From: support Date: Mon, 4 Jul 2022 12:03:23 +0000 (+0000) Subject: Built motion from commit ed019234.|2.6.12 X-Git-Url: http://repos.xcallymotion.com/?a=commitdiff_plain;h=437eec482f6a02bfd559e01d777e18639cd35a80;p=motion2.git Built motion from commit ed019234.|2.6.12 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index ac78730..be24adf 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-04T11:40:26.680Z", + "time": "2022-07-04T11:55:41.803Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 02bc81b..05ec801 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-04T11:40:26.680Z", + "time": "2022-07-04T11:55:41.803Z", "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 c79ace0..fff3770 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 _0x61bb=['urlForward[body]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','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[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x3df822,_0x299495){var _0x4e457d=function(_0x68a45f){while(--_0x68a45f){_0x3df822['push'](_0x3df822['shift']());}};_0x4e457d(++_0x299495);}(_0x61bb,0xa1));var _0xb61b=function(_0x203351,_0xafbd3b){_0x203351=_0x203351-0x0;var _0x995a89=_0x61bb[_0x203351];return _0x995a89;};'use strict';var Sequelize=require('sequelize');module[_0xb61b('0x0')]={'name':{'type':Sequelize[_0xb61b('0x1')],'get':function(_0xc586c2){return this[_0xb61b('0x2')](_0xb61b('0x3'));}},'action':{'type':Sequelize[_0xb61b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb61b('0x5'),_0xb61b('0x6'),_0xb61b('0x7'),_0xb61b('0x8'),_0xb61b('0x9'),_0xb61b('0xa'),_0xb61b('0xb'),_0xb61b('0xc')]],'msg':_0xb61b('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0xb61b('0x4')](0x1000),'comment':_0xb61b('0xe')},'data3':{'type':Sequelize[_0xb61b('0x4')](0x1000),'comment':_0xb61b('0xf')},'data4':{'type':Sequelize[_0xb61b('0x4')](0x1000),'comments':_0xb61b('0x10')},'data5':{'type':Sequelize[_0xb61b('0x4')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xb61b('0x4')],'comments':_0xb61b('0x11')},'data7':{'type':Sequelize[_0xb61b('0x12')],'comments':_0xb61b('0x13')}}; \ No newline at end of file +var _0xaaaf=['urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','STRING','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','exports','action','contactManager','integration','motionbar','jscripty'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0xaaaf,0x108));var _0xfaaa=function(_0x2e0c37,_0x1dcceb){_0x2e0c37=_0x2e0c37-0x0;var _0x3357c5=_0xaaaf[_0x2e0c37];return _0x3357c5;};'use strict';var Sequelize=require('sequelize');module[_0xfaaa('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a6f16){return this['getDataValue'](_0xfaaa('0x1'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xfaaa('0x2'),_0xfaaa('0x3'),_0xfaaa('0x4'),_0xfaaa('0x5'),_0xfaaa('0x6'),_0xfaaa('0x7'),_0xfaaa('0x8'),_0xfaaa('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xfaaa('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xfaaa('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xfaaa('0xc')},'data3':{'type':Sequelize[_0xfaaa('0xd')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xfaaa('0xe')},'data5':{'type':Sequelize[_0xfaaa('0xd')](0x1000),'comments':_0xfaaa('0xf')},'data6':{'type':Sequelize[_0xfaaa('0xd')],'comments':_0xfaaa('0x10')},'data7':{'type':Sequelize[_0xfaaa('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index fec5ac7..b79ce9d 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 _0x62c9=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','find','params','body','catch','Action','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x49939f,_0x2695f3){var _0x1cfcac=function(_0x300216){while(--_0x300216){_0x49939f['push'](_0x49939f['shift']());}};_0x1cfcac(++_0x2695f3);}(_0x62c9,0x1cb));var _0x962c=function(_0x22c50d,_0x3b5e79){_0x22c50d=_0x22c50d-0x0;var _0x1cc24d=_0x62c9[_0x22c50d];return _0x1cc24d;};'use strict';var emlformat=require(_0x962c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x962c('0x1'));var rp=require(_0x962c('0x2'));var moment=require(_0x962c('0x3'));var BPromise=require(_0x962c('0x4'));var Mustache=require(_0x962c('0x5'));var util=require(_0x962c('0x6'));var path=require(_0x962c('0x7'));var sox=require(_0x962c('0x8'));var csv=require('to-csv');var ejs=require(_0x962c('0x9'));var fs=require('fs');var fs_extra=require(_0x962c('0xa'));var _=require('lodash');var squel=require(_0x962c('0xb'));var crypto=require(_0x962c('0xc'));var jsforce=require(_0x962c('0xd'));var deskjs=require(_0x962c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x962c('0xf'));var Papa=require(_0x962c('0x10'));var Redis=require(_0x962c('0x11'));var authService=require(_0x962c('0x12'));var qs=require(_0x962c('0x13'));var as=require(_0x962c('0x14'));var hardwareService=require(_0x962c('0x15'));var logger=require('../../config/logger')(_0x962c('0x16'));var utils=require(_0x962c('0x17'));var config=require(_0x962c('0x18'));var licenseUtil=require(_0x962c('0x19'));var db=require(_0x962c('0x1a'))['db'];function respondWithStatusCode(_0x1bbbd8,_0x5ae9ec){_0x5ae9ec=_0x5ae9ec||0xcc;return function(_0x19f00c){if(_0x19f00c){return _0x1bbbd8[_0x962c('0x1b')](_0x5ae9ec);}return _0x1bbbd8[_0x962c('0x1c')](_0x5ae9ec)[_0x962c('0x1d')]();};}function respondWithResult(_0x3c7a8e,_0x16a619){_0x16a619=_0x16a619||0xc8;return function(_0x49368c){if(_0x49368c){return _0x3c7a8e[_0x962c('0x1c')](_0x16a619)[_0x962c('0x1e')](_0x49368c);}};}function respondWithFilteredResult(_0x5d0e01,_0x497bf5){return function(_0x3eed12){if(_0x3eed12){var _0x2a2067=typeof _0x497bf5[_0x962c('0x1f')]===_0x962c('0x20')&&typeof _0x497bf5[_0x962c('0x21')]===_0x962c('0x20');var _0x1d12bf=_0x3eed12[_0x962c('0x22')];var _0x1e5ba4=_0x2a2067?0x0:_0x497bf5[_0x962c('0x1f')];var _0x3ec2c2=_0x2a2067?_0x3eed12[_0x962c('0x22')]:_0x497bf5[_0x962c('0x1f')]+_0x497bf5[_0x962c('0x21')];var _0x5966e6;if(_0x3ec2c2>=_0x1d12bf){_0x3ec2c2=_0x1d12bf;_0x5966e6=0xc8;}else{_0x5966e6=0xce;}_0x5d0e01[_0x962c('0x1c')](_0x5966e6);return _0x5d0e01[_0x962c('0x23')](_0x962c('0x24'),_0x1e5ba4+'-'+_0x3ec2c2+'/'+_0x1d12bf)[_0x962c('0x1e')](_0x3eed12);}return null;};}function patchUpdates(_0x1483a2){return function(_0x2ac8e7){try{jsonpatch[_0x962c('0x25')](_0x2ac8e7,_0x1483a2,!![]);}catch(_0x69bc59){return BPromise[_0x962c('0x26')](_0x69bc59);}return _0x2ac8e7[_0x962c('0x27')]();};}function saveUpdates(_0x392f8c,_0x45732d){return function(_0x54a466){if(_0x54a466){return _0x54a466[_0x962c('0x28')](_0x392f8c)[_0x962c('0x29')](function(_0x5605f7){return _0x5605f7;});}return null;};}function removeEntity(_0x4bd887,_0x773902){return function(_0x1e64ef){if(_0x1e64ef){return _0x1e64ef['destroy']()[_0x962c('0x29')](function(){_0x4bd887[_0x962c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389cbb,_0x365d94){return function(_0x11d516){if(!_0x11d516){_0x389cbb['sendStatus'](0x194);}return _0x11d516;};}function handleError(_0x26415,_0x5446b5){_0x5446b5=_0x5446b5||0x1f4;return function(_0x117e2d){logger[_0x962c('0x2a')](_0x117e2d[_0x962c('0x2b')]);if(_0x117e2d['name']){delete _0x117e2d['name'];}_0x26415[_0x962c('0x1c')](_0x5446b5)['send'](_0x117e2d);};}exports['update']=function(_0x33e0d4,_0x1ad09c){if(_0x33e0d4['body']['id']){delete _0x33e0d4['body']['id'];}return db['Action'][_0x962c('0x2c')]({'where':{'id':_0x33e0d4[_0x962c('0x2d')]['id']}})[_0x962c('0x29')](handleEntityNotFound(_0x1ad09c,null))[_0x962c('0x29')](saveUpdates(_0x33e0d4[_0x962c('0x2e')],null))[_0x962c('0x29')](respondWithResult(_0x1ad09c,null))[_0x962c('0x2f')](handleError(_0x1ad09c,null));};exports['destroy']=function(_0x1ac78f,_0x3fadb5){return db[_0x962c('0x30')][_0x962c('0x2c')]({'where':{'id':_0x1ac78f[_0x962c('0x2d')]['id']}})[_0x962c('0x29')](handleEntityNotFound(_0x3fadb5,null))[_0x962c('0x29')](removeEntity(_0x3fadb5,null))['catch'](handleError(_0x3fadb5,null));}; \ No newline at end of file +var _0xcf84=['status','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','body','Action','find','params','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x620d02,_0x3767ec){var _0x5c5206=function(_0x3f9465){while(--_0x3f9465){_0x620d02['push'](_0x620d02['shift']());}};_0x5c5206(++_0x3767ec);}(_0xcf84,0x149));var _0x4cf8=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xcf84[_0x1d50f2];return _0x3769b8;};'use strict';var emlformat=require(_0x4cf8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4cf8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4cf8('0x2'));var moment=require(_0x4cf8('0x3'));var BPromise=require(_0x4cf8('0x4'));var Mustache=require(_0x4cf8('0x5'));var util=require('util');var path=require(_0x4cf8('0x6'));var sox=require(_0x4cf8('0x7'));var csv=require(_0x4cf8('0x8'));var ejs=require(_0x4cf8('0x9'));var fs=require('fs');var fs_extra=require(_0x4cf8('0xa'));var _=require(_0x4cf8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4cf8('0xc'));var toCsv=require(_0x4cf8('0x8'));var querystring=require(_0x4cf8('0xd'));var Papa=require('papaparse');var Redis=require(_0x4cf8('0xe'));var authService=require(_0x4cf8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4cf8('0x10'));var hardwareService=require(_0x4cf8('0x11'));var logger=require(_0x4cf8('0x12'))(_0x4cf8('0x13'));var utils=require(_0x4cf8('0x14'));var config=require(_0x4cf8('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f152a,_0x4dee52){_0x4dee52=_0x4dee52||0xcc;return function(_0xc6f803){if(_0xc6f803){return _0x5f152a[_0x4cf8('0x16')](_0x4dee52);}return _0x5f152a['status'](_0x4dee52)['end']();};}function respondWithResult(_0x33ac06,_0x5af769){_0x5af769=_0x5af769||0xc8;return function(_0x42bdf3){if(_0x42bdf3){return _0x33ac06[_0x4cf8('0x17')](_0x5af769)['json'](_0x42bdf3);}};}function respondWithFilteredResult(_0x349a5d,_0x4dacbd){return function(_0x21853a){if(_0x21853a){var _0x510ac4=typeof _0x4dacbd['offset']===_0x4cf8('0x18')&&typeof _0x4dacbd[_0x4cf8('0x19')]===_0x4cf8('0x18');var _0x483fcc=_0x21853a['count'];var _0x3338d2=_0x510ac4?0x0:_0x4dacbd[_0x4cf8('0x1a')];var _0x3b85eb=_0x510ac4?_0x21853a['count']:_0x4dacbd['offset']+_0x4dacbd[_0x4cf8('0x19')];var _0x32e9e6;if(_0x3b85eb>=_0x483fcc){_0x3b85eb=_0x483fcc;_0x32e9e6=0xc8;}else{_0x32e9e6=0xce;}_0x349a5d[_0x4cf8('0x17')](_0x32e9e6);return _0x349a5d[_0x4cf8('0x1b')](_0x4cf8('0x1c'),_0x3338d2+'-'+_0x3b85eb+'/'+_0x483fcc)['json'](_0x21853a);}return null;};}function patchUpdates(_0x24db60){return function(_0x22c81d){try{jsonpatch[_0x4cf8('0x1d')](_0x22c81d,_0x24db60,!![]);}catch(_0x133ecb){return BPromise[_0x4cf8('0x1e')](_0x133ecb);}return _0x22c81d[_0x4cf8('0x1f')]();};}function saveUpdates(_0x52a76b,_0x49f604){return function(_0x2e1209){if(_0x2e1209){return _0x2e1209[_0x4cf8('0x20')](_0x52a76b)[_0x4cf8('0x21')](function(_0x5bd88d){return _0x5bd88d;});}return null;};}function removeEntity(_0x257b03,_0x49f9ff){return function(_0x5aad33){if(_0x5aad33){return _0x5aad33['destroy']()[_0x4cf8('0x21')](function(){_0x257b03[_0x4cf8('0x17')](0xcc)[_0x4cf8('0x22')]();});}};}function handleEntityNotFound(_0x17de97,_0x193222){return function(_0x15c2ef){if(!_0x15c2ef){_0x17de97[_0x4cf8('0x16')](0x194);}return _0x15c2ef;};}function handleError(_0x1d3e39,_0x18ab58){_0x18ab58=_0x18ab58||0x1f4;return function(_0x158c31){logger[_0x4cf8('0x23')](_0x158c31[_0x4cf8('0x24')]);if(_0x158c31['name']){delete _0x158c31[_0x4cf8('0x25')];}_0x1d3e39[_0x4cf8('0x17')](_0x18ab58)[_0x4cf8('0x26')](_0x158c31);};}exports[_0x4cf8('0x20')]=function(_0x5197df,_0x3e3162){if(_0x5197df[_0x4cf8('0x27')]['id']){delete _0x5197df[_0x4cf8('0x27')]['id'];}return db[_0x4cf8('0x28')][_0x4cf8('0x29')]({'where':{'id':_0x5197df[_0x4cf8('0x2a')]['id']}})[_0x4cf8('0x21')](handleEntityNotFound(_0x3e3162,null))[_0x4cf8('0x21')](saveUpdates(_0x5197df[_0x4cf8('0x27')],null))[_0x4cf8('0x21')](respondWithResult(_0x3e3162,null))[_0x4cf8('0x2b')](handleError(_0x3e3162,null));};exports['destroy']=function(_0x19fc48,_0x2f82d6){return db[_0x4cf8('0x28')][_0x4cf8('0x29')]({'where':{'id':_0x19fc48[_0x4cf8('0x2a')]['id']}})[_0x4cf8('0x21')](handleEntityNotFound(_0x2f82d6,null))[_0x4cf8('0x21')](removeEntity(_0x2f82d6,null))[_0x4cf8('0x2b')](handleError(_0x2f82d6,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2cd0a33..9256c32 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 _0x1485=['bluebird','rimraf','./action.attributes','Action','lodash','util','../../config/logger','api','moment'];(function(_0x1e1436,_0x57a41f){var _0x224211=function(_0x4eb37a){while(--_0x4eb37a){_0x1e1436['push'](_0x1e1436['shift']());}};_0x224211(++_0x57a41f);}(_0x1485,0xca));var _0x5148=function(_0x839611,_0x54a00b){_0x839611=_0x839611-0x0;var _0x131e80=_0x1485[_0x839611];return _0x131e80;};'use strict';var _=require(_0x5148('0x0'));var util=require(_0x5148('0x1'));var logger=require(_0x5148('0x2'))(_0x5148('0x3'));var moment=require(_0x5148('0x4'));var BPromise=require(_0x5148('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5148('0x6'));var config=require('../../config/environment');var attributes=require(_0x5148('0x7'));module['exports']=function(_0x47922d,_0x5228cb){return _0x47922d['define'](_0x5148('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34f9=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./action.attributes','define','tools_actions','lodash'];(function(_0xff1c47,_0x358ce3){var _0x35c081=function(_0x1a8353){while(--_0x1a8353){_0xff1c47['push'](_0xff1c47['shift']());}};_0x35c081(++_0x358ce3);}(_0x34f9,0xfb));var _0x934f=function(_0x19cdd2,_0x1d6589){_0x19cdd2=_0x19cdd2-0x0;var _0x28be8f=_0x34f9[_0x19cdd2];return _0x28be8f;};'use strict';var _=require(_0x934f('0x0'));var util=require(_0x934f('0x1'));var logger=require(_0x934f('0x2'))(_0x934f('0x3'));var moment=require(_0x934f('0x4'));var BPromise=require(_0x934f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x934f('0x6'));var rimraf=require(_0x934f('0x7'));var config=require(_0x934f('0x8'));var attributes=require(_0x934f('0x9'));module['exports']=function(_0x2f1329,_0x1be01d){return _0x2f1329[_0x934f('0xa')]('Action',attributes,{'tableName':_0x934f('0xb'),'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 6b4673b..e403a08 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7217,0x19e));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ 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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5a6bc2,_0x2be149){_0x5a6bc2=_0x5a6bc2-0x0;var _0x26da36=_0x1cb9[_0x5a6bc2];return _0x26da36;};'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 df6e3fa..e607106 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 _0x549f=['../../config/environment','./action.controller','put','isAuthenticated','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x56e1f1,_0x433412){var _0x5a7b9d=function(_0x13248b){while(--_0x13248b){_0x56e1f1['push'](_0x56e1f1['shift']());}};_0x5a7b9d(++_0x433412);}(_0x549f,0xde));var _0xf549=function(_0x1c3abf,_0x2bdfdf){_0x1c3abf=_0x1c3abf-0x0;var _0x44c290=_0x549f[_0x1c3abf];return _0x44c290;};'use strict';var multer=require(_0xf549('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf549('0x1'));var express=require(_0xf549('0x2'));var router=express[_0xf549('0x3')]();var fs_extra=require(_0xf549('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf549('0x5'));var config=require(_0xf549('0x6'));var controller=require(_0xf549('0x7'));router[_0xf549('0x8')]('/:id',auth[_0xf549('0x9')](),controller[_0xf549('0xa')]);router['delete']('/:id',auth[_0xf549('0x9')](),controller[_0xf549('0xb')]);module['exports']=router; \ No newline at end of file +var _0xec38=['../../components/auth/service','./action.controller','put','/:id','isAuthenticated','delete','destroy','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xec38,0x18e));var _0x8ec3=function(_0x1eb6ea,_0x55050e){_0x1eb6ea=_0x1eb6ea-0x0;var _0x17a663=_0xec38[_0x1eb6ea];return _0x17a663;};'use strict';var multer=require('multer');var util=require(_0x8ec3('0x0'));var path=require(_0x8ec3('0x1'));var timeout=require(_0x8ec3('0x2'));var express=require(_0x8ec3('0x3'));var router=express['Router']();var fs_extra=require(_0x8ec3('0x4'));var auth=require(_0x8ec3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8ec3('0x6'));router[_0x8ec3('0x7')](_0x8ec3('0x8'),auth[_0x8ec3('0x9')](),controller['update']);router[_0x8ec3('0xa')](_0x8ec3('0x8'),auth[_0x8ec3('0x9')](),controller[_0x8ec3('0xb')]);module[_0x8ec3('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index b5e8e53..a3c91b9 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 _0x8958=['TEXT','exports'];(function(_0x36fe46,_0x40010c){var _0x4d2e9c=function(_0x2dfa20){while(--_0x2dfa20){_0x36fe46['push'](_0x36fe46['shift']());}};_0x4d2e9c(++_0x40010c);}(_0x8958,0x93));var _0x8895=function(_0x3fd24a,_0x29526a){_0x3fd24a=_0x3fd24a-0x0;var _0x19499d=_0x8958[_0x3fd24a];return _0x19499d;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x8958=['TEXT','exports'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0x8958,0x93));var _0x8895=function(_0x57b9f9,_0x2241e4){_0x57b9f9=_0x57b9f9-0x0;var _0x5183a8=_0x8958[_0x57b9f9];return _0x5183a8;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 8488b94..14a7d05 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 _0x3f74=['name','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','cross_join','SUM(%s)','COUNT(%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)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','AnalyticMetric','foreignKey','fullPath','%s-%s.%s','randomstring','generate','output','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','../../files/reports','COUNT(*)','run','right_join','IS\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','undefined','offset','count','Content-Range','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack'];(function(_0x550fe1,_0x2ee147){var _0x1a9e39=function(_0x4632d6){while(--_0x4632d6){_0x550fe1['push'](_0x550fe1['shift']());}};_0x1a9e39(++_0x2ee147);}(_0x3f74,0x121));var _0x43f7=function(_0x13fbbb,_0x40907c){_0x13fbbb=_0x13fbbb-0x0;var _0x24220c=_0x3f74[_0x13fbbb];return _0x24220c;};'use strict';var emlformat=require(_0x43f7('0x0'));var rimraf=require(_0x43f7('0x1'));var zipdir=require(_0x43f7('0x2'));var jsonpatch=require(_0x43f7('0x3'));var rp=require(_0x43f7('0x4'));var moment=require(_0x43f7('0x5'));var BPromise=require(_0x43f7('0x6'));var Mustache=require(_0x43f7('0x7'));var util=require('util');var path=require(_0x43f7('0x8'));var sox=require(_0x43f7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43f7('0xa'));var _=require('lodash');var squel=require(_0x43f7('0xb'));var crypto=require('crypto');var jsforce=require(_0x43f7('0xc'));var deskjs=require(_0x43f7('0xd'));var toCsv=require(_0x43f7('0xe'));var querystring=require(_0x43f7('0xf'));var Papa=require(_0x43f7('0x10'));var Redis=require('ioredis');var authService=require(_0x43f7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x43f7('0x12'));var hardwareService=require(_0x43f7('0x13'));var logger=require('../../config/logger')(_0x43f7('0x14'));var utils=require(_0x43f7('0x15'));var config=require(_0x43f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x43f7('0x17'))['db'];var dbH=require(_0x43f7('0x17'))[_0x43f7('0x18')];function respondWithStatusCode(_0x14abd8,_0x38c349){_0x38c349=_0x38c349||0xcc;return function(_0x2b2da3){if(_0x2b2da3){return _0x14abd8[_0x43f7('0x19')](_0x38c349);}return _0x14abd8[_0x43f7('0x1a')](_0x38c349)[_0x43f7('0x1b')]();};}function respondWithResult(_0x1ba361,_0x158fe9){_0x158fe9=_0x158fe9||0xc8;return function(_0x30856b){if(_0x30856b){return _0x1ba361[_0x43f7('0x1a')](_0x158fe9)[_0x43f7('0x1c')](_0x30856b);}};}function respondWithFilteredResult(_0x1775b5,_0x2316fa){return function(_0x41d7d9){if(_0x41d7d9){var _0x155bdc=typeof _0x2316fa['offset']===_0x43f7('0x1d')&&typeof _0x2316fa['limit']==='undefined';var _0x3d8571=_0x41d7d9['count'];var _0x44380f=_0x155bdc?0x0:_0x2316fa[_0x43f7('0x1e')];var _0x415f0b=_0x155bdc?_0x41d7d9[_0x43f7('0x1f')]:_0x2316fa[_0x43f7('0x1e')]+_0x2316fa['limit'];var _0x83d922;if(_0x415f0b>=_0x3d8571){_0x415f0b=_0x3d8571;_0x83d922=0xc8;}else{_0x83d922=0xce;}_0x1775b5[_0x43f7('0x1a')](_0x83d922);return _0x1775b5['set'](_0x43f7('0x20'),_0x44380f+'-'+_0x415f0b+'/'+_0x3d8571)['json'](_0x41d7d9);}return null;};}function patchUpdates(_0x3ff7f6){return function(_0x246e06){try{jsonpatch[_0x43f7('0x21')](_0x246e06,_0x3ff7f6,!![]);}catch(_0x22c208){return BPromise[_0x43f7('0x22')](_0x22c208);}return _0x246e06[_0x43f7('0x23')]();};}function saveUpdates(_0x1d15e9,_0x19a2f5){return function(_0x35c9ab){if(_0x35c9ab){return _0x35c9ab[_0x43f7('0x24')](_0x1d15e9)[_0x43f7('0x25')](function(_0x4e6e98){return _0x4e6e98;});}return null;};}function removeEntity(_0x313965,_0x2ca45a){return function(_0x2b805d){if(_0x2b805d){return _0x2b805d[_0x43f7('0x26')]()['then'](function(){var _0x2d7b3a=_0x2b805d['get']({'plain':!![]});var _0x173cf9=_0x43f7('0x27');return db[_0x43f7('0x28')][_0x43f7('0x26')]({'where':{'type':_0x173cf9,'resourceId':_0x2d7b3a['id']}})[_0x43f7('0x25')](function(){return _0x2b805d;});})[_0x43f7('0x25')](function(){_0x313965[_0x43f7('0x1a')](0xcc)[_0x43f7('0x1b')]();});}};}function handleEntityNotFound(_0x1d3ee5,_0x18324c){return function(_0x294b7d){if(!_0x294b7d){_0x1d3ee5[_0x43f7('0x19')](0x194);}return _0x294b7d;};}function handleError(_0x4819b1,_0xf1e837){_0xf1e837=_0xf1e837||0x1f4;return function(_0x1bdd3c){logger[_0x43f7('0x29')](_0x1bdd3c[_0x43f7('0x2a')]);if(_0x1bdd3c[_0x43f7('0x2b')]){delete _0x1bdd3c['name'];}_0x4819b1[_0x43f7('0x1a')](_0xf1e837)['send'](_0x1bdd3c);};}exports['index']=function(_0xb0f888,_0x1b9ca5){var _0x5dd95a={},_0x490561={},_0x198d56={'count':0x0,'rows':[]};var _0x58af2b=_[_0x43f7('0x2c')](db[_0x43f7('0x2d')][_0x43f7('0x2e')],function(_0x36e043){return{'name':_0x36e043[_0x43f7('0x2f')],'type':_0x36e043['type'][_0x43f7('0x30')]};});_0x490561[_0x43f7('0x31')]=_[_0x43f7('0x2c')](_0x58af2b,_0x43f7('0x2b'));_0x490561[_0x43f7('0x32')]=_[_0x43f7('0x33')](_0xb0f888['query']);_0x490561[_0x43f7('0x34')]=_[_0x43f7('0x35')](_0x490561[_0x43f7('0x31')],_0x490561[_0x43f7('0x32')]);_0x5dd95a[_0x43f7('0x36')]=_[_0x43f7('0x35')](_0x490561[_0x43f7('0x31')],qs['fields'](_0xb0f888[_0x43f7('0x32')][_0x43f7('0x37')]));_0x5dd95a['attributes']=_0x5dd95a['attributes']['length']?_0x5dd95a[_0x43f7('0x36')]:_0x490561['model'];if(!_0xb0f888[_0x43f7('0x32')][_0x43f7('0x38')](_0x43f7('0x39'))){_0x5dd95a[_0x43f7('0x3a')]=qs['limit'](_0xb0f888[_0x43f7('0x32')][_0x43f7('0x3a')]);_0x5dd95a[_0x43f7('0x1e')]=qs[_0x43f7('0x1e')](_0xb0f888[_0x43f7('0x32')][_0x43f7('0x1e')]);}_0x5dd95a[_0x43f7('0x3b')]=qs[_0x43f7('0x3c')](_0xb0f888[_0x43f7('0x32')][_0x43f7('0x3c')]);_0x5dd95a[_0x43f7('0x3d')]=qs[_0x43f7('0x34')](_[_0x43f7('0x3e')](_0xb0f888[_0x43f7('0x32')],_0x490561[_0x43f7('0x34')]),_0x58af2b);if(_0xb0f888[_0x43f7('0x32')][_0x43f7('0x3f')]){_0x5dd95a[_0x43f7('0x3d')]=_['merge'](_0x5dd95a['where'],{'$or':_[_0x43f7('0x2c')](_0x58af2b,function(_0x75efcc){if(_0x75efcc['type']!==_0x43f7('0x40')){var _0xbdfbe2={};_0xbdfbe2[_0x75efcc[_0x43f7('0x2b')]]={'$like':'%'+_0xb0f888['query'][_0x43f7('0x3f')]+'%'};return _0xbdfbe2;}})});}_0x5dd95a=_[_0x43f7('0x41')]({},_0x5dd95a,_0xb0f888[_0x43f7('0x42')]);var _0x27978b={'where':_0x5dd95a[_0x43f7('0x3d')]};return db[_0x43f7('0x2d')][_0x43f7('0x1f')](_0x27978b)[_0x43f7('0x25')](function(_0x84ee14){_0x198d56[_0x43f7('0x1f')]=_0x84ee14;if(_0xb0f888['query'][_0x43f7('0x43')]){_0x5dd95a[_0x43f7('0x44')]=[{'all':!![]}];}return db[_0x43f7('0x2d')][_0x43f7('0x45')](_0x5dd95a);})[_0x43f7('0x25')](function(_0x27558c){_0x198d56['rows']=_0x27558c;return _0x198d56;})[_0x43f7('0x25')](respondWithFilteredResult(_0x1b9ca5,_0x5dd95a))[_0x43f7('0x46')](handleError(_0x1b9ca5,null));};exports[_0x43f7('0x47')]=function(_0x12e7ee,_0xfdb614){var _0x2a9448={'raw':![],'where':{'id':_0x12e7ee[_0x43f7('0x48')]['id']}},_0x2ae565={};_0x2ae565[_0x43f7('0x31')]=_[_0x43f7('0x33')](db[_0x43f7('0x2d')]['rawAttributes']);_0x2ae565['query']=_[_0x43f7('0x33')](_0x12e7ee[_0x43f7('0x32')]);_0x2ae565[_0x43f7('0x34')]=_[_0x43f7('0x35')](_0x2ae565[_0x43f7('0x31')],_0x2ae565[_0x43f7('0x32')]);_0x2a9448[_0x43f7('0x36')]=_['intersection'](_0x2ae565[_0x43f7('0x31')],qs[_0x43f7('0x37')](_0x12e7ee['query']['fields']));_0x2a9448[_0x43f7('0x36')]=_0x2a9448[_0x43f7('0x36')][_0x43f7('0x49')]?_0x2a9448[_0x43f7('0x36')]:_0x2ae565[_0x43f7('0x31')];if(_0x12e7ee[_0x43f7('0x32')][_0x43f7('0x43')]){_0x2a9448[_0x43f7('0x44')]=[{'all':!![]}];}_0x2a9448=_['merge']({},_0x2a9448,_0x12e7ee[_0x43f7('0x42')]);return db[_0x43f7('0x2d')][_0x43f7('0x4a')](_0x2a9448)['then'](handleEntityNotFound(_0xfdb614,null))[_0x43f7('0x25')](respondWithResult(_0xfdb614,null))[_0x43f7('0x46')](handleError(_0xfdb614,null));};exports['create']=function(_0xade160,_0x588f38){return db[_0x43f7('0x2d')][_0x43f7('0x4b')](_0xade160['body'],{})[_0x43f7('0x25')](function(_0x15fecf){var _0x462cb0=_0xade160['user'][_0x43f7('0x4c')]({'plain':!![]});if(!_0x462cb0)throw new Error(_0x43f7('0x4d'));if(_0x462cb0['role']==='user'){var _0x3a65d6=_0x15fecf['get']({'plain':!![]});var _0x3dcbea=_0x43f7('0x4e');return db[_0x43f7('0x4f')][_0x43f7('0x4a')]({'where':{'name':_0x3dcbea,'userProfileId':_0x462cb0[_0x43f7('0x50')]},'raw':!![]})[_0x43f7('0x25')](function(_0x19fffd){if(_0x19fffd&&_0x19fffd[_0x43f7('0x51')]===0x0){return db[_0x43f7('0x28')][_0x43f7('0x4b')]({'name':_0x3a65d6[_0x43f7('0x2b')],'resourceId':_0x3a65d6['id'],'type':_0x43f7('0x27'),'sectionId':_0x19fffd['id']},{})[_0x43f7('0x25')](function(){return _0x15fecf;});}else{return _0x15fecf;}})[_0x43f7('0x46')](function(_0x2783eb){logger['error'](_0x43f7('0x52'),_0x2783eb);throw _0x2783eb;});}return _0x15fecf;})[_0x43f7('0x25')](respondWithResult(_0x588f38,0xc9))[_0x43f7('0x46')](handleError(_0x588f38,null));};exports['update']=function(_0x3466e6,_0x256717){if(_0x3466e6['body']['id']){delete _0x3466e6[_0x43f7('0x53')]['id'];}return db[_0x43f7('0x2d')]['find']({'where':{'id':_0x3466e6[_0x43f7('0x48')]['id']}})[_0x43f7('0x25')](handleEntityNotFound(_0x256717,null))[_0x43f7('0x25')](saveUpdates(_0x3466e6[_0x43f7('0x53')],null))['then'](respondWithResult(_0x256717,null))[_0x43f7('0x46')](handleError(_0x256717,null));};exports['destroy']=function(_0xb6386,_0x4bde9a){return db[_0x43f7('0x2d')]['find']({'where':{'id':_0xb6386[_0x43f7('0x48')]['id']}})[_0x43f7('0x25')](handleEntityNotFound(_0x4bde9a,null))[_0x43f7('0x25')](removeEntity(_0x4bde9a,null))['catch'](handleError(_0x4bde9a,null));};exports[_0x43f7('0x54')]=function(_0x53afdf,_0x2b92e5){var _0x57932f=0xa;var _0x507707=[_0x43f7('0x55'),'left_join','right_join',_0x43f7('0x56')];var _0x596ed5={'SUM':_0x43f7('0x57'),'COUNT':_0x43f7('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x43f7('0x59'),'AVG':_0x43f7('0x5a'),'GROUP_CONCAT':_0x43f7('0x5b'),'GROUP_CONCAT ASC':_0x43f7('0x5c'),'GROUP_CONCAT DESC':_0x43f7('0x5d')};var _0x47ed29={'SEC_TO_TIME':_0x43f7('0x5e'),'DATE':_0x43f7('0x5f'),'HOUR':_0x43f7('0x60'),'ROUND':_0x43f7('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1fae81=function(_0x1774cd){return!_[_0x43f7('0x62')](['IS\x20NULL',_0x43f7('0x63'),_0x43f7('0x64'),'IS\x20NOT\x20EMPTY'],_0x1774cd);};var _0x3dde87=function(_0x131b31){if(!_0x131b31||!_0x131b31[_0x43f7('0x65')][_0x43f7('0x49')]){return'';}for(var _0x293875='(',_0x4e142d=0x0;_0x4e142d<_0x131b31[_0x43f7('0x65')][_0x43f7('0x49')];_0x4e142d+=0x1){_0x4e142d>0x0&&(_0x293875+='\x20'+_0x131b31[_0x43f7('0x66')]+'\x20');_0x293875+=_0x131b31[_0x43f7('0x65')][_0x4e142d]['group']?_0x3dde87(_0x131b31['rules'][_0x4e142d][_0x43f7('0x67')]):_0x131b31[_0x43f7('0x65')][_0x4e142d][_0x43f7('0x68')]+'\x20'+_0x131b31['rules'][_0x4e142d][_0x43f7('0x69')]+(_0x1fae81(_0x131b31[_0x43f7('0x65')][_0x4e142d][_0x43f7('0x69')])?'\x20'+_0x131b31[_0x43f7('0x65')][_0x4e142d][_0x43f7('0x6a')]:'');}return _0x293875+')';};var _0x2f37c9={'where':{'id':_0x53afdf[_0x43f7('0x48')]['id']}},_0x4221a3,_0x268b1f,_0x35a02d,_0x5bb015,_0x1d0651;_0x2f37c9=_[_0x43f7('0x41')]({},_0x2f37c9,_0x53afdf[_0x43f7('0x42')]);return db['AnalyticCustomReport'][_0x43f7('0x4a')](_0x2f37c9)[_0x43f7('0x25')](function(_0x3b657f){if(_0x3b657f){_0x4221a3=_0x3b657f;return _0x3b657f[_0x43f7('0x6b')]();}return null;})['then'](function(_0x56ebd0){if(_0x56ebd0){if(!_0x56ebd0[_0x43f7('0x49')]){throw new db[(_0x43f7('0x6c'))]['ValidationErrorItem'](_0x43f7('0x6d'),0x193);}_0x268b1f=_0x56ebd0;return db['AnalyticMetric'][_0x43f7('0x45')]({'raw':!![]});}return null;})['then'](function(_0x3688ac){if(_0x3688ac){_0x35a02d=_[_0x43f7('0x6e')](_0x3688ac,'id');var _0x2a9fe0;var _0x4e526a=squel[_0x43f7('0x6f')]();_0x4e526a[_0x43f7('0x70')](_0x4221a3[_0x43f7('0x71')]);for(var _0x285e35=0x0;_0x285e35<_0x268b1f[_0x43f7('0x49')];_0x285e35+=0x1){_0x2a9fe0=_0x268b1f[_0x285e35]['MetricId']?_0x35a02d[_0x268b1f[_0x285e35][_0x43f7('0x72')]][_0x43f7('0x73')]:_0x268b1f[_0x285e35][_0x43f7('0x68')];_0x2a9fe0=_0x268b1f[_0x285e35]['function']?_[_0x43f7('0x74')](_0x596ed5[_0x268b1f[_0x285e35][_0x43f7('0x75')]],'%s',_0x2a9fe0):_0x2a9fe0;_0x2a9fe0=_0x268b1f[_0x285e35][_0x43f7('0x76')]?_['replace'](_0x47ed29[_0x268b1f[_0x285e35][_0x43f7('0x76')]],'%s',_0x2a9fe0):_0x2a9fe0;if(_0x268b1f[_0x285e35][_0x43f7('0x77')]){_0x4e526a['group'](_0x2a9fe0);}_0x268b1f[_0x285e35]['orderBy']&&_0x4e526a[_0x43f7('0x3b')](_0x2a9fe0,_0x268b1f[_0x285e35][_0x43f7('0x78')]===_0x43f7('0x79')?![]:!![]);_0x4e526a[_0x43f7('0x68')](_0x2a9fe0,_0x268b1f[_0x285e35][_0x43f7('0x7a')]||_0x2a9fe0);}if(_0x4221a3[_0x43f7('0x7b')]){_0x4221a3['joins']=JSON[_0x43f7('0x7c')](_0x4221a3[_0x43f7('0x7b')]);for(var _0x25ebbb=0x0;_0x25ebbb<_0x4221a3[_0x43f7('0x7b')]['length'];_0x25ebbb+=0x1){if(_0x4221a3[_0x43f7('0x7b')][_0x25ebbb][_0x43f7('0x7d')]&&_['includes'](_0x507707,_0x4221a3[_0x43f7('0x7b')][_0x25ebbb][_0x43f7('0x7d')])&&_0x4221a3[_0x43f7('0x7b')][_0x25ebbb]['parentKey']&&_0x4221a3[_0x43f7('0x7b')][_0x25ebbb][_0x43f7('0x7e')]&&_0x4221a3[_0x43f7('0x7b')][_0x25ebbb]['foreignKey']){_0x4e526a[_0x4221a3['joins'][_0x25ebbb][_0x43f7('0x7d')]](_0x4221a3['joins'][_0x25ebbb]['foreignTable'],null,util[_0x43f7('0x76')](_0x43f7('0x7f'),_0x4221a3[_0x43f7('0x71')],_0x4221a3[_0x43f7('0x7b')][_0x25ebbb][_0x43f7('0x80')],_0x4221a3['joins'][_0x25ebbb][_0x43f7('0x7e')],_0x4221a3[_0x43f7('0x7b')][_0x25ebbb]['foreignKey']));}}}if(_0x4221a3[_0x43f7('0x81')]){_0x4221a3[_0x43f7('0x81')]=JSON[_0x43f7('0x7c')](_0x4221a3['conditions']);_0x4e526a[_0x43f7('0x3d')](_0x3dde87(_0x4221a3[_0x43f7('0x81')][_0x43f7('0x67')]));}_0x1d0651=_0x4e526a[_0x43f7('0x82')]();_0x4e526a[_0x43f7('0x3a')](_0x57932f);_0x4e526a['offset'](0x0);logger[_0x43f7('0x83')](_0x43f7('0x84'),_0x4e526a[_0x43f7('0x85')]());return dbH['sequelize']['query'](_0x4e526a[_0x43f7('0x85')](),{'type':dbH[_0x43f7('0x86')][_0x43f7('0x87')][_0x43f7('0x88')]});}})[_0x43f7('0x25')](respondWithResult(_0x2b92e5,null))[_0x43f7('0x46')](handleError(_0x2b92e5,null));};function runReport(_0x34fda2,_0x314982,_0x15d500){var _0x54e82c=_0x314982[_0x43f7('0x2b')];var _0x4b0477=0xa;var _0x5f0d26=[_0x43f7('0x55'),_0x43f7('0x89'),'right_join',_0x43f7('0x56')];var _0x301ce0={'SUM':'SUM(%s)','COUNT':_0x43f7('0x58'),'COUNT DISTINCT':_0x43f7('0x8a'),'MAX':_0x43f7('0x8b'),'MIN':_0x43f7('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x43f7('0x5c'),'GROUP_CONCAT DESC':_0x43f7('0x5d')};var _0x355cf6={'SEC_TO_TIME':_0x43f7('0x5e'),'DATE':_0x43f7('0x5f'),'HOUR':_0x43f7('0x60'),'ROUND':_0x43f7('0x61'),'UNIX_TIMESTAMP':_0x43f7('0x8c')};var _0xe21fc5=function(_0x3d737d){return!_[_0x43f7('0x62')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x43f7('0x64'),_0x43f7('0x8d')],_0x3d737d);};var _0x3008ab=function(_0x418188){if(!_0x418188||!_0x418188[_0x43f7('0x65')][_0x43f7('0x49')]){return'';}for(var _0x544be1='(',_0x40a9fc=0x0;_0x40a9fc<_0x418188['rules'][_0x43f7('0x49')];_0x40a9fc+=0x1){_0x40a9fc>0x0&&(_0x544be1+='\x20'+_0x418188[_0x43f7('0x66')]+'\x20');_0x544be1+=_0x418188[_0x43f7('0x65')][_0x40a9fc][_0x43f7('0x67')]?_0x3008ab(_0x418188['rules'][_0x40a9fc][_0x43f7('0x67')]):_0x418188[_0x43f7('0x65')][_0x40a9fc][_0x43f7('0x68')]+'\x20'+_0x418188['rules'][_0x40a9fc][_0x43f7('0x69')]+(_0xe21fc5(_0x418188[_0x43f7('0x65')][_0x40a9fc][_0x43f7('0x69')])?'\x20'+_0x418188[_0x43f7('0x65')][_0x40a9fc]['value']:'');}return _0x544be1+')';};var _0x25f130={'where':{'id':_0x34fda2['id']}},_0x425246,_0x74f822,_0x23ff41,_0x59cf40,_0x831560;_0x25f130=_[_0x43f7('0x41')]({},_0x25f130,_0x15d500);return db['AnalyticCustomReport']['find'](_0x25f130)[_0x43f7('0x25')](function(_0x5e7d33){if(_0x5e7d33){_0x425246=_0x5e7d33;return _0x5e7d33[_0x43f7('0x6b')]();}return null;})[_0x43f7('0x25')](function(_0x5452c8){if(_0x5452c8){if(!_0x5452c8['length']){throw new db[(_0x43f7('0x6c'))][(_0x43f7('0x8e'))](_0x43f7('0x6d'),0x193);}_0x74f822=_0x5452c8;return db[_0x43f7('0x8f')][_0x43f7('0x45')]({'raw':!![]});}return null;})['then'](function(_0x1778c3){if(_0x1778c3){_0x23ff41=_[_0x43f7('0x6e')](_0x1778c3,'id');var _0x10e909;var _0x68ca4d=squel[_0x43f7('0x6f')]();_0x68ca4d['from'](_0x425246[_0x43f7('0x71')]);for(var _0x36cdc7=0x0;_0x36cdc7<_0x74f822[_0x43f7('0x49')];_0x36cdc7+=0x1){_0x10e909=_0x74f822[_0x36cdc7]['MetricId']?_0x23ff41[_0x74f822[_0x36cdc7][_0x43f7('0x72')]][_0x43f7('0x73')]:_0x74f822[_0x36cdc7][_0x43f7('0x68')];_0x10e909=_0x74f822[_0x36cdc7]['function']?_[_0x43f7('0x74')](_0x301ce0[_0x74f822[_0x36cdc7]['function']],'%s',_0x10e909):_0x10e909;_0x10e909=_0x74f822[_0x36cdc7]['format']?_[_0x43f7('0x74')](_0x355cf6[_0x74f822[_0x36cdc7][_0x43f7('0x76')]],'%s',_0x10e909):_0x10e909;if(_0x74f822[_0x36cdc7][_0x43f7('0x77')]){_0x68ca4d['group'](_0x10e909);}_0x74f822[_0x36cdc7][_0x43f7('0x78')]&&_0x68ca4d['order'](_0x10e909,_0x74f822[_0x36cdc7]['orderBy']==='DESC'?![]:!![]);_0x68ca4d['field'](_0x10e909,_0x74f822[_0x36cdc7]['alias']||_0x10e909);}if(_0x425246[_0x43f7('0x7b')]){_0x425246[_0x43f7('0x7b')]=JSON[_0x43f7('0x7c')](_0x425246[_0x43f7('0x7b')]);for(var _0x877290=0x0;_0x877290<_0x425246[_0x43f7('0x7b')][_0x43f7('0x49')];_0x877290+=0x1){if(_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x7d')]&&_[_0x43f7('0x62')](_0x5f0d26,_0x425246[_0x43f7('0x7b')][_0x877290]['type'])&&_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x80')]&&_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x7e')]&&_0x425246['joins'][_0x877290][_0x43f7('0x90')]){_0x68ca4d[_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x7d')]](_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x7e')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x425246[_0x43f7('0x71')],_0x425246[_0x43f7('0x7b')][_0x877290]['parentKey'],_0x425246[_0x43f7('0x7b')][_0x877290]['foreignTable'],_0x425246[_0x43f7('0x7b')][_0x877290][_0x43f7('0x90')]));}}}if(_0x425246[_0x43f7('0x81')]){_0x425246[_0x43f7('0x81')]=JSON[_0x43f7('0x7c')](_0x425246[_0x43f7('0x81')]);_0x68ca4d[_0x43f7('0x3d')](_0x3008ab(_0x425246['conditions'][_0x43f7('0x67')]));}_0x831560=_0x68ca4d[_0x43f7('0x82')]();_0x68ca4d[_0x43f7('0x3a')](_0x4b0477);_0x68ca4d[_0x43f7('0x1e')](0x0);return;}})[_0x43f7('0x25')](function(){if(_0x314982['output']==='web'){return null;}var _0xb14a36=_[_0x43f7('0x41')](_0x314982,{'name':_0x314982[_0x43f7('0x91')]||_0x314982[_0x43f7('0x2b')]||_0x425246[_0x43f7('0x2b')],'basename':_0x54e82c,'savename':util[_0x43f7('0x76')](_0x43f7('0x92'),_0x314982[_0x43f7('0x2b')]||_0x425246['name'],require(_0x43f7('0x93'))[_0x43f7('0x94')](0x4),_0x314982[_0x43f7('0x95')]||'csv'),'reportId':_0x425246['id'],'reportType':_0x43f7('0x96')});return db[_0x43f7('0x97')]['create'](_0xb14a36,{'raw':!![]});})[_0x43f7('0x25')](function(_0x36b92c){if(_0x425246[_0x43f7('0x71')]===_0x43f7('0x98')){_0x831560['where'](_0x425246[_0x43f7('0x71')]+_0x43f7('0x99'),_0x314982[_0x43f7('0x9a')],_0x314982[_0x43f7('0x9b')]);}else{_0x831560[_0x43f7('0x3d')](_0x425246[_0x43f7('0x71')]+_0x43f7('0x9c'),_0x314982[_0x43f7('0x9a')],_0x314982['endDate']);}if(_0x36b92c){logger[_0x43f7('0x9d')](_0x43f7('0x9e'),_0x831560[_0x43f7('0x85')]());require('child_process')[_0x43f7('0x9f')](path[_0x43f7('0x55')](__dirname,_0x43f7('0xa0'),_0x36b92c[_0x43f7('0x95')]),[_0x36b92c['id'],_0x831560['toString'](),path[_0x43f7('0x55')](__dirname,_0x43f7('0xa1'),_0x36b92c['savename']),_0x54e82c]);return _0x36b92c;}else{var _0x4dc7fa=squel[_0x43f7('0x6f')]();_0x4dc7fa[_0x43f7('0x70')]('('+_0x831560[_0x43f7('0x85')]()+')','countTable');_0x4dc7fa[_0x43f7('0x68')](_0x43f7('0xa2'),_0x43f7('0x1f'));_0x831560[_0x43f7('0x3a')](_0x314982[_0x43f7('0x3a')]||_0x4b0477);_0x831560[_0x43f7('0x1e')](_0x314982[_0x43f7('0x1e')]||0x0);return dbH[_0x43f7('0x86')][_0x43f7('0x32')](_0x4dc7fa[_0x43f7('0x85')](),{'type':dbH[_0x43f7('0x86')]['QueryTypes'][_0x43f7('0x88')]})['then'](function(_0xc6a3c6){if(!_0xc6a3c6[_0x43f7('0x49')]){_0x59cf40=0x0;}else{_0x59cf40=_0xc6a3c6[0x0][_0x43f7('0x1f')]||0x0;}return dbH[_0x43f7('0x86')][_0x43f7('0x32')](_0x831560[_0x43f7('0x85')](),{'type':dbH[_0x43f7('0x86')][_0x43f7('0x87')][_0x43f7('0x88')]});})[_0x43f7('0x25')](function(_0x5e75a8){return{'rows':_0x5e75a8||[],'count':_0x59cf40};});}});}exports[_0x43f7('0xa3')]=function(_0x54d36d,_0x48bf42){return runReport(_0x54d36d[_0x43f7('0x48')],_0x54d36d[_0x43f7('0x32')],_0x54d36d[_0x43f7('0x42')])[_0x43f7('0x25')](respondWithResult(_0x48bf42,null))['catch'](handleError(_0x48bf42,null));};exports['runReport']=runReport;exports[_0x43f7('0x32')]=function(_0x4303fe,_0x2e9961){var _0x41c636=0xa;var _0x2bf70d=['join',_0x43f7('0x89'),_0x43f7('0xa4'),_0x43f7('0x56')];var _0x5e6f2e={'SUM':_0x43f7('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x43f7('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x43f7('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x565f81={'SEC_TO_TIME':_0x43f7('0x5e'),'DATE':_0x43f7('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x43f7('0x61'),'UNIX_TIMESTAMP':_0x43f7('0x8c')};var _0x2b748e=function(_0x2e574b){return!_['includes']([_0x43f7('0xa5'),'IS\x20NOT\x20NULL',_0x43f7('0x64'),_0x43f7('0x8d')],_0x2e574b);};var _0x1b19d8=function(_0x1b437e){if(!_0x1b437e||!_0x1b437e[_0x43f7('0x65')][_0x43f7('0x49')]){return'';}for(var _0x1ff3fe='(',_0x5c9e35=0x0;_0x5c9e35<_0x1b437e[_0x43f7('0x65')][_0x43f7('0x49')];_0x5c9e35+=0x1){_0x5c9e35>0x0&&(_0x1ff3fe+='\x20'+_0x1b437e[_0x43f7('0x66')]+'\x20');_0x1ff3fe+=_0x1b437e['rules'][_0x5c9e35][_0x43f7('0x67')]?_0x1b19d8(_0x1b437e[_0x43f7('0x65')][_0x5c9e35][_0x43f7('0x67')]):_0x1b437e[_0x43f7('0x65')][_0x5c9e35][_0x43f7('0x68')]+'\x20'+_0x1b437e[_0x43f7('0x65')][_0x5c9e35][_0x43f7('0x69')]+(_0x2b748e(_0x1b437e[_0x43f7('0x65')][_0x5c9e35][_0x43f7('0x69')])?'\x20'+_0x1b437e['rules'][_0x5c9e35][_0x43f7('0x6a')]:'');}return _0x1ff3fe+')';};var _0x3b93e3={'where':{'id':_0x4303fe[_0x43f7('0x48')]['id']}},_0x3d0a3c,_0x2da23a,_0x42afe5,_0x51ffae,_0xb88aa5;_0x3b93e3=_['merge']({},_0x3b93e3,_0x4303fe[_0x43f7('0x42')]);return db[_0x43f7('0x2d')]['find'](_0x3b93e3)[_0x43f7('0x25')](function(_0x5cfba7){if(_0x5cfba7){_0x3d0a3c=_0x5cfba7;return _0x5cfba7[_0x43f7('0x6b')]();}return null;})[_0x43f7('0x25')](function(_0x5d0d15){if(_0x5d0d15){if(!_0x5d0d15['length']){throw new db['Sequelize'][(_0x43f7('0x8e'))](_0x43f7('0x6d'),0x193);}_0x2da23a=_0x5d0d15;return db[_0x43f7('0x8f')][_0x43f7('0x45')]({'raw':!![]});}return null;})[_0x43f7('0x25')](function(_0x2061dd){if(_0x2061dd){_0x42afe5=_[_0x43f7('0x6e')](_0x2061dd,'id');var _0x17dbc1;var _0xc07364=squel[_0x43f7('0x6f')]();_0xc07364['from'](_0x3d0a3c['table']);for(var _0x4488a2=0x0;_0x4488a2<_0x2da23a[_0x43f7('0x49')];_0x4488a2+=0x1){_0x17dbc1=_0x2da23a[_0x4488a2][_0x43f7('0x72')]?_0x42afe5[_0x2da23a[_0x4488a2][_0x43f7('0x72')]][_0x43f7('0x73')]:_0x2da23a[_0x4488a2][_0x43f7('0x68')];_0x17dbc1=_0x2da23a[_0x4488a2][_0x43f7('0x75')]?_[_0x43f7('0x74')](_0x5e6f2e[_0x2da23a[_0x4488a2][_0x43f7('0x75')]],'%s',_0x17dbc1):_0x17dbc1;_0x17dbc1=_0x2da23a[_0x4488a2][_0x43f7('0x76')]?_[_0x43f7('0x74')](_0x565f81[_0x2da23a[_0x4488a2]['format']],'%s',_0x17dbc1):_0x17dbc1;if(_0x2da23a[_0x4488a2]['groupBy']){_0xc07364['group'](_0x17dbc1);}_0x2da23a[_0x4488a2][_0x43f7('0x78')]&&_0xc07364[_0x43f7('0x3b')](_0x17dbc1,_0x2da23a[_0x4488a2]['orderBy']===_0x43f7('0x79')?![]:!![]);_0xc07364['field'](_0x17dbc1,_0x2da23a[_0x4488a2][_0x43f7('0x7a')]||_0x17dbc1);}if(_0x3d0a3c[_0x43f7('0x7b')]){_0x3d0a3c['joins']=JSON[_0x43f7('0x7c')](_0x3d0a3c[_0x43f7('0x7b')]);for(var _0x2cff95=0x0;_0x2cff95<_0x3d0a3c[_0x43f7('0x7b')]['length'];_0x2cff95+=0x1){if(_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x7d')]&&_[_0x43f7('0x62')](_0x2bf70d,_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x7d')])&&_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95]['parentKey']&&_0x3d0a3c['joins'][_0x2cff95][_0x43f7('0x7e')]&&_0x3d0a3c['joins'][_0x2cff95]['foreignKey']){_0xc07364[_0x3d0a3c['joins'][_0x2cff95][_0x43f7('0x7d')]](_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x7e')],null,util['format'](_0x43f7('0x7f'),_0x3d0a3c[_0x43f7('0x71')],_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x80')],_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x7e')],_0x3d0a3c[_0x43f7('0x7b')][_0x2cff95][_0x43f7('0x90')]));}}}if(_0x3d0a3c[_0x43f7('0x81')]){_0x3d0a3c[_0x43f7('0x81')]=JSON['parse'](_0x3d0a3c[_0x43f7('0x81')]);_0xc07364[_0x43f7('0x3d')](_0x1b19d8(_0x3d0a3c[_0x43f7('0x81')][_0x43f7('0x67')]));}_0xb88aa5=_0xc07364[_0x43f7('0x82')]();_0xc07364['limit'](_0x41c636);_0xc07364[_0x43f7('0x1e')](0x0);logger[_0x43f7('0x83')]('Limited\x20Query:',_0xc07364[_0x43f7('0x85')]());return dbH[_0x43f7('0x86')][_0x43f7('0x32')](_0xc07364[_0x43f7('0x85')](),{'type':dbH[_0x43f7('0x86')]['QueryTypes'][_0x43f7('0x88')]});}})['then'](function(){return{'sql':_0xb88aa5[_0x43f7('0x85')]()};})[_0x43f7('0x25')](respondWithResult(_0x2e9961,null))[_0x43f7('0x46')](handleError(_0x2e9961,null));}; \ No newline at end of file +var _0x8a31=['bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','keys','includeAll','find','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','toString','sequelize','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','ValidationErrorItem','output','web','fullPath','randomstring','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','../../files/reports','savename','COUNT(*)','QueryTypes','run','runReport','GROUP_CONCAT(%s)','IS\x20NOT\x20NULL','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5a36ce,_0x3134c3){var _0xcfaadd=function(_0xc23c9f){while(--_0xc23c9f){_0x5a36ce['push'](_0x5a36ce['shift']());}};_0xcfaadd(++_0x3134c3);}(_0x8a31,0xa1));var _0x18a3=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x8a31[_0x120376];return _0x28c529;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x18a3('0x0'));var zipdir=require(_0x18a3('0x1'));var jsonpatch=require(_0x18a3('0x2'));var rp=require(_0x18a3('0x3'));var moment=require('moment');var BPromise=require(_0x18a3('0x4'));var Mustache=require(_0x18a3('0x5'));var util=require(_0x18a3('0x6'));var path=require(_0x18a3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x18a3('0x8'));var fs=require('fs');var fs_extra=require(_0x18a3('0x9'));var _=require(_0x18a3('0xa'));var squel=require(_0x18a3('0xb'));var crypto=require('crypto');var jsforce=require(_0x18a3('0xc'));var deskjs=require(_0x18a3('0xd'));var toCsv=require(_0x18a3('0xe'));var querystring=require(_0x18a3('0xf'));var Papa=require(_0x18a3('0x10'));var Redis=require(_0x18a3('0x11'));var authService=require(_0x18a3('0x12'));var qs=require(_0x18a3('0x13'));var as=require(_0x18a3('0x14'));var hardwareService=require(_0x18a3('0x15'));var logger=require(_0x18a3('0x16'))(_0x18a3('0x17'));var utils=require(_0x18a3('0x18'));var config=require(_0x18a3('0x19'));var licenseUtil=require(_0x18a3('0x1a'));var db=require(_0x18a3('0x1b'))['db'];var dbH=require('../../mysqldb')[_0x18a3('0x1c')];function respondWithStatusCode(_0x1686e7,_0x1cfc96){_0x1cfc96=_0x1cfc96||0xcc;return function(_0x3d4122){if(_0x3d4122){return _0x1686e7[_0x18a3('0x1d')](_0x1cfc96);}return _0x1686e7[_0x18a3('0x1e')](_0x1cfc96)[_0x18a3('0x1f')]();};}function respondWithResult(_0x3df4f6,_0x5fb93a){_0x5fb93a=_0x5fb93a||0xc8;return function(_0x504041){if(_0x504041){return _0x3df4f6[_0x18a3('0x1e')](_0x5fb93a)['json'](_0x504041);}};}function respondWithFilteredResult(_0xdec06e,_0x4c94b2){return function(_0x452f99){if(_0x452f99){var _0x94e0e6=typeof _0x4c94b2[_0x18a3('0x20')]===_0x18a3('0x21')&&typeof _0x4c94b2[_0x18a3('0x22')]===_0x18a3('0x21');var _0xb0f847=_0x452f99[_0x18a3('0x23')];var _0x44e429=_0x94e0e6?0x0:_0x4c94b2[_0x18a3('0x20')];var _0x1e790d=_0x94e0e6?_0x452f99[_0x18a3('0x23')]:_0x4c94b2[_0x18a3('0x20')]+_0x4c94b2[_0x18a3('0x22')];var _0x21eb1c;if(_0x1e790d>=_0xb0f847){_0x1e790d=_0xb0f847;_0x21eb1c=0xc8;}else{_0x21eb1c=0xce;}_0xdec06e[_0x18a3('0x1e')](_0x21eb1c);return _0xdec06e['set']('Content-Range',_0x44e429+'-'+_0x1e790d+'/'+_0xb0f847)[_0x18a3('0x24')](_0x452f99);}return null;};}function patchUpdates(_0x257b1a){return function(_0x5a5b03){try{jsonpatch[_0x18a3('0x25')](_0x5a5b03,_0x257b1a,!![]);}catch(_0x2e402d){return BPromise[_0x18a3('0x26')](_0x2e402d);}return _0x5a5b03[_0x18a3('0x27')]();};}function saveUpdates(_0x5b9f8c,_0x528068){return function(_0x17e1e7){if(_0x17e1e7){return _0x17e1e7[_0x18a3('0x28')](_0x5b9f8c)[_0x18a3('0x29')](function(_0x325cff){return _0x325cff;});}return null;};}function removeEntity(_0x4bbf3b,_0x2ca4){return function(_0x2b0bc0){if(_0x2b0bc0){return _0x2b0bc0[_0x18a3('0x2a')]()['then'](function(){var _0x4ea258=_0x2b0bc0[_0x18a3('0x2b')]({'plain':!![]});var _0x5b4ccc=_0x18a3('0x2c');return db[_0x18a3('0x2d')][_0x18a3('0x2a')]({'where':{'type':_0x5b4ccc,'resourceId':_0x4ea258['id']}})[_0x18a3('0x29')](function(){return _0x2b0bc0;});})[_0x18a3('0x29')](function(){_0x4bbf3b['status'](0xcc)[_0x18a3('0x1f')]();});}};}function handleEntityNotFound(_0x4515ef,_0x51a8c2){return function(_0x540e8c){if(!_0x540e8c){_0x4515ef[_0x18a3('0x1d')](0x194);}return _0x540e8c;};}function handleError(_0x1d18a2,_0x47cac8){_0x47cac8=_0x47cac8||0x1f4;return function(_0x2b06f6){logger[_0x18a3('0x2e')](_0x2b06f6[_0x18a3('0x2f')]);if(_0x2b06f6[_0x18a3('0x30')]){delete _0x2b06f6[_0x18a3('0x30')];}_0x1d18a2[_0x18a3('0x1e')](_0x47cac8)[_0x18a3('0x31')](_0x2b06f6);};}exports['index']=function(_0x42cd87,_0x3a1f04){var _0xe0c5fb={},_0x10d50d={},_0x569e44={'count':0x0,'rows':[]};var _0x4d0f30=_[_0x18a3('0x32')](db[_0x18a3('0x33')][_0x18a3('0x34')],function(_0x9e1e7c){return{'name':_0x9e1e7c['fieldName'],'type':_0x9e1e7c['type'][_0x18a3('0x35')]};});_0x10d50d[_0x18a3('0x36')]=_[_0x18a3('0x32')](_0x4d0f30,_0x18a3('0x30'));_0x10d50d['query']=_['keys'](_0x42cd87[_0x18a3('0x37')]);_0x10d50d[_0x18a3('0x38')]=_['intersection'](_0x10d50d[_0x18a3('0x36')],_0x10d50d[_0x18a3('0x37')]);_0xe0c5fb[_0x18a3('0x39')]=_[_0x18a3('0x3a')](_0x10d50d['model'],qs[_0x18a3('0x3b')](_0x42cd87[_0x18a3('0x37')]['fields']));_0xe0c5fb[_0x18a3('0x39')]=_0xe0c5fb['attributes'][_0x18a3('0x3c')]?_0xe0c5fb['attributes']:_0x10d50d[_0x18a3('0x36')];if(!_0x42cd87[_0x18a3('0x37')][_0x18a3('0x3d')](_0x18a3('0x3e'))){_0xe0c5fb[_0x18a3('0x22')]=qs[_0x18a3('0x22')](_0x42cd87[_0x18a3('0x37')][_0x18a3('0x22')]);_0xe0c5fb[_0x18a3('0x20')]=qs['offset'](_0x42cd87[_0x18a3('0x37')]['offset']);}_0xe0c5fb[_0x18a3('0x3f')]=qs['sort'](_0x42cd87[_0x18a3('0x37')]['sort']);_0xe0c5fb[_0x18a3('0x40')]=qs[_0x18a3('0x38')](_['pick'](_0x42cd87['query'],_0x10d50d[_0x18a3('0x38')]),_0x4d0f30);if(_0x42cd87[_0x18a3('0x37')]['filter']){_0xe0c5fb[_0x18a3('0x40')]=_[_0x18a3('0x41')](_0xe0c5fb[_0x18a3('0x40')],{'$or':_[_0x18a3('0x32')](_0x4d0f30,function(_0x5bec3e){if(_0x5bec3e[_0x18a3('0x42')]!==_0x18a3('0x43')){var _0xc3df19={};_0xc3df19[_0x5bec3e['name']]={'$like':'%'+_0x42cd87[_0x18a3('0x37')][_0x18a3('0x44')]+'%'};return _0xc3df19;}})});}_0xe0c5fb=_['merge']({},_0xe0c5fb,_0x42cd87[_0x18a3('0x45')]);var _0x2a0fa8={'where':_0xe0c5fb[_0x18a3('0x40')]};return db[_0x18a3('0x33')][_0x18a3('0x23')](_0x2a0fa8)[_0x18a3('0x29')](function(_0x22a950){_0x569e44['count']=_0x22a950;if(_0x42cd87[_0x18a3('0x37')]['includeAll']){_0xe0c5fb[_0x18a3('0x46')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x18a3('0x47')](_0xe0c5fb);})[_0x18a3('0x29')](function(_0x41f9df){_0x569e44[_0x18a3('0x48')]=_0x41f9df;return _0x569e44;})[_0x18a3('0x29')](respondWithFilteredResult(_0x3a1f04,_0xe0c5fb))['catch'](handleError(_0x3a1f04,null));};exports[_0x18a3('0x49')]=function(_0x32fee4,_0x8cb3e2){var _0x4a0262={'raw':![],'where':{'id':_0x32fee4['params']['id']}},_0x3d3370={};_0x3d3370[_0x18a3('0x36')]=_[_0x18a3('0x4a')](db[_0x18a3('0x33')]['rawAttributes']);_0x3d3370['query']=_['keys'](_0x32fee4[_0x18a3('0x37')]);_0x3d3370['filters']=_[_0x18a3('0x3a')](_0x3d3370[_0x18a3('0x36')],_0x3d3370['query']);_0x4a0262[_0x18a3('0x39')]=_[_0x18a3('0x3a')](_0x3d3370[_0x18a3('0x36')],qs[_0x18a3('0x3b')](_0x32fee4[_0x18a3('0x37')][_0x18a3('0x3b')]));_0x4a0262[_0x18a3('0x39')]=_0x4a0262['attributes'][_0x18a3('0x3c')]?_0x4a0262[_0x18a3('0x39')]:_0x3d3370['model'];if(_0x32fee4[_0x18a3('0x37')][_0x18a3('0x4b')]){_0x4a0262[_0x18a3('0x46')]=[{'all':!![]}];}_0x4a0262=_[_0x18a3('0x41')]({},_0x4a0262,_0x32fee4[_0x18a3('0x45')]);return db['AnalyticCustomReport'][_0x18a3('0x4c')](_0x4a0262)[_0x18a3('0x29')](handleEntityNotFound(_0x8cb3e2,null))[_0x18a3('0x29')](respondWithResult(_0x8cb3e2,null))[_0x18a3('0x4d')](handleError(_0x8cb3e2,null));};exports['create']=function(_0x1b3fed,_0x48ac17){return db['AnalyticCustomReport']['create'](_0x1b3fed['body'],{})[_0x18a3('0x29')](function(_0x57418e){var _0x40191a=_0x1b3fed['user'][_0x18a3('0x2b')]({'plain':!![]});if(!_0x40191a)throw new Error(_0x18a3('0x4e'));if(_0x40191a[_0x18a3('0x4f')]===_0x18a3('0x50')){var _0x3df065=_0x57418e[_0x18a3('0x2b')]({'plain':!![]});var _0x1b41a1=_0x18a3('0x51');return db['UserProfileSection'][_0x18a3('0x4c')]({'where':{'name':_0x1b41a1,'userProfileId':_0x40191a[_0x18a3('0x52')]},'raw':!![]})[_0x18a3('0x29')](function(_0x2d2709){if(_0x2d2709&&_0x2d2709[_0x18a3('0x53')]===0x0){return db['UserProfileResource'][_0x18a3('0x54')]({'name':_0x3df065[_0x18a3('0x30')],'resourceId':_0x3df065['id'],'type':_0x18a3('0x2c'),'sectionId':_0x2d2709['id']},{})[_0x18a3('0x29')](function(){return _0x57418e;});}else{return _0x57418e;}})[_0x18a3('0x4d')](function(_0x336836){logger['error'](_0x18a3('0x55'),_0x336836);throw _0x336836;});}return _0x57418e;})[_0x18a3('0x29')](respondWithResult(_0x48ac17,0xc9))[_0x18a3('0x4d')](handleError(_0x48ac17,null));};exports['update']=function(_0x486c70,_0x4337dc){if(_0x486c70[_0x18a3('0x56')]['id']){delete _0x486c70['body']['id'];}return db['AnalyticCustomReport'][_0x18a3('0x4c')]({'where':{'id':_0x486c70[_0x18a3('0x57')]['id']}})[_0x18a3('0x29')](handleEntityNotFound(_0x4337dc,null))['then'](saveUpdates(_0x486c70[_0x18a3('0x56')],null))[_0x18a3('0x29')](respondWithResult(_0x4337dc,null))['catch'](handleError(_0x4337dc,null));};exports[_0x18a3('0x2a')]=function(_0x218d47,_0x31490d){return db[_0x18a3('0x33')]['find']({'where':{'id':_0x218d47[_0x18a3('0x57')]['id']}})[_0x18a3('0x29')](handleEntityNotFound(_0x31490d,null))['then'](removeEntity(_0x31490d,null))[_0x18a3('0x4d')](handleError(_0x31490d,null));};exports[_0x18a3('0x58')]=function(_0x2ef5b1,_0x2cb81b){var _0x5f2c1f=0xa;var _0x3796e2=[_0x18a3('0x59'),_0x18a3('0x5a'),'right_join',_0x18a3('0x5b')];var _0x2b7963={'SUM':_0x18a3('0x5c'),'COUNT':_0x18a3('0x5d'),'COUNT DISTINCT':_0x18a3('0x5e'),'MAX':_0x18a3('0x5f'),'MIN':_0x18a3('0x60'),'AVG':_0x18a3('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x18a3('0x62'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2769f5={'SEC_TO_TIME':_0x18a3('0x63'),'DATE':_0x18a3('0x64'),'HOUR':_0x18a3('0x65'),'ROUND':_0x18a3('0x66'),'UNIX_TIMESTAMP':_0x18a3('0x67')};var _0x2029ce=function(_0x2eedf2){return!_[_0x18a3('0x68')]([_0x18a3('0x69'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x18a3('0x6a')],_0x2eedf2);};var _0x452320=function(_0x206580){if(!_0x206580||!_0x206580[_0x18a3('0x6b')]['length']){return'';}for(var _0x29fc06='(',_0x5158cc=0x0;_0x5158cc<_0x206580[_0x18a3('0x6b')]['length'];_0x5158cc+=0x1){_0x5158cc>0x0&&(_0x29fc06+='\x20'+_0x206580[_0x18a3('0x6c')]+'\x20');_0x29fc06+=_0x206580[_0x18a3('0x6b')][_0x5158cc][_0x18a3('0x6d')]?_0x452320(_0x206580[_0x18a3('0x6b')][_0x5158cc]['group']):_0x206580[_0x18a3('0x6b')][_0x5158cc][_0x18a3('0x6e')]+'\x20'+_0x206580[_0x18a3('0x6b')][_0x5158cc][_0x18a3('0x6f')]+(_0x2029ce(_0x206580[_0x18a3('0x6b')][_0x5158cc]['condition'])?'\x20'+_0x206580[_0x18a3('0x6b')][_0x5158cc][_0x18a3('0x70')]:'');}return _0x29fc06+')';};var _0x17e27a={'where':{'id':_0x2ef5b1['params']['id']}},_0x502926,_0x3718e3,_0x47d543,_0x1441ab,_0x318733;_0x17e27a=_['merge']({},_0x17e27a,_0x2ef5b1[_0x18a3('0x45')]);return db['AnalyticCustomReport']['find'](_0x17e27a)[_0x18a3('0x29')](function(_0x4c7e90){if(_0x4c7e90){_0x502926=_0x4c7e90;return _0x4c7e90[_0x18a3('0x71')]();}return null;})[_0x18a3('0x29')](function(_0x337e8a){if(_0x337e8a){if(!_0x337e8a['length']){throw new db[(_0x18a3('0x72'))]['ValidationErrorItem'](_0x18a3('0x73'),0x193);}_0x3718e3=_0x337e8a;return db[_0x18a3('0x74')][_0x18a3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x43dc7e){if(_0x43dc7e){_0x47d543=_[_0x18a3('0x75')](_0x43dc7e,'id');var _0x4a7903;var _0x58af0f=squel[_0x18a3('0x76')]();_0x58af0f[_0x18a3('0x77')](_0x502926[_0x18a3('0x78')]);for(var _0x1c0cb4=0x0;_0x1c0cb4<_0x3718e3[_0x18a3('0x3c')];_0x1c0cb4+=0x1){_0x4a7903=_0x3718e3[_0x1c0cb4][_0x18a3('0x79')]?_0x47d543[_0x3718e3[_0x1c0cb4][_0x18a3('0x79')]][_0x18a3('0x7a')]:_0x3718e3[_0x1c0cb4]['field'];_0x4a7903=_0x3718e3[_0x1c0cb4][_0x18a3('0x7b')]?_[_0x18a3('0x7c')](_0x2b7963[_0x3718e3[_0x1c0cb4][_0x18a3('0x7b')]],'%s',_0x4a7903):_0x4a7903;_0x4a7903=_0x3718e3[_0x1c0cb4][_0x18a3('0x7d')]?_[_0x18a3('0x7c')](_0x2769f5[_0x3718e3[_0x1c0cb4][_0x18a3('0x7d')]],'%s',_0x4a7903):_0x4a7903;if(_0x3718e3[_0x1c0cb4][_0x18a3('0x7e')]){_0x58af0f['group'](_0x4a7903);}_0x3718e3[_0x1c0cb4][_0x18a3('0x7f')]&&_0x58af0f[_0x18a3('0x3f')](_0x4a7903,_0x3718e3[_0x1c0cb4]['orderBy']===_0x18a3('0x80')?![]:!![]);_0x58af0f[_0x18a3('0x6e')](_0x4a7903,_0x3718e3[_0x1c0cb4][_0x18a3('0x81')]||_0x4a7903);}if(_0x502926['joins']){_0x502926[_0x18a3('0x82')]=JSON[_0x18a3('0x83')](_0x502926[_0x18a3('0x82')]);for(var _0x517021=0x0;_0x517021<_0x502926[_0x18a3('0x82')]['length'];_0x517021+=0x1){if(_0x502926[_0x18a3('0x82')][_0x517021][_0x18a3('0x42')]&&_[_0x18a3('0x68')](_0x3796e2,_0x502926[_0x18a3('0x82')][_0x517021][_0x18a3('0x42')])&&_0x502926['joins'][_0x517021][_0x18a3('0x84')]&&_0x502926[_0x18a3('0x82')][_0x517021][_0x18a3('0x85')]&&_0x502926[_0x18a3('0x82')][_0x517021][_0x18a3('0x86')]){_0x58af0f[_0x502926['joins'][_0x517021][_0x18a3('0x42')]](_0x502926[_0x18a3('0x82')][_0x517021][_0x18a3('0x85')],null,util[_0x18a3('0x7d')](_0x18a3('0x87'),_0x502926['table'],_0x502926[_0x18a3('0x82')][_0x517021]['parentKey'],_0x502926[_0x18a3('0x82')][_0x517021][_0x18a3('0x85')],_0x502926[_0x18a3('0x82')][_0x517021]['foreignKey']));}}}if(_0x502926[_0x18a3('0x88')]){_0x502926[_0x18a3('0x88')]=JSON[_0x18a3('0x83')](_0x502926['conditions']);_0x58af0f[_0x18a3('0x40')](_0x452320(_0x502926[_0x18a3('0x88')][_0x18a3('0x6d')]));}_0x318733=_0x58af0f['clone']();_0x58af0f[_0x18a3('0x22')](_0x5f2c1f);_0x58af0f[_0x18a3('0x20')](0x0);logger[_0x18a3('0x89')]('Limited\x20Query:',_0x58af0f[_0x18a3('0x8a')]());return dbH[_0x18a3('0x8b')]['query'](_0x58af0f['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x18a3('0x8c')]});}})[_0x18a3('0x29')](respondWithResult(_0x2cb81b,null))['catch'](handleError(_0x2cb81b,null));};function runReport(_0xddbb4f,_0x447ed4,_0x28234e){var _0x2f1d4a=_0x447ed4[_0x18a3('0x30')];var _0x37ab18=0xa;var _0x3ad78a=[_0x18a3('0x59'),'left_join','right_join',_0x18a3('0x5b')];var _0x4305c1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x18a3('0x5e'),'MAX':_0x18a3('0x5f'),'MIN':_0x18a3('0x60'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x18a3('0x62'),'GROUP_CONCAT DESC':_0x18a3('0x8d')};var _0x3698bd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x18a3('0x64'),'HOUR':_0x18a3('0x65'),'ROUND':_0x18a3('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x185190=function(_0x4002dd){return!_[_0x18a3('0x68')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x18a3('0x8e'),_0x18a3('0x6a')],_0x4002dd);};var _0x1ab1f3=function(_0x32ea70){if(!_0x32ea70||!_0x32ea70[_0x18a3('0x6b')]['length']){return'';}for(var _0x4c2671='(',_0x3ccc4d=0x0;_0x3ccc4d<_0x32ea70['rules'][_0x18a3('0x3c')];_0x3ccc4d+=0x1){_0x3ccc4d>0x0&&(_0x4c2671+='\x20'+_0x32ea70['operator']+'\x20');_0x4c2671+=_0x32ea70[_0x18a3('0x6b')][_0x3ccc4d][_0x18a3('0x6d')]?_0x1ab1f3(_0x32ea70['rules'][_0x3ccc4d]['group']):_0x32ea70[_0x18a3('0x6b')][_0x3ccc4d][_0x18a3('0x6e')]+'\x20'+_0x32ea70['rules'][_0x3ccc4d][_0x18a3('0x6f')]+(_0x185190(_0x32ea70[_0x18a3('0x6b')][_0x3ccc4d]['condition'])?'\x20'+_0x32ea70[_0x18a3('0x6b')][_0x3ccc4d][_0x18a3('0x70')]:'');}return _0x4c2671+')';};var _0x8a4d5c={'where':{'id':_0xddbb4f['id']}},_0x2fb27b,_0x5e64d8,_0x58f384,_0x4c064d,_0x5a6431;_0x8a4d5c=_['merge']({},_0x8a4d5c,_0x28234e);return db['AnalyticCustomReport'][_0x18a3('0x4c')](_0x8a4d5c)[_0x18a3('0x29')](function(_0x201949){if(_0x201949){_0x2fb27b=_0x201949;return _0x201949[_0x18a3('0x71')]();}return null;})[_0x18a3('0x29')](function(_0x3382db){if(_0x3382db){if(!_0x3382db[_0x18a3('0x3c')]){throw new db[(_0x18a3('0x72'))][(_0x18a3('0x8f'))](_0x18a3('0x73'),0x193);}_0x5e64d8=_0x3382db;return db[_0x18a3('0x74')][_0x18a3('0x47')]({'raw':!![]});}return null;})[_0x18a3('0x29')](function(_0x449f39){if(_0x449f39){_0x58f384=_[_0x18a3('0x75')](_0x449f39,'id');var _0x957584;var _0x1f3380=squel['select']();_0x1f3380[_0x18a3('0x77')](_0x2fb27b[_0x18a3('0x78')]);for(var _0x56ded4=0x0;_0x56ded4<_0x5e64d8[_0x18a3('0x3c')];_0x56ded4+=0x1){_0x957584=_0x5e64d8[_0x56ded4][_0x18a3('0x79')]?_0x58f384[_0x5e64d8[_0x56ded4][_0x18a3('0x79')]][_0x18a3('0x7a')]:_0x5e64d8[_0x56ded4][_0x18a3('0x6e')];_0x957584=_0x5e64d8[_0x56ded4][_0x18a3('0x7b')]?_[_0x18a3('0x7c')](_0x4305c1[_0x5e64d8[_0x56ded4]['function']],'%s',_0x957584):_0x957584;_0x957584=_0x5e64d8[_0x56ded4][_0x18a3('0x7d')]?_[_0x18a3('0x7c')](_0x3698bd[_0x5e64d8[_0x56ded4][_0x18a3('0x7d')]],'%s',_0x957584):_0x957584;if(_0x5e64d8[_0x56ded4][_0x18a3('0x7e')]){_0x1f3380[_0x18a3('0x6d')](_0x957584);}_0x5e64d8[_0x56ded4][_0x18a3('0x7f')]&&_0x1f3380['order'](_0x957584,_0x5e64d8[_0x56ded4]['orderBy']==='DESC'?![]:!![]);_0x1f3380['field'](_0x957584,_0x5e64d8[_0x56ded4][_0x18a3('0x81')]||_0x957584);}if(_0x2fb27b[_0x18a3('0x82')]){_0x2fb27b[_0x18a3('0x82')]=JSON[_0x18a3('0x83')](_0x2fb27b[_0x18a3('0x82')]);for(var _0x27554d=0x0;_0x27554d<_0x2fb27b[_0x18a3('0x82')]['length'];_0x27554d+=0x1){if(_0x2fb27b['joins'][_0x27554d][_0x18a3('0x42')]&&_[_0x18a3('0x68')](_0x3ad78a,_0x2fb27b[_0x18a3('0x82')][_0x27554d][_0x18a3('0x42')])&&_0x2fb27b[_0x18a3('0x82')][_0x27554d]['parentKey']&&_0x2fb27b[_0x18a3('0x82')][_0x27554d][_0x18a3('0x85')]&&_0x2fb27b[_0x18a3('0x82')][_0x27554d]['foreignKey']){_0x1f3380[_0x2fb27b[_0x18a3('0x82')][_0x27554d][_0x18a3('0x42')]](_0x2fb27b[_0x18a3('0x82')][_0x27554d][_0x18a3('0x85')],null,util[_0x18a3('0x7d')]('%s.%s\x20=\x20%s.%s',_0x2fb27b[_0x18a3('0x78')],_0x2fb27b[_0x18a3('0x82')][_0x27554d][_0x18a3('0x84')],_0x2fb27b[_0x18a3('0x82')][_0x27554d][_0x18a3('0x85')],_0x2fb27b['joins'][_0x27554d][_0x18a3('0x86')]));}}}if(_0x2fb27b[_0x18a3('0x88')]){_0x2fb27b[_0x18a3('0x88')]=JSON['parse'](_0x2fb27b[_0x18a3('0x88')]);_0x1f3380[_0x18a3('0x40')](_0x1ab1f3(_0x2fb27b['conditions'][_0x18a3('0x6d')]));}_0x5a6431=_0x1f3380['clone']();_0x1f3380[_0x18a3('0x22')](_0x37ab18);_0x1f3380[_0x18a3('0x20')](0x0);return;}})[_0x18a3('0x29')](function(){if(_0x447ed4[_0x18a3('0x90')]===_0x18a3('0x91')){return null;}var _0x340a3f=_[_0x18a3('0x41')](_0x447ed4,{'name':_0x447ed4[_0x18a3('0x92')]||_0x447ed4[_0x18a3('0x30')]||_0x2fb27b[_0x18a3('0x30')],'basename':_0x2f1d4a,'savename':util[_0x18a3('0x7d')]('%s-%s.%s',_0x447ed4['name']||_0x2fb27b[_0x18a3('0x30')],require(_0x18a3('0x93'))[_0x18a3('0x94')](0x4),_0x447ed4[_0x18a3('0x90')]||'csv'),'reportId':_0x2fb27b['id'],'reportType':'custom'});return db[_0x18a3('0x95')][_0x18a3('0x54')](_0x340a3f,{'raw':!![]});})['then'](function(_0x3a73b8){if(_0x2fb27b[_0x18a3('0x78')]===_0x18a3('0x96')){_0x5a6431[_0x18a3('0x40')](_0x2fb27b[_0x18a3('0x78')]+_0x18a3('0x97'),_0x447ed4[_0x18a3('0x98')],_0x447ed4['endDate']);}else{_0x5a6431[_0x18a3('0x40')](_0x2fb27b[_0x18a3('0x78')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x447ed4[_0x18a3('0x98')],_0x447ed4['endDate']);}if(_0x3a73b8){logger[_0x18a3('0x99')](_0x18a3('0x9a'),_0x5a6431['toString']());require('child_process')[_0x18a3('0x9b')](path[_0x18a3('0x59')](__dirname,'../../components/export/',_0x3a73b8[_0x18a3('0x90')]),[_0x3a73b8['id'],_0x5a6431[_0x18a3('0x8a')](),path[_0x18a3('0x59')](__dirname,_0x18a3('0x9c'),_0x3a73b8[_0x18a3('0x9d')]),_0x2f1d4a]);return _0x3a73b8;}else{var _0x584213=squel[_0x18a3('0x76')]();_0x584213[_0x18a3('0x77')]('('+_0x5a6431[_0x18a3('0x8a')]()+')','countTable');_0x584213[_0x18a3('0x6e')](_0x18a3('0x9e'),_0x18a3('0x23'));_0x5a6431[_0x18a3('0x22')](_0x447ed4[_0x18a3('0x22')]||_0x37ab18);_0x5a6431[_0x18a3('0x20')](_0x447ed4[_0x18a3('0x20')]||0x0);return dbH[_0x18a3('0x8b')][_0x18a3('0x37')](_0x584213[_0x18a3('0x8a')](),{'type':dbH[_0x18a3('0x8b')][_0x18a3('0x9f')][_0x18a3('0x8c')]})[_0x18a3('0x29')](function(_0x1276e4){if(!_0x1276e4['length']){_0x4c064d=0x0;}else{_0x4c064d=_0x1276e4[0x0][_0x18a3('0x23')]||0x0;}return dbH[_0x18a3('0x8b')][_0x18a3('0x37')](_0x5a6431[_0x18a3('0x8a')](),{'type':dbH[_0x18a3('0x8b')][_0x18a3('0x9f')][_0x18a3('0x8c')]});})[_0x18a3('0x29')](function(_0x317fd2){return{'rows':_0x317fd2||[],'count':_0x4c064d};});}});}exports[_0x18a3('0xa0')]=function(_0x33c905,_0x542915){return runReport(_0x33c905[_0x18a3('0x57')],_0x33c905[_0x18a3('0x37')],_0x33c905[_0x18a3('0x45')])[_0x18a3('0x29')](respondWithResult(_0x542915,null))['catch'](handleError(_0x542915,null));};exports[_0x18a3('0xa1')]=runReport;exports[_0x18a3('0x37')]=function(_0x466033,_0x4ab58d){var _0x360d3b=0xa;var _0x13770c=[_0x18a3('0x59'),'left_join','right_join',_0x18a3('0x5b')];var _0x3f2de5={'SUM':_0x18a3('0x5c'),'COUNT':_0x18a3('0x5d'),'COUNT DISTINCT':_0x18a3('0x5e'),'MAX':_0x18a3('0x5f'),'MIN':_0x18a3('0x60'),'AVG':_0x18a3('0x61'),'GROUP_CONCAT':_0x18a3('0xa2'),'GROUP_CONCAT ASC':_0x18a3('0x62'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x243874={'SEC_TO_TIME':_0x18a3('0x63'),'DATE':_0x18a3('0x64'),'HOUR':_0x18a3('0x65'),'ROUND':_0x18a3('0x66'),'UNIX_TIMESTAMP':_0x18a3('0x67')};var _0x40ca7e=function(_0x5c66b2){return!_[_0x18a3('0x68')]([_0x18a3('0x69'),_0x18a3('0xa3'),_0x18a3('0x8e'),_0x18a3('0x6a')],_0x5c66b2);};var _0x43a49c=function(_0x49792a){if(!_0x49792a||!_0x49792a['rules']['length']){return'';}for(var _0x370f6f='(',_0x3bfb92=0x0;_0x3bfb92<_0x49792a[_0x18a3('0x6b')]['length'];_0x3bfb92+=0x1){_0x3bfb92>0x0&&(_0x370f6f+='\x20'+_0x49792a['operator']+'\x20');_0x370f6f+=_0x49792a[_0x18a3('0x6b')][_0x3bfb92]['group']?_0x43a49c(_0x49792a[_0x18a3('0x6b')][_0x3bfb92][_0x18a3('0x6d')]):_0x49792a['rules'][_0x3bfb92][_0x18a3('0x6e')]+'\x20'+_0x49792a[_0x18a3('0x6b')][_0x3bfb92][_0x18a3('0x6f')]+(_0x40ca7e(_0x49792a['rules'][_0x3bfb92][_0x18a3('0x6f')])?'\x20'+_0x49792a[_0x18a3('0x6b')][_0x3bfb92]['value']:'');}return _0x370f6f+')';};var _0x497871={'where':{'id':_0x466033[_0x18a3('0x57')]['id']}},_0x59950a,_0x430867,_0x2c8f8d,_0x3bb240,_0x3b2b29;_0x497871=_[_0x18a3('0x41')]({},_0x497871,_0x466033[_0x18a3('0x45')]);return db[_0x18a3('0x33')][_0x18a3('0x4c')](_0x497871)[_0x18a3('0x29')](function(_0x5b3b66){if(_0x5b3b66){_0x59950a=_0x5b3b66;return _0x5b3b66[_0x18a3('0x71')]();}return null;})['then'](function(_0x4627ab){if(_0x4627ab){if(!_0x4627ab['length']){throw new db[(_0x18a3('0x72'))]['ValidationErrorItem'](_0x18a3('0x73'),0x193);}_0x430867=_0x4627ab;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x18a3('0x29')](function(_0x6a5ec0){if(_0x6a5ec0){_0x2c8f8d=_[_0x18a3('0x75')](_0x6a5ec0,'id');var _0x2f935a;var _0x278d05=squel['select']();_0x278d05[_0x18a3('0x77')](_0x59950a['table']);for(var _0x367309=0x0;_0x367309<_0x430867['length'];_0x367309+=0x1){_0x2f935a=_0x430867[_0x367309][_0x18a3('0x79')]?_0x2c8f8d[_0x430867[_0x367309]['MetricId']][_0x18a3('0x7a')]:_0x430867[_0x367309]['field'];_0x2f935a=_0x430867[_0x367309][_0x18a3('0x7b')]?_[_0x18a3('0x7c')](_0x3f2de5[_0x430867[_0x367309][_0x18a3('0x7b')]],'%s',_0x2f935a):_0x2f935a;_0x2f935a=_0x430867[_0x367309][_0x18a3('0x7d')]?_[_0x18a3('0x7c')](_0x243874[_0x430867[_0x367309][_0x18a3('0x7d')]],'%s',_0x2f935a):_0x2f935a;if(_0x430867[_0x367309][_0x18a3('0x7e')]){_0x278d05[_0x18a3('0x6d')](_0x2f935a);}_0x430867[_0x367309][_0x18a3('0x7f')]&&_0x278d05[_0x18a3('0x3f')](_0x2f935a,_0x430867[_0x367309]['orderBy']==='DESC'?![]:!![]);_0x278d05['field'](_0x2f935a,_0x430867[_0x367309][_0x18a3('0x81')]||_0x2f935a);}if(_0x59950a[_0x18a3('0x82')]){_0x59950a['joins']=JSON[_0x18a3('0x83')](_0x59950a['joins']);for(var _0xc089a1=0x0;_0xc089a1<_0x59950a[_0x18a3('0x82')][_0x18a3('0x3c')];_0xc089a1+=0x1){if(_0x59950a['joins'][_0xc089a1][_0x18a3('0x42')]&&_[_0x18a3('0x68')](_0x13770c,_0x59950a['joins'][_0xc089a1][_0x18a3('0x42')])&&_0x59950a[_0x18a3('0x82')][_0xc089a1][_0x18a3('0x84')]&&_0x59950a['joins'][_0xc089a1]['foreignTable']&&_0x59950a[_0x18a3('0x82')][_0xc089a1][_0x18a3('0x86')]){_0x278d05[_0x59950a[_0x18a3('0x82')][_0xc089a1][_0x18a3('0x42')]](_0x59950a[_0x18a3('0x82')][_0xc089a1][_0x18a3('0x85')],null,util[_0x18a3('0x7d')]('%s.%s\x20=\x20%s.%s',_0x59950a[_0x18a3('0x78')],_0x59950a['joins'][_0xc089a1][_0x18a3('0x84')],_0x59950a[_0x18a3('0x82')][_0xc089a1]['foreignTable'],_0x59950a[_0x18a3('0x82')][_0xc089a1][_0x18a3('0x86')]));}}}if(_0x59950a[_0x18a3('0x88')]){_0x59950a[_0x18a3('0x88')]=JSON[_0x18a3('0x83')](_0x59950a['conditions']);_0x278d05[_0x18a3('0x40')](_0x43a49c(_0x59950a[_0x18a3('0x88')]['group']));}_0x3b2b29=_0x278d05['clone']();_0x278d05['limit'](_0x360d3b);_0x278d05[_0x18a3('0x20')](0x0);logger[_0x18a3('0x89')](_0x18a3('0xa4'),_0x278d05['toString']());return dbH['sequelize'][_0x18a3('0x37')](_0x278d05[_0x18a3('0x8a')](),{'type':dbH[_0x18a3('0x8b')][_0x18a3('0x9f')][_0x18a3('0x8c')]});}})['then'](function(){return{'sql':_0x3b2b29[_0x18a3('0x8a')]()};})[_0x18a3('0x29')](respondWithResult(_0x4ab58d,null))[_0x18a3('0x4d')](handleError(_0x4ab58d,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 7e3e19d..8a3da1e 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 _0x89dd=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./analyticCustomReport.attributes'];(function(_0x372a0a,_0x35182d){var _0x30ae0e=function(_0x158402){while(--_0x158402){_0x372a0a['push'](_0x372a0a['shift']());}};_0x30ae0e(++_0x35182d);}(_0x89dd,0x1be));var _0xd89d=function(_0xe672eb,_0x14af50){_0xe672eb=_0xe672eb-0x0;var _0x5ef77a=_0x89dd[_0xe672eb];return _0x5ef77a;};'use strict';var _=require(_0xd89d('0x0'));var util=require(_0xd89d('0x1'));var logger=require(_0xd89d('0x2'))(_0xd89d('0x3'));var moment=require(_0xd89d('0x4'));var BPromise=require(_0xd89d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd89d('0x6'));var rimraf=require(_0xd89d('0x7'));var config=require('../../config/environment');var attributes=require(_0xd89d('0x8'));module[_0xd89d('0x9')]=function(_0x5a5c91,_0x4fd742){return _0x5a5c91[_0xd89d('0xa')](_0xd89d('0xb'),attributes,{'tableName':_0xd89d('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce44=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3fbb8b,_0x287963){var _0x5f3e22=function(_0x26feaa){while(--_0x26feaa){_0x3fbb8b['push'](_0x3fbb8b['shift']());}};_0x5f3e22(++_0x287963);}(_0xce44,0xe8));var _0x4ce4=function(_0x28399c,_0x40158d){_0x28399c=_0x28399c-0x0;var _0x4b0191=_0xce44[_0x28399c];return _0x4b0191;};'use strict';var _=require('lodash');var util=require(_0x4ce4('0x0'));var logger=require(_0x4ce4('0x1'))(_0x4ce4('0x2'));var moment=require(_0x4ce4('0x3'));var BPromise=require(_0x4ce4('0x4'));var rp=require(_0x4ce4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ce4('0x6'));var config=require(_0x4ce4('0x7'));var attributes=require(_0x4ce4('0x8'));module['exports']=function(_0x238a7b,_0x19acf1){return _0x238a7b[_0x4ce4('0x9')](_0x4ce4('0xa'),attributes,{'tableName':_0x4ce4('0xb'),'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 a6fb90e..3b7e114 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 _0x3177=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5edcd7,_0x4c5e59){var _0x2f5b45=function(_0x11aa0c){while(--_0x11aa0c){_0x5edcd7['push'](_0x5edcd7['shift']());}};_0x2f5b45(++_0x4c5e59);}(_0x3177,0x1b4));var _0x7317=function(_0x3eab50,_0x2c40ba){_0x3eab50=_0x3eab50-0x0;var _0x1d0cb1=_0x3177[_0x3eab50];return _0x1d0cb1;};'use strict';var _=require('lodash');var util=require(_0x7317('0x0'));var moment=require(_0x7317('0x1'));var BPromise=require(_0x7317('0x2'));var rs=require(_0x7317('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7317('0x4'))['db'];var utils=require(_0x7317('0x5'));var logger=require(_0x7317('0x6'))(_0x7317('0x7'));var config=require(_0x7317('0x8'));var jayson=require(_0x7317('0x9'));var client=jayson[_0x7317('0xa')][_0x7317('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eaf37,_0x464341,_0x391fea){return new BPromise(function(_0x3dccdb,_0x55be7b){return client[_0x7317('0xc')](_0x3eaf37,_0x391fea)[_0x7317('0xd')](function(_0x44b168){logger[_0x7317('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x464341,'request\x20sent');logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x464341,_0x7317('0xf'),JSON['stringify'](_0x44b168));if(_0x44b168['error']){if(_0x44b168[_0x7317('0x10')]['code']===0x1f4){logger[_0x7317('0x10')](_0x7317('0x11'),_0x464341,_0x44b168[_0x7317('0x10')]['message']);return _0x55be7b(_0x44b168[_0x7317('0x10')][_0x7317('0x12')]);}logger[_0x7317('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x464341,_0x44b168['error'][_0x7317('0x12')]);return _0x3dccdb(_0x44b168[_0x7317('0x10')][_0x7317('0x12')]);}else{logger[_0x7317('0xe')](_0x7317('0x11'),_0x464341,_0x7317('0xf'));_0x3dccdb(_0x44b168[_0x7317('0x13')][_0x7317('0x12')]);}})[_0x7317('0x14')](function(_0x99230){logger[_0x7317('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x464341,_0x99230);_0x55be7b(_0x99230);});});} \ No newline at end of file +var _0x7f42=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x41bce6,_0x31e269){var _0x2a369a=function(_0x52f1e3){while(--_0x52f1e3){_0x41bce6['push'](_0x41bce6['shift']());}};_0x2a369a(++_0x31e269);}(_0x7f42,0x90));var _0x27f4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7f42[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x27f4('0x0'));var util=require(_0x27f4('0x1'));var moment=require(_0x27f4('0x2'));var BPromise=require(_0x27f4('0x3'));var rs=require(_0x27f4('0x4'));var fs=require('fs');var Redis=require(_0x27f4('0x5'));var db=require(_0x27f4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x27f4('0x7'))(_0x27f4('0x8'));var config=require(_0x27f4('0x9'));var jayson=require(_0x27f4('0xa'));var client=jayson[_0x27f4('0xb')][_0x27f4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e550c,_0x3eab61,_0x23f548){return new BPromise(function(_0x58beab,_0x51f880){return client['request'](_0x2e550c,_0x23f548)[_0x27f4('0xd')](function(_0x2bce1c){logger[_0x27f4('0xe')](_0x27f4('0xf'),_0x3eab61,_0x27f4('0x10'));logger[_0x27f4('0x11')](_0x27f4('0x12'),_0x3eab61,_0x27f4('0x10'),JSON[_0x27f4('0x13')](_0x2bce1c));if(_0x2bce1c['error']){if(_0x2bce1c['error'][_0x27f4('0x14')]===0x1f4){logger[_0x27f4('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3eab61,_0x2bce1c['error'][_0x27f4('0x16')]);return _0x51f880(_0x2bce1c[_0x27f4('0x15')][_0x27f4('0x16')]);}logger[_0x27f4('0x15')](_0x27f4('0xf'),_0x3eab61,_0x2bce1c[_0x27f4('0x15')][_0x27f4('0x16')]);return _0x58beab(_0x2bce1c[_0x27f4('0x15')][_0x27f4('0x16')]);}else{logger[_0x27f4('0xe')](_0x27f4('0xf'),_0x3eab61,_0x27f4('0x10'));_0x58beab(_0x2bce1c[_0x27f4('0x17')][_0x27f4('0x16')]);}})['catch'](function(_0x189625){logger[_0x27f4('0x15')](_0x27f4('0xf'),_0x3eab61,_0x189625);_0x51f880(_0x189625);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 545c146..b5c6f73 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 _0xe6e4=['./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','post','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xe6e4,0xd4));var _0x4e6e=function(_0x91abdd,_0x4e7e7d){_0x91abdd=_0x91abdd-0x0;var _0x3779ad=_0xe6e4[_0x91abdd];return _0x3779ad;};'use strict';var multer=require(_0x4e6e('0x0'));var util=require(_0x4e6e('0x1'));var path=require('path');var timeout=require(_0x4e6e('0x2'));var express=require(_0x4e6e('0x3'));var router=express['Router']();var fs_extra=require(_0x4e6e('0x4'));var auth=require(_0x4e6e('0x5'));var interaction=require(_0x4e6e('0x6'));var config=require(_0x4e6e('0x7'));var controller=require(_0x4e6e('0x8'));router[_0x4e6e('0x9')]('/',auth[_0x4e6e('0xa')](),controller[_0x4e6e('0xb')]);router[_0x4e6e('0x9')](_0x4e6e('0xc'),auth[_0x4e6e('0xa')](),controller[_0x4e6e('0xd')]);router[_0x4e6e('0x9')](_0x4e6e('0xe'),auth[_0x4e6e('0xa')](),controller[_0x4e6e('0xf')]);router[_0x4e6e('0x9')]('/:id/run',auth[_0x4e6e('0xa')](),controller[_0x4e6e('0x10')]);router[_0x4e6e('0x9')]('/:id/query',auth[_0x4e6e('0xa')](),controller['query']);router[_0x4e6e('0x11')]('/',auth[_0x4e6e('0xa')](),controller['create']);router[_0x4e6e('0x12')](_0x4e6e('0xc'),auth['isAuthenticated'](),controller[_0x4e6e('0x13')]);router[_0x4e6e('0x14')]('/:id',auth[_0x4e6e('0xa')](),controller['destroy']);module[_0x4e6e('0x15')]=router; \ No newline at end of file +var _0x8185=['Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','destroy','multer','util','connect-timeout','express'];(function(_0xfbf488,_0x811f64){var _0x42a4e6=function(_0x718ffc){while(--_0x718ffc){_0xfbf488['push'](_0xfbf488['shift']());}};_0x42a4e6(++_0x811f64);}(_0x8185,0x127));var _0x5818=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8185[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var path=require('path');var timeout=require(_0x5818('0x2'));var express=require(_0x5818('0x3'));var router=express[_0x5818('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5818('0x5'));var config=require(_0x5818('0x6'));var controller=require(_0x5818('0x7'));router[_0x5818('0x8')]('/',auth[_0x5818('0x9')](),controller[_0x5818('0xa')]);router[_0x5818('0x8')](_0x5818('0xb'),auth[_0x5818('0x9')](),controller[_0x5818('0xc')]);router[_0x5818('0x8')](_0x5818('0xd'),auth[_0x5818('0x9')](),controller[_0x5818('0xe')]);router[_0x5818('0x8')](_0x5818('0xf'),auth['isAuthenticated'](),controller[_0x5818('0x10')]);router[_0x5818('0x8')](_0x5818('0x11'),auth[_0x5818('0x9')](),controller[_0x5818('0x12')]);router[_0x5818('0x13')]('/',auth[_0x5818('0x9')](),controller[_0x5818('0x14')]);router['put'](_0x5818('0xb'),auth['isAuthenticated'](),controller[_0x5818('0x15')]);router['delete'](_0x5818('0xb'),auth[_0x5818('0x9')](),controller[_0x5818('0x16')]);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 21bb456..0672923 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 _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x39d204,_0x1e3701){var _0x403637=function(_0x2c7d99){while(--_0x2c7d99){_0x39d204['push'](_0x39d204['shift']());}};_0x403637(++_0x1e3701);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x382dc2,_0x5aab53){_0x382dc2=_0x382dc2-0x0;var _0x3709b1=_0x9c5a[_0x382dc2];return _0x3709b1;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x384817,_0x129132){var _0x39d900=function(_0x194db3){while(--_0x194db3){_0x384817['push'](_0x384817['shift']());}};_0x39d900(++_0x129132);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x31407d,_0x4b1dfa){_0x31407d=_0x31407d-0x0;var _0x76a912=_0x9c5a[_0x31407d];return _0x76a912;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ce03e72..0795760 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 _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x3e267c,_0x2fcb4d){var _0x4abfeb=function(_0x33f95f){while(--_0x33f95f){_0x3e267c['push'](_0x3e267c['shift']());}};_0x4abfeb(++_0x2fcb4d);}(_0x1261,0x144));var _0x1126=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x1261[_0x7d62cb];return _0x3a6266;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x2a8011,_0x3be73e){_0x2a8011=_0x2a8011-0x0;var _0x36c48b=_0xc6ac[_0x2a8011];return _0x36c48b;};'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 45706f3..f1441cd 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 _0xe0cd=['AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe0cd,0x70));var _0xde0c=function(_0x258fc1,_0xb5ef7d){_0x258fc1=_0x258fc1-0x0;var _0xf89303=_0xe0cd[_0x258fc1];return _0xf89303;};'use strict';var _=require('lodash');var util=require(_0xde0c('0x0'));var logger=require(_0xde0c('0x1'))(_0xde0c('0x2'));var moment=require(_0xde0c('0x3'));var BPromise=require(_0xde0c('0x4'));var rp=require(_0xde0c('0x5'));var fs=require('fs');var path=require(_0xde0c('0x6'));var rimraf=require('rimraf');var config=require(_0xde0c('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xde0c('0x8')]=function(_0xba21fb,_0x1e112b){return _0xba21fb['define'](_0xde0c('0x9'),attributes,{'tableName':_0xde0c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f87=['AnalyticDefaultReport','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5f87,0x182));var _0x75f8=function(_0x32d85a,_0x2d2a80){_0x32d85a=_0x32d85a-0x0;var _0x35cd09=_0x5f87[_0x32d85a];return _0x35cd09;};'use strict';var _=require('lodash');var util=require(_0x75f8('0x0'));var logger=require('../../config/logger')(_0x75f8('0x1'));var moment=require(_0x75f8('0x2'));var BPromise=require(_0x75f8('0x3'));var rp=require(_0x75f8('0x4'));var fs=require('fs');var path=require(_0x75f8('0x5'));var rimraf=require(_0x75f8('0x6'));var config=require(_0x75f8('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0x75f8('0x8')]=function(_0x4d470d,_0x1816e0){return _0x4d470d[_0x75f8('0x9')](_0x75f8('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index e205362..920b4a1 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 _0x062c=['rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1f3a66,_0x308264){var _0x1b5378=function(_0x29e48c){while(--_0x29e48c){_0x1f3a66['push'](_0x1f3a66['shift']());}};_0x1b5378(++_0x308264);}(_0x062c,0x1b2));var _0xc062=function(_0x4815ca,_0x51c4a9){_0x4815ca=_0x4815ca-0x0;var _0x26a1b1=_0x062c[_0x4815ca];return _0x26a1b1;};'use strict';var _=require(_0xc062('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc062('0x1'));var fs=require('fs');var Redis=require(_0xc062('0x2'));var db=require(_0xc062('0x3'))['db'];var utils=require(_0xc062('0x4'));var logger=require(_0xc062('0x5'))(_0xc062('0x6'));var config=require('../../config/environment');var jayson=require(_0xc062('0x7'));var client=jayson[_0xc062('0x8')][_0xc062('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x313073,_0x84a8d9,_0x491b89){return new BPromise(function(_0x4d8a35,_0x2bdbe6){return client[_0xc062('0xa')](_0x313073,_0x491b89)[_0xc062('0xb')](function(_0x3e4ccf){logger[_0xc062('0xc')](_0xc062('0xd'),_0x84a8d9,_0xc062('0xe'));logger[_0xc062('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x84a8d9,'request\x20sent',JSON[_0xc062('0x10')](_0x3e4ccf));if(_0x3e4ccf['error']){if(_0x3e4ccf[_0xc062('0x11')][_0xc062('0x12')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x84a8d9,_0x3e4ccf[_0xc062('0x11')][_0xc062('0x13')]);return _0x2bdbe6(_0x3e4ccf[_0xc062('0x11')]['message']);}logger[_0xc062('0x11')](_0xc062('0xd'),_0x84a8d9,_0x3e4ccf['error'][_0xc062('0x13')]);return _0x4d8a35(_0x3e4ccf[_0xc062('0x11')][_0xc062('0x13')]);}else{logger[_0xc062('0xc')](_0xc062('0xd'),_0x84a8d9,_0xc062('0xe'));_0x4d8a35(_0x3e4ccf[_0xc062('0x14')][_0xc062('0x13')]);}})[_0xc062('0x15')](function(_0x282676){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x84a8d9,_0x282676);_0x2bdbe6(_0x282676);});});} \ No newline at end of file +var _0x91cd=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x39d8ad,_0x298451){var _0x4a08ac=function(_0x5bbe18){while(--_0x5bbe18){_0x39d8ad['push'](_0x39d8ad['shift']());}};_0x4a08ac(++_0x298451);}(_0x91cd,0x1cc));var _0xd91c=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x91cd[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var util=require(_0xd91c('0x0'));var moment=require(_0xd91c('0x1'));var BPromise=require(_0xd91c('0x2'));var rs=require(_0xd91c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd91c('0x4'))['db'];var utils=require(_0xd91c('0x5'));var logger=require(_0xd91c('0x6'))(_0xd91c('0x7'));var config=require(_0xd91c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd91c('0x9')][_0xd91c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1864fb,_0x1219b5,_0x570994){return new BPromise(function(_0x3bd123,_0x334503){return client[_0xd91c('0xb')](_0x1864fb,_0x570994)[_0xd91c('0xc')](function(_0x27f996){logger[_0xd91c('0xd')](_0xd91c('0xe'),_0x1219b5,_0xd91c('0xf'));logger[_0xd91c('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1219b5,_0xd91c('0xf'),JSON[_0xd91c('0x11')](_0x27f996));if(_0x27f996[_0xd91c('0x12')]){if(_0x27f996[_0xd91c('0x12')][_0xd91c('0x13')]===0x1f4){logger[_0xd91c('0x12')](_0xd91c('0xe'),_0x1219b5,_0x27f996['error']['message']);return _0x334503(_0x27f996[_0xd91c('0x12')][_0xd91c('0x14')]);}logger[_0xd91c('0x12')](_0xd91c('0xe'),_0x1219b5,_0x27f996[_0xd91c('0x12')]['message']);return _0x3bd123(_0x27f996[_0xd91c('0x12')][_0xd91c('0x14')]);}else{logger[_0xd91c('0xd')](_0xd91c('0xe'),_0x1219b5,_0xd91c('0xf'));_0x3bd123(_0x27f996[_0xd91c('0x15')][_0xd91c('0x14')]);}})[_0xd91c('0x16')](function(_0x24e6d5){logger[_0xd91c('0x12')](_0xd91c('0xe'),_0x1219b5,_0x24e6d5);_0x334503(_0x24e6d5);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1b56b29..bb1e1ff 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 _0x1f24=['delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','run','create','update'];(function(_0x2c568b,_0x473d1e){var _0x24cbf8=function(_0x3df2fa){while(--_0x3df2fa){_0x2c568b['push'](_0x2c568b['shift']());}};_0x24cbf8(++_0x473d1e);}(_0x1f24,0x11a));var _0x41f2=function(_0x24e79c,_0x90e9e){_0x24e79c=_0x24e79c-0x0;var _0x4c7209=_0x1f24[_0x24e79c];return _0x4c7209;};'use strict';var multer=require(_0x41f2('0x0'));var util=require(_0x41f2('0x1'));var path=require('path');var timeout=require(_0x41f2('0x2'));var express=require(_0x41f2('0x3'));var router=express['Router']();var fs_extra=require(_0x41f2('0x4'));var auth=require(_0x41f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x41f2('0x6'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x41f2('0x7')](),controller[_0x41f2('0x8')]);router[_0x41f2('0x9')](_0x41f2('0xa'),auth['isAuthenticated'](),controller[_0x41f2('0xb')]);router[_0x41f2('0x9')](_0x41f2('0xc'),auth[_0x41f2('0x7')](),controller[_0x41f2('0xd')]);router['get'](_0x41f2('0xe'),auth[_0x41f2('0x7')](),controller[_0x41f2('0xf')]);router[_0x41f2('0x9')]('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x41f2('0x7')](),controller[_0x41f2('0x10')]);router['put'](_0x41f2('0xa'),auth['isAuthenticated'](),controller[_0x41f2('0x11')]);router[_0x41f2('0x12')](_0x41f2('0xa'),auth[_0x41f2('0x7')](),controller[_0x41f2('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2954=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/query','query','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3ec1da,_0x1e36f5){var _0x472358=function(_0x1d41b1){while(--_0x1d41b1){_0x3ec1da['push'](_0x3ec1da['shift']());}};_0x472358(++_0x1e36f5);}(_0x2954,0x8a));var _0x4295=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x2954[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x4295('0x0'));var util=require('util');var path=require(_0x4295('0x1'));var timeout=require(_0x4295('0x2'));var express=require(_0x4295('0x3'));var router=express[_0x4295('0x4')]();var fs_extra=require(_0x4295('0x5'));var auth=require(_0x4295('0x6'));var interaction=require(_0x4295('0x7'));var config=require(_0x4295('0x8'));var controller=require(_0x4295('0x9'));router['get']('/',auth[_0x4295('0xa')](),controller[_0x4295('0xb')]);router[_0x4295('0xc')](_0x4295('0xd'),auth[_0x4295('0xa')](),controller[_0x4295('0xe')]);router[_0x4295('0xc')](_0x4295('0xf'),auth['isAuthenticated'](),controller[_0x4295('0x10')]);router['get']('/:id/run',auth[_0x4295('0xa')](),controller['run']);router['get'](_0x4295('0x11'),auth[_0x4295('0xa')](),controller[_0x4295('0x12')]);router[_0x4295('0x13')]('/',auth[_0x4295('0xa')](),controller['create']);router[_0x4295('0x14')]('/:id',auth[_0x4295('0xa')](),controller[_0x4295('0x15')]);router[_0x4295('0x16')](_0x4295('0xd'),auth[_0x4295('0xa')](),controller[_0x4295('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index faf3a66..171d7db 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 _0x7d27=['csv','DATE','Loading','ENUM','manual','exports','STRING','pdf'];(function(_0x598e09,_0x96d669){var _0x9c89e6=function(_0x30edd9){while(--_0x30edd9){_0x598e09['push'](_0x598e09['shift']());}};_0x9c89e6(++_0x96d669);}(_0x7d27,0x1cd));var _0x77d2=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7d27[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x77d2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x77d2('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0x77d2('0x2'),'xlsx'),'allowNull':![],'defaultValue':_0x77d2('0x3')},'savename':{'type':Sequelize[_0x77d2('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x77d2('0x4')]},'endDate':{'type':Sequelize[_0x77d2('0x4')]},'status':{'type':Sequelize[_0x77d2('0x1')],'defaultValue':_0x77d2('0x5')},'type':{'type':Sequelize[_0x77d2('0x6')](_0x77d2('0x7'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x850c=['xlsx','DATE','Loading','manual','scheduled','INTEGER','sequelize','exports','STRING','ENUM','csv'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x850c,0x69));var _0xc850=function(_0x32511f,_0x2a61bc){_0x32511f=_0x32511f-0x0;var _0x4a90b8=_0x850c[_0x32511f];return _0x4a90b8;};'use strict';var Sequelize=require(_0xc850('0x0'));var moment=require('moment');module[_0xc850('0x1')]={'name':{'type':Sequelize[_0xc850('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xc850('0x3')](_0xc850('0x4'),'pdf',_0xc850('0x5')),'allowNull':![],'defaultValue':_0xc850('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xc850('0x6')]},'endDate':{'type':Sequelize[_0xc850('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xc850('0x7')},'type':{'type':Sequelize['ENUM'](_0xc850('0x8'),_0xc850('0x9')),'allowNull':![],'defaultValue':_0xc850('0x8')},'reportId':{'type':Sequelize[_0xc850('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xc850('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2ff1e12..640f60d 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 _0x9e34=['catch','show','rawAttributes','find','create','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','output','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x127801,_0x26281a){var _0x362f70=function(_0x372f06){while(--_0x372f06){_0x127801['push'](_0x127801['shift']());}};_0x362f70(++_0x26281a);}(_0x9e34,0xcc));var _0x49e3=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x9e34[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x49e3('0x0'));var rimraf=require(_0x49e3('0x1'));var zipdir=require(_0x49e3('0x2'));var jsonpatch=require(_0x49e3('0x3'));var rp=require(_0x49e3('0x4'));var moment=require('moment');var BPromise=require(_0x49e3('0x5'));var Mustache=require(_0x49e3('0x6'));var util=require('util');var path=require(_0x49e3('0x7'));var sox=require('sox');var csv=require(_0x49e3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49e3('0x9'));var _=require(_0x49e3('0xa'));var squel=require(_0x49e3('0xb'));var crypto=require(_0x49e3('0xc'));var jsforce=require(_0x49e3('0xd'));var deskjs=require(_0x49e3('0xe'));var toCsv=require(_0x49e3('0x8'));var querystring=require(_0x49e3('0xf'));var Papa=require(_0x49e3('0x10'));var Redis=require(_0x49e3('0x11'));var authService=require(_0x49e3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x49e3('0x13'));var hardwareService=require(_0x49e3('0x14'));var logger=require('../../config/logger')(_0x49e3('0x15'));var utils=require('../../config/utils');var config=require(_0x49e3('0x16'));var licenseUtil=require(_0x49e3('0x17'));var db=require(_0x49e3('0x18'))['db'];function respondWithStatusCode(_0x3f7d64,_0x476ced){_0x476ced=_0x476ced||0xcc;return function(_0x5b472a){if(_0x5b472a){return _0x3f7d64[_0x49e3('0x19')](_0x476ced);}return _0x3f7d64[_0x49e3('0x1a')](_0x476ced)['end']();};}function respondWithResult(_0x1f3ac0,_0x1dfe70){_0x1dfe70=_0x1dfe70||0xc8;return function(_0x5e7050){if(_0x5e7050){return _0x1f3ac0[_0x49e3('0x1a')](_0x1dfe70)[_0x49e3('0x1b')](_0x5e7050);}};}function respondWithFilteredResult(_0x52ca9d,_0x655d9e){return function(_0xa96033){if(_0xa96033){var _0x2a3441=typeof _0x655d9e['offset']===_0x49e3('0x1c')&&typeof _0x655d9e['limit']==='undefined';var _0x3db6d7=_0xa96033[_0x49e3('0x1d')];var _0x353cb4=_0x2a3441?0x0:_0x655d9e[_0x49e3('0x1e')];var _0x5b0765=_0x2a3441?_0xa96033['count']:_0x655d9e[_0x49e3('0x1e')]+_0x655d9e['limit'];var _0xf2bcd;if(_0x5b0765>=_0x3db6d7){_0x5b0765=_0x3db6d7;_0xf2bcd=0xc8;}else{_0xf2bcd=0xce;}_0x52ca9d[_0x49e3('0x1a')](_0xf2bcd);return _0x52ca9d[_0x49e3('0x1f')](_0x49e3('0x20'),_0x353cb4+'-'+_0x5b0765+'/'+_0x3db6d7)[_0x49e3('0x1b')](_0xa96033);}return null;};}function patchUpdates(_0x32e0c0){return function(_0x347c8b){try{jsonpatch[_0x49e3('0x21')](_0x347c8b,_0x32e0c0,!![]);}catch(_0x1274ab){return BPromise['reject'](_0x1274ab);}return _0x347c8b[_0x49e3('0x22')]();};}function saveUpdates(_0x3e1966,_0x4629a7){return function(_0x4fa4d1){if(_0x4fa4d1){return _0x4fa4d1[_0x49e3('0x23')](_0x3e1966)[_0x49e3('0x24')](function(_0x49ba07){return _0x49ba07;});}return null;};}function removeEntity(_0x3ce8ee,_0x7921ed){return function(_0x468227){if(_0x468227){return _0x468227[_0x49e3('0x25')]()['then'](function(){var _0x1ea219=_0x468227[_0x49e3('0x26')]({'plain':!![]});var _0xd61532=_0x49e3('0x27');return db[_0x49e3('0x28')]['destroy']({'where':{'type':_0xd61532,'resourceId':_0x1ea219['id']}})[_0x49e3('0x24')](function(){return _0x468227;});})['then'](function(){_0x3ce8ee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d15c4,_0x277179){return function(_0x2b0866){if(!_0x2b0866){_0x5d15c4[_0x49e3('0x19')](0x194);}return _0x2b0866;};}function handleError(_0x2196e9,_0x1cbf72){_0x1cbf72=_0x1cbf72||0x1f4;return function(_0x242f5f){logger['error'](_0x242f5f[_0x49e3('0x29')]);if(_0x242f5f[_0x49e3('0x2a')]){delete _0x242f5f[_0x49e3('0x2a')];}_0x2196e9[_0x49e3('0x1a')](_0x1cbf72)[_0x49e3('0x2b')](_0x242f5f);};}exports[_0x49e3('0x2c')]=function(_0x10d05e,_0x4ffca9){var _0x428465={},_0x447d36={},_0x503c15={'count':0x0,'rows':[]};var _0x5eb30d=_[_0x49e3('0x2d')](db[_0x49e3('0x2e')]['rawAttributes'],function(_0x2febd1){return{'name':_0x2febd1[_0x49e3('0x2f')],'type':_0x2febd1[_0x49e3('0x30')]['key']};});_0x447d36[_0x49e3('0x31')]=_[_0x49e3('0x2d')](_0x5eb30d,'name');_0x447d36['query']=_[_0x49e3('0x32')](_0x10d05e[_0x49e3('0x33')]);_0x447d36[_0x49e3('0x34')]=_[_0x49e3('0x35')](_0x447d36[_0x49e3('0x31')],_0x447d36[_0x49e3('0x33')]);_0x428465['attributes']=_[_0x49e3('0x35')](_0x447d36['model'],qs[_0x49e3('0x36')](_0x10d05e[_0x49e3('0x33')][_0x49e3('0x36')]));_0x428465[_0x49e3('0x37')]=_0x428465['attributes'][_0x49e3('0x38')]?_0x428465[_0x49e3('0x37')]:_0x447d36[_0x49e3('0x31')];if(!_0x10d05e['query']['hasOwnProperty'](_0x49e3('0x39'))){_0x428465[_0x49e3('0x3a')]=qs['limit'](_0x10d05e[_0x49e3('0x33')][_0x49e3('0x3a')]);_0x428465[_0x49e3('0x1e')]=qs[_0x49e3('0x1e')](_0x10d05e[_0x49e3('0x33')][_0x49e3('0x1e')]);}_0x428465['order']=qs[_0x49e3('0x3b')](_0x10d05e[_0x49e3('0x33')]['sort']);_0x428465[_0x49e3('0x3c')]=qs['filters'](_[_0x49e3('0x3d')](_0x10d05e['query'],_0x447d36[_0x49e3('0x34')]),_0x5eb30d);if(_0x10d05e[_0x49e3('0x33')][_0x49e3('0x3e')]){_0x428465['where']=_[_0x49e3('0x3f')](_0x428465[_0x49e3('0x3c')],{'$or':_[_0x49e3('0x2d')](_0x5eb30d,function(_0x30bde1){if(_0x30bde1[_0x49e3('0x30')]!==_0x49e3('0x40')){var _0xfca81f={};_0xfca81f[_0x30bde1[_0x49e3('0x2a')]]={'$like':'%'+_0x10d05e[_0x49e3('0x33')][_0x49e3('0x3e')]+'%'};return _0xfca81f;}})});}_0x428465=_[_0x49e3('0x3f')]({},_0x428465,_0x10d05e[_0x49e3('0x41')]);var _0x3053b0={'where':_0x428465[_0x49e3('0x3c')]};return db['AnalyticExtractedReport']['count'](_0x3053b0)[_0x49e3('0x24')](function(_0xaf9ade){_0x503c15[_0x49e3('0x1d')]=_0xaf9ade;if(_0x10d05e[_0x49e3('0x33')][_0x49e3('0x42')]){_0x428465[_0x49e3('0x43')]=[{'all':!![]}];}return db[_0x49e3('0x2e')]['findAll'](_0x428465);})[_0x49e3('0x24')](function(_0x168f39){_0x503c15[_0x49e3('0x44')]=_0x168f39;return _0x503c15;})[_0x49e3('0x24')](respondWithFilteredResult(_0x4ffca9,_0x428465))[_0x49e3('0x45')](handleError(_0x4ffca9,null));};exports[_0x49e3('0x46')]=function(_0x88b9ea,_0x3729a9){var _0x1d38d3={'raw':!![],'where':{'id':_0x88b9ea['params']['id']}},_0x29307a={};_0x29307a[_0x49e3('0x31')]=_['keys'](db[_0x49e3('0x2e')][_0x49e3('0x47')]);_0x29307a[_0x49e3('0x33')]=_['keys'](_0x88b9ea['query']);_0x29307a[_0x49e3('0x34')]=_[_0x49e3('0x35')](_0x29307a[_0x49e3('0x31')],_0x29307a['query']);_0x1d38d3[_0x49e3('0x37')]=_[_0x49e3('0x35')](_0x29307a[_0x49e3('0x31')],qs['fields'](_0x88b9ea[_0x49e3('0x33')][_0x49e3('0x36')]));_0x1d38d3[_0x49e3('0x37')]=_0x1d38d3['attributes'][_0x49e3('0x38')]?_0x1d38d3[_0x49e3('0x37')]:_0x29307a[_0x49e3('0x31')];if(_0x88b9ea[_0x49e3('0x33')][_0x49e3('0x42')]){_0x1d38d3['include']=[{'all':!![]}];}_0x1d38d3=_['merge']({},_0x1d38d3,_0x88b9ea[_0x49e3('0x41')]);return db[_0x49e3('0x2e')][_0x49e3('0x48')](_0x1d38d3)[_0x49e3('0x24')](handleEntityNotFound(_0x3729a9,null))[_0x49e3('0x24')](respondWithResult(_0x3729a9,null))[_0x49e3('0x45')](handleError(_0x3729a9,null));};exports[_0x49e3('0x49')]=function(_0x3d71c0,_0xa45d03){return db[_0x49e3('0x2e')][_0x49e3('0x49')](_0x3d71c0['body'],{})[_0x49e3('0x24')](function(_0x679c57){var _0x27c453=_0x3d71c0[_0x49e3('0x4a')][_0x49e3('0x26')]({'plain':!![]});if(!_0x27c453)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27c453['role']===_0x49e3('0x4a')){var _0x4dee32=_0x679c57['get']({'plain':!![]});var _0x17ec8b=_0x49e3('0x27');return db['UserProfileSection'][_0x49e3('0x48')]({'where':{'name':_0x17ec8b,'userProfileId':_0x27c453['userProfileId']},'raw':!![]})[_0x49e3('0x24')](function(_0x2ac1ee){if(_0x2ac1ee&&_0x2ac1ee[_0x49e3('0x4b')]===0x0){return db[_0x49e3('0x28')][_0x49e3('0x49')]({'name':_0x4dee32[_0x49e3('0x2a')],'resourceId':_0x4dee32['id'],'type':_0x2ac1ee['name'],'sectionId':_0x2ac1ee['id']},{})[_0x49e3('0x24')](function(){return _0x679c57;});}else{return _0x679c57;}})['catch'](function(_0x17a679){logger[_0x49e3('0x4c')](_0x49e3('0x4d'),_0x17a679);throw _0x17a679;});}return _0x679c57;})[_0x49e3('0x24')](respondWithResult(_0xa45d03,0xc9))['catch'](handleError(_0xa45d03,null));};exports[_0x49e3('0x23')]=function(_0x410a36,_0x396be5){if(_0x410a36[_0x49e3('0x4e')]['id']){delete _0x410a36[_0x49e3('0x4e')]['id'];}return db[_0x49e3('0x2e')]['find']({'where':{'id':_0x410a36[_0x49e3('0x4f')]['id']}})[_0x49e3('0x24')](handleEntityNotFound(_0x396be5,null))[_0x49e3('0x24')](saveUpdates(_0x410a36['body'],null))[_0x49e3('0x24')](respondWithResult(_0x396be5,null))[_0x49e3('0x45')](handleError(_0x396be5,null));};exports[_0x49e3('0x25')]=function(_0x5ba632,_0xf03e62){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x5ba632[_0x49e3('0x4f')]['id']}})['then'](handleEntityNotFound(_0xf03e62,null))[_0x49e3('0x24')](removeEntity(_0xf03e62,null))['catch'](handleError(_0xf03e62,null));};exports[_0x49e3('0x50')]=function(_0x445793,_0x52abcc,_0x260bb5){return db[_0x49e3('0x2e')][_0x49e3('0x48')]({'where':{'id':_0x445793[_0x49e3('0x4f')]['id']},'attributes':[_0x49e3('0x2a'),_0x49e3('0x51'),_0x49e3('0x52'),'output'],'raw':!![]})[_0x49e3('0x24')](handleEntityNotFound(_0x52abcc,null))[_0x49e3('0x24')](function(_0x872436){if(_0x872436){if(!fs[_0x49e3('0x53')](path[_0x49e3('0x54')](config[_0x49e3('0x55')],'server/files/reports',_0x872436[_0x49e3('0x52')]))){throw new db[(_0x49e3('0x56'))][(_0x49e3('0x57'))](_0x49e3('0x58'));}if(_0x445793['query']['exists']){return _0x52abcc[_0x49e3('0x19')](0xc8);}return _0x52abcc['download'](path[_0x49e3('0x54')](config[_0x49e3('0x55')],_0x49e3('0x59'),_0x872436[_0x49e3('0x52')]),util['format']('%s.%s',_0x872436[_0x49e3('0x51')]||_0x872436['name'],_0x872436[_0x49e3('0x5a')]['toLowerCase']()));}})['catch'](handleError(_0x52abcc,null));}; \ No newline at end of file +var _0x3a92=['json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','VIRTUAL','merge','AnalyticExtractedReport','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','download','%s.%s','output','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x44078c,_0x325b6b){var _0x5c1507=function(_0x573e5a){while(--_0x573e5a){_0x44078c['push'](_0x44078c['shift']());}};_0x5c1507(++_0x325b6b);}(_0x3a92,0x109));var _0x23a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a92[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23a9('0x0'));var zipdir=require(_0x23a9('0x1'));var jsonpatch=require(_0x23a9('0x2'));var rp=require(_0x23a9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x23a9('0x4'));var util=require(_0x23a9('0x5'));var path=require(_0x23a9('0x6'));var sox=require(_0x23a9('0x7'));var csv=require(_0x23a9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23a9('0x9'));var _=require(_0x23a9('0xa'));var squel=require(_0x23a9('0xb'));var crypto=require(_0x23a9('0xc'));var jsforce=require(_0x23a9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x23a9('0xe'));var Papa=require(_0x23a9('0xf'));var Redis=require(_0x23a9('0x10'));var authService=require(_0x23a9('0x11'));var qs=require(_0x23a9('0x12'));var as=require(_0x23a9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23a9('0x14'))('api');var utils=require(_0x23a9('0x15'));var config=require(_0x23a9('0x16'));var licenseUtil=require(_0x23a9('0x17'));var db=require(_0x23a9('0x18'))['db'];function respondWithStatusCode(_0x529106,_0x498a36){_0x498a36=_0x498a36||0xcc;return function(_0x5468db){if(_0x5468db){return _0x529106['sendStatus'](_0x498a36);}return _0x529106['status'](_0x498a36)['end']();};}function respondWithResult(_0x1be9e1,_0x3edb87){_0x3edb87=_0x3edb87||0xc8;return function(_0x49c160){if(_0x49c160){return _0x1be9e1[_0x23a9('0x19')](_0x3edb87)[_0x23a9('0x1a')](_0x49c160);}};}function respondWithFilteredResult(_0x382f09,_0x1efedc){return function(_0x455ef8){if(_0x455ef8){var _0x22b1ba=typeof _0x1efedc[_0x23a9('0x1b')]===_0x23a9('0x1c')&&typeof _0x1efedc['limit']===_0x23a9('0x1c');var _0x2b462f=_0x455ef8[_0x23a9('0x1d')];var _0x9b4bfa=_0x22b1ba?0x0:_0x1efedc[_0x23a9('0x1b')];var _0x3bc798=_0x22b1ba?_0x455ef8['count']:_0x1efedc[_0x23a9('0x1b')]+_0x1efedc[_0x23a9('0x1e')];var _0x117afa;if(_0x3bc798>=_0x2b462f){_0x3bc798=_0x2b462f;_0x117afa=0xc8;}else{_0x117afa=0xce;}_0x382f09[_0x23a9('0x19')](_0x117afa);return _0x382f09[_0x23a9('0x1f')](_0x23a9('0x20'),_0x9b4bfa+'-'+_0x3bc798+'/'+_0x2b462f)[_0x23a9('0x1a')](_0x455ef8);}return null;};}function patchUpdates(_0x3aa0bb){return function(_0x232999){try{jsonpatch['apply'](_0x232999,_0x3aa0bb,!![]);}catch(_0x3596c3){return BPromise[_0x23a9('0x21')](_0x3596c3);}return _0x232999[_0x23a9('0x22')]();};}function saveUpdates(_0x4a69f9,_0x4a341c){return function(_0x3e492a){if(_0x3e492a){return _0x3e492a[_0x23a9('0x23')](_0x4a69f9)[_0x23a9('0x24')](function(_0x4ec68f){return _0x4ec68f;});}return null;};}function removeEntity(_0xeadfd7,_0x5dfd3a){return function(_0xc88fd5){if(_0xc88fd5){return _0xc88fd5[_0x23a9('0x25')]()[_0x23a9('0x24')](function(){var _0x49fdae=_0xc88fd5['get']({'plain':!![]});var _0x348387=_0x23a9('0x26');return db[_0x23a9('0x27')]['destroy']({'where':{'type':_0x348387,'resourceId':_0x49fdae['id']}})[_0x23a9('0x24')](function(){return _0xc88fd5;});})[_0x23a9('0x24')](function(){_0xeadfd7[_0x23a9('0x19')](0xcc)[_0x23a9('0x28')]();});}};}function handleEntityNotFound(_0x378d94,_0x5e8af5){return function(_0x3f964f){if(!_0x3f964f){_0x378d94[_0x23a9('0x29')](0x194);}return _0x3f964f;};}function handleError(_0x41bf01,_0x240538){_0x240538=_0x240538||0x1f4;return function(_0x584eb3){logger[_0x23a9('0x2a')](_0x584eb3[_0x23a9('0x2b')]);if(_0x584eb3['name']){delete _0x584eb3[_0x23a9('0x2c')];}_0x41bf01[_0x23a9('0x19')](_0x240538)[_0x23a9('0x2d')](_0x584eb3);};}exports[_0x23a9('0x2e')]=function(_0x4f712e,_0x1569f7){var _0xf0612b={},_0x2ce85f={},_0x56e268={'count':0x0,'rows':[]};var _0x237ceb=_[_0x23a9('0x2f')](db['AnalyticExtractedReport'][_0x23a9('0x30')],function(_0x36c08d){return{'name':_0x36c08d[_0x23a9('0x31')],'type':_0x36c08d[_0x23a9('0x32')]['key']};});_0x2ce85f[_0x23a9('0x33')]=_[_0x23a9('0x2f')](_0x237ceb,_0x23a9('0x2c'));_0x2ce85f[_0x23a9('0x34')]=_[_0x23a9('0x35')](_0x4f712e[_0x23a9('0x34')]);_0x2ce85f[_0x23a9('0x36')]=_[_0x23a9('0x37')](_0x2ce85f[_0x23a9('0x33')],_0x2ce85f[_0x23a9('0x34')]);_0xf0612b[_0x23a9('0x38')]=_[_0x23a9('0x37')](_0x2ce85f[_0x23a9('0x33')],qs[_0x23a9('0x39')](_0x4f712e[_0x23a9('0x34')][_0x23a9('0x39')]));_0xf0612b[_0x23a9('0x38')]=_0xf0612b['attributes'][_0x23a9('0x3a')]?_0xf0612b[_0x23a9('0x38')]:_0x2ce85f[_0x23a9('0x33')];if(!_0x4f712e[_0x23a9('0x34')]['hasOwnProperty']('nolimit')){_0xf0612b[_0x23a9('0x1e')]=qs[_0x23a9('0x1e')](_0x4f712e[_0x23a9('0x34')]['limit']);_0xf0612b['offset']=qs['offset'](_0x4f712e[_0x23a9('0x34')][_0x23a9('0x1b')]);}_0xf0612b['order']=qs[_0x23a9('0x3b')](_0x4f712e[_0x23a9('0x34')]['sort']);_0xf0612b[_0x23a9('0x3c')]=qs[_0x23a9('0x36')](_[_0x23a9('0x3d')](_0x4f712e[_0x23a9('0x34')],_0x2ce85f[_0x23a9('0x36')]),_0x237ceb);if(_0x4f712e[_0x23a9('0x34')][_0x23a9('0x3e')]){_0xf0612b[_0x23a9('0x3c')]=_['merge'](_0xf0612b[_0x23a9('0x3c')],{'$or':_[_0x23a9('0x2f')](_0x237ceb,function(_0x2e7bb4){if(_0x2e7bb4[_0x23a9('0x32')]!==_0x23a9('0x3f')){var _0x13905e={};_0x13905e[_0x2e7bb4[_0x23a9('0x2c')]]={'$like':'%'+_0x4f712e[_0x23a9('0x34')][_0x23a9('0x3e')]+'%'};return _0x13905e;}})});}_0xf0612b=_[_0x23a9('0x40')]({},_0xf0612b,_0x4f712e['options']);var _0x5049ff={'where':_0xf0612b[_0x23a9('0x3c')]};return db[_0x23a9('0x41')][_0x23a9('0x1d')](_0x5049ff)['then'](function(_0xfde060){_0x56e268[_0x23a9('0x1d')]=_0xfde060;if(_0x4f712e[_0x23a9('0x34')][_0x23a9('0x42')]){_0xf0612b[_0x23a9('0x43')]=[{'all':!![]}];}return db[_0x23a9('0x41')][_0x23a9('0x44')](_0xf0612b);})[_0x23a9('0x24')](function(_0x19f35a){_0x56e268[_0x23a9('0x45')]=_0x19f35a;return _0x56e268;})[_0x23a9('0x24')](respondWithFilteredResult(_0x1569f7,_0xf0612b))['catch'](handleError(_0x1569f7,null));};exports[_0x23a9('0x46')]=function(_0x1f059a,_0x4351da){var _0x1f2db5={'raw':!![],'where':{'id':_0x1f059a[_0x23a9('0x47')]['id']}},_0x244db0={};_0x244db0[_0x23a9('0x33')]=_['keys'](db[_0x23a9('0x41')][_0x23a9('0x30')]);_0x244db0[_0x23a9('0x34')]=_[_0x23a9('0x35')](_0x1f059a[_0x23a9('0x34')]);_0x244db0[_0x23a9('0x36')]=_[_0x23a9('0x37')](_0x244db0[_0x23a9('0x33')],_0x244db0['query']);_0x1f2db5[_0x23a9('0x38')]=_[_0x23a9('0x37')](_0x244db0[_0x23a9('0x33')],qs[_0x23a9('0x39')](_0x1f059a[_0x23a9('0x34')][_0x23a9('0x39')]));_0x1f2db5[_0x23a9('0x38')]=_0x1f2db5[_0x23a9('0x38')]['length']?_0x1f2db5['attributes']:_0x244db0[_0x23a9('0x33')];if(_0x1f059a[_0x23a9('0x34')][_0x23a9('0x42')]){_0x1f2db5[_0x23a9('0x43')]=[{'all':!![]}];}_0x1f2db5=_['merge']({},_0x1f2db5,_0x1f059a[_0x23a9('0x48')]);return db['AnalyticExtractedReport'][_0x23a9('0x49')](_0x1f2db5)[_0x23a9('0x24')](handleEntityNotFound(_0x4351da,null))[_0x23a9('0x24')](respondWithResult(_0x4351da,null))[_0x23a9('0x4a')](handleError(_0x4351da,null));};exports[_0x23a9('0x4b')]=function(_0x5ab193,_0x502f0e){return db[_0x23a9('0x41')][_0x23a9('0x4b')](_0x5ab193[_0x23a9('0x4c')],{})[_0x23a9('0x24')](function(_0x54a9a7){var _0x710858=_0x5ab193[_0x23a9('0x4d')][_0x23a9('0x4e')]({'plain':!![]});if(!_0x710858)throw new Error(_0x23a9('0x4f'));if(_0x710858[_0x23a9('0x50')]==='user'){var _0x3f0daa=_0x54a9a7['get']({'plain':!![]});var _0x574dc4=_0x23a9('0x26');return db['UserProfileSection'][_0x23a9('0x49')]({'where':{'name':_0x574dc4,'userProfileId':_0x710858[_0x23a9('0x51')]},'raw':!![]})[_0x23a9('0x24')](function(_0x352813){if(_0x352813&&_0x352813[_0x23a9('0x52')]===0x0){return db[_0x23a9('0x27')][_0x23a9('0x4b')]({'name':_0x3f0daa['name'],'resourceId':_0x3f0daa['id'],'type':_0x352813[_0x23a9('0x2c')],'sectionId':_0x352813['id']},{})[_0x23a9('0x24')](function(){return _0x54a9a7;});}else{return _0x54a9a7;}})[_0x23a9('0x4a')](function(_0x1e1ff6){logger[_0x23a9('0x2a')](_0x23a9('0x53'),_0x1e1ff6);throw _0x1e1ff6;});}return _0x54a9a7;})[_0x23a9('0x24')](respondWithResult(_0x502f0e,0xc9))[_0x23a9('0x4a')](handleError(_0x502f0e,null));};exports[_0x23a9('0x23')]=function(_0x113bb9,_0x18f1ee){if(_0x113bb9[_0x23a9('0x4c')]['id']){delete _0x113bb9[_0x23a9('0x4c')]['id'];}return db[_0x23a9('0x41')][_0x23a9('0x49')]({'where':{'id':_0x113bb9[_0x23a9('0x47')]['id']}})[_0x23a9('0x24')](handleEntityNotFound(_0x18f1ee,null))[_0x23a9('0x24')](saveUpdates(_0x113bb9[_0x23a9('0x4c')],null))['then'](respondWithResult(_0x18f1ee,null))[_0x23a9('0x4a')](handleError(_0x18f1ee,null));};exports[_0x23a9('0x25')]=function(_0x12a74c,_0x4a6b90){return db[_0x23a9('0x41')][_0x23a9('0x49')]({'where':{'id':_0x12a74c[_0x23a9('0x47')]['id']}})[_0x23a9('0x24')](handleEntityNotFound(_0x4a6b90,null))[_0x23a9('0x24')](removeEntity(_0x4a6b90,null))[_0x23a9('0x4a')](handleError(_0x4a6b90,null));};exports['download']=function(_0xbbcfe0,_0x5cc481,_0x1b3316){return db[_0x23a9('0x41')][_0x23a9('0x49')]({'where':{'id':_0xbbcfe0['params']['id']},'attributes':['name',_0x23a9('0x54'),_0x23a9('0x55'),'output'],'raw':!![]})[_0x23a9('0x24')](handleEntityNotFound(_0x5cc481,null))['then'](function(_0x503b1){if(_0x503b1){if(!fs[_0x23a9('0x56')](path[_0x23a9('0x57')](config[_0x23a9('0x58')],_0x23a9('0x59'),_0x503b1[_0x23a9('0x55')]))){throw new db[(_0x23a9('0x5a'))]['ValidationError'](_0x23a9('0x5b'));}if(_0xbbcfe0[_0x23a9('0x34')][_0x23a9('0x5c')]){return _0x5cc481['sendStatus'](0xc8);}return _0x5cc481[_0x23a9('0x5d')](path[_0x23a9('0x57')](config[_0x23a9('0x58')],'server/files/reports',_0x503b1['savename']),util['format'](_0x23a9('0x5e'),_0x503b1[_0x23a9('0x54')]||_0x503b1[_0x23a9('0x2c')],_0x503b1[_0x23a9('0x5f')][_0x23a9('0x60')]()));}})[_0x23a9('0x4a')](handleError(_0x5cc481,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index afa6060..69a8e05 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 _0x907f=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x1d4e21,_0x4e8096){var _0x178fef=function(_0x515879){while(--_0x515879){_0x1d4e21['push'](_0x1d4e21['shift']());}};_0x178fef(++_0x4e8096);}(_0x907f,0x174));var _0xf907=function(_0x423d84,_0xa8a08b){_0x423d84=_0x423d84-0x0;var _0x49d0cd=_0x907f[_0x423d84];return _0x49d0cd;};'use strict';var _=require(_0xf907('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf907('0x1'));var moment=require(_0xf907('0x2'));var BPromise=require(_0xf907('0x3'));var rp=require(_0xf907('0x4'));var fs=require('fs');var path=require(_0xf907('0x5'));var rimraf=require('rimraf');var config=require(_0xf907('0x6'));var attributes=require(_0xf907('0x7'));module[_0xf907('0x8')]=function(_0x5b81e3,_0x1c26f1){return _0x5b81e3[_0xf907('0x9')](_0xf907('0xa'),attributes,{'tableName':_0xf907('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeb5=['bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','util','../../config/logger','api','moment'];(function(_0x2873bd,_0x3a8504){var _0x53cded=function(_0x18fc3e){while(--_0x18fc3e){_0x2873bd['push'](_0x2873bd['shift']());}};_0x53cded(++_0x3a8504);}(_0xbeb5,0x98));var _0x5beb=function(_0x580a5c,_0x4e6e33){_0x580a5c=_0x580a5c-0x0;var _0x32bffd=_0xbeb5[_0x580a5c];return _0x32bffd;};'use strict';var _=require('lodash');var util=require(_0x5beb('0x0'));var logger=require(_0x5beb('0x1'))(_0x5beb('0x2'));var moment=require(_0x5beb('0x3'));var BPromise=require(_0x5beb('0x4'));var rp=require(_0x5beb('0x5'));var fs=require('fs');var path=require(_0x5beb('0x6'));var rimraf=require('rimraf');var config=require(_0x5beb('0x7'));var attributes=require(_0x5beb('0x8'));module[_0x5beb('0x9')]=function(_0x401044,_0x10103e){return _0x401044[_0x5beb('0xa')](_0x5beb('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 b14d566..8c2c9ef 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 _0x6be1=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6be1,0x16e));var _0x16be=function(_0x538d1c,_0x170fc9){_0x538d1c=_0x538d1c-0x0;var _0x29be44=_0x6be1[_0x538d1c];return _0x29be44;};'use strict';var _=require(_0x16be('0x0'));var util=require('util');var moment=require(_0x16be('0x1'));var BPromise=require(_0x16be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16be('0x3'));var db=require(_0x16be('0x4'))['db'];var utils=require(_0x16be('0x5'));var logger=require(_0x16be('0x6'))(_0x16be('0x7'));var config=require(_0x16be('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5df1b4,_0xb76054,_0x2078ae){return new BPromise(function(_0x5d27e7,_0x52f4ee){return client[_0x16be('0x9')](_0x5df1b4,_0x2078ae)[_0x16be('0xa')](function(_0x1b1a71){logger[_0x16be('0xb')](_0x16be('0xc'),_0xb76054,_0x16be('0xd'));logger['debug'](_0x16be('0xe'),_0xb76054,_0x16be('0xd'),JSON[_0x16be('0xf')](_0x1b1a71));if(_0x1b1a71[_0x16be('0x10')]){if(_0x1b1a71[_0x16be('0x10')]['code']===0x1f4){logger['error'](_0x16be('0xc'),_0xb76054,_0x1b1a71[_0x16be('0x10')]['message']);return _0x52f4ee(_0x1b1a71['error'][_0x16be('0x11')]);}logger['error'](_0x16be('0xc'),_0xb76054,_0x1b1a71[_0x16be('0x10')]['message']);return _0x5d27e7(_0x1b1a71[_0x16be('0x10')][_0x16be('0x11')]);}else{logger['info'](_0x16be('0xc'),_0xb76054,_0x16be('0xd'));_0x5d27e7(_0x1b1a71[_0x16be('0x12')]['message']);}})['catch'](function(_0x4561bc){logger[_0x16be('0x10')](_0x16be('0xc'),_0xb76054,_0x4561bc);_0x52f4ee(_0x4561bc);});});} \ No newline at end of file +var _0x4443=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4443,0x71));var _0x3444=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4443[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3444('0x0'));var util=require('util');var moment=require(_0x3444('0x1'));var BPromise=require(_0x3444('0x2'));var rs=require(_0x3444('0x3'));var fs=require('fs');var Redis=require(_0x3444('0x4'));var db=require(_0x3444('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3444('0x6'))(_0x3444('0x7'));var config=require(_0x3444('0x8'));var jayson=require(_0x3444('0x9'));var client=jayson[_0x3444('0xa')][_0x3444('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b86a1,_0x10c432,_0x5c699b){return new BPromise(function(_0x43735a,_0x30713a){return client[_0x3444('0xc')](_0x2b86a1,_0x5c699b)['then'](function(_0x27f17b){logger[_0x3444('0xd')](_0x3444('0xe'),_0x10c432,_0x3444('0xf'));logger[_0x3444('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x10c432,_0x3444('0xf'),JSON['stringify'](_0x27f17b));if(_0x27f17b[_0x3444('0x11')]){if(_0x27f17b[_0x3444('0x11')]['code']===0x1f4){logger[_0x3444('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x10c432,_0x27f17b[_0x3444('0x11')][_0x3444('0x12')]);return _0x30713a(_0x27f17b[_0x3444('0x11')]['message']);}logger['error'](_0x3444('0xe'),_0x10c432,_0x27f17b[_0x3444('0x11')][_0x3444('0x12')]);return _0x43735a(_0x27f17b[_0x3444('0x11')]['message']);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x10c432,_0x3444('0xf'));_0x43735a(_0x27f17b[_0x3444('0x13')][_0x3444('0x12')]);}})[_0x3444('0x14')](function(_0x38e584){logger[_0x3444('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x10c432,_0x38e584);_0x30713a(_0x38e584);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index de200ff..8653ea4 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 _0x1606=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','download','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1606,0x119));var _0x6160=function(_0x365435,_0x1dfcc3){_0x365435=_0x365435-0x0;var _0x33bed6=_0x1606[_0x365435];return _0x33bed6;};'use strict';var multer=require(_0x6160('0x0'));var util=require(_0x6160('0x1'));var path=require(_0x6160('0x2'));var timeout=require(_0x6160('0x3'));var express=require('express');var router=express[_0x6160('0x4')]();var fs_extra=require(_0x6160('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6160('0x6'));var config=require(_0x6160('0x7'));var controller=require(_0x6160('0x8'));router[_0x6160('0x9')]('/',auth[_0x6160('0xa')](),controller[_0x6160('0xb')]);router['get']('/:id',auth[_0x6160('0xa')](),controller[_0x6160('0xc')]);router[_0x6160('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x6160('0xd')]);router['post']('/',auth[_0x6160('0xa')](),controller['create']);router[_0x6160('0xe')](_0x6160('0xf'),auth[_0x6160('0xa')](),controller[_0x6160('0x10')]);router[_0x6160('0x11')](_0x6160('0xf'),auth[_0x6160('0xa')](),controller[_0x6160('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4d1e=['put','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','download','create'];(function(_0x5d972c,_0x108c7a){var _0x1ccd1e=function(_0x538167){while(--_0x538167){_0x5d972c['push'](_0x5d972c['shift']());}};_0x1ccd1e(++_0x108c7a);}(_0x4d1e,0x81));var _0xe4d1=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x4d1e[_0x2abc3d];return _0x252745;};'use strict';var multer=require(_0xe4d1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe4d1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe4d1('0x2'));var auth=require(_0xe4d1('0x3'));var interaction=require(_0xe4d1('0x4'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xe4d1('0x5')]('/',auth[_0xe4d1('0x6')](),controller[_0xe4d1('0x7')]);router[_0xe4d1('0x5')](_0xe4d1('0x8'),auth[_0xe4d1('0x6')](),controller['show']);router['get']('/:id/download',auth[_0xe4d1('0x6')](),controller[_0xe4d1('0x9')]);router['post']('/',auth[_0xe4d1('0x6')](),controller[_0xe4d1('0xa')]);router[_0xe4d1('0xb')](_0xe4d1('0x8'),auth[_0xe4d1('0x6')](),controller['update']);router['delete']('/:id',auth[_0xe4d1('0x6')](),controller[_0xe4d1('0xc')]);module[_0xe4d1('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 4e70f39..91cdc64 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 _0x184a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x184a,0x6d));var _0xa184=function(_0x302fae,_0x4c33d9){_0x302fae=_0x302fae-0x0;var _0x63e136=_0x184a[_0x302fae];return _0x63e136;};'use strict';var Sequelize=require(_0xa184('0x0'));module[_0xa184('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xa184('0x2')]},'function':{'type':Sequelize[_0xa184('0x2')]},'format':{'type':Sequelize[_0xa184('0x2')]},'groupBy':{'type':Sequelize[_0xa184('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xa184('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8e4b=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0xe8ab3a,_0x8cbe7){var _0xdc35f8=function(_0xc1bb7b){while(--_0xc1bb7b){_0xe8ab3a['push'](_0xe8ab3a['shift']());}};_0xdc35f8(++_0x8cbe7);}(_0x8e4b,0x16a));var _0xb8e4=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0x8e4b[_0x47adb8];return _0x4689a8;};'use strict';var Sequelize=require(_0xb8e4('0x0'));module[_0xb8e4('0x1')]={'field':{'type':Sequelize[_0xb8e4('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xb8e4('0x3')]},'format':{'type':Sequelize[_0xb8e4('0x3')]},'groupBy':{'type':Sequelize[_0xb8e4('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb8e4('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 61312c2..0931de0 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 _0xf4cb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','VIRTUAL','then','includeAll','AnalyticFieldReport','findAll','rows','catch','show','params','keys','include','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x171ea0,_0x20019e){var _0x49f0ad=function(_0x17ed7f){while(--_0x17ed7f){_0x171ea0['push'](_0x171ea0['shift']());}};_0x49f0ad(++_0x20019e);}(_0xf4cb,0x1c5));var _0xbf4c=function(_0x5b9096,_0xeffc85){_0x5b9096=_0x5b9096-0x0;var _0x563fc5=_0xf4cb[_0x5b9096];return _0x563fc5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf4c('0x0'));var zipdir=require(_0xbf4c('0x1'));var jsonpatch=require(_0xbf4c('0x2'));var rp=require(_0xbf4c('0x3'));var moment=require(_0xbf4c('0x4'));var BPromise=require(_0xbf4c('0x5'));var Mustache=require(_0xbf4c('0x6'));var util=require(_0xbf4c('0x7'));var path=require('path');var sox=require(_0xbf4c('0x8'));var csv=require(_0xbf4c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf4c('0xa'));var _=require(_0xbf4c('0xb'));var squel=require(_0xbf4c('0xc'));var crypto=require('crypto');var jsforce=require(_0xbf4c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf4c('0xe'));var Papa=require('papaparse');var Redis=require(_0xbf4c('0xf'));var authService=require(_0xbf4c('0x10'));var qs=require(_0xbf4c('0x11'));var as=require(_0xbf4c('0x12'));var hardwareService=require(_0xbf4c('0x13'));var logger=require(_0xbf4c('0x14'))(_0xbf4c('0x15'));var utils=require('../../config/utils');var config=require(_0xbf4c('0x16'));var licenseUtil=require(_0xbf4c('0x17'));var db=require(_0xbf4c('0x18'))['db'];function respondWithStatusCode(_0x58352e,_0x421fee){_0x421fee=_0x421fee||0xcc;return function(_0x194a66){if(_0x194a66){return _0x58352e[_0xbf4c('0x19')](_0x421fee);}return _0x58352e[_0xbf4c('0x1a')](_0x421fee)['end']();};}function respondWithResult(_0x7716eb,_0x223008){_0x223008=_0x223008||0xc8;return function(_0x9887ff){if(_0x9887ff){return _0x7716eb[_0xbf4c('0x1a')](_0x223008)['json'](_0x9887ff);}};}function respondWithFilteredResult(_0x3bc07f,_0x409bf2){return function(_0x3c3aa5){if(_0x3c3aa5){var _0x504e9f=typeof _0x409bf2[_0xbf4c('0x1b')]===_0xbf4c('0x1c')&&typeof _0x409bf2[_0xbf4c('0x1d')]==='undefined';var _0x247bc1=_0x3c3aa5[_0xbf4c('0x1e')];var _0x1958b9=_0x504e9f?0x0:_0x409bf2[_0xbf4c('0x1b')];var _0x32865b=_0x504e9f?_0x3c3aa5[_0xbf4c('0x1e')]:_0x409bf2['offset']+_0x409bf2[_0xbf4c('0x1d')];var _0x244cf7;if(_0x32865b>=_0x247bc1){_0x32865b=_0x247bc1;_0x244cf7=0xc8;}else{_0x244cf7=0xce;}_0x3bc07f[_0xbf4c('0x1a')](_0x244cf7);return _0x3bc07f['set'](_0xbf4c('0x1f'),_0x1958b9+'-'+_0x32865b+'/'+_0x247bc1)['json'](_0x3c3aa5);}return null;};}function patchUpdates(_0x5a1e72){return function(_0x4cabff){try{jsonpatch[_0xbf4c('0x20')](_0x4cabff,_0x5a1e72,!![]);}catch(_0x32ef0b){return BPromise[_0xbf4c('0x21')](_0x32ef0b);}return _0x4cabff['save']();};}function saveUpdates(_0x1b80f7,_0x4eeec7){return function(_0x42c165){if(_0x42c165){return _0x42c165[_0xbf4c('0x22')](_0x1b80f7)['then'](function(_0x411131){return _0x411131;});}return null;};}function removeEntity(_0xee3e9e,_0x3c2be4){return function(_0x5de919){if(_0x5de919){return _0x5de919[_0xbf4c('0x23')]()['then'](function(){_0xee3e9e[_0xbf4c('0x1a')](0xcc)[_0xbf4c('0x24')]();});}};}function handleEntityNotFound(_0x482bf5,_0x3609d3){return function(_0x31d0f2){if(!_0x31d0f2){_0x482bf5[_0xbf4c('0x19')](0x194);}return _0x31d0f2;};}function handleError(_0x2c73eb,_0x465dad){_0x465dad=_0x465dad||0x1f4;return function(_0x418a9b){logger[_0xbf4c('0x25')](_0x418a9b[_0xbf4c('0x26')]);if(_0x418a9b[_0xbf4c('0x27')]){delete _0x418a9b[_0xbf4c('0x27')];}_0x2c73eb[_0xbf4c('0x1a')](_0x465dad)[_0xbf4c('0x28')](_0x418a9b);};}exports[_0xbf4c('0x29')]=function(_0x5bb87c,_0x340fef){var _0x396ff2={},_0xb1d3b5={},_0x42290d={'count':0x0,'rows':[]};var _0x277277=_[_0xbf4c('0x2a')](db['AnalyticFieldReport'][_0xbf4c('0x2b')],function(_0x1eb4c8){return{'name':_0x1eb4c8['fieldName'],'type':_0x1eb4c8[_0xbf4c('0x2c')][_0xbf4c('0x2d')]};});_0xb1d3b5[_0xbf4c('0x2e')]=_['map'](_0x277277,_0xbf4c('0x27'));_0xb1d3b5[_0xbf4c('0x2f')]=_['keys'](_0x5bb87c[_0xbf4c('0x2f')]);_0xb1d3b5[_0xbf4c('0x30')]=_['intersection'](_0xb1d3b5[_0xbf4c('0x2e')],_0xb1d3b5[_0xbf4c('0x2f')]);_0x396ff2[_0xbf4c('0x31')]=_[_0xbf4c('0x32')](_0xb1d3b5[_0xbf4c('0x2e')],qs['fields'](_0x5bb87c[_0xbf4c('0x2f')][_0xbf4c('0x33')]));_0x396ff2['attributes']=_0x396ff2[_0xbf4c('0x31')][_0xbf4c('0x34')]?_0x396ff2[_0xbf4c('0x31')]:_0xb1d3b5[_0xbf4c('0x2e')];if(!_0x5bb87c[_0xbf4c('0x2f')]['hasOwnProperty']('nolimit')){_0x396ff2[_0xbf4c('0x1d')]=qs['limit'](_0x5bb87c[_0xbf4c('0x2f')][_0xbf4c('0x1d')]);_0x396ff2[_0xbf4c('0x1b')]=qs[_0xbf4c('0x1b')](_0x5bb87c[_0xbf4c('0x2f')]['offset']);}_0x396ff2[_0xbf4c('0x35')]=qs[_0xbf4c('0x36')](_0x5bb87c[_0xbf4c('0x2f')][_0xbf4c('0x36')]);_0x396ff2[_0xbf4c('0x37')]=qs[_0xbf4c('0x30')](_[_0xbf4c('0x38')](_0x5bb87c[_0xbf4c('0x2f')],_0xb1d3b5['filters']),_0x277277);if(_0x5bb87c['query']['filter']){_0x396ff2['where']=_['merge'](_0x396ff2[_0xbf4c('0x37')],{'$or':_['map'](_0x277277,function(_0x50b897){if(_0x50b897[_0xbf4c('0x2c')]!==_0xbf4c('0x39')){var _0x48fb44={};_0x48fb44[_0x50b897[_0xbf4c('0x27')]]={'$like':'%'+_0x5bb87c[_0xbf4c('0x2f')]['filter']+'%'};return _0x48fb44;}})});}_0x396ff2=_['merge']({},_0x396ff2,_0x5bb87c['options']);var _0x1663c6={'where':_0x396ff2[_0xbf4c('0x37')]};return db['AnalyticFieldReport'][_0xbf4c('0x1e')](_0x1663c6)[_0xbf4c('0x3a')](function(_0x5784d7){_0x42290d['count']=_0x5784d7;if(_0x5bb87c['query'][_0xbf4c('0x3b')]){_0x396ff2['include']=[{'all':!![]}];}return db[_0xbf4c('0x3c')][_0xbf4c('0x3d')](_0x396ff2);})[_0xbf4c('0x3a')](function(_0x3a99bd){_0x42290d[_0xbf4c('0x3e')]=_0x3a99bd;return _0x42290d;})[_0xbf4c('0x3a')](respondWithFilteredResult(_0x340fef,_0x396ff2))[_0xbf4c('0x3f')](handleError(_0x340fef,null));};exports[_0xbf4c('0x40')]=function(_0x2426d3,_0x5574b9){var _0x2147f4={'raw':![],'where':{'id':_0x2426d3[_0xbf4c('0x41')]['id']}},_0x1171a3={};_0x1171a3['model']=_[_0xbf4c('0x42')](db[_0xbf4c('0x3c')][_0xbf4c('0x2b')]);_0x1171a3[_0xbf4c('0x2f')]=_['keys'](_0x2426d3[_0xbf4c('0x2f')]);_0x1171a3[_0xbf4c('0x30')]=_[_0xbf4c('0x32')](_0x1171a3[_0xbf4c('0x2e')],_0x1171a3[_0xbf4c('0x2f')]);_0x2147f4['attributes']=_[_0xbf4c('0x32')](_0x1171a3[_0xbf4c('0x2e')],qs[_0xbf4c('0x33')](_0x2426d3[_0xbf4c('0x2f')][_0xbf4c('0x33')]));_0x2147f4[_0xbf4c('0x31')]=_0x2147f4[_0xbf4c('0x31')][_0xbf4c('0x34')]?_0x2147f4['attributes']:_0x1171a3['model'];if(_0x2426d3[_0xbf4c('0x2f')][_0xbf4c('0x3b')]){_0x2147f4[_0xbf4c('0x43')]=[{'all':!![]}];}_0x2147f4=_['merge']({},_0x2147f4,_0x2426d3['options']);return db[_0xbf4c('0x3c')][_0xbf4c('0x44')](_0x2147f4)[_0xbf4c('0x3a')](handleEntityNotFound(_0x5574b9,null))['then'](respondWithResult(_0x5574b9,null))[_0xbf4c('0x3f')](handleError(_0x5574b9,null));};exports['create']=function(_0x5815d4,_0x18994a){return db[_0xbf4c('0x3c')][_0xbf4c('0x45')](_0x5815d4[_0xbf4c('0x46')],{})[_0xbf4c('0x3a')](respondWithResult(_0x18994a,0xc9))[_0xbf4c('0x3f')](handleError(_0x18994a,null));};exports[_0xbf4c('0x47')]=function(_0x4c3bdd,_0x5c040f){return db[_0xbf4c('0x3c')][_0xbf4c('0x47')](_0x4c3bdd['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5c040f,0xc9))[_0xbf4c('0x3f')](handleError(_0x5c040f,null));};exports[_0xbf4c('0x22')]=function(_0x183bc1,_0x36c37d){if(_0x183bc1['body']['id']){delete _0x183bc1['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x183bc1[_0xbf4c('0x41')]['id']}})['then'](handleEntityNotFound(_0x36c37d,null))['then'](saveUpdates(_0x183bc1[_0xbf4c('0x46')],null))['then'](respondWithResult(_0x36c37d,null))['catch'](handleError(_0x36c37d,null));};exports[_0xbf4c('0x23')]=function(_0x12b81b,_0x21ffe1){return db[_0xbf4c('0x3c')]['find']({'where':{'id':_0x12b81b[_0xbf4c('0x41')]['id']}})[_0xbf4c('0x3a')](handleEntityNotFound(_0x21ffe1,null))[_0xbf4c('0x3a')](removeEntity(_0x21ffe1,null))[_0xbf4c('0x3f')](handleError(_0x21ffe1,null));};exports[_0xbf4c('0x48')]=function(_0x14ab43,_0x5dc5a5){return db[_0xbf4c('0x3c')][_0xbf4c('0x23')]({'where':{'id':_0x14ab43[_0xbf4c('0x2f')][_0xbf4c('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xbf4c('0x3a')](respondWithResult(_0x5dc5a5,0xcc))['catch'](handleError(_0x5dc5a5,null));};exports[_0xbf4c('0x4a')]=function(_0x188a0c,_0xaaaed6,_0x41099e){return db[_0xbf4c('0x4b')]['findOne']({'where':{'id':_0x188a0c[_0xbf4c('0x41')]['id']}})[_0xbf4c('0x3a')](handleEntityNotFound(_0xaaaed6,null))['then'](function(_0x2f8879){if(_0x2f8879){return db[_0xbf4c('0x4c')][_0xbf4c('0x4d')](function(_0x359122){return db[_0xbf4c('0x3c')][_0xbf4c('0x23')]({'where':{'CustomReportId':_0x188a0c[_0xbf4c('0x41')]['id']},'transaction':_0x359122})[_0xbf4c('0x3a')](function(_0x5e7ca1){var _0x5ae69f=_[_0xbf4c('0x2a')](_0x188a0c[_0xbf4c('0x46')],function(_0x39abd5){delete _0x39abd5['id'];_0x39abd5[_0xbf4c('0x4e')]=_0x188a0c[_0xbf4c('0x41')]['id'];return _0x39abd5;});return db[_0xbf4c('0x3c')][_0xbf4c('0x47')](_0x5ae69f,{'transaction':_0x359122});});})['then'](function(){return db['AnalyticFieldReport'][_0xbf4c('0x3d')]({'where':{'CustomReportId':_0x188a0c[_0xbf4c('0x41')]['id']}});});}})[_0xbf4c('0x3a')](respondWithResult(_0xaaaed6,null))[_0xbf4c('0x3f')](handleError(_0xaaaed6,null));}; \ No newline at end of file +var _0xf58b=['nolimit','sort','where','pick','filter','VIRTUAL','merge','then','includeAll','include','findAll','rows','catch','show','params','fields','length','options','find','create','body','bulkCreate','update','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty'];(function(_0xf803a,_0x23b083){var _0x45a2a3=function(_0x393deb){while(--_0x393deb){_0xf803a['push'](_0xf803a['shift']());}};_0x45a2a3(++_0x23b083);}(_0xf58b,0x1bc));var _0xbf58=function(_0x1878db,_0x18d9f6){_0x1878db=_0x1878db-0x0;var _0x1ae242=_0xf58b[_0x1878db];return _0x1ae242;};'use strict';var emlformat=require(_0xbf58('0x0'));var rimraf=require(_0xbf58('0x1'));var zipdir=require(_0xbf58('0x2'));var jsonpatch=require(_0xbf58('0x3'));var rp=require(_0xbf58('0x4'));var moment=require(_0xbf58('0x5'));var BPromise=require(_0xbf58('0x6'));var Mustache=require(_0xbf58('0x7'));var util=require(_0xbf58('0x8'));var path=require(_0xbf58('0x9'));var sox=require('sox');var csv=require(_0xbf58('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf58('0xb'));var _=require(_0xbf58('0xc'));var squel=require(_0xbf58('0xd'));var crypto=require(_0xbf58('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbf58('0xf'));var toCsv=require(_0xbf58('0xa'));var querystring=require(_0xbf58('0x10'));var Papa=require(_0xbf58('0x11'));var Redis=require(_0xbf58('0x12'));var authService=require(_0xbf58('0x13'));var qs=require(_0xbf58('0x14'));var as=require(_0xbf58('0x15'));var hardwareService=require(_0xbf58('0x16'));var logger=require(_0xbf58('0x17'))('api');var utils=require(_0xbf58('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bc77b,_0x554644){_0x554644=_0x554644||0xcc;return function(_0x45c6f4){if(_0x45c6f4){return _0x3bc77b[_0xbf58('0x19')](_0x554644);}return _0x3bc77b[_0xbf58('0x1a')](_0x554644)[_0xbf58('0x1b')]();};}function respondWithResult(_0x52dad9,_0x4529f1){_0x4529f1=_0x4529f1||0xc8;return function(_0x2a6d6b){if(_0x2a6d6b){return _0x52dad9['status'](_0x4529f1)[_0xbf58('0x1c')](_0x2a6d6b);}};}function respondWithFilteredResult(_0x48eaed,_0xd838b5){return function(_0x26ed47){if(_0x26ed47){var _0x5a9141=typeof _0xd838b5[_0xbf58('0x1d')]===_0xbf58('0x1e')&&typeof _0xd838b5[_0xbf58('0x1f')]===_0xbf58('0x1e');var _0x1d4479=_0x26ed47[_0xbf58('0x20')];var _0x235cc3=_0x5a9141?0x0:_0xd838b5['offset'];var _0x5c49f9=_0x5a9141?_0x26ed47[_0xbf58('0x20')]:_0xd838b5['offset']+_0xd838b5[_0xbf58('0x1f')];var _0x47c36c;if(_0x5c49f9>=_0x1d4479){_0x5c49f9=_0x1d4479;_0x47c36c=0xc8;}else{_0x47c36c=0xce;}_0x48eaed[_0xbf58('0x1a')](_0x47c36c);return _0x48eaed[_0xbf58('0x21')](_0xbf58('0x22'),_0x235cc3+'-'+_0x5c49f9+'/'+_0x1d4479)[_0xbf58('0x1c')](_0x26ed47);}return null;};}function patchUpdates(_0x4afc06){return function(_0x1a2e2a){try{jsonpatch[_0xbf58('0x23')](_0x1a2e2a,_0x4afc06,!![]);}catch(_0x59a304){return BPromise[_0xbf58('0x24')](_0x59a304);}return _0x1a2e2a[_0xbf58('0x25')]();};}function saveUpdates(_0x5bfad8,_0xe5cd70){return function(_0x13909b){if(_0x13909b){return _0x13909b['update'](_0x5bfad8)['then'](function(_0x2d995c){return _0x2d995c;});}return null;};}function removeEntity(_0x4020fe,_0xf2999a){return function(_0x3b05da){if(_0x3b05da){return _0x3b05da[_0xbf58('0x26')]()['then'](function(){_0x4020fe[_0xbf58('0x1a')](0xcc)[_0xbf58('0x1b')]();});}};}function handleEntityNotFound(_0x5d11a5,_0x355a13){return function(_0x3eea95){if(!_0x3eea95){_0x5d11a5[_0xbf58('0x19')](0x194);}return _0x3eea95;};}function handleError(_0x14c70b,_0x8f2afb){_0x8f2afb=_0x8f2afb||0x1f4;return function(_0x5b3e41){logger[_0xbf58('0x27')](_0x5b3e41[_0xbf58('0x28')]);if(_0x5b3e41['name']){delete _0x5b3e41[_0xbf58('0x29')];}_0x14c70b[_0xbf58('0x1a')](_0x8f2afb)['send'](_0x5b3e41);};}exports['index']=function(_0x1fb84d,_0x39752c){var _0x4cedd4={},_0x3c0b5c={},_0x2be790={'count':0x0,'rows':[]};var _0x401557=_[_0xbf58('0x2a')](db[_0xbf58('0x2b')][_0xbf58('0x2c')],function(_0x7287f){return{'name':_0x7287f[_0xbf58('0x2d')],'type':_0x7287f['type'][_0xbf58('0x2e')]};});_0x3c0b5c[_0xbf58('0x2f')]=_[_0xbf58('0x2a')](_0x401557,_0xbf58('0x29'));_0x3c0b5c[_0xbf58('0x30')]=_[_0xbf58('0x31')](_0x1fb84d[_0xbf58('0x30')]);_0x3c0b5c[_0xbf58('0x32')]=_[_0xbf58('0x33')](_0x3c0b5c[_0xbf58('0x2f')],_0x3c0b5c['query']);_0x4cedd4[_0xbf58('0x34')]=_[_0xbf58('0x33')](_0x3c0b5c[_0xbf58('0x2f')],qs['fields'](_0x1fb84d[_0xbf58('0x30')]['fields']));_0x4cedd4[_0xbf58('0x34')]=_0x4cedd4['attributes']['length']?_0x4cedd4['attributes']:_0x3c0b5c[_0xbf58('0x2f')];if(!_0x1fb84d['query'][_0xbf58('0x35')](_0xbf58('0x36'))){_0x4cedd4[_0xbf58('0x1f')]=qs['limit'](_0x1fb84d['query']['limit']);_0x4cedd4['offset']=qs[_0xbf58('0x1d')](_0x1fb84d[_0xbf58('0x30')][_0xbf58('0x1d')]);}_0x4cedd4['order']=qs['sort'](_0x1fb84d[_0xbf58('0x30')][_0xbf58('0x37')]);_0x4cedd4[_0xbf58('0x38')]=qs['filters'](_[_0xbf58('0x39')](_0x1fb84d['query'],_0x3c0b5c['filters']),_0x401557);if(_0x1fb84d['query'][_0xbf58('0x3a')]){_0x4cedd4[_0xbf58('0x38')]=_['merge'](_0x4cedd4[_0xbf58('0x38')],{'$or':_['map'](_0x401557,function(_0x2e7637){if(_0x2e7637['type']!==_0xbf58('0x3b')){var _0x3b0303={};_0x3b0303[_0x2e7637[_0xbf58('0x29')]]={'$like':'%'+_0x1fb84d['query'][_0xbf58('0x3a')]+'%'};return _0x3b0303;}})});}_0x4cedd4=_[_0xbf58('0x3c')]({},_0x4cedd4,_0x1fb84d['options']);var _0x45d880={'where':_0x4cedd4[_0xbf58('0x38')]};return db[_0xbf58('0x2b')][_0xbf58('0x20')](_0x45d880)[_0xbf58('0x3d')](function(_0x126785){_0x2be790[_0xbf58('0x20')]=_0x126785;if(_0x1fb84d[_0xbf58('0x30')][_0xbf58('0x3e')]){_0x4cedd4[_0xbf58('0x3f')]=[{'all':!![]}];}return db[_0xbf58('0x2b')][_0xbf58('0x40')](_0x4cedd4);})['then'](function(_0x7eefef){_0x2be790[_0xbf58('0x41')]=_0x7eefef;return _0x2be790;})[_0xbf58('0x3d')](respondWithFilteredResult(_0x39752c,_0x4cedd4))[_0xbf58('0x42')](handleError(_0x39752c,null));};exports[_0xbf58('0x43')]=function(_0x487a5c,_0x1375cf){var _0x2f7c63={'raw':![],'where':{'id':_0x487a5c[_0xbf58('0x44')]['id']}},_0x314d9f={};_0x314d9f[_0xbf58('0x2f')]=_[_0xbf58('0x31')](db[_0xbf58('0x2b')][_0xbf58('0x2c')]);_0x314d9f['query']=_[_0xbf58('0x31')](_0x487a5c[_0xbf58('0x30')]);_0x314d9f[_0xbf58('0x32')]=_[_0xbf58('0x33')](_0x314d9f['model'],_0x314d9f['query']);_0x2f7c63[_0xbf58('0x34')]=_['intersection'](_0x314d9f[_0xbf58('0x2f')],qs['fields'](_0x487a5c[_0xbf58('0x30')][_0xbf58('0x45')]));_0x2f7c63[_0xbf58('0x34')]=_0x2f7c63[_0xbf58('0x34')][_0xbf58('0x46')]?_0x2f7c63[_0xbf58('0x34')]:_0x314d9f[_0xbf58('0x2f')];if(_0x487a5c[_0xbf58('0x30')]['includeAll']){_0x2f7c63[_0xbf58('0x3f')]=[{'all':!![]}];}_0x2f7c63=_[_0xbf58('0x3c')]({},_0x2f7c63,_0x487a5c[_0xbf58('0x47')]);return db[_0xbf58('0x2b')][_0xbf58('0x48')](_0x2f7c63)['then'](handleEntityNotFound(_0x1375cf,null))[_0xbf58('0x3d')](respondWithResult(_0x1375cf,null))['catch'](handleError(_0x1375cf,null));};exports['create']=function(_0x544198,_0x30fccd){return db[_0xbf58('0x2b')][_0xbf58('0x49')](_0x544198[_0xbf58('0x4a')],{})[_0xbf58('0x3d')](respondWithResult(_0x30fccd,0xc9))[_0xbf58('0x42')](handleError(_0x30fccd,null));};exports[_0xbf58('0x4b')]=function(_0x26c827,_0x433396){return db[_0xbf58('0x2b')][_0xbf58('0x4b')](_0x26c827['body'],{'raw':![],'individualHooks':!![]})[_0xbf58('0x3d')](respondWithResult(_0x433396,0xc9))[_0xbf58('0x42')](handleError(_0x433396,null));};exports[_0xbf58('0x4c')]=function(_0x1e9ad0,_0x229345){if(_0x1e9ad0[_0xbf58('0x4a')]['id']){delete _0x1e9ad0['body']['id'];}return db[_0xbf58('0x2b')]['find']({'where':{'id':_0x1e9ad0[_0xbf58('0x44')]['id']}})[_0xbf58('0x3d')](handleEntityNotFound(_0x229345,null))['then'](saveUpdates(_0x1e9ad0[_0xbf58('0x4a')],null))[_0xbf58('0x3d')](respondWithResult(_0x229345,null))[_0xbf58('0x42')](handleError(_0x229345,null));};exports['destroy']=function(_0x585e8f,_0x2fcec9){return db[_0xbf58('0x2b')][_0xbf58('0x48')]({'where':{'id':_0x585e8f[_0xbf58('0x44')]['id']}})[_0xbf58('0x3d')](handleEntityNotFound(_0x2fcec9,null))[_0xbf58('0x3d')](removeEntity(_0x2fcec9,null))[_0xbf58('0x42')](handleError(_0x2fcec9,null));};exports[_0xbf58('0x4d')]=function(_0x12338c,_0xdcb9dc){return db[_0xbf58('0x2b')][_0xbf58('0x26')]({'where':{'id':_0x12338c['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0xbf58('0x3d')](respondWithResult(_0xdcb9dc,0xcc))[_0xbf58('0x42')](handleError(_0xdcb9dc,null));};exports[_0xbf58('0x4e')]=function(_0x2a9343,_0x4e2bde,_0x6abe19){return db[_0xbf58('0x4f')][_0xbf58('0x50')]({'where':{'id':_0x2a9343[_0xbf58('0x44')]['id']}})[_0xbf58('0x3d')](handleEntityNotFound(_0x4e2bde,null))['then'](function(_0x4d36b5){if(_0x4d36b5){return db[_0xbf58('0x51')]['transaction'](function(_0x4ade74){return db[_0xbf58('0x2b')][_0xbf58('0x26')]({'where':{'CustomReportId':_0x2a9343[_0xbf58('0x44')]['id']},'transaction':_0x4ade74})[_0xbf58('0x3d')](function(_0x3afbcc){var _0x310131=_[_0xbf58('0x2a')](_0x2a9343[_0xbf58('0x4a')],function(_0x5320d7){delete _0x5320d7['id'];_0x5320d7[_0xbf58('0x52')]=_0x2a9343[_0xbf58('0x44')]['id'];return _0x5320d7;});return db[_0xbf58('0x2b')]['bulkCreate'](_0x310131,{'transaction':_0x4ade74});});})[_0xbf58('0x3d')](function(){return db[_0xbf58('0x2b')][_0xbf58('0x40')]({'where':{'CustomReportId':_0x2a9343[_0xbf58('0x44')]['id']}});});}})[_0xbf58('0x3d')](respondWithResult(_0x4e2bde,null))[_0xbf58('0x42')](handleError(_0x4e2bde,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b573e92..a16b02c 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 _0x6764=['bluebird','request-promise','../../config/environment','exports','define','analytics_report_fields','util','../../config/logger','api','moment'];(function(_0x57d176,_0x245db7){var _0x47ffbf=function(_0x67109b){while(--_0x67109b){_0x57d176['push'](_0x57d176['shift']());}};_0x47ffbf(++_0x245db7);}(_0x6764,0x1aa));var _0x4676=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6764[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x4676('0x0'));var logger=require(_0x4676('0x1'))(_0x4676('0x2'));var moment=require(_0x4676('0x3'));var BPromise=require(_0x4676('0x4'));var rp=require(_0x4676('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4676('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x4676('0x7')]=function(_0x1fea04,_0x297cd2){return _0x1fea04[_0x4676('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x4676('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc222=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xc222,0x6e));var _0x2c22=function(_0x587832,_0x58eae6){_0x587832=_0x587832-0x0;var _0x283635=_0xc222[_0x587832];return _0x283635;};'use strict';var _=require(_0x2c22('0x0'));var util=require(_0x2c22('0x1'));var logger=require(_0x2c22('0x2'))(_0x2c22('0x3'));var moment=require('moment');var BPromise=require(_0x2c22('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c22('0x5'));var rimraf=require(_0x2c22('0x6'));var config=require(_0x2c22('0x7'));var attributes=require(_0x2c22('0x8'));module['exports']=function(_0x8a91f0,_0x275ab3){return _0x8a91f0[_0x2c22('0x9')](_0x2c22('0xa'),attributes,{'tableName':_0x2c22('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 6313b3e..3da2cb1 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 _0x392a=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x392a,0x8f));var _0xa392=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x392a[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xa392('0x0'));var util=require(_0xa392('0x1'));var moment=require(_0xa392('0x2'));var BPromise=require(_0xa392('0x3'));var rs=require(_0xa392('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa392('0x5'))(_0xa392('0x6'));var config=require(_0xa392('0x7'));var jayson=require(_0xa392('0x8'));var client=jayson[_0xa392('0x9')][_0xa392('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bf798,_0x38e3a3,_0x46fb56){return new BPromise(function(_0xdb9be,_0x45501b){return client[_0xa392('0xb')](_0x1bf798,_0x46fb56)[_0xa392('0xc')](function(_0x2f2d04){logger[_0xa392('0xd')](_0xa392('0xe'),_0x38e3a3,'request\x20sent');logger['debug'](_0xa392('0xf'),_0x38e3a3,_0xa392('0x10'),JSON['stringify'](_0x2f2d04));if(_0x2f2d04['error']){if(_0x2f2d04[_0xa392('0x11')][_0xa392('0x12')]===0x1f4){logger[_0xa392('0x11')](_0xa392('0xe'),_0x38e3a3,_0x2f2d04['error'][_0xa392('0x13')]);return _0x45501b(_0x2f2d04[_0xa392('0x11')][_0xa392('0x13')]);}logger[_0xa392('0x11')](_0xa392('0xe'),_0x38e3a3,_0x2f2d04[_0xa392('0x11')]['message']);return _0xdb9be(_0x2f2d04[_0xa392('0x11')]['message']);}else{logger['info'](_0xa392('0xe'),_0x38e3a3,'request\x20sent');_0xdb9be(_0x2f2d04[_0xa392('0x14')][_0xa392('0x13')]);}})[_0xa392('0x15')](function(_0x275b61){logger[_0xa392('0x11')](_0xa392('0xe'),_0x38e3a3,_0x275b61);_0x45501b(_0x275b61);});});} \ No newline at end of file +var _0xdd61=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xdd61,0x7d));var _0x1dd6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdd61[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x1dd6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1dd6('0x1'));var fs=require('fs');var Redis=require(_0x1dd6('0x2'));var db=require(_0x1dd6('0x3'))['db'];var utils=require(_0x1dd6('0x4'));var logger=require('../../config/logger')(_0x1dd6('0x5'));var config=require(_0x1dd6('0x6'));var jayson=require(_0x1dd6('0x7'));var client=jayson['client'][_0x1dd6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16e2cd,_0x58e2f4,_0x5e9285){return new BPromise(function(_0x5576cb,_0x5a74f6){return client['request'](_0x16e2cd,_0x5e9285)[_0x1dd6('0x9')](function(_0xf2582b){logger[_0x1dd6('0xa')](_0x1dd6('0xb'),_0x58e2f4,'request\x20sent');logger[_0x1dd6('0xc')](_0x1dd6('0xd'),_0x58e2f4,_0x1dd6('0xe'),JSON['stringify'](_0xf2582b));if(_0xf2582b[_0x1dd6('0xf')]){if(_0xf2582b[_0x1dd6('0xf')]['code']===0x1f4){logger[_0x1dd6('0xf')](_0x1dd6('0xb'),_0x58e2f4,_0xf2582b['error'][_0x1dd6('0x10')]);return _0x5a74f6(_0xf2582b['error']['message']);}logger['error'](_0x1dd6('0xb'),_0x58e2f4,_0xf2582b['error']['message']);return _0x5576cb(_0xf2582b[_0x1dd6('0xf')][_0x1dd6('0x10')]);}else{logger[_0x1dd6('0xa')](_0x1dd6('0xb'),_0x58e2f4,_0x1dd6('0xe'));_0x5576cb(_0xf2582b['result'][_0x1dd6('0x10')]);}})[_0x1dd6('0x11')](function(_0x51386e){logger['error'](_0x1dd6('0xb'),_0x58e2f4,_0x51386e);_0x5a74f6(_0x51386e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index cab171a..7312345 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(_0x3b9665,_0x55a64b){var _0x4956d8=function(_0x15b806){while(--_0x15b806){_0x3b9665['push'](_0x3b9665['shift']());}};_0x4956d8(++_0x55a64b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x2d7182,_0x51d7b5){var _0x1017cc=function(_0x53d24f){while(--_0x53d24f){_0x2d7182['push'](_0x2d7182['shift']());}};_0x1017cc(++_0x51d7b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 24030ae..06125bd 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 _0x2c1b=['TEXT','sequelize','exports','STRING','name'];(function(_0x20ee11,_0x2972e9){var _0x408a73=function(_0x557afd){while(--_0x557afd){_0x20ee11['push'](_0x20ee11['shift']());}};_0x408a73(++_0x2972e9);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x2c1b[_0x382e89];return _0x3a1318;};'use strict';var Sequelize=require(_0xb2c1('0x0'));module[_0xb2c1('0x1')]={'name':{'type':Sequelize[_0xb2c1('0x2')],'allowNull':![],'unique':_0xb2c1('0x3')},'table':{'type':Sequelize[_0xb2c1('0x2')]},'metric':{'type':Sequelize[_0xb2c1('0x4')]},'description':{'type':Sequelize[_0xb2c1('0x2')]}}; \ No newline at end of file +var _0x2a41=['name','TEXT','sequelize','STRING'];(function(_0x5b3161,_0x5d6c3f){var _0x52abd1=function(_0x5f1173){while(--_0x5f1173){_0x5b3161['push'](_0x5b3161['shift']());}};_0x52abd1(++_0x5d6c3f);}(_0x2a41,0x126));var _0x12a4=function(_0x1ce924,_0x220d57){_0x1ce924=_0x1ce924-0x0;var _0x2a8240=_0x2a41[_0x1ce924];return _0x2a8240;};'use strict';var Sequelize=require(_0x12a4('0x0'));module['exports']={'name':{'type':Sequelize[_0x12a4('0x1')],'allowNull':![],'unique':_0x12a4('0x2')},'table':{'type':Sequelize[_0x12a4('0x1')]},'metric':{'type':Sequelize[_0x12a4('0x3')]},'description':{'type':Sequelize[_0x12a4('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 13473fb..ec68be7 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 _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x104993,_0x3f9a6b){var _0x105a96=function(_0x4ad1cb){while(--_0x4ad1cb){_0x104993['push'](_0x104993['shift']());}};_0x105a96(++_0x3f9a6b);}(_0x81bd,0x7c));var _0xd81b=function(_0x21bf0d,_0x91bf98){_0x21bf0d=_0x21bf0d-0x0;var _0x561491=_0x81bd[_0x21bf0d];return _0x561491;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file +var _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x21350f,_0xe6e3ad){var _0x33746f=function(_0xd6188f){while(--_0xd6188f){_0x21350f['push'](_0x21350f['shift']());}};_0x33746f(++_0xe6e3ad);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x24ca[_0x3725ee];return _0x399c71;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index c376cca..036eab2 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 _0xc051=['analytics_metrics','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric'];(function(_0x167303,_0x52e7c0){var _0x1059af=function(_0x23a495){while(--_0x23a495){_0x167303['push'](_0x167303['shift']());}};_0x1059af(++_0x52e7c0);}(_0xc051,0xb5));var _0x1c05=function(_0x31be5c,_0x3bcff7){_0x31be5c=_0x31be5c-0x0;var _0x60979=_0xc051[_0x31be5c];return _0x60979;};'use strict';var _=require(_0x1c05('0x0'));var util=require(_0x1c05('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1c05('0x2'));var BPromise=require(_0x1c05('0x3'));var rp=require(_0x1c05('0x4'));var fs=require('fs');var path=require(_0x1c05('0x5'));var rimraf=require('rimraf');var config=require(_0x1c05('0x6'));var attributes=require(_0x1c05('0x7'));module[_0x1c05('0x8')]=function(_0x294fcb,_0x14284f){return _0x294fcb[_0x1c05('0x9')](_0x1c05('0xa'),attributes,{'tableName':_0x1c05('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06f4=['lodash','util','api','moment','path','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x06f4,0x136));var _0x406f=function(_0x207976,_0xbd789e){_0x207976=_0x207976-0x0;var _0x4e0b7f=_0x06f4[_0x207976];return _0x4e0b7f;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var logger=require('../../config/logger')(_0x406f('0x2'));var moment=require(_0x406f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x406f('0x4'));var rimraf=require('rimraf');var config=require(_0x406f('0x5'));var attributes=require(_0x406f('0x6'));module[_0x406f('0x7')]=function(_0x32b2bd,_0x59821c){return _0x32b2bd[_0x406f('0x8')]('AnalyticMetric',attributes,{'tableName':_0x406f('0x9'),'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 74baba1..0e78ec0 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 _0x7dd0=['rpc','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34bd11,_0x322433){var _0x2a4f5c=function(_0x3296e3){while(--_0x3296e3){_0x34bd11['push'](_0x34bd11['shift']());}};_0x2a4f5c(++_0x322433);}(_0x7dd0,0xa1));var _0x07dd=function(_0x2a13b3,_0x485e11){_0x2a13b3=_0x2a13b3-0x0;var _0x43f830=_0x7dd0[_0x2a13b3];return _0x43f830;};'use strict';var _=require('lodash');var util=require(_0x07dd('0x0'));var moment=require(_0x07dd('0x1'));var BPromise=require(_0x07dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07dd('0x3'));var db=require(_0x07dd('0x4'))['db'];var utils=require(_0x07dd('0x5'));var logger=require(_0x07dd('0x6'))(_0x07dd('0x7'));var config=require(_0x07dd('0x8'));var jayson=require(_0x07dd('0x9'));var client=jayson[_0x07dd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43489e,_0x2ba48e,_0x5250fa){return new BPromise(function(_0xda5650,_0x598685){return client[_0x07dd('0xb')](_0x43489e,_0x5250fa)['then'](function(_0xd8c512){logger[_0x07dd('0xc')](_0x07dd('0xd'),_0x2ba48e,_0x07dd('0xe'));logger[_0x07dd('0xf')](_0x07dd('0x10'),_0x2ba48e,_0x07dd('0xe'),JSON['stringify'](_0xd8c512));if(_0xd8c512[_0x07dd('0x11')]){if(_0xd8c512[_0x07dd('0x11')][_0x07dd('0x12')]===0x1f4){logger[_0x07dd('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x2ba48e,_0xd8c512['error'][_0x07dd('0x13')]);return _0x598685(_0xd8c512['error'][_0x07dd('0x13')]);}logger['error'](_0x07dd('0xd'),_0x2ba48e,_0xd8c512[_0x07dd('0x11')][_0x07dd('0x13')]);return _0xda5650(_0xd8c512[_0x07dd('0x11')]['message']);}else{logger[_0x07dd('0xc')](_0x07dd('0xd'),_0x2ba48e,_0x07dd('0xe'));_0xda5650(_0xd8c512[_0x07dd('0x14')][_0x07dd('0x13')]);}})['catch'](function(_0x1c398e){logger[_0x07dd('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x2ba48e,_0x1c398e);_0x598685(_0x1c398e);});});} \ No newline at end of file +var _0xa88e=['../../config/utils','../../config/logger','rpc','jayson/promise','request','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','moment','../../mysqldb'];(function(_0x26abd0,_0x190fa1){var _0x3ad6e4=function(_0x4e38c3){while(--_0x4e38c3){_0x26abd0['push'](_0x26abd0['shift']());}};_0x3ad6e4(++_0x190fa1);}(_0xa88e,0x12f));var _0xea88=function(_0xb7259b,_0x20488e){_0xb7259b=_0xb7259b-0x0;var _0x5557c8=_0xa88e[_0xb7259b];return _0x5557c8;};'use strict';var _=require(_0xea88('0x0'));var util=require('util');var moment=require(_0xea88('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea88('0x2'))['db'];var utils=require(_0xea88('0x3'));var logger=require(_0xea88('0x4'))(_0xea88('0x5'));var config=require('../../config/environment');var jayson=require(_0xea88('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x294bfe,_0x5f2e65,_0x2c53d5){return new BPromise(function(_0x304fde,_0x505117){return client[_0xea88('0x7')](_0x294bfe,_0x2c53d5)['then'](function(_0x3b58c4){logger['info'](_0xea88('0x8'),_0x5f2e65,_0xea88('0x9'));logger[_0xea88('0xa')](_0xea88('0xb'),_0x5f2e65,_0xea88('0x9'),JSON['stringify'](_0x3b58c4));if(_0x3b58c4[_0xea88('0xc')]){if(_0x3b58c4[_0xea88('0xc')]['code']===0x1f4){logger[_0xea88('0xc')](_0xea88('0x8'),_0x5f2e65,_0x3b58c4['error'][_0xea88('0xd')]);return _0x505117(_0x3b58c4[_0xea88('0xc')][_0xea88('0xd')]);}logger['error'](_0xea88('0x8'),_0x5f2e65,_0x3b58c4[_0xea88('0xc')][_0xea88('0xd')]);return _0x304fde(_0x3b58c4[_0xea88('0xc')]['message']);}else{logger[_0xea88('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x5f2e65,_0xea88('0x9'));_0x304fde(_0x3b58c4[_0xea88('0xf')][_0xea88('0xd')]);}})[_0xea88('0x10')](function(_0xd92914){logger['error'](_0xea88('0x8'),_0x5f2e65,_0xd92914);_0x505117(_0xd92914);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a5b28a2..903aa4a 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 _0xce1a=['../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','get','/:id','put','update','exports','multer','express','Router','fs-extra'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xce1a,0xbf));var _0xace1=function(_0x25ad7f,_0x13d63a){_0x25ad7f=_0x25ad7f-0x0;var _0x27ec9d=_0xce1a[_0x25ad7f];return _0x27ec9d;};'use strict';var multer=require(_0xace1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xace1('0x1'));var router=express[_0xace1('0x2')]();var fs_extra=require(_0xace1('0x3'));var auth=require(_0xace1('0x4'));var interaction=require(_0xace1('0x5'));var config=require('../../config/environment');var controller=require(_0xace1('0x6'));router['get']('/',auth[_0xace1('0x7')](),controller['index']);router[_0xace1('0x8')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['show']);router['post']('/',auth[_0xace1('0x7')](),controller['create']);router[_0xace1('0xa')](_0xace1('0x9'),auth[_0xace1('0x7')](),controller[_0xace1('0xb')]);router['delete'](_0xace1('0x9'),auth[_0xace1('0x7')](),controller['destroy']);module[_0xace1('0xc')]=router; \ No newline at end of file +var _0x8f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x61bb05,_0x47421f){var _0x3ceb3e=function(_0x54b8f7){while(--_0x54b8f7){_0x61bb05['push'](_0x61bb05['shift']());}};_0x3ceb3e(++_0x47421f);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['show']);router[_0xd8f9('0xd')]('/',auth[_0xd8f9('0x9')](),controller['create']);router[_0xd8f9('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);module[_0xd8f9('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index d4bf913..1c93d30 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 _0x222f=['sequelize','exports','TEXT'];(function(_0x1b964a,_0x40fdc2){var _0x2559fa=function(_0x1afe3e){while(--_0x1afe3e){_0x1b964a['push'](_0x1b964a['shift']());}};_0x2559fa(++_0x40fdc2);}(_0x222f,0x1a4));var _0xf222=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x222f[_0x2a4fe2];return _0x225c4a;};'use strict';var Sequelize=require(_0xf222('0x0'));module[_0xf222('0x1')]={'tree':{'type':Sequelize[_0xf222('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x17af=['sequelize','TEXT'];(function(_0x4aa068,_0x3e53d3){var _0x41b01a=function(_0x32ac23){while(--_0x32ac23){_0x4aa068['push'](_0x4aa068['shift']());}};_0x41b01a(++_0x3e53d3);}(_0x17af,0x19c));var _0xf17a=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0x17af[_0x4a6156];return _0x12c1f6;};'use strict';var Sequelize=require(_0xf17a('0x0'));module['exports']={'tree':{'type':Sequelize[_0xf17a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 9615252..0dda4d5 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 _0x0ed6=['util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject','update','then','destroy','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','includeAll','catch','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x3fd108,_0x5d911f){var _0x4f943f=function(_0x12abdf){while(--_0x12abdf){_0x3fd108['push'](_0x3fd108['shift']());}};_0x4f943f(++_0x5d911f);}(_0x0ed6,0x1dd));var _0x60ed=function(_0x57545b,_0x55be65){_0x57545b=_0x57545b-0x0;var _0x56cc26=_0x0ed6[_0x57545b];return _0x56cc26;};'use strict';var emlformat=require(_0x60ed('0x0'));var rimraf=require(_0x60ed('0x1'));var zipdir=require(_0x60ed('0x2'));var jsonpatch=require(_0x60ed('0x3'));var rp=require(_0x60ed('0x4'));var moment=require('moment');var BPromise=require(_0x60ed('0x5'));var Mustache=require('mustache');var util=require(_0x60ed('0x6'));var path=require(_0x60ed('0x7'));var sox=require(_0x60ed('0x8'));var csv=require('to-csv');var ejs=require(_0x60ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60ed('0xa'));var squel=require(_0x60ed('0xb'));var crypto=require(_0x60ed('0xc'));var jsforce=require(_0x60ed('0xd'));var deskjs=require(_0x60ed('0xe'));var toCsv=require(_0x60ed('0xf'));var querystring=require(_0x60ed('0x10'));var Papa=require('papaparse');var Redis=require(_0x60ed('0x11'));var authService=require(_0x60ed('0x12'));var qs=require(_0x60ed('0x13'));var as=require(_0x60ed('0x14'));var hardwareService=require(_0x60ed('0x15'));var logger=require(_0x60ed('0x16'))('api');var utils=require(_0x60ed('0x17'));var config=require(_0x60ed('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x60ed('0x19'))['db'];function respondWithStatusCode(_0x5034fb,_0x1368f3){_0x1368f3=_0x1368f3||0xcc;return function(_0x22cf43){if(_0x22cf43){return _0x5034fb['sendStatus'](_0x1368f3);}return _0x5034fb[_0x60ed('0x1a')](_0x1368f3)[_0x60ed('0x1b')]();};}function respondWithResult(_0x2454fd,_0x342786){_0x342786=_0x342786||0xc8;return function(_0x450806){if(_0x450806){return _0x2454fd[_0x60ed('0x1a')](_0x342786)['json'](_0x450806);}};}function respondWithFilteredResult(_0x4de931,_0x2f54b5){return function(_0x5cdb7b){if(_0x5cdb7b){var _0x23b4c1=typeof _0x2f54b5[_0x60ed('0x1c')]==='undefined'&&typeof _0x2f54b5[_0x60ed('0x1d')]===_0x60ed('0x1e');var _0x4864e7=_0x5cdb7b[_0x60ed('0x1f')];var _0x299150=_0x23b4c1?0x0:_0x2f54b5[_0x60ed('0x1c')];var _0x26de47=_0x23b4c1?_0x5cdb7b[_0x60ed('0x1f')]:_0x2f54b5['offset']+_0x2f54b5['limit'];var _0x4714ea;if(_0x26de47>=_0x4864e7){_0x26de47=_0x4864e7;_0x4714ea=0xc8;}else{_0x4714ea=0xce;}_0x4de931[_0x60ed('0x1a')](_0x4714ea);return _0x4de931[_0x60ed('0x20')]('Content-Range',_0x299150+'-'+_0x26de47+'/'+_0x4864e7)[_0x60ed('0x21')](_0x5cdb7b);}return null;};}function patchUpdates(_0x2d5caa){return function(_0xced070){try{jsonpatch[_0x60ed('0x22')](_0xced070,_0x2d5caa,!![]);}catch(_0x5d8166){return BPromise[_0x60ed('0x23')](_0x5d8166);}return _0xced070['save']();};}function saveUpdates(_0x1c2a97,_0x20d2a1){return function(_0x124c15){if(_0x124c15){return _0x124c15[_0x60ed('0x24')](_0x1c2a97)[_0x60ed('0x25')](function(_0x3f297e){return _0x3f297e;});}return null;};}function removeEntity(_0x16d94e,_0x56c2d2){return function(_0x23bbd0){if(_0x23bbd0){return _0x23bbd0[_0x60ed('0x26')]()['then'](function(){_0x16d94e[_0x60ed('0x1a')](0xcc)[_0x60ed('0x1b')]();});}};}function handleEntityNotFound(_0x347f45,_0x1c8fb8){return function(_0x4aadf5){if(!_0x4aadf5){_0x347f45['sendStatus'](0x194);}return _0x4aadf5;};}function handleError(_0x13c496,_0x25b91e){_0x25b91e=_0x25b91e||0x1f4;return function(_0x4c8262){logger['error'](_0x4c8262[_0x60ed('0x27')]);if(_0x4c8262[_0x60ed('0x28')]){delete _0x4c8262[_0x60ed('0x28')];}_0x13c496[_0x60ed('0x1a')](_0x25b91e)[_0x60ed('0x29')](_0x4c8262);};}exports[_0x60ed('0x2a')]=function(_0x5e7f1f,_0x1c5da4){var _0x510c1d={},_0x4cb8ce={},_0x279883={'count':0x0,'rows':[]};var _0x2effba=_['map'](db[_0x60ed('0x2b')][_0x60ed('0x2c')],function(_0x23fd13){return{'name':_0x23fd13[_0x60ed('0x2d')],'type':_0x23fd13[_0x60ed('0x2e')][_0x60ed('0x2f')]};});_0x4cb8ce[_0x60ed('0x30')]=_[_0x60ed('0x31')](_0x2effba,_0x60ed('0x28'));_0x4cb8ce['query']=_[_0x60ed('0x32')](_0x5e7f1f[_0x60ed('0x33')]);_0x4cb8ce[_0x60ed('0x34')]=_[_0x60ed('0x35')](_0x4cb8ce[_0x60ed('0x30')],_0x4cb8ce[_0x60ed('0x33')]);_0x510c1d[_0x60ed('0x36')]=_[_0x60ed('0x35')](_0x4cb8ce['model'],qs[_0x60ed('0x37')](_0x5e7f1f[_0x60ed('0x33')][_0x60ed('0x37')]));_0x510c1d[_0x60ed('0x36')]=_0x510c1d[_0x60ed('0x36')][_0x60ed('0x38')]?_0x510c1d[_0x60ed('0x36')]:_0x4cb8ce[_0x60ed('0x30')];if(!_0x5e7f1f[_0x60ed('0x33')]['hasOwnProperty']('nolimit')){_0x510c1d[_0x60ed('0x1d')]=qs[_0x60ed('0x1d')](_0x5e7f1f[_0x60ed('0x33')]['limit']);_0x510c1d[_0x60ed('0x1c')]=qs[_0x60ed('0x1c')](_0x5e7f1f[_0x60ed('0x33')][_0x60ed('0x1c')]);}_0x510c1d[_0x60ed('0x39')]=qs[_0x60ed('0x3a')](_0x5e7f1f['query'][_0x60ed('0x3a')]);_0x510c1d['where']=qs[_0x60ed('0x34')](_['pick'](_0x5e7f1f[_0x60ed('0x33')],_0x4cb8ce[_0x60ed('0x34')]),_0x2effba);if(_0x5e7f1f[_0x60ed('0x33')]['filter']){_0x510c1d[_0x60ed('0x3b')]=_[_0x60ed('0x3c')](_0x510c1d[_0x60ed('0x3b')],{'$or':_[_0x60ed('0x31')](_0x2effba,function(_0x45317f){if(_0x45317f['type']!=='VIRTUAL'){var _0x4742c4={};_0x4742c4[_0x45317f[_0x60ed('0x28')]]={'$like':'%'+_0x5e7f1f[_0x60ed('0x33')][_0x60ed('0x3d')]+'%'};return _0x4742c4;}})});}_0x510c1d=_[_0x60ed('0x3c')]({},_0x510c1d,_0x5e7f1f[_0x60ed('0x3e')]);var _0x38f860={'where':_0x510c1d['where']};return db[_0x60ed('0x2b')][_0x60ed('0x1f')](_0x38f860)[_0x60ed('0x25')](function(_0x4c7065){_0x279883[_0x60ed('0x1f')]=_0x4c7065;if(_0x5e7f1f[_0x60ed('0x33')]['includeAll']){_0x510c1d['include']=[{'all':!![]}];}return db[_0x60ed('0x2b')]['findAll'](_0x510c1d);})[_0x60ed('0x25')](function(_0x49cc95){_0x279883['rows']=_0x49cc95;return _0x279883;})['then'](respondWithFilteredResult(_0x1c5da4,_0x510c1d))['catch'](handleError(_0x1c5da4,null));};exports['show']=function(_0x210d8a,_0xb0b6c){var _0x37d8da={'raw':!![],'where':{'id':_0x210d8a['params']['id']}},_0x58d816={};_0x58d816[_0x60ed('0x30')]=_[_0x60ed('0x32')](db[_0x60ed('0x2b')][_0x60ed('0x2c')]);_0x58d816[_0x60ed('0x33')]=_['keys'](_0x210d8a['query']);_0x58d816[_0x60ed('0x34')]=_['intersection'](_0x58d816['model'],_0x58d816[_0x60ed('0x33')]);_0x37d8da['attributes']=_[_0x60ed('0x35')](_0x58d816[_0x60ed('0x30')],qs[_0x60ed('0x37')](_0x210d8a[_0x60ed('0x33')][_0x60ed('0x37')]));_0x37d8da[_0x60ed('0x36')]=_0x37d8da['attributes'][_0x60ed('0x38')]?_0x37d8da[_0x60ed('0x36')]:_0x58d816[_0x60ed('0x30')];if(_0x210d8a[_0x60ed('0x33')][_0x60ed('0x3f')]){_0x37d8da['include']=[{'all':!![]}];}_0x37d8da=_[_0x60ed('0x3c')]({},_0x37d8da,_0x210d8a[_0x60ed('0x3e')]);return db[_0x60ed('0x2b')]['find'](_0x37d8da)[_0x60ed('0x25')](handleEntityNotFound(_0xb0b6c,null))[_0x60ed('0x25')](respondWithResult(_0xb0b6c,null))[_0x60ed('0x40')](handleError(_0xb0b6c,null));};exports[_0x60ed('0x41')]=function(_0x5cabdf,_0x1d3033){return db[_0x60ed('0x2b')][_0x60ed('0x41')](_0x5cabdf[_0x60ed('0x42')],{})[_0x60ed('0x25')](respondWithResult(_0x1d3033,0xc9))[_0x60ed('0x40')](handleError(_0x1d3033,null));};exports[_0x60ed('0x24')]=function(_0x4801b3,_0xdc964c){if(_0x4801b3['body']['id']){delete _0x4801b3['body']['id'];}return db[_0x60ed('0x2b')][_0x60ed('0x43')]({'where':{'id':_0x4801b3[_0x60ed('0x44')]['id']}})[_0x60ed('0x25')](handleEntityNotFound(_0xdc964c,null))[_0x60ed('0x25')](saveUpdates(_0x4801b3[_0x60ed('0x42')],null))[_0x60ed('0x25')](respondWithResult(_0xdc964c,null))[_0x60ed('0x40')](handleError(_0xdc964c,null));};exports[_0x60ed('0x26')]=function(_0x2dc288,_0xd63e9f){return db[_0x60ed('0x2b')]['find']({'where':{'id':_0x2dc288[_0x60ed('0x44')]['id']}})['then'](handleEntityNotFound(_0xd63e9f,null))[_0x60ed('0x25')](removeEntity(_0xd63e9f,null))[_0x60ed('0x40')](handleError(_0xd63e9f,null));}; \ No newline at end of file +var _0x94d5=['key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes'];(function(_0x3574a3,_0x1c2f99){var _0x5429c4=function(_0x21b2b6){while(--_0x21b2b6){_0x3574a3['push'](_0x3574a3['shift']());}};_0x5429c4(++_0x1c2f99);}(_0x94d5,0xf3));var _0x594d=function(_0x2eda9b,_0x134210){_0x2eda9b=_0x2eda9b-0x0;var _0x2cbd61=_0x94d5[_0x2eda9b];return _0x2cbd61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x594d('0x0'));var zipdir=require(_0x594d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x594d('0x2'));var moment=require(_0x594d('0x3'));var BPromise=require(_0x594d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x594d('0x5'));var sox=require('sox');var csv=require(_0x594d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x594d('0x7'));var squel=require(_0x594d('0x8'));var crypto=require(_0x594d('0x9'));var jsforce=require(_0x594d('0xa'));var deskjs=require(_0x594d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x594d('0xc'));var qs=require(_0x594d('0xd'));var as=require(_0x594d('0xe'));var hardwareService=require(_0x594d('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x594d('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x594d('0x11'));var db=require(_0x594d('0x12'))['db'];function respondWithStatusCode(_0x646169,_0x44f555){_0x44f555=_0x44f555||0xcc;return function(_0x4453ce){if(_0x4453ce){return _0x646169['sendStatus'](_0x44f555);}return _0x646169[_0x594d('0x13')](_0x44f555)[_0x594d('0x14')]();};}function respondWithResult(_0x52b170,_0x2fa1c6){_0x2fa1c6=_0x2fa1c6||0xc8;return function(_0x1ab9a1){if(_0x1ab9a1){return _0x52b170[_0x594d('0x13')](_0x2fa1c6)[_0x594d('0x15')](_0x1ab9a1);}};}function respondWithFilteredResult(_0x31bfce,_0x4a5840){return function(_0x190ca2){if(_0x190ca2){var _0x5e86f3=typeof _0x4a5840[_0x594d('0x16')]===_0x594d('0x17')&&typeof _0x4a5840[_0x594d('0x18')]==='undefined';var _0x339e25=_0x190ca2['count'];var _0x43b8c5=_0x5e86f3?0x0:_0x4a5840[_0x594d('0x16')];var _0x573ef5=_0x5e86f3?_0x190ca2[_0x594d('0x19')]:_0x4a5840[_0x594d('0x16')]+_0x4a5840[_0x594d('0x18')];var _0x47e419;if(_0x573ef5>=_0x339e25){_0x573ef5=_0x339e25;_0x47e419=0xc8;}else{_0x47e419=0xce;}_0x31bfce[_0x594d('0x13')](_0x47e419);return _0x31bfce[_0x594d('0x1a')]('Content-Range',_0x43b8c5+'-'+_0x573ef5+'/'+_0x339e25)[_0x594d('0x15')](_0x190ca2);}return null;};}function patchUpdates(_0x4bd41e){return function(_0x18f3ab){try{jsonpatch[_0x594d('0x1b')](_0x18f3ab,_0x4bd41e,!![]);}catch(_0x1cd745){return BPromise[_0x594d('0x1c')](_0x1cd745);}return _0x18f3ab[_0x594d('0x1d')]();};}function saveUpdates(_0x13c0ea,_0x4c07ca){return function(_0x5730c5){if(_0x5730c5){return _0x5730c5[_0x594d('0x1e')](_0x13c0ea)[_0x594d('0x1f')](function(_0x1a6d53){return _0x1a6d53;});}return null;};}function removeEntity(_0xf6326c,_0x50405f){return function(_0x3cda89){if(_0x3cda89){return _0x3cda89[_0x594d('0x20')]()[_0x594d('0x1f')](function(){_0xf6326c[_0x594d('0x13')](0xcc)[_0x594d('0x14')]();});}};}function handleEntityNotFound(_0x33a432,_0x373a45){return function(_0x1dbb76){if(!_0x1dbb76){_0x33a432['sendStatus'](0x194);}return _0x1dbb76;};}function handleError(_0x361a07,_0x31e9d5){_0x31e9d5=_0x31e9d5||0x1f4;return function(_0x28b002){logger[_0x594d('0x21')](_0x28b002[_0x594d('0x22')]);if(_0x28b002['name']){delete _0x28b002[_0x594d('0x23')];}_0x361a07[_0x594d('0x13')](_0x31e9d5)[_0x594d('0x24')](_0x28b002);};}exports[_0x594d('0x25')]=function(_0x285235,_0x315256){var _0x2a59a4={},_0x1f1c7b={},_0xbedfff={'count':0x0,'rows':[]};var _0x531cd7=_[_0x594d('0x26')](db[_0x594d('0x27')][_0x594d('0x28')],function(_0x375ec0){return{'name':_0x375ec0['fieldName'],'type':_0x375ec0['type'][_0x594d('0x29')]};});_0x1f1c7b[_0x594d('0x2a')]=_[_0x594d('0x26')](_0x531cd7,_0x594d('0x23'));_0x1f1c7b[_0x594d('0x2b')]=_[_0x594d('0x2c')](_0x285235[_0x594d('0x2b')]);_0x1f1c7b['filters']=_[_0x594d('0x2d')](_0x1f1c7b[_0x594d('0x2a')],_0x1f1c7b[_0x594d('0x2b')]);_0x2a59a4[_0x594d('0x2e')]=_[_0x594d('0x2d')](_0x1f1c7b[_0x594d('0x2a')],qs['fields'](_0x285235['query'][_0x594d('0x2f')]));_0x2a59a4[_0x594d('0x2e')]=_0x2a59a4[_0x594d('0x2e')][_0x594d('0x30')]?_0x2a59a4['attributes']:_0x1f1c7b[_0x594d('0x2a')];if(!_0x285235['query'][_0x594d('0x31')](_0x594d('0x32'))){_0x2a59a4['limit']=qs[_0x594d('0x18')](_0x285235[_0x594d('0x2b')][_0x594d('0x18')]);_0x2a59a4[_0x594d('0x16')]=qs[_0x594d('0x16')](_0x285235[_0x594d('0x2b')][_0x594d('0x16')]);}_0x2a59a4[_0x594d('0x33')]=qs[_0x594d('0x34')](_0x285235[_0x594d('0x2b')][_0x594d('0x34')]);_0x2a59a4[_0x594d('0x35')]=qs['filters'](_[_0x594d('0x36')](_0x285235[_0x594d('0x2b')],_0x1f1c7b[_0x594d('0x37')]),_0x531cd7);if(_0x285235['query']['filter']){_0x2a59a4['where']=_[_0x594d('0x38')](_0x2a59a4[_0x594d('0x35')],{'$or':_[_0x594d('0x26')](_0x531cd7,function(_0x34a42b){if(_0x34a42b[_0x594d('0x39')]!==_0x594d('0x3a')){var _0x5e41af={};_0x5e41af[_0x34a42b[_0x594d('0x23')]]={'$like':'%'+_0x285235[_0x594d('0x2b')][_0x594d('0x3b')]+'%'};return _0x5e41af;}})});}_0x2a59a4=_[_0x594d('0x38')]({},_0x2a59a4,_0x285235[_0x594d('0x3c')]);var _0x555424={'where':_0x2a59a4[_0x594d('0x35')]};return db[_0x594d('0x27')][_0x594d('0x19')](_0x555424)[_0x594d('0x1f')](function(_0x557f0e){_0xbedfff['count']=_0x557f0e;if(_0x285235[_0x594d('0x2b')][_0x594d('0x3d')]){_0x2a59a4[_0x594d('0x3e')]=[{'all':!![]}];}return db[_0x594d('0x27')][_0x594d('0x3f')](_0x2a59a4);})['then'](function(_0x1fda00){_0xbedfff[_0x594d('0x40')]=_0x1fda00;return _0xbedfff;})['then'](respondWithFilteredResult(_0x315256,_0x2a59a4))[_0x594d('0x41')](handleError(_0x315256,null));};exports[_0x594d('0x42')]=function(_0x26ccc3,_0x566279){var _0x579387={'raw':!![],'where':{'id':_0x26ccc3[_0x594d('0x43')]['id']}},_0x1a1283={};_0x1a1283['model']=_[_0x594d('0x2c')](db[_0x594d('0x27')]['rawAttributes']);_0x1a1283[_0x594d('0x2b')]=_[_0x594d('0x2c')](_0x26ccc3['query']);_0x1a1283[_0x594d('0x37')]=_['intersection'](_0x1a1283[_0x594d('0x2a')],_0x1a1283[_0x594d('0x2b')]);_0x579387['attributes']=_['intersection'](_0x1a1283[_0x594d('0x2a')],qs[_0x594d('0x2f')](_0x26ccc3[_0x594d('0x2b')][_0x594d('0x2f')]));_0x579387[_0x594d('0x2e')]=_0x579387[_0x594d('0x2e')][_0x594d('0x30')]?_0x579387[_0x594d('0x2e')]:_0x1a1283[_0x594d('0x2a')];if(_0x26ccc3['query'][_0x594d('0x3d')]){_0x579387[_0x594d('0x3e')]=[{'all':!![]}];}_0x579387=_['merge']({},_0x579387,_0x26ccc3[_0x594d('0x3c')]);return db[_0x594d('0x27')][_0x594d('0x44')](_0x579387)[_0x594d('0x1f')](handleEntityNotFound(_0x566279,null))[_0x594d('0x1f')](respondWithResult(_0x566279,null))[_0x594d('0x41')](handleError(_0x566279,null));};exports[_0x594d('0x45')]=function(_0x1298e0,_0x1af02f){return db[_0x594d('0x27')]['create'](_0x1298e0[_0x594d('0x46')],{})[_0x594d('0x1f')](respondWithResult(_0x1af02f,0xc9))[_0x594d('0x41')](handleError(_0x1af02f,null));};exports[_0x594d('0x1e')]=function(_0x1cc81b,_0x3c97bf){if(_0x1cc81b['body']['id']){delete _0x1cc81b['body']['id'];}return db[_0x594d('0x27')][_0x594d('0x44')]({'where':{'id':_0x1cc81b[_0x594d('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c97bf,null))['then'](saveUpdates(_0x1cc81b[_0x594d('0x46')],null))['then'](respondWithResult(_0x3c97bf,null))[_0x594d('0x41')](handleError(_0x3c97bf,null));};exports[_0x594d('0x20')]=function(_0x2d40ab,_0x1c9b5d){return db[_0x594d('0x27')][_0x594d('0x44')]({'where':{'id':_0x2d40ab[_0x594d('0x43')]['id']}})[_0x594d('0x1f')](handleEntityNotFound(_0x1c9b5d,null))[_0x594d('0x1f')](removeEntity(_0x1c9b5d,null))[_0x594d('0x41')](handleError(_0x1c9b5d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index fc46e97..dccec0b 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 _0x1f45=['./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','path'];(function(_0x1701b9,_0x3aad79){var _0x102312=function(_0x5f1545){while(--_0x5f1545){_0x1701b9['push'](_0x1701b9['shift']());}};_0x102312(++_0x3aad79);}(_0x1f45,0x87));var _0x51f4=function(_0x56d2e5,_0x1151b9){_0x56d2e5=_0x56d2e5-0x0;var _0x1677b7=_0x1f45[_0x56d2e5];return _0x1677b7;};'use strict';var _=require('lodash');var util=require(_0x51f4('0x0'));var logger=require(_0x51f4('0x1'))(_0x51f4('0x2'));var moment=require('moment');var BPromise=require(_0x51f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51f4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x51f4('0x5'));module[_0x51f4('0x6')]=function(_0x46fbdc,_0x225acd){return _0x46fbdc[_0x51f4('0x7')](_0x51f4('0x8'),attributes,{'tableName':_0x51f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19e9=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x24cbd8,_0x53bf81){var _0x3f1020=function(_0x20b557){while(--_0x20b557){_0x24cbd8['push'](_0x24cbd8['shift']());}};_0x3f1020(++_0x53bf81);}(_0x19e9,0x160));var _0x919e=function(_0x4b3bea,_0x53c074){_0x4b3bea=_0x4b3bea-0x0;var _0xb624ae=_0x19e9[_0x4b3bea];return _0xb624ae;};'use strict';var _=require(_0x919e('0x0'));var util=require(_0x919e('0x1'));var logger=require(_0x919e('0x2'))(_0x919e('0x3'));var moment=require('moment');var BPromise=require(_0x919e('0x4'));var rp=require(_0x919e('0x5'));var fs=require('fs');var path=require(_0x919e('0x6'));var rimraf=require(_0x919e('0x7'));var config=require(_0x919e('0x8'));var attributes=require(_0x919e('0x9'));module[_0x919e('0xa')]=function(_0x58df26,_0x14912c){return _0x58df26[_0x919e('0xb')](_0x919e('0xc'),attributes,{'tableName':_0x919e('0xd'),'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 1188e46..18595d7 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x10f683,_0x285ba1){_0x10f683=_0x10f683-0x0;var _0x61f5c9=_0x7a54[_0x10f683];return _0x61f5c9;};'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(_0x3e53f6,_0x269f33){_0x3e53f6=_0x3e53f6-0x0;var _0x17e171=_0x7a54[_0x3e53f6];return _0x17e171;};'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 6602fa8..fb44342 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 _0xf02b=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x2ce3b3,_0x2da0da){var _0x1214b3=function(_0x1ce84b){while(--_0x1ce84b){_0x2ce3b3['push'](_0x2ce3b3['shift']());}};_0x1214b3(++_0x2da0da);}(_0xf02b,0x1e3));var _0xbf02=function(_0xe8b9c7,_0x534838){_0xe8b9c7=_0xe8b9c7-0x0;var _0x4b606f=_0xf02b[_0xe8b9c7];return _0x4b606f;};'use strict';var multer=require(_0xbf02('0x0'));var util=require('util');var path=require(_0xbf02('0x1'));var timeout=require(_0xbf02('0x2'));var express=require(_0xbf02('0x3'));var router=express[_0xbf02('0x4')]();var fs_extra=require(_0xbf02('0x5'));var auth=require(_0xbf02('0x6'));var interaction=require(_0xbf02('0x7'));var config=require(_0xbf02('0x8'));var controller=require(_0xbf02('0x9'));router[_0xbf02('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbf02('0xa')](_0xbf02('0xb'),auth[_0xbf02('0xc')](),controller[_0xbf02('0xd')]);router[_0xbf02('0xe')]('/',auth[_0xbf02('0xc')](),controller[_0xbf02('0xf')]);router[_0xbf02('0x10')]('/:id',auth[_0xbf02('0xc')](),controller[_0xbf02('0x11')]);router[_0xbf02('0x12')](_0xbf02('0xb'),auth[_0xbf02('0xc')](),controller[_0xbf02('0x13')]);module[_0xbf02('0x14')]=router; \ No newline at end of file +var _0x8e3b=['fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','update','delete','exports','path','connect-timeout','express'];(function(_0x5be3cc,_0x3b5c7d){var _0x1162a2=function(_0x1db04c){while(--_0x1db04c){_0x5be3cc['push'](_0x5be3cc['shift']());}};_0x1162a2(++_0x3b5c7d);}(_0x8e3b,0x1ed));var _0xb8e3=function(_0x2f90d0,_0x1d9ec1){_0x2f90d0=_0x2f90d0-0x0;var _0x25ed4b=_0x8e3b[_0x2f90d0];return _0x25ed4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb8e3('0x0'));var timeout=require(_0xb8e3('0x1'));var express=require(_0xb8e3('0x2'));var router=express['Router']();var fs_extra=require(_0xb8e3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb8e3('0x4'));var config=require(_0xb8e3('0x5'));var controller=require(_0xb8e3('0x6'));router[_0xb8e3('0x7')]('/',auth[_0xb8e3('0x8')](),controller[_0xb8e3('0x9')]);router[_0xb8e3('0x7')](_0xb8e3('0xa'),auth[_0xb8e3('0x8')](),controller[_0xb8e3('0xb')]);router[_0xb8e3('0xc')]('/',auth[_0xb8e3('0x8')](),controller['create']);router['put'](_0xb8e3('0xa'),auth['isAuthenticated'](),controller[_0xb8e3('0xd')]);router[_0xb8e3('0xe')](_0xb8e3('0xa'),auth[_0xb8e3('0x8')](),controller['destroy']);module[_0xb8e3('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 736255b..d4e5cca 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 _0x4350=['exports','STRING','sequelize'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x4350,0x1d0));var _0x0435=function(_0x2ba453,_0x4b4850){_0x2ba453=_0x2ba453-0x0;var _0x44d5d6=_0x4350[_0x2ba453];return _0x44d5d6;};'use strict';var Sequelize=require(_0x0435('0x0'));module[_0x0435('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x0435('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x09dd=['sequelize','exports','STRING'];(function(_0x4f34d8,_0x40f022){var _0xc97536=function(_0xef9dfc){while(--_0xef9dfc){_0x4f34d8['push'](_0x4f34d8['shift']());}};_0xc97536(++_0x40f022);}(_0x09dd,0x81));var _0xd09d=function(_0x1badb1,_0x375ec6){_0x1badb1=_0x1badb1-0x0;var _0x260dae=_0x09dd[_0x1badb1];return _0x260dae;};'use strict';var Sequelize=require(_0xd09d('0x0'));module[_0xd09d('0x1')]={'name':{'type':Sequelize[_0xd09d('0x2')]},'basename':{'type':Sequelize[_0xd09d('0x2')]},'type':{'type':Sequelize[_0xd09d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e684acc..3f53364 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 _0x8ba4=['reject','then','destroy','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','catch','show','params','clone','get','omit','createdAt','updatedAt','body','create','update','find','file','originalname','basename','filename','type','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x259e71,_0x178636){var _0x4cde6f=function(_0x4be4ec){while(--_0x4be4ec){_0x259e71['push'](_0x259e71['shift']());}};_0x4cde6f(++_0x178636);}(_0x8ba4,0x19b));var _0x48ba=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x8ba4[_0x224f65];return _0x3f921c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48ba('0x0'));var zipdir=require(_0x48ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48ba('0x2'));var BPromise=require(_0x48ba('0x3'));var Mustache=require(_0x48ba('0x4'));var util=require(_0x48ba('0x5'));var path=require(_0x48ba('0x6'));var sox=require(_0x48ba('0x7'));var csv=require(_0x48ba('0x8'));var ejs=require(_0x48ba('0x9'));var fs=require('fs');var fs_extra=require(_0x48ba('0xa'));var _=require(_0x48ba('0xb'));var squel=require('squel');var crypto=require(_0x48ba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x48ba('0xd'));var toCsv=require(_0x48ba('0x8'));var querystring=require('querystring');var Papa=require(_0x48ba('0xe'));var Redis=require('ioredis');var authService=require(_0x48ba('0xf'));var qs=require(_0x48ba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48ba('0x11'));var logger=require(_0x48ba('0x12'))(_0x48ba('0x13'));var utils=require(_0x48ba('0x14'));var config=require(_0x48ba('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x48ba('0x16'))['db'];function respondWithStatusCode(_0x326b32,_0x70858e){_0x70858e=_0x70858e||0xcc;return function(_0x45eac0){if(_0x45eac0){return _0x326b32[_0x48ba('0x17')](_0x70858e);}return _0x326b32[_0x48ba('0x18')](_0x70858e)[_0x48ba('0x19')]();};}function respondWithResult(_0xf304fb,_0x3852cd){_0x3852cd=_0x3852cd||0xc8;return function(_0xc8465){if(_0xc8465){return _0xf304fb[_0x48ba('0x18')](_0x3852cd)[_0x48ba('0x1a')](_0xc8465);}};}function respondWithFilteredResult(_0x13ba8b,_0x321cad){return function(_0x3a8281){if(_0x3a8281){var _0x143570=typeof _0x321cad[_0x48ba('0x1b')]===_0x48ba('0x1c')&&typeof _0x321cad[_0x48ba('0x1d')]===_0x48ba('0x1c');var _0x910cb9=_0x3a8281[_0x48ba('0x1e')];var _0x5e6969=_0x143570?0x0:_0x321cad[_0x48ba('0x1b')];var _0x885127=_0x143570?_0x3a8281[_0x48ba('0x1e')]:_0x321cad[_0x48ba('0x1b')]+_0x321cad[_0x48ba('0x1d')];var _0x596631;if(_0x885127>=_0x910cb9){_0x885127=_0x910cb9;_0x596631=0xc8;}else{_0x596631=0xce;}_0x13ba8b[_0x48ba('0x18')](_0x596631);return _0x13ba8b[_0x48ba('0x1f')](_0x48ba('0x20'),_0x5e6969+'-'+_0x885127+'/'+_0x910cb9)[_0x48ba('0x1a')](_0x3a8281);}return null;};}function patchUpdates(_0xa47a7e){return function(_0x5ce32f){try{jsonpatch[_0x48ba('0x21')](_0x5ce32f,_0xa47a7e,!![]);}catch(_0x1fce57){return BPromise[_0x48ba('0x22')](_0x1fce57);}return _0x5ce32f['save']();};}function saveUpdates(_0xf73caf,_0x2b09a3){return function(_0x52971e){if(_0x52971e){return _0x52971e['update'](_0xf73caf)[_0x48ba('0x23')](function(_0x1f00e6){return _0x1f00e6;});}return null;};}function removeEntity(_0x35152d,_0x4433e7){return function(_0x10c344){if(_0x10c344){return _0x10c344[_0x48ba('0x24')]()[_0x48ba('0x23')](function(){_0x35152d['status'](0xcc)[_0x48ba('0x19')]();});}};}function handleEntityNotFound(_0x351319,_0x40f4fc){return function(_0x4c5b2e){if(!_0x4c5b2e){_0x351319[_0x48ba('0x17')](0x194);}return _0x4c5b2e;};}function handleError(_0xcf9ba3,_0x12337e){_0x12337e=_0x12337e||0x1f4;return function(_0x1f4832){logger['error'](_0x1f4832[_0x48ba('0x25')]);if(_0x1f4832[_0x48ba('0x26')]){delete _0x1f4832[_0x48ba('0x26')];}_0xcf9ba3[_0x48ba('0x18')](_0x12337e)[_0x48ba('0x27')](_0x1f4832);};}exports[_0x48ba('0x28')]=function(_0x3c1e6e,_0x2366d1){var _0x5155ce={},_0x14e19d={},_0x48ff13={'count':0x0,'rows':[]};var _0x19da6d=_[_0x48ba('0x29')](db[_0x48ba('0x2a')][_0x48ba('0x2b')],function(_0x5694f5){return{'name':_0x5694f5[_0x48ba('0x2c')],'type':_0x5694f5['type'][_0x48ba('0x2d')]};});_0x14e19d['model']=_[_0x48ba('0x29')](_0x19da6d,'name');_0x14e19d[_0x48ba('0x2e')]=_[_0x48ba('0x2f')](_0x3c1e6e[_0x48ba('0x2e')]);_0x14e19d[_0x48ba('0x30')]=_[_0x48ba('0x31')](_0x14e19d['model'],_0x14e19d[_0x48ba('0x2e')]);_0x5155ce[_0x48ba('0x32')]=_['intersection'](_0x14e19d['model'],qs[_0x48ba('0x33')](_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x33')]));_0x5155ce[_0x48ba('0x32')]=_0x5155ce[_0x48ba('0x32')][_0x48ba('0x34')]?_0x5155ce[_0x48ba('0x32')]:_0x14e19d[_0x48ba('0x35')];if(!_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x36')](_0x48ba('0x37'))){_0x5155ce['limit']=qs[_0x48ba('0x1d')](_0x3c1e6e[_0x48ba('0x2e')]['limit']);_0x5155ce[_0x48ba('0x1b')]=qs[_0x48ba('0x1b')](_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x1b')]);}_0x5155ce['order']=qs[_0x48ba('0x38')](_0x3c1e6e[_0x48ba('0x2e')]['sort']);_0x5155ce['where']=qs[_0x48ba('0x30')](_[_0x48ba('0x39')](_0x3c1e6e[_0x48ba('0x2e')],_0x14e19d['filters']),_0x19da6d);if(_0x3c1e6e['query']['filter']){_0x5155ce['where']=_[_0x48ba('0x3a')](_0x5155ce[_0x48ba('0x3b')],{'$or':_[_0x48ba('0x29')](_0x19da6d,function(_0x40455c){if(_0x40455c['type']!==_0x48ba('0x3c')){var _0x57d637={};_0x57d637[_0x40455c[_0x48ba('0x26')]]={'$like':'%'+_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x3d')]+'%'};return _0x57d637;}})});}_0x5155ce=_['merge']({},_0x5155ce,_0x3c1e6e[_0x48ba('0x3e')]);var _0x5efc6e={'where':_0x5155ce[_0x48ba('0x3b')]};return db['Attachment'][_0x48ba('0x1e')](_0x5efc6e)[_0x48ba('0x23')](function(_0x53d06c){_0x48ff13[_0x48ba('0x1e')]=_0x53d06c;if(_0x3c1e6e[_0x48ba('0x2e')][_0x48ba('0x3f')]){_0x5155ce[_0x48ba('0x40')]=[{'all':!![]}];}return db[_0x48ba('0x2a')]['findAll'](_0x5155ce);})[_0x48ba('0x23')](function(_0x43d923){_0x48ff13['rows']=_0x43d923;return _0x48ff13;})[_0x48ba('0x23')](respondWithFilteredResult(_0x2366d1,_0x5155ce))[_0x48ba('0x41')](handleError(_0x2366d1,null));};exports[_0x48ba('0x42')]=function(_0x73b9ce,_0x3d0bb7){var _0x5696cf={'raw':!![],'where':{'id':_0x73b9ce[_0x48ba('0x43')]['id']}},_0x55991c={};_0x55991c[_0x48ba('0x35')]=_[_0x48ba('0x2f')](db['Attachment'][_0x48ba('0x2b')]);_0x55991c[_0x48ba('0x2e')]=_[_0x48ba('0x2f')](_0x73b9ce[_0x48ba('0x2e')]);_0x55991c[_0x48ba('0x30')]=_[_0x48ba('0x31')](_0x55991c['model'],_0x55991c['query']);_0x5696cf[_0x48ba('0x32')]=_['intersection'](_0x55991c[_0x48ba('0x35')],qs[_0x48ba('0x33')](_0x73b9ce['query'][_0x48ba('0x33')]));_0x5696cf[_0x48ba('0x32')]=_0x5696cf[_0x48ba('0x32')][_0x48ba('0x34')]?_0x5696cf[_0x48ba('0x32')]:_0x55991c[_0x48ba('0x35')];if(_0x73b9ce[_0x48ba('0x2e')][_0x48ba('0x3f')]){_0x5696cf['include']=[{'all':!![]}];}_0x5696cf=_[_0x48ba('0x3a')]({},_0x5696cf,_0x73b9ce[_0x48ba('0x3e')]);return db[_0x48ba('0x2a')]['find'](_0x5696cf)[_0x48ba('0x23')](handleEntityNotFound(_0x3d0bb7,null))[_0x48ba('0x23')](respondWithResult(_0x3d0bb7,null))[_0x48ba('0x41')](handleError(_0x3d0bb7,null));};exports[_0x48ba('0x44')]=function(_0x18f67e,_0x39cc6a){var _0xf3c40c={'where':{'id':_0x18f67e['params']['id']}},_0x58c48d={};_0x58c48d['model']=_[_0x48ba('0x2f')](db['Attachment'][_0x48ba('0x2b')]);_0xf3c40c[_0x48ba('0x32')]=_[_0x48ba('0x31')](_0x58c48d[_0x48ba('0x35')],qs[_0x48ba('0x33')](_0x18f67e[_0x48ba('0x2e')]['fields']));_0xf3c40c[_0x48ba('0x32')]=_0xf3c40c[_0x48ba('0x32')]['length']?_0xf3c40c[_0x48ba('0x32')]:_0x58c48d[_0x48ba('0x35')];if(_0x18f67e['query'][_0x48ba('0x3f')]){_0xf3c40c[_0x48ba('0x40')]=[{'all':!![]}];}_0xf3c40c=_[_0x48ba('0x3a')]({},_0xf3c40c,_0x18f67e[_0x48ba('0x3e')]);return db[_0x48ba('0x2a')]['find'](_0xf3c40c)[_0x48ba('0x23')](handleEntityNotFound(_0x39cc6a,null))[_0x48ba('0x23')](function(_0x1b4dde){if(_0x1b4dde){var _0x49907b=_0x1b4dde[_0x48ba('0x45')]({'plain':!![]});_0x49907b=qs[_0x48ba('0x46')](_0x49907b,['id',_0x48ba('0x47'),_0x48ba('0x48')]);_0x18f67e[_0x48ba('0x49')]=_[_0x48ba('0x46')](_0x18f67e[_0x48ba('0x49')],['id',_0x48ba('0x47'),_0x48ba('0x48')]);return db[_0x48ba('0x2a')][_0x48ba('0x4a')](_[_0x48ba('0x3a')](_0x49907b,_0x18f67e['body']),{'include':_0x18f67e[_0x48ba('0x2e')][_0x48ba('0x3f')]?[{'all':!![]}]:undefined});}})[_0x48ba('0x23')](respondWithResult(_0x39cc6a,0xc9))[_0x48ba('0x41')](handleError(_0x39cc6a,null));};exports[_0x48ba('0x4b')]=function(_0xf03e7,_0xcf19d7){if(_0xf03e7[_0x48ba('0x49')]['id']){delete _0xf03e7[_0x48ba('0x49')]['id'];}return db[_0x48ba('0x2a')][_0x48ba('0x4c')]({'where':{'id':_0xf03e7['params']['id']}})[_0x48ba('0x23')](handleEntityNotFound(_0xcf19d7,null))[_0x48ba('0x23')](saveUpdates(_0xf03e7['body'],null))['then'](respondWithResult(_0xcf19d7,null))[_0x48ba('0x41')](handleError(_0xcf19d7,null));};exports[_0x48ba('0x24')]=function(_0x5c1c7f,_0x48c05b){return db[_0x48ba('0x2a')][_0x48ba('0x4c')]({'where':{'id':_0x5c1c7f[_0x48ba('0x43')]['id']}})[_0x48ba('0x23')](handleEntityNotFound(_0x48c05b,null))['then'](removeEntity(_0x48c05b,null))[_0x48ba('0x41')](handleError(_0x48c05b,null));};exports['create']=function(_0x1e364d,_0x11ea23,_0x3cbf9c){_0x1e364d[_0x48ba('0x49')][_0x48ba('0x26')]=_0x1e364d[_0x48ba('0x4d')][_0x48ba('0x4e')];_0x1e364d['body'][_0x48ba('0x4f')]=_0x1e364d[_0x48ba('0x4d')][_0x48ba('0x50')];_0x1e364d[_0x48ba('0x49')][_0x48ba('0x51')]=_0x1e364d[_0x48ba('0x4d')][_0x48ba('0x52')];return db['Attachment'][_0x48ba('0x4a')](_0x1e364d[_0x48ba('0x49')])[_0x48ba('0x23')](respondWithResult(_0x11ea23,0xc9))[_0x48ba('0x41')](handleError(_0x11ea23,null));};exports[_0x48ba('0x53')]=function(_0x1f0ff4,_0x34653c,_0x4be20b){return db['Attachment'][_0x48ba('0x54')]({'where':{'id':_0x1f0ff4[_0x48ba('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x34653c,null))[_0x48ba('0x23')](function(_0x22a85c){if(_0x22a85c){var _0x4e97af=_0x22a85c[_0x48ba('0x55')]!==null;var _0x37a414=path[_0x48ba('0x56')](config[_0x48ba('0x57')],_0x48ba('0x58'));if(_0x4e97af){_0x37a414=path[_0x48ba('0x56')](_0x37a414,'offline-chat/');}var _0x30c90c=path[_0x48ba('0x56')](_0x37a414,_0x22a85c[_0x48ba('0x4f')]);return _0x34653c[_0x48ba('0x53')](_0x30c90c);}})['catch'](handleError(_0x34653c,null));}; \ No newline at end of file +var _0xe1d3=['query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','options','Attachment','includeAll','include','rows','then','catch','params','rawAttributes','fields','merge','find','clone','get','createdAt','updatedAt','omit','body','create','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','apply','update','destroy','error','stack','name','send','index','map','fieldName','type','key','model'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0xe1d3,0x190));var _0x3e1d=function(_0x10de89,_0x4ea7ac){_0x10de89=_0x10de89-0x0;var _0x1a90d8=_0xe1d3[_0x10de89];return _0x1a90d8;};'use strict';var emlformat=require(_0x3e1d('0x0'));var rimraf=require(_0x3e1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1d('0x2'));var rp=require(_0x3e1d('0x3'));var moment=require(_0x3e1d('0x4'));var BPromise=require(_0x3e1d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e1d('0x6'));var sox=require(_0x3e1d('0x7'));var csv=require(_0x3e1d('0x8'));var ejs=require(_0x3e1d('0x9'));var fs=require('fs');var fs_extra=require(_0x3e1d('0xa'));var _=require(_0x3e1d('0xb'));var squel=require(_0x3e1d('0xc'));var crypto=require('crypto');var jsforce=require(_0x3e1d('0xd'));var deskjs=require(_0x3e1d('0xe'));var toCsv=require(_0x3e1d('0x8'));var querystring=require(_0x3e1d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3e1d('0x10'));var qs=require(_0x3e1d('0x11'));var as=require(_0x3e1d('0x12'));var hardwareService=require(_0x3e1d('0x13'));var logger=require(_0x3e1d('0x14'))(_0x3e1d('0x15'));var utils=require(_0x3e1d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3e1d('0x17'));var db=require(_0x3e1d('0x18'))['db'];function respondWithStatusCode(_0x555ce3,_0x18a86b){_0x18a86b=_0x18a86b||0xcc;return function(_0x2f4cf8){if(_0x2f4cf8){return _0x555ce3[_0x3e1d('0x19')](_0x18a86b);}return _0x555ce3[_0x3e1d('0x1a')](_0x18a86b)[_0x3e1d('0x1b')]();};}function respondWithResult(_0x949503,_0x4f3f16){_0x4f3f16=_0x4f3f16||0xc8;return function(_0x27db52){if(_0x27db52){return _0x949503[_0x3e1d('0x1a')](_0x4f3f16)['json'](_0x27db52);}};}function respondWithFilteredResult(_0x4e66cf,_0x407cd4){return function(_0x39878f){if(_0x39878f){var _0x221a9a=typeof _0x407cd4[_0x3e1d('0x1c')]===_0x3e1d('0x1d')&&typeof _0x407cd4['limit']===_0x3e1d('0x1d');var _0x759a04=_0x39878f[_0x3e1d('0x1e')];var _0x1ac34b=_0x221a9a?0x0:_0x407cd4[_0x3e1d('0x1c')];var _0x317282=_0x221a9a?_0x39878f[_0x3e1d('0x1e')]:_0x407cd4[_0x3e1d('0x1c')]+_0x407cd4['limit'];var _0x3090c2;if(_0x317282>=_0x759a04){_0x317282=_0x759a04;_0x3090c2=0xc8;}else{_0x3090c2=0xce;}_0x4e66cf[_0x3e1d('0x1a')](_0x3090c2);return _0x4e66cf['set'](_0x3e1d('0x1f'),_0x1ac34b+'-'+_0x317282+'/'+_0x759a04)['json'](_0x39878f);}return null;};}function patchUpdates(_0x1c96c2){return function(_0x513819){try{jsonpatch[_0x3e1d('0x20')](_0x513819,_0x1c96c2,!![]);}catch(_0x109fa4){return BPromise['reject'](_0x109fa4);}return _0x513819['save']();};}function saveUpdates(_0x47a8c3,_0xd63051){return function(_0xd4ab2c){if(_0xd4ab2c){return _0xd4ab2c[_0x3e1d('0x21')](_0x47a8c3)['then'](function(_0x11a2ae){return _0x11a2ae;});}return null;};}function removeEntity(_0x4a1057,_0x410162){return function(_0x3a846b){if(_0x3a846b){return _0x3a846b[_0x3e1d('0x22')]()['then'](function(){_0x4a1057[_0x3e1d('0x1a')](0xcc)[_0x3e1d('0x1b')]();});}};}function handleEntityNotFound(_0xac8fa8,_0x28d09b){return function(_0x4f5656){if(!_0x4f5656){_0xac8fa8['sendStatus'](0x194);}return _0x4f5656;};}function handleError(_0x939bff,_0x9f5a4f){_0x9f5a4f=_0x9f5a4f||0x1f4;return function(_0xe5f553){logger[_0x3e1d('0x23')](_0xe5f553[_0x3e1d('0x24')]);if(_0xe5f553[_0x3e1d('0x25')]){delete _0xe5f553[_0x3e1d('0x25')];}_0x939bff[_0x3e1d('0x1a')](_0x9f5a4f)[_0x3e1d('0x26')](_0xe5f553);};}exports[_0x3e1d('0x27')]=function(_0xfabe55,_0x5d1f9a){var _0x5a231c={},_0x57a17a={},_0x99a543={'count':0x0,'rows':[]};var _0x1cc79d=_[_0x3e1d('0x28')](db['Attachment']['rawAttributes'],function(_0x2e51df){return{'name':_0x2e51df[_0x3e1d('0x29')],'type':_0x2e51df[_0x3e1d('0x2a')][_0x3e1d('0x2b')]};});_0x57a17a[_0x3e1d('0x2c')]=_[_0x3e1d('0x28')](_0x1cc79d,_0x3e1d('0x25'));_0x57a17a[_0x3e1d('0x2d')]=_[_0x3e1d('0x2e')](_0xfabe55[_0x3e1d('0x2d')]);_0x57a17a[_0x3e1d('0x2f')]=_[_0x3e1d('0x30')](_0x57a17a['model'],_0x57a17a[_0x3e1d('0x2d')]);_0x5a231c[_0x3e1d('0x31')]=_[_0x3e1d('0x30')](_0x57a17a[_0x3e1d('0x2c')],qs['fields'](_0xfabe55[_0x3e1d('0x2d')]['fields']));_0x5a231c['attributes']=_0x5a231c['attributes'][_0x3e1d('0x32')]?_0x5a231c['attributes']:_0x57a17a[_0x3e1d('0x2c')];if(!_0xfabe55['query'][_0x3e1d('0x33')](_0x3e1d('0x34'))){_0x5a231c['limit']=qs[_0x3e1d('0x35')](_0xfabe55[_0x3e1d('0x2d')][_0x3e1d('0x35')]);_0x5a231c[_0x3e1d('0x1c')]=qs[_0x3e1d('0x1c')](_0xfabe55[_0x3e1d('0x2d')][_0x3e1d('0x1c')]);}_0x5a231c['order']=qs[_0x3e1d('0x36')](_0xfabe55[_0x3e1d('0x2d')][_0x3e1d('0x36')]);_0x5a231c[_0x3e1d('0x37')]=qs[_0x3e1d('0x2f')](_[_0x3e1d('0x38')](_0xfabe55['query'],_0x57a17a[_0x3e1d('0x2f')]),_0x1cc79d);if(_0xfabe55[_0x3e1d('0x2d')]['filter']){_0x5a231c[_0x3e1d('0x37')]=_['merge'](_0x5a231c['where'],{'$or':_[_0x3e1d('0x28')](_0x1cc79d,function(_0x34b896){if(_0x34b896['type']!==_0x3e1d('0x39')){var _0x5dcaf4={};_0x5dcaf4[_0x34b896[_0x3e1d('0x25')]]={'$like':'%'+_0xfabe55[_0x3e1d('0x2d')][_0x3e1d('0x3a')]+'%'};return _0x5dcaf4;}})});}_0x5a231c=_['merge']({},_0x5a231c,_0xfabe55[_0x3e1d('0x3b')]);var _0x5a0cf0={'where':_0x5a231c[_0x3e1d('0x37')]};return db[_0x3e1d('0x3c')][_0x3e1d('0x1e')](_0x5a0cf0)['then'](function(_0x93350f){_0x99a543[_0x3e1d('0x1e')]=_0x93350f;if(_0xfabe55[_0x3e1d('0x2d')][_0x3e1d('0x3d')]){_0x5a231c[_0x3e1d('0x3e')]=[{'all':!![]}];}return db[_0x3e1d('0x3c')]['findAll'](_0x5a231c);})['then'](function(_0x1009eb){_0x99a543[_0x3e1d('0x3f')]=_0x1009eb;return _0x99a543;})[_0x3e1d('0x40')](respondWithFilteredResult(_0x5d1f9a,_0x5a231c))[_0x3e1d('0x41')](handleError(_0x5d1f9a,null));};exports['show']=function(_0xccd0c2,_0x185499){var _0x30a3ba={'raw':!![],'where':{'id':_0xccd0c2[_0x3e1d('0x42')]['id']}},_0x555868={};_0x555868['model']=_[_0x3e1d('0x2e')](db[_0x3e1d('0x3c')][_0x3e1d('0x43')]);_0x555868[_0x3e1d('0x2d')]=_['keys'](_0xccd0c2['query']);_0x555868['filters']=_['intersection'](_0x555868[_0x3e1d('0x2c')],_0x555868[_0x3e1d('0x2d')]);_0x30a3ba[_0x3e1d('0x31')]=_[_0x3e1d('0x30')](_0x555868['model'],qs[_0x3e1d('0x44')](_0xccd0c2[_0x3e1d('0x2d')][_0x3e1d('0x44')]));_0x30a3ba['attributes']=_0x30a3ba[_0x3e1d('0x31')]['length']?_0x30a3ba[_0x3e1d('0x31')]:_0x555868[_0x3e1d('0x2c')];if(_0xccd0c2[_0x3e1d('0x2d')][_0x3e1d('0x3d')]){_0x30a3ba[_0x3e1d('0x3e')]=[{'all':!![]}];}_0x30a3ba=_[_0x3e1d('0x45')]({},_0x30a3ba,_0xccd0c2[_0x3e1d('0x3b')]);return db[_0x3e1d('0x3c')][_0x3e1d('0x46')](_0x30a3ba)[_0x3e1d('0x40')](handleEntityNotFound(_0x185499,null))[_0x3e1d('0x40')](respondWithResult(_0x185499,null))[_0x3e1d('0x41')](handleError(_0x185499,null));};exports[_0x3e1d('0x47')]=function(_0x19254b,_0x3ed541){var _0x2ef387={'where':{'id':_0x19254b[_0x3e1d('0x42')]['id']}},_0xe67bbd={};_0xe67bbd['model']=_[_0x3e1d('0x2e')](db[_0x3e1d('0x3c')][_0x3e1d('0x43')]);_0x2ef387[_0x3e1d('0x31')]=_[_0x3e1d('0x30')](_0xe67bbd[_0x3e1d('0x2c')],qs['fields'](_0x19254b['query'][_0x3e1d('0x44')]));_0x2ef387[_0x3e1d('0x31')]=_0x2ef387[_0x3e1d('0x31')][_0x3e1d('0x32')]?_0x2ef387[_0x3e1d('0x31')]:_0xe67bbd[_0x3e1d('0x2c')];if(_0x19254b[_0x3e1d('0x2d')]['includeAll']){_0x2ef387[_0x3e1d('0x3e')]=[{'all':!![]}];}_0x2ef387=_[_0x3e1d('0x45')]({},_0x2ef387,_0x19254b[_0x3e1d('0x3b')]);return db[_0x3e1d('0x3c')][_0x3e1d('0x46')](_0x2ef387)[_0x3e1d('0x40')](handleEntityNotFound(_0x3ed541,null))[_0x3e1d('0x40')](function(_0x38135c){if(_0x38135c){var _0x5c9a37=_0x38135c[_0x3e1d('0x48')]({'plain':!![]});_0x5c9a37=qs['omit'](_0x5c9a37,['id',_0x3e1d('0x49'),_0x3e1d('0x4a')]);_0x19254b['body']=_[_0x3e1d('0x4b')](_0x19254b[_0x3e1d('0x4c')],['id',_0x3e1d('0x49'),'updatedAt']);return db[_0x3e1d('0x3c')][_0x3e1d('0x4d')](_[_0x3e1d('0x45')](_0x5c9a37,_0x19254b['body']),{'include':_0x19254b[_0x3e1d('0x2d')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3ed541,0xc9))[_0x3e1d('0x41')](handleError(_0x3ed541,null));};exports[_0x3e1d('0x21')]=function(_0x1b0312,_0xba29dd){if(_0x1b0312[_0x3e1d('0x4c')]['id']){delete _0x1b0312['body']['id'];}return db['Attachment']['find']({'where':{'id':_0x1b0312['params']['id']}})[_0x3e1d('0x40')](handleEntityNotFound(_0xba29dd,null))[_0x3e1d('0x40')](saveUpdates(_0x1b0312[_0x3e1d('0x4c')],null))['then'](respondWithResult(_0xba29dd,null))[_0x3e1d('0x41')](handleError(_0xba29dd,null));};exports[_0x3e1d('0x22')]=function(_0x2059f7,_0x1e6567){return db[_0x3e1d('0x3c')]['find']({'where':{'id':_0x2059f7[_0x3e1d('0x42')]['id']}})[_0x3e1d('0x40')](handleEntityNotFound(_0x1e6567,null))[_0x3e1d('0x40')](removeEntity(_0x1e6567,null))[_0x3e1d('0x41')](handleError(_0x1e6567,null));};exports[_0x3e1d('0x4d')]=function(_0x2870c8,_0x47ba7d,_0x2aa74d){_0x2870c8[_0x3e1d('0x4c')][_0x3e1d('0x25')]=_0x2870c8[_0x3e1d('0x4e')][_0x3e1d('0x4f')];_0x2870c8[_0x3e1d('0x4c')][_0x3e1d('0x50')]=_0x2870c8[_0x3e1d('0x4e')]['filename'];_0x2870c8[_0x3e1d('0x4c')][_0x3e1d('0x2a')]=_0x2870c8[_0x3e1d('0x4e')][_0x3e1d('0x51')];return db[_0x3e1d('0x3c')][_0x3e1d('0x4d')](_0x2870c8[_0x3e1d('0x4c')])[_0x3e1d('0x40')](respondWithResult(_0x47ba7d,0xc9))[_0x3e1d('0x41')](handleError(_0x47ba7d,null));};exports[_0x3e1d('0x52')]=function(_0x5d9a18,_0x29b921,_0x488227){return db[_0x3e1d('0x3c')][_0x3e1d('0x53')]({'where':{'id':_0x5d9a18[_0x3e1d('0x42')]['id']},'raw':!![]})[_0x3e1d('0x40')](handleEntityNotFound(_0x29b921,null))[_0x3e1d('0x40')](function(_0x12b8a2){if(_0x12b8a2){var _0x35424f=_0x12b8a2[_0x3e1d('0x54')]!==null;var _0x3717f3=path[_0x3e1d('0x55')](config[_0x3e1d('0x56')],_0x3e1d('0x57'));if(_0x35424f){_0x3717f3=path['join'](_0x3717f3,_0x3e1d('0x58'));}var _0x71120c=path['join'](_0x3717f3,_0x12b8a2[_0x3e1d('0x50')]);return _0x29b921['download'](_0x71120c);}})[_0x3e1d('0x41')](handleError(_0x29b921,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1fec018..ac7663a 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 _0x3a49=['util','api','moment','path','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash'];(function(_0x47294a,_0x28215b){var _0x42a068=function(_0x31e280){while(--_0x31e280){_0x47294a['push'](_0x47294a['shift']());}};_0x42a068(++_0x28215b);}(_0x3a49,0xaf));var _0x93a4=function(_0x1a5430,_0x277586){_0x1a5430=_0x1a5430-0x0;var _0x11eb06=_0x3a49[_0x1a5430];return _0x11eb06;};'use strict';var _=require(_0x93a4('0x0'));var util=require(_0x93a4('0x1'));var logger=require('../../config/logger')(_0x93a4('0x2'));var moment=require(_0x93a4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x93a4('0x4'));var rimraf=require(_0x93a4('0x5'));var config=require(_0x93a4('0x6'));var attributes=require('./attachment.attributes');module[_0x93a4('0x7')]=function(_0x12284b,_0x3795d5){return _0x12284b[_0x93a4('0x8')](_0x93a4('0x9'),attributes,{'tableName':_0x93a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6e8=['../../config/environment','./attachment.attributes','define','Attachment','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x319347,_0x5f1639){var _0x4608df=function(_0x3c1278){while(--_0x3c1278){_0x319347['push'](_0x319347['shift']());}};_0x4608df(++_0x5f1639);}(_0xe6e8,0x1dd));var _0x8e6e=function(_0x32ab1c,_0x5dbf94){_0x32ab1c=_0x32ab1c-0x0;var _0x36f32b=_0xe6e8[_0x32ab1c];return _0x36f32b;};'use strict';var _=require('lodash');var util=require(_0x8e6e('0x0'));var logger=require(_0x8e6e('0x1'))(_0x8e6e('0x2'));var moment=require(_0x8e6e('0x3'));var BPromise=require(_0x8e6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e6e('0x5'));var rimraf=require(_0x8e6e('0x6'));var config=require(_0x8e6e('0x7'));var attributes=require(_0x8e6e('0x8'));module['exports']=function(_0x2f585e,_0x28328b){return _0x2f585e[_0x8e6e('0x9')](_0x8e6e('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 6dcf2ba..0f2df37 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 _0x644a=['../../config/environment','jayson/promise','client','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x124d9e,_0x50addd){var _0x463d39=function(_0x157d10){while(--_0x157d10){_0x124d9e['push'](_0x124d9e['shift']());}};_0x463d39(++_0x50addd);}(_0x644a,0xfd));var _0xa644=function(_0x227fe7,_0x392329){_0x227fe7=_0x227fe7-0x0;var _0x4b98be=_0x644a[_0x227fe7];return _0x4b98be;};'use strict';var _=require(_0xa644('0x0'));var util=require(_0xa644('0x1'));var moment=require(_0xa644('0x2'));var BPromise=require(_0xa644('0x3'));var rs=require(_0xa644('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa644('0x5'))['db'];var utils=require(_0xa644('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa644('0x7'));var jayson=require(_0xa644('0x8'));var client=jayson[_0xa644('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa4af13,_0x1aaaae,_0x4f8b23){return new BPromise(function(_0x15995f,_0x252108){return client['request'](_0xa4af13,_0x4f8b23)['then'](function(_0x36f677){logger[_0xa644('0xa')]('Attachment,\x20%s,\x20%s',_0x1aaaae,_0xa644('0xb'));logger[_0xa644('0xc')](_0xa644('0xd'),_0x1aaaae,_0xa644('0xb'),JSON[_0xa644('0xe')](_0x36f677));if(_0x36f677['error']){if(_0x36f677[_0xa644('0xf')][_0xa644('0x10')]===0x1f4){logger[_0xa644('0xf')](_0xa644('0x11'),_0x1aaaae,_0x36f677[_0xa644('0xf')][_0xa644('0x12')]);return _0x252108(_0x36f677['error'][_0xa644('0x12')]);}logger[_0xa644('0xf')](_0xa644('0x11'),_0x1aaaae,_0x36f677[_0xa644('0xf')][_0xa644('0x12')]);return _0x15995f(_0x36f677[_0xa644('0xf')]['message']);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x1aaaae,'request\x20sent');_0x15995f(_0x36f677['result']['message']);}})[_0xa644('0x13')](function(_0x45e115){logger[_0xa644('0xf')](_0xa644('0x11'),_0x1aaaae,_0x45e115);_0x252108(_0x45e115);});});}exports[_0xa644('0x14')]=function(_0x1536ee){var _0x6fb957=this;return new Promise(function(_0x2cf6c9,_0x300aa0){return db[_0xa644('0x15')][_0xa644('0x16')](_0x1536ee[_0xa644('0x17')],{'raw':_0x1536ee[_0xa644('0x18')]?_0x1536ee[_0xa644('0x18')][_0xa644('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x257e3d){logger[_0xa644('0xa')](_0xa644('0x14'),_0x1536ee);logger['debug'](_0xa644('0x14'),_0x1536ee,JSON[_0xa644('0xe')](_0x257e3d));_0x2cf6c9(_0x257e3d);})['catch'](function(_0x384a2d){logger[_0xa644('0xf')]('CreateAttachment',_0x384a2d[_0xa644('0x12')],_0x1536ee);_0x300aa0(_0x6fb957[_0xa644('0xf')](0x1f4,_0x384a2d[_0xa644('0x12')]));});});}; \ No newline at end of file +var _0xb205=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','create','options','CreateAttachment','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','then','info','Attachment,\x20%s,\x20%s'];(function(_0x5e7fa3,_0x537559){var _0x323185=function(_0x5e7423){while(--_0x5e7423){_0x5e7fa3['push'](_0x5e7fa3['shift']());}};_0x323185(++_0x537559);}(_0xb205,0xf0));var _0x5b20=function(_0x276be4,_0x3d4dc5){_0x276be4=_0x276be4-0x0;var _0x5b2b54=_0xb205[_0x276be4];return _0x5b2b54;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var moment=require(_0x5b20('0x2'));var BPromise=require(_0x5b20('0x3'));var rs=require(_0x5b20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b20('0x5'));var logger=require('../../config/logger')(_0x5b20('0x6'));var config=require(_0x5b20('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b20('0x8')][_0x5b20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x364e48,_0x5c1ff9,_0x32b467){return new BPromise(function(_0x13fb27,_0x528c54){return client['request'](_0x364e48,_0x32b467)[_0x5b20('0xa')](function(_0xb77426){logger[_0x5b20('0xb')](_0x5b20('0xc'),_0x5c1ff9,_0x5b20('0xd'));logger[_0x5b20('0xe')](_0x5b20('0xf'),_0x5c1ff9,'request\x20sent',JSON[_0x5b20('0x10')](_0xb77426));if(_0xb77426[_0x5b20('0x11')]){if(_0xb77426[_0x5b20('0x11')]['code']===0x1f4){logger['error'](_0x5b20('0xc'),_0x5c1ff9,_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);return _0x528c54(_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);}logger['error'](_0x5b20('0xc'),_0x5c1ff9,_0xb77426[_0x5b20('0x11')][_0x5b20('0x12')]);return _0x13fb27(_0xb77426[_0x5b20('0x11')]['message']);}else{logger['info'](_0x5b20('0xc'),_0x5c1ff9,'request\x20sent');_0x13fb27(_0xb77426['result'][_0x5b20('0x12')]);}})['catch'](function(_0x43b7b0){logger[_0x5b20('0x11')](_0x5b20('0xc'),_0x5c1ff9,_0x43b7b0);_0x528c54(_0x43b7b0);});});}exports['CreateAttachment']=function(_0x44ac15){var _0x301c9a=this;return new Promise(function(_0x3e37ef,_0x43199f){return db['Attachment'][_0x5b20('0x13')](_0x44ac15['body'],{'raw':_0x44ac15[_0x5b20('0x14')]?_0x44ac15[_0x5b20('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x5b20('0xa')](function(_0x54cdf3){logger[_0x5b20('0xb')]('CreateAttachment',_0x44ac15);logger[_0x5b20('0xe')](_0x5b20('0x15'),_0x44ac15,JSON['stringify'](_0x54cdf3));_0x3e37ef(_0x54cdf3);})[_0x5b20('0x16')](function(_0x52e27f){logger['error'](_0x5b20('0x15'),_0x52e27f['message'],_0x44ac15);_0x43199f(_0x301c9a['error'](0x1f4,_0x52e27f[_0x5b20('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 8079b0f..b8e3a0b 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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x40c17f,_0x5f50b0){var _0x50aa5c=function(_0x154f1f){while(--_0x154f1f){_0x40c17f['push'](_0x40c17f['shift']());}};_0x50aa5c(++_0x5f50b0);}(_0xadb5,0xad));var _0x5adb=function(_0x28c0dd,_0xbacd6b){_0x28c0dd=_0x28c0dd-0x0;var _0x590ee0=_0xadb5[_0x28c0dd];return _0x590ee0;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x46b628,_0x4fe79e){var _0x351692=function(_0x4a61db){while(--_0x4a61db){_0x46b628['push'](_0x46b628['shift']());}};_0x351692(++_0x4fe79e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x199533,_0xe370c5){_0x199533=_0x199533-0x0;var _0x203348=_0x5f2f[_0x199533];return _0x203348;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 7cb2469..2d1b4fa 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 _0xe682=['login','ad-login','signToken','json','use','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','add','minutes','clearBlockUser','getLicense','catch','status','send','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe682,0xf5));var _0x2e68=function(_0xadcfdc,_0x4bd341){_0xadcfdc=_0xadcfdc-0x0;var _0x119c5e=_0xe682[_0xadcfdc];return _0x119c5e;};'use strict';var passport=require(_0x2e68('0x0'));var LocalStrategy=require(_0x2e68('0x1'))[_0x2e68('0x2')];var moment=require(_0x2e68('0x3'));var ActiveDirectory=require(_0x2e68('0x4'));var BPromise=require('bluebird');var util=require(_0x2e68('0x5'));var db=require(_0x2e68('0x6'))['db'];var authService=require(_0x2e68('0x7'));var utils=require(_0x2e68('0x8'));var config=require('../../config/environment');var logger=require(_0x2e68('0x9'))(_0x2e68('0xa'));function isActiveDirectoryConfigured(_0x2c4b6f){var _0x5ad2ac=![];if(typeof _0x2c4b6f[_0x2e68('0xb')]!==_0x2e68('0xc')){_0x5ad2ac=_0x2c4b6f[_0x2e68('0xb')][_0x2e68('0xd')]&&_0x2c4b6f['activedirectory']['url']&&_0x2c4b6f[_0x2e68('0xb')][_0x2e68('0xe')];}return _0x5ad2ac;}function adAuthenticate(_0x7b869e,_0x2bca59,_0x3a2806){return new BPromise(function(_0x333428,_0x3a5dc5){try{var _0x588eeb=new ActiveDirectory(_0x7b869e);_0x588eeb[_0x2e68('0xf')](_0x2bca59,_0x3a2806,function(_0x4541b4,_0x2eba43){if(_0x4541b4){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x2bca59,util[_0x2e68('0x10')](_0x4541b4,{'showHidden':![],'depth':null}));_0x3a5dc5(_0x2e68('0x11'));}else if(!_0x2eba43){logger[_0x2e68('0x12')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x2bca59);_0x3a5dc5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x333428(_0x2eba43);}});}catch(_0x27d9c9){_0x3a5dc5(_0x27d9c9);}});}function ActiveDirectoryAuthenticate(_0x8c5c56,_0x1a56ee,_0x6599b9,_0x42c26d){var _0x38d88e,_0x3d87b0;if(!isActiveDirectoryConfigured(config)){logger[_0x2e68('0x12')](_0x2e68('0x13'),_0x1a56ee);return _0x42c26d(null,![],{'message':_0x2e68('0x11')});}return db[_0x2e68('0x14')][_0x2e68('0x15')]({'where':{'id':0x1},'attributes':[_0x2e68('0x16'),_0x2e68('0x17')],'raw':!![]})[_0x2e68('0x18')](function(_0x53f2fd){_0x38d88e=_0x53f2fd;if(!_0x38d88e[_0x2e68('0x16')]){logger[_0x2e68('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x1a56ee);throw new Error(_0x2e68('0x11'));}return _0x8c5c56['findOne']({'attributes':['id',_0x2e68('0x19'),_0x2e68('0x1a'),_0x2e68('0x1b'),_0x2e68('0x1c'),_0x2e68('0x1d'),_0x2e68('0x1e'),_0x2e68('0x1f'),_0x2e68('0x20')],'where':{'name':_0x1a56ee,'role':{'$or':[_0x2e68('0x21'),_0x2e68('0x22'),'agent']},'adSsoEnabled':!![]}});})[_0x2e68('0x18')](function(_0x2083ab){if(!_0x2083ab||_0x2083ab&&_0x2083ab[_0x2e68('0x19')]!==_0x1a56ee){throw new Error(_0x2e68('0x11'));}_0x3d87b0=_0x2083ab;var _0x1ab0e0=_0x3d87b0[_0x2e68('0x19')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x2e68('0xb')],_0x1ab0e0,_0x6599b9);})[_0x2e68('0x18')](function(_0x4aec16){if(_0x3d87b0[_0x2e68('0x1d')]){throw new Error(_0x2e68('0x11'));}if(_0x38d88e[_0x2e68('0x17')]>0x0){if(_0x3d87b0[_0x2e68('0x1e')]){if(moment(_0x3d87b0['blockedAt'])[_0x2e68('0x23')](_0x38d88e[_0x2e68('0x17')],_0x2e68('0x24'))>moment()){throw new Error(_0x2e68('0x11'));}return utils[_0x2e68('0x25')](_0x3d87b0,0x0,![],null)[_0x2e68('0x18')](function(){return utils['getLicense'](_0x3d87b0);})['then'](function(){return _0x42c26d(null,_0x3d87b0);});}else{return utils[_0x2e68('0x26')](_0x3d87b0)[_0x2e68('0x18')](function(){return _0x42c26d(null,_0x3d87b0);});}}else{return utils['getLicense'](_0x3d87b0)[_0x2e68('0x18')](function(){return _0x42c26d(null,_0x3d87b0);});}})[_0x2e68('0x27')](function(_0x2c35a0){return _0x42c26d(null,![],_0x2c35a0);});}function handleError(_0xf5af18,_0x1bdedf,_0x43f0e3){return _0xf5af18[_0x2e68('0x28')](_0x1bdedf||0x1f4)[_0x2e68('0x29')]({'message':_0x43f0e3?_0x43f0e3[_0x2e68('0x2a')]||_0x43f0e3:''});}exports[_0x2e68('0x2b')]=function(_0x5087ed,_0x55a23a,_0x448c30){passport[_0x2e68('0xf')](_0x2e68('0x2c'),function(_0x5e9fc8,_0x102f49,_0x1c3ede){var _0x3b53d9=_0x5e9fc8||_0x1c3ede;if(_0x3b53d9){return handleError(_0x55a23a,0x191,_0x3b53d9);}if(!_0x102f49){return handleError(_0x55a23a,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2f5dce={'payload':{'id':_0x102f49['id'],'role':_0x102f49['role']},'options':{'expiresIn':0x15180}};return authService[_0x2e68('0x2d')](_0x2f5dce)['then'](function(_0xcfadce){_0x55a23a[_0x2e68('0x2e')]({'id':_0x102f49['id'],'token':_0xcfadce,'statusCall':'','isAlreadyLogged':_0x102f49[_0x2e68('0x20')]});});}})(_0x5087ed,_0x55a23a,_0x448c30);};passport[_0x2e68('0x2f')](_0x2e68('0x2c'),new LocalStrategy({'usernameField':_0x2e68('0x19'),'passwordField':_0x2e68('0x1a')},function(_0x37fe27,_0x413ff7,_0x6baee3){return ActiveDirectoryAuthenticate(db['User'],_0x37fe27,_0x413ff7,_0x6baee3);})); \ No newline at end of file +var _0x999b=['name','password','role','disabled','blocked','blockedAt','online','user','agent','then','add','blockDuration','minutes','clearBlockUser','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x999b,0x167));var _0xb999=function(_0x1a926b,_0x5b91a2){_0x1a926b=_0x1a926b-0x0;var _0x29fc83=_0x999b[_0x1a926b];return _0x29fc83;};'use strict';var passport=require(_0xb999('0x0'));var LocalStrategy=require(_0xb999('0x1'))['Strategy'];var moment=require(_0xb999('0x2'));var ActiveDirectory=require(_0xb999('0x3'));var BPromise=require(_0xb999('0x4'));var util=require(_0xb999('0x5'));var db=require(_0xb999('0x6'))['db'];var authService=require(_0xb999('0x7'));var utils=require(_0xb999('0x8'));var config=require(_0xb999('0x9'));var logger=require(_0xb999('0xa'))(_0xb999('0xb'));function isActiveDirectoryConfigured(_0x2902bc){var _0x496c95=![];if(typeof _0x2902bc[_0xb999('0xc')]!==_0xb999('0xd')){_0x496c95=_0x2902bc[_0xb999('0xc')][_0xb999('0xe')]&&_0x2902bc[_0xb999('0xc')]['url']&&_0x2902bc['activedirectory'][_0xb999('0xf')];}return _0x496c95;}function adAuthenticate(_0x31578d,_0x180e6c,_0x2c720c){return new BPromise(function(_0x142dff,_0x747653){try{var _0x32ff5e=new ActiveDirectory(_0x31578d);_0x32ff5e[_0xb999('0x10')](_0x180e6c,_0x2c720c,function(_0x4ce137,_0x5639fd){if(_0x4ce137){logger['error'](_0xb999('0x11'),_0x180e6c,util['inspect'](_0x4ce137,{'showHidden':![],'depth':null}));_0x747653(_0xb999('0x12'));}else if(!_0x5639fd){logger[_0xb999('0x13')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x180e6c);_0x747653('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x142dff(_0x5639fd);}});}catch(_0x42b9a1){_0x747653(_0x42b9a1);}});}function ActiveDirectoryAuthenticate(_0x4bbf65,_0x4da0a6,_0x1cb6d7,_0x2f7daa){var _0x195d83,_0x570854;if(!isActiveDirectoryConfigured(config)){logger[_0xb999('0x13')](_0xb999('0x14'),_0x4da0a6);return _0x2f7daa(null,![],{'message':_0xb999('0x12')});}return db[_0xb999('0x15')][_0xb999('0x16')]({'where':{'id':0x1},'attributes':[_0xb999('0x17'),'blockDuration'],'raw':!![]})['then'](function(_0x3a94f8){_0x195d83=_0x3a94f8;if(!_0x195d83['adSsoEnabled']){logger[_0xb999('0x13')](_0xb999('0x18'),_0x4da0a6);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x4bbf65[_0xb999('0x16')]({'attributes':['id',_0xb999('0x19'),_0xb999('0x1a'),'salt',_0xb999('0x1b'),_0xb999('0x1c'),_0xb999('0x1d'),_0xb999('0x1e'),_0xb999('0x1f')],'where':{'name':_0x4da0a6,'role':{'$or':['admin',_0xb999('0x20'),_0xb999('0x21')]},'adSsoEnabled':!![]}});})[_0xb999('0x22')](function(_0x2a1744){if(!_0x2a1744||_0x2a1744&&_0x2a1744[_0xb999('0x19')]!==_0x4da0a6){throw new Error(_0xb999('0x12'));}_0x570854=_0x2a1744;var _0xe2c1f8=_0x570854[_0xb999('0x19')]+'@'+config[_0xb999('0xc')][_0xb999('0xf')];return adAuthenticate(config[_0xb999('0xc')],_0xe2c1f8,_0x1cb6d7);})[_0xb999('0x22')](function(_0x491284){if(_0x570854['disabled']){throw new Error(_0xb999('0x12'));}if(_0x195d83['blockDuration']>0x0){if(_0x570854[_0xb999('0x1d')]){if(moment(_0x570854['blockedAt'])[_0xb999('0x23')](_0x195d83[_0xb999('0x24')],_0xb999('0x25'))>moment()){throw new Error(_0xb999('0x12'));}return utils[_0xb999('0x26')](_0x570854,0x0,![],null)[_0xb999('0x22')](function(){return utils[_0xb999('0x27')](_0x570854);})[_0xb999('0x22')](function(){return _0x2f7daa(null,_0x570854);});}else{return utils['getLicense'](_0x570854)[_0xb999('0x22')](function(){return _0x2f7daa(null,_0x570854);});}}else{return utils[_0xb999('0x27')](_0x570854)[_0xb999('0x22')](function(){return _0x2f7daa(null,_0x570854);});}})[_0xb999('0x28')](function(_0x43689a){return _0x2f7daa(null,![],_0x43689a);});}function handleError(_0x1ea2dd,_0x32913c,_0x285367){return _0x1ea2dd['status'](_0x32913c||0x1f4)[_0xb999('0x29')]({'message':_0x285367?_0x285367[_0xb999('0x2a')]||_0x285367:''});}exports[_0xb999('0x2b')]=function(_0x4edd08,_0x3b913c,_0x291718){passport[_0xb999('0x10')](_0xb999('0x2c'),function(_0x5670ae,_0x5bf495,_0x1623e7){var _0x5cf56c=_0x5670ae||_0x1623e7;if(_0x5cf56c){return handleError(_0x3b913c,0x191,_0x5cf56c);}if(!_0x5bf495){return handleError(_0x3b913c,0x194,{'message':_0xb999('0x2d')});}else{var _0x3af4a9={'payload':{'id':_0x5bf495['id'],'role':_0x5bf495[_0xb999('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xb999('0x2e')](_0x3af4a9)[_0xb999('0x22')](function(_0x1d6d89){_0x3b913c['json']({'id':_0x5bf495['id'],'token':_0x1d6d89,'statusCall':'','isAlreadyLogged':_0x5bf495[_0xb999('0x1f')]});});}})(_0x4edd08,_0x3b913c,_0x291718);};passport[_0xb999('0x2f')](_0xb999('0x2c'),new LocalStrategy({'usernameField':_0xb999('0x19'),'passwordField':_0xb999('0x1a')},function(_0x247fd1,_0x522004,_0x13e232){return ActiveDirectoryAuthenticate(db['User'],_0x247fd1,_0x522004,_0x13e232);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a99b62f..1ad82a4 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 _0x2f60=['Router','./authActiveDirectory.controller','post','exports'];(function(_0x2397ad,_0x120bbd){var _0xbb1489=function(_0x2587fd){while(--_0x2587fd){_0x2397ad['push'](_0x2397ad['shift']());}};_0xbb1489(++_0x120bbd);}(_0x2f60,0x1f0));var _0x02f6=function(_0x5d1c9d,_0x8bb82d){_0x5d1c9d=_0x5d1c9d-0x0;var _0x8edfe4=_0x2f60[_0x5d1c9d];return _0x8edfe4;};'use strict';var express=require('express');var router=express[_0x02f6('0x0')]();var controller=require(_0x02f6('0x1'));router[_0x02f6('0x2')]('/',controller['login']);module[_0x02f6('0x3')]=router; \ No newline at end of file +var _0x458a=['./authActiveDirectory.controller','post','login','exports','Router'];(function(_0x41f55e,_0x264009){var _0x922b33=function(_0x510189){while(--_0x510189){_0x41f55e['push'](_0x41f55e['shift']());}};_0x922b33(++_0x264009);}(_0x458a,0x13f));var _0xa458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x458a[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0xa458('0x0')]();var controller=require(_0xa458('0x1'));router[_0xa458('0x2')]('/',controller[_0xa458('0x3')]);module[_0xa458('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 43430b8..47f71e4 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(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x7a54,0x106));var _0x47a5=function(_0x8f5409,_0x259afb){_0x8f5409=_0x8f5409-0x0;var _0x3e656a=_0x7a54[_0x8f5409];return _0x3e656a;};'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(_0x5bf034,_0xa7891b){var _0x232f13=function(_0x317bff){while(--_0x317bff){_0x5bf034['push'](_0x5bf034['shift']());}};_0x232f13(++_0xa7891b);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 4bde866..7d1e817 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 _0x4a4f=['./authGoogle.controller','../user/user.controller.js','get','/callback','callback','isMiddleware','login','setTokenCookie','exports','express','passport','Router'];(function(_0x5b7613,_0x5de883){var _0x568fce=function(_0x3af372){while(--_0x3af372){_0x5b7613['push'](_0x5b7613['shift']());}};_0x568fce(++_0x5de883);}(_0x4a4f,0x1e9));var _0xf4a4=function(_0x116ce0,_0x1c73bf){_0x116ce0=_0x116ce0-0x0;var _0x2f9644=_0x4a4f[_0x116ce0];return _0x2f9644;};'use strict';var express=require(_0xf4a4('0x0'));var passport=require(_0xf4a4('0x1'));var router=express[_0xf4a4('0x2')]();var controller=require(_0xf4a4('0x3'));var userController=require(_0xf4a4('0x4'));var authService=require('../../components/auth/service');router[_0xf4a4('0x5')]('/',controller['login']);router[_0xf4a4('0x5')](_0xf4a4('0x6'),controller[_0xf4a4('0x7')],authService[_0xf4a4('0x8')],userController[_0xf4a4('0x9')],authService[_0xf4a4('0xa')]);module[_0xf4a4('0xb')]=router; \ No newline at end of file +var _0xface=['isMiddleware','login','setTokenCookie','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','callback'];(function(_0x7ad796,_0x2e8606){var _0x392371=function(_0xa4d4e0){while(--_0xa4d4e0){_0x7ad796['push'](_0x7ad796['shift']());}};_0x392371(++_0x2e8606);}(_0xface,0x12c));var _0xefac=function(_0x36734e,_0xfaa609){_0x36734e=_0x36734e-0x0;var _0x2017e3=_0xface[_0x36734e];return _0x2017e3;};'use strict';var express=require('express');var passport=require(_0xefac('0x0'));var router=express['Router']();var controller=require(_0xefac('0x1'));var userController=require(_0xefac('0x2'));var authService=require(_0xefac('0x3'));router[_0xefac('0x4')]('/',controller['login']);router['get']('/callback',controller[_0xefac('0x5')],authService[_0xefac('0x6')],userController[_0xefac('0x7')],authService[_0xefac('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d819373..4ad0668 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 _0xaea2=['previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','now','save','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','findOne','securePassword','enforcePasswordHistory','validatePasswordPattern'];(function(_0x190015,_0x1799f4){var _0x4231ef=function(_0x1106b3){while(--_0x1106b3){_0x190015['push'](_0x190015['shift']());}};_0x4231ef(++_0x1799f4);}(_0xaea2,0xad));var _0x2aea=function(_0x175866,_0x1e48a6){_0x175866=_0x175866-0x0;var _0x4a561b=_0xaea2[_0x175866];return _0x4a561b;};'use strict';var util=require(_0x2aea('0x0'));var passport=require(_0x2aea('0x1'));var LocalStrategy=require(_0x2aea('0x2'))[_0x2aea('0x3')];var jayson=require(_0x2aea('0x4'));var _=require(_0x2aea('0x5'));var rs=require(_0x2aea('0x6'));var moment=require(_0x2aea('0x7'));var db=require(_0x2aea('0x8'))['db'];var authService=require(_0x2aea('0x9'));var utils=require(_0x2aea('0xa'));var client=jayson[_0x2aea('0xb')][_0x2aea('0xc')]({'port':0x232b});function localAuthenticate(_0x20a6b7,_0x1239e2,_0x3d6b70,_0x1a6e03){var _0x44b620,_0x275300;return db[_0x2aea('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0x2aea('0xe'),_0x2aea('0xf')],'raw':!![]})[_0x2aea('0x10')](function(_0x26924c){_0x44b620=_0x26924c;return _0x20a6b7['findOne']({'attributes':['id',_0x2aea('0x11'),_0x2aea('0x12'),_0x2aea('0x13'),_0x2aea('0x14'),_0x2aea('0x15'),_0x2aea('0x16'),_0x2aea('0x17'),_0x2aea('0x18')],'where':{'name':_0x1239e2,'role':{'$or':[_0x2aea('0x19'),'user',_0x2aea('0x1a')]}}});})['then'](function(_0x11fa61){if(!_0x11fa61||_0x11fa61&&_0x11fa61[_0x2aea('0x11')]!==_0x1239e2){throw new Error(_0x2aea('0x1b'));}else{_0x275300=_0x11fa61;return _0x275300;}})[_0x2aea('0x10')](function(){_0x275300[_0x2aea('0x1c')](_0x3d6b70,function(_0xa3410b,_0x26f939){var _0x7b6d3f=_0x275300[_0x2aea('0x18')]+0x1;if(_0xa3410b){return _0x1a6e03(_0xa3410b);}else if(!_0x26f939){if(_0x275300['disabled']){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}else if(_0x44b620[_0x2aea('0xe')]>0x0){if(_0x275300[_0x2aea('0x16')]){if(_0x44b620[_0x2aea('0xf')]>0x0){if(moment(_0x275300[_0x2aea('0x17')])[_0x2aea('0x1d')](_0x44b620[_0x2aea('0xf')],_0x2aea('0x1e'))>moment()){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}else{return utils[_0x2aea('0x1f')](_0x275300,_0x7b6d3f,![],null)['then'](function(){return _0x1a6e03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}}else{if(_0x7b6d3f>=_0x44b620['allowedLoginAttempts']){return utils['clearBlockUser'](_0x275300,0x0,!![],moment())['then'](function(){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});});}else{return utils[_0x2aea('0x1f')](_0x275300,_0x7b6d3f,![],null)[_0x2aea('0x10')](function(){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});});}}}else{return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}}else{if(_0x275300[_0x2aea('0x15')]){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}else if(_0x44b620['allowedLoginAttempts']>0x0){if(_0x275300['blocked']){if(_0x44b620[_0x2aea('0xf')]>0x0){if(moment(_0x275300[_0x2aea('0x17')])['add'](_0x44b620[_0x2aea('0xf')],'minutes')>moment()){return _0x1a6e03(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x275300,0x0,![],null)[_0x2aea('0x10')](function(){return utils['getLicense'](_0x275300);})[_0x2aea('0x10')](function(){return _0x1a6e03(null,_0x275300);});}}else{return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}}else{return utils['clearBlockUser'](_0x275300,0x0,![],null)[_0x2aea('0x10')](function(){return utils[_0x2aea('0x20')](_0x275300);})[_0x2aea('0x10')](function(){return _0x1a6e03(null,_0x275300);})[_0x2aea('0x21')](function(_0x27359c){return _0x1a6e03(null,![],_0x27359c);});}}else{if(_0x275300[_0x2aea('0x16')]){return _0x1a6e03(null,![],{'message':_0x2aea('0x1b')});}else{return utils[_0x2aea('0x20')](_0x275300)[_0x2aea('0x10')](function(){return _0x1a6e03(null,_0x275300);});}}}});})['catch'](function(_0x52be90){return _0x1a6e03(null,![],_0x52be90);});}function sendServiceMail(_0x1ea45f){return db[_0x2aea('0x22')][_0x2aea('0x23')]({'where':{'service':!![]},'attributes':['id',_0x2aea('0x11'),_0x2aea('0x24')],'include':[{'model':db[_0x2aea('0x25')],'as':_0x2aea('0x26'),'include':[{'model':db[_0x2aea('0x27')],'as':_0x2aea('0x27')}]}]})[_0x2aea('0x10')](function(_0x33ec04){if(!_0x33ec04){throw new Error(_0x2aea('0x28'));}var _0x598c42=_0x33ec04[_0x2aea('0x29')]();var _0x4d057a={'account':_0x598c42,'message':_[_0x2aea('0x2a')]({'from':util[_0x2aea('0x2b')](_0x2aea('0x2c'),_0x33ec04[_0x2aea('0x11')],_0x33ec04[_0x2aea('0x24')]||_0x33ec04['Smtp'][_0x2aea('0x2d')])},_0x1ea45f)};return client[_0x2aea('0x2e')](_0x2aea('0x2f'),_0x4d057a);})[_0x2aea('0x10')](function(_0x2e663f){if(_0x2e663f['error']){throw new Error(util[_0x2aea('0x2b')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x2e663f['error']['message']||JSON[_0x2aea('0x30')](_0x2e663f['error'])));}return!![];});}function handleError(_0x412fdd,_0x41662a,_0x9fb962){return _0x412fdd[_0x2aea('0x31')](_0x41662a||0x1f4)[_0x2aea('0x32')]({'message':_0x9fb962?_0x9fb962[_0x2aea('0x33')]||_0x9fb962:''});}exports[_0x2aea('0x34')]=function(_0x3aa685,_0xbee065,_0x3e0fe2){passport[_0x2aea('0x1c')](_0x2aea('0x35'),function(_0x3c14e9,_0x4f5737,_0x38a8d0){var _0x1f9b04=_0x3c14e9||_0x38a8d0;if(_0x1f9b04){return handleError(_0xbee065,0x191,_0x1f9b04);}if(!_0x4f5737){return handleError(_0xbee065,0x194,{'message':_0x2aea('0x36')});}else{var _0x9d4619={'payload':{'id':_0x4f5737['id'],'role':_0x4f5737[_0x2aea('0x14')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x9d4619)[_0x2aea('0x10')](function(_0x40dc66){_0xbee065[_0x2aea('0x37')]({'id':_0x4f5737['id'],'token':_0x40dc66,'statusCall':'','isAlreadyLogged':_0x4f5737[_0x2aea('0x38')]});});}})(_0x3aa685,_0xbee065,_0x3e0fe2);};exports[_0x2aea('0x39')]=function(_0x43f80e,_0x30fed1){if(!_0x43f80e[_0x2aea('0x3a')]['email']){return handleError(_0x30fed1,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x591276=rs[_0x2aea('0x3b')]();_0x43f80e['body']['email']=_0x43f80e[_0x2aea('0x3a')][_0x2aea('0x24')][_0x2aea('0x3c')]()[_0x2aea('0x3d')]();var _0x4ef3d7;return db[_0x2aea('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0x2aea('0xe'),_0x2aea('0xf')],'raw':!![]})['then'](function(_0x51818b){_0x4ef3d7=_0x51818b;return db[_0x2aea('0x3e')][_0x2aea('0x23')]({'where':{'email':_0x43f80e[_0x2aea('0x3a')]['email']}});})[_0x2aea('0x10')](function(_0x45869d){if(!_0x45869d){throw new Error(_0x2aea('0x3f'));}if(_0x45869d[_0x2aea('0x15')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x45869d['blocked']){if(moment(_0x45869d[_0x2aea('0x17')])['add'](_0x4ef3d7['blockDuration'],_0x2aea('0x1e'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x45869d[_0x2aea('0x16')]=![];_0x45869d['blockedAt']=null;}}_0x45869d[_0x2aea('0x40')]=_0x591276;_0x45869d['resetPasswordExpires']=Date[_0x2aea('0x41')]()+0x36ee80;return _0x45869d[_0x2aea('0x42')]();})[_0x2aea('0x10')](function(){return sendServiceMail({'to':_0x43f80e[_0x2aea('0x3a')][_0x2aea('0x24')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x2aea('0x43')+_0x43f80e[_0x2aea('0x44')][_0x2aea('0x45')]+_0x2aea('0x46')+_0x591276+'\x0a\x0a'+_0x2aea('0x47')});})[_0x2aea('0x10')](function(){_0x30fed1[_0x2aea('0x31')](0xc8)['send']({'message':_0x2aea('0x48')});})['catch'](function(_0x13ff33){return handleError(_0x30fed1,0x1f4,_0x13ff33);});};exports['reset']=function(_0x535394,_0x31eb72){return db[_0x2aea('0x3e')][_0x2aea('0x23')]({'where':{'resetPasswordToken':_0x535394[_0x2aea('0x49')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x2aea('0x10')](function(_0x1fec98){if(!_0x1fec98){throw new Error(_0x2aea('0x4a'));}return db[_0x2aea('0xd')][_0x2aea('0x4b')]({'attributes':['id',_0x2aea('0x4c'),_0x2aea('0x4d'),'passwordHistoryLimit']})[_0x2aea('0x10')](function(_0x3a0bdf){if(_0x3a0bdf['securePassword'])authService[_0x2aea('0x4e')](_0x535394[_0x2aea('0x3a')][_0x2aea('0x12')]);if(!_0x3a0bdf[_0x2aea('0x4d')]||!_0x1fec98[_0x2aea('0x4f')])return _0x1fec98;authService[_0x2aea('0x50')](_0x535394[_0x2aea('0x3a')][_0x2aea('0x12')],_0x1fec98['previousPasswords'],_0x3a0bdf[_0x2aea('0x51')]);return _0x1fec98;})[_0x2aea('0x10')](function(){_0x1fec98[_0x2aea('0x12')]=_0x535394[_0x2aea('0x3a')][_0x2aea('0x12')];_0x1fec98[_0x2aea('0x40')]=null;_0x1fec98[_0x2aea('0x52')]=null;return _0x1fec98['save']();});})[_0x2aea('0x10')](function(){_0x31eb72[_0x2aea('0x31')](0xc8)[_0x2aea('0x32')]({'message':_0x2aea('0x53')});})[_0x2aea('0x21')](function(_0x1eed3){return handleError(_0x31eb72,0x1f4,_0x1eed3);});};passport['use'](_0x2aea('0x35'),new LocalStrategy({'usernameField':_0x2aea('0x11'),'passwordField':'password'},function(_0x3a8c13,_0x38f531,_0x19c0f9){return localAuthenticate(db[_0x2aea('0x3e')],_0x3a8c13,_0x38f531,_0x19c0f9);})); \ No newline at end of file +var _0x21aa=['online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x21aa,0x112));var _0xa21a=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0x21aa[_0x401d67];return _0x25076b;};'use strict';var util=require(_0xa21a('0x0'));var passport=require(_0xa21a('0x1'));var LocalStrategy=require(_0xa21a('0x2'))['Strategy'];var jayson=require(_0xa21a('0x3'));var _=require(_0xa21a('0x4'));var rs=require(_0xa21a('0x5'));var moment=require(_0xa21a('0x6'));var db=require(_0xa21a('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xa21a('0x8'));var client=jayson[_0xa21a('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x156d1b,_0x586cd5,_0x310284,_0x44af44){var _0x3b42f0,_0x37b835;return db['Setting'][_0xa21a('0xa')]({'where':{'id':0x1},'attributes':[_0xa21a('0xb'),_0xa21a('0xc')],'raw':!![]})[_0xa21a('0xd')](function(_0x2a437d){_0x3b42f0=_0x2a437d;return _0x156d1b[_0xa21a('0xa')]({'attributes':['id',_0xa21a('0xe'),_0xa21a('0xf'),_0xa21a('0x10'),_0xa21a('0x11'),_0xa21a('0x12'),_0xa21a('0x13'),'blockedAt',_0xa21a('0x14')],'where':{'name':_0x586cd5,'role':{'$or':[_0xa21a('0x15'),_0xa21a('0x16'),_0xa21a('0x17')]}}});})[_0xa21a('0xd')](function(_0x2da5f3){if(!_0x2da5f3||_0x2da5f3&&_0x2da5f3[_0xa21a('0xe')]!==_0x586cd5){throw new Error(_0xa21a('0x18'));}else{_0x37b835=_0x2da5f3;return _0x37b835;}})[_0xa21a('0xd')](function(){_0x37b835[_0xa21a('0x19')](_0x310284,function(_0x3cf577,_0x2aaf42){var _0x554bc1=_0x37b835['loginAttempts']+0x1;if(_0x3cf577){return _0x44af44(_0x3cf577);}else if(!_0x2aaf42){if(_0x37b835[_0xa21a('0x12')]){return _0x44af44(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3b42f0[_0xa21a('0xb')]>0x0){if(_0x37b835['blocked']){if(_0x3b42f0[_0xa21a('0xc')]>0x0){if(moment(_0x37b835[_0xa21a('0x1a')])[_0xa21a('0x1b')](_0x3b42f0['blockDuration'],'minutes')>moment()){return _0x44af44(null,![],{'message':_0xa21a('0x18')});}else{return utils[_0xa21a('0x1c')](_0x37b835,_0x554bc1,![],null)[_0xa21a('0xd')](function(){return _0x44af44(null,![],{'message':_0xa21a('0x18')});});}}else{return _0x44af44(null,![],{'message':_0xa21a('0x18')});}}else{if(_0x554bc1>=_0x3b42f0[_0xa21a('0xb')]){return utils[_0xa21a('0x1c')](_0x37b835,0x0,!![],moment())[_0xa21a('0xd')](function(){return _0x44af44(null,![],{'message':_0xa21a('0x18')});});}else{return utils[_0xa21a('0x1c')](_0x37b835,_0x554bc1,![],null)[_0xa21a('0xd')](function(){return _0x44af44(null,![],{'message':_0xa21a('0x18')});});}}}else{return _0x44af44(null,![],{'message':_0xa21a('0x18')});}}else{if(_0x37b835[_0xa21a('0x12')]){return _0x44af44(null,![],{'message':_0xa21a('0x18')});}else if(_0x3b42f0['allowedLoginAttempts']>0x0){if(_0x37b835['blocked']){if(_0x3b42f0[_0xa21a('0xc')]>0x0){if(moment(_0x37b835[_0xa21a('0x1a')])[_0xa21a('0x1b')](_0x3b42f0[_0xa21a('0xc')],_0xa21a('0x1d'))>moment()){return _0x44af44(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xa21a('0x1c')](_0x37b835,0x0,![],null)[_0xa21a('0xd')](function(){return utils[_0xa21a('0x1e')](_0x37b835);})[_0xa21a('0xd')](function(){return _0x44af44(null,_0x37b835);});}}else{return _0x44af44(null,![],{'message':_0xa21a('0x18')});}}else{return utils[_0xa21a('0x1c')](_0x37b835,0x0,![],null)[_0xa21a('0xd')](function(){return utils['getLicense'](_0x37b835);})[_0xa21a('0xd')](function(){return _0x44af44(null,_0x37b835);})[_0xa21a('0x1f')](function(_0x28a37f){return _0x44af44(null,![],_0x28a37f);});}}else{if(_0x37b835['blocked']){return _0x44af44(null,![],{'message':_0xa21a('0x18')});}else{return utils[_0xa21a('0x1e')](_0x37b835)[_0xa21a('0xd')](function(){return _0x44af44(null,_0x37b835);});}}}});})[_0xa21a('0x1f')](function(_0x5ed842){return _0x44af44(null,![],_0x5ed842);});}function sendServiceMail(_0x3d8e17){return db[_0xa21a('0x20')][_0xa21a('0x21')]({'where':{'service':!![]},'attributes':['id',_0xa21a('0xe'),_0xa21a('0x22')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xa21a('0x23')}]}]})[_0xa21a('0xd')](function(_0x292a1d){if(!_0x292a1d){throw new Error(_0xa21a('0x24'));}var _0x133314=_0x292a1d[_0xa21a('0x25')]();var _0x928f5d={'account':_0x133314,'message':_['merge']({'from':util[_0xa21a('0x26')](_0xa21a('0x27'),_0x292a1d[_0xa21a('0xe')],_0x292a1d[_0xa21a('0x22')]||_0x292a1d['Smtp'][_0xa21a('0x16')])},_0x3d8e17)};return client['request'](_0xa21a('0x28'),_0x928f5d);})[_0xa21a('0xd')](function(_0x37c4b5){if(_0x37c4b5[_0xa21a('0x29')]){throw new Error(util[_0xa21a('0x26')](_0xa21a('0x2a'),_0x37c4b5[_0xa21a('0x29')][_0xa21a('0x2b')]||JSON[_0xa21a('0x2c')](_0x37c4b5[_0xa21a('0x29')])));}return!![];});}function handleError(_0x493012,_0x5b8240,_0x3a687d){return _0x493012[_0xa21a('0x2d')](_0x5b8240||0x1f4)[_0xa21a('0x2e')]({'message':_0x3a687d?_0x3a687d[_0xa21a('0x2b')]||_0x3a687d:''});}exports['login']=function(_0xee1e6f,_0x2335ad,_0x4b9bf2){passport['authenticate']('local-login',function(_0x1b111e,_0x70d6d7,_0x5be58f){var _0x12abe0=_0x1b111e||_0x5be58f;if(_0x12abe0){return handleError(_0x2335ad,0x191,_0x12abe0);}if(!_0x70d6d7){return handleError(_0x2335ad,0x194,{'message':_0xa21a('0x2f')});}else{var _0x5a596d={'payload':{'id':_0x70d6d7['id'],'role':_0x70d6d7[_0xa21a('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xa21a('0x30')](_0x5a596d)['then'](function(_0x33f241){_0x2335ad[_0xa21a('0x31')]({'id':_0x70d6d7['id'],'token':_0x33f241,'statusCall':'','isAlreadyLogged':_0x70d6d7[_0xa21a('0x32')]});});}})(_0xee1e6f,_0x2335ad,_0x4b9bf2);};exports[_0xa21a('0x33')]=function(_0x3ca746,_0x3b8062){if(!_0x3ca746[_0xa21a('0x34')]['email']){return handleError(_0x3b8062,0x1f4,{'message':_0xa21a('0x35')});}var _0x43f0d1=rs[_0xa21a('0x36')]();_0x3ca746['body'][_0xa21a('0x22')]=_0x3ca746['body'][_0xa21a('0x22')]['trim']()[_0xa21a('0x37')]();var _0x186124;return db['Setting'][_0xa21a('0xa')]({'where':{'id':0x1},'attributes':[_0xa21a('0xb'),_0xa21a('0xc')],'raw':!![]})[_0xa21a('0xd')](function(_0x99cad1){_0x186124=_0x99cad1;return db[_0xa21a('0x38')][_0xa21a('0x21')]({'where':{'email':_0x3ca746['body'][_0xa21a('0x22')]}});})[_0xa21a('0xd')](function(_0x3764e0){if(!_0x3764e0){throw new Error(_0xa21a('0x39'));}if(_0x3764e0[_0xa21a('0x12')]){throw new Error(_0xa21a('0x3a'));}if(_0x3764e0[_0xa21a('0x13')]){if(moment(_0x3764e0['blockedAt'])[_0xa21a('0x1b')](_0x186124['blockDuration'],_0xa21a('0x1d'))>moment()){throw new Error(_0xa21a('0x3b'));}else{_0x3764e0[_0xa21a('0x13')]=![];_0x3764e0['blockedAt']=null;}}_0x3764e0[_0xa21a('0x3c')]=_0x43f0d1;_0x3764e0[_0xa21a('0x3d')]=Date['now']()+0x36ee80;return _0x3764e0['save']();})['then'](function(){return sendServiceMail({'to':_0x3ca746[_0xa21a('0x34')][_0xa21a('0x22')],'subject':_0xa21a('0x3e'),'text':_0xa21a('0x3f')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xa21a('0x40')+_0x3ca746[_0xa21a('0x41')][_0xa21a('0x42')]+'/reset/'+_0x43f0d1+'\x0a\x0a'+_0xa21a('0x43')});})[_0xa21a('0xd')](function(){_0x3b8062[_0xa21a('0x2d')](0xc8)['send']({'message':_0xa21a('0x44')});})[_0xa21a('0x1f')](function(_0x5d4036){return handleError(_0x3b8062,0x1f4,_0x5d4036);});};exports[_0xa21a('0x45')]=function(_0x491d08,_0x2a9d7c){return db['User']['find']({'where':{'resetPasswordToken':_0x491d08[_0xa21a('0x46')][_0xa21a('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xa21a('0xd')](function(_0xecc246){if(!_0xecc246){throw new Error(_0xa21a('0x48'));}return db['Setting'][_0xa21a('0xa')]({'attributes':['id',_0xa21a('0x49'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xa21a('0xd')](function(_0x112084){if(_0x112084[_0xa21a('0x49')])authService[_0xa21a('0x4a')](_0x491d08[_0xa21a('0x34')][_0xa21a('0xf')]);if(!_0x112084[_0xa21a('0x4b')]||!_0xecc246[_0xa21a('0x4c')])return _0xecc246;authService[_0xa21a('0x4d')](_0x491d08[_0xa21a('0x34')][_0xa21a('0xf')],_0xecc246[_0xa21a('0x4c')],_0x112084['passwordHistoryLimit']);return _0xecc246;})[_0xa21a('0xd')](function(){_0xecc246[_0xa21a('0xf')]=_0x491d08[_0xa21a('0x34')][_0xa21a('0xf')];_0xecc246[_0xa21a('0x3c')]=null;_0xecc246[_0xa21a('0x3d')]=null;return _0xecc246[_0xa21a('0x4e')]();});})[_0xa21a('0xd')](function(){_0x2a9d7c[_0xa21a('0x2d')](0xc8)[_0xa21a('0x2e')]({'message':_0xa21a('0x4f')});})['catch'](function(_0x48cda7){return handleError(_0x2a9d7c,0x1f4,_0x48cda7);});};passport[_0xa21a('0x50')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0xa21a('0xf')},function(_0x4f092d,_0x481dd2,_0x3c30e2){return localAuthenticate(db['User'],_0x4f092d,_0x481dd2,_0x3c30e2);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 02efde5..63f4297 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 _0x4948=['./authLocal.controller','post','/forgot','forgot','reset','exports','express'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4948,0xae));var _0x8494=function(_0x3652f7,_0x39448c){_0x3652f7=_0x3652f7-0x0;var _0x365c5c=_0x4948[_0x3652f7];return _0x365c5c;};'use strict';var express=require(_0x8494('0x0'));var router=express['Router']();var controller=require(_0x8494('0x1'));router[_0x8494('0x2')]('/',controller['login']);router['post'](_0x8494('0x3'),controller[_0x8494('0x4')]);router[_0x8494('0x2')]('/reset/:token',controller[_0x8494('0x5')]);module[_0x8494('0x6')]=router; \ No newline at end of file +var _0x67e8=['login','/forgot','reset','exports','Router','post'];(function(_0x309bfb,_0x38a2ce){var _0x158a12=function(_0x3a561b){while(--_0x3a561b){_0x309bfb['push'](_0x309bfb['shift']());}};_0x158a12(++_0x38a2ce);}(_0x67e8,0x88));var _0x867e=function(_0x57dd97,_0x1e5ae4){_0x57dd97=_0x57dd97-0x0;var _0x1b2fa6=_0x67e8[_0x57dd97];return _0x1b2fa6;};'use strict';var express=require('express');var router=express[_0x867e('0x0')]();var controller=require('./authLocal.controller');router[_0x867e('0x1')]('/',controller[_0x867e('0x2')]);router['post'](_0x867e('0x3'),controller['forgot']);router[_0x867e('0x1')]('/reset/:token',controller[_0x867e('0x4')]);module[_0x867e('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index d0f8352..8884d83 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 _0xe3a8=['INTEGER','exports','STRING'];(function(_0x3ccc28,_0x5036d5){var _0x47dd45=function(_0xd86e79){while(--_0xd86e79){_0x3ccc28['push'](_0x3ccc28['shift']());}};_0x47dd45(++_0x5036d5);}(_0xe3a8,0x148));var _0x8e3a=function(_0x2aaf83,_0xfed894){_0x2aaf83=_0x2aaf83-0x0;var _0x1d3b7d=_0xe3a8[_0x2aaf83];return _0x1d3b7d;};'use strict';var Sequelize=require('sequelize');module[_0x8e3a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8e3a('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8e3a('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0xbb59=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb59,0xda));var _0x9bb5=function(_0x32332c,_0x49323d){_0x32332c=_0x32332c-0x0;var _0x41e67e=_0xbb59[_0x32332c];return _0x41e67e;};'use strict';var Sequelize=require('sequelize');module[_0x9bb5('0x0')]={'name':{'type':Sequelize[_0x9bb5('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9bb5('0x1')]},'status':{'type':Sequelize[_0x9bb5('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9bb5('0x3')],'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 a1313e4..11d926b 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 _0x933d=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','Automation','rows','catch','show','rawAttributes','include','merge','create','body','find','params','addConditions','Condition','ids','omit','getConditions','findOne','Action','addActions','getActions','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x933d,0x1bc));var _0xd933=function(_0x4c99d7,_0x378b6f){_0x4c99d7=_0x4c99d7-0x0;var _0x109a38=_0x933d[_0x4c99d7];return _0x109a38;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd933('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd933('0x1'));var moment=require(_0xd933('0x2'));var BPromise=require(_0xd933('0x3'));var Mustache=require(_0xd933('0x4'));var util=require(_0xd933('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd933('0x6'));var ejs=require(_0xd933('0x7'));var fs=require('fs');var fs_extra=require(_0xd933('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd933('0x9'));var jsforce=require(_0xd933('0xa'));var deskjs=require(_0xd933('0xb'));var toCsv=require(_0xd933('0x6'));var querystring=require(_0xd933('0xc'));var Papa=require(_0xd933('0xd'));var Redis=require(_0xd933('0xe'));var authService=require(_0xd933('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd933('0x10'));var utils=require(_0xd933('0x11'));var config=require(_0xd933('0x12'));var licenseUtil=require(_0xd933('0x13'));var db=require(_0xd933('0x14'))['db'];function respondWithStatusCode(_0x415deb,_0x2756be){_0x2756be=_0x2756be||0xcc;return function(_0x36f301){if(_0x36f301){return _0x415deb[_0xd933('0x15')](_0x2756be);}return _0x415deb[_0xd933('0x16')](_0x2756be)[_0xd933('0x17')]();};}function respondWithResult(_0x3c4bc4,_0x2a3bac){_0x2a3bac=_0x2a3bac||0xc8;return function(_0x5571c1){if(_0x5571c1){return _0x3c4bc4[_0xd933('0x16')](_0x2a3bac)['json'](_0x5571c1);}};}function respondWithFilteredResult(_0x3fd1ab,_0x40732a){return function(_0x3b96c8){if(_0x3b96c8){var _0x44b031=typeof _0x40732a[_0xd933('0x18')]===_0xd933('0x19')&&typeof _0x40732a[_0xd933('0x1a')]===_0xd933('0x19');var _0x4a8104=_0x3b96c8[_0xd933('0x1b')];var _0x139b2d=_0x44b031?0x0:_0x40732a[_0xd933('0x18')];var _0x18f520=_0x44b031?_0x3b96c8[_0xd933('0x1b')]:_0x40732a[_0xd933('0x18')]+_0x40732a[_0xd933('0x1a')];var _0x129a9d;if(_0x18f520>=_0x4a8104){_0x18f520=_0x4a8104;_0x129a9d=0xc8;}else{_0x129a9d=0xce;}_0x3fd1ab[_0xd933('0x16')](_0x129a9d);return _0x3fd1ab[_0xd933('0x1c')](_0xd933('0x1d'),_0x139b2d+'-'+_0x18f520+'/'+_0x4a8104)[_0xd933('0x1e')](_0x3b96c8);}return null;};}function patchUpdates(_0x1e9326){return function(_0x21332b){try{jsonpatch['apply'](_0x21332b,_0x1e9326,!![]);}catch(_0x1d1f38){return BPromise[_0xd933('0x1f')](_0x1d1f38);}return _0x21332b[_0xd933('0x20')]();};}function saveUpdates(_0x3ab56d,_0x23b8a9){return function(_0x5f3ed3){if(_0x5f3ed3){return _0x5f3ed3[_0xd933('0x21')](_0x3ab56d)[_0xd933('0x22')](function(_0x5fa66c){return _0x5fa66c;});}return null;};}function removeEntity(_0x19cf46,_0x5afdec){return function(_0xf70add){if(_0xf70add){return _0xf70add[_0xd933('0x23')]()[_0xd933('0x22')](function(){_0x19cf46[_0xd933('0x16')](0xcc)[_0xd933('0x17')]();});}};}function handleEntityNotFound(_0x45a11b,_0x3f5a32){return function(_0x292ac4){if(!_0x292ac4){_0x45a11b[_0xd933('0x15')](0x194);}return _0x292ac4;};}function handleError(_0x2ca37b,_0x31e5f7){_0x31e5f7=_0x31e5f7||0x1f4;return function(_0xd43cd){logger[_0xd933('0x24')](_0xd43cd[_0xd933('0x25')]);if(_0xd43cd[_0xd933('0x26')]){delete _0xd43cd[_0xd933('0x26')];}_0x2ca37b[_0xd933('0x16')](_0x31e5f7)[_0xd933('0x27')](_0xd43cd);};}exports['index']=function(_0x3bbd22,_0x34d787){var _0x3a9a62={},_0x9d2f5e={},_0x11083d={'count':0x0,'rows':[]};var _0x4cc455=_[_0xd933('0x28')](db['Automation']['rawAttributes'],function(_0x4354f6){return{'name':_0x4354f6[_0xd933('0x29')],'type':_0x4354f6[_0xd933('0x2a')][_0xd933('0x2b')]};});_0x9d2f5e[_0xd933('0x2c')]=_[_0xd933('0x28')](_0x4cc455,_0xd933('0x26'));_0x9d2f5e[_0xd933('0x2d')]=_[_0xd933('0x2e')](_0x3bbd22['query']);_0x9d2f5e['filters']=_[_0xd933('0x2f')](_0x9d2f5e[_0xd933('0x2c')],_0x9d2f5e[_0xd933('0x2d')]);_0x3a9a62[_0xd933('0x30')]=_['intersection'](_0x9d2f5e['model'],qs[_0xd933('0x31')](_0x3bbd22[_0xd933('0x2d')][_0xd933('0x31')]));_0x3a9a62[_0xd933('0x30')]=_0x3a9a62['attributes'][_0xd933('0x32')]?_0x3a9a62['attributes']:_0x9d2f5e['model'];if(!_0x3bbd22['query'][_0xd933('0x33')](_0xd933('0x34'))){_0x3a9a62[_0xd933('0x1a')]=qs['limit'](_0x3bbd22['query']['limit']);_0x3a9a62[_0xd933('0x18')]=qs['offset'](_0x3bbd22[_0xd933('0x2d')][_0xd933('0x18')]);}_0x3a9a62[_0xd933('0x35')]=qs[_0xd933('0x36')](_0x3bbd22[_0xd933('0x2d')][_0xd933('0x36')]);_0x3a9a62[_0xd933('0x37')]=qs[_0xd933('0x38')](_[_0xd933('0x39')](_0x3bbd22[_0xd933('0x2d')],_0x9d2f5e['filters']),_0x4cc455);if(_0x3bbd22[_0xd933('0x2d')][_0xd933('0x3a')]){_0x3a9a62[_0xd933('0x37')]=_['merge'](_0x3a9a62[_0xd933('0x37')],{'$or':_[_0xd933('0x28')](_0x4cc455,function(_0x3485ac){if(_0x3485ac[_0xd933('0x2a')]!==_0xd933('0x3b')){var _0x517264={};_0x517264[_0x3485ac[_0xd933('0x26')]]={'$like':'%'+_0x3bbd22[_0xd933('0x2d')][_0xd933('0x3a')]+'%'};return _0x517264;}})});}_0x3a9a62=_['merge']({},_0x3a9a62,_0x3bbd22[_0xd933('0x3c')]);var _0x5b2d21={'where':_0x3a9a62[_0xd933('0x37')]};return db['Automation'][_0xd933('0x1b')](_0x5b2d21)[_0xd933('0x22')](function(_0x1e6643){_0x11083d[_0xd933('0x1b')]=_0x1e6643;if(_0x3bbd22[_0xd933('0x2d')][_0xd933('0x3d')]){_0x3a9a62['include']=[{'all':!![]}];}return db[_0xd933('0x3e')]['findAll'](_0x3a9a62);})['then'](function(_0x229d87){_0x11083d[_0xd933('0x3f')]=_0x229d87;return _0x11083d;})[_0xd933('0x22')](respondWithFilteredResult(_0x34d787,_0x3a9a62))[_0xd933('0x40')](handleError(_0x34d787,null));};exports[_0xd933('0x41')]=function(_0x2e56fa,_0x5aa31c){var _0x3f109d={'raw':![],'where':{'id':_0x2e56fa['params']['id']}},_0x4711f2={};_0x4711f2[_0xd933('0x2c')]=_[_0xd933('0x2e')](db['Automation'][_0xd933('0x42')]);_0x4711f2[_0xd933('0x2d')]=_['keys'](_0x2e56fa[_0xd933('0x2d')]);_0x4711f2[_0xd933('0x38')]=_['intersection'](_0x4711f2[_0xd933('0x2c')],_0x4711f2[_0xd933('0x2d')]);_0x3f109d['attributes']=_['intersection'](_0x4711f2[_0xd933('0x2c')],qs[_0xd933('0x31')](_0x2e56fa['query'][_0xd933('0x31')]));_0x3f109d[_0xd933('0x30')]=_0x3f109d[_0xd933('0x30')][_0xd933('0x32')]?_0x3f109d[_0xd933('0x30')]:_0x4711f2['model'];if(_0x2e56fa[_0xd933('0x2d')][_0xd933('0x3d')]){_0x3f109d[_0xd933('0x43')]=[{'all':!![]}];}_0x3f109d=_[_0xd933('0x44')]({},_0x3f109d,_0x2e56fa[_0xd933('0x3c')]);return db[_0xd933('0x3e')]['find'](_0x3f109d)[_0xd933('0x22')](handleEntityNotFound(_0x5aa31c,null))['then'](respondWithResult(_0x5aa31c,null))[_0xd933('0x40')](handleError(_0x5aa31c,null));};exports[_0xd933('0x45')]=function(_0x487daf,_0x3e57a8){return db[_0xd933('0x3e')][_0xd933('0x45')](_0x487daf[_0xd933('0x46')],{})[_0xd933('0x22')](respondWithResult(_0x3e57a8,0xc9))[_0xd933('0x40')](handleError(_0x3e57a8,null));};exports[_0xd933('0x21')]=function(_0x4d4e8c,_0x3d0872){if(_0x4d4e8c[_0xd933('0x46')]['id']){delete _0x4d4e8c[_0xd933('0x46')]['id'];}return db[_0xd933('0x3e')][_0xd933('0x47')]({'where':{'id':_0x4d4e8c[_0xd933('0x48')]['id']}})[_0xd933('0x22')](handleEntityNotFound(_0x3d0872,null))[_0xd933('0x22')](saveUpdates(_0x4d4e8c[_0xd933('0x46')],null))['then'](respondWithResult(_0x3d0872,null))[_0xd933('0x40')](handleError(_0x3d0872,null));};exports[_0xd933('0x23')]=function(_0x5c5d04,_0x41e9b3){return db[_0xd933('0x3e')]['find']({'where':{'id':_0x5c5d04[_0xd933('0x48')]['id']}})[_0xd933('0x22')](handleEntityNotFound(_0x41e9b3,null))[_0xd933('0x22')](removeEntity(_0x41e9b3,null))[_0xd933('0x40')](handleError(_0x41e9b3,null));};exports[_0xd933('0x49')]=function(_0x30d6bc,_0x5ebc5b,_0x4c7337){return db[_0xd933('0x4a')][_0xd933('0x47')]({'where':{'id':_0x30d6bc[_0xd933('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ebc5b,null))['then'](function(_0x1356a1){if(_0x1356a1){return _0x1356a1['addConditions'](_0x30d6bc[_0xd933('0x46')][_0xd933('0x4b')],_[_0xd933('0x4c')](_0x30d6bc[_0xd933('0x46')],[_0xd933('0x4b'),'id'])||{});}})[_0xd933('0x22')](respondWithResult(_0x5ebc5b,null))['catch'](handleError(_0x5ebc5b,null));};exports[_0xd933('0x4d')]=function(_0x418b79,_0x2e1365,_0x122eec){var _0xfad260={};var _0x33dceb={};var _0x18c5d7;var _0x5ac562;return db['Automation'][_0xd933('0x4e')]({'where':{'id':_0x418b79[_0xd933('0x48')]['id']}})[_0xd933('0x22')](handleEntityNotFound(_0x2e1365,null))[_0xd933('0x22')](function(_0x36650d){if(_0x36650d){_0x18c5d7=_0x36650d;_0x33dceb[_0xd933('0x2c')]=_[_0xd933('0x2e')](db['Condition'][_0xd933('0x42')]);_0x33dceb['query']=_[_0xd933('0x2e')](_0x418b79['query']);_0x33dceb[_0xd933('0x38')]=_[_0xd933('0x2f')](_0x33dceb[_0xd933('0x2c')],_0x33dceb[_0xd933('0x2d')]);_0xfad260[_0xd933('0x30')]=_[_0xd933('0x2f')](_0x33dceb['model'],qs[_0xd933('0x31')](_0x418b79[_0xd933('0x2d')][_0xd933('0x31')]));_0xfad260[_0xd933('0x30')]=_0xfad260[_0xd933('0x30')]['length']?_0xfad260['attributes']:_0x33dceb[_0xd933('0x2c')];_0xfad260['order']=qs[_0xd933('0x36')](_0x418b79[_0xd933('0x2d')][_0xd933('0x36')]);_0xfad260['where']=qs[_0xd933('0x38')](_[_0xd933('0x39')](_0x418b79[_0xd933('0x2d')],_0x33dceb[_0xd933('0x38')]));if(_0x418b79['query'][_0xd933('0x3a')]){_0xfad260['where']=_[_0xd933('0x44')](_0xfad260[_0xd933('0x37')],{'$or':_['map'](_0xfad260['attributes'],function(_0x4e0124){var _0x33477d={};_0x33477d[_0x4e0124]={'$like':'%'+_0x418b79[_0xd933('0x2d')]['filter']+'%'};return _0x33477d;})});}_0xfad260=_[_0xd933('0x44')]({},_0xfad260,_0x418b79[_0xd933('0x3c')]);return _0x18c5d7[_0xd933('0x4d')](_0xfad260);}})[_0xd933('0x22')](function(_0x1ea8e7){if(_0x1ea8e7){_0x5ac562=_0x1ea8e7['length'];if(!_0x418b79[_0xd933('0x2d')][_0xd933('0x33')]('nolimit')){_0xfad260[_0xd933('0x1a')]=qs['limit'](_0x418b79[_0xd933('0x2d')][_0xd933('0x1a')]);_0xfad260[_0xd933('0x18')]=qs[_0xd933('0x18')](_0x418b79[_0xd933('0x2d')][_0xd933('0x18')]);}return _0x18c5d7[_0xd933('0x4d')](_0xfad260);}})['then'](function(_0x12aab6){if(_0x12aab6){return _0x12aab6?{'count':_0x5ac562,'rows':_0x12aab6}:null;}})['then'](respondWithResult(_0x2e1365,null))['catch'](handleError(_0x2e1365,null));};exports['addActions']=function(_0x1da9f6,_0x391dab,_0x15d6aa){return db[_0xd933('0x4f')]['find']({'where':{'id':_0x1da9f6[_0xd933('0x48')]['id']}})['then'](handleEntityNotFound(_0x391dab,null))[_0xd933('0x22')](function(_0x216f67){if(_0x216f67){return _0x216f67[_0xd933('0x50')](_0x1da9f6[_0xd933('0x46')][_0xd933('0x4b')],_[_0xd933('0x4c')](_0x1da9f6[_0xd933('0x46')],[_0xd933('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x391dab,null))[_0xd933('0x40')](handleError(_0x391dab,null));};exports[_0xd933('0x51')]=function(_0x255821,_0x486d1e,_0x3af657){var _0x10ae41={};var _0xa85f16={};var _0x2eb078;var _0x572781;return db[_0xd933('0x3e')]['findOne']({'where':{'id':_0x255821[_0xd933('0x48')]['id']}})[_0xd933('0x22')](handleEntityNotFound(_0x486d1e,null))['then'](function(_0x2dd1bc){if(_0x2dd1bc){_0x2eb078=_0x2dd1bc;_0xa85f16[_0xd933('0x2c')]=_[_0xd933('0x2e')](db['Action'][_0xd933('0x42')]);_0xa85f16[_0xd933('0x2d')]=_[_0xd933('0x2e')](_0x255821['query']);_0xa85f16[_0xd933('0x38')]=_[_0xd933('0x2f')](_0xa85f16['model'],_0xa85f16['query']);_0x10ae41[_0xd933('0x30')]=_[_0xd933('0x2f')](_0xa85f16['model'],qs[_0xd933('0x31')](_0x255821[_0xd933('0x2d')][_0xd933('0x31')]));_0x10ae41[_0xd933('0x30')]=_0x10ae41[_0xd933('0x30')]['length']?_0x10ae41[_0xd933('0x30')]:_0xa85f16['model'];_0x10ae41[_0xd933('0x35')]=qs[_0xd933('0x36')](_0x255821[_0xd933('0x2d')][_0xd933('0x36')]);_0x10ae41[_0xd933('0x37')]=qs['filters'](_[_0xd933('0x39')](_0x255821['query'],_0xa85f16[_0xd933('0x38')]));if(_0x255821[_0xd933('0x2d')][_0xd933('0x3a')]){_0x10ae41[_0xd933('0x37')]=_[_0xd933('0x44')](_0x10ae41[_0xd933('0x37')],{'$or':_[_0xd933('0x28')](_0x10ae41[_0xd933('0x30')],function(_0x43c8fb){var _0x1aa334={};_0x1aa334[_0x43c8fb]={'$like':'%'+_0x255821[_0xd933('0x2d')][_0xd933('0x3a')]+'%'};return _0x1aa334;})});}_0x10ae41=_[_0xd933('0x44')]({},_0x10ae41,_0x255821[_0xd933('0x3c')]);return _0x2eb078['getActions'](_0x10ae41);}})['then'](function(_0x3b8d4d){if(_0x3b8d4d){_0x572781=_0x3b8d4d[_0xd933('0x32')];if(!_0x255821[_0xd933('0x2d')][_0xd933('0x33')]('nolimit')){_0x10ae41[_0xd933('0x1a')]=qs[_0xd933('0x1a')](_0x255821[_0xd933('0x2d')][_0xd933('0x1a')]);_0x10ae41[_0xd933('0x18')]=qs[_0xd933('0x18')](_0x255821[_0xd933('0x2d')][_0xd933('0x18')]);}return _0x2eb078[_0xd933('0x51')](_0x10ae41);}})[_0xd933('0x22')](function(_0x3e502f){if(_0x3e502f){return _0x3e502f?{'count':_0x572781,'rows':_0x3e502f}:null;}})[_0xd933('0x22')](respondWithResult(_0x486d1e,null))[_0xd933('0x40')](handleError(_0x486d1e,null));}; \ No newline at end of file +var _0x30d0=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','addConditions','Condition','ids','omit','findOne','order','getConditions','addActions','Action','getActions','hasOwnProperty','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','map','Automation','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','sort','pick','filter','merge','where'];(function(_0x55b3b5,_0x254983){var _0x5297a9=function(_0x5f302f){while(--_0x5f302f){_0x55b3b5['push'](_0x55b3b5['shift']());}};_0x5297a9(++_0x254983);}(_0x30d0,0x14c));var _0x030d=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x30d0[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x030d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x030d('0x1'));var BPromise=require(_0x030d('0x2'));var Mustache=require(_0x030d('0x3'));var util=require(_0x030d('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x030d('0x5'));var ejs=require(_0x030d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x030d('0x7'));var crypto=require('crypto');var jsforce=require(_0x030d('0x8'));var deskjs=require(_0x030d('0x9'));var toCsv=require(_0x030d('0x5'));var querystring=require(_0x030d('0xa'));var Papa=require(_0x030d('0xb'));var Redis=require(_0x030d('0xc'));var authService=require(_0x030d('0xd'));var qs=require(_0x030d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x030d('0xf'))('api');var utils=require(_0x030d('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x030d('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x832526,_0x39bbeb){_0x39bbeb=_0x39bbeb||0xcc;return function(_0x2f8937){if(_0x2f8937){return _0x832526['sendStatus'](_0x39bbeb);}return _0x832526[_0x030d('0x12')](_0x39bbeb)['end']();};}function respondWithResult(_0x334632,_0x49b36d){_0x49b36d=_0x49b36d||0xc8;return function(_0x381325){if(_0x381325){return _0x334632[_0x030d('0x12')](_0x49b36d)[_0x030d('0x13')](_0x381325);}};}function respondWithFilteredResult(_0x10f804,_0xc9ff7e){return function(_0x56d769){if(_0x56d769){var _0x20e140=typeof _0xc9ff7e[_0x030d('0x14')]===_0x030d('0x15')&&typeof _0xc9ff7e['limit']===_0x030d('0x15');var _0x58f5a9=_0x56d769[_0x030d('0x16')];var _0x647a19=_0x20e140?0x0:_0xc9ff7e[_0x030d('0x14')];var _0x1b310b=_0x20e140?_0x56d769['count']:_0xc9ff7e[_0x030d('0x14')]+_0xc9ff7e[_0x030d('0x17')];var _0x3518ab;if(_0x1b310b>=_0x58f5a9){_0x1b310b=_0x58f5a9;_0x3518ab=0xc8;}else{_0x3518ab=0xce;}_0x10f804[_0x030d('0x12')](_0x3518ab);return _0x10f804[_0x030d('0x18')](_0x030d('0x19'),_0x647a19+'-'+_0x1b310b+'/'+_0x58f5a9)['json'](_0x56d769);}return null;};}function patchUpdates(_0x256a6b){return function(_0x3b5922){try{jsonpatch[_0x030d('0x1a')](_0x3b5922,_0x256a6b,!![]);}catch(_0x5d9f22){return BPromise[_0x030d('0x1b')](_0x5d9f22);}return _0x3b5922['save']();};}function saveUpdates(_0x242ded,_0x3248f3){return function(_0x340c75){if(_0x340c75){return _0x340c75[_0x030d('0x1c')](_0x242ded)['then'](function(_0x318c9e){return _0x318c9e;});}return null;};}function removeEntity(_0x23e031,_0x5bfb02){return function(_0x37fc95){if(_0x37fc95){return _0x37fc95[_0x030d('0x1d')]()[_0x030d('0x1e')](function(){_0x23e031[_0x030d('0x12')](0xcc)[_0x030d('0x1f')]();});}};}function handleEntityNotFound(_0x379af8,_0x39b1b4){return function(_0x441b57){if(!_0x441b57){_0x379af8['sendStatus'](0x194);}return _0x441b57;};}function handleError(_0x33eea6,_0x534005){_0x534005=_0x534005||0x1f4;return function(_0x37c9c6){logger[_0x030d('0x20')](_0x37c9c6[_0x030d('0x21')]);if(_0x37c9c6[_0x030d('0x22')]){delete _0x37c9c6[_0x030d('0x22')];}_0x33eea6[_0x030d('0x12')](_0x534005)['send'](_0x37c9c6);};}exports['index']=function(_0x5ac0a5,_0x54f0e5){var _0x289b93={},_0x2d5ec6={},_0x1f5f02={'count':0x0,'rows':[]};var _0x392b85=_[_0x030d('0x23')](db[_0x030d('0x24')][_0x030d('0x25')],function(_0x2701e7){return{'name':_0x2701e7['fieldName'],'type':_0x2701e7[_0x030d('0x26')][_0x030d('0x27')]};});_0x2d5ec6[_0x030d('0x28')]=_['map'](_0x392b85,_0x030d('0x22'));_0x2d5ec6['query']=_['keys'](_0x5ac0a5['query']);_0x2d5ec6[_0x030d('0x29')]=_[_0x030d('0x2a')](_0x2d5ec6['model'],_0x2d5ec6[_0x030d('0x2b')]);_0x289b93[_0x030d('0x2c')]=_[_0x030d('0x2a')](_0x2d5ec6[_0x030d('0x28')],qs[_0x030d('0x2d')](_0x5ac0a5[_0x030d('0x2b')][_0x030d('0x2d')]));_0x289b93[_0x030d('0x2c')]=_0x289b93[_0x030d('0x2c')][_0x030d('0x2e')]?_0x289b93[_0x030d('0x2c')]:_0x2d5ec6[_0x030d('0x28')];if(!_0x5ac0a5[_0x030d('0x2b')]['hasOwnProperty'](_0x030d('0x2f'))){_0x289b93[_0x030d('0x17')]=qs['limit'](_0x5ac0a5[_0x030d('0x2b')][_0x030d('0x17')]);_0x289b93[_0x030d('0x14')]=qs['offset'](_0x5ac0a5[_0x030d('0x2b')][_0x030d('0x14')]);}_0x289b93['order']=qs[_0x030d('0x30')](_0x5ac0a5['query'][_0x030d('0x30')]);_0x289b93['where']=qs[_0x030d('0x29')](_[_0x030d('0x31')](_0x5ac0a5[_0x030d('0x2b')],_0x2d5ec6[_0x030d('0x29')]),_0x392b85);if(_0x5ac0a5[_0x030d('0x2b')][_0x030d('0x32')]){_0x289b93['where']=_[_0x030d('0x33')](_0x289b93[_0x030d('0x34')],{'$or':_[_0x030d('0x23')](_0x392b85,function(_0x361764){if(_0x361764[_0x030d('0x26')]!==_0x030d('0x35')){var _0x3a2310={};_0x3a2310[_0x361764['name']]={'$like':'%'+_0x5ac0a5['query'][_0x030d('0x32')]+'%'};return _0x3a2310;}})});}_0x289b93=_[_0x030d('0x33')]({},_0x289b93,_0x5ac0a5[_0x030d('0x36')]);var _0x16ed07={'where':_0x289b93[_0x030d('0x34')]};return db[_0x030d('0x24')]['count'](_0x16ed07)[_0x030d('0x1e')](function(_0x853316){_0x1f5f02[_0x030d('0x16')]=_0x853316;if(_0x5ac0a5[_0x030d('0x2b')][_0x030d('0x37')]){_0x289b93[_0x030d('0x38')]=[{'all':!![]}];}return db[_0x030d('0x24')][_0x030d('0x39')](_0x289b93);})[_0x030d('0x1e')](function(_0x56c8ce){_0x1f5f02[_0x030d('0x3a')]=_0x56c8ce;return _0x1f5f02;})[_0x030d('0x1e')](respondWithFilteredResult(_0x54f0e5,_0x289b93))[_0x030d('0x3b')](handleError(_0x54f0e5,null));};exports[_0x030d('0x3c')]=function(_0x4300a4,_0x259f22){var _0x1aadeb={'raw':![],'where':{'id':_0x4300a4[_0x030d('0x3d')]['id']}},_0x4b4a3d={};_0x4b4a3d[_0x030d('0x28')]=_[_0x030d('0x3e')](db['Automation'][_0x030d('0x25')]);_0x4b4a3d[_0x030d('0x2b')]=_[_0x030d('0x3e')](_0x4300a4[_0x030d('0x2b')]);_0x4b4a3d['filters']=_[_0x030d('0x2a')](_0x4b4a3d[_0x030d('0x28')],_0x4b4a3d[_0x030d('0x2b')]);_0x1aadeb[_0x030d('0x2c')]=_['intersection'](_0x4b4a3d[_0x030d('0x28')],qs[_0x030d('0x2d')](_0x4300a4[_0x030d('0x2b')][_0x030d('0x2d')]));_0x1aadeb['attributes']=_0x1aadeb[_0x030d('0x2c')]['length']?_0x1aadeb[_0x030d('0x2c')]:_0x4b4a3d['model'];if(_0x4300a4[_0x030d('0x2b')][_0x030d('0x37')]){_0x1aadeb['include']=[{'all':!![]}];}_0x1aadeb=_[_0x030d('0x33')]({},_0x1aadeb,_0x4300a4['options']);return db[_0x030d('0x24')]['find'](_0x1aadeb)[_0x030d('0x1e')](handleEntityNotFound(_0x259f22,null))[_0x030d('0x1e')](respondWithResult(_0x259f22,null))[_0x030d('0x3b')](handleError(_0x259f22,null));};exports['create']=function(_0x17cda2,_0x5b4321){return db[_0x030d('0x24')][_0x030d('0x3f')](_0x17cda2[_0x030d('0x40')],{})[_0x030d('0x1e')](respondWithResult(_0x5b4321,0xc9))[_0x030d('0x3b')](handleError(_0x5b4321,null));};exports[_0x030d('0x1c')]=function(_0x504095,_0x55ae27){if(_0x504095['body']['id']){delete _0x504095[_0x030d('0x40')]['id'];}return db[_0x030d('0x24')][_0x030d('0x41')]({'where':{'id':_0x504095[_0x030d('0x3d')]['id']}})[_0x030d('0x1e')](handleEntityNotFound(_0x55ae27,null))[_0x030d('0x1e')](saveUpdates(_0x504095[_0x030d('0x40')],null))[_0x030d('0x1e')](respondWithResult(_0x55ae27,null))[_0x030d('0x3b')](handleError(_0x55ae27,null));};exports[_0x030d('0x1d')]=function(_0x5dccff,_0x426500){return db['Automation'][_0x030d('0x41')]({'where':{'id':_0x5dccff[_0x030d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x426500,null))[_0x030d('0x1e')](removeEntity(_0x426500,null))[_0x030d('0x3b')](handleError(_0x426500,null));};exports[_0x030d('0x42')]=function(_0x1b8f30,_0x433837,_0x5f1cde){return db[_0x030d('0x43')][_0x030d('0x41')]({'where':{'id':_0x1b8f30[_0x030d('0x3d')]['id']}})[_0x030d('0x1e')](handleEntityNotFound(_0x433837,null))[_0x030d('0x1e')](function(_0x433be6){if(_0x433be6){return _0x433be6[_0x030d('0x42')](_0x1b8f30[_0x030d('0x40')][_0x030d('0x44')],_[_0x030d('0x45')](_0x1b8f30[_0x030d('0x40')],[_0x030d('0x44'),'id'])||{});}})[_0x030d('0x1e')](respondWithResult(_0x433837,null))[_0x030d('0x3b')](handleError(_0x433837,null));};exports['getConditions']=function(_0x48e31a,_0x3c9ccf,_0x2e18e0){var _0x59f7c8={};var _0x207cf5={};var _0x436f21;var _0x341367;return db[_0x030d('0x24')][_0x030d('0x46')]({'where':{'id':_0x48e31a[_0x030d('0x3d')]['id']}})[_0x030d('0x1e')](handleEntityNotFound(_0x3c9ccf,null))[_0x030d('0x1e')](function(_0x4258c8){if(_0x4258c8){_0x436f21=_0x4258c8;_0x207cf5[_0x030d('0x28')]=_[_0x030d('0x3e')](db[_0x030d('0x43')][_0x030d('0x25')]);_0x207cf5['query']=_['keys'](_0x48e31a[_0x030d('0x2b')]);_0x207cf5[_0x030d('0x29')]=_[_0x030d('0x2a')](_0x207cf5[_0x030d('0x28')],_0x207cf5[_0x030d('0x2b')]);_0x59f7c8[_0x030d('0x2c')]=_[_0x030d('0x2a')](_0x207cf5[_0x030d('0x28')],qs['fields'](_0x48e31a['query'][_0x030d('0x2d')]));_0x59f7c8[_0x030d('0x2c')]=_0x59f7c8[_0x030d('0x2c')][_0x030d('0x2e')]?_0x59f7c8[_0x030d('0x2c')]:_0x207cf5[_0x030d('0x28')];_0x59f7c8[_0x030d('0x47')]=qs[_0x030d('0x30')](_0x48e31a[_0x030d('0x2b')][_0x030d('0x30')]);_0x59f7c8[_0x030d('0x34')]=qs['filters'](_[_0x030d('0x31')](_0x48e31a['query'],_0x207cf5['filters']));if(_0x48e31a[_0x030d('0x2b')][_0x030d('0x32')]){_0x59f7c8[_0x030d('0x34')]=_[_0x030d('0x33')](_0x59f7c8[_0x030d('0x34')],{'$or':_['map'](_0x59f7c8[_0x030d('0x2c')],function(_0x3136e8){var _0xc4ec18={};_0xc4ec18[_0x3136e8]={'$like':'%'+_0x48e31a[_0x030d('0x2b')][_0x030d('0x32')]+'%'};return _0xc4ec18;})});}_0x59f7c8=_[_0x030d('0x33')]({},_0x59f7c8,_0x48e31a['options']);return _0x436f21[_0x030d('0x48')](_0x59f7c8);}})[_0x030d('0x1e')](function(_0x357cba){if(_0x357cba){_0x341367=_0x357cba[_0x030d('0x2e')];if(!_0x48e31a[_0x030d('0x2b')]['hasOwnProperty'](_0x030d('0x2f'))){_0x59f7c8[_0x030d('0x17')]=qs[_0x030d('0x17')](_0x48e31a[_0x030d('0x2b')][_0x030d('0x17')]);_0x59f7c8[_0x030d('0x14')]=qs[_0x030d('0x14')](_0x48e31a[_0x030d('0x2b')][_0x030d('0x14')]);}return _0x436f21[_0x030d('0x48')](_0x59f7c8);}})[_0x030d('0x1e')](function(_0x5e38ea){if(_0x5e38ea){return _0x5e38ea?{'count':_0x341367,'rows':_0x5e38ea}:null;}})[_0x030d('0x1e')](respondWithResult(_0x3c9ccf,null))['catch'](handleError(_0x3c9ccf,null));};exports[_0x030d('0x49')]=function(_0x34bb23,_0x137e74,_0xeb7974){return db[_0x030d('0x4a')][_0x030d('0x41')]({'where':{'id':_0x34bb23['params']['id']}})[_0x030d('0x1e')](handleEntityNotFound(_0x137e74,null))['then'](function(_0x233f39){if(_0x233f39){return _0x233f39[_0x030d('0x49')](_0x34bb23[_0x030d('0x40')][_0x030d('0x44')],_[_0x030d('0x45')](_0x34bb23[_0x030d('0x40')],[_0x030d('0x44'),'id'])||{});}})[_0x030d('0x1e')](respondWithResult(_0x137e74,null))[_0x030d('0x3b')](handleError(_0x137e74,null));};exports['getActions']=function(_0x2db283,_0x2b4a6b,_0x332b7c){var _0x2fb521={};var _0x53bb45={};var _0x394cd6;var _0xd6db43;return db[_0x030d('0x24')][_0x030d('0x46')]({'where':{'id':_0x2db283['params']['id']}})[_0x030d('0x1e')](handleEntityNotFound(_0x2b4a6b,null))[_0x030d('0x1e')](function(_0x18304d){if(_0x18304d){_0x394cd6=_0x18304d;_0x53bb45[_0x030d('0x28')]=_[_0x030d('0x3e')](db[_0x030d('0x4a')][_0x030d('0x25')]);_0x53bb45[_0x030d('0x2b')]=_[_0x030d('0x3e')](_0x2db283['query']);_0x53bb45['filters']=_[_0x030d('0x2a')](_0x53bb45[_0x030d('0x28')],_0x53bb45[_0x030d('0x2b')]);_0x2fb521['attributes']=_['intersection'](_0x53bb45['model'],qs[_0x030d('0x2d')](_0x2db283['query']['fields']));_0x2fb521[_0x030d('0x2c')]=_0x2fb521[_0x030d('0x2c')][_0x030d('0x2e')]?_0x2fb521[_0x030d('0x2c')]:_0x53bb45[_0x030d('0x28')];_0x2fb521[_0x030d('0x47')]=qs[_0x030d('0x30')](_0x2db283[_0x030d('0x2b')][_0x030d('0x30')]);_0x2fb521['where']=qs['filters'](_[_0x030d('0x31')](_0x2db283[_0x030d('0x2b')],_0x53bb45['filters']));if(_0x2db283['query'][_0x030d('0x32')]){_0x2fb521['where']=_[_0x030d('0x33')](_0x2fb521[_0x030d('0x34')],{'$or':_[_0x030d('0x23')](_0x2fb521[_0x030d('0x2c')],function(_0x5c5862){var _0x57df64={};_0x57df64[_0x5c5862]={'$like':'%'+_0x2db283[_0x030d('0x2b')][_0x030d('0x32')]+'%'};return _0x57df64;})});}_0x2fb521=_['merge']({},_0x2fb521,_0x2db283[_0x030d('0x36')]);return _0x394cd6[_0x030d('0x4b')](_0x2fb521);}})['then'](function(_0x3502c6){if(_0x3502c6){_0xd6db43=_0x3502c6[_0x030d('0x2e')];if(!_0x2db283[_0x030d('0x2b')][_0x030d('0x4c')]('nolimit')){_0x2fb521[_0x030d('0x17')]=qs[_0x030d('0x17')](_0x2db283[_0x030d('0x2b')][_0x030d('0x17')]);_0x2fb521['offset']=qs[_0x030d('0x14')](_0x2db283['query'][_0x030d('0x14')]);}return _0x394cd6[_0x030d('0x4b')](_0x2fb521);}})[_0x030d('0x1e')](function(_0x1e3988){if(_0x1e3988){return _0x1e3988?{'count':_0xd6db43,'rows':_0x1e3988}:null;}})[_0x030d('0x1e')](respondWithResult(_0x2b4a6b,null))[_0x030d('0x3b')](handleError(_0x2b4a6b,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2e3c466..fbc1389 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 _0x0e04=['api','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x0e04,0x1de));var _0x40e0=function(_0x2d80be,_0xe94d2f){_0x2d80be=_0x2d80be-0x0;var _0x501350=_0x0e04[_0x2d80be];return _0x501350;};'use strict';var _=require(_0x40e0('0x0'));var util=require(_0x40e0('0x1'));var logger=require(_0x40e0('0x2'))(_0x40e0('0x3'));var moment=require('moment');var BPromise=require(_0x40e0('0x4'));var rp=require(_0x40e0('0x5'));var fs=require('fs');var path=require(_0x40e0('0x6'));var rimraf=require('rimraf');var config=require(_0x40e0('0x7'));var attributes=require(_0x40e0('0x8'));module[_0x40e0('0x9')]=function(_0x1b0f49,_0x46f17c){return _0x1b0f49[_0x40e0('0xa')](_0x40e0('0xb'),attributes,{'tableName':_0x40e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaf0=['../../config/environment','./automation.attributes','define','Automation','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x2692a9,_0x449c0f){var _0x569506=function(_0x56e4d9){while(--_0x56e4d9){_0x2692a9['push'](_0x2692a9['shift']());}};_0x569506(++_0x449c0f);}(_0xdaf0,0x1a6));var _0x0daf=function(_0x5538ba,_0x1f8e52){_0x5538ba=_0x5538ba-0x0;var _0x23e505=_0xdaf0[_0x5538ba];return _0x23e505;};'use strict';var _=require(_0x0daf('0x0'));var util=require(_0x0daf('0x1'));var logger=require(_0x0daf('0x2'))(_0x0daf('0x3'));var moment=require('moment');var BPromise=require(_0x0daf('0x4'));var rp=require(_0x0daf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0daf('0x6'));var config=require(_0x0daf('0x7'));var attributes=require(_0x0daf('0x8'));module['exports']=function(_0x3bc622,_0x11ceb1){return _0x3bc622[_0x0daf('0x9')](_0x0daf('0xa'),attributes,{'tableName':'tools_automations','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 e420326..47ad58d 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 _0x07a2=['error','Automation,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','stringify'];(function(_0x66dd23,_0x3db67f){var _0x5d0c36=function(_0x7191bb){while(--_0x7191bb){_0x66dd23['push'](_0x66dd23['shift']());}};_0x5d0c36(++_0x3db67f);}(_0x07a2,0x12c));var _0x207a=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x07a2[_0x25662e];return _0x59b7bc;};'use strict';var _=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var moment=require('moment');var BPromise=require(_0x207a('0x2'));var rs=require(_0x207a('0x3'));var fs=require('fs');var Redis=require(_0x207a('0x4'));var db=require(_0x207a('0x5'))['db'];var utils=require(_0x207a('0x6'));var logger=require(_0x207a('0x7'))(_0x207a('0x8'));var config=require(_0x207a('0x9'));var jayson=require(_0x207a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18dddc,_0x15d085,_0x7be81c){return new BPromise(function(_0x2a0b70,_0x55412c){return client[_0x207a('0xb')](_0x18dddc,_0x7be81c)['then'](function(_0x5201fe){logger[_0x207a('0xc')]('Automation,\x20%s,\x20%s',_0x15d085,'request\x20sent');logger[_0x207a('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x15d085,'request\x20sent',JSON[_0x207a('0xe')](_0x5201fe));if(_0x5201fe[_0x207a('0xf')]){if(_0x5201fe[_0x207a('0xf')]['code']===0x1f4){logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0x5201fe[_0x207a('0xf')]['message']);return _0x55412c(_0x5201fe[_0x207a('0xf')][_0x207a('0x11')]);}logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0x5201fe[_0x207a('0xf')]['message']);return _0x2a0b70(_0x5201fe[_0x207a('0xf')]['message']);}else{logger[_0x207a('0xc')](_0x207a('0x10'),_0x15d085,_0x207a('0x12'));_0x2a0b70(_0x5201fe[_0x207a('0x13')][_0x207a('0x11')]);}})[_0x207a('0x14')](function(_0xd60aa3){logger[_0x207a('0xf')](_0x207a('0x10'),_0x15d085,_0xd60aa3);_0x55412c(_0xd60aa3);});});} \ No newline at end of file +var _0x1189=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash'];(function(_0x582a30,_0x290a19){var _0x589aca=function(_0xf950ad){while(--_0xf950ad){_0x582a30['push'](_0x582a30['shift']());}};_0x589aca(++_0x290a19);}(_0x1189,0x17f));var _0x9118=function(_0x519bbd,_0xac8b92){_0x519bbd=_0x519bbd-0x0;var _0x4dfc8a=_0x1189[_0x519bbd];return _0x4dfc8a;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var moment=require(_0x9118('0x2'));var BPromise=require(_0x9118('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9118('0x4'));var db=require(_0x9118('0x5'))['db'];var utils=require(_0x9118('0x6'));var logger=require(_0x9118('0x7'))(_0x9118('0x8'));var config=require(_0x9118('0x9'));var jayson=require(_0x9118('0xa'));var client=jayson['client'][_0x9118('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x370bec,_0x21251a,_0x3df1a3){return new BPromise(function(_0x37e930,_0xad3e6e){return client['request'](_0x370bec,_0x3df1a3)[_0x9118('0xc')](function(_0x227eea){logger[_0x9118('0xd')](_0x9118('0xe'),_0x21251a,_0x9118('0xf'));logger[_0x9118('0x10')](_0x9118('0x11'),_0x21251a,'request\x20sent',JSON[_0x9118('0x12')](_0x227eea));if(_0x227eea['error']){if(_0x227eea['error'][_0x9118('0x13')]===0x1f4){logger[_0x9118('0x14')]('Automation,\x20%s,\x20%s',_0x21251a,_0x227eea[_0x9118('0x14')][_0x9118('0x15')]);return _0xad3e6e(_0x227eea[_0x9118('0x14')][_0x9118('0x15')]);}logger[_0x9118('0x14')](_0x9118('0xe'),_0x21251a,_0x227eea[_0x9118('0x14')][_0x9118('0x15')]);return _0x37e930(_0x227eea[_0x9118('0x14')][_0x9118('0x15')]);}else{logger[_0x9118('0xd')]('Automation,\x20%s,\x20%s',_0x21251a,'request\x20sent');_0x37e930(_0x227eea[_0x9118('0x16')]['message']);}})[_0x9118('0x17')](function(_0x1ff727){logger[_0x9118('0x14')](_0x9118('0xe'),_0x21251a,_0x1ff727);_0xad3e6e(_0x1ff727);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index adef0e0..de77156 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 _0x6548=['exports','multer','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','create','post','addConditions','addActions','destroy'];(function(_0xfdc30f,_0xe7a613){var _0x176cae=function(_0x24d171){while(--_0x24d171){_0xfdc30f['push'](_0xfdc30f['shift']());}};_0x176cae(++_0xe7a613);}(_0x6548,0x133));var _0x8654=function(_0x5c8fd0,_0x560ba2){_0x5c8fd0=_0x5c8fd0-0x0;var _0x84cbbd=_0x6548[_0x5c8fd0];return _0x84cbbd;};'use strict';var multer=require(_0x8654('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8654('0x1'));var express=require(_0x8654('0x2'));var router=express[_0x8654('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8654('0x4'));var controller=require('./automation.controller');router[_0x8654('0x5')]('/',auth[_0x8654('0x6')](),controller[_0x8654('0x7')]);router[_0x8654('0x5')](_0x8654('0x8'),auth[_0x8654('0x6')](),controller[_0x8654('0x9')]);router['get'](_0x8654('0xa'),auth[_0x8654('0x6')](),controller['getConditions']);router[_0x8654('0x5')](_0x8654('0xb'),auth[_0x8654('0x6')](),controller['getActions']);router['post']('/',auth[_0x8654('0x6')](),controller[_0x8654('0xc')]);router[_0x8654('0xd')](_0x8654('0xa'),auth['isAuthenticated'](),controller[_0x8654('0xe')]);router[_0x8654('0xd')](_0x8654('0xb'),auth['isAuthenticated'](),controller[_0x8654('0xf')]);router['put'](_0x8654('0x8'),auth[_0x8654('0x6')](),controller['update']);router['delete']('/:id',auth[_0x8654('0x6')](),controller[_0x8654('0x10')]);module[_0x8654('0x11')]=router; \ No newline at end of file +var _0x808a=['destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','/:id/conditions','getConditions','isAuthenticated','getActions','post','create','/:id/actions','addActions','put','update','delete'];(function(_0x51b47a,_0x57e8dc){var _0x2ab6a4=function(_0x170fa0){while(--_0x170fa0){_0x51b47a['push'](_0x51b47a['shift']());}};_0x2ab6a4(++_0x57e8dc);}(_0x808a,0x1b7));var _0xa808=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0x808a[_0xcfc44];return _0x307a25;};'use strict';var multer=require(_0xa808('0x0'));var util=require(_0xa808('0x1'));var path=require(_0xa808('0x2'));var timeout=require(_0xa808('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa808('0x4'));var config=require(_0xa808('0x5'));var controller=require(_0xa808('0x6'));router[_0xa808('0x7')]('/',auth['isAuthenticated'](),controller[_0xa808('0x8')]);router[_0xa808('0x7')](_0xa808('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xa808('0x7')](_0xa808('0xa'),auth['isAuthenticated'](),controller[_0xa808('0xb')]);router['get']('/:id/actions',auth[_0xa808('0xc')](),controller[_0xa808('0xd')]);router[_0xa808('0xe')]('/',auth[_0xa808('0xc')](),controller[_0xa808('0xf')]);router[_0xa808('0xe')](_0xa808('0xa'),auth[_0xa808('0xc')](),controller['addConditions']);router['post'](_0xa808('0x10'),auth[_0xa808('0xc')](),controller[_0xa808('0x11')]);router[_0xa808('0x12')](_0xa808('0x9'),auth['isAuthenticated'](),controller[_0xa808('0x13')]);router[_0xa808('0x14')]('/:id',auth[_0xa808('0xc')](),controller[_0xa808('0x15')]);module[_0xa808('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 8901548..9000121 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 _0x9bee=['#Congestion\x20Retry\x20(min:1,\x20max:999)','INTEGER','#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','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#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)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9bee,0xfa));var _0xe9be=function(_0x27fa44,_0x148336){_0x27fa44=_0x27fa44-0x0;var _0x563a16=_0x9bee[_0x27fa44];return _0x563a16;};'use strict';var Sequelize=require(_0xe9be('0x0'));module[_0xe9be('0x1')]={'name':{'type':Sequelize[_0xe9be('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xe9be('0x3')](_0xe9be('0x4')),'allowNull':![],'defaultValue':_0xe9be('0x4')},'description':{'type':Sequelize[_0xe9be('0x2')]},'active':{'type':Sequelize[_0xe9be('0x5')],'defaultValue':0x0,'comment':_0xe9be('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xe9be('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe9be('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'defaultValue':0x3,'comment':_0xe9be('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe9be('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe9be('0x2')],'defaultValue':_0xe9be('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xe9be('0x3')](_0xe9be('0x11'),_0xe9be('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xe9be('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe9be('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe9be('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe9be('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe9be('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe9be('0xa')](0x9)[_0xe9be('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe9be('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe9be('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe9be('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe9be('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xe9be('0x19')),'defaultValue':_0xe9be('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe9be('0x1b')},'dialCutDigit':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)[_0xe9be('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe9be('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe9be('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe9be('0xa')](0x5)[_0xe9be('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe9be('0x24')}}; \ No newline at end of file +var _0x4fe1=['#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)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#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)'];(function(_0x5e2595,_0x3031c6){var _0x25add1=function(_0x1c704b){while(--_0x1c704b){_0x5e2595['push'](_0x5e2595['shift']());}};_0x25add1(++_0x3031c6);}(_0x4fe1,0xa8));var _0x14fe=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x4fe1[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x14fe('0x0'));module[_0x14fe('0x1')]={'name':{'type':Sequelize[_0x14fe('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x14fe('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x14fe('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x14fe('0x4')](0x4)[_0x14fe('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x14fe('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x14fe('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x14fe('0x4')](0x3)[_0x14fe('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x14fe('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14fe('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x14fe('0x4')](0x5)[_0x14fe('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x14fe('0x4')](0x3)[_0x14fe('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x14fe('0x4')](0x5)[_0x14fe('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14fe('0x8')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x14fe('0x4')](0x3)[_0x14fe('0x5')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14fe('0x9')},'dialGlobalMaxRetry':{'type':Sequelize[_0x14fe('0x4')](0x3)[_0x14fe('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x14fe('0xa')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x14fe('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x14fe('0xb'),_0x14fe('0xc')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x14fe('0xd')],'defaultValue':0x0,'comment':_0x14fe('0xe')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x14fe('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x14fe('0xf')},'dialAMDGreeting':{'type':Sequelize[_0x14fe('0x4')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x14fe('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x14fe('0x4')](0x9)[_0x14fe('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x14fe('0x4')](0x9)[_0x14fe('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x14fe('0x11')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x14fe('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x14fe('0x12')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x14fe('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x14fe('0x4')](0x5)[_0x14fe('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x14fe('0x13')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x14fe('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x14fe('0x14')},'dialOrderByScheduledAt':{'type':Sequelize[_0x14fe('0x3')]('DESC',_0x14fe('0x15')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x14fe('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x14fe('0x4')](0x3)[_0x14fe('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x14fe('0x16')},'dialCutDigit':{'type':Sequelize[_0x14fe('0x4')](0x3)[_0x14fe('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x14fe('0x17')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x14fe('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14fe('0x18')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x14fe('0x4')](0x5)[_0x14fe('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14fe('0x19')},'dialDropMaxRetry':{'type':Sequelize[_0x14fe('0x4')](0x3)[_0x14fe('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x14fe('0x4')](0x5)[_0x14fe('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14fe('0x1a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x14fe('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14fe('0x1b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x14fe('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14fe('0x1c')},'dialMachineMaxRetry':{'type':Sequelize[_0x14fe('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x14fe('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x14fe('0x4')](0x5)[_0x14fe('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14fe('0x1e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x14fe('0x4')](0x3)[_0x14fe('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x14fe('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x14fe('0x1f')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 23eed1e..9ece807 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 _0xc273=['h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','apply','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','Campaign','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','merge','updatedAt','createdAt','IvrCampaigns','autoAssociation','getHoppers','findOne','pick','CampaignId','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','omit','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','field','NOW()','ContactId','CmListId','toString','ListId','from','cm_contacts','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0xc273,0x137));var _0x3c27=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0xc273[_0x51d129];return _0x44c377;};'use strict';var emlformat=require(_0x3c27('0x0'));var rimraf=require(_0x3c27('0x1'));var zipdir=require(_0x3c27('0x2'));var jsonpatch=require(_0x3c27('0x3'));var rp=require(_0x3c27('0x4'));var moment=require(_0x3c27('0x5'));var BPromise=require(_0x3c27('0x6'));var Mustache=require(_0x3c27('0x7'));var util=require(_0x3c27('0x8'));var path=require(_0x3c27('0x9'));var sox=require('sox');var csv=require(_0x3c27('0xa'));var ejs=require(_0x3c27('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c27('0xc'));var squel=require(_0x3c27('0xd'));var crypto=require(_0x3c27('0xe'));var jsforce=require(_0x3c27('0xf'));var deskjs=require(_0x3c27('0x10'));var toCsv=require(_0x3c27('0xa'));var querystring=require(_0x3c27('0x11'));var Papa=require(_0x3c27('0x12'));var Redis=require(_0x3c27('0x13'));var authService=require(_0x3c27('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3c27('0x15'));var hardwareService=require(_0x3c27('0x16'));var logger=require(_0x3c27('0x17'))(_0x3c27('0x18'));var utils=require('../../config/utils');var config=require(_0x3c27('0x19'));var licenseUtil=require(_0x3c27('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24fe22,_0x529147){_0x529147=_0x529147||0xcc;return function(_0x5da394){if(_0x5da394){return _0x24fe22[_0x3c27('0x1b')](_0x529147);}return _0x24fe22['status'](_0x529147)['end']();};}function respondWithResult(_0x463db0,_0x169a85){_0x169a85=_0x169a85||0xc8;return function(_0x1359d5){if(_0x1359d5){return _0x463db0[_0x3c27('0x1c')](_0x169a85)['json'](_0x1359d5);}};}function respondWithFilteredResult(_0x326314,_0x44c9d1){return function(_0x15d97e){if(_0x15d97e){var _0x5db456=typeof _0x44c9d1[_0x3c27('0x1d')]===_0x3c27('0x1e')&&typeof _0x44c9d1[_0x3c27('0x1f')]==='undefined';var _0x5f4b4f=_0x15d97e[_0x3c27('0x20')];var _0x21a214=_0x5db456?0x0:_0x44c9d1[_0x3c27('0x1d')];var _0x4526eb=_0x5db456?_0x15d97e[_0x3c27('0x20')]:_0x44c9d1[_0x3c27('0x1d')]+_0x44c9d1[_0x3c27('0x1f')];var _0x5d8f36;if(_0x4526eb>=_0x5f4b4f){_0x4526eb=_0x5f4b4f;_0x5d8f36=0xc8;}else{_0x5d8f36=0xce;}_0x326314[_0x3c27('0x1c')](_0x5d8f36);return _0x326314[_0x3c27('0x21')]('Content-Range',_0x21a214+'-'+_0x4526eb+'/'+_0x5f4b4f)[_0x3c27('0x22')](_0x15d97e);}return null;};}function patchUpdates(_0x2d0d9a){return function(_0x1e2b8f){try{jsonpatch[_0x3c27('0x23')](_0x1e2b8f,_0x2d0d9a,!![]);}catch(_0x1d9c90){return BPromise['reject'](_0x1d9c90);}return _0x1e2b8f['save']();};}function saveUpdates(_0x5826ea,_0x4130d4){return function(_0x27a218){if(_0x27a218){return _0x27a218[_0x3c27('0x24')](_0x5826ea)[_0x3c27('0x25')](function(_0x367c61){return _0x367c61;});}return null;};}function removeEntity(_0x4cfd76,_0x254084){return function(_0x1a3dd7){if(_0x1a3dd7){return _0x1a3dd7[_0x3c27('0x26')]()['then'](function(){var _0x53de8d=_0x1a3dd7[_0x3c27('0x27')]({'plain':!![]});var _0x534917='IvrCampaigns';return db[_0x3c27('0x28')][_0x3c27('0x26')]({'where':{'type':_0x534917,'resourceId':_0x53de8d['id']}})[_0x3c27('0x25')](function(){return _0x1a3dd7;});})[_0x3c27('0x25')](function(){_0x4cfd76[_0x3c27('0x1c')](0xcc)[_0x3c27('0x29')]();});}};}function handleEntityNotFound(_0x581093,_0x49946e){return function(_0x1eb103){if(!_0x1eb103){_0x581093[_0x3c27('0x1b')](0x194);}return _0x1eb103;};}function handleError(_0x305f96,_0x1436e4){_0x1436e4=_0x1436e4||0x1f4;return function(_0x3376b6){logger[_0x3c27('0x2a')](_0x3376b6[_0x3c27('0x2b')]);if(_0x3376b6[_0x3c27('0x2c')]){delete _0x3376b6[_0x3c27('0x2c')];}_0x305f96[_0x3c27('0x1c')](_0x1436e4)[_0x3c27('0x2d')](_0x3376b6);};}exports[_0x3c27('0x2e')]=function(_0x2f04e9,_0x5c709a){var _0x3b458c={},_0x23444b={},_0x301473={'count':0x0,'rows':[]};var _0x2261e9=_[_0x3c27('0x2f')](db['Campaign'][_0x3c27('0x30')],function(_0x16cdfc){return{'name':_0x16cdfc['fieldName'],'type':_0x16cdfc[_0x3c27('0x31')][_0x3c27('0x32')]};});_0x23444b[_0x3c27('0x33')]=_[_0x3c27('0x2f')](_0x2261e9,_0x3c27('0x2c'));_0x23444b['query']=_[_0x3c27('0x34')](_0x2f04e9['query']);_0x23444b[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0x23444b[_0x3c27('0x33')],_0x23444b[_0x3c27('0x37')]);_0x3b458c['attributes']=_[_0x3c27('0x36')](_0x23444b[_0x3c27('0x33')],qs['fields'](_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x38')]));_0x3b458c[_0x3c27('0x39')]=_0x3b458c[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x3b458c[_0x3c27('0x39')]:_0x23444b[_0x3c27('0x33')];if(!_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x3b')](_0x3c27('0x3c'))){_0x3b458c[_0x3c27('0x1f')]=qs[_0x3c27('0x1f')](_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x1f')]);_0x3b458c[_0x3c27('0x1d')]=qs['offset'](_0x2f04e9[_0x3c27('0x37')]['offset']);}_0x3b458c[_0x3c27('0x3d')]=qs['sort'](_0x2f04e9['query'][_0x3c27('0x3e')]);_0x3b458c['where']=qs['filters'](_['pick'](_0x2f04e9[_0x3c27('0x37')],_0x23444b[_0x3c27('0x35')]),_0x2261e9);if(_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x3f')]){_0x3b458c[_0x3c27('0x40')]=_['merge'](_0x3b458c[_0x3c27('0x40')],{'$or':_[_0x3c27('0x2f')](_0x2261e9,function(_0x2ed7af){if(_0x2ed7af[_0x3c27('0x31')]!==_0x3c27('0x41')){var _0x5a882f={};_0x5a882f[_0x2ed7af[_0x3c27('0x2c')]]={'$like':'%'+_0x2f04e9[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x5a882f;}})});}_0x3b458c=_['merge']({},_0x3b458c,_0x2f04e9['options']);var _0x1285c8={'where':_0x3b458c[_0x3c27('0x40')]};return db['Campaign'][_0x3c27('0x20')](_0x1285c8)[_0x3c27('0x25')](function(_0x12f756){_0x301473[_0x3c27('0x20')]=_0x12f756;if(_0x2f04e9[_0x3c27('0x37')]['includeAll']){_0x3b458c['include']=[{'all':!![]}];}return db[_0x3c27('0x42')][_0x3c27('0x43')](_0x3b458c);})[_0x3c27('0x25')](function(_0x1b4e2a){_0x301473['rows']=_0x1b4e2a;return _0x301473;})[_0x3c27('0x25')](respondWithFilteredResult(_0x5c709a,_0x3b458c))[_0x3c27('0x44')](handleError(_0x5c709a,null));};exports[_0x3c27('0x45')]=function(_0x4ed145,_0xdc70cd){var _0x2e05c4={'raw':![],'where':{'id':_0x4ed145[_0x3c27('0x46')]['id']}},_0x280bf9={};_0x280bf9['model']=_[_0x3c27('0x34')](db[_0x3c27('0x42')][_0x3c27('0x30')]);_0x280bf9['query']=_[_0x3c27('0x34')](_0x4ed145[_0x3c27('0x37')]);_0x280bf9[_0x3c27('0x35')]=_['intersection'](_0x280bf9[_0x3c27('0x33')],_0x280bf9[_0x3c27('0x37')]);_0x2e05c4['attributes']=_[_0x3c27('0x36')](_0x280bf9[_0x3c27('0x33')],qs[_0x3c27('0x38')](_0x4ed145['query'][_0x3c27('0x38')]));_0x2e05c4[_0x3c27('0x39')]=_0x2e05c4[_0x3c27('0x39')]['length']?_0x2e05c4[_0x3c27('0x39')]:_0x280bf9[_0x3c27('0x33')];if(_0x4ed145['query']['includeAll']){_0x2e05c4[_0x3c27('0x47')]=[{'all':!![]}];}_0x2e05c4=_['merge']({},_0x2e05c4,_0x4ed145[_0x3c27('0x48')]);return db[_0x3c27('0x42')][_0x3c27('0x49')](_0x2e05c4)[_0x3c27('0x25')](handleEntityNotFound(_0xdc70cd,null))['then'](respondWithResult(_0xdc70cd,null))[_0x3c27('0x44')](handleError(_0xdc70cd,null));};exports[_0x3c27('0x4a')]=function(_0x5d5038,_0xb824c7){return db[_0x3c27('0x42')][_0x3c27('0x4a')](_0x5d5038[_0x3c27('0x4b')],{})[_0x3c27('0x25')](function(_0x973f06){var _0x548bed=_0x5d5038[_0x3c27('0x4c')][_0x3c27('0x27')]({'plain':!![]});if(!_0x548bed)throw new Error(_0x3c27('0x4d'));if(_0x548bed['role']===_0x3c27('0x4c')){var _0x251d88=_0x973f06['get']({'plain':!![]});var _0x19d5a0='IvrCampaigns';return db[_0x3c27('0x4e')]['find']({'where':{'name':_0x19d5a0,'userProfileId':_0x548bed[_0x3c27('0x4f')]},'raw':!![]})['then'](function(_0x35ade2){if(_0x35ade2&&_0x35ade2['autoAssociation']===0x0){return db[_0x3c27('0x28')][_0x3c27('0x4a')]({'name':_0x251d88[_0x3c27('0x2c')],'resourceId':_0x251d88['id'],'type':_0x35ade2['name'],'sectionId':_0x35ade2['id']},{})['then'](function(){return _0x973f06;});}else{return _0x973f06;}})[_0x3c27('0x44')](function(_0x1b9ac4){logger[_0x3c27('0x2a')](_0x3c27('0x50'),_0x1b9ac4);throw _0x1b9ac4;});}return _0x973f06;})[_0x3c27('0x25')](respondWithResult(_0xb824c7,0xc9))['catch'](handleError(_0xb824c7,null));};exports[_0x3c27('0x51')]=function(_0x4336a4,_0x93f3af){var _0x4b2640={'where':{'id':_0x4336a4[_0x3c27('0x46')]['id']}},_0x3e8f55={};_0x3e8f55[_0x3c27('0x33')]=_[_0x3c27('0x34')](db[_0x3c27('0x42')]['rawAttributes']);_0x4b2640[_0x3c27('0x39')]=_[_0x3c27('0x36')](_0x3e8f55[_0x3c27('0x33')],qs['fields'](_0x4336a4[_0x3c27('0x37')][_0x3c27('0x38')]));_0x4b2640[_0x3c27('0x39')]=_0x4b2640[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x4b2640['attributes']:_0x3e8f55['model'];if(_0x4336a4[_0x3c27('0x37')][_0x3c27('0x52')]){_0x4b2640[_0x3c27('0x47')]=[{'all':!![]}];}_0x4b2640=_[_0x3c27('0x53')]({},_0x4b2640,_0x4336a4[_0x3c27('0x48')]);return db[_0x3c27('0x42')]['find'](_0x4b2640)[_0x3c27('0x25')](handleEntityNotFound(_0x93f3af,null))[_0x3c27('0x25')](function(_0x58a67e){if(_0x58a67e){var _0x15cb98=_0x58a67e[_0x3c27('0x27')]({'plain':!![]});_0x15cb98=qs['omit'](_0x15cb98,['id','createdAt',_0x3c27('0x54')]);_0x4336a4['body']=_['omit'](_0x4336a4[_0x3c27('0x4b')],['id',_0x3c27('0x55'),_0x3c27('0x54')]);return db[_0x3c27('0x42')][_0x3c27('0x4a')](_[_0x3c27('0x53')](_0x15cb98,_0x4336a4[_0x3c27('0x4b')]),{'include':_0x4336a4[_0x3c27('0x37')][_0x3c27('0x52')]?[{'all':!![]}]:undefined})[_0x3c27('0x25')](function(_0x3048f8){var _0x366dc9=_0x4336a4['user'][_0x3c27('0x27')]({'plain':!![]});if(!_0x366dc9)throw new Error(_0x3c27('0x4d'));if(_0x366dc9['role']==='user'){var _0x360c13=_0x3048f8[_0x3c27('0x27')]({'plain':!![]});var _0x31e396=_0x3c27('0x56');return db[_0x3c27('0x4e')][_0x3c27('0x49')]({'where':{'name':_0x31e396,'userProfileId':_0x366dc9[_0x3c27('0x4f')]},'raw':!![]})[_0x3c27('0x25')](function(_0x42c9a6){if(_0x42c9a6&&_0x42c9a6[_0x3c27('0x57')]===0x0){return db[_0x3c27('0x28')][_0x3c27('0x4a')]({'name':_0x360c13['name'],'resourceId':_0x360c13['id'],'type':_0x42c9a6[_0x3c27('0x2c')],'sectionId':_0x42c9a6['id']},{})[_0x3c27('0x25')](function(){return _0x3048f8;});}else{return _0x3048f8;}})[_0x3c27('0x44')](function(_0x1314d7){logger[_0x3c27('0x2a')](_0x3c27('0x50'),_0x1314d7);throw _0x1314d7;});}return _0x3048f8;});}})[_0x3c27('0x25')](respondWithResult(_0x93f3af,0xc9))['catch'](handleError(_0x93f3af,null));};exports['update']=function(_0x41ebd2,_0x192bf9){if(_0x41ebd2[_0x3c27('0x4b')]['id']){delete _0x41ebd2['body']['id'];}return db['Campaign']['find']({'where':{'id':_0x41ebd2[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x192bf9,null))[_0x3c27('0x25')](saveUpdates(_0x41ebd2[_0x3c27('0x4b')],null))[_0x3c27('0x25')](respondWithResult(_0x192bf9,null))[_0x3c27('0x44')](handleError(_0x192bf9,null));};exports[_0x3c27('0x26')]=function(_0x5ca67c,_0x544526){return db['Campaign']['find']({'where':{'id':_0x5ca67c['params']['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x544526,null))[_0x3c27('0x25')](removeEntity(_0x544526,null))['catch'](handleError(_0x544526,null));};exports[_0x3c27('0x58')]=function(_0x25a0b2,_0x4ac98c,_0x2adc75){var _0x5a56f4={'raw':!![],'where':{}};var _0x373a29={};var _0x1ef887={'count':0x0,'rows':[]};return db[_0x3c27('0x42')][_0x3c27('0x59')]({'where':{'id':_0x25a0b2[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x4ac98c,null))['then'](function(_0x59e82){if(_0x59e82){_0x373a29['model']=_['keys'](db['CmHopper'][_0x3c27('0x30')]);_0x373a29['query']=_[_0x3c27('0x34')](_0x25a0b2[_0x3c27('0x37')]);_0x373a29[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0x373a29['model'],_0x373a29[_0x3c27('0x37')]);_0x5a56f4[_0x3c27('0x39')]=_['intersection'](_0x373a29['model'],qs[_0x3c27('0x38')](_0x25a0b2['query']['fields']));_0x5a56f4[_0x3c27('0x39')]=_0x5a56f4[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x5a56f4['attributes']:_0x373a29[_0x3c27('0x33')];if(!_0x25a0b2[_0x3c27('0x37')]['hasOwnProperty']('nolimit')){_0x5a56f4['limit']=qs[_0x3c27('0x1f')](_0x25a0b2['query'][_0x3c27('0x1f')]);_0x5a56f4[_0x3c27('0x1d')]=qs['offset'](_0x25a0b2[_0x3c27('0x37')][_0x3c27('0x1d')]);}_0x5a56f4[_0x3c27('0x3d')]=qs[_0x3c27('0x3e')](_0x25a0b2[_0x3c27('0x37')][_0x3c27('0x3e')]);_0x5a56f4[_0x3c27('0x40')]=qs[_0x3c27('0x35')](_[_0x3c27('0x5a')](_0x25a0b2[_0x3c27('0x37')],_0x373a29[_0x3c27('0x35')]));_0x5a56f4['where'][_0x3c27('0x5b')]=_0x59e82['id'];if(_0x25a0b2[_0x3c27('0x37')][_0x3c27('0x3f')]){_0x5a56f4[_0x3c27('0x40')]=_['merge'](_0x5a56f4[_0x3c27('0x40')],{'$or':_['map'](_0x5a56f4['attributes'],function(_0x1129cf){var _0x4b0f22={};_0x4b0f22[_0x1129cf]={'$like':'%'+_0x25a0b2[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x4b0f22;})});}_0x5a56f4=_[_0x3c27('0x53')]({},_0x5a56f4,_0x25a0b2[_0x3c27('0x48')]);return db[_0x3c27('0x5c')][_0x3c27('0x20')]({'where':_0x5a56f4['where']})[_0x3c27('0x25')](function(_0x3cd10a){_0x1ef887['count']=_0x3cd10a;if(_0x25a0b2[_0x3c27('0x37')]['includeAll']){_0x5a56f4[_0x3c27('0x47')]=[{'all':!![]}];}return db[_0x3c27('0x5c')][_0x3c27('0x43')](_0x5a56f4);})[_0x3c27('0x25')](function(_0x25005f){_0x1ef887[_0x3c27('0x5d')]=_0x25005f;return _0x1ef887;});}})[_0x3c27('0x25')](respondWithFilteredResult(_0x4ac98c,_0x5a56f4))[_0x3c27('0x44')](handleError(_0x4ac98c,null));};exports[_0x3c27('0x5e')]=function(_0xec7612,_0x26f176,_0x5f507e){var _0x263359={'raw':!![],'where':{}};var _0xbcef1b={};var _0x1da3eb={'count':0x0,'rows':[]};return db[_0x3c27('0x42')][_0x3c27('0x59')]({'where':{'id':_0xec7612[_0x3c27('0x46')]['id']}})['then'](handleEntityNotFound(_0x26f176,null))[_0x3c27('0x25')](function(_0x1fe494){if(_0x1fe494){_0xbcef1b[_0x3c27('0x33')]=_['keys'](db[_0x3c27('0x5f')][_0x3c27('0x30')]);_0xbcef1b[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0xec7612[_0x3c27('0x37')]);_0xbcef1b[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0xbcef1b[_0x3c27('0x33')],_0xbcef1b[_0x3c27('0x37')]);_0x263359[_0x3c27('0x39')]=_[_0x3c27('0x36')](_0xbcef1b['model'],qs[_0x3c27('0x38')](_0xec7612[_0x3c27('0x37')][_0x3c27('0x38')]));_0x263359[_0x3c27('0x39')]=_0x263359[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x263359[_0x3c27('0x39')]:_0xbcef1b['model'];if(!_0xec7612[_0x3c27('0x37')][_0x3c27('0x3b')]('nolimit')){_0x263359[_0x3c27('0x1f')]=qs[_0x3c27('0x1f')](_0xec7612[_0x3c27('0x37')][_0x3c27('0x1f')]);_0x263359[_0x3c27('0x1d')]=qs['offset'](_0xec7612[_0x3c27('0x37')][_0x3c27('0x1d')]);}_0x263359[_0x3c27('0x3d')]=qs[_0x3c27('0x3e')](_0xec7612[_0x3c27('0x37')]['sort']);_0x263359[_0x3c27('0x40')]=qs['filters'](_[_0x3c27('0x5a')](_0xec7612[_0x3c27('0x37')],_0xbcef1b[_0x3c27('0x35')]));_0x263359[_0x3c27('0x40')]['CampaignId']=_0x1fe494['id'];if(_0xec7612[_0x3c27('0x37')][_0x3c27('0x3f')]){_0x263359[_0x3c27('0x40')]=_['merge'](_0x263359[_0x3c27('0x40')],{'$or':_[_0x3c27('0x2f')](_0x263359[_0x3c27('0x39')],function(_0x25c368){var _0x1218f7={};_0x1218f7[_0x25c368]={'$like':'%'+_0xec7612[_0x3c27('0x37')]['filter']+'%'};return _0x1218f7;})});}_0x263359=_['merge']({},_0x263359,_0xec7612[_0x3c27('0x48')]);return db[_0x3c27('0x5f')][_0x3c27('0x20')]({'where':_0x263359[_0x3c27('0x40')]})['then'](function(_0x853fbe){_0x1da3eb['count']=_0x853fbe;if(_0xec7612[_0x3c27('0x37')]['includeAll']){_0x263359[_0x3c27('0x47')]=[{'all':!![]}];}return db[_0x3c27('0x5f')][_0x3c27('0x43')](_0x263359);})[_0x3c27('0x25')](function(_0x563aaf){_0x1da3eb['rows']=_0x563aaf;return _0x1da3eb;});}})[_0x3c27('0x25')](respondWithFilteredResult(_0x26f176,_0x263359))[_0x3c27('0x44')](handleError(_0x26f176,null));};exports[_0x3c27('0x60')]=function(_0x1bfa22,_0x1ccb89,_0x204b91){var _0x3b3cf5={'raw':!![],'where':{}};var _0x5263ea={};var _0x4242a2={'count':0x0,'rows':[]};return db[_0x3c27('0x42')]['findOne']({'where':{'id':_0x1bfa22[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x1ccb89,null))[_0x3c27('0x25')](function(_0x49fdfd){if(_0x49fdfd){_0x5263ea[_0x3c27('0x33')]=_['keys'](db[_0x3c27('0x61')]['rawAttributes']);_0x5263ea[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0x1bfa22['query']);_0x5263ea['filters']=_[_0x3c27('0x36')](_0x5263ea[_0x3c27('0x33')],_0x5263ea[_0x3c27('0x37')]);_0x3b3cf5['attributes']=_[_0x3c27('0x36')](_0x5263ea[_0x3c27('0x33')],qs['fields'](_0x1bfa22[_0x3c27('0x37')][_0x3c27('0x38')]));_0x3b3cf5[_0x3c27('0x39')]=_0x3b3cf5[_0x3c27('0x39')][_0x3c27('0x3a')]?_0x3b3cf5[_0x3c27('0x39')]:_0x5263ea['model'];if(!_0x1bfa22[_0x3c27('0x37')][_0x3c27('0x3b')]('nolimit')){_0x3b3cf5[_0x3c27('0x1f')]=qs['limit'](_0x1bfa22['query'][_0x3c27('0x1f')]);_0x3b3cf5['offset']=qs[_0x3c27('0x1d')](_0x1bfa22[_0x3c27('0x37')]['offset']);}_0x3b3cf5[_0x3c27('0x3d')]=qs[_0x3c27('0x3e')](_0x1bfa22[_0x3c27('0x37')][_0x3c27('0x3e')]);_0x3b3cf5['where']=qs[_0x3c27('0x35')](_[_0x3c27('0x5a')](_0x1bfa22[_0x3c27('0x37')],_0x5263ea['filters']));_0x3b3cf5[_0x3c27('0x40')][_0x3c27('0x5b')]=_0x49fdfd['id'];if(_0x1bfa22['query'][_0x3c27('0x3f')]){_0x3b3cf5[_0x3c27('0x40')]=_[_0x3c27('0x53')](_0x3b3cf5[_0x3c27('0x40')],{'$or':_['map'](_0x3b3cf5[_0x3c27('0x39')],function(_0xad0858){var _0x2c104d={};_0x2c104d[_0xad0858]={'$like':'%'+_0x1bfa22[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x2c104d;})});}_0x3b3cf5=_['merge']({},_0x3b3cf5,_0x1bfa22[_0x3c27('0x48')]);return db[_0x3c27('0x61')][_0x3c27('0x20')]({'where':_0x3b3cf5[_0x3c27('0x40')]})['then'](function(_0x5d2a99){_0x4242a2[_0x3c27('0x20')]=_0x5d2a99;if(_0x1bfa22['query'][_0x3c27('0x52')]){_0x3b3cf5['include']=[{'all':!![]}];}return db[_0x3c27('0x61')]['findAll'](_0x3b3cf5);})[_0x3c27('0x25')](function(_0x21926e){_0x4242a2['rows']=_0x21926e;return _0x4242a2;});}})[_0x3c27('0x25')](respondWithFilteredResult(_0x1ccb89,_0x3b3cf5))[_0x3c27('0x44')](handleError(_0x1ccb89,null));};exports[_0x3c27('0x62')]=function(_0x778041,_0x5a7399,_0x23204e){var _0x3cc3c1={'raw':!![],'where':{}};var _0x28e937={};var _0x300a0c={'count':0x0,'rows':[]};return db[_0x3c27('0x42')][_0x3c27('0x59')]({'where':{'id':_0x778041[_0x3c27('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a7399,null))[_0x3c27('0x25')](function(_0x43ff2d){if(_0x43ff2d){_0x28e937[_0x3c27('0x33')]=_['keys'](db['CmHopperBlack'][_0x3c27('0x30')]);_0x28e937[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0x778041[_0x3c27('0x37')]);_0x28e937[_0x3c27('0x35')]=_['intersection'](_0x28e937[_0x3c27('0x33')],_0x28e937['query']);_0x3cc3c1[_0x3c27('0x39')]=_[_0x3c27('0x36')](_0x28e937[_0x3c27('0x33')],qs[_0x3c27('0x38')](_0x778041[_0x3c27('0x37')]['fields']));_0x3cc3c1[_0x3c27('0x39')]=_0x3cc3c1['attributes']['length']?_0x3cc3c1['attributes']:_0x28e937['model'];if(!_0x778041[_0x3c27('0x37')][_0x3c27('0x3b')](_0x3c27('0x3c'))){_0x3cc3c1[_0x3c27('0x1f')]=qs[_0x3c27('0x1f')](_0x778041[_0x3c27('0x37')][_0x3c27('0x1f')]);_0x3cc3c1['offset']=qs[_0x3c27('0x1d')](_0x778041['query'][_0x3c27('0x1d')]);}_0x3cc3c1[_0x3c27('0x3d')]=qs[_0x3c27('0x3e')](_0x778041[_0x3c27('0x37')][_0x3c27('0x3e')]);_0x3cc3c1[_0x3c27('0x40')]=qs[_0x3c27('0x35')](_['pick'](_0x778041[_0x3c27('0x37')],_0x28e937[_0x3c27('0x35')]));_0x3cc3c1[_0x3c27('0x40')]['CampaignId']=_0x43ff2d['id'];if(_0x778041[_0x3c27('0x37')][_0x3c27('0x3f')]){_0x3cc3c1[_0x3c27('0x40')]=_[_0x3c27('0x53')](_0x3cc3c1['where'],{'$or':_['map'](_0x3cc3c1[_0x3c27('0x39')],function(_0xc965ca){var _0x594810={};_0x594810[_0xc965ca]={'$like':'%'+_0x778041[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x594810;})});}_0x3cc3c1=_[_0x3c27('0x53')]({},_0x3cc3c1,_0x778041[_0x3c27('0x48')]);return db[_0x3c27('0x63')]['count']({'where':_0x3cc3c1[_0x3c27('0x40')]})[_0x3c27('0x25')](function(_0x28195b){_0x300a0c[_0x3c27('0x20')]=_0x28195b;if(_0x778041[_0x3c27('0x37')][_0x3c27('0x52')]){_0x3cc3c1[_0x3c27('0x47')]=[{'all':!![]}];}return db[_0x3c27('0x63')][_0x3c27('0x43')](_0x3cc3c1);})[_0x3c27('0x25')](function(_0x4458af){_0x300a0c[_0x3c27('0x5d')]=_0x4458af;return _0x300a0c;});}})[_0x3c27('0x25')](respondWithFilteredResult(_0x5a7399,_0x3cc3c1))[_0x3c27('0x44')](handleError(_0x5a7399,null));};exports[_0x3c27('0x64')]=function(_0x22fb27,_0x3e30c3,_0x594394){var _0xedf3de={};var _0x111c50={};var _0x80e793;var _0x4bb4ff;return db[_0x3c27('0x42')][_0x3c27('0x59')]({'where':{'id':_0x22fb27[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x3e30c3,null))[_0x3c27('0x25')](function(_0x2b7d6c){if(_0x2b7d6c){_0x80e793=_0x2b7d6c;_0x111c50[_0x3c27('0x33')]=_[_0x3c27('0x34')](db[_0x3c27('0x65')][_0x3c27('0x30')]);_0x111c50[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0x22fb27[_0x3c27('0x37')]);_0x111c50[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0x111c50[_0x3c27('0x33')],_0x111c50[_0x3c27('0x37')]);_0xedf3de[_0x3c27('0x39')]=_[_0x3c27('0x36')](_0x111c50[_0x3c27('0x33')],qs[_0x3c27('0x38')](_0x22fb27[_0x3c27('0x37')][_0x3c27('0x38')]));_0xedf3de[_0x3c27('0x39')]=_0xedf3de[_0x3c27('0x39')]['length']?_0xedf3de[_0x3c27('0x39')]:_0x111c50['model'];_0xedf3de[_0x3c27('0x3d')]=qs['sort'](_0x22fb27['query'][_0x3c27('0x3e')]);_0xedf3de['where']=qs['filters'](_[_0x3c27('0x5a')](_0x22fb27['query'],_0x111c50['filters']));if(_0x22fb27[_0x3c27('0x37')][_0x3c27('0x3f')]){_0xedf3de['where']=_[_0x3c27('0x53')](_0xedf3de[_0x3c27('0x40')],{'$or':_[_0x3c27('0x2f')](_0xedf3de[_0x3c27('0x39')],function(_0x5f02f5){var _0x39cb37={};_0x39cb37[_0x5f02f5]={'$like':'%'+_0x22fb27['query'][_0x3c27('0x3f')]+'%'};return _0x39cb37;})});}_0xedf3de=_['merge']({},_0xedf3de,_0x22fb27['options']);return _0x80e793[_0x3c27('0x64')](_0xedf3de);}})[_0x3c27('0x25')](function(_0x538b22){if(_0x538b22){_0x4bb4ff=_0x538b22[_0x3c27('0x3a')];if(!_0x22fb27[_0x3c27('0x37')]['hasOwnProperty']('nolimit')){_0xedf3de['limit']=qs[_0x3c27('0x1f')](_0x22fb27['query'][_0x3c27('0x1f')]);_0xedf3de['offset']=qs[_0x3c27('0x1d')](_0x22fb27['query'][_0x3c27('0x1d')]);}return _0x80e793['getLists'](_0xedf3de);}})['then'](function(_0x28e5d8){if(_0x28e5d8){return _0x28e5d8?{'count':_0x4bb4ff,'rows':_0x28e5d8}:null;}})[_0x3c27('0x25')](respondWithResult(_0x3e30c3,null))['catch'](handleError(_0x3e30c3,null));};exports['addLists']=function(_0x1d7411,_0x9dd402,_0xc264cd){var _0x18dd27,_0x49fbb5;var _0x5668b3=[];var _0x262e57=moment()[_0x3c27('0x66')](_0x3c27('0x67'));return db['Campaign']['find']({'where':{'id':_0x1d7411[_0x3c27('0x46')]['id']}})['then'](handleEntityNotFound(_0x9dd402,null))[_0x3c27('0x25')](function(_0x5def26){if(_0x5def26){_0x49fbb5=_0x5def26;return _0x5def26['addLists'](_0x1d7411[_0x3c27('0x4b')]['ids'],_[_0x3c27('0x68')](_0x1d7411[_0x3c27('0x4b')],[_0x3c27('0x69'),'id'])||{});}return null;})[_0x3c27('0x6a')](function(_0x1030f1){var _0x2f85a5;var _0x4fe866;_0x18dd27=_0x1030f1||[];var _0x408dbe=[];if(_0x1030f1){for(var _0xc391d9=0x0;_0xc391d9<_0x1030f1['length'];_0xc391d9+=0x1){var _0x1b5bc2=_0x1030f1[_0xc391d9][_0x3c27('0x27')]({'plain':!![]});_0x49fbb5['dialCheckDuplicateType']=_0x1d7411[_0x3c27('0x4b')]['dialCheckDuplicateType']?_0x1d7411[_0x3c27('0x4b')][_0x3c27('0x6b')]:_0x49fbb5[_0x3c27('0x6b')];switch(_0x49fbb5[_0x3c27('0x6b')]){case _0x3c27('0x6c'):_0x2f85a5=squel['insert']()[_0x3c27('0x6d')](_0x3c27('0x6e'))[_0x3c27('0x6f')]([_0x3c27('0x70'),_0x3c27('0x71'),'ContactId','ListId',_0x3c27('0x5b'),_0x3c27('0x55'),'updatedAt'],squel['select']()['field'](_0x3c27('0x70'),_0x3c27('0x70'))[_0x3c27('0x72')](_0x3c27('0x73'),_0x3c27('0x71'))['field']('id',_0x3c27('0x74'))[_0x3c27('0x72')](_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')](),_0x3c27('0x77'))['field'](_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')](),'CampaignId')[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x55'))[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27','updatedAt')[_0x3c27('0x78')](_0x3c27('0x79'))['where']('deletedAt\x20IS\x20NULL')[_0x3c27('0x40')]('ListId\x20=\x20?',_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')]())[_0x3c27('0x40')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x3c27('0x7a'),squel[_0x3c27('0x7b')]()[_0x3c27('0x72')](_0x3c27('0x7c'))[_0x3c27('0x78')](_0x3c27('0x7d'))[_0x3c27('0x40')](_0x3c27('0x7e'),_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')]()))['where'](_0x3c27('0x7a'),squel[_0x3c27('0x7b')]()[_0x3c27('0x72')](_0x3c27('0x7f'))[_0x3c27('0x78')]('cm_hopper')[_0x3c27('0x40')](_0x3c27('0x7e'),_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')]())))[_0x3c27('0x76')]();break;case _0x3c27('0x80'):_0x2f85a5=squel[_0x3c27('0x81')]()['into']('cm_hopper')[_0x3c27('0x6f')](['phone',_0x3c27('0x71'),_0x3c27('0x74'),'ListId',_0x3c27('0x5b'),_0x3c27('0x55'),'updatedAt'],squel['select']()[_0x3c27('0x72')](_0x3c27('0x70'),'phone')[_0x3c27('0x72')](_0x3c27('0x73'),_0x3c27('0x71'))[_0x3c27('0x72')]('id',_0x3c27('0x74'))[_0x3c27('0x72')](_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')](),_0x3c27('0x77'))[_0x3c27('0x72')](_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')](),_0x3c27('0x5b'))[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x55'))['field']('\x27'+_0x262e57+'\x27',_0x3c27('0x54'))[_0x3c27('0x78')]('cm_contacts')[_0x3c27('0x40')]('deletedAt\x20IS\x20NULL')[_0x3c27('0x40')](_0x3c27('0x82'),_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')]())['where'](_0x3c27('0x83'))['where'](_0x3c27('0x7a'),squel[_0x3c27('0x7b')]()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x3c27('0x40')](_0x3c27('0x7e'),_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')]())))[_0x3c27('0x76')]();break;default:_0x2f85a5=squel[_0x3c27('0x81')]()[_0x3c27('0x6d')]('cm_hopper')[_0x3c27('0x6f')](['phone','scheduledAt',_0x3c27('0x74'),_0x3c27('0x77'),'CampaignId',_0x3c27('0x55'),_0x3c27('0x54')],squel[_0x3c27('0x7b')]()[_0x3c27('0x72')]('phone',_0x3c27('0x70'))[_0x3c27('0x72')](_0x3c27('0x73'),'scheduledAt')[_0x3c27('0x72')]('id',_0x3c27('0x74'))[_0x3c27('0x72')](_0x1b5bc2[_0x3c27('0x75')]['toString'](),_0x3c27('0x77'))[_0x3c27('0x72')](_0x1d7411['params']['id'][_0x3c27('0x76')](),_0x3c27('0x5b'))[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x55'))['field']('\x27'+_0x262e57+'\x27',_0x3c27('0x54'))[_0x3c27('0x78')](_0x3c27('0x79'))['where'](_0x3c27('0x84'))[_0x3c27('0x40')](_0x3c27('0x82'),_0x1b5bc2[_0x3c27('0x75')][_0x3c27('0x76')]())['where'](_0x3c27('0x83')))[_0x3c27('0x76')]();}_0x4fe866=squel[_0x3c27('0x81')]()[_0x3c27('0x6d')](_0x3c27('0x85'))[_0x3c27('0x6f')]([_0x3c27('0x86'),_0x3c27('0x71'),'phone',_0x3c27('0x87'),_0x3c27('0x55'),_0x3c27('0x54')],squel[_0x3c27('0x7b')]()[_0x3c27('0x72')](_0x3c27('0x88'),'id')[_0x3c27('0x72')](_0x3c27('0x73'),_0x3c27('0x71'))[_0x3c27('0x72')]('ci.item',_0x3c27('0x70'))[_0x3c27('0x72')](_0x3c27('0x89'),'OrderBy')[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x55'))[_0x3c27('0x72')]('\x27'+_0x262e57+'\x27',_0x3c27('0x54'))['from'](_0x3c27('0x8a'),'ci')[_0x3c27('0x8b')](_0x3c27('0x6e'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x3c27('0x40')](_0x3c27('0x8c'),_0x1b5bc2['CmListId'][_0x3c27('0x76')]())['where'](_0x3c27('0x8d'),_0x1d7411[_0x3c27('0x46')]['id'][_0x3c27('0x76')]())[_0x3c27('0x40')](_0x3c27('0x8e'),_0x262e57))['toString']();_0x408dbe[_0x3c27('0x8f')](db['sequelize']['query'](_0x2f85a5));_0x5668b3[_0x3c27('0x8f')](db[_0x3c27('0x90')][_0x3c27('0x37')](_0x4fe866));}return BPromise['all'](_0x408dbe);}})[_0x3c27('0x25')](function(){return BPromise[_0x3c27('0x91')](_0x5668b3);})[_0x3c27('0x25')](function(){return _0x18dd27;})['then'](respondWithResult(_0x9dd402,null))[_0x3c27('0x44')](handleError(_0x9dd402,null));};exports[_0x3c27('0x92')]=function(_0x2f906f,_0x3135a3,_0x4f9ad7){return db[_0x3c27('0x42')][_0x3c27('0x49')]({'where':{'id':_0x2f906f[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x3135a3,null))[_0x3c27('0x25')](function(_0x5b1810){if(_0x5b1810){return _0x5b1810[_0x3c27('0x92')](_0x2f906f[_0x3c27('0x37')]['ids']);}})[_0x3c27('0x25')](function(_0xbb151f){if(_0xbb151f){return db[_0x3c27('0x5c')][_0x3c27('0x26')]({'where':{'ListId':_0x2f906f[_0x3c27('0x37')]['ids'],'CampaignId':_0x2f906f['params']['id']}})[_0x3c27('0x25')](function(){return _0xbb151f;});}})['then'](respondWithStatusCode(_0x3135a3,null))[_0x3c27('0x44')](handleError(_0x3135a3,null));};exports[_0x3c27('0x93')]=function(_0x3e76f4,_0x20e399,_0x2f1e7e){var _0x5434b5={};var _0x128fba={};var _0x2aa1f0;var _0x56b004;return db[_0x3c27('0x42')]['findOne']({'where':{'id':_0x3e76f4[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x20e399,null))[_0x3c27('0x25')](function(_0x4f9fbe){if(_0x4f9fbe){_0x2aa1f0=_0x4f9fbe;_0x128fba['model']=_['keys'](db[_0x3c27('0x65')]['rawAttributes']);_0x128fba[_0x3c27('0x37')]=_[_0x3c27('0x34')](_0x3e76f4[_0x3c27('0x37')]);_0x128fba[_0x3c27('0x35')]=_[_0x3c27('0x36')](_0x128fba[_0x3c27('0x33')],_0x128fba['query']);_0x5434b5['attributes']=_[_0x3c27('0x36')](_0x128fba['model'],qs['fields'](_0x3e76f4['query']['fields']));_0x5434b5['attributes']=_0x5434b5['attributes'][_0x3c27('0x3a')]?_0x5434b5[_0x3c27('0x39')]:_0x128fba[_0x3c27('0x33')];_0x5434b5[_0x3c27('0x3d')]=qs['sort'](_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x3e')]);_0x5434b5[_0x3c27('0x40')]=qs[_0x3c27('0x35')](_['pick'](_0x3e76f4[_0x3c27('0x37')],_0x128fba[_0x3c27('0x35')]));if(_0x3e76f4[_0x3c27('0x37')]['filter']){_0x5434b5[_0x3c27('0x40')]=_[_0x3c27('0x53')](_0x5434b5[_0x3c27('0x40')],{'$or':_[_0x3c27('0x2f')](_0x5434b5['attributes'],function(_0x40d49d){var _0x1f7109={};_0x1f7109[_0x40d49d]={'$like':'%'+_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x3f')]+'%'};return _0x1f7109;})});}_0x5434b5=_[_0x3c27('0x53')]({},_0x5434b5,_0x3e76f4['options']);return _0x2aa1f0[_0x3c27('0x93')](_0x5434b5);}})[_0x3c27('0x25')](function(_0x3fedf3){if(_0x3fedf3){_0x56b004=_0x3fedf3[_0x3c27('0x3a')];if(!_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x3b')](_0x3c27('0x3c'))){_0x5434b5[_0x3c27('0x1f')]=qs['limit'](_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x1f')]);_0x5434b5[_0x3c27('0x1d')]=qs[_0x3c27('0x1d')](_0x3e76f4[_0x3c27('0x37')][_0x3c27('0x1d')]);}return _0x2aa1f0[_0x3c27('0x93')](_0x5434b5);}})['then'](function(_0xef9453){if(_0xef9453){return _0xef9453?{'count':_0x56b004,'rows':_0xef9453}:null;}})[_0x3c27('0x25')](respondWithResult(_0x20e399,null))[_0x3c27('0x44')](handleError(_0x20e399,null));};exports[_0x3c27('0x94')]=function(_0x4509ff,_0x1b543b,_0x3a0768){var _0x3cd9eb,_0x2c3297;var _0x3cae61=[];var _0x4b308e=moment()[_0x3c27('0x66')](_0x3c27('0x67'));return db[_0x3c27('0x42')][_0x3c27('0x49')]({'where':{'id':_0x4509ff[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x1b543b,null))['then'](function(_0x3d6017){if(_0x3d6017){_0x2c3297=_0x3d6017;return _0x3d6017[_0x3c27('0x94')](_0x4509ff[_0x3c27('0x4b')][_0x3c27('0x69')],_['omit'](_0x4509ff[_0x3c27('0x4b')],['ids','id'])||{});}return null;})['spread'](function(_0x1e22fe){var _0x57c540;var _0x59664f;_0x3cd9eb=_0x1e22fe||[];var _0x3d8f68=[];if(_0x1e22fe){for(var _0x2b115f=0x0;_0x2b115f<_0x1e22fe[_0x3c27('0x3a')];_0x2b115f+=0x1){var _0x18ec9f=_0x1e22fe[_0x2b115f]['get']({'plain':!![]});_0x57c540=squel[_0x3c27('0x81')]()[_0x3c27('0x6d')](_0x3c27('0x95'))['fromQuery']([_0x3c27('0x70'),_0x3c27('0x74'),_0x3c27('0x77'),_0x3c27('0x5b'),_0x3c27('0x55'),_0x3c27('0x54')],squel[_0x3c27('0x7b')]()[_0x3c27('0x72')]('phone',_0x3c27('0x70'))['field']('id',_0x3c27('0x74'))[_0x3c27('0x72')](_0x18ec9f['CmListId'][_0x3c27('0x76')](),'ListId')[_0x3c27('0x72')](_0x4509ff['params']['id'][_0x3c27('0x76')](),_0x3c27('0x5b'))[_0x3c27('0x72')]('NOW()',_0x3c27('0x55'))[_0x3c27('0x72')]('NOW()','updatedAt')[_0x3c27('0x78')]('cm_contacts')[_0x3c27('0x40')]('deletedAt\x20IS\x20NULL')[_0x3c27('0x40')](_0x3c27('0x82'),_0x18ec9f[_0x3c27('0x75')][_0x3c27('0x76')]())[_0x3c27('0x40')](_0x3c27('0x83')))[_0x3c27('0x76')]();_0x3d8f68[_0x3c27('0x8f')](db[_0x3c27('0x90')][_0x3c27('0x37')](_0x57c540));}return BPromise[_0x3c27('0x91')](_0x3d8f68);}})[_0x3c27('0x25')](function(){return _0x3cd9eb;})[_0x3c27('0x25')](respondWithResult(_0x1b543b,null))[_0x3c27('0x44')](handleError(_0x1b543b,null));};exports['removeBlackLists']=function(_0x2c1d3e,_0x179912,_0x2ac57f){return db['Campaign'][_0x3c27('0x49')]({'where':{'id':_0x2c1d3e[_0x3c27('0x46')]['id']}})[_0x3c27('0x25')](handleEntityNotFound(_0x179912,null))['then'](function(_0x3f05c4){if(_0x3f05c4){return _0x3f05c4[_0x3c27('0x96')](_0x2c1d3e[_0x3c27('0x37')][_0x3c27('0x69')]);}})[_0x3c27('0x25')](function(_0x3fdc13){if(_0x3fdc13){return db[_0x3c27('0x63')][_0x3c27('0x26')]({'where':{'ListId':_0x2c1d3e[_0x3c27('0x37')]['ids'],'CampaignId':_0x2c1d3e[_0x3c27('0x46')]['id']}})['then'](function(){return _0x3fdc13;});}})[_0x3c27('0x25')](respondWithStatusCode(_0x179912,null))[_0x3c27('0x44')](handleError(_0x179912,null));}; \ No newline at end of file +var _0x7d98=['merge','VIRTUAL','options','Campaign','include','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','updatedAt','body','createdAt','autoAssociation','getHoppers','findOne','CmHopper','sort','findAll','getHopperHistories','CmHopperHistory','hasOwnProperty','CampaignId','getHopperFinals','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','phone','scheduledAt','ContactId','ListId','select','field','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','toString','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','fromQuery','NOW()','insert','ListId\x20=\x20?','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','omit','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','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','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter'];(function(_0x435514,_0x3f8d75){var _0xdf4d48=function(_0x460972){while(--_0x460972){_0x435514['push'](_0x435514['shift']());}};_0xdf4d48(++_0x3f8d75);}(_0x7d98,0xe7));var _0x87d9=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0x7d98[_0x259d17];return _0x407535;};'use strict';var emlformat=require(_0x87d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87d9('0x1'));var jsonpatch=require(_0x87d9('0x2'));var rp=require(_0x87d9('0x3'));var moment=require(_0x87d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87d9('0x5'));var util=require(_0x87d9('0x6'));var path=require('path');var sox=require(_0x87d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d9('0x8'));var squel=require(_0x87d9('0x9'));var crypto=require(_0x87d9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x87d9('0xb'));var toCsv=require(_0x87d9('0xc'));var querystring=require(_0x87d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x87d9('0xe'));var authService=require(_0x87d9('0xf'));var qs=require(_0x87d9('0x10'));var as=require(_0x87d9('0x11'));var hardwareService=require(_0x87d9('0x12'));var logger=require(_0x87d9('0x13'))(_0x87d9('0x14'));var utils=require(_0x87d9('0x15'));var config=require(_0x87d9('0x16'));var licenseUtil=require(_0x87d9('0x17'));var db=require(_0x87d9('0x18'))['db'];function respondWithStatusCode(_0x22f32d,_0x38f33e){_0x38f33e=_0x38f33e||0xcc;return function(_0x22758){if(_0x22758){return _0x22f32d[_0x87d9('0x19')](_0x38f33e);}return _0x22f32d[_0x87d9('0x1a')](_0x38f33e)[_0x87d9('0x1b')]();};}function respondWithResult(_0x185401,_0x380836){_0x380836=_0x380836||0xc8;return function(_0x27d61d){if(_0x27d61d){return _0x185401['status'](_0x380836)['json'](_0x27d61d);}};}function respondWithFilteredResult(_0x9e9e53,_0xaa910c){return function(_0x3231e7){if(_0x3231e7){var _0x501d32=typeof _0xaa910c['offset']===_0x87d9('0x1c')&&typeof _0xaa910c[_0x87d9('0x1d')]===_0x87d9('0x1c');var _0x23ae47=_0x3231e7[_0x87d9('0x1e')];var _0xebc1eb=_0x501d32?0x0:_0xaa910c[_0x87d9('0x1f')];var _0x1f33a3=_0x501d32?_0x3231e7[_0x87d9('0x1e')]:_0xaa910c[_0x87d9('0x1f')]+_0xaa910c[_0x87d9('0x1d')];var _0x5d6da1;if(_0x1f33a3>=_0x23ae47){_0x1f33a3=_0x23ae47;_0x5d6da1=0xc8;}else{_0x5d6da1=0xce;}_0x9e9e53[_0x87d9('0x1a')](_0x5d6da1);return _0x9e9e53['set'](_0x87d9('0x20'),_0xebc1eb+'-'+_0x1f33a3+'/'+_0x23ae47)[_0x87d9('0x21')](_0x3231e7);}return null;};}function patchUpdates(_0x334d31){return function(_0x57bef6){try{jsonpatch['apply'](_0x57bef6,_0x334d31,!![]);}catch(_0x545241){return BPromise[_0x87d9('0x22')](_0x545241);}return _0x57bef6[_0x87d9('0x23')]();};}function saveUpdates(_0x28aaaa,_0x6ab839){return function(_0xc82b02){if(_0xc82b02){return _0xc82b02[_0x87d9('0x24')](_0x28aaaa)[_0x87d9('0x25')](function(_0x3b24e7){return _0x3b24e7;});}return null;};}function removeEntity(_0x1c550c,_0x4c0f7a){return function(_0x31e1b2){if(_0x31e1b2){return _0x31e1b2[_0x87d9('0x26')]()[_0x87d9('0x25')](function(){var _0xb2a651=_0x31e1b2[_0x87d9('0x27')]({'plain':!![]});var _0x340462=_0x87d9('0x28');return db[_0x87d9('0x29')]['destroy']({'where':{'type':_0x340462,'resourceId':_0xb2a651['id']}})[_0x87d9('0x25')](function(){return _0x31e1b2;});})[_0x87d9('0x25')](function(){_0x1c550c[_0x87d9('0x1a')](0xcc)[_0x87d9('0x1b')]();});}};}function handleEntityNotFound(_0x4e6eec,_0x121368){return function(_0x12d733){if(!_0x12d733){_0x4e6eec[_0x87d9('0x19')](0x194);}return _0x12d733;};}function handleError(_0x14fc64,_0x480879){_0x480879=_0x480879||0x1f4;return function(_0x21916a){logger[_0x87d9('0x2a')](_0x21916a[_0x87d9('0x2b')]);if(_0x21916a['name']){delete _0x21916a[_0x87d9('0x2c')];}_0x14fc64[_0x87d9('0x1a')](_0x480879)['send'](_0x21916a);};}exports['index']=function(_0x4f13db,_0x31122b){var _0x21addd={},_0x5aeda7={},_0x821df6={'count':0x0,'rows':[]};var _0x4a820e=_[_0x87d9('0x2d')](db['Campaign'][_0x87d9('0x2e')],function(_0xf23fae){return{'name':_0xf23fae['fieldName'],'type':_0xf23fae[_0x87d9('0x2f')]['key']};});_0x5aeda7[_0x87d9('0x30')]=_[_0x87d9('0x2d')](_0x4a820e,_0x87d9('0x2c'));_0x5aeda7[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x4f13db[_0x87d9('0x31')]);_0x5aeda7['filters']=_[_0x87d9('0x33')](_0x5aeda7[_0x87d9('0x30')],_0x5aeda7[_0x87d9('0x31')]);_0x21addd[_0x87d9('0x34')]=_[_0x87d9('0x33')](_0x5aeda7[_0x87d9('0x30')],qs[_0x87d9('0x35')](_0x4f13db[_0x87d9('0x31')][_0x87d9('0x35')]));_0x21addd['attributes']=_0x21addd[_0x87d9('0x34')][_0x87d9('0x36')]?_0x21addd[_0x87d9('0x34')]:_0x5aeda7[_0x87d9('0x30')];if(!_0x4f13db[_0x87d9('0x31')]['hasOwnProperty'](_0x87d9('0x37'))){_0x21addd[_0x87d9('0x1d')]=qs[_0x87d9('0x1d')](_0x4f13db['query'][_0x87d9('0x1d')]);_0x21addd['offset']=qs[_0x87d9('0x1f')](_0x4f13db[_0x87d9('0x31')][_0x87d9('0x1f')]);}_0x21addd[_0x87d9('0x38')]=qs['sort'](_0x4f13db[_0x87d9('0x31')]['sort']);_0x21addd[_0x87d9('0x39')]=qs[_0x87d9('0x3a')](_[_0x87d9('0x3b')](_0x4f13db[_0x87d9('0x31')],_0x5aeda7['filters']),_0x4a820e);if(_0x4f13db['query'][_0x87d9('0x3c')]){_0x21addd['where']=_[_0x87d9('0x3d')](_0x21addd['where'],{'$or':_[_0x87d9('0x2d')](_0x4a820e,function(_0x53238c){if(_0x53238c[_0x87d9('0x2f')]!==_0x87d9('0x3e')){var _0x5d8a5c={};_0x5d8a5c[_0x53238c[_0x87d9('0x2c')]]={'$like':'%'+_0x4f13db['query']['filter']+'%'};return _0x5d8a5c;}})});}_0x21addd=_['merge']({},_0x21addd,_0x4f13db[_0x87d9('0x3f')]);var _0x5d3963={'where':_0x21addd[_0x87d9('0x39')]};return db[_0x87d9('0x40')][_0x87d9('0x1e')](_0x5d3963)['then'](function(_0x915f05){_0x821df6[_0x87d9('0x1e')]=_0x915f05;if(_0x4f13db[_0x87d9('0x31')]['includeAll']){_0x21addd[_0x87d9('0x41')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x21addd);})['then'](function(_0x39e807){_0x821df6['rows']=_0x39e807;return _0x821df6;})['then'](respondWithFilteredResult(_0x31122b,_0x21addd))[_0x87d9('0x42')](handleError(_0x31122b,null));};exports[_0x87d9('0x43')]=function(_0x16a802,_0x42d7fa){var _0x2f481d={'raw':![],'where':{'id':_0x16a802[_0x87d9('0x44')]['id']}},_0x5cfd74={};_0x5cfd74[_0x87d9('0x30')]=_['keys'](db['Campaign'][_0x87d9('0x2e')]);_0x5cfd74[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x16a802[_0x87d9('0x31')]);_0x5cfd74[_0x87d9('0x3a')]=_[_0x87d9('0x33')](_0x5cfd74[_0x87d9('0x30')],_0x5cfd74[_0x87d9('0x31')]);_0x2f481d['attributes']=_[_0x87d9('0x33')](_0x5cfd74[_0x87d9('0x30')],qs['fields'](_0x16a802['query'][_0x87d9('0x35')]));_0x2f481d[_0x87d9('0x34')]=_0x2f481d['attributes'][_0x87d9('0x36')]?_0x2f481d['attributes']:_0x5cfd74['model'];if(_0x16a802['query']['includeAll']){_0x2f481d[_0x87d9('0x41')]=[{'all':!![]}];}_0x2f481d=_[_0x87d9('0x3d')]({},_0x2f481d,_0x16a802['options']);return db[_0x87d9('0x40')][_0x87d9('0x45')](_0x2f481d)[_0x87d9('0x25')](handleEntityNotFound(_0x42d7fa,null))['then'](respondWithResult(_0x42d7fa,null))[_0x87d9('0x42')](handleError(_0x42d7fa,null));};exports[_0x87d9('0x46')]=function(_0x2d4766,_0x384273){return db[_0x87d9('0x40')][_0x87d9('0x46')](_0x2d4766['body'],{})[_0x87d9('0x25')](function(_0x4c521f){var _0x512d91=_0x2d4766[_0x87d9('0x47')][_0x87d9('0x27')]({'plain':!![]});if(!_0x512d91)throw new Error(_0x87d9('0x48'));if(_0x512d91[_0x87d9('0x49')]===_0x87d9('0x47')){var _0x4fdfa9=_0x4c521f[_0x87d9('0x27')]({'plain':!![]});var _0x312973=_0x87d9('0x28');return db[_0x87d9('0x4a')]['find']({'where':{'name':_0x312973,'userProfileId':_0x512d91[_0x87d9('0x4b')]},'raw':!![]})[_0x87d9('0x25')](function(_0x488b38){if(_0x488b38&&_0x488b38['autoAssociation']===0x0){return db[_0x87d9('0x29')][_0x87d9('0x46')]({'name':_0x4fdfa9[_0x87d9('0x2c')],'resourceId':_0x4fdfa9['id'],'type':_0x488b38[_0x87d9('0x2c')],'sectionId':_0x488b38['id']},{})[_0x87d9('0x25')](function(){return _0x4c521f;});}else{return _0x4c521f;}})['catch'](function(_0x3b1409){logger[_0x87d9('0x2a')](_0x87d9('0x4c'),_0x3b1409);throw _0x3b1409;});}return _0x4c521f;})[_0x87d9('0x25')](respondWithResult(_0x384273,0xc9))[_0x87d9('0x42')](handleError(_0x384273,null));};exports[_0x87d9('0x4d')]=function(_0xe1afb4,_0x844e10){var _0x3a89b0={'where':{'id':_0xe1afb4[_0x87d9('0x44')]['id']}},_0x3f4c35={};_0x3f4c35['model']=_[_0x87d9('0x32')](db[_0x87d9('0x40')][_0x87d9('0x2e')]);_0x3a89b0[_0x87d9('0x34')]=_[_0x87d9('0x33')](_0x3f4c35[_0x87d9('0x30')],qs['fields'](_0xe1afb4[_0x87d9('0x31')][_0x87d9('0x35')]));_0x3a89b0['attributes']=_0x3a89b0[_0x87d9('0x34')][_0x87d9('0x36')]?_0x3a89b0[_0x87d9('0x34')]:_0x3f4c35['model'];if(_0xe1afb4[_0x87d9('0x31')][_0x87d9('0x4e')]){_0x3a89b0[_0x87d9('0x41')]=[{'all':!![]}];}_0x3a89b0=_[_0x87d9('0x3d')]({},_0x3a89b0,_0xe1afb4[_0x87d9('0x3f')]);return db[_0x87d9('0x40')]['find'](_0x3a89b0)[_0x87d9('0x25')](handleEntityNotFound(_0x844e10,null))[_0x87d9('0x25')](function(_0x148778){if(_0x148778){var _0x4f7e6c=_0x148778['get']({'plain':!![]});_0x4f7e6c=qs['omit'](_0x4f7e6c,['id','createdAt',_0x87d9('0x4f')]);_0xe1afb4[_0x87d9('0x50')]=_['omit'](_0xe1afb4[_0x87d9('0x50')],['id',_0x87d9('0x51'),_0x87d9('0x4f')]);return db[_0x87d9('0x40')]['create'](_[_0x87d9('0x3d')](_0x4f7e6c,_0xe1afb4[_0x87d9('0x50')]),{'include':_0xe1afb4[_0x87d9('0x31')][_0x87d9('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3df164){var _0x1ea97c=_0xe1afb4[_0x87d9('0x47')][_0x87d9('0x27')]({'plain':!![]});if(!_0x1ea97c)throw new Error(_0x87d9('0x48'));if(_0x1ea97c[_0x87d9('0x49')]===_0x87d9('0x47')){var _0x1231b2=_0x3df164[_0x87d9('0x27')]({'plain':!![]});var _0x47d0da=_0x87d9('0x28');return db[_0x87d9('0x4a')][_0x87d9('0x45')]({'where':{'name':_0x47d0da,'userProfileId':_0x1ea97c[_0x87d9('0x4b')]},'raw':!![]})[_0x87d9('0x25')](function(_0x2c50a0){if(_0x2c50a0&&_0x2c50a0[_0x87d9('0x52')]===0x0){return db['UserProfileResource'][_0x87d9('0x46')]({'name':_0x1231b2[_0x87d9('0x2c')],'resourceId':_0x1231b2['id'],'type':_0x2c50a0[_0x87d9('0x2c')],'sectionId':_0x2c50a0['id']},{})[_0x87d9('0x25')](function(){return _0x3df164;});}else{return _0x3df164;}})[_0x87d9('0x42')](function(_0x458f2a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x458f2a);throw _0x458f2a;});}return _0x3df164;});}})['then'](respondWithResult(_0x844e10,0xc9))['catch'](handleError(_0x844e10,null));};exports[_0x87d9('0x24')]=function(_0x2e90d6,_0x3aae37){if(_0x2e90d6[_0x87d9('0x50')]['id']){delete _0x2e90d6[_0x87d9('0x50')]['id'];}return db[_0x87d9('0x40')]['find']({'where':{'id':_0x2e90d6[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x3aae37,null))[_0x87d9('0x25')](saveUpdates(_0x2e90d6[_0x87d9('0x50')],null))[_0x87d9('0x25')](respondWithResult(_0x3aae37,null))[_0x87d9('0x42')](handleError(_0x3aae37,null));};exports[_0x87d9('0x26')]=function(_0x44c481,_0x3fa1b3){return db[_0x87d9('0x40')][_0x87d9('0x45')]({'where':{'id':_0x44c481['params']['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x3fa1b3,null))[_0x87d9('0x25')](removeEntity(_0x3fa1b3,null))[_0x87d9('0x42')](handleError(_0x3fa1b3,null));};exports[_0x87d9('0x53')]=function(_0x33c258,_0x51f5ee,_0xa4a9d8){var _0x3581e5={'raw':!![],'where':{}};var _0x12da5d={};var _0x42dfbd={'count':0x0,'rows':[]};return db[_0x87d9('0x40')][_0x87d9('0x54')]({'where':{'id':_0x33c258['params']['id']}})['then'](handleEntityNotFound(_0x51f5ee,null))[_0x87d9('0x25')](function(_0x4830d3){if(_0x4830d3){_0x12da5d[_0x87d9('0x30')]=_['keys'](db[_0x87d9('0x55')][_0x87d9('0x2e')]);_0x12da5d[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x33c258[_0x87d9('0x31')]);_0x12da5d['filters']=_[_0x87d9('0x33')](_0x12da5d['model'],_0x12da5d[_0x87d9('0x31')]);_0x3581e5[_0x87d9('0x34')]=_[_0x87d9('0x33')](_0x12da5d[_0x87d9('0x30')],qs[_0x87d9('0x35')](_0x33c258[_0x87d9('0x31')][_0x87d9('0x35')]));_0x3581e5['attributes']=_0x3581e5[_0x87d9('0x34')][_0x87d9('0x36')]?_0x3581e5[_0x87d9('0x34')]:_0x12da5d['model'];if(!_0x33c258['query']['hasOwnProperty']('nolimit')){_0x3581e5[_0x87d9('0x1d')]=qs[_0x87d9('0x1d')](_0x33c258[_0x87d9('0x31')][_0x87d9('0x1d')]);_0x3581e5[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x33c258[_0x87d9('0x31')][_0x87d9('0x1f')]);}_0x3581e5[_0x87d9('0x38')]=qs['sort'](_0x33c258[_0x87d9('0x31')][_0x87d9('0x56')]);_0x3581e5[_0x87d9('0x39')]=qs[_0x87d9('0x3a')](_[_0x87d9('0x3b')](_0x33c258[_0x87d9('0x31')],_0x12da5d[_0x87d9('0x3a')]));_0x3581e5['where']['CampaignId']=_0x4830d3['id'];if(_0x33c258[_0x87d9('0x31')][_0x87d9('0x3c')]){_0x3581e5[_0x87d9('0x39')]=_['merge'](_0x3581e5[_0x87d9('0x39')],{'$or':_['map'](_0x3581e5[_0x87d9('0x34')],function(_0x9e523c){var _0xdd72e5={};_0xdd72e5[_0x9e523c]={'$like':'%'+_0x33c258[_0x87d9('0x31')][_0x87d9('0x3c')]+'%'};return _0xdd72e5;})});}_0x3581e5=_[_0x87d9('0x3d')]({},_0x3581e5,_0x33c258[_0x87d9('0x3f')]);return db[_0x87d9('0x55')][_0x87d9('0x1e')]({'where':_0x3581e5[_0x87d9('0x39')]})[_0x87d9('0x25')](function(_0x6a1d50){_0x42dfbd[_0x87d9('0x1e')]=_0x6a1d50;if(_0x33c258[_0x87d9('0x31')][_0x87d9('0x4e')]){_0x3581e5[_0x87d9('0x41')]=[{'all':!![]}];}return db[_0x87d9('0x55')][_0x87d9('0x57')](_0x3581e5);})[_0x87d9('0x25')](function(_0x268e92){_0x42dfbd['rows']=_0x268e92;return _0x42dfbd;});}})['then'](respondWithFilteredResult(_0x51f5ee,_0x3581e5))[_0x87d9('0x42')](handleError(_0x51f5ee,null));};exports[_0x87d9('0x58')]=function(_0x358df7,_0x32d14d,_0x4d6019){var _0x4338ff={'raw':!![],'where':{}};var _0x201dda={};var _0x3eed2a={'count':0x0,'rows':[]};return db[_0x87d9('0x40')][_0x87d9('0x54')]({'where':{'id':_0x358df7[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x32d14d,null))[_0x87d9('0x25')](function(_0x5b2b17){if(_0x5b2b17){_0x201dda[_0x87d9('0x30')]=_[_0x87d9('0x32')](db[_0x87d9('0x59')][_0x87d9('0x2e')]);_0x201dda['query']=_['keys'](_0x358df7[_0x87d9('0x31')]);_0x201dda[_0x87d9('0x3a')]=_['intersection'](_0x201dda[_0x87d9('0x30')],_0x201dda[_0x87d9('0x31')]);_0x4338ff[_0x87d9('0x34')]=_[_0x87d9('0x33')](_0x201dda[_0x87d9('0x30')],qs[_0x87d9('0x35')](_0x358df7[_0x87d9('0x31')][_0x87d9('0x35')]));_0x4338ff[_0x87d9('0x34')]=_0x4338ff['attributes']['length']?_0x4338ff[_0x87d9('0x34')]:_0x201dda[_0x87d9('0x30')];if(!_0x358df7['query'][_0x87d9('0x5a')](_0x87d9('0x37'))){_0x4338ff[_0x87d9('0x1d')]=qs[_0x87d9('0x1d')](_0x358df7[_0x87d9('0x31')]['limit']);_0x4338ff[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x358df7[_0x87d9('0x31')]['offset']);}_0x4338ff[_0x87d9('0x38')]=qs[_0x87d9('0x56')](_0x358df7[_0x87d9('0x31')][_0x87d9('0x56')]);_0x4338ff[_0x87d9('0x39')]=qs[_0x87d9('0x3a')](_[_0x87d9('0x3b')](_0x358df7[_0x87d9('0x31')],_0x201dda['filters']));_0x4338ff[_0x87d9('0x39')][_0x87d9('0x5b')]=_0x5b2b17['id'];if(_0x358df7[_0x87d9('0x31')]['filter']){_0x4338ff[_0x87d9('0x39')]=_[_0x87d9('0x3d')](_0x4338ff[_0x87d9('0x39')],{'$or':_[_0x87d9('0x2d')](_0x4338ff[_0x87d9('0x34')],function(_0x45374b){var _0x1992f3={};_0x1992f3[_0x45374b]={'$like':'%'+_0x358df7[_0x87d9('0x31')]['filter']+'%'};return _0x1992f3;})});}_0x4338ff=_[_0x87d9('0x3d')]({},_0x4338ff,_0x358df7[_0x87d9('0x3f')]);return db['CmHopperHistory'][_0x87d9('0x1e')]({'where':_0x4338ff[_0x87d9('0x39')]})[_0x87d9('0x25')](function(_0x513817){_0x3eed2a[_0x87d9('0x1e')]=_0x513817;if(_0x358df7[_0x87d9('0x31')][_0x87d9('0x4e')]){_0x4338ff[_0x87d9('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x4338ff);})[_0x87d9('0x25')](function(_0x1b5761){_0x3eed2a['rows']=_0x1b5761;return _0x3eed2a;});}})[_0x87d9('0x25')](respondWithFilteredResult(_0x32d14d,_0x4338ff))['catch'](handleError(_0x32d14d,null));};exports[_0x87d9('0x5c')]=function(_0x142204,_0xbafe03,_0x2d2036){var _0x16d036={'raw':!![],'where':{}};var _0x5098a7={};var _0xebd024={'count':0x0,'rows':[]};return db['Campaign'][_0x87d9('0x54')]({'where':{'id':_0x142204[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0xbafe03,null))[_0x87d9('0x25')](function(_0x2daa30){if(_0x2daa30){_0x5098a7[_0x87d9('0x30')]=_[_0x87d9('0x32')](db['CmHopperFinal']['rawAttributes']);_0x5098a7[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x142204[_0x87d9('0x31')]);_0x5098a7[_0x87d9('0x3a')]=_[_0x87d9('0x33')](_0x5098a7['model'],_0x5098a7[_0x87d9('0x31')]);_0x16d036['attributes']=_[_0x87d9('0x33')](_0x5098a7[_0x87d9('0x30')],qs[_0x87d9('0x35')](_0x142204[_0x87d9('0x31')][_0x87d9('0x35')]));_0x16d036[_0x87d9('0x34')]=_0x16d036[_0x87d9('0x34')]['length']?_0x16d036[_0x87d9('0x34')]:_0x5098a7[_0x87d9('0x30')];if(!_0x142204[_0x87d9('0x31')][_0x87d9('0x5a')](_0x87d9('0x37'))){_0x16d036['limit']=qs[_0x87d9('0x1d')](_0x142204['query'][_0x87d9('0x1d')]);_0x16d036[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x142204[_0x87d9('0x31')][_0x87d9('0x1f')]);}_0x16d036['order']=qs[_0x87d9('0x56')](_0x142204[_0x87d9('0x31')][_0x87d9('0x56')]);_0x16d036[_0x87d9('0x39')]=qs[_0x87d9('0x3a')](_['pick'](_0x142204[_0x87d9('0x31')],_0x5098a7['filters']));_0x16d036['where'][_0x87d9('0x5b')]=_0x2daa30['id'];if(_0x142204[_0x87d9('0x31')][_0x87d9('0x3c')]){_0x16d036['where']=_[_0x87d9('0x3d')](_0x16d036['where'],{'$or':_[_0x87d9('0x2d')](_0x16d036[_0x87d9('0x34')],function(_0x552763){var _0x466cdb={};_0x466cdb[_0x552763]={'$like':'%'+_0x142204[_0x87d9('0x31')][_0x87d9('0x3c')]+'%'};return _0x466cdb;})});}_0x16d036=_[_0x87d9('0x3d')]({},_0x16d036,_0x142204[_0x87d9('0x3f')]);return db[_0x87d9('0x5d')][_0x87d9('0x1e')]({'where':_0x16d036[_0x87d9('0x39')]})[_0x87d9('0x25')](function(_0x18eedc){_0xebd024['count']=_0x18eedc;if(_0x142204['query']['includeAll']){_0x16d036[_0x87d9('0x41')]=[{'all':!![]}];}return db[_0x87d9('0x5d')][_0x87d9('0x57')](_0x16d036);})[_0x87d9('0x25')](function(_0xfe51bd){_0xebd024[_0x87d9('0x5e')]=_0xfe51bd;return _0xebd024;});}})[_0x87d9('0x25')](respondWithFilteredResult(_0xbafe03,_0x16d036))[_0x87d9('0x42')](handleError(_0xbafe03,null));};exports[_0x87d9('0x5f')]=function(_0x3c5cb9,_0x1ee7e9,_0x1dbba1){var _0x1a5f13={'raw':!![],'where':{}};var _0x233e9f={};var _0x2e4a48={'count':0x0,'rows':[]};return db[_0x87d9('0x40')][_0x87d9('0x54')]({'where':{'id':_0x3c5cb9[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x1ee7e9,null))[_0x87d9('0x25')](function(_0x5ce4de){if(_0x5ce4de){_0x233e9f[_0x87d9('0x30')]=_['keys'](db['CmHopperBlack'][_0x87d9('0x2e')]);_0x233e9f[_0x87d9('0x31')]=_['keys'](_0x3c5cb9[_0x87d9('0x31')]);_0x233e9f['filters']=_[_0x87d9('0x33')](_0x233e9f[_0x87d9('0x30')],_0x233e9f['query']);_0x1a5f13['attributes']=_[_0x87d9('0x33')](_0x233e9f[_0x87d9('0x30')],qs[_0x87d9('0x35')](_0x3c5cb9[_0x87d9('0x31')][_0x87d9('0x35')]));_0x1a5f13[_0x87d9('0x34')]=_0x1a5f13[_0x87d9('0x34')][_0x87d9('0x36')]?_0x1a5f13[_0x87d9('0x34')]:_0x233e9f[_0x87d9('0x30')];if(!_0x3c5cb9['query'][_0x87d9('0x5a')](_0x87d9('0x37'))){_0x1a5f13[_0x87d9('0x1d')]=qs[_0x87d9('0x1d')](_0x3c5cb9[_0x87d9('0x31')][_0x87d9('0x1d')]);_0x1a5f13[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x3c5cb9[_0x87d9('0x31')][_0x87d9('0x1f')]);}_0x1a5f13[_0x87d9('0x38')]=qs[_0x87d9('0x56')](_0x3c5cb9[_0x87d9('0x31')][_0x87d9('0x56')]);_0x1a5f13[_0x87d9('0x39')]=qs['filters'](_[_0x87d9('0x3b')](_0x3c5cb9[_0x87d9('0x31')],_0x233e9f['filters']));_0x1a5f13[_0x87d9('0x39')][_0x87d9('0x5b')]=_0x5ce4de['id'];if(_0x3c5cb9[_0x87d9('0x31')]['filter']){_0x1a5f13[_0x87d9('0x39')]=_[_0x87d9('0x3d')](_0x1a5f13[_0x87d9('0x39')],{'$or':_[_0x87d9('0x2d')](_0x1a5f13[_0x87d9('0x34')],function(_0x1c845c){var _0x3bfb38={};_0x3bfb38[_0x1c845c]={'$like':'%'+_0x3c5cb9['query']['filter']+'%'};return _0x3bfb38;})});}_0x1a5f13=_['merge']({},_0x1a5f13,_0x3c5cb9[_0x87d9('0x3f')]);return db[_0x87d9('0x60')][_0x87d9('0x1e')]({'where':_0x1a5f13[_0x87d9('0x39')]})['then'](function(_0x7d54b8){_0x2e4a48[_0x87d9('0x1e')]=_0x7d54b8;if(_0x3c5cb9[_0x87d9('0x31')][_0x87d9('0x4e')]){_0x1a5f13['include']=[{'all':!![]}];}return db[_0x87d9('0x60')][_0x87d9('0x57')](_0x1a5f13);})[_0x87d9('0x25')](function(_0x1d67e1){_0x2e4a48['rows']=_0x1d67e1;return _0x2e4a48;});}})[_0x87d9('0x25')](respondWithFilteredResult(_0x1ee7e9,_0x1a5f13))[_0x87d9('0x42')](handleError(_0x1ee7e9,null));};exports[_0x87d9('0x61')]=function(_0x346298,_0x1c720d,_0x2b59c8){var _0x3f2b45={};var _0x3df0e9={};var _0x551439;var _0x23b31e;return db['Campaign']['findOne']({'where':{'id':_0x346298[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x1c720d,null))[_0x87d9('0x25')](function(_0x5a4a18){if(_0x5a4a18){_0x551439=_0x5a4a18;_0x3df0e9['model']=_[_0x87d9('0x32')](db[_0x87d9('0x62')][_0x87d9('0x2e')]);_0x3df0e9[_0x87d9('0x31')]=_[_0x87d9('0x32')](_0x346298[_0x87d9('0x31')]);_0x3df0e9[_0x87d9('0x3a')]=_[_0x87d9('0x33')](_0x3df0e9['model'],_0x3df0e9[_0x87d9('0x31')]);_0x3f2b45[_0x87d9('0x34')]=_[_0x87d9('0x33')](_0x3df0e9['model'],qs[_0x87d9('0x35')](_0x346298['query'][_0x87d9('0x35')]));_0x3f2b45[_0x87d9('0x34')]=_0x3f2b45[_0x87d9('0x34')][_0x87d9('0x36')]?_0x3f2b45[_0x87d9('0x34')]:_0x3df0e9[_0x87d9('0x30')];_0x3f2b45[_0x87d9('0x38')]=qs[_0x87d9('0x56')](_0x346298[_0x87d9('0x31')]['sort']);_0x3f2b45['where']=qs['filters'](_[_0x87d9('0x3b')](_0x346298['query'],_0x3df0e9[_0x87d9('0x3a')]));if(_0x346298[_0x87d9('0x31')][_0x87d9('0x3c')]){_0x3f2b45[_0x87d9('0x39')]=_['merge'](_0x3f2b45[_0x87d9('0x39')],{'$or':_[_0x87d9('0x2d')](_0x3f2b45[_0x87d9('0x34')],function(_0x3e08c){var _0x496fc4={};_0x496fc4[_0x3e08c]={'$like':'%'+_0x346298[_0x87d9('0x31')][_0x87d9('0x3c')]+'%'};return _0x496fc4;})});}_0x3f2b45=_[_0x87d9('0x3d')]({},_0x3f2b45,_0x346298[_0x87d9('0x3f')]);return _0x551439['getLists'](_0x3f2b45);}})[_0x87d9('0x25')](function(_0x2a620c){if(_0x2a620c){_0x23b31e=_0x2a620c[_0x87d9('0x36')];if(!_0x346298['query'][_0x87d9('0x5a')](_0x87d9('0x37'))){_0x3f2b45['limit']=qs[_0x87d9('0x1d')](_0x346298[_0x87d9('0x31')][_0x87d9('0x1d')]);_0x3f2b45[_0x87d9('0x1f')]=qs[_0x87d9('0x1f')](_0x346298['query'][_0x87d9('0x1f')]);}return _0x551439[_0x87d9('0x61')](_0x3f2b45);}})[_0x87d9('0x25')](function(_0xfcfe6b){if(_0xfcfe6b){return _0xfcfe6b?{'count':_0x23b31e,'rows':_0xfcfe6b}:null;}})[_0x87d9('0x25')](respondWithResult(_0x1c720d,null))['catch'](handleError(_0x1c720d,null));};exports['addLists']=function(_0x28aeb0,_0x1e2f16,_0x4d4db1){var _0x260b74,_0x5a39a5;var _0x145692=[];var _0x2395f3=moment()[_0x87d9('0x63')](_0x87d9('0x64'));return db[_0x87d9('0x40')][_0x87d9('0x45')]({'where':{'id':_0x28aeb0[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x1e2f16,null))[_0x87d9('0x25')](function(_0x3d3037){if(_0x3d3037){_0x5a39a5=_0x3d3037;return _0x3d3037['addLists'](_0x28aeb0[_0x87d9('0x50')][_0x87d9('0x65')],_['omit'](_0x28aeb0[_0x87d9('0x50')],[_0x87d9('0x65'),'id'])||{});}return null;})[_0x87d9('0x66')](function(_0xd4196f){var _0x38db86;var _0xc8b3fe;_0x260b74=_0xd4196f||[];var _0x41755e=[];if(_0xd4196f){for(var _0x160fa4=0x0;_0x160fa4<_0xd4196f[_0x87d9('0x36')];_0x160fa4+=0x1){var _0xb0ba23=_0xd4196f[_0x160fa4][_0x87d9('0x27')]({'plain':!![]});_0x5a39a5[_0x87d9('0x67')]=_0x28aeb0['body'][_0x87d9('0x67')]?_0x28aeb0[_0x87d9('0x50')][_0x87d9('0x67')]:_0x5a39a5['dialCheckDuplicateType'];switch(_0x5a39a5['dialCheckDuplicateType']){case _0x87d9('0x68'):_0x38db86=squel['insert']()[_0x87d9('0x69')]('cm_hopper')['fromQuery']([_0x87d9('0x6a'),_0x87d9('0x6b'),_0x87d9('0x6c'),_0x87d9('0x6d'),_0x87d9('0x5b'),'createdAt','updatedAt'],squel[_0x87d9('0x6e')]()[_0x87d9('0x6f')](_0x87d9('0x6a'),_0x87d9('0x6a'))['field']('NOW()',_0x87d9('0x6b'))[_0x87d9('0x6f')]('id',_0x87d9('0x6c'))[_0x87d9('0x6f')](_0xb0ba23[_0x87d9('0x70')]['toString'](),'ListId')[_0x87d9('0x6f')](_0x28aeb0['params']['id']['toString'](),'CampaignId')[_0x87d9('0x6f')]('\x27'+_0x2395f3+'\x27','createdAt')[_0x87d9('0x6f')]('\x27'+_0x2395f3+'\x27',_0x87d9('0x4f'))[_0x87d9('0x71')](_0x87d9('0x72'))[_0x87d9('0x39')](_0x87d9('0x73'))[_0x87d9('0x39')]('ListId\x20=\x20?',_0xb0ba23[_0x87d9('0x70')][_0x87d9('0x74')]())[_0x87d9('0x39')](_0x87d9('0x75'))[_0x87d9('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x87d9('0x6e')]()[_0x87d9('0x6f')](_0x87d9('0x76'))[_0x87d9('0x71')](_0x87d9('0x77'))[_0x87d9('0x39')](_0x87d9('0x78'),_0x28aeb0[_0x87d9('0x44')]['id'][_0x87d9('0x74')]()))[_0x87d9('0x39')](_0x87d9('0x79'),squel[_0x87d9('0x6e')]()[_0x87d9('0x6f')]('COALESCE(phone,\x27\x27)')['from'](_0x87d9('0x7a'))['where'](_0x87d9('0x78'),_0x28aeb0[_0x87d9('0x44')]['id']['toString']())))[_0x87d9('0x74')]();break;case _0x87d9('0x7b'):_0x38db86=squel['insert']()[_0x87d9('0x69')]('cm_hopper')[_0x87d9('0x7c')]([_0x87d9('0x6a'),'scheduledAt',_0x87d9('0x6c'),_0x87d9('0x6d'),_0x87d9('0x5b'),'createdAt','updatedAt'],squel['select']()[_0x87d9('0x6f')](_0x87d9('0x6a'),_0x87d9('0x6a'))[_0x87d9('0x6f')](_0x87d9('0x7d'),_0x87d9('0x6b'))['field']('id',_0x87d9('0x6c'))[_0x87d9('0x6f')](_0xb0ba23['CmListId'][_0x87d9('0x74')](),_0x87d9('0x6d'))[_0x87d9('0x6f')](_0x28aeb0[_0x87d9('0x44')]['id'][_0x87d9('0x74')](),_0x87d9('0x5b'))[_0x87d9('0x6f')]('\x27'+_0x2395f3+'\x27',_0x87d9('0x51'))['field']('\x27'+_0x2395f3+'\x27',_0x87d9('0x4f'))[_0x87d9('0x71')]('cm_contacts')[_0x87d9('0x39')](_0x87d9('0x73'))['where']('ListId\x20=\x20?',_0xb0ba23['CmListId'][_0x87d9('0x74')]())[_0x87d9('0x39')](_0x87d9('0x75'))[_0x87d9('0x39')](_0x87d9('0x79'),squel[_0x87d9('0x6e')]()['field']('COALESCE(phone,\x27\x27)')[_0x87d9('0x71')](_0x87d9('0x7a'))['where']('CampaignId\x20=\x20?',_0x28aeb0[_0x87d9('0x44')]['id'][_0x87d9('0x74')]())))[_0x87d9('0x74')]();break;default:_0x38db86=squel[_0x87d9('0x7e')]()[_0x87d9('0x69')](_0x87d9('0x7a'))[_0x87d9('0x7c')]([_0x87d9('0x6a'),_0x87d9('0x6b'),_0x87d9('0x6c'),_0x87d9('0x6d'),_0x87d9('0x5b'),_0x87d9('0x51'),'updatedAt'],squel['select']()[_0x87d9('0x6f')]('phone',_0x87d9('0x6a'))[_0x87d9('0x6f')](_0x87d9('0x7d'),_0x87d9('0x6b'))['field']('id',_0x87d9('0x6c'))[_0x87d9('0x6f')](_0xb0ba23['CmListId']['toString'](),'ListId')[_0x87d9('0x6f')](_0x28aeb0[_0x87d9('0x44')]['id']['toString'](),_0x87d9('0x5b'))[_0x87d9('0x6f')]('\x27'+_0x2395f3+'\x27',_0x87d9('0x51'))['field']('\x27'+_0x2395f3+'\x27','updatedAt')['from'](_0x87d9('0x72'))[_0x87d9('0x39')]('deletedAt\x20IS\x20NULL')[_0x87d9('0x39')](_0x87d9('0x7f'),_0xb0ba23[_0x87d9('0x70')][_0x87d9('0x74')]())[_0x87d9('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x87d9('0x74')]();}_0xc8b3fe=squel[_0x87d9('0x7e')]()['into']('cm_hopper_additional_phones')[_0x87d9('0x7c')]([_0x87d9('0x80'),_0x87d9('0x6b'),_0x87d9('0x6a'),_0x87d9('0x81'),_0x87d9('0x51'),_0x87d9('0x4f')],squel['select']()[_0x87d9('0x6f')](_0x87d9('0x82'),'id')['field'](_0x87d9('0x7d'),_0x87d9('0x6b'))[_0x87d9('0x6f')](_0x87d9('0x83'),_0x87d9('0x6a'))['field'](_0x87d9('0x84'),'OrderBy')[_0x87d9('0x6f')]('\x27'+_0x2395f3+'\x27','createdAt')[_0x87d9('0x6f')]('\x27'+_0x2395f3+'\x27',_0x87d9('0x4f'))[_0x87d9('0x71')](_0x87d9('0x85'),'ci')['join'](_0x87d9('0x7a'),'h',_0x87d9('0x86'))[_0x87d9('0x39')](_0x87d9('0x87'),_0xb0ba23['CmListId'][_0x87d9('0x74')]())[_0x87d9('0x39')](_0x87d9('0x88'),_0x28aeb0[_0x87d9('0x44')]['id']['toString']())[_0x87d9('0x39')](_0x87d9('0x89'),_0x2395f3))[_0x87d9('0x74')]();_0x41755e[_0x87d9('0x8a')](db['sequelize'][_0x87d9('0x31')](_0x38db86));_0x145692['push'](db[_0x87d9('0x8b')][_0x87d9('0x31')](_0xc8b3fe));}return BPromise['all'](_0x41755e);}})[_0x87d9('0x25')](function(){return BPromise[_0x87d9('0x8c')](_0x145692);})[_0x87d9('0x25')](function(){return _0x260b74;})[_0x87d9('0x25')](respondWithResult(_0x1e2f16,null))[_0x87d9('0x42')](handleError(_0x1e2f16,null));};exports['removeLists']=function(_0x480f61,_0x486195,_0x4756c9){return db[_0x87d9('0x40')][_0x87d9('0x45')]({'where':{'id':_0x480f61[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x486195,null))[_0x87d9('0x25')](function(_0x3d8401){if(_0x3d8401){return _0x3d8401[_0x87d9('0x8d')](_0x480f61[_0x87d9('0x31')]['ids']);}})[_0x87d9('0x25')](function(_0x5df747){if(_0x5df747){return db[_0x87d9('0x55')][_0x87d9('0x26')]({'where':{'ListId':_0x480f61['query']['ids'],'CampaignId':_0x480f61[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](function(){return _0x5df747;});}})['then'](respondWithStatusCode(_0x486195,null))[_0x87d9('0x42')](handleError(_0x486195,null));};exports['getBlackLists']=function(_0x37649a,_0x206f02,_0x26c1bd){var _0x4a093c={};var _0x45af09={};var _0x1b2044;var _0x5e0524;return db[_0x87d9('0x40')]['findOne']({'where':{'id':_0x37649a[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x206f02,null))['then'](function(_0x3e5c05){if(_0x3e5c05){_0x1b2044=_0x3e5c05;_0x45af09[_0x87d9('0x30')]=_[_0x87d9('0x32')](db['CmList']['rawAttributes']);_0x45af09[_0x87d9('0x31')]=_['keys'](_0x37649a['query']);_0x45af09['filters']=_[_0x87d9('0x33')](_0x45af09[_0x87d9('0x30')],_0x45af09[_0x87d9('0x31')]);_0x4a093c['attributes']=_['intersection'](_0x45af09[_0x87d9('0x30')],qs[_0x87d9('0x35')](_0x37649a[_0x87d9('0x31')][_0x87d9('0x35')]));_0x4a093c[_0x87d9('0x34')]=_0x4a093c[_0x87d9('0x34')][_0x87d9('0x36')]?_0x4a093c[_0x87d9('0x34')]:_0x45af09['model'];_0x4a093c[_0x87d9('0x38')]=qs[_0x87d9('0x56')](_0x37649a[_0x87d9('0x31')][_0x87d9('0x56')]);_0x4a093c[_0x87d9('0x39')]=qs[_0x87d9('0x3a')](_['pick'](_0x37649a['query'],_0x45af09[_0x87d9('0x3a')]));if(_0x37649a[_0x87d9('0x31')][_0x87d9('0x3c')]){_0x4a093c[_0x87d9('0x39')]=_[_0x87d9('0x3d')](_0x4a093c[_0x87d9('0x39')],{'$or':_[_0x87d9('0x2d')](_0x4a093c['attributes'],function(_0x53d061){var _0x4a4b24={};_0x4a4b24[_0x53d061]={'$like':'%'+_0x37649a[_0x87d9('0x31')][_0x87d9('0x3c')]+'%'};return _0x4a4b24;})});}_0x4a093c=_['merge']({},_0x4a093c,_0x37649a['options']);return _0x1b2044[_0x87d9('0x8e')](_0x4a093c);}})[_0x87d9('0x25')](function(_0x4d5d5f){if(_0x4d5d5f){_0x5e0524=_0x4d5d5f['length'];if(!_0x37649a['query'][_0x87d9('0x5a')](_0x87d9('0x37'))){_0x4a093c[_0x87d9('0x1d')]=qs[_0x87d9('0x1d')](_0x37649a[_0x87d9('0x31')][_0x87d9('0x1d')]);_0x4a093c[_0x87d9('0x1f')]=qs['offset'](_0x37649a['query'][_0x87d9('0x1f')]);}return _0x1b2044['getBlackLists'](_0x4a093c);}})[_0x87d9('0x25')](function(_0x1a2a56){if(_0x1a2a56){return _0x1a2a56?{'count':_0x5e0524,'rows':_0x1a2a56}:null;}})[_0x87d9('0x25')](respondWithResult(_0x206f02,null))[_0x87d9('0x42')](handleError(_0x206f02,null));};exports[_0x87d9('0x8f')]=function(_0x53f7a6,_0x350283,_0x4fb821){var _0xd291f4,_0x22f4f3;var _0x34986c=[];var _0x38e55b=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x87d9('0x40')][_0x87d9('0x45')]({'where':{'id':_0x53f7a6[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x350283,null))[_0x87d9('0x25')](function(_0x23dce8){if(_0x23dce8){_0x22f4f3=_0x23dce8;return _0x23dce8[_0x87d9('0x8f')](_0x53f7a6[_0x87d9('0x50')][_0x87d9('0x65')],_[_0x87d9('0x90')](_0x53f7a6[_0x87d9('0x50')],['ids','id'])||{});}return null;})[_0x87d9('0x66')](function(_0x4e2369){var _0x202cb6;var _0xc56fcd;_0xd291f4=_0x4e2369||[];var _0x19ba02=[];if(_0x4e2369){for(var _0x2ebf9b=0x0;_0x2ebf9b<_0x4e2369[_0x87d9('0x36')];_0x2ebf9b+=0x1){var _0x1d4901=_0x4e2369[_0x2ebf9b][_0x87d9('0x27')]({'plain':!![]});_0x202cb6=squel[_0x87d9('0x7e')]()[_0x87d9('0x69')]('cm_hopper_black')[_0x87d9('0x7c')](['phone',_0x87d9('0x6c'),'ListId','CampaignId',_0x87d9('0x51'),_0x87d9('0x4f')],squel[_0x87d9('0x6e')]()[_0x87d9('0x6f')](_0x87d9('0x6a'),_0x87d9('0x6a'))[_0x87d9('0x6f')]('id',_0x87d9('0x6c'))[_0x87d9('0x6f')](_0x1d4901[_0x87d9('0x70')][_0x87d9('0x74')](),_0x87d9('0x6d'))[_0x87d9('0x6f')](_0x53f7a6['params']['id'][_0x87d9('0x74')](),_0x87d9('0x5b'))[_0x87d9('0x6f')]('NOW()',_0x87d9('0x51'))[_0x87d9('0x6f')](_0x87d9('0x7d'),_0x87d9('0x4f'))['from'](_0x87d9('0x72'))[_0x87d9('0x39')]('deletedAt\x20IS\x20NULL')['where'](_0x87d9('0x7f'),_0x1d4901['CmListId']['toString']())[_0x87d9('0x39')](_0x87d9('0x75')))[_0x87d9('0x74')]();_0x19ba02[_0x87d9('0x8a')](db[_0x87d9('0x8b')]['query'](_0x202cb6));}return BPromise[_0x87d9('0x8c')](_0x19ba02);}})[_0x87d9('0x25')](function(){return _0xd291f4;})['then'](respondWithResult(_0x350283,null))[_0x87d9('0x42')](handleError(_0x350283,null));};exports[_0x87d9('0x91')]=function(_0xec1a42,_0x45a3e2,_0x185e57){return db['Campaign'][_0x87d9('0x45')]({'where':{'id':_0xec1a42[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x45a3e2,null))[_0x87d9('0x25')](function(_0x146efa){if(_0x146efa){return _0x146efa['removeBlackLists'](_0xec1a42['query']['ids']);}})[_0x87d9('0x25')](function(_0x2605a5){if(_0x2605a5){return db['CmHopperBlack'][_0x87d9('0x26')]({'where':{'ListId':_0xec1a42[_0x87d9('0x31')][_0x87d9('0x65')],'CampaignId':_0xec1a42[_0x87d9('0x44')]['id']}})[_0x87d9('0x25')](function(){return _0x2605a5;});}})[_0x87d9('0x25')](respondWithStatusCode(_0x45a3e2,null))[_0x87d9('0x42')](handleError(_0x45a3e2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 0dad61f..985ef4d 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(_0x2aeb58,_0x575b09){var _0x1f5acc=function(_0x31c0e1){while(--_0x31c0e1){_0x2aeb58['push'](_0x2aeb58['shift']());}};_0x1f5acc(++_0x575b09);}(_0x7a54,0x106));var _0x47a5=function(_0x4205ee,_0x515e2a){_0x4205ee=_0x4205ee-0x0;var _0xd9101d=_0x7a54[_0x4205ee];return _0xd9101d;};'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(_0x35d06a,_0x81abc0){var _0x3cf8a5=function(_0x2693f){while(--_0x2693f){_0x35d06a['push'](_0x35d06a['shift']());}};_0x3cf8a5(++_0x81abc0);}(_0x7a54,0x106));var _0x47a5=function(_0x58a0b0,_0xfa8195){_0x58a0b0=_0x58a0b0-0x0;var _0x327946=_0x7a54[_0x58a0b0];return _0x327946;};'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 2479b47..40d603a 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 _0x80df=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCampaign','Campaign','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment'];(function(_0x2dd86b,_0x18a5c0){var _0x250064=function(_0x2d19cd){while(--_0x2d19cd){_0x2dd86b['push'](_0x2dd86b['shift']());}};_0x250064(++_0x18a5c0);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var moment=require(_0xf80d('0x2'));var BPromise=require(_0xf80d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80d('0x4'));var db=require(_0xf80d('0x5'))['db'];var utils=require(_0xf80d('0x6'));var logger=require(_0xf80d('0x7'))(_0xf80d('0x8'));var config=require(_0xf80d('0x9'));var jayson=require(_0xf80d('0xa'));var client=jayson[_0xf80d('0xb')][_0xf80d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62e50f,_0x5068d4,_0x30e2b3){return new BPromise(function(_0x16b219,_0x2f56b3){return client[_0xf80d('0xd')](_0x62e50f,_0x30e2b3)[_0xf80d('0xe')](function(_0x186339){logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));logger[_0xf80d('0x12')](_0xf80d('0x13'),_0x5068d4,_0xf80d('0x11'),JSON[_0xf80d('0x14')](_0x186339));if(_0x186339[_0xf80d('0x15')]){if(_0x186339['error']['code']===0x1f4){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x2f56b3(_0x186339['error'][_0xf80d('0x16')]);}logger['error'](_0xf80d('0x10'),_0x5068d4,_0x186339['error'][_0xf80d('0x16')]);return _0x16b219(_0x186339[_0xf80d('0x15')][_0xf80d('0x16')]);}else{logger[_0xf80d('0xf')](_0xf80d('0x10'),_0x5068d4,_0xf80d('0x11'));_0x16b219(_0x186339[_0xf80d('0x17')][_0xf80d('0x16')]);}})[_0xf80d('0x18')](function(_0x3b8a82){logger[_0xf80d('0x15')](_0xf80d('0x10'),_0x5068d4,_0x3b8a82);_0x2f56b3(_0x3b8a82);});});}exports[_0xf80d('0x19')]=function(_0x1d104a){var _0x34b49d=this;return new Promise(function(_0x2ea2c1,_0x7ba89c){return db[_0xf80d('0x1a')][_0xf80d('0x1b')]({'raw':_0x1d104a['options']?_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x1d')]===undefined?!![]:![]:!![],'where':_0x1d104a['options']?_0x1d104a[_0xf80d('0x1c')]['where']||null:null,'attributes':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x1e')]||null:null,'limit':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x1f')]||null:null,'include':_0x1d104a[_0xf80d('0x1c')]?_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x20')]?_[_0xf80d('0x21')](_0x1d104a[_0xf80d('0x1c')][_0xf80d('0x20')],function(_0x570c99){return{'model':db[_0x570c99[_0xf80d('0x22')]],'as':_0x570c99['as'],'attributes':_0x570c99[_0xf80d('0x1e')],'include':_0x570c99['include']?_[_0xf80d('0x21')](_0x570c99[_0xf80d('0x20')],function(_0x323540){return{'model':db[_0x323540[_0xf80d('0x22')]],'as':_0x323540['as'],'attributes':_0x323540['attributes'],'include':_0x323540[_0xf80d('0x20')]?_[_0xf80d('0x21')](_0x323540[_0xf80d('0x20')],function(_0x2a4597){return{'model':db[_0x2a4597[_0xf80d('0x22')]],'as':_0x2a4597['as'],'attributes':_0x2a4597[_0xf80d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf80d('0xe')](function(_0x68f2c6){logger[_0xf80d('0xf')]('GetCampaign',_0x1d104a);logger[_0xf80d('0x12')](_0xf80d('0x19'),_0x1d104a,JSON[_0xf80d('0x14')](_0x68f2c6));_0x2ea2c1(_0x68f2c6);})[_0xf80d('0x18')](function(_0x3ce924){logger[_0xf80d('0x15')](_0xf80d('0x19'),_0x3ce924['message'],_0x1d104a);_0x7ba89c(_0x34b49d[_0xf80d('0x15')](0x1f4,_0x3ce924[_0xf80d('0x16')]));});});}; \ No newline at end of file +var _0x59c3=['rpc','../../config/environment','jayson/promise','client','request','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4a8f7a,_0x2ed331){var _0x5ae124=function(_0xf39599){while(--_0xf39599){_0x4a8f7a['push'](_0x4a8f7a['shift']());}};_0x5ae124(++_0x2ed331);}(_0x59c3,0x133));var _0x359c=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x59c3[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var moment=require(_0x359c('0x2'));var BPromise=require(_0x359c('0x3'));var rs=require(_0x359c('0x4'));var fs=require('fs');var Redis=require(_0x359c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x359c('0x6'));var logger=require(_0x359c('0x7'))(_0x359c('0x8'));var config=require(_0x359c('0x9'));var jayson=require(_0x359c('0xa'));var client=jayson[_0x359c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9c107b,_0x58b390,_0x3a7d8e){return new BPromise(function(_0x335963,_0x44ae3a){return client[_0x359c('0xc')](_0x9c107b,_0x3a7d8e)['then'](function(_0x1fb4c8){logger['info'](_0x359c('0xd'),_0x58b390,_0x359c('0xe'));logger[_0x359c('0xf')](_0x359c('0x10'),_0x58b390,_0x359c('0xe'),JSON[_0x359c('0x11')](_0x1fb4c8));if(_0x1fb4c8['error']){if(_0x1fb4c8[_0x359c('0x12')][_0x359c('0x13')]===0x1f4){logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);return _0x44ae3a(_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);}logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x1fb4c8[_0x359c('0x12')][_0x359c('0x14')]);return _0x335963(_0x1fb4c8['error'][_0x359c('0x14')]);}else{logger[_0x359c('0x15')]('Campaign,\x20%s,\x20%s',_0x58b390,_0x359c('0xe'));_0x335963(_0x1fb4c8[_0x359c('0x16')][_0x359c('0x14')]);}})[_0x359c('0x17')](function(_0x421bab){logger[_0x359c('0x12')](_0x359c('0xd'),_0x58b390,_0x421bab);_0x44ae3a(_0x421bab);});});}exports[_0x359c('0x18')]=function(_0x2931eb){var _0x27ad53=this;return new Promise(function(_0x2bdd3c,_0x2ae8ee){return db[_0x359c('0x19')][_0x359c('0x1a')]({'raw':_0x2931eb[_0x359c('0x1b')]?_0x2931eb[_0x359c('0x1b')][_0x359c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2931eb[_0x359c('0x1b')]?_0x2931eb['options'][_0x359c('0x1d')]||null:null,'attributes':_0x2931eb['options']?_0x2931eb[_0x359c('0x1b')]['attributes']||null:null,'limit':_0x2931eb[_0x359c('0x1b')]?_0x2931eb[_0x359c('0x1b')][_0x359c('0x1e')]||null:null,'include':_0x2931eb[_0x359c('0x1b')]?_0x2931eb[_0x359c('0x1b')][_0x359c('0x1f')]?_[_0x359c('0x20')](_0x2931eb[_0x359c('0x1b')][_0x359c('0x1f')],function(_0x1d29df){return{'model':db[_0x1d29df[_0x359c('0x21')]],'as':_0x1d29df['as'],'attributes':_0x1d29df[_0x359c('0x22')],'include':_0x1d29df[_0x359c('0x1f')]?_[_0x359c('0x20')](_0x1d29df[_0x359c('0x1f')],function(_0xf6f24){return{'model':db[_0xf6f24['model']],'as':_0xf6f24['as'],'attributes':_0xf6f24[_0x359c('0x22')],'include':_0xf6f24[_0x359c('0x1f')]?_[_0x359c('0x20')](_0xf6f24['include'],function(_0x1436a8){return{'model':db[_0x1436a8[_0x359c('0x21')]],'as':_0x1436a8['as'],'attributes':_0x1436a8[_0x359c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a174a){logger['info'](_0x359c('0x18'),_0x2931eb);logger[_0x359c('0xf')](_0x359c('0x18'),_0x2931eb,JSON[_0x359c('0x11')](_0x1a174a));_0x2bdd3c(_0x1a174a);})['catch'](function(_0x2e42f6){logger[_0x359c('0x12')](_0x359c('0x18'),_0x2e42f6[_0x359c('0x14')],_0x2931eb);_0x2ae8ee(_0x27ad53[_0x359c('0x12')](0x1f4,_0x2e42f6[_0x359c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 10f52b4..b50640c 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 _0x4c3c=['destroy','removeBlackLists','exports','multer','util','connect-timeout','fs-extra','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete'];(function(_0x12cda1,_0x32d850){var _0x212433=function(_0x4a2e7c){while(--_0x4a2e7c){_0x12cda1['push'](_0x12cda1['shift']());}};_0x212433(++_0x32d850);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0x1507b8,_0x43e312){_0x1507b8=_0x1507b8-0x0;var _0x1f6792=_0x4c3c[_0x1507b8];return _0x1f6792;};'use strict';var multer=require(_0xc4c3('0x0'));var util=require(_0xc4c3('0x1'));var path=require('path');var timeout=require(_0xc4c3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc4c3('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc4c3('0x4'));var controller=require(_0xc4c3('0x5'));router[_0xc4c3('0x6')]('/',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x8')]);router[_0xc4c3('0x6')](_0xc4c3('0x9'),auth['isAuthenticated'](),controller[_0xc4c3('0xa')]);router[_0xc4c3('0x6')]('/:id/hoppers',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0xb')]);router[_0xc4c3('0x6')](_0xc4c3('0xc'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0xd')]);router[_0xc4c3('0x6')](_0xc4c3('0xe'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0xf')]);router['get'](_0xc4c3('0x10'),auth['isAuthenticated'](),controller[_0xc4c3('0x11')]);router['get'](_0xc4c3('0x12'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x13')]);router['get'](_0xc4c3('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xc4c3('0x15')]('/',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x16')]);router[_0xc4c3('0x15')](_0xc4c3('0x17'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x18')]);router[_0xc4c3('0x15')]('/:id/lists',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x19')]);router['post'](_0xc4c3('0x14'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x1a')]);router['put']('/:id',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x1b')]);router[_0xc4c3('0x1c')](_0xc4c3('0x9'),auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x1d')]);router[_0xc4c3('0x1c')]('/:id/lists',auth['isAuthenticated'](),controller['removeLists']);router[_0xc4c3('0x1c')]('/:id/blacklists',auth[_0xc4c3('0x7')](),controller[_0xc4c3('0x1e')]);module[_0xc4c3('0x1f')]=router; \ No newline at end of file +var _0x32c2=['show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','addLists','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id'];(function(_0x57c314,_0x567b0f){var _0x22eb95=function(_0x364f8a){while(--_0x364f8a){_0x57c314['push'](_0x57c314['shift']());}};_0x22eb95(++_0x567b0f);}(_0x32c2,0x90));var _0x232c=function(_0xee1c83,_0x11ad1d){_0xee1c83=_0xee1c83-0x0;var _0x4c03c2=_0x32c2[_0xee1c83];return _0x4c03c2;};'use strict';var multer=require(_0x232c('0x0'));var util=require(_0x232c('0x1'));var path=require(_0x232c('0x2'));var timeout=require(_0x232c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x232c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x232c('0x5'));var controller=require(_0x232c('0x6'));router[_0x232c('0x7')]('/',auth[_0x232c('0x8')](),controller[_0x232c('0x9')]);router[_0x232c('0x7')](_0x232c('0xa'),auth[_0x232c('0x8')](),controller[_0x232c('0xb')]);router[_0x232c('0x7')](_0x232c('0xc'),auth[_0x232c('0x8')](),controller[_0x232c('0xd')]);router[_0x232c('0x7')](_0x232c('0xe'),auth['isAuthenticated'](),controller[_0x232c('0xf')]);router[_0x232c('0x7')]('/:id/hopper_finals',auth[_0x232c('0x8')](),controller['getHopperFinals']);router[_0x232c('0x7')](_0x232c('0x10'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x232c('0x7')](_0x232c('0x11'),auth[_0x232c('0x8')](),controller[_0x232c('0x12')]);router[_0x232c('0x7')](_0x232c('0x13'),auth[_0x232c('0x8')](),controller[_0x232c('0x14')]);router[_0x232c('0x15')]('/',auth[_0x232c('0x8')](),controller['create']);router[_0x232c('0x15')]('/:id/clone',auth[_0x232c('0x8')](),controller['clone']);router[_0x232c('0x15')]('/:id/lists',auth[_0x232c('0x8')](),controller[_0x232c('0x16')]);router[_0x232c('0x15')]('/:id/blacklists',auth[_0x232c('0x8')](),controller[_0x232c('0x17')]);router[_0x232c('0x18')](_0x232c('0xa'),auth['isAuthenticated'](),controller[_0x232c('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x232c('0x1a')]);router[_0x232c('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0x232c('0x1c')]);router[_0x232c('0x1b')](_0x232c('0x13'),auth[_0x232c('0x8')](),controller[_0x232c('0x1d')]);module[_0x232c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 8e43748..f240770 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 _0x84f3=['sequelize','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x3d29af,_0x3bfbaf){var _0x16812b=function(_0xa0a055){while(--_0xa0a055){_0x3d29af['push'](_0x3d29af['shift']());}};_0x16812b(++_0x3bfbaf);}(_0x84f3,0x114));var _0x384f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x84f3[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x384f('0x0'));module['exports']={'key':{'type':Sequelize[_0x384f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x384f('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x384f('0x3')],'get':function(){return this[_0x384f('0x4')](_0x384f('0x5'));}}}; \ No newline at end of file +var _0xd90e=['VIRTUAL','getDataValue','key','exports','STRING','TEXT'];(function(_0x4b299d,_0x146f28){var _0x27abaf=function(_0x15998e){while(--_0x15998e){_0x4b299d['push'](_0x4b299d['shift']());}};_0x27abaf(++_0x146f28);}(_0xd90e,0x7b));var _0xed90=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd90e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xed90('0x0')]={'key':{'type':Sequelize[_0xed90('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xed90('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xed90('0x1')]},'name':{'type':Sequelize[_0xed90('0x3')],'get':function(){return this[_0xed90('0x4')](_0xed90('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index d93738f..61165a7 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 _0x9525=['key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CannedAnswers','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','CannedAnswer','fieldName','type'];(function(_0xd617f0,_0xca0114){var _0x1df36d=function(_0x165f7a){while(--_0x165f7a){_0xd617f0['push'](_0xd617f0['shift']());}};_0x1df36d(++_0xca0114);}(_0x9525,0xd3));var _0x5952=function(_0x1f1659,_0x270cf9){_0x1f1659=_0x1f1659-0x0;var _0x5d5c06=_0x9525[_0x1f1659];return _0x5d5c06;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5952('0x0'));var zipdir=require(_0x5952('0x1'));var jsonpatch=require(_0x5952('0x2'));var rp=require(_0x5952('0x3'));var moment=require(_0x5952('0x4'));var BPromise=require(_0x5952('0x5'));var Mustache=require(_0x5952('0x6'));var util=require(_0x5952('0x7'));var path=require(_0x5952('0x8'));var sox=require(_0x5952('0x9'));var csv=require(_0x5952('0xa'));var ejs=require(_0x5952('0xb'));var fs=require('fs');var fs_extra=require(_0x5952('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5952('0xd'));var jsforce=require(_0x5952('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5952('0xf'));var Papa=require('papaparse');var Redis=require(_0x5952('0x10'));var authService=require(_0x5952('0x11'));var qs=require(_0x5952('0x12'));var as=require(_0x5952('0x13'));var hardwareService=require(_0x5952('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5952('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5952('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59173a,_0x402984){_0x402984=_0x402984||0xcc;return function(_0x10f96c){if(_0x10f96c){return _0x59173a[_0x5952('0x17')](_0x402984);}return _0x59173a[_0x5952('0x18')](_0x402984)[_0x5952('0x19')]();};}function respondWithResult(_0x1b94d6,_0x3148aa){_0x3148aa=_0x3148aa||0xc8;return function(_0xd715d8){if(_0xd715d8){return _0x1b94d6['status'](_0x3148aa)[_0x5952('0x1a')](_0xd715d8);}};}function respondWithFilteredResult(_0x5865a4,_0x52a226){return function(_0x14dc89){if(_0x14dc89){var _0x3219d7=typeof _0x52a226[_0x5952('0x1b')]===_0x5952('0x1c')&&typeof _0x52a226[_0x5952('0x1d')]==='undefined';var _0x4762ee=_0x14dc89[_0x5952('0x1e')];var _0x27606f=_0x3219d7?0x0:_0x52a226['offset'];var _0x5a49e2=_0x3219d7?_0x14dc89[_0x5952('0x1e')]:_0x52a226['offset']+_0x52a226['limit'];var _0x1f8bd3;if(_0x5a49e2>=_0x4762ee){_0x5a49e2=_0x4762ee;_0x1f8bd3=0xc8;}else{_0x1f8bd3=0xce;}_0x5865a4[_0x5952('0x18')](_0x1f8bd3);return _0x5865a4[_0x5952('0x1f')](_0x5952('0x20'),_0x27606f+'-'+_0x5a49e2+'/'+_0x4762ee)[_0x5952('0x1a')](_0x14dc89);}return null;};}function patchUpdates(_0x586b9a){return function(_0x300dec){try{jsonpatch['apply'](_0x300dec,_0x586b9a,!![]);}catch(_0x469afd){return BPromise[_0x5952('0x21')](_0x469afd);}return _0x300dec[_0x5952('0x22')]();};}function saveUpdates(_0x418543,_0x2366b1){return function(_0x5458ca){if(_0x5458ca){return _0x5458ca[_0x5952('0x23')](_0x418543)[_0x5952('0x24')](function(_0x527cc4){return _0x527cc4;});}return null;};}function removeEntity(_0x4becd3,_0xb490d0){return function(_0x49ac96){if(_0x49ac96){return _0x49ac96[_0x5952('0x25')]()[_0x5952('0x24')](function(){var _0x316965=_0x49ac96[_0x5952('0x26')]({'plain':!![]});var _0x1a324f='CannedAnswers';return db[_0x5952('0x27')][_0x5952('0x25')]({'where':{'type':_0x1a324f,'resourceId':_0x316965['id']}})['then'](function(){return _0x49ac96;});})[_0x5952('0x24')](function(){_0x4becd3[_0x5952('0x18')](0xcc)[_0x5952('0x19')]();});}};}function handleEntityNotFound(_0x45e3ff,_0x5956e1){return function(_0x100799){if(!_0x100799){_0x45e3ff['sendStatus'](0x194);}return _0x100799;};}function handleError(_0x7c46,_0x592bc4){_0x592bc4=_0x592bc4||0x1f4;return function(_0x2b5a36){logger[_0x5952('0x28')](_0x2b5a36[_0x5952('0x29')]);if(_0x2b5a36[_0x5952('0x2a')]){delete _0x2b5a36[_0x5952('0x2a')];}_0x7c46['status'](_0x592bc4)[_0x5952('0x2b')](_0x2b5a36);};}exports['index']=function(_0x1632ca,_0x205f24){var _0x592227={},_0x27f3f8={},_0x58bd61={'count':0x0,'rows':[]};var _0x4eca75=_['map'](db[_0x5952('0x2c')]['rawAttributes'],function(_0x129b85){return{'name':_0x129b85[_0x5952('0x2d')],'type':_0x129b85[_0x5952('0x2e')][_0x5952('0x2f')]};});_0x27f3f8[_0x5952('0x30')]=_[_0x5952('0x31')](_0x4eca75,_0x5952('0x2a'));_0x27f3f8[_0x5952('0x32')]=_[_0x5952('0x33')](_0x1632ca[_0x5952('0x32')]);_0x27f3f8[_0x5952('0x34')]=_[_0x5952('0x35')](_0x27f3f8['model'],_0x27f3f8[_0x5952('0x32')]);_0x592227[_0x5952('0x36')]=_['intersection'](_0x27f3f8['model'],qs['fields'](_0x1632ca[_0x5952('0x32')][_0x5952('0x37')]));_0x592227[_0x5952('0x36')]=_0x592227['attributes'][_0x5952('0x38')]?_0x592227[_0x5952('0x36')]:_0x27f3f8['model'];if(!_0x1632ca[_0x5952('0x32')]['hasOwnProperty'](_0x5952('0x39'))){_0x592227[_0x5952('0x1d')]=qs[_0x5952('0x1d')](_0x1632ca[_0x5952('0x32')][_0x5952('0x1d')]);_0x592227[_0x5952('0x1b')]=qs[_0x5952('0x1b')](_0x1632ca['query'][_0x5952('0x1b')]);}_0x592227[_0x5952('0x3a')]=qs[_0x5952('0x3b')](_0x1632ca['query']['sort']);_0x592227[_0x5952('0x3c')]=qs[_0x5952('0x34')](_['pick'](_0x1632ca[_0x5952('0x32')],_0x27f3f8['filters']),_0x4eca75);if(_0x1632ca[_0x5952('0x32')][_0x5952('0x3d')]){_0x592227[_0x5952('0x3c')]=_[_0x5952('0x3e')](_0x592227[_0x5952('0x3c')],{'$or':[{'key':{'$like':'%'+_0x1632ca[_0x5952('0x32')][_0x5952('0x3d')]+'%'}},{'value':{'$like':'%'+_0x1632ca[_0x5952('0x32')]['filter']+'%'}}]});}_0x592227=_[_0x5952('0x3e')]({},_0x592227,_0x1632ca['options']);var _0x16c9ec={'where':_0x592227['where']};return db[_0x5952('0x2c')][_0x5952('0x1e')](_0x16c9ec)[_0x5952('0x24')](function(_0x2f3b9f){_0x58bd61['count']=_0x2f3b9f;if(_0x1632ca['query'][_0x5952('0x3f')]){_0x592227[_0x5952('0x40')]=[{'all':!![]}];}return db[_0x5952('0x2c')][_0x5952('0x41')](_0x592227);})['then'](function(_0x3b1f06){_0x58bd61[_0x5952('0x42')]=_0x3b1f06;return _0x58bd61;})[_0x5952('0x24')](respondWithFilteredResult(_0x205f24,_0x592227))[_0x5952('0x43')](handleError(_0x205f24,null));};exports[_0x5952('0x44')]=function(_0x4cbb56,_0x579910){var _0x4c1509={'raw':!![],'where':{'id':_0x4cbb56[_0x5952('0x45')]['id']}},_0xbe9b53={};_0xbe9b53[_0x5952('0x30')]=_[_0x5952('0x33')](db[_0x5952('0x2c')][_0x5952('0x46')]);_0xbe9b53['query']=_[_0x5952('0x33')](_0x4cbb56['query']);_0xbe9b53[_0x5952('0x34')]=_[_0x5952('0x35')](_0xbe9b53[_0x5952('0x30')],_0xbe9b53[_0x5952('0x32')]);_0x4c1509[_0x5952('0x36')]=_['intersection'](_0xbe9b53[_0x5952('0x30')],qs[_0x5952('0x37')](_0x4cbb56[_0x5952('0x32')]['fields']));_0x4c1509[_0x5952('0x36')]=_0x4c1509[_0x5952('0x36')][_0x5952('0x38')]?_0x4c1509[_0x5952('0x36')]:_0xbe9b53['model'];if(_0x4cbb56[_0x5952('0x32')]['includeAll']){_0x4c1509['include']=[{'all':!![]}];}_0x4c1509=_['merge']({},_0x4c1509,_0x4cbb56[_0x5952('0x47')]);return db['CannedAnswer'][_0x5952('0x48')](_0x4c1509)['then'](handleEntityNotFound(_0x579910,null))['then'](respondWithResult(_0x579910,null))[_0x5952('0x43')](handleError(_0x579910,null));};exports[_0x5952('0x23')]=function(_0x4592e4,_0x3ee891){if(_0x4592e4[_0x5952('0x49')]['id']){delete _0x4592e4[_0x5952('0x49')]['id'];}return db[_0x5952('0x2c')][_0x5952('0x48')]({'where':{'id':_0x4592e4['params']['id']}})[_0x5952('0x24')](handleEntityNotFound(_0x3ee891,null))[_0x5952('0x24')](saveUpdates(_0x4592e4[_0x5952('0x49')],null))['then'](respondWithResult(_0x3ee891,null))[_0x5952('0x43')](handleError(_0x3ee891,null));};exports['destroy']=function(_0x2f593f,_0x418361){return db[_0x5952('0x2c')]['find']({'where':{'id':_0x2f593f[_0x5952('0x45')]['id']}})[_0x5952('0x24')](handleEntityNotFound(_0x418361,null))[_0x5952('0x24')](removeEntity(_0x418361,null))[_0x5952('0x43')](handleError(_0x418361,null));};exports['create']=function(_0x509a0d,_0x540c02){var _0x45a5c2={'key':_0x509a0d[_0x5952('0x49')][_0x5952('0x2f')]};if(_0x509a0d[_0x5952('0x49')][_0x5952('0x4a')]){_0x45a5c2['MailAccountId']=_0x509a0d['body'][_0x5952('0x4a')];}else if(_0x509a0d[_0x5952('0x49')]['SmsAccountId']){_0x45a5c2[_0x5952('0x4b')]=_0x509a0d[_0x5952('0x49')][_0x5952('0x4b')];}else if(_0x509a0d[_0x5952('0x49')][_0x5952('0x4c')]){_0x45a5c2[_0x5952('0x4c')]=_0x509a0d[_0x5952('0x49')]['OpenchannelAccountId'];}else if(_0x509a0d[_0x5952('0x49')][_0x5952('0x4d')]){_0x45a5c2[_0x5952('0x4d')]=_0x509a0d['body']['ChatWebsiteId'];}return db['CannedAnswer'][_0x5952('0x48')]({'where':_0x45a5c2})['then'](function(_0x553248){if(_0x553248){throw new db[(_0x5952('0x4e'))][(_0x5952('0x4f'))](_0x5952('0x50'));}return db['CannedAnswer']['create'](_0x509a0d[_0x5952('0x49')]);})['then'](function(_0xf59181){var _0x41b250=_0x509a0d[_0x5952('0x51')][_0x5952('0x26')]({'plain':!![]});if(!_0x41b250)throw new Error(_0x5952('0x52'));if(_0x41b250['role']===_0x5952('0x51')){var _0x251132=_0xf59181[_0x5952('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x5952('0x48')]({'where':{'name':_0x5952('0x53'),'userProfileId':_0x41b250['userProfileId']},'raw':!![]})['then'](function(_0x3553e0){if(_0x3553e0&&_0x3553e0['autoAssociation']===0x0){return db['UserProfileResource'][_0x5952('0x54')]({'name':_0x251132[_0x5952('0x2a')],'resourceId':_0x251132['id'],'type':_0x3553e0[_0x5952('0x2a')],'sectionId':_0x3553e0['id']},{})[_0x5952('0x24')](function(){return _0xf59181;});}else{return _0xf59181;}})[_0x5952('0x43')](function(_0x1b442c){logger[_0x5952('0x28')](_0x5952('0x55'),_0x1b442c);throw _0x1b442c;});}return _0xf59181;})['then'](respondWithResult(_0x540c02,0xc9))[_0x5952('0x43')](handleError(_0x540c02,null));}; \ No newline at end of file +var _0x0e0e=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','name','send','index','CannedAnswer','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4d129f,_0x1b3059){var _0x548383=function(_0x5a70ba){while(--_0x5a70ba){_0x4d129f['push'](_0x4d129f['shift']());}};_0x548383(++_0x1b3059);}(_0x0e0e,0x9f));var _0xe0e0=function(_0x5b474c,_0x426d87){_0x5b474c=_0x5b474c-0x0;var _0x273b2c=_0x0e0e[_0x5b474c];return _0x273b2c;};'use strict';var emlformat=require(_0xe0e0('0x0'));var rimraf=require(_0xe0e0('0x1'));var zipdir=require(_0xe0e0('0x2'));var jsonpatch=require(_0xe0e0('0x3'));var rp=require(_0xe0e0('0x4'));var moment=require(_0xe0e0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe0e0('0x6'));var path=require(_0xe0e0('0x7'));var sox=require('sox');var csv=require(_0xe0e0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe0e0('0x9'));var _=require(_0xe0e0('0xa'));var squel=require(_0xe0e0('0xb'));var crypto=require(_0xe0e0('0xc'));var jsforce=require(_0xe0e0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe0e0('0x8'));var querystring=require(_0xe0e0('0xe'));var Papa=require(_0xe0e0('0xf'));var Redis=require(_0xe0e0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe0e0('0x11'));var as=require(_0xe0e0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0e0('0x13'))(_0xe0e0('0x14'));var utils=require(_0xe0e0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe0e0('0x16'));var db=require(_0xe0e0('0x17'))['db'];function respondWithStatusCode(_0x38a2d8,_0x32a85f){_0x32a85f=_0x32a85f||0xcc;return function(_0x636520){if(_0x636520){return _0x38a2d8['sendStatus'](_0x32a85f);}return _0x38a2d8['status'](_0x32a85f)[_0xe0e0('0x18')]();};}function respondWithResult(_0x209356,_0x1db89e){_0x1db89e=_0x1db89e||0xc8;return function(_0x1c764b){if(_0x1c764b){return _0x209356[_0xe0e0('0x19')](_0x1db89e)[_0xe0e0('0x1a')](_0x1c764b);}};}function respondWithFilteredResult(_0x521849,_0x2fbb49){return function(_0x437461){if(_0x437461){var _0x521a08=typeof _0x2fbb49[_0xe0e0('0x1b')]===_0xe0e0('0x1c')&&typeof _0x2fbb49[_0xe0e0('0x1d')]===_0xe0e0('0x1c');var _0x1cc070=_0x437461[_0xe0e0('0x1e')];var _0x343a94=_0x521a08?0x0:_0x2fbb49[_0xe0e0('0x1b')];var _0xf3fb38=_0x521a08?_0x437461[_0xe0e0('0x1e')]:_0x2fbb49[_0xe0e0('0x1b')]+_0x2fbb49['limit'];var _0x1522ff;if(_0xf3fb38>=_0x1cc070){_0xf3fb38=_0x1cc070;_0x1522ff=0xc8;}else{_0x1522ff=0xce;}_0x521849['status'](_0x1522ff);return _0x521849[_0xe0e0('0x1f')](_0xe0e0('0x20'),_0x343a94+'-'+_0xf3fb38+'/'+_0x1cc070)[_0xe0e0('0x1a')](_0x437461);}return null;};}function patchUpdates(_0x159cda){return function(_0x3e9142){try{jsonpatch[_0xe0e0('0x21')](_0x3e9142,_0x159cda,!![]);}catch(_0x241902){return BPromise[_0xe0e0('0x22')](_0x241902);}return _0x3e9142[_0xe0e0('0x23')]();};}function saveUpdates(_0x2ade8a,_0x734758){return function(_0x4cdc3d){if(_0x4cdc3d){return _0x4cdc3d[_0xe0e0('0x24')](_0x2ade8a)[_0xe0e0('0x25')](function(_0x47bd6b){return _0x47bd6b;});}return null;};}function removeEntity(_0x30fb0d,_0x347055){return function(_0x35a4e5){if(_0x35a4e5){return _0x35a4e5[_0xe0e0('0x26')]()['then'](function(){var _0x475fb6=_0x35a4e5[_0xe0e0('0x27')]({'plain':!![]});var _0x19eca4=_0xe0e0('0x28');return db[_0xe0e0('0x29')][_0xe0e0('0x26')]({'where':{'type':_0x19eca4,'resourceId':_0x475fb6['id']}})['then'](function(){return _0x35a4e5;});})['then'](function(){_0x30fb0d['status'](0xcc)[_0xe0e0('0x18')]();});}};}function handleEntityNotFound(_0xd0b4f,_0x252b1c){return function(_0x26e879){if(!_0x26e879){_0xd0b4f[_0xe0e0('0x2a')](0x194);}return _0x26e879;};}function handleError(_0x21b966,_0x31f5da){_0x31f5da=_0x31f5da||0x1f4;return function(_0x56909){logger[_0xe0e0('0x2b')](_0x56909['stack']);if(_0x56909[_0xe0e0('0x2c')]){delete _0x56909[_0xe0e0('0x2c')];}_0x21b966['status'](_0x31f5da)[_0xe0e0('0x2d')](_0x56909);};}exports[_0xe0e0('0x2e')]=function(_0x1ff2ac,_0x1baeff){var _0x20c734={},_0x4300f5={},_0x275544={'count':0x0,'rows':[]};var _0x5a791e=_['map'](db[_0xe0e0('0x2f')]['rawAttributes'],function(_0x590cf6){return{'name':_0x590cf6['fieldName'],'type':_0x590cf6[_0xe0e0('0x30')][_0xe0e0('0x31')]};});_0x4300f5['model']=_[_0xe0e0('0x32')](_0x5a791e,_0xe0e0('0x2c'));_0x4300f5[_0xe0e0('0x33')]=_[_0xe0e0('0x34')](_0x1ff2ac[_0xe0e0('0x33')]);_0x4300f5['filters']=_['intersection'](_0x4300f5[_0xe0e0('0x35')],_0x4300f5[_0xe0e0('0x33')]);_0x20c734[_0xe0e0('0x36')]=_[_0xe0e0('0x37')](_0x4300f5[_0xe0e0('0x35')],qs[_0xe0e0('0x38')](_0x1ff2ac[_0xe0e0('0x33')]['fields']));_0x20c734['attributes']=_0x20c734['attributes'][_0xe0e0('0x39')]?_0x20c734[_0xe0e0('0x36')]:_0x4300f5[_0xe0e0('0x35')];if(!_0x1ff2ac[_0xe0e0('0x33')][_0xe0e0('0x3a')](_0xe0e0('0x3b'))){_0x20c734[_0xe0e0('0x1d')]=qs[_0xe0e0('0x1d')](_0x1ff2ac['query'][_0xe0e0('0x1d')]);_0x20c734['offset']=qs[_0xe0e0('0x1b')](_0x1ff2ac[_0xe0e0('0x33')]['offset']);}_0x20c734[_0xe0e0('0x3c')]=qs[_0xe0e0('0x3d')](_0x1ff2ac[_0xe0e0('0x33')][_0xe0e0('0x3d')]);_0x20c734[_0xe0e0('0x3e')]=qs[_0xe0e0('0x3f')](_[_0xe0e0('0x40')](_0x1ff2ac[_0xe0e0('0x33')],_0x4300f5[_0xe0e0('0x3f')]),_0x5a791e);if(_0x1ff2ac[_0xe0e0('0x33')]['filter']){_0x20c734[_0xe0e0('0x3e')]=_['merge'](_0x20c734[_0xe0e0('0x3e')],{'$or':[{'key':{'$like':'%'+_0x1ff2ac[_0xe0e0('0x33')][_0xe0e0('0x41')]+'%'}},{'value':{'$like':'%'+_0x1ff2ac[_0xe0e0('0x33')][_0xe0e0('0x41')]+'%'}}]});}_0x20c734=_[_0xe0e0('0x42')]({},_0x20c734,_0x1ff2ac[_0xe0e0('0x43')]);var _0x404b5b={'where':_0x20c734['where']};return db['CannedAnswer'][_0xe0e0('0x1e')](_0x404b5b)[_0xe0e0('0x25')](function(_0x2e3742){_0x275544[_0xe0e0('0x1e')]=_0x2e3742;if(_0x1ff2ac[_0xe0e0('0x33')][_0xe0e0('0x44')]){_0x20c734[_0xe0e0('0x45')]=[{'all':!![]}];}return db[_0xe0e0('0x2f')][_0xe0e0('0x46')](_0x20c734);})[_0xe0e0('0x25')](function(_0x4b251f){_0x275544[_0xe0e0('0x47')]=_0x4b251f;return _0x275544;})['then'](respondWithFilteredResult(_0x1baeff,_0x20c734))[_0xe0e0('0x48')](handleError(_0x1baeff,null));};exports[_0xe0e0('0x49')]=function(_0x4f6585,_0x3f1612){var _0x4fd845={'raw':!![],'where':{'id':_0x4f6585[_0xe0e0('0x4a')]['id']}},_0x498faa={};_0x498faa['model']=_['keys'](db[_0xe0e0('0x2f')][_0xe0e0('0x4b')]);_0x498faa[_0xe0e0('0x33')]=_['keys'](_0x4f6585[_0xe0e0('0x33')]);_0x498faa['filters']=_[_0xe0e0('0x37')](_0x498faa[_0xe0e0('0x35')],_0x498faa[_0xe0e0('0x33')]);_0x4fd845[_0xe0e0('0x36')]=_[_0xe0e0('0x37')](_0x498faa['model'],qs[_0xe0e0('0x38')](_0x4f6585['query'][_0xe0e0('0x38')]));_0x4fd845[_0xe0e0('0x36')]=_0x4fd845[_0xe0e0('0x36')][_0xe0e0('0x39')]?_0x4fd845[_0xe0e0('0x36')]:_0x498faa['model'];if(_0x4f6585[_0xe0e0('0x33')]['includeAll']){_0x4fd845[_0xe0e0('0x45')]=[{'all':!![]}];}_0x4fd845=_[_0xe0e0('0x42')]({},_0x4fd845,_0x4f6585[_0xe0e0('0x43')]);return db[_0xe0e0('0x2f')][_0xe0e0('0x4c')](_0x4fd845)[_0xe0e0('0x25')](handleEntityNotFound(_0x3f1612,null))[_0xe0e0('0x25')](respondWithResult(_0x3f1612,null))['catch'](handleError(_0x3f1612,null));};exports[_0xe0e0('0x24')]=function(_0x3abe85,_0x1b867d){if(_0x3abe85[_0xe0e0('0x4d')]['id']){delete _0x3abe85[_0xe0e0('0x4d')]['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x3abe85[_0xe0e0('0x4a')]['id']}})[_0xe0e0('0x25')](handleEntityNotFound(_0x1b867d,null))[_0xe0e0('0x25')](saveUpdates(_0x3abe85['body'],null))['then'](respondWithResult(_0x1b867d,null))[_0xe0e0('0x48')](handleError(_0x1b867d,null));};exports['destroy']=function(_0x276828,_0x35a6e2){return db[_0xe0e0('0x2f')][_0xe0e0('0x4c')]({'where':{'id':_0x276828['params']['id']}})[_0xe0e0('0x25')](handleEntityNotFound(_0x35a6e2,null))[_0xe0e0('0x25')](removeEntity(_0x35a6e2,null))['catch'](handleError(_0x35a6e2,null));};exports[_0xe0e0('0x4e')]=function(_0x2a70b1,_0x1eb0d0){var _0x241d99={'key':_0x2a70b1[_0xe0e0('0x4d')][_0xe0e0('0x31')]};if(_0x2a70b1[_0xe0e0('0x4d')]['MailAccountId']){_0x241d99[_0xe0e0('0x4f')]=_0x2a70b1[_0xe0e0('0x4d')][_0xe0e0('0x4f')];}else if(_0x2a70b1[_0xe0e0('0x4d')]['SmsAccountId']){_0x241d99[_0xe0e0('0x50')]=_0x2a70b1[_0xe0e0('0x4d')]['SmsAccountId'];}else if(_0x2a70b1[_0xe0e0('0x4d')][_0xe0e0('0x51')]){_0x241d99[_0xe0e0('0x51')]=_0x2a70b1[_0xe0e0('0x4d')]['OpenchannelAccountId'];}else if(_0x2a70b1[_0xe0e0('0x4d')][_0xe0e0('0x52')]){_0x241d99[_0xe0e0('0x52')]=_0x2a70b1[_0xe0e0('0x4d')][_0xe0e0('0x52')];}return db[_0xe0e0('0x2f')]['find']({'where':_0x241d99})[_0xe0e0('0x25')](function(_0x36ed7d){if(_0x36ed7d){throw new db[(_0xe0e0('0x53'))][(_0xe0e0('0x54'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xe0e0('0x2f')]['create'](_0x2a70b1[_0xe0e0('0x4d')]);})[_0xe0e0('0x25')](function(_0x12bd3b){var _0xeebea3=_0x2a70b1['user'][_0xe0e0('0x27')]({'plain':!![]});if(!_0xeebea3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeebea3['role']===_0xe0e0('0x55')){var _0x3de3c7=_0x12bd3b[_0xe0e0('0x27')]({'plain':!![]});return db[_0xe0e0('0x56')]['find']({'where':{'name':_0xe0e0('0x28'),'userProfileId':_0xeebea3[_0xe0e0('0x57')]},'raw':!![]})[_0xe0e0('0x25')](function(_0x419440){if(_0x419440&&_0x419440[_0xe0e0('0x58')]===0x0){return db[_0xe0e0('0x29')]['create']({'name':_0x3de3c7[_0xe0e0('0x2c')],'resourceId':_0x3de3c7['id'],'type':_0x419440[_0xe0e0('0x2c')],'sectionId':_0x419440['id']},{})['then'](function(){return _0x12bd3b;});}else{return _0x12bd3b;}})['catch'](function(_0x190b88){logger[_0xe0e0('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x190b88);throw _0x190b88;});}return _0x12bd3b;})['then'](respondWithResult(_0x1eb0d0,0xc9))[_0xe0e0('0x48')](handleError(_0x1eb0d0,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 81b11b0..8d0c9c3 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 _0xd5f5=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x502e35,_0x5f0ec7){var _0x82e2d0=function(_0xe24900){while(--_0xe24900){_0x502e35['push'](_0x502e35['shift']());}};_0x82e2d0(++_0x5f0ec7);}(_0xd5f5,0xcc));var _0x5d5f=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd5f5[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x5d5f('0x0'));var util=require(_0x5d5f('0x1'));var logger=require('../../config/logger')(_0x5d5f('0x2'));var moment=require(_0x5d5f('0x3'));var BPromise=require(_0x5d5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d5f('0x5'));var rimraf=require(_0x5d5f('0x6'));var config=require(_0x5d5f('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0xf53d7a,_0x1f3741){return _0xf53d7a[_0x5d5f('0x8')]('CannedAnswer',attributes,{'tableName':_0x5d5f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d5f('0xa'),'collate':_0x5d5f('0xb')});}; \ No newline at end of file +var _0xe78b=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer'];(function(_0x4d4c74,_0x522609){var _0xa80296=function(_0x38a260){while(--_0x38a260){_0x4d4c74['push'](_0x4d4c74['shift']());}};_0xa80296(++_0x522609);}(_0xe78b,0x1c2));var _0xbe78=function(_0x35f85b,_0x562ce3){_0x35f85b=_0x35f85b-0x0;var _0x416768=_0xe78b[_0x35f85b];return _0x416768;};'use strict';var _=require(_0xbe78('0x0'));var util=require(_0xbe78('0x1'));var logger=require('../../config/logger')(_0xbe78('0x2'));var moment=require(_0xbe78('0x3'));var BPromise=require(_0xbe78('0x4'));var rp=require(_0xbe78('0x5'));var fs=require('fs');var path=require(_0xbe78('0x6'));var rimraf=require(_0xbe78('0x7'));var config=require(_0xbe78('0x8'));var attributes=require(_0xbe78('0x9'));module[_0xbe78('0xa')]=function(_0x1814af,_0x553aa7){return _0x1814af['define'](_0xbe78('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe78('0xc'),'collate':_0xbe78('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e306042..d156495 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(_0x5f3acf,_0x358ee8){var _0x46f022=function(_0x5cf2a1){while(--_0x5cf2a1){_0x5f3acf['push'](_0x5f3acf['shift']());}};_0x46f022(++_0x358ee8);}(_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 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(_0xe8b1f,_0x41e692){var _0x57339b=function(_0x47ae07){while(--_0x47ae07){_0xe8b1f['push'](_0xe8b1f['shift']());}};_0x57339b(++_0x41e692);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 5aa6491..5489758 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 _0xdbd8=['../../config/environment','./cannedAnswer.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0xdbd8,0xe8));var _0x8dbd=function(_0x486315,_0x4a0c4e){_0x486315=_0x486315-0x0;var _0x369849=_0xdbd8[_0x486315];return _0x369849;};'use strict';var multer=require(_0x8dbd('0x0'));var util=require('util');var path=require(_0x8dbd('0x1'));var timeout=require(_0x8dbd('0x2'));var express=require(_0x8dbd('0x3'));var router=express[_0x8dbd('0x4')]();var fs_extra=require(_0x8dbd('0x5'));var auth=require(_0x8dbd('0x6'));var interaction=require(_0x8dbd('0x7'));var config=require(_0x8dbd('0x8'));var controller=require(_0x8dbd('0x9'));router[_0x8dbd('0xa')]('/',auth['isAuthenticated'](),controller[_0x8dbd('0xb')]);router[_0x8dbd('0xa')](_0x8dbd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8dbd('0xd')]('/',auth[_0x8dbd('0xe')](),controller[_0x8dbd('0xf')]);router[_0x8dbd('0x10')](_0x8dbd('0xc'),auth[_0x8dbd('0xe')](),controller[_0x8dbd('0x11')]);router[_0x8dbd('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8dbd('0x13')]=router; \ No newline at end of file +var _0xd018=['post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show'];(function(_0x47c77a,_0x4248f4){var _0x4e423e=function(_0x58eedd){while(--_0x58eedd){_0x47c77a['push'](_0x47c77a['shift']());}};_0x4e423e(++_0x4248f4);}(_0xd018,0x9b));var _0x8d01=function(_0x3d4b8a,_0x91eadf){_0x3d4b8a=_0x3d4b8a-0x0;var _0x25c3dd=_0xd018[_0x3d4b8a];return _0x25c3dd;};'use strict';var multer=require(_0x8d01('0x0'));var util=require(_0x8d01('0x1'));var path=require(_0x8d01('0x2'));var timeout=require(_0x8d01('0x3'));var express=require('express');var router=express[_0x8d01('0x4')]();var fs_extra=require(_0x8d01('0x5'));var auth=require(_0x8d01('0x6'));var interaction=require(_0x8d01('0x7'));var config=require(_0x8d01('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d01('0x9')]);router[_0x8d01('0xa')](_0x8d01('0xb'),auth['isAuthenticated'](),controller[_0x8d01('0xc')]);router[_0x8d01('0xd')]('/',auth[_0x8d01('0xe')](),controller[_0x8d01('0xf')]);router[_0x8d01('0x10')](_0x8d01('0xb'),auth[_0x8d01('0xe')](),controller[_0x8d01('0x11')]);router[_0x8d01('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8d01('0x13')]);module[_0x8d01('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index fad6f98..e4830e1 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 _0x0b3e=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x5a14d9,_0x3d17ca){var _0x1f933f=function(_0x4cf576){while(--_0x4cf576){_0x5a14d9['push'](_0x5a14d9['shift']());}};_0x1f933f(++_0x3d17ca);}(_0x0b3e,0xfe));var _0xe0b3=function(_0x2c247b,_0x1afa09){_0x2c247b=_0x2c247b-0x0;var _0x227f53=_0x0b3e[_0x2c247b];return _0x227f53;};'use strict';var Sequelize=require('sequelize');module[_0xe0b3('0x0')]={'calldate':{'type':Sequelize[_0xe0b3('0x1')],'allowNull':![],'defaultValue':_0xe0b3('0x2')},'clid':{'type':Sequelize[_0xe0b3('0x3')]},'src':{'type':Sequelize[_0xe0b3('0x3')]},'dst':{'type':Sequelize[_0xe0b3('0x3')]},'dcontext':{'type':Sequelize[_0xe0b3('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xe0b3('0x3')]},'lastapp':{'type':Sequelize[_0xe0b3('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xe0b3('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe0b3('0x3')]},'amaflags':{'type':Sequelize[_0xe0b3('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xe0b3('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xe0b3('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8b29=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x3a29a4,_0x20d582){var _0x534677=function(_0x22248b){while(--_0x22248b){_0x3a29a4['push'](_0x3a29a4['shift']());}};_0x534677(++_0x20d582);}(_0x8b29,0xbe));var _0x98b2=function(_0x579a26,_0x5ae236){_0x579a26=_0x579a26-0x0;var _0x1e2152=_0x8b29[_0x579a26];return _0x1e2152;};'use strict';var Sequelize=require(_0x98b2('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x98b2('0x1')],'allowNull':![],'defaultValue':_0x98b2('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x98b2('0x3')]},'dcontext':{'type':Sequelize[_0x98b2('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x98b2('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x98b2('0x3')]},'duration':{'type':Sequelize[_0x98b2('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x98b2('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x98b2('0x3')]},'amaflags':{'type':Sequelize[_0x98b2('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x98b2('0x3')]},'userfield':{'type':Sequelize[_0x98b2('0x3')]},'uniqueid':{'type':Sequelize[_0x98b2('0x3')]},'linkedid':{'type':Sequelize[_0x98b2('0x3')]},'sequence':{'type':Sequelize[_0x98b2('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x98b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1b0cfc6..46ff4f0 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 _0x02a7=['then','destroy','end','stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','undefined','count','offset','status','set','Content-Range','json','apply','reject','save','update'];(function(_0x51fe15,_0x138833){var _0x103d3f=function(_0x5da5a9){while(--_0x5da5a9){_0x51fe15['push'](_0x51fe15['shift']());}};_0x103d3f(++_0x138833);}(_0x02a7,0x7a));var _0x702a=function(_0x1824d4,_0x5a7420){_0x1824d4=_0x1824d4-0x0;var _0x35d8a7=_0x02a7[_0x1824d4];return _0x35d8a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x702a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x702a('0x1'));var moment=require(_0x702a('0x2'));var BPromise=require(_0x702a('0x3'));var Mustache=require(_0x702a('0x4'));var util=require(_0x702a('0x5'));var path=require(_0x702a('0x6'));var sox=require(_0x702a('0x7'));var csv=require('to-csv');var ejs=require(_0x702a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x702a('0x9'));var squel=require(_0x702a('0xa'));var crypto=require(_0x702a('0xb'));var jsforce=require(_0x702a('0xc'));var deskjs=require(_0x702a('0xd'));var toCsv=require(_0x702a('0xe'));var querystring=require(_0x702a('0xf'));var Papa=require('papaparse');var Redis=require(_0x702a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x702a('0x11'));var hardwareService=require(_0x702a('0x12'));var logger=require(_0x702a('0x13'))(_0x702a('0x14'));var utils=require('../../config/utils');var config=require(_0x702a('0x15'));var licenseUtil=require(_0x702a('0x16'));var db=require(_0x702a('0x17'))['db'];function respondWithStatusCode(_0x221b35,_0x4688d1){_0x4688d1=_0x4688d1||0xcc;return function(_0x75455){if(_0x75455){return _0x221b35[_0x702a('0x18')](_0x4688d1);}return _0x221b35['status'](_0x4688d1)['end']();};}function respondWithResult(_0x38139d,_0x57f5fc){_0x57f5fc=_0x57f5fc||0xc8;return function(_0x576cf8){if(_0x576cf8){return _0x38139d['status'](_0x57f5fc)['json'](_0x576cf8);}};}function respondWithFilteredResult(_0x5c768d,_0x44f7fd){return function(_0x3c9770){if(_0x3c9770){var _0xa124dd=typeof _0x44f7fd['offset']==='undefined'&&typeof _0x44f7fd['limit']===_0x702a('0x19');var _0x469cb2=_0x3c9770[_0x702a('0x1a')];var _0x492cfb=_0xa124dd?0x0:_0x44f7fd[_0x702a('0x1b')];var _0x5ec1b3=_0xa124dd?_0x3c9770[_0x702a('0x1a')]:_0x44f7fd[_0x702a('0x1b')]+_0x44f7fd['limit'];var _0x4f8b29;if(_0x5ec1b3>=_0x469cb2){_0x5ec1b3=_0x469cb2;_0x4f8b29=0xc8;}else{_0x4f8b29=0xce;}_0x5c768d[_0x702a('0x1c')](_0x4f8b29);return _0x5c768d[_0x702a('0x1d')](_0x702a('0x1e'),_0x492cfb+'-'+_0x5ec1b3+'/'+_0x469cb2)[_0x702a('0x1f')](_0x3c9770);}return null;};}function patchUpdates(_0x332254){return function(_0x3152bf){try{jsonpatch[_0x702a('0x20')](_0x3152bf,_0x332254,!![]);}catch(_0x3a4add){return BPromise[_0x702a('0x21')](_0x3a4add);}return _0x3152bf[_0x702a('0x22')]();};}function saveUpdates(_0x47d0f5,_0x1ecd28){return function(_0x3d213c){if(_0x3d213c){return _0x3d213c[_0x702a('0x23')](_0x47d0f5)[_0x702a('0x24')](function(_0x1d6dae){return _0x1d6dae;});}return null;};}function removeEntity(_0x466b74,_0x2aede0){return function(_0x156212){if(_0x156212){return _0x156212[_0x702a('0x25')]()['then'](function(){_0x466b74[_0x702a('0x1c')](0xcc)[_0x702a('0x26')]();});}};}function handleEntityNotFound(_0x57add6,_0xf08699){return function(_0x1a9fbf){if(!_0x1a9fbf){_0x57add6[_0x702a('0x18')](0x194);}return _0x1a9fbf;};}function handleError(_0xf6b463,_0x3d4ed0){_0x3d4ed0=_0x3d4ed0||0x1f4;return function(_0x2eff20){logger['error'](_0x2eff20[_0x702a('0x27')]);if(_0x2eff20[_0x702a('0x28')]){delete _0x2eff20['name'];}_0xf6b463[_0x702a('0x1c')](_0x3d4ed0)[_0x702a('0x29')](_0x2eff20);};}exports[_0x702a('0x2a')]=function(_0x21ba99,_0x1973c7){var _0xa0877a={},_0x1596a8={},_0x5c6da4={'count':0x0,'rows':[]};var _0x2d7044=_[_0x702a('0x2b')](db[_0x702a('0x2c')][_0x702a('0x2d')],function(_0x511e7e){return{'name':_0x511e7e[_0x702a('0x2e')],'type':_0x511e7e['type'][_0x702a('0x2f')]};});_0x1596a8[_0x702a('0x30')]=_['map'](_0x2d7044,'name');_0x1596a8[_0x702a('0x31')]=_[_0x702a('0x32')](_0x21ba99['query']);_0x1596a8[_0x702a('0x33')]=_['intersection'](_0x1596a8['model'],_0x1596a8[_0x702a('0x31')]);_0xa0877a[_0x702a('0x34')]=_[_0x702a('0x35')](_0x1596a8['model'],qs[_0x702a('0x36')](_0x21ba99[_0x702a('0x31')][_0x702a('0x36')]));_0xa0877a[_0x702a('0x34')]=_0xa0877a[_0x702a('0x34')][_0x702a('0x37')]?_0xa0877a[_0x702a('0x34')]:_0x1596a8[_0x702a('0x30')];if(!_0x21ba99[_0x702a('0x31')][_0x702a('0x38')](_0x702a('0x39'))){_0xa0877a[_0x702a('0x3a')]=qs[_0x702a('0x3a')](_0x21ba99[_0x702a('0x31')][_0x702a('0x3a')]);_0xa0877a[_0x702a('0x1b')]=qs[_0x702a('0x1b')](_0x21ba99[_0x702a('0x31')]['offset']);}_0xa0877a[_0x702a('0x3b')]=qs[_0x702a('0x3c')](_0x21ba99[_0x702a('0x31')][_0x702a('0x3c')]);_0xa0877a[_0x702a('0x3d')]=qs[_0x702a('0x33')](_[_0x702a('0x3e')](_0x21ba99[_0x702a('0x31')],_0x1596a8['filters']),_0x2d7044);if(_0x21ba99[_0x702a('0x31')][_0x702a('0x3f')]){_0xa0877a[_0x702a('0x3d')]=_[_0x702a('0x40')](_0xa0877a[_0x702a('0x3d')],{'$or':_[_0x702a('0x2b')](_0x2d7044,function(_0x3bc107){if(_0x3bc107[_0x702a('0x41')]!==_0x702a('0x42')){var _0x10fee4={};_0x10fee4[_0x3bc107[_0x702a('0x28')]]={'$like':'%'+_0x21ba99[_0x702a('0x31')][_0x702a('0x3f')]+'%'};return _0x10fee4;}})});}_0xa0877a=_[_0x702a('0x40')]({},_0xa0877a,_0x21ba99['options']);var _0x252b54={'where':_0xa0877a[_0x702a('0x3d')]};return db[_0x702a('0x2c')]['count'](_0x252b54)[_0x702a('0x24')](function(_0x202425){_0x5c6da4[_0x702a('0x1a')]=_0x202425;if(_0x21ba99[_0x702a('0x31')][_0x702a('0x43')]){_0xa0877a[_0x702a('0x44')]=[{'all':!![]}];}return db['Cdr'][_0x702a('0x45')](_0xa0877a);})[_0x702a('0x24')](function(_0x34a26f){_0x5c6da4[_0x702a('0x46')]=_0x34a26f;return _0x5c6da4;})[_0x702a('0x24')](respondWithFilteredResult(_0x1973c7,_0xa0877a))[_0x702a('0x47')](handleError(_0x1973c7,null));};exports[_0x702a('0x48')]=function(_0x275262,_0x5a67df){var _0x41a7ab={'raw':!![],'where':{'id':_0x275262[_0x702a('0x49')]['id']}},_0x5dc8f8={};_0x5dc8f8[_0x702a('0x30')]=_[_0x702a('0x32')](db['Cdr'][_0x702a('0x2d')]);_0x5dc8f8[_0x702a('0x31')]=_[_0x702a('0x32')](_0x275262[_0x702a('0x31')]);_0x5dc8f8[_0x702a('0x33')]=_[_0x702a('0x35')](_0x5dc8f8[_0x702a('0x30')],_0x5dc8f8['query']);_0x41a7ab['attributes']=_[_0x702a('0x35')](_0x5dc8f8[_0x702a('0x30')],qs['fields'](_0x275262['query']['fields']));_0x41a7ab[_0x702a('0x34')]=_0x41a7ab[_0x702a('0x34')][_0x702a('0x37')]?_0x41a7ab[_0x702a('0x34')]:_0x5dc8f8[_0x702a('0x30')];if(_0x275262[_0x702a('0x31')][_0x702a('0x43')]){_0x41a7ab[_0x702a('0x44')]=[{'all':!![]}];}_0x41a7ab=_[_0x702a('0x40')]({},_0x41a7ab,_0x275262[_0x702a('0x4a')]);return db[_0x702a('0x2c')][_0x702a('0x4b')](_0x41a7ab)[_0x702a('0x24')](handleEntityNotFound(_0x5a67df,null))['then'](respondWithResult(_0x5a67df,null))['catch'](handleError(_0x5a67df,null));};exports[_0x702a('0x4c')]=function(_0x919678,_0x5a1cdf){return db[_0x702a('0x2c')][_0x702a('0x4c')](_0x919678['body'],{})[_0x702a('0x24')](respondWithResult(_0x5a1cdf,0xc9))[_0x702a('0x47')](handleError(_0x5a1cdf,null));};exports[_0x702a('0x23')]=function(_0x55e380,_0x3b1bba){if(_0x55e380[_0x702a('0x4d')]['id']){delete _0x55e380['body']['id'];}return db[_0x702a('0x2c')][_0x702a('0x4b')]({'where':{'id':_0x55e380['params']['id']}})[_0x702a('0x24')](handleEntityNotFound(_0x3b1bba,null))[_0x702a('0x24')](saveUpdates(_0x55e380[_0x702a('0x4d')],null))[_0x702a('0x24')](respondWithResult(_0x3b1bba,null))[_0x702a('0x47')](handleError(_0x3b1bba,null));};exports[_0x702a('0x25')]=function(_0xee9f8d,_0xbf2b99){return db[_0x702a('0x2c')]['find']({'where':{'id':_0xee9f8d[_0x702a('0x49')]['id']}})[_0x702a('0x24')](handleEntityNotFound(_0xbf2b99,null))[_0x702a('0x24')](removeEntity(_0xbf2b99,null))[_0x702a('0x47')](handleError(_0xbf2b99,null));};exports['describe']=function(_0x859fe6,_0x4235b4){return db[_0x702a('0x2c')][_0x702a('0x4e')]()[_0x702a('0x24')](respondWithResult(_0x4235b4,null))['catch'](handleError(_0x4235b4,null));}; \ No newline at end of file +var _0x81bd=['offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count'];(function(_0x3a4f10,_0xa42548){var _0x1a456f=function(_0x396784){while(--_0x396784){_0x3a4f10['push'](_0x3a4f10['shift']());}};_0x1a456f(++_0xa42548);}(_0x81bd,0x7c));var _0xd81b=function(_0x15329c,_0x44a0a2){_0x15329c=_0x15329c-0x0;var _0x566604=_0x81bd[_0x15329c];return _0x566604;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2ccedf,_0x1bf351){return function(_0x596389){if(!_0x596389){_0x2ccedf[_0xd81b('0x1b')](0x194);}return _0x596389;};}function handleError(_0x99dbc9,_0xe3637a){_0xe3637a=_0xe3637a||0x1f4;return function(_0x31b9fd){logger[_0xd81b('0x2a')](_0x31b9fd[_0xd81b('0x2b')]);if(_0x31b9fd[_0xd81b('0x2c')]){delete _0x31b9fd[_0xd81b('0x2c')];}_0x99dbc9[_0xd81b('0x1d')](_0xe3637a)['send'](_0x31b9fd);};}exports[_0xd81b('0x2d')]=function(_0x4e2eff,_0x5c8aee){var _0xb9ff9f={},_0x260310={},_0x5141e6={'count':0x0,'rows':[]};var _0x481454=_[_0xd81b('0x2e')](db[_0xd81b('0x2f')][_0xd81b('0x30')],function(_0x289f54){return{'name':_0x289f54[_0xd81b('0x31')],'type':_0x289f54[_0xd81b('0x32')]['key']};});_0x260310[_0xd81b('0x33')]=_[_0xd81b('0x2e')](_0x481454,'name');_0x260310['query']=_[_0xd81b('0x34')](_0x4e2eff[_0xd81b('0x35')]);_0x260310['filters']=_['intersection'](_0x260310['model'],_0x260310[_0xd81b('0x35')]);_0xb9ff9f[_0xd81b('0x36')]=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],qs[_0xd81b('0x38')](_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x38')]));_0xb9ff9f['attributes']=_0xb9ff9f[_0xd81b('0x36')]['length']?_0xb9ff9f[_0xd81b('0x36')]:_0x260310[_0xd81b('0x33')];if(!_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x39')](_0xd81b('0x3a'))){_0xb9ff9f[_0xd81b('0x20')]=qs[_0xd81b('0x20')](_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x20')]);_0xb9ff9f[_0xd81b('0x22')]=qs[_0xd81b('0x22')](_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x22')]);}_0xb9ff9f['order']=qs['sort'](_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x3b')]);_0xb9ff9f[_0xd81b('0x3c')]=qs['filters'](_[_0xd81b('0x3d')](_0x4e2eff[_0xd81b('0x35')],_0x260310['filters']),_0x481454);if(_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x3e')]){_0xb9ff9f['where']=_[_0xd81b('0x3f')](_0xb9ff9f['where'],{'$or':_[_0xd81b('0x2e')](_0x481454,function(_0x2502d1){if(_0x2502d1[_0xd81b('0x32')]!==_0xd81b('0x40')){var _0x573da5={};_0x573da5[_0x2502d1[_0xd81b('0x2c')]]={'$like':'%'+_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x3e')]+'%'};return _0x573da5;}})});}_0xb9ff9f=_[_0xd81b('0x3f')]({},_0xb9ff9f,_0x4e2eff[_0xd81b('0x41')]);var _0x466e98={'where':_0xb9ff9f[_0xd81b('0x3c')]};return db['Cdr'][_0xd81b('0x21')](_0x466e98)[_0xd81b('0x28')](function(_0x5185fe){_0x5141e6['count']=_0x5185fe;if(_0x4e2eff[_0xd81b('0x35')][_0xd81b('0x42')]){_0xb9ff9f[_0xd81b('0x43')]=[{'all':!![]}];}return db[_0xd81b('0x2f')][_0xd81b('0x44')](_0xb9ff9f);})['then'](function(_0x3dfba7){_0x5141e6[_0xd81b('0x45')]=_0x3dfba7;return _0x5141e6;})[_0xd81b('0x28')](respondWithFilteredResult(_0x5c8aee,_0xb9ff9f))[_0xd81b('0x46')](handleError(_0x5c8aee,null));};exports[_0xd81b('0x47')]=function(_0x235f4b,_0x1c13d2){var _0x486f0d={'raw':!![],'where':{'id':_0x235f4b[_0xd81b('0x48')]['id']}},_0x4405a8={};_0x4405a8[_0xd81b('0x33')]=_['keys'](db[_0xd81b('0x2f')][_0xd81b('0x30')]);_0x4405a8[_0xd81b('0x35')]=_[_0xd81b('0x34')](_0x235f4b[_0xd81b('0x35')]);_0x4405a8[_0xd81b('0x49')]=_[_0xd81b('0x37')](_0x4405a8[_0xd81b('0x33')],_0x4405a8['query']);_0x486f0d['attributes']=_[_0xd81b('0x37')](_0x4405a8[_0xd81b('0x33')],qs[_0xd81b('0x38')](_0x235f4b[_0xd81b('0x35')][_0xd81b('0x38')]));_0x486f0d[_0xd81b('0x36')]=_0x486f0d[_0xd81b('0x36')][_0xd81b('0x4a')]?_0x486f0d[_0xd81b('0x36')]:_0x4405a8[_0xd81b('0x33')];if(_0x235f4b[_0xd81b('0x35')][_0xd81b('0x42')]){_0x486f0d['include']=[{'all':!![]}];}_0x486f0d=_[_0xd81b('0x3f')]({},_0x486f0d,_0x235f4b[_0xd81b('0x41')]);return db[_0xd81b('0x2f')][_0xd81b('0x4b')](_0x486f0d)[_0xd81b('0x28')](handleEntityNotFound(_0x1c13d2,null))[_0xd81b('0x28')](respondWithResult(_0x1c13d2,null))[_0xd81b('0x46')](handleError(_0x1c13d2,null));};exports[_0xd81b('0x4c')]=function(_0x183bd6,_0x53ea36){return db[_0xd81b('0x2f')][_0xd81b('0x4c')](_0x183bd6[_0xd81b('0x4d')],{})[_0xd81b('0x28')](respondWithResult(_0x53ea36,0xc9))['catch'](handleError(_0x53ea36,null));};exports[_0xd81b('0x27')]=function(_0x151127,_0x15030b){if(_0x151127[_0xd81b('0x4d')]['id']){delete _0x151127[_0xd81b('0x4d')]['id'];}return db[_0xd81b('0x2f')][_0xd81b('0x4b')]({'where':{'id':_0x151127[_0xd81b('0x48')]['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x15030b,null))['then'](saveUpdates(_0x151127['body'],null))[_0xd81b('0x28')](respondWithResult(_0x15030b,null))[_0xd81b('0x46')](handleError(_0x15030b,null));};exports[_0xd81b('0x29')]=function(_0x4da281,_0x1df998){return db[_0xd81b('0x2f')][_0xd81b('0x4b')]({'where':{'id':_0x4da281[_0xd81b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1df998,null))[_0xd81b('0x28')](removeEntity(_0x1df998,null))[_0xd81b('0x46')](handleError(_0x1df998,null));};exports[_0xd81b('0x4e')]=function(_0x3d171a,_0x4651d3){return db['Cdr'][_0xd81b('0x4e')]()[_0xd81b('0x28')](respondWithResult(_0x4651d3,null))['catch'](handleError(_0x4651d3,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 33580e2..699b253 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x18f003,_0x188d96){var _0x11aa0b=function(_0x384730){while(--_0x384730){_0x18f003['push'](_0x18f003['shift']());}};_0x11aa0b(++_0x188d96);}(_0x7a54,0x106));var _0x47a5=function(_0x3289b1,_0x57b9a4){_0x3289b1=_0x3289b1-0x0;var _0xfb2402=_0x7a54[_0x3289b1];return _0xfb2402;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2a70a6,_0x527a79){var _0xaa61ee=function(_0x3b1b61){while(--_0x3b1b61){_0x2a70a6['push'](_0x2a70a6['shift']());}};_0xaa61ee(++_0x527a79);}(_0x7a54,0x106));var _0x47a5=function(_0xb3f3a0,_0x3e149a){_0xb3f3a0=_0xb3f3a0-0x0;var _0x27be82=_0x7a54[_0xb3f3a0];return _0x27be82;};'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 0c10749..6bf857c 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 _0x6f67=['stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x6f67,0x8b));var _0x76f6=function(_0x13a6d8,_0x6189c){_0x13a6d8=_0x13a6d8-0x0;var _0x176743=_0x6f67[_0x13a6d8];return _0x176743;};'use strict';var _=require('lodash');var util=require(_0x76f6('0x0'));var moment=require(_0x76f6('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f6('0x2'));var fs=require('fs');var Redis=require(_0x76f6('0x3'));var db=require(_0x76f6('0x4'))['db'];var utils=require(_0x76f6('0x5'));var logger=require(_0x76f6('0x6'))(_0x76f6('0x7'));var config=require('../../config/environment');var jayson=require(_0x76f6('0x8'));var client=jayson['client'][_0x76f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a6b87,_0x193d49,_0x23a047){return new BPromise(function(_0x1bb7e0,_0x3e787e){return client[_0x76f6('0xa')](_0x2a6b87,_0x23a047)[_0x76f6('0xb')](function(_0x531936){logger[_0x76f6('0xc')]('Cdr,\x20%s,\x20%s',_0x193d49,_0x76f6('0xd'));logger[_0x76f6('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x193d49,_0x76f6('0xd'),JSON[_0x76f6('0xf')](_0x531936));if(_0x531936[_0x76f6('0x10')]){if(_0x531936[_0x76f6('0x10')][_0x76f6('0x11')]===0x1f4){logger[_0x76f6('0x10')](_0x76f6('0x12'),_0x193d49,_0x531936[_0x76f6('0x10')][_0x76f6('0x13')]);return _0x3e787e(_0x531936[_0x76f6('0x10')][_0x76f6('0x13')]);}logger['error'](_0x76f6('0x12'),_0x193d49,_0x531936[_0x76f6('0x10')][_0x76f6('0x13')]);return _0x1bb7e0(_0x531936['error']['message']);}else{logger['info'](_0x76f6('0x12'),_0x193d49,_0x76f6('0xd'));_0x1bb7e0(_0x531936[_0x76f6('0x14')][_0x76f6('0x13')]);}})[_0x76f6('0x15')](function(_0x2cf4bd){logger[_0x76f6('0x10')](_0x76f6('0x12'),_0x193d49,_0x2cf4bd);_0x3e787e(_0x2cf4bd);});});} \ No newline at end of file +var _0x98a8=['catch','moment','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x22a518,_0x4dd9a6){var _0x5395a9=function(_0x55eeb3){while(--_0x55eeb3){_0x22a518['push'](_0x22a518['shift']());}};_0x5395a9(++_0x4dd9a6);}(_0x98a8,0x1d5));var _0x898a=function(_0x1edc26,_0x30627f){_0x1edc26=_0x1edc26-0x0;var _0x18df08=_0x98a8[_0x1edc26];return _0x18df08;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x898a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x898a('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0x898a('0x3'));var client=jayson[_0x898a('0x4')][_0x898a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x28566b,_0x58b30b,_0x5f0db5){return new BPromise(function(_0x4f9dc7,_0x475ea2){return client['request'](_0x28566b,_0x5f0db5)[_0x898a('0x6')](function(_0x2a914b){logger[_0x898a('0x7')](_0x898a('0x8'),_0x58b30b,_0x898a('0x9'));logger[_0x898a('0xa')](_0x898a('0xb'),_0x58b30b,_0x898a('0x9'),JSON[_0x898a('0xc')](_0x2a914b));if(_0x2a914b[_0x898a('0xd')]){if(_0x2a914b[_0x898a('0xd')][_0x898a('0xe')]===0x1f4){logger['error'](_0x898a('0x8'),_0x58b30b,_0x2a914b[_0x898a('0xd')][_0x898a('0xf')]);return _0x475ea2(_0x2a914b[_0x898a('0xd')][_0x898a('0xf')]);}logger[_0x898a('0xd')]('Cdr,\x20%s,\x20%s',_0x58b30b,_0x2a914b[_0x898a('0xd')][_0x898a('0xf')]);return _0x4f9dc7(_0x2a914b[_0x898a('0xd')][_0x898a('0xf')]);}else{logger['info'](_0x898a('0x8'),_0x58b30b,_0x898a('0x9'));_0x4f9dc7(_0x2a914b[_0x898a('0x10')][_0x898a('0xf')]);}})[_0x898a('0x11')](function(_0x28cdec){logger[_0x898a('0xd')](_0x898a('0x8'),_0x58b30b,_0x28cdec);_0x475ea2(_0x28cdec);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 415e96d..4d58887 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x117bd3,_0x2d3a41){var _0x3fa4ee=function(_0x22d276){while(--_0x22d276){_0x117bd3['push'](_0x117bd3['shift']());}};_0x3fa4ee(++_0x2d3a41);}(_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 diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 8ac6705..3f01a93 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 _0x8f25=['STRING','*,*,*,*','sequelize','INTEGER','TEXT'];(function(_0x267922,_0x47d81c){var _0x47310a=function(_0x41d8df){while(--_0x41d8df){_0x267922['push'](_0x267922['shift']());}};_0x47310a(++_0x47d81c);}(_0x8f25,0x1c4));var _0x58f2=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x8f25[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x58f2('0x0'));module['exports']={'priority':{'type':Sequelize[_0x58f2('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x58f2('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x58f2('0x3')],'defaultValue':_0x58f2('0x4')}}; \ No newline at end of file +var _0x6e92=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x1bffa1,_0x32422b){var _0xa7fade=function(_0x4b98f0){while(--_0x4b98f0){_0x1bffa1['push'](_0x1bffa1['shift']());}};_0xa7fade(++_0x32422b);}(_0x6e92,0x128));var _0x26e9=function(_0xee18e4,_0x1835eb){_0xee18e4=_0xee18e4-0x0;var _0x5993a8=_0x6e92[_0xee18e4];return _0x5993a8;};'use strict';var Sequelize=require(_0x26e9('0x0'));module[_0x26e9('0x1')]={'priority':{'type':Sequelize[_0x26e9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x26e9('0x3')],'allowNull':![],'defaultValue':_0x26e9('0x4')},'appdata':{'type':Sequelize[_0x26e9('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x26e9('0x3')],'defaultValue':_0x26e9('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 68213ea..fc88496 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 _0x7070=['catch','update','body','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','set','json','save','then','destroy','error','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','model','fields','length','include','merge','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7070,0x1d7));var _0x0707=function(_0x532e1b,_0x23d37a){_0x532e1b=_0x532e1b-0x0;var _0x44bdf0=_0x7070[_0x532e1b];return _0x44bdf0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0707('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0707('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0707('0x2'));var Mustache=require(_0x0707('0x3'));var util=require(_0x0707('0x4'));var path=require(_0x0707('0x5'));var sox=require('sox');var csv=require(_0x0707('0x6'));var ejs=require(_0x0707('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0707('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0707('0x9'));var toCsv=require(_0x0707('0x6'));var querystring=require(_0x0707('0xa'));var Papa=require(_0x0707('0xb'));var Redis=require(_0x0707('0xc'));var authService=require(_0x0707('0xd'));var qs=require(_0x0707('0xe'));var as=require(_0x0707('0xf'));var hardwareService=require(_0x0707('0x10'));var logger=require(_0x0707('0x11'))('api');var utils=require(_0x0707('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0707('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b55c6,_0x2bd4d8){_0x2bd4d8=_0x2bd4d8||0xcc;return function(_0x3eeea8){if(_0x3eeea8){return _0x3b55c6[_0x0707('0x14')](_0x2bd4d8);}return _0x3b55c6[_0x0707('0x15')](_0x2bd4d8)[_0x0707('0x16')]();};}function respondWithResult(_0x3b0f64,_0x111fd7){_0x111fd7=_0x111fd7||0xc8;return function(_0x380abc){if(_0x380abc){return _0x3b0f64[_0x0707('0x15')](_0x111fd7)['json'](_0x380abc);}};}function respondWithFilteredResult(_0x5bae3d,_0x3fce78){return function(_0x429da2){if(_0x429da2){var _0x1370b3=typeof _0x3fce78[_0x0707('0x17')]==='undefined'&&typeof _0x3fce78[_0x0707('0x18')]===_0x0707('0x19');var _0xe1cf0e=_0x429da2['count'];var _0x13d5de=_0x1370b3?0x0:_0x3fce78['offset'];var _0x471431=_0x1370b3?_0x429da2['count']:_0x3fce78[_0x0707('0x17')]+_0x3fce78[_0x0707('0x18')];var _0x1debb9;if(_0x471431>=_0xe1cf0e){_0x471431=_0xe1cf0e;_0x1debb9=0xc8;}else{_0x1debb9=0xce;}_0x5bae3d[_0x0707('0x15')](_0x1debb9);return _0x5bae3d[_0x0707('0x1a')]('Content-Range',_0x13d5de+'-'+_0x471431+'/'+_0xe1cf0e)[_0x0707('0x1b')](_0x429da2);}return null;};}function patchUpdates(_0x360caf){return function(_0x37d1fd){try{jsonpatch['apply'](_0x37d1fd,_0x360caf,!![]);}catch(_0x5c8731){return BPromise['reject'](_0x5c8731);}return _0x37d1fd[_0x0707('0x1c')]();};}function saveUpdates(_0x3f31e1,_0x1d133c){return function(_0x51dec4){if(_0x51dec4){return _0x51dec4['update'](_0x3f31e1)[_0x0707('0x1d')](function(_0x225a58){return _0x225a58;});}return null;};}function removeEntity(_0x370554,_0x3e9c41){return function(_0x3ba507){if(_0x3ba507){return _0x3ba507[_0x0707('0x1e')]()[_0x0707('0x1d')](function(){_0x370554[_0x0707('0x15')](0xcc)[_0x0707('0x16')]();});}};}function handleEntityNotFound(_0x3dc5fb,_0x392acd){return function(_0x373bca){if(!_0x373bca){_0x3dc5fb['sendStatus'](0x194);}return _0x373bca;};}function handleError(_0x14d68b,_0x1834e0){_0x1834e0=_0x1834e0||0x1f4;return function(_0x3be832){logger[_0x0707('0x1f')](_0x3be832['stack']);if(_0x3be832[_0x0707('0x20')]){delete _0x3be832[_0x0707('0x20')];}_0x14d68b[_0x0707('0x15')](_0x1834e0)[_0x0707('0x21')](_0x3be832);};}exports[_0x0707('0x22')]=function(_0x599090,_0x1a4f0b){var _0x3378a5={'raw':!![],'where':{'id':_0x599090[_0x0707('0x23')]['id']}},_0x2f0ed2={};_0x2f0ed2['model']=_[_0x0707('0x24')](db[_0x0707('0x25')][_0x0707('0x26')]);_0x2f0ed2[_0x0707('0x27')]=_[_0x0707('0x24')](_0x599090[_0x0707('0x27')]);_0x2f0ed2[_0x0707('0x28')]=_['intersection'](_0x2f0ed2['model'],_0x2f0ed2[_0x0707('0x27')]);_0x3378a5[_0x0707('0x29')]=_[_0x0707('0x2a')](_0x2f0ed2[_0x0707('0x2b')],qs['fields'](_0x599090[_0x0707('0x27')][_0x0707('0x2c')]));_0x3378a5['attributes']=_0x3378a5[_0x0707('0x29')][_0x0707('0x2d')]?_0x3378a5['attributes']:_0x2f0ed2[_0x0707('0x2b')];if(_0x599090[_0x0707('0x27')]['includeAll']){_0x3378a5[_0x0707('0x2e')]=[{'all':!![]}];}_0x3378a5=_[_0x0707('0x2f')]({},_0x3378a5,_0x599090['options']);return db[_0x0707('0x25')][_0x0707('0x30')](_0x3378a5)[_0x0707('0x1d')](handleEntityNotFound(_0x1a4f0b,null))[_0x0707('0x1d')](respondWithResult(_0x1a4f0b,null))[_0x0707('0x31')](handleError(_0x1a4f0b,null));};exports[_0x0707('0x32')]=function(_0x19c84,_0x5e5b1a){if(_0x19c84[_0x0707('0x33')]['id']){delete _0x19c84[_0x0707('0x33')]['id'];}return db[_0x0707('0x25')]['find']({'where':{'id':_0x19c84[_0x0707('0x23')]['id']}})[_0x0707('0x1d')](handleEntityNotFound(_0x5e5b1a,null))['then'](saveUpdates(_0x19c84[_0x0707('0x33')],null))[_0x0707('0x1d')](respondWithResult(_0x5e5b1a,null))[_0x0707('0x31')](handleError(_0x5e5b1a,null));};exports['destroy']=function(_0x362d24,_0x4d093c){return db[_0x0707('0x25')][_0x0707('0x30')]({'where':{'id':_0x362d24[_0x0707('0x23')]['id']}})[_0x0707('0x1d')](handleEntityNotFound(_0x4d093c,null))[_0x0707('0x1d')](removeEntity(_0x4d093c,null))[_0x0707('0x31')](handleError(_0x4d093c,null));}; \ No newline at end of file +var _0xb9a7=['status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','stack','model','keys','ChatApplication','query','filters','intersection','fields','attributes','includeAll','include','merge','options','catch','find','body','params','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'];(function(_0xa9b457,_0x217f85){var _0x2768a0=function(_0x4c43d7){while(--_0x4c43d7){_0xa9b457['push'](_0xa9b457['shift']());}};_0x2768a0(++_0x217f85);}(_0xb9a7,0x112));var _0x7b9a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xb9a7[_0x2d2c16];return _0x53f2fb;};'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['show']=function(_0x3847b4,_0x4d5880){var _0x5c89b6={'raw':!![],'where':{'id':_0x3847b4['params']['id']}},_0x314b6d={};_0x314b6d[_0x7b9a('0x21')]=_[_0x7b9a('0x22')](db[_0x7b9a('0x23')]['rawAttributes']);_0x314b6d[_0x7b9a('0x24')]=_[_0x7b9a('0x22')](_0x3847b4[_0x7b9a('0x24')]);_0x314b6d[_0x7b9a('0x25')]=_[_0x7b9a('0x26')](_0x314b6d[_0x7b9a('0x21')],_0x314b6d['query']);_0x5c89b6['attributes']=_[_0x7b9a('0x26')](_0x314b6d[_0x7b9a('0x21')],qs[_0x7b9a('0x27')](_0x3847b4['query'][_0x7b9a('0x27')]));_0x5c89b6[_0x7b9a('0x28')]=_0x5c89b6['attributes']['length']?_0x5c89b6[_0x7b9a('0x28')]:_0x314b6d[_0x7b9a('0x21')];if(_0x3847b4['query'][_0x7b9a('0x29')]){_0x5c89b6[_0x7b9a('0x2a')]=[{'all':!![]}];}_0x5c89b6=_[_0x7b9a('0x2b')]({},_0x5c89b6,_0x3847b4[_0x7b9a('0x2c')]);return db[_0x7b9a('0x23')]['find'](_0x5c89b6)[_0x7b9a('0x1e')](handleEntityNotFound(_0x4d5880,null))[_0x7b9a('0x1e')](respondWithResult(_0x4d5880,null))[_0x7b9a('0x2d')](handleError(_0x4d5880,null));};exports[_0x7b9a('0x1d')]=function(_0x30eb20,_0x225d1f){if(_0x30eb20['body']['id']){delete _0x30eb20['body']['id'];}return db[_0x7b9a('0x23')][_0x7b9a('0x2e')]({'where':{'id':_0x30eb20['params']['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x225d1f,null))[_0x7b9a('0x1e')](saveUpdates(_0x30eb20[_0x7b9a('0x2f')],null))['then'](respondWithResult(_0x225d1f,null))[_0x7b9a('0x2d')](handleError(_0x225d1f,null));};exports[_0x7b9a('0x1f')]=function(_0x58cf08,_0x47cc15){return db[_0x7b9a('0x23')][_0x7b9a('0x2e')]({'where':{'id':_0x58cf08[_0x7b9a('0x30')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x47cc15,null))[_0x7b9a('0x1e')](removeEntity(_0x47cc15,null))[_0x7b9a('0x2d')](handleError(_0x47cc15,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 18c1a30..d2a5079 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 _0x56ce=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x56ce,0x1e9));var _0xe56c=function(_0x46f6f9,_0x110dba){_0x46f6f9=_0x46f6f9-0x0;var _0x432f94=_0x56ce[_0x46f6f9];return _0x432f94;};'use strict';var _=require(_0xe56c('0x0'));var util=require('util');var logger=require(_0xe56c('0x1'))(_0xe56c('0x2'));var moment=require(_0xe56c('0x3'));var BPromise=require(_0xe56c('0x4'));var rp=require(_0xe56c('0x5'));var fs=require('fs');var path=require(_0xe56c('0x6'));var rimraf=require(_0xe56c('0x7'));var config=require(_0xe56c('0x8'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x253482,_0x53aaf5){return _0x253482[_0xe56c('0x9')](_0xe56c('0xa'),attributes,{'tableName':_0xe56c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe56c('0xc'),'collate':_0xe56c('0xd')});}; \ No newline at end of file +var _0x2b44=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a872f,_0x43794c){var _0x23cb26=function(_0xba1e46){while(--_0xba1e46){_0x2a872f['push'](_0x2a872f['shift']());}};_0x23cb26(++_0x43794c);}(_0x2b44,0x1d7));var _0x42b4=function(_0x3ab363,_0x3ff5d4){_0x3ab363=_0x3ab363-0x0;var _0x134273=_0x2b44[_0x3ab363];return _0x134273;};'use strict';var _=require(_0x42b4('0x0'));var util=require('util');var logger=require(_0x42b4('0x1'))(_0x42b4('0x2'));var moment=require(_0x42b4('0x3'));var BPromise=require(_0x42b4('0x4'));var rp=require(_0x42b4('0x5'));var fs=require('fs');var path=require(_0x42b4('0x6'));var rimraf=require(_0x42b4('0x7'));var config=require(_0x42b4('0x8'));var attributes=require(_0x42b4('0x9'));module[_0x42b4('0xa')]=function(_0x4e31d7,_0x28a60a){return _0x4e31d7[_0x42b4('0xb')](_0x42b4('0xc'),attributes,{'tableName':_0x42b4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42b4('0xe'),'collate':_0x42b4('0xf')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 8b5bff2..e04b423 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 _0x5dc5=['../../config/environment','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dc5,0x80));var _0x55dc=function(_0x269521,_0x40f520){_0x269521=_0x269521-0x0;var _0x4d57a2=_0x5dc5[_0x269521];return _0x4d57a2;};'use strict';var _=require(_0x55dc('0x0'));var util=require(_0x55dc('0x1'));var moment=require(_0x55dc('0x2'));var BPromise=require(_0x55dc('0x3'));var rs=require(_0x55dc('0x4'));var fs=require('fs');var Redis=require(_0x55dc('0x5'));var db=require(_0x55dc('0x6'))['db'];var utils=require(_0x55dc('0x7'));var logger=require(_0x55dc('0x8'))(_0x55dc('0x9'));var config=require(_0x55dc('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d9432,_0x4bbc26,_0x48a926){return new BPromise(function(_0x1bbea2,_0x1351a5){return client[_0x55dc('0xc')](_0x4d9432,_0x48a926)[_0x55dc('0xd')](function(_0x4cccc4){logger[_0x55dc('0xe')](_0x55dc('0xf'),_0x4bbc26,_0x55dc('0x10'));logger[_0x55dc('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4bbc26,'request\x20sent',JSON['stringify'](_0x4cccc4));if(_0x4cccc4[_0x55dc('0x12')]){if(_0x4cccc4['error'][_0x55dc('0x13')]===0x1f4){logger[_0x55dc('0x12')](_0x55dc('0xf'),_0x4bbc26,_0x4cccc4[_0x55dc('0x12')][_0x55dc('0x14')]);return _0x1351a5(_0x4cccc4[_0x55dc('0x12')]['message']);}logger[_0x55dc('0x12')](_0x55dc('0xf'),_0x4bbc26,_0x4cccc4[_0x55dc('0x12')][_0x55dc('0x14')]);return _0x1bbea2(_0x4cccc4[_0x55dc('0x12')]['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x4bbc26,_0x55dc('0x10'));_0x1bbea2(_0x4cccc4[_0x55dc('0x15')]['message']);}})[_0x55dc('0x16')](function(_0x328d3e){logger[_0x55dc('0x12')](_0x55dc('0xf'),_0x4bbc26,_0x328d3e);_0x1351a5(_0x328d3e);});});} \ No newline at end of file +var _0x47ee=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x15b0ca,_0x570c36){var _0x34179a=function(_0x1b1b0d){while(--_0x1b1b0d){_0x15b0ca['push'](_0x15b0ca['shift']());}};_0x34179a(++_0x570c36);}(_0x47ee,0xa2));var _0xe47e=function(_0x6b3e7f,_0x346b5c){_0x6b3e7f=_0x6b3e7f-0x0;var _0x8ea76f=_0x47ee[_0x6b3e7f];return _0x8ea76f;};'use strict';var _=require(_0xe47e('0x0'));var util=require(_0xe47e('0x1'));var moment=require(_0xe47e('0x2'));var BPromise=require(_0xe47e('0x3'));var rs=require(_0xe47e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe47e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe47e('0x6'))(_0xe47e('0x7'));var config=require(_0xe47e('0x8'));var jayson=require(_0xe47e('0x9'));var client=jayson[_0xe47e('0xa')][_0xe47e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39a5aa,_0x964f05,_0x7667f1){return new BPromise(function(_0x354daf,_0x5bf2e0){return client[_0xe47e('0xc')](_0x39a5aa,_0x7667f1)[_0xe47e('0xd')](function(_0x594954){logger[_0xe47e('0xe')](_0xe47e('0xf'),_0x964f05,_0xe47e('0x10'));logger[_0xe47e('0x11')](_0xe47e('0x12'),_0x964f05,'request\x20sent',JSON[_0xe47e('0x13')](_0x594954));if(_0x594954[_0xe47e('0x14')]){if(_0x594954[_0xe47e('0x14')][_0xe47e('0x15')]===0x1f4){logger[_0xe47e('0x14')](_0xe47e('0xf'),_0x964f05,_0x594954[_0xe47e('0x14')][_0xe47e('0x16')]);return _0x5bf2e0(_0x594954[_0xe47e('0x14')][_0xe47e('0x16')]);}logger[_0xe47e('0x14')](_0xe47e('0xf'),_0x964f05,_0x594954[_0xe47e('0x14')][_0xe47e('0x16')]);return _0x354daf(_0x594954[_0xe47e('0x14')][_0xe47e('0x16')]);}else{logger[_0xe47e('0xe')]('ChatApplication,\x20%s,\x20%s',_0x964f05,'request\x20sent');_0x354daf(_0x594954[_0xe47e('0x17')][_0xe47e('0x16')]);}})['catch'](function(_0x5f1e70){logger[_0xe47e('0x14')](_0xe47e('0xf'),_0x964f05,_0x5f1e70);_0x5bf2e0(_0x5f1e70);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 59f7dc9..867a1a8 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 _0x351b=['exports','multer','path','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','update','destroy'];(function(_0x1c7f48,_0x255687){var _0x274c31=function(_0x58e252){while(--_0x58e252){_0x1c7f48['push'](_0x1c7f48['shift']());}};_0x274c31(++_0x255687);}(_0x351b,0x198));var _0xb351=function(_0x32829c,_0x2768c6){_0x32829c=_0x32829c-0x0;var _0x2114d7=_0x351b[_0x32829c];return _0x2114d7;};'use strict';var multer=require(_0xb351('0x0'));var util=require('util');var path=require(_0xb351('0x1'));var timeout=require('connect-timeout');var express=require(_0xb351('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb351('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb351('0x4'));var controller=require('./chatApplication.controller');router[_0xb351('0x5')](_0xb351('0x6'),auth[_0xb351('0x7')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb351('0x8')]);router['delete'](_0xb351('0x6'),auth[_0xb351('0x7')](),controller[_0xb351('0x9')]);module[_0xb351('0xa')]=router; \ No newline at end of file +var _0xb341=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','util','express','Router','../../components/interaction/service'];(function(_0x11fef9,_0x47c98e){var _0x1012c7=function(_0x523c03){while(--_0x523c03){_0x11fef9['push'](_0x11fef9['shift']());}};_0x1012c7(++_0x47c98e);}(_0xb341,0xb0));var _0x1b34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb341[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1b34('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1b34('0x1'));var router=express[_0x1b34('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b34('0x3'));var config=require('../../config/environment');var controller=require(_0x1b34('0x4'));router[_0x1b34('0x5')](_0x1b34('0x6'),auth[_0x1b34('0x7')](),controller[_0x1b34('0x8')]);router[_0x1b34('0x9')](_0x1b34('0x6'),auth[_0x1b34('0x7')](),controller['update']);router[_0x1b34('0xa')](_0x1b34('0x6'),auth[_0x1b34('0x7')](),controller[_0x1b34('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index a5fad33..702a81e 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 _0x9d76=['BOOLEAN','sequelize','STRING'];(function(_0x50d0a5,_0x3ece14){var _0x16a49c=function(_0x5857fb){while(--_0x5857fb){_0x50d0a5['push'](_0x50d0a5['shift']());}};_0x16a49c(++_0x3ece14);}(_0x9d76,0x76));var _0x69d7=function(_0x4f3376,_0x857693){_0x4f3376=_0x4f3376-0x0;var _0x5c6414=_0x9d76[_0x4f3376];return _0x5c6414;};'use strict';var Sequelize=require(_0x69d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x69d7('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x69d7('0x1')]},'write':{'type':Sequelize[_0x69d7('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1c90=['exports','STRING'];(function(_0x418554,_0x48be28){var _0x2420d0=function(_0x39327a){while(--_0x39327a){_0x418554['push'](_0x418554['shift']());}};_0x2420d0(++_0x48be28);}(_0x1c90,0x104));var _0x01c9=function(_0x2bd7c6,_0x2e068b){_0x2bd7c6=_0x2bd7c6-0x0;var _0x495e30=_0x1c90[_0x2bd7c6];return _0x495e30;};'use strict';var Sequelize=require('sequelize');module[_0x01c9('0x0')]={'name':{'type':Sequelize[_0x01c9('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 3e16640..838e21b 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 _0x3d50=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','length','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x3d50,0x14f));var _0x03d5=function(_0x182ab6,_0x5036be){_0x182ab6=_0x182ab6-0x0;var _0x1cace0=_0x3d50[_0x182ab6];return _0x1cace0;};'use strict';var emlformat=require(_0x03d5('0x0'));var rimraf=require(_0x03d5('0x1'));var zipdir=require(_0x03d5('0x2'));var jsonpatch=require(_0x03d5('0x3'));var rp=require(_0x03d5('0x4'));var moment=require(_0x03d5('0x5'));var BPromise=require(_0x03d5('0x6'));var Mustache=require(_0x03d5('0x7'));var util=require('util');var path=require(_0x03d5('0x8'));var sox=require(_0x03d5('0x9'));var csv=require(_0x03d5('0xa'));var ejs=require(_0x03d5('0xb'));var fs=require('fs');var fs_extra=require(_0x03d5('0xc'));var _=require('lodash');var squel=require(_0x03d5('0xd'));var crypto=require(_0x03d5('0xe'));var jsforce=require(_0x03d5('0xf'));var deskjs=require(_0x03d5('0x10'));var toCsv=require(_0x03d5('0xa'));var querystring=require('querystring');var Papa=require(_0x03d5('0x11'));var Redis=require('ioredis');var authService=require(_0x03d5('0x12'));var qs=require(_0x03d5('0x13'));var as=require(_0x03d5('0x14'));var hardwareService=require(_0x03d5('0x15'));var logger=require(_0x03d5('0x16'))(_0x03d5('0x17'));var utils=require(_0x03d5('0x18'));var config=require(_0x03d5('0x19'));var licenseUtil=require(_0x03d5('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x03d5('0x1b')](config[_0x03d5('0x1c')],{'host':_0x03d5('0x1d'),'port':0x18eb});var socket=require(_0x03d5('0x1e'))(new Redis(config[_0x03d5('0x1c')]));require('./chatGroup.socket')[_0x03d5('0x1f')](socket);function respondWithStatusCode(_0x3cfce8,_0x139906){_0x139906=_0x139906||0xcc;return function(_0x2587c6){if(_0x2587c6){return _0x3cfce8['sendStatus'](_0x139906);}return _0x3cfce8['status'](_0x139906)[_0x03d5('0x20')]();};}function respondWithResult(_0x4a88a1,_0xa8a6d8){_0xa8a6d8=_0xa8a6d8||0xc8;return function(_0x5bd5d5){if(_0x5bd5d5){return _0x4a88a1[_0x03d5('0x21')](_0xa8a6d8)[_0x03d5('0x22')](_0x5bd5d5);}};}function respondWithFilteredResult(_0x7147f2,_0x2414e2){return function(_0x383c94){if(_0x383c94){var _0x4ed033=typeof _0x2414e2[_0x03d5('0x23')]===_0x03d5('0x24')&&typeof _0x2414e2['limit']==='undefined';var _0x564576=_0x383c94[_0x03d5('0x25')];var _0x7de0b6=_0x4ed033?0x0:_0x2414e2['offset'];var _0x42b048=_0x4ed033?_0x383c94['count']:_0x2414e2[_0x03d5('0x23')]+_0x2414e2[_0x03d5('0x26')];var _0x47096e;if(_0x42b048>=_0x564576){_0x42b048=_0x564576;_0x47096e=0xc8;}else{_0x47096e=0xce;}_0x7147f2[_0x03d5('0x21')](_0x47096e);return _0x7147f2['set'](_0x03d5('0x27'),_0x7de0b6+'-'+_0x42b048+'/'+_0x564576)[_0x03d5('0x22')](_0x383c94);}return null;};}function patchUpdates(_0x151df4){return function(_0x3c0be3){try{jsonpatch[_0x03d5('0x28')](_0x3c0be3,_0x151df4,!![]);}catch(_0x2192c3){return BPromise[_0x03d5('0x29')](_0x2192c3);}return _0x3c0be3[_0x03d5('0x2a')]();};}function saveUpdates(_0x19ab69,_0x45b2c9){return function(_0x20ffce){if(_0x20ffce){return _0x20ffce[_0x03d5('0x2b')](_0x19ab69)['then'](function(_0x5f44c7){return _0x5f44c7;});}return null;};}function removeEntity(_0x592481,_0x3c808a){return function(_0x551635){if(_0x551635){return _0x551635[_0x03d5('0x2c')]()['then'](function(){_0x592481[_0x03d5('0x21')](0xcc)[_0x03d5('0x20')]();});}};}function handleEntityNotFound(_0xcd2cab,_0x232b56){return function(_0x1ad494){if(!_0x1ad494){_0xcd2cab[_0x03d5('0x2d')](0x194);}return _0x1ad494;};}function handleError(_0x4f2c06,_0x44ffaf){_0x44ffaf=_0x44ffaf||0x1f4;return function(_0x5d35e2){logger['error'](_0x5d35e2['stack']);if(_0x5d35e2[_0x03d5('0x2e')]){delete _0x5d35e2['name'];}_0x4f2c06[_0x03d5('0x21')](_0x44ffaf)['send'](_0x5d35e2);};}exports[_0x03d5('0x2f')]=function(_0xc0440e,_0x484c30){var _0x2a2b5b={},_0x5dcaa1={},_0x472a2f={'count':0x0,'rows':[]};var _0x2bba69=_[_0x03d5('0x30')](db[_0x03d5('0x31')][_0x03d5('0x32')],function(_0x3a0687){return{'name':_0x3a0687['fieldName'],'type':_0x3a0687[_0x03d5('0x33')][_0x03d5('0x34')]};});_0x5dcaa1[_0x03d5('0x35')]=_[_0x03d5('0x30')](_0x2bba69,_0x03d5('0x2e'));_0x5dcaa1[_0x03d5('0x36')]=_[_0x03d5('0x37')](_0xc0440e['query']);_0x5dcaa1[_0x03d5('0x38')]=_[_0x03d5('0x39')](_0x5dcaa1[_0x03d5('0x35')],_0x5dcaa1[_0x03d5('0x36')]);_0x2a2b5b[_0x03d5('0x3a')]=_[_0x03d5('0x39')](_0x5dcaa1[_0x03d5('0x35')],qs[_0x03d5('0x3b')](_0xc0440e[_0x03d5('0x36')][_0x03d5('0x3b')]));_0x2a2b5b['attributes']=_0x2a2b5b[_0x03d5('0x3a')]['length']?_0x2a2b5b[_0x03d5('0x3a')]:_0x5dcaa1[_0x03d5('0x35')];if(!_0xc0440e[_0x03d5('0x36')][_0x03d5('0x3c')](_0x03d5('0x3d'))){_0x2a2b5b[_0x03d5('0x26')]=qs[_0x03d5('0x26')](_0xc0440e['query'][_0x03d5('0x26')]);_0x2a2b5b[_0x03d5('0x23')]=qs['offset'](_0xc0440e['query'][_0x03d5('0x23')]);}_0x2a2b5b[_0x03d5('0x3e')]=qs[_0x03d5('0x3f')](_0xc0440e[_0x03d5('0x36')][_0x03d5('0x3f')]);_0x2a2b5b[_0x03d5('0x40')]=qs[_0x03d5('0x38')](_[_0x03d5('0x41')](_0xc0440e[_0x03d5('0x36')],_0x5dcaa1[_0x03d5('0x38')]),_0x2bba69);if(_0xc0440e['query'][_0x03d5('0x42')]){_0x2a2b5b[_0x03d5('0x40')]=_[_0x03d5('0x43')](_0x2a2b5b['where'],{'$or':_['map'](_0x2bba69,function(_0x97dcf1){if(_0x97dcf1[_0x03d5('0x33')]!==_0x03d5('0x44')){var _0x42df95={};_0x42df95[_0x97dcf1[_0x03d5('0x2e')]]={'$like':'%'+_0xc0440e['query'][_0x03d5('0x42')]+'%'};return _0x42df95;}})});}_0x2a2b5b=_['merge']({},_0x2a2b5b,_0xc0440e[_0x03d5('0x45')]);var _0x5e0c27={'where':_0x2a2b5b['where']};return db[_0x03d5('0x31')][_0x03d5('0x25')](_0x5e0c27)['then'](function(_0x4cd200){_0x472a2f[_0x03d5('0x25')]=_0x4cd200;if(_0xc0440e[_0x03d5('0x36')][_0x03d5('0x46')]){_0x2a2b5b[_0x03d5('0x47')]=[{'all':!![]}];}return db[_0x03d5('0x31')][_0x03d5('0x48')](_0x2a2b5b);})['then'](function(_0x4fae17){_0x472a2f[_0x03d5('0x49')]=_0x4fae17;return _0x472a2f;})[_0x03d5('0x4a')](respondWithFilteredResult(_0x484c30,_0x2a2b5b))[_0x03d5('0x4b')](handleError(_0x484c30,null));};exports[_0x03d5('0x4c')]=function(_0x1874c2,_0x51a2e9){var _0x1ea9f2={'raw':!![],'where':{'id':_0x1874c2[_0x03d5('0x4d')]['id']}},_0x3adfec={};_0x3adfec[_0x03d5('0x35')]=_[_0x03d5('0x37')](db[_0x03d5('0x31')]['rawAttributes']);_0x3adfec['query']=_[_0x03d5('0x37')](_0x1874c2[_0x03d5('0x36')]);_0x3adfec[_0x03d5('0x38')]=_[_0x03d5('0x39')](_0x3adfec[_0x03d5('0x35')],_0x3adfec[_0x03d5('0x36')]);_0x1ea9f2[_0x03d5('0x3a')]=_[_0x03d5('0x39')](_0x3adfec['model'],qs[_0x03d5('0x3b')](_0x1874c2[_0x03d5('0x36')]['fields']));_0x1ea9f2[_0x03d5('0x3a')]=_0x1ea9f2['attributes']['length']?_0x1ea9f2['attributes']:_0x3adfec[_0x03d5('0x35')];if(_0x1874c2[_0x03d5('0x36')][_0x03d5('0x46')]){_0x1ea9f2[_0x03d5('0x47')]=[{'all':!![]}];}_0x1ea9f2=_[_0x03d5('0x43')]({},_0x1ea9f2,_0x1874c2['options']);return db[_0x03d5('0x31')][_0x03d5('0x4e')](_0x1ea9f2)['then'](handleEntityNotFound(_0x51a2e9,null))['then'](respondWithResult(_0x51a2e9,null))['catch'](handleError(_0x51a2e9,null));};exports[_0x03d5('0x4f')]=function(_0x2d8624,_0x293c8a){return db[_0x03d5('0x31')][_0x03d5('0x4f')](_0x2d8624[_0x03d5('0x50')],{})[_0x03d5('0x4a')](respondWithResult(_0x293c8a,0xc9))['catch'](handleError(_0x293c8a,null));};exports[_0x03d5('0x2b')]=function(_0x16f3e5,_0x258f82){if(_0x16f3e5['body']['id']){delete _0x16f3e5[_0x03d5('0x50')]['id'];}return db[_0x03d5('0x31')][_0x03d5('0x4e')]({'where':{'id':_0x16f3e5['params']['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x258f82,null))[_0x03d5('0x4a')](saveUpdates(_0x16f3e5['body'],null))[_0x03d5('0x4a')](respondWithResult(_0x258f82,null))[_0x03d5('0x4b')](handleError(_0x258f82,null));};exports[_0x03d5('0x2c')]=function(_0x24fe72,_0x3dcf4c){return db[_0x03d5('0x31')][_0x03d5('0x4e')]({'where':{'id':_0x24fe72[_0x03d5('0x4d')]['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x3dcf4c,null))[_0x03d5('0x4a')](removeEntity(_0x3dcf4c,null))[_0x03d5('0x4b')](handleError(_0x3dcf4c,null));};exports[_0x03d5('0x51')]=function(_0x51158c,_0x1ef066){return db[_0x03d5('0x31')][_0x03d5('0x51')]()[_0x03d5('0x4a')](respondWithResult(_0x1ef066,null))['catch'](handleError(_0x1ef066,null));};exports[_0x03d5('0x52')]=function(_0x4363d3,_0x1dff4c,_0x48cd17){return db[_0x03d5('0x53')][_0x03d5('0x25')]({'where':{'ChatGroupId':_0x4363d3['params']['id'],'ToId':_0x4363d3[_0x03d5('0x54')]['id'],'read':![]}})[_0x03d5('0x4a')](function(_0xe4c127){return{'id':_[_0x03d5('0x55')](_0x4363d3[_0x03d5('0x4d')]['id']),'count':_0xe4c127};})[_0x03d5('0x4a')](respondWithResult(_0x1dff4c,null))[_0x03d5('0x4b')](handleError(_0x1dff4c,null));};exports['addMembers']=function(_0x5da0d7,_0x535751,_0x234af0){return db[_0x03d5('0x31')]['find']({'where':{'id':_0x5da0d7['params']['id']}})['then'](handleEntityNotFound(_0x535751,null))[_0x03d5('0x4a')](function(_0x331fff){if(_0x331fff){return _0x331fff[_0x03d5('0x56')](_0x5da0d7[_0x03d5('0x50')][_0x03d5('0x57')],_[_0x03d5('0x58')](_0x5da0d7[_0x03d5('0x50')],[_0x03d5('0x57'),'id'])||{});}})[_0x03d5('0x4a')](respondWithResult(_0x535751,null))[_0x03d5('0x4b')](handleError(_0x535751,null));};exports[_0x03d5('0x59')]=function(_0x2ece44,_0x3178a0,_0x2a8a05){var _0x45f02e={};var _0x15704f={};var _0x2da731;var _0x462246;return db[_0x03d5('0x31')][_0x03d5('0x5a')]({'where':{'id':_0x2ece44[_0x03d5('0x4d')]['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x3178a0,null))['then'](function(_0x4f2dff){if(_0x4f2dff){_0x2da731=_0x4f2dff;_0x15704f[_0x03d5('0x35')]=_[_0x03d5('0x37')](db[_0x03d5('0x5b')][_0x03d5('0x32')]);_0x15704f[_0x03d5('0x36')]=_[_0x03d5('0x37')](_0x2ece44[_0x03d5('0x36')]);_0x15704f[_0x03d5('0x38')]=_['intersection'](_0x15704f[_0x03d5('0x35')],_0x15704f['query']);_0x45f02e[_0x03d5('0x3a')]=_[_0x03d5('0x39')](_0x15704f[_0x03d5('0x35')],qs[_0x03d5('0x3b')](_0x2ece44[_0x03d5('0x36')][_0x03d5('0x3b')]));_0x45f02e['attributes']=_0x45f02e[_0x03d5('0x3a')][_0x03d5('0x5c')]?_0x45f02e[_0x03d5('0x3a')]:_0x15704f['model'];_0x45f02e['order']=qs['sort'](_0x2ece44[_0x03d5('0x36')][_0x03d5('0x3f')]);_0x45f02e[_0x03d5('0x40')]=qs[_0x03d5('0x38')](_[_0x03d5('0x41')](_0x2ece44['query'],_0x15704f[_0x03d5('0x38')]));if(_0x2ece44[_0x03d5('0x36')][_0x03d5('0x42')]){_0x45f02e['where']=_[_0x03d5('0x43')](_0x45f02e[_0x03d5('0x40')],{'$or':_['map'](_0x45f02e['attributes'],function(_0x1a0d87){var _0x4f73e3={};_0x4f73e3[_0x1a0d87]={'$like':'%'+_0x2ece44[_0x03d5('0x36')][_0x03d5('0x42')]+'%'};return _0x4f73e3;})});}_0x45f02e=_[_0x03d5('0x43')]({},_0x45f02e,_0x2ece44[_0x03d5('0x45')]);return _0x2da731[_0x03d5('0x59')](_0x45f02e);}})[_0x03d5('0x4a')](function(_0x2a6477){if(_0x2a6477){_0x462246=_0x2a6477[_0x03d5('0x5c')];if(!_0x2ece44[_0x03d5('0x36')][_0x03d5('0x3c')](_0x03d5('0x3d'))){_0x45f02e[_0x03d5('0x26')]=qs[_0x03d5('0x26')](_0x2ece44['query']['limit']);_0x45f02e[_0x03d5('0x23')]=qs[_0x03d5('0x23')](_0x2ece44[_0x03d5('0x36')]['offset']);}return _0x2da731[_0x03d5('0x59')](_0x45f02e);}})[_0x03d5('0x4a')](function(_0x38898d){if(_0x38898d){return _0x38898d?{'count':_0x462246,'rows':_0x38898d}:null;}})[_0x03d5('0x4a')](respondWithResult(_0x3178a0,null))['catch'](handleError(_0x3178a0,null));};exports['removeMembers']=function(_0x5723d5,_0x565eaf,_0x16f172){return db[_0x03d5('0x31')][_0x03d5('0x4e')]({'where':{'id':_0x5723d5['params']['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x565eaf,null))[_0x03d5('0x4a')](function(_0x5cb03d){if(_0x5cb03d){return _0x5cb03d['removeMembers'](_0x5723d5[_0x03d5('0x36')][_0x03d5('0x57')]);}})[_0x03d5('0x4a')](respondWithStatusCode(_0x565eaf,null))['catch'](handleError(_0x565eaf,null));};exports[_0x03d5('0x5d')]=function(_0x3067fb,_0xf11615,_0x47624e){if(_0x3067fb[_0x03d5('0x50')]['id']){delete _0x3067fb[_0x03d5('0x50')]['id'];}return db[_0x03d5('0x31')][_0x03d5('0x4e')]({'where':{'id':_0x3067fb[_0x03d5('0x4d')]['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0xf11615,null))['then'](function(_0x5e68b2){if(_0x5e68b2){_0x3067fb['body'][_0x03d5('0x5e')]=_0x5e68b2['id'];return db[_0x03d5('0x53')]['create'](_0x3067fb[_0x03d5('0x50')]);}})[_0x03d5('0x4a')](respondWithResult(_0xf11615,null))[_0x03d5('0x4b')](handleError(_0xf11615,null));};exports[_0x03d5('0x5f')]=function(_0x30501f,_0x187b98,_0x15bbb6){var _0x5d9db9={};var _0x111023={};var _0x34fd7d;var _0x14dffc;return db[_0x03d5('0x31')]['findOne']({'where':{'id':_0x30501f[_0x03d5('0x4d')]['id']}})[_0x03d5('0x4a')](handleEntityNotFound(_0x187b98,null))[_0x03d5('0x4a')](function(_0x40554f){if(_0x40554f){_0x34fd7d=_0x40554f;_0x111023[_0x03d5('0x35')]=_[_0x03d5('0x37')](db[_0x03d5('0x53')][_0x03d5('0x32')]);_0x111023[_0x03d5('0x36')]=_['keys'](_0x30501f[_0x03d5('0x36')]);_0x111023[_0x03d5('0x38')]=_[_0x03d5('0x39')](_0x111023[_0x03d5('0x35')],_0x111023[_0x03d5('0x36')]);_0x5d9db9['attributes']=_[_0x03d5('0x39')](_0x111023[_0x03d5('0x35')],qs['fields'](_0x30501f[_0x03d5('0x36')][_0x03d5('0x3b')]));_0x5d9db9['attributes']=_0x5d9db9[_0x03d5('0x3a')]['length']?_0x5d9db9['attributes']:_0x111023[_0x03d5('0x35')];_0x5d9db9[_0x03d5('0x3e')]=qs[_0x03d5('0x3f')](_0x30501f['query']['sort']);_0x5d9db9[_0x03d5('0x40')]=qs[_0x03d5('0x38')](_['pick'](_0x30501f[_0x03d5('0x36')],_0x111023['filters']));if(_0x30501f['query'][_0x03d5('0x42')]){_0x5d9db9['where']=_[_0x03d5('0x43')](_0x5d9db9['where'],{'$or':_[_0x03d5('0x30')](_0x5d9db9['attributes'],function(_0x3eb4e6){var _0x45eda3={};_0x45eda3[_0x3eb4e6]={'$like':'%'+_0x30501f[_0x03d5('0x36')][_0x03d5('0x42')]+'%'};return _0x45eda3;})});}if(_0x30501f[_0x03d5('0x36')][_0x03d5('0x60')]){var _0x4bcf5d=_0x30501f[_0x03d5('0x36')]['$gte']['split'](',');var _0x1fd6c8={};_0x1fd6c8[_0x4bcf5d[0x0]]={'$gte':moment(_0x4bcf5d[0x1])[_0x03d5('0x61')](_0x03d5('0x62'))};_0x5d9db9['where']=_[_0x03d5('0x43')](_0x5d9db9[_0x03d5('0x40')],_0x1fd6c8);}_0x5d9db9=_[_0x03d5('0x43')]({},_0x5d9db9,_0x30501f[_0x03d5('0x45')]);return _0x34fd7d[_0x03d5('0x5f')](_0x5d9db9);}})[_0x03d5('0x4a')](function(_0x487bff){if(_0x487bff){_0x14dffc=_0x487bff['length'];if(!_0x30501f[_0x03d5('0x36')]['hasOwnProperty'](_0x03d5('0x3d'))){_0x5d9db9[_0x03d5('0x26')]=qs[_0x03d5('0x26')](_0x30501f[_0x03d5('0x36')][_0x03d5('0x26')]);_0x5d9db9[_0x03d5('0x23')]=qs[_0x03d5('0x23')](_0x30501f['query'][_0x03d5('0x23')]);}return _0x34fd7d[_0x03d5('0x5f')](_0x5d9db9);}})[_0x03d5('0x4a')](function(_0x51faa6){if(_0x51faa6){return _0x51faa6?{'count':_0x14dffc,'rows':_0x51faa6}:null;}})[_0x03d5('0x4a')](respondWithResult(_0x187b98,null))[_0x03d5('0x4b')](handleError(_0x187b98,null));}; \ No newline at end of file +var _0x3048=['body','params','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','removeMembers','addMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','intersection','find','create'];(function(_0x552873,_0x13e8db){var _0xbdf62d=function(_0x368e1c){while(--_0x368e1c){_0x552873['push'](_0x552873['shift']());}};_0xbdf62d(++_0x13e8db);}(_0x3048,0xdf));var _0x8304=function(_0x7b0a81,_0x5e23e1){_0x7b0a81=_0x7b0a81-0x0;var _0x166572=_0x3048[_0x7b0a81];return _0x166572;};'use strict';var emlformat=require(_0x8304('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8304('0x1'));var rp=require(_0x8304('0x2'));var moment=require(_0x8304('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8304('0x4'));var util=require('util');var path=require(_0x8304('0x5'));var sox=require(_0x8304('0x6'));var csv=require(_0x8304('0x7'));var ejs=require(_0x8304('0x8'));var fs=require('fs');var fs_extra=require(_0x8304('0x9'));var _=require(_0x8304('0xa'));var squel=require('squel');var crypto=require(_0x8304('0xb'));var jsforce=require(_0x8304('0xc'));var deskjs=require(_0x8304('0xd'));var toCsv=require(_0x8304('0x7'));var querystring=require(_0x8304('0xe'));var Papa=require(_0x8304('0xf'));var Redis=require(_0x8304('0x10'));var authService=require(_0x8304('0x11'));var qs=require(_0x8304('0x12'));var as=require(_0x8304('0x13'));var hardwareService=require(_0x8304('0x14'));var logger=require(_0x8304('0x15'))(_0x8304('0x16'));var utils=require(_0x8304('0x17'));var config=require(_0x8304('0x18'));var licenseUtil=require(_0x8304('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8304('0x1a')](config['redis'],{'host':_0x8304('0x1b'),'port':0x18eb});var socket=require(_0x8304('0x1c'))(new Redis(config[_0x8304('0x1d')]));require(_0x8304('0x1e'))[_0x8304('0x1f')](socket);function respondWithStatusCode(_0x6dc2d5,_0x134026){_0x134026=_0x134026||0xcc;return function(_0x2e737b){if(_0x2e737b){return _0x6dc2d5[_0x8304('0x20')](_0x134026);}return _0x6dc2d5[_0x8304('0x21')](_0x134026)[_0x8304('0x22')]();};}function respondWithResult(_0x48a8c9,_0x2abae7){_0x2abae7=_0x2abae7||0xc8;return function(_0x4dc7be){if(_0x4dc7be){return _0x48a8c9[_0x8304('0x21')](_0x2abae7)[_0x8304('0x23')](_0x4dc7be);}};}function respondWithFilteredResult(_0x33b2ce,_0x465d6a){return function(_0x5d6764){if(_0x5d6764){var _0x361c68=typeof _0x465d6a[_0x8304('0x24')]===_0x8304('0x25')&&typeof _0x465d6a[_0x8304('0x26')]==='undefined';var _0x5d3283=_0x5d6764[_0x8304('0x27')];var _0x31b57c=_0x361c68?0x0:_0x465d6a[_0x8304('0x24')];var _0x555157=_0x361c68?_0x5d6764['count']:_0x465d6a[_0x8304('0x24')]+_0x465d6a[_0x8304('0x26')];var _0x395c77;if(_0x555157>=_0x5d3283){_0x555157=_0x5d3283;_0x395c77=0xc8;}else{_0x395c77=0xce;}_0x33b2ce[_0x8304('0x21')](_0x395c77);return _0x33b2ce[_0x8304('0x28')](_0x8304('0x29'),_0x31b57c+'-'+_0x555157+'/'+_0x5d3283)['json'](_0x5d6764);}return null;};}function patchUpdates(_0x159ab0){return function(_0x156795){try{jsonpatch[_0x8304('0x2a')](_0x156795,_0x159ab0,!![]);}catch(_0x515b0d){return BPromise[_0x8304('0x2b')](_0x515b0d);}return _0x156795['save']();};}function saveUpdates(_0x1fc585,_0x5127c0){return function(_0x515955){if(_0x515955){return _0x515955[_0x8304('0x2c')](_0x1fc585)[_0x8304('0x2d')](function(_0x2f77eb){return _0x2f77eb;});}return null;};}function removeEntity(_0x932dc8,_0x51157e){return function(_0x1fd138){if(_0x1fd138){return _0x1fd138['destroy']()['then'](function(){_0x932dc8[_0x8304('0x21')](0xcc)[_0x8304('0x22')]();});}};}function handleEntityNotFound(_0x29e1db,_0x37f95f){return function(_0x265cb0){if(!_0x265cb0){_0x29e1db['sendStatus'](0x194);}return _0x265cb0;};}function handleError(_0x2e895e,_0x2de7be){_0x2de7be=_0x2de7be||0x1f4;return function(_0x4443af){logger[_0x8304('0x2e')](_0x4443af[_0x8304('0x2f')]);if(_0x4443af[_0x8304('0x30')]){delete _0x4443af[_0x8304('0x30')];}_0x2e895e[_0x8304('0x21')](_0x2de7be)[_0x8304('0x31')](_0x4443af);};}exports[_0x8304('0x32')]=function(_0x4d9ee6,_0x2e0a3d){var _0x5a52ae={},_0x2b2f2a={},_0xb5a725={'count':0x0,'rows':[]};var _0x2ad227=_[_0x8304('0x33')](db[_0x8304('0x34')][_0x8304('0x35')],function(_0x4028ee){return{'name':_0x4028ee[_0x8304('0x36')],'type':_0x4028ee['type'][_0x8304('0x37')]};});_0x2b2f2a[_0x8304('0x38')]=_[_0x8304('0x33')](_0x2ad227,'name');_0x2b2f2a[_0x8304('0x39')]=_[_0x8304('0x3a')](_0x4d9ee6['query']);_0x2b2f2a['filters']=_['intersection'](_0x2b2f2a[_0x8304('0x38')],_0x2b2f2a[_0x8304('0x39')]);_0x5a52ae[_0x8304('0x3b')]=_['intersection'](_0x2b2f2a[_0x8304('0x38')],qs[_0x8304('0x3c')](_0x4d9ee6[_0x8304('0x39')]['fields']));_0x5a52ae[_0x8304('0x3b')]=_0x5a52ae[_0x8304('0x3b')][_0x8304('0x3d')]?_0x5a52ae['attributes']:_0x2b2f2a[_0x8304('0x38')];if(!_0x4d9ee6['query'][_0x8304('0x3e')](_0x8304('0x3f'))){_0x5a52ae[_0x8304('0x26')]=qs[_0x8304('0x26')](_0x4d9ee6['query'][_0x8304('0x26')]);_0x5a52ae[_0x8304('0x24')]=qs[_0x8304('0x24')](_0x4d9ee6[_0x8304('0x39')][_0x8304('0x24')]);}_0x5a52ae['order']=qs[_0x8304('0x40')](_0x4d9ee6[_0x8304('0x39')][_0x8304('0x40')]);_0x5a52ae[_0x8304('0x41')]=qs[_0x8304('0x42')](_[_0x8304('0x43')](_0x4d9ee6[_0x8304('0x39')],_0x2b2f2a[_0x8304('0x42')]),_0x2ad227);if(_0x4d9ee6['query'][_0x8304('0x44')]){_0x5a52ae[_0x8304('0x41')]=_[_0x8304('0x45')](_0x5a52ae[_0x8304('0x41')],{'$or':_[_0x8304('0x33')](_0x2ad227,function(_0x31595b){if(_0x31595b['type']!==_0x8304('0x46')){var _0x2be02a={};_0x2be02a[_0x31595b[_0x8304('0x30')]]={'$like':'%'+_0x4d9ee6[_0x8304('0x39')][_0x8304('0x44')]+'%'};return _0x2be02a;}})});}_0x5a52ae=_['merge']({},_0x5a52ae,_0x4d9ee6[_0x8304('0x47')]);var _0x37ea78={'where':_0x5a52ae[_0x8304('0x41')]};return db[_0x8304('0x34')][_0x8304('0x27')](_0x37ea78)[_0x8304('0x2d')](function(_0x45b1ae){_0xb5a725[_0x8304('0x27')]=_0x45b1ae;if(_0x4d9ee6[_0x8304('0x39')][_0x8304('0x48')]){_0x5a52ae[_0x8304('0x49')]=[{'all':!![]}];}return db[_0x8304('0x34')]['findAll'](_0x5a52ae);})['then'](function(_0x2145c0){_0xb5a725[_0x8304('0x4a')]=_0x2145c0;return _0xb5a725;})[_0x8304('0x2d')](respondWithFilteredResult(_0x2e0a3d,_0x5a52ae))[_0x8304('0x4b')](handleError(_0x2e0a3d,null));};exports[_0x8304('0x4c')]=function(_0x145218,_0x22e2a3){var _0x28c943={'raw':!![],'where':{'id':_0x145218['params']['id']}},_0x4a8a13={};_0x4a8a13[_0x8304('0x38')]=_['keys'](db[_0x8304('0x34')]['rawAttributes']);_0x4a8a13[_0x8304('0x39')]=_[_0x8304('0x3a')](_0x145218['query']);_0x4a8a13[_0x8304('0x42')]=_[_0x8304('0x4d')](_0x4a8a13[_0x8304('0x38')],_0x4a8a13['query']);_0x28c943[_0x8304('0x3b')]=_[_0x8304('0x4d')](_0x4a8a13[_0x8304('0x38')],qs[_0x8304('0x3c')](_0x145218['query'][_0x8304('0x3c')]));_0x28c943['attributes']=_0x28c943[_0x8304('0x3b')]['length']?_0x28c943[_0x8304('0x3b')]:_0x4a8a13['model'];if(_0x145218[_0x8304('0x39')][_0x8304('0x48')]){_0x28c943['include']=[{'all':!![]}];}_0x28c943=_[_0x8304('0x45')]({},_0x28c943,_0x145218['options']);return db[_0x8304('0x34')][_0x8304('0x4e')](_0x28c943)[_0x8304('0x2d')](handleEntityNotFound(_0x22e2a3,null))['then'](respondWithResult(_0x22e2a3,null))[_0x8304('0x4b')](handleError(_0x22e2a3,null));};exports['create']=function(_0xa44e8f,_0xd660e3){return db['ChatGroup'][_0x8304('0x4f')](_0xa44e8f[_0x8304('0x50')],{})[_0x8304('0x2d')](respondWithResult(_0xd660e3,0xc9))[_0x8304('0x4b')](handleError(_0xd660e3,null));};exports[_0x8304('0x2c')]=function(_0x3737d3,_0x305a81){if(_0x3737d3[_0x8304('0x50')]['id']){delete _0x3737d3[_0x8304('0x50')]['id'];}return db[_0x8304('0x34')][_0x8304('0x4e')]({'where':{'id':_0x3737d3[_0x8304('0x51')]['id']}})[_0x8304('0x2d')](handleEntityNotFound(_0x305a81,null))['then'](saveUpdates(_0x3737d3[_0x8304('0x50')],null))[_0x8304('0x2d')](respondWithResult(_0x305a81,null))[_0x8304('0x4b')](handleError(_0x305a81,null));};exports[_0x8304('0x52')]=function(_0x104a11,_0x27be2e){return db[_0x8304('0x34')][_0x8304('0x4e')]({'where':{'id':_0x104a11[_0x8304('0x51')]['id']}})[_0x8304('0x2d')](handleEntityNotFound(_0x27be2e,null))['then'](removeEntity(_0x27be2e,null))[_0x8304('0x4b')](handleError(_0x27be2e,null));};exports[_0x8304('0x53')]=function(_0x4980f3,_0x3dea3f){return db[_0x8304('0x34')][_0x8304('0x53')]()[_0x8304('0x2d')](respondWithResult(_0x3dea3f,null))[_0x8304('0x4b')](handleError(_0x3dea3f,null));};exports[_0x8304('0x54')]=function(_0x27d3e8,_0x24d405,_0x467b7c){return db[_0x8304('0x55')][_0x8304('0x27')]({'where':{'ChatGroupId':_0x27d3e8[_0x8304('0x51')]['id'],'ToId':_0x27d3e8[_0x8304('0x56')]['id'],'read':![]}})['then'](function(_0x1d9b11){return{'id':_[_0x8304('0x57')](_0x27d3e8[_0x8304('0x51')]['id']),'count':_0x1d9b11};})[_0x8304('0x2d')](respondWithResult(_0x24d405,null))[_0x8304('0x4b')](handleError(_0x24d405,null));};exports[_0x8304('0x58')]=function(_0x5b2c38,_0x33fcf4,_0x504e0c){return db['ChatGroup'][_0x8304('0x4e')]({'where':{'id':_0x5b2c38[_0x8304('0x51')]['id']}})[_0x8304('0x2d')](handleEntityNotFound(_0x33fcf4,null))[_0x8304('0x2d')](function(_0x1ae365){if(_0x1ae365){return _0x1ae365[_0x8304('0x58')](_0x5b2c38['body'][_0x8304('0x59')],_[_0x8304('0x5a')](_0x5b2c38['body'],[_0x8304('0x59'),'id'])||{});}})[_0x8304('0x2d')](respondWithResult(_0x33fcf4,null))[_0x8304('0x4b')](handleError(_0x33fcf4,null));};exports[_0x8304('0x5b')]=function(_0x19c5dc,_0x12dd45,_0x58b63c){var _0xf1918e={};var _0x1b1d73={};var _0x19b32c;var _0x562684;return db[_0x8304('0x34')][_0x8304('0x5c')]({'where':{'id':_0x19c5dc[_0x8304('0x51')]['id']}})[_0x8304('0x2d')](handleEntityNotFound(_0x12dd45,null))[_0x8304('0x2d')](function(_0x571ed3){if(_0x571ed3){_0x19b32c=_0x571ed3;_0x1b1d73['model']=_[_0x8304('0x3a')](db[_0x8304('0x5d')]['rawAttributes']);_0x1b1d73[_0x8304('0x39')]=_[_0x8304('0x3a')](_0x19c5dc[_0x8304('0x39')]);_0x1b1d73[_0x8304('0x42')]=_[_0x8304('0x4d')](_0x1b1d73[_0x8304('0x38')],_0x1b1d73['query']);_0xf1918e['attributes']=_[_0x8304('0x4d')](_0x1b1d73['model'],qs[_0x8304('0x3c')](_0x19c5dc['query'][_0x8304('0x3c')]));_0xf1918e[_0x8304('0x3b')]=_0xf1918e['attributes'][_0x8304('0x3d')]?_0xf1918e[_0x8304('0x3b')]:_0x1b1d73[_0x8304('0x38')];_0xf1918e[_0x8304('0x5e')]=qs[_0x8304('0x40')](_0x19c5dc['query']['sort']);_0xf1918e[_0x8304('0x41')]=qs['filters'](_['pick'](_0x19c5dc[_0x8304('0x39')],_0x1b1d73['filters']));if(_0x19c5dc[_0x8304('0x39')][_0x8304('0x44')]){_0xf1918e['where']=_[_0x8304('0x45')](_0xf1918e['where'],{'$or':_['map'](_0xf1918e[_0x8304('0x3b')],function(_0x2b5d6f){var _0x571163={};_0x571163[_0x2b5d6f]={'$like':'%'+_0x19c5dc[_0x8304('0x39')]['filter']+'%'};return _0x571163;})});}_0xf1918e=_[_0x8304('0x45')]({},_0xf1918e,_0x19c5dc['options']);return _0x19b32c[_0x8304('0x5b')](_0xf1918e);}})['then'](function(_0x5eb23d){if(_0x5eb23d){_0x562684=_0x5eb23d['length'];if(!_0x19c5dc[_0x8304('0x39')][_0x8304('0x3e')](_0x8304('0x3f'))){_0xf1918e['limit']=qs[_0x8304('0x26')](_0x19c5dc[_0x8304('0x39')][_0x8304('0x26')]);_0xf1918e[_0x8304('0x24')]=qs[_0x8304('0x24')](_0x19c5dc[_0x8304('0x39')]['offset']);}return _0x19b32c[_0x8304('0x5b')](_0xf1918e);}})[_0x8304('0x2d')](function(_0x20fdd5){if(_0x20fdd5){return _0x20fdd5?{'count':_0x562684,'rows':_0x20fdd5}:null;}})[_0x8304('0x2d')](respondWithResult(_0x12dd45,null))['catch'](handleError(_0x12dd45,null));};exports[_0x8304('0x5f')]=function(_0x246b87,_0x1ae9fd,_0x4e99cf){return db[_0x8304('0x34')][_0x8304('0x4e')]({'where':{'id':_0x246b87[_0x8304('0x51')]['id']}})['then'](handleEntityNotFound(_0x1ae9fd,null))[_0x8304('0x2d')](function(_0x5514a5){if(_0x5514a5){return _0x5514a5[_0x8304('0x5f')](_0x246b87[_0x8304('0x39')][_0x8304('0x59')]);}})[_0x8304('0x2d')](respondWithStatusCode(_0x1ae9fd,null))[_0x8304('0x4b')](handleError(_0x1ae9fd,null));};exports[_0x8304('0x60')]=function(_0x2614c3,_0xa8c579,_0x568bb3){if(_0x2614c3['body']['id']){delete _0x2614c3[_0x8304('0x50')]['id'];}return db[_0x8304('0x34')][_0x8304('0x4e')]({'where':{'id':_0x2614c3[_0x8304('0x51')]['id']}})['then'](handleEntityNotFound(_0xa8c579,null))['then'](function(_0x370b0d){if(_0x370b0d){_0x2614c3[_0x8304('0x50')]['ChatGroupId']=_0x370b0d['id'];return db[_0x8304('0x55')]['create'](_0x2614c3['body']);}})[_0x8304('0x2d')](respondWithResult(_0xa8c579,null))['catch'](handleError(_0xa8c579,null));};exports[_0x8304('0x61')]=function(_0x2cc3d0,_0x1a7fae,_0xbe1d8){var _0x4795cf={};var _0x502756={};var _0x2ab6ac;var _0x565dde;return db[_0x8304('0x34')][_0x8304('0x5c')]({'where':{'id':_0x2cc3d0['params']['id']}})[_0x8304('0x2d')](handleEntityNotFound(_0x1a7fae,null))[_0x8304('0x2d')](function(_0x1b08bd){if(_0x1b08bd){_0x2ab6ac=_0x1b08bd;_0x502756[_0x8304('0x38')]=_['keys'](db[_0x8304('0x55')][_0x8304('0x35')]);_0x502756[_0x8304('0x39')]=_[_0x8304('0x3a')](_0x2cc3d0[_0x8304('0x39')]);_0x502756[_0x8304('0x42')]=_[_0x8304('0x4d')](_0x502756[_0x8304('0x38')],_0x502756[_0x8304('0x39')]);_0x4795cf[_0x8304('0x3b')]=_[_0x8304('0x4d')](_0x502756['model'],qs[_0x8304('0x3c')](_0x2cc3d0[_0x8304('0x39')]['fields']));_0x4795cf[_0x8304('0x3b')]=_0x4795cf[_0x8304('0x3b')][_0x8304('0x3d')]?_0x4795cf[_0x8304('0x3b')]:_0x502756[_0x8304('0x38')];_0x4795cf[_0x8304('0x5e')]=qs[_0x8304('0x40')](_0x2cc3d0[_0x8304('0x39')]['sort']);_0x4795cf[_0x8304('0x41')]=qs[_0x8304('0x42')](_[_0x8304('0x43')](_0x2cc3d0[_0x8304('0x39')],_0x502756['filters']));if(_0x2cc3d0[_0x8304('0x39')][_0x8304('0x44')]){_0x4795cf[_0x8304('0x41')]=_[_0x8304('0x45')](_0x4795cf[_0x8304('0x41')],{'$or':_[_0x8304('0x33')](_0x4795cf[_0x8304('0x3b')],function(_0xac98e2){var _0x2cc801={};_0x2cc801[_0xac98e2]={'$like':'%'+_0x2cc3d0[_0x8304('0x39')]['filter']+'%'};return _0x2cc801;})});}if(_0x2cc3d0['query'][_0x8304('0x62')]){var _0x5305a4=_0x2cc3d0[_0x8304('0x39')][_0x8304('0x62')][_0x8304('0x63')](',');var _0x30b076={};_0x30b076[_0x5305a4[0x0]]={'$gte':moment(_0x5305a4[0x1])['format'](_0x8304('0x64'))};_0x4795cf[_0x8304('0x41')]=_[_0x8304('0x45')](_0x4795cf[_0x8304('0x41')],_0x30b076);}_0x4795cf=_['merge']({},_0x4795cf,_0x2cc3d0[_0x8304('0x47')]);return _0x2ab6ac[_0x8304('0x61')](_0x4795cf);}})[_0x8304('0x2d')](function(_0x1f4956){if(_0x1f4956){_0x565dde=_0x1f4956[_0x8304('0x3d')];if(!_0x2cc3d0[_0x8304('0x39')][_0x8304('0x3e')](_0x8304('0x3f'))){_0x4795cf[_0x8304('0x26')]=qs['limit'](_0x2cc3d0['query']['limit']);_0x4795cf['offset']=qs[_0x8304('0x24')](_0x2cc3d0['query']['offset']);}return _0x2ab6ac[_0x8304('0x61')](_0x4795cf);}})[_0x8304('0x2d')](function(_0x3c31dd){if(_0x3c31dd){return _0x3c31dd?{'count':_0x565dde,'rows':_0x3c31dd}:null;}})[_0x8304('0x2d')](respondWithResult(_0x1a7fae,null))[_0x8304('0x4b')](handleError(_0x1a7fae,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d5276f8..9665a14 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 _0x6636=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2920b1,_0x3b9959){var _0x1bd6fb=function(_0x18585d){while(--_0x18585d){_0x2920b1['push'](_0x2920b1['shift']());}};_0x1bd6fb(++_0x3b9959);}(_0x6636,0x119));var _0x6663=function(_0x20a701,_0x431182){_0x20a701=_0x20a701-0x0;var _0x357715=_0x6636[_0x20a701];return _0x357715;};'use strict';var EventEmitter=require(_0x6663('0x0'));var ChatGroup=require(_0x6663('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6663('0x2')](0x0);var events={'afterCreate':_0x6663('0x3'),'afterUpdate':_0x6663('0x4'),'afterDestroy':_0x6663('0x5')};function emitEvent(_0x3b27e6){return function(_0x26173b,_0x24de71,_0x39f6ff){ChatGroupEvents[_0x6663('0x6')](_0x3b27e6+':'+_0x26173b['id'],_0x26173b);ChatGroupEvents[_0x6663('0x6')](_0x3b27e6,_0x26173b);_0x39f6ff(null);};}for(var e in events){if(events[_0x6663('0x7')](e)){var event=events[e];ChatGroup[_0x6663('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x8bca=['hasOwnProperty','hook','events','../../mysqldb','ChatGroup','save','update','remove','emit'];(function(_0xfa7ea0,_0x47fe5f){var _0x577356=function(_0x2d8b6e){while(--_0x2d8b6e){_0xfa7ea0['push'](_0xfa7ea0['shift']());}};_0x577356(++_0x47fe5f);}(_0x8bca,0x12b));var _0xa8bc=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8bca[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require(_0xa8bc('0x0'));var ChatGroup=require(_0xa8bc('0x1'))['db'][_0xa8bc('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8bc('0x3'),'afterUpdate':_0xa8bc('0x4'),'afterDestroy':_0xa8bc('0x5')};function emitEvent(_0x1d462c){return function(_0x3a76d6,_0xeee07d,_0x1a44b6){ChatGroupEvents[_0xa8bc('0x6')](_0x1d462c+':'+_0x3a76d6['id'],_0x3a76d6);ChatGroupEvents[_0xa8bc('0x6')](_0x1d462c,_0x3a76d6);_0x1a44b6(null);};}for(var e in events){if(events[_0xa8bc('0x7')](e)){var event=events[e];ChatGroup[_0xa8bc('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 9af7f11..292a433 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 _0xa288=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x10feb7,_0x238e45){var _0x4ae6cf=function(_0x1ff066){while(--_0x1ff066){_0x10feb7['push'](_0x10feb7['shift']());}};_0x4ae6cf(++_0x238e45);}(_0xa288,0x6e));var _0x8a28=function(_0x130d2e,_0xf53241){_0x130d2e=_0x130d2e-0x0;var _0x4798fb=_0xa288[_0x130d2e];return _0x4798fb;};'use strict';var _=require(_0x8a28('0x0'));var util=require('util');var logger=require(_0x8a28('0x1'))(_0x8a28('0x2'));var moment=require('moment');var BPromise=require(_0x8a28('0x3'));var rp=require(_0x8a28('0x4'));var fs=require('fs');var path=require(_0x8a28('0x5'));var rimraf=require(_0x8a28('0x6'));var config=require(_0x8a28('0x7'));var attributes=require(_0x8a28('0x8'));module[_0x8a28('0x9')]=function(_0x27a972,_0x4c4e48){return _0x27a972[_0x8a28('0xa')](_0x8a28('0xb'),attributes,{'tableName':_0x8a28('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe157=['../../config/logger','api','request-promise','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x2b0690,_0x4f742f){var _0x82be1=function(_0x1e1084){while(--_0x1e1084){_0x2b0690['push'](_0x2b0690['shift']());}};_0x82be1(++_0x4f742f);}(_0xe157,0x8a));var _0x7e15=function(_0x2aed86,_0x14a90d){_0x2aed86=_0x2aed86-0x0;var _0x339071=_0xe157[_0x2aed86];return _0x339071;};'use strict';var _=require(_0x7e15('0x0'));var util=require(_0x7e15('0x1'));var logger=require(_0x7e15('0x2'))(_0x7e15('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7e15('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7e15('0x5'));module[_0x7e15('0x6')]=function(_0x1b65ff,_0x385192){return _0x1b65ff[_0x7e15('0x7')](_0x7e15('0x8'),attributes,{'tableName':_0x7e15('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 e9ab7a4..54d2813 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 _0xb138=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error'];(function(_0x23ac93,_0x19d38c){var _0x1ed344=function(_0x2bf388){while(--_0x2bf388){_0x23ac93['push'](_0x23ac93['shift']());}};_0x1ed344(++_0x19d38c);}(_0xb138,0x1dd));var _0x8b13=function(_0x3ba72d,_0xeb3c6d){_0x3ba72d=_0x3ba72d-0x0;var _0x39491f=_0xb138[_0x3ba72d];return _0x39491f;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});config['redis']=_[_0x8b13('0xc')](config[_0x8b13('0xd')],{'host':_0x8b13('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b13('0xd')]));require(_0x8b13('0xf'))['register'](socket);function respondWithRpcPromise(_0x53ae50,_0x1f2528,_0x21fcd9){return new BPromise(function(_0x13fbd1,_0x439451){return client[_0x8b13('0x10')](_0x53ae50,_0x21fcd9)['then'](function(_0x11bc89){logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));logger[_0x8b13('0x14')](_0x8b13('0x15'),_0x1f2528,'request\x20sent',JSON['stringify'](_0x11bc89));if(_0x11bc89[_0x8b13('0x16')]){if(_0x11bc89[_0x8b13('0x16')]['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x439451(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}logger[_0x8b13('0x16')]('ChatGroup,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x13fbd1(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}else{logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));_0x13fbd1(_0x11bc89[_0x8b13('0x18')]['message']);}})['catch'](function(_0xae4966){logger[_0x8b13('0x16')](_0x8b13('0x12'),_0x1f2528,_0xae4966);_0x439451(_0xae4966);});});} \ No newline at end of file +var _0x7df1=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatGroup,\x20%s,\x20%s'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x7df1,0xe4));var _0x17df=function(_0x1bd029,_0x1e0202){_0x1bd029=_0x1bd029-0x0;var _0x1ff21f=_0x7df1[_0x1bd029];return _0x1ff21f;};'use strict';var _=require(_0x17df('0x0'));var util=require(_0x17df('0x1'));var moment=require(_0x17df('0x2'));var BPromise=require('bluebird');var rs=require(_0x17df('0x3'));var fs=require('fs');var Redis=require(_0x17df('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x17df('0x5'))(_0x17df('0x6'));var config=require(_0x17df('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x17df('0x8')]['http']({'port':0x232a});config[_0x17df('0x9')]=_['defaults'](config['redis'],{'host':_0x17df('0xa'),'port':0x18eb});var socket=require(_0x17df('0xb'))(new Redis(config['redis']));require(_0x17df('0xc'))[_0x17df('0xd')](socket);function respondWithRpcPromise(_0x1c4279,_0x153bff,_0x57125b){return new BPromise(function(_0x5a777a,_0x502e2e){return client[_0x17df('0xe')](_0x1c4279,_0x57125b)['then'](function(_0x42b73a){logger[_0x17df('0xf')]('ChatGroup,\x20%s,\x20%s',_0x153bff,'request\x20sent');logger[_0x17df('0x10')](_0x17df('0x11'),_0x153bff,_0x17df('0x12'),JSON['stringify'](_0x42b73a));if(_0x42b73a[_0x17df('0x13')]){if(_0x42b73a[_0x17df('0x13')][_0x17df('0x14')]===0x1f4){logger[_0x17df('0x13')](_0x17df('0x15'),_0x153bff,_0x42b73a[_0x17df('0x13')][_0x17df('0x16')]);return _0x502e2e(_0x42b73a[_0x17df('0x13')]['message']);}logger['error'](_0x17df('0x15'),_0x153bff,_0x42b73a[_0x17df('0x13')][_0x17df('0x16')]);return _0x5a777a(_0x42b73a[_0x17df('0x13')]['message']);}else{logger[_0x17df('0xf')]('ChatGroup,\x20%s,\x20%s',_0x153bff,_0x17df('0x12'));_0x5a777a(_0x42b73a[_0x17df('0x17')][_0x17df('0x16')]);}})[_0x17df('0x18')](function(_0x98228b){logger['error'](_0x17df('0x15'),_0x153bff,_0x98228b);_0x502e2e(_0x98228b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index b49209b..cc3aa79 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 _0x3666=['removeListener','register','length','chatGroup:','./chatGroup.events','remove'];(function(_0x51c4c9,_0x26cbfd){var _0x5b8ff2=function(_0x49b7f8){while(--_0x49b7f8){_0x51c4c9['push'](_0x51c4c9['shift']());}};_0x5b8ff2(++_0x26cbfd);}(_0x3666,0x1b4));var _0x6366=function(_0x2ab386,_0x1df578){_0x2ab386=_0x2ab386-0x0;var _0x385bf8=_0x3666[_0x2ab386];return _0x385bf8;};'use strict';var ChatGroupEvents=require(_0x6366('0x0'));var events=['save',_0x6366('0x1'),'update'];function createListener(_0x502133,_0x4617bc){return function(_0x2feac4){_0x4617bc['emit'](_0x502133,_0x2feac4);};}function removeListener(_0x510538,_0x459d82){return function(){ChatGroupEvents[_0x6366('0x2')](_0x510538,_0x459d82);};}exports[_0x6366('0x3')]=function(_0x4ac38d){for(var _0x19c401=0x0,_0x3573bf=events[_0x6366('0x4')];_0x19c401<_0x3573bf;_0x19c401++){var _0x3f804a=events[_0x19c401];var _0x76bec1=createListener(_0x6366('0x5')+_0x3f804a,_0x4ac38d);ChatGroupEvents['on'](_0x3f804a,_0x76bec1);}}; \ No newline at end of file +var _0xc2aa=['update','removeListener','register','length','chatGroup:','save'];(function(_0x20b777,_0x1241c5){var _0x2ed92b=function(_0x2c41c9){while(--_0x2c41c9){_0x20b777['push'](_0x20b777['shift']());}};_0x2ed92b(++_0x1241c5);}(_0xc2aa,0x89));var _0xac2a=function(_0x132d9e,_0x4a0839){_0x132d9e=_0x132d9e-0x0;var _0x40b733=_0xc2aa[_0x132d9e];return _0x40b733;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xac2a('0x0'),'remove',_0xac2a('0x1')];function createListener(_0x2a8575,_0x2233ac){return function(_0x553e8a){_0x2233ac['emit'](_0x2a8575,_0x553e8a);};}function removeListener(_0x421c8c,_0x506377){return function(){ChatGroupEvents[_0xac2a('0x2')](_0x421c8c,_0x506377);};}exports[_0xac2a('0x3')]=function(_0x1cbf49){for(var _0x17947f=0x0,_0x48e8b2=events[_0xac2a('0x4')];_0x17947f<_0x48e8b2;_0x17947f++){var _0xcc1e7f=events[_0x17947f];var _0x163fb4=createListener(_0xac2a('0x5')+_0xcc1e7f,_0x1cbf49);ChatGroupEvents['on'](_0xcc1e7f,_0x163fb4);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index c9955c6..f14919c 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 _0x2ba5=['fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/unread','/:id/members','getMembers','post','create','addMembers','addMessage','update','destroy','delete','removeMembers','multer','util','path','connect-timeout','express','Router'];(function(_0x2df84d,_0x56d874){var _0x2634ce=function(_0x8e8e31){while(--_0x8e8e31){_0x2df84d['push'](_0x2df84d['shift']());}};_0x2634ce(++_0x56d874);}(_0x2ba5,0x1c5));var _0x52ba=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x2ba5[_0x95411e];return _0x2c8718;};'use strict';var multer=require(_0x52ba('0x0'));var util=require(_0x52ba('0x1'));var path=require(_0x52ba('0x2'));var timeout=require(_0x52ba('0x3'));var express=require(_0x52ba('0x4'));var router=express[_0x52ba('0x5')]();var fs_extra=require(_0x52ba('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x52ba('0x7'));var config=require(_0x52ba('0x8'));var controller=require(_0x52ba('0x9'));router[_0x52ba('0xa')]('/',auth[_0x52ba('0xb')](),controller[_0x52ba('0xc')]);router['get'](_0x52ba('0xd'),auth['isAuthenticated'](),controller[_0x52ba('0xe')]);router[_0x52ba('0xa')](_0x52ba('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x52ba('0x10'),auth['isAuthenticated'](),controller['getUnread']);router[_0x52ba('0xa')](_0x52ba('0x11'),auth[_0x52ba('0xb')](),controller[_0x52ba('0x12')]);router['get']('/:id/messages',auth[_0x52ba('0xb')](),controller['getMessages']);router[_0x52ba('0x13')]('/',auth[_0x52ba('0xb')](),controller[_0x52ba('0x14')]);router['post']('/:id/members',auth[_0x52ba('0xb')](),controller[_0x52ba('0x15')]);router[_0x52ba('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x52ba('0x16')]);router['put'](_0x52ba('0xf'),auth[_0x52ba('0xb')](),controller[_0x52ba('0x17')]);router['delete'](_0x52ba('0xf'),auth['isAuthenticated'](),controller[_0x52ba('0x18')]);router[_0x52ba('0x19')](_0x52ba('0x11'),auth[_0x52ba('0xb')](),controller[_0x52ba('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x16ae=['update','delete','destroy','removeMembers','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x16ae,0x156));var _0xe16a=function(_0x529e8a,_0x463528){_0x529e8a=_0x529e8a-0x0;var _0x2fb984=_0x16ae[_0x529e8a];return _0x2fb984;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe16a('0x0'));var express=require(_0xe16a('0x1'));var router=express[_0xe16a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe16a('0x3'));var config=require(_0xe16a('0x4'));var controller=require(_0xe16a('0x5'));router[_0xe16a('0x6')]('/',auth[_0xe16a('0x7')](),controller['index']);router[_0xe16a('0x6')](_0xe16a('0x8'),auth[_0xe16a('0x7')](),controller['describe']);router[_0xe16a('0x6')](_0xe16a('0x9'),auth['isAuthenticated'](),controller[_0xe16a('0xa')]);router[_0xe16a('0x6')](_0xe16a('0xb'),auth[_0xe16a('0x7')](),controller[_0xe16a('0xc')]);router[_0xe16a('0x6')](_0xe16a('0xd'),auth[_0xe16a('0x7')](),controller[_0xe16a('0xe')]);router[_0xe16a('0x6')](_0xe16a('0xf'),auth[_0xe16a('0x7')](),controller[_0xe16a('0x10')]);router[_0xe16a('0x11')]('/',auth[_0xe16a('0x7')](),controller[_0xe16a('0x12')]);router[_0xe16a('0x11')](_0xe16a('0xd'),auth['isAuthenticated'](),controller[_0xe16a('0x13')]);router[_0xe16a('0x11')](_0xe16a('0xf'),auth[_0xe16a('0x7')](),controller[_0xe16a('0x14')]);router[_0xe16a('0x15')](_0xe16a('0x9'),auth['isAuthenticated'](),controller[_0xe16a('0x16')]);router[_0xe16a('0x17')](_0xe16a('0x9'),auth[_0xe16a('0x7')](),controller[_0xe16a('0x18')]);router[_0xe16a('0x17')]('/:id/members',auth[_0xe16a('0x7')](),controller[_0xe16a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0d00af3..218ee28 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 _0x8603=['long','DATE','ENUM','out','exports','BOOLEAN','INTEGER','thumb','star','TEXT','STRING'];(function(_0x548c28,_0x3a0d82){var _0x42128c=function(_0x2fa786){while(--_0x2fa786){_0x548c28['push'](_0x548c28['shift']());}};_0x42128c(++_0x3a0d82);}(_0x8603,0x190));var _0x3860=function(_0x3f1879,_0x436c73){_0x3f1879=_0x3f1879-0x0;var _0x2873d1=_0x8603[_0x3f1879];return _0x2873d1;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'closed':{'type':Sequelize[_0x3860('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3860('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x3860('0x3')),'defaultValue':_0x3860('0x4')},'ratingMessage':{'type':Sequelize[_0x3860('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3860('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3860('0x6')]},'secondDisposition':{'type':Sequelize[_0x3860('0x6')]},'thirdDisposition':{'type':Sequelize[_0x3860('0x6')]},'note':{'type':Sequelize[_0x3860('0x6')]},'browserName':{'type':Sequelize[_0x3860('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x3860('0x6')]},'deviceVendor':{'type':Sequelize[_0x3860('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x3860('0x5')]},'customerIp':{'type':Sequelize[_0x3860('0x6')]},'formData':{'type':Sequelize['TEXT'](_0x3860('0x7'))},'read1stAt':{'type':Sequelize[_0x3860('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3860('0x9')]('in',_0x3860('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x3860('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x3860('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x3860('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x00ea=['BOOLEAN','ENUM','star','thumb','TEXT','DATE','STRING','long','exports'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0x00ea,0x19d));var _0xa00e=function(_0x384741,_0x29461c){_0x384741=_0x384741-0x0;var _0x58c3ee=_0x00ea[_0x384741];return _0x58c3ee;};'use strict';var Sequelize=require('sequelize');module[_0xa00e('0x0')]={'closed':{'type':Sequelize[_0xa00e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa00e('0x2')](_0xa00e('0x3'),_0xa00e('0x4')),'defaultValue':_0xa00e('0x3')},'ratingMessage':{'type':Sequelize[_0xa00e('0x5')]},'pathTranscript':{'type':Sequelize[_0xa00e('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa00e('0x6')]},'disposition':{'type':Sequelize[_0xa00e('0x7')]},'secondDisposition':{'type':Sequelize[_0xa00e('0x7')]},'thirdDisposition':{'type':Sequelize[_0xa00e('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xa00e('0x7')]},'browserVersion':{'type':Sequelize[_0xa00e('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xa00e('0x7')]},'deviceModel':{'type':Sequelize[_0xa00e('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xa00e('0x7')]},'referer':{'type':Sequelize[_0xa00e('0x5')]},'customerIp':{'type':Sequelize[_0xa00e('0x7')]},'formData':{'type':Sequelize['TEXT'](_0xa00e('0x8'))},'read1stAt':{'type':Sequelize[_0xa00e('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa00e('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa00e('0x7')]},'customerPort':{'type':Sequelize[_0xa00e('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xa00e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xa00e('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 262c2d3..98a1a67 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 _0xe4fd=['Tag','emit','chatInteractionTags:save','removeTags','toString','tmp','server','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','N.A.','closedAt','browserName','customerIp','customerPort','tail','existsSync','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','client','http','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','merge','body','agent','interaction','account','map','rawAttributes','type','key','getOptions','findAll','chat','user','keys','ChatInteraction','filters','intersection','model','fields','length','attributes','query','includeAll','include','find','create','params','describe','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','parse','Sequelize','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','Attachment','attachmentDownload','Unauthorized','findOne','join','root','offline-chat/','download','close','server/files/chat/upload/','format','now','pathTranscript','Messages','User','ContactId','%s%d','System','agentIdentifier','agentAlias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','\x22%s\x22\x20<%s>','Mail\x20Transcript','mailTranscript','addMessage','ids','omit','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','order','ChatInteractionId','includeAgent','push','addTags','setTags'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0xe4fd,0x1af));var _0xde4f=function(_0x136420,_0x29e998){_0x136420=_0x136420-0x0;var _0x5999f5=_0xe4fd[_0x136420];return _0x5999f5;};'use strict';var rimraf=require(_0xde4f('0x0'));var zipdir=require(_0xde4f('0x1'));var rp=require(_0xde4f('0x2'));var moment=require(_0xde4f('0x3'));var BPromise=require(_0xde4f('0x4'));var Mustache=require(_0xde4f('0x5'));var util=require(_0xde4f('0x6'));var path=require(_0xde4f('0x7'));var ejs=require(_0xde4f('0x8'));var fs=require('fs');var _=require(_0xde4f('0x9'));var Redis=require(_0xde4f('0xa'));var interaction=require(_0xde4f('0xb'));var qs=require(_0xde4f('0xc'));var pdf=require(_0xde4f('0xd'));var logger=require(_0xde4f('0xe'))(_0xde4f('0xf'));var config=require(_0xde4f('0x10'));var db=require('../../mysqldb')['db'];config[_0xde4f('0x11')]=_[_0xde4f('0x12')](config[_0xde4f('0x11')],{'host':_0xde4f('0x13'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0xde4f('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0xde4f('0x15')][_0xde4f('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x368002,_0x5c753a,_0x236a6b,_0x157dfc){return new BPromise(function(_0x553681,_0x13a188){var _0x26039=_0x157dfc||client;return _0x26039[_0xde4f('0x17')](_0x368002,_0x236a6b)['then'](function(_0x347676){logger[_0xde4f('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5c753a,_0xde4f('0x19'));logger[_0xde4f('0x1a')](_0xde4f('0x1b'),_0x5c753a,_0xde4f('0x19'),JSON[_0xde4f('0x1c')](_0x347676));if(_0x347676[_0xde4f('0x1d')]){if(_0x347676[_0xde4f('0x1d')][_0xde4f('0x1e')]===0x1f4){logger[_0xde4f('0x1d')](_0xde4f('0x1f'),_0x5c753a,_0x347676[_0xde4f('0x1d')]['message']);return _0x13a188(_0x347676[_0xde4f('0x1d')]['message']);}logger[_0xde4f('0x1d')](_0xde4f('0x1f'),_0x5c753a,_0x347676[_0xde4f('0x1d')][_0xde4f('0x20')]);return _0x553681(_0x347676[_0xde4f('0x1d')][_0xde4f('0x20')]);}else{logger[_0xde4f('0x18')](_0xde4f('0x1f'),_0x5c753a,_0xde4f('0x19'));_0x553681(_0x347676[_0xde4f('0x21')]['message']);}})[_0xde4f('0x22')](function(_0x580618){logger[_0xde4f('0x1d')](_0xde4f('0x1f'),_0x5c753a,_0x580618);_0x13a188(_0x580618);});});}function respondWithStatusCode(_0x311251,_0x11a013){_0x11a013=_0x11a013||0xcc;return function(_0x22d3b1){if(_0x22d3b1){return _0x311251[_0xde4f('0x23')](_0x11a013);}return _0x311251[_0xde4f('0x24')](_0x11a013)[_0xde4f('0x25')]();};}function respondWithResult(_0x1b915d,_0x1533dd){_0x1533dd=_0x1533dd||0xc8;return function(_0x1299d4){if(_0x1299d4){return _0x1b915d[_0xde4f('0x24')](_0x1533dd)[_0xde4f('0x26')](_0x1299d4);}};}function respondWithFilteredResult(_0x2d5108,_0x48b966){return function(_0x35b3a1){if(_0x35b3a1){var _0x115c44=typeof _0x48b966[_0xde4f('0x27')]===_0xde4f('0x28')&&typeof _0x48b966[_0xde4f('0x29')]===_0xde4f('0x28');var _0x559c4f=_0x35b3a1[_0xde4f('0x2a')];var _0x85d13=_0x115c44?0x0:_0x48b966['offset'];var _0x284cd3=_0x115c44?_0x35b3a1[_0xde4f('0x2a')]:_0x48b966[_0xde4f('0x27')]+_0x48b966[_0xde4f('0x29')];var _0x75b5e5;if(_0x284cd3>=_0x559c4f){_0x284cd3=_0x559c4f;_0x75b5e5=0xc8;}else{_0x75b5e5=0xce;}_0x2d5108[_0xde4f('0x24')](_0x75b5e5);return _0x2d5108[_0xde4f('0x2b')](_0xde4f('0x2c'),_0x85d13+'-'+_0x284cd3+'/'+_0x559c4f)[_0xde4f('0x26')](_0x35b3a1);}return null;};}function saveUpdates(_0x1802a5){return function(_0x200b8f){if(_0x200b8f){return _0x200b8f[_0xde4f('0x2d')](_0x1802a5)[_0xde4f('0x2e')](function(_0x590158){return _0x590158;});}return null;};}function removeEntity(_0x3e6ecf){return function(_0x2bfd47){if(_0x2bfd47){return _0x2bfd47[_0xde4f('0x2f')]()['then'](function(){_0x3e6ecf[_0xde4f('0x24')](0xcc)[_0xde4f('0x25')]();});}};}function handleEntityNotFound(_0x5ccda2){return function(_0x36de2d){if(!_0x36de2d){_0x5ccda2[_0xde4f('0x23')](0x194);}return _0x36de2d;};}function handleError(_0x3db4e3,_0x2131a9){_0x2131a9=_0x2131a9||0x1f4;return function(_0x4755f3){logger[_0xde4f('0x1d')](_0x4755f3[_0xde4f('0x30')]);if(_0x4755f3[_0xde4f('0x31')]){delete _0x4755f3[_0xde4f('0x31')];}_0x3db4e3[_0xde4f('0x24')](_0x2131a9)['send'](_0x4755f3);};}function getMustacheRender(_0x28180f,_0x37cd8d){return Mustache['render'](_0x28180f,_[_0xde4f('0x32')](_0x37cd8d[_0xde4f('0x33')],{'contact':_0x37cd8d['contact'],'message':_0x37cd8d[_0xde4f('0x20')],'agent':_0x37cd8d[_0xde4f('0x34')],'interaction':_0x37cd8d[_0xde4f('0x35')],'account':_0x37cd8d[_0xde4f('0x36')]}))||'';}exports['index']=function(_0x23227d,_0x265c46){var _0x427b3e={};var _0xe66616=_[_0xde4f('0x37')](db['ChatInteraction'][_0xde4f('0x38')],function(_0x50b2be){return{'name':_0x50b2be['fieldName'],'type':_0x50b2be[_0xde4f('0x39')][_0xde4f('0x3a')]};});_0x427b3e=qs[_0xde4f('0x3b')](_0xe66616,_0x23227d);return interaction[_0xde4f('0x3c')](_0xde4f('0x3d'),_0x23227d['query'],_0x23227d[_0xde4f('0x3e')],_0x427b3e,_0xe66616)[_0xde4f('0x2e')](respondWithFilteredResult(_0x265c46,_0x427b3e))[_0xde4f('0x22')](handleError(_0x265c46,null));};exports['show']=function(_0x22690c,_0x2ae83e){var _0x9ae8a5={'raw':![],'where':{'id':_0x22690c['params']['id']}},_0x374509={};_0x374509['model']=_[_0xde4f('0x3f')](db[_0xde4f('0x40')][_0xde4f('0x38')]);_0x374509['query']=_[_0xde4f('0x3f')](_0x22690c['query']);_0x374509[_0xde4f('0x41')]=_[_0xde4f('0x42')](_0x374509[_0xde4f('0x43')],_0x374509['query']);_0x9ae8a5['attributes']=_['intersection'](_0x374509[_0xde4f('0x43')],qs[_0xde4f('0x44')](_0x22690c['query'][_0xde4f('0x44')]));_0x9ae8a5['attributes']=_0x9ae8a5['attributes'][_0xde4f('0x45')]?_0x9ae8a5[_0xde4f('0x46')]:_0x374509[_0xde4f('0x43')];if(_0x22690c[_0xde4f('0x47')][_0xde4f('0x48')]){_0x9ae8a5[_0xde4f('0x49')]=[{'all':!![]}];}_0x9ae8a5=_[_0xde4f('0x32')]({},_0x9ae8a5,_0x22690c['options']);return db[_0xde4f('0x40')][_0xde4f('0x4a')](_0x9ae8a5)[_0xde4f('0x2e')](handleEntityNotFound(_0x2ae83e,null))[_0xde4f('0x2e')](respondWithResult(_0x2ae83e,null))['catch'](handleError(_0x2ae83e,null));};exports[_0xde4f('0x4b')]=function(_0x46634e,_0x670ec5){return db['ChatInteraction'][_0xde4f('0x4b')](_0x46634e[_0xde4f('0x33')],{})['then'](respondWithResult(_0x670ec5,0xc9))['catch'](handleError(_0x670ec5,null));};exports[_0xde4f('0x2d')]=function(_0x477e6,_0x55b825){if(_0x477e6[_0xde4f('0x33')]['id']){delete _0x477e6[_0xde4f('0x33')]['id'];}return db[_0xde4f('0x40')]['find']({'where':{'id':_0x477e6[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x55b825,null))[_0xde4f('0x2e')](saveUpdates(_0x477e6[_0xde4f('0x33')],null))['then'](respondWithResult(_0x55b825,null))[_0xde4f('0x22')](handleError(_0x55b825,null));};exports[_0xde4f('0x2f')]=function(_0x34f0e3,_0x3b5e09){return db[_0xde4f('0x40')][_0xde4f('0x4a')]({'where':{'id':_0x34f0e3[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x3b5e09,null))[_0xde4f('0x2e')](removeEntity(_0x3b5e09,null))[_0xde4f('0x22')](handleError(_0x3b5e09,null));};exports[_0xde4f('0x4d')]=function(_0x8ff547,_0xbb1f41){return db[_0xde4f('0x40')][_0xde4f('0x4d')]()[_0xde4f('0x2e')](respondWithResult(_0xbb1f41,null))[_0xde4f('0x22')](handleError(_0xbb1f41,null));};exports['createVidaooSession']=function(_0x16b43e,_0x12467e){var _0x6b6866=_0x16b43e[_0xde4f('0x4c')]['id'];var _0x26968d;var _0x150612;var _0x47d159;return db['ChatInteraction']['findOne']({'where':{'id':_0x6b6866}})['then'](function(_0x18fd68){_0x26968d=_0x18fd68;return db[_0xde4f('0x4e')]['findOne']({'where':{'id':_0x18fd68[_0xde4f('0x4f')]},'attributes':['id',_0xde4f('0x50'),_0xde4f('0x51'),_0xde4f('0x52'),_0xde4f('0x53'),_0xde4f('0x54')],'raw':!![]});})[_0xde4f('0x2e')](function(_0xb89d97){if(_0xb89d97&&_0xb89d97[_0xde4f('0x50')]&&_0xb89d97[_0xde4f('0x51')]){_0x150612=_0xb89d97;var _0x382459={'interaction':{'id':_0x6b6866},'agent':{'id':_0x16b43e[_0xde4f('0x3e')]['id'],'name':_0x16b43e[_0xde4f('0x3e')][_0xde4f('0x31')],'fullname':_0x16b43e[_0xde4f('0x3e')][_0xde4f('0x55')],'email':_0x16b43e[_0xde4f('0x3e')][_0xde4f('0x56')]},'contact':_0x16b43e[_0xde4f('0x33')][_0xde4f('0x57')],'account':_0x16b43e[_0xde4f('0x33')][_0xde4f('0x36')]};var _0x10c27a={'rejectUnauthorized':![],'method':'POST','url':_0xde4f('0x58'),'headers':{'X-APIKEY':_0xb89d97[_0xde4f('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x16b43e[_0xde4f('0x3e')][_0xde4f('0x56')]],'buttons':null,'topic':_0x150612[_0xde4f('0x52')],'note':_['isNull'](_0x150612[_0xde4f('0x53')])?null:getMustacheRender(_0x150612['vidaooNote'],_0x382459),'metadata':null},'redirect':_0xde4f('0x59'),'json':!![]};try{if(!_[_0xde4f('0x5a')](_0x150612[_0xde4f('0x54')])){var _0x31ea8a=getMustacheRender(_0x150612[_0xde4f('0x54')],_0x382459);var _0x1456f5=JSON[_0xde4f('0x5b')](_0x31ea8a);_0x10c27a['body']['metadata']=_0x1456f5;}}catch(_0xfc19b3){throw new db[(_0xde4f('0x5c'))][(_0xde4f('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x10c27a);}else{throw new db[(_0xde4f('0x5c'))][(_0xde4f('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xde4f('0x2e')](function(_0x86d6b5){_0x47d159=_0x86d6b5;if(_0x47d159['id']){var _0x1ce4ff={'body':_0x47d159[_0xde4f('0x5e')],'ChatWebsiteId':_0x150612['id'],'ChatInteractionId':_0x26968d['id'],'direction':_0xde4f('0x5f'),'UserId':_0x16b43e[_0xde4f('0x3e')]['id']};return db[_0xde4f('0x60')][_0xde4f('0x4b')](_0x1ce4ff,{});}else{throw new db[(_0xde4f('0x5c'))][(_0xde4f('0x5d'))](_0xde4f('0x61'));}})['then'](function(){return _0x26968d[_0xde4f('0x62')]({'vidaooSessionId':_0x47d159['id']});})[_0xde4f('0x2e')](respondWithResult(_0x12467e,null))[_0xde4f('0x22')](handleError(_0x12467e,null));};exports[_0xde4f('0x63')]=function(_0x8b65b3,_0x54a21d){if(_0x8b65b3['body']['id']){delete _0x8b65b3['body']['id'];}return db[_0xde4f('0x40')][_0xde4f('0x4a')]({'where':{'id':_0x8b65b3['params']['id']},'include':[{'model':db[_0xde4f('0x64')],'as':_0xde4f('0x65')}]})[_0xde4f('0x2e')](handleEntityNotFound(_0x54a21d,null))[_0xde4f('0x2e')](saveUpdates(_0x8b65b3[_0xde4f('0x33')],null))['then'](respondWithResult(_0x54a21d,null))[_0xde4f('0x22')](handleError(_0x54a21d,null));};exports[_0xde4f('0x66')]=function(_0x224d40,_0x2b530a){if(_0x224d40[_0xde4f('0x33')]['id']){delete _0x224d40[_0xde4f('0x33')]['id'];}return db[_0xde4f('0x40')]['find']({'where':{'id':_0x224d40[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](function(_0xd4d2f1){if(!_0xd4d2f1){logger[_0xde4f('0x1d')](_0xde4f('0x67'),_0xde4f('0x66'),0x194,'entity\x20not\x20found');_0x2b530a[_0xde4f('0x23')](0x194);}else{if(_0xd4d2f1[_0xde4f('0x68')]){throw new db['Sequelize'][(_0xde4f('0x5d'))](_0xde4f('0x69'));}}return _0xd4d2f1;})[_0xde4f('0x2e')](function(_0x3ececa){if(_0x3ececa){return _0x3ececa[_0xde4f('0x2d')]({'closed':_0x224d40[_0xde4f('0x33')][_0xde4f('0x6a')],'disposition':_0x224d40[_0xde4f('0x33')][_0xde4f('0x6b')]})[_0xde4f('0x2e')](function(_0x292d6f){return _0x292d6f;});}})[_0xde4f('0x2e')](function(){return respondWithRpcPromise(_0xde4f('0x6c'),'abandon',_0x224d40[_0xde4f('0x33')],client9004);})[_0xde4f('0x2e')](respondWithResult(_0x2b530a,null))[_0xde4f('0x22')](handleError(_0x2b530a,null));};exports['attachmentUpload']=function(_0x44ec98,_0xec1c7f){_0x44ec98['body'][_0xde4f('0x31')]=_0x44ec98[_0xde4f('0x6d')][_0xde4f('0x6e')];_0x44ec98['body'][_0xde4f('0x6f')]=_0x44ec98['file'][_0xde4f('0x70')];_0x44ec98['body'][_0xde4f('0x39')]=_0x44ec98[_0xde4f('0x6d')]['mimetype'];return db[_0xde4f('0x71')][_0xde4f('0x4b')](_0x44ec98[_0xde4f('0x33')])[_0xde4f('0x2e')](respondWithResult(_0xec1c7f,0xc9))['catch'](handleError(_0xec1c7f,null));};exports[_0xde4f('0x72')]=function(_0x1384a6,_0x54e91a){return db[_0xde4f('0x40')]['findOne']({'where':{'id':_0x1384a6['params']['id']},'raw':!![]})[_0xde4f('0x2e')](handleEntityNotFound(_0x54e91a,null))['then'](function(_0x601ec9){if(_0x601ec9){if(_0x601ec9[_0xde4f('0x6a')]){return _0x54e91a[_0xde4f('0x24')](0x193)[_0xde4f('0x26')]({'status':0x193,'message':_0xde4f('0x73')});}return db[_0xde4f('0x71')][_0xde4f('0x74')]({'where':{'id':_0x1384a6[_0xde4f('0x47')]['attachId']},'raw':!![]})[_0xde4f('0x2e')](handleEntityNotFound(_0x54e91a,null));}})[_0xde4f('0x2e')](function(_0x162074){if(_0x162074){var _0x2c5948=_0x162074['ChatOfflineMessageId']!==null;var _0x36de35=path[_0xde4f('0x75')](config[_0xde4f('0x76')],'server/files/attachments/');if(_0x2c5948){_0x36de35=path[_0xde4f('0x75')](_0x36de35,_0xde4f('0x77'));}var _0x17dbd7=path[_0xde4f('0x75')](_0x36de35,_0x162074[_0xde4f('0x6f')]);return _0x54e91a[_0xde4f('0x78')](_0x17dbd7);}})[_0xde4f('0x22')](handleError(_0x54e91a,null));};exports[_0xde4f('0x79')]=function(_0x4f6754,_0x59504e){var _0x1ef525=null;var _0x1c75f8=null;var _0x597b3d=null;if(_0x4f6754[_0xde4f('0x33')]['id']){delete _0x4f6754[_0xde4f('0x33')]['id'];}if(_0x4f6754[_0xde4f('0x33')]['mailTranscript']){_0x597b3d=path['join'](config[_0xde4f('0x76')],_0xde4f('0x7a'),util[_0xde4f('0x7b')]('transcript-%s.txt',Date[_0xde4f('0x7c')]()));_0x4f6754[_0xde4f('0x33')][_0xde4f('0x7d')]=_0x597b3d;}return db[_0xde4f('0x40')][_0xde4f('0x4a')]({'where':{'id':_0x4f6754[_0xde4f('0x4c')]['id']},'include':[{'model':db[_0xde4f('0x60')],'as':_0xde4f('0x7e'),'include':[{'model':db['User'],'as':_0xde4f('0x7f')}]}]})['then'](handleEntityNotFound(_0x59504e,null))[_0xde4f('0x2e')](saveUpdates(_0x4f6754[_0xde4f('0x33')],null))[_0xde4f('0x2e')](function(_0x460548){if(_0x460548){_0x1ef525=_0x460548;return db['ChatWebsite'][_0xde4f('0x4a')]({'where':{'id':_0x1ef525[_0xde4f('0x4f')]}});}})['then'](function(_0x34bbb9){if(_0x34bbb9){_0x1c75f8=_0x34bbb9;return db[_0xde4f('0x64')][_0xde4f('0x4a')]({'where':{'id':_0x1ef525[_0xde4f('0x80')]}});}})[_0xde4f('0x2e')](function(_0x6c8a2e){if(_0x6c8a2e){if(_0x597b3d){var _0x375edd=null;for(var _0x4e5b00=0x1;_0x4e5b00<_0x1ef525[_0xde4f('0x7e')][_0xde4f('0x45')];++_0x4e5b00){_0x375edd=_0x1ef525[_0xde4f('0x7e')][_0x4e5b00];var _0x15a251=_0x375edd['UserId']?util[_0xde4f('0x7b')](_0xde4f('0x81'),_0x1c75f8['agentAlias'],_0x375edd['UserId']):_0xde4f('0x82');var _0x37d311=_0x4f6754[_0xde4f('0x33')]['customer']||util[_0xde4f('0x7b')]('%s%d','Visitor',_0x375edd['ContactId']);switch(_0x1c75f8[_0xde4f('0x83')]){case'website_alias':_0x15a251=_0x375edd[_0xde4f('0x68')]?util['format']('%s%d',_0x1c75f8[_0xde4f('0x84')],_0x375edd[_0xde4f('0x68')]):_0xde4f('0x82');break;case'agent_alias':_0x15a251=_0x375edd['UserId']?_0x375edd['User'][_0xde4f('0x85')]||_0x375edd[_0xde4f('0x7f')][_0xde4f('0x55')]:'System';break;case _0xde4f('0x86'):_0x15a251=_0x375edd['UserId']?_0x375edd['User'][_0xde4f('0x55')]:_0xde4f('0x82');break;default:_0x15a251=_0x375edd[_0xde4f('0x68')]?util[_0xde4f('0x7b')](_0xde4f('0x81'),_0x1c75f8['agentAlias'],_0x375edd[_0xde4f('0x68')]):_0xde4f('0x82');}var _0x370042=util[_0xde4f('0x7b')](_0xde4f('0x87'),moment(_0x375edd[_0xde4f('0x88')])[_0xde4f('0x7b')](_0xde4f('0x89')),_0x375edd[_0xde4f('0x8a')]==='in'?_0x37d311:_0x15a251,_0x375edd[_0xde4f('0x33')]);if(!_0x375edd[_0xde4f('0x8b')]){fs[_0xde4f('0x8c')](_0x597b3d,_0x370042);}}return db[_0xde4f('0x8d')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xde4f('0x8e')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xde4f('0x8f'),'raw':!![]}]}]});}}})['then'](function(_0x328304){if(!_0x328304||!_0x328304[_0xde4f('0x90')]||!_0x4f6754[_0xde4f('0x33')])return _0x1ef525;var _0x380efc=_0x328304[_0xde4f('0x91')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x380efc,'message':{'from':util[_0xde4f('0x7b')](_0xde4f('0x92'),_0x328304[_0xde4f('0x31')],_0x328304['email']||_0x328304['Smtp'][_0xde4f('0x3e')]),'to':_0x4f6754['body']['mailTranscript'],'subject':_0xde4f('0x93'),'text':util[_0xde4f('0x7b')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4f6754['body'][_0xde4f('0x94')]),'attachments':[{'path':_0x597b3d}]}})['then'](function(){return _0x1ef525;})['catch'](function(_0x327207){logger[_0xde4f('0x1d')](_0x327207);});})['then'](respondWithStatusCode(_0x59504e,0xc8))[_0xde4f('0x22')](handleError(_0x59504e,null));};exports[_0xde4f('0x95')]=function(_0x261287,_0x3f57c8){return db['ChatMessage'][_0xde4f('0x4a')]({'where':{'id':_0x261287['params']['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x3f57c8,null))[_0xde4f('0x2e')](function(_0x5b25d3){if(_0x5b25d3){return _0x5b25d3[_0xde4f('0x95')](_0x261287['body'][_0xde4f('0x96')],_[_0xde4f('0x97')](_0x261287['body'],['ids','id'])||{});}})[_0xde4f('0x2e')](respondWithResult(_0x3f57c8,null))[_0xde4f('0x22')](handleError(_0x3f57c8,null));};exports['getMessages']=function(_0x230bc1,_0x5df3fb){var _0x5e1678={'raw':![],'where':{}};var _0x529503={};var _0x5f20c0={'count':0x0,'rows':[]};return db[_0xde4f('0x40')][_0xde4f('0x74')]({'where':{'id':_0x230bc1[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x5df3fb,null))[_0xde4f('0x2e')](function(_0x1d8dd3){if(_0x1d8dd3){_0x529503[_0xde4f('0x43')]=_['keys'](db[_0xde4f('0x60')]['rawAttributes']);_0x529503[_0xde4f('0x47')]=_[_0xde4f('0x3f')](_0x230bc1[_0xde4f('0x47')]);_0x529503[_0xde4f('0x41')]=_[_0xde4f('0x42')](_0x529503['model'],_0x529503[_0xde4f('0x47')]);_0x5e1678[_0xde4f('0x46')]=_[_0xde4f('0x42')](_0x529503[_0xde4f('0x43')],qs[_0xde4f('0x44')](_0x230bc1[_0xde4f('0x47')][_0xde4f('0x44')]));_0x5e1678[_0xde4f('0x46')]=_0x5e1678[_0xde4f('0x46')]['length']?_0x5e1678[_0xde4f('0x46')]:_0x529503[_0xde4f('0x43')];if(!_0x230bc1['query'][_0xde4f('0x98')](_0xde4f('0x99'))){_0x5e1678[_0xde4f('0x29')]=qs[_0xde4f('0x29')](_0x230bc1[_0xde4f('0x47')]['limit']);_0x5e1678[_0xde4f('0x27')]=qs[_0xde4f('0x27')](_0x230bc1[_0xde4f('0x47')]['offset']);}_0x5e1678['order']=qs['sort'](_0x230bc1[_0xde4f('0x47')][_0xde4f('0x9a')]);_0x5e1678[_0xde4f('0x9b')]=qs[_0xde4f('0x41')](_[_0xde4f('0x9c')](_0x230bc1[_0xde4f('0x47')],_0x529503['filters']));_0x5e1678[_0xde4f('0x9b')]['ChatInteractionId']=_0x1d8dd3['id'];if(_0x230bc1['query']['filter']){_0x5e1678[_0xde4f('0x9b')]=_[_0xde4f('0x32')](_0x5e1678[_0xde4f('0x9b')],{'$or':_['map'](_0x5e1678[_0xde4f('0x46')],function(_0x1742a8){var _0xba0384={};_0xba0384[_0x1742a8]={'$like':'%'+_0x230bc1[_0xde4f('0x47')][_0xde4f('0x9d')]+'%'};return _0xba0384;})});}if(_0x230bc1[_0xde4f('0x47')][_0xde4f('0x9e')]){var _0x4cf9fc=_0x230bc1[_0xde4f('0x47')]['$gte']['split'](',');var _0x206969={};_0x206969[_0x4cf9fc[0x0]]={'$gte':moment(_0x4cf9fc[0x1])[_0xde4f('0x7b')](_0xde4f('0x9f'))};_0x5e1678[_0xde4f('0x9b')]=_[_0xde4f('0x32')](_0x5e1678[_0xde4f('0x9b')],_0x206969);}_0x5e1678=_[_0xde4f('0x32')]({},_0x5e1678,_0x230bc1[_0xde4f('0xa0')]);return db['ChatMessage']['count']({'where':_0x5e1678[_0xde4f('0x9b')]})[_0xde4f('0x2e')](function(_0xcf71d7){_0x5f20c0[_0xde4f('0x2a')]=_0xcf71d7;if(_0x230bc1[_0xde4f('0x47')][_0xde4f('0x48')]){_0x5e1678[_0xde4f('0x49')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x5e1678);})[_0xde4f('0x2e')](function(_0x1f814a){_0x5f20c0[_0xde4f('0xa1')]=_0x1f814a;return _0x5f20c0;});}})['then'](respondWithFilteredResult(_0x5df3fb,_0x5e1678))[_0xde4f('0x22')](handleError(_0x5df3fb,null));};exports[_0xde4f('0xa2')]=function(_0x2a3540,_0x43ce81){var _0x509949={'where':{}},_0x3162fd={},_0x5a4aae={'count':0x0,'rows':[]};return db[_0xde4f('0x40')][_0xde4f('0x74')]({'where':{'id':_0x2a3540[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x43ce81,null))[_0xde4f('0x2e')](function(_0x27d96c){if(_0x27d96c){_0x3162fd[_0xde4f('0x43')]=_[_0xde4f('0x3f')](db['ChatMessage'][_0xde4f('0x38')]);_0x3162fd[_0xde4f('0x47')]=_[_0xde4f('0x3f')](_0x2a3540[_0xde4f('0x47')]);_0x3162fd[_0xde4f('0x41')]=_[_0xde4f('0x42')](_0x3162fd['model'],_0x3162fd[_0xde4f('0x47')]);_0x509949['attributes']=_[_0xde4f('0x42')](_0x3162fd[_0xde4f('0x43')],qs[_0xde4f('0x44')](_0x2a3540[_0xde4f('0x47')][_0xde4f('0x44')]));_0x509949[_0xde4f('0x46')]=_0x509949[_0xde4f('0x46')][_0xde4f('0x45')]?_0x509949['attributes']:_0x3162fd[_0xde4f('0x43')];if(!_0x2a3540[_0xde4f('0x47')][_0xde4f('0x98')](_0xde4f('0x99'))){_0x509949[_0xde4f('0x29')]=qs[_0xde4f('0x29')](_0x2a3540[_0xde4f('0x47')][_0xde4f('0x29')]);_0x509949[_0xde4f('0x27')]=qs[_0xde4f('0x27')](_0x2a3540[_0xde4f('0x47')][_0xde4f('0x27')]);}_0x509949[_0xde4f('0xa3')]=qs[_0xde4f('0x9a')](_0x2a3540['query'][_0xde4f('0x9a')]);_0x509949[_0xde4f('0x9b')]=qs[_0xde4f('0x41')](_['pick'](_0x2a3540[_0xde4f('0x47')],_0x3162fd[_0xde4f('0x41')]));_0x509949['where'][_0xde4f('0xa4')]=_0x27d96c['id'];if(_0x2a3540['query'][_0xde4f('0x9d')]){_0x509949[_0xde4f('0x9b')]=_[_0xde4f('0x32')](_0x509949[_0xde4f('0x9b')],{'$or':_['map'](_0x509949['attributes'],function(_0x27cee1){var _0xcd49ff={};_0xcd49ff[_0x27cee1]={'$like':'%'+_0x2a3540[_0xde4f('0x47')][_0xde4f('0x9d')]+'%'};return _0xcd49ff;})});}_0x509949[_0xde4f('0x9b')][_0xde4f('0x8b')]=![];if(_0x2a3540[_0xde4f('0x47')]['id']){_0x509949[_0xde4f('0x9b')]['id']={'$gt':_0x2a3540[_0xde4f('0x47')]['id']};}_0x509949=_[_0xde4f('0x32')]({},_0x509949,_0x2a3540[_0xde4f('0xa0')]);return db[_0xde4f('0x60')][_0xde4f('0x2a')]({'where':_0x509949[_0xde4f('0x9b')]})[_0xde4f('0x2e')](function(_0x12c39b){_0x5a4aae[_0xde4f('0x2a')]=_0x12c39b;_0x509949[_0xde4f('0x49')]=[];if(_0x2a3540[_0xde4f('0x47')][_0xde4f('0xa5')]){_0x509949['include'][_0xde4f('0xa6')]({'model':db[_0xde4f('0x7f')],'as':_0xde4f('0x7f'),'attributes':['id',_0xde4f('0x55'),_0xde4f('0x85')]});}if(_0x2a3540[_0xde4f('0x47')][_0xde4f('0x48')]){_0x509949[_0xde4f('0x49')]=[{'all':!![]}];}return db[_0xde4f('0x60')]['findAll'](_0x509949);})[_0xde4f('0x2e')](function(_0x26201e){_0x5a4aae[_0xde4f('0xa1')]=_0x26201e;return _0x5a4aae;});}})[_0xde4f('0x2e')](respondWithFilteredResult(_0x43ce81,_0x509949))[_0xde4f('0x22')](handleError(_0x43ce81,null));};exports[_0xde4f('0xa7')]=function(_0x1d32b8,_0x19c448){return db[_0xde4f('0x40')]['find']({'where':{'id':_0x1d32b8[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x19c448,null))[_0xde4f('0x2e')](function(_0xb12cd4){if(_0xb12cd4){return _0xb12cd4[_0xde4f('0xa8')](_0x1d32b8[_0xde4f('0x33')]['ids'],_['omit'](_0x1d32b8[_0xde4f('0x33')],['ids','id'])||{})['spread'](function(){return db[_0xde4f('0xa9')][_0xde4f('0x3c')]({'attributes':['id',_0xde4f('0x31'),'color'],'where':{'id':_0x1d32b8['body'][_0xde4f('0x96')]}});})[_0xde4f('0x2e')](function(_0x4641ea){socket[_0xde4f('0xaa')](_0xde4f('0xab'),{'id':Number(_0x1d32b8[_0xde4f('0x4c')]['id']),'tags':_0x4641ea||[]});return{'id':Number(_0x1d32b8['params']['id']),'tags':_0x4641ea||[]};});}})['then'](respondWithResult(_0x19c448,null))['catch'](handleError(_0x19c448,null));};exports['removeTags']=function(_0x5a0ac0,_0x583348){return db[_0xde4f('0x40')][_0xde4f('0x4a')]({'where':{'id':_0x5a0ac0[_0xde4f('0x4c')]['id']}})[_0xde4f('0x2e')](handleEntityNotFound(_0x583348,null))['then'](function(_0x5bb234){if(_0x5bb234){return _0x5bb234[_0xde4f('0xac')](_0x5a0ac0[_0xde4f('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x583348,null))[_0xde4f('0x22')](handleError(_0x583348,null));};exports[_0xde4f('0x78')]=function(_0x2c92a0,_0x516bee){var _0x471aec=moment()['unix']()[_0xde4f('0xad')]();var _0xbc98c7=path['join'](config['root'],'server','files',_0xde4f('0xae'));var _0x5c7fa3=path[_0xde4f('0x75')](config['root'],_0xde4f('0xaf'),'files',_0xde4f('0xb0'));var _0x376881=path[_0xde4f('0x75')](_0xbc98c7,_0x471aec);var _0x17a358=util[_0xde4f('0x7b')](_0xde4f('0xb1'),_0x2c92a0[_0xde4f('0x4c')]['id'],_0x471aec);var _0x33f247=path[_0xde4f('0x75')](_0xbc98c7,_0x17a358);var _0x12c8bb=[];_0x12c8bb[_0xde4f('0xa6')]({'model':db['User'],'as':_0xde4f('0x7f'),'attributes':['id',_0xde4f('0x55')],'raw':!![]});_0x12c8bb[_0xde4f('0xa6')]({'model':db['CmContact'],'as':_0xde4f('0x65'),'attributes':['id',_0xde4f('0xb2'),_0xde4f('0xb3')],'raw':!![]});if(_0x2c92a0[_0xde4f('0x47')][_0xde4f('0xb0')]){_0x12c8bb[_0xde4f('0xa6')]({'model':db[_0xde4f('0x71')],'as':_0xde4f('0x71'),'raw':!![]});}var _0x5624f7=[{'model':db['ChatMessage'],'as':_0xde4f('0x7e'),'attributes':['id','body',_0xde4f('0x88'),_0xde4f('0x8a'),'secret',_0xde4f('0xb4')],'include':_0x12c8bb}];_0x5624f7[_0xde4f('0xa6')]({'model':db[_0xde4f('0x4e')],'as':_0xde4f('0xb5'),'attributes':['id','name']});_0x5624f7[_0xde4f('0xa6')]({'model':db['User'],'as':_0xde4f('0xb6'),'attributes':['id',_0xde4f('0x55')]});return db[_0xde4f('0x40')]['find']({'where':{'id':_0x2c92a0[_0xde4f('0x4c')]['id']},'include':_0x5624f7})[_0xde4f('0x2e')](handleEntityNotFound(_0x516bee,null))[_0xde4f('0x2e')](function(_0xb6e4d1){if(_0xb6e4d1){var _0x2175c7=_0xb6e4d1[_0xde4f('0xb7')]({'plain':!![]});fs['mkdirSync'](_0x376881);var _0x20e548={'channel':'Chat','account':_0x2175c7[_0xde4f('0xb5')][_0xde4f('0x31')],'agent':_0x2175c7[_0xde4f('0xb6')]?_0x2175c7[_0xde4f('0xb6')]['fullname']:_0xde4f('0xb8'),'createdAt':moment(_0x2175c7[_0xde4f('0x88')])[_0xde4f('0x7b')](_0xde4f('0x9f'))[_0xde4f('0xad')](),'closedAt':_0x2175c7[_0xde4f('0x6a')]?moment(_0x2175c7[_0xde4f('0xb9')])[_0xde4f('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')[_0xde4f('0xad')]():'','disposition':_0x2175c7[_0xde4f('0x6b')],'chatInfo':{'browser':_0x2175c7[_0xde4f('0xba')],'os':_0x2175c7['osName'],'referer':_0x2175c7['referer'],'customerIp':_0x2175c7[_0xde4f('0xbb')],'customerPort':_0x2175c7[_0xde4f('0xbc')]?_0x2175c7[_0xde4f('0xbc')]:'N.A.'},'messages':_(_0x2175c7['Messages'])[_0xde4f('0xbd')]()[_0xde4f('0x9d')]({'secret':![]})[_0xde4f('0x37')](function(_0x5ad627){if(_0x5ad627[_0xde4f('0x71')]){var _0x44c4c4=path[_0xde4f('0x75')](_0x5c7fa3,_0x5ad627[_0xde4f('0x71')][_0xde4f('0x6f')]);if(fs[_0xde4f('0xbe')](_0x44c4c4)){fs['createReadStream'](_0x44c4c4)['pipe'](fs[_0xde4f('0xbf')](path[_0xde4f('0x75')](_0x376881,_0x5ad627['Attachment'][_0xde4f('0x6f')])));}}return{'date':moment(_0x5ad627['createdAt'])[_0xde4f('0x7b')](_0xde4f('0x9f'))[_0xde4f('0xad')](),'sender':_0x5ad627[_0xde4f('0x8a')]===_0xde4f('0x5f')?_0x5ad627[_0xde4f('0x7f')]?_0x5ad627[_0xde4f('0x7f')]['fullname']:_0xde4f('0x82'):_0x5ad627[_0xde4f('0x65')]['firstName']+(_0x5ad627[_0xde4f('0x65')][_0xde4f('0xb3')]?'\x20'+_0x5ad627[_0xde4f('0x65')][_0xde4f('0xb3')]:''),'body':_0x5ad627[_0xde4f('0x71')]?_0x5ad627['Attachment']['basename']:_0x5ad627[_0xde4f('0x33')],'direction':_0x5ad627[_0xde4f('0x8a')]===_0xde4f('0x5f')?'A':'C','secret':_0x5ad627[_0xde4f('0x8b')],'read':_0x5ad627[_0xde4f('0xb4')],'attachment':_0x5ad627[_0xde4f('0x71')]};})['value']()};return ejs[_0xde4f('0xc0')](path[_0xde4f('0x75')](config[_0xde4f('0x76')],'server',_0xde4f('0xc1'),_0xde4f('0xc2')),{'interaction':_0x20e548})[_0xde4f('0x2e')](function(_0x56b8aa){var _0x15ab8b=path[_0xde4f('0x75')](_0x376881,_0xde4f('0xc3')+_0x2175c7['id']+'-'+_0x471aec+_0xde4f('0xc4'));var _0x3d8904={'path':_0x15ab8b,'channel':'Chat','interactionId':_0x2175c7['id']};return pdf[_0xde4f('0xc5')](_0x56b8aa,_0x3d8904);})[_0xde4f('0x2e')](function(){return new Promise(function(_0x436a5b,_0x809e8d){zipdir(_0x376881,{'saveTo':_0x33f247},function(_0x4c4168,_0x1c6091){if(_0x4c4168)return _0x809e8d(_0x4c4168);return _0x436a5b(_0x1c6091);});})[_0xde4f('0x2e')](function(){return new BPromise(function(_0x733817,_0x2cea3c){rimraf(_0x376881,function(_0x2d529d){if(_0x2d529d)_0x2cea3c(_0x2d529d);return _0x733817();});});})['then'](function(){return _0x516bee['download'](_0x33f247,_0x17a358,function(_0x2eb4cb){if(_0x2eb4cb){logger[_0xde4f('0x1d')](_0xde4f('0xc6'),_0x2eb4cb);}else{fs[_0xde4f('0xc7')](_0x33f247);}});});});}else{return _0x516bee[_0xde4f('0x23')](0xc8);}})[_0xde4f('0x22')](handleError(_0x516bee,null));}; \ No newline at end of file +var _0xcf70=['get','mkdirSync','Chat','Owner','N.A.','closedAt','osName','referer','customerIp','customerPort','tail','pipe','createWriteStream','firstName','lastName','read','renderFile','views','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','status','end','json','undefined','limit','offset','count','Content-Range','update','destroy','sendStatus','name','send','render','merge','body','contact','agent','account','index','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','user','catch','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','include','options','find','create','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooMetadata','vidaooApiKey','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','format','now','pathTranscript','User','CmContact','ContactId','Messages','%s%d','System','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','pick','where','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','ChatInteractionId','push','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','toString','server','files','tmp','attachments','transcript-%d-%s.zip','Account'];(function(_0x148785,_0x195ee5){var _0x17a172=function(_0x478b94){while(--_0x478b94){_0x148785['push'](_0x148785['shift']());}};_0x17a172(++_0x195ee5);}(_0xcf70,0xe2));var _0x0cf7=function(_0x4a9937,_0x179dec){_0x4a9937=_0x4a9937-0x0;var _0x3971c2=_0xcf70[_0x4a9937];return _0x3971c2;};'use strict';var rimraf=require(_0x0cf7('0x0'));var zipdir=require(_0x0cf7('0x1'));var rp=require(_0x0cf7('0x2'));var moment=require('moment');var BPromise=require(_0x0cf7('0x3'));var Mustache=require('mustache');var util=require(_0x0cf7('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0cf7('0x5'));var Redis=require(_0x0cf7('0x6'));var interaction=require(_0x0cf7('0x7'));var qs=require(_0x0cf7('0x8'));var pdf=require(_0x0cf7('0x9'));var logger=require('../../config/logger')('api');var config=require(_0x0cf7('0xa'));var db=require(_0x0cf7('0xb'))['db'];config['redis']=_[_0x0cf7('0xc')](config[_0x0cf7('0xd')],{'host':_0x0cf7('0xe'),'port':0x18eb});var socket=require(_0x0cf7('0xf'))(new Redis(config[_0x0cf7('0xd')]));require(_0x0cf7('0x10'))[_0x0cf7('0x11')](socket);var jayson=require(_0x0cf7('0x12'));var client=jayson[_0x0cf7('0x13')][_0x0cf7('0x14')]({'port':0x232b});var client9004=jayson[_0x0cf7('0x13')][_0x0cf7('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x3fa3fb,_0x4cc30b,_0x1be0e5,_0x396980){return new BPromise(function(_0x5ad28f,_0x194875){var _0x5f62a1=_0x396980||client;return _0x5f62a1[_0x0cf7('0x15')](_0x3fa3fb,_0x1be0e5)[_0x0cf7('0x16')](function(_0x5e9a89){logger[_0x0cf7('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4cc30b,_0x0cf7('0x18'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4cc30b,_0x0cf7('0x18'),JSON[_0x0cf7('0x19')](_0x5e9a89));if(_0x5e9a89[_0x0cf7('0x1a')]){if(_0x5e9a89[_0x0cf7('0x1a')][_0x0cf7('0x1b')]===0x1f4){logger[_0x0cf7('0x1a')](_0x0cf7('0x1c'),_0x4cc30b,_0x5e9a89[_0x0cf7('0x1a')][_0x0cf7('0x1d')]);return _0x194875(_0x5e9a89[_0x0cf7('0x1a')][_0x0cf7('0x1d')]);}logger['error'](_0x0cf7('0x1c'),_0x4cc30b,_0x5e9a89[_0x0cf7('0x1a')][_0x0cf7('0x1d')]);return _0x5ad28f(_0x5e9a89[_0x0cf7('0x1a')][_0x0cf7('0x1d')]);}else{logger[_0x0cf7('0x17')](_0x0cf7('0x1c'),_0x4cc30b,_0x0cf7('0x18'));_0x5ad28f(_0x5e9a89[_0x0cf7('0x1e')]['message']);}})['catch'](function(_0x1fe8ae){logger[_0x0cf7('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x4cc30b,_0x1fe8ae);_0x194875(_0x1fe8ae);});});}function respondWithStatusCode(_0x218c84,_0x293e1b){_0x293e1b=_0x293e1b||0xcc;return function(_0x5cdc86){if(_0x5cdc86){return _0x218c84['sendStatus'](_0x293e1b);}return _0x218c84[_0x0cf7('0x1f')](_0x293e1b)[_0x0cf7('0x20')]();};}function respondWithResult(_0x14b0c5,_0x52ba90){_0x52ba90=_0x52ba90||0xc8;return function(_0x278457){if(_0x278457){return _0x14b0c5[_0x0cf7('0x1f')](_0x52ba90)[_0x0cf7('0x21')](_0x278457);}};}function respondWithFilteredResult(_0x45d080,_0x5c032b){return function(_0x1db1b8){if(_0x1db1b8){var _0x70e804=typeof _0x5c032b['offset']===_0x0cf7('0x22')&&typeof _0x5c032b[_0x0cf7('0x23')]===_0x0cf7('0x22');var _0x5ba30f=_0x1db1b8['count'];var _0x1a5e8d=_0x70e804?0x0:_0x5c032b[_0x0cf7('0x24')];var _0x38c090=_0x70e804?_0x1db1b8[_0x0cf7('0x25')]:_0x5c032b['offset']+_0x5c032b[_0x0cf7('0x23')];var _0x115f2b;if(_0x38c090>=_0x5ba30f){_0x38c090=_0x5ba30f;_0x115f2b=0xc8;}else{_0x115f2b=0xce;}_0x45d080['status'](_0x115f2b);return _0x45d080['set'](_0x0cf7('0x26'),_0x1a5e8d+'-'+_0x38c090+'/'+_0x5ba30f)[_0x0cf7('0x21')](_0x1db1b8);}return null;};}function saveUpdates(_0x3dba82){return function(_0x15c75f){if(_0x15c75f){return _0x15c75f[_0x0cf7('0x27')](_0x3dba82)[_0x0cf7('0x16')](function(_0x35c863){return _0x35c863;});}return null;};}function removeEntity(_0x38256b){return function(_0x1a1670){if(_0x1a1670){return _0x1a1670[_0x0cf7('0x28')]()[_0x0cf7('0x16')](function(){_0x38256b['status'](0xcc)[_0x0cf7('0x20')]();});}};}function handleEntityNotFound(_0x283e97){return function(_0x53a094){if(!_0x53a094){_0x283e97[_0x0cf7('0x29')](0x194);}return _0x53a094;};}function handleError(_0x1cdf1c,_0xdd1b4c){_0xdd1b4c=_0xdd1b4c||0x1f4;return function(_0x30af81){logger[_0x0cf7('0x1a')](_0x30af81['stack']);if(_0x30af81[_0x0cf7('0x2a')]){delete _0x30af81[_0x0cf7('0x2a')];}_0x1cdf1c[_0x0cf7('0x1f')](_0xdd1b4c)[_0x0cf7('0x2b')](_0x30af81);};}function getMustacheRender(_0x38a3a2,_0x56e454){return Mustache[_0x0cf7('0x2c')](_0x38a3a2,_[_0x0cf7('0x2d')](_0x56e454[_0x0cf7('0x2e')],{'contact':_0x56e454[_0x0cf7('0x2f')],'message':_0x56e454[_0x0cf7('0x1d')],'agent':_0x56e454[_0x0cf7('0x30')],'interaction':_0x56e454['interaction'],'account':_0x56e454[_0x0cf7('0x31')]}))||'';}exports[_0x0cf7('0x32')]=function(_0x141bc9,_0x1199da){var _0x166327={};var _0x3c2e68=_['map'](db[_0x0cf7('0x33')]['rawAttributes'],function(_0xd15b0f){return{'name':_0xd15b0f[_0x0cf7('0x34')],'type':_0xd15b0f[_0x0cf7('0x35')][_0x0cf7('0x36')]};});_0x166327=qs[_0x0cf7('0x37')](_0x3c2e68,_0x141bc9);return interaction[_0x0cf7('0x38')](_0x0cf7('0x39'),_0x141bc9[_0x0cf7('0x3a')],_0x141bc9[_0x0cf7('0x3b')],_0x166327,_0x3c2e68)[_0x0cf7('0x16')](respondWithFilteredResult(_0x1199da,_0x166327))[_0x0cf7('0x3c')](handleError(_0x1199da,null));};exports['show']=function(_0x5790ce,_0x41f706){var _0x2918c1={'raw':![],'where':{'id':_0x5790ce[_0x0cf7('0x3d')]['id']}},_0x2ce100={};_0x2ce100[_0x0cf7('0x3e')]=_[_0x0cf7('0x3f')](db[_0x0cf7('0x33')][_0x0cf7('0x40')]);_0x2ce100[_0x0cf7('0x3a')]=_['keys'](_0x5790ce[_0x0cf7('0x3a')]);_0x2ce100[_0x0cf7('0x41')]=_[_0x0cf7('0x42')](_0x2ce100[_0x0cf7('0x3e')],_0x2ce100[_0x0cf7('0x3a')]);_0x2918c1['attributes']=_[_0x0cf7('0x42')](_0x2ce100['model'],qs[_0x0cf7('0x43')](_0x5790ce[_0x0cf7('0x3a')]['fields']));_0x2918c1[_0x0cf7('0x44')]=_0x2918c1[_0x0cf7('0x44')][_0x0cf7('0x45')]?_0x2918c1[_0x0cf7('0x44')]:_0x2ce100['model'];if(_0x5790ce[_0x0cf7('0x3a')]['includeAll']){_0x2918c1[_0x0cf7('0x46')]=[{'all':!![]}];}_0x2918c1=_[_0x0cf7('0x2d')]({},_0x2918c1,_0x5790ce[_0x0cf7('0x47')]);return db[_0x0cf7('0x33')][_0x0cf7('0x48')](_0x2918c1)[_0x0cf7('0x16')](handleEntityNotFound(_0x41f706,null))[_0x0cf7('0x16')](respondWithResult(_0x41f706,null))[_0x0cf7('0x3c')](handleError(_0x41f706,null));};exports[_0x0cf7('0x49')]=function(_0x232956,_0x2cab2c){return db['ChatInteraction']['create'](_0x232956['body'],{})[_0x0cf7('0x16')](respondWithResult(_0x2cab2c,0xc9))[_0x0cf7('0x3c')](handleError(_0x2cab2c,null));};exports[_0x0cf7('0x27')]=function(_0x49079b,_0x34e275){if(_0x49079b[_0x0cf7('0x2e')]['id']){delete _0x49079b[_0x0cf7('0x2e')]['id'];}return db[_0x0cf7('0x33')][_0x0cf7('0x48')]({'where':{'id':_0x49079b[_0x0cf7('0x3d')]['id']}})[_0x0cf7('0x16')](handleEntityNotFound(_0x34e275,null))[_0x0cf7('0x16')](saveUpdates(_0x49079b['body'],null))['then'](respondWithResult(_0x34e275,null))[_0x0cf7('0x3c')](handleError(_0x34e275,null));};exports[_0x0cf7('0x28')]=function(_0x357d14,_0x28d906){return db[_0x0cf7('0x33')]['find']({'where':{'id':_0x357d14[_0x0cf7('0x3d')]['id']}})[_0x0cf7('0x16')](handleEntityNotFound(_0x28d906,null))[_0x0cf7('0x16')](removeEntity(_0x28d906,null))[_0x0cf7('0x3c')](handleError(_0x28d906,null));};exports['describe']=function(_0x42e362,_0x41ac2d){return db[_0x0cf7('0x33')]['describe']()[_0x0cf7('0x16')](respondWithResult(_0x41ac2d,null))[_0x0cf7('0x3c')](handleError(_0x41ac2d,null));};exports['createVidaooSession']=function(_0x3caafd,_0x1d6d45){var _0x13b7a3=_0x3caafd[_0x0cf7('0x3d')]['id'];var _0x5236a8;var _0x44e8f3;var _0x5e853a;return db[_0x0cf7('0x33')][_0x0cf7('0x4a')]({'where':{'id':_0x13b7a3}})['then'](function(_0x21e1c1){_0x5236a8=_0x21e1c1;return db[_0x0cf7('0x4b')][_0x0cf7('0x4a')]({'where':{'id':_0x21e1c1[_0x0cf7('0x4c')]},'attributes':['id','vidaooApiKey',_0x0cf7('0x4d'),'vidaooTopic','vidaooNote',_0x0cf7('0x4e')],'raw':!![]});})['then'](function(_0x50f7a6){if(_0x50f7a6&&_0x50f7a6[_0x0cf7('0x4f')]&&_0x50f7a6[_0x0cf7('0x4d')]){_0x44e8f3=_0x50f7a6;var _0x2e4d39={'interaction':{'id':_0x13b7a3},'agent':{'id':_0x3caafd[_0x0cf7('0x3b')]['id'],'name':_0x3caafd['user'][_0x0cf7('0x2a')],'fullname':_0x3caafd['user'][_0x0cf7('0x50')],'email':_0x3caafd[_0x0cf7('0x3b')][_0x0cf7('0x51')]},'contact':_0x3caafd['body']['contact'],'account':_0x3caafd[_0x0cf7('0x2e')][_0x0cf7('0x31')]};var _0x2b3b1c={'rejectUnauthorized':![],'method':_0x0cf7('0x52'),'url':_0x0cf7('0x53'),'headers':{'X-APIKEY':_0x50f7a6[_0x0cf7('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3caafd[_0x0cf7('0x3b')][_0x0cf7('0x51')]],'buttons':null,'topic':_0x44e8f3['vidaooTopic'],'note':_[_0x0cf7('0x54')](_0x44e8f3[_0x0cf7('0x55')])?null:getMustacheRender(_0x44e8f3['vidaooNote'],_0x2e4d39),'metadata':null},'redirect':_0x0cf7('0x56'),'json':!![]};try{if(!_['isNull'](_0x44e8f3[_0x0cf7('0x4e')])){var _0x40c7bf=getMustacheRender(_0x44e8f3[_0x0cf7('0x4e')],_0x2e4d39);var _0x242758=JSON['parse'](_0x40c7bf);_0x2b3b1c[_0x0cf7('0x2e')]['metadata']=_0x242758;}}catch(_0x5656fb){throw new db[(_0x0cf7('0x57'))][(_0x0cf7('0x58'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2b3b1c);}else{throw new db[(_0x0cf7('0x57'))][(_0x0cf7('0x58'))](_0x0cf7('0x59'));}})[_0x0cf7('0x16')](function(_0x2f9ec2){_0x5e853a=_0x2f9ec2;if(_0x5e853a['id']){var _0x5b6596={'body':_0x5e853a[_0x0cf7('0x5a')],'ChatWebsiteId':_0x44e8f3['id'],'ChatInteractionId':_0x5236a8['id'],'direction':_0x0cf7('0x5b'),'UserId':_0x3caafd['user']['id']};return db[_0x0cf7('0x5c')][_0x0cf7('0x49')](_0x5b6596,{});}else{throw new db[(_0x0cf7('0x57'))][(_0x0cf7('0x58'))](_0x0cf7('0x5d'));}})['then'](function(){return _0x5236a8[_0x0cf7('0x5e')]({'vidaooSessionId':_0x5e853a['id']});})[_0x0cf7('0x16')](respondWithResult(_0x1d6d45,null))[_0x0cf7('0x3c')](handleError(_0x1d6d45,null));};exports[_0x0cf7('0x5f')]=function(_0x12eab3,_0x1347f7){if(_0x12eab3[_0x0cf7('0x2e')]['id']){delete _0x12eab3['body']['id'];}return db[_0x0cf7('0x33')][_0x0cf7('0x48')]({'where':{'id':_0x12eab3[_0x0cf7('0x3d')]['id']},'include':[{'model':db['CmContact'],'as':_0x0cf7('0x60')}]})['then'](handleEntityNotFound(_0x1347f7,null))['then'](saveUpdates(_0x12eab3[_0x0cf7('0x2e')],null))[_0x0cf7('0x16')](respondWithResult(_0x1347f7,null))[_0x0cf7('0x3c')](handleError(_0x1347f7,null));};exports[_0x0cf7('0x61')]=function(_0x1ce664,_0x239c7e){if(_0x1ce664[_0x0cf7('0x2e')]['id']){delete _0x1ce664['body']['id'];}return db[_0x0cf7('0x33')][_0x0cf7('0x48')]({'where':{'id':_0x1ce664[_0x0cf7('0x3d')]['id']}})[_0x0cf7('0x16')](function(_0x446ca9){if(!_0x446ca9){logger[_0x0cf7('0x1a')](_0x0cf7('0x62'),_0x0cf7('0x61'),0x194,_0x0cf7('0x63'));_0x239c7e[_0x0cf7('0x29')](0x194);}else{if(_0x446ca9[_0x0cf7('0x64')]){throw new db[(_0x0cf7('0x57'))][(_0x0cf7('0x58'))](_0x0cf7('0x65'));}}return _0x446ca9;})[_0x0cf7('0x16')](function(_0x384b1f){if(_0x384b1f){return _0x384b1f[_0x0cf7('0x27')]({'closed':_0x1ce664[_0x0cf7('0x2e')][_0x0cf7('0x66')],'disposition':_0x1ce664[_0x0cf7('0x2e')]['disposition']})[_0x0cf7('0x16')](function(_0x3b52e5){return _0x3b52e5;});}})['then'](function(){return respondWithRpcPromise(_0x0cf7('0x67'),_0x0cf7('0x61'),_0x1ce664['body'],client9004);})['then'](respondWithResult(_0x239c7e,null))[_0x0cf7('0x3c')](handleError(_0x239c7e,null));};exports[_0x0cf7('0x68')]=function(_0x2e3f57,_0x30844a){_0x2e3f57[_0x0cf7('0x2e')][_0x0cf7('0x2a')]=_0x2e3f57[_0x0cf7('0x69')]['originalname'];_0x2e3f57[_0x0cf7('0x2e')]['basename']=_0x2e3f57[_0x0cf7('0x69')][_0x0cf7('0x6a')];_0x2e3f57['body']['type']=_0x2e3f57[_0x0cf7('0x69')][_0x0cf7('0x6b')];return db[_0x0cf7('0x6c')][_0x0cf7('0x49')](_0x2e3f57[_0x0cf7('0x2e')])[_0x0cf7('0x16')](respondWithResult(_0x30844a,0xc9))[_0x0cf7('0x3c')](handleError(_0x30844a,null));};exports[_0x0cf7('0x6d')]=function(_0x706000,_0x5ba614){return db[_0x0cf7('0x33')][_0x0cf7('0x4a')]({'where':{'id':_0x706000['params']['id']},'raw':!![]})[_0x0cf7('0x16')](handleEntityNotFound(_0x5ba614,null))[_0x0cf7('0x16')](function(_0x5771b2){if(_0x5771b2){if(_0x5771b2[_0x0cf7('0x66')]){return _0x5ba614[_0x0cf7('0x1f')](0x193)[_0x0cf7('0x21')]({'status':0x193,'message':_0x0cf7('0x6e')});}return db[_0x0cf7('0x6c')][_0x0cf7('0x4a')]({'where':{'id':_0x706000['query'][_0x0cf7('0x6f')]},'raw':!![]})[_0x0cf7('0x16')](handleEntityNotFound(_0x5ba614,null));}})[_0x0cf7('0x16')](function(_0x15dcbd){if(_0x15dcbd){var _0x4a4e5d=_0x15dcbd[_0x0cf7('0x70')]!==null;var _0x3cd12c=path[_0x0cf7('0x71')](config['root'],'server/files/attachments/');if(_0x4a4e5d){_0x3cd12c=path[_0x0cf7('0x71')](_0x3cd12c,_0x0cf7('0x72'));}var _0x398d3e=path[_0x0cf7('0x71')](_0x3cd12c,_0x15dcbd[_0x0cf7('0x73')]);return _0x5ba614[_0x0cf7('0x74')](_0x398d3e);}})[_0x0cf7('0x3c')](handleError(_0x5ba614,null));};exports[_0x0cf7('0x75')]=function(_0x1465dc,_0x57eb52){var _0x14e73b=null;var _0xef2c57=null;var _0x24bd56=null;if(_0x1465dc['body']['id']){delete _0x1465dc[_0x0cf7('0x2e')]['id'];}if(_0x1465dc['body'][_0x0cf7('0x76')]){_0x24bd56=path[_0x0cf7('0x71')](config[_0x0cf7('0x77')],_0x0cf7('0x78'),util[_0x0cf7('0x79')]('transcript-%s.txt',Date[_0x0cf7('0x7a')]()));_0x1465dc[_0x0cf7('0x2e')][_0x0cf7('0x7b')]=_0x24bd56;}return db['ChatInteraction']['find']({'where':{'id':_0x1465dc[_0x0cf7('0x3d')]['id']},'include':[{'model':db[_0x0cf7('0x5c')],'as':'Messages','include':[{'model':db[_0x0cf7('0x7c')],'as':_0x0cf7('0x7c')}]}]})[_0x0cf7('0x16')](handleEntityNotFound(_0x57eb52,null))['then'](saveUpdates(_0x1465dc[_0x0cf7('0x2e')],null))[_0x0cf7('0x16')](function(_0x35322b){if(_0x35322b){_0x14e73b=_0x35322b;return db['ChatWebsite'][_0x0cf7('0x48')]({'where':{'id':_0x14e73b['ChatWebsiteId']}});}})[_0x0cf7('0x16')](function(_0x332983){if(_0x332983){_0xef2c57=_0x332983;return db[_0x0cf7('0x7d')]['find']({'where':{'id':_0x14e73b[_0x0cf7('0x7e')]}});}})['then'](function(_0x3bf72d){if(_0x3bf72d){if(_0x24bd56){var _0x200e6a=null;for(var _0x51f1bf=0x1;_0x51f1bf<_0x14e73b[_0x0cf7('0x7f')][_0x0cf7('0x45')];++_0x51f1bf){_0x200e6a=_0x14e73b[_0x0cf7('0x7f')][_0x51f1bf];var _0x33a1dd=_0x200e6a[_0x0cf7('0x64')]?util[_0x0cf7('0x79')](_0x0cf7('0x80'),_0xef2c57['agentAlias'],_0x200e6a['UserId']):_0x0cf7('0x81');var _0x42e6a9=_0x1465dc[_0x0cf7('0x2e')]['customer']||util[_0x0cf7('0x79')](_0x0cf7('0x80'),_0x0cf7('0x82'),_0x200e6a[_0x0cf7('0x7e')]);switch(_0xef2c57[_0x0cf7('0x83')]){case _0x0cf7('0x84'):_0x33a1dd=_0x200e6a['UserId']?util[_0x0cf7('0x79')](_0x0cf7('0x80'),_0xef2c57[_0x0cf7('0x85')],_0x200e6a[_0x0cf7('0x64')]):'System';break;case _0x0cf7('0x86'):_0x33a1dd=_0x200e6a['UserId']?_0x200e6a['User'][_0x0cf7('0x87')]||_0x200e6a['User'][_0x0cf7('0x50')]:_0x0cf7('0x81');break;case _0x0cf7('0x88'):_0x33a1dd=_0x200e6a[_0x0cf7('0x64')]?_0x200e6a[_0x0cf7('0x7c')][_0x0cf7('0x50')]:'System';break;default:_0x33a1dd=_0x200e6a[_0x0cf7('0x64')]?util[_0x0cf7('0x79')]('%s%d',_0xef2c57['agentAlias'],_0x200e6a[_0x0cf7('0x64')]):_0x0cf7('0x81');}var _0x5d2914=util[_0x0cf7('0x79')]('[%s]\x20%s:\x20%s\x0a',moment(_0x200e6a[_0x0cf7('0x89')])[_0x0cf7('0x79')](_0x0cf7('0x8a')),_0x200e6a[_0x0cf7('0x8b')]==='in'?_0x42e6a9:_0x33a1dd,_0x200e6a[_0x0cf7('0x2e')]);if(!_0x200e6a[_0x0cf7('0x8c')]){fs[_0x0cf7('0x8d')](_0x24bd56,_0x5d2914);}}return db[_0x0cf7('0x8e')][_0x0cf7('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0x0cf7('0x8f')],'as':_0x0cf7('0x90'),'raw':!![],'include':[{'model':db[_0x0cf7('0x91')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x0cf7('0x16')](function(_0x141dda){if(!_0x141dda||!_0x141dda['Smtp']||!_0x1465dc[_0x0cf7('0x2e')])return _0x14e73b;var _0x3ef436=_0x141dda[_0x0cf7('0x92')]();return respondWithRpcPromise(_0x0cf7('0x93'),'sendMail',{'account':_0x3ef436,'message':{'from':util[_0x0cf7('0x79')](_0x0cf7('0x94'),_0x141dda[_0x0cf7('0x2a')],_0x141dda[_0x0cf7('0x51')]||_0x141dda[_0x0cf7('0x90')]['user']),'to':_0x1465dc[_0x0cf7('0x2e')][_0x0cf7('0x76')],'subject':_0x0cf7('0x95'),'text':util[_0x0cf7('0x79')](_0x0cf7('0x96'),_0x1465dc['body'][_0x0cf7('0x76')]),'attachments':[{'path':_0x24bd56}]}})[_0x0cf7('0x16')](function(){return _0x14e73b;})['catch'](function(_0x5f27f5){logger[_0x0cf7('0x1a')](_0x5f27f5);});})[_0x0cf7('0x16')](respondWithStatusCode(_0x57eb52,0xc8))['catch'](handleError(_0x57eb52,null));};exports['addMessage']=function(_0x3c3659,_0x1092f9){return db['ChatMessage'][_0x0cf7('0x48')]({'where':{'id':_0x3c3659[_0x0cf7('0x3d')]['id']}})[_0x0cf7('0x16')](handleEntityNotFound(_0x1092f9,null))[_0x0cf7('0x16')](function(_0x3b7618){if(_0x3b7618){return _0x3b7618[_0x0cf7('0x97')](_0x3c3659[_0x0cf7('0x2e')][_0x0cf7('0x98')],_['omit'](_0x3c3659[_0x0cf7('0x2e')],[_0x0cf7('0x98'),'id'])||{});}})[_0x0cf7('0x16')](respondWithResult(_0x1092f9,null))[_0x0cf7('0x3c')](handleError(_0x1092f9,null));};exports[_0x0cf7('0x99')]=function(_0x26b0a6,_0x27b494){var _0x23dbc6={'raw':![],'where':{}};var _0x7a89f={};var _0x3d0826={'count':0x0,'rows':[]};return db[_0x0cf7('0x33')]['findOne']({'where':{'id':_0x26b0a6[_0x0cf7('0x3d')]['id']}})[_0x0cf7('0x16')](handleEntityNotFound(_0x27b494,null))[_0x0cf7('0x16')](function(_0x3b0d5d){if(_0x3b0d5d){_0x7a89f[_0x0cf7('0x3e')]=_[_0x0cf7('0x3f')](db[_0x0cf7('0x5c')][_0x0cf7('0x40')]);_0x7a89f[_0x0cf7('0x3a')]=_['keys'](_0x26b0a6['query']);_0x7a89f[_0x0cf7('0x41')]=_['intersection'](_0x7a89f[_0x0cf7('0x3e')],_0x7a89f[_0x0cf7('0x3a')]);_0x23dbc6[_0x0cf7('0x44')]=_[_0x0cf7('0x42')](_0x7a89f[_0x0cf7('0x3e')],qs[_0x0cf7('0x43')](_0x26b0a6['query'][_0x0cf7('0x43')]));_0x23dbc6[_0x0cf7('0x44')]=_0x23dbc6['attributes'][_0x0cf7('0x45')]?_0x23dbc6[_0x0cf7('0x44')]:_0x7a89f[_0x0cf7('0x3e')];if(!_0x26b0a6[_0x0cf7('0x3a')][_0x0cf7('0x9a')](_0x0cf7('0x9b'))){_0x23dbc6[_0x0cf7('0x23')]=qs[_0x0cf7('0x23')](_0x26b0a6[_0x0cf7('0x3a')][_0x0cf7('0x23')]);_0x23dbc6[_0x0cf7('0x24')]=qs[_0x0cf7('0x24')](_0x26b0a6['query'][_0x0cf7('0x24')]);}_0x23dbc6[_0x0cf7('0x9c')]=qs[_0x0cf7('0x9d')](_0x26b0a6[_0x0cf7('0x3a')][_0x0cf7('0x9d')]);_0x23dbc6['where']=qs['filters'](_[_0x0cf7('0x9e')](_0x26b0a6[_0x0cf7('0x3a')],_0x7a89f[_0x0cf7('0x41')]));_0x23dbc6['where']['ChatInteractionId']=_0x3b0d5d['id'];if(_0x26b0a6[_0x0cf7('0x3a')]['filter']){_0x23dbc6[_0x0cf7('0x9f')]=_['merge'](_0x23dbc6[_0x0cf7('0x9f')],{'$or':_[_0x0cf7('0xa0')](_0x23dbc6[_0x0cf7('0x44')],function(_0x29f650){var _0x47593c={};_0x47593c[_0x29f650]={'$like':'%'+_0x26b0a6['query'][_0x0cf7('0xa1')]+'%'};return _0x47593c;})});}if(_0x26b0a6[_0x0cf7('0x3a')][_0x0cf7('0xa2')]){var _0xf88dbd=_0x26b0a6[_0x0cf7('0x3a')][_0x0cf7('0xa2')][_0x0cf7('0xa3')](',');var _0x3e0eb6={};_0x3e0eb6[_0xf88dbd[0x0]]={'$gte':moment(_0xf88dbd[0x1])['format'](_0x0cf7('0xa4'))};_0x23dbc6[_0x0cf7('0x9f')]=_[_0x0cf7('0x2d')](_0x23dbc6[_0x0cf7('0x9f')],_0x3e0eb6);}_0x23dbc6=_[_0x0cf7('0x2d')]({},_0x23dbc6,_0x26b0a6[_0x0cf7('0x47')]);return db['ChatMessage'][_0x0cf7('0x25')]({'where':_0x23dbc6['where']})[_0x0cf7('0x16')](function(_0x3f2b89){_0x3d0826['count']=_0x3f2b89;if(_0x26b0a6[_0x0cf7('0x3a')][_0x0cf7('0xa5')]){_0x23dbc6[_0x0cf7('0x46')]=[{'all':!![]}];}return db['ChatMessage'][_0x0cf7('0x38')](_0x23dbc6);})[_0x0cf7('0x16')](function(_0x10cdf6){_0x3d0826[_0x0cf7('0xa6')]=_0x10cdf6;return _0x3d0826;});}})[_0x0cf7('0x16')](respondWithFilteredResult(_0x27b494,_0x23dbc6))[_0x0cf7('0x3c')](handleError(_0x27b494,null));};exports[_0x0cf7('0xa7')]=function(_0x332d39,_0x32c8db){var _0x154bc8={'where':{}},_0x1e2c32={},_0x57f07c={'count':0x0,'rows':[]};return db[_0x0cf7('0x33')][_0x0cf7('0x4a')]({'where':{'id':_0x332d39[_0x0cf7('0x3d')]['id']}})[_0x0cf7('0x16')](handleEntityNotFound(_0x32c8db,null))[_0x0cf7('0x16')](function(_0xb182bc){if(_0xb182bc){_0x1e2c32[_0x0cf7('0x3e')]=_[_0x0cf7('0x3f')](db['ChatMessage'][_0x0cf7('0x40')]);_0x1e2c32['query']=_[_0x0cf7('0x3f')](_0x332d39[_0x0cf7('0x3a')]);_0x1e2c32['filters']=_['intersection'](_0x1e2c32[_0x0cf7('0x3e')],_0x1e2c32[_0x0cf7('0x3a')]);_0x154bc8[_0x0cf7('0x44')]=_[_0x0cf7('0x42')](_0x1e2c32['model'],qs[_0x0cf7('0x43')](_0x332d39[_0x0cf7('0x3a')]['fields']));_0x154bc8['attributes']=_0x154bc8[_0x0cf7('0x44')][_0x0cf7('0x45')]?_0x154bc8[_0x0cf7('0x44')]:_0x1e2c32[_0x0cf7('0x3e')];if(!_0x332d39[_0x0cf7('0x3a')][_0x0cf7('0x9a')]('nolimit')){_0x154bc8['limit']=qs[_0x0cf7('0x23')](_0x332d39[_0x0cf7('0x3a')][_0x0cf7('0x23')]);_0x154bc8[_0x0cf7('0x24')]=qs[_0x0cf7('0x24')](_0x332d39['query']['offset']);}_0x154bc8[_0x0cf7('0x9c')]=qs['sort'](_0x332d39[_0x0cf7('0x3a')]['sort']);_0x154bc8['where']=qs['filters'](_[_0x0cf7('0x9e')](_0x332d39['query'],_0x1e2c32[_0x0cf7('0x41')]));_0x154bc8['where'][_0x0cf7('0xa8')]=_0xb182bc['id'];if(_0x332d39[_0x0cf7('0x3a')][_0x0cf7('0xa1')]){_0x154bc8[_0x0cf7('0x9f')]=_[_0x0cf7('0x2d')](_0x154bc8['where'],{'$or':_[_0x0cf7('0xa0')](_0x154bc8['attributes'],function(_0x2d5e80){var _0x324a08={};_0x324a08[_0x2d5e80]={'$like':'%'+_0x332d39[_0x0cf7('0x3a')][_0x0cf7('0xa1')]+'%'};return _0x324a08;})});}_0x154bc8[_0x0cf7('0x9f')][_0x0cf7('0x8c')]=![];if(_0x332d39[_0x0cf7('0x3a')]['id']){_0x154bc8['where']['id']={'$gt':_0x332d39['query']['id']};}_0x154bc8=_[_0x0cf7('0x2d')]({},_0x154bc8,_0x332d39[_0x0cf7('0x47')]);return db['ChatMessage'][_0x0cf7('0x25')]({'where':_0x154bc8[_0x0cf7('0x9f')]})[_0x0cf7('0x16')](function(_0x5c8896){_0x57f07c[_0x0cf7('0x25')]=_0x5c8896;_0x154bc8[_0x0cf7('0x46')]=[];if(_0x332d39[_0x0cf7('0x3a')]['includeAgent']){_0x154bc8[_0x0cf7('0x46')][_0x0cf7('0xa9')]({'model':db[_0x0cf7('0x7c')],'as':_0x0cf7('0x7c'),'attributes':['id',_0x0cf7('0x50'),_0x0cf7('0x87')]});}if(_0x332d39[_0x0cf7('0x3a')][_0x0cf7('0xa5')]){_0x154bc8[_0x0cf7('0x46')]=[{'all':!![]}];}return db[_0x0cf7('0x5c')][_0x0cf7('0x38')](_0x154bc8);})[_0x0cf7('0x16')](function(_0x44ed79){_0x57f07c[_0x0cf7('0xa6')]=_0x44ed79;return _0x57f07c;});}})[_0x0cf7('0x16')](respondWithFilteredResult(_0x32c8db,_0x154bc8))['catch'](handleError(_0x32c8db,null));};exports['addTags']=function(_0x438906,_0x107620){return db[_0x0cf7('0x33')][_0x0cf7('0x48')]({'where':{'id':_0x438906['params']['id']}})[_0x0cf7('0x16')](handleEntityNotFound(_0x107620,null))[_0x0cf7('0x16')](function(_0x7ada2c){if(_0x7ada2c){return _0x7ada2c['setTags'](_0x438906['body'][_0x0cf7('0x98')],_[_0x0cf7('0xaa')](_0x438906[_0x0cf7('0x2e')],[_0x0cf7('0x98'),'id'])||{})[_0x0cf7('0xab')](function(){return db[_0x0cf7('0xac')][_0x0cf7('0x38')]({'attributes':['id',_0x0cf7('0x2a'),_0x0cf7('0xad')],'where':{'id':_0x438906[_0x0cf7('0x2e')][_0x0cf7('0x98')]}});})['then'](function(_0x3afb0a){socket[_0x0cf7('0xae')](_0x0cf7('0xaf'),{'id':Number(_0x438906['params']['id']),'tags':_0x3afb0a||[]});return{'id':Number(_0x438906[_0x0cf7('0x3d')]['id']),'tags':_0x3afb0a||[]};});}})['then'](respondWithResult(_0x107620,null))[_0x0cf7('0x3c')](handleError(_0x107620,null));};exports[_0x0cf7('0xb0')]=function(_0x12c195,_0xe2f32a){return db[_0x0cf7('0x33')][_0x0cf7('0x48')]({'where':{'id':_0x12c195[_0x0cf7('0x3d')]['id']}})[_0x0cf7('0x16')](handleEntityNotFound(_0xe2f32a,null))[_0x0cf7('0x16')](function(_0x5a5c28){if(_0x5a5c28){return _0x5a5c28[_0x0cf7('0xb0')](_0x12c195[_0x0cf7('0x3a')][_0x0cf7('0x98')]);}})[_0x0cf7('0x16')](respondWithStatusCode(_0xe2f32a,null))[_0x0cf7('0x3c')](handleError(_0xe2f32a,null));};exports[_0x0cf7('0x74')]=function(_0x6237f,_0x473092){var _0x2207bf=moment()['unix']()[_0x0cf7('0xb1')]();var _0x27e8cc=path[_0x0cf7('0x71')](config['root'],_0x0cf7('0xb2'),_0x0cf7('0xb3'),_0x0cf7('0xb4'));var _0x3c1636=path[_0x0cf7('0x71')](config[_0x0cf7('0x77')],'server','files',_0x0cf7('0xb5'));var _0x4b2dca=path[_0x0cf7('0x71')](_0x27e8cc,_0x2207bf);var _0x4302f5=util[_0x0cf7('0x79')](_0x0cf7('0xb6'),_0x6237f['params']['id'],_0x2207bf);var _0x1d6d00=path[_0x0cf7('0x71')](_0x27e8cc,_0x4302f5);var _0xeb8ce=[];_0xeb8ce['push']({'model':db[_0x0cf7('0x7c')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0xeb8ce[_0x0cf7('0xa9')]({'model':db[_0x0cf7('0x7d')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x6237f[_0x0cf7('0x3a')][_0x0cf7('0xb5')]){_0xeb8ce[_0x0cf7('0xa9')]({'model':db[_0x0cf7('0x6c')],'as':_0x0cf7('0x6c'),'raw':!![]});}var _0x2edf0c=[{'model':db[_0x0cf7('0x5c')],'as':_0x0cf7('0x7f'),'attributes':['id','body',_0x0cf7('0x89'),'direction',_0x0cf7('0x8c'),'read'],'include':_0xeb8ce}];_0x2edf0c[_0x0cf7('0xa9')]({'model':db[_0x0cf7('0x4b')],'as':_0x0cf7('0xb7'),'attributes':['id',_0x0cf7('0x2a')]});_0x2edf0c[_0x0cf7('0xa9')]({'model':db[_0x0cf7('0x7c')],'as':'Owner','attributes':['id','fullname']});return db[_0x0cf7('0x33')]['find']({'where':{'id':_0x6237f['params']['id']},'include':_0x2edf0c})[_0x0cf7('0x16')](handleEntityNotFound(_0x473092,null))[_0x0cf7('0x16')](function(_0x5d3573){if(_0x5d3573){var _0x2ca86b=_0x5d3573[_0x0cf7('0xb8')]({'plain':!![]});fs[_0x0cf7('0xb9')](_0x4b2dca);var _0x171fbb={'channel':_0x0cf7('0xba'),'account':_0x2ca86b[_0x0cf7('0xb7')][_0x0cf7('0x2a')],'agent':_0x2ca86b['Owner']?_0x2ca86b[_0x0cf7('0xbb')][_0x0cf7('0x50')]:_0x0cf7('0xbc'),'createdAt':moment(_0x2ca86b[_0x0cf7('0x89')])[_0x0cf7('0x79')](_0x0cf7('0xa4'))[_0x0cf7('0xb1')](),'closedAt':_0x2ca86b[_0x0cf7('0x66')]?moment(_0x2ca86b[_0x0cf7('0xbd')])[_0x0cf7('0x79')](_0x0cf7('0xa4'))['toString']():'','disposition':_0x2ca86b['disposition'],'chatInfo':{'browser':_0x2ca86b['browserName'],'os':_0x2ca86b[_0x0cf7('0xbe')],'referer':_0x2ca86b[_0x0cf7('0xbf')],'customerIp':_0x2ca86b[_0x0cf7('0xc0')],'customerPort':_0x2ca86b[_0x0cf7('0xc1')]?_0x2ca86b[_0x0cf7('0xc1')]:_0x0cf7('0xbc')},'messages':_(_0x2ca86b['Messages'])[_0x0cf7('0xc2')]()[_0x0cf7('0xa1')]({'secret':![]})[_0x0cf7('0xa0')](function(_0x10dfd0){if(_0x10dfd0[_0x0cf7('0x6c')]){var _0x42319a=path['join'](_0x3c1636,_0x10dfd0['Attachment'][_0x0cf7('0x73')]);if(fs['existsSync'](_0x42319a)){fs['createReadStream'](_0x42319a)[_0x0cf7('0xc3')](fs[_0x0cf7('0xc4')](path['join'](_0x4b2dca,_0x10dfd0[_0x0cf7('0x6c')][_0x0cf7('0x73')])));}}return{'date':moment(_0x10dfd0['createdAt'])[_0x0cf7('0x79')](_0x0cf7('0xa4'))[_0x0cf7('0xb1')](),'sender':_0x10dfd0[_0x0cf7('0x8b')]==='out'?_0x10dfd0[_0x0cf7('0x7c')]?_0x10dfd0[_0x0cf7('0x7c')]['fullname']:_0x0cf7('0x81'):_0x10dfd0[_0x0cf7('0x60')][_0x0cf7('0xc5')]+(_0x10dfd0[_0x0cf7('0x60')][_0x0cf7('0xc6')]?'\x20'+_0x10dfd0[_0x0cf7('0x60')]['lastName']:''),'body':_0x10dfd0[_0x0cf7('0x6c')]?_0x10dfd0[_0x0cf7('0x6c')][_0x0cf7('0x73')]:_0x10dfd0['body'],'direction':_0x10dfd0['direction']===_0x0cf7('0x5b')?'A':'C','secret':_0x10dfd0['secret'],'read':_0x10dfd0[_0x0cf7('0xc7')],'attachment':_0x10dfd0['Attachment']};})['value']()};return ejs[_0x0cf7('0xc8')](path[_0x0cf7('0x71')](config[_0x0cf7('0x77')],'server',_0x0cf7('0xc9'),'downloadInteraction.ejs'),{'interaction':_0x171fbb})['then'](function(_0x23ccb1){var _0x2569f7=path['join'](_0x4b2dca,_0x0cf7('0xca')+_0x2ca86b['id']+'-'+_0x2207bf+'.pdf');var _0x384d6b={'path':_0x2569f7,'channel':_0x0cf7('0xba'),'interactionId':_0x2ca86b['id']};return pdf['createPdfFromHTML'](_0x23ccb1,_0x384d6b);})['then'](function(){return new Promise(function(_0x1e4c6b,_0x2f49e5){zipdir(_0x4b2dca,{'saveTo':_0x1d6d00},function(_0x47f8cb,_0x34552f){if(_0x47f8cb)return _0x2f49e5(_0x47f8cb);return _0x1e4c6b(_0x34552f);});})[_0x0cf7('0x16')](function(){return new BPromise(function(_0x7c7003,_0x1cd93f){rimraf(_0x4b2dca,function(_0x504508){if(_0x504508)_0x1cd93f(_0x504508);return _0x7c7003();});});})[_0x0cf7('0x16')](function(){return _0x473092[_0x0cf7('0x74')](_0x1d6d00,_0x4302f5,function(_0xb36291){if(_0xb36291){logger[_0x0cf7('0x1a')](_0x0cf7('0xcb'),_0xb36291);}else{fs[_0x0cf7('0xcc')](_0x1d6d00);}});});});}else{return _0x473092[_0x0cf7('0x29')](0xc8);}})[_0x0cf7('0x3c')](handleError(_0x473092,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0a524ea..39a1fca 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 _0x8b44=['remove','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','save','update'];(function(_0x112147,_0x4e692e){var _0x3ba744=function(_0x191b87){while(--_0x191b87){_0x112147['push'](_0x112147['shift']());}};_0x3ba744(++_0x4e692e);}(_0x8b44,0xbf));var _0x48b4=function(_0x3fd097,_0x59a875){_0x3fd097=_0x3fd097-0x0;var _0x4a0750=_0x8b44[_0x3fd097];return _0x4a0750;};'use strict';var EventEmitter=require(_0x48b4('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x48b4('0x1'))['db'][_0x48b4('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x48b4('0x3'),'afterUpdate':_0x48b4('0x4'),'afterDestroy':_0x48b4('0x5')};function emitEvent(_0x260482){return function(_0x51482e,_0x505ddf,_0x38a47e){_0x51482e['getUsers']({'attributes':['id'],'raw':!![]})[_0x48b4('0x6')](function(_0x111027){_0x51482e['setDataValue']('Users',_0x111027[_0x48b4('0x7')](function(_0x2b45a9){return{'id':_0x2b45a9['id']};}));return ChatMessage[_0x48b4('0x8')]({'where':{'ChatInteractionId':_0x51482e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x48b4('0x6')](function(_0x463bac){_0x51482e['setDataValue'](_0x48b4('0x9'),_0x463bac['length']);ChatInteractionEvents[_0x48b4('0xa')](_0x260482+':'+_0x51482e['id'],_0x51482e);ChatInteractionEvents[_0x48b4('0xa')](_0x260482,_0x51482e);_0x38a47e(null);})[_0x48b4('0xb')](_0x38a47e(null));};}for(var e in events){if(events[_0x48b4('0xc')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x48b4('0xd')]=ChatInteractionEvents; \ No newline at end of file +var _0xca76=['Users','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x3a4b1b,_0x40e5c1){var _0x1b00ac=function(_0x31d720){while(--_0x31d720){_0x3a4b1b['push'](_0x3a4b1b['shift']());}};_0x1b00ac(++_0x40e5c1);}(_0xca76,0x117));var _0x6ca7=function(_0x5c85f1,_0x2129ff){_0x5c85f1=_0x5c85f1-0x0;var _0x427239=_0xca76[_0x5c85f1];return _0x427239;};'use strict';var EventEmitter=require(_0x6ca7('0x0'));var ChatInteraction=require(_0x6ca7('0x1'))['db'][_0x6ca7('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x6ca7('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6ca7('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6ca7('0x5'),'afterDestroy':_0x6ca7('0x6')};function emitEvent(_0x5618df){return function(_0x2aa175,_0x18c80a,_0x4e1a08){_0x2aa175[_0x6ca7('0x7')]({'attributes':['id'],'raw':!![]})[_0x6ca7('0x8')](function(_0x1316a2){_0x2aa175[_0x6ca7('0x9')](_0x6ca7('0xa'),_0x1316a2['map'](function(_0x2fe3d8){return{'id':_0x2fe3d8['id']};}));return ChatMessage[_0x6ca7('0xb')]({'where':{'ChatInteractionId':_0x2aa175['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6ca7('0x8')](function(_0x155ecc){_0x2aa175[_0x6ca7('0x9')](_0x6ca7('0xc'),_0x155ecc['length']);ChatInteractionEvents[_0x6ca7('0xd')](_0x5618df+':'+_0x2aa175['id'],_0x2aa175);ChatInteractionEvents['emit'](_0x5618df,_0x2aa175);_0x4e1a08(null);})[_0x6ca7('0xe')](_0x4e1a08(null));};}for(var e in events){if(events[_0x6ca7('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x6ca7('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 0f61a13..fba8f7f 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 _0x174b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','../../config/logger','api'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x174b,0xce));var _0xb174=function(_0x1aefae,_0x21dd74){_0x1aefae=_0x1aefae-0x0;var _0x29b23c=_0x174b[_0x1aefae];return _0x29b23c;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var logger=require(_0xb174('0x1'))(_0xb174('0x2'));var moment=require(_0xb174('0x3'));var BPromise=require(_0xb174('0x4'));var rp=require(_0xb174('0x5'));var fs=require('fs');var path=require(_0xb174('0x6'));var rimraf=require(_0xb174('0x7'));var config=require(_0xb174('0x8'));var attributes=require(_0xb174('0x9'));module[_0xb174('0xa')]=function(_0x157d89,_0x498a66){return _0x157d89[_0xb174('0xb')](_0xb174('0xc'),attributes,{'tableName':_0xb174('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x61183e,_0x8dd2fd,_0x10e84f){if(_0x61183e['changed'](_0xb174('0xe'))){_0x61183e[_0xb174('0xf')]=moment()[_0xb174('0x10')](_0xb174('0x11'));}_0x10e84f(null,_0x61183e);}},'charset':_0xb174('0x12'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb0a3=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define','chat_interactions','changed','closedAt','format'];(function(_0xb24b6d,_0x49f15e){var _0xc88ebd=function(_0x310bd5){while(--_0x310bd5){_0xb24b6d['push'](_0xb24b6d['shift']());}};_0xc88ebd(++_0x49f15e);}(_0xb0a3,0x197));var _0x3b0a=function(_0x4d934b,_0x52f8e9){_0x4d934b=_0x4d934b-0x0;var _0xc0338b=_0xb0a3[_0x4d934b];return _0xc0338b;};'use strict';var _=require(_0x3b0a('0x0'));var util=require(_0x3b0a('0x1'));var logger=require(_0x3b0a('0x2'))(_0x3b0a('0x3'));var moment=require(_0x3b0a('0x4'));var BPromise=require(_0x3b0a('0x5'));var rp=require(_0x3b0a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b0a('0x7'));var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x543596,_0x39a281){return _0x543596[_0x3b0a('0x8')]('ChatInteraction',attributes,{'tableName':_0x3b0a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x195ada,_0x3d4761,_0x3e3188){if(_0x195ada[_0x3b0a('0xa')]('closed')){_0x195ada[_0x3b0a('0xb')]=moment()[_0x3b0a('0xc')](_0x3b0a('0xd'));}_0x3e3188(null,_0x195ada);}},'charset':'utf8mb4','collate':_0x3b0a('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index dd55eb6..cf06526 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 _0x2c4b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2c4b,0x10e));var _0xb2c4=function(_0x71f648,_0x19654f){_0x71f648=_0x71f648-0x0;var _0x56203f=_0x2c4b[_0x71f648];return _0x56203f;};'use strict';var _=require(_0xb2c4('0x0'));var util=require(_0xb2c4('0x1'));var moment=require(_0xb2c4('0x2'));var BPromise=require(_0xb2c4('0x3'));var rs=require(_0xb2c4('0x4'));var fs=require('fs');var Redis=require(_0xb2c4('0x5'));var db=require(_0xb2c4('0x6'))['db'];var utils=require(_0xb2c4('0x7'));var logger=require(_0xb2c4('0x8'))(_0xb2c4('0x9'));var config=require('../../config/environment');var jayson=require(_0xb2c4('0xa'));var client=jayson[_0xb2c4('0xb')][_0xb2c4('0xc')]({'port':0x232a});config[_0xb2c4('0xd')]=_[_0xb2c4('0xe')](config[_0xb2c4('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb2c4('0xd')]));require(_0xb2c4('0xf'))[_0xb2c4('0x10')](socket);function respondWithRpcPromise(_0x505cab,_0x5f140f,_0x1738d0){return new BPromise(function(_0x2addad,_0x4086fe){return client[_0xb2c4('0x11')](_0x505cab,_0x1738d0)[_0xb2c4('0x12')](function(_0x574d01){logger[_0xb2c4('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x5f140f,_0xb2c4('0x14'));logger[_0xb2c4('0x15')](_0xb2c4('0x16'),_0x5f140f,_0xb2c4('0x14'),JSON[_0xb2c4('0x17')](_0x574d01));if(_0x574d01[_0xb2c4('0x18')]){if(_0x574d01[_0xb2c4('0x18')][_0xb2c4('0x19')]===0x1f4){logger[_0xb2c4('0x18')](_0xb2c4('0x1a'),_0x5f140f,_0x574d01[_0xb2c4('0x18')]['message']);return _0x4086fe(_0x574d01[_0xb2c4('0x18')][_0xb2c4('0x1b')]);}logger[_0xb2c4('0x18')](_0xb2c4('0x1a'),_0x5f140f,_0x574d01[_0xb2c4('0x18')][_0xb2c4('0x1b')]);return _0x2addad(_0x574d01[_0xb2c4('0x18')][_0xb2c4('0x1b')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x5f140f,'request\x20sent');_0x2addad(_0x574d01[_0xb2c4('0x1c')][_0xb2c4('0x1b')]);}})[_0xb2c4('0x1d')](function(_0x18dab8){logger[_0xb2c4('0x18')](_0xb2c4('0x1a'),_0x5f140f,_0x18dab8);_0x4086fe(_0x18dab8);});});}exports[_0xb2c4('0x1e')]=function(_0x4ee18c){var _0x14fac1=this;return new Promise(function(_0x3308c5,_0x4671fd){return db[_0xb2c4('0x1f')][_0xb2c4('0x20')](_0x4ee18c[_0xb2c4('0x21')],{'raw':_0x4ee18c[_0xb2c4('0x22')]?_0x4ee18c[_0xb2c4('0x22')][_0xb2c4('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ee18c[_0xb2c4('0x22')]?_0x4ee18c[_0xb2c4('0x22')][_0xb2c4('0x24')]||null:null,'attributes':_0x4ee18c[_0xb2c4('0x22')]?_0x4ee18c[_0xb2c4('0x22')]['attributes']||null:null,'limit':_0x4ee18c[_0xb2c4('0x22')]?_0x4ee18c[_0xb2c4('0x22')][_0xb2c4('0x25')]||null:null})[_0xb2c4('0x12')](function(_0x31839e){logger['info']('UpdateChatInteraction',_0x4ee18c);logger[_0xb2c4('0x15')](_0xb2c4('0x1e'),_0x4ee18c,JSON[_0xb2c4('0x17')](_0x31839e));_0x3308c5(_0x31839e);})[_0xb2c4('0x1d')](function(_0x2efb59){logger['error'](_0xb2c4('0x1e'),_0x2efb59['message'],_0x4ee18c);_0x4671fd(_0x14fac1[_0xb2c4('0x18')](0x1f4,_0x2efb59[_0xb2c4('0x1b')]));});});};exports[_0xb2c4('0x26')]=function(_0x4ac179){return new Promise(function(_0x320005,_0x12a35b){return db['ChatInteraction'][_0xb2c4('0x27')]({'where':_0x4ac179[_0xb2c4('0x22')]?_0x4ac179[_0xb2c4('0x22')][_0xb2c4('0x24')]||null:null})[_0xb2c4('0x12')](function(_0x3c05e9){if(_0x3c05e9){return _0x3c05e9[_0xb2c4('0x28')](_0x4ac179['body'][_0xb2c4('0x29')],_[_0xb2c4('0x2a')](_0x4ac179[_0xb2c4('0x21')],[_0xb2c4('0x29'),'id'])||{});}})[_0xb2c4('0x2b')](function(_0x25f8c1){logger['info'](_0xb2c4('0x2c'),_0x4ac179);logger[_0xb2c4('0x15')](_0xb2c4('0x2c'),_0x4ac179,JSON[_0xb2c4('0x17')](_0x25f8c1));_0x320005(_0x25f8c1);})[_0xb2c4('0x1d')](function(_0x3ae0c8){logger[_0xb2c4('0x18')]('AddTags',_0x3ae0c8[_0xb2c4('0x1b')],_0x4ac179);_0x12a35b(_this[_0xb2c4('0x18')](0x1f4,_0x3ae0c8['message']));});});}; \ No newline at end of file +var _0xe886=['ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','then','info','request\x20sent','debug'];(function(_0x1e9211,_0x2ffb1e){var _0x3f4748=function(_0x5062b5){while(--_0x5062b5){_0x1e9211['push'](_0x1e9211['shift']());}};_0x3f4748(++_0x2ffb1e);}(_0xe886,0x100));var _0x6e88=function(_0x407891,_0x56fb63){_0x407891=_0x407891-0x0;var _0x2efb99=_0xe886[_0x407891];return _0x2efb99;};'use strict';var _=require('lodash');var util=require(_0x6e88('0x0'));var moment=require('moment');var BPromise=require(_0x6e88('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e88('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e88('0x3'));var logger=require(_0x6e88('0x4'))(_0x6e88('0x5'));var config=require('../../config/environment');var jayson=require(_0x6e88('0x6'));var client=jayson[_0x6e88('0x7')][_0x6e88('0x8')]({'port':0x232a});config[_0x6e88('0x9')]=_[_0x6e88('0xa')](config[_0x6e88('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e88('0x9')]));require('./chatInteraction.socket')[_0x6e88('0xb')](socket);function respondWithRpcPromise(_0x132922,_0x5ca41e,_0x32602c){return new BPromise(function(_0x59ecf6,_0x3011c1){return client[_0x6e88('0xc')](_0x132922,_0x32602c)[_0x6e88('0xd')](function(_0x5d889d){logger[_0x6e88('0xe')]('ChatInteraction,\x20%s,\x20%s',_0x5ca41e,_0x6e88('0xf'));logger[_0x6e88('0x10')](_0x6e88('0x11'),_0x5ca41e,_0x6e88('0xf'),JSON[_0x6e88('0x12')](_0x5d889d));if(_0x5d889d[_0x6e88('0x13')]){if(_0x5d889d[_0x6e88('0x13')]['code']===0x1f4){logger[_0x6e88('0x13')](_0x6e88('0x14'),_0x5ca41e,_0x5d889d[_0x6e88('0x13')][_0x6e88('0x15')]);return _0x3011c1(_0x5d889d[_0x6e88('0x13')][_0x6e88('0x15')]);}logger['error'](_0x6e88('0x14'),_0x5ca41e,_0x5d889d[_0x6e88('0x13')][_0x6e88('0x15')]);return _0x59ecf6(_0x5d889d[_0x6e88('0x13')][_0x6e88('0x15')]);}else{logger[_0x6e88('0xe')](_0x6e88('0x14'),_0x5ca41e,'request\x20sent');_0x59ecf6(_0x5d889d[_0x6e88('0x16')][_0x6e88('0x15')]);}})[_0x6e88('0x17')](function(_0x486d53){logger[_0x6e88('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x5ca41e,_0x486d53);_0x3011c1(_0x486d53);});});}exports[_0x6e88('0x18')]=function(_0x1a038d){var _0x2148ee=this;return new Promise(function(_0x596507,_0x33c79a){return db[_0x6e88('0x19')][_0x6e88('0x1a')](_0x1a038d[_0x6e88('0x1b')],{'raw':_0x1a038d[_0x6e88('0x1c')]?_0x1a038d[_0x6e88('0x1c')][_0x6e88('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a038d[_0x6e88('0x1c')]?_0x1a038d[_0x6e88('0x1c')][_0x6e88('0x1e')]||null:null,'attributes':_0x1a038d[_0x6e88('0x1c')]?_0x1a038d['options']['attributes']||null:null,'limit':_0x1a038d['options']?_0x1a038d[_0x6e88('0x1c')][_0x6e88('0x1f')]||null:null})['then'](function(_0x32c632){logger[_0x6e88('0xe')](_0x6e88('0x18'),_0x1a038d);logger[_0x6e88('0x10')](_0x6e88('0x18'),_0x1a038d,JSON['stringify'](_0x32c632));_0x596507(_0x32c632);})['catch'](function(_0x59cbc1){logger[_0x6e88('0x13')]('UpdateChatInteraction',_0x59cbc1['message'],_0x1a038d);_0x33c79a(_0x2148ee[_0x6e88('0x13')](0x1f4,_0x59cbc1[_0x6e88('0x15')]));});});};exports[_0x6e88('0x20')]=function(_0x435ab5){return new Promise(function(_0x25b003,_0x155fd0){return db[_0x6e88('0x19')][_0x6e88('0x21')]({'where':_0x435ab5['options']?_0x435ab5['options'][_0x6e88('0x1e')]||null:null})[_0x6e88('0xd')](function(_0xb9a457){if(_0xb9a457){return _0xb9a457[_0x6e88('0x22')](_0x435ab5[_0x6e88('0x1b')][_0x6e88('0x23')],_[_0x6e88('0x24')](_0x435ab5[_0x6e88('0x1b')],[_0x6e88('0x23'),'id'])||{});}})[_0x6e88('0x25')](function(_0x271739){logger['info'](_0x6e88('0x26'),_0x435ab5);logger['debug'](_0x6e88('0x26'),_0x435ab5,JSON['stringify'](_0x271739));_0x25b003(_0x271739);})['catch'](function(_0x3ad766){logger['error'](_0x6e88('0x26'),_0x3ad766[_0x6e88('0x15')],_0x435ab5);_0x155fd0(_this[_0x6e88('0x13')](0x1f4,_0x3ad766[_0x6e88('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d851e3a..355d80a 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 _0x427f=['update','emit','removeListener','length','./chatInteraction.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x427f,0x1ba));var _0xf427=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x427f[_0x3947c9];return _0x2e7871;};'use strict';var ChatInteractionEvents=require(_0xf427('0x0'));var events=[_0xf427('0x1'),'remove',_0xf427('0x2')];function createListener(_0x59f4ae,_0x20688a){return function(_0x443bfb){_0x20688a[_0xf427('0x3')](_0x59f4ae,_0x443bfb);};}function removeListener(_0x580bb6,_0x4cabc2){return function(){ChatInteractionEvents[_0xf427('0x4')](_0x580bb6,_0x4cabc2);};}exports['register']=function(_0xf282bf){for(var _0xb9c752=0x0,_0xd484e6=events[_0xf427('0x5')];_0xb9c752<_0xd484e6;_0xb9c752++){var _0x1705f2=events[_0xb9c752];var _0x136fa9=createListener('chatInteraction:'+_0x1705f2,_0xf282bf);ChatInteractionEvents['on'](_0x1705f2,_0x136fa9);}}; \ No newline at end of file +var _0x3097=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','register','length'];(function(_0x4d5472,_0x518ea6){var _0x5afb64=function(_0x2b1286){while(--_0x2b1286){_0x4d5472['push'](_0x4d5472['shift']());}};_0x5afb64(++_0x518ea6);}(_0x3097,0x1b1));var _0x7309=function(_0x5c867f,_0x8c0263){_0x5c867f=_0x5c867f-0x0;var _0xcc8945=_0x3097[_0x5c867f];return _0xcc8945;};'use strict';var ChatInteractionEvents=require(_0x7309('0x0'));var events=[_0x7309('0x1'),_0x7309('0x2'),_0x7309('0x3')];function createListener(_0x4f2cb8,_0x2cb287){return function(_0x119863){_0x2cb287[_0x7309('0x4')](_0x4f2cb8,_0x119863);};}function removeListener(_0xc4e22,_0xf71581){return function(){ChatInteractionEvents['removeListener'](_0xc4e22,_0xf71581);};}exports[_0x7309('0x5')]=function(_0x3884bc){for(var _0x23a116=0x0,_0x1c63f9=events[_0x7309('0x6')];_0x23a116<_0x1c63f9;_0x23a116++){var _0x11b654=events[_0x23a116];var _0xb5b764=createListener(_0x7309('0x7')+_0x11b654,_0x3884bc);ChatInteractionEvents['on'](_0x11b654,_0xb5b764);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index fe2d718..f3644f8 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 _0x4e0c=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','close','chatinteraction:destroy','delete','removeTags'];(function(_0x35a724,_0x1ff8ab){var _0x324516=function(_0x27829a){while(--_0x27829a){_0x35a724['push'](_0x35a724['shift']());}};_0x324516(++_0x1ff8ab);}(_0x4e0c,0x139));var _0xc4e0=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x4e0c[_0x45d55e];return _0x29812a;};'use strict';var multer=require(_0xc4e0('0x0'));var util=require(_0xc4e0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc4e0('0x2'));var router=express[_0xc4e0('0x3')]();var fs_extra=require(_0xc4e0('0x4'));var auth=require(_0xc4e0('0x5'));var interaction=require(_0xc4e0('0x6'));var config=require(_0xc4e0('0x7'));var controller=require('./chatInteraction.controller');router[_0xc4e0('0x8')]('/',auth[_0xc4e0('0x9')](),controller['index']);router[_0xc4e0('0x8')](_0xc4e0('0xa'),auth[_0xc4e0('0x9')](),controller[_0xc4e0('0xb')]);router[_0xc4e0('0x8')](_0xc4e0('0xc'),auth[_0xc4e0('0xd')](),controller[_0xc4e0('0xe')]);router[_0xc4e0('0x8')](_0xc4e0('0xf'),auth[_0xc4e0('0xd')](),controller['attachmentDownload']);router[_0xc4e0('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc4e0('0x10')]);router[_0xc4e0('0x8')](_0xc4e0('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xc4e0('0x12')]);router[_0xc4e0('0x8')](_0xc4e0('0x13'),auth[_0xc4e0('0x9')](),controller[_0xc4e0('0x14')]);router[_0xc4e0('0x15')]('/',auth[_0xc4e0('0x9')](),controller[_0xc4e0('0x16')]);router[_0xc4e0('0x15')](_0xc4e0('0x17'),auth[_0xc4e0('0x9')](),controller[_0xc4e0('0x18')]);var upload=multer({'storage':multer[_0xc4e0('0x19')]({'destination':function(_0x5c2973,_0x11993e,_0x39f35f){_0x39f35f(null,path[_0xc4e0('0x1a')](config['root'],_0xc4e0('0x1b')));},'filename':function(_0x579977,_0x1b9d84,_0x3fcd24){_0x3fcd24(null,util[_0xc4e0('0x1c')]('%s-%s',Date[_0xc4e0('0x1d')](),_0x1b9d84[_0xc4e0('0x1e')][_0xc4e0('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xc4e0('0x20')](_0xc4e0('0x21')),controller[_0xc4e0('0x22')]);router[_0xc4e0('0x15')](_0xc4e0('0x23'),auth[_0xc4e0('0xd')](),controller[_0xc4e0('0x24')]);router[_0xc4e0('0x15')](_0xc4e0('0x25'),auth[_0xc4e0('0x9')](),interaction[_0xc4e0('0x26')](_0xc4e0('0x27'),_0xc4e0('0x28')),controller['addTags']);router[_0xc4e0('0x29')](_0xc4e0('0xc'),auth[_0xc4e0('0x9')](),interaction[_0xc4e0('0x26')]('chat',_0xc4e0('0x2a')),controller[_0xc4e0('0x2b')]);router[_0xc4e0('0x29')]('/:id/custom_update',controller[_0xc4e0('0x2c')]);router[_0xc4e0('0x29')](_0xc4e0('0x2d'),auth[_0xc4e0('0xd')](),controller[_0xc4e0('0x2e')]);router[_0xc4e0('0x29')]('/:id/close',controller[_0xc4e0('0x2f')]);router['delete'](_0xc4e0('0xc'),auth[_0xc4e0('0x9')](),interaction[_0xc4e0('0x26')]('chat',_0xc4e0('0x30')),controller['destroy']);router[_0xc4e0('0x31')](_0xc4e0('0x25'),auth[_0xc4e0('0x9')](),controller[_0xc4e0('0x32')]);module[_0xc4e0('0x33')]=router; \ No newline at end of file +var _0xe7ab=['diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','attachmentUpload','addMessage','/:id/tags','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','createVidaooSession'];(function(_0x1805ea,_0x54af41){var _0x388429=function(_0x8a2a2f){while(--_0x8a2a2f){_0x1805ea['push'](_0x1805ea['shift']());}};_0x388429(++_0x54af41);}(_0xe7ab,0x196));var _0xbe7a=function(_0xf8b7b6,_0x575f7c){_0xf8b7b6=_0xf8b7b6-0x0;var _0x662ba0=_0xe7ab[_0xf8b7b6];return _0x662ba0;};'use strict';var multer=require(_0xbe7a('0x0'));var util=require(_0xbe7a('0x1'));var path=require(_0xbe7a('0x2'));var timeout=require('connect-timeout');var express=require(_0xbe7a('0x3'));var router=express[_0xbe7a('0x4')]();var fs_extra=require(_0xbe7a('0x5'));var auth=require(_0xbe7a('0x6'));var interaction=require(_0xbe7a('0x7'));var config=require('../../config/environment');var controller=require(_0xbe7a('0x8'));router[_0xbe7a('0x9')]('/',auth[_0xbe7a('0xa')](),controller[_0xbe7a('0xb')]);router['get'](_0xbe7a('0xc'),auth[_0xbe7a('0xa')](),controller[_0xbe7a('0xd')]);router['get'](_0xbe7a('0xe'),auth[_0xbe7a('0xf')](),controller[_0xbe7a('0x10')]);router[_0xbe7a('0x9')](_0xbe7a('0x11'),auth[_0xbe7a('0xf')](),controller['attachmentDownload']);router['get'](_0xbe7a('0x12'),auth['isAuthenticated'](),controller[_0xbe7a('0x13')]);router['get']('/:id/my_messages',auth[_0xbe7a('0xf')](),controller[_0xbe7a('0x14')]);router[_0xbe7a('0x9')](_0xbe7a('0x15'),auth[_0xbe7a('0xa')](),controller[_0xbe7a('0x16')]);router[_0xbe7a('0x17')]('/',auth['isAuthenticated'](),controller[_0xbe7a('0x18')]);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0xbe7a('0x19')]);var upload=multer({'storage':multer[_0xbe7a('0x1a')]({'destination':function(_0x130f56,_0x2b0adf,_0x3a18c1){_0x3a18c1(null,path['join'](config[_0xbe7a('0x1b')],_0xbe7a('0x1c')));},'filename':function(_0x375ad4,_0x159ba3,_0x3277d1){_0x3277d1(null,util[_0xbe7a('0x1d')](_0xbe7a('0x1e'),Date[_0xbe7a('0x1f')](),_0x159ba3[_0xbe7a('0x20')][_0xbe7a('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbe7a('0x17')](_0xbe7a('0x22'),upload['single']('file'),controller[_0xbe7a('0x23')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xbe7a('0x24')]);router[_0xbe7a('0x17')](_0xbe7a('0x25'),auth[_0xbe7a('0xa')](),interaction['tracked']('chat',_0xbe7a('0x26')),controller[_0xbe7a('0x27')]);router[_0xbe7a('0x28')](_0xbe7a('0xe'),auth['isAuthenticated'](),interaction[_0xbe7a('0x29')]('chat',_0xbe7a('0x2a')),controller[_0xbe7a('0x2b')]);router['put'](_0xbe7a('0x2c'),controller[_0xbe7a('0x2d')]);router[_0xbe7a('0x28')](_0xbe7a('0x2e'),auth[_0xbe7a('0xf')](),controller[_0xbe7a('0x2f')]);router[_0xbe7a('0x28')]('/:id/close',controller[_0xbe7a('0x30')]);router[_0xbe7a('0x31')](_0xbe7a('0xe'),auth[_0xbe7a('0xa')](),interaction['tracked']('chat',_0xbe7a('0x32')),controller[_0xbe7a('0x33')]);router['delete'](_0xbe7a('0x25'),auth[_0xbe7a('0xa')](),controller[_0xbe7a('0x34')]);module[_0xbe7a('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index aa98379..dbb9b8b 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 _0x5bbd=['INTEGER','sequelize','exports','TEXT','BOOLEAN'];(function(_0x4f6194,_0x1e31de){var _0x350b3c=function(_0x26dc15){while(--_0x26dc15){_0x4f6194['push'](_0x4f6194['shift']());}};_0x350b3c(++_0x1e31de);}(_0x5bbd,0x119));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd5bb('0x0'));module[_0xd5bb('0x1')]={'body':{'type':Sequelize[_0xd5bb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd5bb('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd5bb('0x4')]}}; \ No newline at end of file +var _0x16a5=['BOOLEAN','INTEGER','sequelize','TEXT','medium'];(function(_0x16add5,_0x4ed63e){var _0x3eba81=function(_0x14097b){while(--_0x14097b){_0x16add5['push'](_0x16add5['shift']());}};_0x3eba81(++_0x4ed63e);}(_0x16a5,0x13d));var _0x516a=function(_0x10e653,_0x59f1cc){_0x10e653=_0x10e653-0x0;var _0x328dfd=_0x16a5[_0x10e653];return _0x328dfd;};'use strict';var Sequelize=require(_0x516a('0x0'));module['exports']={'body':{'type':Sequelize[_0x516a('0x1')](_0x516a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x516a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x516a('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5f7714a..b68175f 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 _0xbfd5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','include','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','findAll','agent','admin','user','fullname','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','UserProfileResource','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key'];(function(_0x4a1c63,_0x47ca29){var _0x46b72b=function(_0x428da9){while(--_0x428da9){_0x4a1c63['push'](_0x4a1c63['shift']());}};_0x46b72b(++_0x47ca29);}(_0xbfd5,0xa5));var _0x5bfd=function(_0x2a8e7b,_0x10a139){_0x2a8e7b=_0x2a8e7b-0x0;var _0x2c7f59=_0xbfd5[_0x2a8e7b];return _0x2c7f59;};'use strict';var emlformat=require(_0x5bfd('0x0'));var rimraf=require(_0x5bfd('0x1'));var zipdir=require(_0x5bfd('0x2'));var jsonpatch=require(_0x5bfd('0x3'));var rp=require(_0x5bfd('0x4'));var moment=require(_0x5bfd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5bfd('0x6'));var path=require(_0x5bfd('0x7'));var sox=require('sox');var csv=require(_0x5bfd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bfd('0x9'));var _=require(_0x5bfd('0xa'));var squel=require(_0x5bfd('0xb'));var crypto=require(_0x5bfd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5bfd('0xd'));var toCsv=require(_0x5bfd('0x8'));var querystring=require(_0x5bfd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5bfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5bfd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5bfd('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5bfd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bfd('0x13'))['db'];config[_0x5bfd('0x14')]=_['defaults'](config[_0x5bfd('0x14')],{'host':_0x5bfd('0x15'),'port':0x18eb});var socket=require(_0x5bfd('0x16'))(new Redis(config[_0x5bfd('0x14')]));require('./chatInternalMessage.socket')[_0x5bfd('0x17')](socket);function respondWithStatusCode(_0x303824,_0x3e98d9){_0x3e98d9=_0x3e98d9||0xcc;return function(_0x14671f){if(_0x14671f){return _0x303824[_0x5bfd('0x18')](_0x3e98d9);}return _0x303824['status'](_0x3e98d9)[_0x5bfd('0x19')]();};}function respondWithResult(_0x5d71a4,_0x4720d0){_0x4720d0=_0x4720d0||0xc8;return function(_0xd090ff){if(_0xd090ff){return _0x5d71a4['status'](_0x4720d0)[_0x5bfd('0x1a')](_0xd090ff);}};}function respondWithFilteredResult(_0x50e15c,_0x421549){return function(_0x32364e){if(_0x32364e){var _0x51bdb5=typeof _0x421549[_0x5bfd('0x1b')]===_0x5bfd('0x1c')&&typeof _0x421549[_0x5bfd('0x1d')]===_0x5bfd('0x1c');var _0x24a945=_0x32364e[_0x5bfd('0x1e')];var _0x500c42=_0x51bdb5?0x0:_0x421549[_0x5bfd('0x1b')];var _0x409d19=_0x51bdb5?_0x32364e[_0x5bfd('0x1e')]:_0x421549[_0x5bfd('0x1b')]+_0x421549[_0x5bfd('0x1d')];var _0x7b9ce5;if(_0x409d19>=_0x24a945){_0x409d19=_0x24a945;_0x7b9ce5=0xc8;}else{_0x7b9ce5=0xce;}_0x50e15c[_0x5bfd('0x1f')](_0x7b9ce5);return _0x50e15c[_0x5bfd('0x20')](_0x5bfd('0x21'),_0x500c42+'-'+_0x409d19+'/'+_0x24a945)[_0x5bfd('0x1a')](_0x32364e);}return null;};}function patchUpdates(_0x8aca42){return function(_0x22e033){try{jsonpatch[_0x5bfd('0x22')](_0x22e033,_0x8aca42,!![]);}catch(_0x18b59d){return BPromise[_0x5bfd('0x23')](_0x18b59d);}return _0x22e033[_0x5bfd('0x24')]();};}function saveUpdates(_0x36864f,_0x158306){return function(_0x29ef36){if(_0x29ef36){return _0x29ef36['update'](_0x36864f)[_0x5bfd('0x25')](function(_0x4cce77){return _0x4cce77;});}return null;};}function removeEntity(_0x53a265,_0xce2657){return function(_0x5c8390){if(_0x5c8390){return _0x5c8390[_0x5bfd('0x26')]()[_0x5bfd('0x25')](function(){_0x53a265['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1845a3,_0x54235d){return function(_0x1f72a9){if(!_0x1f72a9){_0x1845a3[_0x5bfd('0x18')](0x194);}return _0x1f72a9;};}function handleError(_0x479893,_0x58a2ec){_0x58a2ec=_0x58a2ec||0x1f4;return function(_0x36cde8){logger['error'](_0x36cde8[_0x5bfd('0x27')]);if(_0x36cde8[_0x5bfd('0x28')]){delete _0x36cde8[_0x5bfd('0x28')];}_0x479893['status'](_0x58a2ec)[_0x5bfd('0x29')](_0x36cde8);};}exports[_0x5bfd('0x2a')]=function(_0x14c2f0,_0x3dd46b){var _0x2049b2={},_0x34b9b1={},_0x2489b6={'count':0x0,'rows':[]};var _0x54e326=_[_0x5bfd('0x2b')](db[_0x5bfd('0x2c')][_0x5bfd('0x2d')],function(_0x461d56){return{'name':_0x461d56[_0x5bfd('0x2e')],'type':_0x461d56[_0x5bfd('0x2f')][_0x5bfd('0x30')]};});_0x34b9b1[_0x5bfd('0x31')]=_[_0x5bfd('0x2b')](_0x54e326,_0x5bfd('0x28'));_0x34b9b1[_0x5bfd('0x32')]=_[_0x5bfd('0x33')](_0x14c2f0[_0x5bfd('0x32')]);_0x34b9b1['filters']=_[_0x5bfd('0x34')](_0x34b9b1[_0x5bfd('0x31')],_0x34b9b1[_0x5bfd('0x32')]);_0x2049b2[_0x5bfd('0x35')]=_[_0x5bfd('0x34')](_0x34b9b1[_0x5bfd('0x31')],qs[_0x5bfd('0x36')](_0x14c2f0[_0x5bfd('0x32')]['fields']));_0x2049b2[_0x5bfd('0x35')]=_0x2049b2['attributes']['length']?_0x2049b2[_0x5bfd('0x35')]:_0x34b9b1[_0x5bfd('0x31')];if(!_0x14c2f0[_0x5bfd('0x32')][_0x5bfd('0x37')](_0x5bfd('0x38'))){_0x2049b2[_0x5bfd('0x1d')]=qs['limit'](_0x14c2f0[_0x5bfd('0x32')][_0x5bfd('0x1d')]);_0x2049b2[_0x5bfd('0x1b')]=qs[_0x5bfd('0x1b')](_0x14c2f0[_0x5bfd('0x32')][_0x5bfd('0x1b')]);}_0x2049b2[_0x5bfd('0x39')]=qs[_0x5bfd('0x3a')](_0x14c2f0[_0x5bfd('0x32')][_0x5bfd('0x3a')]);_0x2049b2[_0x5bfd('0x3b')]=qs[_0x5bfd('0x3c')](_[_0x5bfd('0x3d')](_0x14c2f0[_0x5bfd('0x32')],_0x34b9b1['filters']),_0x54e326);if(_0x14c2f0[_0x5bfd('0x32')]['filter']){_0x2049b2[_0x5bfd('0x3b')]=_[_0x5bfd('0x3e')](_0x2049b2[_0x5bfd('0x3b')],{'$or':_[_0x5bfd('0x2b')](_0x54e326,function(_0x24e941){if(_0x24e941[_0x5bfd('0x2f')]!==_0x5bfd('0x3f')){var _0x18ecd4={};_0x18ecd4[_0x24e941[_0x5bfd('0x28')]]={'$like':'%'+_0x14c2f0['query'][_0x5bfd('0x40')]+'%'};return _0x18ecd4;}})});}_0x2049b2=_[_0x5bfd('0x3e')]({},_0x2049b2,_0x14c2f0[_0x5bfd('0x41')]);var _0x47b72f={'where':_0x2049b2[_0x5bfd('0x3b')]};return db['ChatInternalMessage'][_0x5bfd('0x1e')](_0x47b72f)[_0x5bfd('0x25')](function(_0x30c53f){_0x2489b6['count']=_0x30c53f;if(_0x14c2f0['query'][_0x5bfd('0x42')]){_0x2049b2['include']=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x2049b2);})[_0x5bfd('0x25')](function(_0x23f662){_0x2489b6[_0x5bfd('0x43')]=_0x23f662;return _0x2489b6;})['then'](respondWithFilteredResult(_0x3dd46b,_0x2049b2))[_0x5bfd('0x44')](handleError(_0x3dd46b,null));};exports[_0x5bfd('0x45')]=function(_0x59709a,_0x114218){var _0x3d73da={'raw':!![],'where':{'id':_0x59709a[_0x5bfd('0x46')]['id']}},_0x42f877={};_0x42f877[_0x5bfd('0x31')]=_[_0x5bfd('0x33')](db[_0x5bfd('0x2c')][_0x5bfd('0x2d')]);_0x42f877['query']=_['keys'](_0x59709a[_0x5bfd('0x32')]);_0x42f877['filters']=_[_0x5bfd('0x34')](_0x42f877[_0x5bfd('0x31')],_0x42f877[_0x5bfd('0x32')]);_0x3d73da['attributes']=_[_0x5bfd('0x34')](_0x42f877[_0x5bfd('0x31')],qs[_0x5bfd('0x36')](_0x59709a['query']['fields']));_0x3d73da[_0x5bfd('0x35')]=_0x3d73da[_0x5bfd('0x35')][_0x5bfd('0x47')]?_0x3d73da[_0x5bfd('0x35')]:_0x42f877['model'];if(_0x59709a['query']['includeAll']){_0x3d73da[_0x5bfd('0x48')]=[{'all':!![]}];}_0x3d73da=_['merge']({},_0x3d73da,_0x59709a[_0x5bfd('0x41')]);return db['ChatInternalMessage'][_0x5bfd('0x49')](_0x3d73da)[_0x5bfd('0x25')](handleEntityNotFound(_0x114218,null))['then'](respondWithResult(_0x114218,null))[_0x5bfd('0x44')](handleError(_0x114218,null));};exports[_0x5bfd('0x4a')]=function(_0x5e4f1f,_0x410c26){return db['ChatInternalMessage'][_0x5bfd('0x4a')](_0x5e4f1f[_0x5bfd('0x4b')],{})[_0x5bfd('0x25')](respondWithResult(_0x410c26,0xc9))[_0x5bfd('0x44')](handleError(_0x410c26,null));};exports['update']=function(_0x23f94d,_0xb47295){if(_0x23f94d[_0x5bfd('0x4b')]['id']){delete _0x23f94d[_0x5bfd('0x4b')]['id'];}return db[_0x5bfd('0x2c')][_0x5bfd('0x49')]({'where':{'id':_0x23f94d[_0x5bfd('0x46')]['id']}})[_0x5bfd('0x25')](handleEntityNotFound(_0xb47295,null))[_0x5bfd('0x25')](saveUpdates(_0x23f94d[_0x5bfd('0x4b')],null))[_0x5bfd('0x25')](respondWithResult(_0xb47295,null))[_0x5bfd('0x44')](handleError(_0xb47295,null));};exports[_0x5bfd('0x26')]=function(_0x35a8a7,_0x4b02e5){return db['ChatInternalMessage'][_0x5bfd('0x49')]({'where':{'id':_0x35a8a7[_0x5bfd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b02e5,null))[_0x5bfd('0x25')](removeEntity(_0x4b02e5,null))[_0x5bfd('0x44')](handleError(_0x4b02e5,null));};exports[_0x5bfd('0x4c')]=function(_0x5dd747,_0x173b10){return db['ChatInternalMessage'][_0x5bfd('0x4c')]()[_0x5bfd('0x25')](respondWithResult(_0x173b10,null))[_0x5bfd('0x44')](handleError(_0x173b10,null));};function wrapUser(_0x5f599c){return function(_0x294314){var _0x3874b8=_0x5f599c[_0x5bfd('0x4d')]({'plain':!![]});_0x3874b8[_0x5bfd('0x4e')]=[];if(_0x294314){_0x3874b8[_0x5bfd('0x4f')]=_0x294314[_0x5bfd('0x50')];_0x3874b8['lastMessage']=_0x294314;}else{_0x3874b8[_0x5bfd('0x4f')]=moment(0x0)[_0x5bfd('0x51')](_0x5bfd('0x52'));_0x3874b8[_0x5bfd('0x53')]={};}return _0x3874b8;};}exports[_0x5bfd('0x54')]=function(_0x56706c,_0x49d628,_0x8ff180){var _0x398f80=[];return db['User'][_0x5bfd('0x55')]({'where':{'role':[_0x5bfd('0x56'),_0x5bfd('0x57'),_0x5bfd('0x58')]},'attributes':['id',_0x5bfd('0x59'),_0x5bfd('0x28'),'role','userpic',_0x5bfd('0x5a'),_0x5bfd('0x5b'),_0x5bfd('0x5c'),_0x5bfd('0x5d'),_0x5bfd('0x5e')],'order':qs[_0x5bfd('0x3a')]('-online'),'include':[{'model':db[_0x5bfd('0x5f')],'as':'VoiceQueues','attributes':['id',_0x5bfd('0x28'),_0x5bfd('0x2f')],'through':{'attributes':[]}}]})[_0x5bfd('0x25')](function(_0x182655){if(_0x182655){var _0x3746f8=_0x56706c['user']['get']({'plain':!![]});if(!_0x3746f8)throw new Error(_0x5bfd('0x60'));if(_0x3746f8[_0x5bfd('0x61')]===_0x5bfd('0x58')){return db[_0x5bfd('0x62')][_0x5bfd('0x49')]({'where':{'name':_0x5bfd('0x63'),'userProfileId':_0x3746f8['userProfileId']},'raw':!![]})[_0x5bfd('0x25')](function(_0x3274a0){if(_0x3274a0){if(_0x3274a0[_0x5bfd('0x64')]===0x0){return db[_0x5bfd('0x65')][_0x5bfd('0x55')]({'where':{'sectionId':_0x3274a0['id']},'raw':!![]})[_0x5bfd('0x25')](function(_0x34cadb){var _0x271162=[];if(_['isEmpty'](_0x34cadb)){_0x271162=_[_0x5bfd('0x40')](_0x182655,function(_0x509d2e){if(_0x509d2e[_0x5bfd('0x61')]!==_0x5bfd('0x56')){return _0x509d2e;}});return _0x271162;}else{for(var _0x217b83=0x0;_0x217b83<_0x182655['length'];_0x217b83++){var _0x4d099b=_0x182655[_0x217b83];if(_0x4d099b[_0x5bfd('0x61')]===_0x5bfd('0x56')){var _0x1a0655=_[_0x5bfd('0x49')](_0x34cadb,function(_0x4be323){return _0x4be323['resourceId']===_0x4d099b['id'];});if(_0x1a0655)_0x271162['push'](_0x4d099b);}else{_0x271162[_0x5bfd('0x66')](_0x4d099b);}}return _0x271162;}});}else{return _0x182655;}}else{var _0x504792=_[_0x5bfd('0x40')](_0x182655,function(_0x1e72f4){if(_0x1e72f4[_0x5bfd('0x61')]!==_0x5bfd('0x56')){return _0x1e72f4;}});return _0x504792;}});}else{return _0x182655;}}})[_0x5bfd('0x25')](function(_0x283b50){var _0x30f612=[];if(_0x283b50){_0x398f80=_0x283b50;for(var _0x1a5194=0x0;_0x1a5194<_0x283b50[_0x5bfd('0x47')];_0x1a5194+=0x1){_0x398f80[_0x1a5194][_0x5bfd('0x4e')]=[];_0x30f612['push'](db['ChatInternalMessage'][_0x5bfd('0x49')]({'where':{'FromId':[_0x56706c[_0x5bfd('0x58')]['id'],_0x283b50[_0x1a5194]['id']],'ToId':[_0x56706c['user']['id'],_0x283b50[_0x1a5194]['id']],'ChatGroupId':null},'attributes':['id',_0x5bfd('0x50'),_0x5bfd('0x67'),_0x5bfd('0x68'),_0x5bfd('0x69'),_0x5bfd('0x4b')],'order':qs[_0x5bfd('0x3a')](_0x5bfd('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5bfd('0x25')](wrapUser(_0x283b50[_0x1a5194])));}return BPromise['all'](_0x30f612);}return[];})[_0x5bfd('0x25')](function(_0x59cfec){return{'rows':_0x59cfec,'count':_0x59cfec[_0x5bfd('0x47')]};})['then'](respondWithResult(_0x49d628,null))[_0x5bfd('0x44')](handleError(_0x49d628,null));}; \ No newline at end of file +var _0xf8c7=['options','includeAll','findAll','rows','catch','show','params','keys','attributes','find','create','body','update','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','save','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8c7,0x18f));var _0x7f8c=function(_0x22577f,_0x495538){_0x22577f=_0x22577f-0x0;var _0x35c955=_0xf8c7[_0x22577f];return _0x35c955;};'use strict';var emlformat=require(_0x7f8c('0x0'));var rimraf=require(_0x7f8c('0x1'));var zipdir=require(_0x7f8c('0x2'));var jsonpatch=require(_0x7f8c('0x3'));var rp=require(_0x7f8c('0x4'));var moment=require(_0x7f8c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7f8c('0x6'));var util=require(_0x7f8c('0x7'));var path=require(_0x7f8c('0x8'));var sox=require(_0x7f8c('0x9'));var csv=require(_0x7f8c('0xa'));var ejs=require(_0x7f8c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f8c('0xc'));var squel=require(_0x7f8c('0xd'));var crypto=require(_0x7f8c('0xe'));var jsforce=require(_0x7f8c('0xf'));var deskjs=require(_0x7f8c('0x10'));var toCsv=require(_0x7f8c('0xa'));var querystring=require(_0x7f8c('0x11'));var Papa=require('papaparse');var Redis=require(_0x7f8c('0x12'));var authService=require(_0x7f8c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7f8c('0x14'));var hardwareService=require(_0x7f8c('0x15'));var logger=require('../../config/logger')(_0x7f8c('0x16'));var utils=require(_0x7f8c('0x17'));var config=require(_0x7f8c('0x18'));var licenseUtil=require(_0x7f8c('0x19'));var db=require(_0x7f8c('0x1a'))['db'];config[_0x7f8c('0x1b')]=_[_0x7f8c('0x1c')](config['redis'],{'host':_0x7f8c('0x1d'),'port':0x18eb});var socket=require(_0x7f8c('0x1e'))(new Redis(config[_0x7f8c('0x1b')]));require(_0x7f8c('0x1f'))['register'](socket);function respondWithStatusCode(_0x4d37b4,_0x3f1c10){_0x3f1c10=_0x3f1c10||0xcc;return function(_0x375602){if(_0x375602){return _0x4d37b4[_0x7f8c('0x20')](_0x3f1c10);}return _0x4d37b4[_0x7f8c('0x21')](_0x3f1c10)[_0x7f8c('0x22')]();};}function respondWithResult(_0x575217,_0x18c58f){_0x18c58f=_0x18c58f||0xc8;return function(_0x2ee9d1){if(_0x2ee9d1){return _0x575217[_0x7f8c('0x21')](_0x18c58f)[_0x7f8c('0x23')](_0x2ee9d1);}};}function respondWithFilteredResult(_0x25f4ea,_0x488393){return function(_0x31590a){if(_0x31590a){var _0x54747f=typeof _0x488393[_0x7f8c('0x24')]===_0x7f8c('0x25')&&typeof _0x488393[_0x7f8c('0x26')]==='undefined';var _0x1e259b=_0x31590a['count'];var _0x5bd6b2=_0x54747f?0x0:_0x488393[_0x7f8c('0x24')];var _0x179b08=_0x54747f?_0x31590a[_0x7f8c('0x27')]:_0x488393[_0x7f8c('0x24')]+_0x488393[_0x7f8c('0x26')];var _0xa48ff0;if(_0x179b08>=_0x1e259b){_0x179b08=_0x1e259b;_0xa48ff0=0xc8;}else{_0xa48ff0=0xce;}_0x25f4ea[_0x7f8c('0x21')](_0xa48ff0);return _0x25f4ea[_0x7f8c('0x28')]('Content-Range',_0x5bd6b2+'-'+_0x179b08+'/'+_0x1e259b)[_0x7f8c('0x23')](_0x31590a);}return null;};}function patchUpdates(_0x5261bb){return function(_0x479bc1){try{jsonpatch['apply'](_0x479bc1,_0x5261bb,!![]);}catch(_0x9fbb41){return BPromise['reject'](_0x9fbb41);}return _0x479bc1[_0x7f8c('0x29')]();};}function saveUpdates(_0x3d8fb7,_0x5d644f){return function(_0x3af6b8){if(_0x3af6b8){return _0x3af6b8['update'](_0x3d8fb7)['then'](function(_0xf2f0d1){return _0xf2f0d1;});}return null;};}function removeEntity(_0x175d6e,_0x9f0a02){return function(_0x226d54){if(_0x226d54){return _0x226d54[_0x7f8c('0x2a')]()[_0x7f8c('0x2b')](function(){_0x175d6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x822362,_0x507adc){return function(_0x35f54f){if(!_0x35f54f){_0x822362['sendStatus'](0x194);}return _0x35f54f;};}function handleError(_0x4e81ce,_0x5f2b38){_0x5f2b38=_0x5f2b38||0x1f4;return function(_0x214135){logger[_0x7f8c('0x2c')](_0x214135[_0x7f8c('0x2d')]);if(_0x214135[_0x7f8c('0x2e')]){delete _0x214135[_0x7f8c('0x2e')];}_0x4e81ce[_0x7f8c('0x21')](_0x5f2b38)[_0x7f8c('0x2f')](_0x214135);};}exports[_0x7f8c('0x30')]=function(_0x3dcc19,_0xf52290){var _0x25c554={},_0x3f52e8={},_0x133602={'count':0x0,'rows':[]};var _0x1ac760=_[_0x7f8c('0x31')](db[_0x7f8c('0x32')][_0x7f8c('0x33')],function(_0x42709a){return{'name':_0x42709a[_0x7f8c('0x34')],'type':_0x42709a['type'][_0x7f8c('0x35')]};});_0x3f52e8[_0x7f8c('0x36')]=_[_0x7f8c('0x31')](_0x1ac760,'name');_0x3f52e8[_0x7f8c('0x37')]=_['keys'](_0x3dcc19['query']);_0x3f52e8[_0x7f8c('0x38')]=_[_0x7f8c('0x39')](_0x3f52e8[_0x7f8c('0x36')],_0x3f52e8[_0x7f8c('0x37')]);_0x25c554['attributes']=_['intersection'](_0x3f52e8['model'],qs[_0x7f8c('0x3a')](_0x3dcc19[_0x7f8c('0x37')][_0x7f8c('0x3a')]));_0x25c554['attributes']=_0x25c554['attributes'][_0x7f8c('0x3b')]?_0x25c554['attributes']:_0x3f52e8[_0x7f8c('0x36')];if(!_0x3dcc19[_0x7f8c('0x37')][_0x7f8c('0x3c')](_0x7f8c('0x3d'))){_0x25c554[_0x7f8c('0x26')]=qs[_0x7f8c('0x26')](_0x3dcc19[_0x7f8c('0x37')][_0x7f8c('0x26')]);_0x25c554['offset']=qs[_0x7f8c('0x24')](_0x3dcc19[_0x7f8c('0x37')]['offset']);}_0x25c554[_0x7f8c('0x3e')]=qs[_0x7f8c('0x3f')](_0x3dcc19['query'][_0x7f8c('0x3f')]);_0x25c554[_0x7f8c('0x40')]=qs[_0x7f8c('0x38')](_['pick'](_0x3dcc19[_0x7f8c('0x37')],_0x3f52e8[_0x7f8c('0x38')]),_0x1ac760);if(_0x3dcc19['query']['filter']){_0x25c554[_0x7f8c('0x40')]=_[_0x7f8c('0x41')](_0x25c554['where'],{'$or':_[_0x7f8c('0x31')](_0x1ac760,function(_0x4458ea){if(_0x4458ea[_0x7f8c('0x42')]!==_0x7f8c('0x43')){var _0x3cae90={};_0x3cae90[_0x4458ea['name']]={'$like':'%'+_0x3dcc19['query'][_0x7f8c('0x44')]+'%'};return _0x3cae90;}})});}_0x25c554=_[_0x7f8c('0x41')]({},_0x25c554,_0x3dcc19[_0x7f8c('0x45')]);var _0x518b35={'where':_0x25c554['where']};return db[_0x7f8c('0x32')]['count'](_0x518b35)['then'](function(_0x6c6a1e){_0x133602[_0x7f8c('0x27')]=_0x6c6a1e;if(_0x3dcc19['query'][_0x7f8c('0x46')]){_0x25c554['include']=[{'all':!![]}];}return db[_0x7f8c('0x32')][_0x7f8c('0x47')](_0x25c554);})['then'](function(_0x5cec93){_0x133602[_0x7f8c('0x48')]=_0x5cec93;return _0x133602;})[_0x7f8c('0x2b')](respondWithFilteredResult(_0xf52290,_0x25c554))[_0x7f8c('0x49')](handleError(_0xf52290,null));};exports[_0x7f8c('0x4a')]=function(_0x2f8a71,_0x127f25){var _0x482e3e={'raw':!![],'where':{'id':_0x2f8a71[_0x7f8c('0x4b')]['id']}},_0x5d583b={};_0x5d583b['model']=_[_0x7f8c('0x4c')](db[_0x7f8c('0x32')][_0x7f8c('0x33')]);_0x5d583b[_0x7f8c('0x37')]=_[_0x7f8c('0x4c')](_0x2f8a71['query']);_0x5d583b[_0x7f8c('0x38')]=_[_0x7f8c('0x39')](_0x5d583b[_0x7f8c('0x36')],_0x5d583b[_0x7f8c('0x37')]);_0x482e3e[_0x7f8c('0x4d')]=_[_0x7f8c('0x39')](_0x5d583b[_0x7f8c('0x36')],qs[_0x7f8c('0x3a')](_0x2f8a71['query'][_0x7f8c('0x3a')]));_0x482e3e[_0x7f8c('0x4d')]=_0x482e3e[_0x7f8c('0x4d')][_0x7f8c('0x3b')]?_0x482e3e[_0x7f8c('0x4d')]:_0x5d583b[_0x7f8c('0x36')];if(_0x2f8a71[_0x7f8c('0x37')][_0x7f8c('0x46')]){_0x482e3e['include']=[{'all':!![]}];}_0x482e3e=_[_0x7f8c('0x41')]({},_0x482e3e,_0x2f8a71['options']);return db['ChatInternalMessage'][_0x7f8c('0x4e')](_0x482e3e)['then'](handleEntityNotFound(_0x127f25,null))[_0x7f8c('0x2b')](respondWithResult(_0x127f25,null))[_0x7f8c('0x49')](handleError(_0x127f25,null));};exports[_0x7f8c('0x4f')]=function(_0x8a76a9,_0x5985f8){return db[_0x7f8c('0x32')]['create'](_0x8a76a9[_0x7f8c('0x50')],{})[_0x7f8c('0x2b')](respondWithResult(_0x5985f8,0xc9))[_0x7f8c('0x49')](handleError(_0x5985f8,null));};exports[_0x7f8c('0x51')]=function(_0x3b7a7f,_0xb958c5){if(_0x3b7a7f[_0x7f8c('0x50')]['id']){delete _0x3b7a7f[_0x7f8c('0x50')]['id'];}return db[_0x7f8c('0x32')][_0x7f8c('0x4e')]({'where':{'id':_0x3b7a7f[_0x7f8c('0x4b')]['id']}})[_0x7f8c('0x2b')](handleEntityNotFound(_0xb958c5,null))[_0x7f8c('0x2b')](saveUpdates(_0x3b7a7f[_0x7f8c('0x50')],null))[_0x7f8c('0x2b')](respondWithResult(_0xb958c5,null))[_0x7f8c('0x49')](handleError(_0xb958c5,null));};exports[_0x7f8c('0x2a')]=function(_0x2d345a,_0x8ef41){return db[_0x7f8c('0x32')]['find']({'where':{'id':_0x2d345a[_0x7f8c('0x4b')]['id']}})[_0x7f8c('0x2b')](handleEntityNotFound(_0x8ef41,null))[_0x7f8c('0x2b')](removeEntity(_0x8ef41,null))[_0x7f8c('0x49')](handleError(_0x8ef41,null));};exports[_0x7f8c('0x52')]=function(_0x325248,_0x10e1ee){return db[_0x7f8c('0x32')][_0x7f8c('0x52')]()[_0x7f8c('0x2b')](respondWithResult(_0x10e1ee,null))['catch'](handleError(_0x10e1ee,null));};function wrapUser(_0x148e6c){return function(_0x573572){var _0x3db44e=_0x148e6c[_0x7f8c('0x53')]({'plain':!![]});_0x3db44e['messages']=[];if(_0x573572){_0x3db44e['lastMessageAt']=_0x573572[_0x7f8c('0x54')];_0x3db44e[_0x7f8c('0x55')]=_0x573572;}else{_0x3db44e[_0x7f8c('0x56')]=moment(0x0)[_0x7f8c('0x57')](_0x7f8c('0x58'));_0x3db44e[_0x7f8c('0x55')]={};}return _0x3db44e;};}exports[_0x7f8c('0x59')]=function(_0x4c4283,_0xecd32e,_0x2b361f){var _0x5b6f49=[];return db[_0x7f8c('0x5a')][_0x7f8c('0x47')]({'where':{'role':[_0x7f8c('0x5b'),_0x7f8c('0x5c'),_0x7f8c('0x5d')]},'attributes':['id',_0x7f8c('0x5e'),_0x7f8c('0x2e'),_0x7f8c('0x5f'),_0x7f8c('0x60'),_0x7f8c('0x61'),_0x7f8c('0x62'),_0x7f8c('0x63'),_0x7f8c('0x64'),'showWebBar'],'order':qs[_0x7f8c('0x3f')](_0x7f8c('0x65')),'include':[{'model':db[_0x7f8c('0x66')],'as':_0x7f8c('0x67'),'attributes':['id',_0x7f8c('0x2e'),_0x7f8c('0x42')],'through':{'attributes':[]}}]})[_0x7f8c('0x2b')](function(_0x270e5a){if(_0x270e5a){var _0x4b947f=_0x4c4283[_0x7f8c('0x5d')][_0x7f8c('0x53')]({'plain':!![]});if(!_0x4b947f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b947f[_0x7f8c('0x5f')]===_0x7f8c('0x5d')){return db[_0x7f8c('0x68')][_0x7f8c('0x4e')]({'where':{'name':_0x7f8c('0x69'),'userProfileId':_0x4b947f[_0x7f8c('0x6a')]},'raw':!![]})[_0x7f8c('0x2b')](function(_0x2db09a){if(_0x2db09a){if(_0x2db09a['autoAssociation']===0x0){return db[_0x7f8c('0x6b')][_0x7f8c('0x47')]({'where':{'sectionId':_0x2db09a['id']},'raw':!![]})[_0x7f8c('0x2b')](function(_0x5a8257){var _0x33174c=[];if(_[_0x7f8c('0x6c')](_0x5a8257)){_0x33174c=_['filter'](_0x270e5a,function(_0x1e2ff1){if(_0x1e2ff1[_0x7f8c('0x5f')]!==_0x7f8c('0x5b')){return _0x1e2ff1;}});return _0x33174c;}else{for(var _0x277325=0x0;_0x277325<_0x270e5a[_0x7f8c('0x3b')];_0x277325++){var _0x1788f1=_0x270e5a[_0x277325];if(_0x1788f1[_0x7f8c('0x5f')]===_0x7f8c('0x5b')){var _0x2485a5=_['find'](_0x5a8257,function(_0x3d8c31){return _0x3d8c31[_0x7f8c('0x6d')]===_0x1788f1['id'];});if(_0x2485a5)_0x33174c[_0x7f8c('0x6e')](_0x1788f1);}else{_0x33174c['push'](_0x1788f1);}}return _0x33174c;}});}else{return _0x270e5a;}}else{var _0x10390d=_[_0x7f8c('0x44')](_0x270e5a,function(_0x3af0c9){if(_0x3af0c9[_0x7f8c('0x5f')]!=='agent'){return _0x3af0c9;}});return _0x10390d;}});}else{return _0x270e5a;}}})[_0x7f8c('0x2b')](function(_0x371961){var _0x11764f=[];if(_0x371961){_0x5b6f49=_0x371961;for(var _0x5bd721=0x0;_0x5bd721<_0x371961['length'];_0x5bd721+=0x1){_0x5b6f49[_0x5bd721][_0x7f8c('0x6f')]=[];_0x11764f[_0x7f8c('0x6e')](db[_0x7f8c('0x32')][_0x7f8c('0x4e')]({'where':{'FromId':[_0x4c4283[_0x7f8c('0x5d')]['id'],_0x371961[_0x5bd721]['id']],'ToId':[_0x4c4283[_0x7f8c('0x5d')]['id'],_0x371961[_0x5bd721]['id']],'ChatGroupId':null},'attributes':['id',_0x7f8c('0x54'),_0x7f8c('0x70'),_0x7f8c('0x71'),_0x7f8c('0x72'),_0x7f8c('0x50')],'order':qs[_0x7f8c('0x3f')](_0x7f8c('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7f8c('0x2b')](wrapUser(_0x371961[_0x5bd721])));}return BPromise[_0x7f8c('0x74')](_0x11764f);}return[];})['then'](function(_0x1adbba){return{'rows':_0x1adbba,'count':_0x1adbba[_0x7f8c('0x3b')]};})[_0x7f8c('0x2b')](respondWithResult(_0xecd32e,null))['catch'](handleError(_0xecd32e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a6deabf..95b60d7 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 _0x1ab1=['events','setMaxListeners','emit','hook','exports'];(function(_0x3a7f8b,_0x7fe06c){var _0x34f066=function(_0x38f2a7){while(--_0x38f2a7){_0x3a7f8b['push'](_0x3a7f8b['shift']());}};_0x34f066(++_0x7fe06c);}(_0x1ab1,0x12c));var _0x11ab=function(_0x34df85,_0x13ab3c){_0x34df85=_0x34df85-0x0;var _0x1163f7=_0x1ab1[_0x34df85];return _0x1163f7;};'use strict';var EventEmitter=require(_0x11ab('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x11ab('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28a19c){return function(_0x4a6492,_0x1fc2bd,_0x363103){ChatInternalMessageEvents[_0x11ab('0x2')](_0x28a19c+':'+_0x4a6492['id'],_0x4a6492);ChatInternalMessageEvents[_0x11ab('0x2')](_0x28a19c,_0x4a6492);_0x363103(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x11ab('0x3')](e,emitEvent(event));}}module[_0x11ab('0x4')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xd8dd=['events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x435d49,_0xe63b56){var _0x40a43d=function(_0x427d95){while(--_0x427d95){_0x435d49['push'](_0x435d49['shift']());}};_0x40a43d(++_0xe63b56);}(_0xd8dd,0x19e));var _0xdd8d=function(_0x4ade1e,_0x2fb1d8){_0x4ade1e=_0x4ade1e-0x0;var _0x47ee63=_0xd8dd[_0x4ade1e];return _0x47ee63;};'use strict';var EventEmitter=require(_0xdd8d('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xdd8d('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xdd8d('0x2')](0x0);var events={'afterCreate':_0xdd8d('0x3'),'afterUpdate':_0xdd8d('0x4'),'afterDestroy':_0xdd8d('0x5')};function emitEvent(_0x49a3aa){return function(_0x1bf239,_0x6df91c,_0x45c39b){ChatInternalMessageEvents['emit'](_0x49a3aa+':'+_0x1bf239['id'],_0x1bf239);ChatInternalMessageEvents[_0xdd8d('0x6')](_0x49a3aa,_0x1bf239);_0x45c39b(null);};}for(var e in events){if(events[_0xdd8d('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xdd8d('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 9dfe9ae..1787a6d 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 _0x7779=['utf8mb4','lodash','util','api','bluebird','request-promise','path','define'];(function(_0x1aa5c9,_0x3229d9){var _0x137bf7=function(_0x229bc2){while(--_0x229bc2){_0x1aa5c9['push'](_0x1aa5c9['shift']());}};_0x137bf7(++_0x3229d9);}(_0x7779,0x91));var _0x9777=function(_0x3284cd,_0x2e10a2){_0x3284cd=_0x3284cd-0x0;var _0xe92280=_0x7779[_0x3284cd];return _0xe92280;};'use strict';var _=require(_0x9777('0x0'));var util=require(_0x9777('0x1'));var logger=require('../../config/logger')(_0x9777('0x2'));var moment=require('moment');var BPromise=require(_0x9777('0x3'));var rp=require(_0x9777('0x4'));var fs=require('fs');var path=require(_0x9777('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x53e03e,_0x308a63){return _0x53e03e[_0x9777('0x6')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9777('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6ddb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0x6ddb,0x115));var _0xb6dd=function(_0x99bce3,_0x141c7d){_0x99bce3=_0x99bce3-0x0;var _0x32c32c=_0x6ddb[_0x99bce3];return _0x32c32c;};'use strict';var _=require('lodash');var util=require(_0xb6dd('0x0'));var logger=require(_0xb6dd('0x1'))(_0xb6dd('0x2'));var moment=require(_0xb6dd('0x3'));var BPromise=require(_0xb6dd('0x4'));var rp=require(_0xb6dd('0x5'));var fs=require('fs');var path=require(_0xb6dd('0x6'));var rimraf=require(_0xb6dd('0x7'));var config=require(_0xb6dd('0x8'));var attributes=require(_0xb6dd('0x9'));module[_0xb6dd('0xa')]=function(_0x50b6e8,_0x14e0e0){return _0x50b6e8[_0xb6dd('0xb')](_0xb6dd('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb6dd('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 01c5930..d40dd66 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 _0x1145=['util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x49a4b5,_0x420d0c){var _0x343547=function(_0xdd6b78){while(--_0xdd6b78){_0x49a4b5['push'](_0x49a4b5['shift']());}};_0x343547(++_0x420d0c);}(_0x1145,0xc7));var _0x5114=function(_0x2f7033,_0xb50c23){_0x2f7033=_0x2f7033-0x0;var _0x335046=_0x1145[_0x2f7033];return _0x335046;};'use strict';var _=require(_0x5114('0x0'));var util=require(_0x5114('0x1'));var moment=require(_0x5114('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5114('0x3'));var logger=require(_0x5114('0x4'))(_0x5114('0x5'));var config=require(_0x5114('0x6'));var jayson=require(_0x5114('0x7'));var client=jayson[_0x5114('0x8')][_0x5114('0x9')]({'port':0x232a});config[_0x5114('0xa')]=_[_0x5114('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5114('0xc'))(new Redis(config['redis']));require(_0x5114('0xd'))['register'](socket);function respondWithRpcPromise(_0x4f0807,_0x523a29,_0x5a6a6d){return new BPromise(function(_0x157767,_0xc22ee5){return client[_0x5114('0xe')](_0x4f0807,_0x5a6a6d)['then'](function(_0x1eca82){logger[_0x5114('0xf')](_0x5114('0x10'),_0x523a29,_0x5114('0x11'));logger[_0x5114('0x12')](_0x5114('0x13'),_0x523a29,_0x5114('0x11'),JSON[_0x5114('0x14')](_0x1eca82));if(_0x1eca82['error']){if(_0x1eca82[_0x5114('0x15')]['code']===0x1f4){logger[_0x5114('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x523a29,_0x1eca82['error'][_0x5114('0x16')]);return _0xc22ee5(_0x1eca82[_0x5114('0x15')][_0x5114('0x16')]);}logger['error'](_0x5114('0x10'),_0x523a29,_0x1eca82[_0x5114('0x15')]['message']);return _0x157767(_0x1eca82[_0x5114('0x15')][_0x5114('0x16')]);}else{logger[_0x5114('0xf')](_0x5114('0x10'),_0x523a29,_0x5114('0x11'));_0x157767(_0x1eca82[_0x5114('0x17')][_0x5114('0x16')]);}})[_0x5114('0x18')](function(_0x3d3893){logger['error'](_0x5114('0x10'),_0x523a29,_0x3d3893);_0xc22ee5(_0x3d3893);});});} \ No newline at end of file +var _0x6752=['stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6752,0x96));var _0x2675=function(_0x33f00e,_0x4fab3c){_0x33f00e=_0x33f00e-0x0;var _0x1c6586=_0x6752[_0x33f00e];return _0x1c6586;};'use strict';var _=require(_0x2675('0x0'));var util=require(_0x2675('0x1'));var moment=require(_0x2675('0x2'));var BPromise=require(_0x2675('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2675('0x4'));var db=require(_0x2675('0x5'))['db'];var utils=require(_0x2675('0x6'));var logger=require(_0x2675('0x7'))(_0x2675('0x8'));var config=require(_0x2675('0x9'));var jayson=require(_0x2675('0xa'));var client=jayson[_0x2675('0xb')][_0x2675('0xc')]({'port':0x232a});config['redis']=_[_0x2675('0xd')](config[_0x2675('0xe')],{'host':_0x2675('0xf'),'port':0x18eb});var socket=require(_0x2675('0x10'))(new Redis(config[_0x2675('0xe')]));require('./chatInternalMessage.socket')[_0x2675('0x11')](socket);function respondWithRpcPromise(_0x28f988,_0x474630,_0x1adac0){return new BPromise(function(_0x1aa61c,_0x438df7){return client[_0x2675('0x12')](_0x28f988,_0x1adac0)['then'](function(_0x3689d3){logger[_0x2675('0x13')](_0x2675('0x14'),_0x474630,_0x2675('0x15'));logger[_0x2675('0x16')](_0x2675('0x17'),_0x474630,_0x2675('0x15'),JSON[_0x2675('0x18')](_0x3689d3));if(_0x3689d3[_0x2675('0x19')]){if(_0x3689d3['error'][_0x2675('0x1a')]===0x1f4){logger[_0x2675('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x474630,_0x3689d3[_0x2675('0x19')]['message']);return _0x438df7(_0x3689d3[_0x2675('0x19')]['message']);}logger[_0x2675('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x474630,_0x3689d3[_0x2675('0x19')][_0x2675('0x1b')]);return _0x1aa61c(_0x3689d3[_0x2675('0x19')][_0x2675('0x1b')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x474630,_0x2675('0x15'));_0x1aa61c(_0x3689d3['result'][_0x2675('0x1b')]);}})[_0x2675('0x1c')](function(_0x31b61d){logger['error'](_0x2675('0x14'),_0x474630,_0x31b61d);_0x438df7(_0x31b61d);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 01a208e..3d3b9c8 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 _0x8800=['emit','register','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x1fd59f,_0x369cbb){var _0x4c095e=function(_0x20d040){while(--_0x20d040){_0x1fd59f['push'](_0x1fd59f['shift']());}};_0x4c095e(++_0x369cbb);}(_0x8800,0x171));var _0x0880=function(_0x5cc33b,_0x18c11e){_0x5cc33b=_0x5cc33b-0x0;var _0x55400c=_0x8800[_0x5cc33b];return _0x55400c;};'use strict';var ChatInternalMessageEvents=require(_0x0880('0x0'));var events=[_0x0880('0x1'),_0x0880('0x2'),'update'];function createListener(_0x51fa64,_0x4f1267){return function(_0x4c8f81){_0x4f1267[_0x0880('0x3')](_0x51fa64,_0x4c8f81);};}function removeListener(_0x14c0dd,_0x1a9ed7){return function(){ChatInternalMessageEvents['removeListener'](_0x14c0dd,_0x1a9ed7);};}exports[_0x0880('0x4')]=function(_0x2183c8){for(var _0x17bebd=0x0,_0x4c478c=events['length'];_0x17bebd<_0x4c478c;_0x17bebd++){var _0x193459=events[_0x17bebd];var _0x39c19=createListener(_0x0880('0x5')+_0x193459,_0x2183c8);ChatInternalMessageEvents['on'](_0x193459,_0x39c19);}}; \ No newline at end of file +var _0xf91b=['save','remove','update','emit','removeListener','register','length','./chatInternalMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf91b,0x177));var _0xbf91=function(_0x3b7321,_0x3d7e90){_0x3b7321=_0x3b7321-0x0;var _0x4763c7=_0xf91b[_0x3b7321];return _0x4763c7;};'use strict';var ChatInternalMessageEvents=require(_0xbf91('0x0'));var events=[_0xbf91('0x1'),_0xbf91('0x2'),_0xbf91('0x3')];function createListener(_0x2abc4d,_0xbdb344){return function(_0x18c735){_0xbdb344[_0xbf91('0x4')](_0x2abc4d,_0x18c735);};}function removeListener(_0x5ba62c,_0x37f995){return function(){ChatInternalMessageEvents[_0xbf91('0x5')](_0x5ba62c,_0x37f995);};}exports[_0xbf91('0x6')]=function(_0x29a764){for(var _0x52a528=0x0,_0x50e3dc=events[_0xbf91('0x7')];_0x52a528<_0x50e3dc;_0x52a528++){var _0x1273e4=events[_0x52a528];var _0x1f8dea=createListener('chatInternalMessage:'+_0x1273e4,_0x29a764);ChatInternalMessageEvents['on'](_0x1273e4,_0x1f8dea);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 432c245..15d0965 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 _0xffcc=['create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','getUsers','show','post'];(function(_0x153bfd,_0x468e54){var _0x2da318=function(_0x2a0b42){while(--_0x2a0b42){_0x153bfd['push'](_0x153bfd['shift']());}};_0x2da318(++_0x468e54);}(_0xffcc,0x90));var _0xcffc=function(_0x2a3bb6,_0x378638){_0x2a3bb6=_0x2a3bb6-0x0;var _0x2c3e03=_0xffcc[_0x2a3bb6];return _0x2c3e03;};'use strict';var multer=require(_0xcffc('0x0'));var util=require(_0xcffc('0x1'));var path=require(_0xcffc('0x2'));var timeout=require(_0xcffc('0x3'));var express=require('express');var router=express[_0xcffc('0x4')]();var fs_extra=require(_0xcffc('0x5'));var auth=require(_0xcffc('0x6'));var interaction=require(_0xcffc('0x7'));var config=require(_0xcffc('0x8'));var controller=require(_0xcffc('0x9'));router[_0xcffc('0xa')]('/',auth[_0xcffc('0xb')](),controller[_0xcffc('0xc')]);router['get'](_0xcffc('0xd'),auth[_0xcffc('0xb')](),controller['describe']);router['get']('/users',auth[_0xcffc('0xb')](),controller[_0xcffc('0xe')]);router[_0xcffc('0xa')]('/:id',auth[_0xcffc('0xb')](),controller[_0xcffc('0xf')]);router[_0xcffc('0x10')]('/',auth['isAuthenticated'](),controller[_0xcffc('0x11')]);router[_0xcffc('0x12')](_0xcffc('0x13'),controller['update']);router[_0xcffc('0x14')](_0xcffc('0x13'),auth[_0xcffc('0xb')](),controller[_0xcffc('0x15')]);module[_0xcffc('0x16')]=router; \ No newline at end of file +var _0x1531=['fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','getUsers','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0x1531,0x176));var _0x1153=function(_0x2e300c,_0x532be3){_0x2e300c=_0x2e300c-0x0;var _0x57d4a7=_0x1531[_0x2e300c];return _0x57d4a7;};'use strict';var multer=require(_0x1153('0x0'));var util=require(_0x1153('0x1'));var path=require(_0x1153('0x2'));var timeout=require(_0x1153('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1153('0x4'));var auth=require(_0x1153('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1153('0x6'));router[_0x1153('0x7')]('/',auth[_0x1153('0x8')](),controller['index']);router['get'](_0x1153('0x9'),auth[_0x1153('0x8')](),controller['describe']);router['get'](_0x1153('0xa'),auth[_0x1153('0x8')](),controller[_0x1153('0xb')]);router['get'](_0x1153('0xc'),auth[_0x1153('0x8')](),controller['show']);router[_0x1153('0xd')]('/',auth[_0x1153('0x8')](),controller[_0x1153('0xe')]);router[_0x1153('0xf')](_0x1153('0xc'),controller['update']);router['delete'](_0x1153('0xc'),auth[_0x1153('0x8')](),controller[_0x1153('0x10')]);module[_0x1153('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index bdaed8d..4849a8d 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 _0x6000=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6000,0x17c));var _0x0600=function(_0x5e3978,_0x3caf78){_0x5e3978=_0x5e3978-0x0;var _0x4edbd6=_0x6000[_0x5e3978];return _0x4edbd6;};'use strict';var Sequelize=require(_0x0600('0x0'));module[_0x0600('0x1')]={'body':{'type':Sequelize[_0x0600('0x2')](_0x0600('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x0600('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0600('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x0600('0x5')),'defaultValue':_0x0600('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x0600('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x693f=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4dbf43,_0x8de9ad){var _0x513ccf=function(_0x409816){while(--_0x409816){_0x4dbf43['push'](_0x4dbf43['shift']());}};_0x513ccf(++_0x8de9ad);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf693('0x0'));module[_0xf693('0x1')]={'body':{'type':Sequelize[_0xf693('0x2')](_0xf693('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xf693('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf693('0x5')]('in',_0xf693('0x6')),'defaultValue':_0xf693('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf693('0x7')]},'providerName':{'type':Sequelize[_0xf693('0x8')]},'providerResponse':{'type':Sequelize[_0xf693('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 09dbfd7..48981c9 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 _0x3370=['event','EventManager','acceptmessage','parse','interaction','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','reject','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/license/util','../../mysqldb','defaults','localhost','redis','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','name','map','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','merge','options','find','create','body','params','describe','../../config/logger','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel'];(function(_0x27ce17,_0x6a72){var _0x5a966c=function(_0x4d5bbd){while(--_0x4d5bbd){_0x27ce17['push'](_0x27ce17['shift']());}};_0x5a966c(++_0x6a72);}(_0x3370,0x191));var _0x0337=function(_0x1e9dd4,_0xc065f4){_0x1e9dd4=_0x1e9dd4-0x0;var _0x25dc42=_0x3370[_0x1e9dd4];return _0x25dc42;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0337('0x0'));var jsonpatch=require(_0x0337('0x1'));var rp=require(_0x0337('0x2'));var moment=require(_0x0337('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0337('0x4'));var path=require(_0x0337('0x5'));var sox=require(_0x0337('0x6'));var csv=require(_0x0337('0x7'));var ejs=require(_0x0337('0x8'));var fs=require('fs');var fs_extra=require(_0x0337('0x9'));var _=require(_0x0337('0xa'));var squel=require(_0x0337('0xb'));var crypto=require(_0x0337('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0337('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0337('0xe'));var Redis=require(_0x0337('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0337('0x10'));var logger=require('../../config/logger')(_0x0337('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0337('0x12'));var db=require(_0x0337('0x13'))['db'];config['redis']=_[_0x0337('0x14')](config['redis'],{'host':_0x0337('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0337('0x16')]));require(_0x0337('0x17'))[_0x0337('0x18')](socket);var jayson=require(_0x0337('0x19'));var client=jayson[_0x0337('0x1a')][_0x0337('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1211fc,_0xe7cb5b,_0x10ea66,_0x5ad0af){return new BPromise(function(_0x31e5c3,_0x34207e){var _0x1630ed=_0x5ad0af||client;return _0x1630ed[_0x0337('0x1c')](_0x1211fc,_0x10ea66)[_0x0337('0x1d')](function(_0x18e275){logger[_0x0337('0x1e')](_0x0337('0x1f'),_0xe7cb5b,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0xe7cb5b,_0x0337('0x20'),JSON[_0x0337('0x21')](_0x18e275));if(_0x18e275[_0x0337('0x22')]){if(_0x18e275[_0x0337('0x22')][_0x0337('0x23')]===0x1f4){logger['error'](_0x0337('0x1f'),_0xe7cb5b,_0x18e275[_0x0337('0x22')][_0x0337('0x24')]);return _0x34207e(_0x18e275[_0x0337('0x22')][_0x0337('0x24')]);}logger['error'](_0x0337('0x1f'),_0xe7cb5b,_0x18e275['error'][_0x0337('0x24')]);return _0x31e5c3(_0x18e275['error'][_0x0337('0x24')]);}else{logger['info'](_0x0337('0x1f'),_0xe7cb5b,'request\x20sent');_0x31e5c3(_0x18e275[_0x0337('0x25')][_0x0337('0x24')]);}})[_0x0337('0x26')](function(_0x5ec35c){logger[_0x0337('0x22')](_0x0337('0x1f'),_0xe7cb5b,_0x5ec35c);_0x34207e(_0x5ec35c);});});}function respondWithStatusCode(_0x360762,_0xac9d88){_0xac9d88=_0xac9d88||0xcc;return function(_0x2c7dd5){if(_0x2c7dd5){return _0x360762[_0x0337('0x27')](_0xac9d88);}return _0x360762[_0x0337('0x28')](_0xac9d88)[_0x0337('0x29')]();};}function respondWithResult(_0x1d00f0,_0x267389){_0x267389=_0x267389||0xc8;return function(_0x5d965e){if(_0x5d965e){return _0x1d00f0[_0x0337('0x28')](_0x267389)[_0x0337('0x2a')](_0x5d965e);}};}function respondWithFilteredResult(_0x343e6f,_0x4a5055){return function(_0x57da08){if(_0x57da08){var _0x35bf8c=typeof _0x4a5055['offset']===_0x0337('0x2b')&&typeof _0x4a5055['limit']==='undefined';var _0x5cf15c=_0x57da08[_0x0337('0x2c')];var _0x838211=_0x35bf8c?0x0:_0x4a5055[_0x0337('0x2d')];var _0x1fa3df=_0x35bf8c?_0x57da08[_0x0337('0x2c')]:_0x4a5055[_0x0337('0x2d')]+_0x4a5055[_0x0337('0x2e')];var _0x390055;if(_0x1fa3df>=_0x5cf15c){_0x1fa3df=_0x5cf15c;_0x390055=0xc8;}else{_0x390055=0xce;}_0x343e6f[_0x0337('0x28')](_0x390055);return _0x343e6f['set'](_0x0337('0x2f'),_0x838211+'-'+_0x1fa3df+'/'+_0x5cf15c)[_0x0337('0x2a')](_0x57da08);}return null;};}function patchUpdates(_0x25adf4){return function(_0x4932f9){try{jsonpatch[_0x0337('0x30')](_0x4932f9,_0x25adf4,!![]);}catch(_0x1d5794){return BPromise['reject'](_0x1d5794);}return _0x4932f9[_0x0337('0x31')]();};}function saveUpdates(_0x4997a5,_0x221b46){return function(_0x2411d1){if(_0x2411d1){return _0x2411d1[_0x0337('0x32')](_0x4997a5)[_0x0337('0x1d')](function(_0x47fca9){return _0x47fca9;});}return null;};}function removeEntity(_0x582548,_0x5d79b4){return function(_0x25cc02){if(_0x25cc02){return _0x25cc02['destroy']()['then'](function(){_0x582548[_0x0337('0x28')](0xcc)[_0x0337('0x29')]();});}};}function handleEntityNotFound(_0x12a9ad,_0x17e962){return function(_0x2cca14){if(!_0x2cca14){_0x12a9ad[_0x0337('0x27')](0x194);}return _0x2cca14;};}function handleError(_0x370513,_0x3c5d2c){_0x3c5d2c=_0x3c5d2c||0x1f4;return function(_0x351bd1){logger[_0x0337('0x22')](_0x351bd1['stack']);if(_0x351bd1[_0x0337('0x33')]){delete _0x351bd1[_0x0337('0x33')];}_0x370513['status'](_0x3c5d2c)['send'](_0x351bd1);};}exports['index']=function(_0x13c277,_0x2da7e2){var _0x477c35={},_0x25a05e={},_0x91c619={'count':0x0,'rows':[]};var _0x536846=_[_0x0337('0x34')](db[_0x0337('0x35')][_0x0337('0x36')],function(_0x30ccd6){return{'name':_0x30ccd6[_0x0337('0x37')],'type':_0x30ccd6[_0x0337('0x38')][_0x0337('0x39')]};});_0x25a05e['model']=_[_0x0337('0x34')](_0x536846,'name');_0x25a05e[_0x0337('0x3a')]=_[_0x0337('0x3b')](_0x13c277[_0x0337('0x3a')]);_0x25a05e[_0x0337('0x3c')]=_[_0x0337('0x3d')](_0x25a05e[_0x0337('0x3e')],_0x25a05e['query']);_0x477c35['attributes']=_[_0x0337('0x3d')](_0x25a05e[_0x0337('0x3e')],qs[_0x0337('0x3f')](_0x13c277[_0x0337('0x3a')]['fields']));_0x477c35[_0x0337('0x40')]=_0x477c35['attributes'][_0x0337('0x41')]?_0x477c35[_0x0337('0x40')]:_0x25a05e[_0x0337('0x3e')];if(!_0x13c277[_0x0337('0x3a')][_0x0337('0x42')](_0x0337('0x43'))){_0x477c35['limit']=qs[_0x0337('0x2e')](_0x13c277[_0x0337('0x3a')][_0x0337('0x2e')]);_0x477c35[_0x0337('0x2d')]=qs[_0x0337('0x2d')](_0x13c277['query'][_0x0337('0x2d')]);}_0x477c35[_0x0337('0x44')]=qs[_0x0337('0x45')](_0x13c277['query'][_0x0337('0x45')]);_0x477c35[_0x0337('0x46')]=qs[_0x0337('0x3c')](_[_0x0337('0x47')](_0x13c277['query'],_0x25a05e[_0x0337('0x3c')]),_0x536846);if(_0x13c277['query'][_0x0337('0x48')]){_0x477c35['where']=_['merge'](_0x477c35[_0x0337('0x46')],{'$or':_[_0x0337('0x34')](_0x536846,function(_0x2100ed){if(_0x2100ed['type']!==_0x0337('0x49')){var _0x211cc1={};_0x211cc1[_0x2100ed[_0x0337('0x33')]]={'$like':'%'+_0x13c277[_0x0337('0x3a')][_0x0337('0x48')]+'%'};return _0x211cc1;}})});}_0x477c35=_['merge']({},_0x477c35,_0x13c277['options']);var _0x24a431={'where':_0x477c35[_0x0337('0x46')]};return db['ChatMessage']['count'](_0x24a431)[_0x0337('0x1d')](function(_0x5ccb4a){_0x91c619['count']=_0x5ccb4a;if(_0x13c277[_0x0337('0x3a')][_0x0337('0x4a')]){_0x477c35[_0x0337('0x4b')]=[{'all':!![]}];}return db[_0x0337('0x35')][_0x0337('0x4c')](_0x477c35);})[_0x0337('0x1d')](function(_0xbbc101){_0x91c619[_0x0337('0x4d')]=_0xbbc101;return _0x91c619;})[_0x0337('0x1d')](respondWithFilteredResult(_0x2da7e2,_0x477c35))[_0x0337('0x26')](handleError(_0x2da7e2,null));};exports[_0x0337('0x4e')]=function(_0x55a081,_0x59aa81){var _0x5598e1={'raw':!![],'where':{'id':_0x55a081['params']['id']}},_0x19d4d5={};_0x19d4d5[_0x0337('0x3e')]=_[_0x0337('0x3b')](db[_0x0337('0x35')][_0x0337('0x36')]);_0x19d4d5[_0x0337('0x3a')]=_[_0x0337('0x3b')](_0x55a081[_0x0337('0x3a')]);_0x19d4d5['filters']=_[_0x0337('0x3d')](_0x19d4d5['model'],_0x19d4d5['query']);_0x5598e1[_0x0337('0x40')]=_[_0x0337('0x3d')](_0x19d4d5[_0x0337('0x3e')],qs[_0x0337('0x3f')](_0x55a081['query'][_0x0337('0x3f')]));_0x5598e1[_0x0337('0x40')]=_0x5598e1['attributes'][_0x0337('0x41')]?_0x5598e1[_0x0337('0x40')]:_0x19d4d5[_0x0337('0x3e')];if(_0x55a081[_0x0337('0x3a')][_0x0337('0x4a')]){_0x5598e1[_0x0337('0x4b')]=[{'all':!![]}];}_0x5598e1=_[_0x0337('0x4f')]({},_0x5598e1,_0x55a081[_0x0337('0x50')]);return db[_0x0337('0x35')][_0x0337('0x51')](_0x5598e1)[_0x0337('0x1d')](handleEntityNotFound(_0x59aa81,null))[_0x0337('0x1d')](respondWithResult(_0x59aa81,null))[_0x0337('0x26')](handleError(_0x59aa81,null));};exports[_0x0337('0x52')]=function(_0x30fcee,_0x55418a){return db['ChatMessage'][_0x0337('0x52')](_0x30fcee[_0x0337('0x53')],{})[_0x0337('0x1d')](respondWithResult(_0x55418a,0xc9))[_0x0337('0x26')](handleError(_0x55418a,null));};exports[_0x0337('0x32')]=function(_0x5495f8,_0x445575){if(_0x5495f8[_0x0337('0x53')]['id']){delete _0x5495f8[_0x0337('0x53')]['id'];}return db[_0x0337('0x35')][_0x0337('0x51')]({'where':{'id':_0x5495f8[_0x0337('0x54')]['id']}})[_0x0337('0x1d')](handleEntityNotFound(_0x445575,null))[_0x0337('0x1d')](saveUpdates(_0x5495f8[_0x0337('0x53')],null))['then'](respondWithResult(_0x445575,null))[_0x0337('0x26')](handleError(_0x445575,null));};exports['destroy']=function(_0x36f439,_0x50953a){return db[_0x0337('0x35')][_0x0337('0x51')]({'where':{'id':_0x36f439[_0x0337('0x54')]['id']}})['then'](handleEntityNotFound(_0x50953a,null))[_0x0337('0x1d')](removeEntity(_0x50953a,null))['catch'](handleError(_0x50953a,null));};exports[_0x0337('0x55')]=function(_0x5b8092,_0x3ad47e){return db[_0x0337('0x35')][_0x0337('0x55')]()[_0x0337('0x1d')](respondWithResult(_0x3ad47e,null))[_0x0337('0x26')](handleError(_0x3ad47e,null));};var interaction_log=require(_0x0337('0x56'))(_0x0337('0x57'));exports['accept']=function(_0x420a61,_0x133959,_0x55c8c1){var _0x54e2da={'agent':{},'channel':_0x0337('0x58')};if(_0x420a61['body']['id']){delete _0x420a61[_0x0337('0x53')]['id'];}_0x420a61['body'][_0x0337('0x59')]=!![];_0x420a61[_0x0337('0x53')][_0x0337('0x5a')]=moment()[_0x0337('0x5b')](_0x0337('0x5c'));_0x420a61[_0x0337('0x53')][_0x0337('0x5d')]=_0x420a61[_0x0337('0x53')]['UserId']||_0x420a61['user']['id'];_0x54e2da[_0x0337('0x5e')]['id']=_0x420a61[_0x0337('0x53')][_0x0337('0x5d')];return db[_0x0337('0x35')]['find']({'where':{'id':_0x420a61[_0x0337('0x54')]['id'],'UserId':null}})[_0x0337('0x1d')](handleEntityNotFound(_0x133959,null))[_0x0337('0x1d')](saveUpdates(_0x420a61[_0x0337('0x53')],null))[_0x0337('0x1d')](function(_0x826207){if(_0x826207){_0x54e2da[_0x0337('0x24')]=_0x826207[_0x0337('0x5f')]({'plain':!![]});return db['ChatInteraction'][_0x0337('0x51')]({'where':{'id':_0x826207[_0x0337('0x60')]}});}return null;})[_0x0337('0x1d')](handleEntityNotFound(_0x133959,null))[_0x0337('0x1d')](function(_0x1abc4a){if(_0x1abc4a){return _0x1abc4a[_0x0337('0x32')]({'UserId':_0x420a61['body'][_0x0337('0x5d')],'read1stAt':_[_0x0337('0x61')](_0x1abc4a[_0x0337('0x62')])?moment()[_0x0337('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0337('0x1d')](function(_0x5659f3){if(_0x5659f3){_0x54e2da['interaction']=_0x5659f3[_0x0337('0x5f')]({'plain':!![]});interaction_log[_0x0337('0x1e')](_0x0337('0x63'),_0x420a61['user']['id'],_0x420a61[_0x0337('0x64')]['name'],_0x420a61['user'][_0x0337('0x65')],_0x54e2da['interaction']['id'],_0x420a61[_0x0337('0x53')]?JSON[_0x0337('0x21')](_0x420a61['body']):_0x0337('0x66'));return respondWithRpcPromise(_0x0337('0x67'),_0x0337('0x68'),_0x54e2da);}return null;})[_0x0337('0x1d')](function(_0x4a85e9){var _0x2b2984=_0x0337('0x69')+_0x4a85e9[_0x0337('0x24')][_0x0337('0x6a')];return db[_0x0337('0x6b')][_0x0337('0x3a')](_0x2b2984,{'type':db[_0x0337('0x6c')][_0x0337('0x6d')]['SELECT'],'raw':!![]})[_0x0337('0x1d')](function(_0xd5ab0a){return _0xd5ab0a;});})[_0x0337('0x1d')](function(_0x18de33){if(_0x18de33){_0x54e2da[_0x0337('0x24')][_0x0337('0x6e')]=_0x18de33[0x0];if(!_0x420a61[_0x0337('0x53')][_0x0337('0x5d')])return;return db[_0x0337('0x6f')][_0x0337('0x51')]({'where':{'id':_0x420a61[_0x0337('0x53')][_0x0337('0x5d')],'role':_0x0337('0x5e')},'attributes':['id',_0x0337('0x33'),_0x0337('0x70'),_0x0337('0x71'),_0x0337('0x72')],'raw':!![]});}return null;})[_0x0337('0x1d')](function(_0x3ca92f){if(!_0x3ca92f)return null;_0x54e2da['message']['agent']=_0x3ca92f;return _0x54e2da;})[_0x0337('0x1d')](function(_0x37328b){if(_0x37328b){if(_0x420a61[_0x0337('0x53')][_0x0337('0x73')]){_0x54e2da[_0x0337('0x24')][_0x0337('0x74')]=util[_0x0337('0x5b')]('SIP/%s',_0x420a61['user']['name']);_0x54e2da[_0x0337('0x24')][_0x0337('0x75')]=_0x54e2da['channel'];_0x54e2da[_0x0337('0x24')][_0x0337('0x76')]=_0x54e2da[_0x0337('0x75')];_0x54e2da['message'][_0x0337('0x77')]='accept';return respondWithRpcPromise(_0x0337('0x78'),_0x0337('0x78'),{'event':_0x0337('0x79'),'message':_[_0x0337('0x4f')](_0x54e2da[_0x0337('0x24')],JSON[_0x0337('0x7a')](_0x54e2da[_0x0337('0x7b')][_0x0337('0x7c')]))},client9002)[_0x0337('0x1d')](function(){return _0x54e2da;});}return _0x54e2da;}return null;})[_0x0337('0x1d')](respondWithResult(_0x133959,null))['catch'](handleError(_0x133959,null));};var interaction_log=require(_0x0337('0x56'))(_0x0337('0x57'));exports['reject']=function(_0x3e51ab,_0x5f09d7,_0x360453){var _0x2bc220={'agent':{},'channel':_0x0337('0x58')};if(_0x3e51ab[_0x0337('0x53')]['id']){delete _0x3e51ab[_0x0337('0x53')]['id'];}_0x3e51ab[_0x0337('0x53')][_0x0337('0x5d')]=_0x3e51ab[_0x0337('0x53')][_0x0337('0x5d')]||_0x3e51ab[_0x0337('0x64')]['id'];_0x2bc220[_0x0337('0x5e')]['id']=_0x3e51ab[_0x0337('0x53')]['UserId'];return db[_0x0337('0x35')][_0x0337('0x51')]({'where':{'id':_0x3e51ab[_0x0337('0x54')]['id'],'UserId':null}})[_0x0337('0x1d')](handleEntityNotFound(_0x5f09d7,null))[_0x0337('0x1d')](function(_0x5c7aa3){if(_0x5c7aa3){_0x2bc220['message']=_0x5c7aa3['get']({'plain':!![]});return db[_0x0337('0x7d')][_0x0337('0x51')]({'where':{'id':_0x5c7aa3['ChatInteractionId']}});}return null;})[_0x0337('0x1d')](handleEntityNotFound(_0x5f09d7,null))[_0x0337('0x1d')](function(_0x206cb9){if(_0x206cb9){_0x2bc220[_0x0337('0x7b')]=_0x206cb9['get']({'plain':!![]});interaction_log['info'](_0x0337('0x7e'),_0x3e51ab[_0x0337('0x64')]['id'],_0x3e51ab['user'][_0x0337('0x33')],_0x3e51ab['user'][_0x0337('0x65')],_0x2bc220['interaction']['id'],_0x3e51ab['body']?JSON[_0x0337('0x21')](_0x3e51ab['body']):_0x0337('0x66'));return respondWithRpcPromise(_0x0337('0x7f'),_0x0337('0x80'),_0x2bc220);}return null;})['then'](function(_0x3d77c8){var _0xd287b8=_0x0337('0x69')+_0x3d77c8[_0x0337('0x24')]['ContactId'];return db['sequelize']['query'](_0xd287b8,{'type':db[_0x0337('0x6c')][_0x0337('0x6d')]['SELECT'],'raw':!![]})[_0x0337('0x1d')](function(_0x1f72d7){return _0x1f72d7;});})['then'](function(_0x4ae0c8){if(_0x4ae0c8){_0x2bc220[_0x0337('0x24')][_0x0337('0x6e')]=_0x4ae0c8[0x0];if(!_0x3e51ab[_0x0337('0x53')]['UserId'])return;return db[_0x0337('0x6f')][_0x0337('0x51')]({'where':{'id':_0x3e51ab['body'][_0x0337('0x5d')],'role':'agent'},'attributes':['id','name','fullname',_0x0337('0x71'),_0x0337('0x72')],'raw':!![]});}return null;})[_0x0337('0x1d')](function(_0xcda408){if(!_0xcda408)return null;_0x2bc220[_0x0337('0x24')][_0x0337('0x5e')]=_0xcda408;return _0x2bc220;})[_0x0337('0x1d')](function(_0x58dc01){if(_0x58dc01){_0x58dc01[_0x0337('0x24')]['interface']=util[_0x0337('0x5b')]('SIP/%s',_0x3e51ab['user']['name']);_0x58dc01[_0x0337('0x24')]['channel']=_0x2bc220[_0x0337('0x75')];_0x58dc01['message']['motionChannel']=_0x2bc220[_0x0337('0x75')];_0x58dc01[_0x0337('0x24')][_0x0337('0x77')]=_0x0337('0x81');respondWithRpcPromise(_0x0337('0x78'),_0x0337('0x78'),{'event':'rejectmessage','message':_[_0x0337('0x4f')](_0x2bc220[_0x0337('0x24')],JSON[_0x0337('0x7a')](_0x2bc220[_0x0337('0x7b')][_0x0337('0x7c')]))},client9002);return _0x2bc220;}return null;})[_0x0337('0x1d')](respondWithResult(_0x5f09d7,null))[_0x0337('0x26')](handleError(_0x5f09d7,null));}; \ No newline at end of file +var _0x2589=['keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','ChatMessage','includeAll','findAll','rows','show','params','filters','include','find','create','body','update','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','isNil','interaction','get','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','manual','interface','channel','motionChannel','event','acceptmessage','../../config/logger','reject','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','User','fullname','email','internal','SIP/%s','EventManager','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','save','destroy','end','stack','send','index','map','rawAttributes','type','key','model','name'];(function(_0x249969,_0x4bcf6d){var _0x4b4a61=function(_0x393fbe){while(--_0x393fbe){_0x249969['push'](_0x249969['shift']());}};_0x4b4a61(++_0x4bcf6d);}(_0x2589,0xc7));var _0x9258=function(_0x1a047b,_0x1e6901){_0x1a047b=_0x1a047b-0x0;var _0xf10d2b=_0x2589[_0x1a047b];return _0xf10d2b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9258('0x0'));var zipdir=require(_0x9258('0x1'));var jsonpatch=require(_0x9258('0x2'));var rp=require(_0x9258('0x3'));var moment=require(_0x9258('0x4'));var BPromise=require(_0x9258('0x5'));var Mustache=require(_0x9258('0x6'));var util=require('util');var path=require(_0x9258('0x7'));var sox=require(_0x9258('0x8'));var csv=require(_0x9258('0x9'));var ejs=require(_0x9258('0xa'));var fs=require('fs');var fs_extra=require(_0x9258('0xb'));var _=require(_0x9258('0xc'));var squel=require(_0x9258('0xd'));var crypto=require('crypto');var jsforce=require(_0x9258('0xe'));var deskjs=require(_0x9258('0xf'));var toCsv=require(_0x9258('0x9'));var querystring=require('querystring');var Papa=require(_0x9258('0x10'));var Redis=require('ioredis');var authService=require(_0x9258('0x11'));var qs=require(_0x9258('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9258('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9258('0x14'));var config=require(_0x9258('0x15'));var licenseUtil=require(_0x9258('0x16'));var db=require(_0x9258('0x17'))['db'];config[_0x9258('0x18')]=_[_0x9258('0x19')](config[_0x9258('0x18')],{'host':_0x9258('0x1a'),'port':0x18eb});var socket=require(_0x9258('0x1b'))(new Redis(config[_0x9258('0x18')]));require(_0x9258('0x1c'))[_0x9258('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9258('0x1e')][_0x9258('0x1f')]({'port':0x232c});var client9002=jayson[_0x9258('0x1e')][_0x9258('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2c24c9,_0xdfa117,_0x5525eb,_0x24b901){return new BPromise(function(_0x50203d,_0x301837){var _0x25e2c9=_0x24b901||client;return _0x25e2c9['request'](_0x2c24c9,_0x5525eb)[_0x9258('0x20')](function(_0x142613){logger[_0x9258('0x21')](_0x9258('0x22'),_0xdfa117,'request\x20sent');logger[_0x9258('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0xdfa117,_0x9258('0x24'),JSON['stringify'](_0x142613));if(_0x142613[_0x9258('0x25')]){if(_0x142613[_0x9258('0x25')][_0x9258('0x26')]===0x1f4){logger['error'](_0x9258('0x22'),_0xdfa117,_0x142613[_0x9258('0x25')][_0x9258('0x27')]);return _0x301837(_0x142613[_0x9258('0x25')][_0x9258('0x27')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0xdfa117,_0x142613[_0x9258('0x25')][_0x9258('0x27')]);return _0x50203d(_0x142613['error'][_0x9258('0x27')]);}else{logger[_0x9258('0x21')](_0x9258('0x22'),_0xdfa117,_0x9258('0x24'));_0x50203d(_0x142613[_0x9258('0x28')][_0x9258('0x27')]);}})[_0x9258('0x29')](function(_0x247f9f){logger[_0x9258('0x25')](_0x9258('0x22'),_0xdfa117,_0x247f9f);_0x301837(_0x247f9f);});});}function respondWithStatusCode(_0x56c4b0,_0x2f92b2){_0x2f92b2=_0x2f92b2||0xcc;return function(_0x67de19){if(_0x67de19){return _0x56c4b0[_0x9258('0x2a')](_0x2f92b2);}return _0x56c4b0['status'](_0x2f92b2)['end']();};}function respondWithResult(_0x691fe2,_0x11abab){_0x11abab=_0x11abab||0xc8;return function(_0x4c98d9){if(_0x4c98d9){return _0x691fe2[_0x9258('0x2b')](_0x11abab)['json'](_0x4c98d9);}};}function respondWithFilteredResult(_0x3259f1,_0xb847ca){return function(_0x3d8cfd){if(_0x3d8cfd){var _0x4b5115=typeof _0xb847ca[_0x9258('0x2c')]==='undefined'&&typeof _0xb847ca['limit']===_0x9258('0x2d');var _0x2cb4bb=_0x3d8cfd[_0x9258('0x2e')];var _0x4b88c1=_0x4b5115?0x0:_0xb847ca[_0x9258('0x2c')];var _0x331a36=_0x4b5115?_0x3d8cfd[_0x9258('0x2e')]:_0xb847ca['offset']+_0xb847ca[_0x9258('0x2f')];var _0x1b8b79;if(_0x331a36>=_0x2cb4bb){_0x331a36=_0x2cb4bb;_0x1b8b79=0xc8;}else{_0x1b8b79=0xce;}_0x3259f1[_0x9258('0x2b')](_0x1b8b79);return _0x3259f1[_0x9258('0x30')](_0x9258('0x31'),_0x4b88c1+'-'+_0x331a36+'/'+_0x2cb4bb)[_0x9258('0x32')](_0x3d8cfd);}return null;};}function patchUpdates(_0x48f7c8){return function(_0x272ef9){try{jsonpatch['apply'](_0x272ef9,_0x48f7c8,!![]);}catch(_0x5bbcd4){return BPromise['reject'](_0x5bbcd4);}return _0x272ef9[_0x9258('0x33')]();};}function saveUpdates(_0x29df80,_0x4d2514){return function(_0x54c7de){if(_0x54c7de){return _0x54c7de['update'](_0x29df80)[_0x9258('0x20')](function(_0x2b4f53){return _0x2b4f53;});}return null;};}function removeEntity(_0xb2d5ef,_0x2098b9){return function(_0x9c2c2b){if(_0x9c2c2b){return _0x9c2c2b[_0x9258('0x34')]()[_0x9258('0x20')](function(){_0xb2d5ef['status'](0xcc)[_0x9258('0x35')]();});}};}function handleEntityNotFound(_0x267625,_0xd02b6b){return function(_0xc161e8){if(!_0xc161e8){_0x267625[_0x9258('0x2a')](0x194);}return _0xc161e8;};}function handleError(_0x3d3197,_0x177dd4){_0x177dd4=_0x177dd4||0x1f4;return function(_0x1c285d){logger[_0x9258('0x25')](_0x1c285d[_0x9258('0x36')]);if(_0x1c285d['name']){delete _0x1c285d['name'];}_0x3d3197[_0x9258('0x2b')](_0x177dd4)[_0x9258('0x37')](_0x1c285d);};}exports[_0x9258('0x38')]=function(_0x413858,_0x3add1a){var _0x284e7c={},_0x49087={},_0x41bfba={'count':0x0,'rows':[]};var _0x1f7bdf=_[_0x9258('0x39')](db['ChatMessage'][_0x9258('0x3a')],function(_0x41ae26){return{'name':_0x41ae26['fieldName'],'type':_0x41ae26[_0x9258('0x3b')][_0x9258('0x3c')]};});_0x49087[_0x9258('0x3d')]=_['map'](_0x1f7bdf,_0x9258('0x3e'));_0x49087['query']=_[_0x9258('0x3f')](_0x413858[_0x9258('0x40')]);_0x49087['filters']=_[_0x9258('0x41')](_0x49087[_0x9258('0x3d')],_0x49087[_0x9258('0x40')]);_0x284e7c[_0x9258('0x42')]=_[_0x9258('0x41')](_0x49087[_0x9258('0x3d')],qs['fields'](_0x413858[_0x9258('0x40')][_0x9258('0x43')]));_0x284e7c[_0x9258('0x42')]=_0x284e7c[_0x9258('0x42')][_0x9258('0x44')]?_0x284e7c[_0x9258('0x42')]:_0x49087['model'];if(!_0x413858[_0x9258('0x40')][_0x9258('0x45')](_0x9258('0x46'))){_0x284e7c['limit']=qs[_0x9258('0x2f')](_0x413858[_0x9258('0x40')][_0x9258('0x2f')]);_0x284e7c[_0x9258('0x2c')]=qs[_0x9258('0x2c')](_0x413858['query'][_0x9258('0x2c')]);}_0x284e7c['order']=qs[_0x9258('0x47')](_0x413858[_0x9258('0x40')][_0x9258('0x47')]);_0x284e7c[_0x9258('0x48')]=qs['filters'](_['pick'](_0x413858[_0x9258('0x40')],_0x49087['filters']),_0x1f7bdf);if(_0x413858['query'][_0x9258('0x49')]){_0x284e7c[_0x9258('0x48')]=_[_0x9258('0x4a')](_0x284e7c[_0x9258('0x48')],{'$or':_[_0x9258('0x39')](_0x1f7bdf,function(_0x1f68ce){if(_0x1f68ce['type']!=='VIRTUAL'){var _0x25f2e5={};_0x25f2e5[_0x1f68ce[_0x9258('0x3e')]]={'$like':'%'+_0x413858[_0x9258('0x40')][_0x9258('0x49')]+'%'};return _0x25f2e5;}})});}_0x284e7c=_[_0x9258('0x4a')]({},_0x284e7c,_0x413858[_0x9258('0x4b')]);var _0x1a48a7={'where':_0x284e7c['where']};return db[_0x9258('0x4c')][_0x9258('0x2e')](_0x1a48a7)['then'](function(_0x54658d){_0x41bfba[_0x9258('0x2e')]=_0x54658d;if(_0x413858[_0x9258('0x40')][_0x9258('0x4d')]){_0x284e7c['include']=[{'all':!![]}];}return db[_0x9258('0x4c')][_0x9258('0x4e')](_0x284e7c);})[_0x9258('0x20')](function(_0x5f49d6){_0x41bfba[_0x9258('0x4f')]=_0x5f49d6;return _0x41bfba;})['then'](respondWithFilteredResult(_0x3add1a,_0x284e7c))[_0x9258('0x29')](handleError(_0x3add1a,null));};exports[_0x9258('0x50')]=function(_0x3b3f64,_0x20db28){var _0x3b0ac3={'raw':!![],'where':{'id':_0x3b3f64[_0x9258('0x51')]['id']}},_0x2a21d4={};_0x2a21d4[_0x9258('0x3d')]=_[_0x9258('0x3f')](db[_0x9258('0x4c')][_0x9258('0x3a')]);_0x2a21d4[_0x9258('0x40')]=_[_0x9258('0x3f')](_0x3b3f64['query']);_0x2a21d4[_0x9258('0x52')]=_[_0x9258('0x41')](_0x2a21d4['model'],_0x2a21d4[_0x9258('0x40')]);_0x3b0ac3[_0x9258('0x42')]=_[_0x9258('0x41')](_0x2a21d4['model'],qs[_0x9258('0x43')](_0x3b3f64[_0x9258('0x40')][_0x9258('0x43')]));_0x3b0ac3[_0x9258('0x42')]=_0x3b0ac3[_0x9258('0x42')][_0x9258('0x44')]?_0x3b0ac3[_0x9258('0x42')]:_0x2a21d4['model'];if(_0x3b3f64['query'][_0x9258('0x4d')]){_0x3b0ac3[_0x9258('0x53')]=[{'all':!![]}];}_0x3b0ac3=_[_0x9258('0x4a')]({},_0x3b0ac3,_0x3b3f64[_0x9258('0x4b')]);return db[_0x9258('0x4c')][_0x9258('0x54')](_0x3b0ac3)['then'](handleEntityNotFound(_0x20db28,null))[_0x9258('0x20')](respondWithResult(_0x20db28,null))[_0x9258('0x29')](handleError(_0x20db28,null));};exports['create']=function(_0x1169d7,_0x4d8f02){return db['ChatMessage'][_0x9258('0x55')](_0x1169d7[_0x9258('0x56')],{})[_0x9258('0x20')](respondWithResult(_0x4d8f02,0xc9))[_0x9258('0x29')](handleError(_0x4d8f02,null));};exports[_0x9258('0x57')]=function(_0x2b2d85,_0x43a2b0){if(_0x2b2d85[_0x9258('0x56')]['id']){delete _0x2b2d85[_0x9258('0x56')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x2b2d85[_0x9258('0x51')]['id']}})[_0x9258('0x20')](handleEntityNotFound(_0x43a2b0,null))[_0x9258('0x20')](saveUpdates(_0x2b2d85[_0x9258('0x56')],null))[_0x9258('0x20')](respondWithResult(_0x43a2b0,null))[_0x9258('0x29')](handleError(_0x43a2b0,null));};exports[_0x9258('0x34')]=function(_0x23723e,_0xd63d6d){return db[_0x9258('0x4c')][_0x9258('0x54')]({'where':{'id':_0x23723e[_0x9258('0x51')]['id']}})[_0x9258('0x20')](handleEntityNotFound(_0xd63d6d,null))[_0x9258('0x20')](removeEntity(_0xd63d6d,null))[_0x9258('0x29')](handleError(_0xd63d6d,null));};exports['describe']=function(_0x2157ef,_0x3f955f){return db[_0x9258('0x4c')][_0x9258('0x58')]()[_0x9258('0x20')](respondWithResult(_0x3f955f,null))['catch'](handleError(_0x3f955f,null));};var interaction_log=require('../../config/logger')(_0x9258('0x59'));exports[_0x9258('0x5a')]=function(_0xe3b227,_0x912e3b,_0x3a4334){var _0x32d0c2={'agent':{},'channel':_0x9258('0x5b')};if(_0xe3b227[_0x9258('0x56')]['id']){delete _0xe3b227[_0x9258('0x56')]['id'];}_0xe3b227['body'][_0x9258('0x5c')]=!![];_0xe3b227['body']['readAt']=moment()[_0x9258('0x5d')](_0x9258('0x5e'));_0xe3b227['body'][_0x9258('0x5f')]=_0xe3b227[_0x9258('0x56')][_0x9258('0x5f')]||_0xe3b227[_0x9258('0x60')]['id'];_0x32d0c2[_0x9258('0x61')]['id']=_0xe3b227[_0x9258('0x56')][_0x9258('0x5f')];return db[_0x9258('0x4c')][_0x9258('0x54')]({'where':{'id':_0xe3b227[_0x9258('0x51')]['id'],'UserId':null}})[_0x9258('0x20')](handleEntityNotFound(_0x912e3b,null))['then'](saveUpdates(_0xe3b227[_0x9258('0x56')],null))[_0x9258('0x20')](function(_0x427c6e){if(_0x427c6e){_0x32d0c2[_0x9258('0x27')]=_0x427c6e['get']({'plain':!![]});return db[_0x9258('0x62')]['find']({'where':{'id':_0x427c6e['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x912e3b,null))[_0x9258('0x20')](function(_0x4b17cb){if(_0x4b17cb){return _0x4b17cb[_0x9258('0x57')]({'UserId':_0xe3b227[_0x9258('0x56')]['UserId'],'read1stAt':_[_0x9258('0x63')](_0x4b17cb['read1stAt'])?moment()[_0x9258('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x326674){if(_0x326674){_0x32d0c2[_0x9258('0x64')]=_0x326674[_0x9258('0x65')]({'plain':!![]});interaction_log[_0x9258('0x21')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe3b227[_0x9258('0x60')]['id'],_0xe3b227[_0x9258('0x60')][_0x9258('0x3e')],_0xe3b227[_0x9258('0x60')]['role'],_0x32d0c2['interaction']['id'],_0xe3b227[_0x9258('0x56')]?JSON[_0x9258('0x66')](_0xe3b227[_0x9258('0x56')]):_0x9258('0x67'));return respondWithRpcPromise(_0x9258('0x68'),'acceptMessage',_0x32d0c2);}return null;})[_0x9258('0x20')](function(_0x578dab){var _0x268a32=_0x9258('0x69')+_0x578dab[_0x9258('0x27')][_0x9258('0x6a')];return db[_0x9258('0x6b')][_0x9258('0x40')](_0x268a32,{'type':db['Sequelize'][_0x9258('0x6c')][_0x9258('0x6d')],'raw':!![]})[_0x9258('0x20')](function(_0x3b89c3){return _0x3b89c3;});})['then'](function(_0x5baf1e){if(_0x5baf1e){_0x32d0c2[_0x9258('0x27')][_0x9258('0x6e')]=_0x5baf1e[0x0];if(!_0xe3b227[_0x9258('0x56')][_0x9258('0x5f')])return;return db['User'][_0x9258('0x54')]({'where':{'id':_0xe3b227[_0x9258('0x56')]['UserId'],'role':_0x9258('0x61')},'attributes':['id',_0x9258('0x3e'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x1ad6e8){if(!_0x1ad6e8)return null;_0x32d0c2[_0x9258('0x27')]['agent']=_0x1ad6e8;return _0x32d0c2;})[_0x9258('0x20')](function(_0x25c80b){if(_0x25c80b){if(_0xe3b227[_0x9258('0x56')][_0x9258('0x6f')]){_0x32d0c2['message'][_0x9258('0x70')]=util[_0x9258('0x5d')]('SIP/%s',_0xe3b227['user'][_0x9258('0x3e')]);_0x32d0c2[_0x9258('0x27')][_0x9258('0x71')]=_0x32d0c2[_0x9258('0x71')];_0x32d0c2[_0x9258('0x27')][_0x9258('0x72')]=_0x32d0c2[_0x9258('0x71')];_0x32d0c2[_0x9258('0x27')][_0x9258('0x73')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x9258('0x74'),'message':_[_0x9258('0x4a')](_0x32d0c2[_0x9258('0x27')],JSON['parse'](_0x32d0c2[_0x9258('0x64')]['formData']))},client9002)[_0x9258('0x20')](function(){return _0x32d0c2;});}return _0x32d0c2;}return null;})[_0x9258('0x20')](respondWithResult(_0x912e3b,null))['catch'](handleError(_0x912e3b,null));};var interaction_log=require(_0x9258('0x75'))(_0x9258('0x59'));exports[_0x9258('0x76')]=function(_0x12bc2e,_0xc5805,_0x530bc7){var _0x526e04={'agent':{},'channel':_0x9258('0x5b')};if(_0x12bc2e['body']['id']){delete _0x12bc2e['body']['id'];}_0x12bc2e[_0x9258('0x56')]['UserId']=_0x12bc2e[_0x9258('0x56')][_0x9258('0x5f')]||_0x12bc2e[_0x9258('0x60')]['id'];_0x526e04[_0x9258('0x61')]['id']=_0x12bc2e[_0x9258('0x56')]['UserId'];return db[_0x9258('0x4c')][_0x9258('0x54')]({'where':{'id':_0x12bc2e[_0x9258('0x51')]['id'],'UserId':null}})[_0x9258('0x20')](handleEntityNotFound(_0xc5805,null))[_0x9258('0x20')](function(_0x354ebd){if(_0x354ebd){_0x526e04['message']=_0x354ebd['get']({'plain':!![]});return db['ChatInteraction'][_0x9258('0x54')]({'where':{'id':_0x354ebd[_0x9258('0x77')]}});}return null;})['then'](handleEntityNotFound(_0xc5805,null))[_0x9258('0x20')](function(_0x336574){if(_0x336574){_0x526e04['interaction']=_0x336574['get']({'plain':!![]});interaction_log['info'](_0x9258('0x78'),_0x12bc2e['user']['id'],_0x12bc2e[_0x9258('0x60')]['name'],_0x12bc2e[_0x9258('0x60')][_0x9258('0x79')],_0x526e04[_0x9258('0x64')]['id'],_0x12bc2e[_0x9258('0x56')]?JSON['stringify'](_0x12bc2e[_0x9258('0x56')]):'null');return respondWithRpcPromise(_0x9258('0x7a'),_0x9258('0x7b'),_0x526e04);}return null;})['then'](function(_0x2fc73e){var _0x2ed192=_0x9258('0x69')+_0x2fc73e['message'][_0x9258('0x6a')];return db[_0x9258('0x6b')][_0x9258('0x40')](_0x2ed192,{'type':db[_0x9258('0x7c')]['QueryTypes'][_0x9258('0x6d')],'raw':!![]})[_0x9258('0x20')](function(_0x447796){return _0x447796;});})[_0x9258('0x20')](function(_0x4ec959){if(_0x4ec959){_0x526e04[_0x9258('0x27')]['contact']=_0x4ec959[0x0];if(!_0x12bc2e[_0x9258('0x56')][_0x9258('0x5f')])return;return db[_0x9258('0x7d')][_0x9258('0x54')]({'where':{'id':_0x12bc2e['body'][_0x9258('0x5f')],'role':'agent'},'attributes':['id','name',_0x9258('0x7e'),_0x9258('0x7f'),_0x9258('0x80')],'raw':!![]});}return null;})[_0x9258('0x20')](function(_0x37c074){if(!_0x37c074)return null;_0x526e04[_0x9258('0x27')][_0x9258('0x61')]=_0x37c074;return _0x526e04;})[_0x9258('0x20')](function(_0x300f49){if(_0x300f49){_0x300f49[_0x9258('0x27')][_0x9258('0x70')]=util[_0x9258('0x5d')](_0x9258('0x81'),_0x12bc2e[_0x9258('0x60')][_0x9258('0x3e')]);_0x300f49[_0x9258('0x27')][_0x9258('0x71')]=_0x526e04[_0x9258('0x71')];_0x300f49[_0x9258('0x27')][_0x9258('0x72')]=_0x526e04[_0x9258('0x71')];_0x300f49[_0x9258('0x27')]['event']=_0x9258('0x76');respondWithRpcPromise(_0x9258('0x82'),_0x9258('0x82'),{'event':'rejectmessage','message':_['merge'](_0x526e04['message'],JSON['parse'](_0x526e04[_0x9258('0x64')]['formData']))},client9002);return _0x526e04;}return null;})['then'](respondWithResult(_0xc5805,null))['catch'](handleError(_0xc5805,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 3fb8cd0..4abc391 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 _0xcde8=['hook','exports','events','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x53a83b,_0x31aaee){var _0x5eb250=function(_0xb3edbc){while(--_0xb3edbc){_0x53a83b['push'](_0x53a83b['shift']());}};_0x5eb250(++_0x31aaee);}(_0xcde8,0xa4));var _0x8cde=function(_0x177b5f,_0x1acadf){_0x177b5f=_0x177b5f-0x0;var _0x408777=_0xcde8[_0x177b5f];return _0x408777;};'use strict';var EventEmitter=require(_0x8cde('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x8cde('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8cde('0x2'),'afterUpdate':_0x8cde('0x3'),'afterDestroy':_0x8cde('0x4')};function emitEvent(_0x313b1a){return function(_0x4da4df,_0x34d131,_0x4c7f1d){ChatMessageEvents['emit'](_0x313b1a+':'+_0x4da4df['id'],_0x4da4df);ChatMessageEvents[_0x8cde('0x5')](_0x313b1a,_0x4da4df);_0x4c7f1d(null);};}for(var e in events){if(events[_0x8cde('0x6')](e)){var event=events[e];ChatMessage[_0x8cde('0x7')](e,emitEvent(event));}}module[_0x8cde('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x9e1f=['ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5be86f,_0xc2a4ac){var _0x4c0a01=function(_0x193d6a){while(--_0x193d6a){_0x5be86f['push'](_0x5be86f['shift']());}};_0x4c0a01(++_0xc2a4ac);}(_0x9e1f,0x6b));var _0xf9e1=function(_0x19115a,_0x3ca6f2){_0x19115a=_0x19115a-0x0;var _0x3f2ab7=_0x9e1f[_0x19115a];return _0x3f2ab7;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xf9e1('0x0'))['db'][_0xf9e1('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf9e1('0x2')](0x0);var events={'afterCreate':_0xf9e1('0x3'),'afterUpdate':_0xf9e1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1614d9){return function(_0x15752c,_0x48d82d,_0x19dd17){ChatMessageEvents[_0xf9e1('0x5')](_0x1614d9+':'+_0x15752c['id'],_0x15752c);ChatMessageEvents['emit'](_0x1614d9,_0x15752c);_0x19dd17(null);};}for(var e in events){if(events[_0xf9e1('0x6')](e)){var event=events[e];ChatMessage[_0xf9e1('0x7')](e,emitEvent(event));}}module[_0xf9e1('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 1cde51d..179399a 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 _0x953a=['exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5600c6,_0x58e4e3){var _0x231a14=function(_0x30fd54){while(--_0x30fd54){_0x5600c6['push'](_0x5600c6['shift']());}};_0x231a14(++_0x58e4e3);}(_0x953a,0xf6));var _0xa953=function(_0x8ee616,_0x452cc7){_0x8ee616=_0x8ee616-0x0;var _0xe88371=_0x953a[_0x8ee616];return _0xe88371;};'use strict';var _=require('lodash');var util=require(_0xa953('0x0'));var logger=require('../../config/logger')(_0xa953('0x1'));var moment=require('moment');var BPromise=require(_0xa953('0x2'));var rp=require(_0xa953('0x3'));var fs=require('fs');var path=require(_0xa953('0x4'));var rimraf=require(_0xa953('0x5'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0xa953('0x6')]=function(_0x5e171d,_0x1e6592){return _0x5e171d[_0xa953('0x7')](_0xa953('0x8'),attributes,{'tableName':_0xa953('0x9'),'paranoid':![],'indexes':[{'name':_0xa953('0xa'),'fields':['body'],'type':_0xa953('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38891d,_0x2fafe0,_0x1d55d9){var _0xddfbe1=_0x5e171d[_0xa953('0xc')];var _0x2cd9d9=_0x38891d[_0xa953('0xd')]({'plain':!![]});if(_0x2cd9d9[_0xa953('0xe')][_0xa953('0xf')]()==='in'||_0x2cd9d9[_0xa953('0xe')][_0xa953('0xf')]()==='out'&&!_0x2cd9d9['secret']&&!_[_0xa953('0x10')](_0x2cd9d9[_0xa953('0x11')])){_0xddfbe1[_0xa953('0x12')][_0xa953('0x13')]({'where':{'id':_0x2cd9d9[_0xa953('0x14')]}})[_0xa953('0x15')](function(_0x5642a4){if(_0x5642a4){_0x5642a4[_0xa953('0x16')]({'lastMsgAt':_0x2cd9d9[_0xa953('0x17')],'lastMsgDirection':_0x2cd9d9['direction']['toLowerCase']()});}})[_0xa953('0x18')](function(_0x3162a2){console[_0xa953('0x19')](_0x3162a2);});}_0x1d55d9();}},'charset':_0xa953('0x1a'),'collate':_0xa953('0x1b')});}; \ No newline at end of file +var _0x2855=['direction','toLowerCase','isNil','ChatInteraction','findOne','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get'];(function(_0x3c60b3,_0xeccd24){var _0x2bab8e=function(_0x27f1f7){while(--_0x27f1f7){_0x3c60b3['push'](_0x3c60b3['shift']());}};_0x2bab8e(++_0xeccd24);}(_0x2855,0x8c));var _0x5285=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x2855[_0x454165];return _0x56db53;};'use strict';var _=require(_0x5285('0x0'));var util=require(_0x5285('0x1'));var logger=require(_0x5285('0x2'))(_0x5285('0x3'));var moment=require(_0x5285('0x4'));var BPromise=require(_0x5285('0x5'));var rp=require(_0x5285('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5285('0x7'));var attributes=require('./chatMessage.attributes');module[_0x5285('0x8')]=function(_0xf6f02e,_0x1c93b9){return _0xf6f02e[_0x5285('0x9')](_0x5285('0xa'),attributes,{'tableName':_0x5285('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x5285('0xc')],'type':_0x5285('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9c36d8,_0x4c954f,_0x323f57){var _0x1b932b=_0xf6f02e[_0x5285('0xe')];var _0x4abe9e=_0x9c36d8[_0x5285('0xf')]({'plain':!![]});if(_0x4abe9e[_0x5285('0x10')][_0x5285('0x11')]()==='in'||_0x4abe9e[_0x5285('0x10')]['toLowerCase']()==='out'&&!_0x4abe9e['secret']&&!_[_0x5285('0x12')](_0x4abe9e['UserId'])){_0x1b932b[_0x5285('0x13')][_0x5285('0x14')]({'where':{'id':_0x4abe9e['ChatInteractionId']}})['then'](function(_0x5c2adf){if(_0x5c2adf){_0x5c2adf[_0x5285('0x15')]({'lastMsgAt':_0x4abe9e['createdAt'],'lastMsgDirection':_0x4abe9e['direction'][_0x5285('0x11')]()});}})[_0x5285('0x16')](function(_0xc88aa8){console[_0x5285('0x17')](_0xc88aa8);});}_0x323f57();}},'charset':_0x5285('0x18'),'collate':_0x5285('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 1badf7f..732bdc0 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 _0x5843=['result','catch','CreateChatMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2da443,_0xc79d40){var _0x377feb=function(_0x44174b){while(--_0x44174b){_0x2da443['push'](_0x2da443['shift']());}};_0x377feb(++_0xc79d40);}(_0x5843,0x107));var _0x3584=function(_0x305be3,_0x2baf51){_0x305be3=_0x305be3-0x0;var _0x547993=_0x5843[_0x305be3];return _0x547993;};'use strict';var _=require('lodash');var util=require(_0x3584('0x0'));var moment=require(_0x3584('0x1'));var BPromise=require(_0x3584('0x2'));var rs=require(_0x3584('0x3'));var fs=require('fs');var Redis=require(_0x3584('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3584('0x5'));var logger=require(_0x3584('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3584('0x7'));var client=jayson[_0x3584('0x8')][_0x3584('0x9')]({'port':0x232a});config[_0x3584('0xa')]=_[_0x3584('0xb')](config[_0x3584('0xa')],{'host':_0x3584('0xc'),'port':0x18eb});var socket=require(_0x3584('0xd'))(new Redis(config[_0x3584('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x56cf4c,_0x75ffdb,_0x224b5d){return new BPromise(function(_0x1c545d,_0x4e5175){return client[_0x3584('0xe')](_0x56cf4c,_0x224b5d)[_0x3584('0xf')](function(_0x5d7f4e){logger[_0x3584('0x10')](_0x3584('0x11'),_0x75ffdb,_0x3584('0x12'));logger[_0x3584('0x13')](_0x3584('0x14'),_0x75ffdb,_0x3584('0x12'),JSON[_0x3584('0x15')](_0x5d7f4e));if(_0x5d7f4e[_0x3584('0x16')]){if(_0x5d7f4e[_0x3584('0x16')][_0x3584('0x17')]===0x1f4){logger[_0x3584('0x16')]('ChatMessage,\x20%s,\x20%s',_0x75ffdb,_0x5d7f4e[_0x3584('0x16')]['message']);return _0x4e5175(_0x5d7f4e[_0x3584('0x16')][_0x3584('0x18')]);}logger[_0x3584('0x16')](_0x3584('0x11'),_0x75ffdb,_0x5d7f4e['error'][_0x3584('0x18')]);return _0x1c545d(_0x5d7f4e[_0x3584('0x16')][_0x3584('0x18')]);}else{logger[_0x3584('0x10')](_0x3584('0x11'),_0x75ffdb,_0x3584('0x12'));_0x1c545d(_0x5d7f4e[_0x3584('0x19')][_0x3584('0x18')]);}})[_0x3584('0x1a')](function(_0x136af2){logger['error'](_0x3584('0x11'),_0x75ffdb,_0x136af2);_0x4e5175(_0x136af2);});});}exports[_0x3584('0x1b')]=function(_0x1d5dab){var _0x53c661=this;return new Promise(function(_0x5e518f,_0x1bc6e2){return db['ChatMessage'][_0x3584('0x1c')](_0x1d5dab[_0x3584('0x1d')],{'raw':_0x1d5dab[_0x3584('0x1e')]?_0x1d5dab[_0x3584('0x1e')][_0x3584('0x1f')]===undefined?!![]:![]:!![]})[_0x3584('0xf')](function(_0x25eff5){logger[_0x3584('0x10')](_0x3584('0x1b'),_0x1d5dab);logger[_0x3584('0x13')](_0x3584('0x1b'),_0x1d5dab,JSON[_0x3584('0x15')](_0x25eff5));_0x5e518f(_0x25eff5);})['catch'](function(_0x40f1d1){logger[_0x3584('0x16')](_0x3584('0x1b'),_0x40f1d1[_0x3584('0x18')],_0x1d5dab);_0x1bc6e2(_0x53c661[_0x3584('0x16')](0x1f4,_0x40f1d1[_0x3584('0x18')]));});});}; \ No newline at end of file +var _0x55cf=['result','CreateChatMessage','ChatMessage','body','options','raw','stringify','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1d4849,_0x535294){var _0x451396=function(_0x26931e){while(--_0x26931e){_0x1d4849['push'](_0x1d4849['shift']());}};_0x451396(++_0x535294);}(_0x55cf,0x128));var _0xf55c=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x55cf[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf55c('0x0'));var BPromise=require('bluebird');var rs=require(_0xf55c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf55c('0x2'))['db'];var utils=require(_0xf55c('0x3'));var logger=require(_0xf55c('0x4'))(_0xf55c('0x5'));var config=require(_0xf55c('0x6'));var jayson=require(_0xf55c('0x7'));var client=jayson[_0xf55c('0x8')][_0xf55c('0x9')]({'port':0x232a});config['redis']=_[_0xf55c('0xa')](config[_0xf55c('0xb')],{'host':_0xf55c('0xc'),'port':0x18eb});var socket=require(_0xf55c('0xd'))(new Redis(config[_0xf55c('0xb')]));require(_0xf55c('0xe'))['register'](socket);function respondWithRpcPromise(_0x3fe0e1,_0x27c438,_0x21cf02){return new BPromise(function(_0x1e1dd1,_0x5917d8){return client[_0xf55c('0xf')](_0x3fe0e1,_0x21cf02)[_0xf55c('0x10')](function(_0x3f0a61){logger[_0xf55c('0x11')](_0xf55c('0x12'),_0x27c438,_0xf55c('0x13'));logger[_0xf55c('0x14')](_0xf55c('0x15'),_0x27c438,_0xf55c('0x13'),JSON['stringify'](_0x3f0a61));if(_0x3f0a61['error']){if(_0x3f0a61[_0xf55c('0x16')]['code']===0x1f4){logger[_0xf55c('0x16')]('ChatMessage,\x20%s,\x20%s',_0x27c438,_0x3f0a61[_0xf55c('0x16')][_0xf55c('0x17')]);return _0x5917d8(_0x3f0a61[_0xf55c('0x16')]['message']);}logger['error'](_0xf55c('0x12'),_0x27c438,_0x3f0a61['error'][_0xf55c('0x17')]);return _0x1e1dd1(_0x3f0a61['error'][_0xf55c('0x17')]);}else{logger[_0xf55c('0x11')](_0xf55c('0x12'),_0x27c438,_0xf55c('0x13'));_0x1e1dd1(_0x3f0a61[_0xf55c('0x18')]['message']);}})['catch'](function(_0x4e6be1){logger[_0xf55c('0x16')](_0xf55c('0x12'),_0x27c438,_0x4e6be1);_0x5917d8(_0x4e6be1);});});}exports[_0xf55c('0x19')]=function(_0x2bc652){var _0x42efb2=this;return new Promise(function(_0xc4e5c,_0xdf86da){return db[_0xf55c('0x1a')]['create'](_0x2bc652[_0xf55c('0x1b')],{'raw':_0x2bc652[_0xf55c('0x1c')]?_0x2bc652['options'][_0xf55c('0x1d')]===undefined?!![]:![]:!![]})[_0xf55c('0x10')](function(_0x2ecd2b){logger['info'](_0xf55c('0x19'),_0x2bc652);logger[_0xf55c('0x14')](_0xf55c('0x19'),_0x2bc652,JSON[_0xf55c('0x1e')](_0x2ecd2b));_0xc4e5c(_0x2ecd2b);})[_0xf55c('0x1f')](function(_0x1b7c8f){logger[_0xf55c('0x16')]('CreateChatMessage',_0x1b7c8f[_0xf55c('0x17')],_0x2bc652);_0xdf86da(_0x42efb2[_0xf55c('0x16')](0x1f4,_0x1b7c8f[_0xf55c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2e01de5..4e18068 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 _0x42b0=['register','length','./chatMessage.events','save','update','removeListener'];(function(_0x3c9463,_0xfba58f){var _0x551147=function(_0x103fb4){while(--_0x103fb4){_0x3c9463['push'](_0x3c9463['shift']());}};_0x551147(++_0xfba58f);}(_0x42b0,0xbc));var _0x042b=function(_0x15bc31,_0x14f70c){_0x15bc31=_0x15bc31-0x0;var _0x1989fe=_0x42b0[_0x15bc31];return _0x1989fe;};'use strict';var ChatMessageEvents=require(_0x042b('0x0'));var events=[_0x042b('0x1'),'remove',_0x042b('0x2')];function createListener(_0x4bf494,_0x1d7aa3){return function(_0x5a7e27){_0x1d7aa3['emit'](_0x4bf494,_0x5a7e27);};}function removeListener(_0x401a0c,_0xd73d53){return function(){ChatMessageEvents[_0x042b('0x3')](_0x401a0c,_0xd73d53);};}exports[_0x042b('0x4')]=function(_0x135bc1){for(var _0x5d194a=0x0,_0x51c41c=events[_0x042b('0x5')];_0x5d194a<_0x51c41c;_0x5d194a++){var _0x1ec28f=events[_0x5d194a];var _0x49ab70=createListener('chatMessage:'+_0x1ec28f,_0x135bc1);ChatMessageEvents['on'](_0x1ec28f,_0x49ab70);}}; \ No newline at end of file +var _0xaa5c=['chatMessage:','./chatMessage.events','save','remove','update','register','length'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x106c43,_0x3bdac4){_0x106c43=_0x106c43-0x0;var _0x21c8ee=_0xaa5c[_0x106c43];return _0x21c8ee;};'use strict';var ChatMessageEvents=require(_0xcaa5('0x0'));var events=[_0xcaa5('0x1'),_0xcaa5('0x2'),_0xcaa5('0x3')];function createListener(_0x54ad1c,_0x4cb09c){return function(_0x5c4f66){_0x4cb09c['emit'](_0x54ad1c,_0x5c4f66);};}function removeListener(_0x2125b9,_0x4d1b66){return function(){ChatMessageEvents['removeListener'](_0x2125b9,_0x4d1b66);};}exports[_0xcaa5('0x4')]=function(_0x42afd4){for(var _0x1877d0=0x0,_0x5f56bc=events[_0xcaa5('0x5')];_0x1877d0<_0x5f56bc;_0x1877d0++){var _0x24edf5=events[_0x1877d0];var _0xb27ac1=createListener(_0xcaa5('0x6')+_0x24edf5,_0x42afd4);ChatMessageEvents['on'](_0x24edf5,_0xb27ac1);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 52b2ed8..4d80e50 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 _0x4194=['chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x4194,0x70));var _0x4419=function(_0x5dd62f,_0x28976c){_0x5dd62f=_0x5dd62f-0x0;var _0x1febbd=_0x4194[_0x5dd62f];return _0x1febbd;};'use strict';var multer=require(_0x4419('0x0'));var util=require(_0x4419('0x1'));var path=require(_0x4419('0x2'));var timeout=require('connect-timeout');var express=require(_0x4419('0x3'));var router=express[_0x4419('0x4')]();var fs_extra=require(_0x4419('0x5'));var auth=require(_0x4419('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4419('0x7'));var controller=require(_0x4419('0x8'));router[_0x4419('0x9')]('/',auth[_0x4419('0xa')](),controller[_0x4419('0xb')]);router['get'](_0x4419('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x4419('0xa')](),controller['show']);router['post']('/',auth[_0x4419('0xa')](),interaction['tracked'](_0x4419('0xd'),_0x4419('0xe')),controller[_0x4419('0xf')]);router['put']('/:id',controller['update']);router[_0x4419('0x10')](_0x4419('0x11'),auth['isAuthenticated'](),controller[_0x4419('0x12')]);router['put'](_0x4419('0x13'),auth[_0x4419('0xa')](),controller[_0x4419('0x14')]);router[_0x4419('0x15')](_0x4419('0x16'),auth[_0x4419('0xa')](),controller[_0x4419('0x17')]);module[_0x4419('0x18')]=router; \ No newline at end of file +var _0xd503=['create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','/describe','describe','/:id','isAuthenticated','post','chatmessage:create'];(function(_0x545d7b,_0x2e66ff){var _0x84207=function(_0x59478c){while(--_0x59478c){_0x545d7b['push'](_0x545d7b['shift']());}};_0x84207(++_0x2e66ff);}(_0xd503,0x1a9));var _0x3d50=function(_0x5d2612,_0x3b226c){_0x5d2612=_0x5d2612-0x0;var _0x1b7188=_0xd503[_0x5d2612];return _0x1b7188;};'use strict';var multer=require(_0x3d50('0x0'));var util=require(_0x3d50('0x1'));var path=require(_0x3d50('0x2'));var timeout=require(_0x3d50('0x3'));var express=require(_0x3d50('0x4'));var router=express[_0x3d50('0x5')]();var fs_extra=require(_0x3d50('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3d50('0x7'));var config=require(_0x3d50('0x8'));var controller=require(_0x3d50('0x9'));router[_0x3d50('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3d50('0xb'),auth['isAuthenticated'](),controller[_0x3d50('0xc')]);router[_0x3d50('0xa')](_0x3d50('0xd'),auth[_0x3d50('0xe')](),controller['show']);router[_0x3d50('0xf')]('/',auth[_0x3d50('0xe')](),interaction['tracked']('chat',_0x3d50('0x10')),controller[_0x3d50('0x11')]);router[_0x3d50('0x12')]('/:id',controller[_0x3d50('0x13')]);router[_0x3d50('0x12')](_0x3d50('0x14'),auth[_0x3d50('0xe')](),controller[_0x3d50('0x15')]);router[_0x3d50('0x12')](_0x3d50('0x16'),auth[_0x3d50('0xe')](),controller[_0x3d50('0x17')]);router['delete'](_0x3d50('0xd'),auth[_0x3d50('0xe')](),controller[_0x3d50('0x18')]);module[_0x3d50('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9a112af..c4735ea 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0xc524fd,_0x249fd3){var _0x198f3b=function(_0x1d70c2){while(--_0x1d70c2){_0xc524fd['push'](_0xc524fd['shift']());}};_0x198f3b(++_0x249fd3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x0b0e[_0x4bd950];return _0x5dc59a;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b78a7a7..eb5f124 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(_0x39ffa0,_0x12d01b){var _0x1a5ace=function(_0x28f028){while(--_0x28f028){_0x39ffa0['push'](_0x39ffa0['shift']());}};_0x1a5ace(++_0x12d01b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x7a54,0x106));var _0x47a5=function(_0x11641a,_0x4b5602){_0x11641a=_0x11641a-0x0;var _0x2c3300=_0x7a54[_0x11641a];return _0x2c3300;};'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 c123563..b1eac76 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 _0x5aa0=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','update','remove'];(function(_0x298894,_0x4144b9){var _0x113c61=function(_0x3f5aa8){while(--_0x3f5aa8){_0x298894['push'](_0x298894['shift']());}};_0x113c61(++_0x4144b9);}(_0x5aa0,0x135));var _0x05aa=function(_0x4fcd44,_0x2ff7e2){_0x4fcd44=_0x4fcd44-0x0;var _0xf8fefd=_0x5aa0[_0x4fcd44];return _0xf8fefd;};'use strict';var EventEmitter=require(_0x05aa('0x0'));var ChatOfflineMessage=require(_0x05aa('0x1'))['db'][_0x05aa('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x05aa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x05aa('0x4'),'afterDestroy':_0x05aa('0x5')};function emitEvent(_0xfcdea8){return function(_0x3903c0,_0x579f13,_0x58e8e2){ChatOfflineMessageEvents['emit'](_0xfcdea8+':'+_0x3903c0['id'],_0x3903c0);ChatOfflineMessageEvents[_0x05aa('0x6')](_0xfcdea8,_0x3903c0);_0x58e8e2(null);};}for(var e in events){if(events[_0x05aa('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x05aa('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x7dbe=['hasOwnProperty','hook','exports','events','ChatOfflineMessage','update','remove','emit'];(function(_0x2d26db,_0xc5f6e6){var _0x3bdb54=function(_0x22e61a){while(--_0x22e61a){_0x2d26db['push'](_0x2d26db['shift']());}};_0x3bdb54(++_0xc5f6e6);}(_0x7dbe,0x183));var _0xe7db=function(_0x1deed4,_0x2a0d47){_0x1deed4=_0x1deed4-0x0;var _0x5b7c66=_0x7dbe[_0x1deed4];return _0x5b7c66;};'use strict';var EventEmitter=require(_0xe7db('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xe7db('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe7db('0x2'),'afterDestroy':_0xe7db('0x3')};function emitEvent(_0x5c2404){return function(_0x2c8e32,_0x1701d6,_0x1d7412){ChatOfflineMessageEvents[_0xe7db('0x4')](_0x5c2404+':'+_0x2c8e32['id'],_0x2c8e32);ChatOfflineMessageEvents[_0xe7db('0x4')](_0x5c2404,_0x2c8e32);_0x1d7412(null);};}for(var e in events){if(events[_0xe7db('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xe7db('0x6')](e,emitEvent(event));}}module[_0xe7db('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index eb82e12..93fd172 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 _0x4848=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x3aa556,_0x3f7d88){var _0x36bd20=function(_0x20bb60){while(--_0x20bb60){_0x3aa556['push'](_0x3aa556['shift']());}};_0x36bd20(++_0x3f7d88);}(_0x4848,0xb6));var _0x8484=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x4848[_0x286bfb];return _0x52b683;};'use strict';var attributes=require(_0x8484('0x0'));module['exports']=function(_0x4fd95a){return _0x4fd95a[_0x8484('0x1')](_0x8484('0x2'),attributes,{'tableName':_0x8484('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8484('0x4')});}; \ No newline at end of file +var _0xac37=['utf8mb4','utf8mb4_unicode_ci','exports','ChatOfflineMessage'];(function(_0x289a98,_0x34e82a){var _0x5781c4=function(_0x567a42){while(--_0x567a42){_0x289a98['push'](_0x289a98['shift']());}};_0x5781c4(++_0x34e82a);}(_0xac37,0x156));var _0x7ac3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xac37[_0x138adb];return _0x1b27f2;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x7ac3('0x0')]=function(_0x89636f){return _0x89636f['define'](_0x7ac3('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ac3('0x2'),'collate':_0x7ac3('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index ee3f8b5..e4ca9a0 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 _0xb6a8=['http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb6a8,0xc8));var _0x8b6a=function(_0x109d45,_0x30d816){_0x109d45=_0x109d45-0x0;var _0xb762c8=_0xb6a8[_0x109d45];return _0xb762c8;};'use strict';var _=require(_0x8b6a('0x0'));var util=require(_0x8b6a('0x1'));var moment=require(_0x8b6a('0x2'));var BPromise=require(_0x8b6a('0x3'));var rs=require(_0x8b6a('0x4'));var fs=require('fs');var Redis=require(_0x8b6a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8b6a('0x6'));var jayson=require(_0x8b6a('0x7'));var client=jayson[_0x8b6a('0x8')][_0x8b6a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x275feb,_0x27b1f5,_0x2843cf){return new BPromise(function(_0x3fba29,_0x7915b3){return client[_0x8b6a('0xa')](_0x275feb,_0x2843cf)['then'](function(_0x102e1b){logger['info'](_0x8b6a('0xb'),_0x27b1f5,_0x8b6a('0xc'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x27b1f5,_0x8b6a('0xc'),JSON[_0x8b6a('0xd')](_0x102e1b));if(_0x102e1b[_0x8b6a('0xe')]){if(_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0xf')]===0x1f4){logger['error'](_0x8b6a('0xb'),_0x27b1f5,_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);return _0x7915b3(_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);}logger[_0x8b6a('0xe')](_0x8b6a('0xb'),_0x27b1f5,_0x102e1b[_0x8b6a('0xe')][_0x8b6a('0x10')]);return _0x3fba29(_0x102e1b['error'][_0x8b6a('0x10')]);}else{logger[_0x8b6a('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27b1f5,_0x8b6a('0xc'));_0x3fba29(_0x102e1b['result'][_0x8b6a('0x10')]);}})[_0x8b6a('0x12')](function(_0x2ed166){logger[_0x8b6a('0xe')](_0x8b6a('0xb'),_0x27b1f5,_0x2ed166);_0x7915b3(_0x2ed166);});});} \ No newline at end of file +var _0xc9b0=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3cc4f5,_0x28eb40){var _0x3fb22a=function(_0x1b5ec8){while(--_0x1b5ec8){_0x3cc4f5['push'](_0x3cc4f5['shift']());}};_0x3fb22a(++_0x28eb40);}(_0xc9b0,0x143));var _0x0c9b=function(_0x3b39ba,_0x100166){_0x3b39ba=_0x3b39ba-0x0;var _0x40680c=_0xc9b0[_0x3b39ba];return _0x40680c;};'use strict';var _=require(_0x0c9b('0x0'));var util=require(_0x0c9b('0x1'));var moment=require(_0x0c9b('0x2'));var BPromise=require(_0x0c9b('0x3'));var rs=require(_0x0c9b('0x4'));var fs=require('fs');var Redis=require(_0x0c9b('0x5'));var db=require(_0x0c9b('0x6'))['db'];var utils=require(_0x0c9b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0c9b('0x8'));var jayson=require(_0x0c9b('0x9'));var client=jayson[_0x0c9b('0xa')][_0x0c9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd53c,_0x16779e,_0x363958){return new BPromise(function(_0x44bcd5,_0x170820){return client['request'](_0x1bd53c,_0x363958)['then'](function(_0x4e4a0d){logger[_0x0c9b('0xc')](_0x0c9b('0xd'),_0x16779e,_0x0c9b('0xe'));logger[_0x0c9b('0xf')](_0x0c9b('0x10'),_0x16779e,_0x0c9b('0xe'),JSON['stringify'](_0x4e4a0d));if(_0x4e4a0d[_0x0c9b('0x11')]){if(_0x4e4a0d[_0x0c9b('0x11')]['code']===0x1f4){logger[_0x0c9b('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x16779e,_0x4e4a0d[_0x0c9b('0x11')][_0x0c9b('0x12')]);return _0x170820(_0x4e4a0d[_0x0c9b('0x11')][_0x0c9b('0x12')]);}logger[_0x0c9b('0x11')](_0x0c9b('0xd'),_0x16779e,_0x4e4a0d[_0x0c9b('0x11')][_0x0c9b('0x12')]);return _0x44bcd5(_0x4e4a0d[_0x0c9b('0x11')][_0x0c9b('0x12')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x16779e,'request\x20sent');_0x44bcd5(_0x4e4a0d[_0x0c9b('0x13')][_0x0c9b('0x12')]);}})['catch'](function(_0xa7bda1){logger[_0x0c9b('0x11')](_0x0c9b('0xd'),_0x16779e,_0xa7bda1);_0x170820(_0xa7bda1);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index ec55683..3c07463 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 _0xbf0b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x37cd7e,_0xc3e949){var _0xa8bdf3=function(_0x48eee1){while(--_0x48eee1){_0x37cd7e['push'](_0x37cd7e['shift']());}};_0xa8bdf3(++_0xc3e949);}(_0xbf0b,0x1c9));var _0xbbf0=function(_0x32cfff,_0x30f953){_0x32cfff=_0x32cfff-0x0;var _0x56bd8c=_0xbf0b[_0x32cfff];return _0x56bd8c;};'use strict';var multer=require(_0xbbf0('0x0'));var util=require(_0xbbf0('0x1'));var path=require(_0xbbf0('0x2'));var timeout=require(_0xbbf0('0x3'));var express=require(_0xbbf0('0x4'));var router=express[_0xbbf0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbbf0('0x6'));var interaction=require(_0xbbf0('0x7'));var config=require('../../config/environment');var controller=require('./chatOfflineMessage.controller');router[_0xbbf0('0x8')]('/',auth[_0xbbf0('0x9')](),controller['index']);router['get'](_0xbbf0('0xa'),auth[_0xbbf0('0x9')](),controller[_0xbbf0('0xb')]);router[_0xbbf0('0x8')](_0xbbf0('0xc'),auth[_0xbbf0('0x9')](),controller[_0xbbf0('0xd')]);router[_0xbbf0('0xe')]('/',auth[_0xbbf0('0x9')](),controller['create']);router[_0xbbf0('0xf')](_0xbbf0('0xc'),auth[_0xbbf0('0x9')](),controller[_0xbbf0('0x10')]);router[_0xbbf0('0x11')](_0xbbf0('0xc'),auth['isAuthenticated'](),controller[_0xbbf0('0x12')]);module[_0xbbf0('0x13')]=router; \ No newline at end of file +var _0xc2ea=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xc2ea,0x9c));var _0xac2e=function(_0x33f750,_0x3a0638){_0x33f750=_0x33f750-0x0;var _0xd2186a=_0xc2ea[_0x33f750];return _0xd2186a;};'use strict';var multer=require('multer');var util=require(_0xac2e('0x0'));var path=require(_0xac2e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xac2e('0x2')]();var fs_extra=require(_0xac2e('0x3'));var auth=require(_0xac2e('0x4'));var interaction=require(_0xac2e('0x5'));var config=require(_0xac2e('0x6'));var controller=require(_0xac2e('0x7'));router['get']('/',auth[_0xac2e('0x8')](),controller['index']);router[_0xac2e('0x9')](_0xac2e('0xa'),auth[_0xac2e('0x8')](),controller[_0xac2e('0xb')]);router['get'](_0xac2e('0xc'),auth[_0xac2e('0x8')](),controller[_0xac2e('0xd')]);router[_0xac2e('0xe')]('/',auth[_0xac2e('0x8')](),controller[_0xac2e('0xf')]);router[_0xac2e('0x10')](_0xac2e('0xc'),auth['isAuthenticated'](),controller[_0xac2e('0x11')]);router[_0xac2e('0x12')](_0xac2e('0xc'),auth[_0xac2e('0x8')](),controller[_0xac2e('0x13')]);module[_0xac2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a0a3550..89b74b3 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 _0x480b=['mouseOver','timeout','STRING','INTEGER','sequelize','exports','ENUM'];(function(_0x4a3fc9,_0x363e4c){var _0x39659d=function(_0x14c848){while(--_0x14c848){_0x4a3fc9['push'](_0x4a3fc9['shift']());}};_0x39659d(++_0x363e4c);}(_0x480b,0x138));var _0xb480=function(_0xe88963,_0xa223ca){_0xe88963=_0xe88963-0x0;var _0x578f04=_0x480b[_0xe88963];return _0x578f04;};'use strict';var Sequelize=require(_0xb480('0x0'));module[_0xb480('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb480('0x2')](_0xb480('0x3'),_0xb480('0x4')),'defaultValue':_0xb480('0x3')},'selector':{'type':Sequelize[_0xb480('0x5')]},'timeout':{'type':Sequelize[_0xb480('0x6')]}}; \ No newline at end of file +var _0xd6d8=['exports','ENUM','mouseOver','timeout'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xd6d8,0xe0));var _0x8d6d=function(_0x4deff,_0x42c328){_0x4deff=_0x4deff-0x0;var _0x440123=_0xd6d8[_0x4deff];return _0x440123;};'use strict';var Sequelize=require('sequelize');module[_0x8d6d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8d6d('0x1')](_0x8d6d('0x2'),_0x8d6d('0x3')),'defaultValue':_0x8d6d('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 72b4565..1697296 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 _0xc18a=['rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','show','params','model','keys','ChatProactiveAction'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0xc18a,0x1cf));var _0xac18=function(_0x264efa,_0x17659c){_0x264efa=_0x264efa-0x0;var _0x911da6=_0xc18a[_0x264efa];return _0x911da6;};'use strict';var emlformat=require(_0xac18('0x0'));var rimraf=require(_0xac18('0x1'));var zipdir=require(_0xac18('0x2'));var jsonpatch=require(_0xac18('0x3'));var rp=require('request-promise');var moment=require(_0xac18('0x4'));var BPromise=require(_0xac18('0x5'));var Mustache=require(_0xac18('0x6'));var util=require(_0xac18('0x7'));var path=require(_0xac18('0x8'));var sox=require(_0xac18('0x9'));var csv=require(_0xac18('0xa'));var ejs=require(_0xac18('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac18('0xc'));var squel=require(_0xac18('0xd'));var crypto=require(_0xac18('0xe'));var jsforce=require(_0xac18('0xf'));var deskjs=require(_0xac18('0x10'));var toCsv=require(_0xac18('0xa'));var querystring=require(_0xac18('0x11'));var Papa=require(_0xac18('0x12'));var Redis=require(_0xac18('0x13'));var authService=require(_0xac18('0x14'));var qs=require(_0xac18('0x15'));var as=require(_0xac18('0x16'));var hardwareService=require(_0xac18('0x17'));var logger=require(_0xac18('0x18'))('api');var utils=require(_0xac18('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xac18('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567d8d,_0x215482){_0x215482=_0x215482||0xcc;return function(_0x53b975){if(_0x53b975){return _0x567d8d['sendStatus'](_0x215482);}return _0x567d8d[_0xac18('0x1b')](_0x215482)[_0xac18('0x1c')]();};}function respondWithResult(_0x4a7219,_0x1e6150){_0x1e6150=_0x1e6150||0xc8;return function(_0x33eb5a){if(_0x33eb5a){return _0x4a7219['status'](_0x1e6150)[_0xac18('0x1d')](_0x33eb5a);}};}function respondWithFilteredResult(_0x518187,_0x362b31){return function(_0x550438){if(_0x550438){var _0x4a747c=typeof _0x362b31[_0xac18('0x1e')]===_0xac18('0x1f')&&typeof _0x362b31['limit']==='undefined';var _0x436009=_0x550438[_0xac18('0x20')];var _0x506819=_0x4a747c?0x0:_0x362b31[_0xac18('0x1e')];var _0x98b7d3=_0x4a747c?_0x550438[_0xac18('0x20')]:_0x362b31[_0xac18('0x1e')]+_0x362b31[_0xac18('0x21')];var _0x3666d0;if(_0x98b7d3>=_0x436009){_0x98b7d3=_0x436009;_0x3666d0=0xc8;}else{_0x3666d0=0xce;}_0x518187[_0xac18('0x1b')](_0x3666d0);return _0x518187['set'](_0xac18('0x22'),_0x506819+'-'+_0x98b7d3+'/'+_0x436009)[_0xac18('0x1d')](_0x550438);}return null;};}function patchUpdates(_0x3f6498){return function(_0xbcd5fd){try{jsonpatch[_0xac18('0x23')](_0xbcd5fd,_0x3f6498,!![]);}catch(_0x4a55c0){return BPromise[_0xac18('0x24')](_0x4a55c0);}return _0xbcd5fd[_0xac18('0x25')]();};}function saveUpdates(_0x3924a7,_0x147a03){return function(_0x4f2f18){if(_0x4f2f18){return _0x4f2f18[_0xac18('0x26')](_0x3924a7)[_0xac18('0x27')](function(_0x2c10f3){return _0x2c10f3;});}return null;};}function removeEntity(_0x2c5b19,_0x20d639){return function(_0x204a05){if(_0x204a05){return _0x204a05['destroy']()[_0xac18('0x27')](function(){_0x2c5b19[_0xac18('0x1b')](0xcc)[_0xac18('0x1c')]();});}};}function handleEntityNotFound(_0x53fd81,_0x2d2f69){return function(_0x302b23){if(!_0x302b23){_0x53fd81[_0xac18('0x28')](0x194);}return _0x302b23;};}function handleError(_0x39086e,_0x3e3202){_0x3e3202=_0x3e3202||0x1f4;return function(_0x1aae67){logger[_0xac18('0x29')](_0x1aae67[_0xac18('0x2a')]);if(_0x1aae67['name']){delete _0x1aae67[_0xac18('0x2b')];}_0x39086e[_0xac18('0x1b')](_0x3e3202)['send'](_0x1aae67);};}exports[_0xac18('0x2c')]=function(_0x65f692,_0x14d74a){var _0x2d1492={'raw':!![],'where':{'id':_0x65f692[_0xac18('0x2d')]['id']}},_0xb710bb={};_0xb710bb[_0xac18('0x2e')]=_[_0xac18('0x2f')](db[_0xac18('0x30')][_0xac18('0x31')]);_0xb710bb[_0xac18('0x32')]=_['keys'](_0x65f692['query']);_0xb710bb[_0xac18('0x33')]=_[_0xac18('0x34')](_0xb710bb[_0xac18('0x2e')],_0xb710bb['query']);_0x2d1492[_0xac18('0x35')]=_[_0xac18('0x34')](_0xb710bb[_0xac18('0x2e')],qs[_0xac18('0x36')](_0x65f692[_0xac18('0x32')]['fields']));_0x2d1492[_0xac18('0x35')]=_0x2d1492[_0xac18('0x35')]['length']?_0x2d1492[_0xac18('0x35')]:_0xb710bb[_0xac18('0x2e')];if(_0x65f692['query'][_0xac18('0x37')]){_0x2d1492[_0xac18('0x38')]=[{'all':!![]}];}_0x2d1492=_[_0xac18('0x39')]({},_0x2d1492,_0x65f692[_0xac18('0x3a')]);return db[_0xac18('0x30')][_0xac18('0x3b')](_0x2d1492)[_0xac18('0x27')](handleEntityNotFound(_0x14d74a,null))[_0xac18('0x27')](respondWithResult(_0x14d74a,null))[_0xac18('0x3c')](handleError(_0x14d74a,null));};exports['create']=function(_0x38b847,_0x3c318c){return db[_0xac18('0x30')][_0xac18('0x3d')](_0x38b847[_0xac18('0x3e')],{})[_0xac18('0x27')](respondWithResult(_0x3c318c,0xc9))[_0xac18('0x3c')](handleError(_0x3c318c,null));};exports[_0xac18('0x26')]=function(_0x2404de,_0x678f26){if(_0x2404de['body']['id']){delete _0x2404de['body']['id'];}return db[_0xac18('0x30')][_0xac18('0x3b')]({'where':{'id':_0x2404de['params']['id']}})[_0xac18('0x27')](handleEntityNotFound(_0x678f26,null))['then'](saveUpdates(_0x2404de[_0xac18('0x3e')],null))['then'](respondWithResult(_0x678f26,null))[_0xac18('0x3c')](handleError(_0x678f26,null));};exports[_0xac18('0x3f')]=function(_0x5d1721,_0x4ed58d){return db['ChatProactiveAction']['find']({'where':{'id':_0x5d1721['params']['id']}})[_0xac18('0x27')](handleEntityNotFound(_0x4ed58d,null))['then'](removeEntity(_0x4ed58d,null))[_0xac18('0x3c')](handleError(_0x4ed58d,null));}; \ No newline at end of file +var _0xf4d9=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','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','destroy','then','sendStatus','error','stack','name','send','model','keys','ChatProactiveAction','query','attributes','intersection','fields','length','includeAll','merge','options','catch','create','body','find','params'];(function(_0x1c6f9c,_0x3bbf9f){var _0x480396=function(_0x23fd04){while(--_0x23fd04){_0x1c6f9c['push'](_0x1c6f9c['shift']());}};_0x480396(++_0x3bbf9f);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x1af0f1,_0x54b4df){_0x1af0f1=_0x1af0f1-0x0;var _0x384bce=_0xf4d9[_0x1af0f1];return _0x384bce;};'use strict';var emlformat=require(_0x9f4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f4d('0x1'));var jsonpatch=require(_0x9f4d('0x2'));var rp=require(_0x9f4d('0x3'));var moment=require(_0x9f4d('0x4'));var BPromise=require(_0x9f4d('0x5'));var Mustache=require('mustache');var util=require(_0x9f4d('0x6'));var path=require(_0x9f4d('0x7'));var sox=require(_0x9f4d('0x8'));var csv=require('to-csv');var ejs=require(_0x9f4d('0x9'));var fs=require('fs');var fs_extra=require(_0x9f4d('0xa'));var _=require(_0x9f4d('0xb'));var squel=require('squel');var crypto=require(_0x9f4d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9f4d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9f4d('0xe'));var Papa=require(_0x9f4d('0xf'));var Redis=require(_0x9f4d('0x10'));var authService=require(_0x9f4d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9f4d('0x12'));var hardwareService=require(_0x9f4d('0x13'));var logger=require(_0x9f4d('0x14'))(_0x9f4d('0x15'));var utils=require(_0x9f4d('0x16'));var config=require(_0x9f4d('0x17'));var licenseUtil=require(_0x9f4d('0x18'));var db=require(_0x9f4d('0x19'))['db'];function respondWithStatusCode(_0x13c6fc,_0x112a7d){_0x112a7d=_0x112a7d||0xcc;return function(_0xfb475c){if(_0xfb475c){return _0x13c6fc['sendStatus'](_0x112a7d);}return _0x13c6fc[_0x9f4d('0x1a')](_0x112a7d)[_0x9f4d('0x1b')]();};}function respondWithResult(_0x35e7d4,_0x581e17){_0x581e17=_0x581e17||0xc8;return function(_0x12d180){if(_0x12d180){return _0x35e7d4[_0x9f4d('0x1a')](_0x581e17)[_0x9f4d('0x1c')](_0x12d180);}};}function respondWithFilteredResult(_0x178d8e,_0x514c01){return function(_0x4c8197){if(_0x4c8197){var _0x50534f=typeof _0x514c01[_0x9f4d('0x1d')]===_0x9f4d('0x1e')&&typeof _0x514c01[_0x9f4d('0x1f')]===_0x9f4d('0x1e');var _0x214195=_0x4c8197[_0x9f4d('0x20')];var _0x4f8bb9=_0x50534f?0x0:_0x514c01[_0x9f4d('0x1d')];var _0x3e0b7d=_0x50534f?_0x4c8197[_0x9f4d('0x20')]:_0x514c01[_0x9f4d('0x1d')]+_0x514c01[_0x9f4d('0x1f')];var _0x566d56;if(_0x3e0b7d>=_0x214195){_0x3e0b7d=_0x214195;_0x566d56=0xc8;}else{_0x566d56=0xce;}_0x178d8e[_0x9f4d('0x1a')](_0x566d56);return _0x178d8e[_0x9f4d('0x21')](_0x9f4d('0x22'),_0x4f8bb9+'-'+_0x3e0b7d+'/'+_0x214195)[_0x9f4d('0x1c')](_0x4c8197);}return null;};}function patchUpdates(_0x30577b){return function(_0x14cd44){try{jsonpatch[_0x9f4d('0x23')](_0x14cd44,_0x30577b,!![]);}catch(_0x3917ec){return BPromise[_0x9f4d('0x24')](_0x3917ec);}return _0x14cd44[_0x9f4d('0x25')]();};}function saveUpdates(_0x4f8c11,_0x5bc6ea){return function(_0xc4fd4){if(_0xc4fd4){return _0xc4fd4[_0x9f4d('0x26')](_0x4f8c11)['then'](function(_0x123fd2){return _0x123fd2;});}return null;};}function removeEntity(_0xa900ce,_0x392f65){return function(_0x3e9818){if(_0x3e9818){return _0x3e9818[_0x9f4d('0x27')]()[_0x9f4d('0x28')](function(){_0xa900ce[_0x9f4d('0x1a')](0xcc)[_0x9f4d('0x1b')]();});}};}function handleEntityNotFound(_0x1c1c9f,_0x5a1d6b){return function(_0x3c4541){if(!_0x3c4541){_0x1c1c9f[_0x9f4d('0x29')](0x194);}return _0x3c4541;};}function handleError(_0x46daca,_0x5b126a){_0x5b126a=_0x5b126a||0x1f4;return function(_0x74fa29){logger[_0x9f4d('0x2a')](_0x74fa29[_0x9f4d('0x2b')]);if(_0x74fa29[_0x9f4d('0x2c')]){delete _0x74fa29[_0x9f4d('0x2c')];}_0x46daca[_0x9f4d('0x1a')](_0x5b126a)[_0x9f4d('0x2d')](_0x74fa29);};}exports['show']=function(_0x4eb918,_0x461ebf){var _0x56b90a={'raw':!![],'where':{'id':_0x4eb918['params']['id']}},_0x16db57={};_0x16db57[_0x9f4d('0x2e')]=_[_0x9f4d('0x2f')](db[_0x9f4d('0x30')]['rawAttributes']);_0x16db57[_0x9f4d('0x31')]=_['keys'](_0x4eb918[_0x9f4d('0x31')]);_0x16db57['filters']=_['intersection'](_0x16db57[_0x9f4d('0x2e')],_0x16db57[_0x9f4d('0x31')]);_0x56b90a[_0x9f4d('0x32')]=_[_0x9f4d('0x33')](_0x16db57[_0x9f4d('0x2e')],qs[_0x9f4d('0x34')](_0x4eb918[_0x9f4d('0x31')]['fields']));_0x56b90a[_0x9f4d('0x32')]=_0x56b90a[_0x9f4d('0x32')][_0x9f4d('0x35')]?_0x56b90a[_0x9f4d('0x32')]:_0x16db57[_0x9f4d('0x2e')];if(_0x4eb918[_0x9f4d('0x31')][_0x9f4d('0x36')]){_0x56b90a['include']=[{'all':!![]}];}_0x56b90a=_[_0x9f4d('0x37')]({},_0x56b90a,_0x4eb918[_0x9f4d('0x38')]);return db[_0x9f4d('0x30')]['find'](_0x56b90a)[_0x9f4d('0x28')](handleEntityNotFound(_0x461ebf,null))[_0x9f4d('0x28')](respondWithResult(_0x461ebf,null))[_0x9f4d('0x39')](handleError(_0x461ebf,null));};exports[_0x9f4d('0x3a')]=function(_0xb29b50,_0x1c0fde){return db[_0x9f4d('0x30')][_0x9f4d('0x3a')](_0xb29b50[_0x9f4d('0x3b')],{})[_0x9f4d('0x28')](respondWithResult(_0x1c0fde,0xc9))[_0x9f4d('0x39')](handleError(_0x1c0fde,null));};exports['update']=function(_0x2bc3b5,_0x32eefe){if(_0x2bc3b5[_0x9f4d('0x3b')]['id']){delete _0x2bc3b5[_0x9f4d('0x3b')]['id'];}return db[_0x9f4d('0x30')][_0x9f4d('0x3c')]({'where':{'id':_0x2bc3b5[_0x9f4d('0x3d')]['id']}})[_0x9f4d('0x28')](handleEntityNotFound(_0x32eefe,null))[_0x9f4d('0x28')](saveUpdates(_0x2bc3b5[_0x9f4d('0x3b')],null))[_0x9f4d('0x28')](respondWithResult(_0x32eefe,null))[_0x9f4d('0x39')](handleError(_0x32eefe,null));};exports['destroy']=function(_0x440d05,_0x3d5f26){return db[_0x9f4d('0x30')][_0x9f4d('0x3c')]({'where':{'id':_0x440d05[_0x9f4d('0x3d')]['id']}})[_0x9f4d('0x28')](handleEntityNotFound(_0x3d5f26,null))['then'](removeEntity(_0x3d5f26,null))[_0x9f4d('0x39')](handleError(_0x3d5f26,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 9c613da..d5637f8 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 _0x6726=['../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4316ba,_0x2d6196){var _0x3113ba=function(_0x30f009){while(--_0x30f009){_0x4316ba['push'](_0x4316ba['shift']());}};_0x3113ba(++_0x2d6196);}(_0x6726,0x1c0));var _0x6672=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x6726[_0x53e3fa];return _0xe8584a;};'use strict';var _=require(_0x6672('0x0'));var util=require(_0x6672('0x1'));var logger=require(_0x6672('0x2'))(_0x6672('0x3'));var moment=require(_0x6672('0x4'));var BPromise=require(_0x6672('0x5'));var rp=require(_0x6672('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6672('0x7'));var config=require(_0x6672('0x8'));var attributes=require(_0x6672('0x9'));module['exports']=function(_0xa23ceb,_0x3b5014){return _0xa23ceb[_0x6672('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x6672('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36b3=['ChatProactiveAction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x36b3,0x1cf));var _0x336b=function(_0x3eef61,_0x134d16){_0x3eef61=_0x3eef61-0x0;var _0x43289b=_0x36b3[_0x3eef61];return _0x43289b;};'use strict';var _=require(_0x336b('0x0'));var util=require(_0x336b('0x1'));var logger=require(_0x336b('0x2'))(_0x336b('0x3'));var moment=require(_0x336b('0x4'));var BPromise=require(_0x336b('0x5'));var rp=require(_0x336b('0x6'));var fs=require('fs');var path=require(_0x336b('0x7'));var rimraf=require(_0x336b('0x8'));var config=require(_0x336b('0x9'));var attributes=require(_0x336b('0xa'));module[_0x336b('0xb')]=function(_0x480a16,_0x3431fa){return _0x480a16[_0x336b('0xc')](_0x336b('0xd'),attributes,{'tableName':'chat_proactive_actions','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 1c3b99c..1ec3e46 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 _0xa881=['request\x20sent','stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s'];(function(_0x39fc31,_0x373ae0){var _0x4d90f8=function(_0x1e6313){while(--_0x1e6313){_0x39fc31['push'](_0x39fc31['shift']());}};_0x4d90f8(++_0x373ae0);}(_0xa881,0x16f));var _0x1a88=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa881[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1a88('0x0'));var util=require(_0x1a88('0x1'));var moment=require(_0x1a88('0x2'));var BPromise=require(_0x1a88('0x3'));var rs=require(_0x1a88('0x4'));var fs=require('fs');var Redis=require(_0x1a88('0x5'));var db=require(_0x1a88('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a88('0x7'))('rpc');var config=require(_0x1a88('0x8'));var jayson=require(_0x1a88('0x9'));var client=jayson[_0x1a88('0xa')][_0x1a88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x695df7,_0x527db6,_0x47e9f9){return new BPromise(function(_0x4d8af8,_0x2c83bf){return client[_0x1a88('0xc')](_0x695df7,_0x47e9f9)[_0x1a88('0xd')](function(_0x3f4516){logger[_0x1a88('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x527db6,'request\x20sent');logger[_0x1a88('0xf')](_0x1a88('0x10'),_0x527db6,_0x1a88('0x11'),JSON[_0x1a88('0x12')](_0x3f4516));if(_0x3f4516[_0x1a88('0x13')]){if(_0x3f4516[_0x1a88('0x13')][_0x1a88('0x14')]===0x1f4){logger[_0x1a88('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x527db6,_0x3f4516[_0x1a88('0x13')][_0x1a88('0x15')]);return _0x2c83bf(_0x3f4516[_0x1a88('0x13')][_0x1a88('0x15')]);}logger['error'](_0x1a88('0x16'),_0x527db6,_0x3f4516[_0x1a88('0x13')]['message']);return _0x4d8af8(_0x3f4516[_0x1a88('0x13')]['message']);}else{logger[_0x1a88('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x527db6,_0x1a88('0x11'));_0x4d8af8(_0x3f4516[_0x1a88('0x17')]['message']);}})['catch'](function(_0x280525){logger['error'](_0x1a88('0x16'),_0x527db6,_0x280525);_0x2c83bf(_0x280525);});});} \ No newline at end of file +var _0xd75e=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x28b2ed,_0x2c3542){var _0x284451=function(_0x22d38a){while(--_0x22d38a){_0x28b2ed['push'](_0x28b2ed['shift']());}};_0x284451(++_0x2c3542);}(_0xd75e,0x16c));var _0xed75=function(_0x320ebc,_0x3bd622){_0x320ebc=_0x320ebc-0x0;var _0x3f6065=_0xd75e[_0x320ebc];return _0x3f6065;};'use strict';var _=require(_0xed75('0x0'));var util=require(_0xed75('0x1'));var moment=require(_0xed75('0x2'));var BPromise=require('bluebird');var rs=require(_0xed75('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed75('0x4'));var logger=require(_0xed75('0x5'))(_0xed75('0x6'));var config=require('../../config/environment');var jayson=require(_0xed75('0x7'));var client=jayson['client'][_0xed75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e11ce,_0x5b32a8,_0x53dd74){return new BPromise(function(_0x1be580,_0x3da430){return client[_0xed75('0x9')](_0x4e11ce,_0x53dd74)[_0xed75('0xa')](function(_0x2df11e){logger[_0xed75('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x5b32a8,_0xed75('0xc'));logger[_0xed75('0xd')](_0xed75('0xe'),_0x5b32a8,'request\x20sent',JSON[_0xed75('0xf')](_0x2df11e));if(_0x2df11e[_0xed75('0x10')]){if(_0x2df11e[_0xed75('0x10')]['code']===0x1f4){logger[_0xed75('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x5b32a8,_0x2df11e[_0xed75('0x10')][_0xed75('0x11')]);return _0x3da430(_0x2df11e['error'][_0xed75('0x11')]);}logger[_0xed75('0x10')](_0xed75('0x12'),_0x5b32a8,_0x2df11e['error'][_0xed75('0x11')]);return _0x1be580(_0x2df11e['error'][_0xed75('0x11')]);}else{logger['info'](_0xed75('0x12'),_0x5b32a8,_0xed75('0xc'));_0x1be580(_0x2df11e[_0xed75('0x13')]['message']);}})[_0xed75('0x14')](function(_0x55f72c){logger[_0xed75('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x5b32a8,_0x55f72c);_0x3da430(_0x55f72c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 492934c..1b2fcb8 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 _0x5075=['show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated'];(function(_0x3af04a,_0x36494a){var _0x4d3479=function(_0x259ba9){while(--_0x259ba9){_0x3af04a['push'](_0x3af04a['shift']());}};_0x4d3479(++_0x36494a);}(_0x5075,0x73));var _0x5507=function(_0x19e9a7,_0x57e686){_0x19e9a7=_0x19e9a7-0x0;var _0x3a8442=_0x5075[_0x19e9a7];return _0x3a8442;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/:id',auth[_0x5507('0xa')](),controller[_0x5507('0xb')]);router['post']('/',auth[_0x5507('0xa')](),controller[_0x5507('0xc')]);router[_0x5507('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')](_0x5507('0x10'),auth[_0x5507('0xa')](),controller['destroy']);module[_0x5507('0x11')]=router; \ No newline at end of file +var _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xeff8,0x186));var _0x8eff=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xeff8[_0x18abd2];return _0x1dcad6;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index d704440..2369882 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 _0x8de6=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xfc71a8,_0x464a6f){var _0x15ede8=function(_0x20e4a7){while(--_0x20e4a7){_0xfc71a8['push'](_0xfc71a8['shift']());}};_0x15ede8(++_0x464a6f);}(_0x8de6,0xf6));var _0x68de=function(_0x5e83ec,_0x5abaaf){_0x5e83ec=_0x5e83ec-0x0;var _0x43c08c=_0x8de6[_0x5e83ec];return _0x43c08c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x68de('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x68de('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68de('0x2')](_0x68de('0x3'),_0x68de('0x4'),_0x68de('0x5'))}}; \ No newline at end of file +var _0xfce5=['STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4014e1,_0x4b210b){var _0x9a7cb0=function(_0xea6502){while(--_0xea6502){_0x4014e1['push'](_0x4014e1['shift']());}};_0x9a7cb0(++_0x4b210b);}(_0xfce5,0x159));var _0x5fce=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xfce5[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5fce('0x0')]},'timeout':{'type':Sequelize[_0x5fce('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5fce('0x2')](_0x5fce('0x3'),_0x5fce('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 0a83405..ed785de 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 _0xf2b4=['Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','ChatQueue','findAll','rows','show','params','length','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','ChatQueueId','options','User','findAndCountAll','agent','updatedAt','createdAt','%s/%s','getTeams','findOne','Team','addTeams','ids'];(function(_0x18ea99,_0x5d0dc6){var _0x4e1a63=function(_0x560366){while(--_0x560366){_0x18ea99['push'](_0x18ea99['shift']());}};_0x4e1a63(++_0x5d0dc6);}(_0xf2b4,0xb9));var _0x4f2b=function(_0x2ebb2b,_0x1bc2af){_0x2ebb2b=_0x2ebb2b-0x0;var _0x2d8925=_0xf2b4[_0x2ebb2b];return _0x2d8925;};'use strict';var emlformat=require(_0x4f2b('0x0'));var rimraf=require(_0x4f2b('0x1'));var zipdir=require(_0x4f2b('0x2'));var jsonpatch=require(_0x4f2b('0x3'));var rp=require(_0x4f2b('0x4'));var moment=require(_0x4f2b('0x5'));var BPromise=require(_0x4f2b('0x6'));var Mustache=require(_0x4f2b('0x7'));var util=require('util');var path=require(_0x4f2b('0x8'));var sox=require(_0x4f2b('0x9'));var csv=require(_0x4f2b('0xa'));var ejs=require(_0x4f2b('0xb'));var fs=require('fs');var fs_extra=require(_0x4f2b('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f2b('0xd'));var toCsv=require(_0x4f2b('0xa'));var querystring=require(_0x4f2b('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f2b('0xf'));var authService=require(_0x4f2b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4f2b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f2b('0x12'))(_0x4f2b('0x13'));var utils=require(_0x4f2b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4f2b('0x15'));var db=require(_0x4f2b('0x16'))['db'];config[_0x4f2b('0x17')]=_['defaults'](config[_0x4f2b('0x17')],{'host':_0x4f2b('0x18'),'port':0x18eb});var socket=require(_0x4f2b('0x19'))(new Redis(config[_0x4f2b('0x17')]));require(_0x4f2b('0x1a'))[_0x4f2b('0x1b')](socket);var jayson=require(_0x4f2b('0x1c'));var client=jayson['client'][_0x4f2b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1a8357,_0x5b3787,_0x353447,_0x46077c){return new BPromise(function(_0x4e8a6e,_0x584cf9){var _0x2e5e14=_0x46077c||client;return _0x2e5e14[_0x4f2b('0x1e')](_0x1a8357,_0x353447)[_0x4f2b('0x1f')](function(_0x26eeac){logger[_0x4f2b('0x20')](_0x4f2b('0x21'),_0x5b3787,_0x4f2b('0x22'));logger[_0x4f2b('0x23')](_0x4f2b('0x24'),_0x5b3787,_0x4f2b('0x22'),JSON[_0x4f2b('0x25')](_0x26eeac));if(_0x26eeac[_0x4f2b('0x26')]){if(_0x26eeac['error'][_0x4f2b('0x27')]===0x1f4){logger[_0x4f2b('0x26')](_0x4f2b('0x21'),_0x5b3787,_0x26eeac[_0x4f2b('0x26')]['message']);return _0x584cf9(_0x26eeac[_0x4f2b('0x26')][_0x4f2b('0x28')]);}logger[_0x4f2b('0x26')](_0x4f2b('0x21'),_0x5b3787,_0x26eeac[_0x4f2b('0x26')][_0x4f2b('0x28')]);return _0x4e8a6e(_0x26eeac[_0x4f2b('0x26')][_0x4f2b('0x28')]);}else{logger[_0x4f2b('0x20')](_0x4f2b('0x21'),_0x5b3787,_0x4f2b('0x22'));_0x4e8a6e(_0x26eeac[_0x4f2b('0x29')][_0x4f2b('0x28')]);}})['catch'](function(_0x304c5b){logger[_0x4f2b('0x26')](_0x4f2b('0x21'),_0x5b3787,_0x304c5b);_0x584cf9(_0x304c5b);});});}function respondWithStatusCode(_0x2ee1f4,_0x507144){_0x507144=_0x507144||0xcc;return function(_0x45777f){if(_0x45777f){return _0x2ee1f4['sendStatus'](_0x507144);}return _0x2ee1f4[_0x4f2b('0x2a')](_0x507144)[_0x4f2b('0x2b')]();};}function respondWithResult(_0x1ae12f,_0x1c750a){_0x1c750a=_0x1c750a||0xc8;return function(_0x109481){if(_0x109481){return _0x1ae12f[_0x4f2b('0x2a')](_0x1c750a)[_0x4f2b('0x2c')](_0x109481);}};}function respondWithFilteredResult(_0x9a0ec,_0x4cc472){return function(_0x219e80){if(_0x219e80){var _0x22a554=typeof _0x4cc472[_0x4f2b('0x2d')]===_0x4f2b('0x2e')&&typeof _0x4cc472[_0x4f2b('0x2f')]==='undefined';var _0x13c8f3=_0x219e80[_0x4f2b('0x30')];var _0x9c1c78=_0x22a554?0x0:_0x4cc472[_0x4f2b('0x2d')];var _0x572ffe=_0x22a554?_0x219e80[_0x4f2b('0x30')]:_0x4cc472[_0x4f2b('0x2d')]+_0x4cc472['limit'];var _0x5dfac9;if(_0x572ffe>=_0x13c8f3){_0x572ffe=_0x13c8f3;_0x5dfac9=0xc8;}else{_0x5dfac9=0xce;}_0x9a0ec[_0x4f2b('0x2a')](_0x5dfac9);return _0x9a0ec[_0x4f2b('0x31')](_0x4f2b('0x32'),_0x9c1c78+'-'+_0x572ffe+'/'+_0x13c8f3)[_0x4f2b('0x2c')](_0x219e80);}return null;};}function patchUpdates(_0x53d510){return function(_0x310caa){try{jsonpatch[_0x4f2b('0x33')](_0x310caa,_0x53d510,!![]);}catch(_0x5977b2){return BPromise[_0x4f2b('0x34')](_0x5977b2);}return _0x310caa[_0x4f2b('0x35')]();};}function saveUpdates(_0xfbe7e,_0x3d9ff6){return function(_0x244afd){if(_0x244afd){return _0x244afd[_0x4f2b('0x36')](_0xfbe7e)['then'](function(_0x243457){return _0x243457;});}return null;};}function removeEntity(_0x3356ef,_0x5e59d4){return function(_0x355fe6){if(_0x355fe6){return _0x355fe6[_0x4f2b('0x37')]()[_0x4f2b('0x1f')](function(){var _0x551f14=_0x355fe6[_0x4f2b('0x38')]({'plain':!![]});var _0x37ba44=_0x4f2b('0x39');return db[_0x4f2b('0x3a')][_0x4f2b('0x37')]({'where':{'type':_0x37ba44,'resourceId':_0x551f14['id']}})['then'](function(){return _0x355fe6;});})[_0x4f2b('0x1f')](function(){_0x3356ef[_0x4f2b('0x2a')](0xcc)[_0x4f2b('0x2b')]();});}};}function handleEntityNotFound(_0xd0676d,_0x70f24d){return function(_0x25f0fa){if(!_0x25f0fa){_0xd0676d[_0x4f2b('0x3b')](0x194);}return _0x25f0fa;};}function handleError(_0x3328a8,_0x4a90f4){_0x4a90f4=_0x4a90f4||0x1f4;return function(_0xfd6c31){logger[_0x4f2b('0x26')](_0xfd6c31[_0x4f2b('0x3c')]);if(_0xfd6c31[_0x4f2b('0x3d')]){delete _0xfd6c31['name'];}_0x3328a8[_0x4f2b('0x2a')](_0x4a90f4)['send'](_0xfd6c31);};}exports[_0x4f2b('0x3e')]=function(_0xea6278,_0x346e60){var _0x3b3c2b={},_0x172a40={},_0x85f6f2={'count':0x0,'rows':[]};var _0xc8d89a=_[_0x4f2b('0x3f')](db['ChatQueue'][_0x4f2b('0x40')],function(_0x39dca6){return{'name':_0x39dca6[_0x4f2b('0x41')],'type':_0x39dca6[_0x4f2b('0x42')]['key']};});_0x172a40['model']=_[_0x4f2b('0x3f')](_0xc8d89a,_0x4f2b('0x3d'));_0x172a40['query']=_[_0x4f2b('0x43')](_0xea6278[_0x4f2b('0x44')]);_0x172a40[_0x4f2b('0x45')]=_[_0x4f2b('0x46')](_0x172a40['model'],_0x172a40[_0x4f2b('0x44')]);_0x3b3c2b['attributes']=_[_0x4f2b('0x46')](_0x172a40[_0x4f2b('0x47')],qs[_0x4f2b('0x48')](_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x48')]));_0x3b3c2b[_0x4f2b('0x49')]=_0x3b3c2b[_0x4f2b('0x49')]['length']?_0x3b3c2b[_0x4f2b('0x49')]:_0x172a40[_0x4f2b('0x47')];if(!_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x4a')](_0x4f2b('0x4b'))){_0x3b3c2b[_0x4f2b('0x2f')]=qs['limit'](_0xea6278['query'][_0x4f2b('0x2f')]);_0x3b3c2b[_0x4f2b('0x2d')]=qs['offset'](_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x2d')]);}_0x3b3c2b[_0x4f2b('0x4c')]=qs['sort'](_0xea6278['query'][_0x4f2b('0x4d')]);_0x3b3c2b[_0x4f2b('0x4e')]=qs[_0x4f2b('0x45')](_[_0x4f2b('0x4f')](_0xea6278[_0x4f2b('0x44')],_0x172a40[_0x4f2b('0x45')]),_0xc8d89a);if(_0xea6278['query'][_0x4f2b('0x50')]){_0x3b3c2b[_0x4f2b('0x4e')]=_[_0x4f2b('0x51')](_0x3b3c2b['where'],{'$or':_[_0x4f2b('0x3f')](_0xc8d89a,function(_0x357fc9){if(_0x357fc9[_0x4f2b('0x42')]!==_0x4f2b('0x52')){var _0x1a97f4={};_0x1a97f4[_0x357fc9[_0x4f2b('0x3d')]]={'$like':'%'+_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x50')]+'%'};return _0x1a97f4;}})});}_0x3b3c2b=_['merge']({},_0x3b3c2b,_0xea6278['options']);var _0x340400={'where':_0x3b3c2b[_0x4f2b('0x4e')]};return db['ChatQueue'][_0x4f2b('0x30')](_0x340400)['then'](function(_0x5cfba6){_0x85f6f2[_0x4f2b('0x30')]=_0x5cfba6;if(_0xea6278[_0x4f2b('0x44')][_0x4f2b('0x53')]){_0x3b3c2b['include']=[{'all':!![]}];}return db[_0x4f2b('0x54')][_0x4f2b('0x55')](_0x3b3c2b);})[_0x4f2b('0x1f')](function(_0x11bbbf){_0x85f6f2[_0x4f2b('0x56')]=_0x11bbbf;return _0x85f6f2;})['then'](respondWithFilteredResult(_0x346e60,_0x3b3c2b))['catch'](handleError(_0x346e60,null));};exports[_0x4f2b('0x57')]=function(_0x417c3d,_0x16a0d2){var _0x47e08d={'raw':!![],'where':{'id':_0x417c3d[_0x4f2b('0x58')]['id']}},_0x413ba6={};_0x413ba6[_0x4f2b('0x47')]=_['keys'](db['ChatQueue'][_0x4f2b('0x40')]);_0x413ba6['query']=_[_0x4f2b('0x43')](_0x417c3d[_0x4f2b('0x44')]);_0x413ba6[_0x4f2b('0x45')]=_[_0x4f2b('0x46')](_0x413ba6[_0x4f2b('0x47')],_0x413ba6[_0x4f2b('0x44')]);_0x47e08d[_0x4f2b('0x49')]=_['intersection'](_0x413ba6[_0x4f2b('0x47')],qs[_0x4f2b('0x48')](_0x417c3d['query'][_0x4f2b('0x48')]));_0x47e08d[_0x4f2b('0x49')]=_0x47e08d['attributes'][_0x4f2b('0x59')]?_0x47e08d[_0x4f2b('0x49')]:_0x413ba6[_0x4f2b('0x47')];if(_0x417c3d[_0x4f2b('0x44')][_0x4f2b('0x53')]){_0x47e08d[_0x4f2b('0x5a')]=[{'all':!![]}];}_0x47e08d=_[_0x4f2b('0x51')]({},_0x47e08d,_0x417c3d['options']);return db[_0x4f2b('0x54')]['find'](_0x47e08d)[_0x4f2b('0x1f')](handleEntityNotFound(_0x16a0d2,null))[_0x4f2b('0x1f')](respondWithResult(_0x16a0d2,null))[_0x4f2b('0x5b')](handleError(_0x16a0d2,null));};exports[_0x4f2b('0x5c')]=function(_0x645732,_0x444059){return db[_0x4f2b('0x54')][_0x4f2b('0x5c')](_0x645732[_0x4f2b('0x5d')],{})['then'](function(_0x428843){var _0x4399d5=_0x645732[_0x4f2b('0x5e')][_0x4f2b('0x38')]({'plain':!![]});if(!_0x4399d5)throw new Error(_0x4f2b('0x5f'));if(_0x4399d5[_0x4f2b('0x60')]===_0x4f2b('0x5e')){var _0x301e81=_0x428843['get']({'plain':!![]});var _0x3d181f='ChatQueues';return db['UserProfileSection'][_0x4f2b('0x61')]({'where':{'name':_0x3d181f,'userProfileId':_0x4399d5[_0x4f2b('0x62')]},'raw':!![]})[_0x4f2b('0x1f')](function(_0xce8776){if(_0xce8776&&_0xce8776[_0x4f2b('0x63')]===0x0){return db[_0x4f2b('0x3a')][_0x4f2b('0x5c')]({'name':_0x301e81['name'],'resourceId':_0x301e81['id'],'type':_0xce8776[_0x4f2b('0x3d')],'sectionId':_0xce8776['id']},{})[_0x4f2b('0x1f')](function(){return _0x428843;});}else{return _0x428843;}})['catch'](function(_0xae1273){logger['error'](_0x4f2b('0x64'),_0xae1273);throw _0xae1273;});}return _0x428843;})[_0x4f2b('0x1f')](respondWithResult(_0x444059,0xc9))[_0x4f2b('0x5b')](handleError(_0x444059,null));};exports['update']=function(_0x197494,_0x2a104e){if(_0x197494[_0x4f2b('0x5d')]['id']){delete _0x197494[_0x4f2b('0x5d')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x197494[_0x4f2b('0x58')]['id']}})['then'](handleEntityNotFound(_0x2a104e,null))[_0x4f2b('0x1f')](saveUpdates(_0x197494[_0x4f2b('0x5d')],null))[_0x4f2b('0x1f')](respondWithResult(_0x2a104e,null))[_0x4f2b('0x5b')](handleError(_0x2a104e,null));};exports[_0x4f2b('0x37')]=function(_0x3dcf12,_0x380604){return db['ChatQueue'][_0x4f2b('0x61')]({'where':{'id':_0x3dcf12['params']['id']}})[_0x4f2b('0x1f')](handleEntityNotFound(_0x380604,null))[_0x4f2b('0x1f')](removeEntity(_0x380604,null))[_0x4f2b('0x5b')](handleError(_0x380604,null));};exports[_0x4f2b('0x65')]=function(_0x430769,_0x1294a3){return db['ChatQueue'][_0x4f2b('0x65')]()['then'](respondWithResult(_0x1294a3,null))[_0x4f2b('0x5b')](handleError(_0x1294a3,null));};exports[_0x4f2b('0x66')]=function(_0x3b3565,_0x1dc1d5,_0x52e8d3){var _0x1b9811={'raw':!![],'where':{}},_0x463083={},_0x4e2b7c;return db[_0x4f2b('0x54')]['findOne']({'where':{'id':_0x3b3565[_0x4f2b('0x58')]['id']}})['then'](handleEntityNotFound(_0x1dc1d5,null))[_0x4f2b('0x1f')](function(_0x4507c6){if(_0x4507c6){_0x4e2b7c=_0x4507c6[_0x4f2b('0x38')]({'plain':!![]});_0x463083[_0x4f2b('0x47')]=_[_0x4f2b('0x43')](db[_0x4f2b('0x67')][_0x4f2b('0x40')]);_0x463083[_0x4f2b('0x44')]=_['keys'](_0x3b3565[_0x4f2b('0x44')]);_0x463083['filters']=_['intersection'](_0x463083['model'],_0x463083['query']);_0x1b9811['attributes']=_[_0x4f2b('0x46')](_0x463083[_0x4f2b('0x47')],qs[_0x4f2b('0x48')](_0x3b3565['query'][_0x4f2b('0x48')]));_0x1b9811[_0x4f2b('0x49')]=_0x1b9811['attributes'][_0x4f2b('0x59')]?_0x1b9811[_0x4f2b('0x49')]:_0x463083[_0x4f2b('0x47')];if(!_0x3b3565[_0x4f2b('0x44')]['hasOwnProperty'](_0x4f2b('0x4b'))){_0x1b9811[_0x4f2b('0x2f')]=qs[_0x4f2b('0x2f')](_0x3b3565[_0x4f2b('0x44')][_0x4f2b('0x2f')]);_0x1b9811[_0x4f2b('0x2d')]=qs[_0x4f2b('0x2d')](_0x3b3565[_0x4f2b('0x44')][_0x4f2b('0x2d')]);}_0x1b9811[_0x4f2b('0x4c')]=qs[_0x4f2b('0x4d')](_0x3b3565['query'][_0x4f2b('0x4d')]);_0x1b9811[_0x4f2b('0x4e')]=qs[_0x4f2b('0x45')](_[_0x4f2b('0x4f')](_0x3b3565[_0x4f2b('0x44')],_0x463083[_0x4f2b('0x45')]));_0x1b9811[_0x4f2b('0x4e')][_0x4f2b('0x68')]=_0x4507c6['id'];if(_0x3b3565[_0x4f2b('0x44')][_0x4f2b('0x50')]){_0x1b9811[_0x4f2b('0x4e')]=_[_0x4f2b('0x51')](_0x1b9811[_0x4f2b('0x4e')],{'$or':_['map'](_0x1b9811['attributes'],function(_0x3a5a13){var _0xf2d348={};_0xf2d348[_0x3a5a13]={'$like':'%'+_0x3b3565[_0x4f2b('0x44')][_0x4f2b('0x50')]+'%'};return _0xf2d348;})});}_0x1b9811=_['merge']({},_0x1b9811,_0x3b3565[_0x4f2b('0x69')]);return db[_0x4f2b('0x67')][_0x4f2b('0x55')](_0x1b9811);}})[_0x4f2b('0x1f')](function(_0x21e5ec){if(_0x21e5ec){return db[_0x4f2b('0x6a')][_0x4f2b('0x6b')]({'where':{'id':_[_0x4f2b('0x3f')](_0x21e5ec,'UserId'),'role':_0x4f2b('0x6c')},'attributes':['id',_0x4f2b('0x3d'),'chatPause',_0x4f2b('0x6d'),_0x4f2b('0x6e')]});}})[_0x4f2b('0x1f')](function(_0x37eb42){if(_0x37eb42){return{'count':_0x37eb42[_0x4f2b('0x30')],'rows':_[_0x4f2b('0x3f')](_0x37eb42[_0x4f2b('0x56')],function(_0x2cba8f){return{'membername':_0x2cba8f['name'],'UserId':_0x2cba8f['id'],'queue_name':_0x4e2b7c[_0x4f2b('0x3d')],'ChatQueueId':_0x4e2b7c['id'],'interface':util['format'](_0x4f2b('0x6f'),'SIP',_0x2cba8f[_0x4f2b('0x3d')]),'penalty':0x0,'paused':_0x2cba8f['chatPause'],'createdAt':_0x2cba8f['createdAt'],'updatedAt':_0x2cba8f[_0x4f2b('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4f2b('0x1f')](respondWithFilteredResult(_0x1dc1d5,_0x1b9811))['catch'](handleError(_0x1dc1d5,null));};exports[_0x4f2b('0x70')]=function(_0x30981d,_0x1f5ef0,_0x5c5e30){var _0x416da5={};var _0x19839e={};var _0x515365;var _0x1a31fe;return db['ChatQueue'][_0x4f2b('0x71')]({'where':{'id':_0x30981d[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](handleEntityNotFound(_0x1f5ef0,null))['then'](function(_0x5c2659){if(_0x5c2659){_0x515365=_0x5c2659;_0x19839e[_0x4f2b('0x47')]=_[_0x4f2b('0x43')](db[_0x4f2b('0x72')][_0x4f2b('0x40')]);_0x19839e['query']=_['keys'](_0x30981d[_0x4f2b('0x44')]);_0x19839e['filters']=_[_0x4f2b('0x46')](_0x19839e['model'],_0x19839e[_0x4f2b('0x44')]);_0x416da5[_0x4f2b('0x49')]=_[_0x4f2b('0x46')](_0x19839e['model'],qs[_0x4f2b('0x48')](_0x30981d[_0x4f2b('0x44')]['fields']));_0x416da5[_0x4f2b('0x49')]=_0x416da5[_0x4f2b('0x49')][_0x4f2b('0x59')]?_0x416da5[_0x4f2b('0x49')]:_0x19839e['model'];_0x416da5[_0x4f2b('0x4c')]=qs[_0x4f2b('0x4d')](_0x30981d[_0x4f2b('0x44')][_0x4f2b('0x4d')]);_0x416da5[_0x4f2b('0x4e')]=qs[_0x4f2b('0x45')](_[_0x4f2b('0x4f')](_0x30981d[_0x4f2b('0x44')],_0x19839e['filters']));if(_0x30981d[_0x4f2b('0x44')][_0x4f2b('0x50')]){_0x416da5[_0x4f2b('0x4e')]=_[_0x4f2b('0x51')](_0x416da5['where'],{'$or':_['map'](_0x416da5[_0x4f2b('0x49')],function(_0x5179d7){var _0x3bf0b7={};_0x3bf0b7[_0x5179d7]={'$like':'%'+_0x30981d[_0x4f2b('0x44')][_0x4f2b('0x50')]+'%'};return _0x3bf0b7;})});}_0x416da5=_['merge']({},_0x416da5,_0x30981d[_0x4f2b('0x69')]);return _0x515365[_0x4f2b('0x70')](_0x416da5);}})[_0x4f2b('0x1f')](function(_0x269754){if(_0x269754){_0x1a31fe=_0x269754[_0x4f2b('0x59')];if(!_0x30981d['query'][_0x4f2b('0x4a')]('nolimit')){_0x416da5[_0x4f2b('0x2f')]=qs['limit'](_0x30981d[_0x4f2b('0x44')][_0x4f2b('0x2f')]);_0x416da5[_0x4f2b('0x2d')]=qs['offset'](_0x30981d['query'][_0x4f2b('0x2d')]);}return _0x515365[_0x4f2b('0x70')](_0x416da5);}})[_0x4f2b('0x1f')](function(_0x5b8de3){if(_0x5b8de3){return _0x5b8de3?{'count':_0x1a31fe,'rows':_0x5b8de3}:null;}})['then'](respondWithResult(_0x1f5ef0,null))[_0x4f2b('0x5b')](handleError(_0x1f5ef0,null));};exports[_0x4f2b('0x73')]=function(_0x4d6067,_0x2bb02b,_0x561e8f){var _0x221f31=_0x4d6067[_0x4f2b('0x5d')][_0x4f2b('0x74')];return db['Team']['findAll']({'where':{'id':_0x221f31},'attributes':['id'],'include':[{'model':db[_0x4f2b('0x6a')],'as':_0x4f2b('0x75'),'attributes':['id',_0x4f2b('0x3d'),_0x4f2b('0x76'),'voicePause',_0x4f2b('0x77')],'raw':!![]}]})[_0x4f2b('0x1f')](function(_0x6f7798){if(_0x6f7798){var _0x4c664f=_[_0x4f2b('0x78')](_0x6f7798,function(_0x529d35){var _0x3ce7d6=_0x529d35[_0x4f2b('0x38')]({'plain':!![]});return _0x3ce7d6[_0x4f2b('0x75')];});return db[_0x4f2b('0x54')]['find']({'where':{'id':_0x4d6067[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](function(_0x3b733a){return db[_0x4f2b('0x79')][_0x4f2b('0x7a')](function(_0x2c4f31){return _0x3b733a[_0x4f2b('0x73')](_0x221f31,{'transaction':_0x2c4f31})[_0x4f2b('0x1f')](function(){return BPromise['each'](_0x4c664f,function(_0x194a11){return db[_0x4f2b('0x67')][_0x4f2b('0x7b')]({'where':{'UserId':_0x194a11['id'],'ChatQueueId':_0x4d6067[_0x4f2b('0x58')]['id']},'transaction':_0x2c4f31});});})[_0x4f2b('0x1f')](function(){_0x4c664f[_0x4f2b('0x7c')](function(_0x280c3c){socket[_0x4f2b('0x7d')](_0x4f2b('0x7e'),{'UserId':_0x280c3c['id'],'ChatQueueId':_0x3b733a['id']});});});});});}})[_0x4f2b('0x1f')](respondWithStatusCode(_0x2bb02b,null))[_0x4f2b('0x5b')](handleError(_0x2bb02b,null));};exports[_0x4f2b('0x7f')]=function(_0x3b6709,_0x2fbf34,_0x3d0d2d){return db[_0x4f2b('0x72')]['findAll']({'where':{'id':_0x3b6709[_0x4f2b('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4f2b('0x6a')],'as':_0x4f2b('0x75'),'attributes':['id'],'raw':!![]}]})[_0x4f2b('0x1f')](handleEntityNotFound(_0x2fbf34,null))[_0x4f2b('0x1f')](function(_0x369a38){var _0x5cc34e=_[_0x4f2b('0x3f')](_0x369a38,'id');var _0x27deb0=[];var _0x55cb31=[];var _0x2b8238=squel['select']();_0x2b8238[_0x4f2b('0x80')](_0x4f2b('0x81'))[_0x4f2b('0x82')](_0x4f2b('0x83'),'tq')[_0x4f2b('0x84')](_0x4f2b('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4f2b('0x4e')](_0x4f2b('0x86'),_0x3b6709['params']['id']);for(var _0x51e149=0x0;_0x51e149<_0x369a38[_0x4f2b('0x59')];_0x51e149+=0x1){let _0x1d9b91=_0x369a38[_0x51e149];for(var _0x2cd501=0x0;_0x2cd501<_0x1d9b91[_0x4f2b('0x75')][_0x4f2b('0x59')];_0x2cd501+=0x1){let _0x2bbf10=_0x1d9b91[_0x4f2b('0x75')][_0x2cd501];var _0x32de16=_0x2b8238[_0x4f2b('0x87')]();_0x32de16[_0x4f2b('0x4e')](_0x4f2b('0x88'),_0x2bbf10['id']);_0x55cb31['push'](db['sequelize']['query'](_0x32de16[_0x4f2b('0x89')](),{'type':db['sequelize'][_0x4f2b('0x8a')][_0x4f2b('0x8b')]})[_0x4f2b('0x1f')](function(_0x26acac){if(_0x26acac[_0x4f2b('0x59')]===0x1){return _0x2bbf10['id'];}else{var _0x4f6bf6=_[_0x4f2b('0x8c')](_['map'](_0x26acac,'TeamId'),function(_0x5050ab){return _[_0x4f2b('0x8d')](_0x5cc34e,_0x5050ab);});if(_0x4f6bf6){return _0x2bbf10['id'];}}}));}}return BPromise[_0x4f2b('0x8e')](_0x55cb31)[_0x4f2b('0x1f')](function(_0x4478f){_0x27deb0=_(_0x27deb0)['union'](_0x4478f)[_0x4f2b('0x8f')]()['value']();return db[_0x4f2b('0x54')][_0x4f2b('0x61')]({'where':{'id':_0x3b6709[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](function(_0x345c7c){return db['sequelize'][_0x4f2b('0x7a')](function(_0x363317){return _0x345c7c[_0x4f2b('0x7f')](_0x3b6709[_0x4f2b('0x44')]['ids'],{'transaction':_0x363317})[_0x4f2b('0x1f')](function(){if(!_[_0x4f2b('0x90')](_0x27deb0)){return _0x345c7c[_0x4f2b('0x91')](_0x27deb0,{'transaction':_0x363317});}})[_0x4f2b('0x1f')](function(){_0x27deb0[_0x4f2b('0x7c')](function(_0x43129d){socket[_0x4f2b('0x7d')]('userChatQueue:remove',{'UserId':_0x43129d,'ChatQueueId':_0x345c7c['id']});});});});});});})[_0x4f2b('0x1f')](respondWithStatusCode(_0x2fbf34,null))[_0x4f2b('0x5b')](handleError(_0x2fbf34,null));};exports[_0x4f2b('0x92')]=function(_0x308285,_0x5db6ec,_0x5d7b27){return db['ChatQueue'][_0x4f2b('0x61')]({'where':{'id':_0x308285[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](handleEntityNotFound(_0x5db6ec,null))[_0x4f2b('0x1f')](function(_0x35a26a){if(_0x35a26a){return _0x35a26a['addAgents'](_0x308285['body'][_0x4f2b('0x74')],_[_0x4f2b('0x93')](_0x308285['body'],[_0x4f2b('0x74'),'id'])||{})[_0x4f2b('0x94')](function(_0x173b39){for(var _0x399006=0x0;_0x399006<_0x308285[_0x4f2b('0x5d')][_0x4f2b('0x74')][_0x4f2b('0x59')];_0x399006+=0x1){socket[_0x4f2b('0x7d')](_0x4f2b('0x7e'),{'UserId':Number(_0x308285[_0x4f2b('0x5d')]['ids'][_0x399006]),'ChatQueueId':Number(_0x308285[_0x4f2b('0x58')]['id'])});}return _0x173b39;});}})[_0x4f2b('0x1f')](respondWithResult(_0x5db6ec,null))['catch'](handleError(_0x5db6ec,null));};exports['removeAgents']=function(_0xc2b11c,_0x95c845,_0x2b091f){return db[_0x4f2b('0x54')][_0x4f2b('0x61')]({'where':{'id':_0xc2b11c[_0x4f2b('0x58')]['id']}})[_0x4f2b('0x1f')](handleEntityNotFound(_0x95c845,null))[_0x4f2b('0x1f')](function(_0x32d24f){if(_0x32d24f){return _0x32d24f['removeAgents'](_0xc2b11c[_0x4f2b('0x44')][_0x4f2b('0x74')])[_0x4f2b('0x1f')](function(){if(_[_0x4f2b('0x95')](_0xc2b11c[_0x4f2b('0x44')][_0x4f2b('0x74')])){for(var _0xe39528=0x0;_0xe39528<_0xc2b11c[_0x4f2b('0x44')]['ids'][_0x4f2b('0x59')];_0xe39528+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0xc2b11c['query']['ids'][_0xe39528]),'ChatQueueId':Number(_0xc2b11c[_0x4f2b('0x58')]['id'])});}}else{socket[_0x4f2b('0x7d')]('userChatQueue:remove',{'UserId':Number(_0xc2b11c[_0x4f2b('0x44')]['ids']),'ChatQueueId':Number(_0xc2b11c[_0x4f2b('0x58')]['id'])});}});}})[_0x4f2b('0x1f')](respondWithStatusCode(_0x95c845,null))['catch'](handleError(_0x95c845,null));};exports[_0x4f2b('0x96')]=function(_0xb6aae8,_0x337846,_0x3b5d5a){var _0x577641={};var _0x5789d7={};var _0x33d0f3;var _0x4b8696;return db[_0x4f2b('0x54')]['findOne']({'where':{'id':_0xb6aae8[_0x4f2b('0x58')]['id']}})['then'](handleEntityNotFound(_0x337846,null))['then'](function(_0x4aebeb){if(_0x4aebeb){_0x33d0f3=_0x4aebeb;_0x5789d7['model']=_[_0x4f2b('0x43')](db[_0x4f2b('0x6a')][_0x4f2b('0x40')]);_0x5789d7[_0x4f2b('0x44')]=_['keys'](_0xb6aae8[_0x4f2b('0x44')]);_0x5789d7[_0x4f2b('0x45')]=_[_0x4f2b('0x46')](_0x5789d7[_0x4f2b('0x47')],_0x5789d7[_0x4f2b('0x44')]);_0x577641[_0x4f2b('0x49')]=_['intersection'](_0x5789d7[_0x4f2b('0x47')],qs['fields'](_0xb6aae8['query'][_0x4f2b('0x48')]));_0x577641['attributes']=_0x577641[_0x4f2b('0x49')][_0x4f2b('0x59')]?_0x577641[_0x4f2b('0x49')]:_0x5789d7[_0x4f2b('0x47')];_0x577641[_0x4f2b('0x4c')]=qs[_0x4f2b('0x4d')](_0xb6aae8[_0x4f2b('0x44')]['sort']);_0x577641[_0x4f2b('0x4e')]=qs[_0x4f2b('0x45')](_[_0x4f2b('0x4f')](_0xb6aae8[_0x4f2b('0x44')],_0x5789d7[_0x4f2b('0x45')]));if(_0xb6aae8[_0x4f2b('0x44')][_0x4f2b('0x50')]){_0x577641[_0x4f2b('0x4e')]=_[_0x4f2b('0x51')](_0x577641['where'],{'$or':_[_0x4f2b('0x3f')](_0x577641[_0x4f2b('0x49')],function(_0x1a04c7){var _0x2880b6={};_0x2880b6[_0x1a04c7]={'$like':'%'+_0xb6aae8['query']['filter']+'%'};return _0x2880b6;})});}_0x577641=_[_0x4f2b('0x51')]({},_0x577641,_0xb6aae8['options']);return _0x33d0f3['getAgents'](_0x577641);}})[_0x4f2b('0x1f')](function(_0x233aab){if(_0x233aab){_0x4b8696=_0x233aab[_0x4f2b('0x59')];if(!_0xb6aae8[_0x4f2b('0x44')][_0x4f2b('0x4a')](_0x4f2b('0x4b'))){_0x577641[_0x4f2b('0x2f')]=qs[_0x4f2b('0x2f')](_0xb6aae8[_0x4f2b('0x44')][_0x4f2b('0x2f')]);_0x577641[_0x4f2b('0x2d')]=qs['offset'](_0xb6aae8[_0x4f2b('0x44')][_0x4f2b('0x2d')]);}return _0x33d0f3[_0x4f2b('0x96')](_0x577641);}})[_0x4f2b('0x1f')](function(_0x5218b6){if(_0x5218b6){return _0x5218b6?{'count':_0x4b8696,'rows':_0x5218b6}:null;}})[_0x4f2b('0x1f')](respondWithResult(_0x337846,null))[_0x4f2b('0x5b')](handleError(_0x337846,null));}; \ No newline at end of file +var _0x90a3=['intersection','model','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','UserChatQueue','pick','ChatQueueId','User','agent','chatPause','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','flatMap','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','redis','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','get','ChatQueues','UserProfileResource','destroy','stack','send','index','ChatQueue','rawAttributes','fieldName','type','map','name','query','attributes'];(function(_0x5560c3,_0x39e144){var _0xf6ca88=function(_0x4891d8){while(--_0x4891d8){_0x5560c3['push'](_0x5560c3['shift']());}};_0xf6ca88(++_0x39e144);}(_0x90a3,0x16a));var _0x390a=function(_0x38daae,_0x227c40){_0x38daae=_0x38daae-0x0;var _0x1ad037=_0x90a3[_0x38daae];return _0x1ad037;};'use strict';var emlformat=require(_0x390a('0x0'));var rimraf=require(_0x390a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x390a('0x2'));var rp=require(_0x390a('0x3'));var moment=require(_0x390a('0x4'));var BPromise=require(_0x390a('0x5'));var Mustache=require(_0x390a('0x6'));var util=require(_0x390a('0x7'));var path=require(_0x390a('0x8'));var sox=require('sox');var csv=require(_0x390a('0x9'));var ejs=require(_0x390a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x390a('0xb'));var squel=require(_0x390a('0xc'));var crypto=require(_0x390a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x390a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x390a('0xf'));var Papa=require(_0x390a('0x10'));var Redis=require('ioredis');var authService=require(_0x390a('0x11'));var qs=require(_0x390a('0x12'));var as=require(_0x390a('0x13'));var hardwareService=require(_0x390a('0x14'));var logger=require('../../config/logger')(_0x390a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x390a('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x390a('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x390a('0x17')]));require(_0x390a('0x18'))[_0x390a('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ed242,_0xd443ab,_0x273473,_0x4438bb){return new BPromise(function(_0x17d6d1,_0x13b3e0){var _0x344a7f=_0x4438bb||client;return _0x344a7f[_0x390a('0x1a')](_0x5ed242,_0x273473)['then'](function(_0x2a28ef){logger[_0x390a('0x1b')](_0x390a('0x1c'),_0xd443ab,_0x390a('0x1d'));logger[_0x390a('0x1e')](_0x390a('0x1f'),_0xd443ab,'request\x20sent',JSON[_0x390a('0x20')](_0x2a28ef));if(_0x2a28ef['error']){if(_0x2a28ef[_0x390a('0x21')][_0x390a('0x22')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0xd443ab,_0x2a28ef[_0x390a('0x21')][_0x390a('0x23')]);return _0x13b3e0(_0x2a28ef['error']['message']);}logger[_0x390a('0x21')](_0x390a('0x1c'),_0xd443ab,_0x2a28ef[_0x390a('0x21')][_0x390a('0x23')]);return _0x17d6d1(_0x2a28ef['error']['message']);}else{logger[_0x390a('0x1b')](_0x390a('0x1c'),_0xd443ab,_0x390a('0x1d'));_0x17d6d1(_0x2a28ef['result'][_0x390a('0x23')]);}})[_0x390a('0x24')](function(_0x17680e){logger[_0x390a('0x21')](_0x390a('0x1c'),_0xd443ab,_0x17680e);_0x13b3e0(_0x17680e);});});}function respondWithStatusCode(_0x27a735,_0x46721b){_0x46721b=_0x46721b||0xcc;return function(_0xf85360){if(_0xf85360){return _0x27a735[_0x390a('0x25')](_0x46721b);}return _0x27a735[_0x390a('0x26')](_0x46721b)[_0x390a('0x27')]();};}function respondWithResult(_0x2b9375,_0x2cdaf5){_0x2cdaf5=_0x2cdaf5||0xc8;return function(_0x1b7759){if(_0x1b7759){return _0x2b9375[_0x390a('0x26')](_0x2cdaf5)['json'](_0x1b7759);}};}function respondWithFilteredResult(_0x5ac903,_0x197ec6){return function(_0x12bd5b){if(_0x12bd5b){var _0x2d40e2=typeof _0x197ec6[_0x390a('0x28')]===_0x390a('0x29')&&typeof _0x197ec6[_0x390a('0x2a')]===_0x390a('0x29');var _0xe9a29c=_0x12bd5b['count'];var _0x28a122=_0x2d40e2?0x0:_0x197ec6[_0x390a('0x28')];var _0x560829=_0x2d40e2?_0x12bd5b[_0x390a('0x2b')]:_0x197ec6['offset']+_0x197ec6['limit'];var _0xd06cd0;if(_0x560829>=_0xe9a29c){_0x560829=_0xe9a29c;_0xd06cd0=0xc8;}else{_0xd06cd0=0xce;}_0x5ac903['status'](_0xd06cd0);return _0x5ac903[_0x390a('0x2c')](_0x390a('0x2d'),_0x28a122+'-'+_0x560829+'/'+_0xe9a29c)[_0x390a('0x2e')](_0x12bd5b);}return null;};}function patchUpdates(_0x5a6d32){return function(_0x47fc30){try{jsonpatch['apply'](_0x47fc30,_0x5a6d32,!![]);}catch(_0x1f77fb){return BPromise['reject'](_0x1f77fb);}return _0x47fc30['save']();};}function saveUpdates(_0x4e5ed,_0x2c6de8){return function(_0x10c1be){if(_0x10c1be){return _0x10c1be[_0x390a('0x2f')](_0x4e5ed)[_0x390a('0x30')](function(_0x15170d){return _0x15170d;});}return null;};}function removeEntity(_0x497315,_0x540f16){return function(_0x58b5b9){if(_0x58b5b9){return _0x58b5b9['destroy']()[_0x390a('0x30')](function(){var _0x2e1eee=_0x58b5b9[_0x390a('0x31')]({'plain':!![]});var _0x30b4e5=_0x390a('0x32');return db[_0x390a('0x33')][_0x390a('0x34')]({'where':{'type':_0x30b4e5,'resourceId':_0x2e1eee['id']}})[_0x390a('0x30')](function(){return _0x58b5b9;});})[_0x390a('0x30')](function(){_0x497315[_0x390a('0x26')](0xcc)[_0x390a('0x27')]();});}};}function handleEntityNotFound(_0x12cd8f,_0x41bc41){return function(_0x4f7c7f){if(!_0x4f7c7f){_0x12cd8f[_0x390a('0x25')](0x194);}return _0x4f7c7f;};}function handleError(_0x32e14b,_0x599b5f){_0x599b5f=_0x599b5f||0x1f4;return function(_0x33da32){logger['error'](_0x33da32[_0x390a('0x35')]);if(_0x33da32['name']){delete _0x33da32['name'];}_0x32e14b[_0x390a('0x26')](_0x599b5f)[_0x390a('0x36')](_0x33da32);};}exports[_0x390a('0x37')]=function(_0x32bdec,_0x4e8f14){var _0xcbc4b5={},_0x1c1f02={},_0x2b272d={'count':0x0,'rows':[]};var _0x405216=_['map'](db[_0x390a('0x38')][_0x390a('0x39')],function(_0x3270c6){return{'name':_0x3270c6[_0x390a('0x3a')],'type':_0x3270c6[_0x390a('0x3b')]['key']};});_0x1c1f02['model']=_[_0x390a('0x3c')](_0x405216,_0x390a('0x3d'));_0x1c1f02['query']=_['keys'](_0x32bdec[_0x390a('0x3e')]);_0x1c1f02['filters']=_['intersection'](_0x1c1f02['model'],_0x1c1f02['query']);_0xcbc4b5[_0x390a('0x3f')]=_[_0x390a('0x40')](_0x1c1f02[_0x390a('0x41')],qs['fields'](_0x32bdec['query']['fields']));_0xcbc4b5['attributes']=_0xcbc4b5[_0x390a('0x3f')][_0x390a('0x42')]?_0xcbc4b5[_0x390a('0x3f')]:_0x1c1f02['model'];if(!_0x32bdec[_0x390a('0x3e')][_0x390a('0x43')](_0x390a('0x44'))){_0xcbc4b5[_0x390a('0x2a')]=qs[_0x390a('0x2a')](_0x32bdec['query'][_0x390a('0x2a')]);_0xcbc4b5['offset']=qs[_0x390a('0x28')](_0x32bdec[_0x390a('0x3e')][_0x390a('0x28')]);}_0xcbc4b5[_0x390a('0x45')]=qs[_0x390a('0x46')](_0x32bdec[_0x390a('0x3e')][_0x390a('0x46')]);_0xcbc4b5[_0x390a('0x47')]=qs[_0x390a('0x48')](_['pick'](_0x32bdec[_0x390a('0x3e')],_0x1c1f02[_0x390a('0x48')]),_0x405216);if(_0x32bdec[_0x390a('0x3e')][_0x390a('0x49')]){_0xcbc4b5[_0x390a('0x47')]=_[_0x390a('0x4a')](_0xcbc4b5[_0x390a('0x47')],{'$or':_[_0x390a('0x3c')](_0x405216,function(_0x575c09){if(_0x575c09[_0x390a('0x3b')]!==_0x390a('0x4b')){var _0x50cb4e={};_0x50cb4e[_0x575c09['name']]={'$like':'%'+_0x32bdec[_0x390a('0x3e')][_0x390a('0x49')]+'%'};return _0x50cb4e;}})});}_0xcbc4b5=_[_0x390a('0x4a')]({},_0xcbc4b5,_0x32bdec[_0x390a('0x4c')]);var _0xc7d1bf={'where':_0xcbc4b5['where']};return db[_0x390a('0x38')][_0x390a('0x2b')](_0xc7d1bf)[_0x390a('0x30')](function(_0x248b59){_0x2b272d[_0x390a('0x2b')]=_0x248b59;if(_0x32bdec['query'][_0x390a('0x4d')]){_0xcbc4b5[_0x390a('0x4e')]=[{'all':!![]}];}return db['ChatQueue'][_0x390a('0x4f')](_0xcbc4b5);})['then'](function(_0x23a8b0){_0x2b272d[_0x390a('0x50')]=_0x23a8b0;return _0x2b272d;})[_0x390a('0x30')](respondWithFilteredResult(_0x4e8f14,_0xcbc4b5))[_0x390a('0x24')](handleError(_0x4e8f14,null));};exports['show']=function(_0x337cfc,_0x2ead4b){var _0x4962da={'raw':!![],'where':{'id':_0x337cfc[_0x390a('0x51')]['id']}},_0x505fa4={};_0x505fa4['model']=_[_0x390a('0x52')](db[_0x390a('0x38')][_0x390a('0x39')]);_0x505fa4[_0x390a('0x3e')]=_[_0x390a('0x52')](_0x337cfc[_0x390a('0x3e')]);_0x505fa4[_0x390a('0x48')]=_[_0x390a('0x40')](_0x505fa4[_0x390a('0x41')],_0x505fa4[_0x390a('0x3e')]);_0x4962da[_0x390a('0x3f')]=_[_0x390a('0x40')](_0x505fa4[_0x390a('0x41')],qs[_0x390a('0x53')](_0x337cfc['query']['fields']));_0x4962da[_0x390a('0x3f')]=_0x4962da[_0x390a('0x3f')]['length']?_0x4962da[_0x390a('0x3f')]:_0x505fa4['model'];if(_0x337cfc[_0x390a('0x3e')][_0x390a('0x4d')]){_0x4962da['include']=[{'all':!![]}];}_0x4962da=_['merge']({},_0x4962da,_0x337cfc[_0x390a('0x4c')]);return db[_0x390a('0x38')][_0x390a('0x54')](_0x4962da)[_0x390a('0x30')](handleEntityNotFound(_0x2ead4b,null))[_0x390a('0x30')](respondWithResult(_0x2ead4b,null))[_0x390a('0x24')](handleError(_0x2ead4b,null));};exports[_0x390a('0x55')]=function(_0x40155e,_0x2343e1){return db[_0x390a('0x38')][_0x390a('0x55')](_0x40155e['body'],{})[_0x390a('0x30')](function(_0x464ed9){var _0x58de10=_0x40155e['user'][_0x390a('0x31')]({'plain':!![]});if(!_0x58de10)throw new Error(_0x390a('0x56'));if(_0x58de10['role']===_0x390a('0x57')){var _0x122f4e=_0x464ed9[_0x390a('0x31')]({'plain':!![]});var _0x2f49df=_0x390a('0x32');return db[_0x390a('0x58')][_0x390a('0x54')]({'where':{'name':_0x2f49df,'userProfileId':_0x58de10[_0x390a('0x59')]},'raw':!![]})['then'](function(_0x524557){if(_0x524557&&_0x524557[_0x390a('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x122f4e[_0x390a('0x3d')],'resourceId':_0x122f4e['id'],'type':_0x524557[_0x390a('0x3d')],'sectionId':_0x524557['id']},{})[_0x390a('0x30')](function(){return _0x464ed9;});}else{return _0x464ed9;}})[_0x390a('0x24')](function(_0x93548f){logger['error'](_0x390a('0x5b'),_0x93548f);throw _0x93548f;});}return _0x464ed9;})[_0x390a('0x30')](respondWithResult(_0x2343e1,0xc9))[_0x390a('0x24')](handleError(_0x2343e1,null));};exports['update']=function(_0x2583f4,_0x79a6a1){if(_0x2583f4[_0x390a('0x5c')]['id']){delete _0x2583f4['body']['id'];}return db[_0x390a('0x38')][_0x390a('0x54')]({'where':{'id':_0x2583f4[_0x390a('0x51')]['id']}})['then'](handleEntityNotFound(_0x79a6a1,null))[_0x390a('0x30')](saveUpdates(_0x2583f4[_0x390a('0x5c')],null))[_0x390a('0x30')](respondWithResult(_0x79a6a1,null))['catch'](handleError(_0x79a6a1,null));};exports[_0x390a('0x34')]=function(_0x53af4a,_0x15b9f9){return db[_0x390a('0x38')][_0x390a('0x54')]({'where':{'id':_0x53af4a[_0x390a('0x51')]['id']}})[_0x390a('0x30')](handleEntityNotFound(_0x15b9f9,null))[_0x390a('0x30')](removeEntity(_0x15b9f9,null))['catch'](handleError(_0x15b9f9,null));};exports['describe']=function(_0x142b56,_0x5b88aa){return db[_0x390a('0x38')]['describe']()[_0x390a('0x30')](respondWithResult(_0x5b88aa,null))[_0x390a('0x24')](handleError(_0x5b88aa,null));};exports['getMembers']=function(_0x2a7087,_0x4362c0,_0xa1a965){var _0x386d02={'raw':!![],'where':{}},_0x234592={},_0x1bdce1;return db['ChatQueue'][_0x390a('0x5d')]({'where':{'id':_0x2a7087[_0x390a('0x51')]['id']}})[_0x390a('0x30')](handleEntityNotFound(_0x4362c0,null))[_0x390a('0x30')](function(_0x1e14d4){if(_0x1e14d4){_0x1bdce1=_0x1e14d4[_0x390a('0x31')]({'plain':!![]});_0x234592[_0x390a('0x41')]=_[_0x390a('0x52')](db[_0x390a('0x5e')][_0x390a('0x39')]);_0x234592[_0x390a('0x3e')]=_[_0x390a('0x52')](_0x2a7087[_0x390a('0x3e')]);_0x234592[_0x390a('0x48')]=_[_0x390a('0x40')](_0x234592['model'],_0x234592[_0x390a('0x3e')]);_0x386d02[_0x390a('0x3f')]=_[_0x390a('0x40')](_0x234592[_0x390a('0x41')],qs[_0x390a('0x53')](_0x2a7087[_0x390a('0x3e')][_0x390a('0x53')]));_0x386d02[_0x390a('0x3f')]=_0x386d02[_0x390a('0x3f')][_0x390a('0x42')]?_0x386d02['attributes']:_0x234592['model'];if(!_0x2a7087['query'][_0x390a('0x43')](_0x390a('0x44'))){_0x386d02['limit']=qs[_0x390a('0x2a')](_0x2a7087['query'][_0x390a('0x2a')]);_0x386d02[_0x390a('0x28')]=qs[_0x390a('0x28')](_0x2a7087[_0x390a('0x3e')][_0x390a('0x28')]);}_0x386d02[_0x390a('0x45')]=qs[_0x390a('0x46')](_0x2a7087[_0x390a('0x3e')][_0x390a('0x46')]);_0x386d02[_0x390a('0x47')]=qs[_0x390a('0x48')](_[_0x390a('0x5f')](_0x2a7087[_0x390a('0x3e')],_0x234592['filters']));_0x386d02[_0x390a('0x47')][_0x390a('0x60')]=_0x1e14d4['id'];if(_0x2a7087[_0x390a('0x3e')]['filter']){_0x386d02['where']=_[_0x390a('0x4a')](_0x386d02[_0x390a('0x47')],{'$or':_['map'](_0x386d02['attributes'],function(_0x520d9f){var _0x507ab2={};_0x507ab2[_0x520d9f]={'$like':'%'+_0x2a7087[_0x390a('0x3e')][_0x390a('0x49')]+'%'};return _0x507ab2;})});}_0x386d02=_['merge']({},_0x386d02,_0x2a7087['options']);return db[_0x390a('0x5e')][_0x390a('0x4f')](_0x386d02);}})[_0x390a('0x30')](function(_0x1ad4c0){if(_0x1ad4c0){return db[_0x390a('0x61')]['findAndCountAll']({'where':{'id':_['map'](_0x1ad4c0,'UserId'),'role':_0x390a('0x62')},'attributes':['id',_0x390a('0x3d'),_0x390a('0x63'),'updatedAt','createdAt']});}})['then'](function(_0x2b2593){if(_0x2b2593){return{'count':_0x2b2593[_0x390a('0x2b')],'rows':_[_0x390a('0x3c')](_0x2b2593[_0x390a('0x50')],function(_0x36be95){return{'membername':_0x36be95[_0x390a('0x3d')],'UserId':_0x36be95['id'],'queue_name':_0x1bdce1[_0x390a('0x3d')],'ChatQueueId':_0x1bdce1['id'],'interface':util[_0x390a('0x64')](_0x390a('0x65'),_0x390a('0x66'),_0x36be95['name']),'penalty':0x0,'paused':_0x36be95[_0x390a('0x63')],'createdAt':_0x36be95['createdAt'],'updatedAt':_0x36be95[_0x390a('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x390a('0x30')](respondWithFilteredResult(_0x4362c0,_0x386d02))['catch'](handleError(_0x4362c0,null));};exports[_0x390a('0x68')]=function(_0x30c9ca,_0x94726a,_0xf2d7aa){var _0x37f1bf={};var _0x1b5a6e={};var _0x5ad0e3;var _0x49e7f9;return db[_0x390a('0x38')][_0x390a('0x5d')]({'where':{'id':_0x30c9ca[_0x390a('0x51')]['id']}})[_0x390a('0x30')](handleEntityNotFound(_0x94726a,null))['then'](function(_0x52df1c){if(_0x52df1c){_0x5ad0e3=_0x52df1c;_0x1b5a6e[_0x390a('0x41')]=_[_0x390a('0x52')](db[_0x390a('0x69')][_0x390a('0x39')]);_0x1b5a6e[_0x390a('0x3e')]=_[_0x390a('0x52')](_0x30c9ca['query']);_0x1b5a6e[_0x390a('0x48')]=_['intersection'](_0x1b5a6e[_0x390a('0x41')],_0x1b5a6e['query']);_0x37f1bf[_0x390a('0x3f')]=_['intersection'](_0x1b5a6e['model'],qs[_0x390a('0x53')](_0x30c9ca[_0x390a('0x3e')][_0x390a('0x53')]));_0x37f1bf[_0x390a('0x3f')]=_0x37f1bf[_0x390a('0x3f')]['length']?_0x37f1bf[_0x390a('0x3f')]:_0x1b5a6e['model'];_0x37f1bf[_0x390a('0x45')]=qs[_0x390a('0x46')](_0x30c9ca[_0x390a('0x3e')]['sort']);_0x37f1bf[_0x390a('0x47')]=qs[_0x390a('0x48')](_[_0x390a('0x5f')](_0x30c9ca[_0x390a('0x3e')],_0x1b5a6e[_0x390a('0x48')]));if(_0x30c9ca[_0x390a('0x3e')][_0x390a('0x49')]){_0x37f1bf[_0x390a('0x47')]=_[_0x390a('0x4a')](_0x37f1bf['where'],{'$or':_[_0x390a('0x3c')](_0x37f1bf[_0x390a('0x3f')],function(_0x4b2277){var _0xc6d49a={};_0xc6d49a[_0x4b2277]={'$like':'%'+_0x30c9ca[_0x390a('0x3e')]['filter']+'%'};return _0xc6d49a;})});}_0x37f1bf=_[_0x390a('0x4a')]({},_0x37f1bf,_0x30c9ca['options']);return _0x5ad0e3[_0x390a('0x68')](_0x37f1bf);}})[_0x390a('0x30')](function(_0x9750e6){if(_0x9750e6){_0x49e7f9=_0x9750e6[_0x390a('0x42')];if(!_0x30c9ca[_0x390a('0x3e')][_0x390a('0x43')]('nolimit')){_0x37f1bf[_0x390a('0x2a')]=qs[_0x390a('0x2a')](_0x30c9ca[_0x390a('0x3e')][_0x390a('0x2a')]);_0x37f1bf[_0x390a('0x28')]=qs['offset'](_0x30c9ca[_0x390a('0x3e')][_0x390a('0x28')]);}return _0x5ad0e3[_0x390a('0x68')](_0x37f1bf);}})[_0x390a('0x30')](function(_0x479d85){if(_0x479d85){return _0x479d85?{'count':_0x49e7f9,'rows':_0x479d85}:null;}})[_0x390a('0x30')](respondWithResult(_0x94726a,null))[_0x390a('0x24')](handleError(_0x94726a,null));};exports[_0x390a('0x6a')]=function(_0x4dfe70,_0xf103c5,_0x42ab39){var _0x43297d=_0x4dfe70[_0x390a('0x5c')][_0x390a('0x6b')];return db[_0x390a('0x69')]['findAll']({'where':{'id':_0x43297d},'attributes':['id'],'include':[{'model':db[_0x390a('0x61')],'as':_0x390a('0x6c'),'attributes':['id',_0x390a('0x3d'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x4d1075){if(_0x4d1075){var _0xc3886=_[_0x390a('0x6d')](_0x4d1075,function(_0x59ed68){var _0x19abe6=_0x59ed68[_0x390a('0x31')]({'plain':!![]});return _0x19abe6['Agents'];});return db[_0x390a('0x38')][_0x390a('0x54')]({'where':{'id':_0x4dfe70[_0x390a('0x51')]['id']}})[_0x390a('0x30')](function(_0x536f5e){return db['sequelize'][_0x390a('0x6e')](function(_0x437c27){return _0x536f5e[_0x390a('0x6a')](_0x43297d,{'transaction':_0x437c27})[_0x390a('0x30')](function(){return BPromise[_0x390a('0x6f')](_0xc3886,function(_0x533a8b){return db[_0x390a('0x5e')][_0x390a('0x70')]({'where':{'UserId':_0x533a8b['id'],'ChatQueueId':_0x4dfe70[_0x390a('0x51')]['id']},'transaction':_0x437c27});});})[_0x390a('0x30')](function(){_0xc3886['forEach'](function(_0x5c851a){socket[_0x390a('0x71')]('userChatQueue:save',{'UserId':_0x5c851a['id'],'ChatQueueId':_0x536f5e['id']});});});});});}})[_0x390a('0x30')](respondWithStatusCode(_0xf103c5,null))[_0x390a('0x24')](handleError(_0xf103c5,null));};exports[_0x390a('0x72')]=function(_0x317204,_0x15f2a7,_0x145ebe){return db[_0x390a('0x69')]['findAll']({'where':{'id':_0x317204[_0x390a('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x390a('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x390a('0x30')](handleEntityNotFound(_0x15f2a7,null))[_0x390a('0x30')](function(_0x207d02){var _0x309a60=_[_0x390a('0x3c')](_0x207d02,'id');var _0x2874a8=[];var _0xdf8685=[];var _0x5a5df8=squel[_0x390a('0x73')]();_0x5a5df8[_0x390a('0x74')](_0x390a('0x75'))[_0x390a('0x76')](_0x390a('0x77'),'tq')[_0x390a('0x78')](_0x390a('0x79'),'ut',_0x390a('0x7a'))[_0x390a('0x47')](_0x390a('0x7b'),_0x317204[_0x390a('0x51')]['id']);for(var _0x39a5af=0x0;_0x39a5af<_0x207d02['length'];_0x39a5af+=0x1){let _0x1ca3ff=_0x207d02[_0x39a5af];for(var _0x36bcef=0x0;_0x36bcef<_0x1ca3ff[_0x390a('0x6c')][_0x390a('0x42')];_0x36bcef+=0x1){let _0x5ad4a9=_0x1ca3ff['Agents'][_0x36bcef];var _0x1f9ada=_0x5a5df8[_0x390a('0x7c')]();_0x1f9ada['where'](_0x390a('0x7d'),_0x5ad4a9['id']);_0xdf8685[_0x390a('0x7e')](db['sequelize'][_0x390a('0x3e')](_0x1f9ada[_0x390a('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x390a('0x80')]})['then'](function(_0x2b2317){if(_0x2b2317[_0x390a('0x42')]===0x1){return _0x5ad4a9['id'];}else{var _0x1191c3=_[_0x390a('0x81')](_['map'](_0x2b2317,'TeamId'),function(_0xc90aa7){return _[_0x390a('0x82')](_0x309a60,_0xc90aa7);});if(_0x1191c3){return _0x5ad4a9['id'];}}}));}}return BPromise[_0x390a('0x83')](_0xdf8685)['then'](function(_0x3e6a66){_0x2874a8=_(_0x2874a8)['union'](_0x3e6a66)[_0x390a('0x84')]()[_0x390a('0x85')]();return db[_0x390a('0x38')][_0x390a('0x54')]({'where':{'id':_0x317204[_0x390a('0x51')]['id']}})[_0x390a('0x30')](function(_0x4b7a5c){return db['sequelize'][_0x390a('0x6e')](function(_0x3e41b7){return _0x4b7a5c[_0x390a('0x72')](_0x317204['query'][_0x390a('0x6b')],{'transaction':_0x3e41b7})[_0x390a('0x30')](function(){if(!_[_0x390a('0x86')](_0x2874a8)){return _0x4b7a5c[_0x390a('0x87')](_0x2874a8,{'transaction':_0x3e41b7});}})[_0x390a('0x30')](function(){_0x2874a8['forEach'](function(_0x3fff0d){socket[_0x390a('0x71')](_0x390a('0x88'),{'UserId':_0x3fff0d,'ChatQueueId':_0x4b7a5c['id']});});});});});});})[_0x390a('0x30')](respondWithStatusCode(_0x15f2a7,null))[_0x390a('0x24')](handleError(_0x15f2a7,null));};exports[_0x390a('0x89')]=function(_0x594851,_0x34155e,_0x2c1930){return db[_0x390a('0x38')]['find']({'where':{'id':_0x594851[_0x390a('0x51')]['id']}})['then'](handleEntityNotFound(_0x34155e,null))['then'](function(_0x10d132){if(_0x10d132){return _0x10d132[_0x390a('0x89')](_0x594851[_0x390a('0x5c')]['ids'],_[_0x390a('0x8a')](_0x594851['body'],[_0x390a('0x6b'),'id'])||{})[_0x390a('0x8b')](function(_0x3883e4){for(var _0x8ec15=0x0;_0x8ec15<_0x594851[_0x390a('0x5c')][_0x390a('0x6b')][_0x390a('0x42')];_0x8ec15+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x594851[_0x390a('0x5c')][_0x390a('0x6b')][_0x8ec15]),'ChatQueueId':Number(_0x594851['params']['id'])});}return _0x3883e4;});}})[_0x390a('0x30')](respondWithResult(_0x34155e,null))[_0x390a('0x24')](handleError(_0x34155e,null));};exports['removeAgents']=function(_0x5cfe27,_0x35faa5,_0xfbe881){return db['ChatQueue'][_0x390a('0x54')]({'where':{'id':_0x5cfe27['params']['id']}})['then'](handleEntityNotFound(_0x35faa5,null))[_0x390a('0x30')](function(_0x33cc70){if(_0x33cc70){return _0x33cc70[_0x390a('0x87')](_0x5cfe27[_0x390a('0x3e')][_0x390a('0x6b')])[_0x390a('0x30')](function(){if(_[_0x390a('0x8c')](_0x5cfe27[_0x390a('0x3e')]['ids'])){for(var _0x32e8df=0x0;_0x32e8df<_0x5cfe27[_0x390a('0x3e')]['ids']['length'];_0x32e8df+=0x1){socket['emit'](_0x390a('0x88'),{'UserId':Number(_0x5cfe27[_0x390a('0x3e')][_0x390a('0x6b')][_0x32e8df]),'ChatQueueId':Number(_0x5cfe27['params']['id'])});}}else{socket[_0x390a('0x71')](_0x390a('0x88'),{'UserId':Number(_0x5cfe27[_0x390a('0x3e')][_0x390a('0x6b')]),'ChatQueueId':Number(_0x5cfe27[_0x390a('0x51')]['id'])});}});}})[_0x390a('0x30')](respondWithStatusCode(_0x35faa5,null))[_0x390a('0x24')](handleError(_0x35faa5,null));};exports[_0x390a('0x8d')]=function(_0x1c777a,_0x36b8b7,_0x372717){var _0x3228e2={};var _0x5e9bc7={};var _0x12313e;var _0x3eb3e7;return db[_0x390a('0x38')][_0x390a('0x5d')]({'where':{'id':_0x1c777a['params']['id']}})[_0x390a('0x30')](handleEntityNotFound(_0x36b8b7,null))[_0x390a('0x30')](function(_0x3d4ee0){if(_0x3d4ee0){_0x12313e=_0x3d4ee0;_0x5e9bc7[_0x390a('0x41')]=_[_0x390a('0x52')](db[_0x390a('0x61')][_0x390a('0x39')]);_0x5e9bc7[_0x390a('0x3e')]=_[_0x390a('0x52')](_0x1c777a['query']);_0x5e9bc7[_0x390a('0x48')]=_[_0x390a('0x40')](_0x5e9bc7['model'],_0x5e9bc7[_0x390a('0x3e')]);_0x3228e2[_0x390a('0x3f')]=_[_0x390a('0x40')](_0x5e9bc7['model'],qs[_0x390a('0x53')](_0x1c777a[_0x390a('0x3e')]['fields']));_0x3228e2['attributes']=_0x3228e2[_0x390a('0x3f')][_0x390a('0x42')]?_0x3228e2[_0x390a('0x3f')]:_0x5e9bc7[_0x390a('0x41')];_0x3228e2['order']=qs['sort'](_0x1c777a[_0x390a('0x3e')][_0x390a('0x46')]);_0x3228e2[_0x390a('0x47')]=qs[_0x390a('0x48')](_[_0x390a('0x5f')](_0x1c777a[_0x390a('0x3e')],_0x5e9bc7[_0x390a('0x48')]));if(_0x1c777a[_0x390a('0x3e')][_0x390a('0x49')]){_0x3228e2[_0x390a('0x47')]=_[_0x390a('0x4a')](_0x3228e2[_0x390a('0x47')],{'$or':_['map'](_0x3228e2[_0x390a('0x3f')],function(_0x4613b2){var _0x5e328f={};_0x5e328f[_0x4613b2]={'$like':'%'+_0x1c777a[_0x390a('0x3e')][_0x390a('0x49')]+'%'};return _0x5e328f;})});}_0x3228e2=_['merge']({},_0x3228e2,_0x1c777a[_0x390a('0x4c')]);return _0x12313e[_0x390a('0x8d')](_0x3228e2);}})['then'](function(_0x2ba8cf){if(_0x2ba8cf){_0x3eb3e7=_0x2ba8cf[_0x390a('0x42')];if(!_0x1c777a[_0x390a('0x3e')]['hasOwnProperty']('nolimit')){_0x3228e2[_0x390a('0x2a')]=qs[_0x390a('0x2a')](_0x1c777a['query'][_0x390a('0x2a')]);_0x3228e2[_0x390a('0x28')]=qs['offset'](_0x1c777a['query'][_0x390a('0x28')]);}return _0x12313e[_0x390a('0x8d')](_0x3228e2);}})['then'](function(_0x5e7f39){if(_0x5e7f39){return _0x5e7f39?{'count':_0x3eb3e7,'rows':_0x5e7f39}:null;}})[_0x390a('0x30')](respondWithResult(_0x36b8b7,null))[_0x390a('0x24')](handleError(_0x36b8b7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 04e3ac2..b30af5d 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 _0xb9f7=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x41fce6,_0x25a107){var _0x4c13bb=function(_0x43778b){while(--_0x43778b){_0x41fce6['push'](_0x41fce6['shift']());}};_0x4c13bb(++_0x25a107);}(_0xb9f7,0xca));var _0x7b9f=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xb9f7[_0x903228];return _0xcec81d;};'use strict';var EventEmitter=require(_0x7b9f('0x0'));var ChatQueue=require(_0x7b9f('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7b9f('0x2')](0x0);var events={'afterCreate':_0x7b9f('0x3'),'afterUpdate':_0x7b9f('0x4'),'afterDestroy':_0x7b9f('0x5')};function emitEvent(_0x24867c){return function(_0x3f4b91,_0x3fd6e5,_0x48b808){ChatQueueEvents[_0x7b9f('0x6')](_0x24867c+':'+_0x3f4b91['id'],_0x3f4b91);ChatQueueEvents[_0x7b9f('0x6')](_0x24867c,_0x3f4b91);_0x48b808(null);};}for(var e in events){if(events[_0x7b9f('0x7')](e)){var event=events[e];ChatQueue[_0x7b9f('0x8')](e,emitEvent(event));}}module[_0x7b9f('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x940a=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x940a,0x1ce));var _0xa940=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x940a[_0x2c7b86];return _0x256735;};'use strict';var EventEmitter=require(_0xa940('0x0'));var ChatQueue=require(_0xa940('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa940('0x2')](0x0);var events={'afterCreate':_0xa940('0x3'),'afterUpdate':_0xa940('0x4'),'afterDestroy':_0xa940('0x5')};function emitEvent(_0x4af67b){return function(_0x43e79a,_0x3505c0,_0x3a2265){ChatQueueEvents['emit'](_0x4af67b+':'+_0x43e79a['id'],_0x43e79a);ChatQueueEvents[_0xa940('0x6')](_0x4af67b,_0x43e79a);_0x3a2265(null);};}for(var e in events){if(events[_0xa940('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xa940('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 49c89e6..60a55f1 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 _0x4bbb=['rimraf','../../config/environment','./chatQueue.attributes','lodash','util','moment','request-promise','path'];(function(_0x48391b,_0x51132d){var _0x16cd8f=function(_0x59fa13){while(--_0x59fa13){_0x48391b['push'](_0x48391b['shift']());}};_0x16cd8f(++_0x51132d);}(_0x4bbb,0x1d3));var _0xb4bb=function(_0x4d4968,_0x2fbe38){_0x4d4968=_0x4d4968-0x0;var _0x19e5e6=_0x4bbb[_0x4d4968];return _0x19e5e6;};'use strict';var _=require(_0xb4bb('0x0'));var util=require(_0xb4bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb4bb('0x2'));var BPromise=require('bluebird');var rp=require(_0xb4bb('0x3'));var fs=require('fs');var path=require(_0xb4bb('0x4'));var rimraf=require(_0xb4bb('0x5'));var config=require(_0xb4bb('0x6'));var attributes=require(_0xb4bb('0x7'));module['exports']=function(_0x34b5ca,_0x564412){return _0x34b5ca['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a54=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','define','lodash','util'];(function(_0x337049,_0x4355fc){var _0xea97ea=function(_0x4302d0){while(--_0x4302d0){_0x337049['push'](_0x337049['shift']());}};_0xea97ea(++_0x4355fc);}(_0x5a54,0x195));var _0x45a5=function(_0xafe9f5,_0x3d27bb){_0xafe9f5=_0xafe9f5-0x0;var _0x263a08=_0x5a54[_0xafe9f5];return _0x263a08;};'use strict';var _=require(_0x45a5('0x0'));var util=require(_0x45a5('0x1'));var logger=require(_0x45a5('0x2'))(_0x45a5('0x3'));var moment=require(_0x45a5('0x4'));var BPromise=require(_0x45a5('0x5'));var rp=require(_0x45a5('0x6'));var fs=require('fs');var path=require(_0x45a5('0x7'));var rimraf=require(_0x45a5('0x8'));var config=require('../../config/environment');var attributes=require(_0x45a5('0x9'));module['exports']=function(_0x1419f7,_0x52b3c6){return _0x1419f7[_0x45a5('0xa')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 80013f7..a48ec7b 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 _0x96f9=['info','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetChatQueue','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowChatQueue','ChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','register','request','then'];(function(_0x1b0229,_0x53e271){var _0x23551e=function(_0x4cc25f){while(--_0x4cc25f){_0x1b0229['push'](_0x1b0229['shift']());}};_0x23551e(++_0x53e271);}(_0x96f9,0x64));var _0x996f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x96f9[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x996f('0x0'));var util=require(_0x996f('0x1'));var moment=require(_0x996f('0x2'));var BPromise=require(_0x996f('0x3'));var rs=require(_0x996f('0x4'));var fs=require('fs');var Redis=require(_0x996f('0x5'));var db=require(_0x996f('0x6'))['db'];var utils=require(_0x996f('0x7'));var logger=require(_0x996f('0x8'))('rpc');var config=require(_0x996f('0x9'));var jayson=require(_0x996f('0xa'));var client=jayson['client'][_0x996f('0xb')]({'port':0x232a});config[_0x996f('0xc')]=_[_0x996f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x996f('0xe')](socket);function respondWithRpcPromise(_0x120c79,_0x226986,_0x54e4a3){return new BPromise(function(_0x4775ff,_0xeb28b9){return client[_0x996f('0xf')](_0x120c79,_0x54e4a3)[_0x996f('0x10')](function(_0x5560a0){logger[_0x996f('0x11')](_0x996f('0x12'),_0x226986,'request\x20sent');logger[_0x996f('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x226986,_0x996f('0x14'),JSON[_0x996f('0x15')](_0x5560a0));if(_0x5560a0['error']){if(_0x5560a0[_0x996f('0x16')]['code']===0x1f4){logger[_0x996f('0x16')](_0x996f('0x12'),_0x226986,_0x5560a0[_0x996f('0x16')][_0x996f('0x17')]);return _0xeb28b9(_0x5560a0['error'][_0x996f('0x17')]);}logger[_0x996f('0x16')]('ChatQueue,\x20%s,\x20%s',_0x226986,_0x5560a0[_0x996f('0x16')]['message']);return _0x4775ff(_0x5560a0['error'][_0x996f('0x17')]);}else{logger[_0x996f('0x11')](_0x996f('0x12'),_0x226986,'request\x20sent');_0x4775ff(_0x5560a0[_0x996f('0x18')][_0x996f('0x17')]);}})['catch'](function(_0x275691){logger[_0x996f('0x16')](_0x996f('0x12'),_0x226986,_0x275691);_0xeb28b9(_0x275691);});});}exports[_0x996f('0x19')]=function(_0x4db317){var _0x10efb6=this;return new Promise(function(_0x5db588,_0x35d508){return db['ChatQueue'][_0x996f('0x1a')]({'raw':_0x4db317[_0x996f('0x1b')]?_0x4db317[_0x996f('0x1b')][_0x996f('0x1c')]===undefined?!![]:![]:!![],'where':_0x4db317[_0x996f('0x1b')]?_0x4db317[_0x996f('0x1b')][_0x996f('0x1d')]||null:null,'attributes':_0x4db317[_0x996f('0x1b')]?_0x4db317[_0x996f('0x1b')]['attributes']||null:null,'limit':_0x4db317[_0x996f('0x1b')]?_0x4db317['options'][_0x996f('0x1e')]||null:null,'include':_0x4db317[_0x996f('0x1b')]?_0x4db317['options'][_0x996f('0x1f')]?_[_0x996f('0x20')](_0x4db317['options']['include'],function(_0x492b5f){return{'model':db[_0x492b5f[_0x996f('0x21')]],'as':_0x492b5f['as'],'attributes':_0x492b5f[_0x996f('0x22')],'include':_0x492b5f['include']?_[_0x996f('0x20')](_0x492b5f['include'],function(_0x5b08d0){return{'model':db[_0x5b08d0[_0x996f('0x21')]],'as':_0x5b08d0['as'],'attributes':_0x5b08d0[_0x996f('0x22')],'include':_0x5b08d0[_0x996f('0x1f')]?_[_0x996f('0x20')](_0x5b08d0[_0x996f('0x1f')],function(_0x419662){return{'model':db[_0x419662[_0x996f('0x21')]],'as':_0x419662['as'],'attributes':_0x419662[_0x996f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x996f('0x10')](function(_0x8c07d7){logger[_0x996f('0x11')](_0x996f('0x19'),_0x4db317);logger[_0x996f('0x13')]('GetChatQueue',_0x4db317,JSON[_0x996f('0x15')](_0x8c07d7));_0x5db588(_0x8c07d7);})[_0x996f('0x23')](function(_0x2216e1){logger[_0x996f('0x16')]('GetChatQueue',_0x2216e1[_0x996f('0x17')],_0x4db317);_0x35d508(_0x10efb6[_0x996f('0x16')](0x1f4,_0x2216e1[_0x996f('0x17')]));});});};exports[_0x996f('0x24')]=function(_0x5c58cf){var _0x587356=this;return new Promise(function(_0x6a42c4,_0x2facc2){return db[_0x996f('0x25')][_0x996f('0x26')]({'raw':_0x5c58cf[_0x996f('0x1b')]?_0x5c58cf[_0x996f('0x1b')][_0x996f('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c58cf[_0x996f('0x1b')]?_0x5c58cf[_0x996f('0x1b')][_0x996f('0x1d')]||null:null,'attributes':_0x5c58cf[_0x996f('0x1b')]?_0x5c58cf['options'][_0x996f('0x22')]||null:null,'include':_0x5c58cf[_0x996f('0x1b')]?_0x5c58cf[_0x996f('0x1b')][_0x996f('0x1f')]?_[_0x996f('0x20')](_0x5c58cf[_0x996f('0x1b')][_0x996f('0x1f')],function(_0x148908){return{'model':db[_0x148908[_0x996f('0x21')]],'as':_0x148908['as'],'attributes':_0x148908['attributes'],'include':_0x148908[_0x996f('0x1f')]?_[_0x996f('0x20')](_0x148908[_0x996f('0x1f')],function(_0x6e0b5c){return{'model':db[_0x6e0b5c[_0x996f('0x21')]],'as':_0x6e0b5c['as'],'attributes':_0x6e0b5c[_0x996f('0x22')],'include':_0x6e0b5c[_0x996f('0x1f')]?_['map'](_0x6e0b5c[_0x996f('0x1f')],function(_0x50c0b1){return{'model':db[_0x50c0b1['model']],'as':_0x50c0b1['as'],'attributes':_0x50c0b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x996f('0x10')](function(_0x547f3c){logger[_0x996f('0x11')]('ShowChatQueue',_0x5c58cf);logger[_0x996f('0x13')](_0x996f('0x24'),_0x5c58cf,JSON[_0x996f('0x15')](_0x547f3c));_0x6a42c4(_0x547f3c);})[_0x996f('0x23')](function(_0x5252b4){logger['error'](_0x996f('0x24'),_0x5252b4[_0x996f('0x17')],_0x5c58cf);_0x2facc2(_0x587356[_0x996f('0x16')](0x1f4,_0x5252b4['message']));});});}; \ No newline at end of file +var _0x9f4d=['attributes','limit','include','model','map','GetChatQueue','stringify','catch','ShowChatQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','ChatQueue','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x5a3d49,_0x24b21a){_0x5a3d49=_0x5a3d49-0x0;var _0x4d5c23=_0x9f4d[_0x5a3d49];return _0x4d5c23;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});config[_0xd9f4('0xc')]=_[_0xd9f4('0xd')](config['redis'],{'host':_0xd9f4('0xe'),'port':0x18eb});var socket=require(_0xd9f4('0xf'))(new Redis(config['redis']));require(_0xd9f4('0x10'))['register'](socket);function respondWithRpcPromise(_0x16cacf,_0x41709a,_0x2deeb5){return new BPromise(function(_0x429d90,_0x2bd084){return client['request'](_0x16cacf,_0x2deeb5)[_0xd9f4('0x11')](function(_0x312d09){logger[_0xd9f4('0x12')](_0xd9f4('0x13'),_0x41709a,_0xd9f4('0x14'));logger[_0xd9f4('0x15')](_0xd9f4('0x16'),_0x41709a,_0xd9f4('0x14'),JSON['stringify'](_0x312d09));if(_0x312d09[_0xd9f4('0x17')]){if(_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x18')]===0x1f4){logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);return _0x2bd084(_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);}logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);return _0x429d90(_0x312d09['error']['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x41709a,_0xd9f4('0x14'));_0x429d90(_0x312d09[_0xd9f4('0x1a')][_0xd9f4('0x19')]);}})['catch'](function(_0x45f93c){logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x45f93c);_0x2bd084(_0x45f93c);});});}exports['GetChatQueue']=function(_0x32ab66){var _0x591be1=this;return new Promise(function(_0x313bf2,_0x93e8df){return db[_0xd9f4('0x1b')]['findAll']({'raw':_0x32ab66[_0xd9f4('0x1c')]?_0x32ab66[_0xd9f4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x32ab66['options']?_0x32ab66[_0xd9f4('0x1c')]['where']||null:null,'attributes':_0x32ab66[_0xd9f4('0x1c')]?_0x32ab66[_0xd9f4('0x1c')][_0xd9f4('0x1d')]||null:null,'limit':_0x32ab66[_0xd9f4('0x1c')]?_0x32ab66[_0xd9f4('0x1c')][_0xd9f4('0x1e')]||null:null,'include':_0x32ab66[_0xd9f4('0x1c')]?_0x32ab66[_0xd9f4('0x1c')][_0xd9f4('0x1f')]?_['map'](_0x32ab66[_0xd9f4('0x1c')][_0xd9f4('0x1f')],function(_0x1fe43b){return{'model':db[_0x1fe43b[_0xd9f4('0x20')]],'as':_0x1fe43b['as'],'attributes':_0x1fe43b[_0xd9f4('0x1d')],'include':_0x1fe43b[_0xd9f4('0x1f')]?_[_0xd9f4('0x21')](_0x1fe43b['include'],function(_0x17e017){return{'model':db[_0x17e017[_0xd9f4('0x20')]],'as':_0x17e017['as'],'attributes':_0x17e017[_0xd9f4('0x1d')],'include':_0x17e017[_0xd9f4('0x1f')]?_['map'](_0x17e017['include'],function(_0x478bc6){return{'model':db[_0x478bc6[_0xd9f4('0x20')]],'as':_0x478bc6['as'],'attributes':_0x478bc6['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9f4('0x11')](function(_0x453a08){logger['info']('GetChatQueue',_0x32ab66);logger[_0xd9f4('0x15')](_0xd9f4('0x22'),_0x32ab66,JSON[_0xd9f4('0x23')](_0x453a08));_0x313bf2(_0x453a08);})[_0xd9f4('0x24')](function(_0x8c3e50){logger[_0xd9f4('0x17')](_0xd9f4('0x22'),_0x8c3e50[_0xd9f4('0x19')],_0x32ab66);_0x93e8df(_0x591be1[_0xd9f4('0x17')](0x1f4,_0x8c3e50[_0xd9f4('0x19')]));});});};exports[_0xd9f4('0x25')]=function(_0x40b489){var _0x52d081=this;return new Promise(function(_0x2924e6,_0x505867){return db[_0xd9f4('0x1b')][_0xd9f4('0x26')]({'raw':_0x40b489[_0xd9f4('0x1c')]?_0x40b489[_0xd9f4('0x1c')][_0xd9f4('0x27')]===undefined?!![]:![]:!![],'where':_0x40b489[_0xd9f4('0x1c')]?_0x40b489[_0xd9f4('0x1c')][_0xd9f4('0x28')]||null:null,'attributes':_0x40b489[_0xd9f4('0x1c')]?_0x40b489[_0xd9f4('0x1c')][_0xd9f4('0x1d')]||null:null,'include':_0x40b489[_0xd9f4('0x1c')]?_0x40b489[_0xd9f4('0x1c')]['include']?_['map'](_0x40b489['options'][_0xd9f4('0x1f')],function(_0x9c3f8b){return{'model':db[_0x9c3f8b[_0xd9f4('0x20')]],'as':_0x9c3f8b['as'],'attributes':_0x9c3f8b[_0xd9f4('0x1d')],'include':_0x9c3f8b[_0xd9f4('0x1f')]?_[_0xd9f4('0x21')](_0x9c3f8b[_0xd9f4('0x1f')],function(_0x2c313f){return{'model':db[_0x2c313f[_0xd9f4('0x20')]],'as':_0x2c313f['as'],'attributes':_0x2c313f[_0xd9f4('0x1d')],'include':_0x2c313f[_0xd9f4('0x1f')]?_['map'](_0x2c313f['include'],function(_0x1ba715){return{'model':db[_0x1ba715[_0xd9f4('0x20')]],'as':_0x1ba715['as'],'attributes':_0x1ba715[_0xd9f4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd9f4('0x11')](function(_0x3dea70){logger[_0xd9f4('0x12')](_0xd9f4('0x25'),_0x40b489);logger[_0xd9f4('0x15')](_0xd9f4('0x25'),_0x40b489,JSON[_0xd9f4('0x23')](_0x3dea70));_0x2924e6(_0x3dea70);})[_0xd9f4('0x24')](function(_0x32bd8b){logger[_0xd9f4('0x17')]('ShowChatQueue',_0x32bd8b['message'],_0x40b489);_0x505867(_0x52d081[_0xd9f4('0x17')](0x1f4,_0x32bd8b[_0xd9f4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9c1db36..be31e49 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 _0x6334=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x389911,_0x2d61b2){var _0x5d3cdc=function(_0x1b0818){while(--_0x1b0818){_0x389911['push'](_0x389911['shift']());}};_0x5d3cdc(++_0x2d61b2);}(_0x6334,0x119));var _0x4633=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0x6334[_0x190681];return _0x4f2ada;};'use strict';var ChatQueueEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){ChatQueueEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);ChatQueueEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file +var _0x008c=['./chatQueue.events','save','remove','update','emit','removeListener','register','chatQueue:'];(function(_0x1f48a4,_0x2c6af6){var _0x19ebad=function(_0x58da8b){while(--_0x58da8b){_0x1f48a4['push'](_0x1f48a4['shift']());}};_0x19ebad(++_0x2c6af6);}(_0x008c,0x188));var _0xc008=function(_0x2fc1ce,_0x250865){_0x2fc1ce=_0x2fc1ce-0x0;var _0x2cf1ab=_0x008c[_0x2fc1ce];return _0x2cf1ab;};'use strict';var ChatQueueEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){ChatQueueEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);ChatQueueEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 9b5c106..af8bdbe 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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2e2faa,_0x4ddbce){var _0x160b67=function(_0x50863b){while(--_0x50863b){_0x2e2faa['push'](_0x2e2faa['shift']());}};_0x160b67(++_0x4ddbce);}(_0x008c,0x188));var _0xc008=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x008c[_0x3e2480];return _0x652c0;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=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(_0x2cf5d5,_0x3f1776){var _0x37328d=function(_0x5ad2ff){while(--_0x5ad2ff){_0x2cf5d5['push'](_0x2cf5d5['shift']());}};_0x37328d(++_0x3f1776);}(_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',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 a5b7ccf..43a0ff6 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 _0x01e3=['moment','sequelize','exports','STRING','DATE'];(function(_0x3ee03a,_0x402057){var _0x54a72a=function(_0x199b38){while(--_0x199b38){_0x3ee03a['push'](_0x3ee03a['shift']());}};_0x54a72a(++_0x402057);}(_0x01e3,0x122));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x301e('0x0'));var Sequelize=require(_0x301e('0x1'));module[_0x301e('0x2')]={'uniqueid':{'type':Sequelize[_0x301e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x301e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x301e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x301e('0x3')]}}; \ No newline at end of file +var _0x8bd7=['STRING','DATE','moment','sequelize','exports'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0x8bd7,0x1a1));var _0x78bd=function(_0x574674,_0x53895c){_0x574674=_0x574674-0x0;var _0x5a0ea9=_0x8bd7[_0x574674];return _0x5a0ea9;};'use strict';var moment=require(_0x78bd('0x0'));var Sequelize=require(_0x78bd('0x1'));module[_0x78bd('0x2')]={'uniqueid':{'type':Sequelize[_0x78bd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x78bd('0x3')]},'joinAt':{'type':Sequelize[_0x78bd('0x4')]},'leaveAt':{'type':Sequelize[_0x78bd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x78bd('0x4')]},'reason':{'type':Sequelize[_0x78bd('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 3b09b78..263ff3b 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 _0x53ec=['then','sendStatus','name','send','map','ChatQueueReport','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','create','update','body','destroy','describe','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'];(function(_0x30c5ab,_0x1ba368){var _0x4d9825=function(_0x56c8c1){while(--_0x56c8c1){_0x30c5ab['push'](_0x30c5ab['shift']());}};_0x4d9825(++_0x1ba368);}(_0x53ec,0x192));var _0xc53e=function(_0x55af86,_0x5c8ff6){_0x55af86=_0x55af86-0x0;var _0x58df3b=_0x53ec[_0x55af86];return _0x58df3b;};'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')](_0x4458c8['body'],{})[_0xc53e('0x24')](respondWithResult(_0x15e744,0xc9))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x5a6e41,_0x33d45c){if(_0x5a6e41[_0xc53e('0x46')]['id']){delete _0x5a6e41[_0xc53e('0x46')]['id'];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x5a6e41[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x33d45c,null))[_0xc53e('0x24')](saveUpdates(_0x5a6e41[_0xc53e('0x46')],null))[_0xc53e('0x24')](respondWithResult(_0x33d45c,null))['catch'](handleError(_0x33d45c,null));};exports[_0xc53e('0x47')]=function(_0x17cf13,_0x38520c){return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'id':_0x17cf13['params']['id']}})['then'](handleEntityNotFound(_0x38520c,null))[_0xc53e('0x24')](removeEntity(_0x38520c,null))['catch'](handleError(_0x38520c,null));};exports[_0xc53e('0x48')]=function(_0x575a13,_0x3a49a4){return db[_0xc53e('0x29')][_0xc53e('0x48')]()['then'](respondWithResult(_0x3a49a4,null))[_0xc53e('0x43')](handleError(_0x3a49a4,null));}; \ No newline at end of file +var _0xbe2c=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','json','reject','save','update','then','sendStatus','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type'];(function(_0x28c7ac,_0x22173d){var _0x47fcfa=function(_0x4873a2){while(--_0x4873a2){_0x28c7ac['push'](_0x28c7ac['shift']());}};_0x47fcfa(++_0x22173d);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x63ed40,_0x1df083){_0x63ed40=_0x63ed40-0x0;var _0x5e7bef=_0xbe2c[_0x63ed40];return _0x5e7bef;};'use strict';var emlformat=require(_0xcbe2('0x0'));var rimraf=require(_0xcbe2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcbe2('0x2'));var rp=require('request-promise');var moment=require(_0xcbe2('0x3'));var BPromise=require(_0xcbe2('0x4'));var Mustache=require(_0xcbe2('0x5'));var util=require(_0xcbe2('0x6'));var path=require(_0xcbe2('0x7'));var sox=require('sox');var csv=require(_0xcbe2('0x8'));var ejs=require(_0xcbe2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbe2('0xa'));var squel=require(_0xcbe2('0xb'));var crypto=require(_0xcbe2('0xc'));var jsforce=require(_0xcbe2('0xd'));var deskjs=require(_0xcbe2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcbe2('0xf'));var Redis=require(_0xcbe2('0x10'));var authService=require(_0xcbe2('0x11'));var qs=require(_0xcbe2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbe2('0x13'))(_0xcbe2('0x14'));var utils=require(_0xcbe2('0x15'));var config=require(_0xcbe2('0x16'));var licenseUtil=require(_0xcbe2('0x17'));var db=require(_0xcbe2('0x18'))['db'];function respondWithStatusCode(_0x526ce2,_0x1b94fb){_0x1b94fb=_0x1b94fb||0xcc;return function(_0x192c00){if(_0x192c00){return _0x526ce2['sendStatus'](_0x1b94fb);}return _0x526ce2[_0xcbe2('0x19')](_0x1b94fb)['end']();};}function respondWithResult(_0x41de3f,_0x4c18dc){_0x4c18dc=_0x4c18dc||0xc8;return function(_0x3920bf){if(_0x3920bf){return _0x41de3f['status'](_0x4c18dc)['json'](_0x3920bf);}};}function respondWithFilteredResult(_0xb89337,_0x4ec284){return function(_0xb2995b){if(_0xb2995b){var _0x23c38f=typeof _0x4ec284[_0xcbe2('0x1a')]===_0xcbe2('0x1b')&&typeof _0x4ec284[_0xcbe2('0x1c')]===_0xcbe2('0x1b');var _0x126aa9=_0xb2995b['count'];var _0xb968ac=_0x23c38f?0x0:_0x4ec284['offset'];var _0x1c09cb=_0x23c38f?_0xb2995b[_0xcbe2('0x1d')]:_0x4ec284[_0xcbe2('0x1a')]+_0x4ec284[_0xcbe2('0x1c')];var _0x537eb2;if(_0x1c09cb>=_0x126aa9){_0x1c09cb=_0x126aa9;_0x537eb2=0xc8;}else{_0x537eb2=0xce;}_0xb89337[_0xcbe2('0x19')](_0x537eb2);return _0xb89337['set']('Content-Range',_0xb968ac+'-'+_0x1c09cb+'/'+_0x126aa9)[_0xcbe2('0x1e')](_0xb2995b);}return null;};}function patchUpdates(_0x208863){return function(_0x8b1504){try{jsonpatch['apply'](_0x8b1504,_0x208863,!![]);}catch(_0x104706){return BPromise[_0xcbe2('0x1f')](_0x104706);}return _0x8b1504[_0xcbe2('0x20')]();};}function saveUpdates(_0x5167eb,_0x372789){return function(_0x432329){if(_0x432329){return _0x432329[_0xcbe2('0x21')](_0x5167eb)[_0xcbe2('0x22')](function(_0x38048c){return _0x38048c;});}return null;};}function removeEntity(_0x285fc7,_0x2f1e25){return function(_0x2914e6){if(_0x2914e6){return _0x2914e6['destroy']()[_0xcbe2('0x22')](function(){_0x285fc7[_0xcbe2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40039f,_0x1829e6){return function(_0xc6ec9b){if(!_0xc6ec9b){_0x40039f[_0xcbe2('0x23')](0x194);}return _0xc6ec9b;};}function handleError(_0x105b92,_0x4833cd){_0x4833cd=_0x4833cd||0x1f4;return function(_0xbc5aab){logger[_0xcbe2('0x24')](_0xbc5aab['stack']);if(_0xbc5aab[_0xcbe2('0x25')]){delete _0xbc5aab['name'];}_0x105b92[_0xcbe2('0x19')](_0x4833cd)[_0xcbe2('0x26')](_0xbc5aab);};}exports[_0xcbe2('0x27')]=function(_0x431631,_0x4c194d){var _0xdee879={},_0x37eb8b={},_0x4cf95a={'count':0x0,'rows':[]};var _0x3596be=_[_0xcbe2('0x28')](db[_0xcbe2('0x29')][_0xcbe2('0x2a')],function(_0x26d570){return{'name':_0x26d570[_0xcbe2('0x2b')],'type':_0x26d570[_0xcbe2('0x2c')][_0xcbe2('0x2d')]};});_0x37eb8b[_0xcbe2('0x2e')]=_[_0xcbe2('0x28')](_0x3596be,_0xcbe2('0x25'));_0x37eb8b[_0xcbe2('0x2f')]=_[_0xcbe2('0x30')](_0x431631['query']);_0x37eb8b[_0xcbe2('0x31')]=_[_0xcbe2('0x32')](_0x37eb8b['model'],_0x37eb8b['query']);_0xdee879[_0xcbe2('0x33')]=_['intersection'](_0x37eb8b[_0xcbe2('0x2e')],qs[_0xcbe2('0x34')](_0x431631[_0xcbe2('0x2f')][_0xcbe2('0x34')]));_0xdee879[_0xcbe2('0x33')]=_0xdee879[_0xcbe2('0x33')][_0xcbe2('0x35')]?_0xdee879['attributes']:_0x37eb8b[_0xcbe2('0x2e')];if(!_0x431631['query']['hasOwnProperty'](_0xcbe2('0x36'))){_0xdee879['limit']=qs[_0xcbe2('0x1c')](_0x431631['query'][_0xcbe2('0x1c')]);_0xdee879[_0xcbe2('0x1a')]=qs['offset'](_0x431631[_0xcbe2('0x2f')]['offset']);}_0xdee879[_0xcbe2('0x37')]=qs['sort'](_0x431631['query'][_0xcbe2('0x38')]);_0xdee879['where']=qs['filters'](_[_0xcbe2('0x39')](_0x431631['query'],_0x37eb8b[_0xcbe2('0x31')]),_0x3596be);if(_0x431631[_0xcbe2('0x2f')][_0xcbe2('0x3a')]){_0xdee879['where']=_[_0xcbe2('0x3b')](_0xdee879[_0xcbe2('0x3c')],{'$or':_['map'](_0x3596be,function(_0x522bfd){if(_0x522bfd['type']!==_0xcbe2('0x3d')){var _0x4347a7={};_0x4347a7[_0x522bfd[_0xcbe2('0x25')]]={'$like':'%'+_0x431631[_0xcbe2('0x2f')][_0xcbe2('0x3a')]+'%'};return _0x4347a7;}})});}_0xdee879=_['merge']({},_0xdee879,_0x431631[_0xcbe2('0x3e')]);var _0x2b9fd8={'where':_0xdee879['where']};return db[_0xcbe2('0x29')][_0xcbe2('0x1d')](_0x2b9fd8)[_0xcbe2('0x22')](function(_0x3b2878){_0x4cf95a[_0xcbe2('0x1d')]=_0x3b2878;if(_0x431631[_0xcbe2('0x2f')]['includeAll']){_0xdee879[_0xcbe2('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xcbe2('0x40')](_0xdee879);})['then'](function(_0x272fdb){_0x4cf95a['rows']=_0x272fdb;return _0x4cf95a;})[_0xcbe2('0x22')](respondWithFilteredResult(_0x4c194d,_0xdee879))[_0xcbe2('0x41')](handleError(_0x4c194d,null));};exports[_0xcbe2('0x42')]=function(_0x1a200a,_0x4e72bb){var _0x25899c={'raw':!![],'where':{'id':_0x1a200a[_0xcbe2('0x43')]['id']}},_0x5c5684={};_0x5c5684[_0xcbe2('0x2e')]=_[_0xcbe2('0x30')](db['ChatQueueReport'][_0xcbe2('0x2a')]);_0x5c5684[_0xcbe2('0x2f')]=_['keys'](_0x1a200a[_0xcbe2('0x2f')]);_0x5c5684['filters']=_[_0xcbe2('0x32')](_0x5c5684[_0xcbe2('0x2e')],_0x5c5684[_0xcbe2('0x2f')]);_0x25899c[_0xcbe2('0x33')]=_[_0xcbe2('0x32')](_0x5c5684[_0xcbe2('0x2e')],qs['fields'](_0x1a200a['query'][_0xcbe2('0x34')]));_0x25899c['attributes']=_0x25899c[_0xcbe2('0x33')][_0xcbe2('0x35')]?_0x25899c[_0xcbe2('0x33')]:_0x5c5684[_0xcbe2('0x2e')];if(_0x1a200a[_0xcbe2('0x2f')][_0xcbe2('0x44')]){_0x25899c[_0xcbe2('0x3f')]=[{'all':!![]}];}_0x25899c=_[_0xcbe2('0x3b')]({},_0x25899c,_0x1a200a[_0xcbe2('0x3e')]);return db[_0xcbe2('0x29')][_0xcbe2('0x45')](_0x25899c)[_0xcbe2('0x22')](handleEntityNotFound(_0x4e72bb,null))[_0xcbe2('0x22')](respondWithResult(_0x4e72bb,null))[_0xcbe2('0x41')](handleError(_0x4e72bb,null));};exports['create']=function(_0x1110eb,_0x5868be){return db[_0xcbe2('0x29')][_0xcbe2('0x46')](_0x1110eb[_0xcbe2('0x47')],{})['then'](respondWithResult(_0x5868be,0xc9))[_0xcbe2('0x41')](handleError(_0x5868be,null));};exports[_0xcbe2('0x21')]=function(_0x52057b,_0x33e78b){if(_0x52057b[_0xcbe2('0x47')]['id']){delete _0x52057b[_0xcbe2('0x47')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x52057b['params']['id']}})[_0xcbe2('0x22')](handleEntityNotFound(_0x33e78b,null))[_0xcbe2('0x22')](saveUpdates(_0x52057b[_0xcbe2('0x47')],null))[_0xcbe2('0x22')](respondWithResult(_0x33e78b,null))[_0xcbe2('0x41')](handleError(_0x33e78b,null));};exports[_0xcbe2('0x48')]=function(_0x2d295c,_0x19f1e1){return db[_0xcbe2('0x29')]['find']({'where':{'id':_0x2d295c['params']['id']}})['then'](handleEntityNotFound(_0x19f1e1,null))[_0xcbe2('0x22')](removeEntity(_0x19f1e1,null))[_0xcbe2('0x41')](handleError(_0x19f1e1,null));};exports[_0xcbe2('0x49')]=function(_0x3b6cf8,_0x3275a5){return db[_0xcbe2('0x29')][_0xcbe2('0x49')]()['then'](respondWithResult(_0x3275a5,null))['catch'](handleError(_0x3275a5,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index cd0471d..bb37d45 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(_0x3ac954,_0x32ef8e){var _0x5c1bdc=function(_0x3089ed){while(--_0x3089ed){_0x3ac954['push'](_0x3ac954['shift']());}};_0x5c1bdc(++_0x32ef8e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xb7e7[_0x1da04e];return _0xdd8c41;};'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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x3dfa50,_0x28fbfc){var _0x289bd5=function(_0x94107d){while(--_0x94107d){_0x3dfa50['push'](_0x3dfa50['shift']());}};_0x289bd5(++_0x28fbfc);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 5a97dbc..352637b 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 _0x4201=['rpc','../../config/environment','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','stringify','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x36a3d1,_0x4a32cd){var _0x821ef4=function(_0x1dfb29){while(--_0x1dfb29){_0x36a3d1['push'](_0x36a3d1['shift']());}};_0x821ef4(++_0x4a32cd);}(_0x4201,0x102));var _0x1420=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0x4201[_0xe3e0af];return _0x4828e9;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require(_0x1420('0x2'));var BPromise=require('bluebird');var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1420('0x6'));var config=require(_0x1420('0x7'));var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dae38,_0x174ccf,_0x272e97){return new BPromise(function(_0x5c6211,_0xf9d2f6){return client[_0x1420('0xb')](_0x2dae38,_0x272e97)['then'](function(_0x4cc945){logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));logger[_0x1420('0xf')](_0x1420('0x10'),_0x174ccf,'request\x20sent',JSON['stringify'](_0x4cc945));if(_0x4cc945[_0x1420('0x11')]){if(_0x4cc945[_0x1420('0x11')]['code']===0x1f4){logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0xf9d2f6(_0x4cc945['error'][_0x1420('0x12')]);}logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0x5c6211(_0x4cc945['error'][_0x1420('0x12')]);}else{logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));_0x5c6211(_0x4cc945[_0x1420('0x13')]['message']);}})[_0x1420('0x14')](function(_0x901a0a){logger['error'](_0x1420('0xd'),_0x174ccf,_0x901a0a);_0xf9d2f6(_0x901a0a);});});}exports[_0x1420('0x15')]=function(_0x3f85cb){var _0x3ff1b7=this;return new Promise(function(_0x5634ab,_0x41701e){return db[_0x1420('0x16')][_0x1420('0x17')](_0x3f85cb[_0x1420('0x18')],{'raw':_0x3f85cb[_0x1420('0x19')]?_0x3f85cb[_0x1420('0x19')][_0x1420('0x1a')]===undefined?!![]:![]:!![]})[_0x1420('0x1b')](function(_0x255cef){logger['info']('CreateChatQueueReport',_0x3f85cb);logger[_0x1420('0xf')](_0x1420('0x15'),_0x3f85cb,JSON[_0x1420('0x1c')](_0x255cef));_0x5634ab(_0x255cef);})[_0x1420('0x14')](function(_0x59340f){logger['error'](_0x1420('0x15'),_0x59340f[_0x1420('0x12')],_0x3f85cb);_0x41701e(_0x3ff1b7[_0x1420('0x11')](0x1f4,_0x59340f[_0x1420('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x2d0430){var _0xc75d2=this;return new Promise(function(_0x6300ca,_0x1fddd4){return db[_0x1420('0x16')]['update'](_0x2d0430['body'],{'raw':_0x2d0430[_0x1420('0x19')]?_0x2d0430[_0x1420('0x19')][_0x1420('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d0430[_0x1420('0x19')]?_0x2d0430[_0x1420('0x19')][_0x1420('0x1d')]||null:null,'attributes':_0x2d0430[_0x1420('0x19')]?_0x2d0430[_0x1420('0x19')][_0x1420('0x1e')]||null:null,'limit':_0x2d0430['options']?_0x2d0430[_0x1420('0x19')][_0x1420('0x1f')]||null:null})[_0x1420('0x1b')](function(_0x2c2e90){logger[_0x1420('0xc')]('UpdateChatQueueReport',_0x2d0430);logger['debug'](_0x1420('0x20'),_0x2d0430,JSON[_0x1420('0x1c')](_0x2c2e90));_0x6300ca(_0x2c2e90);})[_0x1420('0x14')](function(_0x2d2fcb){logger['error'](_0x1420('0x20'),_0x2d2fcb[_0x1420('0x12')],_0x2d0430);_0x1fddd4(_0xc75d2[_0x1420('0x11')](0x1f4,_0x2d2fcb[_0x1420('0x12')]));});});}; \ No newline at end of file +var _0xc8ae=['debug','UpdateChatQueueReport','ChatQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','options','raw','then','CreateChatQueueReport'];(function(_0x1f25ff,_0x4e2209){var _0x5b172b=function(_0x50bf62){while(--_0x50bf62){_0x1f25ff['push'](_0x1f25ff['shift']());}};_0x5b172b(++_0x4e2209);}(_0xc8ae,0x1c2));var _0xec8a=function(_0x4c9720,_0x1fe462){_0x4c9720=_0x4c9720-0x0;var _0x2ccab6=_0xc8ae[_0x4c9720];return _0x2ccab6;};'use strict';var _=require(_0xec8a('0x0'));var util=require(_0xec8a('0x1'));var moment=require(_0xec8a('0x2'));var BPromise=require(_0xec8a('0x3'));var rs=require(_0xec8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec8a('0x6'))(_0xec8a('0x7'));var config=require(_0xec8a('0x8'));var jayson=require(_0xec8a('0x9'));var client=jayson[_0xec8a('0xa')][_0xec8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c9d02,_0x54463b,_0x546c92){return new BPromise(function(_0x1d03a7,_0x3c25d0){return client['request'](_0x2c9d02,_0x546c92)['then'](function(_0x2a587f){logger[_0xec8a('0xc')](_0xec8a('0xd'),_0x54463b,_0xec8a('0xe'));logger['debug'](_0xec8a('0xf'),_0x54463b,_0xec8a('0xe'),JSON[_0xec8a('0x10')](_0x2a587f));if(_0x2a587f['error']){if(_0x2a587f[_0xec8a('0x11')][_0xec8a('0x12')]===0x1f4){logger[_0xec8a('0x11')](_0xec8a('0xd'),_0x54463b,_0x2a587f['error'][_0xec8a('0x13')]);return _0x3c25d0(_0x2a587f[_0xec8a('0x11')]['message']);}logger[_0xec8a('0x11')](_0xec8a('0xd'),_0x54463b,_0x2a587f[_0xec8a('0x11')]['message']);return _0x1d03a7(_0x2a587f['error']['message']);}else{logger[_0xec8a('0xc')](_0xec8a('0xd'),_0x54463b,_0xec8a('0xe'));_0x1d03a7(_0x2a587f['result'][_0xec8a('0x13')]);}})[_0xec8a('0x14')](function(_0xc90b40){logger[_0xec8a('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x54463b,_0xc90b40);_0x3c25d0(_0xc90b40);});});}exports['CreateChatQueueReport']=function(_0x13b4fa){var _0xdefce2=this;return new Promise(function(_0x115323,_0x48a949){return db['ChatQueueReport'][_0xec8a('0x15')](_0x13b4fa['body'],{'raw':_0x13b4fa[_0xec8a('0x16')]?_0x13b4fa[_0xec8a('0x16')][_0xec8a('0x17')]===undefined?!![]:![]:!![]})[_0xec8a('0x18')](function(_0x4a1cd2){logger[_0xec8a('0xc')](_0xec8a('0x19'),_0x13b4fa);logger[_0xec8a('0x1a')](_0xec8a('0x19'),_0x13b4fa,JSON['stringify'](_0x4a1cd2));_0x115323(_0x4a1cd2);})[_0xec8a('0x14')](function(_0x3d29cc){logger['error'](_0xec8a('0x19'),_0x3d29cc[_0xec8a('0x13')],_0x13b4fa);_0x48a949(_0xdefce2[_0xec8a('0x11')](0x1f4,_0x3d29cc[_0xec8a('0x13')]));});});};exports[_0xec8a('0x1b')]=function(_0x31ea81){var _0x37af4d=this;return new Promise(function(_0x1c750f,_0x59f527){return db[_0xec8a('0x1c')][_0xec8a('0x1d')](_0x31ea81[_0xec8a('0x1e')],{'raw':_0x31ea81['options']?_0x31ea81['options'][_0xec8a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31ea81[_0xec8a('0x16')]?_0x31ea81['options'][_0xec8a('0x1f')]||null:null,'attributes':_0x31ea81[_0xec8a('0x16')]?_0x31ea81[_0xec8a('0x16')][_0xec8a('0x20')]||null:null,'limit':_0x31ea81['options']?_0x31ea81['options'][_0xec8a('0x21')]||null:null})[_0xec8a('0x18')](function(_0x5f2f70){logger[_0xec8a('0xc')](_0xec8a('0x1b'),_0x31ea81);logger['debug'](_0xec8a('0x1b'),_0x31ea81,JSON[_0xec8a('0x10')](_0x5f2f70));_0x1c750f(_0x5f2f70);})[_0xec8a('0x14')](function(_0x359ade){logger[_0xec8a('0x11')](_0xec8a('0x1b'),_0x359ade[_0xec8a('0x13')],_0x31ea81);_0x59f527(_0x37af4d[_0xec8a('0x11')](0x1f4,_0x359ade[_0xec8a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 79395ee..6ee6b01 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 _0x04e4=['describe','show','post','create','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x3cc69c,_0x534406){var _0x15be76=function(_0x36beb8){while(--_0x36beb8){_0x3cc69c['push'](_0x3cc69c['shift']());}};_0x15be76(++_0x534406);}(_0x04e4,0x103));var _0x404e=function(_0x18a68e,_0x29f1f0){_0x18a68e=_0x18a68e-0x0;var _0x2e6aee=_0x04e4[_0x18a68e];return _0x2e6aee;};'use strict';var multer=require(_0x404e('0x0'));var util=require(_0x404e('0x1'));var path=require(_0x404e('0x2'));var timeout=require(_0x404e('0x3'));var express=require(_0x404e('0x4'));var router=express['Router']();var fs_extra=require(_0x404e('0x5'));var auth=require(_0x404e('0x6'));var interaction=require(_0x404e('0x7'));var config=require(_0x404e('0x8'));var controller=require(_0x404e('0x9'));router[_0x404e('0xa')]('/',auth['isAuthenticated'](),controller[_0x404e('0xb')]);router[_0x404e('0xa')](_0x404e('0xc'),auth[_0x404e('0xd')](),controller[_0x404e('0xe')]);router[_0x404e('0xa')]('/:id',auth[_0x404e('0xd')](),controller[_0x404e('0xf')]);router[_0x404e('0x10')]('/',auth[_0x404e('0xd')](),controller[_0x404e('0x11')]);router['put'](_0x404e('0x12'),auth[_0x404e('0xd')](),controller['update']);router['delete'](_0x404e('0x12'),auth[_0x404e('0xd')](),controller[_0x404e('0x13')]);module[_0x404e('0x14')]=router; \ No newline at end of file +var _0x596e=['show','create','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x3d9cd7,_0x350c95){var _0x9c5fc5=function(_0x1ec7c7){while(--_0x1ec7c7){_0x3d9cd7['push'](_0x3d9cd7['shift']());}};_0x9c5fc5(++_0x350c95);}(_0x596e,0x7e));var _0xe596=function(_0x17be76,_0x51391a){_0x17be76=_0x17be76-0x0;var _0x19f68f=_0x596e[_0x17be76];return _0x19f68f;};'use strict';var multer=require(_0xe596('0x0'));var util=require('util');var path=require(_0xe596('0x1'));var timeout=require(_0xe596('0x2'));var express=require(_0xe596('0x3'));var router=express[_0xe596('0x4')]();var fs_extra=require(_0xe596('0x5'));var auth=require(_0xe596('0x6'));var interaction=require(_0xe596('0x7'));var config=require(_0xe596('0x8'));var controller=require('./chatQueueReport.controller');router[_0xe596('0x9')]('/',auth[_0xe596('0xa')](),controller[_0xe596('0xb')]);router[_0xe596('0x9')](_0xe596('0xc'),auth[_0xe596('0xa')](),controller[_0xe596('0xd')]);router['get']('/:id',auth[_0xe596('0xa')](),controller[_0xe596('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe596('0xf')]);router[_0xe596('0x10')]('/:id',auth[_0xe596('0xa')](),controller['update']);router['delete'](_0xe596('0x11'),auth[_0xe596('0xa')](),controller[_0xe596('0x12')]);module[_0xe596('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 2e11a1f..d550be0 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x45fda1,_0x1a96d0){var _0x4d0df8=function(_0x395a74){while(--_0x395a74){_0x45fda1['push'](_0x45fda1['shift']());}};_0x4d0df8(++_0x1a96d0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xf3cd[_0x415603];return _0x131e72;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x37f212,_0x9bf1b2){var _0x57ba32=function(_0xb71a58){while(--_0xb71a58){_0x37f212['push'](_0x37f212['shift']());}};_0x57ba32(++_0x9bf1b2);}(_0x54ef,0x112));var _0xf54e=function(_0x4d9408,_0xfc3d){_0x4d9408=_0x4d9408-0x0;var _0xde2d3=_0x54ef[_0x4d9408];return _0xde2d3;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c2e526a..cd6d8e0 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 _0x2f56=['update','then','end','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','fields','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0x53076d,_0x3170a4){var _0xabdd81=function(_0xfb1ce3){while(--_0xfb1ce3){_0x53076d['push'](_0x53076d['shift']());}};_0xabdd81(++_0x3170a4);}(_0x2f56,0xbe));var _0x62f5=function(_0x29fee8,_0x22ef76){_0x29fee8=_0x29fee8-0x0;var _0x3e4e97=_0x2f56[_0x29fee8];return _0x3e4e97;};'use strict';var emlformat=require(_0x62f5('0x0'));var rimraf=require(_0x62f5('0x1'));var zipdir=require(_0x62f5('0x2'));var jsonpatch=require(_0x62f5('0x3'));var rp=require(_0x62f5('0x4'));var moment=require(_0x62f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62f5('0x6'));var util=require(_0x62f5('0x7'));var path=require('path');var sox=require(_0x62f5('0x8'));var csv=require(_0x62f5('0x9'));var ejs=require(_0x62f5('0xa'));var fs=require('fs');var fs_extra=require(_0x62f5('0xb'));var _=require(_0x62f5('0xc'));var squel=require(_0x62f5('0xd'));var crypto=require(_0x62f5('0xe'));var jsforce=require(_0x62f5('0xf'));var deskjs=require(_0x62f5('0x10'));var toCsv=require(_0x62f5('0x9'));var querystring=require(_0x62f5('0x11'));var Papa=require(_0x62f5('0x12'));var Redis=require(_0x62f5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x62f5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62f5('0x15'));var logger=require(_0x62f5('0x16'))(_0x62f5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41601d,_0x290854){_0x290854=_0x290854||0xcc;return function(_0x59ccf1){if(_0x59ccf1){return _0x41601d[_0x62f5('0x18')](_0x290854);}return _0x41601d[_0x62f5('0x19')](_0x290854)['end']();};}function respondWithResult(_0x5f0869,_0x247730){_0x247730=_0x247730||0xc8;return function(_0x4f2a65){if(_0x4f2a65){return _0x5f0869[_0x62f5('0x19')](_0x247730)[_0x62f5('0x1a')](_0x4f2a65);}};}function respondWithFilteredResult(_0x491936,_0x6710db){return function(_0x33b128){if(_0x33b128){var _0x5cbc7b=typeof _0x6710db[_0x62f5('0x1b')]==='undefined'&&typeof _0x6710db[_0x62f5('0x1c')]===_0x62f5('0x1d');var _0x28d7f6=_0x33b128[_0x62f5('0x1e')];var _0x2fc202=_0x5cbc7b?0x0:_0x6710db[_0x62f5('0x1b')];var _0x3b5f9d=_0x5cbc7b?_0x33b128[_0x62f5('0x1e')]:_0x6710db[_0x62f5('0x1b')]+_0x6710db[_0x62f5('0x1c')];var _0x4c179b;if(_0x3b5f9d>=_0x28d7f6){_0x3b5f9d=_0x28d7f6;_0x4c179b=0xc8;}else{_0x4c179b=0xce;}_0x491936['status'](_0x4c179b);return _0x491936[_0x62f5('0x1f')](_0x62f5('0x20'),_0x2fc202+'-'+_0x3b5f9d+'/'+_0x28d7f6)[_0x62f5('0x1a')](_0x33b128);}return null;};}function patchUpdates(_0x162d81){return function(_0x4fec27){try{jsonpatch[_0x62f5('0x21')](_0x4fec27,_0x162d81,!![]);}catch(_0x62c99b){return BPromise['reject'](_0x62c99b);}return _0x4fec27[_0x62f5('0x22')]();};}function saveUpdates(_0x47e853,_0x37ea8d){return function(_0x4894b1){if(_0x4894b1){return _0x4894b1[_0x62f5('0x23')](_0x47e853)[_0x62f5('0x24')](function(_0x502052){return _0x502052;});}return null;};}function removeEntity(_0x33164e,_0x2bd9a6){return function(_0x4102a9){if(_0x4102a9){return _0x4102a9['destroy']()[_0x62f5('0x24')](function(){_0x33164e['status'](0xcc)[_0x62f5('0x25')]();});}};}function handleEntityNotFound(_0x5925f1,_0x12e48c){return function(_0x4972c1){if(!_0x4972c1){_0x5925f1[_0x62f5('0x18')](0x194);}return _0x4972c1;};}function handleError(_0x3948ee,_0x4515a1){_0x4515a1=_0x4515a1||0x1f4;return function(_0x2cbba9){logger[_0x62f5('0x26')](_0x2cbba9[_0x62f5('0x27')]);if(_0x2cbba9[_0x62f5('0x28')]){delete _0x2cbba9['name'];}_0x3948ee[_0x62f5('0x19')](_0x4515a1)['send'](_0x2cbba9);};}exports[_0x62f5('0x29')]=function(_0x2fa09e,_0x277df9){var _0x4490a8={},_0x458a99={},_0x4fc66b={'count':0x0,'rows':[]};var _0x3fe19d=_['map'](db[_0x62f5('0x2a')][_0x62f5('0x2b')],function(_0x5bd8fa){return{'name':_0x5bd8fa[_0x62f5('0x2c')],'type':_0x5bd8fa['type'][_0x62f5('0x2d')]};});_0x458a99['model']=_[_0x62f5('0x2e')](_0x3fe19d,_0x62f5('0x28'));_0x458a99['query']=_[_0x62f5('0x2f')](_0x2fa09e[_0x62f5('0x30')]);_0x458a99[_0x62f5('0x31')]=_[_0x62f5('0x32')](_0x458a99[_0x62f5('0x33')],_0x458a99['query']);_0x4490a8[_0x62f5('0x34')]=_[_0x62f5('0x32')](_0x458a99['model'],qs['fields'](_0x2fa09e[_0x62f5('0x30')]['fields']));_0x4490a8['attributes']=_0x4490a8['attributes'][_0x62f5('0x35')]?_0x4490a8[_0x62f5('0x34')]:_0x458a99[_0x62f5('0x33')];if(!_0x2fa09e['query'][_0x62f5('0x36')](_0x62f5('0x37'))){_0x4490a8[_0x62f5('0x1c')]=qs['limit'](_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x1c')]);_0x4490a8[_0x62f5('0x1b')]=qs[_0x62f5('0x1b')](_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x1b')]);}_0x4490a8[_0x62f5('0x38')]=qs[_0x62f5('0x39')](_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x39')]);_0x4490a8[_0x62f5('0x3a')]=qs[_0x62f5('0x31')](_['pick'](_0x2fa09e[_0x62f5('0x30')],_0x458a99[_0x62f5('0x31')]),_0x3fe19d);if(_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x3b')]){_0x4490a8[_0x62f5('0x3a')]=_[_0x62f5('0x3c')](_0x4490a8[_0x62f5('0x3a')],{'$or':_[_0x62f5('0x2e')](_0x3fe19d,function(_0x81c593){if(_0x81c593[_0x62f5('0x3d')]!==_0x62f5('0x3e')){var _0x251468={};_0x251468[_0x81c593[_0x62f5('0x28')]]={'$like':'%'+_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x3b')]+'%'};return _0x251468;}})});}_0x4490a8=_['merge']({},_0x4490a8,_0x2fa09e[_0x62f5('0x3f')]);var _0x490171={'where':_0x4490a8['where']};return db[_0x62f5('0x2a')][_0x62f5('0x1e')](_0x490171)[_0x62f5('0x24')](function(_0x3c7486){_0x4fc66b[_0x62f5('0x1e')]=_0x3c7486;if(_0x2fa09e[_0x62f5('0x30')][_0x62f5('0x40')]){_0x4490a8[_0x62f5('0x41')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x4490a8);})['then'](function(_0xecdda4){_0x4fc66b[_0x62f5('0x42')]=_0xecdda4;return _0x4fc66b;})[_0x62f5('0x24')](respondWithFilteredResult(_0x277df9,_0x4490a8))[_0x62f5('0x43')](handleError(_0x277df9,null));};exports[_0x62f5('0x44')]=function(_0x98804a,_0xb188fe){var _0x1e3c05={'raw':!![],'where':{'id':_0x98804a['params']['id']}},_0x1ef4ba={};_0x1ef4ba[_0x62f5('0x33')]=_[_0x62f5('0x2f')](db['ChatTransferReport'][_0x62f5('0x2b')]);_0x1ef4ba[_0x62f5('0x30')]=_[_0x62f5('0x2f')](_0x98804a[_0x62f5('0x30')]);_0x1ef4ba['filters']=_[_0x62f5('0x32')](_0x1ef4ba[_0x62f5('0x33')],_0x1ef4ba[_0x62f5('0x30')]);_0x1e3c05[_0x62f5('0x34')]=_[_0x62f5('0x32')](_0x1ef4ba[_0x62f5('0x33')],qs[_0x62f5('0x45')](_0x98804a[_0x62f5('0x30')]['fields']));_0x1e3c05[_0x62f5('0x34')]=_0x1e3c05['attributes'][_0x62f5('0x35')]?_0x1e3c05[_0x62f5('0x34')]:_0x1ef4ba[_0x62f5('0x33')];if(_0x98804a[_0x62f5('0x30')]['includeAll']){_0x1e3c05['include']=[{'all':!![]}];}_0x1e3c05=_[_0x62f5('0x3c')]({},_0x1e3c05,_0x98804a[_0x62f5('0x3f')]);return db[_0x62f5('0x2a')]['find'](_0x1e3c05)[_0x62f5('0x24')](handleEntityNotFound(_0xb188fe,null))[_0x62f5('0x24')](respondWithResult(_0xb188fe,null))[_0x62f5('0x43')](handleError(_0xb188fe,null));};exports[_0x62f5('0x46')]=function(_0x45a800,_0x43539d){return db[_0x62f5('0x2a')][_0x62f5('0x46')](_0x45a800[_0x62f5('0x47')],{})[_0x62f5('0x24')](respondWithResult(_0x43539d,0xc9))[_0x62f5('0x43')](handleError(_0x43539d,null));};exports[_0x62f5('0x23')]=function(_0x43ccb5,_0x2d15fa){if(_0x43ccb5[_0x62f5('0x47')]['id']){delete _0x43ccb5['body']['id'];}return db[_0x62f5('0x2a')][_0x62f5('0x48')]({'where':{'id':_0x43ccb5['params']['id']}})['then'](handleEntityNotFound(_0x2d15fa,null))[_0x62f5('0x24')](saveUpdates(_0x43ccb5[_0x62f5('0x47')],null))['then'](respondWithResult(_0x2d15fa,null))[_0x62f5('0x43')](handleError(_0x2d15fa,null));};exports[_0x62f5('0x49')]=function(_0x4a77d5,_0x96d1b0){return db[_0x62f5('0x2a')][_0x62f5('0x48')]({'where':{'id':_0x4a77d5['params']['id']}})['then'](handleEntityNotFound(_0x96d1b0,null))[_0x62f5('0x24')](removeEntity(_0x96d1b0,null))[_0x62f5('0x43')](handleError(_0x96d1b0,null));};exports[_0x62f5('0x4a')]=function(_0x552c88,_0x5e19b2){return db[_0x62f5('0x2a')][_0x62f5('0x4a')]()[_0x62f5('0x24')](respondWithResult(_0x5e19b2,null))[_0x62f5('0x43')](handleError(_0x5e19b2,null));}; \ No newline at end of file +var _0x9489=['filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','type','ChatTransferReport','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','query'];(function(_0x5d4b3d,_0x3c3ad4){var _0x55e880=function(_0x47085c){while(--_0x47085c){_0x5d4b3d['push'](_0x5d4b3d['shift']());}};_0x55e880(++_0x3c3ad4);}(_0x9489,0x148));var _0x9948=function(_0x3bac72,_0x5745fb){_0x3bac72=_0x3bac72-0x0;var _0x3ef51f=_0x9489[_0x3bac72];return _0x3ef51f;};'use strict';var emlformat=require(_0x9948('0x0'));var rimraf=require(_0x9948('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9948('0x2'));var rp=require(_0x9948('0x3'));var moment=require(_0x9948('0x4'));var BPromise=require(_0x9948('0x5'));var Mustache=require('mustache');var util=require(_0x9948('0x6'));var path=require('path');var sox=require(_0x9948('0x7'));var csv=require('to-csv');var ejs=require(_0x9948('0x8'));var fs=require('fs');var fs_extra=require(_0x9948('0x9'));var _=require(_0x9948('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9948('0xb'));var querystring=require(_0x9948('0xc'));var Papa=require(_0x9948('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9948('0xe'));var as=require(_0x9948('0xf'));var hardwareService=require(_0x9948('0x10'));var logger=require(_0x9948('0x11'))(_0x9948('0x12'));var utils=require(_0x9948('0x13'));var config=require(_0x9948('0x14'));var licenseUtil=require(_0x9948('0x15'));var db=require(_0x9948('0x16'))['db'];function respondWithStatusCode(_0x767f05,_0x485d3a){_0x485d3a=_0x485d3a||0xcc;return function(_0x406b53){if(_0x406b53){return _0x767f05[_0x9948('0x17')](_0x485d3a);}return _0x767f05['status'](_0x485d3a)['end']();};}function respondWithResult(_0x57203c,_0x2c622c){_0x2c622c=_0x2c622c||0xc8;return function(_0x4d604e){if(_0x4d604e){return _0x57203c[_0x9948('0x18')](_0x2c622c)[_0x9948('0x19')](_0x4d604e);}};}function respondWithFilteredResult(_0x2094a2,_0x1de7c0){return function(_0x43403d){if(_0x43403d){var _0x205c84=typeof _0x1de7c0[_0x9948('0x1a')]===_0x9948('0x1b')&&typeof _0x1de7c0[_0x9948('0x1c')]===_0x9948('0x1b');var _0x5cfc0d=_0x43403d[_0x9948('0x1d')];var _0x25af22=_0x205c84?0x0:_0x1de7c0[_0x9948('0x1a')];var _0x19841b=_0x205c84?_0x43403d[_0x9948('0x1d')]:_0x1de7c0[_0x9948('0x1a')]+_0x1de7c0['limit'];var _0xf2443e;if(_0x19841b>=_0x5cfc0d){_0x19841b=_0x5cfc0d;_0xf2443e=0xc8;}else{_0xf2443e=0xce;}_0x2094a2['status'](_0xf2443e);return _0x2094a2[_0x9948('0x1e')](_0x9948('0x1f'),_0x25af22+'-'+_0x19841b+'/'+_0x5cfc0d)[_0x9948('0x19')](_0x43403d);}return null;};}function patchUpdates(_0x2de49e){return function(_0x3b6f9b){try{jsonpatch[_0x9948('0x20')](_0x3b6f9b,_0x2de49e,!![]);}catch(_0x528cff){return BPromise[_0x9948('0x21')](_0x528cff);}return _0x3b6f9b[_0x9948('0x22')]();};}function saveUpdates(_0x3f1c00,_0x398b30){return function(_0xad1b00){if(_0xad1b00){return _0xad1b00['update'](_0x3f1c00)[_0x9948('0x23')](function(_0x46c011){return _0x46c011;});}return null;};}function removeEntity(_0x16e7fa,_0x5c493b){return function(_0x54965f){if(_0x54965f){return _0x54965f['destroy']()['then'](function(){_0x16e7fa[_0x9948('0x18')](0xcc)[_0x9948('0x24')]();});}};}function handleEntityNotFound(_0x3ca5e6,_0x381c14){return function(_0x3c68d8){if(!_0x3c68d8){_0x3ca5e6['sendStatus'](0x194);}return _0x3c68d8;};}function handleError(_0x580307,_0xb6e7dd){_0xb6e7dd=_0xb6e7dd||0x1f4;return function(_0x463c40){logger[_0x9948('0x25')](_0x463c40[_0x9948('0x26')]);if(_0x463c40['name']){delete _0x463c40[_0x9948('0x27')];}_0x580307[_0x9948('0x18')](_0xb6e7dd)[_0x9948('0x28')](_0x463c40);};}exports[_0x9948('0x29')]=function(_0x92c4e,_0x1ad488){var _0x44962d={},_0x39c51e={},_0x350e5e={'count':0x0,'rows':[]};var _0x58799f=_['map'](db['ChatTransferReport'][_0x9948('0x2a')],function(_0x2c97ea){return{'name':_0x2c97ea[_0x9948('0x2b')],'type':_0x2c97ea['type'][_0x9948('0x2c')]};});_0x39c51e[_0x9948('0x2d')]=_['map'](_0x58799f,_0x9948('0x27'));_0x39c51e[_0x9948('0x2e')]=_['keys'](_0x92c4e[_0x9948('0x2e')]);_0x39c51e[_0x9948('0x2f')]=_[_0x9948('0x30')](_0x39c51e['model'],_0x39c51e[_0x9948('0x2e')]);_0x44962d[_0x9948('0x31')]=_[_0x9948('0x30')](_0x39c51e['model'],qs[_0x9948('0x32')](_0x92c4e['query'][_0x9948('0x32')]));_0x44962d[_0x9948('0x31')]=_0x44962d['attributes'][_0x9948('0x33')]?_0x44962d[_0x9948('0x31')]:_0x39c51e[_0x9948('0x2d')];if(!_0x92c4e[_0x9948('0x2e')]['hasOwnProperty'](_0x9948('0x34'))){_0x44962d[_0x9948('0x1c')]=qs[_0x9948('0x1c')](_0x92c4e[_0x9948('0x2e')][_0x9948('0x1c')]);_0x44962d[_0x9948('0x1a')]=qs['offset'](_0x92c4e[_0x9948('0x2e')][_0x9948('0x1a')]);}_0x44962d['order']=qs['sort'](_0x92c4e[_0x9948('0x2e')][_0x9948('0x35')]);_0x44962d[_0x9948('0x36')]=qs[_0x9948('0x2f')](_[_0x9948('0x37')](_0x92c4e[_0x9948('0x2e')],_0x39c51e['filters']),_0x58799f);if(_0x92c4e[_0x9948('0x2e')][_0x9948('0x38')]){_0x44962d['where']=_[_0x9948('0x39')](_0x44962d[_0x9948('0x36')],{'$or':_[_0x9948('0x3a')](_0x58799f,function(_0x1a3ea8){if(_0x1a3ea8[_0x9948('0x3b')]!=='VIRTUAL'){var _0x336439={};_0x336439[_0x1a3ea8[_0x9948('0x27')]]={'$like':'%'+_0x92c4e['query']['filter']+'%'};return _0x336439;}})});}_0x44962d=_[_0x9948('0x39')]({},_0x44962d,_0x92c4e['options']);var _0x4626e2={'where':_0x44962d[_0x9948('0x36')]};return db[_0x9948('0x3c')][_0x9948('0x1d')](_0x4626e2)[_0x9948('0x23')](function(_0x1d8a38){_0x350e5e[_0x9948('0x1d')]=_0x1d8a38;if(_0x92c4e[_0x9948('0x2e')][_0x9948('0x3d')]){_0x44962d[_0x9948('0x3e')]=[{'all':!![]}];}return db[_0x9948('0x3c')][_0x9948('0x3f')](_0x44962d);})[_0x9948('0x23')](function(_0x2c3820){_0x350e5e['rows']=_0x2c3820;return _0x350e5e;})['then'](respondWithFilteredResult(_0x1ad488,_0x44962d))[_0x9948('0x40')](handleError(_0x1ad488,null));};exports[_0x9948('0x41')]=function(_0x3fa995,_0x33bafa){var _0x5d7b0c={'raw':!![],'where':{'id':_0x3fa995[_0x9948('0x42')]['id']}},_0x1ebc67={};_0x1ebc67[_0x9948('0x2d')]=_['keys'](db[_0x9948('0x3c')][_0x9948('0x2a')]);_0x1ebc67[_0x9948('0x2e')]=_[_0x9948('0x43')](_0x3fa995[_0x9948('0x2e')]);_0x1ebc67[_0x9948('0x2f')]=_[_0x9948('0x30')](_0x1ebc67[_0x9948('0x2d')],_0x1ebc67[_0x9948('0x2e')]);_0x5d7b0c[_0x9948('0x31')]=_[_0x9948('0x30')](_0x1ebc67[_0x9948('0x2d')],qs['fields'](_0x3fa995[_0x9948('0x2e')][_0x9948('0x32')]));_0x5d7b0c[_0x9948('0x31')]=_0x5d7b0c[_0x9948('0x31')][_0x9948('0x33')]?_0x5d7b0c[_0x9948('0x31')]:_0x1ebc67[_0x9948('0x2d')];if(_0x3fa995[_0x9948('0x2e')]['includeAll']){_0x5d7b0c['include']=[{'all':!![]}];}_0x5d7b0c=_['merge']({},_0x5d7b0c,_0x3fa995[_0x9948('0x44')]);return db[_0x9948('0x3c')][_0x9948('0x45')](_0x5d7b0c)['then'](handleEntityNotFound(_0x33bafa,null))[_0x9948('0x23')](respondWithResult(_0x33bafa,null))[_0x9948('0x40')](handleError(_0x33bafa,null));};exports[_0x9948('0x46')]=function(_0x42891b,_0x1cc76d){return db[_0x9948('0x3c')][_0x9948('0x46')](_0x42891b[_0x9948('0x47')],{})['then'](respondWithResult(_0x1cc76d,0xc9))[_0x9948('0x40')](handleError(_0x1cc76d,null));};exports[_0x9948('0x48')]=function(_0x249c1e,_0x3289c4){if(_0x249c1e[_0x9948('0x47')]['id']){delete _0x249c1e['body']['id'];}return db[_0x9948('0x3c')]['find']({'where':{'id':_0x249c1e['params']['id']}})[_0x9948('0x23')](handleEntityNotFound(_0x3289c4,null))['then'](saveUpdates(_0x249c1e[_0x9948('0x47')],null))[_0x9948('0x23')](respondWithResult(_0x3289c4,null))[_0x9948('0x40')](handleError(_0x3289c4,null));};exports[_0x9948('0x49')]=function(_0xf61de2,_0x4532b7){return db[_0x9948('0x3c')][_0x9948('0x45')]({'where':{'id':_0xf61de2[_0x9948('0x42')]['id']}})[_0x9948('0x23')](handleEntityNotFound(_0x4532b7,null))['then'](removeEntity(_0x4532b7,null))[_0x9948('0x40')](handleError(_0x4532b7,null));};exports[_0x9948('0x4a')]=function(_0x22b6f8,_0x283a5d){return db[_0x9948('0x3c')]['describe']()['then'](respondWithResult(_0x283a5d,null))[_0x9948('0x40')](handleError(_0x283a5d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index aa02e87..d2de1b7 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 _0x681c=['request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','bluebird'];(function(_0x4e16fd,_0x28e642){var _0x258205=function(_0x62eec0){while(--_0x62eec0){_0x4e16fd['push'](_0x4e16fd['shift']());}};_0x258205(++_0x28e642);}(_0x681c,0x1c6));var _0xc681=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x681c[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0xc681('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc681('0x1'));var rp=require(_0xc681('0x2'));var fs=require('fs');var path=require(_0xc681('0x3'));var rimraf=require(_0xc681('0x4'));var config=require(_0xc681('0x5'));var attributes=require(_0xc681('0x6'));module[_0xc681('0x7')]=function(_0x1a16d6,_0x21c971){return _0x1a16d6[_0xc681('0x8')](_0xc681('0x9'),attributes,{'tableName':_0xc681('0xa'),'paranoid':![],'indexes':[{'name':_0xc681('0xb'),'fields':[_0xc681('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d7c=['api','bluebird','request-promise','path','exports','define','ChatTransferReport','report_chat_transfer','../../config/logger'];(function(_0x274fda,_0x55ce9c){var _0x54098a=function(_0x2cf2b9){while(--_0x2cf2b9){_0x274fda['push'](_0x274fda['shift']());}};_0x54098a(++_0x55ce9c);}(_0x9d7c,0x13a));var _0xc9d7=function(_0x3a3afe,_0x15da25){_0x3a3afe=_0x3a3afe-0x0;var _0x262dab=_0x9d7c[_0x3a3afe];return _0x262dab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9d7('0x0'))(_0xc9d7('0x1'));var moment=require('moment');var BPromise=require(_0xc9d7('0x2'));var rp=require(_0xc9d7('0x3'));var fs=require('fs');var path=require(_0xc9d7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0xc9d7('0x5')]=function(_0x185e33,_0x56bc11){return _0x185e33[_0xc9d7('0x6')](_0xc9d7('0x7'),attributes,{'tableName':_0xc9d7('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 93d1a65..7df98ca 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 _0xb9e6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x57e1b2,_0x4d7a48){var _0x5218b7=function(_0x54fcd3){while(--_0x54fcd3){_0x57e1b2['push'](_0x57e1b2['shift']());}};_0x5218b7(++_0x4d7a48);}(_0xb9e6,0xf8));var _0x6b9e=function(_0x5ef455,_0x3cf7d5){_0x5ef455=_0x5ef455-0x0;var _0x1b788d=_0xb9e6[_0x5ef455];return _0x1b788d;};'use strict';var _=require('lodash');var util=require(_0x6b9e('0x0'));var moment=require(_0x6b9e('0x1'));var BPromise=require(_0x6b9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b9e('0x3'));var db=require(_0x6b9e('0x4'))['db'];var utils=require(_0x6b9e('0x5'));var logger=require(_0x6b9e('0x6'))(_0x6b9e('0x7'));var config=require(_0x6b9e('0x8'));var jayson=require(_0x6b9e('0x9'));var client=jayson['client'][_0x6b9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25d678,_0x2a35d9,_0x3f6685){return new BPromise(function(_0xfdc84d,_0x939637){return client[_0x6b9e('0xb')](_0x25d678,_0x3f6685)['then'](function(_0x25e252){logger[_0x6b9e('0xc')](_0x6b9e('0xd'),_0x2a35d9,_0x6b9e('0xe'));logger[_0x6b9e('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2a35d9,_0x6b9e('0xe'),JSON['stringify'](_0x25e252));if(_0x25e252['error']){if(_0x25e252[_0x6b9e('0x10')][_0x6b9e('0x11')]===0x1f4){logger[_0x6b9e('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2a35d9,_0x25e252[_0x6b9e('0x10')][_0x6b9e('0x12')]);return _0x939637(_0x25e252['error']['message']);}logger['error'](_0x6b9e('0xd'),_0x2a35d9,_0x25e252[_0x6b9e('0x10')][_0x6b9e('0x12')]);return _0xfdc84d(_0x25e252[_0x6b9e('0x10')][_0x6b9e('0x12')]);}else{logger[_0x6b9e('0xc')](_0x6b9e('0xd'),_0x2a35d9,_0x6b9e('0xe'));_0xfdc84d(_0x25e252[_0x6b9e('0x13')][_0x6b9e('0x12')]);}})[_0x6b9e('0x14')](function(_0x35ce22){logger[_0x6b9e('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x2a35d9,_0x35ce22);_0x939637(_0x35ce22);});});} \ No newline at end of file +var _0x86c1=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1d2bd7,_0x4408ec){var _0x2664b5=function(_0x1949aa){while(--_0x1949aa){_0x1d2bd7['push'](_0x1d2bd7['shift']());}};_0x2664b5(++_0x4408ec);}(_0x86c1,0x197));var _0x186c=function(_0x24d103,_0x3fa3bc){_0x24d103=_0x24d103-0x0;var _0x4c8380=_0x86c1[_0x24d103];return _0x4c8380;};'use strict';var _=require(_0x186c('0x0'));var util=require(_0x186c('0x1'));var moment=require('moment');var BPromise=require(_0x186c('0x2'));var rs=require(_0x186c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x186c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x186c('0x5'))(_0x186c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf56d8e,_0x2ec276,_0x5541dd){return new BPromise(function(_0xa8e603,_0x45bced){return client['request'](_0xf56d8e,_0x5541dd)['then'](function(_0x2bf197){logger[_0x186c('0x7')](_0x186c('0x8'),_0x2ec276,_0x186c('0x9'));logger['debug'](_0x186c('0xa'),_0x2ec276,_0x186c('0x9'),JSON[_0x186c('0xb')](_0x2bf197));if(_0x2bf197[_0x186c('0xc')]){if(_0x2bf197[_0x186c('0xc')][_0x186c('0xd')]===0x1f4){logger[_0x186c('0xc')](_0x186c('0x8'),_0x2ec276,_0x2bf197['error'][_0x186c('0xe')]);return _0x45bced(_0x2bf197[_0x186c('0xc')][_0x186c('0xe')]);}logger[_0x186c('0xc')](_0x186c('0x8'),_0x2ec276,_0x2bf197[_0x186c('0xc')][_0x186c('0xe')]);return _0xa8e603(_0x2bf197[_0x186c('0xc')]['message']);}else{logger[_0x186c('0x7')](_0x186c('0x8'),_0x2ec276,_0x186c('0x9'));_0xa8e603(_0x2bf197[_0x186c('0xf')][_0x186c('0xe')]);}})[_0x186c('0x10')](function(_0x263196){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2ec276,_0x263196);_0x45bced(_0x263196);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index c49fda1..d84d678 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 _0xb4c3=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4c3,0x1e1));var _0x3b4c=function(_0x527c5f,_0x593d0d){_0x527c5f=_0x527c5f-0x0;var _0x38ae95=_0xb4c3[_0x527c5f];return _0x38ae95;};'use strict';var multer=require(_0x3b4c('0x0'));var util=require(_0x3b4c('0x1'));var path=require(_0x3b4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b4c('0x3'));var router=express['Router']();var fs_extra=require(_0x3b4c('0x4'));var auth=require(_0x3b4c('0x5'));var interaction=require(_0x3b4c('0x6'));var config=require(_0x3b4c('0x7'));var controller=require(_0x3b4c('0x8'));router[_0x3b4c('0x9')]('/',auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xb')]);router[_0x3b4c('0x9')](_0x3b4c('0xc'),auth[_0x3b4c('0xa')](),controller['describe']);router[_0x3b4c('0x9')](_0x3b4c('0xd'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0xe')]);router[_0x3b4c('0xf')]('/',auth[_0x3b4c('0xa')](),controller['create']);router[_0x3b4c('0x10')](_0x3b4c('0xd'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0x11')]);router['delete'](_0x3b4c('0xd'),auth[_0x3b4c('0xa')](),controller[_0x3b4c('0x12')]);module[_0x3b4c('0x13')]=router; \ No newline at end of file +var _0x6a04=['show','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','isAuthenticated','describe'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0x6a04,0xa6));var _0x46a0=function(_0x1ece91,_0x5318b9){_0x1ece91=_0x1ece91-0x0;var _0x24804b=_0x6a04[_0x1ece91];return _0x24804b;};'use strict';var multer=require(_0x46a0('0x0'));var util=require(_0x46a0('0x1'));var path=require(_0x46a0('0x2'));var timeout=require(_0x46a0('0x3'));var express=require(_0x46a0('0x4'));var router=express[_0x46a0('0x5')]();var fs_extra=require(_0x46a0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x46a0('0x7'));var config=require(_0x46a0('0x8'));var controller=require(_0x46a0('0x9'));router[_0x46a0('0xa')]('/',auth['isAuthenticated'](),controller[_0x46a0('0xb')]);router[_0x46a0('0xa')]('/describe',auth[_0x46a0('0xc')](),controller[_0x46a0('0xd')]);router[_0x46a0('0xa')]('/:id',auth[_0x46a0('0xc')](),controller[_0x46a0('0xe')]);router['post']('/',auth[_0x46a0('0xc')](),controller['create']);router[_0x46a0('0xf')](_0x46a0('0x10'),auth[_0x46a0('0xc')](),controller[_0x46a0('0x11')]);router['delete'](_0x46a0('0x10'),auth['isAuthenticated'](),controller[_0x46a0('0x12')]);module[_0x46a0('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index cbfcbe6..5ffa8fa 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 _0x0713=['offlineForm','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','thumb','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x3071('0x0')]={'name':{'type':Sequelize[_0x3071('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'unique':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x3')},'mapKeyOffline':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x3')},'key':{'type':Sequelize[_0x3071('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x4')},'customerAlias':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3071('0x1')]},'animation':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3071('0x9')]('rounded',_0x3071('0xa')),'defaultValue':_0x3071('0xb')},'header_online':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xc')},'start_chat_button':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0xe')},'download_transcript':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3071('0xf')]},'closingQuestion':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x12')},'noteTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x14')},'closingMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x15')},'closingMessageButton':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xd')},'skipMessageButton':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x16')},'conditionAgreement':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x3071('0x9')]('star',_0x3071('0x17')),'defaultValue':_0x3071('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return JSON[_0x3071('0x19')]({'items':[{'type':_0x3071('0x1a'),'variable':null,'config':{'placeholder':_0x3071('0x1b'),'type':_0x3071('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x3071('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3071('0x3'),'type':_0x3071('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3071('0x1d')](_0x3071('0x1e'))?JSON[_0x3071('0x1f')](this[_0x3071('0x1d')](_0x3071('0x1e'))):{};},'set':function(_0x1de5fb){return this['setDataValue'](_0x3071('0x1e'),JSON[_0x3071('0x19')](_0x1de5fb));}},'offlineForm':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3071('0x1a'),'props':{'title':_0x3071('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3071('0x3'),'type':_0x3071('0x3')},'variable':null},{'type':_0x3071('0x20'),'config':{'placeholder':_0x3071('0x21')},'props':{'title':_0x3071('0x21'),'helpText':_0x3071('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x3071('0x1d')](_0x3071('0x23'))?JSON[_0x3071('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x9e26d1){return this[_0x3071('0x24')](_0x3071('0x23'),JSON[_0x3071('0x19')](_0x9e26d1));}},'token':{'type':Sequelize[_0x3071('0x1')],'defaultValue':function(){return rs[_0x3071('0x25')]();}},'autoclose':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3071('0x1')]},'waitingTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x29')},'skipUnmanaged':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x16')},'sendUnmanaged':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3071('0x1')]},'notificationTemplate':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2b')},'verticalAlignment':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2c')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2d')},'defaultTitle':{'type':Sequelize[_0x3071('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2f')},'systemAvatar':{'type':Sequelize[_0x3071('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3071('0x7')],'comment':_0x3071('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x53ed25){if(!_0x53ed25)this[_0x3071('0x24')](_0x3071('0x31'),null);this[_0x3071('0x24')](_0x3071('0x32'),_0x53ed25);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3071('0x1')]},'vidaooTopic':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x33')},'vidaooNote':{'type':Sequelize[_0x3071('0x1')],'defaultValue':function(){return _0x3071('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x3071('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3071('0xf')]}}; \ No newline at end of file +var _0x2dae=['Send','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','TEXT','textarea','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared'];(function(_0x4c3ba0,_0xdc0e0f){var _0xe09d6d=function(_0x301d8c){while(--_0x301d8c){_0x4c3ba0['push'](_0x4c3ba0['shift']());}};_0xe09d6d(++_0xdc0e0f);}(_0x2dae,0xc3));var _0xe2da=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x2dae[_0x5466ab];return _0x40751a;};'use strict';var Sequelize=require(_0xe2da('0x0'));var rs=require('randomstring');module[_0xe2da('0x1')]={'name':{'type':Sequelize[_0xe2da('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xe2da('0x2')],'allowNull':![],'unique':_0xe2da('0x3')},'description':{'type':Sequelize[_0xe2da('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xe2da('0x4')},'mapKeyOffline':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x4')},'key':{'type':Sequelize[_0xe2da('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xe2da('0x5')},'customerAlias':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe2da('0x2')],'allowNull':![],'defaultValue':_0xe2da('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe2da('0x2')],'allowNull':![],'defaultValue':_0xe2da('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe2da('0x2')],'allowNull':![],'defaultValue':_0xe2da('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xe2da('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xe2da('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xe2da('0x2')]},'animation':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe2da('0xa')](_0xe2da('0xb'),_0xe2da('0xc')),'defaultValue':_0xe2da('0xb')},'header_online':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0xd')},'header_offline':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0xe')},'download_transcript':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xe2da('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xe2da('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x10')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe2da('0x11')},'noteTitle':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x12')},'placeholderMessage':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x13')},'closingMessageButton':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0xd')},'skipMessageButton':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x14')},'ratingType':{'type':Sequelize[_0xe2da('0xa')](_0xe2da('0x15'),_0xe2da('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xe2da('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xe2da('0x17')]({'items':[{'type':_0xe2da('0x18'),'variable':null,'config':{'placeholder':_0xe2da('0x19'),'type':_0xe2da('0x1a'),'required':!![]},'props':{'title':_0xe2da('0x19'),'helpText':''}},{'type':_0xe2da('0x18'),'props':{'title':_0xe2da('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe2da('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe2da('0x1b')](_0xe2da('0x1c'))?JSON[_0xe2da('0x1d')](this[_0xe2da('0x1b')](_0xe2da('0x1c'))):{};},'set':function(_0x230fb8){return this[_0xe2da('0x1e')]('onlineForm',JSON[_0xe2da('0x17')](_0x230fb8));}},'offlineForm':{'type':Sequelize[_0xe2da('0x1f')],'defaultValue':function(){return JSON[_0xe2da('0x17')]({'items':[{'type':_0xe2da('0x18'),'props':{'title':_0xe2da('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe2da('0x4'),'type':_0xe2da('0x4')},'variable':null},{'type':_0xe2da('0x20'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xe2da('0x1b')](_0xe2da('0x21'))?JSON[_0xe2da('0x1d')](this[_0xe2da('0x1b')]('offlineForm')):{};},'set':function(_0x490794){return this[_0xe2da('0x1e')](_0xe2da('0x21'),JSON[_0xe2da('0x17')](_0x490794));}},'token':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':function(){return rs[_0xe2da('0x22')]();}},'autoclose':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe2da('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x23')},'waitingMessage':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x25')},'offlineMessageBody':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x27')},'skipUnmanaged':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x28')},'sendUnmanaged':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe2da('0x1f')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe2da('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe2da('0x1f')],'defaultValue':function(){return _0xe2da('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x2b')},'messagesAlignment':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x2c')},'defaultTitle':{'type':Sequelize[_0xe2da('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe2da('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe2da('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':_0xe2da('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![],'comment':_0xe2da('0x2f'),'set':function(_0x26ba99){if(!_0x26ba99)this[_0xe2da('0x1e')](_0xe2da('0x30'),null);this[_0xe2da('0x1e')](_0xe2da('0x31'),_0x26ba99);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xe2da('0x2')]},'vidaooTopic':{'type':Sequelize[_0xe2da('0x2')],'allowNull':![],'defaultValue':_0xe2da('0x32')},'vidaooNote':{'type':Sequelize[_0xe2da('0x2')],'defaultValue':function(){return _0xe2da('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xe2da('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xe2da('0x1f')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 8dd61c5..6930dc2 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 _0x1e3c=['sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','toPairsIn','subjectOffline','email','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','virtual','increment','chatLicenseExceeded','push','all','some','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','x-real-ip','connection','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','addApplications','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','update','get','ChatWebsites','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','keys','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','params','ChatWebsiteId','findOne','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','download','getAvatar','server/files/images/avatars/default_avatar.png','root','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','CmContact','Contacts','DESC','ChatApplication','account','applications','list','orderBy','priority','asc','Applications','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','device','%s\x20%s\x20%s','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','offline','ListId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','openNewInteraction','sequelize','transaction','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail'];(function(_0x4f24e8,_0xe02072){var _0x15e2b8=function(_0x5ca31f){while(--_0x5ca31f){_0x4f24e8['push'](_0x4f24e8['shift']());}};_0x15e2b8(++_0xe02072);}(_0x1e3c,0x178));var _0xc1e3=function(_0x1d9088,_0x1cc0bd){_0x1d9088=_0x1d9088-0x0;var _0x4ee896=_0x1e3c[_0x1d9088];return _0x4ee896;};'use strict';var BPromise=require(_0xc1e3('0x0'));var Mustache=require(_0xc1e3('0x1'));var util=require(_0xc1e3('0x2'));var path=require(_0xc1e3('0x3'));var ejs=require(_0xc1e3('0x4'));var fs=require('fs');var fs_extra=require(_0xc1e3('0x5'));var _=require(_0xc1e3('0x6'));var querystring=require(_0xc1e3('0x7'));var Redis=require(_0xc1e3('0x8'));var qs=require(_0xc1e3('0x9'));var logger=require(_0xc1e3('0xa'))(_0xc1e3('0xb'));var config=require(_0xc1e3('0xc'));var url=require(_0xc1e3('0xd'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc1e3('0xe')](config[_0xc1e3('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xc1e3('0x10'))(new Redis(config[_0xc1e3('0xf')]));require('./chatWebsite.socket')[_0xc1e3('0x11')](socket);var htmlToText=require('html-to-text');var jayson=require(_0xc1e3('0x12'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc1e3('0x13')][_0xc1e3('0x14')]({'port':0x232a});var client9003=jayson[_0xc1e3('0x13')][_0xc1e3('0x14')]({'port':0x232b});var client9001=jayson['client'][_0xc1e3('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x10adb6,_0x509630,_0x53462b,_0x4765df){return new BPromise(function(_0x3adac0,_0x249875){var _0x5814a1=_0x4765df||client;return _0x5814a1[_0xc1e3('0x15')](_0x10adb6,_0x53462b)[_0xc1e3('0x16')](function(_0x41b544){logger[_0xc1e3('0x17')](_0xc1e3('0x18'),_0x509630,_0xc1e3('0x19'));logger[_0xc1e3('0x1a')](_0xc1e3('0x1b'),_0x509630,_0xc1e3('0x19'),JSON['stringify'](_0x41b544));if(_0x41b544[_0xc1e3('0x1c')]){if(_0x41b544['error'][_0xc1e3('0x1d')]===0x1f4){logger['error'](_0xc1e3('0x18'),_0x509630,_0x41b544[_0xc1e3('0x1c')]['message']);return _0x249875(_0x41b544['error'][_0xc1e3('0x1e')]);}logger['error'](_0xc1e3('0x18'),_0x509630,_0x41b544[_0xc1e3('0x1c')]['message']);return _0x3adac0(_0x41b544[_0xc1e3('0x1c')][_0xc1e3('0x1e')]);}else{logger[_0xc1e3('0x17')](_0xc1e3('0x18'),_0x509630,'request\x20sent');_0x3adac0(_0x41b544[_0xc1e3('0x1f')][_0xc1e3('0x1e')]);}})[_0xc1e3('0x20')](function(_0x28066a){logger[_0xc1e3('0x1c')](_0xc1e3('0x18'),_0x509630,_0x28066a);_0x249875(_0x28066a);});});}function respondWithStatusCode(_0x20daf7,_0x4eb8e2){_0x4eb8e2=_0x4eb8e2||0xcc;return function(_0x104129){if(_0x104129){return _0x20daf7[_0xc1e3('0x21')](_0x4eb8e2);}return _0x20daf7[_0xc1e3('0x22')](_0x4eb8e2)['end']();};}function respondWithResult(_0x472859,_0x4bcd73){_0x4bcd73=_0x4bcd73||0xc8;return function(_0x38fdfa){if(_0x38fdfa){return _0x472859[_0xc1e3('0x22')](_0x4bcd73)[_0xc1e3('0x23')](_0x38fdfa);}};}function respondWithFilteredResult(_0x496959,_0x491143){return function(_0x465527){if(_0x465527){var _0x17837e=typeof _0x491143[_0xc1e3('0x24')]===_0xc1e3('0x25')&&typeof _0x491143['limit']==='undefined';var _0x1c6116=_0x465527['count'];var _0x5aef7d=_0x17837e?0x0:_0x491143[_0xc1e3('0x24')];var _0x68ac43=_0x17837e?_0x465527[_0xc1e3('0x26')]:_0x491143[_0xc1e3('0x24')]+_0x491143[_0xc1e3('0x27')];var _0x346e29;if(_0x68ac43>=_0x1c6116){_0x68ac43=_0x1c6116;_0x346e29=0xc8;}else{_0x346e29=0xce;}_0x496959[_0xc1e3('0x22')](_0x346e29);return _0x496959[_0xc1e3('0x28')]('Content-Range',_0x5aef7d+'-'+_0x68ac43+'/'+_0x1c6116)['json'](_0x465527);}return null;};}function saveUpdates(_0x44299a){return function(_0x476c5c){if(_0x476c5c){return _0x476c5c[_0xc1e3('0x29')](_0x44299a)[_0xc1e3('0x16')](function(_0x14fcac){return _0x14fcac;});}return null;};}function removeEntity(_0x4297a5){return function(_0x3eee41){if(_0x3eee41){return _0x3eee41['destroy']()[_0xc1e3('0x16')](function(){var _0x58a4e0=_0x3eee41[_0xc1e3('0x2a')]({'plain':!![]});var _0x535f9f=_0xc1e3('0x2b');return db[_0xc1e3('0x2c')]['destroy']({'where':{'type':_0x535f9f,'resourceId':_0x58a4e0['id']}})[_0xc1e3('0x16')](function(){return _0x3eee41;});})[_0xc1e3('0x16')](function(){_0x4297a5[_0xc1e3('0x22')](0xcc)[_0xc1e3('0x2d')]();});}};}function handleEntityNotFound(_0x45ed64){return function(_0x3bf1fe){if(!_0x3bf1fe){_0x45ed64['sendStatus'](0x194);}return _0x3bf1fe;};}function handleError(_0x4da27f,_0x15290f){_0x15290f=_0x15290f||0x1f4;return function(_0x347603){logger[_0xc1e3('0x1c')](_0x347603[_0xc1e3('0x2e')]);if(_0x347603[_0xc1e3('0x2f')]){delete _0x347603[_0xc1e3('0x2f')];}_0x4da27f[_0xc1e3('0x22')](_0x15290f)[_0xc1e3('0x30')](_0x347603);};}exports[_0xc1e3('0x31')]=function(_0x337674,_0x4f5cb8){var _0xe8666={'include':[{'model':db[_0xc1e3('0x32')],'as':_0xc1e3('0x33')}]},_0x20a813={},_0x2b6359={'count':0x0,'rows':[]};var _0x1d184c=_[_0xc1e3('0x34')](db[_0xc1e3('0x35')][_0xc1e3('0x36')],function(_0x3f65fd){return{'name':_0x3f65fd[_0xc1e3('0x37')],'type':_0x3f65fd[_0xc1e3('0x38')][_0xc1e3('0x39')]};});_0x20a813[_0xc1e3('0x3a')]=_[_0xc1e3('0x34')](_0x1d184c,'name');_0x20a813[_0xc1e3('0x3b')]=_['keys'](_0x337674[_0xc1e3('0x3b')]);_0x20a813[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x20a813['model'],_0x20a813[_0xc1e3('0x3b')]);_0xe8666[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x20a813[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0xe8666[_0xc1e3('0x3e')]=_0xe8666['attributes']['length']?_0xe8666[_0xc1e3('0x3e')]:_0x20a813[_0xc1e3('0x3a')];if(!_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0xe8666['limit']=qs[_0xc1e3('0x27')](_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0xe8666['offset']=qs[_0xc1e3('0x24')](_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0xe8666[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x43')]);_0xe8666[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x337674[_0xc1e3('0x3b')],_0x20a813[_0xc1e3('0x3c')]),_0x1d184c);if(_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x46')]){_0xe8666[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0xe8666[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x1d184c,function(_0x16cc1f){if(_0x16cc1f[_0xc1e3('0x38')]!==_0xc1e3('0x48')){var _0x249023={};_0x249023[_0x16cc1f[_0xc1e3('0x2f')]]={'$like':'%'+_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x46')]+'%'};return _0x249023;}})});}_0xe8666=_[_0xc1e3('0x47')]({},_0xe8666,_0x337674['options']);var _0x558d13={'where':_0xe8666['where']};return db['ChatWebsite'][_0xc1e3('0x26')](_0x558d13)[_0xc1e3('0x16')](function(_0x27dbc0){_0x2b6359['count']=_0x27dbc0;if(_0x337674[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0xe8666['include']=[{'all':!![]}];}return db[_0xc1e3('0x35')][_0xc1e3('0x4a')](_0xe8666);})[_0xc1e3('0x16')](function(_0x3c5a0c){_0x2b6359['rows']=_0x3c5a0c;return _0x2b6359;})[_0xc1e3('0x16')](respondWithFilteredResult(_0x4f5cb8,_0xe8666))['catch'](handleError(_0x4f5cb8,null));};exports['show']=function(_0x118d28,_0x1c4a65){var _0x1b3915={'raw':![],'where':{'id':_0x118d28['params']['id']},'include':[{'model':db[_0xc1e3('0x32')],'as':_0xc1e3('0x33')}]},_0x4c30bf={};_0x4c30bf[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db[_0xc1e3('0x35')][_0xc1e3('0x36')]);_0x4c30bf[_0xc1e3('0x3b')]=_[_0xc1e3('0x4b')](_0x118d28[_0xc1e3('0x3b')]);_0x4c30bf['filters']=_['intersection'](_0x4c30bf['model'],_0x4c30bf[_0xc1e3('0x3b')]);_0x1b3915['attributes']=_[_0xc1e3('0x3d')](_0x4c30bf[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x118d28[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0x1b3915[_0xc1e3('0x3e')]=_0x1b3915[_0xc1e3('0x3e')][_0xc1e3('0x4c')]?_0x1b3915[_0xc1e3('0x3e')]:_0x4c30bf[_0xc1e3('0x3a')];if(_0x118d28[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0x1b3915[_0xc1e3('0x4d')]=[{'all':!![]}];}_0x1b3915=_['merge']({},_0x1b3915,_0x118d28[_0xc1e3('0x4e')]);return db[_0xc1e3('0x35')][_0xc1e3('0x4f')](_0x1b3915)[_0xc1e3('0x16')](handleEntityNotFound(_0x1c4a65,null))[_0xc1e3('0x16')](respondWithResult(_0x1c4a65,null))[_0xc1e3('0x20')](handleError(_0x1c4a65,null));};exports['create']=function(_0xe108f1,_0x58fa1c){return db[_0xc1e3('0x35')][_0xc1e3('0x50')](_0xe108f1[_0xc1e3('0x51')],{})[_0xc1e3('0x16')](function(_0x3492d2){var _0x2a2882=_0xe108f1[_0xc1e3('0x52')][_0xc1e3('0x2a')]({'plain':!![]});if(!_0x2a2882)throw new Error(_0xc1e3('0x53'));if(_0x2a2882[_0xc1e3('0x54')]===_0xc1e3('0x52')){var _0x3dd0b8=_0x3492d2['get']({'plain':!![]});var _0x376e5d=_0xc1e3('0x2b');return db[_0xc1e3('0x55')][_0xc1e3('0x4f')]({'where':{'name':_0x376e5d,'userProfileId':_0x2a2882[_0xc1e3('0x56')]},'raw':!![]})['then'](function(_0x78898d){if(_0x78898d&&_0x78898d['autoAssociation']===0x0){return db[_0xc1e3('0x2c')][_0xc1e3('0x50')]({'name':_0x3dd0b8[_0xc1e3('0x2f')],'resourceId':_0x3dd0b8['id'],'type':_0x78898d['name'],'sectionId':_0x78898d['id']},{})[_0xc1e3('0x16')](function(){return _0x3492d2;});}else{return _0x3492d2;}})[_0xc1e3('0x20')](function(_0x591994){logger[_0xc1e3('0x1c')](_0xc1e3('0x57'),_0x591994);throw _0x591994;});}return _0x3492d2;})['then'](respondWithResult(_0x58fa1c,0xc9))[_0xc1e3('0x20')](handleError(_0x58fa1c,null));};exports[_0xc1e3('0x29')]=function(_0x3e964e,_0x18601b){if(_0x3e964e[_0xc1e3('0x51')]['id']){delete _0x3e964e[_0xc1e3('0x51')]['id'];}return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x3e964e['params']['id']},'include':[{'model':db[_0xc1e3('0x32')],'as':_0xc1e3('0x33')}]})[_0xc1e3('0x16')](handleEntityNotFound(_0x18601b,null))[_0xc1e3('0x16')](saveUpdates(_0x3e964e[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x18601b,null))[_0xc1e3('0x20')](handleError(_0x18601b,null));};exports[_0xc1e3('0x58')]=function(_0x46f5f0,_0x4507b2){return db[_0xc1e3('0x35')]['find']({'where':{'id':_0x46f5f0['params']['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x4507b2,null))['then'](removeEntity(_0x4507b2,null))['catch'](handleError(_0x4507b2,null));};exports['describe']=function(_0x2efa68,_0x223bb7){return db[_0xc1e3('0x35')][_0xc1e3('0x59')]()['then'](respondWithResult(_0x223bb7,null))[_0xc1e3('0x20')](handleError(_0x223bb7,null));};exports[_0xc1e3('0x5a')]=function(_0x4c0f93,_0x3c6fbe){if(_0x4c0f93[_0xc1e3('0x51')]['id']){delete _0x4c0f93[_0xc1e3('0x51')]['id'];}return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x4c0f93[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x3c6fbe,null))[_0xc1e3('0x16')](function(_0x1b936f){if(_0x1b936f){_0x4c0f93[_0xc1e3('0x51')][_0xc1e3('0x5c')]=_0x1b936f['id'];return db['Disposition'][_0xc1e3('0x50')](_0x4c0f93[_0xc1e3('0x51')]);}})[_0xc1e3('0x16')](respondWithResult(_0x3c6fbe,null))['catch'](handleError(_0x3c6fbe,null));};exports['getDispositions']=function(_0x207e4e,_0x789146){var _0x24b9bf={'raw':![],'where':{}};var _0x3a2d4d={};var _0x40c3cd={'count':0x0,'rows':[]};return db[_0xc1e3('0x35')][_0xc1e3('0x5d')]({'where':{'id':_0x207e4e[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x789146,null))[_0xc1e3('0x16')](function(_0x225a37){if(_0x225a37){_0x3a2d4d[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db['Disposition']['rawAttributes']);_0x3a2d4d['query']=_[_0xc1e3('0x4b')](_0x207e4e[_0xc1e3('0x3b')]);_0x3a2d4d[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x3a2d4d[_0xc1e3('0x3a')],_0x3a2d4d[_0xc1e3('0x3b')]);_0x24b9bf[_0xc1e3('0x3e')]=_['intersection'](_0x3a2d4d['model'],qs[_0xc1e3('0x3f')](_0x207e4e[_0xc1e3('0x3b')]['fields']));_0x24b9bf[_0xc1e3('0x3e')]=_0x24b9bf[_0xc1e3('0x3e')]['length']?_0x24b9bf[_0xc1e3('0x3e')]:_0x3a2d4d[_0xc1e3('0x3a')];if(!_0x207e4e['query'][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0x24b9bf['limit']=qs[_0xc1e3('0x27')](_0x207e4e[_0xc1e3('0x3b')]['limit']);_0x24b9bf[_0xc1e3('0x24')]=qs['offset'](_0x207e4e[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0x24b9bf[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x207e4e[_0xc1e3('0x3b')]['sort']);_0x24b9bf['where']=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x207e4e[_0xc1e3('0x3b')],_0x3a2d4d[_0xc1e3('0x3c')]));_0x24b9bf[_0xc1e3('0x44')][_0xc1e3('0x5c')]=_0x225a37['id'];if(_0x207e4e[_0xc1e3('0x3b')][_0xc1e3('0x46')]){_0x24b9bf['where']=_[_0xc1e3('0x47')](_0x24b9bf[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x24b9bf['attributes'],function(_0x636b6b){var _0x56055b={};_0x56055b[_0x636b6b]={'$like':'%'+_0x207e4e[_0xc1e3('0x3b')][_0xc1e3('0x46')]+'%'};return _0x56055b;})});}_0x24b9bf=_[_0xc1e3('0x47')]({},_0x24b9bf,_0x207e4e[_0xc1e3('0x4e')]);return db[_0xc1e3('0x5e')][_0xc1e3('0x26')]({'where':_0x24b9bf[_0xc1e3('0x44')]})[_0xc1e3('0x16')](function(_0xf44f45){_0x40c3cd[_0xc1e3('0x26')]=_0xf44f45;if(_0x207e4e[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0x24b9bf[_0xc1e3('0x4d')]=[{'all':!![]}];}return db[_0xc1e3('0x5e')]['findAll'](_0x24b9bf);})[_0xc1e3('0x16')](function(_0x770ee6){_0x40c3cd[_0xc1e3('0x5f')]=_0x770ee6;return _0x40c3cd;});}})['then'](respondWithFilteredResult(_0x789146,_0x24b9bf))['catch'](handleError(_0x789146,null));};exports[_0xc1e3('0x60')]=function(_0x2ca93d,_0x27dd8f){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x2ca93d[_0xc1e3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x27dd8f,null))[_0xc1e3('0x16')](function(_0x43c9ec){if(_0x43c9ec){return _0x43c9ec[_0xc1e3('0x60')](_0x2ca93d[_0xc1e3('0x3b')][_0xc1e3('0x61')]);}})[_0xc1e3('0x16')](respondWithStatusCode(_0x27dd8f,null))[_0xc1e3('0x20')](handleError(_0x27dd8f,null));};exports[_0xc1e3('0x62')]=function(_0x17697d,_0x467502){if(_0x17697d[_0xc1e3('0x51')]['id']){delete _0x17697d['body']['id'];}return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x17697d[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x467502,null))[_0xc1e3('0x16')](function(_0x187841){if(_0x187841){_0x17697d[_0xc1e3('0x51')]['ChatWebsiteId']=_0x187841['id'];return db[_0xc1e3('0x63')][_0xc1e3('0x50')](_0x17697d[_0xc1e3('0x51')]);}})[_0xc1e3('0x16')](respondWithResult(_0x467502,null))[_0xc1e3('0x20')](handleError(_0x467502,null));};exports[_0xc1e3('0x64')]=function(_0xf2225d,_0x44dc46){var _0x356b25={'raw':![],'where':{}};var _0x270752={};var _0x5618f1={'count':0x0,'rows':[]};return db[_0xc1e3('0x35')][_0xc1e3('0x5d')]({'where':{'id':_0xf2225d[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x44dc46,null))[_0xc1e3('0x16')](function(_0x46399b){if(_0x46399b){_0x270752[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db[_0xc1e3('0x63')][_0xc1e3('0x36')]);_0x270752['query']=_[_0xc1e3('0x4b')](_0xf2225d['query']);_0x270752[_0xc1e3('0x3c')]=_['intersection'](_0x270752[_0xc1e3('0x3a')],_0x270752[_0xc1e3('0x3b')]);_0x356b25[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x270752[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0xf2225d[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0x356b25[_0xc1e3('0x3e')]=_0x356b25[_0xc1e3('0x3e')][_0xc1e3('0x4c')]?_0x356b25[_0xc1e3('0x3e')]:_0x270752['model'];if(!_0xf2225d[_0xc1e3('0x3b')]['hasOwnProperty'](_0xc1e3('0x41'))){_0x356b25[_0xc1e3('0x27')]=qs[_0xc1e3('0x27')](_0xf2225d[_0xc1e3('0x3b')]['limit']);_0x356b25['offset']=qs[_0xc1e3('0x24')](_0xf2225d[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0x356b25[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0xf2225d[_0xc1e3('0x3b')][_0xc1e3('0x43')]);_0x356b25[_0xc1e3('0x44')]=qs['filters'](_[_0xc1e3('0x45')](_0xf2225d[_0xc1e3('0x3b')],_0x270752[_0xc1e3('0x3c')]));_0x356b25[_0xc1e3('0x44')][_0xc1e3('0x5c')]=_0x46399b['id'];if(_0xf2225d[_0xc1e3('0x3b')]['filter']){_0x356b25[_0xc1e3('0x44')]=_['merge'](_0x356b25['where'],{'$or':_['map'](_0x356b25['attributes'],function(_0x2b714f){var _0x4d321d={};_0x4d321d[_0x2b714f]={'$like':'%'+_0xf2225d['query']['filter']+'%'};return _0x4d321d;})});}_0x356b25=_[_0xc1e3('0x47')]({},_0x356b25,_0xf2225d[_0xc1e3('0x4e')]);return db[_0xc1e3('0x63')][_0xc1e3('0x26')]({'where':_0x356b25[_0xc1e3('0x44')]})['then'](function(_0x35113f){_0x5618f1[_0xc1e3('0x26')]=_0x35113f;if(_0xf2225d['query'][_0xc1e3('0x49')]){_0x356b25['include']=[{'all':!![]}];}return db[_0xc1e3('0x63')][_0xc1e3('0x4a')](_0x356b25);})[_0xc1e3('0x16')](function(_0x188a1e){_0x5618f1[_0xc1e3('0x5f')]=_0x188a1e;return _0x5618f1;});}})[_0xc1e3('0x16')](respondWithFilteredResult(_0x44dc46,_0x356b25))[_0xc1e3('0x20')](handleError(_0x44dc46,null));};exports[_0xc1e3('0x65')]=function(_0x1fc52b,_0x47da25){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x1fc52b[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x47da25,null))['then'](function(_0x2cecd4){if(_0x2cecd4){return _0x2cecd4['removeAnswers'](_0x1fc52b[_0xc1e3('0x3b')]['ids']);}})[_0xc1e3('0x16')](respondWithStatusCode(_0x47da25,null))[_0xc1e3('0x20')](handleError(_0x47da25,null));};exports[_0xc1e3('0x66')]=function(_0x3b682f,_0x30ea8b){_0x3b682f[_0xc1e3('0x51')][_0xc1e3('0x67')]=_0x3b682f[_0xc1e3('0x68')][_0xc1e3('0x69')];return db[_0xc1e3('0x35')]['find']({'where':{'id':_0x3b682f['params']['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x30ea8b,null))[_0xc1e3('0x16')](saveUpdates(_0x3b682f[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x30ea8b,null))[_0xc1e3('0x20')](handleError(_0x30ea8b,null));};exports[_0xc1e3('0x6a')]=function(_0x27e93c,_0x4e584e){_0x27e93c[_0xc1e3('0x51')][_0xc1e3('0x6b')]=_0x27e93c[_0xc1e3('0x68')][_0xc1e3('0x69')];return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x27e93c[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x4e584e,null))['then'](saveUpdates(_0x27e93c[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x4e584e,null))['catch'](handleError(_0x4e584e,null));};exports['addCustomerAvatar']=function(_0x2dfb6d,_0x5ef432){_0x2dfb6d[_0xc1e3('0x51')][_0xc1e3('0x6c')]=_0x2dfb6d['file'][_0xc1e3('0x69')];return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x2dfb6d[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x5ef432,null))[_0xc1e3('0x16')](saveUpdates(_0x2dfb6d[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x5ef432,null))[_0xc1e3('0x20')](handleError(_0x5ef432,null));};exports[_0xc1e3('0x6d')]=function(_0x460659,_0x329419){_0x460659['body'][_0xc1e3('0x6e')]=_0x460659['file'][_0xc1e3('0x69')];return db['ChatWebsite'][_0xc1e3('0x4f')]({'where':{'id':_0x460659[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x329419,null))[_0xc1e3('0x16')](saveUpdates(_0x460659[_0xc1e3('0x51')],null))[_0xc1e3('0x16')](respondWithResult(_0x329419,null))['catch'](handleError(_0x329419,null));};exports['getLogo']=function(_0x1b6499,_0x507605){var _0x6c839=path[_0xc1e3('0x6f')](config['root'],_0xc1e3('0x70'));var _0xcdddc2={'where':{'id':_0x1b6499[_0xc1e3('0x5b')]['id']},'attributes':['id',_0xc1e3('0x67')],'raw':!![]};var _0x531c1d=![];return require(_0xc1e3('0x71'))[_0xc1e3('0x72')]()['then'](function(_0x3ad8d1){if(_0x3ad8d1){_0x531c1d=_0x3ad8d1[_0xc1e3('0x73')];}})[_0xc1e3('0x16')](function(){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')](_0xcdddc2);})[_0xc1e3('0x16')](handleEntityNotFound(_0x507605,null))[_0xc1e3('0x16')](function(_0x5c7e0a){if(_0x5c7e0a){if(!_[_0xc1e3('0x74')](_0x5c7e0a[_0xc1e3('0x67')])){if(fs[_0xc1e3('0x75')](path[_0xc1e3('0x6f')](config['root'],'server/files/images/logos/',_0x5c7e0a[_0xc1e3('0x67')]))&&_0x531c1d){_0x6c839=path[_0xc1e3('0x6f')](config['root'],'server/files/images/logos/',_0x5c7e0a[_0xc1e3('0x67')]);}}return _0x507605[_0xc1e3('0x76')](_0x6c839);}})[_0xc1e3('0x20')](handleError(_0x507605,null));};exports[_0xc1e3('0x77')]=function(_0x5b1139,_0x3dd27a){var _0x5b254a=path[_0xc1e3('0x6f')](config['root'],_0xc1e3('0x78'));var _0x47832b={'where':{'id':_0x5b1139[_0xc1e3('0x5b')]['id']},'attributes':['id',_0xc1e3('0x6b')],'raw':!![]};return db['ChatWebsite'][_0xc1e3('0x4f')](_0x47832b)[_0xc1e3('0x16')](handleEntityNotFound(_0x3dd27a,null))[_0xc1e3('0x16')](function(_0x3259b1){if(_0x3259b1){if(!_[_0xc1e3('0x74')](_0x3259b1[_0xc1e3('0x6b')])){if(fs[_0xc1e3('0x75')](path['join'](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x3259b1[_0xc1e3('0x6b')]))){_0x5b254a=path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x3259b1[_0xc1e3('0x6b')]);}}return _0x3dd27a[_0xc1e3('0x76')](_0x5b254a);}})['catch'](handleError(_0x3dd27a,null));};exports['getCustomerAvatar']=function(_0x11bdda,_0x103b98){var _0x4bcac2=path[_0xc1e3('0x6f')](config['root'],_0xc1e3('0x7b'));var _0x1663bd={'where':{'id':_0x11bdda[_0xc1e3('0x5b')]['id']},'attributes':['id',_0xc1e3('0x6c'),'showCustomerAvatar'],'raw':!![]};return db[_0xc1e3('0x35')][_0xc1e3('0x4f')](_0x1663bd)[_0xc1e3('0x16')](handleEntityNotFound(_0x103b98,null))[_0xc1e3('0x16')](function(_0x31d96f){if(_0x31d96f){if(!_[_0xc1e3('0x74')](_0x31d96f[_0xc1e3('0x6c')])){if(fs[_0xc1e3('0x75')](path['join'](config[_0xc1e3('0x79')],'server/files/images/avatars/',_0x31d96f[_0xc1e3('0x6c')]))&&_0x31d96f['showCustomerAvatar']){_0x4bcac2=path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x31d96f[_0xc1e3('0x6c')]);}}return _0x103b98[_0xc1e3('0x76')](_0x4bcac2);}})[_0xc1e3('0x20')](handleError(_0x103b98,null));};exports[_0xc1e3('0x7c')]=function(_0x215b93,_0x209b7c){var _0x591cf0=path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0x7d'));var _0x9e3b6d={'where':{'id':_0x215b93[_0xc1e3('0x5b')]['id']},'attributes':['id',_0xc1e3('0x6e')],'raw':!![]};return db[_0xc1e3('0x35')][_0xc1e3('0x4f')](_0x9e3b6d)[_0xc1e3('0x16')](handleEntityNotFound(_0x209b7c,null))[_0xc1e3('0x16')](function(_0x3d8aa8){if(_0x3d8aa8){if(!_[_0xc1e3('0x74')](_0x3d8aa8['systemAvatar'])){if(fs[_0xc1e3('0x75')](path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x3d8aa8['systemAvatar']))){_0x591cf0=path['join'](config[_0xc1e3('0x79')],_0xc1e3('0x7a'),_0x3d8aa8[_0xc1e3('0x6e')]);}}return _0x209b7c['download'](_0x591cf0);}})['catch'](handleError(_0x209b7c,null));};exports[_0xc1e3('0x7e')]=function(_0x279c8f,_0x582f63){var _0x18137b=require('user-agent-parser');var _0xd53e46=new _0x18137b();var _0x465019=_0xd53e46[_0xc1e3('0x7f')](_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0x81')])[_0xc1e3('0x82')]();var _0x3ed6d7={'body':_0x279c8f['body'],'channel':_0xc1e3('0x83')};var _0xcf23bc=[];var _0x3514a5=[];var _0xebc1c2={};var _0x146d28=![];return db['CmContact'][_0xc1e3('0x59')]()[_0xc1e3('0x16')](function(_0x47392f){if(!_0x47392f){throw new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))](_0xc1e3('0x86'));}_0xcf23bc=_[_0xc1e3('0x87')](_[_0xc1e3('0x4b')](_0x47392f),[_0xc1e3('0x88'),_0xc1e3('0x89')]);_0x3514a5=_[_0xc1e3('0x87')](_[_0xc1e3('0x4b')](_0x47392f),[_0xc1e3('0x88'),'updatedAt',_0xc1e3('0x8a'),'ListId']);if(_0x279c8f[_0xc1e3('0x51')]['id']){delete _0x279c8f[_0xc1e3('0x51')]['id'];}if(_[_0xc1e3('0x74')](_0x279c8f[_0xc1e3('0x51')]['from'])){throw new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))](_0xc1e3('0x8b'));}if(_['isNil'](_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x51')])||_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x51')]===''){throw new db[(_0xc1e3('0x84'))]['ValidationError'](_0xc1e3('0x8c'));}if(_[_0xc1e3('0x74')](_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x8d')])){throw new db['Sequelize'][(_0xc1e3('0x85'))](_0xc1e3('0x8e')+_0x3514a5);}if(!_[_0xc1e3('0x8f')](_0x3514a5,_0x279c8f[_0xc1e3('0x51')]['mapKey'])){throw new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3514a5);}_0xebc1c2[_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x8d')]]=_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x90')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x279c8f[_0xc1e3('0x5b')]['id']},'include':[{'model':db[_0xc1e3('0x91')],'as':_0xc1e3('0x92'),'include':[{'model':db[_0xc1e3('0x93')],'as':_0xc1e3('0x94'),'where':_0xebc1c2,'limit':0x1,'order':[[_0xc1e3('0x89'),_0xc1e3('0x95')]]}]},{'model':db[_0xc1e3('0x96')],'as':'Applications'}]});})[_0xc1e3('0x16')](handleEntityNotFound(_0x582f63,null))[_0xc1e3('0x16')](function(_0x1f08df){if(_0x1f08df&&_0x1f08df[_0xc1e3('0x92')]){_0x3ed6d7[_0xc1e3('0x97')]=_0x1f08df;_0x3ed6d7[_0xc1e3('0x98')]=_0x1f08df['Applications'];_0x3ed6d7[_0xc1e3('0x99')]=_0x1f08df[_0xc1e3('0x92')];_0x3ed6d7[_0xc1e3('0x98')]=_[_0xc1e3('0x9a')](_0x3ed6d7['applications'],[_0xc1e3('0x9b')],[_0xc1e3('0x9c')]);if(_0x3ed6d7[_0xc1e3('0x97')][_0xc1e3('0x9d')]){delete _0x3ed6d7[_0xc1e3('0x97')]['Applications'];}if(_0x3ed6d7[_0xc1e3('0x97')][_0xc1e3('0x92')]&&_0x3ed6d7[_0xc1e3('0x97')][_0xc1e3('0x92')][_0xc1e3('0x94')]['length']){return _0x3ed6d7['account']['List'][_0xc1e3('0x94')][0x0];}var _0x3ef7c1=_[_0xc1e3('0xe')](_0x279c8f[_0xc1e3('0x51')],{'firstName':_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x90')],'ListId':_0x1f08df['ListId']});_0x3ef7c1[_0x279c8f['body']['mapKey']]=_0x279c8f[_0xc1e3('0x51')]['from'];return db[_0xc1e3('0x93')][_0xc1e3('0x50')](_0x3ef7c1,{'fields':_0xcf23bc,'raw':!![]});}})[_0xc1e3('0x16')](handleEntityNotFound(_0x582f63,null))[_0xc1e3('0x16')](function(_0x23b31b){_0x3ed6d7[_0xc1e3('0x9e')]=_0x23b31b;var _0x490758=_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0x9f')];if(_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0xa0')]){_0x490758=_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0xa0')];}else if(_0x279c8f['headers'][_0xc1e3('0xa1')]){_0x490758=_['first'](_0x279c8f['headers']['x-forwarded-for'][_0xc1e3('0xa2')](','));}if(_0x23b31b){var _0x1865a3={'ContactId':_0x23b31b['id'],'ChatWebsiteId':_0x279c8f[_0xc1e3('0x5b')]['id'],'from':(_0x23b31b[_0xc1e3('0xa3')]||'')+'\x20'+(_0x23b31b[_0xc1e3('0xa4')]||''),'customerIp':_0x490758,'customerPort':_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0xa5')]?_0x279c8f[_0xc1e3('0x80')][_0xc1e3('0xa5')]:null,'referer':_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xa6')],'browserName':_0x465019[_0xc1e3('0xa7')][_0xc1e3('0x2f')]&&_0x465019[_0xc1e3('0xa7')]['version']?util[_0xc1e3('0xa8')](_0xc1e3('0xa9'),_0x465019[_0xc1e3('0xa7')][_0xc1e3('0x2f')],_0x465019['browser'][_0xc1e3('0xaa')]):_0xc1e3('0xab'),'browserVersion':_0x465019['browser'][_0xc1e3('0xaa')]||_0xc1e3('0xab'),'osName':util['format'](_0xc1e3('0xa9'),_0x465019['os'][_0xc1e3('0x2f')],_0x465019['os']['version']),'osVersion':_0x465019['os'][_0xc1e3('0xaa')],'deviceModel':_0x465019[_0xc1e3('0xac')][_0xc1e3('0x3a')]&&_0x465019[_0xc1e3('0xac')]['vendor']?util[_0xc1e3('0xa8')](_0xc1e3('0xad'),_0x465019[_0xc1e3('0xac')][_0xc1e3('0x3a')],_0x465019['device'][_0xc1e3('0xae')],_0x465019['device'][_0xc1e3('0x38')]):null,'deviceVendor':_0x465019[_0xc1e3('0xac')]['vendor'],'deviceType':_0x465019['device'][_0xc1e3('0x38')],'formData':JSON[_0xc1e3('0xaf')](_0x279c8f[_0xc1e3('0x51')])};var _0x3b9052={'ChatWebsiteId':_0x279c8f[_0xc1e3('0x5b')]['id'],'closed':![]};if(_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb0')]){_0x3b9052[_0xc1e3('0xb0')]=_0x279c8f['body']['threadId'];return db[_0xc1e3('0xb1')][_0xc1e3('0x4f')]({'where':_0x3b9052})[_0xc1e3('0x16')](function(_0x2103ea){if(_0x2103ea){return[_0x2103ea,![]];}_0x1865a3['threadId']=_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb0')];_0x1865a3[_0xc1e3('0xb2')]=_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb2')];return db['ChatInteraction'][_0xc1e3('0x50')](_0x1865a3)['then'](function(_0x4e430a){return[_0x4e430a,!![]];});});}_0x3b9052[_0xc1e3('0xb3')]=_0x23b31b['id'];if(_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb4')]&&_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb4')]['id']){_0x3b9052['id']=_0x279c8f['body'][_0xc1e3('0xb4')]['id'];return db[_0xc1e3('0xb1')][_0xc1e3('0x4f')]({'where':_0x3b9052})[_0xc1e3('0x16')](function(_0x369482){if(_0x369482){return[_0x369482,![]];}return db[_0xc1e3('0xb1')][_0xc1e3('0x50')](_0x1865a3)[_0xc1e3('0x16')](function(_0x4ae784){return[_0x4ae784,!![]];});});}return db[_0xc1e3('0xb1')][_0xc1e3('0x50')](_0x1865a3)[_0xc1e3('0x16')](function(_0x73e9c9){return[_0x73e9c9,!![]];});}})[_0xc1e3('0xb5')](function(_0x583aec,_0x2a822c){if(_0x583aec){_0x146d28=_0x2a822c;if(!_0x2a822c){var _0x289bef={'from':(_0x3ed6d7['contact'][_0xc1e3('0xa3')]||'')+'\x20'+(_0x3ed6d7[_0xc1e3('0x9e')][_0xc1e3('0xa4')]||'')};if(_0x279c8f['body'][_0xc1e3('0xb0')]&&_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb6')]&&_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xb0')]!=_0x279c8f['body'][_0xc1e3('0xb6')]){_0x289bef[_0xc1e3('0xb0')]=_0x279c8f['body'][_0xc1e3('0xb6')];}return _0x583aec[_0xc1e3('0x29')](_0x289bef);}else{return _0x583aec;}}})['then'](function(_0x540bf9){_0x3ed6d7[_0xc1e3('0xb4')]=_0x540bf9[_0xc1e3('0x2a')]({'plain':!![]});_0x3ed6d7[_0xc1e3('0xb4')][_0xc1e3('0xb7')]=_0x146d28;if(_0x3ed6d7[_0xc1e3('0xb4')][_0xc1e3('0xb7')]){if(_0x3ed6d7[_0xc1e3('0x97')][_0xc1e3('0xb8')]){_0x3ed6d7[_0xc1e3('0x98')]['push']({'id':0x0,'priority':_0x3ed6d7[_0xc1e3('0x98')][_0xc1e3('0x4c')]+0x1,'app':_0xc1e3('0xb9'),'appdata':_0xc1e3('0xba'),'interval':_0xc1e3('0xbb')});}}return db[_0xc1e3('0xbc')]['create']({'body':_0x279c8f['body'][_0xc1e3('0x51')],'ChatWebsiteId':_0x279c8f['params']['id'],'ChatInteractionId':_0x540bf9['id'],'direction':'in','ContactId':_0x3ed6d7[_0xc1e3('0x9e')]['id'],'AttachmentId':_0x279c8f[_0xc1e3('0x51')][_0xc1e3('0xbd')]});})[_0xc1e3('0x16')](function(_0x16eec5){_0x3ed6d7[_0xc1e3('0x1e')]=_0x16eec5;if(_0x3ed6d7[_0xc1e3('0xb4')][_0xc1e3('0xbe')]){return db[_0xc1e3('0xbf')][_0xc1e3('0x4f')]({'attributes':['id',_0xc1e3('0x2f')],'where':{'id':_0x3ed6d7['interaction'][_0xc1e3('0xbe')]}})[_0xc1e3('0x16')](function(_0x4adff5){if(_0x4adff5){_0x3ed6d7['applications'][_0xc1e3('0xc0')]({'id':0x0,'priority':0x0,'app':_0xc1e3('0xc1'),'appdata':_0x4adff5[_0xc1e3('0x2f')]+','+(_0x3ed6d7['account'][_0xc1e3('0xc2')]||0xa),'interval':_0xc1e3('0xbb')});_0x3ed6d7['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xc1e3('0xc3'),_0x3ed6d7);});}return respondWithRpcPromise(_0xc1e3('0xc4'),_0xc1e3('0xc3'),_0x3ed6d7);})[_0xc1e3('0x16')](function(_0x1e60c9){respondWithRpcPromise('EventManager','EventManager',{'event':'notify','message':_0x1e60c9},client9002);return _0x1e60c9;})[_0xc1e3('0x16')](respondWithResult(_0x582f63,null))[_0xc1e3('0x20')](handleError(_0x582f63,null));};exports[_0xc1e3('0xc5')]=function(_0x5c3b78,_0x436d90){var _0x27eb37,_0x1dd4d2,_0x2d42be;var _0x183985=[];var _0x142295={};var _0x5f2d57=_0x5c3b78['files']||[];var _0x1f0133=[];var _0x2a2c44;return db['CmContact'][_0xc1e3('0x59')]()[_0xc1e3('0x16')](function(_0x5cdae5){if(!_0x5cdae5){throw new db[(_0xc1e3('0x84'))]['ValidationError']('no\x20available\x20attributes');}_0x183985=_[_0xc1e3('0x87')](_[_0xc1e3('0x4b')](_0x5cdae5),[_0xc1e3('0x88'),'updatedAt',_0xc1e3('0x8a'),_0xc1e3('0xc6')]);if(_0x5c3b78[_0xc1e3('0x51')]['id']){delete _0x5c3b78[_0xc1e3('0x51')]['id'];}if(_[_0xc1e3('0x74')](_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x90')])){throw _0x436d90[_0xc1e3('0x22')](0x1f4)[_0xc1e3('0x30')](new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))](_0xc1e3('0x8b')));}if(_[_0xc1e3('0x74')](_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x51')])||_0x5c3b78['body'][_0xc1e3('0x51')]===''){throw _0x436d90[_0xc1e3('0x22')](0x1f4)['send'](new db[(_0xc1e3('0x84'))][(_0xc1e3('0x85'))](_0xc1e3('0x8c')));}if(_[_0xc1e3('0x74')](_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0xc7')])){throw _0x436d90[_0xc1e3('0x22')](0x1f4)[_0xc1e3('0x30')](new db[(_0xc1e3('0x84'))]['ValidationError'](_0xc1e3('0xc8')+_0x183985));}if(!_[_0xc1e3('0x8f')](_0x183985,_0x5c3b78['body'][_0xc1e3('0xc7')])){throw _0x436d90[_0xc1e3('0x22')](0x1f4)[_0xc1e3('0x30')](new db['Sequelize'][(_0xc1e3('0x85'))](_0xc1e3('0xc9')+_0x183985));}_0x142295[_0x5c3b78['body'][_0xc1e3('0xc7')]]=_0x5c3b78[_0xc1e3('0x51')]['from'];})['then'](function(){return db[_0xc1e3('0x35')]['find']({'where':{'id':_0x5c3b78['params']['id']},'include':[{'model':db[_0xc1e3('0x91')],'as':_0xc1e3('0x92')},{'model':db[_0xc1e3('0xca')],'as':'MailAccount'}]});})[_0xc1e3('0x16')](handleEntityNotFound(_0x436d90,null))[_0xc1e3('0x16')](function(_0x3f73cd){if(_0x3f73cd&&_0x3f73cd[_0xc1e3('0x92')]){_0x1dd4d2=_0x3f73cd;var _0x3a26e0=_[_0xc1e3('0xe')](_0x5c3b78[_0xc1e3('0x51')],{'firstName':_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x90')],'phone':_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x90')],'ListId':_0x3f73cd['ListId']});_0x3a26e0[_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0xc7')]]=_0x5c3b78[_0xc1e3('0x51')][_0xc1e3('0x90')];return db['CmContact']['findOrCreate']({'where':_0x142295,'defaults':_0x3a26e0});}})[_0xc1e3('0xb5')](function(_0x503ffd){if(_0x503ffd){_0x2d42be=_0x503ffd;var _0x39a811=fs['readFileSync'](path['join'](config['root'],_0xc1e3('0xcb')),_0xc1e3('0xcc'));var _0x2f2198=ejs[_0xc1e3('0xcd')](_0x39a811,{'body':_[_0xc1e3('0xce')](_0x5c3b78[_0xc1e3('0x51')]['body']),'bodyTitle':_0x1dd4d2[_0xc1e3('0xcf')]});return db[_0xc1e3('0xd0')][_0xc1e3('0x50')]({'body':_0x2f2198,'plainBody':htmlToText[_0xc1e3('0xd1')](_0x2f2198),'ContactId':_0x503ffd['id'],'ChatWebsiteId':_0x1dd4d2['id']});}})[_0xc1e3('0x16')](function(_0x21be62){_0x2a2c44=_0x21be62;if(_0x5f2d57[_0xc1e3('0x4c')]){var _0x57559f=_0x5f2d57['map'](function(_0x35a585){return{'name':_0x35a585[_0xc1e3('0xd2')],'basename':_0x35a585[_0xc1e3('0x69')],'type':_0x35a585[_0xc1e3('0xd3')],'ChatOfflineMessageId':_0x21be62['id']};});_0x1f0133=_0x57559f[_0xc1e3('0x34')](_0x28bc1d=>{var _0x20ec81={'filename':_0x28bc1d['name'],'path':path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],_0xc1e3('0xd4'),_0xc1e3('0xd5'),_0xc1e3('0xd6'),'offline-chat',_0x28bc1d['basename'])};return _0x20ec81;});if(!_0x1dd4d2[_0xc1e3('0xd7')]){return db[_0xc1e3('0xd8')][_0xc1e3('0xd9')](function(_0x53c048){return db['Attachment']['bulkCreate'](_0x57559f,{'transaction':_0x53c048});});}}})['then'](function(){if(_0x2a2c44){_0x27eb37=_0x2a2c44;return db[_0xc1e3('0xca')][_0xc1e3('0x5d')]({'where':{'service':!![]},'include':[{'model':db[_0xc1e3('0xda')],'as':_0xc1e3('0xdb'),'raw':!![],'include':[{'model':db[_0xc1e3('0xdc')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x1adcf3){if(_0x1adcf3&&_0x1adcf3[_0xc1e3('0xdb')]&&_0x1dd4d2['forwardOffline']&&_0x1dd4d2[_0xc1e3('0xdd')]){var _0x300ace=_0x1adcf3[_0xc1e3('0xde')]();return respondWithRpcPromise(_0xc1e3('0xdf'),_0xc1e3('0xe0'),{'account':_0x300ace,'message':{'from':util[_0xc1e3('0xa8')](_0xc1e3('0xe1'),_0x1adcf3[_0xc1e3('0x2f')],_0x1adcf3['email']||_0x1adcf3[_0xc1e3('0xdb')][_0xc1e3('0x52')]),'to':_0x1dd4d2[_0xc1e3('0xdd')],'subject':_0x1dd4d2[_0xc1e3('0xe2')],'html':_0x27eb37[_0xc1e3('0x51')],'attachments':_0x1f0133}},client9003)[_0xc1e3('0x16')](function(){return _0x27eb37;})['catch'](function(_0x291a41){logger['error'](_0x291a41);});}})[_0xc1e3('0x16')](function(){if(_0x1dd4d2&&_0x1dd4d2[_0xc1e3('0xd7')]&&_0x1dd4d2[_0xc1e3('0xe3')]){var _0x28ce88=[];if(_0x5f2d57[_0xc1e3('0x4c')]){_0x28ce88=_0x5f2d57[_0xc1e3('0x34')](function(_0xb57935){return{'name':_0xb57935[_0xc1e3('0xd2')],'basename':_0xb57935[_0xc1e3('0x69')],'type':_0xb57935[_0xc1e3('0xd3')],'ChatOfflineMessageId':_0x2a2c44['id']};});}var _0x18f3c0;if(!_[_0xc1e3('0x74')](_0x1dd4d2['subjectOffline'])){var _0x584391=_['map'](_0x5c3b78['body'],function(_0x5be3c3){return _0x5be3c3;});var _0x2bbf5f=_[_0xc1e3('0xe4')](_0x584391)[0x0];var _0x534657=_['mapValues'](_0x2bbf5f,function(_0x1626a6){return _0x1626a6;});_0x18f3c0=_0x534657[0x1][_0x1dd4d2[_0xc1e3('0xe5')]];}var _0xffc35d={'from':_0x2d42be[_0xc1e3('0xe6')],'firstName':_0x2d42be[_0xc1e3('0xa3')],'lastName':_0x2d42be[_0xc1e3('0xa4')],'mapKey':_0xc1e3('0xe6'),'message':{'from':_0x2d42be[_0xc1e3('0xe6')],'to':_0x1dd4d2[_0xc1e3('0xca')][_0xc1e3('0xe6')],'cc':'','subject':_['isNil'](_0x18f3c0)?_0x1dd4d2[_0xc1e3('0xe2')]:_0x18f3c0,'messageId':'','sentAt':new Date(),'attach':_0x28ce88[_0xc1e3('0x4c')],'attachments':_0x28ce88,'originChannel':'Chat','ChatWebsiteId':_0x1dd4d2['id'],'ChatOfflineMessageId':_0x27eb37['id'],'originTo':_0x1dd4d2[_0xc1e3('0xca')]['email']},'body':_0x27eb37['body']};var _0x49bcb9={'account':{'id':_0x1dd4d2[_0xc1e3('0xe3')]},'body':_0xffc35d,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xc1e3('0xe7'),_0xc1e3('0xe8'),_0x49bcb9,client9001)[_0xc1e3('0x16')](function(){return _0x27eb37;})[_0xc1e3('0x20')](function(_0x11c6f8){logger[_0xc1e3('0x1c')](_0x11c6f8);});}return;})[_0xc1e3('0x16')](function(){if(_0x27eb37){return _0x27eb37;}})[_0xc1e3('0x16')](respondWithResult(_0x436d90,null))[_0xc1e3('0x20')](function(_0x2a50e8){logger[_0xc1e3('0x1c')](_0xc1e3('0x20'),_0x2a50e8);for(var _0x2827a7 of _0x5f2d57){var _0x378c4d=path[_0xc1e3('0x6f')](config[_0xc1e3('0x79')],'server','files','attachments','offline-chat',_0x2827a7['filename']);fs_extra[_0xc1e3('0xe9')](_0x378c4d)[_0xc1e3('0x20')](function(_0x3f5049){logger[_0xc1e3('0x1c')](_0xc1e3('0xea'),_0x378c4d,_0x3f5049);});}});};exports[_0xc1e3('0xeb')]=function(_0x4e131b,_0x54aacc){return db[_0xc1e3('0xb1')][_0xc1e3('0x4f')]({'where':{'id':_0x4e131b[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x54aacc,null))[_0xc1e3('0x16')](function(_0x49e63f){if(_0x49e63f){return _0x49e63f[_0xc1e3('0xeb')](_0x4e131b[_0xc1e3('0x51')]['ids'],_[_0xc1e3('0xec')](_0x4e131b['body'],[_0xc1e3('0x61'),'id'])||{});}})['then'](respondWithResult(_0x54aacc,null))[_0xc1e3('0x20')](handleError(_0x54aacc,null));};exports[_0xc1e3('0xed')]=function(_0x176428,_0x3fc972){var _0xbb746f={'raw':![],'where':{}};var _0x6acd2d={};var _0x20ac35={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x176428[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x3fc972,null))[_0xc1e3('0x16')](function(_0x51a07a){if(_0x51a07a){_0x6acd2d[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db['ChatInteraction']['rawAttributes']);_0x6acd2d[_0xc1e3('0x3b')]=_[_0xc1e3('0x4b')](_0x176428[_0xc1e3('0x3b')]);_0x6acd2d['filters']=_[_0xc1e3('0x3d')](_0x6acd2d[_0xc1e3('0x3a')],_0x6acd2d[_0xc1e3('0x3b')]);_0xbb746f[_0xc1e3('0x3e')]=_['intersection'](_0x6acd2d['model'],qs['fields'](_0x176428['query']['fields']));_0xbb746f[_0xc1e3('0x3e')]=_0xbb746f[_0xc1e3('0x3e')]['length']?_0xbb746f[_0xc1e3('0x3e')]:_0x6acd2d['model'];if(!_0x176428[_0xc1e3('0x3b')]['hasOwnProperty']('nolimit')){_0xbb746f[_0xc1e3('0x27')]=qs[_0xc1e3('0x27')](_0x176428[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0xbb746f[_0xc1e3('0x24')]=qs[_0xc1e3('0x24')](_0x176428[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0xbb746f[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x176428['query'][_0xc1e3('0x43')]);_0xbb746f[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_['pick'](_0x176428[_0xc1e3('0x3b')],_0x6acd2d[_0xc1e3('0x3c')]));_0xbb746f[_0xc1e3('0x44')][_0xc1e3('0x5c')]=_0x51a07a['id'];if(_0x176428['query']['filter']){_0xbb746f[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0xbb746f[_0xc1e3('0x44')],{'$or':_['map'](_0xbb746f['attributes'],function(_0x4ba5fb){var _0x352e43={};_0x352e43[_0x4ba5fb]={'$like':'%'+_0x176428['query'][_0xc1e3('0x46')]+'%'};return _0x352e43;})});}_0xbb746f=_[_0xc1e3('0x47')]({},_0xbb746f,_0x176428['options']);return db[_0xc1e3('0xb1')]['count']({'where':_0xbb746f[_0xc1e3('0x44')]})['then'](function(_0x53ddc0){_0x20ac35[_0xc1e3('0x26')]=_0x53ddc0;if(_0x176428[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0xbb746f[_0xc1e3('0x4d')]=[{'model':db['CmContact'],'as':_0xc1e3('0xee'),'required':![]},{'model':db[_0xc1e3('0xbf')],'as':'Owner','attributes':[_0xc1e3('0x2f'),_0xc1e3('0xef'),'internal'],'required':![]},{'model':db[_0xc1e3('0xf0')],'as':_0xc1e3('0xf1'),'attributes':['id',_0xc1e3('0x2f'),_0xc1e3('0xf2')],'where':_0x176428[_0xc1e3('0x3b')][_0xc1e3('0xf3')]?{'id':_0x176428[_0xc1e3('0x3b')]['tag']}:undefined,'required':_0x176428['query'][_0xc1e3('0xf3')]?!![]:![]}];}return db['ChatInteraction'][_0xc1e3('0x4a')](_0xbb746f);})[_0xc1e3('0x16')](function(_0x5791ee){_0x20ac35[_0xc1e3('0x5f')]=_0x5791ee;return _0x20ac35;});}})[_0xc1e3('0x16')](respondWithFilteredResult(_0x3fc972,_0xbb746f))[_0xc1e3('0x20')](handleError(_0x3fc972,null));};function iftimePromise(_0x4f0478,_0x28de81){return respondWithRpcPromise(_0xc1e3('0xf4'),_0xc1e3('0xf5'),{'command':_0x28de81[_0xc1e3('0xf6')]?util['format'](_0xc1e3('0xf7'),_0x4f0478[_0xc1e3('0xf8')],_0x28de81[_0xc1e3('0xf6')]):util[_0xc1e3('0xa8')](_0xc1e3('0xf9'),_0x4f0478[_0xc1e3('0xf8')])},client9002)[_0xc1e3('0x16')](function(_0x41a38e){var _0xa45008=_0x41a38e&&_0x41a38e[_0xc1e3('0xfa')]('true')>=0x0?!![]:![];logger[_0xc1e3('0x17')](_0xc1e3('0xfb'),_0x28de81['id'],_0x4f0478['id'],_0x4f0478[_0xc1e3('0xf8')],_0xa45008?'ONLINE':'OFFLINE',_0x28de81['timezone']?_0x28de81['timezone']:'No\x20timezone');return _0xa45008;})[_0xc1e3('0x20')](function(_0x4405de){logger[_0xc1e3('0x1c')](_0xc1e3('0xfb'),_0x28de81['id'],_0x4f0478['id'],_0x4f0478['interval'],util[_0xc1e3('0xfc')](_0x4405de,{'showHidden':![],'depth':null}),_0x28de81[_0xc1e3('0xf6')]?_0x28de81[_0xc1e3('0xf6')]:_0xc1e3('0xfd'));return![];});}exports[_0xc1e3('0xf5')]=function(_0x5cea6c,_0x3e1910){var _0x28d5fd=0x0;var _0x38790d=0x0;var _0x55683b=![];var _0x9911ed;var _0x36f945;return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x5cea6c['params']['id']},'include':[{'model':db[_0xc1e3('0xfe')],'as':_0xc1e3('0xfe'),'include':[{'model':db['Interval'],'as':_0xc1e3('0xff'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3e1910,null))[_0xc1e3('0x16')](function(_0x254d83){if(_0x254d83){_0x9911ed=_0x254d83;return _0x254d83['getProactiveActions']({'raw':!![]});}})['then'](function(_0x2c3f56){if(_0x9911ed){if(_0x2c3f56){_0x36f945=_0x2c3f56;}}return require(_0xc1e3('0x71'))[_0xc1e3('0x72')]();})[_0xc1e3('0x16')](function(_0x176843){if(_0x176843){_0x38790d=_0x176843[_0xc1e3('0x100')];_0x55683b=_0x176843[_0xc1e3('0x73')];}})[_0xc1e3('0x16')](function(){return db[_0xc1e3('0xb1')][_0xc1e3('0x26')]({'where':{'closed':![]}});})['then'](function(_0x5b3304){_0x28d5fd=_0x5b3304;if(_0x38790d&&_0x5b3304>_0x38790d){return db['License'][_0xc1e3('0x5d')]({'where':{'id':0x1}})[_0xc1e3('0x16')](function(_0x53921c){if(_0x53921c){_0x53921c[_0xc1e3('0x101')](_0xc1e3('0x102'));}});}})[_0xc1e3('0x16')](function(){if(_0x9911ed['Interval']&&_0x9911ed[_0xc1e3('0xfe')][_0xc1e3('0xff')]){var _0x570c47=[];for(var _0x65f32f=0x0;_0x65f32f<_0x9911ed['Interval'][_0xc1e3('0xff')][_0xc1e3('0x4c')];_0x65f32f++){var _0x43bf7f=_0x9911ed['Interval']['Intervals'][_0x65f32f][_0xc1e3('0x2a')]({'plain':!![]});_0x570c47[_0xc1e3('0x103')](iftimePromise(_0x43bf7f,_0x9911ed));}return BPromise[_0xc1e3('0x104')](_0x570c47)[_0xc1e3('0x16')](function(_0x3b9eef){return _[_0xc1e3('0x105')](_0x3b9eef);});}else{return!![];}})[_0xc1e3('0x16')](function(_0x55022f){var _0x307b08=fs[_0xc1e3('0x106')](path[_0xc1e3('0x6f')](config['root'],_0xc1e3('0x107')),'utf8');var _0x597197=new url[(_0xc1e3('0x108'))](_0x9911ed[_0xc1e3('0x109')])[_0xc1e3('0x10a')];var _0x15698d=_0xc1e3('0x10b');var _0x11694f=![];var _0x3218ec={'chatVersion':_0x15698d,'chatWebsiteAddressOrigin':_0x597197,'remote':_0x9911ed[_0xc1e3('0x10c')],'query':querystring[_0xc1e3('0xaf')](_[_0xc1e3('0x47')](_0x9911ed[_0xc1e3('0x2a')]({'plain':!![]}),{'customerIp':_0x5cea6c['headers']['x-forwarded-for']||_0x5cea6c[_0xc1e3('0x80')][_0xc1e3('0x10d')]||_0x5cea6c[_0xc1e3('0x10e')]['remoteAddress']||_0x5cea6c['ip'],'referer':_0x5cea6c[_0xc1e3('0x80')]['referer'],'openedInteractions':_0x28d5fd,'maxInteractions':_0x38790d,'virtual':_0x55683b['virtual'],'online':_0x55022f,'custom':_0x55683b}))['replace'](/'/g,'\x5c\x27')};_0x3e1910[_0xc1e3('0x30')](ejs[_0xc1e3('0xcd')](Mustache[_0xc1e3('0xcd')](_0x307b08,_0x3218ec),{'proactiveActions':_0x36f945,'alignment':_0x9911ed[_0xc1e3('0x10f')],'verticalAlignment':_0x9911ed[_0xc1e3('0x110')],'div_color':_0x9911ed['color'],'labelText':_0x9911ed[_0xc1e3('0x111')],'text_color':_0x9911ed[_0xc1e3('0x112')],'text_button_color':_0x9911ed[_0xc1e3('0x113')],'button_color':_0x9911ed['color_button'],'background_color':_0x9911ed[_0xc1e3('0x114')],'hideWhenOffline':_0x9911ed['hideWhenOffline'],'intervalId':_0x9911ed['IntervalId'],'isDevelopment':_0x11694f,'chatVersion':_0x15698d}));})[_0xc1e3('0x20')](handleError(_0x3e1910,null));};exports[_0xc1e3('0x115')]=function(_0x29c34b,_0x3f8306){var _0x52aca6=_0x29c34b[_0xc1e3('0x5b')]['id'];var _0x54a7cb=_0x29c34b[_0xc1e3('0x51')];var _0x4bc06f=0xc8;var _0x4cfd5d=null;return db[_0xc1e3('0xd8')]['transaction']({'isolationLevel':db[_0xc1e3('0xd8')]['Transaction'][_0xc1e3('0x116')][_0xc1e3('0x117')]},function(_0x10c7ee){return db[_0xc1e3('0x35')]['findOne']({'where':{'id':_0x52aca6},'transaction':_0x10c7ee})['then'](function(_0x2a19b7){if(_0x2a19b7){return db[_0xc1e3('0x96')]['destroy']({'where':{'ChatWebsiteId':_0x52aca6},'transaction':_0x10c7ee})[_0xc1e3('0x16')](function(){var _0x448864=_[_0xc1e3('0x34')](_0x54a7cb,function(_0x45f35d){_0x45f35d[_0xc1e3('0x5c')]=_0x52aca6;return _0x45f35d;});return db[_0xc1e3('0x96')][_0xc1e3('0x118')](_0x448864,{'transaction':_0x10c7ee});});}else{_0x4bc06f=0x194;_0x4cfd5d=[];}});})[_0xc1e3('0x16')](function(){if(_0x4bc06f!==0x194){return db[_0xc1e3('0x96')][_0xc1e3('0x119')]({'where':{'ChatWebsiteId':_0x52aca6},'order':_0xc1e3('0x9b')})[_0xc1e3('0x16')](function(_0x302597){_0x4cfd5d=_0x302597;});}})[_0xc1e3('0x20')](function(_0x5be72c){_0x4bc06f=0x1f4;logger['error'](_0x5be72c[_0xc1e3('0x2e')]);if(_0x5be72c[_0xc1e3('0x2f')]){delete _0x5be72c['name'];}_0x4cfd5d=_0x5be72c;})[_0xc1e3('0x11a')](function(){if(_0x4cfd5d===null){_0x3f8306[_0xc1e3('0x21')](_0x4bc06f);}else{if(_0x4bc06f===0x1f4){_0x3f8306[_0xc1e3('0x22')](_0x4bc06f)[_0xc1e3('0x30')](_0x4cfd5d);}else{_0x3f8306['status'](_0x4bc06f)[_0xc1e3('0x23')](_0x4cfd5d);}}});};exports[_0xc1e3('0x11b')]=function(_0x114b15,_0x507ee1){var _0x3799a3={};var _0x4e2b81={};var _0x3b4d7d;var _0x599691;return db[_0xc1e3('0x35')]['findOne']({'where':{'id':_0x114b15[_0xc1e3('0x5b')]['id']}})['then'](handleEntityNotFound(_0x507ee1,null))[_0xc1e3('0x16')](function(_0x1d4793){if(_0x1d4793){_0x3b4d7d=_0x1d4793;_0x4e2b81[_0xc1e3('0x3a')]=_[_0xc1e3('0x4b')](db['ChatApplication'][_0xc1e3('0x36')]);_0x4e2b81[_0xc1e3('0x3b')]=_['keys'](_0x114b15[_0xc1e3('0x3b')]);_0x4e2b81[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x4e2b81[_0xc1e3('0x3a')],_0x4e2b81[_0xc1e3('0x3b')]);_0x3799a3[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x4e2b81[_0xc1e3('0x3a')],qs['fields'](_0x114b15[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0x3799a3[_0xc1e3('0x3e')]=_0x3799a3[_0xc1e3('0x3e')][_0xc1e3('0x4c')]?_0x3799a3[_0xc1e3('0x3e')]:_0x4e2b81[_0xc1e3('0x3a')];_0x3799a3[_0xc1e3('0x42')]=qs['sort'](_0x114b15[_0xc1e3('0x3b')][_0xc1e3('0x43')]);_0x3799a3[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_['pick'](_0x114b15[_0xc1e3('0x3b')],_0x4e2b81[_0xc1e3('0x3c')]));if(_0x114b15[_0xc1e3('0x3b')][_0xc1e3('0x46')]){_0x3799a3[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0x3799a3[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x3799a3[_0xc1e3('0x3e')],function(_0x435b2f){var _0x3635e6={};_0x3635e6[_0x435b2f]={'$like':'%'+_0x114b15['query']['filter']+'%'};return _0x3635e6;})});}_0x3799a3=_[_0xc1e3('0x47')]({},_0x3799a3,_0x114b15[_0xc1e3('0x4e')]);return _0x3b4d7d[_0xc1e3('0x11b')](_0x3799a3);}})[_0xc1e3('0x16')](function(_0x3ec175){if(_0x3ec175){_0x599691=_0x3ec175[_0xc1e3('0x4c')];if(!_0x114b15['query'][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0x3799a3[_0xc1e3('0x27')]=qs['limit'](_0x114b15[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0x3799a3['offset']=qs[_0xc1e3('0x24')](_0x114b15['query'][_0xc1e3('0x24')]);}return _0x3b4d7d[_0xc1e3('0x11b')](_0x3799a3);}})[_0xc1e3('0x16')](function(_0x2915b4){if(_0x2915b4){return _0x2915b4?{'count':_0x599691,'rows':_0x2915b4}:null;}})[_0xc1e3('0x16')](respondWithResult(_0x507ee1,null))[_0xc1e3('0x20')](handleError(_0x507ee1,null));};exports[_0xc1e3('0x11c')]=function(_0x3ae246,_0x194fb6){return db[_0xc1e3('0x11d')][_0xc1e3('0x4f')]({'where':{'id':_0x3ae246['params']['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x194fb6,null))[_0xc1e3('0x16')](function(_0x3af91c){if(_0x3af91c){return _0x3af91c[_0xc1e3('0x11c')](_0x3ae246[_0xc1e3('0x51')][_0xc1e3('0x61')],_[_0xc1e3('0xec')](_0x3ae246['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x194fb6,null))[_0xc1e3('0x20')](handleError(_0x194fb6,null));};exports[_0xc1e3('0x11e')]=function(_0x311ded,_0x2ce300){var _0x4f2a80={};var _0x1f5d04={};var _0x3dd41e;var _0x48ac8a;return db[_0xc1e3('0x35')][_0xc1e3('0x5d')]({'where':{'id':_0x311ded['params']['id']}})['then'](handleEntityNotFound(_0x2ce300,null))[_0xc1e3('0x16')](function(_0x2c941b){if(_0x2c941b){_0x3dd41e=_0x2c941b;_0x1f5d04[_0xc1e3('0x3a')]=_['keys'](db['ChatProactiveAction'][_0xc1e3('0x36')]);_0x1f5d04['query']=_[_0xc1e3('0x4b')](_0x311ded[_0xc1e3('0x3b')]);_0x1f5d04[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x1f5d04['model'],_0x1f5d04[_0xc1e3('0x3b')]);_0x4f2a80[_0xc1e3('0x3e')]=_['intersection'](_0x1f5d04[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x311ded[_0xc1e3('0x3b')]['fields']));_0x4f2a80[_0xc1e3('0x3e')]=_0x4f2a80['attributes'][_0xc1e3('0x4c')]?_0x4f2a80['attributes']:_0x1f5d04[_0xc1e3('0x3a')];_0x4f2a80[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x311ded[_0xc1e3('0x3b')][_0xc1e3('0x43')]);_0x4f2a80[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x311ded['query'],_0x1f5d04['filters']));if(_0x311ded[_0xc1e3('0x3b')][_0xc1e3('0x46')]){_0x4f2a80[_0xc1e3('0x44')]=_['merge'](_0x4f2a80[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x4f2a80[_0xc1e3('0x3e')],function(_0xd81ba9){var _0x2ceefd={};_0x2ceefd[_0xd81ba9]={'$like':'%'+_0x311ded['query']['filter']+'%'};return _0x2ceefd;})});}_0x4f2a80=_[_0xc1e3('0x47')]({},_0x4f2a80,_0x311ded[_0xc1e3('0x4e')]);return _0x3dd41e[_0xc1e3('0x11e')](_0x4f2a80);}})[_0xc1e3('0x16')](function(_0x1b1874){if(_0x1b1874){_0x48ac8a=_0x1b1874[_0xc1e3('0x4c')];if(!_0x311ded['query'][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0x4f2a80[_0xc1e3('0x27')]=qs[_0xc1e3('0x27')](_0x311ded[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0x4f2a80['offset']=qs['offset'](_0x311ded[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}return _0x3dd41e[_0xc1e3('0x11e')](_0x4f2a80);}})['then'](function(_0x3f8e39){if(_0x3f8e39){return _0x3f8e39?{'count':_0x48ac8a,'rows':_0x3f8e39}:null;}})['then'](respondWithResult(_0x2ce300,null))[_0xc1e3('0x20')](handleError(_0x2ce300,null));};exports[_0xc1e3('0x11f')]=function(_0x459955,_0x36a82b){var _0xb0577e=_0x459955[_0xc1e3('0x3b')]['online']===_0xc1e3('0x120')?_0xc1e3('0x121'):_0xc1e3('0x122');return db[_0xc1e3('0x35')]['find']({'attributes':['id',_0xb0577e],'where':{'id':_0x459955['params']['id']}})['then'](handleEntityNotFound(_0x36a82b,null))[_0xc1e3('0x16')](function(_0x3239e4){if(_0x3239e4){var _0x20eb26=_0x3239e4[_0xb0577e];var _0x5d605d=_0x20eb26&&_0x20eb26['items']?_0x20eb26[_0xc1e3('0x123')]:[];_0x36a82b[_0xc1e3('0x30')]({'fromKey':_[_0xc1e3('0x74')](_0x20eb26[_0xc1e3('0x124')])?undefined:_0x20eb26[_0xc1e3('0x124')],'count':_0x5d605d[_0xc1e3('0x4c')],'rows':_0x5d605d});}})[_0xc1e3('0x20')](handleError(_0x36a82b,null));};exports[_0xc1e3('0x125')]=function(_0x5830d1,_0x25f938){var _0x4ff05e={'raw':![],'where':{}};var _0x50d706={};var _0x61a96a={'count':0x0,'rows':[]};return db[_0xc1e3('0x35')]['findOne']({'where':{'id':_0x5830d1[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x25f938,null))[_0xc1e3('0x16')](function(_0x40d78a){if(_0x40d78a){_0x50d706['model']=_['keys'](db[_0xc1e3('0xd0')][_0xc1e3('0x36')]);_0x50d706[_0xc1e3('0x3b')]=_['keys'](_0x5830d1[_0xc1e3('0x3b')]);_0x50d706['filters']=_[_0xc1e3('0x3d')](_0x50d706['model'],_0x50d706['query']);_0x4ff05e[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x50d706[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x5830d1[_0xc1e3('0x3b')][_0xc1e3('0x3f')]));_0x4ff05e[_0xc1e3('0x3e')]=_0x4ff05e[_0xc1e3('0x3e')][_0xc1e3('0x4c')]?_0x4ff05e[_0xc1e3('0x3e')]:_0x50d706[_0xc1e3('0x3a')];if(!_0x5830d1['query'][_0xc1e3('0x40')](_0xc1e3('0x41'))){_0x4ff05e[_0xc1e3('0x27')]=qs[_0xc1e3('0x27')](_0x5830d1[_0xc1e3('0x3b')][_0xc1e3('0x27')]);_0x4ff05e[_0xc1e3('0x24')]=qs[_0xc1e3('0x24')](_0x5830d1[_0xc1e3('0x3b')][_0xc1e3('0x24')]);}_0x4ff05e[_0xc1e3('0x42')]=qs[_0xc1e3('0x43')](_0x5830d1['query']['sort']);_0x4ff05e[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x5830d1[_0xc1e3('0x3b')],_0x50d706[_0xc1e3('0x3c')]));_0x4ff05e[_0xc1e3('0x44')][_0xc1e3('0x5c')]=_0x40d78a['id'];if(_0x5830d1[_0xc1e3('0x3b')]['filter']){_0x4ff05e[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0x4ff05e[_0xc1e3('0x44')],{'$or':_[_0xc1e3('0x34')](_0x4ff05e[_0xc1e3('0x3e')],function(_0x728266){var _0x2b287a={};_0x2b287a[_0x728266]={'$like':'%'+_0x5830d1['query']['filter']+'%'};return _0x2b287a;})});}_0x4ff05e=_[_0xc1e3('0x47')]({},_0x4ff05e,_0x5830d1['options']);return db[_0xc1e3('0xd0')]['count']({'where':_0x4ff05e[_0xc1e3('0x44')]})[_0xc1e3('0x16')](function(_0x5a3106){_0x61a96a['count']=_0x5a3106;if(_0x5830d1[_0xc1e3('0x3b')][_0xc1e3('0x49')]){_0x4ff05e[_0xc1e3('0x4d')]=[{'all':!![]}];}else{_0x4ff05e[_0xc1e3('0x4d')]=[{'model':db[_0xc1e3('0x93')],'as':'Contact','required':![]},{'model':db[_0xc1e3('0x126')],'as':_0xc1e3('0x127'),'required':![]}];}return db[_0xc1e3('0xd0')][_0xc1e3('0x4a')](_0x4ff05e);})['then'](function(_0x11276f){_0x61a96a[_0xc1e3('0x5f')]=_0x11276f;return _0x61a96a;});}})['then'](respondWithFilteredResult(_0x25f938,_0x4ff05e))['catch'](handleError(_0x25f938,null));};exports[_0xc1e3('0x128')]=function(_0x3cfd40,_0x5056f0){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x3cfd40[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x5056f0,null))[_0xc1e3('0x16')](function(_0x43fd12){if(_0x43fd12){return _0x43fd12[_0xc1e3('0x128')](_0x3cfd40[_0xc1e3('0x51')][_0xc1e3('0x61')],_[_0xc1e3('0xec')](_0x3cfd40[_0xc1e3('0x51')],[_0xc1e3('0x61'),'id'])||{})[_0xc1e3('0xb5')](function(_0x13a5ca){for(var _0xe5bb82=0x0;_0xe5bb82<_0x3cfd40['body'][_0xc1e3('0x61')][_0xc1e3('0x4c')];_0xe5bb82+=0x1){socket[_0xc1e3('0x129')](_0xc1e3('0x12a'),{'UserId':Number(_0x3cfd40[_0xc1e3('0x51')][_0xc1e3('0x61')][_0xe5bb82]),'ChatWebsiteId':Number(_0x3cfd40[_0xc1e3('0x5b')]['id'])});}return _0x13a5ca;});}})[_0xc1e3('0x16')](respondWithResult(_0x5056f0,null))['catch'](handleError(_0x5056f0,null));};exports['removeAgents']=function(_0x8c4b23,_0x5ca597){return db[_0xc1e3('0x35')][_0xc1e3('0x4f')]({'where':{'id':_0x8c4b23[_0xc1e3('0x5b')]['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x5ca597,null))[_0xc1e3('0x16')](function(_0x535fa5){if(_0x535fa5){return _0x535fa5['removeAgents'](_0x8c4b23[_0xc1e3('0x3b')][_0xc1e3('0x61')])[_0xc1e3('0x16')](function(){if(_['isArray'](_0x8c4b23['query'][_0xc1e3('0x61')])){for(var _0x1ac50c=0x0;_0x1ac50c<_0x8c4b23['query'][_0xc1e3('0x61')][_0xc1e3('0x4c')];_0x1ac50c+=0x1){socket[_0xc1e3('0x129')]('userChatWebsite:remove',{'UserId':Number(_0x8c4b23[_0xc1e3('0x3b')][_0xc1e3('0x61')][_0x1ac50c]),'ChatWebsiteId':Number(_0x8c4b23[_0xc1e3('0x5b')]['id'])});}}else{socket[_0xc1e3('0x129')]('userChatWebsite:remove',{'UserId':Number(_0x8c4b23[_0xc1e3('0x3b')]['ids']),'ChatWebsiteId':Number(_0x8c4b23[_0xc1e3('0x5b')]['id'])});}});}})[_0xc1e3('0x16')](respondWithStatusCode(_0x5ca597,null))[_0xc1e3('0x20')](handleError(_0x5ca597,null));};exports[_0xc1e3('0x12b')]=function(_0x4be452,_0x596afd){var _0x4fc9c5={};var _0x22b879={};var _0x4f30e1;var _0x12135a;return db[_0xc1e3('0x35')]['findOne']({'where':{'id':_0x4be452['params']['id']}})[_0xc1e3('0x16')](handleEntityNotFound(_0x596afd,null))[_0xc1e3('0x16')](function(_0x19623e){if(_0x19623e){_0x4f30e1=_0x19623e;_0x22b879[_0xc1e3('0x3a')]=_['keys'](db['User'][_0xc1e3('0x36')]);_0x22b879[_0xc1e3('0x3b')]=_[_0xc1e3('0x4b')](_0x4be452[_0xc1e3('0x3b')]);_0x22b879[_0xc1e3('0x3c')]=_[_0xc1e3('0x3d')](_0x22b879['model'],_0x22b879[_0xc1e3('0x3b')]);_0x4fc9c5[_0xc1e3('0x3e')]=_[_0xc1e3('0x3d')](_0x22b879[_0xc1e3('0x3a')],qs[_0xc1e3('0x3f')](_0x4be452['query']['fields']));_0x4fc9c5[_0xc1e3('0x3e')]=_0x4fc9c5['attributes']['length']?_0x4fc9c5['attributes']:_0x22b879[_0xc1e3('0x3a')];_0x4fc9c5[_0xc1e3('0x42')]=qs['sort'](_0x4be452['query'][_0xc1e3('0x43')]);_0x4fc9c5[_0xc1e3('0x44')]=qs[_0xc1e3('0x3c')](_[_0xc1e3('0x45')](_0x4be452['query'],_0x22b879[_0xc1e3('0x3c')]));if(_0x4be452[_0xc1e3('0x3b')]['filter']){_0x4fc9c5[_0xc1e3('0x44')]=_[_0xc1e3('0x47')](_0x4fc9c5[_0xc1e3('0x44')],{'$or':_['map'](_0x4fc9c5[_0xc1e3('0x3e')],function(_0x5a420f){var _0x2c1123={};_0x2c1123[_0x5a420f]={'$like':'%'+_0x4be452[_0xc1e3('0x3b')][_0xc1e3('0x46')]+'%'};return _0x2c1123;})});}_0x4fc9c5=_[_0xc1e3('0x47')]({},_0x4fc9c5,_0x4be452[_0xc1e3('0x4e')]);return _0x4f30e1[_0xc1e3('0x12b')](_0x4fc9c5);}})['then'](function(_0x4632a1){if(_0x4632a1){_0x12135a=_0x4632a1[_0xc1e3('0x4c')];if(!_0x4be452['query'][_0xc1e3('0x40')]('nolimit')){_0x4fc9c5[_0xc1e3('0x27')]=qs['limit'](_0x4be452[_0xc1e3('0x3b')]['limit']);_0x4fc9c5[_0xc1e3('0x24')]=qs[_0xc1e3('0x24')](_0x4be452['query'][_0xc1e3('0x24')]);}return _0x4f30e1[_0xc1e3('0x12b')](_0x4fc9c5);}})[_0xc1e3('0x16')](function(_0x16a816){if(_0x16a816){return _0x16a816?{'count':_0x12135a,'rows':_0x16a816}:null;}})[_0xc1e3('0x16')](respondWithResult(_0x596afd,null))[_0xc1e3('0x20')](handleError(_0x596afd,null));}; \ No newline at end of file +var _0xa5bd=['chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','Pause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ChatWebsiteId','Disposition','getDispositions','findOne','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','ChatApplication','Applications','applications','List','priority','asc','account','ListId','customerIp','cf-connecting-ip','x-forwarded-for','first','lastName','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','ContactId','interaction','spread','contact','firstName','messageId','created','close','*,*,*,*','ChatMessage','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','push','all','some','server/files/chat/iframe.ejs','utf8','URL','origin','3.1.0','remote','x-real-ip','remoteAddress','replace','verticalAlignment','color','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0xa5bd,0x142));var _0xda5b=function(_0xa1e030,_0x579969){_0xa1e030=_0xa1e030-0x0;var _0x1619bb=_0xa5bd[_0xa1e030];return _0x1619bb;};'use strict';var BPromise=require(_0xda5b('0x0'));var Mustache=require(_0xda5b('0x1'));var util=require(_0xda5b('0x2'));var path=require(_0xda5b('0x3'));var ejs=require(_0xda5b('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda5b('0x5'));var querystring=require(_0xda5b('0x6'));var Redis=require(_0xda5b('0x7'));var qs=require(_0xda5b('0x8'));var logger=require('../../config/logger')(_0xda5b('0x9'));var config=require(_0xda5b('0xa'));var url=require(_0xda5b('0xb'));var db=require(_0xda5b('0xc'))['db'];config[_0xda5b('0xd')]=_[_0xda5b('0xe')](config[_0xda5b('0xd')],{'host':_0xda5b('0xf'),'port':0x18eb});var socket=require(_0xda5b('0x10'))(new Redis(config['redis']));require(_0xda5b('0x11'))[_0xda5b('0x12')](socket);var htmlToText=require(_0xda5b('0x13'));var jayson=require(_0xda5b('0x14'));var client=jayson[_0xda5b('0x15')][_0xda5b('0x16')]({'port':0x232c});var client9002=jayson['client'][_0xda5b('0x16')]({'port':0x232a});var client9003=jayson[_0xda5b('0x15')][_0xda5b('0x16')]({'port':0x232b});var client9001=jayson[_0xda5b('0x15')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3d39c9,_0x5ce8ad,_0x48e5e7,_0x3b7012){return new BPromise(function(_0x28acbd,_0x1705e0){var _0x406183=_0x3b7012||client;return _0x406183['request'](_0x3d39c9,_0x48e5e7)[_0xda5b('0x17')](function(_0x175004){logger[_0xda5b('0x18')](_0xda5b('0x19'),_0x5ce8ad,_0xda5b('0x1a'));logger[_0xda5b('0x1b')](_0xda5b('0x1c'),_0x5ce8ad,_0xda5b('0x1a'),JSON[_0xda5b('0x1d')](_0x175004));if(_0x175004[_0xda5b('0x1e')]){if(_0x175004[_0xda5b('0x1e')][_0xda5b('0x1f')]===0x1f4){logger['error'](_0xda5b('0x19'),_0x5ce8ad,_0x175004[_0xda5b('0x1e')]['message']);return _0x1705e0(_0x175004[_0xda5b('0x1e')][_0xda5b('0x20')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5ce8ad,_0x175004[_0xda5b('0x1e')][_0xda5b('0x20')]);return _0x28acbd(_0x175004[_0xda5b('0x1e')][_0xda5b('0x20')]);}else{logger[_0xda5b('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x5ce8ad,_0xda5b('0x1a'));_0x28acbd(_0x175004[_0xda5b('0x21')][_0xda5b('0x20')]);}})[_0xda5b('0x22')](function(_0xba875b){logger[_0xda5b('0x1e')]('ChatWebsite,\x20%s,\x20%s',_0x5ce8ad,_0xba875b);_0x1705e0(_0xba875b);});});}function respondWithStatusCode(_0x1012bf,_0x2f646d){_0x2f646d=_0x2f646d||0xcc;return function(_0x57a8ae){if(_0x57a8ae){return _0x1012bf['sendStatus'](_0x2f646d);}return _0x1012bf[_0xda5b('0x23')](_0x2f646d)[_0xda5b('0x24')]();};}function respondWithResult(_0x37bbad,_0x18bc45){_0x18bc45=_0x18bc45||0xc8;return function(_0x2d4be9){if(_0x2d4be9){return _0x37bbad['status'](_0x18bc45)[_0xda5b('0x25')](_0x2d4be9);}};}function respondWithFilteredResult(_0x2260b8,_0x5eb4e6){return function(_0x30079b){if(_0x30079b){var _0x1fcaea=typeof _0x5eb4e6['offset']===_0xda5b('0x26')&&typeof _0x5eb4e6[_0xda5b('0x27')]===_0xda5b('0x26');var _0x1f0218=_0x30079b[_0xda5b('0x28')];var _0x5a70a1=_0x1fcaea?0x0:_0x5eb4e6['offset'];var _0x43f89e=_0x1fcaea?_0x30079b[_0xda5b('0x28')]:_0x5eb4e6[_0xda5b('0x29')]+_0x5eb4e6[_0xda5b('0x27')];var _0x1e0400;if(_0x43f89e>=_0x1f0218){_0x43f89e=_0x1f0218;_0x1e0400=0xc8;}else{_0x1e0400=0xce;}_0x2260b8[_0xda5b('0x23')](_0x1e0400);return _0x2260b8[_0xda5b('0x2a')](_0xda5b('0x2b'),_0x5a70a1+'-'+_0x43f89e+'/'+_0x1f0218)['json'](_0x30079b);}return null;};}function saveUpdates(_0x54ed67){return function(_0x445f30){if(_0x445f30){return _0x445f30[_0xda5b('0x2c')](_0x54ed67)[_0xda5b('0x17')](function(_0x1c53a9){return _0x1c53a9;});}return null;};}function removeEntity(_0x30ce9e){return function(_0x40e30d){if(_0x40e30d){return _0x40e30d['destroy']()[_0xda5b('0x17')](function(){var _0x4a3184=_0x40e30d[_0xda5b('0x2d')]({'plain':!![]});var _0x3d417b=_0xda5b('0x2e');return db[_0xda5b('0x2f')][_0xda5b('0x30')]({'where':{'type':_0x3d417b,'resourceId':_0x4a3184['id']}})[_0xda5b('0x17')](function(){return _0x40e30d;});})[_0xda5b('0x17')](function(){_0x30ce9e['status'](0xcc)[_0xda5b('0x24')]();});}};}function handleEntityNotFound(_0x37ba11){return function(_0x18937d){if(!_0x18937d){_0x37ba11[_0xda5b('0x31')](0x194);}return _0x18937d;};}function handleError(_0x396fcd,_0x2e8385){_0x2e8385=_0x2e8385||0x1f4;return function(_0x1fceff){logger['error'](_0x1fceff[_0xda5b('0x32')]);if(_0x1fceff[_0xda5b('0x33')]){delete _0x1fceff[_0xda5b('0x33')];}_0x396fcd[_0xda5b('0x23')](_0x2e8385)['send'](_0x1fceff);};}exports[_0xda5b('0x34')]=function(_0x42fd13,_0xd0549){var _0x4e506c={'include':[{'model':db['Pause'],'as':_0xda5b('0x35')}]},_0x1c762d={},_0x3528a0={'count':0x0,'rows':[]};var _0x4ec097=_[_0xda5b('0x36')](db[_0xda5b('0x37')][_0xda5b('0x38')],function(_0xbbdd58){return{'name':_0xbbdd58['fieldName'],'type':_0xbbdd58[_0xda5b('0x39')]['key']};});_0x1c762d[_0xda5b('0x3a')]=_['map'](_0x4ec097,'name');_0x1c762d[_0xda5b('0x3b')]=_[_0xda5b('0x3c')](_0x42fd13[_0xda5b('0x3b')]);_0x1c762d[_0xda5b('0x3d')]=_[_0xda5b('0x3e')](_0x1c762d[_0xda5b('0x3a')],_0x1c762d[_0xda5b('0x3b')]);_0x4e506c[_0xda5b('0x3f')]=_[_0xda5b('0x3e')](_0x1c762d[_0xda5b('0x3a')],qs[_0xda5b('0x40')](_0x42fd13[_0xda5b('0x3b')][_0xda5b('0x40')]));_0x4e506c[_0xda5b('0x3f')]=_0x4e506c[_0xda5b('0x3f')][_0xda5b('0x41')]?_0x4e506c[_0xda5b('0x3f')]:_0x1c762d[_0xda5b('0x3a')];if(!_0x42fd13[_0xda5b('0x3b')][_0xda5b('0x42')](_0xda5b('0x43'))){_0x4e506c[_0xda5b('0x27')]=qs[_0xda5b('0x27')](_0x42fd13[_0xda5b('0x3b')]['limit']);_0x4e506c[_0xda5b('0x29')]=qs['offset'](_0x42fd13[_0xda5b('0x3b')][_0xda5b('0x29')]);}_0x4e506c[_0xda5b('0x44')]=qs[_0xda5b('0x45')](_0x42fd13[_0xda5b('0x3b')]['sort']);_0x4e506c[_0xda5b('0x46')]=qs[_0xda5b('0x3d')](_[_0xda5b('0x47')](_0x42fd13[_0xda5b('0x3b')],_0x1c762d[_0xda5b('0x3d')]),_0x4ec097);if(_0x42fd13[_0xda5b('0x3b')][_0xda5b('0x48')]){_0x4e506c['where']=_[_0xda5b('0x49')](_0x4e506c[_0xda5b('0x46')],{'$or':_[_0xda5b('0x36')](_0x4ec097,function(_0x51840f){if(_0x51840f[_0xda5b('0x39')]!==_0xda5b('0x4a')){var _0x158bd2={};_0x158bd2[_0x51840f[_0xda5b('0x33')]]={'$like':'%'+_0x42fd13[_0xda5b('0x3b')][_0xda5b('0x48')]+'%'};return _0x158bd2;}})});}_0x4e506c=_['merge']({},_0x4e506c,_0x42fd13[_0xda5b('0x4b')]);var _0x1e5598={'where':_0x4e506c[_0xda5b('0x46')]};return db[_0xda5b('0x37')][_0xda5b('0x28')](_0x1e5598)['then'](function(_0x112b5e){_0x3528a0[_0xda5b('0x28')]=_0x112b5e;if(_0x42fd13[_0xda5b('0x3b')][_0xda5b('0x4c')]){_0x4e506c[_0xda5b('0x4d')]=[{'all':!![]}];}return db[_0xda5b('0x37')][_0xda5b('0x4e')](_0x4e506c);})[_0xda5b('0x17')](function(_0x38f8cc){_0x3528a0[_0xda5b('0x4f')]=_0x38f8cc;return _0x3528a0;})[_0xda5b('0x17')](respondWithFilteredResult(_0xd0549,_0x4e506c))['catch'](handleError(_0xd0549,null));};exports['show']=function(_0x47f37e,_0x304eed){var _0xd2f429={'raw':![],'where':{'id':_0x47f37e[_0xda5b('0x50')]['id']},'include':[{'model':db[_0xda5b('0x51')],'as':'mandatoryDispositionPause'}]},_0x5bab91={};_0x5bab91['model']=_['keys'](db[_0xda5b('0x37')]['rawAttributes']);_0x5bab91[_0xda5b('0x3b')]=_[_0xda5b('0x3c')](_0x47f37e[_0xda5b('0x3b')]);_0x5bab91[_0xda5b('0x3d')]=_[_0xda5b('0x3e')](_0x5bab91[_0xda5b('0x3a')],_0x5bab91[_0xda5b('0x3b')]);_0xd2f429[_0xda5b('0x3f')]=_[_0xda5b('0x3e')](_0x5bab91[_0xda5b('0x3a')],qs[_0xda5b('0x40')](_0x47f37e[_0xda5b('0x3b')][_0xda5b('0x40')]));_0xd2f429[_0xda5b('0x3f')]=_0xd2f429[_0xda5b('0x3f')][_0xda5b('0x41')]?_0xd2f429[_0xda5b('0x3f')]:_0x5bab91[_0xda5b('0x3a')];if(_0x47f37e['query'][_0xda5b('0x4c')]){_0xd2f429[_0xda5b('0x4d')]=[{'all':!![]}];}_0xd2f429=_[_0xda5b('0x49')]({},_0xd2f429,_0x47f37e['options']);return db[_0xda5b('0x37')][_0xda5b('0x52')](_0xd2f429)['then'](handleEntityNotFound(_0x304eed,null))[_0xda5b('0x17')](respondWithResult(_0x304eed,null))[_0xda5b('0x22')](handleError(_0x304eed,null));};exports[_0xda5b('0x53')]=function(_0x21ff89,_0x4af351){return db[_0xda5b('0x37')][_0xda5b('0x53')](_0x21ff89['body'],{})[_0xda5b('0x17')](function(_0x3f9f97){var _0x45e5d7=_0x21ff89[_0xda5b('0x54')][_0xda5b('0x2d')]({'plain':!![]});if(!_0x45e5d7)throw new Error(_0xda5b('0x55'));if(_0x45e5d7[_0xda5b('0x56')]===_0xda5b('0x54')){var _0x5adc57=_0x3f9f97[_0xda5b('0x2d')]({'plain':!![]});var _0x15ca93='ChatWebsites';return db[_0xda5b('0x57')][_0xda5b('0x52')]({'where':{'name':_0x15ca93,'userProfileId':_0x45e5d7['userProfileId']},'raw':!![]})[_0xda5b('0x17')](function(_0x612918){if(_0x612918&&_0x612918[_0xda5b('0x58')]===0x0){return db['UserProfileResource'][_0xda5b('0x53')]({'name':_0x5adc57[_0xda5b('0x33')],'resourceId':_0x5adc57['id'],'type':_0x612918[_0xda5b('0x33')],'sectionId':_0x612918['id']},{})[_0xda5b('0x17')](function(){return _0x3f9f97;});}else{return _0x3f9f97;}})[_0xda5b('0x22')](function(_0x2622eb){logger[_0xda5b('0x1e')](_0xda5b('0x59'),_0x2622eb);throw _0x2622eb;});}return _0x3f9f97;})['then'](respondWithResult(_0x4af351,0xc9))[_0xda5b('0x22')](handleError(_0x4af351,null));};exports['update']=function(_0x44e505,_0x3f05d5){if(_0x44e505[_0xda5b('0x5a')]['id']){delete _0x44e505[_0xda5b('0x5a')]['id'];}return db['ChatWebsite'][_0xda5b('0x52')]({'where':{'id':_0x44e505['params']['id']},'include':[{'model':db['Pause'],'as':_0xda5b('0x35')}]})[_0xda5b('0x17')](handleEntityNotFound(_0x3f05d5,null))['then'](saveUpdates(_0x44e505['body'],null))[_0xda5b('0x17')](respondWithResult(_0x3f05d5,null))['catch'](handleError(_0x3f05d5,null));};exports[_0xda5b('0x30')]=function(_0x1c10fd,_0x5787b6){return db[_0xda5b('0x37')][_0xda5b('0x52')]({'where':{'id':_0x1c10fd[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x5787b6,null))[_0xda5b('0x17')](removeEntity(_0x5787b6,null))[_0xda5b('0x22')](handleError(_0x5787b6,null));};exports[_0xda5b('0x5b')]=function(_0xf282a3,_0x508403){return db['ChatWebsite'][_0xda5b('0x5b')]()['then'](respondWithResult(_0x508403,null))['catch'](handleError(_0x508403,null));};exports['addDisposition']=function(_0xdaf7d,_0x12ae83){if(_0xdaf7d[_0xda5b('0x5a')]['id']){delete _0xdaf7d[_0xda5b('0x5a')]['id'];}return db[_0xda5b('0x37')][_0xda5b('0x52')]({'where':{'id':_0xdaf7d['params']['id']}})['then'](handleEntityNotFound(_0x12ae83,null))[_0xda5b('0x17')](function(_0xe31e0c){if(_0xe31e0c){_0xdaf7d[_0xda5b('0x5a')][_0xda5b('0x5c')]=_0xe31e0c['id'];return db[_0xda5b('0x5d')][_0xda5b('0x53')](_0xdaf7d[_0xda5b('0x5a')]);}})[_0xda5b('0x17')](respondWithResult(_0x12ae83,null))[_0xda5b('0x22')](handleError(_0x12ae83,null));};exports[_0xda5b('0x5e')]=function(_0x3f3e90,_0x14b367){var _0x12bf4d={'raw':![],'where':{}};var _0x4775f6={};var _0x5008d6={'count':0x0,'rows':[]};return db[_0xda5b('0x37')][_0xda5b('0x5f')]({'where':{'id':_0x3f3e90['params']['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x14b367,null))[_0xda5b('0x17')](function(_0x3e832){if(_0x3e832){_0x4775f6[_0xda5b('0x3a')]=_[_0xda5b('0x3c')](db[_0xda5b('0x5d')][_0xda5b('0x38')]);_0x4775f6[_0xda5b('0x3b')]=_[_0xda5b('0x3c')](_0x3f3e90[_0xda5b('0x3b')]);_0x4775f6['filters']=_[_0xda5b('0x3e')](_0x4775f6[_0xda5b('0x3a')],_0x4775f6[_0xda5b('0x3b')]);_0x12bf4d['attributes']=_[_0xda5b('0x3e')](_0x4775f6[_0xda5b('0x3a')],qs[_0xda5b('0x40')](_0x3f3e90[_0xda5b('0x3b')][_0xda5b('0x40')]));_0x12bf4d['attributes']=_0x12bf4d[_0xda5b('0x3f')][_0xda5b('0x41')]?_0x12bf4d[_0xda5b('0x3f')]:_0x4775f6['model'];if(!_0x3f3e90[_0xda5b('0x3b')]['hasOwnProperty'](_0xda5b('0x43'))){_0x12bf4d[_0xda5b('0x27')]=qs[_0xda5b('0x27')](_0x3f3e90[_0xda5b('0x3b')]['limit']);_0x12bf4d[_0xda5b('0x29')]=qs['offset'](_0x3f3e90[_0xda5b('0x3b')][_0xda5b('0x29')]);}_0x12bf4d['order']=qs[_0xda5b('0x45')](_0x3f3e90['query']['sort']);_0x12bf4d[_0xda5b('0x46')]=qs[_0xda5b('0x3d')](_[_0xda5b('0x47')](_0x3f3e90['query'],_0x4775f6[_0xda5b('0x3d')]));_0x12bf4d[_0xda5b('0x46')]['ChatWebsiteId']=_0x3e832['id'];if(_0x3f3e90[_0xda5b('0x3b')]['filter']){_0x12bf4d[_0xda5b('0x46')]=_['merge'](_0x12bf4d[_0xda5b('0x46')],{'$or':_[_0xda5b('0x36')](_0x12bf4d[_0xda5b('0x3f')],function(_0x1b9a1b){var _0x2ee59d={};_0x2ee59d[_0x1b9a1b]={'$like':'%'+_0x3f3e90[_0xda5b('0x3b')]['filter']+'%'};return _0x2ee59d;})});}_0x12bf4d=_[_0xda5b('0x49')]({},_0x12bf4d,_0x3f3e90['options']);return db[_0xda5b('0x5d')][_0xda5b('0x28')]({'where':_0x12bf4d[_0xda5b('0x46')]})[_0xda5b('0x17')](function(_0x3f4e71){_0x5008d6['count']=_0x3f4e71;if(_0x3f3e90['query'][_0xda5b('0x4c')]){_0x12bf4d[_0xda5b('0x4d')]=[{'all':!![]}];}return db['Disposition'][_0xda5b('0x4e')](_0x12bf4d);})['then'](function(_0x411df0){_0x5008d6[_0xda5b('0x4f')]=_0x411df0;return _0x5008d6;});}})[_0xda5b('0x17')](respondWithFilteredResult(_0x14b367,_0x12bf4d))[_0xda5b('0x22')](handleError(_0x14b367,null));};exports['removeDispositions']=function(_0x3da7a5,_0x1ef3a7){return db[_0xda5b('0x37')][_0xda5b('0x52')]({'where':{'id':_0x3da7a5['params']['id']}})['then'](handleEntityNotFound(_0x1ef3a7,null))[_0xda5b('0x17')](function(_0x82a4f){if(_0x82a4f){return _0x82a4f['removeDispositions'](_0x3da7a5[_0xda5b('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x1ef3a7,null))[_0xda5b('0x22')](handleError(_0x1ef3a7,null));};exports[_0xda5b('0x60')]=function(_0x1e8f95,_0x1120d5){if(_0x1e8f95[_0xda5b('0x5a')]['id']){delete _0x1e8f95[_0xda5b('0x5a')]['id'];}return db[_0xda5b('0x37')]['find']({'where':{'id':_0x1e8f95[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x1120d5,null))['then'](function(_0xef3105){if(_0xef3105){_0x1e8f95['body']['ChatWebsiteId']=_0xef3105['id'];return db[_0xda5b('0x61')][_0xda5b('0x53')](_0x1e8f95[_0xda5b('0x5a')]);}})[_0xda5b('0x17')](respondWithResult(_0x1120d5,null))['catch'](handleError(_0x1120d5,null));};exports[_0xda5b('0x62')]=function(_0x236694,_0x458bc1){var _0x4ba2aa={'raw':![],'where':{}};var _0x14b113={};var _0x398c17={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xda5b('0x5f')]({'where':{'id':_0x236694[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x458bc1,null))[_0xda5b('0x17')](function(_0x280df5){if(_0x280df5){_0x14b113[_0xda5b('0x3a')]=_[_0xda5b('0x3c')](db[_0xda5b('0x61')][_0xda5b('0x38')]);_0x14b113[_0xda5b('0x3b')]=_[_0xda5b('0x3c')](_0x236694['query']);_0x14b113[_0xda5b('0x3d')]=_[_0xda5b('0x3e')](_0x14b113[_0xda5b('0x3a')],_0x14b113[_0xda5b('0x3b')]);_0x4ba2aa[_0xda5b('0x3f')]=_['intersection'](_0x14b113[_0xda5b('0x3a')],qs[_0xda5b('0x40')](_0x236694[_0xda5b('0x3b')][_0xda5b('0x40')]));_0x4ba2aa['attributes']=_0x4ba2aa[_0xda5b('0x3f')]['length']?_0x4ba2aa[_0xda5b('0x3f')]:_0x14b113[_0xda5b('0x3a')];if(!_0x236694[_0xda5b('0x3b')]['hasOwnProperty'](_0xda5b('0x43'))){_0x4ba2aa[_0xda5b('0x27')]=qs['limit'](_0x236694[_0xda5b('0x3b')][_0xda5b('0x27')]);_0x4ba2aa[_0xda5b('0x29')]=qs['offset'](_0x236694['query']['offset']);}_0x4ba2aa[_0xda5b('0x44')]=qs[_0xda5b('0x45')](_0x236694[_0xda5b('0x3b')][_0xda5b('0x45')]);_0x4ba2aa['where']=qs[_0xda5b('0x3d')](_[_0xda5b('0x47')](_0x236694['query'],_0x14b113[_0xda5b('0x3d')]));_0x4ba2aa['where'][_0xda5b('0x5c')]=_0x280df5['id'];if(_0x236694[_0xda5b('0x3b')]['filter']){_0x4ba2aa['where']=_['merge'](_0x4ba2aa[_0xda5b('0x46')],{'$or':_['map'](_0x4ba2aa[_0xda5b('0x3f')],function(_0x46b016){var _0x1b26c6={};_0x1b26c6[_0x46b016]={'$like':'%'+_0x236694[_0xda5b('0x3b')][_0xda5b('0x48')]+'%'};return _0x1b26c6;})});}_0x4ba2aa=_['merge']({},_0x4ba2aa,_0x236694[_0xda5b('0x4b')]);return db['CannedAnswer']['count']({'where':_0x4ba2aa[_0xda5b('0x46')]})[_0xda5b('0x17')](function(_0x28be09){_0x398c17[_0xda5b('0x28')]=_0x28be09;if(_0x236694['query'][_0xda5b('0x4c')]){_0x4ba2aa[_0xda5b('0x4d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xda5b('0x4e')](_0x4ba2aa);})[_0xda5b('0x17')](function(_0xecd22e){_0x398c17[_0xda5b('0x4f')]=_0xecd22e;return _0x398c17;});}})[_0xda5b('0x17')](respondWithFilteredResult(_0x458bc1,_0x4ba2aa))[_0xda5b('0x22')](handleError(_0x458bc1,null));};exports['removeAnswers']=function(_0x883e5,_0x10a785){return db['ChatWebsite'][_0xda5b('0x52')]({'where':{'id':_0x883e5[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x10a785,null))['then'](function(_0x1a21d3){if(_0x1a21d3){return _0x1a21d3[_0xda5b('0x63')](_0x883e5[_0xda5b('0x3b')][_0xda5b('0x64')]);}})['then'](respondWithStatusCode(_0x10a785,null))[_0xda5b('0x22')](handleError(_0x10a785,null));};exports['addLogo']=function(_0x49ffc2,_0x223a1c){_0x49ffc2['body'][_0xda5b('0x65')]=_0x49ffc2['file'][_0xda5b('0x66')];return db['ChatWebsite'][_0xda5b('0x52')]({'where':{'id':_0x49ffc2[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x223a1c,null))[_0xda5b('0x17')](saveUpdates(_0x49ffc2[_0xda5b('0x5a')],null))[_0xda5b('0x17')](respondWithResult(_0x223a1c,null))[_0xda5b('0x22')](handleError(_0x223a1c,null));};exports[_0xda5b('0x67')]=function(_0x419035,_0x440e9c){_0x419035['body'][_0xda5b('0x68')]=_0x419035[_0xda5b('0x69')][_0xda5b('0x66')];return db[_0xda5b('0x37')][_0xda5b('0x52')]({'where':{'id':_0x419035[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x440e9c,null))[_0xda5b('0x17')](saveUpdates(_0x419035[_0xda5b('0x5a')],null))['then'](respondWithResult(_0x440e9c,null))['catch'](handleError(_0x440e9c,null));};exports[_0xda5b('0x6a')]=function(_0x2c74ad,_0x3ed773){_0x2c74ad['body']['customerAvatar']=_0x2c74ad['file'][_0xda5b('0x66')];return db[_0xda5b('0x37')][_0xda5b('0x52')]({'where':{'id':_0x2c74ad[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x3ed773,null))[_0xda5b('0x17')](saveUpdates(_0x2c74ad[_0xda5b('0x5a')],null))[_0xda5b('0x17')](respondWithResult(_0x3ed773,null))[_0xda5b('0x22')](handleError(_0x3ed773,null));};exports[_0xda5b('0x6b')]=function(_0x2abc9d,_0x4762c5){_0x2abc9d[_0xda5b('0x5a')]['systemAvatar']=_0x2abc9d[_0xda5b('0x69')][_0xda5b('0x66')];return db[_0xda5b('0x37')]['find']({'where':{'id':_0x2abc9d[_0xda5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x4762c5,null))[_0xda5b('0x17')](saveUpdates(_0x2abc9d[_0xda5b('0x5a')],null))[_0xda5b('0x17')](respondWithResult(_0x4762c5,null))[_0xda5b('0x22')](handleError(_0x4762c5,null));};exports[_0xda5b('0x6c')]=function(_0x1ffb6c,_0x3a3a9e){var _0x2da183=path[_0xda5b('0x6d')](config['root'],_0xda5b('0x6e'));var _0x10ea5b={'where':{'id':_0x1ffb6c[_0xda5b('0x50')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5ad9d0=![];return require(_0xda5b('0x6f'))[_0xda5b('0x70')]()[_0xda5b('0x17')](function(_0x32ef54){if(_0x32ef54){_0x5ad9d0=_0x32ef54['custom'];}})[_0xda5b('0x17')](function(){return db[_0xda5b('0x37')][_0xda5b('0x52')](_0x10ea5b);})[_0xda5b('0x17')](handleEntityNotFound(_0x3a3a9e,null))[_0xda5b('0x17')](function(_0x2dd33c){if(_0x2dd33c){if(!_[_0xda5b('0x71')](_0x2dd33c[_0xda5b('0x65')])){if(fs[_0xda5b('0x72')](path['join'](config[_0xda5b('0x73')],_0xda5b('0x74'),_0x2dd33c['sitepic']))&&_0x5ad9d0){_0x2da183=path[_0xda5b('0x6d')](config[_0xda5b('0x73')],_0xda5b('0x74'),_0x2dd33c['sitepic']);}}return _0x3a3a9e[_0xda5b('0x75')](_0x2da183);}})[_0xda5b('0x22')](handleError(_0x3a3a9e,null));};exports['getAvatar']=function(_0x113a3b,_0x47e4b3){var _0x5c032a=path['join'](config['root'],_0xda5b('0x76'));var _0x5e01c9={'where':{'id':_0x113a3b[_0xda5b('0x50')]['id']},'attributes':['id',_0xda5b('0x68')],'raw':!![]};return db[_0xda5b('0x37')][_0xda5b('0x52')](_0x5e01c9)[_0xda5b('0x17')](handleEntityNotFound(_0x47e4b3,null))['then'](function(_0x585fd3){if(_0x585fd3){if(!_[_0xda5b('0x71')](_0x585fd3[_0xda5b('0x68')])){if(fs[_0xda5b('0x72')](path[_0xda5b('0x6d')](config[_0xda5b('0x73')],_0xda5b('0x77'),_0x585fd3[_0xda5b('0x68')]))){_0x5c032a=path[_0xda5b('0x6d')](config[_0xda5b('0x73')],'server/files/images/avatars/',_0x585fd3[_0xda5b('0x68')]);}}return _0x47e4b3[_0xda5b('0x75')](_0x5c032a);}})[_0xda5b('0x22')](handleError(_0x47e4b3,null));};exports[_0xda5b('0x78')]=function(_0x229f86,_0x548885){var _0x5dca73=path[_0xda5b('0x6d')](config[_0xda5b('0x73')],_0xda5b('0x79'));var _0xd11b60={'where':{'id':_0x229f86[_0xda5b('0x50')]['id']},'attributes':['id','customerAvatar',_0xda5b('0x7a')],'raw':!![]};return db['ChatWebsite'][_0xda5b('0x52')](_0xd11b60)[_0xda5b('0x17')](handleEntityNotFound(_0x548885,null))[_0xda5b('0x17')](function(_0x35dfb1){if(_0x35dfb1){if(!_['isNil'](_0x35dfb1[_0xda5b('0x7b')])){if(fs['existsSync'](path['join'](config[_0xda5b('0x73')],'server/files/images/avatars/',_0x35dfb1[_0xda5b('0x7b')]))&&_0x35dfb1[_0xda5b('0x7a')]){_0x5dca73=path[_0xda5b('0x6d')](config[_0xda5b('0x73')],'server/files/images/avatars/',_0x35dfb1[_0xda5b('0x7b')]);}}return _0x548885[_0xda5b('0x75')](_0x5dca73);}})[_0xda5b('0x22')](handleError(_0x548885,null));};exports[_0xda5b('0x7c')]=function(_0x2a6eff,_0x5f3b94){var _0x153f45=path[_0xda5b('0x6d')](config[_0xda5b('0x73')],_0xda5b('0x7d'));var _0x30a283={'where':{'id':_0x2a6eff['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xda5b('0x37')][_0xda5b('0x52')](_0x30a283)['then'](handleEntityNotFound(_0x5f3b94,null))[_0xda5b('0x17')](function(_0x478916){if(_0x478916){if(!_['isNil'](_0x478916[_0xda5b('0x7e')])){if(fs[_0xda5b('0x72')](path['join'](config['root'],_0xda5b('0x77'),_0x478916[_0xda5b('0x7e')]))){_0x153f45=path['join'](config['root'],_0xda5b('0x77'),_0x478916[_0xda5b('0x7e')]);}}return _0x5f3b94[_0xda5b('0x75')](_0x153f45);}})[_0xda5b('0x22')](handleError(_0x5f3b94,null));};exports[_0xda5b('0x7f')]=function(_0x1c7504,_0x1531d6){var _0x434e22=require('user-agent-parser');var _0x179a44=new _0x434e22();var _0x93ad74=_0x179a44[_0xda5b('0x80')](_0x1c7504[_0xda5b('0x81')][_0xda5b('0x82')])[_0xda5b('0x83')]();var _0x1d05f6={'body':_0x1c7504[_0xda5b('0x5a')],'channel':_0xda5b('0x84')};var _0x4e629f=[];var _0x125192=[];var _0xcdf980={};var _0x38760e=![];return db[_0xda5b('0x85')][_0xda5b('0x5b')]()[_0xda5b('0x17')](function(_0xccc072){if(!_0xccc072){throw new db[(_0xda5b('0x86'))][(_0xda5b('0x87'))](_0xda5b('0x88'));}_0x4e629f=_[_0xda5b('0x89')](_[_0xda5b('0x3c')](_0xccc072),['createdAt',_0xda5b('0x8a')]);_0x125192=_[_0xda5b('0x89')](_['keys'](_0xccc072),[_0xda5b('0x8b'),_0xda5b('0x8a'),_0xda5b('0x8c'),'ListId']);if(_0x1c7504[_0xda5b('0x5a')]['id']){delete _0x1c7504[_0xda5b('0x5a')]['id'];}if(_[_0xda5b('0x71')](_0x1c7504['body'][_0xda5b('0x8d')])){throw new db['Sequelize']['ValidationError'](_0xda5b('0x8e'));}if(_[_0xda5b('0x71')](_0x1c7504['body'][_0xda5b('0x5a')])||_0x1c7504[_0xda5b('0x5a')]['body']===''){throw new db[(_0xda5b('0x86'))][(_0xda5b('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1c7504[_0xda5b('0x5a')]['mapKey'])){throw new db[(_0xda5b('0x86'))][(_0xda5b('0x87'))](_0xda5b('0x8f')+_0x125192);}if(!_['includes'](_0x125192,_0x1c7504[_0xda5b('0x5a')][_0xda5b('0x90')])){throw new db['Sequelize']['ValidationError'](_0xda5b('0x91')+_0x125192);}_0xcdf980[_0x1c7504[_0xda5b('0x5a')]['mapKey']]=_0x1c7504[_0xda5b('0x5a')][_0xda5b('0x8d')];})[_0xda5b('0x17')](function(){return db[_0xda5b('0x37')][_0xda5b('0x52')]({'where':{'id':_0x1c7504[_0xda5b('0x50')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xda5b('0x85')],'as':_0xda5b('0x92'),'where':_0xcdf980,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xda5b('0x93')],'as':_0xda5b('0x94')}]});})[_0xda5b('0x17')](handleEntityNotFound(_0x1531d6,null))[_0xda5b('0x17')](function(_0x34c0c1){if(_0x34c0c1&&_0x34c0c1['List']){_0x1d05f6['account']=_0x34c0c1;_0x1d05f6[_0xda5b('0x95')]=_0x34c0c1[_0xda5b('0x94')];_0x1d05f6['list']=_0x34c0c1[_0xda5b('0x96')];_0x1d05f6[_0xda5b('0x95')]=_['orderBy'](_0x1d05f6[_0xda5b('0x95')],[_0xda5b('0x97')],[_0xda5b('0x98')]);if(_0x1d05f6[_0xda5b('0x99')][_0xda5b('0x94')]){delete _0x1d05f6[_0xda5b('0x99')][_0xda5b('0x94')];}if(_0x1d05f6['account'][_0xda5b('0x96')]&&_0x1d05f6['account'][_0xda5b('0x96')][_0xda5b('0x92')][_0xda5b('0x41')]){return _0x1d05f6[_0xda5b('0x99')][_0xda5b('0x96')][_0xda5b('0x92')][0x0];}var _0x43af8=_[_0xda5b('0xe')](_0x1c7504[_0xda5b('0x5a')],{'firstName':_0x1c7504[_0xda5b('0x5a')][_0xda5b('0x8d')],'ListId':_0x34c0c1[_0xda5b('0x9a')]});_0x43af8[_0x1c7504['body']['mapKey']]=_0x1c7504[_0xda5b('0x5a')][_0xda5b('0x8d')];return db['CmContact']['create'](_0x43af8,{'fields':_0x4e629f,'raw':!![]});}})['then'](handleEntityNotFound(_0x1531d6,null))[_0xda5b('0x17')](function(_0x13e778){_0x1d05f6['contact']=_0x13e778;var _0x426b6e=_0x1c7504[_0xda5b('0x5a')][_0xda5b('0x9b')];if(_0x1c7504[_0xda5b('0x81')][_0xda5b('0x9c')]){_0x426b6e=_0x1c7504[_0xda5b('0x81')][_0xda5b('0x9c')];}else if(_0x1c7504['headers'][_0xda5b('0x9d')]){_0x426b6e=_[_0xda5b('0x9e')](_0x1c7504[_0xda5b('0x81')][_0xda5b('0x9d')]['split'](','));}if(_0x13e778){var _0x193ff1={'ContactId':_0x13e778['id'],'ChatWebsiteId':_0x1c7504[_0xda5b('0x50')]['id'],'from':(_0x13e778['firstName']||'')+'\x20'+(_0x13e778[_0xda5b('0x9f')]||''),'customerIp':_0x426b6e,'customerPort':_0x1c7504[_0xda5b('0x81')]['x-real-port']?_0x1c7504[_0xda5b('0x81')]['x-real-port']:null,'referer':_0x1c7504['body'][_0xda5b('0xa0')],'browserName':_0x93ad74['browser'][_0xda5b('0x33')]&&_0x93ad74[_0xda5b('0xa1')][_0xda5b('0xa2')]?util[_0xda5b('0xa3')](_0xda5b('0xa4'),_0x93ad74[_0xda5b('0xa1')][_0xda5b('0x33')],_0x93ad74[_0xda5b('0xa1')]['version']):'unknown','browserVersion':_0x93ad74[_0xda5b('0xa1')]['version']||_0xda5b('0xa5'),'osName':util[_0xda5b('0xa3')](_0xda5b('0xa4'),_0x93ad74['os']['name'],_0x93ad74['os'][_0xda5b('0xa2')]),'osVersion':_0x93ad74['os'][_0xda5b('0xa2')],'deviceModel':_0x93ad74[_0xda5b('0xa6')][_0xda5b('0x3a')]&&_0x93ad74[_0xda5b('0xa6')]['vendor']?util[_0xda5b('0xa3')](_0xda5b('0xa7'),_0x93ad74[_0xda5b('0xa6')]['model'],_0x93ad74['device']['vendor'],_0x93ad74[_0xda5b('0xa6')]['type']):null,'deviceVendor':_0x93ad74[_0xda5b('0xa6')][_0xda5b('0xa8')],'deviceType':_0x93ad74[_0xda5b('0xa6')][_0xda5b('0x39')],'formData':JSON[_0xda5b('0x1d')](_0x1c7504[_0xda5b('0x5a')])};var _0x11373a={'ChatWebsiteId':_0x1c7504[_0xda5b('0x50')]['id'],'closed':![]};if(_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xa9')]){_0x11373a['threadId']=_0x1c7504['body']['threadId'];return db['ChatInteraction'][_0xda5b('0x52')]({'where':_0x11373a})[_0xda5b('0x17')](function(_0x260125){if(_0x260125){return[_0x260125,![]];}_0x193ff1[_0xda5b('0xa9')]=_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xa9')];_0x193ff1['externalUrl']=_0x1c7504['body']['externalUrl'];return db[_0xda5b('0xaa')][_0xda5b('0x53')](_0x193ff1)[_0xda5b('0x17')](function(_0x216f27){return[_0x216f27,!![]];});});}_0x11373a[_0xda5b('0xab')]=_0x13e778['id'];if(_0x1c7504[_0xda5b('0x5a')]['interaction']&&_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xac')]['id']){_0x11373a['id']=_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xac')]['id'];return db[_0xda5b('0xaa')]['find']({'where':_0x11373a})[_0xda5b('0x17')](function(_0x3fb8c5){if(_0x3fb8c5){return[_0x3fb8c5,![]];}return db[_0xda5b('0xaa')][_0xda5b('0x53')](_0x193ff1)['then'](function(_0x4e4f07){return[_0x4e4f07,!![]];});});}return db[_0xda5b('0xaa')][_0xda5b('0x53')](_0x193ff1)[_0xda5b('0x17')](function(_0xd923f0){return[_0xd923f0,!![]];});}})[_0xda5b('0xad')](function(_0x49e26a,_0x236658){if(_0x49e26a){_0x38760e=_0x236658;if(!_0x236658){var _0x3cf4c8={'from':(_0x1d05f6[_0xda5b('0xae')][_0xda5b('0xaf')]||'')+'\x20'+(_0x1d05f6[_0xda5b('0xae')][_0xda5b('0x9f')]||'')};if(_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xa9')]&&_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xb0')]&&_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xa9')]!=_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xb0')]){_0x3cf4c8[_0xda5b('0xa9')]=_0x1c7504[_0xda5b('0x5a')][_0xda5b('0xb0')];}return _0x49e26a[_0xda5b('0x2c')](_0x3cf4c8);}else{return _0x49e26a;}}})['then'](function(_0x1747da){_0x1d05f6['interaction']=_0x1747da[_0xda5b('0x2d')]({'plain':!![]});_0x1d05f6[_0xda5b('0xac')][_0xda5b('0xb1')]=_0x38760e;if(_0x1d05f6[_0xda5b('0xac')][_0xda5b('0xb1')]){if(_0x1d05f6[_0xda5b('0x99')]['autoclose']){_0x1d05f6['applications']['push']({'id':0x0,'priority':_0x1d05f6['applications'][_0xda5b('0x41')]+0x1,'app':_0xda5b('0xb2'),'appdata':'unmanaged','interval':_0xda5b('0xb3')});}}return db[_0xda5b('0xb4')][_0xda5b('0x53')]({'body':_0x1c7504[_0xda5b('0x5a')][_0xda5b('0x5a')],'ChatWebsiteId':_0x1c7504[_0xda5b('0x50')]['id'],'ChatInteractionId':_0x1747da['id'],'direction':'in','ContactId':_0x1d05f6[_0xda5b('0xae')]['id'],'AttachmentId':_0x1c7504[_0xda5b('0x5a')]['AttachmentId']});})[_0xda5b('0x17')](function(_0x551420){_0x1d05f6['message']=_0x551420;if(_0x1d05f6[_0xda5b('0xac')][_0xda5b('0xb5')]){return db[_0xda5b('0xb6')][_0xda5b('0x52')]({'attributes':['id',_0xda5b('0x33')],'where':{'id':_0x1d05f6[_0xda5b('0xac')][_0xda5b('0xb5')]}})[_0xda5b('0x17')](function(_0x1c5617){if(_0x1c5617){_0x1d05f6[_0xda5b('0x95')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1c5617[_0xda5b('0x33')]+','+(_0x1d05f6[_0xda5b('0x99')][_0xda5b('0xb7')]||0xa),'interval':_0xda5b('0xb3')});_0x1d05f6[_0xda5b('0xb8')]=!![];}return respondWithRpcPromise(_0xda5b('0xb9'),'startRouting',_0x1d05f6);});}return respondWithRpcPromise(_0xda5b('0xb9'),'startRouting',_0x1d05f6);})[_0xda5b('0x17')](function(_0x7b6567){respondWithRpcPromise(_0xda5b('0xba'),'EventManager',{'event':_0xda5b('0x7f'),'message':_0x7b6567},client9002);return _0x7b6567;})[_0xda5b('0x17')](respondWithResult(_0x1531d6,null))[_0xda5b('0x22')](handleError(_0x1531d6,null));};exports[_0xda5b('0xbb')]=function(_0x703819,_0x579e69){var _0x56ab88,_0x3c61b1,_0x2f65b3;var _0xc4124a=[];var _0x3e973f={};var _0x3bd5b8=_0x703819[_0xda5b('0xbc')]||[];var _0x22dce8=[];var _0x525a8f;return db[_0xda5b('0x85')][_0xda5b('0x5b')]()[_0xda5b('0x17')](function(_0x28a677){if(!_0x28a677){throw new db[(_0xda5b('0x86'))][(_0xda5b('0x87'))](_0xda5b('0x88'));}_0xc4124a=_['difference'](_['keys'](_0x28a677),[_0xda5b('0x8b'),_0xda5b('0x8a'),_0xda5b('0x8c'),'ListId']);if(_0x703819[_0xda5b('0x5a')]['id']){delete _0x703819[_0xda5b('0x5a')]['id'];}if(_[_0xda5b('0x71')](_0x703819[_0xda5b('0x5a')]['from'])){throw _0x579e69[_0xda5b('0x23')](0x1f4)[_0xda5b('0xbd')](new db['Sequelize'][(_0xda5b('0x87'))]('from\x20is\x20mandatory'));}if(_[_0xda5b('0x71')](_0x703819['body']['body'])||_0x703819[_0xda5b('0x5a')][_0xda5b('0x5a')]===''){throw _0x579e69['status'](0x1f4)[_0xda5b('0xbd')](new db[(_0xda5b('0x86'))][(_0xda5b('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xda5b('0x71')](_0x703819['body'][_0xda5b('0xbe')])){throw _0x579e69[_0xda5b('0x23')](0x1f4)[_0xda5b('0xbd')](new db[(_0xda5b('0x86'))]['ValidationError'](_0xda5b('0xbf')+_0xc4124a));}if(!_[_0xda5b('0xc0')](_0xc4124a,_0x703819[_0xda5b('0x5a')]['mapKeyOffline'])){throw _0x579e69[_0xda5b('0x23')](0x1f4)[_0xda5b('0xbd')](new db[(_0xda5b('0x86'))][(_0xda5b('0x87'))](_0xda5b('0xc1')+_0xc4124a));}_0x3e973f[_0x703819[_0xda5b('0x5a')][_0xda5b('0xbe')]]=_0x703819[_0xda5b('0x5a')]['from'];})[_0xda5b('0x17')](function(){return db['ChatWebsite'][_0xda5b('0x52')]({'where':{'id':_0x703819[_0xda5b('0x50')]['id']},'include':[{'model':db[_0xda5b('0xc2')],'as':_0xda5b('0x96')},{'model':db[_0xda5b('0xc3')],'as':_0xda5b('0xc3')}]});})[_0xda5b('0x17')](handleEntityNotFound(_0x579e69,null))[_0xda5b('0x17')](function(_0x60d0ae){if(_0x60d0ae&&_0x60d0ae[_0xda5b('0x96')]){_0x3c61b1=_0x60d0ae;var _0x3dc689=_[_0xda5b('0xe')](_0x703819[_0xda5b('0x5a')],{'firstName':_0x703819[_0xda5b('0x5a')][_0xda5b('0x8d')],'phone':_0x703819[_0xda5b('0x5a')]['from'],'ListId':_0x60d0ae[_0xda5b('0x9a')]});_0x3dc689[_0x703819['body']['mapKeyOffline']]=_0x703819[_0xda5b('0x5a')][_0xda5b('0x8d')];return db[_0xda5b('0x85')][_0xda5b('0xc4')]({'where':_0x3e973f,'defaults':_0x3dc689});}})[_0xda5b('0xad')](function(_0x1e54ba){if(_0x1e54ba){_0x2f65b3=_0x1e54ba;var _0x6eb1d7=fs[_0xda5b('0xc5')](path[_0xda5b('0x6d')](config['root'],_0xda5b('0xc6')),'utf8');var _0x3946b6=ejs[_0xda5b('0xc7')](_0x6eb1d7,{'body':_[_0xda5b('0xc8')](_0x703819['body'][_0xda5b('0x5a')]),'bodyTitle':_0x3c61b1[_0xda5b('0xc9')]});return db[_0xda5b('0xca')]['create']({'body':_0x3946b6,'plainBody':htmlToText[_0xda5b('0xcb')](_0x3946b6),'ContactId':_0x1e54ba['id'],'ChatWebsiteId':_0x3c61b1['id']});}})[_0xda5b('0x17')](function(_0xd4874a){_0x525a8f=_0xd4874a;if(_0x3bd5b8[_0xda5b('0x41')]){var _0x283a3d=_0x3bd5b8[_0xda5b('0x36')](function(_0x5e1e5f){return{'name':_0x5e1e5f[_0xda5b('0xcc')],'basename':_0x5e1e5f['filename'],'type':_0x5e1e5f['mimetype'],'ChatOfflineMessageId':_0xd4874a['id']};});_0x22dce8=_0x283a3d['map'](_0x4c2206=>{var _0x1411e1={'filename':_0x4c2206[_0xda5b('0x33')],'path':path['join'](config[_0xda5b('0x73')],_0xda5b('0xcd'),_0xda5b('0xbc'),_0xda5b('0xce'),_0xda5b('0xcf'),_0x4c2206['basename'])};return _0x1411e1;});if(!_0x3c61b1[_0xda5b('0xd0')]){return db[_0xda5b('0xd1')][_0xda5b('0xd2')](function(_0x558a03){return db[_0xda5b('0xd3')]['bulkCreate'](_0x283a3d,{'transaction':_0x558a03});});}}})[_0xda5b('0x17')](function(){if(_0x525a8f){_0x56ab88=_0x525a8f;return db[_0xda5b('0xc3')][_0xda5b('0x5f')]({'where':{'service':!![]},'include':[{'model':db[_0xda5b('0xd4')],'as':_0xda5b('0xd5'),'raw':!![],'include':[{'model':db[_0xda5b('0xd6')],'as':_0xda5b('0xd6'),'raw':!![]}]}]});}})[_0xda5b('0x17')](function(_0x398877){if(_0x398877&&_0x398877['Smtp']&&_0x3c61b1[_0xda5b('0xd7')]&&_0x3c61b1[_0xda5b('0xd8')]){var _0x57ca23=_0x398877[_0xda5b('0xd9')]();return respondWithRpcPromise(_0xda5b('0xda'),_0xda5b('0xdb'),{'account':_0x57ca23,'message':{'from':util[_0xda5b('0xa3')](_0xda5b('0xdc'),_0x398877['name'],_0x398877[_0xda5b('0xdd')]||_0x398877[_0xda5b('0xd5')][_0xda5b('0x54')]),'to':_0x3c61b1['forwardOfflineAddress'],'subject':_0x3c61b1[_0xda5b('0xde')],'html':_0x56ab88[_0xda5b('0x5a')],'attachments':_0x22dce8}},client9003)['then'](function(){return _0x56ab88;})[_0xda5b('0x22')](function(_0x40b5ba){logger[_0xda5b('0x1e')](_0x40b5ba);});}})[_0xda5b('0x17')](function(){if(_0x3c61b1&&_0x3c61b1[_0xda5b('0xd0')]&&_0x3c61b1[_0xda5b('0xdf')]){var _0x46015d=[];if(_0x3bd5b8[_0xda5b('0x41')]){_0x46015d=_0x3bd5b8['map'](function(_0x57251f){return{'name':_0x57251f[_0xda5b('0xcc')],'basename':_0x57251f[_0xda5b('0x66')],'type':_0x57251f[_0xda5b('0xe0')],'ChatOfflineMessageId':_0x525a8f['id']};});}var _0x3d8b98;if(!_[_0xda5b('0x71')](_0x3c61b1[_0xda5b('0xe1')])){var _0x26b515=_[_0xda5b('0x36')](_0x703819['body'],function(_0x16658f){return _0x16658f;});var _0x403ad2=_[_0xda5b('0xe2')](_0x26b515)[0x0];var _0x4dbba3=_[_0xda5b('0xe3')](_0x403ad2,function(_0x5e74fd){return _0x5e74fd;});_0x3d8b98=_0x4dbba3[0x1][_0x3c61b1['subjectOffline']];}var _0x274b15={'from':_0x2f65b3[_0xda5b('0xdd')],'firstName':_0x2f65b3[_0xda5b('0xaf')],'lastName':_0x2f65b3[_0xda5b('0x9f')],'mapKey':'email','message':{'from':_0x2f65b3[_0xda5b('0xdd')],'to':_0x3c61b1[_0xda5b('0xc3')][_0xda5b('0xdd')],'cc':'','subject':_[_0xda5b('0x71')](_0x3d8b98)?_0x3c61b1[_0xda5b('0xde')]:_0x3d8b98,'messageId':'','sentAt':new Date(),'attach':_0x46015d[_0xda5b('0x41')],'attachments':_0x46015d,'originChannel':_0xda5b('0xe4'),'ChatWebsiteId':_0x3c61b1['id'],'ChatOfflineMessageId':_0x56ab88['id'],'originTo':_0x3c61b1[_0xda5b('0xc3')][_0xda5b('0xdd')]},'body':_0x56ab88[_0xda5b('0x5a')]};var _0xa126d3={'account':{'id':_0x3c61b1['MailAccountId']},'body':_0x274b15,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xda5b('0xe5'),_0xda5b('0xe6'),_0xa126d3,client9001)[_0xda5b('0x17')](function(){return _0x56ab88;})['catch'](function(_0x580bb2){logger['error'](_0x580bb2);});}return;})[_0xda5b('0x17')](function(){if(_0x56ab88){return _0x56ab88;}})[_0xda5b('0x17')](respondWithResult(_0x579e69,null))[_0xda5b('0x22')](function(_0x15c016){logger[_0xda5b('0x1e')]('catch',_0x15c016);for(var _0x4d9891 of _0x3bd5b8){var _0x1f2001=path[_0xda5b('0x6d')](config[_0xda5b('0x73')],_0xda5b('0xcd'),_0xda5b('0xbc'),_0xda5b('0xce'),_0xda5b('0xcf'),_0x4d9891[_0xda5b('0x66')]);fs_extra[_0xda5b('0xe7')](_0x1f2001)[_0xda5b('0x22')](function(_0x5858d7){logger['error'](_0xda5b('0xe8'),_0x1f2001,_0x5858d7);});}});};exports[_0xda5b('0xe9')]=function(_0x2a872f,_0x1951e2){return db[_0xda5b('0xaa')][_0xda5b('0x52')]({'where':{'id':_0x2a872f['params']['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x1951e2,null))[_0xda5b('0x17')](function(_0xade4ef){if(_0xade4ef){return _0xade4ef[_0xda5b('0xe9')](_0x2a872f[_0xda5b('0x5a')][_0xda5b('0x64')],_[_0xda5b('0xea')](_0x2a872f['body'],[_0xda5b('0x64'),'id'])||{});}})[_0xda5b('0x17')](respondWithResult(_0x1951e2,null))[_0xda5b('0x22')](handleError(_0x1951e2,null));};exports[_0xda5b('0xeb')]=function(_0x88ff27,_0x106f6a){var _0x1f3203={'raw':![],'where':{}};var _0x3cbf66={};var _0x50ab6e={'count':0x0,'rows':[]};return db[_0xda5b('0x37')][_0xda5b('0x5f')]({'where':{'id':_0x88ff27[_0xda5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x106f6a,null))['then'](function(_0x3c4d36){if(_0x3c4d36){_0x3cbf66[_0xda5b('0x3a')]=_[_0xda5b('0x3c')](db['ChatInteraction'][_0xda5b('0x38')]);_0x3cbf66[_0xda5b('0x3b')]=_[_0xda5b('0x3c')](_0x88ff27['query']);_0x3cbf66[_0xda5b('0x3d')]=_[_0xda5b('0x3e')](_0x3cbf66[_0xda5b('0x3a')],_0x3cbf66[_0xda5b('0x3b')]);_0x1f3203['attributes']=_[_0xda5b('0x3e')](_0x3cbf66[_0xda5b('0x3a')],qs['fields'](_0x88ff27[_0xda5b('0x3b')][_0xda5b('0x40')]));_0x1f3203[_0xda5b('0x3f')]=_0x1f3203[_0xda5b('0x3f')][_0xda5b('0x41')]?_0x1f3203['attributes']:_0x3cbf66[_0xda5b('0x3a')];if(!_0x88ff27[_0xda5b('0x3b')][_0xda5b('0x42')]('nolimit')){_0x1f3203['limit']=qs[_0xda5b('0x27')](_0x88ff27[_0xda5b('0x3b')]['limit']);_0x1f3203[_0xda5b('0x29')]=qs[_0xda5b('0x29')](_0x88ff27[_0xda5b('0x3b')][_0xda5b('0x29')]);}_0x1f3203['order']=qs[_0xda5b('0x45')](_0x88ff27['query']['sort']);_0x1f3203['where']=qs[_0xda5b('0x3d')](_['pick'](_0x88ff27['query'],_0x3cbf66[_0xda5b('0x3d')]));_0x1f3203[_0xda5b('0x46')][_0xda5b('0x5c')]=_0x3c4d36['id'];if(_0x88ff27[_0xda5b('0x3b')][_0xda5b('0x48')]){_0x1f3203[_0xda5b('0x46')]=_[_0xda5b('0x49')](_0x1f3203[_0xda5b('0x46')],{'$or':_[_0xda5b('0x36')](_0x1f3203[_0xda5b('0x3f')],function(_0x2692c8){var _0x208695={};_0x208695[_0x2692c8]={'$like':'%'+_0x88ff27[_0xda5b('0x3b')][_0xda5b('0x48')]+'%'};return _0x208695;})});}_0x1f3203=_[_0xda5b('0x49')]({},_0x1f3203,_0x88ff27['options']);return db[_0xda5b('0xaa')]['count']({'where':_0x1f3203['where']})[_0xda5b('0x17')](function(_0x326afd){_0x50ab6e[_0xda5b('0x28')]=_0x326afd;if(_0x88ff27[_0xda5b('0x3b')][_0xda5b('0x4c')]){_0x1f3203[_0xda5b('0x4d')]=[{'model':db[_0xda5b('0x85')],'as':_0xda5b('0xec'),'required':![]},{'model':db[_0xda5b('0xb6')],'as':_0xda5b('0xed'),'attributes':[_0xda5b('0x33'),_0xda5b('0xee'),_0xda5b('0xef')],'required':![]},{'model':db[_0xda5b('0xf0')],'as':'Tags','attributes':['id',_0xda5b('0x33'),'color'],'where':_0x88ff27[_0xda5b('0x3b')]['tag']?{'id':_0x88ff27[_0xda5b('0x3b')][_0xda5b('0xf1')]}:undefined,'required':_0x88ff27[_0xda5b('0x3b')][_0xda5b('0xf1')]?!![]:![]}];}return db[_0xda5b('0xaa')][_0xda5b('0x4e')](_0x1f3203);})[_0xda5b('0x17')](function(_0x7c687a){_0x50ab6e['rows']=_0x7c687a;return _0x50ab6e;});}})[_0xda5b('0x17')](respondWithFilteredResult(_0x106f6a,_0x1f3203))[_0xda5b('0x22')](handleError(_0x106f6a,null));};function iftimePromise(_0x542b1b,_0x51b6ce){return respondWithRpcPromise(_0xda5b('0xf2'),_0xda5b('0xf3'),{'command':_0x51b6ce[_0xda5b('0xf4')]?util[_0xda5b('0xa3')](_0xda5b('0xf5'),_0x542b1b['interval'],_0x51b6ce['timezone']):util[_0xda5b('0xa3')](_0xda5b('0xf6'),_0x542b1b[_0xda5b('0xf7')])},client9002)[_0xda5b('0x17')](function(_0x5b15e6){var _0x1a2ac4=_0x5b15e6&&_0x5b15e6[_0xda5b('0xf8')](_0xda5b('0xf9'))>=0x0?!![]:![];logger[_0xda5b('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x51b6ce['id'],_0x542b1b['id'],_0x542b1b[_0xda5b('0xf7')],_0x1a2ac4?_0xda5b('0xfa'):'OFFLINE',_0x51b6ce[_0xda5b('0xf4')]?_0x51b6ce['timezone']:_0xda5b('0xfb'));return _0x1a2ac4;})['catch'](function(_0x49c474){logger[_0xda5b('0x1e')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x51b6ce['id'],_0x542b1b['id'],_0x542b1b['interval'],util[_0xda5b('0xfc')](_0x49c474,{'showHidden':![],'depth':null}),_0x51b6ce[_0xda5b('0xf4')]?_0x51b6ce[_0xda5b('0xf4')]:_0xda5b('0xfb'));return![];});}exports['getSnippet']=function(_0xe3d2f9,_0x5328c0){var _0x4cc623=0x0;var _0x5a2df3=0x0;var _0x362611=![];var _0x18463a;var _0x3b2370;return db[_0xda5b('0x37')][_0xda5b('0x52')]({'where':{'id':_0xe3d2f9['params']['id']},'include':[{'model':db['Interval'],'as':_0xda5b('0xfd'),'include':[{'model':db[_0xda5b('0xfd')],'as':_0xda5b('0xfe'),'attributes':['id',_0xda5b('0xf7')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5328c0,null))[_0xda5b('0x17')](function(_0x5f0c4d){if(_0x5f0c4d){_0x18463a=_0x5f0c4d;return _0x5f0c4d[_0xda5b('0xff')]({'raw':!![]});}})[_0xda5b('0x17')](function(_0x3c6db7){if(_0x18463a){if(_0x3c6db7){_0x3b2370=_0x3c6db7;}}return require('../../config/license/util')[_0xda5b('0x70')]();})[_0xda5b('0x17')](function(_0x4a4105){if(_0x4a4105){_0x5a2df3=_0x4a4105[_0xda5b('0x100')];_0x362611=_0x4a4105[_0xda5b('0x101')];}})[_0xda5b('0x17')](function(){return db['ChatInteraction'][_0xda5b('0x28')]({'where':{'closed':![]}});})[_0xda5b('0x17')](function(_0x169187){_0x4cc623=_0x169187;if(_0x5a2df3&&_0x169187>_0x5a2df3){return db[_0xda5b('0x102')][_0xda5b('0x5f')]({'where':{'id':0x1}})[_0xda5b('0x17')](function(_0x113067){if(_0x113067){_0x113067[_0xda5b('0x103')](_0xda5b('0x104'));}});}})[_0xda5b('0x17')](function(){if(_0x18463a[_0xda5b('0xfd')]&&_0x18463a[_0xda5b('0xfd')][_0xda5b('0xfe')]){var _0x1505bb=[];for(var _0x2fed12=0x0;_0x2fed12<_0x18463a[_0xda5b('0xfd')][_0xda5b('0xfe')][_0xda5b('0x41')];_0x2fed12++){var _0x617547=_0x18463a[_0xda5b('0xfd')][_0xda5b('0xfe')][_0x2fed12]['get']({'plain':!![]});_0x1505bb[_0xda5b('0x105')](iftimePromise(_0x617547,_0x18463a));}return BPromise[_0xda5b('0x106')](_0x1505bb)['then'](function(_0x4df356){return _[_0xda5b('0x107')](_0x4df356);});}else{return!![];}})['then'](function(_0x589985){var _0x21c6e9=fs[_0xda5b('0xc5')](path[_0xda5b('0x6d')](config['root'],_0xda5b('0x108')),_0xda5b('0x109'));var _0x24c851=new url[(_0xda5b('0x10a'))](_0x18463a['address'])[_0xda5b('0x10b')];var _0x3ec626=_0xda5b('0x10c');var _0x51ce80=![];var _0x40af26={'chatVersion':_0x3ec626,'chatWebsiteAddressOrigin':_0x24c851,'remote':_0x18463a[_0xda5b('0x10d')],'query':querystring[_0xda5b('0x1d')](_['merge'](_0x18463a[_0xda5b('0x2d')]({'plain':!![]}),{'customerIp':_0xe3d2f9[_0xda5b('0x81')][_0xda5b('0x9d')]||_0xe3d2f9[_0xda5b('0x81')][_0xda5b('0x10e')]||_0xe3d2f9['connection'][_0xda5b('0x10f')]||_0xe3d2f9['ip'],'referer':_0xe3d2f9[_0xda5b('0x81')][_0xda5b('0xa0')],'openedInteractions':_0x4cc623,'maxInteractions':_0x5a2df3,'virtual':_0x362611[_0xda5b('0x100')],'online':_0x589985,'custom':_0x362611}))[_0xda5b('0x110')](/'/g,'\x5c\x27')};_0x5328c0[_0xda5b('0xbd')](ejs[_0xda5b('0xc7')](Mustache['render'](_0x21c6e9,_0x40af26),{'proactiveActions':_0x3b2370,'alignment':_0x18463a['alignment'],'verticalAlignment':_0x18463a[_0xda5b('0x111')],'div_color':_0x18463a[_0xda5b('0x112')],'labelText':_0x18463a['labelText'],'text_color':_0x18463a[_0xda5b('0x113')],'text_button_color':_0x18463a[_0xda5b('0x114')],'button_color':_0x18463a[_0xda5b('0x115')],'background_color':_0x18463a[_0xda5b('0x116')],'hideWhenOffline':_0x18463a[_0xda5b('0x117')],'intervalId':_0x18463a['IntervalId'],'isDevelopment':_0x51ce80,'chatVersion':_0x3ec626}));})[_0xda5b('0x22')](handleError(_0x5328c0,null));};exports[_0xda5b('0x118')]=function(_0x25810e,_0x294bdb){var _0x3c1a00=_0x25810e[_0xda5b('0x50')]['id'];var _0x214e8=_0x25810e['body'];var _0x52007a=0xc8;var _0x1ed5cd=null;return db[_0xda5b('0xd1')]['transaction']({'isolationLevel':db[_0xda5b('0xd1')][_0xda5b('0x119')][_0xda5b('0x11a')][_0xda5b('0x11b')]},function(_0x2f37a7){return db[_0xda5b('0x37')]['findOne']({'where':{'id':_0x3c1a00},'transaction':_0x2f37a7})['then'](function(_0x596f4a){if(_0x596f4a){return db[_0xda5b('0x93')][_0xda5b('0x30')]({'where':{'ChatWebsiteId':_0x3c1a00},'transaction':_0x2f37a7})[_0xda5b('0x17')](function(){var _0xb9f40e=_[_0xda5b('0x36')](_0x214e8,function(_0x510dff){_0x510dff['ChatWebsiteId']=_0x3c1a00;return _0x510dff;});return db['ChatApplication']['bulkCreate'](_0xb9f40e,{'transaction':_0x2f37a7});});}else{_0x52007a=0x194;_0x1ed5cd=[];}});})[_0xda5b('0x17')](function(){if(_0x52007a!==0x194){return db[_0xda5b('0x93')][_0xda5b('0x11c')]({'where':{'ChatWebsiteId':_0x3c1a00},'order':_0xda5b('0x97')})[_0xda5b('0x17')](function(_0x1384ed){_0x1ed5cd=_0x1384ed;});}})[_0xda5b('0x22')](function(_0x53934a){_0x52007a=0x1f4;logger[_0xda5b('0x1e')](_0x53934a[_0xda5b('0x32')]);if(_0x53934a[_0xda5b('0x33')]){delete _0x53934a[_0xda5b('0x33')];}_0x1ed5cd=_0x53934a;})[_0xda5b('0x11d')](function(){if(_0x1ed5cd===null){_0x294bdb[_0xda5b('0x31')](_0x52007a);}else{if(_0x52007a===0x1f4){_0x294bdb[_0xda5b('0x23')](_0x52007a)[_0xda5b('0xbd')](_0x1ed5cd);}else{_0x294bdb[_0xda5b('0x23')](_0x52007a)['json'](_0x1ed5cd);}}});};exports[_0xda5b('0x11e')]=function(_0x1ba22f,_0x5629b5){var _0xd568d5={};var _0x406d03={};var _0x32b2d2;var _0x20e271;return db['ChatWebsite']['findOne']({'where':{'id':_0x1ba22f['params']['id']}})['then'](handleEntityNotFound(_0x5629b5,null))[_0xda5b('0x17')](function(_0x5c9f55){if(_0x5c9f55){_0x32b2d2=_0x5c9f55;_0x406d03[_0xda5b('0x3a')]=_[_0xda5b('0x3c')](db[_0xda5b('0x93')][_0xda5b('0x38')]);_0x406d03[_0xda5b('0x3b')]=_['keys'](_0x1ba22f[_0xda5b('0x3b')]);_0x406d03[_0xda5b('0x3d')]=_[_0xda5b('0x3e')](_0x406d03[_0xda5b('0x3a')],_0x406d03[_0xda5b('0x3b')]);_0xd568d5[_0xda5b('0x3f')]=_['intersection'](_0x406d03['model'],qs[_0xda5b('0x40')](_0x1ba22f['query'][_0xda5b('0x40')]));_0xd568d5['attributes']=_0xd568d5[_0xda5b('0x3f')][_0xda5b('0x41')]?_0xd568d5[_0xda5b('0x3f')]:_0x406d03[_0xda5b('0x3a')];_0xd568d5[_0xda5b('0x44')]=qs['sort'](_0x1ba22f[_0xda5b('0x3b')][_0xda5b('0x45')]);_0xd568d5[_0xda5b('0x46')]=qs[_0xda5b('0x3d')](_[_0xda5b('0x47')](_0x1ba22f[_0xda5b('0x3b')],_0x406d03[_0xda5b('0x3d')]));if(_0x1ba22f['query'][_0xda5b('0x48')]){_0xd568d5['where']=_[_0xda5b('0x49')](_0xd568d5[_0xda5b('0x46')],{'$or':_[_0xda5b('0x36')](_0xd568d5['attributes'],function(_0x3763a2){var _0x4ae58a={};_0x4ae58a[_0x3763a2]={'$like':'%'+_0x1ba22f[_0xda5b('0x3b')][_0xda5b('0x48')]+'%'};return _0x4ae58a;})});}_0xd568d5=_[_0xda5b('0x49')]({},_0xd568d5,_0x1ba22f[_0xda5b('0x4b')]);return _0x32b2d2[_0xda5b('0x11e')](_0xd568d5);}})[_0xda5b('0x17')](function(_0x196fb6){if(_0x196fb6){_0x20e271=_0x196fb6[_0xda5b('0x41')];if(!_0x1ba22f[_0xda5b('0x3b')][_0xda5b('0x42')](_0xda5b('0x43'))){_0xd568d5[_0xda5b('0x27')]=qs['limit'](_0x1ba22f[_0xda5b('0x3b')][_0xda5b('0x27')]);_0xd568d5['offset']=qs['offset'](_0x1ba22f['query'][_0xda5b('0x29')]);}return _0x32b2d2['getApplications'](_0xd568d5);}})[_0xda5b('0x17')](function(_0x3ba7bb){if(_0x3ba7bb){return _0x3ba7bb?{'count':_0x20e271,'rows':_0x3ba7bb}:null;}})[_0xda5b('0x17')](respondWithResult(_0x5629b5,null))['catch'](handleError(_0x5629b5,null));};exports[_0xda5b('0x11f')]=function(_0x37e58f,_0x30a346){return db[_0xda5b('0x120')]['find']({'where':{'id':_0x37e58f['params']['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x30a346,null))['then'](function(_0x4cf265){if(_0x4cf265){return _0x4cf265[_0xda5b('0x11f')](_0x37e58f[_0xda5b('0x5a')][_0xda5b('0x64')],_[_0xda5b('0xea')](_0x37e58f[_0xda5b('0x5a')],[_0xda5b('0x64'),'id'])||{});}})[_0xda5b('0x17')](respondWithResult(_0x30a346,null))['catch'](handleError(_0x30a346,null));};exports[_0xda5b('0xff')]=function(_0x2331cb,_0x1e04d7){var _0x5a8913={};var _0x492b5f={};var _0x5c316d;var _0x98c4f1;return db[_0xda5b('0x37')][_0xda5b('0x5f')]({'where':{'id':_0x2331cb[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x1e04d7,null))[_0xda5b('0x17')](function(_0x1971b2){if(_0x1971b2){_0x5c316d=_0x1971b2;_0x492b5f[_0xda5b('0x3a')]=_[_0xda5b('0x3c')](db[_0xda5b('0x121')][_0xda5b('0x38')]);_0x492b5f[_0xda5b('0x3b')]=_[_0xda5b('0x3c')](_0x2331cb[_0xda5b('0x3b')]);_0x492b5f['filters']=_['intersection'](_0x492b5f[_0xda5b('0x3a')],_0x492b5f[_0xda5b('0x3b')]);_0x5a8913[_0xda5b('0x3f')]=_[_0xda5b('0x3e')](_0x492b5f[_0xda5b('0x3a')],qs[_0xda5b('0x40')](_0x2331cb[_0xda5b('0x3b')][_0xda5b('0x40')]));_0x5a8913[_0xda5b('0x3f')]=_0x5a8913[_0xda5b('0x3f')][_0xda5b('0x41')]?_0x5a8913['attributes']:_0x492b5f[_0xda5b('0x3a')];_0x5a8913[_0xda5b('0x44')]=qs[_0xda5b('0x45')](_0x2331cb[_0xda5b('0x3b')][_0xda5b('0x45')]);_0x5a8913[_0xda5b('0x46')]=qs[_0xda5b('0x3d')](_[_0xda5b('0x47')](_0x2331cb['query'],_0x492b5f['filters']));if(_0x2331cb[_0xda5b('0x3b')][_0xda5b('0x48')]){_0x5a8913[_0xda5b('0x46')]=_['merge'](_0x5a8913[_0xda5b('0x46')],{'$or':_[_0xda5b('0x36')](_0x5a8913[_0xda5b('0x3f')],function(_0x1812a6){var _0x3636ae={};_0x3636ae[_0x1812a6]={'$like':'%'+_0x2331cb[_0xda5b('0x3b')][_0xda5b('0x48')]+'%'};return _0x3636ae;})});}_0x5a8913=_[_0xda5b('0x49')]({},_0x5a8913,_0x2331cb[_0xda5b('0x4b')]);return _0x5c316d[_0xda5b('0xff')](_0x5a8913);}})[_0xda5b('0x17')](function(_0xd55e05){if(_0xd55e05){_0x98c4f1=_0xd55e05[_0xda5b('0x41')];if(!_0x2331cb[_0xda5b('0x3b')][_0xda5b('0x42')](_0xda5b('0x43'))){_0x5a8913[_0xda5b('0x27')]=qs['limit'](_0x2331cb[_0xda5b('0x3b')]['limit']);_0x5a8913[_0xda5b('0x29')]=qs[_0xda5b('0x29')](_0x2331cb[_0xda5b('0x3b')][_0xda5b('0x29')]);}return _0x5c316d['getProactiveActions'](_0x5a8913);}})['then'](function(_0xc5bd85){if(_0xc5bd85){return _0xc5bd85?{'count':_0x98c4f1,'rows':_0xc5bd85}:null;}})[_0xda5b('0x17')](respondWithResult(_0x1e04d7,null))[_0xda5b('0x22')](handleError(_0x1e04d7,null));};exports[_0xda5b('0x122')]=function(_0x3b2c5a,_0x2975ec){var _0x3ef02b=_0x3b2c5a[_0xda5b('0x3b')][_0xda5b('0x123')]===_0xda5b('0x124')?_0xda5b('0x125'):_0xda5b('0x126');return db[_0xda5b('0x37')][_0xda5b('0x52')]({'attributes':['id',_0x3ef02b],'where':{'id':_0x3b2c5a[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x2975ec,null))[_0xda5b('0x17')](function(_0x32ac8e){if(_0x32ac8e){var _0x4afc76=_0x32ac8e[_0x3ef02b];var _0x34b7cc=_0x4afc76&&_0x4afc76[_0xda5b('0x127')]?_0x4afc76[_0xda5b('0x127')]:[];_0x2975ec['send']({'fromKey':_[_0xda5b('0x71')](_0x4afc76['fromKey'])?undefined:_0x4afc76[_0xda5b('0x128')],'count':_0x34b7cc[_0xda5b('0x41')],'rows':_0x34b7cc});}})['catch'](handleError(_0x2975ec,null));};exports['getOfflineMessages']=function(_0x471b3a,_0x5b635e){var _0x4624ba={'raw':![],'where':{}};var _0x38b3be={};var _0x24f03b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xda5b('0x5f')]({'where':{'id':_0x471b3a[_0xda5b('0x50')]['id']}})[_0xda5b('0x17')](handleEntityNotFound(_0x5b635e,null))['then'](function(_0x1ee059){if(_0x1ee059){_0x38b3be[_0xda5b('0x3a')]=_[_0xda5b('0x3c')](db[_0xda5b('0xca')][_0xda5b('0x38')]);_0x38b3be[_0xda5b('0x3b')]=_[_0xda5b('0x3c')](_0x471b3a[_0xda5b('0x3b')]);_0x38b3be['filters']=_[_0xda5b('0x3e')](_0x38b3be['model'],_0x38b3be[_0xda5b('0x3b')]);_0x4624ba[_0xda5b('0x3f')]=_[_0xda5b('0x3e')](_0x38b3be['model'],qs[_0xda5b('0x40')](_0x471b3a['query'][_0xda5b('0x40')]));_0x4624ba[_0xda5b('0x3f')]=_0x4624ba[_0xda5b('0x3f')]['length']?_0x4624ba[_0xda5b('0x3f')]:_0x38b3be[_0xda5b('0x3a')];if(!_0x471b3a['query'][_0xda5b('0x42')](_0xda5b('0x43'))){_0x4624ba[_0xda5b('0x27')]=qs[_0xda5b('0x27')](_0x471b3a[_0xda5b('0x3b')][_0xda5b('0x27')]);_0x4624ba[_0xda5b('0x29')]=qs[_0xda5b('0x29')](_0x471b3a[_0xda5b('0x3b')][_0xda5b('0x29')]);}_0x4624ba['order']=qs['sort'](_0x471b3a[_0xda5b('0x3b')]['sort']);_0x4624ba['where']=qs[_0xda5b('0x3d')](_[_0xda5b('0x47')](_0x471b3a[_0xda5b('0x3b')],_0x38b3be[_0xda5b('0x3d')]));_0x4624ba['where'][_0xda5b('0x5c')]=_0x1ee059['id'];if(_0x471b3a['query'][_0xda5b('0x48')]){_0x4624ba[_0xda5b('0x46')]=_[_0xda5b('0x49')](_0x4624ba[_0xda5b('0x46')],{'$or':_[_0xda5b('0x36')](_0x4624ba[_0xda5b('0x3f')],function(_0xe85610){var _0x1a8141={};_0x1a8141[_0xe85610]={'$like':'%'+_0x471b3a[_0xda5b('0x3b')][_0xda5b('0x48')]+'%'};return _0x1a8141;})});}_0x4624ba=_[_0xda5b('0x49')]({},_0x4624ba,_0x471b3a[_0xda5b('0x4b')]);return db[_0xda5b('0xca')]['count']({'where':_0x4624ba[_0xda5b('0x46')]})[_0xda5b('0x17')](function(_0x1f6482){_0x24f03b[_0xda5b('0x28')]=_0x1f6482;if(_0x471b3a[_0xda5b('0x3b')][_0xda5b('0x4c')]){_0x4624ba[_0xda5b('0x4d')]=[{'all':!![]}];}else{_0x4624ba[_0xda5b('0x4d')]=[{'model':db[_0xda5b('0x85')],'as':'Contact','required':![]},{'model':db[_0xda5b('0xd3')],'as':_0xda5b('0x129'),'required':![]}];}return db[_0xda5b('0xca')][_0xda5b('0x4e')](_0x4624ba);})['then'](function(_0x11de8b){_0x24f03b[_0xda5b('0x4f')]=_0x11de8b;return _0x24f03b;});}})[_0xda5b('0x17')](respondWithFilteredResult(_0x5b635e,_0x4624ba))['catch'](handleError(_0x5b635e,null));};exports[_0xda5b('0x12a')]=function(_0x5cedc5,_0x53b161){return db[_0xda5b('0x37')][_0xda5b('0x52')]({'where':{'id':_0x5cedc5[_0xda5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x53b161,null))['then'](function(_0x34b5bc){if(_0x34b5bc){return _0x34b5bc['addAgents'](_0x5cedc5[_0xda5b('0x5a')][_0xda5b('0x64')],_['omit'](_0x5cedc5['body'],[_0xda5b('0x64'),'id'])||{})[_0xda5b('0xad')](function(_0xe12dfc){for(var _0x551c1d=0x0;_0x551c1d<_0x5cedc5[_0xda5b('0x5a')][_0xda5b('0x64')]['length'];_0x551c1d+=0x1){socket[_0xda5b('0x12b')](_0xda5b('0x12c'),{'UserId':Number(_0x5cedc5[_0xda5b('0x5a')][_0xda5b('0x64')][_0x551c1d]),'ChatWebsiteId':Number(_0x5cedc5[_0xda5b('0x50')]['id'])});}return _0xe12dfc;});}})[_0xda5b('0x17')](respondWithResult(_0x53b161,null))[_0xda5b('0x22')](handleError(_0x53b161,null));};exports[_0xda5b('0x12d')]=function(_0x489361,_0x11c3f4){return db['ChatWebsite'][_0xda5b('0x52')]({'where':{'id':_0x489361[_0xda5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x11c3f4,null))['then'](function(_0x307d9e){if(_0x307d9e){return _0x307d9e['removeAgents'](_0x489361[_0xda5b('0x3b')]['ids'])['then'](function(){if(_[_0xda5b('0x12e')](_0x489361[_0xda5b('0x3b')][_0xda5b('0x64')])){for(var _0xfff5bf=0x0;_0xfff5bf<_0x489361[_0xda5b('0x3b')]['ids'][_0xda5b('0x41')];_0xfff5bf+=0x1){socket[_0xda5b('0x12b')](_0xda5b('0x12f'),{'UserId':Number(_0x489361['query'][_0xda5b('0x64')][_0xfff5bf]),'ChatWebsiteId':Number(_0x489361[_0xda5b('0x50')]['id'])});}}else{socket[_0xda5b('0x12b')](_0xda5b('0x12f'),{'UserId':Number(_0x489361['query'][_0xda5b('0x64')]),'ChatWebsiteId':Number(_0x489361['params']['id'])});}});}})['then'](respondWithStatusCode(_0x11c3f4,null))[_0xda5b('0x22')](handleError(_0x11c3f4,null));};exports[_0xda5b('0x130')]=function(_0x3daa3c,_0x503cd5){var _0x1f5ac7={};var _0x54f462={};var _0x4b32ac;var _0x27cefe;return db[_0xda5b('0x37')]['findOne']({'where':{'id':_0x3daa3c[_0xda5b('0x50')]['id']}})['then'](handleEntityNotFound(_0x503cd5,null))[_0xda5b('0x17')](function(_0x12cae4){if(_0x12cae4){_0x4b32ac=_0x12cae4;_0x54f462[_0xda5b('0x3a')]=_[_0xda5b('0x3c')](db[_0xda5b('0xb6')][_0xda5b('0x38')]);_0x54f462[_0xda5b('0x3b')]=_[_0xda5b('0x3c')](_0x3daa3c[_0xda5b('0x3b')]);_0x54f462[_0xda5b('0x3d')]=_['intersection'](_0x54f462[_0xda5b('0x3a')],_0x54f462[_0xda5b('0x3b')]);_0x1f5ac7[_0xda5b('0x3f')]=_[_0xda5b('0x3e')](_0x54f462[_0xda5b('0x3a')],qs[_0xda5b('0x40')](_0x3daa3c[_0xda5b('0x3b')][_0xda5b('0x40')]));_0x1f5ac7[_0xda5b('0x3f')]=_0x1f5ac7[_0xda5b('0x3f')][_0xda5b('0x41')]?_0x1f5ac7['attributes']:_0x54f462[_0xda5b('0x3a')];_0x1f5ac7[_0xda5b('0x44')]=qs[_0xda5b('0x45')](_0x3daa3c['query'][_0xda5b('0x45')]);_0x1f5ac7[_0xda5b('0x46')]=qs['filters'](_[_0xda5b('0x47')](_0x3daa3c[_0xda5b('0x3b')],_0x54f462[_0xda5b('0x3d')]));if(_0x3daa3c[_0xda5b('0x3b')]['filter']){_0x1f5ac7[_0xda5b('0x46')]=_[_0xda5b('0x49')](_0x1f5ac7[_0xda5b('0x46')],{'$or':_[_0xda5b('0x36')](_0x1f5ac7[_0xda5b('0x3f')],function(_0x2080c6){var _0x9cfbb1={};_0x9cfbb1[_0x2080c6]={'$like':'%'+_0x3daa3c[_0xda5b('0x3b')][_0xda5b('0x48')]+'%'};return _0x9cfbb1;})});}_0x1f5ac7=_[_0xda5b('0x49')]({},_0x1f5ac7,_0x3daa3c[_0xda5b('0x4b')]);return _0x4b32ac[_0xda5b('0x130')](_0x1f5ac7);}})[_0xda5b('0x17')](function(_0x59e174){if(_0x59e174){_0x27cefe=_0x59e174['length'];if(!_0x3daa3c[_0xda5b('0x3b')][_0xda5b('0x42')](_0xda5b('0x43'))){_0x1f5ac7[_0xda5b('0x27')]=qs['limit'](_0x3daa3c[_0xda5b('0x3b')][_0xda5b('0x27')]);_0x1f5ac7[_0xda5b('0x29')]=qs['offset'](_0x3daa3c[_0xda5b('0x3b')][_0xda5b('0x29')]);}return _0x4b32ac[_0xda5b('0x130')](_0x1f5ac7);}})[_0xda5b('0x17')](function(_0x3af12b){if(_0x3af12b){return _0x3af12b?{'count':_0x27cefe,'rows':_0x3af12b}:null;}})[_0xda5b('0x17')](respondWithResult(_0x503cd5,null))[_0xda5b('0x22')](handleError(_0x503cd5,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a34b1f2..77404a5 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 _0x89fe=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x89fe,0x83));var _0xe89f=function(_0xfc939d,_0x1d07a9){_0xfc939d=_0xfc939d-0x0;var _0x4a5cc7=_0x89fe[_0xfc939d];return _0x4a5cc7;};'use strict';var EventEmitter=require(_0xe89f('0x0'));var ChatWebsite=require(_0xe89f('0x1'))['db'][_0xe89f('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe89f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe89f('0x4'),'afterDestroy':_0xe89f('0x5')};function emitEvent(_0x580dce){return function(_0x3d3aa8,_0x3d8b30,_0x159e6b){ChatWebsiteEvents[_0xe89f('0x6')](_0x580dce+':'+_0x3d3aa8['id'],_0x3d3aa8);ChatWebsiteEvents[_0xe89f('0x6')](_0x580dce,_0x3d3aa8);_0x159e6b(null);};}for(var e in events){if(events[_0xe89f('0x7')](e)){var event=events[e];ChatWebsite[_0xe89f('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x44ae=['setMaxListeners','update','emit','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x5d220e,_0x3ddc66){var _0x5a0078=function(_0x30e9c6){while(--_0x30e9c6){_0x5d220e['push'](_0x5d220e['shift']());}};_0x5a0078(++_0x3ddc66);}(_0x44ae,0x17d));var _0xe44a=function(_0x212b03,_0x1f1b50){_0x212b03=_0x212b03-0x0;var _0x423115=_0x44ae[_0x212b03];return _0x423115;};'use strict';var EventEmitter=require(_0xe44a('0x0'));var ChatWebsite=require(_0xe44a('0x1'))['db'][_0xe44a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe44a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe44a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x33c40a){return function(_0x18455c,_0x174a3f,_0x2f653c){ChatWebsiteEvents[_0xe44a('0x5')](_0x33c40a+':'+_0x18455c['id'],_0x18455c);ChatWebsiteEvents[_0xe44a('0x5')](_0x33c40a,_0x18455c);_0x2f653c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xe44a('0x6')](e,emitEvent(event));}}module[_0xe44a('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 6a754a9..0af2f46 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 _0x1b2e=['bluebird','request-promise','../../config/environment','./chatWebsite.attributes','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment'];(function(_0x394685,_0x1d3d47){var _0xf60ccb=function(_0x3d2a3b){while(--_0x3d2a3b){_0x394685['push'](_0x394685['shift']());}};_0xf60ccb(++_0x1d3d47);}(_0x1b2e,0xba));var _0xe1b2=function(_0x4cabea,_0x45c2e1){_0x4cabea=_0x4cabea-0x0;var _0x224bc2=_0x1b2e[_0x4cabea];return _0x224bc2;};'use strict';var _=require(_0xe1b2('0x0'));var util=require('util');var logger=require(_0xe1b2('0x1'))(_0xe1b2('0x2'));var moment=require(_0xe1b2('0x3'));var BPromise=require(_0xe1b2('0x4'));var rp=require(_0xe1b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe1b2('0x6'));var attributes=require(_0xe1b2('0x7'));module['exports']=function(_0x37d29f,_0x28e286){return _0x37d29f['define'](_0xe1b2('0x8'),attributes,{'tableName':_0xe1b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8683=['../../config/logger','bluebird','path','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8683,0x188));var _0x3868=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8683[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3868('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3868('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3868('0x2'));var rimraf=require('rimraf');var config=require(_0x3868('0x3'));var attributes=require(_0x3868('0x4'));module[_0x3868('0x5')]=function(_0x19bb24,_0xf5013e){return _0x19bb24[_0x3868('0x6')]('ChatWebsite',attributes,{'tableName':_0x3868('0x7'),'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 8f28c7e..5bfdc40 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 _0x8159=['http','redis','defaults','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dc712,_0xd18201){var _0x280e1e=function(_0x21cbdf){while(--_0x21cbdf){_0x3dc712['push'](_0x3dc712['shift']());}};_0x280e1e(++_0xd18201);}(_0x8159,0x1ca));var _0x9815=function(_0x26c47a,_0x526d5b){_0x26c47a=_0x26c47a-0x0;var _0x53c0c0=_0x8159[_0x26c47a];return _0x53c0c0;};'use strict';var _=require(_0x9815('0x0'));var util=require(_0x9815('0x1'));var moment=require('moment');var BPromise=require(_0x9815('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9815('0x3'))['db'];var utils=require(_0x9815('0x4'));var logger=require(_0x9815('0x5'))(_0x9815('0x6'));var config=require(_0x9815('0x7'));var jayson=require(_0x9815('0x8'));var client=jayson[_0x9815('0x9')][_0x9815('0xa')]({'port':0x232a});config[_0x9815('0xb')]=_[_0x9815('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9815('0xb')]));require(_0x9815('0xd'))[_0x9815('0xe')](socket);function respondWithRpcPromise(_0x32f930,_0x5a99fe,_0x4f20e6){return new BPromise(function(_0x1a9501,_0x50921e){return client[_0x9815('0xf')](_0x32f930,_0x4f20e6)[_0x9815('0x10')](function(_0x24265c){logger[_0x9815('0x11')](_0x9815('0x12'),_0x5a99fe,'request\x20sent');logger['debug'](_0x9815('0x13'),_0x5a99fe,'request\x20sent',JSON[_0x9815('0x14')](_0x24265c));if(_0x24265c[_0x9815('0x15')]){if(_0x24265c[_0x9815('0x15')][_0x9815('0x16')]===0x1f4){logger[_0x9815('0x15')](_0x9815('0x12'),_0x5a99fe,_0x24265c[_0x9815('0x15')]['message']);return _0x50921e(_0x24265c['error'][_0x9815('0x17')]);}logger[_0x9815('0x15')](_0x9815('0x12'),_0x5a99fe,_0x24265c[_0x9815('0x15')]['message']);return _0x1a9501(_0x24265c[_0x9815('0x15')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5a99fe,'request\x20sent');_0x1a9501(_0x24265c[_0x9815('0x18')][_0x9815('0x17')]);}})[_0x9815('0x19')](function(_0x3984ca){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x5a99fe,_0x3984ca);_0x50921e(_0x3984ca);});});} \ No newline at end of file +var _0x2539=['redis','socket.io-emitter','./chatWebsite.socket','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4bb9fb,_0x27b3f7){var _0x5721f0=function(_0x518bb5){while(--_0x518bb5){_0x4bb9fb['push'](_0x4bb9fb['shift']());}};_0x5721f0(++_0x27b3f7);}(_0x2539,0x165));var _0x9253=function(_0x29d0b6,_0x5bc8e1){_0x29d0b6=_0x29d0b6-0x0;var _0x1f1244=_0x2539[_0x29d0b6];return _0x1f1244;};'use strict';var _=require('lodash');var util=require(_0x9253('0x0'));var moment=require(_0x9253('0x1'));var BPromise=require('bluebird');var rs=require(_0x9253('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9253('0x3'))['db'];var utils=require(_0x9253('0x4'));var logger=require(_0x9253('0x5'))(_0x9253('0x6'));var config=require(_0x9253('0x7'));var jayson=require(_0x9253('0x8'));var client=jayson[_0x9253('0x9')][_0x9253('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9253('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9253('0xc'))(new Redis(config[_0x9253('0xb')]));require(_0x9253('0xd'))['register'](socket);function respondWithRpcPromise(_0x3e6817,_0x5377d4,_0x2cf299){return new BPromise(function(_0x3dae6a,_0x59f60b){return client['request'](_0x3e6817,_0x2cf299)['then'](function(_0x516cc2){logger[_0x9253('0xe')](_0x9253('0xf'),_0x5377d4,_0x9253('0x10'));logger['debug'](_0x9253('0x11'),_0x5377d4,'request\x20sent',JSON[_0x9253('0x12')](_0x516cc2));if(_0x516cc2[_0x9253('0x13')]){if(_0x516cc2[_0x9253('0x13')][_0x9253('0x14')]===0x1f4){logger['error'](_0x9253('0xf'),_0x5377d4,_0x516cc2[_0x9253('0x13')][_0x9253('0x15')]);return _0x59f60b(_0x516cc2[_0x9253('0x13')][_0x9253('0x15')]);}logger['error'](_0x9253('0xf'),_0x5377d4,_0x516cc2[_0x9253('0x13')]['message']);return _0x3dae6a(_0x516cc2[_0x9253('0x13')]['message']);}else{logger[_0x9253('0xe')](_0x9253('0xf'),_0x5377d4,'request\x20sent');_0x3dae6a(_0x516cc2[_0x9253('0x16')][_0x9253('0x15')]);}})['catch'](function(_0x291a99){logger[_0x9253('0x13')](_0x9253('0xf'),_0x5377d4,_0x291a99);_0x59f60b(_0x291a99);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 6134d3b..acea8dd 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 _0x7dfb=['register','length','chatWebsite:','./chatWebsite.events','save','remove','removeListener'];(function(_0x2f4d5f,_0xda7f63){var _0x13dfeb=function(_0x567b81){while(--_0x567b81){_0x2f4d5f['push'](_0x2f4d5f['shift']());}};_0x13dfeb(++_0xda7f63);}(_0x7dfb,0x1ed));var _0xb7df=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7dfb[_0x397cfb];return _0x15fed9;};'use strict';var ChatWebsiteEvents=require(_0xb7df('0x0'));var events=[_0xb7df('0x1'),_0xb7df('0x2'),'update'];function createListener(_0x183599,_0xe66a98){return function(_0x515725){_0xe66a98['emit'](_0x183599,_0x515725);};}function removeListener(_0x42ab85,_0x5cab27){return function(){ChatWebsiteEvents[_0xb7df('0x3')](_0x42ab85,_0x5cab27);};}exports[_0xb7df('0x4')]=function(_0x5e2bbe){for(var _0x2dfabf=0x0,_0x5d2a07=events[_0xb7df('0x5')];_0x2dfabf<_0x5d2a07;_0x2dfabf++){var _0xfcec61=events[_0x2dfabf];var _0x2d442d=createListener(_0xb7df('0x6')+_0xfcec61,_0x5e2bbe);ChatWebsiteEvents['on'](_0xfcec61,_0x2d442d);}}; \ No newline at end of file +var _0x543b=['remove','emit','removeListener','register','chatWebsite:','./chatWebsite.events','save'];(function(_0x2184b1,_0x31b8f7){var _0x317506=function(_0x166e8a){while(--_0x166e8a){_0x2184b1['push'](_0x2184b1['shift']());}};_0x317506(++_0x31b8f7);}(_0x543b,0x17f));var _0xb543=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x543b[_0x2dafbe];return _0x58a45a;};'use strict';var ChatWebsiteEvents=require(_0xb543('0x0'));var events=[_0xb543('0x1'),_0xb543('0x2'),'update'];function createListener(_0x1d9b04,_0x338218){return function(_0x3a618b){_0x338218[_0xb543('0x3')](_0x1d9b04,_0x3a618b);};}function removeListener(_0x42ebd4,_0x28a2b6){return function(){ChatWebsiteEvents[_0xb543('0x4')](_0x42ebd4,_0x28a2b6);};}exports[_0xb543('0x5')]=function(_0x1254d3){for(var _0x56e067=0x0,_0x4c6d98=events['length'];_0x56e067<_0x4c6d98;_0x56e067++){var _0x515c8e=events[_0x56e067];var _0x399afe=createListener(_0xb543('0x6')+_0x515c8e,_0x1254d3);ChatWebsiteEvents['on'](_0x515c8e,_0x399afe);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c38d8d0..7ca290e 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 _0xd590=['post','addDisposition','addAnswer','diskStorage','join','root','format','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','/:id/avatar','addAvatar','%s-%s','addCustomerAvatar','/:id/notify','server/files','attachments','offline-chat','replace','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/dispositions','getDispositions','getAnswers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create'];(function(_0x36b349,_0x27bd8d){var _0x19b37d=function(_0x48be0d){while(--_0x48be0d){_0x36b349['push'](_0x36b349['shift']());}};_0x19b37d(++_0x27bd8d);}(_0xd590,0xfa));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0d59('0x0'));var timeout=require('connect-timeout');var express=require(_0x0d59('0x1'));var router=express[_0x0d59('0x2')]();var fs_extra=require(_0x0d59('0x3'));var auth=require(_0x0d59('0x4'));var interaction=require(_0x0d59('0x5'));var config=require(_0x0d59('0x6'));var controller=require(_0x0d59('0x7'));router['get']('/',auth[_0x0d59('0x8')](),controller[_0x0d59('0x9')]);router['get'](_0x0d59('0xa'),auth[_0x0d59('0x8')](),controller[_0x0d59('0xb')]);router[_0x0d59('0xc')](_0x0d59('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0d59('0xc')](_0x0d59('0xe'),auth['isAuthenticated'](),controller[_0x0d59('0xf')]);router[_0x0d59('0xc')]('/:id/canned_answers',auth[_0x0d59('0x8')](),controller[_0x0d59('0x10')]);router[_0x0d59('0xc')]('/:id/logo',controller[_0x0d59('0x11')]);router['get']('/:id/avatar',controller[_0x0d59('0x12')]);router['get'](_0x0d59('0x13'),controller[_0x0d59('0x14')]);router[_0x0d59('0xc')](_0x0d59('0x15'),controller[_0x0d59('0x16')]);router[_0x0d59('0xc')](_0x0d59('0x17'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x18')]);router['get'](_0x0d59('0x19'),controller['getSnippet']);router[_0x0d59('0xc')]('/:id/applications',auth[_0x0d59('0x8')](),controller[_0x0d59('0x1a')]);router['get']('/:id/proactive_actions',auth[_0x0d59('0x8')](),controller['getProactiveActions']);router[_0x0d59('0xc')](_0x0d59('0x1b'),controller[_0x0d59('0x1c')]);router[_0x0d59('0xc')](_0x0d59('0x1d'),auth['isAuthenticated'](),controller[_0x0d59('0x1e')]);router[_0x0d59('0xc')](_0x0d59('0x1f'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x20')]);router['post']('/',auth[_0x0d59('0x8')](),controller[_0x0d59('0x21')]);router[_0x0d59('0x22')](_0x0d59('0xe'),auth['isAuthenticated'](),controller[_0x0d59('0x23')]);router[_0x0d59('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0d59('0x24')]);var upload=multer({'storage':multer[_0x0d59('0x25')]({'destination':function(_0x35c407,_0x1b9197,_0x129633){_0x129633(null,path[_0x0d59('0x26')](config[_0x0d59('0x27')],'server/files/images/logos/'));},'filename':function(_0x147d55,_0xc77e49,_0x27fd85){_0x27fd85(null,util[_0x0d59('0x28')]('%s-%s',Date[_0x0d59('0x29')](),_0xc77e49[_0x0d59('0x2a')]));}})});router['post'](_0x0d59('0x2b'),upload[_0x0d59('0x2c')](_0x0d59('0x2d')),controller[_0x0d59('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2cf959,_0x4f84b5,_0x328552){_0x328552(null,path[_0x0d59('0x26')](config[_0x0d59('0x27')],_0x0d59('0x2f')));},'filename':function(_0x56d8e1,_0x2aec36,_0x597509){_0x597509(null,util[_0x0d59('0x28')]('%s-%s',Date[_0x0d59('0x29')](),_0x2aec36[_0x0d59('0x2a')]));}})});router[_0x0d59('0x22')](_0x0d59('0x30'),upload[_0x0d59('0x2c')](_0x0d59('0x2d')),controller[_0x0d59('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c49b8,_0x16ca27,_0x19d7e8){_0x19d7e8(null,path['join'](config[_0x0d59('0x27')],_0x0d59('0x2f')));},'filename':function(_0x553343,_0x4ad377,_0xaaf3ad){_0xaaf3ad(null,util[_0x0d59('0x28')](_0x0d59('0x32'),Date['now'](),_0x4ad377[_0x0d59('0x2a')]));}})});router['post'](_0x0d59('0x13'),upload[_0x0d59('0x2c')](_0x0d59('0x2d')),controller[_0x0d59('0x33')]);var upload=multer({'storage':multer[_0x0d59('0x25')]({'destination':function(_0x125784,_0x216e94,_0x1b5a13){_0x1b5a13(null,path[_0x0d59('0x26')](config[_0x0d59('0x27')],_0x0d59('0x2f')));},'filename':function(_0x2d44f3,_0x2924b9,_0x2df364){_0x2df364(null,util[_0x0d59('0x28')](_0x0d59('0x32'),Date[_0x0d59('0x29')](),_0x2924b9['originalname']));}})});router[_0x0d59('0x22')](_0x0d59('0x15'),upload['single'](_0x0d59('0x2d')),controller['addSystemAvatar']);router[_0x0d59('0x22')](_0x0d59('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2c4cee,_0x4fad3c,_0x48505a){const _0x558d0a=path['join'](config['root'],_0x0d59('0x35'),_0x0d59('0x36'),_0x0d59('0x37'));fs_extra['ensureDir'](_0x558d0a,function(){_0x48505a(null,_0x558d0a);});},'filename':function(_0x21c3e5,_0x2ae1d6,_0x202688){const _0x2914cc=_0x2ae1d6[_0x0d59('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3c2f74=path['extname'](_0x2914cc);const _0x4c8bcc=Date[_0x0d59('0x29')]()+'-'+_0x2914cc[_0x0d59('0x38')](_0x3c2f74,'')+_0x3c2f74;_0x202688(null,_0x4c8bcc);}})});router[_0x0d59('0x22')](_0x0d59('0x39'),offlineUploadMulter[_0x0d59('0x3a')](),controller[_0x0d59('0x3b')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0x0d59('0x3c')]);router['post'](_0x0d59('0x3d'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x3e')]);router[_0x0d59('0x22')]('/:id/proactive_actions',auth[_0x0d59('0x8')](),controller[_0x0d59('0x3f')]);router[_0x0d59('0x22')](_0x0d59('0x1f'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x40')]);router[_0x0d59('0x41')](_0x0d59('0xd'),auth[_0x0d59('0x8')](),controller['update']);router[_0x0d59('0x42')](_0x0d59('0xd'),auth[_0x0d59('0x8')](),controller['destroy']);router[_0x0d59('0x42')]('/:id/dispositions',auth[_0x0d59('0x8')](),controller[_0x0d59('0x43')]);router[_0x0d59('0x42')](_0x0d59('0x44'),auth[_0x0d59('0x8')](),controller[_0x0d59('0x45')]);router[_0x0d59('0x42')]('/:id/users',auth[_0x0d59('0x8')](),controller[_0x0d59('0x46')]);module['exports']=router; \ No newline at end of file +var _0x2f24=['exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','now','originalname','root','server/files/images/avatars/','/:id/avatar','single','addAvatar','file','addCustomerAvatar','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','addInteraction','addApplications','addProactiveActions','put','update','delete','removeDispositions','removeAnswers','/:id/users','removeAgents'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x2f24,0x115));var _0x42f2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x2f24[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x42f2('0x0'));var util=require(_0x42f2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x42f2('0x2'));var router=express[_0x42f2('0x3')]();var fs_extra=require(_0x42f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x42f2('0x5'));var config=require('../../config/environment');var controller=require(_0x42f2('0x6'));router[_0x42f2('0x7')]('/',auth[_0x42f2('0x8')](),controller[_0x42f2('0x9')]);router[_0x42f2('0x7')](_0x42f2('0xa'),auth['isAuthenticated'](),controller[_0x42f2('0xb')]);router[_0x42f2('0x7')](_0x42f2('0xc'),auth[_0x42f2('0x8')](),controller[_0x42f2('0xd')]);router[_0x42f2('0x7')](_0x42f2('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x42f2('0x7')](_0x42f2('0xf'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x10')]);router['get'](_0x42f2('0x11'),controller[_0x42f2('0x12')]);router['get']('/:id/avatar',controller['getAvatar']);router[_0x42f2('0x7')](_0x42f2('0x13'),controller['getCustomerAvatar']);router[_0x42f2('0x7')](_0x42f2('0x14'),controller['getSystemAvatar']);router[_0x42f2('0x7')](_0x42f2('0x15'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x16')]);router['get'](_0x42f2('0x17'),controller[_0x42f2('0x18')]);router[_0x42f2('0x7')](_0x42f2('0x19'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x1a')]);router[_0x42f2('0x7')](_0x42f2('0x1b'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x1c')]);router[_0x42f2('0x7')](_0x42f2('0x1d'),controller[_0x42f2('0x1e')]);router[_0x42f2('0x7')](_0x42f2('0x1f'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x20')]);router['get']('/:id/users',auth[_0x42f2('0x8')](),controller['getAgents']);router[_0x42f2('0x21')]('/',auth['isAuthenticated'](),controller[_0x42f2('0x22')]);router['post']('/:id/dispositions',auth[_0x42f2('0x8')](),controller[_0x42f2('0x23')]);router[_0x42f2('0x21')]('/:id/canned_answers',auth[_0x42f2('0x8')](),controller[_0x42f2('0x24')]);var upload=multer({'storage':multer[_0x42f2('0x25')]({'destination':function(_0x4723b5,_0x2949a0,_0x3cb119){_0x3cb119(null,path[_0x42f2('0x26')](config['root'],_0x42f2('0x27')));},'filename':function(_0x4244da,_0x58814e,_0x4e7996){_0x4e7996(null,util[_0x42f2('0x28')](_0x42f2('0x29'),Date[_0x42f2('0x2a')](),_0x58814e[_0x42f2('0x2b')]));}})});router[_0x42f2('0x21')]('/:id/logo',upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2bff05,_0x4ae015,_0x24589a){_0x24589a(null,path[_0x42f2('0x26')](config[_0x42f2('0x2c')],_0x42f2('0x2d')));},'filename':function(_0x1078be,_0x4c015d,_0x421228){_0x421228(null,util[_0x42f2('0x28')](_0x42f2('0x29'),Date['now'](),_0x4c015d[_0x42f2('0x2b')]));}})});router[_0x42f2('0x21')](_0x42f2('0x2e'),upload[_0x42f2('0x2f')]('file'),controller[_0x42f2('0x30')]);var upload=multer({'storage':multer[_0x42f2('0x25')]({'destination':function(_0x72bb72,_0x2055bc,_0x25154f){_0x25154f(null,path[_0x42f2('0x26')](config[_0x42f2('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x4952c7,_0xb7e2ae,_0x94c1a1){_0x94c1a1(null,util[_0x42f2('0x28')]('%s-%s',Date[_0x42f2('0x2a')](),_0xb7e2ae[_0x42f2('0x2b')]));}})});router[_0x42f2('0x21')](_0x42f2('0x13'),upload['single'](_0x42f2('0x31')),controller[_0x42f2('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12bf19,_0x252e81,_0x562d43){_0x562d43(null,path[_0x42f2('0x26')](config[_0x42f2('0x2c')],_0x42f2('0x2d')));},'filename':function(_0x2cc610,_0x5306d1,_0x211541){_0x211541(null,util['format'](_0x42f2('0x29'),Date['now'](),_0x5306d1[_0x42f2('0x2b')]));}})});router[_0x42f2('0x21')](_0x42f2('0x14'),upload[_0x42f2('0x2f')]('file'),controller['addSystemAvatar']);router[_0x42f2('0x21')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x42f2('0x25')]({'destination':function(_0x36a021,_0x5b62e0,_0x26577d){const _0x10adb3=path[_0x42f2('0x26')](config[_0x42f2('0x2c')],_0x42f2('0x33'),_0x42f2('0x34'),_0x42f2('0x35'));fs_extra[_0x42f2('0x36')](_0x10adb3,function(){_0x26577d(null,_0x10adb3);});},'filename':function(_0x519e0f,_0x11b9b7,_0x247c6b){const _0x4f4cad=_0x11b9b7[_0x42f2('0x2b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x156cf6=path['extname'](_0x4f4cad);const _0x2067d7=Date[_0x42f2('0x2a')]()+'-'+_0x4f4cad[_0x42f2('0x37')](_0x156cf6,'')+_0x156cf6;_0x247c6b(null,_0x2067d7);}})});router[_0x42f2('0x21')](_0x42f2('0x38'),offlineUploadMulter[_0x42f2('0x39')](),controller['offline']);router[_0x42f2('0x21')](_0x42f2('0x15'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x3a')]);router[_0x42f2('0x21')]('/:id/applications',auth[_0x42f2('0x8')](),controller[_0x42f2('0x3b')]);router[_0x42f2('0x21')](_0x42f2('0x1b'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x3c')]);router[_0x42f2('0x21')]('/:id/users',auth[_0x42f2('0x8')](),controller['addAgents']);router[_0x42f2('0x3d')](_0x42f2('0xc'),auth['isAuthenticated'](),controller[_0x42f2('0x3e')]);router[_0x42f2('0x3f')]('/:id',auth[_0x42f2('0x8')](),controller['destroy']);router[_0x42f2('0x3f')](_0x42f2('0xe'),auth['isAuthenticated'](),controller[_0x42f2('0x40')]);router['delete'](_0x42f2('0xf'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x41')]);router['delete'](_0x42f2('0x42'),auth[_0x42f2('0x8')](),controller[_0x42f2('0x43')]);module[_0x42f2('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 2d12db4..7d144cc 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 _0xe713=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe713,0x1e0));var _0x3e71=function(_0x248c90,_0x1ed333){_0x248c90=_0x248c90-0x0;var _0x449036=_0xe713[_0x248c90];return _0x449036;};var beaverLogger=require(_0x3e71('0x0'));var express=require(_0x3e71('0x1'));var auth=require(_0x3e71('0x2'));var config=require('../config/environment');var router=express[_0x3e71('0x3')]();var isProduction=config['env']===_0x3e71('0x4')||![];function clientSideLogs(_0x33deea,_0x5128aa,_0xeb27ac){var _0x506712=_0x33deea[_0x3e71('0x5')][_0x3e71('0x6')](_0x3e71('0x7'));if(!_0x506712){throw new Error(_0x3e71('0x8'));}return beaverLogger[_0x3e71('0x9')]({'uri':_0x3e71('0xa'),'logger':_0x506712,'enableCors':!isProduction})(_0x33deea,_0x5128aa,_0xeb27ac);}router[_0x3e71('0xb')](auth[_0x3e71('0xc')](),clientSideLogs);module[_0x3e71('0xd')]=router; \ No newline at end of file +var _0xdd57=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','get','client-side-logger'];(function(_0x945d83,_0x3d4cb4){var _0x983ef3=function(_0x294e52){while(--_0x294e52){_0x945d83['push'](_0x945d83['shift']());}};_0x983ef3(++_0x3d4cb4);}(_0xdd57,0x18c));var _0x7dd5=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xdd57[_0x2b7764];return _0x848dcb;};var beaverLogger=require(_0x7dd5('0x0'));var express=require(_0x7dd5('0x1'));var auth=require(_0x7dd5('0x2'));var config=require(_0x7dd5('0x3'));var router=express[_0x7dd5('0x4')]();var isProduction=config[_0x7dd5('0x5')]===_0x7dd5('0x6')||![];function clientSideLogs(_0x5a45ec,_0x3214a8,_0x3d94da){var _0x1f0f3d=_0x5a45ec['app'][_0x7dd5('0x7')](_0x7dd5('0x8'));if(!_0x1f0f3d){throw new Error(_0x7dd5('0x9'));}return beaverLogger[_0x7dd5('0xa')]({'uri':_0x7dd5('0xb'),'logger':_0x1f0f3d,'enableCors':!isProduction})(_0x5a45ec,_0x3214a8,_0x3d94da);}router[_0x7dd5('0xc')](auth[_0x7dd5('0xd')](),clientSideLogs);module[_0x7dd5('0xe')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d50e045..4dcfadb 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 _0x670e=['MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant'];(function(_0x547af,_0x17abff){var _0x22f7f4=function(_0x5f0384){while(--_0x5f0384){_0x547af['push'](_0x547af['shift']());}};_0x22f7f4(++_0x17abff);}(_0x670e,0x100));var _0xe670=function(_0x1aa359,_0x27927e){_0x1aa359=_0x1aa359-0x0;var _0x5bce5e=_0x670e[_0x1aa359];return _0x5bce5e;};'use strict';var Sequelize=require(_0xe670('0x0'));module['exports']={'name':{'type':Sequelize[_0xe670('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe670('0x2')]('AmazonAWS',_0xe670('0x3'),_0xe670('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe670('0x2')](_0xe670('0x5'),_0xe670('0x6'))},'data1':{'type':Sequelize[_0xe670('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xe670('0x1')],'comment':_0xe670('0x7')},'data3':{'type':Sequelize[_0xe670('0x1')],'comment':_0xe670('0x8')},'data4':{'type':Sequelize[_0xe670('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xe670('0x9')],'comment':_0xe670('0xa')},'data6':{'type':Sequelize[_0xe670('0x9')],'comment':_0xe670('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x640a=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x4a7bba,_0x24ef43){var _0x59f944=function(_0x9dd52b){while(--_0x9dd52b){_0x4a7bba['push'](_0x4a7bba['shift']());}};_0x59f944(++_0x24ef43);}(_0x640a,0x161));var _0xa640=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x640a[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xa640('0x0'));module[_0xa640('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa640('0x2')](_0xa640('0x3'),_0xa640('0x4'),_0xa640('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa640('0x2')](_0xa640('0x6'),_0xa640('0x7'))},'data1':{'type':Sequelize[_0xa640('0x8')],'comment':_0xa640('0x9')},'data2':{'type':Sequelize[_0xa640('0x8')],'comment':_0xa640('0xa')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xa640('0x8')],'comment':_0xa640('0xb')},'data5':{'type':Sequelize[_0xa640('0xc')],'comment':_0xa640('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0xa640('0xe')},'data7':{'type':Sequelize[_0xa640('0xc')],'comment':_0xa640('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b72f94f..9fbc2d1 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 _0x56f1=['sendStatus','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','end','name','padEnd','slice','index','CloudProvider','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','MicrosoftAzure','decryptString','data3','catch','rawAttributes','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','service','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','params','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','refresh_token','data6','startRefreshInterval','emit','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter'];(function(_0x28a2f4,_0x188689){var _0x1919fa=function(_0x3d1585){while(--_0x3d1585){_0x28a2f4['push'](_0x28a2f4['shift']());}};_0x1919fa(++_0x188689);}(_0x56f1,0x1b8));var _0x156f=function(_0x6bc5cb,_0x291daa){_0x6bc5cb=_0x6bc5cb-0x0;var _0x4436a2=_0x56f1[_0x6bc5cb];return _0x4436a2;};'use strict';var _=require(_0x156f('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0x156f('0x1'));var config=require(_0x156f('0x2'));var logger=require(_0x156f('0x3'))(_0x156f('0x4'));var db=require(_0x156f('0x5'))['db'];var oauth=require(_0x156f('0x6'));config[_0x156f('0x7')]=_[_0x156f('0x8')](config[_0x156f('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x156f('0x9'))(new Redis(config[_0x156f('0x7')]));var redis=new Redis(config[_0x156f('0x7')]);function respondWithStatusCode(_0x49d3db,_0x409d61){_0x409d61=_0x409d61||0xcc;return function(_0x405a0c){if(_0x405a0c){return _0x49d3db[_0x156f('0xa')](_0x409d61);}return _0x49d3db['status'](_0x409d61)['end']();};}function respondWithResult(_0x3614b9,_0x3e044a){_0x3e044a=_0x3e044a||0xc8;return function(_0x19c927){if(_0x19c927){return _0x3614b9['status'](_0x3e044a)[_0x156f('0xb')](_0x19c927);}};}function respondWithFilteredResult(_0x34c811,_0x5add11){return function(_0x34ec37){if(_0x34ec37){var _0x1d98a6=typeof _0x5add11[_0x156f('0xc')]===_0x156f('0xd')&&typeof _0x5add11[_0x156f('0xe')]===_0x156f('0xd');var _0x5bb99d=_0x34ec37[_0x156f('0xf')];var _0x3a32df=_0x1d98a6?0x0:_0x5add11[_0x156f('0xc')];var _0x8ee942=_0x1d98a6?_0x34ec37[_0x156f('0xf')]:_0x5add11[_0x156f('0xc')]+_0x5add11[_0x156f('0xe')];var _0x463703;if(_0x8ee942>=_0x5bb99d){_0x8ee942=_0x5bb99d;_0x463703=0xc8;}else{_0x463703=0xce;}_0x34c811['status'](_0x463703);return _0x34c811[_0x156f('0x10')](_0x156f('0x11'),_0x3a32df+'-'+_0x8ee942+'/'+_0x5bb99d)[_0x156f('0xb')](_0x34ec37);}return null;};}function saveUpdates(_0x1ce470){return function(_0x28cca0){if(_0x28cca0){return _0x28cca0[_0x156f('0x12')](_0x1ce470)[_0x156f('0x13')](function(_0x275beb){return _0x275beb;});}return null;};}function removeEntity(_0xd1c10d){return function(_0x292ef9){if(_0x292ef9){return _0x292ef9[_0x156f('0x14')]()[_0x156f('0x13')](function(){_0xd1c10d[_0x156f('0x15')](0xcc)[_0x156f('0x16')]();});}};}function handleEntityNotFound(_0x3ca94e){return function(_0x4cd577){if(!_0x4cd577){_0x3ca94e[_0x156f('0xa')](0x194);}return _0x4cd577;};}function handleError(_0x37cd3b,_0x1be653){_0x1be653=_0x1be653||0x1f4;return function(_0x4039a1){logger['error'](_0x4039a1['stack']);if(_0x4039a1[_0x156f('0x17')]){delete _0x4039a1[_0x156f('0x17')];}_0x37cd3b[_0x156f('0x15')](_0x1be653)['send'](_0x4039a1);};}function maskClientSecret(_0xc0076f){return _[_0x156f('0x18')](_0xc0076f[_0x156f('0x19')](0x0,0x3),0x14,'*');}exports[_0x156f('0x1a')]=function(_0x1eec4f,_0x6a1ddb){var _0x448fbd={},_0x3d59cb={},_0x51035c={'count':0x0,'rows':[]};var _0x497db0=_['map'](db[_0x156f('0x1b')]['rawAttributes'],function(_0x242233){return{'name':_0x242233[_0x156f('0x1c')],'type':_0x242233[_0x156f('0x1d')][_0x156f('0x1e')]};});_0x3d59cb[_0x156f('0x1f')]=_[_0x156f('0x20')](_0x497db0,_0x156f('0x17'));_0x3d59cb['query']=_[_0x156f('0x21')](_0x1eec4f[_0x156f('0x22')]);_0x3d59cb[_0x156f('0x23')]=_[_0x156f('0x24')](_0x3d59cb[_0x156f('0x1f')],_0x3d59cb[_0x156f('0x22')]);_0x448fbd[_0x156f('0x25')]=_[_0x156f('0x24')](_0x3d59cb['model'],qs[_0x156f('0x26')](_0x1eec4f['query']['fields']));_0x448fbd[_0x156f('0x25')]=_0x448fbd[_0x156f('0x25')][_0x156f('0x27')]?_0x448fbd[_0x156f('0x25')]:_0x3d59cb[_0x156f('0x1f')];if(!_0x1eec4f[_0x156f('0x22')][_0x156f('0x28')]('nolimit')){_0x448fbd[_0x156f('0xe')]=qs[_0x156f('0xe')](_0x1eec4f['query'][_0x156f('0xe')]);_0x448fbd[_0x156f('0xc')]=qs[_0x156f('0xc')](_0x1eec4f[_0x156f('0x22')][_0x156f('0xc')]);}_0x448fbd['order']=qs['sort'](_0x1eec4f[_0x156f('0x22')][_0x156f('0x29')]);_0x448fbd[_0x156f('0x2a')]=qs[_0x156f('0x23')](_[_0x156f('0x2b')](_0x1eec4f[_0x156f('0x22')],_0x3d59cb[_0x156f('0x23')]),_0x497db0);if(_0x1eec4f[_0x156f('0x22')][_0x156f('0x2c')]){_0x448fbd[_0x156f('0x2a')]=_[_0x156f('0x2d')](_0x448fbd[_0x156f('0x2a')],{'$or':_[_0x156f('0x20')](_0x497db0,function(_0x435bd1){if(_0x435bd1['type']!=='VIRTUAL'){var _0x208b9b={};_0x208b9b[_0x435bd1['name']]={'$like':'%'+_0x1eec4f[_0x156f('0x22')]['filter']+'%'};return _0x208b9b;}})});}_0x448fbd=_[_0x156f('0x2d')]({},_0x448fbd,_0x1eec4f[_0x156f('0x2e')]);var _0x8d880={'where':_0x448fbd[_0x156f('0x2a')]};return db[_0x156f('0x1b')][_0x156f('0xf')](_0x8d880)[_0x156f('0x13')](function(_0x1066fd){_0x51035c[_0x156f('0xf')]=_0x1066fd;if(_0x1eec4f[_0x156f('0x22')][_0x156f('0x2f')]){_0x448fbd[_0x156f('0x30')]=[{'all':!![]}];}return db[_0x156f('0x1b')]['findAll'](_0x448fbd);})['then'](function(_0x2c9550){_0x51035c['rows']=_[_0x156f('0x20')](_0x2c9550,function(_0x492792){if(_0x492792['service']===_0x156f('0x31')){var _0x5d7b86=encryptor[_0x156f('0x32')](_0x492792[_0x156f('0x33')]);_0x492792[_0x156f('0x33')]=maskClientSecret(_0x5d7b86);}return _0x492792;});return _0x51035c;})[_0x156f('0x13')](respondWithFilteredResult(_0x6a1ddb,_0x448fbd))[_0x156f('0x34')](handleError(_0x6a1ddb,null));};exports['show']=function(_0x48eb79,_0x4f952f){var _0x455739={'raw':!![],'where':{'id':_0x48eb79['params']['id']}},_0x402564={};_0x402564[_0x156f('0x1f')]=_[_0x156f('0x21')](db[_0x156f('0x1b')][_0x156f('0x35')]);_0x402564[_0x156f('0x22')]=_[_0x156f('0x21')](_0x48eb79[_0x156f('0x22')]);_0x402564['filters']=_[_0x156f('0x24')](_0x402564[_0x156f('0x1f')],_0x402564[_0x156f('0x22')]);_0x455739[_0x156f('0x25')]=_[_0x156f('0x24')](_0x402564['model'],qs[_0x156f('0x26')](_0x48eb79[_0x156f('0x22')][_0x156f('0x26')]));_0x455739[_0x156f('0x25')]=_0x455739[_0x156f('0x25')][_0x156f('0x27')]?_0x455739[_0x156f('0x25')]:_0x402564[_0x156f('0x1f')];if(_0x48eb79['query'][_0x156f('0x2f')]){_0x455739[_0x156f('0x30')]=[{'all':!![]}];}_0x455739=_[_0x156f('0x2d')]({},_0x455739,_0x48eb79[_0x156f('0x2e')]);return db[_0x156f('0x1b')][_0x156f('0x36')](_0x455739)[_0x156f('0x13')](handleEntityNotFound(_0x4f952f,null))[_0x156f('0x13')](function(_0x39c0ec){if(_0x39c0ec['service']===_0x156f('0x31')){var _0x2d95b5=encryptor[_0x156f('0x32')](_0x39c0ec[_0x156f('0x33')]);_0x39c0ec[_0x156f('0x33')]=maskClientSecret(_0x2d95b5);}return _0x39c0ec;})['then'](respondWithResult(_0x4f952f,null))['catch'](handleError(_0x4f952f,null));};exports[_0x156f('0x37')]=function(_0x1766bc,_0xde3d61){if(!_0x1766bc[_0x156f('0x38')][_0x156f('0x17')])throw new Error(_0x156f('0x39'));if(!_0x1766bc[_0x156f('0x38')]['service'])throw new Error(_0x156f('0x3a'));var _0x524b9d=db[_0x156f('0x1b')][_0x156f('0x35')][_0x156f('0x3b')][_0x156f('0x3c')];if(!_0x524b9d[_0x156f('0x3d')](_0x1766bc[_0x156f('0x38')][_0x156f('0x3b')]))throw new Error(_0x156f('0x3e')+_0x524b9d['join'](',\x20'));if(_0x1766bc[_0x156f('0x38')]['service']===_0x156f('0x31')&&_0x1766bc['body']['data3']){_0x1766bc[_0x156f('0x38')][_0x156f('0x33')]=encryptor[_0x156f('0x3f')](_0x1766bc[_0x156f('0x38')][_0x156f('0x33')]);}return db[_0x156f('0x1b')]['create'](_0x1766bc['body'],{})[_0x156f('0x13')](respondWithResult(_0xde3d61,0xc9))[_0x156f('0x34')](handleError(_0xde3d61,null));};exports[_0x156f('0x12')]=function(_0x24ba9e,_0x48c68a){if(_0x24ba9e[_0x156f('0x38')]['id']){delete _0x24ba9e[_0x156f('0x38')]['id'];}return db['CloudProvider'][_0x156f('0x36')]({'where':{'id':_0x24ba9e[_0x156f('0x40')]['id']}})['then'](handleEntityNotFound(_0x48c68a,null))['then'](function(_0x3b0dd3){if(_0x3b0dd3[_0x156f('0x3b')]===_0x156f('0x31')&&_0x24ba9e[_0x156f('0x38')][_0x156f('0x33')]){_0x24ba9e['body'][_0x156f('0x33')]=encryptor[_0x156f('0x3f')](_0x24ba9e[_0x156f('0x38')][_0x156f('0x33')]);}return _0x3b0dd3;})['then'](saveUpdates(_0x24ba9e[_0x156f('0x38')],null))['then'](respondWithResult(_0x48c68a,null))[_0x156f('0x34')](handleError(_0x48c68a,null));};exports[_0x156f('0x14')]=function(_0x3b6899,_0x58f688){return db[_0x156f('0x1b')][_0x156f('0x36')]({'where':{'id':_0x3b6899['params']['id']}})['then'](handleEntityNotFound(_0x58f688,null))[_0x156f('0x13')](removeEntity(_0x58f688,null))['catch'](handleError(_0x58f688,null));};exports[_0x156f('0x41')]=function(_0x5c391d,_0x565ceb){return db[_0x156f('0x1b')][_0x156f('0x42')]({'where':{'id':_0x5c391d[_0x156f('0x40')]['id']},'raw':!![]})[_0x156f('0x13')](function(_0x4eff75){if(!_0x4eff75)return _0x565ceb['sendStatus'](0x194);return{'url':oauth[_0x156f('0x43')](_0x4eff75,_0x5c391d[_0x156f('0x44')]['id'])};})['then'](respondWithResult(_0x565ceb,null))[_0x156f('0x34')](handleError(_0x565ceb,null));};exports['oauth2MicrosoftCallback']=function(_0x576e19,_0xfc2575){var _0x52e1f9=_0x576e19[_0x156f('0x38')];var _0x231b56;var _0x815fb4;if(_0x52e1f9[_0x156f('0x45')])throw _0x52e1f9;redis[_0x156f('0x46')](_0x52e1f9[_0x156f('0x47')])['then'](function(_0x439781){if(!_0x439781)throw new Error(_0x156f('0x48'));_0x231b56=JSON[_0x156f('0x49')](_0x439781);var _0x35639a=Buffer[_0x156f('0x4a')](_0x52e1f9[_0x156f('0x47')],_0x156f('0x4b'))[_0x156f('0x4c')]('ascii');_0x815fb4=JSON[_0x156f('0x49')](_0x35639a);if(!oauth['isValidIdToken'](_0x52e1f9['id_token'],_0x231b56[_0x156f('0x4d')]))throw new Error(_0x156f('0x4e'));redis[_0x156f('0x4f')](_0x52e1f9[_0x156f('0x47')]);return oauth[_0x156f('0x50')](_0x52e1f9[_0x156f('0x51')],_0x231b56);})['then'](function(_0xae93c1){_0x231b56[_0x156f('0x52')]=_0xae93c1['access_token'];_0x231b56['data6']=_0xae93c1[_0x156f('0x53')];return db[_0x156f('0x1b')][_0x156f('0x12')]({'data5':_0x231b56[_0x156f('0x52')],'data6':_0x231b56[_0x156f('0x54')]},{'where':{'id':_0x231b56['id']}});})[_0x156f('0x13')](function(){oauth[_0x156f('0x55')](_0x231b56);socket[_0x156f('0x56')]('microsoftAuthorization:success',{'id':_0x815fb4['id']});return;})[_0x156f('0x13')](respondWithStatusCode(_0xfc2575,null))['catch'](function(_0x31fbf7){if(_0x815fb4){socket[_0x156f('0x56')]('microsoftAuthorization:error',{'id':_0x815fb4['id']});}if(!_0x231b56){logger[_0x156f('0x45')]('Invalid\x20authentication\x20state\x20parameter',_0x31fbf7);return _0xfc2575[_0x156f('0x15')](0x1f4)[_0x156f('0x57')](_0x31fbf7[_0x156f('0x58')]);}logger[_0x156f('0x45')](_0x156f('0x59'),_0x231b56['id'],JSON['stringify'](_0x31fbf7));});}; \ No newline at end of file +var _0x5a23=['../../components/encryptor','../../config/logger','api','redis','defaults','localhost','end','status','json','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','service','MicrosoftAzure','decryptString','data3','catch','params','keys','options','find','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','findOne','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','data5','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs'];(function(_0x1044ef,_0x4b70e2){var _0x5d464a=function(_0x190eab){while(--_0x190eab){_0x1044ef['push'](_0x1044ef['shift']());}};_0x5d464a(++_0x4b70e2);}(_0x5a23,0x108));var _0x35a2=function(_0x55c659,_0x1a7eb3){_0x55c659=_0x55c659-0x0;var _0x101b6d=_0x5a23[_0x55c659];return _0x101b6d;};'use strict';var _=require(_0x35a2('0x0'));var Redis=require(_0x35a2('0x1'));var qs=require(_0x35a2('0x2'));var encryptor=require(_0x35a2('0x3'));var config=require('../../config/environment');var logger=require(_0x35a2('0x4'))(_0x35a2('0x5'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0x35a2('0x6')]=_[_0x35a2('0x7')](config[_0x35a2('0x6')],{'host':_0x35a2('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1216cb,_0x57d9ef){_0x57d9ef=_0x57d9ef||0xcc;return function(_0x49a954){if(_0x49a954){return _0x1216cb['sendStatus'](_0x57d9ef);}return _0x1216cb['status'](_0x57d9ef)[_0x35a2('0x9')]();};}function respondWithResult(_0x1b4e14,_0x573cd2){_0x573cd2=_0x573cd2||0xc8;return function(_0x42cd98){if(_0x42cd98){return _0x1b4e14[_0x35a2('0xa')](_0x573cd2)[_0x35a2('0xb')](_0x42cd98);}};}function respondWithFilteredResult(_0x5cdea8,_0x3fce95){return function(_0x499b3c){if(_0x499b3c){var _0x19e3f9=typeof _0x3fce95['offset']==='undefined'&&typeof _0x3fce95[_0x35a2('0xc')]==='undefined';var _0x1700c6=_0x499b3c[_0x35a2('0xd')];var _0x36f138=_0x19e3f9?0x0:_0x3fce95[_0x35a2('0xe')];var _0x2c8c4b=_0x19e3f9?_0x499b3c['count']:_0x3fce95[_0x35a2('0xe')]+_0x3fce95[_0x35a2('0xc')];var _0x13f396;if(_0x2c8c4b>=_0x1700c6){_0x2c8c4b=_0x1700c6;_0x13f396=0xc8;}else{_0x13f396=0xce;}_0x5cdea8[_0x35a2('0xa')](_0x13f396);return _0x5cdea8[_0x35a2('0xf')](_0x35a2('0x10'),_0x36f138+'-'+_0x2c8c4b+'/'+_0x1700c6)['json'](_0x499b3c);}return null;};}function saveUpdates(_0x488bdf){return function(_0x65068d){if(_0x65068d){return _0x65068d[_0x35a2('0x11')](_0x488bdf)[_0x35a2('0x12')](function(_0x5ab883){return _0x5ab883;});}return null;};}function removeEntity(_0x59fab4){return function(_0x51e546){if(_0x51e546){return _0x51e546[_0x35a2('0x13')]()['then'](function(){_0x59fab4['status'](0xcc)[_0x35a2('0x9')]();});}};}function handleEntityNotFound(_0x476a63){return function(_0x14869e){if(!_0x14869e){_0x476a63[_0x35a2('0x14')](0x194);}return _0x14869e;};}function handleError(_0x371f8d,_0x2afed1){_0x2afed1=_0x2afed1||0x1f4;return function(_0x66dc1f){logger[_0x35a2('0x15')](_0x66dc1f['stack']);if(_0x66dc1f[_0x35a2('0x16')]){delete _0x66dc1f[_0x35a2('0x16')];}_0x371f8d[_0x35a2('0xa')](_0x2afed1)[_0x35a2('0x17')](_0x66dc1f);};}function maskClientSecret(_0x44bfd5){return _[_0x35a2('0x18')](_0x44bfd5[_0x35a2('0x19')](0x0,0x3),0x14,'*');}exports[_0x35a2('0x1a')]=function(_0x4a2e88,_0x2e593d){var _0x4e94f0={},_0x9d99b8={},_0x935f00={'count':0x0,'rows':[]};var _0x301689=_[_0x35a2('0x1b')](db[_0x35a2('0x1c')][_0x35a2('0x1d')],function(_0x2ac6be){return{'name':_0x2ac6be['fieldName'],'type':_0x2ac6be['type'][_0x35a2('0x1e')]};});_0x9d99b8[_0x35a2('0x1f')]=_['map'](_0x301689,'name');_0x9d99b8['query']=_['keys'](_0x4a2e88[_0x35a2('0x20')]);_0x9d99b8[_0x35a2('0x21')]=_[_0x35a2('0x22')](_0x9d99b8['model'],_0x9d99b8[_0x35a2('0x20')]);_0x4e94f0[_0x35a2('0x23')]=_[_0x35a2('0x22')](_0x9d99b8[_0x35a2('0x1f')],qs[_0x35a2('0x24')](_0x4a2e88['query'][_0x35a2('0x24')]));_0x4e94f0[_0x35a2('0x23')]=_0x4e94f0[_0x35a2('0x23')][_0x35a2('0x25')]?_0x4e94f0['attributes']:_0x9d99b8['model'];if(!_0x4a2e88[_0x35a2('0x20')][_0x35a2('0x26')](_0x35a2('0x27'))){_0x4e94f0[_0x35a2('0xc')]=qs['limit'](_0x4a2e88[_0x35a2('0x20')]['limit']);_0x4e94f0['offset']=qs['offset'](_0x4a2e88[_0x35a2('0x20')]['offset']);}_0x4e94f0[_0x35a2('0x28')]=qs[_0x35a2('0x29')](_0x4a2e88[_0x35a2('0x20')]['sort']);_0x4e94f0[_0x35a2('0x2a')]=qs[_0x35a2('0x21')](_['pick'](_0x4a2e88[_0x35a2('0x20')],_0x9d99b8[_0x35a2('0x21')]),_0x301689);if(_0x4a2e88[_0x35a2('0x20')]['filter']){_0x4e94f0[_0x35a2('0x2a')]=_['merge'](_0x4e94f0[_0x35a2('0x2a')],{'$or':_[_0x35a2('0x1b')](_0x301689,function(_0x17ea58){if(_0x17ea58['type']!=='VIRTUAL'){var _0x163e73={};_0x163e73[_0x17ea58['name']]={'$like':'%'+_0x4a2e88[_0x35a2('0x20')][_0x35a2('0x2b')]+'%'};return _0x163e73;}})});}_0x4e94f0=_[_0x35a2('0x2c')]({},_0x4e94f0,_0x4a2e88['options']);var _0x588172={'where':_0x4e94f0[_0x35a2('0x2a')]};return db[_0x35a2('0x1c')][_0x35a2('0xd')](_0x588172)['then'](function(_0xced6b9){_0x935f00['count']=_0xced6b9;if(_0x4a2e88['query'][_0x35a2('0x2d')]){_0x4e94f0[_0x35a2('0x2e')]=[{'all':!![]}];}return db[_0x35a2('0x1c')]['findAll'](_0x4e94f0);})[_0x35a2('0x12')](function(_0x51ea1f){_0x935f00['rows']=_[_0x35a2('0x1b')](_0x51ea1f,function(_0x5ee2a5){if(_0x5ee2a5[_0x35a2('0x2f')]===_0x35a2('0x30')){var _0xde84ed=encryptor[_0x35a2('0x31')](_0x5ee2a5[_0x35a2('0x32')]);_0x5ee2a5[_0x35a2('0x32')]=maskClientSecret(_0xde84ed);}return _0x5ee2a5;});return _0x935f00;})[_0x35a2('0x12')](respondWithFilteredResult(_0x2e593d,_0x4e94f0))[_0x35a2('0x33')](handleError(_0x2e593d,null));};exports['show']=function(_0x256185,_0x22ab4f){var _0x17962a={'raw':!![],'where':{'id':_0x256185[_0x35a2('0x34')]['id']}},_0x8a6f6d={};_0x8a6f6d[_0x35a2('0x1f')]=_[_0x35a2('0x35')](db[_0x35a2('0x1c')][_0x35a2('0x1d')]);_0x8a6f6d[_0x35a2('0x20')]=_[_0x35a2('0x35')](_0x256185[_0x35a2('0x20')]);_0x8a6f6d['filters']=_[_0x35a2('0x22')](_0x8a6f6d['model'],_0x8a6f6d[_0x35a2('0x20')]);_0x17962a[_0x35a2('0x23')]=_[_0x35a2('0x22')](_0x8a6f6d[_0x35a2('0x1f')],qs['fields'](_0x256185['query'][_0x35a2('0x24')]));_0x17962a[_0x35a2('0x23')]=_0x17962a[_0x35a2('0x23')]['length']?_0x17962a[_0x35a2('0x23')]:_0x8a6f6d[_0x35a2('0x1f')];if(_0x256185['query'][_0x35a2('0x2d')]){_0x17962a[_0x35a2('0x2e')]=[{'all':!![]}];}_0x17962a=_[_0x35a2('0x2c')]({},_0x17962a,_0x256185[_0x35a2('0x36')]);return db[_0x35a2('0x1c')][_0x35a2('0x37')](_0x17962a)[_0x35a2('0x12')](handleEntityNotFound(_0x22ab4f,null))[_0x35a2('0x12')](function(_0x14304b){if(_0x14304b[_0x35a2('0x2f')]===_0x35a2('0x30')){var _0x166a03=encryptor[_0x35a2('0x31')](_0x14304b[_0x35a2('0x32')]);_0x14304b['data3']=maskClientSecret(_0x166a03);}return _0x14304b;})['then'](respondWithResult(_0x22ab4f,null))[_0x35a2('0x33')](handleError(_0x22ab4f,null));};exports['create']=function(_0x4d7149,_0xbcc96d){if(!_0x4d7149['body'][_0x35a2('0x16')])throw new Error(_0x35a2('0x38'));if(!_0x4d7149['body'][_0x35a2('0x2f')])throw new Error(_0x35a2('0x39'));var _0x9ac193=db[_0x35a2('0x1c')][_0x35a2('0x1d')][_0x35a2('0x2f')][_0x35a2('0x3a')];if(!_0x9ac193[_0x35a2('0x3b')](_0x4d7149[_0x35a2('0x3c')]['service']))throw new Error(_0x35a2('0x3d')+_0x9ac193[_0x35a2('0x3e')](',\x20'));if(_0x4d7149[_0x35a2('0x3c')][_0x35a2('0x2f')]==='MicrosoftAzure'&&_0x4d7149['body']['data3']){_0x4d7149['body'][_0x35a2('0x32')]=encryptor[_0x35a2('0x3f')](_0x4d7149[_0x35a2('0x3c')][_0x35a2('0x32')]);}return db[_0x35a2('0x1c')][_0x35a2('0x40')](_0x4d7149[_0x35a2('0x3c')],{})[_0x35a2('0x12')](respondWithResult(_0xbcc96d,0xc9))[_0x35a2('0x33')](handleError(_0xbcc96d,null));};exports[_0x35a2('0x11')]=function(_0x15e5c0,_0x571208){if(_0x15e5c0['body']['id']){delete _0x15e5c0[_0x35a2('0x3c')]['id'];}return db[_0x35a2('0x1c')][_0x35a2('0x37')]({'where':{'id':_0x15e5c0['params']['id']}})[_0x35a2('0x12')](handleEntityNotFound(_0x571208,null))['then'](function(_0xfef39){if(_0xfef39[_0x35a2('0x2f')]===_0x35a2('0x30')&&_0x15e5c0[_0x35a2('0x3c')][_0x35a2('0x32')]){_0x15e5c0[_0x35a2('0x3c')][_0x35a2('0x32')]=encryptor[_0x35a2('0x3f')](_0x15e5c0[_0x35a2('0x3c')][_0x35a2('0x32')]);}return _0xfef39;})[_0x35a2('0x12')](saveUpdates(_0x15e5c0['body'],null))[_0x35a2('0x12')](respondWithResult(_0x571208,null))[_0x35a2('0x33')](handleError(_0x571208,null));};exports[_0x35a2('0x13')]=function(_0x4fcd79,_0x1a4238){return db[_0x35a2('0x1c')]['find']({'where':{'id':_0x4fcd79[_0x35a2('0x34')]['id']}})[_0x35a2('0x12')](handleEntityNotFound(_0x1a4238,null))[_0x35a2('0x12')](removeEntity(_0x1a4238,null))[_0x35a2('0x33')](handleError(_0x1a4238,null));};exports['oauth2MicrosoftAuthorize']=function(_0x4cdab0,_0x15fa3e){return db[_0x35a2('0x1c')][_0x35a2('0x41')]({'where':{'id':_0x4cdab0[_0x35a2('0x34')]['id']},'raw':!![]})[_0x35a2('0x12')](function(_0x12790b){if(!_0x12790b)return _0x15fa3e[_0x35a2('0x14')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x12790b,_0x4cdab0[_0x35a2('0x42')]['id'])};})['then'](respondWithResult(_0x15fa3e,null))[_0x35a2('0x33')](handleError(_0x15fa3e,null));};exports[_0x35a2('0x43')]=function(_0x16e801,_0x29599c){var _0x199d32=_0x16e801[_0x35a2('0x3c')];var _0x262cd9;var _0x1ec08d;if(_0x199d32[_0x35a2('0x15')])throw _0x199d32;redis['get'](_0x199d32[_0x35a2('0x44')])[_0x35a2('0x12')](function(_0x2ec222){if(!_0x2ec222)throw new Error(_0x35a2('0x45'));_0x262cd9=JSON[_0x35a2('0x46')](_0x2ec222);var _0x5bec29=Buffer[_0x35a2('0x47')](_0x199d32['state'],'base64')[_0x35a2('0x48')](_0x35a2('0x49'));_0x1ec08d=JSON[_0x35a2('0x46')](_0x5bec29);if(!oauth[_0x35a2('0x4a')](_0x199d32['id_token'],_0x262cd9[_0x35a2('0x4b')]))throw new Error(_0x35a2('0x4c'));redis[_0x35a2('0x4d')](_0x199d32['state']);return oauth[_0x35a2('0x4e')](_0x199d32[_0x35a2('0x4f')],_0x262cd9);})['then'](function(_0x121a8b){_0x262cd9['data5']=_0x121a8b[_0x35a2('0x50')];_0x262cd9[_0x35a2('0x51')]=_0x121a8b['refresh_token'];return db[_0x35a2('0x1c')][_0x35a2('0x11')]({'data5':_0x262cd9[_0x35a2('0x52')],'data6':_0x262cd9['data6']},{'where':{'id':_0x262cd9['id']}});})['then'](function(){oauth[_0x35a2('0x53')](_0x262cd9);socket[_0x35a2('0x54')](_0x35a2('0x55'),{'id':_0x1ec08d['id']});return;})['then'](respondWithStatusCode(_0x29599c,null))[_0x35a2('0x33')](function(_0x1b1d4f){if(_0x1ec08d){socket[_0x35a2('0x54')]('microsoftAuthorization:error',{'id':_0x1ec08d['id']});}if(!_0x262cd9){logger[_0x35a2('0x15')](_0x35a2('0x56'),_0x1b1d4f);return _0x29599c['status'](0x1f4)['send'](_0x1b1d4f[_0x35a2('0x57')]);}logger[_0x35a2('0x15')](_0x35a2('0x58'),_0x262cd9['id'],JSON['stringify'](_0x1b1d4f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2b61ccf..f654091 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 _0xb9ec=['api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb9ec,0x1c5));var _0xcb9e=function(_0x44c097,_0x2372d0){_0x44c097=_0x44c097-0x0;var _0x819396=_0xb9ec[_0x44c097];return _0x819396;};'use strict';var _=require(_0xcb9e('0x0'));var util=require(_0xcb9e('0x1'));var logger=require(_0xcb9e('0x2'))(_0xcb9e('0x3'));var moment=require(_0xcb9e('0x4'));var BPromise=require(_0xcb9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb9e('0x6'));var rimraf=require(_0xcb9e('0x7'));var config=require(_0xcb9e('0x8'));var attributes=require(_0xcb9e('0x9'));module[_0xcb9e('0xa')]=function(_0xe09f91,_0xbaee1b){return _0xe09f91['define']('CloudProvider',attributes,{'tableName':_0xcb9e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53a6=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','define','cloud_providers','lodash','util'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x53a6,0xcf));var _0x653a=function(_0x38bebe,_0x4db8bc){_0x38bebe=_0x38bebe-0x0;var _0x262431=_0x53a6[_0x38bebe];return _0x262431;};'use strict';var _=require(_0x653a('0x0'));var util=require(_0x653a('0x1'));var logger=require(_0x653a('0x2'))(_0x653a('0x3'));var moment=require('moment');var BPromise=require(_0x653a('0x4'));var rp=require(_0x653a('0x5'));var fs=require('fs');var path=require(_0x653a('0x6'));var rimraf=require('rimraf');var config=require(_0x653a('0x7'));var attributes=require(_0x653a('0x8'));module['exports']=function(_0x12668f,_0x547a43){return _0x12668f[_0x653a('0x9')]('CloudProvider',attributes,{'tableName':_0x653a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index b5aee79..37f4f97 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 _0x993f=['openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','state','nonce','prompt','login','value','oauth2Claims','oauth2/','set','decode','iss','audience','isAfter','unix','resolve','then','data3','CloudProvider','refresh_token','data6','data4','POST','replace','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','map','all','inspect','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0x993f,0x172));var _0xf993=function(_0x2758ea,_0xae05fe){_0x2758ea=_0x2758ea-0x0;var _0x130cad=_0x993f[_0x2758ea];return _0x130cad;};'use strict';var _=require(_0xf993('0x0'));var crypto=require(_0xf993('0x1'));var jwt=require(_0xf993('0x2'));var moment=require(_0xf993('0x3'));var Redis=require('ioredis');var rp=require(_0xf993('0x4'));var util=require(_0xf993('0x5'));var encryptor=require(_0xf993('0x6'));var config=require(_0xf993('0x7'));var logger=require(_0xf993('0x8'))(_0xf993('0x9'));var schedule=require(_0xf993('0xa'));var db=require(_0xf993('0xb'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf993('0xc'),'port':0x18eb});var redis=new Redis(config[_0xf993('0xd')]);var MICROSOFT_AUTH_URL=_0xf993('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xf993('0xf'),_0xf993('0x10'),_0xf993('0x11'),'offline_access',_0xf993('0x12'),_0xf993('0x13'),_0xf993('0x14')],'Dynamics365':[_0xf993('0xf'),_0xf993('0x15')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5721c7){var _0x24378f=_['map'](AZURE_AUTH_SCOPES[_0x5721c7[_0xf993('0x16')]]);if(_0x5721c7[_0xf993('0x16')]===_0xf993('0x17'))_0x24378f[_0xf993('0x18')](_0x5721c7[_0xf993('0x19')]+_0xf993('0x1a'));return _0x24378f[_0xf993('0x1b')]('\x20');}function getAccessTokenScope(_0x4bfcf2){if(_0x4bfcf2[_0xf993('0x16')]===_0xf993('0x1c'))return _0xf993('0x12');if(_0x4bfcf2['type']===_0xf993('0x17'))return _0x4bfcf2['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4d8a21,_0x580f88){var _0x4cc798=MICROSOFT_AUTH_URL['replace'](_0xf993('0x1d'),_0x4d8a21[_0xf993('0x1e')]);var _0x3b5940=[_0xf993('0x1f'),_0xf993('0x20')];var _0x22487d=Buffer[_0xf993('0x21')](JSON[_0xf993('0x22')]({'id':_0x580f88}))[_0xf993('0x23')](_0xf993('0x24'));var _0x126ece=crypto['randomBytes'](0x10)['toString'](_0xf993('0x25'));var _0x529652=getAuthorizationScopes(_0x4d8a21);var _0x1d89ac=[{'key':_0xf993('0x26'),'value':_0x4d8a21[_0xf993('0x27')]},{'key':_0xf993('0x28'),'value':encodeURIComponent(_0x3b5940[_0xf993('0x1b')]('\x20'))},{'key':_0xf993('0x29'),'value':_0x4d8a21['data4']},{'key':_0xf993('0x2a'),'value':_0xf993('0x2b')},{'key':'scope','value':encodeURIComponent(_0x529652)},{'key':_0xf993('0x2c'),'value':_0x22487d},{'key':_0xf993('0x2d'),'value':_0x126ece},{'key':_0xf993('0x2e'),'value':_0xf993('0x2f')}];var _0x46793e=_0x4cc798+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x1d89ac,function(_0x1e79c5){return _0x1e79c5['key']+'='+_0x1e79c5[_0xf993('0x30')];})['join']('&');_0x4d8a21[_0xf993('0x31')]={'issuer':_0x4cc798['replace'](_0xf993('0x32'),''),'audience':_0x4d8a21[_0xf993('0x27')],'state':_0x22487d,'nonce':_0x126ece};redis[_0xf993('0x33')](_0x22487d,JSON[_0xf993('0x22')](_0x4d8a21));return _0x46793e;}function isValidIdToken(_0x198f20,_0x9ba87e){try{var _0xa88400=jwt[_0xf993('0x34')](_0x198f20,{'complete':!![]});var _0x33fbce=_0xa88400['payload'];if(_0x33fbce[_0xf993('0x35')]!==_0x9ba87e['issuer'])return![];if(_0x33fbce['aud']!==_0x9ba87e[_0xf993('0x36')])return![];if(_0x33fbce[_0xf993('0x2d')]!==_0x9ba87e['nonce'])return![];if(moment()[_0xf993('0x37')](moment[_0xf993('0x38')](_0x33fbce['exp'])))return![];return!![];}catch(_0x1e64b7){throw _0x1e64b7;}}function refreshOauth2MicrosoftAccessToken(_0x5c6b7f){return Promise[_0xf993('0x39')]()[_0xf993('0x3a')](function(){if(_0x5c6b7f[_0xf993('0x3b')])return _0x5c6b7f;return db[_0xf993('0x3c')]['findOne']({'where':{'id':_0x5c6b7f['id']},'raw':!![]});})['then'](function(_0x1a2a10){var _0x280b97={'grant_type':_0xf993('0x3d'),'refresh_token':_0x1a2a10[_0xf993('0x3e')],'scope':getAccessTokenScope(_0x1a2a10),'redirect_uri':_0x1a2a10[_0xf993('0x3f')],'client_id':_0x1a2a10[_0xf993('0x27')],'client_secret':encryptor['decryptString'](_0x1a2a10['data3'])};var _0x298447={'method':_0xf993('0x40'),'uri':MICROSOFT_AUTH_URL[_0xf993('0x41')](_0xf993('0x1d'),_0x1a2a10[_0xf993('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x280b97,'json':!![]};return rp(_0x298447);})[_0xf993('0x3a')](function(_0x578da4){_0x5c6b7f[_0xf993('0x42')]=_0x578da4[_0xf993('0x43')];_0x5c6b7f[_0xf993('0x3e')]=_0x578da4[_0xf993('0x3d')];return db['CloudProvider'][_0xf993('0x44')]({'data5':_0x5c6b7f[_0xf993('0x42')],'data6':_0x5c6b7f[_0xf993('0x3e')]},{'where':{'id':_0x5c6b7f['id']}});})['then'](function(){return _0x5c6b7f;})['catch'](function(_0x20650d){logger[_0xf993('0x45')](_0xf993('0x46'),_0x5c6b7f['id'],_0x20650d);});}function getOauth2MicrosoftAccessToken(_0x4ddbe9,_0x597966){var _0x3c01cc={'grant_type':'authorization_code','code':_0x4ddbe9,'scope':getAccessTokenScope(_0x597966),'redirect_uri':_0x597966[_0xf993('0x3f')],'client_id':_0x597966[_0xf993('0x27')],'client_secret':encryptor['decryptString'](_0x597966['data3'])};var _0x5d0bbe={'method':_0xf993('0x40'),'uri':MICROSOFT_AUTH_URL['replace'](_0xf993('0x1d'),_0x597966[_0xf993('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3c01cc,'json':!![]};return rp(_0x5d0bbe);}function startRefreshInterval(_0x2b2983){var _0x370822=schedule[_0xf993('0x47')];if(_0x370822[_0x2b2983['id']])clearInterval(_0x370822[_0x2b2983['id']]);_0x370822[_0x2b2983['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xf993('0x48')](this,{'id':_0x2b2983['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xf993('0x47')]=_0x370822;}function startAllRefreshIntervals(){return db[_0xf993('0x3c')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xf993('0x3a')](function(_0x45cddb){var _0x22c3e3=_0x45cddb[_0xf993('0x49')](function(_0x546912){return refreshOauth2MicrosoftAccessToken(_0x546912)[_0xf993('0x3a')](function(_0x55c985){startRefreshInterval(_0x55c985);});});return Promise[_0xf993('0x4a')](_0x22c3e3);})['catch'](function(_0x11837b){var _0xaa16=_0x11837b?util[_0xf993('0x4b')](_0x11837b,{'showHidden':![],'depth':null}):'';logger[_0xf993('0x45')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0xaa16);});}module[_0xf993('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xe539=['map','type','Dynamics365','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','data2','code','from','stringify','randomBytes','toString','hex','client_id','response_type','redirect_uri','response_mode','state','nonce','login','value','oauth2Claims','replace','oauth2/','data1','set','iss','issuer','aud','audience','isAfter','exp','resolve','then','data3','CloudProvider','data6','decryptString','POST','{TENANT_ID}','access_token','refresh_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data4','intervals','bind','findAll','inspect','error','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','openid','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xe539,0x1b3));var _0x9e53=function(_0x45c262,_0x2e3ce5){_0x45c262=_0x45c262-0x0;var _0x4f2ba6=_0xe539[_0x45c262];return _0x4f2ba6;};'use strict';var _=require(_0x9e53('0x0'));var crypto=require('crypto');var jwt=require(_0x9e53('0x1'));var moment=require(_0x9e53('0x2'));var Redis=require(_0x9e53('0x3'));var rp=require(_0x9e53('0x4'));var util=require('util');var encryptor=require(_0x9e53('0x5'));var config=require(_0x9e53('0x6'));var logger=require(_0x9e53('0x7'))(_0x9e53('0x8'));var schedule=require(_0x9e53('0x9'));var db=require(_0x9e53('0xa'))['db'];config['redis']=_[_0x9e53('0xb')](config[_0x9e53('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x9e53('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x9e53('0xd'),_0x9e53('0xe'),_0x9e53('0xf'),_0x9e53('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x9e53('0x11'),_0x9e53('0x12')],'Dynamics365':[_0x9e53('0xd'),_0x9e53('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x9e53('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x9e53('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1dbaa1){var _0x21bbc8=_[_0x9e53('0x15')](AZURE_AUTH_SCOPES[_0x1dbaa1[_0x9e53('0x16')]]);if(_0x1dbaa1[_0x9e53('0x16')]===_0x9e53('0x17'))_0x21bbc8['push'](_0x1dbaa1[_0x9e53('0x18')]+_0x9e53('0x19'));return _0x21bbc8[_0x9e53('0x1a')]('\x20');}function getAccessTokenScope(_0x19a52c){if(_0x19a52c['type']===_0x9e53('0x1b'))return _0x9e53('0x1c');if(_0x19a52c[_0x9e53('0x16')]===_0x9e53('0x17'))return _0x19a52c['data7']+_0x9e53('0x19');}function generateMicrosoftAuthorizationUrl(_0x1fccf0,_0x38eb08){var _0x3edf3b=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x1fccf0[_0x9e53('0x1d')]);var _0x20d167=[_0x9e53('0x1e'),'id_token'];var _0x132f8a=Buffer[_0x9e53('0x1f')](JSON[_0x9e53('0x20')]({'id':_0x38eb08}))['toString']('base64');var _0x41bf5d=crypto[_0x9e53('0x21')](0x10)[_0x9e53('0x22')](_0x9e53('0x23'));var _0x47a0ea=getAuthorizationScopes(_0x1fccf0);var _0x5d9ab3=[{'key':_0x9e53('0x24'),'value':_0x1fccf0['data1']},{'key':_0x9e53('0x25'),'value':encodeURIComponent(_0x20d167[_0x9e53('0x1a')]('\x20'))},{'key':_0x9e53('0x26'),'value':_0x1fccf0['data4']},{'key':_0x9e53('0x27'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x47a0ea)},{'key':_0x9e53('0x28'),'value':_0x132f8a},{'key':_0x9e53('0x29'),'value':_0x41bf5d},{'key':'prompt','value':_0x9e53('0x2a')}];var _0x243abb=_0x3edf3b+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9e53('0x15')](_0x5d9ab3,function(_0x2d7f11){return _0x2d7f11['key']+'='+_0x2d7f11[_0x9e53('0x2b')];})[_0x9e53('0x1a')]('&');_0x1fccf0[_0x9e53('0x2c')]={'issuer':_0x3edf3b[_0x9e53('0x2d')](_0x9e53('0x2e'),''),'audience':_0x1fccf0[_0x9e53('0x2f')],'state':_0x132f8a,'nonce':_0x41bf5d};redis[_0x9e53('0x30')](_0x132f8a,JSON[_0x9e53('0x20')](_0x1fccf0));return _0x243abb;}function isValidIdToken(_0x2487bf,_0xb7f5d0){try{var _0x190242=jwt['decode'](_0x2487bf,{'complete':!![]});var _0x374352=_0x190242['payload'];if(_0x374352[_0x9e53('0x31')]!==_0xb7f5d0[_0x9e53('0x32')])return![];if(_0x374352[_0x9e53('0x33')]!==_0xb7f5d0[_0x9e53('0x34')])return![];if(_0x374352['nonce']!==_0xb7f5d0['nonce'])return![];if(moment()[_0x9e53('0x35')](moment['unix'](_0x374352[_0x9e53('0x36')])))return![];return!![];}catch(_0x5146c2){throw _0x5146c2;}}function refreshOauth2MicrosoftAccessToken(_0x3b65e2){return Promise[_0x9e53('0x37')]()[_0x9e53('0x38')](function(){if(_0x3b65e2[_0x9e53('0x39')])return _0x3b65e2;return db[_0x9e53('0x3a')]['findOne']({'where':{'id':_0x3b65e2['id']},'raw':!![]});})[_0x9e53('0x38')](function(_0x2f97d8){var _0x3d0e13={'grant_type':'refresh_token','refresh_token':_0x2f97d8[_0x9e53('0x3b')],'scope':getAccessTokenScope(_0x2f97d8),'redirect_uri':_0x2f97d8['data4'],'client_id':_0x2f97d8[_0x9e53('0x2f')],'client_secret':encryptor[_0x9e53('0x3c')](_0x2f97d8[_0x9e53('0x39')])};var _0x364dd5={'method':_0x9e53('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x9e53('0x2d')](_0x9e53('0x3e'),_0x2f97d8[_0x9e53('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3d0e13,'json':!![]};return rp(_0x364dd5);})['then'](function(_0x182931){_0x3b65e2['data5']=_0x182931[_0x9e53('0x3f')];_0x3b65e2['data6']=_0x182931[_0x9e53('0x40')];return db[_0x9e53('0x3a')][_0x9e53('0x41')]({'data5':_0x3b65e2['data5'],'data6':_0x3b65e2[_0x9e53('0x3b')]},{'where':{'id':_0x3b65e2['id']}});})[_0x9e53('0x38')](function(){return _0x3b65e2;})[_0x9e53('0x42')](function(_0x3788f4){logger['error'](_0x9e53('0x43'),_0x3b65e2['id'],_0x3788f4);});}function getOauth2MicrosoftAccessToken(_0x2db2d0,_0xce8bbd){var _0x504206={'grant_type':_0x9e53('0x44'),'code':_0x2db2d0,'scope':getAccessTokenScope(_0xce8bbd),'redirect_uri':_0xce8bbd[_0x9e53('0x45')],'client_id':_0xce8bbd[_0x9e53('0x2f')],'client_secret':encryptor[_0x9e53('0x3c')](_0xce8bbd[_0x9e53('0x39')])};var _0x316b8c={'method':_0x9e53('0x3d'),'uri':MICROSOFT_AUTH_URL[_0x9e53('0x2d')](_0x9e53('0x3e'),_0xce8bbd[_0x9e53('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x504206,'json':!![]};return rp(_0x316b8c);}function startRefreshInterval(_0x161848){var _0x36a755=schedule[_0x9e53('0x46')];if(_0x36a755[_0x161848['id']])clearInterval(_0x36a755[_0x161848['id']]);_0x36a755[_0x161848['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9e53('0x47')](this,{'id':_0x161848['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x9e53('0x46')]=_0x36a755;}function startAllRefreshIntervals(){return db[_0x9e53('0x3a')][_0x9e53('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x346433){var _0x3d3300=_0x346433['map'](function(_0x1cdcdb){return refreshOauth2MicrosoftAccessToken(_0x1cdcdb)[_0x9e53('0x38')](function(_0x36772c){startRefreshInterval(_0x36772c);});});return Promise['all'](_0x3d3300);})['catch'](function(_0x1b74a6){var _0x114cfe=_0x1b74a6?util[_0x9e53('0x49')](_0x1b74a6,{'showHidden':![],'depth':null}):'';logger[_0x9e53('0x4a')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x114cfe);});}module[_0x9e53('0x4b')]={'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 4d27a0d..15e3865 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 _0x5c96=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0xe61ab6,_0x2b7371){var _0x48dccc=function(_0x1d567c){while(--_0x1d567c){_0xe61ab6['push'](_0xe61ab6['shift']());}};_0x48dccc(++_0x2b7371);}(_0x5c96,0x133));var _0x65c9=function(_0x56d6e,_0x5033a4){_0x56d6e=_0x56d6e-0x0;var _0x42a32f=_0x5c96[_0x56d6e];return _0x42a32f;};'use strict';var _=require(_0x65c9('0x0'));var util=require(_0x65c9('0x1'));var moment=require(_0x65c9('0x2'));var BPromise=require(_0x65c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65c9('0x4'));var db=require(_0x65c9('0x5'))['db'];var utils=require(_0x65c9('0x6'));var logger=require(_0x65c9('0x7'))(_0x65c9('0x8'));var config=require(_0x65c9('0x9'));var jayson=require(_0x65c9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x502c63,_0x4eb25b,_0x1a9b93){return new BPromise(function(_0x10a355,_0x1c679d){return client['request'](_0x502c63,_0x1a9b93)[_0x65c9('0xb')](function(_0x3249da){logger[_0x65c9('0xc')](_0x65c9('0xd'),_0x4eb25b,_0x65c9('0xe'));logger[_0x65c9('0xf')](_0x65c9('0x10'),_0x4eb25b,'request\x20sent',JSON['stringify'](_0x3249da));if(_0x3249da['error']){if(_0x3249da[_0x65c9('0x11')][_0x65c9('0x12')]===0x1f4){logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x3249da[_0x65c9('0x11')]['message']);return _0x1c679d(_0x3249da[_0x65c9('0x11')][_0x65c9('0x13')]);}logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x3249da['error'][_0x65c9('0x13')]);return _0x10a355(_0x3249da[_0x65c9('0x11')][_0x65c9('0x13')]);}else{logger[_0x65c9('0xc')](_0x65c9('0xd'),_0x4eb25b,_0x65c9('0xe'));_0x10a355(_0x3249da[_0x65c9('0x14')][_0x65c9('0x13')]);}})[_0x65c9('0x15')](function(_0x25c0e9){logger[_0x65c9('0x11')](_0x65c9('0xd'),_0x4eb25b,_0x25c0e9);_0x1c679d(_0x25c0e9);});});} \ No newline at end of file +var _0xa49b=['../../config/logger','../../config/environment','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xa49b,0x126));var _0xba49=function(_0x5c62e1,_0x5c5b9b){_0x5c62e1=_0x5c62e1-0x0;var _0x474c6b=_0xa49b[_0x5c62e1];return _0x474c6b;};'use strict';var _=require('lodash');var util=require(_0xba49('0x0'));var moment=require(_0xba49('0x1'));var BPromise=require(_0xba49('0x2'));var rs=require(_0xba49('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba49('0x4'))['db'];var utils=require(_0xba49('0x5'));var logger=require(_0xba49('0x6'))('rpc');var config=require(_0xba49('0x7'));var jayson=require(_0xba49('0x8'));var client=jayson[_0xba49('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd5d20d,_0x4b29c0,_0x1f5909){return new BPromise(function(_0x47340c,_0x2bfae5){return client['request'](_0xd5d20d,_0x1f5909)[_0xba49('0xa')](function(_0x249dd6){logger[_0xba49('0xb')](_0xba49('0xc'),_0x4b29c0,'request\x20sent');logger[_0xba49('0xd')](_0xba49('0xe'),_0x4b29c0,_0xba49('0xf'),JSON['stringify'](_0x249dd6));if(_0x249dd6['error']){if(_0x249dd6[_0xba49('0x10')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x4b29c0,_0x249dd6[_0xba49('0x10')]['message']);return _0x2bfae5(_0x249dd6['error'][_0xba49('0x11')]);}logger[_0xba49('0x10')](_0xba49('0xc'),_0x4b29c0,_0x249dd6[_0xba49('0x10')]['message']);return _0x47340c(_0x249dd6[_0xba49('0x10')][_0xba49('0x11')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x4b29c0,_0xba49('0xf'));_0x47340c(_0x249dd6[_0xba49('0x12')][_0xba49('0x11')]);}})[_0xba49('0x13')](function(_0x56980f){logger[_0xba49('0x10')](_0xba49('0xc'),_0x4b29c0,_0x56980f);_0x2bfae5(_0x56980f);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 28e6532..d8e9e6b 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x68a425,_0x304716){var _0x2cc916=function(_0x425264){while(--_0x425264){_0x68a425['push'](_0x68a425['shift']());}};_0x2cc916(++_0x304716);}(_0xadb5,0xad));var _0x5adb=function(_0x194ce3,_0x240ba3){_0x194ce3=_0x194ce3-0x0;var _0x44372e=_0xadb5[_0x194ce3];return _0x44372e;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x2a9ef4,_0x3f8056){var _0x331fea=function(_0x3ccfb6){while(--_0x3ccfb6){_0x2a9ef4['push'](_0x2a9ef4['shift']());}};_0x331fea(++_0x3f8056);}(_0xadb5,0xad));var _0x5adb=function(_0x4b2062,_0x23bb06){_0x4b2062=_0x4b2062-0x0;var _0x48b08f=_0xadb5[_0x4b2062];return _0x48b08f;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 844c311..f67d02f 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 _0x38f8=['STRING','sequelize'];(function(_0x105114,_0x213db9){var _0xea4357=function(_0x56a477){while(--_0x56a477){_0x105114['push'](_0x105114['shift']());}};_0xea4357(++_0x213db9);}(_0x38f8,0x121));var _0x838f=function(_0x37a924,_0xff5916){_0x37a924=_0x37a924-0x0;var _0x5b5aaf=_0x38f8[_0x37a924];return _0x5b5aaf;};'use strict';var Sequelize=require(_0x838f('0x0'));module['exports']={'name':{'type':Sequelize[_0x838f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x838f('0x1')]},'companyId':{'type':Sequelize[_0x838f('0x1')]},'website':{'type':Sequelize[_0x838f('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x838f('0x1')]},'type':{'type':Sequelize[_0x838f('0x1')]},'street':{'type':Sequelize[_0x838f('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x838f('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x838f('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x838f('0x1')]},'sCity':{'type':Sequelize[_0x838f('0x1')]},'sCountry':{'type':Sequelize[_0x838f('0x1')]},'description':{'type':Sequelize[_0x838f('0x1')]}}; \ No newline at end of file +var _0x9981=['STRING'];(function(_0x147c96,_0x309657){var _0x4ec711=function(_0x3cf7c9){while(--_0x3cf7c9){_0x147c96['push'](_0x147c96['shift']());}};_0x4ec711(++_0x309657);}(_0x9981,0x163));var _0x1998=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9981[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1998('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x1998('0x0')]},'phone':{'type':Sequelize[_0x1998('0x0')]},'fax':{'type':Sequelize[_0x1998('0x0')]},'type':{'type':Sequelize[_0x1998('0x0')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1998('0x0')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x1998('0x0')]},'email':{'type':Sequelize[_0x1998('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1998('0x0')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x1998('0x0')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x1998('0x0')]},'description':{'type':Sequelize[_0x1998('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index aedfe5a..3c2142f 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 _0xbee6=['catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','getContacts','findOne','order','nolimit','eml-format','request-promise','moment','util','path','sox','to-csv','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','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll','include','findAll'];(function(_0x3d86f4,_0x2a9220){var _0x5d8e87=function(_0x542c7c){while(--_0x542c7c){_0x3d86f4['push'](_0x3d86f4['shift']());}};_0x5d8e87(++_0x2a9220);}(_0xbee6,0x6e));var _0x6bee=function(_0x26d89e,_0x2f0571){_0x26d89e=_0x26d89e-0x0;var _0x220fe3=_0xbee6[_0x26d89e];return _0x220fe3;};'use strict';var emlformat=require(_0x6bee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6bee('0x1'));var moment=require(_0x6bee('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6bee('0x3'));var path=require(_0x6bee('0x4'));var sox=require(_0x6bee('0x5'));var csv=require(_0x6bee('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bee('0x7'));var _=require(_0x6bee('0x8'));var squel=require(_0x6bee('0x9'));var crypto=require(_0x6bee('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6bee('0xb'));var toCsv=require(_0x6bee('0x6'));var querystring=require(_0x6bee('0xc'));var Papa=require(_0x6bee('0xd'));var Redis=require(_0x6bee('0xe'));var authService=require(_0x6bee('0xf'));var qs=require(_0x6bee('0x10'));var as=require(_0x6bee('0x11'));var hardwareService=require(_0x6bee('0x12'));var logger=require(_0x6bee('0x13'))('api');var utils=require(_0x6bee('0x14'));var config=require(_0x6bee('0x15'));var licenseUtil=require(_0x6bee('0x16'));var db=require(_0x6bee('0x17'))['db'];function respondWithStatusCode(_0x5dcc26,_0x444680){_0x444680=_0x444680||0xcc;return function(_0x205e01){if(_0x205e01){return _0x5dcc26['sendStatus'](_0x444680);}return _0x5dcc26[_0x6bee('0x18')](_0x444680)['end']();};}function respondWithResult(_0x44dc1a,_0x401ff4){_0x401ff4=_0x401ff4||0xc8;return function(_0x353d36){if(_0x353d36){return _0x44dc1a[_0x6bee('0x18')](_0x401ff4)[_0x6bee('0x19')](_0x353d36);}};}function respondWithFilteredResult(_0x59a436,_0x402dde){return function(_0x371c5b){if(_0x371c5b){var _0x5424d3=typeof _0x402dde[_0x6bee('0x1a')]===_0x6bee('0x1b')&&typeof _0x402dde['limit']===_0x6bee('0x1b');var _0x2deb46=_0x371c5b[_0x6bee('0x1c')];var _0x1d0083=_0x5424d3?0x0:_0x402dde[_0x6bee('0x1a')];var _0x3d7b4a=_0x5424d3?_0x371c5b[_0x6bee('0x1c')]:_0x402dde[_0x6bee('0x1a')]+_0x402dde[_0x6bee('0x1d')];var _0x3839c9;if(_0x3d7b4a>=_0x2deb46){_0x3d7b4a=_0x2deb46;_0x3839c9=0xc8;}else{_0x3839c9=0xce;}_0x59a436[_0x6bee('0x18')](_0x3839c9);return _0x59a436[_0x6bee('0x1e')](_0x6bee('0x1f'),_0x1d0083+'-'+_0x3d7b4a+'/'+_0x2deb46)[_0x6bee('0x19')](_0x371c5b);}return null;};}function patchUpdates(_0x14861a){return function(_0x39a1ec){try{jsonpatch[_0x6bee('0x20')](_0x39a1ec,_0x14861a,!![]);}catch(_0x23a668){return BPromise[_0x6bee('0x21')](_0x23a668);}return _0x39a1ec[_0x6bee('0x22')]();};}function saveUpdates(_0x3c175a,_0x141a6a){return function(_0x505e18){if(_0x505e18){return _0x505e18[_0x6bee('0x23')](_0x3c175a)[_0x6bee('0x24')](function(_0x27d5f2){return _0x27d5f2;});}return null;};}function removeEntity(_0x4b214c,_0x15c640){return function(_0x3ab95f){if(_0x3ab95f){return _0x3ab95f[_0x6bee('0x25')]()[_0x6bee('0x24')](function(){var _0xa5119e=_0x3ab95f[_0x6bee('0x26')]({'plain':!![]});var _0x3d8b86='Companies';return db['UserProfileResource'][_0x6bee('0x25')]({'where':{'type':_0x3d8b86,'resourceId':_0xa5119e['id']}})[_0x6bee('0x24')](function(){return _0x3ab95f;});})['then'](function(){_0x4b214c[_0x6bee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfd55,_0x2f5c34){return function(_0x29fb8d){if(!_0x29fb8d){_0x2cfd55[_0x6bee('0x27')](0x194);}return _0x29fb8d;};}function handleError(_0x23ebbe,_0x4bbf16){_0x4bbf16=_0x4bbf16||0x1f4;return function(_0x4132e8){logger[_0x6bee('0x28')](_0x4132e8[_0x6bee('0x29')]);if(_0x4132e8[_0x6bee('0x2a')]){delete _0x4132e8[_0x6bee('0x2a')];}_0x23ebbe[_0x6bee('0x18')](_0x4bbf16)[_0x6bee('0x2b')](_0x4132e8);};}exports['index']=function(_0x957d0,_0x46a698){var _0x4a92b7={},_0x2c7deb={},_0x128d88={'count':0x0,'rows':[]};return db[_0x6bee('0x2c')]['describe']()['then'](function(_0x278ba7){_0x2c7deb[_0x6bee('0x2d')]=_[_0x6bee('0x2e')](_0x278ba7);_0x2c7deb[_0x6bee('0x2f')]=_[_0x6bee('0x2e')](_0x957d0[_0x6bee('0x2f')]);_0x2c7deb[_0x6bee('0x30')]=_[_0x6bee('0x31')](_0x2c7deb['model'],_0x2c7deb['query']);_0x4a92b7[_0x6bee('0x32')]=_[_0x6bee('0x31')](_0x2c7deb[_0x6bee('0x2d')],qs[_0x6bee('0x33')](_0x957d0['query']['fields']));_0x4a92b7['attributes']=_0x4a92b7[_0x6bee('0x32')][_0x6bee('0x34')]?_0x4a92b7['attributes']:_0x2c7deb[_0x6bee('0x2d')];if(!_0x957d0[_0x6bee('0x2f')][_0x6bee('0x35')]('nolimit')){_0x4a92b7[_0x6bee('0x1d')]=qs[_0x6bee('0x1d')](_0x957d0['query']['limit']);_0x4a92b7[_0x6bee('0x1a')]=qs[_0x6bee('0x1a')](_0x957d0[_0x6bee('0x2f')][_0x6bee('0x1a')]);}_0x4a92b7['order']=qs[_0x6bee('0x36')](_0x957d0['query'][_0x6bee('0x36')]);_0x4a92b7[_0x6bee('0x37')]=qs['filters'](_[_0x6bee('0x38')](_0x957d0[_0x6bee('0x2f')],_0x2c7deb[_0x6bee('0x30')]),_0x278ba7);if(_0x957d0['query'][_0x6bee('0x39')]){_0x4a92b7['where']=_[_0x6bee('0x3a')](_0x4a92b7[_0x6bee('0x37')],{'$or':_[_0x6bee('0x3b')](_0x4a92b7[_0x6bee('0x32')],function(_0x8a35d4){var _0x30bb9e={};_0x30bb9e[_0x8a35d4]={'$like':'%'+_0x957d0['query'][_0x6bee('0x39')]+'%'};return _0x30bb9e;})});}_0x4a92b7=_[_0x6bee('0x3a')]({},_0x4a92b7,_0x957d0[_0x6bee('0x3c')]);var _0x58b2a7={'where':_0x4a92b7['where']};return db[_0x6bee('0x2c')][_0x6bee('0x1c')](_0x58b2a7)['then'](function(_0x5023cc){_0x128d88['count']=_0x5023cc;if(_0x957d0[_0x6bee('0x2f')][_0x6bee('0x3d')]){_0x4a92b7[_0x6bee('0x3e')]=[{'all':!![]}];}return db[_0x6bee('0x2c')][_0x6bee('0x3f')](_0x4a92b7);})[_0x6bee('0x24')](function(_0x264c86){_0x128d88['rows']=_0x264c86;return _0x128d88;})[_0x6bee('0x24')](respondWithFilteredResult(_0x46a698,_0x4a92b7))['catch'](handleError(_0x46a698,null));})[_0x6bee('0x40')](handleError(_0x46a698,null));};exports[_0x6bee('0x41')]=function(_0x36d965,_0x56210e){var _0x39532c={'raw':![],'where':{'id':_0x36d965[_0x6bee('0x42')]['id']}},_0x4909de={};_0x4909de[_0x6bee('0x2d')]=_['keys'](db[_0x6bee('0x2c')][_0x6bee('0x43')]);_0x4909de[_0x6bee('0x2f')]=_[_0x6bee('0x2e')](_0x36d965['query']);_0x4909de[_0x6bee('0x30')]=_[_0x6bee('0x31')](_0x4909de[_0x6bee('0x2d')],_0x4909de['query']);_0x39532c['attributes']=_[_0x6bee('0x31')](_0x4909de[_0x6bee('0x2d')],qs['fields'](_0x36d965[_0x6bee('0x2f')][_0x6bee('0x33')]));_0x39532c[_0x6bee('0x32')]=_0x39532c[_0x6bee('0x32')][_0x6bee('0x34')]?_0x39532c[_0x6bee('0x32')]:_0x4909de[_0x6bee('0x2d')];if(_0x36d965[_0x6bee('0x2f')]['includeAll']){_0x39532c[_0x6bee('0x3e')]=[{'all':!![]}];}_0x39532c=_[_0x6bee('0x3a')]({},_0x39532c,_0x36d965[_0x6bee('0x3c')]);return db[_0x6bee('0x2c')][_0x6bee('0x44')](_0x39532c)[_0x6bee('0x24')](handleEntityNotFound(_0x56210e,null))[_0x6bee('0x24')](respondWithResult(_0x56210e,null))[_0x6bee('0x40')](handleError(_0x56210e,null));};exports[_0x6bee('0x45')]=function(_0x1a75a1,_0x1891a1){return db[_0x6bee('0x2c')][_0x6bee('0x45')](_0x1a75a1[_0x6bee('0x46')],{})[_0x6bee('0x24')](function(_0x784c5){var _0x42ad75=_0x1a75a1[_0x6bee('0x47')][_0x6bee('0x26')]({'plain':!![]});if(!_0x42ad75)throw new Error(_0x6bee('0x48'));if(_0x42ad75[_0x6bee('0x49')]==='user'){var _0x5070b3=_0x784c5[_0x6bee('0x26')]({'plain':!![]});var _0x15457b=_0x6bee('0x4a');return db[_0x6bee('0x4b')]['find']({'where':{'name':_0x15457b,'userProfileId':_0x42ad75[_0x6bee('0x4c')]},'raw':!![]})['then'](function(_0x9868fd){if(_0x9868fd&&_0x9868fd['autoAssociation']===0x0){return db[_0x6bee('0x4d')][_0x6bee('0x45')]({'name':_0x5070b3[_0x6bee('0x2a')],'resourceId':_0x5070b3['id'],'type':_0x9868fd[_0x6bee('0x2a')],'sectionId':_0x9868fd['id']},{})[_0x6bee('0x24')](function(){return _0x784c5;});}else{return _0x784c5;}})['catch'](function(_0x392c4b){logger['error'](_0x6bee('0x4e'),_0x392c4b);throw _0x392c4b;});}return _0x784c5;})['then'](respondWithResult(_0x1891a1,0xc9))['catch'](handleError(_0x1891a1,null));};exports[_0x6bee('0x23')]=function(_0x11d684,_0x2195fd){if(_0x11d684[_0x6bee('0x46')]['id']){delete _0x11d684[_0x6bee('0x46')]['id'];}return db['CmCompany'][_0x6bee('0x44')]({'where':{'id':_0x11d684[_0x6bee('0x42')]['id']}})[_0x6bee('0x24')](handleEntityNotFound(_0x2195fd,null))[_0x6bee('0x24')](saveUpdates(_0x11d684['body'],null))[_0x6bee('0x24')](respondWithResult(_0x2195fd,null))[_0x6bee('0x40')](handleError(_0x2195fd,null));};exports[_0x6bee('0x25')]=function(_0x2446e2,_0x3f4c7b){return db[_0x6bee('0x2c')][_0x6bee('0x44')]({'where':{'id':_0x2446e2[_0x6bee('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f4c7b,null))[_0x6bee('0x24')](removeEntity(_0x3f4c7b,null))['catch'](handleError(_0x3f4c7b,null));};exports[_0x6bee('0x4f')]=function(_0x1c9c7a,_0x3b32bc){return db[_0x6bee('0x2c')][_0x6bee('0x4f')]()[_0x6bee('0x24')](respondWithResult(_0x3b32bc,null))[_0x6bee('0x40')](handleError(_0x3b32bc,null));};exports[_0x6bee('0x50')]=function(_0x1169ca,_0x110384,_0x1b757d){return db[_0x6bee('0x51')][_0x6bee('0x44')]({'where':{'id':_0x1169ca[_0x6bee('0x42')]['id']}})[_0x6bee('0x24')](handleEntityNotFound(_0x110384,null))[_0x6bee('0x24')](function(_0x5b8bd3){if(_0x5b8bd3){return _0x5b8bd3[_0x6bee('0x50')](_0x1169ca[_0x6bee('0x46')][_0x6bee('0x52')],_['omit'](_0x1169ca[_0x6bee('0x46')],['ids','id'])||{});}})[_0x6bee('0x24')](respondWithResult(_0x110384,null))[_0x6bee('0x40')](handleError(_0x110384,null));};exports[_0x6bee('0x53')]=function(_0x4b0144,_0x1af774,_0x5572b8){var _0x5b2c6c={};var _0x52b9a7={};var _0x1d59e6;var _0x2f3f0a;return db[_0x6bee('0x2c')][_0x6bee('0x54')]({'where':{'id':_0x4b0144['params']['id']}})['then'](handleEntityNotFound(_0x1af774,null))['then'](function(_0x35d06d){if(_0x35d06d){_0x1d59e6=_0x35d06d;_0x52b9a7[_0x6bee('0x2d')]=_[_0x6bee('0x2e')](db[_0x6bee('0x51')][_0x6bee('0x43')]);_0x52b9a7['query']=_[_0x6bee('0x2e')](_0x4b0144[_0x6bee('0x2f')]);_0x52b9a7[_0x6bee('0x30')]=_[_0x6bee('0x31')](_0x52b9a7[_0x6bee('0x2d')],_0x52b9a7[_0x6bee('0x2f')]);_0x5b2c6c[_0x6bee('0x32')]=_[_0x6bee('0x31')](_0x52b9a7['model'],qs[_0x6bee('0x33')](_0x4b0144[_0x6bee('0x2f')][_0x6bee('0x33')]));_0x5b2c6c['attributes']=_0x5b2c6c[_0x6bee('0x32')][_0x6bee('0x34')]?_0x5b2c6c['attributes']:_0x52b9a7[_0x6bee('0x2d')];_0x5b2c6c[_0x6bee('0x55')]=qs[_0x6bee('0x36')](_0x4b0144[_0x6bee('0x2f')][_0x6bee('0x36')]);_0x5b2c6c[_0x6bee('0x37')]=qs[_0x6bee('0x30')](_[_0x6bee('0x38')](_0x4b0144[_0x6bee('0x2f')],_0x52b9a7['filters']));if(_0x4b0144[_0x6bee('0x2f')][_0x6bee('0x39')]){_0x5b2c6c[_0x6bee('0x37')]=_[_0x6bee('0x3a')](_0x5b2c6c[_0x6bee('0x37')],{'$or':_[_0x6bee('0x3b')](_0x5b2c6c['attributes'],function(_0x53f188){var _0x2a7682={};_0x2a7682[_0x53f188]={'$like':'%'+_0x4b0144[_0x6bee('0x2f')]['filter']+'%'};return _0x2a7682;})});}_0x5b2c6c=_['merge']({},_0x5b2c6c,_0x4b0144['options']);return _0x1d59e6[_0x6bee('0x53')](_0x5b2c6c);}})[_0x6bee('0x24')](function(_0x10ab72){if(_0x10ab72){_0x2f3f0a=_0x10ab72[_0x6bee('0x34')];if(!_0x4b0144[_0x6bee('0x2f')]['hasOwnProperty'](_0x6bee('0x56'))){_0x5b2c6c[_0x6bee('0x1d')]=qs[_0x6bee('0x1d')](_0x4b0144['query']['limit']);_0x5b2c6c[_0x6bee('0x1a')]=qs[_0x6bee('0x1a')](_0x4b0144[_0x6bee('0x2f')][_0x6bee('0x1a')]);}return _0x1d59e6['getContacts'](_0x5b2c6c);}})[_0x6bee('0x24')](function(_0x54ac27){if(_0x54ac27){return _0x54ac27?{'count':_0x2f3f0a,'rows':_0x54ac27}:null;}})['then'](respondWithResult(_0x1af774,null))['catch'](handleError(_0x1af774,null));}; \ No newline at end of file +var _0x68b8=['name','index','CmCompany','describe','query','filters','intersection','attributes','model','length','order','sort','where','pick','filter','merge','map','includeAll','include','rows','catch','show','params','keys','rawAttributes','fields','options','find','create','body','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','getContacts','findOne','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','Companies','error','stack'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0x68b8,0x134));var _0x868b=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x68b8[_0x545bed];return _0x16c79c;};'use strict';var emlformat=require(_0x868b('0x0'));var rimraf=require(_0x868b('0x1'));var zipdir=require(_0x868b('0x2'));var jsonpatch=require(_0x868b('0x3'));var rp=require('request-promise');var moment=require(_0x868b('0x4'));var BPromise=require(_0x868b('0x5'));var Mustache=require(_0x868b('0x6'));var util=require(_0x868b('0x7'));var path=require(_0x868b('0x8'));var sox=require(_0x868b('0x9'));var csv=require(_0x868b('0xa'));var ejs=require(_0x868b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x868b('0xc'));var squel=require(_0x868b('0xd'));var crypto=require('crypto');var jsforce=require(_0x868b('0xe'));var deskjs=require(_0x868b('0xf'));var toCsv=require(_0x868b('0xa'));var querystring=require(_0x868b('0x10'));var Papa=require(_0x868b('0x11'));var Redis=require(_0x868b('0x12'));var authService=require(_0x868b('0x13'));var qs=require(_0x868b('0x14'));var as=require(_0x868b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x868b('0x16'))('api');var utils=require(_0x868b('0x17'));var config=require(_0x868b('0x18'));var licenseUtil=require(_0x868b('0x19'));var db=require(_0x868b('0x1a'))['db'];function respondWithStatusCode(_0x489e26,_0x48ef50){_0x48ef50=_0x48ef50||0xcc;return function(_0x5e8993){if(_0x5e8993){return _0x489e26[_0x868b('0x1b')](_0x48ef50);}return _0x489e26['status'](_0x48ef50)[_0x868b('0x1c')]();};}function respondWithResult(_0x5b0f31,_0x2a5c3c){_0x2a5c3c=_0x2a5c3c||0xc8;return function(_0x4c9925){if(_0x4c9925){return _0x5b0f31[_0x868b('0x1d')](_0x2a5c3c)[_0x868b('0x1e')](_0x4c9925);}};}function respondWithFilteredResult(_0x45d333,_0xe35d54){return function(_0x464d0e){if(_0x464d0e){var _0x538209=typeof _0xe35d54[_0x868b('0x1f')]===_0x868b('0x20')&&typeof _0xe35d54[_0x868b('0x21')]===_0x868b('0x20');var _0x480d73=_0x464d0e[_0x868b('0x22')];var _0x327a6c=_0x538209?0x0:_0xe35d54[_0x868b('0x1f')];var _0x18944b=_0x538209?_0x464d0e['count']:_0xe35d54[_0x868b('0x1f')]+_0xe35d54[_0x868b('0x21')];var _0x76664a;if(_0x18944b>=_0x480d73){_0x18944b=_0x480d73;_0x76664a=0xc8;}else{_0x76664a=0xce;}_0x45d333[_0x868b('0x1d')](_0x76664a);return _0x45d333['set'](_0x868b('0x23'),_0x327a6c+'-'+_0x18944b+'/'+_0x480d73)['json'](_0x464d0e);}return null;};}function patchUpdates(_0x5e7332){return function(_0x5831e7){try{jsonpatch[_0x868b('0x24')](_0x5831e7,_0x5e7332,!![]);}catch(_0x4e92aa){return BPromise['reject'](_0x4e92aa);}return _0x5831e7[_0x868b('0x25')]();};}function saveUpdates(_0x59982c,_0x2caed9){return function(_0x3d9bc8){if(_0x3d9bc8){return _0x3d9bc8[_0x868b('0x26')](_0x59982c)[_0x868b('0x27')](function(_0x24a81c){return _0x24a81c;});}return null;};}function removeEntity(_0xb8b1cf,_0x18c005){return function(_0x1ff995){if(_0x1ff995){return _0x1ff995[_0x868b('0x28')]()['then'](function(){var _0x281469=_0x1ff995['get']({'plain':!![]});var _0x2bc572=_0x868b('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x2bc572,'resourceId':_0x281469['id']}})[_0x868b('0x27')](function(){return _0x1ff995;});})[_0x868b('0x27')](function(){_0xb8b1cf[_0x868b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16848b,_0x3c430f){return function(_0x31f909){if(!_0x31f909){_0x16848b[_0x868b('0x1b')](0x194);}return _0x31f909;};}function handleError(_0x59773f,_0x3a0b6f){_0x3a0b6f=_0x3a0b6f||0x1f4;return function(_0x5a9a57){logger[_0x868b('0x2a')](_0x5a9a57[_0x868b('0x2b')]);if(_0x5a9a57[_0x868b('0x2c')]){delete _0x5a9a57['name'];}_0x59773f[_0x868b('0x1d')](_0x3a0b6f)['send'](_0x5a9a57);};}exports[_0x868b('0x2d')]=function(_0x3c38e4,_0x64e5a4){var _0x210233={},_0x5cb03b={},_0x4c014f={'count':0x0,'rows':[]};return db[_0x868b('0x2e')][_0x868b('0x2f')]()[_0x868b('0x27')](function(_0x17fab5){_0x5cb03b['model']=_['keys'](_0x17fab5);_0x5cb03b[_0x868b('0x30')]=_['keys'](_0x3c38e4['query']);_0x5cb03b[_0x868b('0x31')]=_[_0x868b('0x32')](_0x5cb03b['model'],_0x5cb03b['query']);_0x210233[_0x868b('0x33')]=_['intersection'](_0x5cb03b[_0x868b('0x34')],qs['fields'](_0x3c38e4[_0x868b('0x30')]['fields']));_0x210233[_0x868b('0x33')]=_0x210233['attributes'][_0x868b('0x35')]?_0x210233[_0x868b('0x33')]:_0x5cb03b['model'];if(!_0x3c38e4[_0x868b('0x30')]['hasOwnProperty']('nolimit')){_0x210233[_0x868b('0x21')]=qs['limit'](_0x3c38e4[_0x868b('0x30')][_0x868b('0x21')]);_0x210233[_0x868b('0x1f')]=qs['offset'](_0x3c38e4[_0x868b('0x30')][_0x868b('0x1f')]);}_0x210233[_0x868b('0x36')]=qs[_0x868b('0x37')](_0x3c38e4[_0x868b('0x30')][_0x868b('0x37')]);_0x210233[_0x868b('0x38')]=qs['filters'](_[_0x868b('0x39')](_0x3c38e4[_0x868b('0x30')],_0x5cb03b[_0x868b('0x31')]),_0x17fab5);if(_0x3c38e4['query'][_0x868b('0x3a')]){_0x210233[_0x868b('0x38')]=_[_0x868b('0x3b')](_0x210233[_0x868b('0x38')],{'$or':_[_0x868b('0x3c')](_0x210233[_0x868b('0x33')],function(_0x249666){var _0x59f1f9={};_0x59f1f9[_0x249666]={'$like':'%'+_0x3c38e4['query'][_0x868b('0x3a')]+'%'};return _0x59f1f9;})});}_0x210233=_[_0x868b('0x3b')]({},_0x210233,_0x3c38e4['options']);var _0x519a24={'where':_0x210233[_0x868b('0x38')]};return db[_0x868b('0x2e')]['count'](_0x519a24)[_0x868b('0x27')](function(_0x2c9783){_0x4c014f['count']=_0x2c9783;if(_0x3c38e4['query'][_0x868b('0x3d')]){_0x210233[_0x868b('0x3e')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x210233);})[_0x868b('0x27')](function(_0x445d74){_0x4c014f[_0x868b('0x3f')]=_0x445d74;return _0x4c014f;})[_0x868b('0x27')](respondWithFilteredResult(_0x64e5a4,_0x210233))[_0x868b('0x40')](handleError(_0x64e5a4,null));})[_0x868b('0x40')](handleError(_0x64e5a4,null));};exports[_0x868b('0x41')]=function(_0x203a12,_0x1d33e4){var _0x24df84={'raw':![],'where':{'id':_0x203a12[_0x868b('0x42')]['id']}},_0x1aed35={};_0x1aed35[_0x868b('0x34')]=_[_0x868b('0x43')](db['CmCompany'][_0x868b('0x44')]);_0x1aed35[_0x868b('0x30')]=_[_0x868b('0x43')](_0x203a12[_0x868b('0x30')]);_0x1aed35[_0x868b('0x31')]=_[_0x868b('0x32')](_0x1aed35['model'],_0x1aed35[_0x868b('0x30')]);_0x24df84[_0x868b('0x33')]=_[_0x868b('0x32')](_0x1aed35['model'],qs[_0x868b('0x45')](_0x203a12[_0x868b('0x30')][_0x868b('0x45')]));_0x24df84[_0x868b('0x33')]=_0x24df84[_0x868b('0x33')][_0x868b('0x35')]?_0x24df84['attributes']:_0x1aed35[_0x868b('0x34')];if(_0x203a12[_0x868b('0x30')][_0x868b('0x3d')]){_0x24df84['include']=[{'all':!![]}];}_0x24df84=_[_0x868b('0x3b')]({},_0x24df84,_0x203a12[_0x868b('0x46')]);return db[_0x868b('0x2e')][_0x868b('0x47')](_0x24df84)[_0x868b('0x27')](handleEntityNotFound(_0x1d33e4,null))[_0x868b('0x27')](respondWithResult(_0x1d33e4,null))[_0x868b('0x40')](handleError(_0x1d33e4,null));};exports[_0x868b('0x48')]=function(_0x2dc236,_0x3c3899){return db[_0x868b('0x2e')][_0x868b('0x48')](_0x2dc236[_0x868b('0x49')],{})[_0x868b('0x27')](function(_0x41d467){var _0x2fe604=_0x2dc236[_0x868b('0x4a')][_0x868b('0x4b')]({'plain':!![]});if(!_0x2fe604)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fe604[_0x868b('0x4c')]===_0x868b('0x4a')){var _0xd25200=_0x41d467['get']({'plain':!![]});var _0x121ef9=_0x868b('0x29');return db[_0x868b('0x4d')]['find']({'where':{'name':_0x121ef9,'userProfileId':_0x2fe604['userProfileId']},'raw':!![]})[_0x868b('0x27')](function(_0x366922){if(_0x366922&&_0x366922[_0x868b('0x4e')]===0x0){return db[_0x868b('0x4f')][_0x868b('0x48')]({'name':_0xd25200['name'],'resourceId':_0xd25200['id'],'type':_0x366922[_0x868b('0x2c')],'sectionId':_0x366922['id']},{})[_0x868b('0x27')](function(){return _0x41d467;});}else{return _0x41d467;}})['catch'](function(_0xa39443){logger[_0x868b('0x2a')](_0x868b('0x50'),_0xa39443);throw _0xa39443;});}return _0x41d467;})['then'](respondWithResult(_0x3c3899,0xc9))[_0x868b('0x40')](handleError(_0x3c3899,null));};exports['update']=function(_0x5714fd,_0x401b51){if(_0x5714fd[_0x868b('0x49')]['id']){delete _0x5714fd[_0x868b('0x49')]['id'];}return db[_0x868b('0x2e')][_0x868b('0x47')]({'where':{'id':_0x5714fd[_0x868b('0x42')]['id']}})[_0x868b('0x27')](handleEntityNotFound(_0x401b51,null))[_0x868b('0x27')](saveUpdates(_0x5714fd[_0x868b('0x49')],null))[_0x868b('0x27')](respondWithResult(_0x401b51,null))[_0x868b('0x40')](handleError(_0x401b51,null));};exports[_0x868b('0x28')]=function(_0x926d50,_0x4a70f1){return db[_0x868b('0x2e')][_0x868b('0x47')]({'where':{'id':_0x926d50['params']['id']}})['then'](handleEntityNotFound(_0x4a70f1,null))[_0x868b('0x27')](removeEntity(_0x4a70f1,null))[_0x868b('0x40')](handleError(_0x4a70f1,null));};exports['describe']=function(_0x36c01b,_0x2db558){return db['CmCompany'][_0x868b('0x2f')]()['then'](respondWithResult(_0x2db558,null))[_0x868b('0x40')](handleError(_0x2db558,null));};exports[_0x868b('0x51')]=function(_0x10515c,_0x496220,_0x40b2a8){return db[_0x868b('0x52')][_0x868b('0x47')]({'where':{'id':_0x10515c[_0x868b('0x42')]['id']}})['then'](handleEntityNotFound(_0x496220,null))['then'](function(_0x2fd2a7){if(_0x2fd2a7){return _0x2fd2a7[_0x868b('0x51')](_0x10515c['body']['ids'],_[_0x868b('0x53')](_0x10515c[_0x868b('0x49')],[_0x868b('0x54'),'id'])||{});}})[_0x868b('0x27')](respondWithResult(_0x496220,null))[_0x868b('0x40')](handleError(_0x496220,null));};exports[_0x868b('0x55')]=function(_0x4412dd,_0x65745a,_0x464233){var _0x4a53e5={};var _0x254975={};var _0xfd312d;var _0x46be0f;return db[_0x868b('0x2e')][_0x868b('0x56')]({'where':{'id':_0x4412dd[_0x868b('0x42')]['id']}})['then'](handleEntityNotFound(_0x65745a,null))[_0x868b('0x27')](function(_0x599ef7){if(_0x599ef7){_0xfd312d=_0x599ef7;_0x254975[_0x868b('0x34')]=_[_0x868b('0x43')](db[_0x868b('0x52')][_0x868b('0x44')]);_0x254975[_0x868b('0x30')]=_['keys'](_0x4412dd['query']);_0x254975[_0x868b('0x31')]=_[_0x868b('0x32')](_0x254975[_0x868b('0x34')],_0x254975[_0x868b('0x30')]);_0x4a53e5[_0x868b('0x33')]=_[_0x868b('0x32')](_0x254975['model'],qs[_0x868b('0x45')](_0x4412dd[_0x868b('0x30')]['fields']));_0x4a53e5[_0x868b('0x33')]=_0x4a53e5[_0x868b('0x33')]['length']?_0x4a53e5[_0x868b('0x33')]:_0x254975[_0x868b('0x34')];_0x4a53e5['order']=qs[_0x868b('0x37')](_0x4412dd[_0x868b('0x30')][_0x868b('0x37')]);_0x4a53e5['where']=qs[_0x868b('0x31')](_[_0x868b('0x39')](_0x4412dd[_0x868b('0x30')],_0x254975[_0x868b('0x31')]));if(_0x4412dd['query'][_0x868b('0x3a')]){_0x4a53e5[_0x868b('0x38')]=_[_0x868b('0x3b')](_0x4a53e5[_0x868b('0x38')],{'$or':_[_0x868b('0x3c')](_0x4a53e5[_0x868b('0x33')],function(_0x517ffa){var _0x4c5157={};_0x4c5157[_0x517ffa]={'$like':'%'+_0x4412dd[_0x868b('0x30')]['filter']+'%'};return _0x4c5157;})});}_0x4a53e5=_[_0x868b('0x3b')]({},_0x4a53e5,_0x4412dd[_0x868b('0x46')]);return _0xfd312d['getContacts'](_0x4a53e5);}})[_0x868b('0x27')](function(_0x442869){if(_0x442869){_0x46be0f=_0x442869[_0x868b('0x35')];if(!_0x4412dd[_0x868b('0x30')]['hasOwnProperty'](_0x868b('0x57'))){_0x4a53e5[_0x868b('0x21')]=qs[_0x868b('0x21')](_0x4412dd[_0x868b('0x30')][_0x868b('0x21')]);_0x4a53e5[_0x868b('0x1f')]=qs['offset'](_0x4412dd[_0x868b('0x30')][_0x868b('0x1f')]);}return _0xfd312d[_0x868b('0x55')](_0x4a53e5);}})[_0x868b('0x27')](function(_0x5958b2){if(_0x5958b2){return _0x5958b2?{'count':_0x46be0f,'rows':_0x5958b2}:null;}})[_0x868b('0x27')](respondWithResult(_0x65745a,null))[_0x868b('0x40')](handleError(_0x65745a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8433261..e2828f1 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 _0x33d5=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','CmCompany','cm_companies','lodash','util'];(function(_0x1bcf71,_0x23f1a7){var _0x1c9c77=function(_0x5a5fcb){while(--_0x5a5fcb){_0x1bcf71['push'](_0x1bcf71['shift']());}};_0x1c9c77(++_0x23f1a7);}(_0x33d5,0x136));var _0x533d=function(_0x746366,_0x2c25b2){_0x746366=_0x746366-0x0;var _0x3d19c3=_0x33d5[_0x746366];return _0x3d19c3;};'use strict';var _=require(_0x533d('0x0'));var util=require(_0x533d('0x1'));var logger=require(_0x533d('0x2'))(_0x533d('0x3'));var moment=require(_0x533d('0x4'));var BPromise=require(_0x533d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x533d('0x6'));var rimraf=require(_0x533d('0x7'));var config=require(_0x533d('0x8'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0xb4e962,_0x53bb78){return _0xb4e962[_0x533d('0x9')](_0x533d('0xa'),attributes,{'tableName':_0x533d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf841=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x11c06c,_0x5e400f){var _0x2e7f2c=function(_0x4eda01){while(--_0x4eda01){_0x11c06c['push'](_0x11c06c['shift']());}};_0x2e7f2c(++_0x5e400f);}(_0xf841,0x198));var _0x1f84=function(_0x395aaf,_0x48a467){_0x395aaf=_0x395aaf-0x0;var _0x1b39d3=_0xf841[_0x395aaf];return _0x1b39d3;};'use strict';var _=require(_0x1f84('0x0'));var util=require(_0x1f84('0x1'));var logger=require(_0x1f84('0x2'))(_0x1f84('0x3'));var moment=require(_0x1f84('0x4'));var BPromise=require(_0x1f84('0x5'));var rp=require(_0x1f84('0x6'));var fs=require('fs');var path=require(_0x1f84('0x7'));var rimraf=require('rimraf');var config=require(_0x1f84('0x8'));var attributes=require(_0x1f84('0x9'));module[_0x1f84('0xa')]=function(_0x5b616a,_0x3631c3){return _0x5b616a[_0x1f84('0xb')](_0x1f84('0xc'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index a7f6b65..c164a98 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 _0xb742=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','CmCompany,\x20%s,\x20%s'];(function(_0x57cc38,_0x471274){var _0x571228=function(_0xc80995){while(--_0xc80995){_0x57cc38['push'](_0x57cc38['shift']());}};_0x571228(++_0x471274);}(_0xb742,0x12e));var _0x2b74=function(_0x5f8000,_0x4a56b1){_0x5f8000=_0x5f8000-0x0;var _0xc8f261=_0xb742[_0x5f8000];return _0xc8f261;};'use strict';var _=require(_0x2b74('0x0'));var util=require('util');var moment=require(_0x2b74('0x1'));var BPromise=require(_0x2b74('0x2'));var rs=require(_0x2b74('0x3'));var fs=require('fs');var Redis=require(_0x2b74('0x4'));var db=require(_0x2b74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b74('0x6'))(_0x2b74('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b74('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45f873,_0x56a15b,_0x4558b0){return new BPromise(function(_0x35d115,_0xa1299f){return client[_0x2b74('0x9')](_0x45f873,_0x4558b0)['then'](function(_0xd64b5b){logger[_0x2b74('0xa')]('CmCompany,\x20%s,\x20%s',_0x56a15b,_0x2b74('0xb'));logger[_0x2b74('0xc')](_0x2b74('0xd'),_0x56a15b,_0x2b74('0xb'),JSON[_0x2b74('0xe')](_0xd64b5b));if(_0xd64b5b['error']){if(_0xd64b5b[_0x2b74('0xf')]['code']===0x1f4){logger[_0x2b74('0xf')]('CmCompany,\x20%s,\x20%s',_0x56a15b,_0xd64b5b[_0x2b74('0xf')][_0x2b74('0x10')]);return _0xa1299f(_0xd64b5b[_0x2b74('0xf')]['message']);}logger['error'](_0x2b74('0x11'),_0x56a15b,_0xd64b5b[_0x2b74('0xf')][_0x2b74('0x10')]);return _0x35d115(_0xd64b5b[_0x2b74('0xf')][_0x2b74('0x10')]);}else{logger[_0x2b74('0xa')]('CmCompany,\x20%s,\x20%s',_0x56a15b,_0x2b74('0xb'));_0x35d115(_0xd64b5b[_0x2b74('0x12')]['message']);}})[_0x2b74('0x13')](function(_0xf63c0a){logger[_0x2b74('0xf')]('CmCompany,\x20%s,\x20%s',_0x56a15b,_0xf63c0a);_0xa1299f(_0xf63c0a);});});} \ No newline at end of file +var _0xd1f0=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','moment','bluebird'];(function(_0x425e82,_0x25d2e4){var _0x136fd6=function(_0x346a8b){while(--_0x346a8b){_0x425e82['push'](_0x425e82['shift']());}};_0x136fd6(++_0x25d2e4);}(_0xd1f0,0xe5));var _0x0d1f=function(_0xe7c36a,_0x641105){_0xe7c36a=_0xe7c36a-0x0;var _0x8b1186=_0xd1f0[_0xe7c36a];return _0x8b1186;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d1f('0x0'));var BPromise=require(_0x0d1f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d1f('0x2'));var db=require(_0x0d1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d1f('0x4'))(_0x0d1f('0x5'));var config=require(_0x0d1f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0d1f('0x7')][_0x0d1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2be233,_0x3297af,_0x2ee764){return new BPromise(function(_0x5d0d22,_0x29c073){return client[_0x0d1f('0x9')](_0x2be233,_0x2ee764)[_0x0d1f('0xa')](function(_0x4925e8){logger[_0x0d1f('0xb')]('CmCompany,\x20%s,\x20%s',_0x3297af,_0x0d1f('0xc'));logger[_0x0d1f('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3297af,_0x0d1f('0xc'),JSON[_0x0d1f('0xe')](_0x4925e8));if(_0x4925e8['error']){if(_0x4925e8[_0x0d1f('0xf')][_0x0d1f('0x10')]===0x1f4){logger[_0x0d1f('0xf')]('CmCompany,\x20%s,\x20%s',_0x3297af,_0x4925e8[_0x0d1f('0xf')][_0x0d1f('0x11')]);return _0x29c073(_0x4925e8[_0x0d1f('0xf')][_0x0d1f('0x11')]);}logger['error'](_0x0d1f('0x12'),_0x3297af,_0x4925e8[_0x0d1f('0xf')][_0x0d1f('0x11')]);return _0x5d0d22(_0x4925e8['error']['message']);}else{logger[_0x0d1f('0xb')](_0x0d1f('0x12'),_0x3297af,'request\x20sent');_0x5d0d22(_0x4925e8[_0x0d1f('0x13')][_0x0d1f('0x11')]);}})[_0x0d1f('0x14')](function(_0x1783f5){logger[_0x0d1f('0xf')](_0x0d1f('0x12'),_0x3297af,_0x1783f5);_0x29c073(_0x1783f5);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index f431d1a..a22b74b 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 _0x976c=['post','create','addContacts','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','describe','/:id','isAuthenticated','show','/:id/contacts','getContacts'];(function(_0x58a73e,_0x219f97){var _0x3c9492=function(_0x2917f8){while(--_0x2917f8){_0x58a73e['push'](_0x58a73e['shift']());}};_0x3c9492(++_0x219f97);}(_0x976c,0x1bf));var _0xc976=function(_0x2a5d30,_0x4803d1){_0x2a5d30=_0x2a5d30-0x0;var _0x24257d=_0x976c[_0x2a5d30];return _0x24257d;};'use strict';var multer=require(_0xc976('0x0'));var util=require('util');var path=require(_0xc976('0x1'));var timeout=require(_0xc976('0x2'));var express=require('express');var router=express[_0xc976('0x3')]();var fs_extra=require(_0xc976('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc976('0x5'));var config=require(_0xc976('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc976('0x7')]);router[_0xc976('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc976('0x9')]);router[_0xc976('0x8')](_0xc976('0xa'),auth[_0xc976('0xb')](),controller[_0xc976('0xc')]);router['get'](_0xc976('0xd'),auth[_0xc976('0xb')](),controller[_0xc976('0xe')]);router[_0xc976('0xf')]('/',auth[_0xc976('0xb')](),controller[_0xc976('0x10')]);router[_0xc976('0xf')](_0xc976('0xd'),auth['isAuthenticated'](),controller[_0xc976('0x11')]);router[_0xc976('0x12')](_0xc976('0xa'),auth[_0xc976('0xb')](),controller[_0xc976('0x13')]);router['delete'](_0xc976('0xa'),auth[_0xc976('0xb')](),controller[_0xc976('0x14')]);module[_0xc976('0x15')]=router; \ No newline at end of file +var _0xb418=['/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index'];(function(_0x32b1f8,_0x21ec79){var _0x2994c9=function(_0x1e522b){while(--_0x1e522b){_0x32b1f8['push'](_0x32b1f8['shift']());}};_0x2994c9(++_0x21ec79);}(_0xb418,0x7f));var _0x8b41=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb418[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0x8b41('0x0'));var util=require(_0x8b41('0x1'));var path=require(_0x8b41('0x2'));var timeout=require(_0x8b41('0x3'));var express=require(_0x8b41('0x4'));var router=express[_0x8b41('0x5')]();var fs_extra=require(_0x8b41('0x6'));var auth=require(_0x8b41('0x7'));var interaction=require(_0x8b41('0x8'));var config=require(_0x8b41('0x9'));var controller=require(_0x8b41('0xa'));router[_0x8b41('0xb')]('/',auth['isAuthenticated'](),controller[_0x8b41('0xc')]);router['get'](_0x8b41('0xd'),auth[_0x8b41('0xe')](),controller[_0x8b41('0xf')]);router[_0x8b41('0xb')](_0x8b41('0x10'),auth[_0x8b41('0xe')](),controller[_0x8b41('0x11')]);router[_0x8b41('0xb')]('/:id/contacts',auth[_0x8b41('0xe')](),controller[_0x8b41('0x12')]);router[_0x8b41('0x13')]('/',auth[_0x8b41('0xe')](),controller[_0x8b41('0x14')]);router[_0x8b41('0x13')](_0x8b41('0x15'),auth[_0x8b41('0xe')](),controller[_0x8b41('0x16')]);router[_0x8b41('0x17')](_0x8b41('0x10'),auth['isAuthenticated'](),controller[_0x8b41('0x18')]);router[_0x8b41('0x19')](_0x8b41('0x10'),auth[_0x8b41('0xe')](),controller[_0x8b41('0x1a')]);module[_0x8b41('0x1b')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 9f34fc1..87f5ca6 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 _0x3d74=['INTEGER','UNSIGNED','DATE','lodash','sequelize','exports','STRING','TEXT'];(function(_0x58ab22,_0x42c988){var _0x3bedba=function(_0x121f16){while(--_0x121f16){_0x58ab22['push'](_0x58ab22['shift']());}};_0x3bedba(++_0x42c988);}(_0x3d74,0x11b));var _0x43d7=function(_0x5abe7f,_0x23775a){_0x5abe7f=_0x5abe7f-0x0;var _0x415ae1=_0x3d74[_0x5abe7f];return _0x415ae1;};'use strict';var _=require(_0x43d7('0x0'));var Sequelize=require(_0x43d7('0x1'));module[_0x43d7('0x2')]={'firstName':{'type':Sequelize[_0x43d7('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x43d7('0x3')]},'street':{'type':Sequelize[_0x43d7('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x43d7('0x3')]},'country':{'type':Sequelize[_0x43d7('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43d7('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x43d7('0x3')]},'email':{'type':Sequelize[_0x43d7('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x43d7('0x3')]},'fb_data':{'type':Sequelize[_0x43d7('0x3')]},'twitter':{'type':Sequelize[_0x43d7('0x3')]},'skype':{'type':Sequelize[_0x43d7('0x3')]},'teams':{'type':Sequelize[_0x43d7('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x43d7('0x3')]},'telegram':{'type':Sequelize[_0x43d7('0x3')]},'UserId':{'type':Sequelize[_0x43d7('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x43d7('0x3')]},'priority':{'type':Sequelize[_0x43d7('0x5')](0x2)[_0x43d7('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x43d7('0x7')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x43d7('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7033=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0x7033,0xda));var _0x3703=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7033[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3703('0x0'));var Sequelize=require(_0x3703('0x1'));module[_0x3703('0x2')]={'firstName':{'type':Sequelize[_0x3703('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x3703('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3703('0x3')]},'country':{'type':Sequelize[_0x3703('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3703('0x4')]},'phone':{'type':Sequelize[_0x3703('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3703('0x3')]},'email':{'type':Sequelize[_0x3703('0x3')]},'url':{'type':Sequelize[_0x3703('0x3')]},'facebook':{'type':Sequelize[_0x3703('0x3')]},'fb_data':{'type':Sequelize[_0x3703('0x3')]},'twitter':{'type':Sequelize[_0x3703('0x3')]},'skype':{'type':Sequelize[_0x3703('0x3')]},'teams':{'type':Sequelize[_0x3703('0x3')]},'viber':{'type':Sequelize[_0x3703('0x3')]},'line':{'type':Sequelize[_0x3703('0x3')]},'wechat':{'type':Sequelize[_0x3703('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x3703('0x3')]},'priority':{'type':Sequelize[_0x3703('0x5')](0x2)[_0x3703('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3703('0x7')],'defaultValue':Sequelize[_0x3703('0x8')]},'dialTimezone':{'type':Sequelize[_0x3703('0x3')]},'utcOffset':{'type':Sequelize[_0x3703('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f856de3..4d7c86b 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(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 f9366d4..25ec517 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 _0x30bf=['CmContact','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x1d4f33,_0x165f68){var _0x103ca4=function(_0x10cbd5){while(--_0x10cbd5){_0x1d4f33['push'](_0x1d4f33['shift']());}};_0x103ca4(++_0x165f68);}(_0x30bf,0xca));var _0xf30b=function(_0x33160f,_0x484f9c){_0x33160f=_0x33160f-0x0;var _0x428d82=_0x30bf[_0x33160f];return _0x428d82;};'use strict';var EventEmitter=require(_0xf30b('0x0'));var CmContact=require('../../mysqldb')['db'][_0xf30b('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf30b('0x2')](0x0);var events={'afterCreate':_0xf30b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ba9cc){return function(_0x48f245,_0x413c7d,_0x2ae328){CmContactEvents[_0xf30b('0x4')](_0x3ba9cc+':'+_0x48f245['id'],_0x48f245);CmContactEvents[_0xf30b('0x4')](_0x3ba9cc,_0x48f245);_0x2ae328(null);};}for(var e in events){if(events[_0xf30b('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xf30b('0x6')]=CmContactEvents; \ No newline at end of file +var _0x7fbf=['CmContact','setMaxListeners','remove','hasOwnProperty','exports'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x7fbf,0xeb));var _0xf7fb=function(_0x576884,_0x379b7f){_0x576884=_0x576884-0x0;var _0xb25f8e=_0x7fbf[_0x576884];return _0xb25f8e;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0xf7fb('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xf7fb('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf7fb('0x2')};function emitEvent(_0x244c95){return function(_0x568523,_0x31a2f8,_0x286ce5){CmContactEvents['emit'](_0x244c95+':'+_0x568523['id'],_0x568523);CmContactEvents['emit'](_0x244c95,_0x568523);_0x286ce5(null);};}for(var e in events){if(events[_0xf7fb('0x3')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xf7fb('0x4')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index a210058..44dfeef 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 _0x54d8=['phone','fti_cm_contacts','lastName','mobile','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','inspect','scheduledat','format','VoiceQueue','findOne','then','isNil','timezones','dialTimezone','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','Campaign','add','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','afterCreate','dialCheckDuplicateType','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','all','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmContact.attributes','CmContact','cm_contacts'];(function(_0xe64ec5,_0x50ddd4){var _0x2cc3fc=function(_0x2d0500){while(--_0x2d0500){_0xe64ec5['push'](_0xe64ec5['shift']());}};_0x2cc3fc(++_0x50ddd4);}(_0x54d8,0xcb));var _0x854d=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x54d8[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x854d('0x0'));var util=require(_0x854d('0x1'));var logger=require(_0x854d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x854d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x854d('0x4'));var rimraf=require(_0x854d('0x5'));var config=require(_0x854d('0x6'));var shared=require('../../config/environment/shared');var attributes=require(_0x854d('0x7'));module['exports']=function(_0x3c1d34,_0x5266bc){return _0x3c1d34['define'](_0x854d('0x8'),attributes,{'tableName':_0x854d('0x9'),'paranoid':!![],'indexes':[{'name':_0x854d('0xa'),'fields':[_0x854d('0xa')]},{'name':_0x854d('0xb'),'fields':['firstName',_0x854d('0xc'),_0x854d('0xa'),_0x854d('0xd'),'fax',_0x854d('0xe')],'type':_0x854d('0xf')}],'timestamps':!![],'charset':_0x854d('0x10'),'collate':_0x854d('0x11'),'hooks':{'afterCreate':function(_0x5c810b,_0x51aa90,_0x4c76cc){var _0x235c34=_0x3c1d34[_0x854d('0x12')];var _0x28b201=_0x5c810b[_0x854d('0x13')]({'plain':!![]});function _0x20e887(){return function(_0x42d422){logger[_0x854d('0x14')](_0x854d('0x15'),'afterCreate',util[_0x854d('0x16')](_0x42d422,{'showHidden':![],'depth':null}));};}function _0x4eb957(_0x2554a0,_0x4c2167){var _0x208b69=_0x4c2167[_0x854d('0x17')]?_0x4c2167[_0x854d('0x17')]:moment()[_0x854d('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x530e73,_0x3921ef){if(_['isNil'](_0x4c2167['dialTimezone'])){_0x530e73({'ret':_0x208b69});}else{_0x235c34[_0x854d('0x19')][_0x854d('0x1a')]({'where':{'id':_0x2554a0['id']}})[_0x854d('0x1b')](function(_0x2a0884){if(!_[_0x854d('0x1c')](_0x2a0884)){var _0x5f2cf9=_0x2a0884['dialTimezone'];if(!_[_0x854d('0x1c')](_0x5f2cf9)){var _0x2f64a0=shared[_0x854d('0x1d')];var _0x31c77c=_0x2f64a0[_0x5f2cf9];var _0x3c39b1=_0x2f64a0[_0x4c2167[_0x854d('0x1e')]];if(!_[_0x854d('0x1c')](_0x31c77c)&&!_['isNil'](_0x3c39b1)){var _0x2ba039=_0x31c77c[_0x854d('0x1f')]-_0x3c39b1[_0x854d('0x1f')];_0x208b69=_0x4c2167[_0x854d('0x17')]?_0x4c2167[_0x854d('0x17')]:moment();var _0xa2a651=moment(_0x208b69)['add'](_0x2ba039,_0x854d('0x20'));_0x530e73({'ret':_0xa2a651['format'](_0x854d('0x21'))});}else _0x530e73({'ret':_0x208b69});}else _0x530e73({'ret':_0x208b69});}else{_0x530e73({'ret':_0x208b69});}});}});return 0xa;}var _0x489e4d=function(_0xfecc8b){return new BPromise(function(_0x30f032,_0x48e4c9){_0x4eb957(_0xfecc8b,_0x28b201)[_0x854d('0x1b')](function(_0x263691){_0x28b201[_0x854d('0x17')]=_0x263691['ret'];_0x235c34['CmHopper']['findOne']({'where':{'phone':_0x28b201[_0x854d('0xa')],'VoiceQueueId':_0xfecc8b['id']}})[_0x854d('0x1b')](function(_0x3d8ddf){if(!_[_0x854d('0x1c')](_0x3d8ddf)){throw new Error('cmContact,\x20afterCreate\x20'+_0x28b201['phone']+_0x854d('0x22')+_0xfecc8b['id']);}return _0x235c34[_0x854d('0x23')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201['ListId'],'priority':_0x28b201[_0x854d('0x25')]?_0x28b201[_0x854d('0x25')]:0x2,'scheduledat':_0x28b201['scheduledat']?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201[_0x854d('0x26')]?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201['callbackUniqueid']?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'VoiceQueueId':_0xfecc8b['id']});})['catch'](function(_0x5121ec){_0x48e4c9(_0x5121ec);});});});};var _0xd55cc0=function(_0x378da8){return new BPromise(function(_0x1db9ed,_0x42b14a){_0x4eb957(_0x378da8,_0x28b201)[_0x854d('0x1b')](function(_0x3128b3){_0x28b201['scheduledat']=_0x3128b3['ret'];_0x235c34[_0x854d('0x23')][_0x854d('0x1a')]({'where':{'phone':_0x28b201[_0x854d('0xa')],'VoiceQueueId':_0x378da8['id']}})[_0x854d('0x1b')](function(_0x498cd4){if(!_[_0x854d('0x1c')](_0x498cd4)){throw new Error('cmContact,\x20afterCreate\x20'+_0x28b201['phone']+_0x854d('0x27')+_0x378da8['id']);}return _0x235c34[_0x854d('0x28')][_0x854d('0x1a')]({'where':{'calleridnum':_0x28b201[_0x854d('0xa')],'VoiceQueueId':_0x378da8['id']}});})[_0x854d('0x1b')](function(_0x5eb242){if(!_['isNil'](_0x5eb242)){throw new Error(_0x854d('0x29')+_0x28b201['phone']+_0x854d('0x2a')+_0x378da8['id']);}return _0x235c34[_0x854d('0x23')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'priority':_0x28b201[_0x854d('0x25')]?_0x28b201['priority']:0x2,'scheduledat':_0x28b201[_0x854d('0x17')]?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201[_0x854d('0x26')]?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201[_0x854d('0x26')]?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'VoiceQueueId':_0x378da8['id']});})[_0x854d('0x2c')](function(_0x2f3688){_0x42b14a(_0x2f3688);});});});};function _0x451625(){return function(_0x3eac7c){logger[_0x854d('0x14')]('cmContact','afterCreate',util[_0x854d('0x16')](_0x3eac7c,{'showHidden':![],'depth':null}));};}function _0x410fa3(_0x12a3b7,_0x3f3248){var _0x27a435=_0x3f3248[_0x854d('0x17')]?_0x3f3248[_0x854d('0x17')]:moment()['format'](_0x854d('0x21'));return new BPromise(function(_0x3751ff,_0x3f3c7b){if(_[_0x854d('0x1c')](_0x3f3248[_0x854d('0x1e')])){_0x3751ff({'ret':_0x27a435});}else{_0x235c34[_0x854d('0x2d')][_0x854d('0x1a')]({'where':{'id':_0x12a3b7['id']}})[_0x854d('0x1b')](function(_0x3e91f6){if(!_[_0x854d('0x1c')](_0x3e91f6)){var _0x186653=_0x3e91f6[_0x854d('0x1e')];if(!_[_0x854d('0x1c')](_0x186653)){var _0x551a3d=shared[_0x854d('0x1d')];var _0x1a7df6=_0x551a3d[_0x186653];var _0x48ddc5=_0x551a3d[_0x3f3248[_0x854d('0x1e')]];if(!_[_0x854d('0x1c')](_0x1a7df6)&&!_[_0x854d('0x1c')](_0x48ddc5)){var _0x1f92aa=_0x1a7df6['utcOffset']-_0x48ddc5[_0x854d('0x1f')];_0x27a435=_0x3f3248[_0x854d('0x17')]?_0x3f3248[_0x854d('0x17')]:moment();var _0x598e95=moment(_0x27a435)[_0x854d('0x2e')](_0x1f92aa,_0x854d('0x20'));_0x3751ff({'ret':_0x598e95[_0x854d('0x18')](_0x854d('0x21'))});}else _0x3751ff({'ret':_0x27a435});}else _0x3751ff({'ret':_0x27a435});}else{_0x3751ff({'ret':_0x27a435});}});}});return 0xa;}var _0x105199=function(_0x266545){return new BPromise(function(_0xf2d73c,_0x42bc54){_0x410fa3(_0x266545,_0x28b201)['then'](function(_0x3ec4f4){_0x28b201[_0x854d('0x17')]=_0x3ec4f4[_0x854d('0x2f')];_0x235c34[_0x854d('0x23')][_0x854d('0x1a')]({'where':{'phone':_0x28b201['phone'],'CampaignId':_0x266545['id']}})[_0x854d('0x1b')](function(_0x3fb0e7){if(!_['isNil'](_0x3fb0e7)){throw new Error('cmContact,\x20afterCreate\x20'+_0x28b201[_0x854d('0xa')]+_0x854d('0x30')+_0x266545['id']);}return _0x235c34[_0x854d('0x23')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'priority':_0x28b201['priority']?_0x28b201[_0x854d('0x25')]:0x2,'scheduledat':_0x28b201[_0x854d('0x17')]?_0x28b201[_0x854d('0x17')]:moment()['format'](_0x854d('0x21')),'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201[_0x854d('0x26')]?_0x28b201['callbackUniqueid']:undefined,'callbackat':_0x28b201[_0x854d('0x26')]?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'CampaignId':_0x266545['id']});})['catch'](function(_0x31d926){_0x42bc54(_0x31d926);});});});};var _0x5a8131=function(_0x5dc957){return new BPromise(function(_0x5c7a2e,_0x3466a2){_0x410fa3(_0x5dc957,_0x28b201)[_0x854d('0x1b')](function(_0x237ba7){_0x28b201[_0x854d('0x17')]=_0x237ba7[_0x854d('0x2f')];_0x235c34[_0x854d('0x23')][_0x854d('0x1a')]({'where':{'phone':_0x28b201['phone'],'CampaignId':_0x5dc957['id']}})[_0x854d('0x1b')](function(_0x3291ff){if(!_[_0x854d('0x1c')](_0x3291ff)){throw new Error(_0x854d('0x31')+_0x28b201['phone']+_0x854d('0x32')+_0x5dc957['id']);}return _0x235c34[_0x854d('0x28')]['findOne']({'where':{'calleridnum':_0x28b201['phone'],'CampaignId':_0x5dc957['id']}});})[_0x854d('0x1b')](function(_0x184939){if(!_[_0x854d('0x1c')](_0x184939)){throw new Error(_0x854d('0x29')+_0x28b201[_0x854d('0xa')]+_0x854d('0x33')+_0x5dc957['id']);}return _0x235c34[_0x854d('0x23')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'priority':_0x28b201[_0x854d('0x25')]?_0x28b201[_0x854d('0x25')]:0x2,'scheduledat':_0x28b201[_0x854d('0x17')]?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201['callbackUniqueid']?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201['callbackUniqueid']?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'CampaignId':_0x5dc957['id']});})['catch'](function(_0x4ba2b6){_0x3466a2(_0x4ba2b6);});});});};if(_0x28b201[_0x854d('0x2b')]){_0x235c34[_0x854d('0x19')][_0x854d('0x34')]({'where':{'type':_0x854d('0x35')},'attributes':['id','dialCheckDuplicateType',_0x854d('0x1e')],'include':[{'model':_0x235c34[_0x854d('0x36')],'as':_0x854d('0x37'),'where':{'id':_0x28b201[_0x854d('0x2b')]}}]})[_0x854d('0x1b')](function(_0xffe18a){if(_0xffe18a){var _0x343fde=[];for(var _0xf7ed3=0x0,_0x4867c7;_0xf7ed3<_0xffe18a['length'];_0xf7ed3+=0x1){_0x4867c7=_0xffe18a[_0xf7ed3][_0x854d('0x13')]({'plain':!![]});switch(_0x4867c7['dialCheckDuplicateType']){case _0x854d('0x38'):_0xd55cc0(_0x4867c7)[_0x854d('0x2c')](_0x20e887());break;case _0x854d('0x39'):_0x489e4d(_0x4867c7)['catch'](_0x20e887());break;default:_0x410fa3(_0x4867c7,_0x28b201)[_0x854d('0x1b')](function(_0x2f1dec){_0x28b201['scheduledat']=_0x2f1dec[_0x854d('0x2f')];_0x235c34[_0x854d('0x23')]['create']({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'scheduledat':_0x28b201['scheduledat']?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'priority':_0x28b201[_0x854d('0x25')]?_0x28b201[_0x854d('0x25')]:0x2,'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201['callbackUniqueid']?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201[_0x854d('0x26')]?moment()[_0x854d('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4867c7['id']})[_0x854d('0x2c')](_0x20e887());});}}}})[_0x854d('0x1b')](function(){return _0x235c34['VoiceQueue'][_0x854d('0x34')]({'where':{'type':_0x854d('0x35')},'attributes':['id'],'include':[{'model':_0x235c34[_0x854d('0x36')],'as':_0x854d('0x3a'),'where':{'id':_0x28b201[_0x854d('0x2b')]}}]})[_0x854d('0x1b')](function(_0x2d0792){if(_0x2d0792){var _0x3fe501=[];for(var _0x5e3fb6=0x0,_0x3c8e36;_0x5e3fb6<_0x2d0792[_0x854d('0x3b')];_0x5e3fb6+=0x1){_0x3c8e36=_0x2d0792[_0x5e3fb6][_0x854d('0x13')]({'plain':!![]});_0x235c34[_0x854d('0x3c')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'VoiceQueueId':_0x3c8e36['id']})[_0x854d('0x2c')](function(_0x1c9e49){logger[_0x854d('0x14')]('cmContact,\x20%s,\x20%s',_0x854d('0x3d'),_0x1c9e49['message']);});}}});})[_0x854d('0x1b')](function(){return _0x235c34[_0x854d('0x2d')]['findAll']({'attributes':['id',_0x854d('0x3e'),_0x854d('0x1e')],'include':[{'model':_0x235c34[_0x854d('0x36')],'as':'Lists','where':{'id':_0x28b201[_0x854d('0x2b')]}}]})['then'](function(_0x1abf33){if(_0x1abf33){var _0x2c894d=[];for(var _0x35e4ee=0x0,_0x61d631;_0x35e4ee<_0x1abf33['length'];_0x35e4ee+=0x1){_0x61d631=_0x1abf33[_0x35e4ee][_0x854d('0x13')]({'plain':!![]});switch(_0x61d631[_0x854d('0x3e')]){case _0x854d('0x38'):_0x5a8131(_0x61d631)[_0x854d('0x2c')](_0x451625());break;case _0x854d('0x39'):_0x105199(_0x61d631)['catch'](_0x451625());break;default:_0x235c34['CmHopper'][_0x854d('0x24')]({'phone':_0x28b201['phone'],'ContactId':_0x28b201['id'],'ListId':_0x28b201[_0x854d('0x2b')],'scheduledat':_0x28b201[_0x854d('0x17')]?_0x28b201[_0x854d('0x17')]:moment()[_0x854d('0x18')](_0x854d('0x21')),'priority':_0x28b201[_0x854d('0x25')]?_0x28b201[_0x854d('0x25')]:0x2,'callback':_0x28b201[_0x854d('0x26')]?!![]:![],'callbackuniqueid':_0x28b201[_0x854d('0x26')]?_0x28b201[_0x854d('0x26')]:undefined,'callbackat':_0x28b201[_0x854d('0x26')]?moment()[_0x854d('0x18')](_0x854d('0x21')):undefined,'CampaignId':_0x61d631['id']})[_0x854d('0x2c')](_0x451625());}}}});})[_0x854d('0x1b')](function(){return _0x235c34[_0x854d('0x2d')][_0x854d('0x34')]({'attributes':['id'],'include':[{'model':_0x235c34[_0x854d('0x36')],'as':'BlackLists','where':{'id':_0x28b201[_0x854d('0x2b')]}}]})[_0x854d('0x1b')](function(_0x530e3f){if(_0x530e3f){var _0x421571=[];for(var _0x156c28=0x0,_0x4fdaec;_0x156c28<_0x530e3f['length'];_0x156c28+=0x1){_0x4fdaec=_0x530e3f[_0x156c28][_0x854d('0x13')]({'plain':!![]});_0x235c34[_0x854d('0x3c')][_0x854d('0x24')]({'phone':_0x28b201[_0x854d('0xa')],'ContactId':_0x28b201['id'],'ListId':_0x28b201['ListId'],'CampaignId':_0x4fdaec['id']})[_0x854d('0x2c')](function(_0x2cd4a3){logger[_0x854d('0x14')](_0x854d('0x3f'),_0x854d('0x3d'),_0x2cd4a3['message']);});}}});})[_0x854d('0x1b')](function(){_0x4c76cc();})[_0x854d('0x2c')](function(_0x48a1bd){logger[_0x854d('0x14')](_0x854d('0x3f'),'afterCreate',_0x48a1bd[_0x854d('0x40')]);_0x4c76cc(_0x48a1bd);});}else{_0x4c76cc(new Error(_0x854d('0x41')));}},'afterDestroy':function(_0x3d5e66,_0x547215,_0x12a427){var _0x3a5a2d=_0x3c1d34['models'];var _0x523042=_0x3d5e66[_0x854d('0x13')]({'plain':!![]});return _0x3a5a2d[_0x854d('0x23')][_0x854d('0x34')]({'raw':!![],'where':{'ListId':_0x523042[_0x854d('0x2b')],'ContactId':_0x523042['id']}})[_0x854d('0x1b')](function(_0x3fb297){if(!_[_0x854d('0x42')](_0x3fb297)){var _0x55fb0b=[];for(var _0x4191d3=0x0;_0x4191d3<_0x3fb297[_0x854d('0x3b')];_0x4191d3+=0x1){var _0x23dcec=_0x3a5a2d[_0x854d('0x23')][_0x854d('0x43')]({'where':{'ListId':_0x3fb297[_0x4191d3][_0x854d('0x2b')],'ContactId':_0x3fb297[_0x4191d3][_0x854d('0x44')],'VoiceQueueId':_0x3fb297[_0x4191d3]['VoiceQueueId'],'CampaignId':_0x3fb297[_0x4191d3][_0x854d('0x45')]}});_0x55fb0b['push'](_0x23dcec);}return BPromise[_0x854d('0x46')](_0x55fb0b);}})[_0x854d('0x1b')](function(_0x5809b0){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0x854d('0x16')](_0x5809b0,{'showHidden':![],'depth':null}));_0x12a427();})[_0x854d('0x2c')](function(_0xc7378e){logger[_0x854d('0x14')]('[CmContact][afterDestroy][Error]',util[_0x854d('0x16')](_0xc7378e,{'showHidden':![],'depth':null}));_0x12a427(_0xc7378e);});}}});}; \ No newline at end of file +var _0x4d85=['utcOffset','add','ret','CmHopper','findOne','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','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','inspect','Campaign','minutes','\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','cmContact,\x20afterCreate,\x20','outbound','CmList','length','get','dialCheckDuplicateType','onlyIfOpen','findAll','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Lists','always','List\x20not\x20found','isEmpty','destroy','VoiceQueueId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','models','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','then','isNil'];(function(_0x3df6a7,_0x5806ab){var _0x3a2d16=function(_0xf85b9e){while(--_0xf85b9e){_0x3df6a7['push'](_0x3df6a7['shift']());}};_0x3a2d16(++_0x5806ab);}(_0x4d85,0xba));var _0x54d8=function(_0x89f772,_0x45088a){_0x89f772=_0x89f772-0x0;var _0x4857a3=_0x4d85[_0x89f772];return _0x4857a3;};'use strict';var _=require('lodash');var util=require(_0x54d8('0x0'));var logger=require(_0x54d8('0x1'))(_0x54d8('0x2'));var moment=require(_0x54d8('0x3'));var BPromise=require(_0x54d8('0x4'));var rp=require(_0x54d8('0x5'));var fs=require('fs');var path=require(_0x54d8('0x6'));var rimraf=require('rimraf');var config=require(_0x54d8('0x7'));var shared=require(_0x54d8('0x8'));var attributes=require('./cmContact.attributes');module['exports']=function(_0x2d8028,_0x37507e){return _0x2d8028[_0x54d8('0x9')](_0x54d8('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x54d8('0xb'),'fields':[_0x54d8('0xb')]},{'name':_0x54d8('0xc'),'fields':[_0x54d8('0xd'),_0x54d8('0xe'),'phone',_0x54d8('0xf'),_0x54d8('0x10'),_0x54d8('0x11')],'type':_0x54d8('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x457373,_0x45d4f4,_0x25b8ab){var _0x176500=_0x2d8028[_0x54d8('0x13')];var _0x30a0fb=_0x457373['get']({'plain':!![]});function _0x296cb0(){return function(_0x4e203a){logger[_0x54d8('0x14')](_0x54d8('0x15'),_0x54d8('0x16'),util['inspect'](_0x4e203a,{'showHidden':![],'depth':null}));};}function _0x5137d6(_0x21c427,_0x40225c){var _0x22f3dc=_0x40225c['scheduledat']?_0x40225c[_0x54d8('0x17')]:moment()[_0x54d8('0x18')](_0x54d8('0x19'));return new BPromise(function(_0x2346ed,_0x35a879){if(_['isNil'](_0x40225c[_0x54d8('0x1a')])){_0x2346ed({'ret':_0x22f3dc});}else{_0x176500[_0x54d8('0x1b')]['findOne']({'where':{'id':_0x21c427['id']}})[_0x54d8('0x1c')](function(_0x29da42){if(!_[_0x54d8('0x1d')](_0x29da42)){var _0x2bd771=_0x29da42[_0x54d8('0x1a')];if(!_[_0x54d8('0x1d')](_0x2bd771)){var _0x2d99cd=shared['timezones'];var _0x2bce7b=_0x2d99cd[_0x2bd771];var _0xf68e6d=_0x2d99cd[_0x40225c[_0x54d8('0x1a')]];if(!_[_0x54d8('0x1d')](_0x2bce7b)&&!_['isNil'](_0xf68e6d)){var _0x474803=_0x2bce7b[_0x54d8('0x1e')]-_0xf68e6d[_0x54d8('0x1e')];_0x22f3dc=_0x40225c[_0x54d8('0x17')]?_0x40225c[_0x54d8('0x17')]:moment();var _0xab12fa=moment(_0x22f3dc)[_0x54d8('0x1f')](_0x474803,'minutes');_0x2346ed({'ret':_0xab12fa[_0x54d8('0x18')](_0x54d8('0x19'))});}else _0x2346ed({'ret':_0x22f3dc});}else _0x2346ed({'ret':_0x22f3dc});}else{_0x2346ed({'ret':_0x22f3dc});}});}});return 0xa;}var _0x5f236e=function(_0x4568e6){return new BPromise(function(_0x4a5573,_0x56639f){_0x5137d6(_0x4568e6,_0x30a0fb)[_0x54d8('0x1c')](function(_0x56c9af){_0x30a0fb[_0x54d8('0x17')]=_0x56c9af[_0x54d8('0x20')];_0x176500[_0x54d8('0x21')][_0x54d8('0x22')]({'where':{'phone':_0x30a0fb[_0x54d8('0xb')],'VoiceQueueId':_0x4568e6['id']}})[_0x54d8('0x1c')](function(_0x420bc0){if(!_[_0x54d8('0x1d')](_0x420bc0)){throw new Error(_0x54d8('0x23')+_0x30a0fb[_0x54d8('0xb')]+_0x54d8('0x24')+_0x4568e6['id']);}return _0x176500[_0x54d8('0x21')]['create']({'phone':_0x30a0fb[_0x54d8('0xb')],'ContactId':_0x30a0fb['id'],'ListId':_0x30a0fb[_0x54d8('0x25')],'priority':_0x30a0fb[_0x54d8('0x26')]?_0x30a0fb[_0x54d8('0x26')]:0x2,'scheduledat':_0x30a0fb[_0x54d8('0x17')]?_0x30a0fb[_0x54d8('0x17')]:moment()[_0x54d8('0x18')](_0x54d8('0x19')),'callback':_0x30a0fb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x30a0fb['callbackUniqueid']?_0x30a0fb[_0x54d8('0x27')]:undefined,'callbackat':_0x30a0fb[_0x54d8('0x27')]?moment()[_0x54d8('0x18')](_0x54d8('0x19')):undefined,'VoiceQueueId':_0x4568e6['id']});})[_0x54d8('0x28')](function(_0x2a0eb8){_0x56639f(_0x2a0eb8);});});});};var _0xdce53a=function(_0xc634c9){return new BPromise(function(_0x529cf3,_0x16d6ec){_0x5137d6(_0xc634c9,_0x30a0fb)[_0x54d8('0x1c')](function(_0x3fd3a4){_0x30a0fb[_0x54d8('0x17')]=_0x3fd3a4[_0x54d8('0x20')];_0x176500['CmHopper'][_0x54d8('0x22')]({'where':{'phone':_0x30a0fb[_0x54d8('0xb')],'VoiceQueueId':_0xc634c9['id']}})[_0x54d8('0x1c')](function(_0x3a1382){if(!_[_0x54d8('0x1d')](_0x3a1382)){throw new Error(_0x54d8('0x23')+_0x30a0fb[_0x54d8('0xb')]+_0x54d8('0x29')+_0xc634c9['id']);}return _0x176500[_0x54d8('0x2a')][_0x54d8('0x22')]({'where':{'calleridnum':_0x30a0fb[_0x54d8('0xb')],'VoiceQueueId':_0xc634c9['id']}});})['then'](function(_0x31870f){if(!_[_0x54d8('0x1d')](_0x31870f)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x30a0fb[_0x54d8('0xb')]+_0x54d8('0x2b')+_0xc634c9['id']);}return _0x176500[_0x54d8('0x21')]['create']({'phone':_0x30a0fb[_0x54d8('0xb')],'ContactId':_0x30a0fb['id'],'ListId':_0x30a0fb[_0x54d8('0x25')],'priority':_0x30a0fb[_0x54d8('0x26')]?_0x30a0fb[_0x54d8('0x26')]:0x2,'scheduledat':_0x30a0fb['scheduledat']?_0x30a0fb[_0x54d8('0x17')]:moment()[_0x54d8('0x18')](_0x54d8('0x19')),'callback':_0x30a0fb[_0x54d8('0x27')]?!![]:![],'callbackuniqueid':_0x30a0fb[_0x54d8('0x27')]?_0x30a0fb[_0x54d8('0x27')]:undefined,'callbackat':_0x30a0fb['callbackUniqueid']?moment()[_0x54d8('0x18')](_0x54d8('0x19')):undefined,'VoiceQueueId':_0xc634c9['id']});})[_0x54d8('0x28')](function(_0x54c736){_0x16d6ec(_0x54c736);});});});};function _0x1ddb1d(){return function(_0x531c1a){logger[_0x54d8('0x14')](_0x54d8('0x15'),_0x54d8('0x16'),util[_0x54d8('0x2c')](_0x531c1a,{'showHidden':![],'depth':null}));};}function _0x423dc3(_0x27f378,_0xfc83f9){var _0x3e7316=_0xfc83f9[_0x54d8('0x17')]?_0xfc83f9[_0x54d8('0x17')]:moment()[_0x54d8('0x18')](_0x54d8('0x19'));return new BPromise(function(_0x950e2b,_0x417e7a){if(_['isNil'](_0xfc83f9[_0x54d8('0x1a')])){_0x950e2b({'ret':_0x3e7316});}else{_0x176500[_0x54d8('0x2d')][_0x54d8('0x22')]({'where':{'id':_0x27f378['id']}})[_0x54d8('0x1c')](function(_0x440c01){if(!_[_0x54d8('0x1d')](_0x440c01)){var _0x2a3877=_0x440c01[_0x54d8('0x1a')];if(!_[_0x54d8('0x1d')](_0x2a3877)){var _0x15e6fb=shared['timezones'];var _0x28272a=_0x15e6fb[_0x2a3877];var _0x35af1c=_0x15e6fb[_0xfc83f9[_0x54d8('0x1a')]];if(!_[_0x54d8('0x1d')](_0x28272a)&&!_[_0x54d8('0x1d')](_0x35af1c)){var _0x55c5ca=_0x28272a['utcOffset']-_0x35af1c[_0x54d8('0x1e')];_0x3e7316=_0xfc83f9[_0x54d8('0x17')]?_0xfc83f9['scheduledat']:moment();var _0x59d014=moment(_0x3e7316)[_0x54d8('0x1f')](_0x55c5ca,_0x54d8('0x2e'));_0x950e2b({'ret':_0x59d014[_0x54d8('0x18')](_0x54d8('0x19'))});}else _0x950e2b({'ret':_0x3e7316});}else _0x950e2b({'ret':_0x3e7316});}else{_0x950e2b({'ret':_0x3e7316});}});}});return 0xa;}var _0x2a1c73=function(_0x5fa024){return new BPromise(function(_0x2e339a,_0x1967d6){_0x423dc3(_0x5fa024,_0x30a0fb)[_0x54d8('0x1c')](function(_0x50d8bd){_0x30a0fb['scheduledat']=_0x50d8bd[_0x54d8('0x20')];_0x176500['CmHopper'][_0x54d8('0x22')]({'where':{'phone':_0x30a0fb[_0x54d8('0xb')],'CampaignId':_0x5fa024['id']}})[_0x54d8('0x1c')](function(_0x127c02){if(!_[_0x54d8('0x1d')](_0x127c02)){throw new Error(_0x54d8('0x23')+_0x30a0fb[_0x54d8('0xb')]+_0x54d8('0x2f')+_0x5fa024['id']);}return _0x176500['CmHopper'][_0x54d8('0x30')]({'phone':_0x30a0fb[_0x54d8('0xb')],'ContactId':_0x30a0fb['id'],'ListId':_0x30a0fb[_0x54d8('0x25')],'priority':_0x30a0fb[_0x54d8('0x26')]?_0x30a0fb[_0x54d8('0x26')]:0x2,'scheduledat':_0x30a0fb[_0x54d8('0x17')]?_0x30a0fb[_0x54d8('0x17')]:moment()[_0x54d8('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x30a0fb['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x30a0fb[_0x54d8('0x27')]?_0x30a0fb['callbackUniqueid']:undefined,'callbackat':_0x30a0fb[_0x54d8('0x27')]?moment()[_0x54d8('0x18')](_0x54d8('0x19')):undefined,'CampaignId':_0x5fa024['id']});})['catch'](function(_0xcce749){_0x1967d6(_0xcce749);});});});};var _0xee8ff8=function(_0x16fc56){return new BPromise(function(_0x2b5fab,_0x5eafb2){_0x423dc3(_0x16fc56,_0x30a0fb)['then'](function(_0x3c0240){_0x30a0fb[_0x54d8('0x17')]=_0x3c0240[_0x54d8('0x20')];_0x176500[_0x54d8('0x21')][_0x54d8('0x22')]({'where':{'phone':_0x30a0fb['phone'],'CampaignId':_0x16fc56['id']}})[_0x54d8('0x1c')](function(_0x4c153a){if(!_['isNil'](_0x4c153a)){throw new Error(_0x54d8('0x23')+_0x30a0fb[_0x54d8('0xb')]+_0x54d8('0x31')+_0x16fc56['id']);}return _0x176500[_0x54d8('0x2a')][_0x54d8('0x22')]({'where':{'calleridnum':_0x30a0fb[_0x54d8('0xb')],'CampaignId':_0x16fc56['id']}});})[_0x54d8('0x1c')](function(_0x5344c4){if(!_[_0x54d8('0x1d')](_0x5344c4)){throw new Error(_0x54d8('0x32')+_0x30a0fb[_0x54d8('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x16fc56['id']);}return _0x176500[_0x54d8('0x21')]['create']({'phone':_0x30a0fb[_0x54d8('0xb')],'ContactId':_0x30a0fb['id'],'ListId':_0x30a0fb[_0x54d8('0x25')],'priority':_0x30a0fb[_0x54d8('0x26')]?_0x30a0fb[_0x54d8('0x26')]:0x2,'scheduledat':_0x30a0fb['scheduledat']?_0x30a0fb[_0x54d8('0x17')]:moment()[_0x54d8('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x30a0fb[_0x54d8('0x27')]?!![]:![],'callbackuniqueid':_0x30a0fb[_0x54d8('0x27')]?_0x30a0fb[_0x54d8('0x27')]:undefined,'callbackat':_0x30a0fb['callbackUniqueid']?moment()[_0x54d8('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x16fc56['id']});})['catch'](function(_0xc3569d){_0x5eafb2(_0xc3569d);});});});};if(_0x30a0fb[_0x54d8('0x25')]){_0x176500['VoiceQueue']['findAll']({'where':{'type':_0x54d8('0x33')},'attributes':['id','dialCheckDuplicateType',_0x54d8('0x1a')],'include':[{'model':_0x176500[_0x54d8('0x34')],'as':'Lists','where':{'id':_0x30a0fb['ListId']}}]})[_0x54d8('0x1c')](function(_0x44783f){if(_0x44783f){var _0x3278ad=[];for(var _0x132bc2=0x0,_0x3ae5f5;_0x132bc2<_0x44783f[_0x54d8('0x35')];_0x132bc2+=0x1){_0x3ae5f5=_0x44783f[_0x132bc2][_0x54d8('0x36')]({'plain':!![]});switch(_0x3ae5f5[_0x54d8('0x37')]){case'always':_0xdce53a(_0x3ae5f5)['catch'](_0x296cb0());break;case _0x54d8('0x38'):_0x5f236e(_0x3ae5f5)[_0x54d8('0x28')](_0x296cb0());break;default:_0x423dc3(_0x3ae5f5,_0x30a0fb)[_0x54d8('0x1c')](function(_0xb62f60){_0x30a0fb[_0x54d8('0x17')]=_0xb62f60['ret'];_0x176500[_0x54d8('0x21')]['create']({'phone':_0x30a0fb[_0x54d8('0xb')],'ContactId':_0x30a0fb['id'],'ListId':_0x30a0fb[_0x54d8('0x25')],'scheduledat':_0x30a0fb['scheduledat']?_0x30a0fb[_0x54d8('0x17')]:moment()[_0x54d8('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x30a0fb[_0x54d8('0x26')]?_0x30a0fb[_0x54d8('0x26')]:0x2,'callback':_0x30a0fb[_0x54d8('0x27')]?!![]:![],'callbackuniqueid':_0x30a0fb['callbackUniqueid']?_0x30a0fb[_0x54d8('0x27')]:undefined,'callbackat':_0x30a0fb[_0x54d8('0x27')]?moment()[_0x54d8('0x18')](_0x54d8('0x19')):undefined,'VoiceQueueId':_0x3ae5f5['id']})['catch'](_0x296cb0());});}}}})[_0x54d8('0x1c')](function(){return _0x176500[_0x54d8('0x1b')][_0x54d8('0x39')]({'where':{'type':_0x54d8('0x33')},'attributes':['id'],'include':[{'model':_0x176500[_0x54d8('0x34')],'as':_0x54d8('0x3a'),'where':{'id':_0x30a0fb[_0x54d8('0x25')]}}]})[_0x54d8('0x1c')](function(_0x204567){if(_0x204567){var _0x501416=[];for(var _0x3f433f=0x0,_0x25e10a;_0x3f433f<_0x204567[_0x54d8('0x35')];_0x3f433f+=0x1){_0x25e10a=_0x204567[_0x3f433f]['get']({'plain':!![]});_0x176500[_0x54d8('0x3b')][_0x54d8('0x30')]({'phone':_0x30a0fb[_0x54d8('0xb')],'ContactId':_0x30a0fb['id'],'ListId':_0x30a0fb[_0x54d8('0x25')],'VoiceQueueId':_0x25e10a['id']})[_0x54d8('0x28')](function(_0x4cfd2e){logger[_0x54d8('0x14')](_0x54d8('0x3c'),'afterCreate',_0x4cfd2e[_0x54d8('0x3d')]);});}}});})[_0x54d8('0x1c')](function(){return _0x176500['Campaign'][_0x54d8('0x39')]({'attributes':['id','dialCheckDuplicateType',_0x54d8('0x1a')],'include':[{'model':_0x176500[_0x54d8('0x34')],'as':_0x54d8('0x3e'),'where':{'id':_0x30a0fb['ListId']}}]})[_0x54d8('0x1c')](function(_0x5bbb39){if(_0x5bbb39){var _0x3eb2af=[];for(var _0x22770e=0x0,_0x84e829;_0x22770e<_0x5bbb39[_0x54d8('0x35')];_0x22770e+=0x1){_0x84e829=_0x5bbb39[_0x22770e][_0x54d8('0x36')]({'plain':!![]});switch(_0x84e829['dialCheckDuplicateType']){case _0x54d8('0x3f'):_0xee8ff8(_0x84e829)[_0x54d8('0x28')](_0x1ddb1d());break;case _0x54d8('0x38'):_0x2a1c73(_0x84e829)['catch'](_0x1ddb1d());break;default:_0x176500['CmHopper'][_0x54d8('0x30')]({'phone':_0x30a0fb['phone'],'ContactId':_0x30a0fb['id'],'ListId':_0x30a0fb[_0x54d8('0x25')],'scheduledat':_0x30a0fb['scheduledat']?_0x30a0fb['scheduledat']:moment()['format'](_0x54d8('0x19')),'priority':_0x30a0fb['priority']?_0x30a0fb['priority']:0x2,'callback':_0x30a0fb[_0x54d8('0x27')]?!![]:![],'callbackuniqueid':_0x30a0fb[_0x54d8('0x27')]?_0x30a0fb[_0x54d8('0x27')]:undefined,'callbackat':_0x30a0fb[_0x54d8('0x27')]?moment()[_0x54d8('0x18')](_0x54d8('0x19')):undefined,'CampaignId':_0x84e829['id']})[_0x54d8('0x28')](_0x1ddb1d());}}}});})[_0x54d8('0x1c')](function(){return _0x176500[_0x54d8('0x2d')][_0x54d8('0x39')]({'attributes':['id'],'include':[{'model':_0x176500['CmList'],'as':'BlackLists','where':{'id':_0x30a0fb[_0x54d8('0x25')]}}]})[_0x54d8('0x1c')](function(_0x296907){if(_0x296907){var _0x2bd078=[];for(var _0x135a73=0x0,_0x474ef9;_0x135a73<_0x296907[_0x54d8('0x35')];_0x135a73+=0x1){_0x474ef9=_0x296907[_0x135a73]['get']({'plain':!![]});_0x176500['CmHopperBlack']['create']({'phone':_0x30a0fb[_0x54d8('0xb')],'ContactId':_0x30a0fb['id'],'ListId':_0x30a0fb[_0x54d8('0x25')],'CampaignId':_0x474ef9['id']})[_0x54d8('0x28')](function(_0xaaba0d){logger[_0x54d8('0x14')](_0x54d8('0x3c'),_0x54d8('0x16'),_0xaaba0d[_0x54d8('0x3d')]);});}}});})[_0x54d8('0x1c')](function(){_0x25b8ab();})[_0x54d8('0x28')](function(_0x147466){logger[_0x54d8('0x14')](_0x54d8('0x3c'),_0x54d8('0x16'),_0x147466[_0x54d8('0x3d')]);_0x25b8ab(_0x147466);});}else{_0x25b8ab(new Error(_0x54d8('0x40')));}},'afterDestroy':function(_0x2e46b7,_0x128503,_0x67da11){var _0x27b9c0=_0x2d8028['models'];var _0x158b46=_0x2e46b7['get']({'plain':!![]});return _0x27b9c0[_0x54d8('0x21')][_0x54d8('0x39')]({'raw':!![],'where':{'ListId':_0x158b46[_0x54d8('0x25')],'ContactId':_0x158b46['id']}})[_0x54d8('0x1c')](function(_0xd8cff2){if(!_[_0x54d8('0x41')](_0xd8cff2)){var _0x13b020=[];for(var _0x9185e4=0x0;_0x9185e4<_0xd8cff2['length'];_0x9185e4+=0x1){var _0x5b0f5b=_0x27b9c0[_0x54d8('0x21')][_0x54d8('0x42')]({'where':{'ListId':_0xd8cff2[_0x9185e4][_0x54d8('0x25')],'ContactId':_0xd8cff2[_0x9185e4]['ContactId'],'VoiceQueueId':_0xd8cff2[_0x9185e4][_0x54d8('0x43')],'CampaignId':_0xd8cff2[_0x9185e4][_0x54d8('0x44')]}});_0x13b020['push'](_0x5b0f5b);}return BPromise['all'](_0x13b020);}})[_0x54d8('0x1c')](function(_0x117101){logger[_0x54d8('0x45')](_0x54d8('0x46'),util[_0x54d8('0x2c')](_0x117101,{'showHidden':![],'depth':null}));_0x67da11();})[_0x54d8('0x28')](function(_0x471890){logger[_0x54d8('0x14')](_0x54d8('0x47'),util[_0x54d8('0x2c')](_0x471890,{'showHidden':![],'depth':null}));_0x67da11(_0x471890);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index fb99be9..6eac137 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(_0x56153f,_0xfa7777){var _0x556731=function(_0x5ea7fd){while(--_0x5ea7fd){_0x56153f['push'](_0x56153f['shift']());}};_0x556731(++_0xfa7777);}(_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 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(_0x2c73c3,_0x3c213f){var _0x355731=function(_0x3b03e7){while(--_0x3b03e7){_0x2c73c3['push'](_0x2c73c3['shift']());}};_0x355731(++_0x3c213f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 dfadfd2..2960f8d 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 _0xe3ed=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe3ed,0x8d));var _0xde3e=function(_0x13a0fa,_0xb3398d){_0x13a0fa=_0x13a0fa-0x0;var _0x5a3888=_0xe3ed[_0x13a0fa];return _0x5a3888;};'use strict';var Sequelize=require(_0xde3e('0x0'));module[_0xde3e('0x1')]={'CmContactId':{'type':Sequelize[_0xde3e('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xde3e('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xde3e('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xde3e('0x3')],'defaultValue':_0xde3e('0x4')},'OrderBy':{'type':Sequelize[_0xde3e('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x4d46=['exports','INTEGER','STRING','sequelize'];(function(_0x191865,_0x98552b){var _0x4994af=function(_0x5c03f2){while(--_0x5c03f2){_0x191865['push'](_0x191865['shift']());}};_0x4994af(++_0x98552b);}(_0x4d46,0x197));var _0x64d4=function(_0x393078,_0x137ad1){_0x393078=_0x393078-0x0;var _0x4fdaab=_0x4d46[_0x393078];return _0x4fdaab;};'use strict';var Sequelize=require(_0x64d4('0x0'));module[_0x64d4('0x1')]={'CmContactId':{'type':Sequelize[_0x64d4('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x64d4('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x64d4('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x64d4('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x64d4('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x64d4('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 2187581..1dc1b02 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 _0xcd8a=['findAll','rows','catch','show','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','params','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0xa2ad57,_0x2ed7ec){var _0x4e99d6=function(_0x3f74c6){while(--_0x3f74c6){_0xa2ad57['push'](_0xa2ad57['shift']());}};_0x4e99d6(++_0x2ed7ec);}(_0xcd8a,0x1a8));var _0xacd8=function(_0x466a67,_0x2e9624){_0x466a67=_0x466a67-0x0;var _0x4ceb18=_0xcd8a[_0x466a67];return _0x4ceb18;};'use strict';var emlformat=require(_0xacd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xacd8('0x1'));var jsonpatch=require(_0xacd8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacd8('0x3'));var Mustache=require(_0xacd8('0x4'));var util=require(_0xacd8('0x5'));var path=require(_0xacd8('0x6'));var sox=require('sox');var csv=require(_0xacd8('0x7'));var ejs=require(_0xacd8('0x8'));var fs=require('fs');var fs_extra=require(_0xacd8('0x9'));var _=require(_0xacd8('0xa'));var squel=require(_0xacd8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xacd8('0xc'));var toCsv=require(_0xacd8('0x7'));var querystring=require('querystring');var Papa=require(_0xacd8('0xd'));var Redis=require('ioredis');var authService=require(_0xacd8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xacd8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacd8('0x10'))(_0xacd8('0x11'));var utils=require(_0xacd8('0x12'));var config=require(_0xacd8('0x13'));var licenseUtil=require(_0xacd8('0x14'));var db=require(_0xacd8('0x15'))['db'];function respondWithStatusCode(_0x306247,_0x343f61){_0x343f61=_0x343f61||0xcc;return function(_0x506d1c){if(_0x506d1c){return _0x306247[_0xacd8('0x16')](_0x343f61);}return _0x306247[_0xacd8('0x17')](_0x343f61)[_0xacd8('0x18')]();};}function respondWithResult(_0x5e319d,_0x2e87b7){_0x2e87b7=_0x2e87b7||0xc8;return function(_0x16c832){if(_0x16c832){return _0x5e319d[_0xacd8('0x17')](_0x2e87b7)[_0xacd8('0x19')](_0x16c832);}};}function respondWithFilteredResult(_0x4c3c64,_0x13a4bf){return function(_0x29729f){if(_0x29729f){var _0x2a6039=typeof _0x13a4bf[_0xacd8('0x1a')]==='undefined'&&typeof _0x13a4bf[_0xacd8('0x1b')]===_0xacd8('0x1c');var _0x5a0105=_0x29729f[_0xacd8('0x1d')];var _0x4678c6=_0x2a6039?0x0:_0x13a4bf[_0xacd8('0x1a')];var _0x30001e=_0x2a6039?_0x29729f[_0xacd8('0x1d')]:_0x13a4bf[_0xacd8('0x1a')]+_0x13a4bf[_0xacd8('0x1b')];var _0x48672f;if(_0x30001e>=_0x5a0105){_0x30001e=_0x5a0105;_0x48672f=0xc8;}else{_0x48672f=0xce;}_0x4c3c64[_0xacd8('0x17')](_0x48672f);return _0x4c3c64[_0xacd8('0x1e')]('Content-Range',_0x4678c6+'-'+_0x30001e+'/'+_0x5a0105)[_0xacd8('0x19')](_0x29729f);}return null;};}function patchUpdates(_0x4e6ce4){return function(_0x53293b){try{jsonpatch['apply'](_0x53293b,_0x4e6ce4,!![]);}catch(_0x306392){return BPromise['reject'](_0x306392);}return _0x53293b[_0xacd8('0x1f')]();};}function saveUpdates(_0xfdc6ce,_0x30c312){return function(_0x108a0b){if(_0x108a0b){return _0x108a0b[_0xacd8('0x20')](_0xfdc6ce)[_0xacd8('0x21')](function(_0x5ac1e2){return _0x5ac1e2;});}return null;};}function removeEntity(_0x1ee815,_0x4ddc5c){return function(_0x2d14e1){if(_0x2d14e1){return _0x2d14e1[_0xacd8('0x22')]()[_0xacd8('0x21')](function(){var _0x4e6a5e=_0x2d14e1['get']({'plain':!![]});var _0x4b6d81=_0xacd8('0x23');return db[_0xacd8('0x24')]['destroy']({'where':{'type':_0x4b6d81,'resourceId':_0x4e6a5e['id']}})[_0xacd8('0x21')](function(){return _0x2d14e1;});})[_0xacd8('0x21')](function(){_0x1ee815[_0xacd8('0x17')](0xcc)[_0xacd8('0x18')]();});}};}function handleEntityNotFound(_0x5c1c6c,_0x3fe28f){return function(_0x1d9d1f){if(!_0x1d9d1f){_0x5c1c6c[_0xacd8('0x16')](0x194);}return _0x1d9d1f;};}function handleError(_0x55f034,_0x160d0b){_0x160d0b=_0x160d0b||0x1f4;return function(_0x1780a1){logger[_0xacd8('0x25')](_0x1780a1[_0xacd8('0x26')]);if(_0x1780a1[_0xacd8('0x27')]){delete _0x1780a1['name'];}_0x55f034[_0xacd8('0x17')](_0x160d0b)[_0xacd8('0x28')](_0x1780a1);};}exports[_0xacd8('0x29')]=function(_0x606f23,_0x3b0057){var _0xe4fae7={},_0x20e7c5={},_0x17c774={'count':0x0,'rows':[]};var _0x513953=_[_0xacd8('0x2a')](db[_0xacd8('0x2b')][_0xacd8('0x2c')],function(_0x409d30){return{'name':_0x409d30[_0xacd8('0x2d')],'type':_0x409d30['type'][_0xacd8('0x2e')]};});_0x20e7c5[_0xacd8('0x2f')]=_['map'](_0x513953,'name');_0x20e7c5[_0xacd8('0x30')]=_[_0xacd8('0x31')](_0x606f23[_0xacd8('0x30')]);_0x20e7c5[_0xacd8('0x32')]=_[_0xacd8('0x33')](_0x20e7c5['model'],_0x20e7c5[_0xacd8('0x30')]);_0xe4fae7[_0xacd8('0x34')]=_[_0xacd8('0x33')](_0x20e7c5['model'],qs[_0xacd8('0x35')](_0x606f23[_0xacd8('0x30')][_0xacd8('0x35')]));_0xe4fae7[_0xacd8('0x34')]=_0xe4fae7[_0xacd8('0x34')][_0xacd8('0x36')]?_0xe4fae7[_0xacd8('0x34')]:_0x20e7c5[_0xacd8('0x2f')];if(!_0x606f23[_0xacd8('0x30')][_0xacd8('0x37')](_0xacd8('0x38'))){_0xe4fae7[_0xacd8('0x1b')]=qs[_0xacd8('0x1b')](_0x606f23[_0xacd8('0x30')][_0xacd8('0x1b')]);_0xe4fae7[_0xacd8('0x1a')]=qs['offset'](_0x606f23[_0xacd8('0x30')][_0xacd8('0x1a')]);}_0xe4fae7[_0xacd8('0x39')]=qs['sort'](_0x606f23[_0xacd8('0x30')][_0xacd8('0x3a')]);_0xe4fae7['where']=qs[_0xacd8('0x32')](_[_0xacd8('0x3b')](_0x606f23['query'],_0x20e7c5[_0xacd8('0x32')]),_0x513953);if(_0x606f23[_0xacd8('0x30')][_0xacd8('0x3c')]){_0xe4fae7[_0xacd8('0x3d')]=_[_0xacd8('0x3e')](_0xe4fae7[_0xacd8('0x3d')],{'$or':_[_0xacd8('0x2a')](_0x513953,function(_0x3dca89){if(_0x3dca89[_0xacd8('0x3f')]!==_0xacd8('0x40')){var _0x495172={};_0x495172[_0x3dca89[_0xacd8('0x27')]]={'$like':'%'+_0x606f23[_0xacd8('0x30')][_0xacd8('0x3c')]+'%'};return _0x495172;}})});}_0xe4fae7=_['merge']({},_0xe4fae7,_0x606f23[_0xacd8('0x41')]);var _0x54e437={'where':_0xe4fae7['where']};return db[_0xacd8('0x2b')][_0xacd8('0x1d')](_0x54e437)[_0xacd8('0x21')](function(_0x5a3711){_0x17c774[_0xacd8('0x1d')]=_0x5a3711;if(_0x606f23[_0xacd8('0x30')][_0xacd8('0x42')]){_0xe4fae7[_0xacd8('0x43')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xacd8('0x44')](_0xe4fae7);})[_0xacd8('0x21')](function(_0x1512fb){_0x17c774[_0xacd8('0x45')]=_0x1512fb;return _0x17c774;})['then'](respondWithFilteredResult(_0x3b0057,_0xe4fae7))[_0xacd8('0x46')](handleError(_0x3b0057,null));};exports[_0xacd8('0x47')]=function(_0x57e741,_0x33162c){var _0x3b4307={'raw':!![],'where':{'id':_0x57e741['params']['id']}},_0x40f223={};_0x40f223[_0xacd8('0x2f')]=_[_0xacd8('0x31')](db['CmContactHasItem'][_0xacd8('0x2c')]);_0x40f223[_0xacd8('0x30')]=_[_0xacd8('0x31')](_0x57e741[_0xacd8('0x30')]);_0x40f223[_0xacd8('0x32')]=_[_0xacd8('0x33')](_0x40f223[_0xacd8('0x2f')],_0x40f223[_0xacd8('0x30')]);_0x3b4307[_0xacd8('0x34')]=_['intersection'](_0x40f223[_0xacd8('0x2f')],qs[_0xacd8('0x35')](_0x57e741['query']['fields']));_0x3b4307[_0xacd8('0x34')]=_0x3b4307[_0xacd8('0x34')][_0xacd8('0x36')]?_0x3b4307['attributes']:_0x40f223['model'];if(_0x57e741[_0xacd8('0x30')]['includeAll']){_0x3b4307[_0xacd8('0x43')]=[{'all':!![]}];}_0x3b4307=_['merge']({},_0x3b4307,_0x57e741[_0xacd8('0x41')]);return db[_0xacd8('0x2b')][_0xacd8('0x48')](_0x3b4307)[_0xacd8('0x21')](handleEntityNotFound(_0x33162c,null))[_0xacd8('0x21')](respondWithResult(_0x33162c,null))['catch'](handleError(_0x33162c,null));};exports['create']=function(_0x51bb3f,_0x4820e8){return db[_0xacd8('0x2b')]['create'](_0x51bb3f[_0xacd8('0x49')],{})[_0xacd8('0x21')](function(_0x366bd0){var _0x28c3a4=_0x51bb3f[_0xacd8('0x4a')][_0xacd8('0x4b')]({'plain':!![]});if(!_0x28c3a4)throw new Error(_0xacd8('0x4c'));if(_0x28c3a4[_0xacd8('0x4d')]===_0xacd8('0x4a')){var _0x2a2486=_0x366bd0[_0xacd8('0x4b')]({'plain':!![]});var _0x1fd2db=_0xacd8('0x23');return db[_0xacd8('0x4e')][_0xacd8('0x48')]({'where':{'name':_0x1fd2db,'userProfileId':_0x28c3a4[_0xacd8('0x4f')]},'raw':!![]})[_0xacd8('0x21')](function(_0x4ddbcd){if(_0x4ddbcd&&_0x4ddbcd['autoAssociation']===0x0){return db[_0xacd8('0x24')][_0xacd8('0x50')]({'name':_0x2a2486[_0xacd8('0x27')],'resourceId':_0x2a2486['id'],'type':_0x4ddbcd[_0xacd8('0x27')],'sectionId':_0x4ddbcd['id']},{})[_0xacd8('0x21')](function(){return _0x366bd0;});}else{return _0x366bd0;}})[_0xacd8('0x46')](function(_0x5967f5){logger[_0xacd8('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5967f5);throw _0x5967f5;});}return _0x366bd0;})[_0xacd8('0x21')](respondWithResult(_0x4820e8,0xc9))[_0xacd8('0x46')](handleError(_0x4820e8,null));};exports[_0xacd8('0x20')]=function(_0x137e43,_0x386d44){if(_0x137e43[_0xacd8('0x49')]['id']){delete _0x137e43[_0xacd8('0x49')]['id'];}return db[_0xacd8('0x2b')][_0xacd8('0x48')]({'where':{'id':_0x137e43[_0xacd8('0x51')]['id']}})[_0xacd8('0x21')](handleEntityNotFound(_0x386d44,null))[_0xacd8('0x21')](saveUpdates(_0x137e43[_0xacd8('0x49')],null))['then'](respondWithResult(_0x386d44,null))[_0xacd8('0x46')](handleError(_0x386d44,null));};exports[_0xacd8('0x22')]=function(_0x45e4be,_0x437bb7){return db[_0xacd8('0x2b')][_0xacd8('0x48')]({'where':{'id':_0x45e4be[_0xacd8('0x51')]['id']}})[_0xacd8('0x21')](handleEntityNotFound(_0x437bb7,null))[_0xacd8('0x21')](removeEntity(_0x437bb7,null))['catch'](handleError(_0x437bb7,null));}; \ No newline at end of file +var _0x4c7b=['path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','save','update','then','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','fields','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x1f7046,_0x1d8271){var _0x2b2c3e=function(_0x49aa64){while(--_0x49aa64){_0x1f7046['push'](_0x1f7046['shift']());}};_0x2b2c3e(++_0x1d8271);}(_0x4c7b,0x1f2));var _0xb4c7=function(_0xfb3b3e,_0x33ba5b){_0xfb3b3e=_0xfb3b3e-0x0;var _0x4bc22c=_0x4c7b[_0xfb3b3e];return _0x4bc22c;};'use strict';var emlformat=require(_0xb4c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4c7('0x1'));var jsonpatch=require(_0xb4c7('0x2'));var rp=require(_0xb4c7('0x3'));var moment=require(_0xb4c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb4c7('0x5'));var path=require(_0xb4c7('0x6'));var sox=require(_0xb4c7('0x7'));var csv=require('to-csv');var ejs=require(_0xb4c7('0x8'));var fs=require('fs');var fs_extra=require(_0xb4c7('0x9'));var _=require(_0xb4c7('0xa'));var squel=require(_0xb4c7('0xb'));var crypto=require('crypto');var jsforce=require(_0xb4c7('0xc'));var deskjs=require(_0xb4c7('0xd'));var toCsv=require(_0xb4c7('0xe'));var querystring=require(_0xb4c7('0xf'));var Papa=require(_0xb4c7('0x10'));var Redis=require(_0xb4c7('0x11'));var authService=require(_0xb4c7('0x12'));var qs=require(_0xb4c7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb4c7('0x14'));var config=require(_0xb4c7('0x15'));var licenseUtil=require(_0xb4c7('0x16'));var db=require(_0xb4c7('0x17'))['db'];function respondWithStatusCode(_0x321ce6,_0xc43e22){_0xc43e22=_0xc43e22||0xcc;return function(_0x170a46){if(_0x170a46){return _0x321ce6[_0xb4c7('0x18')](_0xc43e22);}return _0x321ce6[_0xb4c7('0x19')](_0xc43e22)[_0xb4c7('0x1a')]();};}function respondWithResult(_0x4aa0a5,_0x11bc5a){_0x11bc5a=_0x11bc5a||0xc8;return function(_0x4a6e0a){if(_0x4a6e0a){return _0x4aa0a5['status'](_0x11bc5a)['json'](_0x4a6e0a);}};}function respondWithFilteredResult(_0x263a82,_0x424082){return function(_0x346520){if(_0x346520){var _0x3e73dc=typeof _0x424082[_0xb4c7('0x1b')]==='undefined'&&typeof _0x424082[_0xb4c7('0x1c')]==='undefined';var _0x59366b=_0x346520[_0xb4c7('0x1d')];var _0x5e6e8e=_0x3e73dc?0x0:_0x424082[_0xb4c7('0x1b')];var _0x2e73d5=_0x3e73dc?_0x346520[_0xb4c7('0x1d')]:_0x424082[_0xb4c7('0x1b')]+_0x424082[_0xb4c7('0x1c')];var _0x3314f0;if(_0x2e73d5>=_0x59366b){_0x2e73d5=_0x59366b;_0x3314f0=0xc8;}else{_0x3314f0=0xce;}_0x263a82[_0xb4c7('0x19')](_0x3314f0);return _0x263a82[_0xb4c7('0x1e')](_0xb4c7('0x1f'),_0x5e6e8e+'-'+_0x2e73d5+'/'+_0x59366b)['json'](_0x346520);}return null;};}function patchUpdates(_0xb22b1a){return function(_0x3baed0){try{jsonpatch[_0xb4c7('0x20')](_0x3baed0,_0xb22b1a,!![]);}catch(_0x20f912){return BPromise[_0xb4c7('0x21')](_0x20f912);}return _0x3baed0[_0xb4c7('0x22')]();};}function saveUpdates(_0x14bcd6,_0x42e72f){return function(_0x475668){if(_0x475668){return _0x475668[_0xb4c7('0x23')](_0x14bcd6)[_0xb4c7('0x24')](function(_0x1e2ccf){return _0x1e2ccf;});}return null;};}function removeEntity(_0x242d73,_0x1e7329){return function(_0x3721ed){if(_0x3721ed){return _0x3721ed['destroy']()[_0xb4c7('0x24')](function(){var _0x5b3147=_0x3721ed['get']({'plain':!![]});var _0x227e3a=_0xb4c7('0x25');return db[_0xb4c7('0x26')][_0xb4c7('0x27')]({'where':{'type':_0x227e3a,'resourceId':_0x5b3147['id']}})[_0xb4c7('0x24')](function(){return _0x3721ed;});})[_0xb4c7('0x24')](function(){_0x242d73[_0xb4c7('0x19')](0xcc)[_0xb4c7('0x1a')]();});}};}function handleEntityNotFound(_0x289807,_0x4211d7){return function(_0x2f47f8){if(!_0x2f47f8){_0x289807[_0xb4c7('0x18')](0x194);}return _0x2f47f8;};}function handleError(_0x2e4102,_0x3d9683){_0x3d9683=_0x3d9683||0x1f4;return function(_0x1e6572){logger[_0xb4c7('0x28')](_0x1e6572[_0xb4c7('0x29')]);if(_0x1e6572[_0xb4c7('0x2a')]){delete _0x1e6572[_0xb4c7('0x2a')];}_0x2e4102[_0xb4c7('0x19')](_0x3d9683)[_0xb4c7('0x2b')](_0x1e6572);};}exports[_0xb4c7('0x2c')]=function(_0x464b91,_0x3cdd5c){var _0x4db7d7={},_0x117818={},_0x3d969c={'count':0x0,'rows':[]};var _0x297c8e=_[_0xb4c7('0x2d')](db[_0xb4c7('0x2e')][_0xb4c7('0x2f')],function(_0x54eb90){return{'name':_0x54eb90[_0xb4c7('0x30')],'type':_0x54eb90[_0xb4c7('0x31')][_0xb4c7('0x32')]};});_0x117818['model']=_[_0xb4c7('0x2d')](_0x297c8e,'name');_0x117818['query']=_[_0xb4c7('0x33')](_0x464b91['query']);_0x117818[_0xb4c7('0x34')]=_['intersection'](_0x117818[_0xb4c7('0x35')],_0x117818[_0xb4c7('0x36')]);_0x4db7d7[_0xb4c7('0x37')]=_[_0xb4c7('0x38')](_0x117818[_0xb4c7('0x35')],qs['fields'](_0x464b91['query']['fields']));_0x4db7d7[_0xb4c7('0x37')]=_0x4db7d7[_0xb4c7('0x37')][_0xb4c7('0x39')]?_0x4db7d7['attributes']:_0x117818['model'];if(!_0x464b91['query'][_0xb4c7('0x3a')](_0xb4c7('0x3b'))){_0x4db7d7['limit']=qs['limit'](_0x464b91[_0xb4c7('0x36')]['limit']);_0x4db7d7[_0xb4c7('0x1b')]=qs[_0xb4c7('0x1b')](_0x464b91[_0xb4c7('0x36')]['offset']);}_0x4db7d7[_0xb4c7('0x3c')]=qs[_0xb4c7('0x3d')](_0x464b91[_0xb4c7('0x36')][_0xb4c7('0x3d')]);_0x4db7d7['where']=qs[_0xb4c7('0x34')](_[_0xb4c7('0x3e')](_0x464b91[_0xb4c7('0x36')],_0x117818[_0xb4c7('0x34')]),_0x297c8e);if(_0x464b91[_0xb4c7('0x36')][_0xb4c7('0x3f')]){_0x4db7d7[_0xb4c7('0x40')]=_['merge'](_0x4db7d7[_0xb4c7('0x40')],{'$or':_['map'](_0x297c8e,function(_0x1e249d){if(_0x1e249d[_0xb4c7('0x31')]!=='VIRTUAL'){var _0x4a7283={};_0x4a7283[_0x1e249d[_0xb4c7('0x2a')]]={'$like':'%'+_0x464b91['query'][_0xb4c7('0x3f')]+'%'};return _0x4a7283;}})});}_0x4db7d7=_[_0xb4c7('0x41')]({},_0x4db7d7,_0x464b91[_0xb4c7('0x42')]);var _0x368b0e={'where':_0x4db7d7[_0xb4c7('0x40')]};return db[_0xb4c7('0x2e')][_0xb4c7('0x1d')](_0x368b0e)['then'](function(_0xdf1507){_0x3d969c[_0xb4c7('0x1d')]=_0xdf1507;if(_0x464b91[_0xb4c7('0x36')][_0xb4c7('0x43')]){_0x4db7d7[_0xb4c7('0x44')]=[{'all':!![]}];}return db[_0xb4c7('0x2e')]['findAll'](_0x4db7d7);})[_0xb4c7('0x24')](function(_0x1a9dae){_0x3d969c[_0xb4c7('0x45')]=_0x1a9dae;return _0x3d969c;})[_0xb4c7('0x24')](respondWithFilteredResult(_0x3cdd5c,_0x4db7d7))[_0xb4c7('0x46')](handleError(_0x3cdd5c,null));};exports[_0xb4c7('0x47')]=function(_0x56e735,_0x15c331){var _0x2cd8ce={'raw':!![],'where':{'id':_0x56e735[_0xb4c7('0x48')]['id']}},_0x3a270c={};_0x3a270c[_0xb4c7('0x35')]=_[_0xb4c7('0x33')](db[_0xb4c7('0x2e')][_0xb4c7('0x2f')]);_0x3a270c[_0xb4c7('0x36')]=_[_0xb4c7('0x33')](_0x56e735[_0xb4c7('0x36')]);_0x3a270c[_0xb4c7('0x34')]=_['intersection'](_0x3a270c[_0xb4c7('0x35')],_0x3a270c['query']);_0x2cd8ce[_0xb4c7('0x37')]=_[_0xb4c7('0x38')](_0x3a270c[_0xb4c7('0x35')],qs[_0xb4c7('0x49')](_0x56e735['query'][_0xb4c7('0x49')]));_0x2cd8ce[_0xb4c7('0x37')]=_0x2cd8ce['attributes'][_0xb4c7('0x39')]?_0x2cd8ce['attributes']:_0x3a270c['model'];if(_0x56e735[_0xb4c7('0x36')]['includeAll']){_0x2cd8ce[_0xb4c7('0x44')]=[{'all':!![]}];}_0x2cd8ce=_[_0xb4c7('0x41')]({},_0x2cd8ce,_0x56e735[_0xb4c7('0x42')]);return db[_0xb4c7('0x2e')][_0xb4c7('0x4a')](_0x2cd8ce)['then'](handleEntityNotFound(_0x15c331,null))[_0xb4c7('0x24')](respondWithResult(_0x15c331,null))[_0xb4c7('0x46')](handleError(_0x15c331,null));};exports[_0xb4c7('0x4b')]=function(_0x1ebeae,_0x4f114e){return db[_0xb4c7('0x2e')]['create'](_0x1ebeae[_0xb4c7('0x4c')],{})[_0xb4c7('0x24')](function(_0x5d2ee5){var _0x2563d8=_0x1ebeae[_0xb4c7('0x4d')][_0xb4c7('0x4e')]({'plain':!![]});if(!_0x2563d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2563d8[_0xb4c7('0x4f')]===_0xb4c7('0x4d')){var _0x1fb906=_0x5d2ee5['get']({'plain':!![]});var _0x144a13='CmContactHasItems';return db[_0xb4c7('0x50')][_0xb4c7('0x4a')]({'where':{'name':_0x144a13,'userProfileId':_0x2563d8[_0xb4c7('0x51')]},'raw':!![]})[_0xb4c7('0x24')](function(_0x46a6bd){if(_0x46a6bd&&_0x46a6bd[_0xb4c7('0x52')]===0x0){return db[_0xb4c7('0x26')][_0xb4c7('0x4b')]({'name':_0x1fb906[_0xb4c7('0x2a')],'resourceId':_0x1fb906['id'],'type':_0x46a6bd[_0xb4c7('0x2a')],'sectionId':_0x46a6bd['id']},{})[_0xb4c7('0x24')](function(){return _0x5d2ee5;});}else{return _0x5d2ee5;}})['catch'](function(_0x597b60){logger[_0xb4c7('0x28')](_0xb4c7('0x53'),_0x597b60);throw _0x597b60;});}return _0x5d2ee5;})['then'](respondWithResult(_0x4f114e,0xc9))[_0xb4c7('0x46')](handleError(_0x4f114e,null));};exports[_0xb4c7('0x23')]=function(_0x20cc17,_0x2343d0){if(_0x20cc17[_0xb4c7('0x4c')]['id']){delete _0x20cc17[_0xb4c7('0x4c')]['id'];}return db['CmContactHasItem'][_0xb4c7('0x4a')]({'where':{'id':_0x20cc17[_0xb4c7('0x48')]['id']}})[_0xb4c7('0x24')](handleEntityNotFound(_0x2343d0,null))[_0xb4c7('0x24')](saveUpdates(_0x20cc17[_0xb4c7('0x4c')],null))[_0xb4c7('0x24')](respondWithResult(_0x2343d0,null))['catch'](handleError(_0x2343d0,null));};exports[_0xb4c7('0x27')]=function(_0x332687,_0x381398){return db[_0xb4c7('0x2e')][_0xb4c7('0x4a')]({'where':{'id':_0x332687[_0xb4c7('0x48')]['id']}})[_0xb4c7('0x24')](handleEntityNotFound(_0x381398,null))[_0xb4c7('0x24')](removeEntity(_0x381398,null))['catch'](handleError(_0x381398,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 1ee63dc..d74294d 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 _0xb606=['CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x4e354d,_0x2d8b96){var _0x38bdf9=function(_0x4b99d0){while(--_0x4b99d0){_0x4e354d['push'](_0x4e354d['shift']());}};_0x38bdf9(++_0x2d8b96);}(_0xb606,0x14c));var _0x6b60=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb606[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x6b60('0x0'));var util=require(_0x6b60('0x1'));var logger=require(_0x6b60('0x2'))('api');var moment=require(_0x6b60('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b60('0x4'));var fs=require('fs');var path=require(_0x6b60('0x5'));var rimraf=require(_0x6b60('0x6'));var config=require(_0x6b60('0x7'));var attributes=require(_0x6b60('0x8'));module['exports']=function(_0x533fe5,_0x3fc90f){return _0x533fe5['define'](_0x6b60('0x9'),attributes,{'tableName':_0x6b60('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10a3=['rimraf','../../config/environment','./cmContactHasItem.attributes','exports','cm_contact_has_items','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3d65f4,_0xe14c3){var _0x128310=function(_0x228fe7){while(--_0x228fe7){_0x3d65f4['push'](_0x3d65f4['shift']());}};_0x128310(++_0xe14c3);}(_0x10a3,0x19d));var _0x310a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x10a3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x310a('0x0'));var util=require(_0x310a('0x1'));var logger=require(_0x310a('0x2'))(_0x310a('0x3'));var moment=require('moment');var BPromise=require(_0x310a('0x4'));var rp=require(_0x310a('0x5'));var fs=require('fs');var path=require(_0x310a('0x6'));var rimraf=require(_0x310a('0x7'));var config=require(_0x310a('0x8'));var attributes=require(_0x310a('0x9'));module[_0x310a('0xa')]=function(_0x2856e8,_0xb54764){return _0x2856e8['define']('CmContactHasItem',attributes,{'tableName':_0x310a('0xb'),'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 1295aed..574b838 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 _0xfb4b=['../../config/environment','jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3fa296,_0x2bd315){var _0x10b19f=function(_0x2c868d){while(--_0x2c868d){_0x3fa296['push'](_0x3fa296['shift']());}};_0x10b19f(++_0x2bd315);}(_0xfb4b,0x67));var _0xbfb4=function(_0x7ad69b,_0x11ae97){_0x7ad69b=_0x7ad69b-0x0;var _0x5e8d5d=_0xfb4b[_0x7ad69b];return _0x5e8d5d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbfb4('0x0'));var BPromise=require(_0xbfb4('0x1'));var rs=require(_0xbfb4('0x2'));var fs=require('fs');var Redis=require(_0xbfb4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfb4('0x4'));var logger=require(_0xbfb4('0x5'))(_0xbfb4('0x6'));var config=require(_0xbfb4('0x7'));var jayson=require(_0xbfb4('0x8'));var client=jayson[_0xbfb4('0x9')][_0xbfb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x93d1c9,_0x1be572,_0xb43bef){return new BPromise(function(_0x1feeab,_0x3381f8){return client[_0xbfb4('0xb')](_0x93d1c9,_0xb43bef)['then'](function(_0x342fde){logger[_0xbfb4('0xc')](_0xbfb4('0xd'),_0x1be572,'request\x20sent');logger[_0xbfb4('0xe')](_0xbfb4('0xf'),_0x1be572,_0xbfb4('0x10'),JSON['stringify'](_0x342fde));if(_0x342fde[_0xbfb4('0x11')]){if(_0x342fde[_0xbfb4('0x11')][_0xbfb4('0x12')]===0x1f4){logger[_0xbfb4('0x11')](_0xbfb4('0xd'),_0x1be572,_0x342fde['error'][_0xbfb4('0x13')]);return _0x3381f8(_0x342fde['error'][_0xbfb4('0x13')]);}logger[_0xbfb4('0x11')](_0xbfb4('0xd'),_0x1be572,_0x342fde[_0xbfb4('0x11')][_0xbfb4('0x13')]);return _0x1feeab(_0x342fde[_0xbfb4('0x11')][_0xbfb4('0x13')]);}else{logger[_0xbfb4('0xc')](_0xbfb4('0xd'),_0x1be572,_0xbfb4('0x10'));_0x1feeab(_0x342fde[_0xbfb4('0x14')][_0xbfb4('0x13')]);}})[_0xbfb4('0x15')](function(_0x2464a2){logger['error'](_0xbfb4('0xd'),_0x1be572,_0x2464a2);_0x3381f8(_0x2464a2);});});} \ No newline at end of file +var _0x2041=['CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0xf6c3f9,_0x5baded){var _0x52bf4f=function(_0x51cdd8){while(--_0x51cdd8){_0xf6c3f9['push'](_0xf6c3f9['shift']());}};_0x52bf4f(++_0x5baded);}(_0x2041,0x1a7));var _0x1204=function(_0x4b19a9,_0x486bff){_0x4b19a9=_0x4b19a9-0x0;var _0x5311cb=_0x2041[_0x4b19a9];return _0x5311cb;};'use strict';var _=require(_0x1204('0x0'));var util=require(_0x1204('0x1'));var moment=require(_0x1204('0x2'));var BPromise=require(_0x1204('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1204('0x4'));var db=require(_0x1204('0x5'))['db'];var utils=require(_0x1204('0x6'));var logger=require(_0x1204('0x7'))(_0x1204('0x8'));var config=require(_0x1204('0x9'));var jayson=require(_0x1204('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x201950,_0xba9f81,_0x5c6c74){return new BPromise(function(_0x53209b,_0x5bfe46){return client[_0x1204('0xb')](_0x201950,_0x5c6c74)[_0x1204('0xc')](function(_0x121526){logger[_0x1204('0xd')](_0x1204('0xe'),_0xba9f81,_0x1204('0xf'));logger['debug'](_0x1204('0x10'),_0xba9f81,_0x1204('0xf'),JSON[_0x1204('0x11')](_0x121526));if(_0x121526[_0x1204('0x12')]){if(_0x121526[_0x1204('0x12')][_0x1204('0x13')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0xba9f81,_0x121526[_0x1204('0x12')][_0x1204('0x14')]);return _0x5bfe46(_0x121526['error']['message']);}logger['error'](_0x1204('0xe'),_0xba9f81,_0x121526[_0x1204('0x12')][_0x1204('0x14')]);return _0x53209b(_0x121526['error'][_0x1204('0x14')]);}else{logger[_0x1204('0xd')](_0x1204('0xe'),_0xba9f81,_0x1204('0xf'));_0x53209b(_0x121526[_0x1204('0x15')][_0x1204('0x14')]);}})[_0x1204('0x16')](function(_0x2ad2ab){logger[_0x1204('0x12')](_0x1204('0xe'),_0xba9f81,_0x2ad2ab);_0x5bfe46(_0x2ad2ab);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 4dccd95..96bed67 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 _0x6de9=['./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6de9,0xe6));var _0x96de=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6de9[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x96de('0x0'));var util=require(_0x96de('0x1'));var path=require(_0x96de('0x2'));var timeout=require(_0x96de('0x3'));var express=require(_0x96de('0x4'));var router=express['Router']();var fs_extra=require(_0x96de('0x5'));var auth=require(_0x96de('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x96de('0x7'));var controller=require(_0x96de('0x8'));router['get']('/',auth[_0x96de('0x9')](),controller[_0x96de('0xa')]);router[_0x96de('0xb')](_0x96de('0xc'),auth['isAuthenticated'](),controller[_0x96de('0xd')]);router[_0x96de('0xe')]('/',auth[_0x96de('0x9')](),controller['create']);router[_0x96de('0xf')](_0x96de('0xc'),auth[_0x96de('0x9')](),controller['update']);router['delete'](_0x96de('0xc'),auth[_0x96de('0x9')](),controller['destroy']);module[_0x96de('0x10')]=router; \ No newline at end of file +var _0x6dcd=['./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','put','update','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0x6dcd,0xa2));var _0xd6dc=function(_0xe6f715,_0x2e268f){_0xe6f715=_0xe6f715-0x0;var _0x24567c=_0x6dcd[_0xe6f715];return _0x24567c;};'use strict';var multer=require('multer');var util=require(_0xd6dc('0x0'));var path=require('path');var timeout=require(_0xd6dc('0x1'));var express=require(_0xd6dc('0x2'));var router=express[_0xd6dc('0x3')]();var fs_extra=require(_0xd6dc('0x4'));var auth=require(_0xd6dc('0x5'));var interaction=require(_0xd6dc('0x6'));var config=require(_0xd6dc('0x7'));var controller=require(_0xd6dc('0x8'));router[_0xd6dc('0x9')]('/',auth[_0xd6dc('0xa')](),controller[_0xd6dc('0xb')]);router[_0xd6dc('0x9')](_0xd6dc('0xc'),auth[_0xd6dc('0xa')](),controller[_0xd6dc('0xd')]);router[_0xd6dc('0xe')]('/',auth[_0xd6dc('0xa')](),controller['create']);router[_0xd6dc('0xf')](_0xd6dc('0xc'),auth[_0xd6dc('0xa')](),controller[_0xd6dc('0x10')]);router['delete'](_0xd6dc('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index fb42005..9fc74a2 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 _0x4bbc=['long','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','alias','STRING','TEXT'];(function(_0x26b0ea,_0x35518a){var _0x5a2d25=function(_0x2a1cc3){while(--_0x2a1cc3){_0x26b0ea['push'](_0x26b0ea['shift']());}};_0x5a2d25(++_0x35518a);}(_0x4bbc,0x1d6));var _0xc4bb=function(_0x181916,_0x376121){_0x181916=_0x181916-0x0;var _0x29d507=_0x4bbc[_0x181916];return _0x29d507;};'use strict';var Sequelize=require(_0xc4bb('0x0'));var _=require(_0xc4bb('0x1'));module['exports']={'name':{'type':Sequelize[_0xc4bb('0x2')],'get':function(_0x34f179){return this['getDataValue'](_0xc4bb('0x3'));}},'alias':{'type':Sequelize[_0xc4bb('0x4')],'allowNull':![],'set':function(_0x9d0433){this['setDataValue'](_0xc4bb('0x3'),_0x9d0433?_0x9d0433:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xc4bb('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xc4bb('0x5')](_0xc4bb('0x6')),'get':function(){if(this['getDataValue'](_0xc4bb('0x7'))===_0xc4bb('0x8')){return JSON[_0xc4bb('0x9')](this['getDataValue'](_0xc4bb('0xa')));}else{return this['getDataValue'](_0xc4bb('0xa'));}},'set':function(_0x29b4f6){if(Array[_0xc4bb('0xb')](_0x29b4f6)){this[_0xc4bb('0xc')](_0xc4bb('0xa'),JSON[_0xc4bb('0xd')](_0x29b4f6));}else{this[_0xc4bb('0xc')](_0xc4bb('0xa'),_0x29b4f6);}}},'required':{'type':Sequelize[_0xc4bb('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc4bb('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc4bb('0xf')](_0xc4bb('0x10'))}}; \ No newline at end of file +var _0x23e6=['parse','values','isArray','stringify','setDataValue','BOOLEAN','ENUM','sequelize','lodash','STRING','alias','getDataValue','TEXT','long','select'];(function(_0x9d8e92,_0x22dec7){var _0xfc7977=function(_0x55f0fd){while(--_0x55f0fd){_0x9d8e92['push'](_0x9d8e92['shift']());}};_0xfc7977(++_0x22dec7);}(_0x23e6,0x142));var _0x623e=function(_0x3b3331,_0x420c2f){_0x3b3331=_0x3b3331-0x0;var _0x214e10=_0x23e6[_0x3b3331];return _0x214e10;};'use strict';var Sequelize=require(_0x623e('0x0'));var _=require(_0x623e('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x188a64){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x623e('0x2')],'allowNull':![],'set':function(_0x27f1a6){this['setDataValue'](_0x623e('0x3'),_0x27f1a6?_0x27f1a6:this[_0x623e('0x4')]('name'));}},'type':{'type':Sequelize[_0x623e('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0x623e('0x5')](_0x623e('0x6')),'get':function(){if(this[_0x623e('0x4')]('type')===_0x623e('0x7')){return JSON[_0x623e('0x8')](this[_0x623e('0x4')]('values'));}else{return this[_0x623e('0x4')](_0x623e('0x9'));}},'set':function(_0x26873e){if(Array[_0x623e('0xa')](_0x26873e)){this['setDataValue']('values',JSON[_0x623e('0xb')](_0x26873e));}else{this[_0x623e('0xc')](_0x623e('0x9'),_0x26873e);}}},'required':{'type':Sequelize[_0x623e('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x623e('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x623e('0xe')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 027c604..e1d57a3 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 _0xafe1=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','model','differenceBy','map','query','keys','intersection','fields','attributes','hasOwnProperty','order','where','pick','filters','filter','merge','VIRTUAL','CmCustomField','includeAll','catch','show','params','length','include','options','find','body','create','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','sequelize','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path'];(function(_0x1b79fa,_0x209061){var _0x864a7c=function(_0x4c1402){while(--_0x4c1402){_0x1b79fa['push'](_0x1b79fa['shift']());}};_0x864a7c(++_0x209061);}(_0xafe1,0x14a));var _0x1afe=function(_0x1f7367,_0x2bc8e6){_0x1f7367=_0x1f7367-0x0;var _0xb41671=_0xafe1[_0x1f7367];return _0xb41671;};'use strict';var emlformat=require(_0x1afe('0x0'));var rimraf=require(_0x1afe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1afe('0x2'));var rp=require(_0x1afe('0x3'));var moment=require('moment');var BPromise=require(_0x1afe('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1afe('0x5'));var sox=require(_0x1afe('0x6'));var csv=require(_0x1afe('0x7'));var ejs=require(_0x1afe('0x8'));var fs=require('fs');var fs_extra=require(_0x1afe('0x9'));var _=require(_0x1afe('0xa'));var squel=require(_0x1afe('0xb'));var crypto=require('crypto');var jsforce=require(_0x1afe('0xc'));var deskjs=require(_0x1afe('0xd'));var toCsv=require(_0x1afe('0x7'));var querystring=require(_0x1afe('0xe'));var Papa=require(_0x1afe('0xf'));var Redis=require('ioredis');var authService=require(_0x1afe('0x10'));var qs=require(_0x1afe('0x11'));var as=require(_0x1afe('0x12'));var hardwareService=require(_0x1afe('0x13'));var logger=require(_0x1afe('0x14'))('api');var utils=require(_0x1afe('0x15'));var config=require(_0x1afe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1afe('0x17'))['db'];function respondWithStatusCode(_0x517339,_0x5d6eb5){_0x5d6eb5=_0x5d6eb5||0xcc;return function(_0x58c457){if(_0x58c457){return _0x517339[_0x1afe('0x18')](_0x5d6eb5);}return _0x517339[_0x1afe('0x19')](_0x5d6eb5)[_0x1afe('0x1a')]();};}function respondWithResult(_0x46796f,_0x15007a){_0x15007a=_0x15007a||0xc8;return function(_0x148eb7){if(_0x148eb7){return _0x46796f[_0x1afe('0x19')](_0x15007a)['json'](_0x148eb7);}};}function respondWithFilteredResult(_0xbd3c4c,_0x317cca){return function(_0x3e7b4d){if(_0x3e7b4d){var _0x4c7442=typeof _0x317cca[_0x1afe('0x1b')]===_0x1afe('0x1c')&&typeof _0x317cca[_0x1afe('0x1d')]===_0x1afe('0x1c');var _0x2c3007=_0x3e7b4d[_0x1afe('0x1e')];var _0x1cb0e4=_0x4c7442?0x0:_0x317cca['offset'];var _0x344489=_0x4c7442?_0x3e7b4d[_0x1afe('0x1e')]:_0x317cca['offset']+_0x317cca[_0x1afe('0x1d')];var _0x2283bd;if(_0x344489>=_0x2c3007){_0x344489=_0x2c3007;_0x2283bd=0xc8;}else{_0x2283bd=0xce;}_0xbd3c4c[_0x1afe('0x19')](_0x2283bd);return _0xbd3c4c[_0x1afe('0x1f')](_0x1afe('0x20'),_0x1cb0e4+'-'+_0x344489+'/'+_0x2c3007)['json'](_0x3e7b4d);}return null;};}function patchUpdates(_0x64cc83){return function(_0x448069){try{jsonpatch['apply'](_0x448069,_0x64cc83,!![]);}catch(_0x177907){return BPromise[_0x1afe('0x21')](_0x177907);}return _0x448069[_0x1afe('0x22')]();};}function saveUpdates(_0x3188e5,_0x5caaf5){return function(_0x53fc9b){if(_0x53fc9b){return _0x53fc9b[_0x1afe('0x23')](_0x3188e5)[_0x1afe('0x24')](function(_0x5263a9){return _0x5263a9;});}return null;};}function removeEntity(_0xc76c95,_0x16adf4){return function(_0x3a58a3){if(_0x3a58a3){return _0x3a58a3[_0x1afe('0x25')]()['then'](function(){_0xc76c95[_0x1afe('0x19')](0xcc)[_0x1afe('0x1a')]();});}};}function handleEntityNotFound(_0x30c2f8,_0x10072f){return function(_0x40eb3f){if(!_0x40eb3f){_0x30c2f8['sendStatus'](0x194);}return _0x40eb3f;};}function handleError(_0x44b8c9,_0x34806f){_0x34806f=_0x34806f||0x1f4;return function(_0x410be8){logger[_0x1afe('0x26')](_0x410be8['stack']);if(_0x410be8['name']){delete _0x410be8[_0x1afe('0x27')];}_0x44b8c9[_0x1afe('0x19')](_0x34806f)[_0x1afe('0x28')](_0x410be8);};}exports[_0x1afe('0x29')]=function(_0x5615c8,_0x4d98cc){var _0x8d687b={},_0x4c319a={},_0x5c804b={'count':0x0,'rows':[]};var _0xd8834e=_['map'](db['CmCustomField'][_0x1afe('0x2a')],function(_0x8a0d03){return{'name':_0x8a0d03['fieldName'],'type':_0x8a0d03[_0x1afe('0x2b')][_0x1afe('0x2c')]};});_0x4c319a[_0x1afe('0x2d')]=_[_0x1afe('0x2e')](_[_0x1afe('0x2f')](_0xd8834e,_0x1afe('0x27')),[_0x1afe('0x27')]);_0x4c319a[_0x1afe('0x30')]=_[_0x1afe('0x31')](_0x5615c8['query']);_0x4c319a['filters']=_[_0x1afe('0x32')](_0x4c319a[_0x1afe('0x2d')],_0x4c319a['query']);_0x8d687b['attributes']=_['intersection'](_0x4c319a[_0x1afe('0x2d')],qs[_0x1afe('0x33')](_0x5615c8[_0x1afe('0x30')][_0x1afe('0x33')]));_0x8d687b[_0x1afe('0x34')]=_0x8d687b[_0x1afe('0x34')]['length']?_0x8d687b['attributes']:_0x4c319a[_0x1afe('0x2d')];if(!_0x5615c8['query'][_0x1afe('0x35')]('nolimit')){_0x8d687b[_0x1afe('0x1d')]=qs[_0x1afe('0x1d')](_0x5615c8['query'][_0x1afe('0x1d')]);_0x8d687b[_0x1afe('0x1b')]=qs[_0x1afe('0x1b')](_0x5615c8[_0x1afe('0x30')][_0x1afe('0x1b')]);}_0x8d687b[_0x1afe('0x36')]=qs['sort'](_0x5615c8[_0x1afe('0x30')]['sort']);_0x8d687b[_0x1afe('0x37')]=qs['filters'](_[_0x1afe('0x38')](_0x5615c8[_0x1afe('0x30')],_0x4c319a[_0x1afe('0x39')]),_0xd8834e);if(_0x5615c8[_0x1afe('0x30')][_0x1afe('0x3a')]){_0x8d687b[_0x1afe('0x37')]=_[_0x1afe('0x3b')](_0x8d687b[_0x1afe('0x37')],{'$or':_[_0x1afe('0x2f')](_0xd8834e,function(_0x3eb5b8){if(_0x3eb5b8['type']!==_0x1afe('0x3c')){var _0x271997={};_0x271997[_0x3eb5b8[_0x1afe('0x27')]]={'$like':'%'+_0x5615c8[_0x1afe('0x30')][_0x1afe('0x3a')]+'%'};return _0x271997;}})});}_0x8d687b=_[_0x1afe('0x3b')]({},_0x8d687b,_0x5615c8['options']);var _0xa6e31b={'where':_0x8d687b[_0x1afe('0x37')]};return db[_0x1afe('0x3d')]['count'](_0xa6e31b)['then'](function(_0x37837b){_0x5c804b[_0x1afe('0x1e')]=_0x37837b;if(_0x5615c8['query'][_0x1afe('0x3e')]){_0x8d687b['include']=[{'all':!![]}];}return db[_0x1afe('0x3d')]['findAll'](_0x8d687b);})[_0x1afe('0x24')](function(_0x484475){_0x5c804b['rows']=_0x484475;return _0x5c804b;})[_0x1afe('0x24')](respondWithFilteredResult(_0x4d98cc,_0x8d687b))[_0x1afe('0x3f')](handleError(_0x4d98cc,null));};exports[_0x1afe('0x40')]=function(_0x2c06b7,_0x7e8ab9){var _0x142ad0={'raw':!![],'where':{'id':_0x2c06b7[_0x1afe('0x41')]['id']}},_0x4d18c1={};_0x4d18c1[_0x1afe('0x2d')]=_[_0x1afe('0x31')](db[_0x1afe('0x3d')]['rawAttributes']);_0x4d18c1['query']=_[_0x1afe('0x31')](_0x2c06b7[_0x1afe('0x30')]);_0x4d18c1[_0x1afe('0x39')]=_[_0x1afe('0x32')](_0x4d18c1['model'],_0x4d18c1[_0x1afe('0x30')]);_0x142ad0[_0x1afe('0x34')]=_['intersection'](_0x4d18c1['model'],qs[_0x1afe('0x33')](_0x2c06b7[_0x1afe('0x30')]['fields']));_0x142ad0['attributes']=_0x142ad0[_0x1afe('0x34')][_0x1afe('0x42')]?_0x142ad0[_0x1afe('0x34')]:_0x4d18c1['model'];if(_0x2c06b7[_0x1afe('0x30')][_0x1afe('0x3e')]){_0x142ad0[_0x1afe('0x43')]=[{'all':!![]}];}_0x142ad0=_[_0x1afe('0x3b')]({},_0x142ad0,_0x2c06b7[_0x1afe('0x44')]);return db[_0x1afe('0x3d')][_0x1afe('0x45')](_0x142ad0)['then'](handleEntityNotFound(_0x7e8ab9,null))[_0x1afe('0x24')](respondWithResult(_0x7e8ab9,null))[_0x1afe('0x3f')](handleError(_0x7e8ab9,null));};exports['update']=function(_0x3ab36f,_0x38596b){if(_0x3ab36f['body']['id']){delete _0x3ab36f[_0x1afe('0x46')]['id'];}return db[_0x1afe('0x3d')][_0x1afe('0x45')]({'where':{'id':_0x3ab36f[_0x1afe('0x41')]['id']}})[_0x1afe('0x24')](handleEntityNotFound(_0x38596b,null))[_0x1afe('0x24')](saveUpdates(_0x3ab36f['body'],null))[_0x1afe('0x24')](respondWithResult(_0x38596b,null))[_0x1afe('0x3f')](handleError(_0x38596b,null));};exports['destroy']=function(_0x544d33,_0x40e70f){return db[_0x1afe('0x3d')][_0x1afe('0x45')]({'where':{'id':_0x544d33['params']['id']}})[_0x1afe('0x24')](handleEntityNotFound(_0x40e70f,null))[_0x1afe('0x24')](removeEntity(_0x40e70f,null))[_0x1afe('0x3f')](handleError(_0x40e70f,null));};exports[_0x1afe('0x47')]=function(_0x161f1f,_0x2c992e){var _0x307c32;return db['sequelize']['transaction'](function(_0x221c19){return db[_0x1afe('0x3d')][_0x1afe('0x47')](_0x161f1f['body'],{'transaction':_0x221c19})['then'](function(_0x3a4c60){_0x307c32=_0x3a4c60;var _0x44e0d6={'type':db['Sequelize'][_0x1afe('0x48')],'transaction':_0x221c19};switch(_0x161f1f[_0x1afe('0x46')][_0x1afe('0x2b')]){case _0x1afe('0x49'):_0x44e0d6[_0x1afe('0x2b')]=db[_0x1afe('0x4a')][_0x1afe('0x48')];break;case _0x1afe('0x4b'):_0x44e0d6[_0x1afe('0x2b')]=db['Sequelize'][_0x1afe('0x4c')];break;case _0x1afe('0x4d'):_0x44e0d6[_0x1afe('0x2b')]=db['Sequelize']['BOOLEAN'];_0x44e0d6[_0x1afe('0x4e')]=![];break;default:}return db[_0x1afe('0x4f')]['queryInterface'][_0x1afe('0x50')](_0x1afe('0x51'),util[_0x1afe('0x52')](_0x1afe('0x53'),_0x307c32['id']),_0x44e0d6);})[_0x1afe('0x24')](function(){return _0x307c32;});})[_0x1afe('0x24')](respondWithResult(_0x2c992e,0xc9))['catch'](handleError(_0x2c992e,null));}; \ No newline at end of file +var _0x4883=['pick','merge','filter','options','rows','catch','keys','includeAll','include','body','find','params','sequelize','transaction','create','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','end','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x441ea4,_0x509625){var _0x28d9b1=function(_0x2f8a00){while(--_0x2f8a00){_0x441ea4['push'](_0x441ea4['shift']());}};_0x28d9b1(++_0x509625);}(_0x4883,0x166));var _0x3488=function(_0x37f687,_0x5b9634){_0x37f687=_0x37f687-0x0;var _0xfa776d=_0x4883[_0x37f687];return _0xfa776d;};'use strict';var emlformat=require(_0x3488('0x0'));var rimraf=require(_0x3488('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3488('0x2'));var moment=require(_0x3488('0x3'));var BPromise=require(_0x3488('0x4'));var Mustache=require(_0x3488('0x5'));var util=require('util');var path=require(_0x3488('0x6'));var sox=require(_0x3488('0x7'));var csv=require(_0x3488('0x8'));var ejs=require(_0x3488('0x9'));var fs=require('fs');var fs_extra=require(_0x3488('0xa'));var _=require(_0x3488('0xb'));var squel=require(_0x3488('0xc'));var crypto=require('crypto');var jsforce=require(_0x3488('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3488('0x8'));var querystring=require(_0x3488('0xe'));var Papa=require(_0x3488('0xf'));var Redis=require(_0x3488('0x10'));var authService=require(_0x3488('0x11'));var qs=require(_0x3488('0x12'));var as=require(_0x3488('0x13'));var hardwareService=require(_0x3488('0x14'));var logger=require('../../config/logger')(_0x3488('0x15'));var utils=require('../../config/utils');var config=require(_0x3488('0x16'));var licenseUtil=require(_0x3488('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb9a5ee,_0xd9ffbb){_0xd9ffbb=_0xd9ffbb||0xcc;return function(_0x44dd15){if(_0x44dd15){return _0xb9a5ee[_0x3488('0x18')](_0xd9ffbb);}return _0xb9a5ee['status'](_0xd9ffbb)['end']();};}function respondWithResult(_0x2a7ba0,_0x1a6d69){_0x1a6d69=_0x1a6d69||0xc8;return function(_0x3a127f){if(_0x3a127f){return _0x2a7ba0[_0x3488('0x19')](_0x1a6d69)[_0x3488('0x1a')](_0x3a127f);}};}function respondWithFilteredResult(_0x23c738,_0x4337bc){return function(_0xecad84){if(_0xecad84){var _0x2e94e5=typeof _0x4337bc[_0x3488('0x1b')]===_0x3488('0x1c')&&typeof _0x4337bc[_0x3488('0x1d')]===_0x3488('0x1c');var _0x255489=_0xecad84[_0x3488('0x1e')];var _0x18932e=_0x2e94e5?0x0:_0x4337bc[_0x3488('0x1b')];var _0x4b8f79=_0x2e94e5?_0xecad84[_0x3488('0x1e')]:_0x4337bc[_0x3488('0x1b')]+_0x4337bc[_0x3488('0x1d')];var _0x11d338;if(_0x4b8f79>=_0x255489){_0x4b8f79=_0x255489;_0x11d338=0xc8;}else{_0x11d338=0xce;}_0x23c738[_0x3488('0x19')](_0x11d338);return _0x23c738['set']('Content-Range',_0x18932e+'-'+_0x4b8f79+'/'+_0x255489)[_0x3488('0x1a')](_0xecad84);}return null;};}function patchUpdates(_0x346a9f){return function(_0x25f457){try{jsonpatch[_0x3488('0x1f')](_0x25f457,_0x346a9f,!![]);}catch(_0x558d90){return BPromise[_0x3488('0x20')](_0x558d90);}return _0x25f457['save']();};}function saveUpdates(_0x23e15e,_0x12af1f){return function(_0xa8c2c4){if(_0xa8c2c4){return _0xa8c2c4[_0x3488('0x21')](_0x23e15e)[_0x3488('0x22')](function(_0x1e95c3){return _0x1e95c3;});}return null;};}function removeEntity(_0x433a90,_0xc5987d){return function(_0x4b8bc2){if(_0x4b8bc2){return _0x4b8bc2[_0x3488('0x23')]()[_0x3488('0x22')](function(){_0x433a90['status'](0xcc)[_0x3488('0x24')]();});}};}function handleEntityNotFound(_0x42442d,_0x170122){return function(_0x1479ad){if(!_0x1479ad){_0x42442d[_0x3488('0x18')](0x194);}return _0x1479ad;};}function handleError(_0xc6bca1,_0x5c0df9){_0x5c0df9=_0x5c0df9||0x1f4;return function(_0x145876){logger[_0x3488('0x25')](_0x145876[_0x3488('0x26')]);if(_0x145876['name']){delete _0x145876[_0x3488('0x27')];}_0xc6bca1[_0x3488('0x19')](_0x5c0df9)['send'](_0x145876);};}exports[_0x3488('0x28')]=function(_0x37e919,_0xed07a0){var _0x536e96={},_0x50a0a9={},_0x3e577a={'count':0x0,'rows':[]};var _0x2f3086=_[_0x3488('0x29')](db[_0x3488('0x2a')][_0x3488('0x2b')],function(_0x43bfbd){return{'name':_0x43bfbd[_0x3488('0x2c')],'type':_0x43bfbd[_0x3488('0x2d')][_0x3488('0x2e')]};});_0x50a0a9[_0x3488('0x2f')]=_['differenceBy'](_[_0x3488('0x29')](_0x2f3086,_0x3488('0x27')),[_0x3488('0x27')]);_0x50a0a9[_0x3488('0x30')]=_['keys'](_0x37e919[_0x3488('0x30')]);_0x50a0a9['filters']=_[_0x3488('0x31')](_0x50a0a9['model'],_0x50a0a9[_0x3488('0x30')]);_0x536e96[_0x3488('0x32')]=_['intersection'](_0x50a0a9[_0x3488('0x2f')],qs['fields'](_0x37e919[_0x3488('0x30')][_0x3488('0x33')]));_0x536e96[_0x3488('0x32')]=_0x536e96['attributes']['length']?_0x536e96['attributes']:_0x50a0a9[_0x3488('0x2f')];if(!_0x37e919[_0x3488('0x30')][_0x3488('0x34')](_0x3488('0x35'))){_0x536e96[_0x3488('0x1d')]=qs[_0x3488('0x1d')](_0x37e919[_0x3488('0x30')][_0x3488('0x1d')]);_0x536e96[_0x3488('0x1b')]=qs[_0x3488('0x1b')](_0x37e919[_0x3488('0x30')][_0x3488('0x1b')]);}_0x536e96['order']=qs['sort'](_0x37e919['query'][_0x3488('0x36')]);_0x536e96[_0x3488('0x37')]=qs[_0x3488('0x38')](_[_0x3488('0x39')](_0x37e919[_0x3488('0x30')],_0x50a0a9[_0x3488('0x38')]),_0x2f3086);if(_0x37e919['query']['filter']){_0x536e96[_0x3488('0x37')]=_[_0x3488('0x3a')](_0x536e96['where'],{'$or':_[_0x3488('0x29')](_0x2f3086,function(_0xa038c3){if(_0xa038c3['type']!=='VIRTUAL'){var _0x561859={};_0x561859[_0xa038c3[_0x3488('0x27')]]={'$like':'%'+_0x37e919[_0x3488('0x30')][_0x3488('0x3b')]+'%'};return _0x561859;}})});}_0x536e96=_['merge']({},_0x536e96,_0x37e919[_0x3488('0x3c')]);var _0x243d43={'where':_0x536e96[_0x3488('0x37')]};return db['CmCustomField'][_0x3488('0x1e')](_0x243d43)[_0x3488('0x22')](function(_0x16fcff){_0x3e577a[_0x3488('0x1e')]=_0x16fcff;if(_0x37e919['query']['includeAll']){_0x536e96['include']=[{'all':!![]}];}return db[_0x3488('0x2a')]['findAll'](_0x536e96);})[_0x3488('0x22')](function(_0x85c8ee){_0x3e577a[_0x3488('0x3d')]=_0x85c8ee;return _0x3e577a;})[_0x3488('0x22')](respondWithFilteredResult(_0xed07a0,_0x536e96))[_0x3488('0x3e')](handleError(_0xed07a0,null));};exports['show']=function(_0x5efb52,_0x573cf5){var _0x483e5b={'raw':!![],'where':{'id':_0x5efb52['params']['id']}},_0x342585={};_0x342585[_0x3488('0x2f')]=_[_0x3488('0x3f')](db[_0x3488('0x2a')]['rawAttributes']);_0x342585['query']=_['keys'](_0x5efb52['query']);_0x342585[_0x3488('0x38')]=_[_0x3488('0x31')](_0x342585['model'],_0x342585[_0x3488('0x30')]);_0x483e5b[_0x3488('0x32')]=_['intersection'](_0x342585[_0x3488('0x2f')],qs[_0x3488('0x33')](_0x5efb52[_0x3488('0x30')][_0x3488('0x33')]));_0x483e5b[_0x3488('0x32')]=_0x483e5b[_0x3488('0x32')]['length']?_0x483e5b['attributes']:_0x342585[_0x3488('0x2f')];if(_0x5efb52[_0x3488('0x30')][_0x3488('0x40')]){_0x483e5b[_0x3488('0x41')]=[{'all':!![]}];}_0x483e5b=_[_0x3488('0x3a')]({},_0x483e5b,_0x5efb52[_0x3488('0x3c')]);return db[_0x3488('0x2a')]['find'](_0x483e5b)[_0x3488('0x22')](handleEntityNotFound(_0x573cf5,null))[_0x3488('0x22')](respondWithResult(_0x573cf5,null))[_0x3488('0x3e')](handleError(_0x573cf5,null));};exports[_0x3488('0x21')]=function(_0x3b8012,_0x23dd95){if(_0x3b8012[_0x3488('0x42')]['id']){delete _0x3b8012[_0x3488('0x42')]['id'];}return db[_0x3488('0x2a')][_0x3488('0x43')]({'where':{'id':_0x3b8012['params']['id']}})['then'](handleEntityNotFound(_0x23dd95,null))['then'](saveUpdates(_0x3b8012['body'],null))[_0x3488('0x22')](respondWithResult(_0x23dd95,null))['catch'](handleError(_0x23dd95,null));};exports['destroy']=function(_0x16c53a,_0x161806){return db[_0x3488('0x2a')][_0x3488('0x43')]({'where':{'id':_0x16c53a[_0x3488('0x44')]['id']}})[_0x3488('0x22')](handleEntityNotFound(_0x161806,null))['then'](removeEntity(_0x161806,null))[_0x3488('0x3e')](handleError(_0x161806,null));};exports['create']=function(_0x46cdb3,_0x1d2d57){var _0x2b97f5;return db[_0x3488('0x45')][_0x3488('0x46')](function(_0x16d4ff){return db[_0x3488('0x2a')][_0x3488('0x47')](_0x46cdb3[_0x3488('0x42')],{'transaction':_0x16d4ff})[_0x3488('0x22')](function(_0x182392){_0x2b97f5=_0x182392;var _0x5e7770={'type':db[_0x3488('0x48')][_0x3488('0x49')],'transaction':_0x16d4ff};switch(_0x46cdb3['body']['type']){case _0x3488('0x4a'):_0x5e7770[_0x3488('0x2d')]=db[_0x3488('0x48')][_0x3488('0x49')];break;case _0x3488('0x4b'):_0x5e7770[_0x3488('0x2d')]=db[_0x3488('0x48')][_0x3488('0x4c')];break;case _0x3488('0x4d'):_0x5e7770[_0x3488('0x2d')]=db[_0x3488('0x48')]['BOOLEAN'];_0x5e7770[_0x3488('0x4e')]=![];break;default:}return db[_0x3488('0x45')][_0x3488('0x4f')][_0x3488('0x50')]('cm_contacts',util[_0x3488('0x51')](_0x3488('0x52'),_0x2b97f5['id']),_0x5e7770);})[_0x3488('0x22')](function(){return _0x2b97f5;});})[_0x3488('0x22')](respondWithResult(_0x1d2d57,0xc9))[_0x3488('0x3e')](handleError(_0x1d2d57,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index d639230..612a2cd 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 _0x2710=['cm_custom_fields','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x34a3b0,_0x323584){var _0x4224fc=function(_0xe4af2f){while(--_0xe4af2f){_0x34a3b0['push'](_0x34a3b0['shift']());}};_0x4224fc(++_0x323584);}(_0x2710,0xe7));var _0x0271=function(_0x59d7b7,_0x25bf2f){_0x59d7b7=_0x59d7b7-0x0;var _0x31db17=_0x2710[_0x59d7b7];return _0x31db17;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0271('0x0'))('api');var moment=require(_0x0271('0x1'));var BPromise=require(_0x0271('0x2'));var rp=require(_0x0271('0x3'));var fs=require('fs');var path=require(_0x0271('0x4'));var rimraf=require('rimraf');var config=require(_0x0271('0x5'));var attributes=require(_0x0271('0x6'));module[_0x0271('0x7')]=function(_0x4139dd,_0x184e9e){return _0x4139dd[_0x0271('0x8')]('CmCustomField',attributes,{'tableName':_0x0271('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9529=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x215e19,_0x58af3c){var _0x16d41a=function(_0x3424e4){while(--_0x3424e4){_0x215e19['push'](_0x215e19['shift']());}};_0x16d41a(++_0x58af3c);}(_0x9529,0x18b));var _0x9952=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9529[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9952('0x0'));var util=require(_0x9952('0x1'));var logger=require(_0x9952('0x2'))(_0x9952('0x3'));var moment=require(_0x9952('0x4'));var BPromise=require(_0x9952('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9952('0x6'));var rimraf=require(_0x9952('0x7'));var config=require(_0x9952('0x8'));var attributes=require(_0x9952('0x9'));module[_0x9952('0xa')]=function(_0x5ce9bb,_0x51a0c1){return _0x5ce9bb['define'](_0x9952('0xb'),attributes,{'tableName':_0x9952('0xc'),'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 ef659ce..5987601 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4cc642,_0x2838e2){var _0x24ea52=function(_0x17f709){while(--_0x17f709){_0x4cc642['push'](_0x4cc642['shift']());}};_0x24ea52(++_0x2838e2);}(_0x33af,0xec));var _0xf33a=function(_0x47f719,_0x2e559d){_0x47f719=_0x47f719-0x0;var _0x407f4e=_0x33af[_0x47f719];return _0x407f4e;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('CmCustomField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0xc009=['CmCustomField,\x20%s,\x20%s','info','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x3291cc,_0x3357c8){var _0x18377c=function(_0x668369){while(--_0x668369){_0x3291cc['push'](_0x3291cc['shift']());}};_0x18377c(++_0x3357c8);}(_0xc009,0x8a));var _0x9c00=function(_0xed88cb,_0x2948f8){_0xed88cb=_0xed88cb-0x0;var _0x2e5c20=_0xc009[_0xed88cb];return _0x2e5c20;};'use strict';var _=require(_0x9c00('0x0'));var util=require(_0x9c00('0x1'));var moment=require('moment');var BPromise=require(_0x9c00('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c00('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c00('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9c00('0x5'));var jayson=require(_0x9c00('0x6'));var client=jayson[_0x9c00('0x7')][_0x9c00('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2db825,_0x537fb9,_0x5cc4b){return new BPromise(function(_0x31409a,_0x530378){return client[_0x9c00('0x9')](_0x2db825,_0x5cc4b)['then'](function(_0x2d31cf){logger['info']('CmCustomField,\x20%s,\x20%s',_0x537fb9,'request\x20sent');logger[_0x9c00('0xa')](_0x9c00('0xb'),_0x537fb9,_0x9c00('0xc'),JSON['stringify'](_0x2d31cf));if(_0x2d31cf[_0x9c00('0xd')]){if(_0x2d31cf[_0x9c00('0xd')]['code']===0x1f4){logger[_0x9c00('0xd')]('CmCustomField,\x20%s,\x20%s',_0x537fb9,_0x2d31cf['error'][_0x9c00('0xe')]);return _0x530378(_0x2d31cf[_0x9c00('0xd')]['message']);}logger['error'](_0x9c00('0xf'),_0x537fb9,_0x2d31cf[_0x9c00('0xd')][_0x9c00('0xe')]);return _0x31409a(_0x2d31cf['error'][_0x9c00('0xe')]);}else{logger[_0x9c00('0x10')]('CmCustomField,\x20%s,\x20%s',_0x537fb9,_0x9c00('0xc'));_0x31409a(_0x2d31cf['result'][_0x9c00('0xe')]);}})['catch'](function(_0x930f92){logger['error'](_0x9c00('0xf'),_0x537fb9,_0x930f92);_0x530378(_0x930f92);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4854cbf..90023aa 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 _0xb175=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','isAuthenticated','index','get','/:id','show','post','put'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xb175,0x1a4));var _0x5b17=function(_0x55a44c,_0x262d6c){_0x55a44c=_0x55a44c-0x0;var _0x3f723f=_0xb175[_0x55a44c];return _0x3f723f;};'use strict';var multer=require(_0x5b17('0x0'));var util=require(_0x5b17('0x1'));var path=require(_0x5b17('0x2'));var timeout=require(_0x5b17('0x3'));var express=require('express');var router=express[_0x5b17('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('./cmCustomField.controller');router['get']('/',auth[_0x5b17('0x5')](),controller[_0x5b17('0x6')]);router[_0x5b17('0x7')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0x9')]);router[_0x5b17('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5b17('0xb')]('/:id',auth[_0x5b17('0x5')](),controller[_0x5b17('0xc')]);router[_0x5b17('0xd')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0xe')]);module[_0x5b17('0xf')]=router; \ No newline at end of file +var _0xadae=['get','isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','../../config/environment'];(function(_0x209f08,_0x49c363){var _0x42beb9=function(_0xa9f276){while(--_0xa9f276){_0x209f08['push'](_0x209f08['shift']());}};_0x42beb9(++_0x49c363);}(_0xadae,0x134));var _0xeada=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xadae[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0xeada('0x0'));var util=require(_0xeada('0x1'));var path=require(_0xeada('0x2'));var timeout=require('connect-timeout');var express=require('express');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(_0xeada('0x3'));var controller=require('./cmCustomField.controller');router[_0xeada('0x4')]('/',auth[_0xeada('0x5')](),controller['index']);router['get'](_0xeada('0x6'),auth[_0xeada('0x5')](),controller[_0xeada('0x7')]);router[_0xeada('0x8')]('/',auth[_0xeada('0x5')](),controller[_0xeada('0x9')]);router[_0xeada('0xa')](_0xeada('0x6'),auth[_0xeada('0x5')](),controller[_0xeada('0xb')]);router[_0xeada('0xc')](_0xeada('0x6'),auth[_0xeada('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 030b59b..ce97658 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 _0xf808=['INTEGER','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xd411c4,_0x125263){var _0x3827b0=function(_0x10daa4){while(--_0x10daa4){_0xd411c4['push'](_0xd411c4['shift']());}};_0x3827b0(++_0x125263);}(_0xf808,0x108));var _0x8f80=function(_0xa3502a,_0x406144){_0xa3502a=_0xa3502a-0x0;var _0x2d5c58=_0xf808[_0xa3502a];return _0x2d5c58;};'use strict';var moment=require('moment');var Sequelize=require(_0x8f80('0x0'));module[_0x8f80('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8f80('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8f80('0x3')],'defaultValue':moment()[_0x8f80('0x4')](_0x8f80('0x5'))},'countbusyretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8f80('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x8f80('0x6')](0x2)[_0x8f80('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8f80('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8f80('0x6')],'unique':_0x8f80('0x8')},'ListId':{'type':Sequelize[_0x8f80('0x6')],'unique':_0x8f80('0x8')},'UserId':{'type':Sequelize[_0x8f80('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x8f80('0x6')],'unique':_0x8f80('0x8')},'CampaignId':{'type':Sequelize[_0x8f80('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f80('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x8f80('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x040c=['contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED'];(function(_0x3b554a,_0x2ef7e2){var _0x4de41d=function(_0x5cfea2){while(--_0x5cfea2){_0x3b554a['push'](_0x3b554a['shift']());}};_0x4de41d(++_0x2ef7e2);}(_0x040c,0x1b9));var _0xc040=function(_0xc400c9,_0x3f506d){_0xc400c9=_0xc400c9-0x0;var _0x286af5=_0x040c[_0xc400c9];return _0x286af5;};'use strict';var moment=require(_0xc040('0x0'));var Sequelize=require(_0xc040('0x1'));module[_0xc040('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xc040('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc040('0x4')],'defaultValue':moment()[_0xc040('0x5')](_0xc040('0x6'))},'countbusyretry':{'type':Sequelize[_0xc040('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc040('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc040('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc040('0x4')]},'priority':{'type':Sequelize[_0xc040('0x7')](0x2)[_0xc040('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc040('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc040('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xc040('0x7')],'unique':_0xc040('0xa')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xc040('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc040('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc040('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc040('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc040('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc040('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc040('0x4')],'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 0ff9ed4..bdb90b1 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 _0xc3b5=['model','keys','query','intersection','filters','concat','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','format','direction','prev','isEmpty','priority','ASC','scheduledAt','literal','DESC','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','getPreviewRecall','transaction','recallme','Queue','dialActive','isNumber','status','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','getTimezones','timezones','push','getTimezone','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key'];(function(_0x5ec891,_0x1fd3b0){var _0x3782db=function(_0xd77e73){while(--_0xd77e73){_0x5ec891['push'](_0x5ec891['shift']());}};_0x3782db(++_0x1fd3b0);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x38d7be,_0x5b1b6b){_0x38d7be=_0x38d7be-0x0;var _0x11d972=_0xc3b5[_0x38d7be];return _0x11d972;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0x5c3b('0x0'));var logger=require(_0x5c3b('0x1'))(_0x5c3b('0x2'));var shared=require(_0x5c3b('0x3'));var db=require(_0x5c3b('0x4'))['db'];function respondWithResult(_0x34be81,_0x237a61){_0x237a61=_0x237a61||0xc8;return function(_0x48f8a1){if(_0x48f8a1){return _0x34be81['status'](_0x237a61)[_0x5c3b('0x5')](_0x48f8a1);}};}function respondWithFilteredResult(_0x6b8a1e,_0x56345e){return function(_0x568a28){if(_0x568a28){var _0x30a08f=typeof _0x56345e[_0x5c3b('0x6')]===_0x5c3b('0x7')&&typeof _0x56345e['limit']===_0x5c3b('0x7');var _0x438255=_0x568a28[_0x5c3b('0x8')];var _0x20e71=_0x30a08f?0x0:_0x56345e['offset'];var _0x20dd86=_0x30a08f?_0x568a28[_0x5c3b('0x8')]:_0x56345e[_0x5c3b('0x6')]+_0x56345e[_0x5c3b('0x9')];var _0x363c3d;if(_0x20dd86>=_0x438255){_0x20dd86=_0x438255;_0x363c3d=0xc8;}else{_0x363c3d=0xce;}_0x6b8a1e['status'](_0x363c3d);return _0x6b8a1e[_0x5c3b('0xa')](_0x5c3b('0xb'),_0x20e71+'-'+_0x20dd86+'/'+_0x438255)['json'](_0x568a28);}return null;};}function saveUpdates(_0x1b2815,_0x3b953d){return function(_0x507c2e){if(_0x507c2e){return _0x507c2e[_0x5c3b('0xc')](_0x1b2815)[_0x5c3b('0xd')](function(_0x3e24bd){return _0x3e24bd;});}return null;};}function handleEntityNotFound(_0x2384b9,_0x315e68){return function(_0x3fef28){if(!_0x3fef28){_0x2384b9[_0x5c3b('0xe')](0x194);}return _0x3fef28;};}function handleError(_0x4f20eb,_0x2f7ab2){_0x2f7ab2=_0x2f7ab2||0x1f4;return function(_0x5b55be){logger['error'](_0x5b55be[_0x5c3b('0xf')]);if(_0x5b55be[_0x5c3b('0x10')]){delete _0x5b55be[_0x5c3b('0x10')];}_0x4f20eb['status'](_0x2f7ab2)[_0x5c3b('0x11')](_0x5b55be);};}exports[_0x5c3b('0x12')]=function(_0x5b5810,_0x59f71b){var _0x385053={},_0x34144d={},_0x48d662={'count':0x0,'rows':[]};var _0x3973bc=_[_0x5c3b('0x13')](db[_0x5c3b('0x14')][_0x5c3b('0x15')],function(_0x103943){return{'name':_0x103943[_0x5c3b('0x16')],'type':_0x103943[_0x5c3b('0x17')][_0x5c3b('0x18')]};});_0x34144d[_0x5c3b('0x19')]=_[_0x5c3b('0x13')](_0x3973bc,'name');_0x34144d['query']=_[_0x5c3b('0x1a')](_0x5b5810[_0x5c3b('0x1b')]);_0x34144d['filters']=_[_0x5c3b('0x1c')](_0x34144d['model'],_0x34144d[_0x5c3b('0x1b')]);_0x34144d[_0x5c3b('0x1d')]=_[_0x5c3b('0x1e')](_0x34144d[_0x5c3b('0x1d')],['$and',_0x5c3b('0x1f'),_0x5c3b('0x20'),'$gte',_0x5c3b('0x21'),_0x5c3b('0x22'),_0x5c3b('0x23'),_0x5c3b('0x24'),'$not',_0x5c3b('0x25'),_0x5c3b('0x26'),_0x5c3b('0x27'),_0x5c3b('0x28'),_0x5c3b('0x29'),_0x5c3b('0x2a'),'$iLike','$notILike','$like',_0x5c3b('0x2b'),_0x5c3b('0x2c'),'$contained',_0x5c3b('0x2d')]);_0x385053[_0x5c3b('0x2e')]=_[_0x5c3b('0x1c')](_0x34144d[_0x5c3b('0x19')],qs[_0x5c3b('0x2f')](_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x2f')]));_0x385053[_0x5c3b('0x2e')]=_0x385053[_0x5c3b('0x2e')][_0x5c3b('0x30')]?_0x385053[_0x5c3b('0x2e')]:_0x34144d[_0x5c3b('0x19')];if(!_0x5b5810['query'][_0x5c3b('0x31')](_0x5c3b('0x32'))){_0x385053[_0x5c3b('0x9')]=qs[_0x5c3b('0x9')](_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x9')]);_0x385053[_0x5c3b('0x6')]=qs[_0x5c3b('0x6')](_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x6')]);}_0x385053[_0x5c3b('0x33')]=qs[_0x5c3b('0x34')](_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x34')]);_0x385053[_0x5c3b('0x35')]=qs[_0x5c3b('0x1d')](_[_0x5c3b('0x36')](_0x5b5810['query'],_0x34144d[_0x5c3b('0x1d')]),_0x3973bc);if(_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x37')]){_0x385053[_0x5c3b('0x35')]=_['merge'](_0x385053[_0x5c3b('0x35')],{'$or':_[_0x5c3b('0x13')](_0x3973bc,function(_0x478aca){if(_0x478aca[_0x5c3b('0x17')]!==_0x5c3b('0x38')){var _0x32581a={};_0x32581a[_0x478aca[_0x5c3b('0x10')]]={'$like':'%'+_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x37')]+'%'};return _0x32581a;}})});}_0x385053=_[_0x5c3b('0x39')]({},_0x385053,_0x5b5810[_0x5c3b('0x3a')]);var _0x1fa1df={'where':_0x385053['where']};return db[_0x5c3b('0x14')][_0x5c3b('0x8')](_0x1fa1df)['then'](function(_0x59e079){_0x48d662[_0x5c3b('0x8')]=_0x59e079;if(_0x5b5810[_0x5c3b('0x1b')][_0x5c3b('0x3b')]){_0x385053[_0x5c3b('0x3c')]=[{'all':!![]}];}return db[_0x5c3b('0x14')][_0x5c3b('0x3d')](_0x385053);})[_0x5c3b('0xd')](function(_0x5e78de){_0x48d662['rows']=_0x5e78de;return _0x48d662;})[_0x5c3b('0xd')](respondWithFilteredResult(_0x59f71b,_0x385053))[_0x5c3b('0x3e')](handleError(_0x59f71b,null));};exports[_0x5c3b('0x3f')]=function(_0x3902d7,_0x526436){var _0x16400b={'raw':!![],'where':{'id':_0x3902d7[_0x5c3b('0x40')]['id']}},_0x4b9a81={};_0x4b9a81[_0x5c3b('0x19')]=_[_0x5c3b('0x1a')](db[_0x5c3b('0x14')][_0x5c3b('0x15')]);_0x4b9a81[_0x5c3b('0x1b')]=_[_0x5c3b('0x1a')](_0x3902d7[_0x5c3b('0x1b')]);_0x4b9a81[_0x5c3b('0x1d')]=_['intersection'](_0x4b9a81['model'],_0x4b9a81[_0x5c3b('0x1b')]);_0x16400b[_0x5c3b('0x2e')]=_[_0x5c3b('0x1c')](_0x4b9a81[_0x5c3b('0x19')],qs[_0x5c3b('0x2f')](_0x3902d7[_0x5c3b('0x1b')][_0x5c3b('0x2f')]));_0x16400b[_0x5c3b('0x2e')]=_0x16400b[_0x5c3b('0x2e')]['length']?_0x16400b[_0x5c3b('0x2e')]:_0x4b9a81[_0x5c3b('0x19')];if(_0x3902d7[_0x5c3b('0x1b')]['includeAll']){_0x16400b[_0x5c3b('0x3c')]=[{'all':!![]}];}_0x16400b=_[_0x5c3b('0x39')]({},_0x16400b,_0x3902d7[_0x5c3b('0x3a')]);return db[_0x5c3b('0x14')][_0x5c3b('0x41')](_0x16400b)[_0x5c3b('0xd')](handleEntityNotFound(_0x526436,null))[_0x5c3b('0xd')](respondWithResult(_0x526436,null))[_0x5c3b('0x3e')](handleError(_0x526436,null));};exports[_0x5c3b('0x42')]=function(_0x28c68a,_0x18e704){return db['CmHopper'][_0x5c3b('0x42')](_0x28c68a['body'],{})[_0x5c3b('0xd')](respondWithResult(_0x18e704,0xc9))[_0x5c3b('0x3e')](handleError(_0x18e704,null));};exports['update']=function(_0x1b24e6,_0x285346){if(_0x1b24e6[_0x5c3b('0x43')]['id']){delete _0x1b24e6['body']['id'];}return db[_0x5c3b('0x14')]['find']({'where':{'id':_0x1b24e6[_0x5c3b('0x40')]['id']}})[_0x5c3b('0xd')](handleEntityNotFound(_0x285346,null))[_0x5c3b('0xd')](saveUpdates(_0x1b24e6[_0x5c3b('0x43')],null))[_0x5c3b('0xd')](respondWithResult(_0x285346,null))[_0x5c3b('0x3e')](handleError(_0x285346,null));};exports[_0x5c3b('0x44')]=function(_0x3d6034,_0x42d34f){return db[_0x5c3b('0x14')][_0x5c3b('0x44')]()['then'](respondWithResult(_0x42d34f,null))[_0x5c3b('0x3e')](handleError(_0x42d34f,null));};exports['destroy']=function(_0x155b22,_0x11bf0a){var _0x2751a2;var _0x4b85c1=_0x155b22[_0x5c3b('0x40')]['id'];return db[_0x5c3b('0x14')]['find']({'where':{'id':_0x155b22[_0x5c3b('0x40')]['id']}})[_0x5c3b('0xd')](handleEntityNotFound(_0x11bf0a,null))[_0x5c3b('0xd')](function(_0x2744cd){if(_0x2744cd){return _0x2744cd[_0x5c3b('0x45')]()[_0x5c3b('0xd')](function(_0x37870f){return _0x37870f;});}})[_0x5c3b('0xd')](function(_0x3f3947){_0x2751a2=_0x3f3947;if(_0x3f3947){if(_0x3f3947[_0x5c3b('0x46')]||_0x3f3947[_0x5c3b('0x47')]){return db[_0x3f3947['VoiceQueueId']?'VoiceQueue':'Campaign'][_0x5c3b('0x41')]({'where':{'id':_0x3f3947[_0x5c3b('0x46')]?_0x3f3947['VoiceQueueId']:_0x3f3947[_0x5c3b('0x47')]},'attributes':['id',_0x5c3b('0x10')],'raw':!![]});}}})[_0x5c3b('0xd')](function(_0x2ff7e2){var _0x53c2c2={};if(_0x2ff7e2){_[_0x5c3b('0x39')](_0x53c2c2,_[_0x5c3b('0x48')](_0x2751a2['dataValues'],[_0x5c3b('0x49'),_0x5c3b('0x4a'),'id']));_0x53c2c2[_0x5c3b('0x4b')]=0x15;_0x53c2c2[_0x5c3b('0x4c')]=_0x5c3b('0x4d');_0x53c2c2[_0x5c3b('0x4e')]=_0x2ff7e2[_0x5c3b('0x10')];_0x53c2c2[_0x5c3b('0x4f')]=_0x155b22[_0x5c3b('0x50')][_0x5c3b('0x10')];_0x53c2c2[_0x5c3b('0x51')]=_0x155b22[_0x5c3b('0x50')]['id'];_0x53c2c2[_0x5c3b('0x4d')]=!![];_0x53c2c2['deletedat']=moment()['format'](_0x5c3b('0x52'));_0x53c2c2[_0x5c3b('0x53')]=_0x2751a2[_0x5c3b('0x54')];_0x53c2c2['campaigntype']=_0x2751a2['VoiceQueueId']?'queue':_0x5c3b('0x55');return db['CmContact'][_0x5c3b('0x41')]({'where':{'id':_0x53c2c2[_0x5c3b('0x56')]},'attributes':[_0x5c3b('0x57'),_0x5c3b('0x58')]})[_0x5c3b('0xd')](function(_0x4d7ecb){if(!_[_0x5c3b('0x59')](_0x11bf0a)&&!_['isNil'](_0x4d7ecb[_0x5c3b('0x57')])){_0x53c2c2['calleridname']=_0x4d7ecb[_0x5c3b('0x57')];if(!_[_0x5c3b('0x59')](_0x4d7ecb[_0x5c3b('0x58')])){_0x53c2c2[_0x5c3b('0x5a')]+='\x20'+_0x4d7ecb[_0x5c3b('0x58')];}}})[_0x5c3b('0x5b')](function(){return db[_0x5c3b('0x5c')][_0x5c3b('0x42')](_0x53c2c2);});}})[_0x5c3b('0xd')](function(_0x41e5e0){return db[_0x5c3b('0x5d')]['destroy']({'where':{'CmHopperId':_0x4b85c1}});})['then'](function(){return _0x11bf0a['status'](0xcc)[_0x5c3b('0x5e')]();})[_0x5c3b('0x3e')](handleError(_0x11bf0a,null));};exports[_0x5c3b('0x5f')]=function(_0x150868,_0x532120){var _0x4edba0=[];return db[_0x5c3b('0x60')]['describe']()['then'](function(_0x137458){_0x4edba0=_[_0x5c3b('0x1a')](_0x137458);return _0x150868[_0x5c3b('0x50')][_0x5c3b('0x61')]({'where':{'type':_0x5c3b('0x62'),'dialActive':!![],'dialMethod':_0x5c3b('0x63')},'attributes':['id',_0x5c3b('0x64'),_0x5c3b('0x65')],'raw':!![]});})[_0x5c3b('0xd')](function(_0x460461){if(_0x460461&&_0x460461[_0x5c3b('0x30')]){return db[_0x5c3b('0x66')]['transaction'](function(_0x3faa19){var _0x5564ad={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5c3b('0x67')](_0x5c3b('0x52'))},'VoiceQueueId':{'$in':_[_0x5c3b('0x13')](_0x460461,'id')},'$or':[{'UserId':null},{'UserId':_0x150868[_0x5c3b('0x50')]['id']}]};var _0x3ac366={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x460461)[_0x5c3b('0x37')]([_0x5c3b('0x65'),0x0])[_0x5c3b('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x150868[_0x5c3b('0x50')]['id']}]};var _0x5acd17={'$or':[_0x5564ad,_0x3ac366]};var _0x56c5bb=[];if(_0x150868[_0x5c3b('0x43')][_0x5c3b('0x68')]&&_0x150868[_0x5c3b('0x43')]['direction']===_0x5c3b('0x69')){if(!_[_0x5c3b('0x6a')](_0x150868[_0x5c3b('0x43')]['hopperIds'])){_0x5acd17['id']={'$in':_0x150868[_0x5c3b('0x43')]['hopperIds']};}_0x56c5bb=[[_0x5c3b('0x6b'),_0x5c3b('0x6c')],[_0x5c3b('0x6d'),_0x460461[0x0]['dialOrderByScheduledAt']===_0x5c3b('0x6c')?'DESC':_0x5c3b('0x6c')],db[_0x5c3b('0x66')][_0x5c3b('0x6e')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x5c3b('0x6f')]];}else{if(!_['isEmpty'](_0x150868[_0x5c3b('0x43')][_0x5c3b('0x70')])){_0x5acd17['id']={'$notIn':_0x150868[_0x5c3b('0x43')][_0x5c3b('0x70')]};}_0x56c5bb=[[_0x5c3b('0x6b'),_0x5c3b('0x6f')],[_0x5c3b('0x6d'),_0x460461[0x0][_0x5c3b('0x64')]],db[_0x5c3b('0x66')][_0x5c3b('0x6e')](_0x5c3b('0x71')),['id',_0x5c3b('0x6c')]];}return db[_0x5c3b('0x14')]['findOne']({'attributes':['id',_0x5c3b('0x72'),_0x5c3b('0x54'),'recallme'],'where':_0x5acd17,'order':_0x56c5bb,'transaction':_0x3faa19,'lock':_0x3faa19[_0x5c3b('0x73')][_0x5c3b('0x74')],'include':[{'model':db[_0x5c3b('0x60')],'as':_0x5c3b('0x75'),'attributes':_0x4edba0,'include':[{'model':db[_0x5c3b('0x76')],'as':_0x5c3b('0x77'),'attributes':['id',_0x5c3b('0x10')]}]},{'model':db[_0x5c3b('0x78')],'as':_0x5c3b('0x79'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x5c3b('0xd')](function(_0x402717){if(_0x402717){return _0x402717[_0x5c3b('0xc')]({'UserId':_0x150868['user']['id']},{'transaction':_0x3faa19});}});});}})[_0x5c3b('0xd')](handleEntityNotFound(_0x532120,null))['then'](respondWithResult(_0x532120,null))[_0x5c3b('0x3e')](handleError(_0x532120,null));};exports[_0x5c3b('0x7a')]=function(_0x256ccb,_0x36ba41,_0x3419db){var _0xbc0e51=[];var _0x183fa9=_0x256ccb[_0x5c3b('0x40')]['id'];var _0x419955=_0x256ccb[_0x5c3b('0x50')]['id'];return db[_0x5c3b('0x60')][_0x5c3b('0x44')]()['then'](function(_0x2312d1){_0xbc0e51=_[_0x5c3b('0x1a')](_0x2312d1);return db[_0x5c3b('0x66')][_0x5c3b('0x7b')](function(_0x3d2b86){const _0xa84b04={'id':_0x183fa9};return db['CmHopper']['findOne']({'attributes':['id',_0x5c3b('0x72'),_0x5c3b('0x7c')],'where':_0xa84b04,'transaction':_0x3d2b86,'lock':_0x3d2b86['LOCK'][_0x5c3b('0x74')],'include':[{'model':db[_0x5c3b('0x60')],'as':_0x5c3b('0x75'),'attributes':_0xbc0e51,'include':[{'model':db['CmCompany'],'as':_0x5c3b('0x77'),'attributes':['id',_0x5c3b('0x10')]}]},{'model':db[_0x5c3b('0x78')],'as':_0x5c3b('0x79'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x5c3b('0x7d'),'attributes':['id',_0x5c3b('0x10'),_0x5c3b('0x7e')]}]})[_0x5c3b('0xd')](function(_0x31ab7c){if(_0x31ab7c){return _0x31ab7c[_0x5c3b('0xc')]({'UserId':_0x419955},{'transaction':_0x3d2b86});}});});})[_0x5c3b('0xd')](handleEntityNotFound(_0x36ba41,null))[_0x5c3b('0xd')](respondWithResult(_0x36ba41,null))[_0x5c3b('0x3e')](handleError(_0x36ba41,null));};exports['getOpenContacts']=function(_0xb9e542,_0x2348cb){return _0xb9e542[_0x5c3b('0x50')][_0x5c3b('0x61')]({'where':{'type':_0x5c3b('0x62'),'dialActive':!![],'dialMethod':_0x5c3b('0x63')},'attributes':['id'],'raw':!![]})[_0x5c3b('0xd')](function(_0x36c6cd){if(_0x36c6cd&&_0x36c6cd[_0x5c3b('0x30')]){return db['CmHopper'][_0x5c3b('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5c3b('0x67')](_0x5c3b('0x52'))},'VoiceQueueId':{'$in':_[_0x5c3b('0x13')](_0x36c6cd,'id')},'$or':[{'UserId':null},{'UserId':_0xb9e542['user']['id']}]}});}return 0x0;})['then'](function(_0x59ac9e){if(!_[_0x5c3b('0x59')](_0x59ac9e)&&_[_0x5c3b('0x7f')](_0x59ac9e)){return _0x2348cb[_0x5c3b('0x80')](0xc8)['json']({'contacts':_0x59ac9e});}else{logger[_0x5c3b('0x81')](_0x5c3b('0x82'),_0x5c3b('0x83'),0x194,'entity\x20not\x20found');_0x2348cb[_0x5c3b('0xe')](0x194);}})[_0x5c3b('0x3e')](handleError(_0x2348cb,null));};exports[_0x5c3b('0x84')]=function(_0x5e4c11,_0x3b91e6){var _0x3e272a=shared[_0x5c3b('0x85')];var _0x25aef8=[];_[_0x5c3b('0x13')](_0x3e272a,function(_0x4dfd97){_0x25aef8[_0x5c3b('0x86')]({'id':_0x4dfd97[_0x5c3b('0x10')],'name':_0x4dfd97['name'],'utcOffset':_0x4dfd97['utcOffset']});});return _0x3b91e6['status'](0xc8)[_0x5c3b('0x5')]({'tz':_0x25aef8});};exports[_0x5c3b('0x87')]=function(_0x133eaa,_0x3a44c4){var _0x57f7b3=shared[_0x5c3b('0x85')];var _0x309c51={};if(!_[_0x5c3b('0x59')](_0x57f7b3[_0x133eaa[_0x5c3b('0x43')]['id']]))_0x309c51=_0x57f7b3[_0x133eaa[_0x5c3b('0x43')]['id']];return _0x3a44c4[_0x5c3b('0x80')](0xc8)[_0x5c3b('0x5')](_0x309c51);}; \ No newline at end of file +var _0x02a7=['rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopper','includeAll','include','findAll','then','rows','catch','show','params','length','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','phone','recallme','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','transaction','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','lodash','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','error','stack','send','index'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x02a7,0x7a));var _0x702a=function(_0xa51873,_0x4fc648){_0xa51873=_0xa51873-0x0;var _0x40a2a5=_0x02a7[_0xa51873];return _0x40a2a5;};'use strict';var moment=require('moment');var _=require(_0x702a('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x702a('0x1'));var shared=require(_0x702a('0x2'));var db=require(_0x702a('0x3'))['db'];function respondWithResult(_0xd65b34,_0x4612ca){_0x4612ca=_0x4612ca||0xc8;return function(_0x1fc26b){if(_0x1fc26b){return _0xd65b34[_0x702a('0x4')](_0x4612ca)['json'](_0x1fc26b);}};}function respondWithFilteredResult(_0x1bcfe5,_0x5b7d8c){return function(_0x26b25e){if(_0x26b25e){var _0x1aa2c2=typeof _0x5b7d8c[_0x702a('0x5')]===_0x702a('0x6')&&typeof _0x5b7d8c[_0x702a('0x7')]===_0x702a('0x6');var _0x3b745c=_0x26b25e['count'];var _0x15acfb=_0x1aa2c2?0x0:_0x5b7d8c['offset'];var _0x5c83a4=_0x1aa2c2?_0x26b25e[_0x702a('0x8')]:_0x5b7d8c[_0x702a('0x5')]+_0x5b7d8c[_0x702a('0x7')];var _0x27ef6a;if(_0x5c83a4>=_0x3b745c){_0x5c83a4=_0x3b745c;_0x27ef6a=0xc8;}else{_0x27ef6a=0xce;}_0x1bcfe5['status'](_0x27ef6a);return _0x1bcfe5[_0x702a('0x9')](_0x702a('0xa'),_0x15acfb+'-'+_0x5c83a4+'/'+_0x3b745c)[_0x702a('0xb')](_0x26b25e);}return null;};}function saveUpdates(_0x221b35,_0x4688d1){return function(_0x75455){if(_0x75455){return _0x75455[_0x702a('0xc')](_0x221b35)['then'](function(_0x51364a){return _0x51364a;});}return null;};}function handleEntityNotFound(_0x38139d,_0x57f5fc){return function(_0x576cf8){if(!_0x576cf8){_0x38139d['sendStatus'](0x194);}return _0x576cf8;};}function handleError(_0x554435,_0x5c768d){_0x5c768d=_0x5c768d||0x1f4;return function(_0x44f7fd){logger[_0x702a('0xd')](_0x44f7fd[_0x702a('0xe')]);if(_0x44f7fd['name']){delete _0x44f7fd['name'];}_0x554435['status'](_0x5c768d)[_0x702a('0xf')](_0x44f7fd);};}exports[_0x702a('0x10')]=function(_0x2fd0e0,_0x492cfb){var _0x290591={},_0x5ec1b3={},_0x823794={'count':0x0,'rows':[]};var _0x2c3b0d=_['map'](db['CmHopper'][_0x702a('0x11')],function(_0x18b8a0){return{'name':_0x18b8a0[_0x702a('0x12')],'type':_0x18b8a0[_0x702a('0x13')][_0x702a('0x14')]};});_0x5ec1b3[_0x702a('0x15')]=_[_0x702a('0x16')](_0x2c3b0d,_0x702a('0x17'));_0x5ec1b3[_0x702a('0x18')]=_[_0x702a('0x19')](_0x2fd0e0['query']);_0x5ec1b3[_0x702a('0x1a')]=_[_0x702a('0x1b')](_0x5ec1b3[_0x702a('0x15')],_0x5ec1b3[_0x702a('0x18')]);_0x5ec1b3[_0x702a('0x1a')]=_[_0x702a('0x1c')](_0x5ec1b3[_0x702a('0x1a')],[_0x702a('0x1d'),_0x702a('0x1e'),'$gt',_0x702a('0x1f'),_0x702a('0x20'),'$lte',_0x702a('0x21'),_0x702a('0x22'),_0x702a('0x23'),_0x702a('0x24'),_0x702a('0x25'),_0x702a('0x26'),'$notIn',_0x702a('0x27'),_0x702a('0x28'),'$iLike',_0x702a('0x29'),_0x702a('0x27'),_0x702a('0x2a'),_0x702a('0x2b'),_0x702a('0x2c'),_0x702a('0x2d')]);_0x290591[_0x702a('0x2e')]=_['intersection'](_0x5ec1b3[_0x702a('0x15')],qs[_0x702a('0x2f')](_0x2fd0e0[_0x702a('0x18')][_0x702a('0x2f')]));_0x290591[_0x702a('0x2e')]=_0x290591[_0x702a('0x2e')]['length']?_0x290591[_0x702a('0x2e')]:_0x5ec1b3[_0x702a('0x15')];if(!_0x2fd0e0['query']['hasOwnProperty'](_0x702a('0x30'))){_0x290591[_0x702a('0x7')]=qs['limit'](_0x2fd0e0[_0x702a('0x18')]['limit']);_0x290591['offset']=qs[_0x702a('0x5')](_0x2fd0e0[_0x702a('0x18')][_0x702a('0x5')]);}_0x290591['order']=qs[_0x702a('0x31')](_0x2fd0e0[_0x702a('0x18')][_0x702a('0x31')]);_0x290591[_0x702a('0x32')]=qs[_0x702a('0x1a')](_[_0x702a('0x33')](_0x2fd0e0[_0x702a('0x18')],_0x5ec1b3[_0x702a('0x1a')]),_0x2c3b0d);if(_0x2fd0e0[_0x702a('0x18')][_0x702a('0x34')]){_0x290591[_0x702a('0x32')]=_[_0x702a('0x35')](_0x290591[_0x702a('0x32')],{'$or':_[_0x702a('0x16')](_0x2c3b0d,function(_0x38b1da){if(_0x38b1da[_0x702a('0x13')]!==_0x702a('0x36')){var _0x324d99={};_0x324d99[_0x38b1da['name']]={'$like':'%'+_0x2fd0e0[_0x702a('0x18')][_0x702a('0x34')]+'%'};return _0x324d99;}})});}_0x290591=_[_0x702a('0x35')]({},_0x290591,_0x2fd0e0[_0x702a('0x37')]);var _0x927fd7={'where':_0x290591[_0x702a('0x32')]};return db[_0x702a('0x38')][_0x702a('0x8')](_0x927fd7)['then'](function(_0x1f544d){_0x823794[_0x702a('0x8')]=_0x1f544d;if(_0x2fd0e0[_0x702a('0x18')][_0x702a('0x39')]){_0x290591[_0x702a('0x3a')]=[{'all':!![]}];}return db[_0x702a('0x38')][_0x702a('0x3b')](_0x290591);})[_0x702a('0x3c')](function(_0x38fa54){_0x823794[_0x702a('0x3d')]=_0x38fa54;return _0x823794;})[_0x702a('0x3c')](respondWithFilteredResult(_0x492cfb,_0x290591))[_0x702a('0x3e')](handleError(_0x492cfb,null));};exports[_0x702a('0x3f')]=function(_0xe542be,_0x55f71b){var _0x252b54={'raw':!![],'where':{'id':_0xe542be[_0x702a('0x40')]['id']}},_0xdcb21a={};_0xdcb21a['model']=_[_0x702a('0x19')](db[_0x702a('0x38')][_0x702a('0x11')]);_0xdcb21a[_0x702a('0x18')]=_[_0x702a('0x19')](_0xe542be[_0x702a('0x18')]);_0xdcb21a['filters']=_[_0x702a('0x1b')](_0xdcb21a[_0x702a('0x15')],_0xdcb21a[_0x702a('0x18')]);_0x252b54[_0x702a('0x2e')]=_[_0x702a('0x1b')](_0xdcb21a[_0x702a('0x15')],qs[_0x702a('0x2f')](_0xe542be[_0x702a('0x18')]['fields']));_0x252b54[_0x702a('0x2e')]=_0x252b54['attributes'][_0x702a('0x41')]?_0x252b54[_0x702a('0x2e')]:_0xdcb21a[_0x702a('0x15')];if(_0xe542be['query'][_0x702a('0x39')]){_0x252b54[_0x702a('0x3a')]=[{'all':!![]}];}_0x252b54=_[_0x702a('0x35')]({},_0x252b54,_0xe542be[_0x702a('0x37')]);return db[_0x702a('0x38')][_0x702a('0x42')](_0x252b54)[_0x702a('0x3c')](handleEntityNotFound(_0x55f71b,null))['then'](respondWithResult(_0x55f71b,null))['catch'](handleError(_0x55f71b,null));};exports[_0x702a('0x43')]=function(_0x2caa38,_0x509f43){return db['CmHopper']['create'](_0x2caa38[_0x702a('0x44')],{})[_0x702a('0x3c')](respondWithResult(_0x509f43,0xc9))[_0x702a('0x3e')](handleError(_0x509f43,null));};exports[_0x702a('0xc')]=function(_0x40dbb0,_0x889898){if(_0x40dbb0[_0x702a('0x44')]['id']){delete _0x40dbb0[_0x702a('0x44')]['id'];}return db[_0x702a('0x38')][_0x702a('0x42')]({'where':{'id':_0x40dbb0[_0x702a('0x40')]['id']}})[_0x702a('0x3c')](handleEntityNotFound(_0x889898,null))[_0x702a('0x3c')](saveUpdates(_0x40dbb0['body'],null))['then'](respondWithResult(_0x889898,null))[_0x702a('0x3e')](handleError(_0x889898,null));};exports[_0x702a('0x45')]=function(_0x5a1cdf,_0x4477b7){return db[_0x702a('0x38')]['describe']()[_0x702a('0x3c')](respondWithResult(_0x4477b7,null))[_0x702a('0x3e')](handleError(_0x4477b7,null));};exports[_0x702a('0x46')]=function(_0x55e380,_0x3b1bba){var _0x18a107;var _0x59b1a0=_0x55e380[_0x702a('0x40')]['id'];return db[_0x702a('0x38')]['find']({'where':{'id':_0x55e380[_0x702a('0x40')]['id']}})[_0x702a('0x3c')](handleEntityNotFound(_0x3b1bba,null))[_0x702a('0x3c')](function(_0xf3dc32){if(_0xf3dc32){return _0xf3dc32[_0x702a('0x46')]()[_0x702a('0x3c')](function(_0xee9f8d){return _0xee9f8d;});}})[_0x702a('0x3c')](function(_0x3abd06){_0x18a107=_0x3abd06;if(_0x3abd06){if(_0x3abd06['VoiceQueueId']||_0x3abd06[_0x702a('0x47')]){return db[_0x3abd06[_0x702a('0x48')]?_0x702a('0x49'):_0x702a('0x4a')]['find']({'where':{'id':_0x3abd06[_0x702a('0x48')]?_0x3abd06[_0x702a('0x48')]:_0x3abd06[_0x702a('0x47')]},'attributes':['id',_0x702a('0x17')],'raw':!![]});}}})[_0x702a('0x3c')](function(_0x4d2387){var _0x1cd107={};if(_0x4d2387){_[_0x702a('0x35')](_0x1cd107,_[_0x702a('0x4b')](_0x18a107[_0x702a('0x4c')],[_0x702a('0x4d'),'updatedAt','id']));_0x1cd107['state']=0x15;_0x1cd107[_0x702a('0x4e')]=_0x702a('0x4f');_0x1cd107[_0x702a('0x50')]=_0x4d2387[_0x702a('0x17')];_0x1cd107[_0x702a('0x51')]=_0x55e380[_0x702a('0x52')][_0x702a('0x17')];_0x1cd107[_0x702a('0x53')]=_0x55e380['user']['id'];_0x1cd107['deleted']=!![];_0x1cd107[_0x702a('0x54')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1cd107[_0x702a('0x55')]=_0x18a107['phone'];_0x1cd107[_0x702a('0x56')]=_0x18a107[_0x702a('0x48')]?_0x702a('0x57'):_0x702a('0x58');return db[_0x702a('0x59')][_0x702a('0x42')]({'where':{'id':_0x1cd107[_0x702a('0x5a')]},'attributes':[_0x702a('0x5b'),_0x702a('0x5c')]})['then'](function(_0xb31089){if(!_[_0x702a('0x5d')](_0x3b1bba)&&!_['isNil'](_0xb31089[_0x702a('0x5b')])){_0x1cd107[_0x702a('0x5e')]=_0xb31089[_0x702a('0x5b')];if(!_[_0x702a('0x5d')](_0xb31089[_0x702a('0x5c')])){_0x1cd107[_0x702a('0x5e')]+='\x20'+_0xb31089[_0x702a('0x5c')];}}})['finally'](function(){return db[_0x702a('0x5f')][_0x702a('0x43')](_0x1cd107);});}})['then'](function(_0x20a0ce){return db['CmHopperAdditionalPhone'][_0x702a('0x46')]({'where':{'CmHopperId':_0x59b1a0}});})['then'](function(){return _0x3b1bba[_0x702a('0x4')](0xcc)[_0x702a('0x60')]();})['catch'](handleError(_0x3b1bba,null));};exports[_0x702a('0x61')]=function(_0x312bca,_0x2eeb3d){var _0x2792ce=[];return db['CmContact'][_0x702a('0x45')]()[_0x702a('0x3c')](function(_0x44f845){_0x2792ce=_[_0x702a('0x19')](_0x44f845);return _0x312bca[_0x702a('0x52')][_0x702a('0x62')]({'where':{'type':_0x702a('0x63'),'dialActive':!![],'dialMethod':_0x702a('0x64')},'attributes':['id',_0x702a('0x65'),_0x702a('0x66')],'raw':!![]});})['then'](function(_0x310e06){if(_0x310e06&&_0x310e06[_0x702a('0x41')]){return db[_0x702a('0x67')]['transaction'](function(_0x297a28){var _0x12ea4c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x702a('0x68')](_0x702a('0x69'))},'VoiceQueueId':{'$in':_[_0x702a('0x16')](_0x310e06,'id')},'$or':[{'UserId':null},{'UserId':_0x312bca[_0x702a('0x52')]['id']}]};var _0x27f84f={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x310e06)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x702a('0x16')]('id')[_0x702a('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x312bca[_0x702a('0x52')]['id']}]};var _0x3a57d9={'$or':[_0x12ea4c,_0x27f84f]};var _0x551a05=[];if(_0x312bca[_0x702a('0x44')][_0x702a('0x6b')]&&_0x312bca[_0x702a('0x44')][_0x702a('0x6b')]==='prev'){if(!_[_0x702a('0x6c')](_0x312bca['body'][_0x702a('0x6d')])){_0x3a57d9['id']={'$in':_0x312bca[_0x702a('0x44')]['hopperIds']};}_0x551a05=[[_0x702a('0x6e'),_0x702a('0x6f')],[_0x702a('0x70'),_0x310e06[0x0][_0x702a('0x65')]==='ASC'?_0x702a('0x71'):_0x702a('0x6f')],db['sequelize']['literal'](_0x702a('0x72')),['id','DESC']];}else{if(!_[_0x702a('0x6c')](_0x312bca[_0x702a('0x44')][_0x702a('0x6d')])){_0x3a57d9['id']={'$notIn':_0x312bca['body'][_0x702a('0x6d')]};}_0x551a05=[[_0x702a('0x6e'),_0x702a('0x71')],['scheduledAt',_0x310e06[0x0][_0x702a('0x65')]],db[_0x702a('0x67')][_0x702a('0x73')](_0x702a('0x74')),['id',_0x702a('0x6f')]];}return db[_0x702a('0x38')][_0x702a('0x75')]({'attributes':['id','scheduledat',_0x702a('0x76'),_0x702a('0x77')],'where':_0x3a57d9,'order':_0x551a05,'transaction':_0x297a28,'lock':_0x297a28[_0x702a('0x78')]['UPDATE'],'include':[{'model':db[_0x702a('0x59')],'as':_0x702a('0x79'),'attributes':_0x2792ce,'include':[{'model':db[_0x702a('0x7a')],'as':_0x702a('0x7b'),'attributes':['id','name']}]},{'model':db[_0x702a('0x7c')],'as':_0x702a('0x7d'),'attributes':['id',_0x702a('0x17')]},{'model':db['VoiceQueue'],'as':_0x702a('0x7e'),'attributes':['id',_0x702a('0x17'),_0x702a('0x7f')]}]})['then'](function(_0x5772c9){if(_0x5772c9){return _0x5772c9[_0x702a('0xc')]({'UserId':_0x312bca[_0x702a('0x52')]['id']},{'transaction':_0x297a28});}});});}})[_0x702a('0x3c')](handleEntityNotFound(_0x2eeb3d,null))['then'](respondWithResult(_0x2eeb3d,null))[_0x702a('0x3e')](handleError(_0x2eeb3d,null));};exports[_0x702a('0x80')]=function(_0x59063d,_0x11b1bd,_0x4d244b){var _0x3d599b=[];var _0xe8b6b2=_0x59063d[_0x702a('0x40')]['id'];var _0x5cbba6=_0x59063d[_0x702a('0x52')]['id'];return db[_0x702a('0x59')]['describe']()['then'](function(_0x3dc3a0){_0x3d599b=_[_0x702a('0x19')](_0x3dc3a0);return db['sequelize'][_0x702a('0x81')](function(_0x26f911){const _0xc9549={'id':_0xe8b6b2};return db[_0x702a('0x38')][_0x702a('0x75')]({'attributes':['id','scheduledat',_0x702a('0x77')],'where':_0xc9549,'transaction':_0x26f911,'lock':_0x26f911[_0x702a('0x78')]['UPDATE'],'include':[{'model':db[_0x702a('0x59')],'as':_0x702a('0x79'),'attributes':_0x3d599b,'include':[{'model':db[_0x702a('0x7a')],'as':_0x702a('0x7b'),'attributes':['id',_0x702a('0x17')]}]},{'model':db['CmList'],'as':_0x702a('0x7d'),'attributes':['id',_0x702a('0x17')]},{'model':db['VoiceQueue'],'as':_0x702a('0x7e'),'attributes':['id',_0x702a('0x17'),_0x702a('0x7f')]}]})[_0x702a('0x3c')](function(_0x19fe67){if(_0x19fe67){return _0x19fe67[_0x702a('0xc')]({'UserId':_0x5cbba6},{'transaction':_0x26f911});}});});})['then'](handleEntityNotFound(_0x11b1bd,null))[_0x702a('0x3c')](respondWithResult(_0x11b1bd,null))[_0x702a('0x3e')](handleError(_0x11b1bd,null));};exports[_0x702a('0x82')]=function(_0x39b515,_0x56e636){return _0x39b515[_0x702a('0x52')]['getVoiceQueues']({'where':{'type':_0x702a('0x63'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x702a('0x3c')](function(_0x425ec5){if(_0x425ec5&&_0x425ec5[_0x702a('0x41')]){return db[_0x702a('0x38')][_0x702a('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x702a('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x425ec5,'id')},'$or':[{'UserId':null},{'UserId':_0x39b515[_0x702a('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x13d90a){if(!_[_0x702a('0x5d')](_0x13d90a)&&_['isNumber'](_0x13d90a)){return _0x56e636[_0x702a('0x4')](0xc8)[_0x702a('0xb')]({'contacts':_0x13d90a});}else{logger[_0x702a('0xd')](_0x702a('0x83'),'getOpenContacts',0x194,_0x702a('0x84'));_0x56e636[_0x702a('0x85')](0x194);}})['catch'](handleError(_0x56e636,null));};exports[_0x702a('0x86')]=function(_0x58245e,_0x24fbf3){var _0x3f2bd7=shared[_0x702a('0x87')];var _0x20f404=[];_['map'](_0x3f2bd7,function(_0x43a2cc){_0x20f404[_0x702a('0x88')]({'id':_0x43a2cc[_0x702a('0x17')],'name':_0x43a2cc[_0x702a('0x17')],'utcOffset':_0x43a2cc[_0x702a('0x89')]});});return _0x24fbf3[_0x702a('0x4')](0xc8)[_0x702a('0xb')]({'tz':_0x20f404});};exports[_0x702a('0x8a')]=function(_0x532621,_0x4d13a7){var _0x5c15f1=shared[_0x702a('0x87')];var _0x129983={};if(!_[_0x702a('0x5d')](_0x5c15f1[_0x532621[_0x702a('0x44')]['id']]))_0x129983=_0x5c15f1[_0x532621['body']['id']];return _0x4d13a7[_0x702a('0x4')](0xc8)[_0x702a('0xb')](_0x129983);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 772c4b8..cfabc83 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 _0x1261=['path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45f31b,_0x549b96){var _0x3bab4a=function(_0x505055){while(--_0x505055){_0x45f31b['push'](_0x45f31b['shift']());}};_0x3bab4a(++_0x549b96);}(_0x1261,0x144));var _0x1126=function(_0x274208,_0x3182ff){_0x274208=_0x274208-0x0;var _0x209164=_0x1261[_0x274208];return _0x209164;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('CmHopper',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]},{'name':_0x1126('0xd'),'fields':[_0x1126('0xd')]},{'name':'priority','fields':[_0x1126('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x3a196b,_0x1a03c4){var _0x192dd8=function(_0x122487){while(--_0x122487){_0x3a196b['push'](_0x3a196b['shift']());}};_0x192dd8(++_0x1a03c4);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 95cebc3..decdfae 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 _0x605f=['UpdateCmHopper','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','findAll','LOCK','CmContact','Contact','keys','User','Agent','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','order','UPDATE','GetCmHopperPreview','GetContactByPhone','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()','name','CmList','List','util','moment','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','options','raw','attributes','limit','map','include','model','then','info','debug','stringify','catch','message','error','ShowCmHopper','find','create','body','update','where','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active'];(function(_0x302854,_0x503b53){var _0x3588b8=function(_0x531035){while(--_0x531035){_0x302854['push'](_0x302854['shift']());}};_0x3588b8(++_0x503b53);}(_0x605f,0x1a6));var _0xf605=function(_0x27981a,_0x3fa7c2){_0x27981a=_0x27981a-0x0;var _0x10bf7b=_0x605f[_0x27981a];return _0x10bf7b;};'use strict';var _=require('lodash');var util=require(_0xf605('0x0'));var moment=require(_0xf605('0x1'));var BPromise=require('bluebird');var db=require(_0xf605('0x2'))['db'];var logger=require(_0xf605('0x3'))('rpc');exports[_0xf605('0x4')]=function(_0x12242b){var _0x5bcbc6=this;return new Promise(function(_0x44d678,_0x28bd0e){return db[_0xf605('0x5')]['findAll']({'raw':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'where':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')]['where']||null:null,'attributes':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')][_0xf605('0x8')]||null:null,'limit':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')][_0xf605('0x9')]||null:null,'include':_0x12242b[_0xf605('0x6')]?_0x12242b[_0xf605('0x6')]['include']?_[_0xf605('0xa')](_0x12242b[_0xf605('0x6')][_0xf605('0xb')],function(_0x6cfbed){return{'model':db[_0x6cfbed[_0xf605('0xc')]],'as':_0x6cfbed['as'],'attributes':_0x6cfbed[_0xf605('0x8')],'include':_0x6cfbed['include']?_['map'](_0x6cfbed[_0xf605('0xb')],function(_0x6881db){return{'model':db[_0x6881db[_0xf605('0xc')]],'as':_0x6881db['as'],'attributes':_0x6881db['attributes'],'include':_0x6881db[_0xf605('0xb')]?_['map'](_0x6881db[_0xf605('0xb')],function(_0x94112c){return{'model':db[_0x94112c[_0xf605('0xc')]],'as':_0x94112c['as'],'attributes':_0x94112c[_0xf605('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf605('0xd')](function(_0x116514){logger[_0xf605('0xe')](_0xf605('0x4'),_0x12242b);logger[_0xf605('0xf')](_0xf605('0x4'),_0x12242b,JSON[_0xf605('0x10')](_0x116514));_0x44d678(_0x116514);})[_0xf605('0x11')](function(_0x5f09c3){logger['error']('GetCmHopper',_0x5f09c3[_0xf605('0x12')],_0x12242b);_0x28bd0e(_0x5bcbc6[_0xf605('0x13')](0x1f4,_0x5f09c3[_0xf605('0x12')]));});});};exports[_0xf605('0x14')]=function(_0x1e7acd){var _0x437489=this;return new Promise(function(_0x1655a0,_0x477967){return db[_0xf605('0x5')][_0xf605('0x15')]({'raw':_0x1e7acd[_0xf605('0x6')]?_0x1e7acd['options'][_0xf605('0x7')]===undefined?!![]:![]:!![],'where':_0x1e7acd['options']?_0x1e7acd[_0xf605('0x6')]['where']||null:null,'attributes':_0x1e7acd[_0xf605('0x6')]?_0x1e7acd['options'][_0xf605('0x8')]||null:null,'include':_0x1e7acd[_0xf605('0x6')]?_0x1e7acd[_0xf605('0x6')][_0xf605('0xb')]?_[_0xf605('0xa')](_0x1e7acd[_0xf605('0x6')]['include'],function(_0x751746){return{'model':db[_0x751746[_0xf605('0xc')]],'as':_0x751746['as'],'attributes':_0x751746['attributes'],'include':_0x751746['include']?_[_0xf605('0xa')](_0x751746[_0xf605('0xb')],function(_0x42bd98){return{'model':db[_0x42bd98[_0xf605('0xc')]],'as':_0x42bd98['as'],'attributes':_0x42bd98[_0xf605('0x8')],'include':_0x42bd98[_0xf605('0xb')]?_[_0xf605('0xa')](_0x42bd98['include'],function(_0x3d8fd0){return{'model':db[_0x3d8fd0[_0xf605('0xc')]],'as':_0x3d8fd0['as'],'attributes':_0x3d8fd0[_0xf605('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f43fa){logger['info'](_0xf605('0x14'),_0x1e7acd);logger[_0xf605('0xf')](_0xf605('0x14'),_0x1e7acd,JSON[_0xf605('0x10')](_0x5f43fa));_0x1655a0(_0x5f43fa);})[_0xf605('0x11')](function(_0x73aeb4){logger[_0xf605('0x13')](_0xf605('0x14'),_0x73aeb4[_0xf605('0x12')],_0x1e7acd);_0x477967(_0x437489['error'](0x1f4,_0x73aeb4[_0xf605('0x12')]));});});};exports['CreateCmHopper']=function(_0x1eb5a9){var _0x361e37=this;return new Promise(function(_0x1dc9e0,_0x218bbc){return db[_0xf605('0x5')][_0xf605('0x16')](_0x1eb5a9[_0xf605('0x17')],{'raw':_0x1eb5a9[_0xf605('0x6')]?_0x1eb5a9[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![]})[_0xf605('0xd')](function(_0x4e12d3){logger[_0xf605('0xe')]('CreateCmHopper',_0x1eb5a9);logger[_0xf605('0xf')]('CreateCmHopper',_0x1eb5a9,JSON['stringify'](_0x4e12d3));_0x1dc9e0(_0x4e12d3);})[_0xf605('0x11')](function(_0x4cfbb7){logger[_0xf605('0x13')]('CreateCmHopper',_0x4cfbb7['message'],_0x1eb5a9);_0x218bbc(_0x361e37[_0xf605('0x13')](0x1f4,_0x4cfbb7[_0xf605('0x12')]));});});};exports['UpdateCmHopper']=function(_0x77a8f6){var _0x32caa1=this;return new Promise(function(_0x23dd38,_0x31ac3a){return db[_0xf605('0x5')][_0xf605('0x18')](_0x77a8f6[_0xf605('0x17')],{'raw':_0x77a8f6['options']?_0x77a8f6[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x77a8f6['options']?_0x77a8f6[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':_0x77a8f6[_0xf605('0x6')]?_0x77a8f6['options'][_0xf605('0x8')]||null:null,'limit':_0x77a8f6[_0xf605('0x6')]?_0x77a8f6['options'][_0xf605('0x9')]||null:null})[_0xf605('0xd')](function(_0x117ef3){logger[_0xf605('0xe')]('UpdateCmHopper',_0x77a8f6);logger[_0xf605('0xe')](_0xf605('0x1a'),JSON[_0xf605('0x10')](_0x77a8f6[_0xf605('0x6')][_0xf605('0x19')]),_0x77a8f6[_0xf605('0x17')][_0xf605('0x1b')]);logger[_0xf605('0xf')](_0xf605('0x1c'),_0x77a8f6,JSON[_0xf605('0x10')](_0x117ef3));_0x23dd38(_0x117ef3);})['catch'](function(_0x418807){logger[_0xf605('0x13')](_0xf605('0x1c'),_0x418807[_0xf605('0x12')],_0x77a8f6);_0x31ac3a(_0x32caa1[_0xf605('0x13')](0x1f4,_0x418807[_0xf605('0x12')]));});});};exports[_0xf605('0x1d')]=function(_0x4efcb8){var _0x4691f3=this;return new Promise(function(_0xdee2da,_0x2704a8){return db[_0xf605('0x5')]['destroy']({'where':_0x4efcb8[_0xf605('0x6')]?_0x4efcb8[_0xf605('0x6')][_0xf605('0x19')]||null:null})[_0xf605('0xd')](function(_0x42b026){logger[_0xf605('0xe')](_0xf605('0x1d'),_0x4efcb8);logger[_0xf605('0xf')](_0xf605('0x1d'),_0x4efcb8,JSON[_0xf605('0x10')](_0x42b026));_0xdee2da(_0x42b026);})[_0xf605('0x11')](function(_0x48b418){logger['error']('DestroyCmHopper',_0x48b418[_0xf605('0x12')],_0x4efcb8);_0x2704a8(_0x4691f3[_0xf605('0x13')](0x1f4,_0x48b418[_0xf605('0x12')]));});});};exports[_0xf605('0x1e')]=function(_0x260346){var _0x163e6b=this;return new Promise(function(_0x41cab2,_0x585f3f){return db['CmContact'][_0xf605('0x1f')]()['then'](function(_0x42c9b6){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x17a1c6){return db[_0xf605('0x5')][_0xf605('0x22')]({'where':_0x260346[_0xf605('0x6')]?_0x260346[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':_0x260346[_0xf605('0x6')]?_0x260346[_0xf605('0x6')][_0xf605('0x8')]||null:null,'limit':_0x260346[_0xf605('0x6')]?_0x260346[_0xf605('0x6')][_0xf605('0x9')]||null:null,'order':_0x260346[_0xf605('0x6')]?_0x260346[_0xf605('0x6')]['order']||null:null,'transaction':_0x17a1c6,'lock':_0x17a1c6[_0xf605('0x23')]['UPDATE'],'include':[{'model':db[_0xf605('0x24')],'as':_0xf605('0x25'),'attributes':_[_0xf605('0x26')](_0x42c9b6)},{'model':db[_0xf605('0x27')],'as':_0xf605('0x28'),'attributes':['id','name',_0xf605('0x29')]}]})['then'](function(_0x2c16e0){var _0x5bde1a=[];var _0x1eb03d=[];for(var _0x3ea58c=0x0;_0x3ea58c<_0x2c16e0[_0xf605('0x2a')];_0x3ea58c+=0x1){var _0x1e7031=_0x2c16e0[_0x3ea58c][_0xf605('0x2b')];if(_0x1e7031===null){_0x5bde1a[_0xf605('0x2c')](_0x2c16e0[_0x3ea58c][_0xf605('0x18')](_0x260346[_0xf605('0x17')],{'transaction':_0x17a1c6}));}else if(!_0x1eb03d['includes'](_0x1e7031)){_0x1eb03d[_0xf605('0x2c')](_0x1e7031);_0x5bde1a[_0xf605('0x2c')](_0x2c16e0[_0x3ea58c][_0xf605('0x18')](_0x260346[_0xf605('0x17')],{'transaction':_0x17a1c6}));}}return BPromise[_0xf605('0x2d')](_0x5bde1a);});})[_0xf605('0xd')](function(_0x2e3896){logger[_0xf605('0xe')]('GetContactDialer',_0x260346);if(_0x2e3896[_0xf605('0x2a')]>0x0){logger[_0xf605('0xe')](_0xf605('0x2e'),_0x2e3896[0x0][_0xf605('0x2f')]['id'],_0x2e3896[0x0][_0xf605('0x2f')]['ContactId'],_0x2e3896[0x0][_0xf605('0x2f')][_0xf605('0x1b')]);}logger[_0xf605('0xf')](_0xf605('0x1e'),_0x260346,JSON[_0xf605('0x10')](_0x2e3896));_0x41cab2(_0x2e3896);})[_0xf605('0x11')](function(_0x51829f){logger[_0xf605('0x13')](_0xf605('0x1e'),_0x51829f[_0xf605('0x12')],_0x260346);_0x585f3f(_0x163e6b[_0xf605('0x13')](0x1f4,_0x51829f[_0xf605('0x12')]));});});});};exports[_0xf605('0x30')]=function(_0x25c205){var _0x52fc75=this;return new Promise(function(_0x424125,_0x111399){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x24ad7c){return db[_0xf605('0x31')]['create'](_0x25c205[_0xf605('0x17')],{'raw':_0x25c205[_0xf605('0x6')]?_0x25c205[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'transaction':_0x24ad7c})['then'](function(){logger[_0xf605('0xe')](_0xf605('0x32'),JSON['stringify'](_0x25c205[_0xf605('0x6')]['where']),_0x25c205[_0xf605('0x6')][_0xf605('0x19')]['active']);return db[_0xf605('0x5')][_0xf605('0x33')]({'where':_0x25c205[_0xf605('0x6')]?_0x25c205[_0xf605('0x6')][_0xf605('0x19')]||null:null,'transaction':_0x24ad7c});});})['then'](function(_0x4bf00b){logger[_0xf605('0xe')](_0xf605('0x30'),_0x25c205);logger[_0xf605('0xf')](_0xf605('0x30'),_0x25c205,JSON[_0xf605('0x10')](_0x4bf00b));_0x424125(_0x4bf00b);})[_0xf605('0x11')](function(_0x49a77f){logger['error'](_0xf605('0x30'),_0x49a77f[_0xf605('0x12')],_0x25c205);_0x111399(_0x52fc75[_0xf605('0x13')](0x1f4,_0x49a77f[_0xf605('0x12')]));});});};exports[_0xf605('0x34')]=function(_0x4b156e){var _0x505e81=this;return new Promise(function(_0x4eeacb,_0x56852a){return db[_0xf605('0x5')][_0xf605('0x22')]({'raw':_0x4b156e[_0xf605('0x6')]?_0x4b156e[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'where':_0x4b156e[_0xf605('0x6')]?_0x4b156e[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf605('0x35'),db[_0xf605('0x20')]['fn']('IF',db['sequelize'][_0xf605('0x36')](_0xf605('0x37')+util[_0xf605('0x38')](_0xf605('0x39'),moment()[_0xf605('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xf605('0x3a')))),'contactsRescheduled']]})['then'](function(_0x224e85){logger[_0xf605('0xe')](_0xf605('0x34'),_0x4b156e);logger['debug'](_0xf605('0x34'),_0x4b156e,JSON[_0xf605('0x10')](_0x224e85));_0x4eeacb(_0x224e85);})[_0xf605('0x11')](function(_0x3fcc70){logger[_0xf605('0x13')](_0xf605('0x34'),_0x3fcc70[_0xf605('0x12')],_0x4b156e);_0x56852a(_0x505e81[_0xf605('0x13')](0x1f4,_0x3fcc70[_0xf605('0x12')]));});});};exports[_0xf605('0x3b')]=function(_0x42ecbc){var _0x470242=this;return new Promise(function(_0x2ee700,_0x136956){return db[_0xf605('0x24')][_0xf605('0x1f')]()['then'](function(){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x1760c1){return db['CmHopper']['findAll']({'where':_0x42ecbc['options']?_0x42ecbc[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':_0x42ecbc[_0xf605('0x6')]?_0x42ecbc['options'][_0xf605('0x8')]||null:null,'limit':0x1,'order':_0x42ecbc[_0xf605('0x6')]?_0x42ecbc['options'][_0xf605('0x3c')]||null:null,'group':db[_0xf605('0x5')][_0xf605('0x2b')],'transaction':_0x1760c1,'lock':_0x1760c1[_0xf605('0x23')][_0xf605('0x3d')],'include':_0x42ecbc[_0xf605('0x6')]?_0x42ecbc[_0xf605('0x6')][_0xf605('0xb')]?_[_0xf605('0xa')](_0x42ecbc['options']['include'],function(_0x33bee9){return{'model':db[_0x33bee9[_0xf605('0xc')]],'as':_0x33bee9['as'],'attributes':_0x33bee9[_0xf605('0x8')],'include':_0x33bee9[_0xf605('0xb')]?_[_0xf605('0xa')](_0x33bee9[_0xf605('0xb')],function(_0x3fd733){return{'model':db[_0x3fd733['model']],'as':_0x3fd733['as'],'attributes':_0x3fd733[_0xf605('0x8')],'include':_0x3fd733[_0xf605('0xb')]?_['map'](_0x3fd733[_0xf605('0xb')],function(_0x41c3f6){return{'model':db[_0x41c3f6[_0xf605('0xc')]],'as':_0x41c3f6['as'],'attributes':_0x41c3f6[_0xf605('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf605('0xd')](function(_0x42c389){var _0x3ccff8=[];for(var _0x535384=0x0;_0x535384<_0x42c389[_0xf605('0x2a')];_0x535384+=0x1){_0x3ccff8['push'](_0x42c389[_0x535384][_0xf605('0x18')](_0x42ecbc[_0xf605('0x17')],{'transaction':_0x1760c1}));}return BPromise[_0xf605('0x2d')](_0x3ccff8);});})[_0xf605('0xd')](function(_0x474a2c){logger[_0xf605('0xe')]('GetContactRecallMe',_0x42ecbc);logger[_0xf605('0xf')](_0xf605('0x3b'),_0x42ecbc,JSON['stringify'](_0x474a2c));_0x2ee700(_0x474a2c);})[_0xf605('0x11')](function(_0x325b5e){logger[_0xf605('0x13')](_0xf605('0x3b'),_0x325b5e[_0xf605('0x12')],_0x42ecbc);_0x136956(_0x470242[_0xf605('0x13')](0x1f4,_0x325b5e[_0xf605('0x12')]));});});});};exports[_0xf605('0x3e')]=function(_0x2a7816){var _0xa28464=this;return new Promise(function(_0x2a4325,_0x276eab){db[_0xf605('0x24')][_0xf605('0x1f')]()[_0xf605('0xd')](function(_0x1fc54a){return db[_0xf605('0x5')][_0xf605('0x22')]({'raw':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')][_0xf605('0x7')]===undefined?!![]:![]:!![],'where':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')][_0xf605('0x19')]||null:null,'attributes':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')]['attributes']||null:null,'limit':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')][_0xf605('0x9')]||null:null,'include':_0x2a7816[_0xf605('0x6')]?_0x2a7816[_0xf605('0x6')][_0xf605('0xb')]?_['map'](_0x2a7816[_0xf605('0x6')]['include'],function(_0x177782){return{'model':db[_0x177782[_0xf605('0xc')]],'as':_0x177782['as'],'attributes':_0x177782['as']===_0xf605('0x25')?_[_0xf605('0x26')](_0x1fc54a):_0x177782[_0xf605('0x8')],'include':_0x177782[_0xf605('0xb')]?_[_0xf605('0xa')](_0x177782['include'],function(_0x183ae2){return{'model':db[_0x183ae2[_0xf605('0xc')]],'as':_0x183ae2['as'],'attributes':_0x183ae2[_0xf605('0x8')],'include':_0x183ae2[_0xf605('0xb')]?_[_0xf605('0xa')](_0x183ae2[_0xf605('0xb')],function(_0xb79e){return{'model':db[_0xb79e[_0xf605('0xc')]],'as':_0xb79e['as'],'attributes':_0xb79e[_0xf605('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1aa7aa){logger['info'](_0xf605('0x4'),_0x2a7816);logger[_0xf605('0xf')](_0xf605('0x4'),_0x2a7816,JSON['stringify'](_0x1aa7aa));_0x2a4325(_0x1aa7aa);})[_0xf605('0x11')](function(_0x1c3767){logger[_0xf605('0x13')](_0xf605('0x4'),_0x1c3767['message'],_0x2a7816);_0x276eab(_0xa28464[_0xf605('0x13')](0x1f4,_0x1c3767[_0xf605('0x12')]));});});});};exports[_0xf605('0x3f')]=function(_0xc4443b){var _0x31599d=this;return new Promise(function(_0x1ab61d,_0x49e09b){return db[_0xf605('0x24')]['findOne']({'raw':!![],'where':{'phone':_0xc4443b[_0xf605('0x6')][_0xf605('0x19')][_0xf605('0x40')]},'attributes':['id','dialTimezone'],'order':[['id',_0xf605('0x41')]]})[_0xf605('0xd')](function(_0x649cfc){logger[_0xf605('0xe')](_0xf605('0x42'),_0xc4443b);logger[_0xf605('0xf')](_0xf605('0x42'),_0xc4443b,JSON['stringify'](_0x649cfc));_0x1ab61d(_0x649cfc);})[_0xf605('0x11')](function(_0x56fc60){logger[_0xf605('0x13')](_0xf605('0x42'),_0x56fc60[_0xf605('0x12')],_0xc4443b);_0x49e09b(_0x31599d[_0xf605('0x13')](0x1f4,_0x56fc60[_0xf605('0x12')]));});});};exports[_0xf605('0x43')]=function(_0x45b500){var _0x9ab9c4=this;return new Promise(function(_0x16c298,_0xc46a5){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x8183a1){var _0xb386da=_0x45b500[_0xf605('0x6')]&&_0x45b500[_0xf605('0x6')][_0xf605('0x19')]?_0x45b500[_0xf605('0x6')][_0xf605('0x19')]:{};return db['CmHopper']['update'](_0x45b500[_0xf605('0x17')],{'where':_0xb386da,'transaction':_0x8183a1})['then'](function(_0x37a828){logger[_0xf605('0xe')]('ResetActiveCalls',_0x45b500);logger['debug'](_0xf605('0x43'),_0x45b500,JSON[_0xf605('0x10')](_0x37a828));_0x16c298(_0x37a828);})[_0xf605('0x11')](function(_0x1eaa72){logger[_0xf605('0x13')](_0xf605('0x43'),_0x1eaa72['message'],_0x45b500);_0xc46a5(_0x9ab9c4[_0xf605('0x13')](0x1f4,_0x1eaa72[_0xf605('0x12')]));});});});};exports[_0xf605('0x44')]=function(_0x5568e1){var _0x582537=this;var _0x5ca204=_0x5568e1[_0xf605('0x17')][_0xf605('0x19')]['voiceQueueIds'];var _0x4cb3bb=_0x5568e1[_0xf605('0x17')]['where'][_0xf605('0x45')];var _0x1fea36=_0x5568e1[_0xf605('0x17')]['where'][_0xf605('0x46')];return new Promise(function(_0x52a585,_0x7fc5f6){return db[_0xf605('0x5')][_0xf605('0x22')]({'where':{'voiceQueueId':{'$in':_0x5ca204},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xf605('0x36')]('NOW()\x20+\x20INTERVAL\x20'+_0x4cb3bb+'\x20MINUTE'),'$gt':db[_0xf605('0x20')]['literal'](_0xf605('0x47'))}},'UserId':{'$in':_0x1fea36}},'include':[{'model':db[_0xf605('0x24')],'as':_0xf605('0x25')},{'model':db[_0xf605('0x27')],'as':_0xf605('0x28'),'attributes':['id',_0xf605('0x48'),_0xf605('0x29')]},{'model':db[_0xf605('0x49')],'as':_0xf605('0x4a')}]})['then'](function(_0x5a8842){if(_0x5a8842[_0xf605('0x2a')]>0x0){return db[_0xf605('0x20')][_0xf605('0x21')](function(_0x8f44c2){return db[_0xf605('0x5')][_0xf605('0x18')]({'recallmeNotifiedDate':db[_0xf605('0x20')][_0xf605('0x36')](_0xf605('0x47'))},{'where':{'id':{'$in':_[_0xf605('0xa')](_0x5a8842,'id')}},'transaction':_0x8f44c2})[_0xf605('0xd')](function(){_0x52a585(_0x5a8842);})[_0xf605('0x11')](function(_0x10e574){logger['error'](_0xf605('0x44'),_0x10e574[_0xf605('0x12')],_0x5568e1);_0x7fc5f6(_0x582537['error'](0x1f4,_0x10e574[_0xf605('0x12')]));});})[_0xf605('0x11')](function(_0x1c2a88){logger[_0xf605('0x13')](_0xf605('0x44'),_0x1c2a88[_0xf605('0x12')],_0x5568e1);_0x7fc5f6(_0x582537[_0xf605('0x13')](0x1f4,_0x1c2a88[_0xf605('0x12')]));});}else{_0x52a585(_0x5a8842);}});});}; \ No newline at end of file +var _0x305b=['create','body','stringify','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','order','UPDATE','CmContact','Contact','keys','User','Agent','voicePause','push','includes','all','length','dataValues','ContactId','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','findOne','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','List','literal','lodash','util','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','attributes','map','include','model','info','debug','message','error','ShowCmHopper','find','raw','where','then','catch','CreateCmHopper'];(function(_0x1ca38b,_0x5537e4){var _0x4b9c0e=function(_0x3fe021){while(--_0x3fe021){_0x1ca38b['push'](_0x1ca38b['shift']());}};_0x4b9c0e(++_0x5537e4);}(_0x305b,0x81));var _0xb305=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x305b[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xb305('0x0'));var util=require(_0xb305('0x1'));var moment=require(_0xb305('0x2'));var BPromise=require('bluebird');var db=require(_0xb305('0x3'))['db'];var logger=require(_0xb305('0x4'))(_0xb305('0x5'));exports[_0xb305('0x6')]=function(_0x40e68f){var _0x56440c=this;return new Promise(function(_0x2ac785,_0x2deaee){return db[_0xb305('0x7')][_0xb305('0x8')]({'raw':_0x40e68f[_0xb305('0x9')]?_0x40e68f[_0xb305('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x40e68f['options']?_0x40e68f[_0xb305('0x9')]['where']||null:null,'attributes':_0x40e68f[_0xb305('0x9')]?_0x40e68f[_0xb305('0x9')][_0xb305('0xa')]||null:null,'limit':_0x40e68f[_0xb305('0x9')]?_0x40e68f[_0xb305('0x9')]['limit']||null:null,'include':_0x40e68f['options']?_0x40e68f['options']['include']?_[_0xb305('0xb')](_0x40e68f['options'][_0xb305('0xc')],function(_0x76c8c7){return{'model':db[_0x76c8c7[_0xb305('0xd')]],'as':_0x76c8c7['as'],'attributes':_0x76c8c7[_0xb305('0xa')],'include':_0x76c8c7[_0xb305('0xc')]?_[_0xb305('0xb')](_0x76c8c7[_0xb305('0xc')],function(_0x284580){return{'model':db[_0x284580[_0xb305('0xd')]],'as':_0x284580['as'],'attributes':_0x284580[_0xb305('0xa')],'include':_0x284580['include']?_[_0xb305('0xb')](_0x284580[_0xb305('0xc')],function(_0x5218e1){return{'model':db[_0x5218e1[_0xb305('0xd')]],'as':_0x5218e1['as'],'attributes':_0x5218e1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xfdb72c){logger[_0xb305('0xe')](_0xb305('0x6'),_0x40e68f);logger[_0xb305('0xf')]('GetCmHopper',_0x40e68f,JSON['stringify'](_0xfdb72c));_0x2ac785(_0xfdb72c);})['catch'](function(_0x2e68a6){logger['error'](_0xb305('0x6'),_0x2e68a6[_0xb305('0x10')],_0x40e68f);_0x2deaee(_0x56440c[_0xb305('0x11')](0x1f4,_0x2e68a6[_0xb305('0x10')]));});});};exports[_0xb305('0x12')]=function(_0x3cf2a4){var _0x1d9efa=this;return new Promise(function(_0x1e20cb,_0x1343cf){return db[_0xb305('0x7')][_0xb305('0x13')]({'raw':_0x3cf2a4[_0xb305('0x9')]?_0x3cf2a4['options'][_0xb305('0x14')]===undefined?!![]:![]:!![],'where':_0x3cf2a4['options']?_0x3cf2a4[_0xb305('0x9')][_0xb305('0x15')]||null:null,'attributes':_0x3cf2a4[_0xb305('0x9')]?_0x3cf2a4[_0xb305('0x9')]['attributes']||null:null,'include':_0x3cf2a4[_0xb305('0x9')]?_0x3cf2a4[_0xb305('0x9')][_0xb305('0xc')]?_[_0xb305('0xb')](_0x3cf2a4[_0xb305('0x9')][_0xb305('0xc')],function(_0x3d384f){return{'model':db[_0x3d384f[_0xb305('0xd')]],'as':_0x3d384f['as'],'attributes':_0x3d384f['attributes'],'include':_0x3d384f['include']?_[_0xb305('0xb')](_0x3d384f[_0xb305('0xc')],function(_0x4be5d9){return{'model':db[_0x4be5d9['model']],'as':_0x4be5d9['as'],'attributes':_0x4be5d9['attributes'],'include':_0x4be5d9[_0xb305('0xc')]?_['map'](_0x4be5d9[_0xb305('0xc')],function(_0x25ea57){return{'model':db[_0x25ea57['model']],'as':_0x25ea57['as'],'attributes':_0x25ea57['attributes']};}):[]};}):[]};}):[]:[]})[_0xb305('0x16')](function(_0x2e3c1d){logger[_0xb305('0xe')](_0xb305('0x12'),_0x3cf2a4);logger[_0xb305('0xf')](_0xb305('0x12'),_0x3cf2a4,JSON['stringify'](_0x2e3c1d));_0x1e20cb(_0x2e3c1d);})[_0xb305('0x17')](function(_0x754b29){logger[_0xb305('0x11')](_0xb305('0x12'),_0x754b29[_0xb305('0x10')],_0x3cf2a4);_0x1343cf(_0x1d9efa[_0xb305('0x11')](0x1f4,_0x754b29['message']));});});};exports[_0xb305('0x18')]=function(_0x3015fa){var _0x3b59e0=this;return new Promise(function(_0x46d94e,_0xcf07e3){return db[_0xb305('0x7')][_0xb305('0x19')](_0x3015fa[_0xb305('0x1a')],{'raw':_0x3015fa[_0xb305('0x9')]?_0x3015fa[_0xb305('0x9')][_0xb305('0x14')]===undefined?!![]:![]:!![]})[_0xb305('0x16')](function(_0xbe42d2){logger[_0xb305('0xe')]('CreateCmHopper',_0x3015fa);logger[_0xb305('0xf')](_0xb305('0x18'),_0x3015fa,JSON[_0xb305('0x1b')](_0xbe42d2));_0x46d94e(_0xbe42d2);})['catch'](function(_0x1f4abd){logger[_0xb305('0x11')](_0xb305('0x18'),_0x1f4abd[_0xb305('0x10')],_0x3015fa);_0xcf07e3(_0x3b59e0[_0xb305('0x11')](0x1f4,_0x1f4abd[_0xb305('0x10')]));});});};exports[_0xb305('0x1c')]=function(_0x2d6b4b){var _0x55af6b=this;return new Promise(function(_0x5eff8e,_0x5baedc){return db[_0xb305('0x7')][_0xb305('0x1d')](_0x2d6b4b[_0xb305('0x1a')],{'raw':_0x2d6b4b['options']?_0x2d6b4b[_0xb305('0x9')][_0xb305('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6b4b[_0xb305('0x9')]?_0x2d6b4b[_0xb305('0x9')]['where']||null:null,'attributes':_0x2d6b4b[_0xb305('0x9')]?_0x2d6b4b[_0xb305('0x9')]['attributes']||null:null,'limit':_0x2d6b4b['options']?_0x2d6b4b['options'][_0xb305('0x1e')]||null:null})[_0xb305('0x16')](function(_0x2f8c3f){logger['info']('UpdateCmHopper',_0x2d6b4b);logger['info'](_0xb305('0x1f'),JSON[_0xb305('0x1b')](_0x2d6b4b[_0xb305('0x9')][_0xb305('0x15')]),_0x2d6b4b[_0xb305('0x1a')][_0xb305('0x20')]);logger[_0xb305('0xf')](_0xb305('0x1c'),_0x2d6b4b,JSON[_0xb305('0x1b')](_0x2f8c3f));_0x5eff8e(_0x2f8c3f);})[_0xb305('0x17')](function(_0x3ffed5){logger['error'](_0xb305('0x1c'),_0x3ffed5[_0xb305('0x10')],_0x2d6b4b);_0x5baedc(_0x55af6b['error'](0x1f4,_0x3ffed5['message']));});});};exports['DestroyCmHopper']=function(_0x1d5bf2){var _0x2ba6cb=this;return new Promise(function(_0xb087fd,_0x222a25){return db[_0xb305('0x7')]['destroy']({'where':_0x1d5bf2[_0xb305('0x9')]?_0x1d5bf2['options']['where']||null:null})['then'](function(_0x2c2ddb){logger[_0xb305('0xe')](_0xb305('0x21'),_0x1d5bf2);logger['debug']('DestroyCmHopper',_0x1d5bf2,JSON[_0xb305('0x1b')](_0x2c2ddb));_0xb087fd(_0x2c2ddb);})[_0xb305('0x17')](function(_0xed0484){logger[_0xb305('0x11')](_0xb305('0x21'),_0xed0484[_0xb305('0x10')],_0x1d5bf2);_0x222a25(_0x2ba6cb['error'](0x1f4,_0xed0484[_0xb305('0x10')]));});});};exports[_0xb305('0x22')]=function(_0x31f87d){var _0x2fa84c=this;return new Promise(function(_0x3b739c,_0x28b7d9){return db['CmContact'][_0xb305('0x23')]()[_0xb305('0x16')](function(_0x285b18){return db[_0xb305('0x24')][_0xb305('0x25')](function(_0x570584){return db[_0xb305('0x7')][_0xb305('0x8')]({'where':_0x31f87d[_0xb305('0x9')]?_0x31f87d[_0xb305('0x9')][_0xb305('0x15')]||null:null,'attributes':_0x31f87d['options']?_0x31f87d[_0xb305('0x9')]['attributes']||null:null,'limit':_0x31f87d['options']?_0x31f87d[_0xb305('0x9')][_0xb305('0x1e')]||null:null,'order':_0x31f87d[_0xb305('0x9')]?_0x31f87d[_0xb305('0x9')][_0xb305('0x26')]||null:null,'transaction':_0x570584,'lock':_0x570584['LOCK'][_0xb305('0x27')],'include':[{'model':db[_0xb305('0x28')],'as':_0xb305('0x29'),'attributes':_[_0xb305('0x2a')](_0x285b18)},{'model':db[_0xb305('0x2b')],'as':_0xb305('0x2c'),'attributes':['id','name',_0xb305('0x2d')]}]})['then'](function(_0xe816f9){var _0x5ae80e=[];var _0x9a7d08=[];for(var _0x2de139=0x0;_0x2de139<_0xe816f9['length'];_0x2de139+=0x1){var _0x4f9059=_0xe816f9[_0x2de139]['UserId'];if(_0x4f9059===null){_0x5ae80e[_0xb305('0x2e')](_0xe816f9[_0x2de139][_0xb305('0x1d')](_0x31f87d[_0xb305('0x1a')],{'transaction':_0x570584}));}else if(!_0x9a7d08[_0xb305('0x2f')](_0x4f9059)){_0x9a7d08[_0xb305('0x2e')](_0x4f9059);_0x5ae80e['push'](_0xe816f9[_0x2de139]['update'](_0x31f87d[_0xb305('0x1a')],{'transaction':_0x570584}));}}return BPromise[_0xb305('0x30')](_0x5ae80e);});})[_0xb305('0x16')](function(_0x30b7fb){logger[_0xb305('0xe')]('GetContactDialer',_0x31f87d);if(_0x30b7fb[_0xb305('0x31')]>0x0){logger[_0xb305('0xe')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x30b7fb[0x0][_0xb305('0x32')]['id'],_0x30b7fb[0x0][_0xb305('0x32')][_0xb305('0x33')],_0x30b7fb[0x0][_0xb305('0x32')][_0xb305('0x20')]);}logger[_0xb305('0xf')]('GetContactDialer',_0x31f87d,JSON['stringify'](_0x30b7fb));_0x3b739c(_0x30b7fb);})[_0xb305('0x17')](function(_0x43e7cc){logger[_0xb305('0x11')](_0xb305('0x22'),_0x43e7cc[_0xb305('0x10')],_0x31f87d);_0x28b7d9(_0x2fa84c[_0xb305('0x11')](0x1f4,_0x43e7cc[_0xb305('0x10')]));});});});};exports['MoveContactManagedDialer']=function(_0x18f87d){var _0x7c4679=this;return new Promise(function(_0x2bce94,_0x28addc){return db['sequelize'][_0xb305('0x25')](function(_0x3700d3){return db['CmHopperFinal'][_0xb305('0x19')](_0x18f87d[_0xb305('0x1a')],{'raw':_0x18f87d[_0xb305('0x9')]?_0x18f87d[_0xb305('0x9')][_0xb305('0x14')]===undefined?!![]:![]:!![],'transaction':_0x3700d3})[_0xb305('0x16')](function(){logger['info'](_0xb305('0x34'),JSON[_0xb305('0x1b')](_0x18f87d[_0xb305('0x9')]['where']),_0x18f87d['options']['where'][_0xb305('0x20')]);return db[_0xb305('0x7')][_0xb305('0x35')]({'where':_0x18f87d[_0xb305('0x9')]?_0x18f87d[_0xb305('0x9')][_0xb305('0x15')]||null:null,'transaction':_0x3700d3});});})['then'](function(_0xb82605){logger[_0xb305('0xe')](_0xb305('0x36'),_0x18f87d);logger[_0xb305('0xf')](_0xb305('0x36'),_0x18f87d,JSON[_0xb305('0x1b')](_0xb82605));_0x2bce94(_0xb82605);})['catch'](function(_0x419748){logger['error'](_0xb305('0x36'),_0x419748[_0xb305('0x10')],_0x18f87d);_0x28addc(_0x7c4679[_0xb305('0x11')](0x1f4,_0x419748[_0xb305('0x10')]));});});};exports[_0xb305('0x37')]=function(_0x3480bc){var _0x2eed49=this;return new Promise(function(_0x20975e,_0x5679d1){return db[_0xb305('0x7')][_0xb305('0x8')]({'raw':_0x3480bc['options']?_0x3480bc[_0xb305('0x9')][_0xb305('0x14')]===undefined?!![]:![]:!![],'where':_0x3480bc[_0xb305('0x9')]?_0x3480bc[_0xb305('0x9')][_0xb305('0x15')]||null:null,'attributes':[[db[_0xb305('0x24')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xb305('0x38')+util[_0xb305('0x39')](_0xb305('0x3a'),moment()[_0xb305('0x39')](_0xb305('0x3b')))+_0xb305('0x3c')))),_0xb305('0x3d')]]})['then'](function(_0x1f31c3){logger[_0xb305('0xe')](_0xb305('0x37'),_0x3480bc);logger[_0xb305('0xf')]('CountReScheduled',_0x3480bc,JSON['stringify'](_0x1f31c3));_0x20975e(_0x1f31c3);})[_0xb305('0x17')](function(_0x2eae8d){logger['error']('CountReScheduled',_0x2eae8d[_0xb305('0x10')],_0x3480bc);_0x5679d1(_0x2eed49[_0xb305('0x11')](0x1f4,_0x2eae8d[_0xb305('0x10')]));});});};exports[_0xb305('0x3e')]=function(_0x44212b){var _0x3c4c18=this;return new Promise(function(_0x1020eb,_0x8c97a9){return db['CmContact'][_0xb305('0x23')]()[_0xb305('0x16')](function(){return db[_0xb305('0x24')][_0xb305('0x25')](function(_0x215efa){return db[_0xb305('0x7')][_0xb305('0x8')]({'where':_0x44212b[_0xb305('0x9')]?_0x44212b[_0xb305('0x9')][_0xb305('0x15')]||null:null,'attributes':_0x44212b[_0xb305('0x9')]?_0x44212b['options'][_0xb305('0xa')]||null:null,'limit':0x1,'order':_0x44212b[_0xb305('0x9')]?_0x44212b[_0xb305('0x9')][_0xb305('0x26')]||null:null,'group':db[_0xb305('0x7')][_0xb305('0x3f')],'transaction':_0x215efa,'lock':_0x215efa['LOCK']['UPDATE'],'include':_0x44212b[_0xb305('0x9')]?_0x44212b[_0xb305('0x9')][_0xb305('0xc')]?_['map'](_0x44212b[_0xb305('0x9')]['include'],function(_0x4cd8e7){return{'model':db[_0x4cd8e7[_0xb305('0xd')]],'as':_0x4cd8e7['as'],'attributes':_0x4cd8e7[_0xb305('0xa')],'include':_0x4cd8e7[_0xb305('0xc')]?_[_0xb305('0xb')](_0x4cd8e7[_0xb305('0xc')],function(_0x2ddb71){return{'model':db[_0x2ddb71[_0xb305('0xd')]],'as':_0x2ddb71['as'],'attributes':_0x2ddb71[_0xb305('0xa')],'include':_0x2ddb71[_0xb305('0xc')]?_[_0xb305('0xb')](_0x2ddb71[_0xb305('0xc')],function(_0x157885){return{'model':db[_0x157885['model']],'as':_0x157885['as'],'attributes':_0x157885[_0xb305('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb305('0x16')](function(_0x3b905a){var _0x3935cf=[];for(var _0x3b3f45=0x0;_0x3b3f45<_0x3b905a['length'];_0x3b3f45+=0x1){_0x3935cf[_0xb305('0x2e')](_0x3b905a[_0x3b3f45]['update'](_0x44212b[_0xb305('0x1a')],{'transaction':_0x215efa}));}return BPromise[_0xb305('0x30')](_0x3935cf);});})[_0xb305('0x16')](function(_0x67360a){logger[_0xb305('0xe')](_0xb305('0x3e'),_0x44212b);logger[_0xb305('0xf')]('GetContactRecallMe',_0x44212b,JSON[_0xb305('0x1b')](_0x67360a));_0x1020eb(_0x67360a);})[_0xb305('0x17')](function(_0x4d9eaf){logger[_0xb305('0x11')](_0xb305('0x3e'),_0x4d9eaf[_0xb305('0x10')],_0x44212b);_0x8c97a9(_0x3c4c18[_0xb305('0x11')](0x1f4,_0x4d9eaf[_0xb305('0x10')]));});});});};exports[_0xb305('0x40')]=function(_0x2829e0){var _0x29629c=this;return new Promise(function(_0x2e75dd,_0x19a518){db['CmContact'][_0xb305('0x23')]()[_0xb305('0x16')](function(_0x51e4ad){return db[_0xb305('0x7')][_0xb305('0x8')]({'raw':_0x2829e0[_0xb305('0x9')]?_0x2829e0[_0xb305('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x2829e0['options']?_0x2829e0['options'][_0xb305('0x15')]||null:null,'attributes':_0x2829e0[_0xb305('0x9')]?_0x2829e0['options']['attributes']||null:null,'limit':_0x2829e0[_0xb305('0x9')]?_0x2829e0[_0xb305('0x9')]['limit']||null:null,'include':_0x2829e0[_0xb305('0x9')]?_0x2829e0[_0xb305('0x9')][_0xb305('0xc')]?_[_0xb305('0xb')](_0x2829e0['options'][_0xb305('0xc')],function(_0x3faac7){return{'model':db[_0x3faac7[_0xb305('0xd')]],'as':_0x3faac7['as'],'attributes':_0x3faac7['as']==='Contact'?_[_0xb305('0x2a')](_0x51e4ad):_0x3faac7[_0xb305('0xa')],'include':_0x3faac7[_0xb305('0xc')]?_[_0xb305('0xb')](_0x3faac7[_0xb305('0xc')],function(_0x424e5f){return{'model':db[_0x424e5f[_0xb305('0xd')]],'as':_0x424e5f['as'],'attributes':_0x424e5f[_0xb305('0xa')],'include':_0x424e5f['include']?_[_0xb305('0xb')](_0x424e5f[_0xb305('0xc')],function(_0x23e52c){return{'model':db[_0x23e52c[_0xb305('0xd')]],'as':_0x23e52c['as'],'attributes':_0x23e52c[_0xb305('0xa')]};}):[]};}):[]};}):[]:[]})[_0xb305('0x16')](function(_0x5006db){logger['info'](_0xb305('0x6'),_0x2829e0);logger[_0xb305('0xf')](_0xb305('0x6'),_0x2829e0,JSON['stringify'](_0x5006db));_0x2e75dd(_0x5006db);})[_0xb305('0x17')](function(_0x5770ed){logger[_0xb305('0x11')]('GetCmHopper',_0x5770ed[_0xb305('0x10')],_0x2829e0);_0x19a518(_0x29629c[_0xb305('0x11')](0x1f4,_0x5770ed[_0xb305('0x10')]));});});});};exports['GetContactByPhone']=function(_0x5658ea){var _0x473dcf=this;return new Promise(function(_0x5bdbbb,_0x9eec2){return db[_0xb305('0x28')][_0xb305('0x41')]({'raw':!![],'where':{'phone':_0x5658ea[_0xb305('0x9')]['where']['phone']},'attributes':['id','dialTimezone'],'order':[['id',_0xb305('0x42')]]})[_0xb305('0x16')](function(_0x26e426){logger['info']('getContactByPhone',_0x5658ea);logger[_0xb305('0xf')](_0xb305('0x43'),_0x5658ea,JSON[_0xb305('0x1b')](_0x26e426));_0x5bdbbb(_0x26e426);})[_0xb305('0x17')](function(_0x3b68a8){logger[_0xb305('0x11')]('getContactByPhone',_0x3b68a8[_0xb305('0x10')],_0x5658ea);_0x9eec2(_0x473dcf['error'](0x1f4,_0x3b68a8[_0xb305('0x10')]));});});};exports[_0xb305('0x44')]=function(_0x1684d2){var _0x33c29e=this;return new Promise(function(_0x4e282d,_0xcc0562){return db[_0xb305('0x24')][_0xb305('0x25')](function(_0x5f3891){var _0x53f7b2=_0x1684d2[_0xb305('0x9')]&&_0x1684d2[_0xb305('0x9')][_0xb305('0x15')]?_0x1684d2[_0xb305('0x9')]['where']:{};return db[_0xb305('0x7')]['update'](_0x1684d2[_0xb305('0x1a')],{'where':_0x53f7b2,'transaction':_0x5f3891})[_0xb305('0x16')](function(_0x5aa73d){logger['info'](_0xb305('0x44'),_0x1684d2);logger[_0xb305('0xf')](_0xb305('0x44'),_0x1684d2,JSON[_0xb305('0x1b')](_0x5aa73d));_0x4e282d(_0x5aa73d);})[_0xb305('0x17')](function(_0x28a6e7){logger[_0xb305('0x11')](_0xb305('0x44'),_0x28a6e7['message'],_0x1684d2);_0xcc0562(_0x33c29e['error'](0x1f4,_0x28a6e7[_0xb305('0x10')]));});});});};exports[_0xb305('0x45')]=function(_0x50998e){var _0x236a84=this;var _0x2c2b97=_0x50998e[_0xb305('0x1a')][_0xb305('0x15')]['voiceQueueIds'];var _0x277e28=_0x50998e[_0xb305('0x1a')][_0xb305('0x15')][_0xb305('0x46')];var _0x5edac1=_0x50998e[_0xb305('0x1a')][_0xb305('0x15')][_0xb305('0x47')];return new Promise(function(_0x4b9f22,_0x29aa1c){return db[_0xb305('0x7')][_0xb305('0x8')]({'where':{'voiceQueueId':{'$in':_0x2c2b97},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xb305('0x24')]['literal'](_0xb305('0x48')+_0x277e28+_0xb305('0x49')),'$gt':db[_0xb305('0x24')]['literal'](_0xb305('0x4a'))}},'UserId':{'$in':_0x5edac1}},'include':[{'model':db[_0xb305('0x28')],'as':_0xb305('0x29')},{'model':db[_0xb305('0x2b')],'as':_0xb305('0x2c'),'attributes':['id','name','voicePause']},{'model':db['CmList'],'as':_0xb305('0x4b')}]})[_0xb305('0x16')](function(_0x394717){if(_0x394717[_0xb305('0x31')]>0x0){return db['sequelize']['transaction'](function(_0x1a2d5f){return db[_0xb305('0x7')]['update']({'recallmeNotifiedDate':db[_0xb305('0x24')][_0xb305('0x4c')](_0xb305('0x4a'))},{'where':{'id':{'$in':_[_0xb305('0xb')](_0x394717,'id')}},'transaction':_0x1a2d5f})[_0xb305('0x16')](function(){_0x4b9f22(_0x394717);})['catch'](function(_0x1e5406){logger[_0xb305('0x11')]('CmHopperHandlePreviewRecallNotifications',_0x1e5406['message'],_0x50998e);_0x29aa1c(_0x236a84[_0xb305('0x11')](0x1f4,_0x1e5406['message']));});})['catch'](function(_0x2d75c4){logger[_0xb305('0x11')](_0xb305('0x45'),_0x2d75c4['message'],_0x50998e);_0x29aa1c(_0x236a84[_0xb305('0x11')](0x1f4,_0x2d75c4[_0xb305('0x10')]));});}else{_0x4b9f22(_0x394717);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 06c916b..90b24f8 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 _0x42df=['getPreview','/timezone','getTimezone','put','/:id','update','express','Router','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','show','/:id/previewrecall','getPreviewRecall','create','post'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x42df,0x1aa));var _0xf42d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x42df[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0xf42d('0x0'));var router=express[_0xf42d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf42d('0x2'));router[_0xf42d('0x3')]('/',auth[_0xf42d('0x4')](),controller['index']);router[_0xf42d('0x3')]('/describe',auth[_0xf42d('0x4')](),controller[_0xf42d('0x5')]);router[_0xf42d('0x3')](_0xf42d('0x6'),auth['isAuthenticated'](),controller[_0xf42d('0x7')]);router[_0xf42d('0x3')](_0xf42d('0x8'),auth[_0xf42d('0x4')](),controller['getTimezones']);router[_0xf42d('0x3')]('/:id',auth[_0xf42d('0x4')](),controller[_0xf42d('0x9')]);router[_0xf42d('0x3')](_0xf42d('0xa'),auth[_0xf42d('0x4')](),controller[_0xf42d('0xb')]);router['post']('/',auth[_0xf42d('0x4')](),controller[_0xf42d('0xc')]);router[_0xf42d('0xd')]('/preview',auth[_0xf42d('0x4')](),controller[_0xf42d('0xe')]);router['post'](_0xf42d('0xf'),auth[_0xf42d('0x4')](),controller[_0xf42d('0x10')]);router[_0xf42d('0x11')](_0xf42d('0x12'),auth['isAuthenticated'](),controller[_0xf42d('0x13')]);router['delete'](_0xf42d('0x12'),auth[_0xf42d('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7654=['delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','index','/describe','isAuthenticated','get','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','create','post','getPreview','/timezone','getTimezone','/:id','update'];(function(_0x228109,_0x1acbff){var _0x16d9ae=function(_0x11c901){while(--_0x11c901){_0x228109['push'](_0x228109['shift']());}};_0x16d9ae(++_0x1acbff);}(_0x7654,0xfd));var _0x4765=function(_0x248247,_0x162355){_0x248247=_0x248247-0x0;var _0x8d6ab8=_0x7654[_0x248247];return _0x8d6ab8;};'use strict';var express=require(_0x4765('0x0'));var router=express[_0x4765('0x1')]();var auth=require(_0x4765('0x2'));var controller=require(_0x4765('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x4765('0x4')]);router['get'](_0x4765('0x5'),auth[_0x4765('0x6')](),controller['describe']);router[_0x4765('0x7')](_0x4765('0x8'),auth[_0x4765('0x6')](),controller[_0x4765('0x9')]);router[_0x4765('0x7')](_0x4765('0xa'),auth['isAuthenticated'](),controller[_0x4765('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4765('0xc')]);router[_0x4765('0x7')](_0x4765('0xd'),auth['isAuthenticated'](),controller[_0x4765('0xe')]);router['post']('/',auth[_0x4765('0x6')](),controller[_0x4765('0xf')]);router[_0x4765('0x10')]('/preview',auth[_0x4765('0x6')](),controller[_0x4765('0x11')]);router[_0x4765('0x10')](_0x4765('0x12'),auth['isAuthenticated'](),controller[_0x4765('0x13')]);router['put'](_0x4765('0x14'),auth[_0x4765('0x6')](),controller[_0x4765('0x15')]);router[_0x4765('0x16')](_0x4765('0x14'),auth['isAuthenticated'](),controller[_0x4765('0x17')]);module[_0x4765('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index a9b8b01..fa2c7c5 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 _0xf71d=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x47979c,_0x279829){var _0xda3562=function(_0x39518b){while(--_0x39518b){_0x47979c['push'](_0x47979c['shift']());}};_0xda3562(++_0x279829);}(_0xf71d,0x116));var _0xdf71=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xf71d[_0x1f36bb];return _0xaf97fa;};'use strict';var moment=require('moment');var Sequelize=require(_0xdf71('0x0'));module[_0xdf71('0x1')]={'CmHopperId':{'type':Sequelize[_0xdf71('0x2')]},'phone':{'type':Sequelize[_0xdf71('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xdf71('0x4')],'defaultValue':moment()[_0xdf71('0x5')](_0xdf71('0x6'))},'countbusyretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdf71('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6f79=['moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x170164,_0x5e4e3){var _0x3d415b=function(_0x3ac4fd){while(--_0x3ac4fd){_0x170164['push'](_0x170164['shift']());}};_0x3d415b(++_0x5e4e3);}(_0x6f79,0x162));var _0x96f7=function(_0x399fcc,_0x3085bb){_0x399fcc=_0x399fcc-0x0;var _0x1dbda0=_0x6f79[_0x399fcc];return _0x1dbda0;};'use strict';var moment=require(_0x96f7('0x0'));var Sequelize=require(_0x96f7('0x1'));module[_0x96f7('0x2')]={'CmHopperId':{'type':Sequelize[_0x96f7('0x3')]},'phone':{'type':Sequelize[_0x96f7('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x96f7('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x96f7('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x96f7('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x96f7('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x96f7('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x96f7('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x96f7('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x96f7('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x96f7('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 3bfee75..3e39c2f 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 _0x104c=['index','map','CmHopperAdditionalPhone','fieldName','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x104c,0xd1));var _0xc104=function(_0x3dd3ed,_0x22611d){_0x3dd3ed=_0x3dd3ed-0x0;var _0x260711=_0x104c[_0x3dd3ed];return _0x260711;};'use strict';var emlformat=require(_0xc104('0x0'));var rimraf=require(_0xc104('0x1'));var zipdir=require(_0xc104('0x2'));var jsonpatch=require(_0xc104('0x3'));var rp=require(_0xc104('0x4'));var moment=require(_0xc104('0x5'));var BPromise=require(_0xc104('0x6'));var Mustache=require('mustache');var util=require(_0xc104('0x7'));var path=require(_0xc104('0x8'));var sox=require('sox');var csv=require(_0xc104('0x9'));var ejs=require(_0xc104('0xa'));var fs=require('fs');var fs_extra=require(_0xc104('0xb'));var _=require(_0xc104('0xc'));var squel=require(_0xc104('0xd'));var crypto=require('crypto');var jsforce=require(_0xc104('0xe'));var deskjs=require(_0xc104('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc104('0x10'));var Papa=require(_0xc104('0x11'));var Redis=require(_0xc104('0x12'));var authService=require(_0xc104('0x13'));var qs=require(_0xc104('0x14'));var as=require(_0xc104('0x15'));var hardwareService=require(_0xc104('0x16'));var logger=require(_0xc104('0x17'))(_0xc104('0x18'));var utils=require(_0xc104('0x19'));var config=require(_0xc104('0x1a'));var licenseUtil=require(_0xc104('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239ed3,_0x30b5db){_0x30b5db=_0x30b5db||0xcc;return function(_0x483466){if(_0x483466){return _0x239ed3[_0xc104('0x1c')](_0x30b5db);}return _0x239ed3['status'](_0x30b5db)[_0xc104('0x1d')]();};}function respondWithResult(_0x4d6d62,_0x5524ea){_0x5524ea=_0x5524ea||0xc8;return function(_0x48efa6){if(_0x48efa6){return _0x4d6d62[_0xc104('0x1e')](_0x5524ea)[_0xc104('0x1f')](_0x48efa6);}};}function respondWithFilteredResult(_0x3c3f61,_0x160212){return function(_0x4db57e){if(_0x4db57e){var _0x58f45f=typeof _0x160212[_0xc104('0x20')]===_0xc104('0x21')&&typeof _0x160212[_0xc104('0x22')]===_0xc104('0x21');var _0x16d9a7=_0x4db57e[_0xc104('0x23')];var _0xff0db3=_0x58f45f?0x0:_0x160212['offset'];var _0x2eb3f3=_0x58f45f?_0x4db57e[_0xc104('0x23')]:_0x160212[_0xc104('0x20')]+_0x160212[_0xc104('0x22')];var _0x4241f3;if(_0x2eb3f3>=_0x16d9a7){_0x2eb3f3=_0x16d9a7;_0x4241f3=0xc8;}else{_0x4241f3=0xce;}_0x3c3f61['status'](_0x4241f3);return _0x3c3f61[_0xc104('0x24')]('Content-Range',_0xff0db3+'-'+_0x2eb3f3+'/'+_0x16d9a7)[_0xc104('0x1f')](_0x4db57e);}return null;};}function patchUpdates(_0x1284c5){return function(_0x417290){try{jsonpatch[_0xc104('0x25')](_0x417290,_0x1284c5,!![]);}catch(_0x1dc144){return BPromise['reject'](_0x1dc144);}return _0x417290[_0xc104('0x26')]();};}function saveUpdates(_0x4633e2,_0x227ce9){return function(_0x2b27e3){if(_0x2b27e3){return _0x2b27e3[_0xc104('0x27')](_0x4633e2)[_0xc104('0x28')](function(_0xd58e56){return _0xd58e56;});}return null;};}function removeEntity(_0x3e508f,_0x287157){return function(_0x3d0651){if(_0x3d0651){return _0x3d0651[_0xc104('0x29')]()[_0xc104('0x28')](function(){var _0x2d5b5a=_0x3d0651['get']({'plain':!![]});var _0x416640=_0xc104('0x2a');return db[_0xc104('0x2b')][_0xc104('0x29')]({'where':{'type':_0x416640,'resourceId':_0x2d5b5a['id']}})['then'](function(){return _0x3d0651;});})[_0xc104('0x28')](function(){_0x3e508f[_0xc104('0x1e')](0xcc)[_0xc104('0x1d')]();});}};}function handleEntityNotFound(_0x3f830f,_0xcf6bbe){return function(_0x1eeeff){if(!_0x1eeeff){_0x3f830f[_0xc104('0x1c')](0x194);}return _0x1eeeff;};}function handleError(_0x1b5cf6,_0x4df7d0){_0x4df7d0=_0x4df7d0||0x1f4;return function(_0x530422){logger[_0xc104('0x2c')](_0x530422['stack']);if(_0x530422[_0xc104('0x2d')]){delete _0x530422[_0xc104('0x2d')];}_0x1b5cf6[_0xc104('0x1e')](_0x4df7d0)['send'](_0x530422);};}exports[_0xc104('0x2e')]=function(_0x246e1e,_0x112371){var _0x24c943={},_0x1c1a9d={},_0xf21bdc={'count':0x0,'rows':[]};var _0x165031=_[_0xc104('0x2f')](db[_0xc104('0x30')]['rawAttributes'],function(_0x4cf106){return{'name':_0x4cf106[_0xc104('0x31')],'type':_0x4cf106['type']['key']};});_0x1c1a9d[_0xc104('0x32')]=_[_0xc104('0x2f')](_0x165031,_0xc104('0x2d'));_0x1c1a9d[_0xc104('0x33')]=_[_0xc104('0x34')](_0x246e1e[_0xc104('0x33')]);_0x1c1a9d['filters']=_['intersection'](_0x1c1a9d[_0xc104('0x32')],_0x1c1a9d[_0xc104('0x33')]);_0x24c943[_0xc104('0x35')]=_[_0xc104('0x36')](_0x1c1a9d[_0xc104('0x32')],qs[_0xc104('0x37')](_0x246e1e[_0xc104('0x33')][_0xc104('0x37')]));_0x24c943[_0xc104('0x35')]=_0x24c943[_0xc104('0x35')][_0xc104('0x38')]?_0x24c943[_0xc104('0x35')]:_0x1c1a9d[_0xc104('0x32')];if(!_0x246e1e[_0xc104('0x33')]['hasOwnProperty'](_0xc104('0x39'))){_0x24c943['limit']=qs['limit'](_0x246e1e[_0xc104('0x33')][_0xc104('0x22')]);_0x24c943[_0xc104('0x20')]=qs[_0xc104('0x20')](_0x246e1e['query'][_0xc104('0x20')]);}_0x24c943[_0xc104('0x3a')]=qs[_0xc104('0x3b')](_0x246e1e[_0xc104('0x33')][_0xc104('0x3b')]);_0x24c943[_0xc104('0x3c')]=qs[_0xc104('0x3d')](_[_0xc104('0x3e')](_0x246e1e['query'],_0x1c1a9d[_0xc104('0x3d')]),_0x165031);if(_0x246e1e[_0xc104('0x33')][_0xc104('0x3f')]){_0x24c943[_0xc104('0x3c')]=_['merge'](_0x24c943[_0xc104('0x3c')],{'$or':_[_0xc104('0x2f')](_0x165031,function(_0x158ca2){if(_0x158ca2['type']!==_0xc104('0x40')){var _0x8b27b5={};_0x8b27b5[_0x158ca2[_0xc104('0x2d')]]={'$like':'%'+_0x246e1e['query'][_0xc104('0x3f')]+'%'};return _0x8b27b5;}})});}_0x24c943=_[_0xc104('0x41')]({},_0x24c943,_0x246e1e['options']);var _0x348aba={'where':_0x24c943[_0xc104('0x3c')]};return db[_0xc104('0x30')][_0xc104('0x23')](_0x348aba)[_0xc104('0x28')](function(_0x54c14a){_0xf21bdc[_0xc104('0x23')]=_0x54c14a;if(_0x246e1e['query'][_0xc104('0x42')]){_0x24c943[_0xc104('0x43')]=[{'all':!![]}];}return db[_0xc104('0x30')][_0xc104('0x44')](_0x24c943);})['then'](function(_0x53e2c3){_0xf21bdc[_0xc104('0x45')]=_0x53e2c3;return _0xf21bdc;})['then'](respondWithFilteredResult(_0x112371,_0x24c943))[_0xc104('0x46')](handleError(_0x112371,null));};exports[_0xc104('0x47')]=function(_0x4df6a7,_0x4a98fa){var _0x5473e3={'raw':!![],'where':{'id':_0x4df6a7[_0xc104('0x48')]['id']}},_0x2b79e0={};_0x2b79e0[_0xc104('0x32')]=_[_0xc104('0x34')](db[_0xc104('0x30')][_0xc104('0x49')]);_0x2b79e0['query']=_['keys'](_0x4df6a7[_0xc104('0x33')]);_0x2b79e0[_0xc104('0x3d')]=_[_0xc104('0x36')](_0x2b79e0[_0xc104('0x32')],_0x2b79e0['query']);_0x5473e3[_0xc104('0x35')]=_[_0xc104('0x36')](_0x2b79e0[_0xc104('0x32')],qs['fields'](_0x4df6a7[_0xc104('0x33')][_0xc104('0x37')]));_0x5473e3['attributes']=_0x5473e3[_0xc104('0x35')][_0xc104('0x38')]?_0x5473e3['attributes']:_0x2b79e0[_0xc104('0x32')];if(_0x4df6a7[_0xc104('0x33')][_0xc104('0x42')]){_0x5473e3[_0xc104('0x43')]=[{'all':!![]}];}_0x5473e3=_['merge']({},_0x5473e3,_0x4df6a7[_0xc104('0x4a')]);return db[_0xc104('0x30')]['find'](_0x5473e3)[_0xc104('0x28')](handleEntityNotFound(_0x4a98fa,null))[_0xc104('0x28')](respondWithResult(_0x4a98fa,null))['catch'](handleError(_0x4a98fa,null));};exports[_0xc104('0x4b')]=function(_0x10fc54,_0x323754){return db[_0xc104('0x30')][_0xc104('0x4b')](_0x10fc54[_0xc104('0x4c')],{})[_0xc104('0x28')](function(_0x2c6955){var _0x4f3407=_0x10fc54[_0xc104('0x4d')][_0xc104('0x4e')]({'plain':!![]});if(!_0x4f3407)throw new Error(_0xc104('0x4f'));if(_0x4f3407[_0xc104('0x50')]==='user'){var _0x5c7851=_0x2c6955[_0xc104('0x4e')]({'plain':!![]});var _0x21917c='CmHopperAdditionalPhones';return db[_0xc104('0x51')][_0xc104('0x52')]({'where':{'name':_0x21917c,'userProfileId':_0x4f3407[_0xc104('0x53')]},'raw':!![]})[_0xc104('0x28')](function(_0x5b2143){if(_0x5b2143&&_0x5b2143['autoAssociation']===0x0){return db[_0xc104('0x2b')]['create']({'name':_0x5c7851['name'],'resourceId':_0x5c7851['id'],'type':_0x5b2143[_0xc104('0x2d')],'sectionId':_0x5b2143['id']},{})[_0xc104('0x28')](function(){return _0x2c6955;});}else{return _0x2c6955;}})[_0xc104('0x46')](function(_0x185066){logger[_0xc104('0x2c')](_0xc104('0x54'),_0x185066);throw _0x185066;});}return _0x2c6955;})[_0xc104('0x28')](respondWithResult(_0x323754,0xc9))[_0xc104('0x46')](handleError(_0x323754,null));};exports[_0xc104('0x27')]=function(_0x163a6b,_0x156a5e){if(_0x163a6b[_0xc104('0x4c')]['id']){delete _0x163a6b['body']['id'];}return db[_0xc104('0x30')]['find']({'where':{'id':_0x163a6b[_0xc104('0x48')]['id']}})[_0xc104('0x28')](handleEntityNotFound(_0x156a5e,null))['then'](saveUpdates(_0x163a6b[_0xc104('0x4c')],null))[_0xc104('0x28')](respondWithResult(_0x156a5e,null))[_0xc104('0x46')](handleError(_0x156a5e,null));};exports[_0xc104('0x29')]=function(_0x2bf1ee,_0x3a35da){return db['CmHopperAdditionalPhone'][_0xc104('0x52')]({'where':{'id':_0x2bf1ee['params']['id']}})['then'](handleEntityNotFound(_0x3a35da,null))['then'](removeEntity(_0x3a35da,null))['catch'](handleError(_0x3a35da,null));}; \ No newline at end of file +var _0x7405=['key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type'];(function(_0x139c04,_0x5e4cdb){var _0x5407e4=function(_0x2c4d1b){while(--_0x2c4d1b){_0x139c04['push'](_0x139c04['shift']());}};_0x5407e4(++_0x5e4cdb);}(_0x7405,0x1e1));var _0x5740=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0x7405[_0x2e04ef];return _0x5722b0;};'use strict';var emlformat=require(_0x5740('0x0'));var rimraf=require(_0x5740('0x1'));var zipdir=require(_0x5740('0x2'));var jsonpatch=require(_0x5740('0x3'));var rp=require(_0x5740('0x4'));var moment=require(_0x5740('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5740('0x6'));var util=require(_0x5740('0x7'));var path=require(_0x5740('0x8'));var sox=require(_0x5740('0x9'));var csv=require(_0x5740('0xa'));var ejs=require(_0x5740('0xb'));var fs=require('fs');var fs_extra=require(_0x5740('0xc'));var _=require(_0x5740('0xd'));var squel=require(_0x5740('0xe'));var crypto=require('crypto');var jsforce=require(_0x5740('0xf'));var deskjs=require(_0x5740('0x10'));var toCsv=require(_0x5740('0xa'));var querystring=require(_0x5740('0x11'));var Papa=require(_0x5740('0x12'));var Redis=require(_0x5740('0x13'));var authService=require(_0x5740('0x14'));var qs=require(_0x5740('0x15'));var as=require(_0x5740('0x16'));var hardwareService=require(_0x5740('0x17'));var logger=require(_0x5740('0x18'))(_0x5740('0x19'));var utils=require(_0x5740('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x5740('0x1b'));var db=require(_0x5740('0x1c'))['db'];function respondWithStatusCode(_0x2e5adf,_0xe96e9e){_0xe96e9e=_0xe96e9e||0xcc;return function(_0x43990a){if(_0x43990a){return _0x2e5adf['sendStatus'](_0xe96e9e);}return _0x2e5adf[_0x5740('0x1d')](_0xe96e9e)[_0x5740('0x1e')]();};}function respondWithResult(_0x46257d,_0x4ea7ef){_0x4ea7ef=_0x4ea7ef||0xc8;return function(_0x280040){if(_0x280040){return _0x46257d['status'](_0x4ea7ef)['json'](_0x280040);}};}function respondWithFilteredResult(_0x83a3a6,_0x29373b){return function(_0x70b12e){if(_0x70b12e){var _0x5cf67e=typeof _0x29373b[_0x5740('0x1f')]===_0x5740('0x20')&&typeof _0x29373b[_0x5740('0x21')]===_0x5740('0x20');var _0x55d76a=_0x70b12e[_0x5740('0x22')];var _0x47b5df=_0x5cf67e?0x0:_0x29373b['offset'];var _0x12f931=_0x5cf67e?_0x70b12e[_0x5740('0x22')]:_0x29373b[_0x5740('0x1f')]+_0x29373b[_0x5740('0x21')];var _0x3f5582;if(_0x12f931>=_0x55d76a){_0x12f931=_0x55d76a;_0x3f5582=0xc8;}else{_0x3f5582=0xce;}_0x83a3a6['status'](_0x3f5582);return _0x83a3a6[_0x5740('0x23')](_0x5740('0x24'),_0x47b5df+'-'+_0x12f931+'/'+_0x55d76a)[_0x5740('0x25')](_0x70b12e);}return null;};}function patchUpdates(_0x11a2a7){return function(_0x5e1edc){try{jsonpatch[_0x5740('0x26')](_0x5e1edc,_0x11a2a7,!![]);}catch(_0x550297){return BPromise[_0x5740('0x27')](_0x550297);}return _0x5e1edc[_0x5740('0x28')]();};}function saveUpdates(_0x4b5d08,_0x4dec5d){return function(_0x4fcf8a){if(_0x4fcf8a){return _0x4fcf8a['update'](_0x4b5d08)[_0x5740('0x29')](function(_0xc657c6){return _0xc657c6;});}return null;};}function removeEntity(_0x76c1d7,_0x3c1ad2){return function(_0x258f5e){if(_0x258f5e){return _0x258f5e[_0x5740('0x2a')]()[_0x5740('0x29')](function(){var _0x4ac223=_0x258f5e['get']({'plain':!![]});var _0x329985=_0x5740('0x2b');return db[_0x5740('0x2c')][_0x5740('0x2a')]({'where':{'type':_0x329985,'resourceId':_0x4ac223['id']}})['then'](function(){return _0x258f5e;});})[_0x5740('0x29')](function(){_0x76c1d7[_0x5740('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4254b1,_0x5a0dfa){return function(_0x52262d){if(!_0x52262d){_0x4254b1['sendStatus'](0x194);}return _0x52262d;};}function handleError(_0x1a527c,_0x3324dd){_0x3324dd=_0x3324dd||0x1f4;return function(_0x2d3fda){logger['error'](_0x2d3fda[_0x5740('0x2d')]);if(_0x2d3fda[_0x5740('0x2e')]){delete _0x2d3fda[_0x5740('0x2e')];}_0x1a527c[_0x5740('0x1d')](_0x3324dd)[_0x5740('0x2f')](_0x2d3fda);};}exports[_0x5740('0x30')]=function(_0x4a93cd,_0x38541f){var _0x35cbd7={},_0x4e239d={},_0x37165f={'count':0x0,'rows':[]};var _0x582660=_['map'](db[_0x5740('0x31')][_0x5740('0x32')],function(_0x25b1bb){return{'name':_0x25b1bb[_0x5740('0x33')],'type':_0x25b1bb[_0x5740('0x34')][_0x5740('0x35')]};});_0x4e239d[_0x5740('0x36')]=_[_0x5740('0x37')](_0x582660,_0x5740('0x2e'));_0x4e239d[_0x5740('0x38')]=_[_0x5740('0x39')](_0x4a93cd[_0x5740('0x38')]);_0x4e239d[_0x5740('0x3a')]=_['intersection'](_0x4e239d[_0x5740('0x36')],_0x4e239d[_0x5740('0x38')]);_0x35cbd7[_0x5740('0x3b')]=_[_0x5740('0x3c')](_0x4e239d[_0x5740('0x36')],qs[_0x5740('0x3d')](_0x4a93cd[_0x5740('0x38')][_0x5740('0x3d')]));_0x35cbd7[_0x5740('0x3b')]=_0x35cbd7['attributes'][_0x5740('0x3e')]?_0x35cbd7[_0x5740('0x3b')]:_0x4e239d[_0x5740('0x36')];if(!_0x4a93cd[_0x5740('0x38')][_0x5740('0x3f')](_0x5740('0x40'))){_0x35cbd7[_0x5740('0x21')]=qs[_0x5740('0x21')](_0x4a93cd['query'][_0x5740('0x21')]);_0x35cbd7[_0x5740('0x1f')]=qs[_0x5740('0x1f')](_0x4a93cd['query'][_0x5740('0x1f')]);}_0x35cbd7['order']=qs[_0x5740('0x41')](_0x4a93cd[_0x5740('0x38')][_0x5740('0x41')]);_0x35cbd7[_0x5740('0x42')]=qs[_0x5740('0x3a')](_[_0x5740('0x43')](_0x4a93cd[_0x5740('0x38')],_0x4e239d[_0x5740('0x3a')]),_0x582660);if(_0x4a93cd[_0x5740('0x38')]['filter']){_0x35cbd7[_0x5740('0x42')]=_[_0x5740('0x44')](_0x35cbd7[_0x5740('0x42')],{'$or':_['map'](_0x582660,function(_0x502854){if(_0x502854[_0x5740('0x34')]!==_0x5740('0x45')){var _0x2f0b55={};_0x2f0b55[_0x502854[_0x5740('0x2e')]]={'$like':'%'+_0x4a93cd[_0x5740('0x38')][_0x5740('0x46')]+'%'};return _0x2f0b55;}})});}_0x35cbd7=_[_0x5740('0x44')]({},_0x35cbd7,_0x4a93cd[_0x5740('0x47')]);var _0x29d1e1={'where':_0x35cbd7[_0x5740('0x42')]};return db['CmHopperAdditionalPhone'][_0x5740('0x22')](_0x29d1e1)[_0x5740('0x29')](function(_0x149821){_0x37165f[_0x5740('0x22')]=_0x149821;if(_0x4a93cd['query']['includeAll']){_0x35cbd7['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x5740('0x48')](_0x35cbd7);})[_0x5740('0x29')](function(_0x29a4f8){_0x37165f['rows']=_0x29a4f8;return _0x37165f;})['then'](respondWithFilteredResult(_0x38541f,_0x35cbd7))[_0x5740('0x49')](handleError(_0x38541f,null));};exports[_0x5740('0x4a')]=function(_0x4a02a9,_0x310f14){var _0x420a72={'raw':!![],'where':{'id':_0x4a02a9[_0x5740('0x4b')]['id']}},_0x20e40b={};_0x20e40b[_0x5740('0x36')]=_[_0x5740('0x39')](db[_0x5740('0x31')][_0x5740('0x32')]);_0x20e40b[_0x5740('0x38')]=_[_0x5740('0x39')](_0x4a02a9['query']);_0x20e40b[_0x5740('0x3a')]=_[_0x5740('0x3c')](_0x20e40b[_0x5740('0x36')],_0x20e40b['query']);_0x420a72[_0x5740('0x3b')]=_[_0x5740('0x3c')](_0x20e40b['model'],qs['fields'](_0x4a02a9[_0x5740('0x38')]['fields']));_0x420a72[_0x5740('0x3b')]=_0x420a72[_0x5740('0x3b')][_0x5740('0x3e')]?_0x420a72['attributes']:_0x20e40b['model'];if(_0x4a02a9['query'][_0x5740('0x4c')]){_0x420a72[_0x5740('0x4d')]=[{'all':!![]}];}_0x420a72=_['merge']({},_0x420a72,_0x4a02a9['options']);return db[_0x5740('0x31')]['find'](_0x420a72)[_0x5740('0x29')](handleEntityNotFound(_0x310f14,null))[_0x5740('0x29')](respondWithResult(_0x310f14,null))[_0x5740('0x49')](handleError(_0x310f14,null));};exports[_0x5740('0x4e')]=function(_0x4c5c94,_0x4e045d){return db[_0x5740('0x31')]['create'](_0x4c5c94[_0x5740('0x4f')],{})[_0x5740('0x29')](function(_0x514bf2){var _0xe0e1bb=_0x4c5c94['user'][_0x5740('0x50')]({'plain':!![]});if(!_0xe0e1bb)throw new Error(_0x5740('0x51'));if(_0xe0e1bb['role']===_0x5740('0x52')){var _0x35a466=_0x514bf2['get']({'plain':!![]});var _0x515d9a=_0x5740('0x2b');return db[_0x5740('0x53')][_0x5740('0x54')]({'where':{'name':_0x515d9a,'userProfileId':_0xe0e1bb[_0x5740('0x55')]},'raw':!![]})[_0x5740('0x29')](function(_0x5c4041){if(_0x5c4041&&_0x5c4041[_0x5740('0x56')]===0x0){return db[_0x5740('0x2c')]['create']({'name':_0x35a466[_0x5740('0x2e')],'resourceId':_0x35a466['id'],'type':_0x5c4041['name'],'sectionId':_0x5c4041['id']},{})['then'](function(){return _0x514bf2;});}else{return _0x514bf2;}})[_0x5740('0x49')](function(_0xc45f3){logger['error'](_0x5740('0x57'),_0xc45f3);throw _0xc45f3;});}return _0x514bf2;})[_0x5740('0x29')](respondWithResult(_0x4e045d,0xc9))[_0x5740('0x49')](handleError(_0x4e045d,null));};exports[_0x5740('0x58')]=function(_0x4328c7,_0x36c026){if(_0x4328c7[_0x5740('0x4f')]['id']){delete _0x4328c7[_0x5740('0x4f')]['id'];}return db[_0x5740('0x31')][_0x5740('0x54')]({'where':{'id':_0x4328c7[_0x5740('0x4b')]['id']}})[_0x5740('0x29')](handleEntityNotFound(_0x36c026,null))['then'](saveUpdates(_0x4328c7[_0x5740('0x4f')],null))[_0x5740('0x29')](respondWithResult(_0x36c026,null))[_0x5740('0x49')](handleError(_0x36c026,null));};exports['destroy']=function(_0x2ea82a,_0x1bec7e){return db[_0x5740('0x31')][_0x5740('0x54')]({'where':{'id':_0x2ea82a[_0x5740('0x4b')]['id']}})[_0x5740('0x29')](handleEntityNotFound(_0x1bec7e,null))[_0x5740('0x29')](removeEntity(_0x1bec7e,null))[_0x5740('0x49')](handleError(_0x1bec7e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index ea4a7ef..1a5282f 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 _0x7b68=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x18830d,_0x31f95e){var _0x50ff0d=function(_0x5e2fc5){while(--_0x5e2fc5){_0x18830d['push'](_0x18830d['shift']());}};_0x50ff0d(++_0x31f95e);}(_0x7b68,0x1e7));var _0x87b6=function(_0x34c45a,_0x3dd983){_0x34c45a=_0x34c45a-0x0;var _0x5d5c50=_0x7b68[_0x34c45a];return _0x5d5c50;};'use strict';var _=require(_0x87b6('0x0'));var util=require(_0x87b6('0x1'));var logger=require(_0x87b6('0x2'))(_0x87b6('0x3'));var moment=require(_0x87b6('0x4'));var BPromise=require(_0x87b6('0x5'));var rp=require(_0x87b6('0x6'));var fs=require('fs');var path=require(_0x87b6('0x7'));var rimraf=require(_0x87b6('0x8'));var config=require(_0x87b6('0x9'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x87b6('0xa')]=function(_0x2623d2,_0x163d28){return _0x2623d2[_0x87b6('0xb')](_0x87b6('0xc'),attributes,{'tableName':_0x87b6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x991e=['CmHopperAdditionalPhone','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3b3f90,_0x388364){var _0x52522e=function(_0x86729e){while(--_0x86729e){_0x3b3f90['push'](_0x3b3f90['shift']());}};_0x52522e(++_0x388364);}(_0x991e,0x6f));var _0xe991=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x991e[_0x40220a];return _0x3903cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe991('0x0'))(_0xe991('0x1'));var moment=require(_0xe991('0x2'));var BPromise=require('bluebird');var rp=require(_0xe991('0x3'));var fs=require('fs');var path=require(_0xe991('0x4'));var rimraf=require(_0xe991('0x5'));var config=require(_0xe991('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xe991('0x7')]=function(_0x47ac8b,_0x2be4f4){return _0x47ac8b[_0xe991('0x8')](_0xe991('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','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 9144b39..be91f8b 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 _0x34be=['transaction','update','activateAdditionalPhone','field','lodash','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','CmHopper','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt'];(function(_0xaf44f6,_0x38bb85){var _0x5aadda=function(_0x297a94){while(--_0x297a94){_0xaf44f6['push'](_0xaf44f6['shift']());}};_0x5aadda(++_0x38bb85);}(_0x34be,0x177));var _0xe34b=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x34be[_0x1305e3];return _0x1068e9;};'use strict';var _=require(_0xe34b('0x0'));var util=require('util');var moment=require(_0xe34b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe34b('0x2'));var db=require(_0xe34b('0x3'))['db'];var utils=require(_0xe34b('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe34b('0x5'));var client=jayson[_0xe34b('0x6')][_0xe34b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28fce3,_0xa9a6dc,_0x4c6442){return new BPromise(function(_0xd2b6ea,_0x469da9){return client['request'](_0x28fce3,_0x4c6442)[_0xe34b('0x8')](function(_0x33f6ed){logger['info'](_0xe34b('0x9'),_0xa9a6dc,_0xe34b('0xa'));logger['debug'](_0xe34b('0xb'),_0xa9a6dc,_0xe34b('0xa'),JSON[_0xe34b('0xc')](_0x33f6ed));if(_0x33f6ed[_0xe34b('0xd')]){if(_0x33f6ed[_0xe34b('0xd')][_0xe34b('0xe')]===0x1f4){logger[_0xe34b('0xd')](_0xe34b('0x9'),_0xa9a6dc,_0x33f6ed['error'][_0xe34b('0xf')]);return _0x469da9(_0x33f6ed['error']['message']);}logger[_0xe34b('0xd')](_0xe34b('0x9'),_0xa9a6dc,_0x33f6ed['error'][_0xe34b('0xf')]);return _0xd2b6ea(_0x33f6ed[_0xe34b('0xd')][_0xe34b('0xf')]);}else{logger[_0xe34b('0x10')](_0xe34b('0x9'),_0xa9a6dc,_0xe34b('0xa'));_0xd2b6ea(_0x33f6ed['result'][_0xe34b('0xf')]);}})[_0xe34b('0x11')](function(_0x35bf72){logger[_0xe34b('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xa9a6dc,_0x35bf72);_0x469da9(_0x35bf72);});});}exports[_0xe34b('0x12')]=function(_0x257012){var _0x5d2491=this;return new Promise(function(_0x152eec,_0x54819f){return db['CmHopper'][_0xe34b('0x13')]({'raw':!![],'where':{'ContactId':_0x257012[_0xe34b('0x14')][_0xe34b('0x15')],'ListId':_0x257012['body'][_0xe34b('0x16')],'VoiceQueueId':_0x257012[_0xe34b('0x14')]['VoiceQueueId']===undefined?null:_0x257012[_0xe34b('0x14')][_0xe34b('0x17')],'CampaignId':_0x257012[_0xe34b('0x14')][_0xe34b('0x18')]===undefined?null:_0x257012[_0xe34b('0x14')][_0xe34b('0x18')]}})['then'](function(_0x1161e5){if(_0x1161e5!=null){return db[_0xe34b('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1161e5['id'],'OrderBy':{'$gt':_0x1161e5[_0xe34b('0x1a')]}},'order':[[_0xe34b('0x1a'),_0xe34b('0x1b')]]})[_0xe34b('0x8')](function(_0x24bdf4){var _0x4bb811=0x0;if(_0x24bdf4){if(_0x24bdf4[_0xe34b('0x1c')]+_0x24bdf4[_0xe34b('0x1d')]+_0x24bdf4[_0xe34b('0x1e')]+_0x24bdf4[_0xe34b('0x1f')]+_0x24bdf4[_0xe34b('0x20')]+_0x24bdf4[_0xe34b('0x21')]+_0x24bdf4[_0xe34b('0x22')]+_0x24bdf4[_0xe34b('0x23')]<_0x257012[_0xe34b('0x24')][_0xe34b('0x25')])_0x4bb811=0x1;_0x152eec({'additional':_0x4bb811});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1161e5['id']},'order':[['OrderBy',_0xe34b('0x1b')]]})[_0xe34b('0x8')](function(_0x1be7e2){var _0x4f36b4=0x0;if(_0x1be7e2){if(_0x1be7e2[_0xe34b('0x1c')]+_0x1be7e2[_0xe34b('0x1d')]+_0x1be7e2[_0xe34b('0x1e')]+_0x1be7e2[_0xe34b('0x1f')]+_0x1be7e2['countdropretry']+_0x1be7e2[_0xe34b('0x21')]+_0x1be7e2[_0xe34b('0x22')]+_0x1be7e2[_0xe34b('0x23')]<_0x257012[_0xe34b('0x24')][_0xe34b('0x25')])_0x4f36b4=0x1;_0x152eec({'additional':_0x4f36b4});}else{_0x152eec({'additional':0x0});}})[_0xe34b('0x11')](function(_0x5180be){logger[_0xe34b('0xd')](_0xe34b('0x12'),_0x5180be[_0xe34b('0xf')]);_0x54819f(_0x5d2491['error'](0x1f4,_0x5180be[_0xe34b('0xf')]));});}})['catch'](function(_0x27a2e8){logger['error'](_0xe34b('0x12'),_0x27a2e8[_0xe34b('0xf')]);_0x54819f(_0x5d2491['error'](0x1f4,_0x27a2e8[_0xe34b('0xf')]));});}else _0x152eec({'additional':0x0});});});};exports[_0xe34b('0x26')]=function(_0x4d70ee){var _0x1aded6=this;return new Promise(function(_0x2182e5,_0x32dc76){return db[_0xe34b('0x27')][_0xe34b('0x13')]({'raw':!![],'where':{'ContactId':_0x4d70ee[_0xe34b('0x14')]['ContactId'],'ListId':_0x4d70ee[_0xe34b('0x14')][_0xe34b('0x16')],'VoiceQueueId':_0x4d70ee[_0xe34b('0x14')]['VoiceQueueId']===undefined?null:_0x4d70ee[_0xe34b('0x14')][_0xe34b('0x17')],'CampaignId':_0x4d70ee['body'][_0xe34b('0x18')]===undefined?null:_0x4d70ee[_0xe34b('0x14')][_0xe34b('0x18')]}})[_0xe34b('0x8')](function(_0x9722eb){if(_0x9722eb!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x9722eb['id'],'OrderBy':{'$gte':_0x9722eb[_0xe34b('0x1a')]}},'order':[[_0xe34b('0x1a'),_0xe34b('0x1b')]]})[_0xe34b('0x8')](function(_0x360808){if(_0x360808)return activateAdditionalPhone(_0x9722eb,_0x4d70ee[_0xe34b('0x14')],_0x360808,_0x4d70ee[_0xe34b('0x28')],_0x4d70ee[_0xe34b('0x29')])[_0xe34b('0x8')](function(_0x24c057){_0x2182e5(_0x24c057);});else{return db[_0xe34b('0x19')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x9722eb['id']},'order':[['OrderBy',_0xe34b('0x1b')]]})[_0xe34b('0x8')](function(_0x5acbd3){if(_0x5acbd3)return activateAdditionalPhone(_0x9722eb,_0x4d70ee[_0xe34b('0x14')],_0x5acbd3,_0x4d70ee['duration'],_0x4d70ee['waitTime'])[_0xe34b('0x8')](function(_0x2b3c60){_0x2182e5(_0x2b3c60);});else{_0x2182e5({'id':_0x9722eb['id'],'phone':''});}})[_0xe34b('0x11')](function(_0x46057d){logger[_0xe34b('0xd')]('VerifyAdditionalPhones',_0x46057d[_0xe34b('0xf')]);_0x32dc76(_0x1aded6[_0xe34b('0xd')](0x1f4,_0x46057d['message']));});}})[_0xe34b('0x11')](function(_0x36ab2e){logger[_0xe34b('0xd')](_0xe34b('0x12'),_0x36ab2e['message']);_0x32dc76(_0x1aded6[_0xe34b('0xd')](0x1f4,_0x36ab2e[_0xe34b('0xf')]));});}else _0x2182e5(0x1);});});};function activateAdditionalPhone(_0x233069,_0x2193fc,_0x2f2703,_0xec0d31,_0x560f20){return new Promise(function(_0x3ccd07,_0x107db6){var _0x3d2c77;if(_['isNil'](_0x2f2703[_0xe34b('0x2a')])){_0x2f2703[_0xe34b('0x2a')]=moment();}if(moment()>moment(_0x2f2703['scheduledat'])){_0x3d2c77=moment()[_0xe34b('0x2b')](_0x560f20||0x3,'minutes');}else{if(_0x2f2703[_0xe34b('0x1a')]==0x0){_0x3d2c77=moment(_0x2f2703[_0xe34b('0x2a')]);}else{_0x3d2c77=moment()['add'](_0x560f20||0x3,_0xe34b('0x2c'));}}if(_[_0xe34b('0x2d')](_0x3d2c77)){_0x3d2c77=moment()[_0xe34b('0x2b')](_0x560f20||0x3,_0xe34b('0x2c'));}var _0xaa2e94={'phone':_0x233069[_0xe34b('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x233069[_0xe34b('0x1a')])?0x0:_0x233069[_0xe34b('0x1a')],'scheduledat':moment()[_0xe34b('0x2b')](_0xec0d31||0x1,_0xe34b('0x2c')),'countbusyretry':_0x2193fc['countbusyretry'],'countcongestionretry':_0x2193fc[_0xe34b('0x1d')],'countnoanswerretry':_0x2193fc['countnoanswerretry'],'countnosuchnumberretry':_0x2193fc[_0xe34b('0x1f')],'countdropretry':_0x2193fc[_0xe34b('0x20')],'countabandonedretry':_0x2193fc[_0xe34b('0x21')],'countmachineretry':_0x2193fc[_0xe34b('0x22')],'countagentrejectretry':_0x2193fc['countagentrejectretry'],'createdAt':_0x2193fc[_0xe34b('0x2f')],'updatedAt':_0x2193fc[_0xe34b('0x30')]};var _0xd655c1={'CmHopperId':_0x233069['id'],'phone':_0x2f2703[_0xe34b('0x2e')],'active':0x0,'OrderBy':_[_0xe34b('0x2d')](_0x2f2703[_0xe34b('0x1a')])?0x0:_0x2f2703['OrderBy'],'scheduledat':_0x3d2c77,'countbusyretry':_0x2f2703[_0xe34b('0x1c')],'countcongestionretry':_0x2f2703['countcongestionretry'],'countnoanswerretry':_0x2f2703['countnoanswerretry'],'countnosuchnumberretry':_0x2f2703[_0xe34b('0x1f')],'countdropretry':_0x2f2703[_0xe34b('0x20')],'countabandonedretry':_0x2f2703['countabandonedretry'],'countmachineretry':_0x2f2703[_0xe34b('0x22')],'countagentrejectretry':_0x2f2703[_0xe34b('0x23')],'createdAt':_0x2f2703['createdAt'],'updatedAt':_0x2f2703['updatedAt']};return db['sequelize'][_0xe34b('0x31')](function(_0x4cf3fe){return db[_0xe34b('0x19')][_0xe34b('0x32')](_0xaa2e94,{'where':{'id':_0x2f2703['id']}},{'transaction':_0x4cf3fe})[_0xe34b('0x8')](function(){return db[_0xe34b('0x27')][_0xe34b('0x32')](_0xd655c1,{'where':{'id':_0x233069['id']}},{'transaction':_0x4cf3fe});});})[_0xe34b('0x8')](function(_0x5e7aed){_0x3ccd07({'id':_0x233069['id'],'phone':_0x2f2703[_0xe34b('0x2e')]});})['catch'](function(_0x37f15e){logger[_0xe34b('0xd')](_0xe34b('0x33'),_0x37f15e['message']);_0x107db6({'error':_0x37f15e[_0xe34b('0xf')]});});});}exports['IncrementPreviewCounters']=function(_0x2b91bb){var _0x1f37d9=this;return new Promise(function(_0x2c9698,_0x3f5ab1){return db[_0xe34b('0x27')][_0xe34b('0x32')](_0x2b91bb[_0xe34b('0x14')][_0xe34b('0x34')],{'where':{'id':_0x2b91bb[_0xe34b('0x14')]['id']}})[_0xe34b('0x8')](function(_0x7ca739){_0x2c9698(_0x7ca739);})[_0xe34b('0x11')](function(_0x21651a){logger[_0xe34b('0xd')]('IncrementPreviewCounters',_0x21651a[_0xe34b('0xf')]);_0x3f5ab1(_0x1f37d9[_0xe34b('0xd')](0x1f4,_0x21651a[_0xe34b('0xf')]));});});}; \ No newline at end of file +var _0x9c1e=['request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopper','findOne','ContactId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countcongestionretry','catch','VerifyAdditionalPhones','SwapAdditionalPhones','ListId','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s'];(function(_0x270e46,_0x122174){var _0x18ca4e=function(_0x5c1a81){while(--_0x5c1a81){_0x270e46['push'](_0x270e46['shift']());}};_0x18ca4e(++_0x122174);}(_0x9c1e,0x153));var _0xe9c1=function(_0x1601d9,_0x1933c2){_0x1601d9=_0x1601d9-0x0;var _0x2e4cc1=_0x9c1e[_0x1601d9];return _0x2e4cc1;};'use strict';var _=require(_0xe9c1('0x0'));var util=require(_0xe9c1('0x1'));var moment=require(_0xe9c1('0x2'));var BPromise=require(_0xe9c1('0x3'));var rs=require(_0xe9c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9c1('0x5'))['db'];var utils=require(_0xe9c1('0x6'));var logger=require('../../config/logger')(_0xe9c1('0x7'));var config=require(_0xe9c1('0x8'));var jayson=require(_0xe9c1('0x9'));var client=jayson[_0xe9c1('0xa')][_0xe9c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dae78,_0x3c181b,_0x3c0520){return new BPromise(function(_0x5d4c27,_0x288d4e){return client[_0xe9c1('0xc')](_0x4dae78,_0x3c0520)[_0xe9c1('0xd')](function(_0x3c0436){logger['info'](_0xe9c1('0xe'),_0x3c181b,_0xe9c1('0xf'));logger[_0xe9c1('0x10')](_0xe9c1('0x11'),_0x3c181b,'request\x20sent',JSON[_0xe9c1('0x12')](_0x3c0436));if(_0x3c0436[_0xe9c1('0x13')]){if(_0x3c0436[_0xe9c1('0x13')][_0xe9c1('0x14')]===0x1f4){logger[_0xe9c1('0x13')](_0xe9c1('0xe'),_0x3c181b,_0x3c0436['error'][_0xe9c1('0x15')]);return _0x288d4e(_0x3c0436['error'][_0xe9c1('0x15')]);}logger[_0xe9c1('0x13')](_0xe9c1('0xe'),_0x3c181b,_0x3c0436[_0xe9c1('0x13')]['message']);return _0x5d4c27(_0x3c0436[_0xe9c1('0x13')]['message']);}else{logger['info'](_0xe9c1('0xe'),_0x3c181b,_0xe9c1('0xf'));_0x5d4c27(_0x3c0436['result'][_0xe9c1('0x15')]);}})['catch'](function(_0x36e8fc){logger[_0xe9c1('0x13')](_0xe9c1('0xe'),_0x3c181b,_0x36e8fc);_0x288d4e(_0x36e8fc);});});}exports['VerifyAdditionalPhones']=function(_0xd7aa72){var _0x3a3a30=this;return new Promise(function(_0x2ee3d1,_0x1c4fdc){return db[_0xe9c1('0x16')][_0xe9c1('0x17')]({'raw':!![],'where':{'ContactId':_0xd7aa72['body'][_0xe9c1('0x18')],'ListId':_0xd7aa72[_0xe9c1('0x19')]['ListId'],'VoiceQueueId':_0xd7aa72[_0xe9c1('0x19')]['VoiceQueueId']===undefined?null:_0xd7aa72['body'][_0xe9c1('0x1a')],'CampaignId':_0xd7aa72[_0xe9c1('0x19')]['CampaignId']===undefined?null:_0xd7aa72[_0xe9c1('0x19')][_0xe9c1('0x1b')]}})['then'](function(_0x5401ec){if(_0x5401ec!=null){return db[_0xe9c1('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5401ec['id'],'OrderBy':{'$gt':_0x5401ec[_0xe9c1('0x1d')]}},'order':[[_0xe9c1('0x1d'),_0xe9c1('0x1e')]]})['then'](function(_0x38ed80){var _0x1b9c9a=0x0;if(_0x38ed80){if(_0x38ed80[_0xe9c1('0x1f')]+_0x38ed80['countcongestionretry']+_0x38ed80[_0xe9c1('0x20')]+_0x38ed80[_0xe9c1('0x21')]+_0x38ed80[_0xe9c1('0x22')]+_0x38ed80[_0xe9c1('0x23')]+_0x38ed80[_0xe9c1('0x24')]+_0x38ed80[_0xe9c1('0x25')]<_0xd7aa72['entity'][_0xe9c1('0x26')])_0x1b9c9a=0x1;_0x2ee3d1({'additional':_0x1b9c9a});}else{return db[_0xe9c1('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5401ec['id']},'order':[[_0xe9c1('0x1d'),_0xe9c1('0x1e')]]})[_0xe9c1('0xd')](function(_0x2dc168){var _0x18a12f=0x0;if(_0x2dc168){if(_0x2dc168['countbusyretry']+_0x2dc168[_0xe9c1('0x27')]+_0x2dc168['countnoanswerretry']+_0x2dc168[_0xe9c1('0x21')]+_0x2dc168[_0xe9c1('0x22')]+_0x2dc168[_0xe9c1('0x23')]+_0x2dc168[_0xe9c1('0x24')]+_0x2dc168[_0xe9c1('0x25')]<_0xd7aa72['entity'][_0xe9c1('0x26')])_0x18a12f=0x1;_0x2ee3d1({'additional':_0x18a12f});}else{_0x2ee3d1({'additional':0x0});}})[_0xe9c1('0x28')](function(_0x1aeba7){logger['error']('VerifyAdditionalPhones',_0x1aeba7['message']);_0x1c4fdc(_0x3a3a30[_0xe9c1('0x13')](0x1f4,_0x1aeba7['message']));});}})[_0xe9c1('0x28')](function(_0x205a47){logger[_0xe9c1('0x13')](_0xe9c1('0x29'),_0x205a47[_0xe9c1('0x15')]);_0x1c4fdc(_0x3a3a30[_0xe9c1('0x13')](0x1f4,_0x205a47[_0xe9c1('0x15')]));});}else _0x2ee3d1({'additional':0x0});});});};exports[_0xe9c1('0x2a')]=function(_0x149398){var _0x860ef0=this;return new Promise(function(_0xa180e3,_0x3f4b4e){return db[_0xe9c1('0x16')][_0xe9c1('0x17')]({'raw':!![],'where':{'ContactId':_0x149398['body'][_0xe9c1('0x18')],'ListId':_0x149398['body'][_0xe9c1('0x2b')],'VoiceQueueId':_0x149398[_0xe9c1('0x19')][_0xe9c1('0x1a')]===undefined?null:_0x149398['body'][_0xe9c1('0x1a')],'CampaignId':_0x149398[_0xe9c1('0x19')]['CampaignId']===undefined?null:_0x149398['body']['CampaignId']}})[_0xe9c1('0xd')](function(_0x25f563){if(_0x25f563!=null){return db['CmHopperAdditionalPhone'][_0xe9c1('0x17')]({'raw':!![],'where':{'CmHopperId':_0x25f563['id'],'OrderBy':{'$gte':_0x25f563[_0xe9c1('0x1d')]}},'order':[[_0xe9c1('0x1d'),_0xe9c1('0x1e')]]})['then'](function(_0x4ab817){if(_0x4ab817)return activateAdditionalPhone(_0x25f563,_0x149398[_0xe9c1('0x19')],_0x4ab817,_0x149398[_0xe9c1('0x2c')],_0x149398[_0xe9c1('0x2d')])[_0xe9c1('0xd')](function(_0x1fa535){_0xa180e3(_0x1fa535);});else{return db[_0xe9c1('0x1c')][_0xe9c1('0x17')]({'raw':!![],'where':{'CmHopperId':_0x25f563['id']},'order':[[_0xe9c1('0x1d'),_0xe9c1('0x1e')]]})[_0xe9c1('0xd')](function(_0x2007ae){if(_0x2007ae)return activateAdditionalPhone(_0x25f563,_0x149398['body'],_0x2007ae,_0x149398['duration'],_0x149398[_0xe9c1('0x2d')])[_0xe9c1('0xd')](function(_0xde168e){_0xa180e3(_0xde168e);});else{_0xa180e3({'id':_0x25f563['id'],'phone':''});}})[_0xe9c1('0x28')](function(_0x548f20){logger[_0xe9c1('0x13')](_0xe9c1('0x29'),_0x548f20[_0xe9c1('0x15')]);_0x3f4b4e(_0x860ef0[_0xe9c1('0x13')](0x1f4,_0x548f20[_0xe9c1('0x15')]));});}})[_0xe9c1('0x28')](function(_0xb493a4){logger[_0xe9c1('0x13')](_0xe9c1('0x29'),_0xb493a4[_0xe9c1('0x15')]);_0x3f4b4e(_0x860ef0[_0xe9c1('0x13')](0x1f4,_0xb493a4['message']));});}else _0xa180e3(0x1);});});};function activateAdditionalPhone(_0x45310e,_0x2ad52e,_0x1431db,_0x78f75b,_0x347520){return new Promise(function(_0x3100fc,_0x46bb14){var _0x1faf59;if(_['isNil'](_0x1431db[_0xe9c1('0x2e')])){_0x1431db['scheduledat']=moment();}if(moment()>moment(_0x1431db[_0xe9c1('0x2e')])){_0x1faf59=moment()[_0xe9c1('0x2f')](_0x347520||0x3,_0xe9c1('0x30'));}else{if(_0x1431db[_0xe9c1('0x1d')]==0x0){_0x1faf59=moment(_0x1431db[_0xe9c1('0x2e')]);}else{_0x1faf59=moment()[_0xe9c1('0x2f')](_0x347520||0x3,_0xe9c1('0x30'));}}if(_[_0xe9c1('0x31')](_0x1faf59)){_0x1faf59=moment()[_0xe9c1('0x2f')](_0x347520||0x3,_0xe9c1('0x30'));}var _0x50bbcf={'phone':_0x45310e[_0xe9c1('0x32')],'active':0x0,'OrderBy':_[_0xe9c1('0x31')](_0x45310e[_0xe9c1('0x1d')])?0x0:_0x45310e[_0xe9c1('0x1d')],'scheduledat':moment()[_0xe9c1('0x2f')](_0x78f75b||0x1,_0xe9c1('0x30')),'countbusyretry':_0x2ad52e[_0xe9c1('0x1f')],'countcongestionretry':_0x2ad52e[_0xe9c1('0x27')],'countnoanswerretry':_0x2ad52e[_0xe9c1('0x20')],'countnosuchnumberretry':_0x2ad52e[_0xe9c1('0x21')],'countdropretry':_0x2ad52e[_0xe9c1('0x22')],'countabandonedretry':_0x2ad52e[_0xe9c1('0x23')],'countmachineretry':_0x2ad52e[_0xe9c1('0x24')],'countagentrejectretry':_0x2ad52e['countagentrejectretry'],'createdAt':_0x2ad52e['createdAt'],'updatedAt':_0x2ad52e['updatedAt']};var _0xa70efa={'CmHopperId':_0x45310e['id'],'phone':_0x1431db['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1431db['OrderBy'])?0x0:_0x1431db['OrderBy'],'scheduledat':_0x1faf59,'countbusyretry':_0x1431db[_0xe9c1('0x1f')],'countcongestionretry':_0x1431db[_0xe9c1('0x27')],'countnoanswerretry':_0x1431db[_0xe9c1('0x20')],'countnosuchnumberretry':_0x1431db[_0xe9c1('0x21')],'countdropretry':_0x1431db[_0xe9c1('0x22')],'countabandonedretry':_0x1431db['countabandonedretry'],'countmachineretry':_0x1431db['countmachineretry'],'countagentrejectretry':_0x1431db[_0xe9c1('0x25')],'createdAt':_0x1431db[_0xe9c1('0x33')],'updatedAt':_0x1431db[_0xe9c1('0x34')]};return db[_0xe9c1('0x35')][_0xe9c1('0x36')](function(_0x307fa7){return db[_0xe9c1('0x1c')][_0xe9c1('0x37')](_0x50bbcf,{'where':{'id':_0x1431db['id']}},{'transaction':_0x307fa7})[_0xe9c1('0xd')](function(){return db[_0xe9c1('0x16')][_0xe9c1('0x37')](_0xa70efa,{'where':{'id':_0x45310e['id']}},{'transaction':_0x307fa7});});})[_0xe9c1('0xd')](function(_0x477e21){_0x3100fc({'id':_0x45310e['id'],'phone':_0x1431db[_0xe9c1('0x32')]});})[_0xe9c1('0x28')](function(_0x24d775){logger['error'](_0xe9c1('0x38'),_0x24d775[_0xe9c1('0x15')]);_0x46bb14({'error':_0x24d775[_0xe9c1('0x15')]});});});}exports['IncrementPreviewCounters']=function(_0x38d1b8){var _0x4dc432=this;return new Promise(function(_0xabbed9,_0x144f1a){return db[_0xe9c1('0x16')][_0xe9c1('0x37')](_0x38d1b8[_0xe9c1('0x19')][_0xe9c1('0x39')],{'where':{'id':_0x38d1b8['body']['id']}})[_0xe9c1('0xd')](function(_0x578eb3){_0xabbed9(_0x578eb3);})[_0xe9c1('0x28')](function(_0x35f4f1){logger[_0xe9c1('0x13')](_0xe9c1('0x3a'),_0x35f4f1[_0xe9c1('0x15')]);_0x144f1a(_0x4dc432[_0xe9c1('0x13')](0x1f4,_0x35f4f1[_0xe9c1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b97fba9..d60a769 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 _0x590a=['./cmHopperAdditionalPhone.controller','isAuthenticated','get','/:id','show','create','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x54719d,_0xf894e1){var _0x270473=function(_0x2f1efe){while(--_0x2f1efe){_0x54719d['push'](_0x54719d['shift']());}};_0x270473(++_0xf894e1);}(_0x590a,0x159));var _0xa590=function(_0x14819b,_0xbc02f9){_0x14819b=_0x14819b-0x0;var _0x3170d6=_0x590a[_0x14819b];return _0x3170d6;};'use strict';var multer=require('multer');var util=require(_0xa590('0x0'));var path=require(_0xa590('0x1'));var timeout=require(_0xa590('0x2'));var express=require(_0xa590('0x3'));var router=express[_0xa590('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa590('0x5'));var config=require(_0xa590('0x6'));var controller=require(_0xa590('0x7'));router['get']('/',auth[_0xa590('0x8')](),controller['index']);router[_0xa590('0x9')](_0xa590('0xa'),auth[_0xa590('0x8')](),controller[_0xa590('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa590('0xc')]);router['put'](_0xa590('0xa'),auth[_0xa590('0x8')](),controller[_0xa590('0xd')]);router['delete'](_0xa590('0xa'),auth[_0xa590('0x8')](),controller[_0xa590('0xe')]);module[_0xa590('0xf')]=router; \ No newline at end of file +var _0xcfa3=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','post','put','update','delete','exports'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xcfa3,0x88));var _0x3cfa=function(_0x5205a5,_0x5a70a1){_0x5205a5=_0x5205a5-0x0;var _0x3359d3=_0xcfa3[_0x5205a5];return _0x3359d3;};'use strict';var multer=require('multer');var util=require(_0x3cfa('0x0'));var path=require('path');var timeout=require(_0x3cfa('0x1'));var express=require(_0x3cfa('0x2'));var router=express['Router']();var fs_extra=require(_0x3cfa('0x3'));var auth=require(_0x3cfa('0x4'));var interaction=require(_0x3cfa('0x5'));var config=require(_0x3cfa('0x6'));var controller=require(_0x3cfa('0x7'));router[_0x3cfa('0x8')]('/',auth[_0x3cfa('0x9')](),controller[_0x3cfa('0xa')]);router['get'](_0x3cfa('0xb'),auth[_0x3cfa('0x9')](),controller['show']);router[_0x3cfa('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3cfa('0xd')](_0x3cfa('0xb'),auth[_0x3cfa('0x9')](),controller[_0x3cfa('0xe')]);router[_0x3cfa('0xf')](_0x3cfa('0xb'),auth[_0x3cfa('0x9')](),controller['destroy']);module[_0x3cfa('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c3760b9..1ad7dcc 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 _0x99a0=['contactListQueue','moment','sequelize','INTEGER'];(function(_0x58fdc6,_0x590a69){var _0x30d6af=function(_0x1c0508){while(--_0x1c0508){_0x58fdc6['push'](_0x58fdc6['shift']());}};_0x30d6af(++_0x590a69);}(_0x99a0,0x121));var _0x099a=function(_0x1f369b,_0x67489d){_0x1f369b=_0x1f369b-0x0;var _0x30c615=_0x99a0[_0x1f369b];return _0x30c615;};'use strict';var moment=require(_0x099a('0x0'));var Sequelize=require(_0x099a('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x099a('0x2')],'unique':_0x099a('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x099a('0x3')}}; \ No newline at end of file +var _0x55c1=['INTEGER','moment','sequelize','contactListQueue'];(function(_0x283952,_0x442596){var _0x57bb99=function(_0x5cd9b6){while(--_0x5cd9b6){_0x283952['push'](_0x283952['shift']());}};_0x57bb99(++_0x442596);}(_0x55c1,0x1e5));var _0x155c=function(_0x24bf11,_0x320ad8){_0x24bf11=_0x24bf11-0x0;var _0x20f05b=_0x55c1[_0x24bf11];return _0x20f05b;};'use strict';var moment=require(_0x155c('0x0'));var Sequelize=require(_0x155c('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x155c('0x2')},'ListId':{'type':Sequelize[_0x155c('0x3')],'unique':_0x155c('0x2')},'VoiceQueueId':{'type':Sequelize[_0x155c('0x3')],'unique':_0x155c('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ccfef9b..67bd2f0 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 _0x2174=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','fields','options','find','update','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','CmHopperBlack','rawAttributes','model','map','query','keys','filters','attributes','intersection'];(function(_0x259cad,_0x3dae11){var _0x4e6a68=function(_0x1669dc){while(--_0x1669dc){_0x259cad['push'](_0x259cad['shift']());}};_0x4e6a68(++_0x3dae11);}(_0x2174,0x142));var _0x4217=function(_0x4bdf46,_0x177898){_0x4bdf46=_0x4bdf46-0x0;var _0x104b14=_0x2174[_0x4bdf46];return _0x104b14;};'use strict';var emlformat=require(_0x4217('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4217('0x1'));var rp=require(_0x4217('0x2'));var moment=require('moment');var BPromise=require(_0x4217('0x3'));var Mustache=require(_0x4217('0x4'));var util=require(_0x4217('0x5'));var path=require(_0x4217('0x6'));var sox=require(_0x4217('0x7'));var csv=require('to-csv');var ejs=require(_0x4217('0x8'));var fs=require('fs');var fs_extra=require(_0x4217('0x9'));var _=require('lodash');var squel=require(_0x4217('0xa'));var crypto=require('crypto');var jsforce=require(_0x4217('0xb'));var deskjs=require(_0x4217('0xc'));var toCsv=require(_0x4217('0xd'));var querystring=require(_0x4217('0xe'));var Papa=require(_0x4217('0xf'));var Redis=require(_0x4217('0x10'));var authService=require(_0x4217('0x11'));var qs=require(_0x4217('0x12'));var as=require(_0x4217('0x13'));var hardwareService=require(_0x4217('0x14'));var logger=require(_0x4217('0x15'))(_0x4217('0x16'));var utils=require(_0x4217('0x17'));var config=require(_0x4217('0x18'));var licenseUtil=require(_0x4217('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e555e,_0x230cc0){_0x230cc0=_0x230cc0||0xcc;return function(_0x1556f6){if(_0x1556f6){return _0x4e555e['sendStatus'](_0x230cc0);}return _0x4e555e[_0x4217('0x1a')](_0x230cc0)[_0x4217('0x1b')]();};}function respondWithResult(_0x25e046,_0x5c6792){_0x5c6792=_0x5c6792||0xc8;return function(_0x45b1c6){if(_0x45b1c6){return _0x25e046[_0x4217('0x1a')](_0x5c6792)[_0x4217('0x1c')](_0x45b1c6);}};}function respondWithFilteredResult(_0x17f3cf,_0x523a48){return function(_0xadacbd){if(_0xadacbd){var _0x355d01=typeof _0x523a48['offset']===_0x4217('0x1d')&&typeof _0x523a48[_0x4217('0x1e')]===_0x4217('0x1d');var _0x5159f5=_0xadacbd['count'];var _0x1588e0=_0x355d01?0x0:_0x523a48['offset'];var _0x2d6bf7=_0x355d01?_0xadacbd[_0x4217('0x1f')]:_0x523a48[_0x4217('0x20')]+_0x523a48[_0x4217('0x1e')];var _0x193c83;if(_0x2d6bf7>=_0x5159f5){_0x2d6bf7=_0x5159f5;_0x193c83=0xc8;}else{_0x193c83=0xce;}_0x17f3cf['status'](_0x193c83);return _0x17f3cf['set'](_0x4217('0x21'),_0x1588e0+'-'+_0x2d6bf7+'/'+_0x5159f5)[_0x4217('0x1c')](_0xadacbd);}return null;};}function patchUpdates(_0x34aa16){return function(_0x5619bc){try{jsonpatch[_0x4217('0x22')](_0x5619bc,_0x34aa16,!![]);}catch(_0x4d4465){return BPromise[_0x4217('0x23')](_0x4d4465);}return _0x5619bc[_0x4217('0x24')]();};}function saveUpdates(_0x5080b9,_0x332d14){return function(_0x367e1f){if(_0x367e1f){return _0x367e1f['update'](_0x5080b9)['then'](function(_0x273948){return _0x273948;});}return null;};}function removeEntity(_0x45b7ed,_0x5a64d4){return function(_0x1e11e1){if(_0x1e11e1){return _0x1e11e1[_0x4217('0x25')]()[_0x4217('0x26')](function(){_0x45b7ed[_0x4217('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a0439,_0x1f872e){return function(_0x351c78){if(!_0x351c78){_0x3a0439['sendStatus'](0x194);}return _0x351c78;};}function handleError(_0x4b1fd4,_0x30a145){_0x30a145=_0x30a145||0x1f4;return function(_0x2c33a4){logger[_0x4217('0x27')](_0x2c33a4[_0x4217('0x28')]);if(_0x2c33a4[_0x4217('0x29')]){delete _0x2c33a4[_0x4217('0x29')];}_0x4b1fd4[_0x4217('0x1a')](_0x30a145)[_0x4217('0x2a')](_0x2c33a4);};}exports[_0x4217('0x2b')]=function(_0x4c87a2,_0x11516f){var _0x2fb928={},_0x2f3c19={},_0x55859d={'count':0x0,'rows':[]};var _0x5e77bc=_['map'](db[_0x4217('0x2c')][_0x4217('0x2d')],function(_0x914bd7){return{'name':_0x914bd7['fieldName'],'type':_0x914bd7['type']['key']};});_0x2f3c19[_0x4217('0x2e')]=_[_0x4217('0x2f')](_0x5e77bc,_0x4217('0x29'));_0x2f3c19[_0x4217('0x30')]=_[_0x4217('0x31')](_0x4c87a2[_0x4217('0x30')]);_0x2f3c19[_0x4217('0x32')]=_['intersection'](_0x2f3c19[_0x4217('0x2e')],_0x2f3c19[_0x4217('0x30')]);_0x2fb928[_0x4217('0x33')]=_[_0x4217('0x34')](_0x2f3c19[_0x4217('0x2e')],qs['fields'](_0x4c87a2[_0x4217('0x30')]['fields']));_0x2fb928[_0x4217('0x33')]=_0x2fb928[_0x4217('0x33')][_0x4217('0x35')]?_0x2fb928[_0x4217('0x33')]:_0x2f3c19['model'];if(!_0x4c87a2['query'][_0x4217('0x36')](_0x4217('0x37'))){_0x2fb928[_0x4217('0x1e')]=qs[_0x4217('0x1e')](_0x4c87a2[_0x4217('0x30')][_0x4217('0x1e')]);_0x2fb928[_0x4217('0x20')]=qs[_0x4217('0x20')](_0x4c87a2['query'][_0x4217('0x20')]);}_0x2fb928[_0x4217('0x38')]=qs[_0x4217('0x39')](_0x4c87a2[_0x4217('0x30')][_0x4217('0x39')]);_0x2fb928['where']=qs['filters'](_[_0x4217('0x3a')](_0x4c87a2[_0x4217('0x30')],_0x2f3c19[_0x4217('0x32')]),_0x5e77bc);if(_0x4c87a2[_0x4217('0x30')][_0x4217('0x3b')]){_0x2fb928[_0x4217('0x3c')]=_[_0x4217('0x3d')](_0x2fb928['where'],{'$or':_[_0x4217('0x2f')](_0x5e77bc,function(_0x3cb96a){if(_0x3cb96a['type']!==_0x4217('0x3e')){var _0x2991e7={};_0x2991e7[_0x3cb96a[_0x4217('0x29')]]={'$like':'%'+_0x4c87a2[_0x4217('0x30')][_0x4217('0x3b')]+'%'};return _0x2991e7;}})});}_0x2fb928=_['merge']({},_0x2fb928,_0x4c87a2['options']);var _0x399f5e={'where':_0x2fb928[_0x4217('0x3c')]};return db[_0x4217('0x2c')][_0x4217('0x1f')](_0x399f5e)[_0x4217('0x26')](function(_0x86dbb4){_0x55859d[_0x4217('0x1f')]=_0x86dbb4;if(_0x4c87a2[_0x4217('0x30')][_0x4217('0x3f')]){_0x2fb928[_0x4217('0x40')]=[{'all':!![]}];}return db[_0x4217('0x2c')]['findAll'](_0x2fb928);})['then'](function(_0x2b3cbd){_0x55859d[_0x4217('0x41')]=_0x2b3cbd;return _0x55859d;})[_0x4217('0x26')](respondWithFilteredResult(_0x11516f,_0x2fb928))[_0x4217('0x42')](handleError(_0x11516f,null));};exports[_0x4217('0x43')]=function(_0x30d764,_0x47fac3){var _0x5cb1fb={'raw':!![],'where':{'id':_0x30d764[_0x4217('0x44')]['id']}},_0x855535={};_0x855535['model']=_['keys'](db[_0x4217('0x2c')][_0x4217('0x2d')]);_0x855535['query']=_[_0x4217('0x31')](_0x30d764[_0x4217('0x30')]);_0x855535[_0x4217('0x32')]=_[_0x4217('0x34')](_0x855535[_0x4217('0x2e')],_0x855535[_0x4217('0x30')]);_0x5cb1fb[_0x4217('0x33')]=_[_0x4217('0x34')](_0x855535['model'],qs[_0x4217('0x45')](_0x30d764[_0x4217('0x30')][_0x4217('0x45')]));_0x5cb1fb[_0x4217('0x33')]=_0x5cb1fb['attributes'][_0x4217('0x35')]?_0x5cb1fb['attributes']:_0x855535['model'];if(_0x30d764['query'][_0x4217('0x3f')]){_0x5cb1fb[_0x4217('0x40')]=[{'all':!![]}];}_0x5cb1fb=_[_0x4217('0x3d')]({},_0x5cb1fb,_0x30d764[_0x4217('0x46')]);return db['CmHopperBlack'][_0x4217('0x47')](_0x5cb1fb)['then'](handleEntityNotFound(_0x47fac3,null))[_0x4217('0x26')](respondWithResult(_0x47fac3,null))['catch'](handleError(_0x47fac3,null));};exports[_0x4217('0x48')]=function(_0x1e0de0,_0x238424){if(_0x1e0de0[_0x4217('0x49')]['id']){delete _0x1e0de0[_0x4217('0x49')]['id'];}return db[_0x4217('0x2c')][_0x4217('0x47')]({'where':{'id':_0x1e0de0['params']['id']}})[_0x4217('0x26')](handleEntityNotFound(_0x238424,null))['then'](saveUpdates(_0x1e0de0[_0x4217('0x49')],null))[_0x4217('0x26')](respondWithResult(_0x238424,null))[_0x4217('0x42')](handleError(_0x238424,null));};exports[_0x4217('0x25')]=function(_0x5da8f3,_0xcc41d8){return db[_0x4217('0x2c')][_0x4217('0x47')]({'where':{'id':_0x5da8f3['params']['id']}})['then'](handleEntityNotFound(_0xcc41d8,null))[_0x4217('0x26')](removeEntity(_0xcc41d8,null))[_0x4217('0x42')](handleError(_0xcc41d8,null));};exports[_0x4217('0x4a')]=function(_0x1fc511,_0x250cf6){return db[_0x4217('0x2c')][_0x4217('0x4a')]()[_0x4217('0x26')](respondWithResult(_0x250cf6,null))[_0x4217('0x42')](handleError(_0x250cf6,null));}; \ No newline at end of file +var _0x9137=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','error','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','catch','show','params','length','include','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','ioredis'];(function(_0x1b5054,_0xdf5e1f){var _0x2663c0=function(_0x552f3e){while(--_0x552f3e){_0x1b5054['push'](_0x1b5054['shift']());}};_0x2663c0(++_0xdf5e1f);}(_0x9137,0x79));var _0x7913=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0x9137[_0x414ff1];return _0x29c53f;};'use strict';var emlformat=require(_0x7913('0x0'));var rimraf=require(_0x7913('0x1'));var zipdir=require(_0x7913('0x2'));var jsonpatch=require(_0x7913('0x3'));var rp=require(_0x7913('0x4'));var moment=require(_0x7913('0x5'));var BPromise=require(_0x7913('0x6'));var Mustache=require('mustache');var util=require(_0x7913('0x7'));var path=require(_0x7913('0x8'));var sox=require(_0x7913('0x9'));var csv=require(_0x7913('0xa'));var ejs=require(_0x7913('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7913('0xc'));var crypto=require(_0x7913('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7913('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7913('0xe'));var authService=require(_0x7913('0xf'));var qs=require(_0x7913('0x10'));var as=require(_0x7913('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7913('0x12'))('api');var utils=require(_0x7913('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7913('0x14'));var db=require(_0x7913('0x15'))['db'];function respondWithStatusCode(_0x25c4e2,_0x51828e){_0x51828e=_0x51828e||0xcc;return function(_0x2f06d4){if(_0x2f06d4){return _0x25c4e2[_0x7913('0x16')](_0x51828e);}return _0x25c4e2[_0x7913('0x17')](_0x51828e)['end']();};}function respondWithResult(_0x256283,_0x4ff6de){_0x4ff6de=_0x4ff6de||0xc8;return function(_0x4d44f6){if(_0x4d44f6){return _0x256283['status'](_0x4ff6de)[_0x7913('0x18')](_0x4d44f6);}};}function respondWithFilteredResult(_0x46b55e,_0x12ab2b){return function(_0x1321ff){if(_0x1321ff){var _0xe03356=typeof _0x12ab2b['offset']===_0x7913('0x19')&&typeof _0x12ab2b[_0x7913('0x1a')]===_0x7913('0x19');var _0x23ecea=_0x1321ff[_0x7913('0x1b')];var _0x1d2bff=_0xe03356?0x0:_0x12ab2b[_0x7913('0x1c')];var _0x21742c=_0xe03356?_0x1321ff[_0x7913('0x1b')]:_0x12ab2b['offset']+_0x12ab2b[_0x7913('0x1a')];var _0x1a420c;if(_0x21742c>=_0x23ecea){_0x21742c=_0x23ecea;_0x1a420c=0xc8;}else{_0x1a420c=0xce;}_0x46b55e[_0x7913('0x17')](_0x1a420c);return _0x46b55e['set'](_0x7913('0x1d'),_0x1d2bff+'-'+_0x21742c+'/'+_0x23ecea)[_0x7913('0x18')](_0x1321ff);}return null;};}function patchUpdates(_0x3d609c){return function(_0x4e6858){try{jsonpatch[_0x7913('0x1e')](_0x4e6858,_0x3d609c,!![]);}catch(_0x540fa9){return BPromise[_0x7913('0x1f')](_0x540fa9);}return _0x4e6858[_0x7913('0x20')]();};}function saveUpdates(_0x591f37,_0x11af60){return function(_0x142a66){if(_0x142a66){return _0x142a66['update'](_0x591f37)['then'](function(_0x523306){return _0x523306;});}return null;};}function removeEntity(_0x158c4c,_0x427dbc){return function(_0x4ad946){if(_0x4ad946){return _0x4ad946['destroy']()[_0x7913('0x21')](function(){_0x158c4c[_0x7913('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa12e07,_0x49c922){return function(_0x3ed4bc){if(!_0x3ed4bc){_0xa12e07['sendStatus'](0x194);}return _0x3ed4bc;};}function handleError(_0x446d1c,_0x5bb484){_0x5bb484=_0x5bb484||0x1f4;return function(_0x10bb11){logger[_0x7913('0x22')](_0x10bb11['stack']);if(_0x10bb11['name']){delete _0x10bb11[_0x7913('0x23')];}_0x446d1c['status'](_0x5bb484)[_0x7913('0x24')](_0x10bb11);};}exports['index']=function(_0x54af4d,_0x2760d9){var _0x58fded={},_0x38e694={},_0xc4ace4={'count':0x0,'rows':[]};var _0x3da47a=_[_0x7913('0x25')](db[_0x7913('0x26')][_0x7913('0x27')],function(_0x51ac53){return{'name':_0x51ac53[_0x7913('0x28')],'type':_0x51ac53[_0x7913('0x29')][_0x7913('0x2a')]};});_0x38e694[_0x7913('0x2b')]=_[_0x7913('0x25')](_0x3da47a,'name');_0x38e694['query']=_[_0x7913('0x2c')](_0x54af4d['query']);_0x38e694[_0x7913('0x2d')]=_[_0x7913('0x2e')](_0x38e694[_0x7913('0x2b')],_0x38e694[_0x7913('0x2f')]);_0x58fded[_0x7913('0x30')]=_[_0x7913('0x2e')](_0x38e694[_0x7913('0x2b')],qs['fields'](_0x54af4d[_0x7913('0x2f')][_0x7913('0x31')]));_0x58fded[_0x7913('0x30')]=_0x58fded[_0x7913('0x30')]['length']?_0x58fded[_0x7913('0x30')]:_0x38e694[_0x7913('0x2b')];if(!_0x54af4d[_0x7913('0x2f')][_0x7913('0x32')](_0x7913('0x33'))){_0x58fded['limit']=qs['limit'](_0x54af4d[_0x7913('0x2f')][_0x7913('0x1a')]);_0x58fded[_0x7913('0x1c')]=qs[_0x7913('0x1c')](_0x54af4d['query'][_0x7913('0x1c')]);}_0x58fded[_0x7913('0x34')]=qs[_0x7913('0x35')](_0x54af4d[_0x7913('0x2f')]['sort']);_0x58fded['where']=qs[_0x7913('0x2d')](_[_0x7913('0x36')](_0x54af4d[_0x7913('0x2f')],_0x38e694[_0x7913('0x2d')]),_0x3da47a);if(_0x54af4d[_0x7913('0x2f')][_0x7913('0x37')]){_0x58fded['where']=_[_0x7913('0x38')](_0x58fded[_0x7913('0x39')],{'$or':_['map'](_0x3da47a,function(_0x128122){if(_0x128122[_0x7913('0x29')]!=='VIRTUAL'){var _0x25f12d={};_0x25f12d[_0x128122[_0x7913('0x23')]]={'$like':'%'+_0x54af4d['query'][_0x7913('0x37')]+'%'};return _0x25f12d;}})});}_0x58fded=_[_0x7913('0x38')]({},_0x58fded,_0x54af4d[_0x7913('0x3a')]);var _0x3d014b={'where':_0x58fded[_0x7913('0x39')]};return db['CmHopperBlack']['count'](_0x3d014b)[_0x7913('0x21')](function(_0x45583c){_0xc4ace4[_0x7913('0x1b')]=_0x45583c;if(_0x54af4d['query'][_0x7913('0x3b')]){_0x58fded['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x58fded);})['then'](function(_0x4d6358){_0xc4ace4['rows']=_0x4d6358;return _0xc4ace4;})[_0x7913('0x21')](respondWithFilteredResult(_0x2760d9,_0x58fded))[_0x7913('0x3c')](handleError(_0x2760d9,null));};exports[_0x7913('0x3d')]=function(_0x3abcfc,_0x5a482f){var _0x4f877e={'raw':!![],'where':{'id':_0x3abcfc[_0x7913('0x3e')]['id']}},_0x44117b={};_0x44117b['model']=_[_0x7913('0x2c')](db[_0x7913('0x26')][_0x7913('0x27')]);_0x44117b['query']=_['keys'](_0x3abcfc[_0x7913('0x2f')]);_0x44117b[_0x7913('0x2d')]=_[_0x7913('0x2e')](_0x44117b[_0x7913('0x2b')],_0x44117b[_0x7913('0x2f')]);_0x4f877e[_0x7913('0x30')]=_[_0x7913('0x2e')](_0x44117b[_0x7913('0x2b')],qs[_0x7913('0x31')](_0x3abcfc[_0x7913('0x2f')][_0x7913('0x31')]));_0x4f877e[_0x7913('0x30')]=_0x4f877e[_0x7913('0x30')][_0x7913('0x3f')]?_0x4f877e[_0x7913('0x30')]:_0x44117b[_0x7913('0x2b')];if(_0x3abcfc[_0x7913('0x2f')][_0x7913('0x3b')]){_0x4f877e[_0x7913('0x40')]=[{'all':!![]}];}_0x4f877e=_[_0x7913('0x38')]({},_0x4f877e,_0x3abcfc['options']);return db[_0x7913('0x26')]['find'](_0x4f877e)[_0x7913('0x21')](handleEntityNotFound(_0x5a482f,null))['then'](respondWithResult(_0x5a482f,null))['catch'](handleError(_0x5a482f,null));};exports['update']=function(_0x393d01,_0x4a5e1c){if(_0x393d01[_0x7913('0x41')]['id']){delete _0x393d01[_0x7913('0x41')]['id'];}return db[_0x7913('0x26')][_0x7913('0x42')]({'where':{'id':_0x393d01['params']['id']}})[_0x7913('0x21')](handleEntityNotFound(_0x4a5e1c,null))['then'](saveUpdates(_0x393d01[_0x7913('0x41')],null))[_0x7913('0x21')](respondWithResult(_0x4a5e1c,null))[_0x7913('0x3c')](handleError(_0x4a5e1c,null));};exports['destroy']=function(_0x3d59c6,_0x3c11df){return db[_0x7913('0x26')][_0x7913('0x42')]({'where':{'id':_0x3d59c6[_0x7913('0x3e')]['id']}})[_0x7913('0x21')](handleEntityNotFound(_0x3c11df,null))[_0x7913('0x21')](removeEntity(_0x3c11df,null))[_0x7913('0x3c')](handleError(_0x3c11df,null));};exports[_0x7913('0x43')]=function(_0x2c0f03,_0x1794a4){return db[_0x7913('0x26')]['describe']()[_0x7913('0x21')](respondWithResult(_0x1794a4,null))[_0x7913('0x3c')](handleError(_0x1794a4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c9e1e91..060f74e 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 _0xe150=['./cmHopperBlack.attributes','define','CmHopperBlack','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x5e8ba0,_0x1f684d){var _0x391d74=function(_0x4ea358){while(--_0x4ea358){_0x5e8ba0['push'](_0x5e8ba0['shift']());}};_0x391d74(++_0x1f684d);}(_0xe150,0x19a));var _0x0e15=function(_0x1c4a60,_0x506b93){_0x1c4a60=_0x1c4a60-0x0;var _0x2f3b9a=_0xe150[_0x1c4a60];return _0x2f3b9a;};'use strict';var _=require(_0x0e15('0x0'));var util=require(_0x0e15('0x1'));var logger=require(_0x0e15('0x2'))(_0x0e15('0x3'));var moment=require('moment');var BPromise=require(_0x0e15('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e15('0x5'));var rimraf=require(_0x0e15('0x6'));var config=require(_0x0e15('0x7'));var attributes=require(_0x0e15('0x8'));module['exports']=function(_0x387547,_0x12d697){return _0x387547[_0x0e15('0x9')](_0x0e15('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6b3=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','api'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0xd6b3,0xa5));var _0x3d6b=function(_0x21ea6a,_0x1937ad){_0x21ea6a=_0x21ea6a-0x0;var _0x476fb2=_0xd6b3[_0x21ea6a];return _0x476fb2;};'use strict';var _=require(_0x3d6b('0x0'));var util=require(_0x3d6b('0x1'));var logger=require('../../config/logger')(_0x3d6b('0x2'));var moment=require('moment');var BPromise=require(_0x3d6b('0x3'));var rp=require(_0x3d6b('0x4'));var fs=require('fs');var path=require(_0x3d6b('0x5'));var rimraf=require(_0x3d6b('0x6'));var config=require(_0x3d6b('0x7'));var attributes=require(_0x3d6b('0x8'));module[_0x3d6b('0x9')]=function(_0x31f86e,_0x57a1e5){return _0x31f86e[_0x3d6b('0xa')](_0x3d6b('0xb'),attributes,{'tableName':'cm_hopper_black','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 edcfe0c..976f66a 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 _0xcd24=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','CmHopperBlack,\x20%s,\x20%s','GetCmHopperBlack','findAll','options','raw','include','map','model','attributes','stringify','catch','body','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment'];(function(_0x22788e,_0x1c277){var _0x91255=function(_0x14809b){while(--_0x14809b){_0x22788e['push'](_0x22788e['shift']());}};_0x91255(++_0x1c277);}(_0xcd24,0x16f));var _0x4cd2=function(_0x256463,_0x4f64c3){_0x256463=_0x256463-0x0;var _0x1fcebf=_0xcd24[_0x256463];return _0x1fcebf;};'use strict';var _=require(_0x4cd2('0x0'));var util=require(_0x4cd2('0x1'));var moment=require(_0x4cd2('0x2'));var BPromise=require(_0x4cd2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cd2('0x4'));var db=require(_0x4cd2('0x5'))['db'];var utils=require(_0x4cd2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4cd2('0x7'));var jayson=require(_0x4cd2('0x8'));var client=jayson[_0x4cd2('0x9')][_0x4cd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c5e4f,_0x46aa01,_0x56d96c){return new BPromise(function(_0x3333e8,_0x21dab0){return client[_0x4cd2('0xb')](_0x5c5e4f,_0x56d96c)[_0x4cd2('0xc')](function(_0x5f082d){logger[_0x4cd2('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x46aa01,_0x4cd2('0xe'));logger[_0x4cd2('0xf')](_0x4cd2('0x10'),_0x46aa01,_0x4cd2('0xe'),JSON['stringify'](_0x5f082d));if(_0x5f082d[_0x4cd2('0x11')]){if(_0x5f082d[_0x4cd2('0x11')][_0x4cd2('0x12')]===0x1f4){logger[_0x4cd2('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x46aa01,_0x5f082d['error']['message']);return _0x21dab0(_0x5f082d[_0x4cd2('0x11')][_0x4cd2('0x13')]);}logger[_0x4cd2('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x46aa01,_0x5f082d['error'][_0x4cd2('0x13')]);return _0x3333e8(_0x5f082d[_0x4cd2('0x11')][_0x4cd2('0x13')]);}else{logger[_0x4cd2('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x46aa01,_0x4cd2('0xe'));_0x3333e8(_0x5f082d[_0x4cd2('0x14')]['message']);}})['catch'](function(_0x3d1dfb){logger[_0x4cd2('0x11')](_0x4cd2('0x15'),_0x46aa01,_0x3d1dfb);_0x21dab0(_0x3d1dfb);});});}exports[_0x4cd2('0x16')]=function(_0x4da0a2){var _0x4640e3=this;return new Promise(function(_0x23ece3,_0x333a02){return db['CmHopperBlack'][_0x4cd2('0x17')]({'raw':_0x4da0a2['options']?_0x4da0a2[_0x4cd2('0x18')][_0x4cd2('0x19')]===undefined?!![]:![]:!![],'where':_0x4da0a2[_0x4cd2('0x18')]?_0x4da0a2[_0x4cd2('0x18')]['where']||null:null,'attributes':_0x4da0a2[_0x4cd2('0x18')]?_0x4da0a2[_0x4cd2('0x18')]['attributes']||null:null,'limit':_0x4da0a2[_0x4cd2('0x18')]?_0x4da0a2['options']['limit']||null:null,'include':_0x4da0a2[_0x4cd2('0x18')]?_0x4da0a2[_0x4cd2('0x18')][_0x4cd2('0x1a')]?_[_0x4cd2('0x1b')](_0x4da0a2['options'][_0x4cd2('0x1a')],function(_0x15588b){return{'model':db[_0x15588b[_0x4cd2('0x1c')]],'as':_0x15588b['as'],'attributes':_0x15588b[_0x4cd2('0x1d')],'include':_0x15588b[_0x4cd2('0x1a')]?_[_0x4cd2('0x1b')](_0x15588b['include'],function(_0x30f26d){return{'model':db[_0x30f26d[_0x4cd2('0x1c')]],'as':_0x30f26d['as'],'attributes':_0x30f26d[_0x4cd2('0x1d')],'include':_0x30f26d[_0x4cd2('0x1a')]?_['map'](_0x30f26d[_0x4cd2('0x1a')],function(_0x572b93){return{'model':db[_0x572b93[_0x4cd2('0x1c')]],'as':_0x572b93['as'],'attributes':_0x572b93[_0x4cd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4cd2('0xc')](function(_0x33171c){logger[_0x4cd2('0xd')](_0x4cd2('0x16'),_0x4da0a2);logger[_0x4cd2('0xf')](_0x4cd2('0x16'),_0x4da0a2,JSON[_0x4cd2('0x1e')](_0x33171c));_0x23ece3(_0x33171c);})[_0x4cd2('0x1f')](function(_0x87f11d){logger[_0x4cd2('0x11')](_0x4cd2('0x16'),_0x87f11d[_0x4cd2('0x13')],_0x4da0a2);_0x333a02(_0x4640e3[_0x4cd2('0x11')](0x1f4,_0x87f11d[_0x4cd2('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x1880f3){var _0x55c369=this;return new Promise(function(_0x2f93be,_0x222f3a){return db['CmHopperBlack']['update'](_0x1880f3[_0x4cd2('0x20')],{'raw':_0x1880f3['options']?_0x1880f3[_0x4cd2('0x18')][_0x4cd2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1880f3['options']?_0x1880f3[_0x4cd2('0x18')][_0x4cd2('0x21')]||null:null,'attributes':_0x1880f3[_0x4cd2('0x18')]?_0x1880f3[_0x4cd2('0x18')][_0x4cd2('0x1d')]||null:null,'limit':_0x1880f3['options']?_0x1880f3[_0x4cd2('0x18')]['limit']||null:null})['then'](function(_0x270627){logger[_0x4cd2('0xd')](_0x4cd2('0x22'),_0x1880f3);logger[_0x4cd2('0xf')]('UpdateCmHopperBlack',_0x1880f3,JSON['stringify'](_0x270627));_0x2f93be(_0x270627);})[_0x4cd2('0x1f')](function(_0x4d6e7b){logger[_0x4cd2('0x11')](_0x4cd2('0x22'),_0x4d6e7b[_0x4cd2('0x13')],_0x1880f3);_0x222f3a(_0x55c369[_0x4cd2('0x11')](0x1f4,_0x4d6e7b[_0x4cd2('0x13')]));});});};exports[_0x4cd2('0x23')]=function(_0x1a644c){var _0xa120eb=this;return new Promise(function(_0x1a7054,_0x397a33){return db['CmHopperBlack'][_0x4cd2('0x24')]({'where':_0x1a644c[_0x4cd2('0x18')]?_0x1a644c['options'][_0x4cd2('0x21')]||null:null})[_0x4cd2('0xc')](function(_0xe72bb){logger[_0x4cd2('0xd')](_0x4cd2('0x23'),_0x1a644c);logger[_0x4cd2('0xf')](_0x4cd2('0x23'),_0x1a644c,JSON[_0x4cd2('0x1e')](_0xe72bb));_0x1a7054(_0xe72bb);})[_0x4cd2('0x1f')](function(_0x534b99){logger[_0x4cd2('0x11')]('DestroyCmHopperBlack',_0x534b99[_0x4cd2('0x13')],_0x1a644c);_0x397a33(_0xa120eb[_0x4cd2('0x11')](0x1f4,_0x534b99[_0x4cd2('0x13')]));});});}; \ No newline at end of file +var _0x2578=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x20ebc8,_0x13eb15){var _0x40a4a3=function(_0x17e454){while(--_0x17e454){_0x20ebc8['push'](_0x20ebc8['shift']());}};_0x40a4a3(++_0x13eb15);}(_0x2578,0x131));var _0x8257=function(_0x1d1d94,_0x41e64f){_0x1d1d94=_0x1d1d94-0x0;var _0x4fac0a=_0x2578[_0x1d1d94];return _0x4fac0a;};'use strict';var _=require(_0x8257('0x0'));var util=require(_0x8257('0x1'));var moment=require(_0x8257('0x2'));var BPromise=require('bluebird');var rs=require(_0x8257('0x3'));var fs=require('fs');var Redis=require(_0x8257('0x4'));var db=require(_0x8257('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8257('0x6'))(_0x8257('0x7'));var config=require(_0x8257('0x8'));var jayson=require(_0x8257('0x9'));var client=jayson['client'][_0x8257('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x397949,_0x319281,_0x2bb999){return new BPromise(function(_0x48ebfa,_0x4c8552){return client[_0x8257('0xb')](_0x397949,_0x2bb999)[_0x8257('0xc')](function(_0x4a34ec){logger[_0x8257('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x319281,_0x8257('0xe'));logger[_0x8257('0xf')](_0x8257('0x10'),_0x319281,'request\x20sent',JSON[_0x8257('0x11')](_0x4a34ec));if(_0x4a34ec[_0x8257('0x12')]){if(_0x4a34ec[_0x8257('0x12')][_0x8257('0x13')]===0x1f4){logger[_0x8257('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x319281,_0x4a34ec[_0x8257('0x12')][_0x8257('0x14')]);return _0x4c8552(_0x4a34ec[_0x8257('0x12')][_0x8257('0x14')]);}logger[_0x8257('0x12')](_0x8257('0x15'),_0x319281,_0x4a34ec[_0x8257('0x12')][_0x8257('0x14')]);return _0x48ebfa(_0x4a34ec['error'][_0x8257('0x14')]);}else{logger['info'](_0x8257('0x15'),_0x319281,_0x8257('0xe'));_0x48ebfa(_0x4a34ec[_0x8257('0x16')][_0x8257('0x14')]);}})[_0x8257('0x17')](function(_0xca9977){logger[_0x8257('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x319281,_0xca9977);_0x4c8552(_0xca9977);});});}exports[_0x8257('0x18')]=function(_0x26f368){var _0x19ad33=this;return new Promise(function(_0x5db4c9,_0xe8bec9){return db[_0x8257('0x19')][_0x8257('0x1a')]({'raw':_0x26f368[_0x8257('0x1b')]?_0x26f368[_0x8257('0x1b')][_0x8257('0x1c')]===undefined?!![]:![]:!![],'where':_0x26f368[_0x8257('0x1b')]?_0x26f368[_0x8257('0x1b')]['where']||null:null,'attributes':_0x26f368[_0x8257('0x1b')]?_0x26f368['options'][_0x8257('0x1d')]||null:null,'limit':_0x26f368[_0x8257('0x1b')]?_0x26f368[_0x8257('0x1b')]['limit']||null:null,'include':_0x26f368[_0x8257('0x1b')]?_0x26f368[_0x8257('0x1b')][_0x8257('0x1e')]?_[_0x8257('0x1f')](_0x26f368[_0x8257('0x1b')][_0x8257('0x1e')],function(_0x19fa10){return{'model':db[_0x19fa10[_0x8257('0x20')]],'as':_0x19fa10['as'],'attributes':_0x19fa10['attributes'],'include':_0x19fa10[_0x8257('0x1e')]?_['map'](_0x19fa10[_0x8257('0x1e')],function(_0x4e699a){return{'model':db[_0x4e699a[_0x8257('0x20')]],'as':_0x4e699a['as'],'attributes':_0x4e699a[_0x8257('0x1d')],'include':_0x4e699a[_0x8257('0x1e')]?_[_0x8257('0x1f')](_0x4e699a[_0x8257('0x1e')],function(_0x51db62){return{'model':db[_0x51db62['model']],'as':_0x51db62['as'],'attributes':_0x51db62[_0x8257('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8257('0xc')](function(_0x4a6a6f){logger[_0x8257('0xd')](_0x8257('0x18'),_0x26f368);logger[_0x8257('0xf')]('GetCmHopperBlack',_0x26f368,JSON[_0x8257('0x11')](_0x4a6a6f));_0x5db4c9(_0x4a6a6f);})['catch'](function(_0x47e843){logger[_0x8257('0x12')]('GetCmHopperBlack',_0x47e843[_0x8257('0x14')],_0x26f368);_0xe8bec9(_0x19ad33['error'](0x1f4,_0x47e843[_0x8257('0x14')]));});});};exports[_0x8257('0x21')]=function(_0x488c43){var _0x107447=this;return new Promise(function(_0x1e0510,_0x485d3a){return db[_0x8257('0x19')][_0x8257('0x22')](_0x488c43[_0x8257('0x23')],{'raw':_0x488c43[_0x8257('0x1b')]?_0x488c43[_0x8257('0x1b')][_0x8257('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x488c43[_0x8257('0x1b')]?_0x488c43['options']['where']||null:null,'attributes':_0x488c43['options']?_0x488c43['options'][_0x8257('0x1d')]||null:null,'limit':_0x488c43['options']?_0x488c43[_0x8257('0x1b')]['limit']||null:null})[_0x8257('0xc')](function(_0x11bd40){logger[_0x8257('0xd')](_0x8257('0x21'),_0x488c43);logger[_0x8257('0xf')](_0x8257('0x21'),_0x488c43,JSON[_0x8257('0x11')](_0x11bd40));_0x1e0510(_0x11bd40);})[_0x8257('0x17')](function(_0x4cc6ed){logger[_0x8257('0x12')]('UpdateCmHopperBlack',_0x4cc6ed[_0x8257('0x14')],_0x488c43);_0x485d3a(_0x107447[_0x8257('0x12')](0x1f4,_0x4cc6ed['message']));});});};exports[_0x8257('0x24')]=function(_0x255f84){var _0xc56642=this;return new Promise(function(_0x6a487c,_0x32d6f9){return db[_0x8257('0x19')][_0x8257('0x25')]({'where':_0x255f84['options']?_0x255f84[_0x8257('0x1b')][_0x8257('0x26')]||null:null})[_0x8257('0xc')](function(_0xb16f89){logger[_0x8257('0xd')]('DestroyCmHopperBlack',_0x255f84);logger['debug'](_0x8257('0x24'),_0x255f84,JSON[_0x8257('0x11')](_0xb16f89));_0x6a487c(_0xb16f89);})[_0x8257('0x17')](function(_0x310fc7){logger[_0x8257('0x12')](_0x8257('0x24'),_0x310fc7['message'],_0x255f84);_0x32d6f9(_0xc56642[_0x8257('0x12')](0x1f4,_0x310fc7[_0x8257('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 5052742..a33915f 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 _0x3c6c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','put','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x647b,_0x3c1fa3){var _0x22de87=function(_0x20312c){while(--_0x20312c){_0x647b['push'](_0x647b['shift']());}};_0x22de87(++_0x3c1fa3);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x535bdc,_0x24868d){_0x535bdc=_0x535bdc-0x0;var _0x36f727=_0x3c6c[_0x535bdc];return _0x36f727;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require('util');var path=require(_0xc3c6('0x1'));var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require(_0xc3c6('0x5'));var auth=require(_0xc3c6('0x6'));var interaction=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var controller=require('./cmHopperBlack.controller');router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller['show']);router[_0xc3c6('0xd')](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xe')]);router['delete'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5430=['path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports','multer','util'];(function(_0x26c0ed,_0x541ba7){var _0x5c9212=function(_0x291fd5){while(--_0x291fd5){_0x26c0ed['push'](_0x26c0ed['shift']());}};_0x5c9212(++_0x541ba7);}(_0x5430,0x10c));var _0x0543=function(_0x5619ac,_0x110f8b){_0x5619ac=_0x5619ac-0x0;var _0x3705bc=_0x5430[_0x5619ac];return _0x3705bc;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0xe')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0xf')]);router['delete'](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0x10')]);module[_0x0543('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 931a9b0..d97b5df 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 _0xcebe=['seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x2fd138,_0x38635e){var _0x122003=function(_0x3f6644){while(--_0x3f6644){_0x2fd138['push'](_0x2fd138['shift']());}};_0x122003(++_0x38635e);}(_0xcebe,0x1b2));var _0xeceb=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xcebe[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xeceb('0x0'));var moment=require('moment');module[_0xeceb('0x1')]={'state':{'type':Sequelize[_0xeceb('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xeceb('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xeceb('0x3')]},'originatecalleridname':{'type':Sequelize[_0xeceb('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xeceb('0x4')]},'responsetime':{'type':Sequelize[_0xeceb('0x4')]},'answertime':{'type':Sequelize[_0xeceb('0x4')]},'droptime':{'type':Sequelize[_0xeceb('0x4')]},'endtime':{'type':Sequelize[_0xeceb('0x4')]},'ringtime':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xeceb('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xeceb('0x3')]},'membername':{'type':Sequelize[_0xeceb('0x3')]},'reason':{'type':Sequelize[_0xeceb('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xeceb('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xeceb('0x4')],'set':function(_0x4212b4){var _0x9f4f60=this[_0xeceb('0x5')](_0xeceb('0x6'));if(_0x9f4f60&&_0x4212b4){this[_0xeceb('0x7')](_0xeceb('0x8'),moment(_0x4212b4)[_0xeceb('0x9')](moment(_0x9f4f60),_0xeceb('0xa')));}}},'amd':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xeceb('0x4')]},'callback':{'type':Sequelize[_0xeceb('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xeceb('0x4')]},'deleted':{'type':Sequelize[_0xeceb('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xeceb('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xeceb('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xeceb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x023c=['getDataValue','setDataValue','diff','seconds','BOOLEAN','INTEGER','STRING','DATE'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x023c,0xcd));var _0xc023=function(_0x170d01,_0x2786e9){_0x170d01=_0x170d01-0x0;var _0x399765=_0x023c[_0x170d01];return _0x399765;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0xc023('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xc023('0x1')]},'scheduledat':{'type':Sequelize[_0xc023('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc023('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xc023('0x1')]},'originatecalleridname':{'type':Sequelize[_0xc023('0x1')]},'calleridnum':{'type':Sequelize[_0xc023('0x1')]},'calleridname':{'type':Sequelize[_0xc023('0x1')]},'starttime':{'type':Sequelize[_0xc023('0x2')]},'responsetime':{'type':Sequelize[_0xc023('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xc023('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xc023('0x1')]},'membername':{'type':Sequelize[_0xc023('0x1')]},'reason':{'type':Sequelize[_0xc023('0x1')]},'disposition':{'type':Sequelize[_0xc023('0x1')]},'secondDisposition':{'type':Sequelize[_0xc023('0x1')]},'thirdDisposition':{'type':Sequelize[_0xc023('0x1')]},'dispositionat':{'type':Sequelize[_0xc023('0x2')],'set':function(_0x3638e6){var _0x26c14a=this[_0xc023('0x3')]('endtime');if(_0x26c14a&&_0x3638e6){this[_0xc023('0x4')]('followuptime',moment(_0x3638e6)[_0xc023('0x5')](moment(_0x26c14a),_0xc023('0x6')));}}},'amd':{'type':Sequelize[_0xc023('0x7')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc023('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc023('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xc023('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xc023('0x2')]},'callback':{'type':Sequelize[_0xc023('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc023('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc023('0x2')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc023('0x2')]},'recallme':{'type':Sequelize[_0xc023('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xc023('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc023('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc023('0x0')],'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 e39d667..eefc210 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 _0xc4aa=['ContactId','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','phone','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','describe','uniqueid','find','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x3f3a47,_0x28f84b){var _0x57a682=function(_0x1175d3){while(--_0x1175d3){_0x3f3a47['push'](_0x3f3a47['shift']());}};_0x57a682(++_0x28f84b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')]()['then'](respondWithResult(_0x244950,null))['catch'](handleError(_0x244950,null));};exports[_0xac4a('0x23')]=function(_0x4aaeff,_0x18ae96){if(_0x4aaeff['body'][_0xac4a('0x4a')]){delete _0x4aaeff['body'][_0xac4a('0x4a')];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'uniqueid':_0x4aaeff[_0xac4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x24')](saveUpdates(_0x4aaeff[_0xac4a('0x4c')],null))[_0xac4a('0x24')](respondWithResult(_0x18ae96,null))[_0xac4a('0x44')](handleError(_0x18ae96,null));};exports[_0xac4a('0x4d')]=function(_0x138876,_0x187306,_0x4e6e19){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x138876['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')]('`state`\x20=\x203,\x201,\x20null'))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0xac4a('0x55')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db['sequelize']['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x5e')))),'answeringMachine']]})[_0xac4a('0x24')](handleEntityNotFound(_0x187306,null))['then'](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x5f')]=function(_0x568ffb,_0x3bcae2,_0x3c2f84){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'CampaignId':_0x568ffb['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn']('COUNT',db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x60')))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x61')))),_0xac4a('0x55')],[db['sequelize']['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5e')))),_0xac4a('0x62')]]})[_0xac4a('0x24')](handleEntityNotFound(_0x3bcae2,null))['then'](respondWithResult(_0x3bcae2,null))[_0xac4a('0x44')](handleError(_0x3bcae2,null));};exports[_0xac4a('0x63')]=function(_0x26bd31,_0x231932,_0x513976){return db[_0xac4a('0x64')]['find']({'where':{'id':_0x26bd31[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x231932,null))['then'](function(_0x5bd95b){var _0x17eac2;if(_0x5bd95b){_0x17eac2=squel[_0xac4a('0x65')]()[_0xac4a('0x66')]('cm_hopper')[_0xac4a('0x67')](['phone',_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x69'),'createdAt',_0xac4a('0x6a')],squel['select']()[_0xac4a('0x6b')](_0xac4a('0x6c'),'phone')[_0xac4a('0x6b')]('NOW()',_0xac4a('0x68'))[_0xac4a('0x6b')]('ANY_VALUE(ContactId)',_0xac4a('0x6d'))['field']('ANY_VALUE(ListId)',_0xac4a('0x6e'))['field'](_0xac4a('0x6f'),'VoiceQueueId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')]('NOW()','updatedAt')[_0xac4a('0x72')](_0xac4a('0x73'))['where']('VoiceQueueId\x20=\x20?',_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x75'),_0x26bd31[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))['where'](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')]('phone')[_0xac4a('0x72')](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id']['toString']()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x7d')))[_0xac4a('0x7e')]('ContactId'))[_0xac4a('0x74')]();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x17eac2);}return[];})[_0xac4a('0x24')](respondWithResult(_0x231932,null))['catch'](handleError(_0x231932,null));};exports[_0xac4a('0x7f')]=function(_0x56a934,_0x4447b5,_0x22b718){return db['Campaign']['find']({'where':{'id':_0x56a934[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x4447b5,null))[_0xac4a('0x24')](function(_0x4bb03d){var _0x1f3f1c;if(_0x4bb03d){_0x1f3f1c=squel['insert']()[_0xac4a('0x66')](_0xac4a('0x7a'))[_0xac4a('0x67')]([_0xac4a('0x80'),_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x81'),_0xac4a('0x71'),_0xac4a('0x6a')],squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x6c'),_0xac4a('0x80'))[_0xac4a('0x6b')]('NOW()','scheduledAt')[_0xac4a('0x6b')](_0xac4a('0x82'),_0xac4a('0x6d'))[_0xac4a('0x6b')](_0xac4a('0x83'),_0xac4a('0x6e'))[_0xac4a('0x6b')](_0xac4a('0x84'),'CampaignId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')](_0xac4a('0x70'),_0xac4a('0x6a'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where'](_0xac4a('0x75'),_0x56a934[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()['field'](_0xac4a('0x80'))['from'](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel['select']()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))[_0xac4a('0x3d')]('CampaignId\x20=\x20?',_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where']('state\x20=\x204'))[_0xac4a('0x7e')](_0xac4a('0x6d')))['toString']();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x1f3f1c);}return[];})[_0xac4a('0x24')](respondWithResult(_0x4447b5,null))[_0xac4a('0x44')](handleError(_0x4447b5,null));};exports[_0xac4a('0x86')]=function(_0x34787c,_0x599775,_0xbdff4b){return db[_0xac4a('0x87')][_0xac4a('0x88')]({'where':{'VoiceQueueId':_0x34787c['body'][_0xac4a('0x69')],'CampaignId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x81')],'ContactId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x6d')]}})[_0xac4a('0x24')](handleEntityNotFound(_0x599775,null))['then'](function(_0xe84bf7){if(_0xe84bf7){return _0xe84bf7;}return null;})[_0xac4a('0x24')](respondWithResult(_0x599775,null))['catch'](handleError(_0x599775,null));}; \ No newline at end of file +var _0x7a54=['calleridnum\x20NOT\x20IN\x20(?)','calleridnum','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','findOne','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','CmHopperFinal','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL'];(function(_0x326ea9,_0x317141){var _0x5c33ef=function(_0x2650df){while(--_0x2650df){_0x326ea9['push'](_0x326ea9['shift']());}};_0x5c33ef(++_0x317141);}(_0x7a54,0x106));var _0x47a5=function(_0x10c82b,_0x14fe13){_0x10c82b=_0x10c82b-0x0;var _0x578152=_0x7a54[_0x10c82b];return _0x578152;};'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['CmHopperFinal'][_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['CmHopperFinal']['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['describe']=function(_0x2d38de,_0x23bb04){return db['CmHopperFinal']['describe']()[_0x47a5('0x23')](respondWithResult(_0x23bb04,null))['catch'](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0xd93e37,_0x54c35f){if(_0xd93e37['body'][_0x47a5('0x47')]){delete _0xd93e37['body'][_0x47a5('0x47')];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'uniqueid':_0xd93e37[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x54c35f,null))[_0x47a5('0x23')](saveUpdates(_0xd93e37[_0x47a5('0x48')],null))['then'](respondWithResult(_0x54c35f,null))['catch'](handleError(_0x54c35f,null));};exports[_0x47a5('0x49')]=function(_0x411230,_0x1163e3,_0x9ea93e){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x411230[_0x47a5('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4c')))),'noSuchContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4d')))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x47a5('0x50')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x52')))),'dropContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x47a5('0x53')))),'abandonedContacts'],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x55')))),_0x47a5('0x56')]]})['then'](handleEntityNotFound(_0x1163e3,null))[_0x47a5('0x23')](respondWithResult(_0x1163e3,null))[_0x47a5('0x46')](handleError(_0x1163e3,null));};exports[_0x47a5('0x57')]=function(_0x5a33b8,_0x30ea7a,_0x4db625){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'CampaignId':_0x5a33b8[_0x47a5('0x41')]['id']},'attributes':[[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x58')))),'busyContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x59')))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x52')))),_0x47a5('0x5a')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize'][_0x47a5('0x4f')](_0x47a5('0x53')))),_0x47a5('0x5b')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x5c')))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x47a5('0x56')]]})[_0x47a5('0x23')](handleEntityNotFound(_0x30ea7a,null))[_0x47a5('0x23')](respondWithResult(_0x30ea7a,null))['catch'](handleError(_0x30ea7a,null));};exports[_0x47a5('0x5d')]=function(_0x2e46af,_0x36c67,_0x26f1ac){return db['VoiceQueue'][_0x47a5('0x45')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x43f649){var _0x4cf7c5;if(_0x43f649){_0x4cf7c5=squel[_0x47a5('0x5e')]()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery'](['phone','scheduledAt',_0x47a5('0x61'),_0x47a5('0x62'),_0x47a5('0x63'),_0x47a5('0x64'),'updatedAt'],squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x67'),_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6a'))[_0x47a5('0x66')](_0x47a5('0x6b'),_0x47a5('0x61'))[_0x47a5('0x66')](_0x47a5('0x6c'),'ListId')[_0x47a5('0x66')]('ANY_VALUE(VoiceQueueId)',_0x47a5('0x63'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6d'))[_0x47a5('0x6e')](_0x47a5('0x6f'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x72'),_0x2e46af['body']['state']['toString']())['where'](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x68'))[_0x47a5('0x6e')](_0x47a5('0x60'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')](_0x47a5('0x74'),squel['select']()[_0x47a5('0x66')](_0x47a5('0x75'))[_0x47a5('0x6e')]('cm_hopper_final')[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')]('state\x20=\x204'))['group'](_0x47a5('0x61')))[_0x47a5('0x71')]();return db[_0x47a5('0x4b')][_0x47a5('0x2f')](_0x4cf7c5);}return[];})[_0x47a5('0x23')](respondWithResult(_0x36c67,null))[_0x47a5('0x46')](handleError(_0x36c67,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x592322,_0x3e0dbd,_0x4f2361){return db[_0x47a5('0x76')][_0x47a5('0x45')]({'where':{'id':_0x592322[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x3e0dbd,null))['then'](function(_0x3c66e3){var _0x550bde;if(_0x3c66e3){_0x550bde=squel['insert']()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery']([_0x47a5('0x68'),_0x47a5('0x6a'),_0x47a5('0x61'),'ListId',_0x47a5('0x77'),'createdAt',_0x47a5('0x6d')],squel[_0x47a5('0x65')]()[_0x47a5('0x66')]('ANY_VALUE(calleridnum)',_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),'scheduledAt')[_0x47a5('0x66')]('ANY_VALUE(ContactId)',_0x47a5('0x61'))['field'](_0x47a5('0x6c'),_0x47a5('0x62'))[_0x47a5('0x66')](_0x47a5('0x78'),'CampaignId')[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),'updatedAt')['from'](_0x47a5('0x6f'))['where'](_0x47a5('0x79'),_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())['where'](_0x47a5('0x72'),_0x592322[_0x47a5('0x48')]['state'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x47a5('0x66')](_0x47a5('0x68'))['from'](_0x47a5('0x60'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()['field'](_0x47a5('0x75'))['from'](_0x47a5('0x6f'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')](_0x47a5('0x7a')))[_0x47a5('0x7b')](_0x47a5('0x61')))['toString']();return db[_0x47a5('0x4b')]['query'](_0x550bde);}return[];})['then'](respondWithResult(_0x3e0dbd,null))[_0x47a5('0x46')](handleError(_0x3e0dbd,null));};exports[_0x47a5('0x7c')]=function(_0x352238,_0x96fb22,_0x380c8b){return db['CmHopper'][_0x47a5('0x7d')]({'where':{'VoiceQueueId':_0x352238[_0x47a5('0x48')][_0x47a5('0x63')],'CampaignId':_0x352238[_0x47a5('0x48')]['CampaignId'],'ContactId':_0x352238[_0x47a5('0x48')]['ContactId']}})[_0x47a5('0x23')](handleEntityNotFound(_0x96fb22,null))[_0x47a5('0x23')](function(_0x3f93f0){if(_0x3f93f0){return _0x3f93f0;}return null;})[_0x47a5('0x23')](respondWithResult(_0x96fb22,null))[_0x47a5('0x46')](handleError(_0x96fb22,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 60da711..facb6fe 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 _0x28a0=['define','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x28a0,0xad));var _0x028a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x28a0[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x028a('0x0'));var util=require('util');var logger=require(_0x028a('0x1'))(_0x028a('0x2'));var moment=require('moment');var BPromise=require(_0x028a('0x3'));var rp=require(_0x028a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x028a('0x5'));var config=require(_0x028a('0x6'));var attributes=require(_0x028a('0x7'));module[_0x028a('0x8')]=function(_0x2a60e6,_0x43195d){return _0x2a60e6[_0x028a('0x9')]('CmHopperFinal',attributes,{'tableName':_0x028a('0xa'),'paranoid':![],'indexes':[{'name':_0x028a('0xb'),'fields':[_0x028a('0xb')]},{'name':_0x028a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9f=['util','api','moment','bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x2b9082,_0x68949b){var _0xed2c7e=function(_0x59e53f){while(--_0x59e53f){_0x2b9082['push'](_0x2b9082['shift']());}};_0xed2c7e(++_0x68949b);}(_0x0a9f,0xdc));var _0xf0a9=function(_0x2b41cd,_0x2b4d13){_0x2b41cd=_0x2b41cd-0x0;var _0x4d021b=_0x0a9f[_0x2b41cd];return _0x4d021b;};'use strict';var _=require(_0xf0a9('0x0'));var util=require(_0xf0a9('0x1'));var logger=require('../../config/logger')(_0xf0a9('0x2'));var moment=require(_0xf0a9('0x3'));var BPromise=require(_0xf0a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf0a9('0x5'));var config=require(_0xf0a9('0x6'));var attributes=require(_0xf0a9('0x7'));module[_0xf0a9('0x8')]=function(_0xe7dc0c,_0x325c36){return _0xe7dc0c[_0xf0a9('0x9')]('CmHopperFinal',attributes,{'tableName':_0xf0a9('0xa'),'paranoid':![],'indexes':[{'name':_0xf0a9('0xb'),'fields':[_0xf0a9('0xb')]},{'name':_0xf0a9('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 0e1aa5c..72ec4a7 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(_0x384217,_0x2b6539){var _0x5ba1ba=function(_0x1832e6){while(--_0x1832e6){_0x384217['push'](_0x384217['shift']());}};_0x5ba1ba(++_0x2b6539);}(_0x7a54,0x106));var _0x47a5=function(_0x43da19,_0x6bfb47){_0x43da19=_0x43da19-0x0;var _0x4ac756=_0x7a54[_0x43da19];return _0x4ac756;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x45bfdb,_0x108688){var _0x2861b5=function(_0x502b7c){while(--_0x502b7c){_0x45bfdb['push'](_0x45bfdb['shift']());}};_0x2861b5(++_0x108688);}(_0x7a54,0x106));var _0x47a5=function(_0x47d73e,_0x5981ee){_0x47d73e=_0x47d73e-0x0;var _0x243e6d=_0x7a54[_0x47d73e];return _0x243e6d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 070f53a..3e17b85 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 _0x429a=['get','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','put','update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated'];(function(_0x47ee6b,_0x1b3906){var _0x1780c5=function(_0x513118){while(--_0x513118){_0x47ee6b['push'](_0x47ee6b['shift']());}};_0x1780c5(++_0x1b3906);}(_0x429a,0x116));var _0xa429=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x429a[_0x71b765];return _0x34cb24;};'use strict';var multer=require(_0xa429('0x0'));var util=require(_0xa429('0x1'));var path=require(_0xa429('0x2'));var timeout=require(_0xa429('0x3'));var express=require('express');var router=express[_0xa429('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa429('0x5'));var interaction=require(_0xa429('0x6'));var config=require(_0xa429('0x7'));var controller=require(_0xa429('0x8'));router['get']('/',auth[_0xa429('0x9')](),controller['index']);router['get']('/describe',auth[_0xa429('0x9')](),controller['describe']);router[_0xa429('0xa')](_0xa429('0xb'),auth[_0xa429('0x9')](),controller[_0xa429('0xc')]);router[_0xa429('0xa')](_0xa429('0xd'),auth[_0xa429('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xa429('0xe'),auth[_0xa429('0x9')](),controller[_0xa429('0xf')]);router[_0xa429('0x10')](_0xa429('0x11'),auth[_0xa429('0x9')](),controller[_0xa429('0x12')]);router[_0xa429('0x10')](_0xa429('0x13'),auth[_0xa429('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xa429('0x10')](_0xa429('0x14'),auth[_0xa429('0x9')](),controller['checkContactHopper']);router[_0xa429('0x15')](_0xa429('0xb'),auth['isAuthenticated'](),controller[_0xa429('0x16')]);module[_0xa429('0x17')]=router; \ No newline at end of file +var _0xa43b=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','describe','/:id'];(function(_0x337f26,_0xd19a64){var _0x29598d=function(_0xde551f){while(--_0xde551f){_0x337f26['push'](_0x337f26['shift']());}};_0x29598d(++_0xd19a64);}(_0xa43b,0x174));var _0xba43=function(_0x268272,_0x39812b){_0x268272=_0x268272-0x0;var _0x520845=_0xa43b[_0x268272];return _0x520845;};'use strict';var multer=require(_0xba43('0x0'));var util=require(_0xba43('0x1'));var path=require(_0xba43('0x2'));var timeout=require(_0xba43('0x3'));var express=require('express');var router=express[_0xba43('0x4')]();var fs_extra=require(_0xba43('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba43('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xba43('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xba43('0x7')](_0xba43('0x8'),auth[_0xba43('0x9')](),controller[_0xba43('0xa')]);router[_0xba43('0x7')](_0xba43('0xb'),auth[_0xba43('0x9')](),controller['show']);router[_0xba43('0x7')]('/voice/queue/countAttributes/:id',auth[_0xba43('0x9')](),controller[_0xba43('0xc')]);router[_0xba43('0x7')](_0xba43('0xd'),auth[_0xba43('0x9')](),controller[_0xba43('0xe')]);router[_0xba43('0xf')](_0xba43('0x10'),auth[_0xba43('0x9')](),controller[_0xba43('0x11')]);router[_0xba43('0xf')](_0xba43('0x12'),auth[_0xba43('0x9')](),controller[_0xba43('0x13')]);router[_0xba43('0xf')](_0xba43('0x14'),auth[_0xba43('0x9')](),controller[_0xba43('0x15')]);router[_0xba43('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xba43('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ae6e01b..153c886 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 _0xf5ec=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x29ddc9,_0x199f64){var _0x31def5=function(_0x14aed8){while(--_0x14aed8){_0x29ddc9['push'](_0x29ddc9['shift']());}};_0x31def5(++_0x199f64);}(_0xf5ec,0x165));var _0xcf5e=function(_0x4384c0,_0x41e746){_0x4384c0=_0x4384c0-0x0;var _0x910021=_0xf5ec[_0x4384c0];return _0x910021;};'use strict';var Sequelize=require(_0xcf5e('0x0'));module[_0xcf5e('0x1')]={'state':{'type':Sequelize[_0xcf5e('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xcf5e('0x3')]},'countbusyretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcf5e('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xcf5e('0x4')]},'originatecalleridname':{'type':Sequelize[_0xcf5e('0x4')]},'calleridnum':{'type':Sequelize[_0xcf5e('0x4')]},'calleridname':{'type':Sequelize[_0xcf5e('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcf5e('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xcf5e('0x3')]},'endtime':{'type':Sequelize[_0xcf5e('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcf5e('0x4')]},'campaign':{'type':Sequelize[_0xcf5e('0x4')]},'campaigntype':{'type':Sequelize[_0xcf5e('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xcf5e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcf5e('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcf5e('0x3')]},'recallme':{'type':Sequelize[_0xcf5e('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcf5e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcd6f=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x1486bc,_0x204e1f){var _0x4009e1=function(_0x1c6fdb){while(--_0x1c6fdb){_0x1486bc['push'](_0x1486bc['shift']());}};_0x4009e1(++_0x204e1f);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x3484bf,_0x284123){_0x3484bf=_0x3484bf-0x0;var _0x3de249=_0xcd6f[_0x3484bf];return _0x3de249;};'use strict';var Sequelize=require(_0xfcd6('0x0'));module[_0xfcd6('0x1')]={'state':{'type':Sequelize[_0xfcd6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfcd6('0x3')]},'scheduledat':{'type':Sequelize[_0xfcd6('0x4')]},'countbusyretry':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfcd6('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xfcd6('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfcd6('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xfcd6('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfcd6('0x4')]},'droptime':{'type':Sequelize[_0xfcd6('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xfcd6('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfcd6('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfcd6('0x4')]},'recallme':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfcd6('0x4')]},'edited':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfcd6('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfcd6('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 3465208..4612c63 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 _0x7084=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','create','body','describe','uniqueid','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_0x7084,0x118));var _0x4708=function(_0x8eac2f,_0x5f08e){_0x8eac2f=_0x8eac2f-0x0;var _0x5f5cd9=_0x7084[_0x8eac2f];return _0x5f5cd9;};'use strict';var emlformat=require(_0x4708('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4708('0x1'));var jsonpatch=require(_0x4708('0x2'));var rp=require(_0x4708('0x3'));var moment=require(_0x4708('0x4'));var BPromise=require(_0x4708('0x5'));var Mustache=require('mustache');var util=require(_0x4708('0x6'));var path=require('path');var sox=require(_0x4708('0x7'));var csv=require('to-csv');var ejs=require(_0x4708('0x8'));var fs=require('fs');var fs_extra=require(_0x4708('0x9'));var _=require(_0x4708('0xa'));var squel=require(_0x4708('0xb'));var crypto=require(_0x4708('0xc'));var jsforce=require(_0x4708('0xd'));var deskjs=require(_0x4708('0xe'));var toCsv=require(_0x4708('0xf'));var querystring=require(_0x4708('0x10'));var Papa=require(_0x4708('0x11'));var Redis=require(_0x4708('0x12'));var authService=require(_0x4708('0x13'));var qs=require(_0x4708('0x14'));var as=require(_0x4708('0x15'));var hardwareService=require(_0x4708('0x16'));var logger=require(_0x4708('0x17'))(_0x4708('0x18'));var utils=require(_0x4708('0x19'));var config=require(_0x4708('0x1a'));var licenseUtil=require(_0x4708('0x1b'));var db=require(_0x4708('0x1c'))['db'];function respondWithStatusCode(_0x300d78,_0x25f22a){_0x25f22a=_0x25f22a||0xcc;return function(_0x231785){if(_0x231785){return _0x300d78[_0x4708('0x1d')](_0x25f22a);}return _0x300d78[_0x4708('0x1e')](_0x25f22a)['end']();};}function respondWithResult(_0x34029a,_0x8d5a5f){_0x8d5a5f=_0x8d5a5f||0xc8;return function(_0x3dd093){if(_0x3dd093){return _0x34029a[_0x4708('0x1e')](_0x8d5a5f)[_0x4708('0x1f')](_0x3dd093);}};}function respondWithFilteredResult(_0x1ecc4b,_0xd46b39){return function(_0x4e0bb6){if(_0x4e0bb6){var _0x3eb6eb=typeof _0xd46b39['offset']===_0x4708('0x20')&&typeof _0xd46b39[_0x4708('0x21')]===_0x4708('0x20');var _0x23d80a=_0x4e0bb6[_0x4708('0x22')];var _0x4e1c6b=_0x3eb6eb?0x0:_0xd46b39[_0x4708('0x23')];var _0x1a12ab=_0x3eb6eb?_0x4e0bb6[_0x4708('0x22')]:_0xd46b39[_0x4708('0x23')]+_0xd46b39[_0x4708('0x21')];var _0x33b779;if(_0x1a12ab>=_0x23d80a){_0x1a12ab=_0x23d80a;_0x33b779=0xc8;}else{_0x33b779=0xce;}_0x1ecc4b['status'](_0x33b779);return _0x1ecc4b['set'](_0x4708('0x24'),_0x4e1c6b+'-'+_0x1a12ab+'/'+_0x23d80a)[_0x4708('0x1f')](_0x4e0bb6);}return null;};}function patchUpdates(_0x40e9f4){return function(_0x29856a){try{jsonpatch[_0x4708('0x25')](_0x29856a,_0x40e9f4,!![]);}catch(_0xd7646f){return BPromise[_0x4708('0x26')](_0xd7646f);}return _0x29856a[_0x4708('0x27')]();};}function saveUpdates(_0x445150,_0x4a7052){return function(_0x4a1f4f){if(_0x4a1f4f){return _0x4a1f4f[_0x4708('0x28')](_0x445150)[_0x4708('0x29')](function(_0x372ae5){return _0x372ae5;});}return null;};}function removeEntity(_0x4d0de8,_0xa22189){return function(_0xb7b826){if(_0xb7b826){return _0xb7b826[_0x4708('0x2a')]()[_0x4708('0x29')](function(){_0x4d0de8[_0x4708('0x1e')](0xcc)[_0x4708('0x2b')]();});}};}function handleEntityNotFound(_0x4517c9,_0x4b0a48){return function(_0x3db434){if(!_0x3db434){_0x4517c9[_0x4708('0x1d')](0x194);}return _0x3db434;};}function handleError(_0x9b22a4,_0x59fce4){_0x59fce4=_0x59fce4||0x1f4;return function(_0x24daed){logger['error'](_0x24daed[_0x4708('0x2c')]);if(_0x24daed[_0x4708('0x2d')]){delete _0x24daed[_0x4708('0x2d')];}_0x9b22a4[_0x4708('0x1e')](_0x59fce4)[_0x4708('0x2e')](_0x24daed);};}exports[_0x4708('0x2f')]=function(_0x467ea5,_0x43e12b){var _0x1fb418={},_0x1c3d08={},_0x48ee67={'count':0x0,'rows':[]};var _0x4ef40a=_['map'](db[_0x4708('0x30')][_0x4708('0x31')],function(_0x49bc6a){return{'name':_0x49bc6a[_0x4708('0x32')],'type':_0x49bc6a[_0x4708('0x33')][_0x4708('0x34')]};});_0x1c3d08[_0x4708('0x35')]=_[_0x4708('0x36')](_0x4ef40a,_0x4708('0x2d'));_0x1c3d08[_0x4708('0x37')]=_['keys'](_0x467ea5[_0x4708('0x37')]);_0x1c3d08[_0x4708('0x38')]=_[_0x4708('0x39')](_0x1c3d08[_0x4708('0x35')],_0x1c3d08[_0x4708('0x37')]);_0x1fb418[_0x4708('0x3a')]=_[_0x4708('0x39')](_0x1c3d08['model'],qs['fields'](_0x467ea5[_0x4708('0x37')][_0x4708('0x3b')]));_0x1fb418[_0x4708('0x3a')]=_0x1fb418[_0x4708('0x3a')][_0x4708('0x3c')]?_0x1fb418[_0x4708('0x3a')]:_0x1c3d08[_0x4708('0x35')];if(!_0x467ea5[_0x4708('0x37')][_0x4708('0x3d')](_0x4708('0x3e'))){_0x1fb418[_0x4708('0x21')]=qs[_0x4708('0x21')](_0x467ea5[_0x4708('0x37')][_0x4708('0x21')]);_0x1fb418[_0x4708('0x23')]=qs['offset'](_0x467ea5[_0x4708('0x37')]['offset']);}_0x1fb418[_0x4708('0x3f')]=qs[_0x4708('0x40')](_0x467ea5[_0x4708('0x37')][_0x4708('0x40')]);_0x1fb418[_0x4708('0x41')]=qs[_0x4708('0x38')](_[_0x4708('0x42')](_0x467ea5[_0x4708('0x37')],_0x1c3d08[_0x4708('0x38')]),_0x4ef40a);if(_0x467ea5[_0x4708('0x37')][_0x4708('0x43')]){_0x1fb418[_0x4708('0x41')]=_[_0x4708('0x44')](_0x1fb418['where'],{'$or':_[_0x4708('0x36')](_0x4ef40a,function(_0x3b9a42){if(_0x3b9a42[_0x4708('0x33')]!==_0x4708('0x45')){var _0x5af139={};_0x5af139[_0x3b9a42[_0x4708('0x2d')]]={'$like':'%'+_0x467ea5['query']['filter']+'%'};return _0x5af139;}})});}_0x1fb418=_[_0x4708('0x44')]({},_0x1fb418,_0x467ea5['options']);var _0x4fd7ec={'where':_0x1fb418[_0x4708('0x41')]};return db['CmHopperHistory']['count'](_0x4fd7ec)['then'](function(_0x304fc8){_0x48ee67[_0x4708('0x22')]=_0x304fc8;if(_0x467ea5['query'][_0x4708('0x46')]){_0x1fb418[_0x4708('0x47')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4708('0x48')](_0x1fb418);})[_0x4708('0x29')](function(_0x14497e){_0x48ee67[_0x4708('0x49')]=_0x14497e;return _0x48ee67;})[_0x4708('0x29')](respondWithFilteredResult(_0x43e12b,_0x1fb418))[_0x4708('0x4a')](handleError(_0x43e12b,null));};exports[_0x4708('0x4b')]=function(_0x3f3dd2,_0x250102){var _0xde4924={'raw':!![],'where':{'id':_0x3f3dd2[_0x4708('0x4c')]['id']}},_0x2ff18d={};_0x2ff18d[_0x4708('0x35')]=_[_0x4708('0x4d')](db[_0x4708('0x30')][_0x4708('0x31')]);_0x2ff18d[_0x4708('0x37')]=_['keys'](_0x3f3dd2['query']);_0x2ff18d[_0x4708('0x38')]=_[_0x4708('0x39')](_0x2ff18d[_0x4708('0x35')],_0x2ff18d['query']);_0xde4924[_0x4708('0x3a')]=_[_0x4708('0x39')](_0x2ff18d[_0x4708('0x35')],qs['fields'](_0x3f3dd2[_0x4708('0x37')][_0x4708('0x3b')]));_0xde4924[_0x4708('0x3a')]=_0xde4924[_0x4708('0x3a')][_0x4708('0x3c')]?_0xde4924['attributes']:_0x2ff18d[_0x4708('0x35')];if(_0x3f3dd2[_0x4708('0x37')]['includeAll']){_0xde4924[_0x4708('0x47')]=[{'all':!![]}];}_0xde4924=_[_0x4708('0x44')]({},_0xde4924,_0x3f3dd2['options']);return db['CmHopperHistory']['find'](_0xde4924)[_0x4708('0x29')](handleEntityNotFound(_0x250102,null))['then'](respondWithResult(_0x250102,null))[_0x4708('0x4a')](handleError(_0x250102,null));};exports[_0x4708('0x4e')]=function(_0x380d07,_0x1e9400){return db[_0x4708('0x30')][_0x4708('0x4e')](_0x380d07[_0x4708('0x4f')],{})[_0x4708('0x29')](respondWithResult(_0x1e9400,0xc9))[_0x4708('0x4a')](handleError(_0x1e9400,null));};exports[_0x4708('0x50')]=function(_0x57afe8,_0x48e697){return db['CmHopperHistory'][_0x4708('0x50')]()['then'](respondWithResult(_0x48e697,null))[_0x4708('0x4a')](handleError(_0x48e697,null));};exports[_0x4708('0x28')]=function(_0xa9efc8,_0x288175){if(_0xa9efc8['body'][_0x4708('0x51')]){delete _0xa9efc8[_0x4708('0x4f')][_0x4708('0x51')];}return db[_0x4708('0x30')][_0x4708('0x52')]({'where':{'uniqueid':_0xa9efc8['params']['id']}})[_0x4708('0x29')](handleEntityNotFound(_0x288175,null))['then'](saveUpdates(_0xa9efc8[_0x4708('0x4f')],null))[_0x4708('0x29')](respondWithResult(_0x288175,null))['catch'](handleError(_0x288175,null));}; \ No newline at end of file +var _0x9ca8=['params','include','create','body','describe','uniqueid','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','map','CmHopperHistory','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x337e12,_0x3cb52c){var _0x38e547=function(_0xa6d7e4){while(--_0xa6d7e4){_0x337e12['push'](_0x337e12['shift']());}};_0x38e547(++_0x3cb52c);}(_0x9ca8,0x174));var _0x89ca=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0x9ca8[_0x587ba2];return _0x50ec73;};'use strict';var emlformat=require(_0x89ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89ca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89ca('0x2'));var moment=require(_0x89ca('0x3'));var BPromise=require(_0x89ca('0x4'));var Mustache=require(_0x89ca('0x5'));var util=require(_0x89ca('0x6'));var path=require(_0x89ca('0x7'));var sox=require('sox');var csv=require(_0x89ca('0x8'));var ejs=require(_0x89ca('0x9'));var fs=require('fs');var fs_extra=require(_0x89ca('0xa'));var _=require('lodash');var squel=require(_0x89ca('0xb'));var crypto=require(_0x89ca('0xc'));var jsforce=require(_0x89ca('0xd'));var deskjs=require(_0x89ca('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x89ca('0xf'));var Redis=require(_0x89ca('0x10'));var authService=require(_0x89ca('0x11'));var qs=require(_0x89ca('0x12'));var as=require(_0x89ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x89ca('0x14'));var utils=require(_0x89ca('0x15'));var config=require(_0x89ca('0x16'));var licenseUtil=require(_0x89ca('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22be40,_0x436355){_0x436355=_0x436355||0xcc;return function(_0x457592){if(_0x457592){return _0x22be40['sendStatus'](_0x436355);}return _0x22be40[_0x89ca('0x18')](_0x436355)[_0x89ca('0x19')]();};}function respondWithResult(_0x36622c,_0x32bebd){_0x32bebd=_0x32bebd||0xc8;return function(_0xed0241){if(_0xed0241){return _0x36622c['status'](_0x32bebd)[_0x89ca('0x1a')](_0xed0241);}};}function respondWithFilteredResult(_0x20dbc2,_0x57e809){return function(_0x17b414){if(_0x17b414){var _0x3d463b=typeof _0x57e809[_0x89ca('0x1b')]===_0x89ca('0x1c')&&typeof _0x57e809[_0x89ca('0x1d')]===_0x89ca('0x1c');var _0x4aa0b9=_0x17b414['count'];var _0x55e0e9=_0x3d463b?0x0:_0x57e809[_0x89ca('0x1b')];var _0x2efc8d=_0x3d463b?_0x17b414[_0x89ca('0x1e')]:_0x57e809['offset']+_0x57e809[_0x89ca('0x1d')];var _0x258ea3;if(_0x2efc8d>=_0x4aa0b9){_0x2efc8d=_0x4aa0b9;_0x258ea3=0xc8;}else{_0x258ea3=0xce;}_0x20dbc2[_0x89ca('0x18')](_0x258ea3);return _0x20dbc2[_0x89ca('0x1f')](_0x89ca('0x20'),_0x55e0e9+'-'+_0x2efc8d+'/'+_0x4aa0b9)['json'](_0x17b414);}return null;};}function patchUpdates(_0x38208c){return function(_0x306ef8){try{jsonpatch[_0x89ca('0x21')](_0x306ef8,_0x38208c,!![]);}catch(_0x1f7d66){return BPromise[_0x89ca('0x22')](_0x1f7d66);}return _0x306ef8['save']();};}function saveUpdates(_0x32245e,_0x352873){return function(_0x233529){if(_0x233529){return _0x233529[_0x89ca('0x23')](_0x32245e)[_0x89ca('0x24')](function(_0x51ad67){return _0x51ad67;});}return null;};}function removeEntity(_0x49ea87,_0xcc7a78){return function(_0x178c10){if(_0x178c10){return _0x178c10[_0x89ca('0x25')]()[_0x89ca('0x24')](function(){_0x49ea87[_0x89ca('0x18')](0xcc)[_0x89ca('0x19')]();});}};}function handleEntityNotFound(_0x4a457d,_0x1b34ba){return function(_0x49dd0){if(!_0x49dd0){_0x4a457d['sendStatus'](0x194);}return _0x49dd0;};}function handleError(_0x413d0b,_0x1dd851){_0x1dd851=_0x1dd851||0x1f4;return function(_0x47f16e){logger[_0x89ca('0x26')](_0x47f16e['stack']);if(_0x47f16e[_0x89ca('0x27')]){delete _0x47f16e[_0x89ca('0x27')];}_0x413d0b[_0x89ca('0x18')](_0x1dd851)['send'](_0x47f16e);};}exports['index']=function(_0x172b05,_0x18e6fb){var _0x402143={},_0x2760a7={},_0x439eac={'count':0x0,'rows':[]};var _0x5ceeaf=_[_0x89ca('0x28')](db[_0x89ca('0x29')][_0x89ca('0x2a')],function(_0x52d750){return{'name':_0x52d750['fieldName'],'type':_0x52d750['type'][_0x89ca('0x2b')]};});_0x2760a7[_0x89ca('0x2c')]=_[_0x89ca('0x28')](_0x5ceeaf,_0x89ca('0x27'));_0x2760a7[_0x89ca('0x2d')]=_[_0x89ca('0x2e')](_0x172b05[_0x89ca('0x2d')]);_0x2760a7[_0x89ca('0x2f')]=_[_0x89ca('0x30')](_0x2760a7[_0x89ca('0x2c')],_0x2760a7[_0x89ca('0x2d')]);_0x402143[_0x89ca('0x31')]=_[_0x89ca('0x30')](_0x2760a7[_0x89ca('0x2c')],qs[_0x89ca('0x32')](_0x172b05[_0x89ca('0x2d')][_0x89ca('0x32')]));_0x402143['attributes']=_0x402143[_0x89ca('0x31')][_0x89ca('0x33')]?_0x402143[_0x89ca('0x31')]:_0x2760a7[_0x89ca('0x2c')];if(!_0x172b05[_0x89ca('0x2d')][_0x89ca('0x34')](_0x89ca('0x35'))){_0x402143[_0x89ca('0x1d')]=qs['limit'](_0x172b05[_0x89ca('0x2d')][_0x89ca('0x1d')]);_0x402143[_0x89ca('0x1b')]=qs[_0x89ca('0x1b')](_0x172b05[_0x89ca('0x2d')]['offset']);}_0x402143['order']=qs[_0x89ca('0x36')](_0x172b05['query'][_0x89ca('0x36')]);_0x402143['where']=qs[_0x89ca('0x2f')](_[_0x89ca('0x37')](_0x172b05[_0x89ca('0x2d')],_0x2760a7[_0x89ca('0x2f')]),_0x5ceeaf);if(_0x172b05[_0x89ca('0x2d')][_0x89ca('0x38')]){_0x402143[_0x89ca('0x39')]=_[_0x89ca('0x3a')](_0x402143[_0x89ca('0x39')],{'$or':_[_0x89ca('0x28')](_0x5ceeaf,function(_0x599c85){if(_0x599c85[_0x89ca('0x3b')]!==_0x89ca('0x3c')){var _0xc09989={};_0xc09989[_0x599c85[_0x89ca('0x27')]]={'$like':'%'+_0x172b05[_0x89ca('0x2d')]['filter']+'%'};return _0xc09989;}})});}_0x402143=_[_0x89ca('0x3a')]({},_0x402143,_0x172b05[_0x89ca('0x3d')]);var _0x2ce025={'where':_0x402143['where']};return db['CmHopperHistory'][_0x89ca('0x1e')](_0x2ce025)[_0x89ca('0x24')](function(_0x5af299){_0x439eac[_0x89ca('0x1e')]=_0x5af299;if(_0x172b05[_0x89ca('0x2d')][_0x89ca('0x3e')]){_0x402143['include']=[{'all':!![]}];}return db[_0x89ca('0x29')][_0x89ca('0x3f')](_0x402143);})[_0x89ca('0x24')](function(_0x27c3da){_0x439eac[_0x89ca('0x40')]=_0x27c3da;return _0x439eac;})[_0x89ca('0x24')](respondWithFilteredResult(_0x18e6fb,_0x402143))[_0x89ca('0x41')](handleError(_0x18e6fb,null));};exports['show']=function(_0x5e7367,_0x5d89cc){var _0x34bcfb={'raw':!![],'where':{'id':_0x5e7367[_0x89ca('0x42')]['id']}},_0x4f8035={};_0x4f8035[_0x89ca('0x2c')]=_[_0x89ca('0x2e')](db[_0x89ca('0x29')][_0x89ca('0x2a')]);_0x4f8035[_0x89ca('0x2d')]=_['keys'](_0x5e7367[_0x89ca('0x2d')]);_0x4f8035[_0x89ca('0x2f')]=_[_0x89ca('0x30')](_0x4f8035[_0x89ca('0x2c')],_0x4f8035[_0x89ca('0x2d')]);_0x34bcfb[_0x89ca('0x31')]=_[_0x89ca('0x30')](_0x4f8035[_0x89ca('0x2c')],qs[_0x89ca('0x32')](_0x5e7367[_0x89ca('0x2d')][_0x89ca('0x32')]));_0x34bcfb['attributes']=_0x34bcfb[_0x89ca('0x31')][_0x89ca('0x33')]?_0x34bcfb[_0x89ca('0x31')]:_0x4f8035['model'];if(_0x5e7367[_0x89ca('0x2d')]['includeAll']){_0x34bcfb[_0x89ca('0x43')]=[{'all':!![]}];}_0x34bcfb=_[_0x89ca('0x3a')]({},_0x34bcfb,_0x5e7367[_0x89ca('0x3d')]);return db['CmHopperHistory']['find'](_0x34bcfb)['then'](handleEntityNotFound(_0x5d89cc,null))[_0x89ca('0x24')](respondWithResult(_0x5d89cc,null))[_0x89ca('0x41')](handleError(_0x5d89cc,null));};exports[_0x89ca('0x44')]=function(_0x1e4e38,_0x247388){return db[_0x89ca('0x29')][_0x89ca('0x44')](_0x1e4e38[_0x89ca('0x45')],{})[_0x89ca('0x24')](respondWithResult(_0x247388,0xc9))['catch'](handleError(_0x247388,null));};exports[_0x89ca('0x46')]=function(_0x46fe8c,_0x51fb02){return db['CmHopperHistory'][_0x89ca('0x46')]()[_0x89ca('0x24')](respondWithResult(_0x51fb02,null))[_0x89ca('0x41')](handleError(_0x51fb02,null));};exports[_0x89ca('0x23')]=function(_0x1cadc4,_0x5d4f87){if(_0x1cadc4['body'][_0x89ca('0x47')]){delete _0x1cadc4[_0x89ca('0x45')][_0x89ca('0x47')];}return db[_0x89ca('0x29')][_0x89ca('0x48')]({'where':{'uniqueid':_0x1cadc4['params']['id']}})[_0x89ca('0x24')](handleEntityNotFound(_0x5d4f87,null))[_0x89ca('0x24')](saveUpdates(_0x1cadc4[_0x89ca('0x45')],null))[_0x89ca('0x24')](respondWithResult(_0x5d4f87,null))[_0x89ca('0x41')](handleError(_0x5d4f87,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 4d972a1..f7e0881 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 _0x896e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x896e,0x1e9));var _0xe896=function(_0xd7e7f4,_0x4a1fdb){_0xd7e7f4=_0xd7e7f4-0x0;var _0x540c3d=_0x896e[_0xd7e7f4];return _0x540c3d;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[{'name':_0xe896('0xf'),'fields':['endtime']},{'name':_0xe896('0x10'),'fields':[_0xe896('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc599=['endtime','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history'];(function(_0x307bad,_0x2395a3){var _0x2cc78e=function(_0x37a0da){while(--_0x37a0da){_0x307bad['push'](_0x307bad['shift']());}};_0x2cc78e(++_0x2395a3);}(_0xc599,0x1b2));var _0x9c59=function(_0x222550,_0x3c0a0c){_0x222550=_0x222550-0x0;var _0x58ac61=_0xc599[_0x222550];return _0x58ac61;};'use strict';var _=require('lodash');var util=require(_0x9c59('0x0'));var logger=require('../../config/logger')(_0x9c59('0x1'));var moment=require(_0x9c59('0x2'));var BPromise=require(_0x9c59('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c59('0x4'));var rimraf=require(_0x9c59('0x5'));var config=require(_0x9c59('0x6'));var attributes=require(_0x9c59('0x7'));module[_0x9c59('0x8')]=function(_0x143652,_0x470ec3){return _0x143652['define']('CmHopperHistory',attributes,{'tableName':_0x9c59('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x9c59('0xa')]},{'name':'uniqueid','fields':[_0x9c59('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 0368c2a..08a3954 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 _0xd8ea=['literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','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','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','sequelize','col','predictiveIntervalTotalCalls'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xd8ea,0x1bd));var _0xad8e=function(_0xd2b0b1,_0x13acf0){_0xd2b0b1=_0xd2b0b1-0x0;var _0x1a8303=_0xd8ea[_0xd2b0b1];return _0x1a8303;};'use strict';var _=require(_0xad8e('0x0'));var util=require(_0xad8e('0x1'));var moment=require(_0xad8e('0x2'));var BPromise=require(_0xad8e('0x3'));var rs=require(_0xad8e('0x4'));var fs=require('fs');var Redis=require(_0xad8e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xad8e('0x6'));var logger=require(_0xad8e('0x7'))(_0xad8e('0x8'));var config=require('../../config/environment');var jayson=require(_0xad8e('0x9'));var client=jayson[_0xad8e('0xa')][_0xad8e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27bbcb,_0x5141d5,_0x5313f4){return new BPromise(function(_0x396cc6,_0x47627c){return client[_0xad8e('0xc')](_0x27bbcb,_0x5313f4)[_0xad8e('0xd')](function(_0xbef199){logger[_0xad8e('0xe')](_0xad8e('0xf'),_0x5141d5,_0xad8e('0x10'));logger[_0xad8e('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5141d5,_0xad8e('0x10'),JSON['stringify'](_0xbef199));if(_0xbef199[_0xad8e('0x12')]){if(_0xbef199[_0xad8e('0x12')]['code']===0x1f4){logger[_0xad8e('0x12')](_0xad8e('0xf'),_0x5141d5,_0xbef199[_0xad8e('0x12')]['message']);return _0x47627c(_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);}logger[_0xad8e('0x12')](_0xad8e('0xf'),_0x5141d5,_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);return _0x396cc6(_0xbef199[_0xad8e('0x12')][_0xad8e('0x13')]);}else{logger[_0xad8e('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x5141d5,_0xad8e('0x10'));_0x396cc6(_0xbef199['result'][_0xad8e('0x13')]);}})[_0xad8e('0x14')](function(_0x14eb38){logger[_0xad8e('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x5141d5,_0x14eb38);_0x47627c(_0x14eb38);});});}exports['CreateCmHopperHistory']=function(_0x4e7e83){var _0x6f2b1d=this;return new Promise(function(_0x549aa3,_0xba837b){return db[_0xad8e('0x15')]['create'](_0x4e7e83[_0xad8e('0x16')],{'raw':_0x4e7e83[_0xad8e('0x17')]?_0x4e7e83[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![]})[_0xad8e('0xd')](function(_0x4b3a6a){logger[_0xad8e('0xe')](_0xad8e('0x19'),_0x4e7e83);logger[_0xad8e('0x11')](_0xad8e('0x19'),_0x4e7e83,JSON['stringify'](_0x4b3a6a));_0x549aa3(_0x4b3a6a);})[_0xad8e('0x14')](function(_0x34a269){logger[_0xad8e('0x12')](_0xad8e('0x19'),_0x34a269[_0xad8e('0x13')],_0x4e7e83);_0xba837b(_0x6f2b1d[_0xad8e('0x12')](0x1f4,_0x34a269[_0xad8e('0x13')]));});});};exports[_0xad8e('0x1a')]=function(_0x39372e){var _0x22dd2a=this;return new Promise(function(_0x30aa07,_0x556ed7){return db[_0xad8e('0x15')][_0xad8e('0x1b')]({'raw':_0x39372e['options']?_0x39372e[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x39372e[_0xad8e('0x17')]?_0x39372e['options']['where']||null:null,'attributes':[[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')][_0xad8e('0x1d')]('id')),_0xad8e('0x1e')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x20')))),_0xad8e('0x21')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0xad8e('0x23')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x24')))),_0xad8e('0x25')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x26'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xad8e('0x27')))),_0xad8e('0x28')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x26'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x29')))),_0xad8e('0x2a')]]})['then'](function(_0x2951a8){logger[_0xad8e('0xe')](_0xad8e('0x1a'),_0x39372e);logger['debug']('AvgHandleTime',_0x39372e,JSON[_0xad8e('0x2b')](_0x2951a8));_0x30aa07(_0x2951a8);})[_0xad8e('0x14')](function(_0x4be6d0){logger[_0xad8e('0x12')](_0xad8e('0x1a'),_0x4be6d0['message'],_0x39372e);_0x556ed7(_0x22dd2a['error'](0x1f4,_0x4be6d0['message']));});});};exports[_0xad8e('0x2c')]=function(_0x5c92c7){var _0x3ab613=this;return new Promise(function(_0x18462d,_0x1afbd5){return db['CmHopperHistory'][_0xad8e('0x1b')]({'raw':_0x5c92c7[_0xad8e('0x17')]?_0x5c92c7[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x5c92c7[_0xad8e('0x17')]?_0x5c92c7[_0xad8e('0x17')]['where']||null:null,'attributes':[[_0xad8e('0x2d'),_0xad8e('0x2e')],[db['sequelize']['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),_0xad8e('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x30')))),_0xad8e('0x31')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x20')))),_0xad8e('0x32')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x33')))),_0xad8e('0x34')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xad8e('0x35')))),'outboundCongestionCallsDay'],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x36')))),_0xad8e('0x37')],[db['sequelize']['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x38')))),_0xad8e('0x39')],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3a')))),'outboundUnknownCallsDay'],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3b')))),_0xad8e('0x3c')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db['sequelize']['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x3d')))),'outboundOriginateFailureCallsDay'],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db['sequelize'][_0xad8e('0x1f')](_0xad8e('0x3e')))),_0xad8e('0x3f')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xad8e('0x1c')]['fn']('COUNT',db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')][_0xad8e('0x1f')](_0xad8e('0x40')))),_0xad8e('0x41')]],'group':[_0xad8e('0x2d')]})['then'](function(_0x5158d0){logger[_0xad8e('0xe')](_0xad8e('0x2c'),_0x5c92c7);logger[_0xad8e('0x11')](_0xad8e('0x2c'),_0x5c92c7,JSON[_0xad8e('0x2b')](_0x5158d0));_0x18462d(_0x5158d0);})[_0xad8e('0x14')](function(_0x22f2b6){logger[_0xad8e('0x12')](_0xad8e('0x2c'),_0x22f2b6[_0xad8e('0x13')],_0x5c92c7);_0x1afbd5(_0x3ab613[_0xad8e('0x12')](0x1f4,_0x22f2b6[_0xad8e('0x13')]));});});};exports[_0xad8e('0x42')]=function(_0x44a4b8){var _0x4e48b1=this;return new Promise(function(_0x406e74,_0x2f561d){return db[_0xad8e('0x15')][_0xad8e('0x1b')]({'raw':_0x44a4b8[_0xad8e('0x17')]?_0x44a4b8[_0xad8e('0x17')][_0xad8e('0x18')]===undefined?!![]:![]:!![],'where':_0x44a4b8['options']?_0x44a4b8['options']['where']||null:null,'attributes':[[_0xad8e('0x2d'),_0xad8e('0x2e')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['col']('id')),_0xad8e('0x43')],[db[_0xad8e('0x1c')]['fn'](_0xad8e('0x22'),db[_0xad8e('0x1c')]['fn']('IF',db[_0xad8e('0x1c')]['literal'](_0xad8e('0x20')))),'ivrAnswerCallsDay']],'group':[_0xad8e('0x2d')]})[_0xad8e('0xd')](function(_0x4a8927){logger['info'](_0xad8e('0x42'),_0x44a4b8);logger[_0xad8e('0x11')](_0xad8e('0x42'),_0x44a4b8,JSON['stringify'](_0x4a8927));_0x406e74(_0x4a8927);})[_0xad8e('0x14')](function(_0x485f37){logger[_0xad8e('0x12')](_0xad8e('0x42'),_0x485f37['message'],_0x44a4b8);_0x2f561d(_0x4e48b1['error'](0x1f4,_0x485f37[_0xad8e('0x13')]));});});}; \ No newline at end of file +var _0xca56=['outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create','body','options','CreateCmHopperHistory','AvgHandleTime','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','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'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0xca56,0xee));var _0x6ca5=function(_0x23dfce,_0x232d16){_0x23dfce=_0x23dfce-0x0;var _0x1d5c93=_0xca56[_0x23dfce];return _0x1d5c93;};'use strict';var _=require(_0x6ca5('0x0'));var util=require(_0x6ca5('0x1'));var moment=require(_0x6ca5('0x2'));var BPromise=require(_0x6ca5('0x3'));var rs=require(_0x6ca5('0x4'));var fs=require('fs');var Redis=require(_0x6ca5('0x5'));var db=require(_0x6ca5('0x6'))['db'];var utils=require(_0x6ca5('0x7'));var logger=require(_0x6ca5('0x8'))('rpc');var config=require(_0x6ca5('0x9'));var jayson=require(_0x6ca5('0xa'));var client=jayson[_0x6ca5('0xb')][_0x6ca5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x529cbe,_0x3b2f91,_0x232b31){return new BPromise(function(_0x511b48,_0x586799){return client[_0x6ca5('0xd')](_0x529cbe,_0x232b31)[_0x6ca5('0xe')](function(_0x1d5253){logger[_0x6ca5('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x3b2f91,'request\x20sent');logger[_0x6ca5('0x10')](_0x6ca5('0x11'),_0x3b2f91,_0x6ca5('0x12'),JSON[_0x6ca5('0x13')](_0x1d5253));if(_0x1d5253[_0x6ca5('0x14')]){if(_0x1d5253['error'][_0x6ca5('0x15')]===0x1f4){logger['error'](_0x6ca5('0x16'),_0x3b2f91,_0x1d5253['error']['message']);return _0x586799(_0x1d5253[_0x6ca5('0x14')]['message']);}logger['error'](_0x6ca5('0x16'),_0x3b2f91,_0x1d5253[_0x6ca5('0x14')]['message']);return _0x511b48(_0x1d5253[_0x6ca5('0x14')][_0x6ca5('0x17')]);}else{logger['info'](_0x6ca5('0x16'),_0x3b2f91,_0x6ca5('0x12'));_0x511b48(_0x1d5253[_0x6ca5('0x18')][_0x6ca5('0x17')]);}})[_0x6ca5('0x19')](function(_0x48c164){logger[_0x6ca5('0x14')](_0x6ca5('0x16'),_0x3b2f91,_0x48c164);_0x586799(_0x48c164);});});}exports['CreateCmHopperHistory']=function(_0x2b3daf){var _0xd48e56=this;return new Promise(function(_0x4fefd0,_0x100df4){return db[_0x6ca5('0x1a')][_0x6ca5('0x1b')](_0x2b3daf[_0x6ca5('0x1c')],{'raw':_0x2b3daf[_0x6ca5('0x1d')]?_0x2b3daf[_0x6ca5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x6ca5('0xe')](function(_0xc7c1cb){logger[_0x6ca5('0xf')](_0x6ca5('0x1e'),_0x2b3daf);logger[_0x6ca5('0x10')](_0x6ca5('0x1e'),_0x2b3daf,JSON[_0x6ca5('0x13')](_0xc7c1cb));_0x4fefd0(_0xc7c1cb);})[_0x6ca5('0x19')](function(_0x23c16b){logger[_0x6ca5('0x14')](_0x6ca5('0x1e'),_0x23c16b[_0x6ca5('0x17')],_0x2b3daf);_0x100df4(_0xd48e56[_0x6ca5('0x14')](0x1f4,_0x23c16b[_0x6ca5('0x17')]));});});};exports[_0x6ca5('0x1f')]=function(_0x4e2f36){var _0x16929a=this;return new Promise(function(_0x36fbf1,_0x1a7b0f){return db[_0x6ca5('0x1a')]['findAll']({'raw':_0x4e2f36[_0x6ca5('0x1d')]?_0x4e2f36[_0x6ca5('0x1d')][_0x6ca5('0x20')]===undefined?!![]:![]:!![],'where':_0x4e2f36[_0x6ca5('0x1d')]?_0x4e2f36[_0x6ca5('0x1d')][_0x6ca5('0x21')]||null:null,'attributes':[[db[_0x6ca5('0x22')]['fn']('COUNT',db[_0x6ca5('0x22')][_0x6ca5('0x23')]('id')),_0x6ca5('0x24')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db['sequelize'][_0x6ca5('0x26')](_0x6ca5('0x27')))),_0x6ca5('0x28')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x29')))),_0x6ca5('0x2a')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x2b')))),_0x6ca5('0x2c')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x2d'),db[_0x6ca5('0x22')]['fn']('IF',db['sequelize'][_0x6ca5('0x26')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x6ca5('0x2e')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x2d'),db[_0x6ca5('0x22')]['fn']('IF',db['sequelize'][_0x6ca5('0x26')](_0x6ca5('0x2f')))),_0x6ca5('0x30')]]})[_0x6ca5('0xe')](function(_0xce09fb){logger[_0x6ca5('0xf')](_0x6ca5('0x1f'),_0x4e2f36);logger[_0x6ca5('0x10')](_0x6ca5('0x1f'),_0x4e2f36,JSON['stringify'](_0xce09fb));_0x36fbf1(_0xce09fb);})[_0x6ca5('0x19')](function(_0x37aab3){logger[_0x6ca5('0x14')]('AvgHandleTime',_0x37aab3[_0x6ca5('0x17')],_0x4e2f36);_0x1a7b0f(_0x16929a[_0x6ca5('0x14')](0x1f4,_0x37aab3[_0x6ca5('0x17')]));});});};exports[_0x6ca5('0x31')]=function(_0x550a11){var _0x3d7abc=this;return new Promise(function(_0x161583,_0x353c1a){return db[_0x6ca5('0x1a')][_0x6ca5('0x32')]({'raw':_0x550a11['options']?_0x550a11[_0x6ca5('0x1d')][_0x6ca5('0x20')]===undefined?!![]:![]:!![],'where':_0x550a11[_0x6ca5('0x1d')]?_0x550a11[_0x6ca5('0x1d')]['where']||null:null,'attributes':[[_0x6ca5('0x33'),_0x6ca5('0x34')],[db[_0x6ca5('0x22')]['fn']('COUNT',db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x35')))),'outboundNoSuchCallsDay'],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db['sequelize']['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x36')))),_0x6ca5('0x37')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x27')))),_0x6ca5('0x38')],[db['sequelize']['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')]('`state`\x20=\x205,\x201,\x20null'))),_0x6ca5('0x39')],[db[_0x6ca5('0x22')]['fn']('COUNT',db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')]['literal'](_0x6ca5('0x3a')))),'outboundCongestionCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x3b')))),_0x6ca5('0x3c')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x6ca5('0x26')](_0x6ca5('0x3d')))),_0x6ca5('0x3e')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db['sequelize']['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x3f')))),_0x6ca5('0x40')],[db[_0x6ca5('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6ca5('0x22')]['literal'](_0x6ca5('0x41')))),_0x6ca5('0x42')],[db['sequelize']['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')]('`state`\x20=\x2014,\x201,\x20null'))),_0x6ca5('0x43')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x44')))),_0x6ca5('0x45')],[db['sequelize']['fn'](_0x6ca5('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x6ca5('0x26')](_0x6ca5('0x46')))),_0x6ca5('0x47')],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x48')))),_0x6ca5('0x45')],[db['sequelize']['fn'](_0x6ca5('0x25'),db['sequelize']['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x6ca5('0x49')]],'group':['campaign']})['then'](function(_0x355f77){logger[_0x6ca5('0xf')](_0x6ca5('0x31'),_0x550a11);logger['debug'](_0x6ca5('0x31'),_0x550a11,JSON[_0x6ca5('0x13')](_0x355f77));_0x161583(_0x355f77);})['catch'](function(_0x265c2b){logger['error'](_0x6ca5('0x31'),_0x265c2b[_0x6ca5('0x17')],_0x550a11);_0x353c1a(_0x3d7abc['error'](0x1f4,_0x265c2b[_0x6ca5('0x17')]));});});};exports['GetCampaignHopperHistory']=function(_0x2cce24){var _0x120c28=this;return new Promise(function(_0x467445,_0x16bc24){return db[_0x6ca5('0x1a')]['findAll']({'raw':_0x2cce24['options']?_0x2cce24['options'][_0x6ca5('0x20')]===undefined?!![]:![]:!![],'where':_0x2cce24['options']?_0x2cce24[_0x6ca5('0x1d')][_0x6ca5('0x21')]||null:null,'attributes':[[_0x6ca5('0x33'),'name'],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['col']('id')),'ivrTotalCallsDays'],[db[_0x6ca5('0x22')]['fn'](_0x6ca5('0x25'),db[_0x6ca5('0x22')]['fn']('IF',db[_0x6ca5('0x22')][_0x6ca5('0x26')](_0x6ca5('0x27')))),_0x6ca5('0x4a')]],'group':[_0x6ca5('0x33')]})['then'](function(_0x579e03){logger['info'](_0x6ca5('0x4b'),_0x2cce24);logger[_0x6ca5('0x10')]('GetCampaignHopperHistory',_0x2cce24,JSON[_0x6ca5('0x13')](_0x579e03));_0x467445(_0x579e03);})[_0x6ca5('0x19')](function(_0xe3793b){logger[_0x6ca5('0x14')](_0x6ca5('0x4b'),_0xe3793b['message'],_0x2cce24);_0x16bc24(_0x120c28[_0x6ca5('0x14')](0x1f4,_0xe3793b[_0x6ca5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index af5799a..9626db2 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 _0xa209=['./cmHopperHistory.controller','index','get','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa209,0xc0));var _0x9a20=function(_0x440ba4,_0x3b7413){_0x440ba4=_0x440ba4-0x0;var _0x17e8f5=_0xa209[_0x440ba4];return _0x17e8f5;};'use strict';var multer=require(_0x9a20('0x0'));var util=require(_0x9a20('0x1'));var path=require(_0x9a20('0x2'));var timeout=require(_0x9a20('0x3'));var express=require('express');var router=express[_0x9a20('0x4')]();var fs_extra=require(_0x9a20('0x5'));var auth=require(_0x9a20('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9a20('0x7'));var controller=require(_0x9a20('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9a20('0x9')]);router[_0x9a20('0xa')](_0x9a20('0xb'),auth['isAuthenticated'](),controller[_0x9a20('0xc')]);router[_0x9a20('0xa')](_0x9a20('0xd'),auth['isAuthenticated'](),controller[_0x9a20('0xe')]);router[_0x9a20('0xf')]('/',auth[_0x9a20('0x10')](),controller[_0x9a20('0x11')]);router[_0x9a20('0x12')](_0x9a20('0xd'),auth[_0x9a20('0x10')](),controller[_0x9a20('0x13')]);module['exports']=router; \ No newline at end of file +var _0xccc1=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','post','create','put','update','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xccc1,0x1c6));var _0x1ccc=function(_0x30c3c2,_0x330cca){_0x30c3c2=_0x30c3c2-0x0;var _0x738110=_0xccc1[_0x30c3c2];return _0x738110;};'use strict';var multer=require(_0x1ccc('0x0'));var util=require(_0x1ccc('0x1'));var path=require(_0x1ccc('0x2'));var timeout=require(_0x1ccc('0x3'));var express=require(_0x1ccc('0x4'));var router=express[_0x1ccc('0x5')]();var fs_extra=require(_0x1ccc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ccc('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0x1ccc('0x8')]('/',auth['isAuthenticated'](),controller[_0x1ccc('0x9')]);router['get'](_0x1ccc('0xa'),auth[_0x1ccc('0xb')](),controller[_0x1ccc('0xc')]);router[_0x1ccc('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1ccc('0xd')]);router[_0x1ccc('0xe')]('/',auth['isAuthenticated'](),controller[_0x1ccc('0xf')]);router[_0x1ccc('0x10')]('/:id',auth[_0x1ccc('0xb')](),controller[_0x1ccc('0x11')]);module[_0x1ccc('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 99f5b39..d76f10e 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 _0xf53f=['name','sequelize','exports','STRING'];(function(_0x4bfcb9,_0x6eb6f3){var _0x84611c=function(_0x1f6248){while(--_0x1f6248){_0x4bfcb9['push'](_0x4bfcb9['shift']());}};_0x84611c(++_0x6eb6f3);}(_0xf53f,0x8d));var _0xff53=function(_0x2499dd,_0x3ffa0d){_0x2499dd=_0x2499dd-0x0;var _0x29330e=_0xf53f[_0x2499dd];return _0x29330e;};'use strict';var Sequelize=require(_0xff53('0x0'));module[_0xff53('0x1')]={'name':{'type':Sequelize[_0xff53('0x2')],'unique':_0xff53('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xff53('0x2')]},'dialPrefix':{'type':Sequelize[_0xff53('0x2')]}}; \ No newline at end of file +var _0xf29c=['name','exports','STRING'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0xf29c,0xc7));var _0xcf29=function(_0x18592c,_0x3326d7){_0x18592c=_0x18592c-0x0;var _0xb34b76=_0xf29c[_0x18592c];return _0xb34b76;};'use strict';var Sequelize=require('sequelize');module[_0xcf29('0x0')]={'name':{'type':Sequelize[_0xcf29('0x1')],'unique':_0xcf29('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcf29('0x1')]},'dialPrefix':{'type':Sequelize[_0xcf29('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 842e017..8608eb3 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 _0x4559=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./cmList.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','CmList','type','key','model','query','filters','intersection','attributes','length','order','sort','where','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','keys','fields','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','nolimit','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','ListId','each','omit','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','writeFileSync','format','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','rawAttributes','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','hasOwnProperty','message','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0x4559,0x145));var _0x9455=function(_0x1d3e3f,_0x495ec1){_0x1d3e3f=_0x1d3e3f-0x0;var _0x3879fa=_0x4559[_0x1d3e3f];return _0x3879fa;};'use strict';var emlformat=require(_0x9455('0x0'));var rimraf=require(_0x9455('0x1'));var zipdir=require(_0x9455('0x2'));var jsonpatch=require(_0x9455('0x3'));var rp=require('request-promise');var moment=require(_0x9455('0x4'));var BPromise=require(_0x9455('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9455('0x6'));var sox=require(_0x9455('0x7'));var csv=require(_0x9455('0x8'));var ejs=require(_0x9455('0x9'));var fs=require('fs');var fs_extra=require(_0x9455('0xa'));var _=require(_0x9455('0xb'));var squel=require('squel');var crypto=require(_0x9455('0xc'));var jsforce=require(_0x9455('0xd'));var deskjs=require(_0x9455('0xe'));var toCsv=require(_0x9455('0x8'));var querystring=require(_0x9455('0xf'));var Papa=require(_0x9455('0x10'));var Redis=require(_0x9455('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9455('0x12'));var as=require(_0x9455('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9455('0x14'))(_0x9455('0x15'));var utils=require('../../config/utils');var config=require(_0x9455('0x16'));var licenseUtil=require(_0x9455('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x9455('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9455('0x19'))(new Redis(config[_0x9455('0x18')]));require(_0x9455('0x1a'))['register'](socket);function respondWithStatusCode(_0x5af34d,_0x2b2aac){_0x2b2aac=_0x2b2aac||0xcc;return function(_0x4e1f9c){if(_0x4e1f9c){return _0x5af34d['sendStatus'](_0x2b2aac);}return _0x5af34d[_0x9455('0x1b')](_0x2b2aac)[_0x9455('0x1c')]();};}function respondWithResult(_0x51d4ec,_0x15c13a){_0x15c13a=_0x15c13a||0xc8;return function(_0x10c2a0){if(_0x10c2a0){return _0x51d4ec[_0x9455('0x1b')](_0x15c13a)['json'](_0x10c2a0);}};}function respondWithFilteredResult(_0x3bda61,_0x296a06){return function(_0x5a1823){if(_0x5a1823){var _0x1f4f5f=typeof _0x296a06[_0x9455('0x1d')]===_0x9455('0x1e')&&typeof _0x296a06[_0x9455('0x1f')]==='undefined';var _0x4a4def=_0x5a1823[_0x9455('0x20')];var _0x48dce9=_0x1f4f5f?0x0:_0x296a06[_0x9455('0x1d')];var _0x4e3b17=_0x1f4f5f?_0x5a1823[_0x9455('0x20')]:_0x296a06[_0x9455('0x1d')]+_0x296a06['limit'];var _0xaff40;if(_0x4e3b17>=_0x4a4def){_0x4e3b17=_0x4a4def;_0xaff40=0xc8;}else{_0xaff40=0xce;}_0x3bda61[_0x9455('0x1b')](_0xaff40);return _0x3bda61[_0x9455('0x21')](_0x9455('0x22'),_0x48dce9+'-'+_0x4e3b17+'/'+_0x4a4def)[_0x9455('0x23')](_0x5a1823);}return null;};}function patchUpdates(_0x274743){return function(_0x2880a1){try{jsonpatch[_0x9455('0x24')](_0x2880a1,_0x274743,!![]);}catch(_0x5dda06){return BPromise[_0x9455('0x25')](_0x5dda06);}return _0x2880a1[_0x9455('0x26')]();};}function saveUpdates(_0x44b462,_0x2f22a9){return function(_0xc129f6){if(_0xc129f6){return _0xc129f6[_0x9455('0x27')](_0x44b462)[_0x9455('0x28')](function(_0x27094d){return _0x27094d;});}return null;};}function removeEntity(_0x3dddde,_0x377eac){return function(_0x146cdd){if(_0x146cdd){return _0x146cdd[_0x9455('0x29')]()[_0x9455('0x28')](function(){var _0x5b02a1=_0x146cdd[_0x9455('0x2a')]({'plain':!![]});var _0x125517=_0x9455('0x2b');return db[_0x9455('0x2c')][_0x9455('0x29')]({'where':{'type':_0x125517,'resourceId':_0x5b02a1['id']}})[_0x9455('0x28')](function(){return _0x146cdd;});})[_0x9455('0x28')](function(){_0x3dddde[_0x9455('0x1b')](0xcc)[_0x9455('0x1c')]();});}};}function handleEntityNotFound(_0x1b9465,_0x117f1f){return function(_0x51e3f0){if(!_0x51e3f0){_0x1b9465[_0x9455('0x2d')](0x194);}return _0x51e3f0;};}function handleError(_0x35e62e,_0xb9c020){_0xb9c020=_0xb9c020||0x1f4;return function(_0x47aeb3){logger[_0x9455('0x2e')](_0x47aeb3[_0x9455('0x2f')]);if(_0x47aeb3[_0x9455('0x30')]){delete _0x47aeb3['name'];}_0x35e62e['status'](_0xb9c020)[_0x9455('0x31')](_0x47aeb3);};}exports[_0x9455('0x32')]=function(_0x1df54c,_0x4adc74){var _0x59adb7={},_0x4d7b30={},_0x500ed0={'count':0x0,'rows':[]};var _0x424e0e=_['map'](db[_0x9455('0x33')]['rawAttributes'],function(_0x27138b){return{'name':_0x27138b['fieldName'],'type':_0x27138b[_0x9455('0x34')][_0x9455('0x35')]};});_0x4d7b30[_0x9455('0x36')]=_['map'](_0x424e0e,_0x9455('0x30'));_0x4d7b30[_0x9455('0x37')]=_['keys'](_0x1df54c['query']);_0x4d7b30[_0x9455('0x38')]=_[_0x9455('0x39')](_0x4d7b30['model'],_0x4d7b30[_0x9455('0x37')]);_0x59adb7[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x4d7b30[_0x9455('0x36')],qs['fields'](_0x1df54c[_0x9455('0x37')]['fields']));_0x59adb7[_0x9455('0x3a')]=_0x59adb7[_0x9455('0x3a')][_0x9455('0x3b')]?_0x59adb7[_0x9455('0x3a')]:_0x4d7b30[_0x9455('0x36')];if(!_0x1df54c['query']['hasOwnProperty']('nolimit')){_0x59adb7[_0x9455('0x1f')]=qs[_0x9455('0x1f')](_0x1df54c[_0x9455('0x37')][_0x9455('0x1f')]);_0x59adb7[_0x9455('0x1d')]=qs[_0x9455('0x1d')](_0x1df54c[_0x9455('0x37')]['offset']);}_0x59adb7[_0x9455('0x3c')]=qs[_0x9455('0x3d')](_0x1df54c[_0x9455('0x37')][_0x9455('0x3d')]);_0x59adb7[_0x9455('0x3e')]=qs[_0x9455('0x38')](_['pick'](_0x1df54c[_0x9455('0x37')],_0x4d7b30[_0x9455('0x38')]),_0x424e0e);if(_0x1df54c[_0x9455('0x37')][_0x9455('0x3f')]){_0x59adb7[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x59adb7[_0x9455('0x3e')],{'$or':_[_0x9455('0x41')](_0x424e0e,function(_0x1cd9e6){if(_0x1cd9e6[_0x9455('0x34')]!==_0x9455('0x42')){var _0x4ba78b={};_0x4ba78b[_0x1cd9e6[_0x9455('0x30')]]={'$like':'%'+_0x1df54c[_0x9455('0x37')][_0x9455('0x3f')]+'%'};return _0x4ba78b;}})});}_0x59adb7=_[_0x9455('0x40')]({},_0x59adb7,_0x1df54c['options']);var _0xa21a72={'where':_0x59adb7[_0x9455('0x3e')]};return db[_0x9455('0x33')][_0x9455('0x20')](_0xa21a72)[_0x9455('0x28')](function(_0x2ffd31){_0x500ed0[_0x9455('0x20')]=_0x2ffd31;if(_0x1df54c[_0x9455('0x37')]['includeAll']){_0x59adb7[_0x9455('0x43')]=[{'all':!![]}];}return db[_0x9455('0x33')][_0x9455('0x44')](_0x59adb7);})[_0x9455('0x28')](function(_0x3f4318){_0x500ed0[_0x9455('0x45')]=_0x3f4318;return _0x500ed0;})[_0x9455('0x28')](respondWithFilteredResult(_0x4adc74,_0x59adb7))['catch'](handleError(_0x4adc74,null));};exports[_0x9455('0x46')]=function(_0x7b6469,_0x2393ee){var _0x217002={'raw':![],'where':{'id':_0x7b6469[_0x9455('0x47')]['id']}},_0xdc1639={};_0xdc1639[_0x9455('0x36')]=_[_0x9455('0x48')](db[_0x9455('0x33')]['rawAttributes']);_0xdc1639[_0x9455('0x37')]=_[_0x9455('0x48')](_0x7b6469[_0x9455('0x37')]);_0xdc1639[_0x9455('0x38')]=_['intersection'](_0xdc1639['model'],_0xdc1639[_0x9455('0x37')]);_0x217002['attributes']=_[_0x9455('0x39')](_0xdc1639['model'],qs[_0x9455('0x49')](_0x7b6469['query']['fields']));_0x217002[_0x9455('0x3a')]=_0x217002[_0x9455('0x3a')][_0x9455('0x3b')]?_0x217002[_0x9455('0x3a')]:_0xdc1639['model'];if(_0x7b6469['query'][_0x9455('0x4a')]){_0x217002['include']=[{'all':!![]}];}_0x217002=_['merge']({},_0x217002,_0x7b6469[_0x9455('0x4b')]);return db[_0x9455('0x33')][_0x9455('0x4c')](_0x217002)[_0x9455('0x28')](handleEntityNotFound(_0x2393ee,null))[_0x9455('0x28')](respondWithResult(_0x2393ee,null))[_0x9455('0x4d')](handleError(_0x2393ee,null));};exports[_0x9455('0x4e')]=function(_0x3e98f8,_0x2db2a6){return db[_0x9455('0x33')][_0x9455('0x4e')](_0x3e98f8[_0x9455('0x4f')],{})['then'](function(_0x3048d0){var _0x1918ea=_0x3e98f8[_0x9455('0x50')]['get']({'plain':!![]});if(!_0x1918ea)throw new Error(_0x9455('0x51'));if(_0x1918ea['role']===_0x9455('0x50')){var _0x40a24b=_0x3048d0[_0x9455('0x2a')]({'plain':!![]});var _0x3f9168=_0x9455('0x2b');return db['UserProfileSection'][_0x9455('0x4c')]({'where':{'name':_0x3f9168,'userProfileId':_0x1918ea[_0x9455('0x52')]},'raw':!![]})[_0x9455('0x28')](function(_0x202ae7){if(_0x202ae7&&_0x202ae7[_0x9455('0x53')]===0x0){return db[_0x9455('0x2c')][_0x9455('0x4e')]({'name':_0x40a24b[_0x9455('0x30')],'resourceId':_0x40a24b['id'],'type':_0x202ae7[_0x9455('0x30')],'sectionId':_0x202ae7['id']},{})['then'](function(){return _0x3048d0;});}else{return _0x3048d0;}})['catch'](function(_0x291ef6){logger['error'](_0x9455('0x54'),_0x291ef6);throw _0x291ef6;});}return _0x3048d0;})[_0x9455('0x28')](respondWithResult(_0x2db2a6,0xc9))[_0x9455('0x4d')](handleError(_0x2db2a6,null));};exports[_0x9455('0x27')]=function(_0x522989,_0x4e3ae3){if(_0x522989[_0x9455('0x4f')]['id']){delete _0x522989[_0x9455('0x4f')]['id'];}return db[_0x9455('0x33')]['find']({'where':{'id':_0x522989[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x4e3ae3,null))[_0x9455('0x28')](saveUpdates(_0x522989[_0x9455('0x4f')],null))[_0x9455('0x28')](respondWithResult(_0x4e3ae3,null))[_0x9455('0x4d')](handleError(_0x4e3ae3,null));};exports[_0x9455('0x29')]=function(_0x4e4201,_0x1b0764){return db[_0x9455('0x33')]['find']({'where':{'id':_0x4e4201[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x1b0764,null))[_0x9455('0x28')](removeEntity(_0x1b0764,null))[_0x9455('0x4d')](handleError(_0x1b0764,null));};exports[_0x9455('0x55')]=function(_0xb40b74,_0x118557){return db[_0x9455('0x33')]['describe']()[_0x9455('0x28')](respondWithResult(_0x118557,null))[_0x9455('0x4d')](handleError(_0x118557,null));};exports[_0x9455('0x56')]=function(_0x520125,_0x552ad8,_0x4b4aa6){if(_0x520125['body']['id']){delete _0x520125['body']['id'];}return db[_0x9455('0x33')][_0x9455('0x4c')]({'where':{'id':_0x520125['params']['id']}})['then'](handleEntityNotFound(_0x552ad8,null))['then'](function(_0x9c2a94){if(_0x9c2a94){_0x520125[_0x9455('0x4f')]['ListId']=_0x9c2a94['id'];return db[_0x9455('0x57')][_0x9455('0x4e')](_0x520125[_0x9455('0x4f')]);}})[_0x9455('0x28')](respondWithResult(_0x552ad8,null))[_0x9455('0x4d')](handleError(_0x552ad8,null));};exports['getDispositions']=function(_0x4293ce,_0x3b2ad3,_0x2b0672){var _0x4c30c3={'raw':![],'where':{}};var _0x422e5a={};var _0x51719b={'count':0x0,'rows':[]};return db[_0x9455('0x33')][_0x9455('0x58')]({'where':{'id':_0x4293ce['params']['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x3b2ad3,null))[_0x9455('0x28')](function(_0x547d5b){if(_0x547d5b){_0x422e5a[_0x9455('0x36')]=_[_0x9455('0x48')](db[_0x9455('0x57')]['rawAttributes']);_0x422e5a['query']=_[_0x9455('0x48')](_0x4293ce[_0x9455('0x37')]);_0x422e5a[_0x9455('0x38')]=_[_0x9455('0x39')](_0x422e5a[_0x9455('0x36')],_0x422e5a[_0x9455('0x37')]);_0x4c30c3[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x422e5a[_0x9455('0x36')],qs['fields'](_0x4293ce[_0x9455('0x37')][_0x9455('0x49')]));_0x4c30c3[_0x9455('0x3a')]=_0x4c30c3[_0x9455('0x3a')][_0x9455('0x3b')]?_0x4c30c3['attributes']:_0x422e5a[_0x9455('0x36')];if(!_0x4293ce[_0x9455('0x37')]['hasOwnProperty'](_0x9455('0x59'))){_0x4c30c3[_0x9455('0x1f')]=qs[_0x9455('0x1f')](_0x4293ce[_0x9455('0x37')][_0x9455('0x1f')]);_0x4c30c3['offset']=qs[_0x9455('0x1d')](_0x4293ce['query']['offset']);}_0x4c30c3[_0x9455('0x3c')]=qs['sort'](_0x4293ce['query']['sort']);_0x4c30c3['where']=qs['filters'](_[_0x9455('0x5a')](_0x4293ce['query'],_0x422e5a['filters']));_0x4c30c3['where']['ListId']=_0x547d5b['id'];if(_0x4293ce[_0x9455('0x37')][_0x9455('0x3f')]){_0x4c30c3[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x4c30c3['where'],{'$or':_['map'](_0x4c30c3[_0x9455('0x3a')],function(_0x37a1fb){var _0x3e1f1a={};_0x3e1f1a[_0x37a1fb]={'$like':'%'+_0x4293ce[_0x9455('0x37')][_0x9455('0x3f')]+'%'};return _0x3e1f1a;})});}_0x4c30c3=_['merge']({},_0x4c30c3,_0x4293ce['options']);return db[_0x9455('0x57')]['count']({'where':_0x4c30c3[_0x9455('0x3e')]})['then'](function(_0x45630b){_0x51719b[_0x9455('0x20')]=_0x45630b;if(_0x4293ce[_0x9455('0x37')]['includeAll']){_0x4c30c3[_0x9455('0x43')]=[{'all':!![]}];}return db[_0x9455('0x57')][_0x9455('0x44')](_0x4c30c3);})[_0x9455('0x28')](function(_0xce8f){_0x51719b['rows']=_0xce8f;return _0x51719b;});}})['then'](respondWithFilteredResult(_0x3b2ad3,_0x4c30c3))[_0x9455('0x4d')](handleError(_0x3b2ad3,null));};exports[_0x9455('0x5b')]=function(_0x20d996,_0x3cc78a,_0x4f324d){return db[_0x9455('0x33')][_0x9455('0x4c')]({'where':{'id':_0x20d996['params']['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x3cc78a,null))[_0x9455('0x28')](function(_0x4162fb){if(_0x4162fb){return _0x4162fb[_0x9455('0x5b')](_0x20d996[_0x9455('0x37')][_0x9455('0x5c')]);}})[_0x9455('0x28')](respondWithStatusCode(_0x3cc78a,null))[_0x9455('0x4d')](handleError(_0x3cc78a,null));};exports[_0x9455('0x5d')]=function(_0x44af1e,_0x4f343c,_0xc77ba2){return db[_0x9455('0x33')]['find']({'where':{'id':_0x44af1e[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x4f343c,null))[_0x9455('0x28')](function(_0x5517f7){if(_0x5517f7){var _0x1be95a=[];var _0x452c43={'success':[],'errors':[]};return db[_0x9455('0x5e')]['describe']()['then'](function(_0x344017){if(_0x44af1e['body'][_0x9455('0x5f')]&&_['isArray'](_0x44af1e['body']['tags'])){if(_0x44af1e[_0x9455('0x4f')][_0x9455('0x5f')][_0x9455('0x3b')]){_0x44af1e[_0x9455('0x4f')][_0x9455('0x5f')]=_0x44af1e[_0x9455('0x4f')][_0x9455('0x5f')]['join'](';')+';';}else{_0x44af1e['body']['tags']=null;}}else{_0x44af1e[_0x9455('0x4f')][_0x9455('0x5f')]=null;}if(_0x44af1e[_0x9455('0x4f')]&&_[_0x9455('0x60')](_0x44af1e[_0x9455('0x4f')])){for(var _0x989000=0x0;_0x989000<_0x44af1e[_0x9455('0x4f')][_0x9455('0x3b')];_0x989000+=0x1){_0x44af1e[_0x9455('0x4f')][_0x989000][_0x9455('0x61')]=_0x44af1e[_0x9455('0x47')]['id'];_0x1be95a['push'](_0x44af1e[_0x9455('0x4f')][_0x989000]);}return BPromise[_0x9455('0x62')](_0x1be95a,function(_0x19a6d7){return db[_0x9455('0x5e')]['create'](_[_0x9455('0x63')](_0x19a6d7,[_0x9455('0x5c'),'id'])||{},{'fields':_['keys'](_0x344017),'raw':!![]})['then'](function(_0x1acfab){_0x452c43[_0x9455('0x64')][_0x9455('0x65')](_0x1acfab[_0x9455('0x66')]);})[_0x9455('0x4d')](function(_0x324306){_0x452c43[_0x9455('0x67')][_0x9455('0x65')]({'data':_0x19a6d7,'error':_0x324306['message']});});})[_0x9455('0x28')](function(_0x1d3097){return _0x452c43;})[_0x9455('0x4d')](function(_0x15b379){return _0x15b379;});}else{_0x4f343c[_0x9455('0x1b')](0x190)[_0x9455('0x23')]({'message':_0x9455('0x68')});}});}})[_0x9455('0x28')](respondWithResult(_0x4f343c,null))['catch'](handleError(_0x4f343c,null));};exports[_0x9455('0x69')]=function(_0x51238c,_0x299a9c,_0x15ddac){var _0x1692df;return db[_0x9455('0x33')][_0x9455('0x4c')]({'where':{'id':_0x51238c[_0x9455('0x47')]['id']},'include':[{'model':db[_0x9455('0x6a')],'as':'CustomFields'}]})[_0x9455('0x28')](handleEntityNotFound(_0x299a9c,null))[_0x9455('0x28')](function(_0x233d45){if(_0x233d45){_0x1692df=_0x233d45;return db[_0x9455('0x5e')]['rawAttributes'];}})[_0x9455('0x28')](function(_0x5a26d9){if(_0x5a26d9){var _0x129926={};var _0x23d61f={};_0x23d61f['model']=_[_0x9455('0x6b')](_[_0x9455('0x48')](_0x5a26d9),_[_0x9455('0x41')](_0x1692df[_0x9455('0x6c')],function(_0x4ea0d1){return util['format']('cf_%d',_0x4ea0d1['id']);}));_0x23d61f['query']=_[_0x9455('0x48')](_0x51238c[_0x9455('0x37')]);_0x23d61f[_0x9455('0x38')]=_[_0x9455('0x39')](_0x23d61f[_0x9455('0x36')],_0x23d61f[_0x9455('0x37')]);_0x129926[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x23d61f[_0x9455('0x36')],qs[_0x9455('0x49')](_0x51238c[_0x9455('0x37')][_0x9455('0x49')]));_0x129926[_0x9455('0x3a')]=_0x129926[_0x9455('0x3a')][_0x9455('0x3b')]?_0x129926[_0x9455('0x3a')]:_0x23d61f[_0x9455('0x36')];if(!_0x51238c[_0x9455('0x37')]['hasOwnProperty'](_0x9455('0x59'))){_0x129926['limit']=qs['limit'](_0x51238c[_0x9455('0x37')]['limit']);_0x129926[_0x9455('0x1d')]=qs[_0x9455('0x1d')](_0x51238c[_0x9455('0x37')][_0x9455('0x1d')]);}_0x129926['order']=qs[_0x9455('0x3d')](_0x51238c[_0x9455('0x37')]['sort']);_0x129926[_0x9455('0x3e')]=qs[_0x9455('0x38')](_[_0x9455('0x5a')](_0x51238c[_0x9455('0x37')],_0x23d61f['filters']));_0x129926['raw']=!![];if(_0x51238c[_0x9455('0x37')][_0x9455('0x3f')]){_0x129926[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x129926[_0x9455('0x3e')],{'$or':_[_0x9455('0x41')](_0x129926[_0x9455('0x3a')],function(_0x432b3f){var _0x44f719={};_0x44f719[_0x432b3f]={'$like':'%'+_0x51238c['query']['filter']+'%'};return _0x44f719;})});}_0x129926=_[_0x9455('0x40')]({},_0x129926,_0x51238c[_0x9455('0x4b')]);return _0x1692df[_0x9455('0x69')](_0x129926);}})[_0x9455('0x28')](respondWithResult(_0x299a9c,null))[_0x9455('0x4d')](handleError(_0x299a9c,null));};exports[_0x9455('0x6d')]=function(_0x27cbfb,_0x2f0327,_0x152956){var _0x1dc2f4;var _0x5f3c37;var _0x5a619c;var _0x4b431e=_0x27cbfb['params']['id'];csv_results=[];return db[_0x9455('0x6e')][_0x9455('0x44')]({'attributes':['id',_0x9455('0x30')],'raw':!![],'order':[_0x9455('0x6f')]})[_0x9455('0x28')](function(_0x4659f2){_0x1dc2f4=_0x4659f2;var _0x1259fa=_[_0x9455('0x48')](db[_0x9455('0x5e')]['rawAttributes']);return db['CmCustomField'][_0x9455('0x44')]({'raw':!![],'attributes':['id',_0x9455('0x70')]})[_0x9455('0x28')](function(_0x25dd2a){_0x5f3c37=_0x25dd2a;var _0x2ef6c3=squel[_0x9455('0x71')]()['fields'](_0x1259fa)[_0x9455('0x72')](_0x9455('0x73'),'c')[_0x9455('0x3e')]('c.ListId\x20=\x20?',_0x4b431e)['where'](_0x9455('0x74'))[_0x9455('0x75')]();for(var _0x1446cc=0x0;_0x1446cc<_0x5f3c37[_0x9455('0x3b')];_0x1446cc++){_0x2ef6c3['field'](_0x9455('0x76')+_0x5f3c37[_0x1446cc]['id'],_0x9455('0x77')+_0x5f3c37[_0x1446cc][_0x9455('0x70')]);}for(var _0x1446cc=0x0;_0x1446cc<_0x1dc2f4[_0x9455('0x3b')];_0x1446cc++){_0x2ef6c3[_0x9455('0x78')](squel[_0x9455('0x71')]()[_0x9455('0x78')](_0x9455('0x79'))[_0x9455('0x72')](_0x9455('0x7a'))[_0x9455('0x3e')](_0x9455('0x7b'),_0x1dc2f4[_0x1446cc]['id'])[_0x9455('0x3e')]('CmContactId\x20=\x20c.id'),_0x9455('0x7c')+_0x1dc2f4[_0x1446cc][_0x9455('0x30')]);_0x2ef6c3[_0x9455('0x78')](squel[_0x9455('0x71')]()['field'](_0x9455('0x7d'))[_0x9455('0x72')](_0x9455('0x7a'))[_0x9455('0x3e')](_0x9455('0x7b'),_0x1dc2f4[_0x1446cc]['id'])[_0x9455('0x3e')](_0x9455('0x7e')),_0x9455('0x7f')+_0x1dc2f4[_0x1446cc]['name']);}var _0x7be2ab=[];_0x7be2ab[_0x9455('0x65')](_0x2ef6c3[_0x9455('0x80')]());BPromise[_0x9455('0x62')](_0x7be2ab,handleQuery)[_0x9455('0x28')](function(_0x216727){handleQuery(_0x2ef6c3[_0x9455('0x80')]());var _0x10eb9a=csv_results[0x0];if(!_['isEmpty'](_0x10eb9a)){var _0x4c85e6=toCsv(_0x10eb9a);var _0x350c39=Date['now']();fs[_0x9455('0x81')](util[_0x9455('0x82')]('/tmp/list_%d_%s.csv',_0x4b431e,_0x350c39),_0x4c85e6);_0x2f0327[_0x9455('0x83')](_0x9455('0x84'),'attachment;\x20filename='+util['format'](_0x9455('0x85'),_0x4b431e,_0x350c39));_0x2f0327['setHeader'](_0x9455('0x86'),_0x9455('0x87'));return _0x2f0327[_0x9455('0x88')](util[_0x9455('0x82')]('/tmp/list_%d_%s.csv',_0x4b431e,_0x350c39));}else{return _0x2f0327[_0x9455('0x2d')](0xcc);}});});});};exports[_0x9455('0x89')]=function(_0x2c40d4,_0x1683ba,_0x6befb5){var _0x276f7c;delete _0x2c40d4[_0x9455('0x4f')]['id'];return db[_0x9455('0x33')][_0x9455('0x58')]({'where':{'id':_0x2c40d4[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x1683ba,null))[_0x9455('0x28')](function(_0x16db46){if(_0x16db46){return db[_0x9455('0x8a')][_0x9455('0x8b')](function(_0xd1988f){return db[_0x9455('0x6a')]['create'](_0x2c40d4[_0x9455('0x4f')],{'transaction':_0xd1988f})[_0x9455('0x28')](function(_0x2a91f3){_0x276f7c=_0x2a91f3;return _0x16db46[_0x9455('0x8c')](_0x2a91f3,{'transaction':_0xd1988f});})[_0x9455('0x28')](function(){var _0x47c0de={'type':db[_0x9455('0x8d')][_0x9455('0x8e')],'transaction':_0xd1988f};switch(_0x2c40d4[_0x9455('0x4f')][_0x9455('0x34')]){case _0x9455('0x8f'):_0x47c0de[_0x9455('0x34')]=db['Sequelize'][_0x9455('0x8e')];break;case _0x9455('0x90'):_0x47c0de[_0x9455('0x34')]=db[_0x9455('0x8d')][_0x9455('0x91')];break;case _0x9455('0x92'):_0x47c0de[_0x9455('0x34')]=db[_0x9455('0x8d')][_0x9455('0x93')];_0x47c0de[_0x9455('0x94')]=![];break;default:}return db[_0x9455('0x8a')][_0x9455('0x95')][_0x9455('0x96')](_0x9455('0x73'),util[_0x9455('0x82')](_0x9455('0x97'),_0x276f7c['id']),_0x47c0de);})[_0x9455('0x28')](function(){return _0x276f7c;});});}})[_0x9455('0x28')](respondWithResult(_0x1683ba,null))['catch'](handleError(_0x1683ba,null));};exports[_0x9455('0x98')]=function(_0x46db1c,_0x9dc020,_0x176509){var _0x29d795={};var _0x1b2359={};var _0x1b94ec;var _0x457a98;return db[_0x9455('0x33')][_0x9455('0x58')]({'where':{'id':_0x46db1c['params']['id']}})['then'](handleEntityNotFound(_0x9dc020,null))[_0x9455('0x28')](function(_0x132bfa){if(_0x132bfa){_0x1b94ec=_0x132bfa;_0x1b2359[_0x9455('0x36')]=_['keys'](db[_0x9455('0x6a')][_0x9455('0x99')]);_0x1b2359[_0x9455('0x37')]=_[_0x9455('0x48')](_0x46db1c[_0x9455('0x37')]);_0x1b2359[_0x9455('0x38')]=_[_0x9455('0x39')](_0x1b2359[_0x9455('0x36')],_0x1b2359[_0x9455('0x37')]);_0x29d795[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x1b2359[_0x9455('0x36')],qs[_0x9455('0x49')](_0x46db1c['query']['fields']));_0x29d795[_0x9455('0x3a')]=_0x29d795[_0x9455('0x3a')]['length']?_0x29d795[_0x9455('0x3a')]:_0x1b2359['model'];_0x29d795[_0x9455('0x3c')]=qs[_0x9455('0x3d')](_0x46db1c[_0x9455('0x37')][_0x9455('0x3d')]);_0x29d795[_0x9455('0x3e')]=qs[_0x9455('0x38')](_[_0x9455('0x5a')](_0x46db1c[_0x9455('0x37')],_0x1b2359[_0x9455('0x38')]));_0x29d795[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x29d795[_0x9455('0x3e')],{'$or':[{'ListId':_0x132bfa['id']},{'ListId':null}]});if(_0x46db1c[_0x9455('0x37')][_0x9455('0x3f')]){_0x29d795[_0x9455('0x3e')]=_['merge'](_0x29d795[_0x9455('0x3e')],{'$or':_[_0x9455('0x41')](_0x29d795[_0x9455('0x3a')],function(_0x253c8f){var _0x384f49={};_0x384f49[_0x253c8f]={'$like':'%'+_0x46db1c[_0x9455('0x37')][_0x9455('0x3f')]+'%'};return _0x384f49;})});}_0x29d795=_[_0x9455('0x40')]({},_0x29d795,_0x46db1c[_0x9455('0x4b')]);return db[_0x9455('0x6a')][_0x9455('0x9a')](_0x29d795);}})[_0x9455('0x28')](respondWithResult(_0x9dc020,null))[_0x9455('0x4d')](handleError(_0x9dc020,null));};exports[_0x9455('0x9b')]=function(_0x2a7d80,_0x2779ac){return db[_0x9455('0x6a')][_0x9455('0x9a')]({'where':{'ListId':null}})[_0x9455('0x28')](handleEntityNotFound(_0x2779ac,null))[_0x9455('0x28')](function(_0x2f0cc5){return _0x2f0cc5;})[_0x9455('0x28')](respondWithResult(_0x2779ac,null))[_0x9455('0x4d')](handleError(_0x2779ac,null));};exports[_0x9455('0x9c')]=function(_0x15bf2d,_0x2da533,_0x3f2e41){return db[_0x9455('0x33')]['find']({'where':{'id':_0x15bf2d[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x2da533,null))[_0x9455('0x28')](function(_0x2e68a8){if(_0x2e68a8){return _0x2e68a8[_0x9455('0x9c')](_0x15bf2d[_0x9455('0x4f')]['ids'],_['omit'](_0x15bf2d[_0x9455('0x4f')],[_0x9455('0x5c'),'id'])||{})[_0x9455('0x9d')](function(_0x230bca){for(var _0x40a51f=0x0;_0x40a51f<_0x15bf2d[_0x9455('0x4f')]['ids']['length'];_0x40a51f+=0x1){socket[_0x9455('0x9e')](_0x9455('0x9f'),{'UserId':Number(_0x15bf2d[_0x9455('0x4f')]['ids'][_0x40a51f]),'CmListId':Number(_0x15bf2d['params']['id'])});}return _0x230bca;});}})[_0x9455('0x28')](respondWithResult(_0x2da533,null))['catch'](handleError(_0x2da533,null));};exports[_0x9455('0xa0')]=function(_0x441751,_0x328372,_0x27b49f){return db[_0x9455('0x33')][_0x9455('0x4c')]({'where':{'id':_0x441751[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x328372,null))[_0x9455('0x28')](function(_0x2980a4){if(_0x2980a4){return _0x2980a4['removeAgents'](_0x441751[_0x9455('0x37')][_0x9455('0x5c')])[_0x9455('0x28')](function(){if(_['isArray'](_0x441751[_0x9455('0x37')][_0x9455('0x5c')])){for(var _0x13cee9=0x0;_0x13cee9<_0x441751[_0x9455('0x37')][_0x9455('0x5c')][_0x9455('0x3b')];_0x13cee9+=0x1){socket[_0x9455('0x9e')](_0x9455('0xa1'),{'UserId':Number(_0x441751['query'][_0x9455('0x5c')][_0x13cee9]),'CmListId':Number(_0x441751[_0x9455('0x47')]['id'])});}}else{socket['emit'](_0x9455('0xa1'),{'UserId':Number(_0x441751[_0x9455('0x37')]['ids']),'CmListId':Number(_0x441751[_0x9455('0x47')]['id'])});}});}})[_0x9455('0x28')](respondWithStatusCode(_0x328372,null))['catch'](handleError(_0x328372,null));};exports[_0x9455('0xa2')]=function(_0x57d2bd,_0x43963f,_0x4aaa27){var _0x24462d={};var _0x3fde21={};var _0x458b76;var _0x314d0a;return db[_0x9455('0x33')][_0x9455('0x58')]({'where':{'id':_0x57d2bd[_0x9455('0x47')]['id']}})[_0x9455('0x28')](handleEntityNotFound(_0x43963f,null))[_0x9455('0x28')](function(_0x548e07){if(_0x548e07){_0x458b76=_0x548e07;_0x3fde21['model']=_['keys'](db[_0x9455('0xa3')][_0x9455('0x99')]);_0x3fde21[_0x9455('0x37')]=_[_0x9455('0x48')](_0x57d2bd[_0x9455('0x37')]);_0x3fde21['filters']=_[_0x9455('0x39')](_0x3fde21['model'],_0x3fde21[_0x9455('0x37')]);_0x24462d[_0x9455('0x3a')]=_[_0x9455('0x39')](_0x3fde21[_0x9455('0x36')],qs[_0x9455('0x49')](_0x57d2bd[_0x9455('0x37')][_0x9455('0x49')]));_0x24462d[_0x9455('0x3a')]=_0x24462d[_0x9455('0x3a')][_0x9455('0x3b')]?_0x24462d[_0x9455('0x3a')]:_0x3fde21[_0x9455('0x36')];_0x24462d[_0x9455('0x3c')]=qs[_0x9455('0x3d')](_0x57d2bd[_0x9455('0x37')][_0x9455('0x3d')]);_0x24462d[_0x9455('0x3e')]=qs[_0x9455('0x38')](_[_0x9455('0x5a')](_0x57d2bd[_0x9455('0x37')],_0x3fde21[_0x9455('0x38')]));if(_0x57d2bd[_0x9455('0x37')][_0x9455('0x3f')]){_0x24462d[_0x9455('0x3e')]=_[_0x9455('0x40')](_0x24462d[_0x9455('0x3e')],{'$or':_[_0x9455('0x41')](_0x24462d[_0x9455('0x3a')],function(_0xe5257){var _0x822ec8={};_0x822ec8[_0xe5257]={'$like':'%'+_0x57d2bd[_0x9455('0x37')][_0x9455('0x3f')]+'%'};return _0x822ec8;})});}_0x24462d=_[_0x9455('0x40')]({},_0x24462d,_0x57d2bd[_0x9455('0x4b')]);return _0x458b76[_0x9455('0xa2')](_0x24462d);}})[_0x9455('0x28')](function(_0x373a97){if(_0x373a97){_0x314d0a=_0x373a97[_0x9455('0x3b')];if(!_0x57d2bd[_0x9455('0x37')][_0x9455('0xa4')](_0x9455('0x59'))){_0x24462d['limit']=qs[_0x9455('0x1f')](_0x57d2bd[_0x9455('0x37')]['limit']);_0x24462d[_0x9455('0x1d')]=qs[_0x9455('0x1d')](_0x57d2bd[_0x9455('0x37')][_0x9455('0x1d')]);}return _0x458b76[_0x9455('0xa2')](_0x24462d);}})[_0x9455('0x28')](function(_0x41d54e){if(_0x41d54e){return _0x41d54e?{'count':_0x314d0a,'rows':_0x41d54e}:null;}})['then'](respondWithResult(_0x43963f,null))[_0x9455('0x4d')](handleError(_0x43963f,null));};function handleQuery(_0x4c891a){logger['info'](_0x4c891a);return db[_0x9455('0x8a')][_0x9455('0x37')](_0x4c891a)[_0x9455('0x9d')](function(_0x1d0b02){csv_results[_0x9455('0x65')](_0x1d0b02);})[_0x9455('0x4d')](function(_0x29a681){logger[_0x9455('0x2e')](_0x29a681[_0x9455('0xa5')]);});} \ No newline at end of file +var _0x60c5=['rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','describe','addDisposition','Disposition','getDispositions','findOne','pick','ListId','rows','removeDispositions','ids','addContacts','isArray','tags','each','omit','success','dataValues','errors','push','message','getContacts','CmCustomField','CustomFields','format','cf_%d','getContactsCsv','ContactItemType','CmContact','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','customField_','alias','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description_additionalPhone_','toString','now','writeFileSync','setHeader','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','removeAgents','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','get','Lists','end','error','name','send','index','map','CmList'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x60c5,0x10f));var _0x560c=function(_0x13d56d,_0x162917){_0x13d56d=_0x13d56d-0x0;var _0x3b924d=_0x60c5[_0x13d56d];return _0x3b924d;};'use strict';var emlformat=require(_0x560c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x560c('0x1'));var jsonpatch=require(_0x560c('0x2'));var rp=require(_0x560c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x560c('0x4'));var util=require(_0x560c('0x5'));var path=require(_0x560c('0x6'));var sox=require('sox');var csv=require(_0x560c('0x7'));var ejs=require(_0x560c('0x8'));var fs=require('fs');var fs_extra=require(_0x560c('0x9'));var _=require(_0x560c('0xa'));var squel=require(_0x560c('0xb'));var crypto=require(_0x560c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x560c('0xd'));var toCsv=require(_0x560c('0x7'));var querystring=require(_0x560c('0xe'));var Papa=require(_0x560c('0xf'));var Redis=require(_0x560c('0x10'));var authService=require(_0x560c('0x11'));var qs=require(_0x560c('0x12'));var as=require(_0x560c('0x13'));var hardwareService=require(_0x560c('0x14'));var logger=require(_0x560c('0x15'))(_0x560c('0x16'));var utils=require(_0x560c('0x17'));var config=require(_0x560c('0x18'));var licenseUtil=require(_0x560c('0x19'));var db=require(_0x560c('0x1a'))['db'];var csv_results;config[_0x560c('0x1b')]=_[_0x560c('0x1c')](config['redis'],{'host':_0x560c('0x1d'),'port':0x18eb});var socket=require(_0x560c('0x1e'))(new Redis(config[_0x560c('0x1b')]));require(_0x560c('0x1f'))[_0x560c('0x20')](socket);function respondWithStatusCode(_0x2feedf,_0x3a4edc){_0x3a4edc=_0x3a4edc||0xcc;return function(_0x28fa7a){if(_0x28fa7a){return _0x2feedf[_0x560c('0x21')](_0x3a4edc);}return _0x2feedf[_0x560c('0x22')](_0x3a4edc)['end']();};}function respondWithResult(_0x264c54,_0x2f4c2a){_0x2f4c2a=_0x2f4c2a||0xc8;return function(_0xc7bcdf){if(_0xc7bcdf){return _0x264c54[_0x560c('0x22')](_0x2f4c2a)['json'](_0xc7bcdf);}};}function respondWithFilteredResult(_0x405287,_0x278ce4){return function(_0x4458df){if(_0x4458df){var _0xc6b20b=typeof _0x278ce4[_0x560c('0x23')]===_0x560c('0x24')&&typeof _0x278ce4[_0x560c('0x25')]===_0x560c('0x24');var _0x4a433b=_0x4458df[_0x560c('0x26')];var _0x1d61de=_0xc6b20b?0x0:_0x278ce4['offset'];var _0x46754e=_0xc6b20b?_0x4458df[_0x560c('0x26')]:_0x278ce4[_0x560c('0x23')]+_0x278ce4[_0x560c('0x25')];var _0x290b47;if(_0x46754e>=_0x4a433b){_0x46754e=_0x4a433b;_0x290b47=0xc8;}else{_0x290b47=0xce;}_0x405287[_0x560c('0x22')](_0x290b47);return _0x405287[_0x560c('0x27')](_0x560c('0x28'),_0x1d61de+'-'+_0x46754e+'/'+_0x4a433b)[_0x560c('0x29')](_0x4458df);}return null;};}function patchUpdates(_0x4c29e8){return function(_0x3e33de){try{jsonpatch['apply'](_0x3e33de,_0x4c29e8,!![]);}catch(_0x39b5e0){return BPromise[_0x560c('0x2a')](_0x39b5e0);}return _0x3e33de[_0x560c('0x2b')]();};}function saveUpdates(_0x5493a8,_0x1d564d){return function(_0x3b8ebe){if(_0x3b8ebe){return _0x3b8ebe['update'](_0x5493a8)['then'](function(_0x48d79a){return _0x48d79a;});}return null;};}function removeEntity(_0x8cf338,_0x4a8719){return function(_0x155bad){if(_0x155bad){return _0x155bad[_0x560c('0x2c')]()[_0x560c('0x2d')](function(){var _0x488ce9=_0x155bad[_0x560c('0x2e')]({'plain':!![]});var _0x53a44d=_0x560c('0x2f');return db['UserProfileResource'][_0x560c('0x2c')]({'where':{'type':_0x53a44d,'resourceId':_0x488ce9['id']}})[_0x560c('0x2d')](function(){return _0x155bad;});})[_0x560c('0x2d')](function(){_0x8cf338[_0x560c('0x22')](0xcc)[_0x560c('0x30')]();});}};}function handleEntityNotFound(_0x36cc85,_0x1266d7){return function(_0x14e1df){if(!_0x14e1df){_0x36cc85[_0x560c('0x21')](0x194);}return _0x14e1df;};}function handleError(_0x318b51,_0x5b1fa6){_0x5b1fa6=_0x5b1fa6||0x1f4;return function(_0x27ca91){logger[_0x560c('0x31')](_0x27ca91['stack']);if(_0x27ca91['name']){delete _0x27ca91[_0x560c('0x32')];}_0x318b51[_0x560c('0x22')](_0x5b1fa6)[_0x560c('0x33')](_0x27ca91);};}exports[_0x560c('0x34')]=function(_0x440b88,_0x447e36){var _0x2441ff={},_0x1b0616={},_0x12733a={'count':0x0,'rows':[]};var _0x47e9dd=_[_0x560c('0x35')](db[_0x560c('0x36')][_0x560c('0x37')],function(_0x556176){return{'name':_0x556176[_0x560c('0x38')],'type':_0x556176[_0x560c('0x39')]['key']};});_0x1b0616['model']=_[_0x560c('0x35')](_0x47e9dd,_0x560c('0x32'));_0x1b0616['query']=_[_0x560c('0x3a')](_0x440b88[_0x560c('0x3b')]);_0x1b0616[_0x560c('0x3c')]=_[_0x560c('0x3d')](_0x1b0616[_0x560c('0x3e')],_0x1b0616['query']);_0x2441ff[_0x560c('0x3f')]=_[_0x560c('0x3d')](_0x1b0616[_0x560c('0x3e')],qs[_0x560c('0x40')](_0x440b88[_0x560c('0x3b')][_0x560c('0x40')]));_0x2441ff[_0x560c('0x3f')]=_0x2441ff[_0x560c('0x3f')][_0x560c('0x41')]?_0x2441ff[_0x560c('0x3f')]:_0x1b0616[_0x560c('0x3e')];if(!_0x440b88[_0x560c('0x3b')][_0x560c('0x42')](_0x560c('0x43'))){_0x2441ff[_0x560c('0x25')]=qs['limit'](_0x440b88['query'][_0x560c('0x25')]);_0x2441ff['offset']=qs['offset'](_0x440b88['query'][_0x560c('0x23')]);}_0x2441ff[_0x560c('0x44')]=qs[_0x560c('0x45')](_0x440b88['query'][_0x560c('0x45')]);_0x2441ff[_0x560c('0x46')]=qs['filters'](_['pick'](_0x440b88['query'],_0x1b0616['filters']),_0x47e9dd);if(_0x440b88[_0x560c('0x3b')]['filter']){_0x2441ff[_0x560c('0x46')]=_[_0x560c('0x47')](_0x2441ff[_0x560c('0x46')],{'$or':_[_0x560c('0x35')](_0x47e9dd,function(_0x4bc5e4){if(_0x4bc5e4[_0x560c('0x39')]!==_0x560c('0x48')){var _0x2ef3ce={};_0x2ef3ce[_0x4bc5e4[_0x560c('0x32')]]={'$like':'%'+_0x440b88[_0x560c('0x3b')][_0x560c('0x49')]+'%'};return _0x2ef3ce;}})});}_0x2441ff=_[_0x560c('0x47')]({},_0x2441ff,_0x440b88[_0x560c('0x4a')]);var _0x4e52e6={'where':_0x2441ff[_0x560c('0x46')]};return db[_0x560c('0x36')][_0x560c('0x26')](_0x4e52e6)[_0x560c('0x2d')](function(_0x3fadf2){_0x12733a[_0x560c('0x26')]=_0x3fadf2;if(_0x440b88['query'][_0x560c('0x4b')]){_0x2441ff[_0x560c('0x4c')]=[{'all':!![]}];}return db[_0x560c('0x36')][_0x560c('0x4d')](_0x2441ff);})['then'](function(_0x4b76c5){_0x12733a['rows']=_0x4b76c5;return _0x12733a;})[_0x560c('0x2d')](respondWithFilteredResult(_0x447e36,_0x2441ff))[_0x560c('0x4e')](handleError(_0x447e36,null));};exports[_0x560c('0x4f')]=function(_0x1c5eed,_0x14960e){var _0x1056a5={'raw':![],'where':{'id':_0x1c5eed[_0x560c('0x50')]['id']}},_0x38cd17={};_0x38cd17[_0x560c('0x3e')]=_['keys'](db[_0x560c('0x36')][_0x560c('0x37')]);_0x38cd17['query']=_[_0x560c('0x3a')](_0x1c5eed[_0x560c('0x3b')]);_0x38cd17[_0x560c('0x3c')]=_[_0x560c('0x3d')](_0x38cd17[_0x560c('0x3e')],_0x38cd17[_0x560c('0x3b')]);_0x1056a5[_0x560c('0x3f')]=_[_0x560c('0x3d')](_0x38cd17[_0x560c('0x3e')],qs[_0x560c('0x40')](_0x1c5eed['query'][_0x560c('0x40')]));_0x1056a5[_0x560c('0x3f')]=_0x1056a5[_0x560c('0x3f')][_0x560c('0x41')]?_0x1056a5[_0x560c('0x3f')]:_0x38cd17[_0x560c('0x3e')];if(_0x1c5eed[_0x560c('0x3b')][_0x560c('0x4b')]){_0x1056a5['include']=[{'all':!![]}];}_0x1056a5=_['merge']({},_0x1056a5,_0x1c5eed['options']);return db[_0x560c('0x36')][_0x560c('0x51')](_0x1056a5)[_0x560c('0x2d')](handleEntityNotFound(_0x14960e,null))[_0x560c('0x2d')](respondWithResult(_0x14960e,null))[_0x560c('0x4e')](handleError(_0x14960e,null));};exports[_0x560c('0x52')]=function(_0x5a4fe8,_0x4d9059){return db['CmList'][_0x560c('0x52')](_0x5a4fe8[_0x560c('0x53')],{})[_0x560c('0x2d')](function(_0x51672e){var _0x2418ea=_0x5a4fe8[_0x560c('0x54')][_0x560c('0x2e')]({'plain':!![]});if(!_0x2418ea)throw new Error(_0x560c('0x55'));if(_0x2418ea[_0x560c('0x56')]===_0x560c('0x54')){var _0xe8b931=_0x51672e[_0x560c('0x2e')]({'plain':!![]});var _0x59b8c5=_0x560c('0x2f');return db[_0x560c('0x57')][_0x560c('0x51')]({'where':{'name':_0x59b8c5,'userProfileId':_0x2418ea['userProfileId']},'raw':!![]})[_0x560c('0x2d')](function(_0x301a92){if(_0x301a92&&_0x301a92[_0x560c('0x58')]===0x0){return db[_0x560c('0x59')][_0x560c('0x52')]({'name':_0xe8b931[_0x560c('0x32')],'resourceId':_0xe8b931['id'],'type':_0x301a92[_0x560c('0x32')],'sectionId':_0x301a92['id']},{})['then'](function(){return _0x51672e;});}else{return _0x51672e;}})[_0x560c('0x4e')](function(_0x4cc966){logger[_0x560c('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cc966);throw _0x4cc966;});}return _0x51672e;})[_0x560c('0x2d')](respondWithResult(_0x4d9059,0xc9))[_0x560c('0x4e')](handleError(_0x4d9059,null));};exports['update']=function(_0x34b4c1,_0x1cb55c){if(_0x34b4c1[_0x560c('0x53')]['id']){delete _0x34b4c1[_0x560c('0x53')]['id'];}return db[_0x560c('0x36')][_0x560c('0x51')]({'where':{'id':_0x34b4c1[_0x560c('0x50')]['id']}})[_0x560c('0x2d')](handleEntityNotFound(_0x1cb55c,null))[_0x560c('0x2d')](saveUpdates(_0x34b4c1[_0x560c('0x53')],null))[_0x560c('0x2d')](respondWithResult(_0x1cb55c,null))['catch'](handleError(_0x1cb55c,null));};exports[_0x560c('0x2c')]=function(_0x2fdc2b,_0x3efb79){return db[_0x560c('0x36')][_0x560c('0x51')]({'where':{'id':_0x2fdc2b[_0x560c('0x50')]['id']}})[_0x560c('0x2d')](handleEntityNotFound(_0x3efb79,null))[_0x560c('0x2d')](removeEntity(_0x3efb79,null))['catch'](handleError(_0x3efb79,null));};exports['describe']=function(_0x50f34f,_0x373f71){return db[_0x560c('0x36')][_0x560c('0x5a')]()[_0x560c('0x2d')](respondWithResult(_0x373f71,null))['catch'](handleError(_0x373f71,null));};exports[_0x560c('0x5b')]=function(_0x28d6f8,_0x142dfd,_0x1b7663){if(_0x28d6f8[_0x560c('0x53')]['id']){delete _0x28d6f8['body']['id'];}return db['CmList'][_0x560c('0x51')]({'where':{'id':_0x28d6f8[_0x560c('0x50')]['id']}})[_0x560c('0x2d')](handleEntityNotFound(_0x142dfd,null))[_0x560c('0x2d')](function(_0x311706){if(_0x311706){_0x28d6f8[_0x560c('0x53')]['ListId']=_0x311706['id'];return db[_0x560c('0x5c')][_0x560c('0x52')](_0x28d6f8[_0x560c('0x53')]);}})['then'](respondWithResult(_0x142dfd,null))[_0x560c('0x4e')](handleError(_0x142dfd,null));};exports[_0x560c('0x5d')]=function(_0x4c68da,_0x396f4a,_0x498ce9){var _0x345f64={'raw':![],'where':{}};var _0x49eeec={};var _0x34c710={'count':0x0,'rows':[]};return db['CmList'][_0x560c('0x5e')]({'where':{'id':_0x4c68da['params']['id']}})[_0x560c('0x2d')](handleEntityNotFound(_0x396f4a,null))[_0x560c('0x2d')](function(_0x52e78b){if(_0x52e78b){_0x49eeec['model']=_[_0x560c('0x3a')](db['Disposition'][_0x560c('0x37')]);_0x49eeec[_0x560c('0x3b')]=_[_0x560c('0x3a')](_0x4c68da[_0x560c('0x3b')]);_0x49eeec[_0x560c('0x3c')]=_[_0x560c('0x3d')](_0x49eeec[_0x560c('0x3e')],_0x49eeec['query']);_0x345f64[_0x560c('0x3f')]=_[_0x560c('0x3d')](_0x49eeec[_0x560c('0x3e')],qs['fields'](_0x4c68da[_0x560c('0x3b')][_0x560c('0x40')]));_0x345f64[_0x560c('0x3f')]=_0x345f64['attributes'][_0x560c('0x41')]?_0x345f64[_0x560c('0x3f')]:_0x49eeec[_0x560c('0x3e')];if(!_0x4c68da['query'][_0x560c('0x42')](_0x560c('0x43'))){_0x345f64[_0x560c('0x25')]=qs[_0x560c('0x25')](_0x4c68da['query']['limit']);_0x345f64['offset']=qs[_0x560c('0x23')](_0x4c68da[_0x560c('0x3b')][_0x560c('0x23')]);}_0x345f64[_0x560c('0x44')]=qs[_0x560c('0x45')](_0x4c68da['query'][_0x560c('0x45')]);_0x345f64[_0x560c('0x46')]=qs[_0x560c('0x3c')](_[_0x560c('0x5f')](_0x4c68da[_0x560c('0x3b')],_0x49eeec[_0x560c('0x3c')]));_0x345f64[_0x560c('0x46')][_0x560c('0x60')]=_0x52e78b['id'];if(_0x4c68da[_0x560c('0x3b')]['filter']){_0x345f64['where']=_[_0x560c('0x47')](_0x345f64[_0x560c('0x46')],{'$or':_['map'](_0x345f64[_0x560c('0x3f')],function(_0x2dd2c9){var _0x4dfc4b={};_0x4dfc4b[_0x2dd2c9]={'$like':'%'+_0x4c68da[_0x560c('0x3b')][_0x560c('0x49')]+'%'};return _0x4dfc4b;})});}_0x345f64=_[_0x560c('0x47')]({},_0x345f64,_0x4c68da[_0x560c('0x4a')]);return db[_0x560c('0x5c')]['count']({'where':_0x345f64[_0x560c('0x46')]})[_0x560c('0x2d')](function(_0x537dc5){_0x34c710[_0x560c('0x26')]=_0x537dc5;if(_0x4c68da[_0x560c('0x3b')][_0x560c('0x4b')]){_0x345f64[_0x560c('0x4c')]=[{'all':!![]}];}return db[_0x560c('0x5c')]['findAll'](_0x345f64);})['then'](function(_0x2c01a1){_0x34c710[_0x560c('0x61')]=_0x2c01a1;return _0x34c710;});}})['then'](respondWithFilteredResult(_0x396f4a,_0x345f64))[_0x560c('0x4e')](handleError(_0x396f4a,null));};exports[_0x560c('0x62')]=function(_0x39181e,_0x4661c1,_0x2a989c){return db[_0x560c('0x36')]['find']({'where':{'id':_0x39181e['params']['id']}})['then'](handleEntityNotFound(_0x4661c1,null))[_0x560c('0x2d')](function(_0xa135e1){if(_0xa135e1){return _0xa135e1['removeDispositions'](_0x39181e[_0x560c('0x3b')][_0x560c('0x63')]);}})['then'](respondWithStatusCode(_0x4661c1,null))[_0x560c('0x4e')](handleError(_0x4661c1,null));};exports[_0x560c('0x64')]=function(_0x57ba33,_0x482f24,_0xfb07e7){return db[_0x560c('0x36')][_0x560c('0x51')]({'where':{'id':_0x57ba33[_0x560c('0x50')]['id']}})['then'](handleEntityNotFound(_0x482f24,null))['then'](function(_0xc1ef16){if(_0xc1ef16){var _0x468fa7=[];var _0x5d85df={'success':[],'errors':[]};return db['CmContact'][_0x560c('0x5a')]()['then'](function(_0x55d8d4){if(_0x57ba33[_0x560c('0x53')]['tags']&&_[_0x560c('0x65')](_0x57ba33[_0x560c('0x53')][_0x560c('0x66')])){if(_0x57ba33[_0x560c('0x53')][_0x560c('0x66')][_0x560c('0x41')]){_0x57ba33[_0x560c('0x53')][_0x560c('0x66')]=_0x57ba33['body']['tags']['join'](';')+';';}else{_0x57ba33[_0x560c('0x53')][_0x560c('0x66')]=null;}}else{_0x57ba33['body']['tags']=null;}if(_0x57ba33[_0x560c('0x53')]&&_[_0x560c('0x65')](_0x57ba33[_0x560c('0x53')])){for(var _0x296fea=0x0;_0x296fea<_0x57ba33[_0x560c('0x53')][_0x560c('0x41')];_0x296fea+=0x1){_0x57ba33[_0x560c('0x53')][_0x296fea]['ListId']=_0x57ba33[_0x560c('0x50')]['id'];_0x468fa7['push'](_0x57ba33[_0x560c('0x53')][_0x296fea]);}return BPromise[_0x560c('0x67')](_0x468fa7,function(_0xc01fe9){return db['CmContact'][_0x560c('0x52')](_[_0x560c('0x68')](_0xc01fe9,[_0x560c('0x63'),'id'])||{},{'fields':_[_0x560c('0x3a')](_0x55d8d4),'raw':!![]})[_0x560c('0x2d')](function(_0x46dfe2){_0x5d85df[_0x560c('0x69')]['push'](_0x46dfe2[_0x560c('0x6a')]);})[_0x560c('0x4e')](function(_0x20ef78){_0x5d85df[_0x560c('0x6b')][_0x560c('0x6c')]({'data':_0xc01fe9,'error':_0x20ef78[_0x560c('0x6d')]});});})[_0x560c('0x2d')](function(_0x3158f3){return _0x5d85df;})['catch'](function(_0x32aa1e){return _0x32aa1e;});}else{_0x482f24[_0x560c('0x22')](0x190)[_0x560c('0x29')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x560c('0x2d')](respondWithResult(_0x482f24,null))[_0x560c('0x4e')](handleError(_0x482f24,null));};exports[_0x560c('0x6e')]=function(_0x59d625,_0x2a40aa,_0x354350){var _0x373e1f;return db[_0x560c('0x36')][_0x560c('0x51')]({'where':{'id':_0x59d625[_0x560c('0x50')]['id']},'include':[{'model':db[_0x560c('0x6f')],'as':_0x560c('0x70')}]})[_0x560c('0x2d')](handleEntityNotFound(_0x2a40aa,null))['then'](function(_0x500aac){if(_0x500aac){_0x373e1f=_0x500aac;return db['CmContact'][_0x560c('0x37')];}})[_0x560c('0x2d')](function(_0x1d3e7a){if(_0x1d3e7a){var _0x5ebc82={};var _0x558418={};_0x558418[_0x560c('0x3e')]=_['concat'](_['keys'](_0x1d3e7a),_[_0x560c('0x35')](_0x373e1f['CustomFields'],function(_0x42e9b6){return util[_0x560c('0x71')](_0x560c('0x72'),_0x42e9b6['id']);}));_0x558418[_0x560c('0x3b')]=_[_0x560c('0x3a')](_0x59d625[_0x560c('0x3b')]);_0x558418[_0x560c('0x3c')]=_[_0x560c('0x3d')](_0x558418[_0x560c('0x3e')],_0x558418[_0x560c('0x3b')]);_0x5ebc82['attributes']=_[_0x560c('0x3d')](_0x558418[_0x560c('0x3e')],qs[_0x560c('0x40')](_0x59d625[_0x560c('0x3b')][_0x560c('0x40')]));_0x5ebc82[_0x560c('0x3f')]=_0x5ebc82[_0x560c('0x3f')][_0x560c('0x41')]?_0x5ebc82['attributes']:_0x558418['model'];if(!_0x59d625[_0x560c('0x3b')]['hasOwnProperty'](_0x560c('0x43'))){_0x5ebc82[_0x560c('0x25')]=qs[_0x560c('0x25')](_0x59d625[_0x560c('0x3b')][_0x560c('0x25')]);_0x5ebc82[_0x560c('0x23')]=qs[_0x560c('0x23')](_0x59d625[_0x560c('0x3b')]['offset']);}_0x5ebc82[_0x560c('0x44')]=qs[_0x560c('0x45')](_0x59d625['query']['sort']);_0x5ebc82['where']=qs[_0x560c('0x3c')](_[_0x560c('0x5f')](_0x59d625[_0x560c('0x3b')],_0x558418['filters']));_0x5ebc82['raw']=!![];if(_0x59d625[_0x560c('0x3b')][_0x560c('0x49')]){_0x5ebc82[_0x560c('0x46')]=_['merge'](_0x5ebc82[_0x560c('0x46')],{'$or':_[_0x560c('0x35')](_0x5ebc82[_0x560c('0x3f')],function(_0x471842){var _0x437b1e={};_0x437b1e[_0x471842]={'$like':'%'+_0x59d625['query']['filter']+'%'};return _0x437b1e;})});}_0x5ebc82=_['merge']({},_0x5ebc82,_0x59d625[_0x560c('0x4a')]);return _0x373e1f[_0x560c('0x6e')](_0x5ebc82);}})[_0x560c('0x2d')](respondWithResult(_0x2a40aa,null))[_0x560c('0x4e')](handleError(_0x2a40aa,null));};exports[_0x560c('0x73')]=function(_0xa8db5b,_0x181fbe,_0x29bdec){var _0x2d7189;var _0x5759c6;var _0x4a8aa0;var _0xce578c=_0xa8db5b[_0x560c('0x50')]['id'];csv_results=[];return db[_0x560c('0x74')][_0x560c('0x4d')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})['then'](function(_0x475998){_0x2d7189=_0x475998;var _0x33afe9=_[_0x560c('0x3a')](db[_0x560c('0x75')][_0x560c('0x37')]);return db[_0x560c('0x6f')][_0x560c('0x4d')]({'raw':!![],'attributes':['id','alias']})[_0x560c('0x2d')](function(_0x2ca031){_0x5759c6=_0x2ca031;var _0x2d605f=squel[_0x560c('0x76')]()['fields'](_0x33afe9)[_0x560c('0x77')](_0x560c('0x78'),'c')[_0x560c('0x46')]('c.ListId\x20=\x20?',_0xce578c)[_0x560c('0x46')](_0x560c('0x79'))[_0x560c('0x7a')]();for(var _0x568a45=0x0;_0x568a45<_0x5759c6[_0x560c('0x41')];_0x568a45++){_0x2d605f[_0x560c('0x7b')]('c.cf_'+_0x5759c6[_0x568a45]['id'],_0x560c('0x7c')+_0x5759c6[_0x568a45][_0x560c('0x7d')]);}for(var _0x568a45=0x0;_0x568a45<_0x2d7189[_0x560c('0x41')];_0x568a45++){_0x2d605f[_0x560c('0x7b')](squel[_0x560c('0x76')]()[_0x560c('0x7b')](_0x560c('0x7e'))[_0x560c('0x77')](_0x560c('0x7f'))['where'](_0x560c('0x80'),_0x2d7189[_0x568a45]['id'])[_0x560c('0x46')](_0x560c('0x81')),_0x560c('0x82')+_0x2d7189[_0x568a45][_0x560c('0x32')]);_0x2d605f[_0x560c('0x7b')](squel[_0x560c('0x76')]()['field']('description')[_0x560c('0x77')](_0x560c('0x7f'))['where']('ItemTypeId\x20=\x20?',_0x2d7189[_0x568a45]['id'])[_0x560c('0x46')](_0x560c('0x81')),_0x560c('0x83')+_0x2d7189[_0x568a45][_0x560c('0x32')]);}var _0x52a1f1=[];_0x52a1f1[_0x560c('0x6c')](_0x2d605f[_0x560c('0x84')]());BPromise[_0x560c('0x67')](_0x52a1f1,handleQuery)[_0x560c('0x2d')](function(_0x365d37){handleQuery(_0x2d605f[_0x560c('0x84')]());var _0x40648b=csv_results[0x0];if(!_['isEmpty'](_0x40648b)){var _0x15efd5=toCsv(_0x40648b);var _0x166575=Date[_0x560c('0x85')]();fs[_0x560c('0x86')](util['format']('/tmp/list_%d_%s.csv',_0xce578c,_0x166575),_0x15efd5);_0x181fbe[_0x560c('0x87')]('Content-disposition','attachment;\x20filename='+util['format'](_0x560c('0x88'),_0xce578c,_0x166575));_0x181fbe[_0x560c('0x87')]('Content-type',_0x560c('0x89'));return _0x181fbe[_0x560c('0x8a')](util[_0x560c('0x71')](_0x560c('0x8b'),_0xce578c,_0x166575));}else{return _0x181fbe[_0x560c('0x21')](0xcc);}});});});};exports[_0x560c('0x8c')]=function(_0x43f165,_0x894bd8,_0x44a910){var _0x40eec5;delete _0x43f165[_0x560c('0x53')]['id'];return db[_0x560c('0x36')][_0x560c('0x5e')]({'where':{'id':_0x43f165[_0x560c('0x50')]['id']}})[_0x560c('0x2d')](handleEntityNotFound(_0x894bd8,null))['then'](function(_0x63c3de){if(_0x63c3de){return db[_0x560c('0x8d')][_0x560c('0x8e')](function(_0x59c56f){return db[_0x560c('0x6f')][_0x560c('0x52')](_0x43f165['body'],{'transaction':_0x59c56f})[_0x560c('0x2d')](function(_0x2e12dc){_0x40eec5=_0x2e12dc;return _0x63c3de[_0x560c('0x8f')](_0x2e12dc,{'transaction':_0x59c56f});})[_0x560c('0x2d')](function(){var _0x1a09a0={'type':db[_0x560c('0x90')][_0x560c('0x91')],'transaction':_0x59c56f};switch(_0x43f165[_0x560c('0x53')][_0x560c('0x39')]){case _0x560c('0x92'):_0x1a09a0[_0x560c('0x39')]=db[_0x560c('0x90')][_0x560c('0x91')];break;case _0x560c('0x93'):_0x1a09a0[_0x560c('0x39')]=db[_0x560c('0x90')][_0x560c('0x94')];break;case'switch':_0x1a09a0[_0x560c('0x39')]=db[_0x560c('0x90')][_0x560c('0x95')];_0x1a09a0[_0x560c('0x96')]=![];break;default:}return db['sequelize'][_0x560c('0x97')][_0x560c('0x98')]('cm_contacts',util[_0x560c('0x71')](_0x560c('0x99'),_0x40eec5['id']),_0x1a09a0);})[_0x560c('0x2d')](function(){return _0x40eec5;});});}})['then'](respondWithResult(_0x894bd8,null))[_0x560c('0x4e')](handleError(_0x894bd8,null));};exports[_0x560c('0x9a')]=function(_0x78e25b,_0x2987f5,_0x3245d){var _0x456740={};var _0xcc6fb3={};var _0x239bfc;var _0x30eea9;return db[_0x560c('0x36')][_0x560c('0x5e')]({'where':{'id':_0x78e25b[_0x560c('0x50')]['id']}})[_0x560c('0x2d')](handleEntityNotFound(_0x2987f5,null))[_0x560c('0x2d')](function(_0x21640b){if(_0x21640b){_0x239bfc=_0x21640b;_0xcc6fb3[_0x560c('0x3e')]=_[_0x560c('0x3a')](db[_0x560c('0x6f')][_0x560c('0x37')]);_0xcc6fb3[_0x560c('0x3b')]=_[_0x560c('0x3a')](_0x78e25b[_0x560c('0x3b')]);_0xcc6fb3[_0x560c('0x3c')]=_['intersection'](_0xcc6fb3['model'],_0xcc6fb3[_0x560c('0x3b')]);_0x456740['attributes']=_['intersection'](_0xcc6fb3[_0x560c('0x3e')],qs['fields'](_0x78e25b[_0x560c('0x3b')][_0x560c('0x40')]));_0x456740[_0x560c('0x3f')]=_0x456740[_0x560c('0x3f')]['length']?_0x456740[_0x560c('0x3f')]:_0xcc6fb3[_0x560c('0x3e')];_0x456740['order']=qs['sort'](_0x78e25b[_0x560c('0x3b')][_0x560c('0x45')]);_0x456740[_0x560c('0x46')]=qs[_0x560c('0x3c')](_[_0x560c('0x5f')](_0x78e25b[_0x560c('0x3b')],_0xcc6fb3[_0x560c('0x3c')]));_0x456740[_0x560c('0x46')]=_[_0x560c('0x47')](_0x456740[_0x560c('0x46')],{'$or':[{'ListId':_0x21640b['id']},{'ListId':null}]});if(_0x78e25b[_0x560c('0x3b')]['filter']){_0x456740['where']=_[_0x560c('0x47')](_0x456740[_0x560c('0x46')],{'$or':_['map'](_0x456740[_0x560c('0x3f')],function(_0x2c3068){var _0x12e0c1={};_0x12e0c1[_0x2c3068]={'$like':'%'+_0x78e25b[_0x560c('0x3b')]['filter']+'%'};return _0x12e0c1;})});}_0x456740=_[_0x560c('0x47')]({},_0x456740,_0x78e25b[_0x560c('0x4a')]);return db[_0x560c('0x6f')][_0x560c('0x9b')](_0x456740);}})[_0x560c('0x2d')](respondWithResult(_0x2987f5,null))[_0x560c('0x4e')](handleError(_0x2987f5,null));};exports[_0x560c('0x9c')]=function(_0x4c5ff8,_0x5f453e){return db[_0x560c('0x6f')]['findAndCountAll']({'where':{'ListId':null}})[_0x560c('0x2d')](handleEntityNotFound(_0x5f453e,null))[_0x560c('0x2d')](function(_0x34562e){return _0x34562e;})[_0x560c('0x2d')](respondWithResult(_0x5f453e,null))[_0x560c('0x4e')](handleError(_0x5f453e,null));};exports[_0x560c('0x9d')]=function(_0x2e74a3,_0x4a7428,_0x15fcde){return db[_0x560c('0x36')][_0x560c('0x51')]({'where':{'id':_0x2e74a3['params']['id']}})[_0x560c('0x2d')](handleEntityNotFound(_0x4a7428,null))[_0x560c('0x2d')](function(_0x18d28a){if(_0x18d28a){return _0x18d28a[_0x560c('0x9d')](_0x2e74a3['body'][_0x560c('0x63')],_['omit'](_0x2e74a3[_0x560c('0x53')],[_0x560c('0x63'),'id'])||{})[_0x560c('0x9e')](function(_0x5346fd){for(var _0x5e1bd3=0x0;_0x5e1bd3<_0x2e74a3['body'][_0x560c('0x63')][_0x560c('0x41')];_0x5e1bd3+=0x1){socket[_0x560c('0x9f')]('userCmList:save',{'UserId':Number(_0x2e74a3[_0x560c('0x53')][_0x560c('0x63')][_0x5e1bd3]),'CmListId':Number(_0x2e74a3[_0x560c('0x50')]['id'])});}return _0x5346fd;});}})[_0x560c('0x2d')](respondWithResult(_0x4a7428,null))[_0x560c('0x4e')](handleError(_0x4a7428,null));};exports[_0x560c('0xa0')]=function(_0x277f27,_0x353133,_0x45f417){return db[_0x560c('0x36')][_0x560c('0x51')]({'where':{'id':_0x277f27['params']['id']}})['then'](handleEntityNotFound(_0x353133,null))[_0x560c('0x2d')](function(_0x322b86){if(_0x322b86){return _0x322b86[_0x560c('0xa0')](_0x277f27['query'][_0x560c('0x63')])[_0x560c('0x2d')](function(){if(_[_0x560c('0x65')](_0x277f27[_0x560c('0x3b')][_0x560c('0x63')])){for(var _0x2ea266=0x0;_0x2ea266<_0x277f27['query'][_0x560c('0x63')]['length'];_0x2ea266+=0x1){socket[_0x560c('0x9f')]('userCmList:remove',{'UserId':Number(_0x277f27[_0x560c('0x3b')][_0x560c('0x63')][_0x2ea266]),'CmListId':Number(_0x277f27[_0x560c('0x50')]['id'])});}}else{socket[_0x560c('0x9f')]('userCmList:remove',{'UserId':Number(_0x277f27[_0x560c('0x3b')]['ids']),'CmListId':Number(_0x277f27[_0x560c('0x50')]['id'])});}});}})[_0x560c('0x2d')](respondWithStatusCode(_0x353133,null))['catch'](handleError(_0x353133,null));};exports['getAgents']=function(_0x6dab62,_0x283850,_0x149670){var _0x342be5={};var _0x3a75b2={};var _0x3f5a5f;var _0x4c5845;return db['CmList']['findOne']({'where':{'id':_0x6dab62[_0x560c('0x50')]['id']}})[_0x560c('0x2d')](handleEntityNotFound(_0x283850,null))[_0x560c('0x2d')](function(_0x16fd37){if(_0x16fd37){_0x3f5a5f=_0x16fd37;_0x3a75b2['model']=_['keys'](db[_0x560c('0xa1')][_0x560c('0x37')]);_0x3a75b2[_0x560c('0x3b')]=_['keys'](_0x6dab62[_0x560c('0x3b')]);_0x3a75b2[_0x560c('0x3c')]=_[_0x560c('0x3d')](_0x3a75b2[_0x560c('0x3e')],_0x3a75b2[_0x560c('0x3b')]);_0x342be5[_0x560c('0x3f')]=_[_0x560c('0x3d')](_0x3a75b2[_0x560c('0x3e')],qs[_0x560c('0x40')](_0x6dab62[_0x560c('0x3b')][_0x560c('0x40')]));_0x342be5[_0x560c('0x3f')]=_0x342be5[_0x560c('0x3f')][_0x560c('0x41')]?_0x342be5['attributes']:_0x3a75b2[_0x560c('0x3e')];_0x342be5[_0x560c('0x44')]=qs['sort'](_0x6dab62[_0x560c('0x3b')][_0x560c('0x45')]);_0x342be5[_0x560c('0x46')]=qs['filters'](_[_0x560c('0x5f')](_0x6dab62[_0x560c('0x3b')],_0x3a75b2[_0x560c('0x3c')]));if(_0x6dab62['query'][_0x560c('0x49')]){_0x342be5[_0x560c('0x46')]=_['merge'](_0x342be5['where'],{'$or':_['map'](_0x342be5[_0x560c('0x3f')],function(_0x1ebff1){var _0x112f16={};_0x112f16[_0x1ebff1]={'$like':'%'+_0x6dab62[_0x560c('0x3b')][_0x560c('0x49')]+'%'};return _0x112f16;})});}_0x342be5=_[_0x560c('0x47')]({},_0x342be5,_0x6dab62[_0x560c('0x4a')]);return _0x3f5a5f[_0x560c('0xa2')](_0x342be5);}})['then'](function(_0x407848){if(_0x407848){_0x4c5845=_0x407848['length'];if(!_0x6dab62[_0x560c('0x3b')][_0x560c('0x42')]('nolimit')){_0x342be5['limit']=qs[_0x560c('0x25')](_0x6dab62[_0x560c('0x3b')]['limit']);_0x342be5[_0x560c('0x23')]=qs[_0x560c('0x23')](_0x6dab62[_0x560c('0x3b')][_0x560c('0x23')]);}return _0x3f5a5f[_0x560c('0xa2')](_0x342be5);}})[_0x560c('0x2d')](function(_0x563455){if(_0x563455){return _0x563455?{'count':_0x4c5845,'rows':_0x563455}:null;}})[_0x560c('0x2d')](respondWithResult(_0x283850,null))[_0x560c('0x4e')](handleError(_0x283850,null));};function handleQuery(_0xc057d4){logger['info'](_0xc057d4);return db[_0x560c('0x8d')][_0x560c('0x3b')](_0xc057d4)[_0x560c('0x9e')](function(_0x1b6d00){csv_results[_0x560c('0x6c')](_0x1b6d00);})[_0x560c('0x4e')](function(_0x4003ab){logger[_0x560c('0x31')](_0x4003ab[_0x560c('0x6d')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index c9fddb3..4cb626a 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x181728,_0x471cc4){var _0x3525db=function(_0x59c05c){while(--_0x59c05c){_0x181728['push'](_0x181728['shift']());}};_0x3525db(++_0x471cc4);}(_0x814b,0x1a2));var _0xb814=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x814b[_0x17823f];return _0x51fc21;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x18e963,_0x52c89f){_0x18e963=_0x18e963-0x0;var _0x5e18df=_0x326f[_0x18e963];return _0x5e18df;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a4cad22..bd59a18 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x1233a2,_0x3f39b5){var _0x44e056=function(_0x30e79c){while(--_0x30e79c){_0x1233a2['push'](_0x1233a2['shift']());}};_0x44e056(++_0x3f39b5);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1bda3a,_0x382e0b){_0x1bda3a=_0x1bda3a-0x0;var _0x3d2c24=_0xa8a8[_0x1bda3a];return _0x3d2c24;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7a=['CmList','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xffe89e,_0x46551b){_0xffe89e=_0xffe89e-0x0;var _0x5386b1=_0x6f7a[_0xffe89e];return _0x5386b1;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 035d2f5..1e9b09a 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 _0x6957=['../../config/environment','redis','defaults','localhost','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x29bbd9,_0x1dfa51){var _0x31209f=function(_0x17156f){while(--_0x17156f){_0x29bbd9['push'](_0x29bbd9['shift']());}};_0x31209f(++_0x1dfa51);}(_0x6957,0x13d));var _0x7695=function(_0x3c3ec7,_0x1a4363){_0x3c3ec7=_0x3c3ec7-0x0;var _0x2c6b89=_0x6957[_0x3c3ec7];return _0x2c6b89;};'use strict';var _=require('lodash');var util=require(_0x7695('0x0'));var moment=require(_0x7695('0x1'));var BPromise=require(_0x7695('0x2'));var rs=require(_0x7695('0x3'));var fs=require('fs');var Redis=require(_0x7695('0x4'));var db=require(_0x7695('0x5'))['db'];var utils=require(_0x7695('0x6'));var logger=require('../../config/logger')(_0x7695('0x7'));var config=require(_0x7695('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x7695('0x9')]=_[_0x7695('0xa')](config[_0x7695('0x9')],{'host':_0x7695('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7695('0x9')]));require(_0x7695('0xc'))['register'](socket);function respondWithRpcPromise(_0xbb66c,_0x3bee8e,_0x2843cf){return new BPromise(function(_0x5303d8,_0x54cf21){return client[_0x7695('0xd')](_0xbb66c,_0x2843cf)[_0x7695('0xe')](function(_0x156614){logger[_0x7695('0xf')](_0x7695('0x10'),_0x3bee8e,_0x7695('0x11'));logger[_0x7695('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x3bee8e,_0x7695('0x11'),JSON[_0x7695('0x13')](_0x156614));if(_0x156614['error']){if(_0x156614[_0x7695('0x14')][_0x7695('0x15')]===0x1f4){logger[_0x7695('0x14')](_0x7695('0x10'),_0x3bee8e,_0x156614[_0x7695('0x14')][_0x7695('0x16')]);return _0x54cf21(_0x156614[_0x7695('0x14')]['message']);}logger[_0x7695('0x14')](_0x7695('0x10'),_0x3bee8e,_0x156614[_0x7695('0x14')][_0x7695('0x16')]);return _0x5303d8(_0x156614[_0x7695('0x14')][_0x7695('0x16')]);}else{logger[_0x7695('0xf')](_0x7695('0x10'),_0x3bee8e,'request\x20sent');_0x5303d8(_0x156614[_0x7695('0x17')][_0x7695('0x16')]);}})[_0x7695('0x18')](function(_0x15e086){logger[_0x7695('0x14')](_0x7695('0x10'),_0x3bee8e,_0x15e086);_0x54cf21(_0x15e086);});});} \ No newline at end of file +var _0xd3c5=['request','then','info','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd3c5,0x15d));var _0x5d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5d3c('0x0'));var util=require(_0x5d3c('0x1'));var moment=require(_0x5d3c('0x2'));var BPromise=require(_0x5d3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d3c('0x4'))['db'];var utils=require(_0x5d3c('0x5'));var logger=require('../../config/logger')(_0x5d3c('0x6'));var config=require('../../config/environment');var jayson=require(_0x5d3c('0x7'));var client=jayson[_0x5d3c('0x8')][_0x5d3c('0x9')]({'port':0x232a});config[_0x5d3c('0xa')]=_[_0x5d3c('0xb')](config['redis'],{'host':_0x5d3c('0xc'),'port':0x18eb});var socket=require(_0x5d3c('0xd'))(new Redis(config[_0x5d3c('0xa')]));require(_0x5d3c('0xe'))['register'](socket);function respondWithRpcPromise(_0x3e8bef,_0x3c1b4c,_0x202449){return new BPromise(function(_0x487fca,_0x3e4989){return client[_0x5d3c('0xf')](_0x3e8bef,_0x202449)[_0x5d3c('0x10')](function(_0x25dc7f){logger[_0x5d3c('0x11')]('CmList,\x20%s,\x20%s',_0x3c1b4c,'request\x20sent');logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x3c1b4c,_0x5d3c('0x12'),JSON[_0x5d3c('0x13')](_0x25dc7f));if(_0x25dc7f[_0x5d3c('0x14')]){if(_0x25dc7f[_0x5d3c('0x14')][_0x5d3c('0x15')]===0x1f4){logger[_0x5d3c('0x14')](_0x5d3c('0x16'),_0x3c1b4c,_0x25dc7f[_0x5d3c('0x14')]['message']);return _0x3e4989(_0x25dc7f[_0x5d3c('0x14')][_0x5d3c('0x17')]);}logger[_0x5d3c('0x14')]('CmList,\x20%s,\x20%s',_0x3c1b4c,_0x25dc7f[_0x5d3c('0x14')][_0x5d3c('0x17')]);return _0x487fca(_0x25dc7f['error'][_0x5d3c('0x17')]);}else{logger[_0x5d3c('0x11')](_0x5d3c('0x16'),_0x3c1b4c,'request\x20sent');_0x487fca(_0x25dc7f[_0x5d3c('0x18')][_0x5d3c('0x17')]);}})[_0x5d3c('0x19')](function(_0x44e5ed){logger[_0x5d3c('0x14')]('CmList,\x20%s,\x20%s',_0x3c1b4c,_0x44e5ed);_0x3e4989(_0x44e5ed);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0a41426..c75c331 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 _0xb9e7=['update','emit','removeListener','register','length','cmList:','./cmList.events','save','remove'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0xb9e7,0x1a4));var _0x7b9e=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0xb9e7[_0x3e0763];return _0x351ca2;};'use strict';var CmListEvents=require(_0x7b9e('0x0'));var events=[_0x7b9e('0x1'),_0x7b9e('0x2'),_0x7b9e('0x3')];function createListener(_0x5dbee4,_0xa394d2){return function(_0x36d2c3){_0xa394d2[_0x7b9e('0x4')](_0x5dbee4,_0x36d2c3);};}function removeListener(_0x2af15c,_0x5623a2){return function(){CmListEvents[_0x7b9e('0x5')](_0x2af15c,_0x5623a2);};}exports[_0x7b9e('0x6')]=function(_0x444751){for(var _0x3417ca=0x0,_0x28109a=events[_0x7b9e('0x7')];_0x3417ca<_0x28109a;_0x3417ca++){var _0x8534dc=events[_0x3417ca];var _0x23549c=createListener(_0x7b9e('0x8')+_0x8534dc,_0x444751);CmListEvents['on'](_0x8534dc,_0x23549c);}}; \ No newline at end of file +var _0x786e=['register','cmList:','save','remove','update','emit','removeListener'];(function(_0x2001b6,_0x1184a6){var _0x4446cc=function(_0xbcd05b){while(--_0xbcd05b){_0x2001b6['push'](_0x2001b6['shift']());}};_0x4446cc(++_0x1184a6);}(_0x786e,0x11a));var _0xe786=function(_0x49588f,_0x3e56ea){_0x49588f=_0x49588f-0x0;var _0x41b293=_0x786e[_0x49588f];return _0x41b293;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xe786('0x0'),_0xe786('0x1'),_0xe786('0x2')];function createListener(_0x510768,_0x5254b5){return function(_0x176b64){_0x5254b5[_0xe786('0x3')](_0x510768,_0x176b64);};}function removeListener(_0x33484c,_0x3bc313){return function(){CmListEvents[_0xe786('0x4')](_0x33484c,_0x3bc313);};}exports[_0xe786('0x5')]=function(_0x5534a9){for(var _0x169c0f=0x0,_0x269302=events['length'];_0x169c0f<_0x269302;_0x169c0f++){var _0x1fdf82=events[_0x169c0f];var _0x271941=createListener(_0xe786('0x6')+_0x1fdf82,_0x5534a9);CmListEvents['on'](_0x1fdf82,_0x271941);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 777b1ae..9388906 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 _0x996b=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','/:id','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer'];(function(_0x2c6736,_0x41de4d){var _0x9a471=function(_0x1b6549){while(--_0x1b6549){_0x2c6736['push'](_0x2c6736['shift']());}};_0x9a471(++_0x41de4d);}(_0x996b,0x9b));var _0xb996=function(_0x1bd8fa,_0x286ce2){_0x1bd8fa=_0x1bd8fa-0x0;var _0x517df8=_0x996b[_0x1bd8fa];return _0x517df8;};'use strict';var multer=require(_0xb996('0x0'));var util=require(_0xb996('0x1'));var path=require(_0xb996('0x2'));var timeout=require(_0xb996('0x3'));var express=require(_0xb996('0x4'));var router=express[_0xb996('0x5')]();var fs_extra=require(_0xb996('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb996('0x7'));var controller=require(_0xb996('0x8'));router[_0xb996('0x9')]('/',auth[_0xb996('0xa')](),controller[_0xb996('0xb')]);router[_0xb996('0x9')](_0xb996('0xc'),auth['isAuthenticated'](),controller[_0xb996('0xd')]);router[_0xb996('0x9')](_0xb996('0xe'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0xb996('0x9')](_0xb996('0xf'),auth[_0xb996('0xa')](),controller['show']);router['get'](_0xb996('0x10'),auth[_0xb996('0xa')](),controller[_0xb996('0x11')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0xb996('0x12')]);router[_0xb996('0x9')](_0xb996('0x13'),auth[_0xb996('0xa')](),controller[_0xb996('0x14')]);router[_0xb996('0x9')](_0xb996('0x15'),auth[_0xb996('0xa')](),controller[_0xb996('0x16')]);router[_0xb996('0x9')](_0xb996('0x17'),auth[_0xb996('0xa')](),controller[_0xb996('0x18')]);router['post']('/',auth[_0xb996('0xa')](),controller[_0xb996('0x19')]);router[_0xb996('0x1a')](_0xb996('0x10'),auth[_0xb996('0xa')](),controller[_0xb996('0x1b')]);router['post'](_0xb996('0x1c'),auth[_0xb996('0xa')](),controller[_0xb996('0x1d')]);router['post'](_0xb996('0x15'),auth['isAuthenticated'](),controller[_0xb996('0x1e')]);router[_0xb996('0x1a')](_0xb996('0x17'),auth[_0xb996('0xa')](),controller[_0xb996('0x1f')]);router[_0xb996('0x20')](_0xb996('0xf'),auth[_0xb996('0xa')](),controller[_0xb996('0x21')]);router['delete'](_0xb996('0xf'),auth[_0xb996('0xa')](),controller[_0xb996('0x22')]);router[_0xb996('0x23')](_0xb996('0x10'),auth[_0xb996('0xa')](),controller[_0xb996('0x24')]);router['delete'](_0xb996('0x17'),auth[_0xb996('0xa')](),controller[_0xb996('0x25')]);module[_0xb996('0x26')]=router; \ No newline at end of file +var _0x404b=['../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addAgents','/:id','update','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x467d57,_0x30596a){var _0x3a5bc1=function(_0x21d395){while(--_0x21d395){_0x467d57['push'](_0x467d57['shift']());}};_0x3a5bc1(++_0x30596a);}(_0x404b,0x68));var _0xb404=function(_0x397d58,_0x4943f5){_0x397d58=_0x397d58-0x0;var _0x1158e2=_0x404b[_0x397d58];return _0x1158e2;};'use strict';var multer=require(_0xb404('0x0'));var util=require(_0xb404('0x1'));var path=require(_0xb404('0x2'));var timeout=require(_0xb404('0x3'));var express=require(_0xb404('0x4'));var router=express[_0xb404('0x5')]();var fs_extra=require(_0xb404('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb404('0x7'));var config=require(_0xb404('0x8'));var controller=require(_0xb404('0x9'));router[_0xb404('0xa')]('/',auth[_0xb404('0xb')](),controller[_0xb404('0xc')]);router[_0xb404('0xa')](_0xb404('0xd'),auth[_0xb404('0xb')](),controller[_0xb404('0xe')]);router['get'](_0xb404('0xf'),auth[_0xb404('0xb')](),controller['getGlobalCustomFields']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb404('0x10')]);router[_0xb404('0xa')](_0xb404('0x11'),auth['isAuthenticated'](),controller[_0xb404('0x12')]);router[_0xb404('0xa')]('/:id/contacts',auth[_0xb404('0xb')](),controller[_0xb404('0x13')]);router[_0xb404('0xa')](_0xb404('0x14'),auth['isAuthenticated'](),controller[_0xb404('0x15')]);router[_0xb404('0xa')](_0xb404('0x16'),auth[_0xb404('0xb')](),controller[_0xb404('0x17')]);router['get'](_0xb404('0x18'),auth[_0xb404('0xb')](),controller[_0xb404('0x19')]);router[_0xb404('0x1a')]('/',auth[_0xb404('0xb')](),controller[_0xb404('0x1b')]);router[_0xb404('0x1a')](_0xb404('0x11'),auth[_0xb404('0xb')](),controller[_0xb404('0x1c')]);router[_0xb404('0x1a')](_0xb404('0x1d'),auth[_0xb404('0xb')](),controller['addContacts']);router['post'](_0xb404('0x16'),auth['isAuthenticated'](),controller['addCustomField']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xb404('0x1e')]);router['put'](_0xb404('0x1f'),auth[_0xb404('0xb')](),controller[_0xb404('0x20')]);router['delete']('/:id',auth[_0xb404('0xb')](),controller[_0xb404('0x21')]);router['delete'](_0xb404('0x11'),auth['isAuthenticated'](),controller[_0xb404('0x22')]);router['delete'](_0xb404('0x18'),auth[_0xb404('0xb')](),controller[_0xb404('0x23')]);module[_0xb404('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d7378d8..ded0787 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 _0xfd57=['VIRTUAL','field','STRING','sequelize'];(function(_0x386c2b,_0x13efac){var _0xdeed24=function(_0x5cf2fa){while(--_0x5cf2fa){_0x386c2b['push'](_0x386c2b['shift']());}};_0xdeed24(++_0x13efac);}(_0xfd57,0x1ef));var _0x7fd5=function(_0x5d8d4c,_0x5810f5){_0x5d8d4c=_0x5d8d4c-0x0;var _0x2d8942=_0xfd57[_0x5d8d4c];return _0x2d8942;};'use strict';var Sequelize=require(_0x7fd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x7fd5('0x1')],'get':function(_0x49a777){return this['getDataValue'](_0x7fd5('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x7fd5('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x7fd5('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x7c85=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x57e599,_0x6bec70){var _0xd046d9=function(_0x168cf0){while(--_0x168cf0){_0x57e599['push'](_0x57e599['shift']());}};_0xd046d9(++_0x6bec70);}(_0x7c85,0x18d));var _0x57c8=function(_0x3d2438,_0x2e7922){_0x3d2438=_0x3d2438-0x0;var _0xd18de5=_0x7c85[_0x3d2438];return _0xd18de5;};'use strict';var Sequelize=require(_0x57c8('0x0'));module[_0x57c8('0x1')]={'name':{'type':Sequelize[_0x57c8('0x2')],'get':function(_0x2c4d5b){return this[_0x57c8('0x3')]('field');}},'field':{'type':Sequelize[_0x57c8('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x57c8('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x57c8('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 95b1e22..5a53662 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3c0d8d,_0x1b08c9){var _0x1d0eca=function(_0x42d0d4){while(--_0x42d0d4){_0x3c0d8d['push'](_0x3c0d8d['shift']());}};_0x1d0eca(++_0x1b08c9);}(_0x7a54,0x106));var _0x47a5=function(_0x3e1bbc,_0x6df62e){_0x3e1bbc=_0x3e1bbc-0x0;var _0x1d75cd=_0x7a54[_0x3e1bbc];return _0x1d75cd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2ddb5c,_0x4f5f93){var _0x2cff64=function(_0xea85bb){while(--_0xea85bb){_0x2ddb5c['push'](_0x2ddb5c['shift']());}};_0x2cff64(++_0x4f5f93);}(_0x7a54,0x106));var _0x47a5=function(_0x44f246,_0x1d1a54){_0x44f246=_0x44f246-0x0;var _0x21a1d8=_0x7a54[_0x44f246];return _0x21a1d8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0ff18d2..744ce6b 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 _0xe663=['request-promise','path','rimraf','../../config/environment','./condition.attributes','define','Condition','lodash','util','api','moment','bluebird'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0xe663,0xf7));var _0x3e66=function(_0x315dcf,_0x5d5660){_0x315dcf=_0x315dcf-0x0;var _0x20b96e=_0xe663[_0x315dcf];return _0x20b96e;};'use strict';var _=require(_0x3e66('0x0'));var util=require(_0x3e66('0x1'));var logger=require('../../config/logger')(_0x3e66('0x2'));var moment=require(_0x3e66('0x3'));var BPromise=require(_0x3e66('0x4'));var rp=require(_0x3e66('0x5'));var fs=require('fs');var path=require(_0x3e66('0x6'));var rimraf=require(_0x3e66('0x7'));var config=require(_0x3e66('0x8'));var attributes=require(_0x3e66('0x9'));module['exports']=function(_0x1566d0,_0x16a610){return _0x1566d0[_0x3e66('0xa')](_0x3e66('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7e1=['./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4bcb2b,_0x152a15){var _0x2d294f=function(_0xff744a){while(--_0xff744a){_0x4bcb2b['push'](_0x4bcb2b['shift']());}};_0x2d294f(++_0x152a15);}(_0xd7e1,0x125));var _0x1d7e=function(_0x5ed63c,_0x55b1f3){_0x5ed63c=_0x5ed63c-0x0;var _0x5cdf92=_0xd7e1[_0x5ed63c];return _0x5cdf92;};'use strict';var _=require('lodash');var util=require(_0x1d7e('0x0'));var logger=require(_0x1d7e('0x1'))(_0x1d7e('0x2'));var moment=require(_0x1d7e('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d7e('0x4'));var fs=require('fs');var path=require(_0x1d7e('0x5'));var rimraf=require(_0x1d7e('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d7e('0x7'));module[_0x1d7e('0x8')]=function(_0x16b62c,_0x263da5){return _0x16b62c[_0x1d7e('0x9')](_0x1d7e('0xa'),attributes,{'tableName':_0x1d7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index dd2c720..e37a851 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 _0xcceb=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0xa11b3f,_0x42f243){var _0x26ed64=function(_0xe60a72){while(--_0xe60a72){_0xa11b3f['push'](_0xa11b3f['shift']());}};_0x26ed64(++_0x42f243);}(_0xcceb,0xe8));var _0xbcce=function(_0x171028,_0x7ee648){_0x171028=_0x171028-0x0;var _0x5c4c7b=_0xcceb[_0x171028];return _0x5c4c7b;};'use strict';var _=require(_0xbcce('0x0'));var util=require(_0xbcce('0x1'));var moment=require(_0xbcce('0x2'));var BPromise=require(_0xbcce('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcce('0x4'));var db=require(_0xbcce('0x5'))['db'];var utils=require(_0xbcce('0x6'));var logger=require(_0xbcce('0x7'))(_0xbcce('0x8'));var config=require(_0xbcce('0x9'));var jayson=require(_0xbcce('0xa'));var client=jayson[_0xbcce('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a6e2e,_0x3e94b8,_0x13ceb3){return new BPromise(function(_0x20487c,_0x109e4b){return client[_0xbcce('0xc')](_0x4a6e2e,_0x13ceb3)[_0xbcce('0xd')](function(_0x269f02){logger['info'](_0xbcce('0xe'),_0x3e94b8,_0xbcce('0xf'));logger[_0xbcce('0x10')](_0xbcce('0x11'),_0x3e94b8,_0xbcce('0xf'),JSON[_0xbcce('0x12')](_0x269f02));if(_0x269f02[_0xbcce('0x13')]){if(_0x269f02[_0xbcce('0x13')][_0xbcce('0x14')]===0x1f4){logger[_0xbcce('0x13')](_0xbcce('0xe'),_0x3e94b8,_0x269f02[_0xbcce('0x13')][_0xbcce('0x15')]);return _0x109e4b(_0x269f02[_0xbcce('0x13')][_0xbcce('0x15')]);}logger['error'](_0xbcce('0xe'),_0x3e94b8,_0x269f02[_0xbcce('0x13')][_0xbcce('0x15')]);return _0x20487c(_0x269f02[_0xbcce('0x13')][_0xbcce('0x15')]);}else{logger[_0xbcce('0x16')](_0xbcce('0xe'),_0x3e94b8,_0xbcce('0xf'));_0x20487c(_0x269f02[_0xbcce('0x17')][_0xbcce('0x15')]);}})[_0xbcce('0x18')](function(_0x418e14){logger['error'](_0xbcce('0xe'),_0x3e94b8,_0x418e14);_0x109e4b(_0x418e14);});});} \ No newline at end of file +var _0x8bc8=['message','Condition,\x20%s,\x20%s','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x38a653,_0x1a5872){var _0x370492=function(_0x33a556){while(--_0x33a556){_0x38a653['push'](_0x38a653['shift']());}};_0x370492(++_0x1a5872);}(_0x8bc8,0xbd));var _0x88bc=function(_0x784768,_0x3d0c75){_0x784768=_0x784768-0x0;var _0x3b76fc=_0x8bc8[_0x784768];return _0x3b76fc;};'use strict';var _=require(_0x88bc('0x0'));var util=require(_0x88bc('0x1'));var moment=require(_0x88bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x88bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88bc('0x4'))['db'];var utils=require(_0x88bc('0x5'));var logger=require(_0x88bc('0x6'))(_0x88bc('0x7'));var config=require('../../config/environment');var jayson=require(_0x88bc('0x8'));var client=jayson[_0x88bc('0x9')][_0x88bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x598749,_0x4a336e,_0x39e8f0){return new BPromise(function(_0x24ebe0,_0x54cb5a){return client[_0x88bc('0xb')](_0x598749,_0x39e8f0)[_0x88bc('0xc')](function(_0x47e929){logger['info']('Condition,\x20%s,\x20%s',_0x4a336e,'request\x20sent');logger['debug'](_0x88bc('0xd'),_0x4a336e,_0x88bc('0xe'),JSON[_0x88bc('0xf')](_0x47e929));if(_0x47e929[_0x88bc('0x10')]){if(_0x47e929[_0x88bc('0x10')][_0x88bc('0x11')]===0x1f4){logger[_0x88bc('0x10')]('Condition,\x20%s,\x20%s',_0x4a336e,_0x47e929[_0x88bc('0x10')][_0x88bc('0x12')]);return _0x54cb5a(_0x47e929[_0x88bc('0x10')]['message']);}logger[_0x88bc('0x10')](_0x88bc('0x13'),_0x4a336e,_0x47e929['error'][_0x88bc('0x12')]);return _0x24ebe0(_0x47e929[_0x88bc('0x10')][_0x88bc('0x12')]);}else{logger[_0x88bc('0x14')](_0x88bc('0x13'),_0x4a336e,'request\x20sent');_0x24ebe0(_0x47e929[_0x88bc('0x15')][_0x88bc('0x12')]);}})[_0x88bc('0x16')](function(_0x416c0b){logger[_0x88bc('0x10')](_0x88bc('0x13'),_0x4a336e,_0x416c0b);_0x54cb5a(_0x416c0b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2017589..8c5fbd6 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 _0x299d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x299d,0x18a));var _0xd299=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x299d[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0xd299('0x0'));var util=require(_0xd299('0x1'));var path=require(_0xd299('0x2'));var timeout=require(_0xd299('0x3'));var express=require(_0xd299('0x4'));var router=express[_0xd299('0x5')]();var fs_extra=require(_0xd299('0x6'));var auth=require(_0xd299('0x7'));var interaction=require(_0xd299('0x8'));var config=require(_0xd299('0x9'));var controller=require(_0xd299('0xa'));router['put'](_0xd299('0xb'),auth[_0xd299('0xc')](),controller['update']);router[_0xd299('0xd')](_0xd299('0xb'),auth['isAuthenticated'](),controller[_0xd299('0xe')]);module[_0xd299('0xf')]=router; \ No newline at end of file +var _0x1316=['Router','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated','/:id','util','path','connect-timeout','express'];(function(_0x39eff9,_0x3a57a4){var _0x356d78=function(_0x308377){while(--_0x308377){_0x39eff9['push'](_0x39eff9['shift']());}};_0x356d78(++_0x3a57a4);}(_0x1316,0xf9));var _0x6131=function(_0x2a3b0b,_0x51c1cb){_0x2a3b0b=_0x2a3b0b-0x0;var _0xcb702d=_0x1316[_0x2a3b0b];return _0xcb702d;};'use strict';var multer=require('multer');var util=require(_0x6131('0x0'));var path=require(_0x6131('0x1'));var timeout=require(_0x6131('0x2'));var express=require(_0x6131('0x3'));var router=express[_0x6131('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6131('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6131('0x6'));var controller=require(_0x6131('0x7'));router[_0x6131('0x8')]('/:id',auth[_0x6131('0x9')](),controller['update']);router['delete'](_0x6131('0xa'),auth[_0x6131('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index abd77eb..cc85a5f 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 _0x67c6=['STRING','name','INTEGER','sequelize'];(function(_0x3f9d6b,_0x15d32d){var _0x11a34d=function(_0xbee0ab){while(--_0xbee0ab){_0x3f9d6b['push'](_0x3f9d6b['shift']());}};_0x11a34d(++_0x15d32d);}(_0x67c6,0x147));var _0x667c=function(_0x4b2d2c,_0xa8f929){_0x4b2d2c=_0x4b2d2c-0x0;var _0x486eb5=_0x67c6[_0x4b2d2c];return _0x486eb5;};'use strict';var Sequelize=require(_0x667c('0x0'));module['exports']={'name':{'type':Sequelize[_0x667c('0x1')],'allowNull':![],'unique':_0x667c('0x2')},'OrderBy':{'type':Sequelize[_0x667c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x667c('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x039f=['STRING','INTEGER','sequelize','exports'];(function(_0x18c885,_0x227fdc){var _0x2310ed=function(_0x569e88){while(--_0x569e88){_0x18c885['push'](_0x18c885['shift']());}};_0x2310ed(++_0x227fdc);}(_0x039f,0x162));var _0xf039=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x039f[_0x34933a];return _0x36abb4;};'use strict';var Sequelize=require(_0xf039('0x0'));module[_0xf039('0x1')]={'name':{'type':Sequelize[_0xf039('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xf039('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xf039('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 1d2c82b..731bcc0 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 _0x7708=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','send','index','map','ContactItemType','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x7708,0x188));var _0x8770=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x7708[_0x5b3950];return _0x41e436;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){var _0x460474=_0x4274dd['get']({'plain':!![]});var _0x7b4755=_0x8770('0x23');return db[_0x8770('0x24')][_0x8770('0x22')]({'where':{'type':_0x7b4755,'resourceId':_0x460474['id']}})[_0x8770('0x21')](function(){return _0x4274dd;});})[_0x8770('0x21')](function(){_0x468fc0[_0x8770('0x17')](0xcc)[_0x8770('0x18')]();});}};}function handleEntityNotFound(_0xb3f4aa,_0xa480){return function(_0x5f4973){if(!_0x5f4973){_0xb3f4aa[_0x8770('0x16')](0x194);}return _0x5f4973;};}function handleError(_0x199b96,_0x1df627){_0x1df627=_0x1df627||0x1f4;return function(_0x5c7bd){logger[_0x8770('0x25')](_0x5c7bd[_0x8770('0x26')]);if(_0x5c7bd['name']){delete _0x5c7bd['name'];}_0x199b96[_0x8770('0x17')](_0x1df627)[_0x8770('0x27')](_0x5c7bd);};}exports[_0x8770('0x28')]=function(_0x365080,_0x23f4b0){var _0x4bc072={},_0x5282dd={},_0x45fff4={'count':0x0,'rows':[]};var _0x144c24=_[_0x8770('0x29')](db[_0x8770('0x2a')]['rawAttributes'],function(_0x2f4e44){return{'name':_0x2f4e44['fieldName'],'type':_0x2f4e44['type'][_0x8770('0x2b')]};});_0x5282dd['model']=_[_0x8770('0x29')](_0x144c24,_0x8770('0x2c'));_0x5282dd[_0x8770('0x2d')]=_[_0x8770('0x2e')](_0x365080[_0x8770('0x2d')]);_0x5282dd[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],_0x5282dd[_0x8770('0x2d')]);_0x4bc072['attributes']=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],qs[_0x8770('0x32')](_0x365080['query']['fields']));_0x4bc072[_0x8770('0x33')]=_0x4bc072[_0x8770('0x33')][_0x8770('0x34')]?_0x4bc072['attributes']:_0x5282dd[_0x8770('0x31')];if(!_0x365080['query'][_0x8770('0x35')](_0x8770('0x36'))){_0x4bc072[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x365080[_0x8770('0x2d')][_0x8770('0x1c')]);_0x4bc072[_0x8770('0x1a')]=qs[_0x8770('0x1a')](_0x365080[_0x8770('0x2d')][_0x8770('0x1a')]);}_0x4bc072['order']=qs[_0x8770('0x37')](_0x365080[_0x8770('0x2d')][_0x8770('0x37')]);_0x4bc072['where']=qs[_0x8770('0x2f')](_[_0x8770('0x38')](_0x365080[_0x8770('0x2d')],_0x5282dd[_0x8770('0x2f')]),_0x144c24);if(_0x365080[_0x8770('0x2d')][_0x8770('0x39')]){_0x4bc072['where']=_[_0x8770('0x3a')](_0x4bc072['where'],{'$or':_[_0x8770('0x29')](_0x144c24,function(_0x57f52e){if(_0x57f52e[_0x8770('0x3b')]!==_0x8770('0x3c')){var _0x306142={};_0x306142[_0x57f52e['name']]={'$like':'%'+_0x365080[_0x8770('0x2d')][_0x8770('0x39')]+'%'};return _0x306142;}})});}_0x4bc072=_[_0x8770('0x3a')]({},_0x4bc072,_0x365080[_0x8770('0x3d')]);var _0x408e86={'where':_0x4bc072[_0x8770('0x3e')]};return db['ContactItemType'][_0x8770('0x1b')](_0x408e86)['then'](function(_0x4bcfc7){_0x45fff4[_0x8770('0x1b')]=_0x4bcfc7;if(_0x365080[_0x8770('0x2d')][_0x8770('0x3f')]){_0x4bc072[_0x8770('0x40')]=[{'all':!![]}];}return db[_0x8770('0x2a')]['findAll'](_0x4bc072);})[_0x8770('0x21')](function(_0x26ae1b){_0x45fff4['rows']=_0x26ae1b;return _0x45fff4;})[_0x8770('0x21')](respondWithFilteredResult(_0x23f4b0,_0x4bc072))['catch'](handleError(_0x23f4b0,null));};exports[_0x8770('0x41')]=function(_0x6bfa55,_0xc29c65){var _0x39c0d3={'raw':!![],'where':{'id':_0x6bfa55[_0x8770('0x42')]['id']}},_0x29dae5={};_0x29dae5[_0x8770('0x31')]=_[_0x8770('0x2e')](db[_0x8770('0x2a')][_0x8770('0x43')]);_0x29dae5[_0x8770('0x2d')]=_['keys'](_0x6bfa55[_0x8770('0x2d')]);_0x29dae5[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x29dae5[_0x8770('0x31')],_0x29dae5[_0x8770('0x2d')]);_0x39c0d3[_0x8770('0x33')]=_['intersection'](_0x29dae5[_0x8770('0x31')],qs[_0x8770('0x32')](_0x6bfa55[_0x8770('0x2d')][_0x8770('0x32')]));_0x39c0d3[_0x8770('0x33')]=_0x39c0d3[_0x8770('0x33')][_0x8770('0x34')]?_0x39c0d3[_0x8770('0x33')]:_0x29dae5['model'];if(_0x6bfa55[_0x8770('0x2d')][_0x8770('0x3f')]){_0x39c0d3[_0x8770('0x40')]=[{'all':!![]}];}_0x39c0d3=_[_0x8770('0x3a')]({},_0x39c0d3,_0x6bfa55[_0x8770('0x3d')]);return db['ContactItemType']['find'](_0x39c0d3)[_0x8770('0x21')](handleEntityNotFound(_0xc29c65,null))['then'](respondWithResult(_0xc29c65,null))[_0x8770('0x44')](handleError(_0xc29c65,null));};exports['create']=function(_0x4f9e0b,_0x3805d8){return db[_0x8770('0x2a')][_0x8770('0x45')](_0x4f9e0b[_0x8770('0x46')],{})['then'](function(_0x136cc1){var _0x48dea0=_0x4f9e0b['user']['get']({'plain':!![]});if(!_0x48dea0)throw new Error(_0x8770('0x47'));if(_0x48dea0[_0x8770('0x48')]===_0x8770('0x49')){var _0x4f5cb8=_0x136cc1[_0x8770('0x4a')]({'plain':!![]});var _0x5b6638=_0x8770('0x23');return db[_0x8770('0x4b')][_0x8770('0x4c')]({'where':{'name':_0x5b6638,'userProfileId':_0x48dea0['userProfileId']},'raw':!![]})[_0x8770('0x21')](function(_0x5de11e){if(_0x5de11e&&_0x5de11e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8770('0x45')]({'name':_0x4f5cb8[_0x8770('0x2c')],'resourceId':_0x4f5cb8['id'],'type':_0x5de11e[_0x8770('0x2c')],'sectionId':_0x5de11e['id']},{})[_0x8770('0x21')](function(){return _0x136cc1;});}else{return _0x136cc1;}})[_0x8770('0x44')](function(_0x1df5cd){logger['error'](_0x8770('0x4d'),_0x1df5cd);throw _0x1df5cd;});}return _0x136cc1;})['then'](respondWithResult(_0x3805d8,0xc9))[_0x8770('0x44')](handleError(_0x3805d8,null));};exports[_0x8770('0x20')]=function(_0x475e9d,_0x3e4f77){if(_0x475e9d['body']['id']){delete _0x475e9d[_0x8770('0x46')]['id'];}return db[_0x8770('0x2a')]['find']({'where':{'id':_0x475e9d['params']['id']}})['then'](handleEntityNotFound(_0x3e4f77,null))['then'](saveUpdates(_0x475e9d[_0x8770('0x46')],null))[_0x8770('0x21')](respondWithResult(_0x3e4f77,null))['catch'](handleError(_0x3e4f77,null));};exports[_0x8770('0x22')]=function(_0x38b68f,_0x435c23){return db[_0x8770('0x2a')][_0x8770('0x4c')]({'where':{'id':_0x38b68f[_0x8770('0x42')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x435c23,null))[_0x8770('0x21')](db[_0x8770('0x4e')][_0x8770('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x38b68f[_0x8770('0x42')]['id']}}))['then'](removeEntity(_0x435c23,null))[_0x8770('0x44')](handleError(_0x435c23,null));}; \ No newline at end of file +var _0x627e=['catch','keys','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','ContactItemTypes','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','rows'];(function(_0x2be177,_0x4e706d){var _0x1ef418=function(_0x2413e8){while(--_0x2413e8){_0x2be177['push'](_0x2be177['shift']());}};_0x1ef418(++_0x4e706d);}(_0x627e,0x14a));var _0xe627=function(_0x34c71c,_0x5b93ca){_0x34c71c=_0x34c71c-0x0;var _0x5ab0d2=_0x627e[_0x34c71c];return _0x5ab0d2;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){var _0x2093c5=_0x19adbc[_0xe627('0x25')]({'plain':!![]});var _0x1a5081=_0xe627('0x26');return db['UserProfileResource'][_0xe627('0x24')]({'where':{'type':_0x1a5081,'resourceId':_0x2093c5['id']}})[_0xe627('0x23')](function(){return _0x19adbc;});})[_0xe627('0x23')](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x40ab91,_0x45c694){return function(_0x44c9f7){if(!_0x44c9f7){_0x40ab91[_0xe627('0x18')](0x194);}return _0x44c9f7;};}function handleError(_0x58c728,_0x5ad327){_0x5ad327=_0x5ad327||0x1f4;return function(_0x5aeba1){logger['error'](_0x5aeba1[_0xe627('0x27')]);if(_0x5aeba1[_0xe627('0x28')]){delete _0x5aeba1['name'];}_0x58c728[_0xe627('0x19')](_0x5ad327)['send'](_0x5aeba1);};}exports[_0xe627('0x29')]=function(_0x498e1f,_0x262253){var _0x26833a={},_0x5d8992={},_0x33e9dd={'count':0x0,'rows':[]};var _0x4f92c9=_[_0xe627('0x2a')](db[_0xe627('0x2b')][_0xe627('0x2c')],function(_0x30bd45){return{'name':_0x30bd45[_0xe627('0x2d')],'type':_0x30bd45[_0xe627('0x2e')][_0xe627('0x2f')]};});_0x5d8992[_0xe627('0x30')]=_[_0xe627('0x2a')](_0x4f92c9,_0xe627('0x28'));_0x5d8992[_0xe627('0x31')]=_['keys'](_0x498e1f['query']);_0x5d8992[_0xe627('0x32')]=_['intersection'](_0x5d8992[_0xe627('0x30')],_0x5d8992['query']);_0x26833a['attributes']=_[_0xe627('0x33')](_0x5d8992['model'],qs['fields'](_0x498e1f[_0xe627('0x31')][_0xe627('0x34')]));_0x26833a[_0xe627('0x35')]=_0x26833a['attributes']['length']?_0x26833a['attributes']:_0x5d8992[_0xe627('0x30')];if(!_0x498e1f['query'][_0xe627('0x36')](_0xe627('0x37'))){_0x26833a['limit']=qs[_0xe627('0x1e')](_0x498e1f[_0xe627('0x31')]['limit']);_0x26833a[_0xe627('0x1c')]=qs[_0xe627('0x1c')](_0x498e1f[_0xe627('0x31')][_0xe627('0x1c')]);}_0x26833a[_0xe627('0x38')]=qs[_0xe627('0x39')](_0x498e1f['query'][_0xe627('0x39')]);_0x26833a['where']=qs[_0xe627('0x32')](_['pick'](_0x498e1f[_0xe627('0x31')],_0x5d8992[_0xe627('0x32')]),_0x4f92c9);if(_0x498e1f[_0xe627('0x31')][_0xe627('0x3a')]){_0x26833a[_0xe627('0x3b')]=_[_0xe627('0x3c')](_0x26833a[_0xe627('0x3b')],{'$or':_[_0xe627('0x2a')](_0x4f92c9,function(_0x2119bb){if(_0x2119bb[_0xe627('0x2e')]!==_0xe627('0x3d')){var _0x1f4309={};_0x1f4309[_0x2119bb[_0xe627('0x28')]]={'$like':'%'+_0x498e1f['query']['filter']+'%'};return _0x1f4309;}})});}_0x26833a=_['merge']({},_0x26833a,_0x498e1f['options']);var _0x590978={'where':_0x26833a['where']};return db[_0xe627('0x2b')]['count'](_0x590978)[_0xe627('0x23')](function(_0x59cd6a){_0x33e9dd[_0xe627('0x1f')]=_0x59cd6a;if(_0x498e1f[_0xe627('0x31')][_0xe627('0x3e')]){_0x26833a['include']=[{'all':!![]}];}return db['ContactItemType'][_0xe627('0x3f')](_0x26833a);})['then'](function(_0x5e352e){_0x33e9dd[_0xe627('0x40')]=_0x5e352e;return _0x33e9dd;})['then'](respondWithFilteredResult(_0x262253,_0x26833a))[_0xe627('0x41')](handleError(_0x262253,null));};exports['show']=function(_0x483498,_0x408142){var _0x26bc3e={'raw':!![],'where':{'id':_0x483498['params']['id']}},_0x9faf8f={};_0x9faf8f['model']=_[_0xe627('0x42')](db['ContactItemType']['rawAttributes']);_0x9faf8f[_0xe627('0x31')]=_[_0xe627('0x42')](_0x483498[_0xe627('0x31')]);_0x9faf8f[_0xe627('0x32')]=_[_0xe627('0x33')](_0x9faf8f[_0xe627('0x30')],_0x9faf8f['query']);_0x26bc3e[_0xe627('0x35')]=_[_0xe627('0x33')](_0x9faf8f['model'],qs['fields'](_0x483498[_0xe627('0x31')][_0xe627('0x34')]));_0x26bc3e[_0xe627('0x35')]=_0x26bc3e[_0xe627('0x35')][_0xe627('0x43')]?_0x26bc3e[_0xe627('0x35')]:_0x9faf8f[_0xe627('0x30')];if(_0x483498['query'][_0xe627('0x3e')]){_0x26bc3e['include']=[{'all':!![]}];}_0x26bc3e=_[_0xe627('0x3c')]({},_0x26bc3e,_0x483498[_0xe627('0x44')]);return db[_0xe627('0x2b')]['find'](_0x26bc3e)[_0xe627('0x23')](handleEntityNotFound(_0x408142,null))['then'](respondWithResult(_0x408142,null))[_0xe627('0x41')](handleError(_0x408142,null));};exports[_0xe627('0x45')]=function(_0x375e05,_0x30e057){return db[_0xe627('0x2b')]['create'](_0x375e05[_0xe627('0x46')],{})[_0xe627('0x23')](function(_0x369bdb){var _0x386c1d=_0x375e05[_0xe627('0x47')][_0xe627('0x25')]({'plain':!![]});if(!_0x386c1d)throw new Error(_0xe627('0x48'));if(_0x386c1d[_0xe627('0x49')]===_0xe627('0x47')){var _0x3824da=_0x369bdb['get']({'plain':!![]});var _0x33f40b=_0xe627('0x26');return db['UserProfileSection'][_0xe627('0x4a')]({'where':{'name':_0x33f40b,'userProfileId':_0x386c1d[_0xe627('0x4b')]},'raw':!![]})['then'](function(_0x3b96aa){if(_0x3b96aa&&_0x3b96aa[_0xe627('0x4c')]===0x0){return db['UserProfileResource'][_0xe627('0x45')]({'name':_0x3824da[_0xe627('0x28')],'resourceId':_0x3824da['id'],'type':_0x3b96aa['name'],'sectionId':_0x3b96aa['id']},{})[_0xe627('0x23')](function(){return _0x369bdb;});}else{return _0x369bdb;}})['catch'](function(_0x4dcac2){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dcac2);throw _0x4dcac2;});}return _0x369bdb;})['then'](respondWithResult(_0x30e057,0xc9))[_0xe627('0x41')](handleError(_0x30e057,null));};exports[_0xe627('0x4d')]=function(_0x3a7f0d,_0x131250){if(_0x3a7f0d[_0xe627('0x46')]['id']){delete _0x3a7f0d[_0xe627('0x46')]['id'];}return db['ContactItemType'][_0xe627('0x4a')]({'where':{'id':_0x3a7f0d[_0xe627('0x4e')]['id']}})['then'](handleEntityNotFound(_0x131250,null))['then'](saveUpdates(_0x3a7f0d['body'],null))[_0xe627('0x23')](respondWithResult(_0x131250,null))[_0xe627('0x41')](handleError(_0x131250,null));};exports[_0xe627('0x24')]=function(_0x40e935,_0x375b8c){return db[_0xe627('0x2b')][_0xe627('0x4a')]({'where':{'id':_0x40e935[_0xe627('0x4e')]['id']}})['then'](handleEntityNotFound(_0x375b8c,null))[_0xe627('0x23')](db['CmContactHasItem'][_0xe627('0x4d')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x40e935['params']['id']}}))[_0xe627('0x23')](removeEntity(_0x375b8c,null))[_0xe627('0x41')](handleError(_0x375b8c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 91baaee..041e162 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 _0x1377=['api','moment','bluebird','request-promise','path','./contactItemType.attributes','exports','define','lodash','../../config/logger'];(function(_0xafa8d9,_0x4aa4fd){var _0x2567ed=function(_0x3c1104){while(--_0x3c1104){_0xafa8d9['push'](_0xafa8d9['shift']());}};_0x2567ed(++_0x4aa4fd);}(_0x1377,0x102));var _0x7137=function(_0x3ae751,_0xd90911){_0x3ae751=_0x3ae751-0x0;var _0x4a005c=_0x1377[_0x3ae751];return _0x4a005c;};'use strict';var _=require(_0x7137('0x0'));var util=require('util');var logger=require(_0x7137('0x1'))(_0x7137('0x2'));var moment=require(_0x7137('0x3'));var BPromise=require(_0x7137('0x4'));var rp=require(_0x7137('0x5'));var fs=require('fs');var path=require(_0x7137('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7137('0x7'));module[_0x7137('0x8')]=function(_0x3a204f,_0xd82f1f){return _0x3a204f[_0x7137('0x9')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x551b=['bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','api','moment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x551b,0x175));var _0xb551=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x551b[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xb551('0x0'));var util=require(_0xb551('0x1'));var logger=require('../../config/logger')(_0xb551('0x2'));var moment=require(_0xb551('0x3'));var BPromise=require(_0xb551('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb551('0x5'));var rimraf=require(_0xb551('0x6'));var config=require(_0xb551('0x7'));var attributes=require(_0xb551('0x8'));module[_0xb551('0x9')]=function(_0x2321f2,_0x5a4333){return _0x2321f2[_0xb551('0xa')](_0xb551('0xb'),attributes,{'tableName':_0xb551('0xc'),'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 6f6b507..5ba3640 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 _0x51ed=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3274a2,_0x41f0da){var _0x24f4bd=function(_0x3370b8){while(--_0x3370b8){_0x3274a2['push'](_0x3274a2['shift']());}};_0x24f4bd(++_0x41f0da);}(_0x51ed,0x1a3));var _0xd51e=function(_0x52b73c,_0x26f780){_0x52b73c=_0x52b73c-0x0;var _0x19de8c=_0x51ed[_0x52b73c];return _0x19de8c;};'use strict';var _=require(_0xd51e('0x0'));var util=require('util');var moment=require(_0xd51e('0x1'));var BPromise=require(_0xd51e('0x2'));var rs=require(_0xd51e('0x3'));var fs=require('fs');var Redis=require(_0xd51e('0x4'));var db=require(_0xd51e('0x5'))['db'];var utils=require(_0xd51e('0x6'));var logger=require('../../config/logger')(_0xd51e('0x7'));var config=require(_0xd51e('0x8'));var jayson=require(_0xd51e('0x9'));var client=jayson[_0xd51e('0xa')][_0xd51e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15f43c,_0x541a63,_0x153fa9){return new BPromise(function(_0x548853,_0x3d01e1){return client[_0xd51e('0xc')](_0x15f43c,_0x153fa9)['then'](function(_0x2396ff){logger[_0xd51e('0xd')](_0xd51e('0xe'),_0x541a63,_0xd51e('0xf'));logger[_0xd51e('0x10')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x541a63,_0xd51e('0xf'),JSON[_0xd51e('0x11')](_0x2396ff));if(_0x2396ff[_0xd51e('0x12')]){if(_0x2396ff[_0xd51e('0x12')][_0xd51e('0x13')]===0x1f4){logger[_0xd51e('0x12')](_0xd51e('0xe'),_0x541a63,_0x2396ff[_0xd51e('0x12')][_0xd51e('0x14')]);return _0x3d01e1(_0x2396ff['error'][_0xd51e('0x14')]);}logger[_0xd51e('0x12')](_0xd51e('0xe'),_0x541a63,_0x2396ff[_0xd51e('0x12')][_0xd51e('0x14')]);return _0x548853(_0x2396ff[_0xd51e('0x12')][_0xd51e('0x14')]);}else{logger[_0xd51e('0xd')](_0xd51e('0xe'),_0x541a63,_0xd51e('0xf'));_0x548853(_0x2396ff[_0xd51e('0x15')][_0xd51e('0x14')]);}})[_0xd51e('0x16')](function(_0x4a94d7){logger[_0xd51e('0x12')](_0xd51e('0xe'),_0x541a63,_0x4a94d7);_0x3d01e1(_0x4a94d7);});});} \ No newline at end of file +var _0xe793=['../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ContactItemType,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x563ac7,_0x5cf79f){var _0x14f408=function(_0x5883f2){while(--_0x5883f2){_0x563ac7['push'](_0x563ac7['shift']());}};_0x14f408(++_0x5cf79f);}(_0xe793,0x176));var _0x3e79=function(_0x332907,_0x147ee0){_0x332907=_0x332907-0x0;var _0x3bce1f=_0xe793[_0x332907];return _0x3bce1f;};'use strict';var _=require(_0x3e79('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e79('0x1'));var rs=require(_0x3e79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e79('0x3'))['db'];var utils=require(_0x3e79('0x4'));var logger=require(_0x3e79('0x5'))('rpc');var config=require(_0x3e79('0x6'));var jayson=require(_0x3e79('0x7'));var client=jayson[_0x3e79('0x8')][_0x3e79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26210e,_0x44a7d7,_0x8e0ead){return new BPromise(function(_0x49cc05,_0x150e15){return client['request'](_0x26210e,_0x8e0ead)['then'](function(_0x34efed){logger[_0x3e79('0xa')]('ContactItemType,\x20%s,\x20%s',_0x44a7d7,_0x3e79('0xb'));logger[_0x3e79('0xc')](_0x3e79('0xd'),_0x44a7d7,_0x3e79('0xb'),JSON[_0x3e79('0xe')](_0x34efed));if(_0x34efed[_0x3e79('0xf')]){if(_0x34efed[_0x3e79('0xf')][_0x3e79('0x10')]===0x1f4){logger[_0x3e79('0xf')]('ContactItemType,\x20%s,\x20%s',_0x44a7d7,_0x34efed[_0x3e79('0xf')]['message']);return _0x150e15(_0x34efed[_0x3e79('0xf')][_0x3e79('0x11')]);}logger[_0x3e79('0xf')]('ContactItemType,\x20%s,\x20%s',_0x44a7d7,_0x34efed['error'][_0x3e79('0x11')]);return _0x49cc05(_0x34efed['error'][_0x3e79('0x11')]);}else{logger['info'](_0x3e79('0x12'),_0x44a7d7,_0x3e79('0xb'));_0x49cc05(_0x34efed['result'][_0x3e79('0x11')]);}})[_0x3e79('0x13')](function(_0x21f5a2){logger['error']('ContactItemType,\x20%s,\x20%s',_0x44a7d7,_0x21f5a2);_0x150e15(_0x21f5a2);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6e7145b..31b80f9 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 _0xda77=['create','put','update','delete','destroy','multer','util','connect-timeout','../../config/environment','isAuthenticated','get','/:id','post'];(function(_0x36ec77,_0x1b893a){var _0x442ea8=function(_0xe6cc6d){while(--_0xe6cc6d){_0x36ec77['push'](_0x36ec77['shift']());}};_0x442ea8(++_0x1b893a);}(_0xda77,0x1bf));var _0x7da7=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xda77[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x7da7('0x0'));var util=require(_0x7da7('0x1'));var path=require('path');var timeout=require(_0x7da7('0x2'));var express=require('express');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(_0x7da7('0x3'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0x7da7('0x4')](),controller['index']);router[_0x7da7('0x5')](_0x7da7('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x7da7('0x7')]('/',auth['isAuthenticated'](),controller[_0x7da7('0x8')]);router[_0x7da7('0x9')](_0x7da7('0x6'),auth[_0x7da7('0x4')](),controller[_0x7da7('0xa')]);router[_0x7da7('0xb')]('/:id',auth[_0x7da7('0x4')](),controller[_0x7da7('0xc')]);module['exports']=router; \ No newline at end of file +var _0xc618=['isAuthenticated','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','/:id','show','post'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0xc618,0x137));var _0x8c61=function(_0x33c583,_0x4bc51f){_0x33c583=_0x33c583-0x0;var _0x568d95=_0xc618[_0x33c583];return _0x568d95;};'use strict';var multer=require(_0x8c61('0x0'));var util=require(_0x8c61('0x1'));var path=require(_0x8c61('0x2'));var timeout=require(_0x8c61('0x3'));var express=require(_0x8c61('0x4'));var router=express[_0x8c61('0x5')]();var fs_extra=require(_0x8c61('0x6'));var auth=require(_0x8c61('0x7'));var interaction=require(_0x8c61('0x8'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8c61('0x9')]);router['get'](_0x8c61('0xa'),auth['isAuthenticated'](),controller[_0x8c61('0xb')]);router[_0x8c61('0xc')]('/',auth[_0x8c61('0xd')](),controller[_0x8c61('0xe')]);router[_0x8c61('0xf')]('/:id',auth[_0x8c61('0xd')](),controller['update']);router['delete'](_0x8c61('0xa'),auth[_0x8c61('0xd')](),controller[_0x8c61('0x10')]);module[_0x8c61('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 7937887..9152885 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x50357d,_0xe18fd5){var _0x5f3ac2=function(_0xc94574){while(--_0xc94574){_0x50357d['push'](_0x50357d['shift']());}};_0x5f3ac2(++_0xe18fd5);}(_0xb10b,0x12a));var _0xbb10=function(_0xfcbf57,_0x4b05fd){_0xfcbf57=_0xfcbf57-0x0;var _0x1078fa=_0xb10b[_0xfcbf57];return _0x1078fa;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x368e56,_0x175654){var _0x441c54=function(_0x2da97c){while(--_0x2da97c){_0x368e56['push'](_0x368e56['shift']());}};_0x441c54(++_0x175654);}(_0xb10b,0x12a));var _0xbb10=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0xb10b[_0x296144];return _0x5329b1;};'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 67ef335..038e8a3 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 _0xcdd9=['catch','show','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','get','omit','createdAt','updatedAt','params','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrFaxAccounts','attrOpenchannelAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','end','status','offset','limit','undefined','count','set','reject','update','then','destroy','CustomDashboards','sendStatus','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x26a672,_0x59f5be){var _0x348f43=function(_0x461812){while(--_0x461812){_0x26a672['push'](_0x26a672['shift']());}};_0x348f43(++_0x59f5be);}(_0xcdd9,0xbe));var _0x9cdd=function(_0x49ad05,_0x1acffe){_0x49ad05=_0x49ad05-0x0;var _0x3d51b0=_0xcdd9[_0x49ad05];return _0x3d51b0;};'use strict';var emlformat=require(_0x9cdd('0x0'));var rimraf=require(_0x9cdd('0x1'));var zipdir=require(_0x9cdd('0x2'));var jsonpatch=require(_0x9cdd('0x3'));var rp=require(_0x9cdd('0x4'));var moment=require(_0x9cdd('0x5'));var BPromise=require(_0x9cdd('0x6'));var Mustache=require(_0x9cdd('0x7'));var util=require(_0x9cdd('0x8'));var path=require(_0x9cdd('0x9'));var sox=require('sox');var csv=require(_0x9cdd('0xa'));var ejs=require(_0x9cdd('0xb'));var fs=require('fs');var fs_extra=require(_0x9cdd('0xc'));var _=require(_0x9cdd('0xd'));var squel=require(_0x9cdd('0xe'));var crypto=require('crypto');var jsforce=require(_0x9cdd('0xf'));var deskjs=require(_0x9cdd('0x10'));var toCsv=require(_0x9cdd('0xa'));var querystring=require('querystring');var Papa=require(_0x9cdd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9cdd('0x12'));var hardwareService=require(_0x9cdd('0x13'));var logger=require(_0x9cdd('0x14'))(_0x9cdd('0x15'));var utils=require(_0x9cdd('0x16'));var config=require(_0x9cdd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9cdd('0x18'))['db'];config[_0x9cdd('0x19')]=_[_0x9cdd('0x1a')](config[_0x9cdd('0x19')],{'host':_0x9cdd('0x1b'),'port':0x18eb});var socket=require(_0x9cdd('0x1c'))(new Redis(config[_0x9cdd('0x19')]));require(_0x9cdd('0x1d'))[_0x9cdd('0x1e')](socket);function respondWithStatusCode(_0x43f140,_0x225382){_0x225382=_0x225382||0xcc;return function(_0xf3b957){if(_0xf3b957){return _0x43f140['sendStatus'](_0x225382);}return _0x43f140['status'](_0x225382)[_0x9cdd('0x1f')]();};}function respondWithResult(_0x3f9a80,_0x37cc0a){_0x37cc0a=_0x37cc0a||0xc8;return function(_0x40de53){if(_0x40de53){return _0x3f9a80[_0x9cdd('0x20')](_0x37cc0a)['json'](_0x40de53);}};}function respondWithFilteredResult(_0x4924d0,_0x173d1a){return function(_0x4a8d42){if(_0x4a8d42){var _0x1b83cf=typeof _0x173d1a[_0x9cdd('0x21')]==='undefined'&&typeof _0x173d1a[_0x9cdd('0x22')]===_0x9cdd('0x23');var _0x23e2db=_0x4a8d42[_0x9cdd('0x24')];var _0x355e3c=_0x1b83cf?0x0:_0x173d1a[_0x9cdd('0x21')];var _0x5a4169=_0x1b83cf?_0x4a8d42[_0x9cdd('0x24')]:_0x173d1a[_0x9cdd('0x21')]+_0x173d1a[_0x9cdd('0x22')];var _0x177859;if(_0x5a4169>=_0x23e2db){_0x5a4169=_0x23e2db;_0x177859=0xc8;}else{_0x177859=0xce;}_0x4924d0[_0x9cdd('0x20')](_0x177859);return _0x4924d0[_0x9cdd('0x25')]('Content-Range',_0x355e3c+'-'+_0x5a4169+'/'+_0x23e2db)['json'](_0x4a8d42);}return null;};}function patchUpdates(_0x3576c9){return function(_0x7bdca6){try{jsonpatch['apply'](_0x7bdca6,_0x3576c9,!![]);}catch(_0xd51c46){return BPromise[_0x9cdd('0x26')](_0xd51c46);}return _0x7bdca6['save']();};}function saveUpdates(_0x5dbee4,_0x429cef){return function(_0x200b28){if(_0x200b28){return _0x200b28[_0x9cdd('0x27')](_0x5dbee4)[_0x9cdd('0x28')](function(_0x43bbc3){return _0x43bbc3;});}return null;};}function removeEntity(_0x1102fb,_0x2bfa72){return function(_0x4aefdc){if(_0x4aefdc){return _0x4aefdc[_0x9cdd('0x29')]()[_0x9cdd('0x28')](function(){var _0x5d08f2=_0x4aefdc['get']({'plain':!![]});var _0x1a9d3f=_0x9cdd('0x2a');return db['UserProfileResource'][_0x9cdd('0x29')]({'where':{'type':_0x1a9d3f,'resourceId':_0x5d08f2['id']}})[_0x9cdd('0x28')](function(){return _0x4aefdc;});})[_0x9cdd('0x28')](function(){_0x1102fb[_0x9cdd('0x20')](0xcc)[_0x9cdd('0x1f')]();});}};}function handleEntityNotFound(_0x1c8b8e,_0x305192){return function(_0x3b105c){if(!_0x3b105c){_0x1c8b8e[_0x9cdd('0x2b')](0x194);}return _0x3b105c;};}function handleError(_0x3faf00,_0x1065fa){_0x1065fa=_0x1065fa||0x1f4;return function(_0x4b7206){logger[_0x9cdd('0x2c')](_0x4b7206[_0x9cdd('0x2d')]);if(_0x4b7206[_0x9cdd('0x2e')]){delete _0x4b7206['name'];}_0x3faf00[_0x9cdd('0x20')](_0x1065fa)[_0x9cdd('0x2f')](_0x4b7206);};}exports[_0x9cdd('0x30')]=function(_0x35e684,_0x4092b0){var _0x24a49a={},_0x2b2be0={},_0x25c1cf={'count':0x0,'rows':[]};var _0x337a2b=_[_0x9cdd('0x31')](db[_0x9cdd('0x32')][_0x9cdd('0x33')],function(_0x4a5e16){return{'name':_0x4a5e16[_0x9cdd('0x34')],'type':_0x4a5e16[_0x9cdd('0x35')][_0x9cdd('0x36')]};});_0x2b2be0[_0x9cdd('0x37')]=_[_0x9cdd('0x31')](_0x337a2b,_0x9cdd('0x2e'));_0x2b2be0[_0x9cdd('0x38')]=_[_0x9cdd('0x39')](_0x35e684[_0x9cdd('0x38')]);_0x2b2be0[_0x9cdd('0x3a')]=_[_0x9cdd('0x3b')](_0x2b2be0[_0x9cdd('0x37')],_0x2b2be0['query']);_0x24a49a[_0x9cdd('0x3c')]=_[_0x9cdd('0x3b')](_0x2b2be0[_0x9cdd('0x37')],qs[_0x9cdd('0x3d')](_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x3d')]));_0x24a49a[_0x9cdd('0x3c')]=_0x24a49a[_0x9cdd('0x3c')][_0x9cdd('0x3e')]?_0x24a49a[_0x9cdd('0x3c')]:_0x2b2be0[_0x9cdd('0x37')];if(!_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x3f')](_0x9cdd('0x40'))){_0x24a49a['limit']=qs[_0x9cdd('0x22')](_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x22')]);_0x24a49a['offset']=qs[_0x9cdd('0x21')](_0x35e684[_0x9cdd('0x38')]['offset']);}_0x24a49a[_0x9cdd('0x41')]=qs[_0x9cdd('0x42')](_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x42')]);_0x24a49a[_0x9cdd('0x43')]=qs[_0x9cdd('0x3a')](_[_0x9cdd('0x44')](_0x35e684['query'],_0x2b2be0[_0x9cdd('0x3a')]),_0x337a2b);if(_0x35e684[_0x9cdd('0x38')]['filter']){_0x24a49a[_0x9cdd('0x43')]=_[_0x9cdd('0x45')](_0x24a49a[_0x9cdd('0x43')],{'$or':_[_0x9cdd('0x31')](_0x337a2b,function(_0xb8d7e3){if(_0xb8d7e3[_0x9cdd('0x35')]!==_0x9cdd('0x46')){var _0x5439f5={};_0x5439f5[_0xb8d7e3[_0x9cdd('0x2e')]]={'$like':'%'+_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x47')]+'%'};return _0x5439f5;}})});}_0x24a49a=_[_0x9cdd('0x45')]({},_0x24a49a,_0x35e684[_0x9cdd('0x48')]);var _0xbfdca1={'where':_0x24a49a['where']};return db[_0x9cdd('0x32')]['count'](_0xbfdca1)[_0x9cdd('0x28')](function(_0x14830b){_0x25c1cf['count']=_0x14830b;if(_0x35e684[_0x9cdd('0x38')][_0x9cdd('0x49')]){_0x24a49a[_0x9cdd('0x4a')]=[{'all':!![]}];}return db[_0x9cdd('0x32')][_0x9cdd('0x4b')](_0x24a49a);})[_0x9cdd('0x28')](function(_0x130f6b){_0x25c1cf['rows']=_0x130f6b;return _0x25c1cf;})['then'](respondWithFilteredResult(_0x4092b0,_0x24a49a))[_0x9cdd('0x4c')](handleError(_0x4092b0,null));};exports[_0x9cdd('0x4d')]=function(_0x4c7df1,_0x3e4395){var _0x38c061={'raw':![],'where':{'id':_0x4c7df1['params']['id']}},_0x12c3f9={};_0x12c3f9[_0x9cdd('0x37')]=_[_0x9cdd('0x39')](db[_0x9cdd('0x32')][_0x9cdd('0x33')]);_0x12c3f9['query']=_['keys'](_0x4c7df1[_0x9cdd('0x38')]);_0x12c3f9[_0x9cdd('0x3a')]=_[_0x9cdd('0x3b')](_0x12c3f9[_0x9cdd('0x37')],_0x12c3f9[_0x9cdd('0x38')]);_0x38c061[_0x9cdd('0x3c')]=_[_0x9cdd('0x3b')](_0x12c3f9[_0x9cdd('0x37')],qs[_0x9cdd('0x3d')](_0x4c7df1[_0x9cdd('0x38')]['fields']));_0x38c061[_0x9cdd('0x3c')]=_0x38c061[_0x9cdd('0x3c')][_0x9cdd('0x3e')]?_0x38c061[_0x9cdd('0x3c')]:_0x12c3f9['model'];if(_0x4c7df1[_0x9cdd('0x38')]['includeAll']){_0x38c061[_0x9cdd('0x4a')]=[{'all':!![]}];}_0x38c061=_[_0x9cdd('0x45')]({},_0x38c061,_0x4c7df1[_0x9cdd('0x48')]);return db['Dashboard'][_0x9cdd('0x4e')](_0x38c061)[_0x9cdd('0x28')](handleEntityNotFound(_0x3e4395,null))[_0x9cdd('0x28')](respondWithResult(_0x3e4395,null))[_0x9cdd('0x4c')](handleError(_0x3e4395,null));};exports[_0x9cdd('0x4f')]=function(_0x40dcdc,_0x28139d){return db[_0x9cdd('0x32')]['create'](_0x40dcdc[_0x9cdd('0x50')],{})[_0x9cdd('0x28')](function(_0x1689ed){var _0x2a060e=_0x40dcdc[_0x9cdd('0x51')]['get']({'plain':!![]});if(!_0x2a060e)throw new Error(_0x9cdd('0x52'));if(_0x2a060e[_0x9cdd('0x53')]===_0x9cdd('0x51')){var _0x7bb574=_0x1689ed['get']({'plain':!![]});var _0x377177=_0x9cdd('0x2a');return db[_0x9cdd('0x54')][_0x9cdd('0x4e')]({'where':{'name':_0x377177,'userProfileId':_0x2a060e[_0x9cdd('0x55')]},'raw':!![]})['then'](function(_0x302024){if(_0x302024&&_0x302024[_0x9cdd('0x56')]===0x0){return db[_0x9cdd('0x57')][_0x9cdd('0x4f')]({'name':_0x7bb574['name'],'resourceId':_0x7bb574['id'],'type':_0x302024['name'],'sectionId':_0x302024['id']},{})[_0x9cdd('0x28')](function(){return _0x1689ed;});}else{return _0x1689ed;}})[_0x9cdd('0x4c')](function(_0x2e691a){logger[_0x9cdd('0x2c')](_0x9cdd('0x58'),_0x2e691a);throw _0x2e691a;});}return _0x1689ed;})['then'](respondWithResult(_0x28139d,0xc9))[_0x9cdd('0x4c')](handleError(_0x28139d,null));};exports['clone']=function(_0x51907b,_0x280a1b){var _0x1bb8d1={'where':{'id':_0x51907b['params']['id']}},_0x7c25e2={};_0x7c25e2[_0x9cdd('0x37')]=_['keys'](db[_0x9cdd('0x32')][_0x9cdd('0x33')]);_0x1bb8d1[_0x9cdd('0x3c')]=_['intersection'](_0x7c25e2[_0x9cdd('0x37')],qs[_0x9cdd('0x3d')](_0x51907b[_0x9cdd('0x38')][_0x9cdd('0x3d')]));_0x1bb8d1[_0x9cdd('0x3c')]=_0x1bb8d1[_0x9cdd('0x3c')][_0x9cdd('0x3e')]?_0x1bb8d1[_0x9cdd('0x3c')]:_0x7c25e2[_0x9cdd('0x37')];if(_0x51907b[_0x9cdd('0x38')]['includeAll']){_0x1bb8d1[_0x9cdd('0x4a')]=[{'all':!![]}];}_0x1bb8d1=_[_0x9cdd('0x45')]({},_0x1bb8d1,_0x51907b[_0x9cdd('0x48')]);return db[_0x9cdd('0x32')][_0x9cdd('0x4e')](_0x1bb8d1)['then'](handleEntityNotFound(_0x280a1b,null))[_0x9cdd('0x28')](function(_0x5dee93){if(_0x5dee93){var _0x325a7e=_0x5dee93[_0x9cdd('0x59')]({'plain':!![]});_0x325a7e=qs[_0x9cdd('0x5a')](_0x325a7e,['id',_0x9cdd('0x5b'),_0x9cdd('0x5c')]);_0x51907b[_0x9cdd('0x50')]=_[_0x9cdd('0x5a')](_0x51907b[_0x9cdd('0x50')],['id',_0x9cdd('0x5b'),_0x9cdd('0x5c')]);return db[_0x9cdd('0x32')][_0x9cdd('0x4f')](_[_0x9cdd('0x45')](_0x325a7e,_0x51907b[_0x9cdd('0x50')]),{'include':_0x51907b[_0x9cdd('0x38')][_0x9cdd('0x49')]?[{'all':!![]}]:undefined})[_0x9cdd('0x28')](function(_0x4f0b2e){var _0x2904f6=_0x51907b['user']['get']({'plain':!![]});if(!_0x2904f6)throw new Error(_0x9cdd('0x52'));if(_0x2904f6[_0x9cdd('0x53')]===_0x9cdd('0x51')){var _0x4a0c90=_0x4f0b2e[_0x9cdd('0x59')]({'plain':!![]});var _0x434de5=_0x9cdd('0x2a');return db['UserProfileSection'][_0x9cdd('0x4e')]({'where':{'name':_0x434de5,'userProfileId':_0x2904f6[_0x9cdd('0x55')]},'raw':!![]})[_0x9cdd('0x28')](function(_0x52335e){if(_0x52335e&&_0x52335e[_0x9cdd('0x56')]===0x0){return db[_0x9cdd('0x57')][_0x9cdd('0x4f')]({'name':_0x4a0c90['name'],'resourceId':_0x4a0c90['id'],'type':_0x52335e[_0x9cdd('0x2e')],'sectionId':_0x52335e['id']},{})[_0x9cdd('0x28')](function(){return _0x4f0b2e;});}else{return _0x4f0b2e;}})[_0x9cdd('0x4c')](function(_0x388713){logger['error'](_0x9cdd('0x58'),_0x388713);throw _0x388713;});}return _0x4f0b2e;});}})[_0x9cdd('0x28')](respondWithResult(_0x280a1b,0xc9))['catch'](handleError(_0x280a1b,null));};exports[_0x9cdd('0x27')]=function(_0x56fcac,_0x3f90b3){if(_0x56fcac[_0x9cdd('0x50')]['id']){delete _0x56fcac[_0x9cdd('0x50')]['id'];}return db[_0x9cdd('0x32')][_0x9cdd('0x4e')]({'where':{'id':_0x56fcac[_0x9cdd('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3f90b3,null))[_0x9cdd('0x28')](saveUpdates(_0x56fcac[_0x9cdd('0x50')],null))[_0x9cdd('0x28')](respondWithResult(_0x3f90b3,null))[_0x9cdd('0x4c')](handleError(_0x3f90b3,null));};exports['destroy']=function(_0x2041b8,_0x515f94){return db['Dashboard'][_0x9cdd('0x4e')]({'where':{'id':_0x2041b8[_0x9cdd('0x5d')]['id']}})[_0x9cdd('0x28')](handleEntityNotFound(_0x515f94,null))[_0x9cdd('0x28')](removeEntity(_0x515f94,null))[_0x9cdd('0x4c')](handleError(_0x515f94,null));};function widgetAttributes(_0x1a355d){try{switch(_0x1a355d[_0x9cdd('0x35')]){case _0x9cdd('0x5e'):return[{'name':'attrUrl','value':_0x1a355d[_0x9cdd('0x5f')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d[_0x9cdd('0x60')][0x0]['value']:undefined)||_0x9cdd('0x61')}];case _0x9cdd('0x62'):return[{'name':_0x9cdd('0x63'),'value':_0x1a355d['attrPath']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d[_0x9cdd('0x60')][0x0]['value']:undefined)||''}];case _0x9cdd('0x64'):return[{'name':_0x9cdd('0x65'),'value':_0x1a355d['attrHourFormat']||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d['attrs'][0x0][_0x9cdd('0x66')]:undefined)||_0x9cdd('0x67')},{'name':_0x9cdd('0x68'),'value':_0x1a355d[_0x9cdd('0x68')]||(_0x1a355d['attrs']&&_0x1a355d['attrs'][0x1]?_0x1a355d[_0x9cdd('0x60')][0x1][_0x9cdd('0x66')]:undefined)||_0x9cdd('0x69')},{'name':'attrFontSize','value':_0x1a355d[_0x9cdd('0x6a')]||(_0x1a355d['attrs']&&_0x1a355d['attrs'][0x2]?_0x1a355d['attrs'][0x2][_0x9cdd('0x66')]:undefined)||0xc}];case _0x9cdd('0x6b'):return[{'name':'attrMetric','value':_0x1a355d[_0x9cdd('0x6c')]||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d['attrs'][0x0]['value']:undefined)||_0x9cdd('0x6d')},{'name':_0x9cdd('0x6e'),'value':_0x1a355d[_0x9cdd('0x6e')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x1]?_0x1a355d['attrs'][0x1][_0x9cdd('0x66')]:undefined)||[]},{'name':_0x9cdd('0x6a'),'value':_0x1a355d[_0x9cdd('0x6a')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x2]?_0x1a355d[_0x9cdd('0x60')][0x2][_0x9cdd('0x66')]:undefined)||0x14},{'name':'attrChannel','value':_0x1a355d['attrChannel']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x3]?_0x1a355d[_0x9cdd('0x60')][0x3]['value']:undefined)||_0x9cdd('0x6f')},{'name':_0x9cdd('0x70'),'value':_0x1a355d[_0x9cdd('0x70')]||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x4]?_0x1a355d[_0x9cdd('0x60')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x1a355d['attrFaxAccounts']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x5]?_0x1a355d[_0x9cdd('0x60')][0x5][_0x9cdd('0x66')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1a355d[_0x9cdd('0x71')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x6]?_0x1a355d[_0x9cdd('0x60')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1a355d['attrOpenchannelAccounts']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x7]?_0x1a355d[_0x9cdd('0x60')][0x7][_0x9cdd('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1a355d[_0x9cdd('0x72')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x8]?_0x1a355d[_0x9cdd('0x60')][0x8][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x73'),'value':_0x1a355d[_0x9cdd('0x73')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x9]?_0x1a355d[_0x9cdd('0x60')][0x9][_0x9cdd('0x66')]:undefined)||''}];case _0x9cdd('0x74'):case _0x9cdd('0x75'):return[{'name':_0x9cdd('0x76'),'value':_0x1a355d[_0x9cdd('0x76')]||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d[_0x9cdd('0x60')][0x0][_0x9cdd('0x66')]:undefined)||_0x9cdd('0x6d')},{'name':_0x9cdd('0x77'),'value':_0x1a355d[_0x9cdd('0x77')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x1]?_0x1a355d[_0x9cdd('0x60')][0x1][_0x9cdd('0x66')]:undefined)||null},{'name':_0x9cdd('0x78'),'value':_0x1a355d[_0x9cdd('0x78')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x2]?_0x1a355d['attrs'][0x2]['value']:undefined)||null},{'name':_0x9cdd('0x6e'),'value':_0x1a355d['attrVoiceQueues']||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x3]?_0x1a355d['attrs'][0x3]['value']:undefined)||[]},{'name':_0x9cdd('0x79'),'value':_0x1a355d[_0x9cdd('0x79')]||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x4]?_0x1a355d[_0x9cdd('0x60')][0x4][_0x9cdd('0x66')]:undefined)||_0x9cdd('0x6f')},{'name':_0x9cdd('0x70'),'value':_0x1a355d[_0x9cdd('0x70')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x5]?_0x1a355d[_0x9cdd('0x60')][0x5][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x7a'),'value':_0x1a355d[_0x9cdd('0x7a')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x6]?_0x1a355d[_0x9cdd('0x60')][0x6][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x71'),'value':_0x1a355d['attrSmsAccounts']||(_0x1a355d['attrs']&&_0x1a355d[_0x9cdd('0x60')][0x7]?_0x1a355d[_0x9cdd('0x60')][0x7][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x7b'),'value':_0x1a355d[_0x9cdd('0x7b')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x8]?_0x1a355d[_0x9cdd('0x60')][0x8][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x72'),'value':_0x1a355d[_0x9cdd('0x72')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x9]?_0x1a355d['attrs'][0x9][_0x9cdd('0x66')]:undefined)||''},{'name':_0x9cdd('0x73'),'value':_0x1a355d[_0x9cdd('0x73')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0xa]?_0x1a355d[_0x9cdd('0x60')][0xa][_0x9cdd('0x66')]:undefined)||''}];case'web-report':return[{'name':_0x9cdd('0x7c'),'type':_0x1a355d[_0x9cdd('0x7d')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x0]?_0x1a355d['attrs'][0x0]['type']:undefined)||null,'value':_0x1a355d[_0x9cdd('0x7c')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d['attrs'][0x0]?_0x1a355d[_0x9cdd('0x60')][0x0][_0x9cdd('0x66')]:undefined)||null},{'name':_0x9cdd('0x7e'),'value':_0x1a355d[_0x9cdd('0x7e')]||(_0x1a355d[_0x9cdd('0x60')]&&_0x1a355d[_0x9cdd('0x60')][0x1]?_0x1a355d[_0x9cdd('0x60')][0x1][_0x9cdd('0x66')]:undefined)||0x0}];default:return[];}}catch(_0xdfbb1){logger[_0x9cdd('0x2c')](_0x9cdd('0x7f'),JSON['stringify'](_0xdfbb1));return[];}}exports[_0x9cdd('0x80')]=function(_0x43553b,_0xd073ca,_0x1b4105){if(_0x43553b[_0x9cdd('0x50')]['id']){delete _0x43553b[_0x9cdd('0x50')]['id'];}return db['Dashboard'][_0x9cdd('0x4e')]({'where':{'id':_0x43553b['params']['id']}})[_0x9cdd('0x28')](handleEntityNotFound(_0xd073ca,null))['then'](function(_0x450204){if(_0x450204){_0x43553b[_0x9cdd('0x50')][_0x9cdd('0x81')]=_0x450204['id'];_0x43553b[_0x9cdd('0x50')][_0x9cdd('0x60')]=widgetAttributes(_0x43553b[_0x9cdd('0x50')]);return db[_0x9cdd('0x82')][_0x9cdd('0x4f')](_0x43553b[_0x9cdd('0x50')]);}})['then'](respondWithResult(_0xd073ca,null))[_0x9cdd('0x4c')](handleError(_0xd073ca,null));};exports[_0x9cdd('0x83')]=function(_0x403ab1,_0x3cf23b,_0xf396b6){var _0x2e6be9={};var _0xdb7fd6={};var _0x236fa6;var _0x15420b;return db[_0x9cdd('0x32')][_0x9cdd('0x84')]({'where':{'id':_0x403ab1[_0x9cdd('0x5d')]['id']}})[_0x9cdd('0x28')](handleEntityNotFound(_0x3cf23b,null))[_0x9cdd('0x28')](function(_0x95d0b3){if(_0x95d0b3){_0x236fa6=_0x95d0b3;_0xdb7fd6[_0x9cdd('0x37')]=_[_0x9cdd('0x39')](db['DashboardItem']['rawAttributes']);_0xdb7fd6[_0x9cdd('0x38')]=_['keys'](_0x403ab1[_0x9cdd('0x38')]);_0xdb7fd6['filters']=_[_0x9cdd('0x3b')](_0xdb7fd6[_0x9cdd('0x37')],_0xdb7fd6[_0x9cdd('0x38')]);_0x2e6be9[_0x9cdd('0x3c')]=_['intersection'](_0xdb7fd6['model'],qs[_0x9cdd('0x3d')](_0x403ab1[_0x9cdd('0x38')]['fields']));_0x2e6be9[_0x9cdd('0x3c')]=_0x2e6be9['attributes'][_0x9cdd('0x3e')]?_0x2e6be9['attributes']:_0xdb7fd6[_0x9cdd('0x37')];_0x2e6be9['order']=qs[_0x9cdd('0x42')](_0x403ab1[_0x9cdd('0x38')][_0x9cdd('0x42')]);_0x2e6be9[_0x9cdd('0x43')]=qs[_0x9cdd('0x3a')](_[_0x9cdd('0x44')](_0x403ab1[_0x9cdd('0x38')],_0xdb7fd6[_0x9cdd('0x3a')]));if(_0x403ab1[_0x9cdd('0x38')]['filter']){_0x2e6be9[_0x9cdd('0x43')]=_[_0x9cdd('0x45')](_0x2e6be9['where'],{'$or':_['map'](_0x2e6be9[_0x9cdd('0x3c')],function(_0x21ecf5){var _0x11ab04={};_0x11ab04[_0x21ecf5]={'$like':'%'+_0x403ab1[_0x9cdd('0x38')]['filter']+'%'};return _0x11ab04;})});}_0x2e6be9=_['merge']({},_0x2e6be9,_0x403ab1[_0x9cdd('0x48')]);return _0x236fa6[_0x9cdd('0x83')](_0x2e6be9);}})[_0x9cdd('0x28')](function(_0x5ed353){if(_0x5ed353){_0x15420b=_0x5ed353[_0x9cdd('0x3e')];if(!_0x403ab1[_0x9cdd('0x38')][_0x9cdd('0x3f')]('nolimit')){_0x2e6be9[_0x9cdd('0x22')]=qs[_0x9cdd('0x22')](_0x403ab1[_0x9cdd('0x38')][_0x9cdd('0x22')]);_0x2e6be9[_0x9cdd('0x21')]=qs[_0x9cdd('0x21')](_0x403ab1[_0x9cdd('0x38')][_0x9cdd('0x21')]);}return _0x236fa6[_0x9cdd('0x83')](_0x2e6be9);}})['then'](function(_0x1c7fca){if(_0x1c7fca){return _0x1c7fca?{'count':_0x15420b,'rows':_0x1c7fca}:null;}})[_0x9cdd('0x28')](respondWithResult(_0x3cf23b,null))['catch'](handleError(_0x3cf23b,null));}; \ No newline at end of file +var _0x73c6=['attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','findOne','getItems','eml-format','rimraf','fast-json-patch','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','get','CustomDashboards','destroy','error','stack','name','send','map','Dashboard','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','show','params','options','catch','create','role','user','UserProfileSection','find','autoAssociation','clone','updatedAt','body','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice'];(function(_0x1c451d,_0x11814a){var _0x3b54de=function(_0x5afa2d){while(--_0x5afa2d){_0x1c451d['push'](_0x1c451d['shift']());}};_0x3b54de(++_0x11814a);}(_0x73c6,0x11d));var _0x673c=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x73c6[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0x673c('0x0'));var rimraf=require(_0x673c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x673c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x673c('0x3'));var Mustache=require(_0x673c('0x4'));var util=require(_0x673c('0x5'));var path=require('path');var sox=require(_0x673c('0x6'));var csv=require(_0x673c('0x7'));var ejs=require(_0x673c('0x8'));var fs=require('fs');var fs_extra=require(_0x673c('0x9'));var _=require(_0x673c('0xa'));var squel=require(_0x673c('0xb'));var crypto=require(_0x673c('0xc'));var jsforce=require(_0x673c('0xd'));var deskjs=require(_0x673c('0xe'));var toCsv=require(_0x673c('0x7'));var querystring=require(_0x673c('0xf'));var Papa=require(_0x673c('0x10'));var Redis=require(_0x673c('0x11'));var authService=require(_0x673c('0x12'));var qs=require(_0x673c('0x13'));var as=require(_0x673c('0x14'));var hardwareService=require(_0x673c('0x15'));var logger=require(_0x673c('0x16'))(_0x673c('0x17'));var utils=require(_0x673c('0x18'));var config=require(_0x673c('0x19'));var licenseUtil=require(_0x673c('0x1a'));var db=require(_0x673c('0x1b'))['db'];config[_0x673c('0x1c')]=_[_0x673c('0x1d')](config['redis'],{'host':_0x673c('0x1e'),'port':0x18eb});var socket=require(_0x673c('0x1f'))(new Redis(config[_0x673c('0x1c')]));require(_0x673c('0x20'))[_0x673c('0x21')](socket);function respondWithStatusCode(_0x3e0afa,_0x8e1f08){_0x8e1f08=_0x8e1f08||0xcc;return function(_0x300d3c){if(_0x300d3c){return _0x3e0afa[_0x673c('0x22')](_0x8e1f08);}return _0x3e0afa['status'](_0x8e1f08)[_0x673c('0x23')]();};}function respondWithResult(_0x12e10e,_0x5c1e33){_0x5c1e33=_0x5c1e33||0xc8;return function(_0x5e70b2){if(_0x5e70b2){return _0x12e10e[_0x673c('0x24')](_0x5c1e33)[_0x673c('0x25')](_0x5e70b2);}};}function respondWithFilteredResult(_0x250f5a,_0x98c9c4){return function(_0x3ea223){if(_0x3ea223){var _0x357702=typeof _0x98c9c4[_0x673c('0x26')]==='undefined'&&typeof _0x98c9c4[_0x673c('0x27')]===_0x673c('0x28');var _0x5258fc=_0x3ea223[_0x673c('0x29')];var _0x142270=_0x357702?0x0:_0x98c9c4[_0x673c('0x26')];var _0x46df93=_0x357702?_0x3ea223[_0x673c('0x29')]:_0x98c9c4[_0x673c('0x26')]+_0x98c9c4[_0x673c('0x27')];var _0x3ff206;if(_0x46df93>=_0x5258fc){_0x46df93=_0x5258fc;_0x3ff206=0xc8;}else{_0x3ff206=0xce;}_0x250f5a[_0x673c('0x24')](_0x3ff206);return _0x250f5a[_0x673c('0x2a')](_0x673c('0x2b'),_0x142270+'-'+_0x46df93+'/'+_0x5258fc)[_0x673c('0x25')](_0x3ea223);}return null;};}function patchUpdates(_0x50b302){return function(_0x59f6ac){try{jsonpatch[_0x673c('0x2c')](_0x59f6ac,_0x50b302,!![]);}catch(_0x357e81){return BPromise['reject'](_0x357e81);}return _0x59f6ac[_0x673c('0x2d')]();};}function saveUpdates(_0x19b70e,_0x2d89af){return function(_0x4cf7d0){if(_0x4cf7d0){return _0x4cf7d0['update'](_0x19b70e)[_0x673c('0x2e')](function(_0x379bec){return _0x379bec;});}return null;};}function removeEntity(_0x728ca3,_0x371f03){return function(_0x25902a){if(_0x25902a){return _0x25902a['destroy']()[_0x673c('0x2e')](function(){var _0x1576a9=_0x25902a[_0x673c('0x2f')]({'plain':!![]});var _0x137726=_0x673c('0x30');return db['UserProfileResource'][_0x673c('0x31')]({'where':{'type':_0x137726,'resourceId':_0x1576a9['id']}})[_0x673c('0x2e')](function(){return _0x25902a;});})[_0x673c('0x2e')](function(){_0x728ca3['status'](0xcc)[_0x673c('0x23')]();});}};}function handleEntityNotFound(_0x3ada6,_0x373771){return function(_0x1a6c7e){if(!_0x1a6c7e){_0x3ada6[_0x673c('0x22')](0x194);}return _0x1a6c7e;};}function handleError(_0x2249f8,_0x53af7c){_0x53af7c=_0x53af7c||0x1f4;return function(_0xef4bf8){logger[_0x673c('0x32')](_0xef4bf8[_0x673c('0x33')]);if(_0xef4bf8['name']){delete _0xef4bf8[_0x673c('0x34')];}_0x2249f8['status'](_0x53af7c)[_0x673c('0x35')](_0xef4bf8);};}exports['index']=function(_0x5ea637,_0x1cd81c){var _0x4efbfd={},_0x1abbeb={},_0x590feb={'count':0x0,'rows':[]};var _0x361d67=_[_0x673c('0x36')](db[_0x673c('0x37')][_0x673c('0x38')],function(_0x1a7b98){return{'name':_0x1a7b98['fieldName'],'type':_0x1a7b98[_0x673c('0x39')][_0x673c('0x3a')]};});_0x1abbeb[_0x673c('0x3b')]=_[_0x673c('0x36')](_0x361d67,_0x673c('0x34'));_0x1abbeb[_0x673c('0x3c')]=_[_0x673c('0x3d')](_0x5ea637[_0x673c('0x3c')]);_0x1abbeb['filters']=_[_0x673c('0x3e')](_0x1abbeb[_0x673c('0x3b')],_0x1abbeb[_0x673c('0x3c')]);_0x4efbfd['attributes']=_[_0x673c('0x3e')](_0x1abbeb[_0x673c('0x3b')],qs[_0x673c('0x3f')](_0x5ea637[_0x673c('0x3c')]['fields']));_0x4efbfd[_0x673c('0x40')]=_0x4efbfd[_0x673c('0x40')][_0x673c('0x41')]?_0x4efbfd[_0x673c('0x40')]:_0x1abbeb[_0x673c('0x3b')];if(!_0x5ea637['query'][_0x673c('0x42')](_0x673c('0x43'))){_0x4efbfd[_0x673c('0x27')]=qs[_0x673c('0x27')](_0x5ea637[_0x673c('0x3c')][_0x673c('0x27')]);_0x4efbfd[_0x673c('0x26')]=qs['offset'](_0x5ea637['query']['offset']);}_0x4efbfd[_0x673c('0x44')]=qs[_0x673c('0x45')](_0x5ea637[_0x673c('0x3c')][_0x673c('0x45')]);_0x4efbfd[_0x673c('0x46')]=qs[_0x673c('0x47')](_[_0x673c('0x48')](_0x5ea637['query'],_0x1abbeb[_0x673c('0x47')]),_0x361d67);if(_0x5ea637[_0x673c('0x3c')][_0x673c('0x49')]){_0x4efbfd[_0x673c('0x46')]=_['merge'](_0x4efbfd[_0x673c('0x46')],{'$or':_[_0x673c('0x36')](_0x361d67,function(_0x90b4ae){if(_0x90b4ae[_0x673c('0x39')]!==_0x673c('0x4a')){var _0x2a8929={};_0x2a8929[_0x90b4ae[_0x673c('0x34')]]={'$like':'%'+_0x5ea637[_0x673c('0x3c')][_0x673c('0x49')]+'%'};return _0x2a8929;}})});}_0x4efbfd=_[_0x673c('0x4b')]({},_0x4efbfd,_0x5ea637['options']);var _0x4eaad7={'where':_0x4efbfd[_0x673c('0x46')]};return db[_0x673c('0x37')][_0x673c('0x29')](_0x4eaad7)[_0x673c('0x2e')](function(_0x50a4b8){_0x590feb[_0x673c('0x29')]=_0x50a4b8;if(_0x5ea637[_0x673c('0x3c')][_0x673c('0x4c')]){_0x4efbfd[_0x673c('0x4d')]=[{'all':!![]}];}return db['Dashboard'][_0x673c('0x4e')](_0x4efbfd);})[_0x673c('0x2e')](function(_0x4ce55e){_0x590feb['rows']=_0x4ce55e;return _0x590feb;})[_0x673c('0x2e')](respondWithFilteredResult(_0x1cd81c,_0x4efbfd))['catch'](handleError(_0x1cd81c,null));};exports[_0x673c('0x4f')]=function(_0x27b786,_0x8389a8){var _0x3a7246={'raw':![],'where':{'id':_0x27b786[_0x673c('0x50')]['id']}},_0x8fabff={};_0x8fabff[_0x673c('0x3b')]=_[_0x673c('0x3d')](db[_0x673c('0x37')]['rawAttributes']);_0x8fabff[_0x673c('0x3c')]=_[_0x673c('0x3d')](_0x27b786[_0x673c('0x3c')]);_0x8fabff[_0x673c('0x47')]=_[_0x673c('0x3e')](_0x8fabff[_0x673c('0x3b')],_0x8fabff['query']);_0x3a7246[_0x673c('0x40')]=_['intersection'](_0x8fabff[_0x673c('0x3b')],qs[_0x673c('0x3f')](_0x27b786[_0x673c('0x3c')][_0x673c('0x3f')]));_0x3a7246['attributes']=_0x3a7246[_0x673c('0x40')][_0x673c('0x41')]?_0x3a7246[_0x673c('0x40')]:_0x8fabff[_0x673c('0x3b')];if(_0x27b786[_0x673c('0x3c')][_0x673c('0x4c')]){_0x3a7246[_0x673c('0x4d')]=[{'all':!![]}];}_0x3a7246=_['merge']({},_0x3a7246,_0x27b786[_0x673c('0x51')]);return db['Dashboard']['find'](_0x3a7246)[_0x673c('0x2e')](handleEntityNotFound(_0x8389a8,null))[_0x673c('0x2e')](respondWithResult(_0x8389a8,null))[_0x673c('0x52')](handleError(_0x8389a8,null));};exports['create']=function(_0x3bff75,_0x1c577a){return db[_0x673c('0x37')][_0x673c('0x53')](_0x3bff75['body'],{})[_0x673c('0x2e')](function(_0xf99850){var _0x40a7bd=_0x3bff75['user'][_0x673c('0x2f')]({'plain':!![]});if(!_0x40a7bd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a7bd[_0x673c('0x54')]===_0x673c('0x55')){var _0x4e6f1e=_0xf99850[_0x673c('0x2f')]({'plain':!![]});var _0x596838=_0x673c('0x30');return db[_0x673c('0x56')][_0x673c('0x57')]({'where':{'name':_0x596838,'userProfileId':_0x40a7bd['userProfileId']},'raw':!![]})[_0x673c('0x2e')](function(_0x5d6531){if(_0x5d6531&&_0x5d6531[_0x673c('0x58')]===0x0){return db['UserProfileResource'][_0x673c('0x53')]({'name':_0x4e6f1e[_0x673c('0x34')],'resourceId':_0x4e6f1e['id'],'type':_0x5d6531[_0x673c('0x34')],'sectionId':_0x5d6531['id']},{})[_0x673c('0x2e')](function(){return _0xf99850;});}else{return _0xf99850;}})[_0x673c('0x52')](function(_0x1a93f9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a93f9);throw _0x1a93f9;});}return _0xf99850;})[_0x673c('0x2e')](respondWithResult(_0x1c577a,0xc9))[_0x673c('0x52')](handleError(_0x1c577a,null));};exports[_0x673c('0x59')]=function(_0x4fbc71,_0x247cd8){var _0x329bc2={'where':{'id':_0x4fbc71['params']['id']}},_0xc26f70={};_0xc26f70[_0x673c('0x3b')]=_[_0x673c('0x3d')](db[_0x673c('0x37')][_0x673c('0x38')]);_0x329bc2[_0x673c('0x40')]=_[_0x673c('0x3e')](_0xc26f70['model'],qs['fields'](_0x4fbc71['query']['fields']));_0x329bc2['attributes']=_0x329bc2[_0x673c('0x40')][_0x673c('0x41')]?_0x329bc2[_0x673c('0x40')]:_0xc26f70[_0x673c('0x3b')];if(_0x4fbc71[_0x673c('0x3c')][_0x673c('0x4c')]){_0x329bc2['include']=[{'all':!![]}];}_0x329bc2=_['merge']({},_0x329bc2,_0x4fbc71[_0x673c('0x51')]);return db['Dashboard'][_0x673c('0x57')](_0x329bc2)[_0x673c('0x2e')](handleEntityNotFound(_0x247cd8,null))[_0x673c('0x2e')](function(_0x45b761){if(_0x45b761){var _0x4cd0b1=_0x45b761[_0x673c('0x2f')]({'plain':!![]});_0x4cd0b1=qs['omit'](_0x4cd0b1,['id','createdAt',_0x673c('0x5a')]);_0x4fbc71[_0x673c('0x5b')]=_['omit'](_0x4fbc71[_0x673c('0x5b')],['id','createdAt',_0x673c('0x5a')]);return db[_0x673c('0x37')][_0x673c('0x53')](_[_0x673c('0x4b')](_0x4cd0b1,_0x4fbc71['body']),{'include':_0x4fbc71[_0x673c('0x3c')][_0x673c('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x1b47b1){var _0x2b9551=_0x4fbc71[_0x673c('0x55')][_0x673c('0x2f')]({'plain':!![]});if(!_0x2b9551)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b9551[_0x673c('0x54')]===_0x673c('0x55')){var _0x5896fc=_0x1b47b1[_0x673c('0x2f')]({'plain':!![]});var _0x1d2db8='CustomDashboards';return db[_0x673c('0x56')]['find']({'where':{'name':_0x1d2db8,'userProfileId':_0x2b9551[_0x673c('0x5c')]},'raw':!![]})[_0x673c('0x2e')](function(_0x3ec764){if(_0x3ec764&&_0x3ec764['autoAssociation']===0x0){return db['UserProfileResource'][_0x673c('0x53')]({'name':_0x5896fc[_0x673c('0x34')],'resourceId':_0x5896fc['id'],'type':_0x3ec764[_0x673c('0x34')],'sectionId':_0x3ec764['id']},{})['then'](function(){return _0x1b47b1;});}else{return _0x1b47b1;}})[_0x673c('0x52')](function(_0x37caa5){logger[_0x673c('0x32')](_0x673c('0x5d'),_0x37caa5);throw _0x37caa5;});}return _0x1b47b1;});}})[_0x673c('0x2e')](respondWithResult(_0x247cd8,0xc9))[_0x673c('0x52')](handleError(_0x247cd8,null));};exports[_0x673c('0x5e')]=function(_0x46e8df,_0x15e431){if(_0x46e8df['body']['id']){delete _0x46e8df['body']['id'];}return db['Dashboard'][_0x673c('0x57')]({'where':{'id':_0x46e8df[_0x673c('0x50')]['id']}})[_0x673c('0x2e')](handleEntityNotFound(_0x15e431,null))[_0x673c('0x2e')](saveUpdates(_0x46e8df[_0x673c('0x5b')],null))['then'](respondWithResult(_0x15e431,null))['catch'](handleError(_0x15e431,null));};exports['destroy']=function(_0x5cca7e,_0x172ead){return db[_0x673c('0x37')]['find']({'where':{'id':_0x5cca7e[_0x673c('0x50')]['id']}})[_0x673c('0x2e')](handleEntityNotFound(_0x172ead,null))[_0x673c('0x2e')](removeEntity(_0x172ead,null))['catch'](handleError(_0x172ead,null));};function widgetAttributes(_0x45b79d){try{switch(_0x45b79d['type']){case _0x673c('0x5f'):return[{'name':_0x673c('0x60'),'value':_0x45b79d['attrUrl']||(_0x45b79d['attrs']&&_0x45b79d[_0x673c('0x61')][0x0]?_0x45b79d[_0x673c('0x61')][0x0][_0x673c('0x62')]:undefined)||_0x673c('0x63')}];case _0x673c('0x64'):return[{'name':_0x673c('0x65'),'value':_0x45b79d['attrPath']||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d['attrs'][0x0]?_0x45b79d[_0x673c('0x61')][0x0][_0x673c('0x62')]:undefined)||''}];case _0x673c('0x66'):return[{'name':_0x673c('0x67'),'value':_0x45b79d[_0x673c('0x67')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x0]?_0x45b79d[_0x673c('0x61')][0x0][_0x673c('0x62')]:undefined)||_0x673c('0x68')},{'name':_0x673c('0x69'),'value':_0x45b79d[_0x673c('0x69')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x1]?_0x45b79d[_0x673c('0x61')][0x1][_0x673c('0x62')]:undefined)||_0x673c('0x6a')},{'name':_0x673c('0x6b'),'value':_0x45b79d[_0x673c('0x6b')]||(_0x45b79d['attrs']&&_0x45b79d[_0x673c('0x61')][0x2]?_0x45b79d['attrs'][0x2][_0x673c('0x62')]:undefined)||0xc}];case _0x673c('0x6c'):return[{'name':_0x673c('0x6d'),'value':_0x45b79d[_0x673c('0x6d')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x0]?_0x45b79d[_0x673c('0x61')][0x0]['value']:undefined)||_0x673c('0x6e')},{'name':_0x673c('0x6f'),'value':_0x45b79d[_0x673c('0x6f')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x1]?_0x45b79d[_0x673c('0x61')][0x1][_0x673c('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0x45b79d[_0x673c('0x6b')]||(_0x45b79d['attrs']&&_0x45b79d[_0x673c('0x61')][0x2]?_0x45b79d['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x673c('0x70'),'value':_0x45b79d[_0x673c('0x70')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x3]?_0x45b79d[_0x673c('0x61')][0x3][_0x673c('0x62')]:undefined)||_0x673c('0x71')},{'name':'attrEmailAccounts','value':_0x45b79d[_0x673c('0x72')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d['attrs'][0x4]?_0x45b79d[_0x673c('0x61')][0x4][_0x673c('0x62')]:undefined)||''},{'name':_0x673c('0x73'),'value':_0x45b79d['attrFaxAccounts']||(_0x45b79d['attrs']&&_0x45b79d[_0x673c('0x61')][0x5]?_0x45b79d[_0x673c('0x61')][0x5][_0x673c('0x62')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x45b79d['attrSmsAccounts']||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x6]?_0x45b79d[_0x673c('0x61')][0x6][_0x673c('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x45b79d[_0x673c('0x74')]||(_0x45b79d['attrs']&&_0x45b79d[_0x673c('0x61')][0x7]?_0x45b79d['attrs'][0x7]['value']:undefined)||''},{'name':_0x673c('0x75'),'value':_0x45b79d['attrWhatsappAccounts']||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x8]?_0x45b79d['attrs'][0x8][_0x673c('0x62')]:undefined)||''},{'name':_0x673c('0x76'),'value':_0x45b79d[_0x673c('0x76')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x9]?_0x45b79d['attrs'][0x9][_0x673c('0x62')]:undefined)||''}];case'multibar-chart':case _0x673c('0x77'):return[{'name':'attrSerie1','value':_0x45b79d[_0x673c('0x78')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x0]?_0x45b79d[_0x673c('0x61')][0x0][_0x673c('0x62')]:undefined)||_0x673c('0x6e')},{'name':_0x673c('0x79'),'value':_0x45b79d[_0x673c('0x79')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d['attrs'][0x1]?_0x45b79d[_0x673c('0x61')][0x1][_0x673c('0x62')]:undefined)||null},{'name':_0x673c('0x7a'),'value':_0x45b79d['attrSerie3']||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x2]?_0x45b79d[_0x673c('0x61')][0x2][_0x673c('0x62')]:undefined)||null},{'name':_0x673c('0x6f'),'value':_0x45b79d[_0x673c('0x6f')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x3]?_0x45b79d[_0x673c('0x61')][0x3]['value']:undefined)||[]},{'name':_0x673c('0x70'),'value':_0x45b79d[_0x673c('0x70')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d['attrs'][0x4]?_0x45b79d['attrs'][0x4][_0x673c('0x62')]:undefined)||_0x673c('0x71')},{'name':'attrEmailAccounts','value':_0x45b79d[_0x673c('0x72')]||(_0x45b79d['attrs']&&_0x45b79d['attrs'][0x5]?_0x45b79d['attrs'][0x5][_0x673c('0x62')]:undefined)||''},{'name':_0x673c('0x73'),'value':_0x45b79d[_0x673c('0x73')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d['attrs'][0x6]?_0x45b79d[_0x673c('0x61')][0x6]['value']:undefined)||''},{'name':_0x673c('0x7b'),'value':_0x45b79d[_0x673c('0x7b')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x7]?_0x45b79d[_0x673c('0x61')][0x7][_0x673c('0x62')]:undefined)||''},{'name':_0x673c('0x74'),'value':_0x45b79d[_0x673c('0x74')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x8]?_0x45b79d[_0x673c('0x61')][0x8][_0x673c('0x62')]:undefined)||''},{'name':_0x673c('0x75'),'value':_0x45b79d[_0x673c('0x75')]||(_0x45b79d['attrs']&&_0x45b79d['attrs'][0x9]?_0x45b79d[_0x673c('0x61')][0x9][_0x673c('0x62')]:undefined)||''},{'name':_0x673c('0x76'),'value':_0x45b79d[_0x673c('0x76')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0xa]?_0x45b79d[_0x673c('0x61')][0xa][_0x673c('0x62')]:undefined)||''}];case _0x673c('0x7c'):return[{'name':'attrReport','type':_0x45b79d[_0x673c('0x7d')]||(_0x45b79d['attrs']&&_0x45b79d[_0x673c('0x61')][0x0]?_0x45b79d[_0x673c('0x61')][0x0][_0x673c('0x39')]:undefined)||null,'value':_0x45b79d[_0x673c('0x7e')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x0]?_0x45b79d[_0x673c('0x61')][0x0][_0x673c('0x62')]:undefined)||null},{'name':_0x673c('0x7f'),'value':_0x45b79d[_0x673c('0x7f')]||(_0x45b79d[_0x673c('0x61')]&&_0x45b79d[_0x673c('0x61')][0x1]?_0x45b79d['attrs'][0x1][_0x673c('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x4c6484){logger[_0x673c('0x32')](_0x673c('0x80'),JSON['stringify'](_0x4c6484));return[];}}exports[_0x673c('0x81')]=function(_0x39514f,_0x141e23,_0xbb1823){if(_0x39514f[_0x673c('0x5b')]['id']){delete _0x39514f[_0x673c('0x5b')]['id'];}return db[_0x673c('0x37')][_0x673c('0x57')]({'where':{'id':_0x39514f[_0x673c('0x50')]['id']}})[_0x673c('0x2e')](handleEntityNotFound(_0x141e23,null))[_0x673c('0x2e')](function(_0x9e9352){if(_0x9e9352){_0x39514f[_0x673c('0x5b')][_0x673c('0x82')]=_0x9e9352['id'];_0x39514f[_0x673c('0x5b')][_0x673c('0x61')]=widgetAttributes(_0x39514f[_0x673c('0x5b')]);return db['DashboardItem'][_0x673c('0x53')](_0x39514f[_0x673c('0x5b')]);}})['then'](respondWithResult(_0x141e23,null))['catch'](handleError(_0x141e23,null));};exports['getItems']=function(_0x250e34,_0x25b27b,_0x315ab3){var _0x8f5e07={};var _0x1996c5={};var _0xd4c090;var _0x122637;return db[_0x673c('0x37')][_0x673c('0x83')]({'where':{'id':_0x250e34['params']['id']}})[_0x673c('0x2e')](handleEntityNotFound(_0x25b27b,null))[_0x673c('0x2e')](function(_0x5302b7){if(_0x5302b7){_0xd4c090=_0x5302b7;_0x1996c5[_0x673c('0x3b')]=_[_0x673c('0x3d')](db['DashboardItem']['rawAttributes']);_0x1996c5['query']=_['keys'](_0x250e34[_0x673c('0x3c')]);_0x1996c5['filters']=_[_0x673c('0x3e')](_0x1996c5[_0x673c('0x3b')],_0x1996c5[_0x673c('0x3c')]);_0x8f5e07[_0x673c('0x40')]=_[_0x673c('0x3e')](_0x1996c5[_0x673c('0x3b')],qs[_0x673c('0x3f')](_0x250e34[_0x673c('0x3c')]['fields']));_0x8f5e07[_0x673c('0x40')]=_0x8f5e07[_0x673c('0x40')]['length']?_0x8f5e07[_0x673c('0x40')]:_0x1996c5[_0x673c('0x3b')];_0x8f5e07[_0x673c('0x44')]=qs[_0x673c('0x45')](_0x250e34[_0x673c('0x3c')][_0x673c('0x45')]);_0x8f5e07[_0x673c('0x46')]=qs[_0x673c('0x47')](_['pick'](_0x250e34[_0x673c('0x3c')],_0x1996c5[_0x673c('0x47')]));if(_0x250e34[_0x673c('0x3c')]['filter']){_0x8f5e07[_0x673c('0x46')]=_[_0x673c('0x4b')](_0x8f5e07[_0x673c('0x46')],{'$or':_[_0x673c('0x36')](_0x8f5e07[_0x673c('0x40')],function(_0x243b33){var _0x2de330={};_0x2de330[_0x243b33]={'$like':'%'+_0x250e34[_0x673c('0x3c')][_0x673c('0x49')]+'%'};return _0x2de330;})});}_0x8f5e07=_[_0x673c('0x4b')]({},_0x8f5e07,_0x250e34['options']);return _0xd4c090[_0x673c('0x84')](_0x8f5e07);}})[_0x673c('0x2e')](function(_0x29b520){if(_0x29b520){_0x122637=_0x29b520['length'];if(!_0x250e34[_0x673c('0x3c')][_0x673c('0x42')](_0x673c('0x43'))){_0x8f5e07['limit']=qs[_0x673c('0x27')](_0x250e34[_0x673c('0x3c')][_0x673c('0x27')]);_0x8f5e07[_0x673c('0x26')]=qs[_0x673c('0x26')](_0x250e34[_0x673c('0x3c')][_0x673c('0x26')]);}return _0xd4c090[_0x673c('0x84')](_0x8f5e07);}})['then'](function(_0x5301ac){if(_0x5301ac){return _0x5301ac?{'count':_0x122637,'rows':_0x5301ac}:null;}})['then'](respondWithResult(_0x25b27b,null))[_0x673c('0x52')](handleError(_0x25b27b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8b83628..f00998d 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 _0x52aa=['exports','events','Dashboard','save','update','emit','hook'];(function(_0x5a62cd,_0x2cf6bb){var _0x32bd21=function(_0x1c87ef){while(--_0x1c87ef){_0x5a62cd['push'](_0x5a62cd['shift']());}};_0x32bd21(++_0x2cf6bb);}(_0x52aa,0x1c1));var _0xa52a=function(_0x194f0a,_0x44e965){_0x194f0a=_0x194f0a-0x0;var _0x433080=_0x52aa[_0x194f0a];return _0x433080;};'use strict';var EventEmitter=require(_0xa52a('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xa52a('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa52a('0x2'),'afterUpdate':_0xa52a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x26c796){return function(_0x4f8f04,_0x5dd4d0,_0x541dd5){DashboardEvents[_0xa52a('0x4')](_0x26c796+':'+_0x4f8f04['id'],_0x4f8f04);DashboardEvents[_0xa52a('0x4')](_0x26c796,_0x4f8f04);_0x541dd5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xa52a('0x5')](e,emitEvent(event));}}module[_0xa52a('0x6')]=DashboardEvents; \ No newline at end of file +var _0xfd4e=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4c7e8e,_0x3c5035){var _0x503c3f=function(_0x5a0659){while(--_0x5a0659){_0x4c7e8e['push'](_0x4c7e8e['shift']());}};_0x503c3f(++_0x3c5035);}(_0xfd4e,0x1b0));var _0xefd4=function(_0x40cfd8,_0x23a9c4){_0x40cfd8=_0x40cfd8-0x0;var _0x16d63c=_0xfd4e[_0x40cfd8];return _0x16d63c;};'use strict';var EventEmitter=require(_0xefd4('0x0'));var Dashboard=require(_0xefd4('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xefd4('0x2')](0x0);var events={'afterCreate':_0xefd4('0x3'),'afterUpdate':_0xefd4('0x4'),'afterDestroy':_0xefd4('0x5')};function emitEvent(_0x352790){return function(_0x253018,_0x5436b6,_0x4ba276){DashboardEvents[_0xefd4('0x6')](_0x352790+':'+_0x253018['id'],_0x253018);DashboardEvents[_0xefd4('0x6')](_0x352790,_0x253018);_0x4ba276(null);};}for(var e in events){if(events[_0xefd4('0x7')](e)){var event=events[e];Dashboard[_0xefd4('0x8')](e,emitEvent(event));}}module[_0xefd4('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 66833aa..d6a1e43 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 _0xba58=['path','rimraf','./dashboard.attributes','Dashboard','api','moment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xba58,0x166));var _0x8ba5=function(_0x336b55,_0x51ce29){_0x336b55=_0x336b55-0x0;var _0x45965e=_0xba58[_0x336b55];return _0x45965e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8ba5('0x0'));var moment=require(_0x8ba5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ba5('0x2'));var rimraf=require(_0x8ba5('0x3'));var config=require('../../config/environment');var attributes=require(_0x8ba5('0x4'));module['exports']=function(_0x2b75b6,_0x38dc78){return _0x2b75b6['define'](_0x8ba5('0x5'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x749c=['request-promise','rimraf','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x749c,0xc6));var _0xc749=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x749c[_0x9d639c];return _0x1671de;};'use strict';var _=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var logger=require(_0xc749('0x2'))(_0xc749('0x3'));var moment=require(_0xc749('0x4'));var BPromise=require(_0xc749('0x5'));var rp=require(_0xc749('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc749('0x7'));var config=require(_0xc749('0x8'));var attributes=require(_0xc749('0x9'));module['exports']=function(_0x185a06,_0x3021f0){return _0x185a06['define'](_0xc749('0xa'),attributes,{'tableName':_0xc749('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 4928e84..de6f10b 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 _0x305f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x577c60,_0x250fff){var _0x887a24=function(_0x11e370){while(--_0x11e370){_0x577c60['push'](_0x577c60['shift']());}};_0x887a24(++_0x250fff);}(_0x305f,0x97));var _0xf305=function(_0x3e35d9,_0x30b3dd){_0x3e35d9=_0x3e35d9-0x0;var _0x455aeb=_0x305f[_0x3e35d9];return _0x455aeb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf305('0x0'));var BPromise=require(_0xf305('0x1'));var rs=require(_0xf305('0x2'));var fs=require('fs');var Redis=require(_0xf305('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf305('0x4'));var logger=require(_0xf305('0x5'))(_0xf305('0x6'));var config=require(_0xf305('0x7'));var jayson=require(_0xf305('0x8'));var client=jayson[_0xf305('0x9')][_0xf305('0xa')]({'port':0x232a});config['redis']=_[_0xf305('0xb')](config[_0xf305('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf305('0xd'))(new Redis(config['redis']));require(_0xf305('0xe'))[_0xf305('0xf')](socket);function respondWithRpcPromise(_0x163d8f,_0x4faccf,_0x534288){return new BPromise(function(_0x11e67a,_0x30c7f7){return client[_0xf305('0x10')](_0x163d8f,_0x534288)['then'](function(_0x310ba5){logger[_0xf305('0x11')](_0xf305('0x12'),_0x4faccf,'request\x20sent');logger[_0xf305('0x13')](_0xf305('0x14'),_0x4faccf,_0xf305('0x15'),JSON['stringify'](_0x310ba5));if(_0x310ba5[_0xf305('0x16')]){if(_0x310ba5[_0xf305('0x16')][_0xf305('0x17')]===0x1f4){logger[_0xf305('0x16')](_0xf305('0x12'),_0x4faccf,_0x310ba5[_0xf305('0x16')][_0xf305('0x18')]);return _0x30c7f7(_0x310ba5['error'][_0xf305('0x18')]);}logger[_0xf305('0x16')]('Dashboard,\x20%s,\x20%s',_0x4faccf,_0x310ba5['error'][_0xf305('0x18')]);return _0x11e67a(_0x310ba5[_0xf305('0x16')][_0xf305('0x18')]);}else{logger[_0xf305('0x11')](_0xf305('0x12'),_0x4faccf,_0xf305('0x15'));_0x11e67a(_0x310ba5[_0xf305('0x19')][_0xf305('0x18')]);}})['catch'](function(_0x2a641f){logger[_0xf305('0x16')](_0xf305('0x12'),_0x4faccf,_0x2a641f);_0x30c7f7(_0x2a641f);});});} \ No newline at end of file +var _0xaee2=['localhost','socket.io-emitter','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis'];(function(_0x55a70a,_0x45166b){var _0x578c8b=function(_0xf282d2){while(--_0xf282d2){_0x55a70a['push'](_0x55a70a['shift']());}};_0x578c8b(++_0x45166b);}(_0xaee2,0x19e));var _0x2aee=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xaee2[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var util=require(_0x2aee('0x0'));var moment=require(_0x2aee('0x1'));var BPromise=require(_0x2aee('0x2'));var rs=require(_0x2aee('0x3'));var fs=require('fs');var Redis=require(_0x2aee('0x4'));var db=require(_0x2aee('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2aee('0x6'));var jayson=require(_0x2aee('0x7'));var client=jayson[_0x2aee('0x8')][_0x2aee('0x9')]({'port':0x232a});config[_0x2aee('0xa')]=_['defaults'](config['redis'],{'host':_0x2aee('0xb'),'port':0x18eb});var socket=require(_0x2aee('0xc'))(new Redis(config[_0x2aee('0xa')]));require(_0x2aee('0xd'))[_0x2aee('0xe')](socket);function respondWithRpcPromise(_0x420b07,_0x48b6ed,_0x2abbed){return new BPromise(function(_0x266eb4,_0xf4a5ad){return client[_0x2aee('0xf')](_0x420b07,_0x2abbed)['then'](function(_0x3451a6){logger['info'](_0x2aee('0x10'),_0x48b6ed,_0x2aee('0x11'));logger[_0x2aee('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x48b6ed,_0x2aee('0x11'),JSON[_0x2aee('0x13')](_0x3451a6));if(_0x3451a6[_0x2aee('0x14')]){if(_0x3451a6[_0x2aee('0x14')][_0x2aee('0x15')]===0x1f4){logger['error'](_0x2aee('0x10'),_0x48b6ed,_0x3451a6[_0x2aee('0x14')]['message']);return _0xf4a5ad(_0x3451a6[_0x2aee('0x14')]['message']);}logger[_0x2aee('0x14')](_0x2aee('0x10'),_0x48b6ed,_0x3451a6[_0x2aee('0x14')][_0x2aee('0x16')]);return _0x266eb4(_0x3451a6[_0x2aee('0x14')][_0x2aee('0x16')]);}else{logger[_0x2aee('0x17')](_0x2aee('0x10'),_0x48b6ed,_0x2aee('0x11'));_0x266eb4(_0x3451a6['result'][_0x2aee('0x16')]);}})[_0x2aee('0x18')](function(_0x555ac9){logger['error'](_0x2aee('0x10'),_0x48b6ed,_0x555ac9);_0xf4a5ad(_0x555ac9);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9486cd0..f11647a 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 _0x5e1a=['./dashboard.events','save','update','emit','register','length'];(function(_0x4a8a9e,_0x202429){var _0x2398de=function(_0x3462a7){while(--_0x3462a7){_0x4a8a9e['push'](_0x4a8a9e['shift']());}};_0x2398de(++_0x202429);}(_0x5e1a,0x156));var _0xa5e1=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0x5e1a[_0x35c5a8];return _0x34782c;};'use strict';var DashboardEvents=require(_0xa5e1('0x0'));var events=[_0xa5e1('0x1'),'remove',_0xa5e1('0x2')];function createListener(_0x57e9d4,_0x16f63b){return function(_0x37af8f){_0x16f63b[_0xa5e1('0x3')](_0x57e9d4,_0x37af8f);};}function removeListener(_0x4a75e5,_0x507329){return function(){DashboardEvents['removeListener'](_0x4a75e5,_0x507329);};}exports[_0xa5e1('0x4')]=function(_0x542059){for(var _0x59d776=0x0,_0x104e41=events[_0xa5e1('0x5')];_0x59d776<_0x104e41;_0x59d776++){var _0x37eea7=events[_0x59d776];var _0x59ac38=createListener('dashboard:'+_0x37eea7,_0x542059);DashboardEvents['on'](_0x37eea7,_0x59ac38);}}; \ No newline at end of file +var _0xfe0b=['emit','removeListener','register','dashboard:','./dashboard.events','save','update'];(function(_0x2eb5d3,_0x185815){var _0x4403fa=function(_0x194406){while(--_0x194406){_0x2eb5d3['push'](_0x2eb5d3['shift']());}};_0x4403fa(++_0x185815);}(_0xfe0b,0x162));var _0xbfe0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfe0b[_0x19e35c];return _0x3e1fe8;};'use strict';var DashboardEvents=require(_0xbfe0('0x0'));var events=[_0xbfe0('0x1'),'remove',_0xbfe0('0x2')];function createListener(_0x316fed,_0x16c12b){return function(_0x20352f){_0x16c12b[_0xbfe0('0x3')](_0x316fed,_0x20352f);};}function removeListener(_0x10b1da,_0x47d9af){return function(){DashboardEvents[_0xbfe0('0x4')](_0x10b1da,_0x47d9af);};}exports[_0xbfe0('0x5')]=function(_0x38b7c8){for(var _0x339e54=0x0,_0x121c74=events['length'];_0x339e54<_0x121c74;_0x339e54++){var _0x3e4382=events[_0x339e54];var _0x367d86=createListener(_0xbfe0('0x6')+_0x3e4382,_0x38b7c8);DashboardEvents['on'](_0x3e4382,_0x367d86);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 0cc8c4c..3408cb6 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 _0xa4e7=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','getItems','post','create','/:id/clone','addItem','put','update','delete','exports','util','path'];(function(_0x4c9254,_0x1bff96){var _0x289c02=function(_0x1ca5f0){while(--_0x1ca5f0){_0x4c9254['push'](_0x4c9254['shift']());}};_0x289c02(++_0x1bff96);}(_0xa4e7,0x10f));var _0x7a4e=function(_0x14e603,_0x115454){_0x14e603=_0x14e603-0x0;var _0x453a10=_0xa4e7[_0x14e603];return _0x453a10;};'use strict';var multer=require('multer');var util=require(_0x7a4e('0x0'));var path=require(_0x7a4e('0x1'));var timeout=require(_0x7a4e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7a4e('0x3'));var auth=require(_0x7a4e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7a4e('0x5'));var controller=require(_0x7a4e('0x6'));router['get']('/',auth[_0x7a4e('0x7')](),controller[_0x7a4e('0x8')]);router[_0x7a4e('0x9')](_0x7a4e('0xa'),auth[_0x7a4e('0x7')](),controller['show']);router['get'](_0x7a4e('0xb'),auth[_0x7a4e('0x7')](),controller[_0x7a4e('0xc')]);router[_0x7a4e('0xd')]('/',auth[_0x7a4e('0x7')](),controller[_0x7a4e('0xe')]);router[_0x7a4e('0xd')](_0x7a4e('0xf'),auth[_0x7a4e('0x7')](),controller['clone']);router[_0x7a4e('0xd')](_0x7a4e('0xb'),auth[_0x7a4e('0x7')](),controller[_0x7a4e('0x10')]);router[_0x7a4e('0x11')](_0x7a4e('0xa'),auth[_0x7a4e('0x7')](),controller[_0x7a4e('0x12')]);router[_0x7a4e('0x13')]('/:id',auth[_0x7a4e('0x7')](),controller['destroy']);module[_0x7a4e('0x14')]=router; \ No newline at end of file +var _0x79bd=['/:id/items','getItems','post','create','/:id/clone','addItem','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','/:id','show','get'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0x79bd,0x80));var _0xd79b=function(_0x1aec14,_0x596774){_0x1aec14=_0x1aec14-0x0;var _0x193299=_0x79bd[_0x1aec14];return _0x193299;};'use strict';var multer=require(_0xd79b('0x0'));var util=require(_0xd79b('0x1'));var path=require(_0xd79b('0x2'));var timeout=require(_0xd79b('0x3'));var express=require(_0xd79b('0x4'));var router=express[_0xd79b('0x5')]();var fs_extra=require(_0xd79b('0x6'));var auth=require(_0xd79b('0x7'));var interaction=require(_0xd79b('0x8'));var config=require(_0xd79b('0x9'));var controller=require(_0xd79b('0xa'));router['get']('/',auth[_0xd79b('0xb')](),controller[_0xd79b('0xc')]);router['get'](_0xd79b('0xd'),auth[_0xd79b('0xb')](),controller[_0xd79b('0xe')]);router[_0xd79b('0xf')](_0xd79b('0x10'),auth[_0xd79b('0xb')](),controller[_0xd79b('0x11')]);router[_0xd79b('0x12')]('/',auth[_0xd79b('0xb')](),controller[_0xd79b('0x13')]);router[_0xd79b('0x12')](_0xd79b('0x14'),auth['isAuthenticated'](),controller['clone']);router[_0xd79b('0x12')](_0xd79b('0x10'),auth[_0xd79b('0xb')](),controller[_0xd79b('0x15')]);router['put'](_0xd79b('0xd'),auth[_0xd79b('0xb')](),controller['update']);router[_0xd79b('0x16')](_0xd79b('0xd'),auth[_0xd79b('0xb')](),controller[_0xd79b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index aaaa8e5..de6bbf7 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 _0x1967=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','long'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x1967,0x173));var _0x7196=function(_0x3dd280,_0x51fdea){_0x3dd280=_0x3dd280-0x0;var _0xd3d59c=_0x1967[_0x3dd280];return _0xd3d59c;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x7196('0x0'));var _=require(_0x7196('0x1'));module[_0x7196('0x2')]={'title':{'type':Sequelize[_0x7196('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7196('0x4')](_0x7196('0x5')),'get':function(){try{return JSON[_0x7196('0x6')](this[_0x7196('0x7')](_0x7196('0x8')));}catch(_0x5c128f){return[];}},'set':function(_0x36b01e){try{this[_0x7196('0x9')](_0x7196('0x8'),JSON[_0x7196('0xa')](_0x36b01e));}catch(_0x266a6e){this[_0x7196('0x9')]('attrs',JSON[_0x7196('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7196('0xb')]},'col':{'type':Sequelize[_0x7196('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7196('0x3')],'allowNull':![],'defaultValue':_0x7196('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7196('0x3')]},'titleFontSize':{'type':Sequelize[_0x7196('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xafc4=['TEXT','long','setDataValue','attrs','stringify','INTEGER','sequelize','lodash','STRING'];(function(_0x3e8f52,_0x2be9c0){var _0x4efc14=function(_0x5a32db){while(--_0x5a32db){_0x3e8f52['push'](_0x3e8f52['shift']());}};_0x4efc14(++_0x2be9c0);}(_0xafc4,0x69));var _0x4afc=function(_0x1cd8ce,_0xe8c157){_0x1cd8ce=_0x1cd8ce-0x0;var _0x5036e2=_0xafc4[_0x1cd8ce];return _0x5036e2;};'use strict';var Sequelize=require(_0x4afc('0x0'));var squel=require('squel');var _=require(_0x4afc('0x1'));module['exports']={'title':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4afc('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4afc('0x3')](_0x4afc('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x36cb50){return[];}},'set':function(_0x471d45){try{this[_0x4afc('0x5')](_0x4afc('0x6'),JSON[_0x4afc('0x7')](_0x471d45));}catch(_0xaf053d){this['setDataValue'](_0x4afc('0x6'),JSON[_0x4afc('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4afc('0x8')]},'col':{'type':Sequelize[_0x4afc('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4afc('0x2')]},'titleFontSize':{'type':Sequelize[_0x4afc('0x8')],'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 cd5acc1..aea90f3 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 _0xa423=['../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','apply','reject','save','update','then','error','name','send','show','params','model','keys','DashboardItem','filters','intersection','query','attributes','fields','length','includeAll','options','find','catch','destroy','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/logger','api'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xa423,0x16c));var _0x3a42=function(_0x202b05,_0x5a246c){_0x202b05=_0x202b05-0x0;var _0x22a0a7=_0xa423[_0x202b05];return _0x22a0a7;};'use strict';var emlformat=require(_0x3a42('0x0'));var rimraf=require(_0x3a42('0x1'));var zipdir=require(_0x3a42('0x2'));var jsonpatch=require(_0x3a42('0x3'));var rp=require(_0x3a42('0x4'));var moment=require('moment');var BPromise=require(_0x3a42('0x5'));var Mustache=require(_0x3a42('0x6'));var util=require('util');var path=require(_0x3a42('0x7'));var sox=require(_0x3a42('0x8'));var csv=require(_0x3a42('0x9'));var ejs=require(_0x3a42('0xa'));var fs=require('fs');var fs_extra=require(_0x3a42('0xb'));var _=require('lodash');var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require(_0x3a42('0xe'));var deskjs=require(_0x3a42('0xf'));var toCsv=require(_0x3a42('0x9'));var querystring=require(_0x3a42('0x10'));var Papa=require(_0x3a42('0x11'));var Redis=require(_0x3a42('0x12'));var authService=require(_0x3a42('0x13'));var qs=require(_0x3a42('0x14'));var as=require(_0x3a42('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x16'))(_0x3a42('0x17'));var utils=require(_0x3a42('0x18'));var config=require(_0x3a42('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3a42('0x1a')]=_['defaults'](config[_0x3a42('0x1a')],{'host':_0x3a42('0x1b'),'port':0x18eb});var socket=require(_0x3a42('0x1c'))(new Redis(config[_0x3a42('0x1a')]));require(_0x3a42('0x1d'))[_0x3a42('0x1e')](socket);function respondWithStatusCode(_0x5f5244,_0xd32889){_0xd32889=_0xd32889||0xcc;return function(_0x4f715c){if(_0x4f715c){return _0x5f5244[_0x3a42('0x1f')](_0xd32889);}return _0x5f5244['status'](_0xd32889)[_0x3a42('0x20')]();};}function respondWithResult(_0x5895a8,_0x46ef1e){_0x46ef1e=_0x46ef1e||0xc8;return function(_0x4edcf5){if(_0x4edcf5){return _0x5895a8['status'](_0x46ef1e)['json'](_0x4edcf5);}};}function respondWithFilteredResult(_0x26c844,_0x3a1dd0){return function(_0x438cf1){if(_0x438cf1){var _0x39e620=typeof _0x3a1dd0[_0x3a42('0x21')]==='undefined'&&typeof _0x3a1dd0[_0x3a42('0x22')]===_0x3a42('0x23');var _0x49f00e=_0x438cf1[_0x3a42('0x24')];var _0xa89087=_0x39e620?0x0:_0x3a1dd0[_0x3a42('0x21')];var _0x59f337=_0x39e620?_0x438cf1[_0x3a42('0x24')]:_0x3a1dd0[_0x3a42('0x21')]+_0x3a1dd0[_0x3a42('0x22')];var _0x477605;if(_0x59f337>=_0x49f00e){_0x59f337=_0x49f00e;_0x477605=0xc8;}else{_0x477605=0xce;}_0x26c844[_0x3a42('0x25')](_0x477605);return _0x26c844['set'](_0x3a42('0x26'),_0xa89087+'-'+_0x59f337+'/'+_0x49f00e)[_0x3a42('0x27')](_0x438cf1);}return null;};}function patchUpdates(_0x379fe6){return function(_0x434283){try{jsonpatch[_0x3a42('0x28')](_0x434283,_0x379fe6,!![]);}catch(_0x5b41d2){return BPromise[_0x3a42('0x29')](_0x5b41d2);}return _0x434283[_0x3a42('0x2a')]();};}function saveUpdates(_0x477cb9,_0x1add9b){return function(_0x1540e5){if(_0x1540e5){return _0x1540e5[_0x3a42('0x2b')](_0x477cb9)[_0x3a42('0x2c')](function(_0x434044){return _0x434044;});}return null;};}function removeEntity(_0x2c4b3a,_0x3a3f87){return function(_0x29a4d0){if(_0x29a4d0){return _0x29a4d0['destroy']()[_0x3a42('0x2c')](function(){_0x2c4b3a[_0x3a42('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3027dd,_0x5b5897){return function(_0x462a56){if(!_0x462a56){_0x3027dd[_0x3a42('0x1f')](0x194);}return _0x462a56;};}function handleError(_0x409910,_0x299282){_0x299282=_0x299282||0x1f4;return function(_0x1559cd){logger[_0x3a42('0x2d')](_0x1559cd['stack']);if(_0x1559cd[_0x3a42('0x2e')]){delete _0x1559cd[_0x3a42('0x2e')];}_0x409910[_0x3a42('0x25')](_0x299282)[_0x3a42('0x2f')](_0x1559cd);};}exports[_0x3a42('0x30')]=function(_0x44ef39,_0x41776f){var _0x56ee5d={'raw':![],'where':{'id':_0x44ef39[_0x3a42('0x31')]['id']}},_0x2d6192={};_0x2d6192[_0x3a42('0x32')]=_[_0x3a42('0x33')](db[_0x3a42('0x34')]['rawAttributes']);_0x2d6192['query']=_[_0x3a42('0x33')](_0x44ef39['query']);_0x2d6192[_0x3a42('0x35')]=_[_0x3a42('0x36')](_0x2d6192[_0x3a42('0x32')],_0x2d6192[_0x3a42('0x37')]);_0x56ee5d[_0x3a42('0x38')]=_[_0x3a42('0x36')](_0x2d6192['model'],qs[_0x3a42('0x39')](_0x44ef39[_0x3a42('0x37')][_0x3a42('0x39')]));_0x56ee5d['attributes']=_0x56ee5d['attributes'][_0x3a42('0x3a')]?_0x56ee5d[_0x3a42('0x38')]:_0x2d6192[_0x3a42('0x32')];if(_0x44ef39[_0x3a42('0x37')][_0x3a42('0x3b')]){_0x56ee5d['include']=[{'all':!![]}];}_0x56ee5d=_['merge']({},_0x56ee5d,_0x44ef39[_0x3a42('0x3c')]);return db[_0x3a42('0x34')][_0x3a42('0x3d')](_0x56ee5d)[_0x3a42('0x2c')](handleEntityNotFound(_0x41776f,null))['then'](respondWithResult(_0x41776f,null))[_0x3a42('0x3e')](handleError(_0x41776f,null));};exports[_0x3a42('0x3f')]=function(_0x4fb43f,_0x479e5e){return db['DashboardItem'][_0x3a42('0x3d')]({'where':{'id':_0x4fb43f['params']['id']}})[_0x3a42('0x2c')](handleEntityNotFound(_0x479e5e,null))[_0x3a42('0x2c')](removeEntity(_0x479e5e,null))[_0x3a42('0x3e')](handleError(_0x479e5e,null));};function widgetAttributes(_0x1fcbcb){try{switch(_0x1fcbcb[_0x3a42('0x40')]){case _0x3a42('0x41'):return[{'name':_0x3a42('0x42'),'value':_0x1fcbcb[_0x3a42('0x42')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0][_0x3a42('0x44')]:undefined)||_0x3a42('0x45')}];case _0x3a42('0x46'):return[{'name':_0x3a42('0x47'),'value':_0x1fcbcb['attrPath']||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x0]?_0x1fcbcb['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x3a42('0x48'),'value':_0x1fcbcb['attrHourFormat']||(_0x1fcbcb['attrs']&&_0x1fcbcb['attrs'][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x3a42('0x49'),'value':_0x1fcbcb[_0x3a42('0x49')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x1]?_0x1fcbcb[_0x3a42('0x43')][0x1][_0x3a42('0x44')]:undefined)||'0.00'},{'name':_0x3a42('0x4a'),'value':_0x1fcbcb[_0x3a42('0x4a')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x2]?_0x1fcbcb[_0x3a42('0x43')][0x2][_0x3a42('0x44')]:undefined)||0xc}];case'counter':return[{'name':_0x3a42('0x4b'),'value':_0x1fcbcb[_0x3a42('0x4b')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0][_0x3a42('0x44')]:undefined)||_0x3a42('0x4c')},{'name':'attrVoiceQueues','value':_0x1fcbcb[_0x3a42('0x4d')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x1]?_0x1fcbcb[_0x3a42('0x43')][0x1][_0x3a42('0x44')]:undefined)||[]},{'name':'attrFontSize','value':_0x1fcbcb[_0x3a42('0x4a')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x2]?_0x1fcbcb['attrs'][0x2][_0x3a42('0x44')]:undefined)||0x14},{'name':_0x3a42('0x4e'),'value':_0x1fcbcb[_0x3a42('0x4e')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x3]?_0x1fcbcb['attrs'][0x3][_0x3a42('0x44')]:undefined)||_0x3a42('0x4f')},{'name':_0x3a42('0x50'),'value':_0x1fcbcb[_0x3a42('0x50')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x4]?_0x1fcbcb[_0x3a42('0x43')][0x4][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x51'),'value':_0x1fcbcb[_0x3a42('0x51')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x5]?_0x1fcbcb['attrs'][0x5][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x52'),'value':_0x1fcbcb[_0x3a42('0x52')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x6]?_0x1fcbcb[_0x3a42('0x43')][0x6]['value']:undefined)||''},{'name':_0x3a42('0x53'),'value':_0x1fcbcb['attrOpenchannelAccounts']||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x7]?_0x1fcbcb[_0x3a42('0x43')][0x7][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x54'),'value':_0x1fcbcb[_0x3a42('0x54')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x8]?_0x1fcbcb[_0x3a42('0x43')][0x8]['value']:undefined)||''},{'name':_0x3a42('0x55'),'value':_0x1fcbcb[_0x3a42('0x55')]||(_0x1fcbcb['attrs']&&_0x1fcbcb['attrs'][0x9]?_0x1fcbcb[_0x3a42('0x43')][0x9][_0x3a42('0x44')]:undefined)||''}];case'multibar-chart':case _0x3a42('0x56'):return[{'name':_0x3a42('0x57'),'value':_0x1fcbcb[_0x3a42('0x57')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0]['value']:undefined)||_0x3a42('0x4c')},{'name':'attrSerie2','value':_0x1fcbcb[_0x3a42('0x58')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x1]?_0x1fcbcb[_0x3a42('0x43')][0x1][_0x3a42('0x44')]:undefined)||null},{'name':_0x3a42('0x59'),'value':_0x1fcbcb[_0x3a42('0x59')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x2]?_0x1fcbcb[_0x3a42('0x43')][0x2][_0x3a42('0x44')]:undefined)||null},{'name':_0x3a42('0x4d'),'value':_0x1fcbcb[_0x3a42('0x4d')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x3]?_0x1fcbcb[_0x3a42('0x43')][0x3][_0x3a42('0x44')]:undefined)||[]},{'name':_0x3a42('0x4e'),'value':_0x1fcbcb[_0x3a42('0x4e')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x4]?_0x1fcbcb[_0x3a42('0x43')][0x4][_0x3a42('0x44')]:undefined)||'voice'},{'name':_0x3a42('0x50'),'value':_0x1fcbcb[_0x3a42('0x50')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x5]?_0x1fcbcb[_0x3a42('0x43')][0x5][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x51'),'value':_0x1fcbcb[_0x3a42('0x51')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb['attrs'][0x6]?_0x1fcbcb['attrs'][0x6]['value']:undefined)||''},{'name':_0x3a42('0x52'),'value':_0x1fcbcb[_0x3a42('0x52')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x7]?_0x1fcbcb['attrs'][0x7][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x53'),'value':_0x1fcbcb[_0x3a42('0x53')]||(_0x1fcbcb['attrs']&&_0x1fcbcb[_0x3a42('0x43')][0x8]?_0x1fcbcb[_0x3a42('0x43')][0x8]['value']:undefined)||''},{'name':_0x3a42('0x54'),'value':_0x1fcbcb[_0x3a42('0x54')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x9]?_0x1fcbcb[_0x3a42('0x43')][0x9][_0x3a42('0x44')]:undefined)||''},{'name':_0x3a42('0x55'),'value':_0x1fcbcb[_0x3a42('0x55')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0xa]?_0x1fcbcb[_0x3a42('0x43')][0xa][_0x3a42('0x44')]:undefined)||''}];case _0x3a42('0x5a'):return[{'name':_0x3a42('0x5b'),'type':_0x1fcbcb[_0x3a42('0x5c')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x0]?_0x1fcbcb[_0x3a42('0x43')][0x0]['type']:undefined)||null,'value':_0x1fcbcb[_0x3a42('0x5b')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x0]?_0x1fcbcb['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x1fcbcb[_0x3a42('0x5d')]||(_0x1fcbcb[_0x3a42('0x43')]&&_0x1fcbcb[_0x3a42('0x43')][0x1]?_0x1fcbcb[_0x3a42('0x43')][0x1][_0x3a42('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3cf363){logger[_0x3a42('0x2d')]('widgetAttributes:\x20%s',JSON[_0x3a42('0x5e')](_0x3cf363));return[];}}exports[_0x3a42('0x5f')]=function(_0x5986fc,_0xbe17c3){if(_0x5986fc[_0x3a42('0x60')]){_0x5986fc['body'][_0x3a42('0x43')]=widgetAttributes(_0x5986fc['body']);}return db[_0x3a42('0x34')]['create'](_0x5986fc[_0x3a42('0x60')],{})[_0x3a42('0x2c')](respondWithResult(_0xbe17c3,0xc9))[_0x3a42('0x3e')](handleError(_0xbe17c3,null));};exports[_0x3a42('0x2b')]=function(_0x3d448e,_0x46a14d){if(_0x3d448e[_0x3a42('0x60')]['id']){delete _0x3d448e['body']['id'];}_0x3d448e[_0x3a42('0x60')][_0x3a42('0x43')]=widgetAttributes(_0x3d448e['body']);return db[_0x3a42('0x34')][_0x3a42('0x3d')]({'where':{'id':_0x3d448e['params']['id']}})[_0x3a42('0x2c')](handleEntityNotFound(_0x46a14d,null))[_0x3a42('0x2c')](saveUpdates(_0x3d448e[_0x3a42('0x60')],null))[_0x3a42('0x2c')](respondWithResult(_0x46a14d,null))[_0x3a42('0x3e')](handleError(_0x46a14d,null));}; \ No newline at end of file +var _0xbfe8=['update','destroy','then','error','stack','name','send','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','options','DashboardItem','find','catch','type','iframe','attrUrl','value','https://','custom','attrPath','attrs','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','attrReport','reportType','widgetAttributes:\x20%s','stringify','create','body','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','reject','save'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x30248c,_0x81f395){_0x30248c=_0x30248c-0x0;var _0x239bc3=_0xbfe8[_0x30248c];return _0x239bc3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bfe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bfe('0x1'));var rp=require(_0x8bfe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8bfe('0x3'));var util=require(_0x8bfe('0x4'));var path=require('path');var sox=require(_0x8bfe('0x5'));var csv=require(_0x8bfe('0x6'));var ejs=require(_0x8bfe('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8bfe('0x8'));var squel=require(_0x8bfe('0x9'));var crypto=require(_0x8bfe('0xa'));var jsforce=require(_0x8bfe('0xb'));var deskjs=require(_0x8bfe('0xc'));var toCsv=require(_0x8bfe('0x6'));var querystring=require(_0x8bfe('0xd'));var Papa=require(_0x8bfe('0xe'));var Redis=require(_0x8bfe('0xf'));var authService=require(_0x8bfe('0x10'));var qs=require(_0x8bfe('0x11'));var as=require(_0x8bfe('0x12'));var hardwareService=require(_0x8bfe('0x13'));var logger=require(_0x8bfe('0x14'))(_0x8bfe('0x15'));var utils=require('../../config/utils');var config=require(_0x8bfe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bfe('0x17'))['db'];config[_0x8bfe('0x18')]=_[_0x8bfe('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8bfe('0x1a'))(new Redis(config[_0x8bfe('0x18')]));require(_0x8bfe('0x1b'))[_0x8bfe('0x1c')](socket);function respondWithStatusCode(_0x46c8e3,_0x4965b3){_0x4965b3=_0x4965b3||0xcc;return function(_0x41cc42){if(_0x41cc42){return _0x46c8e3[_0x8bfe('0x1d')](_0x4965b3);}return _0x46c8e3['status'](_0x4965b3)[_0x8bfe('0x1e')]();};}function respondWithResult(_0xe57cb1,_0x109031){_0x109031=_0x109031||0xc8;return function(_0x47efbd){if(_0x47efbd){return _0xe57cb1['status'](_0x109031)[_0x8bfe('0x1f')](_0x47efbd);}};}function respondWithFilteredResult(_0x5019ba,_0x4d6993){return function(_0x2e7c29){if(_0x2e7c29){var _0x17d688=typeof _0x4d6993[_0x8bfe('0x20')]===_0x8bfe('0x21')&&typeof _0x4d6993[_0x8bfe('0x22')]===_0x8bfe('0x21');var _0x3b0837=_0x2e7c29['count'];var _0xbc7fa2=_0x17d688?0x0:_0x4d6993['offset'];var _0x2e64ee=_0x17d688?_0x2e7c29[_0x8bfe('0x23')]:_0x4d6993[_0x8bfe('0x20')]+_0x4d6993['limit'];var _0x55af8c;if(_0x2e64ee>=_0x3b0837){_0x2e64ee=_0x3b0837;_0x55af8c=0xc8;}else{_0x55af8c=0xce;}_0x5019ba[_0x8bfe('0x24')](_0x55af8c);return _0x5019ba['set']('Content-Range',_0xbc7fa2+'-'+_0x2e64ee+'/'+_0x3b0837)[_0x8bfe('0x1f')](_0x2e7c29);}return null;};}function patchUpdates(_0x5397fb){return function(_0xfe6da8){try{jsonpatch['apply'](_0xfe6da8,_0x5397fb,!![]);}catch(_0x34043a){return BPromise[_0x8bfe('0x25')](_0x34043a);}return _0xfe6da8[_0x8bfe('0x26')]();};}function saveUpdates(_0x260dd9,_0x5efee2){return function(_0x283245){if(_0x283245){return _0x283245[_0x8bfe('0x27')](_0x260dd9)['then'](function(_0x2f73d0){return _0x2f73d0;});}return null;};}function removeEntity(_0x1789f7,_0x46526f){return function(_0x20b512){if(_0x20b512){return _0x20b512[_0x8bfe('0x28')]()[_0x8bfe('0x29')](function(){_0x1789f7['status'](0xcc)[_0x8bfe('0x1e')]();});}};}function handleEntityNotFound(_0x458888,_0x4720fa){return function(_0x4461e8){if(!_0x4461e8){_0x458888[_0x8bfe('0x1d')](0x194);}return _0x4461e8;};}function handleError(_0x399bce,_0x345a99){_0x345a99=_0x345a99||0x1f4;return function(_0x2cbfb3){logger[_0x8bfe('0x2a')](_0x2cbfb3[_0x8bfe('0x2b')]);if(_0x2cbfb3[_0x8bfe('0x2c')]){delete _0x2cbfb3['name'];}_0x399bce[_0x8bfe('0x24')](_0x345a99)[_0x8bfe('0x2d')](_0x2cbfb3);};}exports['show']=function(_0x133f5b,_0x2e86ee){var _0x1ba415={'raw':![],'where':{'id':_0x133f5b[_0x8bfe('0x2e')]['id']}},_0x5259ec={};_0x5259ec[_0x8bfe('0x2f')]=_['keys'](db['DashboardItem'][_0x8bfe('0x30')]);_0x5259ec[_0x8bfe('0x31')]=_[_0x8bfe('0x32')](_0x133f5b[_0x8bfe('0x31')]);_0x5259ec[_0x8bfe('0x33')]=_[_0x8bfe('0x34')](_0x5259ec[_0x8bfe('0x2f')],_0x5259ec[_0x8bfe('0x31')]);_0x1ba415[_0x8bfe('0x35')]=_[_0x8bfe('0x34')](_0x5259ec['model'],qs['fields'](_0x133f5b[_0x8bfe('0x31')][_0x8bfe('0x36')]));_0x1ba415[_0x8bfe('0x35')]=_0x1ba415[_0x8bfe('0x35')][_0x8bfe('0x37')]?_0x1ba415[_0x8bfe('0x35')]:_0x5259ec[_0x8bfe('0x2f')];if(_0x133f5b['query'][_0x8bfe('0x38')]){_0x1ba415[_0x8bfe('0x39')]=[{'all':!![]}];}_0x1ba415=_['merge']({},_0x1ba415,_0x133f5b[_0x8bfe('0x3a')]);return db[_0x8bfe('0x3b')][_0x8bfe('0x3c')](_0x1ba415)[_0x8bfe('0x29')](handleEntityNotFound(_0x2e86ee,null))[_0x8bfe('0x29')](respondWithResult(_0x2e86ee,null))['catch'](handleError(_0x2e86ee,null));};exports[_0x8bfe('0x28')]=function(_0x506e50,_0x5a90b9){return db['DashboardItem']['find']({'where':{'id':_0x506e50[_0x8bfe('0x2e')]['id']}})[_0x8bfe('0x29')](handleEntityNotFound(_0x5a90b9,null))[_0x8bfe('0x29')](removeEntity(_0x5a90b9,null))[_0x8bfe('0x3d')](handleError(_0x5a90b9,null));};function widgetAttributes(_0x23ac8b){try{switch(_0x23ac8b[_0x8bfe('0x3e')]){case _0x8bfe('0x3f'):return[{'name':'attrUrl','value':_0x23ac8b[_0x8bfe('0x40')]||(_0x23ac8b['attrs']&&_0x23ac8b['attrs'][0x0]?_0x23ac8b['attrs'][0x0][_0x8bfe('0x41')]:undefined)||_0x8bfe('0x42')}];case _0x8bfe('0x43'):return[{'name':_0x8bfe('0x44'),'value':_0x23ac8b[_0x8bfe('0x44')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x0]?_0x23ac8b[_0x8bfe('0x45')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x8bfe('0x46'),'value':_0x23ac8b[_0x8bfe('0x46')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x0]?_0x23ac8b[_0x8bfe('0x45')][0x0][_0x8bfe('0x41')]:undefined)||_0x8bfe('0x47')},{'name':_0x8bfe('0x48'),'value':_0x23ac8b[_0x8bfe('0x48')]||(_0x23ac8b['attrs']&&_0x23ac8b[_0x8bfe('0x45')][0x1]?_0x23ac8b[_0x8bfe('0x45')][0x1][_0x8bfe('0x41')]:undefined)||_0x8bfe('0x49')},{'name':_0x8bfe('0x4a'),'value':_0x23ac8b[_0x8bfe('0x4a')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b['attrs'][0x2]?_0x23ac8b[_0x8bfe('0x45')][0x2][_0x8bfe('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0x8bfe('0x4b'),'value':_0x23ac8b['attrMetric']||(_0x23ac8b['attrs']&&_0x23ac8b[_0x8bfe('0x45')][0x0]?_0x23ac8b[_0x8bfe('0x45')][0x0][_0x8bfe('0x41')]:undefined)||'total'},{'name':_0x8bfe('0x4c'),'value':_0x23ac8b['attrVoiceQueues']||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x1]?_0x23ac8b['attrs'][0x1][_0x8bfe('0x41')]:undefined)||[]},{'name':_0x8bfe('0x4a'),'value':_0x23ac8b[_0x8bfe('0x4a')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b['attrs'][0x2]?_0x23ac8b[_0x8bfe('0x45')][0x2][_0x8bfe('0x41')]:undefined)||0x14},{'name':_0x8bfe('0x4d'),'value':_0x23ac8b['attrChannel']||(_0x23ac8b['attrs']&&_0x23ac8b[_0x8bfe('0x45')][0x3]?_0x23ac8b[_0x8bfe('0x45')][0x3][_0x8bfe('0x41')]:undefined)||_0x8bfe('0x4e')},{'name':_0x8bfe('0x4f'),'value':_0x23ac8b[_0x8bfe('0x4f')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x4]?_0x23ac8b['attrs'][0x4][_0x8bfe('0x41')]:undefined)||''},{'name':_0x8bfe('0x50'),'value':_0x23ac8b['attrFaxAccounts']||(_0x23ac8b['attrs']&&_0x23ac8b[_0x8bfe('0x45')][0x5]?_0x23ac8b[_0x8bfe('0x45')][0x5][_0x8bfe('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x23ac8b[_0x8bfe('0x51')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b['attrs'][0x6]?_0x23ac8b[_0x8bfe('0x45')][0x6][_0x8bfe('0x41')]:undefined)||''},{'name':_0x8bfe('0x52'),'value':_0x23ac8b[_0x8bfe('0x52')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x7]?_0x23ac8b['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x23ac8b['attrWhatsappAccounts']||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x8]?_0x23ac8b[_0x8bfe('0x45')][0x8][_0x8bfe('0x41')]:undefined)||''},{'name':_0x8bfe('0x53'),'value':_0x23ac8b['attrChatWebsites']||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x9]?_0x23ac8b[_0x8bfe('0x45')][0x9][_0x8bfe('0x41')]:undefined)||''}];case _0x8bfe('0x54'):case _0x8bfe('0x55'):return[{'name':'attrSerie1','value':_0x23ac8b[_0x8bfe('0x56')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b['attrs'][0x0]?_0x23ac8b[_0x8bfe('0x45')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x23ac8b[_0x8bfe('0x57')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x1]?_0x23ac8b['attrs'][0x1][_0x8bfe('0x41')]:undefined)||null},{'name':_0x8bfe('0x58'),'value':_0x23ac8b[_0x8bfe('0x58')]||(_0x23ac8b['attrs']&&_0x23ac8b[_0x8bfe('0x45')][0x2]?_0x23ac8b[_0x8bfe('0x45')][0x2][_0x8bfe('0x41')]:undefined)||null},{'name':_0x8bfe('0x4c'),'value':_0x23ac8b['attrVoiceQueues']||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x3]?_0x23ac8b['attrs'][0x3][_0x8bfe('0x41')]:undefined)||[]},{'name':_0x8bfe('0x4d'),'value':_0x23ac8b[_0x8bfe('0x4d')]||(_0x23ac8b['attrs']&&_0x23ac8b[_0x8bfe('0x45')][0x4]?_0x23ac8b[_0x8bfe('0x45')][0x4][_0x8bfe('0x41')]:undefined)||_0x8bfe('0x4e')},{'name':_0x8bfe('0x4f'),'value':_0x23ac8b['attrEmailAccounts']||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x5]?_0x23ac8b[_0x8bfe('0x45')][0x5][_0x8bfe('0x41')]:undefined)||''},{'name':_0x8bfe('0x50'),'value':_0x23ac8b[_0x8bfe('0x50')]||(_0x23ac8b['attrs']&&_0x23ac8b[_0x8bfe('0x45')][0x6]?_0x23ac8b['attrs'][0x6][_0x8bfe('0x41')]:undefined)||''},{'name':_0x8bfe('0x51'),'value':_0x23ac8b[_0x8bfe('0x51')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x7]?_0x23ac8b[_0x8bfe('0x45')][0x7]['value']:undefined)||''},{'name':_0x8bfe('0x52'),'value':_0x23ac8b[_0x8bfe('0x52')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b['attrs'][0x8]?_0x23ac8b[_0x8bfe('0x45')][0x8][_0x8bfe('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x23ac8b[_0x8bfe('0x59')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x9]?_0x23ac8b['attrs'][0x9][_0x8bfe('0x41')]:undefined)||''},{'name':_0x8bfe('0x53'),'value':_0x23ac8b[_0x8bfe('0x53')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0xa]?_0x23ac8b[_0x8bfe('0x45')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x8bfe('0x5a'),'type':_0x23ac8b[_0x8bfe('0x5b')]||(_0x23ac8b['attrs']&&_0x23ac8b[_0x8bfe('0x45')][0x0]?_0x23ac8b[_0x8bfe('0x45')][0x0][_0x8bfe('0x3e')]:undefined)||null,'value':_0x23ac8b[_0x8bfe('0x5a')]||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b['attrs'][0x0]?_0x23ac8b['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x23ac8b['attrRefresh']||(_0x23ac8b[_0x8bfe('0x45')]&&_0x23ac8b[_0x8bfe('0x45')][0x1]?_0x23ac8b[_0x8bfe('0x45')][0x1][_0x8bfe('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x583f6c){logger[_0x8bfe('0x2a')](_0x8bfe('0x5c'),JSON[_0x8bfe('0x5d')](_0x583f6c));return[];}}exports[_0x8bfe('0x5e')]=function(_0x241cd8,_0x5137d7){if(_0x241cd8[_0x8bfe('0x5f')]){_0x241cd8['body'][_0x8bfe('0x45')]=widgetAttributes(_0x241cd8[_0x8bfe('0x5f')]);}return db['DashboardItem']['create'](_0x241cd8[_0x8bfe('0x5f')],{})[_0x8bfe('0x29')](respondWithResult(_0x5137d7,0xc9))[_0x8bfe('0x3d')](handleError(_0x5137d7,null));};exports[_0x8bfe('0x27')]=function(_0x4ac283,_0x1abf84){if(_0x4ac283['body']['id']){delete _0x4ac283[_0x8bfe('0x5f')]['id'];}_0x4ac283[_0x8bfe('0x5f')][_0x8bfe('0x45')]=widgetAttributes(_0x4ac283[_0x8bfe('0x5f')]);return db[_0x8bfe('0x3b')][_0x8bfe('0x3c')]({'where':{'id':_0x4ac283[_0x8bfe('0x2e')]['id']}})[_0x8bfe('0x29')](handleEntityNotFound(_0x1abf84,null))[_0x8bfe('0x29')](saveUpdates(_0x4ac283[_0x8bfe('0x5f')],null))[_0x8bfe('0x29')](respondWithResult(_0x1abf84,null))[_0x8bfe('0x3d')](handleError(_0x1abf84,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0470ac1..f82445f 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 _0x6054=['DashboardItem','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6054,0x127));var _0x4605=function(_0x5f1d5a,_0x1c85a7){_0x5f1d5a=_0x5f1d5a-0x0;var _0x449071=_0x6054[_0x5f1d5a];return _0x449071;};'use strict';var EventEmitter=require(_0x4605('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x4605('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4605('0x2'),'afterUpdate':_0x4605('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4e4a89){return function(_0x216beb,_0x166281,_0x1f1088){DashboardItemEvents[_0x4605('0x4')](_0x4e4a89+':'+_0x216beb['id'],_0x216beb);DashboardItemEvents['emit'](_0x4e4a89,_0x216beb);_0x1f1088(null);};}for(var e in events){if(events[_0x4605('0x5')](e)){var event=events[e];DashboardItem[_0x4605('0x6')](e,emitEvent(event));}}module[_0x4605('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x39b8=['hook','exports','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x4dc0ae,_0x426795){var _0x4b9414=function(_0x4113e4){while(--_0x4113e4){_0x4dc0ae['push'](_0x4dc0ae['shift']());}};_0x4b9414(++_0x426795);}(_0x39b8,0x12b));var _0x839b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x39b8[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x839b('0x0'))['db'][_0x839b('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x839b('0x2')](0x0);var events={'afterCreate':_0x839b('0x3'),'afterUpdate':'update','afterDestroy':_0x839b('0x4')};function emitEvent(_0xa14576){return function(_0x565015,_0x204d12,_0x4ec4b8){DashboardItemEvents[_0x839b('0x5')](_0xa14576+':'+_0x565015['id'],_0x565015);DashboardItemEvents[_0x839b('0x5')](_0xa14576,_0x565015);_0x4ec4b8(null);};}for(var e in events){if(events[_0x839b('0x6')](e)){var event=events[e];DashboardItem[_0x839b('0x7')](e,emitEvent(event));}}module[_0x839b('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f8d6385..acaec92 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 _0x0852=['./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3b362b,_0x21cfc3){var _0x4542c0=function(_0x11a2ec){while(--_0x11a2ec){_0x3b362b['push'](_0x3b362b['shift']());}};_0x4542c0(++_0x21cfc3);}(_0x0852,0x130));var _0x2085=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x0852[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x2085('0x0'));var util=require(_0x2085('0x1'));var logger=require(_0x2085('0x2'))(_0x2085('0x3'));var moment=require(_0x2085('0x4'));var BPromise=require('bluebird');var rp=require(_0x2085('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2085('0x6'));var config=require(_0x2085('0x7'));var attributes=require(_0x2085('0x8'));module[_0x2085('0x9')]=function(_0xf78836,_0xdaf21){return _0xf78836['define'](_0x2085('0xa'),attributes,{'tableName':_0x2085('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2090=['rimraf','./dashboardItem.attributes','DashboardItem','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x2090,0xae));var _0x0209=function(_0x3c4fb1,_0x1e1136){_0x3c4fb1=_0x3c4fb1-0x0;var _0x4629b8=_0x2090[_0x3c4fb1];return _0x4629b8;};'use strict';var _=require('lodash');var util=require(_0x0209('0x0'));var logger=require(_0x0209('0x1'))('api');var moment=require(_0x0209('0x2'));var BPromise=require(_0x0209('0x3'));var rp=require(_0x0209('0x4'));var fs=require('fs');var path=require(_0x0209('0x5'));var rimraf=require(_0x0209('0x6'));var config=require('../../config/environment');var attributes=require(_0x0209('0x7'));module['exports']=function(_0x2aaa17,_0x8c2e0b){return _0x2aaa17['define'](_0x0209('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index d60aff8..ef44113 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 _0xe254=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35c1a5,_0x2e70ca){var _0x14efce=function(_0xa94b62){while(--_0xa94b62){_0x35c1a5['push'](_0x35c1a5['shift']());}};_0x14efce(++_0x2e70ca);}(_0xe254,0xaa));var _0x4e25=function(_0x3f8f64,_0x4acb83){_0x3f8f64=_0x3f8f64-0x0;var _0x2a6f78=_0xe254[_0x3f8f64];return _0x2a6f78;};'use strict';var _=require(_0x4e25('0x0'));var util=require(_0x4e25('0x1'));var moment=require(_0x4e25('0x2'));var BPromise=require(_0x4e25('0x3'));var rs=require(_0x4e25('0x4'));var fs=require('fs');var Redis=require(_0x4e25('0x5'));var db=require(_0x4e25('0x6'))['db'];var utils=require(_0x4e25('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x4e25('0x8'));var jayson=require(_0x4e25('0x9'));var client=jayson['client'][_0x4e25('0xa')]({'port':0x232a});config[_0x4e25('0xb')]=_[_0x4e25('0xc')](config[_0x4e25('0xb')],{'host':_0x4e25('0xd'),'port':0x18eb});var socket=require(_0x4e25('0xe'))(new Redis(config[_0x4e25('0xb')]));require(_0x4e25('0xf'))['register'](socket);function respondWithRpcPromise(_0x2e0db2,_0x239c51,_0x5b5b78){return new BPromise(function(_0x19280e,_0x2d2e43){return client[_0x4e25('0x10')](_0x2e0db2,_0x5b5b78)[_0x4e25('0x11')](function(_0x2112b5){logger[_0x4e25('0x12')](_0x4e25('0x13'),_0x239c51,_0x4e25('0x14'));logger[_0x4e25('0x15')](_0x4e25('0x16'),_0x239c51,_0x4e25('0x14'),JSON[_0x4e25('0x17')](_0x2112b5));if(_0x2112b5[_0x4e25('0x18')]){if(_0x2112b5[_0x4e25('0x18')][_0x4e25('0x19')]===0x1f4){logger[_0x4e25('0x18')]('DashboardItem,\x20%s,\x20%s',_0x239c51,_0x2112b5[_0x4e25('0x18')][_0x4e25('0x1a')]);return _0x2d2e43(_0x2112b5[_0x4e25('0x18')][_0x4e25('0x1a')]);}logger[_0x4e25('0x18')](_0x4e25('0x13'),_0x239c51,_0x2112b5[_0x4e25('0x18')][_0x4e25('0x1a')]);return _0x19280e(_0x2112b5['error'][_0x4e25('0x1a')]);}else{logger[_0x4e25('0x12')](_0x4e25('0x13'),_0x239c51,'request\x20sent');_0x19280e(_0x2112b5['result'][_0x4e25('0x1a')]);}})[_0x4e25('0x1b')](function(_0x563463){logger[_0x4e25('0x18')](_0x4e25('0x13'),_0x239c51,_0x563463);_0x2d2e43(_0x563463);});});} \ No newline at end of file +var _0xb5e3=['redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1d7225,_0xaca183){var _0x35e545=function(_0x10569a){while(--_0x10569a){_0x1d7225['push'](_0x1d7225['shift']());}};_0x35e545(++_0xaca183);}(_0xb5e3,0x13e));var _0x3b5e=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xb5e3[_0x487496];return _0x539dc8;};'use strict';var _=require(_0x3b5e('0x0'));var util=require(_0x3b5e('0x1'));var moment=require(_0x3b5e('0x2'));var BPromise=require(_0x3b5e('0x3'));var rs=require(_0x3b5e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b5e('0x5'))['db'];var utils=require(_0x3b5e('0x6'));var logger=require(_0x3b5e('0x7'))(_0x3b5e('0x8'));var config=require(_0x3b5e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3b5e('0xa')][_0x3b5e('0xb')]({'port':0x232a});config[_0x3b5e('0xc')]=_[_0x3b5e('0xd')](config[_0x3b5e('0xc')],{'host':_0x3b5e('0xe'),'port':0x18eb});var socket=require(_0x3b5e('0xf'))(new Redis(config[_0x3b5e('0xc')]));require(_0x3b5e('0x10'))[_0x3b5e('0x11')](socket);function respondWithRpcPromise(_0x124fab,_0x3a6794,_0x1cc7c8){return new BPromise(function(_0x15cf28,_0x2ce4f3){return client[_0x3b5e('0x12')](_0x124fab,_0x1cc7c8)[_0x3b5e('0x13')](function(_0x2eba81){logger[_0x3b5e('0x14')](_0x3b5e('0x15'),_0x3a6794,_0x3b5e('0x16'));logger['debug'](_0x3b5e('0x17'),_0x3a6794,_0x3b5e('0x16'),JSON[_0x3b5e('0x18')](_0x2eba81));if(_0x2eba81[_0x3b5e('0x19')]){if(_0x2eba81[_0x3b5e('0x19')][_0x3b5e('0x1a')]===0x1f4){logger['error'](_0x3b5e('0x15'),_0x3a6794,_0x2eba81[_0x3b5e('0x19')]['message']);return _0x2ce4f3(_0x2eba81[_0x3b5e('0x19')][_0x3b5e('0x1b')]);}logger['error'](_0x3b5e('0x15'),_0x3a6794,_0x2eba81[_0x3b5e('0x19')][_0x3b5e('0x1b')]);return _0x15cf28(_0x2eba81[_0x3b5e('0x19')][_0x3b5e('0x1b')]);}else{logger[_0x3b5e('0x14')](_0x3b5e('0x15'),_0x3a6794,_0x3b5e('0x16'));_0x15cf28(_0x2eba81[_0x3b5e('0x1c')][_0x3b5e('0x1b')]);}})[_0x3b5e('0x1d')](function(_0xc5a0b6){logger[_0x3b5e('0x19')](_0x3b5e('0x15'),_0x3a6794,_0xc5a0b6);_0x2ce4f3(_0xc5a0b6);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 795faf6..b762958 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 _0xba76=['remove','emit','dashboardItem:','./dashboardItem.events','save'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xba76,0x116));var _0x6ba7=function(_0x4835c1,_0x1527a3){_0x4835c1=_0x4835c1-0x0;var _0x50e995=_0xba76[_0x4835c1];return _0x50e995;};'use strict';var DashboardItemEvents=require(_0x6ba7('0x0'));var events=[_0x6ba7('0x1'),_0x6ba7('0x2'),'update'];function createListener(_0x458fd6,_0x577d4e){return function(_0x115dc5){_0x577d4e[_0x6ba7('0x3')](_0x458fd6,_0x115dc5);};}function removeListener(_0x4d4f26,_0x40162c){return function(){DashboardItemEvents['removeListener'](_0x4d4f26,_0x40162c);};}exports['register']=function(_0x2754a5){for(var _0x1739d4=0x0,_0x1c24a3=events['length'];_0x1739d4<_0x1c24a3;_0x1739d4++){var _0x3cd4d5=events[_0x1739d4];var _0x55394f=createListener(_0x6ba7('0x4')+_0x3cd4d5,_0x2754a5);DashboardItemEvents['on'](_0x3cd4d5,_0x55394f);}}; \ No newline at end of file +var _0x0153=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x4f4b62,_0x4dbe21){var _0x5f5310=function(_0x4deb97){while(--_0x4deb97){_0x4f4b62['push'](_0x4f4b62['shift']());}};_0x5f5310(++_0x4dbe21);}(_0x0153,0xed));var _0x3015=function(_0x30c464,_0x1ff4f1){_0x30c464=_0x30c464-0x0;var _0x1d6521=_0x0153[_0x30c464];return _0x1d6521;};'use strict';var DashboardItemEvents=require(_0x3015('0x0'));var events=[_0x3015('0x1'),_0x3015('0x2'),'update'];function createListener(_0x40597c,_0x1ff751){return function(_0x44825c){_0x1ff751[_0x3015('0x3')](_0x40597c,_0x44825c);};}function removeListener(_0x3735d6,_0x23e59b){return function(){DashboardItemEvents[_0x3015('0x4')](_0x3735d6,_0x23e59b);};}exports[_0x3015('0x5')]=function(_0x4fce02){for(var _0x340e90=0x0,_0x4a7081=events[_0x3015('0x6')];_0x340e90<_0x4a7081;_0x340e90++){var _0x7cfdbb=events[_0x340e90];var _0xcb75e=createListener(_0x3015('0x7')+_0x7cfdbb,_0x4fce02);DashboardItemEvents['on'](_0x7cfdbb,_0xcb75e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 206ea61..f3f6380 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 _0x333c=['../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x333c,0x1a3));var _0xc333=function(_0x3500d7,_0x1ac308){_0x3500d7=_0x3500d7-0x0;var _0x41b7fc=_0x333c[_0x3500d7];return _0x41b7fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc333('0x0'));var timeout=require(_0xc333('0x1'));var express=require(_0xc333('0x2'));var router=express['Router']();var fs_extra=require(_0xc333('0x3'));var auth=require(_0xc333('0x4'));var interaction=require(_0xc333('0x5'));var config=require(_0xc333('0x6'));var controller=require(_0xc333('0x7'));router[_0xc333('0x8')](_0xc333('0x9'),auth[_0xc333('0xa')](),controller['show']);router[_0xc333('0xb')]('/',auth[_0xc333('0xa')](),controller['create']);router[_0xc333('0xc')](_0xc333('0x9'),auth[_0xc333('0xa')](),controller[_0xc333('0xd')]);router[_0xc333('0xe')](_0xc333('0x9'),auth[_0xc333('0xa')](),controller[_0xc333('0xf')]);module[_0xc333('0x10')]=router; \ No newline at end of file +var _0x8379=['destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x5645d3,_0x5b89dc){var _0x131f18=function(_0x355d7f){while(--_0x355d7f){_0x5645d3['push'](_0x5645d3['shift']());}};_0x131f18(++_0x5b89dc);}(_0x8379,0x1a5));var _0x9837=function(_0x1684f9,_0x4ed0ea){_0x1684f9=_0x1684f9-0x0;var _0x4d0939=_0x8379[_0x1684f9];return _0x4d0939;};'use strict';var multer=require('multer');var util=require(_0x9837('0x0'));var path=require(_0x9837('0x1'));var timeout=require(_0x9837('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9837('0x3'));var auth=require(_0x9837('0x4'));var interaction=require(_0x9837('0x5'));var config=require('../../config/environment');var controller=require(_0x9837('0x6'));router[_0x9837('0x7')](_0x9837('0x8'),auth[_0x9837('0x9')](),controller[_0x9837('0xa')]);router['post']('/',auth[_0x9837('0x9')](),controller['create']);router[_0x9837('0xb')](_0x9837('0x8'),auth[_0x9837('0x9')](),controller[_0x9837('0xc')]);router[_0x9837('0xd')](_0x9837('0x8'),auth[_0x9837('0x9')](),controller[_0x9837('0xe')]);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 5ce2723..e12914f 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 _0x2e80=['first','second','third','sequelize','STRING','ENUM'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x2e80,0x1e3));var _0x02e8=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0x2e80[_0x568cf0];return _0x360f81;};'use strict';var Sequelize=require(_0x02e8('0x0'));module['exports']={'name':{'type':Sequelize[_0x02e8('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x02e8('0x2')](_0x02e8('0x3'),_0x02e8('0x4'),_0x02e8('0x5')),'allowNull':![],'defaultValue':_0x02e8('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56ca=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x5e878a,_0x31d766){var _0xf2a9b6=function(_0x2468be){while(--_0x2468be){_0x5e878a['push'](_0x5e878a['shift']());}};_0xf2a9b6(++_0x31d766);}(_0x56ca,0x185));var _0xa56c=function(_0x500534,_0x40359f){_0x500534=_0x500534-0x0;var _0x4b619e=_0x56ca[_0x500534];return _0x4b619e;};'use strict';var Sequelize=require(_0xa56c('0x0'));module[_0xa56c('0x1')]={'name':{'type':Sequelize[_0xa56c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa56c('0x3')](_0xa56c('0x4'),_0xa56c('0x5'),_0xa56c('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xa56c('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1802de8..2962109 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 _0xcb14=['include','rows','catch','show','params','rawAttributes','length','create','user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','send','index','map','Disposition','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0xcb14,0x106));var _0x4cb1=function(_0x5ed493,_0x2e626d){_0x5ed493=_0x5ed493-0x0;var _0x5515c8=_0xcb14[_0x5ed493];return _0x5515c8;};'use strict';var emlformat=require(_0x4cb1('0x0'));var rimraf=require(_0x4cb1('0x1'));var zipdir=require(_0x4cb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4cb1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4cb1('0x4'));var util=require(_0x4cb1('0x5'));var path=require(_0x4cb1('0x6'));var sox=require(_0x4cb1('0x7'));var csv=require(_0x4cb1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4cb1('0x9'));var crypto=require(_0x4cb1('0xa'));var jsforce=require(_0x4cb1('0xb'));var deskjs=require(_0x4cb1('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4cb1('0xd'));var Redis=require(_0x4cb1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4cb1('0xf'));var as=require(_0x4cb1('0x10'));var hardwareService=require(_0x4cb1('0x11'));var logger=require(_0x4cb1('0x12'))(_0x4cb1('0x13'));var utils=require(_0x4cb1('0x14'));var config=require(_0x4cb1('0x15'));var licenseUtil=require(_0x4cb1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43d9f1,_0x1c466e){_0x1c466e=_0x1c466e||0xcc;return function(_0x2cb7c4){if(_0x2cb7c4){return _0x43d9f1[_0x4cb1('0x17')](_0x1c466e);}return _0x43d9f1[_0x4cb1('0x18')](_0x1c466e)[_0x4cb1('0x19')]();};}function respondWithResult(_0x5a419f,_0x5ad5b0){_0x5ad5b0=_0x5ad5b0||0xc8;return function(_0x3f2827){if(_0x3f2827){return _0x5a419f[_0x4cb1('0x18')](_0x5ad5b0)[_0x4cb1('0x1a')](_0x3f2827);}};}function respondWithFilteredResult(_0x5d6490,_0x17e0af){return function(_0x500edb){if(_0x500edb){var _0x27f572=typeof _0x17e0af['offset']==='undefined'&&typeof _0x17e0af[_0x4cb1('0x1b')]===_0x4cb1('0x1c');var _0x35f7b9=_0x500edb[_0x4cb1('0x1d')];var _0x5a2f9b=_0x27f572?0x0:_0x17e0af['offset'];var _0xaebce2=_0x27f572?_0x500edb[_0x4cb1('0x1d')]:_0x17e0af[_0x4cb1('0x1e')]+_0x17e0af[_0x4cb1('0x1b')];var _0x38b210;if(_0xaebce2>=_0x35f7b9){_0xaebce2=_0x35f7b9;_0x38b210=0xc8;}else{_0x38b210=0xce;}_0x5d6490[_0x4cb1('0x18')](_0x38b210);return _0x5d6490[_0x4cb1('0x1f')](_0x4cb1('0x20'),_0x5a2f9b+'-'+_0xaebce2+'/'+_0x35f7b9)['json'](_0x500edb);}return null;};}function patchUpdates(_0x466d33){return function(_0x2afb57){try{jsonpatch['apply'](_0x2afb57,_0x466d33,!![]);}catch(_0x571264){return BPromise['reject'](_0x571264);}return _0x2afb57[_0x4cb1('0x21')]();};}function saveUpdates(_0x2db720,_0x311d35){return function(_0x20cd2d){if(_0x20cd2d){return _0x20cd2d[_0x4cb1('0x22')](_0x2db720)[_0x4cb1('0x23')](function(_0x2b1512){return _0x2b1512;});}return null;};}function removeEntity(_0x11ac81,_0x18f7d1){return function(_0x1462ea){if(_0x1462ea){return _0x1462ea[_0x4cb1('0x24')]()['then'](function(){var _0x5e0db6=_0x1462ea[_0x4cb1('0x25')]({'plain':!![]});var _0x336d9b=_0x4cb1('0x26');return db[_0x4cb1('0x27')][_0x4cb1('0x24')]({'where':{'type':_0x336d9b,'resourceId':_0x5e0db6['id']}})[_0x4cb1('0x23')](function(){return _0x1462ea;});})[_0x4cb1('0x23')](function(){_0x11ac81[_0x4cb1('0x18')](0xcc)[_0x4cb1('0x19')]();});}};}function handleEntityNotFound(_0x316544,_0x4ddecd){return function(_0x3ebd74){if(!_0x3ebd74){_0x316544['sendStatus'](0x194);}return _0x3ebd74;};}function handleError(_0xb95b2f,_0x3040d5){_0x3040d5=_0x3040d5||0x1f4;return function(_0x4c1d37){logger['error'](_0x4c1d37[_0x4cb1('0x28')]);if(_0x4c1d37['name']){delete _0x4c1d37[_0x4cb1('0x29')];}_0xb95b2f['status'](_0x3040d5)[_0x4cb1('0x2a')](_0x4c1d37);};}exports[_0x4cb1('0x2b')]=function(_0x4d1135,_0x251acd){var _0xa4e8ba={},_0x3fee0e={},_0x564d32={'count':0x0,'rows':[]};var _0x105fa2=_[_0x4cb1('0x2c')](db[_0x4cb1('0x2d')]['rawAttributes'],function(_0x4a3404){return{'name':_0x4a3404[_0x4cb1('0x2e')],'type':_0x4a3404['type'][_0x4cb1('0x2f')]};});_0x3fee0e[_0x4cb1('0x30')]=_[_0x4cb1('0x2c')](_0x105fa2,_0x4cb1('0x29'));_0x3fee0e[_0x4cb1('0x31')]=_[_0x4cb1('0x32')](_0x4d1135[_0x4cb1('0x31')]);_0x3fee0e['filters']=_[_0x4cb1('0x33')](_0x3fee0e['model'],_0x3fee0e['query']);_0xa4e8ba[_0x4cb1('0x34')]=_[_0x4cb1('0x33')](_0x3fee0e[_0x4cb1('0x30')],qs[_0x4cb1('0x35')](_0x4d1135[_0x4cb1('0x31')]['fields']));_0xa4e8ba['attributes']=_0xa4e8ba['attributes']['length']?_0xa4e8ba[_0x4cb1('0x34')]:_0x3fee0e['model'];if(!_0x4d1135[_0x4cb1('0x31')][_0x4cb1('0x36')](_0x4cb1('0x37'))){_0xa4e8ba['limit']=qs[_0x4cb1('0x1b')](_0x4d1135['query']['limit']);_0xa4e8ba[_0x4cb1('0x1e')]=qs['offset'](_0x4d1135[_0x4cb1('0x31')]['offset']);}_0xa4e8ba['order']=qs[_0x4cb1('0x38')](_0x4d1135[_0x4cb1('0x31')][_0x4cb1('0x38')]);_0xa4e8ba[_0x4cb1('0x39')]=qs[_0x4cb1('0x3a')](_[_0x4cb1('0x3b')](_0x4d1135['query'],_0x3fee0e[_0x4cb1('0x3a')]),_0x105fa2);if(_0x4d1135[_0x4cb1('0x31')][_0x4cb1('0x3c')]){_0xa4e8ba[_0x4cb1('0x39')]=_[_0x4cb1('0x3d')](_0xa4e8ba[_0x4cb1('0x39')],{'$or':_[_0x4cb1('0x2c')](_0x105fa2,function(_0xdd064e){if(_0xdd064e[_0x4cb1('0x3e')]!==_0x4cb1('0x3f')){var _0x43ec88={};_0x43ec88[_0xdd064e[_0x4cb1('0x29')]]={'$like':'%'+_0x4d1135[_0x4cb1('0x31')][_0x4cb1('0x3c')]+'%'};return _0x43ec88;}})});}_0xa4e8ba=_[_0x4cb1('0x3d')]({},_0xa4e8ba,_0x4d1135[_0x4cb1('0x40')]);var _0x6c9e73={'where':_0xa4e8ba[_0x4cb1('0x39')]};return db['Disposition'][_0x4cb1('0x1d')](_0x6c9e73)[_0x4cb1('0x23')](function(_0x120b25){_0x564d32['count']=_0x120b25;if(_0x4d1135['query'][_0x4cb1('0x41')]){_0xa4e8ba[_0x4cb1('0x42')]=[{'all':!![]}];}return db[_0x4cb1('0x2d')]['findAll'](_0xa4e8ba);})[_0x4cb1('0x23')](function(_0x41053f){_0x564d32[_0x4cb1('0x43')]=_0x41053f;return _0x564d32;})[_0x4cb1('0x23')](respondWithFilteredResult(_0x251acd,_0xa4e8ba))[_0x4cb1('0x44')](handleError(_0x251acd,null));};exports[_0x4cb1('0x45')]=function(_0x39a59c,_0x5f3185){var _0x7618a1={'raw':!![],'where':{'id':_0x39a59c[_0x4cb1('0x46')]['id']}},_0x1442c7={};_0x1442c7['model']=_[_0x4cb1('0x32')](db['Disposition'][_0x4cb1('0x47')]);_0x1442c7['query']=_['keys'](_0x39a59c[_0x4cb1('0x31')]);_0x1442c7[_0x4cb1('0x3a')]=_[_0x4cb1('0x33')](_0x1442c7[_0x4cb1('0x30')],_0x1442c7['query']);_0x7618a1[_0x4cb1('0x34')]=_['intersection'](_0x1442c7['model'],qs[_0x4cb1('0x35')](_0x39a59c[_0x4cb1('0x31')][_0x4cb1('0x35')]));_0x7618a1['attributes']=_0x7618a1['attributes'][_0x4cb1('0x48')]?_0x7618a1['attributes']:_0x1442c7[_0x4cb1('0x30')];if(_0x39a59c['query'][_0x4cb1('0x41')]){_0x7618a1['include']=[{'all':!![]}];}_0x7618a1=_[_0x4cb1('0x3d')]({},_0x7618a1,_0x39a59c[_0x4cb1('0x40')]);return db['Disposition']['find'](_0x7618a1)[_0x4cb1('0x23')](handleEntityNotFound(_0x5f3185,null))[_0x4cb1('0x23')](respondWithResult(_0x5f3185,null))['catch'](handleError(_0x5f3185,null));};exports[_0x4cb1('0x49')]=function(_0x13c0e5,_0x5b6cbb){return db['Disposition'][_0x4cb1('0x49')](_0x13c0e5['body'],{})[_0x4cb1('0x23')](function(_0x1fbf1b){var _0x3cef51=_0x13c0e5[_0x4cb1('0x4a')]['get']({'plain':!![]});if(!_0x3cef51)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cef51[_0x4cb1('0x4b')]===_0x4cb1('0x4a')){var _0x5b99e5=_0x1fbf1b['get']({'plain':!![]});var _0x3fc360=_0x4cb1('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x3fc360,'userProfileId':_0x3cef51[_0x4cb1('0x4c')]},'raw':!![]})['then'](function(_0x2e88bc){if(_0x2e88bc&&_0x2e88bc[_0x4cb1('0x4d')]===0x0){return db['UserProfileResource'][_0x4cb1('0x49')]({'name':_0x5b99e5['name'],'resourceId':_0x5b99e5['id'],'type':_0x2e88bc[_0x4cb1('0x29')],'sectionId':_0x2e88bc['id']},{})[_0x4cb1('0x23')](function(){return _0x1fbf1b;});}else{return _0x1fbf1b;}})[_0x4cb1('0x44')](function(_0x5aff12){logger[_0x4cb1('0x4e')](_0x4cb1('0x4f'),_0x5aff12);throw _0x5aff12;});}return _0x1fbf1b;})[_0x4cb1('0x23')](respondWithResult(_0x5b6cbb,0xc9))[_0x4cb1('0x44')](handleError(_0x5b6cbb,null));};exports[_0x4cb1('0x22')]=function(_0x2bee32,_0x167da7){if(_0x2bee32[_0x4cb1('0x50')]['id']){delete _0x2bee32[_0x4cb1('0x50')]['id'];}return db[_0x4cb1('0x2d')][_0x4cb1('0x51')]({'where':{'id':_0x2bee32[_0x4cb1('0x46')]['id']}})[_0x4cb1('0x23')](handleEntityNotFound(_0x167da7,null))[_0x4cb1('0x23')](saveUpdates(_0x2bee32['body'],null))[_0x4cb1('0x23')](respondWithResult(_0x167da7,null))[_0x4cb1('0x44')](handleError(_0x167da7,null));};exports[_0x4cb1('0x24')]=function(_0x5cf80c,_0x3cc317){return db[_0x4cb1('0x2d')][_0x4cb1('0x51')]({'where':{'id':_0x5cf80c[_0x4cb1('0x46')]['id']}})[_0x4cb1('0x23')](handleEntityNotFound(_0x3cc317,null))['then'](removeEntity(_0x3cc317,null))[_0x4cb1('0x44')](handleError(_0x3cc317,null));}; \ No newline at end of file +var _0xf61e=['set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','keys','Disposition','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x1994b7,_0x1eb8d8){var _0x46753f=function(_0x80a46b){while(--_0x80a46b){_0x1994b7['push'](_0x1994b7['shift']());}};_0x46753f(++_0x1eb8d8);}(_0xf61e,0x82));var _0xef61=function(_0x5c9d38,_0x3e988a){_0x5c9d38=_0x5c9d38-0x0;var _0x49f573=_0xf61e[_0x5c9d38];return _0x49f573;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xef61('0x3'));var BPromise=require(_0xef61('0x4'));var Mustache=require(_0xef61('0x5'));var util=require(_0xef61('0x6'));var path=require(_0xef61('0x7'));var sox=require(_0xef61('0x8'));var csv=require(_0xef61('0x9'));var ejs=require(_0xef61('0xa'));var fs=require('fs');var fs_extra=require(_0xef61('0xb'));var _=require('lodash');var squel=require(_0xef61('0xc'));var crypto=require('crypto');var jsforce=require(_0xef61('0xd'));var deskjs=require(_0xef61('0xe'));var toCsv=require(_0xef61('0x9'));var querystring=require(_0xef61('0xf'));var Papa=require(_0xef61('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xef61('0x11'));var hardwareService=require(_0xef61('0x12'));var logger=require(_0xef61('0x13'))('api');var utils=require(_0xef61('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xef61('0x15'));var db=require(_0xef61('0x16'))['db'];function respondWithStatusCode(_0x1dd860,_0x238b16){_0x238b16=_0x238b16||0xcc;return function(_0x5f427c){if(_0x5f427c){return _0x1dd860[_0xef61('0x17')](_0x238b16);}return _0x1dd860['status'](_0x238b16)[_0xef61('0x18')]();};}function respondWithResult(_0xb9dd78,_0x1692d4){_0x1692d4=_0x1692d4||0xc8;return function(_0x24dd49){if(_0x24dd49){return _0xb9dd78[_0xef61('0x19')](_0x1692d4)[_0xef61('0x1a')](_0x24dd49);}};}function respondWithFilteredResult(_0x395d88,_0x512d5b){return function(_0x436a8a){if(_0x436a8a){var _0x4fab66=typeof _0x512d5b[_0xef61('0x1b')]===_0xef61('0x1c')&&typeof _0x512d5b[_0xef61('0x1d')]===_0xef61('0x1c');var _0x15d970=_0x436a8a['count'];var _0x18b628=_0x4fab66?0x0:_0x512d5b['offset'];var _0x1a87ed=_0x4fab66?_0x436a8a['count']:_0x512d5b[_0xef61('0x1b')]+_0x512d5b[_0xef61('0x1d')];var _0x4b1ee3;if(_0x1a87ed>=_0x15d970){_0x1a87ed=_0x15d970;_0x4b1ee3=0xc8;}else{_0x4b1ee3=0xce;}_0x395d88[_0xef61('0x19')](_0x4b1ee3);return _0x395d88[_0xef61('0x1e')](_0xef61('0x1f'),_0x18b628+'-'+_0x1a87ed+'/'+_0x15d970)['json'](_0x436a8a);}return null;};}function patchUpdates(_0x13b2fd){return function(_0x2f8a61){try{jsonpatch[_0xef61('0x20')](_0x2f8a61,_0x13b2fd,!![]);}catch(_0x27f662){return BPromise[_0xef61('0x21')](_0x27f662);}return _0x2f8a61[_0xef61('0x22')]();};}function saveUpdates(_0x51a813,_0x4e9dce){return function(_0x29a66d){if(_0x29a66d){return _0x29a66d[_0xef61('0x23')](_0x51a813)[_0xef61('0x24')](function(_0xc525ea){return _0xc525ea;});}return null;};}function removeEntity(_0x2105ec,_0x46302b){return function(_0x1015e9){if(_0x1015e9){return _0x1015e9[_0xef61('0x25')]()[_0xef61('0x24')](function(){var _0x43ba7a=_0x1015e9['get']({'plain':!![]});var _0x197a9f=_0xef61('0x26');return db[_0xef61('0x27')][_0xef61('0x25')]({'where':{'type':_0x197a9f,'resourceId':_0x43ba7a['id']}})[_0xef61('0x24')](function(){return _0x1015e9;});})[_0xef61('0x24')](function(){_0x2105ec['status'](0xcc)[_0xef61('0x18')]();});}};}function handleEntityNotFound(_0x4e1db2,_0x5f0807){return function(_0x30ff91){if(!_0x30ff91){_0x4e1db2[_0xef61('0x17')](0x194);}return _0x30ff91;};}function handleError(_0x4cb2b8,_0x178079){_0x178079=_0x178079||0x1f4;return function(_0x34bfff){logger[_0xef61('0x28')](_0x34bfff[_0xef61('0x29')]);if(_0x34bfff[_0xef61('0x2a')]){delete _0x34bfff[_0xef61('0x2a')];}_0x4cb2b8[_0xef61('0x19')](_0x178079)[_0xef61('0x2b')](_0x34bfff);};}exports[_0xef61('0x2c')]=function(_0xabb48e,_0x567a92){var _0x2d0955={},_0x1e1915={},_0x3cf5aa={'count':0x0,'rows':[]};var _0x371915=_['map'](db['Disposition'][_0xef61('0x2d')],function(_0x426418){return{'name':_0x426418[_0xef61('0x2e')],'type':_0x426418[_0xef61('0x2f')][_0xef61('0x30')]};});_0x1e1915[_0xef61('0x31')]=_[_0xef61('0x32')](_0x371915,'name');_0x1e1915['query']=_['keys'](_0xabb48e[_0xef61('0x33')]);_0x1e1915['filters']=_[_0xef61('0x34')](_0x1e1915[_0xef61('0x31')],_0x1e1915[_0xef61('0x33')]);_0x2d0955[_0xef61('0x35')]=_[_0xef61('0x34')](_0x1e1915[_0xef61('0x31')],qs[_0xef61('0x36')](_0xabb48e['query']['fields']));_0x2d0955[_0xef61('0x35')]=_0x2d0955[_0xef61('0x35')][_0xef61('0x37')]?_0x2d0955[_0xef61('0x35')]:_0x1e1915['model'];if(!_0xabb48e[_0xef61('0x33')][_0xef61('0x38')]('nolimit')){_0x2d0955[_0xef61('0x1d')]=qs[_0xef61('0x1d')](_0xabb48e['query'][_0xef61('0x1d')]);_0x2d0955[_0xef61('0x1b')]=qs[_0xef61('0x1b')](_0xabb48e['query'][_0xef61('0x1b')]);}_0x2d0955['order']=qs[_0xef61('0x39')](_0xabb48e[_0xef61('0x33')][_0xef61('0x39')]);_0x2d0955['where']=qs['filters'](_['pick'](_0xabb48e[_0xef61('0x33')],_0x1e1915[_0xef61('0x3a')]),_0x371915);if(_0xabb48e[_0xef61('0x33')][_0xef61('0x3b')]){_0x2d0955['where']=_[_0xef61('0x3c')](_0x2d0955['where'],{'$or':_[_0xef61('0x32')](_0x371915,function(_0x7e2ba6){if(_0x7e2ba6[_0xef61('0x2f')]!==_0xef61('0x3d')){var _0x55be39={};_0x55be39[_0x7e2ba6['name']]={'$like':'%'+_0xabb48e[_0xef61('0x33')][_0xef61('0x3b')]+'%'};return _0x55be39;}})});}_0x2d0955=_[_0xef61('0x3c')]({},_0x2d0955,_0xabb48e[_0xef61('0x3e')]);var _0x3f2af2={'where':_0x2d0955['where']};return db['Disposition'][_0xef61('0x3f')](_0x3f2af2)[_0xef61('0x24')](function(_0x284b61){_0x3cf5aa[_0xef61('0x3f')]=_0x284b61;if(_0xabb48e['query'][_0xef61('0x40')]){_0x2d0955[_0xef61('0x41')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2d0955);})['then'](function(_0x1304b3){_0x3cf5aa[_0xef61('0x42')]=_0x1304b3;return _0x3cf5aa;})[_0xef61('0x24')](respondWithFilteredResult(_0x567a92,_0x2d0955))['catch'](handleError(_0x567a92,null));};exports[_0xef61('0x43')]=function(_0x24d213,_0x6b8383){var _0x3f6133={'raw':!![],'where':{'id':_0x24d213['params']['id']}},_0x502082={};_0x502082[_0xef61('0x31')]=_[_0xef61('0x44')](db['Disposition'][_0xef61('0x2d')]);_0x502082[_0xef61('0x33')]=_['keys'](_0x24d213[_0xef61('0x33')]);_0x502082['filters']=_[_0xef61('0x34')](_0x502082[_0xef61('0x31')],_0x502082['query']);_0x3f6133['attributes']=_[_0xef61('0x34')](_0x502082['model'],qs[_0xef61('0x36')](_0x24d213[_0xef61('0x33')][_0xef61('0x36')]));_0x3f6133[_0xef61('0x35')]=_0x3f6133[_0xef61('0x35')][_0xef61('0x37')]?_0x3f6133[_0xef61('0x35')]:_0x502082['model'];if(_0x24d213[_0xef61('0x33')][_0xef61('0x40')]){_0x3f6133[_0xef61('0x41')]=[{'all':!![]}];}_0x3f6133=_['merge']({},_0x3f6133,_0x24d213[_0xef61('0x3e')]);return db[_0xef61('0x45')][_0xef61('0x46')](_0x3f6133)[_0xef61('0x24')](handleEntityNotFound(_0x6b8383,null))[_0xef61('0x24')](respondWithResult(_0x6b8383,null))[_0xef61('0x47')](handleError(_0x6b8383,null));};exports['create']=function(_0x416924,_0x173395){return db[_0xef61('0x45')][_0xef61('0x48')](_0x416924['body'],{})[_0xef61('0x24')](function(_0x35a8bf){var _0x5f02b3=_0x416924[_0xef61('0x49')][_0xef61('0x4a')]({'plain':!![]});if(!_0x5f02b3)throw new Error(_0xef61('0x4b'));if(_0x5f02b3[_0xef61('0x4c')]==='user'){var _0x2bfa43=_0x35a8bf[_0xef61('0x4a')]({'plain':!![]});var _0x1e6f19=_0xef61('0x26');return db[_0xef61('0x4d')][_0xef61('0x46')]({'where':{'name':_0x1e6f19,'userProfileId':_0x5f02b3['userProfileId']},'raw':!![]})['then'](function(_0x340068){if(_0x340068&&_0x340068['autoAssociation']===0x0){return db['UserProfileResource'][_0xef61('0x48')]({'name':_0x2bfa43['name'],'resourceId':_0x2bfa43['id'],'type':_0x340068['name'],'sectionId':_0x340068['id']},{})[_0xef61('0x24')](function(){return _0x35a8bf;});}else{return _0x35a8bf;}})[_0xef61('0x47')](function(_0x1d87a2){logger[_0xef61('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d87a2);throw _0x1d87a2;});}return _0x35a8bf;})[_0xef61('0x24')](respondWithResult(_0x173395,0xc9))[_0xef61('0x47')](handleError(_0x173395,null));};exports[_0xef61('0x23')]=function(_0x34c648,_0x35e439){if(_0x34c648[_0xef61('0x4e')]['id']){delete _0x34c648['body']['id'];}return db[_0xef61('0x45')][_0xef61('0x46')]({'where':{'id':_0x34c648[_0xef61('0x4f')]['id']}})[_0xef61('0x24')](handleEntityNotFound(_0x35e439,null))[_0xef61('0x24')](saveUpdates(_0x34c648[_0xef61('0x4e')],null))['then'](respondWithResult(_0x35e439,null))[_0xef61('0x47')](handleError(_0x35e439,null));};exports['destroy']=function(_0x5bb504,_0x556466){return db[_0xef61('0x45')][_0xef61('0x46')]({'where':{'id':_0x5bb504[_0xef61('0x4f')]['id']}})[_0xef61('0x24')](handleEntityNotFound(_0x556466,null))[_0xef61('0x24')](removeEntity(_0x556466,null))[_0xef61('0x47')](handleError(_0x556466,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 301aa80..cbfc9e0 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 _0x4baf=['bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name','name_chat','name_mail','MailAccountId','name_sms','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','api','moment'];(function(_0x38ed42,_0x3d9a37){var _0x474931=function(_0x1fa601){while(--_0x1fa601){_0x38ed42['push'](_0x38ed42['shift']());}};_0x474931(++_0x3d9a37);}(_0x4baf,0xf9));var _0xf4ba=function(_0x34ab55,_0x2a188d){_0x34ab55=_0x34ab55-0x0;var _0x2a63aa=_0x4baf[_0x34ab55];return _0x2a63aa;};'use strict';var _=require('lodash');var util=require(_0xf4ba('0x0'));var logger=require('../../config/logger')(_0xf4ba('0x1'));var moment=require(_0xf4ba('0x2'));var BPromise=require(_0xf4ba('0x3'));var rp=require(_0xf4ba('0x4'));var fs=require('fs');var path=require(_0xf4ba('0x5'));var rimraf=require(_0xf4ba('0x6'));var config=require(_0xf4ba('0x7'));var attributes=require(_0xf4ba('0x8'));module['exports']=function(_0x3cc806,_0x203e33){return _0x3cc806[_0xf4ba('0x9')](_0xf4ba('0xa'),attributes,{'tableName':_0xf4ba('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xf4ba('0xc'),'ListId']},{'unique':!![],'name':_0xf4ba('0xd'),'fields':[_0xf4ba('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0xf4ba('0xe'),'fields':[_0xf4ba('0xc'),_0xf4ba('0xf')]},{'unique':!![],'name':_0xf4ba('0x10'),'fields':[_0xf4ba('0xc'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0xf4ba('0x11')]},{'unique':!![],'name':_0xf4ba('0x12'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xf4ba('0x13'),'fields':[_0xf4ba('0xc'),_0xf4ba('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9123=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','path','rimraf','./disposition.attributes','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId'];(function(_0x2ad1b8,_0x1ea09b){var _0x52547d=function(_0x33b77c){while(--_0x33b77c){_0x2ad1b8['push'](_0x2ad1b8['shift']());}};_0x52547d(++_0x1ea09b);}(_0x9123,0x1a4));var _0x3912=function(_0x601638,_0x576686){_0x601638=_0x601638-0x0;var _0x32f939=_0x9123[_0x601638];return _0x32f939;};'use strict';var _=require(_0x3912('0x0'));var util=require(_0x3912('0x1'));var logger=require(_0x3912('0x2'))('api');var moment=require(_0x3912('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3912('0x4'));var rimraf=require(_0x3912('0x5'));var config=require('../../config/environment');var attributes=require(_0x3912('0x6'));module['exports']=function(_0x64d07d,_0x4e6b72){return _0x64d07d[_0x3912('0x7')]('Disposition',attributes,{'tableName':_0x3912('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3912('0x9'),'fields':[_0x3912('0xa'),_0x3912('0xb')]},{'unique':!![],'name':_0x3912('0xc'),'fields':[_0x3912('0xa'),_0x3912('0xd')]},{'unique':!![],'name':_0x3912('0xe'),'fields':[_0x3912('0xa'),_0x3912('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x3912('0xa'),_0x3912('0x10')]},{'unique':!![],'name':_0x3912('0x11'),'fields':[_0x3912('0xa'),_0x3912('0x12')]},{'unique':!![],'name':_0x3912('0x13'),'fields':[_0x3912('0xa'),_0x3912('0x14')]},{'unique':!![],'name':_0x3912('0x15'),'fields':[_0x3912('0xa'),_0x3912('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 917f6a1..e8f137f 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(_0x401818,_0x3f1df5){var _0x37753a=function(_0x210809){while(--_0x210809){_0x401818['push'](_0x401818['shift']());}};_0x37753a(++_0x3f1df5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d3118,_0xe439bf){var _0x2203bc=function(_0x5f328a){while(--_0x5f328a){_0x2d3118['push'](_0x2d3118['shift']());}};_0x2203bc(++_0xe439bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index aeb340e..46890d8 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 _0x24ca=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4f63c0,_0x4abc0d){var _0x3f7729=function(_0x1bd3f1){while(--_0x1bd3f1){_0x4f63c0['push'](_0x4f63c0['shift']());}};_0x3f7729(++_0x4abc0d);}(_0x24ca,0x1aa));var _0xa24c=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x24ca[_0x4c3ffe];return _0x28d3eb;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express[_0xa24c('0x4')]();var fs_extra=require(_0xa24c('0x5'));var auth=require(_0xa24c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa24c('0x7'));var controller=require('./disposition.controller');router['get']('/',auth[_0xa24c('0x8')](),controller[_0xa24c('0x9')]);router[_0xa24c('0xa')](_0xa24c('0xb'),auth['isAuthenticated'](),controller[_0xa24c('0xc')]);router['post']('/',auth[_0xa24c('0x8')](),controller[_0xa24c('0xd')]);router[_0xa24c('0xe')]('/:id',auth[_0xa24c('0x8')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xb'),auth['isAuthenticated'](),controller[_0xa24c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3667=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports'];(function(_0x508610,_0x401c1d){var _0x3e34bb=function(_0x17f731){while(--_0x17f731){_0x508610['push'](_0x508610['shift']());}};_0x3e34bb(++_0x401c1d);}(_0x3667,0x72));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express[_0x7366('0x5')]();var fs_extra=require(_0x7366('0x6'));var auth=require(_0x7366('0x7'));var interaction=require(_0x7366('0x8'));var config=require('../../config/environment');var controller=require(_0x7366('0x9'));router[_0x7366('0xa')]('/',auth[_0x7366('0xb')](),controller['index']);router['get'](_0x7366('0xc'),auth[_0x7366('0xb')](),controller['show']);router[_0x7366('0xd')]('/',auth[_0x7366('0xb')](),controller[_0x7366('0xe')]);router[_0x7366('0xf')](_0x7366('0xc'),auth['isAuthenticated'](),controller[_0x7366('0x10')]);router[_0x7366('0x11')](_0x7366('0xc'),auth[_0x7366('0xb')](),controller['destroy']);module[_0x7366('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3581290..6c90b93 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 _0xe7df=['yes','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0x1e9c8f,_0x2bd677){var _0x5a99cb=function(_0x282633){while(--_0x282633){_0x1e9c8f['push'](_0x1e9c8f['shift']());}};_0x5a99cb(++_0x2bd677);}(_0xe7df,0x9d));var _0xfe7d=function(_0x726917,_0x2516b2){_0x726917=_0x726917-0x0;var _0x5d3d40=_0xe7df[_0x726917];return _0x5d3d40;};'use strict';var Sequelize=require(_0xfe7d('0x0'));module[_0xfe7d('0x1')]={'name':{'type':Sequelize[_0xfe7d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfe7d('0x2')]},'ecm':{'type':Sequelize[_0xfe7d('0x3')](_0xfe7d('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xfe7d('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xfe7d('0x2')],'unique':_0xfe7d('0x5')},'minrate':{'type':Sequelize[_0xfe7d('0x3')]('2400',_0xfe7d('0x6'),_0xfe7d('0x7'),_0xfe7d('0x8'),_0xfe7d('0x9'),_0xfe7d('0xa')),'defaultValue':_0xfe7d('0x6')},'maxrate':{'type':Sequelize[_0xfe7d('0x3')](_0xfe7d('0xb'),_0xfe7d('0x6'),_0xfe7d('0x7'),_0xfe7d('0x8'),_0xfe7d('0x9'),_0xfe7d('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xfe7d('0x2')],'defaultValue':_0xfe7d('0xc')},'gateway':{'type':Sequelize[_0xfe7d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xfe7d('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfe7d('0x3')](_0xfe7d('0xe'),_0xfe7d('0xf'),'DADHI','KHOMP'),'defaultValue':_0xfe7d('0xe')},'key':{'type':Sequelize[_0xfe7d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfe7d('0x10')],'defaultValue':function(){return _0xfe7d('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfe7d('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfe7d('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe7d('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfe7d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe7d('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xfe7d('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xfe7d('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3e6aba){if(!_0x3e6aba)this[_0xfe7d('0x14')](_0xfe7d('0x15'),null);this[_0xfe7d('0x14')](_0xfe7d('0x16'),_0x3e6aba);}}}; \ No newline at end of file +var _0xde84=['4800','7200','9600','12000','14400','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','2400'];(function(_0x207cf1,_0x14e106){var _0x5e52a2=function(_0xee691f){while(--_0xee691f){_0x207cf1['push'](_0x207cf1['shift']());}};_0x5e52a2(++_0x14e106);}(_0xde84,0x127));var _0x4de8=function(_0x198129,_0x13face){_0x198129=_0x198129-0x0;var _0x5314d1=_0xde84[_0x198129];return _0x5314d1;};'use strict';var Sequelize=require('sequelize');module[_0x4de8('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4de8('0x1')]},'ecm':{'type':Sequelize[_0x4de8('0x2')](_0x4de8('0x3'),'no'),'defaultValue':_0x4de8('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x4de8('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x4de8('0x4'),_0x4de8('0x5'),_0x4de8('0x6'),_0x4de8('0x7'),_0x4de8('0x8'),'14400'),'defaultValue':_0x4de8('0x5')},'maxrate':{'type':Sequelize[_0x4de8('0x2')](_0x4de8('0x4'),_0x4de8('0x5'),_0x4de8('0x6'),_0x4de8('0x7'),_0x4de8('0x8'),'14400'),'defaultValue':_0x4de8('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4de8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4de8('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4de8('0x2')]('SIP',_0x4de8('0xb'),_0x4de8('0xc'),_0x4de8('0xd')),'defaultValue':_0x4de8('0xe')},'key':{'type':Sequelize[_0x4de8('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4de8('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4de8('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4de8('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4de8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4de8('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4de8('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4de8('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4de8('0xa')],'allowNull':!![],'defaultValue':null,'comment':_0x4de8('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x4de8('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b98d2){if(!_0x2b98d2)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x4de8('0x12')](_0x4de8('0x13'),_0x2b98d2);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5d3583a..6e044aa 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 _0xab19=['then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','get','FaxAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','merge','where','filter','options','FaxAccount','include','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','findOne','order','pick','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','addInteraction','FaxInteraction','omit','User','fullname','internal','Tag','Tags','color','tag','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','Set','ecm','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','sequelize','VoiceExtension','updateAccountApplications','updatedAt','TrunkId','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','fax','List','ListId','List\x20not\x20found','out','Messages','spread','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request'];(function(_0x57ef11,_0x23a9b2){var _0x1bf2be=function(_0x1c43ae){while(--_0x1c43ae){_0x57ef11['push'](_0x57ef11['shift']());}};_0x1bf2be(++_0x23a9b2);}(_0xab19,0x156));var _0x9ab1=function(_0x1e0eba,_0x15a84c){_0x1e0eba=_0x1e0eba-0x0;var _0x631c66=_0xab19[_0x1e0eba];return _0x631c66;};'use strict';var emlformat=require(_0x9ab1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9ab1('0x1'));var rp=require('request-promise');var moment=require(_0x9ab1('0x2'));var BPromise=require(_0x9ab1('0x3'));var Mustache=require(_0x9ab1('0x4'));var util=require(_0x9ab1('0x5'));var path=require('path');var sox=require(_0x9ab1('0x6'));var csv=require(_0x9ab1('0x7'));var ejs=require(_0x9ab1('0x8'));var fs=require('fs');var fs_extra=require(_0x9ab1('0x9'));var _=require(_0x9ab1('0xa'));var squel=require(_0x9ab1('0xb'));var crypto=require(_0x9ab1('0xc'));var jsforce=require(_0x9ab1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9ab1('0x7'));var querystring=require(_0x9ab1('0xe'));var Papa=require(_0x9ab1('0xf'));var Redis=require(_0x9ab1('0x10'));var authService=require(_0x9ab1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9ab1('0x12'));var hardwareService=require(_0x9ab1('0x13'));var logger=require(_0x9ab1('0x14'))(_0x9ab1('0x15'));var utils=require(_0x9ab1('0x16'));var config=require(_0x9ab1('0x17'));var licenseUtil=require(_0x9ab1('0x18'));var db=require(_0x9ab1('0x19'))['db'];config[_0x9ab1('0x1a')]=_[_0x9ab1('0x1b')](config[_0x9ab1('0x1a')],{'host':_0x9ab1('0x1c'),'port':0x18eb});var socket=require(_0x9ab1('0x1d'))(new Redis(config['redis']));require(_0x9ab1('0x1e'))[_0x9ab1('0x1f')](socket);var jayson=require(_0x9ab1('0x20'));var client=jayson[_0x9ab1('0x21')][_0x9ab1('0x22')]({'port':0x232c});var client9002=jayson[_0x9ab1('0x21')][_0x9ab1('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x41f54b,_0x8dbddf,_0x20409a,_0x3c1506){return new BPromise(function(_0x3e1c67,_0x5dc5da){var _0x43951c=_0x3c1506||client;return _0x43951c[_0x9ab1('0x23')](_0x41f54b,_0x20409a)[_0x9ab1('0x24')](function(_0x430c39){logger[_0x9ab1('0x25')](_0x9ab1('0x26'),_0x8dbddf,_0x9ab1('0x27'));logger['debug'](_0x9ab1('0x28'),_0x8dbddf,_0x9ab1('0x27'),JSON[_0x9ab1('0x29')](_0x430c39));if(_0x430c39[_0x9ab1('0x2a')]){if(_0x430c39[_0x9ab1('0x2a')]['code']===0x1f4){logger[_0x9ab1('0x2a')](_0x9ab1('0x26'),_0x8dbddf,_0x430c39[_0x9ab1('0x2a')][_0x9ab1('0x2b')]);return _0x5dc5da(_0x430c39['error']['message']);}logger[_0x9ab1('0x2a')](_0x9ab1('0x26'),_0x8dbddf,_0x430c39[_0x9ab1('0x2a')][_0x9ab1('0x2b')]);return _0x3e1c67(_0x430c39[_0x9ab1('0x2a')][_0x9ab1('0x2b')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x8dbddf,_0x9ab1('0x27'));_0x3e1c67(_0x430c39['result']['message']);}})[_0x9ab1('0x2c')](function(_0x2c4db4){logger[_0x9ab1('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x8dbddf,_0x2c4db4);_0x5dc5da(_0x2c4db4);});});}function respondWithStatusCode(_0x1b376f,_0xa464d9){_0xa464d9=_0xa464d9||0xcc;return function(_0x955d40){if(_0x955d40){return _0x1b376f[_0x9ab1('0x2d')](_0xa464d9);}return _0x1b376f['status'](_0xa464d9)[_0x9ab1('0x2e')]();};}function respondWithResult(_0x2ef930,_0x42b3b9){_0x42b3b9=_0x42b3b9||0xc8;return function(_0x11bbe8){if(_0x11bbe8){return _0x2ef930[_0x9ab1('0x2f')](_0x42b3b9)['json'](_0x11bbe8);}};}function respondWithFilteredResult(_0x4c67aa,_0x5c5e8c){return function(_0x5f12d3){if(_0x5f12d3){var _0x161d4b=typeof _0x5c5e8c[_0x9ab1('0x30')]===_0x9ab1('0x31')&&typeof _0x5c5e8c[_0x9ab1('0x32')]===_0x9ab1('0x31');var _0xd245ef=_0x5f12d3[_0x9ab1('0x33')];var _0x33cb8a=_0x161d4b?0x0:_0x5c5e8c[_0x9ab1('0x30')];var _0x3adb56=_0x161d4b?_0x5f12d3[_0x9ab1('0x33')]:_0x5c5e8c[_0x9ab1('0x30')]+_0x5c5e8c[_0x9ab1('0x32')];var _0x501d5b;if(_0x3adb56>=_0xd245ef){_0x3adb56=_0xd245ef;_0x501d5b=0xc8;}else{_0x501d5b=0xce;}_0x4c67aa[_0x9ab1('0x2f')](_0x501d5b);return _0x4c67aa[_0x9ab1('0x34')](_0x9ab1('0x35'),_0x33cb8a+'-'+_0x3adb56+'/'+_0xd245ef)[_0x9ab1('0x36')](_0x5f12d3);}return null;};}function patchUpdates(_0x4ebf55){return function(_0x4e68e9){try{jsonpatch['apply'](_0x4e68e9,_0x4ebf55,!![]);}catch(_0x351ef){return BPromise[_0x9ab1('0x37')](_0x351ef);}return _0x4e68e9['save']();};}function saveUpdates(_0xf44ed0,_0xd2d392){return function(_0x1dfea9){if(_0x1dfea9){return _0x1dfea9[_0x9ab1('0x38')](_0xf44ed0)[_0x9ab1('0x24')](function(_0x5a92b9){return _0x5a92b9;});}return null;};}function removeEntity(_0x13174f,_0x5a4700){return function(_0x3060d0){if(_0x3060d0){return _0x3060d0['destroy']()[_0x9ab1('0x24')](function(){var _0x2530f3=_0x3060d0[_0x9ab1('0x39')]({'plain':!![]});var _0x2c56e5=_0x9ab1('0x3a');return db[_0x9ab1('0x3b')][_0x9ab1('0x3c')]({'where':{'type':_0x2c56e5,'resourceId':_0x2530f3['id']}})[_0x9ab1('0x24')](function(){return _0x3060d0;});})[_0x9ab1('0x24')](function(){_0x13174f[_0x9ab1('0x2f')](0xcc)[_0x9ab1('0x2e')]();});}};}function handleEntityNotFound(_0x58798e,_0x2e8bb6){return function(_0x206012){if(!_0x206012){_0x58798e['sendStatus'](0x194);}return _0x206012;};}function handleError(_0x11eda6,_0x5b0298){_0x5b0298=_0x5b0298||0x1f4;return function(_0x2cebfa){logger[_0x9ab1('0x2a')](_0x2cebfa[_0x9ab1('0x3d')]);if(_0x2cebfa['name']){delete _0x2cebfa[_0x9ab1('0x3e')];}_0x11eda6[_0x9ab1('0x2f')](_0x5b0298)[_0x9ab1('0x3f')](_0x2cebfa);};}exports[_0x9ab1('0x40')]=function(_0x17afcb,_0xe1e8a6){var _0x54ddeb={'include':[{'model':db[_0x9ab1('0x41')],'as':_0x9ab1('0x42')}]},_0x5374e0={},_0x5dcabf={'count':0x0,'rows':[]};var _0x27d2ed=_[_0x9ab1('0x43')](db['FaxAccount'][_0x9ab1('0x44')],function(_0x3c1804){return{'name':_0x3c1804[_0x9ab1('0x45')],'type':_0x3c1804[_0x9ab1('0x46')][_0x9ab1('0x47')]};});_0x5374e0[_0x9ab1('0x48')]=_[_0x9ab1('0x43')](_0x27d2ed,_0x9ab1('0x3e'));_0x5374e0[_0x9ab1('0x49')]=_[_0x9ab1('0x4a')](_0x17afcb[_0x9ab1('0x49')]);_0x5374e0[_0x9ab1('0x4b')]=_['intersection'](_0x5374e0[_0x9ab1('0x48')],_0x5374e0[_0x9ab1('0x49')]);_0x54ddeb['attributes']=_[_0x9ab1('0x4c')](_0x5374e0[_0x9ab1('0x48')],qs[_0x9ab1('0x4d')](_0x17afcb[_0x9ab1('0x49')][_0x9ab1('0x4d')]));_0x54ddeb['attributes']=_0x54ddeb[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x54ddeb[_0x9ab1('0x4e')]:_0x5374e0[_0x9ab1('0x48')];if(!_0x17afcb[_0x9ab1('0x49')][_0x9ab1('0x50')](_0x9ab1('0x51'))){_0x54ddeb[_0x9ab1('0x32')]=qs[_0x9ab1('0x32')](_0x17afcb[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x54ddeb[_0x9ab1('0x30')]=qs['offset'](_0x17afcb['query'][_0x9ab1('0x30')]);}_0x54ddeb['order']=qs[_0x9ab1('0x52')](_0x17afcb['query']['sort']);_0x54ddeb['where']=qs[_0x9ab1('0x4b')](_['pick'](_0x17afcb[_0x9ab1('0x49')],_0x5374e0['filters']),_0x27d2ed);if(_0x17afcb[_0x9ab1('0x49')]['filter']){_0x54ddeb['where']=_[_0x9ab1('0x53')](_0x54ddeb[_0x9ab1('0x54')],{'$or':_[_0x9ab1('0x43')](_0x27d2ed,function(_0x48e9fd){if(_0x48e9fd[_0x9ab1('0x46')]!=='VIRTUAL'){var _0x50a34d={};_0x50a34d[_0x48e9fd[_0x9ab1('0x3e')]]={'$like':'%'+_0x17afcb[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x50a34d;}})});}_0x54ddeb=_[_0x9ab1('0x53')]({},_0x54ddeb,_0x17afcb[_0x9ab1('0x56')]);var _0x255768={'where':_0x54ddeb[_0x9ab1('0x54')]};return db[_0x9ab1('0x57')][_0x9ab1('0x33')](_0x255768)['then'](function(_0x448058){_0x5dcabf[_0x9ab1('0x33')]=_0x448058;if(_0x17afcb[_0x9ab1('0x49')]['includeAll']){_0x54ddeb[_0x9ab1('0x58')]=[{'all':!![]}];}return db[_0x9ab1('0x57')]['findAll'](_0x54ddeb);})[_0x9ab1('0x24')](function(_0x46117e){_0x5dcabf['rows']=_0x46117e;return _0x5dcabf;})[_0x9ab1('0x24')](respondWithFilteredResult(_0xe1e8a6,_0x54ddeb))[_0x9ab1('0x2c')](handleError(_0xe1e8a6,null));};exports[_0x9ab1('0x59')]=function(_0x3d8205,_0x89ea0a){var _0x233fec={'raw':![],'where':{'id':_0x3d8205[_0x9ab1('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x9ab1('0x42')}]},_0x3c6a41={};_0x3c6a41['model']=_[_0x9ab1('0x4a')](db[_0x9ab1('0x57')][_0x9ab1('0x44')]);_0x3c6a41[_0x9ab1('0x49')]=_[_0x9ab1('0x4a')](_0x3d8205[_0x9ab1('0x49')]);_0x3c6a41[_0x9ab1('0x4b')]=_['intersection'](_0x3c6a41['model'],_0x3c6a41['query']);_0x233fec[_0x9ab1('0x4e')]=_[_0x9ab1('0x4c')](_0x3c6a41['model'],qs[_0x9ab1('0x4d')](_0x3d8205[_0x9ab1('0x49')][_0x9ab1('0x4d')]));_0x233fec[_0x9ab1('0x4e')]=_0x233fec[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x233fec['attributes']:_0x3c6a41[_0x9ab1('0x48')];if(_0x3d8205[_0x9ab1('0x49')]['includeAll']){_0x233fec[_0x9ab1('0x58')]=[{'all':!![]}];}_0x233fec=_[_0x9ab1('0x53')]({},_0x233fec,_0x3d8205[_0x9ab1('0x56')]);return db['FaxAccount'][_0x9ab1('0x5b')](_0x233fec)[_0x9ab1('0x24')](handleEntityNotFound(_0x89ea0a,null))[_0x9ab1('0x24')](respondWithResult(_0x89ea0a,null))[_0x9ab1('0x2c')](handleError(_0x89ea0a,null));};exports['create']=function(_0x46b2fd,_0x43eda5){return db[_0x9ab1('0x57')][_0x9ab1('0x5c')](_0x46b2fd['body'],{})[_0x9ab1('0x24')](function(_0x1e06e0){var _0x424f1b=_0x46b2fd[_0x9ab1('0x5d')][_0x9ab1('0x39')]({'plain':!![]});if(!_0x424f1b)throw new Error(_0x9ab1('0x5e'));if(_0x424f1b['role']===_0x9ab1('0x5d')){var _0x3d4120=_0x1e06e0[_0x9ab1('0x39')]({'plain':!![]});var _0x37a023=_0x9ab1('0x3a');return db['UserProfileSection'][_0x9ab1('0x5b')]({'where':{'name':_0x37a023,'userProfileId':_0x424f1b['userProfileId']},'raw':!![]})['then'](function(_0x52b5e4){if(_0x52b5e4&&_0x52b5e4[_0x9ab1('0x5f')]===0x0){return db[_0x9ab1('0x3b')][_0x9ab1('0x5c')]({'name':_0x3d4120[_0x9ab1('0x3e')],'resourceId':_0x3d4120['id'],'type':_0x52b5e4[_0x9ab1('0x3e')],'sectionId':_0x52b5e4['id']},{})[_0x9ab1('0x24')](function(){return _0x1e06e0;});}else{return _0x1e06e0;}})[_0x9ab1('0x2c')](function(_0x3ac35c){logger['error'](_0x9ab1('0x60'),_0x3ac35c);throw _0x3ac35c;});}return _0x1e06e0;})[_0x9ab1('0x24')](respondWithResult(_0x43eda5,0xc9))[_0x9ab1('0x2c')](handleError(_0x43eda5,null));};exports['update']=function(_0x5464d3,_0x54b84d){if(_0x5464d3[_0x9ab1('0x61')]['id']){delete _0x5464d3[_0x9ab1('0x61')]['id'];}return db[_0x9ab1('0x57')][_0x9ab1('0x5b')]({'where':{'id':_0x5464d3['params']['id']},'include':[{'model':db[_0x9ab1('0x41')],'as':_0x9ab1('0x42')}]})[_0x9ab1('0x24')](handleEntityNotFound(_0x54b84d,null))[_0x9ab1('0x24')](saveUpdates(_0x5464d3[_0x9ab1('0x61')],null))[_0x9ab1('0x24')](respondWithResult(_0x54b84d,null))[_0x9ab1('0x2c')](handleError(_0x54b84d,null));};exports[_0x9ab1('0x3c')]=function(_0x446ff7,_0x348be2){return db['FaxAccount'][_0x9ab1('0x5b')]({'where':{'id':_0x446ff7[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x348be2,null))[_0x9ab1('0x24')](removeEntity(_0x348be2,null))[_0x9ab1('0x2c')](handleError(_0x348be2,null));};exports[_0x9ab1('0x62')]=function(_0x3aa6e1,_0x40e33e){return db[_0x9ab1('0x57')][_0x9ab1('0x62')]()[_0x9ab1('0x24')](respondWithResult(_0x40e33e,null))[_0x9ab1('0x2c')](handleError(_0x40e33e,null));};exports[_0x9ab1('0x63')]=function(_0x2b3150,_0x4e2719,_0x253f5f){if(_0x2b3150[_0x9ab1('0x61')]['id']){delete _0x2b3150['body']['id'];}return db[_0x9ab1('0x57')]['find']({'where':{'id':_0x2b3150[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4e2719,null))[_0x9ab1('0x24')](function(_0x384f6e){if(_0x384f6e){_0x2b3150[_0x9ab1('0x61')][_0x9ab1('0x64')]=_0x384f6e['id'];return db[_0x9ab1('0x65')][_0x9ab1('0x5c')](_0x2b3150[_0x9ab1('0x61')]);}})[_0x9ab1('0x24')](respondWithResult(_0x4e2719,null))[_0x9ab1('0x2c')](handleError(_0x4e2719,null));};exports['getDispositions']=function(_0xafac82,_0x1d4af3,_0xb81b4c){var _0x4f64ee={'raw':![],'where':{}};var _0x278416={};var _0x5d1984={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9ab1('0x66')]({'where':{'id':_0xafac82['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x1d4af3,null))[_0x9ab1('0x24')](function(_0x2b5738){if(_0x2b5738){_0x278416[_0x9ab1('0x48')]=_['keys'](db['Disposition'][_0x9ab1('0x44')]);_0x278416['query']=_[_0x9ab1('0x4a')](_0xafac82[_0x9ab1('0x49')]);_0x278416[_0x9ab1('0x4b')]=_['intersection'](_0x278416[_0x9ab1('0x48')],_0x278416[_0x9ab1('0x49')]);_0x4f64ee['attributes']=_[_0x9ab1('0x4c')](_0x278416['model'],qs['fields'](_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x4d')]));_0x4f64ee[_0x9ab1('0x4e')]=_0x4f64ee[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x4f64ee['attributes']:_0x278416['model'];if(!_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x50')]('nolimit')){_0x4f64ee[_0x9ab1('0x32')]=qs['limit'](_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x4f64ee['offset']=qs['offset'](_0xafac82['query'][_0x9ab1('0x30')]);}_0x4f64ee[_0x9ab1('0x67')]=qs[_0x9ab1('0x52')](_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x4f64ee[_0x9ab1('0x54')]=qs[_0x9ab1('0x4b')](_[_0x9ab1('0x68')](_0xafac82[_0x9ab1('0x49')],_0x278416[_0x9ab1('0x4b')]));_0x4f64ee['where'][_0x9ab1('0x64')]=_0x2b5738['id'];if(_0xafac82['query'][_0x9ab1('0x55')]){_0x4f64ee[_0x9ab1('0x54')]=_['merge'](_0x4f64ee['where'],{'$or':_[_0x9ab1('0x43')](_0x4f64ee[_0x9ab1('0x4e')],function(_0x6812ca){var _0x145f22={};_0x145f22[_0x6812ca]={'$like':'%'+_0xafac82['query'][_0x9ab1('0x55')]+'%'};return _0x145f22;})});}_0x4f64ee=_[_0x9ab1('0x53')]({},_0x4f64ee,_0xafac82[_0x9ab1('0x56')]);return db[_0x9ab1('0x65')]['count']({'where':_0x4f64ee[_0x9ab1('0x54')]})[_0x9ab1('0x24')](function(_0x3b54d7){_0x5d1984[_0x9ab1('0x33')]=_0x3b54d7;if(_0xafac82[_0x9ab1('0x49')][_0x9ab1('0x69')]){_0x4f64ee[_0x9ab1('0x58')]=[{'all':!![]}];}return db[_0x9ab1('0x65')]['findAll'](_0x4f64ee);})[_0x9ab1('0x24')](function(_0x51feda){_0x5d1984[_0x9ab1('0x6a')]=_0x51feda;return _0x5d1984;});}})[_0x9ab1('0x24')](respondWithFilteredResult(_0x1d4af3,_0x4f64ee))[_0x9ab1('0x2c')](handleError(_0x1d4af3,null));};exports[_0x9ab1('0x6b')]=function(_0x2b1a3b,_0x5569f6,_0x322102){return db['FaxAccount'][_0x9ab1('0x5b')]({'where':{'id':_0x2b1a3b[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5569f6,null))[_0x9ab1('0x24')](function(_0x52d7f7){if(_0x52d7f7){return _0x52d7f7['removeDispositions'](_0x2b1a3b[_0x9ab1('0x49')][_0x9ab1('0x6c')]);}})[_0x9ab1('0x24')](respondWithStatusCode(_0x5569f6,null))['catch'](handleError(_0x5569f6,null));};exports[_0x9ab1('0x6d')]=function(_0x5c30a7,_0x104583,_0x1d7e9f){if(_0x5c30a7['body']['id']){delete _0x5c30a7[_0x9ab1('0x61')]['id'];}return db[_0x9ab1('0x57')]['find']({'where':{'id':_0x5c30a7['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x104583,null))[_0x9ab1('0x24')](function(_0x5b4d45){if(_0x5b4d45){_0x5c30a7[_0x9ab1('0x61')]['FaxAccountId']=_0x5b4d45['id'];return db[_0x9ab1('0x6e')]['create'](_0x5c30a7[_0x9ab1('0x61')]);}})['then'](respondWithResult(_0x104583,null))[_0x9ab1('0x2c')](handleError(_0x104583,null));};exports[_0x9ab1('0x6f')]=function(_0x27828e,_0x3a4cda,_0x3c7641){var _0x5634c9={'raw':![],'where':{}};var _0x404f09={};var _0x125de2={'count':0x0,'rows':[]};return db[_0x9ab1('0x57')][_0x9ab1('0x66')]({'where':{'id':_0x27828e[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a4cda,null))['then'](function(_0x478ec4){if(_0x478ec4){_0x404f09[_0x9ab1('0x48')]=_[_0x9ab1('0x4a')](db['CannedAnswer'][_0x9ab1('0x44')]);_0x404f09[_0x9ab1('0x49')]=_['keys'](_0x27828e[_0x9ab1('0x49')]);_0x404f09[_0x9ab1('0x4b')]=_[_0x9ab1('0x4c')](_0x404f09['model'],_0x404f09['query']);_0x5634c9['attributes']=_[_0x9ab1('0x4c')](_0x404f09[_0x9ab1('0x48')],qs[_0x9ab1('0x4d')](_0x27828e['query'][_0x9ab1('0x4d')]));_0x5634c9[_0x9ab1('0x4e')]=_0x5634c9[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x5634c9['attributes']:_0x404f09[_0x9ab1('0x48')];if(!_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x50')]('nolimit')){_0x5634c9['limit']=qs['limit'](_0x27828e['query'][_0x9ab1('0x32')]);_0x5634c9[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x30')]);}_0x5634c9[_0x9ab1('0x67')]=qs[_0x9ab1('0x52')](_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x5634c9[_0x9ab1('0x54')]=qs[_0x9ab1('0x4b')](_[_0x9ab1('0x68')](_0x27828e[_0x9ab1('0x49')],_0x404f09[_0x9ab1('0x4b')]));_0x5634c9[_0x9ab1('0x54')]['FaxAccountId']=_0x478ec4['id'];if(_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x55')]){_0x5634c9['where']=_[_0x9ab1('0x53')](_0x5634c9['where'],{'$or':_[_0x9ab1('0x43')](_0x5634c9[_0x9ab1('0x4e')],function(_0x52a1a4){var _0x402359={};_0x402359[_0x52a1a4]={'$like':'%'+_0x27828e[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x402359;})});}_0x5634c9=_['merge']({},_0x5634c9,_0x27828e[_0x9ab1('0x56')]);return db[_0x9ab1('0x6e')][_0x9ab1('0x33')]({'where':_0x5634c9[_0x9ab1('0x54')]})['then'](function(_0x15ba0f){_0x125de2[_0x9ab1('0x33')]=_0x15ba0f;if(_0x27828e['query'][_0x9ab1('0x69')]){_0x5634c9[_0x9ab1('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9ab1('0x70')](_0x5634c9);})[_0x9ab1('0x24')](function(_0x1032d7){_0x125de2[_0x9ab1('0x6a')]=_0x1032d7;return _0x125de2;});}})['then'](respondWithFilteredResult(_0x3a4cda,_0x5634c9))[_0x9ab1('0x2c')](handleError(_0x3a4cda,null));};exports['removeAnswers']=function(_0x1ac036,_0x3eb65b,_0x4e42fe){return db[_0x9ab1('0x57')]['find']({'where':{'id':_0x1ac036[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3eb65b,null))[_0x9ab1('0x24')](function(_0x17b3e1){if(_0x17b3e1){return _0x17b3e1['removeAnswers'](_0x1ac036[_0x9ab1('0x49')][_0x9ab1('0x6c')]);}})[_0x9ab1('0x24')](respondWithStatusCode(_0x3eb65b,null))[_0x9ab1('0x2c')](handleError(_0x3eb65b,null));};exports[_0x9ab1('0x71')]=function(_0x42a69a,_0x4c27b7,_0x172d72){return db[_0x9ab1('0x72')][_0x9ab1('0x5b')]({'where':{'id':_0x42a69a['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x4c27b7,null))[_0x9ab1('0x24')](function(_0x444673){if(_0x444673){return _0x444673[_0x9ab1('0x71')](_0x42a69a['body'][_0x9ab1('0x6c')],_[_0x9ab1('0x73')](_0x42a69a[_0x9ab1('0x61')],[_0x9ab1('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x4c27b7,null))[_0x9ab1('0x2c')](handleError(_0x4c27b7,null));};exports['getInteractions']=function(_0x5d9e50,_0x5f0226,_0x509044){var _0x5159a3={'raw':![],'where':{}};var _0x487ee6={};var _0x5be674={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9ab1('0x66')]({'where':{'id':_0x5d9e50['params']['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x5f0226,null))[_0x9ab1('0x24')](function(_0x41db89){if(_0x41db89){_0x487ee6['model']=_['keys'](db[_0x9ab1('0x72')][_0x9ab1('0x44')]);_0x487ee6[_0x9ab1('0x49')]=_[_0x9ab1('0x4a')](_0x5d9e50[_0x9ab1('0x49')]);_0x487ee6[_0x9ab1('0x4b')]=_[_0x9ab1('0x4c')](_0x487ee6[_0x9ab1('0x48')],_0x487ee6['query']);_0x5159a3['attributes']=_[_0x9ab1('0x4c')](_0x487ee6[_0x9ab1('0x48')],qs[_0x9ab1('0x4d')](_0x5d9e50['query']['fields']));_0x5159a3[_0x9ab1('0x4e')]=_0x5159a3['attributes'][_0x9ab1('0x4f')]?_0x5159a3[_0x9ab1('0x4e')]:_0x487ee6[_0x9ab1('0x48')];if(!_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x50')]('nolimit')){_0x5159a3[_0x9ab1('0x32')]=qs['limit'](_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x5159a3[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x30')]);}_0x5159a3[_0x9ab1('0x67')]=qs[_0x9ab1('0x52')](_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x5159a3[_0x9ab1('0x54')]=qs[_0x9ab1('0x4b')](_['pick'](_0x5d9e50[_0x9ab1('0x49')],_0x487ee6['filters']));_0x5159a3['where'][_0x9ab1('0x64')]=_0x41db89['id'];if(_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x55')]){_0x5159a3['where']=_[_0x9ab1('0x53')](_0x5159a3['where'],{'$or':_[_0x9ab1('0x43')](_0x5159a3[_0x9ab1('0x4e')],function(_0x36995a){var _0x578cab={};_0x578cab[_0x36995a]={'$like':'%'+_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x578cab;})});}_0x5159a3=_[_0x9ab1('0x53')]({},_0x5159a3,_0x5d9e50['options']);return db['FaxInteraction'][_0x9ab1('0x33')]({'where':_0x5159a3[_0x9ab1('0x54')]})[_0x9ab1('0x24')](function(_0x5188da){_0x5be674[_0x9ab1('0x33')]=_0x5188da;if(_0x5d9e50['query'][_0x9ab1('0x69')]){_0x5159a3[_0x9ab1('0x58')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x9ab1('0x74')],'as':'Owner','attributes':[_0x9ab1('0x3e'),_0x9ab1('0x75'),_0x9ab1('0x76')],'required':![]},{'model':db[_0x9ab1('0x77')],'as':_0x9ab1('0x78'),'attributes':['id',_0x9ab1('0x3e'),_0x9ab1('0x79')],'where':_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x7a')]?{'id':_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x7a')]}:undefined,'required':_0x5d9e50[_0x9ab1('0x49')][_0x9ab1('0x7a')]?!![]:![]}];}return db[_0x9ab1('0x72')][_0x9ab1('0x70')](_0x5159a3);})[_0x9ab1('0x24')](function(_0x1895c0){_0x5be674[_0x9ab1('0x6a')]=_0x1895c0;return _0x5be674;});}})[_0x9ab1('0x24')](respondWithFilteredResult(_0x5f0226,_0x5159a3))['catch'](handleError(_0x5f0226,null));};exports['addApplications']=function(_0x3d98c1,_0x3d7aa4){var _0x1bfec4=_0x3d98c1[_0x9ab1('0x5a')]['id'];var _0x3f1f27=_0x3d98c1[_0x9ab1('0x61')];var _0x271332=0xc8;var _0x569d50=null;return db['sequelize'][_0x9ab1('0x7b')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x500841){return db[_0x9ab1('0x57')][_0x9ab1('0x66')]({'where':{'id':_0x1bfec4},'transaction':_0x500841})[_0x9ab1('0x24')](function(_0x543466){if(_0x543466){return db[_0x9ab1('0x7c')][_0x9ab1('0x3c')]({'where':{'FaxAccountId':_0x1bfec4},'transaction':_0x500841})['then'](function(){var _0x2aa457=_['map'](_0x3f1f27,function(_0x357a1d){_0x357a1d[_0x9ab1('0x64')]=_0x1bfec4;return _0x357a1d;});return db[_0x9ab1('0x7c')][_0x9ab1('0x7d')](_0x2aa457,{'transaction':_0x500841});});}else{_0x271332=0x194;_0x569d50=[];}});})[_0x9ab1('0x24')](function(){if(_0x271332!==0x194){return db[_0x9ab1('0x7c')][_0x9ab1('0x7e')]({'where':{'FaxAccountId':_0x1bfec4},'order':_0x9ab1('0x7f')})[_0x9ab1('0x24')](function(_0x445820){_0x569d50=_0x445820;});}})[_0x9ab1('0x2c')](function(_0x108dc8){_0x271332=0x1f4;logger[_0x9ab1('0x2a')](_0x108dc8[_0x9ab1('0x3d')]);if(_0x108dc8[_0x9ab1('0x3e')]){delete _0x108dc8[_0x9ab1('0x3e')];}_0x569d50=_0x108dc8;})['finally'](function(){if(_0x569d50===null){_0x3d7aa4[_0x9ab1('0x2d')](_0x271332);}else{if(_0x271332===0x1f4){_0x3d7aa4['status'](_0x271332)[_0x9ab1('0x3f')](_0x569d50);}else{_0x3d7aa4[_0x9ab1('0x2f')](_0x271332)[_0x9ab1('0x36')](_0x569d50);}}});};exports['getApplications']=function(_0x3ea506,_0x121154,_0x104b58){var _0x40a885={};var _0x4d8f95={};var _0x3b8d7e;var _0x418abc;return db['FaxAccount'][_0x9ab1('0x66')]({'where':{'id':_0x3ea506[_0x9ab1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x121154,null))[_0x9ab1('0x24')](function(_0x52072b){if(_0x52072b){_0x3b8d7e=_0x52072b;_0x4d8f95[_0x9ab1('0x48')]=_[_0x9ab1('0x4a')](db[_0x9ab1('0x7c')][_0x9ab1('0x44')]);_0x4d8f95['query']=_[_0x9ab1('0x4a')](_0x3ea506[_0x9ab1('0x49')]);_0x4d8f95[_0x9ab1('0x4b')]=_[_0x9ab1('0x4c')](_0x4d8f95[_0x9ab1('0x48')],_0x4d8f95[_0x9ab1('0x49')]);_0x40a885[_0x9ab1('0x4e')]=_[_0x9ab1('0x4c')](_0x4d8f95[_0x9ab1('0x48')],qs[_0x9ab1('0x4d')](_0x3ea506['query'][_0x9ab1('0x4d')]));_0x40a885[_0x9ab1('0x4e')]=_0x40a885[_0x9ab1('0x4e')]['length']?_0x40a885[_0x9ab1('0x4e')]:_0x4d8f95[_0x9ab1('0x48')];_0x40a885[_0x9ab1('0x67')]=qs[_0x9ab1('0x52')](_0x3ea506[_0x9ab1('0x49')]['sort']);_0x40a885[_0x9ab1('0x54')]=qs[_0x9ab1('0x4b')](_['pick'](_0x3ea506[_0x9ab1('0x49')],_0x4d8f95[_0x9ab1('0x4b')]));if(_0x3ea506[_0x9ab1('0x49')][_0x9ab1('0x55')]){_0x40a885[_0x9ab1('0x54')]=_[_0x9ab1('0x53')](_0x40a885['where'],{'$or':_['map'](_0x40a885[_0x9ab1('0x4e')],function(_0xb68a39){var _0x28df83={};_0x28df83[_0xb68a39]={'$like':'%'+_0x3ea506[_0x9ab1('0x49')]['filter']+'%'};return _0x28df83;})});}_0x40a885=_[_0x9ab1('0x53')]({},_0x40a885,_0x3ea506[_0x9ab1('0x56')]);return _0x3b8d7e[_0x9ab1('0x80')](_0x40a885);}})[_0x9ab1('0x24')](function(_0x8fcd9e){if(_0x8fcd9e){_0x418abc=_0x8fcd9e[_0x9ab1('0x4f')];if(!_0x3ea506[_0x9ab1('0x49')][_0x9ab1('0x50')](_0x9ab1('0x51'))){_0x40a885[_0x9ab1('0x32')]=qs[_0x9ab1('0x32')](_0x3ea506[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x40a885[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x3ea506[_0x9ab1('0x49')][_0x9ab1('0x30')]);}return _0x3b8d7e[_0x9ab1('0x80')](_0x40a885);}})['then'](function(_0x70619f){if(_0x70619f){return _0x70619f?{'count':_0x418abc,'rows':_0x70619f}:null;}})[_0x9ab1('0x24')](respondWithResult(_0x121154,null))[_0x9ab1('0x2c')](handleError(_0x121154,null));};function Extension(_0x4ac4d2,_0x34750b,_0x563cfc,_0x3ebb30){this['context']=_0x9ab1('0x81');this[_0x9ab1('0x82')]=_0x4ac4d2[_0x9ab1('0x83')];this[_0x9ab1('0x84')]=_0x3ebb30;this['type']=_0x9ab1('0x85');this[_0x9ab1('0x86')]=_0x9ab1('0x87');this[_0x9ab1('0x64')]=_0x4ac4d2['id'];this[_0x9ab1('0x7f')]=_0x34750b;this[_0x9ab1('0x88')]=_0x563cfc;}function createExtensionsReciveFax(_0x5a904d){var _0x3f133a=0x1;var _0x1e798c=[];_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,'','Answer'));_0x3f133a+=0x1;_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,_0x9ab1('0x8a'),_0x9ab1('0x8b')));_0x3f133a+=0x1;for(var _0x25415d in _0x5a904d){if(_0x5a904d[_0x9ab1('0x50')](_0x25415d)&&(_0x25415d===_0x9ab1('0x8c')||_0x25415d===_0x9ab1('0x83')||_0x25415d==='gateway'||_0x25415d==='faxdetect'||_0x25415d===_0x9ab1('0x8d')||_0x25415d===_0x9ab1('0x8e')||_0x25415d===_0x9ab1('0x8f')||_0x25415d===_0x9ab1('0x90')||_0x25415d===_0x9ab1('0x91'))){_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,_0x9ab1('0x92')+_0x25415d+')='+_0x5a904d[_0x25415d],_0x9ab1('0x8b')));_0x3f133a+=0x1;}}_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,'6',_0x9ab1('0x93')));_0x3f133a+=0x1;_0x1e798c[_0x9ab1('0x89')](new Extension(_0x5a904d,_0x3f133a,_0x9ab1('0x94'),'ReceiveFax'));_0x3f133a=0x0;return _0x1e798c;}exports['addAccountApplications']=function(_0x590400,_0x516c36,_0x46961e){var _0x24c969;return db[_0x9ab1('0x95')][_0x9ab1('0x7b')](function(_0x1a7cb4){return db[_0x9ab1('0x57')][_0x9ab1('0x5c')](_0x590400['body'],{'transaction':_0x1a7cb4})['then'](function(_0x9f30fd){_0x24c969=_0x9f30fd[_0x9ab1('0x39')]({'plain':!![]});return db[_0x9ab1('0x96')][_0x9ab1('0x7d')](createExtensionsReciveFax(_0x24c969),{'transaction':_0x1a7cb4});});})[_0x9ab1('0x24')](function(){return _0x24c969;})[_0x9ab1('0x24')](respondWithResult(_0x516c36,null))[_0x9ab1('0x2c')](handleError(_0x516c36,null));};exports[_0x9ab1('0x97')]=function(_0x3acce8,_0xdee5d3,_0x2383b){var _0x125e93;return db[_0x9ab1('0x95')]['transaction'](function(_0xcf0a8a){return db[_0x9ab1('0x57')][_0x9ab1('0x38')](_0x3acce8[_0x9ab1('0x61')],{'where':{'id':_0x3acce8[_0x9ab1('0x61')]['id']},'transaction':_0xcf0a8a})[_0x9ab1('0x24')](function(_0x219066){return db[_0x9ab1('0x96')][_0x9ab1('0x3c')]({'where':{'FaxAccountId':_0x3acce8[_0x9ab1('0x61')]['id']},'transaction':_0xcf0a8a})[_0x9ab1('0x24')](function(_0x378532){return db[_0x9ab1('0x96')][_0x9ab1('0x7d')](createExtensionsReciveFax(_[_0x9ab1('0x73')](_0x3acce8[_0x9ab1('0x61')],['tech',_0x9ab1('0x47'),'createdAt',_0x9ab1('0x98'),_0x9ab1('0x99'),'ListId'])),{'transaction':_0xcf0a8a});});});})['then'](function(){return db['FaxAccount']['findById'](_0x3acce8[_0x9ab1('0x61')]['id']);})[_0x9ab1('0x24')](respondWithResult(_0xdee5d3,null))[_0x9ab1('0x2c')](handleError(_0xdee5d3,null));};exports[_0x9ab1('0x9a')]=function(_0x74123d,_0x515e05,_0x3800b7){var _0x29dd5={'raw':!![],'where':{}};var _0x3c4c70={};var _0x3a9988={'count':0x0,'rows':[]};return db[_0x9ab1('0x57')]['findOne']({'where':{'id':_0x74123d[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x515e05,null))['then'](function(_0x596936){if(_0x596936){_0x3c4c70[_0x9ab1('0x48')]=_[_0x9ab1('0x4a')](db[_0x9ab1('0x9b')][_0x9ab1('0x44')]);_0x3c4c70[_0x9ab1('0x49')]=_[_0x9ab1('0x4a')](_0x74123d[_0x9ab1('0x49')]);_0x3c4c70['filters']=_['intersection'](_0x3c4c70[_0x9ab1('0x48')],_0x3c4c70[_0x9ab1('0x49')]);_0x29dd5[_0x9ab1('0x4e')]=_[_0x9ab1('0x4c')](_0x3c4c70[_0x9ab1('0x48')],qs['fields'](_0x74123d['query']['fields']));_0x29dd5[_0x9ab1('0x4e')]=_0x29dd5[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x29dd5[_0x9ab1('0x4e')]:_0x3c4c70['model'];if(!_0x74123d['query'][_0x9ab1('0x50')](_0x9ab1('0x51'))){_0x29dd5[_0x9ab1('0x32')]=qs[_0x9ab1('0x32')](_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x32')]);_0x29dd5[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x30')]);}_0x29dd5[_0x9ab1('0x67')]=qs['sort'](_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x29dd5['where']=qs[_0x9ab1('0x4b')](_[_0x9ab1('0x68')](_0x74123d[_0x9ab1('0x49')],_0x3c4c70[_0x9ab1('0x4b')]));_0x29dd5['where'][_0x9ab1('0x64')]=_0x596936['id'];if(_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x55')]){_0x29dd5[_0x9ab1('0x54')]=_[_0x9ab1('0x53')](_0x29dd5[_0x9ab1('0x54')],{'$or':_['map'](_0x29dd5[_0x9ab1('0x4e')],function(_0x68af70){var _0x502156={};_0x502156[_0x68af70]={'$like':'%'+_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x502156;})});}if(_0x74123d['query']['$gte']){var _0x1d834e=_0x74123d[_0x9ab1('0x49')]['$gte'][_0x9ab1('0x9c')](',');var _0x14c605={};_0x14c605[_0x1d834e[0x0]]={'$gte':moment(_0x1d834e[0x1])[_0x9ab1('0x9d')](_0x9ab1('0x9e'))};_0x29dd5[_0x9ab1('0x54')]=_['merge'](_0x29dd5['where'],_0x14c605);}_0x29dd5=_[_0x9ab1('0x53')]({},_0x29dd5,_0x74123d[_0x9ab1('0x56')]);return db[_0x9ab1('0x9b')][_0x9ab1('0x33')]({'where':_0x29dd5['where']})[_0x9ab1('0x24')](function(_0x27c6ce){_0x3a9988['count']=_0x27c6ce;if(_0x74123d[_0x9ab1('0x49')][_0x9ab1('0x69')]){_0x29dd5['include']=[{'all':!![]}];}return db[_0x9ab1('0x9b')][_0x9ab1('0x70')](_0x29dd5);})[_0x9ab1('0x24')](function(_0x577669){_0x3a9988[_0x9ab1('0x6a')]=_0x577669;return _0x3a9988;});}})['then'](respondWithFilteredResult(_0x515e05,_0x29dd5))[_0x9ab1('0x2c')](handleError(_0x515e05,null));};exports[_0x9ab1('0x3f')]=function(_0x1afb2c,_0x5492ee,_0x3455c9){var _0x1052f0,_0x10d266={},_0x2377bc;if(_0x1afb2c[_0x9ab1('0x61')]['to']){_0x2377bc=_0x1afb2c[_0x9ab1('0x61')]['to'][0x0];}return db['FaxAccount'][_0x9ab1('0x5b')]({'where':{'id':_0x1afb2c[_0x9ab1('0x5a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x9ab1('0x9f')],'as':_0x9ab1('0xa0'),'where':{'fax':_0x2377bc},'limit':0x1,'order':[[_0x9ab1('0x98'),_0x9ab1('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x5492ee,null))['then'](function(_0x3428d4){_0x1052f0=_0x3428d4;if(_0x1afb2c['body']['attachments']&&_0x1afb2c[_0x9ab1('0x61')]['attachments'][_0x9ab1('0x4f')]){for(var _0x1d8d4b=0x0;_0x1d8d4b<_0x1afb2c[_0x9ab1('0x61')]['attachments'][_0x9ab1('0x4f')];_0x1d8d4b+=0x1){_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][_0x1d8d4b]={'filename':_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][_0x1d8d4b][_0x9ab1('0x3e')],'id':_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][_0x1d8d4b]['id'],'path':path[_0x9ab1('0xa3')](config[_0x9ab1('0xa4')],_0x9ab1('0xa5'),_0x1afb2c['body'][_0x9ab1('0xa2')][_0x1d8d4b][_0x9ab1('0xa6')])};}}return respondWithRpcPromise(_0x9ab1('0xa7'),_0x9ab1('0xa7'),{'FaxAccountId':_[_0x9ab1('0xa8')](_0x1afb2c[_0x9ab1('0x5a')]['id'])?undefined:_0x1afb2c[_0x9ab1('0x5a')]['id'],'path':_['isNil'](_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xa9')])?undefined:_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xa9')],'fax':_[_0x9ab1('0xa8')](_0x1afb2c[_0x9ab1('0x61')]['to'][0x0])?undefined:_0x1afb2c['body']['to'][0x0]},client9002);})['then'](function(){if(_0x1052f0){if(_[_0x9ab1('0xa8')](_0x1afb2c['body'][_0x9ab1('0xaa')])){_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xaa')]=util[_0x9ab1('0x9d')]('\x22%s\x22\x20<%s>',_0x1052f0[_0x9ab1('0x3e')],_0x1052f0[_0x9ab1('0xab')]);}if(_0x1052f0[_0x9ab1('0xac')]){if(_0x1052f0[_0x9ab1('0xac')][_0x9ab1('0xa0')]['length']){return _0x1052f0['List'][_0x9ab1('0xa0')][0x0];}else{return db[_0x9ab1('0x9f')][_0x9ab1('0x5c')](_[_0x9ab1('0x1b')](_0x1afb2c['body'],{'firstName':_0x1afb2c[_0x9ab1('0x61')]['to'][0x0],'phone':_0x1afb2c[_0x9ab1('0x61')]['to'][0x0],'fax':_0x1afb2c[_0x9ab1('0x61')]['to'][0x0],'ListId':_0x1052f0[_0x9ab1('0xad')]}));}}else{throw new Error(_0x9ab1('0xae'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x9ab1('0x24')](function(_0x5b390c){if(_0x5b390c){return db['FaxInteraction']['find']({'where':{'ContactId':_0x5b390c['id'],'closed':![],'FaxAccountId':_0x1052f0['id']}})['then'](function(_0x5cbd9c){if(_0x5cbd9c){return[_0x5cbd9c,![]];}return db[_0x9ab1('0x72')][_0x9ab1('0x5c')]({'UserId':_0x1afb2c[_0x9ab1('0x5d')]['id'],'ContactId':_0x5b390c['id'],'FaxAccountId':_0x1052f0['id'],'fax':_0x1afb2c[_0x9ab1('0x61')]['to'][0x0],'firstMsgDirection':_0x9ab1('0xaf'),'Messages':[_['merge'](_0x1afb2c[_0x9ab1('0x61')],{'read':![],'body':_0x1afb2c[_0x9ab1('0x61')]['attachments'][0x0]['filename'],'FaxAccountId':_0x1052f0['id'],'UserId':_0x1afb2c[_0x9ab1('0x5d')]['id'],'ContactId':_0x5b390c['id'],'AttachmentId':_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0]['id']})]},{'include':[{'model':db[_0x9ab1('0x9b')],'as':_0x9ab1('0xb0')}]})[_0x9ab1('0x24')](function(_0x14b460){return[_0x14b460,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9ab1('0xb1')](function(_0x413424,_0x300980){if(_0x300980){return _0x413424;}return db[_0x9ab1('0x9b')][_0x9ab1('0x5c')]({'direction':'out','read':![],'body':_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xb2')],'FaxAccountId':_0x1052f0['id'],'FaxInteractionId':_0x413424['id'],'UserId':_0x1afb2c[_0x9ab1('0x5d')]['id'],'ContactId':_0x413424['ContactId'],'AttachmentId':_0x1afb2c[_0x9ab1('0x61')]['attachments'][0x0]['id']})[_0x9ab1('0x24')](function(_0x519c18){_0x413424[_0x9ab1('0xb3')][_0x9ab1('0xb0')]=[];_0x413424['dataValues'][_0x9ab1('0xb0')][_0x9ab1('0x89')](_0x519c18[_0x9ab1('0xb3')]);return _0x413424;});})['then'](function(_0x1ebe5a){respondWithRpcPromise('SendFax',_0x9ab1('0xb4'),{'FaxAccountId':_['isNil'](_0x1afb2c[_0x9ab1('0x5a')]['id'])?undefined:_0x1afb2c[_0x9ab1('0x5a')]['id'],'path':_[_0x9ab1('0xa8')](_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xa9')])?undefined:_0x1afb2c[_0x9ab1('0x61')][_0x9ab1('0xa2')][0x0][_0x9ab1('0xa9')],'fax':_[_0x9ab1('0xa8')](_0x1afb2c[_0x9ab1('0x61')]['to'][0x0])?undefined:_0x1afb2c['body']['to'][0x0],'AttachmentId':_0x1afb2c[_0x9ab1('0x61')]['attachments'][0x0]['id']},client9002)[_0x9ab1('0x24')](function(_0x14ca33){logger['info'](_0x9ab1('0xb5'),_0x14ca33);})[_0x9ab1('0x2c')](function(_0x1d126f){logger[_0x9ab1('0x25')](_0x9ab1('0xb5'),_0x1d126f);});return _0x1ebe5a;})[_0x9ab1('0x24')](respondWithResult(_0x5492ee,null))[_0x9ab1('0x2c')](handleError(_0x5492ee,null));};exports[_0x9ab1('0xb6')]=function(_0x5408ba,_0x4d9cba,_0x1bf0e9){return db['FaxAccount']['find']({'where':{'id':_0x5408ba[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x4d9cba,null))[_0x9ab1('0x24')](function(_0x3ff173){if(_0x3ff173){return _0x3ff173[_0x9ab1('0xb6')](_0x5408ba['body'][_0x9ab1('0x6c')],_[_0x9ab1('0x73')](_0x5408ba[_0x9ab1('0x61')],[_0x9ab1('0x6c'),'id'])||{})[_0x9ab1('0xb1')](function(_0x58ec58){for(var _0xbf7972=0x0;_0xbf7972<_0x5408ba[_0x9ab1('0x61')][_0x9ab1('0x6c')][_0x9ab1('0x4f')];_0xbf7972+=0x1){socket[_0x9ab1('0xb7')](_0x9ab1('0xb8'),{'UserId':Number(_0x5408ba[_0x9ab1('0x61')][_0x9ab1('0x6c')][_0xbf7972]),'FaxAccountId':Number(_0x5408ba[_0x9ab1('0x5a')]['id'])});}return _0x58ec58;});}})[_0x9ab1('0x24')](respondWithResult(_0x4d9cba,null))[_0x9ab1('0x2c')](handleError(_0x4d9cba,null));};exports[_0x9ab1('0xb9')]=function(_0x223739,_0x3b8e84,_0x2cf7ad){return db['FaxAccount'][_0x9ab1('0x5b')]({'where':{'id':_0x223739[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x3b8e84,null))[_0x9ab1('0x24')](function(_0x5be989){if(_0x5be989){return _0x5be989[_0x9ab1('0xb9')](_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')])[_0x9ab1('0x24')](function(){if(_[_0x9ab1('0xba')](_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')])){for(var _0x13a45d=0x0;_0x13a45d<_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')][_0x9ab1('0x4f')];_0x13a45d+=0x1){socket[_0x9ab1('0xb7')](_0x9ab1('0xbb'),{'UserId':Number(_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')][_0x13a45d]),'FaxAccountId':Number(_0x223739['params']['id'])});}}else{socket['emit'](_0x9ab1('0xbb'),{'UserId':Number(_0x223739[_0x9ab1('0x49')][_0x9ab1('0x6c')]),'FaxAccountId':Number(_0x223739[_0x9ab1('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b8e84,null))[_0x9ab1('0x2c')](handleError(_0x3b8e84,null));};exports[_0x9ab1('0xbc')]=function(_0x4daba9,_0x1d170f,_0x2724ec){var _0x513f6b={};var _0x47be42={};var _0x4bc5af;var _0x2aa4f1;return db[_0x9ab1('0x57')][_0x9ab1('0x66')]({'where':{'id':_0x4daba9[_0x9ab1('0x5a')]['id']}})[_0x9ab1('0x24')](handleEntityNotFound(_0x1d170f,null))[_0x9ab1('0x24')](function(_0x13c03b){if(_0x13c03b){_0x4bc5af=_0x13c03b;_0x47be42[_0x9ab1('0x48')]=_[_0x9ab1('0x4a')](db['User'][_0x9ab1('0x44')]);_0x47be42[_0x9ab1('0x49')]=_['keys'](_0x4daba9[_0x9ab1('0x49')]);_0x47be42[_0x9ab1('0x4b')]=_[_0x9ab1('0x4c')](_0x47be42['model'],_0x47be42['query']);_0x513f6b[_0x9ab1('0x4e')]=_['intersection'](_0x47be42[_0x9ab1('0x48')],qs['fields'](_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x4d')]));_0x513f6b['attributes']=_0x513f6b[_0x9ab1('0x4e')][_0x9ab1('0x4f')]?_0x513f6b[_0x9ab1('0x4e')]:_0x47be42[_0x9ab1('0x48')];_0x513f6b['order']=qs[_0x9ab1('0x52')](_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x52')]);_0x513f6b[_0x9ab1('0x54')]=qs['filters'](_[_0x9ab1('0x68')](_0x4daba9[_0x9ab1('0x49')],_0x47be42[_0x9ab1('0x4b')]));if(_0x4daba9['query']['filter']){_0x513f6b[_0x9ab1('0x54')]=_['merge'](_0x513f6b[_0x9ab1('0x54')],{'$or':_[_0x9ab1('0x43')](_0x513f6b[_0x9ab1('0x4e')],function(_0x12dc8e){var _0x3c24fa={};_0x3c24fa[_0x12dc8e]={'$like':'%'+_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x55')]+'%'};return _0x3c24fa;})});}_0x513f6b=_[_0x9ab1('0x53')]({},_0x513f6b,_0x4daba9[_0x9ab1('0x56')]);return _0x4bc5af[_0x9ab1('0xbc')](_0x513f6b);}})[_0x9ab1('0x24')](function(_0x4d8863){if(_0x4d8863){_0x2aa4f1=_0x4d8863[_0x9ab1('0x4f')];if(!_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x50')](_0x9ab1('0x51'))){_0x513f6b[_0x9ab1('0x32')]=qs['limit'](_0x4daba9[_0x9ab1('0x49')]['limit']);_0x513f6b[_0x9ab1('0x30')]=qs[_0x9ab1('0x30')](_0x4daba9[_0x9ab1('0x49')][_0x9ab1('0x30')]);}return _0x4bc5af[_0x9ab1('0xbc')](_0x513f6b);}})[_0x9ab1('0x24')](function(_0x4bbde7){if(_0x4bbde7){return _0x4bbde7?{'count':_0x2aa4f1,'rows':_0x4bbde7}:null;}})['then'](respondWithResult(_0x1d170f,null))[_0x9ab1('0x2c')](handleError(_0x1d170f,null));}; \ No newline at end of file +var _0x3628=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','findAll','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','send','getApplications','context','localstationid','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','FaxAccount','fieldName','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','Pause','rawAttributes','length','options','find','create'];(function(_0x5e4ecd,_0x54f6e3){var _0x2b2c16=function(_0x4e6e92){while(--_0x4e6e92){_0x5e4ecd['push'](_0x5e4ecd['shift']());}};_0x2b2c16(++_0x54f6e3);}(_0x3628,0x134));var _0x8362=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x3628[_0xf34109];return _0x570bfc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8362('0x0'));var zipdir=require(_0x8362('0x1'));var jsonpatch=require(_0x8362('0x2'));var rp=require(_0x8362('0x3'));var moment=require(_0x8362('0x4'));var BPromise=require(_0x8362('0x5'));var Mustache=require(_0x8362('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8362('0x7'));var csv=require(_0x8362('0x8'));var ejs=require(_0x8362('0x9'));var fs=require('fs');var fs_extra=require(_0x8362('0xa'));var _=require('lodash');var squel=require(_0x8362('0xb'));var crypto=require(_0x8362('0xc'));var jsforce=require(_0x8362('0xd'));var deskjs=require(_0x8362('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8362('0xf'));var Papa=require(_0x8362('0x10'));var Redis=require(_0x8362('0x11'));var authService=require(_0x8362('0x12'));var qs=require(_0x8362('0x13'));var as=require(_0x8362('0x14'));var hardwareService=require(_0x8362('0x15'));var logger=require(_0x8362('0x16'))(_0x8362('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8362('0x18'));var db=require('../../mysqldb')['db'];config[_0x8362('0x19')]=_[_0x8362('0x1a')](config[_0x8362('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x8362('0x1b'))(new Redis(config[_0x8362('0x19')]));require('./faxAccount.socket')[_0x8362('0x1c')](socket);var jayson=require(_0x8362('0x1d'));var client=jayson[_0x8362('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x8362('0x1e')][_0x8362('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xbc5b1e,_0x1abe0f,_0x1f8200,_0x36e853){return new BPromise(function(_0x23f8e7,_0x55a56e){var _0x12f038=_0x36e853||client;return _0x12f038['request'](_0xbc5b1e,_0x1f8200)[_0x8362('0x20')](function(_0x2530ab){logger[_0x8362('0x21')](_0x8362('0x22'),_0x1abe0f,_0x8362('0x23'));logger[_0x8362('0x24')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1abe0f,'request\x20sent',JSON['stringify'](_0x2530ab));if(_0x2530ab[_0x8362('0x25')]){if(_0x2530ab[_0x8362('0x25')]['code']===0x1f4){logger[_0x8362('0x25')](_0x8362('0x22'),_0x1abe0f,_0x2530ab[_0x8362('0x25')][_0x8362('0x26')]);return _0x55a56e(_0x2530ab[_0x8362('0x25')]['message']);}logger[_0x8362('0x25')](_0x8362('0x22'),_0x1abe0f,_0x2530ab[_0x8362('0x25')][_0x8362('0x26')]);return _0x23f8e7(_0x2530ab[_0x8362('0x25')][_0x8362('0x26')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1abe0f,'request\x20sent');_0x23f8e7(_0x2530ab[_0x8362('0x27')][_0x8362('0x26')]);}})[_0x8362('0x28')](function(_0xedc19a){logger[_0x8362('0x25')](_0x8362('0x22'),_0x1abe0f,_0xedc19a);_0x55a56e(_0xedc19a);});});}function respondWithStatusCode(_0x46e0a3,_0x214845){_0x214845=_0x214845||0xcc;return function(_0x2a3220){if(_0x2a3220){return _0x46e0a3[_0x8362('0x29')](_0x214845);}return _0x46e0a3[_0x8362('0x2a')](_0x214845)[_0x8362('0x2b')]();};}function respondWithResult(_0x457774,_0x1e76c6){_0x1e76c6=_0x1e76c6||0xc8;return function(_0x36741c){if(_0x36741c){return _0x457774[_0x8362('0x2a')](_0x1e76c6)[_0x8362('0x2c')](_0x36741c);}};}function respondWithFilteredResult(_0x473085,_0x50e731){return function(_0x3d965e){if(_0x3d965e){var _0x18d7a5=typeof _0x50e731['offset']===_0x8362('0x2d')&&typeof _0x50e731['limit']===_0x8362('0x2d');var _0x45fc75=_0x3d965e[_0x8362('0x2e')];var _0x5640b7=_0x18d7a5?0x0:_0x50e731[_0x8362('0x2f')];var _0x2786b4=_0x18d7a5?_0x3d965e[_0x8362('0x2e')]:_0x50e731[_0x8362('0x2f')]+_0x50e731[_0x8362('0x30')];var _0x1c7582;if(_0x2786b4>=_0x45fc75){_0x2786b4=_0x45fc75;_0x1c7582=0xc8;}else{_0x1c7582=0xce;}_0x473085[_0x8362('0x2a')](_0x1c7582);return _0x473085[_0x8362('0x31')](_0x8362('0x32'),_0x5640b7+'-'+_0x2786b4+'/'+_0x45fc75)[_0x8362('0x2c')](_0x3d965e);}return null;};}function patchUpdates(_0x4741f4){return function(_0x35fd6d){try{jsonpatch['apply'](_0x35fd6d,_0x4741f4,!![]);}catch(_0x1a02a5){return BPromise[_0x8362('0x33')](_0x1a02a5);}return _0x35fd6d[_0x8362('0x34')]();};}function saveUpdates(_0x93c0b,_0x4ba2eb){return function(_0x238646){if(_0x238646){return _0x238646[_0x8362('0x35')](_0x93c0b)[_0x8362('0x20')](function(_0x440fc6){return _0x440fc6;});}return null;};}function removeEntity(_0x18b303,_0x406258){return function(_0x5cb549){if(_0x5cb549){return _0x5cb549[_0x8362('0x36')]()[_0x8362('0x20')](function(){var _0x5267e0=_0x5cb549[_0x8362('0x37')]({'plain':!![]});var _0xcb8898=_0x8362('0x38');return db[_0x8362('0x39')][_0x8362('0x36')]({'where':{'type':_0xcb8898,'resourceId':_0x5267e0['id']}})[_0x8362('0x20')](function(){return _0x5cb549;});})[_0x8362('0x20')](function(){_0x18b303['status'](0xcc)[_0x8362('0x2b')]();});}};}function handleEntityNotFound(_0x5575da,_0x56b484){return function(_0x2e598c){if(!_0x2e598c){_0x5575da[_0x8362('0x29')](0x194);}return _0x2e598c;};}function handleError(_0x41f551,_0x51160f){_0x51160f=_0x51160f||0x1f4;return function(_0x1d5315){logger[_0x8362('0x25')](_0x1d5315[_0x8362('0x3a')]);if(_0x1d5315[_0x8362('0x3b')]){delete _0x1d5315[_0x8362('0x3b')];}_0x41f551[_0x8362('0x2a')](_0x51160f)['send'](_0x1d5315);};}exports[_0x8362('0x3c')]=function(_0x4d0341,_0xba130d){var _0x1df8f9={'include':[{'model':db['Pause'],'as':_0x8362('0x3d')}]},_0x221e90={},_0x1dcf06={'count':0x0,'rows':[]};var _0x648fb6=_[_0x8362('0x3e')](db[_0x8362('0x3f')]['rawAttributes'],function(_0x5c2c6a){return{'name':_0x5c2c6a[_0x8362('0x40')],'type':_0x5c2c6a['type']['key']};});_0x221e90['model']=_[_0x8362('0x3e')](_0x648fb6,_0x8362('0x3b'));_0x221e90[_0x8362('0x41')]=_[_0x8362('0x42')](_0x4d0341[_0x8362('0x41')]);_0x221e90[_0x8362('0x43')]=_[_0x8362('0x44')](_0x221e90[_0x8362('0x45')],_0x221e90[_0x8362('0x41')]);_0x1df8f9['attributes']=_[_0x8362('0x44')](_0x221e90[_0x8362('0x45')],qs[_0x8362('0x46')](_0x4d0341[_0x8362('0x41')][_0x8362('0x46')]));_0x1df8f9['attributes']=_0x1df8f9[_0x8362('0x47')]['length']?_0x1df8f9[_0x8362('0x47')]:_0x221e90[_0x8362('0x45')];if(!_0x4d0341[_0x8362('0x41')][_0x8362('0x48')]('nolimit')){_0x1df8f9[_0x8362('0x30')]=qs['limit'](_0x4d0341[_0x8362('0x41')][_0x8362('0x30')]);_0x1df8f9[_0x8362('0x2f')]=qs[_0x8362('0x2f')](_0x4d0341['query']['offset']);}_0x1df8f9[_0x8362('0x49')]=qs['sort'](_0x4d0341[_0x8362('0x41')][_0x8362('0x4a')]);_0x1df8f9[_0x8362('0x4b')]=qs[_0x8362('0x43')](_[_0x8362('0x4c')](_0x4d0341[_0x8362('0x41')],_0x221e90['filters']),_0x648fb6);if(_0x4d0341[_0x8362('0x41')][_0x8362('0x4d')]){_0x1df8f9[_0x8362('0x4b')]=_[_0x8362('0x4e')](_0x1df8f9[_0x8362('0x4b')],{'$or':_[_0x8362('0x3e')](_0x648fb6,function(_0x20f5e5){if(_0x20f5e5['type']!==_0x8362('0x4f')){var _0x591226={};_0x591226[_0x20f5e5['name']]={'$like':'%'+_0x4d0341['query'][_0x8362('0x4d')]+'%'};return _0x591226;}})});}_0x1df8f9=_[_0x8362('0x4e')]({},_0x1df8f9,_0x4d0341['options']);var _0x2ed965={'where':_0x1df8f9['where']};return db['FaxAccount'][_0x8362('0x2e')](_0x2ed965)['then'](function(_0x503004){_0x1dcf06[_0x8362('0x2e')]=_0x503004;if(_0x4d0341[_0x8362('0x41')][_0x8362('0x50')]){_0x1df8f9['include']=[{'all':!![]}];}return db[_0x8362('0x3f')]['findAll'](_0x1df8f9);})[_0x8362('0x20')](function(_0x17bcc4){_0x1dcf06[_0x8362('0x51')]=_0x17bcc4;return _0x1dcf06;})[_0x8362('0x20')](respondWithFilteredResult(_0xba130d,_0x1df8f9))[_0x8362('0x28')](handleError(_0xba130d,null));};exports[_0x8362('0x52')]=function(_0x316918,_0x6b59c7){var _0x17115d={'raw':![],'where':{'id':_0x316918[_0x8362('0x53')]['id']},'include':[{'model':db[_0x8362('0x54')],'as':_0x8362('0x3d')}]},_0x39768b={};_0x39768b[_0x8362('0x45')]=_[_0x8362('0x42')](db[_0x8362('0x3f')][_0x8362('0x55')]);_0x39768b[_0x8362('0x41')]=_['keys'](_0x316918[_0x8362('0x41')]);_0x39768b[_0x8362('0x43')]=_[_0x8362('0x44')](_0x39768b[_0x8362('0x45')],_0x39768b[_0x8362('0x41')]);_0x17115d['attributes']=_['intersection'](_0x39768b[_0x8362('0x45')],qs[_0x8362('0x46')](_0x316918[_0x8362('0x41')][_0x8362('0x46')]));_0x17115d[_0x8362('0x47')]=_0x17115d[_0x8362('0x47')][_0x8362('0x56')]?_0x17115d[_0x8362('0x47')]:_0x39768b[_0x8362('0x45')];if(_0x316918['query'][_0x8362('0x50')]){_0x17115d['include']=[{'all':!![]}];}_0x17115d=_[_0x8362('0x4e')]({},_0x17115d,_0x316918[_0x8362('0x57')]);return db[_0x8362('0x3f')][_0x8362('0x58')](_0x17115d)[_0x8362('0x20')](handleEntityNotFound(_0x6b59c7,null))['then'](respondWithResult(_0x6b59c7,null))[_0x8362('0x28')](handleError(_0x6b59c7,null));};exports[_0x8362('0x59')]=function(_0xccb469,_0x8600e5){return db[_0x8362('0x3f')]['create'](_0xccb469['body'],{})[_0x8362('0x20')](function(_0x260629){var _0x57fbff=_0xccb469[_0x8362('0x5a')][_0x8362('0x37')]({'plain':!![]});if(!_0x57fbff)throw new Error(_0x8362('0x5b'));if(_0x57fbff[_0x8362('0x5c')]===_0x8362('0x5a')){var _0x472021=_0x260629[_0x8362('0x37')]({'plain':!![]});var _0xd866d=_0x8362('0x38');return db[_0x8362('0x5d')][_0x8362('0x58')]({'where':{'name':_0xd866d,'userProfileId':_0x57fbff[_0x8362('0x5e')]},'raw':!![]})[_0x8362('0x20')](function(_0x4657f6){if(_0x4657f6&&_0x4657f6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x472021[_0x8362('0x3b')],'resourceId':_0x472021['id'],'type':_0x4657f6[_0x8362('0x3b')],'sectionId':_0x4657f6['id']},{})[_0x8362('0x20')](function(){return _0x260629;});}else{return _0x260629;}})[_0x8362('0x28')](function(_0x2c4640){logger['error'](_0x8362('0x5f'),_0x2c4640);throw _0x2c4640;});}return _0x260629;})[_0x8362('0x20')](respondWithResult(_0x8600e5,0xc9))['catch'](handleError(_0x8600e5,null));};exports[_0x8362('0x35')]=function(_0x14022a,_0x18cb22){if(_0x14022a[_0x8362('0x60')]['id']){delete _0x14022a[_0x8362('0x60')]['id'];}return db[_0x8362('0x3f')][_0x8362('0x58')]({'where':{'id':_0x14022a[_0x8362('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x8362('0x3d')}]})[_0x8362('0x20')](handleEntityNotFound(_0x18cb22,null))[_0x8362('0x20')](saveUpdates(_0x14022a[_0x8362('0x60')],null))[_0x8362('0x20')](respondWithResult(_0x18cb22,null))[_0x8362('0x28')](handleError(_0x18cb22,null));};exports[_0x8362('0x36')]=function(_0x16b0a1,_0x5c5c64){return db[_0x8362('0x3f')]['find']({'where':{'id':_0x16b0a1['params']['id']}})['then'](handleEntityNotFound(_0x5c5c64,null))[_0x8362('0x20')](removeEntity(_0x5c5c64,null))[_0x8362('0x28')](handleError(_0x5c5c64,null));};exports[_0x8362('0x61')]=function(_0x28ba1a,_0x55ef43){return db[_0x8362('0x3f')][_0x8362('0x61')]()['then'](respondWithResult(_0x55ef43,null))[_0x8362('0x28')](handleError(_0x55ef43,null));};exports[_0x8362('0x62')]=function(_0x1a0f1f,_0x550eae,_0x5dfd5b){if(_0x1a0f1f[_0x8362('0x60')]['id']){delete _0x1a0f1f[_0x8362('0x60')]['id'];}return db[_0x8362('0x3f')][_0x8362('0x58')]({'where':{'id':_0x1a0f1f[_0x8362('0x53')]['id']}})['then'](handleEntityNotFound(_0x550eae,null))[_0x8362('0x20')](function(_0x495c48){if(_0x495c48){_0x1a0f1f[_0x8362('0x60')][_0x8362('0x63')]=_0x495c48['id'];return db['Disposition'][_0x8362('0x59')](_0x1a0f1f['body']);}})['then'](respondWithResult(_0x550eae,null))[_0x8362('0x28')](handleError(_0x550eae,null));};exports[_0x8362('0x64')]=function(_0x3972ae,_0x30e98a,_0x1cf582){var _0x54a362={'raw':![],'where':{}};var _0x1fbda9={};var _0x163cda={'count':0x0,'rows':[]};return db[_0x8362('0x3f')][_0x8362('0x65')]({'where':{'id':_0x3972ae[_0x8362('0x53')]['id']}})[_0x8362('0x20')](handleEntityNotFound(_0x30e98a,null))[_0x8362('0x20')](function(_0x2d7d21){if(_0x2d7d21){_0x1fbda9[_0x8362('0x45')]=_['keys'](db[_0x8362('0x66')][_0x8362('0x55')]);_0x1fbda9[_0x8362('0x41')]=_[_0x8362('0x42')](_0x3972ae[_0x8362('0x41')]);_0x1fbda9[_0x8362('0x43')]=_[_0x8362('0x44')](_0x1fbda9[_0x8362('0x45')],_0x1fbda9[_0x8362('0x41')]);_0x54a362[_0x8362('0x47')]=_['intersection'](_0x1fbda9[_0x8362('0x45')],qs['fields'](_0x3972ae[_0x8362('0x41')][_0x8362('0x46')]));_0x54a362['attributes']=_0x54a362[_0x8362('0x47')][_0x8362('0x56')]?_0x54a362[_0x8362('0x47')]:_0x1fbda9[_0x8362('0x45')];if(!_0x3972ae[_0x8362('0x41')][_0x8362('0x48')](_0x8362('0x67'))){_0x54a362[_0x8362('0x30')]=qs[_0x8362('0x30')](_0x3972ae[_0x8362('0x41')][_0x8362('0x30')]);_0x54a362[_0x8362('0x2f')]=qs[_0x8362('0x2f')](_0x3972ae['query'][_0x8362('0x2f')]);}_0x54a362['order']=qs[_0x8362('0x4a')](_0x3972ae[_0x8362('0x41')][_0x8362('0x4a')]);_0x54a362[_0x8362('0x4b')]=qs[_0x8362('0x43')](_[_0x8362('0x4c')](_0x3972ae[_0x8362('0x41')],_0x1fbda9[_0x8362('0x43')]));_0x54a362[_0x8362('0x4b')][_0x8362('0x63')]=_0x2d7d21['id'];if(_0x3972ae[_0x8362('0x41')]['filter']){_0x54a362[_0x8362('0x4b')]=_[_0x8362('0x4e')](_0x54a362[_0x8362('0x4b')],{'$or':_[_0x8362('0x3e')](_0x54a362['attributes'],function(_0x1b3ab5){var _0x523279={};_0x523279[_0x1b3ab5]={'$like':'%'+_0x3972ae['query'][_0x8362('0x4d')]+'%'};return _0x523279;})});}_0x54a362=_[_0x8362('0x4e')]({},_0x54a362,_0x3972ae[_0x8362('0x57')]);return db[_0x8362('0x66')]['count']({'where':_0x54a362[_0x8362('0x4b')]})[_0x8362('0x20')](function(_0x4f9d32){_0x163cda[_0x8362('0x2e')]=_0x4f9d32;if(_0x3972ae['query']['includeAll']){_0x54a362['include']=[{'all':!![]}];}return db[_0x8362('0x66')]['findAll'](_0x54a362);})[_0x8362('0x20')](function(_0x53773d){_0x163cda[_0x8362('0x51')]=_0x53773d;return _0x163cda;});}})['then'](respondWithFilteredResult(_0x30e98a,_0x54a362))[_0x8362('0x28')](handleError(_0x30e98a,null));};exports[_0x8362('0x68')]=function(_0x19000f,_0x5b9e2c,_0x1333ed){return db[_0x8362('0x3f')]['find']({'where':{'id':_0x19000f['params']['id']}})[_0x8362('0x20')](handleEntityNotFound(_0x5b9e2c,null))[_0x8362('0x20')](function(_0x118cfd){if(_0x118cfd){return _0x118cfd[_0x8362('0x68')](_0x19000f['query'][_0x8362('0x69')]);}})[_0x8362('0x20')](respondWithStatusCode(_0x5b9e2c,null))[_0x8362('0x28')](handleError(_0x5b9e2c,null));};exports[_0x8362('0x6a')]=function(_0x582d26,_0x54f929,_0xdf228c){if(_0x582d26['body']['id']){delete _0x582d26['body']['id'];}return db[_0x8362('0x3f')][_0x8362('0x58')]({'where':{'id':_0x582d26[_0x8362('0x53')]['id']}})['then'](handleEntityNotFound(_0x54f929,null))[_0x8362('0x20')](function(_0x431cd2){if(_0x431cd2){_0x582d26[_0x8362('0x60')][_0x8362('0x63')]=_0x431cd2['id'];return db[_0x8362('0x6b')][_0x8362('0x59')](_0x582d26[_0x8362('0x60')]);}})['then'](respondWithResult(_0x54f929,null))['catch'](handleError(_0x54f929,null));};exports[_0x8362('0x6c')]=function(_0x4304f8,_0x533450,_0x4bdb3c){var _0x4f2a0a={'raw':![],'where':{}};var _0x4072bf={};var _0x5e7761={'count':0x0,'rows':[]};return db[_0x8362('0x3f')][_0x8362('0x65')]({'where':{'id':_0x4304f8['params']['id']}})['then'](handleEntityNotFound(_0x533450,null))[_0x8362('0x20')](function(_0x250e8d){if(_0x250e8d){_0x4072bf['model']=_[_0x8362('0x42')](db['CannedAnswer'][_0x8362('0x55')]);_0x4072bf['query']=_['keys'](_0x4304f8[_0x8362('0x41')]);_0x4072bf[_0x8362('0x43')]=_['intersection'](_0x4072bf[_0x8362('0x45')],_0x4072bf['query']);_0x4f2a0a[_0x8362('0x47')]=_[_0x8362('0x44')](_0x4072bf[_0x8362('0x45')],qs[_0x8362('0x46')](_0x4304f8['query']['fields']));_0x4f2a0a[_0x8362('0x47')]=_0x4f2a0a[_0x8362('0x47')]['length']?_0x4f2a0a[_0x8362('0x47')]:_0x4072bf[_0x8362('0x45')];if(!_0x4304f8[_0x8362('0x41')][_0x8362('0x48')](_0x8362('0x67'))){_0x4f2a0a['limit']=qs[_0x8362('0x30')](_0x4304f8['query']['limit']);_0x4f2a0a[_0x8362('0x2f')]=qs[_0x8362('0x2f')](_0x4304f8[_0x8362('0x41')][_0x8362('0x2f')]);}_0x4f2a0a[_0x8362('0x49')]=qs[_0x8362('0x4a')](_0x4304f8[_0x8362('0x41')][_0x8362('0x4a')]);_0x4f2a0a[_0x8362('0x4b')]=qs[_0x8362('0x43')](_[_0x8362('0x4c')](_0x4304f8[_0x8362('0x41')],_0x4072bf[_0x8362('0x43')]));_0x4f2a0a[_0x8362('0x4b')]['FaxAccountId']=_0x250e8d['id'];if(_0x4304f8[_0x8362('0x41')][_0x8362('0x4d')]){_0x4f2a0a['where']=_[_0x8362('0x4e')](_0x4f2a0a[_0x8362('0x4b')],{'$or':_[_0x8362('0x3e')](_0x4f2a0a[_0x8362('0x47')],function(_0x2ae34c){var _0x4e370e={};_0x4e370e[_0x2ae34c]={'$like':'%'+_0x4304f8[_0x8362('0x41')]['filter']+'%'};return _0x4e370e;})});}_0x4f2a0a=_[_0x8362('0x4e')]({},_0x4f2a0a,_0x4304f8['options']);return db[_0x8362('0x6b')][_0x8362('0x2e')]({'where':_0x4f2a0a[_0x8362('0x4b')]})[_0x8362('0x20')](function(_0x3dde90){_0x5e7761[_0x8362('0x2e')]=_0x3dde90;if(_0x4304f8['query'][_0x8362('0x50')]){_0x4f2a0a[_0x8362('0x6d')]=[{'all':!![]}];}return db[_0x8362('0x6b')]['findAll'](_0x4f2a0a);})[_0x8362('0x20')](function(_0x460098){_0x5e7761[_0x8362('0x51')]=_0x460098;return _0x5e7761;});}})[_0x8362('0x20')](respondWithFilteredResult(_0x533450,_0x4f2a0a))[_0x8362('0x28')](handleError(_0x533450,null));};exports[_0x8362('0x6e')]=function(_0x25cb6b,_0x46e1f7,_0x1172ec){return db[_0x8362('0x3f')][_0x8362('0x58')]({'where':{'id':_0x25cb6b['params']['id']}})['then'](handleEntityNotFound(_0x46e1f7,null))[_0x8362('0x20')](function(_0x4bcc71){if(_0x4bcc71){return _0x4bcc71[_0x8362('0x6e')](_0x25cb6b[_0x8362('0x41')][_0x8362('0x69')]);}})[_0x8362('0x20')](respondWithStatusCode(_0x46e1f7,null))[_0x8362('0x28')](handleError(_0x46e1f7,null));};exports[_0x8362('0x6f')]=function(_0x44b30b,_0x1c3c31,_0x5396cc){return db[_0x8362('0x70')][_0x8362('0x58')]({'where':{'id':_0x44b30b['params']['id']}})[_0x8362('0x20')](handleEntityNotFound(_0x1c3c31,null))[_0x8362('0x20')](function(_0x3057b4){if(_0x3057b4){return _0x3057b4[_0x8362('0x6f')](_0x44b30b['body'][_0x8362('0x69')],_[_0x8362('0x71')](_0x44b30b[_0x8362('0x60')],[_0x8362('0x69'),'id'])||{});}})[_0x8362('0x20')](respondWithResult(_0x1c3c31,null))[_0x8362('0x28')](handleError(_0x1c3c31,null));};exports[_0x8362('0x72')]=function(_0x44fb1b,_0x19a4f9,_0x3c2946){var _0x43c276={'raw':![],'where':{}};var _0x367b9d={};var _0x4fa3b4={'count':0x0,'rows':[]};return db[_0x8362('0x3f')][_0x8362('0x65')]({'where':{'id':_0x44fb1b[_0x8362('0x53')]['id']}})['then'](handleEntityNotFound(_0x19a4f9,null))['then'](function(_0x43cb5a){if(_0x43cb5a){_0x367b9d['model']=_[_0x8362('0x42')](db[_0x8362('0x70')][_0x8362('0x55')]);_0x367b9d[_0x8362('0x41')]=_[_0x8362('0x42')](_0x44fb1b[_0x8362('0x41')]);_0x367b9d[_0x8362('0x43')]=_[_0x8362('0x44')](_0x367b9d['model'],_0x367b9d['query']);_0x43c276[_0x8362('0x47')]=_[_0x8362('0x44')](_0x367b9d[_0x8362('0x45')],qs[_0x8362('0x46')](_0x44fb1b['query'][_0x8362('0x46')]));_0x43c276[_0x8362('0x47')]=_0x43c276['attributes'][_0x8362('0x56')]?_0x43c276['attributes']:_0x367b9d[_0x8362('0x45')];if(!_0x44fb1b[_0x8362('0x41')][_0x8362('0x48')]('nolimit')){_0x43c276[_0x8362('0x30')]=qs[_0x8362('0x30')](_0x44fb1b[_0x8362('0x41')][_0x8362('0x30')]);_0x43c276['offset']=qs['offset'](_0x44fb1b[_0x8362('0x41')]['offset']);}_0x43c276['order']=qs['sort'](_0x44fb1b[_0x8362('0x41')]['sort']);_0x43c276[_0x8362('0x4b')]=qs[_0x8362('0x43')](_['pick'](_0x44fb1b[_0x8362('0x41')],_0x367b9d[_0x8362('0x43')]));_0x43c276[_0x8362('0x4b')][_0x8362('0x63')]=_0x43cb5a['id'];if(_0x44fb1b['query'][_0x8362('0x4d')]){_0x43c276[_0x8362('0x4b')]=_[_0x8362('0x4e')](_0x43c276[_0x8362('0x4b')],{'$or':_[_0x8362('0x3e')](_0x43c276[_0x8362('0x47')],function(_0xcc1bb9){var _0x243e83={};_0x243e83[_0xcc1bb9]={'$like':'%'+_0x44fb1b['query'][_0x8362('0x4d')]+'%'};return _0x243e83;})});}_0x43c276=_[_0x8362('0x4e')]({},_0x43c276,_0x44fb1b[_0x8362('0x57')]);return db['FaxInteraction'][_0x8362('0x2e')]({'where':_0x43c276[_0x8362('0x4b')]})[_0x8362('0x20')](function(_0x55394e){_0x4fa3b4[_0x8362('0x2e')]=_0x55394e;if(_0x44fb1b[_0x8362('0x41')]['includeAll']){_0x43c276[_0x8362('0x6d')]=[{'model':db['CmContact'],'as':_0x8362('0x73'),'required':![]},{'model':db[_0x8362('0x74')],'as':_0x8362('0x75'),'attributes':[_0x8362('0x3b'),_0x8362('0x76'),_0x8362('0x77')],'required':![]},{'model':db['Tag'],'as':_0x8362('0x78'),'attributes':['id',_0x8362('0x3b'),_0x8362('0x79')],'where':_0x44fb1b[_0x8362('0x41')][_0x8362('0x7a')]?{'id':_0x44fb1b[_0x8362('0x41')]['tag']}:undefined,'required':_0x44fb1b['query'][_0x8362('0x7a')]?!![]:![]}];}return db[_0x8362('0x70')][_0x8362('0x7b')](_0x43c276);})[_0x8362('0x20')](function(_0x56b816){_0x4fa3b4[_0x8362('0x51')]=_0x56b816;return _0x4fa3b4;});}})[_0x8362('0x20')](respondWithFilteredResult(_0x19a4f9,_0x43c276))[_0x8362('0x28')](handleError(_0x19a4f9,null));};exports[_0x8362('0x7c')]=function(_0x5a9dfb,_0x2a4a94){var _0x206ffd=_0x5a9dfb[_0x8362('0x53')]['id'];var _0x2fa023=_0x5a9dfb[_0x8362('0x60')];var _0x5de2a0=0xc8;var _0x1ae6cf=null;return db['sequelize'][_0x8362('0x7d')]({'isolationLevel':db['sequelize'][_0x8362('0x7e')][_0x8362('0x7f')][_0x8362('0x80')]},function(_0x14d734){return db['FaxAccount']['findOne']({'where':{'id':_0x206ffd},'transaction':_0x14d734})[_0x8362('0x20')](function(_0x3387c8){if(_0x3387c8){return db[_0x8362('0x81')][_0x8362('0x36')]({'where':{'FaxAccountId':_0x206ffd},'transaction':_0x14d734})['then'](function(){var _0x23c769=_[_0x8362('0x3e')](_0x2fa023,function(_0x1e09ba){_0x1e09ba[_0x8362('0x63')]=_0x206ffd;return _0x1e09ba;});return db[_0x8362('0x81')][_0x8362('0x82')](_0x23c769,{'transaction':_0x14d734});});}else{_0x5de2a0=0x194;_0x1ae6cf=[];}});})['then'](function(){if(_0x5de2a0!==0x194){return db[_0x8362('0x81')][_0x8362('0x83')]({'where':{'FaxAccountId':_0x206ffd},'order':_0x8362('0x84')})[_0x8362('0x20')](function(_0x159482){_0x1ae6cf=_0x159482;});}})[_0x8362('0x28')](function(_0x38f888){_0x5de2a0=0x1f4;logger['error'](_0x38f888[_0x8362('0x3a')]);if(_0x38f888['name']){delete _0x38f888[_0x8362('0x3b')];}_0x1ae6cf=_0x38f888;})['finally'](function(){if(_0x1ae6cf===null){_0x2a4a94[_0x8362('0x29')](_0x5de2a0);}else{if(_0x5de2a0===0x1f4){_0x2a4a94['status'](_0x5de2a0)[_0x8362('0x85')](_0x1ae6cf);}else{_0x2a4a94[_0x8362('0x2a')](_0x5de2a0)[_0x8362('0x2c')](_0x1ae6cf);}}});};exports[_0x8362('0x86')]=function(_0x404351,_0x18f79e,_0x4eacef){var _0x215857={};var _0x47c478={};var _0x23e6ec;var _0x45e867;return db[_0x8362('0x3f')][_0x8362('0x65')]({'where':{'id':_0x404351[_0x8362('0x53')]['id']}})[_0x8362('0x20')](handleEntityNotFound(_0x18f79e,null))[_0x8362('0x20')](function(_0x4d0f05){if(_0x4d0f05){_0x23e6ec=_0x4d0f05;_0x47c478[_0x8362('0x45')]=_[_0x8362('0x42')](db[_0x8362('0x81')][_0x8362('0x55')]);_0x47c478[_0x8362('0x41')]=_[_0x8362('0x42')](_0x404351[_0x8362('0x41')]);_0x47c478['filters']=_[_0x8362('0x44')](_0x47c478[_0x8362('0x45')],_0x47c478[_0x8362('0x41')]);_0x215857[_0x8362('0x47')]=_['intersection'](_0x47c478['model'],qs[_0x8362('0x46')](_0x404351['query']['fields']));_0x215857[_0x8362('0x47')]=_0x215857['attributes'][_0x8362('0x56')]?_0x215857['attributes']:_0x47c478[_0x8362('0x45')];_0x215857[_0x8362('0x49')]=qs[_0x8362('0x4a')](_0x404351[_0x8362('0x41')]['sort']);_0x215857[_0x8362('0x4b')]=qs[_0x8362('0x43')](_[_0x8362('0x4c')](_0x404351[_0x8362('0x41')],_0x47c478[_0x8362('0x43')]));if(_0x404351[_0x8362('0x41')][_0x8362('0x4d')]){_0x215857['where']=_[_0x8362('0x4e')](_0x215857['where'],{'$or':_[_0x8362('0x3e')](_0x215857[_0x8362('0x47')],function(_0x439663){var _0x1b2c4b={};_0x1b2c4b[_0x439663]={'$like':'%'+_0x404351[_0x8362('0x41')][_0x8362('0x4d')]+'%'};return _0x1b2c4b;})});}_0x215857=_['merge']({},_0x215857,_0x404351[_0x8362('0x57')]);return _0x23e6ec['getApplications'](_0x215857);}})[_0x8362('0x20')](function(_0xf6a739){if(_0xf6a739){_0x45e867=_0xf6a739['length'];if(!_0x404351[_0x8362('0x41')][_0x8362('0x48')]('nolimit')){_0x215857['limit']=qs[_0x8362('0x30')](_0x404351['query'][_0x8362('0x30')]);_0x215857[_0x8362('0x2f')]=qs[_0x8362('0x2f')](_0x404351['query'][_0x8362('0x2f')]);}return _0x23e6ec[_0x8362('0x86')](_0x215857);}})[_0x8362('0x20')](function(_0x31dc4e){if(_0x31dc4e){return _0x31dc4e?{'count':_0x45e867,'rows':_0x31dc4e}:null;}})[_0x8362('0x20')](respondWithResult(_0x18f79e,null))['catch'](handleError(_0x18f79e,null));};function Extension(_0x27efc0,_0x3ec693,_0x155de5,_0x285107){this[_0x8362('0x87')]='from-voip-provider';this['exten']=_0x27efc0[_0x8362('0x88')];this[_0x8362('0x89')]=_0x285107;this['type']=_0x8362('0x8a');this[_0x8362('0x8b')]='Fax\x20Extension';this['FaxAccountId']=_0x27efc0['id'];this['priority']=_0x3ec693;this[_0x8362('0x8c')]=_0x155de5;}function createExtensionsReciveFax(_0x43f76b){var _0xb5bbf=0x1;var _0x13b0d2=[];_0x13b0d2[_0x8362('0x8d')](new Extension(_0x43f76b,_0xb5bbf,'',_0x8362('0x8e')));_0xb5bbf+=0x1;_0x13b0d2[_0x8362('0x8d')](new Extension(_0x43f76b,_0xb5bbf,_0x8362('0x8f'),_0x8362('0x90')));_0xb5bbf+=0x1;for(var _0x25b8df in _0x43f76b){if(_0x43f76b[_0x8362('0x48')](_0x25b8df)&&(_0x25b8df===_0x8362('0x91')||_0x25b8df===_0x8362('0x88')||_0x25b8df===_0x8362('0x92')||_0x25b8df===_0x8362('0x93')||_0x25b8df===_0x8362('0x94')||_0x25b8df===_0x8362('0x95')||_0x25b8df==='minrate'||_0x25b8df==='modem'||_0x25b8df===_0x8362('0x96'))){_0x13b0d2[_0x8362('0x8d')](new Extension(_0x43f76b,_0xb5bbf,_0x8362('0x97')+_0x25b8df+')='+_0x43f76b[_0x25b8df],_0x8362('0x90')));_0xb5bbf+=0x1;}}_0x13b0d2[_0x8362('0x8d')](new Extension(_0x43f76b,_0xb5bbf,'6',_0x8362('0x98')));_0xb5bbf+=0x1;_0x13b0d2['push'](new Extension(_0x43f76b,_0xb5bbf,_0x8362('0x99'),_0x8362('0x9a')));_0xb5bbf=0x0;return _0x13b0d2;}exports[_0x8362('0x9b')]=function(_0x30d1c0,_0x2f72fa,_0x36a856){var _0xa42f60;return db[_0x8362('0x9c')][_0x8362('0x7d')](function(_0x2e16f1){return db['FaxAccount'][_0x8362('0x59')](_0x30d1c0[_0x8362('0x60')],{'transaction':_0x2e16f1})[_0x8362('0x20')](function(_0x47fc1f){_0xa42f60=_0x47fc1f[_0x8362('0x37')]({'plain':!![]});return db[_0x8362('0x9d')][_0x8362('0x82')](createExtensionsReciveFax(_0xa42f60),{'transaction':_0x2e16f1});});})[_0x8362('0x20')](function(){return _0xa42f60;})[_0x8362('0x20')](respondWithResult(_0x2f72fa,null))[_0x8362('0x28')](handleError(_0x2f72fa,null));};exports[_0x8362('0x9e')]=function(_0x5a8cd6,_0x3a2a9e,_0x13e9e7){var _0x5fc1b9;return db[_0x8362('0x9c')][_0x8362('0x7d')](function(_0x1b3973){return db[_0x8362('0x3f')][_0x8362('0x35')](_0x5a8cd6[_0x8362('0x60')],{'where':{'id':_0x5a8cd6['body']['id']},'transaction':_0x1b3973})[_0x8362('0x20')](function(_0x519432){return db[_0x8362('0x9d')][_0x8362('0x36')]({'where':{'FaxAccountId':_0x5a8cd6[_0x8362('0x60')]['id']},'transaction':_0x1b3973})[_0x8362('0x20')](function(_0x176a73){return db[_0x8362('0x9d')][_0x8362('0x82')](createExtensionsReciveFax(_['omit'](_0x5a8cd6['body'],[_0x8362('0x9f'),'key',_0x8362('0xa0'),_0x8362('0xa1'),'TrunkId','ListId'])),{'transaction':_0x1b3973});});});})[_0x8362('0x20')](function(){return db[_0x8362('0x3f')][_0x8362('0xa2')](_0x5a8cd6[_0x8362('0x60')]['id']);})[_0x8362('0x20')](respondWithResult(_0x3a2a9e,null))[_0x8362('0x28')](handleError(_0x3a2a9e,null));};exports[_0x8362('0xa3')]=function(_0x4c76d6,_0x4eb727,_0x1af7cb){var _0xf14fb9={'raw':!![],'where':{}};var _0x57d859={};var _0x1d41ae={'count':0x0,'rows':[]};return db[_0x8362('0x3f')][_0x8362('0x65')]({'where':{'id':_0x4c76d6[_0x8362('0x53')]['id']}})[_0x8362('0x20')](handleEntityNotFound(_0x4eb727,null))[_0x8362('0x20')](function(_0x168ae1){if(_0x168ae1){_0x57d859[_0x8362('0x45')]=_[_0x8362('0x42')](db[_0x8362('0xa4')][_0x8362('0x55')]);_0x57d859[_0x8362('0x41')]=_[_0x8362('0x42')](_0x4c76d6[_0x8362('0x41')]);_0x57d859[_0x8362('0x43')]=_['intersection'](_0x57d859[_0x8362('0x45')],_0x57d859['query']);_0xf14fb9['attributes']=_[_0x8362('0x44')](_0x57d859['model'],qs[_0x8362('0x46')](_0x4c76d6[_0x8362('0x41')]['fields']));_0xf14fb9[_0x8362('0x47')]=_0xf14fb9[_0x8362('0x47')][_0x8362('0x56')]?_0xf14fb9[_0x8362('0x47')]:_0x57d859[_0x8362('0x45')];if(!_0x4c76d6[_0x8362('0x41')][_0x8362('0x48')](_0x8362('0x67'))){_0xf14fb9['limit']=qs['limit'](_0x4c76d6[_0x8362('0x41')][_0x8362('0x30')]);_0xf14fb9[_0x8362('0x2f')]=qs[_0x8362('0x2f')](_0x4c76d6[_0x8362('0x41')][_0x8362('0x2f')]);}_0xf14fb9[_0x8362('0x49')]=qs['sort'](_0x4c76d6[_0x8362('0x41')]['sort']);_0xf14fb9['where']=qs[_0x8362('0x43')](_['pick'](_0x4c76d6[_0x8362('0x41')],_0x57d859[_0x8362('0x43')]));_0xf14fb9['where']['FaxAccountId']=_0x168ae1['id'];if(_0x4c76d6[_0x8362('0x41')][_0x8362('0x4d')]){_0xf14fb9[_0x8362('0x4b')]=_[_0x8362('0x4e')](_0xf14fb9[_0x8362('0x4b')],{'$or':_[_0x8362('0x3e')](_0xf14fb9[_0x8362('0x47')],function(_0x2451bc){var _0x59edb0={};_0x59edb0[_0x2451bc]={'$like':'%'+_0x4c76d6[_0x8362('0x41')][_0x8362('0x4d')]+'%'};return _0x59edb0;})});}if(_0x4c76d6[_0x8362('0x41')][_0x8362('0xa5')]){var _0x5ddf2c=_0x4c76d6[_0x8362('0x41')][_0x8362('0xa5')][_0x8362('0xa6')](',');var _0x546434={};_0x546434[_0x5ddf2c[0x0]]={'$gte':moment(_0x5ddf2c[0x1])[_0x8362('0xa7')](_0x8362('0xa8'))};_0xf14fb9['where']=_[_0x8362('0x4e')](_0xf14fb9[_0x8362('0x4b')],_0x546434);}_0xf14fb9=_[_0x8362('0x4e')]({},_0xf14fb9,_0x4c76d6[_0x8362('0x57')]);return db[_0x8362('0xa4')]['count']({'where':_0xf14fb9['where']})[_0x8362('0x20')](function(_0x85fd60){_0x1d41ae[_0x8362('0x2e')]=_0x85fd60;if(_0x4c76d6[_0x8362('0x41')]['includeAll']){_0xf14fb9[_0x8362('0x6d')]=[{'all':!![]}];}return db[_0x8362('0xa4')]['findAll'](_0xf14fb9);})[_0x8362('0x20')](function(_0x1ad779){_0x1d41ae[_0x8362('0x51')]=_0x1ad779;return _0x1d41ae;});}})['then'](respondWithFilteredResult(_0x4eb727,_0xf14fb9))[_0x8362('0x28')](handleError(_0x4eb727,null));};exports[_0x8362('0x85')]=function(_0x394bb3,_0xffd773,_0xfdf13b){var _0x511252,_0x374a85={},_0x3d6880;if(_0x394bb3['body']['to']){_0x3d6880=_0x394bb3[_0x8362('0x60')]['to'][0x0];}return db[_0x8362('0x3f')]['find']({'where':{'id':_0x394bb3['params']['id']},'include':[{'model':db[_0x8362('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8362('0xaa'),'where':{'fax':_0x3d6880},'limit':0x1,'order':[['updatedAt',_0x8362('0xab')]]}]}]})[_0x8362('0x20')](handleEntityNotFound(_0xffd773,null))[_0x8362('0x20')](function(_0x1218f7){_0x511252=_0x1218f7;if(_0x394bb3[_0x8362('0x60')][_0x8362('0xac')]&&_0x394bb3[_0x8362('0x60')]['attachments'][_0x8362('0x56')]){for(var _0x40e251=0x0;_0x40e251<_0x394bb3[_0x8362('0x60')][_0x8362('0xac')][_0x8362('0x56')];_0x40e251+=0x1){_0x394bb3['body'][_0x8362('0xac')][_0x40e251]={'filename':_0x394bb3['body'][_0x8362('0xac')][_0x40e251][_0x8362('0x3b')],'id':_0x394bb3[_0x8362('0x60')][_0x8362('0xac')][_0x40e251]['id'],'path':path[_0x8362('0xad')](config[_0x8362('0xae')],_0x8362('0xaf'),_0x394bb3[_0x8362('0x60')]['attachments'][_0x40e251][_0x8362('0xb0')])};}}return respondWithRpcPromise(_0x8362('0xb1'),_0x8362('0xb1'),{'FaxAccountId':_[_0x8362('0xb2')](_0x394bb3[_0x8362('0x53')]['id'])?undefined:_0x394bb3[_0x8362('0x53')]['id'],'path':_['isNil'](_0x394bb3[_0x8362('0x60')][_0x8362('0xac')][0x0][_0x8362('0xb3')])?undefined:_0x394bb3['body']['attachments'][0x0][_0x8362('0xb3')],'fax':_[_0x8362('0xb2')](_0x394bb3[_0x8362('0x60')]['to'][0x0])?undefined:_0x394bb3['body']['to'][0x0]},client9002);})[_0x8362('0x20')](function(){if(_0x511252){if(_[_0x8362('0xb2')](_0x394bb3[_0x8362('0x60')][_0x8362('0xb4')])){_0x394bb3[_0x8362('0x60')][_0x8362('0xb4')]=util[_0x8362('0xa7')](_0x8362('0xb5'),_0x511252[_0x8362('0x3b')],_0x511252['fax']);}if(_0x511252[_0x8362('0xb6')]){if(_0x511252[_0x8362('0xb6')][_0x8362('0xaa')]['length']){return _0x511252[_0x8362('0xb6')][_0x8362('0xaa')][0x0];}else{return db['CmContact'][_0x8362('0x59')](_['defaults'](_0x394bb3[_0x8362('0x60')],{'firstName':_0x394bb3[_0x8362('0x60')]['to'][0x0],'phone':_0x394bb3[_0x8362('0x60')]['to'][0x0],'fax':_0x394bb3['body']['to'][0x0],'ListId':_0x511252['ListId']}));}}else{throw new Error(_0x8362('0xb7'));}}else{throw new Error(_0x8362('0xb8'));}})[_0x8362('0x20')](function(_0xbbac79){if(_0xbbac79){return db['FaxInteraction'][_0x8362('0x58')]({'where':{'ContactId':_0xbbac79['id'],'closed':![],'FaxAccountId':_0x511252['id']}})[_0x8362('0x20')](function(_0x401897){if(_0x401897){return[_0x401897,![]];}return db['FaxInteraction']['create']({'UserId':_0x394bb3[_0x8362('0x5a')]['id'],'ContactId':_0xbbac79['id'],'FaxAccountId':_0x511252['id'],'fax':_0x394bb3[_0x8362('0x60')]['to'][0x0],'firstMsgDirection':_0x8362('0xb9'),'Messages':[_['merge'](_0x394bb3[_0x8362('0x60')],{'read':![],'body':_0x394bb3['body'][_0x8362('0xac')][0x0]['filename'],'FaxAccountId':_0x511252['id'],'UserId':_0x394bb3[_0x8362('0x5a')]['id'],'ContactId':_0xbbac79['id'],'AttachmentId':_0x394bb3['body'][_0x8362('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x8362('0xa4')],'as':_0x8362('0xba')}]})['then'](function(_0x5450f3){return[_0x5450f3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8362('0xbb')](function(_0x1732bc,_0x58301a){if(_0x58301a){return _0x1732bc;}return db['FaxMessage'][_0x8362('0x59')]({'direction':'out','read':![],'body':_0x394bb3[_0x8362('0x60')][_0x8362('0xac')][0x0]['filename'],'FaxAccountId':_0x511252['id'],'FaxInteractionId':_0x1732bc['id'],'UserId':_0x394bb3[_0x8362('0x5a')]['id'],'ContactId':_0x1732bc[_0x8362('0xbc')],'AttachmentId':_0x394bb3['body']['attachments'][0x0]['id']})[_0x8362('0x20')](function(_0x69267c){_0x1732bc['dataValues']['Messages']=[];_0x1732bc['dataValues'][_0x8362('0xba')][_0x8362('0x8d')](_0x69267c[_0x8362('0xbd')]);return _0x1732bc;});})[_0x8362('0x20')](function(_0x321860){respondWithRpcPromise('SendFax',_0x8362('0xbe'),{'FaxAccountId':_['isNil'](_0x394bb3['params']['id'])?undefined:_0x394bb3['params']['id'],'path':_[_0x8362('0xb2')](_0x394bb3[_0x8362('0x60')]['attachments'][0x0][_0x8362('0xb3')])?undefined:_0x394bb3[_0x8362('0x60')]['attachments'][0x0][_0x8362('0xb3')],'fax':_[_0x8362('0xb2')](_0x394bb3[_0x8362('0x60')]['to'][0x0])?undefined:_0x394bb3[_0x8362('0x60')]['to'][0x0],'AttachmentId':_0x394bb3[_0x8362('0x60')][_0x8362('0xac')][0x0]['id']},client9002)[_0x8362('0x20')](function(_0x3e6c8b){logger[_0x8362('0x21')](_0x8362('0xbf'),_0x3e6c8b);})[_0x8362('0x28')](function(_0x7ff226){logger['info']('SendFaxRpc,\x20%s',_0x7ff226);});return _0x321860;})[_0x8362('0x20')](respondWithResult(_0xffd773,null))[_0x8362('0x28')](handleError(_0xffd773,null));};exports[_0x8362('0xc0')]=function(_0x43cacc,_0x28ab76,_0x5ecb6e){return db[_0x8362('0x3f')]['find']({'where':{'id':_0x43cacc[_0x8362('0x53')]['id']}})[_0x8362('0x20')](handleEntityNotFound(_0x28ab76,null))['then'](function(_0x4fe2bc){if(_0x4fe2bc){return _0x4fe2bc[_0x8362('0xc0')](_0x43cacc[_0x8362('0x60')][_0x8362('0x69')],_[_0x8362('0x71')](_0x43cacc[_0x8362('0x60')],[_0x8362('0x69'),'id'])||{})[_0x8362('0xbb')](function(_0x2bfe28){for(var _0x7703c7=0x0;_0x7703c7<_0x43cacc[_0x8362('0x60')]['ids'][_0x8362('0x56')];_0x7703c7+=0x1){socket[_0x8362('0xc1')](_0x8362('0xc2'),{'UserId':Number(_0x43cacc[_0x8362('0x60')]['ids'][_0x7703c7]),'FaxAccountId':Number(_0x43cacc[_0x8362('0x53')]['id'])});}return _0x2bfe28;});}})[_0x8362('0x20')](respondWithResult(_0x28ab76,null))['catch'](handleError(_0x28ab76,null));};exports[_0x8362('0xc3')]=function(_0x2e3e73,_0x38a5e0,_0x4fa198){return db[_0x8362('0x3f')][_0x8362('0x58')]({'where':{'id':_0x2e3e73[_0x8362('0x53')]['id']}})[_0x8362('0x20')](handleEntityNotFound(_0x38a5e0,null))[_0x8362('0x20')](function(_0x3b1ea5){if(_0x3b1ea5){return _0x3b1ea5[_0x8362('0xc3')](_0x2e3e73[_0x8362('0x41')][_0x8362('0x69')])['then'](function(){if(_[_0x8362('0xc4')](_0x2e3e73[_0x8362('0x41')]['ids'])){for(var _0x5e11a8=0x0;_0x5e11a8<_0x2e3e73['query'][_0x8362('0x69')]['length'];_0x5e11a8+=0x1){socket[_0x8362('0xc1')](_0x8362('0xc5'),{'UserId':Number(_0x2e3e73['query'][_0x8362('0x69')][_0x5e11a8]),'FaxAccountId':Number(_0x2e3e73[_0x8362('0x53')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x2e3e73['query'][_0x8362('0x69')]),'FaxAccountId':Number(_0x2e3e73['params']['id'])});}});}})[_0x8362('0x20')](respondWithStatusCode(_0x38a5e0,null))[_0x8362('0x28')](handleError(_0x38a5e0,null));};exports['getAgents']=function(_0x3d8709,_0x383e91,_0xbb44b3){var _0x35c62b={};var _0xc747e1={};var _0x17d58d;var _0x1dcb32;return db[_0x8362('0x3f')][_0x8362('0x65')]({'where':{'id':_0x3d8709[_0x8362('0x53')]['id']}})[_0x8362('0x20')](handleEntityNotFound(_0x383e91,null))[_0x8362('0x20')](function(_0x21741d){if(_0x21741d){_0x17d58d=_0x21741d;_0xc747e1[_0x8362('0x45')]=_['keys'](db['User'][_0x8362('0x55')]);_0xc747e1[_0x8362('0x41')]=_[_0x8362('0x42')](_0x3d8709['query']);_0xc747e1['filters']=_[_0x8362('0x44')](_0xc747e1[_0x8362('0x45')],_0xc747e1['query']);_0x35c62b[_0x8362('0x47')]=_['intersection'](_0xc747e1[_0x8362('0x45')],qs[_0x8362('0x46')](_0x3d8709[_0x8362('0x41')][_0x8362('0x46')]));_0x35c62b[_0x8362('0x47')]=_0x35c62b[_0x8362('0x47')][_0x8362('0x56')]?_0x35c62b[_0x8362('0x47')]:_0xc747e1['model'];_0x35c62b[_0x8362('0x49')]=qs[_0x8362('0x4a')](_0x3d8709[_0x8362('0x41')][_0x8362('0x4a')]);_0x35c62b['where']=qs['filters'](_[_0x8362('0x4c')](_0x3d8709[_0x8362('0x41')],_0xc747e1[_0x8362('0x43')]));if(_0x3d8709[_0x8362('0x41')][_0x8362('0x4d')]){_0x35c62b[_0x8362('0x4b')]=_[_0x8362('0x4e')](_0x35c62b[_0x8362('0x4b')],{'$or':_[_0x8362('0x3e')](_0x35c62b[_0x8362('0x47')],function(_0x4d6e56){var _0x4b0579={};_0x4b0579[_0x4d6e56]={'$like':'%'+_0x3d8709['query'][_0x8362('0x4d')]+'%'};return _0x4b0579;})});}_0x35c62b=_['merge']({},_0x35c62b,_0x3d8709[_0x8362('0x57')]);return _0x17d58d[_0x8362('0xc6')](_0x35c62b);}})[_0x8362('0x20')](function(_0x23b237){if(_0x23b237){_0x1dcb32=_0x23b237['length'];if(!_0x3d8709[_0x8362('0x41')][_0x8362('0x48')](_0x8362('0x67'))){_0x35c62b[_0x8362('0x30')]=qs['limit'](_0x3d8709[_0x8362('0x41')]['limit']);_0x35c62b[_0x8362('0x2f')]=qs['offset'](_0x3d8709['query'][_0x8362('0x2f')]);}return _0x17d58d[_0x8362('0xc6')](_0x35c62b);}})[_0x8362('0x20')](function(_0x2cfc00){if(_0x2cfc00){return _0x2cfc00?{'count':_0x1dcb32,'rows':_0x2cfc00}:null;}})[_0x8362('0x20')](respondWithResult(_0x383e91,null))[_0x8362('0x28')](handleError(_0x383e91,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 94e6ae6..906c3bf 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 _0xb9be=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','update','remove'];(function(_0x5da246,_0x4dea24){var _0x461d38=function(_0x402dba){while(--_0x402dba){_0x5da246['push'](_0x5da246['shift']());}};_0x461d38(++_0x4dea24);}(_0xb9be,0xfe));var _0xeb9b=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xb9be[_0x5f1391];return _0x50ebe3;};'use strict';var EventEmitter=require(_0xeb9b('0x0'));var FaxAccount=require(_0xeb9b('0x1'))['db'][_0xeb9b('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xeb9b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeb9b('0x4'),'afterDestroy':_0xeb9b('0x5')};function emitEvent(_0x4dd696){return function(_0x46bb89,_0x4e5601,_0x30e11e){FaxAccountEvents['emit'](_0x4dd696+':'+_0x46bb89['id'],_0x46bb89);FaxAccountEvents[_0xeb9b('0x6')](_0x4dd696,_0x46bb89);_0x30e11e(null);};}for(var e in events){if(events[_0xeb9b('0x7')](e)){var event=events[e];FaxAccount[_0xeb9b('0x8')](e,emitEvent(event));}}module[_0xeb9b('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x8f22=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x32b312,_0x4e3f0f){var _0x313368=function(_0x29143f){while(--_0x29143f){_0x32b312['push'](_0x32b312['shift']());}};_0x313368(++_0x4e3f0f);}(_0x8f22,0x1e3));var _0x28f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f22[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0x28f2('0x0'));var FaxAccount=require(_0x28f2('0x1'))['db'][_0x28f2('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x28f2('0x3')](0x0);var events={'afterCreate':_0x28f2('0x4'),'afterUpdate':_0x28f2('0x5'),'afterDestroy':_0x28f2('0x6')};function emitEvent(_0x421a00){return function(_0xb300bd,_0x1537f2,_0x22adc0){FaxAccountEvents[_0x28f2('0x7')](_0x421a00+':'+_0xb300bd['id'],_0xb300bd);FaxAccountEvents[_0x28f2('0x7')](_0x421a00,_0xb300bd);_0x22adc0(null);};}for(var e in events){if(events[_0x28f2('0x8')](e)){var event=events[e];FaxAccount[_0x28f2('0x9')](e,emitEvent(event));}}module[_0x28f2('0xa')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f634323..8461603 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 _0x0c76=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x0c76,0x151));var _0x60c7=function(_0x5e4976,_0x3fbb6e){_0x5e4976=_0x5e4976-0x0;var _0x5240ec=_0x0c76[_0x5e4976];return _0x5240ec;};'use strict';var _=require(_0x60c7('0x0'));var util=require(_0x60c7('0x1'));var logger=require(_0x60c7('0x2'))(_0x60c7('0x3'));var moment=require(_0x60c7('0x4'));var BPromise=require('bluebird');var rp=require(_0x60c7('0x5'));var fs=require('fs');var path=require(_0x60c7('0x6'));var rimraf=require('rimraf');var config=require(_0x60c7('0x7'));var attributes=require(_0x60c7('0x8'));module[_0x60c7('0x9')]=function(_0x199166,_0x4d59aa){return _0x199166[_0x60c7('0xa')](_0x60c7('0xb'),attributes,{'tableName':_0x60c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb506=['bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','util','api','moment'];(function(_0x4146e4,_0x2d91cf){var _0x4d9137=function(_0x28e695){while(--_0x28e695){_0x4146e4['push'](_0x4146e4['shift']());}};_0x4d9137(++_0x2d91cf);}(_0xb506,0x1d6));var _0x6b50=function(_0x2c7388,_0x599080){_0x2c7388=_0x2c7388-0x0;var _0x3143bf=_0xb506[_0x2c7388];return _0x3143bf;};'use strict';var _=require('lodash');var util=require(_0x6b50('0x0'));var logger=require('../../config/logger')(_0x6b50('0x1'));var moment=require(_0x6b50('0x2'));var BPromise=require(_0x6b50('0x3'));var rp=require(_0x6b50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b50('0x5'));var config=require(_0x6b50('0x6'));var attributes=require(_0x6b50('0x7'));module[_0x6b50('0x8')]=function(_0x58eb82,_0x814e45){return _0x58eb82['define'](_0x6b50('0x9'),attributes,{'tableName':_0x6b50('0xa'),'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 625e238..433eb17 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 _0x8d25=['then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','debug','catch','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','DESC','account','applications','Applications','list','priority','asc','Contacts','length','ListId','contact','fax','spread','get','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','create','ContactId','AttachmentId','UserId','unshift','name','Start','startRouting','lodash','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request'];(function(_0x25b444,_0x20da5e){var _0x425f88=function(_0xe4183e){while(--_0xe4183e){_0x25b444['push'](_0x25b444['shift']());}};_0x425f88(++_0x20da5e);}(_0x8d25,0x18e));var _0x58d2=function(_0x3a43bd,_0x29477e){_0x3a43bd=_0x3a43bd-0x0;var _0x5c7283=_0x8d25[_0x3a43bd];return _0x5c7283;};'use strict';var _=require(_0x58d2('0x0'));var util=require('util');var moment=require(_0x58d2('0x1'));var BPromise=require(_0x58d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58d2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x58d2('0x4'));var jayson=require(_0x58d2('0x5'));var client=jayson['client']['http']({'port':0x232c});config[_0x58d2('0x6')]=_['defaults'](config[_0x58d2('0x6')],{'host':_0x58d2('0x7'),'port':0x18eb});var socket=require(_0x58d2('0x8'))(new Redis(config[_0x58d2('0x6')]));require(_0x58d2('0x9'))[_0x58d2('0xa')](socket);function respondWithRpcPromise(_0x176220,_0x2f762d,_0x4f4691){return new BPromise(function(_0x5a3874,_0x9ab82d){return client[_0x58d2('0xb')](_0x176220,_0x4f4691)[_0x58d2('0xc')](function(_0x4d65e4){logger[_0x58d2('0xd')](_0x58d2('0xe'),_0x2f762d,_0x58d2('0xf'));logger['debug'](_0x58d2('0x10'),_0x2f762d,'request\x20sent',JSON[_0x58d2('0x11')](_0x4d65e4));if(_0x4d65e4[_0x58d2('0x12')]){if(_0x4d65e4['error']['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x2f762d,_0x4d65e4[_0x58d2('0x12')][_0x58d2('0x13')]);return _0x9ab82d(_0x4d65e4[_0x58d2('0x12')][_0x58d2('0x13')]);}logger['error'](_0x58d2('0xe'),_0x2f762d,_0x4d65e4[_0x58d2('0x12')][_0x58d2('0x13')]);return _0x5a3874(_0x4d65e4[_0x58d2('0x12')][_0x58d2('0x13')]);}else{logger[_0x58d2('0xd')](_0x58d2('0xe'),_0x2f762d,_0x58d2('0xf'));_0x5a3874(_0x4d65e4[_0x58d2('0x14')][_0x58d2('0x13')]);}})['catch'](function(_0x2e71eb){logger[_0x58d2('0x12')](_0x58d2('0xe'),_0x2f762d,_0x2e71eb);_0x9ab82d(_0x2e71eb);});});}exports['GetFaxAccount']=function(_0x6c25ec){var _0x56148b=this;return new Promise(function(_0x39d19a,_0x2838d7){return db['FaxAccount'][_0x58d2('0x15')]({'raw':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec[_0x58d2('0x16')][_0x58d2('0x17')]===undefined?!![]:![]:!![],'where':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec['options'][_0x58d2('0x18')]||null:null,'attributes':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec[_0x58d2('0x16')][_0x58d2('0x19')]||null:null,'limit':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec[_0x58d2('0x16')]['limit']||null:null,'include':_0x6c25ec[_0x58d2('0x16')]?_0x6c25ec['options'][_0x58d2('0x1a')]?_[_0x58d2('0x1b')](_0x6c25ec[_0x58d2('0x16')][_0x58d2('0x1a')],function(_0x56aee5){return{'model':db[_0x56aee5['model']],'as':_0x56aee5['as'],'attributes':_0x56aee5[_0x58d2('0x19')],'include':_0x56aee5['include']?_[_0x58d2('0x1b')](_0x56aee5[_0x58d2('0x1a')],function(_0x35587b){return{'model':db[_0x35587b[_0x58d2('0x1c')]],'as':_0x35587b['as'],'attributes':_0x35587b[_0x58d2('0x19')],'include':_0x35587b[_0x58d2('0x1a')]?_[_0x58d2('0x1b')](_0x35587b[_0x58d2('0x1a')],function(_0x2bb558){return{'model':db[_0x2bb558['model']],'as':_0x2bb558['as'],'attributes':_0x2bb558[_0x58d2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x58d2('0xc')](function(_0x1d5099){logger['info'](_0x58d2('0x1d'),_0x6c25ec);logger[_0x58d2('0x1e')](_0x58d2('0x1d'),_0x6c25ec,JSON[_0x58d2('0x11')](_0x1d5099));_0x39d19a(_0x1d5099);})[_0x58d2('0x1f')](function(_0x18300c){logger['error'](_0x58d2('0x1d'),_0x18300c['message'],_0x6c25ec);_0x2838d7(_0x56148b[_0x58d2('0x12')](0x1f4,_0x18300c['message']));});});};exports[_0x58d2('0x20')]=function(_0x5acd39,_0x11dfe9,_0x2973d6){var _0x4e5972=this;return new Promise(function(_0x2450fe,_0x253008){var _0x25ec44={'body':_0x5acd39[_0x58d2('0x21')],'channel':'fax'};var _0x1c0da8=[];var _0x2f9c8b=[];var _0x1ed29e={};return db[_0x58d2('0x22')][_0x58d2('0x23')]()['then'](function(_0x31653d){if(!_0x31653d){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))](_0x58d2('0x26'));}_0x1c0da8=_['difference'](_['keys'](_0x31653d),[_0x58d2('0x27'),_0x58d2('0x28')]);_0x2f9c8b=_[_0x58d2('0x29')](_['keys'](_0x31653d),['createdAt',_0x58d2('0x28'),_0x58d2('0x2a'),'ListId']);if(_0x5acd39[_0x58d2('0x21')]['id']){delete _0x5acd39[_0x58d2('0x21')]['id'];}if(_[_0x58d2('0x2b')](_0x5acd39[_0x58d2('0x21')][_0x58d2('0x2c')])){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))]('from\x20is\x20mandatory');}if(_[_0x58d2('0x2b')](_0x5acd39[_0x58d2('0x21')][_0x58d2('0x21')])||_0x5acd39[_0x58d2('0x21')][_0x58d2('0x21')]===''){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))](_0x58d2('0x2d'));}if(_[_0x58d2('0x2b')](_0x5acd39[_0x58d2('0x21')][_0x58d2('0x2e')])){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2f9c8b);}if(!_[_0x58d2('0x2f')](_0x2f9c8b,_0x5acd39[_0x58d2('0x21')]['mapKey'])){throw new db[(_0x58d2('0x24'))][(_0x58d2('0x25'))](_0x58d2('0x30')+_0x2f9c8b);}_0x1ed29e[_0x5acd39[_0x58d2('0x21')][_0x58d2('0x2e')]]=_0x5acd39['body'][_0x58d2('0x2c')];})['then'](function(){return db[_0x58d2('0x31')][_0x58d2('0x32')]({'where':{'id':_0x5acd39['account']['id']},'include':[{'model':db[_0x58d2('0x33')],'as':_0x58d2('0x34'),'include':[{'model':db[_0x58d2('0x22')],'as':'Contacts','where':_0x1ed29e,'limit':0x1,'order':[[_0x58d2('0x28'),_0x58d2('0x35')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x58d2('0xc')](function(_0x418fba){if(_0x418fba&&_0x418fba[_0x58d2('0x34')]){var _0x50425a=_0x418fba['get']({'plain':!![]});_0x25ec44[_0x58d2('0x36')]=_0x50425a;_0x25ec44[_0x58d2('0x37')]=_0x50425a[_0x58d2('0x38')];_0x25ec44[_0x58d2('0x39')]=_0x50425a[_0x58d2('0x34')];_0x25ec44[_0x58d2('0x37')]=_['orderBy'](_0x25ec44[_0x58d2('0x37')],[_0x58d2('0x3a')],[_0x58d2('0x3b')]);if(_0x25ec44['account']['Applications']){delete _0x25ec44[_0x58d2('0x36')][_0x58d2('0x38')];}if(_0x25ec44[_0x58d2('0x36')][_0x58d2('0x34')]&&_0x25ec44['account'][_0x58d2('0x34')][_0x58d2('0x3c')][_0x58d2('0x3d')]){return _0x25ec44[_0x58d2('0x36')][_0x58d2('0x34')][_0x58d2('0x3c')][0x0];}var _0x9d300a=_['defaults'](_0x5acd39[_0x58d2('0x21')],{'firstName':_0x5acd39[_0x58d2('0x21')]['from'],'ListId':_0x50425a[_0x58d2('0x3e')]});_0x9d300a[_0x5acd39['body'][_0x58d2('0x2e')]]=_0x5acd39[_0x58d2('0x21')][_0x58d2('0x2c')];return db['CmContact']['create'](_0x9d300a,{'fields':_0x1c0da8,'raw':!![]});}})[_0x58d2('0xc')](function(_0xe54bb8){_0x25ec44[_0x58d2('0x3f')]=_0xe54bb8;if(_0xe54bb8){var _0x21050c={'ContactId':_0xe54bb8['id'],'FaxAccountId':_0x5acd39['account']['id'],'fax':_0xe54bb8[_0x58d2('0x40')]};return db['FaxInteraction'][_0x58d2('0x32')]({'where':{'ContactId':_0xe54bb8['id'],'closed':![],'FaxAccountId':_0x5acd39[_0x58d2('0x36')]['id']}})[_0x58d2('0xc')](function(_0xb4b6be){if(_0xb4b6be){return[_0xb4b6be,![]];}return db['FaxInteraction']['create'](_0x21050c)[_0x58d2('0xc')](function(_0x4ed5de){return[_0x4ed5de,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x58d2('0x41')](function(_0x5f2650,_0x29478c){var _0x348890=_0x5f2650[_0x58d2('0x42')]({'plain':!![]});if(_0x29478c){if(_0x25ec44[_0x58d2('0x36')]['autoclose']){_0x25ec44[_0x58d2('0x37')][_0x58d2('0x43')]({'id':0x0,'priority':_0x25ec44[_0x58d2('0x37')][_0x58d2('0x3d')]+0x1,'app':_0x58d2('0x44'),'appdata':_0x58d2('0x45'),'interval':_0x58d2('0x46')});}_0x348890[_0x58d2('0x47')]=!![];}else{_0x348890[_0x58d2('0x47')]=![];}_0x25ec44[_0x58d2('0x48')]=_0x348890;return db[_0x58d2('0x49')][_0x58d2('0x4a')]({'body':_0x5acd39[_0x58d2('0x21')]['body'],'FaxAccountId':_0x5acd39[_0x58d2('0x36')]['id'],'FaxInteractionId':_0x5f2650['id'],'direction':'in','ContactId':_0x5f2650[_0x58d2('0x4b')],'AttachmentId':_0x5acd39[_0x58d2('0x21')][_0x58d2('0x4c')]});})['then'](function(_0x5ba619){_0x25ec44[_0x58d2('0x13')]=_0x5ba619;if(_0x25ec44['interaction'][_0x58d2('0x4d')]){return db['User'][_0x58d2('0x32')]({'attributes':['id','name'],'where':{'id':_0x25ec44[_0x58d2('0x48')][_0x58d2('0x4d')]}})[_0x58d2('0xc')](function(_0x440ff5){if(_0x440ff5){_0x25ec44[_0x58d2('0x37')][_0x58d2('0x4e')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x440ff5[_0x58d2('0x4f')]+','+(_0x25ec44['account']['waitForTheAssignedAgent']||0xa),'interval':_0x58d2('0x46')});}return respondWithRpcPromise(_0x58d2('0x50'),_0x58d2('0x51'),_0x25ec44);});}return respondWithRpcPromise(_0x58d2('0x50'),'startRouting',_0x25ec44);})[_0x58d2('0xc')](function(_0x5e4ba9){_0x2450fe(_0x5e4ba9);})[_0x58d2('0x1f')](function(_0x699f22){_0x253008(_0x4e5972[_0x58d2('0x12')](0x1f4,_0x699f22['message']));});});}; \ No newline at end of file +var _0x54a4=['create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','unmanaged','*,*,*,*','created','interaction','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','request\x20sent','result','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFaxAccount','catch','NotifyFaxAccount','body','CmContact','then','no\x20available\x20attributes','keys','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','DESC','FaxApplication','Applications','get','list','applications','asc','Contacts','defaults'];(function(_0xe5c582,_0x245e29){var _0x58ff7b=function(_0x5a18a8){while(--_0x5a18a8){_0xe5c582['push'](_0xe5c582['shift']());}};_0x58ff7b(++_0x245e29);}(_0x54a4,0x11f));var _0x454a=function(_0x5f363e,_0x4100f0){_0x5f363e=_0x5f363e-0x0;var _0x2ea7ea=_0x54a4[_0x5f363e];return _0x2ea7ea;};'use strict';var _=require(_0x454a('0x0'));var util=require('util');var moment=require(_0x454a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x454a('0x2'));var db=require(_0x454a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x454a('0x4'))(_0x454a('0x5'));var config=require(_0x454a('0x6'));var jayson=require(_0x454a('0x7'));var client=jayson['client'][_0x454a('0x8')]({'port':0x232c});config[_0x454a('0x9')]=_['defaults'](config[_0x454a('0x9')],{'host':_0x454a('0xa'),'port':0x18eb});var socket=require(_0x454a('0xb'))(new Redis(config[_0x454a('0x9')]));require(_0x454a('0xc'))[_0x454a('0xd')](socket);function respondWithRpcPromise(_0x4b4903,_0x37f6b7,_0x260b33){return new BPromise(function(_0x64702,_0x17251c){return client[_0x454a('0xe')](_0x4b4903,_0x260b33)['then'](function(_0x2a003b){logger[_0x454a('0xf')]('FaxAccount,\x20%s,\x20%s',_0x37f6b7,'request\x20sent');logger[_0x454a('0x10')](_0x454a('0x11'),_0x37f6b7,'request\x20sent',JSON[_0x454a('0x12')](_0x2a003b));if(_0x2a003b[_0x454a('0x13')]){if(_0x2a003b[_0x454a('0x13')][_0x454a('0x14')]===0x1f4){logger[_0x454a('0x13')](_0x454a('0x15'),_0x37f6b7,_0x2a003b[_0x454a('0x13')]['message']);return _0x17251c(_0x2a003b['error'][_0x454a('0x16')]);}logger[_0x454a('0x13')](_0x454a('0x15'),_0x37f6b7,_0x2a003b[_0x454a('0x13')][_0x454a('0x16')]);return _0x64702(_0x2a003b[_0x454a('0x13')]['message']);}else{logger[_0x454a('0xf')]('FaxAccount,\x20%s,\x20%s',_0x37f6b7,_0x454a('0x17'));_0x64702(_0x2a003b[_0x454a('0x18')][_0x454a('0x16')]);}})['catch'](function(_0x499b5c){logger[_0x454a('0x13')](_0x454a('0x15'),_0x37f6b7,_0x499b5c);_0x17251c(_0x499b5c);});});}exports['GetFaxAccount']=function(_0x1e15c1){var _0x4a914b=this;return new Promise(function(_0x37ff08,_0x29023e){return db[_0x454a('0x19')][_0x454a('0x1a')]({'raw':_0x1e15c1[_0x454a('0x1b')]?_0x1e15c1[_0x454a('0x1b')][_0x454a('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e15c1[_0x454a('0x1b')]?_0x1e15c1['options'][_0x454a('0x1d')]||null:null,'attributes':_0x1e15c1[_0x454a('0x1b')]?_0x1e15c1[_0x454a('0x1b')][_0x454a('0x1e')]||null:null,'limit':_0x1e15c1[_0x454a('0x1b')]?_0x1e15c1[_0x454a('0x1b')][_0x454a('0x1f')]||null:null,'include':_0x1e15c1[_0x454a('0x1b')]?_0x1e15c1[_0x454a('0x1b')][_0x454a('0x20')]?_['map'](_0x1e15c1[_0x454a('0x1b')][_0x454a('0x20')],function(_0xa04143){return{'model':db[_0xa04143[_0x454a('0x21')]],'as':_0xa04143['as'],'attributes':_0xa04143['attributes'],'include':_0xa04143[_0x454a('0x20')]?_[_0x454a('0x22')](_0xa04143[_0x454a('0x20')],function(_0x50e3dc){return{'model':db[_0x50e3dc[_0x454a('0x21')]],'as':_0x50e3dc['as'],'attributes':_0x50e3dc[_0x454a('0x1e')],'include':_0x50e3dc[_0x454a('0x20')]?_[_0x454a('0x22')](_0x50e3dc[_0x454a('0x20')],function(_0x3fa02f){return{'model':db[_0x3fa02f[_0x454a('0x21')]],'as':_0x3fa02f['as'],'attributes':_0x3fa02f[_0x454a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb0fe28){logger['info'](_0x454a('0x23'),_0x1e15c1);logger['debug'](_0x454a('0x23'),_0x1e15c1,JSON[_0x454a('0x12')](_0xb0fe28));_0x37ff08(_0xb0fe28);})[_0x454a('0x24')](function(_0x3d5500){logger[_0x454a('0x13')](_0x454a('0x23'),_0x3d5500[_0x454a('0x16')],_0x1e15c1);_0x29023e(_0x4a914b[_0x454a('0x13')](0x1f4,_0x3d5500[_0x454a('0x16')]));});});};exports[_0x454a('0x25')]=function(_0x43843d,_0x82f4d8,_0x4acf2d){var _0x30ca4c=this;return new Promise(function(_0xb52862,_0x856a41){var _0xb62d4e={'body':_0x43843d[_0x454a('0x26')],'channel':'fax'};var _0x1906d0=[];var _0x29457b=[];var _0x5316e8={};return db[_0x454a('0x27')]['describe']()[_0x454a('0x28')](function(_0x13ad50){if(!_0x13ad50){throw new db['Sequelize']['ValidationError'](_0x454a('0x29'));}_0x1906d0=_['difference'](_[_0x454a('0x2a')](_0x13ad50),['createdAt','updatedAt']);_0x29457b=_[_0x454a('0x2b')](_['keys'](_0x13ad50),[_0x454a('0x2c'),_0x454a('0x2d'),_0x454a('0x2e'),_0x454a('0x2f')]);if(_0x43843d[_0x454a('0x26')]['id']){delete _0x43843d[_0x454a('0x26')]['id'];}if(_[_0x454a('0x30')](_0x43843d[_0x454a('0x26')][_0x454a('0x31')])){throw new db[(_0x454a('0x32'))][(_0x454a('0x33'))](_0x454a('0x34'));}if(_['isNil'](_0x43843d[_0x454a('0x26')]['body'])||_0x43843d[_0x454a('0x26')]['body']===''){throw new db[(_0x454a('0x32'))][(_0x454a('0x33'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x454a('0x30')](_0x43843d[_0x454a('0x26')][_0x454a('0x35')])){throw new db[(_0x454a('0x32'))]['ValidationError'](_0x454a('0x36')+_0x29457b);}if(!_['includes'](_0x29457b,_0x43843d['body'][_0x454a('0x35')])){throw new db[(_0x454a('0x32'))][(_0x454a('0x33'))](_0x454a('0x37')+_0x29457b);}_0x5316e8[_0x43843d[_0x454a('0x26')]['mapKey']]=_0x43843d[_0x454a('0x26')][_0x454a('0x31')];})[_0x454a('0x28')](function(){return db[_0x454a('0x19')][_0x454a('0x38')]({'where':{'id':_0x43843d[_0x454a('0x39')]['id']},'include':[{'model':db[_0x454a('0x3a')],'as':_0x454a('0x3b'),'include':[{'model':db[_0x454a('0x27')],'as':'Contacts','where':_0x5316e8,'limit':0x1,'order':[['updatedAt',_0x454a('0x3c')]]}]},{'model':db[_0x454a('0x3d')],'as':_0x454a('0x3e')}]});})['then'](function(_0x19c779){if(_0x19c779&&_0x19c779[_0x454a('0x3b')]){var _0x4d0f2a=_0x19c779[_0x454a('0x3f')]({'plain':!![]});_0xb62d4e[_0x454a('0x39')]=_0x4d0f2a;_0xb62d4e['applications']=_0x4d0f2a[_0x454a('0x3e')];_0xb62d4e[_0x454a('0x40')]=_0x4d0f2a['List'];_0xb62d4e[_0x454a('0x41')]=_['orderBy'](_0xb62d4e[_0x454a('0x41')],['priority'],[_0x454a('0x42')]);if(_0xb62d4e['account'][_0x454a('0x3e')]){delete _0xb62d4e[_0x454a('0x39')]['Applications'];}if(_0xb62d4e[_0x454a('0x39')][_0x454a('0x3b')]&&_0xb62d4e[_0x454a('0x39')][_0x454a('0x3b')]['Contacts']['length']){return _0xb62d4e['account'][_0x454a('0x3b')][_0x454a('0x43')][0x0];}var _0x980394=_[_0x454a('0x44')](_0x43843d[_0x454a('0x26')],{'firstName':_0x43843d[_0x454a('0x26')][_0x454a('0x31')],'ListId':_0x4d0f2a[_0x454a('0x2f')]});_0x980394[_0x43843d[_0x454a('0x26')][_0x454a('0x35')]]=_0x43843d['body'][_0x454a('0x31')];return db[_0x454a('0x27')][_0x454a('0x45')](_0x980394,{'fields':_0x1906d0,'raw':!![]});}})[_0x454a('0x28')](function(_0x3029ea){_0xb62d4e[_0x454a('0x46')]=_0x3029ea;if(_0x3029ea){var _0x2ce6cb={'ContactId':_0x3029ea['id'],'FaxAccountId':_0x43843d[_0x454a('0x39')]['id'],'fax':_0x3029ea['fax']};return db[_0x454a('0x47')]['find']({'where':{'ContactId':_0x3029ea['id'],'closed':![],'FaxAccountId':_0x43843d['account']['id']}})['then'](function(_0x1e4344){if(_0x1e4344){return[_0x1e4344,![]];}return db[_0x454a('0x47')][_0x454a('0x45')](_0x2ce6cb)[_0x454a('0x28')](function(_0x11f239){return[_0x11f239,!![]];});});}else{throw new Error(_0x454a('0x48'));}})[_0x454a('0x49')](function(_0x57f4dd,_0x2ba82a){var _0x351d58=_0x57f4dd[_0x454a('0x3f')]({'plain':!![]});if(_0x2ba82a){if(_0xb62d4e[_0x454a('0x39')][_0x454a('0x4a')]){_0xb62d4e[_0x454a('0x41')][_0x454a('0x4b')]({'id':0x0,'priority':_0xb62d4e['applications'][_0x454a('0x4c')]+0x1,'app':'close','appdata':_0x454a('0x4d'),'interval':_0x454a('0x4e')});}_0x351d58[_0x454a('0x4f')]=!![];}else{_0x351d58[_0x454a('0x4f')]=![];}_0xb62d4e[_0x454a('0x50')]=_0x351d58;return db['FaxMessage'][_0x454a('0x45')]({'body':_0x43843d[_0x454a('0x26')][_0x454a('0x26')],'FaxAccountId':_0x43843d[_0x454a('0x39')]['id'],'FaxInteractionId':_0x57f4dd['id'],'direction':'in','ContactId':_0x57f4dd['ContactId'],'AttachmentId':_0x43843d[_0x454a('0x26')][_0x454a('0x51')]});})[_0x454a('0x28')](function(_0x55a9be){_0xb62d4e[_0x454a('0x16')]=_0x55a9be;if(_0xb62d4e['interaction'][_0x454a('0x52')]){return db[_0x454a('0x53')][_0x454a('0x38')]({'attributes':['id',_0x454a('0x54')],'where':{'id':_0xb62d4e[_0x454a('0x50')][_0x454a('0x52')]}})['then'](function(_0x554db4){if(_0x554db4){_0xb62d4e[_0x454a('0x41')][_0x454a('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x554db4[_0x454a('0x54')]+','+(_0xb62d4e[_0x454a('0x39')][_0x454a('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0xb62d4e);});}return respondWithRpcPromise(_0x454a('0x57'),_0x454a('0x58'),_0xb62d4e);})['then'](function(_0x280314){_0xb52862(_0x280314);})[_0x454a('0x24')](function(_0x4558a2){_0x856a41(_0x30ca4c[_0x454a('0x13')](0x1f4,_0x4558a2[_0x454a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 944a123..2d5e94c 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 _0xcfde=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x4f78a8,_0x5e7afd){var _0x46f268=function(_0x5ee6d5){while(--_0x5ee6d5){_0x4f78a8['push'](_0x4f78a8['shift']());}};_0x46f268(++_0x5e7afd);}(_0xcfde,0xf9));var _0xecfd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcfde[_0x167cc1];return _0x10bc4b;};'use strict';var FaxAccountEvents=require(_0xecfd('0x0'));var events=[_0xecfd('0x1'),_0xecfd('0x2'),_0xecfd('0x3')];function createListener(_0x275d11,_0x1a7b03){return function(_0x3b86fd){_0x1a7b03[_0xecfd('0x4')](_0x275d11,_0x3b86fd);};}function removeListener(_0x2ba023,_0x2de17b){return function(){FaxAccountEvents[_0xecfd('0x5')](_0x2ba023,_0x2de17b);};}exports[_0xecfd('0x6')]=function(_0x3e3da7){for(var _0x40887c=0x0,_0x2a3a8d=events[_0xecfd('0x7')];_0x40887c<_0x2a3a8d;_0x40887c++){var _0x1281ee=events[_0x40887c];var _0x595bfa=createListener(_0xecfd('0x8')+_0x1281ee,_0x3e3da7);FaxAccountEvents['on'](_0x1281ee,_0x595bfa);}}; \ No newline at end of file +var _0x0857=['update','emit','removeListener','register','faxAccount:','./faxAccount.events','remove'];(function(_0x138d06,_0x33edf2){var _0x1a01eb=function(_0x387acb){while(--_0x387acb){_0x138d06['push'](_0x138d06['shift']());}};_0x1a01eb(++_0x33edf2);}(_0x0857,0xfa));var _0x7085=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0857[_0x3bf83f];return _0x22c4a9;};'use strict';var FaxAccountEvents=require(_0x7085('0x0'));var events=['save',_0x7085('0x1'),_0x7085('0x2')];function createListener(_0x4adc20,_0xd78d6e){return function(_0x2bd287){_0xd78d6e[_0x7085('0x3')](_0x4adc20,_0x2bd287);};}function removeListener(_0x1a05c6,_0x2afbd3){return function(){FaxAccountEvents[_0x7085('0x4')](_0x1a05c6,_0x2afbd3);};}exports[_0x7085('0x5')]=function(_0x36de91){for(var _0x55bb0a=0x0,_0xf9eb49=events['length'];_0x55bb0a<_0xf9eb49;_0x55bb0a++){var _0x5c3af8=events[_0x55bb0a];var _0x598d60=createListener(_0x7085('0x6')+_0x5c3af8,_0x36de91);FaxAccountEvents['on'](_0x5c3af8,_0x598d60);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 0f98e0c..b3b60fe 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(_0x58b6cc,_0x559b8b){var _0x148892=function(_0x2a0176){while(--_0x2a0176){_0x58b6cc['push'](_0x58b6cc['shift']());}};_0x148892(++_0x559b8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x18b910,_0x41bdcd){var _0x3ef45f=function(_0x12a86f){while(--_0x12a86f){_0x18b910['push'](_0x18b910['shift']());}};_0x3ef45f(++_0x41bdcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 522ac05..ae29996 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 _0x9106=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x2b63c4,_0x2fc67e){var _0x75616a=function(_0x16cd33){while(--_0x16cd33){_0x2b63c4['push'](_0x2b63c4['shift']());}};_0x75616a(++_0x2fc67e);}(_0x9106,0x176));var _0x6910=function(_0x2d9359,_0x52473b){_0x2d9359=_0x2d9359-0x0;var _0x3fe0ef=_0x9106[_0x2d9359];return _0x3fe0ef;};'use strict';var Sequelize=require(_0x6910('0x0'));module[_0x6910('0x1')]={'priority':{'type':Sequelize[_0x6910('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6910('0x3')],'allowNull':![],'defaultValue':_0x6910('0x4')},'appdata':{'type':Sequelize[_0x6910('0x5')]()},'description':{'type':Sequelize[_0x6910('0x3')]},'interval':{'type':Sequelize[_0x6910('0x3')],'defaultValue':_0x6910('0x6')}}; \ No newline at end of file +var _0x1271=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0xdbe563,_0x13cb26){var _0xf99dfc=function(_0x57d549){while(--_0x57d549){_0xdbe563['push'](_0xdbe563['shift']());}};_0xf99dfc(++_0x13cb26);}(_0x1271,0x8f));var _0x1127=function(_0x11f8e9,_0x67f67f){_0x11f8e9=_0x11f8e9-0x0;var _0x3a04d7=_0x1271[_0x11f8e9];return _0x3a04d7;};'use strict';var Sequelize=require(_0x1127('0x0'));module[_0x1127('0x1')]={'priority':{'type':Sequelize[_0x1127('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1127('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1127('0x4')]()},'description':{'type':Sequelize[_0x1127('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1127('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 0944547..bb27e21 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 _0x68c6=['fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','find','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','send','map','FaxApplication','rawAttributes'];(function(_0x86a170,_0x1a31d7){var _0x640e8b=function(_0xa7d2a2){while(--_0xa7d2a2){_0x86a170['push'](_0x86a170['shift']());}};_0x640e8b(++_0x1a31d7);}(_0x68c6,0x182));var _0x668c=function(_0x2c602e,_0x1d26f5){_0x2c602e=_0x2c602e-0x0;var _0x1a2650=_0x68c6[_0x2c602e];return _0x1a2650;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x668c('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x668c('0x1'));var Mustache=require(_0x668c('0x2'));var util=require(_0x668c('0x3'));var path=require(_0x668c('0x4'));var sox=require('sox');var csv=require(_0x668c('0x5'));var ejs=require(_0x668c('0x6'));var fs=require('fs');var fs_extra=require(_0x668c('0x7'));var _=require(_0x668c('0x8'));var squel=require(_0x668c('0x9'));var crypto=require('crypto');var jsforce=require(_0x668c('0xa'));var deskjs=require(_0x668c('0xb'));var toCsv=require(_0x668c('0x5'));var querystring=require(_0x668c('0xc'));var Papa=require(_0x668c('0xd'));var Redis=require(_0x668c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x668c('0xf'));var as=require(_0x668c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x668c('0x11'))('api');var utils=require(_0x668c('0x12'));var config=require(_0x668c('0x13'));var licenseUtil=require(_0x668c('0x14'));var db=require(_0x668c('0x15'))['db'];function respondWithStatusCode(_0x2c5255,_0x580435){_0x580435=_0x580435||0xcc;return function(_0x4657c7){if(_0x4657c7){return _0x2c5255['sendStatus'](_0x580435);}return _0x2c5255[_0x668c('0x16')](_0x580435)[_0x668c('0x17')]();};}function respondWithResult(_0x4f6264,_0x2c1caa){_0x2c1caa=_0x2c1caa||0xc8;return function(_0x1fb78e){if(_0x1fb78e){return _0x4f6264[_0x668c('0x16')](_0x2c1caa)[_0x668c('0x18')](_0x1fb78e);}};}function respondWithFilteredResult(_0x2c8d1e,_0x55226f){return function(_0x3d1f26){if(_0x3d1f26){var _0x5ccaa4=typeof _0x55226f[_0x668c('0x19')]===_0x668c('0x1a')&&typeof _0x55226f[_0x668c('0x1b')]==='undefined';var _0x4c2c68=_0x3d1f26[_0x668c('0x1c')];var _0x31ca58=_0x5ccaa4?0x0:_0x55226f[_0x668c('0x19')];var _0x1f3850=_0x5ccaa4?_0x3d1f26[_0x668c('0x1c')]:_0x55226f[_0x668c('0x19')]+_0x55226f[_0x668c('0x1b')];var _0x51b249;if(_0x1f3850>=_0x4c2c68){_0x1f3850=_0x4c2c68;_0x51b249=0xc8;}else{_0x51b249=0xce;}_0x2c8d1e['status'](_0x51b249);return _0x2c8d1e[_0x668c('0x1d')](_0x668c('0x1e'),_0x31ca58+'-'+_0x1f3850+'/'+_0x4c2c68)[_0x668c('0x18')](_0x3d1f26);}return null;};}function patchUpdates(_0x56354d){return function(_0xb6a095){try{jsonpatch['apply'](_0xb6a095,_0x56354d,!![]);}catch(_0xec2e18){return BPromise[_0x668c('0x1f')](_0xec2e18);}return _0xb6a095['save']();};}function saveUpdates(_0x2e4d52,_0x33372){return function(_0x3adf49){if(_0x3adf49){return _0x3adf49[_0x668c('0x20')](_0x2e4d52)[_0x668c('0x21')](function(_0x55754d){return _0x55754d;});}return null;};}function removeEntity(_0x27a6e9,_0x457382){return function(_0x268a5a){if(_0x268a5a){return _0x268a5a['destroy']()[_0x668c('0x21')](function(){_0x27a6e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc601,_0x761ec){return function(_0x228316){if(!_0x228316){_0x2bc601['sendStatus'](0x194);}return _0x228316;};}function handleError(_0x2afea2,_0x239f61){_0x239f61=_0x239f61||0x1f4;return function(_0x24b609){logger['error'](_0x24b609[_0x668c('0x22')]);if(_0x24b609[_0x668c('0x23')]){delete _0x24b609[_0x668c('0x23')];}_0x2afea2['status'](_0x239f61)[_0x668c('0x24')](_0x24b609);};}exports['index']=function(_0x3703f5,_0x50c5bc){var _0x612b60={},_0x59183b={},_0x33a671={'count':0x0,'rows':[]};var _0x47731c=_[_0x668c('0x25')](db[_0x668c('0x26')][_0x668c('0x27')],function(_0x1e258a){return{'name':_0x1e258a[_0x668c('0x28')],'type':_0x1e258a[_0x668c('0x29')][_0x668c('0x2a')]};});_0x59183b['model']=_[_0x668c('0x25')](_0x47731c,_0x668c('0x23'));_0x59183b[_0x668c('0x2b')]=_[_0x668c('0x2c')](_0x3703f5[_0x668c('0x2b')]);_0x59183b[_0x668c('0x2d')]=_['intersection'](_0x59183b[_0x668c('0x2e')],_0x59183b[_0x668c('0x2b')]);_0x612b60[_0x668c('0x2f')]=_[_0x668c('0x30')](_0x59183b['model'],qs['fields'](_0x3703f5['query'][_0x668c('0x31')]));_0x612b60['attributes']=_0x612b60[_0x668c('0x2f')][_0x668c('0x32')]?_0x612b60[_0x668c('0x2f')]:_0x59183b[_0x668c('0x2e')];if(!_0x3703f5['query'][_0x668c('0x33')](_0x668c('0x34'))){_0x612b60['limit']=qs[_0x668c('0x1b')](_0x3703f5[_0x668c('0x2b')][_0x668c('0x1b')]);_0x612b60['offset']=qs['offset'](_0x3703f5[_0x668c('0x2b')][_0x668c('0x19')]);}_0x612b60['order']=qs[_0x668c('0x35')](_0x3703f5[_0x668c('0x2b')][_0x668c('0x35')]);_0x612b60['where']=qs[_0x668c('0x2d')](_[_0x668c('0x36')](_0x3703f5[_0x668c('0x2b')],_0x59183b[_0x668c('0x2d')]),_0x47731c);if(_0x3703f5[_0x668c('0x2b')][_0x668c('0x37')]){_0x612b60[_0x668c('0x38')]=_['merge'](_0x612b60[_0x668c('0x38')],{'$or':_['map'](_0x47731c,function(_0xe4247f){if(_0xe4247f[_0x668c('0x29')]!==_0x668c('0x39')){var _0x3f14f3={};_0x3f14f3[_0xe4247f[_0x668c('0x23')]]={'$like':'%'+_0x3703f5[_0x668c('0x2b')]['filter']+'%'};return _0x3f14f3;}})});}_0x612b60=_[_0x668c('0x3a')]({},_0x612b60,_0x3703f5[_0x668c('0x3b')]);var _0x2bf718={'where':_0x612b60[_0x668c('0x38')]};return db['FaxApplication'][_0x668c('0x1c')](_0x2bf718)['then'](function(_0x13bdbe){_0x33a671[_0x668c('0x1c')]=_0x13bdbe;if(_0x3703f5['query'][_0x668c('0x3c')]){_0x612b60[_0x668c('0x3d')]=[{'all':!![]}];}return db[_0x668c('0x26')][_0x668c('0x3e')](_0x612b60);})[_0x668c('0x21')](function(_0x1e6bee){_0x33a671[_0x668c('0x3f')]=_0x1e6bee;return _0x33a671;})['then'](respondWithFilteredResult(_0x50c5bc,_0x612b60))[_0x668c('0x40')](handleError(_0x50c5bc,null));};exports[_0x668c('0x41')]=function(_0x3d782a,_0x5329be){var _0x34c719={'raw':!![],'where':{'id':_0x3d782a[_0x668c('0x42')]['id']}},_0x8dc411={};_0x8dc411[_0x668c('0x2e')]=_[_0x668c('0x2c')](db['FaxApplication'][_0x668c('0x27')]);_0x8dc411[_0x668c('0x2b')]=_[_0x668c('0x2c')](_0x3d782a[_0x668c('0x2b')]);_0x8dc411[_0x668c('0x2d')]=_['intersection'](_0x8dc411[_0x668c('0x2e')],_0x8dc411[_0x668c('0x2b')]);_0x34c719['attributes']=_[_0x668c('0x30')](_0x8dc411[_0x668c('0x2e')],qs[_0x668c('0x31')](_0x3d782a[_0x668c('0x2b')][_0x668c('0x31')]));_0x34c719[_0x668c('0x2f')]=_0x34c719['attributes'][_0x668c('0x32')]?_0x34c719[_0x668c('0x2f')]:_0x8dc411[_0x668c('0x2e')];if(_0x3d782a[_0x668c('0x2b')][_0x668c('0x3c')]){_0x34c719[_0x668c('0x3d')]=[{'all':!![]}];}_0x34c719=_[_0x668c('0x3a')]({},_0x34c719,_0x3d782a['options']);return db[_0x668c('0x26')]['find'](_0x34c719)[_0x668c('0x21')](handleEntityNotFound(_0x5329be,null))[_0x668c('0x21')](respondWithResult(_0x5329be,null))[_0x668c('0x40')](handleError(_0x5329be,null));};exports[_0x668c('0x43')]=function(_0x366b0d,_0x4ef624){return db['FaxApplication'][_0x668c('0x43')](_0x366b0d[_0x668c('0x44')],{})[_0x668c('0x21')](respondWithResult(_0x4ef624,0xc9))[_0x668c('0x40')](handleError(_0x4ef624,null));};exports[_0x668c('0x20')]=function(_0x42ab78,_0x494777){if(_0x42ab78[_0x668c('0x44')]['id']){delete _0x42ab78[_0x668c('0x44')]['id'];}return db[_0x668c('0x26')]['find']({'where':{'id':_0x42ab78[_0x668c('0x42')]['id']}})[_0x668c('0x21')](handleEntityNotFound(_0x494777,null))[_0x668c('0x21')](saveUpdates(_0x42ab78[_0x668c('0x44')],null))['then'](respondWithResult(_0x494777,null))['catch'](handleError(_0x494777,null));};exports[_0x668c('0x45')]=function(_0x454d58,_0x4f4939){return db[_0x668c('0x26')][_0x668c('0x46')]({'where':{'id':_0x454d58[_0x668c('0x42')]['id']}})[_0x668c('0x21')](handleEntityNotFound(_0x4f4939,null))[_0x668c('0x21')](removeEntity(_0x4f4939,null))[_0x668c('0x40')](handleError(_0x4f4939,null));}; \ No newline at end of file +var _0x2ce4=['find','eml-format','rimraf','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','FaxApplication','includeAll','include','rows','catch','params','options','create','body'];(function(_0x4dae5f,_0x3db736){var _0x3a7e30=function(_0x28e312){while(--_0x28e312){_0x4dae5f['push'](_0x4dae5f['shift']());}};_0x3a7e30(++_0x3db736);}(_0x2ce4,0x91));var _0x42ce=function(_0x2bab9a,_0x28e45e){_0x2bab9a=_0x2bab9a-0x0;var _0x56ca9e=_0x2ce4[_0x2bab9a];return _0x56ca9e;};'use strict';var emlformat=require(_0x42ce('0x0'));var rimraf=require(_0x42ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x42ce('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x42ce('0x3'));var util=require(_0x42ce('0x4'));var path=require(_0x42ce('0x5'));var sox=require(_0x42ce('0x6'));var csv=require(_0x42ce('0x7'));var ejs=require(_0x42ce('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42ce('0x9'));var squel=require(_0x42ce('0xa'));var crypto=require(_0x42ce('0xb'));var jsforce=require(_0x42ce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42ce('0x7'));var querystring=require(_0x42ce('0xd'));var Papa=require(_0x42ce('0xe'));var Redis=require(_0x42ce('0xf'));var authService=require(_0x42ce('0x10'));var qs=require(_0x42ce('0x11'));var as=require(_0x42ce('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42ce('0x13'))(_0x42ce('0x14'));var utils=require(_0x42ce('0x15'));var config=require(_0x42ce('0x16'));var licenseUtil=require(_0x42ce('0x17'));var db=require(_0x42ce('0x18'))['db'];function respondWithStatusCode(_0x51e011,_0x20192f){_0x20192f=_0x20192f||0xcc;return function(_0x364e94){if(_0x364e94){return _0x51e011[_0x42ce('0x19')](_0x20192f);}return _0x51e011[_0x42ce('0x1a')](_0x20192f)[_0x42ce('0x1b')]();};}function respondWithResult(_0x61749e,_0x102049){_0x102049=_0x102049||0xc8;return function(_0x41323d){if(_0x41323d){return _0x61749e[_0x42ce('0x1a')](_0x102049)[_0x42ce('0x1c')](_0x41323d);}};}function respondWithFilteredResult(_0x5b1b17,_0x2b246c){return function(_0x39e7f0){if(_0x39e7f0){var _0x56f6d4=typeof _0x2b246c[_0x42ce('0x1d')]===_0x42ce('0x1e')&&typeof _0x2b246c[_0x42ce('0x1f')]===_0x42ce('0x1e');var _0x3699a8=_0x39e7f0[_0x42ce('0x20')];var _0x1d80b0=_0x56f6d4?0x0:_0x2b246c[_0x42ce('0x1d')];var _0x3a3b47=_0x56f6d4?_0x39e7f0['count']:_0x2b246c[_0x42ce('0x1d')]+_0x2b246c[_0x42ce('0x1f')];var _0x30c446;if(_0x3a3b47>=_0x3699a8){_0x3a3b47=_0x3699a8;_0x30c446=0xc8;}else{_0x30c446=0xce;}_0x5b1b17[_0x42ce('0x1a')](_0x30c446);return _0x5b1b17[_0x42ce('0x21')](_0x42ce('0x22'),_0x1d80b0+'-'+_0x3a3b47+'/'+_0x3699a8)['json'](_0x39e7f0);}return null;};}function patchUpdates(_0x290b73){return function(_0x2aeaf0){try{jsonpatch[_0x42ce('0x23')](_0x2aeaf0,_0x290b73,!![]);}catch(_0x5c6638){return BPromise[_0x42ce('0x24')](_0x5c6638);}return _0x2aeaf0[_0x42ce('0x25')]();};}function saveUpdates(_0x350f8b,_0x398ad8){return function(_0x55117b){if(_0x55117b){return _0x55117b['update'](_0x350f8b)[_0x42ce('0x26')](function(_0x230b7f){return _0x230b7f;});}return null;};}function removeEntity(_0x3ea904,_0x3a74bc){return function(_0x56dc7e){if(_0x56dc7e){return _0x56dc7e['destroy']()[_0x42ce('0x26')](function(){_0x3ea904[_0x42ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4afc52,_0x36a814){return function(_0x1fcf86){if(!_0x1fcf86){_0x4afc52['sendStatus'](0x194);}return _0x1fcf86;};}function handleError(_0x12f9da,_0x6da807){_0x6da807=_0x6da807||0x1f4;return function(_0x5ce849){logger[_0x42ce('0x27')](_0x5ce849[_0x42ce('0x28')]);if(_0x5ce849['name']){delete _0x5ce849[_0x42ce('0x29')];}_0x12f9da[_0x42ce('0x1a')](_0x6da807)['send'](_0x5ce849);};}exports[_0x42ce('0x2a')]=function(_0x19f4d8,_0x46310b){var _0x28fe7a={},_0x3bda84={},_0x399ece={'count':0x0,'rows':[]};var _0xb3b20a=_['map'](db['FaxApplication']['rawAttributes'],function(_0x579d2f){return{'name':_0x579d2f['fieldName'],'type':_0x579d2f[_0x42ce('0x2b')][_0x42ce('0x2c')]};});_0x3bda84[_0x42ce('0x2d')]=_[_0x42ce('0x2e')](_0xb3b20a,_0x42ce('0x29'));_0x3bda84[_0x42ce('0x2f')]=_[_0x42ce('0x30')](_0x19f4d8[_0x42ce('0x2f')]);_0x3bda84[_0x42ce('0x31')]=_['intersection'](_0x3bda84[_0x42ce('0x2d')],_0x3bda84[_0x42ce('0x2f')]);_0x28fe7a[_0x42ce('0x32')]=_[_0x42ce('0x33')](_0x3bda84[_0x42ce('0x2d')],qs[_0x42ce('0x34')](_0x19f4d8[_0x42ce('0x2f')][_0x42ce('0x34')]));_0x28fe7a['attributes']=_0x28fe7a[_0x42ce('0x32')][_0x42ce('0x35')]?_0x28fe7a[_0x42ce('0x32')]:_0x3bda84[_0x42ce('0x2d')];if(!_0x19f4d8[_0x42ce('0x2f')][_0x42ce('0x36')](_0x42ce('0x37'))){_0x28fe7a[_0x42ce('0x1f')]=qs[_0x42ce('0x1f')](_0x19f4d8['query'][_0x42ce('0x1f')]);_0x28fe7a['offset']=qs[_0x42ce('0x1d')](_0x19f4d8[_0x42ce('0x2f')]['offset']);}_0x28fe7a['order']=qs['sort'](_0x19f4d8[_0x42ce('0x2f')][_0x42ce('0x38')]);_0x28fe7a[_0x42ce('0x39')]=qs[_0x42ce('0x31')](_[_0x42ce('0x3a')](_0x19f4d8['query'],_0x3bda84[_0x42ce('0x31')]),_0xb3b20a);if(_0x19f4d8[_0x42ce('0x2f')]['filter']){_0x28fe7a['where']=_[_0x42ce('0x3b')](_0x28fe7a[_0x42ce('0x39')],{'$or':_['map'](_0xb3b20a,function(_0x3e67ed){if(_0x3e67ed['type']!==_0x42ce('0x3c')){var _0x10cb66={};_0x10cb66[_0x3e67ed[_0x42ce('0x29')]]={'$like':'%'+_0x19f4d8['query'][_0x42ce('0x3d')]+'%'};return _0x10cb66;}})});}_0x28fe7a=_[_0x42ce('0x3b')]({},_0x28fe7a,_0x19f4d8['options']);var _0x14161e={'where':_0x28fe7a[_0x42ce('0x39')]};return db[_0x42ce('0x3e')][_0x42ce('0x20')](_0x14161e)['then'](function(_0x2fda72){_0x399ece[_0x42ce('0x20')]=_0x2fda72;if(_0x19f4d8[_0x42ce('0x2f')][_0x42ce('0x3f')]){_0x28fe7a[_0x42ce('0x40')]=[{'all':!![]}];}return db[_0x42ce('0x3e')]['findAll'](_0x28fe7a);})[_0x42ce('0x26')](function(_0x4ea829){_0x399ece[_0x42ce('0x41')]=_0x4ea829;return _0x399ece;})[_0x42ce('0x26')](respondWithFilteredResult(_0x46310b,_0x28fe7a))[_0x42ce('0x42')](handleError(_0x46310b,null));};exports['show']=function(_0xaf5604,_0x2077e3){var _0x26f68e={'raw':!![],'where':{'id':_0xaf5604[_0x42ce('0x43')]['id']}},_0x397f40={};_0x397f40[_0x42ce('0x2d')]=_[_0x42ce('0x30')](db[_0x42ce('0x3e')]['rawAttributes']);_0x397f40[_0x42ce('0x2f')]=_[_0x42ce('0x30')](_0xaf5604[_0x42ce('0x2f')]);_0x397f40[_0x42ce('0x31')]=_[_0x42ce('0x33')](_0x397f40[_0x42ce('0x2d')],_0x397f40[_0x42ce('0x2f')]);_0x26f68e['attributes']=_['intersection'](_0x397f40[_0x42ce('0x2d')],qs[_0x42ce('0x34')](_0xaf5604[_0x42ce('0x2f')][_0x42ce('0x34')]));_0x26f68e[_0x42ce('0x32')]=_0x26f68e[_0x42ce('0x32')]['length']?_0x26f68e[_0x42ce('0x32')]:_0x397f40['model'];if(_0xaf5604[_0x42ce('0x2f')][_0x42ce('0x3f')]){_0x26f68e[_0x42ce('0x40')]=[{'all':!![]}];}_0x26f68e=_[_0x42ce('0x3b')]({},_0x26f68e,_0xaf5604[_0x42ce('0x44')]);return db[_0x42ce('0x3e')]['find'](_0x26f68e)[_0x42ce('0x26')](handleEntityNotFound(_0x2077e3,null))['then'](respondWithResult(_0x2077e3,null))[_0x42ce('0x42')](handleError(_0x2077e3,null));};exports[_0x42ce('0x45')]=function(_0x1914cc,_0x379030){return db[_0x42ce('0x3e')][_0x42ce('0x45')](_0x1914cc[_0x42ce('0x46')],{})['then'](respondWithResult(_0x379030,0xc9))[_0x42ce('0x42')](handleError(_0x379030,null));};exports['update']=function(_0x553d8d,_0x426763){if(_0x553d8d['body']['id']){delete _0x553d8d[_0x42ce('0x46')]['id'];}return db[_0x42ce('0x3e')][_0x42ce('0x47')]({'where':{'id':_0x553d8d['params']['id']}})[_0x42ce('0x26')](handleEntityNotFound(_0x426763,null))['then'](saveUpdates(_0x553d8d[_0x42ce('0x46')],null))[_0x42ce('0x26')](respondWithResult(_0x426763,null))[_0x42ce('0x42')](handleError(_0x426763,null));};exports['destroy']=function(_0x278960,_0x24663f){return db[_0x42ce('0x3e')][_0x42ce('0x47')]({'where':{'id':_0x278960[_0x42ce('0x43')]['id']}})[_0x42ce('0x26')](handleEntityNotFound(_0x24663f,null))[_0x42ce('0x26')](removeEntity(_0x24663f,null))[_0x42ce('0x42')](handleError(_0x24663f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index ba6ba76..9c5b7cc 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 _0x8489=['exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x8489,0x10f));var _0x9848=function(_0x16fea5,_0x566b5d){_0x16fea5=_0x16fea5-0x0;var _0x5c9681=_0x8489[_0x16fea5];return _0x5c9681;};'use strict';var _=require(_0x9848('0x0'));var util=require(_0x9848('0x1'));var logger=require(_0x9848('0x2'))(_0x9848('0x3'));var moment=require(_0x9848('0x4'));var BPromise=require(_0x9848('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9848('0x6'));var rimraf=require(_0x9848('0x7'));var config=require(_0x9848('0x8'));var attributes=require('./faxApplication.attributes');module[_0x9848('0x9')]=function(_0x270782,_0x49efef){return _0x270782[_0x9848('0xa')](_0x9848('0xb'),attributes,{'tableName':_0x9848('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9848('0xd')});}; \ No newline at end of file +var _0xdf53=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x19fcae,_0x3e5b1c){var _0x3f6cef=function(_0x555e05){while(--_0x555e05){_0x19fcae['push'](_0x19fcae['shift']());}};_0x3f6cef(++_0x3e5b1c);}(_0xdf53,0x1c9));var _0x3df5=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdf53[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x3df5('0x0'));var util=require(_0x3df5('0x1'));var logger=require(_0x3df5('0x2'))(_0x3df5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3df5('0x4'));var rimraf=require(_0x3df5('0x5'));var config=require(_0x3df5('0x6'));var attributes=require(_0x3df5('0x7'));module[_0x3df5('0x8')]=function(_0x18d77c,_0x31c5ca){return _0x18d77c[_0x3df5('0x9')](_0x3df5('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3df5('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 2a22958..8692243 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 _0x61bb=['update','body','options','where','attributes','UpdateFaxApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','FaxApplication'];(function(_0x185bdb,_0x5d7cce){var _0x308c39=function(_0x3ee4d4){while(--_0x3ee4d4){_0x185bdb['push'](_0x185bdb['shift']());}};_0x308c39(++_0x5d7cce);}(_0x61bb,0xa1));var _0xb61b=function(_0x2511c1,_0xf4e1d7){_0x2511c1=_0x2511c1-0x0;var _0x25597a=_0x61bb[_0x2511c1];return _0x25597a;};'use strict';var _=require('lodash');var util=require(_0xb61b('0x0'));var moment=require(_0xb61b('0x1'));var BPromise=require(_0xb61b('0x2'));var rs=require(_0xb61b('0x3'));var fs=require('fs');var Redis=require(_0xb61b('0x4'));var db=require(_0xb61b('0x5'))['db'];var utils=require(_0xb61b('0x6'));var logger=require(_0xb61b('0x7'))(_0xb61b('0x8'));var config=require(_0xb61b('0x9'));var jayson=require(_0xb61b('0xa'));var client=jayson[_0xb61b('0xb')][_0xb61b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56e7c4,_0x3c0798,_0x4e5f16){return new BPromise(function(_0x5a3c8b,_0x5a7d57){return client[_0xb61b('0xd')](_0x56e7c4,_0x4e5f16)[_0xb61b('0xe')](function(_0x5bef06){logger[_0xb61b('0xf')](_0xb61b('0x10'),_0x3c0798,_0xb61b('0x11'));logger[_0xb61b('0x12')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3c0798,_0xb61b('0x11'),JSON[_0xb61b('0x13')](_0x5bef06));if(_0x5bef06[_0xb61b('0x14')]){if(_0x5bef06[_0xb61b('0x14')]['code']===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x3c0798,_0x5bef06[_0xb61b('0x14')][_0xb61b('0x15')]);return _0x5a7d57(_0x5bef06[_0xb61b('0x14')][_0xb61b('0x15')]);}logger['error'](_0xb61b('0x10'),_0x3c0798,_0x5bef06['error'][_0xb61b('0x15')]);return _0x5a3c8b(_0x5bef06['error'][_0xb61b('0x15')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x3c0798,_0xb61b('0x11'));_0x5a3c8b(_0x5bef06[_0xb61b('0x16')][_0xb61b('0x15')]);}})[_0xb61b('0x17')](function(_0x283b2c){logger[_0xb61b('0x14')](_0xb61b('0x10'),_0x3c0798,_0x283b2c);_0x5a7d57(_0x283b2c);});});}exports['UpdateFaxApplication']=function(_0x36bd6d){var _0x41c081=this;return new Promise(function(_0x3c2be3,_0xe320d0){return db[_0xb61b('0x18')][_0xb61b('0x19')](_0x36bd6d[_0xb61b('0x1a')],{'raw':_0x36bd6d[_0xb61b('0x1b')]?_0x36bd6d[_0xb61b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36bd6d[_0xb61b('0x1b')]?_0x36bd6d['options'][_0xb61b('0x1c')]||null:null,'attributes':_0x36bd6d[_0xb61b('0x1b')]?_0x36bd6d[_0xb61b('0x1b')][_0xb61b('0x1d')]||null:null,'limit':_0x36bd6d['options']?_0x36bd6d[_0xb61b('0x1b')]['limit']||null:null})['then'](function(_0x589980){logger[_0xb61b('0xf')](_0xb61b('0x1e'),_0x36bd6d);logger[_0xb61b('0x12')](_0xb61b('0x1e'),_0x36bd6d,JSON['stringify'](_0x589980));_0x3c2be3(_0x589980);})['catch'](function(_0x5821b4){logger[_0xb61b('0x14')](_0xb61b('0x1e'),_0x5821b4['message'],_0x36bd6d);_0xe320d0(_0x41c081['error'](0x1f4,_0x5821b4[_0xb61b('0x15')]));});});}; \ No newline at end of file +var _0x9335=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','lodash','util','bluebird'];(function(_0x4f5132,_0x16cde7){var _0x1de762=function(_0x4f63d5){while(--_0x4f63d5){_0x4f5132['push'](_0x4f5132['shift']());}};_0x1de762(++_0x16cde7);}(_0x9335,0xab));var _0x5933=function(_0x13f963,_0x414959){_0x13f963=_0x13f963-0x0;var _0x5c6160=_0x9335[_0x13f963];return _0x5c6160;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var moment=require('moment');var BPromise=require(_0x5933('0x2'));var rs=require(_0x5933('0x3'));var fs=require('fs');var Redis=require(_0x5933('0x4'));var db=require(_0x5933('0x5'))['db'];var utils=require(_0x5933('0x6'));var logger=require(_0x5933('0x7'))(_0x5933('0x8'));var config=require('../../config/environment');var jayson=require(_0x5933('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21f4c1,_0x3f15fc,_0x21ab46){return new BPromise(function(_0x59c5cb,_0x2ad740){return client[_0x5933('0xa')](_0x21f4c1,_0x21ab46)[_0x5933('0xb')](function(_0xbcd6bb){logger[_0x5933('0xc')](_0x5933('0xd'),_0x3f15fc,_0x5933('0xe'));logger[_0x5933('0xf')](_0x5933('0x10'),_0x3f15fc,_0x5933('0xe'),JSON[_0x5933('0x11')](_0xbcd6bb));if(_0xbcd6bb[_0x5933('0x12')]){if(_0xbcd6bb[_0x5933('0x12')]['code']===0x1f4){logger[_0x5933('0x12')]('FaxApplication,\x20%s,\x20%s',_0x3f15fc,_0xbcd6bb[_0x5933('0x12')][_0x5933('0x13')]);return _0x2ad740(_0xbcd6bb[_0x5933('0x12')]['message']);}logger[_0x5933('0x12')]('FaxApplication,\x20%s,\x20%s',_0x3f15fc,_0xbcd6bb[_0x5933('0x12')]['message']);return _0x59c5cb(_0xbcd6bb[_0x5933('0x12')]['message']);}else{logger[_0x5933('0xc')]('FaxApplication,\x20%s,\x20%s',_0x3f15fc,_0x5933('0xe'));_0x59c5cb(_0xbcd6bb[_0x5933('0x14')][_0x5933('0x13')]);}})['catch'](function(_0x48dc5b){logger[_0x5933('0x12')](_0x5933('0xd'),_0x3f15fc,_0x48dc5b);_0x2ad740(_0x48dc5b);});});}exports[_0x5933('0x15')]=function(_0x51a525){var _0x4a4d3f=this;return new Promise(function(_0x15263f,_0x480e67){return db[_0x5933('0x16')][_0x5933('0x17')](_0x51a525[_0x5933('0x18')],{'raw':_0x51a525['options']?_0x51a525[_0x5933('0x19')][_0x5933('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51a525[_0x5933('0x19')]?_0x51a525['options'][_0x5933('0x1b')]||null:null,'attributes':_0x51a525['options']?_0x51a525[_0x5933('0x19')]['attributes']||null:null,'limit':_0x51a525[_0x5933('0x19')]?_0x51a525['options'][_0x5933('0x1c')]||null:null})['then'](function(_0x54a25a){logger['info']('UpdateFaxApplication',_0x51a525);logger[_0x5933('0xf')]('UpdateFaxApplication',_0x51a525,JSON[_0x5933('0x11')](_0x54a25a));_0x15263f(_0x54a25a);})['catch'](function(_0x4f538a){logger[_0x5933('0x12')](_0x5933('0x15'),_0x4f538a[_0x5933('0x13')],_0x51a525);_0x480e67(_0x4a4d3f['error'](0x1f4,_0x4f538a[_0x5933('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 24edfba..2c5dd43 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x528f09,_0x2ebe0f){var _0x33f4ae=function(_0x748ca5){while(--_0x748ca5){_0x528f09['push'](_0x528f09['shift']());}};_0x33f4ae(++_0x2ebe0f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x0972=['isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x22895a,_0x372810){var _0x4e067c=function(_0x490dcb){while(--_0x490dcb){_0x22895a['push'](_0x22895a['shift']());}};_0x4e067c(++_0x372810);}(_0x0972,0x64));var _0x2097=function(_0x90b0e,_0x5ce393){_0x90b0e=_0x90b0e-0x0;var _0x254782=_0x0972[_0x90b0e];return _0x254782;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var fs_extra=require(_0x2097('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var controller=require(_0x2097('0x6'));router[_0x2097('0x7')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0x7')]('/:id',auth[_0x2097('0x8')](),controller[_0x2097('0xa')]);router[_0x2097('0xb')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0xc')]);router['put'](_0x2097('0xd'),auth[_0x2097('0x8')](),controller[_0x2097('0xe')]);router[_0x2097('0xf')](_0x2097('0xd'),auth[_0x2097('0x8')](),controller[_0x2097('0x10')]);module[_0x2097('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 48094ac..691f58f 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 _0x578c=['out','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x578c,0x158));var _0xc578=function(_0x6e7061,_0x7d6347){_0x6e7061=_0x6e7061-0x0;var _0x9f40cb=_0x578c[_0x6e7061];return _0x9f40cb;};'use strict';var Sequelize=require(_0xc578('0x0'));module[_0xc578('0x1')]={'closed':{'type':Sequelize[_0xc578('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc578('0x3')]},'secondDisposition':{'type':Sequelize[_0xc578('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc578('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc578('0x4')]},'fax':{'type':Sequelize[_0xc578('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc578('0x5')]('in',_0xc578('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc578('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc578('0x5')]('in',_0xc578('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb071=['BOOLEAN','DATE','STRING','ENUM','exports'];(function(_0x51fe86,_0x422b66){var _0x3557d4=function(_0x524a6a){while(--_0x524a6a){_0x51fe86['push'](_0x51fe86['shift']());}};_0x3557d4(++_0x422b66);}(_0xb071,0xea));var _0x1b07=function(_0x491001,_0x2e13ee){_0x491001=_0x491001-0x0;var _0x2971ef=_0xb071[_0x491001];return _0x2971ef;};'use strict';var Sequelize=require('sequelize');module[_0x1b07('0x0')]={'closed':{'type':Sequelize[_0x1b07('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1b07('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1b07('0x3')]},'note':{'type':Sequelize[_0x1b07('0x3')]},'read1stAt':{'type':Sequelize[_0x1b07('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x1b07('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1b07('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'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 126cbbd..8e4b43c 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 _0x2a4d=['removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','resolve','log','err','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','offset','limit','set','Content-Range','update','then','end','stack','name','send','index','map','rawAttributes','key','getOptions','findAll','fax','query','user','show','params','model','FaxInteraction','filters','intersection','fields','attributes','length','include','options','find','catch','create','body','destroy','describe','addMessage','ids','omit','findOne','keys','sort','where','pick','FaxInteractionId','filter','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','count','includeAll','addTags','setTags','spread','Tag','emit','faxInteractionTags:save'];(function(_0x3ffd44,_0x13bdd5){var _0x229a89=function(_0x527ab3){while(--_0x527ab3){_0x3ffd44['push'](_0x3ffd44['shift']());}};_0x229a89(++_0x13bdd5);}(_0x2a4d,0x1ab));var _0xd2a4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2a4d[_0x4b055c];return _0x4b62bb;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd2a4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xd2a4('0x1'));var path=require(_0xd2a4('0x2'));var fs=require('fs');var _=require(_0xd2a4('0x3'));var Redis=require(_0xd2a4('0x4'));var interaction=require(_0xd2a4('0x5'));var qs=require(_0xd2a4('0x6'));var logger=require(_0xd2a4('0x7'))(_0xd2a4('0x8'));var config=require(_0xd2a4('0x9'));var db=require(_0xd2a4('0xa'))['db'];config[_0xd2a4('0xb')]=_[_0xd2a4('0xc')](config[_0xd2a4('0xb')],{'host':_0xd2a4('0xd'),'port':0x18eb});var socket=require(_0xd2a4('0xe'))(new Redis(config[_0xd2a4('0xb')]));require('./faxInteraction.socket')[_0xd2a4('0xf')](socket);function respondWithStatusCode(_0x4a6075,_0x5c7977){_0x5c7977=_0x5c7977||0xcc;return function(_0x487121){if(_0x487121){return _0x4a6075[_0xd2a4('0x10')](_0x5c7977);}return _0x4a6075[_0xd2a4('0x11')](_0x5c7977)['end']();};}function respondWithResult(_0x1dce8c,_0x1b3701){_0x1b3701=_0x1b3701||0xc8;return function(_0x1c4c9d){if(_0x1c4c9d){return _0x1dce8c[_0xd2a4('0x11')](_0x1b3701)[_0xd2a4('0x12')](_0x1c4c9d);}};}function respondWithFilteredResult(_0x352a11,_0xd9ec4a){return function(_0x5b7699){if(_0x5b7699){var _0x174ed7=typeof _0xd9ec4a['offset']===_0xd2a4('0x13')&&typeof _0xd9ec4a['limit']===_0xd2a4('0x13');var _0xea2364=_0x5b7699['count'];var _0x3668dc=_0x174ed7?0x0:_0xd9ec4a[_0xd2a4('0x14')];var _0x436dc5=_0x174ed7?_0x5b7699['count']:_0xd9ec4a[_0xd2a4('0x14')]+_0xd9ec4a[_0xd2a4('0x15')];var _0xbf4444;if(_0x436dc5>=_0xea2364){_0x436dc5=_0xea2364;_0xbf4444=0xc8;}else{_0xbf4444=0xce;}_0x352a11[_0xd2a4('0x11')](_0xbf4444);return _0x352a11[_0xd2a4('0x16')](_0xd2a4('0x17'),_0x3668dc+'-'+_0x436dc5+'/'+_0xea2364)[_0xd2a4('0x12')](_0x5b7699);}return null;};}function saveUpdates(_0x43d920){return function(_0xd5213a){if(_0xd5213a){return _0xd5213a[_0xd2a4('0x18')](_0x43d920)[_0xd2a4('0x19')](function(_0xf62195){return _0xf62195;});}return null;};}function removeEntity(_0x103e00){return function(_0x5aa638){if(_0x5aa638){return _0x5aa638['destroy']()['then'](function(){_0x103e00['status'](0xcc)[_0xd2a4('0x1a')]();});}};}function handleEntityNotFound(_0x1fe790){return function(_0x5a5c92){if(!_0x5a5c92){_0x1fe790['sendStatus'](0x194);}return _0x5a5c92;};}function handleError(_0x1a948a,_0x4dd26d){_0x4dd26d=_0x4dd26d||0x1f4;return function(_0x66c315){logger['error'](_0x66c315[_0xd2a4('0x1b')]);if(_0x66c315[_0xd2a4('0x1c')]){delete _0x66c315[_0xd2a4('0x1c')];}_0x1a948a[_0xd2a4('0x11')](_0x4dd26d)[_0xd2a4('0x1d')](_0x66c315);};}exports[_0xd2a4('0x1e')]=function(_0x3ef6d5,_0x5e3d5d){var _0x34b076={};var _0x171dd1=_[_0xd2a4('0x1f')](db['FaxInteraction'][_0xd2a4('0x20')],function(_0x100418){return{'name':_0x100418['fieldName'],'type':_0x100418['type'][_0xd2a4('0x21')]};});_0x34b076=qs[_0xd2a4('0x22')](_0x171dd1,_0x3ef6d5);return interaction[_0xd2a4('0x23')](_0xd2a4('0x24'),_0x3ef6d5[_0xd2a4('0x25')],_0x3ef6d5[_0xd2a4('0x26')],_0x34b076,_0x171dd1)[_0xd2a4('0x19')](respondWithFilteredResult(_0x5e3d5d,_0x34b076))['catch'](handleError(_0x5e3d5d,null));};exports[_0xd2a4('0x27')]=function(_0x47526c,_0x560da3){var _0x22c3d2={'raw':![],'where':{'id':_0x47526c[_0xd2a4('0x28')]['id']}},_0x5b9b28={};_0x5b9b28[_0xd2a4('0x29')]=_['keys'](db[_0xd2a4('0x2a')][_0xd2a4('0x20')]);_0x5b9b28[_0xd2a4('0x25')]=_['keys'](_0x47526c['query']);_0x5b9b28[_0xd2a4('0x2b')]=_[_0xd2a4('0x2c')](_0x5b9b28['model'],_0x5b9b28[_0xd2a4('0x25')]);_0x22c3d2['attributes']=_[_0xd2a4('0x2c')](_0x5b9b28['model'],qs[_0xd2a4('0x2d')](_0x47526c[_0xd2a4('0x25')][_0xd2a4('0x2d')]));_0x22c3d2[_0xd2a4('0x2e')]=_0x22c3d2[_0xd2a4('0x2e')][_0xd2a4('0x2f')]?_0x22c3d2[_0xd2a4('0x2e')]:_0x5b9b28[_0xd2a4('0x29')];if(_0x47526c[_0xd2a4('0x25')]['includeAll']){_0x22c3d2[_0xd2a4('0x30')]=[{'all':!![]}];}_0x22c3d2=_['merge']({},_0x22c3d2,_0x47526c[_0xd2a4('0x31')]);return db[_0xd2a4('0x2a')][_0xd2a4('0x32')](_0x22c3d2)['then'](handleEntityNotFound(_0x560da3,null))['then'](respondWithResult(_0x560da3,null))[_0xd2a4('0x33')](handleError(_0x560da3,null));};exports[_0xd2a4('0x34')]=function(_0x287057,_0x1b887b){return db['FaxInteraction'][_0xd2a4('0x34')](_0x287057['body'],{})['then'](respondWithResult(_0x1b887b,0xc9))[_0xd2a4('0x33')](handleError(_0x1b887b,null));};exports[_0xd2a4('0x18')]=function(_0x4a5c7f,_0x1ecd6e){if(_0x4a5c7f['body']['id']){delete _0x4a5c7f[_0xd2a4('0x35')]['id'];}return db['FaxInteraction'][_0xd2a4('0x32')]({'where':{'id':_0x4a5c7f[_0xd2a4('0x28')]['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x1ecd6e,null))[_0xd2a4('0x19')](saveUpdates(_0x4a5c7f['body'],null))['then'](respondWithResult(_0x1ecd6e,null))[_0xd2a4('0x33')](handleError(_0x1ecd6e,null));};exports[_0xd2a4('0x36')]=function(_0x25bf84,_0x345b2f){return db['FaxInteraction']['find']({'where':{'id':_0x25bf84[_0xd2a4('0x28')]['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x345b2f,null))[_0xd2a4('0x19')](removeEntity(_0x345b2f,null))[_0xd2a4('0x33')](handleError(_0x345b2f,null));};exports['describe']=function(_0x400eff,_0x550d59){return db[_0xd2a4('0x2a')][_0xd2a4('0x37')]()['then'](respondWithResult(_0x550d59,null))[_0xd2a4('0x33')](handleError(_0x550d59,null));};exports[_0xd2a4('0x38')]=function(_0x384581,_0x32a1a4){return db['FaxMessage'][_0xd2a4('0x32')]({'where':{'id':_0x384581['params']['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x32a1a4,null))[_0xd2a4('0x19')](function(_0x4174b9){if(_0x4174b9){return _0x4174b9[_0xd2a4('0x38')](_0x384581[_0xd2a4('0x35')][_0xd2a4('0x39')],_[_0xd2a4('0x3a')](_0x384581[_0xd2a4('0x35')],[_0xd2a4('0x39'),'id'])||{});}})[_0xd2a4('0x19')](respondWithResult(_0x32a1a4,null))[_0xd2a4('0x33')](handleError(_0x32a1a4,null));};exports['getMessages']=function(_0x579b59,_0x446b41){var _0x49bb2d={'raw':![],'where':{}};var _0x2bcc2f={};var _0x3cb04c={'count':0x0,'rows':[]};return db[_0xd2a4('0x2a')][_0xd2a4('0x3b')]({'where':{'id':_0x579b59[_0xd2a4('0x28')]['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x446b41,null))['then'](function(_0x2eed30){if(_0x2eed30){_0x2bcc2f[_0xd2a4('0x29')]=_[_0xd2a4('0x3c')](db['FaxMessage'][_0xd2a4('0x20')]);_0x2bcc2f[_0xd2a4('0x25')]=_['keys'](_0x579b59[_0xd2a4('0x25')]);_0x2bcc2f[_0xd2a4('0x2b')]=_[_0xd2a4('0x2c')](_0x2bcc2f[_0xd2a4('0x29')],_0x2bcc2f[_0xd2a4('0x25')]);_0x49bb2d[_0xd2a4('0x2e')]=_[_0xd2a4('0x2c')](_0x2bcc2f[_0xd2a4('0x29')],qs[_0xd2a4('0x2d')](_0x579b59['query'][_0xd2a4('0x2d')]));_0x49bb2d[_0xd2a4('0x2e')]=_0x49bb2d['attributes'][_0xd2a4('0x2f')]?_0x49bb2d[_0xd2a4('0x2e')]:_0x2bcc2f[_0xd2a4('0x29')];if(!_0x579b59[_0xd2a4('0x25')]['hasOwnProperty']('nolimit')){_0x49bb2d[_0xd2a4('0x15')]=qs[_0xd2a4('0x15')](_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x15')]);_0x49bb2d['offset']=qs[_0xd2a4('0x14')](_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x14')]);}_0x49bb2d['order']=qs[_0xd2a4('0x3d')](_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x3d')]);_0x49bb2d[_0xd2a4('0x3e')]=qs[_0xd2a4('0x2b')](_[_0xd2a4('0x3f')](_0x579b59[_0xd2a4('0x25')],_0x2bcc2f[_0xd2a4('0x2b')]));_0x49bb2d[_0xd2a4('0x3e')][_0xd2a4('0x40')]=_0x2eed30['id'];if(_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x41')]){_0x49bb2d[_0xd2a4('0x3e')]=_[_0xd2a4('0x42')](_0x49bb2d['where'],{'$or':_['map'](_0x49bb2d[_0xd2a4('0x2e')],function(_0x1ed9c8){var _0x4fb79={};_0x4fb79[_0x1ed9c8]={'$like':'%'+_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x41')]+'%'};return _0x4fb79;})});}if(_0x579b59[_0xd2a4('0x25')]['$gte']){var _0x3ce7c1=_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x43')]['split'](',');var _0x3b3e01={};_0x3b3e01[_0x3ce7c1[0x0]]={'$gte':moment(_0x3ce7c1[0x1])['format'](_0xd2a4('0x44'))};_0x49bb2d[_0xd2a4('0x3e')]=_['merge'](_0x49bb2d[_0xd2a4('0x3e')],_0x3b3e01);}_0x49bb2d=_['merge']({},_0x49bb2d,_0x579b59[_0xd2a4('0x31')]);return db[_0xd2a4('0x45')][_0xd2a4('0x46')]({'where':_0x49bb2d[_0xd2a4('0x3e')]})[_0xd2a4('0x19')](function(_0x485a58){_0x3cb04c['count']=_0x485a58;if(_0x579b59[_0xd2a4('0x25')][_0xd2a4('0x47')]){_0x49bb2d[_0xd2a4('0x30')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x49bb2d);})[_0xd2a4('0x19')](function(_0x27119d){_0x3cb04c['rows']=_0x27119d;return _0x3cb04c;});}})['then'](respondWithFilteredResult(_0x446b41,_0x49bb2d))['catch'](handleError(_0x446b41,null));};exports[_0xd2a4('0x48')]=function(_0x544e79,_0x1a0dca){return db[_0xd2a4('0x2a')][_0xd2a4('0x32')]({'where':{'id':_0x544e79[_0xd2a4('0x28')]['id']}})['then'](handleEntityNotFound(_0x1a0dca,null))[_0xd2a4('0x19')](function(_0x4125a3){if(_0x4125a3){return _0x4125a3[_0xd2a4('0x49')](_0x544e79[_0xd2a4('0x35')][_0xd2a4('0x39')],_[_0xd2a4('0x3a')](_0x544e79[_0xd2a4('0x35')],[_0xd2a4('0x39'),'id'])||{})[_0xd2a4('0x4a')](function(){return db[_0xd2a4('0x4b')]['findAll']({'attributes':['id',_0xd2a4('0x1c'),'color'],'where':{'id':_0x544e79[_0xd2a4('0x35')][_0xd2a4('0x39')]}});})[_0xd2a4('0x19')](function(_0x141311){socket[_0xd2a4('0x4c')](_0xd2a4('0x4d'),{'id':Number(_0x544e79[_0xd2a4('0x28')]['id']),'tags':_0x141311||[]});return{'id':Number(_0x544e79[_0xd2a4('0x28')]['id']),'tags':_0x141311||[]};});}})[_0xd2a4('0x19')](respondWithResult(_0x1a0dca,null))[_0xd2a4('0x33')](handleError(_0x1a0dca,null));};exports[_0xd2a4('0x4e')]=function(_0x5911a8,_0x5879e3){return db[_0xd2a4('0x2a')][_0xd2a4('0x32')]({'where':{'id':_0x5911a8[_0xd2a4('0x28')]['id']}})[_0xd2a4('0x19')](handleEntityNotFound(_0x5879e3,null))[_0xd2a4('0x19')](function(_0x24c2c8){if(_0x24c2c8){return _0x24c2c8[_0xd2a4('0x4e')](_0x5911a8['query'][_0xd2a4('0x39')]);}})[_0xd2a4('0x19')](respondWithStatusCode(_0x5879e3,null))['catch'](handleError(_0x5879e3,null));};exports[_0xd2a4('0x4f')]=function(_0x2c83b5,_0xd1a430){var _0x1b60f1=moment()[_0xd2a4('0x50')]()[_0xd2a4('0x51')]();var _0x38620b=path[_0xd2a4('0x52')](config[_0xd2a4('0x53')],_0xd2a4('0x54'),_0xd2a4('0x55'),_0xd2a4('0x56'));var _0x2c48c5=path[_0xd2a4('0x52')](config[_0xd2a4('0x53')],_0xd2a4('0x54'),_0xd2a4('0x55'),_0xd2a4('0x57'));var _0x1d9689=path[_0xd2a4('0x52')](_0x38620b,_0x1b60f1);var _0x5f4df3=util[_0xd2a4('0x58')](_0xd2a4('0x59'),_0x2c83b5[_0xd2a4('0x28')]['id'],_0x1b60f1);var _0x18430d=path[_0xd2a4('0x52')](_0x38620b,_0x5f4df3);var _0x567b8f=[];_0x567b8f['push']({'model':db[_0xd2a4('0x5a')],'as':_0xd2a4('0x5a'),'raw':!![]});var _0x25f6c9=[{'model':db[_0xd2a4('0x45')],'as':_0xd2a4('0x5b'),'attributes':['id',_0xd2a4('0x35'),_0xd2a4('0x5c')],'include':_0x567b8f}];return db[_0xd2a4('0x2a')]['find']({'where':{'id':_0x2c83b5[_0xd2a4('0x28')]['id']},'include':_0x25f6c9})[_0xd2a4('0x19')](handleEntityNotFound(_0xd1a430,null))[_0xd2a4('0x19')](function(_0x1876aa){if(_0x1876aa&&_0x1876aa[_0xd2a4('0x5b')]){var _0x3ad538=_0x1876aa[_0xd2a4('0x5d')]({'plain':!![]});fs[_0xd2a4('0x5e')](_0x1d9689);for(var _0x2ab582=0x0;_0x2ab582<_0x3ad538[_0xd2a4('0x5b')]['length'];_0x2ab582++){var _0x597dc8=_0x3ad538[_0xd2a4('0x5b')][_0x2ab582][_0xd2a4('0x5a')];if(_0x597dc8){var _0xa1efa7=path[_0xd2a4('0x52')](_0x2c48c5,_0x597dc8[_0xd2a4('0x5f')]);if(fs[_0xd2a4('0x60')](_0xa1efa7)){fs[_0xd2a4('0x61')](_0xa1efa7)['pipe'](fs['createWriteStream'](path[_0xd2a4('0x52')](_0x1d9689,_0x597dc8[_0xd2a4('0x5f')])));}}}return BPromise[_0xd2a4('0x62')]()['then'](function(){return new BPromise(function(_0x4abc6f,_0x39b6c2){zipdir(_0x1d9689,{'saveTo':_0x18430d},function(_0x43123c,_0x228b8f){if(_0x43123c)return _0x39b6c2(_0x43123c);return _0x4abc6f(_0x228b8f);});})['then'](function(){return new BPromise(function(_0xb506f1,_0x4e6885){rimraf(_0x1d9689,function(_0x86b3fb){if(_0x86b3fb)_0x4e6885(_0x86b3fb);return _0xb506f1();});});})[_0xd2a4('0x19')](function(){return _0xd1a430[_0xd2a4('0x4f')](_0x18430d,_0x5f4df3,function(_0x3f7566){if(_0x3f7566){console[_0xd2a4('0x63')](_0xd2a4('0x64'),_0x3f7566);}else{fs['unlinkSync'](_0x18430d);}});});});}else{return _0xd1a430[_0xd2a4('0x10')](0xc8);}})[_0xd2a4('0x33')](handleError(_0xd1a430,null));}; \ No newline at end of file +var _0xb0bd=['include','merge','options','create','find','body','describe','addMessage','FaxMessage','omit','getMessages','findOne','order','sort','where','pick','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','ids','spread','removeTags','download','unix','toString','join','server','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','user','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll'];(function(_0x834658,_0x2d5d58){var _0x3090c3=function(_0x10104a){while(--_0x10104a){_0x834658['push'](_0x834658['shift']());}};_0x3090c3(++_0x2d5d58);}(_0xb0bd,0x161));var _0xdb0b=function(_0x65c9b5,_0x265552){_0x65c9b5=_0x65c9b5-0x0;var _0x38c80d=_0xb0bd[_0x65c9b5];return _0x38c80d;};'use strict';var rimraf=require(_0xdb0b('0x0'));var zipdir=require(_0xdb0b('0x1'));var moment=require(_0xdb0b('0x2'));var BPromise=require('bluebird');var util=require(_0xdb0b('0x3'));var path=require(_0xdb0b('0x4'));var fs=require('fs');var _=require(_0xdb0b('0x5'));var Redis=require('ioredis');var interaction=require(_0xdb0b('0x6'));var qs=require(_0xdb0b('0x7'));var logger=require(_0xdb0b('0x8'))(_0xdb0b('0x9'));var config=require(_0xdb0b('0xa'));var db=require(_0xdb0b('0xb'))['db'];config['redis']=_[_0xdb0b('0xc')](config['redis'],{'host':_0xdb0b('0xd'),'port':0x18eb});var socket=require(_0xdb0b('0xe'))(new Redis(config[_0xdb0b('0xf')]));require('./faxInteraction.socket')[_0xdb0b('0x10')](socket);function respondWithStatusCode(_0x3a4b57,_0x19c6be){_0x19c6be=_0x19c6be||0xcc;return function(_0x43227c){if(_0x43227c){return _0x3a4b57[_0xdb0b('0x11')](_0x19c6be);}return _0x3a4b57['status'](_0x19c6be)[_0xdb0b('0x12')]();};}function respondWithResult(_0x4b6039,_0xdf917f){_0xdf917f=_0xdf917f||0xc8;return function(_0x1c7706){if(_0x1c7706){return _0x4b6039[_0xdb0b('0x13')](_0xdf917f)[_0xdb0b('0x14')](_0x1c7706);}};}function respondWithFilteredResult(_0x27a21e,_0x549287){return function(_0x14bb15){if(_0x14bb15){var _0x279220=typeof _0x549287[_0xdb0b('0x15')]==='undefined'&&typeof _0x549287['limit']===_0xdb0b('0x16');var _0x31555a=_0x14bb15[_0xdb0b('0x17')];var _0x4f1dfe=_0x279220?0x0:_0x549287[_0xdb0b('0x15')];var _0x1621e6=_0x279220?_0x14bb15['count']:_0x549287['offset']+_0x549287[_0xdb0b('0x18')];var _0x517d49;if(_0x1621e6>=_0x31555a){_0x1621e6=_0x31555a;_0x517d49=0xc8;}else{_0x517d49=0xce;}_0x27a21e[_0xdb0b('0x13')](_0x517d49);return _0x27a21e[_0xdb0b('0x19')](_0xdb0b('0x1a'),_0x4f1dfe+'-'+_0x1621e6+'/'+_0x31555a)[_0xdb0b('0x14')](_0x14bb15);}return null;};}function saveUpdates(_0x4227fa){return function(_0x2a6efd){if(_0x2a6efd){return _0x2a6efd[_0xdb0b('0x1b')](_0x4227fa)[_0xdb0b('0x1c')](function(_0x2b1889){return _0x2b1889;});}return null;};}function removeEntity(_0x55e763){return function(_0x5441aa){if(_0x5441aa){return _0x5441aa[_0xdb0b('0x1d')]()[_0xdb0b('0x1c')](function(){_0x55e763['status'](0xcc)[_0xdb0b('0x12')]();});}};}function handleEntityNotFound(_0x4259e5){return function(_0x5c172c){if(!_0x5c172c){_0x4259e5['sendStatus'](0x194);}return _0x5c172c;};}function handleError(_0x1d9a45,_0x5632c4){_0x5632c4=_0x5632c4||0x1f4;return function(_0x3f6aa5){logger[_0xdb0b('0x1e')](_0x3f6aa5[_0xdb0b('0x1f')]);if(_0x3f6aa5[_0xdb0b('0x20')]){delete _0x3f6aa5[_0xdb0b('0x20')];}_0x1d9a45[_0xdb0b('0x13')](_0x5632c4)[_0xdb0b('0x21')](_0x3f6aa5);};}exports[_0xdb0b('0x22')]=function(_0x298651,_0x1e496e){var _0x498bde={};var _0x1e4de0=_[_0xdb0b('0x23')](db[_0xdb0b('0x24')][_0xdb0b('0x25')],function(_0x6fd6){return{'name':_0x6fd6[_0xdb0b('0x26')],'type':_0x6fd6[_0xdb0b('0x27')]['key']};});_0x498bde=qs[_0xdb0b('0x28')](_0x1e4de0,_0x298651);return interaction[_0xdb0b('0x29')]('fax',_0x298651[_0xdb0b('0x2a')],_0x298651[_0xdb0b('0x2b')],_0x498bde,_0x1e4de0)['then'](respondWithFilteredResult(_0x1e496e,_0x498bde))[_0xdb0b('0x2c')](handleError(_0x1e496e,null));};exports[_0xdb0b('0x2d')]=function(_0x386aa9,_0x33c228){var _0x4a570a={'raw':![],'where':{'id':_0x386aa9[_0xdb0b('0x2e')]['id']}},_0xcafd8b={};_0xcafd8b['model']=_['keys'](db[_0xdb0b('0x24')][_0xdb0b('0x25')]);_0xcafd8b['query']=_[_0xdb0b('0x2f')](_0x386aa9[_0xdb0b('0x2a')]);_0xcafd8b[_0xdb0b('0x30')]=_[_0xdb0b('0x31')](_0xcafd8b[_0xdb0b('0x32')],_0xcafd8b[_0xdb0b('0x2a')]);_0x4a570a[_0xdb0b('0x33')]=_['intersection'](_0xcafd8b['model'],qs[_0xdb0b('0x34')](_0x386aa9[_0xdb0b('0x2a')]['fields']));_0x4a570a[_0xdb0b('0x33')]=_0x4a570a['attributes'][_0xdb0b('0x35')]?_0x4a570a[_0xdb0b('0x33')]:_0xcafd8b[_0xdb0b('0x32')];if(_0x386aa9[_0xdb0b('0x2a')][_0xdb0b('0x36')]){_0x4a570a[_0xdb0b('0x37')]=[{'all':!![]}];}_0x4a570a=_[_0xdb0b('0x38')]({},_0x4a570a,_0x386aa9[_0xdb0b('0x39')]);return db[_0xdb0b('0x24')]['find'](_0x4a570a)['then'](handleEntityNotFound(_0x33c228,null))[_0xdb0b('0x1c')](respondWithResult(_0x33c228,null))[_0xdb0b('0x2c')](handleError(_0x33c228,null));};exports[_0xdb0b('0x3a')]=function(_0x2d90d1,_0x4d115c){return db[_0xdb0b('0x24')]['create'](_0x2d90d1['body'],{})[_0xdb0b('0x1c')](respondWithResult(_0x4d115c,0xc9))[_0xdb0b('0x2c')](handleError(_0x4d115c,null));};exports[_0xdb0b('0x1b')]=function(_0x2c77cd,_0xa7f02c){if(_0x2c77cd['body']['id']){delete _0x2c77cd['body']['id'];}return db['FaxInteraction'][_0xdb0b('0x3b')]({'where':{'id':_0x2c77cd[_0xdb0b('0x2e')]['id']}})[_0xdb0b('0x1c')](handleEntityNotFound(_0xa7f02c,null))[_0xdb0b('0x1c')](saveUpdates(_0x2c77cd[_0xdb0b('0x3c')],null))[_0xdb0b('0x1c')](respondWithResult(_0xa7f02c,null))[_0xdb0b('0x2c')](handleError(_0xa7f02c,null));};exports['destroy']=function(_0x15ae42,_0x4a47fa){return db[_0xdb0b('0x24')][_0xdb0b('0x3b')]({'where':{'id':_0x15ae42[_0xdb0b('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4a47fa,null))[_0xdb0b('0x1c')](removeEntity(_0x4a47fa,null))[_0xdb0b('0x2c')](handleError(_0x4a47fa,null));};exports['describe']=function(_0xe66953,_0x2c6eeb){return db['FaxInteraction'][_0xdb0b('0x3d')]()[_0xdb0b('0x1c')](respondWithResult(_0x2c6eeb,null))[_0xdb0b('0x2c')](handleError(_0x2c6eeb,null));};exports[_0xdb0b('0x3e')]=function(_0x474509,_0x29ffc0){return db[_0xdb0b('0x3f')][_0xdb0b('0x3b')]({'where':{'id':_0x474509['params']['id']}})[_0xdb0b('0x1c')](handleEntityNotFound(_0x29ffc0,null))[_0xdb0b('0x1c')](function(_0x585638){if(_0x585638){return _0x585638[_0xdb0b('0x3e')](_0x474509[_0xdb0b('0x3c')]['ids'],_[_0xdb0b('0x40')](_0x474509[_0xdb0b('0x3c')],['ids','id'])||{});}})['then'](respondWithResult(_0x29ffc0,null))[_0xdb0b('0x2c')](handleError(_0x29ffc0,null));};exports[_0xdb0b('0x41')]=function(_0x49c4dd,_0x18be44){var _0x524ecf={'raw':![],'where':{}};var _0x71d405={};var _0x5c7815={'count':0x0,'rows':[]};return db[_0xdb0b('0x24')][_0xdb0b('0x42')]({'where':{'id':_0x49c4dd[_0xdb0b('0x2e')]['id']}})[_0xdb0b('0x1c')](handleEntityNotFound(_0x18be44,null))[_0xdb0b('0x1c')](function(_0x46c5d8){if(_0x46c5d8){_0x71d405[_0xdb0b('0x32')]=_[_0xdb0b('0x2f')](db[_0xdb0b('0x3f')][_0xdb0b('0x25')]);_0x71d405['query']=_[_0xdb0b('0x2f')](_0x49c4dd[_0xdb0b('0x2a')]);_0x71d405[_0xdb0b('0x30')]=_['intersection'](_0x71d405['model'],_0x71d405['query']);_0x524ecf[_0xdb0b('0x33')]=_['intersection'](_0x71d405[_0xdb0b('0x32')],qs[_0xdb0b('0x34')](_0x49c4dd['query'][_0xdb0b('0x34')]));_0x524ecf['attributes']=_0x524ecf['attributes'][_0xdb0b('0x35')]?_0x524ecf[_0xdb0b('0x33')]:_0x71d405[_0xdb0b('0x32')];if(!_0x49c4dd[_0xdb0b('0x2a')]['hasOwnProperty']('nolimit')){_0x524ecf['limit']=qs['limit'](_0x49c4dd['query'][_0xdb0b('0x18')]);_0x524ecf['offset']=qs['offset'](_0x49c4dd[_0xdb0b('0x2a')][_0xdb0b('0x15')]);}_0x524ecf[_0xdb0b('0x43')]=qs['sort'](_0x49c4dd['query'][_0xdb0b('0x44')]);_0x524ecf[_0xdb0b('0x45')]=qs['filters'](_[_0xdb0b('0x46')](_0x49c4dd[_0xdb0b('0x2a')],_0x71d405[_0xdb0b('0x30')]));_0x524ecf[_0xdb0b('0x45')][_0xdb0b('0x47')]=_0x46c5d8['id'];if(_0x49c4dd[_0xdb0b('0x2a')]['filter']){_0x524ecf[_0xdb0b('0x45')]=_[_0xdb0b('0x38')](_0x524ecf[_0xdb0b('0x45')],{'$or':_[_0xdb0b('0x23')](_0x524ecf[_0xdb0b('0x33')],function(_0x525683){var _0x195ae6={};_0x195ae6[_0x525683]={'$like':'%'+_0x49c4dd[_0xdb0b('0x2a')]['filter']+'%'};return _0x195ae6;})});}if(_0x49c4dd[_0xdb0b('0x2a')][_0xdb0b('0x48')]){var _0x5b7635=_0x49c4dd[_0xdb0b('0x2a')]['$gte'][_0xdb0b('0x49')](',');var _0x4f7bf4={};_0x4f7bf4[_0x5b7635[0x0]]={'$gte':moment(_0x5b7635[0x1])[_0xdb0b('0x4a')](_0xdb0b('0x4b'))};_0x524ecf[_0xdb0b('0x45')]=_[_0xdb0b('0x38')](_0x524ecf[_0xdb0b('0x45')],_0x4f7bf4);}_0x524ecf=_[_0xdb0b('0x38')]({},_0x524ecf,_0x49c4dd[_0xdb0b('0x39')]);return db[_0xdb0b('0x3f')][_0xdb0b('0x17')]({'where':_0x524ecf[_0xdb0b('0x45')]})['then'](function(_0x4ba183){_0x5c7815[_0xdb0b('0x17')]=_0x4ba183;if(_0x49c4dd[_0xdb0b('0x2a')][_0xdb0b('0x36')]){_0x524ecf[_0xdb0b('0x37')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x524ecf);})[_0xdb0b('0x1c')](function(_0x4c2789){_0x5c7815[_0xdb0b('0x4c')]=_0x4c2789;return _0x5c7815;});}})[_0xdb0b('0x1c')](respondWithFilteredResult(_0x18be44,_0x524ecf))[_0xdb0b('0x2c')](handleError(_0x18be44,null));};exports[_0xdb0b('0x4d')]=function(_0x4334a5,_0x58e23b){return db['FaxInteraction'][_0xdb0b('0x3b')]({'where':{'id':_0x4334a5[_0xdb0b('0x2e')]['id']}})['then'](handleEntityNotFound(_0x58e23b,null))[_0xdb0b('0x1c')](function(_0x2f3e35){if(_0x2f3e35){return _0x2f3e35['setTags'](_0x4334a5[_0xdb0b('0x3c')][_0xdb0b('0x4e')],_['omit'](_0x4334a5[_0xdb0b('0x3c')],[_0xdb0b('0x4e'),'id'])||{})[_0xdb0b('0x4f')](function(){return db['Tag']['findAll']({'attributes':['id',_0xdb0b('0x20'),'color'],'where':{'id':_0x4334a5[_0xdb0b('0x3c')]['ids']}});})[_0xdb0b('0x1c')](function(_0x3571b9){socket['emit']('faxInteractionTags:save',{'id':Number(_0x4334a5[_0xdb0b('0x2e')]['id']),'tags':_0x3571b9||[]});return{'id':Number(_0x4334a5[_0xdb0b('0x2e')]['id']),'tags':_0x3571b9||[]};});}})[_0xdb0b('0x1c')](respondWithResult(_0x58e23b,null))[_0xdb0b('0x2c')](handleError(_0x58e23b,null));};exports[_0xdb0b('0x50')]=function(_0x1f14d7,_0x66cab4){return db[_0xdb0b('0x24')]['find']({'where':{'id':_0x1f14d7[_0xdb0b('0x2e')]['id']}})[_0xdb0b('0x1c')](handleEntityNotFound(_0x66cab4,null))[_0xdb0b('0x1c')](function(_0x5606c4){if(_0x5606c4){return _0x5606c4[_0xdb0b('0x50')](_0x1f14d7[_0xdb0b('0x2a')][_0xdb0b('0x4e')]);}})[_0xdb0b('0x1c')](respondWithStatusCode(_0x66cab4,null))['catch'](handleError(_0x66cab4,null));};exports[_0xdb0b('0x51')]=function(_0x399e23,_0x2f3ea4){var _0x52ba91=moment()[_0xdb0b('0x52')]()[_0xdb0b('0x53')]();var _0x5e77fd=path[_0xdb0b('0x54')](config['root'],_0xdb0b('0x55'),_0xdb0b('0x56'),'tmp');var _0x44cf49=path[_0xdb0b('0x54')](config['root'],_0xdb0b('0x55'),_0xdb0b('0x56'),_0xdb0b('0x57'));var _0x2432d1=path[_0xdb0b('0x54')](_0x5e77fd,_0x52ba91);var _0x549733=util['format'](_0xdb0b('0x58'),_0x399e23[_0xdb0b('0x2e')]['id'],_0x52ba91);var _0x16ed0c=path[_0xdb0b('0x54')](_0x5e77fd,_0x549733);var _0x24db73=[];_0x24db73[_0xdb0b('0x59')]({'model':db['Attachment'],'as':_0xdb0b('0x5a'),'raw':!![]});var _0x45d03a=[{'model':db[_0xdb0b('0x3f')],'as':_0xdb0b('0x5b'),'attributes':['id','body',_0xdb0b('0x5c')],'include':_0x24db73}];return db['FaxInteraction']['find']({'where':{'id':_0x399e23['params']['id']},'include':_0x45d03a})[_0xdb0b('0x1c')](handleEntityNotFound(_0x2f3ea4,null))['then'](function(_0x50b069){if(_0x50b069&&_0x50b069[_0xdb0b('0x5b')]){var _0x317481=_0x50b069['get']({'plain':!![]});fs[_0xdb0b('0x5d')](_0x2432d1);for(var _0x19f5ed=0x0;_0x19f5ed<_0x317481[_0xdb0b('0x5b')]['length'];_0x19f5ed++){var _0x529d8c=_0x317481[_0xdb0b('0x5b')][_0x19f5ed]['Attachment'];if(_0x529d8c){var _0x1ec7bc=path[_0xdb0b('0x54')](_0x44cf49,_0x529d8c[_0xdb0b('0x5e')]);if(fs[_0xdb0b('0x5f')](_0x1ec7bc)){fs['createReadStream'](_0x1ec7bc)[_0xdb0b('0x60')](fs[_0xdb0b('0x61')](path[_0xdb0b('0x54')](_0x2432d1,_0x529d8c[_0xdb0b('0x5e')])));}}}return BPromise[_0xdb0b('0x62')]()[_0xdb0b('0x1c')](function(){return new BPromise(function(_0x1f6ba3,_0x24b54d){zipdir(_0x2432d1,{'saveTo':_0x16ed0c},function(_0x24cde7,_0x18c8c8){if(_0x24cde7)return _0x24b54d(_0x24cde7);return _0x1f6ba3(_0x18c8c8);});})[_0xdb0b('0x1c')](function(){return new BPromise(function(_0x2f3987,_0x3fc8a9){rimraf(_0x2432d1,function(_0x29a158){if(_0x29a158)_0x3fc8a9(_0x29a158);return _0x2f3987();});});})[_0xdb0b('0x1c')](function(){return _0x2f3ea4[_0xdb0b('0x51')](_0x16ed0c,_0x549733,function(_0x22bf13){if(_0x22bf13){console[_0xdb0b('0x63')](_0xdb0b('0x64'),_0x22bf13);}else{fs[_0xdb0b('0x65')](_0x16ed0c);}});});});}else{return _0x2f3ea4[_0xdb0b('0x11')](0xc8);}})[_0xdb0b('0x2c')](handleError(_0x2f3ea4,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 04be48f..45344c2 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 _0xf22d=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0xf22d,0x6a));var _0xdf22=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xf22d[_0x1bb58c];return _0x277586;};'use strict';var EventEmitter=require(_0xdf22('0x0'));var FaxInteraction=require(_0xdf22('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db'][_0xdf22('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdf22('0x3'),'afterUpdate':_0xdf22('0x4'),'afterDestroy':_0xdf22('0x5')};function emitEvent(_0x3bf82d){return function(_0x99e43b,_0x73734e,_0x2caa2c){_0x99e43b[_0xdf22('0x6')]({'attributes':['id'],'raw':!![]})[_0xdf22('0x7')](function(_0x2f161b){_0x99e43b['setDataValue'](_0xdf22('0x8'),_0x2f161b['map'](function(_0x16616c){return{'id':_0x16616c['id']};}));return FaxMessage[_0xdf22('0x9')]({'where':{'FaxInteractionId':_0x99e43b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdf22('0x7')](function(_0x352f0e){_0x99e43b[_0xdf22('0xa')]('unreadMessages',_0x352f0e[_0xdf22('0xb')]);FaxInteractionEvents[_0xdf22('0xc')](_0x3bf82d+':'+_0x99e43b['id'],_0x99e43b);FaxInteractionEvents[_0xdf22('0xc')](_0x3bf82d,_0x99e43b);_0x2caa2c(null);})[_0xdf22('0xd')](_0x2caa2c(null));};}for(var e in events){if(events[_0xdf22('0xe')](e)){var event=events[e];FaxInteraction[_0xdf22('0xf')](e,emitEvent(event));}}module[_0xdf22('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x2b6e=['events','FaxInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports'];(function(_0x46193c,_0x41ad09){var _0x3fdc8d=function(_0x361956){while(--_0x361956){_0x46193c['push'](_0x46193c['shift']());}};_0x3fdc8d(++_0x41ad09);}(_0x2b6e,0x18c));var _0xe2b6=function(_0x196dd1,_0x566dbf){_0x196dd1=_0x196dd1-0x0;var _0x1221b6=_0x2b6e[_0x196dd1];return _0x1221b6;};'use strict';var EventEmitter=require(_0xe2b6('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xe2b6('0x1')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xe2b6('0x2')](0x0);var events={'afterCreate':_0xe2b6('0x3'),'afterUpdate':_0xe2b6('0x4'),'afterDestroy':_0xe2b6('0x5')};function emitEvent(_0x4d988a){return function(_0x58f3a7,_0x5ec9e3,_0x58d523){_0x58f3a7[_0xe2b6('0x6')]({'attributes':['id'],'raw':!![]})[_0xe2b6('0x7')](function(_0x3dc54c){_0x58f3a7[_0xe2b6('0x8')](_0xe2b6('0x9'),_0x3dc54c[_0xe2b6('0xa')](function(_0x45b9e0){return{'id':_0x45b9e0['id']};}));return FaxMessage[_0xe2b6('0xb')]({'where':{'FaxInteractionId':_0x58f3a7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe2b6('0x7')](function(_0x456ce2){_0x58f3a7[_0xe2b6('0x8')](_0xe2b6('0xc'),_0x456ce2[_0xe2b6('0xd')]);FaxInteractionEvents[_0xe2b6('0xe')](_0x4d988a+':'+_0x58f3a7['id'],_0x58f3a7);FaxInteractionEvents[_0xe2b6('0xe')](_0x4d988a,_0x58f3a7);_0x58d523(null);})[_0xe2b6('0xf')](_0x58d523(null));};}for(var e in events){if(events[_0xe2b6('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xe2b6('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 499e546..443c3fc 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 _0x77b4=['util','../../config/logger','moment','request-promise','rimraf','./faxInteraction.attributes','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a4ba9,_0x206a61){var _0x54ab7d=function(_0x537716){while(--_0x537716){_0x4a4ba9['push'](_0x4a4ba9['shift']());}};_0x54ab7d(++_0x206a61);}(_0x77b4,0x1e0));var _0x477b=function(_0x6b83b1,_0x4b3392){_0x6b83b1=_0x6b83b1-0x0;var _0x30cb37=_0x77b4[_0x6b83b1];return _0x30cb37;};'use strict';var _=require('lodash');var util=require(_0x477b('0x0'));var logger=require(_0x477b('0x1'))('api');var moment=require(_0x477b('0x2'));var BPromise=require('bluebird');var rp=require(_0x477b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x477b('0x4'));var config=require('../../config/environment');var attributes=require(_0x477b('0x5'));module['exports']=function(_0x3d6bac,_0x43bfe0){return _0x3d6bac['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11d884,_0x20b147,_0x451069){if(_0x11d884[_0x477b('0x6')]('closed')){_0x11d884[_0x477b('0x7')]=moment()[_0x477b('0x8')](_0x477b('0x9'));}_0x451069(null,_0x11d884);}}});}; \ No newline at end of file +var _0xcb2c=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','FaxInteraction','fax_interactions'];(function(_0x1cf1c6,_0x378916){var _0x2e08af=function(_0x49b13f){while(--_0x49b13f){_0x1cf1c6['push'](_0x1cf1c6['shift']());}};_0x2e08af(++_0x378916);}(_0xcb2c,0x16b));var _0xccb2=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xcb2c[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xccb2('0x0'));var util=require('util');var logger=require(_0xccb2('0x1'))(_0xccb2('0x2'));var moment=require(_0xccb2('0x3'));var BPromise=require(_0xccb2('0x4'));var rp=require(_0xccb2('0x5'));var fs=require('fs');var path=require(_0xccb2('0x6'));var rimraf=require(_0xccb2('0x7'));var config=require(_0xccb2('0x8'));var attributes=require(_0xccb2('0x9'));module['exports']=function(_0x299af9,_0x10db29){return _0x299af9['define'](_0xccb2('0xa'),attributes,{'tableName':_0xccb2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c083f,_0x4bace6,_0x427191){if(_0x1c083f['changed'](_0xccb2('0xc'))){_0x1c083f[_0xccb2('0xd')]=moment()['format'](_0xccb2('0xe'));}_0x427191(null,_0x1c083f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f1b5498..9d7d10c 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 _0xadb3=['client','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','UpdateFaxInteraction','update','options','raw','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x433818,_0x287818){var _0x3f3358=function(_0x468f9e){while(--_0x468f9e){_0x433818['push'](_0x433818['shift']());}};_0x3f3358(++_0x287818);}(_0xadb3,0x1f1));var _0x3adb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xadb3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3adb('0x0'));var util=require('util');var moment=require(_0x3adb('0x1'));var BPromise=require(_0x3adb('0x2'));var rs=require(_0x3adb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3adb('0x4'))['db'];var utils=require(_0x3adb('0x5'));var logger=require(_0x3adb('0x6'))(_0x3adb('0x7'));var config=require(_0x3adb('0x8'));var jayson=require(_0x3adb('0x9'));var client=jayson[_0x3adb('0xa')]['http']({'port':0x232a});config[_0x3adb('0xb')]=_['defaults'](config['redis'],{'host':_0x3adb('0xc'),'port':0x18eb});var socket=require(_0x3adb('0xd'))(new Redis(config[_0x3adb('0xb')]));require(_0x3adb('0xe'))[_0x3adb('0xf')](socket);function respondWithRpcPromise(_0x4681e7,_0x1bc59d,_0x1e330f){return new BPromise(function(_0x260da6,_0xe4f48b){return client['request'](_0x4681e7,_0x1e330f)[_0x3adb('0x10')](function(_0x3120c2){logger[_0x3adb('0x11')](_0x3adb('0x12'),_0x1bc59d,'request\x20sent');logger[_0x3adb('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x1bc59d,_0x3adb('0x14'),JSON[_0x3adb('0x15')](_0x3120c2));if(_0x3120c2[_0x3adb('0x16')]){if(_0x3120c2[_0x3adb('0x16')][_0x3adb('0x17')]===0x1f4){logger[_0x3adb('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1bc59d,_0x3120c2[_0x3adb('0x16')][_0x3adb('0x18')]);return _0xe4f48b(_0x3120c2[_0x3adb('0x16')][_0x3adb('0x18')]);}logger[_0x3adb('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x1bc59d,_0x3120c2['error'][_0x3adb('0x18')]);return _0x260da6(_0x3120c2[_0x3adb('0x16')][_0x3adb('0x18')]);}else{logger[_0x3adb('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x1bc59d,_0x3adb('0x14'));_0x260da6(_0x3120c2['result'][_0x3adb('0x18')]);}})['catch'](function(_0x10ec07){logger[_0x3adb('0x16')](_0x3adb('0x12'),_0x1bc59d,_0x10ec07);_0xe4f48b(_0x10ec07);});});}exports[_0x3adb('0x19')]=function(_0x3f817a){var _0x1ee45e=this;return new Promise(function(_0x169f00,_0x4c9d32){return db['FaxInteraction'][_0x3adb('0x1a')](_0x3f817a['body'],{'raw':_0x3f817a[_0x3adb('0x1b')]?_0x3f817a['options'][_0x3adb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f817a[_0x3adb('0x1b')]?_0x3f817a[_0x3adb('0x1b')]['where']||null:null,'attributes':_0x3f817a[_0x3adb('0x1b')]?_0x3f817a[_0x3adb('0x1b')]['attributes']||null:null,'limit':_0x3f817a[_0x3adb('0x1b')]?_0x3f817a[_0x3adb('0x1b')]['limit']||null:null})['then'](function(_0x6dc69a){logger[_0x3adb('0x11')](_0x3adb('0x19'),_0x3f817a);logger[_0x3adb('0x13')](_0x3adb('0x19'),_0x3f817a,JSON[_0x3adb('0x15')](_0x6dc69a));_0x169f00(_0x6dc69a);})[_0x3adb('0x1d')](function(_0x41fd96){logger[_0x3adb('0x16')](_0x3adb('0x19'),_0x41fd96[_0x3adb('0x18')],_0x3f817a);_0x4c9d32(_0x1ee45e[_0x3adb('0x16')](0x1f4,_0x41fd96[_0x3adb('0x18')]));});});};exports[_0x3adb('0x1e')]=function(_0x3abaf4){return new Promise(function(_0x4dba15,_0x4e5c4b){return db[_0x3adb('0x1f')][_0x3adb('0x20')]({'where':_0x3abaf4[_0x3adb('0x1b')]?_0x3abaf4['options']['where']||null:null})[_0x3adb('0x10')](function(_0x5f271a){if(_0x5f271a){return _0x5f271a[_0x3adb('0x21')](_0x3abaf4[_0x3adb('0x22')][_0x3adb('0x23')],_[_0x3adb('0x24')](_0x3abaf4['body'],[_0x3adb('0x23'),'id'])||{});}})[_0x3adb('0x25')](function(_0x3b1c91){logger[_0x3adb('0x11')]('AddTags',_0x3abaf4);logger[_0x3adb('0x13')](_0x3adb('0x26'),_0x3abaf4,JSON[_0x3adb('0x15')](_0x3b1c91));_0x4dba15(_0x3b1c91);})['catch'](function(_0x3a6e64){logger[_0x3adb('0x16')](_0x3adb('0x26'),_0x3a6e64[_0x3adb('0x18')],_0x3abaf4);_0x4e5c4b(_this[_0x3adb('0x16')](0x1f4,_0x3a6e64[_0x3adb('0x18')]));});});}; \ No newline at end of file +var _0xfabf=['bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','localhost','socket.io-emitter','redis','./faxInteraction.socket','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','FaxInteraction','update','body','options','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','where','ids','omit','spread','AddTags','moment'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xfabf,0x6b));var _0xffab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfabf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xffab('0x0'));var BPromise=require(_0xffab('0x1'));var rs=require(_0xffab('0x2'));var fs=require('fs');var Redis=require(_0xffab('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xffab('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xffab('0x5'));var client=jayson[_0xffab('0x6')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xffab('0x7'),'port':0x18eb});var socket=require(_0xffab('0x8'))(new Redis(config[_0xffab('0x9')]));require(_0xffab('0xa'))['register'](socket);function respondWithRpcPromise(_0x5a949a,_0x2369bd,_0x360033){return new BPromise(function(_0x153fc8,_0xa30e11){return client['request'](_0x5a949a,_0x360033)[_0xffab('0xb')](function(_0x286ac8){logger['info'](_0xffab('0xc'),_0x2369bd,_0xffab('0xd'));logger[_0xffab('0xe')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2369bd,_0xffab('0xd'),JSON[_0xffab('0xf')](_0x286ac8));if(_0x286ac8['error']){if(_0x286ac8[_0xffab('0x10')][_0xffab('0x11')]===0x1f4){logger[_0xffab('0x10')](_0xffab('0xc'),_0x2369bd,_0x286ac8['error'][_0xffab('0x12')]);return _0xa30e11(_0x286ac8[_0xffab('0x10')][_0xffab('0x12')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2369bd,_0x286ac8[_0xffab('0x10')]['message']);return _0x153fc8(_0x286ac8['error'][_0xffab('0x12')]);}else{logger[_0xffab('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x2369bd,_0xffab('0xd'));_0x153fc8(_0x286ac8[_0xffab('0x14')][_0xffab('0x12')]);}})[_0xffab('0x15')](function(_0x1bc8da){logger[_0xffab('0x10')](_0xffab('0xc'),_0x2369bd,_0x1bc8da);_0xa30e11(_0x1bc8da);});});}exports['UpdateFaxInteraction']=function(_0x1cd55b){var _0x222c83=this;return new Promise(function(_0x10c7d3,_0x228131){return db[_0xffab('0x16')][_0xffab('0x17')](_0x1cd55b[_0xffab('0x18')],{'raw':_0x1cd55b[_0xffab('0x19')]?_0x1cd55b[_0xffab('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cd55b[_0xffab('0x19')]?_0x1cd55b[_0xffab('0x19')]['where']||null:null,'attributes':_0x1cd55b[_0xffab('0x19')]?_0x1cd55b[_0xffab('0x19')][_0xffab('0x1a')]||null:null,'limit':_0x1cd55b[_0xffab('0x19')]?_0x1cd55b[_0xffab('0x19')][_0xffab('0x1b')]||null:null})[_0xffab('0xb')](function(_0x400393){logger[_0xffab('0x13')]('UpdateFaxInteraction',_0x1cd55b);logger[_0xffab('0xe')](_0xffab('0x1c'),_0x1cd55b,JSON[_0xffab('0xf')](_0x400393));_0x10c7d3(_0x400393);})[_0xffab('0x15')](function(_0x36cabc){logger[_0xffab('0x10')](_0xffab('0x1c'),_0x36cabc[_0xffab('0x12')],_0x1cd55b);_0x228131(_0x222c83['error'](0x1f4,_0x36cabc[_0xffab('0x12')]));});});};exports[_0xffab('0x1d')]=function(_0x491007){return new Promise(function(_0x3c45b2,_0x3960ad){return db[_0xffab('0x16')][_0xffab('0x1e')]({'where':_0x491007[_0xffab('0x19')]?_0x491007[_0xffab('0x19')][_0xffab('0x1f')]||null:null})[_0xffab('0xb')](function(_0x5edd2e){if(_0x5edd2e){return _0x5edd2e['addTags'](_0x491007[_0xffab('0x18')][_0xffab('0x20')],_[_0xffab('0x21')](_0x491007[_0xffab('0x18')],[_0xffab('0x20'),'id'])||{});}})[_0xffab('0x22')](function(_0x2c00bc){logger['info'](_0xffab('0x23'),_0x491007);logger[_0xffab('0xe')]('AddTags',_0x491007,JSON[_0xffab('0xf')](_0x2c00bc));_0x3c45b2(_0x2c00bc);})[_0xffab('0x15')](function(_0x14a563){logger['error']('AddTags',_0x14a563['message'],_0x491007);_0x3960ad(_this[_0xffab('0x10')](0x1f4,_0x14a563[_0xffab('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index dc14c03..00375cf 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 _0x64f0=['./faxInteraction.events','save','update','emit','register'];(function(_0x95e0a,_0x2b689d){var _0x485c54=function(_0x5f08f9){while(--_0x5f08f9){_0x95e0a['push'](_0x95e0a['shift']());}};_0x485c54(++_0x2b689d);}(_0x64f0,0x159));var _0x064f=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x64f0[_0x4b7b69];return _0x173b4c;};'use strict';var FaxInteractionEvents=require(_0x064f('0x0'));var events=[_0x064f('0x1'),'remove',_0x064f('0x2')];function createListener(_0x2273ef,_0x2a9e9f){return function(_0x44a4a6){_0x2a9e9f[_0x064f('0x3')](_0x2273ef,_0x44a4a6);};}function removeListener(_0x1dd665,_0x17ef4d){return function(){FaxInteractionEvents['removeListener'](_0x1dd665,_0x17ef4d);};}exports[_0x064f('0x4')]=function(_0x5aae81){for(var _0x3d8c86=0x0,_0x2eedf8=events['length'];_0x3d8c86<_0x2eedf8;_0x3d8c86++){var _0xe71d12=events[_0x3d8c86];var _0x3e35e6=createListener('faxInteraction:'+_0xe71d12,_0x5aae81);FaxInteractionEvents['on'](_0xe71d12,_0x3e35e6);}}; \ No newline at end of file +var _0x6f66=['save','update','emit','removeListener','register','length','./faxInteraction.events'];(function(_0x39291b,_0x2edd20){var _0x279db1=function(_0xa51b9d){while(--_0xa51b9d){_0x39291b['push'](_0x39291b['shift']());}};_0x279db1(++_0x2edd20);}(_0x6f66,0x133));var _0x66f6=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x6f66[_0x190ff6];return _0x5356d2;};'use strict';var FaxInteractionEvents=require(_0x66f6('0x0'));var events=[_0x66f6('0x1'),'remove',_0x66f6('0x2')];function createListener(_0x545209,_0xe6cd94){return function(_0x3fadd9){_0xe6cd94[_0x66f6('0x3')](_0x545209,_0x3fadd9);};}function removeListener(_0x52f900,_0x30e7b7){return function(){FaxInteractionEvents[_0x66f6('0x4')](_0x52f900,_0x30e7b7);};}exports[_0x66f6('0x5')]=function(_0x3a0dd0){for(var _0x50c3a5=0x0,_0x54be98=events[_0x66f6('0x6')];_0x50c3a5<_0x54be98;_0x50c3a5++){var _0x4cc2db=events[_0x50c3a5];var _0x52efa9=createListener('faxInteraction:'+_0x4cc2db,_0x3a0dd0);FaxInteractionEvents['on'](_0x4cc2db,_0x52efa9);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 490e96b..0f443e6 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 _0xfaa9=['get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','put','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x54a4e4,_0x4788ec){var _0x4c38bb=function(_0x16d739){while(--_0x16d739){_0x54a4e4['push'](_0x54a4e4['shift']());}};_0x4c38bb(++_0x4788ec);}(_0xfaa9,0x177));var _0x9faa=function(_0x9ae1e,_0x251d11){_0x9ae1e=_0x9ae1e-0x0;var _0x5bd8f3=_0xfaa9[_0x9ae1e];return _0x5bd8f3;};'use strict';var multer=require('multer');var util=require(_0x9faa('0x0'));var path=require(_0x9faa('0x1'));var timeout=require(_0x9faa('0x2'));var express=require(_0x9faa('0x3'));var router=express['Router']();var fs_extra=require(_0x9faa('0x4'));var auth=require(_0x9faa('0x5'));var interaction=require(_0x9faa('0x6'));var config=require(_0x9faa('0x7'));var controller=require(_0x9faa('0x8'));router[_0x9faa('0x9')]('/',auth[_0x9faa('0xa')](),controller[_0x9faa('0xb')]);router[_0x9faa('0x9')]('/describe',auth[_0x9faa('0xa')](),controller[_0x9faa('0xc')]);router[_0x9faa('0x9')](_0x9faa('0xd'),auth[_0x9faa('0xa')](),controller[_0x9faa('0xe')]);router[_0x9faa('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x9faa('0xf')]);router[_0x9faa('0x9')](_0x9faa('0x10'),auth[_0x9faa('0xa')](),controller[_0x9faa('0x11')]);router[_0x9faa('0x12')]('/',auth[_0x9faa('0xa')](),controller[_0x9faa('0x13')]);router['post'](_0x9faa('0x14'),auth[_0x9faa('0xa')](),controller[_0x9faa('0x15')]);router[_0x9faa('0x12')](_0x9faa('0x16'),auth[_0x9faa('0xa')](),interaction[_0x9faa('0x17')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x9faa('0x18')](_0x9faa('0xd'),auth['isAuthenticated'](),interaction[_0x9faa('0x17')](_0x9faa('0x19'),_0x9faa('0x1a')),controller[_0x9faa('0x1b')]);router['delete'](_0x9faa('0xd'),auth[_0x9faa('0xa')](),interaction[_0x9faa('0x17')](_0x9faa('0x19'),_0x9faa('0x1c')),controller[_0x9faa('0x1d')]);router[_0x9faa('0x1e')](_0x9faa('0x16'),auth[_0x9faa('0xa')](),controller['removeTags']);module[_0x9faa('0x1f')]=router; \ No newline at end of file +var _0x7dff=['./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a306a,_0x3bdfdf){var _0x5ec858=function(_0x43d10d){while(--_0x43d10d){_0x5a306a['push'](_0x5a306a['shift']());}};_0x5ec858(++_0x3bdfdf);}(_0x7dff,0xde));var _0xf7df=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x7dff[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0xf7df('0x0'));var util=require('util');var path=require(_0xf7df('0x1'));var timeout=require(_0xf7df('0x2'));var express=require(_0xf7df('0x3'));var router=express[_0xf7df('0x4')]();var fs_extra=require(_0xf7df('0x5'));var auth=require(_0xf7df('0x6'));var interaction=require(_0xf7df('0x7'));var config=require(_0xf7df('0x8'));var controller=require(_0xf7df('0x9'));router[_0xf7df('0xa')]('/',auth[_0xf7df('0xb')](),controller['index']);router[_0xf7df('0xa')](_0xf7df('0xc'),auth[_0xf7df('0xb')](),controller[_0xf7df('0xd')]);router[_0xf7df('0xa')](_0xf7df('0xe'),auth[_0xf7df('0xb')](),controller[_0xf7df('0xf')]);router[_0xf7df('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf7df('0x10')]);router[_0xf7df('0xa')](_0xf7df('0x11'),auth[_0xf7df('0xb')](),controller[_0xf7df('0x12')]);router['post']('/',auth[_0xf7df('0xb')](),controller[_0xf7df('0x13')]);router[_0xf7df('0x14')](_0xf7df('0x15'),auth['isAuthenticated'](),controller[_0xf7df('0x16')]);router[_0xf7df('0x14')](_0xf7df('0x17'),auth[_0xf7df('0xb')](),interaction[_0xf7df('0x18')](_0xf7df('0x19'),_0xf7df('0x1a')),controller[_0xf7df('0x1b')]);router[_0xf7df('0x1c')](_0xf7df('0xe'),auth[_0xf7df('0xb')](),interaction[_0xf7df('0x18')](_0xf7df('0x19'),_0xf7df('0x1d')),controller['update']);router[_0xf7df('0x1e')](_0xf7df('0xe'),auth[_0xf7df('0xb')](),interaction[_0xf7df('0x18')](_0xf7df('0x19'),'faxinteraction:destroy'),controller[_0xf7df('0x1f')]);router[_0xf7df('0x1e')](_0xf7df('0x17'),auth[_0xf7df('0xb')](),controller['removeTags']);module[_0xf7df('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index af4d6cf..f72650a 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 _0x28a2=['exports','TEXT','medium','BOOLEAN','ENUM','out','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x228a('0x0'));module[_0x228a('0x1')]={'body':{'type':Sequelize[_0x228a('0x2')](_0x228a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x228a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x228a('0x5')]('in',_0x228a('0x6')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x228a('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xca8d=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3a023f,_0x3a0789){var _0x1de363=function(_0x239e8e){while(--_0x239e8e){_0x3a023f['push'](_0x3a023f['shift']());}};_0x1de363(++_0x3a0789);}(_0xca8d,0x172));var _0xdca8=function(_0x5a30fb,_0x206270){_0x5a30fb=_0x5a30fb-0x0;var _0x3b86aa=_0xca8d[_0x5a30fb];return _0x3b86aa;};'use strict';var Sequelize=require(_0xdca8('0x0'));module[_0xdca8('0x1')]={'body':{'type':Sequelize[_0xdca8('0x2')](_0xdca8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdca8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdca8('0x5')]('in',_0xdca8('0x6')),'defaultValue':_0xdca8('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xdca8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xdca8('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index adc5ec4..b008c79 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 _0xc90c=['http','client','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','filter','merge','type','VIRTUAL','options','then','findAll','rows','show','includeAll','include','find','body','params','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','SIP/%s','channel','event','EventManager','acceptmessage','role','null','RejectMessage','ContactId','Sequelize','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','isNil','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register'];(function(_0x1bf32f,_0x2e994e){var _0x147063=function(_0x423069){while(--_0x423069){_0x1bf32f['push'](_0x1bf32f['shift']());}};_0x147063(++_0x2e994e);}(_0xc90c,0x101));var _0xcc90=function(_0x244b86,_0x12085d){_0x244b86=_0x244b86-0x0;var _0x1ac13b=_0xc90c[_0x244b86];return _0x1ac13b;};'use strict';var emlformat=require(_0xcc90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc90('0x2'));var moment=require(_0xcc90('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc90('0x4'));var util=require(_0xcc90('0x5'));var path=require(_0xcc90('0x6'));var sox=require(_0xcc90('0x7'));var csv=require(_0xcc90('0x8'));var ejs=require(_0xcc90('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc90('0xa'));var squel=require(_0xcc90('0xb'));var crypto=require(_0xcc90('0xc'));var jsforce=require(_0xcc90('0xd'));var deskjs=require(_0xcc90('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcc90('0xf'));var Papa=require(_0xcc90('0x10'));var Redis=require(_0xcc90('0x11'));var authService=require(_0xcc90('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcc90('0x13'));var hardwareService=require(_0xcc90('0x14'));var logger=require(_0xcc90('0x15'))(_0xcc90('0x16'));var utils=require(_0xcc90('0x17'));var config=require(_0xcc90('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc90('0x19'))['db'];config[_0xcc90('0x1a')]=_[_0xcc90('0x1b')](config['redis'],{'host':_0xcc90('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc90('0x1a')]));require(_0xcc90('0x1d'))[_0xcc90('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xcc90('0x1f')]({'port':0x232c});var client9002=jayson[_0xcc90('0x20')][_0xcc90('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18d843,_0x5db24f,_0x5d5500,_0x236d22){return new BPromise(function(_0x3258e5,_0x3da503){var _0x128da0=_0x236d22||client;return _0x128da0[_0xcc90('0x21')](_0x18d843,_0x5d5500)['then'](function(_0x80c3b){logger[_0xcc90('0x22')](_0xcc90('0x23'),_0x5db24f,'request\x20sent');logger[_0xcc90('0x24')](_0xcc90('0x25'),_0x5db24f,_0xcc90('0x26'),JSON[_0xcc90('0x27')](_0x80c3b));if(_0x80c3b[_0xcc90('0x28')]){if(_0x80c3b[_0xcc90('0x28')]['code']===0x1f4){logger[_0xcc90('0x28')](_0xcc90('0x23'),_0x5db24f,_0x80c3b['error'][_0xcc90('0x29')]);return _0x3da503(_0x80c3b['error'][_0xcc90('0x29')]);}logger[_0xcc90('0x28')](_0xcc90('0x23'),_0x5db24f,_0x80c3b['error'][_0xcc90('0x29')]);return _0x3258e5(_0x80c3b[_0xcc90('0x28')][_0xcc90('0x29')]);}else{logger[_0xcc90('0x22')](_0xcc90('0x23'),_0x5db24f,_0xcc90('0x26'));_0x3258e5(_0x80c3b[_0xcc90('0x2a')][_0xcc90('0x29')]);}})[_0xcc90('0x2b')](function(_0x36321a){logger[_0xcc90('0x28')](_0xcc90('0x23'),_0x5db24f,_0x36321a);_0x3da503(_0x36321a);});});}function respondWithStatusCode(_0x5e7a39,_0x3502d9){_0x3502d9=_0x3502d9||0xcc;return function(_0x52917a){if(_0x52917a){return _0x5e7a39[_0xcc90('0x2c')](_0x3502d9);}return _0x5e7a39[_0xcc90('0x2d')](_0x3502d9)[_0xcc90('0x2e')]();};}function respondWithResult(_0x1a43e6,_0x2f0f46){_0x2f0f46=_0x2f0f46||0xc8;return function(_0x4bad0a){if(_0x4bad0a){return _0x1a43e6[_0xcc90('0x2d')](_0x2f0f46)[_0xcc90('0x2f')](_0x4bad0a);}};}function respondWithFilteredResult(_0x5d5c0e,_0x364451){return function(_0x361fd6){if(_0x361fd6){var _0x598e75=typeof _0x364451[_0xcc90('0x30')]==='undefined'&&typeof _0x364451['limit']==='undefined';var _0xa5f904=_0x361fd6[_0xcc90('0x31')];var _0x57a463=_0x598e75?0x0:_0x364451['offset'];var _0x5a032d=_0x598e75?_0x361fd6[_0xcc90('0x31')]:_0x364451[_0xcc90('0x30')]+_0x364451['limit'];var _0x4b759a;if(_0x5a032d>=_0xa5f904){_0x5a032d=_0xa5f904;_0x4b759a=0xc8;}else{_0x4b759a=0xce;}_0x5d5c0e[_0xcc90('0x2d')](_0x4b759a);return _0x5d5c0e['set'](_0xcc90('0x32'),_0x57a463+'-'+_0x5a032d+'/'+_0xa5f904)[_0xcc90('0x2f')](_0x361fd6);}return null;};}function patchUpdates(_0x24fb5b){return function(_0x4ab8af){try{jsonpatch[_0xcc90('0x33')](_0x4ab8af,_0x24fb5b,!![]);}catch(_0x78e4a7){return BPromise[_0xcc90('0x34')](_0x78e4a7);}return _0x4ab8af[_0xcc90('0x35')]();};}function saveUpdates(_0x10107b,_0x4d284d){return function(_0x5e049a){if(_0x5e049a){return _0x5e049a[_0xcc90('0x36')](_0x10107b)['then'](function(_0xcabc9e){return _0xcabc9e;});}return null;};}function removeEntity(_0x2a4cab,_0x3bb62e){return function(_0x5691a8){if(_0x5691a8){return _0x5691a8[_0xcc90('0x37')]()['then'](function(){_0x2a4cab[_0xcc90('0x2d')](0xcc)[_0xcc90('0x2e')]();});}};}function handleEntityNotFound(_0x141b9d,_0x5d4a54){return function(_0x2a2148){if(!_0x2a2148){_0x141b9d[_0xcc90('0x2c')](0x194);}return _0x2a2148;};}function handleError(_0x420070,_0x4c9e9b){_0x4c9e9b=_0x4c9e9b||0x1f4;return function(_0x5d4042){logger[_0xcc90('0x28')](_0x5d4042[_0xcc90('0x38')]);if(_0x5d4042[_0xcc90('0x39')]){delete _0x5d4042[_0xcc90('0x39')];}_0x420070[_0xcc90('0x2d')](_0x4c9e9b)[_0xcc90('0x3a')](_0x5d4042);};}exports[_0xcc90('0x3b')]=function(_0x49299a,_0x3d64c8){var _0x155462={},_0x185845={},_0x2bd013={'count':0x0,'rows':[]};var _0x5c6444=_[_0xcc90('0x3c')](db[_0xcc90('0x3d')][_0xcc90('0x3e')],function(_0x4e729c){return{'name':_0x4e729c['fieldName'],'type':_0x4e729c['type']['key']};});_0x185845[_0xcc90('0x3f')]=_['map'](_0x5c6444,_0xcc90('0x39'));_0x185845[_0xcc90('0x40')]=_[_0xcc90('0x41')](_0x49299a['query']);_0x185845[_0xcc90('0x42')]=_['intersection'](_0x185845['model'],_0x185845[_0xcc90('0x40')]);_0x155462[_0xcc90('0x43')]=_[_0xcc90('0x44')](_0x185845[_0xcc90('0x3f')],qs[_0xcc90('0x45')](_0x49299a[_0xcc90('0x40')]['fields']));_0x155462[_0xcc90('0x43')]=_0x155462[_0xcc90('0x43')][_0xcc90('0x46')]?_0x155462[_0xcc90('0x43')]:_0x185845[_0xcc90('0x3f')];if(!_0x49299a['query'][_0xcc90('0x47')]('nolimit')){_0x155462['limit']=qs[_0xcc90('0x48')](_0x49299a[_0xcc90('0x40')][_0xcc90('0x48')]);_0x155462[_0xcc90('0x30')]=qs['offset'](_0x49299a[_0xcc90('0x40')][_0xcc90('0x30')]);}_0x155462['order']=qs[_0xcc90('0x49')](_0x49299a['query'][_0xcc90('0x49')]);_0x155462[_0xcc90('0x4a')]=qs['filters'](_['pick'](_0x49299a['query'],_0x185845[_0xcc90('0x42')]),_0x5c6444);if(_0x49299a[_0xcc90('0x40')][_0xcc90('0x4b')]){_0x155462['where']=_[_0xcc90('0x4c')](_0x155462[_0xcc90('0x4a')],{'$or':_[_0xcc90('0x3c')](_0x5c6444,function(_0x585695){if(_0x585695[_0xcc90('0x4d')]!==_0xcc90('0x4e')){var _0x51e5f0={};_0x51e5f0[_0x585695[_0xcc90('0x39')]]={'$like':'%'+_0x49299a[_0xcc90('0x40')][_0xcc90('0x4b')]+'%'};return _0x51e5f0;}})});}_0x155462=_['merge']({},_0x155462,_0x49299a[_0xcc90('0x4f')]);var _0x398828={'where':_0x155462[_0xcc90('0x4a')]};return db[_0xcc90('0x3d')]['count'](_0x398828)[_0xcc90('0x50')](function(_0x3b1324){_0x2bd013[_0xcc90('0x31')]=_0x3b1324;if(_0x49299a[_0xcc90('0x40')]['includeAll']){_0x155462['include']=[{'all':!![]}];}return db[_0xcc90('0x3d')][_0xcc90('0x51')](_0x155462);})['then'](function(_0x44173e){_0x2bd013[_0xcc90('0x52')]=_0x44173e;return _0x2bd013;})[_0xcc90('0x50')](respondWithFilteredResult(_0x3d64c8,_0x155462))[_0xcc90('0x2b')](handleError(_0x3d64c8,null));};exports[_0xcc90('0x53')]=function(_0x268fe7,_0x1caf03){var _0x44f90e={'raw':!![],'where':{'id':_0x268fe7['params']['id']}},_0x23a848={};_0x23a848[_0xcc90('0x3f')]=_[_0xcc90('0x41')](db['FaxMessage'][_0xcc90('0x3e')]);_0x23a848[_0xcc90('0x40')]=_[_0xcc90('0x41')](_0x268fe7['query']);_0x23a848[_0xcc90('0x42')]=_[_0xcc90('0x44')](_0x23a848[_0xcc90('0x3f')],_0x23a848[_0xcc90('0x40')]);_0x44f90e[_0xcc90('0x43')]=_['intersection'](_0x23a848[_0xcc90('0x3f')],qs[_0xcc90('0x45')](_0x268fe7[_0xcc90('0x40')]['fields']));_0x44f90e['attributes']=_0x44f90e[_0xcc90('0x43')][_0xcc90('0x46')]?_0x44f90e['attributes']:_0x23a848[_0xcc90('0x3f')];if(_0x268fe7[_0xcc90('0x40')][_0xcc90('0x54')]){_0x44f90e[_0xcc90('0x55')]=[{'all':!![]}];}_0x44f90e=_['merge']({},_0x44f90e,_0x268fe7[_0xcc90('0x4f')]);return db[_0xcc90('0x3d')][_0xcc90('0x56')](_0x44f90e)[_0xcc90('0x50')](handleEntityNotFound(_0x1caf03,null))['then'](respondWithResult(_0x1caf03,null))['catch'](handleError(_0x1caf03,null));};exports[_0xcc90('0x36')]=function(_0x45e453,_0x4ec666){if(_0x45e453[_0xcc90('0x57')]['id']){delete _0x45e453[_0xcc90('0x57')]['id'];}return db[_0xcc90('0x3d')][_0xcc90('0x56')]({'where':{'id':_0x45e453[_0xcc90('0x58')]['id']}})[_0xcc90('0x50')](handleEntityNotFound(_0x4ec666,null))['then'](saveUpdates(_0x45e453['body'],null))['then'](respondWithResult(_0x4ec666,null))[_0xcc90('0x2b')](handleError(_0x4ec666,null));};exports[_0xcc90('0x37')]=function(_0x13b71f,_0x3242e9){return db[_0xcc90('0x3d')]['find']({'where':{'id':_0x13b71f[_0xcc90('0x58')]['id']}})[_0xcc90('0x50')](handleEntityNotFound(_0x3242e9,null))['then'](removeEntity(_0x3242e9,null))['catch'](handleError(_0x3242e9,null));};exports[_0xcc90('0x59')]=function(_0x4d4c8a,_0x4a3cab){return db[_0xcc90('0x3d')][_0xcc90('0x59')]()[_0xcc90('0x50')](respondWithResult(_0x4a3cab,null))[_0xcc90('0x2b')](handleError(_0x4a3cab,null));};var interaction_log=require(_0xcc90('0x15'))(_0xcc90('0x5a'));exports[_0xcc90('0x5b')]=function(_0xbf2f41,_0x4bee2a,_0x5b143e){var _0x52c8f7={'agent':{},'channel':_0xcc90('0x5c')};if(_0xbf2f41['body']['id']){delete _0xbf2f41[_0xcc90('0x57')]['id'];}_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x5d')]=!![];_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x5e')]=moment()['format'](_0xcc90('0x5f'));_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x60')]=_0xbf2f41['body'][_0xcc90('0x60')]||_0xbf2f41['user']['id'];_0x52c8f7['agent']['id']=_0xbf2f41[_0xcc90('0x57')]['UserId'];return db[_0xcc90('0x3d')][_0xcc90('0x56')]({'where':{'id':_0xbf2f41[_0xcc90('0x58')]['id'],'UserId':null}})[_0xcc90('0x50')](handleEntityNotFound(_0x4bee2a,null))[_0xcc90('0x50')](saveUpdates(_0xbf2f41[_0xcc90('0x57')],null))[_0xcc90('0x50')](function(_0xf1d9fc){if(_0xf1d9fc){_0x52c8f7[_0xcc90('0x29')]=_0xf1d9fc[_0xcc90('0x61')]({'plain':!![]});return db[_0xcc90('0x62')][_0xcc90('0x56')]({'where':{'id':_0xf1d9fc[_0xcc90('0x63')]}});}return null;})[_0xcc90('0x50')](handleEntityNotFound(_0x4bee2a,null))[_0xcc90('0x50')](function(_0x415d99){if(_0x415d99){return _0x415d99[_0xcc90('0x36')]({'UserId':_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x60')],'read1stAt':_['isNil'](_0x415d99['read1stAt'])?moment()[_0xcc90('0x64')](_0xcc90('0x5f')):undefined});}return null;})[_0xcc90('0x50')](function(_0x59dfeb){if(_0x59dfeb){_0x52c8f7[_0xcc90('0x65')]=_0x59dfeb['get']({'plain':!![]});interaction_log['info'](_0xcc90('0x66'),_0xbf2f41['user']['id'],_0xbf2f41[_0xcc90('0x67')]['name'],_0xbf2f41[_0xcc90('0x67')]['role'],_0x52c8f7['interaction']['id'],_0xbf2f41[_0xcc90('0x57')]?JSON[_0xcc90('0x27')](_0xbf2f41['body']):'null');return respondWithRpcPromise(_0xcc90('0x68'),_0xcc90('0x69'),_0x52c8f7);}return null;})[_0xcc90('0x50')](function(_0x3f2d5f){var _0x1d6cd6=_0xcc90('0x6a')+_0x3f2d5f[_0xcc90('0x29')]['ContactId'];return db[_0xcc90('0x6b')]['query'](_0x1d6cd6,{'type':db['Sequelize'][_0xcc90('0x6c')][_0xcc90('0x6d')],'raw':!![]})['then'](function(_0x5cb984){return _0x5cb984;});})[_0xcc90('0x50')](function(_0xf6d038){if(_0xf6d038){_0x52c8f7[_0xcc90('0x29')][_0xcc90('0x6e')]=_0xf6d038[0x0];if(!_0xbf2f41['body'][_0xcc90('0x60')])return;return db[_0xcc90('0x6f')][_0xcc90('0x56')]({'where':{'id':_0xbf2f41[_0xcc90('0x57')][_0xcc90('0x60')],'role':_0xcc90('0x70')},'attributes':['id','name',_0xcc90('0x71'),_0xcc90('0x72'),_0xcc90('0x73')],'raw':!![]});}return null;})[_0xcc90('0x50')](function(_0x2d362f){if(!_0x2d362f)return null;_0x52c8f7[_0xcc90('0x29')][_0xcc90('0x70')]=_0x2d362f;return _0x52c8f7;})[_0xcc90('0x50')](function(_0x5cbe38){if(_0x5cbe38){if(_0xbf2f41[_0xcc90('0x57')]['manual']){_0x52c8f7[_0xcc90('0x29')]['interface']=util['format'](_0xcc90('0x74'),_0xbf2f41[_0xcc90('0x67')][_0xcc90('0x39')]);_0x52c8f7[_0xcc90('0x29')][_0xcc90('0x75')]=_0x52c8f7[_0xcc90('0x75')];_0x52c8f7['message']['motionChannel']=_0x52c8f7['channel'];_0x52c8f7[_0xcc90('0x29')][_0xcc90('0x76')]=_0xcc90('0x5b');return respondWithRpcPromise(_0xcc90('0x77'),_0xcc90('0x77'),{'event':_0xcc90('0x78'),'message':_0x52c8f7[_0xcc90('0x29')]},client9002)[_0xcc90('0x50')](function(){return _0x52c8f7;});}return _0x52c8f7;}return null;})['then'](respondWithResult(_0x4bee2a,null))[_0xcc90('0x2b')](handleError(_0x4bee2a,null));};var interaction_log=require(_0xcc90('0x15'))('fax-interactions');exports[_0xcc90('0x34')]=function(_0x591345,_0x5e0d94,_0x51e7d7){var _0x169bff={'agent':{},'channel':'fax'};if(_0x591345['body']['id']){delete _0x591345[_0xcc90('0x57')]['id'];}_0x591345[_0xcc90('0x57')][_0xcc90('0x60')]=_0x591345[_0xcc90('0x57')][_0xcc90('0x60')]||_0x591345[_0xcc90('0x67')]['id'];_0x169bff['agent']['id']=_0x591345['body'][_0xcc90('0x60')];return db[_0xcc90('0x3d')][_0xcc90('0x56')]({'where':{'id':_0x591345[_0xcc90('0x58')]['id'],'UserId':null}})[_0xcc90('0x50')](handleEntityNotFound(_0x5e0d94,null))[_0xcc90('0x50')](function(_0x5b8119){if(_0x5b8119){_0x169bff[_0xcc90('0x29')]=_0x5b8119[_0xcc90('0x61')]({'plain':!![]});return db[_0xcc90('0x62')][_0xcc90('0x56')]({'where':{'id':_0x5b8119[_0xcc90('0x63')]}});}return null;})[_0xcc90('0x50')](handleEntityNotFound(_0x5e0d94,null))['then'](function(_0x280013){if(_0x280013){_0x169bff[_0xcc90('0x65')]=_0x280013[_0xcc90('0x61')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x591345[_0xcc90('0x67')]['id'],_0x591345[_0xcc90('0x67')][_0xcc90('0x39')],_0x591345[_0xcc90('0x67')][_0xcc90('0x79')],_0x169bff['interaction']['id'],_0x591345['body']?JSON[_0xcc90('0x27')](_0x591345[_0xcc90('0x57')]):_0xcc90('0x7a'));return respondWithRpcPromise(_0xcc90('0x7b'),'rejectMessage',_0x169bff);}return null;})[_0xcc90('0x50')](function(_0xc42263){var _0x1ef534=_0xcc90('0x6a')+_0xc42263[_0xcc90('0x29')][_0xcc90('0x7c')];return db[_0xcc90('0x6b')][_0xcc90('0x40')](_0x1ef534,{'type':db[_0xcc90('0x7d')][_0xcc90('0x6c')][_0xcc90('0x6d')],'raw':!![]})[_0xcc90('0x50')](function(_0x370dfd){return _0x370dfd;});})[_0xcc90('0x50')](function(_0x50b3a6){if(_0x50b3a6){_0x169bff[_0xcc90('0x29')][_0xcc90('0x6e')]=_0x50b3a6[0x0];if(!_0x591345[_0xcc90('0x57')][_0xcc90('0x60')])return;return db[_0xcc90('0x6f')][_0xcc90('0x56')]({'where':{'id':_0x591345[_0xcc90('0x57')][_0xcc90('0x60')],'role':_0xcc90('0x70')},'attributes':['id','name',_0xcc90('0x71'),_0xcc90('0x72'),'internal'],'raw':!![]});}return null;})[_0xcc90('0x50')](function(_0x301998){if(!_0x301998)return null;_0x169bff[_0xcc90('0x29')][_0xcc90('0x70')]=_0x301998;return _0x169bff;})[_0xcc90('0x50')](function(_0x144bd4){if(_0x144bd4){_0x144bd4[_0xcc90('0x29')]['interface']=util[_0xcc90('0x64')](_0xcc90('0x74'),_0x591345['user']['name']);_0x144bd4[_0xcc90('0x29')][_0xcc90('0x75')]=_0x169bff[_0xcc90('0x75')];_0x144bd4['message'][_0xcc90('0x7e')]=_0x169bff['channel'];_0x144bd4['message']['event']=_0xcc90('0x34');respondWithRpcPromise(_0xcc90('0x77'),'EventManager',{'event':_0xcc90('0x7f'),'message':_0x144bd4[_0xcc90('0x29')]},client9002);return _0x169bff;}return null;})['then'](respondWithResult(_0x5e0d94,null))[_0xcc90('0x2b')](handleError(_0x5e0d94,null));};exports[_0xcc90('0x80')]=function(_0x1600d3,_0x132506){var _0x3a007e;return db['FaxMessage'][_0xcc90('0x80')](_0x1600d3[_0xcc90('0x57')],{})['then'](function(_0x198b0f){_0x3a007e=_0x198b0f;return db[_0xcc90('0x81')][_0xcc90('0x82')]({'where':{'id':_0x3a007e[_0xcc90('0x7c')]}});})[_0xcc90('0x50')](function(_0x36f139){if(_['isNil'](_0x36f139)){return;}else{_0x3a007e[_0xcc90('0x5c')]=_0x36f139[_0xcc90('0x5c')];return db[_0xcc90('0x83')]['findOne']({'where':{'id':_0x3a007e[_0xcc90('0x84')]}});}})['then'](function(_0x38e575){return respondWithRpcPromise(_0xcc90('0x85'),'SendFax',{'FaxAccountId':_['isNil'](_0x1600d3[_0xcc90('0x57')])?undefined:_0x1600d3[_0xcc90('0x57')][_0xcc90('0x86')],'path':_[_0xcc90('0x87')](_0x38e575)?undefined:util[_0xcc90('0x64')](_0xcc90('0x88'),_0x38e575[_0xcc90('0x89')]),'fax':_[_0xcc90('0x87')](_0x3a007e['fax'])?undefined:_0x3a007e[_0xcc90('0x5c')],'AttachmentId':_0x3a007e['AttachmentId']},client9002);})[_0xcc90('0x50')](respondWithResult(_0x132506,0xc9))[_0xcc90('0x2b')](handleError(_0x132506,null));};exports[_0xcc90('0x8a')]=function(_0x5788b5,_0x4e9b4e){var _0x2d786b=path[_0xcc90('0x8b')](config[_0xcc90('0x8c')],_0xcc90('0x8d'),_0xcc90('0x8e'),_0xcc90('0x8f'));return db[_0xcc90('0x3d')][_0xcc90('0x56')]({'where':{'id':_0x5788b5[_0xcc90('0x58')]['id']},'include':[{'model':db[_0xcc90('0x83')],'as':'Attachment'}]})[_0xcc90('0x50')](handleEntityNotFound(_0x4e9b4e,null))['then'](function(_0x3e8f81){if(_0x3e8f81){return _0x4e9b4e['download'](path[_0xcc90('0x8b')](_0x2d786b,_0x3e8f81[_0xcc90('0x83')][_0xcc90('0x89')]));}})['catch'](handleError(_0x4e9b4e,null));}; \ No newline at end of file +var _0xe194=['send','index','map','fieldName','type','key','model','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','FaxMessage','include','rows','show','params','rawAttributes','includeAll','find','body','describe','accept','fax','read','readAt','format','UserId','user','agent','get','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','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','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','fullname','SIP/%s','rejectmessage','create','CmContact','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','files','attachments','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','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','undefined','count','limit','set','apply','reject','save','update','destroy','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe194,0xe9));var _0x4e19=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0xe194[_0x3a04ab];return _0x4bff6d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4e19('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e19('0x1'));var moment=require(_0x4e19('0x2'));var BPromise=require(_0x4e19('0x3'));var Mustache=require(_0x4e19('0x4'));var util=require('util');var path=require(_0x4e19('0x5'));var sox=require(_0x4e19('0x6'));var csv=require('to-csv');var ejs=require(_0x4e19('0x7'));var fs=require('fs');var fs_extra=require(_0x4e19('0x8'));var _=require(_0x4e19('0x9'));var squel=require(_0x4e19('0xa'));var crypto=require(_0x4e19('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4e19('0xc'));var querystring=require(_0x4e19('0xd'));var Papa=require(_0x4e19('0xe'));var Redis=require(_0x4e19('0xf'));var authService=require(_0x4e19('0x10'));var qs=require(_0x4e19('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e19('0x12'));var logger=require(_0x4e19('0x13'))(_0x4e19('0x14'));var utils=require(_0x4e19('0x15'));var config=require(_0x4e19('0x16'));var licenseUtil=require(_0x4e19('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4e19('0x18')](config[_0x4e19('0x19')],{'host':_0x4e19('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e19('0x19')]));require('./faxMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x4e19('0x1b')][_0x4e19('0x1c')]({'port':0x232c});var client9002=jayson[_0x4e19('0x1b')][_0x4e19('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x52dcc7,_0x2388ef,_0x406a0b,_0x4b182b){return new BPromise(function(_0x159147,_0x7c28fc){var _0x30c322=_0x4b182b||client;return _0x30c322[_0x4e19('0x1d')](_0x52dcc7,_0x406a0b)[_0x4e19('0x1e')](function(_0x507289){logger[_0x4e19('0x1f')](_0x4e19('0x20'),_0x2388ef,_0x4e19('0x21'));logger[_0x4e19('0x22')](_0x4e19('0x23'),_0x2388ef,_0x4e19('0x21'),JSON[_0x4e19('0x24')](_0x507289));if(_0x507289[_0x4e19('0x25')]){if(_0x507289['error'][_0x4e19('0x26')]===0x1f4){logger[_0x4e19('0x25')](_0x4e19('0x20'),_0x2388ef,_0x507289[_0x4e19('0x25')][_0x4e19('0x27')]);return _0x7c28fc(_0x507289[_0x4e19('0x25')][_0x4e19('0x27')]);}logger[_0x4e19('0x25')](_0x4e19('0x20'),_0x2388ef,_0x507289[_0x4e19('0x25')][_0x4e19('0x27')]);return _0x159147(_0x507289[_0x4e19('0x25')]['message']);}else{logger[_0x4e19('0x1f')]('FaxMessage,\x20%s,\x20%s',_0x2388ef,'request\x20sent');_0x159147(_0x507289[_0x4e19('0x28')][_0x4e19('0x27')]);}})[_0x4e19('0x29')](function(_0x4efbaf){logger[_0x4e19('0x25')]('FaxMessage,\x20%s,\x20%s',_0x2388ef,_0x4efbaf);_0x7c28fc(_0x4efbaf);});});}function respondWithStatusCode(_0x435db6,_0x555599){_0x555599=_0x555599||0xcc;return function(_0xdaa7f2){if(_0xdaa7f2){return _0x435db6[_0x4e19('0x2a')](_0x555599);}return _0x435db6[_0x4e19('0x2b')](_0x555599)[_0x4e19('0x2c')]();};}function respondWithResult(_0x38adec,_0x40b1cb){_0x40b1cb=_0x40b1cb||0xc8;return function(_0x4f2024){if(_0x4f2024){return _0x38adec['status'](_0x40b1cb)[_0x4e19('0x2d')](_0x4f2024);}};}function respondWithFilteredResult(_0x3b1444,_0x1d8a2e){return function(_0x269dc2){if(_0x269dc2){var _0x2a3f45=typeof _0x1d8a2e[_0x4e19('0x2e')]===_0x4e19('0x2f')&&typeof _0x1d8a2e['limit']===_0x4e19('0x2f');var _0x1821b4=_0x269dc2['count'];var _0x5456b6=_0x2a3f45?0x0:_0x1d8a2e['offset'];var _0x48387c=_0x2a3f45?_0x269dc2[_0x4e19('0x30')]:_0x1d8a2e[_0x4e19('0x2e')]+_0x1d8a2e[_0x4e19('0x31')];var _0x407093;if(_0x48387c>=_0x1821b4){_0x48387c=_0x1821b4;_0x407093=0xc8;}else{_0x407093=0xce;}_0x3b1444['status'](_0x407093);return _0x3b1444[_0x4e19('0x32')]('Content-Range',_0x5456b6+'-'+_0x48387c+'/'+_0x1821b4)[_0x4e19('0x2d')](_0x269dc2);}return null;};}function patchUpdates(_0x24cf1b){return function(_0x4546fa){try{jsonpatch[_0x4e19('0x33')](_0x4546fa,_0x24cf1b,!![]);}catch(_0x4698ef){return BPromise[_0x4e19('0x34')](_0x4698ef);}return _0x4546fa[_0x4e19('0x35')]();};}function saveUpdates(_0x21210a,_0x3df650){return function(_0x3dd0b9){if(_0x3dd0b9){return _0x3dd0b9[_0x4e19('0x36')](_0x21210a)[_0x4e19('0x1e')](function(_0x21195b){return _0x21195b;});}return null;};}function removeEntity(_0x2e107c,_0x5cf58e){return function(_0x65a164){if(_0x65a164){return _0x65a164[_0x4e19('0x37')]()[_0x4e19('0x1e')](function(){_0x2e107c['status'](0xcc)[_0x4e19('0x2c')]();});}};}function handleEntityNotFound(_0x5a37af,_0x25eb66){return function(_0x10e328){if(!_0x10e328){_0x5a37af[_0x4e19('0x2a')](0x194);}return _0x10e328;};}function handleError(_0x520a46,_0x2bb3d6){_0x2bb3d6=_0x2bb3d6||0x1f4;return function(_0x574933){logger[_0x4e19('0x25')](_0x574933[_0x4e19('0x38')]);if(_0x574933['name']){delete _0x574933['name'];}_0x520a46[_0x4e19('0x2b')](_0x2bb3d6)[_0x4e19('0x39')](_0x574933);};}exports[_0x4e19('0x3a')]=function(_0x1bf6e4,_0xd4bb2c){var _0x1df6bc={},_0x5aac0d={},_0x35f61e={'count':0x0,'rows':[]};var _0x67e657=_[_0x4e19('0x3b')](db['FaxMessage']['rawAttributes'],function(_0x5c043e){return{'name':_0x5c043e[_0x4e19('0x3c')],'type':_0x5c043e[_0x4e19('0x3d')][_0x4e19('0x3e')]};});_0x5aac0d[_0x4e19('0x3f')]=_[_0x4e19('0x3b')](_0x67e657,_0x4e19('0x40'));_0x5aac0d['query']=_[_0x4e19('0x41')](_0x1bf6e4[_0x4e19('0x42')]);_0x5aac0d['filters']=_['intersection'](_0x5aac0d[_0x4e19('0x3f')],_0x5aac0d['query']);_0x1df6bc[_0x4e19('0x43')]=_[_0x4e19('0x44')](_0x5aac0d[_0x4e19('0x3f')],qs[_0x4e19('0x45')](_0x1bf6e4['query']['fields']));_0x1df6bc[_0x4e19('0x43')]=_0x1df6bc[_0x4e19('0x43')][_0x4e19('0x46')]?_0x1df6bc[_0x4e19('0x43')]:_0x5aac0d[_0x4e19('0x3f')];if(!_0x1bf6e4[_0x4e19('0x42')][_0x4e19('0x47')](_0x4e19('0x48'))){_0x1df6bc[_0x4e19('0x31')]=qs[_0x4e19('0x31')](_0x1bf6e4[_0x4e19('0x42')]['limit']);_0x1df6bc['offset']=qs[_0x4e19('0x2e')](_0x1bf6e4[_0x4e19('0x42')][_0x4e19('0x2e')]);}_0x1df6bc[_0x4e19('0x49')]=qs[_0x4e19('0x4a')](_0x1bf6e4[_0x4e19('0x42')][_0x4e19('0x4a')]);_0x1df6bc[_0x4e19('0x4b')]=qs[_0x4e19('0x4c')](_[_0x4e19('0x4d')](_0x1bf6e4['query'],_0x5aac0d[_0x4e19('0x4c')]),_0x67e657);if(_0x1bf6e4['query']['filter']){_0x1df6bc[_0x4e19('0x4b')]=_[_0x4e19('0x4e')](_0x1df6bc[_0x4e19('0x4b')],{'$or':_[_0x4e19('0x3b')](_0x67e657,function(_0x1871d7){if(_0x1871d7['type']!=='VIRTUAL'){var _0x539879={};_0x539879[_0x1871d7[_0x4e19('0x40')]]={'$like':'%'+_0x1bf6e4[_0x4e19('0x42')][_0x4e19('0x4f')]+'%'};return _0x539879;}})});}_0x1df6bc=_[_0x4e19('0x4e')]({},_0x1df6bc,_0x1bf6e4['options']);var _0x41cdae={'where':_0x1df6bc['where']};return db[_0x4e19('0x50')][_0x4e19('0x30')](_0x41cdae)[_0x4e19('0x1e')](function(_0x320671){_0x35f61e['count']=_0x320671;if(_0x1bf6e4['query']['includeAll']){_0x1df6bc[_0x4e19('0x51')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x1df6bc);})[_0x4e19('0x1e')](function(_0x28b5fd){_0x35f61e[_0x4e19('0x52')]=_0x28b5fd;return _0x35f61e;})[_0x4e19('0x1e')](respondWithFilteredResult(_0xd4bb2c,_0x1df6bc))['catch'](handleError(_0xd4bb2c,null));};exports[_0x4e19('0x53')]=function(_0x470db4,_0x5916b8){var _0x360984={'raw':!![],'where':{'id':_0x470db4[_0x4e19('0x54')]['id']}},_0x469876={};_0x469876[_0x4e19('0x3f')]=_['keys'](db[_0x4e19('0x50')][_0x4e19('0x55')]);_0x469876['query']=_[_0x4e19('0x41')](_0x470db4[_0x4e19('0x42')]);_0x469876['filters']=_[_0x4e19('0x44')](_0x469876[_0x4e19('0x3f')],_0x469876[_0x4e19('0x42')]);_0x360984[_0x4e19('0x43')]=_[_0x4e19('0x44')](_0x469876['model'],qs['fields'](_0x470db4[_0x4e19('0x42')]['fields']));_0x360984[_0x4e19('0x43')]=_0x360984[_0x4e19('0x43')][_0x4e19('0x46')]?_0x360984[_0x4e19('0x43')]:_0x469876[_0x4e19('0x3f')];if(_0x470db4['query'][_0x4e19('0x56')]){_0x360984[_0x4e19('0x51')]=[{'all':!![]}];}_0x360984=_[_0x4e19('0x4e')]({},_0x360984,_0x470db4['options']);return db[_0x4e19('0x50')][_0x4e19('0x57')](_0x360984)['then'](handleEntityNotFound(_0x5916b8,null))[_0x4e19('0x1e')](respondWithResult(_0x5916b8,null))[_0x4e19('0x29')](handleError(_0x5916b8,null));};exports[_0x4e19('0x36')]=function(_0x20d225,_0x20a000){if(_0x20d225['body']['id']){delete _0x20d225[_0x4e19('0x58')]['id'];}return db[_0x4e19('0x50')][_0x4e19('0x57')]({'where':{'id':_0x20d225['params']['id']}})['then'](handleEntityNotFound(_0x20a000,null))[_0x4e19('0x1e')](saveUpdates(_0x20d225[_0x4e19('0x58')],null))['then'](respondWithResult(_0x20a000,null))['catch'](handleError(_0x20a000,null));};exports[_0x4e19('0x37')]=function(_0x349571,_0x54c687){return db[_0x4e19('0x50')]['find']({'where':{'id':_0x349571[_0x4e19('0x54')]['id']}})['then'](handleEntityNotFound(_0x54c687,null))[_0x4e19('0x1e')](removeEntity(_0x54c687,null))[_0x4e19('0x29')](handleError(_0x54c687,null));};exports[_0x4e19('0x59')]=function(_0x55f666,_0xcbd371){return db[_0x4e19('0x50')]['describe']()[_0x4e19('0x1e')](respondWithResult(_0xcbd371,null))[_0x4e19('0x29')](handleError(_0xcbd371,null));};var interaction_log=require(_0x4e19('0x13'))('fax-interactions');exports[_0x4e19('0x5a')]=function(_0x54bce1,_0x4314c7,_0x56abac){var _0x145c8c={'agent':{},'channel':_0x4e19('0x5b')};if(_0x54bce1[_0x4e19('0x58')]['id']){delete _0x54bce1[_0x4e19('0x58')]['id'];}_0x54bce1[_0x4e19('0x58')][_0x4e19('0x5c')]=!![];_0x54bce1[_0x4e19('0x58')][_0x4e19('0x5d')]=moment()[_0x4e19('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x54bce1[_0x4e19('0x58')][_0x4e19('0x5f')]=_0x54bce1[_0x4e19('0x58')][_0x4e19('0x5f')]||_0x54bce1[_0x4e19('0x60')]['id'];_0x145c8c[_0x4e19('0x61')]['id']=_0x54bce1[_0x4e19('0x58')]['UserId'];return db[_0x4e19('0x50')][_0x4e19('0x57')]({'where':{'id':_0x54bce1[_0x4e19('0x54')]['id'],'UserId':null}})[_0x4e19('0x1e')](handleEntityNotFound(_0x4314c7,null))[_0x4e19('0x1e')](saveUpdates(_0x54bce1['body'],null))[_0x4e19('0x1e')](function(_0x49b3f6){if(_0x49b3f6){_0x145c8c[_0x4e19('0x27')]=_0x49b3f6[_0x4e19('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x4e19('0x57')]({'where':{'id':_0x49b3f6['FaxInteractionId']}});}return null;})[_0x4e19('0x1e')](handleEntityNotFound(_0x4314c7,null))[_0x4e19('0x1e')](function(_0x539ae9){if(_0x539ae9){return _0x539ae9[_0x4e19('0x36')]({'UserId':_0x54bce1[_0x4e19('0x58')][_0x4e19('0x5f')],'read1stAt':_[_0x4e19('0x63')](_0x539ae9[_0x4e19('0x64')])?moment()['format'](_0x4e19('0x65')):undefined});}return null;})[_0x4e19('0x1e')](function(_0x2be383){if(_0x2be383){_0x145c8c[_0x4e19('0x66')]=_0x2be383[_0x4e19('0x62')]({'plain':!![]});interaction_log[_0x4e19('0x1f')](_0x4e19('0x67'),_0x54bce1[_0x4e19('0x60')]['id'],_0x54bce1[_0x4e19('0x60')][_0x4e19('0x40')],_0x54bce1[_0x4e19('0x60')][_0x4e19('0x68')],_0x145c8c[_0x4e19('0x66')]['id'],_0x54bce1[_0x4e19('0x58')]?JSON[_0x4e19('0x24')](_0x54bce1['body']):_0x4e19('0x69'));return respondWithRpcPromise('AcceptMessage',_0x4e19('0x6a'),_0x145c8c);}return null;})[_0x4e19('0x1e')](function(_0x41a166){var _0x26a390=_0x4e19('0x6b')+_0x41a166[_0x4e19('0x27')][_0x4e19('0x6c')];return db[_0x4e19('0x6d')][_0x4e19('0x42')](_0x26a390,{'type':db[_0x4e19('0x6e')][_0x4e19('0x6f')][_0x4e19('0x70')],'raw':!![]})[_0x4e19('0x1e')](function(_0x4c36eb){return _0x4c36eb;});})[_0x4e19('0x1e')](function(_0x325ae3){if(_0x325ae3){_0x145c8c['message']['contact']=_0x325ae3[0x0];if(!_0x54bce1[_0x4e19('0x58')][_0x4e19('0x5f')])return;return db[_0x4e19('0x71')][_0x4e19('0x57')]({'where':{'id':_0x54bce1['body'][_0x4e19('0x5f')],'role':_0x4e19('0x61')},'attributes':['id',_0x4e19('0x40'),'fullname',_0x4e19('0x72'),_0x4e19('0x73')],'raw':!![]});}return null;})['then'](function(_0x3a3b37){if(!_0x3a3b37)return null;_0x145c8c['message']['agent']=_0x3a3b37;return _0x145c8c;})['then'](function(_0x1692da){if(_0x1692da){if(_0x54bce1[_0x4e19('0x58')][_0x4e19('0x74')]){_0x145c8c[_0x4e19('0x27')][_0x4e19('0x75')]=util[_0x4e19('0x5e')]('SIP/%s',_0x54bce1[_0x4e19('0x60')][_0x4e19('0x40')]);_0x145c8c[_0x4e19('0x27')]['channel']=_0x145c8c[_0x4e19('0x76')];_0x145c8c['message'][_0x4e19('0x77')]=_0x145c8c['channel'];_0x145c8c[_0x4e19('0x27')][_0x4e19('0x78')]=_0x4e19('0x5a');return respondWithRpcPromise(_0x4e19('0x79'),_0x4e19('0x79'),{'event':_0x4e19('0x7a'),'message':_0x145c8c[_0x4e19('0x27')]},client9002)[_0x4e19('0x1e')](function(){return _0x145c8c;});}return _0x145c8c;}return null;})['then'](respondWithResult(_0x4314c7,null))[_0x4e19('0x29')](handleError(_0x4314c7,null));};var interaction_log=require(_0x4e19('0x13'))(_0x4e19('0x7b'));exports[_0x4e19('0x34')]=function(_0x272a94,_0xbeff6a,_0x88fa60){var _0x32aac3={'agent':{},'channel':_0x4e19('0x5b')};if(_0x272a94[_0x4e19('0x58')]['id']){delete _0x272a94[_0x4e19('0x58')]['id'];}_0x272a94[_0x4e19('0x58')][_0x4e19('0x5f')]=_0x272a94['body']['UserId']||_0x272a94[_0x4e19('0x60')]['id'];_0x32aac3[_0x4e19('0x61')]['id']=_0x272a94['body'][_0x4e19('0x5f')];return db[_0x4e19('0x50')][_0x4e19('0x57')]({'where':{'id':_0x272a94[_0x4e19('0x54')]['id'],'UserId':null}})[_0x4e19('0x1e')](handleEntityNotFound(_0xbeff6a,null))[_0x4e19('0x1e')](function(_0x25ef49){if(_0x25ef49){_0x32aac3['message']=_0x25ef49[_0x4e19('0x62')]({'plain':!![]});return db[_0x4e19('0x7c')][_0x4e19('0x57')]({'where':{'id':_0x25ef49[_0x4e19('0x7d')]}});}return null;})[_0x4e19('0x1e')](handleEntityNotFound(_0xbeff6a,null))[_0x4e19('0x1e')](function(_0x3fc506){if(_0x3fc506){_0x32aac3[_0x4e19('0x66')]=_0x3fc506[_0x4e19('0x62')]({'plain':!![]});interaction_log[_0x4e19('0x1f')](_0x4e19('0x7e'),_0x272a94[_0x4e19('0x60')]['id'],_0x272a94[_0x4e19('0x60')]['name'],_0x272a94[_0x4e19('0x60')]['role'],_0x32aac3['interaction']['id'],_0x272a94['body']?JSON[_0x4e19('0x24')](_0x272a94[_0x4e19('0x58')]):_0x4e19('0x69'));return respondWithRpcPromise('RejectMessage',_0x4e19('0x7f'),_0x32aac3);}return null;})[_0x4e19('0x1e')](function(_0x408981){var _0x108fe4=_0x4e19('0x6b')+_0x408981[_0x4e19('0x27')][_0x4e19('0x6c')];return db[_0x4e19('0x6d')]['query'](_0x108fe4,{'type':db['Sequelize'][_0x4e19('0x6f')][_0x4e19('0x70')],'raw':!![]})[_0x4e19('0x1e')](function(_0x40b48d){return _0x40b48d;});})['then'](function(_0x4075a1){if(_0x4075a1){_0x32aac3['message'][_0x4e19('0x80')]=_0x4075a1[0x0];if(!_0x272a94['body'][_0x4e19('0x5f')])return;return db[_0x4e19('0x71')][_0x4e19('0x57')]({'where':{'id':_0x272a94[_0x4e19('0x58')][_0x4e19('0x5f')],'role':_0x4e19('0x61')},'attributes':['id',_0x4e19('0x40'),_0x4e19('0x81'),'email',_0x4e19('0x73')],'raw':!![]});}return null;})['then'](function(_0x566c7f){if(!_0x566c7f)return null;_0x32aac3[_0x4e19('0x27')][_0x4e19('0x61')]=_0x566c7f;return _0x32aac3;})[_0x4e19('0x1e')](function(_0x27acec){if(_0x27acec){_0x27acec['message'][_0x4e19('0x75')]=util[_0x4e19('0x5e')](_0x4e19('0x82'),_0x272a94[_0x4e19('0x60')][_0x4e19('0x40')]);_0x27acec[_0x4e19('0x27')][_0x4e19('0x76')]=_0x32aac3[_0x4e19('0x76')];_0x27acec['message'][_0x4e19('0x77')]=_0x32aac3['channel'];_0x27acec[_0x4e19('0x27')][_0x4e19('0x78')]=_0x4e19('0x34');respondWithRpcPromise(_0x4e19('0x79'),'EventManager',{'event':_0x4e19('0x83'),'message':_0x27acec['message']},client9002);return _0x32aac3;}return null;})[_0x4e19('0x1e')](respondWithResult(_0xbeff6a,null))['catch'](handleError(_0xbeff6a,null));};exports['create']=function(_0x49a460,_0x3f1bf2){var _0x2afe6f;return db[_0x4e19('0x50')][_0x4e19('0x84')](_0x49a460[_0x4e19('0x58')],{})[_0x4e19('0x1e')](function(_0x1e860d){_0x2afe6f=_0x1e860d;return db[_0x4e19('0x85')]['findOne']({'where':{'id':_0x2afe6f['ContactId']}});})[_0x4e19('0x1e')](function(_0x562ece){if(_['isNil'](_0x562ece)){return;}else{_0x2afe6f[_0x4e19('0x5b')]=_0x562ece[_0x4e19('0x5b')];return db[_0x4e19('0x86')][_0x4e19('0x87')]({'where':{'id':_0x2afe6f['AttachmentId']}});}})[_0x4e19('0x1e')](function(_0x18fdff){return respondWithRpcPromise(_0x4e19('0x88'),_0x4e19('0x88'),{'FaxAccountId':_[_0x4e19('0x63')](_0x49a460[_0x4e19('0x58')])?undefined:_0x49a460[_0x4e19('0x58')][_0x4e19('0x89')],'path':_[_0x4e19('0x63')](_0x18fdff)?undefined:util[_0x4e19('0x5e')](_0x4e19('0x8a'),_0x18fdff[_0x4e19('0x8b')]),'fax':_[_0x4e19('0x63')](_0x2afe6f[_0x4e19('0x5b')])?undefined:_0x2afe6f[_0x4e19('0x5b')],'AttachmentId':_0x2afe6f[_0x4e19('0x8c')]},client9002);})[_0x4e19('0x1e')](respondWithResult(_0x3f1bf2,0xc9))[_0x4e19('0x29')](handleError(_0x3f1bf2,null));};exports[_0x4e19('0x8d')]=function(_0x23f070,_0x572fed){var _0x529750=path[_0x4e19('0x8e')](config['root'],'server',_0x4e19('0x8f'),_0x4e19('0x90'));return db[_0x4e19('0x50')][_0x4e19('0x57')]({'where':{'id':_0x23f070[_0x4e19('0x54')]['id']},'include':[{'model':db[_0x4e19('0x86')],'as':'Attachment'}]})[_0x4e19('0x1e')](handleEntityNotFound(_0x572fed,null))[_0x4e19('0x1e')](function(_0x1ea471){if(_0x1ea471){return _0x572fed['download'](path[_0x4e19('0x8e')](_0x529750,_0x1ea471['Attachment'][_0x4e19('0x8b')]));}})[_0x4e19('0x29')](handleError(_0x572fed,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index bc49f33..c55b350 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 _0x6bfc=['exports','../../mysqldb','FaxMessage','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6bfc,0x159));var _0xc6bf=function(_0x415616,_0x133338){_0x415616=_0x415616-0x0;var _0x5e3fa8=_0x6bfc[_0x415616];return _0x5e3fa8;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xc6bf('0x0'))['db'][_0xc6bf('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc6bf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc6bf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x196d6b){return function(_0x4a6de4,_0x15b991,_0xe23c7e){FaxMessageEvents[_0xc6bf('0x4')](_0x196d6b+':'+_0x4a6de4['id'],_0x4a6de4);FaxMessageEvents['emit'](_0x196d6b,_0x4a6de4);_0xe23c7e(null);};}for(var e in events){if(events[_0xc6bf('0x5')](e)){var event=events[e];FaxMessage[_0xc6bf('0x6')](e,emitEvent(event));}}module[_0xc6bf('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x02b6=['hook','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x2937e0,_0x34b0f5){var _0x2c9b46=function(_0x5480f5){while(--_0x5480f5){_0x2937e0['push'](_0x2937e0['shift']());}};_0x2c9b46(++_0x34b0f5);}(_0x02b6,0xfe));var _0x602b=function(_0x35a933,_0x2ceb51){_0x35a933=_0x35a933-0x0;var _0x11dc97=_0x02b6[_0x35a933];return _0x11dc97;};'use strict';var EventEmitter=require(_0x602b('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x602b('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x602b('0x2')](0x0);var events={'afterCreate':_0x602b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x8291f){return function(_0x31f4a4,_0x33cc82,_0x2eec97){FaxMessageEvents['emit'](_0x8291f+':'+_0x31f4a4['id'],_0x31f4a4);FaxMessageEvents[_0x602b('0x4')](_0x8291f,_0x31f4a4);_0x2eec97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x602b('0x5')](e,emitEvent(event));}}module[_0x602b('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index b7160db..4782d3a 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 _0x63e2=['createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','out','isNil','UserId','FaxInteraction','FaxInteractionId','then'];(function(_0x4c26b6,_0x14b3e8){var _0x433964=function(_0x42e489){while(--_0x42e489){_0x4c26b6['push'](_0x4c26b6['shift']());}};_0x433964(++_0x14b3e8);}(_0x63e2,0x12d));var _0x263e=function(_0x4e0553,_0x5b9049){_0x4e0553=_0x4e0553-0x0;var _0x53b5a2=_0x63e2[_0x4e0553];return _0x53b5a2;};'use strict';var _=require(_0x263e('0x0'));var util=require('util');var logger=require(_0x263e('0x1'))('api');var moment=require(_0x263e('0x2'));var BPromise=require(_0x263e('0x3'));var rp=require(_0x263e('0x4'));var fs=require('fs');var path=require(_0x263e('0x5'));var rimraf=require(_0x263e('0x6'));var config=require('../../config/environment');var attributes=require(_0x263e('0x7'));module['exports']=function(_0x329fa4,_0x46a80f){return _0x329fa4[_0x263e('0x8')](_0x263e('0x9'),attributes,{'tableName':_0x263e('0xa'),'paranoid':![],'indexes':[{'name':_0x263e('0xb'),'fields':[_0x263e('0xc')],'type':_0x263e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43613a,_0x350e8a,_0x101920){var _0xb2acc4=_0x329fa4['models'];var _0x58ba24=_0x43613a[_0x263e('0xe')]({'plain':!![]});if(_0x58ba24['direction'][_0x263e('0xf')]()==='in'||_0x58ba24[_0x263e('0x10')][_0x263e('0xf')]()===_0x263e('0x11')&&!_0x58ba24['secret']&&!_[_0x263e('0x12')](_0x58ba24[_0x263e('0x13')])){_0xb2acc4[_0x263e('0x14')]['findOne']({'where':{'id':_0x58ba24[_0x263e('0x15')]}})[_0x263e('0x16')](function(_0x13ed8d){if(_0x13ed8d){_0x13ed8d['update']({'lastMsgAt':_0x58ba24[_0x263e('0x17')],'lastMsgDirection':_0x58ba24[_0x263e('0x10')]['toLowerCase']()});}})[_0x263e('0x18')](function(_0x33ba12){console['error'](_0x33ba12);});}_0x101920();}},'charset':_0x263e('0x19'),'collate':_0x263e('0x1a')});}; \ No newline at end of file +var _0x4456=['createdAt','catch','error','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x4a41e1,_0x11d052){var _0x807c7f=function(_0xc31f8b){while(--_0xc31f8b){_0x4a41e1['push'](_0x4a41e1['shift']());}};_0x807c7f(++_0x11d052);}(_0x4456,0x67));var _0x6445=function(_0x334f83,_0x254bdb){_0x334f83=_0x334f83-0x0;var _0x15afd5=_0x4456[_0x334f83];return _0x15afd5;};'use strict';var _=require(_0x6445('0x0'));var util=require(_0x6445('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6445('0x2'));var BPromise=require(_0x6445('0x3'));var rp=require(_0x6445('0x4'));var fs=require('fs');var path=require(_0x6445('0x5'));var rimraf=require('rimraf');var config=require(_0x6445('0x6'));var attributes=require(_0x6445('0x7'));module['exports']=function(_0x31c100,_0x55e659){return _0x31c100['define'](_0x6445('0x8'),attributes,{'tableName':_0x6445('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x6445('0xa')],'type':_0x6445('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27fc23,_0x334212,_0x571173){var _0x100f31=_0x31c100[_0x6445('0xc')];var _0x383d80=_0x27fc23[_0x6445('0xd')]({'plain':!![]});if(_0x383d80[_0x6445('0xe')][_0x6445('0xf')]()==='in'||_0x383d80[_0x6445('0xe')][_0x6445('0xf')]()===_0x6445('0x10')&&!_0x383d80['secret']&&!_[_0x6445('0x11')](_0x383d80[_0x6445('0x12')])){_0x100f31[_0x6445('0x13')][_0x6445('0x14')]({'where':{'id':_0x383d80[_0x6445('0x15')]}})['then'](function(_0x346272){if(_0x346272){_0x346272['update']({'lastMsgAt':_0x383d80[_0x6445('0x16')],'lastMsgDirection':_0x383d80[_0x6445('0xe')][_0x6445('0xf')]()});}})[_0x6445('0x17')](function(_0x21d26d){console[_0x6445('0x18')](_0x21d26d);});}_0x571173();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f526704..53bb119 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 _0x4bc3=['CreateFaxMessage','FaxMessage','create','body','options','raw','then','stringify','catch','UpdateFaxMessage','update','where','attributes','limit','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4bc3[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x41b2ff,_0x5de8b5,_0x5a478d){return new BPromise(function(_0x2b8112,_0x33025c){return client[_0x34bc('0x10')](_0x41b2ff,_0x5a478d)['then'](function(_0x41960e){logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));logger[_0x34bc('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5de8b5,_0x34bc('0x12'),JSON['stringify'](_0x41960e));if(_0x41960e[_0x34bc('0x14')]){if(_0x41960e[_0x34bc('0x14')][_0x34bc('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x41960e[_0x34bc('0x14')]['message']);return _0x33025c(_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);}logger[_0x34bc('0x14')](_0x34bc('0x11'),_0x5de8b5,_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);return _0x2b8112(_0x41960e['error']['message']);}else{logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));_0x2b8112(_0x41960e[_0x34bc('0x17')][_0x34bc('0x16')]);}})['catch'](function(_0x46aa24){logger[_0x34bc('0x14')]('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x46aa24);_0x33025c(_0x46aa24);});});}exports[_0x34bc('0x18')]=function(_0x9e9f14){var _0x4d2d5e=this;return new Promise(function(_0x14cec8,_0x26cdec){return db[_0x34bc('0x19')][_0x34bc('0x1a')](_0x9e9f14[_0x34bc('0x1b')],{'raw':_0x9e9f14[_0x34bc('0x1c')]?_0x9e9f14['options'][_0x34bc('0x1d')]===undefined?!![]:![]:!![]})[_0x34bc('0x1e')](function(_0x38882c){logger['info']('CreateFaxMessage',_0x9e9f14);logger[_0x34bc('0x13')](_0x34bc('0x18'),_0x9e9f14,JSON[_0x34bc('0x1f')](_0x38882c));_0x14cec8(_0x38882c);})[_0x34bc('0x20')](function(_0x13094a){logger[_0x34bc('0x14')](_0x34bc('0x18'),_0x13094a[_0x34bc('0x16')],_0x9e9f14);_0x26cdec(_0x4d2d5e[_0x34bc('0x14')](0x1f4,_0x13094a[_0x34bc('0x16')]));});});};exports[_0x34bc('0x21')]=function(_0x1edcb0){var _0x4fd589=this;return new Promise(function(_0x43e527,_0x48ec13){return db['FaxMessage'][_0x34bc('0x22')](_0x1edcb0['body'],{'raw':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1edcb0['options']?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x23')]||null:null,'attributes':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x24')]||null:null,'limit':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0['options'][_0x34bc('0x25')]||null:null})[_0x34bc('0x1e')](function(_0x22aacc){logger[_0x34bc('0x26')](_0x34bc('0x21'),_0x1edcb0);logger[_0x34bc('0x13')]('UpdateFaxMessage',_0x1edcb0,JSON[_0x34bc('0x1f')](_0x22aacc));_0x43e527(_0x22aacc);})['catch'](function(_0x530748){logger[_0x34bc('0x14')]('UpdateFaxMessage',_0x530748[_0x34bc('0x16')],_0x1edcb0);_0x48ec13(_0x4fd589[_0x34bc('0x14')](0x1f4,_0x530748[_0x34bc('0x16')]));});});}; \ No newline at end of file +var _0x00bb=['redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxMessage,\x20%s,\x20%s','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','update','attributes','UpdateFaxMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x18dbec,_0x2c8bb9){var _0xb53164=function(_0x409104){while(--_0x409104){_0x18dbec['push'](_0x18dbec['shift']());}};_0xb53164(++_0x2c8bb9);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'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});config[_0xb00b('0x8')]=_[_0xb00b('0x9')](config[_0xb00b('0x8')],{'host':_0xb00b('0xa'),'port':0x18eb});var socket=require(_0xb00b('0xb'))(new Redis(config[_0xb00b('0x8')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5154d9,_0x1e9b7b,_0x5851d4){return new BPromise(function(_0x46a25c,_0x28d3cc){return client['request'](_0x5154d9,_0x5851d4)[_0xb00b('0xc')](function(_0x5a63ed){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));logger[_0xb00b('0xe')](_0xb00b('0xf'),_0x1e9b7b,_0xb00b('0xd'),JSON[_0xb00b('0x10')](_0x5a63ed));if(_0x5a63ed[_0xb00b('0x11')]){if(_0x5a63ed['error'][_0xb00b('0x12')]===0x1f4){logger[_0xb00b('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);return _0x28d3cc(_0x5a63ed['error']['message']);}logger[_0xb00b('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed['error'][_0xb00b('0x13')]);return _0x46a25c(_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);}else{logger[_0xb00b('0x14')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));_0x46a25c(_0x5a63ed['result'][_0xb00b('0x13')]);}})['catch'](function(_0x25d7a0){logger['error'](_0xb00b('0x15'),_0x1e9b7b,_0x25d7a0);_0x28d3cc(_0x25d7a0);});});}exports[_0xb00b('0x16')]=function(_0x53ee68){var _0x55770c=this;return new Promise(function(_0x2b0da1,_0x4a334b){return db[_0xb00b('0x17')][_0xb00b('0x18')](_0x53ee68[_0xb00b('0x19')],{'raw':_0x53ee68[_0xb00b('0x1a')]?_0x53ee68['options'][_0xb00b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x25a973){logger[_0xb00b('0x14')]('CreateFaxMessage',_0x53ee68);logger[_0xb00b('0xe')](_0xb00b('0x16'),_0x53ee68,JSON['stringify'](_0x25a973));_0x2b0da1(_0x25a973);})[_0xb00b('0x1c')](function(_0x1f04d3){logger['error'](_0xb00b('0x16'),_0x1f04d3[_0xb00b('0x13')],_0x53ee68);_0x4a334b(_0x55770c[_0xb00b('0x11')](0x1f4,_0x1f04d3[_0xb00b('0x13')]));});});};exports['UpdateFaxMessage']=function(_0x50be6c){var _0x3785e9=this;return new Promise(function(_0x490380,_0x550587){return db['FaxMessage'][_0xb00b('0x1d')](_0x50be6c[_0xb00b('0x19')],{'raw':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')][_0xb00b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')]['where']||null:null,'attributes':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c['options'][_0xb00b('0x1e')]||null:null,'limit':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')]['limit']||null:null})[_0xb00b('0xc')](function(_0x280ed3){logger[_0xb00b('0x14')](_0xb00b('0x1f'),_0x50be6c);logger[_0xb00b('0xe')](_0xb00b('0x1f'),_0x50be6c,JSON[_0xb00b('0x10')](_0x280ed3));_0x490380(_0x280ed3);})[_0xb00b('0x1c')](function(_0x149c1a){logger['error'](_0xb00b('0x1f'),_0x149c1a[_0xb00b('0x13')],_0x50be6c);_0x550587(_0x3785e9['error'](0x1f4,_0x149c1a[_0xb00b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 93b6d8c..4610177 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 _0x1107=['update','removeListener','faxMessage:','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1107,0xcb));var _0x7110=function(_0x150322,_0x2199fb){_0x150322=_0x150322-0x0;var _0x606a08=_0x1107[_0x150322];return _0x606a08;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x7110('0x0'),_0x7110('0x1'),_0x7110('0x2')];function createListener(_0x33d551,_0x4b1220){return function(_0x4696f9){_0x4b1220['emit'](_0x33d551,_0x4696f9);};}function removeListener(_0x27e48f,_0x2f89ca){return function(){FaxMessageEvents[_0x7110('0x3')](_0x27e48f,_0x2f89ca);};}exports['register']=function(_0x24aeb4){for(var _0x4c0ac3=0x0,_0x2aefa3=events['length'];_0x4c0ac3<_0x2aefa3;_0x4c0ac3++){var _0x3038e8=events[_0x4c0ac3];var _0x579fd9=createListener(_0x7110('0x4')+_0x3038e8,_0x24aeb4);FaxMessageEvents['on'](_0x3038e8,_0x579fd9);}}; \ No newline at end of file +var _0x53d5=['length','./faxMessage.events','remove','update','removeListener','register'];(function(_0x292e26,_0x22a93a){var _0x1bde9d=function(_0x4212e3){while(--_0x4212e3){_0x292e26['push'](_0x292e26['shift']());}};_0x1bde9d(++_0x22a93a);}(_0x53d5,0x151));var _0x553d=function(_0x30dfa4,_0x1a6275){_0x30dfa4=_0x30dfa4-0x0;var _0x185b37=_0x53d5[_0x30dfa4];return _0x185b37;};'use strict';var FaxMessageEvents=require(_0x553d('0x0'));var events=['save',_0x553d('0x1'),_0x553d('0x2')];function createListener(_0x4e8ade,_0x4646a6){return function(_0x14767f){_0x4646a6['emit'](_0x4e8ade,_0x14767f);};}function removeListener(_0x15f198,_0x2019ea){return function(){FaxMessageEvents[_0x553d('0x3')](_0x15f198,_0x2019ea);};}exports[_0x553d('0x4')]=function(_0x3ea203){for(var _0x51d0ac=0x0,_0x34338b=events[_0x553d('0x5')];_0x51d0ac<_0x34338b;_0x51d0ac++){var _0x256459=events[_0x51d0ac];var _0x505e16=createListener('faxMessage:'+_0x256459,_0x3ea203);FaxMessageEvents['on'](_0x256459,_0x505e16);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3098a86..41ef098 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 _0xa902=['reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','tracked','faxmessage:create','put','/:id/accept'];(function(_0x4851bf,_0x2713ea){var _0x37a58a=function(_0x26a1fc){while(--_0x26a1fc){_0x4851bf['push'](_0x4851bf['shift']());}};_0x37a58a(++_0x2713ea);}(_0xa902,0x8d));var _0x2a90=function(_0x527c30,_0x2a8feb){_0x527c30=_0x527c30-0x0;var _0x34f2b4=_0xa902[_0x527c30];return _0x34f2b4;};'use strict';var multer=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var path=require(_0x2a90('0x2'));var timeout=require(_0x2a90('0x3'));var express=require(_0x2a90('0x4'));var router=express['Router']();var fs_extra=require(_0x2a90('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a90('0x6'));var controller=require(_0x2a90('0x7'));router[_0x2a90('0x8')]('/',auth[_0x2a90('0x9')](),controller[_0x2a90('0xa')]);router[_0x2a90('0x8')]('/describe',auth[_0x2a90('0x9')](),controller['describe']);router['get'](_0x2a90('0xb'),auth[_0x2a90('0x9')](),controller[_0x2a90('0xc')]);router[_0x2a90('0x8')](_0x2a90('0xd'),auth['isAuthenticated'](),controller[_0x2a90('0xe')]);router[_0x2a90('0xf')]('/',auth[_0x2a90('0x9')](),interaction[_0x2a90('0x10')]('fax',_0x2a90('0x11')),controller['create']);router[_0x2a90('0x12')]('/:id',auth[_0x2a90('0x9')](),controller['update']);router[_0x2a90('0x12')](_0x2a90('0x13'),auth[_0x2a90('0x9')](),controller['accept']);router['put']('/:id/reject',auth[_0x2a90('0x9')](),controller[_0x2a90('0x14')]);router['delete'](_0x2a90('0xb'),auth[_0x2a90('0x9')](),controller[_0x2a90('0x15')]);module[_0x2a90('0x16')]=router; \ No newline at end of file +var _0xa75b=['get','isAuthenticated','index','/describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x9c3568,_0x53a9c8){var _0xbfa267=function(_0x5271e7){while(--_0x5271e7){_0x9c3568['push'](_0x9c3568['shift']());}};_0xbfa267(++_0x53a9c8);}(_0xa75b,0x170));var _0xba75=function(_0x16f717,_0x299b34){_0x16f717=_0x16f717-0x0;var _0x3d788a=_0xa75b[_0x16f717];return _0x3d788a;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),interaction[_0xba75('0x11')](_0xba75('0x12'),_0xba75('0x13')),controller[_0xba75('0x14')]);router[_0xba75('0x15')](_0xba75('0x16'),auth[_0xba75('0xa')](),controller['update']);router['put'](_0xba75('0x17'),auth['isAuthenticated'](),controller[_0xba75('0x18')]);router[_0xba75('0x15')](_0xba75('0x19'),auth[_0xba75('0xa')](),controller['reject']);router[_0xba75('0x1a')](_0xba75('0x16'),auth[_0xba75('0xa')](),controller[_0xba75('0x1b')]);module[_0xba75('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5fef80c..6f494c1 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 _0x9cae=['roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x2c506f,_0x40d0d5){var _0x30df57=function(_0x579127){while(--_0x579127){_0x2c506f['push'](_0x2c506f['shift']());}};_0x30df57(++_0x40d0d5);}(_0x9cae,0xeb));var _0xe9ca=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9cae[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xe9ca('0x0')]={'name':{'type':Sequelize[_0xe9ca('0x1')],'unique':_0xe9ca('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe9ca('0x1')]},'timeout':{'type':Sequelize[_0xe9ca('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe9ca('0x4')]('rrmemory','beepall',_0xe9ca('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7f11=['INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x18b6d2,_0x3f454a){var _0x7db3c=function(_0x481cdd){while(--_0x481cdd){_0x18b6d2['push'](_0x18b6d2['shift']());}};_0x7db3c(++_0x3f454a);}(_0x7f11,0x10c));var _0x17f1=function(_0x2ecb30,_0xe8c79e){_0x2ecb30=_0x2ecb30-0x0;var _0x17d89e=_0x7f11[_0x2ecb30];return _0x17d89e;};'use strict';var Sequelize=require(_0x17f1('0x0'));module[_0x17f1('0x1')]={'name':{'type':Sequelize[_0x17f1('0x2')],'unique':_0x17f1('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x17f1('0x2')]},'timeout':{'type':Sequelize[_0x17f1('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x17f1('0x5')](_0x17f1('0x6'),_0x17f1('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x17f1('0x4')],'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 851f514..4c7331d 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 _0x3976=['getMembers','findOne','nolimit','FaxQueueId','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','emit','userFaxQueue:save','removeTeams','Team','User','select','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','transaction','isEmpty','removeAgents','forEach','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','FaxQueue','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','describe'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x3976,0xc4));var _0x6397=function(_0x19b6d7,_0x41130d){_0x19b6d7=_0x19b6d7-0x0;var _0x5ee0d5=_0x3976[_0x19b6d7];return _0x5ee0d5;};'use strict';var emlformat=require(_0x6397('0x0'));var rimraf=require(_0x6397('0x1'));var zipdir=require(_0x6397('0x2'));var jsonpatch=require(_0x6397('0x3'));var rp=require(_0x6397('0x4'));var moment=require(_0x6397('0x5'));var BPromise=require(_0x6397('0x6'));var Mustache=require('mustache');var util=require(_0x6397('0x7'));var path=require(_0x6397('0x8'));var sox=require(_0x6397('0x9'));var csv=require(_0x6397('0xa'));var ejs=require(_0x6397('0xb'));var fs=require('fs');var fs_extra=require(_0x6397('0xc'));var _=require(_0x6397('0xd'));var squel=require(_0x6397('0xe'));var crypto=require(_0x6397('0xf'));var jsforce=require(_0x6397('0x10'));var deskjs=require(_0x6397('0x11'));var toCsv=require(_0x6397('0xa'));var querystring=require(_0x6397('0x12'));var Papa=require(_0x6397('0x13'));var Redis=require(_0x6397('0x14'));var authService=require(_0x6397('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x6397('0x16'));var hardwareService=require(_0x6397('0x17'));var logger=require(_0x6397('0x18'))(_0x6397('0x19'));var utils=require(_0x6397('0x1a'));var config=require(_0x6397('0x1b'));var licenseUtil=require(_0x6397('0x1c'));var db=require(_0x6397('0x1d'))['db'];config[_0x6397('0x1e')]=_['defaults'](config['redis'],{'host':_0x6397('0x1f'),'port':0x18eb});var socket=require(_0x6397('0x20'))(new Redis(config[_0x6397('0x1e')]));require(_0x6397('0x21'))[_0x6397('0x22')](socket);function respondWithStatusCode(_0x5d6def,_0x3c7b39){_0x3c7b39=_0x3c7b39||0xcc;return function(_0x24585b){if(_0x24585b){return _0x5d6def[_0x6397('0x23')](_0x3c7b39);}return _0x5d6def[_0x6397('0x24')](_0x3c7b39)[_0x6397('0x25')]();};}function respondWithResult(_0x3b466b,_0x14287c){_0x14287c=_0x14287c||0xc8;return function(_0x299acb){if(_0x299acb){return _0x3b466b[_0x6397('0x24')](_0x14287c)[_0x6397('0x26')](_0x299acb);}};}function respondWithFilteredResult(_0x370f4f,_0xcf8958){return function(_0x518ec9){if(_0x518ec9){var _0x2f63a3=typeof _0xcf8958['offset']===_0x6397('0x27')&&typeof _0xcf8958[_0x6397('0x28')]===_0x6397('0x27');var _0x597924=_0x518ec9[_0x6397('0x29')];var _0x1bcdc9=_0x2f63a3?0x0:_0xcf8958[_0x6397('0x2a')];var _0x493014=_0x2f63a3?_0x518ec9['count']:_0xcf8958[_0x6397('0x2a')]+_0xcf8958[_0x6397('0x28')];var _0x2d86f3;if(_0x493014>=_0x597924){_0x493014=_0x597924;_0x2d86f3=0xc8;}else{_0x2d86f3=0xce;}_0x370f4f[_0x6397('0x24')](_0x2d86f3);return _0x370f4f[_0x6397('0x2b')](_0x6397('0x2c'),_0x1bcdc9+'-'+_0x493014+'/'+_0x597924)[_0x6397('0x26')](_0x518ec9);}return null;};}function patchUpdates(_0x5289df){return function(_0xdaaba6){try{jsonpatch[_0x6397('0x2d')](_0xdaaba6,_0x5289df,!![]);}catch(_0x4e7c88){return BPromise['reject'](_0x4e7c88);}return _0xdaaba6['save']();};}function saveUpdates(_0x50272a,_0xd6cd26){return function(_0xba4690){if(_0xba4690){return _0xba4690[_0x6397('0x2e')](_0x50272a)['then'](function(_0x2b491f){return _0x2b491f;});}return null;};}function removeEntity(_0x4984db,_0x2cc56c){return function(_0x5c7749){if(_0x5c7749){return _0x5c7749['destroy']()[_0x6397('0x2f')](function(){var _0x28f6c0=_0x5c7749[_0x6397('0x30')]({'plain':!![]});var _0x56a594=_0x6397('0x31');return db[_0x6397('0x32')]['destroy']({'where':{'type':_0x56a594,'resourceId':_0x28f6c0['id']}})[_0x6397('0x2f')](function(){return _0x5c7749;});})['then'](function(){_0x4984db[_0x6397('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d7c7,_0x33a813){return function(_0x13a046){if(!_0x13a046){_0x23d7c7[_0x6397('0x23')](0x194);}return _0x13a046;};}function handleError(_0x3cedd3,_0x832178){_0x832178=_0x832178||0x1f4;return function(_0x2928de){logger[_0x6397('0x33')](_0x2928de[_0x6397('0x34')]);if(_0x2928de[_0x6397('0x35')]){delete _0x2928de[_0x6397('0x35')];}_0x3cedd3[_0x6397('0x24')](_0x832178)[_0x6397('0x36')](_0x2928de);};}exports[_0x6397('0x37')]=function(_0x272e5e,_0x2efc7d){var _0x58dbef={},_0x8a7415={},_0x190940={'count':0x0,'rows':[]};var _0x1f04db=_[_0x6397('0x38')](db['FaxQueue'][_0x6397('0x39')],function(_0x221fdc){return{'name':_0x221fdc[_0x6397('0x3a')],'type':_0x221fdc['type'][_0x6397('0x3b')]};});_0x8a7415[_0x6397('0x3c')]=_[_0x6397('0x38')](_0x1f04db,_0x6397('0x35'));_0x8a7415[_0x6397('0x3d')]=_['keys'](_0x272e5e[_0x6397('0x3d')]);_0x8a7415[_0x6397('0x3e')]=_[_0x6397('0x3f')](_0x8a7415[_0x6397('0x3c')],_0x8a7415[_0x6397('0x3d')]);_0x58dbef['attributes']=_[_0x6397('0x3f')](_0x8a7415['model'],qs['fields'](_0x272e5e[_0x6397('0x3d')][_0x6397('0x40')]));_0x58dbef[_0x6397('0x41')]=_0x58dbef['attributes']['length']?_0x58dbef[_0x6397('0x41')]:_0x8a7415['model'];if(!_0x272e5e['query'][_0x6397('0x42')]('nolimit')){_0x58dbef[_0x6397('0x28')]=qs[_0x6397('0x28')](_0x272e5e[_0x6397('0x3d')]['limit']);_0x58dbef['offset']=qs[_0x6397('0x2a')](_0x272e5e[_0x6397('0x3d')]['offset']);}_0x58dbef[_0x6397('0x43')]=qs[_0x6397('0x44')](_0x272e5e[_0x6397('0x3d')]['sort']);_0x58dbef[_0x6397('0x45')]=qs[_0x6397('0x3e')](_[_0x6397('0x46')](_0x272e5e[_0x6397('0x3d')],_0x8a7415[_0x6397('0x3e')]),_0x1f04db);if(_0x272e5e[_0x6397('0x3d')][_0x6397('0x47')]){_0x58dbef[_0x6397('0x45')]=_[_0x6397('0x48')](_0x58dbef['where'],{'$or':_[_0x6397('0x38')](_0x1f04db,function(_0x42e4f8){if(_0x42e4f8[_0x6397('0x49')]!=='VIRTUAL'){var _0x4fb235={};_0x4fb235[_0x42e4f8[_0x6397('0x35')]]={'$like':'%'+_0x272e5e[_0x6397('0x3d')]['filter']+'%'};return _0x4fb235;}})});}_0x58dbef=_['merge']({},_0x58dbef,_0x272e5e[_0x6397('0x4a')]);var _0x603e01={'where':_0x58dbef[_0x6397('0x45')]};return db[_0x6397('0x4b')][_0x6397('0x29')](_0x603e01)[_0x6397('0x2f')](function(_0x31e5c2){_0x190940[_0x6397('0x29')]=_0x31e5c2;if(_0x272e5e[_0x6397('0x3d')][_0x6397('0x4c')]){_0x58dbef[_0x6397('0x4d')]=[{'all':!![]}];}return db[_0x6397('0x4b')][_0x6397('0x4e')](_0x58dbef);})['then'](function(_0x3e8f59){_0x190940[_0x6397('0x4f')]=_0x3e8f59;return _0x190940;})[_0x6397('0x2f')](respondWithFilteredResult(_0x2efc7d,_0x58dbef))[_0x6397('0x50')](handleError(_0x2efc7d,null));};exports['show']=function(_0x8db62a,_0x42db33){var _0x3e5f19={'raw':!![],'where':{'id':_0x8db62a[_0x6397('0x51')]['id']}},_0x55a13e={};_0x55a13e[_0x6397('0x3c')]=_['keys'](db['FaxQueue']['rawAttributes']);_0x55a13e[_0x6397('0x3d')]=_[_0x6397('0x52')](_0x8db62a[_0x6397('0x3d')]);_0x55a13e[_0x6397('0x3e')]=_['intersection'](_0x55a13e[_0x6397('0x3c')],_0x55a13e[_0x6397('0x3d')]);_0x3e5f19[_0x6397('0x41')]=_[_0x6397('0x3f')](_0x55a13e[_0x6397('0x3c')],qs[_0x6397('0x40')](_0x8db62a[_0x6397('0x3d')]['fields']));_0x3e5f19[_0x6397('0x41')]=_0x3e5f19[_0x6397('0x41')][_0x6397('0x53')]?_0x3e5f19['attributes']:_0x55a13e[_0x6397('0x3c')];if(_0x8db62a[_0x6397('0x3d')][_0x6397('0x4c')]){_0x3e5f19[_0x6397('0x4d')]=[{'all':!![]}];}_0x3e5f19=_[_0x6397('0x48')]({},_0x3e5f19,_0x8db62a[_0x6397('0x4a')]);return db[_0x6397('0x4b')][_0x6397('0x54')](_0x3e5f19)[_0x6397('0x2f')](handleEntityNotFound(_0x42db33,null))['then'](respondWithResult(_0x42db33,null))[_0x6397('0x50')](handleError(_0x42db33,null));};exports['create']=function(_0x4c22fc,_0x5e8a13){return db[_0x6397('0x4b')][_0x6397('0x55')](_0x4c22fc[_0x6397('0x56')],{})['then'](function(_0xc9abdb){var _0x13ac9f=_0x4c22fc[_0x6397('0x57')]['get']({'plain':!![]});if(!_0x13ac9f)throw new Error(_0x6397('0x58'));if(_0x13ac9f['role']===_0x6397('0x57')){var _0x59b4b6=_0xc9abdb[_0x6397('0x30')]({'plain':!![]});var _0x44bff5=_0x6397('0x31');return db[_0x6397('0x59')]['find']({'where':{'name':_0x44bff5,'userProfileId':_0x13ac9f[_0x6397('0x5a')]},'raw':!![]})[_0x6397('0x2f')](function(_0xc84f8a){if(_0xc84f8a&&_0xc84f8a['autoAssociation']===0x0){return db[_0x6397('0x32')]['create']({'name':_0x59b4b6[_0x6397('0x35')],'resourceId':_0x59b4b6['id'],'type':_0xc84f8a[_0x6397('0x35')],'sectionId':_0xc84f8a['id']},{})[_0x6397('0x2f')](function(){return _0xc9abdb;});}else{return _0xc9abdb;}})[_0x6397('0x50')](function(_0x15e3e7){logger[_0x6397('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15e3e7);throw _0x15e3e7;});}return _0xc9abdb;})[_0x6397('0x2f')](respondWithResult(_0x5e8a13,0xc9))['catch'](handleError(_0x5e8a13,null));};exports[_0x6397('0x2e')]=function(_0x1ae64a,_0x5b39ef){if(_0x1ae64a[_0x6397('0x56')]['id']){delete _0x1ae64a[_0x6397('0x56')]['id'];}return db[_0x6397('0x4b')]['find']({'where':{'id':_0x1ae64a[_0x6397('0x51')]['id']}})[_0x6397('0x2f')](handleEntityNotFound(_0x5b39ef,null))[_0x6397('0x2f')](saveUpdates(_0x1ae64a['body'],null))[_0x6397('0x2f')](respondWithResult(_0x5b39ef,null))[_0x6397('0x50')](handleError(_0x5b39ef,null));};exports['destroy']=function(_0x43cac2,_0x62ce7f){return db['FaxQueue']['find']({'where':{'id':_0x43cac2['params']['id']}})['then'](handleEntityNotFound(_0x62ce7f,null))[_0x6397('0x2f')](removeEntity(_0x62ce7f,null))[_0x6397('0x50')](handleError(_0x62ce7f,null));};exports['describe']=function(_0x359e21,_0x35488e){return db[_0x6397('0x4b')][_0x6397('0x5b')]()[_0x6397('0x2f')](respondWithResult(_0x35488e,null))[_0x6397('0x50')](handleError(_0x35488e,null));};exports[_0x6397('0x5c')]=function(_0x5204e8,_0x14b448,_0x381ede){var _0xa14289={'raw':!![],'where':{}},_0x4d9447={},_0xc5514;return db[_0x6397('0x4b')][_0x6397('0x5d')]({'where':{'id':_0x5204e8[_0x6397('0x51')]['id']}})['then'](handleEntityNotFound(_0x14b448,null))['then'](function(_0x31f754){if(_0x31f754){_0xc5514=_0x31f754[_0x6397('0x30')]({'plain':!![]});_0x4d9447[_0x6397('0x3c')]=_[_0x6397('0x52')](db['UserFaxQueue'][_0x6397('0x39')]);_0x4d9447['query']=_[_0x6397('0x52')](_0x5204e8[_0x6397('0x3d')]);_0x4d9447[_0x6397('0x3e')]=_[_0x6397('0x3f')](_0x4d9447[_0x6397('0x3c')],_0x4d9447['query']);_0xa14289[_0x6397('0x41')]=_[_0x6397('0x3f')](_0x4d9447[_0x6397('0x3c')],qs[_0x6397('0x40')](_0x5204e8[_0x6397('0x3d')][_0x6397('0x40')]));_0xa14289[_0x6397('0x41')]=_0xa14289[_0x6397('0x41')][_0x6397('0x53')]?_0xa14289[_0x6397('0x41')]:_0x4d9447[_0x6397('0x3c')];if(!_0x5204e8['query'][_0x6397('0x42')](_0x6397('0x5e'))){_0xa14289[_0x6397('0x28')]=qs[_0x6397('0x28')](_0x5204e8[_0x6397('0x3d')][_0x6397('0x28')]);_0xa14289[_0x6397('0x2a')]=qs['offset'](_0x5204e8[_0x6397('0x3d')][_0x6397('0x2a')]);}_0xa14289['order']=qs[_0x6397('0x44')](_0x5204e8[_0x6397('0x3d')][_0x6397('0x44')]);_0xa14289[_0x6397('0x45')]=qs['filters'](_['pick'](_0x5204e8['query'],_0x4d9447[_0x6397('0x3e')]));_0xa14289[_0x6397('0x45')][_0x6397('0x5f')]=_0x31f754['id'];if(_0x5204e8['query'][_0x6397('0x47')]){_0xa14289[_0x6397('0x45')]=_[_0x6397('0x48')](_0xa14289[_0x6397('0x45')],{'$or':_[_0x6397('0x38')](_0xa14289[_0x6397('0x41')],function(_0x571648){var _0xed18a4={};_0xed18a4[_0x571648]={'$like':'%'+_0x5204e8[_0x6397('0x3d')][_0x6397('0x47')]+'%'};return _0xed18a4;})});}_0xa14289=_['merge']({},_0xa14289,_0x5204e8['options']);return db[_0x6397('0x60')]['findAll'](_0xa14289);}})[_0x6397('0x2f')](function(_0x237495){if(_0x237495){return db['User'][_0x6397('0x61')]({'where':{'id':_['map'](_0x237495,_0x6397('0x62')),'role':_0x6397('0x63')},'attributes':['id','name',_0x6397('0x64'),_0x6397('0x65'),_0x6397('0x66')]});}})[_0x6397('0x2f')](function(_0x35db98){if(_0x35db98){return{'count':_0x35db98[_0x6397('0x29')],'rows':_[_0x6397('0x38')](_0x35db98[_0x6397('0x4f')],function(_0x1231fc){return{'membername':_0x1231fc[_0x6397('0x35')],'UserId':_0x1231fc['id'],'queue_name':_0xc5514[_0x6397('0x35')],'FaxQueueId':_0xc5514['id'],'interface':util['format'](_0x6397('0x67'),_0x6397('0x68'),_0x1231fc[_0x6397('0x35')]),'penalty':0x0,'paused':_0x1231fc[_0x6397('0x64')],'createdAt':_0x1231fc[_0x6397('0x66')],'updatedAt':_0x1231fc[_0x6397('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14b448,_0xa14289))['catch'](handleError(_0x14b448,null));};exports['getTeams']=function(_0xf3fd91,_0xf33dfc,_0x281492){var _0x140fbb={};var _0x5e3d7e={};var _0x365cf7;var _0x1e0262;return db['FaxQueue'][_0x6397('0x5d')]({'where':{'id':_0xf3fd91['params']['id']}})[_0x6397('0x2f')](handleEntityNotFound(_0xf33dfc,null))[_0x6397('0x2f')](function(_0x37a45a){if(_0x37a45a){_0x365cf7=_0x37a45a;_0x5e3d7e[_0x6397('0x3c')]=_[_0x6397('0x52')](db['Team']['rawAttributes']);_0x5e3d7e[_0x6397('0x3d')]=_[_0x6397('0x52')](_0xf3fd91[_0x6397('0x3d')]);_0x5e3d7e[_0x6397('0x3e')]=_[_0x6397('0x3f')](_0x5e3d7e[_0x6397('0x3c')],_0x5e3d7e[_0x6397('0x3d')]);_0x140fbb[_0x6397('0x41')]=_[_0x6397('0x3f')](_0x5e3d7e[_0x6397('0x3c')],qs['fields'](_0xf3fd91[_0x6397('0x3d')][_0x6397('0x40')]));_0x140fbb['attributes']=_0x140fbb[_0x6397('0x41')]['length']?_0x140fbb[_0x6397('0x41')]:_0x5e3d7e[_0x6397('0x3c')];_0x140fbb[_0x6397('0x43')]=qs[_0x6397('0x44')](_0xf3fd91[_0x6397('0x3d')][_0x6397('0x44')]);_0x140fbb[_0x6397('0x45')]=qs[_0x6397('0x3e')](_[_0x6397('0x46')](_0xf3fd91['query'],_0x5e3d7e[_0x6397('0x3e')]));if(_0xf3fd91['query']['filter']){_0x140fbb[_0x6397('0x45')]=_[_0x6397('0x48')](_0x140fbb[_0x6397('0x45')],{'$or':_[_0x6397('0x38')](_0x140fbb[_0x6397('0x41')],function(_0x472fd6){var _0x5057e8={};_0x5057e8[_0x472fd6]={'$like':'%'+_0xf3fd91[_0x6397('0x3d')][_0x6397('0x47')]+'%'};return _0x5057e8;})});}_0x140fbb=_[_0x6397('0x48')]({},_0x140fbb,_0xf3fd91[_0x6397('0x4a')]);return _0x365cf7[_0x6397('0x69')](_0x140fbb);}})[_0x6397('0x2f')](function(_0x426c06){if(_0x426c06){_0x1e0262=_0x426c06[_0x6397('0x53')];if(!_0xf3fd91[_0x6397('0x3d')]['hasOwnProperty'](_0x6397('0x5e'))){_0x140fbb[_0x6397('0x28')]=qs['limit'](_0xf3fd91[_0x6397('0x3d')]['limit']);_0x140fbb[_0x6397('0x2a')]=qs[_0x6397('0x2a')](_0xf3fd91[_0x6397('0x3d')][_0x6397('0x2a')]);}return _0x365cf7[_0x6397('0x69')](_0x140fbb);}})[_0x6397('0x2f')](function(_0x2475ea){if(_0x2475ea){return _0x2475ea?{'count':_0x1e0262,'rows':_0x2475ea}:null;}})['then'](respondWithResult(_0xf33dfc,null))[_0x6397('0x50')](handleError(_0xf33dfc,null));};exports[_0x6397('0x6a')]=function(_0x13e0b3,_0x381cee,_0x4cad5a){var _0x42dbda=_0x13e0b3[_0x6397('0x56')][_0x6397('0x6b')];return db['Team']['findAll']({'where':{'id':_0x42dbda},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6397('0x6c'),'attributes':['id','name',_0x6397('0x6d'),_0x6397('0x6e'),_0x6397('0x6f')],'raw':!![]}]})['then'](function(_0x295976){if(_0x295976){var _0x19977f=_[_0x6397('0x70')](_0x295976,function(_0x2187fe){var _0xcac35e=_0x2187fe[_0x6397('0x30')]({'plain':!![]});return _0xcac35e[_0x6397('0x6c')];});return db[_0x6397('0x4b')][_0x6397('0x54')]({'where':{'id':_0x13e0b3[_0x6397('0x51')]['id']}})[_0x6397('0x2f')](function(_0x11a169){return db[_0x6397('0x71')]['transaction'](function(_0x15e4b2){return _0x11a169['addTeams'](_0x42dbda,{'transaction':_0x15e4b2})[_0x6397('0x2f')](function(){return BPromise[_0x6397('0x72')](_0x19977f,function(_0x56f5db){return db[_0x6397('0x60')]['findOrCreate']({'where':{'UserId':_0x56f5db['id'],'FaxQueueId':_0x13e0b3[_0x6397('0x51')]['id']},'transaction':_0x15e4b2});});})[_0x6397('0x2f')](function(){_0x19977f['forEach'](function(_0x1faa7c){socket[_0x6397('0x73')](_0x6397('0x74'),{'UserId':_0x1faa7c['id'],'FaxQueueId':_0x11a169['id']});});});});});}})[_0x6397('0x2f')](respondWithStatusCode(_0x381cee,null))['catch'](handleError(_0x381cee,null));};exports[_0x6397('0x75')]=function(_0x321225,_0x1739fb,_0x6cb6d5){return db[_0x6397('0x76')][_0x6397('0x4e')]({'where':{'id':_0x321225[_0x6397('0x3d')][_0x6397('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x6397('0x77')],'as':_0x6397('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x6397('0x2f')](handleEntityNotFound(_0x1739fb,null))[_0x6397('0x2f')](function(_0x4ea355){var _0xdd5ec9=_[_0x6397('0x38')](_0x4ea355,'id');var _0x249eea=[];var _0x552931=[];var _0xe9cacf=squel[_0x6397('0x78')]();_0xe9cacf['field'](_0x6397('0x79'))['from'](_0x6397('0x7a'),'tq')['join'](_0x6397('0x7b'),'ut',_0x6397('0x7c'))['where'](_0x6397('0x7d'),_0x321225[_0x6397('0x51')]['id']);for(var _0x146979=0x0;_0x146979<_0x4ea355['length'];_0x146979+=0x1){let _0x36b60c=_0x4ea355[_0x146979];for(var _0x31d41f=0x0;_0x31d41f<_0x36b60c[_0x6397('0x6c')][_0x6397('0x53')];_0x31d41f+=0x1){let _0x76f60d=_0x36b60c['Agents'][_0x31d41f];var _0x17c534=_0xe9cacf['clone']();_0x17c534[_0x6397('0x45')](_0x6397('0x7e'),_0x76f60d['id']);_0x552931[_0x6397('0x7f')](db[_0x6397('0x71')][_0x6397('0x3d')](_0x17c534[_0x6397('0x80')](),{'type':db[_0x6397('0x71')][_0x6397('0x81')][_0x6397('0x82')]})[_0x6397('0x2f')](function(_0x3d8475){if(_0x3d8475[_0x6397('0x53')]===0x1){return _0x76f60d['id'];}else{var _0x4863f7=_[_0x6397('0x83')](_[_0x6397('0x38')](_0x3d8475,_0x6397('0x84')),function(_0x38642e){return _['includes'](_0xdd5ec9,_0x38642e);});if(_0x4863f7){return _0x76f60d['id'];}}}));}}return BPromise[_0x6397('0x85')](_0x552931)[_0x6397('0x2f')](function(_0x4da14c){_0x249eea=_(_0x249eea)[_0x6397('0x86')](_0x4da14c)['compact']()[_0x6397('0x87')]();return db[_0x6397('0x4b')][_0x6397('0x54')]({'where':{'id':_0x321225['params']['id']}})[_0x6397('0x2f')](function(_0x2c64a9){return db[_0x6397('0x71')][_0x6397('0x88')](function(_0x22e254){return _0x2c64a9[_0x6397('0x75')](_0x321225[_0x6397('0x3d')][_0x6397('0x6b')],{'transaction':_0x22e254})[_0x6397('0x2f')](function(){if(!_[_0x6397('0x89')](_0x249eea)){return _0x2c64a9[_0x6397('0x8a')](_0x249eea,{'transaction':_0x22e254});}})['then'](function(){_0x249eea[_0x6397('0x8b')](function(_0x1b0baf){socket[_0x6397('0x73')]('userFaxQueue:remove',{'UserId':_0x1b0baf,'FaxQueueId':_0x2c64a9['id']});});});});});});})['then'](respondWithStatusCode(_0x1739fb,null))[_0x6397('0x50')](handleError(_0x1739fb,null));};exports['addAgents']=function(_0x308673,_0x29dace,_0x5b9c81){return db['FaxQueue'][_0x6397('0x54')]({'where':{'id':_0x308673[_0x6397('0x51')]['id']}})['then'](handleEntityNotFound(_0x29dace,null))[_0x6397('0x2f')](function(_0x588255){if(_0x588255){return _0x588255[_0x6397('0x8c')](_0x308673[_0x6397('0x56')][_0x6397('0x6b')],_['omit'](_0x308673[_0x6397('0x56')],[_0x6397('0x6b'),'id'])||{})[_0x6397('0x8d')](function(_0x2d8d59){for(var _0x1a0018=0x0;_0x1a0018<_0x308673[_0x6397('0x56')]['ids'][_0x6397('0x53')];_0x1a0018+=0x1){socket[_0x6397('0x73')](_0x6397('0x74'),{'UserId':Number(_0x308673[_0x6397('0x56')][_0x6397('0x6b')][_0x1a0018]),'FaxQueueId':Number(_0x308673[_0x6397('0x51')]['id'])});}return _0x2d8d59;});}})[_0x6397('0x2f')](respondWithResult(_0x29dace,null))[_0x6397('0x50')](handleError(_0x29dace,null));};exports[_0x6397('0x8a')]=function(_0x3537d6,_0xf8bc7e,_0x52ffbb){return db[_0x6397('0x4b')]['find']({'where':{'id':_0x3537d6[_0x6397('0x51')]['id']}})[_0x6397('0x2f')](handleEntityNotFound(_0xf8bc7e,null))[_0x6397('0x2f')](function(_0x38c3fd){if(_0x38c3fd){return _0x38c3fd[_0x6397('0x8a')](_0x3537d6[_0x6397('0x3d')][_0x6397('0x6b')])[_0x6397('0x2f')](function(){if(_[_0x6397('0x8e')](_0x3537d6['query']['ids'])){for(var _0x15f468=0x0;_0x15f468<_0x3537d6[_0x6397('0x3d')][_0x6397('0x6b')][_0x6397('0x53')];_0x15f468+=0x1){socket[_0x6397('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x3537d6['query'][_0x6397('0x6b')][_0x15f468]),'FaxQueueId':Number(_0x3537d6['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3537d6[_0x6397('0x3d')][_0x6397('0x6b')]),'FaxQueueId':Number(_0x3537d6['params']['id'])});}});}})[_0x6397('0x2f')](respondWithStatusCode(_0xf8bc7e,null))['catch'](handleError(_0xf8bc7e,null));};exports[_0x6397('0x8f')]=function(_0x569abf,_0x29b2c8,_0x102d21){var _0x51a98b={};var _0x220b41={};var _0x245fe4;var _0x1d6bed;return db[_0x6397('0x4b')]['findOne']({'where':{'id':_0x569abf[_0x6397('0x51')]['id']}})['then'](handleEntityNotFound(_0x29b2c8,null))[_0x6397('0x2f')](function(_0xf549c9){if(_0xf549c9){_0x245fe4=_0xf549c9;_0x220b41[_0x6397('0x3c')]=_[_0x6397('0x52')](db['User']['rawAttributes']);_0x220b41[_0x6397('0x3d')]=_['keys'](_0x569abf[_0x6397('0x3d')]);_0x220b41[_0x6397('0x3e')]=_[_0x6397('0x3f')](_0x220b41[_0x6397('0x3c')],_0x220b41[_0x6397('0x3d')]);_0x51a98b[_0x6397('0x41')]=_['intersection'](_0x220b41[_0x6397('0x3c')],qs[_0x6397('0x40')](_0x569abf['query'][_0x6397('0x40')]));_0x51a98b[_0x6397('0x41')]=_0x51a98b[_0x6397('0x41')][_0x6397('0x53')]?_0x51a98b[_0x6397('0x41')]:_0x220b41[_0x6397('0x3c')];_0x51a98b['order']=qs['sort'](_0x569abf[_0x6397('0x3d')][_0x6397('0x44')]);_0x51a98b[_0x6397('0x45')]=qs[_0x6397('0x3e')](_[_0x6397('0x46')](_0x569abf[_0x6397('0x3d')],_0x220b41[_0x6397('0x3e')]));if(_0x569abf[_0x6397('0x3d')][_0x6397('0x47')]){_0x51a98b[_0x6397('0x45')]=_['merge'](_0x51a98b['where'],{'$or':_[_0x6397('0x38')](_0x51a98b[_0x6397('0x41')],function(_0x1a2855){var _0xdd5884={};_0xdd5884[_0x1a2855]={'$like':'%'+_0x569abf['query']['filter']+'%'};return _0xdd5884;})});}_0x51a98b=_[_0x6397('0x48')]({},_0x51a98b,_0x569abf[_0x6397('0x4a')]);return _0x245fe4[_0x6397('0x8f')](_0x51a98b);}})['then'](function(_0x31318a){if(_0x31318a){_0x1d6bed=_0x31318a[_0x6397('0x53')];if(!_0x569abf[_0x6397('0x3d')]['hasOwnProperty']('nolimit')){_0x51a98b['limit']=qs[_0x6397('0x28')](_0x569abf['query'][_0x6397('0x28')]);_0x51a98b[_0x6397('0x2a')]=qs[_0x6397('0x2a')](_0x569abf[_0x6397('0x3d')][_0x6397('0x2a')]);}return _0x245fe4[_0x6397('0x8f')](_0x51a98b);}})[_0x6397('0x2f')](function(_0x3cff1a){if(_0x3cff1a){return _0x3cff1a?{'count':_0x1d6bed,'rows':_0x3cff1a}:null;}})['then'](respondWithResult(_0x29b2c8,null))[_0x6397('0x50')](handleError(_0x29b2c8,null));}; \ No newline at end of file +var _0x33d0=['each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','offset','undefined','count','limit','status','Content-Range','json','apply','reject','save','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','rawAttributes','nolimit','FaxQueueId','merge','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','voicePause','flatMap','transaction'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x33d0,0x144));var _0x033d=function(_0x27cc90,_0x5bd896){_0x27cc90=_0x27cc90-0x0;var _0x3845f3=_0x33d0[_0x27cc90];return _0x3845f3;};'use strict';var emlformat=require(_0x033d('0x0'));var rimraf=require(_0x033d('0x1'));var zipdir=require(_0x033d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x033d('0x3'));var moment=require('moment');var BPromise=require(_0x033d('0x4'));var Mustache=require(_0x033d('0x5'));var util=require(_0x033d('0x6'));var path=require('path');var sox=require(_0x033d('0x7'));var csv=require('to-csv');var ejs=require(_0x033d('0x8'));var fs=require('fs');var fs_extra=require(_0x033d('0x9'));var _=require(_0x033d('0xa'));var squel=require(_0x033d('0xb'));var crypto=require(_0x033d('0xc'));var jsforce=require(_0x033d('0xd'));var deskjs=require(_0x033d('0xe'));var toCsv=require(_0x033d('0xf'));var querystring=require(_0x033d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x033d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x033d('0x12'))(_0x033d('0x13'));var utils=require(_0x033d('0x14'));var config=require(_0x033d('0x15'));var licenseUtil=require(_0x033d('0x16'));var db=require(_0x033d('0x17'))['db'];config[_0x033d('0x18')]=_[_0x033d('0x19')](config[_0x033d('0x18')],{'host':_0x033d('0x1a'),'port':0x18eb});var socket=require(_0x033d('0x1b'))(new Redis(config['redis']));require(_0x033d('0x1c'))[_0x033d('0x1d')](socket);function respondWithStatusCode(_0x377a1b,_0x25ad4e){_0x25ad4e=_0x25ad4e||0xcc;return function(_0x4bf9a2){if(_0x4bf9a2){return _0x377a1b[_0x033d('0x1e')](_0x25ad4e);}return _0x377a1b['status'](_0x25ad4e)['end']();};}function respondWithResult(_0x5c7092,_0xcb1f83){_0xcb1f83=_0xcb1f83||0xc8;return function(_0x533581){if(_0x533581){return _0x5c7092['status'](_0xcb1f83)['json'](_0x533581);}};}function respondWithFilteredResult(_0x2819a4,_0x109153){return function(_0x550c95){if(_0x550c95){var _0x5f4cf8=typeof _0x109153[_0x033d('0x1f')]===_0x033d('0x20')&&typeof _0x109153['limit']==='undefined';var _0x347c63=_0x550c95[_0x033d('0x21')];var _0x3df356=_0x5f4cf8?0x0:_0x109153['offset'];var _0x3b310d=_0x5f4cf8?_0x550c95['count']:_0x109153['offset']+_0x109153[_0x033d('0x22')];var _0x26dede;if(_0x3b310d>=_0x347c63){_0x3b310d=_0x347c63;_0x26dede=0xc8;}else{_0x26dede=0xce;}_0x2819a4[_0x033d('0x23')](_0x26dede);return _0x2819a4['set'](_0x033d('0x24'),_0x3df356+'-'+_0x3b310d+'/'+_0x347c63)[_0x033d('0x25')](_0x550c95);}return null;};}function patchUpdates(_0x51ba58){return function(_0x4ce4c9){try{jsonpatch[_0x033d('0x26')](_0x4ce4c9,_0x51ba58,!![]);}catch(_0x368460){return BPromise[_0x033d('0x27')](_0x368460);}return _0x4ce4c9[_0x033d('0x28')]();};}function saveUpdates(_0xd93333,_0x23170a){return function(_0x44926c){if(_0x44926c){return _0x44926c['update'](_0xd93333)['then'](function(_0x5a705c){return _0x5a705c;});}return null;};}function removeEntity(_0x5cb812,_0x17e390){return function(_0xb8d2ec){if(_0xb8d2ec){return _0xb8d2ec[_0x033d('0x29')]()[_0x033d('0x2a')](function(){var _0x96f08f=_0xb8d2ec[_0x033d('0x2b')]({'plain':!![]});var _0x5489f6=_0x033d('0x2c');return db[_0x033d('0x2d')]['destroy']({'where':{'type':_0x5489f6,'resourceId':_0x96f08f['id']}})[_0x033d('0x2a')](function(){return _0xb8d2ec;});})['then'](function(){_0x5cb812[_0x033d('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x183470,_0x22f607){return function(_0x1c037e){if(!_0x1c037e){_0x183470['sendStatus'](0x194);}return _0x1c037e;};}function handleError(_0x172f8a,_0x379bdb){_0x379bdb=_0x379bdb||0x1f4;return function(_0xd460be){logger[_0x033d('0x2e')](_0xd460be[_0x033d('0x2f')]);if(_0xd460be['name']){delete _0xd460be[_0x033d('0x30')];}_0x172f8a['status'](_0x379bdb)[_0x033d('0x31')](_0xd460be);};}exports[_0x033d('0x32')]=function(_0x548c0e,_0x32d738){var _0x2581b1={},_0x490432={},_0x1438e2={'count':0x0,'rows':[]};var _0x49b2a2=_[_0x033d('0x33')](db[_0x033d('0x34')]['rawAttributes'],function(_0x5f1e6f){return{'name':_0x5f1e6f[_0x033d('0x35')],'type':_0x5f1e6f['type']['key']};});_0x490432[_0x033d('0x36')]=_['map'](_0x49b2a2,_0x033d('0x30'));_0x490432[_0x033d('0x37')]=_[_0x033d('0x38')](_0x548c0e[_0x033d('0x37')]);_0x490432[_0x033d('0x39')]=_[_0x033d('0x3a')](_0x490432[_0x033d('0x36')],_0x490432['query']);_0x2581b1[_0x033d('0x3b')]=_[_0x033d('0x3a')](_0x490432[_0x033d('0x36')],qs[_0x033d('0x3c')](_0x548c0e[_0x033d('0x37')][_0x033d('0x3c')]));_0x2581b1[_0x033d('0x3b')]=_0x2581b1[_0x033d('0x3b')][_0x033d('0x3d')]?_0x2581b1['attributes']:_0x490432[_0x033d('0x36')];if(!_0x548c0e[_0x033d('0x37')][_0x033d('0x3e')]('nolimit')){_0x2581b1[_0x033d('0x22')]=qs[_0x033d('0x22')](_0x548c0e[_0x033d('0x37')][_0x033d('0x22')]);_0x2581b1[_0x033d('0x1f')]=qs[_0x033d('0x1f')](_0x548c0e[_0x033d('0x37')]['offset']);}_0x2581b1[_0x033d('0x3f')]=qs[_0x033d('0x40')](_0x548c0e[_0x033d('0x37')][_0x033d('0x40')]);_0x2581b1[_0x033d('0x41')]=qs['filters'](_[_0x033d('0x42')](_0x548c0e['query'],_0x490432[_0x033d('0x39')]),_0x49b2a2);if(_0x548c0e[_0x033d('0x37')][_0x033d('0x43')]){_0x2581b1[_0x033d('0x41')]=_['merge'](_0x2581b1[_0x033d('0x41')],{'$or':_[_0x033d('0x33')](_0x49b2a2,function(_0x197b1e){if(_0x197b1e[_0x033d('0x44')]!==_0x033d('0x45')){var _0x213388={};_0x213388[_0x197b1e[_0x033d('0x30')]]={'$like':'%'+_0x548c0e['query'][_0x033d('0x43')]+'%'};return _0x213388;}})});}_0x2581b1=_['merge']({},_0x2581b1,_0x548c0e[_0x033d('0x46')]);var _0x137707={'where':_0x2581b1[_0x033d('0x41')]};return db[_0x033d('0x34')][_0x033d('0x21')](_0x137707)[_0x033d('0x2a')](function(_0x2d384d){_0x1438e2['count']=_0x2d384d;if(_0x548c0e[_0x033d('0x37')]['includeAll']){_0x2581b1['include']=[{'all':!![]}];}return db[_0x033d('0x34')][_0x033d('0x47')](_0x2581b1);})[_0x033d('0x2a')](function(_0x3b587b){_0x1438e2[_0x033d('0x48')]=_0x3b587b;return _0x1438e2;})[_0x033d('0x2a')](respondWithFilteredResult(_0x32d738,_0x2581b1))[_0x033d('0x49')](handleError(_0x32d738,null));};exports[_0x033d('0x4a')]=function(_0x258090,_0x1e8bb3){var _0x4a870d={'raw':!![],'where':{'id':_0x258090[_0x033d('0x4b')]['id']}},_0x590cdd={};_0x590cdd[_0x033d('0x36')]=_[_0x033d('0x38')](db[_0x033d('0x34')]['rawAttributes']);_0x590cdd['query']=_[_0x033d('0x38')](_0x258090[_0x033d('0x37')]);_0x590cdd['filters']=_[_0x033d('0x3a')](_0x590cdd[_0x033d('0x36')],_0x590cdd[_0x033d('0x37')]);_0x4a870d[_0x033d('0x3b')]=_['intersection'](_0x590cdd[_0x033d('0x36')],qs[_0x033d('0x3c')](_0x258090[_0x033d('0x37')][_0x033d('0x3c')]));_0x4a870d[_0x033d('0x3b')]=_0x4a870d[_0x033d('0x3b')][_0x033d('0x3d')]?_0x4a870d[_0x033d('0x3b')]:_0x590cdd[_0x033d('0x36')];if(_0x258090[_0x033d('0x37')][_0x033d('0x4c')]){_0x4a870d[_0x033d('0x4d')]=[{'all':!![]}];}_0x4a870d=_['merge']({},_0x4a870d,_0x258090[_0x033d('0x46')]);return db[_0x033d('0x34')][_0x033d('0x4e')](_0x4a870d)['then'](handleEntityNotFound(_0x1e8bb3,null))[_0x033d('0x2a')](respondWithResult(_0x1e8bb3,null))[_0x033d('0x49')](handleError(_0x1e8bb3,null));};exports['create']=function(_0x113b3a,_0x1ee946){return db[_0x033d('0x34')][_0x033d('0x4f')](_0x113b3a[_0x033d('0x50')],{})[_0x033d('0x2a')](function(_0x128840){var _0xe7d1b1=_0x113b3a[_0x033d('0x51')][_0x033d('0x2b')]({'plain':!![]});if(!_0xe7d1b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe7d1b1[_0x033d('0x52')]==='user'){var _0x4f918b=_0x128840[_0x033d('0x2b')]({'plain':!![]});var _0x4270ea=_0x033d('0x2c');return db[_0x033d('0x53')][_0x033d('0x4e')]({'where':{'name':_0x4270ea,'userProfileId':_0xe7d1b1[_0x033d('0x54')]},'raw':!![]})['then'](function(_0x411a53){if(_0x411a53&&_0x411a53[_0x033d('0x55')]===0x0){return db[_0x033d('0x2d')]['create']({'name':_0x4f918b[_0x033d('0x30')],'resourceId':_0x4f918b['id'],'type':_0x411a53[_0x033d('0x30')],'sectionId':_0x411a53['id']},{})[_0x033d('0x2a')](function(){return _0x128840;});}else{return _0x128840;}})[_0x033d('0x49')](function(_0xfb8767){logger[_0x033d('0x2e')](_0x033d('0x56'),_0xfb8767);throw _0xfb8767;});}return _0x128840;})[_0x033d('0x2a')](respondWithResult(_0x1ee946,0xc9))['catch'](handleError(_0x1ee946,null));};exports['update']=function(_0x1a41bb,_0x16bfb6){if(_0x1a41bb[_0x033d('0x50')]['id']){delete _0x1a41bb['body']['id'];}return db[_0x033d('0x34')][_0x033d('0x4e')]({'where':{'id':_0x1a41bb[_0x033d('0x4b')]['id']}})[_0x033d('0x2a')](handleEntityNotFound(_0x16bfb6,null))[_0x033d('0x2a')](saveUpdates(_0x1a41bb[_0x033d('0x50')],null))[_0x033d('0x2a')](respondWithResult(_0x16bfb6,null))['catch'](handleError(_0x16bfb6,null));};exports[_0x033d('0x29')]=function(_0x5f00c2,_0x25dece){return db[_0x033d('0x34')][_0x033d('0x4e')]({'where':{'id':_0x5f00c2['params']['id']}})['then'](handleEntityNotFound(_0x25dece,null))[_0x033d('0x2a')](removeEntity(_0x25dece,null))[_0x033d('0x49')](handleError(_0x25dece,null));};exports[_0x033d('0x57')]=function(_0x221d69,_0x2383f0){return db['FaxQueue'][_0x033d('0x57')]()[_0x033d('0x2a')](respondWithResult(_0x2383f0,null))[_0x033d('0x49')](handleError(_0x2383f0,null));};exports[_0x033d('0x58')]=function(_0x4b7824,_0x165b35,_0x287d49){var _0x336147={'raw':!![],'where':{}},_0x1ab595={},_0x3a6567;return db['FaxQueue'][_0x033d('0x59')]({'where':{'id':_0x4b7824[_0x033d('0x4b')]['id']}})[_0x033d('0x2a')](handleEntityNotFound(_0x165b35,null))[_0x033d('0x2a')](function(_0x3ccf7e){if(_0x3ccf7e){_0x3a6567=_0x3ccf7e[_0x033d('0x2b')]({'plain':!![]});_0x1ab595[_0x033d('0x36')]=_['keys'](db[_0x033d('0x5a')][_0x033d('0x5b')]);_0x1ab595['query']=_[_0x033d('0x38')](_0x4b7824[_0x033d('0x37')]);_0x1ab595[_0x033d('0x39')]=_[_0x033d('0x3a')](_0x1ab595[_0x033d('0x36')],_0x1ab595[_0x033d('0x37')]);_0x336147[_0x033d('0x3b')]=_[_0x033d('0x3a')](_0x1ab595['model'],qs[_0x033d('0x3c')](_0x4b7824[_0x033d('0x37')][_0x033d('0x3c')]));_0x336147[_0x033d('0x3b')]=_0x336147['attributes'][_0x033d('0x3d')]?_0x336147[_0x033d('0x3b')]:_0x1ab595['model'];if(!_0x4b7824[_0x033d('0x37')]['hasOwnProperty'](_0x033d('0x5c'))){_0x336147[_0x033d('0x22')]=qs['limit'](_0x4b7824['query'][_0x033d('0x22')]);_0x336147[_0x033d('0x1f')]=qs[_0x033d('0x1f')](_0x4b7824[_0x033d('0x37')][_0x033d('0x1f')]);}_0x336147['order']=qs[_0x033d('0x40')](_0x4b7824['query']['sort']);_0x336147[_0x033d('0x41')]=qs[_0x033d('0x39')](_['pick'](_0x4b7824[_0x033d('0x37')],_0x1ab595[_0x033d('0x39')]));_0x336147['where'][_0x033d('0x5d')]=_0x3ccf7e['id'];if(_0x4b7824['query'][_0x033d('0x43')]){_0x336147[_0x033d('0x41')]=_[_0x033d('0x5e')](_0x336147[_0x033d('0x41')],{'$or':_[_0x033d('0x33')](_0x336147['attributes'],function(_0x3c0850){var _0x4e9505={};_0x4e9505[_0x3c0850]={'$like':'%'+_0x4b7824[_0x033d('0x37')][_0x033d('0x43')]+'%'};return _0x4e9505;})});}_0x336147=_[_0x033d('0x5e')]({},_0x336147,_0x4b7824[_0x033d('0x46')]);return db[_0x033d('0x5a')][_0x033d('0x47')](_0x336147);}})['then'](function(_0x2fe82d){if(_0x2fe82d){return db[_0x033d('0x5f')][_0x033d('0x60')]({'where':{'id':_[_0x033d('0x33')](_0x2fe82d,_0x033d('0x61')),'role':_0x033d('0x62')},'attributes':['id',_0x033d('0x30'),_0x033d('0x63'),_0x033d('0x64'),_0x033d('0x65')]});}})[_0x033d('0x2a')](function(_0x18ee07){if(_0x18ee07){return{'count':_0x18ee07[_0x033d('0x21')],'rows':_['map'](_0x18ee07['rows'],function(_0x5dba1b){return{'membername':_0x5dba1b[_0x033d('0x30')],'UserId':_0x5dba1b['id'],'queue_name':_0x3a6567[_0x033d('0x30')],'FaxQueueId':_0x3a6567['id'],'interface':util['format'](_0x033d('0x66'),'SIP',_0x5dba1b[_0x033d('0x30')]),'penalty':0x0,'paused':_0x5dba1b['faxPause'],'createdAt':_0x5dba1b[_0x033d('0x65')],'updatedAt':_0x5dba1b[_0x033d('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x033d('0x2a')](respondWithFilteredResult(_0x165b35,_0x336147))[_0x033d('0x49')](handleError(_0x165b35,null));};exports[_0x033d('0x67')]=function(_0x1339a9,_0x391a3a,_0x3e89c4){var _0x2e535b={};var _0x48a890={};var _0x59f5c6;var _0x3b6834;return db[_0x033d('0x34')][_0x033d('0x59')]({'where':{'id':_0x1339a9['params']['id']}})['then'](handleEntityNotFound(_0x391a3a,null))[_0x033d('0x2a')](function(_0x4e9ce5){if(_0x4e9ce5){_0x59f5c6=_0x4e9ce5;_0x48a890[_0x033d('0x36')]=_[_0x033d('0x38')](db[_0x033d('0x68')][_0x033d('0x5b')]);_0x48a890[_0x033d('0x37')]=_['keys'](_0x1339a9[_0x033d('0x37')]);_0x48a890[_0x033d('0x39')]=_[_0x033d('0x3a')](_0x48a890[_0x033d('0x36')],_0x48a890[_0x033d('0x37')]);_0x2e535b['attributes']=_[_0x033d('0x3a')](_0x48a890['model'],qs[_0x033d('0x3c')](_0x1339a9[_0x033d('0x37')][_0x033d('0x3c')]));_0x2e535b['attributes']=_0x2e535b[_0x033d('0x3b')][_0x033d('0x3d')]?_0x2e535b[_0x033d('0x3b')]:_0x48a890[_0x033d('0x36')];_0x2e535b[_0x033d('0x3f')]=qs[_0x033d('0x40')](_0x1339a9[_0x033d('0x37')][_0x033d('0x40')]);_0x2e535b['where']=qs[_0x033d('0x39')](_[_0x033d('0x42')](_0x1339a9['query'],_0x48a890[_0x033d('0x39')]));if(_0x1339a9[_0x033d('0x37')][_0x033d('0x43')]){_0x2e535b[_0x033d('0x41')]=_[_0x033d('0x5e')](_0x2e535b['where'],{'$or':_[_0x033d('0x33')](_0x2e535b[_0x033d('0x3b')],function(_0x585abf){var _0x65f42={};_0x65f42[_0x585abf]={'$like':'%'+_0x1339a9[_0x033d('0x37')]['filter']+'%'};return _0x65f42;})});}_0x2e535b=_[_0x033d('0x5e')]({},_0x2e535b,_0x1339a9[_0x033d('0x46')]);return _0x59f5c6[_0x033d('0x67')](_0x2e535b);}})[_0x033d('0x2a')](function(_0xb14843){if(_0xb14843){_0x3b6834=_0xb14843[_0x033d('0x3d')];if(!_0x1339a9['query'][_0x033d('0x3e')](_0x033d('0x5c'))){_0x2e535b[_0x033d('0x22')]=qs['limit'](_0x1339a9['query']['limit']);_0x2e535b['offset']=qs[_0x033d('0x1f')](_0x1339a9[_0x033d('0x37')]['offset']);}return _0x59f5c6[_0x033d('0x67')](_0x2e535b);}})[_0x033d('0x2a')](function(_0x1c7ff5){if(_0x1c7ff5){return _0x1c7ff5?{'count':_0x3b6834,'rows':_0x1c7ff5}:null;}})[_0x033d('0x2a')](respondWithResult(_0x391a3a,null))[_0x033d('0x49')](handleError(_0x391a3a,null));};exports[_0x033d('0x69')]=function(_0x25e293,_0x20db6e,_0x3f3383){var _0xc8b04f=_0x25e293['body'][_0x033d('0x6a')];return db[_0x033d('0x68')][_0x033d('0x47')]({'where':{'id':_0xc8b04f},'attributes':['id'],'include':[{'model':db[_0x033d('0x5f')],'as':_0x033d('0x6b'),'attributes':['id',_0x033d('0x30'),'online',_0x033d('0x6c'),'interface'],'raw':!![]}]})[_0x033d('0x2a')](function(_0x51418b){if(_0x51418b){var _0x37a264=_[_0x033d('0x6d')](_0x51418b,function(_0x4ec3fd){var _0x28ccca=_0x4ec3fd['get']({'plain':!![]});return _0x28ccca[_0x033d('0x6b')];});return db[_0x033d('0x34')][_0x033d('0x4e')]({'where':{'id':_0x25e293[_0x033d('0x4b')]['id']}})[_0x033d('0x2a')](function(_0x4c5167){return db['sequelize'][_0x033d('0x6e')](function(_0x33dc22){return _0x4c5167[_0x033d('0x69')](_0xc8b04f,{'transaction':_0x33dc22})[_0x033d('0x2a')](function(){return BPromise[_0x033d('0x6f')](_0x37a264,function(_0x11416f){return db[_0x033d('0x5a')][_0x033d('0x70')]({'where':{'UserId':_0x11416f['id'],'FaxQueueId':_0x25e293['params']['id']},'transaction':_0x33dc22});});})[_0x033d('0x2a')](function(){_0x37a264[_0x033d('0x71')](function(_0x3b160d){socket['emit'](_0x033d('0x72'),{'UserId':_0x3b160d['id'],'FaxQueueId':_0x4c5167['id']});});});});});}})[_0x033d('0x2a')](respondWithStatusCode(_0x20db6e,null))['catch'](handleError(_0x20db6e,null));};exports[_0x033d('0x73')]=function(_0x29e020,_0xa02250,_0x4df6a4){return db[_0x033d('0x68')][_0x033d('0x47')]({'where':{'id':_0x29e020[_0x033d('0x37')][_0x033d('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x033d('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa02250,null))[_0x033d('0x2a')](function(_0x2504f0){var _0x50c3e6=_[_0x033d('0x33')](_0x2504f0,'id');var _0x4df490=[];var _0x288ff3=[];var _0x1a0ef2=squel[_0x033d('0x74')]();_0x1a0ef2[_0x033d('0x75')](_0x033d('0x76'))[_0x033d('0x77')](_0x033d('0x78'),'tq')[_0x033d('0x79')](_0x033d('0x7a'),'ut',_0x033d('0x7b'))['where'](_0x033d('0x7c'),_0x29e020[_0x033d('0x4b')]['id']);for(var _0x655f60=0x0;_0x655f60<_0x2504f0[_0x033d('0x3d')];_0x655f60+=0x1){let _0x3d7076=_0x2504f0[_0x655f60];for(var _0x16d3d6=0x0;_0x16d3d6<_0x3d7076[_0x033d('0x6b')][_0x033d('0x3d')];_0x16d3d6+=0x1){let _0x1dc6fa=_0x3d7076['Agents'][_0x16d3d6];var _0x14de8d=_0x1a0ef2[_0x033d('0x7d')]();_0x14de8d[_0x033d('0x41')](_0x033d('0x7e'),_0x1dc6fa['id']);_0x288ff3[_0x033d('0x7f')](db['sequelize'][_0x033d('0x37')](_0x14de8d[_0x033d('0x80')](),{'type':db[_0x033d('0x81')][_0x033d('0x82')]['SELECT']})[_0x033d('0x2a')](function(_0x407c4d){if(_0x407c4d[_0x033d('0x3d')]===0x1){return _0x1dc6fa['id'];}else{var _0x3c20c8=_[_0x033d('0x83')](_[_0x033d('0x33')](_0x407c4d,_0x033d('0x84')),function(_0x56d7ed){return _[_0x033d('0x85')](_0x50c3e6,_0x56d7ed);});if(_0x3c20c8){return _0x1dc6fa['id'];}}}));}}return BPromise[_0x033d('0x86')](_0x288ff3)[_0x033d('0x2a')](function(_0x55eeaa){_0x4df490=_(_0x4df490)[_0x033d('0x87')](_0x55eeaa)[_0x033d('0x88')]()['value']();return db[_0x033d('0x34')][_0x033d('0x4e')]({'where':{'id':_0x29e020[_0x033d('0x4b')]['id']}})[_0x033d('0x2a')](function(_0x31c7ce){return db[_0x033d('0x81')][_0x033d('0x6e')](function(_0xa8e7f9){return _0x31c7ce['removeTeams'](_0x29e020['query']['ids'],{'transaction':_0xa8e7f9})['then'](function(){if(!_[_0x033d('0x89')](_0x4df490)){return _0x31c7ce['removeAgents'](_0x4df490,{'transaction':_0xa8e7f9});}})[_0x033d('0x2a')](function(){_0x4df490[_0x033d('0x71')](function(_0x1917b5){socket[_0x033d('0x8a')](_0x033d('0x8b'),{'UserId':_0x1917b5,'FaxQueueId':_0x31c7ce['id']});});});});});});})[_0x033d('0x2a')](respondWithStatusCode(_0xa02250,null))[_0x033d('0x49')](handleError(_0xa02250,null));};exports[_0x033d('0x8c')]=function(_0x39c8f1,_0x59854,_0x3eabe7){return db[_0x033d('0x34')][_0x033d('0x4e')]({'where':{'id':_0x39c8f1[_0x033d('0x4b')]['id']}})[_0x033d('0x2a')](handleEntityNotFound(_0x59854,null))[_0x033d('0x2a')](function(_0x49106e){if(_0x49106e){return _0x49106e[_0x033d('0x8c')](_0x39c8f1[_0x033d('0x50')][_0x033d('0x6a')],_[_0x033d('0x8d')](_0x39c8f1[_0x033d('0x50')],[_0x033d('0x6a'),'id'])||{})[_0x033d('0x8e')](function(_0x28e14d){for(var _0x4aacd6=0x0;_0x4aacd6<_0x39c8f1['body'][_0x033d('0x6a')][_0x033d('0x3d')];_0x4aacd6+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x39c8f1[_0x033d('0x50')][_0x033d('0x6a')][_0x4aacd6]),'FaxQueueId':Number(_0x39c8f1[_0x033d('0x4b')]['id'])});}return _0x28e14d;});}})['then'](respondWithResult(_0x59854,null))[_0x033d('0x49')](handleError(_0x59854,null));};exports[_0x033d('0x8f')]=function(_0x343c2a,_0x190f47,_0x160b6e){return db[_0x033d('0x34')][_0x033d('0x4e')]({'where':{'id':_0x343c2a['params']['id']}})[_0x033d('0x2a')](handleEntityNotFound(_0x190f47,null))[_0x033d('0x2a')](function(_0x1399b0){if(_0x1399b0){return _0x1399b0[_0x033d('0x8f')](_0x343c2a['query'][_0x033d('0x6a')])[_0x033d('0x2a')](function(){if(_['isArray'](_0x343c2a[_0x033d('0x37')][_0x033d('0x6a')])){for(var _0x387d46=0x0;_0x387d46<_0x343c2a[_0x033d('0x37')]['ids'][_0x033d('0x3d')];_0x387d46+=0x1){socket[_0x033d('0x8a')](_0x033d('0x8b'),{'UserId':Number(_0x343c2a[_0x033d('0x37')][_0x033d('0x6a')][_0x387d46]),'FaxQueueId':Number(_0x343c2a[_0x033d('0x4b')]['id'])});}}else{socket[_0x033d('0x8a')]('userFaxQueue:remove',{'UserId':Number(_0x343c2a['query'][_0x033d('0x6a')]),'FaxQueueId':Number(_0x343c2a[_0x033d('0x4b')]['id'])});}});}})[_0x033d('0x2a')](respondWithStatusCode(_0x190f47,null))[_0x033d('0x49')](handleError(_0x190f47,null));};exports['getAgents']=function(_0x1262f7,_0x2b7eec,_0xf99480){var _0x3f7193={};var _0x38d7a5={};var _0x1d4fc0;var _0x1a104a;return db[_0x033d('0x34')][_0x033d('0x59')]({'where':{'id':_0x1262f7['params']['id']}})[_0x033d('0x2a')](handleEntityNotFound(_0x2b7eec,null))[_0x033d('0x2a')](function(_0x4905b5){if(_0x4905b5){_0x1d4fc0=_0x4905b5;_0x38d7a5[_0x033d('0x36')]=_[_0x033d('0x38')](db[_0x033d('0x5f')][_0x033d('0x5b')]);_0x38d7a5['query']=_['keys'](_0x1262f7[_0x033d('0x37')]);_0x38d7a5['filters']=_[_0x033d('0x3a')](_0x38d7a5[_0x033d('0x36')],_0x38d7a5[_0x033d('0x37')]);_0x3f7193['attributes']=_[_0x033d('0x3a')](_0x38d7a5[_0x033d('0x36')],qs[_0x033d('0x3c')](_0x1262f7[_0x033d('0x37')]['fields']));_0x3f7193[_0x033d('0x3b')]=_0x3f7193[_0x033d('0x3b')][_0x033d('0x3d')]?_0x3f7193[_0x033d('0x3b')]:_0x38d7a5[_0x033d('0x36')];_0x3f7193[_0x033d('0x3f')]=qs[_0x033d('0x40')](_0x1262f7[_0x033d('0x37')]['sort']);_0x3f7193['where']=qs[_0x033d('0x39')](_[_0x033d('0x42')](_0x1262f7[_0x033d('0x37')],_0x38d7a5[_0x033d('0x39')]));if(_0x1262f7[_0x033d('0x37')][_0x033d('0x43')]){_0x3f7193[_0x033d('0x41')]=_[_0x033d('0x5e')](_0x3f7193[_0x033d('0x41')],{'$or':_['map'](_0x3f7193[_0x033d('0x3b')],function(_0x304da8){var _0x290d9a={};_0x290d9a[_0x304da8]={'$like':'%'+_0x1262f7[_0x033d('0x37')][_0x033d('0x43')]+'%'};return _0x290d9a;})});}_0x3f7193=_[_0x033d('0x5e')]({},_0x3f7193,_0x1262f7[_0x033d('0x46')]);return _0x1d4fc0['getAgents'](_0x3f7193);}})[_0x033d('0x2a')](function(_0x291fb9){if(_0x291fb9){_0x1a104a=_0x291fb9[_0x033d('0x3d')];if(!_0x1262f7[_0x033d('0x37')][_0x033d('0x3e')]('nolimit')){_0x3f7193[_0x033d('0x22')]=qs['limit'](_0x1262f7[_0x033d('0x37')][_0x033d('0x22')]);_0x3f7193[_0x033d('0x1f')]=qs['offset'](_0x1262f7['query']['offset']);}return _0x1d4fc0[_0x033d('0x90')](_0x3f7193);}})[_0x033d('0x2a')](function(_0x227e98){if(_0x227e98){return _0x227e98?{'count':_0x1a104a,'rows':_0x227e98}:null;}})['then'](respondWithResult(_0x2b7eec,null))[_0x033d('0x49')](handleError(_0x2b7eec,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a1d91a8..92cde8e 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 _0x0ca3=['events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x1c3961,_0x4f5d19){var _0x340ca2=function(_0x1caec3){while(--_0x1caec3){_0x1c3961['push'](_0x1c3961['shift']());}};_0x340ca2(++_0x4f5d19);}(_0x0ca3,0x168));var _0x30ca=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0x0ca3[_0x48e1ec];return _0x3b33eb;};'use strict';var EventEmitter=require(_0x30ca('0x0'));var FaxQueue=require(_0x30ca('0x1'))['db'][_0x30ca('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x30ca('0x3')](0x0);var events={'afterCreate':_0x30ca('0x4'),'afterUpdate':'update','afterDestroy':_0x30ca('0x5')};function emitEvent(_0x28eb9b){return function(_0x55c06a,_0x3e3ad9,_0x3ab599){FaxQueueEvents[_0x30ca('0x6')](_0x28eb9b+':'+_0x55c06a['id'],_0x55c06a);FaxQueueEvents['emit'](_0x28eb9b,_0x55c06a);_0x3ab599(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x30ca('0x7')](e,emitEvent(event));}}module[_0x30ca('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x12af=['setMaxListeners','save','emit','hasOwnProperty','exports','../../mysqldb','FaxQueue'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0x12af,0x12b));var _0xf12a=function(_0x3f4315,_0xd6ec89){_0x3f4315=_0x3f4315-0x0;var _0x5842e3=_0x12af[_0x3f4315];return _0x5842e3;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xf12a('0x0'))['db'][_0xf12a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf12a('0x2')](0x0);var events={'afterCreate':_0xf12a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x35a6fc){return function(_0x515a4a,_0x3652eb,_0x553f2a){FaxQueueEvents[_0xf12a('0x4')](_0x35a6fc+':'+_0x515a4a['id'],_0x515a4a);FaxQueueEvents[_0xf12a('0x4')](_0x35a6fc,_0x515a4a);_0x553f2a(null);};}for(var e in events){if(events[_0xf12a('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xf12a('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index dda62c9..297ce48 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 _0x10c5=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash'];(function(_0x4f814c,_0x3e2c4b){var _0x37bccf=function(_0x40f774){while(--_0x40f774){_0x4f814c['push'](_0x4f814c['shift']());}};_0x37bccf(++_0x3e2c4b);}(_0x10c5,0xfb));var _0x510c=function(_0x34b415,_0x2bbe6c){_0x34b415=_0x34b415-0x0;var _0x30b346=_0x10c5[_0x34b415];return _0x30b346;};'use strict';var _=require(_0x510c('0x0'));var util=require(_0x510c('0x1'));var logger=require(_0x510c('0x2'))('api');var moment=require(_0x510c('0x3'));var BPromise=require('bluebird');var rp=require(_0x510c('0x4'));var fs=require('fs');var path=require(_0x510c('0x5'));var rimraf=require(_0x510c('0x6'));var config=require(_0x510c('0x7'));var attributes=require(_0x510c('0x8'));module['exports']=function(_0x40015f,_0x4a2f92){return _0x40015f[_0x510c('0x9')](_0x510c('0xa'),attributes,{'tableName':_0x510c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf949=['util','../../config/logger','api','bluebird','path','rimraf','./faxQueue.attributes','define','fax_queues','lodash'];(function(_0x51e02b,_0x5dc4ef){var _0x2c41c2=function(_0x25254d){while(--_0x25254d){_0x51e02b['push'](_0x51e02b['shift']());}};_0x2c41c2(++_0x5dc4ef);}(_0xf949,0x12b));var _0x9f94=function(_0x49b704,_0x5df4d9){_0x49b704=_0x49b704-0x0;var _0x38484e=_0xf949[_0x49b704];return _0x38484e;};'use strict';var _=require(_0x9f94('0x0'));var util=require(_0x9f94('0x1'));var logger=require(_0x9f94('0x2'))(_0x9f94('0x3'));var moment=require('moment');var BPromise=require(_0x9f94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f94('0x5'));var rimraf=require(_0x9f94('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f94('0x7'));module['exports']=function(_0xcd99e9,_0x4d2194){return _0xcd99e9[_0x9f94('0x8')]('FaxQueue',attributes,{'tableName':_0x9f94('0x9'),'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 62a0595..5fa2136 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 _0x62a1=['http','redis','defaults','localhost','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3797bc,_0x4c4319){var _0x36454e=function(_0x2d80af){while(--_0x2d80af){_0x3797bc['push'](_0x3797bc['shift']());}};_0x36454e(++_0x4c4319);}(_0x62a1,0x1e1));var _0x162a=function(_0x474acd,_0x4b8247){_0x474acd=_0x474acd-0x0;var _0xaad65=_0x62a1[_0x474acd];return _0xaad65;};'use strict';var _=require(_0x162a('0x0'));var util=require(_0x162a('0x1'));var moment=require(_0x162a('0x2'));var BPromise=require('bluebird');var rs=require(_0x162a('0x3'));var fs=require('fs');var Redis=require(_0x162a('0x4'));var db=require(_0x162a('0x5'))['db'];var utils=require(_0x162a('0x6'));var logger=require('../../config/logger')(_0x162a('0x7'));var config=require(_0x162a('0x8'));var jayson=require(_0x162a('0x9'));var client=jayson[_0x162a('0xa')][_0x162a('0xb')]({'port':0x232a});config[_0x162a('0xc')]=_[_0x162a('0xd')](config[_0x162a('0xc')],{'host':_0x162a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x162a('0xc')]));require(_0x162a('0xf'))[_0x162a('0x10')](socket);function respondWithRpcPromise(_0x2d32ed,_0x2f62ff,_0x5b43a0){return new BPromise(function(_0x2c2869,_0x31b286){return client['request'](_0x2d32ed,_0x5b43a0)[_0x162a('0x11')](function(_0x1aeae9){logger[_0x162a('0x12')](_0x162a('0x13'),_0x2f62ff,_0x162a('0x14'));logger['debug'](_0x162a('0x15'),_0x2f62ff,_0x162a('0x14'),JSON[_0x162a('0x16')](_0x1aeae9));if(_0x1aeae9[_0x162a('0x17')]){if(_0x1aeae9[_0x162a('0x17')]['code']===0x1f4){logger[_0x162a('0x17')](_0x162a('0x13'),_0x2f62ff,_0x1aeae9['error'][_0x162a('0x18')]);return _0x31b286(_0x1aeae9['error'][_0x162a('0x18')]);}logger[_0x162a('0x17')](_0x162a('0x13'),_0x2f62ff,_0x1aeae9[_0x162a('0x17')][_0x162a('0x18')]);return _0x2c2869(_0x1aeae9[_0x162a('0x17')][_0x162a('0x18')]);}else{logger[_0x162a('0x12')](_0x162a('0x13'),_0x2f62ff,_0x162a('0x14'));_0x2c2869(_0x1aeae9[_0x162a('0x19')][_0x162a('0x18')]);}})[_0x162a('0x1a')](function(_0x4fd29a){logger['error'](_0x162a('0x13'),_0x2f62ff,_0x4fd29a);_0x31b286(_0x4fd29a);});});}exports[_0x162a('0x1b')]=function(_0x328175){var _0xeb18d9=this;return new Promise(function(_0x23b593,_0x1da146){return db[_0x162a('0x1c')][_0x162a('0x1d')]({'raw':_0x328175[_0x162a('0x1e')]?_0x328175[_0x162a('0x1e')][_0x162a('0x1f')]===undefined?!![]:![]:!![],'where':_0x328175[_0x162a('0x1e')]?_0x328175['options'][_0x162a('0x20')]||null:null,'attributes':_0x328175['options']?_0x328175['options'][_0x162a('0x21')]||null:null,'limit':_0x328175[_0x162a('0x1e')]?_0x328175['options'][_0x162a('0x22')]||null:null,'include':_0x328175['options']?_0x328175[_0x162a('0x1e')][_0x162a('0x23')]?_[_0x162a('0x24')](_0x328175[_0x162a('0x1e')][_0x162a('0x23')],function(_0x237b83){return{'model':db[_0x237b83[_0x162a('0x25')]],'as':_0x237b83['as'],'attributes':_0x237b83[_0x162a('0x21')],'include':_0x237b83[_0x162a('0x23')]?_[_0x162a('0x24')](_0x237b83[_0x162a('0x23')],function(_0x5c2357){return{'model':db[_0x5c2357[_0x162a('0x25')]],'as':_0x5c2357['as'],'attributes':_0x5c2357[_0x162a('0x21')],'include':_0x5c2357[_0x162a('0x23')]?_[_0x162a('0x24')](_0x5c2357['include'],function(_0x513564){return{'model':db[_0x513564[_0x162a('0x25')]],'as':_0x513564['as'],'attributes':_0x513564[_0x162a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x506643){logger[_0x162a('0x12')](_0x162a('0x1b'),_0x328175);logger[_0x162a('0x26')](_0x162a('0x1b'),_0x328175,JSON['stringify'](_0x506643));_0x23b593(_0x506643);})[_0x162a('0x1a')](function(_0x275072){logger[_0x162a('0x17')](_0x162a('0x1b'),_0x275072['message'],_0x328175);_0x1da146(_0xeb18d9[_0x162a('0x17')](0x1f4,_0x275072[_0x162a('0x18')]));});});};exports['ShowFaxQueue']=function(_0x5dd246){var _0x27f608=this;return new Promise(function(_0x39ce57,_0x9ab52a){return db[_0x162a('0x1c')][_0x162a('0x27')]({'raw':_0x5dd246[_0x162a('0x1e')]?_0x5dd246[_0x162a('0x1e')][_0x162a('0x1f')]===undefined?!![]:![]:!![],'where':_0x5dd246[_0x162a('0x1e')]?_0x5dd246[_0x162a('0x1e')][_0x162a('0x20')]||null:null,'attributes':_0x5dd246[_0x162a('0x1e')]?_0x5dd246[_0x162a('0x1e')][_0x162a('0x21')]||null:null,'include':_0x5dd246['options']?_0x5dd246[_0x162a('0x1e')][_0x162a('0x23')]?_['map'](_0x5dd246[_0x162a('0x1e')][_0x162a('0x23')],function(_0x1c5d2e){return{'model':db[_0x1c5d2e[_0x162a('0x25')]],'as':_0x1c5d2e['as'],'attributes':_0x1c5d2e['attributes'],'include':_0x1c5d2e[_0x162a('0x23')]?_['map'](_0x1c5d2e[_0x162a('0x23')],function(_0x53a3a3){return{'model':db[_0x53a3a3[_0x162a('0x25')]],'as':_0x53a3a3['as'],'attributes':_0x53a3a3[_0x162a('0x21')],'include':_0x53a3a3[_0x162a('0x23')]?_['map'](_0x53a3a3[_0x162a('0x23')],function(_0x5f2ea1){return{'model':db[_0x5f2ea1['model']],'as':_0x5f2ea1['as'],'attributes':_0x5f2ea1[_0x162a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x162a('0x11')](function(_0x3f74dd){logger[_0x162a('0x12')](_0x162a('0x28'),_0x5dd246);logger[_0x162a('0x26')]('ShowFaxQueue',_0x5dd246,JSON[_0x162a('0x16')](_0x3f74dd));_0x39ce57(_0x3f74dd);})[_0x162a('0x1a')](function(_0x62973c){logger['error'](_0x162a('0x28'),_0x62973c[_0x162a('0x18')],_0x5dd246);_0x9ab52a(_0x27f608['error'](0x1f4,_0x62973c[_0x162a('0x18')]));});});}; \ No newline at end of file +var _0x28de=['limit','include','model','attributes','map','debug','GetFaxQueue','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','FaxQueue','options','where'];(function(_0x339642,_0x57eb5b){var _0x2edf91=function(_0x12fb90){while(--_0x12fb90){_0x339642['push'](_0x339642['shift']());}};_0x2edf91(++_0x57eb5b);}(_0x28de,0x148));var _0xe28d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x28de[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe28d('0x0'));var util=require(_0xe28d('0x1'));var moment=require(_0xe28d('0x2'));var BPromise=require(_0xe28d('0x3'));var rs=require(_0xe28d('0x4'));var fs=require('fs');var Redis=require(_0xe28d('0x5'));var db=require(_0xe28d('0x6'))['db'];var utils=require(_0xe28d('0x7'));var logger=require(_0xe28d('0x8'))(_0xe28d('0x9'));var config=require(_0xe28d('0xa'));var jayson=require(_0xe28d('0xb'));var client=jayson[_0xe28d('0xc')][_0xe28d('0xd')]({'port':0x232a});config['redis']=_[_0xe28d('0xe')](config[_0xe28d('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe28d('0xf')]));require(_0xe28d('0x10'))[_0xe28d('0x11')](socket);function respondWithRpcPromise(_0x3bc53c,_0x3ce210,_0x21b1c6){return new BPromise(function(_0x431689,_0x4edadf){return client[_0xe28d('0x12')](_0x3bc53c,_0x21b1c6)[_0xe28d('0x13')](function(_0x21e7c5){logger['info'](_0xe28d('0x14'),_0x3ce210,'request\x20sent');logger['debug'](_0xe28d('0x15'),_0x3ce210,_0xe28d('0x16'),JSON[_0xe28d('0x17')](_0x21e7c5));if(_0x21e7c5[_0xe28d('0x18')]){if(_0x21e7c5[_0xe28d('0x18')][_0xe28d('0x19')]===0x1f4){logger['error'](_0xe28d('0x14'),_0x3ce210,_0x21e7c5[_0xe28d('0x18')]['message']);return _0x4edadf(_0x21e7c5[_0xe28d('0x18')][_0xe28d('0x1a')]);}logger['error'](_0xe28d('0x14'),_0x3ce210,_0x21e7c5[_0xe28d('0x18')][_0xe28d('0x1a')]);return _0x431689(_0x21e7c5[_0xe28d('0x18')][_0xe28d('0x1a')]);}else{logger[_0xe28d('0x1b')](_0xe28d('0x14'),_0x3ce210,'request\x20sent');_0x431689(_0x21e7c5['result'][_0xe28d('0x1a')]);}})[_0xe28d('0x1c')](function(_0x5cd2fa){logger[_0xe28d('0x18')](_0xe28d('0x14'),_0x3ce210,_0x5cd2fa);_0x4edadf(_0x5cd2fa);});});}exports['GetFaxQueue']=function(_0x59d986){var _0x2e882c=this;return new Promise(function(_0x21874b,_0x138dee){return db[_0xe28d('0x1d')]['findAll']({'raw':_0x59d986[_0xe28d('0x1e')]?_0x59d986['options']['raw']===undefined?!![]:![]:!![],'where':_0x59d986[_0xe28d('0x1e')]?_0x59d986[_0xe28d('0x1e')][_0xe28d('0x1f')]||null:null,'attributes':_0x59d986['options']?_0x59d986[_0xe28d('0x1e')]['attributes']||null:null,'limit':_0x59d986[_0xe28d('0x1e')]?_0x59d986['options'][_0xe28d('0x20')]||null:null,'include':_0x59d986[_0xe28d('0x1e')]?_0x59d986[_0xe28d('0x1e')][_0xe28d('0x21')]?_['map'](_0x59d986['options'][_0xe28d('0x21')],function(_0x3a2e8f){return{'model':db[_0x3a2e8f[_0xe28d('0x22')]],'as':_0x3a2e8f['as'],'attributes':_0x3a2e8f[_0xe28d('0x23')],'include':_0x3a2e8f['include']?_[_0xe28d('0x24')](_0x3a2e8f[_0xe28d('0x21')],function(_0x1a5cf6){return{'model':db[_0x1a5cf6[_0xe28d('0x22')]],'as':_0x1a5cf6['as'],'attributes':_0x1a5cf6[_0xe28d('0x23')],'include':_0x1a5cf6[_0xe28d('0x21')]?_[_0xe28d('0x24')](_0x1a5cf6[_0xe28d('0x21')],function(_0x2033be){return{'model':db[_0x2033be['model']],'as':_0x2033be['as'],'attributes':_0x2033be[_0xe28d('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe28d('0x13')](function(_0x527659){logger['info']('GetFaxQueue',_0x59d986);logger[_0xe28d('0x25')](_0xe28d('0x26'),_0x59d986,JSON[_0xe28d('0x17')](_0x527659));_0x21874b(_0x527659);})['catch'](function(_0x1de631){logger[_0xe28d('0x18')](_0xe28d('0x26'),_0x1de631[_0xe28d('0x1a')],_0x59d986);_0x138dee(_0x2e882c[_0xe28d('0x18')](0x1f4,_0x1de631[_0xe28d('0x1a')]));});});};exports[_0xe28d('0x27')]=function(_0x5e9866){var _0x3fa62e=this;return new Promise(function(_0x5d3474,_0x11c2ca){return db[_0xe28d('0x1d')]['find']({'raw':_0x5e9866['options']?_0x5e9866[_0xe28d('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5e9866[_0xe28d('0x1e')]?_0x5e9866[_0xe28d('0x1e')][_0xe28d('0x1f')]||null:null,'attributes':_0x5e9866[_0xe28d('0x1e')]?_0x5e9866['options']['attributes']||null:null,'include':_0x5e9866[_0xe28d('0x1e')]?_0x5e9866[_0xe28d('0x1e')][_0xe28d('0x21')]?_[_0xe28d('0x24')](_0x5e9866[_0xe28d('0x1e')][_0xe28d('0x21')],function(_0x40d5e9){return{'model':db[_0x40d5e9['model']],'as':_0x40d5e9['as'],'attributes':_0x40d5e9[_0xe28d('0x23')],'include':_0x40d5e9['include']?_['map'](_0x40d5e9['include'],function(_0x1f412c){return{'model':db[_0x1f412c[_0xe28d('0x22')]],'as':_0x1f412c['as'],'attributes':_0x1f412c[_0xe28d('0x23')],'include':_0x1f412c[_0xe28d('0x21')]?_[_0xe28d('0x24')](_0x1f412c[_0xe28d('0x21')],function(_0x5ba8b5){return{'model':db[_0x5ba8b5[_0xe28d('0x22')]],'as':_0x5ba8b5['as'],'attributes':_0x5ba8b5[_0xe28d('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd484c6){logger['info']('ShowFaxQueue',_0x5e9866);logger[_0xe28d('0x25')]('ShowFaxQueue',_0x5e9866,JSON['stringify'](_0xd484c6));_0x5d3474(_0xd484c6);})[_0xe28d('0x1c')](function(_0x4af76a){logger[_0xe28d('0x18')](_0xe28d('0x27'),_0x4af76a[_0xe28d('0x1a')],_0x5e9866);_0x11c2ca(_0x3fa62e['error'](0x1f4,_0x4af76a[_0xe28d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index bc76ee2..5c83967 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 _0x3bcf=['update','emit','removeListener','length','./faxQueue.events','save','remove'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x3bcf,0xdd));var _0xf3bc=function(_0x246079,_0x3aec24){_0x246079=_0x246079-0x0;var _0x579004=_0x3bcf[_0x246079];return _0x579004;};'use strict';var FaxQueueEvents=require(_0xf3bc('0x0'));var events=[_0xf3bc('0x1'),_0xf3bc('0x2'),_0xf3bc('0x3')];function createListener(_0x13021e,_0x3a7b98){return function(_0x47c1d5){_0x3a7b98[_0xf3bc('0x4')](_0x13021e,_0x47c1d5);};}function removeListener(_0x412e93,_0x31d88a){return function(){FaxQueueEvents[_0xf3bc('0x5')](_0x412e93,_0x31d88a);};}exports['register']=function(_0x403472){for(var _0x3456d0=0x0,_0x37bae7=events[_0xf3bc('0x6')];_0x3456d0<_0x37bae7;_0x3456d0++){var _0x137de6=events[_0x3456d0];var _0x26960c=createListener('faxQueue:'+_0x137de6,_0x403472);FaxQueueEvents['on'](_0x137de6,_0x26960c);}}; \ No newline at end of file +var _0xdb26=['faxQueue:','./faxQueue.events','remove','update','emit','removeListener','length'];(function(_0x13d9aa,_0x24b4dd){var _0x2a60ef=function(_0x2c1d7f){while(--_0x2c1d7f){_0x13d9aa['push'](_0x13d9aa['shift']());}};_0x2a60ef(++_0x24b4dd);}(_0xdb26,0xb7));var _0x6db2=function(_0x1b5256,_0x10179d){_0x1b5256=_0x1b5256-0x0;var _0x2ffa09=_0xdb26[_0x1b5256];return _0x2ffa09;};'use strict';var FaxQueueEvents=require(_0x6db2('0x0'));var events=['save',_0x6db2('0x1'),_0x6db2('0x2')];function createListener(_0xa24daf,_0xf2fdc7){return function(_0x4753eb){_0xf2fdc7[_0x6db2('0x3')](_0xa24daf,_0x4753eb);};}function removeListener(_0x41d1c5,_0x240f42){return function(){FaxQueueEvents[_0x6db2('0x4')](_0x41d1c5,_0x240f42);};}exports['register']=function(_0x57fcee){for(var _0x592245=0x0,_0x43dd97=events[_0x6db2('0x5')];_0x592245<_0x43dd97;_0x592245++){var _0x450831=events[_0x592245];var _0x9ebfcf=createListener(_0x6db2('0x6')+_0x450831,_0x57fcee);FaxQueueEvents['on'](_0x450831,_0x9ebfcf);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c6c1641..af14ff2 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 _0x6a55=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x6a55,0xdb));var _0x56a5=function(_0x330141,_0x1dd290){_0x330141=_0x330141-0x0;var _0x1b68a2=_0x6a55[_0x330141];return _0x1b68a2;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./faxQueue.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0x4')](_0x56a5('0xa'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x4')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller['getTeams']);router['get'](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);router[_0x56a5('0xf')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x10')]);router['post']('/:id/teams',auth[_0x56a5('0x5')](),controller[_0x56a5('0x11')]);router[_0x56a5('0xf')](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x12')]);router[_0x56a5('0x13')]('/:id',auth[_0x56a5('0x5')](),controller['update']);router[_0x56a5('0x14')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x15')]);router[_0x56a5('0x14')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x16')]);router[_0x56a5('0x14')]('/:id/users',auth[_0x56a5('0x5')](),controller[_0x56a5('0x17')]);module[_0x56a5('0x18')]=router; \ No newline at end of file +var _0x53ec=['getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users'];(function(_0xa61b6a,_0x2642f6){var _0x40ac2d=function(_0xb24f7){while(--_0xb24f7){_0xa61b6a['push'](_0xa61b6a['shift']());}};_0x40ac2d(++_0x2642f6);}(_0x53ec,0x192));var _0xc53e=function(_0x1274dd,_0x21624b){_0x1274dd=_0x1274dd-0x0;var _0xc6919=_0x53ec[_0x1274dd];return _0xc6919;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/teams',auth[_0xc53e('0x9')](),controller['getTeams']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc53e('0x13')](_0xc53e('0x14'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x15')]);router[_0xc53e('0x13')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x16')]);router[_0xc53e('0x17')](_0xc53e('0xd'),auth['isAuthenticated'](),controller[_0xc53e('0x18')]);router[_0xc53e('0x19')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1a')]);router[_0xc53e('0x19')](_0xc53e('0x14'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router['delete']('/:id/users',auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);module[_0xc53e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index ae249bf..92a2949 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 _0x5f1e=['STRING','sequelize','exports','DATE'];(function(_0x23f359,_0x1d9936){var _0xe0f972=function(_0x5df452){while(--_0x5df452){_0x23f359['push'](_0x23f359['shift']());}};_0xe0f972(++_0x1d9936);}(_0x5f1e,0x71));var _0xe5f1=function(_0x37e1aa,_0xc282a){_0x37e1aa=_0x37e1aa-0x0;var _0x4b1d81=_0x5f1e[_0x37e1aa];return _0x4b1d81;};'use strict';var moment=require('moment');var Sequelize=require(_0xe5f1('0x0'));module[_0xe5f1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe5f1('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe5f1('0x2')]},'exitAt':{'type':Sequelize[_0xe5f1('0x2')]},'reason':{'type':Sequelize[_0xe5f1('0x3')]}}; \ No newline at end of file +var _0xc997=['moment','sequelize','exports','STRING','DATE'];(function(_0x2418e0,_0x7215b0){var _0x55ffbf=function(_0x4fc0ec){while(--_0x4fc0ec){_0x2418e0['push'](_0x2418e0['shift']());}};_0x55ffbf(++_0x7215b0);}(_0xc997,0x131));var _0x7c99=function(_0x2f9c03,_0x1b8555){_0x2f9c03=_0x2f9c03-0x0;var _0x35fdf5=_0xc997[_0x2f9c03];return _0x35fdf5;};'use strict';var moment=require(_0x7c99('0x0'));var Sequelize=require(_0x7c99('0x1'));module[_0x7c99('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7c99('0x3')]},'joinAt':{'type':Sequelize[_0x7c99('0x4')]},'leaveAt':{'type':Sequelize[_0x7c99('0x4')]},'acceptAt':{'type':Sequelize[_0x7c99('0x4')]},'exitAt':{'type':Sequelize[_0x7c99('0x4')]},'reason':{'type':Sequelize[_0x7c99('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 30e0457..a58e5b2 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 _0xb821=['filter','where','merge','VIRTUAL','options','include','findAll','show','keys','includeAll','find','catch','body','update','describe','rimraf','zip-dir','moment','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/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb821,0xa7));var _0x1b82=function(_0x45b4ab,_0x35e608){_0x45b4ab=_0x45b4ab-0x0;var _0x57c9a7=_0xb821[_0x45b4ab];return _0x57c9a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];function respondWithStatusCode(_0x241d11,_0x2391f5){_0x2391f5=_0x2391f5||0xcc;return function(_0x61b6eb){if(_0x61b6eb){return _0x241d11['sendStatus'](_0x2391f5);}return _0x241d11[_0x1b82('0x18')](_0x2391f5)['end']();};}function respondWithResult(_0x54915f,_0x1e553a){_0x1e553a=_0x1e553a||0xc8;return function(_0x4bf75b){if(_0x4bf75b){return _0x54915f[_0x1b82('0x18')](_0x1e553a)[_0x1b82('0x19')](_0x4bf75b);}};}function respondWithFilteredResult(_0x5d4cf1,_0x46c2cf){return function(_0x5dab7d){if(_0x5dab7d){var _0x563261=typeof _0x46c2cf[_0x1b82('0x1a')]==='undefined'&&typeof _0x46c2cf[_0x1b82('0x1b')]===_0x1b82('0x1c');var _0xf42818=_0x5dab7d['count'];var _0x514082=_0x563261?0x0:_0x46c2cf[_0x1b82('0x1a')];var _0x5d66c3=_0x563261?_0x5dab7d[_0x1b82('0x1d')]:_0x46c2cf[_0x1b82('0x1a')]+_0x46c2cf[_0x1b82('0x1b')];var _0x594a63;if(_0x5d66c3>=_0xf42818){_0x5d66c3=_0xf42818;_0x594a63=0xc8;}else{_0x594a63=0xce;}_0x5d4cf1[_0x1b82('0x18')](_0x594a63);return _0x5d4cf1[_0x1b82('0x1e')](_0x1b82('0x1f'),_0x514082+'-'+_0x5d66c3+'/'+_0xf42818)[_0x1b82('0x19')](_0x5dab7d);}return null;};}function patchUpdates(_0x10d45c){return function(_0x47e99b){try{jsonpatch[_0x1b82('0x20')](_0x47e99b,_0x10d45c,!![]);}catch(_0x1892b0){return BPromise[_0x1b82('0x21')](_0x1892b0);}return _0x47e99b[_0x1b82('0x22')]();};}function saveUpdates(_0x26e481,_0x31fd64){return function(_0x2d07f4){if(_0x2d07f4){return _0x2d07f4['update'](_0x26e481)[_0x1b82('0x23')](function(_0x233740){return _0x233740;});}return null;};}function removeEntity(_0x5b8d09,_0x561d78){return function(_0x225b81){if(_0x225b81){return _0x225b81[_0x1b82('0x24')]()['then'](function(){_0x5b8d09[_0x1b82('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd458,_0x5f556b){return function(_0xf2e556){if(!_0xf2e556){_0x5cd458[_0x1b82('0x25')](0x194);}return _0xf2e556;};}function handleError(_0xfd00d1,_0x257b79){_0x257b79=_0x257b79||0x1f4;return function(_0x548a3b){logger[_0x1b82('0x26')](_0x548a3b[_0x1b82('0x27')]);if(_0x548a3b[_0x1b82('0x28')]){delete _0x548a3b[_0x1b82('0x28')];}_0xfd00d1[_0x1b82('0x18')](_0x257b79)[_0x1b82('0x29')](_0x548a3b);};}exports[_0x1b82('0x2a')]=function(_0x21ea34,_0x39641a){var _0x1f9c6b={},_0x2fe45d={},_0x37275f={'count':0x0,'rows':[]};var _0x466441=_['map'](db[_0x1b82('0x2b')][_0x1b82('0x2c')],function(_0x155a34){return{'name':_0x155a34[_0x1b82('0x2d')],'type':_0x155a34[_0x1b82('0x2e')][_0x1b82('0x2f')]};});_0x2fe45d[_0x1b82('0x30')]=_[_0x1b82('0x31')](_0x466441,_0x1b82('0x28'));_0x2fe45d[_0x1b82('0x32')]=_['keys'](_0x21ea34[_0x1b82('0x32')]);_0x2fe45d[_0x1b82('0x33')]=_[_0x1b82('0x34')](_0x2fe45d[_0x1b82('0x30')],_0x2fe45d['query']);_0x1f9c6b[_0x1b82('0x35')]=_[_0x1b82('0x34')](_0x2fe45d['model'],qs[_0x1b82('0x36')](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x36')]));_0x1f9c6b['attributes']=_0x1f9c6b['attributes'][_0x1b82('0x37')]?_0x1f9c6b['attributes']:_0x2fe45d['model'];if(!_0x21ea34[_0x1b82('0x32')][_0x1b82('0x38')](_0x1b82('0x39'))){_0x1f9c6b['limit']=qs[_0x1b82('0x1b')](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x1b')]);_0x1f9c6b[_0x1b82('0x1a')]=qs['offset'](_0x21ea34[_0x1b82('0x32')][_0x1b82('0x1a')]);}_0x1f9c6b[_0x1b82('0x3a')]=qs['sort'](_0x21ea34['query'][_0x1b82('0x3b')]);_0x1f9c6b['where']=qs[_0x1b82('0x33')](_[_0x1b82('0x3c')](_0x21ea34[_0x1b82('0x32')],_0x2fe45d[_0x1b82('0x33')]),_0x466441);if(_0x21ea34[_0x1b82('0x32')][_0x1b82('0x3d')]){_0x1f9c6b[_0x1b82('0x3e')]=_[_0x1b82('0x3f')](_0x1f9c6b['where'],{'$or':_['map'](_0x466441,function(_0x18b624){if(_0x18b624['type']!==_0x1b82('0x40')){var _0x592449={};_0x592449[_0x18b624[_0x1b82('0x28')]]={'$like':'%'+_0x21ea34[_0x1b82('0x32')][_0x1b82('0x3d')]+'%'};return _0x592449;}})});}_0x1f9c6b=_[_0x1b82('0x3f')]({},_0x1f9c6b,_0x21ea34[_0x1b82('0x41')]);var _0x202bb4={'where':_0x1f9c6b['where']};return db[_0x1b82('0x2b')]['count'](_0x202bb4)[_0x1b82('0x23')](function(_0x4e5659){_0x37275f[_0x1b82('0x1d')]=_0x4e5659;if(_0x21ea34['query']['includeAll']){_0x1f9c6b[_0x1b82('0x42')]=[{'all':!![]}];}return db[_0x1b82('0x2b')][_0x1b82('0x43')](_0x1f9c6b);})[_0x1b82('0x23')](function(_0x3eb429){_0x37275f['rows']=_0x3eb429;return _0x37275f;})[_0x1b82('0x23')](respondWithFilteredResult(_0x39641a,_0x1f9c6b))['catch'](handleError(_0x39641a,null));};exports[_0x1b82('0x44')]=function(_0x2fcf04,_0x17e47f){var _0x3adf9c={'raw':!![],'where':{'id':_0x2fcf04['params']['id']}},_0x365ab4={};_0x365ab4[_0x1b82('0x30')]=_['keys'](db[_0x1b82('0x2b')][_0x1b82('0x2c')]);_0x365ab4['query']=_[_0x1b82('0x45')](_0x2fcf04[_0x1b82('0x32')]);_0x365ab4[_0x1b82('0x33')]=_[_0x1b82('0x34')](_0x365ab4[_0x1b82('0x30')],_0x365ab4[_0x1b82('0x32')]);_0x3adf9c[_0x1b82('0x35')]=_['intersection'](_0x365ab4[_0x1b82('0x30')],qs['fields'](_0x2fcf04[_0x1b82('0x32')][_0x1b82('0x36')]));_0x3adf9c[_0x1b82('0x35')]=_0x3adf9c[_0x1b82('0x35')][_0x1b82('0x37')]?_0x3adf9c[_0x1b82('0x35')]:_0x365ab4[_0x1b82('0x30')];if(_0x2fcf04[_0x1b82('0x32')][_0x1b82('0x46')]){_0x3adf9c[_0x1b82('0x42')]=[{'all':!![]}];}_0x3adf9c=_[_0x1b82('0x3f')]({},_0x3adf9c,_0x2fcf04[_0x1b82('0x41')]);return db[_0x1b82('0x2b')][_0x1b82('0x47')](_0x3adf9c)['then'](handleEntityNotFound(_0x17e47f,null))['then'](respondWithResult(_0x17e47f,null))[_0x1b82('0x48')](handleError(_0x17e47f,null));};exports['create']=function(_0x12d9ac,_0x3df0af){return db[_0x1b82('0x2b')]['create'](_0x12d9ac[_0x1b82('0x49')],{})['then'](respondWithResult(_0x3df0af,0xc9))['catch'](handleError(_0x3df0af,null));};exports[_0x1b82('0x4a')]=function(_0x2aadf7,_0x242324){if(_0x2aadf7['body']['id']){delete _0x2aadf7[_0x1b82('0x49')]['id'];}return db[_0x1b82('0x2b')]['find']({'where':{'id':_0x2aadf7['params']['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x242324,null))[_0x1b82('0x23')](saveUpdates(_0x2aadf7[_0x1b82('0x49')],null))['then'](respondWithResult(_0x242324,null))[_0x1b82('0x48')](handleError(_0x242324,null));};exports[_0x1b82('0x24')]=function(_0x31fb5d,_0x29f9ae){return db[_0x1b82('0x2b')][_0x1b82('0x47')]({'where':{'id':_0x31fb5d['params']['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x29f9ae,null))['then'](removeEntity(_0x29f9ae,null))[_0x1b82('0x48')](handleError(_0x29f9ae,null));};exports[_0x1b82('0x4b')]=function(_0x5d9708,_0x44ce1c){return db['FaxQueueReport'][_0x1b82('0x4b')]()[_0x1b82('0x23')](respondWithResult(_0x44ce1c,null))[_0x1b82('0x48')](handleError(_0x44ce1c,null));}; \ No newline at end of file +var _0xb26e=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','request-promise','moment'];(function(_0x4929ae,_0x19802b){var _0x1daece=function(_0x4f69fc){while(--_0x4f69fc){_0x4929ae['push'](_0x4929ae['shift']());}};_0x1daece(++_0x19802b);}(_0xb26e,0x11d));var _0xeb26=function(_0x5b95af,_0x1b27a5){_0x5b95af=_0x5b95af-0x0;var _0x57da28=_0xb26e[_0x5b95af];return _0x57da28;};'use strict';var emlformat=require(_0xeb26('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb26('0x1'));var moment=require(_0xeb26('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xeb26('0x3'));var util=require(_0xeb26('0x4'));var path=require(_0xeb26('0x5'));var sox=require(_0xeb26('0x6'));var csv=require(_0xeb26('0x7'));var ejs=require(_0xeb26('0x8'));var fs=require('fs');var fs_extra=require(_0xeb26('0x9'));var _=require(_0xeb26('0xa'));var squel=require(_0xeb26('0xb'));var crypto=require(_0xeb26('0xc'));var jsforce=require(_0xeb26('0xd'));var deskjs=require(_0xeb26('0xe'));var toCsv=require(_0xeb26('0x7'));var querystring=require('querystring');var Papa=require(_0xeb26('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeb26('0x10'));var as=require(_0xeb26('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb26('0x12'))('api');var utils=require(_0xeb26('0x13'));var config=require(_0xeb26('0x14'));var licenseUtil=require(_0xeb26('0x15'));var db=require(_0xeb26('0x16'))['db'];function respondWithStatusCode(_0x4540da,_0x3053a5){_0x3053a5=_0x3053a5||0xcc;return function(_0x36060a){if(_0x36060a){return _0x4540da['sendStatus'](_0x3053a5);}return _0x4540da[_0xeb26('0x17')](_0x3053a5)[_0xeb26('0x18')]();};}function respondWithResult(_0x4c7112,_0x3d8643){_0x3d8643=_0x3d8643||0xc8;return function(_0x17bebd){if(_0x17bebd){return _0x4c7112[_0xeb26('0x17')](_0x3d8643)[_0xeb26('0x19')](_0x17bebd);}};}function respondWithFilteredResult(_0x54740f,_0x17e9d2){return function(_0x1a07ac){if(_0x1a07ac){var _0x76e697=typeof _0x17e9d2[_0xeb26('0x1a')]===_0xeb26('0x1b')&&typeof _0x17e9d2[_0xeb26('0x1c')]===_0xeb26('0x1b');var _0x3435e8=_0x1a07ac['count'];var _0x31052d=_0x76e697?0x0:_0x17e9d2['offset'];var _0x1e7c03=_0x76e697?_0x1a07ac[_0xeb26('0x1d')]:_0x17e9d2[_0xeb26('0x1a')]+_0x17e9d2['limit'];var _0x1e83b4;if(_0x1e7c03>=_0x3435e8){_0x1e7c03=_0x3435e8;_0x1e83b4=0xc8;}else{_0x1e83b4=0xce;}_0x54740f[_0xeb26('0x17')](_0x1e83b4);return _0x54740f[_0xeb26('0x1e')]('Content-Range',_0x31052d+'-'+_0x1e7c03+'/'+_0x3435e8)[_0xeb26('0x19')](_0x1a07ac);}return null;};}function patchUpdates(_0x413108){return function(_0x32dad3){try{jsonpatch[_0xeb26('0x1f')](_0x32dad3,_0x413108,!![]);}catch(_0x143cc8){return BPromise[_0xeb26('0x20')](_0x143cc8);}return _0x32dad3[_0xeb26('0x21')]();};}function saveUpdates(_0x20392f,_0x2dc7ee){return function(_0x426e5a){if(_0x426e5a){return _0x426e5a[_0xeb26('0x22')](_0x20392f)[_0xeb26('0x23')](function(_0x2219ee){return _0x2219ee;});}return null;};}function removeEntity(_0x40bce7,_0xde4668){return function(_0xcf9673){if(_0xcf9673){return _0xcf9673['destroy']()[_0xeb26('0x23')](function(){_0x40bce7[_0xeb26('0x17')](0xcc)[_0xeb26('0x18')]();});}};}function handleEntityNotFound(_0x3e17ca,_0x72ac9d){return function(_0x2a6b49){if(!_0x2a6b49){_0x3e17ca['sendStatus'](0x194);}return _0x2a6b49;};}function handleError(_0x2e07cf,_0x4478b8){_0x4478b8=_0x4478b8||0x1f4;return function(_0x1e084b){logger[_0xeb26('0x24')](_0x1e084b[_0xeb26('0x25')]);if(_0x1e084b[_0xeb26('0x26')]){delete _0x1e084b[_0xeb26('0x26')];}_0x2e07cf['status'](_0x4478b8)[_0xeb26('0x27')](_0x1e084b);};}exports['index']=function(_0x15ca74,_0x1a107b){var _0x84d448={},_0x3d80c7={},_0x4c50b3={'count':0x0,'rows':[]};var _0x16005a=_[_0xeb26('0x28')](db[_0xeb26('0x29')][_0xeb26('0x2a')],function(_0x24c908){return{'name':_0x24c908[_0xeb26('0x2b')],'type':_0x24c908[_0xeb26('0x2c')][_0xeb26('0x2d')]};});_0x3d80c7[_0xeb26('0x2e')]=_[_0xeb26('0x28')](_0x16005a,_0xeb26('0x26'));_0x3d80c7[_0xeb26('0x2f')]=_[_0xeb26('0x30')](_0x15ca74[_0xeb26('0x2f')]);_0x3d80c7['filters']=_[_0xeb26('0x31')](_0x3d80c7[_0xeb26('0x2e')],_0x3d80c7[_0xeb26('0x2f')]);_0x84d448[_0xeb26('0x32')]=_[_0xeb26('0x31')](_0x3d80c7[_0xeb26('0x2e')],qs[_0xeb26('0x33')](_0x15ca74[_0xeb26('0x2f')]['fields']));_0x84d448[_0xeb26('0x32')]=_0x84d448['attributes'][_0xeb26('0x34')]?_0x84d448[_0xeb26('0x32')]:_0x3d80c7[_0xeb26('0x2e')];if(!_0x15ca74['query']['hasOwnProperty'](_0xeb26('0x35'))){_0x84d448['limit']=qs[_0xeb26('0x1c')](_0x15ca74['query']['limit']);_0x84d448['offset']=qs[_0xeb26('0x1a')](_0x15ca74[_0xeb26('0x2f')][_0xeb26('0x1a')]);}_0x84d448[_0xeb26('0x36')]=qs[_0xeb26('0x37')](_0x15ca74[_0xeb26('0x2f')]['sort']);_0x84d448[_0xeb26('0x38')]=qs[_0xeb26('0x39')](_['pick'](_0x15ca74[_0xeb26('0x2f')],_0x3d80c7['filters']),_0x16005a);if(_0x15ca74[_0xeb26('0x2f')]['filter']){_0x84d448[_0xeb26('0x38')]=_[_0xeb26('0x3a')](_0x84d448[_0xeb26('0x38')],{'$or':_[_0xeb26('0x28')](_0x16005a,function(_0x46af13){if(_0x46af13[_0xeb26('0x2c')]!==_0xeb26('0x3b')){var _0x44aeca={};_0x44aeca[_0x46af13[_0xeb26('0x26')]]={'$like':'%'+_0x15ca74[_0xeb26('0x2f')][_0xeb26('0x3c')]+'%'};return _0x44aeca;}})});}_0x84d448=_[_0xeb26('0x3a')]({},_0x84d448,_0x15ca74[_0xeb26('0x3d')]);var _0x5edcf2={'where':_0x84d448[_0xeb26('0x38')]};return db[_0xeb26('0x29')]['count'](_0x5edcf2)[_0xeb26('0x23')](function(_0xa46d3d){_0x4c50b3[_0xeb26('0x1d')]=_0xa46d3d;if(_0x15ca74[_0xeb26('0x2f')]['includeAll']){_0x84d448['include']=[{'all':!![]}];}return db[_0xeb26('0x29')][_0xeb26('0x3e')](_0x84d448);})[_0xeb26('0x23')](function(_0x8017fb){_0x4c50b3['rows']=_0x8017fb;return _0x4c50b3;})[_0xeb26('0x23')](respondWithFilteredResult(_0x1a107b,_0x84d448))[_0xeb26('0x3f')](handleError(_0x1a107b,null));};exports[_0xeb26('0x40')]=function(_0xb41841,_0x3014d1){var _0x3dba8f={'raw':!![],'where':{'id':_0xb41841[_0xeb26('0x41')]['id']}},_0xbd1bd={};_0xbd1bd[_0xeb26('0x2e')]=_[_0xeb26('0x30')](db['FaxQueueReport']['rawAttributes']);_0xbd1bd['query']=_[_0xeb26('0x30')](_0xb41841[_0xeb26('0x2f')]);_0xbd1bd['filters']=_['intersection'](_0xbd1bd[_0xeb26('0x2e')],_0xbd1bd[_0xeb26('0x2f')]);_0x3dba8f[_0xeb26('0x32')]=_['intersection'](_0xbd1bd[_0xeb26('0x2e')],qs['fields'](_0xb41841['query'][_0xeb26('0x33')]));_0x3dba8f[_0xeb26('0x32')]=_0x3dba8f[_0xeb26('0x32')][_0xeb26('0x34')]?_0x3dba8f[_0xeb26('0x32')]:_0xbd1bd['model'];if(_0xb41841[_0xeb26('0x2f')][_0xeb26('0x42')]){_0x3dba8f['include']=[{'all':!![]}];}_0x3dba8f=_['merge']({},_0x3dba8f,_0xb41841[_0xeb26('0x3d')]);return db[_0xeb26('0x29')][_0xeb26('0x43')](_0x3dba8f)[_0xeb26('0x23')](handleEntityNotFound(_0x3014d1,null))[_0xeb26('0x23')](respondWithResult(_0x3014d1,null))[_0xeb26('0x3f')](handleError(_0x3014d1,null));};exports[_0xeb26('0x44')]=function(_0x222ae4,_0xaee67a){return db[_0xeb26('0x29')][_0xeb26('0x44')](_0x222ae4[_0xeb26('0x45')],{})[_0xeb26('0x23')](respondWithResult(_0xaee67a,0xc9))[_0xeb26('0x3f')](handleError(_0xaee67a,null));};exports[_0xeb26('0x22')]=function(_0x189f51,_0x2d039b){if(_0x189f51[_0xeb26('0x45')]['id']){delete _0x189f51[_0xeb26('0x45')]['id'];}return db['FaxQueueReport'][_0xeb26('0x43')]({'where':{'id':_0x189f51[_0xeb26('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d039b,null))[_0xeb26('0x23')](saveUpdates(_0x189f51[_0xeb26('0x45')],null))[_0xeb26('0x23')](respondWithResult(_0x2d039b,null))[_0xeb26('0x3f')](handleError(_0x2d039b,null));};exports[_0xeb26('0x46')]=function(_0x327cd6,_0x3ea819){return db[_0xeb26('0x29')][_0xeb26('0x43')]({'where':{'id':_0x327cd6['params']['id']}})[_0xeb26('0x23')](handleEntityNotFound(_0x3ea819,null))[_0xeb26('0x23')](removeEntity(_0x3ea819,null))[_0xeb26('0x3f')](handleError(_0x3ea819,null));};exports[_0xeb26('0x47')]=function(_0xbb4099,_0x21dc2d){return db[_0xeb26('0x29')]['describe']()[_0xeb26('0x23')](respondWithResult(_0x21dc2d,null))['catch'](handleError(_0x21dc2d,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 3410dde..e5853f4 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x29ea4b,_0x117512){var _0x3f47a4=function(_0x22a1bf){while(--_0x22a1bf){_0x29ea4b['push'](_0x29ea4b['shift']());}};_0x3f47a4(++_0x117512);}(_0x7a54,0x106));var _0x47a5=function(_0x2b260d,_0x51c027){_0x2b260d=_0x2b260d-0x0;var _0xe96806=_0x7a54[_0x2b260d];return _0xe96806;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x814b,0x1a2));var _0xb814=function(_0x466410,_0x4069d9){_0x466410=_0x466410-0x0;var _0x3d758e=_0x814b[_0x466410];return _0x3d758e;};'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_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index a39f4cc..4616c2b 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 _0xaceb=['jayson/promise','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','update','where','attributes','limit','UpdateFaxQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xaceb,0xca));var _0xbace=function(_0x22e07a,_0x310a85){_0x22e07a=_0x22e07a-0x0;var _0xe2960f=_0xaceb[_0x22e07a];return _0xe2960f;};'use strict';var _=require(_0xbace('0x0'));var util=require('util');var moment=require(_0xbace('0x1'));var BPromise=require('bluebird');var rs=require(_0xbace('0x2'));var fs=require('fs');var Redis=require(_0xbace('0x3'));var db=require(_0xbace('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbace('0x5'))(_0xbace('0x6'));var config=require(_0xbace('0x7'));var jayson=require(_0xbace('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xedc6f4,_0x247182,_0x167356){return new BPromise(function(_0x136177,_0x596a29){return client['request'](_0xedc6f4,_0x167356)[_0xbace('0x9')](function(_0x51aaa1){logger[_0xbace('0xa')](_0xbace('0xb'),_0x247182,'request\x20sent');logger[_0xbace('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x247182,_0xbace('0xd'),JSON[_0xbace('0xe')](_0x51aaa1));if(_0x51aaa1[_0xbace('0xf')]){if(_0x51aaa1[_0xbace('0xf')][_0xbace('0x10')]===0x1f4){logger[_0xbace('0xf')](_0xbace('0xb'),_0x247182,_0x51aaa1['error'][_0xbace('0x11')]);return _0x596a29(_0x51aaa1[_0xbace('0xf')][_0xbace('0x11')]);}logger[_0xbace('0xf')](_0xbace('0xb'),_0x247182,_0x51aaa1['error'][_0xbace('0x11')]);return _0x136177(_0x51aaa1[_0xbace('0xf')][_0xbace('0x11')]);}else{logger[_0xbace('0xa')](_0xbace('0xb'),_0x247182,'request\x20sent');_0x136177(_0x51aaa1[_0xbace('0x12')]['message']);}})[_0xbace('0x13')](function(_0x1bdb8d){logger[_0xbace('0xf')](_0xbace('0xb'),_0x247182,_0x1bdb8d);_0x596a29(_0x1bdb8d);});});}exports[_0xbace('0x14')]=function(_0x48d244){var _0x420b68=this;return new Promise(function(_0x57db4e,_0x4f6fff){return db[_0xbace('0x15')]['create'](_0x48d244[_0xbace('0x16')],{'raw':_0x48d244[_0xbace('0x17')]?_0x48d244[_0xbace('0x17')][_0xbace('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x42e3a0){logger[_0xbace('0xa')](_0xbace('0x14'),_0x48d244);logger[_0xbace('0xc')](_0xbace('0x14'),_0x48d244,JSON[_0xbace('0xe')](_0x42e3a0));_0x57db4e(_0x42e3a0);})[_0xbace('0x13')](function(_0x3e61ea){logger[_0xbace('0xf')](_0xbace('0x14'),_0x3e61ea[_0xbace('0x11')],_0x48d244);_0x4f6fff(_0x420b68['error'](0x1f4,_0x3e61ea[_0xbace('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x375359){var _0x52faa9=this;return new Promise(function(_0x28b113,_0x254a1a){return db[_0xbace('0x15')][_0xbace('0x19')](_0x375359['body'],{'raw':_0x375359[_0xbace('0x17')]?_0x375359[_0xbace('0x17')][_0xbace('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x375359[_0xbace('0x17')]?_0x375359['options'][_0xbace('0x1a')]||null:null,'attributes':_0x375359[_0xbace('0x17')]?_0x375359['options'][_0xbace('0x1b')]||null:null,'limit':_0x375359[_0xbace('0x17')]?_0x375359[_0xbace('0x17')][_0xbace('0x1c')]||null:null})['then'](function(_0x275078){logger[_0xbace('0xa')](_0xbace('0x1d'),_0x375359);logger[_0xbace('0xc')](_0xbace('0x1d'),_0x375359,JSON[_0xbace('0xe')](_0x275078));_0x28b113(_0x275078);})[_0xbace('0x13')](function(_0x3e94e4){logger[_0xbace('0xf')](_0xbace('0x1d'),_0x3e94e4[_0xbace('0x11')],_0x375359);_0x254a1a(_0x52faa9[_0xbace('0xf')](0x1f4,_0x3e94e4['message']));});});}; \ No newline at end of file +var _0x08fe=['CreateFaxQueueReport','FaxQueueReport','create','options','raw','then','body','where','attributes','limit','UpdateFaxQueueReport','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3f4a1a,_0x2c4b1d){var _0x141b94=function(_0x3fc2e1){while(--_0x3fc2e1){_0x3f4a1a['push'](_0x3f4a1a['shift']());}};_0x141b94(++_0x2c4b1d);}(_0x08fe,0x1ab));var _0xe08f=function(_0xf3b525,_0x419b48){_0xf3b525=_0xf3b525-0x0;var _0x1f98b3=_0x08fe[_0xf3b525];return _0x1f98b3;};'use strict';var _=require('lodash');var util=require(_0xe08f('0x0'));var moment=require(_0xe08f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe08f('0x2'));var db=require(_0xe08f('0x3'))['db'];var utils=require(_0xe08f('0x4'));var logger=require(_0xe08f('0x5'))(_0xe08f('0x6'));var config=require('../../config/environment');var jayson=require(_0xe08f('0x7'));var client=jayson[_0xe08f('0x8')][_0xe08f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x501fc1,_0x4cf322,_0x1677e0){return new BPromise(function(_0x457dc3,_0x45f2b6){return client[_0xe08f('0xa')](_0x501fc1,_0x1677e0)['then'](function(_0x11f7c8){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4cf322,_0xe08f('0xb'));logger[_0xe08f('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4cf322,_0xe08f('0xb'),JSON[_0xe08f('0xd')](_0x11f7c8));if(_0x11f7c8[_0xe08f('0xe')]){if(_0x11f7c8[_0xe08f('0xe')][_0xe08f('0xf')]===0x1f4){logger[_0xe08f('0xe')](_0xe08f('0x10'),_0x4cf322,_0x11f7c8[_0xe08f('0xe')]['message']);return _0x45f2b6(_0x11f7c8[_0xe08f('0xe')][_0xe08f('0x11')]);}logger[_0xe08f('0xe')](_0xe08f('0x10'),_0x4cf322,_0x11f7c8[_0xe08f('0xe')]['message']);return _0x457dc3(_0x11f7c8['error']['message']);}else{logger[_0xe08f('0x12')](_0xe08f('0x10'),_0x4cf322,_0xe08f('0xb'));_0x457dc3(_0x11f7c8[_0xe08f('0x13')][_0xe08f('0x11')]);}})[_0xe08f('0x14')](function(_0x341819){logger[_0xe08f('0xe')](_0xe08f('0x10'),_0x4cf322,_0x341819);_0x45f2b6(_0x341819);});});}exports[_0xe08f('0x15')]=function(_0x5ce6b5){var _0x43242f=this;return new Promise(function(_0x2b1f5f,_0x45b349){return db[_0xe08f('0x16')][_0xe08f('0x17')](_0x5ce6b5['body'],{'raw':_0x5ce6b5[_0xe08f('0x18')]?_0x5ce6b5[_0xe08f('0x18')][_0xe08f('0x19')]===undefined?!![]:![]:!![]})[_0xe08f('0x1a')](function(_0x341e51){logger[_0xe08f('0x12')](_0xe08f('0x15'),_0x5ce6b5);logger[_0xe08f('0xc')](_0xe08f('0x15'),_0x5ce6b5,JSON[_0xe08f('0xd')](_0x341e51));_0x2b1f5f(_0x341e51);})[_0xe08f('0x14')](function(_0x5c5d4c){logger['error']('CreateFaxQueueReport',_0x5c5d4c[_0xe08f('0x11')],_0x5ce6b5);_0x45b349(_0x43242f[_0xe08f('0xe')](0x1f4,_0x5c5d4c[_0xe08f('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x3c4553){var _0x29284c=this;return new Promise(function(_0x1bee36,_0x563249){return db[_0xe08f('0x16')]['update'](_0x3c4553[_0xe08f('0x1b')],{'raw':_0x3c4553[_0xe08f('0x18')]?_0x3c4553[_0xe08f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c4553['options']?_0x3c4553[_0xe08f('0x18')][_0xe08f('0x1c')]||null:null,'attributes':_0x3c4553[_0xe08f('0x18')]?_0x3c4553['options'][_0xe08f('0x1d')]||null:null,'limit':_0x3c4553[_0xe08f('0x18')]?_0x3c4553[_0xe08f('0x18')][_0xe08f('0x1e')]||null:null})[_0xe08f('0x1a')](function(_0x261da2){logger['info'](_0xe08f('0x1f'),_0x3c4553);logger[_0xe08f('0xc')](_0xe08f('0x1f'),_0x3c4553,JSON[_0xe08f('0xd')](_0x261da2));_0x1bee36(_0x261da2);})[_0xe08f('0x14')](function(_0x46e4f6){logger[_0xe08f('0xe')](_0xe08f('0x1f'),_0x46e4f6[_0xe08f('0x11')],_0x3c4553);_0x563249(_0x29284c[_0xe08f('0xe')](0x1f4,_0x46e4f6[_0xe08f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 25c7979..a98c5a5 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 _0x52fd=['path','express','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x52fd,0x1ca));var _0xd52f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x52fd[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd52f('0x0'));var util=require(_0xd52f('0x1'));var path=require(_0xd52f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd52f('0x3'));var router=express[_0xd52f('0x4')]();var fs_extra=require(_0xd52f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd52f('0x6'));var config=require('../../config/environment');var controller=require(_0xd52f('0x7'));router['get']('/',auth[_0xd52f('0x8')](),controller[_0xd52f('0x9')]);router[_0xd52f('0xa')](_0xd52f('0xb'),auth[_0xd52f('0x8')](),controller[_0xd52f('0xc')]);router[_0xd52f('0xa')](_0xd52f('0xd'),auth[_0xd52f('0x8')](),controller[_0xd52f('0xe')]);router[_0xd52f('0xf')]('/',auth['isAuthenticated'](),controller[_0xd52f('0x10')]);router[_0xd52f('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd52f('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd52f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xcb15=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','describe','get','show','put','/:id','update','delete','destroy','exports','multer'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xcb15,0xfb));var _0x5cb1=function(_0x5fa488,_0x116911){_0x5fa488=_0x5fa488-0x0;var _0x481878=_0xcb15[_0x5fa488];return _0x481878;};'use strict';var multer=require(_0x5cb1('0x0'));var util=require(_0x5cb1('0x1'));var path=require(_0x5cb1('0x2'));var timeout=require(_0x5cb1('0x3'));var express=require(_0x5cb1('0x4'));var router=express[_0x5cb1('0x5')]();var fs_extra=require(_0x5cb1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5cb1('0x7'));var config=require(_0x5cb1('0x8'));var controller=require(_0x5cb1('0x9'));router['get']('/',auth[_0x5cb1('0xa')](),controller[_0x5cb1('0xb')]);router['get']('/describe',auth[_0x5cb1('0xa')](),controller[_0x5cb1('0xc')]);router[_0x5cb1('0xd')]('/:id',auth[_0x5cb1('0xa')](),controller[_0x5cb1('0xe')]);router['post']('/',auth[_0x5cb1('0xa')](),controller['create']);router[_0x5cb1('0xf')](_0x5cb1('0x10'),auth[_0x5cb1('0xa')](),controller[_0x5cb1('0x11')]);router[_0x5cb1('0x12')]('/:id',auth[_0x5cb1('0xa')](),controller[_0x5cb1('0x13')]);module[_0x5cb1('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c36ad01..25fb982 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2a2434,_0xa00a61){_0x2a2434=_0x2a2434-0x0;var _0x9d80a0=_0xb43b[_0x2a2434];return _0x9d80a0;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x51a3fe,_0x1f8ee0){var _0x140662=function(_0x2f4bd1){while(--_0x2f4bd1){_0x51a3fe['push'](_0x51a3fe['shift']());}};_0x140662(++_0x1f8ee0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xcb91[_0x20589d];return _0x422de9;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 134f1fb..15058bb 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 _0x127b=['fieldName','type','keys','filters','intersection','attributes','model','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','rows','show','includeAll','options','find','create','body','catch','update','params','describe','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','error','name','index','map','FaxTransferReport'];(function(_0x5b21a8,_0x35701f){var _0x5f6aaa=function(_0x3aca8c){while(--_0x3aca8c){_0x5b21a8['push'](_0x5b21a8['shift']());}};_0x5f6aaa(++_0x35701f);}(_0x127b,0x6a));var _0xb127=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x127b[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb127('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb127('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb127('0x2'));var Mustache=require(_0xb127('0x3'));var util=require(_0xb127('0x4'));var path=require(_0xb127('0x5'));var sox=require(_0xb127('0x6'));var csv=require(_0xb127('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb127('0x8'));var _=require(_0xb127('0x9'));var squel=require(_0xb127('0xa'));var crypto=require(_0xb127('0xb'));var jsforce=require(_0xb127('0xc'));var deskjs=require(_0xb127('0xd'));var toCsv=require(_0xb127('0x7'));var querystring=require(_0xb127('0xe'));var Papa=require(_0xb127('0xf'));var Redis=require(_0xb127('0x10'));var authService=require(_0xb127('0x11'));var qs=require(_0xb127('0x12'));var as=require(_0xb127('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb127('0x14'))(_0xb127('0x15'));var utils=require(_0xb127('0x16'));var config=require(_0xb127('0x17'));var licenseUtil=require(_0xb127('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc70ad9,_0x2cdd30){_0x2cdd30=_0x2cdd30||0xcc;return function(_0x183e4a){if(_0x183e4a){return _0xc70ad9[_0xb127('0x19')](_0x2cdd30);}return _0xc70ad9[_0xb127('0x1a')](_0x2cdd30)[_0xb127('0x1b')]();};}function respondWithResult(_0x2202cf,_0x28cb33){_0x28cb33=_0x28cb33||0xc8;return function(_0x8bb955){if(_0x8bb955){return _0x2202cf[_0xb127('0x1a')](_0x28cb33)[_0xb127('0x1c')](_0x8bb955);}};}function respondWithFilteredResult(_0x2bd62f,_0x231bdc){return function(_0xb5f151){if(_0xb5f151){var _0x4acfcd=typeof _0x231bdc[_0xb127('0x1d')]==='undefined'&&typeof _0x231bdc[_0xb127('0x1e')]===_0xb127('0x1f');var _0x40a84d=_0xb5f151[_0xb127('0x20')];var _0x53132d=_0x4acfcd?0x0:_0x231bdc['offset'];var _0x25df81=_0x4acfcd?_0xb5f151[_0xb127('0x20')]:_0x231bdc[_0xb127('0x1d')]+_0x231bdc[_0xb127('0x1e')];var _0x4d7e69;if(_0x25df81>=_0x40a84d){_0x25df81=_0x40a84d;_0x4d7e69=0xc8;}else{_0x4d7e69=0xce;}_0x2bd62f['status'](_0x4d7e69);return _0x2bd62f['set'](_0xb127('0x21'),_0x53132d+'-'+_0x25df81+'/'+_0x40a84d)[_0xb127('0x1c')](_0xb5f151);}return null;};}function patchUpdates(_0x2fa26c){return function(_0x4e7eed){try{jsonpatch[_0xb127('0x22')](_0x4e7eed,_0x2fa26c,!![]);}catch(_0x45d580){return BPromise[_0xb127('0x23')](_0x45d580);}return _0x4e7eed[_0xb127('0x24')]();};}function saveUpdates(_0x164a60,_0x4d225f){return function(_0x2a922c){if(_0x2a922c){return _0x2a922c['update'](_0x164a60)['then'](function(_0x484c27){return _0x484c27;});}return null;};}function removeEntity(_0x426da5,_0xd8b816){return function(_0x3a3d84){if(_0x3a3d84){return _0x3a3d84[_0xb127('0x25')]()[_0xb127('0x26')](function(){_0x426da5[_0xb127('0x1a')](0xcc)[_0xb127('0x1b')]();});}};}function handleEntityNotFound(_0x3856ab,_0x4fc30f){return function(_0x59c65c){if(!_0x59c65c){_0x3856ab[_0xb127('0x19')](0x194);}return _0x59c65c;};}function handleError(_0x5aad6e,_0x45cb6a){_0x45cb6a=_0x45cb6a||0x1f4;return function(_0x2852c4){logger[_0xb127('0x27')](_0x2852c4['stack']);if(_0x2852c4[_0xb127('0x28')]){delete _0x2852c4[_0xb127('0x28')];}_0x5aad6e[_0xb127('0x1a')](_0x45cb6a)['send'](_0x2852c4);};}exports[_0xb127('0x29')]=function(_0xc7d1b6,_0x382ccb){var _0x32e20b={},_0x14a46d={},_0x4fb697={'count':0x0,'rows':[]};var _0x23d524=_[_0xb127('0x2a')](db[_0xb127('0x2b')]['rawAttributes'],function(_0x320f56){return{'name':_0x320f56[_0xb127('0x2c')],'type':_0x320f56[_0xb127('0x2d')]['key']};});_0x14a46d['model']=_[_0xb127('0x2a')](_0x23d524,_0xb127('0x28'));_0x14a46d['query']=_[_0xb127('0x2e')](_0xc7d1b6['query']);_0x14a46d[_0xb127('0x2f')]=_[_0xb127('0x30')](_0x14a46d['model'],_0x14a46d['query']);_0x32e20b[_0xb127('0x31')]=_[_0xb127('0x30')](_0x14a46d[_0xb127('0x32')],qs[_0xb127('0x33')](_0xc7d1b6['query'][_0xb127('0x33')]));_0x32e20b[_0xb127('0x31')]=_0x32e20b['attributes'][_0xb127('0x34')]?_0x32e20b[_0xb127('0x31')]:_0x14a46d[_0xb127('0x32')];if(!_0xc7d1b6[_0xb127('0x35')][_0xb127('0x36')](_0xb127('0x37'))){_0x32e20b[_0xb127('0x1e')]=qs['limit'](_0xc7d1b6[_0xb127('0x35')][_0xb127('0x1e')]);_0x32e20b['offset']=qs[_0xb127('0x1d')](_0xc7d1b6[_0xb127('0x35')][_0xb127('0x1d')]);}_0x32e20b[_0xb127('0x38')]=qs[_0xb127('0x39')](_0xc7d1b6['query'][_0xb127('0x39')]);_0x32e20b[_0xb127('0x3a')]=qs[_0xb127('0x2f')](_[_0xb127('0x3b')](_0xc7d1b6[_0xb127('0x35')],_0x14a46d[_0xb127('0x2f')]),_0x23d524);if(_0xc7d1b6[_0xb127('0x35')][_0xb127('0x3c')]){_0x32e20b[_0xb127('0x3a')]=_['merge'](_0x32e20b[_0xb127('0x3a')],{'$or':_[_0xb127('0x2a')](_0x23d524,function(_0x4fbc7e){if(_0x4fbc7e[_0xb127('0x2d')]!==_0xb127('0x3d')){var _0x14ba4d={};_0x14ba4d[_0x4fbc7e[_0xb127('0x28')]]={'$like':'%'+_0xc7d1b6[_0xb127('0x35')][_0xb127('0x3c')]+'%'};return _0x14ba4d;}})});}_0x32e20b=_[_0xb127('0x3e')]({},_0x32e20b,_0xc7d1b6['options']);var _0x2c4c80={'where':_0x32e20b[_0xb127('0x3a')]};return db['FaxTransferReport'][_0xb127('0x20')](_0x2c4c80)[_0xb127('0x26')](function(_0x2f79eb){_0x4fb697[_0xb127('0x20')]=_0x2f79eb;if(_0xc7d1b6[_0xb127('0x35')]['includeAll']){_0x32e20b[_0xb127('0x3f')]=[{'all':!![]}];}return db[_0xb127('0x2b')]['findAll'](_0x32e20b);})[_0xb127('0x26')](function(_0x528cd4){_0x4fb697[_0xb127('0x40')]=_0x528cd4;return _0x4fb697;})['then'](respondWithFilteredResult(_0x382ccb,_0x32e20b))['catch'](handleError(_0x382ccb,null));};exports[_0xb127('0x41')]=function(_0x24b9a1,_0x5325fb){var _0x714d16={'raw':!![],'where':{'id':_0x24b9a1['params']['id']}},_0x165db8={};_0x165db8['model']=_[_0xb127('0x2e')](db[_0xb127('0x2b')]['rawAttributes']);_0x165db8[_0xb127('0x35')]=_['keys'](_0x24b9a1['query']);_0x165db8[_0xb127('0x2f')]=_['intersection'](_0x165db8['model'],_0x165db8[_0xb127('0x35')]);_0x714d16[_0xb127('0x31')]=_[_0xb127('0x30')](_0x165db8[_0xb127('0x32')],qs['fields'](_0x24b9a1[_0xb127('0x35')][_0xb127('0x33')]));_0x714d16[_0xb127('0x31')]=_0x714d16[_0xb127('0x31')][_0xb127('0x34')]?_0x714d16['attributes']:_0x165db8[_0xb127('0x32')];if(_0x24b9a1[_0xb127('0x35')][_0xb127('0x42')]){_0x714d16[_0xb127('0x3f')]=[{'all':!![]}];}_0x714d16=_[_0xb127('0x3e')]({},_0x714d16,_0x24b9a1[_0xb127('0x43')]);return db[_0xb127('0x2b')][_0xb127('0x44')](_0x714d16)[_0xb127('0x26')](handleEntityNotFound(_0x5325fb,null))['then'](respondWithResult(_0x5325fb,null))['catch'](handleError(_0x5325fb,null));};exports[_0xb127('0x45')]=function(_0xf1195,_0x4623a5){return db['FaxTransferReport'][_0xb127('0x45')](_0xf1195[_0xb127('0x46')],{})['then'](respondWithResult(_0x4623a5,0xc9))[_0xb127('0x47')](handleError(_0x4623a5,null));};exports[_0xb127('0x48')]=function(_0x2a84c7,_0x1dac27){if(_0x2a84c7['body']['id']){delete _0x2a84c7[_0xb127('0x46')]['id'];}return db[_0xb127('0x2b')][_0xb127('0x44')]({'where':{'id':_0x2a84c7['params']['id']}})['then'](handleEntityNotFound(_0x1dac27,null))[_0xb127('0x26')](saveUpdates(_0x2a84c7[_0xb127('0x46')],null))[_0xb127('0x26')](respondWithResult(_0x1dac27,null))[_0xb127('0x47')](handleError(_0x1dac27,null));};exports[_0xb127('0x25')]=function(_0x512b4b,_0x2a650e){return db['FaxTransferReport']['find']({'where':{'id':_0x512b4b[_0xb127('0x49')]['id']}})[_0xb127('0x26')](handleEntityNotFound(_0x2a650e,null))[_0xb127('0x26')](removeEntity(_0x2a650e,null))[_0xb127('0x47')](handleError(_0x2a650e,null));};exports[_0xb127('0x4a')]=function(_0x76d650,_0x5ca062){return db[_0xb127('0x2b')]['describe']()[_0xb127('0x26')](respondWithResult(_0x5ca062,null))[_0xb127('0x47')](handleError(_0x5ca062,null));}; \ No newline at end of file +var _0x3da5=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','options','FaxTransferReport','includeAll','findAll','show','keys','find','catch','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','update','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3da5,0xb9));var _0x53da=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x3da5[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53da('0x0'));var zipdir=require(_0x53da('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53da('0x2'));var moment=require(_0x53da('0x3'));var BPromise=require(_0x53da('0x4'));var Mustache=require(_0x53da('0x5'));var util=require(_0x53da('0x6'));var path=require(_0x53da('0x7'));var sox=require(_0x53da('0x8'));var csv=require(_0x53da('0x9'));var ejs=require(_0x53da('0xa'));var fs=require('fs');var fs_extra=require(_0x53da('0xb'));var _=require(_0x53da('0xc'));var squel=require(_0x53da('0xd'));var crypto=require(_0x53da('0xe'));var jsforce=require(_0x53da('0xf'));var deskjs=require(_0x53da('0x10'));var toCsv=require(_0x53da('0x9'));var querystring=require(_0x53da('0x11'));var Papa=require(_0x53da('0x12'));var Redis=require(_0x53da('0x13'));var authService=require(_0x53da('0x14'));var qs=require(_0x53da('0x15'));var as=require(_0x53da('0x16'));var hardwareService=require(_0x53da('0x17'));var logger=require(_0x53da('0x18'))(_0x53da('0x19'));var utils=require('../../config/utils');var config=require(_0x53da('0x1a'));var licenseUtil=require(_0x53da('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e741a,_0x5c1e64){_0x5c1e64=_0x5c1e64||0xcc;return function(_0x55de5f){if(_0x55de5f){return _0x5e741a[_0x53da('0x1c')](_0x5c1e64);}return _0x5e741a[_0x53da('0x1d')](_0x5c1e64)[_0x53da('0x1e')]();};}function respondWithResult(_0x4ad37a,_0x3527e4){_0x3527e4=_0x3527e4||0xc8;return function(_0x6125ec){if(_0x6125ec){return _0x4ad37a['status'](_0x3527e4)['json'](_0x6125ec);}};}function respondWithFilteredResult(_0x413d9b,_0x7043fc){return function(_0x3f7d4c){if(_0x3f7d4c){var _0x3598f2=typeof _0x7043fc[_0x53da('0x1f')]===_0x53da('0x20')&&typeof _0x7043fc[_0x53da('0x21')]===_0x53da('0x20');var _0x3e34f3=_0x3f7d4c[_0x53da('0x22')];var _0xd6ade0=_0x3598f2?0x0:_0x7043fc['offset'];var _0x2689a7=_0x3598f2?_0x3f7d4c['count']:_0x7043fc['offset']+_0x7043fc[_0x53da('0x21')];var _0x482305;if(_0x2689a7>=_0x3e34f3){_0x2689a7=_0x3e34f3;_0x482305=0xc8;}else{_0x482305=0xce;}_0x413d9b['status'](_0x482305);return _0x413d9b['set']('Content-Range',_0xd6ade0+'-'+_0x2689a7+'/'+_0x3e34f3)[_0x53da('0x23')](_0x3f7d4c);}return null;};}function patchUpdates(_0x372d50){return function(_0x2d9441){try{jsonpatch['apply'](_0x2d9441,_0x372d50,!![]);}catch(_0x38c877){return BPromise[_0x53da('0x24')](_0x38c877);}return _0x2d9441[_0x53da('0x25')]();};}function saveUpdates(_0x51016f,_0x5c4f3e){return function(_0x52e75d){if(_0x52e75d){return _0x52e75d[_0x53da('0x26')](_0x51016f)[_0x53da('0x27')](function(_0x36d348){return _0x36d348;});}return null;};}function removeEntity(_0x5a3dbd,_0x19d87c){return function(_0xd74118){if(_0xd74118){return _0xd74118[_0x53da('0x28')]()[_0x53da('0x27')](function(){_0x5a3dbd[_0x53da('0x1d')](0xcc)[_0x53da('0x1e')]();});}};}function handleEntityNotFound(_0x20d6a9,_0x2a1bc0){return function(_0x123f5f){if(!_0x123f5f){_0x20d6a9['sendStatus'](0x194);}return _0x123f5f;};}function handleError(_0x438e81,_0x389005){_0x389005=_0x389005||0x1f4;return function(_0x50526b){logger[_0x53da('0x29')](_0x50526b[_0x53da('0x2a')]);if(_0x50526b[_0x53da('0x2b')]){delete _0x50526b['name'];}_0x438e81[_0x53da('0x1d')](_0x389005)[_0x53da('0x2c')](_0x50526b);};}exports[_0x53da('0x2d')]=function(_0x5172f0,_0x4b714d){var _0x2ec547={},_0x35778e={},_0x3a18a5={'count':0x0,'rows':[]};var _0x1d1d6a=_[_0x53da('0x2e')](db['FaxTransferReport'][_0x53da('0x2f')],function(_0x235d7c){return{'name':_0x235d7c[_0x53da('0x30')],'type':_0x235d7c['type']['key']};});_0x35778e[_0x53da('0x31')]=_[_0x53da('0x2e')](_0x1d1d6a,'name');_0x35778e[_0x53da('0x32')]=_['keys'](_0x5172f0[_0x53da('0x32')]);_0x35778e[_0x53da('0x33')]=_['intersection'](_0x35778e[_0x53da('0x31')],_0x35778e['query']);_0x2ec547[_0x53da('0x34')]=_[_0x53da('0x35')](_0x35778e[_0x53da('0x31')],qs[_0x53da('0x36')](_0x5172f0[_0x53da('0x32')]['fields']));_0x2ec547[_0x53da('0x34')]=_0x2ec547['attributes'][_0x53da('0x37')]?_0x2ec547['attributes']:_0x35778e[_0x53da('0x31')];if(!_0x5172f0[_0x53da('0x32')]['hasOwnProperty'](_0x53da('0x38'))){_0x2ec547[_0x53da('0x21')]=qs[_0x53da('0x21')](_0x5172f0[_0x53da('0x32')][_0x53da('0x21')]);_0x2ec547[_0x53da('0x1f')]=qs[_0x53da('0x1f')](_0x5172f0[_0x53da('0x32')][_0x53da('0x1f')]);}_0x2ec547['order']=qs['sort'](_0x5172f0[_0x53da('0x32')][_0x53da('0x39')]);_0x2ec547[_0x53da('0x3a')]=qs[_0x53da('0x33')](_[_0x53da('0x3b')](_0x5172f0[_0x53da('0x32')],_0x35778e[_0x53da('0x33')]),_0x1d1d6a);if(_0x5172f0[_0x53da('0x32')][_0x53da('0x3c')]){_0x2ec547[_0x53da('0x3a')]=_[_0x53da('0x3d')](_0x2ec547[_0x53da('0x3a')],{'$or':_['map'](_0x1d1d6a,function(_0x4e1050){if(_0x4e1050[_0x53da('0x3e')]!=='VIRTUAL'){var _0x4586c7={};_0x4586c7[_0x4e1050[_0x53da('0x2b')]]={'$like':'%'+_0x5172f0[_0x53da('0x32')]['filter']+'%'};return _0x4586c7;}})});}_0x2ec547=_[_0x53da('0x3d')]({},_0x2ec547,_0x5172f0[_0x53da('0x3f')]);var _0x149abf={'where':_0x2ec547[_0x53da('0x3a')]};return db[_0x53da('0x40')][_0x53da('0x22')](_0x149abf)[_0x53da('0x27')](function(_0x4bc74f){_0x3a18a5[_0x53da('0x22')]=_0x4bc74f;if(_0x5172f0[_0x53da('0x32')][_0x53da('0x41')]){_0x2ec547['include']=[{'all':!![]}];}return db[_0x53da('0x40')][_0x53da('0x42')](_0x2ec547);})['then'](function(_0x33e900){_0x3a18a5['rows']=_0x33e900;return _0x3a18a5;})['then'](respondWithFilteredResult(_0x4b714d,_0x2ec547))['catch'](handleError(_0x4b714d,null));};exports[_0x53da('0x43')]=function(_0x32d0f2,_0x3ec9bd){var _0x5e705d={'raw':!![],'where':{'id':_0x32d0f2['params']['id']}},_0x4f3e85={};_0x4f3e85[_0x53da('0x31')]=_['keys'](db[_0x53da('0x40')]['rawAttributes']);_0x4f3e85[_0x53da('0x32')]=_[_0x53da('0x44')](_0x32d0f2[_0x53da('0x32')]);_0x4f3e85['filters']=_['intersection'](_0x4f3e85['model'],_0x4f3e85[_0x53da('0x32')]);_0x5e705d['attributes']=_[_0x53da('0x35')](_0x4f3e85[_0x53da('0x31')],qs[_0x53da('0x36')](_0x32d0f2['query'][_0x53da('0x36')]));_0x5e705d[_0x53da('0x34')]=_0x5e705d['attributes'][_0x53da('0x37')]?_0x5e705d[_0x53da('0x34')]:_0x4f3e85[_0x53da('0x31')];if(_0x32d0f2[_0x53da('0x32')][_0x53da('0x41')]){_0x5e705d['include']=[{'all':!![]}];}_0x5e705d=_[_0x53da('0x3d')]({},_0x5e705d,_0x32d0f2['options']);return db[_0x53da('0x40')][_0x53da('0x45')](_0x5e705d)[_0x53da('0x27')](handleEntityNotFound(_0x3ec9bd,null))[_0x53da('0x27')](respondWithResult(_0x3ec9bd,null))[_0x53da('0x46')](handleError(_0x3ec9bd,null));};exports[_0x53da('0x47')]=function(_0x2c11f5,_0x522518){return db[_0x53da('0x40')][_0x53da('0x47')](_0x2c11f5[_0x53da('0x48')],{})[_0x53da('0x27')](respondWithResult(_0x522518,0xc9))[_0x53da('0x46')](handleError(_0x522518,null));};exports[_0x53da('0x26')]=function(_0x20abc3,_0x37143b){if(_0x20abc3[_0x53da('0x48')]['id']){delete _0x20abc3[_0x53da('0x48')]['id'];}return db[_0x53da('0x40')][_0x53da('0x45')]({'where':{'id':_0x20abc3['params']['id']}})['then'](handleEntityNotFound(_0x37143b,null))[_0x53da('0x27')](saveUpdates(_0x20abc3[_0x53da('0x48')],null))[_0x53da('0x27')](respondWithResult(_0x37143b,null))[_0x53da('0x46')](handleError(_0x37143b,null));};exports['destroy']=function(_0x4b172e,_0x3e5167){return db[_0x53da('0x40')][_0x53da('0x45')]({'where':{'id':_0x4b172e[_0x53da('0x49')]['id']}})[_0x53da('0x27')](handleEntityNotFound(_0x3e5167,null))[_0x53da('0x27')](removeEntity(_0x3e5167,null))[_0x53da('0x46')](handleError(_0x3e5167,null));};exports['describe']=function(_0x489ead,_0x1323dc){return db[_0x53da('0x40')][_0x53da('0x4a')]()[_0x53da('0x27')](respondWithResult(_0x1323dc,null))['catch'](handleError(_0x1323dc,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 48668ed..bc6a33a 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 _0x348e=['api','moment','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger'];(function(_0x2c7603,_0x288ab6){var _0x2e4e45=function(_0x27a4c7){while(--_0x27a4c7){_0x2c7603['push'](_0x2c7603['shift']());}};_0x2e4e45(++_0x288ab6);}(_0x348e,0x7f));var _0xe348=function(_0x12fc39,_0x408afb){_0x12fc39=_0x12fc39-0x0;var _0x706d12=_0x348e[_0x12fc39];return _0x706d12;};'use strict';var _=require(_0xe348('0x0'));var util=require(_0xe348('0x1'));var logger=require(_0xe348('0x2'))(_0xe348('0x3'));var moment=require(_0xe348('0x4'));var BPromise=require(_0xe348('0x5'));var rp=require(_0xe348('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe348('0x7'));var attributes=require(_0xe348('0x8'));module[_0xe348('0x9')]=function(_0x397f62,_0x5ae383){return _0x397f62[_0xe348('0xa')](_0xe348('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xe348('0xc'),'fields':[_0xe348('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28cc=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1d86f7,_0x3ed73d){var _0xcef1de=function(_0x47b6fc){while(--_0x47b6fc){_0x1d86f7['push'](_0x1d86f7['shift']());}};_0xcef1de(++_0x3ed73d);}(_0x28cc,0x180));var _0xc28c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28cc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc28c('0x0'));var util=require(_0xc28c('0x1'));var logger=require(_0xc28c('0x2'))(_0xc28c('0x3'));var moment=require(_0xc28c('0x4'));var BPromise=require(_0xc28c('0x5'));var rp=require(_0xc28c('0x6'));var fs=require('fs');var path=require(_0xc28c('0x7'));var rimraf=require(_0xc28c('0x8'));var config=require(_0xc28c('0x9'));var attributes=require(_0xc28c('0xa'));module[_0xc28c('0xb')]=function(_0xba2032,_0x227a35){return _0xba2032['define'](_0xc28c('0xc'),attributes,{'tableName':_0xc28c('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc28c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index b6acf1f..3486615 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 _0x20fe=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x18f045,_0x2d7693){var _0xfd133c=function(_0xb3f0eb){while(--_0xb3f0eb){_0x18f045['push'](_0x18f045['shift']());}};_0xfd133c(++_0x2d7693);}(_0x20fe,0xb1));var _0xe20f=function(_0x212740,_0x4d27db){_0x212740=_0x212740-0x0;var _0xbce06d=_0x20fe[_0x212740];return _0xbce06d;};'use strict';var _=require('lodash');var util=require(_0xe20f('0x0'));var moment=require(_0xe20f('0x1'));var BPromise=require(_0xe20f('0x2'));var rs=require(_0xe20f('0x3'));var fs=require('fs');var Redis=require(_0xe20f('0x4'));var db=require(_0xe20f('0x5'))['db'];var utils=require(_0xe20f('0x6'));var logger=require(_0xe20f('0x7'))(_0xe20f('0x8'));var config=require(_0xe20f('0x9'));var jayson=require(_0xe20f('0xa'));var client=jayson['client'][_0xe20f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dbe4a,_0x59615,_0x41a8b6){return new BPromise(function(_0x15db78,_0x18cbc5){return client[_0xe20f('0xc')](_0x2dbe4a,_0x41a8b6)[_0xe20f('0xd')](function(_0x5857af){logger[_0xe20f('0xe')](_0xe20f('0xf'),_0x59615,_0xe20f('0x10'));logger[_0xe20f('0x11')](_0xe20f('0x12'),_0x59615,_0xe20f('0x10'),JSON['stringify'](_0x5857af));if(_0x5857af[_0xe20f('0x13')]){if(_0x5857af[_0xe20f('0x13')]['code']===0x1f4){logger[_0xe20f('0x13')](_0xe20f('0xf'),_0x59615,_0x5857af[_0xe20f('0x13')][_0xe20f('0x14')]);return _0x18cbc5(_0x5857af[_0xe20f('0x13')][_0xe20f('0x14')]);}logger[_0xe20f('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x59615,_0x5857af[_0xe20f('0x13')][_0xe20f('0x14')]);return _0x15db78(_0x5857af[_0xe20f('0x13')][_0xe20f('0x14')]);}else{logger[_0xe20f('0xe')](_0xe20f('0xf'),_0x59615,_0xe20f('0x10'));_0x15db78(_0x5857af['result']['message']);}})[_0xe20f('0x15')](function(_0x53b9e8){logger['error'](_0xe20f('0xf'),_0x59615,_0x53b9e8);_0x18cbc5(_0x53b9e8);});});} \ No newline at end of file +var _0xdcfb=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x38f91c,_0x25a21d){var _0x1fc0e5=function(_0x34f04f){while(--_0x34f04f){_0x38f91c['push'](_0x38f91c['shift']());}};_0x1fc0e5(++_0x25a21d);}(_0xdcfb,0x96));var _0xbdcf=function(_0x2f2cb8,_0x417d38){_0x2f2cb8=_0x2f2cb8-0x0;var _0x5a7add=_0xdcfb[_0x2f2cb8];return _0x5a7add;};'use strict';var _=require('lodash');var util=require(_0xbdcf('0x0'));var moment=require(_0xbdcf('0x1'));var BPromise=require(_0xbdcf('0x2'));var rs=require(_0xbdcf('0x3'));var fs=require('fs');var Redis=require(_0xbdcf('0x4'));var db=require(_0xbdcf('0x5'))['db'];var utils=require(_0xbdcf('0x6'));var logger=require(_0xbdcf('0x7'))(_0xbdcf('0x8'));var config=require(_0xbdcf('0x9'));var jayson=require(_0xbdcf('0xa'));var client=jayson[_0xbdcf('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc205f3,_0xaf23d6,_0x6245b2){return new BPromise(function(_0x166cec,_0xbfc985){return client[_0xbdcf('0xc')](_0xc205f3,_0x6245b2)['then'](function(_0x58bb23){logger['info'](_0xbdcf('0xd'),_0xaf23d6,_0xbdcf('0xe'));logger[_0xbdcf('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xaf23d6,_0xbdcf('0xe'),JSON['stringify'](_0x58bb23));if(_0x58bb23['error']){if(_0x58bb23[_0xbdcf('0x10')][_0xbdcf('0x11')]===0x1f4){logger['error'](_0xbdcf('0xd'),_0xaf23d6,_0x58bb23['error'][_0xbdcf('0x12')]);return _0xbfc985(_0x58bb23[_0xbdcf('0x10')]['message']);}logger[_0xbdcf('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0xaf23d6,_0x58bb23['error'][_0xbdcf('0x12')]);return _0x166cec(_0x58bb23[_0xbdcf('0x10')][_0xbdcf('0x12')]);}else{logger['info'](_0xbdcf('0xd'),_0xaf23d6,'request\x20sent');_0x166cec(_0x58bb23[_0xbdcf('0x13')][_0xbdcf('0x12')]);}})[_0xbdcf('0x14')](function(_0x357e70){logger[_0xbdcf('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0xaf23d6,_0x357e70);_0xbfc985(_0x357e70);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2a8c2aa..591a470 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 _0x5039=['get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller'];(function(_0x301785,_0x506056){var _0x4ea53b=function(_0x5da0a7){while(--_0x5da0a7){_0x301785['push'](_0x301785['shift']());}};_0x4ea53b(++_0x506056);}(_0x5039,0x14d));var _0x9503=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x5039[_0x3e8cae];return _0x45c4d6;};'use strict';var multer=require(_0x9503('0x0'));var util=require(_0x9503('0x1'));var path=require(_0x9503('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9503('0x3'));var auth=require(_0x9503('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9503('0x5'));var controller=require(_0x9503('0x6'));router[_0x9503('0x7')]('/',auth['isAuthenticated'](),controller[_0x9503('0x8')]);router[_0x9503('0x7')](_0x9503('0x9'),auth[_0x9503('0xa')](),controller[_0x9503('0xb')]);router[_0x9503('0x7')]('/:id',auth[_0x9503('0xa')](),controller[_0x9503('0xc')]);router[_0x9503('0xd')]('/',auth[_0x9503('0xa')](),controller[_0x9503('0xe')]);router[_0x9503('0xf')](_0x9503('0x10'),auth[_0x9503('0xa')](),controller['update']);router[_0x9503('0x11')](_0x9503('0x10'),auth[_0x9503('0xa')](),controller[_0x9503('0x12')]);module[_0x9503('0x13')]=router; \ No newline at end of file +var _0x2900=['put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxTransferReport.controller','index','get','isAuthenticated','/:id','show'];(function(_0x1b78ba,_0x1caa0d){var _0x224cb9=function(_0x3a99ae){while(--_0x3a99ae){_0x1b78ba['push'](_0x1b78ba['shift']());}};_0x224cb9(++_0x1caa0d);}(_0x2900,0x183));var _0x0290=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x2900[_0x4d79bc];return _0x4b4760;};'use strict';var multer=require('multer');var util=require(_0x0290('0x0'));var path=require(_0x0290('0x1'));var timeout=require(_0x0290('0x2'));var express=require(_0x0290('0x3'));var router=express[_0x0290('0x4')]();var fs_extra=require(_0x0290('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0290('0x6'));var config=require('../../config/environment');var controller=require(_0x0290('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0290('0x8')]);router[_0x0290('0x9')]('/describe',auth[_0x0290('0xa')](),controller['describe']);router[_0x0290('0x9')](_0x0290('0xb'),auth[_0x0290('0xa')](),controller[_0x0290('0xc')]);router['post']('/',auth[_0x0290('0xa')](),controller['create']);router[_0x0290('0xd')](_0x0290('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0290('0xe')](_0x0290('0xb'),auth[_0x0290('0xa')](),controller[_0x0290('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 6dc6a2d..e5f44e1 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 _0x6cc4=['/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x5e798b,_0x58cec4){var _0x32cb85=function(_0x1bcc25){while(--_0x1bcc25){_0x5e798b['push'](_0x5e798b['shift']());}};_0x32cb85(++_0x58cec4);}(_0x6cc4,0xfa));var _0x46cc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6cc4[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x46cc('0x0'));var util=require(_0x46cc('0x1'));var path=require(_0x46cc('0x2'));var timeout=require('connect-timeout');var express=require(_0x46cc('0x3'));var router=express[_0x46cc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x46cc('0x5'));var config=require(_0x46cc('0x6'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x46cc('0x7')](),controller[_0x46cc('0x8')]);router[_0x46cc('0x9')](_0x46cc('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x46cc('0x9')](_0x46cc('0xb'),auth[_0x46cc('0x7')](),controller[_0x46cc('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x46cc('0xd')]);router[_0x46cc('0xe')]('/',auth[_0x46cc('0x7')](),controller[_0x46cc('0xf')]);router[_0x46cc('0xe')](_0x46cc('0xb'),auth[_0x46cc('0x7')](),controller[_0x46cc('0x10')]);router[_0x46cc('0x11')](_0x46cc('0xa'),auth[_0x46cc('0x7')](),controller[_0x46cc('0x12')]);router['delete'](_0x46cc('0xa'),auth[_0x46cc('0x7')](),controller[_0x46cc('0x13')]);module['exports']=router; \ No newline at end of file +var _0x16c9=['/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','show'];(function(_0x41be4b,_0x413768){var _0x5ebe57=function(_0x5cfde7){while(--_0x5cfde7){_0x41be4b['push'](_0x41be4b['shift']());}};_0x5ebe57(++_0x413768);}(_0x16c9,0x144));var _0x916c=function(_0x37561b,_0x51eaff){_0x37561b=_0x37561b-0x0;var _0xe6e375=_0x16c9[_0x37561b];return _0xe6e375;};'use strict';var multer=require(_0x916c('0x0'));var util=require(_0x916c('0x1'));var path=require(_0x916c('0x2'));var timeout=require(_0x916c('0x3'));var express=require(_0x916c('0x4'));var router=express[_0x916c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x916c('0x6'));var interaction=require(_0x916c('0x7'));var config=require(_0x916c('0x8'));var controller=require(_0x916c('0x9'));router[_0x916c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x916c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x916c('0xb')]);router['get'](_0x916c('0xc'),auth[_0x916c('0xd')](),controller['getConfigurations']);router[_0x916c('0xa')](_0x916c('0xe'),auth['isAuthenticated'](),controller[_0x916c('0xf')]);router[_0x916c('0x10')]('/',auth[_0x916c('0xd')](),controller[_0x916c('0x11')]);router[_0x916c('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x916c('0x12')]);router['put'](_0x916c('0x13'),auth['isAuthenticated'](),controller[_0x916c('0x14')]);router[_0x916c('0x15')]('/:id',auth[_0x916c('0xd')](),controller[_0x916c('0x16')]);module[_0x916c('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 d3a4911..61c4daf 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 _0x2e28=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x2e28,0xf6));var _0x82e2=function(_0x2f90db,_0x1327d2){_0x2f90db=_0x2f90db-0x0;var _0x59f52f=_0x2e28[_0x2f90db];return _0x59f52f;};'use strict';var Sequelize=require('sequelize');module[_0x82e2('0x0')]={'name':{'type':Sequelize[_0x82e2('0x1')]},'description':{'type':Sequelize[_0x82e2('0x1')]},'username':{'type':Sequelize[_0x82e2('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x82e2('0x2')](_0x82e2('0x3')),'defaultValue':_0x82e2('0x3')},'password':{'type':Sequelize[_0x82e2('0x1')]},'consumerKey':{'type':Sequelize[_0x82e2('0x1')]},'consumerSecret':{'type':Sequelize[_0x82e2('0x1')]},'token':{'type':Sequelize[_0x82e2('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x82e2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x82e2('0x2')](_0x82e2('0x4'),_0x82e2('0x5')),'defaultValue':_0x82e2('0x4')}}; \ No newline at end of file +var _0xd55f=['ENUM','basic','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x357681,_0x7447cc){var _0xa009ba=function(_0x28673a){while(--_0x28673a){_0x357681['push'](_0x357681['shift']());}};_0xa009ba(++_0x7447cc);}(_0xd55f,0x1ee));var _0xfd55=function(_0x51cb7a,_0x3e3c30){_0x51cb7a=_0x51cb7a-0x0;var _0x13d2b0=_0xd55f[_0x51cb7a];return _0x13d2b0;};'use strict';var Sequelize=require(_0xfd55('0x0'));module[_0xfd55('0x1')]={'name':{'type':Sequelize[_0xfd55('0x2')]},'description':{'type':Sequelize[_0xfd55('0x2')]},'username':{'type':Sequelize[_0xfd55('0x2')]},'remoteUri':{'type':Sequelize[_0xfd55('0x2')]},'authType':{'type':Sequelize[_0xfd55('0x3')]('basic'),'defaultValue':_0xfd55('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xfd55('0x2')]},'consumerSecret':{'type':Sequelize[_0xfd55('0x2')]},'token':{'type':Sequelize[_0xfd55('0x2')]},'tokenSecret':{'type':Sequelize[_0xfd55('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfd55('0x3')](_0xfd55('0x5'),_0xfd55('0x6')),'defaultValue':_0xfd55('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 6d849df..6d9819d 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 _0xc600=['offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','DeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','merge','find','create','body','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','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','json'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xc600,0xc6));var _0x0c60=function(_0xdfcdf8,_0x55b8e1){_0xdfcdf8=_0xdfcdf8-0x0;var _0x2e3ccb=_0xc600[_0xdfcdf8];return _0x2e3ccb;};'use strict';var emlformat=require(_0x0c60('0x0'));var rimraf=require(_0x0c60('0x1'));var zipdir=require(_0x0c60('0x2'));var jsonpatch=require(_0x0c60('0x3'));var rp=require(_0x0c60('0x4'));var moment=require(_0x0c60('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0c60('0x6'));var util=require(_0x0c60('0x7'));var path=require('path');var sox=require(_0x0c60('0x8'));var csv=require(_0x0c60('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c60('0xa'));var _=require(_0x0c60('0xb'));var squel=require(_0x0c60('0xc'));var crypto=require(_0x0c60('0xd'));var jsforce=require(_0x0c60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0c60('0x9'));var querystring=require(_0x0c60('0xf'));var Papa=require('papaparse');var Redis=require(_0x0c60('0x10'));var authService=require(_0x0c60('0x11'));var qs=require(_0x0c60('0x12'));var as=require(_0x0c60('0x13'));var hardwareService=require(_0x0c60('0x14'));var logger=require(_0x0c60('0x15'))('api');var utils=require(_0x0c60('0x16'));var config=require(_0x0c60('0x17'));var licenseUtil=require(_0x0c60('0x18'));var db=require(_0x0c60('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16a601,_0x2737c6){_0x2737c6=_0x2737c6||0xcc;return function(_0x4a560d){if(_0x4a560d){return _0x16a601['sendStatus'](_0x2737c6);}return _0x16a601[_0x0c60('0x1a')](_0x2737c6)['end']();};}function respondWithResult(_0x1a9bf2,_0x25dd5d){_0x25dd5d=_0x25dd5d||0xc8;return function(_0x25074c){if(_0x25074c){return _0x1a9bf2[_0x0c60('0x1a')](_0x25dd5d)[_0x0c60('0x1b')](_0x25074c);}};}function respondWithFilteredResult(_0x4a2b3a,_0x2193f6){return function(_0x198ba5){if(_0x198ba5){var _0x58d0f9=typeof _0x2193f6[_0x0c60('0x1c')]===_0x0c60('0x1d')&&typeof _0x2193f6[_0x0c60('0x1e')]===_0x0c60('0x1d');var _0x2ce8f2=_0x198ba5[_0x0c60('0x1f')];var _0x41d135=_0x58d0f9?0x0:_0x2193f6[_0x0c60('0x1c')];var _0x830536=_0x58d0f9?_0x198ba5[_0x0c60('0x1f')]:_0x2193f6['offset']+_0x2193f6[_0x0c60('0x1e')];var _0x36811b;if(_0x830536>=_0x2ce8f2){_0x830536=_0x2ce8f2;_0x36811b=0xc8;}else{_0x36811b=0xce;}_0x4a2b3a['status'](_0x36811b);return _0x4a2b3a[_0x0c60('0x20')](_0x0c60('0x21'),_0x41d135+'-'+_0x830536+'/'+_0x2ce8f2)[_0x0c60('0x1b')](_0x198ba5);}return null;};}function patchUpdates(_0x50060c){return function(_0x57ae8c){try{jsonpatch['apply'](_0x57ae8c,_0x50060c,!![]);}catch(_0x3d7a3a){return BPromise[_0x0c60('0x22')](_0x3d7a3a);}return _0x57ae8c[_0x0c60('0x23')]();};}function saveUpdates(_0x4746f8,_0x452c7f){return function(_0x255df){if(_0x255df){return _0x255df[_0x0c60('0x24')](_0x4746f8)[_0x0c60('0x25')](function(_0xc1857d){return _0xc1857d;});}return null;};}function removeEntity(_0x17eb3f,_0x135986){return function(_0x407f3e){if(_0x407f3e){return _0x407f3e[_0x0c60('0x26')]()['then'](function(){_0x17eb3f[_0x0c60('0x1a')](0xcc)[_0x0c60('0x27')]();});}};}function handleEntityNotFound(_0x4c899c,_0x125631){return function(_0x55cd1c){if(!_0x55cd1c){_0x4c899c[_0x0c60('0x28')](0x194);}return _0x55cd1c;};}function handleError(_0x4ce078,_0x545bce){_0x545bce=_0x545bce||0x1f4;return function(_0x479f47){logger[_0x0c60('0x29')](_0x479f47[_0x0c60('0x2a')]);if(_0x479f47[_0x0c60('0x2b')]){delete _0x479f47[_0x0c60('0x2b')];}_0x4ce078[_0x0c60('0x1a')](_0x545bce)[_0x0c60('0x2c')](_0x479f47);};}exports['index']=function(_0x1a63f5,_0xe27646){var _0x36c579={},_0xa8d72f={},_0xfba4d1={'count':0x0,'rows':[]};var _0x4f9c61=_[_0x0c60('0x2d')](db[_0x0c60('0x2e')][_0x0c60('0x2f')],function(_0x317257){return{'name':_0x317257['fieldName'],'type':_0x317257[_0x0c60('0x30')]['key']};});_0xa8d72f[_0x0c60('0x31')]=_[_0x0c60('0x2d')](_0x4f9c61,_0x0c60('0x2b'));_0xa8d72f[_0x0c60('0x32')]=_[_0x0c60('0x33')](_0x1a63f5[_0x0c60('0x32')]);_0xa8d72f[_0x0c60('0x34')]=_[_0x0c60('0x35')](_0xa8d72f['model'],_0xa8d72f[_0x0c60('0x32')]);_0x36c579[_0x0c60('0x36')]=_[_0x0c60('0x35')](_0xa8d72f['model'],qs['fields'](_0x1a63f5['query'][_0x0c60('0x37')]));_0x36c579['attributes']=_0x36c579[_0x0c60('0x36')][_0x0c60('0x38')]?_0x36c579[_0x0c60('0x36')]:_0xa8d72f['model'];if(!_0x1a63f5[_0x0c60('0x32')][_0x0c60('0x39')](_0x0c60('0x3a'))){_0x36c579[_0x0c60('0x1e')]=qs[_0x0c60('0x1e')](_0x1a63f5['query'][_0x0c60('0x1e')]);_0x36c579[_0x0c60('0x1c')]=qs[_0x0c60('0x1c')](_0x1a63f5['query'][_0x0c60('0x1c')]);}_0x36c579[_0x0c60('0x3b')]=qs[_0x0c60('0x3c')](_0x1a63f5[_0x0c60('0x32')][_0x0c60('0x3c')]);_0x36c579[_0x0c60('0x3d')]=qs[_0x0c60('0x34')](_[_0x0c60('0x3e')](_0x1a63f5[_0x0c60('0x32')],_0xa8d72f[_0x0c60('0x34')]),_0x4f9c61);if(_0x1a63f5[_0x0c60('0x32')][_0x0c60('0x3f')]){_0x36c579[_0x0c60('0x3d')]=_['merge'](_0x36c579[_0x0c60('0x3d')],{'$or':_[_0x0c60('0x2d')](_0x4f9c61,function(_0x35b5d8){if(_0x35b5d8[_0x0c60('0x30')]!==_0x0c60('0x40')){var _0x1cbc0f={};_0x1cbc0f[_0x35b5d8[_0x0c60('0x2b')]]={'$like':'%'+_0x1a63f5[_0x0c60('0x32')]['filter']+'%'};return _0x1cbc0f;}})});}_0x36c579=_['merge']({},_0x36c579,_0x1a63f5[_0x0c60('0x41')]);var _0x3760b8={'where':_0x36c579['where']};return db[_0x0c60('0x2e')][_0x0c60('0x1f')](_0x3760b8)[_0x0c60('0x25')](function(_0x48dc10){_0xfba4d1[_0x0c60('0x1f')]=_0x48dc10;if(_0x1a63f5[_0x0c60('0x32')][_0x0c60('0x42')]){_0x36c579['include']=[{'all':!![]}];}return db[_0x0c60('0x2e')][_0x0c60('0x43')](_0x36c579);})['then'](function(_0x2502f6){_0xfba4d1[_0x0c60('0x44')]=_0x2502f6;return _0xfba4d1;})['then'](respondWithFilteredResult(_0xe27646,_0x36c579))[_0x0c60('0x45')](handleError(_0xe27646,null));};exports['show']=function(_0x40e9ce,_0x8009d){var _0x36d0e3={'raw':![],'where':{'id':_0x40e9ce[_0x0c60('0x46')]['id']}},_0x5cb311={};_0x5cb311[_0x0c60('0x31')]=_[_0x0c60('0x33')](db[_0x0c60('0x2e')]['rawAttributes']);_0x5cb311[_0x0c60('0x32')]=_[_0x0c60('0x33')](_0x40e9ce[_0x0c60('0x32')]);_0x5cb311['filters']=_[_0x0c60('0x35')](_0x5cb311[_0x0c60('0x31')],_0x5cb311['query']);_0x36d0e3[_0x0c60('0x36')]=_[_0x0c60('0x35')](_0x5cb311['model'],qs[_0x0c60('0x37')](_0x40e9ce[_0x0c60('0x32')]['fields']));_0x36d0e3[_0x0c60('0x36')]=_0x36d0e3[_0x0c60('0x36')][_0x0c60('0x38')]?_0x36d0e3[_0x0c60('0x36')]:_0x5cb311[_0x0c60('0x31')];if(_0x40e9ce[_0x0c60('0x32')][_0x0c60('0x42')]){_0x36d0e3[_0x0c60('0x47')]=[{'all':!![]}];}_0x36d0e3=_[_0x0c60('0x48')]({},_0x36d0e3,_0x40e9ce['options']);return db[_0x0c60('0x2e')][_0x0c60('0x49')](_0x36d0e3)[_0x0c60('0x25')](handleEntityNotFound(_0x8009d,null))[_0x0c60('0x25')](respondWithResult(_0x8009d,null))[_0x0c60('0x45')](handleError(_0x8009d,null));};exports[_0x0c60('0x4a')]=function(_0x40c028,_0x2aacf6){return db[_0x0c60('0x2e')][_0x0c60('0x4a')](_0x40c028[_0x0c60('0x4b')],{})[_0x0c60('0x25')](respondWithResult(_0x2aacf6,0xc9))['catch'](handleError(_0x2aacf6,null));};exports[_0x0c60('0x24')]=function(_0x678743,_0x5b1c3a){if(_0x678743['body']['id']){delete _0x678743[_0x0c60('0x4b')]['id'];}return db[_0x0c60('0x2e')]['find']({'where':{'id':_0x678743[_0x0c60('0x46')]['id']}})[_0x0c60('0x25')](handleEntityNotFound(_0x5b1c3a,null))[_0x0c60('0x25')](saveUpdates(_0x678743['body'],null))['then'](respondWithResult(_0x5b1c3a,null))[_0x0c60('0x45')](handleError(_0x5b1c3a,null));};exports[_0x0c60('0x26')]=function(_0x2cfbe8,_0x4ac90f){return db[_0x0c60('0x2e')][_0x0c60('0x49')]({'where':{'id':_0x2cfbe8[_0x0c60('0x46')]['id']}})[_0x0c60('0x25')](handleEntityNotFound(_0x4ac90f,null))[_0x0c60('0x25')](removeEntity(_0x4ac90f,null))['catch'](handleError(_0x4ac90f,null));};exports[_0x0c60('0x4c')]=function(_0x1fdf6b,_0x5b9068,_0x3ff3fc){var _0x213746={};var _0x233d3a={};var _0x306ef1;var _0x2d2ab0;return db['DeskAccount']['findOne']({'where':{'id':_0x1fdf6b['params']['id']}})['then'](handleEntityNotFound(_0x5b9068,null))[_0x0c60('0x25')](function(_0xf3694e){if(_0xf3694e){_0x306ef1=_0xf3694e;_0x233d3a['model']=_[_0x0c60('0x33')](db[_0x0c60('0x4d')][_0x0c60('0x2f')]);_0x233d3a[_0x0c60('0x32')]=_['keys'](_0x1fdf6b[_0x0c60('0x32')]);_0x233d3a[_0x0c60('0x34')]=_[_0x0c60('0x35')](_0x233d3a[_0x0c60('0x31')],_0x233d3a[_0x0c60('0x32')]);_0x213746['attributes']=_[_0x0c60('0x35')](_0x233d3a[_0x0c60('0x31')],qs['fields'](_0x1fdf6b[_0x0c60('0x32')][_0x0c60('0x37')]));_0x213746[_0x0c60('0x36')]=_0x213746[_0x0c60('0x36')][_0x0c60('0x38')]?_0x213746[_0x0c60('0x36')]:_0x233d3a[_0x0c60('0x31')];_0x213746[_0x0c60('0x3b')]=qs[_0x0c60('0x3c')](_0x1fdf6b[_0x0c60('0x32')][_0x0c60('0x3c')]);_0x213746[_0x0c60('0x3d')]=qs[_0x0c60('0x34')](_[_0x0c60('0x3e')](_0x1fdf6b[_0x0c60('0x32')],_0x233d3a[_0x0c60('0x34')]));if(_0x1fdf6b['query'][_0x0c60('0x3f')]){_0x213746[_0x0c60('0x3d')]=_['merge'](_0x213746[_0x0c60('0x3d')],{'$or':_[_0x0c60('0x2d')](_0x213746[_0x0c60('0x36')],function(_0x3b341d){var _0x336928={};_0x336928[_0x3b341d]={'$like':'%'+_0x1fdf6b['query'][_0x0c60('0x3f')]+'%'};return _0x336928;})});}_0x213746=_[_0x0c60('0x48')]({},_0x213746,_0x1fdf6b[_0x0c60('0x41')]);return _0x306ef1[_0x0c60('0x4c')](_0x213746);}})[_0x0c60('0x25')](function(_0x2db7f2){if(_0x2db7f2){_0x2d2ab0=_0x2db7f2[_0x0c60('0x38')];if(!_0x1fdf6b['query']['hasOwnProperty']('nolimit')){_0x213746[_0x0c60('0x1e')]=qs[_0x0c60('0x1e')](_0x1fdf6b['query']['limit']);_0x213746[_0x0c60('0x1c')]=qs['offset'](_0x1fdf6b[_0x0c60('0x32')][_0x0c60('0x1c')]);}return _0x306ef1[_0x0c60('0x4c')](_0x213746);}})[_0x0c60('0x25')](function(_0x18194b){if(_0x18194b){return _0x18194b?{'count':_0x2d2ab0,'rows':_0x18194b}:null;}})[_0x0c60('0x25')](respondWithResult(_0x5b9068,null))[_0x0c60('0x45')](handleError(_0x5b9068,null));};exports[_0x0c60('0x4e')]=function(_0x3a58b8,_0x20ce72,_0x31405d){if(_0x3a58b8['body']['id']){delete _0x3a58b8[_0x0c60('0x4b')]['id'];}return db[_0x0c60('0x2e')][_0x0c60('0x4f')]({'where':{'id':_0x3a58b8[_0x0c60('0x46')]['id']}})[_0x0c60('0x25')](handleEntityNotFound(_0x20ce72,null))['then'](function(_0x575966){if(_0x575966){_0x3a58b8['body']['AccountId']=_0x575966['id'];_0x3a58b8[_0x0c60('0x4b')][_0x0c60('0x50')]=integrations['getSubjects'](_0x3a58b8[_0x0c60('0x4b')][_0x0c60('0x51')],_0x3a58b8[_0x0c60('0x4b')][_0x0c60('0x30')]);_0x3a58b8[_0x0c60('0x4b')]['Descriptions']=integrations[_0x0c60('0x52')](_0x3a58b8[_0x0c60('0x4b')]['channel'],_0x3a58b8[_0x0c60('0x4b')][_0x0c60('0x30')]);return db[_0x0c60('0x4d')]['create'](_0x3a58b8[_0x0c60('0x4b')],{'include':[{'model':db[_0x0c60('0x53')],'as':_0x0c60('0x50')},{'model':db[_0x0c60('0x53')],'as':_0x0c60('0x54')}]});}return null;})[_0x0c60('0x25')](respondWithResult(_0x20ce72,null))[_0x0c60('0x45')](handleError(_0x20ce72,null));};exports[_0x0c60('0x55')]=function(_0x238a2b,_0x13e72f,_0x18a38d){var _0xfa1115=[{'name':_0x0c60('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1e181a='';return db[_0x0c60('0x2e')][_0x0c60('0x4f')]({'where':{'id':_0x238a2b[_0x0c60('0x46')]['id']},'attributes':['id',_0x0c60('0x57'),_0x0c60('0x58'),_0x0c60('0x59'),_0x0c60('0x5a'),'consumerKey',_0x0c60('0x5b'),'token','tokenSecret']})[_0x0c60('0x25')](handleEntityNotFound(_0x13e72f,null))['then'](function(_0x3255d6){if(_0x3255d6){_0x1e181a=_0x3255d6['remoteUri'];var _0x1a8f65=_0x1e181a[_0x0c60('0x5c')](-0x1);if(_0x1a8f65==='/'){_0x1e181a=_0x1e181a[_0x0c60('0x5d')](0x0,_0x1e181a[_0x0c60('0x5e')](_0x1a8f65));}var _0x377728={'method':_0x0c60('0x5f'),'uri':util[_0x0c60('0x60')](_0x0c60('0x61'),_0x1e181a),'headers':{'Content-Type':_0x0c60('0x62'),'Accept':_0x0c60('0x62')},'json':!![]};if(_0x3255d6[_0x0c60('0x58')]===_0x0c60('0x63')){_0x377728[_0x0c60('0x64')][_0x0c60('0x65')]=util[_0x0c60('0x60')](_0x0c60('0x66'),new Buffer(util['format'](_0x0c60('0x67'),_0x3255d6[_0x0c60('0x59')],_0x3255d6[_0x0c60('0x5a')]))[_0x0c60('0x68')]('base64'));}return rp(_0x377728)['then'](function(_0x19387c){return _0xfa1115[_0x0c60('0x69')](_['map'](_0x19387c[_0x0c60('0x6a')][_0x0c60('0x6b')],function(_0x3d3f24){return{'id':_0x3d3f24['name'],'name':_0x3d3f24[_0x0c60('0x2b')],'type':_0x3d3f24['type'],'active':_0x3d3f24['active'],'label':_0x3d3f24[_0x0c60('0x6c')],'custom':!![]};}));});}})['then'](function(_0x3e353f){return{'count':_0x3e353f[_0x0c60('0x38')],'rows':_0x3e353f};})[_0x0c60('0x25')](respondWithResult(_0x13e72f,null))[_0x0c60('0x45')](function(_0x4a239f){var _0x2f6cb3=_0x238a2b[_0x0c60('0x32')][_0x0c60('0x6d')]?0x1f4:_0x4a239f[_0x0c60('0x6e')]||0x1f4;logger[_0x0c60('0x29')](_0x0c60('0x6f'),_0x0c60('0x55'),_0x2f6cb3,JSON[_0x0c60('0x70')](_0x4a239f));delete _0x4a239f[_0x0c60('0x2b')];if(_0x2f6cb3===0x191){_0x2f6cb3=0x190;}_0x13e72f[_0x0c60('0x1a')](_0x2f6cb3)['send'](_0x238a2b['query'][_0x0c60('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x4a239f['statusCode']}:_0x4a239f);});}; \ No newline at end of file +var _0x5d63=['_embedded','active','label','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','error','name','send','index','DeskAccount','fieldName','type','model','map','query','keys','filters','intersection','attributes','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','length','options','create','body','find','destroy','getConfigurations','findOne','DeskConfiguration','rawAttributes','fields','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','token','tokenSecret','GET','format','basic','headers','Basic\x20%s','%s:%s','password','toString','concat'];(function(_0x2daef6,_0xcac228){var _0x62d030=function(_0x26a7d6){while(--_0x26a7d6){_0x2daef6['push'](_0x2daef6['shift']());}};_0x62d030(++_0xcac228);}(_0x5d63,0x70));var _0x35d6=function(_0x4edea8,_0x195f39){_0x4edea8=_0x4edea8-0x0;var _0x2068aa=_0x5d63[_0x4edea8];return _0x2068aa;};'use strict';var emlformat=require(_0x35d6('0x0'));var rimraf=require(_0x35d6('0x1'));var zipdir=require(_0x35d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35d6('0x3'));var moment=require('moment');var BPromise=require(_0x35d6('0x4'));var Mustache=require('mustache');var util=require(_0x35d6('0x5'));var path=require(_0x35d6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x35d6('0x7'));var _=require(_0x35d6('0x8'));var squel=require(_0x35d6('0x9'));var crypto=require(_0x35d6('0xa'));var jsforce=require(_0x35d6('0xb'));var deskjs=require(_0x35d6('0xc'));var toCsv=require(_0x35d6('0xd'));var querystring=require(_0x35d6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35d6('0xf'));var qs=require(_0x35d6('0x10'));var as=require(_0x35d6('0x11'));var hardwareService=require(_0x35d6('0x12'));var logger=require(_0x35d6('0x13'))('api');var utils=require(_0x35d6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x35d6('0x15'));var db=require(_0x35d6('0x16'))['db'];var integrations=require(_0x35d6('0x17'));function respondWithStatusCode(_0x682818,_0x3fd7cb){_0x3fd7cb=_0x3fd7cb||0xcc;return function(_0x4e9da1){if(_0x4e9da1){return _0x682818[_0x35d6('0x18')](_0x3fd7cb);}return _0x682818[_0x35d6('0x19')](_0x3fd7cb)[_0x35d6('0x1a')]();};}function respondWithResult(_0x4843b7,_0x570b68){_0x570b68=_0x570b68||0xc8;return function(_0x14a6ba){if(_0x14a6ba){return _0x4843b7[_0x35d6('0x19')](_0x570b68)[_0x35d6('0x1b')](_0x14a6ba);}};}function respondWithFilteredResult(_0x1647e0,_0x453a82){return function(_0x44f309){if(_0x44f309){var _0x42321a=typeof _0x453a82[_0x35d6('0x1c')]===_0x35d6('0x1d')&&typeof _0x453a82[_0x35d6('0x1e')]===_0x35d6('0x1d');var _0x4a3f4c=_0x44f309['count'];var _0x2a459b=_0x42321a?0x0:_0x453a82[_0x35d6('0x1c')];var _0x42c2de=_0x42321a?_0x44f309[_0x35d6('0x1f')]:_0x453a82['offset']+_0x453a82[_0x35d6('0x1e')];var _0x12a98a;if(_0x42c2de>=_0x4a3f4c){_0x42c2de=_0x4a3f4c;_0x12a98a=0xc8;}else{_0x12a98a=0xce;}_0x1647e0[_0x35d6('0x19')](_0x12a98a);return _0x1647e0['set']('Content-Range',_0x2a459b+'-'+_0x42c2de+'/'+_0x4a3f4c)[_0x35d6('0x1b')](_0x44f309);}return null;};}function patchUpdates(_0x4dcf0b){return function(_0x5a18a6){try{jsonpatch[_0x35d6('0x20')](_0x5a18a6,_0x4dcf0b,!![]);}catch(_0x24d33d){return BPromise[_0x35d6('0x21')](_0x24d33d);}return _0x5a18a6[_0x35d6('0x22')]();};}function saveUpdates(_0x26d10f,_0x209a58){return function(_0x16f3dd){if(_0x16f3dd){return _0x16f3dd[_0x35d6('0x23')](_0x26d10f)[_0x35d6('0x24')](function(_0x3b2c62){return _0x3b2c62;});}return null;};}function removeEntity(_0x42fa8c,_0x5bcf4a){return function(_0x174499){if(_0x174499){return _0x174499['destroy']()[_0x35d6('0x24')](function(){_0x42fa8c[_0x35d6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4802d0,_0x4088e4){return function(_0x2b9e7f){if(!_0x2b9e7f){_0x4802d0['sendStatus'](0x194);}return _0x2b9e7f;};}function handleError(_0x484600,_0x42f92b){_0x42f92b=_0x42f92b||0x1f4;return function(_0x46fa7a){logger[_0x35d6('0x25')](_0x46fa7a['stack']);if(_0x46fa7a[_0x35d6('0x26')]){delete _0x46fa7a['name'];}_0x484600[_0x35d6('0x19')](_0x42f92b)[_0x35d6('0x27')](_0x46fa7a);};}exports[_0x35d6('0x28')]=function(_0x51cc70,_0x5a2f4f){var _0x4f9aa4={},_0x4a3368={},_0x1bf415={'count':0x0,'rows':[]};var _0x2394b5=_['map'](db[_0x35d6('0x29')]['rawAttributes'],function(_0x14fefa){return{'name':_0x14fefa[_0x35d6('0x2a')],'type':_0x14fefa[_0x35d6('0x2b')]['key']};});_0x4a3368[_0x35d6('0x2c')]=_[_0x35d6('0x2d')](_0x2394b5,_0x35d6('0x26'));_0x4a3368[_0x35d6('0x2e')]=_[_0x35d6('0x2f')](_0x51cc70[_0x35d6('0x2e')]);_0x4a3368[_0x35d6('0x30')]=_[_0x35d6('0x31')](_0x4a3368[_0x35d6('0x2c')],_0x4a3368[_0x35d6('0x2e')]);_0x4f9aa4[_0x35d6('0x32')]=_[_0x35d6('0x31')](_0x4a3368[_0x35d6('0x2c')],qs['fields'](_0x51cc70[_0x35d6('0x2e')]['fields']));_0x4f9aa4[_0x35d6('0x32')]=_0x4f9aa4['attributes']['length']?_0x4f9aa4[_0x35d6('0x32')]:_0x4a3368[_0x35d6('0x2c')];if(!_0x51cc70[_0x35d6('0x2e')]['hasOwnProperty']('nolimit')){_0x4f9aa4[_0x35d6('0x1e')]=qs[_0x35d6('0x1e')](_0x51cc70['query'][_0x35d6('0x1e')]);_0x4f9aa4['offset']=qs[_0x35d6('0x1c')](_0x51cc70['query'][_0x35d6('0x1c')]);}_0x4f9aa4[_0x35d6('0x33')]=qs['sort'](_0x51cc70[_0x35d6('0x2e')][_0x35d6('0x34')]);_0x4f9aa4[_0x35d6('0x35')]=qs[_0x35d6('0x30')](_['pick'](_0x51cc70[_0x35d6('0x2e')],_0x4a3368[_0x35d6('0x30')]),_0x2394b5);if(_0x51cc70[_0x35d6('0x2e')][_0x35d6('0x36')]){_0x4f9aa4['where']=_['merge'](_0x4f9aa4['where'],{'$or':_[_0x35d6('0x2d')](_0x2394b5,function(_0x594b58){if(_0x594b58[_0x35d6('0x2b')]!=='VIRTUAL'){var _0x23a893={};_0x23a893[_0x594b58[_0x35d6('0x26')]]={'$like':'%'+_0x51cc70[_0x35d6('0x2e')][_0x35d6('0x36')]+'%'};return _0x23a893;}})});}_0x4f9aa4=_[_0x35d6('0x37')]({},_0x4f9aa4,_0x51cc70['options']);var _0xe07d16={'where':_0x4f9aa4[_0x35d6('0x35')]};return db[_0x35d6('0x29')][_0x35d6('0x1f')](_0xe07d16)[_0x35d6('0x24')](function(_0xf29e88){_0x1bf415[_0x35d6('0x1f')]=_0xf29e88;if(_0x51cc70[_0x35d6('0x2e')][_0x35d6('0x38')]){_0x4f9aa4['include']=[{'all':!![]}];}return db[_0x35d6('0x29')][_0x35d6('0x39')](_0x4f9aa4);})[_0x35d6('0x24')](function(_0x327478){_0x1bf415[_0x35d6('0x3a')]=_0x327478;return _0x1bf415;})[_0x35d6('0x24')](respondWithFilteredResult(_0x5a2f4f,_0x4f9aa4))[_0x35d6('0x3b')](handleError(_0x5a2f4f,null));};exports[_0x35d6('0x3c')]=function(_0x5d7c52,_0x198ea1){var _0x3a2f04={'raw':![],'where':{'id':_0x5d7c52[_0x35d6('0x3d')]['id']}},_0x2e1e98={};_0x2e1e98['model']=_[_0x35d6('0x2f')](db[_0x35d6('0x29')]['rawAttributes']);_0x2e1e98['query']=_[_0x35d6('0x2f')](_0x5d7c52['query']);_0x2e1e98[_0x35d6('0x30')]=_[_0x35d6('0x31')](_0x2e1e98[_0x35d6('0x2c')],_0x2e1e98[_0x35d6('0x2e')]);_0x3a2f04['attributes']=_['intersection'](_0x2e1e98[_0x35d6('0x2c')],qs['fields'](_0x5d7c52[_0x35d6('0x2e')]['fields']));_0x3a2f04['attributes']=_0x3a2f04['attributes'][_0x35d6('0x3e')]?_0x3a2f04['attributes']:_0x2e1e98[_0x35d6('0x2c')];if(_0x5d7c52['query']['includeAll']){_0x3a2f04['include']=[{'all':!![]}];}_0x3a2f04=_[_0x35d6('0x37')]({},_0x3a2f04,_0x5d7c52[_0x35d6('0x3f')]);return db[_0x35d6('0x29')]['find'](_0x3a2f04)['then'](handleEntityNotFound(_0x198ea1,null))[_0x35d6('0x24')](respondWithResult(_0x198ea1,null))[_0x35d6('0x3b')](handleError(_0x198ea1,null));};exports['create']=function(_0x704106,_0x2c5f3c){return db[_0x35d6('0x29')][_0x35d6('0x40')](_0x704106[_0x35d6('0x41')],{})[_0x35d6('0x24')](respondWithResult(_0x2c5f3c,0xc9))[_0x35d6('0x3b')](handleError(_0x2c5f3c,null));};exports['update']=function(_0x38fe3e,_0x254204){if(_0x38fe3e[_0x35d6('0x41')]['id']){delete _0x38fe3e[_0x35d6('0x41')]['id'];}return db['DeskAccount'][_0x35d6('0x42')]({'where':{'id':_0x38fe3e[_0x35d6('0x3d')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x254204,null))[_0x35d6('0x24')](saveUpdates(_0x38fe3e[_0x35d6('0x41')],null))[_0x35d6('0x24')](respondWithResult(_0x254204,null))[_0x35d6('0x3b')](handleError(_0x254204,null));};exports[_0x35d6('0x43')]=function(_0x3e2cf2,_0xabf7a8){return db[_0x35d6('0x29')][_0x35d6('0x42')]({'where':{'id':_0x3e2cf2['params']['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0xabf7a8,null))[_0x35d6('0x24')](removeEntity(_0xabf7a8,null))[_0x35d6('0x3b')](handleError(_0xabf7a8,null));};exports[_0x35d6('0x44')]=function(_0x2a444f,_0xdae71b,_0x54fe97){var _0x2dab63={};var _0x172a17={};var _0x48cdc8;var _0x5885c7;return db[_0x35d6('0x29')][_0x35d6('0x45')]({'where':{'id':_0x2a444f[_0x35d6('0x3d')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0xdae71b,null))[_0x35d6('0x24')](function(_0x3c2d2f){if(_0x3c2d2f){_0x48cdc8=_0x3c2d2f;_0x172a17['model']=_[_0x35d6('0x2f')](db[_0x35d6('0x46')][_0x35d6('0x47')]);_0x172a17['query']=_[_0x35d6('0x2f')](_0x2a444f[_0x35d6('0x2e')]);_0x172a17[_0x35d6('0x30')]=_['intersection'](_0x172a17[_0x35d6('0x2c')],_0x172a17[_0x35d6('0x2e')]);_0x2dab63['attributes']=_[_0x35d6('0x31')](_0x172a17['model'],qs[_0x35d6('0x48')](_0x2a444f[_0x35d6('0x2e')][_0x35d6('0x48')]));_0x2dab63[_0x35d6('0x32')]=_0x2dab63['attributes']['length']?_0x2dab63[_0x35d6('0x32')]:_0x172a17[_0x35d6('0x2c')];_0x2dab63[_0x35d6('0x33')]=qs[_0x35d6('0x34')](_0x2a444f['query'][_0x35d6('0x34')]);_0x2dab63[_0x35d6('0x35')]=qs[_0x35d6('0x30')](_['pick'](_0x2a444f[_0x35d6('0x2e')],_0x172a17[_0x35d6('0x30')]));if(_0x2a444f[_0x35d6('0x2e')]['filter']){_0x2dab63[_0x35d6('0x35')]=_[_0x35d6('0x37')](_0x2dab63[_0x35d6('0x35')],{'$or':_[_0x35d6('0x2d')](_0x2dab63['attributes'],function(_0xc1a912){var _0x1ca168={};_0x1ca168[_0xc1a912]={'$like':'%'+_0x2a444f[_0x35d6('0x2e')]['filter']+'%'};return _0x1ca168;})});}_0x2dab63=_[_0x35d6('0x37')]({},_0x2dab63,_0x2a444f[_0x35d6('0x3f')]);return _0x48cdc8[_0x35d6('0x44')](_0x2dab63);}})['then'](function(_0x124115){if(_0x124115){_0x5885c7=_0x124115[_0x35d6('0x3e')];if(!_0x2a444f[_0x35d6('0x2e')][_0x35d6('0x49')]('nolimit')){_0x2dab63[_0x35d6('0x1e')]=qs['limit'](_0x2a444f[_0x35d6('0x2e')][_0x35d6('0x1e')]);_0x2dab63[_0x35d6('0x1c')]=qs['offset'](_0x2a444f[_0x35d6('0x2e')][_0x35d6('0x1c')]);}return _0x48cdc8[_0x35d6('0x44')](_0x2dab63);}})['then'](function(_0x478580){if(_0x478580){return _0x478580?{'count':_0x5885c7,'rows':_0x478580}:null;}})['then'](respondWithResult(_0xdae71b,null))['catch'](handleError(_0xdae71b,null));};exports[_0x35d6('0x4a')]=function(_0x352035,_0x16ee6c,_0x5df8bd){if(_0x352035[_0x35d6('0x41')]['id']){delete _0x352035[_0x35d6('0x41')]['id'];}return db[_0x35d6('0x29')][_0x35d6('0x45')]({'where':{'id':_0x352035[_0x35d6('0x3d')]['id']}})[_0x35d6('0x24')](handleEntityNotFound(_0x16ee6c,null))[_0x35d6('0x24')](function(_0x1e6bfd){if(_0x1e6bfd){_0x352035[_0x35d6('0x41')][_0x35d6('0x4b')]=_0x1e6bfd['id'];_0x352035[_0x35d6('0x41')][_0x35d6('0x4c')]=integrations['getSubjects'](_0x352035[_0x35d6('0x41')][_0x35d6('0x4d')],_0x352035[_0x35d6('0x41')][_0x35d6('0x2b')]);_0x352035[_0x35d6('0x41')][_0x35d6('0x4e')]=integrations[_0x35d6('0x4f')](_0x352035[_0x35d6('0x41')][_0x35d6('0x4d')],_0x352035[_0x35d6('0x41')]['type']);return db[_0x35d6('0x46')][_0x35d6('0x40')](_0x352035['body'],{'include':[{'model':db[_0x35d6('0x50')],'as':_0x35d6('0x4c')},{'model':db['DeskField'],'as':_0x35d6('0x4e')}]});}return null;})[_0x35d6('0x24')](respondWithResult(_0x16ee6c,null))[_0x35d6('0x3b')](handleError(_0x16ee6c,null));};exports[_0x35d6('0x51')]=function(_0x401dab,_0x4efb21,_0x3cb3d3){var _0x4d6120=[{'name':_0x35d6('0x52'),'label':_0x35d6('0x52'),'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 _0x5d7422='';return db['DeskAccount']['findOne']({'where':{'id':_0x401dab['params']['id']},'attributes':['id',_0x35d6('0x53'),_0x35d6('0x54'),_0x35d6('0x55'),'password',_0x35d6('0x56'),'consumerSecret',_0x35d6('0x57'),_0x35d6('0x58')]})[_0x35d6('0x24')](handleEntityNotFound(_0x4efb21,null))[_0x35d6('0x24')](function(_0x542703){if(_0x542703){_0x5d7422=_0x542703[_0x35d6('0x53')];var _0x3ae585=_0x5d7422['slice'](-0x1);if(_0x3ae585==='/'){_0x5d7422=_0x5d7422['substring'](0x0,_0x5d7422['lastIndexOf'](_0x3ae585));}var _0x58d2b9={'method':_0x35d6('0x59'),'uri':util[_0x35d6('0x5a')]('%s/custom_fields',_0x5d7422),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x542703[_0x35d6('0x54')]===_0x35d6('0x5b')){_0x58d2b9[_0x35d6('0x5c')]['Authorization']=util[_0x35d6('0x5a')](_0x35d6('0x5d'),new Buffer(util[_0x35d6('0x5a')](_0x35d6('0x5e'),_0x542703[_0x35d6('0x55')],_0x542703[_0x35d6('0x5f')]))[_0x35d6('0x60')]('base64'));}return rp(_0x58d2b9)['then'](function(_0x19693d){return _0x4d6120[_0x35d6('0x61')](_[_0x35d6('0x2d')](_0x19693d[_0x35d6('0x62')]['entries'],function(_0x580875){return{'id':_0x580875[_0x35d6('0x26')],'name':_0x580875[_0x35d6('0x26')],'type':_0x580875[_0x35d6('0x2b')],'active':_0x580875[_0x35d6('0x63')],'label':_0x580875[_0x35d6('0x64')],'custom':!![]};}));});}})[_0x35d6('0x24')](function(_0x183e67){return{'count':_0x183e67[_0x35d6('0x3e')],'rows':_0x183e67};})[_0x35d6('0x24')](respondWithResult(_0x4efb21,null))[_0x35d6('0x3b')](function(_0x345def){var _0x56e124=_0x401dab[_0x35d6('0x2e')][_0x35d6('0x65')]?0x1f4:_0x345def[_0x35d6('0x66')]||0x1f4;logger[_0x35d6('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x35d6('0x51'),_0x56e124,JSON[_0x35d6('0x67')](_0x345def));delete _0x345def[_0x35d6('0x26')];if(_0x56e124===0x191){_0x56e124=0x190;}_0x4efb21[_0x35d6('0x19')](_0x56e124)[_0x35d6('0x27')](_0x401dab[_0x35d6('0x2e')][_0x35d6('0x65')]?{'message':_0x35d6('0x68'),'statusCode':_0x345def['statusCode']}:_0x345def);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 178642f..6551703 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 _0x3497=['DeskAccount','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x36a997,_0x288f0b){var _0x561b1b=function(_0x8ed5bb){while(--_0x8ed5bb){_0x36a997['push'](_0x36a997['shift']());}};_0x561b1b(++_0x288f0b);}(_0x3497,0x8d));var _0x7349=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0x3497[_0x5aa373];return _0x590e8e;};'use strict';var _=require(_0x7349('0x0'));var util=require('util');var logger=require(_0x7349('0x1'))(_0x7349('0x2'));var moment=require('moment');var BPromise=require(_0x7349('0x3'));var rp=require(_0x7349('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7349('0x5'));var config=require(_0x7349('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7349('0x7'));module['exports']=function(_0x3702c6,_0x45b2c7){return _0x3702c6[_0x7349('0x8')](_0x7349('0x9'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9457=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9457,0x1df));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7945('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7945('0x1'));var BPromise=require(_0x7945('0x2'));var rp=require(_0x7945('0x3'));var fs=require('fs');var path=require(_0x7945('0x4'));var rimraf=require(_0x7945('0x5'));var config=require(_0x7945('0x6'));var attributes=require(_0x7945('0x7'));var integrations=require(_0x7945('0x8'));module[_0x7945('0x9')]=function(_0x308b1c,_0x54cf21){return _0x308b1c[_0x7945('0xa')](_0x7945('0xb'),attributes,{'tableName':_0x7945('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 67bea9b..1cf9d9a 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 _0x545c=['include','map','model','then','catch','ShowDeskAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','GetDeskAccount','DeskAccount','findAll','options','attributes','limit'];(function(_0xdb160e,_0x2171e0){var _0x1faba1=function(_0x3eab6e){while(--_0x3eab6e){_0xdb160e['push'](_0xdb160e['shift']());}};_0x1faba1(++_0x2171e0);}(_0x545c,0x87));var _0xc545=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x545c[_0x4d8666];return _0x37175b;};'use strict';var _=require(_0xc545('0x0'));var util=require('util');var moment=require(_0xc545('0x1'));var BPromise=require(_0xc545('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc545('0x3'));var db=require(_0xc545('0x4'))['db'];var utils=require(_0xc545('0x5'));var logger=require(_0xc545('0x6'))(_0xc545('0x7'));var config=require(_0xc545('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc545('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a4b9e,_0x3b29b4,_0x321a24){return new BPromise(function(_0x5c70c0,_0x587cea){return client[_0xc545('0xa')](_0x1a4b9e,_0x321a24)['then'](function(_0x2a3fce){logger[_0xc545('0xb')]('DeskAccount,\x20%s,\x20%s',_0x3b29b4,_0xc545('0xc'));logger[_0xc545('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3b29b4,_0xc545('0xc'),JSON[_0xc545('0xe')](_0x2a3fce));if(_0x2a3fce[_0xc545('0xf')]){if(_0x2a3fce[_0xc545('0xf')][_0xc545('0x10')]===0x1f4){logger[_0xc545('0xf')](_0xc545('0x11'),_0x3b29b4,_0x2a3fce[_0xc545('0xf')]['message']);return _0x587cea(_0x2a3fce[_0xc545('0xf')][_0xc545('0x12')]);}logger[_0xc545('0xf')]('DeskAccount,\x20%s,\x20%s',_0x3b29b4,_0x2a3fce[_0xc545('0xf')][_0xc545('0x12')]);return _0x5c70c0(_0x2a3fce['error']['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3b29b4,'request\x20sent');_0x5c70c0(_0x2a3fce['result'][_0xc545('0x12')]);}})['catch'](function(_0xbb80b6){logger[_0xc545('0xf')](_0xc545('0x11'),_0x3b29b4,_0xbb80b6);_0x587cea(_0xbb80b6);});});}exports[_0xc545('0x13')]=function(_0x35c776){var _0x47e703=this;return new Promise(function(_0x8fa465,_0x3d6ac7){return db[_0xc545('0x14')][_0xc545('0x15')]({'raw':_0x35c776[_0xc545('0x16')]?_0x35c776[_0xc545('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x35c776['options']?_0x35c776[_0xc545('0x16')]['where']||null:null,'attributes':_0x35c776[_0xc545('0x16')]?_0x35c776['options'][_0xc545('0x17')]||null:null,'limit':_0x35c776[_0xc545('0x16')]?_0x35c776['options'][_0xc545('0x18')]||null:null,'include':_0x35c776['options']?_0x35c776[_0xc545('0x16')][_0xc545('0x19')]?_[_0xc545('0x1a')](_0x35c776['options'][_0xc545('0x19')],function(_0x10d8d3){return{'model':db[_0x10d8d3[_0xc545('0x1b')]],'as':_0x10d8d3['as'],'attributes':_0x10d8d3['attributes'],'include':_0x10d8d3[_0xc545('0x19')]?_[_0xc545('0x1a')](_0x10d8d3[_0xc545('0x19')],function(_0x53e3f0){return{'model':db[_0x53e3f0[_0xc545('0x1b')]],'as':_0x53e3f0['as'],'attributes':_0x53e3f0['attributes'],'include':_0x53e3f0['include']?_[_0xc545('0x1a')](_0x53e3f0[_0xc545('0x19')],function(_0x20206b){return{'model':db[_0x20206b[_0xc545('0x1b')]],'as':_0x20206b['as'],'attributes':_0x20206b[_0xc545('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc545('0x1c')](function(_0x487d96){logger[_0xc545('0xb')](_0xc545('0x13'),_0x35c776);logger[_0xc545('0xd')]('GetDeskAccount',_0x35c776,JSON[_0xc545('0xe')](_0x487d96));_0x8fa465(_0x487d96);})[_0xc545('0x1d')](function(_0x1ef2f2){logger[_0xc545('0xf')](_0xc545('0x13'),_0x1ef2f2[_0xc545('0x12')],_0x35c776);_0x3d6ac7(_0x47e703[_0xc545('0xf')](0x1f4,_0x1ef2f2['message']));});});};exports[_0xc545('0x1e')]=function(_0x426e43){var _0x5edbcb=this;return new Promise(function(_0x45aa5c,_0x56ce7b){return db[_0xc545('0x14')][_0xc545('0x1f')]({'raw':_0x426e43[_0xc545('0x16')]?_0x426e43['options']['raw']===undefined?!![]:![]:!![],'where':_0x426e43['options']?_0x426e43[_0xc545('0x16')]['where']||null:null,'attributes':_0x426e43[_0xc545('0x16')]?_0x426e43[_0xc545('0x16')][_0xc545('0x17')]||null:null,'include':_0x426e43[_0xc545('0x16')]?_0x426e43[_0xc545('0x16')][_0xc545('0x19')]?_[_0xc545('0x1a')](_0x426e43[_0xc545('0x16')][_0xc545('0x19')],function(_0x31fd43){return{'model':db[_0x31fd43[_0xc545('0x1b')]],'as':_0x31fd43['as'],'attributes':_0x31fd43[_0xc545('0x17')],'include':_0x31fd43[_0xc545('0x19')]?_['map'](_0x31fd43[_0xc545('0x19')],function(_0x3bdf14){return{'model':db[_0x3bdf14[_0xc545('0x1b')]],'as':_0x3bdf14['as'],'attributes':_0x3bdf14[_0xc545('0x17')],'include':_0x3bdf14[_0xc545('0x19')]?_[_0xc545('0x1a')](_0x3bdf14[_0xc545('0x19')],function(_0x3e43ed){return{'model':db[_0x3e43ed['model']],'as':_0x3e43ed['as'],'attributes':_0x3e43ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xea3435){logger[_0xc545('0xb')](_0xc545('0x1e'),_0x426e43);logger[_0xc545('0xd')](_0xc545('0x1e'),_0x426e43,JSON[_0xc545('0xe')](_0xea3435));_0x45aa5c(_0xea3435);})[_0xc545('0x1d')](function(_0xb05288){logger[_0xc545('0xf')]('ShowDeskAccount',_0xb05288[_0xc545('0x12')],_0x426e43);_0x56ce7b(_0x5edbcb[_0xc545('0xf')](0x1f4,_0xb05288['message']));});});}; \ No newline at end of file +var _0x9991=['code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','attributes','limit','include','map','model','stringify','ShowDeskAccount','find','raw','where','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x4c2094,_0x2254c4){var _0x27b16e=function(_0x69acbc){while(--_0x69acbc){_0x4c2094['push'](_0x4c2094['shift']());}};_0x27b16e(++_0x2254c4);}(_0x9991,0xc7));var _0x1999=function(_0x1a81ee,_0x6e9de2){_0x1a81ee=_0x1a81ee-0x0;var _0x361281=_0x9991[_0x1a81ee];return _0x361281;};'use strict';var _=require(_0x1999('0x0'));var util=require(_0x1999('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1999('0x2'));var fs=require('fs');var Redis=require(_0x1999('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1999('0x4'));var logger=require('../../config/logger')(_0x1999('0x5'));var config=require(_0x1999('0x6'));var jayson=require(_0x1999('0x7'));var client=jayson[_0x1999('0x8')][_0x1999('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26202d,_0x4c6bca,_0x5883b8){return new BPromise(function(_0x33af1a,_0x13a943){return client[_0x1999('0xa')](_0x26202d,_0x5883b8)[_0x1999('0xb')](function(_0x120be7){logger[_0x1999('0xc')]('DeskAccount,\x20%s,\x20%s',_0x4c6bca,_0x1999('0xd'));logger[_0x1999('0xe')](_0x1999('0xf'),_0x4c6bca,_0x1999('0xd'),JSON['stringify'](_0x120be7));if(_0x120be7['error']){if(_0x120be7[_0x1999('0x10')][_0x1999('0x11')]===0x1f4){logger['error'](_0x1999('0x12'),_0x4c6bca,_0x120be7[_0x1999('0x10')][_0x1999('0x13')]);return _0x13a943(_0x120be7[_0x1999('0x10')][_0x1999('0x13')]);}logger[_0x1999('0x10')](_0x1999('0x12'),_0x4c6bca,_0x120be7[_0x1999('0x10')][_0x1999('0x13')]);return _0x33af1a(_0x120be7[_0x1999('0x10')][_0x1999('0x13')]);}else{logger[_0x1999('0xc')](_0x1999('0x12'),_0x4c6bca,'request\x20sent');_0x33af1a(_0x120be7[_0x1999('0x14')][_0x1999('0x13')]);}})[_0x1999('0x15')](function(_0x78640e){logger['error'](_0x1999('0x12'),_0x4c6bca,_0x78640e);_0x13a943(_0x78640e);});});}exports[_0x1999('0x16')]=function(_0x5dd9e8){var _0x5c7f6e=this;return new Promise(function(_0xaeb325,_0x2518eb){return db[_0x1999('0x17')][_0x1999('0x18')]({'raw':_0x5dd9e8[_0x1999('0x19')]?_0x5dd9e8[_0x1999('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5dd9e8['options']?_0x5dd9e8[_0x1999('0x19')]['where']||null:null,'attributes':_0x5dd9e8[_0x1999('0x19')]?_0x5dd9e8[_0x1999('0x19')][_0x1999('0x1a')]||null:null,'limit':_0x5dd9e8[_0x1999('0x19')]?_0x5dd9e8[_0x1999('0x19')][_0x1999('0x1b')]||null:null,'include':_0x5dd9e8[_0x1999('0x19')]?_0x5dd9e8['options'][_0x1999('0x1c')]?_[_0x1999('0x1d')](_0x5dd9e8[_0x1999('0x19')][_0x1999('0x1c')],function(_0x5d0be3){return{'model':db[_0x5d0be3[_0x1999('0x1e')]],'as':_0x5d0be3['as'],'attributes':_0x5d0be3['attributes'],'include':_0x5d0be3[_0x1999('0x1c')]?_[_0x1999('0x1d')](_0x5d0be3[_0x1999('0x1c')],function(_0xd7c5c9){return{'model':db[_0xd7c5c9[_0x1999('0x1e')]],'as':_0xd7c5c9['as'],'attributes':_0xd7c5c9[_0x1999('0x1a')],'include':_0xd7c5c9['include']?_[_0x1999('0x1d')](_0xd7c5c9[_0x1999('0x1c')],function(_0x5f35bc){return{'model':db[_0x5f35bc[_0x1999('0x1e')]],'as':_0x5f35bc['as'],'attributes':_0x5f35bc[_0x1999('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1999('0xb')](function(_0x510cad){logger[_0x1999('0xc')](_0x1999('0x16'),_0x5dd9e8);logger[_0x1999('0xe')](_0x1999('0x16'),_0x5dd9e8,JSON[_0x1999('0x1f')](_0x510cad));_0xaeb325(_0x510cad);})['catch'](function(_0x5ef1c1){logger['error'](_0x1999('0x16'),_0x5ef1c1['message'],_0x5dd9e8);_0x2518eb(_0x5c7f6e['error'](0x1f4,_0x5ef1c1['message']));});});};exports[_0x1999('0x20')]=function(_0x2c2809){var _0x490602=this;return new Promise(function(_0x4c4350,_0x19e38c){return db[_0x1999('0x17')][_0x1999('0x21')]({'raw':_0x2c2809[_0x1999('0x19')]?_0x2c2809['options'][_0x1999('0x22')]===undefined?!![]:![]:!![],'where':_0x2c2809['options']?_0x2c2809[_0x1999('0x19')][_0x1999('0x23')]||null:null,'attributes':_0x2c2809[_0x1999('0x19')]?_0x2c2809[_0x1999('0x19')][_0x1999('0x1a')]||null:null,'include':_0x2c2809[_0x1999('0x19')]?_0x2c2809[_0x1999('0x19')][_0x1999('0x1c')]?_[_0x1999('0x1d')](_0x2c2809['options'][_0x1999('0x1c')],function(_0x96a929){return{'model':db[_0x96a929[_0x1999('0x1e')]],'as':_0x96a929['as'],'attributes':_0x96a929['attributes'],'include':_0x96a929[_0x1999('0x1c')]?_[_0x1999('0x1d')](_0x96a929[_0x1999('0x1c')],function(_0x6b46e4){return{'model':db[_0x6b46e4[_0x1999('0x1e')]],'as':_0x6b46e4['as'],'attributes':_0x6b46e4[_0x1999('0x1a')],'include':_0x6b46e4[_0x1999('0x1c')]?_['map'](_0x6b46e4[_0x1999('0x1c')],function(_0x40b04d){return{'model':db[_0x40b04d[_0x1999('0x1e')]],'as':_0x40b04d['as'],'attributes':_0x40b04d['attributes']};}):[]};}):[]};}):[]:[]})[_0x1999('0xb')](function(_0x59875a){logger[_0x1999('0xc')]('ShowDeskAccount',_0x2c2809);logger['debug']('ShowDeskAccount',_0x2c2809,JSON['stringify'](_0x59875a));_0x4c4350(_0x59875a);})[_0x1999('0x15')](function(_0x4babd4){logger[_0x1999('0x10')](_0x1999('0x20'),_0x4babd4[_0x1999('0x13')],_0x2c2809);_0x19e38c(_0x490602[_0x1999('0x10')](0x1f4,_0x4babd4['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5ce3354..f511ac7 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x55ca,0x126));var _0xa55c=function(_0x33f2fa,_0x1411d5){_0x33f2fa=_0x33f2fa-0x0;var _0xe5b3b3=_0x55ca[_0x33f2fa];return _0xe5b3b3;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);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['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=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(_0x3e41b8,_0x3f1334){var _0x198680=function(_0x17b297){while(--_0x17b297){_0x3e41b8['push'](_0x3e41b8['shift']());}};_0x198680(++_0x3f1334);}(_0xedd9,0xfc));var _0x9edd=function(_0x67b3d5,_0x44f9ae){_0x67b3d5=_0x67b3d5-0x0;var _0x44a51b=_0xedd9[_0x67b3d5];return _0x44a51b;};'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 90f62a7..f5deef9 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 _0x8f29=['STRING'];(function(_0x5a51d7,_0x4d332c){var _0x254676=function(_0x2344d1){while(--_0x2344d1){_0x5a51d7['push'](_0x5a51d7['shift']());}};_0x254676(++_0x4d332c);}(_0x8f29,0xa9));var _0x98f2=function(_0x28c0a2,_0x261333){_0x28c0a2=_0x28c0a2-0x0;var _0x235b4c=_0x8f29[_0x28c0a2];return _0x235b4c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x98f2('0x0')]},'description':{'type':Sequelize[_0x98f2('0x0')]}}; \ No newline at end of file +var _0x54fc=['sequelize','exports','STRING'];(function(_0x56c910,_0x30a323){var _0x3fe915=function(_0x1e8276){while(--_0x1e8276){_0x56c910['push'](_0x56c910['shift']());}};_0x3fe915(++_0x30a323);}(_0x54fc,0x1b6));var _0xc54f=function(_0x6873bf,_0x572006){_0x6873bf=_0x6873bf-0x0;var _0xd22a86=_0x54fc[_0x6873bf];return _0xd22a86;};'use strict';var Sequelize=require(_0xc54f('0x0'));module[_0xc54f('0x1')]={'name':{'type':Sequelize[_0xc54f('0x2')]},'description':{'type':Sequelize[_0xc54f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index a11f58d..bc0a89a 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 _0x4637=['Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','apply','reject','update','then','destroy','stack','send','DeskConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','rows','show','include','find','create','body','catch','params','getFields','findOne','DeskField','order','getSubjects','getDescriptions'];(function(_0x5f396f,_0x17f585){var _0x467268=function(_0x284584){while(--_0x284584){_0x5f396f['push'](_0x5f396f['shift']());}};_0x467268(++_0x17f585);}(_0x4637,0x1a3));var _0x7463=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x4637[_0xf50820];return _0x2a9b10;};'use strict';var emlformat=require(_0x7463('0x0'));var rimraf=require(_0x7463('0x1'));var zipdir=require(_0x7463('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7463('0x3'));var moment=require('moment');var BPromise=require(_0x7463('0x4'));var Mustache=require(_0x7463('0x5'));var util=require(_0x7463('0x6'));var path=require('path');var sox=require(_0x7463('0x7'));var csv=require(_0x7463('0x8'));var ejs=require(_0x7463('0x9'));var fs=require('fs');var fs_extra=require(_0x7463('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7463('0xb'));var jsforce=require(_0x7463('0xc'));var deskjs=require(_0x7463('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7463('0xe'));var Papa=require(_0x7463('0xf'));var Redis=require(_0x7463('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7463('0x11'));var as=require(_0x7463('0x12'));var hardwareService=require(_0x7463('0x13'));var logger=require('../../config/logger')(_0x7463('0x14'));var utils=require(_0x7463('0x15'));var config=require(_0x7463('0x16'));var licenseUtil=require(_0x7463('0x17'));var db=require(_0x7463('0x18'))['db'];function respondWithStatusCode(_0x125097,_0x123b9b){_0x123b9b=_0x123b9b||0xcc;return function(_0xc87091){if(_0xc87091){return _0x125097[_0x7463('0x19')](_0x123b9b);}return _0x125097[_0x7463('0x1a')](_0x123b9b)['end']();};}function respondWithResult(_0x80c029,_0x534e85){_0x534e85=_0x534e85||0xc8;return function(_0x188033){if(_0x188033){return _0x80c029[_0x7463('0x1a')](_0x534e85)[_0x7463('0x1b')](_0x188033);}};}function respondWithFilteredResult(_0x5d7688,_0x254976){return function(_0x56a26a){if(_0x56a26a){var _0x38ab31=typeof _0x254976[_0x7463('0x1c')]===_0x7463('0x1d')&&typeof _0x254976[_0x7463('0x1e')]===_0x7463('0x1d');var _0x4fca13=_0x56a26a['count'];var _0xcf4745=_0x38ab31?0x0:_0x254976['offset'];var _0x2edda9=_0x38ab31?_0x56a26a[_0x7463('0x1f')]:_0x254976[_0x7463('0x1c')]+_0x254976[_0x7463('0x1e')];var _0x4ea73d;if(_0x2edda9>=_0x4fca13){_0x2edda9=_0x4fca13;_0x4ea73d=0xc8;}else{_0x4ea73d=0xce;}_0x5d7688['status'](_0x4ea73d);return _0x5d7688[_0x7463('0x20')]('Content-Range',_0xcf4745+'-'+_0x2edda9+'/'+_0x4fca13)[_0x7463('0x1b')](_0x56a26a);}return null;};}function patchUpdates(_0x4a3483){return function(_0x5ec7d9){try{jsonpatch[_0x7463('0x21')](_0x5ec7d9,_0x4a3483,!![]);}catch(_0xe747d7){return BPromise[_0x7463('0x22')](_0xe747d7);}return _0x5ec7d9['save']();};}function saveUpdates(_0x4397da,_0x2778b5){return function(_0x3f3dd9){if(_0x3f3dd9){return _0x3f3dd9[_0x7463('0x23')](_0x4397da)[_0x7463('0x24')](function(_0x480228){return _0x480228;});}return null;};}function removeEntity(_0xf400c6,_0x195e61){return function(_0x366c7a){if(_0x366c7a){return _0x366c7a[_0x7463('0x25')]()[_0x7463('0x24')](function(){_0xf400c6[_0x7463('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e638b,_0x561796){return function(_0x45b875){if(!_0x45b875){_0x3e638b[_0x7463('0x19')](0x194);}return _0x45b875;};}function handleError(_0x4fa07b,_0x94a07a){_0x94a07a=_0x94a07a||0x1f4;return function(_0x1c23ed){logger['error'](_0x1c23ed[_0x7463('0x26')]);if(_0x1c23ed['name']){delete _0x1c23ed['name'];}_0x4fa07b['status'](_0x94a07a)[_0x7463('0x27')](_0x1c23ed);};}exports['index']=function(_0x8a3496,_0x409e18){var _0xaaef04={},_0x151c7c={},_0x58cdb5={'count':0x0,'rows':[]};var _0x4dfc3e=_['map'](db[_0x7463('0x28')][_0x7463('0x29')],function(_0x48c4db){return{'name':_0x48c4db[_0x7463('0x2a')],'type':_0x48c4db[_0x7463('0x2b')]['key']};});_0x151c7c[_0x7463('0x2c')]=_[_0x7463('0x2d')](_0x4dfc3e,'name');_0x151c7c[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x8a3496[_0x7463('0x2e')]);_0x151c7c[_0x7463('0x30')]=_[_0x7463('0x31')](_0x151c7c[_0x7463('0x2c')],_0x151c7c[_0x7463('0x2e')]);_0xaaef04['attributes']=_[_0x7463('0x31')](_0x151c7c[_0x7463('0x2c')],qs[_0x7463('0x32')](_0x8a3496['query'][_0x7463('0x32')]));_0xaaef04[_0x7463('0x33')]=_0xaaef04[_0x7463('0x33')][_0x7463('0x34')]?_0xaaef04[_0x7463('0x33')]:_0x151c7c[_0x7463('0x2c')];if(!_0x8a3496['query'][_0x7463('0x35')](_0x7463('0x36'))){_0xaaef04[_0x7463('0x1e')]=qs['limit'](_0x8a3496['query'][_0x7463('0x1e')]);_0xaaef04[_0x7463('0x1c')]=qs[_0x7463('0x1c')](_0x8a3496['query']['offset']);}_0xaaef04['order']=qs[_0x7463('0x37')](_0x8a3496[_0x7463('0x2e')][_0x7463('0x37')]);_0xaaef04[_0x7463('0x38')]=qs[_0x7463('0x30')](_[_0x7463('0x39')](_0x8a3496[_0x7463('0x2e')],_0x151c7c[_0x7463('0x30')]),_0x4dfc3e);if(_0x8a3496[_0x7463('0x2e')][_0x7463('0x3a')]){_0xaaef04[_0x7463('0x38')]=_[_0x7463('0x3b')](_0xaaef04[_0x7463('0x38')],{'$or':_[_0x7463('0x2d')](_0x4dfc3e,function(_0x15855b){if(_0x15855b[_0x7463('0x2b')]!==_0x7463('0x3c')){var _0x878a0c={};_0x878a0c[_0x15855b[_0x7463('0x3d')]]={'$like':'%'+_0x8a3496[_0x7463('0x2e')][_0x7463('0x3a')]+'%'};return _0x878a0c;}})});}_0xaaef04=_[_0x7463('0x3b')]({},_0xaaef04,_0x8a3496[_0x7463('0x3e')]);var _0x13e2ab={'where':_0xaaef04[_0x7463('0x38')]};return db[_0x7463('0x28')]['count'](_0x13e2ab)[_0x7463('0x24')](function(_0xf849ab){_0x58cdb5[_0x7463('0x1f')]=_0xf849ab;if(_0x8a3496[_0x7463('0x2e')][_0x7463('0x3f')]){_0xaaef04['include']=[{'all':!![]}];}return db[_0x7463('0x28')][_0x7463('0x40')](_0xaaef04);})[_0x7463('0x24')](function(_0x4b3a6e){_0x58cdb5[_0x7463('0x41')]=_0x4b3a6e;return _0x58cdb5;})['then'](respondWithFilteredResult(_0x409e18,_0xaaef04))['catch'](handleError(_0x409e18,null));};exports[_0x7463('0x42')]=function(_0x4f3bef,_0x4ca90f){var _0x1d007e={'raw':![],'where':{'id':_0x4f3bef['params']['id']}},_0x573031={};_0x573031[_0x7463('0x2c')]=_['keys'](db[_0x7463('0x28')][_0x7463('0x29')]);_0x573031[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x4f3bef[_0x7463('0x2e')]);_0x573031[_0x7463('0x30')]=_['intersection'](_0x573031[_0x7463('0x2c')],_0x573031[_0x7463('0x2e')]);_0x1d007e[_0x7463('0x33')]=_['intersection'](_0x573031['model'],qs[_0x7463('0x32')](_0x4f3bef[_0x7463('0x2e')][_0x7463('0x32')]));_0x1d007e[_0x7463('0x33')]=_0x1d007e[_0x7463('0x33')][_0x7463('0x34')]?_0x1d007e[_0x7463('0x33')]:_0x573031[_0x7463('0x2c')];if(_0x4f3bef[_0x7463('0x2e')][_0x7463('0x3f')]){_0x1d007e[_0x7463('0x43')]=[{'all':!![]}];}_0x1d007e=_['merge']({},_0x1d007e,_0x4f3bef['options']);return db[_0x7463('0x28')][_0x7463('0x44')](_0x1d007e)[_0x7463('0x24')](handleEntityNotFound(_0x4ca90f,null))[_0x7463('0x24')](respondWithResult(_0x4ca90f,null))['catch'](handleError(_0x4ca90f,null));};exports[_0x7463('0x45')]=function(_0x31f639,_0x4c4f2d){return db[_0x7463('0x28')][_0x7463('0x45')](_0x31f639[_0x7463('0x46')],{})[_0x7463('0x24')](respondWithResult(_0x4c4f2d,0xc9))[_0x7463('0x47')](handleError(_0x4c4f2d,null));};exports[_0x7463('0x23')]=function(_0x1eb753,_0x49e86d){if(_0x1eb753[_0x7463('0x46')]['id']){delete _0x1eb753['body']['id'];}return db[_0x7463('0x28')][_0x7463('0x44')]({'where':{'id':_0x1eb753['params']['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x49e86d,null))[_0x7463('0x24')](saveUpdates(_0x1eb753[_0x7463('0x46')],null))[_0x7463('0x24')](respondWithResult(_0x49e86d,null))['catch'](handleError(_0x49e86d,null));};exports[_0x7463('0x25')]=function(_0x3c98f8,_0x33be23){return db[_0x7463('0x28')][_0x7463('0x44')]({'where':{'id':_0x3c98f8[_0x7463('0x48')]['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x33be23,null))[_0x7463('0x24')](removeEntity(_0x33be23,null))[_0x7463('0x47')](handleError(_0x33be23,null));};exports[_0x7463('0x49')]=function(_0x58ae15,_0x2edc2e,_0x13c804){var _0x56558f={};var _0x826f8c={};var _0x178a8a;var _0x2c8ace;return db[_0x7463('0x28')][_0x7463('0x4a')]({'where':{'id':_0x58ae15[_0x7463('0x48')]['id']}})['then'](handleEntityNotFound(_0x2edc2e,null))['then'](function(_0x12e425){if(_0x12e425){_0x178a8a=_0x12e425;_0x826f8c['model']=_[_0x7463('0x2f')](db[_0x7463('0x4b')][_0x7463('0x29')]);_0x826f8c[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x58ae15[_0x7463('0x2e')]);_0x826f8c[_0x7463('0x30')]=_[_0x7463('0x31')](_0x826f8c[_0x7463('0x2c')],_0x826f8c['query']);_0x56558f[_0x7463('0x33')]=_['intersection'](_0x826f8c[_0x7463('0x2c')],qs[_0x7463('0x32')](_0x58ae15[_0x7463('0x2e')][_0x7463('0x32')]));_0x56558f[_0x7463('0x33')]=_0x56558f[_0x7463('0x33')][_0x7463('0x34')]?_0x56558f[_0x7463('0x33')]:_0x826f8c[_0x7463('0x2c')];_0x56558f[_0x7463('0x4c')]=qs[_0x7463('0x37')](_0x58ae15[_0x7463('0x2e')][_0x7463('0x37')]);_0x56558f[_0x7463('0x38')]=qs[_0x7463('0x30')](_['pick'](_0x58ae15['query'],_0x826f8c[_0x7463('0x30')]));if(_0x58ae15[_0x7463('0x2e')][_0x7463('0x3a')]){_0x56558f['where']=_[_0x7463('0x3b')](_0x56558f['where'],{'$or':_['map'](_0x56558f[_0x7463('0x33')],function(_0x25f81c){var _0x569af3={};_0x569af3[_0x25f81c]={'$like':'%'+_0x58ae15[_0x7463('0x2e')][_0x7463('0x3a')]+'%'};return _0x569af3;})});}_0x56558f=_[_0x7463('0x3b')]({},_0x56558f,_0x58ae15[_0x7463('0x3e')]);return _0x178a8a[_0x7463('0x49')](_0x56558f);}})[_0x7463('0x24')](function(_0x52d532){if(_0x52d532){_0x2c8ace=_0x52d532['length'];if(!_0x58ae15[_0x7463('0x2e')]['hasOwnProperty'](_0x7463('0x36'))){_0x56558f['limit']=qs[_0x7463('0x1e')](_0x58ae15[_0x7463('0x2e')]['limit']);_0x56558f[_0x7463('0x1c')]=qs[_0x7463('0x1c')](_0x58ae15[_0x7463('0x2e')][_0x7463('0x1c')]);}return _0x178a8a[_0x7463('0x49')](_0x56558f);}})[_0x7463('0x24')](function(_0x34311e){if(_0x34311e){return _0x34311e?{'count':_0x2c8ace,'rows':_0x34311e}:null;}})[_0x7463('0x24')](respondWithResult(_0x2edc2e,null))[_0x7463('0x47')](handleError(_0x2edc2e,null));};exports['getSubjects']=function(_0x4e631b,_0x499021,_0x1427da){var _0x7d86ae={};var _0x214116={};var _0x33410b;var _0x534c0b;return db[_0x7463('0x28')][_0x7463('0x4a')]({'where':{'id':_0x4e631b['params']['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x499021,null))[_0x7463('0x24')](function(_0x53fcb1){if(_0x53fcb1){_0x33410b=_0x53fcb1;_0x214116[_0x7463('0x2c')]=_[_0x7463('0x2f')](db[_0x7463('0x4b')][_0x7463('0x29')]);_0x214116[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x4e631b['query']);_0x214116['filters']=_[_0x7463('0x31')](_0x214116[_0x7463('0x2c')],_0x214116[_0x7463('0x2e')]);_0x7d86ae[_0x7463('0x33')]=_[_0x7463('0x31')](_0x214116[_0x7463('0x2c')],qs['fields'](_0x4e631b[_0x7463('0x2e')]['fields']));_0x7d86ae[_0x7463('0x33')]=_0x7d86ae['attributes']['length']?_0x7d86ae[_0x7463('0x33')]:_0x214116[_0x7463('0x2c')];_0x7d86ae[_0x7463('0x4c')]=qs[_0x7463('0x37')](_0x4e631b[_0x7463('0x2e')][_0x7463('0x37')]);_0x7d86ae[_0x7463('0x38')]=qs[_0x7463('0x30')](_['pick'](_0x4e631b[_0x7463('0x2e')],_0x214116['filters']));if(_0x4e631b[_0x7463('0x2e')][_0x7463('0x3a')]){_0x7d86ae[_0x7463('0x38')]=_[_0x7463('0x3b')](_0x7d86ae['where'],{'$or':_[_0x7463('0x2d')](_0x7d86ae[_0x7463('0x33')],function(_0xde7d0a){var _0x2c4f87={};_0x2c4f87[_0xde7d0a]={'$like':'%'+_0x4e631b['query'][_0x7463('0x3a')]+'%'};return _0x2c4f87;})});}_0x7d86ae=_[_0x7463('0x3b')]({},_0x7d86ae,_0x4e631b[_0x7463('0x3e')]);return _0x33410b[_0x7463('0x4d')](_0x7d86ae);}})[_0x7463('0x24')](function(_0x42b891){if(_0x42b891){_0x534c0b=_0x42b891[_0x7463('0x34')];if(!_0x4e631b[_0x7463('0x2e')][_0x7463('0x35')](_0x7463('0x36'))){_0x7d86ae['limit']=qs[_0x7463('0x1e')](_0x4e631b[_0x7463('0x2e')][_0x7463('0x1e')]);_0x7d86ae['offset']=qs[_0x7463('0x1c')](_0x4e631b[_0x7463('0x2e')][_0x7463('0x1c')]);}return _0x33410b['getSubjects'](_0x7d86ae);}})['then'](function(_0x54c19f){if(_0x54c19f){return _0x54c19f?{'count':_0x534c0b,'rows':_0x54c19f}:null;}})[_0x7463('0x24')](respondWithResult(_0x499021,null))[_0x7463('0x47')](handleError(_0x499021,null));};exports[_0x7463('0x4e')]=function(_0x2a6254,_0x54d8e0,_0x434fff){var _0x18d53c={};var _0x5bb9bb={};var _0x50ee32;var _0x4ceb25;return db['DeskConfiguration'][_0x7463('0x4a')]({'where':{'id':_0x2a6254[_0x7463('0x48')]['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x54d8e0,null))[_0x7463('0x24')](function(_0x9d9ac3){if(_0x9d9ac3){_0x50ee32=_0x9d9ac3;_0x5bb9bb[_0x7463('0x2c')]=_[_0x7463('0x2f')](db[_0x7463('0x4b')]['rawAttributes']);_0x5bb9bb['query']=_[_0x7463('0x2f')](_0x2a6254['query']);_0x5bb9bb['filters']=_[_0x7463('0x31')](_0x5bb9bb['model'],_0x5bb9bb['query']);_0x18d53c['attributes']=_[_0x7463('0x31')](_0x5bb9bb[_0x7463('0x2c')],qs[_0x7463('0x32')](_0x2a6254[_0x7463('0x2e')][_0x7463('0x32')]));_0x18d53c[_0x7463('0x33')]=_0x18d53c[_0x7463('0x33')][_0x7463('0x34')]?_0x18d53c[_0x7463('0x33')]:_0x5bb9bb['model'];_0x18d53c['order']=qs[_0x7463('0x37')](_0x2a6254['query'][_0x7463('0x37')]);_0x18d53c['where']=qs[_0x7463('0x30')](_['pick'](_0x2a6254[_0x7463('0x2e')],_0x5bb9bb[_0x7463('0x30')]));if(_0x2a6254[_0x7463('0x2e')]['filter']){_0x18d53c[_0x7463('0x38')]=_[_0x7463('0x3b')](_0x18d53c[_0x7463('0x38')],{'$or':_['map'](_0x18d53c[_0x7463('0x33')],function(_0x45af67){var _0x1ed4fc={};_0x1ed4fc[_0x45af67]={'$like':'%'+_0x2a6254['query'][_0x7463('0x3a')]+'%'};return _0x1ed4fc;})});}_0x18d53c=_[_0x7463('0x3b')]({},_0x18d53c,_0x2a6254['options']);return _0x50ee32[_0x7463('0x4e')](_0x18d53c);}})['then'](function(_0x36e228){if(_0x36e228){_0x4ceb25=_0x36e228[_0x7463('0x34')];if(!_0x2a6254[_0x7463('0x2e')][_0x7463('0x35')](_0x7463('0x36'))){_0x18d53c[_0x7463('0x1e')]=qs[_0x7463('0x1e')](_0x2a6254[_0x7463('0x2e')]['limit']);_0x18d53c[_0x7463('0x1c')]=qs['offset'](_0x2a6254[_0x7463('0x2e')][_0x7463('0x1c')]);}return _0x50ee32[_0x7463('0x4e')](_0x18d53c);}})[_0x7463('0x24')](function(_0x2eb712){if(_0x2eb712){return _0x2eb712?{'count':_0x4ceb25,'rows':_0x2eb712}:null;}})[_0x7463('0x24')](respondWithResult(_0x54d8e0,null))[_0x7463('0x47')](handleError(_0x54d8e0,null));};exports['getTags']=function(_0x5b7a6b,_0x385440,_0x254821){var _0x4fa9d4={};var _0x937ce0={};var _0x5e6a28;var _0x23afff;return db[_0x7463('0x28')][_0x7463('0x4a')]({'where':{'id':_0x5b7a6b['params']['id']}})['then'](handleEntityNotFound(_0x385440,null))[_0x7463('0x24')](function(_0x18cd9d){if(_0x18cd9d){_0x5e6a28=_0x18cd9d;_0x937ce0[_0x7463('0x2c')]=_['keys'](db[_0x7463('0x4f')][_0x7463('0x29')]);_0x937ce0[_0x7463('0x2e')]=_[_0x7463('0x2f')](_0x5b7a6b[_0x7463('0x2e')]);_0x937ce0[_0x7463('0x30')]=_[_0x7463('0x31')](_0x937ce0[_0x7463('0x2c')],_0x937ce0['query']);_0x4fa9d4[_0x7463('0x33')]=_[_0x7463('0x31')](_0x937ce0[_0x7463('0x2c')],qs[_0x7463('0x32')](_0x5b7a6b['query'][_0x7463('0x32')]));_0x4fa9d4[_0x7463('0x33')]=_0x4fa9d4[_0x7463('0x33')][_0x7463('0x34')]?_0x4fa9d4[_0x7463('0x33')]:_0x937ce0[_0x7463('0x2c')];_0x4fa9d4[_0x7463('0x4c')]=qs[_0x7463('0x37')](_0x5b7a6b[_0x7463('0x2e')]['sort']);_0x4fa9d4[_0x7463('0x38')]=qs[_0x7463('0x30')](_[_0x7463('0x39')](_0x5b7a6b['query'],_0x937ce0[_0x7463('0x30')]));if(_0x5b7a6b[_0x7463('0x2e')][_0x7463('0x3a')]){_0x4fa9d4[_0x7463('0x38')]=_[_0x7463('0x3b')](_0x4fa9d4['where'],{'$or':_[_0x7463('0x2d')](_0x4fa9d4[_0x7463('0x33')],function(_0x585c00){var _0x49b7dd={};_0x49b7dd[_0x585c00]={'$like':'%'+_0x5b7a6b[_0x7463('0x2e')]['filter']+'%'};return _0x49b7dd;})});}_0x4fa9d4=_[_0x7463('0x3b')]({},_0x4fa9d4,_0x5b7a6b[_0x7463('0x3e')]);return _0x5e6a28[_0x7463('0x50')](_0x4fa9d4);}})[_0x7463('0x24')](function(_0x590243){if(_0x590243){_0x23afff=_0x590243[_0x7463('0x34')];if(!_0x5b7a6b[_0x7463('0x2e')][_0x7463('0x35')]('nolimit')){_0x4fa9d4['limit']=qs['limit'](_0x5b7a6b[_0x7463('0x2e')][_0x7463('0x1e')]);_0x4fa9d4[_0x7463('0x1c')]=qs[_0x7463('0x1c')](_0x5b7a6b['query'][_0x7463('0x1c')]);}return _0x5e6a28[_0x7463('0x50')](_0x4fa9d4);}})['then'](function(_0x43f66b){if(_0x43f66b){return _0x43f66b?{'count':_0x23afff,'rows':_0x43f66b}:null;}})[_0x7463('0x24')](respondWithResult(_0x385440,null))['catch'](handleError(_0x385440,null));};exports[_0x7463('0x51')]=function(_0x133985,_0x48b357,_0x1ae134){if(_0x133985[_0x7463('0x46')]['id']){delete _0x133985[_0x7463('0x46')]['id'];}return db[_0x7463('0x28')][_0x7463('0x4a')]({'where':{'id':_0x133985[_0x7463('0x48')]['id']}})[_0x7463('0x24')](handleEntityNotFound(_0x48b357,null))[_0x7463('0x24')](function(_0x264899){if(_0x264899){return _0x264899[_0x7463('0x51')](_0x133985[_0x7463('0x46')][_0x7463('0x52')]||[]);}return null;})[_0x7463('0x24')](respondWithResult(_0x48b357,null))[_0x7463('0x47')](handleError(_0x48b357,null));}; \ No newline at end of file +var _0x3bb3=['type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','stack','name','send','index','map','DeskConfiguration','rawAttributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3bb3,0x119));var _0x33bb=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3bb3[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x33bb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33bb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33bb('0x2'));var moment=require('moment');var BPromise=require(_0x33bb('0x3'));var Mustache=require(_0x33bb('0x4'));var util=require(_0x33bb('0x5'));var path=require('path');var sox=require(_0x33bb('0x6'));var csv=require(_0x33bb('0x7'));var ejs=require(_0x33bb('0x8'));var fs=require('fs');var fs_extra=require(_0x33bb('0x9'));var _=require(_0x33bb('0xa'));var squel=require(_0x33bb('0xb'));var crypto=require(_0x33bb('0xc'));var jsforce=require(_0x33bb('0xd'));var deskjs=require(_0x33bb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x33bb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x33bb('0x10'));var qs=require(_0x33bb('0x11'));var as=require(_0x33bb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33bb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x33bb('0x14'));var licenseUtil=require(_0x33bb('0x15'));var db=require(_0x33bb('0x16'))['db'];function respondWithStatusCode(_0x82eb0b,_0x427f87){_0x427f87=_0x427f87||0xcc;return function(_0x333701){if(_0x333701){return _0x82eb0b[_0x33bb('0x17')](_0x427f87);}return _0x82eb0b[_0x33bb('0x18')](_0x427f87)[_0x33bb('0x19')]();};}function respondWithResult(_0x55f4b1,_0x55e0be){_0x55e0be=_0x55e0be||0xc8;return function(_0x56f9c8){if(_0x56f9c8){return _0x55f4b1[_0x33bb('0x18')](_0x55e0be)[_0x33bb('0x1a')](_0x56f9c8);}};}function respondWithFilteredResult(_0x48a83f,_0x24dc4c){return function(_0x49b3a3){if(_0x49b3a3){var _0x509ff8=typeof _0x24dc4c[_0x33bb('0x1b')]===_0x33bb('0x1c')&&typeof _0x24dc4c[_0x33bb('0x1d')]===_0x33bb('0x1c');var _0x29ffb0=_0x49b3a3[_0x33bb('0x1e')];var _0x51accb=_0x509ff8?0x0:_0x24dc4c['offset'];var _0x1f7ef7=_0x509ff8?_0x49b3a3[_0x33bb('0x1e')]:_0x24dc4c[_0x33bb('0x1b')]+_0x24dc4c[_0x33bb('0x1d')];var _0x1fb3b4;if(_0x1f7ef7>=_0x29ffb0){_0x1f7ef7=_0x29ffb0;_0x1fb3b4=0xc8;}else{_0x1fb3b4=0xce;}_0x48a83f[_0x33bb('0x18')](_0x1fb3b4);return _0x48a83f[_0x33bb('0x1f')]('Content-Range',_0x51accb+'-'+_0x1f7ef7+'/'+_0x29ffb0)['json'](_0x49b3a3);}return null;};}function patchUpdates(_0x13aac3){return function(_0x23292c){try{jsonpatch[_0x33bb('0x20')](_0x23292c,_0x13aac3,!![]);}catch(_0x1eb2ce){return BPromise['reject'](_0x1eb2ce);}return _0x23292c[_0x33bb('0x21')]();};}function saveUpdates(_0x47bc0c,_0x35327d){return function(_0x46061d){if(_0x46061d){return _0x46061d[_0x33bb('0x22')](_0x47bc0c)[_0x33bb('0x23')](function(_0x371a19){return _0x371a19;});}return null;};}function removeEntity(_0x27adae,_0x5c9909){return function(_0xd1b4a7){if(_0xd1b4a7){return _0xd1b4a7['destroy']()[_0x33bb('0x23')](function(){_0x27adae[_0x33bb('0x18')](0xcc)[_0x33bb('0x19')]();});}};}function handleEntityNotFound(_0x3d9439,_0x44b4fa){return function(_0x27cb6a){if(!_0x27cb6a){_0x3d9439[_0x33bb('0x17')](0x194);}return _0x27cb6a;};}function handleError(_0x122f57,_0x14c39c){_0x14c39c=_0x14c39c||0x1f4;return function(_0xb529a4){logger['error'](_0xb529a4[_0x33bb('0x24')]);if(_0xb529a4[_0x33bb('0x25')]){delete _0xb529a4[_0x33bb('0x25')];}_0x122f57[_0x33bb('0x18')](_0x14c39c)[_0x33bb('0x26')](_0xb529a4);};}exports[_0x33bb('0x27')]=function(_0x4c69e3,_0x1e0266){var _0x297516={},_0x2e9267={},_0x19403e={'count':0x0,'rows':[]};var _0x17d52d=_[_0x33bb('0x28')](db[_0x33bb('0x29')][_0x33bb('0x2a')],function(_0x5014cf){return{'name':_0x5014cf['fieldName'],'type':_0x5014cf[_0x33bb('0x2b')]['key']};});_0x2e9267[_0x33bb('0x2c')]=_['map'](_0x17d52d,_0x33bb('0x25'));_0x2e9267[_0x33bb('0x2d')]=_[_0x33bb('0x2e')](_0x4c69e3['query']);_0x2e9267[_0x33bb('0x2f')]=_[_0x33bb('0x30')](_0x2e9267[_0x33bb('0x2c')],_0x2e9267[_0x33bb('0x2d')]);_0x297516['attributes']=_[_0x33bb('0x30')](_0x2e9267[_0x33bb('0x2c')],qs[_0x33bb('0x31')](_0x4c69e3[_0x33bb('0x2d')]['fields']));_0x297516['attributes']=_0x297516[_0x33bb('0x32')][_0x33bb('0x33')]?_0x297516['attributes']:_0x2e9267[_0x33bb('0x2c')];if(!_0x4c69e3[_0x33bb('0x2d')][_0x33bb('0x34')]('nolimit')){_0x297516['limit']=qs[_0x33bb('0x1d')](_0x4c69e3[_0x33bb('0x2d')][_0x33bb('0x1d')]);_0x297516[_0x33bb('0x1b')]=qs[_0x33bb('0x1b')](_0x4c69e3['query']['offset']);}_0x297516[_0x33bb('0x35')]=qs[_0x33bb('0x36')](_0x4c69e3['query'][_0x33bb('0x36')]);_0x297516['where']=qs[_0x33bb('0x2f')](_[_0x33bb('0x37')](_0x4c69e3[_0x33bb('0x2d')],_0x2e9267[_0x33bb('0x2f')]),_0x17d52d);if(_0x4c69e3[_0x33bb('0x2d')]['filter']){_0x297516[_0x33bb('0x38')]=_[_0x33bb('0x39')](_0x297516['where'],{'$or':_[_0x33bb('0x28')](_0x17d52d,function(_0x4f5dbe){if(_0x4f5dbe[_0x33bb('0x2b')]!==_0x33bb('0x3a')){var _0x5e94d6={};_0x5e94d6[_0x4f5dbe[_0x33bb('0x25')]]={'$like':'%'+_0x4c69e3[_0x33bb('0x2d')][_0x33bb('0x3b')]+'%'};return _0x5e94d6;}})});}_0x297516=_[_0x33bb('0x39')]({},_0x297516,_0x4c69e3['options']);var _0x590961={'where':_0x297516[_0x33bb('0x38')]};return db['DeskConfiguration'][_0x33bb('0x1e')](_0x590961)['then'](function(_0x320a88){_0x19403e['count']=_0x320a88;if(_0x4c69e3[_0x33bb('0x2d')][_0x33bb('0x3c')]){_0x297516['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x33bb('0x3d')](_0x297516);})[_0x33bb('0x23')](function(_0x5ea4a5){_0x19403e[_0x33bb('0x3e')]=_0x5ea4a5;return _0x19403e;})['then'](respondWithFilteredResult(_0x1e0266,_0x297516))[_0x33bb('0x3f')](handleError(_0x1e0266,null));};exports[_0x33bb('0x40')]=function(_0x2d0425,_0x264335){var _0x42cd78={'raw':![],'where':{'id':_0x2d0425[_0x33bb('0x41')]['id']}},_0x58f0fa={};_0x58f0fa[_0x33bb('0x2c')]=_[_0x33bb('0x2e')](db['DeskConfiguration'][_0x33bb('0x2a')]);_0x58f0fa[_0x33bb('0x2d')]=_['keys'](_0x2d0425['query']);_0x58f0fa[_0x33bb('0x2f')]=_[_0x33bb('0x30')](_0x58f0fa[_0x33bb('0x2c')],_0x58f0fa['query']);_0x42cd78['attributes']=_[_0x33bb('0x30')](_0x58f0fa[_0x33bb('0x2c')],qs[_0x33bb('0x31')](_0x2d0425[_0x33bb('0x2d')][_0x33bb('0x31')]));_0x42cd78[_0x33bb('0x32')]=_0x42cd78[_0x33bb('0x32')][_0x33bb('0x33')]?_0x42cd78['attributes']:_0x58f0fa['model'];if(_0x2d0425[_0x33bb('0x2d')][_0x33bb('0x3c')]){_0x42cd78[_0x33bb('0x42')]=[{'all':!![]}];}_0x42cd78=_['merge']({},_0x42cd78,_0x2d0425[_0x33bb('0x43')]);return db[_0x33bb('0x29')][_0x33bb('0x44')](_0x42cd78)['then'](handleEntityNotFound(_0x264335,null))[_0x33bb('0x23')](respondWithResult(_0x264335,null))['catch'](handleError(_0x264335,null));};exports[_0x33bb('0x45')]=function(_0xe4c3c8,_0x3010c2){return db[_0x33bb('0x29')][_0x33bb('0x45')](_0xe4c3c8['body'],{})['then'](respondWithResult(_0x3010c2,0xc9))[_0x33bb('0x3f')](handleError(_0x3010c2,null));};exports[_0x33bb('0x22')]=function(_0x550012,_0xc9e294){if(_0x550012[_0x33bb('0x46')]['id']){delete _0x550012[_0x33bb('0x46')]['id'];}return db[_0x33bb('0x29')]['find']({'where':{'id':_0x550012[_0x33bb('0x41')]['id']}})['then'](handleEntityNotFound(_0xc9e294,null))[_0x33bb('0x23')](saveUpdates(_0x550012['body'],null))[_0x33bb('0x23')](respondWithResult(_0xc9e294,null))['catch'](handleError(_0xc9e294,null));};exports['destroy']=function(_0x376665,_0x2bb745){return db[_0x33bb('0x29')]['find']({'where':{'id':_0x376665[_0x33bb('0x41')]['id']}})[_0x33bb('0x23')](handleEntityNotFound(_0x2bb745,null))['then'](removeEntity(_0x2bb745,null))[_0x33bb('0x3f')](handleError(_0x2bb745,null));};exports[_0x33bb('0x47')]=function(_0x486a50,_0x24f0fe,_0x11678d){var _0x3df966={};var _0x30dccb={};var _0x353ef6;var _0x330eac;return db[_0x33bb('0x29')][_0x33bb('0x48')]({'where':{'id':_0x486a50[_0x33bb('0x41')]['id']}})[_0x33bb('0x23')](handleEntityNotFound(_0x24f0fe,null))[_0x33bb('0x23')](function(_0x3bac45){if(_0x3bac45){_0x353ef6=_0x3bac45;_0x30dccb['model']=_[_0x33bb('0x2e')](db[_0x33bb('0x49')]['rawAttributes']);_0x30dccb[_0x33bb('0x2d')]=_['keys'](_0x486a50['query']);_0x30dccb[_0x33bb('0x2f')]=_[_0x33bb('0x30')](_0x30dccb[_0x33bb('0x2c')],_0x30dccb[_0x33bb('0x2d')]);_0x3df966[_0x33bb('0x32')]=_[_0x33bb('0x30')](_0x30dccb[_0x33bb('0x2c')],qs[_0x33bb('0x31')](_0x486a50[_0x33bb('0x2d')][_0x33bb('0x31')]));_0x3df966['attributes']=_0x3df966[_0x33bb('0x32')][_0x33bb('0x33')]?_0x3df966[_0x33bb('0x32')]:_0x30dccb[_0x33bb('0x2c')];_0x3df966[_0x33bb('0x35')]=qs[_0x33bb('0x36')](_0x486a50['query'][_0x33bb('0x36')]);_0x3df966['where']=qs[_0x33bb('0x2f')](_['pick'](_0x486a50[_0x33bb('0x2d')],_0x30dccb[_0x33bb('0x2f')]));if(_0x486a50['query'][_0x33bb('0x3b')]){_0x3df966['where']=_[_0x33bb('0x39')](_0x3df966['where'],{'$or':_[_0x33bb('0x28')](_0x3df966['attributes'],function(_0x29fb9b){var _0x33ea37={};_0x33ea37[_0x29fb9b]={'$like':'%'+_0x486a50['query']['filter']+'%'};return _0x33ea37;})});}_0x3df966=_[_0x33bb('0x39')]({},_0x3df966,_0x486a50[_0x33bb('0x43')]);return _0x353ef6[_0x33bb('0x47')](_0x3df966);}})['then'](function(_0x266a1f){if(_0x266a1f){_0x330eac=_0x266a1f[_0x33bb('0x33')];if(!_0x486a50[_0x33bb('0x2d')]['hasOwnProperty'](_0x33bb('0x4a'))){_0x3df966[_0x33bb('0x1d')]=qs[_0x33bb('0x1d')](_0x486a50['query'][_0x33bb('0x1d')]);_0x3df966[_0x33bb('0x1b')]=qs['offset'](_0x486a50[_0x33bb('0x2d')][_0x33bb('0x1b')]);}return _0x353ef6[_0x33bb('0x47')](_0x3df966);}})[_0x33bb('0x23')](function(_0x4041eb){if(_0x4041eb){return _0x4041eb?{'count':_0x330eac,'rows':_0x4041eb}:null;}})[_0x33bb('0x23')](respondWithResult(_0x24f0fe,null))[_0x33bb('0x3f')](handleError(_0x24f0fe,null));};exports[_0x33bb('0x4b')]=function(_0xf55c17,_0x2252db,_0x243591){var _0x815d={};var _0x2582f8={};var _0x478759;var _0x583511;return db[_0x33bb('0x29')][_0x33bb('0x48')]({'where':{'id':_0xf55c17['params']['id']}})['then'](handleEntityNotFound(_0x2252db,null))[_0x33bb('0x23')](function(_0x4d4949){if(_0x4d4949){_0x478759=_0x4d4949;_0x2582f8[_0x33bb('0x2c')]=_['keys'](db[_0x33bb('0x49')][_0x33bb('0x2a')]);_0x2582f8[_0x33bb('0x2d')]=_[_0x33bb('0x2e')](_0xf55c17[_0x33bb('0x2d')]);_0x2582f8[_0x33bb('0x2f')]=_['intersection'](_0x2582f8[_0x33bb('0x2c')],_0x2582f8['query']);_0x815d[_0x33bb('0x32')]=_['intersection'](_0x2582f8[_0x33bb('0x2c')],qs[_0x33bb('0x31')](_0xf55c17[_0x33bb('0x2d')][_0x33bb('0x31')]));_0x815d[_0x33bb('0x32')]=_0x815d[_0x33bb('0x32')][_0x33bb('0x33')]?_0x815d[_0x33bb('0x32')]:_0x2582f8[_0x33bb('0x2c')];_0x815d[_0x33bb('0x35')]=qs[_0x33bb('0x36')](_0xf55c17['query']['sort']);_0x815d[_0x33bb('0x38')]=qs[_0x33bb('0x2f')](_[_0x33bb('0x37')](_0xf55c17[_0x33bb('0x2d')],_0x2582f8[_0x33bb('0x2f')]));if(_0xf55c17[_0x33bb('0x2d')][_0x33bb('0x3b')]){_0x815d[_0x33bb('0x38')]=_[_0x33bb('0x39')](_0x815d[_0x33bb('0x38')],{'$or':_[_0x33bb('0x28')](_0x815d['attributes'],function(_0x29d23d){var _0x146092={};_0x146092[_0x29d23d]={'$like':'%'+_0xf55c17['query'][_0x33bb('0x3b')]+'%'};return _0x146092;})});}_0x815d=_[_0x33bb('0x39')]({},_0x815d,_0xf55c17[_0x33bb('0x43')]);return _0x478759[_0x33bb('0x4b')](_0x815d);}})[_0x33bb('0x23')](function(_0x51c112){if(_0x51c112){_0x583511=_0x51c112[_0x33bb('0x33')];if(!_0xf55c17[_0x33bb('0x2d')]['hasOwnProperty'](_0x33bb('0x4a'))){_0x815d[_0x33bb('0x1d')]=qs[_0x33bb('0x1d')](_0xf55c17['query'][_0x33bb('0x1d')]);_0x815d[_0x33bb('0x1b')]=qs['offset'](_0xf55c17[_0x33bb('0x2d')][_0x33bb('0x1b')]);}return _0x478759[_0x33bb('0x4b')](_0x815d);}})[_0x33bb('0x23')](function(_0x101e1a){if(_0x101e1a){return _0x101e1a?{'count':_0x583511,'rows':_0x101e1a}:null;}})[_0x33bb('0x23')](respondWithResult(_0x2252db,null))[_0x33bb('0x3f')](handleError(_0x2252db,null));};exports[_0x33bb('0x4c')]=function(_0x202f57,_0x743425,_0x4c62dc){var _0x1b422d={};var _0x5423cd={};var _0x4570a5;var _0x175da1;return db[_0x33bb('0x29')][_0x33bb('0x48')]({'where':{'id':_0x202f57[_0x33bb('0x41')]['id']}})[_0x33bb('0x23')](handleEntityNotFound(_0x743425,null))['then'](function(_0x40acac){if(_0x40acac){_0x4570a5=_0x40acac;_0x5423cd[_0x33bb('0x2c')]=_['keys'](db[_0x33bb('0x49')][_0x33bb('0x2a')]);_0x5423cd['query']=_[_0x33bb('0x2e')](_0x202f57[_0x33bb('0x2d')]);_0x5423cd[_0x33bb('0x2f')]=_[_0x33bb('0x30')](_0x5423cd[_0x33bb('0x2c')],_0x5423cd[_0x33bb('0x2d')]);_0x1b422d[_0x33bb('0x32')]=_[_0x33bb('0x30')](_0x5423cd[_0x33bb('0x2c')],qs[_0x33bb('0x31')](_0x202f57[_0x33bb('0x2d')]['fields']));_0x1b422d['attributes']=_0x1b422d[_0x33bb('0x32')]['length']?_0x1b422d['attributes']:_0x5423cd[_0x33bb('0x2c')];_0x1b422d[_0x33bb('0x35')]=qs[_0x33bb('0x36')](_0x202f57[_0x33bb('0x2d')][_0x33bb('0x36')]);_0x1b422d[_0x33bb('0x38')]=qs[_0x33bb('0x2f')](_['pick'](_0x202f57[_0x33bb('0x2d')],_0x5423cd[_0x33bb('0x2f')]));if(_0x202f57[_0x33bb('0x2d')][_0x33bb('0x3b')]){_0x1b422d[_0x33bb('0x38')]=_[_0x33bb('0x39')](_0x1b422d[_0x33bb('0x38')],{'$or':_[_0x33bb('0x28')](_0x1b422d[_0x33bb('0x32')],function(_0x199078){var _0x2dc247={};_0x2dc247[_0x199078]={'$like':'%'+_0x202f57[_0x33bb('0x2d')][_0x33bb('0x3b')]+'%'};return _0x2dc247;})});}_0x1b422d=_[_0x33bb('0x39')]({},_0x1b422d,_0x202f57[_0x33bb('0x43')]);return _0x4570a5[_0x33bb('0x4c')](_0x1b422d);}})['then'](function(_0x50a8d2){if(_0x50a8d2){_0x175da1=_0x50a8d2[_0x33bb('0x33')];if(!_0x202f57[_0x33bb('0x2d')][_0x33bb('0x34')](_0x33bb('0x4a'))){_0x1b422d['limit']=qs[_0x33bb('0x1d')](_0x202f57['query']['limit']);_0x1b422d['offset']=qs[_0x33bb('0x1b')](_0x202f57[_0x33bb('0x2d')]['offset']);}return _0x4570a5[_0x33bb('0x4c')](_0x1b422d);}})[_0x33bb('0x23')](function(_0x3760d0){if(_0x3760d0){return _0x3760d0?{'count':_0x175da1,'rows':_0x3760d0}:null;}})[_0x33bb('0x23')](respondWithResult(_0x743425,null))[_0x33bb('0x3f')](handleError(_0x743425,null));};exports[_0x33bb('0x4d')]=function(_0x4c0fe7,_0x5b62af,_0x3b49c6){var _0x3ea619={};var _0x1353e1={};var _0xddbc07;var _0x16c04f;return db[_0x33bb('0x29')]['findOne']({'where':{'id':_0x4c0fe7[_0x33bb('0x41')]['id']}})[_0x33bb('0x23')](handleEntityNotFound(_0x5b62af,null))['then'](function(_0x5b2938){if(_0x5b2938){_0xddbc07=_0x5b2938;_0x1353e1[_0x33bb('0x2c')]=_[_0x33bb('0x2e')](db[_0x33bb('0x4e')]['rawAttributes']);_0x1353e1[_0x33bb('0x2d')]=_[_0x33bb('0x2e')](_0x4c0fe7[_0x33bb('0x2d')]);_0x1353e1[_0x33bb('0x2f')]=_[_0x33bb('0x30')](_0x1353e1[_0x33bb('0x2c')],_0x1353e1[_0x33bb('0x2d')]);_0x3ea619['attributes']=_[_0x33bb('0x30')](_0x1353e1['model'],qs[_0x33bb('0x31')](_0x4c0fe7[_0x33bb('0x2d')][_0x33bb('0x31')]));_0x3ea619[_0x33bb('0x32')]=_0x3ea619['attributes'][_0x33bb('0x33')]?_0x3ea619[_0x33bb('0x32')]:_0x1353e1[_0x33bb('0x2c')];_0x3ea619['order']=qs[_0x33bb('0x36')](_0x4c0fe7['query'][_0x33bb('0x36')]);_0x3ea619[_0x33bb('0x38')]=qs['filters'](_[_0x33bb('0x37')](_0x4c0fe7[_0x33bb('0x2d')],_0x1353e1[_0x33bb('0x2f')]));if(_0x4c0fe7['query'][_0x33bb('0x3b')]){_0x3ea619[_0x33bb('0x38')]=_[_0x33bb('0x39')](_0x3ea619[_0x33bb('0x38')],{'$or':_[_0x33bb('0x28')](_0x3ea619[_0x33bb('0x32')],function(_0x2ec9f1){var _0x14851f={};_0x14851f[_0x2ec9f1]={'$like':'%'+_0x4c0fe7[_0x33bb('0x2d')][_0x33bb('0x3b')]+'%'};return _0x14851f;})});}_0x3ea619=_[_0x33bb('0x39')]({},_0x3ea619,_0x4c0fe7[_0x33bb('0x43')]);return _0xddbc07['getTags'](_0x3ea619);}})[_0x33bb('0x23')](function(_0xcce5e6){if(_0xcce5e6){_0x16c04f=_0xcce5e6[_0x33bb('0x33')];if(!_0x4c0fe7[_0x33bb('0x2d')][_0x33bb('0x34')](_0x33bb('0x4a'))){_0x3ea619[_0x33bb('0x1d')]=qs['limit'](_0x4c0fe7[_0x33bb('0x2d')][_0x33bb('0x1d')]);_0x3ea619[_0x33bb('0x1b')]=qs['offset'](_0x4c0fe7[_0x33bb('0x2d')][_0x33bb('0x1b')]);}return _0xddbc07[_0x33bb('0x4d')](_0x3ea619);}})[_0x33bb('0x23')](function(_0x227e90){if(_0x227e90){return _0x227e90?{'count':_0x16c04f,'rows':_0x227e90}:null;}})[_0x33bb('0x23')](respondWithResult(_0x5b62af,null))[_0x33bb('0x3f')](handleError(_0x5b62af,null));};exports[_0x33bb('0x4f')]=function(_0x11918b,_0x228021,_0x40835d){if(_0x11918b[_0x33bb('0x46')]['id']){delete _0x11918b['body']['id'];}return db[_0x33bb('0x29')]['findOne']({'where':{'id':_0x11918b[_0x33bb('0x41')]['id']}})[_0x33bb('0x23')](handleEntityNotFound(_0x228021,null))[_0x33bb('0x23')](function(_0x56bdc1){if(_0x56bdc1){return _0x56bdc1[_0x33bb('0x4f')](_0x11918b[_0x33bb('0x46')][_0x33bb('0x50')]||[]);}return null;})[_0x33bb('0x23')](respondWithResult(_0x228021,null))['catch'](handleError(_0x228021,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index f71dcf2..0bb415d 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 _0xf97b=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x198247,_0x491c12){var _0x2b18bc=function(_0x4a43e2){while(--_0x4a43e2){_0x198247['push'](_0x198247['shift']());}};_0x2b18bc(++_0x491c12);}(_0xf97b,0x19c));var _0xbf97=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xf97b[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xbf97('0x0'));var util=require(_0xbf97('0x1'));var logger=require(_0xbf97('0x2'))(_0xbf97('0x3'));var moment=require(_0xbf97('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf97('0x5'));var fs=require('fs');var path=require(_0xbf97('0x6'));var rimraf=require(_0xbf97('0x7'));var config=require(_0xbf97('0x8'));var attributes=require(_0xbf97('0x9'));module[_0xbf97('0xa')]=function(_0x4486ec,_0x1d58b6){return _0x4486ec[_0xbf97('0xb')](_0xbf97('0xc'),attributes,{'tableName':_0xbf97('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x624e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','util','../../config/logger'];(function(_0x26474e,_0x1e9e85){var _0x24eb78=function(_0x4278ab){while(--_0x4278ab){_0x26474e['push'](_0x26474e['shift']());}};_0x24eb78(++_0x1e9e85);}(_0x624e,0x184));var _0xe624=function(_0x2e3f5b,_0x225d5c){_0x2e3f5b=_0x2e3f5b-0x0;var _0x2d4148=_0x624e[_0x2e3f5b];return _0x2d4148;};'use strict';var _=require('lodash');var util=require(_0xe624('0x0'));var logger=require(_0xe624('0x1'))(_0xe624('0x2'));var moment=require(_0xe624('0x3'));var BPromise=require(_0xe624('0x4'));var rp=require(_0xe624('0x5'));var fs=require('fs');var path=require(_0xe624('0x6'));var rimraf=require(_0xe624('0x7'));var config=require(_0xe624('0x8'));var attributes=require(_0xe624('0x9'));module[_0xe624('0xa')]=function(_0x18ecbc,_0x1b0eef){return _0x18ecbc['define'](_0xe624('0xb'),attributes,{'tableName':_0xe624('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 57dcbb4..63fd6ab 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 _0xc373=['../../config/environment','jayson/promise','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e9097,_0x21c1a8){var _0x167366=function(_0x21e5b1){while(--_0x21e5b1){_0x1e9097['push'](_0x1e9097['shift']());}};_0x167366(++_0x21c1a8);}(_0xc373,0x1c7));var _0x3c37=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xc373[_0x310a1b];return _0xdea206;};'use strict';var _=require('lodash');var util=require(_0x3c37('0x0'));var moment=require(_0x3c37('0x1'));var BPromise=require(_0x3c37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c37('0x3'))['db'];var utils=require(_0x3c37('0x4'));var logger=require(_0x3c37('0x5'))(_0x3c37('0x6'));var config=require(_0x3c37('0x7'));var jayson=require(_0x3c37('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1941,_0x1244e6,_0x14b09d){return new BPromise(function(_0x10617,_0x465de6){return client[_0x3c37('0x9')](_0x2e1941,_0x14b09d)[_0x3c37('0xa')](function(_0x59d4f9){logger[_0x3c37('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x1244e6,'request\x20sent');logger[_0x3c37('0xc')](_0x3c37('0xd'),_0x1244e6,_0x3c37('0xe'),JSON[_0x3c37('0xf')](_0x59d4f9));if(_0x59d4f9[_0x3c37('0x10')]){if(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x11')]===0x1f4){logger['error'](_0x3c37('0x12'),_0x1244e6,_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);return _0x465de6(_0x59d4f9['error']['message']);}logger[_0x3c37('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x1244e6,_0x59d4f9['error'][_0x3c37('0x13')]);return _0x10617(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);}else{logger[_0x3c37('0xb')](_0x3c37('0x12'),_0x1244e6,_0x3c37('0xe'));_0x10617(_0x59d4f9[_0x3c37('0x14')][_0x3c37('0x13')]);}})[_0x3c37('0x15')](function(_0x4e1560){logger[_0x3c37('0x10')](_0x3c37('0x12'),_0x1244e6,_0x4e1560);_0x465de6(_0x4e1560);});});} \ No newline at end of file +var _0xce04=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','code','error','message'];(function(_0x481780,_0x3db65d){var _0x2d2b2b=function(_0x320199){while(--_0x320199){_0x481780['push'](_0x481780['shift']());}};_0x2d2b2b(++_0x3db65d);}(_0xce04,0xc0));var _0x4ce0=function(_0x1a45c4,_0x3151aa){_0x1a45c4=_0x1a45c4-0x0;var _0x327638=_0xce04[_0x1a45c4];return _0x327638;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var moment=require(_0x4ce0('0x1'));var BPromise=require(_0x4ce0('0x2'));var rs=require(_0x4ce0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce0('0x5'));var jayson=require(_0x4ce0('0x6'));var client=jayson['client'][_0x4ce0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x462871,_0x5377ab,_0x3a0dca){return new BPromise(function(_0x3b7238,_0x709a46){return client['request'](_0x462871,_0x3a0dca)[_0x4ce0('0x8')](function(_0x29c627){logger[_0x4ce0('0x9')](_0x4ce0('0xa'),_0x5377ab,_0x4ce0('0xb'));logger[_0x4ce0('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5377ab,_0x4ce0('0xb'),JSON['stringify'](_0x29c627));if(_0x29c627['error']){if(_0x29c627['error'][_0x4ce0('0xd')]===0x1f4){logger[_0x4ce0('0xe')](_0x4ce0('0xa'),_0x5377ab,_0x29c627['error'][_0x4ce0('0xf')]);return _0x709a46(_0x29c627[_0x4ce0('0xe')]['message']);}logger[_0x4ce0('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x5377ab,_0x29c627[_0x4ce0('0xe')][_0x4ce0('0xf')]);return _0x3b7238(_0x29c627[_0x4ce0('0xe')]['message']);}else{logger[_0x4ce0('0x9')](_0x4ce0('0xa'),_0x5377ab,_0x4ce0('0xb'));_0x3b7238(_0x29c627['result'][_0x4ce0('0xf')]);}})['catch'](function(_0x4d1fd2){logger[_0x4ce0('0xe')](_0x4ce0('0xa'),_0x5377ab,_0x4d1fd2);_0x709a46(_0x4d1fd2);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 21db534..7799b63 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 _0xaf5b=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5972a6,_0x3cd054){var _0x51fd0f=function(_0x46ba29){while(--_0x46ba29){_0x5972a6['push'](_0x5972a6['shift']());}};_0x51fd0f(++_0x3cd054);}(_0xaf5b,0x108));var _0xbaf5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xaf5b[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xbaf5('0x0'));var util=require(_0xbaf5('0x1'));var path=require('path');var timeout=require(_0xbaf5('0x2'));var express=require(_0xbaf5('0x3'));var router=express[_0xbaf5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbaf5('0x5'));var interaction=require(_0xbaf5('0x6'));var config=require(_0xbaf5('0x7'));var controller=require('./intDeskField.controller');router[_0xbaf5('0x8')]('/',auth[_0xbaf5('0x9')](),controller[_0xbaf5('0xa')]);router['get'](_0xbaf5('0xb'),auth[_0xbaf5('0x9')](),controller[_0xbaf5('0xc')]);router[_0xbaf5('0xd')]('/',auth[_0xbaf5('0x9')](),controller['create']);router[_0xbaf5('0xe')](_0xbaf5('0xb'),auth['isAuthenticated'](),controller[_0xbaf5('0xf')]);router[_0xbaf5('0x10')](_0xbaf5('0xb'),auth[_0xbaf5('0x9')](),controller['destroy']);module[_0xbaf5('0x11')]=router; \ No newline at end of file +var _0x0cfa=['Router','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2051c5,_0x3d235c){var _0x146f60=function(_0x550a46){while(--_0x550a46){_0x2051c5['push'](_0x2051c5['shift']());}};_0x146f60(++_0x3d235c);}(_0x0cfa,0x73));var _0xa0cf=function(_0xb6445f,_0x153870){_0xb6445f=_0xb6445f-0x0;var _0x41e08c=_0x0cfa[_0xb6445f];return _0x41e08c;};'use strict';var multer=require(_0xa0cf('0x0'));var util=require(_0xa0cf('0x1'));var path=require(_0xa0cf('0x2'));var timeout=require(_0xa0cf('0x3'));var express=require(_0xa0cf('0x4'));var router=express[_0xa0cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa0cf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa0cf('0x7'));var controller=require(_0xa0cf('0x8'));router[_0xa0cf('0x9')]('/',auth[_0xa0cf('0xa')](),controller[_0xa0cf('0xb')]);router[_0xa0cf('0x9')](_0xa0cf('0xc'),auth[_0xa0cf('0xa')](),controller[_0xa0cf('0xd')]);router[_0xa0cf('0xe')]('/',auth[_0xa0cf('0xa')](),controller[_0xa0cf('0xf')]);router[_0xa0cf('0x10')](_0xa0cf('0xc'),auth[_0xa0cf('0xa')](),controller['update']);router[_0xa0cf('0x11')](_0xa0cf('0xc'),auth['isAuthenticated'](),controller[_0xa0cf('0x12')]);module[_0xa0cf('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 1535cc5..93a4245 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 _0x1440=['picklist','STRING','exports','ENUM','string','customVariable'];(function(_0x3b7aa8,_0x3b3728){var _0x258bd2=function(_0x5e1a4b){while(--_0x5e1a4b){_0x3b7aa8['push'](_0x3b7aa8['shift']());}};_0x258bd2(++_0x3b3728);}(_0x1440,0x12e));var _0x0144=function(_0x31e878,_0x206e87){_0x31e878=_0x31e878-0x0;var _0x5e7ea5=_0x1440[_0x31e878];return _0x5e7ea5;};'use strict';var Sequelize=require('sequelize');module[_0x0144('0x0')]={'type':{'type':Sequelize[_0x0144('0x1')](_0x0144('0x2'),'variable',_0x0144('0x3'),'keyValue',_0x0144('0x4')),'defaultValue':_0x0144('0x2')},'content':{'type':Sequelize[_0x0144('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0144('0x1')](_0x0144('0x2'),'variable',_0x0144('0x3'))},'keyContent':{'type':Sequelize[_0x0144('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0144('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0144('0x5')]}}; \ No newline at end of file +var _0xc1e5=['exports','customVariable','keyValue','picklist','string','STRING','ENUM','sequelize'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xc1e5,0x87));var _0x5c1e=function(_0x24a15e,_0x4862ce){_0x24a15e=_0x24a15e-0x0;var _0x10256f=_0xc1e5[_0x24a15e];return _0x10256f;};'use strict';var Sequelize=require(_0x5c1e('0x0'));module[_0x5c1e('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x5c1e('0x2'),_0x5c1e('0x3'),_0x5c1e('0x4')),'defaultValue':_0x5c1e('0x5')},'content':{'type':Sequelize[_0x5c1e('0x6')]},'key':{'type':Sequelize[_0x5c1e('0x6')]},'keyType':{'type':Sequelize[_0x5c1e('0x7')]('string','variable',_0x5c1e('0x2'))},'keyContent':{'type':Sequelize[_0x5c1e('0x6')]},'idField':{'type':Sequelize[_0x5c1e('0x6')]},'nameField':{'type':Sequelize[_0x5c1e('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5c1e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 22237b8..b480adc 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 _0x16a6=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','error','stack','name','send','index','map','DeskField','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0x1427f8,_0x417f31){var _0x30a432=function(_0x1c5037){while(--_0x1c5037){_0x1427f8['push'](_0x1427f8['shift']());}};_0x30a432(++_0x417f31);}(_0x16a6,0x15c));var _0x616a=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x16a6[_0x26b80e];return _0x84a8a8;};'use strict';var emlformat=require(_0x616a('0x0'));var rimraf=require(_0x616a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x616a('0x2'));var rp=require(_0x616a('0x3'));var moment=require(_0x616a('0x4'));var BPromise=require(_0x616a('0x5'));var Mustache=require(_0x616a('0x6'));var util=require(_0x616a('0x7'));var path=require('path');var sox=require(_0x616a('0x8'));var csv=require(_0x616a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x616a('0xa'));var squel=require(_0x616a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x616a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x616a('0xd'));var Papa=require('papaparse');var Redis=require(_0x616a('0xe'));var authService=require(_0x616a('0xf'));var qs=require(_0x616a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x616a('0x11'));var logger=require(_0x616a('0x12'))(_0x616a('0x13'));var utils=require(_0x616a('0x14'));var config=require(_0x616a('0x15'));var licenseUtil=require(_0x616a('0x16'));var db=require(_0x616a('0x17'))['db'];function respondWithStatusCode(_0x4122b7,_0x5755c7){_0x5755c7=_0x5755c7||0xcc;return function(_0x318dfe){if(_0x318dfe){return _0x4122b7[_0x616a('0x18')](_0x5755c7);}return _0x4122b7[_0x616a('0x19')](_0x5755c7)[_0x616a('0x1a')]();};}function respondWithResult(_0x295fc2,_0x4a33d5){_0x4a33d5=_0x4a33d5||0xc8;return function(_0x1399c1){if(_0x1399c1){return _0x295fc2[_0x616a('0x19')](_0x4a33d5)[_0x616a('0x1b')](_0x1399c1);}};}function respondWithFilteredResult(_0x18b6dc,_0x3bcf20){return function(_0x53f228){if(_0x53f228){var _0x204e68=typeof _0x3bcf20[_0x616a('0x1c')]==='undefined'&&typeof _0x3bcf20['limit']===_0x616a('0x1d');var _0x4768b2=_0x53f228[_0x616a('0x1e')];var _0x4d59e7=_0x204e68?0x0:_0x3bcf20[_0x616a('0x1c')];var _0x1f3241=_0x204e68?_0x53f228['count']:_0x3bcf20['offset']+_0x3bcf20[_0x616a('0x1f')];var _0x27e95c;if(_0x1f3241>=_0x4768b2){_0x1f3241=_0x4768b2;_0x27e95c=0xc8;}else{_0x27e95c=0xce;}_0x18b6dc[_0x616a('0x19')](_0x27e95c);return _0x18b6dc[_0x616a('0x20')]('Content-Range',_0x4d59e7+'-'+_0x1f3241+'/'+_0x4768b2)['json'](_0x53f228);}return null;};}function patchUpdates(_0x5568fd){return function(_0x5f2e80){try{jsonpatch['apply'](_0x5f2e80,_0x5568fd,!![]);}catch(_0x5ee3f2){return BPromise[_0x616a('0x21')](_0x5ee3f2);}return _0x5f2e80['save']();};}function saveUpdates(_0xb8ceeb,_0x137974){return function(_0x4f5594){if(_0x4f5594){return _0x4f5594[_0x616a('0x22')](_0xb8ceeb)[_0x616a('0x23')](function(_0x3d484b){return _0x3d484b;});}return null;};}function removeEntity(_0x100c98,_0x500c22){return function(_0x2db2bb){if(_0x2db2bb){return _0x2db2bb[_0x616a('0x24')]()[_0x616a('0x23')](function(){_0x100c98[_0x616a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e11f2,_0x4be8a8){return function(_0x30c1a){if(!_0x30c1a){_0x3e11f2[_0x616a('0x18')](0x194);}return _0x30c1a;};}function handleError(_0x5f1e6a,_0x55abc8){_0x55abc8=_0x55abc8||0x1f4;return function(_0x50c6b8){logger[_0x616a('0x25')](_0x50c6b8[_0x616a('0x26')]);if(_0x50c6b8[_0x616a('0x27')]){delete _0x50c6b8[_0x616a('0x27')];}_0x5f1e6a['status'](_0x55abc8)[_0x616a('0x28')](_0x50c6b8);};}exports[_0x616a('0x29')]=function(_0x195b73,_0x163fd0){var _0x28ca50={},_0x87db00={},_0x41a22d={'count':0x0,'rows':[]};var _0x5f3a59=_[_0x616a('0x2a')](db[_0x616a('0x2b')]['rawAttributes'],function(_0x41f722){return{'name':_0x41f722['fieldName'],'type':_0x41f722['type'][_0x616a('0x2c')]};});_0x87db00[_0x616a('0x2d')]=_[_0x616a('0x2a')](_0x5f3a59,'name');_0x87db00[_0x616a('0x2e')]=_[_0x616a('0x2f')](_0x195b73[_0x616a('0x2e')]);_0x87db00[_0x616a('0x30')]=_[_0x616a('0x31')](_0x87db00[_0x616a('0x2d')],_0x87db00['query']);_0x28ca50[_0x616a('0x32')]=_['intersection'](_0x87db00[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x195b73[_0x616a('0x2e')]['fields']));_0x28ca50[_0x616a('0x32')]=_0x28ca50[_0x616a('0x32')]['length']?_0x28ca50['attributes']:_0x87db00[_0x616a('0x2d')];if(!_0x195b73[_0x616a('0x2e')][_0x616a('0x34')](_0x616a('0x35'))){_0x28ca50['limit']=qs['limit'](_0x195b73['query'][_0x616a('0x1f')]);_0x28ca50[_0x616a('0x1c')]=qs[_0x616a('0x1c')](_0x195b73[_0x616a('0x2e')][_0x616a('0x1c')]);}_0x28ca50[_0x616a('0x36')]=qs[_0x616a('0x37')](_0x195b73[_0x616a('0x2e')][_0x616a('0x37')]);_0x28ca50[_0x616a('0x38')]=qs['filters'](_[_0x616a('0x39')](_0x195b73['query'],_0x87db00[_0x616a('0x30')]),_0x5f3a59);if(_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]){_0x28ca50[_0x616a('0x38')]=_[_0x616a('0x3b')](_0x28ca50[_0x616a('0x38')],{'$or':_[_0x616a('0x2a')](_0x5f3a59,function(_0x220c32){if(_0x220c32[_0x616a('0x3c')]!=='VIRTUAL'){var _0x304e27={};_0x304e27[_0x220c32[_0x616a('0x27')]]={'$like':'%'+_0x195b73[_0x616a('0x2e')][_0x616a('0x3a')]+'%'};return _0x304e27;}})});}_0x28ca50=_['merge']({},_0x28ca50,_0x195b73[_0x616a('0x3d')]);var _0x4c6a76={'where':_0x28ca50[_0x616a('0x38')]};return db['DeskField'][_0x616a('0x1e')](_0x4c6a76)[_0x616a('0x23')](function(_0x598085){_0x41a22d[_0x616a('0x1e')]=_0x598085;if(_0x195b73['query'][_0x616a('0x3e')]){_0x28ca50[_0x616a('0x3f')]=[{'all':!![]}];}return db[_0x616a('0x2b')][_0x616a('0x40')](_0x28ca50);})[_0x616a('0x23')](function(_0x21fd2b){_0x41a22d[_0x616a('0x41')]=_0x21fd2b;return _0x41a22d;})['then'](respondWithFilteredResult(_0x163fd0,_0x28ca50))[_0x616a('0x42')](handleError(_0x163fd0,null));};exports['show']=function(_0x409689,_0x35e3e3){var _0x199140={'raw':!![],'where':{'id':_0x409689[_0x616a('0x43')]['id']}},_0x4dbb8b={};_0x4dbb8b[_0x616a('0x2d')]=_[_0x616a('0x2f')](db[_0x616a('0x2b')][_0x616a('0x44')]);_0x4dbb8b['query']=_[_0x616a('0x2f')](_0x409689[_0x616a('0x2e')]);_0x4dbb8b[_0x616a('0x30')]=_['intersection'](_0x4dbb8b[_0x616a('0x2d')],_0x4dbb8b[_0x616a('0x2e')]);_0x199140[_0x616a('0x32')]=_[_0x616a('0x31')](_0x4dbb8b[_0x616a('0x2d')],qs[_0x616a('0x33')](_0x409689[_0x616a('0x2e')]['fields']));_0x199140[_0x616a('0x32')]=_0x199140[_0x616a('0x32')]['length']?_0x199140['attributes']:_0x4dbb8b[_0x616a('0x2d')];if(_0x409689[_0x616a('0x2e')][_0x616a('0x3e')]){_0x199140[_0x616a('0x3f')]=[{'all':!![]}];}_0x199140=_[_0x616a('0x3b')]({},_0x199140,_0x409689[_0x616a('0x3d')]);return db['DeskField'][_0x616a('0x45')](_0x199140)[_0x616a('0x23')](handleEntityNotFound(_0x35e3e3,null))[_0x616a('0x23')](respondWithResult(_0x35e3e3,null))['catch'](handleError(_0x35e3e3,null));};exports[_0x616a('0x46')]=function(_0x507efa,_0x52d38){return db[_0x616a('0x2b')][_0x616a('0x46')](_0x507efa[_0x616a('0x47')],{})['then'](respondWithResult(_0x52d38,0xc9))[_0x616a('0x42')](handleError(_0x52d38,null));};exports[_0x616a('0x22')]=function(_0x3bea90,_0x3d42fc){if(_0x3bea90[_0x616a('0x47')]['id']){delete _0x3bea90['body']['id'];}return db[_0x616a('0x2b')][_0x616a('0x45')]({'where':{'id':_0x3bea90[_0x616a('0x43')]['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x3d42fc,null))[_0x616a('0x23')](saveUpdates(_0x3bea90[_0x616a('0x47')],null))['then'](respondWithResult(_0x3d42fc,null))[_0x616a('0x42')](handleError(_0x3d42fc,null));};exports[_0x616a('0x24')]=function(_0x349cd0,_0x16e6c2){return db['DeskField'][_0x616a('0x45')]({'where':{'id':_0x349cd0['params']['id']}})[_0x616a('0x23')](handleEntityNotFound(_0x16e6c2,null))[_0x616a('0x23')](removeEntity(_0x16e6c2,null))['catch'](handleError(_0x16e6c2,null));}; \ No newline at end of file +var _0xf360=['limit','order','sort','where','filters','pick','filter','merge','type','options','DeskField','includeAll','include','rows','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x1f7120,_0x53456a){var _0x512142=function(_0xae9761){while(--_0xae9761){_0x1f7120['push'](_0x1f7120['shift']());}};_0x512142(++_0x53456a);}(_0xf360,0x13c));var _0x0f36=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf360[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x0f36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0f36('0x1'));var jsonpatch=require(_0x0f36('0x2'));var rp=require(_0x0f36('0x3'));var moment=require(_0x0f36('0x4'));var BPromise=require(_0x0f36('0x5'));var Mustache=require('mustache');var util=require(_0x0f36('0x6'));var path=require(_0x0f36('0x7'));var sox=require(_0x0f36('0x8'));var csv=require(_0x0f36('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f36('0xa'));var _=require(_0x0f36('0xb'));var squel=require(_0x0f36('0xc'));var crypto=require(_0x0f36('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f36('0xe'));var toCsv=require(_0x0f36('0x9'));var querystring=require('querystring');var Papa=require(_0x0f36('0xf'));var Redis=require(_0x0f36('0x10'));var authService=require(_0x0f36('0x11'));var qs=require(_0x0f36('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f36('0x13'));var logger=require(_0x0f36('0x14'))(_0x0f36('0x15'));var utils=require(_0x0f36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0f36('0x17'))['db'];function respondWithStatusCode(_0x3427eb,_0x37f9cf){_0x37f9cf=_0x37f9cf||0xcc;return function(_0x3b4852){if(_0x3b4852){return _0x3427eb['sendStatus'](_0x37f9cf);}return _0x3427eb[_0x0f36('0x18')](_0x37f9cf)['end']();};}function respondWithResult(_0x532fea,_0x2bd012){_0x2bd012=_0x2bd012||0xc8;return function(_0x5435ec){if(_0x5435ec){return _0x532fea[_0x0f36('0x18')](_0x2bd012)[_0x0f36('0x19')](_0x5435ec);}};}function respondWithFilteredResult(_0x17980a,_0x4462e0){return function(_0x3c85b8){if(_0x3c85b8){var _0x40721a=typeof _0x4462e0['offset']===_0x0f36('0x1a')&&typeof _0x4462e0['limit']===_0x0f36('0x1a');var _0x1a0070=_0x3c85b8[_0x0f36('0x1b')];var _0x3b6956=_0x40721a?0x0:_0x4462e0[_0x0f36('0x1c')];var _0x7e27c1=_0x40721a?_0x3c85b8[_0x0f36('0x1b')]:_0x4462e0['offset']+_0x4462e0['limit'];var _0x41daa4;if(_0x7e27c1>=_0x1a0070){_0x7e27c1=_0x1a0070;_0x41daa4=0xc8;}else{_0x41daa4=0xce;}_0x17980a[_0x0f36('0x18')](_0x41daa4);return _0x17980a[_0x0f36('0x1d')](_0x0f36('0x1e'),_0x3b6956+'-'+_0x7e27c1+'/'+_0x1a0070)[_0x0f36('0x19')](_0x3c85b8);}return null;};}function patchUpdates(_0x507541){return function(_0x634bd2){try{jsonpatch[_0x0f36('0x1f')](_0x634bd2,_0x507541,!![]);}catch(_0x325849){return BPromise[_0x0f36('0x20')](_0x325849);}return _0x634bd2[_0x0f36('0x21')]();};}function saveUpdates(_0x59fccb,_0x18c1d6){return function(_0x20f999){if(_0x20f999){return _0x20f999[_0x0f36('0x22')](_0x59fccb)[_0x0f36('0x23')](function(_0x4cc2cd){return _0x4cc2cd;});}return null;};}function removeEntity(_0x1a3c54,_0x1de3fc){return function(_0x11cf86){if(_0x11cf86){return _0x11cf86[_0x0f36('0x24')]()[_0x0f36('0x23')](function(){_0x1a3c54[_0x0f36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2690b,_0x382a85){return function(_0x2a55e9){if(!_0x2a55e9){_0xe2690b[_0x0f36('0x25')](0x194);}return _0x2a55e9;};}function handleError(_0x24b785,_0x374c27){_0x374c27=_0x374c27||0x1f4;return function(_0x283d2e){logger['error'](_0x283d2e[_0x0f36('0x26')]);if(_0x283d2e[_0x0f36('0x27')]){delete _0x283d2e['name'];}_0x24b785[_0x0f36('0x18')](_0x374c27)[_0x0f36('0x28')](_0x283d2e);};}exports[_0x0f36('0x29')]=function(_0x137568,_0x362c0d){var _0x68b82a={},_0x42119d={},_0x3cfd9a={'count':0x0,'rows':[]};var _0x521b40=_[_0x0f36('0x2a')](db['DeskField'][_0x0f36('0x2b')],function(_0x4aadef){return{'name':_0x4aadef['fieldName'],'type':_0x4aadef['type'][_0x0f36('0x2c')]};});_0x42119d[_0x0f36('0x2d')]=_[_0x0f36('0x2a')](_0x521b40,_0x0f36('0x27'));_0x42119d[_0x0f36('0x2e')]=_[_0x0f36('0x2f')](_0x137568[_0x0f36('0x2e')]);_0x42119d['filters']=_[_0x0f36('0x30')](_0x42119d[_0x0f36('0x2d')],_0x42119d[_0x0f36('0x2e')]);_0x68b82a['attributes']=_['intersection'](_0x42119d[_0x0f36('0x2d')],qs[_0x0f36('0x31')](_0x137568[_0x0f36('0x2e')][_0x0f36('0x31')]));_0x68b82a['attributes']=_0x68b82a[_0x0f36('0x32')][_0x0f36('0x33')]?_0x68b82a[_0x0f36('0x32')]:_0x42119d[_0x0f36('0x2d')];if(!_0x137568[_0x0f36('0x2e')][_0x0f36('0x34')](_0x0f36('0x35'))){_0x68b82a[_0x0f36('0x36')]=qs['limit'](_0x137568[_0x0f36('0x2e')]['limit']);_0x68b82a[_0x0f36('0x1c')]=qs['offset'](_0x137568[_0x0f36('0x2e')][_0x0f36('0x1c')]);}_0x68b82a[_0x0f36('0x37')]=qs[_0x0f36('0x38')](_0x137568['query'][_0x0f36('0x38')]);_0x68b82a[_0x0f36('0x39')]=qs[_0x0f36('0x3a')](_[_0x0f36('0x3b')](_0x137568[_0x0f36('0x2e')],_0x42119d[_0x0f36('0x3a')]),_0x521b40);if(_0x137568[_0x0f36('0x2e')][_0x0f36('0x3c')]){_0x68b82a[_0x0f36('0x39')]=_[_0x0f36('0x3d')](_0x68b82a[_0x0f36('0x39')],{'$or':_[_0x0f36('0x2a')](_0x521b40,function(_0xe2456d){if(_0xe2456d[_0x0f36('0x3e')]!=='VIRTUAL'){var _0x15e833={};_0x15e833[_0xe2456d[_0x0f36('0x27')]]={'$like':'%'+_0x137568[_0x0f36('0x2e')][_0x0f36('0x3c')]+'%'};return _0x15e833;}})});}_0x68b82a=_[_0x0f36('0x3d')]({},_0x68b82a,_0x137568[_0x0f36('0x3f')]);var _0xf70e2a={'where':_0x68b82a[_0x0f36('0x39')]};return db[_0x0f36('0x40')][_0x0f36('0x1b')](_0xf70e2a)[_0x0f36('0x23')](function(_0x5f14ac){_0x3cfd9a[_0x0f36('0x1b')]=_0x5f14ac;if(_0x137568[_0x0f36('0x2e')][_0x0f36('0x41')]){_0x68b82a[_0x0f36('0x42')]=[{'all':!![]}];}return db[_0x0f36('0x40')]['findAll'](_0x68b82a);})[_0x0f36('0x23')](function(_0x3fe641){_0x3cfd9a[_0x0f36('0x43')]=_0x3fe641;return _0x3cfd9a;})[_0x0f36('0x23')](respondWithFilteredResult(_0x362c0d,_0x68b82a))[_0x0f36('0x44')](handleError(_0x362c0d,null));};exports[_0x0f36('0x45')]=function(_0x135878,_0x67fd0d){var _0x59d496={'raw':!![],'where':{'id':_0x135878['params']['id']}},_0x358bab={};_0x358bab[_0x0f36('0x2d')]=_[_0x0f36('0x2f')](db['DeskField'][_0x0f36('0x2b')]);_0x358bab[_0x0f36('0x2e')]=_['keys'](_0x135878[_0x0f36('0x2e')]);_0x358bab[_0x0f36('0x3a')]=_[_0x0f36('0x30')](_0x358bab[_0x0f36('0x2d')],_0x358bab[_0x0f36('0x2e')]);_0x59d496[_0x0f36('0x32')]=_['intersection'](_0x358bab['model'],qs[_0x0f36('0x31')](_0x135878['query'][_0x0f36('0x31')]));_0x59d496['attributes']=_0x59d496[_0x0f36('0x32')][_0x0f36('0x33')]?_0x59d496[_0x0f36('0x32')]:_0x358bab['model'];if(_0x135878[_0x0f36('0x2e')][_0x0f36('0x41')]){_0x59d496[_0x0f36('0x42')]=[{'all':!![]}];}_0x59d496=_[_0x0f36('0x3d')]({},_0x59d496,_0x135878[_0x0f36('0x3f')]);return db[_0x0f36('0x40')][_0x0f36('0x46')](_0x59d496)[_0x0f36('0x23')](handleEntityNotFound(_0x67fd0d,null))[_0x0f36('0x23')](respondWithResult(_0x67fd0d,null))[_0x0f36('0x44')](handleError(_0x67fd0d,null));};exports[_0x0f36('0x47')]=function(_0x133106,_0x553b5e){return db[_0x0f36('0x40')][_0x0f36('0x47')](_0x133106[_0x0f36('0x48')],{})[_0x0f36('0x23')](respondWithResult(_0x553b5e,0xc9))[_0x0f36('0x44')](handleError(_0x553b5e,null));};exports['update']=function(_0x29c369,_0x228d46){if(_0x29c369[_0x0f36('0x48')]['id']){delete _0x29c369[_0x0f36('0x48')]['id'];}return db[_0x0f36('0x40')][_0x0f36('0x46')]({'where':{'id':_0x29c369[_0x0f36('0x49')]['id']}})[_0x0f36('0x23')](handleEntityNotFound(_0x228d46,null))['then'](saveUpdates(_0x29c369[_0x0f36('0x48')],null))[_0x0f36('0x23')](respondWithResult(_0x228d46,null))[_0x0f36('0x44')](handleError(_0x228d46,null));};exports[_0x0f36('0x24')]=function(_0x1c6bfa,_0x1ecf9d){return db['DeskField'][_0x0f36('0x46')]({'where':{'id':_0x1c6bfa['params']['id']}})[_0x0f36('0x23')](handleEntityNotFound(_0x1ecf9d,null))[_0x0f36('0x23')](removeEntity(_0x1ecf9d,null))[_0x0f36('0x44')](handleError(_0x1ecf9d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 1c33399..2863137 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 _0x70ca=['path','rimraf','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x70ca,0x6a));var _0xa70c=function(_0x376ef9,_0xe35335){_0x376ef9=_0x376ef9-0x0;var _0x33fcaa=_0x70ca[_0x376ef9];return _0x33fcaa;};'use strict';var _=require(_0xa70c('0x0'));var util=require(_0xa70c('0x1'));var logger=require(_0xa70c('0x2'))(_0xa70c('0x3'));var moment=require(_0xa70c('0x4'));var BPromise=require(_0xa70c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa70c('0x6'));var rimraf=require(_0xa70c('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xa70c('0x8')]=function(_0x38c31c,_0x24004c){return _0x38c31c[_0xa70c('0x9')](_0xa70c('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa70c('0xb'),'fields':[_0xa70c('0xc'),_0xa70c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed71=['api','moment','request-promise','rimraf','desk_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x5a8225,_0x358770){var _0x395522=function(_0x4c9d48){while(--_0x4c9d48){_0x5a8225['push'](_0x5a8225['shift']());}};_0x395522(++_0x358770);}(_0xed71,0x1dd));var _0x1ed7=function(_0x1894e7,_0x1253e6){_0x1894e7=_0x1894e7-0x0;var _0x5e857f=_0xed71[_0x1894e7];return _0x5e857f;};'use strict';var _=require(_0x1ed7('0x0'));var util=require(_0x1ed7('0x1'));var logger=require(_0x1ed7('0x2'))(_0x1ed7('0x3'));var moment=require(_0x1ed7('0x4'));var BPromise=require('bluebird');var rp=require(_0x1ed7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ed7('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x4d8146,_0xb92096){return _0x4d8146['define']('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x1ed7('0x7'),'fields':[_0x1ed7('0x8'),_0x1ed7('0x9')],'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 df41317..50b9a7d 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 _0xdc26=['client','http','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0xdc26,0x1dd));var _0x6dc2=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0xdc26[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0x6dc2('0x0'));var util=require(_0x6dc2('0x1'));var moment=require(_0x6dc2('0x2'));var BPromise=require(_0x6dc2('0x3'));var rs=require(_0x6dc2('0x4'));var fs=require('fs');var Redis=require(_0x6dc2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6dc2('0x6'));var logger=require(_0x6dc2('0x7'))(_0x6dc2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6dc2('0x9')][_0x6dc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bb95c,_0x50b638,_0x4eaffa){return new BPromise(function(_0x4a82b0,_0x20ab05){return client['request'](_0x3bb95c,_0x4eaffa)['then'](function(_0x42cf57){logger[_0x6dc2('0xb')](_0x6dc2('0xc'),_0x50b638,'request\x20sent');logger[_0x6dc2('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x50b638,_0x6dc2('0xe'),JSON['stringify'](_0x42cf57));if(_0x42cf57[_0x6dc2('0xf')]){if(_0x42cf57[_0x6dc2('0xf')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x50b638,_0x42cf57['error'][_0x6dc2('0x10')]);return _0x20ab05(_0x42cf57[_0x6dc2('0xf')][_0x6dc2('0x10')]);}logger[_0x6dc2('0xf')]('DeskField,\x20%s,\x20%s',_0x50b638,_0x42cf57[_0x6dc2('0xf')][_0x6dc2('0x10')]);return _0x4a82b0(_0x42cf57['error'][_0x6dc2('0x10')]);}else{logger['info'](_0x6dc2('0xc'),_0x50b638,_0x6dc2('0xe'));_0x4a82b0(_0x42cf57['result']['message']);}})[_0x6dc2('0x11')](function(_0x492024){logger[_0x6dc2('0xf')]('DeskField,\x20%s,\x20%s',_0x50b638,_0x492024);_0x20ab05(_0x492024);});});} \ No newline at end of file +var _0xad07=['../../config/utils','rpc','jayson/promise','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x42a203,_0x478efa){var _0x5dece4=function(_0x4acf0b){while(--_0x4acf0b){_0x42a203['push'](_0x42a203['shift']());}};_0x5dece4(++_0x478efa);}(_0xad07,0x19e));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require('util');var moment=require(_0x7ad0('0x1'));var BPromise=require(_0x7ad0('0x2'));var rs=require(_0x7ad0('0x3'));var fs=require('fs');var Redis=require(_0x7ad0('0x4'));var db=require(_0x7ad0('0x5'))['db'];var utils=require(_0x7ad0('0x6'));var logger=require('../../config/logger')(_0x7ad0('0x7'));var config=require('../../config/environment');var jayson=require(_0x7ad0('0x8'));var client=jayson['client'][_0x7ad0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa43618,_0xde8568,_0x71fcd1){return new BPromise(function(_0x58c479,_0xa4431c){return client['request'](_0xa43618,_0x71fcd1)[_0x7ad0('0xa')](function(_0x12674a){logger[_0x7ad0('0xb')](_0x7ad0('0xc'),_0xde8568,_0x7ad0('0xd'));logger['debug'](_0x7ad0('0xe'),_0xde8568,_0x7ad0('0xd'),JSON[_0x7ad0('0xf')](_0x12674a));if(_0x12674a['error']){if(_0x12674a[_0x7ad0('0x10')][_0x7ad0('0x11')]===0x1f4){logger[_0x7ad0('0x10')](_0x7ad0('0xc'),_0xde8568,_0x12674a[_0x7ad0('0x10')][_0x7ad0('0x12')]);return _0xa4431c(_0x12674a[_0x7ad0('0x10')][_0x7ad0('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0xde8568,_0x12674a[_0x7ad0('0x10')][_0x7ad0('0x12')]);return _0x58c479(_0x12674a[_0x7ad0('0x10')]['message']);}else{logger[_0x7ad0('0xb')](_0x7ad0('0xc'),_0xde8568,_0x7ad0('0xd'));_0x58c479(_0x12674a[_0x7ad0('0x13')][_0x7ad0('0x12')]);}})[_0x7ad0('0x14')](function(_0x52ebcc){logger[_0x7ad0('0x10')](_0x7ad0('0xc'),_0xde8568,_0x52ebcc);_0xa4431c(_0x52ebcc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7605301..09cdb25 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 _0x4861=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete'];(function(_0x40bcc2,_0x124a63){var _0x346747=function(_0x1521c9){while(--_0x1521c9){_0x40bcc2['push'](_0x40bcc2['shift']());}};_0x346747(++_0x124a63);}(_0x4861,0x105));var _0x1486=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4861[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x1486('0x0'));var util=require(_0x1486('0x1'));var path=require(_0x1486('0x2'));var timeout=require(_0x1486('0x3'));var express=require(_0x1486('0x4'));var router=express[_0x1486('0x5')]();var fs_extra=require(_0x1486('0x6'));var auth=require(_0x1486('0x7'));var interaction=require(_0x1486('0x8'));var config=require(_0x1486('0x9'));var controller=require(_0x1486('0xa'));router[_0x1486('0xb')]('/',auth[_0x1486('0xc')](),controller[_0x1486('0xd')]);router[_0x1486('0xb')](_0x1486('0xe'),auth[_0x1486('0xc')](),controller[_0x1486('0xf')]);router[_0x1486('0xb')](_0x1486('0x10'),auth[_0x1486('0xc')](),controller[_0x1486('0x11')]);router[_0x1486('0xb')](_0x1486('0x12'),auth[_0x1486('0xc')](),controller['getFields']);router[_0x1486('0x13')]('/',auth[_0x1486('0xc')](),controller[_0x1486('0x14')]);router[_0x1486('0x13')](_0x1486('0x10'),auth['isAuthenticated'](),controller[_0x1486('0x15')]);router[_0x1486('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x1486('0x17')]);router[_0x1486('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x1486('0x19')]);module['exports']=router; \ No newline at end of file +var _0x2695=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x224267,_0x351e35){var _0x3d03cf=function(_0xee3a21){while(--_0xee3a21){_0x224267['push'](_0x224267['shift']());}};_0x3d03cf(++_0x351e35);}(_0x2695,0x109));var _0x5269=function(_0x5598ef,_0x52cf9d){_0x5598ef=_0x5598ef-0x0;var _0x445c55=_0x2695[_0x5598ef];return _0x445c55;};'use strict';var multer=require('multer');var util=require(_0x5269('0x0'));var path=require(_0x5269('0x1'));var timeout=require('connect-timeout');var express=require(_0x5269('0x2'));var router=express[_0x5269('0x3')]();var fs_extra=require(_0x5269('0x4'));var auth=require(_0x5269('0x5'));var interaction=require(_0x5269('0x6'));var config=require(_0x5269('0x7'));var controller=require(_0x5269('0x8'));router[_0x5269('0x9')]('/',auth[_0x5269('0xa')](),controller[_0x5269('0xb')]);router[_0x5269('0x9')](_0x5269('0xc'),auth[_0x5269('0xa')](),controller[_0x5269('0xd')]);router['get'](_0x5269('0xe'),auth['isAuthenticated'](),controller[_0x5269('0xf')]);router[_0x5269('0x9')](_0x5269('0x10'),auth[_0x5269('0xa')](),controller[_0x5269('0x11')]);router[_0x5269('0x12')]('/',auth[_0x5269('0xa')](),controller[_0x5269('0x13')]);router[_0x5269('0x12')](_0x5269('0xe'),auth[_0x5269('0xa')](),controller[_0x5269('0x14')]);router['put'](_0x5269('0xc'),auth[_0x5269('0xa')](),controller[_0x5269('0x15')]);router[_0x5269('0x16')](_0x5269('0xc'),auth[_0x5269('0xa')](),controller[_0x5269('0x17')]);module[_0x5269('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 57ce296..d485e8f 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 _0xd45e=['STRING','BOOLEAN','exports'];(function(_0x3db5e2,_0x52044d){var _0x27fa71=function(_0x22a98c){while(--_0x22a98c){_0x3db5e2['push'](_0x3db5e2['shift']());}};_0x27fa71(++_0x52044d);}(_0xd45e,0x182));var _0xed45=function(_0x19f716,_0x498681){_0x19f716=_0x19f716-0x0;var _0xfaa946=_0xd45e[_0x19f716];return _0xfaa946;};'use strict';var Sequelize=require('sequelize');module[_0xed45('0x0')]={'name':{'type':Sequelize[_0xed45('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xed45('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xed45('0x1')]},'clientId':{'type':Sequelize[_0xed45('0x1')]},'clientSecret':{'type':Sequelize[_0xed45('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xed45('0x1')]},'modernAuthentication':{'type':Sequelize[_0xed45('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe002=['exports','STRING','BOOLEAN','sequelize'];(function(_0x535130,_0x2a40a0){var _0x129526=function(_0x11b3a1){while(--_0x11b3a1){_0x535130['push'](_0x535130['shift']());}};_0x129526(++_0x2a40a0);}(_0xe002,0xf7));var _0x2e00=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0xe002[_0x3238ea];return _0x4aaac2;};'use strict';var Sequelize=require(_0x2e00('0x0'));module[_0x2e00('0x1')]={'name':{'type':Sequelize[_0x2e00('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2e00('0x2')]},'remoteUri':{'type':Sequelize[_0x2e00('0x2')]},'tenantId':{'type':Sequelize[_0x2e00('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x2e00('0x2')]},'serverUrl':{'type':Sequelize[_0x2e00('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2e00('0x2')]},'modernAuthentication':{'type':Sequelize[_0x2e00('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 9edd9cd..56d7185 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 _0x66e2=['Incident','title','description','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','MetadataId','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','UserLocalizedLabel','Label','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','options','includeAll','include','rows','catch','params','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','order','pick','merge','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType'];(function(_0x20b00e,_0x4ff2f7){var _0x55cae3=function(_0x1ecba0){while(--_0x1ecba0){_0x20b00e['push'](_0x20b00e['shift']());}};_0x55cae3(++_0x4ff2f7);}(_0x66e2,0x74));var _0x266e=function(_0x48fd24,_0x13fa0b){_0x48fd24=_0x48fd24-0x0;var _0x2edb3a=_0x66e2[_0x48fd24];return _0x2edb3a;};'use strict';var rp=require('request-promise');var util=require(_0x266e('0x0'));var _=require(_0x266e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x266e('0x2'))('api');var db=require(_0x266e('0x3'))['db'];var integrations=require(_0x266e('0x4'));function respondWithResult(_0x51a2fb,_0x381e95){_0x381e95=_0x381e95||0xc8;return function(_0x222245){if(_0x222245){return _0x51a2fb[_0x266e('0x5')](_0x381e95)[_0x266e('0x6')](_0x222245);}};}function respondWithFilteredResult(_0x4ac1fa,_0xc07efd){return function(_0x331073){if(_0x331073){var _0x191a31=typeof _0xc07efd[_0x266e('0x7')]===_0x266e('0x8')&&typeof _0xc07efd[_0x266e('0x9')]===_0x266e('0x8');var _0x464156=_0x331073['count'];var _0x4dd2ef=_0x191a31?0x0:_0xc07efd[_0x266e('0x7')];var _0x50c1ca=_0x191a31?_0x331073[_0x266e('0xa')]:_0xc07efd[_0x266e('0x7')]+_0xc07efd['limit'];var _0x3fa839;if(_0x50c1ca>=_0x464156){_0x50c1ca=_0x464156;_0x3fa839=0xc8;}else{_0x3fa839=0xce;}_0x4ac1fa[_0x266e('0x5')](_0x3fa839);return _0x4ac1fa[_0x266e('0xb')](_0x266e('0xc'),_0x4dd2ef+'-'+_0x50c1ca+'/'+_0x464156)[_0x266e('0x6')](_0x331073);}return null;};}function saveUpdates(_0x5c95c3){return function(_0x2c1393){if(_0x2c1393){return _0x2c1393['update'](_0x5c95c3)['then'](function(_0x1e3ea4){return _0x1e3ea4;});}return null;};}function removeEntity(_0x15ea24){return function(_0x51f92a){if(_0x51f92a){return _0x51f92a['destroy']()[_0x266e('0xd')](function(){_0x15ea24[_0x266e('0x5')](0xcc)[_0x266e('0xe')]();});}};}function handleEntityNotFound(_0x32c3e7){return function(_0x34862e){if(!_0x34862e){_0x32c3e7[_0x266e('0xf')](0x194);}return _0x34862e;};}function handleError(_0x646a4d,_0x354257){_0x354257=_0x354257||0x1f4;return function(_0x46b1a1){logger[_0x266e('0x10')](_0x46b1a1[_0x266e('0x11')]);if(_0x46b1a1['name']){delete _0x46b1a1[_0x266e('0x12')];}_0x646a4d[_0x266e('0x5')](_0x354257)[_0x266e('0x13')](_0x46b1a1);};}exports[_0x266e('0x14')]=function(_0x3d3ec0,_0x2158f7){var _0x10b2ae={},_0x2b56fd={},_0x3b1394={'count':0x0,'rows':[]};var _0x23b058=_[_0x266e('0x15')](db[_0x266e('0x16')][_0x266e('0x17')],function(_0x5aaaf2){return{'name':_0x5aaaf2['fieldName'],'type':_0x5aaaf2[_0x266e('0x18')][_0x266e('0x19')]};});_0x2b56fd['model']=_[_0x266e('0x15')](_0x23b058,_0x266e('0x12'));_0x2b56fd[_0x266e('0x1a')]=_[_0x266e('0x1b')](_0x3d3ec0[_0x266e('0x1a')]);_0x2b56fd[_0x266e('0x1c')]=_[_0x266e('0x1d')](_0x2b56fd[_0x266e('0x1e')],_0x2b56fd[_0x266e('0x1a')]);_0x10b2ae[_0x266e('0x1f')]=_[_0x266e('0x1d')](_0x2b56fd['model'],qs[_0x266e('0x20')](_0x3d3ec0[_0x266e('0x1a')]['fields']));_0x10b2ae[_0x266e('0x1f')]=_0x10b2ae['attributes'][_0x266e('0x21')]?_0x10b2ae['attributes']:_0x2b56fd['model'];if(!_0x3d3ec0[_0x266e('0x1a')][_0x266e('0x22')](_0x266e('0x23'))){_0x10b2ae[_0x266e('0x9')]=qs[_0x266e('0x9')](_0x3d3ec0[_0x266e('0x1a')]['limit']);_0x10b2ae[_0x266e('0x7')]=qs['offset'](_0x3d3ec0[_0x266e('0x1a')][_0x266e('0x7')]);}_0x10b2ae['order']=qs[_0x266e('0x24')](_0x3d3ec0['query']['sort']);_0x10b2ae[_0x266e('0x25')]=qs['filters'](_['pick'](_0x3d3ec0[_0x266e('0x1a')],_0x2b56fd[_0x266e('0x1c')]),_0x23b058);if(_0x3d3ec0[_0x266e('0x1a')][_0x266e('0x26')]){_0x10b2ae[_0x266e('0x25')]=_['merge'](_0x10b2ae[_0x266e('0x25')],{'$or':_['map'](_0x23b058,function(_0xde2767){if(_0xde2767['type']!=='VIRTUAL'){var _0x2ee3d3={};_0x2ee3d3[_0xde2767[_0x266e('0x12')]]={'$like':'%'+_0x3d3ec0[_0x266e('0x1a')]['filter']+'%'};return _0x2ee3d3;}})});}_0x10b2ae=_['merge']({},_0x10b2ae,_0x3d3ec0[_0x266e('0x27')]);var _0x15f863={'where':_0x10b2ae[_0x266e('0x25')]};return db[_0x266e('0x16')][_0x266e('0xa')](_0x15f863)['then'](function(_0x38a489){_0x3b1394[_0x266e('0xa')]=_0x38a489;if(_0x3d3ec0['query'][_0x266e('0x28')]){_0x10b2ae[_0x266e('0x29')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x10b2ae);})[_0x266e('0xd')](function(_0x2b7768){_0x3b1394[_0x266e('0x2a')]=_0x2b7768;return _0x3b1394;})[_0x266e('0xd')](respondWithFilteredResult(_0x2158f7,_0x10b2ae))[_0x266e('0x2b')](handleError(_0x2158f7,null));};exports['show']=function(_0x2fa415,_0x18e912){var _0x1b4bba={'raw':![],'where':{'id':_0x2fa415[_0x266e('0x2c')]['id']}},_0xcec6f8={};_0xcec6f8[_0x266e('0x1e')]=_[_0x266e('0x1b')](db[_0x266e('0x16')][_0x266e('0x17')]);_0xcec6f8['query']=_[_0x266e('0x1b')](_0x2fa415['query']);_0xcec6f8['filters']=_['intersection'](_0xcec6f8[_0x266e('0x1e')],_0xcec6f8[_0x266e('0x1a')]);_0x1b4bba[_0x266e('0x1f')]=_[_0x266e('0x1d')](_0xcec6f8[_0x266e('0x1e')],qs[_0x266e('0x20')](_0x2fa415['query'][_0x266e('0x20')]));_0x1b4bba[_0x266e('0x1f')]=_0x1b4bba[_0x266e('0x1f')]['length']?_0x1b4bba[_0x266e('0x1f')]:_0xcec6f8[_0x266e('0x1e')];if(_0x2fa415[_0x266e('0x1a')][_0x266e('0x28')]){_0x1b4bba[_0x266e('0x29')]=[{'all':!![]}];}_0x1b4bba=_['merge']({},_0x1b4bba,_0x2fa415[_0x266e('0x27')]);return db[_0x266e('0x16')][_0x266e('0x2d')](_0x1b4bba)['then'](handleEntityNotFound(_0x18e912,null))[_0x266e('0xd')](respondWithResult(_0x18e912,null))[_0x266e('0x2b')](handleError(_0x18e912,null));};exports[_0x266e('0x2e')]=function(_0xc1fb2c,_0x482d95){return db['Dynamics365Account'][_0x266e('0x2e')](_0xc1fb2c[_0x266e('0x2f')],{})[_0x266e('0xd')](respondWithResult(_0x482d95,0xc9))[_0x266e('0x2b')](handleError(_0x482d95,null));};exports[_0x266e('0x30')]=function(_0x47435b,_0x246899){if(_0x47435b[_0x266e('0x2f')]['id']){delete _0x47435b[_0x266e('0x2f')]['id'];}return db['Dynamics365Account'][_0x266e('0x2d')]({'where':{'id':_0x47435b[_0x266e('0x2c')]['id']}})[_0x266e('0xd')](handleEntityNotFound(_0x246899,null))['then'](saveUpdates(_0x47435b[_0x266e('0x2f')],null))[_0x266e('0xd')](respondWithResult(_0x246899,null))[_0x266e('0x2b')](handleError(_0x246899,null));};exports[_0x266e('0x31')]=function(_0x294b5e,_0x493131){return db[_0x266e('0x16')][_0x266e('0x2d')]({'where':{'id':_0x294b5e[_0x266e('0x2c')]['id']}})[_0x266e('0xd')](handleEntityNotFound(_0x493131,null))['then'](removeEntity(_0x493131,null))['catch'](handleError(_0x493131,null));};exports[_0x266e('0x32')]=function(_0x5d6b42,_0x515422){var _0x15533e={};var _0x120000={};var _0x41d2ed;var _0x2eb248;return db['Dynamics365Account']['findOne']({'where':{'id':_0x5d6b42['params']['id']}})['then'](handleEntityNotFound(_0x515422,null))[_0x266e('0xd')](function(_0x2439c7){if(_0x2439c7){_0x41d2ed=_0x2439c7;_0x120000[_0x266e('0x1e')]=_[_0x266e('0x1b')](db[_0x266e('0x33')][_0x266e('0x17')]);_0x120000[_0x266e('0x1a')]=_[_0x266e('0x1b')](_0x5d6b42[_0x266e('0x1a')]);_0x120000[_0x266e('0x1c')]=_[_0x266e('0x1d')](_0x120000[_0x266e('0x1e')],_0x120000[_0x266e('0x1a')]);_0x15533e['attributes']=_['intersection'](_0x120000[_0x266e('0x1e')],qs[_0x266e('0x20')](_0x5d6b42['query'][_0x266e('0x20')]));_0x15533e['attributes']=_0x15533e[_0x266e('0x1f')]['length']?_0x15533e[_0x266e('0x1f')]:_0x120000[_0x266e('0x1e')];_0x15533e[_0x266e('0x34')]=qs[_0x266e('0x24')](_0x5d6b42[_0x266e('0x1a')][_0x266e('0x24')]);_0x15533e[_0x266e('0x25')]=qs['filters'](_[_0x266e('0x35')](_0x5d6b42[_0x266e('0x1a')],_0x120000[_0x266e('0x1c')]));if(_0x5d6b42[_0x266e('0x1a')][_0x266e('0x26')]){_0x15533e[_0x266e('0x25')]=_[_0x266e('0x36')](_0x15533e[_0x266e('0x25')],{'$or':_['map'](_0x15533e[_0x266e('0x1f')],function(_0x39be8d){var _0x3ffba8={};_0x3ffba8[_0x39be8d]={'$like':'%'+_0x5d6b42['query']['filter']+'%'};return _0x3ffba8;})});}_0x15533e=_[_0x266e('0x36')]({},_0x15533e,_0x5d6b42[_0x266e('0x27')]);return _0x41d2ed[_0x266e('0x32')](_0x15533e);}})[_0x266e('0xd')](function(_0x159038){if(_0x159038){_0x2eb248=_0x159038[_0x266e('0x21')];if(!_0x5d6b42[_0x266e('0x1a')][_0x266e('0x22')]('nolimit')){_0x15533e['limit']=qs['limit'](_0x5d6b42[_0x266e('0x1a')]['limit']);_0x15533e[_0x266e('0x7')]=qs[_0x266e('0x7')](_0x5d6b42[_0x266e('0x1a')][_0x266e('0x7')]);}return _0x41d2ed['getConfigurations'](_0x15533e);}})[_0x266e('0xd')](function(_0x2a3e26){if(_0x2a3e26){return _0x2a3e26?{'count':_0x2eb248,'rows':_0x2a3e26}:null;}})[_0x266e('0xd')](respondWithResult(_0x515422,null))[_0x266e('0x2b')](handleError(_0x515422,null));};exports[_0x266e('0x37')]=function(_0x30fd69,_0x55aa72){if(_0x30fd69[_0x266e('0x2f')]['id']){delete _0x30fd69[_0x266e('0x2f')]['id'];}return db[_0x266e('0x16')][_0x266e('0x38')]({'where':{'id':_0x30fd69[_0x266e('0x2c')]['id']}})[_0x266e('0xd')](handleEntityNotFound(_0x55aa72,null))[_0x266e('0xd')](function(_0x25aea8){if(_0x25aea8){_0x30fd69[_0x266e('0x2f')][_0x266e('0x39')]=_0x25aea8['id'];_0x30fd69[_0x266e('0x2f')][_0x266e('0x3a')]=integrations[_0x266e('0x3b')](_0x30fd69[_0x266e('0x2f')][_0x266e('0x3c')],_0x30fd69[_0x266e('0x2f')][_0x266e('0x18')]);_0x30fd69[_0x266e('0x2f')][_0x266e('0x3d')]=integrations[_0x266e('0x3e')](_0x30fd69[_0x266e('0x2f')][_0x266e('0x3c')],_0x30fd69[_0x266e('0x2f')]['type']);return db[_0x266e('0x33')]['create'](_0x30fd69[_0x266e('0x2f')],{'include':[{'model':db[_0x266e('0x3f')],'as':_0x266e('0x3a')},{'model':db[_0x266e('0x3f')],'as':_0x266e('0x3d')}]});}return null;})[_0x266e('0xd')](respondWithResult(_0x55aa72,null))[_0x266e('0x2b')](handleError(_0x55aa72,null));};function sanitizeRemoteUri(_0x40d216){var _0x6c4cd3=_0x40d216[_0x266e('0x40')](-0x1);if(_0x6c4cd3==='/')return _0x40d216[_0x266e('0x41')](0x0,_0x40d216[_0x266e('0x42')](_0x6c4cd3));return _0x40d216;}function getWebApiUrl(_0x306dec){return util[_0x266e('0x43')](_0x266e('0x44'),_0x306dec);}exports[_0x266e('0x45')]=function(_0xd4a74b,_0x2688e9){var _0x22c9bb=_0xd4a74b[_0x266e('0x1a')][_0x266e('0x46')];var _0x263ec5=_0x22c9bb==='incident'?_0x266e('0x47'):'PhoneCall';var _0x1922a1='';var _0x54b059='';var _0x50b4dd='';var _0x4e401d='';var _0x18a94b='';var _0x359fb6='';var _0x33627b='';var _0x5f073d='';var _0x434f53=[_0x266e('0x48'),_0x266e('0x49'),_0x266e('0x4a'),_0x266e('0x4b'),_0x266e('0x4c'),_0x266e('0x4d'),'phonenumber','regardingobjectid',_0x266e('0x4e'),_0x266e('0x4f')];var _0x4fcd81=[_0x266e('0x50'),_0x266e('0x51'),_0x266e('0x52'),_0x266e('0x53'),_0x266e('0x54'),_0x266e('0x55'),'contractdetailidname','contractidname',_0x266e('0x56'),_0x266e('0x57'),_0x266e('0x58'),_0x266e('0x59'),'createdon',_0x266e('0x5a'),_0x266e('0x5b'),_0x266e('0x5c'),_0x266e('0x5d'),_0x266e('0x5e'),_0x266e('0x5f'),_0x266e('0x60'),_0x266e('0x61'),_0x266e('0x62'),_0x266e('0x63'),'exchangerate','firstresponsebykpiidname',_0x266e('0x64'),_0x266e('0x65'),_0x266e('0x66'),_0x266e('0x67'),_0x266e('0x68'),'masteridname',_0x266e('0x69'),_0x266e('0x6a'),_0x266e('0x6b'),_0x266e('0x6c'),_0x266e('0x6d'),'modifiedonbehalfbyname',_0x266e('0x6e'),'msdyn_incidenttypename',_0x266e('0x6f'),_0x266e('0x70'),'onholdtime','overriddencreatedon','owneridname','owneridtype',_0x266e('0x71'),_0x266e('0x72'),_0x266e('0x73'),'primarycontactidyominame',_0x266e('0x74'),_0x266e('0x75'),'productserialnumber',_0x266e('0x76'),_0x266e('0x77'),_0x266e('0x78'),_0x266e('0x79'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0x266e('0x7a'),_0x266e('0x7b'),_0x266e('0x7c'),_0x266e('0x7d'),_0x266e('0x7e'),_0x266e('0x7f'),_0x266e('0x80'),_0x266e('0x81'),'traversedpath',_0x266e('0x82'),'versionnumber'];var _0xc6dbb=_0x434f53[_0x266e('0x83')](_0x4fcd81);return db[_0x266e('0x16')][_0x266e('0x38')]({'where':{'id':_0xd4a74b[_0x266e('0x2c')]['id']},'attributes':['id',_0x266e('0x84'),'password',_0x266e('0x85'),_0x266e('0x86'),_0x266e('0x87'),_0x266e('0x88'),_0x266e('0x89')],'include':[{'model':db['CloudProvider'],'as':_0x266e('0x8a'),'attributes':['id','data5',_0x266e('0x8b')]}]})[_0x266e('0xd')](handleEntityNotFound(_0x2688e9,null))[_0x266e('0xd')](function(_0xfd5144){if(_0xfd5144){if(_0xfd5144['modernAuthentication']){_0xfd5144[_0x266e('0x8c')]=_0xfd5144['CloudProvider'][_0x266e('0x8d')];_0x5f073d=sanitizeRemoteUri(_0xfd5144[_0x266e('0x8a')][_0x266e('0x8b')]);_0x33627b=getWebApiUrl(_0x5f073d);return _0xfd5144;}_0x5f073d=sanitizeRemoteUri(_0xfd5144[_0x266e('0x85')]);_0x33627b=getWebApiUrl(_0x5f073d);var _0x1b7bdf={'method':_0x266e('0x8e'),'uri':_0x266e('0x8f')+_0xfd5144[_0x266e('0x86')]+'/oauth2/token','form':{'client_id':_0xfd5144[_0x266e('0x87')],'resource':_0x5f073d,'username':_0xfd5144[_0x266e('0x84')],'password':_0xfd5144[_0x266e('0x90')],'grant_type':_0x266e('0x90'),'client_secret':_0xfd5144['clientSecret']},'json':!![]};return rp(_0x1b7bdf);}})[_0x266e('0xd')](function(_0x5e1c9d){_0x359fb6=_0x5e1c9d['access_token'];var _0x3005d2={'method':_0x266e('0x91'),'uri':encodeURI(_0x33627b+_0x266e('0x92')+_0x263ec5+'\x27'),'headers':{'Authorization':_0x266e('0x93')+_0x359fb6,'If-None-Match':null,'OData-Version':_0x266e('0x94')},'json':!![]};return rp(_0x3005d2);})[_0x266e('0xd')](function(_0x341e11){var _0xc25fb=_0x341e11[_0x266e('0x95')][0x0];var _0x5c2003=_0xc25fb['MetadataId'];var _0x2aa97b={'method':_0x266e('0x91'),'uri':_0x33627b+_0x266e('0x96')+_0x5c2003+_0x266e('0x97'),'headers':{'Authorization':'Bearer\x20'+_0x359fb6,'If-None-Match':null,'OData-Version':_0x266e('0x94')},'json':!![]};return rp(_0x2aa97b);})['then'](function(_0x21aae1){_0x1922a1=_0x21aae1;_0x54b059=_0x1922a1[_0x266e('0x98')];_0x54b059=_[_0x266e('0x99')](_0x54b059,function(_0x2456ce){return!_0xc6dbb[_0x266e('0x9a')](_0x2456ce['LogicalName']);});var _0x1e6853=[];var _0x3ee6c7=[];_0x54b059[_0x266e('0x9b')](function(_0x1bf0e8){if(_0x1bf0e8['@odata.type']){var _0x3512f4=_0x1bf0e8[_0x266e('0x9c')][_0x266e('0x41')](_0x1bf0e8[_0x266e('0x9c')]['lastIndexOf']('.')+0x1);if(_0x3512f4===_0x266e('0x9d')){_0x1e6853[_0x266e('0x9e')](getSelectList(_0x33627b,_0x22c9bb,_0x3ee6c7,_0x1922a1['MetadataId'],_0x1bf0e8['MetadataId'],_0x359fb6));}}});return Promise[_0x266e('0x9f')](_0x1e6853);})[_0x266e('0xd')](function(_0x2bebc6){_0x50b4dd=_0x2bebc6[0x0];var _0x3e247c=[];var _0x49efb7=[];_0x54b059[_0x266e('0x9b')](function(_0x12dbb5){if(!_[_0x266e('0xa0')](_0x12dbb5[_0x266e('0x9c')])){var _0x91e780=_0x12dbb5[_0x266e('0x9c')][_0x266e('0x41')](_0x12dbb5[_0x266e('0x9c')]['lastIndexOf']('.')+0x1);if(_0x91e780===_0x266e('0xa1')){_0x3e247c[_0x266e('0x9e')](getBooleanList(_0x33627b,_0x22c9bb,_0x49efb7,_0x1922a1[_0x266e('0xa2')],_0x12dbb5['MetadataId'],_0x359fb6));}}});return Promise[_0x266e('0x9f')](_0x3e247c);})[_0x266e('0xd')](function(_0xb0dc85){_0x4e401d=_0xb0dc85[0x0];var _0x550a51=[];var _0x4dc7cf=[];_0x54b059[_0x266e('0x9b')](function(_0x395bdf){if(_0x395bdf[_0x266e('0x9c')]){var _0x18e076=_0x395bdf[_0x266e('0x9c')][_0x266e('0x41')](_0x395bdf['@odata.type'][_0x266e('0x42')]('.')+0x1);if(_0x18e076===_0x266e('0xa3')||_0x18e076===_0x266e('0xa4')||_0x18e076==='BigIntAttributeMetadata'||_0x18e076===_0x266e('0xa5')||_0x18e076===_0x266e('0xa6')||_0x18e076==='DateTimeAttributeMetadata'||_0x18e076===_0x266e('0xa7')||_0x18e076==='EntityNameAttributeMetadata'||_0x18e076===_0x266e('0xa8')||_0x18e076==='DecimalAttributeMetadata'){_0x550a51[_0x266e('0x9e')](getInputList(_0x33627b,_0x22c9bb,_0x18e076,_0x4dc7cf,_0x1922a1[_0x266e('0xa2')],_0x395bdf['MetadataId'],_0x359fb6));}}});return Promise[_0x266e('0x9f')](_0x550a51);})[_0x266e('0xd')](function(_0xbc3b19){_0x18a94b=_0xbc3b19[0x0];var _0x46568b=_0x50b4dd[_0x266e('0x83')](_0x4e401d)['concat'](_0x18a94b);var _0x20c106={'count':_0x46568b[_0x266e('0x21')],'rows':_0x46568b};return _0x20c106;})[_0x266e('0xd')](respondWithResult(_0x2688e9,null))[_0x266e('0x2b')](function(_0x340b42){var _0x36c94a=_0xd4a74b[_0x266e('0x1a')]['test']?0x1f4:_0x340b42['statusCode']||0x1f4;logger['error'](_0x340b42[_0x266e('0x11')]);delete _0x340b42['name'];if(_0x36c94a===0x191){_0x36c94a=0x190;}_0x2688e9[_0x266e('0x5')](_0x36c94a)[_0x266e('0x13')](_0xd4a74b[_0x266e('0x1a')][_0x266e('0xa9')]?{'message':_0x266e('0xaa'),'statusCode':_0x340b42[_0x266e('0xab')]}:_0x340b42);});};function getSelectList(_0x2b6656,_0x38e29d,_0x5981ce,_0x119e9f,_0x49d75,_0x1ec218){var _0x3bb438={'method':_0x266e('0x91'),'uri':_0x2b6656+'EntityDefinitions('+_0x119e9f+_0x266e('0xac')+_0x49d75+_0x266e('0xad')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1ec218,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3bb438)['then'](function(_0x499b40){var _0x50b482=[];var _0x16a8ac=_0x499b40[_0x266e('0xae')]['Options'];_0x16a8ac[_0x266e('0x9b')](function(_0x4a33c8){_0x50b482['push']({'name':_0x4a33c8['Label'][_0x266e('0xaf')][_0x266e('0xb0')],'value':String(_0x4a33c8[_0x266e('0xb1')])});});var _0x43275e={'id':_0x38e29d+'_'+_0x499b40[_0x266e('0xb2')],'name':_0x499b40['DisplayName'][_0x266e('0xaf')]['Label'],'custom':![],'options':_0x50b482};_0x5981ce[_0x266e('0x9e')](_0x43275e);return _0x5981ce;});}function getBooleanList(_0x285eba,_0x33fbad,_0x30fd0a,_0x2e06ff,_0xd2f17d,_0x4abe20){var _0x4bd7af={'method':_0x266e('0x91'),'uri':_0x285eba+_0x266e('0x96')+_0x2e06ff+_0x266e('0xac')+_0xd2f17d+_0x266e('0xb3'),'headers':{'Authorization':_0x266e('0x93')+_0x4abe20,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4bd7af)[_0x266e('0xd')](function(_0x497f14){var _0x44fa1f=[];_0x44fa1f[_0x266e('0x9e')]({'name':_0x497f14['OptionSet'][_0x266e('0xb4')][_0x266e('0xb0')][_0x266e('0xaf')]['Label'],'value':_0x266e('0xb5')},{'name':_0x497f14['OptionSet'][_0x266e('0xb6')][_0x266e('0xb0')][_0x266e('0xaf')][_0x266e('0xb0')],'value':_0x266e('0xb7')});var _0x33cc76={'id':_0x33fbad+'_'+_0x497f14[_0x266e('0xb2')],'name':_0x497f14[_0x266e('0xb8')]['UserLocalizedLabel'][_0x266e('0xb0')],'custom':![],'options':_0x44fa1f};_0x30fd0a['push'](_0x33cc76);return _0x30fd0a;});}function getInputList(_0xca54db,_0x34f8ef,_0x5dfcf9,_0x56b477,_0x1092b7,_0x1545d3,_0x35b042){var _0x1f4935={'method':_0x266e('0x91'),'uri':_0xca54db+_0x266e('0x96')+_0x1092b7+')/Attributes('+_0x1545d3+_0x266e('0xb9')+_0x5dfcf9+_0x266e('0xba'),'headers':{'Authorization':_0x266e('0x93')+_0x35b042,'If-None-Match':null,'OData-Version':_0x266e('0x94')},'json':!![]};return rp(_0x1f4935)['then'](function(_0x23a936){var _0x589cc7={'id':_0x34f8ef+'_'+_0x23a936[_0x266e('0xb2')],'name':_0x23a936[_0x266e('0xb8')][_0x266e('0xaf')]?_0x23a936[_0x266e('0xb8')][_0x266e('0xaf')][_0x266e('0xb0')]:_0x23a936[_0x266e('0xb2')],'custom':![],'options':[]};_0x56b477['push'](_0x589cc7);return _0x56b477;});} \ No newline at end of file +var _0xb4fe=['modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','tenantId','clientSecret','modernAuthentication','data5','data7','access_token','CloudProvider','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','count','status','set','Content-Range','update','then','destroy','end','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','findAll','rows','catch','params','include','options','find','create','body','getConfigurations','Dynamics365Configuration','nolimit','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','lastIndexOf','format','getFields','ticketType','Incident','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','actualserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame'];(function(_0x11a514,_0x456822){var _0x5f19d4=function(_0x2f778){while(--_0x2f778){_0x11a514['push'](_0x11a514['shift']());}};_0x5f19d4(++_0x456822);}(_0xb4fe,0x117));var _0xeb4f=function(_0x5d76a1,_0x248048){_0x5d76a1=_0x5d76a1-0x0;var _0x5512e5=_0xb4fe[_0x5d76a1];return _0x5512e5;};'use strict';var rp=require(_0xeb4f('0x0'));var util=require(_0xeb4f('0x1'));var _=require(_0xeb4f('0x2'));var qs=require(_0xeb4f('0x3'));var logger=require('../../config/logger')(_0xeb4f('0x4'));var db=require(_0xeb4f('0x5'))['db'];var integrations=require(_0xeb4f('0x6'));function respondWithResult(_0xbd5141,_0x5e98b6){_0x5e98b6=_0x5e98b6||0xc8;return function(_0x4031ef){if(_0x4031ef){return _0xbd5141['status'](_0x5e98b6)[_0xeb4f('0x7')](_0x4031ef);}};}function respondWithFilteredResult(_0x237684,_0x13bda2){return function(_0x52e799){if(_0x52e799){var _0xa790ee=typeof _0x13bda2[_0xeb4f('0x8')]===_0xeb4f('0x9')&&typeof _0x13bda2['limit']==='undefined';var _0x5121cb=_0x52e799[_0xeb4f('0xa')];var _0x1b9f10=_0xa790ee?0x0:_0x13bda2[_0xeb4f('0x8')];var _0x3a4bc4=_0xa790ee?_0x52e799['count']:_0x13bda2['offset']+_0x13bda2['limit'];var _0x4efb9f;if(_0x3a4bc4>=_0x5121cb){_0x3a4bc4=_0x5121cb;_0x4efb9f=0xc8;}else{_0x4efb9f=0xce;}_0x237684[_0xeb4f('0xb')](_0x4efb9f);return _0x237684[_0xeb4f('0xc')](_0xeb4f('0xd'),_0x1b9f10+'-'+_0x3a4bc4+'/'+_0x5121cb)[_0xeb4f('0x7')](_0x52e799);}return null;};}function saveUpdates(_0x59a300){return function(_0x3509aa){if(_0x3509aa){return _0x3509aa[_0xeb4f('0xe')](_0x59a300)[_0xeb4f('0xf')](function(_0x2437ba){return _0x2437ba;});}return null;};}function removeEntity(_0x2a9c59){return function(_0x1ce64d){if(_0x1ce64d){return _0x1ce64d[_0xeb4f('0x10')]()[_0xeb4f('0xf')](function(){_0x2a9c59[_0xeb4f('0xb')](0xcc)[_0xeb4f('0x11')]();});}};}function handleEntityNotFound(_0x5b67f9){return function(_0x5aec5d){if(!_0x5aec5d){_0x5b67f9['sendStatus'](0x194);}return _0x5aec5d;};}function handleError(_0x39b5ac,_0x2e3621){_0x2e3621=_0x2e3621||0x1f4;return function(_0x220aaf){logger[_0xeb4f('0x12')](_0x220aaf[_0xeb4f('0x13')]);if(_0x220aaf['name']){delete _0x220aaf[_0xeb4f('0x14')];}_0x39b5ac['status'](_0x2e3621)[_0xeb4f('0x15')](_0x220aaf);};}exports['index']=function(_0x3dfa86,_0x4ae520){var _0x4f9504={},_0x4d9c44={},_0x2b2d28={'count':0x0,'rows':[]};var _0x43806f=_[_0xeb4f('0x16')](db[_0xeb4f('0x17')][_0xeb4f('0x18')],function(_0x15fca9){return{'name':_0x15fca9[_0xeb4f('0x19')],'type':_0x15fca9['type']['key']};});_0x4d9c44[_0xeb4f('0x1a')]=_[_0xeb4f('0x16')](_0x43806f,_0xeb4f('0x14'));_0x4d9c44[_0xeb4f('0x1b')]=_[_0xeb4f('0x1c')](_0x3dfa86['query']);_0x4d9c44[_0xeb4f('0x1d')]=_[_0xeb4f('0x1e')](_0x4d9c44[_0xeb4f('0x1a')],_0x4d9c44[_0xeb4f('0x1b')]);_0x4f9504[_0xeb4f('0x1f')]=_['intersection'](_0x4d9c44[_0xeb4f('0x1a')],qs[_0xeb4f('0x20')](_0x3dfa86[_0xeb4f('0x1b')][_0xeb4f('0x20')]));_0x4f9504[_0xeb4f('0x1f')]=_0x4f9504[_0xeb4f('0x1f')][_0xeb4f('0x21')]?_0x4f9504[_0xeb4f('0x1f')]:_0x4d9c44[_0xeb4f('0x1a')];if(!_0x3dfa86['query'][_0xeb4f('0x22')]('nolimit')){_0x4f9504['limit']=qs[_0xeb4f('0x23')](_0x3dfa86[_0xeb4f('0x1b')][_0xeb4f('0x23')]);_0x4f9504[_0xeb4f('0x8')]=qs[_0xeb4f('0x8')](_0x3dfa86['query'][_0xeb4f('0x8')]);}_0x4f9504[_0xeb4f('0x24')]=qs['sort'](_0x3dfa86[_0xeb4f('0x1b')][_0xeb4f('0x25')]);_0x4f9504[_0xeb4f('0x26')]=qs[_0xeb4f('0x1d')](_[_0xeb4f('0x27')](_0x3dfa86['query'],_0x4d9c44[_0xeb4f('0x1d')]),_0x43806f);if(_0x3dfa86[_0xeb4f('0x1b')][_0xeb4f('0x28')]){_0x4f9504[_0xeb4f('0x26')]=_['merge'](_0x4f9504[_0xeb4f('0x26')],{'$or':_[_0xeb4f('0x16')](_0x43806f,function(_0x38e28c){if(_0x38e28c[_0xeb4f('0x29')]!==_0xeb4f('0x2a')){var _0x4b4189={};_0x4b4189[_0x38e28c[_0xeb4f('0x14')]]={'$like':'%'+_0x3dfa86[_0xeb4f('0x1b')]['filter']+'%'};return _0x4b4189;}})});}_0x4f9504=_[_0xeb4f('0x2b')]({},_0x4f9504,_0x3dfa86['options']);var _0x2e92a9={'where':_0x4f9504[_0xeb4f('0x26')]};return db[_0xeb4f('0x17')][_0xeb4f('0xa')](_0x2e92a9)[_0xeb4f('0xf')](function(_0x179d0e){_0x2b2d28['count']=_0x179d0e;if(_0x3dfa86[_0xeb4f('0x1b')]['includeAll']){_0x4f9504['include']=[{'all':!![]}];}return db[_0xeb4f('0x17')][_0xeb4f('0x2c')](_0x4f9504);})[_0xeb4f('0xf')](function(_0x4e64db){_0x2b2d28[_0xeb4f('0x2d')]=_0x4e64db;return _0x2b2d28;})[_0xeb4f('0xf')](respondWithFilteredResult(_0x4ae520,_0x4f9504))[_0xeb4f('0x2e')](handleError(_0x4ae520,null));};exports['show']=function(_0x3982d6,_0x23b79e){var _0x2b5667={'raw':![],'where':{'id':_0x3982d6[_0xeb4f('0x2f')]['id']}},_0x3bc882={};_0x3bc882[_0xeb4f('0x1a')]=_[_0xeb4f('0x1c')](db[_0xeb4f('0x17')][_0xeb4f('0x18')]);_0x3bc882['query']=_['keys'](_0x3982d6[_0xeb4f('0x1b')]);_0x3bc882[_0xeb4f('0x1d')]=_[_0xeb4f('0x1e')](_0x3bc882[_0xeb4f('0x1a')],_0x3bc882['query']);_0x2b5667[_0xeb4f('0x1f')]=_[_0xeb4f('0x1e')](_0x3bc882[_0xeb4f('0x1a')],qs[_0xeb4f('0x20')](_0x3982d6['query'][_0xeb4f('0x20')]));_0x2b5667[_0xeb4f('0x1f')]=_0x2b5667[_0xeb4f('0x1f')][_0xeb4f('0x21')]?_0x2b5667[_0xeb4f('0x1f')]:_0x3bc882['model'];if(_0x3982d6[_0xeb4f('0x1b')]['includeAll']){_0x2b5667[_0xeb4f('0x30')]=[{'all':!![]}];}_0x2b5667=_[_0xeb4f('0x2b')]({},_0x2b5667,_0x3982d6[_0xeb4f('0x31')]);return db[_0xeb4f('0x17')][_0xeb4f('0x32')](_0x2b5667)[_0xeb4f('0xf')](handleEntityNotFound(_0x23b79e,null))[_0xeb4f('0xf')](respondWithResult(_0x23b79e,null))[_0xeb4f('0x2e')](handleError(_0x23b79e,null));};exports[_0xeb4f('0x33')]=function(_0x4a53eb,_0x5b5abc){return db['Dynamics365Account'][_0xeb4f('0x33')](_0x4a53eb['body'],{})[_0xeb4f('0xf')](respondWithResult(_0x5b5abc,0xc9))[_0xeb4f('0x2e')](handleError(_0x5b5abc,null));};exports[_0xeb4f('0xe')]=function(_0xe68ee5,_0x9c9bbc){if(_0xe68ee5['body']['id']){delete _0xe68ee5[_0xeb4f('0x34')]['id'];}return db['Dynamics365Account'][_0xeb4f('0x32')]({'where':{'id':_0xe68ee5['params']['id']}})['then'](handleEntityNotFound(_0x9c9bbc,null))['then'](saveUpdates(_0xe68ee5['body'],null))[_0xeb4f('0xf')](respondWithResult(_0x9c9bbc,null))[_0xeb4f('0x2e')](handleError(_0x9c9bbc,null));};exports[_0xeb4f('0x10')]=function(_0xca1ffe,_0x40f6c5){return db['Dynamics365Account'][_0xeb4f('0x32')]({'where':{'id':_0xca1ffe[_0xeb4f('0x2f')]['id']}})[_0xeb4f('0xf')](handleEntityNotFound(_0x40f6c5,null))[_0xeb4f('0xf')](removeEntity(_0x40f6c5,null))[_0xeb4f('0x2e')](handleError(_0x40f6c5,null));};exports[_0xeb4f('0x35')]=function(_0x3469e1,_0xeb4d39){var _0x2bc29c={};var _0x1efb19={};var _0x863a64;var _0x10d0bd;return db[_0xeb4f('0x17')]['findOne']({'where':{'id':_0x3469e1[_0xeb4f('0x2f')]['id']}})[_0xeb4f('0xf')](handleEntityNotFound(_0xeb4d39,null))[_0xeb4f('0xf')](function(_0x1be1f8){if(_0x1be1f8){_0x863a64=_0x1be1f8;_0x1efb19[_0xeb4f('0x1a')]=_[_0xeb4f('0x1c')](db[_0xeb4f('0x36')]['rawAttributes']);_0x1efb19[_0xeb4f('0x1b')]=_[_0xeb4f('0x1c')](_0x3469e1[_0xeb4f('0x1b')]);_0x1efb19[_0xeb4f('0x1d')]=_[_0xeb4f('0x1e')](_0x1efb19[_0xeb4f('0x1a')],_0x1efb19['query']);_0x2bc29c[_0xeb4f('0x1f')]=_[_0xeb4f('0x1e')](_0x1efb19[_0xeb4f('0x1a')],qs[_0xeb4f('0x20')](_0x3469e1['query']['fields']));_0x2bc29c[_0xeb4f('0x1f')]=_0x2bc29c['attributes']['length']?_0x2bc29c[_0xeb4f('0x1f')]:_0x1efb19[_0xeb4f('0x1a')];_0x2bc29c[_0xeb4f('0x24')]=qs[_0xeb4f('0x25')](_0x3469e1['query']['sort']);_0x2bc29c[_0xeb4f('0x26')]=qs[_0xeb4f('0x1d')](_[_0xeb4f('0x27')](_0x3469e1[_0xeb4f('0x1b')],_0x1efb19[_0xeb4f('0x1d')]));if(_0x3469e1[_0xeb4f('0x1b')][_0xeb4f('0x28')]){_0x2bc29c[_0xeb4f('0x26')]=_[_0xeb4f('0x2b')](_0x2bc29c[_0xeb4f('0x26')],{'$or':_[_0xeb4f('0x16')](_0x2bc29c[_0xeb4f('0x1f')],function(_0x2b53a9){var _0x4fa1bb={};_0x4fa1bb[_0x2b53a9]={'$like':'%'+_0x3469e1[_0xeb4f('0x1b')]['filter']+'%'};return _0x4fa1bb;})});}_0x2bc29c=_[_0xeb4f('0x2b')]({},_0x2bc29c,_0x3469e1[_0xeb4f('0x31')]);return _0x863a64['getConfigurations'](_0x2bc29c);}})[_0xeb4f('0xf')](function(_0x4d3d53){if(_0x4d3d53){_0x10d0bd=_0x4d3d53[_0xeb4f('0x21')];if(!_0x3469e1[_0xeb4f('0x1b')][_0xeb4f('0x22')](_0xeb4f('0x37'))){_0x2bc29c[_0xeb4f('0x23')]=qs[_0xeb4f('0x23')](_0x3469e1[_0xeb4f('0x1b')][_0xeb4f('0x23')]);_0x2bc29c[_0xeb4f('0x8')]=qs[_0xeb4f('0x8')](_0x3469e1[_0xeb4f('0x1b')][_0xeb4f('0x8')]);}return _0x863a64[_0xeb4f('0x35')](_0x2bc29c);}})[_0xeb4f('0xf')](function(_0x1727e5){if(_0x1727e5){return _0x1727e5?{'count':_0x10d0bd,'rows':_0x1727e5}:null;}})[_0xeb4f('0xf')](respondWithResult(_0xeb4d39,null))['catch'](handleError(_0xeb4d39,null));};exports['addConfiguration']=function(_0x384346,_0x49445e){if(_0x384346[_0xeb4f('0x34')]['id']){delete _0x384346[_0xeb4f('0x34')]['id'];}return db['Dynamics365Account'][_0xeb4f('0x38')]({'where':{'id':_0x384346['params']['id']}})['then'](handleEntityNotFound(_0x49445e,null))[_0xeb4f('0xf')](function(_0x35285b){if(_0x35285b){_0x384346[_0xeb4f('0x34')][_0xeb4f('0x39')]=_0x35285b['id'];_0x384346[_0xeb4f('0x34')][_0xeb4f('0x3a')]=integrations[_0xeb4f('0x3b')](_0x384346['body'][_0xeb4f('0x3c')],_0x384346['body'][_0xeb4f('0x29')]);_0x384346['body']['Descriptions']=integrations[_0xeb4f('0x3d')](_0x384346[_0xeb4f('0x34')][_0xeb4f('0x3c')],_0x384346[_0xeb4f('0x34')][_0xeb4f('0x29')]);return db[_0xeb4f('0x36')][_0xeb4f('0x33')](_0x384346[_0xeb4f('0x34')],{'include':[{'model':db['Dynamics365Field'],'as':_0xeb4f('0x3a')},{'model':db[_0xeb4f('0x3e')],'as':_0xeb4f('0x3f')}]});}return null;})[_0xeb4f('0xf')](respondWithResult(_0x49445e,null))[_0xeb4f('0x2e')](handleError(_0x49445e,null));};function sanitizeRemoteUri(_0x2e39bf){var _0x7617d=_0x2e39bf[_0xeb4f('0x40')](-0x1);if(_0x7617d==='/')return _0x2e39bf['substring'](0x0,_0x2e39bf[_0xeb4f('0x41')](_0x7617d));return _0x2e39bf;}function getWebApiUrl(_0x4a6d44){return util[_0xeb4f('0x42')]('%s/api/data/v9.0/',_0x4a6d44);}exports[_0xeb4f('0x43')]=function(_0x903e17,_0x2571c1){var _0x5ee5cd=_0x903e17[_0xeb4f('0x1b')][_0xeb4f('0x44')];var _0x84aa34=_0x5ee5cd==='incident'?_0xeb4f('0x45'):'PhoneCall';var _0xba51f0='';var _0x57c0c5='';var _0x433a38='';var _0x375b35='';var _0x339ef3='';var _0x48c062='';var _0x4d567c='';var _0x1b3854='';var _0x3ae834=['title',_0xeb4f('0x46'),_0xeb4f('0x47'),_0xeb4f('0x48'),_0xeb4f('0x49'),_0xeb4f('0x4a'),_0xeb4f('0x4b'),_0xeb4f('0x4c'),_0xeb4f('0x4d'),_0xeb4f('0x4e')];var _0xbf0ecc=['accountidname','accountidyominame',_0xeb4f('0x4f'),'billedserviceunits','contactidname',_0xeb4f('0x50'),_0xeb4f('0x51'),_0xeb4f('0x52'),_0xeb4f('0x53'),'createdbyexternalpartyyominame',_0xeb4f('0x54'),'createdbyyominame','createdon','createdonbehalfbyname',_0xeb4f('0x55'),_0xeb4f('0x56'),_0xeb4f('0x57'),_0xeb4f('0x58'),_0xeb4f('0x59'),_0xeb4f('0x5a'),_0xeb4f('0x5b'),'entityimage_url',_0xeb4f('0x5c'),_0xeb4f('0x5d'),_0xeb4f('0x5e'),_0xeb4f('0x5f'),_0xeb4f('0x60'),_0xeb4f('0x61'),_0xeb4f('0x62'),_0xeb4f('0x63'),_0xeb4f('0x64'),'modifiedbyexternalpartyname',_0xeb4f('0x65'),'modifiedbyname',_0xeb4f('0x66'),_0xeb4f('0x67'),_0xeb4f('0x68'),_0xeb4f('0x69'),'msdyn_incidenttypename',_0xeb4f('0x6a'),'numberofchildincidents',_0xeb4f('0x6b'),_0xeb4f('0x6c'),'owneridname',_0xeb4f('0x6d'),_0xeb4f('0x6e'),_0xeb4f('0x6f'),_0xeb4f('0x70'),_0xeb4f('0x71'),'prioritycodename',_0xeb4f('0x72'),'productserialnumber',_0xeb4f('0x73'),_0xeb4f('0x74'),_0xeb4f('0x75'),_0xeb4f('0x76'),_0xeb4f('0x77'),_0xeb4f('0x78'),_0xeb4f('0x79'),_0xeb4f('0x7a'),_0xeb4f('0x7b'),'statecode',_0xeb4f('0x7c'),_0xeb4f('0x7d'),_0xeb4f('0x7e'),_0xeb4f('0x7f'),_0xeb4f('0x80'),_0xeb4f('0x81'),_0xeb4f('0x82'),'versionnumber'];var _0x3d45c8=_0x3ae834[_0xeb4f('0x83')](_0xbf0ecc);return db['Dynamics365Account']['findOne']({'where':{'id':_0x903e17['params']['id']},'attributes':['id',_0xeb4f('0x84'),_0xeb4f('0x85'),'remoteUri',_0xeb4f('0x86'),'clientId',_0xeb4f('0x87'),_0xeb4f('0x88')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0xeb4f('0x89'),_0xeb4f('0x8a')]}]})['then'](handleEntityNotFound(_0x2571c1,null))[_0xeb4f('0xf')](function(_0x115abe){if(_0x115abe){if(_0x115abe['modernAuthentication']){_0x115abe[_0xeb4f('0x8b')]=_0x115abe[_0xeb4f('0x8c')][_0xeb4f('0x89')];_0x1b3854=sanitizeRemoteUri(_0x115abe[_0xeb4f('0x8c')][_0xeb4f('0x8a')]);_0x4d567c=getWebApiUrl(_0x1b3854);return _0x115abe;}_0x1b3854=sanitizeRemoteUri(_0x115abe['remoteUri']);_0x4d567c=getWebApiUrl(_0x1b3854);var _0x5e0240={'method':_0xeb4f('0x8d'),'uri':_0xeb4f('0x8e')+_0x115abe['tenantId']+_0xeb4f('0x8f'),'form':{'client_id':_0x115abe[_0xeb4f('0x90')],'resource':_0x1b3854,'username':_0x115abe['username'],'password':_0x115abe[_0xeb4f('0x85')],'grant_type':_0xeb4f('0x85'),'client_secret':_0x115abe[_0xeb4f('0x87')]},'json':!![]};return rp(_0x5e0240);}})['then'](function(_0x4a5108){_0x48c062=_0x4a5108['access_token'];var _0x37850b={'method':_0xeb4f('0x91'),'uri':encodeURI(_0x4d567c+_0xeb4f('0x92')+_0x84aa34+'\x27'),'headers':{'Authorization':_0xeb4f('0x93')+_0x48c062,'If-None-Match':null,'OData-Version':_0xeb4f('0x94')},'json':!![]};return rp(_0x37850b);})[_0xeb4f('0xf')](function(_0x38f811){var _0x1e16ff=_0x38f811[_0xeb4f('0x95')][0x0];var _0x46ffeb=_0x1e16ff[_0xeb4f('0x96')];var _0x3a0de2={'method':_0xeb4f('0x91'),'uri':_0x4d567c+_0xeb4f('0x97')+_0x46ffeb+_0xeb4f('0x98'),'headers':{'Authorization':'Bearer\x20'+_0x48c062,'If-None-Match':null,'OData-Version':_0xeb4f('0x94')},'json':!![]};return rp(_0x3a0de2);})[_0xeb4f('0xf')](function(_0x178e82){_0xba51f0=_0x178e82;_0x57c0c5=_0xba51f0[_0xeb4f('0x99')];_0x57c0c5=_[_0xeb4f('0x9a')](_0x57c0c5,function(_0x4dcabd){return!_0x3d45c8[_0xeb4f('0x9b')](_0x4dcabd[_0xeb4f('0x9c')]);});var _0x22d284=[];var _0x218bf6=[];_0x57c0c5['forEach'](function(_0x32e6d5){if(_0x32e6d5['@odata.type']){var _0x2b163b=_0x32e6d5[_0xeb4f('0x9d')][_0xeb4f('0x9e')](_0x32e6d5[_0xeb4f('0x9d')][_0xeb4f('0x41')]('.')+0x1);if(_0x2b163b===_0xeb4f('0x9f')){_0x22d284[_0xeb4f('0xa0')](getSelectList(_0x4d567c,_0x5ee5cd,_0x218bf6,_0xba51f0[_0xeb4f('0x96')],_0x32e6d5[_0xeb4f('0x96')],_0x48c062));}}});return Promise[_0xeb4f('0xa1')](_0x22d284);})['then'](function(_0x2e90c5){_0x433a38=_0x2e90c5[0x0];var _0x377552=[];var _0x1354e9=[];_0x57c0c5[_0xeb4f('0xa2')](function(_0x1a6352){if(!_[_0xeb4f('0xa3')](_0x1a6352['@odata.type'])){var _0x4ddc60=_0x1a6352[_0xeb4f('0x9d')][_0xeb4f('0x9e')](_0x1a6352['@odata.type']['lastIndexOf']('.')+0x1);if(_0x4ddc60===_0xeb4f('0xa4')){_0x377552[_0xeb4f('0xa0')](getBooleanList(_0x4d567c,_0x5ee5cd,_0x1354e9,_0xba51f0[_0xeb4f('0x96')],_0x1a6352[_0xeb4f('0x96')],_0x48c062));}}});return Promise['all'](_0x377552);})['then'](function(_0x3413b7){_0x375b35=_0x3413b7[0x0];var _0x243506=[];var _0x57eaf7=[];_0x57c0c5[_0xeb4f('0xa2')](function(_0x2956dc){if(_0x2956dc['@odata.type']){var _0x3514c7=_0x2956dc[_0xeb4f('0x9d')][_0xeb4f('0x9e')](_0x2956dc[_0xeb4f('0x9d')][_0xeb4f('0x41')]('.')+0x1);if(_0x3514c7===_0xeb4f('0xa5')||_0x3514c7===_0xeb4f('0xa6')||_0x3514c7==='BigIntAttributeMetadata'||_0x3514c7===_0xeb4f('0xa7')||_0x3514c7==='MemoAttributeMetadata'||_0x3514c7===_0xeb4f('0xa8')||_0x3514c7===_0xeb4f('0xa9')||_0x3514c7===_0xeb4f('0xaa')||_0x3514c7===_0xeb4f('0xab')||_0x3514c7===_0xeb4f('0xac')){_0x243506[_0xeb4f('0xa0')](getInputList(_0x4d567c,_0x5ee5cd,_0x3514c7,_0x57eaf7,_0xba51f0[_0xeb4f('0x96')],_0x2956dc[_0xeb4f('0x96')],_0x48c062));}}});return Promise[_0xeb4f('0xa1')](_0x243506);})['then'](function(_0xca20be){_0x339ef3=_0xca20be[0x0];var _0x2feda3=_0x433a38[_0xeb4f('0x83')](_0x375b35)[_0xeb4f('0x83')](_0x339ef3);var _0x506b35={'count':_0x2feda3['length'],'rows':_0x2feda3};return _0x506b35;})[_0xeb4f('0xf')](respondWithResult(_0x2571c1,null))[_0xeb4f('0x2e')](function(_0x407c45){var _0x449677=_0x903e17[_0xeb4f('0x1b')][_0xeb4f('0xad')]?0x1f4:_0x407c45[_0xeb4f('0xae')]||0x1f4;logger[_0xeb4f('0x12')](_0x407c45[_0xeb4f('0x13')]);delete _0x407c45['name'];if(_0x449677===0x191){_0x449677=0x190;}_0x2571c1['status'](_0x449677)[_0xeb4f('0x15')](_0x903e17[_0xeb4f('0x1b')][_0xeb4f('0xad')]?{'message':_0xeb4f('0xaf'),'statusCode':_0x407c45[_0xeb4f('0xae')]}:_0x407c45);});};function getSelectList(_0x3eb165,_0x54b0db,_0x15dc13,_0x4b6ea9,_0x5ebea0,_0x390bfe){var _0x178144={'method':'GET','uri':_0x3eb165+_0xeb4f('0x97')+_0x4b6ea9+_0xeb4f('0xb0')+_0x5ebea0+_0xeb4f('0xb1')+_0xeb4f('0xb2'),'headers':{'Authorization':_0xeb4f('0x93')+_0x390bfe,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x178144)[_0xeb4f('0xf')](function(_0x45b748){var _0x60d4db=[];var _0x49f952=_0x45b748[_0xeb4f('0xb3')][_0xeb4f('0xb4')];_0x49f952[_0xeb4f('0xa2')](function(_0x5ea8ce){_0x60d4db['push']({'name':_0x5ea8ce[_0xeb4f('0xb5')][_0xeb4f('0xb6')][_0xeb4f('0xb5')],'value':String(_0x5ea8ce[_0xeb4f('0xb7')])});});var _0x4c87c8={'id':_0x54b0db+'_'+_0x45b748[_0xeb4f('0x9c')],'name':_0x45b748[_0xeb4f('0xb8')][_0xeb4f('0xb6')][_0xeb4f('0xb5')],'custom':![],'options':_0x60d4db};_0x15dc13[_0xeb4f('0xa0')](_0x4c87c8);return _0x15dc13;});}function getBooleanList(_0x307a4a,_0x44d6c5,_0xb13015,_0x4d7c09,_0x3d54b9,_0xc33a6c){var _0x81dcb9={'method':_0xeb4f('0x91'),'uri':_0x307a4a+_0xeb4f('0x97')+_0x4d7c09+_0xeb4f('0xb0')+_0x3d54b9+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xeb4f('0x93')+_0xc33a6c,'If-None-Match':null,'OData-Version':_0xeb4f('0x94')},'json':!![]};return rp(_0x81dcb9)[_0xeb4f('0xf')](function(_0x1c773a){var _0x56c8b5=[];_0x56c8b5[_0xeb4f('0xa0')]({'name':_0x1c773a[_0xeb4f('0xb3')][_0xeb4f('0xb9')][_0xeb4f('0xb5')][_0xeb4f('0xb6')][_0xeb4f('0xb5')],'value':_0xeb4f('0xba')},{'name':_0x1c773a[_0xeb4f('0xb3')][_0xeb4f('0xbb')][_0xeb4f('0xb5')][_0xeb4f('0xb6')][_0xeb4f('0xb5')],'value':_0xeb4f('0xbc')});var _0x367982={'id':_0x44d6c5+'_'+_0x1c773a[_0xeb4f('0x9c')],'name':_0x1c773a[_0xeb4f('0xb8')][_0xeb4f('0xb6')][_0xeb4f('0xb5')],'custom':![],'options':_0x56c8b5};_0xb13015[_0xeb4f('0xa0')](_0x367982);return _0xb13015;});}function getInputList(_0x2ea47d,_0x47145f,_0x5cafa0,_0x34b969,_0x11e758,_0x2bef9e,_0x560e0b){var _0xc7a430={'method':'GET','uri':_0x2ea47d+_0xeb4f('0x97')+_0x11e758+_0xeb4f('0xb0')+_0x2bef9e+_0xeb4f('0xbd')+_0x5cafa0+_0xeb4f('0xbe'),'headers':{'Authorization':_0xeb4f('0x93')+_0x560e0b,'If-None-Match':null,'OData-Version':_0xeb4f('0x94')},'json':!![]};return rp(_0xc7a430)['then'](function(_0x581af8){var _0x1e8044={'id':_0x47145f+'_'+_0x581af8[_0xeb4f('0x9c')],'name':_0x581af8[_0xeb4f('0xb8')][_0xeb4f('0xb6')]?_0x581af8['DisplayName'][_0xeb4f('0xb6')]['Label']:_0x581af8[_0xeb4f('0x9c')],'custom':![],'options':[]};_0x34b969['push'](_0x1e8044);return _0x34b969;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c357e5e..570601d 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(_0x6ef86b,_0x45f88c){var _0x153e6e=function(_0x1af05c){while(--_0x1af05c){_0x6ef86b['push'](_0x6ef86b['shift']());}};_0x153e6e(++_0x45f88c);}(_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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c2041,_0x1d7bbe){var _0x3ece93=function(_0x51ef53){while(--_0x51ef53){_0x4c2041['push'](_0x4c2041['shift']());}};_0x3ece93(++_0x1d7bbe);}(_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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index c949c40..829a8b5 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 _0xebfb=['raw','where','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','Dynamics365Account','findAll','options','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','find'];(function(_0x1b03fd,_0x337db1){var _0x4bcb04=function(_0x124958){while(--_0x124958){_0x1b03fd['push'](_0x1b03fd['shift']());}};_0x4bcb04(++_0x337db1);}(_0xebfb,0x10a));var _0xbebf=function(_0x295553,_0x10b5be){_0x295553=_0x295553-0x0;var _0xd57296=_0xebfb[_0x295553];return _0xd57296;};'use strict';var _=require('lodash');var util=require(_0xbebf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbebf('0x1'));var fs=require('fs');var Redis=require(_0xbebf('0x2'));var db=require(_0xbebf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbebf('0x4'))(_0xbebf('0x5'));var config=require(_0xbebf('0x6'));var jayson=require(_0xbebf('0x7'));var client=jayson['client'][_0xbebf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a976d,_0x17651b,_0x267bd9){return new BPromise(function(_0x26dd18,_0x8aca07){return client[_0xbebf('0x9')](_0x5a976d,_0x267bd9)[_0xbebf('0xa')](function(_0x4586f1){logger[_0xbebf('0xb')](_0xbebf('0xc'),_0x17651b,_0xbebf('0xd'));logger[_0xbebf('0xe')](_0xbebf('0xf'),_0x17651b,_0xbebf('0xd'),JSON[_0xbebf('0x10')](_0x4586f1));if(_0x4586f1[_0xbebf('0x11')]){if(_0x4586f1[_0xbebf('0x11')]['code']===0x1f4){logger['error'](_0xbebf('0xc'),_0x17651b,_0x4586f1['error']['message']);return _0x8aca07(_0x4586f1[_0xbebf('0x11')][_0xbebf('0x12')]);}logger[_0xbebf('0x11')](_0xbebf('0xc'),_0x17651b,_0x4586f1['error'][_0xbebf('0x12')]);return _0x26dd18(_0x4586f1[_0xbebf('0x11')][_0xbebf('0x12')]);}else{logger[_0xbebf('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x17651b,_0xbebf('0xd'));_0x26dd18(_0x4586f1['result'][_0xbebf('0x12')]);}})[_0xbebf('0x13')](function(_0x2bee91){logger['error'](_0xbebf('0xc'),_0x17651b,_0x2bee91);_0x8aca07(_0x2bee91);});});}exports['GetDynamics365Account']=function(_0x370e94){var _0x3d7d3a=this;return new Promise(function(_0x108837,_0x5e0847){return db[_0xbebf('0x14')][_0xbebf('0x15')]({'raw':_0x370e94[_0xbebf('0x16')]?_0x370e94[_0xbebf('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x370e94[_0xbebf('0x16')]?_0x370e94[_0xbebf('0x16')]['where']||null:null,'attributes':_0x370e94[_0xbebf('0x16')]?_0x370e94['options'][_0xbebf('0x17')]||null:null,'limit':_0x370e94['options']?_0x370e94['options'][_0xbebf('0x18')]||null:null,'include':_0x370e94[_0xbebf('0x16')]?_0x370e94[_0xbebf('0x16')][_0xbebf('0x19')]?_[_0xbebf('0x1a')](_0x370e94[_0xbebf('0x16')][_0xbebf('0x19')],function(_0x5a53e1){return{'model':db[_0x5a53e1[_0xbebf('0x1b')]],'as':_0x5a53e1['as'],'attributes':_0x5a53e1[_0xbebf('0x17')],'include':_0x5a53e1[_0xbebf('0x19')]?_[_0xbebf('0x1a')](_0x5a53e1[_0xbebf('0x19')],function(_0x553fa8){return{'model':db[_0x553fa8['model']],'as':_0x553fa8['as'],'attributes':_0x553fa8[_0xbebf('0x17')],'include':_0x553fa8['include']?_['map'](_0x553fa8[_0xbebf('0x19')],function(_0x53af4e){return{'model':db[_0x53af4e[_0xbebf('0x1b')]],'as':_0x53af4e['as'],'attributes':_0x53af4e[_0xbebf('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbebf('0xa')](function(_0x49a655){logger[_0xbebf('0xb')](_0xbebf('0x1c'),_0x370e94);logger['debug'](_0xbebf('0x1c'),_0x370e94,JSON[_0xbebf('0x10')](_0x49a655));_0x108837(_0x49a655);})[_0xbebf('0x13')](function(_0x1422fd){logger[_0xbebf('0x11')](_0xbebf('0x1c'),_0x1422fd['message'],_0x370e94);_0x5e0847(_0x3d7d3a[_0xbebf('0x11')](0x1f4,_0x1422fd[_0xbebf('0x12')]));});});};exports[_0xbebf('0x1d')]=function(_0x51c5e4){var _0x54f3b0=this;return new Promise(function(_0x587582,_0x3093cf){return db[_0xbebf('0x14')][_0xbebf('0x1e')]({'raw':_0x51c5e4[_0xbebf('0x16')]?_0x51c5e4[_0xbebf('0x16')][_0xbebf('0x1f')]===undefined?!![]:![]:!![],'where':_0x51c5e4[_0xbebf('0x16')]?_0x51c5e4[_0xbebf('0x16')][_0xbebf('0x20')]||null:null,'attributes':_0x51c5e4[_0xbebf('0x16')]?_0x51c5e4['options'][_0xbebf('0x17')]||null:null,'include':_0x51c5e4[_0xbebf('0x16')]?_0x51c5e4['options'][_0xbebf('0x19')]?_[_0xbebf('0x1a')](_0x51c5e4[_0xbebf('0x16')][_0xbebf('0x19')],function(_0x1b395a){return{'model':db[_0x1b395a['model']],'as':_0x1b395a['as'],'attributes':_0x1b395a['attributes'],'include':_0x1b395a[_0xbebf('0x19')]?_[_0xbebf('0x1a')](_0x1b395a[_0xbebf('0x19')],function(_0x561923){return{'model':db[_0x561923[_0xbebf('0x1b')]],'as':_0x561923['as'],'attributes':_0x561923[_0xbebf('0x17')],'include':_0x561923['include']?_['map'](_0x561923[_0xbebf('0x19')],function(_0x2db836){return{'model':db[_0x2db836[_0xbebf('0x1b')]],'as':_0x2db836['as'],'attributes':_0x2db836[_0xbebf('0x17')]};}):[]};}):[]};}):[]:[]})[_0xbebf('0xa')](function(_0x4f1cc9){logger[_0xbebf('0xb')](_0xbebf('0x1d'),_0x51c5e4);logger[_0xbebf('0xe')](_0xbebf('0x1d'),_0x51c5e4,JSON['stringify'](_0x4f1cc9));_0x587582(_0x4f1cc9);})[_0xbebf('0x13')](function(_0x5e0c4a){logger['error'](_0xbebf('0x1d'),_0x5e0c4a[_0xbebf('0x12')],_0x51c5e4);_0x3093cf(_0x54f3b0[_0xbebf('0x11')](0x1f4,_0x5e0c4a[_0xbebf('0x12')]));});});}; \ No newline at end of file +var _0x6762=['client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetDynamics365Account','options','attributes','limit','map','include','model','debug','ShowDynamics365Account','Dynamics365Account','find','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x11e793,_0x4d6a22){var _0xe673ef=function(_0x49735f){while(--_0x49735f){_0x11e793['push'](_0x11e793['shift']());}};_0xe673ef(++_0x4d6a22);}(_0x6762,0x1a4));var _0x2676=function(_0x181e07,_0x5910aa){_0x181e07=_0x181e07-0x0;var _0x5cc8a9=_0x6762[_0x181e07];return _0x5cc8a9;};'use strict';var _=require(_0x2676('0x0'));var util=require(_0x2676('0x1'));var moment=require(_0x2676('0x2'));var BPromise=require('bluebird');var rs=require(_0x2676('0x3'));var fs=require('fs');var Redis=require(_0x2676('0x4'));var db=require(_0x2676('0x5'))['db'];var utils=require(_0x2676('0x6'));var logger=require(_0x2676('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2676('0x8'));var client=jayson[_0x2676('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x175f1c,_0x54cc49,_0x3b12f2){return new BPromise(function(_0x3dbd6c,_0x197baa){return client[_0x2676('0xa')](_0x175f1c,_0x3b12f2)[_0x2676('0xb')](function(_0x5a2265){logger[_0x2676('0xc')](_0x2676('0xd'),_0x54cc49,_0x2676('0xe'));logger['debug'](_0x2676('0xf'),_0x54cc49,'request\x20sent',JSON[_0x2676('0x10')](_0x5a2265));if(_0x5a2265['error']){if(_0x5a2265[_0x2676('0x11')][_0x2676('0x12')]===0x1f4){logger[_0x2676('0x11')](_0x2676('0xd'),_0x54cc49,_0x5a2265[_0x2676('0x11')]['message']);return _0x197baa(_0x5a2265[_0x2676('0x11')][_0x2676('0x13')]);}logger[_0x2676('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x54cc49,_0x5a2265[_0x2676('0x11')][_0x2676('0x13')]);return _0x3dbd6c(_0x5a2265[_0x2676('0x11')][_0x2676('0x13')]);}else{logger['info'](_0x2676('0xd'),_0x54cc49,_0x2676('0xe'));_0x3dbd6c(_0x5a2265['result'][_0x2676('0x13')]);}})['catch'](function(_0x43d2ee){logger[_0x2676('0x11')](_0x2676('0xd'),_0x54cc49,_0x43d2ee);_0x197baa(_0x43d2ee);});});}exports[_0x2676('0x14')]=function(_0x1870cc){var _0x4c9065=this;return new Promise(function(_0x1a33fd,_0x3eb821){return db['Dynamics365Account']['findAll']({'raw':_0x1870cc['options']?_0x1870cc['options']['raw']===undefined?!![]:![]:!![],'where':_0x1870cc['options']?_0x1870cc['options']['where']||null:null,'attributes':_0x1870cc[_0x2676('0x15')]?_0x1870cc[_0x2676('0x15')][_0x2676('0x16')]||null:null,'limit':_0x1870cc[_0x2676('0x15')]?_0x1870cc[_0x2676('0x15')][_0x2676('0x17')]||null:null,'include':_0x1870cc[_0x2676('0x15')]?_0x1870cc[_0x2676('0x15')]['include']?_[_0x2676('0x18')](_0x1870cc[_0x2676('0x15')][_0x2676('0x19')],function(_0x38bba5){return{'model':db[_0x38bba5[_0x2676('0x1a')]],'as':_0x38bba5['as'],'attributes':_0x38bba5['attributes'],'include':_0x38bba5[_0x2676('0x19')]?_['map'](_0x38bba5[_0x2676('0x19')],function(_0x2c93e1){return{'model':db[_0x2c93e1['model']],'as':_0x2c93e1['as'],'attributes':_0x2c93e1[_0x2676('0x16')],'include':_0x2c93e1[_0x2676('0x19')]?_[_0x2676('0x18')](_0x2c93e1[_0x2676('0x19')],function(_0x155eaa){return{'model':db[_0x155eaa['model']],'as':_0x155eaa['as'],'attributes':_0x155eaa[_0x2676('0x16')]};}):[]};}):[]};}):[]:[]})[_0x2676('0xb')](function(_0x1954b2){logger[_0x2676('0xc')](_0x2676('0x14'),_0x1870cc);logger[_0x2676('0x1b')](_0x2676('0x14'),_0x1870cc,JSON[_0x2676('0x10')](_0x1954b2));_0x1a33fd(_0x1954b2);})['catch'](function(_0x5bf813){logger[_0x2676('0x11')](_0x2676('0x14'),_0x5bf813[_0x2676('0x13')],_0x1870cc);_0x3eb821(_0x4c9065['error'](0x1f4,_0x5bf813['message']));});});};exports[_0x2676('0x1c')]=function(_0x229451){var _0x406e3a=this;return new Promise(function(_0x3715da,_0x5ef01e){return db[_0x2676('0x1d')][_0x2676('0x1e')]({'raw':_0x229451[_0x2676('0x15')]?_0x229451[_0x2676('0x15')][_0x2676('0x1f')]===undefined?!![]:![]:!![],'where':_0x229451[_0x2676('0x15')]?_0x229451[_0x2676('0x15')]['where']||null:null,'attributes':_0x229451[_0x2676('0x15')]?_0x229451[_0x2676('0x15')]['attributes']||null:null,'include':_0x229451[_0x2676('0x15')]?_0x229451[_0x2676('0x15')]['include']?_[_0x2676('0x18')](_0x229451[_0x2676('0x15')][_0x2676('0x19')],function(_0x2e939b){return{'model':db[_0x2e939b['model']],'as':_0x2e939b['as'],'attributes':_0x2e939b['attributes'],'include':_0x2e939b[_0x2676('0x19')]?_[_0x2676('0x18')](_0x2e939b['include'],function(_0x3bbb13){return{'model':db[_0x3bbb13['model']],'as':_0x3bbb13['as'],'attributes':_0x3bbb13['attributes'],'include':_0x3bbb13[_0x2676('0x19')]?_[_0x2676('0x18')](_0x3bbb13[_0x2676('0x19')],function(_0x199fe5){return{'model':db[_0x199fe5['model']],'as':_0x199fe5['as'],'attributes':_0x199fe5[_0x2676('0x16')]};}):[]};}):[]};}):[]:[]})[_0x2676('0xb')](function(_0x3bafed){logger[_0x2676('0xc')](_0x2676('0x1c'),_0x229451);logger[_0x2676('0x1b')]('ShowDynamics365Account',_0x229451,JSON['stringify'](_0x3bafed));_0x3715da(_0x3bafed);})[_0x2676('0x20')](function(_0x2022be){logger['error']('ShowDynamics365Account',_0x2022be[_0x2676('0x13')],_0x229451);_0x5ef01e(_0x406e3a[_0x2676('0x11')](0x1f4,_0x2022be[_0x2676('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 5fdfcd4..2a61b43 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 _0x10d6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','update','destroy','util','path','connect-timeout','Router','fs-extra'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x10d6,0x145));var _0x610d=function(_0x4184e5,_0x176f62){_0x4184e5=_0x4184e5-0x0;var _0x200b7e=_0x10d6[_0x4184e5];return _0x200b7e;};'use strict';var multer=require('multer');var util=require(_0x610d('0x0'));var path=require(_0x610d('0x1'));var timeout=require(_0x610d('0x2'));var express=require('express');var router=express[_0x610d('0x3')]();var fs_extra=require(_0x610d('0x4'));var auth=require(_0x610d('0x5'));var interaction=require(_0x610d('0x6'));var config=require(_0x610d('0x7'));var controller=require(_0x610d('0x8'));router[_0x610d('0x9')]('/',auth['isAuthenticated'](),controller[_0x610d('0xa')]);router[_0x610d('0x9')](_0x610d('0xb'),auth[_0x610d('0xc')](),controller[_0x610d('0xd')]);router[_0x610d('0x9')](_0x610d('0xe'),auth[_0x610d('0xc')](),controller[_0x610d('0xf')]);router[_0x610d('0x9')](_0x610d('0x10'),auth[_0x610d('0xc')](),controller[_0x610d('0x11')]);router[_0x610d('0x9')]('/:id/descriptions',auth[_0x610d('0xc')](),controller[_0x610d('0x12')]);router['post']('/',auth[_0x610d('0xc')](),controller[_0x610d('0x13')]);router['put'](_0x610d('0xb'),auth[_0x610d('0xc')](),controller[_0x610d('0x14')]);router['delete'](_0x610d('0xb'),auth[_0x610d('0xc')](),controller[_0x610d('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa5dd=['create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','post'];(function(_0xa26794,_0x4b5b83){var _0x477be0=function(_0x5d6d43){while(--_0x5d6d43){_0xa26794['push'](_0xa26794['shift']());}};_0x477be0(++_0x4b5b83);}(_0xa5dd,0x101));var _0xda5d=function(_0x3e0ef0,_0x484888){_0x3e0ef0=_0x3e0ef0-0x0;var _0xcce035=_0xa5dd[_0x3e0ef0];return _0xcce035;};'use strict';var multer=require(_0xda5d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda5d('0x1'));var express=require(_0xda5d('0x2'));var router=express[_0xda5d('0x3')]();var fs_extra=require(_0xda5d('0x4'));var auth=require(_0xda5d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda5d('0x6'));var controller=require(_0xda5d('0x7'));router[_0xda5d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda5d('0x8')](_0xda5d('0x9'),auth[_0xda5d('0xa')](),controller[_0xda5d('0xb')]);router[_0xda5d('0x8')](_0xda5d('0xc'),auth[_0xda5d('0xa')](),controller[_0xda5d('0xd')]);router['get']('/:id/subjects',auth[_0xda5d('0xa')](),controller['getSubjects']);router['get'](_0xda5d('0xe'),auth[_0xda5d('0xa')](),controller['getDescriptions']);router[_0xda5d('0xf')]('/',auth[_0xda5d('0xa')](),controller[_0xda5d('0x10')]);router['put']('/:id',auth[_0xda5d('0xa')](),controller[_0xda5d('0x11')]);router[_0xda5d('0x12')](_0xda5d('0x9'),auth[_0xda5d('0xa')](),controller[_0xda5d('0x13')]);module[_0xda5d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index ce21ae3..92dda96 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 _0x2d8a=['ENUM','incident','phonecall','contact','BOOLEAN','exports','STRING'];(function(_0x441315,_0x55af18){var _0x3f360c=function(_0x1fbe27){while(--_0x1fbe27){_0x441315['push'](_0x441315['shift']());}};_0x3f360c(++_0x55af18);}(_0x2d8a,0x1ef));var _0xa2d8=function(_0x396d48,_0x264959){_0x396d48=_0x396d48-0x0;var _0x5ee81c=_0x2d8a[_0x396d48];return _0x5ee81c;};'use strict';var Sequelize=require('sequelize');module[_0xa2d8('0x0')]={'name':{'type':Sequelize[_0xa2d8('0x1')]},'description':{'type':Sequelize[_0xa2d8('0x1')]},'ticketType':{'type':Sequelize[_0xa2d8('0x2')](_0xa2d8('0x3'),_0xa2d8('0x4')),'defaultValue':_0xa2d8('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0xa2d8('0x5'),'nothing'),'defaultValue':_0xa2d8('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa2d8('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x436a=['phonecall','contact','nothing','BOOLEAN','sequelize','STRING','ENUM','incident'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0x436a,0xb4));var _0xa436=function(_0x1ad3bb,_0x429647){_0x1ad3bb=_0x1ad3bb-0x0;var _0x1447fc=_0x436a[_0x1ad3bb];return _0x1447fc;};'use strict';var Sequelize=require(_0xa436('0x0'));module['exports']={'name':{'type':Sequelize[_0xa436('0x1')]},'description':{'type':Sequelize[_0xa436('0x1')]},'ticketType':{'type':Sequelize[_0xa436('0x2')](_0xa436('0x3'),_0xa436('0x4')),'defaultValue':_0xa436('0x3')},'moduleCreate':{'type':Sequelize[_0xa436('0x2')](_0xa436('0x5'),_0xa436('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa436('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa436('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index b385be4..6c913fe 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 _0xbd77=['keys','options','find','create','body','getFields','findOne','hasOwnProperty','nolimit','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','error','name','send','index','rawAttributes','fieldName','map','query','filters','attributes','intersection','model','fields','length','order','sort','where','pick','filter','type','VIRTUAL','merge','Dynamics365Configuration','then','includeAll','include','catch','show','params'];(function(_0x29d4b5,_0x1913e2){var _0x3fbb01=function(_0x8b0a41){while(--_0x8b0a41){_0x29d4b5['push'](_0x29d4b5['shift']());}};_0x3fbb01(++_0x1913e2);}(_0xbd77,0x183));var _0x7bd7=function(_0x472995,_0x269d98){_0x472995=_0x472995-0x0;var _0x521303=_0xbd77[_0x472995];return _0x521303;};'use strict';var emlformat=require(_0x7bd7('0x0'));var rimraf=require(_0x7bd7('0x1'));var zipdir=require(_0x7bd7('0x2'));var jsonpatch=require(_0x7bd7('0x3'));var rp=require('request-promise');var moment=require(_0x7bd7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7bd7('0x5'));var util=require(_0x7bd7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7bd7('0x7'));var ejs=require(_0x7bd7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bd7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bd7('0xa'));var deskjs=require(_0x7bd7('0xb'));var toCsv=require(_0x7bd7('0x7'));var querystring=require(_0x7bd7('0xc'));var Papa=require('papaparse');var Redis=require(_0x7bd7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7bd7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bd7('0xf'));var logger=require(_0x7bd7('0x10'))(_0x7bd7('0x11'));var utils=require(_0x7bd7('0x12'));var config=require(_0x7bd7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c67d4,_0x1f5f85){_0x1f5f85=_0x1f5f85||0xcc;return function(_0x58d04b){if(_0x58d04b){return _0x5c67d4[_0x7bd7('0x14')](_0x1f5f85);}return _0x5c67d4[_0x7bd7('0x15')](_0x1f5f85)[_0x7bd7('0x16')]();};}function respondWithResult(_0x3ed067,_0x452b3e){_0x452b3e=_0x452b3e||0xc8;return function(_0xd43e41){if(_0xd43e41){return _0x3ed067[_0x7bd7('0x15')](_0x452b3e)[_0x7bd7('0x17')](_0xd43e41);}};}function respondWithFilteredResult(_0xf7f217,_0x4abc6d){return function(_0xa27113){if(_0xa27113){var _0x2c7e7e=typeof _0x4abc6d[_0x7bd7('0x18')]==='undefined'&&typeof _0x4abc6d[_0x7bd7('0x19')]===_0x7bd7('0x1a');var _0xaa218b=_0xa27113[_0x7bd7('0x1b')];var _0x5eac75=_0x2c7e7e?0x0:_0x4abc6d[_0x7bd7('0x18')];var _0x3dc2fd=_0x2c7e7e?_0xa27113[_0x7bd7('0x1b')]:_0x4abc6d[_0x7bd7('0x18')]+_0x4abc6d[_0x7bd7('0x19')];var _0x565133;if(_0x3dc2fd>=_0xaa218b){_0x3dc2fd=_0xaa218b;_0x565133=0xc8;}else{_0x565133=0xce;}_0xf7f217['status'](_0x565133);return _0xf7f217[_0x7bd7('0x1c')](_0x7bd7('0x1d'),_0x5eac75+'-'+_0x3dc2fd+'/'+_0xaa218b)['json'](_0xa27113);}return null;};}function patchUpdates(_0x46da50){return function(_0x41bf70){try{jsonpatch[_0x7bd7('0x1e')](_0x41bf70,_0x46da50,!![]);}catch(_0x3cb6ae){return BPromise[_0x7bd7('0x1f')](_0x3cb6ae);}return _0x41bf70[_0x7bd7('0x20')]();};}function saveUpdates(_0x4df200,_0x218523){return function(_0x16bb46){if(_0x16bb46){return _0x16bb46['update'](_0x4df200)['then'](function(_0x10df86){return _0x10df86;});}return null;};}function removeEntity(_0x443ab5,_0x41cdac){return function(_0x13c9e5){if(_0x13c9e5){return _0x13c9e5[_0x7bd7('0x21')]()['then'](function(){_0x443ab5['status'](0xcc)[_0x7bd7('0x16')]();});}};}function handleEntityNotFound(_0x54be69,_0x3a1ad3){return function(_0xe6a939){if(!_0xe6a939){_0x54be69['sendStatus'](0x194);}return _0xe6a939;};}function handleError(_0x30a9a5,_0x5acda1){_0x5acda1=_0x5acda1||0x1f4;return function(_0x5e4578){logger[_0x7bd7('0x22')](_0x5e4578['stack']);if(_0x5e4578[_0x7bd7('0x23')]){delete _0x5e4578[_0x7bd7('0x23')];}_0x30a9a5['status'](_0x5acda1)[_0x7bd7('0x24')](_0x5e4578);};}exports[_0x7bd7('0x25')]=function(_0x12faf3,_0x428b48){var _0x3fa5ae={},_0xeb5461={},_0x5a8ad6={'count':0x0,'rows':[]};var _0x16042d=_['map'](db['Dynamics365Configuration'][_0x7bd7('0x26')],function(_0x28e57c){return{'name':_0x28e57c[_0x7bd7('0x27')],'type':_0x28e57c['type']['key']};});_0xeb5461['model']=_[_0x7bd7('0x28')](_0x16042d,_0x7bd7('0x23'));_0xeb5461[_0x7bd7('0x29')]=_['keys'](_0x12faf3[_0x7bd7('0x29')]);_0xeb5461[_0x7bd7('0x2a')]=_['intersection'](_0xeb5461['model'],_0xeb5461[_0x7bd7('0x29')]);_0x3fa5ae[_0x7bd7('0x2b')]=_[_0x7bd7('0x2c')](_0xeb5461[_0x7bd7('0x2d')],qs[_0x7bd7('0x2e')](_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x2e')]));_0x3fa5ae[_0x7bd7('0x2b')]=_0x3fa5ae[_0x7bd7('0x2b')][_0x7bd7('0x2f')]?_0x3fa5ae[_0x7bd7('0x2b')]:_0xeb5461[_0x7bd7('0x2d')];if(!_0x12faf3[_0x7bd7('0x29')]['hasOwnProperty']('nolimit')){_0x3fa5ae['limit']=qs[_0x7bd7('0x19')](_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x19')]);_0x3fa5ae[_0x7bd7('0x18')]=qs[_0x7bd7('0x18')](_0x12faf3[_0x7bd7('0x29')]['offset']);}_0x3fa5ae[_0x7bd7('0x30')]=qs[_0x7bd7('0x31')](_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x31')]);_0x3fa5ae[_0x7bd7('0x32')]=qs['filters'](_[_0x7bd7('0x33')](_0x12faf3['query'],_0xeb5461[_0x7bd7('0x2a')]),_0x16042d);if(_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x34')]){_0x3fa5ae['where']=_['merge'](_0x3fa5ae['where'],{'$or':_[_0x7bd7('0x28')](_0x16042d,function(_0x5bfc91){if(_0x5bfc91[_0x7bd7('0x35')]!==_0x7bd7('0x36')){var _0x13e940={};_0x13e940[_0x5bfc91[_0x7bd7('0x23')]]={'$like':'%'+_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x34')]+'%'};return _0x13e940;}})});}_0x3fa5ae=_[_0x7bd7('0x37')]({},_0x3fa5ae,_0x12faf3['options']);var _0x20cc0e={'where':_0x3fa5ae[_0x7bd7('0x32')]};return db[_0x7bd7('0x38')]['count'](_0x20cc0e)[_0x7bd7('0x39')](function(_0x2fb9c8){_0x5a8ad6[_0x7bd7('0x1b')]=_0x2fb9c8;if(_0x12faf3[_0x7bd7('0x29')][_0x7bd7('0x3a')]){_0x3fa5ae[_0x7bd7('0x3b')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x3fa5ae);})[_0x7bd7('0x39')](function(_0x11a3f3){_0x5a8ad6['rows']=_0x11a3f3;return _0x5a8ad6;})[_0x7bd7('0x39')](respondWithFilteredResult(_0x428b48,_0x3fa5ae))[_0x7bd7('0x3c')](handleError(_0x428b48,null));};exports[_0x7bd7('0x3d')]=function(_0x1ec57d,_0x2999f2){var _0x2541d2={'raw':![],'where':{'id':_0x1ec57d[_0x7bd7('0x3e')]['id']}},_0x565cb8={};_0x565cb8[_0x7bd7('0x2d')]=_[_0x7bd7('0x3f')](db[_0x7bd7('0x38')][_0x7bd7('0x26')]);_0x565cb8[_0x7bd7('0x29')]=_[_0x7bd7('0x3f')](_0x1ec57d[_0x7bd7('0x29')]);_0x565cb8['filters']=_[_0x7bd7('0x2c')](_0x565cb8[_0x7bd7('0x2d')],_0x565cb8[_0x7bd7('0x29')]);_0x2541d2[_0x7bd7('0x2b')]=_[_0x7bd7('0x2c')](_0x565cb8[_0x7bd7('0x2d')],qs[_0x7bd7('0x2e')](_0x1ec57d[_0x7bd7('0x29')][_0x7bd7('0x2e')]));_0x2541d2['attributes']=_0x2541d2[_0x7bd7('0x2b')]['length']?_0x2541d2[_0x7bd7('0x2b')]:_0x565cb8['model'];if(_0x1ec57d[_0x7bd7('0x29')][_0x7bd7('0x3a')]){_0x2541d2['include']=[{'all':!![]}];}_0x2541d2=_['merge']({},_0x2541d2,_0x1ec57d[_0x7bd7('0x40')]);return db[_0x7bd7('0x38')][_0x7bd7('0x41')](_0x2541d2)[_0x7bd7('0x39')](handleEntityNotFound(_0x2999f2,null))['then'](respondWithResult(_0x2999f2,null))[_0x7bd7('0x3c')](handleError(_0x2999f2,null));};exports[_0x7bd7('0x42')]=function(_0x17ae14,_0x553c7a){return db[_0x7bd7('0x38')][_0x7bd7('0x42')](_0x17ae14[_0x7bd7('0x43')],{})[_0x7bd7('0x39')](respondWithResult(_0x553c7a,0xc9))[_0x7bd7('0x3c')](handleError(_0x553c7a,null));};exports['update']=function(_0x2488d1,_0x32843b){if(_0x2488d1['body']['id']){delete _0x2488d1['body']['id'];}return db['Dynamics365Configuration'][_0x7bd7('0x41')]({'where':{'id':_0x2488d1[_0x7bd7('0x3e')]['id']}})[_0x7bd7('0x39')](handleEntityNotFound(_0x32843b,null))[_0x7bd7('0x39')](saveUpdates(_0x2488d1['body'],null))['then'](respondWithResult(_0x32843b,null))[_0x7bd7('0x3c')](handleError(_0x32843b,null));};exports[_0x7bd7('0x21')]=function(_0x4455bd,_0x5d97fb){return db[_0x7bd7('0x38')][_0x7bd7('0x41')]({'where':{'id':_0x4455bd[_0x7bd7('0x3e')]['id']}})[_0x7bd7('0x39')](handleEntityNotFound(_0x5d97fb,null))[_0x7bd7('0x39')](removeEntity(_0x5d97fb,null))[_0x7bd7('0x3c')](handleError(_0x5d97fb,null));};exports[_0x7bd7('0x44')]=function(_0x3ed5e2,_0x4ae082,_0x138959){var _0x5501ff={};var _0x3ce2f4={};var _0x42fb4b;var _0x2d9ebb;return db[_0x7bd7('0x38')][_0x7bd7('0x45')]({'where':{'id':_0x3ed5e2[_0x7bd7('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4ae082,null))['then'](function(_0x2f61f7){if(_0x2f61f7){_0x42fb4b=_0x2f61f7;_0x3ce2f4[_0x7bd7('0x2d')]=_[_0x7bd7('0x3f')](db['Dynamics365Field'][_0x7bd7('0x26')]);_0x3ce2f4[_0x7bd7('0x29')]=_[_0x7bd7('0x3f')](_0x3ed5e2[_0x7bd7('0x29')]);_0x3ce2f4['filters']=_['intersection'](_0x3ce2f4[_0x7bd7('0x2d')],_0x3ce2f4[_0x7bd7('0x29')]);_0x5501ff[_0x7bd7('0x2b')]=_[_0x7bd7('0x2c')](_0x3ce2f4[_0x7bd7('0x2d')],qs['fields'](_0x3ed5e2[_0x7bd7('0x29')][_0x7bd7('0x2e')]));_0x5501ff[_0x7bd7('0x2b')]=_0x5501ff['attributes']['length']?_0x5501ff['attributes']:_0x3ce2f4['model'];_0x5501ff['order']=qs[_0x7bd7('0x31')](_0x3ed5e2['query']['sort']);_0x5501ff[_0x7bd7('0x32')]=qs[_0x7bd7('0x2a')](_[_0x7bd7('0x33')](_0x3ed5e2[_0x7bd7('0x29')],_0x3ce2f4[_0x7bd7('0x2a')]));if(_0x3ed5e2['query'][_0x7bd7('0x34')]){_0x5501ff[_0x7bd7('0x32')]=_[_0x7bd7('0x37')](_0x5501ff[_0x7bd7('0x32')],{'$or':_[_0x7bd7('0x28')](_0x5501ff[_0x7bd7('0x2b')],function(_0x547300){var _0x54e3f7={};_0x54e3f7[_0x547300]={'$like':'%'+_0x3ed5e2[_0x7bd7('0x29')][_0x7bd7('0x34')]+'%'};return _0x54e3f7;})});}_0x5501ff=_[_0x7bd7('0x37')]({},_0x5501ff,_0x3ed5e2[_0x7bd7('0x40')]);return _0x42fb4b['getFields'](_0x5501ff);}})[_0x7bd7('0x39')](function(_0x376375){if(_0x376375){_0x2d9ebb=_0x376375[_0x7bd7('0x2f')];if(!_0x3ed5e2[_0x7bd7('0x29')][_0x7bd7('0x46')](_0x7bd7('0x47'))){_0x5501ff[_0x7bd7('0x19')]=qs['limit'](_0x3ed5e2['query'][_0x7bd7('0x19')]);_0x5501ff[_0x7bd7('0x18')]=qs[_0x7bd7('0x18')](_0x3ed5e2['query']['offset']);}return _0x42fb4b['getFields'](_0x5501ff);}})['then'](function(_0x42390d){if(_0x42390d){return _0x42390d?{'count':_0x2d9ebb,'rows':_0x42390d}:null;}})[_0x7bd7('0x39')](respondWithResult(_0x4ae082,null))[_0x7bd7('0x3c')](handleError(_0x4ae082,null));};exports['getSubjects']=function(_0x3872b6,_0x469516,_0xda8829){var _0x29d0d5={};var _0x13f91d={};var _0x6d9222;var _0x849a20;return db[_0x7bd7('0x38')][_0x7bd7('0x45')]({'where':{'id':_0x3872b6['params']['id']}})[_0x7bd7('0x39')](handleEntityNotFound(_0x469516,null))['then'](function(_0x13a9e0){if(_0x13a9e0){_0x6d9222=_0x13a9e0;_0x13f91d[_0x7bd7('0x2d')]=_[_0x7bd7('0x3f')](db['Dynamics365Field'][_0x7bd7('0x26')]);_0x13f91d[_0x7bd7('0x29')]=_[_0x7bd7('0x3f')](_0x3872b6[_0x7bd7('0x29')]);_0x13f91d[_0x7bd7('0x2a')]=_[_0x7bd7('0x2c')](_0x13f91d[_0x7bd7('0x2d')],_0x13f91d[_0x7bd7('0x29')]);_0x29d0d5['attributes']=_[_0x7bd7('0x2c')](_0x13f91d[_0x7bd7('0x2d')],qs[_0x7bd7('0x2e')](_0x3872b6[_0x7bd7('0x29')]['fields']));_0x29d0d5[_0x7bd7('0x2b')]=_0x29d0d5[_0x7bd7('0x2b')][_0x7bd7('0x2f')]?_0x29d0d5[_0x7bd7('0x2b')]:_0x13f91d[_0x7bd7('0x2d')];_0x29d0d5[_0x7bd7('0x30')]=qs[_0x7bd7('0x31')](_0x3872b6['query']['sort']);_0x29d0d5['where']=qs['filters'](_[_0x7bd7('0x33')](_0x3872b6[_0x7bd7('0x29')],_0x13f91d['filters']));if(_0x3872b6[_0x7bd7('0x29')][_0x7bd7('0x34')]){_0x29d0d5[_0x7bd7('0x32')]=_[_0x7bd7('0x37')](_0x29d0d5[_0x7bd7('0x32')],{'$or':_[_0x7bd7('0x28')](_0x29d0d5[_0x7bd7('0x2b')],function(_0x5647a6){var _0x171169={};_0x171169[_0x5647a6]={'$like':'%'+_0x3872b6['query'][_0x7bd7('0x34')]+'%'};return _0x171169;})});}_0x29d0d5=_[_0x7bd7('0x37')]({},_0x29d0d5,_0x3872b6['options']);return _0x6d9222[_0x7bd7('0x48')](_0x29d0d5);}})['then'](function(_0x5ea1fb){if(_0x5ea1fb){_0x849a20=_0x5ea1fb[_0x7bd7('0x2f')];if(!_0x3872b6['query'][_0x7bd7('0x46')]('nolimit')){_0x29d0d5['limit']=qs[_0x7bd7('0x19')](_0x3872b6[_0x7bd7('0x29')][_0x7bd7('0x19')]);_0x29d0d5['offset']=qs['offset'](_0x3872b6[_0x7bd7('0x29')][_0x7bd7('0x18')]);}return _0x6d9222[_0x7bd7('0x48')](_0x29d0d5);}})[_0x7bd7('0x39')](function(_0x3f7ad6){if(_0x3f7ad6){return _0x3f7ad6?{'count':_0x849a20,'rows':_0x3f7ad6}:null;}})[_0x7bd7('0x39')](respondWithResult(_0x469516,null))[_0x7bd7('0x3c')](handleError(_0x469516,null));};exports[_0x7bd7('0x49')]=function(_0x8b8ba3,_0x37ff2a,_0x5cd53d){var _0x4ab4df={};var _0x5256a3={};var _0xa08bb0;var _0x2ec37b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x8b8ba3['params']['id']}})[_0x7bd7('0x39')](handleEntityNotFound(_0x37ff2a,null))[_0x7bd7('0x39')](function(_0x1a019e){if(_0x1a019e){_0xa08bb0=_0x1a019e;_0x5256a3[_0x7bd7('0x2d')]=_[_0x7bd7('0x3f')](db[_0x7bd7('0x4a')][_0x7bd7('0x26')]);_0x5256a3[_0x7bd7('0x29')]=_[_0x7bd7('0x3f')](_0x8b8ba3['query']);_0x5256a3[_0x7bd7('0x2a')]=_['intersection'](_0x5256a3[_0x7bd7('0x2d')],_0x5256a3['query']);_0x4ab4df[_0x7bd7('0x2b')]=_[_0x7bd7('0x2c')](_0x5256a3[_0x7bd7('0x2d')],qs[_0x7bd7('0x2e')](_0x8b8ba3[_0x7bd7('0x29')][_0x7bd7('0x2e')]));_0x4ab4df[_0x7bd7('0x2b')]=_0x4ab4df[_0x7bd7('0x2b')][_0x7bd7('0x2f')]?_0x4ab4df[_0x7bd7('0x2b')]:_0x5256a3[_0x7bd7('0x2d')];_0x4ab4df['order']=qs['sort'](_0x8b8ba3['query'][_0x7bd7('0x31')]);_0x4ab4df['where']=qs[_0x7bd7('0x2a')](_[_0x7bd7('0x33')](_0x8b8ba3[_0x7bd7('0x29')],_0x5256a3[_0x7bd7('0x2a')]));if(_0x8b8ba3[_0x7bd7('0x29')]['filter']){_0x4ab4df[_0x7bd7('0x32')]=_[_0x7bd7('0x37')](_0x4ab4df[_0x7bd7('0x32')],{'$or':_['map'](_0x4ab4df['attributes'],function(_0x5f317a){var _0x6910f8={};_0x6910f8[_0x5f317a]={'$like':'%'+_0x8b8ba3['query'][_0x7bd7('0x34')]+'%'};return _0x6910f8;})});}_0x4ab4df=_[_0x7bd7('0x37')]({},_0x4ab4df,_0x8b8ba3[_0x7bd7('0x40')]);return _0xa08bb0['getDescriptions'](_0x4ab4df);}})[_0x7bd7('0x39')](function(_0x40a144){if(_0x40a144){_0x2ec37b=_0x40a144[_0x7bd7('0x2f')];if(!_0x8b8ba3[_0x7bd7('0x29')][_0x7bd7('0x46')](_0x7bd7('0x47'))){_0x4ab4df[_0x7bd7('0x19')]=qs['limit'](_0x8b8ba3[_0x7bd7('0x29')][_0x7bd7('0x19')]);_0x4ab4df[_0x7bd7('0x18')]=qs[_0x7bd7('0x18')](_0x8b8ba3['query']['offset']);}return _0xa08bb0[_0x7bd7('0x49')](_0x4ab4df);}})['then'](function(_0x664f33){if(_0x664f33){return _0x664f33?{'count':_0x2ec37b,'rows':_0x664f33}:null;}})[_0x7bd7('0x39')](respondWithResult(_0x37ff2a,null))['catch'](handleError(_0x37ff2a,null));}; \ No newline at end of file +var _0x0373=['type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','catch','create','find','body','getFields','findOne','filter','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','status','end','json','offset','limit','undefined','count','reject','update','then','destroy','sendStatus','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName'];(function(_0x5e5e17,_0x1e80c3){var _0x22f9af=function(_0x3e91de){while(--_0x3e91de){_0x5e5e17['push'](_0x5e5e17['shift']());}};_0x22f9af(++_0x1e80c3);}(_0x0373,0x6c));var _0x3037=function(_0x515e13,_0x3fabd7){_0x515e13=_0x515e13-0x0;var _0x1dd659=_0x0373[_0x515e13];return _0x1dd659;};'use strict';var emlformat=require(_0x3037('0x0'));var rimraf=require(_0x3037('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3037('0x2'));var rp=require('request-promise');var moment=require(_0x3037('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3037('0x4'));var util=require(_0x3037('0x5'));var path=require(_0x3037('0x6'));var sox=require(_0x3037('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3037('0x8'));var _=require(_0x3037('0x9'));var squel=require('squel');var crypto=require(_0x3037('0xa'));var jsforce=require(_0x3037('0xb'));var deskjs=require(_0x3037('0xc'));var toCsv=require(_0x3037('0xd'));var querystring=require(_0x3037('0xe'));var Papa=require(_0x3037('0xf'));var Redis=require(_0x3037('0x10'));var authService=require(_0x3037('0x11'));var qs=require(_0x3037('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3037('0x13'))(_0x3037('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xff1220,_0x4273db){_0x4273db=_0x4273db||0xcc;return function(_0x5ae78d){if(_0x5ae78d){return _0xff1220['sendStatus'](_0x4273db);}return _0xff1220[_0x3037('0x15')](_0x4273db)[_0x3037('0x16')]();};}function respondWithResult(_0x1317b9,_0x534fa4){_0x534fa4=_0x534fa4||0xc8;return function(_0x1bd770){if(_0x1bd770){return _0x1317b9['status'](_0x534fa4)[_0x3037('0x17')](_0x1bd770);}};}function respondWithFilteredResult(_0x1b65db,_0x3a8031){return function(_0x3a68bb){if(_0x3a68bb){var _0xf1554e=typeof _0x3a8031[_0x3037('0x18')]==='undefined'&&typeof _0x3a8031[_0x3037('0x19')]===_0x3037('0x1a');var _0x4391d0=_0x3a68bb[_0x3037('0x1b')];var _0x48dec7=_0xf1554e?0x0:_0x3a8031[_0x3037('0x18')];var _0xee839a=_0xf1554e?_0x3a68bb[_0x3037('0x1b')]:_0x3a8031[_0x3037('0x18')]+_0x3a8031[_0x3037('0x19')];var _0x59b187;if(_0xee839a>=_0x4391d0){_0xee839a=_0x4391d0;_0x59b187=0xc8;}else{_0x59b187=0xce;}_0x1b65db['status'](_0x59b187);return _0x1b65db['set']('Content-Range',_0x48dec7+'-'+_0xee839a+'/'+_0x4391d0)[_0x3037('0x17')](_0x3a68bb);}return null;};}function patchUpdates(_0x5c1ebb){return function(_0x5c345e){try{jsonpatch['apply'](_0x5c345e,_0x5c1ebb,!![]);}catch(_0x2e8dd2){return BPromise[_0x3037('0x1c')](_0x2e8dd2);}return _0x5c345e['save']();};}function saveUpdates(_0x5354dc,_0x5060cc){return function(_0x586066){if(_0x586066){return _0x586066[_0x3037('0x1d')](_0x5354dc)[_0x3037('0x1e')](function(_0x57af7a){return _0x57af7a;});}return null;};}function removeEntity(_0x2bac17,_0x1e6865){return function(_0x310a2b){if(_0x310a2b){return _0x310a2b[_0x3037('0x1f')]()[_0x3037('0x1e')](function(){_0x2bac17[_0x3037('0x15')](0xcc)[_0x3037('0x16')]();});}};}function handleEntityNotFound(_0x16b2f8,_0x301cd7){return function(_0x31b7ba){if(!_0x31b7ba){_0x16b2f8[_0x3037('0x20')](0x194);}return _0x31b7ba;};}function handleError(_0x4b01e4,_0x2da2d4){_0x2da2d4=_0x2da2d4||0x1f4;return function(_0x35519e){logger['error'](_0x35519e[_0x3037('0x21')]);if(_0x35519e['name']){delete _0x35519e[_0x3037('0x22')];}_0x4b01e4[_0x3037('0x15')](_0x2da2d4)['send'](_0x35519e);};}exports[_0x3037('0x23')]=function(_0x37d475,_0x11f917){var _0x186113={},_0xb09192={},_0x132dc9={'count':0x0,'rows':[]};var _0xed9536=_[_0x3037('0x24')](db[_0x3037('0x25')][_0x3037('0x26')],function(_0x2d7eff){return{'name':_0x2d7eff[_0x3037('0x27')],'type':_0x2d7eff[_0x3037('0x28')][_0x3037('0x29')]};});_0xb09192[_0x3037('0x2a')]=_[_0x3037('0x24')](_0xed9536,'name');_0xb09192['query']=_[_0x3037('0x2b')](_0x37d475['query']);_0xb09192['filters']=_[_0x3037('0x2c')](_0xb09192[_0x3037('0x2a')],_0xb09192['query']);_0x186113[_0x3037('0x2d')]=_[_0x3037('0x2c')](_0xb09192[_0x3037('0x2a')],qs[_0x3037('0x2e')](_0x37d475['query']['fields']));_0x186113[_0x3037('0x2d')]=_0x186113[_0x3037('0x2d')][_0x3037('0x2f')]?_0x186113[_0x3037('0x2d')]:_0xb09192[_0x3037('0x2a')];if(!_0x37d475[_0x3037('0x30')][_0x3037('0x31')](_0x3037('0x32'))){_0x186113[_0x3037('0x19')]=qs[_0x3037('0x19')](_0x37d475['query'][_0x3037('0x19')]);_0x186113[_0x3037('0x18')]=qs[_0x3037('0x18')](_0x37d475[_0x3037('0x30')]['offset']);}_0x186113[_0x3037('0x33')]=qs['sort'](_0x37d475['query'][_0x3037('0x34')]);_0x186113[_0x3037('0x35')]=qs[_0x3037('0x36')](_[_0x3037('0x37')](_0x37d475[_0x3037('0x30')],_0xb09192[_0x3037('0x36')]),_0xed9536);if(_0x37d475[_0x3037('0x30')]['filter']){_0x186113[_0x3037('0x35')]=_[_0x3037('0x38')](_0x186113[_0x3037('0x35')],{'$or':_[_0x3037('0x24')](_0xed9536,function(_0xd5cdb7){if(_0xd5cdb7[_0x3037('0x28')]!==_0x3037('0x39')){var _0x39e609={};_0x39e609[_0xd5cdb7[_0x3037('0x22')]]={'$like':'%'+_0x37d475[_0x3037('0x30')]['filter']+'%'};return _0x39e609;}})});}_0x186113=_[_0x3037('0x38')]({},_0x186113,_0x37d475[_0x3037('0x3a')]);var _0x5e7385={'where':_0x186113[_0x3037('0x35')]};return db[_0x3037('0x25')][_0x3037('0x1b')](_0x5e7385)[_0x3037('0x1e')](function(_0x54d496){_0x132dc9['count']=_0x54d496;if(_0x37d475[_0x3037('0x30')]['includeAll']){_0x186113[_0x3037('0x3b')]=[{'all':!![]}];}return db[_0x3037('0x25')][_0x3037('0x3c')](_0x186113);})[_0x3037('0x1e')](function(_0x52a58d){_0x132dc9[_0x3037('0x3d')]=_0x52a58d;return _0x132dc9;})['then'](respondWithFilteredResult(_0x11f917,_0x186113))['catch'](handleError(_0x11f917,null));};exports['show']=function(_0x5603d2,_0x53dcbf){var _0x4d0480={'raw':![],'where':{'id':_0x5603d2[_0x3037('0x3e')]['id']}},_0x5b2da5={};_0x5b2da5['model']=_['keys'](db['Dynamics365Configuration'][_0x3037('0x26')]);_0x5b2da5[_0x3037('0x30')]=_['keys'](_0x5603d2[_0x3037('0x30')]);_0x5b2da5[_0x3037('0x36')]=_[_0x3037('0x2c')](_0x5b2da5[_0x3037('0x2a')],_0x5b2da5[_0x3037('0x30')]);_0x4d0480['attributes']=_[_0x3037('0x2c')](_0x5b2da5[_0x3037('0x2a')],qs[_0x3037('0x2e')](_0x5603d2[_0x3037('0x30')][_0x3037('0x2e')]));_0x4d0480[_0x3037('0x2d')]=_0x4d0480['attributes'][_0x3037('0x2f')]?_0x4d0480[_0x3037('0x2d')]:_0x5b2da5['model'];if(_0x5603d2[_0x3037('0x30')][_0x3037('0x3f')]){_0x4d0480[_0x3037('0x3b')]=[{'all':!![]}];}_0x4d0480=_[_0x3037('0x38')]({},_0x4d0480,_0x5603d2[_0x3037('0x3a')]);return db[_0x3037('0x25')]['find'](_0x4d0480)[_0x3037('0x1e')](handleEntityNotFound(_0x53dcbf,null))[_0x3037('0x1e')](respondWithResult(_0x53dcbf,null))[_0x3037('0x40')](handleError(_0x53dcbf,null));};exports[_0x3037('0x41')]=function(_0x54f409,_0x290969){return db[_0x3037('0x25')]['create'](_0x54f409['body'],{})['then'](respondWithResult(_0x290969,0xc9))['catch'](handleError(_0x290969,null));};exports[_0x3037('0x1d')]=function(_0xf19ff1,_0x17546b){if(_0xf19ff1['body']['id']){delete _0xf19ff1['body']['id'];}return db[_0x3037('0x25')][_0x3037('0x42')]({'where':{'id':_0xf19ff1['params']['id']}})[_0x3037('0x1e')](handleEntityNotFound(_0x17546b,null))['then'](saveUpdates(_0xf19ff1[_0x3037('0x43')],null))['then'](respondWithResult(_0x17546b,null))['catch'](handleError(_0x17546b,null));};exports[_0x3037('0x1f')]=function(_0x43b6d0,_0x16afea){return db[_0x3037('0x25')][_0x3037('0x42')]({'where':{'id':_0x43b6d0[_0x3037('0x3e')]['id']}})[_0x3037('0x1e')](handleEntityNotFound(_0x16afea,null))['then'](removeEntity(_0x16afea,null))[_0x3037('0x40')](handleError(_0x16afea,null));};exports[_0x3037('0x44')]=function(_0xfb41e3,_0x530ba5,_0x34867f){var _0x365e0d={};var _0x156091={};var _0x349b16;var _0x24a12a;return db[_0x3037('0x25')][_0x3037('0x45')]({'where':{'id':_0xfb41e3[_0x3037('0x3e')]['id']}})[_0x3037('0x1e')](handleEntityNotFound(_0x530ba5,null))[_0x3037('0x1e')](function(_0x14f3cc){if(_0x14f3cc){_0x349b16=_0x14f3cc;_0x156091[_0x3037('0x2a')]=_['keys'](db['Dynamics365Field'][_0x3037('0x26')]);_0x156091[_0x3037('0x30')]=_[_0x3037('0x2b')](_0xfb41e3[_0x3037('0x30')]);_0x156091[_0x3037('0x36')]=_[_0x3037('0x2c')](_0x156091[_0x3037('0x2a')],_0x156091[_0x3037('0x30')]);_0x365e0d[_0x3037('0x2d')]=_[_0x3037('0x2c')](_0x156091['model'],qs[_0x3037('0x2e')](_0xfb41e3[_0x3037('0x30')]['fields']));_0x365e0d[_0x3037('0x2d')]=_0x365e0d[_0x3037('0x2d')][_0x3037('0x2f')]?_0x365e0d[_0x3037('0x2d')]:_0x156091['model'];_0x365e0d['order']=qs['sort'](_0xfb41e3[_0x3037('0x30')][_0x3037('0x34')]);_0x365e0d[_0x3037('0x35')]=qs[_0x3037('0x36')](_[_0x3037('0x37')](_0xfb41e3['query'],_0x156091['filters']));if(_0xfb41e3[_0x3037('0x30')][_0x3037('0x46')]){_0x365e0d[_0x3037('0x35')]=_[_0x3037('0x38')](_0x365e0d[_0x3037('0x35')],{'$or':_[_0x3037('0x24')](_0x365e0d[_0x3037('0x2d')],function(_0x3fc19e){var _0x10e235={};_0x10e235[_0x3fc19e]={'$like':'%'+_0xfb41e3['query'][_0x3037('0x46')]+'%'};return _0x10e235;})});}_0x365e0d=_[_0x3037('0x38')]({},_0x365e0d,_0xfb41e3[_0x3037('0x3a')]);return _0x349b16[_0x3037('0x44')](_0x365e0d);}})[_0x3037('0x1e')](function(_0x4218a1){if(_0x4218a1){_0x24a12a=_0x4218a1[_0x3037('0x2f')];if(!_0xfb41e3[_0x3037('0x30')][_0x3037('0x31')]('nolimit')){_0x365e0d[_0x3037('0x19')]=qs[_0x3037('0x19')](_0xfb41e3['query']['limit']);_0x365e0d['offset']=qs[_0x3037('0x18')](_0xfb41e3[_0x3037('0x30')][_0x3037('0x18')]);}return _0x349b16[_0x3037('0x44')](_0x365e0d);}})[_0x3037('0x1e')](function(_0xb7ce16){if(_0xb7ce16){return _0xb7ce16?{'count':_0x24a12a,'rows':_0xb7ce16}:null;}})['then'](respondWithResult(_0x530ba5,null))[_0x3037('0x40')](handleError(_0x530ba5,null));};exports[_0x3037('0x47')]=function(_0x541e03,_0x26e712,_0xb0a6df){var _0x3e85f8={};var _0x357d1a={};var _0x57135d;var _0x5b3b1b;return db[_0x3037('0x25')]['findOne']({'where':{'id':_0x541e03[_0x3037('0x3e')]['id']}})[_0x3037('0x1e')](handleEntityNotFound(_0x26e712,null))[_0x3037('0x1e')](function(_0x162f5d){if(_0x162f5d){_0x57135d=_0x162f5d;_0x357d1a[_0x3037('0x2a')]=_[_0x3037('0x2b')](db['Dynamics365Field'][_0x3037('0x26')]);_0x357d1a[_0x3037('0x30')]=_[_0x3037('0x2b')](_0x541e03['query']);_0x357d1a[_0x3037('0x36')]=_[_0x3037('0x2c')](_0x357d1a['model'],_0x357d1a[_0x3037('0x30')]);_0x3e85f8['attributes']=_[_0x3037('0x2c')](_0x357d1a['model'],qs[_0x3037('0x2e')](_0x541e03[_0x3037('0x30')][_0x3037('0x2e')]));_0x3e85f8[_0x3037('0x2d')]=_0x3e85f8[_0x3037('0x2d')][_0x3037('0x2f')]?_0x3e85f8['attributes']:_0x357d1a['model'];_0x3e85f8['order']=qs[_0x3037('0x34')](_0x541e03[_0x3037('0x30')][_0x3037('0x34')]);_0x3e85f8[_0x3037('0x35')]=qs[_0x3037('0x36')](_[_0x3037('0x37')](_0x541e03['query'],_0x357d1a['filters']));if(_0x541e03[_0x3037('0x30')][_0x3037('0x46')]){_0x3e85f8[_0x3037('0x35')]=_['merge'](_0x3e85f8['where'],{'$or':_['map'](_0x3e85f8[_0x3037('0x2d')],function(_0x4c11ae){var _0x1fe18c={};_0x1fe18c[_0x4c11ae]={'$like':'%'+_0x541e03[_0x3037('0x30')][_0x3037('0x46')]+'%'};return _0x1fe18c;})});}_0x3e85f8=_['merge']({},_0x3e85f8,_0x541e03[_0x3037('0x3a')]);return _0x57135d[_0x3037('0x47')](_0x3e85f8);}})[_0x3037('0x1e')](function(_0x3ae64f){if(_0x3ae64f){_0x5b3b1b=_0x3ae64f[_0x3037('0x2f')];if(!_0x541e03[_0x3037('0x30')][_0x3037('0x31')](_0x3037('0x32'))){_0x3e85f8[_0x3037('0x19')]=qs[_0x3037('0x19')](_0x541e03['query'][_0x3037('0x19')]);_0x3e85f8[_0x3037('0x18')]=qs[_0x3037('0x18')](_0x541e03[_0x3037('0x30')][_0x3037('0x18')]);}return _0x57135d[_0x3037('0x47')](_0x3e85f8);}})[_0x3037('0x1e')](function(_0x381ae8){if(_0x381ae8){return _0x381ae8?{'count':_0x5b3b1b,'rows':_0x381ae8}:null;}})['then'](respondWithResult(_0x26e712,null))[_0x3037('0x40')](handleError(_0x26e712,null));};exports[_0x3037('0x48')]=function(_0x11a557,_0xe3c990,_0xefd4d7){var _0x2f66a6={};var _0x3d97b9={};var _0x36006b;var _0x42b357;return db[_0x3037('0x25')][_0x3037('0x45')]({'where':{'id':_0x11a557[_0x3037('0x3e')]['id']}})[_0x3037('0x1e')](handleEntityNotFound(_0xe3c990,null))[_0x3037('0x1e')](function(_0x205822){if(_0x205822){_0x36006b=_0x205822;_0x3d97b9[_0x3037('0x2a')]=_[_0x3037('0x2b')](db[_0x3037('0x49')][_0x3037('0x26')]);_0x3d97b9[_0x3037('0x30')]=_[_0x3037('0x2b')](_0x11a557['query']);_0x3d97b9['filters']=_[_0x3037('0x2c')](_0x3d97b9['model'],_0x3d97b9[_0x3037('0x30')]);_0x2f66a6['attributes']=_[_0x3037('0x2c')](_0x3d97b9['model'],qs['fields'](_0x11a557[_0x3037('0x30')][_0x3037('0x2e')]));_0x2f66a6[_0x3037('0x2d')]=_0x2f66a6[_0x3037('0x2d')]['length']?_0x2f66a6[_0x3037('0x2d')]:_0x3d97b9[_0x3037('0x2a')];_0x2f66a6[_0x3037('0x33')]=qs[_0x3037('0x34')](_0x11a557[_0x3037('0x30')][_0x3037('0x34')]);_0x2f66a6[_0x3037('0x35')]=qs[_0x3037('0x36')](_[_0x3037('0x37')](_0x11a557[_0x3037('0x30')],_0x3d97b9['filters']));if(_0x11a557[_0x3037('0x30')][_0x3037('0x46')]){_0x2f66a6[_0x3037('0x35')]=_[_0x3037('0x38')](_0x2f66a6[_0x3037('0x35')],{'$or':_[_0x3037('0x24')](_0x2f66a6['attributes'],function(_0x51d5b3){var _0x28ec13={};_0x28ec13[_0x51d5b3]={'$like':'%'+_0x11a557[_0x3037('0x30')][_0x3037('0x46')]+'%'};return _0x28ec13;})});}_0x2f66a6=_['merge']({},_0x2f66a6,_0x11a557[_0x3037('0x3a')]);return _0x36006b[_0x3037('0x48')](_0x2f66a6);}})['then'](function(_0x5ceec4){if(_0x5ceec4){_0x42b357=_0x5ceec4[_0x3037('0x2f')];if(!_0x11a557[_0x3037('0x30')]['hasOwnProperty'](_0x3037('0x32'))){_0x2f66a6[_0x3037('0x19')]=qs[_0x3037('0x19')](_0x11a557['query'][_0x3037('0x19')]);_0x2f66a6[_0x3037('0x18')]=qs[_0x3037('0x18')](_0x11a557[_0x3037('0x30')][_0x3037('0x18')]);}return _0x36006b['getDescriptions'](_0x2f66a6);}})[_0x3037('0x1e')](function(_0x507649){if(_0x507649){return _0x507649?{'count':_0x42b357,'rows':_0x507649}:null;}})[_0x3037('0x1e')](respondWithResult(_0xe3c990,null))[_0x3037('0x40')](handleError(_0xe3c990,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f09a610..4aa7774 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 _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x3436cb,_0x34a719){var _0x18e2e7=function(_0x476aff){while(--_0x476aff){_0x3436cb['push'](_0x3436cb['shift']());}};_0x18e2e7(++_0x34a719);}(_0xbec5,0xe5));var _0x5bec=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xbec5[_0x3bfdde];return _0x3f752a;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x28c88e,_0x308d32){var _0x1cadf9=function(_0x2a8aba){while(--_0x2a8aba){_0x28c88e['push'](_0x28c88e['shift']());}};_0x1cadf9(++_0x308d32);}(_0x84ab,0x12f));var _0xb84a=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x84ab[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 3158f11..56343af 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 _0xc4e1=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x4332be,_0x2e9ade){var _0x3c99ae=function(_0x682e41){while(--_0x682e41){_0x4332be['push'](_0x4332be['shift']());}};_0x3c99ae(++_0x2e9ade);}(_0xc4e1,0xb3));var _0x1c4e=function(_0x2f7b71,_0x31bedf){_0x2f7b71=_0x2f7b71-0x0;var _0x5887cb=_0xc4e1[_0x2f7b71];return _0x5887cb;};'use strict';var _=require(_0x1c4e('0x0'));var util=require(_0x1c4e('0x1'));var moment=require(_0x1c4e('0x2'));var BPromise=require(_0x1c4e('0x3'));var rs=require(_0x1c4e('0x4'));var fs=require('fs');var Redis=require(_0x1c4e('0x5'));var db=require(_0x1c4e('0x6'))['db'];var utils=require(_0x1c4e('0x7'));var logger=require('../../config/logger')(_0x1c4e('0x8'));var config=require(_0x1c4e('0x9'));var jayson=require(_0x1c4e('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21a8f4,_0x16a6af,_0x2f21c9){return new BPromise(function(_0x45afcf,_0x2c25ec){return client[_0x1c4e('0xb')](_0x21a8f4,_0x2f21c9)[_0x1c4e('0xc')](function(_0x11820c){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x16a6af,_0x1c4e('0xd'));logger[_0x1c4e('0xe')](_0x1c4e('0xf'),_0x16a6af,_0x1c4e('0xd'),JSON[_0x1c4e('0x10')](_0x11820c));if(_0x11820c[_0x1c4e('0x11')]){if(_0x11820c['error'][_0x1c4e('0x12')]===0x1f4){logger[_0x1c4e('0x11')](_0x1c4e('0x13'),_0x16a6af,_0x11820c['error']['message']);return _0x2c25ec(_0x11820c[_0x1c4e('0x11')][_0x1c4e('0x14')]);}logger['error'](_0x1c4e('0x13'),_0x16a6af,_0x11820c['error'][_0x1c4e('0x14')]);return _0x45afcf(_0x11820c['error'][_0x1c4e('0x14')]);}else{logger[_0x1c4e('0x15')](_0x1c4e('0x13'),_0x16a6af,_0x1c4e('0xd'));_0x45afcf(_0x11820c[_0x1c4e('0x16')][_0x1c4e('0x14')]);}})[_0x1c4e('0x17')](function(_0xaae8cc){logger[_0x1c4e('0x11')](_0x1c4e('0x13'),_0x16a6af,_0xaae8cc);_0x2c25ec(_0xaae8cc);});});} \ No newline at end of file +var _0x0ae4=['../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x31ccee,_0x115433){var _0x4403e0=function(_0x19c877){while(--_0x19c877){_0x31ccee['push'](_0x31ccee['shift']());}};_0x4403e0(++_0x115433);}(_0x0ae4,0x95));var _0x40ae=function(_0x26560d,_0x1affb8){_0x26560d=_0x26560d-0x0;var _0x12ac6a=_0x0ae4[_0x26560d];return _0x12ac6a;};'use strict';var _=require(_0x40ae('0x0'));var util=require(_0x40ae('0x1'));var moment=require('moment');var BPromise=require(_0x40ae('0x2'));var rs=require(_0x40ae('0x3'));var fs=require('fs');var Redis=require(_0x40ae('0x4'));var db=require(_0x40ae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40ae('0x6'))(_0x40ae('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x40ae('0x8')][_0x40ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24fbee,_0x2b094c,_0x3d20ad){return new BPromise(function(_0xb2b58e,_0x231c4b){return client[_0x40ae('0xa')](_0x24fbee,_0x3d20ad)[_0x40ae('0xb')](function(_0x4ad91a){logger[_0x40ae('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2b094c,_0x40ae('0xd'));logger[_0x40ae('0xe')](_0x40ae('0xf'),_0x2b094c,_0x40ae('0xd'),JSON[_0x40ae('0x10')](_0x4ad91a));if(_0x4ad91a[_0x40ae('0x11')]){if(_0x4ad91a['error'][_0x40ae('0x12')]===0x1f4){logger[_0x40ae('0x11')](_0x40ae('0x13'),_0x2b094c,_0x4ad91a[_0x40ae('0x11')][_0x40ae('0x14')]);return _0x231c4b(_0x4ad91a[_0x40ae('0x11')][_0x40ae('0x14')]);}logger['error'](_0x40ae('0x13'),_0x2b094c,_0x4ad91a[_0x40ae('0x11')][_0x40ae('0x14')]);return _0xb2b58e(_0x4ad91a['error']['message']);}else{logger[_0x40ae('0xc')](_0x40ae('0x13'),_0x2b094c,'request\x20sent');_0xb2b58e(_0x4ad91a[_0x40ae('0x15')][_0x40ae('0x14')]);}})['catch'](function(_0x55e6a4){logger[_0x40ae('0x11')](_0x40ae('0x13'),_0x2b094c,_0x55e6a4);_0x231c4b(_0x55e6a4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 15b8a30..2071211 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 _0x36d8=['./intDynamics365Field.controller','get','isAuthenticated','/:id','show','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0x36d8,0x13a));var _0x836d=function(_0x37c2a8,_0xfa8a08){_0x37c2a8=_0x37c2a8-0x0;var _0x41a1a0=_0x36d8[_0x37c2a8];return _0x41a1a0;};'use strict';var multer=require(_0x836d('0x0'));var util=require(_0x836d('0x1'));var path=require(_0x836d('0x2'));var timeout=require(_0x836d('0x3'));var express=require(_0x836d('0x4'));var router=express[_0x836d('0x5')]();var fs_extra=require(_0x836d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x836d('0x7'));var config=require(_0x836d('0x8'));var controller=require(_0x836d('0x9'));router[_0x836d('0xa')]('/',auth[_0x836d('0xb')](),controller['index']);router['get'](_0x836d('0xc'),auth['isAuthenticated'](),controller[_0x836d('0xd')]);router['post']('/',auth[_0x836d('0xb')](),controller['create']);router[_0x836d('0xe')](_0x836d('0xc'),auth[_0x836d('0xb')](),controller[_0x836d('0xf')]);router['delete'](_0x836d('0xc'),auth[_0x836d('0xb')](),controller[_0x836d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x07aa=['/:id','isAuthenticated','show','create','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','./intDynamics365Field.controller','get','index'];(function(_0x172caf,_0x35f2bd){var _0x5abddf=function(_0x3e082e){while(--_0x3e082e){_0x172caf['push'](_0x172caf['shift']());}};_0x5abddf(++_0x35f2bd);}(_0x07aa,0x97));var _0xa07a=function(_0x499f9a,_0x34c589){_0x499f9a=_0x499f9a-0x0;var _0x339cad=_0x07aa[_0x499f9a];return _0x339cad;};'use strict';var multer=require(_0xa07a('0x0'));var util=require(_0xa07a('0x1'));var path=require(_0xa07a('0x2'));var timeout=require(_0xa07a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa07a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa07a('0x5'));var controller=require(_0xa07a('0x6'));router[_0xa07a('0x7')]('/',auth['isAuthenticated'](),controller[_0xa07a('0x8')]);router[_0xa07a('0x7')](_0xa07a('0x9'),auth[_0xa07a('0xa')](),controller[_0xa07a('0xb')]);router['post']('/',auth[_0xa07a('0xa')](),controller[_0xa07a('0xc')]);router['put'](_0xa07a('0x9'),auth['isAuthenticated'](),controller[_0xa07a('0xd')]);router['delete'](_0xa07a('0x9'),auth[_0xa07a('0xa')](),controller[_0xa07a('0xe')]);module[_0xa07a('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index bf5f762..afea597 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 _0xbcc5=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x14268f,_0x5f0869){var _0x269bcb=function(_0x61157f){while(--_0x61157f){_0x14268f['push'](_0x14268f['shift']());}};_0x269bcb(++_0x5f0869);}(_0xbcc5,0x19e));var _0x5bcc=function(_0x2a0f88,_0x43a5fa){_0x2a0f88=_0x2a0f88-0x0;var _0x39ce06=_0xbcc5[_0x2a0f88];return _0x39ce06;};'use strict';var Sequelize=require('sequelize');module[_0x5bcc('0x0')]={'type':{'type':Sequelize[_0x5bcc('0x1')](_0x5bcc('0x2'),_0x5bcc('0x3'),'customVariable',_0x5bcc('0x4'),_0x5bcc('0x5')),'defaultValue':_0x5bcc('0x2')},'content':{'type':Sequelize[_0x5bcc('0x6')]},'key':{'type':Sequelize[_0x5bcc('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x5bcc('0x2'),_0x5bcc('0x3'),_0x5bcc('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5bcc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5bcc('0x6')]}}; \ No newline at end of file +var _0xaf33=['variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN','exports','string'];(function(_0x1a985e,_0x56ad23){var _0x145978=function(_0x288514){while(--_0x288514){_0x1a985e['push'](_0x1a985e['shift']());}};_0x145978(++_0x56ad23);}(_0xaf33,0x1b7));var _0x3af3=function(_0x4aba57,_0x4c65ec){_0x4aba57=_0x4aba57-0x0;var _0x3630a5=_0xaf33[_0x4aba57];return _0x3630a5;};'use strict';var Sequelize=require('sequelize');module[_0x3af3('0x0')]={'type':{'type':Sequelize['ENUM'](_0x3af3('0x1'),_0x3af3('0x2'),'customVariable',_0x3af3('0x3'),_0x3af3('0x4')),'defaultValue':_0x3af3('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3af3('0x5')]},'keyType':{'type':Sequelize[_0x3af3('0x6')](_0x3af3('0x1'),_0x3af3('0x2'),_0x3af3('0x7'))},'keyContent':{'type':Sequelize[_0x3af3('0x5')]},'idField':{'type':Sequelize[_0x3af3('0x5')]},'nameField':{'type':Sequelize[_0x3af3('0x5')]},'customField':{'type':Sequelize[_0x3af3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f468e6e..4cd3cc0 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 _0x40cb=['body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','sendStatus','name','index','map','Dynamics365Field','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','fields','catch','create'];(function(_0x197785,_0x406254){var _0x58190f=function(_0x5922a7){while(--_0x5922a7){_0x197785['push'](_0x197785['shift']());}};_0x58190f(++_0x406254);}(_0x40cb,0x1ad));var _0xb40c=function(_0x364afe,_0x38786a){_0x364afe=_0x364afe-0x0;var _0x42fcd6=_0x40cb[_0x364afe];return _0x42fcd6;};'use strict';var emlformat=require(_0xb40c('0x0'));var rimraf=require(_0xb40c('0x1'));var zipdir=require(_0xb40c('0x2'));var jsonpatch=require(_0xb40c('0x3'));var rp=require(_0xb40c('0x4'));var moment=require(_0xb40c('0x5'));var BPromise=require(_0xb40c('0x6'));var Mustache=require(_0xb40c('0x7'));var util=require(_0xb40c('0x8'));var path=require(_0xb40c('0x9'));var sox=require(_0xb40c('0xa'));var csv=require('to-csv');var ejs=require(_0xb40c('0xb'));var fs=require('fs');var fs_extra=require(_0xb40c('0xc'));var _=require(_0xb40c('0xd'));var squel=require(_0xb40c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb40c('0xf'));var toCsv=require(_0xb40c('0x10'));var querystring=require(_0xb40c('0x11'));var Papa=require(_0xb40c('0x12'));var Redis=require(_0xb40c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb40c('0x14'));var as=require(_0xb40c('0x15'));var hardwareService=require(_0xb40c('0x16'));var logger=require('../../config/logger')(_0xb40c('0x17'));var utils=require('../../config/utils');var config=require(_0xb40c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36b6a7,_0x11cf7f){_0x11cf7f=_0x11cf7f||0xcc;return function(_0x30f36d){if(_0x30f36d){return _0x36b6a7['sendStatus'](_0x11cf7f);}return _0x36b6a7[_0xb40c('0x19')](_0x11cf7f)[_0xb40c('0x1a')]();};}function respondWithResult(_0x2bfe88,_0x27a9b2){_0x27a9b2=_0x27a9b2||0xc8;return function(_0xb80ae3){if(_0xb80ae3){return _0x2bfe88[_0xb40c('0x19')](_0x27a9b2)[_0xb40c('0x1b')](_0xb80ae3);}};}function respondWithFilteredResult(_0xbd3d70,_0x2a033b){return function(_0x39d21f){if(_0x39d21f){var _0x13ac3d=typeof _0x2a033b[_0xb40c('0x1c')]===_0xb40c('0x1d')&&typeof _0x2a033b['limit']===_0xb40c('0x1d');var _0x292c78=_0x39d21f[_0xb40c('0x1e')];var _0x3f3227=_0x13ac3d?0x0:_0x2a033b['offset'];var _0x22e5d7=_0x13ac3d?_0x39d21f[_0xb40c('0x1e')]:_0x2a033b[_0xb40c('0x1c')]+_0x2a033b[_0xb40c('0x1f')];var _0x29a915;if(_0x22e5d7>=_0x292c78){_0x22e5d7=_0x292c78;_0x29a915=0xc8;}else{_0x29a915=0xce;}_0xbd3d70[_0xb40c('0x19')](_0x29a915);return _0xbd3d70[_0xb40c('0x20')]('Content-Range',_0x3f3227+'-'+_0x22e5d7+'/'+_0x292c78)['json'](_0x39d21f);}return null;};}function patchUpdates(_0x3a9b9d){return function(_0xe1c34d){try{jsonpatch[_0xb40c('0x21')](_0xe1c34d,_0x3a9b9d,!![]);}catch(_0x3f5a27){return BPromise[_0xb40c('0x22')](_0x3f5a27);}return _0xe1c34d[_0xb40c('0x23')]();};}function saveUpdates(_0x2b9f32,_0x41f046){return function(_0x2bbe60){if(_0x2bbe60){return _0x2bbe60['update'](_0x2b9f32)[_0xb40c('0x24')](function(_0x272fb4){return _0x272fb4;});}return null;};}function removeEntity(_0x125dae,_0x383448){return function(_0x3ff0c0){if(_0x3ff0c0){return _0x3ff0c0[_0xb40c('0x25')]()[_0xb40c('0x24')](function(){_0x125dae[_0xb40c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dd0fe,_0x169a16){return function(_0x5c09ab){if(!_0x5c09ab){_0x4dd0fe[_0xb40c('0x26')](0x194);}return _0x5c09ab;};}function handleError(_0x5c717,_0x3cd533){_0x3cd533=_0x3cd533||0x1f4;return function(_0x4cdbce){logger['error'](_0x4cdbce['stack']);if(_0x4cdbce[_0xb40c('0x27')]){delete _0x4cdbce[_0xb40c('0x27')];}_0x5c717['status'](_0x3cd533)['send'](_0x4cdbce);};}exports[_0xb40c('0x28')]=function(_0x5e7c70,_0x1b83b6){var _0x9c059d={},_0x49d9a5={},_0x5e89ae={'count':0x0,'rows':[]};var _0x5ba4aa=_[_0xb40c('0x29')](db[_0xb40c('0x2a')]['rawAttributes'],function(_0x7293d){return{'name':_0x7293d[_0xb40c('0x2b')],'type':_0x7293d[_0xb40c('0x2c')][_0xb40c('0x2d')]};});_0x49d9a5[_0xb40c('0x2e')]=_[_0xb40c('0x29')](_0x5ba4aa,_0xb40c('0x27'));_0x49d9a5[_0xb40c('0x2f')]=_[_0xb40c('0x30')](_0x5e7c70[_0xb40c('0x2f')]);_0x49d9a5[_0xb40c('0x31')]=_[_0xb40c('0x32')](_0x49d9a5['model'],_0x49d9a5[_0xb40c('0x2f')]);_0x9c059d[_0xb40c('0x33')]=_['intersection'](_0x49d9a5['model'],qs['fields'](_0x5e7c70['query']['fields']));_0x9c059d[_0xb40c('0x33')]=_0x9c059d['attributes'][_0xb40c('0x34')]?_0x9c059d[_0xb40c('0x33')]:_0x49d9a5[_0xb40c('0x2e')];if(!_0x5e7c70['query']['hasOwnProperty']('nolimit')){_0x9c059d[_0xb40c('0x1f')]=qs[_0xb40c('0x1f')](_0x5e7c70[_0xb40c('0x2f')][_0xb40c('0x1f')]);_0x9c059d[_0xb40c('0x1c')]=qs['offset'](_0x5e7c70[_0xb40c('0x2f')][_0xb40c('0x1c')]);}_0x9c059d[_0xb40c('0x35')]=qs[_0xb40c('0x36')](_0x5e7c70[_0xb40c('0x2f')]['sort']);_0x9c059d[_0xb40c('0x37')]=qs['filters'](_[_0xb40c('0x38')](_0x5e7c70[_0xb40c('0x2f')],_0x49d9a5[_0xb40c('0x31')]),_0x5ba4aa);if(_0x5e7c70[_0xb40c('0x2f')][_0xb40c('0x39')]){_0x9c059d[_0xb40c('0x37')]=_[_0xb40c('0x3a')](_0x9c059d['where'],{'$or':_[_0xb40c('0x29')](_0x5ba4aa,function(_0x34411c){if(_0x34411c[_0xb40c('0x2c')]!==_0xb40c('0x3b')){var _0x1ec72f={};_0x1ec72f[_0x34411c[_0xb40c('0x27')]]={'$like':'%'+_0x5e7c70[_0xb40c('0x2f')][_0xb40c('0x39')]+'%'};return _0x1ec72f;}})});}_0x9c059d=_['merge']({},_0x9c059d,_0x5e7c70[_0xb40c('0x3c')]);var _0x5f25f0={'where':_0x9c059d[_0xb40c('0x37')]};return db['Dynamics365Field'][_0xb40c('0x1e')](_0x5f25f0)[_0xb40c('0x24')](function(_0x371b1e){_0x5e89ae['count']=_0x371b1e;if(_0x5e7c70['query']['includeAll']){_0x9c059d[_0xb40c('0x3d')]=[{'all':!![]}];}return db[_0xb40c('0x2a')]['findAll'](_0x9c059d);})[_0xb40c('0x24')](function(_0x30d444){_0x5e89ae[_0xb40c('0x3e')]=_0x30d444;return _0x5e89ae;})[_0xb40c('0x24')](respondWithFilteredResult(_0x1b83b6,_0x9c059d))['catch'](handleError(_0x1b83b6,null));};exports[_0xb40c('0x3f')]=function(_0x5f0152,_0x53820c){var _0x182d65={'raw':!![],'where':{'id':_0x5f0152[_0xb40c('0x40')]['id']}},_0x4975d0={};_0x4975d0[_0xb40c('0x2e')]=_[_0xb40c('0x30')](db['Dynamics365Field']['rawAttributes']);_0x4975d0[_0xb40c('0x2f')]=_['keys'](_0x5f0152[_0xb40c('0x2f')]);_0x4975d0['filters']=_[_0xb40c('0x32')](_0x4975d0[_0xb40c('0x2e')],_0x4975d0['query']);_0x182d65[_0xb40c('0x33')]=_['intersection'](_0x4975d0[_0xb40c('0x2e')],qs['fields'](_0x5f0152[_0xb40c('0x2f')][_0xb40c('0x41')]));_0x182d65['attributes']=_0x182d65['attributes'][_0xb40c('0x34')]?_0x182d65[_0xb40c('0x33')]:_0x4975d0['model'];if(_0x5f0152['query']['includeAll']){_0x182d65[_0xb40c('0x3d')]=[{'all':!![]}];}_0x182d65=_[_0xb40c('0x3a')]({},_0x182d65,_0x5f0152[_0xb40c('0x3c')]);return db[_0xb40c('0x2a')]['find'](_0x182d65)[_0xb40c('0x24')](handleEntityNotFound(_0x53820c,null))[_0xb40c('0x24')](respondWithResult(_0x53820c,null))[_0xb40c('0x42')](handleError(_0x53820c,null));};exports[_0xb40c('0x43')]=function(_0x3ac865,_0x2f626b){return db[_0xb40c('0x2a')][_0xb40c('0x43')](_0x3ac865[_0xb40c('0x44')],{})[_0xb40c('0x24')](respondWithResult(_0x2f626b,0xc9))['catch'](handleError(_0x2f626b,null));};exports[_0xb40c('0x45')]=function(_0x260256,_0x3294c1){if(_0x260256['body']['id']){delete _0x260256[_0xb40c('0x44')]['id'];}return db[_0xb40c('0x2a')]['find']({'where':{'id':_0x260256[_0xb40c('0x40')]['id']}})[_0xb40c('0x24')](handleEntityNotFound(_0x3294c1,null))[_0xb40c('0x24')](saveUpdates(_0x260256[_0xb40c('0x44')],null))[_0xb40c('0x24')](respondWithResult(_0x3294c1,null))['catch'](handleError(_0x3294c1,null));};exports[_0xb40c('0x25')]=function(_0x2a3056,_0x101027){return db['Dynamics365Field'][_0xb40c('0x46')]({'where':{'id':_0x2a3056['params']['id']}})['then'](handleEntityNotFound(_0x101027,null))[_0xb40c('0x24')](removeEntity(_0x101027,null))[_0xb40c('0x42')](handleError(_0x101027,null));}; \ No newline at end of file +var _0x76d7=['Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x526aa1,_0x2b869f){var _0x4d7cdf=function(_0x5a7406){while(--_0x5a7406){_0x526aa1['push'](_0x526aa1['shift']());}};_0x4d7cdf(++_0x2b869f);}(_0x76d7,0x13e));var _0x776d=function(_0x5da27a,_0x139cf5){_0x5da27a=_0x5da27a-0x0;var _0x35a016=_0x76d7[_0x5da27a];return _0x35a016;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x776d('0x0'));var zipdir=require(_0x776d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x776d('0x2'));var Mustache=require(_0x776d('0x3'));var util=require('util');var path=require(_0x776d('0x4'));var sox=require('sox');var csv=require(_0x776d('0x5'));var ejs=require(_0x776d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x776d('0x7'));var squel=require(_0x776d('0x8'));var crypto=require(_0x776d('0x9'));var jsforce=require(_0x776d('0xa'));var deskjs=require(_0x776d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x776d('0xc'));var Redis=require(_0x776d('0xd'));var authService=require(_0x776d('0xe'));var qs=require(_0x776d('0xf'));var as=require(_0x776d('0x10'));var hardwareService=require(_0x776d('0x11'));var logger=require(_0x776d('0x12'))(_0x776d('0x13'));var utils=require(_0x776d('0x14'));var config=require(_0x776d('0x15'));var licenseUtil=require(_0x776d('0x16'));var db=require(_0x776d('0x17'))['db'];function respondWithStatusCode(_0x3f4cb1,_0x6ac38c){_0x6ac38c=_0x6ac38c||0xcc;return function(_0xa1da46){if(_0xa1da46){return _0x3f4cb1[_0x776d('0x18')](_0x6ac38c);}return _0x3f4cb1[_0x776d('0x19')](_0x6ac38c)[_0x776d('0x1a')]();};}function respondWithResult(_0x5d69fb,_0x40b2f4){_0x40b2f4=_0x40b2f4||0xc8;return function(_0x5d130d){if(_0x5d130d){return _0x5d69fb['status'](_0x40b2f4)['json'](_0x5d130d);}};}function respondWithFilteredResult(_0xbdb18a,_0x1b4ef6){return function(_0x4966e6){if(_0x4966e6){var _0x5ed353=typeof _0x1b4ef6['offset']===_0x776d('0x1b')&&typeof _0x1b4ef6[_0x776d('0x1c')]==='undefined';var _0x4a1b39=_0x4966e6[_0x776d('0x1d')];var _0x593622=_0x5ed353?0x0:_0x1b4ef6[_0x776d('0x1e')];var _0x1156e1=_0x5ed353?_0x4966e6['count']:_0x1b4ef6['offset']+_0x1b4ef6[_0x776d('0x1c')];var _0x1e7c9a;if(_0x1156e1>=_0x4a1b39){_0x1156e1=_0x4a1b39;_0x1e7c9a=0xc8;}else{_0x1e7c9a=0xce;}_0xbdb18a[_0x776d('0x19')](_0x1e7c9a);return _0xbdb18a['set']('Content-Range',_0x593622+'-'+_0x1156e1+'/'+_0x4a1b39)[_0x776d('0x1f')](_0x4966e6);}return null;};}function patchUpdates(_0x12cfaa){return function(_0x18eca5){try{jsonpatch[_0x776d('0x20')](_0x18eca5,_0x12cfaa,!![]);}catch(_0x58cded){return BPromise['reject'](_0x58cded);}return _0x18eca5[_0x776d('0x21')]();};}function saveUpdates(_0x3f3bea,_0x318a4b){return function(_0x4049ab){if(_0x4049ab){return _0x4049ab[_0x776d('0x22')](_0x3f3bea)[_0x776d('0x23')](function(_0x36ef6c){return _0x36ef6c;});}return null;};}function removeEntity(_0x242d3d,_0x319647){return function(_0xac7e24){if(_0xac7e24){return _0xac7e24[_0x776d('0x24')]()[_0x776d('0x23')](function(){_0x242d3d[_0x776d('0x19')](0xcc)[_0x776d('0x1a')]();});}};}function handleEntityNotFound(_0x2b5db0,_0x486fd1){return function(_0x2a7f08){if(!_0x2a7f08){_0x2b5db0[_0x776d('0x18')](0x194);}return _0x2a7f08;};}function handleError(_0x4a7e97,_0x162e1e){_0x162e1e=_0x162e1e||0x1f4;return function(_0x167f82){logger[_0x776d('0x25')](_0x167f82[_0x776d('0x26')]);if(_0x167f82[_0x776d('0x27')]){delete _0x167f82[_0x776d('0x27')];}_0x4a7e97[_0x776d('0x19')](_0x162e1e)[_0x776d('0x28')](_0x167f82);};}exports[_0x776d('0x29')]=function(_0x278b3a,_0x5acf43){var _0x2ea4dc={},_0xec9a05={},_0x1370d8={'count':0x0,'rows':[]};var _0x5f46a9=_['map'](db[_0x776d('0x2a')][_0x776d('0x2b')],function(_0x9caec3){return{'name':_0x9caec3[_0x776d('0x2c')],'type':_0x9caec3[_0x776d('0x2d')][_0x776d('0x2e')]};});_0xec9a05[_0x776d('0x2f')]=_[_0x776d('0x30')](_0x5f46a9,_0x776d('0x27'));_0xec9a05[_0x776d('0x31')]=_['keys'](_0x278b3a[_0x776d('0x31')]);_0xec9a05[_0x776d('0x32')]=_['intersection'](_0xec9a05[_0x776d('0x2f')],_0xec9a05['query']);_0x2ea4dc[_0x776d('0x33')]=_[_0x776d('0x34')](_0xec9a05[_0x776d('0x2f')],qs[_0x776d('0x35')](_0x278b3a['query']['fields']));_0x2ea4dc['attributes']=_0x2ea4dc[_0x776d('0x33')]['length']?_0x2ea4dc[_0x776d('0x33')]:_0xec9a05[_0x776d('0x2f')];if(!_0x278b3a[_0x776d('0x31')][_0x776d('0x36')]('nolimit')){_0x2ea4dc[_0x776d('0x1c')]=qs['limit'](_0x278b3a[_0x776d('0x31')][_0x776d('0x1c')]);_0x2ea4dc[_0x776d('0x1e')]=qs[_0x776d('0x1e')](_0x278b3a[_0x776d('0x31')]['offset']);}_0x2ea4dc[_0x776d('0x37')]=qs[_0x776d('0x38')](_0x278b3a['query'][_0x776d('0x38')]);_0x2ea4dc[_0x776d('0x39')]=qs[_0x776d('0x32')](_[_0x776d('0x3a')](_0x278b3a[_0x776d('0x31')],_0xec9a05['filters']),_0x5f46a9);if(_0x278b3a[_0x776d('0x31')]['filter']){_0x2ea4dc[_0x776d('0x39')]=_[_0x776d('0x3b')](_0x2ea4dc[_0x776d('0x39')],{'$or':_['map'](_0x5f46a9,function(_0x154cab){if(_0x154cab[_0x776d('0x2d')]!==_0x776d('0x3c')){var _0x4f6f7b={};_0x4f6f7b[_0x154cab[_0x776d('0x27')]]={'$like':'%'+_0x278b3a['query']['filter']+'%'};return _0x4f6f7b;}})});}_0x2ea4dc=_['merge']({},_0x2ea4dc,_0x278b3a[_0x776d('0x3d')]);var _0x469f36={'where':_0x2ea4dc[_0x776d('0x39')]};return db[_0x776d('0x2a')]['count'](_0x469f36)[_0x776d('0x23')](function(_0x116913){_0x1370d8[_0x776d('0x1d')]=_0x116913;if(_0x278b3a[_0x776d('0x31')][_0x776d('0x3e')]){_0x2ea4dc[_0x776d('0x3f')]=[{'all':!![]}];}return db[_0x776d('0x2a')]['findAll'](_0x2ea4dc);})['then'](function(_0x388c1b){_0x1370d8[_0x776d('0x40')]=_0x388c1b;return _0x1370d8;})[_0x776d('0x23')](respondWithFilteredResult(_0x5acf43,_0x2ea4dc))[_0x776d('0x41')](handleError(_0x5acf43,null));};exports[_0x776d('0x42')]=function(_0x1ca262,_0x131ff4){var _0x4a204e={'raw':!![],'where':{'id':_0x1ca262[_0x776d('0x43')]['id']}},_0x3364d9={};_0x3364d9['model']=_['keys'](db['Dynamics365Field'][_0x776d('0x2b')]);_0x3364d9[_0x776d('0x31')]=_[_0x776d('0x44')](_0x1ca262[_0x776d('0x31')]);_0x3364d9[_0x776d('0x32')]=_['intersection'](_0x3364d9[_0x776d('0x2f')],_0x3364d9[_0x776d('0x31')]);_0x4a204e['attributes']=_[_0x776d('0x34')](_0x3364d9[_0x776d('0x2f')],qs[_0x776d('0x35')](_0x1ca262[_0x776d('0x31')][_0x776d('0x35')]));_0x4a204e[_0x776d('0x33')]=_0x4a204e[_0x776d('0x33')]['length']?_0x4a204e[_0x776d('0x33')]:_0x3364d9[_0x776d('0x2f')];if(_0x1ca262[_0x776d('0x31')][_0x776d('0x3e')]){_0x4a204e[_0x776d('0x3f')]=[{'all':!![]}];}_0x4a204e=_[_0x776d('0x3b')]({},_0x4a204e,_0x1ca262[_0x776d('0x3d')]);return db[_0x776d('0x2a')][_0x776d('0x45')](_0x4a204e)[_0x776d('0x23')](handleEntityNotFound(_0x131ff4,null))[_0x776d('0x23')](respondWithResult(_0x131ff4,null))[_0x776d('0x41')](handleError(_0x131ff4,null));};exports[_0x776d('0x46')]=function(_0x1924fe,_0x28ee0c){return db['Dynamics365Field'][_0x776d('0x46')](_0x1924fe[_0x776d('0x47')],{})[_0x776d('0x23')](respondWithResult(_0x28ee0c,0xc9))['catch'](handleError(_0x28ee0c,null));};exports['update']=function(_0x3544fc,_0x18ea6b){if(_0x3544fc['body']['id']){delete _0x3544fc['body']['id'];}return db[_0x776d('0x2a')][_0x776d('0x45')]({'where':{'id':_0x3544fc['params']['id']}})['then'](handleEntityNotFound(_0x18ea6b,null))[_0x776d('0x23')](saveUpdates(_0x3544fc[_0x776d('0x47')],null))[_0x776d('0x23')](respondWithResult(_0x18ea6b,null))[_0x776d('0x41')](handleError(_0x18ea6b,null));};exports['destroy']=function(_0x24a402,_0x44a8be){return db[_0x776d('0x2a')][_0x776d('0x45')]({'where':{'id':_0x24a402[_0x776d('0x43')]['id']}})[_0x776d('0x23')](handleEntityNotFound(_0x44a8be,null))['then'](removeEntity(_0x44a8be,null))[_0x776d('0x41')](handleError(_0x44a8be,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 820e3aa..8eb9872 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 _0xf5b0=['../../config/environment','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x26adcd,_0x54d8e0){var _0x380718=function(_0x3eb674){while(--_0x3eb674){_0x26adcd['push'](_0x26adcd['shift']());}};_0x380718(++_0x54d8e0);}(_0xf5b0,0x1d5));var _0x0f5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0f5b('0x0'))(_0x0f5b('0x1'));var moment=require(_0x0f5b('0x2'));var BPromise=require(_0x0f5b('0x3'));var rp=require(_0x0f5b('0x4'));var fs=require('fs');var path=require(_0x0f5b('0x5'));var rimraf=require(_0x0f5b('0x6'));var config=require(_0x0f5b('0x7'));var attributes=require(_0x0f5b('0x8'));module[_0x0f5b('0x9')]=function(_0x1b50da,_0x37410a){return _0x1b50da[_0x0f5b('0xa')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x0f5b('0xb'),'fields':[_0x0f5b('0xc'),_0x0f5b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e01=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util'];(function(_0x191b2d,_0x15f3d9){var _0x364d36=function(_0x4f1f26){while(--_0x4f1f26){_0x191b2d['push'](_0x191b2d['shift']());}};_0x364d36(++_0x15f3d9);}(_0x5e01,0xb9));var _0x15e0=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x5e01[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x15e0('0x0'));var util=require(_0x15e0('0x1'));var logger=require(_0x15e0('0x2'))(_0x15e0('0x3'));var moment=require(_0x15e0('0x4'));var BPromise=require(_0x15e0('0x5'));var rp=require(_0x15e0('0x6'));var fs=require('fs');var path=require(_0x15e0('0x7'));var rimraf=require(_0x15e0('0x8'));var config=require(_0x15e0('0x9'));var attributes=require(_0x15e0('0xa'));module[_0x15e0('0xb')]=function(_0x322fd1,_0x2f140b){return _0x322fd1[_0x15e0('0xc')](_0x15e0('0xd'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x15e0('0xe'),'fields':[_0x15e0('0xf'),_0x15e0('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 ce68930..e79cb25 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 _0xb6b3=['../../config/logger','rpc','../../config/environment','request','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xb6b3,0xcc));var _0x3b6b=function(_0x23d5a6,_0xd0ba9){_0x23d5a6=_0x23d5a6-0x0;var _0x33a126=_0xb6b3[_0x23d5a6];return _0x33a126;};'use strict';var _=require(_0x3b6b('0x0'));var util=require(_0x3b6b('0x1'));var moment=require(_0x3b6b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b6b('0x3'));var db=require(_0x3b6b('0x4'))['db'];var utils=require(_0x3b6b('0x5'));var logger=require(_0x3b6b('0x6'))(_0x3b6b('0x7'));var config=require(_0x3b6b('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43504a,_0x2c9136,_0x15b10e){return new BPromise(function(_0x33ceaa,_0x525d9c){return client[_0x3b6b('0x9')](_0x43504a,_0x15b10e)[_0x3b6b('0xa')](function(_0x2b0bf1){logger[_0x3b6b('0xb')](_0x3b6b('0xc'),_0x2c9136,'request\x20sent');logger['debug'](_0x3b6b('0xd'),_0x2c9136,_0x3b6b('0xe'),JSON[_0x3b6b('0xf')](_0x2b0bf1));if(_0x2b0bf1[_0x3b6b('0x10')]){if(_0x2b0bf1[_0x3b6b('0x10')][_0x3b6b('0x11')]===0x1f4){logger[_0x3b6b('0x10')](_0x3b6b('0xc'),_0x2c9136,_0x2b0bf1[_0x3b6b('0x10')][_0x3b6b('0x12')]);return _0x525d9c(_0x2b0bf1[_0x3b6b('0x10')]['message']);}logger[_0x3b6b('0x10')](_0x3b6b('0xc'),_0x2c9136,_0x2b0bf1['error'][_0x3b6b('0x12')]);return _0x33ceaa(_0x2b0bf1[_0x3b6b('0x10')][_0x3b6b('0x12')]);}else{logger[_0x3b6b('0xb')](_0x3b6b('0xc'),_0x2c9136,_0x3b6b('0xe'));_0x33ceaa(_0x2b0bf1[_0x3b6b('0x13')][_0x3b6b('0x12')]);}})[_0x3b6b('0x14')](function(_0x4a5610){logger[_0x3b6b('0x10')](_0x3b6b('0xc'),_0x2c9136,_0x4a5610);_0x525d9c(_0x4a5610);});});} \ No newline at end of file +var _0x0e9f=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0e9f,0x10b));var _0xf0e9=function(_0x4b47ca,_0x5f4a8c){_0x4b47ca=_0x4b47ca-0x0;var _0x39247d=_0x0e9f[_0x4b47ca];return _0x39247d;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require(_0xf0e9('0x2'));var BPromise=require(_0xf0e9('0x3'));var rs=require(_0xf0e9('0x4'));var fs=require('fs');var Redis=require(_0xf0e9('0x5'));var db=require(_0xf0e9('0x6'))['db'];var utils=require(_0xf0e9('0x7'));var logger=require(_0xf0e9('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf0e9('0x9'));var client=jayson[_0xf0e9('0xa')][_0xf0e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3da80f,_0x5a4580,_0x2411d6){return new BPromise(function(_0x263001,_0x1964a0){return client[_0xf0e9('0xc')](_0x3da80f,_0x2411d6)[_0xf0e9('0xd')](function(_0x55c5e5){logger[_0xf0e9('0xe')](_0xf0e9('0xf'),_0x5a4580,'request\x20sent');logger[_0xf0e9('0x10')](_0xf0e9('0x11'),_0x5a4580,_0xf0e9('0x12'),JSON[_0xf0e9('0x13')](_0x55c5e5));if(_0x55c5e5[_0xf0e9('0x14')]){if(_0x55c5e5[_0xf0e9('0x14')][_0xf0e9('0x15')]===0x1f4){logger[_0xf0e9('0x14')](_0xf0e9('0xf'),_0x5a4580,_0x55c5e5[_0xf0e9('0x14')][_0xf0e9('0x16')]);return _0x1964a0(_0x55c5e5[_0xf0e9('0x14')][_0xf0e9('0x16')]);}logger['error'](_0xf0e9('0xf'),_0x5a4580,_0x55c5e5['error'][_0xf0e9('0x16')]);return _0x263001(_0x55c5e5[_0xf0e9('0x14')][_0xf0e9('0x16')]);}else{logger['info'](_0xf0e9('0xf'),_0x5a4580,'request\x20sent');_0x263001(_0x55c5e5[_0xf0e9('0x17')][_0xf0e9('0x16')]);}})['catch'](function(_0x10e506){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x5a4580,_0x10e506);_0x1964a0(_0x10e506);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5e5d502..7420637 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 _0x6671=['/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6671,0xe6));var _0x1667=function(_0x166301,_0x5798af){_0x166301=_0x166301-0x0;var _0x492147=_0x6671[_0x166301];return _0x492147;};'use strict';var multer=require(_0x1667('0x0'));var util=require(_0x1667('0x1'));var path=require('path');var timeout=require(_0x1667('0x2'));var express=require(_0x1667('0x3'));var router=express[_0x1667('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1667('0x5'));var interaction=require(_0x1667('0x6'));var config=require(_0x1667('0x7'));var controller=require(_0x1667('0x8'));router[_0x1667('0x9')]('/',auth[_0x1667('0xa')](),controller[_0x1667('0xb')]);router[_0x1667('0x9')](_0x1667('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x1667('0x9')](_0x1667('0xd'),auth[_0x1667('0xa')](),controller[_0x1667('0xe')]);router['get'](_0x1667('0xf'),auth[_0x1667('0xa')](),controller[_0x1667('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1667('0x11')]);router[_0x1667('0x12')](_0x1667('0xd'),auth['isAuthenticated'](),controller[_0x1667('0x13')]);router[_0x1667('0x14')](_0x1667('0xc'),auth[_0x1667('0xa')](),controller[_0x1667('0x15')]);router['delete'](_0x1667('0xc'),auth[_0x1667('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6941=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','create','post','put','/:id'];(function(_0x33d4a9,_0xcadec3){var _0x11a763=function(_0x6e3254){while(--_0x6e3254){_0x33d4a9['push'](_0x33d4a9['shift']());}};_0x11a763(++_0xcadec3);}(_0x6941,0x192));var _0x1694=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x6941[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x1694('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1694('0x1'));var express=require(_0x1694('0x2'));var router=express[_0x1694('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1694('0x4'));var config=require('../../config/environment');var controller=require(_0x1694('0x5'));router[_0x1694('0x6')]('/',auth[_0x1694('0x7')](),controller[_0x1694('0x8')]);router[_0x1694('0x6')]('/:id',auth[_0x1694('0x7')](),controller['show']);router[_0x1694('0x6')](_0x1694('0x9'),auth[_0x1694('0x7')](),controller[_0x1694('0xa')]);router[_0x1694('0x6')](_0x1694('0xb'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x1694('0x7')](),controller[_0x1694('0xc')]);router[_0x1694('0xd')](_0x1694('0x9'),auth[_0x1694('0x7')](),controller['addConfiguration']);router[_0x1694('0xe')](_0x1694('0xf'),auth[_0x1694('0x7')](),controller['update']);router[_0x1694('0x10')](_0x1694('0xf'),auth[_0x1694('0x7')](),controller[_0x1694('0x11')]);module[_0x1694('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 378651a..7097dcb 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 _0xaebd=['remoteUri','sequelize','STRING','username'];(function(_0x2c1ddd,_0x2a667f){var _0x49fa39=function(_0x581c2d){while(--_0x581c2d){_0x2c1ddd['push'](_0x2c1ddd['shift']());}};_0x49fa39(++_0x2a667f);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1eace4,_0x4d9e77){_0x1eace4=_0x1eace4-0x0;var _0x107580=_0xaebd[_0x1eace4];return _0x107580;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaeb('0x1')]},'description':{'type':Sequelize[_0xdaeb('0x1')]},'username':{'type':Sequelize[_0xdaeb('0x1')],'unique':_0xdaeb('0x2')},'apiKey':{'type':Sequelize[_0xdaeb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xdaeb('0x3')},'serverUrl':{'type':Sequelize[_0xdaeb('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xfb11=['sequelize','STRING','username'];(function(_0x1e808a,_0x330dbc){var _0x4567b2=function(_0x424724){while(--_0x424724){_0x1e808a['push'](_0x1e808a['shift']());}};_0x4567b2(++_0x330dbc);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xfb11[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'name':{'type':Sequelize[_0x1fb1('0x1')]},'description':{'type':Sequelize[_0x1fb1('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x1fb1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1fb1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x1fb1('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 1e37595..e871152 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 _0x41bb=['../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','pick','map','addConfiguration','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','description','source','ticket_type','company','includes','custom_text','custom_dropdown','choices','capitalize','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5c0dfb,_0x29fe5e){var _0x49be35=function(_0xd36496){while(--_0xd36496){_0x5c0dfb['push'](_0x5c0dfb['shift']());}};_0x49be35(++_0x29fe5e);}(_0x41bb,0xc5));var _0xb41b=function(_0x223c01,_0x10a89e){_0x223c01=_0x223c01-0x0;var _0x458dae=_0x41bb[_0x223c01];return _0x458dae;};'use strict';var emlformat=require(_0xb41b('0x0'));var rimraf=require(_0xb41b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb41b('0x2'));var rp=require('request-promise');var moment=require(_0xb41b('0x3'));var BPromise=require(_0xb41b('0x4'));var Mustache=require(_0xb41b('0x5'));var util=require(_0xb41b('0x6'));var path=require('path');var sox=require(_0xb41b('0x7'));var csv=require(_0xb41b('0x8'));var ejs=require(_0xb41b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0xa'));var jsforce=require(_0xb41b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb41b('0x8'));var querystring=require(_0xb41b('0xc'));var Papa=require(_0xb41b('0xd'));var Redis=require(_0xb41b('0xe'));var authService=require(_0xb41b('0xf'));var qs=require(_0xb41b('0x10'));var as=require(_0xb41b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb41b('0x12'))('api');var utils=require(_0xb41b('0x13'));var config=require(_0xb41b('0x14'));var licenseUtil=require(_0xb41b('0x15'));var db=require(_0xb41b('0x16'))['db'];var integrations=require(_0xb41b('0x17'));function respondWithStatusCode(_0x5f1ea4,_0x353ba3){_0x353ba3=_0x353ba3||0xcc;return function(_0x2d947a){if(_0x2d947a){return _0x5f1ea4[_0xb41b('0x18')](_0x353ba3);}return _0x5f1ea4[_0xb41b('0x19')](_0x353ba3)[_0xb41b('0x1a')]();};}function respondWithResult(_0x4e8603,_0x4e7f11){_0x4e7f11=_0x4e7f11||0xc8;return function(_0x55e507){if(_0x55e507){return _0x4e8603[_0xb41b('0x19')](_0x4e7f11)[_0xb41b('0x1b')](_0x55e507);}};}function respondWithFilteredResult(_0x143a81,_0x338920){return function(_0x29ea51){if(_0x29ea51){var _0x54591e=typeof _0x338920[_0xb41b('0x1c')]===_0xb41b('0x1d')&&typeof _0x338920[_0xb41b('0x1e')]===_0xb41b('0x1d');var _0x43f4ea=_0x29ea51[_0xb41b('0x1f')];var _0x198783=_0x54591e?0x0:_0x338920['offset'];var _0x4b3580=_0x54591e?_0x29ea51['count']:_0x338920[_0xb41b('0x1c')]+_0x338920['limit'];var _0x307633;if(_0x4b3580>=_0x43f4ea){_0x4b3580=_0x43f4ea;_0x307633=0xc8;}else{_0x307633=0xce;}_0x143a81[_0xb41b('0x19')](_0x307633);return _0x143a81[_0xb41b('0x20')]('Content-Range',_0x198783+'-'+_0x4b3580+'/'+_0x43f4ea)['json'](_0x29ea51);}return null;};}function patchUpdates(_0x1a1386){return function(_0x3b6ffb){try{jsonpatch[_0xb41b('0x21')](_0x3b6ffb,_0x1a1386,!![]);}catch(_0x2373f4){return BPromise[_0xb41b('0x22')](_0x2373f4);}return _0x3b6ffb[_0xb41b('0x23')]();};}function saveUpdates(_0x4c73da,_0x58f149){return function(_0x2b436f){if(_0x2b436f){return _0x2b436f[_0xb41b('0x24')](_0x4c73da)[_0xb41b('0x25')](function(_0x583741){return _0x583741;});}return null;};}function removeEntity(_0x14e9c8,_0x2441d6){return function(_0x546101){if(_0x546101){return _0x546101[_0xb41b('0x26')]()[_0xb41b('0x25')](function(){_0x14e9c8['status'](0xcc)[_0xb41b('0x1a')]();});}};}function handleEntityNotFound(_0x4a7992,_0x2d0f27){return function(_0x4c6a91){if(!_0x4c6a91){_0x4a7992['sendStatus'](0x194);}return _0x4c6a91;};}function handleError(_0x3af2c,_0x4265b8){_0x4265b8=_0x4265b8||0x1f4;return function(_0x583099){logger['error'](_0x583099[_0xb41b('0x27')]);if(_0x583099[_0xb41b('0x28')]){delete _0x583099[_0xb41b('0x28')];}_0x3af2c[_0xb41b('0x19')](_0x4265b8)[_0xb41b('0x29')](_0x583099);};}exports[_0xb41b('0x2a')]=function(_0x253efb,_0x545395){var _0x26ef96={},_0xb68029={},_0x5069aa={'count':0x0,'rows':[]};var _0xe64568=_['map'](db[_0xb41b('0x2b')][_0xb41b('0x2c')],function(_0x597a35){return{'name':_0x597a35[_0xb41b('0x2d')],'type':_0x597a35['type'][_0xb41b('0x2e')]};});_0xb68029[_0xb41b('0x2f')]=_['map'](_0xe64568,_0xb41b('0x28'));_0xb68029[_0xb41b('0x30')]=_[_0xb41b('0x31')](_0x253efb[_0xb41b('0x30')]);_0xb68029[_0xb41b('0x32')]=_[_0xb41b('0x33')](_0xb68029[_0xb41b('0x2f')],_0xb68029[_0xb41b('0x30')]);_0x26ef96[_0xb41b('0x34')]=_[_0xb41b('0x33')](_0xb68029['model'],qs[_0xb41b('0x35')](_0x253efb['query']['fields']));_0x26ef96[_0xb41b('0x34')]=_0x26ef96[_0xb41b('0x34')][_0xb41b('0x36')]?_0x26ef96[_0xb41b('0x34')]:_0xb68029[_0xb41b('0x2f')];if(!_0x253efb[_0xb41b('0x30')][_0xb41b('0x37')](_0xb41b('0x38'))){_0x26ef96[_0xb41b('0x1e')]=qs[_0xb41b('0x1e')](_0x253efb[_0xb41b('0x30')]['limit']);_0x26ef96[_0xb41b('0x1c')]=qs[_0xb41b('0x1c')](_0x253efb[_0xb41b('0x30')][_0xb41b('0x1c')]);}_0x26ef96[_0xb41b('0x39')]=qs[_0xb41b('0x3a')](_0x253efb['query']['sort']);_0x26ef96[_0xb41b('0x3b')]=qs[_0xb41b('0x32')](_['pick'](_0x253efb[_0xb41b('0x30')],_0xb68029[_0xb41b('0x32')]),_0xe64568);if(_0x253efb[_0xb41b('0x30')][_0xb41b('0x3c')]){_0x26ef96[_0xb41b('0x3b')]=_['merge'](_0x26ef96[_0xb41b('0x3b')],{'$or':_['map'](_0xe64568,function(_0x7d43d1){if(_0x7d43d1[_0xb41b('0x3d')]!==_0xb41b('0x3e')){var _0x40789b={};_0x40789b[_0x7d43d1[_0xb41b('0x28')]]={'$like':'%'+_0x253efb[_0xb41b('0x30')][_0xb41b('0x3c')]+'%'};return _0x40789b;}})});}_0x26ef96=_[_0xb41b('0x3f')]({},_0x26ef96,_0x253efb[_0xb41b('0x40')]);var _0x578b67={'where':_0x26ef96['where']};return db['FreshdeskAccount'][_0xb41b('0x1f')](_0x578b67)['then'](function(_0x56a415){_0x5069aa[_0xb41b('0x1f')]=_0x56a415;if(_0x253efb['query'][_0xb41b('0x41')]){_0x26ef96[_0xb41b('0x42')]=[{'all':!![]}];}return db[_0xb41b('0x2b')][_0xb41b('0x43')](_0x26ef96);})[_0xb41b('0x25')](function(_0x25c5b7){_0x5069aa[_0xb41b('0x44')]=_0x25c5b7;return _0x5069aa;})['then'](respondWithFilteredResult(_0x545395,_0x26ef96))[_0xb41b('0x45')](handleError(_0x545395,null));};exports[_0xb41b('0x46')]=function(_0x3f181c,_0x174d6c){var _0x47bab5={'raw':![],'where':{'id':_0x3f181c['params']['id']}},_0x2f1391={};_0x2f1391[_0xb41b('0x2f')]=_[_0xb41b('0x31')](db[_0xb41b('0x2b')]['rawAttributes']);_0x2f1391['query']=_[_0xb41b('0x31')](_0x3f181c[_0xb41b('0x30')]);_0x2f1391[_0xb41b('0x32')]=_[_0xb41b('0x33')](_0x2f1391[_0xb41b('0x2f')],_0x2f1391[_0xb41b('0x30')]);_0x47bab5[_0xb41b('0x34')]=_['intersection'](_0x2f1391['model'],qs[_0xb41b('0x35')](_0x3f181c['query'][_0xb41b('0x35')]));_0x47bab5['attributes']=_0x47bab5[_0xb41b('0x34')]['length']?_0x47bab5[_0xb41b('0x34')]:_0x2f1391['model'];if(_0x3f181c[_0xb41b('0x30')][_0xb41b('0x41')]){_0x47bab5[_0xb41b('0x42')]=[{'all':!![]}];}_0x47bab5=_[_0xb41b('0x3f')]({},_0x47bab5,_0x3f181c['options']);return db[_0xb41b('0x2b')][_0xb41b('0x47')](_0x47bab5)['then'](handleEntityNotFound(_0x174d6c,null))[_0xb41b('0x25')](respondWithResult(_0x174d6c,null))['catch'](handleError(_0x174d6c,null));};exports['create']=function(_0x5733d0,_0x5bea5e){return db[_0xb41b('0x2b')][_0xb41b('0x48')](_0x5733d0[_0xb41b('0x49')],{})[_0xb41b('0x25')](respondWithResult(_0x5bea5e,0xc9))[_0xb41b('0x45')](handleError(_0x5bea5e,null));};exports[_0xb41b('0x24')]=function(_0x34d076,_0x3852ae){if(_0x34d076[_0xb41b('0x49')]['id']){delete _0x34d076[_0xb41b('0x49')]['id'];}return db[_0xb41b('0x2b')][_0xb41b('0x47')]({'where':{'id':_0x34d076[_0xb41b('0x4a')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x3852ae,null))[_0xb41b('0x25')](saveUpdates(_0x34d076[_0xb41b('0x49')],null))['then'](respondWithResult(_0x3852ae,null))[_0xb41b('0x45')](handleError(_0x3852ae,null));};exports['destroy']=function(_0x4a7aa3,_0x326145){return db[_0xb41b('0x2b')][_0xb41b('0x47')]({'where':{'id':_0x4a7aa3[_0xb41b('0x4a')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x326145,null))[_0xb41b('0x25')](removeEntity(_0x326145,null))[_0xb41b('0x45')](handleError(_0x326145,null));};exports[_0xb41b('0x4b')]=function(_0x2befc7,_0x1977b1,_0x408d4f){var _0x2e5113={};var _0x236c05={};var _0x3ce89e;var _0x2a6124;return db[_0xb41b('0x2b')][_0xb41b('0x4c')]({'where':{'id':_0x2befc7[_0xb41b('0x4a')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x1977b1,null))[_0xb41b('0x25')](function(_0x2f847e){if(_0x2f847e){_0x3ce89e=_0x2f847e;_0x236c05['model']=_[_0xb41b('0x31')](db['FreshdeskConfiguration'][_0xb41b('0x2c')]);_0x236c05[_0xb41b('0x30')]=_[_0xb41b('0x31')](_0x2befc7[_0xb41b('0x30')]);_0x236c05[_0xb41b('0x32')]=_[_0xb41b('0x33')](_0x236c05[_0xb41b('0x2f')],_0x236c05['query']);_0x2e5113[_0xb41b('0x34')]=_[_0xb41b('0x33')](_0x236c05[_0xb41b('0x2f')],qs['fields'](_0x2befc7[_0xb41b('0x30')][_0xb41b('0x35')]));_0x2e5113[_0xb41b('0x34')]=_0x2e5113[_0xb41b('0x34')][_0xb41b('0x36')]?_0x2e5113[_0xb41b('0x34')]:_0x236c05[_0xb41b('0x2f')];_0x2e5113['order']=qs['sort'](_0x2befc7[_0xb41b('0x30')][_0xb41b('0x3a')]);_0x2e5113['where']=qs[_0xb41b('0x32')](_[_0xb41b('0x4d')](_0x2befc7['query'],_0x236c05[_0xb41b('0x32')]));if(_0x2befc7[_0xb41b('0x30')][_0xb41b('0x3c')]){_0x2e5113[_0xb41b('0x3b')]=_[_0xb41b('0x3f')](_0x2e5113[_0xb41b('0x3b')],{'$or':_[_0xb41b('0x4e')](_0x2e5113[_0xb41b('0x34')],function(_0x182b8a){var _0x331e98={};_0x331e98[_0x182b8a]={'$like':'%'+_0x2befc7['query'][_0xb41b('0x3c')]+'%'};return _0x331e98;})});}_0x2e5113=_[_0xb41b('0x3f')]({},_0x2e5113,_0x2befc7['options']);return _0x3ce89e['getConfigurations'](_0x2e5113);}})[_0xb41b('0x25')](function(_0x185054){if(_0x185054){_0x2a6124=_0x185054[_0xb41b('0x36')];if(!_0x2befc7['query'][_0xb41b('0x37')](_0xb41b('0x38'))){_0x2e5113[_0xb41b('0x1e')]=qs[_0xb41b('0x1e')](_0x2befc7[_0xb41b('0x30')][_0xb41b('0x1e')]);_0x2e5113[_0xb41b('0x1c')]=qs[_0xb41b('0x1c')](_0x2befc7[_0xb41b('0x30')][_0xb41b('0x1c')]);}return _0x3ce89e['getConfigurations'](_0x2e5113);}})[_0xb41b('0x25')](function(_0x164f30){if(_0x164f30){return _0x164f30?{'count':_0x2a6124,'rows':_0x164f30}:null;}})['then'](respondWithResult(_0x1977b1,null))[_0xb41b('0x45')](handleError(_0x1977b1,null));};exports[_0xb41b('0x4f')]=function(_0x28da01,_0x48e95d,_0x23b64e){if(_0x28da01[_0xb41b('0x49')]['id']){delete _0x28da01[_0xb41b('0x49')]['id'];}return db[_0xb41b('0x2b')][_0xb41b('0x4c')]({'where':{'id':_0x28da01[_0xb41b('0x4a')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x48e95d,null))[_0xb41b('0x25')](function(_0x35d1c5){if(_0x35d1c5){_0x28da01[_0xb41b('0x49')]['AccountId']=_0x35d1c5['id'];_0x28da01['body']['Subjects']=integrations['getSubjects'](_0x28da01[_0xb41b('0x49')][_0xb41b('0x50')],_0x28da01[_0xb41b('0x49')][_0xb41b('0x3d')]);_0x28da01[_0xb41b('0x49')][_0xb41b('0x51')]=integrations['getDescriptions'](_0x28da01[_0xb41b('0x49')]['channel'],_0x28da01[_0xb41b('0x49')]['type']);return db[_0xb41b('0x52')]['create'](_0x28da01[_0xb41b('0x49')],{'include':[{'model':db[_0xb41b('0x53')],'as':'Subjects'},{'model':db[_0xb41b('0x53')],'as':_0xb41b('0x51')}]});}return null;})[_0xb41b('0x25')](respondWithResult(_0x48e95d,null))[_0xb41b('0x45')](handleError(_0x48e95d,null));};exports[_0xb41b('0x54')]=function(_0x1c0131,_0x31efa4,_0x523c72){var _0xf3c1bb='';return db['FreshdeskAccount'][_0xb41b('0x4c')]({'where':{'id':_0x1c0131[_0xb41b('0x4a')]['id']},'attributes':['id',_0xb41b('0x55'),'apiKey']})['then'](handleEntityNotFound(_0x31efa4,null))['then'](function(_0x571e41){if(_0x571e41){_0xf3c1bb=_0x571e41[_0xb41b('0x55')];var _0x106fdb=_0xf3c1bb[_0xb41b('0x56')](-0x1);if(_0x106fdb==='/'){_0xf3c1bb=_0xf3c1bb['substring'](0x0,_0xf3c1bb['lastIndexOf'](_0x106fdb));}return rp({'method':_0xb41b('0x57'),'uri':util[_0xb41b('0x58')](_0xb41b('0x59'),_0xf3c1bb,_0xb41b('0x5a')),'headers':{'Authorization':util[_0xb41b('0x58')](_0xb41b('0x5b'),new Buffer(util[_0xb41b('0x58')]('%s:X',_0x571e41['apiKey']))[_0xb41b('0x5c')](_0xb41b('0x5d')))},'json':!![]});}})['then'](function(_0x275e12){if(_0x275e12){var _0x5dd752=[_0xb41b('0x5e'),_0xb41b('0x5f'),'agent',_0xb41b('0x60'),_0xb41b('0x19'),'priority','group',_0xb41b('0x61'),_0xb41b('0x62'),'group',_0xb41b('0x63')];_['remove'](_0x275e12,function(_0x310fec){return _0x5dd752[_0xb41b('0x64')](_0x310fec['name'])||!_0x310fec['default']&&_0x310fec[_0xb41b('0x3d')]!==_0xb41b('0x65')&&_0x310fec['type']!==_0xb41b('0x66');});return{'count':_0x275e12[_0xb41b('0x36')],'rows':_[_0xb41b('0x4e')](_0x275e12,function(_0x5dd56d){return{'id':_0x5dd56d[_0xb41b('0x28')],'name':_0x5dd56d['label'],'custom':!_0x5dd56d['default'],'options':_0x5dd56d[_0xb41b('0x67')]?_[_0xb41b('0x4e')](_0x5dd56d[_0xb41b('0x67')],function(_0x12d086){return{'name':_[_0xb41b('0x68')](_0x12d086),'value':_0x12d086};}):[]};})};}})[_0xb41b('0x25')](respondWithResult(_0x31efa4,null))[_0xb41b('0x45')](function(_0x3872fd){var _0x47577e=_0x1c0131[_0xb41b('0x30')][_0xb41b('0x69')]?0x1f4:_0x3872fd[_0xb41b('0x6a')]||0x1f4;logger[_0xb41b('0x6b')]('getFields,\x20%s,\x20%s,\x20%s',_0xb41b('0x54'),_0x47577e,JSON[_0xb41b('0x6c')](_0x3872fd));delete _0x3872fd[_0xb41b('0x28')];if(_0x47577e===0x191){_0x47577e=0x190;}_0x31efa4[_0xb41b('0x19')](_0x47577e)[_0xb41b('0x29')](_0x1c0131[_0xb41b('0x30')][_0xb41b('0x69')]?{'message':_0xb41b('0x6d'),'statusCode':_0x3872fd['statusCode']}:_0x3872fd);});}; \ No newline at end of file +var _0xa699=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','update','params','getConfigurations','findOne','FreshdeskConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','%s:X','toString','base64','subject','agent','description','priority','source','ticket_type','group','company','remove','includes','label','default','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa699,0x6b));var _0x9a69=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xa699[_0x2307fa];return _0x496486;};'use strict';var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require(_0x9a69('0x6'));var Mustache=require(_0x9a69('0x7'));var util=require(_0x9a69('0x8'));var path=require(_0x9a69('0x9'));var sox=require(_0x9a69('0xa'));var csv=require(_0x9a69('0xb'));var ejs=require(_0x9a69('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a69('0xd'));var squel=require(_0x9a69('0xe'));var crypto=require(_0x9a69('0xf'));var jsforce=require(_0x9a69('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9a69('0xb'));var querystring=require(_0x9a69('0x11'));var Papa=require(_0x9a69('0x12'));var Redis=require(_0x9a69('0x13'));var authService=require(_0x9a69('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a69('0x15'));var logger=require('../../config/logger')(_0x9a69('0x16'));var utils=require(_0x9a69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a69('0x18'));var db=require(_0x9a69('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x81dfb1,_0x2e613e){_0x2e613e=_0x2e613e||0xcc;return function(_0x57e34){if(_0x57e34){return _0x81dfb1[_0x9a69('0x1a')](_0x2e613e);}return _0x81dfb1[_0x9a69('0x1b')](_0x2e613e)[_0x9a69('0x1c')]();};}function respondWithResult(_0x34b5b0,_0x2a5b83){_0x2a5b83=_0x2a5b83||0xc8;return function(_0x1581d6){if(_0x1581d6){return _0x34b5b0['status'](_0x2a5b83)[_0x9a69('0x1d')](_0x1581d6);}};}function respondWithFilteredResult(_0x17de41,_0x2be3ec){return function(_0x5e982d){if(_0x5e982d){var _0x13fd7=typeof _0x2be3ec[_0x9a69('0x1e')]===_0x9a69('0x1f')&&typeof _0x2be3ec[_0x9a69('0x20')]===_0x9a69('0x1f');var _0x5b5161=_0x5e982d[_0x9a69('0x21')];var _0x2a6a0d=_0x13fd7?0x0:_0x2be3ec[_0x9a69('0x1e')];var _0x334474=_0x13fd7?_0x5e982d[_0x9a69('0x21')]:_0x2be3ec[_0x9a69('0x1e')]+_0x2be3ec[_0x9a69('0x20')];var _0x45cae5;if(_0x334474>=_0x5b5161){_0x334474=_0x5b5161;_0x45cae5=0xc8;}else{_0x45cae5=0xce;}_0x17de41[_0x9a69('0x1b')](_0x45cae5);return _0x17de41[_0x9a69('0x22')]('Content-Range',_0x2a6a0d+'-'+_0x334474+'/'+_0x5b5161)['json'](_0x5e982d);}return null;};}function patchUpdates(_0x5ebb09){return function(_0x426f72){try{jsonpatch[_0x9a69('0x23')](_0x426f72,_0x5ebb09,!![]);}catch(_0x518620){return BPromise[_0x9a69('0x24')](_0x518620);}return _0x426f72[_0x9a69('0x25')]();};}function saveUpdates(_0x265291,_0x4d6a93){return function(_0x4b9b28){if(_0x4b9b28){return _0x4b9b28['update'](_0x265291)[_0x9a69('0x26')](function(_0x5f4138){return _0x5f4138;});}return null;};}function removeEntity(_0x140cbe,_0x28f5f7){return function(_0x256cc1){if(_0x256cc1){return _0x256cc1[_0x9a69('0x27')]()['then'](function(){_0x140cbe[_0x9a69('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203d32,_0x4ef126){return function(_0x5ac01c){if(!_0x5ac01c){_0x203d32[_0x9a69('0x1a')](0x194);}return _0x5ac01c;};}function handleError(_0xf6fea2,_0x268cef){_0x268cef=_0x268cef||0x1f4;return function(_0xbe0597){logger[_0x9a69('0x28')](_0xbe0597[_0x9a69('0x29')]);if(_0xbe0597[_0x9a69('0x2a')]){delete _0xbe0597[_0x9a69('0x2a')];}_0xf6fea2[_0x9a69('0x1b')](_0x268cef)[_0x9a69('0x2b')](_0xbe0597);};}exports['index']=function(_0x1ff48e,_0x165a87){var _0x5433b3={},_0x54e643={},_0x4b3539={'count':0x0,'rows':[]};var _0x1f976b=_['map'](db[_0x9a69('0x2c')][_0x9a69('0x2d')],function(_0x31b83b){return{'name':_0x31b83b[_0x9a69('0x2e')],'type':_0x31b83b[_0x9a69('0x2f')][_0x9a69('0x30')]};});_0x54e643[_0x9a69('0x31')]=_[_0x9a69('0x32')](_0x1f976b,_0x9a69('0x2a'));_0x54e643[_0x9a69('0x33')]=_[_0x9a69('0x34')](_0x1ff48e[_0x9a69('0x33')]);_0x54e643[_0x9a69('0x35')]=_[_0x9a69('0x36')](_0x54e643[_0x9a69('0x31')],_0x54e643[_0x9a69('0x33')]);_0x5433b3[_0x9a69('0x37')]=_['intersection'](_0x54e643['model'],qs[_0x9a69('0x38')](_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x38')]));_0x5433b3[_0x9a69('0x37')]=_0x5433b3[_0x9a69('0x37')]['length']?_0x5433b3['attributes']:_0x54e643['model'];if(!_0x1ff48e['query'][_0x9a69('0x39')](_0x9a69('0x3a'))){_0x5433b3[_0x9a69('0x20')]=qs[_0x9a69('0x20')](_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x20')]);_0x5433b3['offset']=qs['offset'](_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x1e')]);}_0x5433b3[_0x9a69('0x3b')]=qs['sort'](_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x3c')]);_0x5433b3[_0x9a69('0x3d')]=qs[_0x9a69('0x35')](_[_0x9a69('0x3e')](_0x1ff48e[_0x9a69('0x33')],_0x54e643[_0x9a69('0x35')]),_0x1f976b);if(_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x3f')]){_0x5433b3[_0x9a69('0x3d')]=_[_0x9a69('0x40')](_0x5433b3['where'],{'$or':_[_0x9a69('0x32')](_0x1f976b,function(_0x524958){if(_0x524958['type']!=='VIRTUAL'){var _0x5dd195={};_0x5dd195[_0x524958[_0x9a69('0x2a')]]={'$like':'%'+_0x1ff48e[_0x9a69('0x33')]['filter']+'%'};return _0x5dd195;}})});}_0x5433b3=_['merge']({},_0x5433b3,_0x1ff48e['options']);var _0x28100b={'where':_0x5433b3[_0x9a69('0x3d')]};return db[_0x9a69('0x2c')]['count'](_0x28100b)[_0x9a69('0x26')](function(_0x36aa5f){_0x4b3539[_0x9a69('0x21')]=_0x36aa5f;if(_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x41')]){_0x5433b3[_0x9a69('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x9a69('0x43')](_0x5433b3);})[_0x9a69('0x26')](function(_0x1d54c9){_0x4b3539[_0x9a69('0x44')]=_0x1d54c9;return _0x4b3539;})['then'](respondWithFilteredResult(_0x165a87,_0x5433b3))[_0x9a69('0x45')](handleError(_0x165a87,null));};exports[_0x9a69('0x46')]=function(_0x5b309a,_0x318de1){var _0x3c78e2={'raw':![],'where':{'id':_0x5b309a['params']['id']}},_0x23b174={};_0x23b174['model']=_['keys'](db[_0x9a69('0x2c')][_0x9a69('0x2d')]);_0x23b174[_0x9a69('0x33')]=_[_0x9a69('0x34')](_0x5b309a['query']);_0x23b174[_0x9a69('0x35')]=_[_0x9a69('0x36')](_0x23b174[_0x9a69('0x31')],_0x23b174[_0x9a69('0x33')]);_0x3c78e2['attributes']=_[_0x9a69('0x36')](_0x23b174[_0x9a69('0x31')],qs[_0x9a69('0x38')](_0x5b309a[_0x9a69('0x33')]['fields']));_0x3c78e2[_0x9a69('0x37')]=_0x3c78e2['attributes'][_0x9a69('0x47')]?_0x3c78e2['attributes']:_0x23b174[_0x9a69('0x31')];if(_0x5b309a['query'][_0x9a69('0x41')]){_0x3c78e2['include']=[{'all':!![]}];}_0x3c78e2=_[_0x9a69('0x40')]({},_0x3c78e2,_0x5b309a[_0x9a69('0x48')]);return db[_0x9a69('0x2c')][_0x9a69('0x49')](_0x3c78e2)['then'](handleEntityNotFound(_0x318de1,null))[_0x9a69('0x26')](respondWithResult(_0x318de1,null))[_0x9a69('0x45')](handleError(_0x318de1,null));};exports[_0x9a69('0x4a')]=function(_0x2537b0,_0x18b0be){return db[_0x9a69('0x2c')][_0x9a69('0x4a')](_0x2537b0[_0x9a69('0x4b')],{})[_0x9a69('0x26')](respondWithResult(_0x18b0be,0xc9))['catch'](handleError(_0x18b0be,null));};exports[_0x9a69('0x4c')]=function(_0x6046a7,_0x1a104f){if(_0x6046a7[_0x9a69('0x4b')]['id']){delete _0x6046a7[_0x9a69('0x4b')]['id'];}return db[_0x9a69('0x2c')][_0x9a69('0x49')]({'where':{'id':_0x6046a7[_0x9a69('0x4d')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x1a104f,null))[_0x9a69('0x26')](saveUpdates(_0x6046a7[_0x9a69('0x4b')],null))[_0x9a69('0x26')](respondWithResult(_0x1a104f,null))[_0x9a69('0x45')](handleError(_0x1a104f,null));};exports[_0x9a69('0x27')]=function(_0x18ab7a,_0x4c5b25){return db[_0x9a69('0x2c')][_0x9a69('0x49')]({'where':{'id':_0x18ab7a[_0x9a69('0x4d')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x4c5b25,null))[_0x9a69('0x26')](removeEntity(_0x4c5b25,null))[_0x9a69('0x45')](handleError(_0x4c5b25,null));};exports[_0x9a69('0x4e')]=function(_0x52a75f,_0x15100e,_0xf378fd){var _0x2b7b66={};var _0x9a7c34={};var _0x18c353;var _0x32c826;return db[_0x9a69('0x2c')][_0x9a69('0x4f')]({'where':{'id':_0x52a75f[_0x9a69('0x4d')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x15100e,null))[_0x9a69('0x26')](function(_0x546243){if(_0x546243){_0x18c353=_0x546243;_0x9a7c34[_0x9a69('0x31')]=_[_0x9a69('0x34')](db[_0x9a69('0x50')]['rawAttributes']);_0x9a7c34[_0x9a69('0x33')]=_['keys'](_0x52a75f['query']);_0x9a7c34[_0x9a69('0x35')]=_[_0x9a69('0x36')](_0x9a7c34[_0x9a69('0x31')],_0x9a7c34[_0x9a69('0x33')]);_0x2b7b66['attributes']=_['intersection'](_0x9a7c34[_0x9a69('0x31')],qs['fields'](_0x52a75f[_0x9a69('0x33')]['fields']));_0x2b7b66['attributes']=_0x2b7b66[_0x9a69('0x37')][_0x9a69('0x47')]?_0x2b7b66[_0x9a69('0x37')]:_0x9a7c34[_0x9a69('0x31')];_0x2b7b66[_0x9a69('0x3b')]=qs[_0x9a69('0x3c')](_0x52a75f[_0x9a69('0x33')]['sort']);_0x2b7b66[_0x9a69('0x3d')]=qs[_0x9a69('0x35')](_[_0x9a69('0x3e')](_0x52a75f[_0x9a69('0x33')],_0x9a7c34['filters']));if(_0x52a75f[_0x9a69('0x33')][_0x9a69('0x3f')]){_0x2b7b66[_0x9a69('0x3d')]=_['merge'](_0x2b7b66[_0x9a69('0x3d')],{'$or':_[_0x9a69('0x32')](_0x2b7b66['attributes'],function(_0x533dcd){var _0x34ee21={};_0x34ee21[_0x533dcd]={'$like':'%'+_0x52a75f[_0x9a69('0x33')][_0x9a69('0x3f')]+'%'};return _0x34ee21;})});}_0x2b7b66=_[_0x9a69('0x40')]({},_0x2b7b66,_0x52a75f['options']);return _0x18c353['getConfigurations'](_0x2b7b66);}})[_0x9a69('0x26')](function(_0x37a9b6){if(_0x37a9b6){_0x32c826=_0x37a9b6['length'];if(!_0x52a75f[_0x9a69('0x33')][_0x9a69('0x39')]('nolimit')){_0x2b7b66[_0x9a69('0x20')]=qs['limit'](_0x52a75f[_0x9a69('0x33')]['limit']);_0x2b7b66['offset']=qs[_0x9a69('0x1e')](_0x52a75f[_0x9a69('0x33')][_0x9a69('0x1e')]);}return _0x18c353['getConfigurations'](_0x2b7b66);}})[_0x9a69('0x26')](function(_0x269cd7){if(_0x269cd7){return _0x269cd7?{'count':_0x32c826,'rows':_0x269cd7}:null;}})[_0x9a69('0x26')](respondWithResult(_0x15100e,null))[_0x9a69('0x45')](handleError(_0x15100e,null));};exports['addConfiguration']=function(_0x420057,_0x45549e,_0x665d9e){if(_0x420057[_0x9a69('0x4b')]['id']){delete _0x420057[_0x9a69('0x4b')]['id'];}return db[_0x9a69('0x2c')][_0x9a69('0x4f')]({'where':{'id':_0x420057[_0x9a69('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45549e,null))[_0x9a69('0x26')](function(_0x51bf8d){if(_0x51bf8d){_0x420057['body']['AccountId']=_0x51bf8d['id'];_0x420057[_0x9a69('0x4b')][_0x9a69('0x51')]=integrations[_0x9a69('0x52')](_0x420057[_0x9a69('0x4b')][_0x9a69('0x53')],_0x420057[_0x9a69('0x4b')]['type']);_0x420057[_0x9a69('0x4b')]['Descriptions']=integrations[_0x9a69('0x54')](_0x420057[_0x9a69('0x4b')][_0x9a69('0x53')],_0x420057[_0x9a69('0x4b')][_0x9a69('0x2f')]);return db[_0x9a69('0x50')][_0x9a69('0x4a')](_0x420057['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x9a69('0x51')},{'model':db[_0x9a69('0x55')],'as':_0x9a69('0x56')}]});}return null;})['then'](respondWithResult(_0x45549e,null))[_0x9a69('0x45')](handleError(_0x45549e,null));};exports[_0x9a69('0x57')]=function(_0xb93218,_0x270e6b,_0xbbc647){var _0x2a7f48='';return db[_0x9a69('0x2c')]['findOne']({'where':{'id':_0xb93218['params']['id']},'attributes':['id',_0x9a69('0x58'),'apiKey']})['then'](handleEntityNotFound(_0x270e6b,null))[_0x9a69('0x26')](function(_0x428f46){if(_0x428f46){_0x2a7f48=_0x428f46[_0x9a69('0x58')];var _0x857872=_0x2a7f48[_0x9a69('0x59')](-0x1);if(_0x857872==='/'){_0x2a7f48=_0x2a7f48[_0x9a69('0x5a')](0x0,_0x2a7f48[_0x9a69('0x5b')](_0x857872));}return rp({'method':_0x9a69('0x5c'),'uri':util[_0x9a69('0x5d')](_0x9a69('0x5e'),_0x2a7f48,'api/v2/ticket_fields'),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x9a69('0x5d')](_0x9a69('0x5f'),_0x428f46['apiKey']))[_0x9a69('0x60')](_0x9a69('0x61')))},'json':!![]});}})[_0x9a69('0x26')](function(_0x1e2948){if(_0x1e2948){var _0x180683=['requester',_0x9a69('0x62'),_0x9a69('0x63'),_0x9a69('0x64'),_0x9a69('0x1b'),_0x9a69('0x65'),'group',_0x9a69('0x66'),_0x9a69('0x67'),_0x9a69('0x68'),_0x9a69('0x69')];_[_0x9a69('0x6a')](_0x1e2948,function(_0x27dc6b){return _0x180683[_0x9a69('0x6b')](_0x27dc6b[_0x9a69('0x2a')])||!_0x27dc6b['default']&&_0x27dc6b[_0x9a69('0x2f')]!=='custom_text'&&_0x27dc6b[_0x9a69('0x2f')]!=='custom_dropdown';});return{'count':_0x1e2948[_0x9a69('0x47')],'rows':_[_0x9a69('0x32')](_0x1e2948,function(_0x3425ce){return{'id':_0x3425ce['name'],'name':_0x3425ce[_0x9a69('0x6c')],'custom':!_0x3425ce[_0x9a69('0x6d')],'options':_0x3425ce['choices']?_[_0x9a69('0x32')](_0x3425ce[_0x9a69('0x6e')],function(_0x29e6c4){return{'name':_[_0x9a69('0x6f')](_0x29e6c4),'value':_0x29e6c4};}):[]};})};}})['then'](respondWithResult(_0x270e6b,null))['catch'](function(_0x2abc56){var _0x5d4e64=_0xb93218[_0x9a69('0x33')][_0x9a69('0x70')]?0x1f4:_0x2abc56[_0x9a69('0x71')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5d4e64,JSON[_0x9a69('0x72')](_0x2abc56));delete _0x2abc56['name'];if(_0x5d4e64===0x191){_0x5d4e64=0x190;}_0x270e6b['status'](_0x5d4e64)[_0x9a69('0x2b')](_0xb93218['query']['test']?{'message':_0x9a69('0x73'),'statusCode':_0x2abc56[_0x9a69('0x71')]}:_0x2abc56);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 78e53ac..140266e 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 _0x6fe7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x1ff12c,_0x40e32e){var _0x5163f3=function(_0x4c6a98){while(--_0x4c6a98){_0x1ff12c['push'](_0x1ff12c['shift']());}};_0x5163f3(++_0x40e32e);}(_0x6fe7,0x106));var _0x76fe=function(_0x1b2257,_0x51eb18){_0x1b2257=_0x1b2257-0x0;var _0x42023d=_0x6fe7[_0x1b2257];return _0x42023d;};'use strict';var _=require(_0x76fe('0x0'));var util=require(_0x76fe('0x1'));var logger=require(_0x76fe('0x2'))(_0x76fe('0x3'));var moment=require(_0x76fe('0x4'));var BPromise=require(_0x76fe('0x5'));var rp=require(_0x76fe('0x6'));var fs=require('fs');var path=require(_0x76fe('0x7'));var rimraf=require(_0x76fe('0x8'));var config=require(_0x76fe('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x76fe('0xa'));module['exports']=function(_0x17ffb1,_0x3ddbaf){return _0x17ffb1[_0x76fe('0xb')](_0x76fe('0xc'),attributes,{'tableName':_0x76fe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa517=['rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x525c48,_0x3b8cf7){var _0x2de86f=function(_0x250c6d){while(--_0x250c6d){_0x525c48['push'](_0x525c48['shift']());}};_0x2de86f(++_0x3b8cf7);}(_0xa517,0x155));var _0x7a51=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xa517[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x7a51('0x0'));var util=require(_0x7a51('0x1'));var logger=require(_0x7a51('0x2'))('api');var moment=require(_0x7a51('0x3'));var BPromise=require(_0x7a51('0x4'));var rp=require(_0x7a51('0x5'));var fs=require('fs');var path=require(_0x7a51('0x6'));var rimraf=require(_0x7a51('0x7'));var config=require('../../config/environment');var attributes=require(_0x7a51('0x8'));var integrations=require(_0x7a51('0x9'));module[_0x7a51('0xa')]=function(_0x586e6f,_0x33c0bc){return _0x586e6f['define'](_0x7a51('0xb'),attributes,{'tableName':'int_freshdesk_accounts','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 f401a2d..9c87c72 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 _0x8eca=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','include','model','map','ShowFreshdeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info'];(function(_0x41a237,_0x2647d7){var _0x276a84=function(_0x366c14){while(--_0x366c14){_0x41a237['push'](_0x41a237['shift']());}};_0x276a84(++_0x2647d7);}(_0x8eca,0x114));var _0xa8ec=function(_0xd13171,_0xc54453){_0xd13171=_0xd13171-0x0;var _0x452bd0=_0x8eca[_0xd13171];return _0x452bd0;};'use strict';var _=require(_0xa8ec('0x0'));var util=require('util');var moment=require(_0xa8ec('0x1'));var BPromise=require(_0xa8ec('0x2'));var rs=require(_0xa8ec('0x3'));var fs=require('fs');var Redis=require(_0xa8ec('0x4'));var db=require(_0xa8ec('0x5'))['db'];var utils=require(_0xa8ec('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa8ec('0x7'));var client=jayson[_0xa8ec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c85a7,_0x888a29,_0x56cf27){return new BPromise(function(_0x245560,_0x4c1d2f){return client[_0xa8ec('0x9')](_0x3c85a7,_0x56cf27)[_0xa8ec('0xa')](function(_0x603fe3){logger[_0xa8ec('0xb')](_0xa8ec('0xc'),_0x888a29,_0xa8ec('0xd'));logger[_0xa8ec('0xe')](_0xa8ec('0xf'),_0x888a29,_0xa8ec('0xd'),JSON[_0xa8ec('0x10')](_0x603fe3));if(_0x603fe3[_0xa8ec('0x11')]){if(_0x603fe3[_0xa8ec('0x11')]['code']===0x1f4){logger[_0xa8ec('0x11')](_0xa8ec('0xc'),_0x888a29,_0x603fe3['error'][_0xa8ec('0x12')]);return _0x4c1d2f(_0x603fe3[_0xa8ec('0x11')][_0xa8ec('0x12')]);}logger[_0xa8ec('0x11')](_0xa8ec('0xc'),_0x888a29,_0x603fe3[_0xa8ec('0x11')][_0xa8ec('0x12')]);return _0x245560(_0x603fe3[_0xa8ec('0x11')][_0xa8ec('0x12')]);}else{logger[_0xa8ec('0xb')](_0xa8ec('0xc'),_0x888a29,'request\x20sent');_0x245560(_0x603fe3[_0xa8ec('0x13')][_0xa8ec('0x12')]);}})[_0xa8ec('0x14')](function(_0xfc643f){logger[_0xa8ec('0x11')](_0xa8ec('0xc'),_0x888a29,_0xfc643f);_0x4c1d2f(_0xfc643f);});});}exports[_0xa8ec('0x15')]=function(_0xa31918){var _0x4a5286=this;return new Promise(function(_0x4ddf5f,_0x555d79){return db[_0xa8ec('0x16')]['findAll']({'raw':_0xa31918[_0xa8ec('0x17')]?_0xa31918['options'][_0xa8ec('0x18')]===undefined?!![]:![]:!![],'where':_0xa31918[_0xa8ec('0x17')]?_0xa31918[_0xa8ec('0x17')][_0xa8ec('0x19')]||null:null,'attributes':_0xa31918['options']?_0xa31918['options'][_0xa8ec('0x1a')]||null:null,'limit':_0xa31918[_0xa8ec('0x17')]?_0xa31918[_0xa8ec('0x17')]['limit']||null:null,'include':_0xa31918[_0xa8ec('0x17')]?_0xa31918[_0xa8ec('0x17')]['include']?_['map'](_0xa31918[_0xa8ec('0x17')][_0xa8ec('0x1b')],function(_0x24d108){return{'model':db[_0x24d108[_0xa8ec('0x1c')]],'as':_0x24d108['as'],'attributes':_0x24d108['attributes'],'include':_0x24d108['include']?_['map'](_0x24d108['include'],function(_0x510528){return{'model':db[_0x510528['model']],'as':_0x510528['as'],'attributes':_0x510528[_0xa8ec('0x1a')],'include':_0x510528[_0xa8ec('0x1b')]?_[_0xa8ec('0x1d')](_0x510528[_0xa8ec('0x1b')],function(_0x152343){return{'model':db[_0x152343[_0xa8ec('0x1c')]],'as':_0x152343['as'],'attributes':_0x152343[_0xa8ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa8ec('0xa')](function(_0x419931){logger['info']('GetFreshdeskAccount',_0xa31918);logger[_0xa8ec('0xe')]('GetFreshdeskAccount',_0xa31918,JSON[_0xa8ec('0x10')](_0x419931));_0x4ddf5f(_0x419931);})[_0xa8ec('0x14')](function(_0x411952){logger[_0xa8ec('0x11')](_0xa8ec('0x15'),_0x411952[_0xa8ec('0x12')],_0xa31918);_0x555d79(_0x4a5286[_0xa8ec('0x11')](0x1f4,_0x411952[_0xa8ec('0x12')]));});});};exports[_0xa8ec('0x1e')]=function(_0x2e92e8){var _0x304dc1=this;return new Promise(function(_0x61d4e0,_0x9a0795){return db[_0xa8ec('0x16')][_0xa8ec('0x1f')]({'raw':_0x2e92e8[_0xa8ec('0x17')]?_0x2e92e8['options'][_0xa8ec('0x18')]===undefined?!![]:![]:!![],'where':_0x2e92e8[_0xa8ec('0x17')]?_0x2e92e8[_0xa8ec('0x17')][_0xa8ec('0x19')]||null:null,'attributes':_0x2e92e8[_0xa8ec('0x17')]?_0x2e92e8[_0xa8ec('0x17')][_0xa8ec('0x1a')]||null:null,'include':_0x2e92e8[_0xa8ec('0x17')]?_0x2e92e8['options'][_0xa8ec('0x1b')]?_[_0xa8ec('0x1d')](_0x2e92e8[_0xa8ec('0x17')]['include'],function(_0x20cdd8){return{'model':db[_0x20cdd8[_0xa8ec('0x1c')]],'as':_0x20cdd8['as'],'attributes':_0x20cdd8[_0xa8ec('0x1a')],'include':_0x20cdd8[_0xa8ec('0x1b')]?_[_0xa8ec('0x1d')](_0x20cdd8['include'],function(_0x287db4){return{'model':db[_0x287db4[_0xa8ec('0x1c')]],'as':_0x287db4['as'],'attributes':_0x287db4['attributes'],'include':_0x287db4[_0xa8ec('0x1b')]?_['map'](_0x287db4[_0xa8ec('0x1b')],function(_0x5a110b){return{'model':db[_0x5a110b['model']],'as':_0x5a110b['as'],'attributes':_0x5a110b[_0xa8ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa8ec('0xa')](function(_0x294f5d){logger[_0xa8ec('0xb')](_0xa8ec('0x1e'),_0x2e92e8);logger[_0xa8ec('0xe')](_0xa8ec('0x1e'),_0x2e92e8,JSON[_0xa8ec('0x10')](_0x294f5d));_0x61d4e0(_0x294f5d);})[_0xa8ec('0x14')](function(_0x78b019){logger[_0xa8ec('0x11')](_0xa8ec('0x1e'),_0x78b019[_0xa8ec('0x12')],_0x2e92e8);_0x9a0795(_0x304dc1[_0xa8ec('0x11')](0x1f4,_0x78b019[_0xa8ec('0x12')]));});});}; \ No newline at end of file +var _0x64be=['message','result','catch','GetFreshdeskAccount','options','raw','attributes','limit','include','map','model','then','debug','FreshdeskAccount','where','ShowFreshdeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x54b582,_0x13f810){var _0x29858c=function(_0x4ac03e){while(--_0x4ac03e){_0x54b582['push'](_0x54b582['shift']());}};_0x29858c(++_0x13f810);}(_0x64be,0x120));var _0xe64b=function(_0x10877f,_0x19a63d){_0x10877f=_0x10877f-0x0;var _0x413c5b=_0x64be[_0x10877f];return _0x413c5b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe64b('0x0'));var BPromise=require(_0xe64b('0x1'));var rs=require(_0xe64b('0x2'));var fs=require('fs');var Redis=require(_0xe64b('0x3'));var db=require(_0xe64b('0x4'))['db'];var utils=require(_0xe64b('0x5'));var logger=require(_0xe64b('0x6'))(_0xe64b('0x7'));var config=require(_0xe64b('0x8'));var jayson=require(_0xe64b('0x9'));var client=jayson[_0xe64b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1123,_0x3b5f3c,_0x79619d){return new BPromise(function(_0x6c2c7e,_0x50ae00){return client[_0xe64b('0xb')](_0x2d1123,_0x79619d)['then'](function(_0x44448e){logger[_0xe64b('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b5f3c,'request\x20sent');logger['debug'](_0xe64b('0xd'),_0x3b5f3c,_0xe64b('0xe'),JSON[_0xe64b('0xf')](_0x44448e));if(_0x44448e[_0xe64b('0x10')]){if(_0x44448e['error']['code']===0x1f4){logger[_0xe64b('0x10')](_0xe64b('0x11'),_0x3b5f3c,_0x44448e['error'][_0xe64b('0x12')]);return _0x50ae00(_0x44448e['error']['message']);}logger[_0xe64b('0x10')](_0xe64b('0x11'),_0x3b5f3c,_0x44448e[_0xe64b('0x10')][_0xe64b('0x12')]);return _0x6c2c7e(_0x44448e[_0xe64b('0x10')]['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x3b5f3c,_0xe64b('0xe'));_0x6c2c7e(_0x44448e[_0xe64b('0x13')][_0xe64b('0x12')]);}})[_0xe64b('0x14')](function(_0x4c08bc){logger[_0xe64b('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x3b5f3c,_0x4c08bc);_0x50ae00(_0x4c08bc);});});}exports[_0xe64b('0x15')]=function(_0x44df9f){var _0x3d2c7c=this;return new Promise(function(_0x1edfaf,_0x514254){return db['FreshdeskAccount']['findAll']({'raw':_0x44df9f[_0xe64b('0x16')]?_0x44df9f['options'][_0xe64b('0x17')]===undefined?!![]:![]:!![],'where':_0x44df9f[_0xe64b('0x16')]?_0x44df9f[_0xe64b('0x16')]['where']||null:null,'attributes':_0x44df9f[_0xe64b('0x16')]?_0x44df9f[_0xe64b('0x16')][_0xe64b('0x18')]||null:null,'limit':_0x44df9f['options']?_0x44df9f[_0xe64b('0x16')][_0xe64b('0x19')]||null:null,'include':_0x44df9f['options']?_0x44df9f[_0xe64b('0x16')][_0xe64b('0x1a')]?_[_0xe64b('0x1b')](_0x44df9f[_0xe64b('0x16')]['include'],function(_0x6d9092){return{'model':db[_0x6d9092[_0xe64b('0x1c')]],'as':_0x6d9092['as'],'attributes':_0x6d9092['attributes'],'include':_0x6d9092[_0xe64b('0x1a')]?_[_0xe64b('0x1b')](_0x6d9092[_0xe64b('0x1a')],function(_0x5bdbb8){return{'model':db[_0x5bdbb8[_0xe64b('0x1c')]],'as':_0x5bdbb8['as'],'attributes':_0x5bdbb8[_0xe64b('0x18')],'include':_0x5bdbb8[_0xe64b('0x1a')]?_[_0xe64b('0x1b')](_0x5bdbb8['include'],function(_0x136b87){return{'model':db[_0x136b87['model']],'as':_0x136b87['as'],'attributes':_0x136b87[_0xe64b('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe64b('0x1d')](function(_0x2d4061){logger[_0xe64b('0xc')](_0xe64b('0x15'),_0x44df9f);logger[_0xe64b('0x1e')](_0xe64b('0x15'),_0x44df9f,JSON['stringify'](_0x2d4061));_0x1edfaf(_0x2d4061);})[_0xe64b('0x14')](function(_0x9edddd){logger['error']('GetFreshdeskAccount',_0x9edddd['message'],_0x44df9f);_0x514254(_0x3d2c7c[_0xe64b('0x10')](0x1f4,_0x9edddd[_0xe64b('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x526a54){var _0x13c5a3=this;return new Promise(function(_0x42cd19,_0x45ae28){return db[_0xe64b('0x1f')]['find']({'raw':_0x526a54[_0xe64b('0x16')]?_0x526a54['options'][_0xe64b('0x17')]===undefined?!![]:![]:!![],'where':_0x526a54['options']?_0x526a54['options'][_0xe64b('0x20')]||null:null,'attributes':_0x526a54['options']?_0x526a54['options'][_0xe64b('0x18')]||null:null,'include':_0x526a54[_0xe64b('0x16')]?_0x526a54['options'][_0xe64b('0x1a')]?_[_0xe64b('0x1b')](_0x526a54[_0xe64b('0x16')][_0xe64b('0x1a')],function(_0x2beb69){return{'model':db[_0x2beb69[_0xe64b('0x1c')]],'as':_0x2beb69['as'],'attributes':_0x2beb69[_0xe64b('0x18')],'include':_0x2beb69[_0xe64b('0x1a')]?_[_0xe64b('0x1b')](_0x2beb69[_0xe64b('0x1a')],function(_0x5993b){return{'model':db[_0x5993b[_0xe64b('0x1c')]],'as':_0x5993b['as'],'attributes':_0x5993b['attributes'],'include':_0x5993b['include']?_['map'](_0x5993b[_0xe64b('0x1a')],function(_0x43c54a){return{'model':db[_0x43c54a[_0xe64b('0x1c')]],'as':_0x43c54a['as'],'attributes':_0x43c54a[_0xe64b('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe64b('0x1d')](function(_0x165a0f){logger['info'](_0xe64b('0x21'),_0x526a54);logger['debug'](_0xe64b('0x21'),_0x526a54,JSON['stringify'](_0x165a0f));_0x42cd19(_0x165a0f);})[_0xe64b('0x14')](function(_0x49cf3b){logger['error']('ShowFreshdeskAccount',_0x49cf3b['message'],_0x526a54);_0x45ae28(_0x13c5a3[_0xe64b('0x10')](0x1f4,_0x49cf3b[_0xe64b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c13b32a..22c1367 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 _0x354c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','create','/:id/tags','setTags','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x354c,0x182));var _0xc354=function(_0x3f84f9,_0x3f5cdb){_0x3f84f9=_0x3f84f9-0x0;var _0x359080=_0x354c[_0x3f84f9];return _0x359080;};'use strict';var multer=require('multer');var util=require(_0xc354('0x0'));var path=require(_0xc354('0x1'));var timeout=require(_0xc354('0x2'));var express=require(_0xc354('0x3'));var router=express[_0xc354('0x4')]();var fs_extra=require(_0xc354('0x5'));var auth=require(_0xc354('0x6'));var interaction=require(_0xc354('0x7'));var config=require(_0xc354('0x8'));var controller=require(_0xc354('0x9'));router[_0xc354('0xa')]('/',auth[_0xc354('0xb')](),controller['index']);router[_0xc354('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc354('0xc')]);router[_0xc354('0xa')](_0xc354('0xd'),auth[_0xc354('0xb')](),controller[_0xc354('0xe')]);router['get'](_0xc354('0xf'),auth[_0xc354('0xb')](),controller[_0xc354('0x10')]);router[_0xc354('0xa')](_0xc354('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc354('0xa')]('/:id/tags',auth[_0xc354('0xb')](),controller[_0xc354('0x12')]);router['post']('/',auth[_0xc354('0xb')](),controller[_0xc354('0x13')]);router['post'](_0xc354('0x14'),auth['isAuthenticated'](),controller[_0xc354('0x15')]);router['put'](_0xc354('0x16'),auth[_0xc354('0xb')](),controller[_0xc354('0x17')]);router['delete']('/:id',auth[_0xc354('0xb')](),controller[_0xc354('0x18')]);module[_0xc354('0x19')]=router; \ No newline at end of file +var _0xa2f0=['put','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','/:id/fields','getFields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xa2f0,0x67));var _0x0a2f=function(_0x4e15ff,_0xa5f44f){_0x4e15ff=_0x4e15ff-0x0;var _0x846034=_0xa2f0[_0x4e15ff];return _0x846034;};'use strict';var multer=require(_0x0a2f('0x0'));var util=require(_0x0a2f('0x1'));var path=require('path');var timeout=require(_0x0a2f('0x2'));var express=require('express');var router=express[_0x0a2f('0x3')]();var fs_extra=require(_0x0a2f('0x4'));var auth=require(_0x0a2f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0a2f('0x6'));var controller=require(_0x0a2f('0x7'));router[_0x0a2f('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a2f('0x9')]);router[_0x0a2f('0x8')](_0x0a2f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a2f('0x8')](_0x0a2f('0xb'),auth['isAuthenticated'](),controller[_0x0a2f('0xc')]);router[_0x0a2f('0x8')](_0x0a2f('0xd'),auth[_0x0a2f('0xe')](),controller['getSubjects']);router[_0x0a2f('0x8')](_0x0a2f('0xf'),auth['isAuthenticated'](),controller[_0x0a2f('0x10')]);router[_0x0a2f('0x8')](_0x0a2f('0x11'),auth['isAuthenticated'](),controller[_0x0a2f('0x12')]);router[_0x0a2f('0x13')]('/',auth[_0x0a2f('0xe')](),controller[_0x0a2f('0x14')]);router[_0x0a2f('0x13')](_0x0a2f('0x11'),auth[_0x0a2f('0xe')](),controller[_0x0a2f('0x15')]);router[_0x0a2f('0x16')](_0x0a2f('0xa'),auth['isAuthenticated'](),controller[_0x0a2f('0x17')]);router['delete'](_0x0a2f('0xa'),auth['isAuthenticated'](),controller[_0x0a2f('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index dc7100a..5d0392d 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 _0x320a=['sequelize','exports','STRING'];(function(_0x4a5df4,_0x407591){var _0x341917=function(_0x57e29c){while(--_0x57e29c){_0x4a5df4['push'](_0x4a5df4['shift']());}};_0x341917(++_0x407591);}(_0x320a,0x1ec));var _0xa320=function(_0x384c84,_0x216ee5){_0x384c84=_0x384c84-0x0;var _0x37b0ec=_0x320a[_0x384c84];return _0x37b0ec;};'use strict';var Sequelize=require(_0xa320('0x0'));module[_0xa320('0x1')]={'name':{'type':Sequelize[_0xa320('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcd3f=['STRING','sequelize'];(function(_0x5ea1a6,_0x36ce42){var _0xa38b8=function(_0x1844c6){while(--_0x1844c6){_0x5ea1a6['push'](_0x5ea1a6['shift']());}};_0xa38b8(++_0x36ce42);}(_0xcd3f,0x177));var _0xfcd3=function(_0x12efd7,_0x14202f){_0x12efd7=_0x12efd7-0x0;var _0x4bb9b2=_0xcd3f[_0x12efd7];return _0x4bb9b2;};'use strict';var Sequelize=require(_0xfcd3('0x0'));module['exports']={'name':{'type':Sequelize[_0xfcd3('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e8cca85..47e7465 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 _0x8347=['Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','count','offset','set','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','create','body','find','params','getFields','FreshdeskField','pick','filter','getSubjects','findOne','hasOwnProperty','getDescriptions','getTags'];(function(_0x2ca9f1,_0xff9bd3){var _0x73f4a7=function(_0x26d4a8){while(--_0x26d4a8){_0x2ca9f1['push'](_0x2ca9f1['shift']());}};_0x73f4a7(++_0xff9bd3);}(_0x8347,0x19d));var _0x7834=function(_0x802b9e,_0xc3a46d){_0x802b9e=_0x802b9e-0x0;var _0x34b40=_0x8347[_0x802b9e];return _0x34b40;};'use strict';var emlformat=require(_0x7834('0x0'));var rimraf=require(_0x7834('0x1'));var zipdir=require(_0x7834('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7834('0x3'));var moment=require(_0x7834('0x4'));var BPromise=require(_0x7834('0x5'));var Mustache=require(_0x7834('0x6'));var util=require(_0x7834('0x7'));var path=require(_0x7834('0x8'));var sox=require('sox');var csv=require(_0x7834('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7834('0xa'));var _=require(_0x7834('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7834('0xc'));var deskjs=require(_0x7834('0xd'));var toCsv=require(_0x7834('0x9'));var querystring=require(_0x7834('0xe'));var Papa=require(_0x7834('0xf'));var Redis=require(_0x7834('0x10'));var authService=require(_0x7834('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7834('0x12'));var hardwareService=require(_0x7834('0x13'));var logger=require('../../config/logger')(_0x7834('0x14'));var utils=require(_0x7834('0x15'));var config=require(_0x7834('0x16'));var licenseUtil=require(_0x7834('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d5ce2,_0x5a7d0d){_0x5a7d0d=_0x5a7d0d||0xcc;return function(_0x2c34dd){if(_0x2c34dd){return _0x4d5ce2[_0x7834('0x18')](_0x5a7d0d);}return _0x4d5ce2[_0x7834('0x19')](_0x5a7d0d)['end']();};}function respondWithResult(_0x42c0ab,_0x5999a1){_0x5999a1=_0x5999a1||0xc8;return function(_0x4ac447){if(_0x4ac447){return _0x42c0ab[_0x7834('0x19')](_0x5999a1)[_0x7834('0x1a')](_0x4ac447);}};}function respondWithFilteredResult(_0x40735,_0x133ffa){return function(_0x36cff7){if(_0x36cff7){var _0x4a62b7=typeof _0x133ffa['offset']==='undefined'&&typeof _0x133ffa[_0x7834('0x1b')]==='undefined';var _0x5e0898=_0x36cff7[_0x7834('0x1c')];var _0x13b31c=_0x4a62b7?0x0:_0x133ffa[_0x7834('0x1d')];var _0x527c3c=_0x4a62b7?_0x36cff7['count']:_0x133ffa['offset']+_0x133ffa['limit'];var _0x31a841;if(_0x527c3c>=_0x5e0898){_0x527c3c=_0x5e0898;_0x31a841=0xc8;}else{_0x31a841=0xce;}_0x40735[_0x7834('0x19')](_0x31a841);return _0x40735[_0x7834('0x1e')]('Content-Range',_0x13b31c+'-'+_0x527c3c+'/'+_0x5e0898)[_0x7834('0x1a')](_0x36cff7);}return null;};}function patchUpdates(_0x596c61){return function(_0x14e6ad){try{jsonpatch[_0x7834('0x1f')](_0x14e6ad,_0x596c61,!![]);}catch(_0xb079ff){return BPromise[_0x7834('0x20')](_0xb079ff);}return _0x14e6ad[_0x7834('0x21')]();};}function saveUpdates(_0x3d7935,_0x4796f7){return function(_0x24bc33){if(_0x24bc33){return _0x24bc33[_0x7834('0x22')](_0x3d7935)[_0x7834('0x23')](function(_0x1f4815){return _0x1f4815;});}return null;};}function removeEntity(_0x3fad28,_0x462bd2){return function(_0x5f0cae){if(_0x5f0cae){return _0x5f0cae[_0x7834('0x24')]()[_0x7834('0x23')](function(){_0x3fad28['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ddf5c,_0x51f1eb){return function(_0x59ae00){if(!_0x59ae00){_0x1ddf5c[_0x7834('0x18')](0x194);}return _0x59ae00;};}function handleError(_0x35a527,_0x12adb5){_0x12adb5=_0x12adb5||0x1f4;return function(_0x1e345f){logger['error'](_0x1e345f[_0x7834('0x25')]);if(_0x1e345f[_0x7834('0x26')]){delete _0x1e345f[_0x7834('0x26')];}_0x35a527[_0x7834('0x19')](_0x12adb5)[_0x7834('0x27')](_0x1e345f);};}exports['index']=function(_0x4cbe93,_0x347209){var _0x5dce97={},_0x31f23e={},_0x13f704={'count':0x0,'rows':[]};var _0x3b48c4=_[_0x7834('0x28')](db[_0x7834('0x29')][_0x7834('0x2a')],function(_0x514dae){return{'name':_0x514dae[_0x7834('0x2b')],'type':_0x514dae['type']['key']};});_0x31f23e['model']=_[_0x7834('0x28')](_0x3b48c4,_0x7834('0x26'));_0x31f23e[_0x7834('0x2c')]=_['keys'](_0x4cbe93[_0x7834('0x2c')]);_0x31f23e[_0x7834('0x2d')]=_['intersection'](_0x31f23e[_0x7834('0x2e')],_0x31f23e[_0x7834('0x2c')]);_0x5dce97[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x31f23e['model'],qs[_0x7834('0x31')](_0x4cbe93[_0x7834('0x2c')][_0x7834('0x31')]));_0x5dce97[_0x7834('0x2f')]=_0x5dce97[_0x7834('0x2f')][_0x7834('0x32')]?_0x5dce97[_0x7834('0x2f')]:_0x31f23e[_0x7834('0x2e')];if(!_0x4cbe93[_0x7834('0x2c')]['hasOwnProperty'](_0x7834('0x33'))){_0x5dce97['limit']=qs['limit'](_0x4cbe93[_0x7834('0x2c')][_0x7834('0x1b')]);_0x5dce97[_0x7834('0x1d')]=qs['offset'](_0x4cbe93['query'][_0x7834('0x1d')]);}_0x5dce97[_0x7834('0x34')]=qs[_0x7834('0x35')](_0x4cbe93[_0x7834('0x2c')][_0x7834('0x35')]);_0x5dce97[_0x7834('0x36')]=qs[_0x7834('0x2d')](_['pick'](_0x4cbe93[_0x7834('0x2c')],_0x31f23e[_0x7834('0x2d')]),_0x3b48c4);if(_0x4cbe93['query']['filter']){_0x5dce97['where']=_[_0x7834('0x37')](_0x5dce97[_0x7834('0x36')],{'$or':_[_0x7834('0x28')](_0x3b48c4,function(_0x285704){if(_0x285704[_0x7834('0x38')]!==_0x7834('0x39')){var _0x5786a3={};_0x5786a3[_0x285704[_0x7834('0x26')]]={'$like':'%'+_0x4cbe93[_0x7834('0x2c')]['filter']+'%'};return _0x5786a3;}})});}_0x5dce97=_['merge']({},_0x5dce97,_0x4cbe93[_0x7834('0x3a')]);var _0x91c2ac={'where':_0x5dce97[_0x7834('0x36')]};return db[_0x7834('0x29')][_0x7834('0x1c')](_0x91c2ac)[_0x7834('0x23')](function(_0x4d4d84){_0x13f704[_0x7834('0x1c')]=_0x4d4d84;if(_0x4cbe93[_0x7834('0x2c')][_0x7834('0x3b')]){_0x5dce97['include']=[{'all':!![]}];}return db[_0x7834('0x29')][_0x7834('0x3c')](_0x5dce97);})[_0x7834('0x23')](function(_0x2dd2ab){_0x13f704[_0x7834('0x3d')]=_0x2dd2ab;return _0x13f704;})[_0x7834('0x23')](respondWithFilteredResult(_0x347209,_0x5dce97))[_0x7834('0x3e')](handleError(_0x347209,null));};exports[_0x7834('0x3f')]=function(_0x4f47c2,_0x4e0e5b){var _0x10a9e4={'raw':![],'where':{'id':_0x4f47c2['params']['id']}},_0x243e48={};_0x243e48[_0x7834('0x2e')]=_[_0x7834('0x40')](db[_0x7834('0x29')][_0x7834('0x2a')]);_0x243e48[_0x7834('0x2c')]=_[_0x7834('0x40')](_0x4f47c2[_0x7834('0x2c')]);_0x243e48['filters']=_['intersection'](_0x243e48[_0x7834('0x2e')],_0x243e48[_0x7834('0x2c')]);_0x10a9e4[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x243e48['model'],qs['fields'](_0x4f47c2['query'][_0x7834('0x31')]));_0x10a9e4[_0x7834('0x2f')]=_0x10a9e4['attributes'][_0x7834('0x32')]?_0x10a9e4[_0x7834('0x2f')]:_0x243e48['model'];if(_0x4f47c2['query'][_0x7834('0x3b')]){_0x10a9e4[_0x7834('0x41')]=[{'all':!![]}];}_0x10a9e4=_[_0x7834('0x37')]({},_0x10a9e4,_0x4f47c2[_0x7834('0x3a')]);return db[_0x7834('0x29')]['find'](_0x10a9e4)['then'](handleEntityNotFound(_0x4e0e5b,null))['then'](respondWithResult(_0x4e0e5b,null))[_0x7834('0x3e')](handleError(_0x4e0e5b,null));};exports[_0x7834('0x42')]=function(_0x107968,_0x505775){return db[_0x7834('0x29')][_0x7834('0x42')](_0x107968[_0x7834('0x43')],{})['then'](respondWithResult(_0x505775,0xc9))[_0x7834('0x3e')](handleError(_0x505775,null));};exports[_0x7834('0x22')]=function(_0xff4998,_0x5d4e86){if(_0xff4998[_0x7834('0x43')]['id']){delete _0xff4998['body']['id'];}return db[_0x7834('0x29')][_0x7834('0x44')]({'where':{'id':_0xff4998['params']['id']}})['then'](handleEntityNotFound(_0x5d4e86,null))[_0x7834('0x23')](saveUpdates(_0xff4998[_0x7834('0x43')],null))[_0x7834('0x23')](respondWithResult(_0x5d4e86,null))['catch'](handleError(_0x5d4e86,null));};exports[_0x7834('0x24')]=function(_0x21e401,_0x1830de){return db[_0x7834('0x29')][_0x7834('0x44')]({'where':{'id':_0x21e401[_0x7834('0x45')]['id']}})['then'](handleEntityNotFound(_0x1830de,null))[_0x7834('0x23')](removeEntity(_0x1830de,null))['catch'](handleError(_0x1830de,null));};exports[_0x7834('0x46')]=function(_0x68a4a3,_0x431aa3,_0xa2250d){var _0x237525={};var _0x527821={};var _0x5575a5;var _0x3b2189;return db[_0x7834('0x29')]['findOne']({'where':{'id':_0x68a4a3[_0x7834('0x45')]['id']}})[_0x7834('0x23')](handleEntityNotFound(_0x431aa3,null))[_0x7834('0x23')](function(_0x5c5056){if(_0x5c5056){_0x5575a5=_0x5c5056;_0x527821[_0x7834('0x2e')]=_['keys'](db[_0x7834('0x47')][_0x7834('0x2a')]);_0x527821[_0x7834('0x2c')]=_[_0x7834('0x40')](_0x68a4a3[_0x7834('0x2c')]);_0x527821['filters']=_[_0x7834('0x30')](_0x527821[_0x7834('0x2e')],_0x527821[_0x7834('0x2c')]);_0x237525[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x527821[_0x7834('0x2e')],qs[_0x7834('0x31')](_0x68a4a3[_0x7834('0x2c')][_0x7834('0x31')]));_0x237525[_0x7834('0x2f')]=_0x237525[_0x7834('0x2f')][_0x7834('0x32')]?_0x237525[_0x7834('0x2f')]:_0x527821[_0x7834('0x2e')];_0x237525['order']=qs[_0x7834('0x35')](_0x68a4a3[_0x7834('0x2c')][_0x7834('0x35')]);_0x237525[_0x7834('0x36')]=qs['filters'](_[_0x7834('0x48')](_0x68a4a3[_0x7834('0x2c')],_0x527821[_0x7834('0x2d')]));if(_0x68a4a3[_0x7834('0x2c')]['filter']){_0x237525[_0x7834('0x36')]=_[_0x7834('0x37')](_0x237525['where'],{'$or':_[_0x7834('0x28')](_0x237525['attributes'],function(_0x116bf1){var _0x2eff24={};_0x2eff24[_0x116bf1]={'$like':'%'+_0x68a4a3['query'][_0x7834('0x49')]+'%'};return _0x2eff24;})});}_0x237525=_[_0x7834('0x37')]({},_0x237525,_0x68a4a3['options']);return _0x5575a5[_0x7834('0x46')](_0x237525);}})[_0x7834('0x23')](function(_0x56e508){if(_0x56e508){_0x3b2189=_0x56e508['length'];if(!_0x68a4a3[_0x7834('0x2c')]['hasOwnProperty'](_0x7834('0x33'))){_0x237525[_0x7834('0x1b')]=qs[_0x7834('0x1b')](_0x68a4a3[_0x7834('0x2c')][_0x7834('0x1b')]);_0x237525['offset']=qs[_0x7834('0x1d')](_0x68a4a3['query'][_0x7834('0x1d')]);}return _0x5575a5[_0x7834('0x46')](_0x237525);}})[_0x7834('0x23')](function(_0x100d8d){if(_0x100d8d){return _0x100d8d?{'count':_0x3b2189,'rows':_0x100d8d}:null;}})[_0x7834('0x23')](respondWithResult(_0x431aa3,null))['catch'](handleError(_0x431aa3,null));};exports[_0x7834('0x4a')]=function(_0xe0a389,_0x58e31c,_0x51917a){var _0x3d4815={};var _0x42c287={};var _0x3b45bc;var _0x209232;return db[_0x7834('0x29')][_0x7834('0x4b')]({'where':{'id':_0xe0a389[_0x7834('0x45')]['id']}})['then'](handleEntityNotFound(_0x58e31c,null))[_0x7834('0x23')](function(_0x539e27){if(_0x539e27){_0x3b45bc=_0x539e27;_0x42c287['model']=_[_0x7834('0x40')](db['FreshdeskField'][_0x7834('0x2a')]);_0x42c287['query']=_[_0x7834('0x40')](_0xe0a389[_0x7834('0x2c')]);_0x42c287[_0x7834('0x2d')]=_[_0x7834('0x30')](_0x42c287[_0x7834('0x2e')],_0x42c287['query']);_0x3d4815[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x42c287['model'],qs['fields'](_0xe0a389[_0x7834('0x2c')][_0x7834('0x31')]));_0x3d4815[_0x7834('0x2f')]=_0x3d4815[_0x7834('0x2f')][_0x7834('0x32')]?_0x3d4815[_0x7834('0x2f')]:_0x42c287['model'];_0x3d4815['order']=qs[_0x7834('0x35')](_0xe0a389[_0x7834('0x2c')]['sort']);_0x3d4815['where']=qs[_0x7834('0x2d')](_['pick'](_0xe0a389[_0x7834('0x2c')],_0x42c287[_0x7834('0x2d')]));if(_0xe0a389['query'][_0x7834('0x49')]){_0x3d4815[_0x7834('0x36')]=_[_0x7834('0x37')](_0x3d4815[_0x7834('0x36')],{'$or':_[_0x7834('0x28')](_0x3d4815[_0x7834('0x2f')],function(_0x35a763){var _0x16858d={};_0x16858d[_0x35a763]={'$like':'%'+_0xe0a389[_0x7834('0x2c')][_0x7834('0x49')]+'%'};return _0x16858d;})});}_0x3d4815=_[_0x7834('0x37')]({},_0x3d4815,_0xe0a389['options']);return _0x3b45bc[_0x7834('0x4a')](_0x3d4815);}})['then'](function(_0x3b9c72){if(_0x3b9c72){_0x209232=_0x3b9c72['length'];if(!_0xe0a389[_0x7834('0x2c')][_0x7834('0x4c')](_0x7834('0x33'))){_0x3d4815[_0x7834('0x1b')]=qs[_0x7834('0x1b')](_0xe0a389['query']['limit']);_0x3d4815[_0x7834('0x1d')]=qs[_0x7834('0x1d')](_0xe0a389[_0x7834('0x2c')][_0x7834('0x1d')]);}return _0x3b45bc[_0x7834('0x4a')](_0x3d4815);}})[_0x7834('0x23')](function(_0x58a594){if(_0x58a594){return _0x58a594?{'count':_0x209232,'rows':_0x58a594}:null;}})['then'](respondWithResult(_0x58e31c,null))[_0x7834('0x3e')](handleError(_0x58e31c,null));};exports[_0x7834('0x4d')]=function(_0x3ef4af,_0x469478,_0x47d5a1){var _0x4d57ae={};var _0x44ed5e={};var _0x5ce40e;var _0x3ac81b;return db[_0x7834('0x29')][_0x7834('0x4b')]({'where':{'id':_0x3ef4af[_0x7834('0x45')]['id']}})[_0x7834('0x23')](handleEntityNotFound(_0x469478,null))[_0x7834('0x23')](function(_0x41ceca){if(_0x41ceca){_0x5ce40e=_0x41ceca;_0x44ed5e[_0x7834('0x2e')]=_[_0x7834('0x40')](db[_0x7834('0x47')]['rawAttributes']);_0x44ed5e[_0x7834('0x2c')]=_[_0x7834('0x40')](_0x3ef4af[_0x7834('0x2c')]);_0x44ed5e[_0x7834('0x2d')]=_[_0x7834('0x30')](_0x44ed5e[_0x7834('0x2e')],_0x44ed5e['query']);_0x4d57ae[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x44ed5e[_0x7834('0x2e')],qs[_0x7834('0x31')](_0x3ef4af[_0x7834('0x2c')]['fields']));_0x4d57ae[_0x7834('0x2f')]=_0x4d57ae['attributes']['length']?_0x4d57ae[_0x7834('0x2f')]:_0x44ed5e[_0x7834('0x2e')];_0x4d57ae[_0x7834('0x34')]=qs['sort'](_0x3ef4af[_0x7834('0x2c')]['sort']);_0x4d57ae['where']=qs['filters'](_[_0x7834('0x48')](_0x3ef4af[_0x7834('0x2c')],_0x44ed5e[_0x7834('0x2d')]));if(_0x3ef4af[_0x7834('0x2c')][_0x7834('0x49')]){_0x4d57ae['where']=_['merge'](_0x4d57ae[_0x7834('0x36')],{'$or':_[_0x7834('0x28')](_0x4d57ae[_0x7834('0x2f')],function(_0x18c051){var _0x4bd547={};_0x4bd547[_0x18c051]={'$like':'%'+_0x3ef4af[_0x7834('0x2c')][_0x7834('0x49')]+'%'};return _0x4bd547;})});}_0x4d57ae=_[_0x7834('0x37')]({},_0x4d57ae,_0x3ef4af[_0x7834('0x3a')]);return _0x5ce40e[_0x7834('0x4d')](_0x4d57ae);}})[_0x7834('0x23')](function(_0x56d1e2){if(_0x56d1e2){_0x3ac81b=_0x56d1e2['length'];if(!_0x3ef4af[_0x7834('0x2c')][_0x7834('0x4c')]('nolimit')){_0x4d57ae['limit']=qs[_0x7834('0x1b')](_0x3ef4af[_0x7834('0x2c')]['limit']);_0x4d57ae[_0x7834('0x1d')]=qs[_0x7834('0x1d')](_0x3ef4af['query'][_0x7834('0x1d')]);}return _0x5ce40e[_0x7834('0x4d')](_0x4d57ae);}})['then'](function(_0x26ec1d){if(_0x26ec1d){return _0x26ec1d?{'count':_0x3ac81b,'rows':_0x26ec1d}:null;}})[_0x7834('0x23')](respondWithResult(_0x469478,null))[_0x7834('0x3e')](handleError(_0x469478,null));};exports[_0x7834('0x4e')]=function(_0xdd3dd9,_0x105512,_0x53a3fe){var _0x1dc8ee={};var _0x30ef78={};var _0x3477c7;var _0x53b50a;return db[_0x7834('0x29')][_0x7834('0x4b')]({'where':{'id':_0xdd3dd9['params']['id']}})[_0x7834('0x23')](handleEntityNotFound(_0x105512,null))[_0x7834('0x23')](function(_0x4da93a){if(_0x4da93a){_0x3477c7=_0x4da93a;_0x30ef78[_0x7834('0x2e')]=_[_0x7834('0x40')](db[_0x7834('0x4f')][_0x7834('0x2a')]);_0x30ef78['query']=_['keys'](_0xdd3dd9[_0x7834('0x2c')]);_0x30ef78[_0x7834('0x2d')]=_[_0x7834('0x30')](_0x30ef78['model'],_0x30ef78[_0x7834('0x2c')]);_0x1dc8ee[_0x7834('0x2f')]=_[_0x7834('0x30')](_0x30ef78[_0x7834('0x2e')],qs[_0x7834('0x31')](_0xdd3dd9[_0x7834('0x2c')]['fields']));_0x1dc8ee['attributes']=_0x1dc8ee[_0x7834('0x2f')][_0x7834('0x32')]?_0x1dc8ee[_0x7834('0x2f')]:_0x30ef78[_0x7834('0x2e')];_0x1dc8ee[_0x7834('0x34')]=qs[_0x7834('0x35')](_0xdd3dd9[_0x7834('0x2c')][_0x7834('0x35')]);_0x1dc8ee[_0x7834('0x36')]=qs[_0x7834('0x2d')](_['pick'](_0xdd3dd9[_0x7834('0x2c')],_0x30ef78['filters']));if(_0xdd3dd9[_0x7834('0x2c')]['filter']){_0x1dc8ee[_0x7834('0x36')]=_[_0x7834('0x37')](_0x1dc8ee[_0x7834('0x36')],{'$or':_[_0x7834('0x28')](_0x1dc8ee['attributes'],function(_0x1d835d){var _0x2097dc={};_0x2097dc[_0x1d835d]={'$like':'%'+_0xdd3dd9['query'][_0x7834('0x49')]+'%'};return _0x2097dc;})});}_0x1dc8ee=_['merge']({},_0x1dc8ee,_0xdd3dd9[_0x7834('0x3a')]);return _0x3477c7[_0x7834('0x4e')](_0x1dc8ee);}})[_0x7834('0x23')](function(_0x47a62e){if(_0x47a62e){_0x53b50a=_0x47a62e[_0x7834('0x32')];if(!_0xdd3dd9[_0x7834('0x2c')][_0x7834('0x4c')](_0x7834('0x33'))){_0x1dc8ee[_0x7834('0x1b')]=qs[_0x7834('0x1b')](_0xdd3dd9[_0x7834('0x2c')][_0x7834('0x1b')]);_0x1dc8ee[_0x7834('0x1d')]=qs[_0x7834('0x1d')](_0xdd3dd9[_0x7834('0x2c')][_0x7834('0x1d')]);}return _0x3477c7[_0x7834('0x4e')](_0x1dc8ee);}})[_0x7834('0x23')](function(_0x549999){if(_0x549999){return _0x549999?{'count':_0x53b50a,'rows':_0x549999}:null;}})[_0x7834('0x23')](respondWithResult(_0x105512,null))[_0x7834('0x3e')](handleError(_0x105512,null));};exports[_0x7834('0x50')]=function(_0xf78bd4,_0x2e53e1,_0x42153c){if(_0xf78bd4[_0x7834('0x43')]['id']){delete _0xf78bd4[_0x7834('0x43')]['id'];}return db[_0x7834('0x29')]['findOne']({'where':{'id':_0xf78bd4[_0x7834('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e53e1,null))['then'](function(_0x260d1){if(_0x260d1){return _0x260d1[_0x7834('0x50')](_0xf78bd4[_0x7834('0x43')][_0x7834('0x51')]||[]);}return null;})[_0x7834('0x23')](respondWithResult(_0x2e53e1,null))[_0x7834('0x3e')](handleError(_0x2e53e1,null));}; \ No newline at end of file +var _0x767b=['apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','FreshdeskConfiguration','count','includeAll','findAll','rows','catch','find','create','body','params','FreshdeskField','length','order','getFields','hasOwnProperty','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range'];(function(_0xb51497,_0x2de1ae){var _0x21725e=function(_0x220028){while(--_0x220028){_0xb51497['push'](_0xb51497['shift']());}};_0x21725e(++_0x2de1ae);}(_0x767b,0xd9));var _0xb767=function(_0x1382be,_0x49bc15){_0x1382be=_0x1382be-0x0;var _0x1cdb85=_0x767b[_0x1382be];return _0x1cdb85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb767('0x0'));var zipdir=require(_0xb767('0x1'));var jsonpatch=require(_0xb767('0x2'));var rp=require(_0xb767('0x3'));var moment=require(_0xb767('0x4'));var BPromise=require(_0xb767('0x5'));var Mustache=require(_0xb767('0x6'));var util=require(_0xb767('0x7'));var path=require(_0xb767('0x8'));var sox=require(_0xb767('0x9'));var csv=require('to-csv');var ejs=require(_0xb767('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb767('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb767('0xc'));var querystring=require(_0xb767('0xd'));var Papa=require(_0xb767('0xe'));var Redis=require(_0xb767('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb767('0x10'));var hardwareService=require(_0xb767('0x11'));var logger=require('../../config/logger')(_0xb767('0x12'));var utils=require(_0xb767('0x13'));var config=require(_0xb767('0x14'));var licenseUtil=require(_0xb767('0x15'));var db=require(_0xb767('0x16'))['db'];function respondWithStatusCode(_0x4e4fb7,_0x4ad54d){_0x4ad54d=_0x4ad54d||0xcc;return function(_0x1da85d){if(_0x1da85d){return _0x4e4fb7[_0xb767('0x17')](_0x4ad54d);}return _0x4e4fb7[_0xb767('0x18')](_0x4ad54d)[_0xb767('0x19')]();};}function respondWithResult(_0x5a8fd5,_0x4869ed){_0x4869ed=_0x4869ed||0xc8;return function(_0x5b710e){if(_0x5b710e){return _0x5a8fd5[_0xb767('0x18')](_0x4869ed)[_0xb767('0x1a')](_0x5b710e);}};}function respondWithFilteredResult(_0x21ce76,_0x349d40){return function(_0xbbcf7a){if(_0xbbcf7a){var _0x1565d2=typeof _0x349d40[_0xb767('0x1b')]===_0xb767('0x1c')&&typeof _0x349d40[_0xb767('0x1d')]===_0xb767('0x1c');var _0x5db744=_0xbbcf7a['count'];var _0x3b0d3a=_0x1565d2?0x0:_0x349d40[_0xb767('0x1b')];var _0x1faff5=_0x1565d2?_0xbbcf7a['count']:_0x349d40[_0xb767('0x1b')]+_0x349d40[_0xb767('0x1d')];var _0x5ed44d;if(_0x1faff5>=_0x5db744){_0x1faff5=_0x5db744;_0x5ed44d=0xc8;}else{_0x5ed44d=0xce;}_0x21ce76[_0xb767('0x18')](_0x5ed44d);return _0x21ce76[_0xb767('0x1e')](_0xb767('0x1f'),_0x3b0d3a+'-'+_0x1faff5+'/'+_0x5db744)[_0xb767('0x1a')](_0xbbcf7a);}return null;};}function patchUpdates(_0xe63d90){return function(_0x4fb21d){try{jsonpatch[_0xb767('0x20')](_0x4fb21d,_0xe63d90,!![]);}catch(_0xdf05b1){return BPromise['reject'](_0xdf05b1);}return _0x4fb21d[_0xb767('0x21')]();};}function saveUpdates(_0xd71618,_0x1822c7){return function(_0x360137){if(_0x360137){return _0x360137[_0xb767('0x22')](_0xd71618)[_0xb767('0x23')](function(_0x5404f1){return _0x5404f1;});}return null;};}function removeEntity(_0xd0544c,_0x59ca7b){return function(_0x3eebcb){if(_0x3eebcb){return _0x3eebcb[_0xb767('0x24')]()['then'](function(){_0xd0544c[_0xb767('0x18')](0xcc)[_0xb767('0x19')]();});}};}function handleEntityNotFound(_0x47bcf5,_0x49f7ab){return function(_0x37b1fc){if(!_0x37b1fc){_0x47bcf5[_0xb767('0x17')](0x194);}return _0x37b1fc;};}function handleError(_0x53b0da,_0x4843ed){_0x4843ed=_0x4843ed||0x1f4;return function(_0x1b6c5e){logger[_0xb767('0x25')](_0x1b6c5e[_0xb767('0x26')]);if(_0x1b6c5e[_0xb767('0x27')]){delete _0x1b6c5e[_0xb767('0x27')];}_0x53b0da['status'](_0x4843ed)[_0xb767('0x28')](_0x1b6c5e);};}exports[_0xb767('0x29')]=function(_0x3ca88f,_0x332fc8){var _0x169652={},_0xc70de9={},_0x29e6ac={'count':0x0,'rows':[]};var _0x42c7b3=_[_0xb767('0x2a')](db['FreshdeskConfiguration'][_0xb767('0x2b')],function(_0x1b0ddb){return{'name':_0x1b0ddb[_0xb767('0x2c')],'type':_0x1b0ddb[_0xb767('0x2d')][_0xb767('0x2e')]};});_0xc70de9[_0xb767('0x2f')]=_[_0xb767('0x2a')](_0x42c7b3,_0xb767('0x27'));_0xc70de9['query']=_[_0xb767('0x30')](_0x3ca88f[_0xb767('0x31')]);_0xc70de9[_0xb767('0x32')]=_[_0xb767('0x33')](_0xc70de9[_0xb767('0x2f')],_0xc70de9[_0xb767('0x31')]);_0x169652[_0xb767('0x34')]=_[_0xb767('0x33')](_0xc70de9[_0xb767('0x2f')],qs[_0xb767('0x35')](_0x3ca88f[_0xb767('0x31')][_0xb767('0x35')]));_0x169652[_0xb767('0x34')]=_0x169652[_0xb767('0x34')]['length']?_0x169652[_0xb767('0x34')]:_0xc70de9['model'];if(!_0x3ca88f['query']['hasOwnProperty'](_0xb767('0x36'))){_0x169652['limit']=qs[_0xb767('0x1d')](_0x3ca88f[_0xb767('0x31')]['limit']);_0x169652[_0xb767('0x1b')]=qs[_0xb767('0x1b')](_0x3ca88f[_0xb767('0x31')]['offset']);}_0x169652['order']=qs[_0xb767('0x37')](_0x3ca88f[_0xb767('0x31')]['sort']);_0x169652[_0xb767('0x38')]=qs[_0xb767('0x32')](_[_0xb767('0x39')](_0x3ca88f[_0xb767('0x31')],_0xc70de9[_0xb767('0x32')]),_0x42c7b3);if(_0x3ca88f[_0xb767('0x31')][_0xb767('0x3a')]){_0x169652[_0xb767('0x38')]=_[_0xb767('0x3b')](_0x169652[_0xb767('0x38')],{'$or':_[_0xb767('0x2a')](_0x42c7b3,function(_0x2f85e1){if(_0x2f85e1['type']!=='VIRTUAL'){var _0x380c2f={};_0x380c2f[_0x2f85e1[_0xb767('0x27')]]={'$like':'%'+_0x3ca88f[_0xb767('0x31')][_0xb767('0x3a')]+'%'};return _0x380c2f;}})});}_0x169652=_[_0xb767('0x3b')]({},_0x169652,_0x3ca88f[_0xb767('0x3c')]);var _0x4016e5={'where':_0x169652['where']};return db[_0xb767('0x3d')][_0xb767('0x3e')](_0x4016e5)[_0xb767('0x23')](function(_0x443491){_0x29e6ac[_0xb767('0x3e')]=_0x443491;if(_0x3ca88f[_0xb767('0x31')][_0xb767('0x3f')]){_0x169652['include']=[{'all':!![]}];}return db[_0xb767('0x3d')][_0xb767('0x40')](_0x169652);})[_0xb767('0x23')](function(_0x4773cb){_0x29e6ac[_0xb767('0x41')]=_0x4773cb;return _0x29e6ac;})[_0xb767('0x23')](respondWithFilteredResult(_0x332fc8,_0x169652))[_0xb767('0x42')](handleError(_0x332fc8,null));};exports['show']=function(_0x4514d9,_0x2f24df){var _0x4c8d9b={'raw':![],'where':{'id':_0x4514d9['params']['id']}},_0x269001={};_0x269001[_0xb767('0x2f')]=_[_0xb767('0x30')](db[_0xb767('0x3d')][_0xb767('0x2b')]);_0x269001[_0xb767('0x31')]=_[_0xb767('0x30')](_0x4514d9[_0xb767('0x31')]);_0x269001[_0xb767('0x32')]=_[_0xb767('0x33')](_0x269001[_0xb767('0x2f')],_0x269001[_0xb767('0x31')]);_0x4c8d9b[_0xb767('0x34')]=_[_0xb767('0x33')](_0x269001[_0xb767('0x2f')],qs[_0xb767('0x35')](_0x4514d9['query']['fields']));_0x4c8d9b[_0xb767('0x34')]=_0x4c8d9b[_0xb767('0x34')]['length']?_0x4c8d9b['attributes']:_0x269001[_0xb767('0x2f')];if(_0x4514d9[_0xb767('0x31')][_0xb767('0x3f')]){_0x4c8d9b['include']=[{'all':!![]}];}_0x4c8d9b=_['merge']({},_0x4c8d9b,_0x4514d9[_0xb767('0x3c')]);return db[_0xb767('0x3d')][_0xb767('0x43')](_0x4c8d9b)[_0xb767('0x23')](handleEntityNotFound(_0x2f24df,null))[_0xb767('0x23')](respondWithResult(_0x2f24df,null))['catch'](handleError(_0x2f24df,null));};exports[_0xb767('0x44')]=function(_0x519b09,_0xfe845f){return db['FreshdeskConfiguration'][_0xb767('0x44')](_0x519b09[_0xb767('0x45')],{})['then'](respondWithResult(_0xfe845f,0xc9))[_0xb767('0x42')](handleError(_0xfe845f,null));};exports[_0xb767('0x22')]=function(_0x2daf17,_0x4a0e8c){if(_0x2daf17[_0xb767('0x45')]['id']){delete _0x2daf17[_0xb767('0x45')]['id'];}return db['FreshdeskConfiguration'][_0xb767('0x43')]({'where':{'id':_0x2daf17[_0xb767('0x46')]['id']}})[_0xb767('0x23')](handleEntityNotFound(_0x4a0e8c,null))['then'](saveUpdates(_0x2daf17['body'],null))[_0xb767('0x23')](respondWithResult(_0x4a0e8c,null))[_0xb767('0x42')](handleError(_0x4a0e8c,null));};exports[_0xb767('0x24')]=function(_0x2db81d,_0x235e31){return db[_0xb767('0x3d')][_0xb767('0x43')]({'where':{'id':_0x2db81d['params']['id']}})['then'](handleEntityNotFound(_0x235e31,null))[_0xb767('0x23')](removeEntity(_0x235e31,null))[_0xb767('0x42')](handleError(_0x235e31,null));};exports['getFields']=function(_0x5c4c2b,_0x4d1c1a,_0x1a9d3e){var _0x4eb856={};var _0x4a23ce={};var _0x49c565;var _0x136ffc;return db[_0xb767('0x3d')]['findOne']({'where':{'id':_0x5c4c2b[_0xb767('0x46')]['id']}})[_0xb767('0x23')](handleEntityNotFound(_0x4d1c1a,null))['then'](function(_0x492c08){if(_0x492c08){_0x49c565=_0x492c08;_0x4a23ce[_0xb767('0x2f')]=_[_0xb767('0x30')](db[_0xb767('0x47')]['rawAttributes']);_0x4a23ce['query']=_['keys'](_0x5c4c2b[_0xb767('0x31')]);_0x4a23ce['filters']=_[_0xb767('0x33')](_0x4a23ce[_0xb767('0x2f')],_0x4a23ce['query']);_0x4eb856[_0xb767('0x34')]=_[_0xb767('0x33')](_0x4a23ce[_0xb767('0x2f')],qs[_0xb767('0x35')](_0x5c4c2b[_0xb767('0x31')][_0xb767('0x35')]));_0x4eb856[_0xb767('0x34')]=_0x4eb856[_0xb767('0x34')][_0xb767('0x48')]?_0x4eb856[_0xb767('0x34')]:_0x4a23ce[_0xb767('0x2f')];_0x4eb856[_0xb767('0x49')]=qs[_0xb767('0x37')](_0x5c4c2b[_0xb767('0x31')][_0xb767('0x37')]);_0x4eb856[_0xb767('0x38')]=qs['filters'](_[_0xb767('0x39')](_0x5c4c2b[_0xb767('0x31')],_0x4a23ce['filters']));if(_0x5c4c2b[_0xb767('0x31')][_0xb767('0x3a')]){_0x4eb856[_0xb767('0x38')]=_[_0xb767('0x3b')](_0x4eb856[_0xb767('0x38')],{'$or':_['map'](_0x4eb856['attributes'],function(_0x58ae1f){var _0x218ddc={};_0x218ddc[_0x58ae1f]={'$like':'%'+_0x5c4c2b[_0xb767('0x31')][_0xb767('0x3a')]+'%'};return _0x218ddc;})});}_0x4eb856=_[_0xb767('0x3b')]({},_0x4eb856,_0x5c4c2b['options']);return _0x49c565[_0xb767('0x4a')](_0x4eb856);}})[_0xb767('0x23')](function(_0x3671a0){if(_0x3671a0){_0x136ffc=_0x3671a0['length'];if(!_0x5c4c2b[_0xb767('0x31')][_0xb767('0x4b')]('nolimit')){_0x4eb856[_0xb767('0x1d')]=qs[_0xb767('0x1d')](_0x5c4c2b[_0xb767('0x31')][_0xb767('0x1d')]);_0x4eb856[_0xb767('0x1b')]=qs[_0xb767('0x1b')](_0x5c4c2b[_0xb767('0x31')]['offset']);}return _0x49c565[_0xb767('0x4a')](_0x4eb856);}})[_0xb767('0x23')](function(_0x49c81e){if(_0x49c81e){return _0x49c81e?{'count':_0x136ffc,'rows':_0x49c81e}:null;}})[_0xb767('0x23')](respondWithResult(_0x4d1c1a,null))[_0xb767('0x42')](handleError(_0x4d1c1a,null));};exports[_0xb767('0x4c')]=function(_0x5b5f29,_0x3c7670,_0x44d018){var _0x4077c4={};var _0x22d7d3={};var _0x59e83f;var _0x1e8a16;return db[_0xb767('0x3d')]['findOne']({'where':{'id':_0x5b5f29[_0xb767('0x46')]['id']}})[_0xb767('0x23')](handleEntityNotFound(_0x3c7670,null))[_0xb767('0x23')](function(_0x3e1010){if(_0x3e1010){_0x59e83f=_0x3e1010;_0x22d7d3[_0xb767('0x2f')]=_[_0xb767('0x30')](db[_0xb767('0x47')][_0xb767('0x2b')]);_0x22d7d3['query']=_[_0xb767('0x30')](_0x5b5f29[_0xb767('0x31')]);_0x22d7d3['filters']=_[_0xb767('0x33')](_0x22d7d3[_0xb767('0x2f')],_0x22d7d3['query']);_0x4077c4[_0xb767('0x34')]=_['intersection'](_0x22d7d3[_0xb767('0x2f')],qs[_0xb767('0x35')](_0x5b5f29[_0xb767('0x31')][_0xb767('0x35')]));_0x4077c4[_0xb767('0x34')]=_0x4077c4[_0xb767('0x34')][_0xb767('0x48')]?_0x4077c4[_0xb767('0x34')]:_0x22d7d3['model'];_0x4077c4['order']=qs[_0xb767('0x37')](_0x5b5f29['query']['sort']);_0x4077c4[_0xb767('0x38')]=qs[_0xb767('0x32')](_[_0xb767('0x39')](_0x5b5f29[_0xb767('0x31')],_0x22d7d3[_0xb767('0x32')]));if(_0x5b5f29[_0xb767('0x31')][_0xb767('0x3a')]){_0x4077c4[_0xb767('0x38')]=_[_0xb767('0x3b')](_0x4077c4[_0xb767('0x38')],{'$or':_[_0xb767('0x2a')](_0x4077c4[_0xb767('0x34')],function(_0x47d410){var _0x11ad3c={};_0x11ad3c[_0x47d410]={'$like':'%'+_0x5b5f29[_0xb767('0x31')][_0xb767('0x3a')]+'%'};return _0x11ad3c;})});}_0x4077c4=_['merge']({},_0x4077c4,_0x5b5f29[_0xb767('0x3c')]);return _0x59e83f[_0xb767('0x4c')](_0x4077c4);}})['then'](function(_0x2be7ab){if(_0x2be7ab){_0x1e8a16=_0x2be7ab[_0xb767('0x48')];if(!_0x5b5f29[_0xb767('0x31')]['hasOwnProperty'](_0xb767('0x36'))){_0x4077c4[_0xb767('0x1d')]=qs[_0xb767('0x1d')](_0x5b5f29[_0xb767('0x31')][_0xb767('0x1d')]);_0x4077c4[_0xb767('0x1b')]=qs['offset'](_0x5b5f29[_0xb767('0x31')][_0xb767('0x1b')]);}return _0x59e83f['getSubjects'](_0x4077c4);}})[_0xb767('0x23')](function(_0x2915a4){if(_0x2915a4){return _0x2915a4?{'count':_0x1e8a16,'rows':_0x2915a4}:null;}})[_0xb767('0x23')](respondWithResult(_0x3c7670,null))[_0xb767('0x42')](handleError(_0x3c7670,null));};exports[_0xb767('0x4d')]=function(_0x3ae218,_0x4c8970,_0x2e1502){var _0x3d18f3={};var _0x5145bc={};var _0x417345;var _0x5489ae;return db[_0xb767('0x3d')][_0xb767('0x4e')]({'where':{'id':_0x3ae218[_0xb767('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c8970,null))[_0xb767('0x23')](function(_0x1b6f13){if(_0x1b6f13){_0x417345=_0x1b6f13;_0x5145bc[_0xb767('0x2f')]=_['keys'](db[_0xb767('0x47')]['rawAttributes']);_0x5145bc['query']=_[_0xb767('0x30')](_0x3ae218[_0xb767('0x31')]);_0x5145bc[_0xb767('0x32')]=_[_0xb767('0x33')](_0x5145bc[_0xb767('0x2f')],_0x5145bc[_0xb767('0x31')]);_0x3d18f3[_0xb767('0x34')]=_['intersection'](_0x5145bc[_0xb767('0x2f')],qs['fields'](_0x3ae218['query'][_0xb767('0x35')]));_0x3d18f3[_0xb767('0x34')]=_0x3d18f3[_0xb767('0x34')][_0xb767('0x48')]?_0x3d18f3[_0xb767('0x34')]:_0x5145bc[_0xb767('0x2f')];_0x3d18f3[_0xb767('0x49')]=qs['sort'](_0x3ae218[_0xb767('0x31')]['sort']);_0x3d18f3['where']=qs[_0xb767('0x32')](_[_0xb767('0x39')](_0x3ae218[_0xb767('0x31')],_0x5145bc[_0xb767('0x32')]));if(_0x3ae218['query'][_0xb767('0x3a')]){_0x3d18f3['where']=_[_0xb767('0x3b')](_0x3d18f3[_0xb767('0x38')],{'$or':_['map'](_0x3d18f3['attributes'],function(_0x4d8d33){var _0x17fb62={};_0x17fb62[_0x4d8d33]={'$like':'%'+_0x3ae218[_0xb767('0x31')]['filter']+'%'};return _0x17fb62;})});}_0x3d18f3=_[_0xb767('0x3b')]({},_0x3d18f3,_0x3ae218[_0xb767('0x3c')]);return _0x417345[_0xb767('0x4d')](_0x3d18f3);}})[_0xb767('0x23')](function(_0x134ae0){if(_0x134ae0){_0x5489ae=_0x134ae0['length'];if(!_0x3ae218[_0xb767('0x31')][_0xb767('0x4b')](_0xb767('0x36'))){_0x3d18f3['limit']=qs[_0xb767('0x1d')](_0x3ae218[_0xb767('0x31')]['limit']);_0x3d18f3[_0xb767('0x1b')]=qs[_0xb767('0x1b')](_0x3ae218[_0xb767('0x31')][_0xb767('0x1b')]);}return _0x417345[_0xb767('0x4d')](_0x3d18f3);}})[_0xb767('0x23')](function(_0x4a0a86){if(_0x4a0a86){return _0x4a0a86?{'count':_0x5489ae,'rows':_0x4a0a86}:null;}})[_0xb767('0x23')](respondWithResult(_0x4c8970,null))[_0xb767('0x42')](handleError(_0x4c8970,null));};exports[_0xb767('0x4f')]=function(_0x393176,_0x5b37a2,_0x5787fa){var _0x31d382={};var _0x887e26={};var _0x11b3ac;var _0x31a55b;return db[_0xb767('0x3d')]['findOne']({'where':{'id':_0x393176[_0xb767('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b37a2,null))[_0xb767('0x23')](function(_0x4678e2){if(_0x4678e2){_0x11b3ac=_0x4678e2;_0x887e26['model']=_['keys'](db[_0xb767('0x50')][_0xb767('0x2b')]);_0x887e26[_0xb767('0x31')]=_[_0xb767('0x30')](_0x393176[_0xb767('0x31')]);_0x887e26[_0xb767('0x32')]=_[_0xb767('0x33')](_0x887e26[_0xb767('0x2f')],_0x887e26[_0xb767('0x31')]);_0x31d382[_0xb767('0x34')]=_[_0xb767('0x33')](_0x887e26[_0xb767('0x2f')],qs['fields'](_0x393176['query'][_0xb767('0x35')]));_0x31d382['attributes']=_0x31d382[_0xb767('0x34')][_0xb767('0x48')]?_0x31d382['attributes']:_0x887e26['model'];_0x31d382['order']=qs['sort'](_0x393176[_0xb767('0x31')][_0xb767('0x37')]);_0x31d382['where']=qs[_0xb767('0x32')](_[_0xb767('0x39')](_0x393176[_0xb767('0x31')],_0x887e26[_0xb767('0x32')]));if(_0x393176[_0xb767('0x31')]['filter']){_0x31d382[_0xb767('0x38')]=_[_0xb767('0x3b')](_0x31d382[_0xb767('0x38')],{'$or':_['map'](_0x31d382[_0xb767('0x34')],function(_0x29f5af){var _0x4d8f30={};_0x4d8f30[_0x29f5af]={'$like':'%'+_0x393176[_0xb767('0x31')][_0xb767('0x3a')]+'%'};return _0x4d8f30;})});}_0x31d382=_['merge']({},_0x31d382,_0x393176[_0xb767('0x3c')]);return _0x11b3ac[_0xb767('0x4f')](_0x31d382);}})['then'](function(_0x373697){if(_0x373697){_0x31a55b=_0x373697['length'];if(!_0x393176[_0xb767('0x31')][_0xb767('0x4b')](_0xb767('0x36'))){_0x31d382['limit']=qs[_0xb767('0x1d')](_0x393176[_0xb767('0x31')][_0xb767('0x1d')]);_0x31d382[_0xb767('0x1b')]=qs['offset'](_0x393176[_0xb767('0x31')][_0xb767('0x1b')]);}return _0x11b3ac[_0xb767('0x4f')](_0x31d382);}})['then'](function(_0x2a98ba){if(_0x2a98ba){return _0x2a98ba?{'count':_0x31a55b,'rows':_0x2a98ba}:null;}})[_0xb767('0x23')](respondWithResult(_0x5b37a2,null))['catch'](handleError(_0x5b37a2,null));};exports[_0xb767('0x51')]=function(_0x568153,_0x465968,_0xea6d15){if(_0x568153['body']['id']){delete _0x568153[_0xb767('0x45')]['id'];}return db[_0xb767('0x3d')][_0xb767('0x4e')]({'where':{'id':_0x568153['params']['id']}})[_0xb767('0x23')](handleEntityNotFound(_0x465968,null))[_0xb767('0x23')](function(_0x2f4a78){if(_0x2f4a78){return _0x2f4a78[_0xb767('0x51')](_0x568153[_0xb767('0x45')][_0xb767('0x52')]||[]);}return null;})['then'](respondWithResult(_0x465968,null))[_0xb767('0x42')](handleError(_0x465968,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2bcf6b8..49a3bcc 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 _0x75ec=['exports','define','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x16168a,_0x47974c){var _0x35316d=function(_0x3ad457){while(--_0x3ad457){_0x16168a['push'](_0x16168a['shift']());}};_0x35316d(++_0x47974c);}(_0x75ec,0x1a6));var _0xc75e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x75ec[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0xc75e('0x0'));var logger=require(_0xc75e('0x1'))(_0xc75e('0x2'));var moment=require('moment');var BPromise=require(_0xc75e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc75e('0x4'));var rimraf=require(_0xc75e('0x5'));var config=require(_0xc75e('0x6'));var attributes=require(_0xc75e('0x7'));module[_0xc75e('0x8')]=function(_0x1d1f36,_0x369abf){return _0x1d1f36[_0xc75e('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe578=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x1315cc,_0x1d34f0){var _0x59c55d=function(_0x3e6481){while(--_0x3e6481){_0x1315cc['push'](_0x1315cc['shift']());}};_0x59c55d(++_0x1d34f0);}(_0xe578,0x78));var _0x8e57=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe578[_0x432682];return _0x463d05;};'use strict';var _=require(_0x8e57('0x0'));var util=require(_0x8e57('0x1'));var logger=require(_0x8e57('0x2'))(_0x8e57('0x3'));var moment=require(_0x8e57('0x4'));var BPromise=require(_0x8e57('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e57('0x6'));var rimraf=require('rimraf');var config=require(_0x8e57('0x7'));var attributes=require(_0x8e57('0x8'));module[_0x8e57('0x9')]=function(_0x3a76a7,_0x4e6734){return _0x3a76a7[_0x8e57('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x8e57('0xb'),'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 3cc5850..2253edd 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 _0x319a=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x319a,0xcd));var _0xa319=function(_0x2bcbf8,_0x5dcc40){_0x2bcbf8=_0x2bcbf8-0x0;var _0x1bfb1f=_0x319a[_0x2bcbf8];return _0x1bfb1f;};'use strict';var _=require(_0xa319('0x0'));var util=require(_0xa319('0x1'));var moment=require(_0xa319('0x2'));var BPromise=require(_0xa319('0x3'));var rs=require(_0xa319('0x4'));var fs=require('fs');var Redis=require(_0xa319('0x5'));var db=require(_0xa319('0x6'))['db'];var utils=require(_0xa319('0x7'));var logger=require('../../config/logger')(_0xa319('0x8'));var config=require(_0xa319('0x9'));var jayson=require(_0xa319('0xa'));var client=jayson[_0xa319('0xb')][_0xa319('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a25bb,_0xb32b75,_0x551a1a){return new BPromise(function(_0x5eeba3,_0x4f7c96){return client['request'](_0x5a25bb,_0x551a1a)[_0xa319('0xd')](function(_0x4989ea){logger[_0xa319('0xe')](_0xa319('0xf'),_0xb32b75,_0xa319('0x10'));logger[_0xa319('0x11')](_0xa319('0x12'),_0xb32b75,_0xa319('0x10'),JSON[_0xa319('0x13')](_0x4989ea));if(_0x4989ea['error']){if(_0x4989ea[_0xa319('0x14')][_0xa319('0x15')]===0x1f4){logger['error'](_0xa319('0xf'),_0xb32b75,_0x4989ea[_0xa319('0x14')][_0xa319('0x16')]);return _0x4f7c96(_0x4989ea['error'][_0xa319('0x16')]);}logger[_0xa319('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xb32b75,_0x4989ea[_0xa319('0x14')][_0xa319('0x16')]);return _0x5eeba3(_0x4989ea[_0xa319('0x14')][_0xa319('0x16')]);}else{logger[_0xa319('0xe')](_0xa319('0xf'),_0xb32b75,_0xa319('0x10'));_0x5eeba3(_0x4989ea[_0xa319('0x17')][_0xa319('0x16')]);}})[_0xa319('0x18')](function(_0x5610a1){logger[_0xa319('0x14')](_0xa319('0xf'),_0xb32b75,_0x5610a1);_0x4f7c96(_0x5610a1);});});} \ No newline at end of file +var _0x9e2a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x58c7f7,_0xcd5b2a){var _0x7c8e46=function(_0x29d9f3){while(--_0x29d9f3){_0x58c7f7['push'](_0x58c7f7['shift']());}};_0x7c8e46(++_0xcd5b2a);}(_0x9e2a,0xbc));var _0xa9e2=function(_0x4f8581,_0x4953c0){_0x4f8581=_0x4f8581-0x0;var _0x62aafb=_0x9e2a[_0x4f8581];return _0x62aafb;};'use strict';var _=require(_0xa9e2('0x0'));var util=require(_0xa9e2('0x1'));var moment=require(_0xa9e2('0x2'));var BPromise=require('bluebird');var rs=require(_0xa9e2('0x3'));var fs=require('fs');var Redis=require(_0xa9e2('0x4'));var db=require(_0xa9e2('0x5'))['db'];var utils=require(_0xa9e2('0x6'));var logger=require(_0xa9e2('0x7'))(_0xa9e2('0x8'));var config=require('../../config/environment');var jayson=require(_0xa9e2('0x9'));var client=jayson[_0xa9e2('0xa')][_0xa9e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45eeb6,_0x201704,_0x312e1f){return new BPromise(function(_0x5279bf,_0x2abb41){return client[_0xa9e2('0xc')](_0x45eeb6,_0x312e1f)[_0xa9e2('0xd')](function(_0x518304){logger[_0xa9e2('0xe')](_0xa9e2('0xf'),_0x201704,_0xa9e2('0x10'));logger[_0xa9e2('0x11')](_0xa9e2('0x12'),_0x201704,_0xa9e2('0x10'),JSON[_0xa9e2('0x13')](_0x518304));if(_0x518304[_0xa9e2('0x14')]){if(_0x518304[_0xa9e2('0x14')]['code']===0x1f4){logger[_0xa9e2('0x14')](_0xa9e2('0xf'),_0x201704,_0x518304[_0xa9e2('0x14')]['message']);return _0x2abb41(_0x518304['error'][_0xa9e2('0x15')]);}logger[_0xa9e2('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x201704,_0x518304[_0xa9e2('0x14')][_0xa9e2('0x15')]);return _0x5279bf(_0x518304[_0xa9e2('0x14')][_0xa9e2('0x15')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x201704,_0xa9e2('0x10'));_0x5279bf(_0x518304[_0xa9e2('0x16')][_0xa9e2('0x15')]);}})[_0xa9e2('0x17')](function(_0x12e69e){logger[_0xa9e2('0x14')](_0xa9e2('0xf'),_0x201704,_0x12e69e);_0x2abb41(_0x12e69e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7177700..9d159ab 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 _0xd291=['update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','index','/:id','show','isAuthenticated','create','put'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd291,0x1b3));var _0x1d29=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd291[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1d29('0x0'));var util=require(_0x1d29('0x1'));var path=require('path');var timeout=require(_0x1d29('0x2'));var express=require('express');var router=express[_0x1d29('0x3')]();var fs_extra=require(_0x1d29('0x4'));var auth=require(_0x1d29('0x5'));var interaction=require(_0x1d29('0x6'));var config=require('../../config/environment');var controller=require(_0x1d29('0x7'));router[_0x1d29('0x8')]('/',auth['isAuthenticated'](),controller[_0x1d29('0x9')]);router[_0x1d29('0x8')](_0x1d29('0xa'),auth['isAuthenticated'](),controller[_0x1d29('0xb')]);router['post']('/',auth[_0x1d29('0xc')](),controller[_0x1d29('0xd')]);router[_0x1d29('0xe')](_0x1d29('0xa'),auth[_0x1d29('0xc')](),controller[_0x1d29('0xf')]);router[_0x1d29('0x10')](_0x1d29('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1d29('0x11')]=router; \ No newline at end of file +var _0xa798=['../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','create','/:id','update','exports','path','connect-timeout','express','Router'];(function(_0x14e302,_0x1bd716){var _0x5197a0=function(_0x2b771e){while(--_0x2b771e){_0x14e302['push'](_0x14e302['shift']());}};_0x5197a0(++_0x1bd716);}(_0xa798,0x1cd));var _0x8a79=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xa798[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8a79('0x0'));var timeout=require(_0x8a79('0x1'));var express=require(_0x8a79('0x2'));var router=express[_0x8a79('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8a79('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8a79('0x5'));var controller=require(_0x8a79('0x6'));router[_0x8a79('0x7')]('/',auth[_0x8a79('0x8')](),controller[_0x8a79('0x9')]);router[_0x8a79('0x7')]('/:id',auth[_0x8a79('0x8')](),controller[_0x8a79('0xa')]);router['post']('/',auth[_0x8a79('0x8')](),controller[_0x8a79('0xb')]);router['put'](_0x8a79('0xc'),auth['isAuthenticated'](),controller[_0x8a79('0xd')]);router['delete'](_0x8a79('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x8a79('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 81ff934..307315f 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 _0x225e=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','exports'];(function(_0xfd1170,_0x335b0c){var _0x283a66=function(_0x4b2bc6){while(--_0x4b2bc6){_0xfd1170['push'](_0xfd1170['shift']());}};_0x283a66(++_0x335b0c);}(_0x225e,0x1af));var _0xe225=function(_0x4e5906,_0x268b6f){_0x4e5906=_0x4e5906-0x0;var _0x5ebc07=_0x225e[_0x4e5906];return _0x5ebc07;};'use strict';var Sequelize=require('sequelize');module[_0xe225('0x0')]={'type':{'type':Sequelize[_0xe225('0x1')](_0xe225('0x2'),_0xe225('0x3'),_0xe225('0x4'),_0xe225('0x5'),_0xe225('0x6')),'defaultValue':_0xe225('0x2')},'content':{'type':Sequelize[_0xe225('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe225('0x1')](_0xe225('0x2'),_0xe225('0x3'),_0xe225('0x4'))},'keyContent':{'type':Sequelize[_0xe225('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe225('0x7')]}}; \ No newline at end of file +var _0x58e0=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x58e0,0x178));var _0x058e=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x58e0[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0x058e('0x0'));module['exports']={'type':{'type':Sequelize[_0x058e('0x1')](_0x058e('0x2'),'variable',_0x058e('0x3'),_0x058e('0x4'),_0x058e('0x5')),'defaultValue':_0x058e('0x2')},'content':{'type':Sequelize[_0x058e('0x6')]},'key':{'type':Sequelize[_0x058e('0x6')]},'keyType':{'type':Sequelize[_0x058e('0x1')](_0x058e('0x2'),_0x058e('0x7'),_0x058e('0x3'))},'keyContent':{'type':Sequelize[_0x058e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x058e('0x6')]},'customField':{'type':Sequelize[_0x058e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x058e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 7eeb02a..00c9c5c 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 _0x70e0=['nolimit','order','sort','where','filters','filter','merge','options','include','rows','catch','show','rawAttributes','length','find','create','body','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','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty'];(function(_0x274f6f,_0x541c09){var _0x66fe2=function(_0x4aa452){while(--_0x4aa452){_0x274f6f['push'](_0x274f6f['shift']());}};_0x66fe2(++_0x541c09);}(_0x70e0,0x17b));var _0x070e=function(_0x2423c9,_0x1e095d){_0x2423c9=_0x2423c9-0x0;var _0x4db8c5=_0x70e0[_0x2423c9];return _0x4db8c5;};'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={},_0x26373b={},_0x5e8326={'count':0x0,'rows':[]};var _0x282344=_[_0x070e('0x29')](db[_0x070e('0x2a')]['rawAttributes'],function(_0x5c5f0d){return{'name':_0x5c5f0d[_0x070e('0x2b')],'type':_0x5c5f0d[_0x070e('0x2c')][_0x070e('0x2d')]};});_0x26373b['model']=_[_0x070e('0x29')](_0x282344,_0x070e('0x26'));_0x26373b[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x43dd96['query']);_0x26373b['filters']=_['intersection'](_0x26373b['model'],_0x26373b[_0x070e('0x2e')]);_0x1a1892['attributes']=_[_0x070e('0x30')](_0x26373b[_0x070e('0x31')],qs['fields'](_0x43dd96['query'][_0x070e('0x32')]));_0x1a1892[_0x070e('0x33')]=_0x1a1892['attributes']['length']?_0x1a1892[_0x070e('0x33')]:_0x26373b[_0x070e('0x31')];if(!_0x43dd96[_0x070e('0x2e')][_0x070e('0x34')](_0x070e('0x35'))){_0x1a1892['limit']=qs['limit'](_0x43dd96[_0x070e('0x2e')][_0x070e('0x1e')]);_0x1a1892[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x43dd96[_0x070e('0x2e')]['offset']);}_0x1a1892[_0x070e('0x36')]=qs[_0x070e('0x37')](_0x43dd96['query'][_0x070e('0x37')]);_0x1a1892[_0x070e('0x38')]=qs['filters'](_['pick'](_0x43dd96['query'],_0x26373b[_0x070e('0x39')]),_0x282344);if(_0x43dd96[_0x070e('0x2e')][_0x070e('0x3a')]){_0x1a1892[_0x070e('0x38')]=_[_0x070e('0x3b')](_0x1a1892['where'],{'$or':_[_0x070e('0x29')](_0x282344,function(_0xa1bb20){if(_0xa1bb20[_0x070e('0x2c')]!=='VIRTUAL'){var _0x268c5d={};_0x268c5d[_0xa1bb20[_0x070e('0x26')]]={'$like':'%'+_0x43dd96[_0x070e('0x2e')]['filter']+'%'};return _0x268c5d;}})});}_0x1a1892=_[_0x070e('0x3b')]({},_0x1a1892,_0x43dd96[_0x070e('0x3c')]);var _0x4800a9={'where':_0x1a1892[_0x070e('0x38')]};return db['FreshdeskField'][_0x070e('0x1d')](_0x4800a9)[_0x070e('0x23')](function(_0x3462d3){_0x5e8326[_0x070e('0x1d')]=_0x3462d3;if(_0x43dd96[_0x070e('0x2e')]['includeAll']){_0x1a1892[_0x070e('0x3d')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x1a1892);})[_0x070e('0x23')](function(_0x42c448){_0x5e8326[_0x070e('0x3e')]=_0x42c448;return _0x5e8326;})['then'](respondWithFilteredResult(_0x28d7f2,_0x1a1892))[_0x070e('0x3f')](handleError(_0x28d7f2,null));};exports[_0x070e('0x40')]=function(_0x556bf3,_0x7dc240){var _0x4a4ee3={'raw':!![],'where':{'id':_0x556bf3['params']['id']}},_0x13e4e0={};_0x13e4e0['model']=_['keys'](db[_0x070e('0x2a')][_0x070e('0x41')]);_0x13e4e0[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x556bf3[_0x070e('0x2e')]);_0x13e4e0['filters']=_[_0x070e('0x30')](_0x13e4e0['model'],_0x13e4e0[_0x070e('0x2e')]);_0x4a4ee3[_0x070e('0x33')]=_[_0x070e('0x30')](_0x13e4e0['model'],qs['fields'](_0x556bf3[_0x070e('0x2e')]['fields']));_0x4a4ee3[_0x070e('0x33')]=_0x4a4ee3[_0x070e('0x33')][_0x070e('0x42')]?_0x4a4ee3['attributes']:_0x13e4e0[_0x070e('0x31')];if(_0x556bf3[_0x070e('0x2e')]['includeAll']){_0x4a4ee3['include']=[{'all':!![]}];}_0x4a4ee3=_[_0x070e('0x3b')]({},_0x4a4ee3,_0x556bf3[_0x070e('0x3c')]);return db[_0x070e('0x2a')][_0x070e('0x43')](_0x4a4ee3)[_0x070e('0x23')](handleEntityNotFound(_0x7dc240,null))['then'](respondWithResult(_0x7dc240,null))[_0x070e('0x3f')](handleError(_0x7dc240,null));};exports[_0x070e('0x44')]=function(_0x427fa7,_0x391dee){return db[_0x070e('0x2a')][_0x070e('0x44')](_0x427fa7[_0x070e('0x45')],{})[_0x070e('0x23')](respondWithResult(_0x391dee,0xc9))[_0x070e('0x3f')](handleError(_0x391dee,null));};exports[_0x070e('0x22')]=function(_0x210c4d,_0x3be553){if(_0x210c4d[_0x070e('0x45')]['id']){delete _0x210c4d[_0x070e('0x45')]['id'];}return db[_0x070e('0x2a')]['find']({'where':{'id':_0x210c4d[_0x070e('0x46')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x3be553,null))[_0x070e('0x23')](saveUpdates(_0x210c4d[_0x070e('0x45')],null))[_0x070e('0x23')](respondWithResult(_0x3be553,null))[_0x070e('0x3f')](handleError(_0x3be553,null));};exports[_0x070e('0x47')]=function(_0x35dbaf,_0x1c64d2){return db['FreshdeskField'][_0x070e('0x43')]({'where':{'id':_0x35dbaf['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x1c64d2,null))[_0x070e('0x23')](removeEntity(_0x1c64d2,null))['catch'](handleError(_0x1c64d2,null));}; \ No newline at end of file +var _0x750a=['../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','sendStatus','error','stack','name','send','map','FreshdeskField','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','body','update','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment'];(function(_0x411ae6,_0x28602a){var _0x4d2b50=function(_0x543969){while(--_0x543969){_0x411ae6['push'](_0x411ae6['shift']());}};_0x4d2b50(++_0x28602a);}(_0x750a,0x140));var _0xa750=function(_0x1cc498,_0xcb045){_0x1cc498=_0x1cc498-0x0;var _0x4781ef=_0x750a[_0x1cc498];return _0x4781ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x3001bc,_0x7e22ad){return function(_0x3d52b3){if(!_0x3d52b3){_0x3001bc[_0xa750('0x1e')](0x194);}return _0x3d52b3;};}function handleError(_0xe92342,_0x27a5eb){_0x27a5eb=_0x27a5eb||0x1f4;return function(_0x31ea63){logger[_0xa750('0x1f')](_0x31ea63[_0xa750('0x20')]);if(_0x31ea63['name']){delete _0x31ea63[_0xa750('0x21')];}_0xe92342[_0xa750('0x15')](_0x27a5eb)[_0xa750('0x22')](_0x31ea63);};}exports['index']=function(_0x35ab53,_0x6ade2b){var _0x3270e3={},_0x1223d2={},_0x579f1c={'count':0x0,'rows':[]};var _0x297eef=_[_0xa750('0x23')](db[_0xa750('0x24')][_0xa750('0x25')],function(_0x2c5253){return{'name':_0x2c5253['fieldName'],'type':_0x2c5253[_0xa750('0x26')]['key']};});_0x1223d2[_0xa750('0x27')]=_[_0xa750('0x23')](_0x297eef,'name');_0x1223d2[_0xa750('0x28')]=_[_0xa750('0x29')](_0x35ab53[_0xa750('0x28')]);_0x1223d2[_0xa750('0x2a')]=_[_0xa750('0x2b')](_0x1223d2[_0xa750('0x27')],_0x1223d2[_0xa750('0x28')]);_0x3270e3[_0xa750('0x2c')]=_['intersection'](_0x1223d2[_0xa750('0x27')],qs['fields'](_0x35ab53[_0xa750('0x28')][_0xa750('0x2d')]));_0x3270e3[_0xa750('0x2c')]=_0x3270e3[_0xa750('0x2c')]['length']?_0x3270e3[_0xa750('0x2c')]:_0x1223d2[_0xa750('0x27')];if(!_0x35ab53['query'][_0xa750('0x2e')](_0xa750('0x2f'))){_0x3270e3[_0xa750('0x30')]=qs[_0xa750('0x30')](_0x35ab53['query'][_0xa750('0x30')]);_0x3270e3['offset']=qs['offset'](_0x35ab53[_0xa750('0x28')][_0xa750('0x17')]);}_0x3270e3[_0xa750('0x31')]=qs['sort'](_0x35ab53[_0xa750('0x28')][_0xa750('0x32')]);_0x3270e3[_0xa750('0x33')]=qs['filters'](_[_0xa750('0x34')](_0x35ab53[_0xa750('0x28')],_0x1223d2[_0xa750('0x2a')]),_0x297eef);if(_0x35ab53['query'][_0xa750('0x35')]){_0x3270e3[_0xa750('0x33')]=_[_0xa750('0x36')](_0x3270e3['where'],{'$or':_[_0xa750('0x23')](_0x297eef,function(_0x339f10){if(_0x339f10[_0xa750('0x26')]!==_0xa750('0x37')){var _0x4dd8d5={};_0x4dd8d5[_0x339f10['name']]={'$like':'%'+_0x35ab53[_0xa750('0x28')][_0xa750('0x35')]+'%'};return _0x4dd8d5;}})});}_0x3270e3=_['merge']({},_0x3270e3,_0x35ab53[_0xa750('0x38')]);var _0x2f57e9={'where':_0x3270e3[_0xa750('0x33')]};return db[_0xa750('0x24')][_0xa750('0x19')](_0x2f57e9)['then'](function(_0x6c99c4){_0x579f1c[_0xa750('0x19')]=_0x6c99c4;if(_0x35ab53[_0xa750('0x28')][_0xa750('0x39')]){_0x3270e3[_0xa750('0x3a')]=[{'all':!![]}];}return db[_0xa750('0x24')][_0xa750('0x3b')](_0x3270e3);})['then'](function(_0x3daa38){_0x579f1c['rows']=_0x3daa38;return _0x579f1c;})[_0xa750('0x1d')](respondWithFilteredResult(_0x6ade2b,_0x3270e3))['catch'](handleError(_0x6ade2b,null));};exports[_0xa750('0x3c')]=function(_0x376afb,_0xf9fd5f){var _0x1be24e={'raw':!![],'where':{'id':_0x376afb[_0xa750('0x3d')]['id']}},_0x430d60={};_0x430d60[_0xa750('0x27')]=_[_0xa750('0x29')](db[_0xa750('0x24')][_0xa750('0x25')]);_0x430d60[_0xa750('0x28')]=_[_0xa750('0x29')](_0x376afb[_0xa750('0x28')]);_0x430d60[_0xa750('0x2a')]=_[_0xa750('0x2b')](_0x430d60[_0xa750('0x27')],_0x430d60[_0xa750('0x28')]);_0x1be24e[_0xa750('0x2c')]=_[_0xa750('0x2b')](_0x430d60[_0xa750('0x27')],qs['fields'](_0x376afb[_0xa750('0x28')][_0xa750('0x2d')]));_0x1be24e[_0xa750('0x2c')]=_0x1be24e[_0xa750('0x2c')][_0xa750('0x3e')]?_0x1be24e[_0xa750('0x2c')]:_0x430d60[_0xa750('0x27')];if(_0x376afb[_0xa750('0x28')][_0xa750('0x39')]){_0x1be24e['include']=[{'all':!![]}];}_0x1be24e=_[_0xa750('0x36')]({},_0x1be24e,_0x376afb[_0xa750('0x38')]);return db['FreshdeskField'][_0xa750('0x3f')](_0x1be24e)[_0xa750('0x1d')](handleEntityNotFound(_0xf9fd5f,null))[_0xa750('0x1d')](respondWithResult(_0xf9fd5f,null))[_0xa750('0x40')](handleError(_0xf9fd5f,null));};exports[_0xa750('0x41')]=function(_0x2c2c9a,_0x5e7a95){return db[_0xa750('0x24')][_0xa750('0x41')](_0x2c2c9a[_0xa750('0x42')],{})['then'](respondWithResult(_0x5e7a95,0xc9))[_0xa750('0x40')](handleError(_0x5e7a95,null));};exports[_0xa750('0x43')]=function(_0x58afd2,_0x93e49f){if(_0x58afd2[_0xa750('0x42')]['id']){delete _0x58afd2[_0xa750('0x42')]['id'];}return db['FreshdeskField'][_0xa750('0x3f')]({'where':{'id':_0x58afd2[_0xa750('0x3d')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x93e49f,null))[_0xa750('0x1d')](saveUpdates(_0x58afd2['body'],null))[_0xa750('0x1d')](respondWithResult(_0x93e49f,null))[_0xa750('0x40')](handleError(_0x93e49f,null));};exports[_0xa750('0x1c')]=function(_0xed4f88,_0x4ce363){return db[_0xa750('0x24')][_0xa750('0x3f')]({'where':{'id':_0xed4f88['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4ce363,null))['then'](removeEntity(_0x4ce363,null))[_0xa750('0x40')](handleError(_0x4ce363,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 7e63a20..30a89d8 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 _0x4860=['define','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4860,0x197));var _0x0486=function(_0x5a801f,_0x9919f9){_0x5a801f=_0x5a801f-0x0;var _0x35720c=_0x4860[_0x5a801f];return _0x35720c;};'use strict';var _=require(_0x0486('0x0'));var util=require(_0x0486('0x1'));var logger=require(_0x0486('0x2'))('api');var moment=require(_0x0486('0x3'));var BPromise=require('bluebird');var rp=require(_0x0486('0x4'));var fs=require('fs');var path=require(_0x0486('0x5'));var rimraf=require('rimraf');var config=require(_0x0486('0x6'));var attributes=require(_0x0486('0x7'));module[_0x0486('0x8')]=function(_0x47946b,_0x355f17){return _0x47946b[_0x0486('0x9')]('FreshdeskField',attributes,{'tableName':_0x0486('0xa'),'paranoid':![],'indexes':[{'name':_0x0486('0xb'),'fields':[_0x0486('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa473=['rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path'];(function(_0x44fe9d,_0x18a4c8){var _0x432039=function(_0x137b54){while(--_0x137b54){_0x44fe9d['push'](_0x44fe9d['shift']());}};_0x432039(++_0x18a4c8);}(_0xa473,0x1cb));var _0x3a47=function(_0x513974,_0x278a0a){_0x513974=_0x513974-0x0;var _0x12f55e=_0xa473[_0x513974];return _0x12f55e;};'use strict';var _=require(_0x3a47('0x0'));var util=require(_0x3a47('0x1'));var logger=require('../../config/logger')(_0x3a47('0x2'));var moment=require(_0x3a47('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a47('0x4'));var fs=require('fs');var path=require(_0x3a47('0x5'));var rimraf=require(_0x3a47('0x6'));var config=require(_0x3a47('0x7'));var attributes=require(_0x3a47('0x8'));module['exports']=function(_0x38d11b,_0x341643){return _0x38d11b[_0x3a47('0x9')](_0x3a47('0xa'),attributes,{'tableName':_0x3a47('0xb'),'paranoid':![],'indexes':[{'name':_0x3a47('0xc'),'fields':[_0x3a47('0xd'),_0x3a47('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 25888ae..ed06893 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 _0xa8a7=['request','then','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x63c794,_0x14f52c){var _0x16f319=function(_0x149940){while(--_0x149940){_0x63c794['push'](_0x63c794['shift']());}};_0x16f319(++_0x14f52c);}(_0xa8a7,0x83));var _0x7a8a=function(_0x4c6d42,_0x2fa3a9){_0x4c6d42=_0x4c6d42-0x0;var _0x20e70c=_0xa8a7[_0x4c6d42];return _0x20e70c;};'use strict';var _=require(_0x7a8a('0x0'));var util=require('util');var moment=require(_0x7a8a('0x1'));var BPromise=require(_0x7a8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a8a('0x3'))['db'];var utils=require(_0x7a8a('0x4'));var logger=require('../../config/logger')(_0x7a8a('0x5'));var config=require(_0x7a8a('0x6'));var jayson=require(_0x7a8a('0x7'));var client=jayson[_0x7a8a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aa6e9,_0x3314bd,_0x8a1282){return new BPromise(function(_0x5842ad,_0x3fa08a){return client[_0x7a8a('0x9')](_0x3aa6e9,_0x8a1282)[_0x7a8a('0xa')](function(_0x558daf){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3314bd,'request\x20sent');logger[_0x7a8a('0xb')](_0x7a8a('0xc'),_0x3314bd,_0x7a8a('0xd'),JSON['stringify'](_0x558daf));if(_0x558daf[_0x7a8a('0xe')]){if(_0x558daf[_0x7a8a('0xe')][_0x7a8a('0xf')]===0x1f4){logger['error'](_0x7a8a('0x10'),_0x3314bd,_0x558daf[_0x7a8a('0xe')][_0x7a8a('0x11')]);return _0x3fa08a(_0x558daf[_0x7a8a('0xe')][_0x7a8a('0x11')]);}logger[_0x7a8a('0xe')](_0x7a8a('0x10'),_0x3314bd,_0x558daf[_0x7a8a('0xe')][_0x7a8a('0x11')]);return _0x5842ad(_0x558daf['error'][_0x7a8a('0x11')]);}else{logger['info'](_0x7a8a('0x10'),_0x3314bd,_0x7a8a('0xd'));_0x5842ad(_0x558daf[_0x7a8a('0x12')][_0x7a8a('0x11')]);}})[_0x7a8a('0x13')](function(_0x21001d){logger['error'](_0x7a8a('0x10'),_0x3314bd,_0x21001d);_0x3fa08a(_0x21001d);});});} \ No newline at end of file +var _0xfb0a=['http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x8b92b1,_0x576718){var _0x369735=function(_0x21b3f4){while(--_0x21b3f4){_0x8b92b1['push'](_0x8b92b1['shift']());}};_0x369735(++_0x576718);}(_0xfb0a,0xad));var _0xafb0=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xfb0a[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xafb0('0x0'));var util=require(_0xafb0('0x1'));var moment=require(_0xafb0('0x2'));var BPromise=require('bluebird');var rs=require(_0xafb0('0x3'));var fs=require('fs');var Redis=require(_0xafb0('0x4'));var db=require(_0xafb0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xafb0('0x6'))(_0xafb0('0x7'));var config=require(_0xafb0('0x8'));var jayson=require(_0xafb0('0x9'));var client=jayson[_0xafb0('0xa')][_0xafb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1514d6,_0x46e7de,_0xd77b95){return new BPromise(function(_0xaf0195,_0xf1b12b){return client[_0xafb0('0xc')](_0x1514d6,_0xd77b95)[_0xafb0('0xd')](function(_0x179b24){logger[_0xafb0('0xe')](_0xafb0('0xf'),_0x46e7de,_0xafb0('0x10'));logger[_0xafb0('0x11')](_0xafb0('0x12'),_0x46e7de,_0xafb0('0x10'),JSON[_0xafb0('0x13')](_0x179b24));if(_0x179b24['error']){if(_0x179b24[_0xafb0('0x14')]['code']===0x1f4){logger[_0xafb0('0x14')](_0xafb0('0xf'),_0x46e7de,_0x179b24['error']['message']);return _0xf1b12b(_0x179b24['error'][_0xafb0('0x15')]);}logger[_0xafb0('0x14')](_0xafb0('0xf'),_0x46e7de,_0x179b24[_0xafb0('0x14')][_0xafb0('0x15')]);return _0xaf0195(_0x179b24[_0xafb0('0x14')][_0xafb0('0x15')]);}else{logger['info'](_0xafb0('0xf'),_0x46e7de,'request\x20sent');_0xaf0195(_0x179b24[_0xafb0('0x16')][_0xafb0('0x15')]);}})['catch'](function(_0x31d91c){logger[_0xafb0('0x14')](_0xafb0('0xf'),_0x46e7de,_0x31d91c);_0xf1b12b(_0x31d91c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 041fa18..c7c2c93 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 _0x9c00=['create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x5112ff,_0x58dedf){var _0x92adb7=function(_0x4c334e){while(--_0x4c334e){_0x5112ff['push'](_0x5112ff['shift']());}};_0x92adb7(++_0x58dedf);}(_0x9c00,0x1a0));var _0x09c0=function(_0x5ebb4d,_0x3180ec){_0x5ebb4d=_0x5ebb4d-0x0;var _0x7e1980=_0x9c00[_0x5ebb4d];return _0x7e1980;};'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('0x8')]('/:id/configurations',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xf')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0xf')](_0x09c0('0x11'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x13')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x14')]);router[_0x09c0('0x15')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x16')]);module[_0x09c0('0x17')]=router; \ No newline at end of file +var _0xe511=['get','index','show','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x1940e8,_0x4cffb8){var _0x3fd732=function(_0x46cb41){while(--_0x46cb41){_0x1940e8['push'](_0x1940e8['shift']());}};_0x3fd732(++_0x4cffb8);}(_0xe511,0x16f));var _0x1e51=function(_0x559057,_0xc1a46c){_0x559057=_0x559057-0x0;var _0x13c81d=_0xe511[_0x559057];return _0x13c81d;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0xf')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x10')]);router[_0x1e51('0xf')](_0x1e51('0x11'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x13')]('/:id',auth[_0x1e51('0xd')](),controller[_0x1e51('0x14')]);router[_0x1e51('0x15')](_0x1e51('0x16'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x17')]);module[_0x1e51('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index fa81e26..9445aac 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 _0x6a95=['exports','STRING','username','sequelize'];(function(_0x14e00a,_0x50dcc0){var _0x3f57fb=function(_0x23a236){while(--_0x23a236){_0x14e00a['push'](_0x14e00a['shift']());}};_0x3f57fb(++_0x50dcc0);}(_0x6a95,0x1db));var _0x56a9=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x6a95[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x955f=['exports','STRING','sequelize'];(function(_0x559b02,_0x559270){var _0x431e21=function(_0x545031){while(--_0x545031){_0x559b02['push'](_0x559b02['shift']());}};_0x431e21(++_0x559270);}(_0x955f,0x1eb));var _0xf955=function(_0xe36a18,_0x364cb6){_0xe36a18=_0xe36a18-0x0;var _0x3c4965=_0x955f[_0xe36a18];return _0x3c4965;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')]},'description':{'type':Sequelize[_0xf955('0x2')]},'username':{'type':Sequelize[_0xf955('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf955('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf955('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 5c174ee..b7d7f33 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 _0x60c2=['mustache','util','path','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','keys','includeAll','find','body','params','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','create','FreshsalesField','getFields','username','remoteUri','apiKey','slice','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x44d968,_0x3b926d){var _0x5f50b9=function(_0x5e2ffa){while(--_0x5e2ffa){_0x44d968['push'](_0x44d968['shift']());}};_0x5f50b9(++_0x3b926d);}(_0x60c2,0xbe));var _0x260c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x60c2[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x260c('0x0'));var rimraf=require(_0x260c('0x1'));var zipdir=require(_0x260c('0x2'));var jsonpatch=require(_0x260c('0x3'));var rp=require(_0x260c('0x4'));var moment=require('moment');var BPromise=require(_0x260c('0x5'));var Mustache=require(_0x260c('0x6'));var util=require(_0x260c('0x7'));var path=require(_0x260c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x260c('0x9'));var _=require(_0x260c('0xa'));var squel=require(_0x260c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x260c('0xc'));var toCsv=require(_0x260c('0xd'));var querystring=require(_0x260c('0xe'));var Papa=require(_0x260c('0xf'));var Redis=require(_0x260c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x260c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x260c('0x12'))(_0x260c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x260c('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x260c('0x15'));function respondWithStatusCode(_0xb8dc22,_0x197b80){_0x197b80=_0x197b80||0xcc;return function(_0x42e984){if(_0x42e984){return _0xb8dc22['sendStatus'](_0x197b80);}return _0xb8dc22[_0x260c('0x16')](_0x197b80)[_0x260c('0x17')]();};}function respondWithResult(_0x3cad6a,_0x4ba264){_0x4ba264=_0x4ba264||0xc8;return function(_0x4f8bb9){if(_0x4f8bb9){return _0x3cad6a['status'](_0x4ba264)[_0x260c('0x18')](_0x4f8bb9);}};}function respondWithFilteredResult(_0x559445,_0x10c732){return function(_0x173f77){if(_0x173f77){var _0x494c14=typeof _0x10c732[_0x260c('0x19')]==='undefined'&&typeof _0x10c732['limit']===_0x260c('0x1a');var _0xa217d2=_0x173f77[_0x260c('0x1b')];var _0x3d145d=_0x494c14?0x0:_0x10c732['offset'];var _0x585055=_0x494c14?_0x173f77['count']:_0x10c732[_0x260c('0x19')]+_0x10c732[_0x260c('0x1c')];var _0x1a5910;if(_0x585055>=_0xa217d2){_0x585055=_0xa217d2;_0x1a5910=0xc8;}else{_0x1a5910=0xce;}_0x559445[_0x260c('0x16')](_0x1a5910);return _0x559445['set'](_0x260c('0x1d'),_0x3d145d+'-'+_0x585055+'/'+_0xa217d2)[_0x260c('0x18')](_0x173f77);}return null;};}function patchUpdates(_0x4588d7){return function(_0x28bf96){try{jsonpatch['apply'](_0x28bf96,_0x4588d7,!![]);}catch(_0xcffd97){return BPromise[_0x260c('0x1e')](_0xcffd97);}return _0x28bf96[_0x260c('0x1f')]();};}function saveUpdates(_0x4c9a0c,_0x32c006){return function(_0x35a3b5){if(_0x35a3b5){return _0x35a3b5['update'](_0x4c9a0c)[_0x260c('0x20')](function(_0x5a778a){return _0x5a778a;});}return null;};}function removeEntity(_0x5a14ae,_0x1aefcf){return function(_0xbf37b2){if(_0xbf37b2){return _0xbf37b2['destroy']()['then'](function(){_0x5a14ae['status'](0xcc)[_0x260c('0x17')]();});}};}function handleEntityNotFound(_0x18d6ee,_0x48d564){return function(_0x10c01d){if(!_0x10c01d){_0x18d6ee[_0x260c('0x21')](0x194);}return _0x10c01d;};}function handleError(_0x282025,_0x35506c){_0x35506c=_0x35506c||0x1f4;return function(_0x4f5e2d){logger['error'](_0x4f5e2d[_0x260c('0x22')]);if(_0x4f5e2d[_0x260c('0x23')]){delete _0x4f5e2d[_0x260c('0x23')];}_0x282025[_0x260c('0x16')](_0x35506c)[_0x260c('0x24')](_0x4f5e2d);};}exports[_0x260c('0x25')]=function(_0x523f85,_0x27d8cb){var _0x29aa37={},_0x4a1a63={},_0x5a8549={'count':0x0,'rows':[]};var _0x3e9ded=_[_0x260c('0x26')](db[_0x260c('0x27')][_0x260c('0x28')],function(_0x509a33){return{'name':_0x509a33[_0x260c('0x29')],'type':_0x509a33[_0x260c('0x2a')]['key']};});_0x4a1a63[_0x260c('0x2b')]=_[_0x260c('0x26')](_0x3e9ded,_0x260c('0x23'));_0x4a1a63[_0x260c('0x2c')]=_['keys'](_0x523f85['query']);_0x4a1a63[_0x260c('0x2d')]=_['intersection'](_0x4a1a63[_0x260c('0x2b')],_0x4a1a63[_0x260c('0x2c')]);_0x29aa37[_0x260c('0x2e')]=_[_0x260c('0x2f')](_0x4a1a63['model'],qs[_0x260c('0x30')](_0x523f85[_0x260c('0x2c')][_0x260c('0x30')]));_0x29aa37[_0x260c('0x2e')]=_0x29aa37[_0x260c('0x2e')][_0x260c('0x31')]?_0x29aa37['attributes']:_0x4a1a63['model'];if(!_0x523f85[_0x260c('0x2c')][_0x260c('0x32')](_0x260c('0x33'))){_0x29aa37[_0x260c('0x1c')]=qs[_0x260c('0x1c')](_0x523f85['query'][_0x260c('0x1c')]);_0x29aa37['offset']=qs[_0x260c('0x19')](_0x523f85[_0x260c('0x2c')][_0x260c('0x19')]);}_0x29aa37[_0x260c('0x34')]=qs['sort'](_0x523f85[_0x260c('0x2c')][_0x260c('0x35')]);_0x29aa37[_0x260c('0x36')]=qs['filters'](_[_0x260c('0x37')](_0x523f85[_0x260c('0x2c')],_0x4a1a63[_0x260c('0x2d')]),_0x3e9ded);if(_0x523f85[_0x260c('0x2c')][_0x260c('0x38')]){_0x29aa37[_0x260c('0x36')]=_['merge'](_0x29aa37['where'],{'$or':_['map'](_0x3e9ded,function(_0x4dddfd){if(_0x4dddfd[_0x260c('0x2a')]!==_0x260c('0x39')){var _0x271300={};_0x271300[_0x4dddfd['name']]={'$like':'%'+_0x523f85[_0x260c('0x2c')]['filter']+'%'};return _0x271300;}})});}_0x29aa37=_[_0x260c('0x3a')]({},_0x29aa37,_0x523f85[_0x260c('0x3b')]);var _0x1a22a7={'where':_0x29aa37[_0x260c('0x36')]};return db['FreshsalesAccount'][_0x260c('0x1b')](_0x1a22a7)[_0x260c('0x20')](function(_0x1a32e1){_0x5a8549[_0x260c('0x1b')]=_0x1a32e1;if(_0x523f85[_0x260c('0x2c')]['includeAll']){_0x29aa37['include']=[{'all':!![]}];}return db[_0x260c('0x27')][_0x260c('0x3c')](_0x29aa37);})[_0x260c('0x20')](function(_0x19d028){_0x5a8549[_0x260c('0x3d')]=_0x19d028;return _0x5a8549;})['then'](respondWithFilteredResult(_0x27d8cb,_0x29aa37))[_0x260c('0x3e')](handleError(_0x27d8cb,null));};exports[_0x260c('0x3f')]=function(_0x41b6c0,_0x1691e0){var _0x41bd5a={'raw':![],'where':{'id':_0x41b6c0['params']['id']}},_0x4e9707={};_0x4e9707['model']=_[_0x260c('0x40')](db[_0x260c('0x27')][_0x260c('0x28')]);_0x4e9707['query']=_[_0x260c('0x40')](_0x41b6c0['query']);_0x4e9707[_0x260c('0x2d')]=_['intersection'](_0x4e9707[_0x260c('0x2b')],_0x4e9707[_0x260c('0x2c')]);_0x41bd5a[_0x260c('0x2e')]=_[_0x260c('0x2f')](_0x4e9707['model'],qs[_0x260c('0x30')](_0x41b6c0[_0x260c('0x2c')]['fields']));_0x41bd5a['attributes']=_0x41bd5a[_0x260c('0x2e')][_0x260c('0x31')]?_0x41bd5a[_0x260c('0x2e')]:_0x4e9707[_0x260c('0x2b')];if(_0x41b6c0[_0x260c('0x2c')][_0x260c('0x41')]){_0x41bd5a['include']=[{'all':!![]}];}_0x41bd5a=_[_0x260c('0x3a')]({},_0x41bd5a,_0x41b6c0[_0x260c('0x3b')]);return db[_0x260c('0x27')][_0x260c('0x42')](_0x41bd5a)['then'](handleEntityNotFound(_0x1691e0,null))['then'](respondWithResult(_0x1691e0,null))['catch'](handleError(_0x1691e0,null));};exports['create']=function(_0x3a72e7,_0xa53702){return db['FreshsalesAccount']['create'](_0x3a72e7[_0x260c('0x43')],{})['then'](respondWithResult(_0xa53702,0xc9))[_0x260c('0x3e')](handleError(_0xa53702,null));};exports['update']=function(_0x56b6bc,_0xbed402){if(_0x56b6bc[_0x260c('0x43')]['id']){delete _0x56b6bc[_0x260c('0x43')]['id'];}return db['FreshsalesAccount'][_0x260c('0x42')]({'where':{'id':_0x56b6bc[_0x260c('0x44')]['id']}})[_0x260c('0x20')](handleEntityNotFound(_0xbed402,null))[_0x260c('0x20')](saveUpdates(_0x56b6bc[_0x260c('0x43')],null))[_0x260c('0x20')](respondWithResult(_0xbed402,null))[_0x260c('0x3e')](handleError(_0xbed402,null));};exports[_0x260c('0x45')]=function(_0x3f3fce,_0x2c6c50){return db[_0x260c('0x27')][_0x260c('0x42')]({'where':{'id':_0x3f3fce[_0x260c('0x44')]['id']}})[_0x260c('0x20')](handleEntityNotFound(_0x2c6c50,null))[_0x260c('0x20')](removeEntity(_0x2c6c50,null))['catch'](handleError(_0x2c6c50,null));};exports[_0x260c('0x46')]=function(_0x23abb3,_0xcaa60f,_0xfce59d){var _0x579c09={};var _0xca0f2f={};var _0x2dffa0;var _0x259f26;return db[_0x260c('0x27')][_0x260c('0x47')]({'where':{'id':_0x23abb3['params']['id']}})[_0x260c('0x20')](handleEntityNotFound(_0xcaa60f,null))[_0x260c('0x20')](function(_0x30edd8){if(_0x30edd8){_0x2dffa0=_0x30edd8;_0xca0f2f['model']=_['keys'](db[_0x260c('0x48')][_0x260c('0x28')]);_0xca0f2f[_0x260c('0x2c')]=_['keys'](_0x23abb3[_0x260c('0x2c')]);_0xca0f2f[_0x260c('0x2d')]=_['intersection'](_0xca0f2f['model'],_0xca0f2f[_0x260c('0x2c')]);_0x579c09[_0x260c('0x2e')]=_[_0x260c('0x2f')](_0xca0f2f[_0x260c('0x2b')],qs[_0x260c('0x30')](_0x23abb3['query'][_0x260c('0x30')]));_0x579c09[_0x260c('0x2e')]=_0x579c09['attributes'][_0x260c('0x31')]?_0x579c09['attributes']:_0xca0f2f[_0x260c('0x2b')];_0x579c09[_0x260c('0x34')]=qs[_0x260c('0x35')](_0x23abb3[_0x260c('0x2c')][_0x260c('0x35')]);_0x579c09['where']=qs['filters'](_[_0x260c('0x37')](_0x23abb3[_0x260c('0x2c')],_0xca0f2f['filters']));if(_0x23abb3[_0x260c('0x2c')]['filter']){_0x579c09[_0x260c('0x36')]=_['merge'](_0x579c09[_0x260c('0x36')],{'$or':_[_0x260c('0x26')](_0x579c09[_0x260c('0x2e')],function(_0x1148b9){var _0x2a6948={};_0x2a6948[_0x1148b9]={'$like':'%'+_0x23abb3[_0x260c('0x2c')][_0x260c('0x38')]+'%'};return _0x2a6948;})});}_0x579c09=_['merge']({},_0x579c09,_0x23abb3[_0x260c('0x3b')]);return _0x2dffa0['getConfigurations'](_0x579c09);}})[_0x260c('0x20')](function(_0x252a58){if(_0x252a58){_0x259f26=_0x252a58[_0x260c('0x31')];if(!_0x23abb3[_0x260c('0x2c')][_0x260c('0x32')](_0x260c('0x33'))){_0x579c09['limit']=qs[_0x260c('0x1c')](_0x23abb3['query']['limit']);_0x579c09[_0x260c('0x19')]=qs[_0x260c('0x19')](_0x23abb3[_0x260c('0x2c')]['offset']);}return _0x2dffa0[_0x260c('0x46')](_0x579c09);}})[_0x260c('0x20')](function(_0x76440c){if(_0x76440c){return _0x76440c?{'count':_0x259f26,'rows':_0x76440c}:null;}})[_0x260c('0x20')](respondWithResult(_0xcaa60f,null))[_0x260c('0x3e')](handleError(_0xcaa60f,null));};exports[_0x260c('0x49')]=function(_0x4b342e,_0x333382,_0x4a489c){if(_0x4b342e[_0x260c('0x43')]['id']){delete _0x4b342e[_0x260c('0x43')]['id'];}return db[_0x260c('0x27')][_0x260c('0x47')]({'where':{'id':_0x4b342e['params']['id']}})[_0x260c('0x20')](handleEntityNotFound(_0x333382,null))['then'](function(_0x198fb9){if(_0x198fb9){_0x4b342e[_0x260c('0x43')][_0x260c('0x4a')]=_0x198fb9['id'];_0x4b342e['body'][_0x260c('0x4b')]=integrations['getSubjects'](_0x4b342e[_0x260c('0x43')][_0x260c('0x4c')],_0x4b342e[_0x260c('0x43')]['type']);_0x4b342e['body'][_0x260c('0x4d')]=integrations['getDescriptions'](_0x4b342e[_0x260c('0x43')][_0x260c('0x4c')],_0x4b342e['body'][_0x260c('0x2a')]);return db[_0x260c('0x48')][_0x260c('0x4e')](_0x4b342e[_0x260c('0x43')],{'include':[{'model':db['FreshsalesField'],'as':_0x260c('0x4b')},{'model':db[_0x260c('0x4f')],'as':_0x260c('0x4d')}]});}return null;})[_0x260c('0x20')](respondWithResult(_0x333382,null))[_0x260c('0x3e')](handleError(_0x333382,null));};exports[_0x260c('0x50')]=function(_0x369a13,_0x142bc5,_0x3b7dd6){var _0x521f84='';var _0x2ff9d3='';return db['FreshsalesAccount'][_0x260c('0x47')]({'where':{'id':_0x369a13[_0x260c('0x44')]['id']},'attributes':['id',_0x260c('0x51'),_0x260c('0x52'),_0x260c('0x53')]})[_0x260c('0x20')](handleEntityNotFound(_0x142bc5,null))[_0x260c('0x20')](function(_0x13c876){if(_0x13c876){_0x2ff9d3=_0x13c876[_0x260c('0x51')];_0x521f84=_0x13c876[_0x260c('0x52')];var _0x21a587=_0x13c876[_0x260c('0x52')][_0x260c('0x54')](-0x1);if(_0x21a587==='/'){_0x521f84=_0x521f84['substring'](0x0,_0x521f84['lastIndexOf'](_0x21a587));}return rp({'method':_0x260c('0x55'),'uri':util[_0x260c('0x56')](_0x260c('0x57'),_0x521f84,_0x260c('0x58')),'headers':{'Authorization':_0x260c('0x59')+_0x13c876[_0x260c('0x53')]},'json':!![]});}})['then'](function(_0x6bb778){if(_0x6bb778){var _0x59e928=_0x6bb778[_0x260c('0x5a')];var _0x117f9c=![];var _0x40ecf1=null;for(_0x40ecf1=0x0;_0x40ecf1<_0x59e928[_0x260c('0x31')];_0x40ecf1++){if(_0x59e928[_0x40ecf1][_0x260c('0x5b')]===_0x2ff9d3){_0x117f9c=!![];}}if(_0x117f9c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x260c('0x5c')});}}})[_0x260c('0x20')](respondWithResult(_0x142bc5,null))[_0x260c('0x3e')](function(_0x3fdc5a){var _0x24c144=_0x369a13[_0x260c('0x2c')][_0x260c('0x5d')]?0x1f4:_0x3fdc5a['statusCode']||0x1f4;logger[_0x260c('0x5e')](_0x260c('0x5f'),_0x260c('0x50'),_0x24c144,JSON[_0x260c('0x60')](_0x3fdc5a));delete _0x3fdc5a[_0x260c('0x23')];if(_0x24c144===0x191){_0x24c144=0x190;}_0x142bc5[_0x260c('0x16')](_0x24c144)[_0x260c('0x24')](_0x369a13['query'][_0x260c('0x5d')]?{'message':'Wrong\x20credentials','statusCode':_0x3fdc5a[_0x260c('0x61')]}:_0x3fdc5a);});}; \ No newline at end of file +var _0xd67a=['query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','where','options','includeAll','include','rows','params','rawAttributes','length','catch','create','body','find','destroy','getConfigurations','findOne','FreshsalesConfiguration','order','merge','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','remoteUri','username','substring','lastIndexOf','GET','format','/api/selector/owners','users','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','index','map','FreshsalesAccount','fieldName','type','model'];(function(_0x4e195f,_0x427353){var _0xb42a69=function(_0x29c0e4){while(--_0x29c0e4){_0x4e195f['push'](_0x4e195f['shift']());}};_0xb42a69(++_0x427353);}(_0xd67a,0x160));var _0xad67=function(_0x30f778,_0x33267a){_0x30f778=_0x30f778-0x0;var _0xc33fd0=_0xd67a[_0x30f778];return _0xc33fd0;};'use strict';var emlformat=require(_0xad67('0x0'));var rimraf=require(_0xad67('0x1'));var zipdir=require(_0xad67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad67('0x3'));var moment=require('moment');var BPromise=require(_0xad67('0x4'));var Mustache=require(_0xad67('0x5'));var util=require(_0xad67('0x6'));var path=require(_0xad67('0x7'));var sox=require('sox');var csv=require(_0xad67('0x8'));var ejs=require(_0xad67('0x9'));var fs=require('fs');var fs_extra=require(_0xad67('0xa'));var _=require(_0xad67('0xb'));var squel=require(_0xad67('0xc'));var crypto=require(_0xad67('0xd'));var jsforce=require(_0xad67('0xe'));var deskjs=require(_0xad67('0xf'));var toCsv=require(_0xad67('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xad67('0x10'));var authService=require(_0xad67('0x11'));var qs=require(_0xad67('0x12'));var as=require(_0xad67('0x13'));var hardwareService=require(_0xad67('0x14'));var logger=require(_0xad67('0x15'))(_0xad67('0x16'));var utils=require('../../config/utils');var config=require(_0xad67('0x17'));var licenseUtil=require(_0xad67('0x18'));var db=require(_0xad67('0x19'))['db'];var integrations=require(_0xad67('0x1a'));function respondWithStatusCode(_0x4f76b0,_0x4488ac){_0x4488ac=_0x4488ac||0xcc;return function(_0x160e5c){if(_0x160e5c){return _0x4f76b0[_0xad67('0x1b')](_0x4488ac);}return _0x4f76b0[_0xad67('0x1c')](_0x4488ac)[_0xad67('0x1d')]();};}function respondWithResult(_0x56d306,_0x1289e9){_0x1289e9=_0x1289e9||0xc8;return function(_0x58456f){if(_0x58456f){return _0x56d306[_0xad67('0x1c')](_0x1289e9)['json'](_0x58456f);}};}function respondWithFilteredResult(_0x15024a,_0x374053){return function(_0x35e592){if(_0x35e592){var _0x299ae2=typeof _0x374053[_0xad67('0x1e')]===_0xad67('0x1f')&&typeof _0x374053[_0xad67('0x20')]==='undefined';var _0xd00b04=_0x35e592['count'];var _0x36e8b1=_0x299ae2?0x0:_0x374053['offset'];var _0x57b453=_0x299ae2?_0x35e592[_0xad67('0x21')]:_0x374053[_0xad67('0x1e')]+_0x374053[_0xad67('0x20')];var _0x5d816d;if(_0x57b453>=_0xd00b04){_0x57b453=_0xd00b04;_0x5d816d=0xc8;}else{_0x5d816d=0xce;}_0x15024a[_0xad67('0x1c')](_0x5d816d);return _0x15024a[_0xad67('0x22')]('Content-Range',_0x36e8b1+'-'+_0x57b453+'/'+_0xd00b04)['json'](_0x35e592);}return null;};}function patchUpdates(_0xd205e7){return function(_0x27922d){try{jsonpatch['apply'](_0x27922d,_0xd205e7,!![]);}catch(_0x1ae256){return BPromise[_0xad67('0x23')](_0x1ae256);}return _0x27922d[_0xad67('0x24')]();};}function saveUpdates(_0x2212be,_0x326c81){return function(_0x4d60b4){if(_0x4d60b4){return _0x4d60b4[_0xad67('0x25')](_0x2212be)[_0xad67('0x26')](function(_0x4d3fc5){return _0x4d3fc5;});}return null;};}function removeEntity(_0x190f59,_0x5e37d4){return function(_0x491484){if(_0x491484){return _0x491484['destroy']()[_0xad67('0x26')](function(){_0x190f59[_0xad67('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54b441,_0x2195ad){return function(_0x30cb26){if(!_0x30cb26){_0x54b441[_0xad67('0x1b')](0x194);}return _0x30cb26;};}function handleError(_0x441db5,_0x5ee425){_0x5ee425=_0x5ee425||0x1f4;return function(_0x19e1a3){logger[_0xad67('0x27')](_0x19e1a3[_0xad67('0x28')]);if(_0x19e1a3[_0xad67('0x29')]){delete _0x19e1a3[_0xad67('0x29')];}_0x441db5[_0xad67('0x1c')](_0x5ee425)['send'](_0x19e1a3);};}exports[_0xad67('0x2a')]=function(_0x3aeab4,_0x3355e6){var _0x9baf27={},_0x5cd5e8={},_0xc182dd={'count':0x0,'rows':[]};var _0xeae951=_[_0xad67('0x2b')](db[_0xad67('0x2c')]['rawAttributes'],function(_0x18bad8){return{'name':_0x18bad8[_0xad67('0x2d')],'type':_0x18bad8[_0xad67('0x2e')]['key']};});_0x5cd5e8[_0xad67('0x2f')]=_['map'](_0xeae951,_0xad67('0x29'));_0x5cd5e8[_0xad67('0x30')]=_[_0xad67('0x31')](_0x3aeab4[_0xad67('0x30')]);_0x5cd5e8[_0xad67('0x32')]=_['intersection'](_0x5cd5e8['model'],_0x5cd5e8['query']);_0x9baf27[_0xad67('0x33')]=_[_0xad67('0x34')](_0x5cd5e8[_0xad67('0x2f')],qs[_0xad67('0x35')](_0x3aeab4['query'][_0xad67('0x35')]));_0x9baf27['attributes']=_0x9baf27['attributes']['length']?_0x9baf27[_0xad67('0x33')]:_0x5cd5e8[_0xad67('0x2f')];if(!_0x3aeab4['query'][_0xad67('0x36')]('nolimit')){_0x9baf27[_0xad67('0x20')]=qs[_0xad67('0x20')](_0x3aeab4['query'][_0xad67('0x20')]);_0x9baf27[_0xad67('0x1e')]=qs['offset'](_0x3aeab4[_0xad67('0x30')][_0xad67('0x1e')]);}_0x9baf27['order']=qs[_0xad67('0x37')](_0x3aeab4[_0xad67('0x30')][_0xad67('0x37')]);_0x9baf27['where']=qs['filters'](_[_0xad67('0x38')](_0x3aeab4[_0xad67('0x30')],_0x5cd5e8[_0xad67('0x32')]),_0xeae951);if(_0x3aeab4[_0xad67('0x30')][_0xad67('0x39')]){_0x9baf27[_0xad67('0x3a')]=_['merge'](_0x9baf27[_0xad67('0x3a')],{'$or':_[_0xad67('0x2b')](_0xeae951,function(_0x912bae){if(_0x912bae[_0xad67('0x2e')]!=='VIRTUAL'){var _0x40c3d6={};_0x40c3d6[_0x912bae[_0xad67('0x29')]]={'$like':'%'+_0x3aeab4[_0xad67('0x30')][_0xad67('0x39')]+'%'};return _0x40c3d6;}})});}_0x9baf27=_['merge']({},_0x9baf27,_0x3aeab4[_0xad67('0x3b')]);var _0x53a7d0={'where':_0x9baf27[_0xad67('0x3a')]};return db['FreshsalesAccount']['count'](_0x53a7d0)['then'](function(_0x351de4){_0xc182dd[_0xad67('0x21')]=_0x351de4;if(_0x3aeab4[_0xad67('0x30')][_0xad67('0x3c')]){_0x9baf27[_0xad67('0x3d')]=[{'all':!![]}];}return db[_0xad67('0x2c')]['findAll'](_0x9baf27);})[_0xad67('0x26')](function(_0x293c13){_0xc182dd[_0xad67('0x3e')]=_0x293c13;return _0xc182dd;})[_0xad67('0x26')](respondWithFilteredResult(_0x3355e6,_0x9baf27))['catch'](handleError(_0x3355e6,null));};exports['show']=function(_0x2438ab,_0x2413a1){var _0x12b60c={'raw':![],'where':{'id':_0x2438ab[_0xad67('0x3f')]['id']}},_0x58cc1d={};_0x58cc1d['model']=_[_0xad67('0x31')](db[_0xad67('0x2c')][_0xad67('0x40')]);_0x58cc1d[_0xad67('0x30')]=_[_0xad67('0x31')](_0x2438ab['query']);_0x58cc1d[_0xad67('0x32')]=_['intersection'](_0x58cc1d[_0xad67('0x2f')],_0x58cc1d[_0xad67('0x30')]);_0x12b60c['attributes']=_[_0xad67('0x34')](_0x58cc1d[_0xad67('0x2f')],qs[_0xad67('0x35')](_0x2438ab[_0xad67('0x30')][_0xad67('0x35')]));_0x12b60c[_0xad67('0x33')]=_0x12b60c[_0xad67('0x33')][_0xad67('0x41')]?_0x12b60c['attributes']:_0x58cc1d['model'];if(_0x2438ab[_0xad67('0x30')][_0xad67('0x3c')]){_0x12b60c[_0xad67('0x3d')]=[{'all':!![]}];}_0x12b60c=_['merge']({},_0x12b60c,_0x2438ab[_0xad67('0x3b')]);return db[_0xad67('0x2c')]['find'](_0x12b60c)[_0xad67('0x26')](handleEntityNotFound(_0x2413a1,null))[_0xad67('0x26')](respondWithResult(_0x2413a1,null))[_0xad67('0x42')](handleError(_0x2413a1,null));};exports['create']=function(_0x45a6b5,_0x16cb65){return db['FreshsalesAccount'][_0xad67('0x43')](_0x45a6b5[_0xad67('0x44')],{})['then'](respondWithResult(_0x16cb65,0xc9))['catch'](handleError(_0x16cb65,null));};exports[_0xad67('0x25')]=function(_0x2ea04e,_0x23cd11){if(_0x2ea04e[_0xad67('0x44')]['id']){delete _0x2ea04e[_0xad67('0x44')]['id'];}return db[_0xad67('0x2c')][_0xad67('0x45')]({'where':{'id':_0x2ea04e[_0xad67('0x3f')]['id']}})[_0xad67('0x26')](handleEntityNotFound(_0x23cd11,null))[_0xad67('0x26')](saveUpdates(_0x2ea04e['body'],null))[_0xad67('0x26')](respondWithResult(_0x23cd11,null))['catch'](handleError(_0x23cd11,null));};exports[_0xad67('0x46')]=function(_0xf4c8e9,_0x4665de){return db[_0xad67('0x2c')][_0xad67('0x45')]({'where':{'id':_0xf4c8e9[_0xad67('0x3f')]['id']}})[_0xad67('0x26')](handleEntityNotFound(_0x4665de,null))[_0xad67('0x26')](removeEntity(_0x4665de,null))[_0xad67('0x42')](handleError(_0x4665de,null));};exports[_0xad67('0x47')]=function(_0x1c688f,_0x2e5300,_0x4ff62c){var _0x207e6e={};var _0xc20f3b={};var _0x54d6e5;var _0x2cfb39;return db['FreshsalesAccount'][_0xad67('0x48')]({'where':{'id':_0x1c688f[_0xad67('0x3f')]['id']}})[_0xad67('0x26')](handleEntityNotFound(_0x2e5300,null))[_0xad67('0x26')](function(_0x4a2f5e){if(_0x4a2f5e){_0x54d6e5=_0x4a2f5e;_0xc20f3b[_0xad67('0x2f')]=_[_0xad67('0x31')](db[_0xad67('0x49')]['rawAttributes']);_0xc20f3b[_0xad67('0x30')]=_[_0xad67('0x31')](_0x1c688f['query']);_0xc20f3b[_0xad67('0x32')]=_[_0xad67('0x34')](_0xc20f3b[_0xad67('0x2f')],_0xc20f3b[_0xad67('0x30')]);_0x207e6e[_0xad67('0x33')]=_['intersection'](_0xc20f3b[_0xad67('0x2f')],qs[_0xad67('0x35')](_0x1c688f['query'][_0xad67('0x35')]));_0x207e6e[_0xad67('0x33')]=_0x207e6e['attributes']['length']?_0x207e6e[_0xad67('0x33')]:_0xc20f3b['model'];_0x207e6e[_0xad67('0x4a')]=qs['sort'](_0x1c688f['query'][_0xad67('0x37')]);_0x207e6e[_0xad67('0x3a')]=qs[_0xad67('0x32')](_[_0xad67('0x38')](_0x1c688f[_0xad67('0x30')],_0xc20f3b[_0xad67('0x32')]));if(_0x1c688f[_0xad67('0x30')][_0xad67('0x39')]){_0x207e6e[_0xad67('0x3a')]=_[_0xad67('0x4b')](_0x207e6e['where'],{'$or':_['map'](_0x207e6e[_0xad67('0x33')],function(_0x9bd64d){var _0x28e35c={};_0x28e35c[_0x9bd64d]={'$like':'%'+_0x1c688f[_0xad67('0x30')][_0xad67('0x39')]+'%'};return _0x28e35c;})});}_0x207e6e=_[_0xad67('0x4b')]({},_0x207e6e,_0x1c688f[_0xad67('0x3b')]);return _0x54d6e5[_0xad67('0x47')](_0x207e6e);}})['then'](function(_0x53d18b){if(_0x53d18b){_0x2cfb39=_0x53d18b[_0xad67('0x41')];if(!_0x1c688f[_0xad67('0x30')][_0xad67('0x36')](_0xad67('0x4c'))){_0x207e6e[_0xad67('0x20')]=qs['limit'](_0x1c688f[_0xad67('0x30')][_0xad67('0x20')]);_0x207e6e[_0xad67('0x1e')]=qs[_0xad67('0x1e')](_0x1c688f['query']['offset']);}return _0x54d6e5[_0xad67('0x47')](_0x207e6e);}})[_0xad67('0x26')](function(_0x321ae3){if(_0x321ae3){return _0x321ae3?{'count':_0x2cfb39,'rows':_0x321ae3}:null;}})[_0xad67('0x26')](respondWithResult(_0x2e5300,null))[_0xad67('0x42')](handleError(_0x2e5300,null));};exports['addConfiguration']=function(_0x2c280b,_0xdec7ae,_0x2ce183){if(_0x2c280b[_0xad67('0x44')]['id']){delete _0x2c280b['body']['id'];}return db[_0xad67('0x2c')][_0xad67('0x48')]({'where':{'id':_0x2c280b[_0xad67('0x3f')]['id']}})[_0xad67('0x26')](handleEntityNotFound(_0xdec7ae,null))[_0xad67('0x26')](function(_0x35e782){if(_0x35e782){_0x2c280b['body'][_0xad67('0x4d')]=_0x35e782['id'];_0x2c280b[_0xad67('0x44')][_0xad67('0x4e')]=integrations[_0xad67('0x4f')](_0x2c280b['body'][_0xad67('0x50')],_0x2c280b[_0xad67('0x44')]['type']);_0x2c280b[_0xad67('0x44')][_0xad67('0x51')]=integrations[_0xad67('0x52')](_0x2c280b[_0xad67('0x44')]['channel'],_0x2c280b['body'][_0xad67('0x2e')]);return db['FreshsalesConfiguration']['create'](_0x2c280b[_0xad67('0x44')],{'include':[{'model':db[_0xad67('0x53')],'as':'Subjects'},{'model':db[_0xad67('0x53')],'as':_0xad67('0x51')}]});}return null;})[_0xad67('0x26')](respondWithResult(_0xdec7ae,null))[_0xad67('0x42')](handleError(_0xdec7ae,null));};exports[_0xad67('0x54')]=function(_0x1af4d7,_0x1375fc,_0x290899){var _0x40cb59='';var _0x24abd2='';return db['FreshsalesAccount'][_0xad67('0x48')]({'where':{'id':_0x1af4d7[_0xad67('0x3f')]['id']},'attributes':['id','username',_0xad67('0x55'),'apiKey']})[_0xad67('0x26')](handleEntityNotFound(_0x1375fc,null))[_0xad67('0x26')](function(_0xaa558b){if(_0xaa558b){_0x24abd2=_0xaa558b[_0xad67('0x56')];_0x40cb59=_0xaa558b[_0xad67('0x55')];var _0x50e589=_0xaa558b[_0xad67('0x55')]['slice'](-0x1);if(_0x50e589==='/'){_0x40cb59=_0x40cb59[_0xad67('0x57')](0x0,_0x40cb59[_0xad67('0x58')](_0x50e589));}return rp({'method':_0xad67('0x59'),'uri':util[_0xad67('0x5a')]('%s%s',_0x40cb59,_0xad67('0x5b')),'headers':{'Authorization':'Token\x20token='+_0xaa558b['apiKey']},'json':!![]});}})['then'](function(_0x420897){if(_0x420897){var _0x5d79d6=_0x420897[_0xad67('0x5c')];var _0x5e29bf=![];var _0x19da47=null;for(_0x19da47=0x0;_0x19da47<_0x5d79d6['length'];_0x19da47++){if(_0x5d79d6[_0x19da47]['email']===_0x24abd2){_0x5e29bf=!![];}}if(_0x5e29bf){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xad67('0x5d')});}}})[_0xad67('0x26')](respondWithResult(_0x1375fc,null))['catch'](function(_0x2dc8dd){var _0x56ca14=_0x1af4d7[_0xad67('0x30')]['test']?0x1f4:_0x2dc8dd[_0xad67('0x5e')]||0x1f4;logger[_0xad67('0x27')](_0xad67('0x5f'),_0xad67('0x54'),_0x56ca14,JSON[_0xad67('0x60')](_0x2dc8dd));delete _0x2dc8dd[_0xad67('0x29')];if(_0x56ca14===0x191){_0x56ca14=0x190;}_0x1375fc[_0xad67('0x1c')](_0x56ca14)[_0xad67('0x61')](_0x1af4d7[_0xad67('0x30')][_0xad67('0x62')]?{'message':_0xad67('0x63'),'statusCode':_0x2dc8dd[_0xad67('0x5e')]}:_0x2dc8dd);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ae8757d..e37782d 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 _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x4533b4,_0x29b46a){var _0x3e2b6d=function(_0x5c7771){while(--_0x5c7771){_0x4533b4['push'](_0x4533b4['shift']());}};_0x3e2b6d(++_0x29b46a);}(_0xe5af,0x9c));var _0xfe5a=function(_0x3fcaa7,_0x308f38){_0x3fcaa7=_0x3fcaa7-0x0;var _0x3b4015=_0xe5af[_0x3fcaa7];return _0x3b4015;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xfe5a('0x6'));module[_0xfe5a('0x7')]=function(_0x4e418f,_0x5eea2e){return _0x4e418f[_0xfe5a('0x8')](_0xfe5a('0x9'),attributes,{'tableName':_0xfe5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1893=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x242ba8,_0x3f52fd){var _0x5ec867=function(_0x3196db){while(--_0x3196db){_0x242ba8['push'](_0x242ba8['shift']());}};_0x5ec867(++_0x3f52fd);}(_0x1893,0xa2));var _0x3189=function(_0x3d905,_0x7b688d){_0x3d905=_0x3d905-0x0;var _0x3a990b=_0x1893[_0x3d905];return _0x3a990b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));var integrations=require(_0x3189('0x8'));module[_0x3189('0x9')]=function(_0x4080a9,_0x77c566){return _0x4080a9[_0x3189('0xa')](_0x3189('0xb'),attributes,{'tableName':_0x3189('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index e285a6e..50da708 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 _0x9f0e=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit','include','map','model','attributes','ShowFreshsalesAccount','find','where','lodash','util'];(function(_0x3f99c0,_0x1e8816){var _0x1d5e2e=function(_0x2ee522){while(--_0x2ee522){_0x3f99c0['push'](_0x3f99c0['shift']());}};_0x1d5e2e(++_0x1e8816);}(_0x9f0e,0x116));var _0xe9f0=function(_0x650e61,_0x40055a){_0x650e61=_0x650e61-0x0;var _0x288cfa=_0x9f0e[_0x650e61];return _0x288cfa;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});}exports[_0xe9f0('0x16')]=function(_0x2ab12b){var _0x3da237=this;return new Promise(function(_0x59bf5a,_0x15a33b){return db[_0xe9f0('0x17')][_0xe9f0('0x18')]({'raw':_0x2ab12b['options']?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['where']||null:null,'attributes':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')]['attributes']||null:null,'limit':_0x2ab12b['options']?_0x2ab12b['options'][_0xe9f0('0x1b')]||null:null,'include':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x2ab12b['options'][_0xe9f0('0x1c')],function(_0x38b7ee){return{'model':db[_0x38b7ee[_0xe9f0('0x1e')]],'as':_0x38b7ee['as'],'attributes':_0x38b7ee[_0xe9f0('0x1f')],'include':_0x38b7ee[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x38b7ee[_0xe9f0('0x1c')],function(_0x1321bb){return{'model':db[_0x1321bb[_0xe9f0('0x1e')]],'as':_0x1321bb['as'],'attributes':_0x1321bb[_0xe9f0('0x1f')],'include':_0x1321bb['include']?_[_0xe9f0('0x1d')](_0x1321bb[_0xe9f0('0x1c')],function(_0x2ddfba){return{'model':db[_0x2ddfba[_0xe9f0('0x1e')]],'as':_0x2ddfba['as'],'attributes':_0x2ddfba['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x2613fd){logger[_0xe9f0('0xc')](_0xe9f0('0x16'),_0x2ab12b);logger[_0xe9f0('0xf')]('GetFreshsalesAccount',_0x2ab12b,JSON[_0xe9f0('0x11')](_0x2613fd));_0x59bf5a(_0x2613fd);})[_0xe9f0('0x15')](function(_0x44fb5b){logger[_0xe9f0('0x12')](_0xe9f0('0x16'),_0x44fb5b[_0xe9f0('0x13')],_0x2ab12b);_0x15a33b(_0x3da237[_0xe9f0('0x12')](0x1f4,_0x44fb5b[_0xe9f0('0x13')]));});});};exports[_0xe9f0('0x20')]=function(_0x3dbe49){var _0x22806c=this;return new Promise(function(_0x617ad3,_0x445ad0){return db[_0xe9f0('0x17')][_0xe9f0('0x21')]({'raw':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x22')]||null:null,'attributes':_0x3dbe49[_0xe9f0('0x19')]?_0x3dbe49[_0xe9f0('0x19')][_0xe9f0('0x1f')]||null:null,'include':_0x3dbe49['options']?_0x3dbe49['options']['include']?_[_0xe9f0('0x1d')](_0x3dbe49['options'][_0xe9f0('0x1c')],function(_0xc5fa13){return{'model':db[_0xc5fa13['model']],'as':_0xc5fa13['as'],'attributes':_0xc5fa13[_0xe9f0('0x1f')],'include':_0xc5fa13['include']?_['map'](_0xc5fa13['include'],function(_0x165440){return{'model':db[_0x165440[_0xe9f0('0x1e')]],'as':_0x165440['as'],'attributes':_0x165440['attributes'],'include':_0x165440[_0xe9f0('0x1c')]?_[_0xe9f0('0x1d')](_0x165440[_0xe9f0('0x1c')],function(_0x4d4186){return{'model':db[_0x4d4186['model']],'as':_0x4d4186['as'],'attributes':_0x4d4186[_0xe9f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9f0('0xb')](function(_0x1917c8){logger['info'](_0xe9f0('0x20'),_0x3dbe49);logger[_0xe9f0('0xf')](_0xe9f0('0x20'),_0x3dbe49,JSON[_0xe9f0('0x11')](_0x1917c8));_0x617ad3(_0x1917c8);})[_0xe9f0('0x15')](function(_0x552ec2){logger[_0xe9f0('0x12')](_0xe9f0('0x20'),_0x552ec2[_0xe9f0('0x13')],_0x3dbe49);_0x445ad0(_0x22806c['error'](0x1f4,_0x552ec2[_0xe9f0('0x13')]));});});}; \ No newline at end of file +var _0xc4aa=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowFreshsalesAccount','lodash','util','moment'];(function(_0x72d4c5,_0x41e674){var _0x3d2059=function(_0x4a150a){while(--_0x4a150a){_0x72d4c5['push'](_0x72d4c5['shift']());}};_0x3d2059(++_0x41e674);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'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')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')]({'raw':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x19')]===undefined?!![]:![]:!![],'where':_0x28e304[_0xac4a('0x18')]?_0x28e304[_0xac4a('0x18')][_0xac4a('0x1a')]||null:null,'attributes':_0x28e304[_0xac4a('0x18')]?_0x28e304[_0xac4a('0x18')][_0xac4a('0x1b')]||null:null,'limit':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x1c')]||null:null,'include':_0x28e304[_0xac4a('0x18')]?_0x28e304['options'][_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x28e304[_0xac4a('0x18')][_0xac4a('0x1d')],function(_0x4d2d6c){return{'model':db[_0x4d2d6c[_0xac4a('0x1f')]],'as':_0x4d2d6c['as'],'attributes':_0x4d2d6c[_0xac4a('0x1b')],'include':_0x4d2d6c[_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x4d2d6c[_0xac4a('0x1d')],function(_0x2b0dc2){return{'model':db[_0x2b0dc2[_0xac4a('0x1f')]],'as':_0x2b0dc2['as'],'attributes':_0x2b0dc2[_0xac4a('0x1b')],'include':_0x2b0dc2[_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x2b0dc2[_0xac4a('0x1d')],function(_0x215a31){return{'model':db[_0x215a31[_0xac4a('0x1f')]],'as':_0x215a31['as'],'attributes':_0x215a31[_0xac4a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xac4a('0xc')](function(_0x20202c){logger['info'](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON[_0xac4a('0x20')](_0x20202c));_0x546c5d(_0x20202c);})[_0xac4a('0x14')](function(_0x4a5a9e){logger['error'](_0xac4a('0x15'),_0x4a5a9e[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x4a5a9e['message']));});});};exports['ShowFreshsalesAccount']=function(_0x355755){var _0x2896bc=this;return new Promise(function(_0x228629,_0x432066){return db[_0xac4a('0x16')]['find']({'raw':_0x355755[_0xac4a('0x18')]?_0x355755['options'][_0xac4a('0x19')]===undefined?!![]:![]:!![],'where':_0x355755['options']?_0x355755[_0xac4a('0x18')][_0xac4a('0x1a')]||null:null,'attributes':_0x355755[_0xac4a('0x18')]?_0x355755[_0xac4a('0x18')][_0xac4a('0x1b')]||null:null,'include':_0x355755[_0xac4a('0x18')]?_0x355755[_0xac4a('0x18')][_0xac4a('0x1d')]?_[_0xac4a('0x1e')](_0x355755[_0xac4a('0x18')][_0xac4a('0x1d')],function(_0x1634df){return{'model':db[_0x1634df[_0xac4a('0x1f')]],'as':_0x1634df['as'],'attributes':_0x1634df[_0xac4a('0x1b')],'include':_0x1634df['include']?_[_0xac4a('0x1e')](_0x1634df[_0xac4a('0x1d')],function(_0x5a4e2b){return{'model':db[_0x5a4e2b[_0xac4a('0x1f')]],'as':_0x5a4e2b['as'],'attributes':_0x5a4e2b[_0xac4a('0x1b')],'include':_0x5a4e2b['include']?_['map'](_0x5a4e2b[_0xac4a('0x1d')],function(_0x1ba096){return{'model':db[_0x1ba096[_0xac4a('0x1f')]],'as':_0x1ba096['as'],'attributes':_0x1ba096[_0xac4a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x453d02){logger[_0xac4a('0x13')]('ShowFreshsalesAccount',_0x355755);logger[_0xac4a('0xf')](_0xac4a('0x21'),_0x355755,JSON[_0xac4a('0x20')](_0x453d02));_0x228629(_0x453d02);})['catch'](function(_0x121328){logger[_0xac4a('0x10')](_0xac4a('0x21'),_0x121328['message'],_0x355755);_0x432066(_0x2896bc[_0xac4a('0x10')](0x1f4,_0x121328[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 45e42cf..fab1fb6 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 _0x2df9=['express','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','/:id/subjects','getDescriptions','getFields','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2df9,0xd9));var _0x92df=function(_0xe0444c,_0x5acdf5){_0xe0444c=_0xe0444c-0x0;var _0x232b2d=_0x2df9[_0xe0444c];return _0x232b2d;};'use strict';var multer=require(_0x92df('0x0'));var util=require(_0x92df('0x1'));var path=require('path');var timeout=require(_0x92df('0x2'));var express=require(_0x92df('0x3'));var router=express['Router']();var fs_extra=require(_0x92df('0x4'));var auth=require(_0x92df('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x92df('0x6')]('/',auth[_0x92df('0x7')](),controller[_0x92df('0x8')]);router[_0x92df('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x92df('0x9')]);router['get'](_0x92df('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x92df('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x92df('0xb')]);router[_0x92df('0x6')]('/:id/fields',auth[_0x92df('0x7')](),controller[_0x92df('0xc')]);router[_0x92df('0xd')]('/',auth['isAuthenticated'](),controller[_0x92df('0xe')]);router[_0x92df('0xf')](_0x92df('0x10'),auth[_0x92df('0x7')](),controller[_0x92df('0x11')]);router['delete']('/:id',auth[_0x92df('0x7')](),controller[_0x92df('0x12')]);module[_0x92df('0x13')]=router; \ No newline at end of file +var _0x58d7=['path','connect-timeout','Router','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x58d7,0x143));var _0x758d=function(_0x32aff7,_0x5d341f){_0x32aff7=_0x32aff7-0x0;var _0x1ec21c=_0x58d7[_0x32aff7];return _0x1ec21c;};'use strict';var multer=require(_0x758d('0x0'));var util=require(_0x758d('0x1'));var path=require(_0x758d('0x2'));var timeout=require(_0x758d('0x3'));var express=require('express');var router=express[_0x758d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x758d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x758d('0x6'));router[_0x758d('0x7')]('/',auth[_0x758d('0x8')](),controller[_0x758d('0x9')]);router['get'](_0x758d('0xa'),auth[_0x758d('0x8')](),controller[_0x758d('0xb')]);router[_0x758d('0x7')](_0x758d('0xc'),auth[_0x758d('0x8')](),controller[_0x758d('0xd')]);router['get'](_0x758d('0xe'),auth[_0x758d('0x8')](),controller[_0x758d('0xf')]);router[_0x758d('0x7')](_0x758d('0x10'),auth['isAuthenticated'](),controller[_0x758d('0x11')]);router[_0x758d('0x12')]('/',auth['isAuthenticated'](),controller[_0x758d('0x13')]);router[_0x758d('0x14')](_0x758d('0xa'),auth[_0x758d('0x8')](),controller[_0x758d('0x15')]);router[_0x758d('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x758d('0x17')]);module[_0x758d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 892c2a4..c5d00e1 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 _0x9bee=['STRING','sequelize','exports'];(function(_0x5dad01,_0x51ee76){var _0x596e37=function(_0x5abc73){while(--_0x5abc73){_0x5dad01['push'](_0x5dad01['shift']());}};_0x596e37(++_0x51ee76);}(_0x9bee,0x1a5));var _0xe9be=function(_0x2ffcec,_0x3c7db8){_0x2ffcec=_0x2ffcec-0x0;var _0x11d00f=_0x9bee[_0x2ffcec];return _0x11d00f;};'use strict';var Sequelize=require(_0xe9be('0x0'));module[_0xe9be('0x1')]={'name':{'type':Sequelize[_0xe9be('0x2')]},'description':{'type':Sequelize[_0xe9be('0x2')]}}; \ No newline at end of file +var _0xa386=['STRING','sequelize','exports'];(function(_0x1f6e4b,_0x2972cf){var _0xab3772=function(_0x308b5f){while(--_0x308b5f){_0x1f6e4b['push'](_0x1f6e4b['shift']());}};_0xab3772(++_0x2972cf);}(_0xa386,0x1ba));var _0x6a38=function(_0x203a81,_0x37aefa){_0x203a81=_0x203a81-0x0;var _0x5b45f8=_0xa386[_0x203a81];return _0x5b45f8;};'use strict';var Sequelize=require(_0x6a38('0x0'));module[_0x6a38('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6a38('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f26a241..c655d24 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 _0x927c=['order','filter','getSubjects','getDescriptions','getFields','rimraf','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','options','count','findAll','rows','show','params','keys','includeAll','include','find','catch','create','body','findOne','FreshsalesField'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x927c,0x190));var _0xc927=function(_0x44480d,_0x1c8b29){_0x44480d=_0x44480d-0x0;var _0x18063f=_0x927c[_0x44480d];return _0x18063f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc927('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc927('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc927('0x2'));var path=require(_0xc927('0x3'));var sox=require(_0xc927('0x4'));var csv=require(_0xc927('0x5'));var ejs=require(_0xc927('0x6'));var fs=require('fs');var fs_extra=require(_0xc927('0x7'));var _=require(_0xc927('0x8'));var squel=require(_0xc927('0x9'));var crypto=require('crypto');var jsforce=require(_0xc927('0xa'));var deskjs=require(_0xc927('0xb'));var toCsv=require(_0xc927('0x5'));var querystring=require(_0xc927('0xc'));var Papa=require(_0xc927('0xd'));var Redis=require(_0xc927('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc927('0xf'));var as=require(_0xc927('0x10'));var hardwareService=require(_0xc927('0x11'));var logger=require('../../config/logger')(_0xc927('0x12'));var utils=require('../../config/utils');var config=require(_0xc927('0x13'));var licenseUtil=require(_0xc927('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c2d7b,_0x282004){_0x282004=_0x282004||0xcc;return function(_0x18a801){if(_0x18a801){return _0x3c2d7b[_0xc927('0x15')](_0x282004);}return _0x3c2d7b[_0xc927('0x16')](_0x282004)[_0xc927('0x17')]();};}function respondWithResult(_0x577d1f,_0x4389c1){_0x4389c1=_0x4389c1||0xc8;return function(_0x21b212){if(_0x21b212){return _0x577d1f[_0xc927('0x16')](_0x4389c1)[_0xc927('0x18')](_0x21b212);}};}function respondWithFilteredResult(_0xc25525,_0x1fc930){return function(_0x3a7349){if(_0x3a7349){var _0x1a929a=typeof _0x1fc930['offset']===_0xc927('0x19')&&typeof _0x1fc930[_0xc927('0x1a')]===_0xc927('0x19');var _0x5130c9=_0x3a7349['count'];var _0x52cfc0=_0x1a929a?0x0:_0x1fc930[_0xc927('0x1b')];var _0x2caaec=_0x1a929a?_0x3a7349['count']:_0x1fc930[_0xc927('0x1b')]+_0x1fc930['limit'];var _0x1bb3a4;if(_0x2caaec>=_0x5130c9){_0x2caaec=_0x5130c9;_0x1bb3a4=0xc8;}else{_0x1bb3a4=0xce;}_0xc25525[_0xc927('0x16')](_0x1bb3a4);return _0xc25525[_0xc927('0x1c')](_0xc927('0x1d'),_0x52cfc0+'-'+_0x2caaec+'/'+_0x5130c9)[_0xc927('0x18')](_0x3a7349);}return null;};}function patchUpdates(_0x823d10){return function(_0x102441){try{jsonpatch[_0xc927('0x1e')](_0x102441,_0x823d10,!![]);}catch(_0x8a1262){return BPromise['reject'](_0x8a1262);}return _0x102441[_0xc927('0x1f')]();};}function saveUpdates(_0x49f32e,_0x2608f5){return function(_0x59390c){if(_0x59390c){return _0x59390c[_0xc927('0x20')](_0x49f32e)[_0xc927('0x21')](function(_0x5c7eed){return _0x5c7eed;});}return null;};}function removeEntity(_0x3c20b4,_0x305853){return function(_0x3bafdd){if(_0x3bafdd){return _0x3bafdd[_0xc927('0x22')]()['then'](function(){_0x3c20b4[_0xc927('0x16')](0xcc)[_0xc927('0x17')]();});}};}function handleEntityNotFound(_0x58f5cc,_0x4297e7){return function(_0x5ee123){if(!_0x5ee123){_0x58f5cc['sendStatus'](0x194);}return _0x5ee123;};}function handleError(_0x2d1f35,_0x13943e){_0x13943e=_0x13943e||0x1f4;return function(_0x49b2aa){logger[_0xc927('0x23')](_0x49b2aa[_0xc927('0x24')]);if(_0x49b2aa[_0xc927('0x25')]){delete _0x49b2aa['name'];}_0x2d1f35[_0xc927('0x16')](_0x13943e)[_0xc927('0x26')](_0x49b2aa);};}exports[_0xc927('0x27')]=function(_0x365dd4,_0x14637e){var _0x39c5cb={},_0x56e5db={},_0x72ddc8={'count':0x0,'rows':[]};var _0x3cc3b8=_[_0xc927('0x28')](db[_0xc927('0x29')][_0xc927('0x2a')],function(_0x15e848){return{'name':_0x15e848[_0xc927('0x2b')],'type':_0x15e848['type'][_0xc927('0x2c')]};});_0x56e5db[_0xc927('0x2d')]=_[_0xc927('0x28')](_0x3cc3b8,_0xc927('0x25'));_0x56e5db[_0xc927('0x2e')]=_['keys'](_0x365dd4[_0xc927('0x2e')]);_0x56e5db[_0xc927('0x2f')]=_[_0xc927('0x30')](_0x56e5db[_0xc927('0x2d')],_0x56e5db[_0xc927('0x2e')]);_0x39c5cb[_0xc927('0x31')]=_[_0xc927('0x30')](_0x56e5db[_0xc927('0x2d')],qs[_0xc927('0x32')](_0x365dd4['query']['fields']));_0x39c5cb['attributes']=_0x39c5cb[_0xc927('0x31')][_0xc927('0x33')]?_0x39c5cb[_0xc927('0x31')]:_0x56e5db[_0xc927('0x2d')];if(!_0x365dd4[_0xc927('0x2e')][_0xc927('0x34')](_0xc927('0x35'))){_0x39c5cb['limit']=qs['limit'](_0x365dd4[_0xc927('0x2e')][_0xc927('0x1a')]);_0x39c5cb[_0xc927('0x1b')]=qs[_0xc927('0x1b')](_0x365dd4[_0xc927('0x2e')][_0xc927('0x1b')]);}_0x39c5cb['order']=qs[_0xc927('0x36')](_0x365dd4[_0xc927('0x2e')][_0xc927('0x36')]);_0x39c5cb[_0xc927('0x37')]=qs[_0xc927('0x2f')](_[_0xc927('0x38')](_0x365dd4[_0xc927('0x2e')],_0x56e5db[_0xc927('0x2f')]),_0x3cc3b8);if(_0x365dd4[_0xc927('0x2e')]['filter']){_0x39c5cb[_0xc927('0x37')]=_[_0xc927('0x39')](_0x39c5cb[_0xc927('0x37')],{'$or':_['map'](_0x3cc3b8,function(_0x146340){if(_0x146340[_0xc927('0x3a')]!=='VIRTUAL'){var _0x592352={};_0x592352[_0x146340['name']]={'$like':'%'+_0x365dd4[_0xc927('0x2e')]['filter']+'%'};return _0x592352;}})});}_0x39c5cb=_[_0xc927('0x39')]({},_0x39c5cb,_0x365dd4[_0xc927('0x3b')]);var _0xfbe84b={'where':_0x39c5cb[_0xc927('0x37')]};return db['FreshsalesConfiguration'][_0xc927('0x3c')](_0xfbe84b)['then'](function(_0x4df72b){_0x72ddc8[_0xc927('0x3c')]=_0x4df72b;if(_0x365dd4['query']['includeAll']){_0x39c5cb['include']=[{'all':!![]}];}return db[_0xc927('0x29')][_0xc927('0x3d')](_0x39c5cb);})[_0xc927('0x21')](function(_0x163428){_0x72ddc8[_0xc927('0x3e')]=_0x163428;return _0x72ddc8;})['then'](respondWithFilteredResult(_0x14637e,_0x39c5cb))['catch'](handleError(_0x14637e,null));};exports[_0xc927('0x3f')]=function(_0x29a2d9,_0x4af5a9){var _0x4ebc4d={'raw':![],'where':{'id':_0x29a2d9[_0xc927('0x40')]['id']}},_0xaf2a56={};_0xaf2a56[_0xc927('0x2d')]=_[_0xc927('0x41')](db[_0xc927('0x29')][_0xc927('0x2a')]);_0xaf2a56[_0xc927('0x2e')]=_[_0xc927('0x41')](_0x29a2d9[_0xc927('0x2e')]);_0xaf2a56[_0xc927('0x2f')]=_['intersection'](_0xaf2a56[_0xc927('0x2d')],_0xaf2a56[_0xc927('0x2e')]);_0x4ebc4d['attributes']=_[_0xc927('0x30')](_0xaf2a56[_0xc927('0x2d')],qs[_0xc927('0x32')](_0x29a2d9[_0xc927('0x2e')][_0xc927('0x32')]));_0x4ebc4d[_0xc927('0x31')]=_0x4ebc4d[_0xc927('0x31')][_0xc927('0x33')]?_0x4ebc4d[_0xc927('0x31')]:_0xaf2a56[_0xc927('0x2d')];if(_0x29a2d9[_0xc927('0x2e')][_0xc927('0x42')]){_0x4ebc4d[_0xc927('0x43')]=[{'all':!![]}];}_0x4ebc4d=_[_0xc927('0x39')]({},_0x4ebc4d,_0x29a2d9[_0xc927('0x3b')]);return db[_0xc927('0x29')][_0xc927('0x44')](_0x4ebc4d)[_0xc927('0x21')](handleEntityNotFound(_0x4af5a9,null))['then'](respondWithResult(_0x4af5a9,null))[_0xc927('0x45')](handleError(_0x4af5a9,null));};exports[_0xc927('0x46')]=function(_0x4722db,_0x2b0547){return db[_0xc927('0x29')]['create'](_0x4722db[_0xc927('0x47')],{})[_0xc927('0x21')](respondWithResult(_0x2b0547,0xc9))[_0xc927('0x45')](handleError(_0x2b0547,null));};exports['update']=function(_0x5db522,_0x2cbd66){if(_0x5db522[_0xc927('0x47')]['id']){delete _0x5db522['body']['id'];}return db[_0xc927('0x29')]['find']({'where':{'id':_0x5db522[_0xc927('0x40')]['id']}})[_0xc927('0x21')](handleEntityNotFound(_0x2cbd66,null))[_0xc927('0x21')](saveUpdates(_0x5db522['body'],null))[_0xc927('0x21')](respondWithResult(_0x2cbd66,null))[_0xc927('0x45')](handleError(_0x2cbd66,null));};exports[_0xc927('0x22')]=function(_0x50b176,_0x5b3004){return db[_0xc927('0x29')][_0xc927('0x44')]({'where':{'id':_0x50b176[_0xc927('0x40')]['id']}})[_0xc927('0x21')](handleEntityNotFound(_0x5b3004,null))[_0xc927('0x21')](removeEntity(_0x5b3004,null))[_0xc927('0x45')](handleError(_0x5b3004,null));};exports['getSubjects']=function(_0x359f0c,_0x375f3e,_0x4f670b){var _0xc23311={};var _0x1b84e8={};var _0x27c274;var _0x51a2f9;return db[_0xc927('0x29')][_0xc927('0x48')]({'where':{'id':_0x359f0c[_0xc927('0x40')]['id']}})['then'](handleEntityNotFound(_0x375f3e,null))[_0xc927('0x21')](function(_0x3ef13d){if(_0x3ef13d){_0x27c274=_0x3ef13d;_0x1b84e8[_0xc927('0x2d')]=_[_0xc927('0x41')](db[_0xc927('0x49')][_0xc927('0x2a')]);_0x1b84e8[_0xc927('0x2e')]=_[_0xc927('0x41')](_0x359f0c[_0xc927('0x2e')]);_0x1b84e8[_0xc927('0x2f')]=_[_0xc927('0x30')](_0x1b84e8['model'],_0x1b84e8[_0xc927('0x2e')]);_0xc23311[_0xc927('0x31')]=_[_0xc927('0x30')](_0x1b84e8[_0xc927('0x2d')],qs['fields'](_0x359f0c[_0xc927('0x2e')][_0xc927('0x32')]));_0xc23311[_0xc927('0x31')]=_0xc23311[_0xc927('0x31')][_0xc927('0x33')]?_0xc23311[_0xc927('0x31')]:_0x1b84e8[_0xc927('0x2d')];_0xc23311[_0xc927('0x4a')]=qs[_0xc927('0x36')](_0x359f0c['query'][_0xc927('0x36')]);_0xc23311[_0xc927('0x37')]=qs['filters'](_[_0xc927('0x38')](_0x359f0c[_0xc927('0x2e')],_0x1b84e8[_0xc927('0x2f')]));if(_0x359f0c[_0xc927('0x2e')][_0xc927('0x4b')]){_0xc23311[_0xc927('0x37')]=_[_0xc927('0x39')](_0xc23311[_0xc927('0x37')],{'$or':_['map'](_0xc23311['attributes'],function(_0x17f887){var _0x1d9ef8={};_0x1d9ef8[_0x17f887]={'$like':'%'+_0x359f0c[_0xc927('0x2e')][_0xc927('0x4b')]+'%'};return _0x1d9ef8;})});}_0xc23311=_['merge']({},_0xc23311,_0x359f0c[_0xc927('0x3b')]);return _0x27c274[_0xc927('0x4c')](_0xc23311);}})[_0xc927('0x21')](function(_0x7a4f14){if(_0x7a4f14){_0x51a2f9=_0x7a4f14['length'];if(!_0x359f0c['query'][_0xc927('0x34')]('nolimit')){_0xc23311[_0xc927('0x1a')]=qs[_0xc927('0x1a')](_0x359f0c[_0xc927('0x2e')][_0xc927('0x1a')]);_0xc23311[_0xc927('0x1b')]=qs[_0xc927('0x1b')](_0x359f0c[_0xc927('0x2e')][_0xc927('0x1b')]);}return _0x27c274[_0xc927('0x4c')](_0xc23311);}})['then'](function(_0xd1518d){if(_0xd1518d){return _0xd1518d?{'count':_0x51a2f9,'rows':_0xd1518d}:null;}})[_0xc927('0x21')](respondWithResult(_0x375f3e,null))[_0xc927('0x45')](handleError(_0x375f3e,null));};exports[_0xc927('0x4d')]=function(_0x39ad5e,_0x2d6d3b,_0x11fd5c){var _0x1f7d99={};var _0x2b080e={};var _0x2398ab;var _0x229d62;return db[_0xc927('0x29')][_0xc927('0x48')]({'where':{'id':_0x39ad5e['params']['id']}})[_0xc927('0x21')](handleEntityNotFound(_0x2d6d3b,null))['then'](function(_0x1213e0){if(_0x1213e0){_0x2398ab=_0x1213e0;_0x2b080e[_0xc927('0x2d')]=_[_0xc927('0x41')](db[_0xc927('0x49')][_0xc927('0x2a')]);_0x2b080e[_0xc927('0x2e')]=_[_0xc927('0x41')](_0x39ad5e['query']);_0x2b080e[_0xc927('0x2f')]=_['intersection'](_0x2b080e[_0xc927('0x2d')],_0x2b080e[_0xc927('0x2e')]);_0x1f7d99['attributes']=_['intersection'](_0x2b080e['model'],qs['fields'](_0x39ad5e['query'][_0xc927('0x32')]));_0x1f7d99[_0xc927('0x31')]=_0x1f7d99['attributes'][_0xc927('0x33')]?_0x1f7d99[_0xc927('0x31')]:_0x2b080e['model'];_0x1f7d99[_0xc927('0x4a')]=qs[_0xc927('0x36')](_0x39ad5e[_0xc927('0x2e')]['sort']);_0x1f7d99[_0xc927('0x37')]=qs[_0xc927('0x2f')](_[_0xc927('0x38')](_0x39ad5e['query'],_0x2b080e[_0xc927('0x2f')]));if(_0x39ad5e['query'][_0xc927('0x4b')]){_0x1f7d99[_0xc927('0x37')]=_[_0xc927('0x39')](_0x1f7d99[_0xc927('0x37')],{'$or':_[_0xc927('0x28')](_0x1f7d99[_0xc927('0x31')],function(_0xc81524){var _0x17cd6e={};_0x17cd6e[_0xc81524]={'$like':'%'+_0x39ad5e[_0xc927('0x2e')]['filter']+'%'};return _0x17cd6e;})});}_0x1f7d99=_[_0xc927('0x39')]({},_0x1f7d99,_0x39ad5e[_0xc927('0x3b')]);return _0x2398ab[_0xc927('0x4d')](_0x1f7d99);}})['then'](function(_0x4af815){if(_0x4af815){_0x229d62=_0x4af815[_0xc927('0x33')];if(!_0x39ad5e['query'][_0xc927('0x34')](_0xc927('0x35'))){_0x1f7d99[_0xc927('0x1a')]=qs['limit'](_0x39ad5e[_0xc927('0x2e')][_0xc927('0x1a')]);_0x1f7d99[_0xc927('0x1b')]=qs[_0xc927('0x1b')](_0x39ad5e[_0xc927('0x2e')][_0xc927('0x1b')]);}return _0x2398ab['getDescriptions'](_0x1f7d99);}})['then'](function(_0x1e23b7){if(_0x1e23b7){return _0x1e23b7?{'count':_0x229d62,'rows':_0x1e23b7}:null;}})['then'](respondWithResult(_0x2d6d3b,null))['catch'](handleError(_0x2d6d3b,null));};exports[_0xc927('0x4e')]=function(_0x3e8c09,_0x16192b,_0x4cb91c){var _0x4f6606={};var _0x25d0cf={};var _0x29356d;var _0x242cf1;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x3e8c09[_0xc927('0x40')]['id']}})['then'](handleEntityNotFound(_0x16192b,null))['then'](function(_0xa407a7){if(_0xa407a7){_0x29356d=_0xa407a7;_0x25d0cf[_0xc927('0x2d')]=_[_0xc927('0x41')](db[_0xc927('0x49')][_0xc927('0x2a')]);_0x25d0cf[_0xc927('0x2e')]=_[_0xc927('0x41')](_0x3e8c09[_0xc927('0x2e')]);_0x25d0cf[_0xc927('0x2f')]=_[_0xc927('0x30')](_0x25d0cf['model'],_0x25d0cf[_0xc927('0x2e')]);_0x4f6606['attributes']=_[_0xc927('0x30')](_0x25d0cf[_0xc927('0x2d')],qs[_0xc927('0x32')](_0x3e8c09['query']['fields']));_0x4f6606[_0xc927('0x31')]=_0x4f6606[_0xc927('0x31')][_0xc927('0x33')]?_0x4f6606[_0xc927('0x31')]:_0x25d0cf[_0xc927('0x2d')];_0x4f6606['order']=qs[_0xc927('0x36')](_0x3e8c09[_0xc927('0x2e')][_0xc927('0x36')]);_0x4f6606[_0xc927('0x37')]=qs['filters'](_[_0xc927('0x38')](_0x3e8c09[_0xc927('0x2e')],_0x25d0cf[_0xc927('0x2f')]));if(_0x3e8c09[_0xc927('0x2e')][_0xc927('0x4b')]){_0x4f6606['where']=_['merge'](_0x4f6606['where'],{'$or':_[_0xc927('0x28')](_0x4f6606[_0xc927('0x31')],function(_0x360a85){var _0x1980b2={};_0x1980b2[_0x360a85]={'$like':'%'+_0x3e8c09[_0xc927('0x2e')][_0xc927('0x4b')]+'%'};return _0x1980b2;})});}_0x4f6606=_[_0xc927('0x39')]({},_0x4f6606,_0x3e8c09[_0xc927('0x3b')]);return _0x29356d[_0xc927('0x4e')](_0x4f6606);}})[_0xc927('0x21')](function(_0x5ed535){if(_0x5ed535){_0x242cf1=_0x5ed535[_0xc927('0x33')];if(!_0x3e8c09['query'][_0xc927('0x34')](_0xc927('0x35'))){_0x4f6606[_0xc927('0x1a')]=qs[_0xc927('0x1a')](_0x3e8c09[_0xc927('0x2e')][_0xc927('0x1a')]);_0x4f6606[_0xc927('0x1b')]=qs[_0xc927('0x1b')](_0x3e8c09[_0xc927('0x2e')][_0xc927('0x1b')]);}return _0x29356d[_0xc927('0x4e')](_0x4f6606);}})[_0xc927('0x21')](function(_0x406d3c){if(_0x406d3c){return _0x406d3c?{'count':_0x242cf1,'rows':_0x406d3c}:null;}})[_0xc927('0x21')](respondWithResult(_0x16192b,null))['catch'](handleError(_0x16192b,null));}; \ No newline at end of file +var _0x5aea=['update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','options','include','findAll','rows','catch','rawAttributes','includeAll','find','create','body','params','getSubjects','FreshsalesField','order','nolimit','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','save'];(function(_0x41a1f0,_0x38013a){var _0x146553=function(_0xefa433){while(--_0xefa433){_0x41a1f0['push'](_0x41a1f0['shift']());}};_0x146553(++_0x38013a);}(_0x5aea,0xd0));var _0xa5ae=function(_0x3116b6,_0x52a819){_0x3116b6=_0x3116b6-0x0;var _0x4a5bef=_0x5aea[_0x3116b6];return _0x4a5bef;};'use strict';var emlformat=require(_0xa5ae('0x0'));var rimraf=require(_0xa5ae('0x1'));var zipdir=require(_0xa5ae('0x2'));var jsonpatch=require(_0xa5ae('0x3'));var rp=require(_0xa5ae('0x4'));var moment=require(_0xa5ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa5ae('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa5ae('0x7'));var csv=require('to-csv');var ejs=require(_0xa5ae('0x8'));var fs=require('fs');var fs_extra=require(_0xa5ae('0x9'));var _=require(_0xa5ae('0xa'));var squel=require(_0xa5ae('0xb'));var crypto=require(_0xa5ae('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa5ae('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa5ae('0xe'));var Papa=require(_0xa5ae('0xf'));var Redis=require(_0xa5ae('0x10'));var authService=require(_0xa5ae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa5ae('0x12'));var hardwareService=require(_0xa5ae('0x13'));var logger=require(_0xa5ae('0x14'))(_0xa5ae('0x15'));var utils=require(_0xa5ae('0x16'));var config=require(_0xa5ae('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5ae('0x18'))['db'];function respondWithStatusCode(_0x2cdd6b,_0x3cdabb){_0x3cdabb=_0x3cdabb||0xcc;return function(_0x413fcb){if(_0x413fcb){return _0x2cdd6b['sendStatus'](_0x3cdabb);}return _0x2cdd6b[_0xa5ae('0x19')](_0x3cdabb)[_0xa5ae('0x1a')]();};}function respondWithResult(_0x5cbcdb,_0x6c6f65){_0x6c6f65=_0x6c6f65||0xc8;return function(_0x313d9a){if(_0x313d9a){return _0x5cbcdb[_0xa5ae('0x19')](_0x6c6f65)[_0xa5ae('0x1b')](_0x313d9a);}};}function respondWithFilteredResult(_0x2b9bd2,_0x6d5a3a){return function(_0x51b742){if(_0x51b742){var _0x1756a0=typeof _0x6d5a3a['offset']===_0xa5ae('0x1c')&&typeof _0x6d5a3a[_0xa5ae('0x1d')]===_0xa5ae('0x1c');var _0x5cfc30=_0x51b742['count'];var _0x6635ef=_0x1756a0?0x0:_0x6d5a3a[_0xa5ae('0x1e')];var _0x47f2c0=_0x1756a0?_0x51b742[_0xa5ae('0x1f')]:_0x6d5a3a[_0xa5ae('0x1e')]+_0x6d5a3a['limit'];var _0x69ad49;if(_0x47f2c0>=_0x5cfc30){_0x47f2c0=_0x5cfc30;_0x69ad49=0xc8;}else{_0x69ad49=0xce;}_0x2b9bd2['status'](_0x69ad49);return _0x2b9bd2[_0xa5ae('0x20')](_0xa5ae('0x21'),_0x6635ef+'-'+_0x47f2c0+'/'+_0x5cfc30)[_0xa5ae('0x1b')](_0x51b742);}return null;};}function patchUpdates(_0x4b467e){return function(_0x20d018){try{jsonpatch['apply'](_0x20d018,_0x4b467e,!![]);}catch(_0x6938e6){return BPromise['reject'](_0x6938e6);}return _0x20d018[_0xa5ae('0x22')]();};}function saveUpdates(_0x3c9088,_0x143a1d){return function(_0xc0462e){if(_0xc0462e){return _0xc0462e[_0xa5ae('0x23')](_0x3c9088)[_0xa5ae('0x24')](function(_0x10ae81){return _0x10ae81;});}return null;};}function removeEntity(_0x5d5631,_0xd9b8e9){return function(_0x3a2695){if(_0x3a2695){return _0x3a2695[_0xa5ae('0x25')]()[_0xa5ae('0x24')](function(){_0x5d5631[_0xa5ae('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x568fb0,_0x4b7b01){return function(_0x1d646a){if(!_0x1d646a){_0x568fb0[_0xa5ae('0x26')](0x194);}return _0x1d646a;};}function handleError(_0x41710c,_0x178239){_0x178239=_0x178239||0x1f4;return function(_0x30abf4){logger[_0xa5ae('0x27')](_0x30abf4[_0xa5ae('0x28')]);if(_0x30abf4[_0xa5ae('0x29')]){delete _0x30abf4[_0xa5ae('0x29')];}_0x41710c[_0xa5ae('0x19')](_0x178239)[_0xa5ae('0x2a')](_0x30abf4);};}exports[_0xa5ae('0x2b')]=function(_0x56a87c,_0x2f6986){var _0x21c193={},_0x231a79={},_0x3b9d4f={'count':0x0,'rows':[]};var _0x1b4b4f=_[_0xa5ae('0x2c')](db[_0xa5ae('0x2d')]['rawAttributes'],function(_0xd1888f){return{'name':_0xd1888f[_0xa5ae('0x2e')],'type':_0xd1888f[_0xa5ae('0x2f')][_0xa5ae('0x30')]};});_0x231a79[_0xa5ae('0x31')]=_[_0xa5ae('0x2c')](_0x1b4b4f,_0xa5ae('0x29'));_0x231a79[_0xa5ae('0x32')]=_[_0xa5ae('0x33')](_0x56a87c[_0xa5ae('0x32')]);_0x231a79[_0xa5ae('0x34')]=_[_0xa5ae('0x35')](_0x231a79[_0xa5ae('0x31')],_0x231a79[_0xa5ae('0x32')]);_0x21c193[_0xa5ae('0x36')]=_[_0xa5ae('0x35')](_0x231a79[_0xa5ae('0x31')],qs[_0xa5ae('0x37')](_0x56a87c[_0xa5ae('0x32')][_0xa5ae('0x37')]));_0x21c193[_0xa5ae('0x36')]=_0x21c193[_0xa5ae('0x36')][_0xa5ae('0x38')]?_0x21c193['attributes']:_0x231a79[_0xa5ae('0x31')];if(!_0x56a87c['query'][_0xa5ae('0x39')]('nolimit')){_0x21c193[_0xa5ae('0x1d')]=qs[_0xa5ae('0x1d')](_0x56a87c['query'][_0xa5ae('0x1d')]);_0x21c193['offset']=qs[_0xa5ae('0x1e')](_0x56a87c['query'][_0xa5ae('0x1e')]);}_0x21c193['order']=qs[_0xa5ae('0x3a')](_0x56a87c[_0xa5ae('0x32')][_0xa5ae('0x3a')]);_0x21c193[_0xa5ae('0x3b')]=qs[_0xa5ae('0x34')](_[_0xa5ae('0x3c')](_0x56a87c[_0xa5ae('0x32')],_0x231a79[_0xa5ae('0x34')]),_0x1b4b4f);if(_0x56a87c[_0xa5ae('0x32')]['filter']){_0x21c193[_0xa5ae('0x3b')]=_[_0xa5ae('0x3d')](_0x21c193['where'],{'$or':_['map'](_0x1b4b4f,function(_0x3d69d0){if(_0x3d69d0[_0xa5ae('0x2f')]!=='VIRTUAL'){var _0x5b302c={};_0x5b302c[_0x3d69d0['name']]={'$like':'%'+_0x56a87c['query'][_0xa5ae('0x3e')]+'%'};return _0x5b302c;}})});}_0x21c193=_[_0xa5ae('0x3d')]({},_0x21c193,_0x56a87c[_0xa5ae('0x3f')]);var _0x5a8ff7={'where':_0x21c193[_0xa5ae('0x3b')]};return db[_0xa5ae('0x2d')][_0xa5ae('0x1f')](_0x5a8ff7)['then'](function(_0x340a74){_0x3b9d4f['count']=_0x340a74;if(_0x56a87c['query']['includeAll']){_0x21c193[_0xa5ae('0x40')]=[{'all':!![]}];}return db[_0xa5ae('0x2d')][_0xa5ae('0x41')](_0x21c193);})['then'](function(_0x2a75a0){_0x3b9d4f[_0xa5ae('0x42')]=_0x2a75a0;return _0x3b9d4f;})[_0xa5ae('0x24')](respondWithFilteredResult(_0x2f6986,_0x21c193))[_0xa5ae('0x43')](handleError(_0x2f6986,null));};exports['show']=function(_0x57b94a,_0x227df5){var _0x398747={'raw':![],'where':{'id':_0x57b94a['params']['id']}},_0x58ee73={};_0x58ee73['model']=_[_0xa5ae('0x33')](db['FreshsalesConfiguration'][_0xa5ae('0x44')]);_0x58ee73[_0xa5ae('0x32')]=_[_0xa5ae('0x33')](_0x57b94a[_0xa5ae('0x32')]);_0x58ee73[_0xa5ae('0x34')]=_[_0xa5ae('0x35')](_0x58ee73['model'],_0x58ee73[_0xa5ae('0x32')]);_0x398747['attributes']=_[_0xa5ae('0x35')](_0x58ee73[_0xa5ae('0x31')],qs[_0xa5ae('0x37')](_0x57b94a[_0xa5ae('0x32')][_0xa5ae('0x37')]));_0x398747[_0xa5ae('0x36')]=_0x398747['attributes']['length']?_0x398747[_0xa5ae('0x36')]:_0x58ee73[_0xa5ae('0x31')];if(_0x57b94a[_0xa5ae('0x32')][_0xa5ae('0x45')]){_0x398747[_0xa5ae('0x40')]=[{'all':!![]}];}_0x398747=_['merge']({},_0x398747,_0x57b94a[_0xa5ae('0x3f')]);return db[_0xa5ae('0x2d')][_0xa5ae('0x46')](_0x398747)[_0xa5ae('0x24')](handleEntityNotFound(_0x227df5,null))[_0xa5ae('0x24')](respondWithResult(_0x227df5,null))[_0xa5ae('0x43')](handleError(_0x227df5,null));};exports[_0xa5ae('0x47')]=function(_0x120a4d,_0x45052a){return db[_0xa5ae('0x2d')]['create'](_0x120a4d[_0xa5ae('0x48')],{})['then'](respondWithResult(_0x45052a,0xc9))['catch'](handleError(_0x45052a,null));};exports[_0xa5ae('0x23')]=function(_0x5db8f5,_0x522034){if(_0x5db8f5[_0xa5ae('0x48')]['id']){delete _0x5db8f5[_0xa5ae('0x48')]['id'];}return db[_0xa5ae('0x2d')][_0xa5ae('0x46')]({'where':{'id':_0x5db8f5[_0xa5ae('0x49')]['id']}})[_0xa5ae('0x24')](handleEntityNotFound(_0x522034,null))[_0xa5ae('0x24')](saveUpdates(_0x5db8f5[_0xa5ae('0x48')],null))[_0xa5ae('0x24')](respondWithResult(_0x522034,null))[_0xa5ae('0x43')](handleError(_0x522034,null));};exports['destroy']=function(_0x5dc053,_0x2d37ad){return db[_0xa5ae('0x2d')][_0xa5ae('0x46')]({'where':{'id':_0x5dc053[_0xa5ae('0x49')]['id']}})[_0xa5ae('0x24')](handleEntityNotFound(_0x2d37ad,null))['then'](removeEntity(_0x2d37ad,null))[_0xa5ae('0x43')](handleError(_0x2d37ad,null));};exports[_0xa5ae('0x4a')]=function(_0x6a51a8,_0x31d070,_0x2be466){var _0x4d351b={};var _0x3d57f6={};var _0x3eb97b;var _0x4d69c0;return db[_0xa5ae('0x2d')]['findOne']({'where':{'id':_0x6a51a8[_0xa5ae('0x49')]['id']}})['then'](handleEntityNotFound(_0x31d070,null))[_0xa5ae('0x24')](function(_0x22b43d){if(_0x22b43d){_0x3eb97b=_0x22b43d;_0x3d57f6[_0xa5ae('0x31')]=_[_0xa5ae('0x33')](db[_0xa5ae('0x4b')][_0xa5ae('0x44')]);_0x3d57f6[_0xa5ae('0x32')]=_[_0xa5ae('0x33')](_0x6a51a8[_0xa5ae('0x32')]);_0x3d57f6[_0xa5ae('0x34')]=_[_0xa5ae('0x35')](_0x3d57f6[_0xa5ae('0x31')],_0x3d57f6[_0xa5ae('0x32')]);_0x4d351b['attributes']=_[_0xa5ae('0x35')](_0x3d57f6[_0xa5ae('0x31')],qs[_0xa5ae('0x37')](_0x6a51a8[_0xa5ae('0x32')][_0xa5ae('0x37')]));_0x4d351b[_0xa5ae('0x36')]=_0x4d351b['attributes'][_0xa5ae('0x38')]?_0x4d351b[_0xa5ae('0x36')]:_0x3d57f6['model'];_0x4d351b[_0xa5ae('0x4c')]=qs[_0xa5ae('0x3a')](_0x6a51a8[_0xa5ae('0x32')]['sort']);_0x4d351b[_0xa5ae('0x3b')]=qs[_0xa5ae('0x34')](_[_0xa5ae('0x3c')](_0x6a51a8[_0xa5ae('0x32')],_0x3d57f6[_0xa5ae('0x34')]));if(_0x6a51a8[_0xa5ae('0x32')][_0xa5ae('0x3e')]){_0x4d351b[_0xa5ae('0x3b')]=_[_0xa5ae('0x3d')](_0x4d351b['where'],{'$or':_[_0xa5ae('0x2c')](_0x4d351b['attributes'],function(_0x337a66){var _0x4ee6aa={};_0x4ee6aa[_0x337a66]={'$like':'%'+_0x6a51a8['query'][_0xa5ae('0x3e')]+'%'};return _0x4ee6aa;})});}_0x4d351b=_['merge']({},_0x4d351b,_0x6a51a8[_0xa5ae('0x3f')]);return _0x3eb97b[_0xa5ae('0x4a')](_0x4d351b);}})['then'](function(_0x41d233){if(_0x41d233){_0x4d69c0=_0x41d233[_0xa5ae('0x38')];if(!_0x6a51a8['query'][_0xa5ae('0x39')](_0xa5ae('0x4d'))){_0x4d351b[_0xa5ae('0x1d')]=qs[_0xa5ae('0x1d')](_0x6a51a8[_0xa5ae('0x32')]['limit']);_0x4d351b['offset']=qs[_0xa5ae('0x1e')](_0x6a51a8[_0xa5ae('0x32')]['offset']);}return _0x3eb97b[_0xa5ae('0x4a')](_0x4d351b);}})[_0xa5ae('0x24')](function(_0xb7abe1){if(_0xb7abe1){return _0xb7abe1?{'count':_0x4d69c0,'rows':_0xb7abe1}:null;}})[_0xa5ae('0x24')](respondWithResult(_0x31d070,null))[_0xa5ae('0x43')](handleError(_0x31d070,null));};exports[_0xa5ae('0x4e')]=function(_0x4bcf5e,_0x3963cd,_0x2cc06d){var _0x7439b5={};var _0x35f9be={};var _0x36d7ae;var _0x51a7a0;return db[_0xa5ae('0x2d')][_0xa5ae('0x4f')]({'where':{'id':_0x4bcf5e[_0xa5ae('0x49')]['id']}})['then'](handleEntityNotFound(_0x3963cd,null))[_0xa5ae('0x24')](function(_0x2dd799){if(_0x2dd799){_0x36d7ae=_0x2dd799;_0x35f9be[_0xa5ae('0x31')]=_[_0xa5ae('0x33')](db['FreshsalesField']['rawAttributes']);_0x35f9be['query']=_[_0xa5ae('0x33')](_0x4bcf5e['query']);_0x35f9be[_0xa5ae('0x34')]=_[_0xa5ae('0x35')](_0x35f9be[_0xa5ae('0x31')],_0x35f9be[_0xa5ae('0x32')]);_0x7439b5[_0xa5ae('0x36')]=_[_0xa5ae('0x35')](_0x35f9be[_0xa5ae('0x31')],qs[_0xa5ae('0x37')](_0x4bcf5e[_0xa5ae('0x32')][_0xa5ae('0x37')]));_0x7439b5['attributes']=_0x7439b5[_0xa5ae('0x36')][_0xa5ae('0x38')]?_0x7439b5[_0xa5ae('0x36')]:_0x35f9be['model'];_0x7439b5[_0xa5ae('0x4c')]=qs['sort'](_0x4bcf5e[_0xa5ae('0x32')]['sort']);_0x7439b5[_0xa5ae('0x3b')]=qs[_0xa5ae('0x34')](_[_0xa5ae('0x3c')](_0x4bcf5e[_0xa5ae('0x32')],_0x35f9be[_0xa5ae('0x34')]));if(_0x4bcf5e['query'][_0xa5ae('0x3e')]){_0x7439b5[_0xa5ae('0x3b')]=_['merge'](_0x7439b5[_0xa5ae('0x3b')],{'$or':_[_0xa5ae('0x2c')](_0x7439b5[_0xa5ae('0x36')],function(_0x3b7a0){var _0x1ff419={};_0x1ff419[_0x3b7a0]={'$like':'%'+_0x4bcf5e[_0xa5ae('0x32')][_0xa5ae('0x3e')]+'%'};return _0x1ff419;})});}_0x7439b5=_['merge']({},_0x7439b5,_0x4bcf5e[_0xa5ae('0x3f')]);return _0x36d7ae['getDescriptions'](_0x7439b5);}})[_0xa5ae('0x24')](function(_0x561652){if(_0x561652){_0x51a7a0=_0x561652['length'];if(!_0x4bcf5e['query'][_0xa5ae('0x39')](_0xa5ae('0x4d'))){_0x7439b5[_0xa5ae('0x1d')]=qs['limit'](_0x4bcf5e['query']['limit']);_0x7439b5[_0xa5ae('0x1e')]=qs['offset'](_0x4bcf5e[_0xa5ae('0x32')][_0xa5ae('0x1e')]);}return _0x36d7ae[_0xa5ae('0x4e')](_0x7439b5);}})[_0xa5ae('0x24')](function(_0x549b3b){if(_0x549b3b){return _0x549b3b?{'count':_0x51a7a0,'rows':_0x549b3b}:null;}})[_0xa5ae('0x24')](respondWithResult(_0x3963cd,null))[_0xa5ae('0x43')](handleError(_0x3963cd,null));};exports[_0xa5ae('0x50')]=function(_0x15278c,_0x10997d,_0x51c0e2){var _0x1554ce={};var _0x5a2cc6={};var _0x231da8;var _0x5e2e43;return db[_0xa5ae('0x2d')]['findOne']({'where':{'id':_0x15278c[_0xa5ae('0x49')]['id']}})['then'](handleEntityNotFound(_0x10997d,null))[_0xa5ae('0x24')](function(_0x467e2d){if(_0x467e2d){_0x231da8=_0x467e2d;_0x5a2cc6['model']=_[_0xa5ae('0x33')](db[_0xa5ae('0x4b')]['rawAttributes']);_0x5a2cc6[_0xa5ae('0x32')]=_[_0xa5ae('0x33')](_0x15278c[_0xa5ae('0x32')]);_0x5a2cc6[_0xa5ae('0x34')]=_[_0xa5ae('0x35')](_0x5a2cc6['model'],_0x5a2cc6[_0xa5ae('0x32')]);_0x1554ce['attributes']=_[_0xa5ae('0x35')](_0x5a2cc6[_0xa5ae('0x31')],qs['fields'](_0x15278c['query'][_0xa5ae('0x37')]));_0x1554ce[_0xa5ae('0x36')]=_0x1554ce[_0xa5ae('0x36')][_0xa5ae('0x38')]?_0x1554ce['attributes']:_0x5a2cc6['model'];_0x1554ce[_0xa5ae('0x4c')]=qs[_0xa5ae('0x3a')](_0x15278c[_0xa5ae('0x32')][_0xa5ae('0x3a')]);_0x1554ce[_0xa5ae('0x3b')]=qs[_0xa5ae('0x34')](_[_0xa5ae('0x3c')](_0x15278c[_0xa5ae('0x32')],_0x5a2cc6[_0xa5ae('0x34')]));if(_0x15278c[_0xa5ae('0x32')]['filter']){_0x1554ce[_0xa5ae('0x3b')]=_[_0xa5ae('0x3d')](_0x1554ce[_0xa5ae('0x3b')],{'$or':_[_0xa5ae('0x2c')](_0x1554ce[_0xa5ae('0x36')],function(_0x1bc7f2){var _0x418b01={};_0x418b01[_0x1bc7f2]={'$like':'%'+_0x15278c['query'][_0xa5ae('0x3e')]+'%'};return _0x418b01;})});}_0x1554ce=_[_0xa5ae('0x3d')]({},_0x1554ce,_0x15278c['options']);return _0x231da8[_0xa5ae('0x50')](_0x1554ce);}})[_0xa5ae('0x24')](function(_0x57d664){if(_0x57d664){_0x5e2e43=_0x57d664[_0xa5ae('0x38')];if(!_0x15278c['query']['hasOwnProperty'](_0xa5ae('0x4d'))){_0x1554ce[_0xa5ae('0x1d')]=qs[_0xa5ae('0x1d')](_0x15278c['query'][_0xa5ae('0x1d')]);_0x1554ce['offset']=qs[_0xa5ae('0x1e')](_0x15278c[_0xa5ae('0x32')][_0xa5ae('0x1e')]);}return _0x231da8[_0xa5ae('0x50')](_0x1554ce);}})[_0xa5ae('0x24')](function(_0x27bc9e){if(_0x27bc9e){return _0x27bc9e?{'count':_0x5e2e43,'rows':_0x27bc9e}:null;}})[_0xa5ae('0x24')](respondWithResult(_0x10997d,null))[_0xa5ae('0x43')](handleError(_0x10997d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 9902b57..d7627ef 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 _0x2a20=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x2a20,0x15c));var _0x02a2=function(_0x1f0e39,_0x57c1bc){_0x1f0e39=_0x1f0e39-0x0;var _0x5a5362=_0x2a20[_0x1f0e39];return _0x5a5362;};'use strict';var _=require(_0x02a2('0x0'));var util=require(_0x02a2('0x1'));var logger=require(_0x02a2('0x2'))(_0x02a2('0x3'));var moment=require('moment');var BPromise=require(_0x02a2('0x4'));var rp=require(_0x02a2('0x5'));var fs=require('fs');var path=require(_0x02a2('0x6'));var rimraf=require(_0x02a2('0x7'));var config=require('../../config/environment');var attributes=require(_0x02a2('0x8'));module[_0x02a2('0x9')]=function(_0xcb776d,_0x3b7d65){return _0xcb776d[_0x02a2('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x02a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3580=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x328330,_0x3f88ec){var _0x12b87c=function(_0x245e6d){while(--_0x245e6d){_0x328330['push'](_0x328330['shift']());}};_0x12b87c(++_0x3f88ec);}(_0x3580,0x117));var _0x0358=function(_0x36d281,_0x3e379b){_0x36d281=_0x36d281-0x0;var _0x5e8fae=_0x3580[_0x36d281];return _0x5e8fae;};'use strict';var _=require(_0x0358('0x0'));var util=require(_0x0358('0x1'));var logger=require(_0x0358('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0358('0x3'));var rp=require(_0x0358('0x4'));var fs=require('fs');var path=require(_0x0358('0x5'));var rimraf=require(_0x0358('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x0358('0x7')]=function(_0x568b47,_0xf38331){return _0x568b47[_0x0358('0x8')](_0x0358('0x9'),attributes,{'tableName':_0x0358('0xa'),'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 542916e..286c8e9 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 _0xf6ad=['message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x3a631c,_0x5a1655){var _0x27128c=function(_0x1dd6b3){while(--_0x1dd6b3){_0x3a631c['push'](_0x3a631c['shift']());}};_0x27128c(++_0x5a1655);}(_0xf6ad,0xad));var _0xdf6a=function(_0x5ad68b,_0x55228b){_0x5ad68b=_0x5ad68b-0x0;var _0x6bd1e4=_0xf6ad[_0x5ad68b];return _0x6bd1e4;};'use strict';var _=require(_0xdf6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdf6a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf6a('0x2'));var db=require(_0xdf6a('0x3'))['db'];var utils=require(_0xdf6a('0x4'));var logger=require(_0xdf6a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf6a('0x6')][_0xdf6a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xaa70d0,_0x33650f,_0x3d1b15){return new BPromise(function(_0x208692,_0x3b4794){return client['request'](_0xaa70d0,_0x3d1b15)[_0xdf6a('0x8')](function(_0x37dff1){logger[_0xdf6a('0x9')](_0xdf6a('0xa'),_0x33650f,_0xdf6a('0xb'));logger[_0xdf6a('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x33650f,'request\x20sent',JSON['stringify'](_0x37dff1));if(_0x37dff1[_0xdf6a('0xd')]){if(_0x37dff1['error']['code']===0x1f4){logger[_0xdf6a('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x33650f,_0x37dff1[_0xdf6a('0xd')][_0xdf6a('0xe')]);return _0x3b4794(_0x37dff1[_0xdf6a('0xd')][_0xdf6a('0xe')]);}logger[_0xdf6a('0xd')](_0xdf6a('0xa'),_0x33650f,_0x37dff1[_0xdf6a('0xd')][_0xdf6a('0xe')]);return _0x208692(_0x37dff1['error'][_0xdf6a('0xe')]);}else{logger['info'](_0xdf6a('0xa'),_0x33650f,'request\x20sent');_0x208692(_0x37dff1[_0xdf6a('0xf')][_0xdf6a('0xe')]);}})[_0xdf6a('0x10')](function(_0x10a6f9){logger[_0xdf6a('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x33650f,_0x10a6f9);_0x3b4794(_0x10a6f9);});});} \ No newline at end of file +var _0x7bbe=['stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0xf2bcd1,_0x4c5838){var _0x5af0a8=function(_0x49116b){while(--_0x49116b){_0xf2bcd1['push'](_0xf2bcd1['shift']());}};_0x5af0a8(++_0x4c5838);}(_0x7bbe,0x1ea));var _0xe7bb=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0x7bbe[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require('lodash');var util=require(_0xe7bb('0x0'));var moment=require(_0xe7bb('0x1'));var BPromise=require('bluebird');var rs=require(_0xe7bb('0x2'));var fs=require('fs');var Redis=require(_0xe7bb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7bb('0x4'));var logger=require(_0xe7bb('0x5'))(_0xe7bb('0x6'));var config=require(_0xe7bb('0x7'));var jayson=require(_0xe7bb('0x8'));var client=jayson[_0xe7bb('0x9')][_0xe7bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25e319,_0x4827cf,_0x52c515){return new BPromise(function(_0x5f31c1,_0x24657c){return client[_0xe7bb('0xb')](_0x25e319,_0x52c515)[_0xe7bb('0xc')](function(_0x29d8cd){logger[_0xe7bb('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4827cf,_0xe7bb('0xe'));logger[_0xe7bb('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x4827cf,'request\x20sent',JSON[_0xe7bb('0x10')](_0x29d8cd));if(_0x29d8cd[_0xe7bb('0x11')]){if(_0x29d8cd[_0xe7bb('0x11')][_0xe7bb('0x12')]===0x1f4){logger['error'](_0xe7bb('0x13'),_0x4827cf,_0x29d8cd[_0xe7bb('0x11')][_0xe7bb('0x14')]);return _0x24657c(_0x29d8cd['error'][_0xe7bb('0x14')]);}logger[_0xe7bb('0x11')](_0xe7bb('0x13'),_0x4827cf,_0x29d8cd[_0xe7bb('0x11')][_0xe7bb('0x14')]);return _0x5f31c1(_0x29d8cd[_0xe7bb('0x11')][_0xe7bb('0x14')]);}else{logger[_0xe7bb('0xd')](_0xe7bb('0x13'),_0x4827cf,_0xe7bb('0xe'));_0x5f31c1(_0x29d8cd[_0xe7bb('0x15')][_0xe7bb('0x14')]);}})[_0xe7bb('0x16')](function(_0x49c182){logger[_0xe7bb('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4827cf,_0x49c182);_0x24657c(_0x49c182);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8f3577b..def169a 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 _0x0a34=['get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x511b76,_0x4727fa){var _0x5424ff=function(_0x24b7c0){while(--_0x24b7c0){_0x511b76['push'](_0x511b76['shift']());}};_0x5424ff(++_0x4727fa);}(_0x0a34,0x12a));var _0x40a3=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x0a34[_0x15c421];return _0x5e5ed5;};'use strict';var multer=require(_0x40a3('0x0'));var util=require(_0x40a3('0x1'));var path=require('path');var timeout=require(_0x40a3('0x2'));var express=require(_0x40a3('0x3'));var router=express[_0x40a3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x40a3('0x5'));var interaction=require(_0x40a3('0x6'));var config=require(_0x40a3('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x40a3('0x8')]('/',auth[_0x40a3('0x9')](),controller[_0x40a3('0xa')]);router[_0x40a3('0x8')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['show']);router[_0x40a3('0xc')]('/',auth[_0x40a3('0x9')](),controller[_0x40a3('0xd')]);router[_0x40a3('0xe')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['update']);router[_0x40a3('0xf')](_0x40a3('0xb'),auth[_0x40a3('0x9')](),controller['destroy']);module[_0x40a3('0x10')]=router; \ No newline at end of file +var _0x976a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','isAuthenticated','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x41d89e,_0x4f9f29){var _0x5f3ff5=function(_0x149ba0){while(--_0x149ba0){_0x41d89e['push'](_0x41d89e['shift']());}};_0x5f3ff5(++_0x4f9f29);}(_0x976a,0xf4));var _0xa976=function(_0xb28123,_0x4adf7c){_0xb28123=_0xb28123-0x0;var _0xd4e5f0=_0x976a[_0xb28123];return _0xd4e5f0;};'use strict';var multer=require(_0xa976('0x0'));var util=require(_0xa976('0x1'));var path=require(_0xa976('0x2'));var timeout=require('connect-timeout');var express=require(_0xa976('0x3'));var router=express[_0xa976('0x4')]();var fs_extra=require(_0xa976('0x5'));var auth=require(_0xa976('0x6'));var interaction=require(_0xa976('0x7'));var config=require(_0xa976('0x8'));var controller=require(_0xa976('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa976('0xa')](_0xa976('0xb'),auth[_0xa976('0xc')](),controller[_0xa976('0xd')]);router[_0xa976('0xe')]('/',auth[_0xa976('0xc')](),controller[_0xa976('0xf')]);router[_0xa976('0x10')](_0xa976('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa976('0xb'),auth[_0xa976('0xc')](),controller[_0xa976('0x11')]);module[_0xa976('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5982613..2dfb4e9 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 _0x3d0f=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x3d0f,0x15f));var _0xf3d0=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x3d0f[_0x109371];return _0x4fd858;};'use strict';var Sequelize=require(_0xf3d0('0x0'));module[_0xf3d0('0x1')]={'type':{'type':Sequelize[_0xf3d0('0x2')](_0xf3d0('0x3'),_0xf3d0('0x4'),'customVariable',_0xf3d0('0x5'),_0xf3d0('0x6')),'defaultValue':_0xf3d0('0x3')},'content':{'type':Sequelize[_0xf3d0('0x7')]},'key':{'type':Sequelize[_0xf3d0('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xf3d0('0x7')]},'idField':{'type':Sequelize[_0xf3d0('0x7')]},'nameField':{'type':Sequelize[_0xf3d0('0x7')]},'customField':{'type':Sequelize[_0xf3d0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf3d0('0x7')]}}; \ No newline at end of file +var _0x1394=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x4e08da,_0x596944){var _0x2193f0=function(_0x4c9eb2){while(--_0x4c9eb2){_0x4e08da['push'](_0x4e08da['shift']());}};_0x2193f0(++_0x596944);}(_0x1394,0x1ba));var _0x4139=function(_0x523f67,_0x4afd88){_0x523f67=_0x523f67-0x0;var _0x3fc45a=_0x1394[_0x523f67];return _0x3fc45a;};'use strict';var Sequelize=require(_0x4139('0x0'));module[_0x4139('0x1')]={'type':{'type':Sequelize[_0x4139('0x2')](_0x4139('0x3'),_0x4139('0x4'),_0x4139('0x5'),_0x4139('0x6'),_0x4139('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4139('0x8')]},'key':{'type':Sequelize[_0x4139('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x4139('0x5'))},'keyContent':{'type':Sequelize[_0x4139('0x8')]},'idField':{'type':Sequelize[_0x4139('0x8')]},'nameField':{'type':Sequelize[_0x4139('0x8')]},'customField':{'type':Sequelize[_0x4139('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4139('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5e56d6d..414fb20 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 _0xdde5=['moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdde5,0x1b8));var _0x5dde=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0xdde5[_0x54381d];return _0x5308a7;};'use strict';var emlformat=require(_0x5dde('0x0'));var rimraf=require(_0x5dde('0x1'));var zipdir=require(_0x5dde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5dde('0x3'));var moment=require(_0x5dde('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5dde('0x5'));var path=require(_0x5dde('0x6'));var sox=require('sox');var csv=require(_0x5dde('0x7'));var ejs=require(_0x5dde('0x8'));var fs=require('fs');var fs_extra=require(_0x5dde('0x9'));var _=require(_0x5dde('0xa'));var squel=require('squel');var crypto=require(_0x5dde('0xb'));var jsforce=require(_0x5dde('0xc'));var deskjs=require(_0x5dde('0xd'));var toCsv=require(_0x5dde('0x7'));var querystring=require(_0x5dde('0xe'));var Papa=require(_0x5dde('0xf'));var Redis=require(_0x5dde('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5dde('0x11'));var as=require(_0x5dde('0x12'));var hardwareService=require(_0x5dde('0x13'));var logger=require(_0x5dde('0x14'))(_0x5dde('0x15'));var utils=require(_0x5dde('0x16'));var config=require(_0x5dde('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5dde('0x18'))['db'];function respondWithStatusCode(_0x216eb0,_0x56b276){_0x56b276=_0x56b276||0xcc;return function(_0x1fbb61){if(_0x1fbb61){return _0x216eb0['sendStatus'](_0x56b276);}return _0x216eb0[_0x5dde('0x19')](_0x56b276)[_0x5dde('0x1a')]();};}function respondWithResult(_0x1bbb8c,_0x1cc822){_0x1cc822=_0x1cc822||0xc8;return function(_0x4290be){if(_0x4290be){return _0x1bbb8c['status'](_0x1cc822)[_0x5dde('0x1b')](_0x4290be);}};}function respondWithFilteredResult(_0x3e71aa,_0x29252c){return function(_0x29a531){if(_0x29a531){var _0x10670f=typeof _0x29252c['offset']===_0x5dde('0x1c')&&typeof _0x29252c[_0x5dde('0x1d')]==='undefined';var _0x3dddf5=_0x29a531['count'];var _0x4d175d=_0x10670f?0x0:_0x29252c[_0x5dde('0x1e')];var _0x280a7b=_0x10670f?_0x29a531[_0x5dde('0x1f')]:_0x29252c['offset']+_0x29252c[_0x5dde('0x1d')];var _0x1e36f7;if(_0x280a7b>=_0x3dddf5){_0x280a7b=_0x3dddf5;_0x1e36f7=0xc8;}else{_0x1e36f7=0xce;}_0x3e71aa[_0x5dde('0x19')](_0x1e36f7);return _0x3e71aa[_0x5dde('0x20')](_0x5dde('0x21'),_0x4d175d+'-'+_0x280a7b+'/'+_0x3dddf5)[_0x5dde('0x1b')](_0x29a531);}return null;};}function patchUpdates(_0x1abec3){return function(_0x2243c1){try{jsonpatch['apply'](_0x2243c1,_0x1abec3,!![]);}catch(_0x424b5c){return BPromise[_0x5dde('0x22')](_0x424b5c);}return _0x2243c1[_0x5dde('0x23')]();};}function saveUpdates(_0x1f6d92,_0x56eea1){return function(_0x1477a0){if(_0x1477a0){return _0x1477a0[_0x5dde('0x24')](_0x1f6d92)[_0x5dde('0x25')](function(_0x28857f){return _0x28857f;});}return null;};}function removeEntity(_0x4a4344,_0xd68523){return function(_0x2f7b57){if(_0x2f7b57){return _0x2f7b57[_0x5dde('0x26')]()['then'](function(){_0x4a4344['status'](0xcc)[_0x5dde('0x1a')]();});}};}function handleEntityNotFound(_0x328044,_0x4b3df4){return function(_0xaedf5){if(!_0xaedf5){_0x328044[_0x5dde('0x27')](0x194);}return _0xaedf5;};}function handleError(_0x34a04f,_0x2967cd){_0x2967cd=_0x2967cd||0x1f4;return function(_0x539993){logger[_0x5dde('0x28')](_0x539993[_0x5dde('0x29')]);if(_0x539993[_0x5dde('0x2a')]){delete _0x539993[_0x5dde('0x2a')];}_0x34a04f[_0x5dde('0x19')](_0x2967cd)[_0x5dde('0x2b')](_0x539993);};}exports[_0x5dde('0x2c')]=function(_0x35b79b,_0x5e22c3){var _0x73c202={},_0x4861f8={},_0x317e62={'count':0x0,'rows':[]};var _0x3167a9=_[_0x5dde('0x2d')](db[_0x5dde('0x2e')][_0x5dde('0x2f')],function(_0x2a4d7b){return{'name':_0x2a4d7b['fieldName'],'type':_0x2a4d7b[_0x5dde('0x30')]['key']};});_0x4861f8[_0x5dde('0x31')]=_[_0x5dde('0x2d')](_0x3167a9,_0x5dde('0x2a'));_0x4861f8['query']=_[_0x5dde('0x32')](_0x35b79b[_0x5dde('0x33')]);_0x4861f8['filters']=_['intersection'](_0x4861f8['model'],_0x4861f8['query']);_0x73c202[_0x5dde('0x34')]=_[_0x5dde('0x35')](_0x4861f8[_0x5dde('0x31')],qs[_0x5dde('0x36')](_0x35b79b['query']['fields']));_0x73c202[_0x5dde('0x34')]=_0x73c202[_0x5dde('0x34')][_0x5dde('0x37')]?_0x73c202['attributes']:_0x4861f8[_0x5dde('0x31')];if(!_0x35b79b['query'][_0x5dde('0x38')]('nolimit')){_0x73c202['limit']=qs[_0x5dde('0x1d')](_0x35b79b[_0x5dde('0x33')][_0x5dde('0x1d')]);_0x73c202[_0x5dde('0x1e')]=qs[_0x5dde('0x1e')](_0x35b79b[_0x5dde('0x33')][_0x5dde('0x1e')]);}_0x73c202[_0x5dde('0x39')]=qs['sort'](_0x35b79b[_0x5dde('0x33')]['sort']);_0x73c202[_0x5dde('0x3a')]=qs[_0x5dde('0x3b')](_[_0x5dde('0x3c')](_0x35b79b[_0x5dde('0x33')],_0x4861f8['filters']),_0x3167a9);if(_0x35b79b[_0x5dde('0x33')][_0x5dde('0x3d')]){_0x73c202[_0x5dde('0x3a')]=_[_0x5dde('0x3e')](_0x73c202[_0x5dde('0x3a')],{'$or':_[_0x5dde('0x2d')](_0x3167a9,function(_0x31d17d){if(_0x31d17d[_0x5dde('0x30')]!==_0x5dde('0x3f')){var _0x33db06={};_0x33db06[_0x31d17d[_0x5dde('0x2a')]]={'$like':'%'+_0x35b79b['query'][_0x5dde('0x3d')]+'%'};return _0x33db06;}})});}_0x73c202=_[_0x5dde('0x3e')]({},_0x73c202,_0x35b79b[_0x5dde('0x40')]);var _0x116fb4={'where':_0x73c202['where']};return db[_0x5dde('0x2e')][_0x5dde('0x1f')](_0x116fb4)['then'](function(_0x4fbcf9){_0x317e62[_0x5dde('0x1f')]=_0x4fbcf9;if(_0x35b79b['query'][_0x5dde('0x41')]){_0x73c202[_0x5dde('0x42')]=[{'all':!![]}];}return db[_0x5dde('0x2e')][_0x5dde('0x43')](_0x73c202);})['then'](function(_0x46a95b){_0x317e62['rows']=_0x46a95b;return _0x317e62;})['then'](respondWithFilteredResult(_0x5e22c3,_0x73c202))[_0x5dde('0x44')](handleError(_0x5e22c3,null));};exports[_0x5dde('0x45')]=function(_0x4138a5,_0x2d72d5){var _0x58fbb0={'raw':!![],'where':{'id':_0x4138a5[_0x5dde('0x46')]['id']}},_0x32c46e={};_0x32c46e[_0x5dde('0x31')]=_[_0x5dde('0x32')](db['FreshsalesField'][_0x5dde('0x2f')]);_0x32c46e[_0x5dde('0x33')]=_[_0x5dde('0x32')](_0x4138a5[_0x5dde('0x33')]);_0x32c46e[_0x5dde('0x3b')]=_['intersection'](_0x32c46e['model'],_0x32c46e['query']);_0x58fbb0[_0x5dde('0x34')]=_[_0x5dde('0x35')](_0x32c46e['model'],qs['fields'](_0x4138a5[_0x5dde('0x33')][_0x5dde('0x36')]));_0x58fbb0['attributes']=_0x58fbb0[_0x5dde('0x34')][_0x5dde('0x37')]?_0x58fbb0['attributes']:_0x32c46e[_0x5dde('0x31')];if(_0x4138a5[_0x5dde('0x33')][_0x5dde('0x41')]){_0x58fbb0[_0x5dde('0x42')]=[{'all':!![]}];}_0x58fbb0=_[_0x5dde('0x3e')]({},_0x58fbb0,_0x4138a5[_0x5dde('0x40')]);return db[_0x5dde('0x2e')]['find'](_0x58fbb0)[_0x5dde('0x25')](handleEntityNotFound(_0x2d72d5,null))['then'](respondWithResult(_0x2d72d5,null))[_0x5dde('0x44')](handleError(_0x2d72d5,null));};exports[_0x5dde('0x47')]=function(_0x46f4a8,_0x2de177){return db[_0x5dde('0x2e')][_0x5dde('0x47')](_0x46f4a8[_0x5dde('0x48')],{})[_0x5dde('0x25')](respondWithResult(_0x2de177,0xc9))['catch'](handleError(_0x2de177,null));};exports[_0x5dde('0x24')]=function(_0x289bfd,_0x320af7){if(_0x289bfd[_0x5dde('0x48')]['id']){delete _0x289bfd[_0x5dde('0x48')]['id'];}return db[_0x5dde('0x2e')][_0x5dde('0x49')]({'where':{'id':_0x289bfd[_0x5dde('0x46')]['id']}})[_0x5dde('0x25')](handleEntityNotFound(_0x320af7,null))['then'](saveUpdates(_0x289bfd[_0x5dde('0x48')],null))[_0x5dde('0x25')](respondWithResult(_0x320af7,null))[_0x5dde('0x44')](handleError(_0x320af7,null));};exports[_0x5dde('0x26')]=function(_0x1c3588,_0x16c92a){return db[_0x5dde('0x2e')][_0x5dde('0x49')]({'where':{'id':_0x1c3588[_0x5dde('0x46')]['id']}})[_0x5dde('0x25')](handleEntityNotFound(_0x16c92a,null))[_0x5dde('0x25')](removeEntity(_0x16c92a,null))[_0x5dde('0x44')](handleError(_0x16c92a,null));}; \ No newline at end of file +var _0x8047=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','options','find','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8047,0x86));var _0x7804=function(_0xa25342,_0x24522b){_0xa25342=_0xa25342-0x0;var _0x52be43=_0x8047[_0xa25342];return _0x52be43;};'use strict';var emlformat=require(_0x7804('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7804('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7804('0x2'));var moment=require(_0x7804('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7804('0x4'));var util=require(_0x7804('0x5'));var path=require(_0x7804('0x6'));var sox=require(_0x7804('0x7'));var csv=require(_0x7804('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7804('0x9'));var _=require('lodash');var squel=require(_0x7804('0xa'));var crypto=require('crypto');var jsforce=require(_0x7804('0xb'));var deskjs=require(_0x7804('0xc'));var toCsv=require(_0x7804('0x8'));var querystring=require(_0x7804('0xd'));var Papa=require(_0x7804('0xe'));var Redis=require(_0x7804('0xf'));var authService=require(_0x7804('0x10'));var qs=require(_0x7804('0x11'));var as=require(_0x7804('0x12'));var hardwareService=require(_0x7804('0x13'));var logger=require(_0x7804('0x14'))('api');var utils=require(_0x7804('0x15'));var config=require(_0x7804('0x16'));var licenseUtil=require(_0x7804('0x17'));var db=require(_0x7804('0x18'))['db'];function respondWithStatusCode(_0x22e3bc,_0x2eb946){_0x2eb946=_0x2eb946||0xcc;return function(_0x27e764){if(_0x27e764){return _0x22e3bc['sendStatus'](_0x2eb946);}return _0x22e3bc['status'](_0x2eb946)[_0x7804('0x19')]();};}function respondWithResult(_0x2823d3,_0x2d2ae6){_0x2d2ae6=_0x2d2ae6||0xc8;return function(_0x554773){if(_0x554773){return _0x2823d3['status'](_0x2d2ae6)[_0x7804('0x1a')](_0x554773);}};}function respondWithFilteredResult(_0x1af658,_0x5dfcbe){return function(_0x3f14c6){if(_0x3f14c6){var _0x4fd6ab=typeof _0x5dfcbe[_0x7804('0x1b')]==='undefined'&&typeof _0x5dfcbe['limit']==='undefined';var _0x56237c=_0x3f14c6[_0x7804('0x1c')];var _0x55555f=_0x4fd6ab?0x0:_0x5dfcbe[_0x7804('0x1b')];var _0x41f5dd=_0x4fd6ab?_0x3f14c6[_0x7804('0x1c')]:_0x5dfcbe[_0x7804('0x1b')]+_0x5dfcbe[_0x7804('0x1d')];var _0x52c9b0;if(_0x41f5dd>=_0x56237c){_0x41f5dd=_0x56237c;_0x52c9b0=0xc8;}else{_0x52c9b0=0xce;}_0x1af658[_0x7804('0x1e')](_0x52c9b0);return _0x1af658[_0x7804('0x1f')](_0x7804('0x20'),_0x55555f+'-'+_0x41f5dd+'/'+_0x56237c)[_0x7804('0x1a')](_0x3f14c6);}return null;};}function patchUpdates(_0x4ca859){return function(_0x21df23){try{jsonpatch[_0x7804('0x21')](_0x21df23,_0x4ca859,!![]);}catch(_0x36a56d){return BPromise[_0x7804('0x22')](_0x36a56d);}return _0x21df23[_0x7804('0x23')]();};}function saveUpdates(_0x4c8b73,_0x14c688){return function(_0x37f8d5){if(_0x37f8d5){return _0x37f8d5[_0x7804('0x24')](_0x4c8b73)[_0x7804('0x25')](function(_0x2ae277){return _0x2ae277;});}return null;};}function removeEntity(_0xd67b4c,_0x562744){return function(_0x5070ce){if(_0x5070ce){return _0x5070ce[_0x7804('0x26')]()['then'](function(){_0xd67b4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d2988,_0x16b34d){return function(_0x550b32){if(!_0x550b32){_0x1d2988[_0x7804('0x27')](0x194);}return _0x550b32;};}function handleError(_0x3ababf,_0x409e2e){_0x409e2e=_0x409e2e||0x1f4;return function(_0x5b212f){logger[_0x7804('0x28')](_0x5b212f[_0x7804('0x29')]);if(_0x5b212f[_0x7804('0x2a')]){delete _0x5b212f[_0x7804('0x2a')];}_0x3ababf['status'](_0x409e2e)[_0x7804('0x2b')](_0x5b212f);};}exports[_0x7804('0x2c')]=function(_0x376c16,_0x5332bf){var _0x22f951={},_0x4216a4={},_0xe499c2={'count':0x0,'rows':[]};var _0x1db819=_[_0x7804('0x2d')](db[_0x7804('0x2e')][_0x7804('0x2f')],function(_0x16f478){return{'name':_0x16f478[_0x7804('0x30')],'type':_0x16f478[_0x7804('0x31')][_0x7804('0x32')]};});_0x4216a4[_0x7804('0x33')]=_[_0x7804('0x2d')](_0x1db819,_0x7804('0x2a'));_0x4216a4['query']=_['keys'](_0x376c16[_0x7804('0x34')]);_0x4216a4['filters']=_[_0x7804('0x35')](_0x4216a4[_0x7804('0x33')],_0x4216a4[_0x7804('0x34')]);_0x22f951[_0x7804('0x36')]=_[_0x7804('0x35')](_0x4216a4[_0x7804('0x33')],qs[_0x7804('0x37')](_0x376c16[_0x7804('0x34')][_0x7804('0x37')]));_0x22f951[_0x7804('0x36')]=_0x22f951[_0x7804('0x36')][_0x7804('0x38')]?_0x22f951[_0x7804('0x36')]:_0x4216a4['model'];if(!_0x376c16[_0x7804('0x34')]['hasOwnProperty']('nolimit')){_0x22f951[_0x7804('0x1d')]=qs[_0x7804('0x1d')](_0x376c16[_0x7804('0x34')][_0x7804('0x1d')]);_0x22f951[_0x7804('0x1b')]=qs[_0x7804('0x1b')](_0x376c16[_0x7804('0x34')][_0x7804('0x1b')]);}_0x22f951[_0x7804('0x39')]=qs[_0x7804('0x3a')](_0x376c16['query']['sort']);_0x22f951[_0x7804('0x3b')]=qs[_0x7804('0x3c')](_[_0x7804('0x3d')](_0x376c16[_0x7804('0x34')],_0x4216a4[_0x7804('0x3c')]),_0x1db819);if(_0x376c16[_0x7804('0x34')]['filter']){_0x22f951[_0x7804('0x3b')]=_[_0x7804('0x3e')](_0x22f951[_0x7804('0x3b')],{'$or':_[_0x7804('0x2d')](_0x1db819,function(_0xcea689){if(_0xcea689['type']!==_0x7804('0x3f')){var _0xa063c9={};_0xa063c9[_0xcea689[_0x7804('0x2a')]]={'$like':'%'+_0x376c16['query'][_0x7804('0x40')]+'%'};return _0xa063c9;}})});}_0x22f951=_[_0x7804('0x3e')]({},_0x22f951,_0x376c16['options']);var _0xa7800a={'where':_0x22f951[_0x7804('0x3b')]};return db[_0x7804('0x2e')][_0x7804('0x1c')](_0xa7800a)['then'](function(_0x186053){_0xe499c2[_0x7804('0x1c')]=_0x186053;if(_0x376c16[_0x7804('0x34')][_0x7804('0x41')]){_0x22f951[_0x7804('0x42')]=[{'all':!![]}];}return db[_0x7804('0x2e')]['findAll'](_0x22f951);})[_0x7804('0x25')](function(_0x49985d){_0xe499c2[_0x7804('0x43')]=_0x49985d;return _0xe499c2;})['then'](respondWithFilteredResult(_0x5332bf,_0x22f951))[_0x7804('0x44')](handleError(_0x5332bf,null));};exports[_0x7804('0x45')]=function(_0x93d24d,_0x4d7f54){var _0x211cf7={'raw':!![],'where':{'id':_0x93d24d[_0x7804('0x46')]['id']}},_0x11639c={};_0x11639c['model']=_[_0x7804('0x47')](db[_0x7804('0x2e')]['rawAttributes']);_0x11639c[_0x7804('0x34')]=_[_0x7804('0x47')](_0x93d24d[_0x7804('0x34')]);_0x11639c[_0x7804('0x3c')]=_['intersection'](_0x11639c[_0x7804('0x33')],_0x11639c[_0x7804('0x34')]);_0x211cf7[_0x7804('0x36')]=_['intersection'](_0x11639c[_0x7804('0x33')],qs[_0x7804('0x37')](_0x93d24d['query'][_0x7804('0x37')]));_0x211cf7['attributes']=_0x211cf7[_0x7804('0x36')][_0x7804('0x38')]?_0x211cf7[_0x7804('0x36')]:_0x11639c['model'];if(_0x93d24d['query'][_0x7804('0x41')]){_0x211cf7['include']=[{'all':!![]}];}_0x211cf7=_[_0x7804('0x3e')]({},_0x211cf7,_0x93d24d[_0x7804('0x48')]);return db[_0x7804('0x2e')][_0x7804('0x49')](_0x211cf7)['then'](handleEntityNotFound(_0x4d7f54,null))[_0x7804('0x25')](respondWithResult(_0x4d7f54,null))[_0x7804('0x44')](handleError(_0x4d7f54,null));};exports[_0x7804('0x4a')]=function(_0x3cdf19,_0x118113){return db[_0x7804('0x2e')][_0x7804('0x4a')](_0x3cdf19[_0x7804('0x4b')],{})['then'](respondWithResult(_0x118113,0xc9))[_0x7804('0x44')](handleError(_0x118113,null));};exports['update']=function(_0x3ad444,_0x4c8c5c){if(_0x3ad444[_0x7804('0x4b')]['id']){delete _0x3ad444[_0x7804('0x4b')]['id'];}return db[_0x7804('0x2e')][_0x7804('0x49')]({'where':{'id':_0x3ad444[_0x7804('0x46')]['id']}})[_0x7804('0x25')](handleEntityNotFound(_0x4c8c5c,null))[_0x7804('0x25')](saveUpdates(_0x3ad444[_0x7804('0x4b')],null))['then'](respondWithResult(_0x4c8c5c,null))[_0x7804('0x44')](handleError(_0x4c8c5c,null));};exports['destroy']=function(_0x218ed5,_0xab16be){return db['FreshsalesField']['find']({'where':{'id':_0x218ed5[_0x7804('0x46')]['id']}})[_0x7804('0x25')](handleEntityNotFound(_0xab16be,null))[_0x7804('0x25')](removeEntity(_0xab16be,null))[_0x7804('0x44')](handleError(_0xab16be,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index c6f8dba..df4a525 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 _0xa5c1=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','lodash'];(function(_0x5c842a,_0x28ab93){var _0xca6f3d=function(_0x37632a){while(--_0x37632a){_0x5c842a['push'](_0x5c842a['shift']());}};_0xca6f3d(++_0x28ab93);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x3ffe30,_0x44ed58){_0x3ffe30=_0x3ffe30-0x0;var _0x4747b3=_0xa5c1[_0x3ffe30];return _0x4747b3;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var logger=require(_0x1a5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a5c('0x4'));var rimraf=require(_0x1a5c('0x5'));var config=require(_0x1a5c('0x6'));var attributes=require(_0x1a5c('0x7'));module[_0x1a5c('0x8')]=function(_0x3c3558,_0x4d7377){return _0x3c3558[_0x1a5c('0x9')]('FreshsalesField',attributes,{'tableName':_0x1a5c('0xa'),'paranoid':![],'indexes':[{'name':_0x1a5c('0xb'),'fields':[_0x1a5c('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f0e=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x1e42ec,_0x267f87){var _0x5805ec=function(_0x4b78d2){while(--_0x4b78d2){_0x1e42ec['push'](_0x1e42ec['shift']());}};_0x5805ec(++_0x267f87);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2eb565,_0x526f6c){_0x2eb565=_0x2eb565-0x0;var _0x51f08b=_0x9f0e[_0x2eb565];return _0x51f08b;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));module[_0xe9f0('0x9')]=function(_0x50313d,_0x5b87c1){return _0x50313d[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':_0xe9f0('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xe9f0('0xd'),_0xe9f0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 5e11fae..198878f 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 _0xeff8=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5316f2,_0x438da0){var _0x106659=function(_0xc5cba){while(--_0xc5cba){_0x5316f2['push'](_0x5316f2['shift']());}};_0x106659(++_0x438da0);}(_0xeff8,0x186));var _0x8eff=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xeff8[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var moment=require('moment');var BPromise=require(_0x8eff('0x2'));var rs=require(_0x8eff('0x3'));var fs=require('fs');var Redis=require(_0x8eff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eff('0x5'));var logger=require(_0x8eff('0x6'))(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eff('0x9')][_0x8eff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){return client[_0x8eff('0xb')](_0x3409bc,_0x491f01)[_0x8eff('0xc')](function(_0x5bd403){logger['info'](_0x8eff('0xd'),_0x323b2,_0x8eff('0xe'));logger[_0x8eff('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x323b2,_0x8eff('0xe'),JSON[_0x8eff('0x10')](_0x5bd403));if(_0x5bd403['error']){if(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x12')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x323b2,_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);return _0x19557f(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);}logger[_0x8eff('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x323b2,_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);return _0x3fb9ee(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);}else{logger[_0x8eff('0x14')](_0x8eff('0xd'),_0x323b2,_0x8eff('0xe'));_0x3fb9ee(_0x5bd403[_0x8eff('0x15')][_0x8eff('0x13')]);}})[_0x8eff('0x16')](function(_0x137344){logger['error'](_0x8eff('0xd'),_0x323b2,_0x137344);_0x19557f(_0x137344);});});} \ No newline at end of file +var _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x2b2468,_0x14de04){var _0xb517fd=function(_0x424d14){while(--_0x424d14){_0x2b2468['push'](_0x2b2468['shift']());}};_0xb517fd(++_0x14de04);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4acd73,_0x33d08d){_0x4acd73=_0x4acd73-0x0;var _0x353daa=_0xc1c6[_0x4acd73];return _0x353daa;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 1ad3384..f8d545a 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(_0x184a02,_0x19bad1){var _0x48d884=function(_0x4a4064){while(--_0x4a4064){_0x184a02['push'](_0x184a02['shift']());}};_0x48d884(++_0x19bad1);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x14d285,_0xb8daeb){var _0x454565=function(_0x274cf9){while(--_0x274cf9){_0x14d285['push'](_0x14d285['shift']());}};_0x454565(++_0xb8daeb);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 6bba9ec..3e7d65d 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 _0x5323=['newTab','sequelize','exports','STRING','ENUM'];(function(_0x137e04,_0x3c0799){var _0x4c6762=function(_0x45f489){while(--_0x45f489){_0x137e04['push'](_0x137e04['shift']());}};_0x4c6762(++_0x3c0799);}(_0x5323,0x88));var _0x3532=function(_0x243c03,_0x1b778b){_0x243c03=_0x243c03-0x0;var _0x3bdfdf=_0x5323[_0x243c03];return _0x3bdfdf;};'use strict';var Sequelize=require(_0x3532('0x0'));module[_0x3532('0x1')]={'name':{'type':Sequelize[_0x3532('0x2')]},'description':{'type':Sequelize[_0x3532('0x2')]},'username':{'type':Sequelize[_0x3532('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x3532('0x2')]},'password':{'type':Sequelize[_0x3532('0x2')]},'clientId':{'type':Sequelize[_0x3532('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x3532('0x2')]},'serverUrl':{'type':Sequelize[_0x3532('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3532('0x3')]('integrationTab',_0x3532('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4efb=['username','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x4c837d,_0x4c22e9){var _0x1eaa45=function(_0x871ed9){while(--_0x871ed9){_0x4c837d['push'](_0x4c837d['shift']());}};_0x1eaa45(++_0x4c22e9);}(_0x4efb,0xfa));var _0xb4ef=function(_0x39b117,_0x4eae17){_0x39b117=_0x39b117-0x0;var _0x1038fa=_0x4efb[_0x39b117];return _0x1038fa;};'use strict';var Sequelize=require('sequelize');module[_0xb4ef('0x0')]={'name':{'type':Sequelize[_0xb4ef('0x1')]},'description':{'type':Sequelize[_0xb4ef('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xb4ef('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xb4ef('0x1')]},'clientId':{'type':Sequelize[_0xb4ef('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xb4ef('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb4ef('0x3')](_0xb4ef('0x4'),_0xb4ef('0x5')),'defaultValue':_0xb4ef('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 89e3d5b..5ddb59a 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 _0xb97c=['Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','clientId','clientSecret','username','securityToken','remoteUri','slice','substring','Connection','password','concat','isNil','ticketType','sobject','describe','ActivityDate','IsRecurrence','picklist','boolean','textarea','phone','remove','includes','label','picklistValues','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','getConfigurations','findOne','addConfiguration','body','AccountId','Subjects','getSubjects','channel'];(function(_0x12eb50,_0x45879d){var _0x8682f6=function(_0x127c0a){while(--_0x127c0a){_0x12eb50['push'](_0x12eb50['shift']());}};_0x8682f6(++_0x45879d);}(_0xb97c,0x19b));var _0xcb97=function(_0x5660a5,_0x2ebdd9){_0x5660a5=_0x5660a5-0x0;var _0x350864=_0xb97c[_0x5660a5];return _0x350864;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcb97('0x0'));var jsonpatch=require(_0xcb97('0x1'));var rp=require(_0xcb97('0x2'));var moment=require(_0xcb97('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcb97('0x4'));var path=require(_0xcb97('0x5'));var sox=require(_0xcb97('0x6'));var csv=require(_0xcb97('0x7'));var ejs=require(_0xcb97('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb97('0x9'));var squel=require(_0xcb97('0xa'));var crypto=require(_0xcb97('0xb'));var jsforce=require(_0xcb97('0xc'));var deskjs=require(_0xcb97('0xd'));var toCsv=require(_0xcb97('0x7'));var querystring=require(_0xcb97('0xe'));var Papa=require(_0xcb97('0xf'));var Redis=require('ioredis');var authService=require(_0xcb97('0x10'));var qs=require(_0xcb97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb97('0x12'));var logger=require(_0xcb97('0x13'))(_0xcb97('0x14'));var utils=require(_0xcb97('0x15'));var config=require(_0xcb97('0x16'));var licenseUtil=require(_0xcb97('0x17'));var db=require(_0xcb97('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x42abe7,_0x1ea338){_0x1ea338=_0x1ea338||0xcc;return function(_0x199cd4){if(_0x199cd4){return _0x42abe7[_0xcb97('0x19')](_0x1ea338);}return _0x42abe7[_0xcb97('0x1a')](_0x1ea338)['end']();};}function respondWithResult(_0x2cde2c,_0x1a720e){_0x1a720e=_0x1a720e||0xc8;return function(_0x4b5f4a){if(_0x4b5f4a){return _0x2cde2c[_0xcb97('0x1a')](_0x1a720e)[_0xcb97('0x1b')](_0x4b5f4a);}};}function respondWithFilteredResult(_0xb59ca6,_0x323b1d){return function(_0x39aa74){if(_0x39aa74){var _0x597dff=typeof _0x323b1d[_0xcb97('0x1c')]==='undefined'&&typeof _0x323b1d[_0xcb97('0x1d')]===_0xcb97('0x1e');var _0xee193a=_0x39aa74[_0xcb97('0x1f')];var _0x55790a=_0x597dff?0x0:_0x323b1d[_0xcb97('0x1c')];var _0x38a424=_0x597dff?_0x39aa74[_0xcb97('0x1f')]:_0x323b1d[_0xcb97('0x1c')]+_0x323b1d[_0xcb97('0x1d')];var _0x21d6c4;if(_0x38a424>=_0xee193a){_0x38a424=_0xee193a;_0x21d6c4=0xc8;}else{_0x21d6c4=0xce;}_0xb59ca6[_0xcb97('0x1a')](_0x21d6c4);return _0xb59ca6['set'](_0xcb97('0x20'),_0x55790a+'-'+_0x38a424+'/'+_0xee193a)[_0xcb97('0x1b')](_0x39aa74);}return null;};}function patchUpdates(_0x2c8e62){return function(_0x1bfeec){try{jsonpatch[_0xcb97('0x21')](_0x1bfeec,_0x2c8e62,!![]);}catch(_0xdac9b2){return BPromise[_0xcb97('0x22')](_0xdac9b2);}return _0x1bfeec[_0xcb97('0x23')]();};}function saveUpdates(_0x477cb9,_0x1c368d){return function(_0x28953d){if(_0x28953d){return _0x28953d[_0xcb97('0x24')](_0x477cb9)[_0xcb97('0x25')](function(_0x55907c){return _0x55907c;});}return null;};}function removeEntity(_0x207db3,_0x45c599){return function(_0x430ea0){if(_0x430ea0){return _0x430ea0[_0xcb97('0x26')]()[_0xcb97('0x25')](function(){_0x207db3[_0xcb97('0x1a')](0xcc)[_0xcb97('0x27')]();});}};}function handleEntityNotFound(_0x5e5ad4,_0x17b21f){return function(_0x2f3ff5){if(!_0x2f3ff5){_0x5e5ad4[_0xcb97('0x19')](0x194);}return _0x2f3ff5;};}function handleError(_0x41108c,_0x32d14a){_0x32d14a=_0x32d14a||0x1f4;return function(_0x50f5cd){logger[_0xcb97('0x28')](_0x50f5cd[_0xcb97('0x29')]);if(_0x50f5cd[_0xcb97('0x2a')]){delete _0x50f5cd['name'];}_0x41108c[_0xcb97('0x1a')](_0x32d14a)[_0xcb97('0x2b')](_0x50f5cd);};}exports[_0xcb97('0x2c')]=function(_0x1017ce,_0x1d51e9){var _0x517dd8={},_0x323a03={},_0x56c201={'count':0x0,'rows':[]};var _0x4e2dd6=_[_0xcb97('0x2d')](db[_0xcb97('0x2e')][_0xcb97('0x2f')],function(_0x180a43){return{'name':_0x180a43[_0xcb97('0x30')],'type':_0x180a43['type'][_0xcb97('0x31')]};});_0x323a03[_0xcb97('0x32')]=_[_0xcb97('0x2d')](_0x4e2dd6,_0xcb97('0x2a'));_0x323a03[_0xcb97('0x33')]=_[_0xcb97('0x34')](_0x1017ce[_0xcb97('0x33')]);_0x323a03['filters']=_['intersection'](_0x323a03['model'],_0x323a03['query']);_0x517dd8['attributes']=_[_0xcb97('0x35')](_0x323a03[_0xcb97('0x32')],qs[_0xcb97('0x36')](_0x1017ce[_0xcb97('0x33')]['fields']));_0x517dd8[_0xcb97('0x37')]=_0x517dd8[_0xcb97('0x37')]['length']?_0x517dd8[_0xcb97('0x37')]:_0x323a03[_0xcb97('0x32')];if(!_0x1017ce['query'][_0xcb97('0x38')](_0xcb97('0x39'))){_0x517dd8['limit']=qs[_0xcb97('0x1d')](_0x1017ce['query']['limit']);_0x517dd8[_0xcb97('0x1c')]=qs[_0xcb97('0x1c')](_0x1017ce[_0xcb97('0x33')][_0xcb97('0x1c')]);}_0x517dd8[_0xcb97('0x3a')]=qs[_0xcb97('0x3b')](_0x1017ce[_0xcb97('0x33')][_0xcb97('0x3b')]);_0x517dd8[_0xcb97('0x3c')]=qs[_0xcb97('0x3d')](_[_0xcb97('0x3e')](_0x1017ce[_0xcb97('0x33')],_0x323a03['filters']),_0x4e2dd6);if(_0x1017ce[_0xcb97('0x33')][_0xcb97('0x3f')]){_0x517dd8[_0xcb97('0x3c')]=_['merge'](_0x517dd8['where'],{'$or':_[_0xcb97('0x2d')](_0x4e2dd6,function(_0x3f1c6c){if(_0x3f1c6c[_0xcb97('0x40')]!==_0xcb97('0x41')){var _0x294922={};_0x294922[_0x3f1c6c[_0xcb97('0x2a')]]={'$like':'%'+_0x1017ce['query'][_0xcb97('0x3f')]+'%'};return _0x294922;}})});}_0x517dd8=_[_0xcb97('0x42')]({},_0x517dd8,_0x1017ce[_0xcb97('0x43')]);var _0x3b2046={'where':_0x517dd8[_0xcb97('0x3c')]};return db[_0xcb97('0x2e')][_0xcb97('0x1f')](_0x3b2046)['then'](function(_0x47a774){_0x56c201[_0xcb97('0x1f')]=_0x47a774;if(_0x1017ce[_0xcb97('0x33')][_0xcb97('0x44')]){_0x517dd8[_0xcb97('0x45')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xcb97('0x46')](_0x517dd8);})['then'](function(_0xa055ec){_0x56c201['rows']=_0xa055ec;return _0x56c201;})[_0xcb97('0x25')](respondWithFilteredResult(_0x1d51e9,_0x517dd8))[_0xcb97('0x47')](handleError(_0x1d51e9,null));};exports[_0xcb97('0x48')]=function(_0x403c25,_0x414501){var _0x53d0fc={'raw':![],'where':{'id':_0x403c25[_0xcb97('0x49')]['id']}},_0x298362={};_0x298362[_0xcb97('0x32')]=_[_0xcb97('0x34')](db['SalesforceAccount'][_0xcb97('0x2f')]);_0x298362[_0xcb97('0x33')]=_[_0xcb97('0x34')](_0x403c25[_0xcb97('0x33')]);_0x298362[_0xcb97('0x3d')]=_['intersection'](_0x298362[_0xcb97('0x32')],_0x298362[_0xcb97('0x33')]);_0x53d0fc[_0xcb97('0x37')]=_[_0xcb97('0x35')](_0x298362[_0xcb97('0x32')],qs[_0xcb97('0x36')](_0x403c25[_0xcb97('0x33')][_0xcb97('0x36')]));_0x53d0fc[_0xcb97('0x37')]=_0x53d0fc['attributes'][_0xcb97('0x4a')]?_0x53d0fc[_0xcb97('0x37')]:_0x298362[_0xcb97('0x32')];if(_0x403c25['query']['includeAll']){_0x53d0fc[_0xcb97('0x45')]=[{'all':!![]}];}_0x53d0fc=_['merge']({},_0x53d0fc,_0x403c25['options']);return db[_0xcb97('0x2e')][_0xcb97('0x4b')](_0x53d0fc)[_0xcb97('0x25')](handleEntityNotFound(_0x414501,null))[_0xcb97('0x25')](respondWithResult(_0x414501,null))[_0xcb97('0x47')](handleError(_0x414501,null));};exports[_0xcb97('0x4c')]=function(_0x37739c,_0x4f5fcc){return db[_0xcb97('0x2e')][_0xcb97('0x4c')](_0x37739c['body'],{})[_0xcb97('0x25')](respondWithResult(_0x4f5fcc,0xc9))[_0xcb97('0x47')](handleError(_0x4f5fcc,null));};exports[_0xcb97('0x24')]=function(_0x1819fc,_0x406a8d){if(_0x1819fc['body']['id']){delete _0x1819fc['body']['id'];}return db[_0xcb97('0x2e')]['find']({'where':{'id':_0x1819fc[_0xcb97('0x49')]['id']}})['then'](handleEntityNotFound(_0x406a8d,null))['then'](saveUpdates(_0x1819fc['body'],null))[_0xcb97('0x25')](respondWithResult(_0x406a8d,null))[_0xcb97('0x47')](handleError(_0x406a8d,null));};exports[_0xcb97('0x26')]=function(_0x27fa3a,_0x288391){return db['SalesforceAccount']['find']({'where':{'id':_0x27fa3a[_0xcb97('0x49')]['id']}})[_0xcb97('0x25')](handleEntityNotFound(_0x288391,null))[_0xcb97('0x25')](removeEntity(_0x288391,null))['catch'](handleError(_0x288391,null));};exports[_0xcb97('0x4d')]=function(_0x2841ea,_0x517636,_0x4252e3){var _0x30cf39={};var _0x2bff9a={};var _0x2137be;var _0x1f0b4c;return db[_0xcb97('0x2e')][_0xcb97('0x4e')]({'where':{'id':_0x2841ea[_0xcb97('0x49')]['id']}})[_0xcb97('0x25')](handleEntityNotFound(_0x517636,null))[_0xcb97('0x25')](function(_0x46aea6){if(_0x46aea6){_0x2137be=_0x46aea6;_0x2bff9a['model']=_[_0xcb97('0x34')](db['SalesforceConfiguration'][_0xcb97('0x2f')]);_0x2bff9a[_0xcb97('0x33')]=_[_0xcb97('0x34')](_0x2841ea['query']);_0x2bff9a[_0xcb97('0x3d')]=_[_0xcb97('0x35')](_0x2bff9a['model'],_0x2bff9a[_0xcb97('0x33')]);_0x30cf39['attributes']=_[_0xcb97('0x35')](_0x2bff9a['model'],qs[_0xcb97('0x36')](_0x2841ea[_0xcb97('0x33')]['fields']));_0x30cf39[_0xcb97('0x37')]=_0x30cf39[_0xcb97('0x37')][_0xcb97('0x4a')]?_0x30cf39[_0xcb97('0x37')]:_0x2bff9a[_0xcb97('0x32')];_0x30cf39[_0xcb97('0x3a')]=qs['sort'](_0x2841ea['query']['sort']);_0x30cf39[_0xcb97('0x3c')]=qs['filters'](_[_0xcb97('0x3e')](_0x2841ea[_0xcb97('0x33')],_0x2bff9a['filters']));if(_0x2841ea[_0xcb97('0x33')][_0xcb97('0x3f')]){_0x30cf39[_0xcb97('0x3c')]=_[_0xcb97('0x42')](_0x30cf39['where'],{'$or':_[_0xcb97('0x2d')](_0x30cf39[_0xcb97('0x37')],function(_0x5d0825){var _0x2fa4f9={};_0x2fa4f9[_0x5d0825]={'$like':'%'+_0x2841ea[_0xcb97('0x33')][_0xcb97('0x3f')]+'%'};return _0x2fa4f9;})});}_0x30cf39=_[_0xcb97('0x42')]({},_0x30cf39,_0x2841ea[_0xcb97('0x43')]);return _0x2137be[_0xcb97('0x4d')](_0x30cf39);}})[_0xcb97('0x25')](function(_0x3116c1){if(_0x3116c1){_0x1f0b4c=_0x3116c1['length'];if(!_0x2841ea[_0xcb97('0x33')]['hasOwnProperty'](_0xcb97('0x39'))){_0x30cf39[_0xcb97('0x1d')]=qs[_0xcb97('0x1d')](_0x2841ea[_0xcb97('0x33')][_0xcb97('0x1d')]);_0x30cf39[_0xcb97('0x1c')]=qs['offset'](_0x2841ea['query'][_0xcb97('0x1c')]);}return _0x2137be[_0xcb97('0x4d')](_0x30cf39);}})[_0xcb97('0x25')](function(_0x21128e){if(_0x21128e){return _0x21128e?{'count':_0x1f0b4c,'rows':_0x21128e}:null;}})[_0xcb97('0x25')](respondWithResult(_0x517636,null))[_0xcb97('0x47')](handleError(_0x517636,null));};exports[_0xcb97('0x4f')]=function(_0x302115,_0x4d2cd3,_0x5e011c){if(_0x302115[_0xcb97('0x50')]['id']){delete _0x302115[_0xcb97('0x50')]['id'];}return db[_0xcb97('0x2e')][_0xcb97('0x4e')]({'where':{'id':_0x302115[_0xcb97('0x49')]['id']}})[_0xcb97('0x25')](handleEntityNotFound(_0x4d2cd3,null))[_0xcb97('0x25')](function(_0x509be7){if(_0x509be7){_0x302115[_0xcb97('0x50')][_0xcb97('0x51')]=_0x509be7['id'];_0x302115['body'][_0xcb97('0x52')]=integrations[_0xcb97('0x53')](_0x302115['body'][_0xcb97('0x54')],_0x302115[_0xcb97('0x50')][_0xcb97('0x40')]);_0x302115[_0xcb97('0x50')][_0xcb97('0x55')]=integrations[_0xcb97('0x56')](_0x302115['body'][_0xcb97('0x54')],_0x302115[_0xcb97('0x50')][_0xcb97('0x40')]);return db[_0xcb97('0x57')][_0xcb97('0x4c')](_0x302115[_0xcb97('0x50')],{'include':[{'model':db[_0xcb97('0x58')],'as':_0xcb97('0x52')},{'model':db[_0xcb97('0x58')],'as':_0xcb97('0x55')}]});}return null;})[_0xcb97('0x25')](respondWithResult(_0x4d2cd3,null))['catch'](handleError(_0x4d2cd3,null));};exports[_0xcb97('0x59')]=function(_0xc2baa6,_0x441da5,_0x369a5c){var _0x392ea0;var _0x3885cc='';var _0x583d34=_0xcb97('0x5a');return db['SalesforceAccount'][_0xcb97('0x4e')]({'where':{'id':_0xc2baa6['params']['id']},'attributes':['id','remoteUri',_0xcb97('0x5b'),_0xcb97('0x5c'),_0xcb97('0x5d'),'password',_0xcb97('0x5e')]})[_0xcb97('0x25')](handleEntityNotFound(_0x441da5,null))[_0xcb97('0x25')](function(_0x38c729){if(_0x38c729){_0x3885cc=_0x38c729[_0xcb97('0x5f')];var _0xda315d=_0x3885cc[_0xcb97('0x60')](-0x1);if(_0xda315d==='/'){_0x3885cc=_0x3885cc[_0xcb97('0x61')](0x0,_0x3885cc['lastIndexOf'](_0xda315d));}_0x392ea0=new jsforce[(_0xcb97('0x62'))]({'oauth2':{'loginUrl':_0x3885cc,'clientId':_0x38c729[_0xcb97('0x5b')],'clientSecret':_0x38c729['clientSecret']}});return _0x392ea0['login'](_0x38c729['username'],_0x38c729[_0xcb97('0x63')][_0xcb97('0x64')](_0x38c729[_0xcb97('0x5e')]));}})[_0xcb97('0x25')](function(_0x57fcb6){if(_0x57fcb6){if(!_[_0xcb97('0x65')](_0xc2baa6['query'][_0xcb97('0x66')])){_0x583d34=_0xc2baa6[_0xcb97('0x33')]['ticketType'];}return _0x392ea0[_0xcb97('0x67')](_0x583d34)[_0xcb97('0x68')]();}})[_0xcb97('0x25')](function(_0x13eb1c){var _0x13bc06=['OwnerId',_0xcb97('0x69'),'IsReminderSet',_0xcb97('0x6a'),'Subject','Description'];var _0x310330=['string','int',_0xcb97('0x6b'),_0xcb97('0x6c'),'email',_0xcb97('0x6d'),_0xcb97('0x6e')];if(_0x13eb1c){_[_0xcb97('0x6f')](_0x13eb1c['fields'],function(_0x13dac4){return _0x13bc06[_0xcb97('0x70')](_0x13dac4[_0xcb97('0x2a')])||!_0x310330[_0xcb97('0x70')](_0x13dac4[_0xcb97('0x40')]);});return{'count':_0x13eb1c[_0xcb97('0x36')][_0xcb97('0x4a')],'rows':_[_0xcb97('0x2d')](_0x13eb1c[_0xcb97('0x36')],function(_0x1392aa){return{'id':_0x1392aa[_0xcb97('0x2a')],'name':_0x1392aa[_0xcb97('0x71')],'custom':_0x1392aa['custom'],'options':_0x1392aa['picklistValues']['length']>0x0?_[_0xcb97('0x2d')](_0x1392aa[_0xcb97('0x72')],function(_0x5b7d71){return{'name':_0x5b7d71['label'],'value':_0x5b7d71[_0xcb97('0x73')]};}):_0x1392aa[_0xcb97('0x40')]=='boolean'?[{'name':_0xcb97('0x74'),'value':_0xcb97('0x75')},{'name':_0xcb97('0x76'),'value':_0xcb97('0x77')}]:[]};})};}})[_0xcb97('0x25')](respondWithResult(_0x441da5,null))['catch'](function(_0x3b556f){var _0x1c2d65=_0xc2baa6[_0xcb97('0x33')]['test']?0x1f4:_0x3b556f[_0xcb97('0x78')]||0x1f4;logger[_0xcb97('0x28')](_0xcb97('0x79'),'getFields',_0x1c2d65,JSON['stringify'](_0x3b556f));delete _0x3b556f[_0xcb97('0x2a')];if(_0x1c2d65===0x191){_0x1c2d65=0x190;}_0x441da5[_0xcb97('0x1a')](_0x1c2d65)[_0xcb97('0x2b')](_0xc2baa6[_0xcb97('0x33')][_0xcb97('0x7a')]?{'message':_0xcb97('0x7b'),'statusCode':_0x3b556f[_0xcb97('0x78')]}:_0x3b556f);});}; \ No newline at end of file +var _0xa20d=['int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','SalesforceConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','findOne','clientId','remoteUri','slice','lastIndexOf','Connection','clientSecret','login','username','password','securityToken','isNil','ticketType','sobject','describe','Subject','string'];(function(_0x3cfc78,_0x2a4932){var _0x3e9d7b=function(_0x51e4e1){while(--_0x51e4e1){_0x3cfc78['push'](_0x3cfc78['shift']());}};_0x3e9d7b(++_0x2a4932);}(_0xa20d,0x8d));var _0xda20=function(_0x2b8380,_0x44dffc){_0x2b8380=_0x2b8380-0x0;var _0x4aa69d=_0xa20d[_0x2b8380];return _0x4aa69d;};'use strict';var emlformat=require(_0xda20('0x0'));var rimraf=require(_0xda20('0x1'));var zipdir=require(_0xda20('0x2'));var jsonpatch=require(_0xda20('0x3'));var rp=require(_0xda20('0x4'));var moment=require(_0xda20('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda20('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xda20('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda20('0x8'));var crypto=require('crypto');var jsforce=require(_0xda20('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xda20('0x7'));var querystring=require(_0xda20('0xa'));var Papa=require(_0xda20('0xb'));var Redis=require(_0xda20('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xda20('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda20('0xe'));var logger=require(_0xda20('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xda20('0x10'));var licenseUtil=require(_0xda20('0x11'));var db=require(_0xda20('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2b0bb0,_0x42eee1){_0x42eee1=_0x42eee1||0xcc;return function(_0x2a29da){if(_0x2a29da){return _0x2b0bb0[_0xda20('0x13')](_0x42eee1);}return _0x2b0bb0['status'](_0x42eee1)[_0xda20('0x14')]();};}function respondWithResult(_0x5bae89,_0x4006d6){_0x4006d6=_0x4006d6||0xc8;return function(_0x5ed63b){if(_0x5ed63b){return _0x5bae89[_0xda20('0x15')](_0x4006d6)[_0xda20('0x16')](_0x5ed63b);}};}function respondWithFilteredResult(_0x35dd5b,_0x49632d){return function(_0x180e90){if(_0x180e90){var _0xf9b467=typeof _0x49632d[_0xda20('0x17')]==='undefined'&&typeof _0x49632d['limit']===_0xda20('0x18');var _0x26521e=_0x180e90[_0xda20('0x19')];var _0x1d88f4=_0xf9b467?0x0:_0x49632d[_0xda20('0x17')];var _0x260374=_0xf9b467?_0x180e90[_0xda20('0x19')]:_0x49632d[_0xda20('0x17')]+_0x49632d[_0xda20('0x1a')];var _0x5c9bf0;if(_0x260374>=_0x26521e){_0x260374=_0x26521e;_0x5c9bf0=0xc8;}else{_0x5c9bf0=0xce;}_0x35dd5b[_0xda20('0x15')](_0x5c9bf0);return _0x35dd5b[_0xda20('0x1b')](_0xda20('0x1c'),_0x1d88f4+'-'+_0x260374+'/'+_0x26521e)['json'](_0x180e90);}return null;};}function patchUpdates(_0x5f4496){return function(_0x261bd2){try{jsonpatch[_0xda20('0x1d')](_0x261bd2,_0x5f4496,!![]);}catch(_0x3d1f42){return BPromise[_0xda20('0x1e')](_0x3d1f42);}return _0x261bd2[_0xda20('0x1f')]();};}function saveUpdates(_0x34f54c,_0x5189df){return function(_0x513634){if(_0x513634){return _0x513634[_0xda20('0x20')](_0x34f54c)[_0xda20('0x21')](function(_0x48ffb3){return _0x48ffb3;});}return null;};}function removeEntity(_0x361bc6,_0x5285a4){return function(_0x5aadb4){if(_0x5aadb4){return _0x5aadb4[_0xda20('0x22')]()[_0xda20('0x21')](function(){_0x361bc6[_0xda20('0x15')](0xcc)[_0xda20('0x14')]();});}};}function handleEntityNotFound(_0xf864f1,_0x8da52c){return function(_0x401248){if(!_0x401248){_0xf864f1[_0xda20('0x13')](0x194);}return _0x401248;};}function handleError(_0x378b6b,_0x5000d5){_0x5000d5=_0x5000d5||0x1f4;return function(_0x26f4ed){logger['error'](_0x26f4ed['stack']);if(_0x26f4ed[_0xda20('0x23')]){delete _0x26f4ed[_0xda20('0x23')];}_0x378b6b[_0xda20('0x15')](_0x5000d5)[_0xda20('0x24')](_0x26f4ed);};}exports[_0xda20('0x25')]=function(_0x5dcf54,_0x4c63f0){var _0x15350e={},_0x7721ec={},_0xf1cbbe={'count':0x0,'rows':[]};var _0x2024f1=_[_0xda20('0x26')](db[_0xda20('0x27')][_0xda20('0x28')],function(_0x6b2e10){return{'name':_0x6b2e10['fieldName'],'type':_0x6b2e10[_0xda20('0x29')][_0xda20('0x2a')]};});_0x7721ec[_0xda20('0x2b')]=_['map'](_0x2024f1,_0xda20('0x23'));_0x7721ec[_0xda20('0x2c')]=_[_0xda20('0x2d')](_0x5dcf54[_0xda20('0x2c')]);_0x7721ec[_0xda20('0x2e')]=_[_0xda20('0x2f')](_0x7721ec[_0xda20('0x2b')],_0x7721ec[_0xda20('0x2c')]);_0x15350e[_0xda20('0x30')]=_[_0xda20('0x2f')](_0x7721ec['model'],qs[_0xda20('0x31')](_0x5dcf54['query'][_0xda20('0x31')]));_0x15350e[_0xda20('0x30')]=_0x15350e[_0xda20('0x30')][_0xda20('0x32')]?_0x15350e['attributes']:_0x7721ec[_0xda20('0x2b')];if(!_0x5dcf54['query'][_0xda20('0x33')](_0xda20('0x34'))){_0x15350e['limit']=qs[_0xda20('0x1a')](_0x5dcf54['query'][_0xda20('0x1a')]);_0x15350e[_0xda20('0x17')]=qs[_0xda20('0x17')](_0x5dcf54[_0xda20('0x2c')][_0xda20('0x17')]);}_0x15350e[_0xda20('0x35')]=qs['sort'](_0x5dcf54[_0xda20('0x2c')][_0xda20('0x36')]);_0x15350e[_0xda20('0x37')]=qs[_0xda20('0x2e')](_[_0xda20('0x38')](_0x5dcf54[_0xda20('0x2c')],_0x7721ec['filters']),_0x2024f1);if(_0x5dcf54[_0xda20('0x2c')][_0xda20('0x39')]){_0x15350e[_0xda20('0x37')]=_[_0xda20('0x3a')](_0x15350e['where'],{'$or':_[_0xda20('0x26')](_0x2024f1,function(_0x52e31b){if(_0x52e31b[_0xda20('0x29')]!==_0xda20('0x3b')){var _0x506aad={};_0x506aad[_0x52e31b[_0xda20('0x23')]]={'$like':'%'+_0x5dcf54[_0xda20('0x2c')][_0xda20('0x39')]+'%'};return _0x506aad;}})});}_0x15350e=_[_0xda20('0x3a')]({},_0x15350e,_0x5dcf54['options']);var _0x3a3d7a={'where':_0x15350e[_0xda20('0x37')]};return db[_0xda20('0x27')][_0xda20('0x19')](_0x3a3d7a)[_0xda20('0x21')](function(_0x28b332){_0xf1cbbe[_0xda20('0x19')]=_0x28b332;if(_0x5dcf54[_0xda20('0x2c')][_0xda20('0x3c')]){_0x15350e[_0xda20('0x3d')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xda20('0x3e')](_0x15350e);})[_0xda20('0x21')](function(_0x337f13){_0xf1cbbe[_0xda20('0x3f')]=_0x337f13;return _0xf1cbbe;})[_0xda20('0x21')](respondWithFilteredResult(_0x4c63f0,_0x15350e))[_0xda20('0x40')](handleError(_0x4c63f0,null));};exports[_0xda20('0x41')]=function(_0x13e937,_0x21a1a0){var _0x3fcf5d={'raw':![],'where':{'id':_0x13e937[_0xda20('0x42')]['id']}},_0x34cbb9={};_0x34cbb9[_0xda20('0x2b')]=_['keys'](db[_0xda20('0x27')][_0xda20('0x28')]);_0x34cbb9[_0xda20('0x2c')]=_['keys'](_0x13e937[_0xda20('0x2c')]);_0x34cbb9[_0xda20('0x2e')]=_['intersection'](_0x34cbb9[_0xda20('0x2b')],_0x34cbb9['query']);_0x3fcf5d[_0xda20('0x30')]=_[_0xda20('0x2f')](_0x34cbb9[_0xda20('0x2b')],qs[_0xda20('0x31')](_0x13e937[_0xda20('0x2c')][_0xda20('0x31')]));_0x3fcf5d[_0xda20('0x30')]=_0x3fcf5d['attributes'][_0xda20('0x32')]?_0x3fcf5d[_0xda20('0x30')]:_0x34cbb9[_0xda20('0x2b')];if(_0x13e937[_0xda20('0x2c')][_0xda20('0x3c')]){_0x3fcf5d[_0xda20('0x3d')]=[{'all':!![]}];}_0x3fcf5d=_[_0xda20('0x3a')]({},_0x3fcf5d,_0x13e937[_0xda20('0x43')]);return db[_0xda20('0x27')][_0xda20('0x44')](_0x3fcf5d)[_0xda20('0x21')](handleEntityNotFound(_0x21a1a0,null))[_0xda20('0x21')](respondWithResult(_0x21a1a0,null))[_0xda20('0x40')](handleError(_0x21a1a0,null));};exports[_0xda20('0x45')]=function(_0xfdd18d,_0x225221){return db[_0xda20('0x27')]['create'](_0xfdd18d['body'],{})[_0xda20('0x21')](respondWithResult(_0x225221,0xc9))[_0xda20('0x40')](handleError(_0x225221,null));};exports[_0xda20('0x20')]=function(_0x546468,_0x53a08b){if(_0x546468[_0xda20('0x46')]['id']){delete _0x546468[_0xda20('0x46')]['id'];}return db[_0xda20('0x27')][_0xda20('0x44')]({'where':{'id':_0x546468[_0xda20('0x42')]['id']}})[_0xda20('0x21')](handleEntityNotFound(_0x53a08b,null))['then'](saveUpdates(_0x546468['body'],null))[_0xda20('0x21')](respondWithResult(_0x53a08b,null))[_0xda20('0x40')](handleError(_0x53a08b,null));};exports['destroy']=function(_0xe4491e,_0xce176d){return db[_0xda20('0x27')][_0xda20('0x44')]({'where':{'id':_0xe4491e[_0xda20('0x42')]['id']}})['then'](handleEntityNotFound(_0xce176d,null))[_0xda20('0x21')](removeEntity(_0xce176d,null))[_0xda20('0x40')](handleError(_0xce176d,null));};exports[_0xda20('0x47')]=function(_0x26136f,_0x15c520,_0xfdf6cb){var _0x2a0cc9={};var _0x5341ca={};var _0x15b8ee;var _0x490762;return db[_0xda20('0x27')]['findOne']({'where':{'id':_0x26136f['params']['id']}})['then'](handleEntityNotFound(_0x15c520,null))[_0xda20('0x21')](function(_0xe19398){if(_0xe19398){_0x15b8ee=_0xe19398;_0x5341ca[_0xda20('0x2b')]=_[_0xda20('0x2d')](db[_0xda20('0x48')][_0xda20('0x28')]);_0x5341ca['query']=_[_0xda20('0x2d')](_0x26136f[_0xda20('0x2c')]);_0x5341ca[_0xda20('0x2e')]=_[_0xda20('0x2f')](_0x5341ca[_0xda20('0x2b')],_0x5341ca['query']);_0x2a0cc9['attributes']=_[_0xda20('0x2f')](_0x5341ca[_0xda20('0x2b')],qs[_0xda20('0x31')](_0x26136f[_0xda20('0x2c')][_0xda20('0x31')]));_0x2a0cc9[_0xda20('0x30')]=_0x2a0cc9[_0xda20('0x30')]['length']?_0x2a0cc9[_0xda20('0x30')]:_0x5341ca['model'];_0x2a0cc9['order']=qs[_0xda20('0x36')](_0x26136f[_0xda20('0x2c')][_0xda20('0x36')]);_0x2a0cc9['where']=qs[_0xda20('0x2e')](_[_0xda20('0x38')](_0x26136f[_0xda20('0x2c')],_0x5341ca[_0xda20('0x2e')]));if(_0x26136f[_0xda20('0x2c')][_0xda20('0x39')]){_0x2a0cc9[_0xda20('0x37')]=_[_0xda20('0x3a')](_0x2a0cc9[_0xda20('0x37')],{'$or':_[_0xda20('0x26')](_0x2a0cc9['attributes'],function(_0x338833){var _0x34e854={};_0x34e854[_0x338833]={'$like':'%'+_0x26136f[_0xda20('0x2c')][_0xda20('0x39')]+'%'};return _0x34e854;})});}_0x2a0cc9=_[_0xda20('0x3a')]({},_0x2a0cc9,_0x26136f[_0xda20('0x43')]);return _0x15b8ee[_0xda20('0x47')](_0x2a0cc9);}})[_0xda20('0x21')](function(_0x2ded40){if(_0x2ded40){_0x490762=_0x2ded40[_0xda20('0x32')];if(!_0x26136f['query'][_0xda20('0x33')]('nolimit')){_0x2a0cc9['limit']=qs['limit'](_0x26136f[_0xda20('0x2c')][_0xda20('0x1a')]);_0x2a0cc9[_0xda20('0x17')]=qs[_0xda20('0x17')](_0x26136f[_0xda20('0x2c')][_0xda20('0x17')]);}return _0x15b8ee[_0xda20('0x47')](_0x2a0cc9);}})[_0xda20('0x21')](function(_0x412831){if(_0x412831){return _0x412831?{'count':_0x490762,'rows':_0x412831}:null;}})[_0xda20('0x21')](respondWithResult(_0x15c520,null))[_0xda20('0x40')](handleError(_0x15c520,null));};exports[_0xda20('0x49')]=function(_0x58c550,_0x1b1c8a,_0x57ab35){if(_0x58c550['body']['id']){delete _0x58c550['body']['id'];}return db[_0xda20('0x27')]['findOne']({'where':{'id':_0x58c550[_0xda20('0x42')]['id']}})[_0xda20('0x21')](handleEntityNotFound(_0x1b1c8a,null))[_0xda20('0x21')](function(_0xfad000){if(_0xfad000){_0x58c550['body']['AccountId']=_0xfad000['id'];_0x58c550[_0xda20('0x46')][_0xda20('0x4a')]=integrations[_0xda20('0x4b')](_0x58c550[_0xda20('0x46')]['channel'],_0x58c550[_0xda20('0x46')]['type']);_0x58c550['body'][_0xda20('0x4c')]=integrations[_0xda20('0x4d')](_0x58c550[_0xda20('0x46')][_0xda20('0x4e')],_0x58c550['body'][_0xda20('0x29')]);return db['SalesforceConfiguration'][_0xda20('0x45')](_0x58c550['body'],{'include':[{'model':db[_0xda20('0x4f')],'as':_0xda20('0x4a')},{'model':db[_0xda20('0x4f')],'as':'Descriptions'}]});}return null;})[_0xda20('0x21')](respondWithResult(_0x1b1c8a,null))[_0xda20('0x40')](handleError(_0x1b1c8a,null));};exports[_0xda20('0x50')]=function(_0x237173,_0x309487,_0x3a277b){var _0x490a55;var _0x34c0ce='';var _0x4bfdf6=_0xda20('0x51');return db[_0xda20('0x27')][_0xda20('0x52')]({'where':{'id':_0x237173['params']['id']},'attributes':['id','remoteUri',_0xda20('0x53'),'clientSecret','username','password','securityToken']})[_0xda20('0x21')](handleEntityNotFound(_0x309487,null))[_0xda20('0x21')](function(_0x50764b){if(_0x50764b){_0x34c0ce=_0x50764b[_0xda20('0x54')];var _0x11246f=_0x34c0ce[_0xda20('0x55')](-0x1);if(_0x11246f==='/'){_0x34c0ce=_0x34c0ce['substring'](0x0,_0x34c0ce[_0xda20('0x56')](_0x11246f));}_0x490a55=new jsforce[(_0xda20('0x57'))]({'oauth2':{'loginUrl':_0x34c0ce,'clientId':_0x50764b['clientId'],'clientSecret':_0x50764b[_0xda20('0x58')]}});return _0x490a55[_0xda20('0x59')](_0x50764b[_0xda20('0x5a')],_0x50764b[_0xda20('0x5b')]['concat'](_0x50764b[_0xda20('0x5c')]));}})[_0xda20('0x21')](function(_0x296ed6){if(_0x296ed6){if(!_[_0xda20('0x5d')](_0x237173[_0xda20('0x2c')]['ticketType'])){_0x4bfdf6=_0x237173[_0xda20('0x2c')][_0xda20('0x5e')];}return _0x490a55[_0xda20('0x5f')](_0x4bfdf6)[_0xda20('0x60')]();}})[_0xda20('0x21')](function(_0x27a810){var _0x2cb247=['OwnerId','ActivityDate','IsReminderSet','IsRecurrence',_0xda20('0x61'),'Description'];var _0x38570f=[_0xda20('0x62'),_0xda20('0x63'),'picklist',_0xda20('0x64'),_0xda20('0x65'),_0xda20('0x66'),_0xda20('0x67')];if(_0x27a810){_[_0xda20('0x68')](_0x27a810[_0xda20('0x31')],function(_0x1d323b){return _0x2cb247['includes'](_0x1d323b[_0xda20('0x23')])||!_0x38570f[_0xda20('0x69')](_0x1d323b[_0xda20('0x29')]);});return{'count':_0x27a810[_0xda20('0x31')][_0xda20('0x32')],'rows':_['map'](_0x27a810['fields'],function(_0x3650ab){return{'id':_0x3650ab[_0xda20('0x23')],'name':_0x3650ab[_0xda20('0x6a')],'custom':_0x3650ab[_0xda20('0x6b')],'options':_0x3650ab[_0xda20('0x6c')][_0xda20('0x32')]>0x0?_[_0xda20('0x26')](_0x3650ab[_0xda20('0x6c')],function(_0x148bc3){return{'name':_0x148bc3[_0xda20('0x6a')],'value':_0x148bc3[_0xda20('0x6d')]};}):_0x3650ab['type']==_0xda20('0x64')?[{'name':_0xda20('0x6e'),'value':_0xda20('0x6f')},{'name':_0xda20('0x70'),'value':_0xda20('0x71')}]:[]};})};}})[_0xda20('0x21')](respondWithResult(_0x309487,null))[_0xda20('0x40')](function(_0x13f6d7){var _0x24ef67=_0x237173[_0xda20('0x2c')][_0xda20('0x72')]?0x1f4:_0x13f6d7['statusCode']||0x1f4;logger[_0xda20('0x73')](_0xda20('0x74'),'getFields',_0x24ef67,JSON[_0xda20('0x75')](_0x13f6d7));delete _0x13f6d7[_0xda20('0x23')];if(_0x24ef67===0x191){_0x24ef67=0x190;}_0x309487['status'](_0x24ef67)[_0xda20('0x24')](_0x237173['query'][_0xda20('0x72')]?{'message':_0xda20('0x76'),'statusCode':_0x13f6d7[_0xda20('0x77')]}:_0x13f6d7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index d12338c..6cf3b6a 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 _0xd596=['moment','bluebird','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xd596,0x14c));var _0x6d59=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xd596[_0x425716];return _0x2d39af;};'use strict';var _=require(_0x6d59('0x0'));var util=require(_0x6d59('0x1'));var logger=require(_0x6d59('0x2'))(_0x6d59('0x3'));var moment=require(_0x6d59('0x4'));var BPromise=require(_0x6d59('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d59('0x6'));var rimraf=require('rimraf');var config=require(_0x6d59('0x7'));var attributes=require(_0x6d59('0x8'));var integrations=require(_0x6d59('0x9'));module[_0x6d59('0xa')]=function(_0x51eb95,_0x4349d6){return _0x51eb95[_0x6d59('0xb')](_0x6d59('0xc'),attributes,{'tableName':_0x6d59('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfabe=['int_salesforce_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','SalesforceAccount'];(function(_0x450076,_0x10983b){var _0x2029cc=function(_0x4a5e76){while(--_0x4a5e76){_0x450076['push'](_0x450076['shift']());}};_0x2029cc(++_0x10983b);}(_0xfabe,0x9b));var _0xefab=function(_0x420984,_0x348242){_0x420984=_0x420984-0x0;var _0x2bb911=_0xfabe[_0x420984];return _0x2bb911;};'use strict';var _=require(_0xefab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xefab('0x1'));var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var rp=require(_0xefab('0x4'));var fs=require('fs');var path=require(_0xefab('0x5'));var rimraf=require(_0xefab('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xefab('0x7'));module[_0xefab('0x8')]=function(_0x260585,_0x578611){return _0x260585['define'](_0xefab('0x9'),attributes,{'tableName':_0xefab('0xa'),'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 d547d7d..a6e524c 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 _0x7f1c=['options','raw','where','attributes','limit','include','map','model','then','stringify','catch','ShowSalesforceAccount','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','GetSalesforceAccount','SalesforceAccount','findAll'];(function(_0x290b74,_0x4186b7){var _0x2cd1b0=function(_0x168e62){while(--_0x168e62){_0x290b74['push'](_0x290b74['shift']());}};_0x2cd1b0(++_0x4186b7);}(_0x7f1c,0xdf));var _0xc7f1=function(_0x458897,_0x2175c6){_0x458897=_0x458897-0x0;var _0x1dabb9=_0x7f1c[_0x458897];return _0x1dabb9;};'use strict';var _=require('lodash');var util=require(_0xc7f1('0x0'));var moment=require(_0xc7f1('0x1'));var BPromise=require(_0xc7f1('0x2'));var rs=require(_0xc7f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc7f1('0x4'));var logger=require(_0xc7f1('0x5'))(_0xc7f1('0x6'));var config=require(_0xc7f1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc7f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25b4cf,_0xa7e8d2,_0x7db466){return new BPromise(function(_0x10abde,_0x5a5e05){return client[_0xc7f1('0x9')](_0x25b4cf,_0x7db466)['then'](function(_0x5e2c5f){logger[_0xc7f1('0xa')](_0xc7f1('0xb'),_0xa7e8d2,_0xc7f1('0xc'));logger[_0xc7f1('0xd')](_0xc7f1('0xe'),_0xa7e8d2,_0xc7f1('0xc'),JSON['stringify'](_0x5e2c5f));if(_0x5e2c5f['error']){if(_0x5e2c5f['error'][_0xc7f1('0xf')]===0x1f4){logger[_0xc7f1('0x10')](_0xc7f1('0xb'),_0xa7e8d2,_0x5e2c5f['error']['message']);return _0x5a5e05(_0x5e2c5f[_0xc7f1('0x10')][_0xc7f1('0x11')]);}logger[_0xc7f1('0x10')](_0xc7f1('0xb'),_0xa7e8d2,_0x5e2c5f['error'][_0xc7f1('0x11')]);return _0x10abde(_0x5e2c5f[_0xc7f1('0x10')][_0xc7f1('0x11')]);}else{logger[_0xc7f1('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0xa7e8d2,_0xc7f1('0xc'));_0x10abde(_0x5e2c5f[_0xc7f1('0x12')][_0xc7f1('0x11')]);}})['catch'](function(_0x406694){logger[_0xc7f1('0x10')](_0xc7f1('0xb'),_0xa7e8d2,_0x406694);_0x5a5e05(_0x406694);});});}exports[_0xc7f1('0x13')]=function(_0x226f23){var _0x29f1d3=this;return new Promise(function(_0x5e5601,_0x4906ea){return db[_0xc7f1('0x14')][_0xc7f1('0x15')]({'raw':_0x226f23[_0xc7f1('0x16')]?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x17')]===undefined?!![]:![]:!![],'where':_0x226f23['options']?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x18')]||null:null,'attributes':_0x226f23[_0xc7f1('0x16')]?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x19')]||null:null,'limit':_0x226f23[_0xc7f1('0x16')]?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x1a')]||null:null,'include':_0x226f23[_0xc7f1('0x16')]?_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0x226f23[_0xc7f1('0x16')][_0xc7f1('0x1b')],function(_0x38f970){return{'model':db[_0x38f970[_0xc7f1('0x1d')]],'as':_0x38f970['as'],'attributes':_0x38f970[_0xc7f1('0x19')],'include':_0x38f970[_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0x38f970[_0xc7f1('0x1b')],function(_0x25b0f4){return{'model':db[_0x25b0f4['model']],'as':_0x25b0f4['as'],'attributes':_0x25b0f4[_0xc7f1('0x19')],'include':_0x25b0f4[_0xc7f1('0x1b')]?_['map'](_0x25b0f4[_0xc7f1('0x1b')],function(_0x2e8705){return{'model':db[_0x2e8705['model']],'as':_0x2e8705['as'],'attributes':_0x2e8705['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7f1('0x1e')](function(_0x10b1ab){logger[_0xc7f1('0xa')](_0xc7f1('0x13'),_0x226f23);logger[_0xc7f1('0xd')](_0xc7f1('0x13'),_0x226f23,JSON[_0xc7f1('0x1f')](_0x10b1ab));_0x5e5601(_0x10b1ab);})[_0xc7f1('0x20')](function(_0x248963){logger[_0xc7f1('0x10')](_0xc7f1('0x13'),_0x248963[_0xc7f1('0x11')],_0x226f23);_0x4906ea(_0x29f1d3[_0xc7f1('0x10')](0x1f4,_0x248963['message']));});});};exports[_0xc7f1('0x21')]=function(_0x2a28ab){var _0x311d8e=this;return new Promise(function(_0x4b2f16,_0x1a13af){return db['SalesforceAccount'][_0xc7f1('0x22')]({'raw':_0x2a28ab['options']?_0x2a28ab[_0xc7f1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2a28ab['options']?_0x2a28ab[_0xc7f1('0x16')][_0xc7f1('0x18')]||null:null,'attributes':_0x2a28ab['options']?_0x2a28ab[_0xc7f1('0x16')]['attributes']||null:null,'include':_0x2a28ab['options']?_0x2a28ab[_0xc7f1('0x16')][_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0x2a28ab[_0xc7f1('0x16')][_0xc7f1('0x1b')],function(_0xd47b51){return{'model':db[_0xd47b51[_0xc7f1('0x1d')]],'as':_0xd47b51['as'],'attributes':_0xd47b51[_0xc7f1('0x19')],'include':_0xd47b51[_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0xd47b51[_0xc7f1('0x1b')],function(_0x17a64e){return{'model':db[_0x17a64e[_0xc7f1('0x1d')]],'as':_0x17a64e['as'],'attributes':_0x17a64e[_0xc7f1('0x19')],'include':_0x17a64e[_0xc7f1('0x1b')]?_[_0xc7f1('0x1c')](_0x17a64e[_0xc7f1('0x1b')],function(_0x4fa0e8){return{'model':db[_0x4fa0e8[_0xc7f1('0x1d')]],'as':_0x4fa0e8['as'],'attributes':_0x4fa0e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7f1('0x1e')](function(_0x5510c4){logger[_0xc7f1('0xa')]('ShowSalesforceAccount',_0x2a28ab);logger[_0xc7f1('0xd')](_0xc7f1('0x21'),_0x2a28ab,JSON[_0xc7f1('0x1f')](_0x5510c4));_0x4b2f16(_0x5510c4);})['catch'](function(_0x301212){logger['error'](_0xc7f1('0x21'),_0x301212[_0xc7f1('0x11')],_0x2a28ab);_0x1a13af(_0x311d8e['error'](0x1f4,_0x301212['message']));});});}; \ No newline at end of file +var _0x142c=['model','catch','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','include','map'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0x142c,0x8f));var _0xc142=function(_0x58b332,_0x54787d){_0x58b332=_0x58b332-0x0;var _0xb8e97e=_0x142c[_0x58b332];return _0xb8e97e;};'use strict';var _=require(_0xc142('0x0'));var util=require(_0xc142('0x1'));var moment=require(_0xc142('0x2'));var BPromise=require(_0xc142('0x3'));var rs=require(_0xc142('0x4'));var fs=require('fs');var Redis=require(_0xc142('0x5'));var db=require(_0xc142('0x6'))['db'];var utils=require(_0xc142('0x7'));var logger=require('../../config/logger')(_0xc142('0x8'));var config=require(_0xc142('0x9'));var jayson=require(_0xc142('0xa'));var client=jayson[_0xc142('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46f1d2,_0x583f7b,_0x477ae4){return new BPromise(function(_0x2e8d46,_0x4794dc){return client[_0xc142('0xc')](_0x46f1d2,_0x477ae4)[_0xc142('0xd')](function(_0x557d8a){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x583f7b,_0xc142('0xe'));logger[_0xc142('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x583f7b,_0xc142('0xe'),JSON[_0xc142('0x10')](_0x557d8a));if(_0x557d8a[_0xc142('0x11')]){if(_0x557d8a['error'][_0xc142('0x12')]===0x1f4){logger[_0xc142('0x11')](_0xc142('0x13'),_0x583f7b,_0x557d8a[_0xc142('0x11')]['message']);return _0x4794dc(_0x557d8a[_0xc142('0x11')][_0xc142('0x14')]);}logger[_0xc142('0x11')](_0xc142('0x13'),_0x583f7b,_0x557d8a[_0xc142('0x11')]['message']);return _0x2e8d46(_0x557d8a[_0xc142('0x11')]['message']);}else{logger[_0xc142('0x15')](_0xc142('0x13'),_0x583f7b,'request\x20sent');_0x2e8d46(_0x557d8a[_0xc142('0x16')][_0xc142('0x14')]);}})['catch'](function(_0x4608b7){logger[_0xc142('0x11')](_0xc142('0x13'),_0x583f7b,_0x4608b7);_0x4794dc(_0x4608b7);});});}exports[_0xc142('0x17')]=function(_0x3bd5d0){var _0x17ac56=this;return new Promise(function(_0x11235f,_0x499535){return db[_0xc142('0x18')][_0xc142('0x19')]({'raw':_0x3bd5d0[_0xc142('0x1a')]?_0x3bd5d0[_0xc142('0x1a')][_0xc142('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bd5d0[_0xc142('0x1a')]?_0x3bd5d0['options'][_0xc142('0x1c')]||null:null,'attributes':_0x3bd5d0[_0xc142('0x1a')]?_0x3bd5d0[_0xc142('0x1a')][_0xc142('0x1d')]||null:null,'limit':_0x3bd5d0[_0xc142('0x1a')]?_0x3bd5d0[_0xc142('0x1a')]['limit']||null:null,'include':_0x3bd5d0['options']?_0x3bd5d0[_0xc142('0x1a')][_0xc142('0x1e')]?_[_0xc142('0x1f')](_0x3bd5d0[_0xc142('0x1a')][_0xc142('0x1e')],function(_0xfa0959){return{'model':db[_0xfa0959[_0xc142('0x20')]],'as':_0xfa0959['as'],'attributes':_0xfa0959[_0xc142('0x1d')],'include':_0xfa0959[_0xc142('0x1e')]?_['map'](_0xfa0959[_0xc142('0x1e')],function(_0xfb7d87){return{'model':db[_0xfb7d87[_0xc142('0x20')]],'as':_0xfb7d87['as'],'attributes':_0xfb7d87['attributes'],'include':_0xfb7d87[_0xc142('0x1e')]?_[_0xc142('0x1f')](_0xfb7d87[_0xc142('0x1e')],function(_0x4fcc97){return{'model':db[_0x4fcc97[_0xc142('0x20')]],'as':_0x4fcc97['as'],'attributes':_0x4fcc97[_0xc142('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc142('0xd')](function(_0x15c7a3){logger[_0xc142('0x15')](_0xc142('0x17'),_0x3bd5d0);logger[_0xc142('0xf')](_0xc142('0x17'),_0x3bd5d0,JSON[_0xc142('0x10')](_0x15c7a3));_0x11235f(_0x15c7a3);})[_0xc142('0x21')](function(_0x1e4949){logger[_0xc142('0x11')]('GetSalesforceAccount',_0x1e4949[_0xc142('0x14')],_0x3bd5d0);_0x499535(_0x17ac56[_0xc142('0x11')](0x1f4,_0x1e4949['message']));});});};exports[_0xc142('0x22')]=function(_0x2d4c85){var _0x131ec8=this;return new Promise(function(_0x1fc734,_0x444ae3){return db[_0xc142('0x18')]['find']({'raw':_0x2d4c85['options']?_0x2d4c85[_0xc142('0x1a')][_0xc142('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d4c85[_0xc142('0x1a')]?_0x2d4c85[_0xc142('0x1a')]['where']||null:null,'attributes':_0x2d4c85['options']?_0x2d4c85[_0xc142('0x1a')]['attributes']||null:null,'include':_0x2d4c85[_0xc142('0x1a')]?_0x2d4c85[_0xc142('0x1a')][_0xc142('0x1e')]?_['map'](_0x2d4c85[_0xc142('0x1a')][_0xc142('0x1e')],function(_0x24e8d9){return{'model':db[_0x24e8d9[_0xc142('0x20')]],'as':_0x24e8d9['as'],'attributes':_0x24e8d9[_0xc142('0x1d')],'include':_0x24e8d9[_0xc142('0x1e')]?_[_0xc142('0x1f')](_0x24e8d9[_0xc142('0x1e')],function(_0x4ac611){return{'model':db[_0x4ac611['model']],'as':_0x4ac611['as'],'attributes':_0x4ac611[_0xc142('0x1d')],'include':_0x4ac611[_0xc142('0x1e')]?_[_0xc142('0x1f')](_0x4ac611[_0xc142('0x1e')],function(_0x582c43){return{'model':db[_0x582c43[_0xc142('0x20')]],'as':_0x582c43['as'],'attributes':_0x582c43[_0xc142('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc142('0xd')](function(_0x392833){logger[_0xc142('0x15')](_0xc142('0x22'),_0x2d4c85);logger[_0xc142('0xf')](_0xc142('0x22'),_0x2d4c85,JSON[_0xc142('0x10')](_0x392833));_0x1fc734(_0x392833);})[_0xc142('0x21')](function(_0x4f3afd){logger[_0xc142('0x11')](_0xc142('0x22'),_0x4f3afd['message'],_0x2d4c85);_0x444ae3(_0x131ec8['error'](0x1f4,_0x4f3afd[_0xc142('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index ae60f20..bea5d95 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdb28,0x106));var _0x8db2=function(_0x33f761,_0x272b5d){_0x33f761=_0x33f761-0x0;var _0x2d4b2a=_0xdb28[_0x33f761];return _0x2d4b2a;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x1c7aff,_0xdf72b7){var _0x106186=function(_0x4ed19a){while(--_0x4ed19a){_0x1c7aff['push'](_0x1c7aff['shift']());}};_0x106186(++_0xdf72b7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2cb69f3..838ab19 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 _0xd408=['account_contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Case','contact_lead','contact','lead'];(function(_0xa7c5e1,_0x5aeccb){var _0x460004=function(_0x2062be){while(--_0x2062be){_0xa7c5e1['push'](_0xa7c5e1['shift']());}};_0x460004(++_0x5aeccb);}(_0xd408,0x1e7));var _0x8d40=function(_0x21695a,_0x16cc85){_0x21695a=_0x21695a-0x0;var _0x4f9ac4=_0xd408[_0x21695a];return _0x4f9ac4;};'use strict';var Sequelize=require(_0x8d40('0x0'));module[_0x8d40('0x1')]={'name':{'type':Sequelize[_0x8d40('0x2')]},'description':{'type':Sequelize[_0x8d40('0x2')]},'ticketType':{'type':Sequelize[_0x8d40('0x3')]('Task',_0x8d40('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x8d40('0x3')](_0x8d40('0x5'),_0x8d40('0x6'),_0x8d40('0x7'),_0x8d40('0x8'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x8d40('0x9'),_0x8d40('0x6'),_0x8d40('0x7'),_0x8d40('0xa')),'defaultValue':_0x8d40('0x7')},'leadId':{'type':Sequelize[_0x8d40('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x8d40('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x8d40('0x2')]}}; \ No newline at end of file +var _0x1e00=['account','contact_lead','nothing','sequelize','STRING','Task','Case','contact','lead','account_contact_lead'];(function(_0x263464,_0xa3aa44){var _0x795f6b=function(_0x44fe5b){while(--_0x44fe5b){_0x263464['push'](_0x263464['shift']());}};_0x795f6b(++_0xa3aa44);}(_0x1e00,0xa3));var _0x01e0=function(_0x26593c,_0x4bd769){_0x26593c=_0x26593c-0x0;var _0xdb3585=_0x1e00[_0x26593c];return _0xdb3585;};'use strict';var Sequelize=require(_0x01e0('0x0'));module['exports']={'name':{'type':Sequelize[_0x01e0('0x1')]},'description':{'type':Sequelize[_0x01e0('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x01e0('0x2'),_0x01e0('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x01e0('0x4'),_0x01e0('0x5'),_0x01e0('0x6'),_0x01e0('0x7')),'defaultValue':_0x01e0('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x01e0('0x9'),_0x01e0('0x4'),_0x01e0('0x5'),_0x01e0('0x7')),'defaultValue':_0x01e0('0x5')},'leadId':{'type':Sequelize[_0x01e0('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x01e0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 310f047..87e77a4 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 _0x88c8=['index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','update','destroy','getFields','findOne','SalesforceField','filter','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name'];(function(_0x1c8522,_0x29b58e){var _0x478fd9=function(_0x4bb05f){while(--_0x4bb05f){_0x1c8522['push'](_0x1c8522['shift']());}};_0x478fd9(++_0x29b58e);}(_0x88c8,0x117));var _0x888c=function(_0x4fd2bb,_0x172b61){_0x4fd2bb=_0x4fd2bb-0x0;var _0x10b87b=_0x88c8[_0x4fd2bb];return _0x10b87b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x888c('0x0'));var zipdir=require(_0x888c('0x1'));var jsonpatch=require(_0x888c('0x2'));var rp=require(_0x888c('0x3'));var moment=require(_0x888c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x888c('0x5'));var util=require(_0x888c('0x6'));var path=require(_0x888c('0x7'));var sox=require(_0x888c('0x8'));var csv=require('to-csv');var ejs=require(_0x888c('0x9'));var fs=require('fs');var fs_extra=require(_0x888c('0xa'));var _=require(_0x888c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x888c('0xc'));var deskjs=require(_0x888c('0xd'));var toCsv=require(_0x888c('0xe'));var querystring=require(_0x888c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x888c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x888c('0x11'))(_0x888c('0x12'));var utils=require('../../config/utils');var config=require(_0x888c('0x13'));var licenseUtil=require(_0x888c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35f2d5,_0x33a875){_0x33a875=_0x33a875||0xcc;return function(_0x56d9df){if(_0x56d9df){return _0x35f2d5[_0x888c('0x15')](_0x33a875);}return _0x35f2d5[_0x888c('0x16')](_0x33a875)[_0x888c('0x17')]();};}function respondWithResult(_0x3a9071,_0x176860){_0x176860=_0x176860||0xc8;return function(_0x119fe6){if(_0x119fe6){return _0x3a9071[_0x888c('0x16')](_0x176860)[_0x888c('0x18')](_0x119fe6);}};}function respondWithFilteredResult(_0x56263c,_0x1cde30){return function(_0xc25010){if(_0xc25010){var _0x4e0aee=typeof _0x1cde30[_0x888c('0x19')]==='undefined'&&typeof _0x1cde30[_0x888c('0x1a')]==='undefined';var _0x2e070=_0xc25010[_0x888c('0x1b')];var _0x206d17=_0x4e0aee?0x0:_0x1cde30[_0x888c('0x19')];var _0x20807e=_0x4e0aee?_0xc25010['count']:_0x1cde30[_0x888c('0x19')]+_0x1cde30[_0x888c('0x1a')];var _0xdb1277;if(_0x20807e>=_0x2e070){_0x20807e=_0x2e070;_0xdb1277=0xc8;}else{_0xdb1277=0xce;}_0x56263c[_0x888c('0x16')](_0xdb1277);return _0x56263c[_0x888c('0x1c')](_0x888c('0x1d'),_0x206d17+'-'+_0x20807e+'/'+_0x2e070)[_0x888c('0x18')](_0xc25010);}return null;};}function patchUpdates(_0x3740fc){return function(_0x3088f0){try{jsonpatch[_0x888c('0x1e')](_0x3088f0,_0x3740fc,!![]);}catch(_0x30488f){return BPromise[_0x888c('0x1f')](_0x30488f);}return _0x3088f0[_0x888c('0x20')]();};}function saveUpdates(_0x2e4482,_0x5b05d4){return function(_0x4bfb6d){if(_0x4bfb6d){return _0x4bfb6d['update'](_0x2e4482)[_0x888c('0x21')](function(_0x52221d){return _0x52221d;});}return null;};}function removeEntity(_0x4110f0,_0x27d86b){return function(_0x38ef33){if(_0x38ef33){return _0x38ef33['destroy']()[_0x888c('0x21')](function(){_0x4110f0[_0x888c('0x16')](0xcc)[_0x888c('0x17')]();});}};}function handleEntityNotFound(_0x4d992a,_0x1569d2){return function(_0x2ca60f){if(!_0x2ca60f){_0x4d992a['sendStatus'](0x194);}return _0x2ca60f;};}function handleError(_0x20c5f9,_0x431e2b){_0x431e2b=_0x431e2b||0x1f4;return function(_0x161996){logger[_0x888c('0x22')](_0x161996[_0x888c('0x23')]);if(_0x161996[_0x888c('0x24')]){delete _0x161996['name'];}_0x20c5f9[_0x888c('0x16')](_0x431e2b)['send'](_0x161996);};}exports[_0x888c('0x25')]=function(_0x1e148b,_0x29fa1e){var _0x387e45={},_0x24342b={},_0x162c93={'count':0x0,'rows':[]};var _0x1bb2ab=_[_0x888c('0x26')](db[_0x888c('0x27')][_0x888c('0x28')],function(_0x3eed38){return{'name':_0x3eed38[_0x888c('0x29')],'type':_0x3eed38[_0x888c('0x2a')][_0x888c('0x2b')]};});_0x24342b[_0x888c('0x2c')]=_['map'](_0x1bb2ab,_0x888c('0x24'));_0x24342b[_0x888c('0x2d')]=_['keys'](_0x1e148b[_0x888c('0x2d')]);_0x24342b['filters']=_[_0x888c('0x2e')](_0x24342b['model'],_0x24342b['query']);_0x387e45['attributes']=_['intersection'](_0x24342b[_0x888c('0x2c')],qs[_0x888c('0x2f')](_0x1e148b['query']['fields']));_0x387e45[_0x888c('0x30')]=_0x387e45[_0x888c('0x30')][_0x888c('0x31')]?_0x387e45[_0x888c('0x30')]:_0x24342b[_0x888c('0x2c')];if(!_0x1e148b['query'][_0x888c('0x32')](_0x888c('0x33'))){_0x387e45[_0x888c('0x1a')]=qs[_0x888c('0x1a')](_0x1e148b['query'][_0x888c('0x1a')]);_0x387e45[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x1e148b['query'][_0x888c('0x19')]);}_0x387e45[_0x888c('0x34')]=qs['sort'](_0x1e148b[_0x888c('0x2d')][_0x888c('0x35')]);_0x387e45[_0x888c('0x36')]=qs[_0x888c('0x37')](_[_0x888c('0x38')](_0x1e148b[_0x888c('0x2d')],_0x24342b[_0x888c('0x37')]),_0x1bb2ab);if(_0x1e148b[_0x888c('0x2d')]['filter']){_0x387e45[_0x888c('0x36')]=_[_0x888c('0x39')](_0x387e45[_0x888c('0x36')],{'$or':_[_0x888c('0x26')](_0x1bb2ab,function(_0x3b032a){if(_0x3b032a[_0x888c('0x2a')]!==_0x888c('0x3a')){var _0x41d0d6={};_0x41d0d6[_0x3b032a[_0x888c('0x24')]]={'$like':'%'+_0x1e148b[_0x888c('0x2d')]['filter']+'%'};return _0x41d0d6;}})});}_0x387e45=_[_0x888c('0x39')]({},_0x387e45,_0x1e148b[_0x888c('0x3b')]);var _0x37afea={'where':_0x387e45[_0x888c('0x36')]};return db[_0x888c('0x27')][_0x888c('0x1b')](_0x37afea)[_0x888c('0x21')](function(_0x4bbb3f){_0x162c93[_0x888c('0x1b')]=_0x4bbb3f;if(_0x1e148b[_0x888c('0x2d')]['includeAll']){_0x387e45[_0x888c('0x3c')]=[{'all':!![]}];}return db[_0x888c('0x27')][_0x888c('0x3d')](_0x387e45);})[_0x888c('0x21')](function(_0x4ef38b){_0x162c93[_0x888c('0x3e')]=_0x4ef38b;return _0x162c93;})[_0x888c('0x21')](respondWithFilteredResult(_0x29fa1e,_0x387e45))[_0x888c('0x3f')](handleError(_0x29fa1e,null));};exports[_0x888c('0x40')]=function(_0x43e066,_0x4a1ea2){var _0x265e9c={'raw':![],'where':{'id':_0x43e066[_0x888c('0x41')]['id']}},_0x7ff184={};_0x7ff184['model']=_[_0x888c('0x42')](db[_0x888c('0x27')][_0x888c('0x28')]);_0x7ff184[_0x888c('0x2d')]=_[_0x888c('0x42')](_0x43e066[_0x888c('0x2d')]);_0x7ff184[_0x888c('0x37')]=_[_0x888c('0x2e')](_0x7ff184['model'],_0x7ff184[_0x888c('0x2d')]);_0x265e9c[_0x888c('0x30')]=_[_0x888c('0x2e')](_0x7ff184[_0x888c('0x2c')],qs[_0x888c('0x2f')](_0x43e066[_0x888c('0x2d')][_0x888c('0x2f')]));_0x265e9c[_0x888c('0x30')]=_0x265e9c[_0x888c('0x30')][_0x888c('0x31')]?_0x265e9c[_0x888c('0x30')]:_0x7ff184[_0x888c('0x2c')];if(_0x43e066['query'][_0x888c('0x43')]){_0x265e9c[_0x888c('0x3c')]=[{'all':!![]}];}_0x265e9c=_[_0x888c('0x39')]({},_0x265e9c,_0x43e066[_0x888c('0x3b')]);return db[_0x888c('0x27')][_0x888c('0x44')](_0x265e9c)[_0x888c('0x21')](handleEntityNotFound(_0x4a1ea2,null))[_0x888c('0x21')](respondWithResult(_0x4a1ea2,null))[_0x888c('0x3f')](handleError(_0x4a1ea2,null));};exports[_0x888c('0x45')]=function(_0x2eeef0,_0x2c2950){return db['SalesforceConfiguration'][_0x888c('0x45')](_0x2eeef0[_0x888c('0x46')],{})['then'](respondWithResult(_0x2c2950,0xc9))['catch'](handleError(_0x2c2950,null));};exports[_0x888c('0x47')]=function(_0x2035e3,_0x53f5ea){if(_0x2035e3[_0x888c('0x46')]['id']){delete _0x2035e3[_0x888c('0x46')]['id'];}return db['SalesforceConfiguration'][_0x888c('0x44')]({'where':{'id':_0x2035e3['params']['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x53f5ea,null))[_0x888c('0x21')](saveUpdates(_0x2035e3[_0x888c('0x46')],null))[_0x888c('0x21')](respondWithResult(_0x53f5ea,null))['catch'](handleError(_0x53f5ea,null));};exports[_0x888c('0x48')]=function(_0x392c0b,_0x568558){return db[_0x888c('0x27')][_0x888c('0x44')]({'where':{'id':_0x392c0b[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x568558,null))[_0x888c('0x21')](removeEntity(_0x568558,null))[_0x888c('0x3f')](handleError(_0x568558,null));};exports[_0x888c('0x49')]=function(_0x352a3c,_0x27dbf4,_0x3454c5){var _0x1be8a6={};var _0xfbaade={};var _0x18d914;var _0x55f36f;return db[_0x888c('0x27')][_0x888c('0x4a')]({'where':{'id':_0x352a3c[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x27dbf4,null))[_0x888c('0x21')](function(_0x1e4c3f){if(_0x1e4c3f){_0x18d914=_0x1e4c3f;_0xfbaade[_0x888c('0x2c')]=_[_0x888c('0x42')](db[_0x888c('0x4b')][_0x888c('0x28')]);_0xfbaade[_0x888c('0x2d')]=_[_0x888c('0x42')](_0x352a3c[_0x888c('0x2d')]);_0xfbaade['filters']=_['intersection'](_0xfbaade[_0x888c('0x2c')],_0xfbaade[_0x888c('0x2d')]);_0x1be8a6[_0x888c('0x30')]=_[_0x888c('0x2e')](_0xfbaade['model'],qs[_0x888c('0x2f')](_0x352a3c['query'][_0x888c('0x2f')]));_0x1be8a6[_0x888c('0x30')]=_0x1be8a6[_0x888c('0x30')][_0x888c('0x31')]?_0x1be8a6[_0x888c('0x30')]:_0xfbaade['model'];_0x1be8a6['order']=qs[_0x888c('0x35')](_0x352a3c[_0x888c('0x2d')][_0x888c('0x35')]);_0x1be8a6[_0x888c('0x36')]=qs[_0x888c('0x37')](_[_0x888c('0x38')](_0x352a3c[_0x888c('0x2d')],_0xfbaade[_0x888c('0x37')]));if(_0x352a3c[_0x888c('0x2d')]['filter']){_0x1be8a6[_0x888c('0x36')]=_[_0x888c('0x39')](_0x1be8a6[_0x888c('0x36')],{'$or':_[_0x888c('0x26')](_0x1be8a6['attributes'],function(_0x3f264c){var _0x1d1ff5={};_0x1d1ff5[_0x3f264c]={'$like':'%'+_0x352a3c['query'][_0x888c('0x4c')]+'%'};return _0x1d1ff5;})});}_0x1be8a6=_['merge']({},_0x1be8a6,_0x352a3c[_0x888c('0x3b')]);return _0x18d914[_0x888c('0x49')](_0x1be8a6);}})['then'](function(_0x2b5a67){if(_0x2b5a67){_0x55f36f=_0x2b5a67[_0x888c('0x31')];if(!_0x352a3c['query'][_0x888c('0x32')]('nolimit')){_0x1be8a6['limit']=qs['limit'](_0x352a3c['query']['limit']);_0x1be8a6[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x352a3c[_0x888c('0x2d')][_0x888c('0x19')]);}return _0x18d914['getFields'](_0x1be8a6);}})['then'](function(_0x53c319){if(_0x53c319){return _0x53c319?{'count':_0x55f36f,'rows':_0x53c319}:null;}})['then'](respondWithResult(_0x27dbf4,null))[_0x888c('0x3f')](handleError(_0x27dbf4,null));};exports['getSubjects']=function(_0x13a999,_0x2b9dba,_0x4c74b1){var _0x357c1f={};var _0x130fb7={};var _0x232ce6;var _0x5252fc;return db[_0x888c('0x27')][_0x888c('0x4a')]({'where':{'id':_0x13a999[_0x888c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2b9dba,null))[_0x888c('0x21')](function(_0x1a613d){if(_0x1a613d){_0x232ce6=_0x1a613d;_0x130fb7[_0x888c('0x2c')]=_[_0x888c('0x42')](db[_0x888c('0x4b')][_0x888c('0x28')]);_0x130fb7[_0x888c('0x2d')]=_[_0x888c('0x42')](_0x13a999[_0x888c('0x2d')]);_0x130fb7[_0x888c('0x37')]=_[_0x888c('0x2e')](_0x130fb7['model'],_0x130fb7[_0x888c('0x2d')]);_0x357c1f[_0x888c('0x30')]=_[_0x888c('0x2e')](_0x130fb7[_0x888c('0x2c')],qs[_0x888c('0x2f')](_0x13a999[_0x888c('0x2d')][_0x888c('0x2f')]));_0x357c1f[_0x888c('0x30')]=_0x357c1f['attributes'][_0x888c('0x31')]?_0x357c1f[_0x888c('0x30')]:_0x130fb7['model'];_0x357c1f['order']=qs[_0x888c('0x35')](_0x13a999['query'][_0x888c('0x35')]);_0x357c1f[_0x888c('0x36')]=qs[_0x888c('0x37')](_[_0x888c('0x38')](_0x13a999[_0x888c('0x2d')],_0x130fb7[_0x888c('0x37')]));if(_0x13a999['query'][_0x888c('0x4c')]){_0x357c1f['where']=_[_0x888c('0x39')](_0x357c1f[_0x888c('0x36')],{'$or':_[_0x888c('0x26')](_0x357c1f[_0x888c('0x30')],function(_0x301aaf){var _0x5e07dc={};_0x5e07dc[_0x301aaf]={'$like':'%'+_0x13a999[_0x888c('0x2d')][_0x888c('0x4c')]+'%'};return _0x5e07dc;})});}_0x357c1f=_['merge']({},_0x357c1f,_0x13a999['options']);return _0x232ce6['getSubjects'](_0x357c1f);}})[_0x888c('0x21')](function(_0xb24808){if(_0xb24808){_0x5252fc=_0xb24808[_0x888c('0x31')];if(!_0x13a999[_0x888c('0x2d')]['hasOwnProperty']('nolimit')){_0x357c1f[_0x888c('0x1a')]=qs[_0x888c('0x1a')](_0x13a999[_0x888c('0x2d')][_0x888c('0x1a')]);_0x357c1f[_0x888c('0x19')]=qs['offset'](_0x13a999[_0x888c('0x2d')][_0x888c('0x19')]);}return _0x232ce6[_0x888c('0x4d')](_0x357c1f);}})[_0x888c('0x21')](function(_0x1f753f){if(_0x1f753f){return _0x1f753f?{'count':_0x5252fc,'rows':_0x1f753f}:null;}})['then'](respondWithResult(_0x2b9dba,null))[_0x888c('0x3f')](handleError(_0x2b9dba,null));};exports[_0x888c('0x4e')]=function(_0x1e2982,_0x415931,_0x19ff92){var _0x4c44e4={};var _0x4445b0={};var _0x3700f6;var _0x2d5c07;return db['SalesforceConfiguration'][_0x888c('0x4a')]({'where':{'id':_0x1e2982[_0x888c('0x41')]['id']}})[_0x888c('0x21')](handleEntityNotFound(_0x415931,null))[_0x888c('0x21')](function(_0x5f5233){if(_0x5f5233){_0x3700f6=_0x5f5233;_0x4445b0['model']=_[_0x888c('0x42')](db[_0x888c('0x4b')][_0x888c('0x28')]);_0x4445b0[_0x888c('0x2d')]=_[_0x888c('0x42')](_0x1e2982[_0x888c('0x2d')]);_0x4445b0['filters']=_[_0x888c('0x2e')](_0x4445b0[_0x888c('0x2c')],_0x4445b0[_0x888c('0x2d')]);_0x4c44e4[_0x888c('0x30')]=_[_0x888c('0x2e')](_0x4445b0[_0x888c('0x2c')],qs[_0x888c('0x2f')](_0x1e2982[_0x888c('0x2d')]['fields']));_0x4c44e4['attributes']=_0x4c44e4[_0x888c('0x30')][_0x888c('0x31')]?_0x4c44e4[_0x888c('0x30')]:_0x4445b0[_0x888c('0x2c')];_0x4c44e4[_0x888c('0x34')]=qs['sort'](_0x1e2982[_0x888c('0x2d')][_0x888c('0x35')]);_0x4c44e4['where']=qs['filters'](_[_0x888c('0x38')](_0x1e2982[_0x888c('0x2d')],_0x4445b0[_0x888c('0x37')]));if(_0x1e2982['query'][_0x888c('0x4c')]){_0x4c44e4['where']=_[_0x888c('0x39')](_0x4c44e4[_0x888c('0x36')],{'$or':_['map'](_0x4c44e4[_0x888c('0x30')],function(_0x29518b){var _0x19b603={};_0x19b603[_0x29518b]={'$like':'%'+_0x1e2982[_0x888c('0x2d')][_0x888c('0x4c')]+'%'};return _0x19b603;})});}_0x4c44e4=_[_0x888c('0x39')]({},_0x4c44e4,_0x1e2982['options']);return _0x3700f6[_0x888c('0x4e')](_0x4c44e4);}})['then'](function(_0x4468ad){if(_0x4468ad){_0x2d5c07=_0x4468ad[_0x888c('0x31')];if(!_0x1e2982['query']['hasOwnProperty']('nolimit')){_0x4c44e4[_0x888c('0x1a')]=qs['limit'](_0x1e2982['query'][_0x888c('0x1a')]);_0x4c44e4[_0x888c('0x19')]=qs[_0x888c('0x19')](_0x1e2982[_0x888c('0x2d')][_0x888c('0x19')]);}return _0x3700f6[_0x888c('0x4e')](_0x4c44e4);}})['then'](function(_0x4455d8){if(_0x4455d8){return _0x4455d8?{'count':_0x2d5c07,'rows':_0x4455d8}:null;}})[_0x888c('0x21')](respondWithResult(_0x415931,null))[_0x888c('0x3f')](handleError(_0x415931,null));}; \ No newline at end of file +var _0x685b=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','destroy','then','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0x685b,0x8d));var _0xb685=function(_0x1d06a5,_0x4fc577){_0x1d06a5=_0x1d06a5-0x0;var _0xbaab59=_0x685b[_0x1d06a5];return _0xbaab59;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb685('0x0'));var zipdir=require(_0xb685('0x1'));var jsonpatch=require(_0xb685('0x2'));var rp=require(_0xb685('0x3'));var moment=require(_0xb685('0x4'));var BPromise=require(_0xb685('0x5'));var Mustache=require(_0xb685('0x6'));var util=require(_0xb685('0x7'));var path=require(_0xb685('0x8'));var sox=require(_0xb685('0x9'));var csv=require(_0xb685('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb685('0xb'));var _=require(_0xb685('0xc'));var squel=require(_0xb685('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb685('0xa'));var querystring=require(_0xb685('0xe'));var Papa=require('papaparse');var Redis=require(_0xb685('0xf'));var authService=require(_0xb685('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb685('0x11'));var hardwareService=require(_0xb685('0x12'));var logger=require(_0xb685('0x13'))('api');var utils=require(_0xb685('0x14'));var config=require(_0xb685('0x15'));var licenseUtil=require(_0xb685('0x16'));var db=require(_0xb685('0x17'))['db'];function respondWithStatusCode(_0x161f7c,_0x1b4513){_0x1b4513=_0x1b4513||0xcc;return function(_0x26ec65){if(_0x26ec65){return _0x161f7c[_0xb685('0x18')](_0x1b4513);}return _0x161f7c[_0xb685('0x19')](_0x1b4513)[_0xb685('0x1a')]();};}function respondWithResult(_0x9986de,_0x86e6d9){_0x86e6d9=_0x86e6d9||0xc8;return function(_0x266e54){if(_0x266e54){return _0x9986de[_0xb685('0x19')](_0x86e6d9)['json'](_0x266e54);}};}function respondWithFilteredResult(_0x11feba,_0x407b0e){return function(_0x468ba4){if(_0x468ba4){var _0x37b4dd=typeof _0x407b0e[_0xb685('0x1b')]==='undefined'&&typeof _0x407b0e[_0xb685('0x1c')]===_0xb685('0x1d');var _0x2e7dc9=_0x468ba4[_0xb685('0x1e')];var _0x40ba1c=_0x37b4dd?0x0:_0x407b0e['offset'];var _0x4feb4=_0x37b4dd?_0x468ba4[_0xb685('0x1e')]:_0x407b0e[_0xb685('0x1b')]+_0x407b0e[_0xb685('0x1c')];var _0x10f63b;if(_0x4feb4>=_0x2e7dc9){_0x4feb4=_0x2e7dc9;_0x10f63b=0xc8;}else{_0x10f63b=0xce;}_0x11feba['status'](_0x10f63b);return _0x11feba[_0xb685('0x1f')](_0xb685('0x20'),_0x40ba1c+'-'+_0x4feb4+'/'+_0x2e7dc9)[_0xb685('0x21')](_0x468ba4);}return null;};}function patchUpdates(_0x36462d){return function(_0x4fe82d){try{jsonpatch['apply'](_0x4fe82d,_0x36462d,!![]);}catch(_0x34c0bd){return BPromise[_0xb685('0x22')](_0x34c0bd);}return _0x4fe82d[_0xb685('0x23')]();};}function saveUpdates(_0x15f776,_0x1c43bd){return function(_0x25a3ee){if(_0x25a3ee){return _0x25a3ee[_0xb685('0x24')](_0x15f776)['then'](function(_0x32e5f3){return _0x32e5f3;});}return null;};}function removeEntity(_0x418875,_0x363bfd){return function(_0x5c8807){if(_0x5c8807){return _0x5c8807[_0xb685('0x25')]()[_0xb685('0x26')](function(){_0x418875['status'](0xcc)[_0xb685('0x1a')]();});}};}function handleEntityNotFound(_0x59a622,_0x426393){return function(_0x967e27){if(!_0x967e27){_0x59a622[_0xb685('0x18')](0x194);}return _0x967e27;};}function handleError(_0x52d913,_0x2b3613){_0x2b3613=_0x2b3613||0x1f4;return function(_0x1e607b){logger['error'](_0x1e607b[_0xb685('0x27')]);if(_0x1e607b['name']){delete _0x1e607b[_0xb685('0x28')];}_0x52d913['status'](_0x2b3613)['send'](_0x1e607b);};}exports[_0xb685('0x29')]=function(_0x12ab23,_0x47321c){var _0x548888={},_0x3b986c={},_0x2c3958={'count':0x0,'rows':[]};var _0xe936c3=_[_0xb685('0x2a')](db[_0xb685('0x2b')][_0xb685('0x2c')],function(_0x40d418){return{'name':_0x40d418[_0xb685('0x2d')],'type':_0x40d418[_0xb685('0x2e')][_0xb685('0x2f')]};});_0x3b986c[_0xb685('0x30')]=_[_0xb685('0x2a')](_0xe936c3,'name');_0x3b986c[_0xb685('0x31')]=_[_0xb685('0x32')](_0x12ab23[_0xb685('0x31')]);_0x3b986c[_0xb685('0x33')]=_[_0xb685('0x34')](_0x3b986c['model'],_0x3b986c[_0xb685('0x31')]);_0x548888[_0xb685('0x35')]=_[_0xb685('0x34')](_0x3b986c['model'],qs[_0xb685('0x36')](_0x12ab23[_0xb685('0x31')][_0xb685('0x36')]));_0x548888['attributes']=_0x548888['attributes']['length']?_0x548888[_0xb685('0x35')]:_0x3b986c[_0xb685('0x30')];if(!_0x12ab23[_0xb685('0x31')][_0xb685('0x37')](_0xb685('0x38'))){_0x548888[_0xb685('0x1c')]=qs[_0xb685('0x1c')](_0x12ab23[_0xb685('0x31')][_0xb685('0x1c')]);_0x548888[_0xb685('0x1b')]=qs[_0xb685('0x1b')](_0x12ab23[_0xb685('0x31')][_0xb685('0x1b')]);}_0x548888[_0xb685('0x39')]=qs[_0xb685('0x3a')](_0x12ab23[_0xb685('0x31')][_0xb685('0x3a')]);_0x548888[_0xb685('0x3b')]=qs[_0xb685('0x33')](_[_0xb685('0x3c')](_0x12ab23[_0xb685('0x31')],_0x3b986c['filters']),_0xe936c3);if(_0x12ab23[_0xb685('0x31')][_0xb685('0x3d')]){_0x548888[_0xb685('0x3b')]=_[_0xb685('0x3e')](_0x548888[_0xb685('0x3b')],{'$or':_[_0xb685('0x2a')](_0xe936c3,function(_0x5bdd00){if(_0x5bdd00[_0xb685('0x2e')]!=='VIRTUAL'){var _0x3ff29f={};_0x3ff29f[_0x5bdd00[_0xb685('0x28')]]={'$like':'%'+_0x12ab23[_0xb685('0x31')][_0xb685('0x3d')]+'%'};return _0x3ff29f;}})});}_0x548888=_[_0xb685('0x3e')]({},_0x548888,_0x12ab23[_0xb685('0x3f')]);var _0x5cf4ed={'where':_0x548888[_0xb685('0x3b')]};return db[_0xb685('0x2b')][_0xb685('0x1e')](_0x5cf4ed)[_0xb685('0x26')](function(_0x71c432){_0x2c3958[_0xb685('0x1e')]=_0x71c432;if(_0x12ab23['query'][_0xb685('0x40')]){_0x548888[_0xb685('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xb685('0x42')](_0x548888);})[_0xb685('0x26')](function(_0x205886){_0x2c3958[_0xb685('0x43')]=_0x205886;return _0x2c3958;})[_0xb685('0x26')](respondWithFilteredResult(_0x47321c,_0x548888))[_0xb685('0x44')](handleError(_0x47321c,null));};exports[_0xb685('0x45')]=function(_0x232f96,_0x433c58){var _0x2affce={'raw':![],'where':{'id':_0x232f96[_0xb685('0x46')]['id']}},_0x51aa33={};_0x51aa33[_0xb685('0x30')]=_[_0xb685('0x32')](db[_0xb685('0x2b')]['rawAttributes']);_0x51aa33['query']=_['keys'](_0x232f96[_0xb685('0x31')]);_0x51aa33[_0xb685('0x33')]=_[_0xb685('0x34')](_0x51aa33[_0xb685('0x30')],_0x51aa33[_0xb685('0x31')]);_0x2affce['attributes']=_[_0xb685('0x34')](_0x51aa33['model'],qs[_0xb685('0x36')](_0x232f96[_0xb685('0x31')][_0xb685('0x36')]));_0x2affce[_0xb685('0x35')]=_0x2affce[_0xb685('0x35')][_0xb685('0x47')]?_0x2affce['attributes']:_0x51aa33['model'];if(_0x232f96[_0xb685('0x31')][_0xb685('0x40')]){_0x2affce['include']=[{'all':!![]}];}_0x2affce=_[_0xb685('0x3e')]({},_0x2affce,_0x232f96['options']);return db[_0xb685('0x2b')][_0xb685('0x48')](_0x2affce)['then'](handleEntityNotFound(_0x433c58,null))['then'](respondWithResult(_0x433c58,null))['catch'](handleError(_0x433c58,null));};exports['create']=function(_0x4f758f,_0x43e741){return db[_0xb685('0x2b')][_0xb685('0x49')](_0x4f758f[_0xb685('0x4a')],{})[_0xb685('0x26')](respondWithResult(_0x43e741,0xc9))['catch'](handleError(_0x43e741,null));};exports[_0xb685('0x24')]=function(_0x110252,_0x109b4d){if(_0x110252[_0xb685('0x4a')]['id']){delete _0x110252[_0xb685('0x4a')]['id'];}return db[_0xb685('0x2b')][_0xb685('0x48')]({'where':{'id':_0x110252[_0xb685('0x46')]['id']}})[_0xb685('0x26')](handleEntityNotFound(_0x109b4d,null))['then'](saveUpdates(_0x110252[_0xb685('0x4a')],null))[_0xb685('0x26')](respondWithResult(_0x109b4d,null))[_0xb685('0x44')](handleError(_0x109b4d,null));};exports[_0xb685('0x25')]=function(_0x10d652,_0x4f180d){return db[_0xb685('0x2b')][_0xb685('0x48')]({'where':{'id':_0x10d652[_0xb685('0x46')]['id']}})[_0xb685('0x26')](handleEntityNotFound(_0x4f180d,null))['then'](removeEntity(_0x4f180d,null))[_0xb685('0x44')](handleError(_0x4f180d,null));};exports[_0xb685('0x4b')]=function(_0x14aa5e,_0x591318,_0xd25290){var _0x56556e={};var _0x184e0d={};var _0x495ecd;var _0xfe9edd;return db[_0xb685('0x2b')][_0xb685('0x4c')]({'where':{'id':_0x14aa5e[_0xb685('0x46')]['id']}})['then'](handleEntityNotFound(_0x591318,null))[_0xb685('0x26')](function(_0x43d634){if(_0x43d634){_0x495ecd=_0x43d634;_0x184e0d[_0xb685('0x30')]=_[_0xb685('0x32')](db[_0xb685('0x4d')][_0xb685('0x2c')]);_0x184e0d[_0xb685('0x31')]=_['keys'](_0x14aa5e['query']);_0x184e0d['filters']=_['intersection'](_0x184e0d[_0xb685('0x30')],_0x184e0d[_0xb685('0x31')]);_0x56556e[_0xb685('0x35')]=_[_0xb685('0x34')](_0x184e0d[_0xb685('0x30')],qs[_0xb685('0x36')](_0x14aa5e[_0xb685('0x31')]['fields']));_0x56556e[_0xb685('0x35')]=_0x56556e[_0xb685('0x35')][_0xb685('0x47')]?_0x56556e['attributes']:_0x184e0d[_0xb685('0x30')];_0x56556e[_0xb685('0x39')]=qs[_0xb685('0x3a')](_0x14aa5e[_0xb685('0x31')][_0xb685('0x3a')]);_0x56556e[_0xb685('0x3b')]=qs[_0xb685('0x33')](_[_0xb685('0x3c')](_0x14aa5e[_0xb685('0x31')],_0x184e0d['filters']));if(_0x14aa5e[_0xb685('0x31')]['filter']){_0x56556e[_0xb685('0x3b')]=_[_0xb685('0x3e')](_0x56556e[_0xb685('0x3b')],{'$or':_['map'](_0x56556e[_0xb685('0x35')],function(_0x2a4df7){var _0x46659d={};_0x46659d[_0x2a4df7]={'$like':'%'+_0x14aa5e[_0xb685('0x31')][_0xb685('0x3d')]+'%'};return _0x46659d;})});}_0x56556e=_['merge']({},_0x56556e,_0x14aa5e['options']);return _0x495ecd[_0xb685('0x4b')](_0x56556e);}})['then'](function(_0x2cc80e){if(_0x2cc80e){_0xfe9edd=_0x2cc80e[_0xb685('0x47')];if(!_0x14aa5e[_0xb685('0x31')][_0xb685('0x37')]('nolimit')){_0x56556e[_0xb685('0x1c')]=qs[_0xb685('0x1c')](_0x14aa5e[_0xb685('0x31')][_0xb685('0x1c')]);_0x56556e[_0xb685('0x1b')]=qs[_0xb685('0x1b')](_0x14aa5e['query'][_0xb685('0x1b')]);}return _0x495ecd[_0xb685('0x4b')](_0x56556e);}})['then'](function(_0x5d3b60){if(_0x5d3b60){return _0x5d3b60?{'count':_0xfe9edd,'rows':_0x5d3b60}:null;}})[_0xb685('0x26')](respondWithResult(_0x591318,null))['catch'](handleError(_0x591318,null));};exports[_0xb685('0x4e')]=function(_0x178b0d,_0x36fe3e,_0x3435de){var _0x42e8bf={};var _0x470747={};var _0x211518;var _0x119101;return db[_0xb685('0x2b')][_0xb685('0x4c')]({'where':{'id':_0x178b0d['params']['id']}})[_0xb685('0x26')](handleEntityNotFound(_0x36fe3e,null))[_0xb685('0x26')](function(_0x539968){if(_0x539968){_0x211518=_0x539968;_0x470747[_0xb685('0x30')]=_[_0xb685('0x32')](db[_0xb685('0x4d')]['rawAttributes']);_0x470747[_0xb685('0x31')]=_[_0xb685('0x32')](_0x178b0d['query']);_0x470747['filters']=_['intersection'](_0x470747[_0xb685('0x30')],_0x470747[_0xb685('0x31')]);_0x42e8bf[_0xb685('0x35')]=_[_0xb685('0x34')](_0x470747[_0xb685('0x30')],qs[_0xb685('0x36')](_0x178b0d['query'][_0xb685('0x36')]));_0x42e8bf['attributes']=_0x42e8bf[_0xb685('0x35')][_0xb685('0x47')]?_0x42e8bf[_0xb685('0x35')]:_0x470747[_0xb685('0x30')];_0x42e8bf['order']=qs[_0xb685('0x3a')](_0x178b0d[_0xb685('0x31')][_0xb685('0x3a')]);_0x42e8bf[_0xb685('0x3b')]=qs[_0xb685('0x33')](_[_0xb685('0x3c')](_0x178b0d['query'],_0x470747['filters']));if(_0x178b0d[_0xb685('0x31')][_0xb685('0x3d')]){_0x42e8bf['where']=_[_0xb685('0x3e')](_0x42e8bf[_0xb685('0x3b')],{'$or':_['map'](_0x42e8bf[_0xb685('0x35')],function(_0x2c7b70){var _0x2aa69a={};_0x2aa69a[_0x2c7b70]={'$like':'%'+_0x178b0d[_0xb685('0x31')][_0xb685('0x3d')]+'%'};return _0x2aa69a;})});}_0x42e8bf=_['merge']({},_0x42e8bf,_0x178b0d[_0xb685('0x3f')]);return _0x211518[_0xb685('0x4e')](_0x42e8bf);}})[_0xb685('0x26')](function(_0x2a2a2f){if(_0x2a2a2f){_0x119101=_0x2a2a2f[_0xb685('0x47')];if(!_0x178b0d['query'][_0xb685('0x37')](_0xb685('0x38'))){_0x42e8bf[_0xb685('0x1c')]=qs[_0xb685('0x1c')](_0x178b0d[_0xb685('0x31')][_0xb685('0x1c')]);_0x42e8bf[_0xb685('0x1b')]=qs[_0xb685('0x1b')](_0x178b0d[_0xb685('0x31')][_0xb685('0x1b')]);}return _0x211518[_0xb685('0x4e')](_0x42e8bf);}})[_0xb685('0x26')](function(_0x399006){if(_0x399006){return _0x399006?{'count':_0x119101,'rows':_0x399006}:null;}})[_0xb685('0x26')](respondWithResult(_0x36fe3e,null))[_0xb685('0x44')](handleError(_0x36fe3e,null));};exports['getDescriptions']=function(_0x4de404,_0x58f128,_0x2fbfdf){var _0x2f4c0a={};var _0x2c751c={};var _0x2e33f4;var _0x553ed5;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x4de404['params']['id']}})[_0xb685('0x26')](handleEntityNotFound(_0x58f128,null))['then'](function(_0x2d81e9){if(_0x2d81e9){_0x2e33f4=_0x2d81e9;_0x2c751c['model']=_['keys'](db['SalesforceField'][_0xb685('0x2c')]);_0x2c751c[_0xb685('0x31')]=_[_0xb685('0x32')](_0x4de404[_0xb685('0x31')]);_0x2c751c[_0xb685('0x33')]=_['intersection'](_0x2c751c[_0xb685('0x30')],_0x2c751c[_0xb685('0x31')]);_0x2f4c0a[_0xb685('0x35')]=_[_0xb685('0x34')](_0x2c751c[_0xb685('0x30')],qs[_0xb685('0x36')](_0x4de404['query'][_0xb685('0x36')]));_0x2f4c0a['attributes']=_0x2f4c0a[_0xb685('0x35')][_0xb685('0x47')]?_0x2f4c0a[_0xb685('0x35')]:_0x2c751c[_0xb685('0x30')];_0x2f4c0a[_0xb685('0x39')]=qs['sort'](_0x4de404['query']['sort']);_0x2f4c0a[_0xb685('0x3b')]=qs[_0xb685('0x33')](_[_0xb685('0x3c')](_0x4de404[_0xb685('0x31')],_0x2c751c[_0xb685('0x33')]));if(_0x4de404[_0xb685('0x31')]['filter']){_0x2f4c0a[_0xb685('0x3b')]=_['merge'](_0x2f4c0a['where'],{'$or':_[_0xb685('0x2a')](_0x2f4c0a['attributes'],function(_0x80d592){var _0x5cede7={};_0x5cede7[_0x80d592]={'$like':'%'+_0x4de404[_0xb685('0x31')][_0xb685('0x3d')]+'%'};return _0x5cede7;})});}_0x2f4c0a=_[_0xb685('0x3e')]({},_0x2f4c0a,_0x4de404[_0xb685('0x3f')]);return _0x2e33f4['getDescriptions'](_0x2f4c0a);}})[_0xb685('0x26')](function(_0x24d47a){if(_0x24d47a){_0x553ed5=_0x24d47a['length'];if(!_0x4de404[_0xb685('0x31')][_0xb685('0x37')]('nolimit')){_0x2f4c0a['limit']=qs[_0xb685('0x1c')](_0x4de404[_0xb685('0x31')]['limit']);_0x2f4c0a[_0xb685('0x1b')]=qs[_0xb685('0x1b')](_0x4de404['query'][_0xb685('0x1b')]);}return _0x2e33f4[_0xb685('0x4f')](_0x2f4c0a);}})[_0xb685('0x26')](function(_0x28eae9){if(_0x28eae9){return _0x28eae9?{'count':_0x553ed5,'rows':_0x28eae9}:null;}})[_0xb685('0x26')](respondWithResult(_0x58f128,null))[_0xb685('0x44')](handleError(_0x58f128,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fef887c..20fd2b4 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 _0x68a2=['int_salesforce_configurations','util','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x1a455c,_0x3e182c){var _0x5d5a35=function(_0x552acd){while(--_0x552acd){_0x1a455c['push'](_0x1a455c['shift']());}};_0x5d5a35(++_0x3e182c);}(_0x68a2,0x85));var _0x268a=function(_0x4e71c4,_0xc4d62d){_0x4e71c4=_0x4e71c4-0x0;var _0x4fb92b=_0x68a2[_0x4e71c4];return _0x4fb92b;};'use strict';var _=require('lodash');var util=require(_0x268a('0x0'));var logger=require('../../config/logger')(_0x268a('0x1'));var moment=require(_0x268a('0x2'));var BPromise=require('bluebird');var rp=require(_0x268a('0x3'));var fs=require('fs');var path=require(_0x268a('0x4'));var rimraf=require(_0x268a('0x5'));var config=require(_0x268a('0x6'));var attributes=require(_0x268a('0x7'));module[_0x268a('0x8')]=function(_0x3041df,_0x516fe1){return _0x3041df[_0x268a('0x9')](_0x268a('0xa'),attributes,{'tableName':_0x268a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0213=['../../config/environment','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x49cb92,_0x3c31a6){var _0x16ee5a=function(_0x48e0c6){while(--_0x48e0c6){_0x49cb92['push'](_0x49cb92['shift']());}};_0x16ee5a(++_0x3c31a6);}(_0x0213,0x1a8));var _0x3021=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x0213[_0x16a637];return _0x25126d;};'use strict';var _=require(_0x3021('0x0'));var util=require(_0x3021('0x1'));var logger=require(_0x3021('0x2'))(_0x3021('0x3'));var moment=require('moment');var BPromise=require(_0x3021('0x4'));var rp=require(_0x3021('0x5'));var fs=require('fs');var path=require(_0x3021('0x6'));var rimraf=require(_0x3021('0x7'));var config=require(_0x3021('0x8'));var attributes=require(_0x3021('0x9'));module['exports']=function(_0x3efbe4,_0x56e1c5){return _0x3efbe4[_0x3021('0xa')]('SalesforceConfiguration',attributes,{'tableName':_0x3021('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 fe4f37b..d07064f 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 _0xae8a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','stringify','error','message','result','moment','bluebird','randomstring'];(function(_0x4cf834,_0x77a576){var _0x34a470=function(_0x2ecd2e){while(--_0x2ecd2e){_0x4cf834['push'](_0x4cf834['shift']());}};_0x34a470(++_0x77a576);}(_0xae8a,0x6f));var _0xaae8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xae8a[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xaae8('0x0'));var BPromise=require(_0xaae8('0x1'));var rs=require(_0xaae8('0x2'));var fs=require('fs');var Redis=require(_0xaae8('0x3'));var db=require(_0xaae8('0x4'))['db'];var utils=require(_0xaae8('0x5'));var logger=require(_0xaae8('0x6'))(_0xaae8('0x7'));var config=require('../../config/environment');var jayson=require(_0xaae8('0x8'));var client=jayson[_0xaae8('0x9')][_0xaae8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50a002,_0x3d94fc,_0x553868){return new BPromise(function(_0x5dc469,_0x211406){return client['request'](_0x50a002,_0x553868)[_0xaae8('0xb')](function(_0x275f0f){logger[_0xaae8('0xc')](_0xaae8('0xd'),_0x3d94fc,'request\x20sent');logger[_0xaae8('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3d94fc,'request\x20sent',JSON[_0xaae8('0xf')](_0x275f0f));if(_0x275f0f['error']){if(_0x275f0f[_0xaae8('0x10')]['code']===0x1f4){logger['error'](_0xaae8('0xd'),_0x3d94fc,_0x275f0f['error'][_0xaae8('0x11')]);return _0x211406(_0x275f0f['error'][_0xaae8('0x11')]);}logger[_0xaae8('0x10')](_0xaae8('0xd'),_0x3d94fc,_0x275f0f[_0xaae8('0x10')][_0xaae8('0x11')]);return _0x5dc469(_0x275f0f[_0xaae8('0x10')]['message']);}else{logger[_0xaae8('0xc')](_0xaae8('0xd'),_0x3d94fc,'request\x20sent');_0x5dc469(_0x275f0f[_0xaae8('0x12')]['message']);}})['catch'](function(_0x18c5c8){logger['error'](_0xaae8('0xd'),_0x3d94fc,_0x18c5c8);_0x211406(_0x18c5c8);});});} \ No newline at end of file +var _0x6507=['info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x6507,0x86));var _0x7650=function(_0x3cd26b,_0x5bf64d){_0x3cd26b=_0x3cd26b-0x0;var _0x7b3067=_0x6507[_0x3cd26b];return _0x7b3067;};'use strict';var _=require(_0x7650('0x0'));var util=require(_0x7650('0x1'));var moment=require('moment');var BPromise=require(_0x7650('0x2'));var rs=require(_0x7650('0x3'));var fs=require('fs');var Redis=require(_0x7650('0x4'));var db=require(_0x7650('0x5'))['db'];var utils=require(_0x7650('0x6'));var logger=require(_0x7650('0x7'))(_0x7650('0x8'));var config=require(_0x7650('0x9'));var jayson=require(_0x7650('0xa'));var client=jayson[_0x7650('0xb')][_0x7650('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c4a0c,_0x31adc,_0x498707){return new BPromise(function(_0x2b9de2,_0x521ade){return client[_0x7650('0xd')](_0x2c4a0c,_0x498707)[_0x7650('0xe')](function(_0x11adc0){logger['info'](_0x7650('0xf'),_0x31adc,_0x7650('0x10'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x31adc,_0x7650('0x10'),JSON['stringify'](_0x11adc0));if(_0x11adc0[_0x7650('0x11')]){if(_0x11adc0[_0x7650('0x11')][_0x7650('0x12')]===0x1f4){logger[_0x7650('0x11')](_0x7650('0xf'),_0x31adc,_0x11adc0[_0x7650('0x11')][_0x7650('0x13')]);return _0x521ade(_0x11adc0[_0x7650('0x11')]['message']);}logger[_0x7650('0x11')](_0x7650('0xf'),_0x31adc,_0x11adc0['error']['message']);return _0x2b9de2(_0x11adc0['error'][_0x7650('0x13')]);}else{logger[_0x7650('0x14')](_0x7650('0xf'),_0x31adc,_0x7650('0x10'));_0x2b9de2(_0x11adc0[_0x7650('0x15')][_0x7650('0x13')]);}})['catch'](function(_0x4dbe43){logger[_0x7650('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x31adc,_0x4dbe43);_0x521ade(_0x4dbe43);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 33fbc54..e3c7065 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 _0x2d3e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x5e5652,_0x30c64d){var _0x37a637=function(_0x64a0f6){while(--_0x64a0f6){_0x5e5652['push'](_0x5e5652['shift']());}};_0x37a637(++_0x30c64d);}(_0x2d3e,0x161));var _0xe2d3=function(_0x45dd9e,_0xad4da0){_0x45dd9e=_0x45dd9e-0x0;var _0x35a357=_0x2d3e[_0x45dd9e];return _0x35a357;};'use strict';var multer=require(_0xe2d3('0x0'));var util=require(_0xe2d3('0x1'));var path=require('path');var timeout=require(_0xe2d3('0x2'));var express=require(_0xe2d3('0x3'));var router=express[_0xe2d3('0x4')]();var fs_extra=require(_0xe2d3('0x5'));var auth=require(_0xe2d3('0x6'));var interaction=require(_0xe2d3('0x7'));var config=require(_0xe2d3('0x8'));var controller=require(_0xe2d3('0x9'));router[_0xe2d3('0xa')]('/',auth[_0xe2d3('0xb')](),controller[_0xe2d3('0xc')]);router[_0xe2d3('0xa')](_0xe2d3('0xd'),auth[_0xe2d3('0xb')](),controller[_0xe2d3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe2d3('0xf')]);router[_0xe2d3('0x10')](_0xe2d3('0xd'),auth[_0xe2d3('0xb')](),controller[_0xe2d3('0x11')]);router[_0xe2d3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe2d3('0x13')]);module[_0xe2d3('0x14')]=router; \ No newline at end of file +var _0x8a1e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8a1e,0x178));var _0xe8a1=function(_0x58b460,_0x11305e){_0x58b460=_0x58b460-0x0;var _0x758c77=_0x8a1e[_0x58b460];return _0x758c77;};'use strict';var multer=require(_0xe8a1('0x0'));var util=require(_0xe8a1('0x1'));var path=require(_0xe8a1('0x2'));var timeout=require('connect-timeout');var express=require(_0xe8a1('0x3'));var router=express[_0xe8a1('0x4')]();var fs_extra=require(_0xe8a1('0x5'));var auth=require(_0xe8a1('0x6'));var interaction=require(_0xe8a1('0x7'));var config=require(_0xe8a1('0x8'));var controller=require(_0xe8a1('0x9'));router['get']('/',auth[_0xe8a1('0xa')](),controller[_0xe8a1('0xb')]);router[_0xe8a1('0xc')](_0xe8a1('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe8a1('0xa')](),controller[_0xe8a1('0xe')]);router[_0xe8a1('0xf')](_0xe8a1('0xd'),auth[_0xe8a1('0xa')](),controller[_0xe8a1('0x10')]);router[_0xe8a1('0x11')](_0xe8a1('0xd'),auth[_0xe8a1('0xa')](),controller[_0xe8a1('0x12')]);module[_0xe8a1('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 91de954..58fe12d 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 _0xfa63=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xfa63,0x65));var _0x3fa6=function(_0x11a8dd,_0x493433){_0x11a8dd=_0x11a8dd-0x0;var _0x3be03f=_0xfa63[_0x11a8dd];return _0x3be03f;};'use strict';var Sequelize=require(_0x3fa6('0x0'));module[_0x3fa6('0x1')]={'type':{'type':Sequelize[_0x3fa6('0x2')](_0x3fa6('0x3'),_0x3fa6('0x4'),_0x3fa6('0x5'),_0x3fa6('0x6'),_0x3fa6('0x7')),'defaultValue':_0x3fa6('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3fa6('0x8')]},'keyType':{'type':Sequelize[_0x3fa6('0x2')](_0x3fa6('0x3'),_0x3fa6('0x4'),_0x3fa6('0x5'))},'keyContent':{'type':Sequelize[_0x3fa6('0x8')]},'idField':{'type':Sequelize[_0x3fa6('0x8')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xab7d=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x26a901,_0x29dd83){var _0x305c2a=function(_0x54c8f9){while(--_0x54c8f9){_0x26a901['push'](_0x26a901['shift']());}};_0x305c2a(++_0x29dd83);}(_0xab7d,0x18e));var _0xdab7=function(_0x5b2e29,_0x30a9ca){_0x5b2e29=_0x5b2e29-0x0;var _0x53c842=_0xab7d[_0x5b2e29];return _0x53c842;};'use strict';var Sequelize=require(_0xdab7('0x0'));module[_0xdab7('0x1')]={'type':{'type':Sequelize[_0xdab7('0x2')](_0xdab7('0x3'),_0xdab7('0x4'),_0xdab7('0x5'),_0xdab7('0x6'),_0xdab7('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdab7('0x8')]},'key':{'type':Sequelize[_0xdab7('0x8')]},'keyType':{'type':Sequelize[_0xdab7('0x2')](_0xdab7('0x3'),_0xdab7('0x4'),_0xdab7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdab7('0x8')]},'variableName':{'type':Sequelize[_0xdab7('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 245e9c2..71ff331 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 _0xfa80=['include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','destroy','name','send','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','SalesforceField','includeAll'];(function(_0x153051,_0x1f6cd4){var _0x283297=function(_0x3f9390){while(--_0x3f9390){_0x153051['push'](_0x153051['shift']());}};_0x283297(++_0x1f6cd4);}(_0xfa80,0xdb));var _0x0fa8=function(_0x51d65b,_0x1d0c18){_0x51d65b=_0x51d65b-0x0;var _0x33a059=_0xfa80[_0x51d65b];return _0x33a059;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fa8('0x0'));var zipdir=require(_0x0fa8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0fa8('0x2'));var moment=require(_0x0fa8('0x3'));var BPromise=require(_0x0fa8('0x4'));var Mustache=require(_0x0fa8('0x5'));var util=require(_0x0fa8('0x6'));var path=require(_0x0fa8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0fa8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fa8('0x9'));var squel=require(_0x0fa8('0xa'));var crypto=require(_0x0fa8('0xb'));var jsforce=require(_0x0fa8('0xc'));var deskjs=require(_0x0fa8('0xd'));var toCsv=require(_0x0fa8('0xe'));var querystring=require(_0x0fa8('0xf'));var Papa=require('papaparse');var Redis=require(_0x0fa8('0x10'));var authService=require(_0x0fa8('0x11'));var qs=require(_0x0fa8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fa8('0x13'));var logger=require(_0x0fa8('0x14'))(_0x0fa8('0x15'));var utils=require(_0x0fa8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d67cb,_0x457773){_0x457773=_0x457773||0xcc;return function(_0x13b809){if(_0x13b809){return _0x5d67cb[_0x0fa8('0x17')](_0x457773);}return _0x5d67cb[_0x0fa8('0x18')](_0x457773)[_0x0fa8('0x19')]();};}function respondWithResult(_0x5df39f,_0x1e1260){_0x1e1260=_0x1e1260||0xc8;return function(_0x3486b9){if(_0x3486b9){return _0x5df39f['status'](_0x1e1260)['json'](_0x3486b9);}};}function respondWithFilteredResult(_0x4c0e4e,_0x186aa8){return function(_0x295b4f){if(_0x295b4f){var _0x4a3bfa=typeof _0x186aa8[_0x0fa8('0x1a')]==='undefined'&&typeof _0x186aa8[_0x0fa8('0x1b')]===_0x0fa8('0x1c');var _0x2e5974=_0x295b4f[_0x0fa8('0x1d')];var _0x43b9ac=_0x4a3bfa?0x0:_0x186aa8[_0x0fa8('0x1a')];var _0x583bb9=_0x4a3bfa?_0x295b4f['count']:_0x186aa8['offset']+_0x186aa8[_0x0fa8('0x1b')];var _0x2dcf07;if(_0x583bb9>=_0x2e5974){_0x583bb9=_0x2e5974;_0x2dcf07=0xc8;}else{_0x2dcf07=0xce;}_0x4c0e4e[_0x0fa8('0x18')](_0x2dcf07);return _0x4c0e4e['set'](_0x0fa8('0x1e'),_0x43b9ac+'-'+_0x583bb9+'/'+_0x2e5974)[_0x0fa8('0x1f')](_0x295b4f);}return null;};}function patchUpdates(_0x403819){return function(_0x3670dc){try{jsonpatch[_0x0fa8('0x20')](_0x3670dc,_0x403819,!![]);}catch(_0xf10cd1){return BPromise['reject'](_0xf10cd1);}return _0x3670dc[_0x0fa8('0x21')]();};}function saveUpdates(_0x4692be,_0x2edd39){return function(_0x32932b){if(_0x32932b){return _0x32932b[_0x0fa8('0x22')](_0x4692be)[_0x0fa8('0x23')](function(_0x4b0287){return _0x4b0287;});}return null;};}function removeEntity(_0x480eaa,_0x5a61c7){return function(_0x8b3741){if(_0x8b3741){return _0x8b3741[_0x0fa8('0x24')]()['then'](function(){_0x480eaa[_0x0fa8('0x18')](0xcc)[_0x0fa8('0x19')]();});}};}function handleEntityNotFound(_0x1add33,_0x162836){return function(_0x123a8b){if(!_0x123a8b){_0x1add33[_0x0fa8('0x17')](0x194);}return _0x123a8b;};}function handleError(_0x342349,_0x2e517a){_0x2e517a=_0x2e517a||0x1f4;return function(_0xbb0cd0){logger['error'](_0xbb0cd0['stack']);if(_0xbb0cd0[_0x0fa8('0x25')]){delete _0xbb0cd0[_0x0fa8('0x25')];}_0x342349[_0x0fa8('0x18')](_0x2e517a)[_0x0fa8('0x26')](_0xbb0cd0);};}exports['index']=function(_0xb65014,_0x3a0e67){var _0x1f6986={},_0x196c7a={},_0x38c563={'count':0x0,'rows':[]};var _0x232708=_[_0x0fa8('0x27')](db['SalesforceField'][_0x0fa8('0x28')],function(_0x582a3a){return{'name':_0x582a3a[_0x0fa8('0x29')],'type':_0x582a3a['type'][_0x0fa8('0x2a')]};});_0x196c7a[_0x0fa8('0x2b')]=_[_0x0fa8('0x27')](_0x232708,'name');_0x196c7a[_0x0fa8('0x2c')]=_['keys'](_0xb65014[_0x0fa8('0x2c')]);_0x196c7a['filters']=_[_0x0fa8('0x2d')](_0x196c7a[_0x0fa8('0x2b')],_0x196c7a[_0x0fa8('0x2c')]);_0x1f6986['attributes']=_[_0x0fa8('0x2d')](_0x196c7a['model'],qs[_0x0fa8('0x2e')](_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x2e')]));_0x1f6986[_0x0fa8('0x2f')]=_0x1f6986[_0x0fa8('0x2f')][_0x0fa8('0x30')]?_0x1f6986[_0x0fa8('0x2f')]:_0x196c7a[_0x0fa8('0x2b')];if(!_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x31')](_0x0fa8('0x32'))){_0x1f6986['limit']=qs['limit'](_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x1b')]);_0x1f6986[_0x0fa8('0x1a')]=qs[_0x0fa8('0x1a')](_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x1a')]);}_0x1f6986[_0x0fa8('0x33')]=qs['sort'](_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x34')]);_0x1f6986[_0x0fa8('0x35')]=qs[_0x0fa8('0x36')](_[_0x0fa8('0x37')](_0xb65014[_0x0fa8('0x2c')],_0x196c7a['filters']),_0x232708);if(_0xb65014['query'][_0x0fa8('0x38')]){_0x1f6986['where']=_['merge'](_0x1f6986[_0x0fa8('0x35')],{'$or':_[_0x0fa8('0x27')](_0x232708,function(_0x1fee8b){if(_0x1fee8b['type']!=='VIRTUAL'){var _0x180308={};_0x180308[_0x1fee8b['name']]={'$like':'%'+_0xb65014['query'][_0x0fa8('0x38')]+'%'};return _0x180308;}})});}_0x1f6986=_[_0x0fa8('0x39')]({},_0x1f6986,_0xb65014[_0x0fa8('0x3a')]);var _0x3c3516={'where':_0x1f6986[_0x0fa8('0x35')]};return db[_0x0fa8('0x3b')][_0x0fa8('0x1d')](_0x3c3516)[_0x0fa8('0x23')](function(_0x3bf66f){_0x38c563[_0x0fa8('0x1d')]=_0x3bf66f;if(_0xb65014[_0x0fa8('0x2c')][_0x0fa8('0x3c')]){_0x1f6986[_0x0fa8('0x3d')]=[{'all':!![]}];}return db[_0x0fa8('0x3b')][_0x0fa8('0x3e')](_0x1f6986);})[_0x0fa8('0x23')](function(_0x72abf){_0x38c563[_0x0fa8('0x3f')]=_0x72abf;return _0x38c563;})['then'](respondWithFilteredResult(_0x3a0e67,_0x1f6986))[_0x0fa8('0x40')](handleError(_0x3a0e67,null));};exports['show']=function(_0x33788e,_0x66913f){var _0x54bf1c={'raw':!![],'where':{'id':_0x33788e[_0x0fa8('0x41')]['id']}},_0x3776ca={};_0x3776ca[_0x0fa8('0x2b')]=_['keys'](db[_0x0fa8('0x3b')][_0x0fa8('0x28')]);_0x3776ca[_0x0fa8('0x2c')]=_[_0x0fa8('0x42')](_0x33788e[_0x0fa8('0x2c')]);_0x3776ca['filters']=_[_0x0fa8('0x2d')](_0x3776ca['model'],_0x3776ca[_0x0fa8('0x2c')]);_0x54bf1c[_0x0fa8('0x2f')]=_[_0x0fa8('0x2d')](_0x3776ca['model'],qs['fields'](_0x33788e[_0x0fa8('0x2c')][_0x0fa8('0x2e')]));_0x54bf1c[_0x0fa8('0x2f')]=_0x54bf1c[_0x0fa8('0x2f')][_0x0fa8('0x30')]?_0x54bf1c[_0x0fa8('0x2f')]:_0x3776ca[_0x0fa8('0x2b')];if(_0x33788e[_0x0fa8('0x2c')][_0x0fa8('0x3c')]){_0x54bf1c[_0x0fa8('0x3d')]=[{'all':!![]}];}_0x54bf1c=_['merge']({},_0x54bf1c,_0x33788e[_0x0fa8('0x3a')]);return db[_0x0fa8('0x3b')][_0x0fa8('0x43')](_0x54bf1c)['then'](handleEntityNotFound(_0x66913f,null))[_0x0fa8('0x23')](respondWithResult(_0x66913f,null))[_0x0fa8('0x40')](handleError(_0x66913f,null));};exports['create']=function(_0x169cba,_0x25f90d){return db[_0x0fa8('0x3b')][_0x0fa8('0x44')](_0x169cba[_0x0fa8('0x45')],{})['then'](respondWithResult(_0x25f90d,0xc9))['catch'](handleError(_0x25f90d,null));};exports[_0x0fa8('0x22')]=function(_0x26b7f7,_0x3a8e7d){if(_0x26b7f7[_0x0fa8('0x45')]['id']){delete _0x26b7f7[_0x0fa8('0x45')]['id'];}return db[_0x0fa8('0x3b')][_0x0fa8('0x43')]({'where':{'id':_0x26b7f7[_0x0fa8('0x41')]['id']}})[_0x0fa8('0x23')](handleEntityNotFound(_0x3a8e7d,null))[_0x0fa8('0x23')](saveUpdates(_0x26b7f7[_0x0fa8('0x45')],null))['then'](respondWithResult(_0x3a8e7d,null))[_0x0fa8('0x40')](handleError(_0x3a8e7d,null));};exports[_0x0fa8('0x24')]=function(_0x133bb9,_0x2bd7f){return db[_0x0fa8('0x3b')]['find']({'where':{'id':_0x133bb9[_0x0fa8('0x41')]['id']}})['then'](handleEntityNotFound(_0x2bd7f,null))[_0x0fa8('0x23')](removeEntity(_0x2bd7f,null))[_0x0fa8('0x40')](handleError(_0x2bd7f,null));}; \ No newline at end of file +var _0xb2b8=['then','error','stack','name','index','map','SalesforceField','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy'];(function(_0x365f27,_0x1d3449){var _0x1015b0=function(_0x3f7c8c){while(--_0x3f7c8c){_0x365f27['push'](_0x365f27['shift']());}};_0x1015b0(++_0x1d3449);}(_0xb2b8,0x6e));var _0x8b2b=function(_0x34f82d,_0x502be6){_0x34f82d=_0x34f82d-0x0;var _0x4d3125=_0xb2b8[_0x34f82d];return _0x4d3125;};'use strict';var emlformat=require(_0x8b2b('0x0'));var rimraf=require(_0x8b2b('0x1'));var zipdir=require(_0x8b2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b2b('0x3'));var moment=require('moment');var BPromise=require(_0x8b2b('0x4'));var Mustache=require(_0x8b2b('0x5'));var util=require('util');var path=require(_0x8b2b('0x6'));var sox=require(_0x8b2b('0x7'));var csv=require(_0x8b2b('0x8'));var ejs=require(_0x8b2b('0x9'));var fs=require('fs');var fs_extra=require(_0x8b2b('0xa'));var _=require(_0x8b2b('0xb'));var squel=require(_0x8b2b('0xc'));var crypto=require(_0x8b2b('0xd'));var jsforce=require(_0x8b2b('0xe'));var deskjs=require(_0x8b2b('0xf'));var toCsv=require(_0x8b2b('0x8'));var querystring=require(_0x8b2b('0x10'));var Papa=require(_0x8b2b('0x11'));var Redis=require('ioredis');var authService=require(_0x8b2b('0x12'));var qs=require(_0x8b2b('0x13'));var as=require(_0x8b2b('0x14'));var hardwareService=require(_0x8b2b('0x15'));var logger=require('../../config/logger')(_0x8b2b('0x16'));var utils=require(_0x8b2b('0x17'));var config=require(_0x8b2b('0x18'));var licenseUtil=require(_0x8b2b('0x19'));var db=require(_0x8b2b('0x1a'))['db'];function respondWithStatusCode(_0x34b7fa,_0x53c6a2){_0x53c6a2=_0x53c6a2||0xcc;return function(_0xf5b057){if(_0xf5b057){return _0x34b7fa[_0x8b2b('0x1b')](_0x53c6a2);}return _0x34b7fa[_0x8b2b('0x1c')](_0x53c6a2)[_0x8b2b('0x1d')]();};}function respondWithResult(_0x3b320c,_0x3e54d0){_0x3e54d0=_0x3e54d0||0xc8;return function(_0x5a3e4e){if(_0x5a3e4e){return _0x3b320c['status'](_0x3e54d0)[_0x8b2b('0x1e')](_0x5a3e4e);}};}function respondWithFilteredResult(_0xf5b834,_0x3309c1){return function(_0x555cb6){if(_0x555cb6){var _0x35c085=typeof _0x3309c1[_0x8b2b('0x1f')]===_0x8b2b('0x20')&&typeof _0x3309c1[_0x8b2b('0x21')]===_0x8b2b('0x20');var _0x29fbc8=_0x555cb6[_0x8b2b('0x22')];var _0xe60c9f=_0x35c085?0x0:_0x3309c1[_0x8b2b('0x1f')];var _0x4cce1c=_0x35c085?_0x555cb6[_0x8b2b('0x22')]:_0x3309c1[_0x8b2b('0x1f')]+_0x3309c1[_0x8b2b('0x21')];var _0x54a6f7;if(_0x4cce1c>=_0x29fbc8){_0x4cce1c=_0x29fbc8;_0x54a6f7=0xc8;}else{_0x54a6f7=0xce;}_0xf5b834[_0x8b2b('0x1c')](_0x54a6f7);return _0xf5b834['set'](_0x8b2b('0x23'),_0xe60c9f+'-'+_0x4cce1c+'/'+_0x29fbc8)[_0x8b2b('0x1e')](_0x555cb6);}return null;};}function patchUpdates(_0x1db986){return function(_0x1de0d2){try{jsonpatch[_0x8b2b('0x24')](_0x1de0d2,_0x1db986,!![]);}catch(_0x1bde67){return BPromise[_0x8b2b('0x25')](_0x1bde67);}return _0x1de0d2[_0x8b2b('0x26')]();};}function saveUpdates(_0x1e3447,_0x298dc0){return function(_0x21eaff){if(_0x21eaff){return _0x21eaff['update'](_0x1e3447)['then'](function(_0x177036){return _0x177036;});}return null;};}function removeEntity(_0x103a10,_0x5cb458){return function(_0x1b10ce){if(_0x1b10ce){return _0x1b10ce[_0x8b2b('0x27')]()[_0x8b2b('0x28')](function(){_0x103a10['status'](0xcc)[_0x8b2b('0x1d')]();});}};}function handleEntityNotFound(_0x4c97fc,_0x338f0c){return function(_0x450581){if(!_0x450581){_0x4c97fc[_0x8b2b('0x1b')](0x194);}return _0x450581;};}function handleError(_0x1c16f4,_0x3fe1a3){_0x3fe1a3=_0x3fe1a3||0x1f4;return function(_0x5eab78){logger[_0x8b2b('0x29')](_0x5eab78[_0x8b2b('0x2a')]);if(_0x5eab78['name']){delete _0x5eab78[_0x8b2b('0x2b')];}_0x1c16f4['status'](_0x3fe1a3)['send'](_0x5eab78);};}exports[_0x8b2b('0x2c')]=function(_0x143a7e,_0x4ca70f){var _0x36e591={},_0x3ea5a0={},_0x2da666={'count':0x0,'rows':[]};var _0xbe2aee=_[_0x8b2b('0x2d')](db[_0x8b2b('0x2e')]['rawAttributes'],function(_0x3c2827){return{'name':_0x3c2827[_0x8b2b('0x2f')],'type':_0x3c2827[_0x8b2b('0x30')][_0x8b2b('0x31')]};});_0x3ea5a0[_0x8b2b('0x32')]=_[_0x8b2b('0x2d')](_0xbe2aee,_0x8b2b('0x2b'));_0x3ea5a0['query']=_['keys'](_0x143a7e['query']);_0x3ea5a0[_0x8b2b('0x33')]=_[_0x8b2b('0x34')](_0x3ea5a0[_0x8b2b('0x32')],_0x3ea5a0[_0x8b2b('0x35')]);_0x36e591[_0x8b2b('0x36')]=_[_0x8b2b('0x34')](_0x3ea5a0[_0x8b2b('0x32')],qs[_0x8b2b('0x37')](_0x143a7e[_0x8b2b('0x35')][_0x8b2b('0x37')]));_0x36e591['attributes']=_0x36e591[_0x8b2b('0x36')][_0x8b2b('0x38')]?_0x36e591[_0x8b2b('0x36')]:_0x3ea5a0['model'];if(!_0x143a7e[_0x8b2b('0x35')][_0x8b2b('0x39')](_0x8b2b('0x3a'))){_0x36e591['limit']=qs[_0x8b2b('0x21')](_0x143a7e[_0x8b2b('0x35')]['limit']);_0x36e591[_0x8b2b('0x1f')]=qs[_0x8b2b('0x1f')](_0x143a7e[_0x8b2b('0x35')]['offset']);}_0x36e591['order']=qs['sort'](_0x143a7e[_0x8b2b('0x35')]['sort']);_0x36e591['where']=qs[_0x8b2b('0x33')](_[_0x8b2b('0x3b')](_0x143a7e['query'],_0x3ea5a0[_0x8b2b('0x33')]),_0xbe2aee);if(_0x143a7e[_0x8b2b('0x35')]['filter']){_0x36e591[_0x8b2b('0x3c')]=_[_0x8b2b('0x3d')](_0x36e591[_0x8b2b('0x3c')],{'$or':_['map'](_0xbe2aee,function(_0xac9626){if(_0xac9626['type']!==_0x8b2b('0x3e')){var _0x2d2c09={};_0x2d2c09[_0xac9626[_0x8b2b('0x2b')]]={'$like':'%'+_0x143a7e[_0x8b2b('0x35')][_0x8b2b('0x3f')]+'%'};return _0x2d2c09;}})});}_0x36e591=_[_0x8b2b('0x3d')]({},_0x36e591,_0x143a7e[_0x8b2b('0x40')]);var _0x4c875a={'where':_0x36e591[_0x8b2b('0x3c')]};return db['SalesforceField'][_0x8b2b('0x22')](_0x4c875a)['then'](function(_0xcb4ba){_0x2da666[_0x8b2b('0x22')]=_0xcb4ba;if(_0x143a7e[_0x8b2b('0x35')]['includeAll']){_0x36e591[_0x8b2b('0x41')]=[{'all':!![]}];}return db[_0x8b2b('0x2e')][_0x8b2b('0x42')](_0x36e591);})['then'](function(_0xc59d09){_0x2da666[_0x8b2b('0x43')]=_0xc59d09;return _0x2da666;})['then'](respondWithFilteredResult(_0x4ca70f,_0x36e591))[_0x8b2b('0x44')](handleError(_0x4ca70f,null));};exports[_0x8b2b('0x45')]=function(_0x5d8681,_0x3a04a3){var _0x5aa0e={'raw':!![],'where':{'id':_0x5d8681[_0x8b2b('0x46')]['id']}},_0x157a92={};_0x157a92[_0x8b2b('0x32')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x157a92[_0x8b2b('0x35')]=_['keys'](_0x5d8681[_0x8b2b('0x35')]);_0x157a92[_0x8b2b('0x33')]=_[_0x8b2b('0x34')](_0x157a92[_0x8b2b('0x32')],_0x157a92[_0x8b2b('0x35')]);_0x5aa0e[_0x8b2b('0x36')]=_[_0x8b2b('0x34')](_0x157a92[_0x8b2b('0x32')],qs['fields'](_0x5d8681[_0x8b2b('0x35')]['fields']));_0x5aa0e[_0x8b2b('0x36')]=_0x5aa0e[_0x8b2b('0x36')][_0x8b2b('0x38')]?_0x5aa0e[_0x8b2b('0x36')]:_0x157a92[_0x8b2b('0x32')];if(_0x5d8681[_0x8b2b('0x35')][_0x8b2b('0x47')]){_0x5aa0e['include']=[{'all':!![]}];}_0x5aa0e=_[_0x8b2b('0x3d')]({},_0x5aa0e,_0x5d8681[_0x8b2b('0x40')]);return db['SalesforceField'][_0x8b2b('0x48')](_0x5aa0e)['then'](handleEntityNotFound(_0x3a04a3,null))[_0x8b2b('0x28')](respondWithResult(_0x3a04a3,null))[_0x8b2b('0x44')](handleError(_0x3a04a3,null));};exports[_0x8b2b('0x49')]=function(_0x471e94,_0x491b73){return db[_0x8b2b('0x2e')][_0x8b2b('0x49')](_0x471e94[_0x8b2b('0x4a')],{})[_0x8b2b('0x28')](respondWithResult(_0x491b73,0xc9))['catch'](handleError(_0x491b73,null));};exports['update']=function(_0x3cdd13,_0x38943b){if(_0x3cdd13[_0x8b2b('0x4a')]['id']){delete _0x3cdd13['body']['id'];}return db[_0x8b2b('0x2e')][_0x8b2b('0x48')]({'where':{'id':_0x3cdd13[_0x8b2b('0x46')]['id']}})[_0x8b2b('0x28')](handleEntityNotFound(_0x38943b,null))['then'](saveUpdates(_0x3cdd13['body'],null))[_0x8b2b('0x28')](respondWithResult(_0x38943b,null))['catch'](handleError(_0x38943b,null));};exports[_0x8b2b('0x27')]=function(_0x3ce561,_0x190956){return db[_0x8b2b('0x2e')][_0x8b2b('0x48')]({'where':{'id':_0x3ce561['params']['id']}})[_0x8b2b('0x28')](handleEntityNotFound(_0x190956,null))[_0x8b2b('0x28')](removeEntity(_0x190956,null))[_0x8b2b('0x44')](handleError(_0x190956,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7a0e3b0..8c1b95e 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 _0xc950=['api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x186973,_0x5bb89e){var _0x28ebab=function(_0x510aa8){while(--_0x510aa8){_0x186973['push'](_0x186973['shift']());}};_0x28ebab(++_0x5bb89e);}(_0xc950,0x177));var _0x0c95=function(_0x3f25c8,_0x5a9402){_0x3f25c8=_0x3f25c8-0x0;var _0x315c75=_0xc950[_0x3f25c8];return _0x315c75;};'use strict';var _=require(_0x0c95('0x0'));var util=require(_0x0c95('0x1'));var logger=require(_0x0c95('0x2'))(_0x0c95('0x3'));var moment=require(_0x0c95('0x4'));var BPromise=require('bluebird');var rp=require(_0x0c95('0x5'));var fs=require('fs');var path=require(_0x0c95('0x6'));var rimraf=require(_0x0c95('0x7'));var config=require(_0x0c95('0x8'));var attributes=require(_0x0c95('0x9'));module['exports']=function(_0x25513d,_0x52db7b){return _0x25513d['define'](_0x0c95('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x0c95('0xb'),'fields':[_0x0c95('0xc'),_0x0c95('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9004=['api','moment','bluebird','path','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x4870d6,_0x499731){var _0x1f20b1=function(_0xc8e6bf){while(--_0xc8e6bf){_0x4870d6['push'](_0x4870d6['shift']());}};_0x1f20b1(++_0x499731);}(_0x9004,0x1bf));var _0x4900=function(_0x2bf9e7,_0xf2b5b4){_0x2bf9e7=_0x2bf9e7-0x0;var _0x1cdf3d=_0x9004[_0x2bf9e7];return _0x1cdf3d;};'use strict';var _=require(_0x4900('0x0'));var util=require(_0x4900('0x1'));var logger=require(_0x4900('0x2'))(_0x4900('0x3'));var moment=require(_0x4900('0x4'));var BPromise=require(_0x4900('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4900('0x6'));var rimraf=require('rimraf');var config=require(_0x4900('0x7'));var attributes=require(_0x4900('0x8'));module['exports']=function(_0x1bebc2,_0x4f46b0){return _0x1bebc2[_0x4900('0x9')](_0x4900('0xa'),attributes,{'tableName':_0x4900('0xb'),'paranoid':![],'indexes':[{'name':_0x4900('0xc'),'fields':[_0x4900('0xd'),_0x4900('0xe')],'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 7829147..3fa6867 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 _0x4b07=['request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x18f64a,_0x1c8248){var _0x44687f=function(_0x1234ad){while(--_0x1234ad){_0x18f64a['push'](_0x18f64a['shift']());}};_0x44687f(++_0x1c8248);}(_0x4b07,0x80));var _0x74b0=function(_0x42eed7,_0x308dcc){_0x42eed7=_0x42eed7-0x0;var _0x40cef4=_0x4b07[_0x42eed7];return _0x40cef4;};'use strict';var _=require(_0x74b0('0x0'));var util=require(_0x74b0('0x1'));var moment=require(_0x74b0('0x2'));var BPromise=require(_0x74b0('0x3'));var rs=require(_0x74b0('0x4'));var fs=require('fs');var Redis=require(_0x74b0('0x5'));var db=require(_0x74b0('0x6'))['db'];var utils=require(_0x74b0('0x7'));var logger=require('../../config/logger')(_0x74b0('0x8'));var config=require(_0x74b0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x74b0('0xa')][_0x74b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b7abe,_0x56abb2,_0x240c44){return new BPromise(function(_0x4c5de4,_0x1f7c43){return client[_0x74b0('0xc')](_0x4b7abe,_0x240c44)[_0x74b0('0xd')](function(_0xf38564){logger[_0x74b0('0xe')](_0x74b0('0xf'),_0x56abb2,_0x74b0('0x10'));logger[_0x74b0('0x11')](_0x74b0('0x12'),_0x56abb2,_0x74b0('0x10'),JSON['stringify'](_0xf38564));if(_0xf38564[_0x74b0('0x13')]){if(_0xf38564[_0x74b0('0x13')][_0x74b0('0x14')]===0x1f4){logger[_0x74b0('0x13')](_0x74b0('0xf'),_0x56abb2,_0xf38564[_0x74b0('0x13')]['message']);return _0x1f7c43(_0xf38564[_0x74b0('0x13')][_0x74b0('0x15')]);}logger[_0x74b0('0x13')]('SalesforceField,\x20%s,\x20%s',_0x56abb2,_0xf38564[_0x74b0('0x13')][_0x74b0('0x15')]);return _0x4c5de4(_0xf38564[_0x74b0('0x13')][_0x74b0('0x15')]);}else{logger['info'](_0x74b0('0xf'),_0x56abb2,'request\x20sent');_0x4c5de4(_0xf38564[_0x74b0('0x16')][_0x74b0('0x15')]);}})[_0x74b0('0x17')](function(_0x43782c){logger[_0x74b0('0x13')](_0x74b0('0xf'),_0x56abb2,_0x43782c);_0x1f7c43(_0x43782c);});});} \ No newline at end of file +var _0x88df=['result','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3ffaf7,_0x48b1ae){var _0x12d8d5=function(_0x58ba1d){while(--_0x58ba1d){_0x3ffaf7['push'](_0x3ffaf7['shift']());}};_0x12d8d5(++_0x48b1ae);}(_0x88df,0x1cf));var _0xf88d=function(_0x1e84f5,_0x430ab8){_0x1e84f5=_0x1e84f5-0x0;var _0x3d3f71=_0x88df[_0x1e84f5];return _0x3d3f71;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf88d('0x0'));var BPromise=require(_0xf88d('0x1'));var rs=require(_0xf88d('0x2'));var fs=require('fs');var Redis=require(_0xf88d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf88d('0x4'));var logger=require(_0xf88d('0x5'))(_0xf88d('0x6'));var config=require(_0xf88d('0x7'));var jayson=require(_0xf88d('0x8'));var client=jayson['client'][_0xf88d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc8cbaa,_0x19f780,_0x47f30f){return new BPromise(function(_0x4d4b58,_0x33fb89){return client[_0xf88d('0xa')](_0xc8cbaa,_0x47f30f)[_0xf88d('0xb')](function(_0x57f892){logger[_0xf88d('0xc')](_0xf88d('0xd'),_0x19f780,_0xf88d('0xe'));logger['debug'](_0xf88d('0xf'),_0x19f780,_0xf88d('0xe'),JSON[_0xf88d('0x10')](_0x57f892));if(_0x57f892[_0xf88d('0x11')]){if(_0x57f892[_0xf88d('0x11')][_0xf88d('0x12')]===0x1f4){logger[_0xf88d('0x11')](_0xf88d('0xd'),_0x19f780,_0x57f892[_0xf88d('0x11')]['message']);return _0x33fb89(_0x57f892[_0xf88d('0x11')]['message']);}logger['error'](_0xf88d('0xd'),_0x19f780,_0x57f892[_0xf88d('0x11')][_0xf88d('0x13')]);return _0x4d4b58(_0x57f892[_0xf88d('0x11')]['message']);}else{logger[_0xf88d('0xc')]('SalesforceField,\x20%s,\x20%s',_0x19f780,_0xf88d('0xe'));_0x4d4b58(_0x57f892[_0xf88d('0x14')][_0xf88d('0x13')]);}})['catch'](function(_0xeeac6d){logger['error']('SalesforceField,\x20%s,\x20%s',_0x19f780,_0xeeac6d);_0x33fb89(_0xeeac6d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2f1c097..7b8efbf 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 _0xf491=['../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','/:id/configurations','isAuthenticated','/:id/fields','getFields','create','post','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x4d6a8c,_0x48758c){var _0x1ee549=function(_0x476312){while(--_0x476312){_0x4d6a8c['push'](_0x4d6a8c['shift']());}};_0x1ee549(++_0x48758c);}(_0xf491,0x178));var _0x1f49=function(_0x32c5f9,_0x4b6d8b){_0x32c5f9=_0x32c5f9-0x0;var _0x17d315=_0xf491[_0x32c5f9];return _0x17d315;};'use strict';var multer=require(_0x1f49('0x0'));var util=require(_0x1f49('0x1'));var path=require(_0x1f49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f49('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f49('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f49('0x5'));var controller=require(_0x1f49('0x6'));router[_0x1f49('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f49('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1f49('0x7')](_0x1f49('0x8'),auth[_0x1f49('0x9')](),controller['getConfigurations']);router[_0x1f49('0x7')](_0x1f49('0xa'),auth[_0x1f49('0x9')](),controller[_0x1f49('0xb')]);router['post']('/',auth[_0x1f49('0x9')](),controller[_0x1f49('0xc')]);router[_0x1f49('0xd')](_0x1f49('0x8'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1f49('0xe')](_0x1f49('0xf'),auth[_0x1f49('0x9')](),controller[_0x1f49('0x10')]);router[_0x1f49('0x11')](_0x1f49('0xf'),auth[_0x1f49('0x9')](),controller[_0x1f49('0x12')]);module[_0x1f49('0x13')]=router; \ No newline at end of file +var _0x4c58=['/:id/fields','post','create','addConfiguration','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x4c58,0xed));var _0x84c5=function(_0x4094e2,_0x26d283){_0x4094e2=_0x4094e2-0x0;var _0x272039=_0x4c58[_0x4094e2];return _0x272039;};'use strict';var multer=require(_0x84c5('0x0'));var util=require('util');var path=require(_0x84c5('0x1'));var timeout=require(_0x84c5('0x2'));var express=require(_0x84c5('0x3'));var router=express[_0x84c5('0x4')]();var fs_extra=require(_0x84c5('0x5'));var auth=require(_0x84c5('0x6'));var interaction=require(_0x84c5('0x7'));var config=require('../../config/environment');var controller=require(_0x84c5('0x8'));router[_0x84c5('0x9')]('/',auth[_0x84c5('0xa')](),controller[_0x84c5('0xb')]);router[_0x84c5('0x9')](_0x84c5('0xc'),auth[_0x84c5('0xa')](),controller[_0x84c5('0xd')]);router[_0x84c5('0x9')](_0x84c5('0xe'),auth[_0x84c5('0xa')](),controller[_0x84c5('0xf')]);router[_0x84c5('0x9')](_0x84c5('0x10'),auth[_0x84c5('0xa')](),controller['getFields']);router[_0x84c5('0x11')]('/',auth[_0x84c5('0xa')](),controller[_0x84c5('0x12')]);router['post'](_0x84c5('0xe'),auth[_0x84c5('0xa')](),controller[_0x84c5('0x13')]);router['put']('/:id',auth[_0x84c5('0xa')](),controller[_0x84c5('0x14')]);router['delete'](_0x84c5('0xc'),auth[_0x84c5('0xa')](),controller[_0x84c5('0x15')]);module[_0x84c5('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 93452d3..1ecc2ac 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 _0xe78a=['sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe78a,0x87));var _0xae78=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe78a[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xae78('0x0'));module[_0xae78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xae78('0x2')]},'username':{'type':Sequelize[_0xae78('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xae78('0x2')]},'email':{'type':Sequelize[_0xae78('0x2')]},'remoteUri':{'type':Sequelize[_0xae78('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x3820=['sequelize','exports','STRING','remoteUri'];(function(_0x4a3615,_0x14b293){var _0xb362dc=function(_0x54078a){while(--_0x54078a){_0x4a3615['push'](_0x4a3615['shift']());}};_0xb362dc(++_0x14b293);}(_0x3820,0x144));var _0x0382=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0x3820[_0xf1af27];return _0x46b274;};'use strict';var Sequelize=require(_0x0382('0x0'));module[_0x0382('0x1')]={'name':{'type':Sequelize[_0x0382('0x2')]},'description':{'type':Sequelize[_0x0382('0x2')]},'username':{'type':Sequelize[_0x0382('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x0382('0x2')]},'email':{'type':Sequelize[_0x0382('0x2')]},'remoteUri':{'type':Sequelize[_0x0382('0x2')],'unique':_0x0382('0x3')},'serverUrl':{'type':Sequelize[_0x0382('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 6a83f76..0ef9862 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 _0xc875=['username','password','email','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','internalType','label','push','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','test','statusCode','Wrong\x20credentials','true','false','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','state','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','rfc','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','work_notes','short_description','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location'];(function(_0x26277c,_0x485dc3){var _0x401e71=function(_0x2d31e5){while(--_0x2d31e5){_0x26277c['push'](_0x26277c['shift']());}};_0x401e71(++_0x485dc3);}(_0xc875,0xd2));var _0x5c87=function(_0x14f8da,_0x58d9d0){_0x14f8da=_0x14f8da-0x0;var _0xcf0a98=_0xc875[_0x14f8da];return _0xcf0a98;};'use strict';var emlformat=require(_0x5c87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c87('0x1'));var jsonpatch=require(_0x5c87('0x2'));var rp=require(_0x5c87('0x3'));var moment=require('moment');var BPromise=require(_0x5c87('0x4'));var Mustache=require(_0x5c87('0x5'));var util=require(_0x5c87('0x6'));var path=require(_0x5c87('0x7'));var sox=require(_0x5c87('0x8'));var csv=require(_0x5c87('0x9'));var ejs=require(_0x5c87('0xa'));var fs=require('fs');var fs_extra=require(_0x5c87('0xb'));var _=require('lodash');var squel=require(_0x5c87('0xc'));var crypto=require(_0x5c87('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5c87('0xe'));var toCsv=require(_0x5c87('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c87('0xf'));var authService=require(_0x5c87('0x10'));var qs=require(_0x5c87('0x11'));var as=require(_0x5c87('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c87('0x13'))('api');var utils=require(_0x5c87('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5c87('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x379c65,_0x5d3336){_0x5d3336=_0x5d3336||0xcc;return function(_0x589fb3){if(_0x589fb3){return _0x379c65['sendStatus'](_0x5d3336);}return _0x379c65['status'](_0x5d3336)[_0x5c87('0x16')]();};}function respondWithResult(_0x45365f,_0x2475bf){_0x2475bf=_0x2475bf||0xc8;return function(_0x2d522f){if(_0x2d522f){return _0x45365f[_0x5c87('0x17')](_0x2475bf)[_0x5c87('0x18')](_0x2d522f);}};}function respondWithFilteredResult(_0x39c14b,_0xa9d87a){return function(_0x408a5){if(_0x408a5){var _0x5b0027=typeof _0xa9d87a['offset']===_0x5c87('0x19')&&typeof _0xa9d87a[_0x5c87('0x1a')]===_0x5c87('0x19');var _0x942310=_0x408a5[_0x5c87('0x1b')];var _0x46376c=_0x5b0027?0x0:_0xa9d87a['offset'];var _0x3e6d47=_0x5b0027?_0x408a5[_0x5c87('0x1b')]:_0xa9d87a[_0x5c87('0x1c')]+_0xa9d87a[_0x5c87('0x1a')];var _0x4e4274;if(_0x3e6d47>=_0x942310){_0x3e6d47=_0x942310;_0x4e4274=0xc8;}else{_0x4e4274=0xce;}_0x39c14b[_0x5c87('0x17')](_0x4e4274);return _0x39c14b['set'](_0x5c87('0x1d'),_0x46376c+'-'+_0x3e6d47+'/'+_0x942310)['json'](_0x408a5);}return null;};}function patchUpdates(_0x5bbbf3){return function(_0x24acf2){try{jsonpatch['apply'](_0x24acf2,_0x5bbbf3,!![]);}catch(_0x2e7545){return BPromise[_0x5c87('0x1e')](_0x2e7545);}return _0x24acf2[_0x5c87('0x1f')]();};}function saveUpdates(_0x4aba41,_0x184d5a){return function(_0x5d93e4){if(_0x5d93e4){return _0x5d93e4[_0x5c87('0x20')](_0x4aba41)[_0x5c87('0x21')](function(_0x42b47b){return _0x42b47b;});}return null;};}function removeEntity(_0x49377b,_0x47cd85){return function(_0x4a6bff){if(_0x4a6bff){return _0x4a6bff[_0x5c87('0x22')]()[_0x5c87('0x21')](function(){_0x49377b[_0x5c87('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x413998,_0x3df577){return function(_0x51bd63){if(!_0x51bd63){_0x413998[_0x5c87('0x23')](0x194);}return _0x51bd63;};}function handleError(_0x564ce3,_0x5f5390){_0x5f5390=_0x5f5390||0x1f4;return function(_0x5d7357){logger[_0x5c87('0x24')](_0x5d7357[_0x5c87('0x25')]);if(_0x5d7357['name']){delete _0x5d7357[_0x5c87('0x26')];}_0x564ce3[_0x5c87('0x17')](_0x5f5390)[_0x5c87('0x27')](_0x5d7357);};}exports['index']=function(_0x555ef2,_0x2f94c0){var _0x6ff97d={},_0x4cc666={},_0x59a673={'count':0x0,'rows':[]};var _0x5b0875=_[_0x5c87('0x28')](db[_0x5c87('0x29')][_0x5c87('0x2a')],function(_0x55973f){return{'name':_0x55973f[_0x5c87('0x2b')],'type':_0x55973f[_0x5c87('0x2c')][_0x5c87('0x2d')]};});_0x4cc666[_0x5c87('0x2e')]=_[_0x5c87('0x28')](_0x5b0875,_0x5c87('0x26'));_0x4cc666[_0x5c87('0x2f')]=_[_0x5c87('0x30')](_0x555ef2[_0x5c87('0x2f')]);_0x4cc666['filters']=_[_0x5c87('0x31')](_0x4cc666['model'],_0x4cc666[_0x5c87('0x2f')]);_0x6ff97d[_0x5c87('0x32')]=_[_0x5c87('0x31')](_0x4cc666['model'],qs[_0x5c87('0x33')](_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x33')]));_0x6ff97d[_0x5c87('0x32')]=_0x6ff97d[_0x5c87('0x32')][_0x5c87('0x34')]?_0x6ff97d[_0x5c87('0x32')]:_0x4cc666[_0x5c87('0x2e')];if(!_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x35')](_0x5c87('0x36'))){_0x6ff97d[_0x5c87('0x1a')]=qs[_0x5c87('0x1a')](_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x1a')]);_0x6ff97d[_0x5c87('0x1c')]=qs[_0x5c87('0x1c')](_0x555ef2['query'][_0x5c87('0x1c')]);}_0x6ff97d[_0x5c87('0x37')]=qs[_0x5c87('0x38')](_0x555ef2['query']['sort']);_0x6ff97d['where']=qs[_0x5c87('0x39')](_[_0x5c87('0x3a')](_0x555ef2['query'],_0x4cc666[_0x5c87('0x39')]),_0x5b0875);if(_0x555ef2[_0x5c87('0x2f')]['filter']){_0x6ff97d[_0x5c87('0x3b')]=_[_0x5c87('0x3c')](_0x6ff97d['where'],{'$or':_[_0x5c87('0x28')](_0x5b0875,function(_0x5b80cb){if(_0x5b80cb[_0x5c87('0x2c')]!=='VIRTUAL'){var _0x3026fd={};_0x3026fd[_0x5b80cb[_0x5c87('0x26')]]={'$like':'%'+_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x3d')]+'%'};return _0x3026fd;}})});}_0x6ff97d=_[_0x5c87('0x3c')]({},_0x6ff97d,_0x555ef2['options']);var _0x264f05={'where':_0x6ff97d[_0x5c87('0x3b')]};return db[_0x5c87('0x29')][_0x5c87('0x1b')](_0x264f05)[_0x5c87('0x21')](function(_0x29be24){_0x59a673[_0x5c87('0x1b')]=_0x29be24;if(_0x555ef2[_0x5c87('0x2f')][_0x5c87('0x3e')]){_0x6ff97d[_0x5c87('0x3f')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x5c87('0x40')](_0x6ff97d);})[_0x5c87('0x21')](function(_0x46813e){_0x59a673[_0x5c87('0x41')]=_0x46813e;return _0x59a673;})[_0x5c87('0x21')](respondWithFilteredResult(_0x2f94c0,_0x6ff97d))[_0x5c87('0x42')](handleError(_0x2f94c0,null));};exports[_0x5c87('0x43')]=function(_0x12720a,_0xd7d9bb){var _0x1272fb={'raw':![],'where':{'id':_0x12720a[_0x5c87('0x44')]['id']}},_0x483650={};_0x483650['model']=_[_0x5c87('0x30')](db[_0x5c87('0x29')]['rawAttributes']);_0x483650[_0x5c87('0x2f')]=_[_0x5c87('0x30')](_0x12720a['query']);_0x483650[_0x5c87('0x39')]=_['intersection'](_0x483650[_0x5c87('0x2e')],_0x483650[_0x5c87('0x2f')]);_0x1272fb['attributes']=_[_0x5c87('0x31')](_0x483650[_0x5c87('0x2e')],qs[_0x5c87('0x33')](_0x12720a['query'][_0x5c87('0x33')]));_0x1272fb[_0x5c87('0x32')]=_0x1272fb[_0x5c87('0x32')]['length']?_0x1272fb[_0x5c87('0x32')]:_0x483650[_0x5c87('0x2e')];if(_0x12720a[_0x5c87('0x2f')]['includeAll']){_0x1272fb[_0x5c87('0x3f')]=[{'all':!![]}];}_0x1272fb=_[_0x5c87('0x3c')]({},_0x1272fb,_0x12720a[_0x5c87('0x45')]);return db['ServicenowAccount'][_0x5c87('0x46')](_0x1272fb)['then'](handleEntityNotFound(_0xd7d9bb,null))[_0x5c87('0x21')](respondWithResult(_0xd7d9bb,null))[_0x5c87('0x42')](handleError(_0xd7d9bb,null));};exports[_0x5c87('0x47')]=function(_0x2f759f,_0x57ab1e){return db[_0x5c87('0x29')][_0x5c87('0x47')](_0x2f759f[_0x5c87('0x48')],{})['then'](respondWithResult(_0x57ab1e,0xc9))[_0x5c87('0x42')](handleError(_0x57ab1e,null));};exports[_0x5c87('0x20')]=function(_0x460123,_0x48e9eb){if(_0x460123[_0x5c87('0x48')]['id']){delete _0x460123[_0x5c87('0x48')]['id'];}return db[_0x5c87('0x29')][_0x5c87('0x46')]({'where':{'id':_0x460123[_0x5c87('0x44')]['id']}})['then'](handleEntityNotFound(_0x48e9eb,null))['then'](saveUpdates(_0x460123[_0x5c87('0x48')],null))[_0x5c87('0x21')](respondWithResult(_0x48e9eb,null))[_0x5c87('0x42')](handleError(_0x48e9eb,null));};exports[_0x5c87('0x22')]=function(_0x1decf4,_0x184377){return db[_0x5c87('0x29')][_0x5c87('0x46')]({'where':{'id':_0x1decf4['params']['id']}})['then'](handleEntityNotFound(_0x184377,null))[_0x5c87('0x21')](removeEntity(_0x184377,null))['catch'](handleError(_0x184377,null));};exports[_0x5c87('0x49')]=function(_0x19d3f8,_0x49834e,_0x5030d9){var _0x340a2f={};var _0x1c587f={};var _0x338049;var _0x42e3ef;return db[_0x5c87('0x29')][_0x5c87('0x4a')]({'where':{'id':_0x19d3f8[_0x5c87('0x44')]['id']}})[_0x5c87('0x21')](handleEntityNotFound(_0x49834e,null))[_0x5c87('0x21')](function(_0x242c6f){if(_0x242c6f){_0x338049=_0x242c6f;_0x1c587f[_0x5c87('0x2e')]=_[_0x5c87('0x30')](db[_0x5c87('0x4b')][_0x5c87('0x2a')]);_0x1c587f[_0x5c87('0x2f')]=_[_0x5c87('0x30')](_0x19d3f8[_0x5c87('0x2f')]);_0x1c587f[_0x5c87('0x39')]=_[_0x5c87('0x31')](_0x1c587f[_0x5c87('0x2e')],_0x1c587f[_0x5c87('0x2f')]);_0x340a2f['attributes']=_['intersection'](_0x1c587f[_0x5c87('0x2e')],qs[_0x5c87('0x33')](_0x19d3f8[_0x5c87('0x2f')]['fields']));_0x340a2f[_0x5c87('0x32')]=_0x340a2f[_0x5c87('0x32')][_0x5c87('0x34')]?_0x340a2f[_0x5c87('0x32')]:_0x1c587f[_0x5c87('0x2e')];_0x340a2f['order']=qs[_0x5c87('0x38')](_0x19d3f8[_0x5c87('0x2f')]['sort']);_0x340a2f[_0x5c87('0x3b')]=qs[_0x5c87('0x39')](_[_0x5c87('0x3a')](_0x19d3f8[_0x5c87('0x2f')],_0x1c587f['filters']));if(_0x19d3f8[_0x5c87('0x2f')][_0x5c87('0x3d')]){_0x340a2f[_0x5c87('0x3b')]=_[_0x5c87('0x3c')](_0x340a2f[_0x5c87('0x3b')],{'$or':_['map'](_0x340a2f[_0x5c87('0x32')],function(_0x171f4b){var _0x54b83c={};_0x54b83c[_0x171f4b]={'$like':'%'+_0x19d3f8['query'][_0x5c87('0x3d')]+'%'};return _0x54b83c;})});}_0x340a2f=_[_0x5c87('0x3c')]({},_0x340a2f,_0x19d3f8[_0x5c87('0x45')]);return _0x338049[_0x5c87('0x49')](_0x340a2f);}})['then'](function(_0x333a21){if(_0x333a21){_0x42e3ef=_0x333a21[_0x5c87('0x34')];if(!_0x19d3f8[_0x5c87('0x2f')][_0x5c87('0x35')](_0x5c87('0x36'))){_0x340a2f[_0x5c87('0x1a')]=qs[_0x5c87('0x1a')](_0x19d3f8[_0x5c87('0x2f')][_0x5c87('0x1a')]);_0x340a2f[_0x5c87('0x1c')]=qs[_0x5c87('0x1c')](_0x19d3f8[_0x5c87('0x2f')][_0x5c87('0x1c')]);}return _0x338049['getConfigurations'](_0x340a2f);}})[_0x5c87('0x21')](function(_0x1fb7e6){if(_0x1fb7e6){return _0x1fb7e6?{'count':_0x42e3ef,'rows':_0x1fb7e6}:null;}})['then'](respondWithResult(_0x49834e,null))[_0x5c87('0x42')](handleError(_0x49834e,null));};exports[_0x5c87('0x4c')]=function(_0x130857,_0x5addf4,_0x391b38){if(_0x130857[_0x5c87('0x48')]['id']){delete _0x130857['body']['id'];}return db[_0x5c87('0x29')][_0x5c87('0x4a')]({'where':{'id':_0x130857[_0x5c87('0x44')]['id']}})['then'](handleEntityNotFound(_0x5addf4,null))[_0x5c87('0x21')](function(_0x294c19){if(_0x294c19){_0x130857[_0x5c87('0x48')][_0x5c87('0x4d')]=_0x294c19['id'];_0x130857[_0x5c87('0x48')][_0x5c87('0x4e')]=integrations[_0x5c87('0x4f')](_0x130857[_0x5c87('0x48')][_0x5c87('0x50')],_0x130857[_0x5c87('0x48')][_0x5c87('0x2c')]);_0x130857[_0x5c87('0x48')][_0x5c87('0x51')]=integrations[_0x5c87('0x52')](_0x130857[_0x5c87('0x48')]['channel'],_0x130857[_0x5c87('0x48')][_0x5c87('0x2c')]);return db[_0x5c87('0x4b')][_0x5c87('0x47')](_0x130857['body'],{'include':[{'model':db[_0x5c87('0x53')],'as':_0x5c87('0x4e')},{'model':db[_0x5c87('0x53')],'as':_0x5c87('0x51')}]});}return null;})[_0x5c87('0x21')](respondWithResult(_0x5addf4,null))[_0x5c87('0x42')](handleError(_0x5addf4,null));};exports[_0x5c87('0x54')]=function(_0x1603dd,_0x65e4fd,_0x2bfc2e){var _0x17a0a9=[_0x5c87('0x55'),_0x5c87('0x56'),_0x5c87('0x57'),_0x5c87('0x58'),_0x5c87('0x59'),_0x5c87('0x5a'),_0x5c87('0x5b'),_0x5c87('0x5c'),_0x5c87('0x5d')];var _0xfd722f=['parent',_0x5c87('0x55'),_0x5c87('0x5e'),'watch_list',_0x5c87('0x5f'),_0x5c87('0x60'),_0x5c87('0x61'),_0x5c87('0x56'),_0x5c87('0x62'),_0x5c87('0x63'),'resolved_by',_0x5c87('0x64'),_0x5c87('0x65'),_0x5c87('0x66'),'sys_created_on',_0x5c87('0x67'),_0x5c87('0x68'),'sys_created_by',_0x5c87('0x57'),_0x5c87('0x37'),'calendar_stc',_0x5c87('0x69'),_0x5c87('0x6a'),_0x5c87('0x6b'),_0x5c87('0x6c'),_0x5c87('0x6d'),'work_notes_list',_0x5c87('0x6e'),_0x5c87('0x6f'),'sys_domain_path',_0x5c87('0x70'),'time_worked',_0x5c87('0x71'),_0x5c87('0x72'),_0x5c87('0x73'),_0x5c87('0x74'),_0x5c87('0x75'),_0x5c87('0x76'),_0x5c87('0x77'),'caller_id','approval_set',_0x5c87('0x58'),_0x5c87('0x78'),_0x5c87('0x79'),'close_code','correlation_display','delivery_task','work_start',_0x5c87('0x7a'),_0x5c87('0x7b'),_0x5c87('0x7c'),_0x5c87('0x7d'),_0x5c87('0x7e'),_0x5c87('0x5a'),_0x5c87('0x7f'),_0x5c87('0x80'),_0x5c87('0x81'),_0x5c87('0x82'),'parent_incident',_0x5c87('0x83'),_0x5c87('0x84'),_0x5c87('0x85'),_0x5c87('0x5b'),_0x5c87('0x86'),'problem_id',_0x5c87('0x87'),_0x5c87('0x88'),_0x5c87('0x89'),_0x5c87('0x8a'),_0x5c87('0x5c'),'comments',_0x5c87('0x8b'),'approval',_0x5c87('0x8c'),_0x5c87('0x8d'),_0x5c87('0x8e'),_0x5c87('0x8f'),'sys_tags',_0x5c87('0x90'),_0x5c87('0x91'),_0x5c87('0x92'),_0x5c87('0x93'),_0x5c87('0x5d')];var _0x5d2d4f='';var _0x16e0f3='';var _0x30f5d4=[];var _0x18057e='';var _0x5ae4cf='';var _0x46adfa=[];var _0x22924d='';var _0x44d101='';var _0x427706={};var _0x57729c='';return db[_0x5c87('0x29')][_0x5c87('0x4a')]({'where':{'id':_0x1603dd[_0x5c87('0x44')]['id']},'attributes':['id',_0x5c87('0x94'),_0x5c87('0x95'),_0x5c87('0x96'),'remoteUri','serverUrl']})[_0x5c87('0x21')](handleEntityNotFound(_0x65e4fd,null))[_0x5c87('0x21')](function(_0x456d32){if(_0x456d32){_0x57729c=_0x456d32['remoteUri'];var _0x52e7fc=_0x57729c[_0x5c87('0x97')](-0x1);if(_0x52e7fc==='/'){_0x57729c=_0x57729c[_0x5c87('0x98')](0x0,_0x57729c[_0x5c87('0x99')](_0x52e7fc));}_0x44d101=util[_0x5c87('0x9a')](_0x5c87('0x9b'),_0x57729c);_0x22924d=util['format'](_0x5c87('0x9c'),_0x57729c);_0x427706={'user':_0x456d32[_0x5c87('0x94')],'pass':_0x456d32[_0x5c87('0x95')]};var _0x5c657c={'method':_0x5c87('0x9d'),'uri':_0x44d101+_0x5c87('0x9e'),'auth':_0x427706,'json':!![]};return rp(_0x5c657c);}})[_0x5c87('0x21')](function(_0x76f2b5){if(_0x76f2b5[_0x5c87('0x9f')][_0x5c87('0x34')]>0x0){_0x5d2d4f=_0x76f2b5[_0x5c87('0x9f')];}console[_0x5c87('0xa0')]('incident\x20table\x20objects',_0x5d2d4f);_0x46adfa=[];_0x16e0f3=Object['assign']([],_0x5d2d4f);_[_0x5c87('0xa1')](_0x16e0f3,function(_0x363b44){return!_0x17a0a9[_0x5c87('0xa2')](_0x363b44[_0x5c87('0x26')]);});_0x16e0f3[_0x5c87('0xa3')](function(_0x57885f){var _0x23900c=createFieldObject(_0x22924d,_0x427706,_0x57885f[_0x5c87('0xa4')],_0x57885f[_0x5c87('0x26')],_0x57885f[_0x5c87('0xa5')],![]);_0x46adfa[_0x5c87('0xa6')](_0x23900c);});return Promise['all'](_0x46adfa);})['then'](function(_0x2351a8){_0x30f5d4=_0x2351a8;_0x18057e=Object[_0x5c87('0xa7')]([],_0x5d2d4f);console[_0x5c87('0xa0')](_0x5c87('0xa8'),_0x5d2d4f);_[_0x5c87('0xa1')](_0x18057e,function(_0x3d7858){return _0xfd722f[_0x5c87('0xa2')](_0x3d7858[_0x5c87('0x26')]);});console[_0x5c87('0xa0')](_0x5c87('0xa9'),_0x18057e);_0x46adfa=[];_0x18057e[_0x5c87('0xa3')](function(_0x4723dd){var _0x39488b=createFieldObject(_0x22924d,_0x427706,_0x4723dd['internalType'],_0x4723dd[_0x5c87('0x26')],_0x4723dd['label'],!![]);_0x46adfa[_0x5c87('0xa6')](_0x39488b);});return Promise[_0x5c87('0xaa')](_0x46adfa);})[_0x5c87('0x21')](function(_0x263c93){_0x5ae4cf=_0x263c93;var _0x47f2b9=_0x30f5d4[_0x5c87('0xab')](_0x5ae4cf);return{'count':_0x47f2b9[_0x5c87('0x34')],'rows':_0x47f2b9};})[_0x5c87('0x21')](respondWithResult(_0x65e4fd,null))[_0x5c87('0x42')](function(_0x43377f){console[_0x5c87('0xa0')]('ServiceNow\x20error:\x20'+_0x43377f);var _0x121aee=_0x1603dd[_0x5c87('0x2f')][_0x5c87('0xac')]?0x1f4:_0x43377f[_0x5c87('0xad')]||0x1f4;logger[_0x5c87('0x24')](_0x43377f[_0x5c87('0x25')]);delete _0x43377f[_0x5c87('0x26')];if(_0x121aee===0x191){_0x121aee=0x190;}_0x65e4fd[_0x5c87('0x17')](_0x121aee)[_0x5c87('0x27')](_0x1603dd[_0x5c87('0x2f')][_0x5c87('0xac')]?{'message':_0x5c87('0xae'),'statusCode':_0x43377f[_0x5c87('0xad')]}:_0x43377f);});};function createFieldObject(_0x3f3c8b,_0x113f30,_0x252a60,_0x33216a,_0xa46bac,_0x1a0522){return new Promise(function(_0x4c4a5b,_0x3a7d56){var _0x1b2d8e={'id':_0x33216a,'name':_0xa46bac,'custom':_0x1a0522};if(_0x252a60==='boolean'){_0x1b2d8e[_0x5c87('0x45')]=[{'name':'True','value':_0x5c87('0xaf')},{'name':'False','value':_0x5c87('0xb0')}];_0x4c4a5b(_0x1b2d8e);}else{var _0x295344={'method':_0x5c87('0x9d'),'uri':_0x3f3c8b+'sys_choice?sysparm_query=name=incident^element='+_0x33216a,'auth':_0x113f30,'json':!![]};return rp(_0x295344)['then'](function(_0x33b099){var _0x34766e=[];if(_0x33b099['result']['length']>0x0){_0x33b099[_0x5c87('0x9f')][_0x5c87('0xa3')](function(_0x460938){if(_0x460938[_0x5c87('0xb1')]===_0x5c87('0xb0')){var _0x40e09c={'name':_0x460938[_0x5c87('0xa5')],'value':_0x460938[_0x5c87('0xb2')]};_0x34766e[_0x5c87('0xa6')](_0x40e09c);}});}_0x1b2d8e[_0x5c87('0x45')]=_0x34766e;if(_0x1b2d8e[_0x5c87('0x45')][_0x5c87('0x34')]>0x0){_0x4c4a5b(_0x1b2d8e);}else{if(_0x1a0522==![]){_0x4c4a5b();}else{_0x4c4a5b(_0x1b2d8e);}}});}});} \ No newline at end of file +var _0xe4ac=['username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','assign','includes','forEach','internalType','label','push','TCL:\x20_object','remove','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','send','index','map','ServicenowAccount','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','work_notes_list','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','location'];(function(_0x152375,_0x2e649e){var _0x56b6cd=function(_0x28cbe3){while(--_0x28cbe3){_0x152375['push'](_0x152375['shift']());}};_0x56b6cd(++_0x2e649e);}(_0xe4ac,0xe7));var _0xce4a=function(_0x311df2,_0x5b6291){_0x311df2=_0x311df2-0x0;var _0x2d70d7=_0xe4ac[_0x311df2];return _0x2d70d7;};'use strict';var emlformat=require(_0xce4a('0x0'));var rimraf=require(_0xce4a('0x1'));var zipdir=require(_0xce4a('0x2'));var jsonpatch=require(_0xce4a('0x3'));var rp=require(_0xce4a('0x4'));var moment=require('moment');var BPromise=require(_0xce4a('0x5'));var Mustache=require(_0xce4a('0x6'));var util=require(_0xce4a('0x7'));var path=require('path');var sox=require(_0xce4a('0x8'));var csv=require(_0xce4a('0x9'));var ejs=require(_0xce4a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce4a('0xb'));var squel=require(_0xce4a('0xc'));var crypto=require('crypto');var jsforce=require(_0xce4a('0xd'));var deskjs=require(_0xce4a('0xe'));var toCsv=require(_0xce4a('0x9'));var querystring=require(_0xce4a('0xf'));var Papa=require(_0xce4a('0x10'));var Redis=require(_0xce4a('0x11'));var authService=require(_0xce4a('0x12'));var qs=require(_0xce4a('0x13'));var as=require(_0xce4a('0x14'));var hardwareService=require(_0xce4a('0x15'));var logger=require(_0xce4a('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xce4a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xce4a('0x18'))['db'];var integrations=require(_0xce4a('0x19'));function respondWithStatusCode(_0x1e827a,_0x118768){_0x118768=_0x118768||0xcc;return function(_0x2a2f74){if(_0x2a2f74){return _0x1e827a['sendStatus'](_0x118768);}return _0x1e827a[_0xce4a('0x1a')](_0x118768)[_0xce4a('0x1b')]();};}function respondWithResult(_0x26d61d,_0x8c10e4){_0x8c10e4=_0x8c10e4||0xc8;return function(_0x2a6ce8){if(_0x2a6ce8){return _0x26d61d[_0xce4a('0x1a')](_0x8c10e4)[_0xce4a('0x1c')](_0x2a6ce8);}};}function respondWithFilteredResult(_0xedfe94,_0x545a12){return function(_0x10ff3d){if(_0x10ff3d){var _0x2911cc=typeof _0x545a12['offset']===_0xce4a('0x1d')&&typeof _0x545a12['limit']===_0xce4a('0x1d');var _0x31e368=_0x10ff3d[_0xce4a('0x1e')];var _0x277c96=_0x2911cc?0x0:_0x545a12['offset'];var _0x3c7cfe=_0x2911cc?_0x10ff3d[_0xce4a('0x1e')]:_0x545a12[_0xce4a('0x1f')]+_0x545a12[_0xce4a('0x20')];var _0x4e8ff6;if(_0x3c7cfe>=_0x31e368){_0x3c7cfe=_0x31e368;_0x4e8ff6=0xc8;}else{_0x4e8ff6=0xce;}_0xedfe94[_0xce4a('0x1a')](_0x4e8ff6);return _0xedfe94['set'](_0xce4a('0x21'),_0x277c96+'-'+_0x3c7cfe+'/'+_0x31e368)[_0xce4a('0x1c')](_0x10ff3d);}return null;};}function patchUpdates(_0xccdbb4){return function(_0x6abf21){try{jsonpatch[_0xce4a('0x22')](_0x6abf21,_0xccdbb4,!![]);}catch(_0x142f5d){return BPromise[_0xce4a('0x23')](_0x142f5d);}return _0x6abf21[_0xce4a('0x24')]();};}function saveUpdates(_0x2bc93e,_0x56114f){return function(_0x5bd710){if(_0x5bd710){return _0x5bd710[_0xce4a('0x25')](_0x2bc93e)[_0xce4a('0x26')](function(_0x245be1){return _0x245be1;});}return null;};}function removeEntity(_0x1f2152,_0x3028f1){return function(_0x6067e3){if(_0x6067e3){return _0x6067e3[_0xce4a('0x27')]()['then'](function(){_0x1f2152[_0xce4a('0x1a')](0xcc)[_0xce4a('0x1b')]();});}};}function handleEntityNotFound(_0x2daae9,_0x49a277){return function(_0x2d3187){if(!_0x2d3187){_0x2daae9[_0xce4a('0x28')](0x194);}return _0x2d3187;};}function handleError(_0x39ba9d,_0x37ad3b){_0x37ad3b=_0x37ad3b||0x1f4;return function(_0x2943f6){logger[_0xce4a('0x29')](_0x2943f6[_0xce4a('0x2a')]);if(_0x2943f6['name']){delete _0x2943f6['name'];}_0x39ba9d['status'](_0x37ad3b)[_0xce4a('0x2b')](_0x2943f6);};}exports[_0xce4a('0x2c')]=function(_0x5e1875,_0x229889){var _0x554a17={},_0x143fc6={},_0x161f87={'count':0x0,'rows':[]};var _0x49239f=_[_0xce4a('0x2d')](db[_0xce4a('0x2e')][_0xce4a('0x2f')],function(_0x573b95){return{'name':_0x573b95['fieldName'],'type':_0x573b95[_0xce4a('0x30')][_0xce4a('0x31')]};});_0x143fc6[_0xce4a('0x32')]=_[_0xce4a('0x2d')](_0x49239f,_0xce4a('0x33'));_0x143fc6[_0xce4a('0x34')]=_['keys'](_0x5e1875['query']);_0x143fc6[_0xce4a('0x35')]=_[_0xce4a('0x36')](_0x143fc6['model'],_0x143fc6[_0xce4a('0x34')]);_0x554a17['attributes']=_[_0xce4a('0x36')](_0x143fc6['model'],qs[_0xce4a('0x37')](_0x5e1875['query'][_0xce4a('0x37')]));_0x554a17[_0xce4a('0x38')]=_0x554a17[_0xce4a('0x38')][_0xce4a('0x39')]?_0x554a17[_0xce4a('0x38')]:_0x143fc6['model'];if(!_0x5e1875[_0xce4a('0x34')][_0xce4a('0x3a')](_0xce4a('0x3b'))){_0x554a17['limit']=qs['limit'](_0x5e1875[_0xce4a('0x34')][_0xce4a('0x20')]);_0x554a17['offset']=qs[_0xce4a('0x1f')](_0x5e1875[_0xce4a('0x34')]['offset']);}_0x554a17[_0xce4a('0x3c')]=qs['sort'](_0x5e1875[_0xce4a('0x34')][_0xce4a('0x3d')]);_0x554a17['where']=qs[_0xce4a('0x35')](_[_0xce4a('0x3e')](_0x5e1875[_0xce4a('0x34')],_0x143fc6[_0xce4a('0x35')]),_0x49239f);if(_0x5e1875[_0xce4a('0x34')][_0xce4a('0x3f')]){_0x554a17[_0xce4a('0x40')]=_[_0xce4a('0x41')](_0x554a17[_0xce4a('0x40')],{'$or':_[_0xce4a('0x2d')](_0x49239f,function(_0x490fef){if(_0x490fef[_0xce4a('0x30')]!==_0xce4a('0x42')){var _0x42eaa0={};_0x42eaa0[_0x490fef[_0xce4a('0x33')]]={'$like':'%'+_0x5e1875[_0xce4a('0x34')][_0xce4a('0x3f')]+'%'};return _0x42eaa0;}})});}_0x554a17=_[_0xce4a('0x41')]({},_0x554a17,_0x5e1875[_0xce4a('0x43')]);var _0x242294={'where':_0x554a17['where']};return db[_0xce4a('0x2e')][_0xce4a('0x1e')](_0x242294)[_0xce4a('0x26')](function(_0x4e9edb){_0x161f87['count']=_0x4e9edb;if(_0x5e1875[_0xce4a('0x34')][_0xce4a('0x44')]){_0x554a17[_0xce4a('0x45')]=[{'all':!![]}];}return db[_0xce4a('0x2e')][_0xce4a('0x46')](_0x554a17);})[_0xce4a('0x26')](function(_0x5cbda9){_0x161f87[_0xce4a('0x47')]=_0x5cbda9;return _0x161f87;})[_0xce4a('0x26')](respondWithFilteredResult(_0x229889,_0x554a17))[_0xce4a('0x48')](handleError(_0x229889,null));};exports[_0xce4a('0x49')]=function(_0x31ed2c,_0x42664e){var _0x1bacae={'raw':![],'where':{'id':_0x31ed2c['params']['id']}},_0xd6cf61={};_0xd6cf61[_0xce4a('0x32')]=_[_0xce4a('0x4a')](db[_0xce4a('0x2e')][_0xce4a('0x2f')]);_0xd6cf61['query']=_[_0xce4a('0x4a')](_0x31ed2c[_0xce4a('0x34')]);_0xd6cf61['filters']=_[_0xce4a('0x36')](_0xd6cf61[_0xce4a('0x32')],_0xd6cf61[_0xce4a('0x34')]);_0x1bacae['attributes']=_[_0xce4a('0x36')](_0xd6cf61[_0xce4a('0x32')],qs[_0xce4a('0x37')](_0x31ed2c[_0xce4a('0x34')]['fields']));_0x1bacae[_0xce4a('0x38')]=_0x1bacae[_0xce4a('0x38')][_0xce4a('0x39')]?_0x1bacae[_0xce4a('0x38')]:_0xd6cf61[_0xce4a('0x32')];if(_0x31ed2c['query'][_0xce4a('0x44')]){_0x1bacae['include']=[{'all':!![]}];}_0x1bacae=_[_0xce4a('0x41')]({},_0x1bacae,_0x31ed2c[_0xce4a('0x43')]);return db[_0xce4a('0x2e')][_0xce4a('0x4b')](_0x1bacae)[_0xce4a('0x26')](handleEntityNotFound(_0x42664e,null))['then'](respondWithResult(_0x42664e,null))['catch'](handleError(_0x42664e,null));};exports[_0xce4a('0x4c')]=function(_0x137e0e,_0x2ccb17){return db['ServicenowAccount'][_0xce4a('0x4c')](_0x137e0e[_0xce4a('0x4d')],{})['then'](respondWithResult(_0x2ccb17,0xc9))[_0xce4a('0x48')](handleError(_0x2ccb17,null));};exports[_0xce4a('0x25')]=function(_0x4ee3c3,_0x261c59){if(_0x4ee3c3['body']['id']){delete _0x4ee3c3['body']['id'];}return db[_0xce4a('0x2e')][_0xce4a('0x4b')]({'where':{'id':_0x4ee3c3[_0xce4a('0x4e')]['id']}})[_0xce4a('0x26')](handleEntityNotFound(_0x261c59,null))[_0xce4a('0x26')](saveUpdates(_0x4ee3c3[_0xce4a('0x4d')],null))[_0xce4a('0x26')](respondWithResult(_0x261c59,null))[_0xce4a('0x48')](handleError(_0x261c59,null));};exports[_0xce4a('0x27')]=function(_0x1002fa,_0x2317c2){return db[_0xce4a('0x2e')]['find']({'where':{'id':_0x1002fa[_0xce4a('0x4e')]['id']}})[_0xce4a('0x26')](handleEntityNotFound(_0x2317c2,null))['then'](removeEntity(_0x2317c2,null))[_0xce4a('0x48')](handleError(_0x2317c2,null));};exports[_0xce4a('0x4f')]=function(_0x220689,_0x281825,_0x5947e2){var _0x9c6aed={};var _0x4be2a3={};var _0x29aa74;var _0x161eac;return db[_0xce4a('0x2e')][_0xce4a('0x50')]({'where':{'id':_0x220689[_0xce4a('0x4e')]['id']}})[_0xce4a('0x26')](handleEntityNotFound(_0x281825,null))[_0xce4a('0x26')](function(_0xe03d5f){if(_0xe03d5f){_0x29aa74=_0xe03d5f;_0x4be2a3[_0xce4a('0x32')]=_[_0xce4a('0x4a')](db['ServicenowConfiguration']['rawAttributes']);_0x4be2a3[_0xce4a('0x34')]=_[_0xce4a('0x4a')](_0x220689['query']);_0x4be2a3[_0xce4a('0x35')]=_[_0xce4a('0x36')](_0x4be2a3['model'],_0x4be2a3['query']);_0x9c6aed['attributes']=_[_0xce4a('0x36')](_0x4be2a3[_0xce4a('0x32')],qs[_0xce4a('0x37')](_0x220689[_0xce4a('0x34')][_0xce4a('0x37')]));_0x9c6aed[_0xce4a('0x38')]=_0x9c6aed['attributes'][_0xce4a('0x39')]?_0x9c6aed[_0xce4a('0x38')]:_0x4be2a3[_0xce4a('0x32')];_0x9c6aed[_0xce4a('0x3c')]=qs['sort'](_0x220689[_0xce4a('0x34')]['sort']);_0x9c6aed[_0xce4a('0x40')]=qs[_0xce4a('0x35')](_['pick'](_0x220689[_0xce4a('0x34')],_0x4be2a3[_0xce4a('0x35')]));if(_0x220689[_0xce4a('0x34')][_0xce4a('0x3f')]){_0x9c6aed['where']=_['merge'](_0x9c6aed[_0xce4a('0x40')],{'$or':_[_0xce4a('0x2d')](_0x9c6aed[_0xce4a('0x38')],function(_0x48c170){var _0xdd124e={};_0xdd124e[_0x48c170]={'$like':'%'+_0x220689[_0xce4a('0x34')][_0xce4a('0x3f')]+'%'};return _0xdd124e;})});}_0x9c6aed=_[_0xce4a('0x41')]({},_0x9c6aed,_0x220689[_0xce4a('0x43')]);return _0x29aa74['getConfigurations'](_0x9c6aed);}})[_0xce4a('0x26')](function(_0x208ba1){if(_0x208ba1){_0x161eac=_0x208ba1[_0xce4a('0x39')];if(!_0x220689[_0xce4a('0x34')][_0xce4a('0x3a')](_0xce4a('0x3b'))){_0x9c6aed[_0xce4a('0x20')]=qs[_0xce4a('0x20')](_0x220689[_0xce4a('0x34')][_0xce4a('0x20')]);_0x9c6aed[_0xce4a('0x1f')]=qs['offset'](_0x220689['query'][_0xce4a('0x1f')]);}return _0x29aa74[_0xce4a('0x4f')](_0x9c6aed);}})[_0xce4a('0x26')](function(_0xabf965){if(_0xabf965){return _0xabf965?{'count':_0x161eac,'rows':_0xabf965}:null;}})['then'](respondWithResult(_0x281825,null))['catch'](handleError(_0x281825,null));};exports[_0xce4a('0x51')]=function(_0xd95b1f,_0x22611e,_0x1e40d0){if(_0xd95b1f[_0xce4a('0x4d')]['id']){delete _0xd95b1f[_0xce4a('0x4d')]['id'];}return db[_0xce4a('0x2e')][_0xce4a('0x50')]({'where':{'id':_0xd95b1f['params']['id']}})[_0xce4a('0x26')](handleEntityNotFound(_0x22611e,null))[_0xce4a('0x26')](function(_0x146002){if(_0x146002){_0xd95b1f['body'][_0xce4a('0x52')]=_0x146002['id'];_0xd95b1f[_0xce4a('0x4d')][_0xce4a('0x53')]=integrations[_0xce4a('0x54')](_0xd95b1f[_0xce4a('0x4d')][_0xce4a('0x55')],_0xd95b1f[_0xce4a('0x4d')]['type']);_0xd95b1f[_0xce4a('0x4d')][_0xce4a('0x56')]=integrations[_0xce4a('0x57')](_0xd95b1f[_0xce4a('0x4d')]['channel'],_0xd95b1f[_0xce4a('0x4d')][_0xce4a('0x30')]);return db[_0xce4a('0x58')][_0xce4a('0x4c')](_0xd95b1f[_0xce4a('0x4d')],{'include':[{'model':db[_0xce4a('0x59')],'as':'Subjects'},{'model':db[_0xce4a('0x59')],'as':_0xce4a('0x56')}]});}return null;})['then'](respondWithResult(_0x22611e,null))[_0xce4a('0x48')](handleError(_0x22611e,null));};exports[_0xce4a('0x5a')]=function(_0x5a92a0,_0x120192,_0x5bfb90){var _0x5ed46e=[_0xce4a('0x5b'),_0xce4a('0x5c'),_0xce4a('0x5d'),'subcategory','close_code',_0xce4a('0x5e'),_0xce4a('0x5f'),_0xce4a('0x60'),_0xce4a('0x61')];var _0x5e4637=[_0xce4a('0x62'),_0xce4a('0x5b'),_0xce4a('0x63'),_0xce4a('0x64'),'upon_reject',_0xce4a('0x65'),'child_incidents',_0xce4a('0x5c'),_0xce4a('0x66'),_0xce4a('0x67'),_0xce4a('0x68'),_0xce4a('0x69'),_0xce4a('0x6a'),_0xce4a('0x6b'),_0xce4a('0x6c'),'sys_domain',_0xce4a('0x6d'),_0xce4a('0x6e'),_0xce4a('0x5d'),_0xce4a('0x3c'),_0xce4a('0x6f'),_0xce4a('0x70'),'cmdb_ci',_0xce4a('0x71'),_0xce4a('0x72'),'active',_0xce4a('0x73'),'business_service',_0xce4a('0x74'),_0xce4a('0x75'),'rfc',_0xce4a('0x76'),_0xce4a('0x77'),_0xce4a('0x78'),_0xce4a('0x79'),_0xce4a('0x7a'),_0xce4a('0x7b'),_0xce4a('0x7c'),_0xce4a('0x7d'),_0xce4a('0x7e'),_0xce4a('0x7f'),'subcategory','work_notes',_0xce4a('0x80'),_0xce4a('0x81'),_0xce4a('0x82'),_0xce4a('0x83'),_0xce4a('0x84'),_0xce4a('0x85'),'business_stc',_0xce4a('0x86'),_0xce4a('0x87'),'calendar_duration','notify',_0xce4a('0x88'),_0xce4a('0x89'),_0xce4a('0x8a'),'follow_up',_0xce4a('0x8b'),_0xce4a('0x8c'),_0xce4a('0x8d'),_0xce4a('0x8e'),_0xce4a('0x5f'),_0xce4a('0x8f'),_0xce4a('0x90'),_0xce4a('0x91'),'reassignment_count',_0xce4a('0x92'),_0xce4a('0x93'),_0xce4a('0x60'),_0xce4a('0x94'),_0xce4a('0x95'),_0xce4a('0x96'),_0xce4a('0x97'),_0xce4a('0x98'),_0xce4a('0x99'),_0xce4a('0x9a'),'sys_tags',_0xce4a('0x9b'),_0xce4a('0x9c'),_0xce4a('0x9d'),_0xce4a('0x9e'),_0xce4a('0x61')];var _0x5d03d9='';var _0x5e25b7='';var _0x1dd326=[];var _0x12823c='';var _0x1cf32c='';var _0x4949f4=[];var _0x26a440='';var _0x4d0cf8='';var _0x405df0={};var _0x571ed0='';return db[_0xce4a('0x2e')][_0xce4a('0x50')]({'where':{'id':_0x5a92a0[_0xce4a('0x4e')]['id']},'attributes':['id',_0xce4a('0x9f'),_0xce4a('0xa0'),_0xce4a('0xa1'),_0xce4a('0xa2'),_0xce4a('0xa3')]})[_0xce4a('0x26')](handleEntityNotFound(_0x120192,null))[_0xce4a('0x26')](function(_0x407c65){if(_0x407c65){_0x571ed0=_0x407c65['remoteUri'];var _0x57ac37=_0x571ed0[_0xce4a('0xa4')](-0x1);if(_0x57ac37==='/'){_0x571ed0=_0x571ed0[_0xce4a('0xa5')](0x0,_0x571ed0[_0xce4a('0xa6')](_0x57ac37));}_0x4d0cf8=util[_0xce4a('0xa7')]('%s/api/now/doc/table/schema/',_0x571ed0);_0x26a440=util[_0xce4a('0xa7')](_0xce4a('0xa8'),_0x571ed0);_0x405df0={'user':_0x407c65[_0xce4a('0x9f')],'pass':_0x407c65['password']};var _0x367df1={'method':_0xce4a('0xa9'),'uri':_0x4d0cf8+_0xce4a('0xaa'),'auth':_0x405df0,'json':!![]};return rp(_0x367df1);}})[_0xce4a('0x26')](function(_0x5627b3){if(_0x5627b3['result']['length']>0x0){_0x5d03d9=_0x5627b3[_0xce4a('0xab')];}console['log']('incident\x20table\x20objects',_0x5d03d9);_0x4949f4=[];_0x5e25b7=Object[_0xce4a('0xac')]([],_0x5d03d9);_['remove'](_0x5e25b7,function(_0x3ba99e){return!_0x5ed46e[_0xce4a('0xad')](_0x3ba99e[_0xce4a('0x33')]);});_0x5e25b7[_0xce4a('0xae')](function(_0x1a5b7f){var _0x5d7ac6=createFieldObject(_0x26a440,_0x405df0,_0x1a5b7f[_0xce4a('0xaf')],_0x1a5b7f['name'],_0x1a5b7f[_0xce4a('0xb0')],![]);_0x4949f4[_0xce4a('0xb1')](_0x5d7ac6);});return Promise['all'](_0x4949f4);})['then'](function(_0xe75f4e){_0x1dd326=_0xe75f4e;_0x12823c=Object['assign']([],_0x5d03d9);console['log'](_0xce4a('0xb2'),_0x5d03d9);_[_0xce4a('0xb3')](_0x12823c,function(_0x5aa797){return _0x5e4637['includes'](_0x5aa797[_0xce4a('0x33')]);});console[_0xce4a('0xb4')](_0xce4a('0xb5'),_0x12823c);_0x4949f4=[];_0x12823c['forEach'](function(_0x13a207){var _0x252e7e=createFieldObject(_0x26a440,_0x405df0,_0x13a207[_0xce4a('0xaf')],_0x13a207[_0xce4a('0x33')],_0x13a207[_0xce4a('0xb0')],!![]);_0x4949f4[_0xce4a('0xb1')](_0x252e7e);});return Promise[_0xce4a('0xb6')](_0x4949f4);})['then'](function(_0x392dc8){_0x1cf32c=_0x392dc8;var _0xabe50b=_0x1dd326[_0xce4a('0xb7')](_0x1cf32c);return{'count':_0xabe50b[_0xce4a('0x39')],'rows':_0xabe50b};})[_0xce4a('0x26')](respondWithResult(_0x120192,null))[_0xce4a('0x48')](function(_0x31257c){console[_0xce4a('0xb4')](_0xce4a('0xb8')+_0x31257c);var _0x4dab35=_0x5a92a0[_0xce4a('0x34')]['test']?0x1f4:_0x31257c[_0xce4a('0xb9')]||0x1f4;logger[_0xce4a('0x29')](_0x31257c[_0xce4a('0x2a')]);delete _0x31257c[_0xce4a('0x33')];if(_0x4dab35===0x191){_0x4dab35=0x190;}_0x120192['status'](_0x4dab35)[_0xce4a('0x2b')](_0x5a92a0['query'][_0xce4a('0xba')]?{'message':_0xce4a('0xbb'),'statusCode':_0x31257c[_0xce4a('0xb9')]}:_0x31257c);});};function createFieldObject(_0x3cbf6b,_0x2d7445,_0x2677a7,_0x39cacb,_0x573af5,_0x4ecb59){return new Promise(function(_0x531538,_0x6cfc1f){var _0x1ecdbb={'id':_0x39cacb,'name':_0x573af5,'custom':_0x4ecb59};if(_0x2677a7===_0xce4a('0xbc')){_0x1ecdbb['options']=[{'name':_0xce4a('0xbd'),'value':_0xce4a('0xbe')},{'name':'False','value':_0xce4a('0xbf')}];_0x531538(_0x1ecdbb);}else{var _0x405548={'method':'GET','uri':_0x3cbf6b+_0xce4a('0xc0')+_0x39cacb,'auth':_0x2d7445,'json':!![]};return rp(_0x405548)[_0xce4a('0x26')](function(_0x85b2dc){var _0x18d77a=[];if(_0x85b2dc['result'][_0xce4a('0x39')]>0x0){_0x85b2dc[_0xce4a('0xab')][_0xce4a('0xae')](function(_0x18919f){if(_0x18919f[_0xce4a('0xc1')]===_0xce4a('0xbf')){var _0x421a53={'name':_0x18919f['label'],'value':_0x18919f[_0xce4a('0xc2')]};_0x18d77a[_0xce4a('0xb1')](_0x421a53);}});}_0x1ecdbb[_0xce4a('0x43')]=_0x18d77a;if(_0x1ecdbb[_0xce4a('0x43')][_0xce4a('0x39')]>0x0){_0x531538(_0x1ecdbb);}else{if(_0x4ecb59==![]){_0x531538();}else{_0x531538(_0x1ecdbb);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 562752f..719fd82 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 _0x8958=['exports','define','ServicenowAccount','util','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x242884,_0x657442){var _0x1586c2=function(_0x21dc71){while(--_0x21dc71){_0x242884['push'](_0x242884['shift']());}};_0x1586c2(++_0x657442);}(_0x8958,0x93));var _0x8895=function(_0x53f3b3,_0x2bd615){_0x53f3b3=_0x53f3b3-0x0;var _0x16c538=_0x8958[_0x53f3b3];return _0x16c538;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x8895('0x5')]=function(_0x2f03ad,_0x124e1e){return _0x2f03ad[_0x8895('0x6')](_0x8895('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes'];(function(_0x23d706,_0x12b65b){var _0x66611c=function(_0x1b2192){while(--_0x1b2192){_0x23d706['push'](_0x23d706['shift']());}};_0x66611c(++_0x12b65b);}(_0x187d,0x93));var _0xd187=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x187d[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index e3aae37..21f725f 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 _0x1bd8=['options','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0x1603aa,_0x4bb864){var _0x427b41=function(_0x59aecf){while(--_0x59aecf){_0x1603aa['push'](_0x1603aa['shift']());}};_0x427b41(++_0x4bb864);}(_0x1bd8,0x1e5));var _0x81bd=function(_0x168ebf,_0x4aae5b){_0x168ebf=_0x168ebf-0x0;var _0x1d2826=_0x1bd8[_0x168ebf];return _0x1d2826;};'use strict';var _=require(_0x81bd('0x0'));var util=require('util');var moment=require(_0x81bd('0x1'));var BPromise=require(_0x81bd('0x2'));var rs=require(_0x81bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81bd('0x4'))['db'];var utils=require(_0x81bd('0x5'));var logger=require(_0x81bd('0x6'))(_0x81bd('0x7'));var config=require(_0x81bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x81bd('0x9')][_0x81bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465cc7,_0x277422,_0x32f85b){return new BPromise(function(_0x55e8c6,_0x5aaca3){return client[_0x81bd('0xb')](_0x465cc7,_0x32f85b)[_0x81bd('0xc')](function(_0x1d9173){logger['info'](_0x81bd('0xd'),_0x277422,_0x81bd('0xe'));logger[_0x81bd('0xf')](_0x81bd('0x10'),_0x277422,_0x81bd('0xe'),JSON[_0x81bd('0x11')](_0x1d9173));if(_0x1d9173[_0x81bd('0x12')]){if(_0x1d9173[_0x81bd('0x12')]['code']===0x1f4){logger[_0x81bd('0x12')](_0x81bd('0xd'),_0x277422,_0x1d9173[_0x81bd('0x12')][_0x81bd('0x13')]);return _0x5aaca3(_0x1d9173['error'][_0x81bd('0x13')]);}logger[_0x81bd('0x12')](_0x81bd('0xd'),_0x277422,_0x1d9173[_0x81bd('0x12')][_0x81bd('0x13')]);return _0x55e8c6(_0x1d9173[_0x81bd('0x12')][_0x81bd('0x13')]);}else{logger[_0x81bd('0x14')](_0x81bd('0xd'),_0x277422,_0x81bd('0xe'));_0x55e8c6(_0x1d9173['result'][_0x81bd('0x13')]);}})[_0x81bd('0x15')](function(_0x255428){logger[_0x81bd('0x12')](_0x81bd('0xd'),_0x277422,_0x255428);_0x5aaca3(_0x255428);});});}exports[_0x81bd('0x16')]=function(_0x54874c){var _0xb6235=this;return new Promise(function(_0x3e4cb6,_0x200386){return db[_0x81bd('0x17')][_0x81bd('0x18')]({'raw':_0x54874c[_0x81bd('0x19')]?_0x54874c['options']['raw']===undefined?!![]:![]:!![],'where':_0x54874c[_0x81bd('0x19')]?_0x54874c[_0x81bd('0x19')][_0x81bd('0x1a')]||null:null,'attributes':_0x54874c['options']?_0x54874c[_0x81bd('0x19')][_0x81bd('0x1b')]||null:null,'limit':_0x54874c[_0x81bd('0x19')]?_0x54874c[_0x81bd('0x19')][_0x81bd('0x1c')]||null:null,'include':_0x54874c[_0x81bd('0x19')]?_0x54874c['options'][_0x81bd('0x1d')]?_[_0x81bd('0x1e')](_0x54874c[_0x81bd('0x19')][_0x81bd('0x1d')],function(_0x51ea41){return{'model':db[_0x51ea41[_0x81bd('0x1f')]],'as':_0x51ea41['as'],'attributes':_0x51ea41[_0x81bd('0x1b')],'include':_0x51ea41['include']?_[_0x81bd('0x1e')](_0x51ea41[_0x81bd('0x1d')],function(_0x4d246d){return{'model':db[_0x4d246d[_0x81bd('0x1f')]],'as':_0x4d246d['as'],'attributes':_0x4d246d[_0x81bd('0x1b')],'include':_0x4d246d[_0x81bd('0x1d')]?_[_0x81bd('0x1e')](_0x4d246d['include'],function(_0x327d44){return{'model':db[_0x327d44['model']],'as':_0x327d44['as'],'attributes':_0x327d44[_0x81bd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x81bd('0xc')](function(_0x56325f){logger[_0x81bd('0x14')](_0x81bd('0x16'),_0x54874c);logger['debug'](_0x81bd('0x16'),_0x54874c,JSON[_0x81bd('0x11')](_0x56325f));_0x3e4cb6(_0x56325f);})[_0x81bd('0x15')](function(_0x4de4c4){logger[_0x81bd('0x12')](_0x81bd('0x16'),_0x4de4c4['message'],_0x54874c);_0x200386(_0xb6235[_0x81bd('0x12')](0x1f4,_0x4de4c4['message']));});});};exports[_0x81bd('0x20')]=function(_0x414c6f){var _0x345420=this;return new Promise(function(_0x4ca15e,_0x3182e8){return db[_0x81bd('0x17')][_0x81bd('0x21')]({'raw':_0x414c6f[_0x81bd('0x19')]?_0x414c6f['options']['raw']===undefined?!![]:![]:!![],'where':_0x414c6f[_0x81bd('0x19')]?_0x414c6f['options'][_0x81bd('0x1a')]||null:null,'attributes':_0x414c6f[_0x81bd('0x19')]?_0x414c6f[_0x81bd('0x19')][_0x81bd('0x1b')]||null:null,'include':_0x414c6f['options']?_0x414c6f[_0x81bd('0x19')][_0x81bd('0x1d')]?_[_0x81bd('0x1e')](_0x414c6f[_0x81bd('0x19')][_0x81bd('0x1d')],function(_0x5ad202){return{'model':db[_0x5ad202['model']],'as':_0x5ad202['as'],'attributes':_0x5ad202['attributes'],'include':_0x5ad202['include']?_['map'](_0x5ad202[_0x81bd('0x1d')],function(_0x1a01a6){return{'model':db[_0x1a01a6[_0x81bd('0x1f')]],'as':_0x1a01a6['as'],'attributes':_0x1a01a6[_0x81bd('0x1b')],'include':_0x1a01a6['include']?_[_0x81bd('0x1e')](_0x1a01a6[_0x81bd('0x1d')],function(_0xc9e76f){return{'model':db[_0xc9e76f[_0x81bd('0x1f')]],'as':_0xc9e76f['as'],'attributes':_0xc9e76f[_0x81bd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x81bd('0xc')](function(_0x4ff6e7){logger[_0x81bd('0x14')](_0x81bd('0x20'),_0x414c6f);logger['debug'](_0x81bd('0x20'),_0x414c6f,JSON[_0x81bd('0x11')](_0x4ff6e7));_0x4ca15e(_0x4ff6e7);})['catch'](function(_0x42f129){logger[_0x81bd('0x12')](_0x81bd('0x20'),_0x42f129[_0x81bd('0x13')],_0x414c6f);_0x3182e8(_0x345420[_0x81bd('0x12')](0x1f4,_0x42f129[_0x81bd('0x13')]));});});}; \ No newline at end of file +var _0x869e=['error','message','catch','GetServicenowAccount','options','raw','where','attributes','limit','include','model','then','debug','stringify','ShowServicenowAccount','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x869e,0x131));var _0xe869=function(_0x26ce33,_0x2b0d0b){_0x26ce33=_0x26ce33-0x0;var _0x54a7d4=_0x869e[_0x26ce33];return _0x54a7d4;};'use strict';var _=require(_0xe869('0x0'));var util=require(_0xe869('0x1'));var moment=require(_0xe869('0x2'));var BPromise=require(_0xe869('0x3'));var rs=require(_0xe869('0x4'));var fs=require('fs');var Redis=require(_0xe869('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe869('0x6'))(_0xe869('0x7'));var config=require(_0xe869('0x8'));var jayson=require(_0xe869('0x9'));var client=jayson[_0xe869('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f4d8e,_0x3c7384,_0x46a8f1){return new BPromise(function(_0x4dcba7,_0x1711d1){return client[_0xe869('0xb')](_0x2f4d8e,_0x46a8f1)['then'](function(_0x5b5247){logger[_0xe869('0xc')](_0xe869('0xd'),_0x3c7384,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3c7384,_0xe869('0xe'),JSON['stringify'](_0x5b5247));if(_0x5b5247[_0xe869('0xf')]){if(_0x5b5247[_0xe869('0xf')]['code']===0x1f4){logger[_0xe869('0xf')](_0xe869('0xd'),_0x3c7384,_0x5b5247[_0xe869('0xf')]['message']);return _0x1711d1(_0x5b5247[_0xe869('0xf')][_0xe869('0x10')]);}logger['error'](_0xe869('0xd'),_0x3c7384,_0x5b5247['error'][_0xe869('0x10')]);return _0x4dcba7(_0x5b5247[_0xe869('0xf')][_0xe869('0x10')]);}else{logger[_0xe869('0xc')](_0xe869('0xd'),_0x3c7384,_0xe869('0xe'));_0x4dcba7(_0x5b5247['result'][_0xe869('0x10')]);}})[_0xe869('0x11')](function(_0xb41d8f){logger['error'](_0xe869('0xd'),_0x3c7384,_0xb41d8f);_0x1711d1(_0xb41d8f);});});}exports[_0xe869('0x12')]=function(_0x12c300){var _0x5583e5=this;return new Promise(function(_0x5e3d0f,_0x57cae3){return db['ServicenowAccount']['findAll']({'raw':_0x12c300[_0xe869('0x13')]?_0x12c300[_0xe869('0x13')][_0xe869('0x14')]===undefined?!![]:![]:!![],'where':_0x12c300[_0xe869('0x13')]?_0x12c300[_0xe869('0x13')][_0xe869('0x15')]||null:null,'attributes':_0x12c300[_0xe869('0x13')]?_0x12c300[_0xe869('0x13')][_0xe869('0x16')]||null:null,'limit':_0x12c300[_0xe869('0x13')]?_0x12c300[_0xe869('0x13')][_0xe869('0x17')]||null:null,'include':_0x12c300[_0xe869('0x13')]?_0x12c300['options'][_0xe869('0x18')]?_['map'](_0x12c300['options'][_0xe869('0x18')],function(_0x4eb2cf){return{'model':db[_0x4eb2cf[_0xe869('0x19')]],'as':_0x4eb2cf['as'],'attributes':_0x4eb2cf[_0xe869('0x16')],'include':_0x4eb2cf[_0xe869('0x18')]?_['map'](_0x4eb2cf[_0xe869('0x18')],function(_0x8d87b6){return{'model':db[_0x8d87b6['model']],'as':_0x8d87b6['as'],'attributes':_0x8d87b6['attributes'],'include':_0x8d87b6[_0xe869('0x18')]?_['map'](_0x8d87b6[_0xe869('0x18')],function(_0x136ba9){return{'model':db[_0x136ba9['model']],'as':_0x136ba9['as'],'attributes':_0x136ba9[_0xe869('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe869('0x1a')](function(_0x54f3e5){logger[_0xe869('0xc')](_0xe869('0x12'),_0x12c300);logger[_0xe869('0x1b')]('GetServicenowAccount',_0x12c300,JSON[_0xe869('0x1c')](_0x54f3e5));_0x5e3d0f(_0x54f3e5);})[_0xe869('0x11')](function(_0x276dfe){logger['error'](_0xe869('0x12'),_0x276dfe['message'],_0x12c300);_0x57cae3(_0x5583e5[_0xe869('0xf')](0x1f4,_0x276dfe[_0xe869('0x10')]));});});};exports[_0xe869('0x1d')]=function(_0x18fc7b){var _0x4a099c=this;return new Promise(function(_0x3ab53d,_0x3aa459){return db['ServicenowAccount'][_0xe869('0x1e')]({'raw':_0x18fc7b[_0xe869('0x13')]?_0x18fc7b[_0xe869('0x13')][_0xe869('0x14')]===undefined?!![]:![]:!![],'where':_0x18fc7b[_0xe869('0x13')]?_0x18fc7b[_0xe869('0x13')][_0xe869('0x15')]||null:null,'attributes':_0x18fc7b[_0xe869('0x13')]?_0x18fc7b[_0xe869('0x13')][_0xe869('0x16')]||null:null,'include':_0x18fc7b[_0xe869('0x13')]?_0x18fc7b[_0xe869('0x13')]['include']?_[_0xe869('0x1f')](_0x18fc7b['options'][_0xe869('0x18')],function(_0x2dd369){return{'model':db[_0x2dd369[_0xe869('0x19')]],'as':_0x2dd369['as'],'attributes':_0x2dd369[_0xe869('0x16')],'include':_0x2dd369[_0xe869('0x18')]?_[_0xe869('0x1f')](_0x2dd369[_0xe869('0x18')],function(_0x16aaf8){return{'model':db[_0x16aaf8[_0xe869('0x19')]],'as':_0x16aaf8['as'],'attributes':_0x16aaf8[_0xe869('0x16')],'include':_0x16aaf8[_0xe869('0x18')]?_[_0xe869('0x1f')](_0x16aaf8[_0xe869('0x18')],function(_0x518bb7){return{'model':db[_0x518bb7['model']],'as':_0x518bb7['as'],'attributes':_0x518bb7[_0xe869('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3895fe){logger[_0xe869('0xc')]('ShowServicenowAccount',_0x18fc7b);logger[_0xe869('0x1b')](_0xe869('0x1d'),_0x18fc7b,JSON[_0xe869('0x1c')](_0x3895fe));_0x3ab53d(_0x3895fe);})[_0xe869('0x11')](function(_0x312c47){logger[_0xe869('0xf')](_0xe869('0x1d'),_0x312c47['message'],_0x18fc7b);_0x3aa459(_0x4a099c['error'](0x1f4,_0x312c47[_0xe869('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 45aad4b..4c1c04d 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 _0x5f0a=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','update','delete','/:id'];(function(_0x4c085f,_0x2dc7c5){var _0x1f9d13=function(_0x38343b){while(--_0x38343b){_0x4c085f['push'](_0x4c085f['shift']());}};_0x1f9d13(++_0x2dc7c5);}(_0x5f0a,0xe3));var _0xa5f0=function(_0x1f153f,_0x4ddd5f){_0x1f153f=_0x1f153f-0x0;var _0x46b29e=_0x5f0a[_0x1f153f];return _0x46b29e;};'use strict';var multer=require(_0xa5f0('0x0'));var util=require(_0xa5f0('0x1'));var path=require(_0xa5f0('0x2'));var timeout=require(_0xa5f0('0x3'));var express=require('express');var router=express[_0xa5f0('0x4')]();var fs_extra=require(_0xa5f0('0x5'));var auth=require(_0xa5f0('0x6'));var interaction=require(_0xa5f0('0x7'));var config=require(_0xa5f0('0x8'));var controller=require(_0xa5f0('0x9'));router[_0xa5f0('0xa')]('/',auth[_0xa5f0('0xb')](),controller['index']);router[_0xa5f0('0xa')]('/:id',auth[_0xa5f0('0xb')](),controller[_0xa5f0('0xc')]);router['get'](_0xa5f0('0xd'),auth[_0xa5f0('0xb')](),controller[_0xa5f0('0xe')]);router[_0xa5f0('0xa')]('/:id/subjects',auth[_0xa5f0('0xb')](),controller[_0xa5f0('0xf')]);router[_0xa5f0('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa5f0('0x10')]);router[_0xa5f0('0x11')]('/',auth['isAuthenticated'](),controller[_0xa5f0('0x12')]);router[_0xa5f0('0x13')]('/:id',auth[_0xa5f0('0xb')](),controller[_0xa5f0('0x14')]);router[_0xa5f0('0x15')](_0xa5f0('0x16'),auth[_0xa5f0('0xb')](),controller[_0xa5f0('0x17')]);module[_0xa5f0('0x18')]=router; \ No newline at end of file +var _0x44b0=['exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getDescriptions','create','put','destroy'];(function(_0x1662e6,_0x1dcf4d){var _0x290ae6=function(_0x531389){while(--_0x531389){_0x1662e6['push'](_0x1662e6['shift']());}};_0x290ae6(++_0x1dcf4d);}(_0x44b0,0xf8));var _0x044b=function(_0x36c1c7,_0x5ea729){_0x36c1c7=_0x36c1c7-0x0;var _0x52e6b8=_0x44b0[_0x36c1c7];return _0x52e6b8;};'use strict';var multer=require('multer');var util=require(_0x044b('0x0'));var path=require(_0x044b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x044b('0x2')]();var fs_extra=require(_0x044b('0x3'));var auth=require(_0x044b('0x4'));var interaction=require(_0x044b('0x5'));var config=require('../../config/environment');var controller=require(_0x044b('0x6'));router[_0x044b('0x7')]('/',auth[_0x044b('0x8')](),controller[_0x044b('0x9')]);router[_0x044b('0x7')](_0x044b('0xa'),auth[_0x044b('0x8')](),controller[_0x044b('0xb')]);router['get'](_0x044b('0xc'),auth[_0x044b('0x8')](),controller[_0x044b('0xd')]);router['get']('/:id/subjects',auth[_0x044b('0x8')](),controller['getSubjects']);router[_0x044b('0x7')]('/:id/descriptions',auth[_0x044b('0x8')](),controller[_0x044b('0xe')]);router['post']('/',auth[_0x044b('0x8')](),controller[_0x044b('0xf')]);router[_0x044b('0x10')]('/:id',auth[_0x044b('0x8')](),controller['update']);router['delete'](_0x044b('0xa'),auth['isAuthenticated'](),controller[_0x044b('0x11')]);module[_0x044b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 069cb27..c7705e4 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 _0x2f82=['exports','STRING','sequelize'];(function(_0x4d9f4a,_0x538b36){var _0x783fde=function(_0x210e72){while(--_0x210e72){_0x4d9f4a['push'](_0x4d9f4a['shift']());}};_0x783fde(++_0x538b36);}(_0x2f82,0x1eb));var _0x22f8=function(_0x275f4a,_0x2077d4){_0x275f4a=_0x275f4a-0x0;var _0x4b4a21=_0x2f82[_0x275f4a];return _0x4b4a21;};'use strict';var Sequelize=require(_0x22f8('0x0'));module[_0x22f8('0x1')]={'name':{'type':Sequelize[_0x22f8('0x2')]},'description':{'type':Sequelize[_0x22f8('0x2')]}}; \ No newline at end of file +var _0x65aa=['exports','STRING','sequelize'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x65aa,0x188));var _0xa65a=function(_0x3a0d41,_0x213679){_0x3a0d41=_0x3a0d41-0x0;var _0xd00982=_0x65aa[_0x3a0d41];return _0xd00982;};'use strict';var Sequelize=require(_0xa65a('0x0'));module[_0xa65a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa65a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4fd6928..1ef915c 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 _0x1fca=['hasOwnProperty','getSubjects','ServicenowConfiguration','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','getFields','findOne','ServicenowField'];(function(_0x133838,_0x5f19a7){var _0x3a5239=function(_0x3e177b){while(--_0x3e177b){_0x133838['push'](_0x133838['shift']());}};_0x3a5239(++_0x5f19a7);}(_0x1fca,0x155));var _0xa1fc=function(_0x5c6f37,_0x5251e2){_0x5c6f37=_0x5c6f37-0x0;var _0x489ad2=_0x1fca[_0x5c6f37];return _0x489ad2;};'use strict';var emlformat=require(_0xa1fc('0x0'));var rimraf=require(_0xa1fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1fc('0x2'));var rp=require(_0xa1fc('0x3'));var moment=require(_0xa1fc('0x4'));var BPromise=require(_0xa1fc('0x5'));var Mustache=require(_0xa1fc('0x6'));var util=require(_0xa1fc('0x7'));var path=require(_0xa1fc('0x8'));var sox=require(_0xa1fc('0x9'));var csv=require(_0xa1fc('0xa'));var ejs=require(_0xa1fc('0xb'));var fs=require('fs');var fs_extra=require(_0xa1fc('0xc'));var _=require(_0xa1fc('0xd'));var squel=require('squel');var crypto=require(_0xa1fc('0xe'));var jsforce=require(_0xa1fc('0xf'));var deskjs=require(_0xa1fc('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa1fc('0x11'));var Papa=require(_0xa1fc('0x12'));var Redis=require(_0xa1fc('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa1fc('0x14'));var as=require(_0xa1fc('0x15'));var hardwareService=require(_0xa1fc('0x16'));var logger=require(_0xa1fc('0x17'))(_0xa1fc('0x18'));var utils=require(_0xa1fc('0x19'));var config=require(_0xa1fc('0x1a'));var licenseUtil=require(_0xa1fc('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3fa6,_0xc08ea){_0xc08ea=_0xc08ea||0xcc;return function(_0x297c06){if(_0x297c06){return _0x5c3fa6[_0xa1fc('0x1c')](_0xc08ea);}return _0x5c3fa6['status'](_0xc08ea)['end']();};}function respondWithResult(_0x48bbb8,_0x2714b4){_0x2714b4=_0x2714b4||0xc8;return function(_0x2f7f32){if(_0x2f7f32){return _0x48bbb8[_0xa1fc('0x1d')](_0x2714b4)['json'](_0x2f7f32);}};}function respondWithFilteredResult(_0x451777,_0x35bd19){return function(_0x5563f1){if(_0x5563f1){var _0x5bf4fa=typeof _0x35bd19[_0xa1fc('0x1e')]==='undefined'&&typeof _0x35bd19[_0xa1fc('0x1f')]===_0xa1fc('0x20');var _0x2a69e2=_0x5563f1[_0xa1fc('0x21')];var _0x2dfcb5=_0x5bf4fa?0x0:_0x35bd19['offset'];var _0xd347d6=_0x5bf4fa?_0x5563f1[_0xa1fc('0x21')]:_0x35bd19[_0xa1fc('0x1e')]+_0x35bd19['limit'];var _0x45e4bd;if(_0xd347d6>=_0x2a69e2){_0xd347d6=_0x2a69e2;_0x45e4bd=0xc8;}else{_0x45e4bd=0xce;}_0x451777['status'](_0x45e4bd);return _0x451777['set'](_0xa1fc('0x22'),_0x2dfcb5+'-'+_0xd347d6+'/'+_0x2a69e2)[_0xa1fc('0x23')](_0x5563f1);}return null;};}function patchUpdates(_0xedebbe){return function(_0x13d67c){try{jsonpatch[_0xa1fc('0x24')](_0x13d67c,_0xedebbe,!![]);}catch(_0x4004f4){return BPromise['reject'](_0x4004f4);}return _0x13d67c[_0xa1fc('0x25')]();};}function saveUpdates(_0x8a98c8,_0xc61330){return function(_0x244e2e){if(_0x244e2e){return _0x244e2e[_0xa1fc('0x26')](_0x8a98c8)[_0xa1fc('0x27')](function(_0x2da6f4){return _0x2da6f4;});}return null;};}function removeEntity(_0x48086f,_0x1a6152){return function(_0x17f800){if(_0x17f800){return _0x17f800[_0xa1fc('0x28')]()[_0xa1fc('0x27')](function(){_0x48086f[_0xa1fc('0x1d')](0xcc)[_0xa1fc('0x29')]();});}};}function handleEntityNotFound(_0x144cbb,_0x119b5a){return function(_0x1ca957){if(!_0x1ca957){_0x144cbb[_0xa1fc('0x1c')](0x194);}return _0x1ca957;};}function handleError(_0x366f95,_0x2df86b){_0x2df86b=_0x2df86b||0x1f4;return function(_0x5b8791){logger[_0xa1fc('0x2a')](_0x5b8791[_0xa1fc('0x2b')]);if(_0x5b8791['name']){delete _0x5b8791[_0xa1fc('0x2c')];}_0x366f95[_0xa1fc('0x1d')](_0x2df86b)['send'](_0x5b8791);};}exports[_0xa1fc('0x2d')]=function(_0x3a532f,_0x1bff9c){var _0x1535de={},_0x41989c={},_0x5e831d={'count':0x0,'rows':[]};var _0x2b0c0a=_['map'](db['ServicenowConfiguration'][_0xa1fc('0x2e')],function(_0x216083){return{'name':_0x216083[_0xa1fc('0x2f')],'type':_0x216083[_0xa1fc('0x30')][_0xa1fc('0x31')]};});_0x41989c[_0xa1fc('0x32')]=_['map'](_0x2b0c0a,_0xa1fc('0x2c'));_0x41989c['query']=_[_0xa1fc('0x33')](_0x3a532f[_0xa1fc('0x34')]);_0x41989c[_0xa1fc('0x35')]=_[_0xa1fc('0x36')](_0x41989c[_0xa1fc('0x32')],_0x41989c[_0xa1fc('0x34')]);_0x1535de[_0xa1fc('0x37')]=_[_0xa1fc('0x36')](_0x41989c[_0xa1fc('0x32')],qs[_0xa1fc('0x38')](_0x3a532f[_0xa1fc('0x34')][_0xa1fc('0x38')]));_0x1535de[_0xa1fc('0x37')]=_0x1535de[_0xa1fc('0x37')][_0xa1fc('0x39')]?_0x1535de[_0xa1fc('0x37')]:_0x41989c[_0xa1fc('0x32')];if(!_0x3a532f[_0xa1fc('0x34')]['hasOwnProperty'](_0xa1fc('0x3a'))){_0x1535de[_0xa1fc('0x1f')]=qs[_0xa1fc('0x1f')](_0x3a532f[_0xa1fc('0x34')][_0xa1fc('0x1f')]);_0x1535de[_0xa1fc('0x1e')]=qs[_0xa1fc('0x1e')](_0x3a532f[_0xa1fc('0x34')]['offset']);}_0x1535de[_0xa1fc('0x3b')]=qs[_0xa1fc('0x3c')](_0x3a532f[_0xa1fc('0x34')][_0xa1fc('0x3c')]);_0x1535de[_0xa1fc('0x3d')]=qs[_0xa1fc('0x35')](_['pick'](_0x3a532f['query'],_0x41989c['filters']),_0x2b0c0a);if(_0x3a532f['query'][_0xa1fc('0x3e')]){_0x1535de[_0xa1fc('0x3d')]=_[_0xa1fc('0x3f')](_0x1535de['where'],{'$or':_[_0xa1fc('0x40')](_0x2b0c0a,function(_0x1d6bcd){if(_0x1d6bcd[_0xa1fc('0x30')]!==_0xa1fc('0x41')){var _0x2f02fb={};_0x2f02fb[_0x1d6bcd[_0xa1fc('0x2c')]]={'$like':'%'+_0x3a532f[_0xa1fc('0x34')][_0xa1fc('0x3e')]+'%'};return _0x2f02fb;}})});}_0x1535de=_[_0xa1fc('0x3f')]({},_0x1535de,_0x3a532f[_0xa1fc('0x42')]);var _0x18f4b4={'where':_0x1535de[_0xa1fc('0x3d')]};return db['ServicenowConfiguration'][_0xa1fc('0x21')](_0x18f4b4)[_0xa1fc('0x27')](function(_0x2163bd){_0x5e831d[_0xa1fc('0x21')]=_0x2163bd;if(_0x3a532f['query']['includeAll']){_0x1535de[_0xa1fc('0x43')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xa1fc('0x44')](_0x1535de);})['then'](function(_0x31cff1){_0x5e831d['rows']=_0x31cff1;return _0x5e831d;})[_0xa1fc('0x27')](respondWithFilteredResult(_0x1bff9c,_0x1535de))[_0xa1fc('0x45')](handleError(_0x1bff9c,null));};exports[_0xa1fc('0x46')]=function(_0x560736,_0x371c40){var _0x4dde19={'raw':![],'where':{'id':_0x560736[_0xa1fc('0x47')]['id']}},_0x1d6213={};_0x1d6213[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](db['ServicenowConfiguration'][_0xa1fc('0x2e')]);_0x1d6213['query']=_['keys'](_0x560736['query']);_0x1d6213[_0xa1fc('0x35')]=_[_0xa1fc('0x36')](_0x1d6213[_0xa1fc('0x32')],_0x1d6213[_0xa1fc('0x34')]);_0x4dde19['attributes']=_[_0xa1fc('0x36')](_0x1d6213[_0xa1fc('0x32')],qs[_0xa1fc('0x38')](_0x560736[_0xa1fc('0x34')][_0xa1fc('0x38')]));_0x4dde19[_0xa1fc('0x37')]=_0x4dde19[_0xa1fc('0x37')][_0xa1fc('0x39')]?_0x4dde19['attributes']:_0x1d6213[_0xa1fc('0x32')];if(_0x560736['query'][_0xa1fc('0x48')]){_0x4dde19[_0xa1fc('0x43')]=[{'all':!![]}];}_0x4dde19=_[_0xa1fc('0x3f')]({},_0x4dde19,_0x560736[_0xa1fc('0x42')]);return db['ServicenowConfiguration'][_0xa1fc('0x49')](_0x4dde19)[_0xa1fc('0x27')](handleEntityNotFound(_0x371c40,null))[_0xa1fc('0x27')](respondWithResult(_0x371c40,null))['catch'](handleError(_0x371c40,null));};exports[_0xa1fc('0x4a')]=function(_0x5adc91,_0x1bb144){return db['ServicenowConfiguration'][_0xa1fc('0x4a')](_0x5adc91[_0xa1fc('0x4b')],{})[_0xa1fc('0x27')](respondWithResult(_0x1bb144,0xc9))[_0xa1fc('0x45')](handleError(_0x1bb144,null));};exports['update']=function(_0x2e22de,_0x311df4){if(_0x2e22de[_0xa1fc('0x4b')]['id']){delete _0x2e22de[_0xa1fc('0x4b')]['id'];}return db['ServicenowConfiguration'][_0xa1fc('0x49')]({'where':{'id':_0x2e22de[_0xa1fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x311df4,null))[_0xa1fc('0x27')](saveUpdates(_0x2e22de[_0xa1fc('0x4b')],null))[_0xa1fc('0x27')](respondWithResult(_0x311df4,null))[_0xa1fc('0x45')](handleError(_0x311df4,null));};exports['destroy']=function(_0x1e920f,_0xb73c0a){return db['ServicenowConfiguration'][_0xa1fc('0x49')]({'where':{'id':_0x1e920f[_0xa1fc('0x47')]['id']}})['then'](handleEntityNotFound(_0xb73c0a,null))[_0xa1fc('0x27')](removeEntity(_0xb73c0a,null))[_0xa1fc('0x45')](handleError(_0xb73c0a,null));};exports[_0xa1fc('0x4c')]=function(_0x258b08,_0x3d05e4,_0x52f9c8){var _0x4b0594={};var _0x381ff7={};var _0x287a76;var _0x36791b;return db['ServicenowConfiguration'][_0xa1fc('0x4d')]({'where':{'id':_0x258b08['params']['id']}})['then'](handleEntityNotFound(_0x3d05e4,null))[_0xa1fc('0x27')](function(_0x75a3cf){if(_0x75a3cf){_0x287a76=_0x75a3cf;_0x381ff7[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](db[_0xa1fc('0x4e')][_0xa1fc('0x2e')]);_0x381ff7[_0xa1fc('0x34')]=_[_0xa1fc('0x33')](_0x258b08[_0xa1fc('0x34')]);_0x381ff7[_0xa1fc('0x35')]=_[_0xa1fc('0x36')](_0x381ff7[_0xa1fc('0x32')],_0x381ff7['query']);_0x4b0594[_0xa1fc('0x37')]=_['intersection'](_0x381ff7['model'],qs['fields'](_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x38')]));_0x4b0594[_0xa1fc('0x37')]=_0x4b0594[_0xa1fc('0x37')][_0xa1fc('0x39')]?_0x4b0594[_0xa1fc('0x37')]:_0x381ff7[_0xa1fc('0x32')];_0x4b0594[_0xa1fc('0x3b')]=qs[_0xa1fc('0x3c')](_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x3c')]);_0x4b0594[_0xa1fc('0x3d')]=qs[_0xa1fc('0x35')](_['pick'](_0x258b08['query'],_0x381ff7[_0xa1fc('0x35')]));if(_0x258b08[_0xa1fc('0x34')]['filter']){_0x4b0594[_0xa1fc('0x3d')]=_[_0xa1fc('0x3f')](_0x4b0594['where'],{'$or':_['map'](_0x4b0594[_0xa1fc('0x37')],function(_0x20ddaa){var _0x43a85f={};_0x43a85f[_0x20ddaa]={'$like':'%'+_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x3e')]+'%'};return _0x43a85f;})});}_0x4b0594=_[_0xa1fc('0x3f')]({},_0x4b0594,_0x258b08[_0xa1fc('0x42')]);return _0x287a76[_0xa1fc('0x4c')](_0x4b0594);}})[_0xa1fc('0x27')](function(_0x1372fe){if(_0x1372fe){_0x36791b=_0x1372fe['length'];if(!_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x4f')](_0xa1fc('0x3a'))){_0x4b0594[_0xa1fc('0x1f')]=qs[_0xa1fc('0x1f')](_0x258b08['query'][_0xa1fc('0x1f')]);_0x4b0594[_0xa1fc('0x1e')]=qs[_0xa1fc('0x1e')](_0x258b08[_0xa1fc('0x34')][_0xa1fc('0x1e')]);}return _0x287a76[_0xa1fc('0x4c')](_0x4b0594);}})[_0xa1fc('0x27')](function(_0x17568c){if(_0x17568c){return _0x17568c?{'count':_0x36791b,'rows':_0x17568c}:null;}})[_0xa1fc('0x27')](respondWithResult(_0x3d05e4,null))['catch'](handleError(_0x3d05e4,null));};exports[_0xa1fc('0x50')]=function(_0x48f548,_0x37ffbd,_0x5e7fa5){var _0x15385a={};var _0x5686b5={};var _0x35b0ac;var _0x22a9c0;return db[_0xa1fc('0x51')]['findOne']({'where':{'id':_0x48f548[_0xa1fc('0x47')]['id']}})[_0xa1fc('0x27')](handleEntityNotFound(_0x37ffbd,null))[_0xa1fc('0x27')](function(_0x33483a){if(_0x33483a){_0x35b0ac=_0x33483a;_0x5686b5[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](db[_0xa1fc('0x4e')][_0xa1fc('0x2e')]);_0x5686b5[_0xa1fc('0x34')]=_[_0xa1fc('0x33')](_0x48f548[_0xa1fc('0x34')]);_0x5686b5['filters']=_[_0xa1fc('0x36')](_0x5686b5[_0xa1fc('0x32')],_0x5686b5[_0xa1fc('0x34')]);_0x15385a[_0xa1fc('0x37')]=_[_0xa1fc('0x36')](_0x5686b5[_0xa1fc('0x32')],qs[_0xa1fc('0x38')](_0x48f548[_0xa1fc('0x34')]['fields']));_0x15385a['attributes']=_0x15385a['attributes']['length']?_0x15385a[_0xa1fc('0x37')]:_0x5686b5[_0xa1fc('0x32')];_0x15385a[_0xa1fc('0x3b')]=qs['sort'](_0x48f548['query']['sort']);_0x15385a[_0xa1fc('0x3d')]=qs[_0xa1fc('0x35')](_[_0xa1fc('0x52')](_0x48f548[_0xa1fc('0x34')],_0x5686b5['filters']));if(_0x48f548[_0xa1fc('0x34')][_0xa1fc('0x3e')]){_0x15385a[_0xa1fc('0x3d')]=_[_0xa1fc('0x3f')](_0x15385a[_0xa1fc('0x3d')],{'$or':_['map'](_0x15385a['attributes'],function(_0xaf6b21){var _0x463626={};_0x463626[_0xaf6b21]={'$like':'%'+_0x48f548[_0xa1fc('0x34')][_0xa1fc('0x3e')]+'%'};return _0x463626;})});}_0x15385a=_['merge']({},_0x15385a,_0x48f548[_0xa1fc('0x42')]);return _0x35b0ac[_0xa1fc('0x50')](_0x15385a);}})['then'](function(_0x267fe2){if(_0x267fe2){_0x22a9c0=_0x267fe2[_0xa1fc('0x39')];if(!_0x48f548['query'][_0xa1fc('0x4f')](_0xa1fc('0x3a'))){_0x15385a[_0xa1fc('0x1f')]=qs['limit'](_0x48f548[_0xa1fc('0x34')][_0xa1fc('0x1f')]);_0x15385a[_0xa1fc('0x1e')]=qs[_0xa1fc('0x1e')](_0x48f548['query'][_0xa1fc('0x1e')]);}return _0x35b0ac[_0xa1fc('0x50')](_0x15385a);}})[_0xa1fc('0x27')](function(_0xd42978){if(_0xd42978){return _0xd42978?{'count':_0x22a9c0,'rows':_0xd42978}:null;}})[_0xa1fc('0x27')](respondWithResult(_0x37ffbd,null))[_0xa1fc('0x45')](handleError(_0x37ffbd,null));};exports['getDescriptions']=function(_0x36c8b3,_0x4305a0,_0x353d60){var _0x34b779={};var _0x124fbf={};var _0x591f3a;var _0x195a4a;return db[_0xa1fc('0x51')]['findOne']({'where':{'id':_0x36c8b3['params']['id']}})['then'](handleEntityNotFound(_0x4305a0,null))[_0xa1fc('0x27')](function(_0x20ca64){if(_0x20ca64){_0x591f3a=_0x20ca64;_0x124fbf[_0xa1fc('0x32')]=_[_0xa1fc('0x33')](db[_0xa1fc('0x4e')]['rawAttributes']);_0x124fbf['query']=_[_0xa1fc('0x33')](_0x36c8b3['query']);_0x124fbf[_0xa1fc('0x35')]=_[_0xa1fc('0x36')](_0x124fbf['model'],_0x124fbf['query']);_0x34b779[_0xa1fc('0x37')]=_[_0xa1fc('0x36')](_0x124fbf[_0xa1fc('0x32')],qs[_0xa1fc('0x38')](_0x36c8b3[_0xa1fc('0x34')][_0xa1fc('0x38')]));_0x34b779[_0xa1fc('0x37')]=_0x34b779[_0xa1fc('0x37')][_0xa1fc('0x39')]?_0x34b779[_0xa1fc('0x37')]:_0x124fbf[_0xa1fc('0x32')];_0x34b779['order']=qs['sort'](_0x36c8b3['query']['sort']);_0x34b779[_0xa1fc('0x3d')]=qs[_0xa1fc('0x35')](_[_0xa1fc('0x52')](_0x36c8b3[_0xa1fc('0x34')],_0x124fbf[_0xa1fc('0x35')]));if(_0x36c8b3[_0xa1fc('0x34')]['filter']){_0x34b779[_0xa1fc('0x3d')]=_[_0xa1fc('0x3f')](_0x34b779[_0xa1fc('0x3d')],{'$or':_[_0xa1fc('0x40')](_0x34b779['attributes'],function(_0x253e47){var _0x4ba132={};_0x4ba132[_0x253e47]={'$like':'%'+_0x36c8b3[_0xa1fc('0x34')]['filter']+'%'};return _0x4ba132;})});}_0x34b779=_[_0xa1fc('0x3f')]({},_0x34b779,_0x36c8b3[_0xa1fc('0x42')]);return _0x591f3a[_0xa1fc('0x53')](_0x34b779);}})['then'](function(_0x1d9723){if(_0x1d9723){_0x195a4a=_0x1d9723[_0xa1fc('0x39')];if(!_0x36c8b3[_0xa1fc('0x34')][_0xa1fc('0x4f')](_0xa1fc('0x3a'))){_0x34b779['limit']=qs[_0xa1fc('0x1f')](_0x36c8b3[_0xa1fc('0x34')]['limit']);_0x34b779[_0xa1fc('0x1e')]=qs['offset'](_0x36c8b3['query'][_0xa1fc('0x1e')]);}return _0x591f3a['getDescriptions'](_0x34b779);}})[_0xa1fc('0x27')](function(_0x340f8b){if(_0x340f8b){return _0x340f8b?{'count':_0x195a4a,'rows':_0x340f8b}:null;}})[_0xa1fc('0x27')](respondWithResult(_0x4305a0,null))[_0xa1fc('0x45')](handleError(_0x4305a0,null));}; \ No newline at end of file +var _0xf5bf=['Content-Range','save','update','destroy','then','sendStatus','error','name','index','ServicenowConfiguration','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','find','body','params','findOne','ServicenowField','getFields','getSubjects','getDescriptions','nolimit','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status'];(function(_0x5bf83b,_0x112fca){var _0x388ba4=function(_0x400c5d){while(--_0x400c5d){_0x5bf83b['push'](_0x5bf83b['shift']());}};_0x388ba4(++_0x112fca);}(_0xf5bf,0x166));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xff5b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xff5b('0x1'));var rp=require(_0xff5b('0x2'));var moment=require(_0xff5b('0x3'));var BPromise=require(_0xff5b('0x4'));var Mustache=require(_0xff5b('0x5'));var util=require(_0xff5b('0x6'));var path=require(_0xff5b('0x7'));var sox=require(_0xff5b('0x8'));var csv=require('to-csv');var ejs=require(_0xff5b('0x9'));var fs=require('fs');var fs_extra=require(_0xff5b('0xa'));var _=require(_0xff5b('0xb'));var squel=require(_0xff5b('0xc'));var crypto=require(_0xff5b('0xd'));var jsforce=require(_0xff5b('0xe'));var deskjs=require(_0xff5b('0xf'));var toCsv=require(_0xff5b('0x10'));var querystring=require(_0xff5b('0x11'));var Papa=require(_0xff5b('0x12'));var Redis=require(_0xff5b('0x13'));var authService=require(_0xff5b('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xff5b('0x15'))(_0xff5b('0x16'));var utils=require('../../config/utils');var config=require(_0xff5b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xff5b('0x18'))['db'];function respondWithStatusCode(_0xa20cd,_0x1238c1){_0x1238c1=_0x1238c1||0xcc;return function(_0x1f2eab){if(_0x1f2eab){return _0xa20cd['sendStatus'](_0x1238c1);}return _0xa20cd['status'](_0x1238c1)[_0xff5b('0x19')]();};}function respondWithResult(_0x19f62a,_0x5a5d0a){_0x5a5d0a=_0x5a5d0a||0xc8;return function(_0x2323f8){if(_0x2323f8){return _0x19f62a['status'](_0x5a5d0a)[_0xff5b('0x1a')](_0x2323f8);}};}function respondWithFilteredResult(_0x1dc828,_0x272c0){return function(_0x5580e1){if(_0x5580e1){var _0x53ea3a=typeof _0x272c0[_0xff5b('0x1b')]===_0xff5b('0x1c')&&typeof _0x272c0[_0xff5b('0x1d')]===_0xff5b('0x1c');var _0xe00127=_0x5580e1['count'];var _0x2e2dd8=_0x53ea3a?0x0:_0x272c0['offset'];var _0x34f5eb=_0x53ea3a?_0x5580e1[_0xff5b('0x1e')]:_0x272c0['offset']+_0x272c0[_0xff5b('0x1d')];var _0x30b552;if(_0x34f5eb>=_0xe00127){_0x34f5eb=_0xe00127;_0x30b552=0xc8;}else{_0x30b552=0xce;}_0x1dc828[_0xff5b('0x1f')](_0x30b552);return _0x1dc828['set'](_0xff5b('0x20'),_0x2e2dd8+'-'+_0x34f5eb+'/'+_0xe00127)[_0xff5b('0x1a')](_0x5580e1);}return null;};}function patchUpdates(_0x3ef485){return function(_0x282ea8){try{jsonpatch['apply'](_0x282ea8,_0x3ef485,!![]);}catch(_0x17e2a9){return BPromise['reject'](_0x17e2a9);}return _0x282ea8[_0xff5b('0x21')]();};}function saveUpdates(_0x284a68,_0x14144f){return function(_0x529631){if(_0x529631){return _0x529631[_0xff5b('0x22')](_0x284a68)['then'](function(_0x52c57e){return _0x52c57e;});}return null;};}function removeEntity(_0x56a9cf,_0xaabbc8){return function(_0x1ad9cf){if(_0x1ad9cf){return _0x1ad9cf[_0xff5b('0x23')]()[_0xff5b('0x24')](function(){_0x56a9cf['status'](0xcc)[_0xff5b('0x19')]();});}};}function handleEntityNotFound(_0x589f36,_0x2f862b){return function(_0x52daf8){if(!_0x52daf8){_0x589f36[_0xff5b('0x25')](0x194);}return _0x52daf8;};}function handleError(_0x30d7a4,_0x398126){_0x398126=_0x398126||0x1f4;return function(_0x33c873){logger[_0xff5b('0x26')](_0x33c873['stack']);if(_0x33c873['name']){delete _0x33c873[_0xff5b('0x27')];}_0x30d7a4[_0xff5b('0x1f')](_0x398126)['send'](_0x33c873);};}exports[_0xff5b('0x28')]=function(_0x32b47f,_0x2792f6){var _0x2f2bd3={},_0x82c8f9={},_0x362154={'count':0x0,'rows':[]};var _0x267062=_['map'](db[_0xff5b('0x29')]['rawAttributes'],function(_0x5b185b){return{'name':_0x5b185b[_0xff5b('0x2a')],'type':_0x5b185b['type'][_0xff5b('0x2b')]};});_0x82c8f9[_0xff5b('0x2c')]=_[_0xff5b('0x2d')](_0x267062,'name');_0x82c8f9['query']=_[_0xff5b('0x2e')](_0x32b47f[_0xff5b('0x2f')]);_0x82c8f9[_0xff5b('0x30')]=_[_0xff5b('0x31')](_0x82c8f9[_0xff5b('0x2c')],_0x82c8f9[_0xff5b('0x2f')]);_0x2f2bd3[_0xff5b('0x32')]=_[_0xff5b('0x31')](_0x82c8f9[_0xff5b('0x2c')],qs['fields'](_0x32b47f[_0xff5b('0x2f')][_0xff5b('0x33')]));_0x2f2bd3[_0xff5b('0x32')]=_0x2f2bd3['attributes'][_0xff5b('0x34')]?_0x2f2bd3['attributes']:_0x82c8f9['model'];if(!_0x32b47f[_0xff5b('0x2f')][_0xff5b('0x35')]('nolimit')){_0x2f2bd3[_0xff5b('0x1d')]=qs['limit'](_0x32b47f['query'][_0xff5b('0x1d')]);_0x2f2bd3[_0xff5b('0x1b')]=qs[_0xff5b('0x1b')](_0x32b47f[_0xff5b('0x2f')][_0xff5b('0x1b')]);}_0x2f2bd3[_0xff5b('0x36')]=qs[_0xff5b('0x37')](_0x32b47f[_0xff5b('0x2f')][_0xff5b('0x37')]);_0x2f2bd3[_0xff5b('0x38')]=qs[_0xff5b('0x30')](_[_0xff5b('0x39')](_0x32b47f[_0xff5b('0x2f')],_0x82c8f9['filters']),_0x267062);if(_0x32b47f[_0xff5b('0x2f')][_0xff5b('0x3a')]){_0x2f2bd3[_0xff5b('0x38')]=_['merge'](_0x2f2bd3[_0xff5b('0x38')],{'$or':_[_0xff5b('0x2d')](_0x267062,function(_0x1f4d2a){if(_0x1f4d2a[_0xff5b('0x3b')]!=='VIRTUAL'){var _0x4ec93f={};_0x4ec93f[_0x1f4d2a[_0xff5b('0x27')]]={'$like':'%'+_0x32b47f['query'][_0xff5b('0x3a')]+'%'};return _0x4ec93f;}})});}_0x2f2bd3=_['merge']({},_0x2f2bd3,_0x32b47f[_0xff5b('0x3c')]);var _0x29152e={'where':_0x2f2bd3['where']};return db[_0xff5b('0x29')]['count'](_0x29152e)[_0xff5b('0x24')](function(_0x58e02b){_0x362154[_0xff5b('0x1e')]=_0x58e02b;if(_0x32b47f[_0xff5b('0x2f')][_0xff5b('0x3d')]){_0x2f2bd3[_0xff5b('0x3e')]=[{'all':!![]}];}return db[_0xff5b('0x29')][_0xff5b('0x3f')](_0x2f2bd3);})[_0xff5b('0x24')](function(_0x422515){_0x362154[_0xff5b('0x40')]=_0x422515;return _0x362154;})[_0xff5b('0x24')](respondWithFilteredResult(_0x2792f6,_0x2f2bd3))[_0xff5b('0x41')](handleError(_0x2792f6,null));};exports[_0xff5b('0x42')]=function(_0x46b683,_0x1a3c4c){var _0x341368={'raw':![],'where':{'id':_0x46b683['params']['id']}},_0x21e038={};_0x21e038[_0xff5b('0x2c')]=_[_0xff5b('0x2e')](db[_0xff5b('0x29')][_0xff5b('0x43')]);_0x21e038[_0xff5b('0x2f')]=_['keys'](_0x46b683[_0xff5b('0x2f')]);_0x21e038['filters']=_[_0xff5b('0x31')](_0x21e038[_0xff5b('0x2c')],_0x21e038['query']);_0x341368[_0xff5b('0x32')]=_[_0xff5b('0x31')](_0x21e038[_0xff5b('0x2c')],qs[_0xff5b('0x33')](_0x46b683[_0xff5b('0x2f')][_0xff5b('0x33')]));_0x341368['attributes']=_0x341368['attributes'][_0xff5b('0x34')]?_0x341368[_0xff5b('0x32')]:_0x21e038[_0xff5b('0x2c')];if(_0x46b683[_0xff5b('0x2f')][_0xff5b('0x3d')]){_0x341368[_0xff5b('0x3e')]=[{'all':!![]}];}_0x341368=_[_0xff5b('0x44')]({},_0x341368,_0x46b683['options']);return db['ServicenowConfiguration'][_0xff5b('0x45')](_0x341368)[_0xff5b('0x24')](handleEntityNotFound(_0x1a3c4c,null))[_0xff5b('0x24')](respondWithResult(_0x1a3c4c,null))[_0xff5b('0x41')](handleError(_0x1a3c4c,null));};exports['create']=function(_0x405b1d,_0x18506e){return db[_0xff5b('0x29')]['create'](_0x405b1d['body'],{})[_0xff5b('0x24')](respondWithResult(_0x18506e,0xc9))['catch'](handleError(_0x18506e,null));};exports['update']=function(_0x3c13e9,_0x271273){if(_0x3c13e9[_0xff5b('0x46')]['id']){delete _0x3c13e9[_0xff5b('0x46')]['id'];}return db[_0xff5b('0x29')]['find']({'where':{'id':_0x3c13e9[_0xff5b('0x47')]['id']}})[_0xff5b('0x24')](handleEntityNotFound(_0x271273,null))[_0xff5b('0x24')](saveUpdates(_0x3c13e9[_0xff5b('0x46')],null))[_0xff5b('0x24')](respondWithResult(_0x271273,null))[_0xff5b('0x41')](handleError(_0x271273,null));};exports[_0xff5b('0x23')]=function(_0x390b4d,_0x2e272d){return db['ServicenowConfiguration'][_0xff5b('0x45')]({'where':{'id':_0x390b4d[_0xff5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e272d,null))[_0xff5b('0x24')](removeEntity(_0x2e272d,null))[_0xff5b('0x41')](handleError(_0x2e272d,null));};exports['getFields']=function(_0x420506,_0x973615,_0x16f067){var _0x20520f={};var _0x583df2={};var _0x36cd4a;var _0x482388;return db[_0xff5b('0x29')][_0xff5b('0x48')]({'where':{'id':_0x420506[_0xff5b('0x47')]['id']}})[_0xff5b('0x24')](handleEntityNotFound(_0x973615,null))[_0xff5b('0x24')](function(_0x1d9454){if(_0x1d9454){_0x36cd4a=_0x1d9454;_0x583df2[_0xff5b('0x2c')]=_[_0xff5b('0x2e')](db[_0xff5b('0x49')][_0xff5b('0x43')]);_0x583df2[_0xff5b('0x2f')]=_[_0xff5b('0x2e')](_0x420506[_0xff5b('0x2f')]);_0x583df2[_0xff5b('0x30')]=_[_0xff5b('0x31')](_0x583df2[_0xff5b('0x2c')],_0x583df2[_0xff5b('0x2f')]);_0x20520f[_0xff5b('0x32')]=_[_0xff5b('0x31')](_0x583df2[_0xff5b('0x2c')],qs['fields'](_0x420506[_0xff5b('0x2f')]['fields']));_0x20520f[_0xff5b('0x32')]=_0x20520f[_0xff5b('0x32')][_0xff5b('0x34')]?_0x20520f[_0xff5b('0x32')]:_0x583df2[_0xff5b('0x2c')];_0x20520f[_0xff5b('0x36')]=qs['sort'](_0x420506['query']['sort']);_0x20520f[_0xff5b('0x38')]=qs[_0xff5b('0x30')](_[_0xff5b('0x39')](_0x420506[_0xff5b('0x2f')],_0x583df2[_0xff5b('0x30')]));if(_0x420506[_0xff5b('0x2f')][_0xff5b('0x3a')]){_0x20520f['where']=_[_0xff5b('0x44')](_0x20520f['where'],{'$or':_[_0xff5b('0x2d')](_0x20520f[_0xff5b('0x32')],function(_0x20c3e6){var _0x148879={};_0x148879[_0x20c3e6]={'$like':'%'+_0x420506[_0xff5b('0x2f')][_0xff5b('0x3a')]+'%'};return _0x148879;})});}_0x20520f=_[_0xff5b('0x44')]({},_0x20520f,_0x420506['options']);return _0x36cd4a[_0xff5b('0x4a')](_0x20520f);}})['then'](function(_0x5d8ef3){if(_0x5d8ef3){_0x482388=_0x5d8ef3[_0xff5b('0x34')];if(!_0x420506['query']['hasOwnProperty']('nolimit')){_0x20520f[_0xff5b('0x1d')]=qs[_0xff5b('0x1d')](_0x420506['query']['limit']);_0x20520f['offset']=qs[_0xff5b('0x1b')](_0x420506['query'][_0xff5b('0x1b')]);}return _0x36cd4a[_0xff5b('0x4a')](_0x20520f);}})[_0xff5b('0x24')](function(_0x454db0){if(_0x454db0){return _0x454db0?{'count':_0x482388,'rows':_0x454db0}:null;}})[_0xff5b('0x24')](respondWithResult(_0x973615,null))[_0xff5b('0x41')](handleError(_0x973615,null));};exports[_0xff5b('0x4b')]=function(_0x563661,_0x5ad40a,_0x33af4f){var _0x49db9d={};var _0xedf913={};var _0x4a1f8d;var _0x352a75;return db[_0xff5b('0x29')][_0xff5b('0x48')]({'where':{'id':_0x563661['params']['id']}})[_0xff5b('0x24')](handleEntityNotFound(_0x5ad40a,null))['then'](function(_0x15d85d){if(_0x15d85d){_0x4a1f8d=_0x15d85d;_0xedf913[_0xff5b('0x2c')]=_['keys'](db['ServicenowField'][_0xff5b('0x43')]);_0xedf913[_0xff5b('0x2f')]=_[_0xff5b('0x2e')](_0x563661[_0xff5b('0x2f')]);_0xedf913[_0xff5b('0x30')]=_[_0xff5b('0x31')](_0xedf913[_0xff5b('0x2c')],_0xedf913[_0xff5b('0x2f')]);_0x49db9d[_0xff5b('0x32')]=_[_0xff5b('0x31')](_0xedf913['model'],qs[_0xff5b('0x33')](_0x563661['query'][_0xff5b('0x33')]));_0x49db9d[_0xff5b('0x32')]=_0x49db9d[_0xff5b('0x32')][_0xff5b('0x34')]?_0x49db9d['attributes']:_0xedf913[_0xff5b('0x2c')];_0x49db9d[_0xff5b('0x36')]=qs[_0xff5b('0x37')](_0x563661[_0xff5b('0x2f')][_0xff5b('0x37')]);_0x49db9d[_0xff5b('0x38')]=qs[_0xff5b('0x30')](_[_0xff5b('0x39')](_0x563661[_0xff5b('0x2f')],_0xedf913[_0xff5b('0x30')]));if(_0x563661[_0xff5b('0x2f')]['filter']){_0x49db9d['where']=_[_0xff5b('0x44')](_0x49db9d[_0xff5b('0x38')],{'$or':_[_0xff5b('0x2d')](_0x49db9d[_0xff5b('0x32')],function(_0x298391){var _0x33b724={};_0x33b724[_0x298391]={'$like':'%'+_0x563661['query'][_0xff5b('0x3a')]+'%'};return _0x33b724;})});}_0x49db9d=_['merge']({},_0x49db9d,_0x563661[_0xff5b('0x3c')]);return _0x4a1f8d['getSubjects'](_0x49db9d);}})['then'](function(_0x4a718f){if(_0x4a718f){_0x352a75=_0x4a718f[_0xff5b('0x34')];if(!_0x563661[_0xff5b('0x2f')][_0xff5b('0x35')]('nolimit')){_0x49db9d[_0xff5b('0x1d')]=qs[_0xff5b('0x1d')](_0x563661[_0xff5b('0x2f')][_0xff5b('0x1d')]);_0x49db9d[_0xff5b('0x1b')]=qs[_0xff5b('0x1b')](_0x563661[_0xff5b('0x2f')][_0xff5b('0x1b')]);}return _0x4a1f8d['getSubjects'](_0x49db9d);}})[_0xff5b('0x24')](function(_0x48141e){if(_0x48141e){return _0x48141e?{'count':_0x352a75,'rows':_0x48141e}:null;}})[_0xff5b('0x24')](respondWithResult(_0x5ad40a,null))[_0xff5b('0x41')](handleError(_0x5ad40a,null));};exports[_0xff5b('0x4c')]=function(_0x496947,_0x3e10dd,_0x2fb107){var _0x35b44a={};var _0x53266={};var _0x4c11a1;var _0x565401;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x496947[_0xff5b('0x47')]['id']}})[_0xff5b('0x24')](handleEntityNotFound(_0x3e10dd,null))[_0xff5b('0x24')](function(_0xd7b277){if(_0xd7b277){_0x4c11a1=_0xd7b277;_0x53266[_0xff5b('0x2c')]=_[_0xff5b('0x2e')](db['ServicenowField']['rawAttributes']);_0x53266[_0xff5b('0x2f')]=_[_0xff5b('0x2e')](_0x496947['query']);_0x53266[_0xff5b('0x30')]=_[_0xff5b('0x31')](_0x53266[_0xff5b('0x2c')],_0x53266[_0xff5b('0x2f')]);_0x35b44a[_0xff5b('0x32')]=_[_0xff5b('0x31')](_0x53266['model'],qs[_0xff5b('0x33')](_0x496947['query']['fields']));_0x35b44a[_0xff5b('0x32')]=_0x35b44a[_0xff5b('0x32')][_0xff5b('0x34')]?_0x35b44a[_0xff5b('0x32')]:_0x53266['model'];_0x35b44a['order']=qs[_0xff5b('0x37')](_0x496947[_0xff5b('0x2f')][_0xff5b('0x37')]);_0x35b44a[_0xff5b('0x38')]=qs[_0xff5b('0x30')](_[_0xff5b('0x39')](_0x496947[_0xff5b('0x2f')],_0x53266['filters']));if(_0x496947[_0xff5b('0x2f')][_0xff5b('0x3a')]){_0x35b44a[_0xff5b('0x38')]=_[_0xff5b('0x44')](_0x35b44a[_0xff5b('0x38')],{'$or':_[_0xff5b('0x2d')](_0x35b44a['attributes'],function(_0x21dabf){var _0x4ef835={};_0x4ef835[_0x21dabf]={'$like':'%'+_0x496947[_0xff5b('0x2f')][_0xff5b('0x3a')]+'%'};return _0x4ef835;})});}_0x35b44a=_[_0xff5b('0x44')]({},_0x35b44a,_0x496947[_0xff5b('0x3c')]);return _0x4c11a1[_0xff5b('0x4c')](_0x35b44a);}})[_0xff5b('0x24')](function(_0xfd96b3){if(_0xfd96b3){_0x565401=_0xfd96b3[_0xff5b('0x34')];if(!_0x496947[_0xff5b('0x2f')][_0xff5b('0x35')](_0xff5b('0x4d'))){_0x35b44a[_0xff5b('0x1d')]=qs[_0xff5b('0x1d')](_0x496947[_0xff5b('0x2f')][_0xff5b('0x1d')]);_0x35b44a[_0xff5b('0x1b')]=qs[_0xff5b('0x1b')](_0x496947[_0xff5b('0x2f')]['offset']);}return _0x4c11a1['getDescriptions'](_0x35b44a);}})['then'](function(_0x116c91){if(_0x116c91){return _0x116c91?{'count':_0x565401,'rows':_0x116c91}:null;}})[_0xff5b('0x24')](respondWithResult(_0x3e10dd,null))[_0xff5b('0x41')](handleError(_0x3e10dd,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 944f550..ea11e8e 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 _0xbb35=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','util'];(function(_0x293138,_0x1a50fb){var _0x31f9eb=function(_0x23da80){while(--_0x23da80){_0x293138['push'](_0x293138['shift']());}};_0x31f9eb(++_0x1a50fb);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x373041,_0x251f6c){_0x373041=_0x373041-0x0;var _0x1e25ef=_0xbb35[_0x373041];return _0x1e25ef;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var logger=require(_0x5bb3('0x1'))(_0x5bb3('0x2'));var moment=require(_0x5bb3('0x3'));var BPromise=require(_0x5bb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb3('0x5'));var rimraf=require(_0x5bb3('0x6'));var config=require(_0x5bb3('0x7'));var attributes=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x321535,_0x46ef03){return _0x321535[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4dc=['ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x264c5f,_0x432fc2){var _0x491e55=function(_0x2aa982){while(--_0x2aa982){_0x264c5f['push'](_0x264c5f['shift']());}};_0x491e55(++_0x432fc2);}(_0xd4dc,0xff));var _0xcd4d=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xd4dc[_0x22b68a];return _0x1ac67a;};'use strict';var _=require(_0xcd4d('0x0'));var util=require('util');var logger=require(_0xcd4d('0x1'))(_0xcd4d('0x2'));var moment=require(_0xcd4d('0x3'));var BPromise=require(_0xcd4d('0x4'));var rp=require(_0xcd4d('0x5'));var fs=require('fs');var path=require(_0xcd4d('0x6'));var rimraf=require(_0xcd4d('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd4d('0x8'));module['exports']=function(_0x5d70fb,_0x3c5bbd){return _0x5d70fb['define'](_0xcd4d('0x9'),attributes,{'tableName':_0xcd4d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index cceadb3..2eb4418 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 _0x642a=['request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x37e5ed,_0x41cba3){var _0x53e57a=function(_0x584499){while(--_0x584499){_0x37e5ed['push'](_0x37e5ed['shift']());}};_0x53e57a(++_0x41cba3);}(_0x642a,0x18f));var _0xa642=function(_0xb7ae81,_0x28dc63){_0xb7ae81=_0xb7ae81-0x0;var _0x10726a=_0x642a[_0xb7ae81];return _0x10726a;};'use strict';var _=require(_0xa642('0x0'));var util=require(_0xa642('0x1'));var moment=require('moment');var BPromise=require(_0xa642('0x2'));var rs=require(_0xa642('0x3'));var fs=require('fs');var Redis=require(_0xa642('0x4'));var db=require(_0xa642('0x5'))['db'];var utils=require(_0xa642('0x6'));var logger=require(_0xa642('0x7'))(_0xa642('0x8'));var config=require(_0xa642('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa642('0xa')][_0xa642('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58c6ae,_0xacd69a,_0x32180d){return new BPromise(function(_0x9f1d08,_0x4b9f0e){return client['request'](_0x58c6ae,_0x32180d)['then'](function(_0x26be0f){logger[_0xa642('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0xacd69a,'request\x20sent');logger[_0xa642('0xd')](_0xa642('0xe'),_0xacd69a,_0xa642('0xf'),JSON[_0xa642('0x10')](_0x26be0f));if(_0x26be0f[_0xa642('0x11')]){if(_0x26be0f[_0xa642('0x11')][_0xa642('0x12')]===0x1f4){logger[_0xa642('0x11')](_0xa642('0x13'),_0xacd69a,_0x26be0f[_0xa642('0x11')][_0xa642('0x14')]);return _0x4b9f0e(_0x26be0f[_0xa642('0x11')][_0xa642('0x14')]);}logger[_0xa642('0x11')](_0xa642('0x13'),_0xacd69a,_0x26be0f['error'][_0xa642('0x14')]);return _0x9f1d08(_0x26be0f[_0xa642('0x11')][_0xa642('0x14')]);}else{logger[_0xa642('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0xacd69a,_0xa642('0xf'));_0x9f1d08(_0x26be0f[_0xa642('0x15')][_0xa642('0x14')]);}})[_0xa642('0x16')](function(_0x495900){logger[_0xa642('0x11')](_0xa642('0x13'),_0xacd69a,_0x495900);_0x4b9f0e(_0x495900);});});} \ No newline at end of file +var _0x2eb4=['ServicenowConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','error'];(function(_0x36e59e,_0x5614b4){var _0xc74f84=function(_0x2cdf95){while(--_0x2cdf95){_0x36e59e['push'](_0x36e59e['shift']());}};_0xc74f84(++_0x5614b4);}(_0x2eb4,0x17f));var _0x42eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2eb4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x42eb('0x0'));var util=require('util');var moment=require(_0x42eb('0x1'));var BPromise=require(_0x42eb('0x2'));var rs=require(_0x42eb('0x3'));var fs=require('fs');var Redis=require(_0x42eb('0x4'));var db=require(_0x42eb('0x5'))['db'];var utils=require(_0x42eb('0x6'));var logger=require(_0x42eb('0x7'))('rpc');var config=require(_0x42eb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x42eb('0x9')][_0x42eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a7084,_0x21bfc7,_0x281f5f){return new BPromise(function(_0x270770,_0x4c72c3){return client[_0x42eb('0xb')](_0x5a7084,_0x281f5f)[_0x42eb('0xc')](function(_0x23623a){logger[_0x42eb('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x21bfc7,'request\x20sent');logger[_0x42eb('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x21bfc7,'request\x20sent',JSON['stringify'](_0x23623a));if(_0x23623a['error']){if(_0x23623a['error']['code']===0x1f4){logger[_0x42eb('0xf')](_0x42eb('0x10'),_0x21bfc7,_0x23623a[_0x42eb('0xf')][_0x42eb('0x11')]);return _0x4c72c3(_0x23623a['error'][_0x42eb('0x11')]);}logger[_0x42eb('0xf')](_0x42eb('0x10'),_0x21bfc7,_0x23623a[_0x42eb('0xf')][_0x42eb('0x11')]);return _0x270770(_0x23623a[_0x42eb('0xf')][_0x42eb('0x11')]);}else{logger[_0x42eb('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x21bfc7,_0x42eb('0x12'));_0x270770(_0x23623a[_0x42eb('0x13')]['message']);}})[_0x42eb('0x14')](function(_0x19ee2a){logger[_0x42eb('0xf')](_0x42eb('0x10'),_0x21bfc7,_0x19ee2a);_0x4c72c3(_0x19ee2a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b4365b5..b59026c 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 _0x5a0e=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports'];(function(_0x327ac5,_0x4ce610){var _0x229b57=function(_0x401aa4){while(--_0x401aa4){_0x327ac5['push'](_0x327ac5['shift']());}};_0x229b57(++_0x4ce610);}(_0x5a0e,0xc6));var _0xe5a0=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x5a0e[_0xcaf223];return _0x17e00d;};'use strict';var multer=require(_0xe5a0('0x0'));var util=require(_0xe5a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe5a0('0x2'));var router=express[_0xe5a0('0x3')]();var fs_extra=require(_0xe5a0('0x4'));var auth=require(_0xe5a0('0x5'));var interaction=require(_0xe5a0('0x6'));var config=require('../../config/environment');var controller=require(_0xe5a0('0x7'));router[_0xe5a0('0x8')]('/',auth[_0xe5a0('0x9')](),controller[_0xe5a0('0xa')]);router[_0xe5a0('0x8')](_0xe5a0('0xb'),auth['isAuthenticated'](),controller[_0xe5a0('0xc')]);router[_0xe5a0('0xd')]('/',auth[_0xe5a0('0x9')](),controller['create']);router[_0xe5a0('0xe')](_0xe5a0('0xb'),auth[_0xe5a0('0x9')](),controller[_0xe5a0('0xf')]);router['delete'](_0xe5a0('0xb'),auth[_0xe5a0('0x9')](),controller[_0xe5a0('0x10')]);module[_0xe5a0('0x11')]=router; \ No newline at end of file +var _0xd153=['util','path','express','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x4aed69,_0x2719c9){var _0x360b9c=function(_0x221b52){while(--_0x221b52){_0x4aed69['push'](_0x4aed69['shift']());}};_0x360b9c(++_0x2719c9);}(_0xd153,0xaa));var _0x3d15=function(_0x577802,_0xecf29e){_0x577802=_0x577802-0x0;var _0x4cbff3=_0xd153[_0x577802];return _0x4cbff3;};'use strict';var multer=require(_0x3d15('0x0'));var util=require(_0x3d15('0x1'));var path=require(_0x3d15('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d15('0x3'));var router=express[_0x3d15('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3d15('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d15('0x6'));var controller=require(_0x3d15('0x7'));router[_0x3d15('0x8')]('/',auth[_0x3d15('0x9')](),controller[_0x3d15('0xa')]);router[_0x3d15('0x8')](_0x3d15('0xb'),auth[_0x3d15('0x9')](),controller[_0x3d15('0xc')]);router[_0x3d15('0xd')]('/',auth['isAuthenticated'](),controller[_0x3d15('0xe')]);router[_0x3d15('0xf')](_0x3d15('0xb'),auth[_0x3d15('0x9')](),controller[_0x3d15('0x10')]);router[_0x3d15('0x11')]('/:id',auth[_0x3d15('0x9')](),controller[_0x3d15('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 16cb966..c5365e1 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 _0x804a=['string','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','keyValue','picklist','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x804a,0x158));var _0xa804=function(_0x22f86f,_0x4d2253){_0x22f86f=_0x22f86f-0x0;var _0x129a28=_0x804a[_0x22f86f];return _0x129a28;};'use strict';var Sequelize=require(_0xa804('0x0'));module[_0xa804('0x1')]={'type':{'type':Sequelize[_0xa804('0x2')]('string','variable','customVariable',_0xa804('0x3'),_0xa804('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa804('0x5')]},'key':{'type':Sequelize[_0xa804('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xa804('0x6'),_0xa804('0x7'),_0xa804('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa804('0x5')]},'customField':{'type':Sequelize[_0xa804('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa804('0x5')]}}; \ No newline at end of file +var _0x594a=['STRING','string','customVariable','sequelize','exports','ENUM','keyValue'];(function(_0x30dd05,_0x40adfd){var _0x32a04e=function(_0x28b84d){while(--_0x28b84d){_0x30dd05['push'](_0x30dd05['shift']());}};_0x32a04e(++_0x40adfd);}(_0x594a,0x184));var _0xa594=function(_0x14e0d4,_0x16a492){_0x14e0d4=_0x14e0d4-0x0;var _0x2aeee8=_0x594a[_0x14e0d4];return _0x2aeee8;};'use strict';var Sequelize=require(_0xa594('0x0'));module[_0xa594('0x1')]={'type':{'type':Sequelize[_0xa594('0x2')]('string','variable','customVariable',_0xa594('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa594('0x4')]},'keyType':{'type':Sequelize[_0xa594('0x2')](_0xa594('0x5'),'variable',_0xa594('0x6'))},'keyContent':{'type':Sequelize[_0xa594('0x4')]},'idField':{'type':Sequelize[_0xa594('0x4')]},'nameField':{'type':Sequelize[_0xa594('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 15ea2cd..9505458 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 _0xbd43=['intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','ServicenowField','fieldName','type','key','model','map','query','filters'];(function(_0x3a4f02,_0x46a551){var _0x1cbcb3=function(_0x2efd1e){while(--_0x2efd1e){_0x3a4f02['push'](_0x3a4f02['shift']());}};_0x1cbcb3(++_0x46a551);}(_0xbd43,0xf7));var _0x3bd4=function(_0x1a4878,_0x26adb8){_0x1a4878=_0x1a4878-0x0;var _0x3e5350=_0xbd43[_0x1a4878];return _0x3e5350;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bd4('0x0'));var zipdir=require(_0x3bd4('0x1'));var jsonpatch=require(_0x3bd4('0x2'));var rp=require(_0x3bd4('0x3'));var moment=require('moment');var BPromise=require(_0x3bd4('0x4'));var Mustache=require('mustache');var util=require(_0x3bd4('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3bd4('0x6'));var fs=require('fs');var fs_extra=require(_0x3bd4('0x7'));var _=require(_0x3bd4('0x8'));var squel=require(_0x3bd4('0x9'));var crypto=require(_0x3bd4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3bd4('0xb'));var toCsv=require(_0x3bd4('0xc'));var querystring=require(_0x3bd4('0xd'));var Papa=require(_0x3bd4('0xe'));var Redis=require('ioredis');var authService=require(_0x3bd4('0xf'));var qs=require(_0x3bd4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bd4('0x11'))(_0x3bd4('0x12'));var utils=require(_0x3bd4('0x13'));var config=require(_0x3bd4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3bd4('0x15'))['db'];function respondWithStatusCode(_0x35ff4c,_0x2e137d){_0x2e137d=_0x2e137d||0xcc;return function(_0x3656eb){if(_0x3656eb){return _0x35ff4c[_0x3bd4('0x16')](_0x2e137d);}return _0x35ff4c['status'](_0x2e137d)[_0x3bd4('0x17')]();};}function respondWithResult(_0x597ab6,_0x13923f){_0x13923f=_0x13923f||0xc8;return function(_0x44bfe2){if(_0x44bfe2){return _0x597ab6['status'](_0x13923f)['json'](_0x44bfe2);}};}function respondWithFilteredResult(_0x4d0d16,_0x1b8ece){return function(_0x3f3058){if(_0x3f3058){var _0x4bbfbc=typeof _0x1b8ece['offset']===_0x3bd4('0x18')&&typeof _0x1b8ece[_0x3bd4('0x19')]===_0x3bd4('0x18');var _0xf0fe4e=_0x3f3058[_0x3bd4('0x1a')];var _0x11ab1e=_0x4bbfbc?0x0:_0x1b8ece[_0x3bd4('0x1b')];var _0xfd73a8=_0x4bbfbc?_0x3f3058['count']:_0x1b8ece[_0x3bd4('0x1b')]+_0x1b8ece[_0x3bd4('0x19')];var _0x468f69;if(_0xfd73a8>=_0xf0fe4e){_0xfd73a8=_0xf0fe4e;_0x468f69=0xc8;}else{_0x468f69=0xce;}_0x4d0d16[_0x3bd4('0x1c')](_0x468f69);return _0x4d0d16[_0x3bd4('0x1d')](_0x3bd4('0x1e'),_0x11ab1e+'-'+_0xfd73a8+'/'+_0xf0fe4e)[_0x3bd4('0x1f')](_0x3f3058);}return null;};}function patchUpdates(_0x20a620){return function(_0x9f8007){try{jsonpatch[_0x3bd4('0x20')](_0x9f8007,_0x20a620,!![]);}catch(_0xe81bb){return BPromise['reject'](_0xe81bb);}return _0x9f8007[_0x3bd4('0x21')]();};}function saveUpdates(_0x588c82,_0x157b47){return function(_0x5a7381){if(_0x5a7381){return _0x5a7381['update'](_0x588c82)[_0x3bd4('0x22')](function(_0x582784){return _0x582784;});}return null;};}function removeEntity(_0x28802e,_0x4a2e12){return function(_0x44278c){if(_0x44278c){return _0x44278c[_0x3bd4('0x23')]()[_0x3bd4('0x22')](function(){_0x28802e[_0x3bd4('0x1c')](0xcc)[_0x3bd4('0x17')]();});}};}function handleEntityNotFound(_0x4ecf68,_0x52da60){return function(_0x266654){if(!_0x266654){_0x4ecf68[_0x3bd4('0x16')](0x194);}return _0x266654;};}function handleError(_0x180978,_0xa80229){_0xa80229=_0xa80229||0x1f4;return function(_0x158ab6){logger[_0x3bd4('0x24')](_0x158ab6[_0x3bd4('0x25')]);if(_0x158ab6[_0x3bd4('0x26')]){delete _0x158ab6[_0x3bd4('0x26')];}_0x180978[_0x3bd4('0x1c')](_0xa80229)[_0x3bd4('0x27')](_0x158ab6);};}exports[_0x3bd4('0x28')]=function(_0xe3b7e6,_0x17dbde){var _0x5612bd={},_0x83a34={},_0x4ecb66={'count':0x0,'rows':[]};var _0x126258=_['map'](db[_0x3bd4('0x29')]['rawAttributes'],function(_0x469559){return{'name':_0x469559[_0x3bd4('0x2a')],'type':_0x469559[_0x3bd4('0x2b')][_0x3bd4('0x2c')]};});_0x83a34[_0x3bd4('0x2d')]=_[_0x3bd4('0x2e')](_0x126258,_0x3bd4('0x26'));_0x83a34[_0x3bd4('0x2f')]=_['keys'](_0xe3b7e6[_0x3bd4('0x2f')]);_0x83a34[_0x3bd4('0x30')]=_[_0x3bd4('0x31')](_0x83a34[_0x3bd4('0x2d')],_0x83a34[_0x3bd4('0x2f')]);_0x5612bd[_0x3bd4('0x32')]=_[_0x3bd4('0x31')](_0x83a34[_0x3bd4('0x2d')],qs['fields'](_0xe3b7e6[_0x3bd4('0x2f')][_0x3bd4('0x33')]));_0x5612bd[_0x3bd4('0x32')]=_0x5612bd['attributes'][_0x3bd4('0x34')]?_0x5612bd[_0x3bd4('0x32')]:_0x83a34[_0x3bd4('0x2d')];if(!_0xe3b7e6[_0x3bd4('0x2f')]['hasOwnProperty'](_0x3bd4('0x35'))){_0x5612bd[_0x3bd4('0x19')]=qs[_0x3bd4('0x19')](_0xe3b7e6['query']['limit']);_0x5612bd[_0x3bd4('0x1b')]=qs[_0x3bd4('0x1b')](_0xe3b7e6[_0x3bd4('0x2f')][_0x3bd4('0x1b')]);}_0x5612bd['order']=qs[_0x3bd4('0x36')](_0xe3b7e6[_0x3bd4('0x2f')][_0x3bd4('0x36')]);_0x5612bd['where']=qs[_0x3bd4('0x30')](_[_0x3bd4('0x37')](_0xe3b7e6[_0x3bd4('0x2f')],_0x83a34[_0x3bd4('0x30')]),_0x126258);if(_0xe3b7e6[_0x3bd4('0x2f')]['filter']){_0x5612bd[_0x3bd4('0x38')]=_[_0x3bd4('0x39')](_0x5612bd[_0x3bd4('0x38')],{'$or':_[_0x3bd4('0x2e')](_0x126258,function(_0x22681a){if(_0x22681a[_0x3bd4('0x2b')]!==_0x3bd4('0x3a')){var _0x549423={};_0x549423[_0x22681a['name']]={'$like':'%'+_0xe3b7e6['query'][_0x3bd4('0x3b')]+'%'};return _0x549423;}})});}_0x5612bd=_[_0x3bd4('0x39')]({},_0x5612bd,_0xe3b7e6[_0x3bd4('0x3c')]);var _0x524f5f={'where':_0x5612bd[_0x3bd4('0x38')]};return db['ServicenowField'][_0x3bd4('0x1a')](_0x524f5f)[_0x3bd4('0x22')](function(_0x3d3350){_0x4ecb66[_0x3bd4('0x1a')]=_0x3d3350;if(_0xe3b7e6[_0x3bd4('0x2f')][_0x3bd4('0x3d')]){_0x5612bd[_0x3bd4('0x3e')]=[{'all':!![]}];}return db[_0x3bd4('0x29')][_0x3bd4('0x3f')](_0x5612bd);})[_0x3bd4('0x22')](function(_0x1fa968){_0x4ecb66[_0x3bd4('0x40')]=_0x1fa968;return _0x4ecb66;})[_0x3bd4('0x22')](respondWithFilteredResult(_0x17dbde,_0x5612bd))['catch'](handleError(_0x17dbde,null));};exports[_0x3bd4('0x41')]=function(_0x3c7aa4,_0x55d361){var _0x49de78={'raw':!![],'where':{'id':_0x3c7aa4[_0x3bd4('0x42')]['id']}},_0x549bf4={};_0x549bf4['model']=_[_0x3bd4('0x43')](db['ServicenowField'][_0x3bd4('0x44')]);_0x549bf4[_0x3bd4('0x2f')]=_[_0x3bd4('0x43')](_0x3c7aa4[_0x3bd4('0x2f')]);_0x549bf4[_0x3bd4('0x30')]=_[_0x3bd4('0x31')](_0x549bf4['model'],_0x549bf4[_0x3bd4('0x2f')]);_0x49de78[_0x3bd4('0x32')]=_['intersection'](_0x549bf4[_0x3bd4('0x2d')],qs[_0x3bd4('0x33')](_0x3c7aa4[_0x3bd4('0x2f')]['fields']));_0x49de78[_0x3bd4('0x32')]=_0x49de78[_0x3bd4('0x32')][_0x3bd4('0x34')]?_0x49de78[_0x3bd4('0x32')]:_0x549bf4[_0x3bd4('0x2d')];if(_0x3c7aa4[_0x3bd4('0x2f')][_0x3bd4('0x3d')]){_0x49de78['include']=[{'all':!![]}];}_0x49de78=_['merge']({},_0x49de78,_0x3c7aa4[_0x3bd4('0x3c')]);return db['ServicenowField'][_0x3bd4('0x45')](_0x49de78)[_0x3bd4('0x22')](handleEntityNotFound(_0x55d361,null))[_0x3bd4('0x22')](respondWithResult(_0x55d361,null))[_0x3bd4('0x46')](handleError(_0x55d361,null));};exports[_0x3bd4('0x47')]=function(_0x565893,_0x1e1149){return db[_0x3bd4('0x29')]['create'](_0x565893[_0x3bd4('0x48')],{})[_0x3bd4('0x22')](respondWithResult(_0x1e1149,0xc9))[_0x3bd4('0x46')](handleError(_0x1e1149,null));};exports[_0x3bd4('0x49')]=function(_0x105c16,_0x224ae5){if(_0x105c16[_0x3bd4('0x48')]['id']){delete _0x105c16['body']['id'];}return db[_0x3bd4('0x29')][_0x3bd4('0x45')]({'where':{'id':_0x105c16[_0x3bd4('0x42')]['id']}})[_0x3bd4('0x22')](handleEntityNotFound(_0x224ae5,null))[_0x3bd4('0x22')](saveUpdates(_0x105c16[_0x3bd4('0x48')],null))[_0x3bd4('0x22')](respondWithResult(_0x224ae5,null))[_0x3bd4('0x46')](handleError(_0x224ae5,null));};exports[_0x3bd4('0x23')]=function(_0x450b2c,_0x1c8634){return db['ServicenowField'][_0x3bd4('0x45')]({'where':{'id':_0x450b2c[_0x3bd4('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c8634,null))[_0x3bd4('0x22')](removeEntity(_0x1c8634,null))[_0x3bd4('0x46')](handleError(_0x1c8634,null));}; \ No newline at end of file +var _0x3449=['body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x3449,0x1c6));var _0x9344=function(_0xb5f663,_0x512825){_0xb5f663=_0xb5f663-0x0;var _0xe82e49=_0x3449[_0xb5f663];return _0xe82e49;};'use strict';var emlformat=require(_0x9344('0x0'));var rimraf=require(_0x9344('0x1'));var zipdir=require(_0x9344('0x2'));var jsonpatch=require(_0x9344('0x3'));var rp=require('request-promise');var moment=require(_0x9344('0x4'));var BPromise=require(_0x9344('0x5'));var Mustache=require('mustache');var util=require(_0x9344('0x6'));var path=require(_0x9344('0x7'));var sox=require(_0x9344('0x8'));var csv=require(_0x9344('0x9'));var ejs=require(_0x9344('0xa'));var fs=require('fs');var fs_extra=require(_0x9344('0xb'));var _=require(_0x9344('0xc'));var squel=require('squel');var crypto=require(_0x9344('0xd'));var jsforce=require(_0x9344('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9344('0x9'));var querystring=require(_0x9344('0xf'));var Papa=require(_0x9344('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9344('0x11'));var as=require(_0x9344('0x12'));var hardwareService=require(_0x9344('0x13'));var logger=require('../../config/logger')(_0x9344('0x14'));var utils=require('../../config/utils');var config=require(_0x9344('0x15'));var licenseUtil=require(_0x9344('0x16'));var db=require(_0x9344('0x17'))['db'];function respondWithStatusCode(_0x5cef64,_0x27f4e7){_0x27f4e7=_0x27f4e7||0xcc;return function(_0x1d2041){if(_0x1d2041){return _0x5cef64[_0x9344('0x18')](_0x27f4e7);}return _0x5cef64['status'](_0x27f4e7)[_0x9344('0x19')]();};}function respondWithResult(_0x2258da,_0x502540){_0x502540=_0x502540||0xc8;return function(_0x41d272){if(_0x41d272){return _0x2258da[_0x9344('0x1a')](_0x502540)[_0x9344('0x1b')](_0x41d272);}};}function respondWithFilteredResult(_0xeec3ce,_0x40e3ce){return function(_0x276141){if(_0x276141){var _0x5c83f6=typeof _0x40e3ce[_0x9344('0x1c')]==='undefined'&&typeof _0x40e3ce['limit']===_0x9344('0x1d');var _0x2e41ff=_0x276141[_0x9344('0x1e')];var _0x13406f=_0x5c83f6?0x0:_0x40e3ce['offset'];var _0x322f7f=_0x5c83f6?_0x276141[_0x9344('0x1e')]:_0x40e3ce['offset']+_0x40e3ce[_0x9344('0x1f')];var _0xa3296;if(_0x322f7f>=_0x2e41ff){_0x322f7f=_0x2e41ff;_0xa3296=0xc8;}else{_0xa3296=0xce;}_0xeec3ce['status'](_0xa3296);return _0xeec3ce[_0x9344('0x20')]('Content-Range',_0x13406f+'-'+_0x322f7f+'/'+_0x2e41ff)[_0x9344('0x1b')](_0x276141);}return null;};}function patchUpdates(_0x4ef5f9){return function(_0x4b7e7d){try{jsonpatch[_0x9344('0x21')](_0x4b7e7d,_0x4ef5f9,!![]);}catch(_0x448910){return BPromise[_0x9344('0x22')](_0x448910);}return _0x4b7e7d[_0x9344('0x23')]();};}function saveUpdates(_0x3e8961,_0x287e96){return function(_0x564641){if(_0x564641){return _0x564641['update'](_0x3e8961)[_0x9344('0x24')](function(_0x5e3a76){return _0x5e3a76;});}return null;};}function removeEntity(_0x421944,_0x156d6c){return function(_0x332285){if(_0x332285){return _0x332285[_0x9344('0x25')]()[_0x9344('0x24')](function(){_0x421944[_0x9344('0x1a')](0xcc)[_0x9344('0x19')]();});}};}function handleEntityNotFound(_0x51eef4,_0x3bf85e){return function(_0x2ac183){if(!_0x2ac183){_0x51eef4[_0x9344('0x18')](0x194);}return _0x2ac183;};}function handleError(_0x18dc2c,_0x4eb39b){_0x4eb39b=_0x4eb39b||0x1f4;return function(_0x454cd1){logger['error'](_0x454cd1[_0x9344('0x26')]);if(_0x454cd1[_0x9344('0x27')]){delete _0x454cd1[_0x9344('0x27')];}_0x18dc2c[_0x9344('0x1a')](_0x4eb39b)[_0x9344('0x28')](_0x454cd1);};}exports[_0x9344('0x29')]=function(_0x2c5552,_0x410bf7){var _0x2c331e={},_0x5ebe1a={},_0x13c90a={'count':0x0,'rows':[]};var _0x598d86=_[_0x9344('0x2a')](db[_0x9344('0x2b')][_0x9344('0x2c')],function(_0x5c8827){return{'name':_0x5c8827['fieldName'],'type':_0x5c8827[_0x9344('0x2d')][_0x9344('0x2e')]};});_0x5ebe1a[_0x9344('0x2f')]=_['map'](_0x598d86,_0x9344('0x27'));_0x5ebe1a[_0x9344('0x30')]=_[_0x9344('0x31')](_0x2c5552[_0x9344('0x30')]);_0x5ebe1a[_0x9344('0x32')]=_[_0x9344('0x33')](_0x5ebe1a[_0x9344('0x2f')],_0x5ebe1a['query']);_0x2c331e[_0x9344('0x34')]=_[_0x9344('0x33')](_0x5ebe1a[_0x9344('0x2f')],qs['fields'](_0x2c5552['query'][_0x9344('0x35')]));_0x2c331e[_0x9344('0x34')]=_0x2c331e['attributes'][_0x9344('0x36')]?_0x2c331e[_0x9344('0x34')]:_0x5ebe1a[_0x9344('0x2f')];if(!_0x2c5552[_0x9344('0x30')][_0x9344('0x37')](_0x9344('0x38'))){_0x2c331e[_0x9344('0x1f')]=qs[_0x9344('0x1f')](_0x2c5552['query'][_0x9344('0x1f')]);_0x2c331e['offset']=qs[_0x9344('0x1c')](_0x2c5552['query'][_0x9344('0x1c')]);}_0x2c331e[_0x9344('0x39')]=qs[_0x9344('0x3a')](_0x2c5552[_0x9344('0x30')]['sort']);_0x2c331e['where']=qs[_0x9344('0x32')](_[_0x9344('0x3b')](_0x2c5552['query'],_0x5ebe1a[_0x9344('0x32')]),_0x598d86);if(_0x2c5552['query'][_0x9344('0x3c')]){_0x2c331e[_0x9344('0x3d')]=_[_0x9344('0x3e')](_0x2c331e[_0x9344('0x3d')],{'$or':_[_0x9344('0x2a')](_0x598d86,function(_0x59f625){if(_0x59f625[_0x9344('0x2d')]!==_0x9344('0x3f')){var _0x3c99b0={};_0x3c99b0[_0x59f625[_0x9344('0x27')]]={'$like':'%'+_0x2c5552[_0x9344('0x30')][_0x9344('0x3c')]+'%'};return _0x3c99b0;}})});}_0x2c331e=_[_0x9344('0x3e')]({},_0x2c331e,_0x2c5552[_0x9344('0x40')]);var _0x239725={'where':_0x2c331e['where']};return db[_0x9344('0x2b')][_0x9344('0x1e')](_0x239725)['then'](function(_0x1d850a){_0x13c90a[_0x9344('0x1e')]=_0x1d850a;if(_0x2c5552[_0x9344('0x30')][_0x9344('0x41')]){_0x2c331e[_0x9344('0x42')]=[{'all':!![]}];}return db['ServicenowField'][_0x9344('0x43')](_0x2c331e);})['then'](function(_0x45b2a2){_0x13c90a[_0x9344('0x44')]=_0x45b2a2;return _0x13c90a;})[_0x9344('0x24')](respondWithFilteredResult(_0x410bf7,_0x2c331e))[_0x9344('0x45')](handleError(_0x410bf7,null));};exports['show']=function(_0xc1cd84,_0xc8229f){var _0x3fe287={'raw':!![],'where':{'id':_0xc1cd84['params']['id']}},_0x7dd963={};_0x7dd963[_0x9344('0x2f')]=_[_0x9344('0x31')](db['ServicenowField']['rawAttributes']);_0x7dd963[_0x9344('0x30')]=_[_0x9344('0x31')](_0xc1cd84['query']);_0x7dd963[_0x9344('0x32')]=_[_0x9344('0x33')](_0x7dd963['model'],_0x7dd963['query']);_0x3fe287['attributes']=_['intersection'](_0x7dd963[_0x9344('0x2f')],qs['fields'](_0xc1cd84['query'][_0x9344('0x35')]));_0x3fe287[_0x9344('0x34')]=_0x3fe287[_0x9344('0x34')][_0x9344('0x36')]?_0x3fe287[_0x9344('0x34')]:_0x7dd963[_0x9344('0x2f')];if(_0xc1cd84[_0x9344('0x30')][_0x9344('0x41')]){_0x3fe287['include']=[{'all':!![]}];}_0x3fe287=_[_0x9344('0x3e')]({},_0x3fe287,_0xc1cd84['options']);return db[_0x9344('0x2b')]['find'](_0x3fe287)['then'](handleEntityNotFound(_0xc8229f,null))[_0x9344('0x24')](respondWithResult(_0xc8229f,null))[_0x9344('0x45')](handleError(_0xc8229f,null));};exports[_0x9344('0x46')]=function(_0x1e49db,_0x53f507){return db['ServicenowField'][_0x9344('0x46')](_0x1e49db[_0x9344('0x47')],{})[_0x9344('0x24')](respondWithResult(_0x53f507,0xc9))['catch'](handleError(_0x53f507,null));};exports[_0x9344('0x48')]=function(_0x173e95,_0x5f0d1f){if(_0x173e95['body']['id']){delete _0x173e95[_0x9344('0x47')]['id'];}return db[_0x9344('0x2b')][_0x9344('0x49')]({'where':{'id':_0x173e95['params']['id']}})['then'](handleEntityNotFound(_0x5f0d1f,null))[_0x9344('0x24')](saveUpdates(_0x173e95[_0x9344('0x47')],null))[_0x9344('0x24')](respondWithResult(_0x5f0d1f,null))[_0x9344('0x45')](handleError(_0x5f0d1f,null));};exports[_0x9344('0x25')]=function(_0x200ada,_0x5693e6){return db[_0x9344('0x2b')]['find']({'where':{'id':_0x200ada[_0x9344('0x4a')]['id']}})[_0x9344('0x24')](handleEntityNotFound(_0x5693e6,null))[_0x9344('0x24')](removeEntity(_0x5693e6,null))[_0x9344('0x45')](handleError(_0x5693e6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 351d710..8fd86aa 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 _0xcdff=['exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','api','bluebird','request-promise','rimraf','./intServicenowField.attributes'];(function(_0x1611be,_0x45b887){var _0x231601=function(_0x474a78){while(--_0x474a78){_0x1611be['push'](_0x1611be['shift']());}};_0x231601(++_0x45b887);}(_0xcdff,0xc9));var _0xfcdf=function(_0xf8815,_0x44292e){_0xf8815=_0xf8815-0x0;var _0x5dbe2b=_0xcdff[_0xf8815];return _0x5dbe2b;};'use strict';var _=require(_0xfcdf('0x0'));var util=require(_0xfcdf('0x1'));var logger=require('../../config/logger')(_0xfcdf('0x2'));var moment=require('moment');var BPromise=require(_0xfcdf('0x3'));var rp=require(_0xfcdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfcdf('0x5'));var config=require('../../config/environment');var attributes=require(_0xfcdf('0x6'));module[_0xfcdf('0x7')]=function(_0x448842,_0x41735c){return _0x448842[_0xfcdf('0x8')](_0xfcdf('0x9'),attributes,{'tableName':_0xfcdf('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xfcdf('0xb'),_0xfcdf('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde65=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0xde65,0x1cf));var _0x5de6=function(_0x49420b,_0x3f2a46){_0x49420b=_0x49420b-0x0;var _0xb5f5c9=_0xde65[_0x49420b];return _0xb5f5c9;};'use strict';var _=require(_0x5de6('0x0'));var util=require(_0x5de6('0x1'));var logger=require(_0x5de6('0x2'))(_0x5de6('0x3'));var moment=require(_0x5de6('0x4'));var BPromise=require(_0x5de6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5de6('0x6'));var rimraf=require('rimraf');var config=require(_0x5de6('0x7'));var attributes=require(_0x5de6('0x8'));module['exports']=function(_0x2080bc,_0x55c2c3){return _0x2080bc['define'](_0x5de6('0x9'),attributes,{'tableName':_0x5de6('0xa'),'paranoid':![],'indexes':[{'name':_0x5de6('0xb'),'fields':[_0x5de6('0xc'),_0x5de6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index f7c7c66..1960f7f 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x32e9d3,_0xf8e7b6){var _0x5a57c1=function(_0x131ffd){while(--_0x131ffd){_0x32e9d3['push'](_0x32e9d3['shift']());}};_0x5a57c1(++_0xf8e7b6);}(_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 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 _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 250e8ff..26b1e9f 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5b99ff,_0x3e4341){var _0x58dd63=function(_0x10fee6){while(--_0x10fee6){_0x5b99ff['push'](_0x5b99ff['shift']());}};_0x58dd63(++_0x3e4341);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5f3a90,_0x1a57ca){var _0x260c47=function(_0x3f6402){while(--_0x3f6402){_0x5f3a90['push'](_0x5f3a90['shift']());}};_0x260c47(++_0x1a57ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 95387b6..c2cb0ad 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(_0x1e5829,_0xb464cd){var _0x5552ea=function(_0x11b15c){while(--_0x11b15c){_0x1e5829['push'](_0x1e5829['shift']());}};_0x5552ea(++_0xb464cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x20034c,_0x34d060){var _0x54dbae=function(_0x28ee83){while(--_0x28ee83){_0x20034c['push'](_0x20034c['shift']());}};_0x54dbae(++_0x34d060);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 eda7aef..d2d1d43 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 _0x1349=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','destroy','findOne','SugarcrmConfiguration','sort','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','values','module_fields','remove','includes','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x557c1d,_0x446947){var _0x348e2a=function(_0x39299d){while(--_0x39299d){_0x557c1d['push'](_0x557c1d['shift']());}};_0x348e2a(++_0x446947);}(_0x1349,0x69));var _0x9134=function(_0x2f6685,_0x2ac7ce){_0x2f6685=_0x2f6685-0x0;var _0x3e3e52=_0x1349[_0x2f6685];return _0x3e3e52;};'use strict';var emlformat=require(_0x9134('0x0'));var rimraf=require(_0x9134('0x1'));var zipdir=require(_0x9134('0x2'));var jsonpatch=require(_0x9134('0x3'));var rp=require(_0x9134('0x4'));var moment=require(_0x9134('0x5'));var BPromise=require(_0x9134('0x6'));var Mustache=require(_0x9134('0x7'));var util=require(_0x9134('0x8'));var path=require(_0x9134('0x9'));var sox=require(_0x9134('0xa'));var csv=require(_0x9134('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9134('0xc'));var _=require(_0x9134('0xd'));var squel=require(_0x9134('0xe'));var crypto=require(_0x9134('0xf'));var jsforce=require(_0x9134('0x10'));var deskjs=require(_0x9134('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9134('0x12'));var Redis=require(_0x9134('0x13'));var authService=require(_0x9134('0x14'));var qs=require(_0x9134('0x15'));var as=require(_0x9134('0x16'));var hardwareService=require(_0x9134('0x17'));var logger=require(_0x9134('0x18'))(_0x9134('0x19'));var utils=require(_0x9134('0x1a'));var config=require(_0x9134('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9134('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3c0af4,_0x115874){_0x115874=_0x115874||0xcc;return function(_0x31f3b8){if(_0x31f3b8){return _0x3c0af4[_0x9134('0x1d')](_0x115874);}return _0x3c0af4[_0x9134('0x1e')](_0x115874)['end']();};}function respondWithResult(_0x16b7c9,_0x24e3f6){_0x24e3f6=_0x24e3f6||0xc8;return function(_0x45b75b){if(_0x45b75b){return _0x16b7c9['status'](_0x24e3f6)[_0x9134('0x1f')](_0x45b75b);}};}function respondWithFilteredResult(_0xfa98f4,_0x432d7e){return function(_0x207d60){if(_0x207d60){var _0x58f335=typeof _0x432d7e[_0x9134('0x20')]===_0x9134('0x21')&&typeof _0x432d7e[_0x9134('0x22')]===_0x9134('0x21');var _0x3d3bb2=_0x207d60[_0x9134('0x23')];var _0xb86159=_0x58f335?0x0:_0x432d7e[_0x9134('0x20')];var _0x2977ac=_0x58f335?_0x207d60[_0x9134('0x23')]:_0x432d7e[_0x9134('0x20')]+_0x432d7e[_0x9134('0x22')];var _0x52a136;if(_0x2977ac>=_0x3d3bb2){_0x2977ac=_0x3d3bb2;_0x52a136=0xc8;}else{_0x52a136=0xce;}_0xfa98f4['status'](_0x52a136);return _0xfa98f4[_0x9134('0x24')](_0x9134('0x25'),_0xb86159+'-'+_0x2977ac+'/'+_0x3d3bb2)[_0x9134('0x1f')](_0x207d60);}return null;};}function patchUpdates(_0x289026){return function(_0x2ccebb){try{jsonpatch[_0x9134('0x26')](_0x2ccebb,_0x289026,!![]);}catch(_0x53887a){return BPromise[_0x9134('0x27')](_0x53887a);}return _0x2ccebb[_0x9134('0x28')]();};}function saveUpdates(_0x18b96c,_0x1617ac){return function(_0x338f57){if(_0x338f57){return _0x338f57[_0x9134('0x29')](_0x18b96c)[_0x9134('0x2a')](function(_0x48cb95){return _0x48cb95;});}return null;};}function removeEntity(_0x2acda7,_0x10e1f7){return function(_0x1a62e5){if(_0x1a62e5){return _0x1a62e5['destroy']()[_0x9134('0x2a')](function(){_0x2acda7[_0x9134('0x1e')](0xcc)[_0x9134('0x2b')]();});}};}function handleEntityNotFound(_0xc7152f,_0x5f5279){return function(_0x3374e2){if(!_0x3374e2){_0xc7152f[_0x9134('0x1d')](0x194);}return _0x3374e2;};}function handleError(_0x4b0a4b,_0x27cb46){_0x27cb46=_0x27cb46||0x1f4;return function(_0x398750){logger[_0x9134('0x2c')](_0x398750[_0x9134('0x2d')]);if(_0x398750[_0x9134('0x2e')]){delete _0x398750['name'];}_0x4b0a4b[_0x9134('0x1e')](_0x27cb46)['send'](_0x398750);};}exports[_0x9134('0x2f')]=function(_0x4aafab,_0x19ad34){var _0x4b9ae6={},_0x4c3649={},_0x398691={'count':0x0,'rows':[]};var _0x4d991c=_[_0x9134('0x30')](db['SugarcrmAccount']['rawAttributes'],function(_0x2c3300){return{'name':_0x2c3300['fieldName'],'type':_0x2c3300[_0x9134('0x31')][_0x9134('0x32')]};});_0x4c3649[_0x9134('0x33')]=_[_0x9134('0x30')](_0x4d991c,_0x9134('0x2e'));_0x4c3649[_0x9134('0x34')]=_[_0x9134('0x35')](_0x4aafab[_0x9134('0x34')]);_0x4c3649['filters']=_['intersection'](_0x4c3649[_0x9134('0x33')],_0x4c3649['query']);_0x4b9ae6['attributes']=_[_0x9134('0x36')](_0x4c3649[_0x9134('0x33')],qs[_0x9134('0x37')](_0x4aafab[_0x9134('0x34')][_0x9134('0x37')]));_0x4b9ae6[_0x9134('0x38')]=_0x4b9ae6[_0x9134('0x38')]['length']?_0x4b9ae6[_0x9134('0x38')]:_0x4c3649[_0x9134('0x33')];if(!_0x4aafab[_0x9134('0x34')][_0x9134('0x39')](_0x9134('0x3a'))){_0x4b9ae6['limit']=qs[_0x9134('0x22')](_0x4aafab[_0x9134('0x34')]['limit']);_0x4b9ae6['offset']=qs[_0x9134('0x20')](_0x4aafab['query'][_0x9134('0x20')]);}_0x4b9ae6[_0x9134('0x3b')]=qs['sort'](_0x4aafab[_0x9134('0x34')]['sort']);_0x4b9ae6[_0x9134('0x3c')]=qs[_0x9134('0x3d')](_[_0x9134('0x3e')](_0x4aafab[_0x9134('0x34')],_0x4c3649['filters']),_0x4d991c);if(_0x4aafab[_0x9134('0x34')][_0x9134('0x3f')]){_0x4b9ae6['where']=_[_0x9134('0x40')](_0x4b9ae6['where'],{'$or':_[_0x9134('0x30')](_0x4d991c,function(_0x2e36e5){if(_0x2e36e5[_0x9134('0x31')]!==_0x9134('0x41')){var _0x433f82={};_0x433f82[_0x2e36e5['name']]={'$like':'%'+_0x4aafab[_0x9134('0x34')][_0x9134('0x3f')]+'%'};return _0x433f82;}})});}_0x4b9ae6=_['merge']({},_0x4b9ae6,_0x4aafab[_0x9134('0x42')]);var _0x3ba45e={'where':_0x4b9ae6['where']};return db[_0x9134('0x43')][_0x9134('0x23')](_0x3ba45e)[_0x9134('0x2a')](function(_0x1e672c){_0x398691[_0x9134('0x23')]=_0x1e672c;if(_0x4aafab[_0x9134('0x34')][_0x9134('0x44')]){_0x4b9ae6[_0x9134('0x45')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x9134('0x46')](_0x4b9ae6);})[_0x9134('0x2a')](function(_0x3b5ade){_0x398691[_0x9134('0x47')]=_0x3b5ade;return _0x398691;})[_0x9134('0x2a')](respondWithFilteredResult(_0x19ad34,_0x4b9ae6))['catch'](handleError(_0x19ad34,null));};exports[_0x9134('0x48')]=function(_0x3ec907,_0x3ca704){var _0x372d56={'raw':![],'where':{'id':_0x3ec907[_0x9134('0x49')]['id']}},_0x4cfd02={};_0x4cfd02['model']=_[_0x9134('0x35')](db[_0x9134('0x43')][_0x9134('0x4a')]);_0x4cfd02[_0x9134('0x34')]=_['keys'](_0x3ec907['query']);_0x4cfd02['filters']=_['intersection'](_0x4cfd02[_0x9134('0x33')],_0x4cfd02[_0x9134('0x34')]);_0x372d56[_0x9134('0x38')]=_[_0x9134('0x36')](_0x4cfd02[_0x9134('0x33')],qs[_0x9134('0x37')](_0x3ec907[_0x9134('0x34')][_0x9134('0x37')]));_0x372d56[_0x9134('0x38')]=_0x372d56[_0x9134('0x38')][_0x9134('0x4b')]?_0x372d56['attributes']:_0x4cfd02[_0x9134('0x33')];if(_0x3ec907[_0x9134('0x34')][_0x9134('0x44')]){_0x372d56[_0x9134('0x45')]=[{'all':!![]}];}_0x372d56=_[_0x9134('0x40')]({},_0x372d56,_0x3ec907[_0x9134('0x42')]);return db[_0x9134('0x43')][_0x9134('0x4c')](_0x372d56)[_0x9134('0x2a')](handleEntityNotFound(_0x3ca704,null))['then'](respondWithResult(_0x3ca704,null))[_0x9134('0x4d')](handleError(_0x3ca704,null));};exports[_0x9134('0x4e')]=function(_0x1fc744,_0x1a7369){return db[_0x9134('0x43')][_0x9134('0x4e')](_0x1fc744[_0x9134('0x4f')],{})[_0x9134('0x2a')](respondWithResult(_0x1a7369,0xc9))['catch'](handleError(_0x1a7369,null));};exports['update']=function(_0xac6bcc,_0x3ddf7b){if(_0xac6bcc['body']['id']){delete _0xac6bcc['body']['id'];}return db[_0x9134('0x43')][_0x9134('0x4c')]({'where':{'id':_0xac6bcc['params']['id']}})[_0x9134('0x2a')](handleEntityNotFound(_0x3ddf7b,null))['then'](saveUpdates(_0xac6bcc[_0x9134('0x4f')],null))[_0x9134('0x2a')](respondWithResult(_0x3ddf7b,null))[_0x9134('0x4d')](handleError(_0x3ddf7b,null));};exports[_0x9134('0x50')]=function(_0x454749,_0x5ea30c){return db[_0x9134('0x43')][_0x9134('0x4c')]({'where':{'id':_0x454749[_0x9134('0x49')]['id']}})[_0x9134('0x2a')](handleEntityNotFound(_0x5ea30c,null))[_0x9134('0x2a')](removeEntity(_0x5ea30c,null))[_0x9134('0x4d')](handleError(_0x5ea30c,null));};exports['getConfigurations']=function(_0x542a49,_0xbc6050,_0x4adc29){var _0x5da368={};var _0xe322f2={};var _0x2011b5;var _0x9bcfd1;return db['SugarcrmAccount'][_0x9134('0x51')]({'where':{'id':_0x542a49['params']['id']}})['then'](handleEntityNotFound(_0xbc6050,null))[_0x9134('0x2a')](function(_0x1ed655){if(_0x1ed655){_0x2011b5=_0x1ed655;_0xe322f2[_0x9134('0x33')]=_[_0x9134('0x35')](db[_0x9134('0x52')]['rawAttributes']);_0xe322f2[_0x9134('0x34')]=_[_0x9134('0x35')](_0x542a49[_0x9134('0x34')]);_0xe322f2['filters']=_[_0x9134('0x36')](_0xe322f2['model'],_0xe322f2['query']);_0x5da368['attributes']=_[_0x9134('0x36')](_0xe322f2[_0x9134('0x33')],qs[_0x9134('0x37')](_0x542a49['query'][_0x9134('0x37')]));_0x5da368[_0x9134('0x38')]=_0x5da368[_0x9134('0x38')][_0x9134('0x4b')]?_0x5da368[_0x9134('0x38')]:_0xe322f2[_0x9134('0x33')];_0x5da368[_0x9134('0x3b')]=qs[_0x9134('0x53')](_0x542a49[_0x9134('0x34')][_0x9134('0x53')]);_0x5da368[_0x9134('0x3c')]=qs[_0x9134('0x3d')](_[_0x9134('0x3e')](_0x542a49[_0x9134('0x34')],_0xe322f2['filters']));if(_0x542a49[_0x9134('0x34')][_0x9134('0x3f')]){_0x5da368[_0x9134('0x3c')]=_[_0x9134('0x40')](_0x5da368[_0x9134('0x3c')],{'$or':_[_0x9134('0x30')](_0x5da368['attributes'],function(_0x1f123e){var _0x58ab19={};_0x58ab19[_0x1f123e]={'$like':'%'+_0x542a49[_0x9134('0x34')][_0x9134('0x3f')]+'%'};return _0x58ab19;})});}_0x5da368=_[_0x9134('0x40')]({},_0x5da368,_0x542a49['options']);return _0x2011b5[_0x9134('0x54')](_0x5da368);}})['then'](function(_0x49c599){if(_0x49c599){_0x9bcfd1=_0x49c599[_0x9134('0x4b')];if(!_0x542a49[_0x9134('0x34')][_0x9134('0x39')](_0x9134('0x3a'))){_0x5da368[_0x9134('0x22')]=qs[_0x9134('0x22')](_0x542a49[_0x9134('0x34')][_0x9134('0x22')]);_0x5da368[_0x9134('0x20')]=qs[_0x9134('0x20')](_0x542a49[_0x9134('0x34')][_0x9134('0x20')]);}return _0x2011b5[_0x9134('0x54')](_0x5da368);}})[_0x9134('0x2a')](function(_0xfe1645){if(_0xfe1645){return _0xfe1645?{'count':_0x9bcfd1,'rows':_0xfe1645}:null;}})[_0x9134('0x2a')](respondWithResult(_0xbc6050,null))[_0x9134('0x4d')](handleError(_0xbc6050,null));};exports['addConfiguration']=function(_0x578059,_0x5f0b28,_0x23fb85){if(_0x578059[_0x9134('0x4f')]['id']){delete _0x578059[_0x9134('0x4f')]['id'];}return db[_0x9134('0x43')][_0x9134('0x51')]({'where':{'id':_0x578059[_0x9134('0x49')]['id']}})[_0x9134('0x2a')](handleEntityNotFound(_0x5f0b28,null))[_0x9134('0x2a')](function(_0x4b494d){if(_0x4b494d){_0x578059[_0x9134('0x4f')][_0x9134('0x55')]=_0x4b494d['id'];_0x578059['body'][_0x9134('0x56')]=integrations['getSubjects'](_0x578059[_0x9134('0x4f')][_0x9134('0x57')],_0x578059[_0x9134('0x4f')]['type']);_0x578059[_0x9134('0x4f')][_0x9134('0x58')]=integrations[_0x9134('0x59')](_0x578059['body'][_0x9134('0x57')],_0x578059[_0x9134('0x4f')][_0x9134('0x31')]);return db[_0x9134('0x52')]['create'](_0x578059['body'],{'include':[{'model':db[_0x9134('0x5a')],'as':_0x9134('0x56')},{'model':db['SugarcrmField'],'as':_0x9134('0x58')}]});}return null;})[_0x9134('0x2a')](respondWithResult(_0x5f0b28,null))[_0x9134('0x4d')](handleError(_0x5f0b28,null));};exports['getFields']=function(_0x609aad,_0x15af99,_0xe96604){var _0xd6978b='';var _0x125e12=['id',_0x9134('0x2e'),_0x9134('0x5b'),_0x9134('0x5c'),_0x9134('0x5d'),_0x9134('0x5e'),_0x9134('0x5f'),_0x9134('0x60'),_0x9134('0x61'),_0x9134('0x62'),'parent_name',_0x9134('0x63')];return db[_0x9134('0x43')]['findOne']({'where':{'id':_0x609aad[_0x9134('0x49')]['id']},'attributes':['id',_0x9134('0x64'),_0x9134('0x65'),_0x9134('0x66')]})[_0x9134('0x2a')](handleEntityNotFound(_0x15af99,null))[_0x9134('0x2a')](function(_0x38acf9){if(_0x38acf9){_0xd6978b=_0x38acf9[_0x9134('0x66')];var _0x2e13f=_0xd6978b[_0x9134('0x67')](-0x1);if(_0x2e13f==='/'){_0xd6978b=_0xd6978b[_0x9134('0x68')](0x0,_0xd6978b[_0x9134('0x69')](_0x2e13f));}return rp({'method':_0x9134('0x6a'),'uri':util['format'](_0x9134('0x6b'),_0xd6978b,_0x9134('0x6c')),'json':!![],'form':{'method':_0x9134('0x6d'),'input_type':'JSON','response_type':_0x9134('0x6e'),'rest_data':JSON[_0x9134('0x6f')]({'user_auth':{'user_name':_0x38acf9[_0x9134('0x64')],'password':_0x38acf9[_0x9134('0x65')],'encryption':_0x9134('0x70')},'application':_0x9134('0x71')})}});}})[_0x9134('0x2a')](function(_0x5d870c){if(_0x5d870c&&_0x5d870c['name']!==_0x9134('0x72')&&_0x5d870c['name']!=='Password\x20Expired'){return rp({'method':_0x9134('0x6a'),'uri':util[_0x9134('0x73')](_0x9134('0x6b'),_0xd6978b,_0x9134('0x6c')),'json':!![],'form':{'method':_0x9134('0x74'),'input_type':_0x9134('0x6e'),'response_type':_0x9134('0x6e'),'rest_data':JSON['stringify']({'session':_0x5d870c['id'],'module_name':'Calls'})}})['then'](function(_0xfa342a){if(_0xfa342a){var _0x59f153=_[_0x9134('0x75')](_0xfa342a[_0x9134('0x76')]);_[_0x9134('0x77')](_0x59f153,function(_0x2cf7c2){return _0x125e12[_0x9134('0x78')](_0x2cf7c2[_0x9134('0x2e')]);});return{'count':_0x59f153[_0x9134('0x4b')],'rows':_['map'](_0x59f153,function(_0x47a32e){return{'id':_0x47a32e['name'],'name':_0x47a32e['label'],'custom':_[_0x9134('0x79')](_0x47a32e['name'],'_c')?!![]:![],'options':_0x47a32e[_0x9134('0x42')]?_[_0x9134('0x30')](_[_0x9134('0x75')](_0x47a32e['options']),function(_0x123e61){return{'name':_0x123e61['value'],'value':_0x123e61[_0x9134('0x2e')]};}):[]};})};}})[_0x9134('0x2a')](respondWithResult(_0x15af99,null))[_0x9134('0x4d')](function(_0x481703){var _0x6db0c9=_0x609aad[_0x9134('0x34')][_0x9134('0x7a')]?0x1f4:_0x481703[_0x9134('0x7b')]||0x1f4;logger[_0x9134('0x2c')](_0x9134('0x7c'),'getFields',_0x6db0c9,JSON[_0x9134('0x6f')](_0x481703));delete _0x481703[_0x9134('0x2e')];if(_0x6db0c9===0x191){_0x6db0c9=0x190;}_0x15af99[_0x9134('0x1e')](_0x6db0c9)[_0x9134('0x7d')](_0x609aad[_0x9134('0x34')][_0x9134('0x7a')]?{'message':_0x9134('0x7e'),'statusCode':_0x481703[_0x9134('0x7b')]}:_0x481703);});}else{var _0x385659=0x1f4;_0x15af99[_0x9134('0x1e')](_0x385659)[_0x9134('0x7d')]({'message':_0x9134('0x7e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x5196=['label','values','value','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','moment','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','SugarcrmAccount','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','rows','show','params','rawAttributes','include','find','catch','body','getConfigurations','findOne','SugarcrmConfiguration','options','hasOwnProperty','AccountId','channel','Descriptions','getDescriptions','create','Subjects','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','parent_id','parent_type','direction','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','module_fields','remove','includes'];(function(_0x1b3f8d,_0x433897){var _0xa0bc53=function(_0xd375a4){while(--_0xd375a4){_0x1b3f8d['push'](_0x1b3f8d['shift']());}};_0xa0bc53(++_0x433897);}(_0x5196,0x164));var _0x6519=function(_0x394a87,_0x44ca49){_0x394a87=_0x394a87-0x0;var _0x53b37a=_0x5196[_0x394a87];return _0x53b37a;};'use strict';var emlformat=require(_0x6519('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6519('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6519('0x2'));var BPromise=require(_0x6519('0x3'));var Mustache=require(_0x6519('0x4'));var util=require(_0x6519('0x5'));var path=require('path');var sox=require(_0x6519('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6519('0x7'));var squel=require(_0x6519('0x8'));var crypto=require(_0x6519('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6519('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6519('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6519('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6519('0xd'));var logger=require(_0x6519('0xe'))(_0x6519('0xf'));var utils=require(_0x6519('0x10'));var config=require(_0x6519('0x11'));var licenseUtil=require(_0x6519('0x12'));var db=require(_0x6519('0x13'))['db'];var integrations=require(_0x6519('0x14'));function respondWithStatusCode(_0x47768c,_0xafeb1b){_0xafeb1b=_0xafeb1b||0xcc;return function(_0x2968fd){if(_0x2968fd){return _0x47768c[_0x6519('0x15')](_0xafeb1b);}return _0x47768c[_0x6519('0x16')](_0xafeb1b)[_0x6519('0x17')]();};}function respondWithResult(_0x46acd9,_0x180ee7){_0x180ee7=_0x180ee7||0xc8;return function(_0x30d247){if(_0x30d247){return _0x46acd9[_0x6519('0x16')](_0x180ee7)[_0x6519('0x18')](_0x30d247);}};}function respondWithFilteredResult(_0x1b7ec9,_0x22d6d5){return function(_0x1aadf6){if(_0x1aadf6){var _0x44783a=typeof _0x22d6d5['offset']===_0x6519('0x19')&&typeof _0x22d6d5[_0x6519('0x1a')]===_0x6519('0x19');var _0x415b61=_0x1aadf6['count'];var _0x3078e7=_0x44783a?0x0:_0x22d6d5[_0x6519('0x1b')];var _0x151f09=_0x44783a?_0x1aadf6[_0x6519('0x1c')]:_0x22d6d5[_0x6519('0x1b')]+_0x22d6d5[_0x6519('0x1a')];var _0x616033;if(_0x151f09>=_0x415b61){_0x151f09=_0x415b61;_0x616033=0xc8;}else{_0x616033=0xce;}_0x1b7ec9[_0x6519('0x16')](_0x616033);return _0x1b7ec9[_0x6519('0x1d')](_0x6519('0x1e'),_0x3078e7+'-'+_0x151f09+'/'+_0x415b61)[_0x6519('0x18')](_0x1aadf6);}return null;};}function patchUpdates(_0x12005a){return function(_0x22bc5f){try{jsonpatch[_0x6519('0x1f')](_0x22bc5f,_0x12005a,!![]);}catch(_0x232e88){return BPromise[_0x6519('0x20')](_0x232e88);}return _0x22bc5f[_0x6519('0x21')]();};}function saveUpdates(_0x1d5b4e,_0x4c557e){return function(_0x20d3c8){if(_0x20d3c8){return _0x20d3c8[_0x6519('0x22')](_0x1d5b4e)['then'](function(_0x804407){return _0x804407;});}return null;};}function removeEntity(_0x13f56a,_0x354b08){return function(_0x2af90a){if(_0x2af90a){return _0x2af90a[_0x6519('0x23')]()[_0x6519('0x24')](function(){_0x13f56a['status'](0xcc)[_0x6519('0x17')]();});}};}function handleEntityNotFound(_0x355757,_0x559b4e){return function(_0x289b4f){if(!_0x289b4f){_0x355757[_0x6519('0x15')](0x194);}return _0x289b4f;};}function handleError(_0x25e305,_0x1143cf){_0x1143cf=_0x1143cf||0x1f4;return function(_0x5bbf7c){logger[_0x6519('0x25')](_0x5bbf7c[_0x6519('0x26')]);if(_0x5bbf7c[_0x6519('0x27')]){delete _0x5bbf7c['name'];}_0x25e305['status'](_0x1143cf)['send'](_0x5bbf7c);};}exports['index']=function(_0x24b57a,_0x1621e2){var _0x2d97ff={},_0x4fe402={},_0x3f72ca={'count':0x0,'rows':[]};var _0x277cce=_[_0x6519('0x28')](db[_0x6519('0x29')]['rawAttributes'],function(_0x21e698){return{'name':_0x21e698['fieldName'],'type':_0x21e698[_0x6519('0x2a')][_0x6519('0x2b')]};});_0x4fe402['model']=_[_0x6519('0x28')](_0x277cce,_0x6519('0x27'));_0x4fe402[_0x6519('0x2c')]=_[_0x6519('0x2d')](_0x24b57a[_0x6519('0x2c')]);_0x4fe402['filters']=_[_0x6519('0x2e')](_0x4fe402[_0x6519('0x2f')],_0x4fe402['query']);_0x2d97ff['attributes']=_[_0x6519('0x2e')](_0x4fe402['model'],qs[_0x6519('0x30')](_0x24b57a[_0x6519('0x2c')][_0x6519('0x30')]));_0x2d97ff['attributes']=_0x2d97ff[_0x6519('0x31')][_0x6519('0x32')]?_0x2d97ff[_0x6519('0x31')]:_0x4fe402[_0x6519('0x2f')];if(!_0x24b57a['query']['hasOwnProperty'](_0x6519('0x33'))){_0x2d97ff[_0x6519('0x1a')]=qs['limit'](_0x24b57a[_0x6519('0x2c')]['limit']);_0x2d97ff[_0x6519('0x1b')]=qs['offset'](_0x24b57a['query']['offset']);}_0x2d97ff['order']=qs[_0x6519('0x34')](_0x24b57a[_0x6519('0x2c')][_0x6519('0x34')]);_0x2d97ff['where']=qs[_0x6519('0x35')](_[_0x6519('0x36')](_0x24b57a[_0x6519('0x2c')],_0x4fe402[_0x6519('0x35')]),_0x277cce);if(_0x24b57a[_0x6519('0x2c')][_0x6519('0x37')]){_0x2d97ff[_0x6519('0x38')]=_[_0x6519('0x39')](_0x2d97ff[_0x6519('0x38')],{'$or':_[_0x6519('0x28')](_0x277cce,function(_0x54fab0){if(_0x54fab0[_0x6519('0x2a')]!==_0x6519('0x3a')){var _0x4e4830={};_0x4e4830[_0x54fab0['name']]={'$like':'%'+_0x24b57a[_0x6519('0x2c')][_0x6519('0x37')]+'%'};return _0x4e4830;}})});}_0x2d97ff=_[_0x6519('0x39')]({},_0x2d97ff,_0x24b57a['options']);var _0x4917f9={'where':_0x2d97ff[_0x6519('0x38')]};return db['SugarcrmAccount'][_0x6519('0x1c')](_0x4917f9)[_0x6519('0x24')](function(_0x355880){_0x3f72ca['count']=_0x355880;if(_0x24b57a[_0x6519('0x2c')][_0x6519('0x3b')]){_0x2d97ff['include']=[{'all':!![]}];}return db[_0x6519('0x29')]['findAll'](_0x2d97ff);})[_0x6519('0x24')](function(_0x44af94){_0x3f72ca[_0x6519('0x3c')]=_0x44af94;return _0x3f72ca;})[_0x6519('0x24')](respondWithFilteredResult(_0x1621e2,_0x2d97ff))['catch'](handleError(_0x1621e2,null));};exports[_0x6519('0x3d')]=function(_0x3e6179,_0x50b2ef){var _0x5e4a1a={'raw':![],'where':{'id':_0x3e6179[_0x6519('0x3e')]['id']}},_0x39de85={};_0x39de85[_0x6519('0x2f')]=_[_0x6519('0x2d')](db[_0x6519('0x29')][_0x6519('0x3f')]);_0x39de85[_0x6519('0x2c')]=_[_0x6519('0x2d')](_0x3e6179[_0x6519('0x2c')]);_0x39de85[_0x6519('0x35')]=_[_0x6519('0x2e')](_0x39de85['model'],_0x39de85[_0x6519('0x2c')]);_0x5e4a1a['attributes']=_[_0x6519('0x2e')](_0x39de85[_0x6519('0x2f')],qs[_0x6519('0x30')](_0x3e6179[_0x6519('0x2c')][_0x6519('0x30')]));_0x5e4a1a['attributes']=_0x5e4a1a['attributes']['length']?_0x5e4a1a[_0x6519('0x31')]:_0x39de85['model'];if(_0x3e6179['query'][_0x6519('0x3b')]){_0x5e4a1a[_0x6519('0x40')]=[{'all':!![]}];}_0x5e4a1a=_[_0x6519('0x39')]({},_0x5e4a1a,_0x3e6179['options']);return db[_0x6519('0x29')][_0x6519('0x41')](_0x5e4a1a)[_0x6519('0x24')](handleEntityNotFound(_0x50b2ef,null))[_0x6519('0x24')](respondWithResult(_0x50b2ef,null))[_0x6519('0x42')](handleError(_0x50b2ef,null));};exports['create']=function(_0x4c0a1c,_0x9f3fe7){return db[_0x6519('0x29')]['create'](_0x4c0a1c[_0x6519('0x43')],{})['then'](respondWithResult(_0x9f3fe7,0xc9))[_0x6519('0x42')](handleError(_0x9f3fe7,null));};exports[_0x6519('0x22')]=function(_0x14beac,_0x387200){if(_0x14beac['body']['id']){delete _0x14beac[_0x6519('0x43')]['id'];}return db[_0x6519('0x29')][_0x6519('0x41')]({'where':{'id':_0x14beac[_0x6519('0x3e')]['id']}})[_0x6519('0x24')](handleEntityNotFound(_0x387200,null))[_0x6519('0x24')](saveUpdates(_0x14beac[_0x6519('0x43')],null))[_0x6519('0x24')](respondWithResult(_0x387200,null))[_0x6519('0x42')](handleError(_0x387200,null));};exports[_0x6519('0x23')]=function(_0x69a72b,_0x25ca8a){return db[_0x6519('0x29')][_0x6519('0x41')]({'where':{'id':_0x69a72b[_0x6519('0x3e')]['id']}})['then'](handleEntityNotFound(_0x25ca8a,null))['then'](removeEntity(_0x25ca8a,null))[_0x6519('0x42')](handleError(_0x25ca8a,null));};exports[_0x6519('0x44')]=function(_0x2b7e50,_0x5b6fd2,_0x5a2228){var _0x27e9a7={};var _0x1d3c2b={};var _0x4ca537;var _0x26e21e;return db['SugarcrmAccount'][_0x6519('0x45')]({'where':{'id':_0x2b7e50[_0x6519('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5b6fd2,null))[_0x6519('0x24')](function(_0x548473){if(_0x548473){_0x4ca537=_0x548473;_0x1d3c2b['model']=_['keys'](db[_0x6519('0x46')]['rawAttributes']);_0x1d3c2b[_0x6519('0x2c')]=_[_0x6519('0x2d')](_0x2b7e50['query']);_0x1d3c2b[_0x6519('0x35')]=_[_0x6519('0x2e')](_0x1d3c2b['model'],_0x1d3c2b[_0x6519('0x2c')]);_0x27e9a7[_0x6519('0x31')]=_['intersection'](_0x1d3c2b[_0x6519('0x2f')],qs['fields'](_0x2b7e50[_0x6519('0x2c')]['fields']));_0x27e9a7[_0x6519('0x31')]=_0x27e9a7[_0x6519('0x31')][_0x6519('0x32')]?_0x27e9a7[_0x6519('0x31')]:_0x1d3c2b['model'];_0x27e9a7['order']=qs[_0x6519('0x34')](_0x2b7e50[_0x6519('0x2c')][_0x6519('0x34')]);_0x27e9a7[_0x6519('0x38')]=qs[_0x6519('0x35')](_[_0x6519('0x36')](_0x2b7e50[_0x6519('0x2c')],_0x1d3c2b[_0x6519('0x35')]));if(_0x2b7e50[_0x6519('0x2c')]['filter']){_0x27e9a7[_0x6519('0x38')]=_[_0x6519('0x39')](_0x27e9a7[_0x6519('0x38')],{'$or':_[_0x6519('0x28')](_0x27e9a7[_0x6519('0x31')],function(_0x2c9485){var _0x3ff0cc={};_0x3ff0cc[_0x2c9485]={'$like':'%'+_0x2b7e50[_0x6519('0x2c')][_0x6519('0x37')]+'%'};return _0x3ff0cc;})});}_0x27e9a7=_['merge']({},_0x27e9a7,_0x2b7e50[_0x6519('0x47')]);return _0x4ca537['getConfigurations'](_0x27e9a7);}})[_0x6519('0x24')](function(_0x4139cc){if(_0x4139cc){_0x26e21e=_0x4139cc[_0x6519('0x32')];if(!_0x2b7e50[_0x6519('0x2c')][_0x6519('0x48')](_0x6519('0x33'))){_0x27e9a7[_0x6519('0x1a')]=qs[_0x6519('0x1a')](_0x2b7e50['query'][_0x6519('0x1a')]);_0x27e9a7[_0x6519('0x1b')]=qs[_0x6519('0x1b')](_0x2b7e50[_0x6519('0x2c')][_0x6519('0x1b')]);}return _0x4ca537[_0x6519('0x44')](_0x27e9a7);}})[_0x6519('0x24')](function(_0x4a5667){if(_0x4a5667){return _0x4a5667?{'count':_0x26e21e,'rows':_0x4a5667}:null;}})[_0x6519('0x24')](respondWithResult(_0x5b6fd2,null))[_0x6519('0x42')](handleError(_0x5b6fd2,null));};exports['addConfiguration']=function(_0x5a6579,_0x528864,_0x33606a){if(_0x5a6579['body']['id']){delete _0x5a6579[_0x6519('0x43')]['id'];}return db[_0x6519('0x29')][_0x6519('0x45')]({'where':{'id':_0x5a6579[_0x6519('0x3e')]['id']}})['then'](handleEntityNotFound(_0x528864,null))[_0x6519('0x24')](function(_0x3a63c2){if(_0x3a63c2){_0x5a6579[_0x6519('0x43')][_0x6519('0x49')]=_0x3a63c2['id'];_0x5a6579[_0x6519('0x43')]['Subjects']=integrations['getSubjects'](_0x5a6579[_0x6519('0x43')][_0x6519('0x4a')],_0x5a6579[_0x6519('0x43')][_0x6519('0x2a')]);_0x5a6579['body'][_0x6519('0x4b')]=integrations[_0x6519('0x4c')](_0x5a6579[_0x6519('0x43')][_0x6519('0x4a')],_0x5a6579[_0x6519('0x43')][_0x6519('0x2a')]);return db[_0x6519('0x46')][_0x6519('0x4d')](_0x5a6579[_0x6519('0x43')],{'include':[{'model':db['SugarcrmField'],'as':_0x6519('0x4e')},{'model':db[_0x6519('0x4f')],'as':_0x6519('0x4b')}]});}return null;})[_0x6519('0x24')](respondWithResult(_0x528864,null))[_0x6519('0x42')](handleError(_0x528864,null));};exports[_0x6519('0x50')]=function(_0x2bfc92,_0x888b37,_0x3ef344){var _0x50719b='';var _0x4ff51d=['id',_0x6519('0x27'),_0x6519('0x51'),_0x6519('0x52'),'description',_0x6519('0x53'),_0x6519('0x54'),'duration_minutes',_0x6519('0x55'),_0x6519('0x56'),'parent_name',_0x6519('0x57')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x2bfc92[_0x6519('0x3e')]['id']},'attributes':['id','username','password','remoteUri']})['then'](handleEntityNotFound(_0x888b37,null))[_0x6519('0x24')](function(_0x4cad86){if(_0x4cad86){_0x50719b=_0x4cad86[_0x6519('0x58')];var _0x2d4ce2=_0x50719b[_0x6519('0x59')](-0x1);if(_0x2d4ce2==='/'){_0x50719b=_0x50719b[_0x6519('0x5a')](0x0,_0x50719b[_0x6519('0x5b')](_0x2d4ce2));}return rp({'method':'POST','uri':util[_0x6519('0x5c')](_0x6519('0x5d'),_0x50719b,_0x6519('0x5e')),'json':!![],'form':{'method':_0x6519('0x5f'),'input_type':_0x6519('0x60'),'response_type':_0x6519('0x60'),'rest_data':JSON[_0x6519('0x61')]({'user_auth':{'user_name':_0x4cad86['username'],'password':_0x4cad86[_0x6519('0x62')],'encryption':'PLAIN'},'application':_0x6519('0x63')})}});}})[_0x6519('0x24')](function(_0x461b6b){if(_0x461b6b&&_0x461b6b[_0x6519('0x27')]!==_0x6519('0x64')&&_0x461b6b['name']!==_0x6519('0x65')){return rp({'method':_0x6519('0x66'),'uri':util['format'](_0x6519('0x5d'),_0x50719b,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6519('0x67'),'input_type':_0x6519('0x60'),'response_type':_0x6519('0x60'),'rest_data':JSON[_0x6519('0x61')]({'session':_0x461b6b['id'],'module_name':_0x6519('0x68')})}})[_0x6519('0x24')](function(_0x5cd893){if(_0x5cd893){var _0x6c8ef1=_['values'](_0x5cd893[_0x6519('0x69')]);_[_0x6519('0x6a')](_0x6c8ef1,function(_0xb8042a){return _0x4ff51d[_0x6519('0x6b')](_0xb8042a[_0x6519('0x27')]);});return{'count':_0x6c8ef1[_0x6519('0x32')],'rows':_[_0x6519('0x28')](_0x6c8ef1,function(_0x43721b){return{'id':_0x43721b[_0x6519('0x27')],'name':_0x43721b[_0x6519('0x6c')],'custom':_['endsWith'](_0x43721b[_0x6519('0x27')],'_c')?!![]:![],'options':_0x43721b[_0x6519('0x47')]?_[_0x6519('0x28')](_[_0x6519('0x6d')](_0x43721b[_0x6519('0x47')]),function(_0x17c89c){return{'name':_0x17c89c[_0x6519('0x6e')],'value':_0x17c89c['name']};}):[]};})};}})['then'](respondWithResult(_0x888b37,null))[_0x6519('0x42')](function(_0x2baff4){var _0x1370e=_0x2bfc92[_0x6519('0x2c')][_0x6519('0x6f')]?0x1f4:_0x2baff4['statusCode']||0x1f4;logger[_0x6519('0x25')](_0x6519('0x70'),_0x6519('0x50'),_0x1370e,JSON[_0x6519('0x61')](_0x2baff4));delete _0x2baff4[_0x6519('0x27')];if(_0x1370e===0x191){_0x1370e=0x190;}_0x888b37[_0x6519('0x16')](_0x1370e)[_0x6519('0x71')](_0x2bfc92['query'][_0x6519('0x6f')]?{'message':_0x6519('0x72'),'statusCode':_0x2baff4[_0x6519('0x73')]}:_0x2baff4);});}else{var _0x20906=0x1f4;_0x888b37['status'](_0x20906)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 51e0b90..2c9fbe8 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 _0xbb9e=['rimraf','../../config/environment','define','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xbb9e,0xf4));var _0xebb9=function(_0x3d1e54,_0x3b961b){_0x3d1e54=_0x3d1e54-0x0;var _0x313e75=_0xbb9e[_0x3d1e54];return _0x313e75;};'use strict';var _=require(_0xebb9('0x0'));var util=require('util');var logger=require(_0xebb9('0x1'))(_0xebb9('0x2'));var moment=require(_0xebb9('0x3'));var BPromise=require(_0xebb9('0x4'));var rp=require(_0xebb9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebb9('0x6'));var config=require(_0xebb9('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xd576d4,_0x17889c){return _0xd576d4[_0xebb9('0x8')]('SugarcrmAccount',attributes,{'tableName':_0xebb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6333=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x16065c,_0x52411f){var _0x5171e9=function(_0x92ef87){while(--_0x92ef87){_0x16065c['push'](_0x16065c['shift']());}};_0x5171e9(++_0x52411f);}(_0x6333,0x185));var _0x3633=function(_0x395021,_0x447059){_0x395021=_0x395021-0x0;var _0x5a4dae=_0x6333[_0x395021];return _0x5a4dae;};'use strict';var _=require(_0x3633('0x0'));var util=require(_0x3633('0x1'));var logger=require(_0x3633('0x2'))('api');var moment=require(_0x3633('0x3'));var BPromise=require(_0x3633('0x4'));var rp=require(_0x3633('0x5'));var fs=require('fs');var path=require(_0x3633('0x6'));var rimraf=require(_0x3633('0x7'));var config=require(_0x3633('0x8'));var attributes=require(_0x3633('0x9'));var integrations=require(_0x3633('0xa'));module[_0x3633('0xb')]=function(_0x5a8701,_0xa64829){return _0x5a8701[_0x3633('0xc')]('SugarcrmAccount',attributes,{'tableName':_0x3633('0xd'),'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 f18d179..ca33619 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 _0xb7b2=['debug','GetSugarcrmAccount','ShowSugarcrmAccount','find','then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','SugarcrmAccount','findAll','raw','where','options','attributes','limit','include','map','model'];(function(_0x52672f,_0x278e34){var _0x205d5a=function(_0x51d802){while(--_0x51d802){_0x52672f['push'](_0x52672f['shift']());}};_0x205d5a(++_0x278e34);}(_0xb7b2,0xc5));var _0x2b7b=function(_0x59b4df,_0x48c7fe){_0x59b4df=_0x59b4df-0x0;var _0x561e39=_0xb7b2[_0x59b4df];return _0x561e39;};'use strict';var _=require('lodash');var util=require(_0x2b7b('0x0'));var moment=require(_0x2b7b('0x1'));var BPromise=require(_0x2b7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b7b('0x4'));var logger=require(_0x2b7b('0x5'))('rpc');var config=require(_0x2b7b('0x6'));var jayson=require(_0x2b7b('0x7'));var client=jayson[_0x2b7b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f282,_0x39df5e,_0x4c1fd1){return new BPromise(function(_0x4ee863,_0x350f57){return client[_0x2b7b('0x9')](_0x10f282,_0x4c1fd1)['then'](function(_0x76eaf3){logger['info'](_0x2b7b('0xa'),_0x39df5e,_0x2b7b('0xb'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x39df5e,_0x2b7b('0xb'),JSON[_0x2b7b('0xc')](_0x76eaf3));if(_0x76eaf3['error']){if(_0x76eaf3[_0x2b7b('0xd')]['code']===0x1f4){logger[_0x2b7b('0xd')](_0x2b7b('0xa'),_0x39df5e,_0x76eaf3[_0x2b7b('0xd')][_0x2b7b('0xe')]);return _0x350f57(_0x76eaf3[_0x2b7b('0xd')][_0x2b7b('0xe')]);}logger[_0x2b7b('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x39df5e,_0x76eaf3['error']['message']);return _0x4ee863(_0x76eaf3[_0x2b7b('0xd')][_0x2b7b('0xe')]);}else{logger[_0x2b7b('0xf')](_0x2b7b('0xa'),_0x39df5e,_0x2b7b('0xb'));_0x4ee863(_0x76eaf3['result'][_0x2b7b('0xe')]);}})[_0x2b7b('0x10')](function(_0x32c3c6){logger[_0x2b7b('0xd')](_0x2b7b('0xa'),_0x39df5e,_0x32c3c6);_0x350f57(_0x32c3c6);});});}exports['GetSugarcrmAccount']=function(_0x204ab2){var _0x3e4550=this;return new Promise(function(_0x3bf081,_0xb0c07f){return db[_0x2b7b('0x11')][_0x2b7b('0x12')]({'raw':_0x204ab2['options']?_0x204ab2['options'][_0x2b7b('0x13')]===undefined?!![]:![]:!![],'where':_0x204ab2['options']?_0x204ab2['options'][_0x2b7b('0x14')]||null:null,'attributes':_0x204ab2[_0x2b7b('0x15')]?_0x204ab2[_0x2b7b('0x15')][_0x2b7b('0x16')]||null:null,'limit':_0x204ab2[_0x2b7b('0x15')]?_0x204ab2['options'][_0x2b7b('0x17')]||null:null,'include':_0x204ab2[_0x2b7b('0x15')]?_0x204ab2[_0x2b7b('0x15')][_0x2b7b('0x18')]?_[_0x2b7b('0x19')](_0x204ab2[_0x2b7b('0x15')][_0x2b7b('0x18')],function(_0x56e2ef){return{'model':db[_0x56e2ef[_0x2b7b('0x1a')]],'as':_0x56e2ef['as'],'attributes':_0x56e2ef[_0x2b7b('0x16')],'include':_0x56e2ef[_0x2b7b('0x18')]?_['map'](_0x56e2ef[_0x2b7b('0x18')],function(_0x3b00e0){return{'model':db[_0x3b00e0[_0x2b7b('0x1a')]],'as':_0x3b00e0['as'],'attributes':_0x3b00e0[_0x2b7b('0x16')],'include':_0x3b00e0[_0x2b7b('0x18')]?_[_0x2b7b('0x19')](_0x3b00e0[_0x2b7b('0x18')],function(_0x472b26){return{'model':db[_0x472b26[_0x2b7b('0x1a')]],'as':_0x472b26['as'],'attributes':_0x472b26[_0x2b7b('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x335de2){logger[_0x2b7b('0xf')]('GetSugarcrmAccount',_0x204ab2);logger[_0x2b7b('0x1b')](_0x2b7b('0x1c'),_0x204ab2,JSON['stringify'](_0x335de2));_0x3bf081(_0x335de2);})[_0x2b7b('0x10')](function(_0xd4a829){logger[_0x2b7b('0xd')](_0x2b7b('0x1c'),_0xd4a829[_0x2b7b('0xe')],_0x204ab2);_0xb0c07f(_0x3e4550['error'](0x1f4,_0xd4a829[_0x2b7b('0xe')]));});});};exports[_0x2b7b('0x1d')]=function(_0x2e1ce6){var _0x504b09=this;return new Promise(function(_0x1bcef3,_0x158efd){return db[_0x2b7b('0x11')][_0x2b7b('0x1e')]({'raw':_0x2e1ce6[_0x2b7b('0x15')]?_0x2e1ce6[_0x2b7b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2e1ce6['options']?_0x2e1ce6[_0x2b7b('0x15')]['where']||null:null,'attributes':_0x2e1ce6[_0x2b7b('0x15')]?_0x2e1ce6['options']['attributes']||null:null,'include':_0x2e1ce6[_0x2b7b('0x15')]?_0x2e1ce6[_0x2b7b('0x15')]['include']?_[_0x2b7b('0x19')](_0x2e1ce6['options'][_0x2b7b('0x18')],function(_0xccf44a){return{'model':db[_0xccf44a[_0x2b7b('0x1a')]],'as':_0xccf44a['as'],'attributes':_0xccf44a[_0x2b7b('0x16')],'include':_0xccf44a[_0x2b7b('0x18')]?_[_0x2b7b('0x19')](_0xccf44a[_0x2b7b('0x18')],function(_0x5cb2a7){return{'model':db[_0x5cb2a7[_0x2b7b('0x1a')]],'as':_0x5cb2a7['as'],'attributes':_0x5cb2a7[_0x2b7b('0x16')],'include':_0x5cb2a7[_0x2b7b('0x18')]?_['map'](_0x5cb2a7[_0x2b7b('0x18')],function(_0x517eac){return{'model':db[_0x517eac[_0x2b7b('0x1a')]],'as':_0x517eac['as'],'attributes':_0x517eac[_0x2b7b('0x16')]};}):[]};}):[]};}):[]:[]})[_0x2b7b('0x1f')](function(_0x88f01a){logger[_0x2b7b('0xf')](_0x2b7b('0x1d'),_0x2e1ce6);logger[_0x2b7b('0x1b')](_0x2b7b('0x1d'),_0x2e1ce6,JSON[_0x2b7b('0xc')](_0x88f01a));_0x1bcef3(_0x88f01a);})[_0x2b7b('0x10')](function(_0x331ffe){logger[_0x2b7b('0xd')](_0x2b7b('0x1d'),_0x331ffe[_0x2b7b('0xe')],_0x2e1ce6);_0x158efd(_0x504b09[_0x2b7b('0xd')](0x1f4,_0x331ffe[_0x2b7b('0xe')]));});});}; \ No newline at end of file +var _0x9519=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','options','raw','attributes','limit','map','include','model','ShowSugarcrmAccount','SugarcrmAccount','find','util','moment','bluebird','randomstring'];(function(_0x5ce7ff,_0x9cd861){var _0x43df3c=function(_0x58a3a2){while(--_0x58a3a2){_0x5ce7ff['push'](_0x5ce7ff['shift']());}};_0x43df3c(++_0x9cd861);}(_0x9519,0x15a));var _0x9951=function(_0x37731d,_0x105aa1){_0x37731d=_0x37731d-0x0;var _0x570e65=_0x9519[_0x37731d];return _0x570e65;};'use strict';var _=require('lodash');var util=require(_0x9951('0x0'));var moment=require(_0x9951('0x1'));var BPromise=require(_0x9951('0x2'));var rs=require(_0x9951('0x3'));var fs=require('fs');var Redis=require(_0x9951('0x4'));var db=require(_0x9951('0x5'))['db'];var utils=require(_0x9951('0x6'));var logger=require(_0x9951('0x7'))(_0x9951('0x8'));var config=require('../../config/environment');var jayson=require(_0x9951('0x9'));var client=jayson['client'][_0x9951('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48faac,_0x771cb9,_0x3fb8c7){return new BPromise(function(_0x4ea7a5,_0x50b34d){return client[_0x9951('0xb')](_0x48faac,_0x3fb8c7)[_0x9951('0xc')](function(_0x26dd8e){logger['info'](_0x9951('0xd'),_0x771cb9,_0x9951('0xe'));logger[_0x9951('0xf')](_0x9951('0x10'),_0x771cb9,'request\x20sent',JSON[_0x9951('0x11')](_0x26dd8e));if(_0x26dd8e[_0x9951('0x12')]){if(_0x26dd8e[_0x9951('0x12')][_0x9951('0x13')]===0x1f4){logger[_0x9951('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x771cb9,_0x26dd8e[_0x9951('0x12')][_0x9951('0x14')]);return _0x50b34d(_0x26dd8e[_0x9951('0x12')][_0x9951('0x14')]);}logger[_0x9951('0x12')](_0x9951('0xd'),_0x771cb9,_0x26dd8e['error'][_0x9951('0x14')]);return _0x4ea7a5(_0x26dd8e[_0x9951('0x12')][_0x9951('0x14')]);}else{logger[_0x9951('0x15')]('SugarcrmAccount,\x20%s,\x20%s',_0x771cb9,_0x9951('0xe'));_0x4ea7a5(_0x26dd8e[_0x9951('0x16')][_0x9951('0x14')]);}})[_0x9951('0x17')](function(_0x5ba348){logger[_0x9951('0x12')](_0x9951('0xd'),_0x771cb9,_0x5ba348);_0x50b34d(_0x5ba348);});});}exports[_0x9951('0x18')]=function(_0x2ba55e){var _0xe1a58a=this;return new Promise(function(_0x1f955d,_0x328fb2){return db['SugarcrmAccount']['findAll']({'raw':_0x2ba55e[_0x9951('0x19')]?_0x2ba55e[_0x9951('0x19')][_0x9951('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ba55e[_0x9951('0x19')]?_0x2ba55e[_0x9951('0x19')]['where']||null:null,'attributes':_0x2ba55e[_0x9951('0x19')]?_0x2ba55e['options'][_0x9951('0x1b')]||null:null,'limit':_0x2ba55e[_0x9951('0x19')]?_0x2ba55e[_0x9951('0x19')][_0x9951('0x1c')]||null:null,'include':_0x2ba55e[_0x9951('0x19')]?_0x2ba55e[_0x9951('0x19')]['include']?_[_0x9951('0x1d')](_0x2ba55e[_0x9951('0x19')][_0x9951('0x1e')],function(_0x3438fa){return{'model':db[_0x3438fa[_0x9951('0x1f')]],'as':_0x3438fa['as'],'attributes':_0x3438fa[_0x9951('0x1b')],'include':_0x3438fa[_0x9951('0x1e')]?_[_0x9951('0x1d')](_0x3438fa['include'],function(_0x328210){return{'model':db[_0x328210[_0x9951('0x1f')]],'as':_0x328210['as'],'attributes':_0x328210[_0x9951('0x1b')],'include':_0x328210[_0x9951('0x1e')]?_[_0x9951('0x1d')](_0x328210[_0x9951('0x1e')],function(_0x492f17){return{'model':db[_0x492f17[_0x9951('0x1f')]],'as':_0x492f17['as'],'attributes':_0x492f17['attributes']};}):[]};}):[]};}):[]:[]})[_0x9951('0xc')](function(_0x341e9d){logger['info']('GetSugarcrmAccount',_0x2ba55e);logger[_0x9951('0xf')](_0x9951('0x18'),_0x2ba55e,JSON[_0x9951('0x11')](_0x341e9d));_0x1f955d(_0x341e9d);})[_0x9951('0x17')](function(_0x368cb4){logger[_0x9951('0x12')](_0x9951('0x18'),_0x368cb4['message'],_0x2ba55e);_0x328fb2(_0xe1a58a[_0x9951('0x12')](0x1f4,_0x368cb4[_0x9951('0x14')]));});});};exports[_0x9951('0x20')]=function(_0x50ee75){var _0x3b1b4f=this;return new Promise(function(_0x52e258,_0x2cb2e9){return db[_0x9951('0x21')][_0x9951('0x22')]({'raw':_0x50ee75[_0x9951('0x19')]?_0x50ee75['options']['raw']===undefined?!![]:![]:!![],'where':_0x50ee75['options']?_0x50ee75[_0x9951('0x19')]['where']||null:null,'attributes':_0x50ee75['options']?_0x50ee75[_0x9951('0x19')][_0x9951('0x1b')]||null:null,'include':_0x50ee75[_0x9951('0x19')]?_0x50ee75['options'][_0x9951('0x1e')]?_[_0x9951('0x1d')](_0x50ee75[_0x9951('0x19')][_0x9951('0x1e')],function(_0x562843){return{'model':db[_0x562843[_0x9951('0x1f')]],'as':_0x562843['as'],'attributes':_0x562843[_0x9951('0x1b')],'include':_0x562843[_0x9951('0x1e')]?_[_0x9951('0x1d')](_0x562843[_0x9951('0x1e')],function(_0x2d31b2){return{'model':db[_0x2d31b2[_0x9951('0x1f')]],'as':_0x2d31b2['as'],'attributes':_0x2d31b2[_0x9951('0x1b')],'include':_0x2d31b2[_0x9951('0x1e')]?_[_0x9951('0x1d')](_0x2d31b2[_0x9951('0x1e')],function(_0x5e3387){return{'model':db[_0x5e3387[_0x9951('0x1f')]],'as':_0x5e3387['as'],'attributes':_0x5e3387[_0x9951('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9951('0xc')](function(_0x5354a3){logger[_0x9951('0x15')]('ShowSugarcrmAccount',_0x50ee75);logger[_0x9951('0xf')]('ShowSugarcrmAccount',_0x50ee75,JSON[_0x9951('0x11')](_0x5354a3));_0x52e258(_0x5354a3);})['catch'](function(_0x524402){logger['error'](_0x9951('0x20'),_0x524402[_0x9951('0x14')],_0x50ee75);_0x2cb2e9(_0x3b1b4f[_0x9951('0x12')](0x1f4,_0x524402['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 46ececa..233a876 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 _0x6332=['connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','destroy','multer'];(function(_0x4b692e,_0x5331f2){var _0x180568=function(_0xc7e839){while(--_0xc7e839){_0x4b692e['push'](_0x4b692e['shift']());}};_0x180568(++_0x5331f2);}(_0x6332,0x1a3));var _0x2633=function(_0xc1fac,_0xc28588){_0xc1fac=_0xc1fac-0x0;var _0x217f6c=_0x6332[_0xc1fac];return _0x217f6c;};'use strict';var multer=require(_0x2633('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2633('0x1'));var express=require(_0x2633('0x2'));var router=express[_0x2633('0x3')]();var fs_extra=require(_0x2633('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2633('0x5'));var controller=require(_0x2633('0x6'));router[_0x2633('0x7')]('/',auth[_0x2633('0x8')](),controller['index']);router[_0x2633('0x7')](_0x2633('0x9'),auth[_0x2633('0x8')](),controller[_0x2633('0xa')]);router[_0x2633('0x7')](_0x2633('0xb'),auth[_0x2633('0x8')](),controller[_0x2633('0xc')]);router[_0x2633('0x7')](_0x2633('0xd'),auth[_0x2633('0x8')](),controller[_0x2633('0xe')]);router[_0x2633('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2633('0xf')]);router[_0x2633('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2633('0x11')](_0x2633('0x9'),auth[_0x2633('0x8')](),controller[_0x2633('0x12')]);router['delete'](_0x2633('0x9'),auth[_0x2633('0x8')](),controller[_0x2633('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf2ff=['getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects'];(function(_0x34d113,_0x11d6ba){var _0x3a6349=function(_0x501fca){while(--_0x501fca){_0x34d113['push'](_0x34d113['shift']());}};_0x3a6349(++_0x11d6ba);}(_0xf2ff,0x1ec));var _0xff2f=function(_0x409a02,_0x1637bb){_0x409a02=_0x409a02-0x0;var _0x573aec=_0xf2ff[_0x409a02];return _0x573aec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xff2f('0x0'));var timeout=require('connect-timeout');var express=require(_0xff2f('0x1'));var router=express[_0xff2f('0x2')]();var fs_extra=require(_0xff2f('0x3'));var auth=require(_0xff2f('0x4'));var interaction=require(_0xff2f('0x5'));var config=require('../../config/environment');var controller=require(_0xff2f('0x6'));router[_0xff2f('0x7')]('/',auth[_0xff2f('0x8')](),controller[_0xff2f('0x9')]);router[_0xff2f('0x7')](_0xff2f('0xa'),auth['isAuthenticated'](),controller[_0xff2f('0xb')]);router[_0xff2f('0x7')](_0xff2f('0xc'),auth[_0xff2f('0x8')](),controller['getFields']);router[_0xff2f('0x7')](_0xff2f('0xd'),auth[_0xff2f('0x8')](),controller[_0xff2f('0xe')]);router[_0xff2f('0x7')](_0xff2f('0xf'),auth[_0xff2f('0x8')](),controller[_0xff2f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff2f('0x11')]);router[_0xff2f('0x12')](_0xff2f('0xa'),auth[_0xff2f('0x8')](),controller[_0xff2f('0x13')]);router[_0xff2f('0x14')](_0xff2f('0xa'),auth[_0xff2f('0x8')](),controller[_0xff2f('0x15')]);module[_0xff2f('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 929334e..507cd18 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 _0xd7a5=['exports','STRING','sequelize'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xd7a5,0x1c7));var _0x5d7a=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xd7a5[_0x13cab0];return _0x38804f;};'use strict';var Sequelize=require(_0x5d7a('0x0'));module[_0x5d7a('0x1')]={'name':{'type':Sequelize[_0x5d7a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3623=['exports','STRING','sequelize'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0x3623,0x13d));var _0x3362=function(_0x15797a,_0x16274f){_0x15797a=_0x15797a-0x0;var _0x3e2618=_0x3623[_0x15797a];return _0x3e2618;};'use strict';var Sequelize=require(_0x3362('0x0'));module[_0x3362('0x1')]={'name':{'type':Sequelize[_0x3362('0x2')]},'description':{'type':Sequelize[_0x3362('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index bb15103..2e4ae64 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 _0xea96=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','count','includeAll','SugarcrmConfiguration','findAll','rows','catch','show','params','keys','include','create','body','update','find','getFields','findOne','SugarcrmField','pick','filter','getSubjects','getDescriptions','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x396dcd,_0x46acc8){var _0x134bdf=function(_0x2ae828){while(--_0x2ae828){_0x396dcd['push'](_0x396dcd['shift']());}};_0x134bdf(++_0x46acc8);}(_0xea96,0x77));var _0x6ea9=function(_0x3c3632,_0x3f00ff){_0x3c3632=_0x3c3632-0x0;var _0xb56ced=_0xea96[_0x3c3632];return _0xb56ced;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ea9('0x0'));var rp=require('request-promise');var moment=require(_0x6ea9('0x1'));var BPromise=require(_0x6ea9('0x2'));var Mustache=require('mustache');var util=require(_0x6ea9('0x3'));var path=require(_0x6ea9('0x4'));var sox=require(_0x6ea9('0x5'));var csv=require('to-csv');var ejs=require(_0x6ea9('0x6'));var fs=require('fs');var fs_extra=require(_0x6ea9('0x7'));var _=require(_0x6ea9('0x8'));var squel=require(_0x6ea9('0x9'));var crypto=require(_0x6ea9('0xa'));var jsforce=require(_0x6ea9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6ea9('0xc'));var querystring=require(_0x6ea9('0xd'));var Papa=require(_0x6ea9('0xe'));var Redis=require(_0x6ea9('0xf'));var authService=require(_0x6ea9('0x10'));var qs=require(_0x6ea9('0x11'));var as=require(_0x6ea9('0x12'));var hardwareService=require(_0x6ea9('0x13'));var logger=require(_0x6ea9('0x14'))(_0x6ea9('0x15'));var utils=require('../../config/utils');var config=require(_0x6ea9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ea9('0x17'))['db'];function respondWithStatusCode(_0x44f575,_0x560033){_0x560033=_0x560033||0xcc;return function(_0x55f929){if(_0x55f929){return _0x44f575[_0x6ea9('0x18')](_0x560033);}return _0x44f575[_0x6ea9('0x19')](_0x560033)[_0x6ea9('0x1a')]();};}function respondWithResult(_0x22da4c,_0x2ad773){_0x2ad773=_0x2ad773||0xc8;return function(_0x9e187f){if(_0x9e187f){return _0x22da4c[_0x6ea9('0x19')](_0x2ad773)[_0x6ea9('0x1b')](_0x9e187f);}};}function respondWithFilteredResult(_0x44a1e8,_0x55afec){return function(_0x12a93f){if(_0x12a93f){var _0x318808=typeof _0x55afec[_0x6ea9('0x1c')]===_0x6ea9('0x1d')&&typeof _0x55afec[_0x6ea9('0x1e')]==='undefined';var _0x246197=_0x12a93f['count'];var _0x4f411f=_0x318808?0x0:_0x55afec['offset'];var _0x50f616=_0x318808?_0x12a93f['count']:_0x55afec[_0x6ea9('0x1c')]+_0x55afec['limit'];var _0x2091e7;if(_0x50f616>=_0x246197){_0x50f616=_0x246197;_0x2091e7=0xc8;}else{_0x2091e7=0xce;}_0x44a1e8[_0x6ea9('0x19')](_0x2091e7);return _0x44a1e8[_0x6ea9('0x1f')]('Content-Range',_0x4f411f+'-'+_0x50f616+'/'+_0x246197)[_0x6ea9('0x1b')](_0x12a93f);}return null;};}function patchUpdates(_0x204ea4){return function(_0x53e9e6){try{jsonpatch['apply'](_0x53e9e6,_0x204ea4,!![]);}catch(_0x6dc342){return BPromise[_0x6ea9('0x20')](_0x6dc342);}return _0x53e9e6['save']();};}function saveUpdates(_0x1047da,_0x85148b){return function(_0x525142){if(_0x525142){return _0x525142['update'](_0x1047da)[_0x6ea9('0x21')](function(_0xea48a8){return _0xea48a8;});}return null;};}function removeEntity(_0x3e7037,_0x2e5be8){return function(_0x3c4a37){if(_0x3c4a37){return _0x3c4a37[_0x6ea9('0x22')]()[_0x6ea9('0x21')](function(){_0x3e7037[_0x6ea9('0x19')](0xcc)[_0x6ea9('0x1a')]();});}};}function handleEntityNotFound(_0x22381f,_0x53cfe9){return function(_0x4d5454){if(!_0x4d5454){_0x22381f[_0x6ea9('0x18')](0x194);}return _0x4d5454;};}function handleError(_0x1dfbcc,_0x53c7cb){_0x53c7cb=_0x53c7cb||0x1f4;return function(_0x3da579){logger[_0x6ea9('0x23')](_0x3da579[_0x6ea9('0x24')]);if(_0x3da579[_0x6ea9('0x25')]){delete _0x3da579['name'];}_0x1dfbcc[_0x6ea9('0x19')](_0x53c7cb)[_0x6ea9('0x26')](_0x3da579);};}exports[_0x6ea9('0x27')]=function(_0x4cd730,_0x5233ad){var _0x589aa2={},_0x56b10c={},_0xd879ff={'count':0x0,'rows':[]};var _0x73719e=_[_0x6ea9('0x28')](db['SugarcrmConfiguration'][_0x6ea9('0x29')],function(_0x3bfbdb){return{'name':_0x3bfbdb[_0x6ea9('0x2a')],'type':_0x3bfbdb['type'][_0x6ea9('0x2b')]};});_0x56b10c[_0x6ea9('0x2c')]=_[_0x6ea9('0x28')](_0x73719e,_0x6ea9('0x25'));_0x56b10c['query']=_['keys'](_0x4cd730[_0x6ea9('0x2d')]);_0x56b10c[_0x6ea9('0x2e')]=_[_0x6ea9('0x2f')](_0x56b10c['model'],_0x56b10c[_0x6ea9('0x2d')]);_0x589aa2[_0x6ea9('0x30')]=_[_0x6ea9('0x2f')](_0x56b10c[_0x6ea9('0x2c')],qs[_0x6ea9('0x31')](_0x4cd730[_0x6ea9('0x2d')]['fields']));_0x589aa2[_0x6ea9('0x30')]=_0x589aa2[_0x6ea9('0x30')][_0x6ea9('0x32')]?_0x589aa2[_0x6ea9('0x30')]:_0x56b10c['model'];if(!_0x4cd730[_0x6ea9('0x2d')][_0x6ea9('0x33')](_0x6ea9('0x34'))){_0x589aa2[_0x6ea9('0x1e')]=qs[_0x6ea9('0x1e')](_0x4cd730['query']['limit']);_0x589aa2[_0x6ea9('0x1c')]=qs['offset'](_0x4cd730['query'][_0x6ea9('0x1c')]);}_0x589aa2[_0x6ea9('0x35')]=qs[_0x6ea9('0x36')](_0x4cd730[_0x6ea9('0x2d')][_0x6ea9('0x36')]);_0x589aa2[_0x6ea9('0x37')]=qs[_0x6ea9('0x2e')](_['pick'](_0x4cd730[_0x6ea9('0x2d')],_0x56b10c[_0x6ea9('0x2e')]),_0x73719e);if(_0x4cd730[_0x6ea9('0x2d')]['filter']){_0x589aa2[_0x6ea9('0x37')]=_[_0x6ea9('0x38')](_0x589aa2[_0x6ea9('0x37')],{'$or':_['map'](_0x73719e,function(_0x256894){if(_0x256894[_0x6ea9('0x39')]!==_0x6ea9('0x3a')){var _0x555277={};_0x555277[_0x256894['name']]={'$like':'%'+_0x4cd730[_0x6ea9('0x2d')]['filter']+'%'};return _0x555277;}})});}_0x589aa2=_[_0x6ea9('0x38')]({},_0x589aa2,_0x4cd730[_0x6ea9('0x3b')]);var _0x513fa9={'where':_0x589aa2[_0x6ea9('0x37')]};return db['SugarcrmConfiguration'][_0x6ea9('0x3c')](_0x513fa9)[_0x6ea9('0x21')](function(_0x1e8752){_0xd879ff['count']=_0x1e8752;if(_0x4cd730[_0x6ea9('0x2d')][_0x6ea9('0x3d')]){_0x589aa2['include']=[{'all':!![]}];}return db[_0x6ea9('0x3e')][_0x6ea9('0x3f')](_0x589aa2);})['then'](function(_0x1e8865){_0xd879ff[_0x6ea9('0x40')]=_0x1e8865;return _0xd879ff;})[_0x6ea9('0x21')](respondWithFilteredResult(_0x5233ad,_0x589aa2))[_0x6ea9('0x41')](handleError(_0x5233ad,null));};exports[_0x6ea9('0x42')]=function(_0x5abbb8,_0x5d45e4){var _0x585265={'raw':![],'where':{'id':_0x5abbb8[_0x6ea9('0x43')]['id']}},_0x216bc1={};_0x216bc1['model']=_[_0x6ea9('0x44')](db[_0x6ea9('0x3e')][_0x6ea9('0x29')]);_0x216bc1['query']=_[_0x6ea9('0x44')](_0x5abbb8[_0x6ea9('0x2d')]);_0x216bc1[_0x6ea9('0x2e')]=_[_0x6ea9('0x2f')](_0x216bc1['model'],_0x216bc1['query']);_0x585265[_0x6ea9('0x30')]=_['intersection'](_0x216bc1[_0x6ea9('0x2c')],qs[_0x6ea9('0x31')](_0x5abbb8[_0x6ea9('0x2d')][_0x6ea9('0x31')]));_0x585265[_0x6ea9('0x30')]=_0x585265[_0x6ea9('0x30')][_0x6ea9('0x32')]?_0x585265[_0x6ea9('0x30')]:_0x216bc1['model'];if(_0x5abbb8['query'][_0x6ea9('0x3d')]){_0x585265[_0x6ea9('0x45')]=[{'all':!![]}];}_0x585265=_[_0x6ea9('0x38')]({},_0x585265,_0x5abbb8[_0x6ea9('0x3b')]);return db[_0x6ea9('0x3e')]['find'](_0x585265)['then'](handleEntityNotFound(_0x5d45e4,null))[_0x6ea9('0x21')](respondWithResult(_0x5d45e4,null))[_0x6ea9('0x41')](handleError(_0x5d45e4,null));};exports[_0x6ea9('0x46')]=function(_0xde1c00,_0x2cf4a8){return db[_0x6ea9('0x3e')][_0x6ea9('0x46')](_0xde1c00[_0x6ea9('0x47')],{})[_0x6ea9('0x21')](respondWithResult(_0x2cf4a8,0xc9))[_0x6ea9('0x41')](handleError(_0x2cf4a8,null));};exports[_0x6ea9('0x48')]=function(_0x1ab602,_0x31c419){if(_0x1ab602[_0x6ea9('0x47')]['id']){delete _0x1ab602['body']['id'];}return db[_0x6ea9('0x3e')][_0x6ea9('0x49')]({'where':{'id':_0x1ab602['params']['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0x31c419,null))[_0x6ea9('0x21')](saveUpdates(_0x1ab602[_0x6ea9('0x47')],null))[_0x6ea9('0x21')](respondWithResult(_0x31c419,null))['catch'](handleError(_0x31c419,null));};exports[_0x6ea9('0x22')]=function(_0x2ae630,_0xc0fe3c){return db[_0x6ea9('0x3e')][_0x6ea9('0x49')]({'where':{'id':_0x2ae630[_0x6ea9('0x43')]['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0xc0fe3c,null))['then'](removeEntity(_0xc0fe3c,null))[_0x6ea9('0x41')](handleError(_0xc0fe3c,null));};exports[_0x6ea9('0x4a')]=function(_0x384329,_0x5983fc,_0x5c41f5){var _0x5dbf6f={};var _0x16cc8a={};var _0x1cfc61;var _0x2490c9;return db[_0x6ea9('0x3e')][_0x6ea9('0x4b')]({'where':{'id':_0x384329[_0x6ea9('0x43')]['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0x5983fc,null))[_0x6ea9('0x21')](function(_0x8bcbb3){if(_0x8bcbb3){_0x1cfc61=_0x8bcbb3;_0x16cc8a['model']=_[_0x6ea9('0x44')](db[_0x6ea9('0x4c')]['rawAttributes']);_0x16cc8a[_0x6ea9('0x2d')]=_[_0x6ea9('0x44')](_0x384329[_0x6ea9('0x2d')]);_0x16cc8a[_0x6ea9('0x2e')]=_['intersection'](_0x16cc8a[_0x6ea9('0x2c')],_0x16cc8a[_0x6ea9('0x2d')]);_0x5dbf6f[_0x6ea9('0x30')]=_[_0x6ea9('0x2f')](_0x16cc8a[_0x6ea9('0x2c')],qs['fields'](_0x384329['query']['fields']));_0x5dbf6f[_0x6ea9('0x30')]=_0x5dbf6f[_0x6ea9('0x30')][_0x6ea9('0x32')]?_0x5dbf6f[_0x6ea9('0x30')]:_0x16cc8a[_0x6ea9('0x2c')];_0x5dbf6f['order']=qs[_0x6ea9('0x36')](_0x384329[_0x6ea9('0x2d')][_0x6ea9('0x36')]);_0x5dbf6f[_0x6ea9('0x37')]=qs[_0x6ea9('0x2e')](_[_0x6ea9('0x4d')](_0x384329[_0x6ea9('0x2d')],_0x16cc8a[_0x6ea9('0x2e')]));if(_0x384329['query'][_0x6ea9('0x4e')]){_0x5dbf6f[_0x6ea9('0x37')]=_['merge'](_0x5dbf6f['where'],{'$or':_[_0x6ea9('0x28')](_0x5dbf6f[_0x6ea9('0x30')],function(_0x1630d2){var _0x5db43e={};_0x5db43e[_0x1630d2]={'$like':'%'+_0x384329[_0x6ea9('0x2d')]['filter']+'%'};return _0x5db43e;})});}_0x5dbf6f=_[_0x6ea9('0x38')]({},_0x5dbf6f,_0x384329[_0x6ea9('0x3b')]);return _0x1cfc61['getFields'](_0x5dbf6f);}})['then'](function(_0x25c90c){if(_0x25c90c){_0x2490c9=_0x25c90c[_0x6ea9('0x32')];if(!_0x384329[_0x6ea9('0x2d')][_0x6ea9('0x33')](_0x6ea9('0x34'))){_0x5dbf6f[_0x6ea9('0x1e')]=qs['limit'](_0x384329['query'][_0x6ea9('0x1e')]);_0x5dbf6f[_0x6ea9('0x1c')]=qs[_0x6ea9('0x1c')](_0x384329[_0x6ea9('0x2d')][_0x6ea9('0x1c')]);}return _0x1cfc61[_0x6ea9('0x4a')](_0x5dbf6f);}})[_0x6ea9('0x21')](function(_0x19cacb){if(_0x19cacb){return _0x19cacb?{'count':_0x2490c9,'rows':_0x19cacb}:null;}})[_0x6ea9('0x21')](respondWithResult(_0x5983fc,null))[_0x6ea9('0x41')](handleError(_0x5983fc,null));};exports['getSubjects']=function(_0x259f44,_0xd67388,_0x1f5065){var _0x5c3318={};var _0x218d48={};var _0x4f41f6;var _0x35b6d9;return db[_0x6ea9('0x3e')]['findOne']({'where':{'id':_0x259f44[_0x6ea9('0x43')]['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0xd67388,null))[_0x6ea9('0x21')](function(_0x24709e){if(_0x24709e){_0x4f41f6=_0x24709e;_0x218d48['model']=_[_0x6ea9('0x44')](db[_0x6ea9('0x4c')][_0x6ea9('0x29')]);_0x218d48[_0x6ea9('0x2d')]=_['keys'](_0x259f44[_0x6ea9('0x2d')]);_0x218d48[_0x6ea9('0x2e')]=_[_0x6ea9('0x2f')](_0x218d48[_0x6ea9('0x2c')],_0x218d48[_0x6ea9('0x2d')]);_0x5c3318[_0x6ea9('0x30')]=_['intersection'](_0x218d48[_0x6ea9('0x2c')],qs['fields'](_0x259f44['query'][_0x6ea9('0x31')]));_0x5c3318[_0x6ea9('0x30')]=_0x5c3318[_0x6ea9('0x30')][_0x6ea9('0x32')]?_0x5c3318[_0x6ea9('0x30')]:_0x218d48[_0x6ea9('0x2c')];_0x5c3318['order']=qs['sort'](_0x259f44['query'][_0x6ea9('0x36')]);_0x5c3318[_0x6ea9('0x37')]=qs[_0x6ea9('0x2e')](_[_0x6ea9('0x4d')](_0x259f44['query'],_0x218d48[_0x6ea9('0x2e')]));if(_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x4e')]){_0x5c3318[_0x6ea9('0x37')]=_[_0x6ea9('0x38')](_0x5c3318['where'],{'$or':_['map'](_0x5c3318[_0x6ea9('0x30')],function(_0x4ca136){var _0x18a41c={};_0x18a41c[_0x4ca136]={'$like':'%'+_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x4e')]+'%'};return _0x18a41c;})});}_0x5c3318=_['merge']({},_0x5c3318,_0x259f44[_0x6ea9('0x3b')]);return _0x4f41f6[_0x6ea9('0x4f')](_0x5c3318);}})[_0x6ea9('0x21')](function(_0x27144e){if(_0x27144e){_0x35b6d9=_0x27144e['length'];if(!_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x33')]('nolimit')){_0x5c3318[_0x6ea9('0x1e')]=qs[_0x6ea9('0x1e')](_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x1e')]);_0x5c3318[_0x6ea9('0x1c')]=qs[_0x6ea9('0x1c')](_0x259f44[_0x6ea9('0x2d')][_0x6ea9('0x1c')]);}return _0x4f41f6[_0x6ea9('0x4f')](_0x5c3318);}})['then'](function(_0x197eca){if(_0x197eca){return _0x197eca?{'count':_0x35b6d9,'rows':_0x197eca}:null;}})['then'](respondWithResult(_0xd67388,null))[_0x6ea9('0x41')](handleError(_0xd67388,null));};exports['getDescriptions']=function(_0x354a2d,_0x22b49d,_0x1c6e55){var _0x57a8e5={};var _0x25a443={};var _0xce3f3;var _0xcd6b57;return db['SugarcrmConfiguration'][_0x6ea9('0x4b')]({'where':{'id':_0x354a2d[_0x6ea9('0x43')]['id']}})[_0x6ea9('0x21')](handleEntityNotFound(_0x22b49d,null))[_0x6ea9('0x21')](function(_0x440b28){if(_0x440b28){_0xce3f3=_0x440b28;_0x25a443['model']=_[_0x6ea9('0x44')](db[_0x6ea9('0x4c')]['rawAttributes']);_0x25a443[_0x6ea9('0x2d')]=_[_0x6ea9('0x44')](_0x354a2d['query']);_0x25a443[_0x6ea9('0x2e')]=_[_0x6ea9('0x2f')](_0x25a443[_0x6ea9('0x2c')],_0x25a443[_0x6ea9('0x2d')]);_0x57a8e5['attributes']=_[_0x6ea9('0x2f')](_0x25a443[_0x6ea9('0x2c')],qs['fields'](_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x31')]));_0x57a8e5[_0x6ea9('0x30')]=_0x57a8e5['attributes']['length']?_0x57a8e5[_0x6ea9('0x30')]:_0x25a443['model'];_0x57a8e5[_0x6ea9('0x35')]=qs[_0x6ea9('0x36')](_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x36')]);_0x57a8e5[_0x6ea9('0x37')]=qs[_0x6ea9('0x2e')](_[_0x6ea9('0x4d')](_0x354a2d[_0x6ea9('0x2d')],_0x25a443[_0x6ea9('0x2e')]));if(_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x4e')]){_0x57a8e5['where']=_[_0x6ea9('0x38')](_0x57a8e5[_0x6ea9('0x37')],{'$or':_[_0x6ea9('0x28')](_0x57a8e5[_0x6ea9('0x30')],function(_0x239793){var _0x427b8c={};_0x427b8c[_0x239793]={'$like':'%'+_0x354a2d[_0x6ea9('0x2d')]['filter']+'%'};return _0x427b8c;})});}_0x57a8e5=_['merge']({},_0x57a8e5,_0x354a2d[_0x6ea9('0x3b')]);return _0xce3f3[_0x6ea9('0x50')](_0x57a8e5);}})[_0x6ea9('0x21')](function(_0x5481f3){if(_0x5481f3){_0xcd6b57=_0x5481f3[_0x6ea9('0x32')];if(!_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x33')](_0x6ea9('0x34'))){_0x57a8e5[_0x6ea9('0x1e')]=qs[_0x6ea9('0x1e')](_0x354a2d[_0x6ea9('0x2d')]['limit']);_0x57a8e5[_0x6ea9('0x1c')]=qs['offset'](_0x354a2d[_0x6ea9('0x2d')][_0x6ea9('0x1c')]);}return _0xce3f3['getDescriptions'](_0x57a8e5);}})[_0x6ea9('0x21')](function(_0x1a3dc5){if(_0x1a3dc5){return _0x1a3dc5?{'count':_0xcd6b57,'rows':_0x1a3dc5}:null;}})[_0x6ea9('0x21')](respondWithResult(_0x22b49d,null))[_0x6ea9('0x41')](handleError(_0x22b49d,null));}; \ No newline at end of file +var _0x9ec3=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','save','update','destroy','then','error','stack','name','index','SugarcrmConfiguration','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0x9ec3,0x1da));var _0x39ec=function(_0x59b969,_0x59b1a8){_0x59b969=_0x59b969-0x0;var _0x2b2f54=_0x9ec3[_0x59b969];return _0x2b2f54;};'use strict';var emlformat=require(_0x39ec('0x0'));var rimraf=require(_0x39ec('0x1'));var zipdir=require(_0x39ec('0x2'));var jsonpatch=require(_0x39ec('0x3'));var rp=require(_0x39ec('0x4'));var moment=require(_0x39ec('0x5'));var BPromise=require(_0x39ec('0x6'));var Mustache=require(_0x39ec('0x7'));var util=require('util');var path=require(_0x39ec('0x8'));var sox=require(_0x39ec('0x9'));var csv=require(_0x39ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x39ec('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x39ec('0xc'));var deskjs=require(_0x39ec('0xd'));var toCsv=require('to-csv');var querystring=require(_0x39ec('0xe'));var Papa=require(_0x39ec('0xf'));var Redis=require(_0x39ec('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x39ec('0x11'));var as=require(_0x39ec('0x12'));var hardwareService=require(_0x39ec('0x13'));var logger=require(_0x39ec('0x14'))(_0x39ec('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x39ec('0x16'));var db=require(_0x39ec('0x17'))['db'];function respondWithStatusCode(_0x5c9c02,_0xc41cbb){_0xc41cbb=_0xc41cbb||0xcc;return function(_0x1f5848){if(_0x1f5848){return _0x5c9c02[_0x39ec('0x18')](_0xc41cbb);}return _0x5c9c02[_0x39ec('0x19')](_0xc41cbb)[_0x39ec('0x1a')]();};}function respondWithResult(_0x470f77,_0x2a4557){_0x2a4557=_0x2a4557||0xc8;return function(_0x158f43){if(_0x158f43){return _0x470f77['status'](_0x2a4557)[_0x39ec('0x1b')](_0x158f43);}};}function respondWithFilteredResult(_0x395910,_0x46b807){return function(_0x256449){if(_0x256449){var _0x1a0644=typeof _0x46b807['offset']===_0x39ec('0x1c')&&typeof _0x46b807[_0x39ec('0x1d')]===_0x39ec('0x1c');var _0x407a73=_0x256449['count'];var _0x40bdcd=_0x1a0644?0x0:_0x46b807[_0x39ec('0x1e')];var _0x52e76b=_0x1a0644?_0x256449[_0x39ec('0x1f')]:_0x46b807['offset']+_0x46b807['limit'];var _0x4eaae0;if(_0x52e76b>=_0x407a73){_0x52e76b=_0x407a73;_0x4eaae0=0xc8;}else{_0x4eaae0=0xce;}_0x395910[_0x39ec('0x19')](_0x4eaae0);return _0x395910['set']('Content-Range',_0x40bdcd+'-'+_0x52e76b+'/'+_0x407a73)[_0x39ec('0x1b')](_0x256449);}return null;};}function patchUpdates(_0x2e9a51){return function(_0x18e7a9){try{jsonpatch[_0x39ec('0x20')](_0x18e7a9,_0x2e9a51,!![]);}catch(_0x1affcd){return BPromise[_0x39ec('0x21')](_0x1affcd);}return _0x18e7a9[_0x39ec('0x22')]();};}function saveUpdates(_0x3d231b,_0x546d29){return function(_0x55a23f){if(_0x55a23f){return _0x55a23f[_0x39ec('0x23')](_0x3d231b)['then'](function(_0x354fa0){return _0x354fa0;});}return null;};}function removeEntity(_0x5f3775,_0x1244bc){return function(_0x35d0c7){if(_0x35d0c7){return _0x35d0c7[_0x39ec('0x24')]()[_0x39ec('0x25')](function(){_0x5f3775[_0x39ec('0x19')](0xcc)[_0x39ec('0x1a')]();});}};}function handleEntityNotFound(_0x536ff3,_0x4e548c){return function(_0x225a64){if(!_0x225a64){_0x536ff3['sendStatus'](0x194);}return _0x225a64;};}function handleError(_0x1b1159,_0x521602){_0x521602=_0x521602||0x1f4;return function(_0x356d61){logger[_0x39ec('0x26')](_0x356d61[_0x39ec('0x27')]);if(_0x356d61[_0x39ec('0x28')]){delete _0x356d61[_0x39ec('0x28')];}_0x1b1159[_0x39ec('0x19')](_0x521602)['send'](_0x356d61);};}exports[_0x39ec('0x29')]=function(_0x590f4b,_0x5d19e2){var _0x30fa30={},_0x2600bf={},_0x224584={'count':0x0,'rows':[]};var _0x37f506=_['map'](db[_0x39ec('0x2a')]['rawAttributes'],function(_0x14a17c){return{'name':_0x14a17c['fieldName'],'type':_0x14a17c['type'][_0x39ec('0x2b')]};});_0x2600bf[_0x39ec('0x2c')]=_[_0x39ec('0x2d')](_0x37f506,'name');_0x2600bf['query']=_[_0x39ec('0x2e')](_0x590f4b[_0x39ec('0x2f')]);_0x2600bf['filters']=_[_0x39ec('0x30')](_0x2600bf[_0x39ec('0x2c')],_0x2600bf['query']);_0x30fa30[_0x39ec('0x31')]=_[_0x39ec('0x30')](_0x2600bf[_0x39ec('0x2c')],qs['fields'](_0x590f4b['query'][_0x39ec('0x32')]));_0x30fa30['attributes']=_0x30fa30[_0x39ec('0x31')][_0x39ec('0x33')]?_0x30fa30[_0x39ec('0x31')]:_0x2600bf[_0x39ec('0x2c')];if(!_0x590f4b[_0x39ec('0x2f')][_0x39ec('0x34')](_0x39ec('0x35'))){_0x30fa30[_0x39ec('0x1d')]=qs[_0x39ec('0x1d')](_0x590f4b[_0x39ec('0x2f')][_0x39ec('0x1d')]);_0x30fa30['offset']=qs[_0x39ec('0x1e')](_0x590f4b[_0x39ec('0x2f')][_0x39ec('0x1e')]);}_0x30fa30[_0x39ec('0x36')]=qs['sort'](_0x590f4b[_0x39ec('0x2f')][_0x39ec('0x37')]);_0x30fa30[_0x39ec('0x38')]=qs[_0x39ec('0x39')](_[_0x39ec('0x3a')](_0x590f4b['query'],_0x2600bf['filters']),_0x37f506);if(_0x590f4b[_0x39ec('0x2f')]['filter']){_0x30fa30[_0x39ec('0x38')]=_[_0x39ec('0x3b')](_0x30fa30[_0x39ec('0x38')],{'$or':_['map'](_0x37f506,function(_0x43a801){if(_0x43a801[_0x39ec('0x3c')]!==_0x39ec('0x3d')){var _0x1eca70={};_0x1eca70[_0x43a801[_0x39ec('0x28')]]={'$like':'%'+_0x590f4b[_0x39ec('0x2f')][_0x39ec('0x3e')]+'%'};return _0x1eca70;}})});}_0x30fa30=_[_0x39ec('0x3b')]({},_0x30fa30,_0x590f4b[_0x39ec('0x3f')]);var _0xd3dd2b={'where':_0x30fa30[_0x39ec('0x38')]};return db['SugarcrmConfiguration'][_0x39ec('0x1f')](_0xd3dd2b)[_0x39ec('0x25')](function(_0x20153a){_0x224584[_0x39ec('0x1f')]=_0x20153a;if(_0x590f4b['query'][_0x39ec('0x40')]){_0x30fa30[_0x39ec('0x41')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x39ec('0x42')](_0x30fa30);})[_0x39ec('0x25')](function(_0x3786ef){_0x224584[_0x39ec('0x43')]=_0x3786ef;return _0x224584;})[_0x39ec('0x25')](respondWithFilteredResult(_0x5d19e2,_0x30fa30))[_0x39ec('0x44')](handleError(_0x5d19e2,null));};exports[_0x39ec('0x45')]=function(_0x3258c1,_0x17f2cf){var _0x319950={'raw':![],'where':{'id':_0x3258c1[_0x39ec('0x46')]['id']}},_0x1adb69={};_0x1adb69[_0x39ec('0x2c')]=_[_0x39ec('0x2e')](db[_0x39ec('0x2a')][_0x39ec('0x47')]);_0x1adb69[_0x39ec('0x2f')]=_['keys'](_0x3258c1[_0x39ec('0x2f')]);_0x1adb69[_0x39ec('0x39')]=_[_0x39ec('0x30')](_0x1adb69['model'],_0x1adb69[_0x39ec('0x2f')]);_0x319950[_0x39ec('0x31')]=_[_0x39ec('0x30')](_0x1adb69[_0x39ec('0x2c')],qs[_0x39ec('0x32')](_0x3258c1['query'][_0x39ec('0x32')]));_0x319950['attributes']=_0x319950['attributes'][_0x39ec('0x33')]?_0x319950[_0x39ec('0x31')]:_0x1adb69[_0x39ec('0x2c')];if(_0x3258c1[_0x39ec('0x2f')][_0x39ec('0x40')]){_0x319950['include']=[{'all':!![]}];}_0x319950=_[_0x39ec('0x3b')]({},_0x319950,_0x3258c1[_0x39ec('0x3f')]);return db['SugarcrmConfiguration'][_0x39ec('0x48')](_0x319950)[_0x39ec('0x25')](handleEntityNotFound(_0x17f2cf,null))[_0x39ec('0x25')](respondWithResult(_0x17f2cf,null))[_0x39ec('0x44')](handleError(_0x17f2cf,null));};exports['create']=function(_0x55c405,_0x27d0f6){return db[_0x39ec('0x2a')]['create'](_0x55c405[_0x39ec('0x49')],{})[_0x39ec('0x25')](respondWithResult(_0x27d0f6,0xc9))[_0x39ec('0x44')](handleError(_0x27d0f6,null));};exports[_0x39ec('0x23')]=function(_0x4ce464,_0x566927){if(_0x4ce464['body']['id']){delete _0x4ce464[_0x39ec('0x49')]['id'];}return db['SugarcrmConfiguration'][_0x39ec('0x48')]({'where':{'id':_0x4ce464[_0x39ec('0x46')]['id']}})[_0x39ec('0x25')](handleEntityNotFound(_0x566927,null))[_0x39ec('0x25')](saveUpdates(_0x4ce464[_0x39ec('0x49')],null))[_0x39ec('0x25')](respondWithResult(_0x566927,null))[_0x39ec('0x44')](handleError(_0x566927,null));};exports[_0x39ec('0x24')]=function(_0x52d220,_0x5573a3){return db[_0x39ec('0x2a')][_0x39ec('0x48')]({'where':{'id':_0x52d220[_0x39ec('0x46')]['id']}})[_0x39ec('0x25')](handleEntityNotFound(_0x5573a3,null))[_0x39ec('0x25')](removeEntity(_0x5573a3,null))[_0x39ec('0x44')](handleError(_0x5573a3,null));};exports[_0x39ec('0x4a')]=function(_0x486f90,_0x36a73f,_0x1c9c1b){var _0x3690b5={};var _0x469d9f={};var _0x57976d;var _0x3dec5a;return db[_0x39ec('0x2a')][_0x39ec('0x4b')]({'where':{'id':_0x486f90['params']['id']}})[_0x39ec('0x25')](handleEntityNotFound(_0x36a73f,null))['then'](function(_0x38e758){if(_0x38e758){_0x57976d=_0x38e758;_0x469d9f[_0x39ec('0x2c')]=_[_0x39ec('0x2e')](db['SugarcrmField'][_0x39ec('0x47')]);_0x469d9f[_0x39ec('0x2f')]=_['keys'](_0x486f90[_0x39ec('0x2f')]);_0x469d9f[_0x39ec('0x39')]=_[_0x39ec('0x30')](_0x469d9f['model'],_0x469d9f[_0x39ec('0x2f')]);_0x3690b5[_0x39ec('0x31')]=_[_0x39ec('0x30')](_0x469d9f[_0x39ec('0x2c')],qs['fields'](_0x486f90[_0x39ec('0x2f')][_0x39ec('0x32')]));_0x3690b5['attributes']=_0x3690b5[_0x39ec('0x31')][_0x39ec('0x33')]?_0x3690b5[_0x39ec('0x31')]:_0x469d9f[_0x39ec('0x2c')];_0x3690b5['order']=qs[_0x39ec('0x37')](_0x486f90[_0x39ec('0x2f')][_0x39ec('0x37')]);_0x3690b5[_0x39ec('0x38')]=qs[_0x39ec('0x39')](_[_0x39ec('0x3a')](_0x486f90[_0x39ec('0x2f')],_0x469d9f[_0x39ec('0x39')]));if(_0x486f90[_0x39ec('0x2f')]['filter']){_0x3690b5[_0x39ec('0x38')]=_[_0x39ec('0x3b')](_0x3690b5['where'],{'$or':_[_0x39ec('0x2d')](_0x3690b5[_0x39ec('0x31')],function(_0x8826b5){var _0x4b0652={};_0x4b0652[_0x8826b5]={'$like':'%'+_0x486f90['query']['filter']+'%'};return _0x4b0652;})});}_0x3690b5=_[_0x39ec('0x3b')]({},_0x3690b5,_0x486f90[_0x39ec('0x3f')]);return _0x57976d['getFields'](_0x3690b5);}})[_0x39ec('0x25')](function(_0x3b5eaf){if(_0x3b5eaf){_0x3dec5a=_0x3b5eaf[_0x39ec('0x33')];if(!_0x486f90[_0x39ec('0x2f')]['hasOwnProperty'](_0x39ec('0x35'))){_0x3690b5['limit']=qs[_0x39ec('0x1d')](_0x486f90[_0x39ec('0x2f')][_0x39ec('0x1d')]);_0x3690b5[_0x39ec('0x1e')]=qs[_0x39ec('0x1e')](_0x486f90[_0x39ec('0x2f')][_0x39ec('0x1e')]);}return _0x57976d[_0x39ec('0x4a')](_0x3690b5);}})['then'](function(_0x221219){if(_0x221219){return _0x221219?{'count':_0x3dec5a,'rows':_0x221219}:null;}})[_0x39ec('0x25')](respondWithResult(_0x36a73f,null))['catch'](handleError(_0x36a73f,null));};exports['getSubjects']=function(_0x314b5b,_0x5d9f74,_0x2c3fde){var _0x504471={};var _0x15ff5d={};var _0x2c4acc;var _0x243a1f;return db[_0x39ec('0x2a')][_0x39ec('0x4b')]({'where':{'id':_0x314b5b[_0x39ec('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d9f74,null))[_0x39ec('0x25')](function(_0x55e154){if(_0x55e154){_0x2c4acc=_0x55e154;_0x15ff5d[_0x39ec('0x2c')]=_[_0x39ec('0x2e')](db[_0x39ec('0x4c')]['rawAttributes']);_0x15ff5d[_0x39ec('0x2f')]=_['keys'](_0x314b5b['query']);_0x15ff5d['filters']=_[_0x39ec('0x30')](_0x15ff5d[_0x39ec('0x2c')],_0x15ff5d[_0x39ec('0x2f')]);_0x504471[_0x39ec('0x31')]=_[_0x39ec('0x30')](_0x15ff5d[_0x39ec('0x2c')],qs['fields'](_0x314b5b[_0x39ec('0x2f')][_0x39ec('0x32')]));_0x504471['attributes']=_0x504471[_0x39ec('0x31')][_0x39ec('0x33')]?_0x504471[_0x39ec('0x31')]:_0x15ff5d['model'];_0x504471[_0x39ec('0x36')]=qs[_0x39ec('0x37')](_0x314b5b[_0x39ec('0x2f')][_0x39ec('0x37')]);_0x504471[_0x39ec('0x38')]=qs[_0x39ec('0x39')](_[_0x39ec('0x3a')](_0x314b5b[_0x39ec('0x2f')],_0x15ff5d[_0x39ec('0x39')]));if(_0x314b5b[_0x39ec('0x2f')][_0x39ec('0x3e')]){_0x504471[_0x39ec('0x38')]=_[_0x39ec('0x3b')](_0x504471[_0x39ec('0x38')],{'$or':_[_0x39ec('0x2d')](_0x504471[_0x39ec('0x31')],function(_0x153f3a){var _0x2fde7a={};_0x2fde7a[_0x153f3a]={'$like':'%'+_0x314b5b[_0x39ec('0x2f')][_0x39ec('0x3e')]+'%'};return _0x2fde7a;})});}_0x504471=_[_0x39ec('0x3b')]({},_0x504471,_0x314b5b[_0x39ec('0x3f')]);return _0x2c4acc[_0x39ec('0x4d')](_0x504471);}})[_0x39ec('0x25')](function(_0x50e61c){if(_0x50e61c){_0x243a1f=_0x50e61c['length'];if(!_0x314b5b[_0x39ec('0x2f')][_0x39ec('0x34')](_0x39ec('0x35'))){_0x504471[_0x39ec('0x1d')]=qs[_0x39ec('0x1d')](_0x314b5b['query'][_0x39ec('0x1d')]);_0x504471[_0x39ec('0x1e')]=qs[_0x39ec('0x1e')](_0x314b5b[_0x39ec('0x2f')][_0x39ec('0x1e')]);}return _0x2c4acc['getSubjects'](_0x504471);}})[_0x39ec('0x25')](function(_0x5c0143){if(_0x5c0143){return _0x5c0143?{'count':_0x243a1f,'rows':_0x5c0143}:null;}})[_0x39ec('0x25')](respondWithResult(_0x5d9f74,null))[_0x39ec('0x44')](handleError(_0x5d9f74,null));};exports[_0x39ec('0x4e')]=function(_0x4f3a51,_0x1aea87,_0x5911e2){var _0x519f90={};var _0x3b1871={};var _0x34ef48;var _0xe4cbcc;return db['SugarcrmConfiguration'][_0x39ec('0x4b')]({'where':{'id':_0x4f3a51['params']['id']}})['then'](handleEntityNotFound(_0x1aea87,null))[_0x39ec('0x25')](function(_0x4a748f){if(_0x4a748f){_0x34ef48=_0x4a748f;_0x3b1871[_0x39ec('0x2c')]=_[_0x39ec('0x2e')](db[_0x39ec('0x4c')][_0x39ec('0x47')]);_0x3b1871['query']=_[_0x39ec('0x2e')](_0x4f3a51[_0x39ec('0x2f')]);_0x3b1871[_0x39ec('0x39')]=_[_0x39ec('0x30')](_0x3b1871[_0x39ec('0x2c')],_0x3b1871['query']);_0x519f90[_0x39ec('0x31')]=_[_0x39ec('0x30')](_0x3b1871[_0x39ec('0x2c')],qs['fields'](_0x4f3a51[_0x39ec('0x2f')][_0x39ec('0x32')]));_0x519f90[_0x39ec('0x31')]=_0x519f90[_0x39ec('0x31')][_0x39ec('0x33')]?_0x519f90['attributes']:_0x3b1871[_0x39ec('0x2c')];_0x519f90[_0x39ec('0x36')]=qs['sort'](_0x4f3a51[_0x39ec('0x2f')][_0x39ec('0x37')]);_0x519f90[_0x39ec('0x38')]=qs[_0x39ec('0x39')](_[_0x39ec('0x3a')](_0x4f3a51[_0x39ec('0x2f')],_0x3b1871[_0x39ec('0x39')]));if(_0x4f3a51[_0x39ec('0x2f')]['filter']){_0x519f90['where']=_[_0x39ec('0x3b')](_0x519f90[_0x39ec('0x38')],{'$or':_['map'](_0x519f90['attributes'],function(_0x1a73bb){var _0xc0cfce={};_0xc0cfce[_0x1a73bb]={'$like':'%'+_0x4f3a51['query'][_0x39ec('0x3e')]+'%'};return _0xc0cfce;})});}_0x519f90=_['merge']({},_0x519f90,_0x4f3a51[_0x39ec('0x3f')]);return _0x34ef48[_0x39ec('0x4e')](_0x519f90);}})[_0x39ec('0x25')](function(_0x38d651){if(_0x38d651){_0xe4cbcc=_0x38d651[_0x39ec('0x33')];if(!_0x4f3a51[_0x39ec('0x2f')][_0x39ec('0x34')](_0x39ec('0x35'))){_0x519f90[_0x39ec('0x1d')]=qs['limit'](_0x4f3a51[_0x39ec('0x2f')][_0x39ec('0x1d')]);_0x519f90[_0x39ec('0x1e')]=qs['offset'](_0x4f3a51[_0x39ec('0x2f')][_0x39ec('0x1e')]);}return _0x34ef48[_0x39ec('0x4e')](_0x519f90);}})[_0x39ec('0x25')](function(_0x2c7ec0){if(_0x2c7ec0){return _0x2c7ec0?{'count':_0xe4cbcc,'rows':_0x2c7ec0}:null;}})['then'](respondWithResult(_0x1aea87,null))[_0x39ec('0x44')](handleError(_0x1aea87,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 67635d6..8625381 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 _0x98a1=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f53fc,_0x4265e0){var _0x1ae053=function(_0x47dbf1){while(--_0x47dbf1){_0x5f53fc['push'](_0x5f53fc['shift']());}};_0x1ae053(++_0x4265e0);}(_0x98a1,0x14a));var _0x198a=function(_0x55f323,_0x5cc60f){_0x55f323=_0x55f323-0x0;var _0x3e205e=_0x98a1[_0x55f323];return _0x3e205e;};'use strict';var _=require('lodash');var util=require(_0x198a('0x0'));var logger=require(_0x198a('0x1'))(_0x198a('0x2'));var moment=require(_0x198a('0x3'));var BPromise=require(_0x198a('0x4'));var rp=require(_0x198a('0x5'));var fs=require('fs');var path=require(_0x198a('0x6'));var rimraf=require(_0x198a('0x7'));var config=require(_0x198a('0x8'));var attributes=require(_0x198a('0x9'));module[_0x198a('0xa')]=function(_0x213a4b,_0x342b79){return _0x213a4b[_0x198a('0xb')]('SugarcrmConfiguration',attributes,{'tableName':_0x198a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b97=['./intSugarcrmConfiguration.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xf84a59,_0x1092b0){var _0x54cb4c=function(_0xa7d3c){while(--_0xa7d3c){_0xf84a59['push'](_0xf84a59['shift']());}};_0x54cb4c(++_0x1092b0);}(_0x2b97,0xea));var _0x72b9=function(_0x4bd4b5,_0x3c2e64){_0x4bd4b5=_0x4bd4b5-0x0;var _0x1930c7=_0x2b97[_0x4bd4b5];return _0x1930c7;};'use strict';var _=require(_0x72b9('0x0'));var util=require('util');var logger=require(_0x72b9('0x1'))(_0x72b9('0x2'));var moment=require(_0x72b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x72b9('0x4'));var fs=require('fs');var path=require(_0x72b9('0x5'));var rimraf=require(_0x72b9('0x6'));var config=require(_0x72b9('0x7'));var attributes=require(_0x72b9('0x8'));module[_0x72b9('0x9')]=function(_0x168e17,_0x50aba2){return _0x168e17[_0x72b9('0xa')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','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 999cbe5..ef41152 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 _0xa7e8=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x362454,_0x164fea){var _0x2d4798=function(_0x47f3f5){while(--_0x47f3f5){_0x362454['push'](_0x362454['shift']());}};_0x2d4798(++_0x164fea);}(_0xa7e8,0x170));var _0x8a7e=function(_0x117fc1,_0x18392f){_0x117fc1=_0x117fc1-0x0;var _0x3b6d09=_0xa7e8[_0x117fc1];return _0x3b6d09;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8a7e('0x0'));var rs=require(_0x8a7e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a7e('0x2'))['db'];var utils=require(_0x8a7e('0x3'));var logger=require('../../config/logger')(_0x8a7e('0x4'));var config=require(_0x8a7e('0x5'));var jayson=require(_0x8a7e('0x6'));var client=jayson['client'][_0x8a7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x35fe19,_0x34c026,_0x6165cc){return new BPromise(function(_0x44dc7d,_0x6a5521){return client[_0x8a7e('0x8')](_0x35fe19,_0x6165cc)['then'](function(_0x2db1bb){logger[_0x8a7e('0x9')](_0x8a7e('0xa'),_0x34c026,_0x8a7e('0xb'));logger[_0x8a7e('0xc')](_0x8a7e('0xd'),_0x34c026,'request\x20sent',JSON[_0x8a7e('0xe')](_0x2db1bb));if(_0x2db1bb[_0x8a7e('0xf')]){if(_0x2db1bb['error'][_0x8a7e('0x10')]===0x1f4){logger[_0x8a7e('0xf')](_0x8a7e('0xa'),_0x34c026,_0x2db1bb[_0x8a7e('0xf')][_0x8a7e('0x11')]);return _0x6a5521(_0x2db1bb[_0x8a7e('0xf')][_0x8a7e('0x11')]);}logger[_0x8a7e('0xf')](_0x8a7e('0xa'),_0x34c026,_0x2db1bb[_0x8a7e('0xf')][_0x8a7e('0x11')]);return _0x44dc7d(_0x2db1bb[_0x8a7e('0xf')]['message']);}else{logger[_0x8a7e('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x34c026,'request\x20sent');_0x44dc7d(_0x2db1bb[_0x8a7e('0x12')][_0x8a7e('0x11')]);}})['catch'](function(_0x5a3a99){logger[_0x8a7e('0xf')](_0x8a7e('0xa'),_0x34c026,_0x5a3a99);_0x6a5521(_0x5a3a99);});});} \ No newline at end of file +var _0x4107=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment','bluebird','randomstring'];(function(_0xd20582,_0x52fd0f){var _0x3fce88=function(_0x5401d5){while(--_0x5401d5){_0xd20582['push'](_0xd20582['shift']());}};_0x3fce88(++_0x52fd0f);}(_0x4107,0x146));var _0x7410=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x4107[_0x3ec122];return _0x4ecf41;};'use strict';var _=require('lodash');var util=require(_0x7410('0x0'));var moment=require(_0x7410('0x1'));var BPromise=require(_0x7410('0x2'));var rs=require(_0x7410('0x3'));var fs=require('fs');var Redis=require(_0x7410('0x4'));var db=require(_0x7410('0x5'))['db'];var utils=require(_0x7410('0x6'));var logger=require(_0x7410('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7410('0x8'));var client=jayson[_0x7410('0x9')][_0x7410('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dda86,_0x33895f,_0x2d1ed2){return new BPromise(function(_0x14d449,_0x5cbf76){return client[_0x7410('0xb')](_0x2dda86,_0x2d1ed2)[_0x7410('0xc')](function(_0x5c7f5a){logger['info'](_0x7410('0xd'),_0x33895f,_0x7410('0xe'));logger[_0x7410('0xf')](_0x7410('0x10'),_0x33895f,_0x7410('0xe'),JSON['stringify'](_0x5c7f5a));if(_0x5c7f5a[_0x7410('0x11')]){if(_0x5c7f5a[_0x7410('0x11')]['code']===0x1f4){logger[_0x7410('0x11')](_0x7410('0xd'),_0x33895f,_0x5c7f5a[_0x7410('0x11')][_0x7410('0x12')]);return _0x5cbf76(_0x5c7f5a[_0x7410('0x11')]['message']);}logger['error'](_0x7410('0xd'),_0x33895f,_0x5c7f5a[_0x7410('0x11')][_0x7410('0x12')]);return _0x14d449(_0x5c7f5a[_0x7410('0x11')]['message']);}else{logger[_0x7410('0x13')](_0x7410('0xd'),_0x33895f,_0x7410('0xe'));_0x14d449(_0x5c7f5a[_0x7410('0x14')][_0x7410('0x12')]);}})[_0x7410('0x15')](function(_0x446612){logger[_0x7410('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x33895f,_0x446612);_0x5cbf76(_0x446612);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index ee8a518..bdf6023 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 _0xa8dd=['post','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','/:id','isAuthenticated','show'];(function(_0x7f88bd,_0x4d3638){var _0x4d926f=function(_0x7a3d8d){while(--_0x7a3d8d){_0x7f88bd['push'](_0x7f88bd['shift']());}};_0x4d926f(++_0x4d3638);}(_0xa8dd,0x102));var _0xda8d=function(_0x1ef093,_0x44e1ed){_0x1ef093=_0x1ef093-0x0;var _0x3728ca=_0xa8dd[_0x1ef093];return _0x3728ca;};'use strict';var multer=require('multer');var util=require(_0xda8d('0x0'));var path=require(_0xda8d('0x1'));var timeout=require('connect-timeout');var express=require(_0xda8d('0x2'));var router=express[_0xda8d('0x3')]();var fs_extra=require(_0xda8d('0x4'));var auth=require(_0xda8d('0x5'));var interaction=require(_0xda8d('0x6'));var config=require('../../config/environment');var controller=require(_0xda8d('0x7'));router[_0xda8d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda8d('0x8')](_0xda8d('0x9'),auth[_0xda8d('0xa')](),controller[_0xda8d('0xb')]);router[_0xda8d('0xc')]('/',auth[_0xda8d('0xa')](),controller[_0xda8d('0xd')]);router['put']('/:id',auth[_0xda8d('0xa')](),controller[_0xda8d('0xe')]);router[_0xda8d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xda8d('0x10')]);module[_0xda8d('0x11')]=router; \ No newline at end of file +var _0xb479=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x214ca0,_0x1b92ac){var _0x28fb0d=function(_0x5803bc){while(--_0x5803bc){_0x214ca0['push'](_0x214ca0['shift']());}};_0x28fb0d(++_0x1b92ac);}(_0xb479,0x104));var _0x9b47=function(_0x30fdff,_0x3e5225){_0x30fdff=_0x30fdff-0x0;var _0x4868b1=_0xb479[_0x30fdff];return _0x4868b1;};'use strict';var multer=require(_0x9b47('0x0'));var util=require(_0x9b47('0x1'));var path=require(_0x9b47('0x2'));var timeout=require(_0x9b47('0x3'));var express=require(_0x9b47('0x4'));var router=express['Router']();var fs_extra=require(_0x9b47('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9b47('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x9b47('0x7')]('/',auth[_0x9b47('0x8')](),controller[_0x9b47('0x9')]);router[_0x9b47('0x7')](_0x9b47('0xa'),auth['isAuthenticated'](),controller[_0x9b47('0xb')]);router['post']('/',auth[_0x9b47('0x8')](),controller[_0x9b47('0xc')]);router[_0x9b47('0xd')](_0x9b47('0xa'),auth['isAuthenticated'](),controller[_0x9b47('0xe')]);router['delete']('/:id',auth[_0x9b47('0x8')](),controller[_0x9b47('0xf')]);module[_0x9b47('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 6a7fa93..32296ea 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 _0x7f27=['customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','string','STRING'];(function(_0x1071f5,_0x1cb30c){var _0x2f869c=function(_0x1bd953){while(--_0x1bd953){_0x1071f5['push'](_0x1071f5['shift']());}};_0x2f869c(++_0x1cb30c);}(_0x7f27,0xb2));var _0x77f2=function(_0x2e7e7e,_0x394c4e){_0x2e7e7e=_0x2e7e7e-0x0;var _0x1a43ee=_0x7f27[_0x2e7e7e];return _0x1a43ee;};'use strict';var Sequelize=require(_0x77f2('0x0'));module['exports']={'type':{'type':Sequelize[_0x77f2('0x1')]('string',_0x77f2('0x2'),'customVariable',_0x77f2('0x3'),'picklist'),'defaultValue':_0x77f2('0x4')},'content':{'type':Sequelize[_0x77f2('0x5')]},'key':{'type':Sequelize[_0x77f2('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x77f2('0x4'),'variable',_0x77f2('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x77f2('0x5')]},'customField':{'type':Sequelize[_0x77f2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x77f2('0x5')]}}; \ No newline at end of file +var _0x1165=['picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x249565,_0x2a026a){var _0x43dee8=function(_0x15a1ab){while(--_0x15a1ab){_0x249565['push'](_0x249565['shift']());}};_0x43dee8(++_0x2a026a);}(_0x1165,0x137));var _0x5116=function(_0x441c6d,_0xace735){_0x441c6d=_0x441c6d-0x0;var _0x5d067f=_0x1165[_0x441c6d];return _0x5d067f;};'use strict';var Sequelize=require(_0x5116('0x0'));module[_0x5116('0x1')]={'type':{'type':Sequelize[_0x5116('0x2')](_0x5116('0x3'),'variable','customVariable','keyValue',_0x5116('0x4')),'defaultValue':_0x5116('0x3')},'content':{'type':Sequelize[_0x5116('0x5')]},'key':{'type':Sequelize[_0x5116('0x5')]},'keyType':{'type':Sequelize[_0x5116('0x2')](_0x5116('0x3'),_0x5116('0x6'),_0x5116('0x7'))},'keyContent':{'type':Sequelize[_0x5116('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5116('0x5')]},'customField':{'type':Sequelize[_0x5116('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 fcc9337..9281c86 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 _0xc64b=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','end','sendStatus','stack','name','send','index','map','SugarcrmField','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','options','create','body','params','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xc8f8d6,_0x5e7570){var _0x511e5b=function(_0x239ee5){while(--_0x239ee5){_0xc8f8d6['push'](_0xc8f8d6['shift']());}};_0x511e5b(++_0x5e7570);}(_0xc64b,0x176));var _0xbc64=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0xc64b[_0x4efd3d];return _0x1293f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc64('0x0'));var zipdir=require(_0xbc64('0x1'));var jsonpatch=require(_0xbc64('0x2'));var rp=require(_0xbc64('0x3'));var moment=require(_0xbc64('0x4'));var BPromise=require(_0xbc64('0x5'));var Mustache=require(_0xbc64('0x6'));var util=require(_0xbc64('0x7'));var path=require('path');var sox=require(_0xbc64('0x8'));var csv=require(_0xbc64('0x9'));var ejs=require(_0xbc64('0xa'));var fs=require('fs');var fs_extra=require(_0xbc64('0xb'));var _=require(_0xbc64('0xc'));var squel=require(_0xbc64('0xd'));var crypto=require(_0xbc64('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbc64('0x9'));var querystring=require(_0xbc64('0xf'));var Papa=require(_0xbc64('0x10'));var Redis=require(_0xbc64('0x11'));var authService=require(_0xbc64('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbc64('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc64('0x14'))(_0xbc64('0x15'));var utils=require(_0xbc64('0x16'));var config=require(_0xbc64('0x17'));var licenseUtil=require(_0xbc64('0x18'));var db=require(_0xbc64('0x19'))['db'];function respondWithStatusCode(_0x1bfbeb,_0x33db7c){_0x33db7c=_0x33db7c||0xcc;return function(_0x424c44){if(_0x424c44){return _0x1bfbeb['sendStatus'](_0x33db7c);}return _0x1bfbeb[_0xbc64('0x1a')](_0x33db7c)['end']();};}function respondWithResult(_0x2b627a,_0x14ab2e){_0x14ab2e=_0x14ab2e||0xc8;return function(_0x8b0899){if(_0x8b0899){return _0x2b627a[_0xbc64('0x1a')](_0x14ab2e)[_0xbc64('0x1b')](_0x8b0899);}};}function respondWithFilteredResult(_0x2252d2,_0x124676){return function(_0x1433f4){if(_0x1433f4){var _0x3513cb=typeof _0x124676[_0xbc64('0x1c')]===_0xbc64('0x1d')&&typeof _0x124676[_0xbc64('0x1e')]===_0xbc64('0x1d');var _0x5a2457=_0x1433f4[_0xbc64('0x1f')];var _0x36b6b3=_0x3513cb?0x0:_0x124676[_0xbc64('0x1c')];var _0x3af9ae=_0x3513cb?_0x1433f4[_0xbc64('0x1f')]:_0x124676[_0xbc64('0x1c')]+_0x124676[_0xbc64('0x1e')];var _0x21ce93;if(_0x3af9ae>=_0x5a2457){_0x3af9ae=_0x5a2457;_0x21ce93=0xc8;}else{_0x21ce93=0xce;}_0x2252d2[_0xbc64('0x1a')](_0x21ce93);return _0x2252d2['set'](_0xbc64('0x20'),_0x36b6b3+'-'+_0x3af9ae+'/'+_0x5a2457)[_0xbc64('0x1b')](_0x1433f4);}return null;};}function patchUpdates(_0x151873){return function(_0x224f2b){try{jsonpatch[_0xbc64('0x21')](_0x224f2b,_0x151873,!![]);}catch(_0x4e63bc){return BPromise[_0xbc64('0x22')](_0x4e63bc);}return _0x224f2b[_0xbc64('0x23')]();};}function saveUpdates(_0xbf6ef4,_0x388ac7){return function(_0x40fa2c){if(_0x40fa2c){return _0x40fa2c['update'](_0xbf6ef4)[_0xbc64('0x24')](function(_0x40d34e){return _0x40d34e;});}return null;};}function removeEntity(_0x502b82,_0x1aaa8f){return function(_0x2a54c4){if(_0x2a54c4){return _0x2a54c4['destroy']()[_0xbc64('0x24')](function(){_0x502b82[_0xbc64('0x1a')](0xcc)[_0xbc64('0x25')]();});}};}function handleEntityNotFound(_0x166ecb,_0x255a26){return function(_0x474afd){if(!_0x474afd){_0x166ecb[_0xbc64('0x26')](0x194);}return _0x474afd;};}function handleError(_0x1f79fa,_0x107140){_0x107140=_0x107140||0x1f4;return function(_0x4505c6){logger['error'](_0x4505c6[_0xbc64('0x27')]);if(_0x4505c6[_0xbc64('0x28')]){delete _0x4505c6[_0xbc64('0x28')];}_0x1f79fa[_0xbc64('0x1a')](_0x107140)[_0xbc64('0x29')](_0x4505c6);};}exports[_0xbc64('0x2a')]=function(_0x38f93c,_0x2598f3){var _0x7c038={},_0x3aabe5={},_0x501d40={'count':0x0,'rows':[]};var _0x4ca188=_[_0xbc64('0x2b')](db[_0xbc64('0x2c')][_0xbc64('0x2d')],function(_0xf2560d){return{'name':_0xf2560d['fieldName'],'type':_0xf2560d['type'][_0xbc64('0x2e')]};});_0x3aabe5[_0xbc64('0x2f')]=_['map'](_0x4ca188,_0xbc64('0x28'));_0x3aabe5[_0xbc64('0x30')]=_[_0xbc64('0x31')](_0x38f93c[_0xbc64('0x30')]);_0x3aabe5[_0xbc64('0x32')]=_['intersection'](_0x3aabe5[_0xbc64('0x2f')],_0x3aabe5[_0xbc64('0x30')]);_0x7c038[_0xbc64('0x33')]=_[_0xbc64('0x34')](_0x3aabe5[_0xbc64('0x2f')],qs[_0xbc64('0x35')](_0x38f93c[_0xbc64('0x30')][_0xbc64('0x35')]));_0x7c038[_0xbc64('0x33')]=_0x7c038[_0xbc64('0x33')][_0xbc64('0x36')]?_0x7c038[_0xbc64('0x33')]:_0x3aabe5[_0xbc64('0x2f')];if(!_0x38f93c[_0xbc64('0x30')][_0xbc64('0x37')](_0xbc64('0x38'))){_0x7c038[_0xbc64('0x1e')]=qs['limit'](_0x38f93c[_0xbc64('0x30')][_0xbc64('0x1e')]);_0x7c038[_0xbc64('0x1c')]=qs[_0xbc64('0x1c')](_0x38f93c['query'][_0xbc64('0x1c')]);}_0x7c038[_0xbc64('0x39')]=qs[_0xbc64('0x3a')](_0x38f93c[_0xbc64('0x30')][_0xbc64('0x3a')]);_0x7c038['where']=qs[_0xbc64('0x32')](_[_0xbc64('0x3b')](_0x38f93c[_0xbc64('0x30')],_0x3aabe5[_0xbc64('0x32')]),_0x4ca188);if(_0x38f93c[_0xbc64('0x30')]['filter']){_0x7c038[_0xbc64('0x3c')]=_[_0xbc64('0x3d')](_0x7c038[_0xbc64('0x3c')],{'$or':_[_0xbc64('0x2b')](_0x4ca188,function(_0x5f5b5f){if(_0x5f5b5f[_0xbc64('0x3e')]!==_0xbc64('0x3f')){var _0x5d61d2={};_0x5d61d2[_0x5f5b5f[_0xbc64('0x28')]]={'$like':'%'+_0x38f93c[_0xbc64('0x30')][_0xbc64('0x40')]+'%'};return _0x5d61d2;}})});}_0x7c038=_[_0xbc64('0x3d')]({},_0x7c038,_0x38f93c['options']);var _0x339f0b={'where':_0x7c038[_0xbc64('0x3c')]};return db[_0xbc64('0x2c')][_0xbc64('0x1f')](_0x339f0b)[_0xbc64('0x24')](function(_0x513786){_0x501d40[_0xbc64('0x1f')]=_0x513786;if(_0x38f93c[_0xbc64('0x30')][_0xbc64('0x41')]){_0x7c038['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xbc64('0x42')](_0x7c038);})['then'](function(_0x155842){_0x501d40[_0xbc64('0x43')]=_0x155842;return _0x501d40;})[_0xbc64('0x24')](respondWithFilteredResult(_0x2598f3,_0x7c038))[_0xbc64('0x44')](handleError(_0x2598f3,null));};exports[_0xbc64('0x45')]=function(_0x22d757,_0x80e6cf){var _0x403111={'raw':!![],'where':{'id':_0x22d757['params']['id']}},_0xaaceb9={};_0xaaceb9[_0xbc64('0x2f')]=_[_0xbc64('0x31')](db[_0xbc64('0x2c')]['rawAttributes']);_0xaaceb9['query']=_['keys'](_0x22d757['query']);_0xaaceb9[_0xbc64('0x32')]=_['intersection'](_0xaaceb9[_0xbc64('0x2f')],_0xaaceb9[_0xbc64('0x30')]);_0x403111[_0xbc64('0x33')]=_['intersection'](_0xaaceb9['model'],qs['fields'](_0x22d757['query'][_0xbc64('0x35')]));_0x403111['attributes']=_0x403111[_0xbc64('0x33')][_0xbc64('0x36')]?_0x403111['attributes']:_0xaaceb9['model'];if(_0x22d757[_0xbc64('0x30')][_0xbc64('0x41')]){_0x403111['include']=[{'all':!![]}];}_0x403111=_[_0xbc64('0x3d')]({},_0x403111,_0x22d757[_0xbc64('0x46')]);return db[_0xbc64('0x2c')]['find'](_0x403111)['then'](handleEntityNotFound(_0x80e6cf,null))[_0xbc64('0x24')](respondWithResult(_0x80e6cf,null))[_0xbc64('0x44')](handleError(_0x80e6cf,null));};exports[_0xbc64('0x47')]=function(_0x3dc18b,_0x46f04c){return db[_0xbc64('0x2c')]['create'](_0x3dc18b[_0xbc64('0x48')],{})[_0xbc64('0x24')](respondWithResult(_0x46f04c,0xc9))[_0xbc64('0x44')](handleError(_0x46f04c,null));};exports['update']=function(_0x5682d2,_0x31ab1a){if(_0x5682d2[_0xbc64('0x48')]['id']){delete _0x5682d2[_0xbc64('0x48')]['id'];}return db[_0xbc64('0x2c')]['find']({'where':{'id':_0x5682d2[_0xbc64('0x49')]['id']}})[_0xbc64('0x24')](handleEntityNotFound(_0x31ab1a,null))[_0xbc64('0x24')](saveUpdates(_0x5682d2[_0xbc64('0x48')],null))[_0xbc64('0x24')](respondWithResult(_0x31ab1a,null))[_0xbc64('0x44')](handleError(_0x31ab1a,null));};exports[_0xbc64('0x4a')]=function(_0x2bef5d,_0x49d5e8){return db['SugarcrmField'][_0xbc64('0x4b')]({'where':{'id':_0x2bef5d[_0xbc64('0x49')]['id']}})[_0xbc64('0x24')](handleEntityNotFound(_0x49d5e8,null))[_0xbc64('0x24')](removeEntity(_0x49d5e8,null))['catch'](handleError(_0x49d5e8,null));}; \ No newline at end of file +var _0xaf0b=['status','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','SugarcrmField','includeAll','include','rows','catch','show','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','count','offset','set','apply','save','update','destroy','then','error','stack','name'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xaf0b,0x1e6));var _0xbaf0=function(_0x29a75c,_0x525f3c){_0x29a75c=_0x29a75c-0x0;var _0x3185d3=_0xaf0b[_0x29a75c];return _0x3185d3;};'use strict';var emlformat=require(_0xbaf0('0x0'));var rimraf=require(_0xbaf0('0x1'));var zipdir=require(_0xbaf0('0x2'));var jsonpatch=require(_0xbaf0('0x3'));var rp=require(_0xbaf0('0x4'));var moment=require(_0xbaf0('0x5'));var BPromise=require(_0xbaf0('0x6'));var Mustache=require(_0xbaf0('0x7'));var util=require(_0xbaf0('0x8'));var path=require('path');var sox=require(_0xbaf0('0x9'));var csv=require(_0xbaf0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbaf0('0xb'));var _=require(_0xbaf0('0xc'));var squel=require(_0xbaf0('0xd'));var crypto=require(_0xbaf0('0xe'));var jsforce=require(_0xbaf0('0xf'));var deskjs=require(_0xbaf0('0x10'));var toCsv=require(_0xbaf0('0xa'));var querystring=require('querystring');var Papa=require(_0xbaf0('0x11'));var Redis=require(_0xbaf0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbaf0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbaf0('0x14'))(_0xbaf0('0x15'));var utils=require(_0xbaf0('0x16'));var config=require(_0xbaf0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbaf0('0x18'))['db'];function respondWithStatusCode(_0x22b0a2,_0x12917d){_0x12917d=_0x12917d||0xcc;return function(_0x137762){if(_0x137762){return _0x22b0a2['sendStatus'](_0x12917d);}return _0x22b0a2['status'](_0x12917d)[_0xbaf0('0x19')]();};}function respondWithResult(_0x31c618,_0x12df88){_0x12df88=_0x12df88||0xc8;return function(_0x517614){if(_0x517614){return _0x31c618['status'](_0x12df88)[_0xbaf0('0x1a')](_0x517614);}};}function respondWithFilteredResult(_0x5145d7,_0xb6964e){return function(_0x2aea83){if(_0x2aea83){var _0x9d59f7=typeof _0xb6964e['offset']==='undefined'&&typeof _0xb6964e['limit']===_0xbaf0('0x1b');var _0x149214=_0x2aea83['count'];var _0x5ce547=_0x9d59f7?0x0:_0xb6964e['offset'];var _0x27d123=_0x9d59f7?_0x2aea83[_0xbaf0('0x1c')]:_0xb6964e[_0xbaf0('0x1d')]+_0xb6964e['limit'];var _0x15beb3;if(_0x27d123>=_0x149214){_0x27d123=_0x149214;_0x15beb3=0xc8;}else{_0x15beb3=0xce;}_0x5145d7['status'](_0x15beb3);return _0x5145d7[_0xbaf0('0x1e')]('Content-Range',_0x5ce547+'-'+_0x27d123+'/'+_0x149214)[_0xbaf0('0x1a')](_0x2aea83);}return null;};}function patchUpdates(_0x860218){return function(_0x360b25){try{jsonpatch[_0xbaf0('0x1f')](_0x360b25,_0x860218,!![]);}catch(_0x4916af){return BPromise['reject'](_0x4916af);}return _0x360b25[_0xbaf0('0x20')]();};}function saveUpdates(_0x419f03,_0x18f428){return function(_0x3ada0e){if(_0x3ada0e){return _0x3ada0e[_0xbaf0('0x21')](_0x419f03)['then'](function(_0x195a43){return _0x195a43;});}return null;};}function removeEntity(_0x12e6db,_0x5ee292){return function(_0x15ac43){if(_0x15ac43){return _0x15ac43[_0xbaf0('0x22')]()[_0xbaf0('0x23')](function(){_0x12e6db['status'](0xcc)[_0xbaf0('0x19')]();});}};}function handleEntityNotFound(_0x2a125c,_0x373f69){return function(_0x5f5385){if(!_0x5f5385){_0x2a125c['sendStatus'](0x194);}return _0x5f5385;};}function handleError(_0x1ddcf5,_0x317d86){_0x317d86=_0x317d86||0x1f4;return function(_0x289586){logger[_0xbaf0('0x24')](_0x289586[_0xbaf0('0x25')]);if(_0x289586[_0xbaf0('0x26')]){delete _0x289586[_0xbaf0('0x26')];}_0x1ddcf5[_0xbaf0('0x27')](_0x317d86)['send'](_0x289586);};}exports[_0xbaf0('0x28')]=function(_0x7abc7d,_0x33ad0e){var _0x5513f3={},_0x39f005={},_0x135ccf={'count':0x0,'rows':[]};var _0x157b1a=_[_0xbaf0('0x29')](db['SugarcrmField'][_0xbaf0('0x2a')],function(_0x353ad9){return{'name':_0x353ad9[_0xbaf0('0x2b')],'type':_0x353ad9[_0xbaf0('0x2c')][_0xbaf0('0x2d')]};});_0x39f005[_0xbaf0('0x2e')]=_['map'](_0x157b1a,_0xbaf0('0x26'));_0x39f005[_0xbaf0('0x2f')]=_[_0xbaf0('0x30')](_0x7abc7d[_0xbaf0('0x2f')]);_0x39f005['filters']=_[_0xbaf0('0x31')](_0x39f005['model'],_0x39f005['query']);_0x5513f3[_0xbaf0('0x32')]=_['intersection'](_0x39f005[_0xbaf0('0x2e')],qs[_0xbaf0('0x33')](_0x7abc7d[_0xbaf0('0x2f')][_0xbaf0('0x33')]));_0x5513f3[_0xbaf0('0x32')]=_0x5513f3[_0xbaf0('0x32')][_0xbaf0('0x34')]?_0x5513f3[_0xbaf0('0x32')]:_0x39f005[_0xbaf0('0x2e')];if(!_0x7abc7d[_0xbaf0('0x2f')][_0xbaf0('0x35')](_0xbaf0('0x36'))){_0x5513f3['limit']=qs['limit'](_0x7abc7d[_0xbaf0('0x2f')][_0xbaf0('0x37')]);_0x5513f3[_0xbaf0('0x1d')]=qs[_0xbaf0('0x1d')](_0x7abc7d[_0xbaf0('0x2f')][_0xbaf0('0x1d')]);}_0x5513f3[_0xbaf0('0x38')]=qs[_0xbaf0('0x39')](_0x7abc7d[_0xbaf0('0x2f')][_0xbaf0('0x39')]);_0x5513f3['where']=qs[_0xbaf0('0x3a')](_[_0xbaf0('0x3b')](_0x7abc7d[_0xbaf0('0x2f')],_0x39f005[_0xbaf0('0x3a')]),_0x157b1a);if(_0x7abc7d[_0xbaf0('0x2f')][_0xbaf0('0x3c')]){_0x5513f3['where']=_[_0xbaf0('0x3d')](_0x5513f3[_0xbaf0('0x3e')],{'$or':_[_0xbaf0('0x29')](_0x157b1a,function(_0x5c83d8){if(_0x5c83d8[_0xbaf0('0x2c')]!==_0xbaf0('0x3f')){var _0x49d62c={};_0x49d62c[_0x5c83d8['name']]={'$like':'%'+_0x7abc7d[_0xbaf0('0x2f')][_0xbaf0('0x3c')]+'%'};return _0x49d62c;}})});}_0x5513f3=_[_0xbaf0('0x3d')]({},_0x5513f3,_0x7abc7d[_0xbaf0('0x40')]);var _0x3c8f81={'where':_0x5513f3[_0xbaf0('0x3e')]};return db[_0xbaf0('0x41')]['count'](_0x3c8f81)['then'](function(_0x73eccb){_0x135ccf[_0xbaf0('0x1c')]=_0x73eccb;if(_0x7abc7d[_0xbaf0('0x2f')][_0xbaf0('0x42')]){_0x5513f3[_0xbaf0('0x43')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x5513f3);})[_0xbaf0('0x23')](function(_0x3d97c3){_0x135ccf[_0xbaf0('0x44')]=_0x3d97c3;return _0x135ccf;})[_0xbaf0('0x23')](respondWithFilteredResult(_0x33ad0e,_0x5513f3))[_0xbaf0('0x45')](handleError(_0x33ad0e,null));};exports[_0xbaf0('0x46')]=function(_0x5c7f45,_0x1e171f){var _0x407f49={'raw':!![],'where':{'id':_0x5c7f45['params']['id']}},_0x1a0372={};_0x1a0372['model']=_[_0xbaf0('0x30')](db[_0xbaf0('0x41')]['rawAttributes']);_0x1a0372['query']=_[_0xbaf0('0x30')](_0x5c7f45['query']);_0x1a0372[_0xbaf0('0x3a')]=_[_0xbaf0('0x31')](_0x1a0372['model'],_0x1a0372[_0xbaf0('0x2f')]);_0x407f49['attributes']=_[_0xbaf0('0x31')](_0x1a0372['model'],qs[_0xbaf0('0x33')](_0x5c7f45[_0xbaf0('0x2f')]['fields']));_0x407f49[_0xbaf0('0x32')]=_0x407f49['attributes'][_0xbaf0('0x34')]?_0x407f49[_0xbaf0('0x32')]:_0x1a0372['model'];if(_0x5c7f45[_0xbaf0('0x2f')][_0xbaf0('0x42')]){_0x407f49[_0xbaf0('0x43')]=[{'all':!![]}];}_0x407f49=_['merge']({},_0x407f49,_0x5c7f45[_0xbaf0('0x40')]);return db[_0xbaf0('0x41')]['find'](_0x407f49)[_0xbaf0('0x23')](handleEntityNotFound(_0x1e171f,null))[_0xbaf0('0x23')](respondWithResult(_0x1e171f,null))[_0xbaf0('0x45')](handleError(_0x1e171f,null));};exports[_0xbaf0('0x47')]=function(_0x2df8b9,_0x174bef){return db[_0xbaf0('0x41')]['create'](_0x2df8b9[_0xbaf0('0x48')],{})['then'](respondWithResult(_0x174bef,0xc9))[_0xbaf0('0x45')](handleError(_0x174bef,null));};exports[_0xbaf0('0x21')]=function(_0x3e2514,_0x183f29){if(_0x3e2514['body']['id']){delete _0x3e2514[_0xbaf0('0x48')]['id'];}return db[_0xbaf0('0x41')]['find']({'where':{'id':_0x3e2514[_0xbaf0('0x49')]['id']}})[_0xbaf0('0x23')](handleEntityNotFound(_0x183f29,null))[_0xbaf0('0x23')](saveUpdates(_0x3e2514[_0xbaf0('0x48')],null))[_0xbaf0('0x23')](respondWithResult(_0x183f29,null))[_0xbaf0('0x45')](handleError(_0x183f29,null));};exports[_0xbaf0('0x22')]=function(_0x4a210f,_0x325199){return db[_0xbaf0('0x41')][_0xbaf0('0x4a')]({'where':{'id':_0x4a210f[_0xbaf0('0x49')]['id']}})[_0xbaf0('0x23')](handleEntityNotFound(_0x325199,null))['then'](removeEntity(_0x325199,null))[_0xbaf0('0x45')](handleError(_0x325199,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index d4c6a63..c4371a2 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 _0xff35=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SugarcrmField'];(function(_0x1a3d8b,_0x3b8b10){var _0x437cca=function(_0x4b2fac){while(--_0x4b2fac){_0x1a3d8b['push'](_0x1a3d8b['shift']());}};_0x437cca(++_0x3b8b10);}(_0xff35,0x154));var _0x5ff3=function(_0x261675,_0x36c5e2){_0x261675=_0x261675-0x0;var _0x194b5f=_0xff35[_0x261675];return _0x194b5f;};'use strict';var _=require(_0x5ff3('0x0'));var util=require(_0x5ff3('0x1'));var logger=require(_0x5ff3('0x2'))(_0x5ff3('0x3'));var moment=require(_0x5ff3('0x4'));var BPromise=require(_0x5ff3('0x5'));var rp=require(_0x5ff3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ff3('0x7'));var config=require(_0x5ff3('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x5ff3('0x9')]=function(_0x1df27b,_0x4f5dc5){return _0x1df27b[_0x5ff3('0xa')](_0x5ff3('0xb'),attributes,{'tableName':_0x5ff3('0xc'),'paranoid':![],'indexes':[{'name':_0x5ff3('0xd'),'fields':[_0x5ff3('0xe'),_0x5ff3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb3b=['./intSugarcrmField.attributes','exports','define','SugarcrmField','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x406599,_0x55de11){var _0x349751=function(_0x408ada){while(--_0x408ada){_0x406599['push'](_0x406599['shift']());}};_0x349751(++_0x55de11);}(_0xbb3b,0x148));var _0xbbb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb3b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbbb3('0x0'));var util=require(_0xbbb3('0x1'));var logger=require('../../config/logger')(_0xbbb3('0x2'));var moment=require(_0xbbb3('0x3'));var BPromise=require('bluebird');var rp=require(_0xbbb3('0x4'));var fs=require('fs');var path=require(_0xbbb3('0x5'));var rimraf=require(_0xbbb3('0x6'));var config=require(_0xbbb3('0x7'));var attributes=require(_0xbbb3('0x8'));module[_0xbbb3('0x9')]=function(_0x687984,_0x13d02f){return _0x687984[_0xbbb3('0xa')](_0xbbb3('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xbbb3('0xc'),_0xbbb3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 505d755..662b047 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 _0x5a23=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','catch'];(function(_0xe1784f,_0x4a4d3e){var _0x25e8e2=function(_0x4d55ba){while(--_0x4d55ba){_0xe1784f['push'](_0xe1784f['shift']());}};_0x25e8e2(++_0x4a4d3e);}(_0x5a23,0x198));var _0x35a2=function(_0x2c7757,_0x26dda8){_0x2c7757=_0x2c7757-0x0;var _0x180111=_0x5a23[_0x2c7757];return _0x180111;};'use strict';var _=require(_0x35a2('0x0'));var util=require(_0x35a2('0x1'));var moment=require(_0x35a2('0x2'));var BPromise=require(_0x35a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35a2('0x4'));var db=require(_0x35a2('0x5'))['db'];var utils=require(_0x35a2('0x6'));var logger=require(_0x35a2('0x7'))(_0x35a2('0x8'));var config=require(_0x35a2('0x9'));var jayson=require(_0x35a2('0xa'));var client=jayson[_0x35a2('0xb')][_0x35a2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x571f46,_0x556aa1,_0x5c591a){return new BPromise(function(_0x272510,_0x5ca553){return client[_0x35a2('0xd')](_0x571f46,_0x5c591a)[_0x35a2('0xe')](function(_0x207bbe){logger[_0x35a2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x556aa1,'request\x20sent');logger['debug'](_0x35a2('0x10'),_0x556aa1,_0x35a2('0x11'),JSON[_0x35a2('0x12')](_0x207bbe));if(_0x207bbe[_0x35a2('0x13')]){if(_0x207bbe[_0x35a2('0x13')]['code']===0x1f4){logger['error'](_0x35a2('0x14'),_0x556aa1,_0x207bbe['error'][_0x35a2('0x15')]);return _0x5ca553(_0x207bbe[_0x35a2('0x13')][_0x35a2('0x15')]);}logger[_0x35a2('0x13')](_0x35a2('0x14'),_0x556aa1,_0x207bbe[_0x35a2('0x13')][_0x35a2('0x15')]);return _0x272510(_0x207bbe[_0x35a2('0x13')][_0x35a2('0x15')]);}else{logger[_0x35a2('0xf')](_0x35a2('0x14'),_0x556aa1,'request\x20sent');_0x272510(_0x207bbe[_0x35a2('0x16')]['message']);}})[_0x35a2('0x17')](function(_0x240f43){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x556aa1,_0x240f43);_0x5ca553(_0x240f43);});});} \ No newline at end of file +var _0xd271=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x46c532,_0x5367d3){var _0x41bde0=function(_0x5a1b0a){while(--_0x5a1b0a){_0x46c532['push'](_0x46c532['shift']());}};_0x41bde0(++_0x5367d3);}(_0xd271,0xea));var _0x1d27=function(_0x496cc2,_0x33f03f){_0x496cc2=_0x496cc2-0x0;var _0x57da3e=_0xd271[_0x496cc2];return _0x57da3e;};'use strict';var _=require(_0x1d27('0x0'));var util=require(_0x1d27('0x1'));var moment=require(_0x1d27('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d27('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d27('0x4'))['db'];var utils=require(_0x1d27('0x5'));var logger=require('../../config/logger')(_0x1d27('0x6'));var config=require(_0x1d27('0x7'));var jayson=require(_0x1d27('0x8'));var client=jayson['client'][_0x1d27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bbab7,_0x284710,_0x262e86){return new BPromise(function(_0x356b28,_0xc9554c){return client[_0x1d27('0xa')](_0x5bbab7,_0x262e86)[_0x1d27('0xb')](function(_0x1c75c5){logger[_0x1d27('0xc')](_0x1d27('0xd'),_0x284710,_0x1d27('0xe'));logger[_0x1d27('0xf')](_0x1d27('0x10'),_0x284710,_0x1d27('0xe'),JSON[_0x1d27('0x11')](_0x1c75c5));if(_0x1c75c5[_0x1d27('0x12')]){if(_0x1c75c5[_0x1d27('0x12')][_0x1d27('0x13')]===0x1f4){logger[_0x1d27('0x12')](_0x1d27('0xd'),_0x284710,_0x1c75c5['error'][_0x1d27('0x14')]);return _0xc9554c(_0x1c75c5[_0x1d27('0x12')][_0x1d27('0x14')]);}logger['error'](_0x1d27('0xd'),_0x284710,_0x1c75c5[_0x1d27('0x12')]['message']);return _0x356b28(_0x1c75c5[_0x1d27('0x12')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x284710,_0x1d27('0xe'));_0x356b28(_0x1c75c5[_0x1d27('0x15')]['message']);}})[_0x1d27('0x16')](function(_0x58d8df){logger[_0x1d27('0x12')](_0x1d27('0xd'),_0x284710,_0x58d8df);_0xc9554c(_0x58d8df);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 5e2d713..ec67f6c 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 _0x1159=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','post','create','addConfiguration','put','update','delete'];(function(_0x6fda4c,_0x10ab5f){var _0x284923=function(_0x178cdd){while(--_0x178cdd){_0x6fda4c['push'](_0x6fda4c['shift']());}};_0x284923(++_0x10ab5f);}(_0x1159,0xf3));var _0x9115=function(_0x1ad770,_0x42ad4a){_0x1ad770=_0x1ad770-0x0;var _0x30e2a3=_0x1159[_0x1ad770];return _0x30e2a3;};'use strict';var multer=require(_0x9115('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9115('0x1'));var express=require(_0x9115('0x2'));var router=express[_0x9115('0x3')]();var fs_extra=require(_0x9115('0x4'));var auth=require(_0x9115('0x5'));var interaction=require(_0x9115('0x6'));var config=require(_0x9115('0x7'));var controller=require(_0x9115('0x8'));router['get']('/',auth[_0x9115('0x9')](),controller[_0x9115('0xa')]);router[_0x9115('0xb')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller[_0x9115('0xd')]);router[_0x9115('0xb')]('/:id/configurations',auth[_0x9115('0x9')](),controller[_0x9115('0xe')]);router['get']('/:id/fields',auth[_0x9115('0x9')](),controller['getFields']);router[_0x9115('0xf')]('/',auth[_0x9115('0x9')](),controller[_0x9115('0x10')]);router[_0x9115('0xf')]('/:id/configurations',auth[_0x9115('0x9')](),controller[_0x9115('0x11')]);router[_0x9115('0x12')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller[_0x9115('0x13')]);router[_0x9115('0x14')](_0x9115('0xc'),auth[_0x9115('0x9')](),controller['destroy']);module[_0x9115('0x15')]=router; \ No newline at end of file +var _0xa4fa=['/:id/configurations','getConfigurations','post','create','addConfiguration','/:id','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x59e63b,_0x1904ab){var _0x3054eb=function(_0x4ee491){while(--_0x4ee491){_0x59e63b['push'](_0x59e63b['shift']());}};_0x3054eb(++_0x1904ab);}(_0xa4fa,0x1ca));var _0xaa4f=function(_0x276796,_0x11636a){_0x276796=_0x276796-0x0;var _0x2e67b8=_0xa4fa[_0x276796];return _0x2e67b8;};'use strict';var multer=require(_0xaa4f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaa4f('0x1'));var express=require(_0xaa4f('0x2'));var router=express['Router']();var fs_extra=require(_0xaa4f('0x3'));var auth=require(_0xaa4f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xaa4f('0x5'));var controller=require('./intVtigerAccount.controller');router[_0xaa4f('0x6')]('/',auth[_0xaa4f('0x7')](),controller[_0xaa4f('0x8')]);router[_0xaa4f('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xaa4f('0x9')]);router[_0xaa4f('0x6')](_0xaa4f('0xa'),auth[_0xaa4f('0x7')](),controller[_0xaa4f('0xb')]);router[_0xaa4f('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xaa4f('0xc')]('/',auth['isAuthenticated'](),controller[_0xaa4f('0xd')]);router[_0xaa4f('0xc')](_0xaa4f('0xa'),auth[_0xaa4f('0x7')](),controller[_0xaa4f('0xe')]);router['put'](_0xaa4f('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xaa4f('0x10')]('/:id',auth[_0xaa4f('0x7')](),controller['destroy']);module[_0xaa4f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e2f009c..f84e127 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 _0xdbf5=['sequelize','STRING','HelpDesk'];(function(_0xf81382,_0x3a2565){var _0x36dbfa=function(_0x3cb5d0){while(--_0x3cb5d0){_0xf81382['push'](_0xf81382['shift']());}};_0x36dbfa(++_0x3a2565);}(_0xdbf5,0x159));var _0x5dbf=function(_0x11d48e,_0x21a582){_0x11d48e=_0x11d48e-0x0;var _0x41ff1a=_0xdbf5[_0x11d48e];return _0x41ff1a;};'use strict';var Sequelize=require(_0x5dbf('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5dbf('0x1')]},'username':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![],'defaultValue':_0x5dbf('0x2')},'remoteUri':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7af3=['STRING','HelpDesk','sequelize'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x7af3,0x1e8));var _0x37af=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7af3[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x37af('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x37af('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x37af('0x1')],'allowNull':![],'defaultValue':_0x37af('0x2')},'remoteUri':{'type':Sequelize[_0x37af('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x37af('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x37af('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 2950b39..ca165c1 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 _0xffa5=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','then','end','error','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','sort','AccountId','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','accessKey','remoteUri','slice','substring','%s/webservice.php','GET','getchallenge','success','result','sessionName','autogenerated','reference','owner','remove','false','label','cf_','picklist','picklistValues','value','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xffa5,0x6a));var _0x5ffa=function(_0x48df2e,_0x35e5a2){_0x48df2e=_0x48df2e-0x0;var _0x810007=_0xffa5[_0x48df2e];return _0x810007;};'use strict';var emlformat=require(_0x5ffa('0x0'));var rimraf=require(_0x5ffa('0x1'));var zipdir=require(_0x5ffa('0x2'));var jsonpatch=require(_0x5ffa('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ffa('0x4'));var Mustache=require(_0x5ffa('0x5'));var util=require('util');var path=require(_0x5ffa('0x6'));var sox=require(_0x5ffa('0x7'));var csv=require('to-csv');var ejs=require(_0x5ffa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ffa('0x9'));var squel=require(_0x5ffa('0xa'));var crypto=require(_0x5ffa('0xb'));var jsforce=require(_0x5ffa('0xc'));var deskjs=require(_0x5ffa('0xd'));var toCsv=require(_0x5ffa('0xe'));var querystring=require(_0x5ffa('0xf'));var Papa=require(_0x5ffa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ffa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ffa('0x12'))(_0x5ffa('0x13'));var utils=require(_0x5ffa('0x14'));var config=require(_0x5ffa('0x15'));var licenseUtil=require(_0x5ffa('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5ffa('0x17'));function respondWithStatusCode(_0x4a903e,_0x49467b){_0x49467b=_0x49467b||0xcc;return function(_0x8bff4e){if(_0x8bff4e){return _0x4a903e[_0x5ffa('0x18')](_0x49467b);}return _0x4a903e[_0x5ffa('0x19')](_0x49467b)['end']();};}function respondWithResult(_0x24a7de,_0x44d13f){_0x44d13f=_0x44d13f||0xc8;return function(_0x594923){if(_0x594923){return _0x24a7de[_0x5ffa('0x19')](_0x44d13f)['json'](_0x594923);}};}function respondWithFilteredResult(_0x26beb2,_0x3dc1ff){return function(_0xd2f8f0){if(_0xd2f8f0){var _0x17b83e=typeof _0x3dc1ff[_0x5ffa('0x1a')]===_0x5ffa('0x1b')&&typeof _0x3dc1ff[_0x5ffa('0x1c')]===_0x5ffa('0x1b');var _0x33ca9a=_0xd2f8f0['count'];var _0x579027=_0x17b83e?0x0:_0x3dc1ff[_0x5ffa('0x1a')];var _0x3d9625=_0x17b83e?_0xd2f8f0[_0x5ffa('0x1d')]:_0x3dc1ff[_0x5ffa('0x1a')]+_0x3dc1ff[_0x5ffa('0x1c')];var _0x514fab;if(_0x3d9625>=_0x33ca9a){_0x3d9625=_0x33ca9a;_0x514fab=0xc8;}else{_0x514fab=0xce;}_0x26beb2[_0x5ffa('0x19')](_0x514fab);return _0x26beb2[_0x5ffa('0x1e')]('Content-Range',_0x579027+'-'+_0x3d9625+'/'+_0x33ca9a)[_0x5ffa('0x1f')](_0xd2f8f0);}return null;};}function patchUpdates(_0xb33e81){return function(_0x75154e){try{jsonpatch[_0x5ffa('0x20')](_0x75154e,_0xb33e81,!![]);}catch(_0xaaab3b){return BPromise['reject'](_0xaaab3b);}return _0x75154e[_0x5ffa('0x21')]();};}function saveUpdates(_0x35a924,_0x2baa81){return function(_0x4d96dc){if(_0x4d96dc){return _0x4d96dc[_0x5ffa('0x22')](_0x35a924)[_0x5ffa('0x23')](function(_0x4067db){return _0x4067db;});}return null;};}function removeEntity(_0x4171b4,_0x326fea){return function(_0xdafbbc){if(_0xdafbbc){return _0xdafbbc['destroy']()[_0x5ffa('0x23')](function(){_0x4171b4[_0x5ffa('0x19')](0xcc)[_0x5ffa('0x24')]();});}};}function handleEntityNotFound(_0x4f2397,_0xaca77a){return function(_0x2f31b8){if(!_0x2f31b8){_0x4f2397['sendStatus'](0x194);}return _0x2f31b8;};}function handleError(_0x43e155,_0x48d77d){_0x48d77d=_0x48d77d||0x1f4;return function(_0x46af6){logger[_0x5ffa('0x25')](_0x46af6['stack']);if(_0x46af6[_0x5ffa('0x26')]){delete _0x46af6[_0x5ffa('0x26')];}_0x43e155['status'](_0x48d77d)[_0x5ffa('0x27')](_0x46af6);};}exports[_0x5ffa('0x28')]=function(_0x267db5,_0x1edcfd){var _0x2df6db={},_0x2fb658={},_0x42d5ab={'count':0x0,'rows':[]};var _0x371bf3=_[_0x5ffa('0x29')](db[_0x5ffa('0x2a')][_0x5ffa('0x2b')],function(_0x24fd6f){return{'name':_0x24fd6f[_0x5ffa('0x2c')],'type':_0x24fd6f[_0x5ffa('0x2d')][_0x5ffa('0x2e')]};});_0x2fb658['model']=_[_0x5ffa('0x29')](_0x371bf3,'name');_0x2fb658[_0x5ffa('0x2f')]=_[_0x5ffa('0x30')](_0x267db5[_0x5ffa('0x2f')]);_0x2fb658['filters']=_['intersection'](_0x2fb658['model'],_0x2fb658[_0x5ffa('0x2f')]);_0x2df6db[_0x5ffa('0x31')]=_[_0x5ffa('0x32')](_0x2fb658[_0x5ffa('0x33')],qs[_0x5ffa('0x34')](_0x267db5['query'][_0x5ffa('0x34')]));_0x2df6db[_0x5ffa('0x31')]=_0x2df6db[_0x5ffa('0x31')][_0x5ffa('0x35')]?_0x2df6db[_0x5ffa('0x31')]:_0x2fb658[_0x5ffa('0x33')];if(!_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x36')](_0x5ffa('0x37'))){_0x2df6db['limit']=qs[_0x5ffa('0x1c')](_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x1c')]);_0x2df6db['offset']=qs['offset'](_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x1a')]);}_0x2df6db[_0x5ffa('0x38')]=qs['sort'](_0x267db5[_0x5ffa('0x2f')]['sort']);_0x2df6db[_0x5ffa('0x39')]=qs['filters'](_[_0x5ffa('0x3a')](_0x267db5['query'],_0x2fb658[_0x5ffa('0x3b')]),_0x371bf3);if(_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x3c')]){_0x2df6db[_0x5ffa('0x39')]=_[_0x5ffa('0x3d')](_0x2df6db[_0x5ffa('0x39')],{'$or':_['map'](_0x371bf3,function(_0x3faae1){if(_0x3faae1[_0x5ffa('0x2d')]!==_0x5ffa('0x3e')){var _0x3d9e14={};_0x3d9e14[_0x3faae1[_0x5ffa('0x26')]]={'$like':'%'+_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x3c')]+'%'};return _0x3d9e14;}})});}_0x2df6db=_['merge']({},_0x2df6db,_0x267db5[_0x5ffa('0x3f')]);var _0x4a9e4a={'where':_0x2df6db[_0x5ffa('0x39')]};return db[_0x5ffa('0x2a')][_0x5ffa('0x1d')](_0x4a9e4a)[_0x5ffa('0x23')](function(_0x46b2d3){_0x42d5ab['count']=_0x46b2d3;if(_0x267db5[_0x5ffa('0x2f')][_0x5ffa('0x40')]){_0x2df6db[_0x5ffa('0x41')]=[{'all':!![]}];}return db[_0x5ffa('0x2a')][_0x5ffa('0x42')](_0x2df6db);})[_0x5ffa('0x23')](function(_0x22449d){_0x42d5ab[_0x5ffa('0x43')]=_0x22449d;return _0x42d5ab;})['then'](respondWithFilteredResult(_0x1edcfd,_0x2df6db))[_0x5ffa('0x44')](handleError(_0x1edcfd,null));};exports[_0x5ffa('0x45')]=function(_0x1e3cbe,_0xbded96){var _0x168848={'raw':![],'where':{'id':_0x1e3cbe[_0x5ffa('0x46')]['id']}},_0x4bbcbd={};_0x4bbcbd[_0x5ffa('0x33')]=_[_0x5ffa('0x30')](db[_0x5ffa('0x2a')][_0x5ffa('0x2b')]);_0x4bbcbd[_0x5ffa('0x2f')]=_[_0x5ffa('0x30')](_0x1e3cbe[_0x5ffa('0x2f')]);_0x4bbcbd[_0x5ffa('0x3b')]=_[_0x5ffa('0x32')](_0x4bbcbd[_0x5ffa('0x33')],_0x4bbcbd['query']);_0x168848['attributes']=_[_0x5ffa('0x32')](_0x4bbcbd[_0x5ffa('0x33')],qs[_0x5ffa('0x34')](_0x1e3cbe['query'][_0x5ffa('0x34')]));_0x168848['attributes']=_0x168848[_0x5ffa('0x31')][_0x5ffa('0x35')]?_0x168848[_0x5ffa('0x31')]:_0x4bbcbd['model'];if(_0x1e3cbe[_0x5ffa('0x2f')][_0x5ffa('0x40')]){_0x168848['include']=[{'all':!![]}];}_0x168848=_[_0x5ffa('0x3d')]({},_0x168848,_0x1e3cbe['options']);return db[_0x5ffa('0x2a')][_0x5ffa('0x47')](_0x168848)[_0x5ffa('0x23')](handleEntityNotFound(_0xbded96,null))[_0x5ffa('0x23')](respondWithResult(_0xbded96,null))['catch'](handleError(_0xbded96,null));};exports[_0x5ffa('0x48')]=function(_0x53f2b9,_0x438387){return db[_0x5ffa('0x2a')]['create'](_0x53f2b9[_0x5ffa('0x49')],{})[_0x5ffa('0x23')](respondWithResult(_0x438387,0xc9))[_0x5ffa('0x44')](handleError(_0x438387,null));};exports[_0x5ffa('0x22')]=function(_0x442ba8,_0x5389ca){if(_0x442ba8[_0x5ffa('0x49')]['id']){delete _0x442ba8['body']['id'];}return db[_0x5ffa('0x2a')][_0x5ffa('0x47')]({'where':{'id':_0x442ba8[_0x5ffa('0x46')]['id']}})[_0x5ffa('0x23')](handleEntityNotFound(_0x5389ca,null))[_0x5ffa('0x23')](saveUpdates(_0x442ba8[_0x5ffa('0x49')],null))['then'](respondWithResult(_0x5389ca,null))[_0x5ffa('0x44')](handleError(_0x5389ca,null));};exports[_0x5ffa('0x4a')]=function(_0x1653d5,_0x365c91){return db[_0x5ffa('0x2a')][_0x5ffa('0x47')]({'where':{'id':_0x1653d5[_0x5ffa('0x46')]['id']}})[_0x5ffa('0x23')](handleEntityNotFound(_0x365c91,null))[_0x5ffa('0x23')](removeEntity(_0x365c91,null))[_0x5ffa('0x44')](handleError(_0x365c91,null));};exports[_0x5ffa('0x4b')]=function(_0x368ce9,_0x1680cf,_0x464921){var _0x8fa851={};var _0x125c0d={};var _0x52c44b;var _0x25cc77;return db[_0x5ffa('0x2a')][_0x5ffa('0x4c')]({'where':{'id':_0x368ce9[_0x5ffa('0x46')]['id']}})['then'](handleEntityNotFound(_0x1680cf,null))[_0x5ffa('0x23')](function(_0x5d1ace){if(_0x5d1ace){_0x52c44b=_0x5d1ace;_0x125c0d[_0x5ffa('0x33')]=_['keys'](db['VtigerConfiguration'][_0x5ffa('0x2b')]);_0x125c0d['query']=_[_0x5ffa('0x30')](_0x368ce9[_0x5ffa('0x2f')]);_0x125c0d[_0x5ffa('0x3b')]=_['intersection'](_0x125c0d['model'],_0x125c0d[_0x5ffa('0x2f')]);_0x8fa851[_0x5ffa('0x31')]=_[_0x5ffa('0x32')](_0x125c0d['model'],qs[_0x5ffa('0x34')](_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x34')]));_0x8fa851[_0x5ffa('0x31')]=_0x8fa851['attributes'][_0x5ffa('0x35')]?_0x8fa851['attributes']:_0x125c0d[_0x5ffa('0x33')];_0x8fa851[_0x5ffa('0x38')]=qs[_0x5ffa('0x4d')](_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x4d')]);_0x8fa851[_0x5ffa('0x39')]=qs[_0x5ffa('0x3b')](_[_0x5ffa('0x3a')](_0x368ce9[_0x5ffa('0x2f')],_0x125c0d[_0x5ffa('0x3b')]));if(_0x368ce9['query']['filter']){_0x8fa851['where']=_[_0x5ffa('0x3d')](_0x8fa851[_0x5ffa('0x39')],{'$or':_[_0x5ffa('0x29')](_0x8fa851[_0x5ffa('0x31')],function(_0x267259){var _0x3ea38e={};_0x3ea38e[_0x267259]={'$like':'%'+_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x3c')]+'%'};return _0x3ea38e;})});}_0x8fa851=_[_0x5ffa('0x3d')]({},_0x8fa851,_0x368ce9[_0x5ffa('0x3f')]);return _0x52c44b['getConfigurations'](_0x8fa851);}})[_0x5ffa('0x23')](function(_0x4f8474){if(_0x4f8474){_0x25cc77=_0x4f8474[_0x5ffa('0x35')];if(!_0x368ce9['query'][_0x5ffa('0x36')]('nolimit')){_0x8fa851['limit']=qs[_0x5ffa('0x1c')](_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x1c')]);_0x8fa851[_0x5ffa('0x1a')]=qs['offset'](_0x368ce9[_0x5ffa('0x2f')][_0x5ffa('0x1a')]);}return _0x52c44b[_0x5ffa('0x4b')](_0x8fa851);}})[_0x5ffa('0x23')](function(_0x31cf9f){if(_0x31cf9f){return _0x31cf9f?{'count':_0x25cc77,'rows':_0x31cf9f}:null;}})['then'](respondWithResult(_0x1680cf,null))[_0x5ffa('0x44')](handleError(_0x1680cf,null));};exports['addConfiguration']=function(_0x16269b,_0x2bf0b5,_0x51a00f){if(_0x16269b['body']['id']){delete _0x16269b['body']['id'];}return db[_0x5ffa('0x2a')]['findOne']({'where':{'id':_0x16269b[_0x5ffa('0x46')]['id']}})[_0x5ffa('0x23')](handleEntityNotFound(_0x2bf0b5,null))[_0x5ffa('0x23')](function(_0x205389){if(_0x205389){_0x16269b['body'][_0x5ffa('0x4e')]=_0x205389['id'];_0x16269b[_0x5ffa('0x49')]['Subjects']=integrations['getSubjects'](_0x16269b[_0x5ffa('0x49')][_0x5ffa('0x4f')],_0x16269b['body']['type']);_0x16269b[_0x5ffa('0x49')][_0x5ffa('0x50')]=integrations[_0x5ffa('0x51')](_0x16269b[_0x5ffa('0x49')][_0x5ffa('0x4f')],_0x16269b['body'][_0x5ffa('0x2d')]);return db[_0x5ffa('0x52')][_0x5ffa('0x48')](_0x16269b[_0x5ffa('0x49')],{'include':[{'model':db[_0x5ffa('0x53')],'as':'Subjects'},{'model':db[_0x5ffa('0x53')],'as':_0x5ffa('0x50')}]});}return null;})['then'](respondWithResult(_0x2bf0b5,null))[_0x5ffa('0x44')](handleError(_0x2bf0b5,null));};var md5=require(_0x5ffa('0x54'));exports[_0x5ffa('0x55')]=function(_0x4908f9,_0x114642,_0x1202ac){var _0x3f1cd9=null;var _0x4f7461=null;var _0x15dd90=null;var _0x3fb419=null;var _0x2ac49c='';return db['VtigerAccount'][_0x5ffa('0x4c')]({'where':{'id':_0x4908f9['params']['id']},'attributes':['id',_0x5ffa('0x26'),_0x5ffa('0x56'),_0x5ffa('0x57'),_0x5ffa('0x58'),'remoteUri','serverUrl',_0x5ffa('0x59')]})[_0x5ffa('0x23')](handleEntityNotFound(_0x114642,null))[_0x5ffa('0x23')](function(_0x241cbf){if(_0x241cbf){_0x3f1cd9=_0x241cbf[_0x5ffa('0x56')];_0x4f7461=_0x241cbf['accessKey'];_0x15dd90=_0x241cbf[_0x5ffa('0x58')];_0x2ac49c=_0x241cbf[_0x5ffa('0x5a')];var _0x3ff3cb=_0x2ac49c[_0x5ffa('0x5b')](-0x1);if(_0x3ff3cb==='/'){_0x2ac49c=_0x2ac49c[_0x5ffa('0x5c')](0x0,_0x2ac49c['lastIndexOf'](_0x3ff3cb));}_0x3fb419=util['format'](_0x5ffa('0x5d'),_0x2ac49c);var _0x15b776={'method':_0x5ffa('0x5e'),'uri':_0x3fb419,'qs':{'operation':_0x5ffa('0x5f'),'username':_0x241cbf[_0x5ffa('0x56')]},'json':!![]};return rp(_0x15b776);}})[_0x5ffa('0x23')](function(_0x25fb02){if(_0x25fb02[_0x5ffa('0x60')]){var _0x551361={'method':'POST','uri':_0x3fb419,'form':{'operation':'login','username':_0x3f1cd9,'accessKey':md5(_0x25fb02[_0x5ffa('0x61')]['token']+_0x4f7461)},'json':!![]};return rp(_0x551361);}})['then'](function(_0x545a82){if(_0x545a82['success']){var _0x48a3bc={'method':_0x5ffa('0x5e'),'uri':_0x3fb419,'qs':{'operation':'describe','username':_0x3f1cd9,'sessionName':_0x545a82['result'][_0x5ffa('0x62')],'elementType':_0x15dd90},'json':!![]};return rp(_0x48a3bc);}})[_0x5ffa('0x23')](function(_0x34ff1f){if(_0x34ff1f[_0x5ffa('0x60')]){var _0x23c342=[_0x5ffa('0x63'),_0x5ffa('0x64'),_0x5ffa('0x65')];_[_0x5ffa('0x66')](_0x34ff1f['result'][_0x5ffa('0x34')],function(_0x1cd77c){return _0x23c342['includes'](_0x1cd77c[_0x5ffa('0x2d')][_0x5ffa('0x26')]);});_['remove'](_0x34ff1f[_0x5ffa('0x61')][_0x5ffa('0x34')],function(_0x2886df){return _0x2886df['editable']===_0x5ffa('0x67');});return{'count':_0x34ff1f[_0x5ffa('0x61')][_0x5ffa('0x34')][_0x5ffa('0x35')],'rows':_['map'](_0x34ff1f[_0x5ffa('0x61')][_0x5ffa('0x34')],function(_0x3f9ffe){return{'id':_0x3f9ffe['name'],'name':_0x3f9ffe[_0x5ffa('0x68')],'custom':_['startsWith'](_0x3f9ffe[_0x5ffa('0x26')],_0x5ffa('0x69'))?!![]:![],'options':_0x3f9ffe['type'][_0x5ffa('0x26')]===_0x5ffa('0x6a')&&_0x3f9ffe[_0x5ffa('0x2d')][_0x5ffa('0x6b')][_0x5ffa('0x35')]>0x0?_[_0x5ffa('0x29')](_0x3f9ffe[_0x5ffa('0x2d')]['picklistValues'],function(_0x15b1e3){return{'name':_0x15b1e3[_0x5ffa('0x68')],'value':_0x15b1e3[_0x5ffa('0x6c')]};}):[]};})};}})[_0x5ffa('0x23')](respondWithResult(_0x114642,null))[_0x5ffa('0x44')](function(_0x334d5f){console[_0x5ffa('0x6d')]('vTiger\x20error:\x20'+_0x334d5f);var _0x404bb8=_0x4908f9[_0x5ffa('0x2f')][_0x5ffa('0x6e')]?0x1f4:_0x334d5f[_0x5ffa('0x6f')]||0x1f4;logger[_0x5ffa('0x25')](_0x5ffa('0x70'),_0x5ffa('0x55'),_0x404bb8,JSON[_0x5ffa('0x71')](_0x334d5f));delete _0x334d5f[_0x5ffa('0x26')];if(_0x404bb8===0x191){_0x404bb8=0x190;}_0x114642['status'](_0x404bb8)[_0x5ffa('0x27')](_0x4908f9[_0x5ffa('0x2f')]['test']?{'message':_0x5ffa('0x72'),'statusCode':_0x334d5f[_0x5ffa('0x6f')]}:_0x334d5f);});}; \ No newline at end of file +var _0xc69c=['false','startsWith','cf_','picklist','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','map','rawAttributes','type','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','VtigerAccount','fields','find','create','body','getConfigurations','VtigerConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','findOne','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','POST','login','result','token','describe','sessionName','success','autogenerated','reference','owner','remove','editable'];(function(_0x140322,_0x43d8b1){var _0x4437fb=function(_0x38bf33){while(--_0x38bf33){_0x140322['push'](_0x140322['shift']());}};_0x4437fb(++_0x43d8b1);}(_0xc69c,0x101));var _0xcc69=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xc69c[_0x5627e1];return _0x2f013f;};'use strict';var emlformat=require(_0xcc69('0x0'));var rimraf=require(_0xcc69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc69('0x2'));var rp=require(_0xcc69('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc69('0x4'));var util=require(_0xcc69('0x5'));var path=require(_0xcc69('0x6'));var sox=require('sox');var csv=require(_0xcc69('0x7'));var ejs=require(_0xcc69('0x8'));var fs=require('fs');var fs_extra=require(_0xcc69('0x9'));var _=require(_0xcc69('0xa'));var squel=require(_0xcc69('0xb'));var crypto=require(_0xcc69('0xc'));var jsforce=require(_0xcc69('0xd'));var deskjs=require(_0xcc69('0xe'));var toCsv=require(_0xcc69('0x7'));var querystring=require('querystring');var Papa=require(_0xcc69('0xf'));var Redis=require(_0xcc69('0x10'));var authService=require(_0xcc69('0x11'));var qs=require(_0xcc69('0x12'));var as=require(_0xcc69('0x13'));var hardwareService=require(_0xcc69('0x14'));var logger=require(_0xcc69('0x15'))('api');var utils=require(_0xcc69('0x16'));var config=require(_0xcc69('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc69('0x18'))['db'];var integrations=require(_0xcc69('0x19'));function respondWithStatusCode(_0x16a78f,_0x5db5e7){_0x5db5e7=_0x5db5e7||0xcc;return function(_0x576c70){if(_0x576c70){return _0x16a78f['sendStatus'](_0x5db5e7);}return _0x16a78f['status'](_0x5db5e7)[_0xcc69('0x1a')]();};}function respondWithResult(_0x386a60,_0x29bef){_0x29bef=_0x29bef||0xc8;return function(_0x8f4ae6){if(_0x8f4ae6){return _0x386a60[_0xcc69('0x1b')](_0x29bef)[_0xcc69('0x1c')](_0x8f4ae6);}};}function respondWithFilteredResult(_0x2c062c,_0x118ddd){return function(_0x1b946c){if(_0x1b946c){var _0x2e2ab2=typeof _0x118ddd[_0xcc69('0x1d')]===_0xcc69('0x1e')&&typeof _0x118ddd[_0xcc69('0x1f')]==='undefined';var _0x4c827f=_0x1b946c[_0xcc69('0x20')];var _0x65507=_0x2e2ab2?0x0:_0x118ddd[_0xcc69('0x1d')];var _0x1edc3f=_0x2e2ab2?_0x1b946c['count']:_0x118ddd[_0xcc69('0x1d')]+_0x118ddd[_0xcc69('0x1f')];var _0x388247;if(_0x1edc3f>=_0x4c827f){_0x1edc3f=_0x4c827f;_0x388247=0xc8;}else{_0x388247=0xce;}_0x2c062c[_0xcc69('0x1b')](_0x388247);return _0x2c062c[_0xcc69('0x21')](_0xcc69('0x22'),_0x65507+'-'+_0x1edc3f+'/'+_0x4c827f)[_0xcc69('0x1c')](_0x1b946c);}return null;};}function patchUpdates(_0x2deb19){return function(_0x237bde){try{jsonpatch['apply'](_0x237bde,_0x2deb19,!![]);}catch(_0xd67971){return BPromise[_0xcc69('0x23')](_0xd67971);}return _0x237bde[_0xcc69('0x24')]();};}function saveUpdates(_0x3915c3,_0x14b843){return function(_0x3b64f5){if(_0x3b64f5){return _0x3b64f5[_0xcc69('0x25')](_0x3915c3)[_0xcc69('0x26')](function(_0x599da6){return _0x599da6;});}return null;};}function removeEntity(_0x53467b,_0x1f92a5){return function(_0x4db2da){if(_0x4db2da){return _0x4db2da['destroy']()[_0xcc69('0x26')](function(){_0x53467b[_0xcc69('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x306876,_0x360ca4){return function(_0x181442){if(!_0x181442){_0x306876[_0xcc69('0x27')](0x194);}return _0x181442;};}function handleError(_0x28b29a,_0x405f4d){_0x405f4d=_0x405f4d||0x1f4;return function(_0x4e302f){logger[_0xcc69('0x28')](_0x4e302f[_0xcc69('0x29')]);if(_0x4e302f[_0xcc69('0x2a')]){delete _0x4e302f[_0xcc69('0x2a')];}_0x28b29a['status'](_0x405f4d)[_0xcc69('0x2b')](_0x4e302f);};}exports['index']=function(_0x10a325,_0x427cb6){var _0x305aa6={},_0x1536d6={},_0xb9fb63={'count':0x0,'rows':[]};var _0x108cf8=_[_0xcc69('0x2c')](db['VtigerAccount'][_0xcc69('0x2d')],function(_0x574df0){return{'name':_0x574df0['fieldName'],'type':_0x574df0[_0xcc69('0x2e')]['key']};});_0x1536d6[_0xcc69('0x2f')]=_[_0xcc69('0x2c')](_0x108cf8,_0xcc69('0x2a'));_0x1536d6[_0xcc69('0x30')]=_['keys'](_0x10a325[_0xcc69('0x30')]);_0x1536d6[_0xcc69('0x31')]=_[_0xcc69('0x32')](_0x1536d6[_0xcc69('0x2f')],_0x1536d6[_0xcc69('0x30')]);_0x305aa6['attributes']=_[_0xcc69('0x32')](_0x1536d6['model'],qs['fields'](_0x10a325[_0xcc69('0x30')]['fields']));_0x305aa6['attributes']=_0x305aa6[_0xcc69('0x33')][_0xcc69('0x34')]?_0x305aa6[_0xcc69('0x33')]:_0x1536d6[_0xcc69('0x2f')];if(!_0x10a325['query'][_0xcc69('0x35')]('nolimit')){_0x305aa6['limit']=qs[_0xcc69('0x1f')](_0x10a325[_0xcc69('0x30')][_0xcc69('0x1f')]);_0x305aa6['offset']=qs['offset'](_0x10a325[_0xcc69('0x30')][_0xcc69('0x1d')]);}_0x305aa6['order']=qs[_0xcc69('0x36')](_0x10a325[_0xcc69('0x30')][_0xcc69('0x36')]);_0x305aa6['where']=qs[_0xcc69('0x31')](_['pick'](_0x10a325['query'],_0x1536d6[_0xcc69('0x31')]),_0x108cf8);if(_0x10a325['query'][_0xcc69('0x37')]){_0x305aa6[_0xcc69('0x38')]=_[_0xcc69('0x39')](_0x305aa6[_0xcc69('0x38')],{'$or':_[_0xcc69('0x2c')](_0x108cf8,function(_0x1ea058){if(_0x1ea058[_0xcc69('0x2e')]!==_0xcc69('0x3a')){var _0x3491bd={};_0x3491bd[_0x1ea058[_0xcc69('0x2a')]]={'$like':'%'+_0x10a325[_0xcc69('0x30')][_0xcc69('0x37')]+'%'};return _0x3491bd;}})});}_0x305aa6=_[_0xcc69('0x39')]({},_0x305aa6,_0x10a325[_0xcc69('0x3b')]);var _0x1ddba6={'where':_0x305aa6[_0xcc69('0x38')]};return db['VtigerAccount'][_0xcc69('0x20')](_0x1ddba6)['then'](function(_0x207aaf){_0xb9fb63['count']=_0x207aaf;if(_0x10a325['query'][_0xcc69('0x3c')]){_0x305aa6[_0xcc69('0x3d')]=[{'all':!![]}];}return db['VtigerAccount'][_0xcc69('0x3e')](_0x305aa6);})[_0xcc69('0x26')](function(_0x3b7fc4){_0xb9fb63['rows']=_0x3b7fc4;return _0xb9fb63;})[_0xcc69('0x26')](respondWithFilteredResult(_0x427cb6,_0x305aa6))[_0xcc69('0x3f')](handleError(_0x427cb6,null));};exports[_0xcc69('0x40')]=function(_0x87aea4,_0x30a608){var _0x101498={'raw':![],'where':{'id':_0x87aea4[_0xcc69('0x41')]['id']}},_0x393256={};_0x393256[_0xcc69('0x2f')]=_[_0xcc69('0x42')](db[_0xcc69('0x43')][_0xcc69('0x2d')]);_0x393256[_0xcc69('0x30')]=_[_0xcc69('0x42')](_0x87aea4['query']);_0x393256['filters']=_['intersection'](_0x393256[_0xcc69('0x2f')],_0x393256['query']);_0x101498[_0xcc69('0x33')]=_[_0xcc69('0x32')](_0x393256[_0xcc69('0x2f')],qs[_0xcc69('0x44')](_0x87aea4[_0xcc69('0x30')][_0xcc69('0x44')]));_0x101498[_0xcc69('0x33')]=_0x101498[_0xcc69('0x33')][_0xcc69('0x34')]?_0x101498[_0xcc69('0x33')]:_0x393256['model'];if(_0x87aea4[_0xcc69('0x30')][_0xcc69('0x3c')]){_0x101498['include']=[{'all':!![]}];}_0x101498=_[_0xcc69('0x39')]({},_0x101498,_0x87aea4[_0xcc69('0x3b')]);return db[_0xcc69('0x43')][_0xcc69('0x45')](_0x101498)[_0xcc69('0x26')](handleEntityNotFound(_0x30a608,null))['then'](respondWithResult(_0x30a608,null))[_0xcc69('0x3f')](handleError(_0x30a608,null));};exports[_0xcc69('0x46')]=function(_0x2c992c,_0x2f895e){return db[_0xcc69('0x43')]['create'](_0x2c992c['body'],{})[_0xcc69('0x26')](respondWithResult(_0x2f895e,0xc9))[_0xcc69('0x3f')](handleError(_0x2f895e,null));};exports[_0xcc69('0x25')]=function(_0x21958f,_0x55df7c){if(_0x21958f[_0xcc69('0x47')]['id']){delete _0x21958f['body']['id'];}return db[_0xcc69('0x43')]['find']({'where':{'id':_0x21958f[_0xcc69('0x41')]['id']}})['then'](handleEntityNotFound(_0x55df7c,null))[_0xcc69('0x26')](saveUpdates(_0x21958f[_0xcc69('0x47')],null))[_0xcc69('0x26')](respondWithResult(_0x55df7c,null))['catch'](handleError(_0x55df7c,null));};exports['destroy']=function(_0x5188e6,_0x5a295e){return db[_0xcc69('0x43')][_0xcc69('0x45')]({'where':{'id':_0x5188e6[_0xcc69('0x41')]['id']}})[_0xcc69('0x26')](handleEntityNotFound(_0x5a295e,null))['then'](removeEntity(_0x5a295e,null))[_0xcc69('0x3f')](handleError(_0x5a295e,null));};exports[_0xcc69('0x48')]=function(_0x5589a8,_0x4086bb,_0x43aeb0){var _0x4a345b={};var _0x3ff128={};var _0x594da6;var _0x2dab9b;return db['VtigerAccount']['findOne']({'where':{'id':_0x5589a8[_0xcc69('0x41')]['id']}})[_0xcc69('0x26')](handleEntityNotFound(_0x4086bb,null))['then'](function(_0x4019b0){if(_0x4019b0){_0x594da6=_0x4019b0;_0x3ff128[_0xcc69('0x2f')]=_[_0xcc69('0x42')](db[_0xcc69('0x49')]['rawAttributes']);_0x3ff128[_0xcc69('0x30')]=_[_0xcc69('0x42')](_0x5589a8[_0xcc69('0x30')]);_0x3ff128[_0xcc69('0x31')]=_[_0xcc69('0x32')](_0x3ff128[_0xcc69('0x2f')],_0x3ff128['query']);_0x4a345b['attributes']=_[_0xcc69('0x32')](_0x3ff128[_0xcc69('0x2f')],qs[_0xcc69('0x44')](_0x5589a8[_0xcc69('0x30')][_0xcc69('0x44')]));_0x4a345b[_0xcc69('0x33')]=_0x4a345b[_0xcc69('0x33')]['length']?_0x4a345b['attributes']:_0x3ff128[_0xcc69('0x2f')];_0x4a345b['order']=qs[_0xcc69('0x36')](_0x5589a8[_0xcc69('0x30')]['sort']);_0x4a345b['where']=qs[_0xcc69('0x31')](_['pick'](_0x5589a8[_0xcc69('0x30')],_0x3ff128[_0xcc69('0x31')]));if(_0x5589a8[_0xcc69('0x30')][_0xcc69('0x37')]){_0x4a345b[_0xcc69('0x38')]=_[_0xcc69('0x39')](_0x4a345b[_0xcc69('0x38')],{'$or':_[_0xcc69('0x2c')](_0x4a345b['attributes'],function(_0x7d3df7){var _0x3c6d13={};_0x3c6d13[_0x7d3df7]={'$like':'%'+_0x5589a8[_0xcc69('0x30')][_0xcc69('0x37')]+'%'};return _0x3c6d13;})});}_0x4a345b=_[_0xcc69('0x39')]({},_0x4a345b,_0x5589a8[_0xcc69('0x3b')]);return _0x594da6['getConfigurations'](_0x4a345b);}})['then'](function(_0x45c37a){if(_0x45c37a){_0x2dab9b=_0x45c37a['length'];if(!_0x5589a8[_0xcc69('0x30')][_0xcc69('0x35')](_0xcc69('0x4a'))){_0x4a345b[_0xcc69('0x1f')]=qs['limit'](_0x5589a8[_0xcc69('0x30')][_0xcc69('0x1f')]);_0x4a345b[_0xcc69('0x1d')]=qs['offset'](_0x5589a8['query'][_0xcc69('0x1d')]);}return _0x594da6[_0xcc69('0x48')](_0x4a345b);}})[_0xcc69('0x26')](function(_0x498ecf){if(_0x498ecf){return _0x498ecf?{'count':_0x2dab9b,'rows':_0x498ecf}:null;}})[_0xcc69('0x26')](respondWithResult(_0x4086bb,null))['catch'](handleError(_0x4086bb,null));};exports[_0xcc69('0x4b')]=function(_0x543840,_0x5eaf94,_0x280eaa){if(_0x543840[_0xcc69('0x47')]['id']){delete _0x543840[_0xcc69('0x47')]['id'];}return db[_0xcc69('0x43')]['findOne']({'where':{'id':_0x543840['params']['id']}})['then'](handleEntityNotFound(_0x5eaf94,null))[_0xcc69('0x26')](function(_0x185bad){if(_0x185bad){_0x543840['body'][_0xcc69('0x4c')]=_0x185bad['id'];_0x543840[_0xcc69('0x47')][_0xcc69('0x4d')]=integrations[_0xcc69('0x4e')](_0x543840[_0xcc69('0x47')][_0xcc69('0x4f')],_0x543840[_0xcc69('0x47')][_0xcc69('0x2e')]);_0x543840[_0xcc69('0x47')][_0xcc69('0x50')]=integrations[_0xcc69('0x51')](_0x543840['body'][_0xcc69('0x4f')],_0x543840[_0xcc69('0x47')][_0xcc69('0x2e')]);return db['VtigerConfiguration'][_0xcc69('0x46')](_0x543840[_0xcc69('0x47')],{'include':[{'model':db[_0xcc69('0x52')],'as':'Subjects'},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0xcc69('0x26')](respondWithResult(_0x5eaf94,null))['catch'](handleError(_0x5eaf94,null));};var md5=require(_0xcc69('0x53'));exports['getFields']=function(_0xea0932,_0x21ea5,_0x253872){var _0x2c5152=null;var _0x3a8b81=null;var _0x2aae51=null;var _0x2c4972=null;var _0x2c634c='';return db[_0xcc69('0x43')][_0xcc69('0x54')]({'where':{'id':_0xea0932[_0xcc69('0x41')]['id']},'attributes':['id',_0xcc69('0x2a'),_0xcc69('0x55'),_0xcc69('0x56'),_0xcc69('0x57'),_0xcc69('0x58'),_0xcc69('0x59'),_0xcc69('0x5a')]})['then'](handleEntityNotFound(_0x21ea5,null))['then'](function(_0x7e7da8){if(_0x7e7da8){_0x2c5152=_0x7e7da8[_0xcc69('0x55')];_0x3a8b81=_0x7e7da8['accessKey'];_0x2aae51=_0x7e7da8[_0xcc69('0x57')];_0x2c634c=_0x7e7da8['remoteUri'];var _0x10f431=_0x2c634c[_0xcc69('0x5b')](-0x1);if(_0x10f431==='/'){_0x2c634c=_0x2c634c[_0xcc69('0x5c')](0x0,_0x2c634c[_0xcc69('0x5d')](_0x10f431));}_0x2c4972=util['format'](_0xcc69('0x5e'),_0x2c634c);var _0x64a298={'method':_0xcc69('0x5f'),'uri':_0x2c4972,'qs':{'operation':_0xcc69('0x60'),'username':_0x7e7da8[_0xcc69('0x55')]},'json':!![]};return rp(_0x64a298);}})[_0xcc69('0x26')](function(_0x490464){if(_0x490464['success']){var _0x644c69={'method':_0xcc69('0x61'),'uri':_0x2c4972,'form':{'operation':_0xcc69('0x62'),'username':_0x2c5152,'accessKey':md5(_0x490464[_0xcc69('0x63')][_0xcc69('0x64')]+_0x3a8b81)},'json':!![]};return rp(_0x644c69);}})[_0xcc69('0x26')](function(_0x4c54d4){if(_0x4c54d4['success']){var _0x2a2d9c={'method':_0xcc69('0x5f'),'uri':_0x2c4972,'qs':{'operation':_0xcc69('0x65'),'username':_0x2c5152,'sessionName':_0x4c54d4[_0xcc69('0x63')][_0xcc69('0x66')],'elementType':_0x2aae51},'json':!![]};return rp(_0x2a2d9c);}})[_0xcc69('0x26')](function(_0x27206e){if(_0x27206e[_0xcc69('0x67')]){var _0x4ac468=[_0xcc69('0x68'),_0xcc69('0x69'),_0xcc69('0x6a')];_[_0xcc69('0x6b')](_0x27206e[_0xcc69('0x63')]['fields'],function(_0x169f28){return _0x4ac468['includes'](_0x169f28[_0xcc69('0x2e')]['name']);});_[_0xcc69('0x6b')](_0x27206e['result'][_0xcc69('0x44')],function(_0x1bb3f7){return _0x1bb3f7[_0xcc69('0x6c')]===_0xcc69('0x6d');});return{'count':_0x27206e['result'][_0xcc69('0x44')]['length'],'rows':_['map'](_0x27206e['result']['fields'],function(_0x1d6d59){return{'id':_0x1d6d59[_0xcc69('0x2a')],'name':_0x1d6d59['label'],'custom':_[_0xcc69('0x6e')](_0x1d6d59['name'],_0xcc69('0x6f'))?!![]:![],'options':_0x1d6d59[_0xcc69('0x2e')][_0xcc69('0x2a')]===_0xcc69('0x70')&&_0x1d6d59[_0xcc69('0x2e')][_0xcc69('0x71')]['length']>0x0?_['map'](_0x1d6d59[_0xcc69('0x2e')][_0xcc69('0x71')],function(_0x1b9a32){return{'name':_0x1b9a32['label'],'value':_0x1b9a32[_0xcc69('0x72')]};}):[]};})};}})[_0xcc69('0x26')](respondWithResult(_0x21ea5,null))[_0xcc69('0x3f')](function(_0x4ad633){console[_0xcc69('0x73')]('vTiger\x20error:\x20'+_0x4ad633);var _0x37fbc7=_0xea0932['query'][_0xcc69('0x74')]?0x1f4:_0x4ad633['statusCode']||0x1f4;logger[_0xcc69('0x28')](_0xcc69('0x75'),_0xcc69('0x76'),_0x37fbc7,JSON[_0xcc69('0x77')](_0x4ad633));delete _0x4ad633['name'];if(_0x37fbc7===0x191){_0x37fbc7=0x190;}_0x21ea5[_0xcc69('0x1b')](_0x37fbc7)[_0xcc69('0x2b')](_0xea0932[_0xcc69('0x30')]['test']?{'message':_0xcc69('0x78'),'statusCode':_0x4ad633[_0xcc69('0x79')]}:_0x4ad633);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 76f1eec..50db418 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 _0x7889=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x1e40de,_0x32153){var _0xe135f9=function(_0x47d2c1){while(--_0x47d2c1){_0x1e40de['push'](_0x1e40de['shift']());}};_0xe135f9(++_0x32153);}(_0x7889,0xde));var _0x9788=function(_0x2c7148,_0x5c9bb6){_0x2c7148=_0x2c7148-0x0;var _0x2d68e2=_0x7889[_0x2c7148];return _0x2d68e2;};'use strict';var _=require(_0x9788('0x0'));var util=require(_0x9788('0x1'));var logger=require(_0x9788('0x2'))(_0x9788('0x3'));var moment=require('moment');var BPromise=require(_0x9788('0x4'));var rp=require(_0x9788('0x5'));var fs=require('fs');var path=require(_0x9788('0x6'));var rimraf=require(_0x9788('0x7'));var config=require(_0x9788('0x8'));var attributes=require(_0x9788('0x9'));var integrations=require(_0x9788('0xa'));module['exports']=function(_0x217cd2,_0x5910be){return _0x217cd2[_0x9788('0xb')](_0x9788('0xc'),attributes,{'tableName':_0x9788('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ab8=['util','api','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x514bd1,_0x25ea3e){var _0x58a281=function(_0x25567a){while(--_0x25567a){_0x514bd1['push'](_0x514bd1['shift']());}};_0x58a281(++_0x25ea3e);}(_0x3ab8,0x173));var _0x83ab=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x3ab8[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x83ab('0x0'));var util=require(_0x83ab('0x1'));var logger=require('../../config/logger')(_0x83ab('0x2'));var moment=require(_0x83ab('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x83ab('0x4'));var rimraf=require(_0x83ab('0x5'));var config=require(_0x83ab('0x6'));var attributes=require(_0x83ab('0x7'));var integrations=require(_0x83ab('0x8'));module[_0x83ab('0x9')]=function(_0x5a3340,_0x1b2ccf){return _0x5a3340['define'](_0x83ab('0xa'),attributes,{'tableName':_0x83ab('0xb'),'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 72ca8dc..ea2942d 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 _0x0bb5=['VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','limit','map','include','model','attributes','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x597eb6,_0x4fbdea){var _0x58c0fb=function(_0x357767){while(--_0x357767){_0x597eb6['push'](_0x597eb6['shift']());}};_0x58c0fb(++_0x4fbdea);}(_0x0bb5,0x148));var _0x50bb=function(_0xfd9abe,_0x7dcca4){_0xfd9abe=_0xfd9abe-0x0;var _0xb8e118=_0x0bb5[_0xfd9abe];return _0xb8e118;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});}exports['GetVtigerAccount']=function(_0x24ba19){var _0x4796ec=this;return new Promise(function(_0x301f61,_0x431ed4){return db['VtigerAccount']['findAll']({'raw':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x24ba19[_0x50bb('0x16')]?_0x24ba19['options'][_0x50bb('0x18')]||null:null,'attributes':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')]['attributes']||null:null,'limit':_0x24ba19[_0x50bb('0x16')]?_0x24ba19[_0x50bb('0x16')][_0x50bb('0x19')]||null:null,'include':_0x24ba19['options']?_0x24ba19[_0x50bb('0x16')]['include']?_[_0x50bb('0x1a')](_0x24ba19[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x2ee87a){return{'model':db[_0x2ee87a[_0x50bb('0x1c')]],'as':_0x2ee87a['as'],'attributes':_0x2ee87a[_0x50bb('0x1d')],'include':_0x2ee87a['include']?_[_0x50bb('0x1a')](_0x2ee87a[_0x50bb('0x1b')],function(_0x284a76){return{'model':db[_0x284a76[_0x50bb('0x1c')]],'as':_0x284a76['as'],'attributes':_0x284a76['attributes'],'include':_0x284a76[_0x50bb('0x1b')]?_['map'](_0x284a76['include'],function(_0x2befd9){return{'model':db[_0x2befd9['model']],'as':_0x2befd9['as'],'attributes':_0x2befd9['attributes']};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x12ee2c){logger[_0x50bb('0xb')](_0x50bb('0x1e'),_0x24ba19);logger[_0x50bb('0xd')](_0x50bb('0x1e'),_0x24ba19,JSON[_0x50bb('0x10')](_0x12ee2c));_0x301f61(_0x12ee2c);})[_0x50bb('0x15')](function(_0x4f7514){logger[_0x50bb('0x11')](_0x50bb('0x1e'),_0x4f7514[_0x50bb('0x13')],_0x24ba19);_0x431ed4(_0x4796ec[_0x50bb('0x11')](0x1f4,_0x4f7514['message']));});});};exports[_0x50bb('0x1f')]=function(_0x1a62fb){var _0xc38da5=this;return new Promise(function(_0xb3c3ba,_0x3fd5f6){return db[_0x50bb('0x20')][_0x50bb('0x21')]({'raw':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x17')]===undefined?!![]:![]:!![],'where':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')]['where']||null:null,'attributes':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1d')]||null:null,'include':_0x1a62fb[_0x50bb('0x16')]?_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1a62fb[_0x50bb('0x16')][_0x50bb('0x1b')],function(_0x1cc4e2){return{'model':db[_0x1cc4e2[_0x50bb('0x1c')]],'as':_0x1cc4e2['as'],'attributes':_0x1cc4e2['attributes'],'include':_0x1cc4e2[_0x50bb('0x1b')]?_[_0x50bb('0x1a')](_0x1cc4e2[_0x50bb('0x1b')],function(_0x2bfb54){return{'model':db[_0x2bfb54[_0x50bb('0x1c')]],'as':_0x2bfb54['as'],'attributes':_0x2bfb54[_0x50bb('0x1d')],'include':_0x2bfb54['include']?_['map'](_0x2bfb54[_0x50bb('0x1b')],function(_0x5ed0b4){return{'model':db[_0x5ed0b4[_0x50bb('0x1c')]],'as':_0x5ed0b4['as'],'attributes':_0x5ed0b4[_0x50bb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x50bb('0xa')](function(_0x171c6b){logger[_0x50bb('0xb')]('ShowVtigerAccount',_0x1a62fb);logger[_0x50bb('0xd')]('ShowVtigerAccount',_0x1a62fb,JSON[_0x50bb('0x10')](_0x171c6b));_0xb3c3ba(_0x171c6b);})[_0x50bb('0x15')](function(_0x280e5a){logger['error']('ShowVtigerAccount',_0x280e5a[_0x50bb('0x13')],_0x1a62fb);_0x3fd5f6(_0xc38da5[_0x50bb('0x11')](0x1f4,_0x280e5a[_0x50bb('0x13')]));});});}; \ No newline at end of file +var _0x282b=['map','model','ShowVtigerAccount','VtigerAccount','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','include'];(function(_0x1769c9,_0x12e11a){var _0x12d755=function(_0xcb5304){while(--_0xcb5304){_0x1769c9['push'](_0x1769c9['shift']());}};_0x12d755(++_0x12e11a);}(_0x282b,0xec));var _0xb282=function(_0x26ca7f,_0x2b9aa4){_0x26ca7f=_0x26ca7f-0x0;var _0x5416c4=_0x282b[_0x26ca7f];return _0x5416c4;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['VtigerAccount'][_0xb282('0x16')]({'raw':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x19')]||null:null,'attributes':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x1a')]||null:null,'limit':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')]['limit']||null:null,'include':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x1b')]?_[_0xb282('0x1c')](_0xca5f12[_0xb282('0x17')]['include'],function(_0x4d624f){return{'model':db[_0x4d624f[_0xb282('0x1d')]],'as':_0x4d624f['as'],'attributes':_0x4d624f[_0xb282('0x1a')],'include':_0x4d624f['include']?_['map'](_0x4d624f[_0xb282('0x1b')],function(_0x114f77){return{'model':db[_0x114f77[_0xb282('0x1d')]],'as':_0x114f77['as'],'attributes':_0x114f77[_0xb282('0x1a')],'include':_0x114f77[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x114f77['include'],function(_0xa0d7fb){return{'model':db[_0xa0d7fb[_0xb282('0x1d')]],'as':_0xa0d7fb['as'],'attributes':_0xa0d7fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb282('0xb')](function(_0x38a1f8){logger[_0xb282('0xc')](_0xb282('0x15'),_0xca5f12);logger['debug'](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x38a1f8));_0x3f8a3f(_0x38a1f8);})[_0xb282('0x14')](function(_0x433ad5){logger[_0xb282('0x11')](_0xb282('0x15'),_0x433ad5[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070['error'](0x1f4,_0x433ad5[_0xb282('0x12')]));});});};exports[_0xb282('0x1e')]=function(_0x3eb294){var _0xd8780b=this;return new Promise(function(_0x42ef75,_0x5f3ddf){return db[_0xb282('0x1f')]['find']({'raw':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb294['options']?_0x3eb294[_0xb282('0x17')]['where']||null:null,'attributes':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1a')]||null:null,'include':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')]?_['map'](_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')],function(_0x4ede9d){return{'model':db[_0x4ede9d['model']],'as':_0x4ede9d['as'],'attributes':_0x4ede9d[_0xb282('0x1a')],'include':_0x4ede9d[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4ede9d['include'],function(_0x4a76ce){return{'model':db[_0x4a76ce['model']],'as':_0x4a76ce['as'],'attributes':_0x4a76ce[_0xb282('0x1a')],'include':_0x4a76ce[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4a76ce[_0xb282('0x1b')],function(_0x17c1e4){return{'model':db[_0x17c1e4[_0xb282('0x1d')]],'as':_0x17c1e4['as'],'attributes':_0x17c1e4[_0xb282('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc171){logger['info'](_0xb282('0x1e'),_0x3eb294);logger[_0xb282('0x20')](_0xb282('0x1e'),_0x3eb294,JSON['stringify'](_0x3dc171));_0x42ef75(_0x3dc171);})[_0xb282('0x14')](function(_0x4beef2){logger[_0xb282('0x11')](_0xb282('0x1e'),_0x4beef2[_0xb282('0x12')],_0x3eb294);_0x5f3ddf(_0xd8780b[_0xb282('0x11')](0x1f4,_0x4beef2['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d48c1a8..87ff3c7 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 _0xb57a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','exports'];(function(_0x3feab0,_0x3490ce){var _0x3eca70=function(_0xebdaa4){while(--_0xebdaa4){_0x3feab0['push'](_0x3feab0['shift']());}};_0x3eca70(++_0x3490ce);}(_0xb57a,0x69));var _0xab57=function(_0x58eee8,_0x13da33){_0x58eee8=_0x58eee8-0x0;var _0x40e81=_0xb57a[_0x58eee8];return _0x40e81;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab57('0x0'));var timeout=require(_0xab57('0x1'));var express=require(_0xab57('0x2'));var router=express[_0xab57('0x3')]();var fs_extra=require(_0xab57('0x4'));var auth=require(_0xab57('0x5'));var interaction=require(_0xab57('0x6'));var config=require(_0xab57('0x7'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0xab57('0x8')](),controller[_0xab57('0x9')]);router[_0xab57('0xa')](_0xab57('0xb'),auth[_0xab57('0x8')](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xab57('0xc')]);router[_0xab57('0xa')](_0xab57('0xd'),auth[_0xab57('0x8')](),controller[_0xab57('0xe')]);router['get'](_0xab57('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xab57('0x10')]('/',auth['isAuthenticated'](),controller[_0xab57('0x11')]);router['put'](_0xab57('0xb'),auth['isAuthenticated'](),controller[_0xab57('0x12')]);router[_0xab57('0x13')]('/:id',auth[_0xab57('0x8')](),controller['destroy']);module[_0xab57('0x14')]=router; \ No newline at end of file +var _0xdba1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x175c13,_0x21224d){var _0x4876a6=function(_0x3252ae){while(--_0x3252ae){_0x175c13['push'](_0x175c13['shift']());}};_0x4876a6(++_0x21224d);}(_0xdba1,0x186));var _0x1dba=function(_0x1f7494,_0x2f0b7d){_0x1f7494=_0x1f7494-0x0;var _0xb9afbf=_0xdba1[_0x1f7494];return _0xb9afbf;};'use strict';var multer=require(_0x1dba('0x0'));var util=require(_0x1dba('0x1'));var path=require('path');var timeout=require(_0x1dba('0x2'));var express=require(_0x1dba('0x3'));var router=express[_0x1dba('0x4')]();var fs_extra=require(_0x1dba('0x5'));var auth=require(_0x1dba('0x6'));var interaction=require(_0x1dba('0x7'));var config=require(_0x1dba('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x1dba('0x9')]('/',auth['isAuthenticated'](),controller[_0x1dba('0xa')]);router[_0x1dba('0x9')](_0x1dba('0xb'),auth[_0x1dba('0xc')](),controller[_0x1dba('0xd')]);router[_0x1dba('0x9')](_0x1dba('0xe'),auth[_0x1dba('0xc')](),controller[_0x1dba('0xf')]);router[_0x1dba('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x1dba('0x10')]);router[_0x1dba('0x9')]('/:id/descriptions',auth[_0x1dba('0xc')](),controller['getDescriptions']);router[_0x1dba('0x11')]('/',auth['isAuthenticated'](),controller[_0x1dba('0x12')]);router[_0x1dba('0x13')](_0x1dba('0xb'),auth[_0x1dba('0xc')](),controller['update']);router[_0x1dba('0x14')](_0x1dba('0xb'),auth[_0x1dba('0xc')](),controller[_0x1dba('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c4a8ef6..494f007 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 _0x9a52=['STRING','sequelize','exports'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0x9a52,0x1a5));var _0x29a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x29a5('0x0'));module[_0x29a5('0x1')]={'name':{'type':Sequelize[_0x29a5('0x2')]},'description':{'type':Sequelize[_0x29a5('0x2')]}}; \ No newline at end of file +var _0x0128=['exports','STRING','sequelize'];(function(_0x11efd6,_0xc19a5c){var _0x533bbc=function(_0x54de6c){while(--_0x54de6c){_0x11efd6['push'](_0x11efd6['shift']());}};_0x533bbc(++_0xc19a5c);}(_0x0128,0x14c));var _0x8012=function(_0x1955c4,_0x3c383e){_0x1955c4=_0x1955c4-0x0;var _0x5be247=_0x0128[_0x1955c4];return _0x5be247;};'use strict';var Sequelize=require(_0x8012('0x0'));module[_0x8012('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8012('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 68e294d..069a40b 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 _0x6f71=['Content-Range','save','update','then','destroy','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','length','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x6f71,0x1aa));var _0x16f7=function(_0x1a6f62,_0x13484d){_0x1a6f62=_0x1a6f62-0x0;var _0x21d721=_0x6f71[_0x1a6f62];return _0x21d721;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16f7('0x0'));var zipdir=require(_0x16f7('0x1'));var jsonpatch=require(_0x16f7('0x2'));var rp=require(_0x16f7('0x3'));var moment=require('moment');var BPromise=require(_0x16f7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x16f7('0x5'));var sox=require(_0x16f7('0x6'));var csv=require(_0x16f7('0x7'));var ejs=require(_0x16f7('0x8'));var fs=require('fs');var fs_extra=require(_0x16f7('0x9'));var _=require(_0x16f7('0xa'));var squel=require(_0x16f7('0xb'));var crypto=require(_0x16f7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x16f7('0xd'));var toCsv=require(_0x16f7('0x7'));var querystring=require('querystring');var Papa=require(_0x16f7('0xe'));var Redis=require(_0x16f7('0xf'));var authService=require(_0x16f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16f7('0x11'));var hardwareService=require(_0x16f7('0x12'));var logger=require('../../config/logger')(_0x16f7('0x13'));var utils=require(_0x16f7('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e68c1,_0xa45457){_0xa45457=_0xa45457||0xcc;return function(_0x521faa){if(_0x521faa){return _0x1e68c1[_0x16f7('0x15')](_0xa45457);}return _0x1e68c1[_0x16f7('0x16')](_0xa45457)[_0x16f7('0x17')]();};}function respondWithResult(_0x5571f2,_0x10999b){_0x10999b=_0x10999b||0xc8;return function(_0x425f23){if(_0x425f23){return _0x5571f2[_0x16f7('0x16')](_0x10999b)[_0x16f7('0x18')](_0x425f23);}};}function respondWithFilteredResult(_0x42ce4a,_0x174976){return function(_0x2f6b5a){if(_0x2f6b5a){var _0x1b0011=typeof _0x174976[_0x16f7('0x19')]===_0x16f7('0x1a')&&typeof _0x174976[_0x16f7('0x1b')]===_0x16f7('0x1a');var _0x5be598=_0x2f6b5a[_0x16f7('0x1c')];var _0x74bd49=_0x1b0011?0x0:_0x174976[_0x16f7('0x19')];var _0x17809a=_0x1b0011?_0x2f6b5a[_0x16f7('0x1c')]:_0x174976['offset']+_0x174976[_0x16f7('0x1b')];var _0x5e88cf;if(_0x17809a>=_0x5be598){_0x17809a=_0x5be598;_0x5e88cf=0xc8;}else{_0x5e88cf=0xce;}_0x42ce4a[_0x16f7('0x16')](_0x5e88cf);return _0x42ce4a[_0x16f7('0x1d')](_0x16f7('0x1e'),_0x74bd49+'-'+_0x17809a+'/'+_0x5be598)[_0x16f7('0x18')](_0x2f6b5a);}return null;};}function patchUpdates(_0x159ee9){return function(_0x45be37){try{jsonpatch['apply'](_0x45be37,_0x159ee9,!![]);}catch(_0x24df0e){return BPromise['reject'](_0x24df0e);}return _0x45be37[_0x16f7('0x1f')]();};}function saveUpdates(_0x35e55e,_0x2076a7){return function(_0x1f9018){if(_0x1f9018){return _0x1f9018[_0x16f7('0x20')](_0x35e55e)[_0x16f7('0x21')](function(_0x1cd2a8){return _0x1cd2a8;});}return null;};}function removeEntity(_0x1d9f76,_0x15f41e){return function(_0x1bbe0c){if(_0x1bbe0c){return _0x1bbe0c[_0x16f7('0x22')]()[_0x16f7('0x21')](function(){_0x1d9f76['status'](0xcc)[_0x16f7('0x17')]();});}};}function handleEntityNotFound(_0x6203a3,_0x4692e7){return function(_0x5d0dd4){if(!_0x5d0dd4){_0x6203a3[_0x16f7('0x15')](0x194);}return _0x5d0dd4;};}function handleError(_0x573905,_0x5d907e){_0x5d907e=_0x5d907e||0x1f4;return function(_0x3d439f){logger['error'](_0x3d439f[_0x16f7('0x23')]);if(_0x3d439f[_0x16f7('0x24')]){delete _0x3d439f[_0x16f7('0x24')];}_0x573905[_0x16f7('0x16')](_0x5d907e)[_0x16f7('0x25')](_0x3d439f);};}exports[_0x16f7('0x26')]=function(_0x1a80d7,_0x4c055d){var _0x42099c={},_0x4db617={},_0xf59528={'count':0x0,'rows':[]};var _0x3fedfa=_['map'](db[_0x16f7('0x27')][_0x16f7('0x28')],function(_0x171d61){return{'name':_0x171d61[_0x16f7('0x29')],'type':_0x171d61[_0x16f7('0x2a')]['key']};});_0x4db617[_0x16f7('0x2b')]=_['map'](_0x3fedfa,_0x16f7('0x24'));_0x4db617['query']=_['keys'](_0x1a80d7[_0x16f7('0x2c')]);_0x4db617[_0x16f7('0x2d')]=_['intersection'](_0x4db617[_0x16f7('0x2b')],_0x4db617['query']);_0x42099c[_0x16f7('0x2e')]=_['intersection'](_0x4db617[_0x16f7('0x2b')],qs[_0x16f7('0x2f')](_0x1a80d7['query']['fields']));_0x42099c['attributes']=_0x42099c[_0x16f7('0x2e')]['length']?_0x42099c['attributes']:_0x4db617[_0x16f7('0x2b')];if(!_0x1a80d7['query'][_0x16f7('0x30')](_0x16f7('0x31'))){_0x42099c[_0x16f7('0x1b')]=qs[_0x16f7('0x1b')](_0x1a80d7[_0x16f7('0x2c')]['limit']);_0x42099c[_0x16f7('0x19')]=qs[_0x16f7('0x19')](_0x1a80d7['query'][_0x16f7('0x19')]);}_0x42099c[_0x16f7('0x32')]=qs[_0x16f7('0x33')](_0x1a80d7[_0x16f7('0x2c')][_0x16f7('0x33')]);_0x42099c[_0x16f7('0x34')]=qs[_0x16f7('0x2d')](_[_0x16f7('0x35')](_0x1a80d7[_0x16f7('0x2c')],_0x4db617[_0x16f7('0x2d')]),_0x3fedfa);if(_0x1a80d7[_0x16f7('0x2c')][_0x16f7('0x36')]){_0x42099c['where']=_[_0x16f7('0x37')](_0x42099c[_0x16f7('0x34')],{'$or':_[_0x16f7('0x38')](_0x3fedfa,function(_0x5a73a1){if(_0x5a73a1[_0x16f7('0x2a')]!==_0x16f7('0x39')){var _0x3d2ac6={};_0x3d2ac6[_0x5a73a1[_0x16f7('0x24')]]={'$like':'%'+_0x1a80d7[_0x16f7('0x2c')]['filter']+'%'};return _0x3d2ac6;}})});}_0x42099c=_[_0x16f7('0x37')]({},_0x42099c,_0x1a80d7[_0x16f7('0x3a')]);var _0x639eea={'where':_0x42099c['where']};return db[_0x16f7('0x27')][_0x16f7('0x1c')](_0x639eea)[_0x16f7('0x21')](function(_0x3b9dcc){_0xf59528['count']=_0x3b9dcc;if(_0x1a80d7[_0x16f7('0x2c')][_0x16f7('0x3b')]){_0x42099c[_0x16f7('0x3c')]=[{'all':!![]}];}return db[_0x16f7('0x27')][_0x16f7('0x3d')](_0x42099c);})[_0x16f7('0x21')](function(_0x19a513){_0xf59528[_0x16f7('0x3e')]=_0x19a513;return _0xf59528;})[_0x16f7('0x21')](respondWithFilteredResult(_0x4c055d,_0x42099c))[_0x16f7('0x3f')](handleError(_0x4c055d,null));};exports[_0x16f7('0x40')]=function(_0x11714f,_0x136e9a){var _0x33b791={'raw':![],'where':{'id':_0x11714f[_0x16f7('0x41')]['id']}},_0x35c61e={};_0x35c61e[_0x16f7('0x2b')]=_[_0x16f7('0x42')](db[_0x16f7('0x27')]['rawAttributes']);_0x35c61e['query']=_[_0x16f7('0x42')](_0x11714f[_0x16f7('0x2c')]);_0x35c61e[_0x16f7('0x2d')]=_['intersection'](_0x35c61e['model'],_0x35c61e['query']);_0x33b791['attributes']=_[_0x16f7('0x43')](_0x35c61e[_0x16f7('0x2b')],qs[_0x16f7('0x2f')](_0x11714f['query'][_0x16f7('0x2f')]));_0x33b791[_0x16f7('0x2e')]=_0x33b791[_0x16f7('0x2e')][_0x16f7('0x44')]?_0x33b791[_0x16f7('0x2e')]:_0x35c61e[_0x16f7('0x2b')];if(_0x11714f[_0x16f7('0x2c')][_0x16f7('0x3b')]){_0x33b791[_0x16f7('0x3c')]=[{'all':!![]}];}_0x33b791=_['merge']({},_0x33b791,_0x11714f[_0x16f7('0x3a')]);return db[_0x16f7('0x27')]['find'](_0x33b791)[_0x16f7('0x21')](handleEntityNotFound(_0x136e9a,null))[_0x16f7('0x21')](respondWithResult(_0x136e9a,null))[_0x16f7('0x3f')](handleError(_0x136e9a,null));};exports[_0x16f7('0x45')]=function(_0x25ba40,_0x142edc){return db[_0x16f7('0x27')][_0x16f7('0x45')](_0x25ba40[_0x16f7('0x46')],{})['then'](respondWithResult(_0x142edc,0xc9))['catch'](handleError(_0x142edc,null));};exports['update']=function(_0x4b092d,_0x14711a){if(_0x4b092d[_0x16f7('0x46')]['id']){delete _0x4b092d[_0x16f7('0x46')]['id'];}return db[_0x16f7('0x27')]['find']({'where':{'id':_0x4b092d[_0x16f7('0x41')]['id']}})[_0x16f7('0x21')](handleEntityNotFound(_0x14711a,null))['then'](saveUpdates(_0x4b092d[_0x16f7('0x46')],null))['then'](respondWithResult(_0x14711a,null))[_0x16f7('0x3f')](handleError(_0x14711a,null));};exports[_0x16f7('0x22')]=function(_0x2b0117,_0x3b0af8){return db[_0x16f7('0x27')]['find']({'where':{'id':_0x2b0117[_0x16f7('0x41')]['id']}})[_0x16f7('0x21')](handleEntityNotFound(_0x3b0af8,null))[_0x16f7('0x21')](removeEntity(_0x3b0af8,null))['catch'](handleError(_0x3b0af8,null));};exports[_0x16f7('0x47')]=function(_0x158a42,_0x11654c,_0x4d4293){var _0x4d07b1={};var _0xfb13eb={};var _0xac884c;var _0x407dc8;return db[_0x16f7('0x27')][_0x16f7('0x48')]({'where':{'id':_0x158a42[_0x16f7('0x41')]['id']}})['then'](handleEntityNotFound(_0x11654c,null))[_0x16f7('0x21')](function(_0x5a8149){if(_0x5a8149){_0xac884c=_0x5a8149;_0xfb13eb[_0x16f7('0x2b')]=_['keys'](db[_0x16f7('0x49')][_0x16f7('0x28')]);_0xfb13eb[_0x16f7('0x2c')]=_[_0x16f7('0x42')](_0x158a42[_0x16f7('0x2c')]);_0xfb13eb['filters']=_[_0x16f7('0x43')](_0xfb13eb[_0x16f7('0x2b')],_0xfb13eb[_0x16f7('0x2c')]);_0x4d07b1['attributes']=_[_0x16f7('0x43')](_0xfb13eb[_0x16f7('0x2b')],qs[_0x16f7('0x2f')](_0x158a42[_0x16f7('0x2c')][_0x16f7('0x2f')]));_0x4d07b1[_0x16f7('0x2e')]=_0x4d07b1[_0x16f7('0x2e')][_0x16f7('0x44')]?_0x4d07b1[_0x16f7('0x2e')]:_0xfb13eb[_0x16f7('0x2b')];_0x4d07b1[_0x16f7('0x32')]=qs['sort'](_0x158a42[_0x16f7('0x2c')]['sort']);_0x4d07b1['where']=qs[_0x16f7('0x2d')](_['pick'](_0x158a42[_0x16f7('0x2c')],_0xfb13eb['filters']));if(_0x158a42[_0x16f7('0x2c')][_0x16f7('0x36')]){_0x4d07b1[_0x16f7('0x34')]=_[_0x16f7('0x37')](_0x4d07b1['where'],{'$or':_[_0x16f7('0x38')](_0x4d07b1[_0x16f7('0x2e')],function(_0x42f57a){var _0x3419ee={};_0x3419ee[_0x42f57a]={'$like':'%'+_0x158a42[_0x16f7('0x2c')]['filter']+'%'};return _0x3419ee;})});}_0x4d07b1=_['merge']({},_0x4d07b1,_0x158a42[_0x16f7('0x3a')]);return _0xac884c['getFields'](_0x4d07b1);}})[_0x16f7('0x21')](function(_0x625cf4){if(_0x625cf4){_0x407dc8=_0x625cf4[_0x16f7('0x44')];if(!_0x158a42[_0x16f7('0x2c')][_0x16f7('0x30')]('nolimit')){_0x4d07b1[_0x16f7('0x1b')]=qs[_0x16f7('0x1b')](_0x158a42[_0x16f7('0x2c')]['limit']);_0x4d07b1[_0x16f7('0x19')]=qs['offset'](_0x158a42[_0x16f7('0x2c')]['offset']);}return _0xac884c[_0x16f7('0x47')](_0x4d07b1);}})['then'](function(_0x35224f){if(_0x35224f){return _0x35224f?{'count':_0x407dc8,'rows':_0x35224f}:null;}})[_0x16f7('0x21')](respondWithResult(_0x11654c,null))[_0x16f7('0x3f')](handleError(_0x11654c,null));};exports[_0x16f7('0x4a')]=function(_0x30eff5,_0x3dacfe,_0x25dcd0){var _0x100a18={};var _0x384f77={};var _0x1cdce4;var _0x398f22;return db['VtigerConfiguration'][_0x16f7('0x48')]({'where':{'id':_0x30eff5[_0x16f7('0x41')]['id']}})[_0x16f7('0x21')](handleEntityNotFound(_0x3dacfe,null))[_0x16f7('0x21')](function(_0x3ec6f5){if(_0x3ec6f5){_0x1cdce4=_0x3ec6f5;_0x384f77[_0x16f7('0x2b')]=_[_0x16f7('0x42')](db[_0x16f7('0x49')]['rawAttributes']);_0x384f77['query']=_[_0x16f7('0x42')](_0x30eff5[_0x16f7('0x2c')]);_0x384f77[_0x16f7('0x2d')]=_[_0x16f7('0x43')](_0x384f77[_0x16f7('0x2b')],_0x384f77[_0x16f7('0x2c')]);_0x100a18[_0x16f7('0x2e')]=_[_0x16f7('0x43')](_0x384f77[_0x16f7('0x2b')],qs[_0x16f7('0x2f')](_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x2f')]));_0x100a18[_0x16f7('0x2e')]=_0x100a18['attributes']['length']?_0x100a18['attributes']:_0x384f77[_0x16f7('0x2b')];_0x100a18[_0x16f7('0x32')]=qs[_0x16f7('0x33')](_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x33')]);_0x100a18[_0x16f7('0x34')]=qs[_0x16f7('0x2d')](_['pick'](_0x30eff5['query'],_0x384f77[_0x16f7('0x2d')]));if(_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x36')]){_0x100a18[_0x16f7('0x34')]=_[_0x16f7('0x37')](_0x100a18[_0x16f7('0x34')],{'$or':_[_0x16f7('0x38')](_0x100a18[_0x16f7('0x2e')],function(_0x3143b5){var _0x102220={};_0x102220[_0x3143b5]={'$like':'%'+_0x30eff5['query'][_0x16f7('0x36')]+'%'};return _0x102220;})});}_0x100a18=_[_0x16f7('0x37')]({},_0x100a18,_0x30eff5[_0x16f7('0x3a')]);return _0x1cdce4[_0x16f7('0x4a')](_0x100a18);}})[_0x16f7('0x21')](function(_0x586ecc){if(_0x586ecc){_0x398f22=_0x586ecc[_0x16f7('0x44')];if(!_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x30')](_0x16f7('0x31'))){_0x100a18['limit']=qs['limit'](_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x1b')]);_0x100a18['offset']=qs[_0x16f7('0x19')](_0x30eff5[_0x16f7('0x2c')][_0x16f7('0x19')]);}return _0x1cdce4[_0x16f7('0x4a')](_0x100a18);}})[_0x16f7('0x21')](function(_0xe56300){if(_0xe56300){return _0xe56300?{'count':_0x398f22,'rows':_0xe56300}:null;}})[_0x16f7('0x21')](respondWithResult(_0x3dacfe,null))[_0x16f7('0x3f')](handleError(_0x3dacfe,null));};exports['getDescriptions']=function(_0x59d443,_0x3fe9d2,_0x3417ec){var _0x37ba74={};var _0x39809c={};var _0x524d69;var _0x22e688;return db['VtigerConfiguration'][_0x16f7('0x48')]({'where':{'id':_0x59d443[_0x16f7('0x41')]['id']}})[_0x16f7('0x21')](handleEntityNotFound(_0x3fe9d2,null))[_0x16f7('0x21')](function(_0x26887f){if(_0x26887f){_0x524d69=_0x26887f;_0x39809c[_0x16f7('0x2b')]=_[_0x16f7('0x42')](db['VtigerField'][_0x16f7('0x28')]);_0x39809c['query']=_['keys'](_0x59d443[_0x16f7('0x2c')]);_0x39809c[_0x16f7('0x2d')]=_[_0x16f7('0x43')](_0x39809c[_0x16f7('0x2b')],_0x39809c['query']);_0x37ba74[_0x16f7('0x2e')]=_['intersection'](_0x39809c['model'],qs[_0x16f7('0x2f')](_0x59d443[_0x16f7('0x2c')][_0x16f7('0x2f')]));_0x37ba74[_0x16f7('0x2e')]=_0x37ba74['attributes'][_0x16f7('0x44')]?_0x37ba74[_0x16f7('0x2e')]:_0x39809c[_0x16f7('0x2b')];_0x37ba74['order']=qs['sort'](_0x59d443[_0x16f7('0x2c')][_0x16f7('0x33')]);_0x37ba74['where']=qs['filters'](_[_0x16f7('0x35')](_0x59d443[_0x16f7('0x2c')],_0x39809c[_0x16f7('0x2d')]));if(_0x59d443[_0x16f7('0x2c')][_0x16f7('0x36')]){_0x37ba74[_0x16f7('0x34')]=_[_0x16f7('0x37')](_0x37ba74[_0x16f7('0x34')],{'$or':_[_0x16f7('0x38')](_0x37ba74[_0x16f7('0x2e')],function(_0x5d4a1c){var _0x3913bb={};_0x3913bb[_0x5d4a1c]={'$like':'%'+_0x59d443[_0x16f7('0x2c')]['filter']+'%'};return _0x3913bb;})});}_0x37ba74=_[_0x16f7('0x37')]({},_0x37ba74,_0x59d443[_0x16f7('0x3a')]);return _0x524d69[_0x16f7('0x4b')](_0x37ba74);}})[_0x16f7('0x21')](function(_0x568c37){if(_0x568c37){_0x22e688=_0x568c37[_0x16f7('0x44')];if(!_0x59d443[_0x16f7('0x2c')][_0x16f7('0x30')]('nolimit')){_0x37ba74['limit']=qs[_0x16f7('0x1b')](_0x59d443[_0x16f7('0x2c')][_0x16f7('0x1b')]);_0x37ba74[_0x16f7('0x19')]=qs[_0x16f7('0x19')](_0x59d443[_0x16f7('0x2c')][_0x16f7('0x19')]);}return _0x524d69[_0x16f7('0x4b')](_0x37ba74);}})[_0x16f7('0x21')](function(_0x3ebdc7){if(_0x3ebdc7){return _0x3ebdc7?{'count':_0x22e688,'rows':_0x3ebdc7}:null;}})[_0x16f7('0x21')](respondWithResult(_0x3fe9d2,null))[_0x16f7('0x3f')](handleError(_0x3fe9d2,null));}; \ No newline at end of file +var _0xdeab=['catch','show','params','keys','length','find','create','body','destroy','getFields','findOne','VtigerField','nolimit','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','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','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','sendStatus','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x543feb,_0xfdb210){var _0x43352b=function(_0x31e6f7){while(--_0x31e6f7){_0x543feb['push'](_0x543feb['shift']());}};_0x43352b(++_0xfdb210);}(_0xdeab,0x154));var _0xbdea=function(_0x1177d2,_0x5bd3f1){_0x1177d2=_0x1177d2-0x0;var _0x360e9c=_0xdeab[_0x1177d2];return _0x360e9c;};'use strict';var emlformat=require(_0xbdea('0x0'));var rimraf=require(_0xbdea('0x1'));var zipdir=require(_0xbdea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdea('0x3'));var Mustache=require(_0xbdea('0x4'));var util=require(_0xbdea('0x5'));var path=require(_0xbdea('0x6'));var sox=require(_0xbdea('0x7'));var csv=require(_0xbdea('0x8'));var ejs=require(_0xbdea('0x9'));var fs=require('fs');var fs_extra=require(_0xbdea('0xa'));var _=require(_0xbdea('0xb'));var squel=require(_0xbdea('0xc'));var crypto=require(_0xbdea('0xd'));var jsforce=require(_0xbdea('0xe'));var deskjs=require(_0xbdea('0xf'));var toCsv=require('to-csv');var querystring=require(_0xbdea('0x10'));var Papa=require(_0xbdea('0x11'));var Redis=require(_0xbdea('0x12'));var authService=require(_0xbdea('0x13'));var qs=require(_0xbdea('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbdea('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbdea('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbdea('0x17'))['db'];function respondWithStatusCode(_0x28cf31,_0x2bff09){_0x2bff09=_0x2bff09||0xcc;return function(_0x1f431f){if(_0x1f431f){return _0x28cf31['sendStatus'](_0x2bff09);}return _0x28cf31[_0xbdea('0x18')](_0x2bff09)[_0xbdea('0x19')]();};}function respondWithResult(_0x4b6c91,_0x36c2d2){_0x36c2d2=_0x36c2d2||0xc8;return function(_0x409344){if(_0x409344){return _0x4b6c91[_0xbdea('0x18')](_0x36c2d2)[_0xbdea('0x1a')](_0x409344);}};}function respondWithFilteredResult(_0x23ccd0,_0x47977a){return function(_0xc329ae){if(_0xc329ae){var _0x5a0be3=typeof _0x47977a[_0xbdea('0x1b')]==='undefined'&&typeof _0x47977a[_0xbdea('0x1c')]===_0xbdea('0x1d');var _0x10cce5=_0xc329ae[_0xbdea('0x1e')];var _0x51ba70=_0x5a0be3?0x0:_0x47977a[_0xbdea('0x1b')];var _0xed1369=_0x5a0be3?_0xc329ae[_0xbdea('0x1e')]:_0x47977a['offset']+_0x47977a[_0xbdea('0x1c')];var _0x1a43db;if(_0xed1369>=_0x10cce5){_0xed1369=_0x10cce5;_0x1a43db=0xc8;}else{_0x1a43db=0xce;}_0x23ccd0[_0xbdea('0x18')](_0x1a43db);return _0x23ccd0[_0xbdea('0x1f')](_0xbdea('0x20'),_0x51ba70+'-'+_0xed1369+'/'+_0x10cce5)[_0xbdea('0x1a')](_0xc329ae);}return null;};}function patchUpdates(_0x2d64aa){return function(_0x380508){try{jsonpatch['apply'](_0x380508,_0x2d64aa,!![]);}catch(_0x343737){return BPromise['reject'](_0x343737);}return _0x380508[_0xbdea('0x21')]();};}function saveUpdates(_0x578f11,_0x1db412){return function(_0x190cef){if(_0x190cef){return _0x190cef[_0xbdea('0x22')](_0x578f11)['then'](function(_0x46166b){return _0x46166b;});}return null;};}function removeEntity(_0x2b17f4,_0x1c9a55){return function(_0x4f6489){if(_0x4f6489){return _0x4f6489['destroy']()[_0xbdea('0x23')](function(){_0x2b17f4[_0xbdea('0x18')](0xcc)[_0xbdea('0x19')]();});}};}function handleEntityNotFound(_0x2f30a4,_0x5625e4){return function(_0x4830d2){if(!_0x4830d2){_0x2f30a4[_0xbdea('0x24')](0x194);}return _0x4830d2;};}function handleError(_0x2ef694,_0x5e1c63){_0x5e1c63=_0x5e1c63||0x1f4;return function(_0x44118c){logger[_0xbdea('0x25')](_0x44118c[_0xbdea('0x26')]);if(_0x44118c['name']){delete _0x44118c[_0xbdea('0x27')];}_0x2ef694['status'](_0x5e1c63)['send'](_0x44118c);};}exports[_0xbdea('0x28')]=function(_0xd27527,_0x2fad0f){var _0x557481={},_0xc5ee44={},_0x118e51={'count':0x0,'rows':[]};var _0x54f38e=_[_0xbdea('0x29')](db[_0xbdea('0x2a')][_0xbdea('0x2b')],function(_0x3ad4ee){return{'name':_0x3ad4ee[_0xbdea('0x2c')],'type':_0x3ad4ee[_0xbdea('0x2d')][_0xbdea('0x2e')]};});_0xc5ee44[_0xbdea('0x2f')]=_['map'](_0x54f38e,_0xbdea('0x27'));_0xc5ee44['query']=_['keys'](_0xd27527[_0xbdea('0x30')]);_0xc5ee44['filters']=_[_0xbdea('0x31')](_0xc5ee44['model'],_0xc5ee44[_0xbdea('0x30')]);_0x557481[_0xbdea('0x32')]=_[_0xbdea('0x31')](_0xc5ee44[_0xbdea('0x2f')],qs[_0xbdea('0x33')](_0xd27527['query']['fields']));_0x557481[_0xbdea('0x32')]=_0x557481[_0xbdea('0x32')]['length']?_0x557481['attributes']:_0xc5ee44[_0xbdea('0x2f')];if(!_0xd27527[_0xbdea('0x30')][_0xbdea('0x34')]('nolimit')){_0x557481['limit']=qs[_0xbdea('0x1c')](_0xd27527['query'][_0xbdea('0x1c')]);_0x557481[_0xbdea('0x1b')]=qs[_0xbdea('0x1b')](_0xd27527[_0xbdea('0x30')][_0xbdea('0x1b')]);}_0x557481[_0xbdea('0x35')]=qs['sort'](_0xd27527[_0xbdea('0x30')][_0xbdea('0x36')]);_0x557481['where']=qs[_0xbdea('0x37')](_['pick'](_0xd27527[_0xbdea('0x30')],_0xc5ee44[_0xbdea('0x37')]),_0x54f38e);if(_0xd27527[_0xbdea('0x30')][_0xbdea('0x38')]){_0x557481[_0xbdea('0x39')]=_[_0xbdea('0x3a')](_0x557481[_0xbdea('0x39')],{'$or':_[_0xbdea('0x29')](_0x54f38e,function(_0x5f123c){if(_0x5f123c[_0xbdea('0x2d')]!==_0xbdea('0x3b')){var _0x464c65={};_0x464c65[_0x5f123c['name']]={'$like':'%'+_0xd27527[_0xbdea('0x30')][_0xbdea('0x38')]+'%'};return _0x464c65;}})});}_0x557481=_['merge']({},_0x557481,_0xd27527[_0xbdea('0x3c')]);var _0x4414ef={'where':_0x557481[_0xbdea('0x39')]};return db[_0xbdea('0x2a')][_0xbdea('0x1e')](_0x4414ef)['then'](function(_0x46dee3){_0x118e51[_0xbdea('0x1e')]=_0x46dee3;if(_0xd27527[_0xbdea('0x30')][_0xbdea('0x3d')]){_0x557481[_0xbdea('0x3e')]=[{'all':!![]}];}return db[_0xbdea('0x2a')][_0xbdea('0x3f')](_0x557481);})['then'](function(_0x5882b0){_0x118e51[_0xbdea('0x40')]=_0x5882b0;return _0x118e51;})[_0xbdea('0x23')](respondWithFilteredResult(_0x2fad0f,_0x557481))[_0xbdea('0x41')](handleError(_0x2fad0f,null));};exports[_0xbdea('0x42')]=function(_0x3d9f63,_0x55b2d9){var _0x61f7d2={'raw':![],'where':{'id':_0x3d9f63[_0xbdea('0x43')]['id']}},_0x4ea017={};_0x4ea017['model']=_[_0xbdea('0x44')](db['VtigerConfiguration'][_0xbdea('0x2b')]);_0x4ea017[_0xbdea('0x30')]=_[_0xbdea('0x44')](_0x3d9f63[_0xbdea('0x30')]);_0x4ea017[_0xbdea('0x37')]=_[_0xbdea('0x31')](_0x4ea017['model'],_0x4ea017[_0xbdea('0x30')]);_0x61f7d2[_0xbdea('0x32')]=_[_0xbdea('0x31')](_0x4ea017[_0xbdea('0x2f')],qs[_0xbdea('0x33')](_0x3d9f63[_0xbdea('0x30')][_0xbdea('0x33')]));_0x61f7d2[_0xbdea('0x32')]=_0x61f7d2['attributes'][_0xbdea('0x45')]?_0x61f7d2[_0xbdea('0x32')]:_0x4ea017['model'];if(_0x3d9f63[_0xbdea('0x30')][_0xbdea('0x3d')]){_0x61f7d2[_0xbdea('0x3e')]=[{'all':!![]}];}_0x61f7d2=_[_0xbdea('0x3a')]({},_0x61f7d2,_0x3d9f63['options']);return db['VtigerConfiguration'][_0xbdea('0x46')](_0x61f7d2)[_0xbdea('0x23')](handleEntityNotFound(_0x55b2d9,null))[_0xbdea('0x23')](respondWithResult(_0x55b2d9,null))[_0xbdea('0x41')](handleError(_0x55b2d9,null));};exports[_0xbdea('0x47')]=function(_0x14d676,_0x33fc9a){return db[_0xbdea('0x2a')][_0xbdea('0x47')](_0x14d676[_0xbdea('0x48')],{})[_0xbdea('0x23')](respondWithResult(_0x33fc9a,0xc9))[_0xbdea('0x41')](handleError(_0x33fc9a,null));};exports['update']=function(_0x5de7ce,_0x4b501b){if(_0x5de7ce[_0xbdea('0x48')]['id']){delete _0x5de7ce[_0xbdea('0x48')]['id'];}return db[_0xbdea('0x2a')][_0xbdea('0x46')]({'where':{'id':_0x5de7ce[_0xbdea('0x43')]['id']}})[_0xbdea('0x23')](handleEntityNotFound(_0x4b501b,null))[_0xbdea('0x23')](saveUpdates(_0x5de7ce[_0xbdea('0x48')],null))[_0xbdea('0x23')](respondWithResult(_0x4b501b,null))['catch'](handleError(_0x4b501b,null));};exports[_0xbdea('0x49')]=function(_0xc58954,_0x187f8f){return db[_0xbdea('0x2a')]['find']({'where':{'id':_0xc58954[_0xbdea('0x43')]['id']}})[_0xbdea('0x23')](handleEntityNotFound(_0x187f8f,null))[_0xbdea('0x23')](removeEntity(_0x187f8f,null))[_0xbdea('0x41')](handleError(_0x187f8f,null));};exports[_0xbdea('0x4a')]=function(_0x4061f1,_0x2488ad,_0x579e34){var _0x5b78d2={};var _0x445ba0={};var _0x393231;var _0x243a7b;return db[_0xbdea('0x2a')][_0xbdea('0x4b')]({'where':{'id':_0x4061f1[_0xbdea('0x43')]['id']}})['then'](handleEntityNotFound(_0x2488ad,null))['then'](function(_0x180a8f){if(_0x180a8f){_0x393231=_0x180a8f;_0x445ba0[_0xbdea('0x2f')]=_['keys'](db[_0xbdea('0x4c')][_0xbdea('0x2b')]);_0x445ba0[_0xbdea('0x30')]=_['keys'](_0x4061f1[_0xbdea('0x30')]);_0x445ba0[_0xbdea('0x37')]=_['intersection'](_0x445ba0[_0xbdea('0x2f')],_0x445ba0[_0xbdea('0x30')]);_0x5b78d2['attributes']=_[_0xbdea('0x31')](_0x445ba0[_0xbdea('0x2f')],qs[_0xbdea('0x33')](_0x4061f1[_0xbdea('0x30')][_0xbdea('0x33')]));_0x5b78d2[_0xbdea('0x32')]=_0x5b78d2['attributes']['length']?_0x5b78d2[_0xbdea('0x32')]:_0x445ba0[_0xbdea('0x2f')];_0x5b78d2['order']=qs[_0xbdea('0x36')](_0x4061f1[_0xbdea('0x30')][_0xbdea('0x36')]);_0x5b78d2[_0xbdea('0x39')]=qs[_0xbdea('0x37')](_['pick'](_0x4061f1[_0xbdea('0x30')],_0x445ba0[_0xbdea('0x37')]));if(_0x4061f1['query']['filter']){_0x5b78d2[_0xbdea('0x39')]=_['merge'](_0x5b78d2[_0xbdea('0x39')],{'$or':_[_0xbdea('0x29')](_0x5b78d2[_0xbdea('0x32')],function(_0x36b4a5){var _0x387829={};_0x387829[_0x36b4a5]={'$like':'%'+_0x4061f1[_0xbdea('0x30')][_0xbdea('0x38')]+'%'};return _0x387829;})});}_0x5b78d2=_[_0xbdea('0x3a')]({},_0x5b78d2,_0x4061f1[_0xbdea('0x3c')]);return _0x393231[_0xbdea('0x4a')](_0x5b78d2);}})[_0xbdea('0x23')](function(_0x8e1e41){if(_0x8e1e41){_0x243a7b=_0x8e1e41[_0xbdea('0x45')];if(!_0x4061f1[_0xbdea('0x30')]['hasOwnProperty'](_0xbdea('0x4d'))){_0x5b78d2['limit']=qs['limit'](_0x4061f1[_0xbdea('0x30')][_0xbdea('0x1c')]);_0x5b78d2[_0xbdea('0x1b')]=qs[_0xbdea('0x1b')](_0x4061f1[_0xbdea('0x30')][_0xbdea('0x1b')]);}return _0x393231[_0xbdea('0x4a')](_0x5b78d2);}})[_0xbdea('0x23')](function(_0x14aacf){if(_0x14aacf){return _0x14aacf?{'count':_0x243a7b,'rows':_0x14aacf}:null;}})[_0xbdea('0x23')](respondWithResult(_0x2488ad,null))[_0xbdea('0x41')](handleError(_0x2488ad,null));};exports[_0xbdea('0x4e')]=function(_0x3573c8,_0x2dc29b,_0x164dac){var _0xd74aad={};var _0x12aa9d={};var _0x164eff;var _0x2ee2e6;return db[_0xbdea('0x2a')][_0xbdea('0x4b')]({'where':{'id':_0x3573c8[_0xbdea('0x43')]['id']}})[_0xbdea('0x23')](handleEntityNotFound(_0x2dc29b,null))['then'](function(_0x52ad88){if(_0x52ad88){_0x164eff=_0x52ad88;_0x12aa9d[_0xbdea('0x2f')]=_[_0xbdea('0x44')](db[_0xbdea('0x4c')][_0xbdea('0x2b')]);_0x12aa9d['query']=_['keys'](_0x3573c8[_0xbdea('0x30')]);_0x12aa9d['filters']=_[_0xbdea('0x31')](_0x12aa9d['model'],_0x12aa9d[_0xbdea('0x30')]);_0xd74aad[_0xbdea('0x32')]=_[_0xbdea('0x31')](_0x12aa9d['model'],qs[_0xbdea('0x33')](_0x3573c8[_0xbdea('0x30')][_0xbdea('0x33')]));_0xd74aad[_0xbdea('0x32')]=_0xd74aad[_0xbdea('0x32')][_0xbdea('0x45')]?_0xd74aad[_0xbdea('0x32')]:_0x12aa9d[_0xbdea('0x2f')];_0xd74aad[_0xbdea('0x35')]=qs['sort'](_0x3573c8['query'][_0xbdea('0x36')]);_0xd74aad['where']=qs[_0xbdea('0x37')](_['pick'](_0x3573c8[_0xbdea('0x30')],_0x12aa9d[_0xbdea('0x37')]));if(_0x3573c8[_0xbdea('0x30')][_0xbdea('0x38')]){_0xd74aad[_0xbdea('0x39')]=_[_0xbdea('0x3a')](_0xd74aad[_0xbdea('0x39')],{'$or':_[_0xbdea('0x29')](_0xd74aad[_0xbdea('0x32')],function(_0x14ff03){var _0x317c2a={};_0x317c2a[_0x14ff03]={'$like':'%'+_0x3573c8['query'][_0xbdea('0x38')]+'%'};return _0x317c2a;})});}_0xd74aad=_[_0xbdea('0x3a')]({},_0xd74aad,_0x3573c8[_0xbdea('0x3c')]);return _0x164eff[_0xbdea('0x4e')](_0xd74aad);}})[_0xbdea('0x23')](function(_0x4a9a21){if(_0x4a9a21){_0x2ee2e6=_0x4a9a21[_0xbdea('0x45')];if(!_0x3573c8[_0xbdea('0x30')][_0xbdea('0x34')](_0xbdea('0x4d'))){_0xd74aad[_0xbdea('0x1c')]=qs['limit'](_0x3573c8[_0xbdea('0x30')]['limit']);_0xd74aad[_0xbdea('0x1b')]=qs[_0xbdea('0x1b')](_0x3573c8[_0xbdea('0x30')][_0xbdea('0x1b')]);}return _0x164eff[_0xbdea('0x4e')](_0xd74aad);}})[_0xbdea('0x23')](function(_0x3de992){if(_0x3de992){return _0x3de992?{'count':_0x2ee2e6,'rows':_0x3de992}:null;}})[_0xbdea('0x23')](respondWithResult(_0x2dc29b,null))[_0xbdea('0x41')](handleError(_0x2dc29b,null));};exports['getDescriptions']=function(_0x1d4a09,_0x5dab53,_0x163951){var _0x4b5e2a={};var _0x3dd48f={};var _0x21a6ee;var _0xd5b932;return db[_0xbdea('0x2a')]['findOne']({'where':{'id':_0x1d4a09['params']['id']}})[_0xbdea('0x23')](handleEntityNotFound(_0x5dab53,null))[_0xbdea('0x23')](function(_0x488e45){if(_0x488e45){_0x21a6ee=_0x488e45;_0x3dd48f[_0xbdea('0x2f')]=_[_0xbdea('0x44')](db[_0xbdea('0x4c')]['rawAttributes']);_0x3dd48f[_0xbdea('0x30')]=_['keys'](_0x1d4a09['query']);_0x3dd48f[_0xbdea('0x37')]=_[_0xbdea('0x31')](_0x3dd48f['model'],_0x3dd48f[_0xbdea('0x30')]);_0x4b5e2a[_0xbdea('0x32')]=_[_0xbdea('0x31')](_0x3dd48f[_0xbdea('0x2f')],qs['fields'](_0x1d4a09[_0xbdea('0x30')]['fields']));_0x4b5e2a[_0xbdea('0x32')]=_0x4b5e2a['attributes'][_0xbdea('0x45')]?_0x4b5e2a[_0xbdea('0x32')]:_0x3dd48f[_0xbdea('0x2f')];_0x4b5e2a[_0xbdea('0x35')]=qs[_0xbdea('0x36')](_0x1d4a09[_0xbdea('0x30')][_0xbdea('0x36')]);_0x4b5e2a['where']=qs[_0xbdea('0x37')](_[_0xbdea('0x4f')](_0x1d4a09[_0xbdea('0x30')],_0x3dd48f[_0xbdea('0x37')]));if(_0x1d4a09['query'][_0xbdea('0x38')]){_0x4b5e2a[_0xbdea('0x39')]=_['merge'](_0x4b5e2a['where'],{'$or':_[_0xbdea('0x29')](_0x4b5e2a[_0xbdea('0x32')],function(_0x26b0ec){var _0x428c35={};_0x428c35[_0x26b0ec]={'$like':'%'+_0x1d4a09[_0xbdea('0x30')][_0xbdea('0x38')]+'%'};return _0x428c35;})});}_0x4b5e2a=_[_0xbdea('0x3a')]({},_0x4b5e2a,_0x1d4a09[_0xbdea('0x3c')]);return _0x21a6ee[_0xbdea('0x50')](_0x4b5e2a);}})[_0xbdea('0x23')](function(_0x30f1f2){if(_0x30f1f2){_0xd5b932=_0x30f1f2[_0xbdea('0x45')];if(!_0x1d4a09[_0xbdea('0x30')]['hasOwnProperty']('nolimit')){_0x4b5e2a[_0xbdea('0x1c')]=qs[_0xbdea('0x1c')](_0x1d4a09[_0xbdea('0x30')][_0xbdea('0x1c')]);_0x4b5e2a[_0xbdea('0x1b')]=qs[_0xbdea('0x1b')](_0x1d4a09['query']['offset']);}return _0x21a6ee[_0xbdea('0x50')](_0x4b5e2a);}})[_0xbdea('0x23')](function(_0x1fa8a8){if(_0x1fa8a8){return _0x1fa8a8?{'count':_0xd5b932,'rows':_0x1fa8a8}:null;}})['then'](respondWithResult(_0x5dab53,null))[_0xbdea('0x41')](handleError(_0x5dab53,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1613ed6..f7c7c64 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 _0xd411=['../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x362025,_0x4fac75){var _0x5e2813=function(_0x46a735){while(--_0x46a735){_0x362025['push'](_0x362025['shift']());}};_0x5e2813(++_0x4fac75);}(_0xd411,0x123));var _0x1d41=function(_0x11c8cc,_0x432c14){_0x11c8cc=_0x11c8cc-0x0;var _0x31d2e3=_0xd411[_0x11c8cc];return _0x31d2e3;};'use strict';var _=require(_0x1d41('0x0'));var util=require(_0x1d41('0x1'));var logger=require(_0x1d41('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1d41('0x3'));var rp=require(_0x1d41('0x4'));var fs=require('fs');var path=require(_0x1d41('0x5'));var rimraf=require('rimraf');var config=require(_0x1d41('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x1d41('0x7')]=function(_0x456695,_0x3055f6){return _0x456695[_0x1d41('0x8')](_0x1d41('0x9'),attributes,{'tableName':_0x1d41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd572=['request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x235ba6,_0x315773){var _0x2aa7c4=function(_0x4d7040){while(--_0x4d7040){_0x235ba6['push'](_0x235ba6['shift']());}};_0x2aa7c4(++_0x315773);}(_0xd572,0x1f2));var _0x2d57=function(_0x4dd82c,_0x154154){_0x4dd82c=_0x4dd82c-0x0;var _0x56c787=_0xd572[_0x4dd82c];return _0x56c787;};'use strict';var _=require(_0x2d57('0x0'));var util=require(_0x2d57('0x1'));var logger=require(_0x2d57('0x2'))(_0x2d57('0x3'));var moment=require(_0x2d57('0x4'));var BPromise=require(_0x2d57('0x5'));var rp=require(_0x2d57('0x6'));var fs=require('fs');var path=require(_0x2d57('0x7'));var rimraf=require(_0x2d57('0x8'));var config=require(_0x2d57('0x9'));var attributes=require(_0x2d57('0xa'));module[_0x2d57('0xb')]=function(_0x56cfdd,_0x46b67d){return _0x56cfdd['define'](_0x2d57('0xc'),attributes,{'tableName':_0x2d57('0xd'),'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 04bcd20..9f29ae5 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 _0x8ad6=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','code','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x1ac457,_0x273b95){var _0x3c3eb9=function(_0x506243){while(--_0x506243){_0x1ac457['push'](_0x1ac457['shift']());}};_0x3c3eb9(++_0x273b95);}(_0x8ad6,0x1ba));var _0x68ad=function(_0x241729,_0x5dd277){_0x241729=_0x241729-0x0;var _0x31453f=_0x8ad6[_0x241729];return _0x31453f;};'use strict';var _=require('lodash');var util=require(_0x68ad('0x0'));var moment=require(_0x68ad('0x1'));var BPromise=require(_0x68ad('0x2'));var rs=require(_0x68ad('0x3'));var fs=require('fs');var Redis=require(_0x68ad('0x4'));var db=require(_0x68ad('0x5'))['db'];var utils=require(_0x68ad('0x6'));var logger=require(_0x68ad('0x7'))(_0x68ad('0x8'));var config=require(_0x68ad('0x9'));var jayson=require(_0x68ad('0xa'));var client=jayson[_0x68ad('0xb')][_0x68ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x529515,_0x37c0a9,_0x3e5a44){return new BPromise(function(_0x1997f7,_0x350631){return client[_0x68ad('0xd')](_0x529515,_0x3e5a44)['then'](function(_0x30d118){logger[_0x68ad('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x37c0a9,_0x68ad('0xf'));logger[_0x68ad('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x37c0a9,_0x68ad('0xf'),JSON['stringify'](_0x30d118));if(_0x30d118[_0x68ad('0x11')]){if(_0x30d118[_0x68ad('0x11')][_0x68ad('0x12')]===0x1f4){logger[_0x68ad('0x11')](_0x68ad('0x13'),_0x37c0a9,_0x30d118[_0x68ad('0x11')][_0x68ad('0x14')]);return _0x350631(_0x30d118[_0x68ad('0x11')][_0x68ad('0x14')]);}logger[_0x68ad('0x11')](_0x68ad('0x13'),_0x37c0a9,_0x30d118[_0x68ad('0x11')][_0x68ad('0x14')]);return _0x1997f7(_0x30d118[_0x68ad('0x11')][_0x68ad('0x14')]);}else{logger[_0x68ad('0xe')](_0x68ad('0x13'),_0x37c0a9,'request\x20sent');_0x1997f7(_0x30d118[_0x68ad('0x15')][_0x68ad('0x14')]);}})['catch'](function(_0x1cbd2e){logger[_0x68ad('0x11')](_0x68ad('0x13'),_0x37c0a9,_0x1cbd2e);_0x350631(_0x1cbd2e);});});} \ No newline at end of file +var _0x1aa9=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x530044,_0x23f36a){var _0x16c325=function(_0x464b6d){while(--_0x464b6d){_0x530044['push'](_0x530044['shift']());}};_0x16c325(++_0x23f36a);}(_0x1aa9,0x1a3));var _0x91aa=function(_0x413d74,_0x5bab1b){_0x413d74=_0x413d74-0x0;var _0x177f90=_0x1aa9[_0x413d74];return _0x177f90;};'use strict';var _=require(_0x91aa('0x0'));var util=require(_0x91aa('0x1'));var moment=require(_0x91aa('0x2'));var BPromise=require(_0x91aa('0x3'));var rs=require(_0x91aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x91aa('0x6'))(_0x91aa('0x7'));var config=require('../../config/environment');var jayson=require(_0x91aa('0x8'));var client=jayson['client'][_0x91aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cc17e,_0x4c44fc,_0x440cce){return new BPromise(function(_0x594301,_0x24caf9){return client['request'](_0x2cc17e,_0x440cce)[_0x91aa('0xa')](function(_0x3060b7){logger[_0x91aa('0xb')](_0x91aa('0xc'),_0x4c44fc,_0x91aa('0xd'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x4c44fc,'request\x20sent',JSON[_0x91aa('0xe')](_0x3060b7));if(_0x3060b7[_0x91aa('0xf')]){if(_0x3060b7[_0x91aa('0xf')][_0x91aa('0x10')]===0x1f4){logger[_0x91aa('0xf')](_0x91aa('0xc'),_0x4c44fc,_0x3060b7[_0x91aa('0xf')][_0x91aa('0x11')]);return _0x24caf9(_0x3060b7[_0x91aa('0xf')]['message']);}logger[_0x91aa('0xf')](_0x91aa('0xc'),_0x4c44fc,_0x3060b7['error'][_0x91aa('0x11')]);return _0x594301(_0x3060b7[_0x91aa('0xf')][_0x91aa('0x11')]);}else{logger[_0x91aa('0xb')](_0x91aa('0xc'),_0x4c44fc,_0x91aa('0xd'));_0x594301(_0x3060b7['result'][_0x91aa('0x11')]);}})[_0x91aa('0x12')](function(_0x1843cd){logger['error'](_0x91aa('0xc'),_0x4c44fc,_0x1843cd);_0x24caf9(_0x1843cd);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 3f45b28..68c7652 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 _0x5fe4=['destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','put','/:id','update','delete'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x5fe4,0x189));var _0x45fe=function(_0x28383d,_0x4c101e){_0x28383d=_0x28383d-0x0;var _0x2e919e=_0x5fe4[_0x28383d];return _0x2e919e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x45fe('0x0'));var timeout=require(_0x45fe('0x1'));var express=require(_0x45fe('0x2'));var router=express['Router']();var fs_extra=require(_0x45fe('0x3'));var auth=require(_0x45fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x45fe('0x5'));var controller=require('./intVtigerField.controller');router[_0x45fe('0x6')]('/',auth['isAuthenticated'](),controller[_0x45fe('0x7')]);router['get']('/:id',auth[_0x45fe('0x8')](),controller[_0x45fe('0x9')]);router[_0x45fe('0xa')]('/',auth[_0x45fe('0x8')](),controller['create']);router[_0x45fe('0xb')](_0x45fe('0xc'),auth[_0x45fe('0x8')](),controller[_0x45fe('0xd')]);router[_0x45fe('0xe')](_0x45fe('0xc'),auth['isAuthenticated'](),controller[_0x45fe('0xf')]);module[_0x45fe('0x10')]=router; \ No newline at end of file +var _0xabbb=['get','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xabbb,0x19a));var _0xbabb=function(_0x2b39f2,_0x523941){_0x2b39f2=_0x2b39f2-0x0;var _0x568395=_0xabbb[_0x2b39f2];return _0x568395;};'use strict';var multer=require(_0xbabb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbabb('0x1'));var express=require('express');var router=express[_0xbabb('0x2')]();var fs_extra=require(_0xbabb('0x3'));var auth=require(_0xbabb('0x4'));var interaction=require(_0xbabb('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbabb('0x6')](_0xbabb('0x7'),auth['isAuthenticated'](),controller[_0xbabb('0x8')]);router[_0xbabb('0x9')]('/',auth[_0xbabb('0xa')](),controller[_0xbabb('0xb')]);router[_0xbabb('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xbabb('0xd')]);router['delete'](_0xbabb('0x7'),auth['isAuthenticated'](),controller[_0xbabb('0xe')]);module[_0xbabb('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index fe29959..841a698 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 _0x8099=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0xc8c4b0,_0x240c34){var _0x21700e=function(_0x195a55){while(--_0x195a55){_0xc8c4b0['push'](_0xc8c4b0['shift']());}};_0x21700e(++_0x240c34);}(_0x8099,0x1d1));var _0x9809=function(_0x5dfb04,_0xee57d1){_0x5dfb04=_0x5dfb04-0x0;var _0x58f52a=_0x8099[_0x5dfb04];return _0x58f52a;};'use strict';var Sequelize=require(_0x9809('0x0'));module[_0x9809('0x1')]={'type':{'type':Sequelize[_0x9809('0x2')](_0x9809('0x3'),_0x9809('0x4'),_0x9809('0x5'),_0x9809('0x6'),_0x9809('0x7')),'defaultValue':_0x9809('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9809('0x2')](_0x9809('0x3'),_0x9809('0x4'),_0x9809('0x5'))},'keyContent':{'type':Sequelize[_0x9809('0x8')]},'idField':{'type':Sequelize[_0x9809('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9809('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9809('0x8')]}}; \ No newline at end of file +var _0x4915=['variable','BOOLEAN','exports','string','customVariable','keyValue','picklist','STRING'];(function(_0x420a27,_0x4c7cf2){var _0x1d686c=function(_0x28761f){while(--_0x28761f){_0x420a27['push'](_0x420a27['shift']());}};_0x1d686c(++_0x4c7cf2);}(_0x4915,0x1f2));var _0x5491=function(_0x3d69f9,_0x24daed){_0x3d69f9=_0x3d69f9-0x0;var _0x386964=_0x4915[_0x3d69f9];return _0x386964;};'use strict';var Sequelize=require('sequelize');module[_0x5491('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5491('0x1'),'variable',_0x5491('0x2'),_0x5491('0x3'),_0x5491('0x4')),'defaultValue':_0x5491('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5491('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5491('0x6'),_0x5491('0x2'))},'keyContent':{'type':Sequelize[_0x5491('0x5')]},'idField':{'type':Sequelize[_0x5491('0x5')]},'nameField':{'type':Sequelize[_0x5491('0x5')]},'customField':{'type':Sequelize[_0x5491('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5491('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e9eff05..2c741cf 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 _0x9326=['../../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','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x18f3a3,_0x4470bc){var _0x1351d8=function(_0x50f113){while(--_0x50f113){_0x18f3a3['push'](_0x18f3a3['shift']());}};_0x1351d8(++_0x4470bc);}(_0x9326,0xd7));var _0x6932=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x9326[_0x5ee3d3];return _0x4b272f;};'use strict';var emlformat=require(_0x6932('0x0'));var rimraf=require(_0x6932('0x1'));var zipdir=require(_0x6932('0x2'));var jsonpatch=require(_0x6932('0x3'));var rp=require(_0x6932('0x4'));var moment=require(_0x6932('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6932('0x6'));var util=require(_0x6932('0x7'));var path=require('path');var sox=require(_0x6932('0x8'));var csv=require(_0x6932('0x9'));var ejs=require(_0x6932('0xa'));var fs=require('fs');var fs_extra=require(_0x6932('0xb'));var _=require(_0x6932('0xc'));var squel=require(_0x6932('0xd'));var crypto=require(_0x6932('0xe'));var jsforce=require(_0x6932('0xf'));var deskjs=require(_0x6932('0x10'));var toCsv=require(_0x6932('0x9'));var querystring=require(_0x6932('0x11'));var Papa=require('papaparse');var Redis=require(_0x6932('0x12'));var authService=require(_0x6932('0x13'));var qs=require(_0x6932('0x14'));var as=require(_0x6932('0x15'));var hardwareService=require(_0x6932('0x16'));var logger=require('../../config/logger')(_0x6932('0x17'));var utils=require(_0x6932('0x18'));var config=require(_0x6932('0x19'));var licenseUtil=require(_0x6932('0x1a'));var db=require(_0x6932('0x1b'))['db'];function respondWithStatusCode(_0x13ae0d,_0x5ac1fb){_0x5ac1fb=_0x5ac1fb||0xcc;return function(_0x22139c){if(_0x22139c){return _0x13ae0d[_0x6932('0x1c')](_0x5ac1fb);}return _0x13ae0d[_0x6932('0x1d')](_0x5ac1fb)['end']();};}function respondWithResult(_0xa83e22,_0x9fe7cc){_0x9fe7cc=_0x9fe7cc||0xc8;return function(_0x59b486){if(_0x59b486){return _0xa83e22[_0x6932('0x1d')](_0x9fe7cc)[_0x6932('0x1e')](_0x59b486);}};}function respondWithFilteredResult(_0x1db7aa,_0x1c1ab8){return function(_0x393309){if(_0x393309){var _0x3f4645=typeof _0x1c1ab8[_0x6932('0x1f')]==='undefined'&&typeof _0x1c1ab8[_0x6932('0x20')]==='undefined';var _0x5be8ba=_0x393309[_0x6932('0x21')];var _0x7f4e4d=_0x3f4645?0x0:_0x1c1ab8[_0x6932('0x1f')];var _0x330322=_0x3f4645?_0x393309[_0x6932('0x21')]:_0x1c1ab8[_0x6932('0x1f')]+_0x1c1ab8[_0x6932('0x20')];var _0x3c4642;if(_0x330322>=_0x5be8ba){_0x330322=_0x5be8ba;_0x3c4642=0xc8;}else{_0x3c4642=0xce;}_0x1db7aa[_0x6932('0x1d')](_0x3c4642);return _0x1db7aa['set'](_0x6932('0x22'),_0x7f4e4d+'-'+_0x330322+'/'+_0x5be8ba)[_0x6932('0x1e')](_0x393309);}return null;};}function patchUpdates(_0x4eff69){return function(_0x2e1df2){try{jsonpatch[_0x6932('0x23')](_0x2e1df2,_0x4eff69,!![]);}catch(_0x507b5b){return BPromise[_0x6932('0x24')](_0x507b5b);}return _0x2e1df2[_0x6932('0x25')]();};}function saveUpdates(_0x12c2e,_0x33ccff){return function(_0x3ab508){if(_0x3ab508){return _0x3ab508[_0x6932('0x26')](_0x12c2e)['then'](function(_0x12e4eb){return _0x12e4eb;});}return null;};}function removeEntity(_0x38f8b3,_0x274bb3){return function(_0x588cf1){if(_0x588cf1){return _0x588cf1[_0x6932('0x27')]()[_0x6932('0x28')](function(){_0x38f8b3[_0x6932('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e106,_0x471310){return function(_0x3a2dd2){if(!_0x3a2dd2){_0x34e106['sendStatus'](0x194);}return _0x3a2dd2;};}function handleError(_0x527d08,_0x4b4206){_0x4b4206=_0x4b4206||0x1f4;return function(_0x3bd6c7){logger[_0x6932('0x29')](_0x3bd6c7[_0x6932('0x2a')]);if(_0x3bd6c7[_0x6932('0x2b')]){delete _0x3bd6c7[_0x6932('0x2b')];}_0x527d08[_0x6932('0x1d')](_0x4b4206)[_0x6932('0x2c')](_0x3bd6c7);};}exports[_0x6932('0x2d')]=function(_0x1e538c,_0x207704){var _0x205162={},_0x489fa2={},_0xb86f79={'count':0x0,'rows':[]};var _0x24840d=_['map'](db[_0x6932('0x2e')][_0x6932('0x2f')],function(_0x3a48f7){return{'name':_0x3a48f7[_0x6932('0x30')],'type':_0x3a48f7[_0x6932('0x31')][_0x6932('0x32')]};});_0x489fa2[_0x6932('0x33')]=_['map'](_0x24840d,_0x6932('0x2b'));_0x489fa2['query']=_[_0x6932('0x34')](_0x1e538c[_0x6932('0x35')]);_0x489fa2[_0x6932('0x36')]=_['intersection'](_0x489fa2['model'],_0x489fa2[_0x6932('0x35')]);_0x205162[_0x6932('0x37')]=_['intersection'](_0x489fa2[_0x6932('0x33')],qs[_0x6932('0x38')](_0x1e538c[_0x6932('0x35')][_0x6932('0x38')]));_0x205162['attributes']=_0x205162[_0x6932('0x37')][_0x6932('0x39')]?_0x205162['attributes']:_0x489fa2[_0x6932('0x33')];if(!_0x1e538c[_0x6932('0x35')][_0x6932('0x3a')](_0x6932('0x3b'))){_0x205162[_0x6932('0x20')]=qs['limit'](_0x1e538c['query'][_0x6932('0x20')]);_0x205162[_0x6932('0x1f')]=qs[_0x6932('0x1f')](_0x1e538c[_0x6932('0x35')][_0x6932('0x1f')]);}_0x205162[_0x6932('0x3c')]=qs[_0x6932('0x3d')](_0x1e538c[_0x6932('0x35')]['sort']);_0x205162['where']=qs[_0x6932('0x36')](_[_0x6932('0x3e')](_0x1e538c['query'],_0x489fa2[_0x6932('0x36')]),_0x24840d);if(_0x1e538c[_0x6932('0x35')][_0x6932('0x3f')]){_0x205162[_0x6932('0x40')]=_[_0x6932('0x41')](_0x205162[_0x6932('0x40')],{'$or':_[_0x6932('0x42')](_0x24840d,function(_0x4e90d3){if(_0x4e90d3[_0x6932('0x31')]!==_0x6932('0x43')){var _0x46e1b1={};_0x46e1b1[_0x4e90d3[_0x6932('0x2b')]]={'$like':'%'+_0x1e538c[_0x6932('0x35')]['filter']+'%'};return _0x46e1b1;}})});}_0x205162=_['merge']({},_0x205162,_0x1e538c[_0x6932('0x44')]);var _0x3aba5b={'where':_0x205162[_0x6932('0x40')]};return db[_0x6932('0x2e')][_0x6932('0x21')](_0x3aba5b)['then'](function(_0xa45818){_0xb86f79['count']=_0xa45818;if(_0x1e538c['query'][_0x6932('0x45')]){_0x205162[_0x6932('0x46')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x205162);})['then'](function(_0x518f86){_0xb86f79[_0x6932('0x47')]=_0x518f86;return _0xb86f79;})[_0x6932('0x28')](respondWithFilteredResult(_0x207704,_0x205162))[_0x6932('0x48')](handleError(_0x207704,null));};exports['show']=function(_0x1150ce,_0x409a96){var _0x5055ac={'raw':!![],'where':{'id':_0x1150ce[_0x6932('0x49')]['id']}},_0x1705e={};_0x1705e['model']=_[_0x6932('0x34')](db['VtigerField'][_0x6932('0x2f')]);_0x1705e[_0x6932('0x35')]=_[_0x6932('0x34')](_0x1150ce['query']);_0x1705e[_0x6932('0x36')]=_[_0x6932('0x4a')](_0x1705e['model'],_0x1705e[_0x6932('0x35')]);_0x5055ac['attributes']=_['intersection'](_0x1705e[_0x6932('0x33')],qs[_0x6932('0x38')](_0x1150ce['query'][_0x6932('0x38')]));_0x5055ac[_0x6932('0x37')]=_0x5055ac[_0x6932('0x37')][_0x6932('0x39')]?_0x5055ac[_0x6932('0x37')]:_0x1705e[_0x6932('0x33')];if(_0x1150ce[_0x6932('0x35')][_0x6932('0x45')]){_0x5055ac[_0x6932('0x46')]=[{'all':!![]}];}_0x5055ac=_[_0x6932('0x41')]({},_0x5055ac,_0x1150ce['options']);return db[_0x6932('0x2e')][_0x6932('0x4b')](_0x5055ac)[_0x6932('0x28')](handleEntityNotFound(_0x409a96,null))[_0x6932('0x28')](respondWithResult(_0x409a96,null))[_0x6932('0x48')](handleError(_0x409a96,null));};exports[_0x6932('0x4c')]=function(_0x2dee81,_0x8c847d){return db[_0x6932('0x2e')][_0x6932('0x4c')](_0x2dee81[_0x6932('0x4d')],{})['then'](respondWithResult(_0x8c847d,0xc9))['catch'](handleError(_0x8c847d,null));};exports[_0x6932('0x26')]=function(_0x49e6f2,_0x294fcd){if(_0x49e6f2[_0x6932('0x4d')]['id']){delete _0x49e6f2[_0x6932('0x4d')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x49e6f2[_0x6932('0x49')]['id']}})[_0x6932('0x28')](handleEntityNotFound(_0x294fcd,null))[_0x6932('0x28')](saveUpdates(_0x49e6f2['body'],null))[_0x6932('0x28')](respondWithResult(_0x294fcd,null))[_0x6932('0x48')](handleError(_0x294fcd,null));};exports[_0x6932('0x27')]=function(_0x27dca6,_0x2421c2){return db[_0x6932('0x2e')][_0x6932('0x4b')]({'where':{'id':_0x27dca6[_0x6932('0x49')]['id']}})[_0x6932('0x28')](handleEntityNotFound(_0x2421c2,null))[_0x6932('0x28')](removeEntity(_0x2421c2,null))[_0x6932('0x48')](handleError(_0x2421c2,null));}; \ No newline at end of file +var _0xe4dd=['mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','length','include','find','create','body','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe4dd,0x114));var _0xde4d=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xe4dd[_0x174ef5];return _0x1cc379;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xde4d('0x0'));var rp=require(_0xde4d('0x1'));var moment=require(_0xde4d('0x2'));var BPromise=require(_0xde4d('0x3'));var Mustache=require(_0xde4d('0x4'));var util=require(_0xde4d('0x5'));var path=require(_0xde4d('0x6'));var sox=require(_0xde4d('0x7'));var csv=require(_0xde4d('0x8'));var ejs=require(_0xde4d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde4d('0xa'));var squel=require(_0xde4d('0xb'));var crypto=require('crypto');var jsforce=require(_0xde4d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xde4d('0x8'));var querystring=require('querystring');var Papa=require(_0xde4d('0xd'));var Redis=require('ioredis');var authService=require(_0xde4d('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde4d('0xf'));var logger=require(_0xde4d('0x10'))(_0xde4d('0x11'));var utils=require(_0xde4d('0x12'));var config=require(_0xde4d('0x13'));var licenseUtil=require(_0xde4d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4de7fa,_0x2d96bb){_0x2d96bb=_0x2d96bb||0xcc;return function(_0xdcad81){if(_0xdcad81){return _0x4de7fa[_0xde4d('0x15')](_0x2d96bb);}return _0x4de7fa[_0xde4d('0x16')](_0x2d96bb)[_0xde4d('0x17')]();};}function respondWithResult(_0x773fab,_0xe7bc0e){_0xe7bc0e=_0xe7bc0e||0xc8;return function(_0x39f464){if(_0x39f464){return _0x773fab[_0xde4d('0x16')](_0xe7bc0e)[_0xde4d('0x18')](_0x39f464);}};}function respondWithFilteredResult(_0x1c9130,_0x53ebf6){return function(_0xfc3976){if(_0xfc3976){var _0x3c4d0d=typeof _0x53ebf6[_0xde4d('0x19')]===_0xde4d('0x1a')&&typeof _0x53ebf6[_0xde4d('0x1b')]===_0xde4d('0x1a');var _0x475803=_0xfc3976[_0xde4d('0x1c')];var _0xfc2d7e=_0x3c4d0d?0x0:_0x53ebf6[_0xde4d('0x19')];var _0x265e63=_0x3c4d0d?_0xfc3976['count']:_0x53ebf6['offset']+_0x53ebf6[_0xde4d('0x1b')];var _0x48d501;if(_0x265e63>=_0x475803){_0x265e63=_0x475803;_0x48d501=0xc8;}else{_0x48d501=0xce;}_0x1c9130['status'](_0x48d501);return _0x1c9130[_0xde4d('0x1d')](_0xde4d('0x1e'),_0xfc2d7e+'-'+_0x265e63+'/'+_0x475803)['json'](_0xfc3976);}return null;};}function patchUpdates(_0x51d243){return function(_0x1159ae){try{jsonpatch[_0xde4d('0x1f')](_0x1159ae,_0x51d243,!![]);}catch(_0x286570){return BPromise['reject'](_0x286570);}return _0x1159ae[_0xde4d('0x20')]();};}function saveUpdates(_0x1164a0,_0x608a6){return function(_0xd8e18b){if(_0xd8e18b){return _0xd8e18b[_0xde4d('0x21')](_0x1164a0)[_0xde4d('0x22')](function(_0x4a8e5e){return _0x4a8e5e;});}return null;};}function removeEntity(_0xef4c96,_0x13a526){return function(_0x14e17f){if(_0x14e17f){return _0x14e17f[_0xde4d('0x23')]()[_0xde4d('0x22')](function(){_0xef4c96[_0xde4d('0x16')](0xcc)[_0xde4d('0x17')]();});}};}function handleEntityNotFound(_0x2d0cd5,_0x5cfcd2){return function(_0x1b50aa){if(!_0x1b50aa){_0x2d0cd5[_0xde4d('0x15')](0x194);}return _0x1b50aa;};}function handleError(_0x252173,_0x336768){_0x336768=_0x336768||0x1f4;return function(_0xd330d0){logger[_0xde4d('0x24')](_0xd330d0[_0xde4d('0x25')]);if(_0xd330d0[_0xde4d('0x26')]){delete _0xd330d0[_0xde4d('0x26')];}_0x252173['status'](_0x336768)['send'](_0xd330d0);};}exports[_0xde4d('0x27')]=function(_0x3a7f47,_0x1dbeb3){var _0x395807={},_0x5b7740={},_0x4131ed={'count':0x0,'rows':[]};var _0x37ccde=_[_0xde4d('0x28')](db[_0xde4d('0x29')][_0xde4d('0x2a')],function(_0x19b077){return{'name':_0x19b077[_0xde4d('0x2b')],'type':_0x19b077[_0xde4d('0x2c')]['key']};});_0x5b7740[_0xde4d('0x2d')]=_[_0xde4d('0x28')](_0x37ccde,'name');_0x5b7740[_0xde4d('0x2e')]=_[_0xde4d('0x2f')](_0x3a7f47['query']);_0x5b7740[_0xde4d('0x30')]=_['intersection'](_0x5b7740['model'],_0x5b7740[_0xde4d('0x2e')]);_0x395807['attributes']=_[_0xde4d('0x31')](_0x5b7740['model'],qs['fields'](_0x3a7f47[_0xde4d('0x2e')][_0xde4d('0x32')]));_0x395807[_0xde4d('0x33')]=_0x395807[_0xde4d('0x33')]['length']?_0x395807['attributes']:_0x5b7740[_0xde4d('0x2d')];if(!_0x3a7f47[_0xde4d('0x2e')][_0xde4d('0x34')](_0xde4d('0x35'))){_0x395807[_0xde4d('0x1b')]=qs[_0xde4d('0x1b')](_0x3a7f47[_0xde4d('0x2e')]['limit']);_0x395807[_0xde4d('0x19')]=qs['offset'](_0x3a7f47['query'][_0xde4d('0x19')]);}_0x395807['order']=qs['sort'](_0x3a7f47['query'][_0xde4d('0x36')]);_0x395807[_0xde4d('0x37')]=qs[_0xde4d('0x30')](_[_0xde4d('0x38')](_0x3a7f47[_0xde4d('0x2e')],_0x5b7740['filters']),_0x37ccde);if(_0x3a7f47[_0xde4d('0x2e')][_0xde4d('0x39')]){_0x395807[_0xde4d('0x37')]=_[_0xde4d('0x3a')](_0x395807[_0xde4d('0x37')],{'$or':_[_0xde4d('0x28')](_0x37ccde,function(_0x1c5eb6){if(_0x1c5eb6[_0xde4d('0x2c')]!==_0xde4d('0x3b')){var _0xc796ee={};_0xc796ee[_0x1c5eb6[_0xde4d('0x26')]]={'$like':'%'+_0x3a7f47[_0xde4d('0x2e')]['filter']+'%'};return _0xc796ee;}})});}_0x395807=_['merge']({},_0x395807,_0x3a7f47[_0xde4d('0x3c')]);var _0x417b63={'where':_0x395807[_0xde4d('0x37')]};return db['VtigerField'][_0xde4d('0x1c')](_0x417b63)[_0xde4d('0x22')](function(_0x421b41){_0x4131ed[_0xde4d('0x1c')]=_0x421b41;if(_0x3a7f47['query'][_0xde4d('0x3d')]){_0x395807['include']=[{'all':!![]}];}return db[_0xde4d('0x29')]['findAll'](_0x395807);})[_0xde4d('0x22')](function(_0x320732){_0x4131ed['rows']=_0x320732;return _0x4131ed;})[_0xde4d('0x22')](respondWithFilteredResult(_0x1dbeb3,_0x395807))[_0xde4d('0x3e')](handleError(_0x1dbeb3,null));};exports[_0xde4d('0x3f')]=function(_0x9edf7c,_0x3f00ec){var _0x1ef017={'raw':!![],'where':{'id':_0x9edf7c[_0xde4d('0x40')]['id']}},_0x5d3408={};_0x5d3408['model']=_[_0xde4d('0x2f')](db[_0xde4d('0x29')][_0xde4d('0x2a')]);_0x5d3408[_0xde4d('0x2e')]=_[_0xde4d('0x2f')](_0x9edf7c[_0xde4d('0x2e')]);_0x5d3408[_0xde4d('0x30')]=_['intersection'](_0x5d3408[_0xde4d('0x2d')],_0x5d3408[_0xde4d('0x2e')]);_0x1ef017[_0xde4d('0x33')]=_['intersection'](_0x5d3408[_0xde4d('0x2d')],qs[_0xde4d('0x32')](_0x9edf7c[_0xde4d('0x2e')]['fields']));_0x1ef017[_0xde4d('0x33')]=_0x1ef017[_0xde4d('0x33')][_0xde4d('0x41')]?_0x1ef017[_0xde4d('0x33')]:_0x5d3408[_0xde4d('0x2d')];if(_0x9edf7c[_0xde4d('0x2e')][_0xde4d('0x3d')]){_0x1ef017[_0xde4d('0x42')]=[{'all':!![]}];}_0x1ef017=_[_0xde4d('0x3a')]({},_0x1ef017,_0x9edf7c[_0xde4d('0x3c')]);return db['VtigerField'][_0xde4d('0x43')](_0x1ef017)[_0xde4d('0x22')](handleEntityNotFound(_0x3f00ec,null))[_0xde4d('0x22')](respondWithResult(_0x3f00ec,null))[_0xde4d('0x3e')](handleError(_0x3f00ec,null));};exports['create']=function(_0xab9cab,_0x529cec){return db[_0xde4d('0x29')][_0xde4d('0x44')](_0xab9cab[_0xde4d('0x45')],{})[_0xde4d('0x22')](respondWithResult(_0x529cec,0xc9))[_0xde4d('0x3e')](handleError(_0x529cec,null));};exports['update']=function(_0x969ca5,_0x384666){if(_0x969ca5[_0xde4d('0x45')]['id']){delete _0x969ca5[_0xde4d('0x45')]['id'];}return db[_0xde4d('0x29')][_0xde4d('0x43')]({'where':{'id':_0x969ca5[_0xde4d('0x40')]['id']}})['then'](handleEntityNotFound(_0x384666,null))[_0xde4d('0x22')](saveUpdates(_0x969ca5[_0xde4d('0x45')],null))[_0xde4d('0x22')](respondWithResult(_0x384666,null))[_0xde4d('0x3e')](handleError(_0x384666,null));};exports['destroy']=function(_0x5229da,_0x52f7a2){return db[_0xde4d('0x29')][_0xde4d('0x43')]({'where':{'id':_0x5229da['params']['id']}})[_0xde4d('0x22')](handleEntityNotFound(_0x52f7a2,null))['then'](removeEntity(_0x52f7a2,null))[_0xde4d('0x3e')](handleError(_0x52f7a2,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 178902d..8aa9ae8 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 _0x5801=['moment','bluebird','request-promise','path','rimraf','exports','define','VtigerField','vtiger_unique_index','idField','lodash','../../config/logger'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x5801,0x166));var _0x1580=function(_0x6b998b,_0x4b45da){_0x6b998b=_0x6b998b-0x0;var _0x2f7f8f=_0x5801[_0x6b998b];return _0x2f7f8f;};'use strict';var _=require(_0x1580('0x0'));var util=require('util');var logger=require(_0x1580('0x1'))('api');var moment=require(_0x1580('0x2'));var BPromise=require(_0x1580('0x3'));var rp=require(_0x1580('0x4'));var fs=require('fs');var path=require(_0x1580('0x5'));var rimraf=require(_0x1580('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x1580('0x7')]=function(_0x157ea9,_0x1e29a6){return _0x157ea9[_0x1580('0x8')](_0x1580('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x1580('0xa'),'fields':[_0x1580('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x348c=['./intVtigerField.attributes','exports','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x566d23,_0x514854){var _0x34df43=function(_0x1911ae){while(--_0x1911ae){_0x566d23['push'](_0x566d23['shift']());}};_0x34df43(++_0x514854);}(_0x348c,0x164));var _0xc348=function(_0xdd3395,_0x2f794d){_0xdd3395=_0xdd3395-0x0;var _0x3b549d=_0x348c[_0xdd3395];return _0x3b549d;};'use strict';var _=require(_0xc348('0x0'));var util=require(_0xc348('0x1'));var logger=require(_0xc348('0x2'))(_0xc348('0x3'));var moment=require(_0xc348('0x4'));var BPromise=require(_0xc348('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc348('0x6'));var config=require(_0xc348('0x7'));var attributes=require(_0xc348('0x8'));module[_0xc348('0x9')]=function(_0x178294,_0x49fcb2){return _0x178294['define']('VtigerField',attributes,{'tableName':_0xc348('0xa'),'paranoid':![],'indexes':[{'name':_0xc348('0xb'),'fields':[_0xc348('0xc'),_0xc348('0xd')],'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 91a3ea9..a45bc6d 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 _0x2a18=['info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','message','VtigerField,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x46390e,_0x39d20f){var _0x4db91c=function(_0x2bd91e){while(--_0x2bd91e){_0x46390e['push'](_0x46390e['shift']());}};_0x4db91c(++_0x39d20f);}(_0x2a18,0x64));var _0x82a1=function(_0x7a319d,_0x235959){_0x7a319d=_0x7a319d-0x0;var _0x5c6b4e=_0x2a18[_0x7a319d];return _0x5c6b4e;};'use strict';var _=require(_0x82a1('0x0'));var util=require('util');var moment=require(_0x82a1('0x1'));var BPromise=require(_0x82a1('0x2'));var rs=require(_0x82a1('0x3'));var fs=require('fs');var Redis=require(_0x82a1('0x4'));var db=require(_0x82a1('0x5'))['db'];var utils=require(_0x82a1('0x6'));var logger=require(_0x82a1('0x7'))(_0x82a1('0x8'));var config=require(_0x82a1('0x9'));var jayson=require(_0x82a1('0xa'));var client=jayson[_0x82a1('0xb')][_0x82a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7d5964,_0x5a5f3e,_0x4cb67d){return new BPromise(function(_0x4f9c8e,_0x4d2035){return client[_0x82a1('0xd')](_0x7d5964,_0x4cb67d)[_0x82a1('0xe')](function(_0x3e93bb){logger[_0x82a1('0xf')]('VtigerField,\x20%s,\x20%s',_0x5a5f3e,_0x82a1('0x10'));logger[_0x82a1('0x11')](_0x82a1('0x12'),_0x5a5f3e,'request\x20sent',JSON['stringify'](_0x3e93bb));if(_0x3e93bb[_0x82a1('0x13')]){if(_0x3e93bb['error']['code']===0x1f4){logger[_0x82a1('0x13')]('VtigerField,\x20%s,\x20%s',_0x5a5f3e,_0x3e93bb[_0x82a1('0x13')][_0x82a1('0x14')]);return _0x4d2035(_0x3e93bb[_0x82a1('0x13')][_0x82a1('0x14')]);}logger[_0x82a1('0x13')](_0x82a1('0x15'),_0x5a5f3e,_0x3e93bb[_0x82a1('0x13')]['message']);return _0x4f9c8e(_0x3e93bb[_0x82a1('0x13')][_0x82a1('0x14')]);}else{logger[_0x82a1('0xf')](_0x82a1('0x15'),_0x5a5f3e,_0x82a1('0x10'));_0x4f9c8e(_0x3e93bb['result'][_0x82a1('0x14')]);}})[_0x82a1('0x16')](function(_0x272972){logger[_0x82a1('0x13')](_0x82a1('0x15'),_0x5a5f3e,_0x272972);_0x4d2035(_0x272972);});});} \ No newline at end of file +var _0x8068=['result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8068,0x1c9));var _0x8806=function(_0x76517f,_0x325017){_0x76517f=_0x76517f-0x0;var _0x43cc3a=_0x8068[_0x76517f];return _0x43cc3a;};'use strict';var _=require(_0x8806('0x0'));var util=require('util');var moment=require(_0x8806('0x1'));var BPromise=require('bluebird');var rs=require(_0x8806('0x2'));var fs=require('fs');var Redis=require(_0x8806('0x3'));var db=require(_0x8806('0x4'))['db'];var utils=require(_0x8806('0x5'));var logger=require(_0x8806('0x6'))(_0x8806('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8806('0x8')][_0x8806('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bd2ee,_0x582163,_0x544e32){return new BPromise(function(_0x56e537,_0x31714f){return client['request'](_0x5bd2ee,_0x544e32)[_0x8806('0xa')](function(_0x1861a8){logger[_0x8806('0xb')](_0x8806('0xc'),_0x582163,_0x8806('0xd'));logger[_0x8806('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x582163,_0x8806('0xd'),JSON['stringify'](_0x1861a8));if(_0x1861a8[_0x8806('0xf')]){if(_0x1861a8[_0x8806('0xf')][_0x8806('0x10')]===0x1f4){logger[_0x8806('0xf')](_0x8806('0xc'),_0x582163,_0x1861a8[_0x8806('0xf')][_0x8806('0x11')]);return _0x31714f(_0x1861a8[_0x8806('0xf')][_0x8806('0x11')]);}logger[_0x8806('0xf')]('VtigerField,\x20%s,\x20%s',_0x582163,_0x1861a8[_0x8806('0xf')]['message']);return _0x56e537(_0x1861a8[_0x8806('0xf')][_0x8806('0x11')]);}else{logger['info'](_0x8806('0xc'),_0x582163,_0x8806('0xd'));_0x56e537(_0x1861a8[_0x8806('0x12')][_0x8806('0x11')]);}})['catch'](function(_0x576652){logger[_0x8806('0xf')](_0x8806('0xc'),_0x582163,_0x576652);_0x31714f(_0x576652);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 83b1d0c..a03ef82 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 _0xc3d5=['fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','/:id','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','addConfiguration','update','delete','util'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xc3d5,0x16f));var _0x5c3d=function(_0x13fe61,_0x257256){_0x13fe61=_0x13fe61-0x0;var _0x3c1e9f=_0xc3d5[_0x13fe61];return _0x3c1e9f;};'use strict';var multer=require('multer');var util=require(_0x5c3d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5c3d('0x1'));var auth=require(_0x5c3d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x5c3d('0x3'));var controller=require(_0x5c3d('0x4'));router[_0x5c3d('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c3d('0x5')](_0x5c3d('0x6'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5c3d('0x7'),auth[_0x5c3d('0x8')](),controller['getConfigurations']);router['get'](_0x5c3d('0x9'),auth['isAuthenticated'](),controller[_0x5c3d('0xa')]);router[_0x5c3d('0xb')]('/',auth[_0x5c3d('0x8')](),controller[_0x5c3d('0xc')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5c3d('0xd')]);router['put'](_0x5c3d('0x6'),auth[_0x5c3d('0x8')](),controller[_0x5c3d('0xe')]);router[_0x5c3d('0xf')](_0x5c3d('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6bac=['../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','/:id','getConfigurations','getFields','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x13cfda,_0xbfa43c){var _0x2b664a=function(_0x47744c){while(--_0x47744c){_0x13cfda['push'](_0x13cfda['shift']());}};_0x2b664a(++_0xbfa43c);}(_0x6bac,0xf1));var _0xc6ba=function(_0x5c81cc,_0x12c9f){_0x5c81cc=_0x5c81cc-0x0;var _0x53b65d=_0x6bac[_0x5c81cc];return _0x53b65d;};'use strict';var multer=require(_0xc6ba('0x0'));var util=require(_0xc6ba('0x1'));var path=require('path');var timeout=require(_0xc6ba('0x2'));var express=require('express');var router=express[_0xc6ba('0x3')]();var fs_extra=require(_0xc6ba('0x4'));var auth=require(_0xc6ba('0x5'));var interaction=require(_0xc6ba('0x6'));var config=require('../../config/environment');var controller=require(_0xc6ba('0x7'));router[_0xc6ba('0x8')]('/',auth[_0xc6ba('0x9')](),controller['index']);router[_0xc6ba('0x8')](_0xc6ba('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc6ba('0x8')]('/:id/configurations',auth[_0xc6ba('0x9')](),controller[_0xc6ba('0xb')]);router['get']('/:id/fields',auth[_0xc6ba('0x9')](),controller[_0xc6ba('0xc')]);router['post']('/',auth[_0xc6ba('0x9')](),controller['create']);router['post'](_0xc6ba('0xd'),auth[_0xc6ba('0x9')](),controller[_0xc6ba('0xe')]);router[_0xc6ba('0xf')](_0xc6ba('0xa'),auth[_0xc6ba('0x9')](),controller['update']);router[_0xc6ba('0x10')](_0xc6ba('0xa'),auth[_0xc6ba('0x9')](),controller[_0xc6ba('0x11')]);module[_0xc6ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f88f61c..c0b8502 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 _0x1893=['newTab','STRING','username','ENUM','password','token','integrationTab'];(function(_0x420c7b,_0x289369){var _0x5c2ca3=function(_0x249b9a){while(--_0x249b9a){_0x420c7b['push'](_0x420c7b['shift']());}};_0x5c2ca3(++_0x289369);}(_0x1893,0xa2));var _0x3189=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x1893[_0x31b5b2];return _0x364f13;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]},'username':{'type':Sequelize[_0x3189('0x0')],'unique':_0x3189('0x1')},'password':{'type':Sequelize[_0x3189('0x0')]},'token':{'type':Sequelize[_0x3189('0x0')]},'remoteUri':{'type':Sequelize[_0x3189('0x0')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x3189('0x2')](_0x3189('0x3'),_0x3189('0x4')),'defaultValue':_0x3189('0x3')},'serverUrl':{'type':Sequelize[_0x3189('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x3189('0x2')](_0x3189('0x5'),_0x3189('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xaf11=['exports','STRING','username','remoteUri','ENUM','password','integrationTab','sequelize'];(function(_0x13d580,_0x53a187){var _0x5e124b=function(_0x5abc88){while(--_0x5abc88){_0x13d580['push'](_0x13d580['shift']());}};_0x5e124b(++_0x53a187);}(_0xaf11,0x12f));var _0x1af1=function(_0x4e013b,_0x19fa9e){_0x4e013b=_0x4e013b-0x0;var _0x16d1b0=_0xaf11[_0x4e013b];return _0x16d1b0;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'name':{'type':Sequelize[_0x1af1('0x2')]},'description':{'type':Sequelize[_0x1af1('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1af1('0x3')},'password':{'type':Sequelize[_0x1af1('0x2')]},'token':{'type':Sequelize[_0x1af1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1af1('0x4')},'authType':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x6'),'token'),'defaultValue':_0x1af1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x7'),'newTab'),'defaultValue':_0x1af1('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 136272e..5e4071d 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 _0xd914=['channel','ZendeskField','username','token','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','password','headers','%s:%s','Basic\x20%s','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','group','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','pick','map','options','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd914,0x17f));var _0x4d91=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0xd914[_0x4c80d7];return _0x3c5095;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];var integrations=require(_0x4d91('0x1b'));function respondWithStatusCode(_0x318e0c,_0x4ea591){_0x4ea591=_0x4ea591||0xcc;return function(_0x577a69){if(_0x577a69){return _0x318e0c[_0x4d91('0x1c')](_0x4ea591);}return _0x318e0c[_0x4d91('0x1d')](_0x4ea591)[_0x4d91('0x1e')]();};}function respondWithResult(_0x3c9fd6,_0x33fbd4){_0x33fbd4=_0x33fbd4||0xc8;return function(_0x25bafc){if(_0x25bafc){return _0x3c9fd6[_0x4d91('0x1d')](_0x33fbd4)['json'](_0x25bafc);}};}function respondWithFilteredResult(_0x3a8ec9,_0x42631a){return function(_0x1e2ef7){if(_0x1e2ef7){var _0xb92681=typeof _0x42631a[_0x4d91('0x1f')]==='undefined'&&typeof _0x42631a[_0x4d91('0x20')]===_0x4d91('0x21');var _0x241564=_0x1e2ef7[_0x4d91('0x22')];var _0x4cfa40=_0xb92681?0x0:_0x42631a[_0x4d91('0x1f')];var _0x3b579b=_0xb92681?_0x1e2ef7[_0x4d91('0x22')]:_0x42631a['offset']+_0x42631a[_0x4d91('0x20')];var _0x127911;if(_0x3b579b>=_0x241564){_0x3b579b=_0x241564;_0x127911=0xc8;}else{_0x127911=0xce;}_0x3a8ec9[_0x4d91('0x1d')](_0x127911);return _0x3a8ec9[_0x4d91('0x23')](_0x4d91('0x24'),_0x4cfa40+'-'+_0x3b579b+'/'+_0x241564)[_0x4d91('0x25')](_0x1e2ef7);}return null;};}function patchUpdates(_0xc1d44f){return function(_0x193ca9){try{jsonpatch[_0x4d91('0x26')](_0x193ca9,_0xc1d44f,!![]);}catch(_0x226d85){return BPromise['reject'](_0x226d85);}return _0x193ca9[_0x4d91('0x27')]();};}function saveUpdates(_0x5f5236,_0x57913e){return function(_0x74a697){if(_0x74a697){return _0x74a697[_0x4d91('0x28')](_0x5f5236)[_0x4d91('0x29')](function(_0x9cb864){return _0x9cb864;});}return null;};}function removeEntity(_0x7d8cbf,_0x12b722){return function(_0x100cd4){if(_0x100cd4){return _0x100cd4[_0x4d91('0x2a')]()['then'](function(){_0x7d8cbf['status'](0xcc)[_0x4d91('0x1e')]();});}};}function handleEntityNotFound(_0x112923,_0x3bed98){return function(_0x45fc91){if(!_0x45fc91){_0x112923[_0x4d91('0x1c')](0x194);}return _0x45fc91;};}function handleError(_0x2c7d7a,_0x14bdb4){_0x14bdb4=_0x14bdb4||0x1f4;return function(_0x560966){logger[_0x4d91('0x2b')](_0x560966[_0x4d91('0x2c')]);if(_0x560966[_0x4d91('0x2d')]){delete _0x560966['name'];}_0x2c7d7a['status'](_0x14bdb4)[_0x4d91('0x2e')](_0x560966);};}exports[_0x4d91('0x2f')]=function(_0x5ed948,_0x50fe76){var _0x42d5a0={},_0x2d6981={},_0x43371e={'count':0x0,'rows':[]};var _0x17c7bc=_['map'](db[_0x4d91('0x30')][_0x4d91('0x31')],function(_0x468e95){return{'name':_0x468e95[_0x4d91('0x32')],'type':_0x468e95[_0x4d91('0x33')][_0x4d91('0x34')]};});_0x2d6981[_0x4d91('0x35')]=_['map'](_0x17c7bc,_0x4d91('0x2d'));_0x2d6981['query']=_['keys'](_0x5ed948[_0x4d91('0x36')]);_0x2d6981[_0x4d91('0x37')]=_['intersection'](_0x2d6981[_0x4d91('0x35')],_0x2d6981[_0x4d91('0x36')]);_0x42d5a0[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x2d6981[_0x4d91('0x35')],qs['fields'](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x42d5a0[_0x4d91('0x38')]=_0x42d5a0[_0x4d91('0x38')][_0x4d91('0x3b')]?_0x42d5a0[_0x4d91('0x38')]:_0x2d6981['model'];if(!_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3c')]('nolimit')){_0x42d5a0[_0x4d91('0x20')]=qs[_0x4d91('0x20')](_0x5ed948[_0x4d91('0x36')]['limit']);_0x42d5a0[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x1f')]);}_0x42d5a0['order']=qs[_0x4d91('0x3d')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x42d5a0[_0x4d91('0x3e')]=qs['filters'](_['pick'](_0x5ed948[_0x4d91('0x36')],_0x2d6981[_0x4d91('0x37')]),_0x17c7bc);if(_0x5ed948['query'][_0x4d91('0x3f')]){_0x42d5a0[_0x4d91('0x3e')]=_[_0x4d91('0x40')](_0x42d5a0[_0x4d91('0x3e')],{'$or':_['map'](_0x17c7bc,function(_0x2eb7c7){if(_0x2eb7c7[_0x4d91('0x33')]!=='VIRTUAL'){var _0x1ba6cd={};_0x1ba6cd[_0x2eb7c7['name']]={'$like':'%'+_0x5ed948[_0x4d91('0x36')]['filter']+'%'};return _0x1ba6cd;}})});}_0x42d5a0=_[_0x4d91('0x40')]({},_0x42d5a0,_0x5ed948['options']);var _0x24fc69={'where':_0x42d5a0[_0x4d91('0x3e')]};return db[_0x4d91('0x30')][_0x4d91('0x22')](_0x24fc69)['then'](function(_0x5bcc9b){_0x43371e[_0x4d91('0x22')]=_0x5bcc9b;if(_0x5ed948['query'][_0x4d91('0x41')]){_0x42d5a0[_0x4d91('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4d91('0x43')](_0x42d5a0);})[_0x4d91('0x29')](function(_0x14db37){_0x43371e[_0x4d91('0x44')]=_0x14db37;return _0x43371e;})[_0x4d91('0x29')](respondWithFilteredResult(_0x50fe76,_0x42d5a0))[_0x4d91('0x45')](handleError(_0x50fe76,null));};exports[_0x4d91('0x46')]=function(_0x4f6254,_0x1e4c6d){var _0x4c70af={'raw':![],'where':{'id':_0x4f6254[_0x4d91('0x47')]['id']}},_0x41c06a={};_0x41c06a[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x30')][_0x4d91('0x31')]);_0x41c06a['query']=_['keys'](_0x4f6254[_0x4d91('0x36')]);_0x41c06a[_0x4d91('0x37')]=_['intersection'](_0x41c06a[_0x4d91('0x35')],_0x41c06a[_0x4d91('0x36')]);_0x4c70af[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x41c06a[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x4f6254[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x4c70af[_0x4d91('0x38')]=_0x4c70af['attributes']['length']?_0x4c70af[_0x4d91('0x38')]:_0x41c06a['model'];if(_0x4f6254[_0x4d91('0x36')][_0x4d91('0x41')]){_0x4c70af[_0x4d91('0x42')]=[{'all':!![]}];}_0x4c70af=_[_0x4d91('0x40')]({},_0x4c70af,_0x4f6254['options']);return db[_0x4d91('0x30')]['find'](_0x4c70af)['then'](handleEntityNotFound(_0x1e4c6d,null))[_0x4d91('0x29')](respondWithResult(_0x1e4c6d,null))[_0x4d91('0x45')](handleError(_0x1e4c6d,null));};exports[_0x4d91('0x49')]=function(_0xa03d75,_0x1f91ec){return db[_0x4d91('0x30')]['create'](_0xa03d75[_0x4d91('0x4a')],{})[_0x4d91('0x29')](respondWithResult(_0x1f91ec,0xc9))[_0x4d91('0x45')](handleError(_0x1f91ec,null));};exports[_0x4d91('0x28')]=function(_0x106e5b,_0x44e9ec){if(_0x106e5b[_0x4d91('0x4a')]['id']){delete _0x106e5b[_0x4d91('0x4a')]['id'];}return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x106e5b[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x44e9ec,null))[_0x4d91('0x29')](saveUpdates(_0x106e5b['body'],null))[_0x4d91('0x29')](respondWithResult(_0x44e9ec,null))[_0x4d91('0x45')](handleError(_0x44e9ec,null));};exports[_0x4d91('0x2a')]=function(_0x386935,_0x436a3d){return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x386935[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x436a3d,null))[_0x4d91('0x29')](removeEntity(_0x436a3d,null))[_0x4d91('0x45')](handleError(_0x436a3d,null));};exports[_0x4d91('0x4c')]=function(_0x2bba43,_0x26ecd7,_0x19e57e){var _0x5765ce={};var _0x4aae23={};var _0x392cc3;var _0x2159e4;return db[_0x4d91('0x30')][_0x4d91('0x4d')]({'where':{'id':_0x2bba43[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x26ecd7,null))[_0x4d91('0x29')](function(_0x4138c5){if(_0x4138c5){_0x392cc3=_0x4138c5;_0x4aae23[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x4e')][_0x4d91('0x31')]);_0x4aae23[_0x4d91('0x36')]=_[_0x4d91('0x48')](_0x2bba43[_0x4d91('0x36')]);_0x4aae23[_0x4d91('0x37')]=_[_0x4d91('0x39')](_0x4aae23['model'],_0x4aae23['query']);_0x5765ce['attributes']=_[_0x4d91('0x39')](_0x4aae23[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x2bba43['query'][_0x4d91('0x3a')]));_0x5765ce[_0x4d91('0x38')]=_0x5765ce[_0x4d91('0x38')]['length']?_0x5765ce['attributes']:_0x4aae23['model'];_0x5765ce[_0x4d91('0x4f')]=qs[_0x4d91('0x3d')](_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x5765ce[_0x4d91('0x3e')]=qs['filters'](_[_0x4d91('0x50')](_0x2bba43[_0x4d91('0x36')],_0x4aae23['filters']));if(_0x2bba43['query'][_0x4d91('0x3f')]){_0x5765ce['where']=_[_0x4d91('0x40')](_0x5765ce[_0x4d91('0x3e')],{'$or':_[_0x4d91('0x51')](_0x5765ce['attributes'],function(_0x2e0bff){var _0x3d6c26={};_0x3d6c26[_0x2e0bff]={'$like':'%'+_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3f')]+'%'};return _0x3d6c26;})});}_0x5765ce=_[_0x4d91('0x40')]({},_0x5765ce,_0x2bba43[_0x4d91('0x52')]);return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})['then'](function(_0x533572){if(_0x533572){_0x2159e4=_0x533572['length'];if(!_0x2bba43['query'][_0x4d91('0x3c')](_0x4d91('0x53'))){_0x5765ce[_0x4d91('0x20')]=qs['limit'](_0x2bba43[_0x4d91('0x36')]['limit']);_0x5765ce[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x2bba43['query']['offset']);}return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})[_0x4d91('0x29')](function(_0x31150f){if(_0x31150f){return _0x31150f?{'count':_0x2159e4,'rows':_0x31150f}:null;}})[_0x4d91('0x29')](respondWithResult(_0x26ecd7,null))[_0x4d91('0x45')](handleError(_0x26ecd7,null));};exports[_0x4d91('0x54')]=function(_0x7a94e2,_0x42e550,_0xd384a9){if(_0x7a94e2[_0x4d91('0x4a')]['id']){delete _0x7a94e2['body']['id'];}return db['ZendeskAccount'][_0x4d91('0x4d')]({'where':{'id':_0x7a94e2[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x42e550,null))[_0x4d91('0x29')](function(_0x16ba26){if(_0x16ba26){_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x55')]=_0x16ba26['id'];_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x56')]=integrations['getSubjects'](_0x7a94e2['body']['channel'],_0x7a94e2['body'][_0x4d91('0x33')]);_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x57')]=integrations[_0x4d91('0x58')](_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x59')],_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x33')]);return db[_0x4d91('0x4e')][_0x4d91('0x49')](_0x7a94e2[_0x4d91('0x4a')],{'include':[{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x56')},{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x57')}]});}return null;})[_0x4d91('0x29')](respondWithResult(_0x42e550,null))[_0x4d91('0x45')](handleError(_0x42e550,null));};exports['getFields']=function(_0x4062c6,_0x1be4b1,_0xc4ef10){var _0x2e2105='';return db[_0x4d91('0x30')]['findOne']({'where':{'id':_0x4062c6[_0x4d91('0x47')]['id']},'attributes':['id',_0x4d91('0x5b'),'password',_0x4d91('0x5c'),_0x4d91('0x5d'),_0x4d91('0x5e')]})[_0x4d91('0x29')](handleEntityNotFound(_0x1be4b1,null))[_0x4d91('0x29')](function(_0x4bc5a0){if(_0x4bc5a0){_0x2e2105=_0x4bc5a0[_0x4d91('0x5e')];var _0x2a5bc0=_0x2e2105['slice'](-0x1);if(_0x2a5bc0==='/'){_0x2e2105=_0x2e2105[_0x4d91('0x5f')](0x0,_0x2e2105[_0x4d91('0x60')](_0x2a5bc0));}var _0xd94b29={'method':'GET','uri':util[_0x4d91('0x61')](_0x4d91('0x62'),_0x2e2105,_0x4d91('0x63')),'json':!![]};switch(_0x4bc5a0[_0x4d91('0x5d')]){case _0x4d91('0x64'):_0xd94b29[_0x4d91('0x65')]={'Authorization':util[_0x4d91('0x61')]('Basic\x20%s',new Buffer(util[_0x4d91('0x61')](_0x4d91('0x66'),_0x4bc5a0['username'],_0x4bc5a0[_0x4d91('0x64')]))['toString']('base64'))};break;case _0x4d91('0x5c'):_0xd94b29['headers']={'Authorization':util[_0x4d91('0x61')](_0x4d91('0x67'),new Buffer(util[_0x4d91('0x61')](_0x4d91('0x68'),_0x4bc5a0[_0x4d91('0x5b')],_0x4bc5a0[_0x4d91('0x5c')]))[_0x4d91('0x69')]('base64'))};break;default:throw new db['Sequelize'][(_0x4d91('0x6a'))](_0x4d91('0x6b'));}return rp(_0xd94b29);}})[_0x4d91('0x29')](function(_0x42164f){if(_0x42164f){var _0x1e3838=['subject','description',_0x4d91('0x6c'),'assignee'];_['remove'](_0x42164f[_0x4d91('0x63')],function(_0x54fea8){return _0x1e3838['includes'](_0x54fea8[_0x4d91('0x33')]);});return{'count':_0x42164f[_0x4d91('0x63')][_0x4d91('0x3b')],'rows':_['map'](_0x42164f['ticket_fields'],function(_0x52604d){return{'id':_0x52604d['id'],'name':_0x52604d[_0x4d91('0x6d')]>0x7?_0x52604d[_0x4d91('0x6e')]:_0x52604d[_0x4d91('0x33')],'custom':_0x52604d[_0x4d91('0x6d')]>0x7?!![]:![],'options':_0x52604d[_0x4d91('0x6f')]?_0x52604d[_0x4d91('0x6f')]:_0x52604d[_0x4d91('0x70')]?_0x52604d[_0x4d91('0x70')]:[]};})};}})[_0x4d91('0x29')](respondWithResult(_0x1be4b1,null))['catch'](function(_0xb9d1ff){var _0x579a9e=_0x4062c6['query'][_0x4d91('0x71')]?0x1f4:_0xb9d1ff[_0x4d91('0x72')]||0x1f4;logger[_0x4d91('0x2b')](_0x4d91('0x73'),'getFields',_0x579a9e,JSON[_0x4d91('0x74')](_0xb9d1ff));delete _0xb9d1ff[_0x4d91('0x2d')];if(_0x579a9e===0x191){_0x579a9e=0x190;}_0x1be4b1[_0x4d91('0x1d')](_0x579a9e)[_0x4d91('0x2e')](_0x4062c6[_0x4d91('0x36')][_0x4d91('0x71')]?{'message':_0x4d91('0x75'),'statusCode':_0xb9d1ff['statusCode']}:_0xb9d1ff);});}; \ No newline at end of file +var _0xbaf0=['findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','ZendeskConfiguration','pick','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','%s:%s','toString','headers','%s/token:%s','base64','Sequelize','ValidationError','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','includeAll','include'];(function(_0x8153ce,_0xcb6429){var _0x3294bc=function(_0x52382f){while(--_0x52382f){_0x8153ce['push'](_0x8153ce['shift']());}};_0x3294bc(++_0xcb6429);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0baf('0x1b'));function respondWithStatusCode(_0xe4378c,_0x5db689){_0x5db689=_0x5db689||0xcc;return function(_0x13df17){if(_0x13df17){return _0xe4378c['sendStatus'](_0x5db689);}return _0xe4378c[_0x0baf('0x1c')](_0x5db689)['end']();};}function respondWithResult(_0x1c76a8,_0x1f50c3){_0x1f50c3=_0x1f50c3||0xc8;return function(_0x7fbf67){if(_0x7fbf67){return _0x1c76a8[_0x0baf('0x1c')](_0x1f50c3)[_0x0baf('0x1d')](_0x7fbf67);}};}function respondWithFilteredResult(_0x469599,_0x4f80a8){return function(_0x4cd79d){if(_0x4cd79d){var _0x2312c7=typeof _0x4f80a8[_0x0baf('0x1e')]===_0x0baf('0x1f')&&typeof _0x4f80a8[_0x0baf('0x20')]===_0x0baf('0x1f');var _0x288a98=_0x4cd79d['count'];var _0x63c820=_0x2312c7?0x0:_0x4f80a8[_0x0baf('0x1e')];var _0x1ef0e5=_0x2312c7?_0x4cd79d[_0x0baf('0x21')]:_0x4f80a8[_0x0baf('0x1e')]+_0x4f80a8[_0x0baf('0x20')];var _0x4ff793;if(_0x1ef0e5>=_0x288a98){_0x1ef0e5=_0x288a98;_0x4ff793=0xc8;}else{_0x4ff793=0xce;}_0x469599['status'](_0x4ff793);return _0x469599[_0x0baf('0x22')](_0x0baf('0x23'),_0x63c820+'-'+_0x1ef0e5+'/'+_0x288a98)[_0x0baf('0x1d')](_0x4cd79d);}return null;};}function patchUpdates(_0x1848e8){return function(_0x1fa92b){try{jsonpatch[_0x0baf('0x24')](_0x1fa92b,_0x1848e8,!![]);}catch(_0x210cd8){return BPromise[_0x0baf('0x25')](_0x210cd8);}return _0x1fa92b[_0x0baf('0x26')]();};}function saveUpdates(_0x15a2c3,_0x54f2fa){return function(_0x334bd6){if(_0x334bd6){return _0x334bd6['update'](_0x15a2c3)[_0x0baf('0x27')](function(_0x5dbf00){return _0x5dbf00;});}return null;};}function removeEntity(_0x4de74c,_0x2ef0aa){return function(_0x48a0e9){if(_0x48a0e9){return _0x48a0e9['destroy']()[_0x0baf('0x27')](function(){_0x4de74c[_0x0baf('0x1c')](0xcc)[_0x0baf('0x28')]();});}};}function handleEntityNotFound(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(!_0x56b299){_0x19d9fd[_0x0baf('0x29')](0x194);}return _0x56b299;};}function handleError(_0x4681c5,_0x1ca35a){_0x1ca35a=_0x1ca35a||0x1f4;return function(_0x366e71){logger[_0x0baf('0x2a')](_0x366e71[_0x0baf('0x2b')]);if(_0x366e71[_0x0baf('0x2c')]){delete _0x366e71['name'];}_0x4681c5[_0x0baf('0x1c')](_0x1ca35a)[_0x0baf('0x2d')](_0x366e71);};}exports[_0x0baf('0x2e')]=function(_0x265915,_0x55c715){var _0x29dbdf={},_0x34a58a={},_0x5d9d7f={'count':0x0,'rows':[]};var _0x44ec31=_[_0x0baf('0x2f')](db[_0x0baf('0x30')][_0x0baf('0x31')],function(_0xd14f0f){return{'name':_0xd14f0f[_0x0baf('0x32')],'type':_0xd14f0f[_0x0baf('0x33')]['key']};});_0x34a58a[_0x0baf('0x34')]=_[_0x0baf('0x2f')](_0x44ec31,_0x0baf('0x2c'));_0x34a58a[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x265915[_0x0baf('0x35')]);_0x34a58a[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x34a58a[_0x0baf('0x34')],_0x34a58a[_0x0baf('0x35')]);_0x29dbdf[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x34a58a[_0x0baf('0x34')],qs[_0x0baf('0x3a')](_0x265915['query'][_0x0baf('0x3a')]));_0x29dbdf['attributes']=_0x29dbdf[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x29dbdf[_0x0baf('0x39')]:_0x34a58a[_0x0baf('0x34')];if(!_0x265915['query'][_0x0baf('0x3c')](_0x0baf('0x3d'))){_0x29dbdf['limit']=qs[_0x0baf('0x20')](_0x265915[_0x0baf('0x35')][_0x0baf('0x20')]);_0x29dbdf[_0x0baf('0x1e')]=qs[_0x0baf('0x1e')](_0x265915[_0x0baf('0x35')][_0x0baf('0x1e')]);}_0x29dbdf[_0x0baf('0x3e')]=qs['sort'](_0x265915[_0x0baf('0x35')][_0x0baf('0x3f')]);_0x29dbdf['where']=qs[_0x0baf('0x37')](_['pick'](_0x265915['query'],_0x34a58a[_0x0baf('0x37')]),_0x44ec31);if(_0x265915[_0x0baf('0x35')]['filter']){_0x29dbdf['where']=_[_0x0baf('0x40')](_0x29dbdf[_0x0baf('0x41')],{'$or':_[_0x0baf('0x2f')](_0x44ec31,function(_0xb2d9ab){if(_0xb2d9ab[_0x0baf('0x33')]!==_0x0baf('0x42')){var _0x290464={};_0x290464[_0xb2d9ab[_0x0baf('0x2c')]]={'$like':'%'+_0x265915[_0x0baf('0x35')][_0x0baf('0x43')]+'%'};return _0x290464;}})});}_0x29dbdf=_[_0x0baf('0x40')]({},_0x29dbdf,_0x265915[_0x0baf('0x44')]);var _0x354cb1={'where':_0x29dbdf[_0x0baf('0x41')]};return db['ZendeskAccount'][_0x0baf('0x21')](_0x354cb1)[_0x0baf('0x27')](function(_0x4f1de9){_0x5d9d7f[_0x0baf('0x21')]=_0x4f1de9;if(_0x265915[_0x0baf('0x35')][_0x0baf('0x45')]){_0x29dbdf[_0x0baf('0x46')]=[{'all':!![]}];}return db[_0x0baf('0x30')][_0x0baf('0x47')](_0x29dbdf);})['then'](function(_0x23ad34){_0x5d9d7f[_0x0baf('0x48')]=_0x23ad34;return _0x5d9d7f;})['then'](respondWithFilteredResult(_0x55c715,_0x29dbdf))[_0x0baf('0x49')](handleError(_0x55c715,null));};exports[_0x0baf('0x4a')]=function(_0x45c6aa,_0x57903e){var _0x504031={'raw':![],'where':{'id':_0x45c6aa[_0x0baf('0x4b')]['id']}},_0x193fd3={};_0x193fd3[_0x0baf('0x34')]=_[_0x0baf('0x36')](db[_0x0baf('0x30')][_0x0baf('0x31')]);_0x193fd3[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x45c6aa[_0x0baf('0x35')]);_0x193fd3[_0x0baf('0x37')]=_['intersection'](_0x193fd3[_0x0baf('0x34')],_0x193fd3[_0x0baf('0x35')]);_0x504031[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x193fd3[_0x0baf('0x34')],qs['fields'](_0x45c6aa[_0x0baf('0x35')][_0x0baf('0x3a')]));_0x504031[_0x0baf('0x39')]=_0x504031[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x504031['attributes']:_0x193fd3[_0x0baf('0x34')];if(_0x45c6aa[_0x0baf('0x35')][_0x0baf('0x45')]){_0x504031[_0x0baf('0x46')]=[{'all':!![]}];}_0x504031=_[_0x0baf('0x40')]({},_0x504031,_0x45c6aa[_0x0baf('0x44')]);return db[_0x0baf('0x30')]['find'](_0x504031)[_0x0baf('0x27')](handleEntityNotFound(_0x57903e,null))[_0x0baf('0x27')](respondWithResult(_0x57903e,null))[_0x0baf('0x49')](handleError(_0x57903e,null));};exports['create']=function(_0x3c9de3,_0x2222b6){return db[_0x0baf('0x30')][_0x0baf('0x4c')](_0x3c9de3[_0x0baf('0x4d')],{})[_0x0baf('0x27')](respondWithResult(_0x2222b6,0xc9))[_0x0baf('0x49')](handleError(_0x2222b6,null));};exports['update']=function(_0x22c451,_0x428c9b){if(_0x22c451[_0x0baf('0x4d')]['id']){delete _0x22c451[_0x0baf('0x4d')]['id'];}return db[_0x0baf('0x30')][_0x0baf('0x4e')]({'where':{'id':_0x22c451[_0x0baf('0x4b')]['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0x428c9b,null))[_0x0baf('0x27')](saveUpdates(_0x22c451[_0x0baf('0x4d')],null))[_0x0baf('0x27')](respondWithResult(_0x428c9b,null))['catch'](handleError(_0x428c9b,null));};exports['destroy']=function(_0x354329,_0x3d6b19){return db[_0x0baf('0x30')][_0x0baf('0x4e')]({'where':{'id':_0x354329[_0x0baf('0x4b')]['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0x3d6b19,null))[_0x0baf('0x27')](removeEntity(_0x3d6b19,null))['catch'](handleError(_0x3d6b19,null));};exports[_0x0baf('0x4f')]=function(_0x2ef4c1,_0xf2424,_0x16d9fb){var _0x3fdb41={};var _0x1e2671={};var _0x5e1849;var _0x3eebe5;return db['ZendeskAccount'][_0x0baf('0x50')]({'where':{'id':_0x2ef4c1['params']['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0xf2424,null))['then'](function(_0x35b1a5){if(_0x35b1a5){_0x5e1849=_0x35b1a5;_0x1e2671['model']=_[_0x0baf('0x36')](db[_0x0baf('0x51')][_0x0baf('0x31')]);_0x1e2671[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x2ef4c1['query']);_0x1e2671[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x1e2671[_0x0baf('0x34')],_0x1e2671[_0x0baf('0x35')]);_0x3fdb41[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x1e2671['model'],qs[_0x0baf('0x3a')](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x3a')]));_0x3fdb41[_0x0baf('0x39')]=_0x3fdb41[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x3fdb41[_0x0baf('0x39')]:_0x1e2671['model'];_0x3fdb41['order']=qs[_0x0baf('0x3f')](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x3f')]);_0x3fdb41[_0x0baf('0x41')]=qs[_0x0baf('0x37')](_[_0x0baf('0x52')](_0x2ef4c1[_0x0baf('0x35')],_0x1e2671[_0x0baf('0x37')]));if(_0x2ef4c1[_0x0baf('0x35')]['filter']){_0x3fdb41[_0x0baf('0x41')]=_[_0x0baf('0x40')](_0x3fdb41[_0x0baf('0x41')],{'$or':_[_0x0baf('0x2f')](_0x3fdb41[_0x0baf('0x39')],function(_0xebfc0c){var _0x26f5c9={};_0x26f5c9[_0xebfc0c]={'$like':'%'+_0x2ef4c1['query'][_0x0baf('0x43')]+'%'};return _0x26f5c9;})});}_0x3fdb41=_[_0x0baf('0x40')]({},_0x3fdb41,_0x2ef4c1[_0x0baf('0x44')]);return _0x5e1849[_0x0baf('0x4f')](_0x3fdb41);}})[_0x0baf('0x27')](function(_0x1a6d22){if(_0x1a6d22){_0x3eebe5=_0x1a6d22[_0x0baf('0x3b')];if(!_0x2ef4c1[_0x0baf('0x35')]['hasOwnProperty'](_0x0baf('0x3d'))){_0x3fdb41['limit']=qs[_0x0baf('0x20')](_0x2ef4c1['query']['limit']);_0x3fdb41[_0x0baf('0x1e')]=qs['offset'](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x1e')]);}return _0x5e1849['getConfigurations'](_0x3fdb41);}})[_0x0baf('0x27')](function(_0xfb6708){if(_0xfb6708){return _0xfb6708?{'count':_0x3eebe5,'rows':_0xfb6708}:null;}})[_0x0baf('0x27')](respondWithResult(_0xf2424,null))['catch'](handleError(_0xf2424,null));};exports['addConfiguration']=function(_0x2438df,_0x7e8946,_0x6d789f){if(_0x2438df[_0x0baf('0x4d')]['id']){delete _0x2438df[_0x0baf('0x4d')]['id'];}return db['ZendeskAccount'][_0x0baf('0x50')]({'where':{'id':_0x2438df['params']['id']}})['then'](handleEntityNotFound(_0x7e8946,null))['then'](function(_0x427ed1){if(_0x427ed1){_0x2438df['body']['AccountId']=_0x427ed1['id'];_0x2438df[_0x0baf('0x4d')][_0x0baf('0x53')]=integrations[_0x0baf('0x54')](_0x2438df[_0x0baf('0x4d')][_0x0baf('0x55')],_0x2438df[_0x0baf('0x4d')]['type']);_0x2438df[_0x0baf('0x4d')][_0x0baf('0x56')]=integrations[_0x0baf('0x57')](_0x2438df[_0x0baf('0x4d')][_0x0baf('0x55')],_0x2438df[_0x0baf('0x4d')]['type']);return db[_0x0baf('0x51')][_0x0baf('0x4c')](_0x2438df[_0x0baf('0x4d')],{'include':[{'model':db['ZendeskField'],'as':_0x0baf('0x53')},{'model':db[_0x0baf('0x58')],'as':_0x0baf('0x56')}]});}return null;})[_0x0baf('0x27')](respondWithResult(_0x7e8946,null))[_0x0baf('0x49')](handleError(_0x7e8946,null));};exports[_0x0baf('0x59')]=function(_0x4cc046,_0x5874cc,_0x54353a){var _0x4b7caa='';return db[_0x0baf('0x30')][_0x0baf('0x50')]({'where':{'id':_0x4cc046[_0x0baf('0x4b')]['id']},'attributes':['id',_0x0baf('0x5a'),_0x0baf('0x5b'),_0x0baf('0x5c'),'authType','remoteUri']})[_0x0baf('0x27')](handleEntityNotFound(_0x5874cc,null))['then'](function(_0x22cd07){if(_0x22cd07){_0x4b7caa=_0x22cd07[_0x0baf('0x5d')];var _0x4cca39=_0x4b7caa[_0x0baf('0x5e')](-0x1);if(_0x4cca39==='/'){_0x4b7caa=_0x4b7caa[_0x0baf('0x5f')](0x0,_0x4b7caa[_0x0baf('0x60')](_0x4cca39));}var _0xb1d719={'method':_0x0baf('0x61'),'uri':util[_0x0baf('0x62')](_0x0baf('0x63'),_0x4b7caa,_0x0baf('0x64')),'json':!![]};switch(_0x22cd07[_0x0baf('0x65')]){case'password':_0xb1d719['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x0baf('0x66'),_0x22cd07[_0x0baf('0x5a')],_0x22cd07[_0x0baf('0x5b')]))[_0x0baf('0x67')]('base64'))};break;case _0x0baf('0x5c'):_0xb1d719[_0x0baf('0x68')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x0baf('0x62')](_0x0baf('0x69'),_0x22cd07[_0x0baf('0x5a')],_0x22cd07[_0x0baf('0x5c')]))[_0x0baf('0x67')](_0x0baf('0x6a')))};break;default:throw new db[(_0x0baf('0x6b'))][(_0x0baf('0x6c'))]('Unknown\x20authentication\x20type');}return rp(_0xb1d719);}})[_0x0baf('0x27')](function(_0x1a3b7b){if(_0x1a3b7b){var _0x560c0f=[_0x0baf('0x6d'),_0x0baf('0x6e'),'group',_0x0baf('0x6f')];_[_0x0baf('0x70')](_0x1a3b7b[_0x0baf('0x64')],function(_0x2baede){return _0x560c0f[_0x0baf('0x71')](_0x2baede['type']);});return{'count':_0x1a3b7b['ticket_fields'][_0x0baf('0x3b')],'rows':_[_0x0baf('0x2f')](_0x1a3b7b['ticket_fields'],function(_0x28bc1c){return{'id':_0x28bc1c['id'],'name':_0x28bc1c[_0x0baf('0x72')]>0x7?_0x28bc1c[_0x0baf('0x73')]:_0x28bc1c['type'],'custom':_0x28bc1c[_0x0baf('0x72')]>0x7?!![]:![],'options':_0x28bc1c[_0x0baf('0x74')]?_0x28bc1c[_0x0baf('0x74')]:_0x28bc1c['custom_field_options']?_0x28bc1c[_0x0baf('0x75')]:[]};})};}})['then'](respondWithResult(_0x5874cc,null))[_0x0baf('0x49')](function(_0x3fee46){var _0x3fd039=_0x4cc046[_0x0baf('0x35')][_0x0baf('0x76')]?0x1f4:_0x3fee46['statusCode']||0x1f4;logger[_0x0baf('0x2a')](_0x0baf('0x77'),'getFields',_0x3fd039,JSON[_0x0baf('0x78')](_0x3fee46));delete _0x3fee46[_0x0baf('0x2c')];if(_0x3fd039===0x191){_0x3fd039=0x190;}_0x5874cc[_0x0baf('0x1c')](_0x3fd039)[_0x0baf('0x2d')](_0x4cc046[_0x0baf('0x35')][_0x0baf('0x76')]?{'message':_0x0baf('0x79'),'statusCode':_0x3fee46[_0x0baf('0x7a')]}:_0x3fee46);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e75255a..7e27335 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 _0xdca4=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','moment','bluebird','path','rimraf'];(function(_0x5d8668,_0x4ce2d2){var _0x424a4a=function(_0x1951a8){while(--_0x1951a8){_0x5d8668['push'](_0x5d8668['shift']());}};_0x424a4a(++_0x4ce2d2);}(_0xdca4,0x19e));var _0x4dca=function(_0x2ac3ab,_0x226477){_0x2ac3ab=_0x2ac3ab-0x0;var _0x52d68c=_0xdca4[_0x2ac3ab];return _0x52d68c;};'use strict';var _=require(_0x4dca('0x0'));var util=require(_0x4dca('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4dca('0x2'));var BPromise=require(_0x4dca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dca('0x4'));var rimraf=require(_0x4dca('0x5'));var config=require(_0x4dca('0x6'));var attributes=require(_0x4dca('0x7'));var integrations=require(_0x4dca('0x8'));module[_0x4dca('0x9')]=function(_0x59bdda,_0x21d674){return _0x59bdda[_0x4dca('0xa')]('ZendeskAccount',attributes,{'tableName':_0x4dca('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d6d=['api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','util','../../config/logger'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x2d6d,0x76));var _0xd2d6=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x2d6d[_0x40ac5e];return _0x2839d6;};'use strict';var _=require('lodash');var util=require(_0xd2d6('0x0'));var logger=require(_0xd2d6('0x1'))(_0xd2d6('0x2'));var moment=require(_0xd2d6('0x3'));var BPromise=require(_0xd2d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2d6('0x5'));var rimraf=require(_0xd2d6('0x6'));var config=require(_0xd2d6('0x7'));var attributes=require(_0xd2d6('0x8'));var integrations=require(_0xd2d6('0x9'));module['exports']=function(_0x421e83,_0x26dbb3){return _0x421e83[_0xd2d6('0xa')](_0xd2d6('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 07ad9ae..fbddf25 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 _0xb5f1=['include','map','model','ShowZendeskAccount','find','then','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb5f1,0x141));var _0x1b5f=function(_0x895898,_0x28a586){_0x895898=_0x895898-0x0;var _0x4758c0=_0xb5f1[_0x895898];return _0x4758c0;};'use strict';var _=require(_0x1b5f('0x0'));var util=require('util');var moment=require(_0x1b5f('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b5f('0x2'));var fs=require('fs');var Redis=require(_0x1b5f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b5f('0x4'));var logger=require(_0x1b5f('0x5'))(_0x1b5f('0x6'));var config=require(_0x1b5f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x267d68,_0x111fa1,_0xc35856){return new BPromise(function(_0x37dc78,_0x242672){return client[_0x1b5f('0x9')](_0x267d68,_0xc35856)['then'](function(_0xcf1cd1){logger[_0x1b5f('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x111fa1,_0x1b5f('0xb'));logger[_0x1b5f('0xc')](_0x1b5f('0xd'),_0x111fa1,'request\x20sent',JSON[_0x1b5f('0xe')](_0xcf1cd1));if(_0xcf1cd1[_0x1b5f('0xf')]){if(_0xcf1cd1[_0x1b5f('0xf')][_0x1b5f('0x10')]===0x1f4){logger[_0x1b5f('0xf')](_0x1b5f('0x11'),_0x111fa1,_0xcf1cd1[_0x1b5f('0xf')]['message']);return _0x242672(_0xcf1cd1[_0x1b5f('0xf')][_0x1b5f('0x12')]);}logger['error'](_0x1b5f('0x11'),_0x111fa1,_0xcf1cd1[_0x1b5f('0xf')][_0x1b5f('0x12')]);return _0x37dc78(_0xcf1cd1[_0x1b5f('0xf')]['message']);}else{logger[_0x1b5f('0xa')](_0x1b5f('0x11'),_0x111fa1,_0x1b5f('0xb'));_0x37dc78(_0xcf1cd1[_0x1b5f('0x13')]['message']);}})[_0x1b5f('0x14')](function(_0x4f653b){logger[_0x1b5f('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x111fa1,_0x4f653b);_0x242672(_0x4f653b);});});}exports[_0x1b5f('0x15')]=function(_0x2beeca){var _0x14bc75=this;return new Promise(function(_0x38c3a7,_0x53d25c){return db[_0x1b5f('0x16')][_0x1b5f('0x17')]({'raw':_0x2beeca[_0x1b5f('0x18')]?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x19')]===undefined?!![]:![]:!![],'where':_0x2beeca['options']?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x1a')]||null:null,'attributes':_0x2beeca['options']?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x1b')]||null:null,'limit':_0x2beeca[_0x1b5f('0x18')]?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x1c')]||null:null,'include':_0x2beeca[_0x1b5f('0x18')]?_0x2beeca[_0x1b5f('0x18')][_0x1b5f('0x1d')]?_[_0x1b5f('0x1e')](_0x2beeca['options'][_0x1b5f('0x1d')],function(_0x13c8db){return{'model':db[_0x13c8db['model']],'as':_0x13c8db['as'],'attributes':_0x13c8db['attributes'],'include':_0x13c8db['include']?_[_0x1b5f('0x1e')](_0x13c8db[_0x1b5f('0x1d')],function(_0x467d08){return{'model':db[_0x467d08[_0x1b5f('0x1f')]],'as':_0x467d08['as'],'attributes':_0x467d08[_0x1b5f('0x1b')],'include':_0x467d08['include']?_[_0x1b5f('0x1e')](_0x467d08[_0x1b5f('0x1d')],function(_0x39ede5){return{'model':db[_0x39ede5['model']],'as':_0x39ede5['as'],'attributes':_0x39ede5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49a29d){logger[_0x1b5f('0xa')](_0x1b5f('0x15'),_0x2beeca);logger[_0x1b5f('0xc')](_0x1b5f('0x15'),_0x2beeca,JSON[_0x1b5f('0xe')](_0x49a29d));_0x38c3a7(_0x49a29d);})['catch'](function(_0x1c0ee7){logger[_0x1b5f('0xf')](_0x1b5f('0x15'),_0x1c0ee7[_0x1b5f('0x12')],_0x2beeca);_0x53d25c(_0x14bc75[_0x1b5f('0xf')](0x1f4,_0x1c0ee7['message']));});});};exports[_0x1b5f('0x20')]=function(_0x2fcdd4){var _0x560e61=this;return new Promise(function(_0x465e7c,_0x1167c3){return db[_0x1b5f('0x16')][_0x1b5f('0x21')]({'raw':_0x2fcdd4[_0x1b5f('0x18')]?_0x2fcdd4['options']['raw']===undefined?!![]:![]:!![],'where':_0x2fcdd4[_0x1b5f('0x18')]?_0x2fcdd4['options'][_0x1b5f('0x1a')]||null:null,'attributes':_0x2fcdd4[_0x1b5f('0x18')]?_0x2fcdd4['options'][_0x1b5f('0x1b')]||null:null,'include':_0x2fcdd4[_0x1b5f('0x18')]?_0x2fcdd4[_0x1b5f('0x18')][_0x1b5f('0x1d')]?_['map'](_0x2fcdd4[_0x1b5f('0x18')][_0x1b5f('0x1d')],function(_0x56b2d3){return{'model':db[_0x56b2d3[_0x1b5f('0x1f')]],'as':_0x56b2d3['as'],'attributes':_0x56b2d3[_0x1b5f('0x1b')],'include':_0x56b2d3[_0x1b5f('0x1d')]?_[_0x1b5f('0x1e')](_0x56b2d3[_0x1b5f('0x1d')],function(_0x28123b){return{'model':db[_0x28123b[_0x1b5f('0x1f')]],'as':_0x28123b['as'],'attributes':_0x28123b[_0x1b5f('0x1b')],'include':_0x28123b[_0x1b5f('0x1d')]?_['map'](_0x28123b[_0x1b5f('0x1d')],function(_0x3aea88){return{'model':db[_0x3aea88[_0x1b5f('0x1f')]],'as':_0x3aea88['as'],'attributes':_0x3aea88[_0x1b5f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1b5f('0x22')](function(_0x2a4aaf){logger[_0x1b5f('0xa')](_0x1b5f('0x20'),_0x2fcdd4);logger[_0x1b5f('0xc')]('ShowZendeskAccount',_0x2fcdd4,JSON[_0x1b5f('0xe')](_0x2a4aaf));_0x465e7c(_0x2a4aaf);})['catch'](function(_0x4fa234){logger['error'](_0x1b5f('0x20'),_0x4fa234[_0x1b5f('0x12')],_0x2fcdd4);_0x1167c3(_0x560e61[_0x1b5f('0xf')](0x1f4,_0x4fa234[_0x1b5f('0x12')]));});});}; \ No newline at end of file +var _0x9e90=['find','ShowZendeskAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','request','info','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZendeskAccount,\x20%s,\x20%s','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug'];(function(_0x1746a6,_0x3f66ea){var _0x54b4b9=function(_0x40f2ac){while(--_0x40f2ac){_0x1746a6['push'](_0x1746a6['shift']());}};_0x54b4b9(++_0x3f66ea);}(_0x9e90,0x1a2));var _0x09e9=function(_0x291fae,_0x16144f){_0x291fae=_0x291fae-0x0;var _0x938ce8=_0x9e90[_0x291fae];return _0x938ce8;};'use strict';var _=require(_0x09e9('0x0'));var util=require(_0x09e9('0x1'));var moment=require(_0x09e9('0x2'));var BPromise=require('bluebird');var rs=require(_0x09e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09e9('0x4'))['db'];var utils=require(_0x09e9('0x5'));var logger=require(_0x09e9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x09e9('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x817276,_0x1f8cb3,_0x4f3373){return new BPromise(function(_0x5992cd,_0x4c3c1c){return client[_0x09e9('0x8')](_0x817276,_0x4f3373)['then'](function(_0x426f46){logger[_0x09e9('0x9')]('ZendeskAccount,\x20%s,\x20%s',_0x1f8cb3,'request\x20sent');logger['debug'](_0x09e9('0xa'),_0x1f8cb3,_0x09e9('0xb'),JSON[_0x09e9('0xc')](_0x426f46));if(_0x426f46[_0x09e9('0xd')]){if(_0x426f46[_0x09e9('0xd')]['code']===0x1f4){logger[_0x09e9('0xd')](_0x09e9('0xe'),_0x1f8cb3,_0x426f46[_0x09e9('0xd')][_0x09e9('0xf')]);return _0x4c3c1c(_0x426f46['error'][_0x09e9('0xf')]);}logger['error'](_0x09e9('0xe'),_0x1f8cb3,_0x426f46['error'][_0x09e9('0xf')]);return _0x5992cd(_0x426f46['error'][_0x09e9('0xf')]);}else{logger[_0x09e9('0x9')](_0x09e9('0xe'),_0x1f8cb3,_0x09e9('0xb'));_0x5992cd(_0x426f46['result'][_0x09e9('0xf')]);}})[_0x09e9('0x10')](function(_0x4ffd12){logger[_0x09e9('0xd')](_0x09e9('0xe'),_0x1f8cb3,_0x4ffd12);_0x4c3c1c(_0x4ffd12);});});}exports[_0x09e9('0x11')]=function(_0x6ea391){var _0x20409a=this;return new Promise(function(_0x43a3f9,_0x5c40e5){return db[_0x09e9('0x12')][_0x09e9('0x13')]({'raw':_0x6ea391['options']?_0x6ea391[_0x09e9('0x14')][_0x09e9('0x15')]===undefined?!![]:![]:!![],'where':_0x6ea391[_0x09e9('0x14')]?_0x6ea391[_0x09e9('0x14')][_0x09e9('0x16')]||null:null,'attributes':_0x6ea391[_0x09e9('0x14')]?_0x6ea391[_0x09e9('0x14')][_0x09e9('0x17')]||null:null,'limit':_0x6ea391['options']?_0x6ea391['options'][_0x09e9('0x18')]||null:null,'include':_0x6ea391[_0x09e9('0x14')]?_0x6ea391[_0x09e9('0x14')][_0x09e9('0x19')]?_[_0x09e9('0x1a')](_0x6ea391[_0x09e9('0x14')][_0x09e9('0x19')],function(_0x48c82c){return{'model':db[_0x48c82c[_0x09e9('0x1b')]],'as':_0x48c82c['as'],'attributes':_0x48c82c[_0x09e9('0x17')],'include':_0x48c82c[_0x09e9('0x19')]?_[_0x09e9('0x1a')](_0x48c82c[_0x09e9('0x19')],function(_0x173c52){return{'model':db[_0x173c52[_0x09e9('0x1b')]],'as':_0x173c52['as'],'attributes':_0x173c52['attributes'],'include':_0x173c52['include']?_[_0x09e9('0x1a')](_0x173c52['include'],function(_0x427f59){return{'model':db[_0x427f59['model']],'as':_0x427f59['as'],'attributes':_0x427f59[_0x09e9('0x17')]};}):[]};}):[]};}):[]:[]})[_0x09e9('0x1c')](function(_0x5d06f0){logger[_0x09e9('0x9')](_0x09e9('0x11'),_0x6ea391);logger[_0x09e9('0x1d')]('GetZendeskAccount',_0x6ea391,JSON['stringify'](_0x5d06f0));_0x43a3f9(_0x5d06f0);})[_0x09e9('0x10')](function(_0x5675a1){logger[_0x09e9('0xd')](_0x09e9('0x11'),_0x5675a1['message'],_0x6ea391);_0x5c40e5(_0x20409a[_0x09e9('0xd')](0x1f4,_0x5675a1[_0x09e9('0xf')]));});});};exports['ShowZendeskAccount']=function(_0x357fb0){var _0x2ff2f3=this;return new Promise(function(_0x496d5e,_0x5e8879){return db[_0x09e9('0x12')][_0x09e9('0x1e')]({'raw':_0x357fb0['options']?_0x357fb0[_0x09e9('0x14')][_0x09e9('0x15')]===undefined?!![]:![]:!![],'where':_0x357fb0[_0x09e9('0x14')]?_0x357fb0['options'][_0x09e9('0x16')]||null:null,'attributes':_0x357fb0[_0x09e9('0x14')]?_0x357fb0[_0x09e9('0x14')][_0x09e9('0x17')]||null:null,'include':_0x357fb0['options']?_0x357fb0[_0x09e9('0x14')][_0x09e9('0x19')]?_['map'](_0x357fb0[_0x09e9('0x14')]['include'],function(_0x39e04d){return{'model':db[_0x39e04d[_0x09e9('0x1b')]],'as':_0x39e04d['as'],'attributes':_0x39e04d[_0x09e9('0x17')],'include':_0x39e04d[_0x09e9('0x19')]?_['map'](_0x39e04d['include'],function(_0x1b29a8){return{'model':db[_0x1b29a8[_0x09e9('0x1b')]],'as':_0x1b29a8['as'],'attributes':_0x1b29a8[_0x09e9('0x17')],'include':_0x1b29a8[_0x09e9('0x19')]?_[_0x09e9('0x1a')](_0x1b29a8['include'],function(_0x4fee03){return{'model':db[_0x4fee03[_0x09e9('0x1b')]],'as':_0x4fee03['as'],'attributes':_0x4fee03['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4800b1){logger[_0x09e9('0x9')]('ShowZendeskAccount',_0x357fb0);logger[_0x09e9('0x1d')](_0x09e9('0x1f'),_0x357fb0,JSON[_0x09e9('0xc')](_0x4800b1));_0x496d5e(_0x4800b1);})[_0x09e9('0x10')](function(_0x2f6504){logger[_0x09e9('0xd')](_0x09e9('0x1f'),_0x2f6504[_0x09e9('0xf')],_0x357fb0);_0x5e8879(_0x2ff2f3['error'](0x1f4,_0x2f6504['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7dfe812..01455e2 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 _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x5f0aa9,_0x20a53c){var _0x243d98=function(_0x352c23){while(--_0x352c23){_0x5f0aa9['push'](_0x5f0aa9['shift']());}};_0x243d98(++_0x20a53c);}(_0x91a7,0xe7));var _0x791a=function(_0x317822,_0xba3222){_0x317822=_0x317822-0x0;var _0x59e915=_0x91a7[_0x317822];return _0x59e915;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file +var _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('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 e7b63f9..94bd6dc 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 _0xbae3=['STRING','sequelize','exports'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xbae3,0xee));var _0x3bae=function(_0x25dd5e,_0x540d50){_0x25dd5e=_0x25dd5e-0x0;var _0x8e60e5=_0xbae3[_0x25dd5e];return _0x8e60e5;};'use strict';var Sequelize=require(_0x3bae('0x0'));module[_0x3bae('0x1')]={'name':{'type':Sequelize[_0x3bae('0x2')]},'description':{'type':Sequelize[_0x3bae('0x2')]}}; \ No newline at end of file +var _0x3714=['sequelize','exports'];(function(_0x303596,_0x2ab891){var _0x2e259b=function(_0x1aaa9a){while(--_0x1aaa9a){_0x303596['push'](_0x303596['shift']());}};_0x2e259b(++_0x2ab891);}(_0x3714,0x126));var _0x4371=function(_0x733e8b,_0x13b35e){_0x733e8b=_0x733e8b-0x0;var _0x5e3b6d=_0x3714[_0x733e8b];return _0x5e3b6d;};'use strict';var Sequelize=require(_0x4371('0x0'));module[_0x4371('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d06c72d..e3fcff0 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 _0xc009=['getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskConfiguration','include','catch','show','rawAttributes','includeAll','find','create','body','params','getFields','findOne','ZendeskField','order','hasOwnProperty','getSubjects'];(function(_0x15523b,_0x388fe6){var _0x409eed=function(_0x2e79c4){while(--_0x2e79c4){_0x15523b['push'](_0x15523b['shift']());}};_0x409eed(++_0x388fe6);}(_0xc009,0x1a2));var _0x9c00=function(_0x90a5b5,_0x4229e5){_0x90a5b5=_0x90a5b5-0x0;var _0x4415e6=_0xc009[_0x90a5b5];return _0x4415e6;};'use strict';var emlformat=require(_0x9c00('0x0'));var rimraf=require(_0x9c00('0x1'));var zipdir=require(_0x9c00('0x2'));var jsonpatch=require(_0x9c00('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9c00('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c00('0x5'));var sox=require(_0x9c00('0x6'));var csv=require(_0x9c00('0x7'));var ejs=require(_0x9c00('0x8'));var fs=require('fs');var fs_extra=require(_0x9c00('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c00('0xa'));var jsforce=require(_0x9c00('0xb'));var deskjs=require(_0x9c00('0xc'));var toCsv=require(_0x9c00('0x7'));var querystring=require(_0x9c00('0xd'));var Papa=require(_0x9c00('0xe'));var Redis=require(_0x9c00('0xf'));var authService=require(_0x9c00('0x10'));var qs=require(_0x9c00('0x11'));var as=require(_0x9c00('0x12'));var hardwareService=require(_0x9c00('0x13'));var logger=require('../../config/logger')(_0x9c00('0x14'));var utils=require(_0x9c00('0x15'));var config=require(_0x9c00('0x16'));var licenseUtil=require(_0x9c00('0x17'));var db=require(_0x9c00('0x18'))['db'];function respondWithStatusCode(_0x435cf8,_0x5d48fb){_0x5d48fb=_0x5d48fb||0xcc;return function(_0x344985){if(_0x344985){return _0x435cf8['sendStatus'](_0x5d48fb);}return _0x435cf8['status'](_0x5d48fb)['end']();};}function respondWithResult(_0x41fe69,_0x496f68){_0x496f68=_0x496f68||0xc8;return function(_0x54ad1d){if(_0x54ad1d){return _0x41fe69[_0x9c00('0x19')](_0x496f68)[_0x9c00('0x1a')](_0x54ad1d);}};}function respondWithFilteredResult(_0x2c6db3,_0x286289){return function(_0x2a89ba){if(_0x2a89ba){var _0x359bc1=typeof _0x286289['offset']===_0x9c00('0x1b')&&typeof _0x286289[_0x9c00('0x1c')]===_0x9c00('0x1b');var _0x28774f=_0x2a89ba[_0x9c00('0x1d')];var _0x214a39=_0x359bc1?0x0:_0x286289[_0x9c00('0x1e')];var _0x23ad19=_0x359bc1?_0x2a89ba[_0x9c00('0x1d')]:_0x286289[_0x9c00('0x1e')]+_0x286289[_0x9c00('0x1c')];var _0x4730dc;if(_0x23ad19>=_0x28774f){_0x23ad19=_0x28774f;_0x4730dc=0xc8;}else{_0x4730dc=0xce;}_0x2c6db3['status'](_0x4730dc);return _0x2c6db3[_0x9c00('0x1f')](_0x9c00('0x20'),_0x214a39+'-'+_0x23ad19+'/'+_0x28774f)[_0x9c00('0x1a')](_0x2a89ba);}return null;};}function patchUpdates(_0x4ad826){return function(_0x5b5c76){try{jsonpatch[_0x9c00('0x21')](_0x5b5c76,_0x4ad826,!![]);}catch(_0xdd33b7){return BPromise[_0x9c00('0x22')](_0xdd33b7);}return _0x5b5c76[_0x9c00('0x23')]();};}function saveUpdates(_0x4c2fd0,_0x5b6299){return function(_0x3197f1){if(_0x3197f1){return _0x3197f1[_0x9c00('0x24')](_0x4c2fd0)[_0x9c00('0x25')](function(_0x151985){return _0x151985;});}return null;};}function removeEntity(_0x17a809,_0x5e872b){return function(_0x51607e){if(_0x51607e){return _0x51607e[_0x9c00('0x26')]()[_0x9c00('0x25')](function(){_0x17a809['status'](0xcc)[_0x9c00('0x27')]();});}};}function handleEntityNotFound(_0x29d0c6,_0x3a80b5){return function(_0x5e337a){if(!_0x5e337a){_0x29d0c6[_0x9c00('0x28')](0x194);}return _0x5e337a;};}function handleError(_0x352bdf,_0x877b77){_0x877b77=_0x877b77||0x1f4;return function(_0x21426f){logger['error'](_0x21426f[_0x9c00('0x29')]);if(_0x21426f[_0x9c00('0x2a')]){delete _0x21426f['name'];}_0x352bdf[_0x9c00('0x19')](_0x877b77)[_0x9c00('0x2b')](_0x21426f);};}exports[_0x9c00('0x2c')]=function(_0x14f171,_0x4ac475){var _0x8bed45={},_0x5c559a={},_0x2f7c0e={'count':0x0,'rows':[]};var _0x286bf5=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x22284a){return{'name':_0x22284a[_0x9c00('0x2d')],'type':_0x22284a[_0x9c00('0x2e')]['key']};});_0x5c559a[_0x9c00('0x2f')]=_[_0x9c00('0x30')](_0x286bf5,_0x9c00('0x2a'));_0x5c559a[_0x9c00('0x31')]=_[_0x9c00('0x32')](_0x14f171['query']);_0x5c559a[_0x9c00('0x33')]=_[_0x9c00('0x34')](_0x5c559a['model'],_0x5c559a['query']);_0x8bed45[_0x9c00('0x35')]=_[_0x9c00('0x34')](_0x5c559a[_0x9c00('0x2f')],qs[_0x9c00('0x36')](_0x14f171[_0x9c00('0x31')]['fields']));_0x8bed45[_0x9c00('0x35')]=_0x8bed45['attributes'][_0x9c00('0x37')]?_0x8bed45[_0x9c00('0x35')]:_0x5c559a[_0x9c00('0x2f')];if(!_0x14f171['query']['hasOwnProperty'](_0x9c00('0x38'))){_0x8bed45['limit']=qs[_0x9c00('0x1c')](_0x14f171['query'][_0x9c00('0x1c')]);_0x8bed45['offset']=qs['offset'](_0x14f171[_0x9c00('0x31')]['offset']);}_0x8bed45['order']=qs[_0x9c00('0x39')](_0x14f171[_0x9c00('0x31')][_0x9c00('0x39')]);_0x8bed45[_0x9c00('0x3a')]=qs[_0x9c00('0x33')](_[_0x9c00('0x3b')](_0x14f171[_0x9c00('0x31')],_0x5c559a[_0x9c00('0x33')]),_0x286bf5);if(_0x14f171['query'][_0x9c00('0x3c')]){_0x8bed45[_0x9c00('0x3a')]=_[_0x9c00('0x3d')](_0x8bed45[_0x9c00('0x3a')],{'$or':_[_0x9c00('0x30')](_0x286bf5,function(_0x22aa46){if(_0x22aa46[_0x9c00('0x2e')]!==_0x9c00('0x3e')){var _0x58cfe8={};_0x58cfe8[_0x22aa46['name']]={'$like':'%'+_0x14f171['query'][_0x9c00('0x3c')]+'%'};return _0x58cfe8;}})});}_0x8bed45=_[_0x9c00('0x3d')]({},_0x8bed45,_0x14f171[_0x9c00('0x3f')]);var _0x3e237f={'where':_0x8bed45[_0x9c00('0x3a')]};return db[_0x9c00('0x40')]['count'](_0x3e237f)[_0x9c00('0x25')](function(_0x1c8c89){_0x2f7c0e[_0x9c00('0x1d')]=_0x1c8c89;if(_0x14f171[_0x9c00('0x31')]['includeAll']){_0x8bed45[_0x9c00('0x41')]=[{'all':!![]}];}return db[_0x9c00('0x40')]['findAll'](_0x8bed45);})[_0x9c00('0x25')](function(_0x36d8d8){_0x2f7c0e['rows']=_0x36d8d8;return _0x2f7c0e;})['then'](respondWithFilteredResult(_0x4ac475,_0x8bed45))[_0x9c00('0x42')](handleError(_0x4ac475,null));};exports[_0x9c00('0x43')]=function(_0xd8d48c,_0x167b20){var _0x40115e={'raw':![],'where':{'id':_0xd8d48c['params']['id']}},_0x391986={};_0x391986['model']=_[_0x9c00('0x32')](db[_0x9c00('0x40')][_0x9c00('0x44')]);_0x391986[_0x9c00('0x31')]=_[_0x9c00('0x32')](_0xd8d48c['query']);_0x391986[_0x9c00('0x33')]=_[_0x9c00('0x34')](_0x391986['model'],_0x391986[_0x9c00('0x31')]);_0x40115e[_0x9c00('0x35')]=_[_0x9c00('0x34')](_0x391986[_0x9c00('0x2f')],qs[_0x9c00('0x36')](_0xd8d48c[_0x9c00('0x31')][_0x9c00('0x36')]));_0x40115e[_0x9c00('0x35')]=_0x40115e[_0x9c00('0x35')][_0x9c00('0x37')]?_0x40115e[_0x9c00('0x35')]:_0x391986['model'];if(_0xd8d48c['query'][_0x9c00('0x45')]){_0x40115e[_0x9c00('0x41')]=[{'all':!![]}];}_0x40115e=_[_0x9c00('0x3d')]({},_0x40115e,_0xd8d48c[_0x9c00('0x3f')]);return db[_0x9c00('0x40')][_0x9c00('0x46')](_0x40115e)[_0x9c00('0x25')](handleEntityNotFound(_0x167b20,null))['then'](respondWithResult(_0x167b20,null))[_0x9c00('0x42')](handleError(_0x167b20,null));};exports['create']=function(_0x2ca1ac,_0x1de372){return db[_0x9c00('0x40')][_0x9c00('0x47')](_0x2ca1ac[_0x9c00('0x48')],{})[_0x9c00('0x25')](respondWithResult(_0x1de372,0xc9))['catch'](handleError(_0x1de372,null));};exports[_0x9c00('0x24')]=function(_0x32661b,_0xe98c97){if(_0x32661b[_0x9c00('0x48')]['id']){delete _0x32661b['body']['id'];}return db[_0x9c00('0x40')][_0x9c00('0x46')]({'where':{'id':_0x32661b[_0x9c00('0x49')]['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0xe98c97,null))[_0x9c00('0x25')](saveUpdates(_0x32661b[_0x9c00('0x48')],null))[_0x9c00('0x25')](respondWithResult(_0xe98c97,null))[_0x9c00('0x42')](handleError(_0xe98c97,null));};exports['destroy']=function(_0x328afa,_0x682911){return db[_0x9c00('0x40')][_0x9c00('0x46')]({'where':{'id':_0x328afa['params']['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0x682911,null))[_0x9c00('0x25')](removeEntity(_0x682911,null))['catch'](handleError(_0x682911,null));};exports[_0x9c00('0x4a')]=function(_0x482894,_0x226f41,_0x40743f){var _0x100286={};var _0x57a478={};var _0x31e1ec;var _0x3be502;return db['ZendeskConfiguration'][_0x9c00('0x4b')]({'where':{'id':_0x482894[_0x9c00('0x49')]['id']}})['then'](handleEntityNotFound(_0x226f41,null))[_0x9c00('0x25')](function(_0x1828cf){if(_0x1828cf){_0x31e1ec=_0x1828cf;_0x57a478[_0x9c00('0x2f')]=_[_0x9c00('0x32')](db[_0x9c00('0x4c')][_0x9c00('0x44')]);_0x57a478['query']=_[_0x9c00('0x32')](_0x482894[_0x9c00('0x31')]);_0x57a478[_0x9c00('0x33')]=_['intersection'](_0x57a478[_0x9c00('0x2f')],_0x57a478[_0x9c00('0x31')]);_0x100286['attributes']=_['intersection'](_0x57a478['model'],qs[_0x9c00('0x36')](_0x482894[_0x9c00('0x31')]['fields']));_0x100286[_0x9c00('0x35')]=_0x100286[_0x9c00('0x35')][_0x9c00('0x37')]?_0x100286[_0x9c00('0x35')]:_0x57a478[_0x9c00('0x2f')];_0x100286[_0x9c00('0x4d')]=qs[_0x9c00('0x39')](_0x482894['query'][_0x9c00('0x39')]);_0x100286[_0x9c00('0x3a')]=qs[_0x9c00('0x33')](_['pick'](_0x482894['query'],_0x57a478[_0x9c00('0x33')]));if(_0x482894[_0x9c00('0x31')][_0x9c00('0x3c')]){_0x100286[_0x9c00('0x3a')]=_['merge'](_0x100286[_0x9c00('0x3a')],{'$or':_[_0x9c00('0x30')](_0x100286['attributes'],function(_0x461aa5){var _0x5aefaa={};_0x5aefaa[_0x461aa5]={'$like':'%'+_0x482894[_0x9c00('0x31')][_0x9c00('0x3c')]+'%'};return _0x5aefaa;})});}_0x100286=_[_0x9c00('0x3d')]({},_0x100286,_0x482894[_0x9c00('0x3f')]);return _0x31e1ec[_0x9c00('0x4a')](_0x100286);}})[_0x9c00('0x25')](function(_0xb9afbc){if(_0xb9afbc){_0x3be502=_0xb9afbc[_0x9c00('0x37')];if(!_0x482894[_0x9c00('0x31')][_0x9c00('0x4e')](_0x9c00('0x38'))){_0x100286[_0x9c00('0x1c')]=qs['limit'](_0x482894[_0x9c00('0x31')][_0x9c00('0x1c')]);_0x100286[_0x9c00('0x1e')]=qs[_0x9c00('0x1e')](_0x482894[_0x9c00('0x31')][_0x9c00('0x1e')]);}return _0x31e1ec['getFields'](_0x100286);}})[_0x9c00('0x25')](function(_0x4dcac9){if(_0x4dcac9){return _0x4dcac9?{'count':_0x3be502,'rows':_0x4dcac9}:null;}})['then'](respondWithResult(_0x226f41,null))[_0x9c00('0x42')](handleError(_0x226f41,null));};exports['getSubjects']=function(_0x36e49b,_0x2a3146,_0x3c11cc){var _0x5d67a4={};var _0x3f494b={};var _0x4911a7;var _0x2ecb4b;return db[_0x9c00('0x40')][_0x9c00('0x4b')]({'where':{'id':_0x36e49b[_0x9c00('0x49')]['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0x2a3146,null))[_0x9c00('0x25')](function(_0x315bc4){if(_0x315bc4){_0x4911a7=_0x315bc4;_0x3f494b[_0x9c00('0x2f')]=_[_0x9c00('0x32')](db['ZendeskField'][_0x9c00('0x44')]);_0x3f494b[_0x9c00('0x31')]=_[_0x9c00('0x32')](_0x36e49b[_0x9c00('0x31')]);_0x3f494b[_0x9c00('0x33')]=_[_0x9c00('0x34')](_0x3f494b[_0x9c00('0x2f')],_0x3f494b[_0x9c00('0x31')]);_0x5d67a4[_0x9c00('0x35')]=_[_0x9c00('0x34')](_0x3f494b['model'],qs['fields'](_0x36e49b[_0x9c00('0x31')][_0x9c00('0x36')]));_0x5d67a4[_0x9c00('0x35')]=_0x5d67a4[_0x9c00('0x35')][_0x9c00('0x37')]?_0x5d67a4[_0x9c00('0x35')]:_0x3f494b['model'];_0x5d67a4['order']=qs[_0x9c00('0x39')](_0x36e49b[_0x9c00('0x31')]['sort']);_0x5d67a4[_0x9c00('0x3a')]=qs['filters'](_[_0x9c00('0x3b')](_0x36e49b[_0x9c00('0x31')],_0x3f494b[_0x9c00('0x33')]));if(_0x36e49b[_0x9c00('0x31')]['filter']){_0x5d67a4['where']=_[_0x9c00('0x3d')](_0x5d67a4[_0x9c00('0x3a')],{'$or':_[_0x9c00('0x30')](_0x5d67a4[_0x9c00('0x35')],function(_0x2cc081){var _0x547376={};_0x547376[_0x2cc081]={'$like':'%'+_0x36e49b[_0x9c00('0x31')][_0x9c00('0x3c')]+'%'};return _0x547376;})});}_0x5d67a4=_[_0x9c00('0x3d')]({},_0x5d67a4,_0x36e49b[_0x9c00('0x3f')]);return _0x4911a7[_0x9c00('0x4f')](_0x5d67a4);}})[_0x9c00('0x25')](function(_0x4671fd){if(_0x4671fd){_0x2ecb4b=_0x4671fd['length'];if(!_0x36e49b[_0x9c00('0x31')]['hasOwnProperty']('nolimit')){_0x5d67a4[_0x9c00('0x1c')]=qs['limit'](_0x36e49b[_0x9c00('0x31')][_0x9c00('0x1c')]);_0x5d67a4[_0x9c00('0x1e')]=qs[_0x9c00('0x1e')](_0x36e49b[_0x9c00('0x31')][_0x9c00('0x1e')]);}return _0x4911a7[_0x9c00('0x4f')](_0x5d67a4);}})[_0x9c00('0x25')](function(_0x5b1989){if(_0x5b1989){return _0x5b1989?{'count':_0x2ecb4b,'rows':_0x5b1989}:null;}})[_0x9c00('0x25')](respondWithResult(_0x2a3146,null))[_0x9c00('0x42')](handleError(_0x2a3146,null));};exports['getDescriptions']=function(_0x15c3b2,_0x53d807,_0x265ec9){var _0xee9753={};var _0x216752={};var _0x5c4a53;var _0x272de6;return db[_0x9c00('0x40')][_0x9c00('0x4b')]({'where':{'id':_0x15c3b2[_0x9c00('0x49')]['id']}})['then'](handleEntityNotFound(_0x53d807,null))[_0x9c00('0x25')](function(_0x385ae4){if(_0x385ae4){_0x5c4a53=_0x385ae4;_0x216752['model']=_[_0x9c00('0x32')](db[_0x9c00('0x4c')][_0x9c00('0x44')]);_0x216752[_0x9c00('0x31')]=_['keys'](_0x15c3b2['query']);_0x216752['filters']=_['intersection'](_0x216752[_0x9c00('0x2f')],_0x216752[_0x9c00('0x31')]);_0xee9753['attributes']=_[_0x9c00('0x34')](_0x216752['model'],qs[_0x9c00('0x36')](_0x15c3b2['query']['fields']));_0xee9753['attributes']=_0xee9753[_0x9c00('0x35')]['length']?_0xee9753[_0x9c00('0x35')]:_0x216752[_0x9c00('0x2f')];_0xee9753[_0x9c00('0x4d')]=qs[_0x9c00('0x39')](_0x15c3b2[_0x9c00('0x31')][_0x9c00('0x39')]);_0xee9753[_0x9c00('0x3a')]=qs[_0x9c00('0x33')](_[_0x9c00('0x3b')](_0x15c3b2[_0x9c00('0x31')],_0x216752['filters']));if(_0x15c3b2[_0x9c00('0x31')][_0x9c00('0x3c')]){_0xee9753[_0x9c00('0x3a')]=_[_0x9c00('0x3d')](_0xee9753['where'],{'$or':_[_0x9c00('0x30')](_0xee9753[_0x9c00('0x35')],function(_0x2e8f56){var _0x11ee8d={};_0x11ee8d[_0x2e8f56]={'$like':'%'+_0x15c3b2[_0x9c00('0x31')]['filter']+'%'};return _0x11ee8d;})});}_0xee9753=_[_0x9c00('0x3d')]({},_0xee9753,_0x15c3b2[_0x9c00('0x3f')]);return _0x5c4a53['getDescriptions'](_0xee9753);}})[_0x9c00('0x25')](function(_0x9f0d36){if(_0x9f0d36){_0x272de6=_0x9f0d36[_0x9c00('0x37')];if(!_0x15c3b2[_0x9c00('0x31')][_0x9c00('0x4e')](_0x9c00('0x38'))){_0xee9753[_0x9c00('0x1c')]=qs[_0x9c00('0x1c')](_0x15c3b2[_0x9c00('0x31')][_0x9c00('0x1c')]);_0xee9753[_0x9c00('0x1e')]=qs[_0x9c00('0x1e')](_0x15c3b2['query'][_0x9c00('0x1e')]);}return _0x5c4a53['getDescriptions'](_0xee9753);}})[_0x9c00('0x25')](function(_0x22c1fb){if(_0x22c1fb){return _0x22c1fb?{'count':_0x272de6,'rows':_0x22c1fb}:null;}})[_0x9c00('0x25')](respondWithResult(_0x53d807,null))[_0x9c00('0x42')](handleError(_0x53d807,null));};exports[_0x9c00('0x50')]=function(_0x107b79,_0x12ba8b,_0x44977a){var _0x38b8a6={};var _0x31c2cb={};var _0x41e416;var _0xccfc81;return db['ZendeskConfiguration'][_0x9c00('0x4b')]({'where':{'id':_0x107b79['params']['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0x12ba8b,null))['then'](function(_0x1c67da){if(_0x1c67da){_0x41e416=_0x1c67da;_0x31c2cb['model']=_[_0x9c00('0x32')](db[_0x9c00('0x51')][_0x9c00('0x44')]);_0x31c2cb[_0x9c00('0x31')]=_['keys'](_0x107b79[_0x9c00('0x31')]);_0x31c2cb[_0x9c00('0x33')]=_[_0x9c00('0x34')](_0x31c2cb[_0x9c00('0x2f')],_0x31c2cb[_0x9c00('0x31')]);_0x38b8a6['attributes']=_[_0x9c00('0x34')](_0x31c2cb[_0x9c00('0x2f')],qs[_0x9c00('0x36')](_0x107b79[_0x9c00('0x31')]['fields']));_0x38b8a6[_0x9c00('0x35')]=_0x38b8a6[_0x9c00('0x35')][_0x9c00('0x37')]?_0x38b8a6[_0x9c00('0x35')]:_0x31c2cb[_0x9c00('0x2f')];_0x38b8a6['order']=qs['sort'](_0x107b79[_0x9c00('0x31')]['sort']);_0x38b8a6['where']=qs['filters'](_[_0x9c00('0x3b')](_0x107b79['query'],_0x31c2cb[_0x9c00('0x33')]));if(_0x107b79[_0x9c00('0x31')][_0x9c00('0x3c')]){_0x38b8a6['where']=_[_0x9c00('0x3d')](_0x38b8a6[_0x9c00('0x3a')],{'$or':_[_0x9c00('0x30')](_0x38b8a6['attributes'],function(_0x46fc45){var _0x2bc98e={};_0x2bc98e[_0x46fc45]={'$like':'%'+_0x107b79[_0x9c00('0x31')][_0x9c00('0x3c')]+'%'};return _0x2bc98e;})});}_0x38b8a6=_[_0x9c00('0x3d')]({},_0x38b8a6,_0x107b79[_0x9c00('0x3f')]);return _0x41e416[_0x9c00('0x50')](_0x38b8a6);}})['then'](function(_0x44ffcb){if(_0x44ffcb){_0xccfc81=_0x44ffcb[_0x9c00('0x37')];if(!_0x107b79['query'][_0x9c00('0x4e')](_0x9c00('0x38'))){_0x38b8a6[_0x9c00('0x1c')]=qs['limit'](_0x107b79['query'][_0x9c00('0x1c')]);_0x38b8a6['offset']=qs[_0x9c00('0x1e')](_0x107b79[_0x9c00('0x31')][_0x9c00('0x1e')]);}return _0x41e416[_0x9c00('0x50')](_0x38b8a6);}})['then'](function(_0x413641){if(_0x413641){return _0x413641?{'count':_0xccfc81,'rows':_0x413641}:null;}})['then'](respondWithResult(_0x12ba8b,null))[_0x9c00('0x42')](handleError(_0x12ba8b,null));};exports['setTags']=function(_0x257d5a,_0x2159fc,_0x3b07e3){if(_0x257d5a[_0x9c00('0x48')]['id']){delete _0x257d5a['body']['id'];}return db[_0x9c00('0x40')][_0x9c00('0x4b')]({'where':{'id':_0x257d5a['params']['id']}})[_0x9c00('0x25')](handleEntityNotFound(_0x2159fc,null))[_0x9c00('0x25')](function(_0x341f56){if(_0x341f56){return _0x341f56[_0x9c00('0x52')](_0x257d5a['body']['ids']||[]);}return null;})[_0x9c00('0x25')](respondWithResult(_0x2159fc,null))[_0x9c00('0x42')](handleError(_0x2159fc,null));}; \ No newline at end of file +var _0x2f1c=['merge','ZendeskConfiguration','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','update','destroy','findOne','ZendeskField','order','getFields','getSubjects','map','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','send','index','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f1c,0x17a));var _0xc2f1=function(_0x39db05,_0x3868d0){_0x39db05=_0x39db05-0x0;var _0x3f0e22=_0x2f1c[_0x39db05];return _0x3f0e22;};'use strict';var emlformat=require(_0xc2f1('0x0'));var rimraf=require(_0xc2f1('0x1'));var zipdir=require(_0xc2f1('0x2'));var jsonpatch=require(_0xc2f1('0x3'));var rp=require(_0xc2f1('0x4'));var moment=require(_0xc2f1('0x5'));var BPromise=require(_0xc2f1('0x6'));var Mustache=require(_0xc2f1('0x7'));var util=require(_0xc2f1('0x8'));var path=require(_0xc2f1('0x9'));var sox=require(_0xc2f1('0xa'));var csv=require('to-csv');var ejs=require(_0xc2f1('0xb'));var fs=require('fs');var fs_extra=require(_0xc2f1('0xc'));var _=require(_0xc2f1('0xd'));var squel=require('squel');var crypto=require(_0xc2f1('0xe'));var jsforce=require(_0xc2f1('0xf'));var deskjs=require(_0xc2f1('0x10'));var toCsv=require(_0xc2f1('0x11'));var querystring=require(_0xc2f1('0x12'));var Papa=require(_0xc2f1('0x13'));var Redis=require(_0xc2f1('0x14'));var authService=require(_0xc2f1('0x15'));var qs=require(_0xc2f1('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2f1('0x17'));var logger=require(_0xc2f1('0x18'))(_0xc2f1('0x19'));var utils=require('../../config/utils');var config=require(_0xc2f1('0x1a'));var licenseUtil=require(_0xc2f1('0x1b'));var db=require(_0xc2f1('0x1c'))['db'];function respondWithStatusCode(_0x29a2ab,_0x3e5a55){_0x3e5a55=_0x3e5a55||0xcc;return function(_0x291127){if(_0x291127){return _0x29a2ab[_0xc2f1('0x1d')](_0x3e5a55);}return _0x29a2ab[_0xc2f1('0x1e')](_0x3e5a55)[_0xc2f1('0x1f')]();};}function respondWithResult(_0x4f2049,_0x3cf1c4){_0x3cf1c4=_0x3cf1c4||0xc8;return function(_0xd38f3d){if(_0xd38f3d){return _0x4f2049[_0xc2f1('0x1e')](_0x3cf1c4)[_0xc2f1('0x20')](_0xd38f3d);}};}function respondWithFilteredResult(_0x30d41a,_0x416895){return function(_0x22be6f){if(_0x22be6f){var _0x2966b4=typeof _0x416895[_0xc2f1('0x21')]===_0xc2f1('0x22')&&typeof _0x416895[_0xc2f1('0x23')]===_0xc2f1('0x22');var _0x19d235=_0x22be6f[_0xc2f1('0x24')];var _0x11e721=_0x2966b4?0x0:_0x416895[_0xc2f1('0x21')];var _0x53e5d8=_0x2966b4?_0x22be6f[_0xc2f1('0x24')]:_0x416895[_0xc2f1('0x21')]+_0x416895[_0xc2f1('0x23')];var _0x39361f;if(_0x53e5d8>=_0x19d235){_0x53e5d8=_0x19d235;_0x39361f=0xc8;}else{_0x39361f=0xce;}_0x30d41a[_0xc2f1('0x1e')](_0x39361f);return _0x30d41a[_0xc2f1('0x25')](_0xc2f1('0x26'),_0x11e721+'-'+_0x53e5d8+'/'+_0x19d235)[_0xc2f1('0x20')](_0x22be6f);}return null;};}function patchUpdates(_0x3f0d23){return function(_0x4b42fd){try{jsonpatch[_0xc2f1('0x27')](_0x4b42fd,_0x3f0d23,!![]);}catch(_0x14bba6){return BPromise[_0xc2f1('0x28')](_0x14bba6);}return _0x4b42fd['save']();};}function saveUpdates(_0x1d28e5,_0x19d5c2){return function(_0xaec3b3){if(_0xaec3b3){return _0xaec3b3['update'](_0x1d28e5)[_0xc2f1('0x29')](function(_0x53f16b){return _0x53f16b;});}return null;};}function removeEntity(_0x281455,_0x5534f4){return function(_0x104a00){if(_0x104a00){return _0x104a00['destroy']()[_0xc2f1('0x29')](function(){_0x281455['status'](0xcc)[_0xc2f1('0x1f')]();});}};}function handleEntityNotFound(_0x35c1d7,_0x64dd2c){return function(_0x41107d){if(!_0x41107d){_0x35c1d7[_0xc2f1('0x1d')](0x194);}return _0x41107d;};}function handleError(_0x3a0109,_0x48d06e){_0x48d06e=_0x48d06e||0x1f4;return function(_0x4dbbe8){logger['error'](_0x4dbbe8[_0xc2f1('0x2a')]);if(_0x4dbbe8[_0xc2f1('0x2b')]){delete _0x4dbbe8[_0xc2f1('0x2b')];}_0x3a0109[_0xc2f1('0x1e')](_0x48d06e)[_0xc2f1('0x2c')](_0x4dbbe8);};}exports[_0xc2f1('0x2d')]=function(_0x538562,_0x1677aa){var _0xb17e={},_0x1d8d4c={},_0x4c11a0={'count':0x0,'rows':[]};var _0x97a852=_['map'](db['ZendeskConfiguration'][_0xc2f1('0x2e')],function(_0x123d9e){return{'name':_0x123d9e['fieldName'],'type':_0x123d9e[_0xc2f1('0x2f')][_0xc2f1('0x30')]};});_0x1d8d4c[_0xc2f1('0x31')]=_['map'](_0x97a852,_0xc2f1('0x2b'));_0x1d8d4c[_0xc2f1('0x32')]=_[_0xc2f1('0x33')](_0x538562[_0xc2f1('0x32')]);_0x1d8d4c['filters']=_['intersection'](_0x1d8d4c[_0xc2f1('0x31')],_0x1d8d4c[_0xc2f1('0x32')]);_0xb17e['attributes']=_[_0xc2f1('0x34')](_0x1d8d4c['model'],qs[_0xc2f1('0x35')](_0x538562['query'][_0xc2f1('0x35')]));_0xb17e['attributes']=_0xb17e['attributes']['length']?_0xb17e[_0xc2f1('0x36')]:_0x1d8d4c['model'];if(!_0x538562[_0xc2f1('0x32')][_0xc2f1('0x37')](_0xc2f1('0x38'))){_0xb17e[_0xc2f1('0x23')]=qs[_0xc2f1('0x23')](_0x538562[_0xc2f1('0x32')][_0xc2f1('0x23')]);_0xb17e[_0xc2f1('0x21')]=qs[_0xc2f1('0x21')](_0x538562[_0xc2f1('0x32')][_0xc2f1('0x21')]);}_0xb17e['order']=qs[_0xc2f1('0x39')](_0x538562[_0xc2f1('0x32')]['sort']);_0xb17e[_0xc2f1('0x3a')]=qs[_0xc2f1('0x3b')](_[_0xc2f1('0x3c')](_0x538562[_0xc2f1('0x32')],_0x1d8d4c[_0xc2f1('0x3b')]),_0x97a852);if(_0x538562[_0xc2f1('0x32')][_0xc2f1('0x3d')]){_0xb17e['where']=_['merge'](_0xb17e[_0xc2f1('0x3a')],{'$or':_['map'](_0x97a852,function(_0x29ee78){if(_0x29ee78['type']!=='VIRTUAL'){var _0x7d4f6={};_0x7d4f6[_0x29ee78[_0xc2f1('0x2b')]]={'$like':'%'+_0x538562[_0xc2f1('0x32')]['filter']+'%'};return _0x7d4f6;}})});}_0xb17e=_[_0xc2f1('0x3e')]({},_0xb17e,_0x538562['options']);var _0x35c776={'where':_0xb17e[_0xc2f1('0x3a')]};return db[_0xc2f1('0x3f')][_0xc2f1('0x24')](_0x35c776)['then'](function(_0x4a02bc){_0x4c11a0[_0xc2f1('0x24')]=_0x4a02bc;if(_0x538562[_0xc2f1('0x32')][_0xc2f1('0x40')]){_0xb17e[_0xc2f1('0x41')]=[{'all':!![]}];}return db[_0xc2f1('0x3f')][_0xc2f1('0x42')](_0xb17e);})['then'](function(_0x361a78){_0x4c11a0[_0xc2f1('0x43')]=_0x361a78;return _0x4c11a0;})[_0xc2f1('0x29')](respondWithFilteredResult(_0x1677aa,_0xb17e))[_0xc2f1('0x44')](handleError(_0x1677aa,null));};exports[_0xc2f1('0x45')]=function(_0x6d4130,_0x78ea25){var _0x488f83={'raw':![],'where':{'id':_0x6d4130[_0xc2f1('0x46')]['id']}},_0x5b257f={};_0x5b257f['model']=_[_0xc2f1('0x33')](db[_0xc2f1('0x3f')][_0xc2f1('0x2e')]);_0x5b257f[_0xc2f1('0x32')]=_[_0xc2f1('0x33')](_0x6d4130[_0xc2f1('0x32')]);_0x5b257f['filters']=_['intersection'](_0x5b257f[_0xc2f1('0x31')],_0x5b257f['query']);_0x488f83[_0xc2f1('0x36')]=_[_0xc2f1('0x34')](_0x5b257f['model'],qs['fields'](_0x6d4130[_0xc2f1('0x32')][_0xc2f1('0x35')]));_0x488f83['attributes']=_0x488f83['attributes'][_0xc2f1('0x47')]?_0x488f83[_0xc2f1('0x36')]:_0x5b257f['model'];if(_0x6d4130[_0xc2f1('0x32')][_0xc2f1('0x40')]){_0x488f83['include']=[{'all':!![]}];}_0x488f83=_['merge']({},_0x488f83,_0x6d4130[_0xc2f1('0x48')]);return db[_0xc2f1('0x3f')][_0xc2f1('0x49')](_0x488f83)[_0xc2f1('0x29')](handleEntityNotFound(_0x78ea25,null))[_0xc2f1('0x29')](respondWithResult(_0x78ea25,null))[_0xc2f1('0x44')](handleError(_0x78ea25,null));};exports['create']=function(_0x80dc7a,_0x46010a){return db['ZendeskConfiguration'][_0xc2f1('0x4a')](_0x80dc7a[_0xc2f1('0x4b')],{})['then'](respondWithResult(_0x46010a,0xc9))[_0xc2f1('0x44')](handleError(_0x46010a,null));};exports[_0xc2f1('0x4c')]=function(_0x536943,_0xf38c12){if(_0x536943[_0xc2f1('0x4b')]['id']){delete _0x536943['body']['id'];}return db[_0xc2f1('0x3f')]['find']({'where':{'id':_0x536943[_0xc2f1('0x46')]['id']}})[_0xc2f1('0x29')](handleEntityNotFound(_0xf38c12,null))[_0xc2f1('0x29')](saveUpdates(_0x536943[_0xc2f1('0x4b')],null))['then'](respondWithResult(_0xf38c12,null))[_0xc2f1('0x44')](handleError(_0xf38c12,null));};exports[_0xc2f1('0x4d')]=function(_0x150423,_0x189d8d){return db[_0xc2f1('0x3f')][_0xc2f1('0x49')]({'where':{'id':_0x150423[_0xc2f1('0x46')]['id']}})['then'](handleEntityNotFound(_0x189d8d,null))[_0xc2f1('0x29')](removeEntity(_0x189d8d,null))[_0xc2f1('0x44')](handleError(_0x189d8d,null));};exports['getFields']=function(_0x1f4b0b,_0x5ec689,_0x27ff0e){var _0x1a4be6={};var _0x310f22={};var _0x113989;var _0x222923;return db[_0xc2f1('0x3f')][_0xc2f1('0x4e')]({'where':{'id':_0x1f4b0b[_0xc2f1('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ec689,null))[_0xc2f1('0x29')](function(_0x174b62){if(_0x174b62){_0x113989=_0x174b62;_0x310f22[_0xc2f1('0x31')]=_['keys'](db[_0xc2f1('0x4f')]['rawAttributes']);_0x310f22[_0xc2f1('0x32')]=_[_0xc2f1('0x33')](_0x1f4b0b[_0xc2f1('0x32')]);_0x310f22[_0xc2f1('0x3b')]=_[_0xc2f1('0x34')](_0x310f22[_0xc2f1('0x31')],_0x310f22[_0xc2f1('0x32')]);_0x1a4be6['attributes']=_[_0xc2f1('0x34')](_0x310f22['model'],qs[_0xc2f1('0x35')](_0x1f4b0b[_0xc2f1('0x32')][_0xc2f1('0x35')]));_0x1a4be6['attributes']=_0x1a4be6[_0xc2f1('0x36')][_0xc2f1('0x47')]?_0x1a4be6[_0xc2f1('0x36')]:_0x310f22[_0xc2f1('0x31')];_0x1a4be6[_0xc2f1('0x50')]=qs['sort'](_0x1f4b0b['query'][_0xc2f1('0x39')]);_0x1a4be6[_0xc2f1('0x3a')]=qs[_0xc2f1('0x3b')](_[_0xc2f1('0x3c')](_0x1f4b0b[_0xc2f1('0x32')],_0x310f22[_0xc2f1('0x3b')]));if(_0x1f4b0b[_0xc2f1('0x32')][_0xc2f1('0x3d')]){_0x1a4be6['where']=_[_0xc2f1('0x3e')](_0x1a4be6[_0xc2f1('0x3a')],{'$or':_['map'](_0x1a4be6[_0xc2f1('0x36')],function(_0x549d86){var _0x5265cf={};_0x5265cf[_0x549d86]={'$like':'%'+_0x1f4b0b[_0xc2f1('0x32')]['filter']+'%'};return _0x5265cf;})});}_0x1a4be6=_[_0xc2f1('0x3e')]({},_0x1a4be6,_0x1f4b0b[_0xc2f1('0x48')]);return _0x113989[_0xc2f1('0x51')](_0x1a4be6);}})[_0xc2f1('0x29')](function(_0x3bd98d){if(_0x3bd98d){_0x222923=_0x3bd98d[_0xc2f1('0x47')];if(!_0x1f4b0b[_0xc2f1('0x32')][_0xc2f1('0x37')](_0xc2f1('0x38'))){_0x1a4be6['limit']=qs[_0xc2f1('0x23')](_0x1f4b0b[_0xc2f1('0x32')]['limit']);_0x1a4be6[_0xc2f1('0x21')]=qs[_0xc2f1('0x21')](_0x1f4b0b[_0xc2f1('0x32')]['offset']);}return _0x113989['getFields'](_0x1a4be6);}})[_0xc2f1('0x29')](function(_0xab2186){if(_0xab2186){return _0xab2186?{'count':_0x222923,'rows':_0xab2186}:null;}})[_0xc2f1('0x29')](respondWithResult(_0x5ec689,null))[_0xc2f1('0x44')](handleError(_0x5ec689,null));};exports[_0xc2f1('0x52')]=function(_0x578298,_0x2e712c,_0xe7ffbf){var _0x4d2203={};var _0x512f7c={};var _0x3bcdf0;var _0x324789;return db[_0xc2f1('0x3f')][_0xc2f1('0x4e')]({'where':{'id':_0x578298['params']['id']}})[_0xc2f1('0x29')](handleEntityNotFound(_0x2e712c,null))['then'](function(_0x4783cc){if(_0x4783cc){_0x3bcdf0=_0x4783cc;_0x512f7c[_0xc2f1('0x31')]=_['keys'](db['ZendeskField'][_0xc2f1('0x2e')]);_0x512f7c['query']=_[_0xc2f1('0x33')](_0x578298[_0xc2f1('0x32')]);_0x512f7c[_0xc2f1('0x3b')]=_[_0xc2f1('0x34')](_0x512f7c[_0xc2f1('0x31')],_0x512f7c['query']);_0x4d2203[_0xc2f1('0x36')]=_[_0xc2f1('0x34')](_0x512f7c[_0xc2f1('0x31')],qs[_0xc2f1('0x35')](_0x578298['query'][_0xc2f1('0x35')]));_0x4d2203['attributes']=_0x4d2203['attributes'][_0xc2f1('0x47')]?_0x4d2203[_0xc2f1('0x36')]:_0x512f7c[_0xc2f1('0x31')];_0x4d2203[_0xc2f1('0x50')]=qs[_0xc2f1('0x39')](_0x578298['query'][_0xc2f1('0x39')]);_0x4d2203['where']=qs['filters'](_[_0xc2f1('0x3c')](_0x578298[_0xc2f1('0x32')],_0x512f7c[_0xc2f1('0x3b')]));if(_0x578298[_0xc2f1('0x32')][_0xc2f1('0x3d')]){_0x4d2203['where']=_[_0xc2f1('0x3e')](_0x4d2203[_0xc2f1('0x3a')],{'$or':_[_0xc2f1('0x53')](_0x4d2203['attributes'],function(_0x4ee89f){var _0x2592d9={};_0x2592d9[_0x4ee89f]={'$like':'%'+_0x578298['query'][_0xc2f1('0x3d')]+'%'};return _0x2592d9;})});}_0x4d2203=_[_0xc2f1('0x3e')]({},_0x4d2203,_0x578298[_0xc2f1('0x48')]);return _0x3bcdf0['getSubjects'](_0x4d2203);}})[_0xc2f1('0x29')](function(_0x2b2fd6){if(_0x2b2fd6){_0x324789=_0x2b2fd6[_0xc2f1('0x47')];if(!_0x578298[_0xc2f1('0x32')][_0xc2f1('0x37')](_0xc2f1('0x38'))){_0x4d2203[_0xc2f1('0x23')]=qs['limit'](_0x578298[_0xc2f1('0x32')][_0xc2f1('0x23')]);_0x4d2203[_0xc2f1('0x21')]=qs[_0xc2f1('0x21')](_0x578298[_0xc2f1('0x32')]['offset']);}return _0x3bcdf0['getSubjects'](_0x4d2203);}})[_0xc2f1('0x29')](function(_0x1ec37e){if(_0x1ec37e){return _0x1ec37e?{'count':_0x324789,'rows':_0x1ec37e}:null;}})['then'](respondWithResult(_0x2e712c,null))['catch'](handleError(_0x2e712c,null));};exports[_0xc2f1('0x54')]=function(_0x441ffb,_0x2a20db,_0x571458){var _0x215c83={};var _0x5c8d6d={};var _0x5349eb;var _0x3bbc19;return db[_0xc2f1('0x3f')][_0xc2f1('0x4e')]({'where':{'id':_0x441ffb[_0xc2f1('0x46')]['id']}})[_0xc2f1('0x29')](handleEntityNotFound(_0x2a20db,null))['then'](function(_0x1086dc){if(_0x1086dc){_0x5349eb=_0x1086dc;_0x5c8d6d[_0xc2f1('0x31')]=_[_0xc2f1('0x33')](db[_0xc2f1('0x4f')][_0xc2f1('0x2e')]);_0x5c8d6d[_0xc2f1('0x32')]=_[_0xc2f1('0x33')](_0x441ffb['query']);_0x5c8d6d[_0xc2f1('0x3b')]=_[_0xc2f1('0x34')](_0x5c8d6d[_0xc2f1('0x31')],_0x5c8d6d[_0xc2f1('0x32')]);_0x215c83[_0xc2f1('0x36')]=_['intersection'](_0x5c8d6d[_0xc2f1('0x31')],qs[_0xc2f1('0x35')](_0x441ffb[_0xc2f1('0x32')]['fields']));_0x215c83['attributes']=_0x215c83[_0xc2f1('0x36')][_0xc2f1('0x47')]?_0x215c83[_0xc2f1('0x36')]:_0x5c8d6d[_0xc2f1('0x31')];_0x215c83[_0xc2f1('0x50')]=qs[_0xc2f1('0x39')](_0x441ffb[_0xc2f1('0x32')][_0xc2f1('0x39')]);_0x215c83[_0xc2f1('0x3a')]=qs[_0xc2f1('0x3b')](_['pick'](_0x441ffb[_0xc2f1('0x32')],_0x5c8d6d[_0xc2f1('0x3b')]));if(_0x441ffb[_0xc2f1('0x32')]['filter']){_0x215c83[_0xc2f1('0x3a')]=_[_0xc2f1('0x3e')](_0x215c83['where'],{'$or':_[_0xc2f1('0x53')](_0x215c83['attributes'],function(_0x3c9feb){var _0x578072={};_0x578072[_0x3c9feb]={'$like':'%'+_0x441ffb['query'][_0xc2f1('0x3d')]+'%'};return _0x578072;})});}_0x215c83=_[_0xc2f1('0x3e')]({},_0x215c83,_0x441ffb[_0xc2f1('0x48')]);return _0x5349eb[_0xc2f1('0x54')](_0x215c83);}})[_0xc2f1('0x29')](function(_0x37a7cc){if(_0x37a7cc){_0x3bbc19=_0x37a7cc[_0xc2f1('0x47')];if(!_0x441ffb[_0xc2f1('0x32')]['hasOwnProperty'](_0xc2f1('0x38'))){_0x215c83[_0xc2f1('0x23')]=qs['limit'](_0x441ffb[_0xc2f1('0x32')][_0xc2f1('0x23')]);_0x215c83[_0xc2f1('0x21')]=qs[_0xc2f1('0x21')](_0x441ffb[_0xc2f1('0x32')]['offset']);}return _0x5349eb[_0xc2f1('0x54')](_0x215c83);}})[_0xc2f1('0x29')](function(_0x296f27){if(_0x296f27){return _0x296f27?{'count':_0x3bbc19,'rows':_0x296f27}:null;}})[_0xc2f1('0x29')](respondWithResult(_0x2a20db,null))[_0xc2f1('0x44')](handleError(_0x2a20db,null));};exports[_0xc2f1('0x55')]=function(_0x5ad50f,_0x4c40ef,_0x31445a){var _0x495c7b={};var _0x52ccfd={};var _0x249531;var _0x5cb3a0;return db['ZendeskConfiguration'][_0xc2f1('0x4e')]({'where':{'id':_0x5ad50f[_0xc2f1('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c40ef,null))['then'](function(_0x413015){if(_0x413015){_0x249531=_0x413015;_0x52ccfd[_0xc2f1('0x31')]=_['keys'](db[_0xc2f1('0x56')][_0xc2f1('0x2e')]);_0x52ccfd[_0xc2f1('0x32')]=_['keys'](_0x5ad50f[_0xc2f1('0x32')]);_0x52ccfd[_0xc2f1('0x3b')]=_[_0xc2f1('0x34')](_0x52ccfd[_0xc2f1('0x31')],_0x52ccfd[_0xc2f1('0x32')]);_0x495c7b[_0xc2f1('0x36')]=_['intersection'](_0x52ccfd[_0xc2f1('0x31')],qs[_0xc2f1('0x35')](_0x5ad50f[_0xc2f1('0x32')]['fields']));_0x495c7b[_0xc2f1('0x36')]=_0x495c7b['attributes'][_0xc2f1('0x47')]?_0x495c7b[_0xc2f1('0x36')]:_0x52ccfd['model'];_0x495c7b[_0xc2f1('0x50')]=qs[_0xc2f1('0x39')](_0x5ad50f[_0xc2f1('0x32')][_0xc2f1('0x39')]);_0x495c7b[_0xc2f1('0x3a')]=qs[_0xc2f1('0x3b')](_[_0xc2f1('0x3c')](_0x5ad50f[_0xc2f1('0x32')],_0x52ccfd['filters']));if(_0x5ad50f[_0xc2f1('0x32')][_0xc2f1('0x3d')]){_0x495c7b[_0xc2f1('0x3a')]=_['merge'](_0x495c7b[_0xc2f1('0x3a')],{'$or':_[_0xc2f1('0x53')](_0x495c7b['attributes'],function(_0x29a9d9){var _0x101aec={};_0x101aec[_0x29a9d9]={'$like':'%'+_0x5ad50f['query'][_0xc2f1('0x3d')]+'%'};return _0x101aec;})});}_0x495c7b=_['merge']({},_0x495c7b,_0x5ad50f[_0xc2f1('0x48')]);return _0x249531[_0xc2f1('0x55')](_0x495c7b);}})['then'](function(_0x61a361){if(_0x61a361){_0x5cb3a0=_0x61a361['length'];if(!_0x5ad50f['query'][_0xc2f1('0x37')](_0xc2f1('0x38'))){_0x495c7b['limit']=qs[_0xc2f1('0x23')](_0x5ad50f['query'][_0xc2f1('0x23')]);_0x495c7b[_0xc2f1('0x21')]=qs['offset'](_0x5ad50f[_0xc2f1('0x32')][_0xc2f1('0x21')]);}return _0x249531['getTags'](_0x495c7b);}})[_0xc2f1('0x29')](function(_0x417476){if(_0x417476){return _0x417476?{'count':_0x5cb3a0,'rows':_0x417476}:null;}})[_0xc2f1('0x29')](respondWithResult(_0x4c40ef,null))[_0xc2f1('0x44')](handleError(_0x4c40ef,null));};exports[_0xc2f1('0x57')]=function(_0x5aee5f,_0x1b0ac9,_0x462633){if(_0x5aee5f['body']['id']){delete _0x5aee5f[_0xc2f1('0x4b')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5aee5f[_0xc2f1('0x46')]['id']}})[_0xc2f1('0x29')](handleEntityNotFound(_0x1b0ac9,null))[_0xc2f1('0x29')](function(_0x1c7b4a){if(_0x1c7b4a){return _0x1c7b4a[_0xc2f1('0x57')](_0x5aee5f[_0xc2f1('0x4b')]['ids']||[]);}return null;})[_0xc2f1('0x29')](respondWithResult(_0x1b0ac9,null))[_0xc2f1('0x44')](handleError(_0x1b0ac9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 66470d2..cec821a 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 _0xea28=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4d8117,_0xfce801){var _0x39c3a3=function(_0x28ec19){while(--_0x28ec19){_0x4d8117['push'](_0x4d8117['shift']());}};_0x39c3a3(++_0xfce801);}(_0xea28,0x13a));var _0x8ea2=function(_0x130d3d,_0x5dfe7f){_0x130d3d=_0x130d3d-0x0;var _0x548f57=_0xea28[_0x130d3d];return _0x548f57;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x1c4866,_0x255b66){var _0x4239e6=function(_0xb477fe){while(--_0xb477fe){_0x1c4866['push'](_0x1c4866['shift']());}};_0x4239e6(++_0x255b66);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 41b4bdb..d1ff5ce 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 _0xaae3=['../../config/environment','jayson/promise','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x10d9b3,_0x312fe9){var _0x779b20=function(_0x5e3e24){while(--_0x5e3e24){_0x10d9b3['push'](_0x10d9b3['shift']());}};_0x779b20(++_0x312fe9);}(_0xaae3,0xa2));var _0x3aae=function(_0x3064e7,_0x34edba){_0x3064e7=_0x3064e7-0x0;var _0x26038e=_0xaae3[_0x3064e7];return _0x26038e;};'use strict';var _=require('lodash');var util=require(_0x3aae('0x0'));var moment=require(_0x3aae('0x1'));var BPromise=require(_0x3aae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3aae('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3aae('0x4'))(_0x3aae('0x5'));var config=require(_0x3aae('0x6'));var jayson=require(_0x3aae('0x7'));var client=jayson[_0x3aae('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54ef1f,_0x1b2ce0,_0x3f987d){return new BPromise(function(_0x25e2e6,_0x3797d8){return client[_0x3aae('0x9')](_0x54ef1f,_0x3f987d)[_0x3aae('0xa')](function(_0x20b38c){logger[_0x3aae('0xb')](_0x3aae('0xc'),_0x1b2ce0,_0x3aae('0xd'));logger[_0x3aae('0xe')](_0x3aae('0xf'),_0x1b2ce0,_0x3aae('0xd'),JSON[_0x3aae('0x10')](_0x20b38c));if(_0x20b38c[_0x3aae('0x11')]){if(_0x20b38c[_0x3aae('0x11')][_0x3aae('0x12')]===0x1f4){logger[_0x3aae('0x11')](_0x3aae('0xc'),_0x1b2ce0,_0x20b38c['error']['message']);return _0x3797d8(_0x20b38c[_0x3aae('0x11')]['message']);}logger[_0x3aae('0x11')](_0x3aae('0xc'),_0x1b2ce0,_0x20b38c[_0x3aae('0x11')][_0x3aae('0x13')]);return _0x25e2e6(_0x20b38c[_0x3aae('0x11')]['message']);}else{logger[_0x3aae('0xb')](_0x3aae('0xc'),_0x1b2ce0,_0x3aae('0xd'));_0x25e2e6(_0x20b38c[_0x3aae('0x14')][_0x3aae('0x13')]);}})['catch'](function(_0x3ba526){logger[_0x3aae('0x11')](_0x3aae('0xc'),_0x1b2ce0,_0x3ba526);_0x3797d8(_0x3ba526);});});} \ No newline at end of file +var _0x8c05=['error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4ca3ac,_0x55f3d7){var _0x15ad24=function(_0x2c71eb){while(--_0x2c71eb){_0x4ca3ac['push'](_0x4ca3ac['shift']());}};_0x15ad24(++_0x55f3d7);}(_0x8c05,0x108));var _0x58c0=function(_0x4e91ba,_0x4d7833){_0x4e91ba=_0x4e91ba-0x0;var _0x5007cf=_0x8c05[_0x4e91ba];return _0x5007cf;};'use strict';var _=require(_0x58c0('0x0'));var util=require('util');var moment=require(_0x58c0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58c0('0x2'))['db'];var utils=require(_0x58c0('0x3'));var logger=require(_0x58c0('0x4'))(_0x58c0('0x5'));var config=require(_0x58c0('0x6'));var jayson=require(_0x58c0('0x7'));var client=jayson[_0x58c0('0x8')][_0x58c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xee6519,_0x2232cc,_0x1afb3f){return new BPromise(function(_0x1154a9,_0x4c8ec4){return client[_0x58c0('0xa')](_0xee6519,_0x1afb3f)['then'](function(_0x37eb70){logger[_0x58c0('0xb')](_0x58c0('0xc'),_0x2232cc,'request\x20sent');logger['debug'](_0x58c0('0xd'),_0x2232cc,_0x58c0('0xe'),JSON[_0x58c0('0xf')](_0x37eb70));if(_0x37eb70[_0x58c0('0x10')]){if(_0x37eb70[_0x58c0('0x10')][_0x58c0('0x11')]===0x1f4){logger[_0x58c0('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2232cc,_0x37eb70[_0x58c0('0x10')][_0x58c0('0x12')]);return _0x4c8ec4(_0x37eb70[_0x58c0('0x10')][_0x58c0('0x12')]);}logger['error'](_0x58c0('0xc'),_0x2232cc,_0x37eb70[_0x58c0('0x10')]['message']);return _0x1154a9(_0x37eb70['error'][_0x58c0('0x12')]);}else{logger[_0x58c0('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2232cc,'request\x20sent');_0x1154a9(_0x37eb70['result'][_0x58c0('0x12')]);}})[_0x58c0('0x13')](function(_0x5bc9a6){logger['error'](_0x58c0('0xc'),_0x2232cc,_0x5bc9a6);_0x4c8ec4(_0x5bc9a6);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ce24ea7..dcb1bd1 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 _0xb693=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','get'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xb693,0x1c1));var _0x3b69=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xb693[_0x40aaa4];return _0x4e21e5;};'use strict';var multer=require(_0x3b69('0x0'));var util=require(_0x3b69('0x1'));var path=require(_0x3b69('0x2'));var timeout=require(_0x3b69('0x3'));var express=require(_0x3b69('0x4'));var router=express[_0x3b69('0x5')]();var fs_extra=require(_0x3b69('0x6'));var auth=require(_0x3b69('0x7'));var interaction=require(_0x3b69('0x8'));var config=require('../../config/environment');var controller=require(_0x3b69('0x9'));router['get']('/',auth[_0x3b69('0xa')](),controller[_0x3b69('0xb')]);router[_0x3b69('0xc')](_0x3b69('0xd'),auth[_0x3b69('0xa')](),controller[_0x3b69('0xe')]);router[_0x3b69('0xf')]('/',auth[_0x3b69('0xa')](),controller[_0x3b69('0x10')]);router['put'](_0x3b69('0xd'),auth[_0x3b69('0xa')](),controller[_0x3b69('0x11')]);router[_0x3b69('0x12')](_0x3b69('0xd'),auth[_0x3b69('0xa')](),controller[_0x3b69('0x13')]);module[_0x3b69('0x14')]=router; \ No newline at end of file +var _0xd686=['./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xd686,0x75));var _0x6d68=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xd686[_0xa30766];return _0x24e780;};'use strict';var multer=require(_0x6d68('0x0'));var util=require(_0x6d68('0x1'));var path=require(_0x6d68('0x2'));var timeout=require(_0x6d68('0x3'));var express=require('express');var router=express[_0x6d68('0x4')]();var fs_extra=require(_0x6d68('0x5'));var auth=require(_0x6d68('0x6'));var interaction=require(_0x6d68('0x7'));var config=require(_0x6d68('0x8'));var controller=require(_0x6d68('0x9'));router[_0x6d68('0xa')]('/',auth[_0x6d68('0xb')](),controller[_0x6d68('0xc')]);router[_0x6d68('0xa')](_0x6d68('0xd'),auth[_0x6d68('0xb')](),controller[_0x6d68('0xe')]);router[_0x6d68('0xf')]('/',auth['isAuthenticated'](),controller[_0x6d68('0x10')]);router[_0x6d68('0x11')](_0x6d68('0xd'),auth[_0x6d68('0xb')](),controller[_0x6d68('0x12')]);router[_0x6d68('0x13')](_0x6d68('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x6d68('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index afd6dd2..83fbebd 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 _0xfeb2=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x16a197,_0x17a01a){var _0x3233e1=function(_0x5b1f1d){while(--_0x5b1f1d){_0x16a197['push'](_0x16a197['shift']());}};_0x3233e1(++_0x17a01a);}(_0xfeb2,0x110));var _0x2feb=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0xfeb2[_0x30faee];return _0x3a90ab;};'use strict';var Sequelize=require(_0x2feb('0x0'));module[_0x2feb('0x1')]={'type':{'type':Sequelize[_0x2feb('0x2')](_0x2feb('0x3'),_0x2feb('0x4'),_0x2feb('0x5'),_0x2feb('0x6'),'picklist'),'defaultValue':_0x2feb('0x3')},'content':{'type':Sequelize[_0x2feb('0x7')]},'key':{'type':Sequelize[_0x2feb('0x7')]},'keyType':{'type':Sequelize[_0x2feb('0x2')]('string',_0x2feb('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x2feb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2feb('0x7')]}}; \ No newline at end of file +var _0x8c02=['picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x8c02,0x145));var _0x28c0=function(_0x2aecfe,_0x19e2aa){_0x2aecfe=_0x2aecfe-0x0;var _0xec5e16=_0x8c02[_0x2aecfe];return _0xec5e16;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x28c0('0x0')](_0x28c0('0x1'),_0x28c0('0x2'),_0x28c0('0x3'),'keyValue',_0x28c0('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x28c0('0x5')]},'key':{'type':Sequelize[_0x28c0('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x28c0('0x5')]},'nameField':{'type':Sequelize[_0x28c0('0x5')]},'customField':{'type':Sequelize[_0x28c0('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x28c0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6adaa9c..6737e84 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 _0x3889=['merge','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter'];(function(_0x30374d,_0x5782f2){var _0xc899b9=function(_0x325040){while(--_0x325040){_0x30374d['push'](_0x30374d['shift']());}};_0xc899b9(++_0x5782f2);}(_0x3889,0x1c2));var _0x9388=function(_0x505ce4,_0x4c7f7f){_0x505ce4=_0x505ce4-0x0;var _0x5e33ef=_0x3889[_0x505ce4];return _0x5e33ef;};'use strict';var emlformat=require(_0x9388('0x0'));var rimraf=require(_0x9388('0x1'));var zipdir=require(_0x9388('0x2'));var jsonpatch=require(_0x9388('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9388('0x4'));var Mustache=require(_0x9388('0x5'));var util=require(_0x9388('0x6'));var path=require(_0x9388('0x7'));var sox=require('sox');var csv=require(_0x9388('0x8'));var ejs=require(_0x9388('0x9'));var fs=require('fs');var fs_extra=require(_0x9388('0xa'));var _=require(_0x9388('0xb'));var squel=require(_0x9388('0xc'));var crypto=require(_0x9388('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9388('0xe'));var toCsv=require(_0x9388('0x8'));var querystring=require(_0x9388('0xf'));var Papa=require(_0x9388('0x10'));var Redis=require('ioredis');var authService=require(_0x9388('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9388('0x12'));var utils=require(_0x9388('0x13'));var config=require(_0x9388('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9388('0x15'))['db'];function respondWithStatusCode(_0x5cffcb,_0x38359d){_0x38359d=_0x38359d||0xcc;return function(_0x56e0c3){if(_0x56e0c3){return _0x5cffcb[_0x9388('0x16')](_0x38359d);}return _0x5cffcb[_0x9388('0x17')](_0x38359d)[_0x9388('0x18')]();};}function respondWithResult(_0x38b1ed,_0x266929){_0x266929=_0x266929||0xc8;return function(_0x3f156e){if(_0x3f156e){return _0x38b1ed[_0x9388('0x17')](_0x266929)[_0x9388('0x19')](_0x3f156e);}};}function respondWithFilteredResult(_0x5472b7,_0x28710b){return function(_0x300c5a){if(_0x300c5a){var _0x320f5c=typeof _0x28710b[_0x9388('0x1a')]===_0x9388('0x1b')&&typeof _0x28710b['limit']===_0x9388('0x1b');var _0x9b4c18=_0x300c5a[_0x9388('0x1c')];var _0x1db29b=_0x320f5c?0x0:_0x28710b['offset'];var _0x253afb=_0x320f5c?_0x300c5a[_0x9388('0x1c')]:_0x28710b[_0x9388('0x1a')]+_0x28710b[_0x9388('0x1d')];var _0x3f28e3;if(_0x253afb>=_0x9b4c18){_0x253afb=_0x9b4c18;_0x3f28e3=0xc8;}else{_0x3f28e3=0xce;}_0x5472b7['status'](_0x3f28e3);return _0x5472b7[_0x9388('0x1e')](_0x9388('0x1f'),_0x1db29b+'-'+_0x253afb+'/'+_0x9b4c18)[_0x9388('0x19')](_0x300c5a);}return null;};}function patchUpdates(_0x3193fe){return function(_0x4170c8){try{jsonpatch[_0x9388('0x20')](_0x4170c8,_0x3193fe,!![]);}catch(_0x2aa2e4){return BPromise['reject'](_0x2aa2e4);}return _0x4170c8[_0x9388('0x21')]();};}function saveUpdates(_0x4815fc,_0x2929a5){return function(_0x4a158b){if(_0x4a158b){return _0x4a158b[_0x9388('0x22')](_0x4815fc)[_0x9388('0x23')](function(_0x3ac4e0){return _0x3ac4e0;});}return null;};}function removeEntity(_0x46e8fa,_0x10eeb9){return function(_0x395132){if(_0x395132){return _0x395132[_0x9388('0x24')]()['then'](function(){_0x46e8fa[_0x9388('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ebd8,_0x3f3f44){return function(_0x4ec68b){if(!_0x4ec68b){_0x36ebd8[_0x9388('0x16')](0x194);}return _0x4ec68b;};}function handleError(_0x374587,_0x4edebb){_0x4edebb=_0x4edebb||0x1f4;return function(_0x2ff963){logger['error'](_0x2ff963[_0x9388('0x25')]);if(_0x2ff963[_0x9388('0x26')]){delete _0x2ff963[_0x9388('0x26')];}_0x374587['status'](_0x4edebb)[_0x9388('0x27')](_0x2ff963);};}exports[_0x9388('0x28')]=function(_0x1ed685,_0x44fd65){var _0x157087={},_0x19eaab={},_0x199bd9={'count':0x0,'rows':[]};var _0x32cb2a=_[_0x9388('0x29')](db[_0x9388('0x2a')][_0x9388('0x2b')],function(_0x1123fb){return{'name':_0x1123fb[_0x9388('0x2c')],'type':_0x1123fb[_0x9388('0x2d')][_0x9388('0x2e')]};});_0x19eaab[_0x9388('0x2f')]=_['map'](_0x32cb2a,_0x9388('0x26'));_0x19eaab[_0x9388('0x30')]=_[_0x9388('0x31')](_0x1ed685['query']);_0x19eaab['filters']=_[_0x9388('0x32')](_0x19eaab[_0x9388('0x2f')],_0x19eaab[_0x9388('0x30')]);_0x157087[_0x9388('0x33')]=_['intersection'](_0x19eaab[_0x9388('0x2f')],qs['fields'](_0x1ed685[_0x9388('0x30')][_0x9388('0x34')]));_0x157087[_0x9388('0x33')]=_0x157087[_0x9388('0x33')][_0x9388('0x35')]?_0x157087['attributes']:_0x19eaab['model'];if(!_0x1ed685[_0x9388('0x30')][_0x9388('0x36')](_0x9388('0x37'))){_0x157087[_0x9388('0x1d')]=qs[_0x9388('0x1d')](_0x1ed685['query'][_0x9388('0x1d')]);_0x157087[_0x9388('0x1a')]=qs[_0x9388('0x1a')](_0x1ed685[_0x9388('0x30')][_0x9388('0x1a')]);}_0x157087[_0x9388('0x38')]=qs[_0x9388('0x39')](_0x1ed685['query']['sort']);_0x157087[_0x9388('0x3a')]=qs[_0x9388('0x3b')](_['pick'](_0x1ed685[_0x9388('0x30')],_0x19eaab[_0x9388('0x3b')]),_0x32cb2a);if(_0x1ed685[_0x9388('0x30')][_0x9388('0x3c')]){_0x157087[_0x9388('0x3a')]=_[_0x9388('0x3d')](_0x157087[_0x9388('0x3a')],{'$or':_[_0x9388('0x29')](_0x32cb2a,function(_0x2e95de){if(_0x2e95de[_0x9388('0x2d')]!==_0x9388('0x3e')){var _0x395094={};_0x395094[_0x2e95de[_0x9388('0x26')]]={'$like':'%'+_0x1ed685[_0x9388('0x30')][_0x9388('0x3c')]+'%'};return _0x395094;}})});}_0x157087=_[_0x9388('0x3d')]({},_0x157087,_0x1ed685[_0x9388('0x3f')]);var _0x3017ee={'where':_0x157087[_0x9388('0x3a')]};return db[_0x9388('0x2a')][_0x9388('0x1c')](_0x3017ee)[_0x9388('0x23')](function(_0x3d8709){_0x199bd9[_0x9388('0x1c')]=_0x3d8709;if(_0x1ed685['query'][_0x9388('0x40')]){_0x157087[_0x9388('0x41')]=[{'all':!![]}];}return db[_0x9388('0x2a')]['findAll'](_0x157087);})['then'](function(_0x2cf224){_0x199bd9[_0x9388('0x42')]=_0x2cf224;return _0x199bd9;})['then'](respondWithFilteredResult(_0x44fd65,_0x157087))['catch'](handleError(_0x44fd65,null));};exports[_0x9388('0x43')]=function(_0x5962b7,_0x5e0c7){var _0x1573cc={'raw':!![],'where':{'id':_0x5962b7['params']['id']}},_0x14ceca={};_0x14ceca[_0x9388('0x2f')]=_[_0x9388('0x31')](db[_0x9388('0x2a')][_0x9388('0x2b')]);_0x14ceca[_0x9388('0x30')]=_[_0x9388('0x31')](_0x5962b7[_0x9388('0x30')]);_0x14ceca[_0x9388('0x3b')]=_[_0x9388('0x32')](_0x14ceca[_0x9388('0x2f')],_0x14ceca[_0x9388('0x30')]);_0x1573cc[_0x9388('0x33')]=_[_0x9388('0x32')](_0x14ceca['model'],qs['fields'](_0x5962b7[_0x9388('0x30')][_0x9388('0x34')]));_0x1573cc[_0x9388('0x33')]=_0x1573cc[_0x9388('0x33')][_0x9388('0x35')]?_0x1573cc['attributes']:_0x14ceca[_0x9388('0x2f')];if(_0x5962b7[_0x9388('0x30')][_0x9388('0x40')]){_0x1573cc[_0x9388('0x41')]=[{'all':!![]}];}_0x1573cc=_['merge']({},_0x1573cc,_0x5962b7[_0x9388('0x3f')]);return db[_0x9388('0x2a')][_0x9388('0x44')](_0x1573cc)['then'](handleEntityNotFound(_0x5e0c7,null))[_0x9388('0x23')](respondWithResult(_0x5e0c7,null))[_0x9388('0x45')](handleError(_0x5e0c7,null));};exports['create']=function(_0x134d4d,_0x3b5584){return db[_0x9388('0x2a')][_0x9388('0x46')](_0x134d4d[_0x9388('0x47')],{})[_0x9388('0x23')](respondWithResult(_0x3b5584,0xc9))[_0x9388('0x45')](handleError(_0x3b5584,null));};exports[_0x9388('0x22')]=function(_0x42cf9a,_0x48be2f){if(_0x42cf9a[_0x9388('0x47')]['id']){delete _0x42cf9a[_0x9388('0x47')]['id'];}return db[_0x9388('0x2a')][_0x9388('0x44')]({'where':{'id':_0x42cf9a[_0x9388('0x48')]['id']}})['then'](handleEntityNotFound(_0x48be2f,null))[_0x9388('0x23')](saveUpdates(_0x42cf9a[_0x9388('0x47')],null))[_0x9388('0x23')](respondWithResult(_0x48be2f,null))[_0x9388('0x45')](handleError(_0x48be2f,null));};exports[_0x9388('0x24')]=function(_0x26ce89,_0x1a3fda){return db[_0x9388('0x2a')]['find']({'where':{'id':_0x26ce89[_0x9388('0x48')]['id']}})[_0x9388('0x23')](handleEntityNotFound(_0x1a3fda,null))[_0x9388('0x23')](removeEntity(_0x1a3fda,null))[_0x9388('0x45')](handleError(_0x1a3fda,null));}; \ No newline at end of file +var _0xeb8c=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','ZendeskField','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox'];(function(_0x242ec4,_0x43e8d2){var _0x58802d=function(_0x12bc7c){while(--_0x12bc7c){_0x242ec4['push'](_0x242ec4['shift']());}};_0x58802d(++_0x43e8d2);}(_0xeb8c,0x170));var _0xceb8=function(_0x5977db,_0x96b09a){_0x5977db=_0x5977db-0x0;var _0x5510d6=_0xeb8c[_0x5977db];return _0x5510d6;};'use strict';var emlformat=require(_0xceb8('0x0'));var rimraf=require(_0xceb8('0x1'));var zipdir=require(_0xceb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xceb8('0x3'));var BPromise=require(_0xceb8('0x4'));var Mustache=require(_0xceb8('0x5'));var util=require('util');var path=require('path');var sox=require(_0xceb8('0x6'));var csv=require('to-csv');var ejs=require(_0xceb8('0x7'));var fs=require('fs');var fs_extra=require(_0xceb8('0x8'));var _=require(_0xceb8('0x9'));var squel=require(_0xceb8('0xa'));var crypto=require('crypto');var jsforce=require(_0xceb8('0xb'));var deskjs=require(_0xceb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xceb8('0xd'));var Papa=require(_0xceb8('0xe'));var Redis=require(_0xceb8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xceb8('0x10'));var as=require(_0xceb8('0x11'));var hardwareService=require(_0xceb8('0x12'));var logger=require(_0xceb8('0x13'))(_0xceb8('0x14'));var utils=require(_0xceb8('0x15'));var config=require(_0xceb8('0x16'));var licenseUtil=require(_0xceb8('0x17'));var db=require(_0xceb8('0x18'))['db'];function respondWithStatusCode(_0x14003d,_0x4c662d){_0x4c662d=_0x4c662d||0xcc;return function(_0x1815bd){if(_0x1815bd){return _0x14003d[_0xceb8('0x19')](_0x4c662d);}return _0x14003d[_0xceb8('0x1a')](_0x4c662d)['end']();};}function respondWithResult(_0x1e8af2,_0x576910){_0x576910=_0x576910||0xc8;return function(_0x442f0d){if(_0x442f0d){return _0x1e8af2[_0xceb8('0x1a')](_0x576910)['json'](_0x442f0d);}};}function respondWithFilteredResult(_0x306ef0,_0x12e8e0){return function(_0xe68e20){if(_0xe68e20){var _0x550887=typeof _0x12e8e0['offset']===_0xceb8('0x1b')&&typeof _0x12e8e0[_0xceb8('0x1c')]===_0xceb8('0x1b');var _0x790c3f=_0xe68e20[_0xceb8('0x1d')];var _0x15ee47=_0x550887?0x0:_0x12e8e0[_0xceb8('0x1e')];var _0x304899=_0x550887?_0xe68e20[_0xceb8('0x1d')]:_0x12e8e0[_0xceb8('0x1e')]+_0x12e8e0['limit'];var _0x57a92e;if(_0x304899>=_0x790c3f){_0x304899=_0x790c3f;_0x57a92e=0xc8;}else{_0x57a92e=0xce;}_0x306ef0['status'](_0x57a92e);return _0x306ef0['set'](_0xceb8('0x1f'),_0x15ee47+'-'+_0x304899+'/'+_0x790c3f)[_0xceb8('0x20')](_0xe68e20);}return null;};}function patchUpdates(_0x3b2f9d){return function(_0x42db02){try{jsonpatch[_0xceb8('0x21')](_0x42db02,_0x3b2f9d,!![]);}catch(_0xcb192f){return BPromise[_0xceb8('0x22')](_0xcb192f);}return _0x42db02[_0xceb8('0x23')]();};}function saveUpdates(_0x2faa80,_0x275736){return function(_0x5a8342){if(_0x5a8342){return _0x5a8342[_0xceb8('0x24')](_0x2faa80)[_0xceb8('0x25')](function(_0x2bd762){return _0x2bd762;});}return null;};}function removeEntity(_0x103b4f,_0x2c7d76){return function(_0x5ba4d8){if(_0x5ba4d8){return _0x5ba4d8[_0xceb8('0x26')]()['then'](function(){_0x103b4f[_0xceb8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x979bc2,_0x517239){return function(_0x26723e){if(!_0x26723e){_0x979bc2[_0xceb8('0x19')](0x194);}return _0x26723e;};}function handleError(_0x415fbb,_0x256eb5){_0x256eb5=_0x256eb5||0x1f4;return function(_0x36476d){logger[_0xceb8('0x27')](_0x36476d[_0xceb8('0x28')]);if(_0x36476d['name']){delete _0x36476d['name'];}_0x415fbb['status'](_0x256eb5)[_0xceb8('0x29')](_0x36476d);};}exports['index']=function(_0x50d9d9,_0x49876b){var _0x2db98a={},_0x826b1b={},_0x39423c={'count':0x0,'rows':[]};var _0x39c3bd=_['map'](db[_0xceb8('0x2a')][_0xceb8('0x2b')],function(_0x45ed69){return{'name':_0x45ed69[_0xceb8('0x2c')],'type':_0x45ed69['type'][_0xceb8('0x2d')]};});_0x826b1b[_0xceb8('0x2e')]=_['map'](_0x39c3bd,_0xceb8('0x2f'));_0x826b1b[_0xceb8('0x30')]=_[_0xceb8('0x31')](_0x50d9d9[_0xceb8('0x30')]);_0x826b1b[_0xceb8('0x32')]=_['intersection'](_0x826b1b[_0xceb8('0x2e')],_0x826b1b[_0xceb8('0x30')]);_0x2db98a[_0xceb8('0x33')]=_[_0xceb8('0x34')](_0x826b1b[_0xceb8('0x2e')],qs['fields'](_0x50d9d9['query'][_0xceb8('0x35')]));_0x2db98a[_0xceb8('0x33')]=_0x2db98a['attributes']['length']?_0x2db98a[_0xceb8('0x33')]:_0x826b1b[_0xceb8('0x2e')];if(!_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x36')](_0xceb8('0x37'))){_0x2db98a[_0xceb8('0x1c')]=qs[_0xceb8('0x1c')](_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x1c')]);_0x2db98a['offset']=qs[_0xceb8('0x1e')](_0x50d9d9[_0xceb8('0x30')]['offset']);}_0x2db98a['order']=qs['sort'](_0x50d9d9['query'][_0xceb8('0x38')]);_0x2db98a[_0xceb8('0x39')]=qs[_0xceb8('0x32')](_[_0xceb8('0x3a')](_0x50d9d9[_0xceb8('0x30')],_0x826b1b[_0xceb8('0x32')]),_0x39c3bd);if(_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x3b')]){_0x2db98a[_0xceb8('0x39')]=_[_0xceb8('0x3c')](_0x2db98a[_0xceb8('0x39')],{'$or':_[_0xceb8('0x3d')](_0x39c3bd,function(_0x5c35a0){if(_0x5c35a0[_0xceb8('0x3e')]!=='VIRTUAL'){var _0x3562eb={};_0x3562eb[_0x5c35a0[_0xceb8('0x2f')]]={'$like':'%'+_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x3b')]+'%'};return _0x3562eb;}})});}_0x2db98a=_[_0xceb8('0x3c')]({},_0x2db98a,_0x50d9d9[_0xceb8('0x3f')]);var _0x1dad9d={'where':_0x2db98a['where']};return db['ZendeskField'][_0xceb8('0x1d')](_0x1dad9d)[_0xceb8('0x25')](function(_0x2891d9){_0x39423c[_0xceb8('0x1d')]=_0x2891d9;if(_0x50d9d9[_0xceb8('0x30')][_0xceb8('0x40')]){_0x2db98a['include']=[{'all':!![]}];}return db['ZendeskField'][_0xceb8('0x41')](_0x2db98a);})['then'](function(_0x5836e5){_0x39423c[_0xceb8('0x42')]=_0x5836e5;return _0x39423c;})['then'](respondWithFilteredResult(_0x49876b,_0x2db98a))[_0xceb8('0x43')](handleError(_0x49876b,null));};exports[_0xceb8('0x44')]=function(_0x185bbf,_0x59e269){var _0x492340={'raw':!![],'where':{'id':_0x185bbf[_0xceb8('0x45')]['id']}},_0x1c49c1={};_0x1c49c1[_0xceb8('0x2e')]=_[_0xceb8('0x31')](db[_0xceb8('0x2a')]['rawAttributes']);_0x1c49c1[_0xceb8('0x30')]=_[_0xceb8('0x31')](_0x185bbf['query']);_0x1c49c1[_0xceb8('0x32')]=_[_0xceb8('0x34')](_0x1c49c1[_0xceb8('0x2e')],_0x1c49c1[_0xceb8('0x30')]);_0x492340[_0xceb8('0x33')]=_[_0xceb8('0x34')](_0x1c49c1[_0xceb8('0x2e')],qs[_0xceb8('0x35')](_0x185bbf[_0xceb8('0x30')]['fields']));_0x492340[_0xceb8('0x33')]=_0x492340[_0xceb8('0x33')][_0xceb8('0x46')]?_0x492340[_0xceb8('0x33')]:_0x1c49c1['model'];if(_0x185bbf[_0xceb8('0x30')][_0xceb8('0x40')]){_0x492340[_0xceb8('0x47')]=[{'all':!![]}];}_0x492340=_[_0xceb8('0x3c')]({},_0x492340,_0x185bbf['options']);return db['ZendeskField'][_0xceb8('0x48')](_0x492340)[_0xceb8('0x25')](handleEntityNotFound(_0x59e269,null))['then'](respondWithResult(_0x59e269,null))['catch'](handleError(_0x59e269,null));};exports[_0xceb8('0x49')]=function(_0x3e94d4,_0xdefa76){return db[_0xceb8('0x2a')]['create'](_0x3e94d4[_0xceb8('0x4a')],{})[_0xceb8('0x25')](respondWithResult(_0xdefa76,0xc9))[_0xceb8('0x43')](handleError(_0xdefa76,null));};exports[_0xceb8('0x24')]=function(_0x2f6d4a,_0x31e422){if(_0x2f6d4a[_0xceb8('0x4a')]['id']){delete _0x2f6d4a[_0xceb8('0x4a')]['id'];}return db['ZendeskField'][_0xceb8('0x48')]({'where':{'id':_0x2f6d4a[_0xceb8('0x45')]['id']}})[_0xceb8('0x25')](handleEntityNotFound(_0x31e422,null))[_0xceb8('0x25')](saveUpdates(_0x2f6d4a[_0xceb8('0x4a')],null))[_0xceb8('0x25')](respondWithResult(_0x31e422,null))[_0xceb8('0x43')](handleError(_0x31e422,null));};exports[_0xceb8('0x26')]=function(_0x559d82,_0x135234){return db['ZendeskField']['find']({'where':{'id':_0x559d82[_0xceb8('0x45')]['id']}})[_0xceb8('0x25')](handleEntityNotFound(_0x135234,null))[_0xceb8('0x25')](removeEntity(_0x135234,null))[_0xceb8('0x43')](handleError(_0x135234,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7d22746..325650d 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 _0x25da=['zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x25da,0x14c));var _0xa25d=function(_0x47a3d9,_0x2b6c75){_0x47a3d9=_0x47a3d9-0x0;var _0x68d5a6=_0x25da[_0x47a3d9];return _0x68d5a6;};'use strict';var _=require(_0xa25d('0x0'));var util=require(_0xa25d('0x1'));var logger=require(_0xa25d('0x2'))(_0xa25d('0x3'));var moment=require(_0xa25d('0x4'));var BPromise=require(_0xa25d('0x5'));var rp=require(_0xa25d('0x6'));var fs=require('fs');var path=require(_0xa25d('0x7'));var rimraf=require(_0xa25d('0x8'));var config=require('../../config/environment');var attributes=require(_0xa25d('0x9'));module[_0xa25d('0xa')]=function(_0x49b86b,_0x1022ef){return _0x49b86b['define'](_0xa25d('0xb'),attributes,{'tableName':_0xa25d('0xc'),'paranoid':![],'indexes':[{'name':_0xa25d('0xd'),'fields':['idField',_0xa25d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02f5=['./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4053cf,_0x14397f){var _0x3bf960=function(_0x59ede5){while(--_0x59ede5){_0x4053cf['push'](_0x4053cf['shift']());}};_0x3bf960(++_0x14397f);}(_0x02f5,0x92));var _0x502f=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x02f5[_0x29db36];return _0x234e87;};'use strict';var _=require(_0x502f('0x0'));var util=require(_0x502f('0x1'));var logger=require('../../config/logger')(_0x502f('0x2'));var moment=require('moment');var BPromise=require(_0x502f('0x3'));var rp=require(_0x502f('0x4'));var fs=require('fs');var path=require(_0x502f('0x5'));var rimraf=require(_0x502f('0x6'));var config=require(_0x502f('0x7'));var attributes=require(_0x502f('0x8'));module['exports']=function(_0x2444f8,_0x2337d7){return _0x2444f8[_0x502f('0x9')](_0x502f('0xa'),attributes,{'tableName':_0x502f('0xb'),'paranoid':![],'indexes':[{'name':_0x502f('0xc'),'fields':[_0x502f('0xd'),'FieldId'],'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 cfb0adb..7a3876a 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 _0xc636=['info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xc636,0x11a));var _0x6c63=function(_0x3955ec,_0x3337ea){_0x3955ec=_0x3955ec-0x0;var _0x36dc80=_0xc636[_0x3955ec];return _0x36dc80;};'use strict';var _=require(_0x6c63('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6c63('0x1'));var rs=require(_0x6c63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c63('0x4'))(_0x6c63('0x5'));var config=require(_0x6c63('0x6'));var jayson=require(_0x6c63('0x7'));var client=jayson[_0x6c63('0x8')][_0x6c63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48fc11,_0x1275e2,_0x2d7034){return new BPromise(function(_0x3aa5c4,_0x522b96){return client[_0x6c63('0xa')](_0x48fc11,_0x2d7034)[_0x6c63('0xb')](function(_0x23806c){logger[_0x6c63('0xc')](_0x6c63('0xd'),_0x1275e2,'request\x20sent');logger[_0x6c63('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x1275e2,_0x6c63('0xf'),JSON['stringify'](_0x23806c));if(_0x23806c[_0x6c63('0x10')]){if(_0x23806c['error'][_0x6c63('0x11')]===0x1f4){logger[_0x6c63('0x10')]('ZendeskField,\x20%s,\x20%s',_0x1275e2,_0x23806c['error']['message']);return _0x522b96(_0x23806c[_0x6c63('0x10')][_0x6c63('0x12')]);}logger[_0x6c63('0x10')]('ZendeskField,\x20%s,\x20%s',_0x1275e2,_0x23806c[_0x6c63('0x10')]['message']);return _0x3aa5c4(_0x23806c[_0x6c63('0x10')][_0x6c63('0x12')]);}else{logger[_0x6c63('0xc')](_0x6c63('0xd'),_0x1275e2,_0x6c63('0xf'));_0x3aa5c4(_0x23806c[_0x6c63('0x13')]['message']);}})[_0x6c63('0x14')](function(_0x4b7688){logger[_0x6c63('0x10')](_0x6c63('0xd'),_0x1275e2,_0x4b7688);_0x522b96(_0x4b7688);});});} \ No newline at end of file +var _0xa9f5=['../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis'];(function(_0x1c463a,_0xf94fa8){var _0x4b80c4=function(_0x2489d7){while(--_0x2489d7){_0x1c463a['push'](_0x1c463a['shift']());}};_0x4b80c4(++_0xf94fa8);}(_0xa9f5,0xea));var _0x5a9f=function(_0x4f1b36,_0x46c41a){_0x4f1b36=_0x4f1b36-0x0;var _0x2b0391=_0xa9f5[_0x4f1b36];return _0x2b0391;};'use strict';var _=require(_0x5a9f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5a9f('0x1'));var rs=require(_0x5a9f('0x2'));var fs=require('fs');var Redis=require(_0x5a9f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a9f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5a9f('0x5'));var jayson=require(_0x5a9f('0x6'));var client=jayson[_0x5a9f('0x7')][_0x5a9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fcfc0,_0x2a1162,_0x409734){return new BPromise(function(_0x28a415,_0x416d21){return client['request'](_0x3fcfc0,_0x409734)['then'](function(_0x33d8e4){logger[_0x5a9f('0x9')]('ZendeskField,\x20%s,\x20%s',_0x2a1162,_0x5a9f('0xa'));logger['debug'](_0x5a9f('0xb'),_0x2a1162,_0x5a9f('0xa'),JSON[_0x5a9f('0xc')](_0x33d8e4));if(_0x33d8e4['error']){if(_0x33d8e4[_0x5a9f('0xd')][_0x5a9f('0xe')]===0x1f4){logger[_0x5a9f('0xd')](_0x5a9f('0xf'),_0x2a1162,_0x33d8e4[_0x5a9f('0xd')][_0x5a9f('0x10')]);return _0x416d21(_0x33d8e4[_0x5a9f('0xd')][_0x5a9f('0x10')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x2a1162,_0x33d8e4[_0x5a9f('0xd')][_0x5a9f('0x10')]);return _0x28a415(_0x33d8e4['error'][_0x5a9f('0x10')]);}else{logger[_0x5a9f('0x9')](_0x5a9f('0xf'),_0x2a1162,'request\x20sent');_0x28a415(_0x33d8e4['result'][_0x5a9f('0x10')]);}})['catch'](function(_0x4a2baf){logger[_0x5a9f('0xd')](_0x5a9f('0xf'),_0x2a1162,_0x4a2baf);_0x416d21(_0x4a2baf);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 099c69f..bbca2ba 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 _0x6a92=['put','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x6a92,0x13f));var _0x26a9=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x6a92[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0x26a9('0x0'));var util=require(_0x26a9('0x1'));var path=require(_0x26a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x26a9('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x26a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x26a9('0x5'));var controller=require(_0x26a9('0x6'));router['get']('/',auth[_0x26a9('0x7')](),controller[_0x26a9('0x8')]);router[_0x26a9('0x9')]('/:id',auth[_0x26a9('0x7')](),controller[_0x26a9('0xa')]);router[_0x26a9('0x9')](_0x26a9('0xb'),auth[_0x26a9('0x7')](),controller[_0x26a9('0xc')]);router['get']('/:id/fields',auth[_0x26a9('0x7')](),controller[_0x26a9('0xd')]);router[_0x26a9('0xe')]('/',auth['isAuthenticated'](),controller[_0x26a9('0xf')]);router[_0x26a9('0xe')](_0x26a9('0xb'),auth[_0x26a9('0x7')](),controller[_0x26a9('0x10')]);router[_0x26a9('0x11')](_0x26a9('0x12'),auth[_0x26a9('0x7')](),controller['update']);router['delete'](_0x26a9('0x12'),auth[_0x26a9('0x7')](),controller[_0x26a9('0x13')]);module[_0x26a9('0x14')]=router; \ No newline at end of file +var _0x7c7e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','util','path','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c7e,0x1ab));var _0xe7c7=function(_0x3bb6e6,_0x2a552f){_0x3bb6e6=_0x3bb6e6-0x0;var _0x5a0258=_0x7c7e[_0x3bb6e6];return _0x5a0258;};'use strict';var multer=require('multer');var util=require(_0xe7c7('0x0'));var path=require(_0xe7c7('0x1'));var timeout=require(_0xe7c7('0x2'));var express=require(_0xe7c7('0x3'));var router=express[_0xe7c7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7c7('0x5'));var interaction=require(_0xe7c7('0x6'));var config=require(_0xe7c7('0x7'));var controller=require(_0xe7c7('0x8'));router[_0xe7c7('0x9')]('/',auth[_0xe7c7('0xa')](),controller[_0xe7c7('0xb')]);router[_0xe7c7('0x9')](_0xe7c7('0xc'),auth[_0xe7c7('0xa')](),controller[_0xe7c7('0xd')]);router['get'](_0xe7c7('0xe'),auth[_0xe7c7('0xa')](),controller[_0xe7c7('0xf')]);router[_0xe7c7('0x9')](_0xe7c7('0x10'),auth[_0xe7c7('0xa')](),controller[_0xe7c7('0x11')]);router['post']('/',auth[_0xe7c7('0xa')](),controller[_0xe7c7('0x12')]);router[_0xe7c7('0x13')](_0xe7c7('0xe'),auth['isAuthenticated'](),controller[_0xe7c7('0x14')]);router[_0xe7c7('0x15')](_0xe7c7('0xc'),auth[_0xe7c7('0xa')](),controller[_0xe7c7('0x16')]);router['delete'](_0xe7c7('0xc'),auth[_0xe7c7('0xa')](),controller[_0xe7c7('0x17')]);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 babdcff..89a15fe 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 _0x00bb=['STRING','sequelize','exports'];(function(_0x5f1364,_0x5b2752){var _0x2424c8=function(_0x393bc5){while(--_0x393bc5){_0x5f1364['push'](_0x5f1364['shift']());}};_0x2424c8(++_0x5b2752);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x00bb[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file +var _0x9c44=['STRING'];(function(_0xcd81b8,_0x18d9fd){var _0xc3ae18=function(_0x2bd4e0){while(--_0x2bd4e0){_0xcd81b8['push'](_0xcd81b8['shift']());}};_0xc3ae18(++_0x18d9fd);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')]},'description':{'type':Sequelize[_0x49c4('0x0')]},'host':{'type':Sequelize[_0x49c4('0x0')]},'zone':{'type':Sequelize[_0x49c4('0x0')]},'clientId':{'type':Sequelize[_0x49c4('0x0')]},'clientSecret':{'type':Sequelize[_0x49c4('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x49c4('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 29bf0ab..1104dfc 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 _0x16de=['crypto','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','apply','reject','update','then','destroy','end','sendStatus','stack','name','index','map','ZohoAccount','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','getConfigurations','ZohoConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','refreshToken','host','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','system_mandatory','push','data_type','pick_list_values','stringify','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel'];(function(_0xc84838,_0x47e144){var _0x5d14f9=function(_0xe4a36d){while(--_0xe4a36d){_0xc84838['push'](_0xc84838['shift']());}};_0x5d14f9(++_0x47e144);}(_0x16de,0xe9));var _0xe16d=function(_0x4fec59,_0x49a6bc){_0x4fec59=_0x4fec59-0x0;var _0x2605c3=_0x16de[_0x4fec59];return _0x2605c3;};'use strict';var emlformat=require(_0xe16d('0x0'));var rimraf=require(_0xe16d('0x1'));var zipdir=require(_0xe16d('0x2'));var jsonpatch=require(_0xe16d('0x3'));var rp=require(_0xe16d('0x4'));var moment=require(_0xe16d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe16d('0x6'));var util=require(_0xe16d('0x7'));var path=require(_0xe16d('0x8'));var sox=require('sox');var csv=require(_0xe16d('0x9'));var ejs=require(_0xe16d('0xa'));var fs=require('fs');var fs_extra=require(_0xe16d('0xb'));var _=require('lodash');var squel=require(_0xe16d('0xc'));var crypto=require(_0xe16d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe16d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe16d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe16d('0xf'));var as=require(_0xe16d('0x10'));var hardwareService=require(_0xe16d('0x11'));var logger=require('../../config/logger')(_0xe16d('0x12'));var utils=require(_0xe16d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe16d('0x14'));var db=require(_0xe16d('0x15'))['db'];var integrations=require(_0xe16d('0x16'));function respondWithStatusCode(_0x34e66f,_0x5318ec){_0x5318ec=_0x5318ec||0xcc;return function(_0x4d9bcc){if(_0x4d9bcc){return _0x34e66f['sendStatus'](_0x5318ec);}return _0x34e66f[_0xe16d('0x17')](_0x5318ec)['end']();};}function respondWithResult(_0x227dc0,_0x28b44c){_0x28b44c=_0x28b44c||0xc8;return function(_0x2af270){if(_0x2af270){return _0x227dc0['status'](_0x28b44c)[_0xe16d('0x18')](_0x2af270);}};}function respondWithFilteredResult(_0x210eb2,_0x26ee56){return function(_0x5eca75){if(_0x5eca75){var _0x46cdda=typeof _0x26ee56['offset']===_0xe16d('0x19')&&typeof _0x26ee56[_0xe16d('0x1a')]===_0xe16d('0x19');var _0x49cf86=_0x5eca75['count'];var _0x179d97=_0x46cdda?0x0:_0x26ee56['offset'];var _0x16e469=_0x46cdda?_0x5eca75[_0xe16d('0x1b')]:_0x26ee56[_0xe16d('0x1c')]+_0x26ee56[_0xe16d('0x1a')];var _0x53a347;if(_0x16e469>=_0x49cf86){_0x16e469=_0x49cf86;_0x53a347=0xc8;}else{_0x53a347=0xce;}_0x210eb2['status'](_0x53a347);return _0x210eb2['set']('Content-Range',_0x179d97+'-'+_0x16e469+'/'+_0x49cf86)['json'](_0x5eca75);}return null;};}function patchUpdates(_0x16ed97){return function(_0x4d803e){try{jsonpatch[_0xe16d('0x1d')](_0x4d803e,_0x16ed97,!![]);}catch(_0x2fd00b){return BPromise[_0xe16d('0x1e')](_0x2fd00b);}return _0x4d803e['save']();};}function saveUpdates(_0x953910,_0x553bf6){return function(_0x4cff32){if(_0x4cff32){return _0x4cff32[_0xe16d('0x1f')](_0x953910)[_0xe16d('0x20')](function(_0x394c70){return _0x394c70;});}return null;};}function removeEntity(_0x4a1f4c,_0x1b9e10){return function(_0x273fb6){if(_0x273fb6){return _0x273fb6[_0xe16d('0x21')]()[_0xe16d('0x20')](function(){_0x4a1f4c[_0xe16d('0x17')](0xcc)[_0xe16d('0x22')]();});}};}function handleEntityNotFound(_0x31346e,_0x36fbaa){return function(_0xb2c7e4){if(!_0xb2c7e4){_0x31346e[_0xe16d('0x23')](0x194);}return _0xb2c7e4;};}function handleError(_0x1cd336,_0x2852fb){_0x2852fb=_0x2852fb||0x1f4;return function(_0x16c2ac){logger['error'](_0x16c2ac[_0xe16d('0x24')]);if(_0x16c2ac[_0xe16d('0x25')]){delete _0x16c2ac['name'];}_0x1cd336[_0xe16d('0x17')](_0x2852fb)['send'](_0x16c2ac);};}exports[_0xe16d('0x26')]=function(_0x42ec10,_0x1ee303){var _0xbb9b1a={},_0x1bc90c={},_0x39f3eb={'count':0x0,'rows':[]};var _0x48fcdc=_[_0xe16d('0x27')](db[_0xe16d('0x28')]['rawAttributes'],function(_0x16bf50){return{'name':_0x16bf50[_0xe16d('0x29')],'type':_0x16bf50[_0xe16d('0x2a')][_0xe16d('0x2b')]};});_0x1bc90c['model']=_['map'](_0x48fcdc,_0xe16d('0x25'));_0x1bc90c[_0xe16d('0x2c')]=_['keys'](_0x42ec10[_0xe16d('0x2c')]);_0x1bc90c['filters']=_[_0xe16d('0x2d')](_0x1bc90c[_0xe16d('0x2e')],_0x1bc90c[_0xe16d('0x2c')]);_0xbb9b1a[_0xe16d('0x2f')]=_[_0xe16d('0x2d')](_0x1bc90c['model'],qs['fields'](_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x30')]));_0xbb9b1a['attributes']=_0xbb9b1a['attributes'][_0xe16d('0x31')]?_0xbb9b1a['attributes']:_0x1bc90c['model'];if(!_0x42ec10['query'][_0xe16d('0x32')]('nolimit')){_0xbb9b1a['limit']=qs[_0xe16d('0x1a')](_0x42ec10['query'][_0xe16d('0x1a')]);_0xbb9b1a[_0xe16d('0x1c')]=qs[_0xe16d('0x1c')](_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x1c')]);}_0xbb9b1a[_0xe16d('0x33')]=qs['sort'](_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x34')]);_0xbb9b1a[_0xe16d('0x35')]=qs['filters'](_[_0xe16d('0x36')](_0x42ec10[_0xe16d('0x2c')],_0x1bc90c[_0xe16d('0x37')]),_0x48fcdc);if(_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x38')]){_0xbb9b1a['where']=_[_0xe16d('0x39')](_0xbb9b1a['where'],{'$or':_[_0xe16d('0x27')](_0x48fcdc,function(_0x1d7abc){if(_0x1d7abc[_0xe16d('0x2a')]!==_0xe16d('0x3a')){var _0x52ca10={};_0x52ca10[_0x1d7abc[_0xe16d('0x25')]]={'$like':'%'+_0x42ec10['query'][_0xe16d('0x38')]+'%'};return _0x52ca10;}})});}_0xbb9b1a=_[_0xe16d('0x39')]({},_0xbb9b1a,_0x42ec10[_0xe16d('0x3b')]);var _0x33b18b={'where':_0xbb9b1a['where']};return db['ZohoAccount'][_0xe16d('0x1b')](_0x33b18b)[_0xe16d('0x20')](function(_0x28b414){_0x39f3eb[_0xe16d('0x1b')]=_0x28b414;if(_0x42ec10[_0xe16d('0x2c')][_0xe16d('0x3c')]){_0xbb9b1a[_0xe16d('0x3d')]=[{'all':!![]}];}return db[_0xe16d('0x28')][_0xe16d('0x3e')](_0xbb9b1a);})['then'](function(_0x24e29a){_0x39f3eb[_0xe16d('0x3f')]=_0x24e29a;return _0x39f3eb;})[_0xe16d('0x20')](respondWithFilteredResult(_0x1ee303,_0xbb9b1a))[_0xe16d('0x40')](handleError(_0x1ee303,null));};exports[_0xe16d('0x41')]=function(_0x3b38c2,_0xdc4a18){var _0x442938={'raw':![],'where':{'id':_0x3b38c2[_0xe16d('0x42')]['id']}},_0x1c2b3e={};_0x1c2b3e[_0xe16d('0x2e')]=_[_0xe16d('0x43')](db[_0xe16d('0x28')][_0xe16d('0x44')]);_0x1c2b3e[_0xe16d('0x2c')]=_['keys'](_0x3b38c2['query']);_0x1c2b3e[_0xe16d('0x37')]=_['intersection'](_0x1c2b3e['model'],_0x1c2b3e['query']);_0x442938[_0xe16d('0x2f')]=_[_0xe16d('0x2d')](_0x1c2b3e[_0xe16d('0x2e')],qs[_0xe16d('0x30')](_0x3b38c2[_0xe16d('0x2c')]['fields']));_0x442938[_0xe16d('0x2f')]=_0x442938[_0xe16d('0x2f')]['length']?_0x442938['attributes']:_0x1c2b3e[_0xe16d('0x2e')];if(_0x3b38c2[_0xe16d('0x2c')][_0xe16d('0x3c')]){_0x442938[_0xe16d('0x3d')]=[{'all':!![]}];}_0x442938=_['merge']({},_0x442938,_0x3b38c2[_0xe16d('0x3b')]);return db['ZohoAccount']['find'](_0x442938)[_0xe16d('0x20')](handleEntityNotFound(_0xdc4a18,null))[_0xe16d('0x20')](respondWithResult(_0xdc4a18,null))['catch'](handleError(_0xdc4a18,null));};exports[_0xe16d('0x45')]=function(_0x1dbdd9,_0xaa4a82){return db[_0xe16d('0x28')][_0xe16d('0x45')](_0x1dbdd9['body'],{})[_0xe16d('0x20')](respondWithResult(_0xaa4a82,0xc9))['catch'](handleError(_0xaa4a82,null));};exports[_0xe16d('0x1f')]=function(_0x3337f7,_0x552386){if(_0x3337f7[_0xe16d('0x46')]['id']){delete _0x3337f7[_0xe16d('0x46')]['id'];}return db[_0xe16d('0x28')]['find']({'where':{'id':_0x3337f7[_0xe16d('0x42')]['id']}})['then'](handleEntityNotFound(_0x552386,null))[_0xe16d('0x20')](saveUpdates(_0x3337f7[_0xe16d('0x46')],null))['then'](respondWithResult(_0x552386,null))[_0xe16d('0x40')](handleError(_0x552386,null));};exports[_0xe16d('0x21')]=function(_0x855405,_0x3ba038){return db[_0xe16d('0x28')]['find']({'where':{'id':_0x855405['params']['id']}})[_0xe16d('0x20')](handleEntityNotFound(_0x3ba038,null))[_0xe16d('0x20')](removeEntity(_0x3ba038,null))[_0xe16d('0x40')](handleError(_0x3ba038,null));};exports[_0xe16d('0x47')]=function(_0x4045ff,_0x5262e1,_0x15c8ba){var _0x4fd909={};var _0x412dc3={};var _0x5e6c17;var _0x223cfc;return db[_0xe16d('0x28')]['findOne']({'where':{'id':_0x4045ff[_0xe16d('0x42')]['id']}})[_0xe16d('0x20')](handleEntityNotFound(_0x5262e1,null))[_0xe16d('0x20')](function(_0x15ccd1){if(_0x15ccd1){_0x5e6c17=_0x15ccd1;_0x412dc3[_0xe16d('0x2e')]=_[_0xe16d('0x43')](db[_0xe16d('0x48')][_0xe16d('0x44')]);_0x412dc3[_0xe16d('0x2c')]=_[_0xe16d('0x43')](_0x4045ff['query']);_0x412dc3[_0xe16d('0x37')]=_[_0xe16d('0x2d')](_0x412dc3[_0xe16d('0x2e')],_0x412dc3[_0xe16d('0x2c')]);_0x4fd909[_0xe16d('0x2f')]=_[_0xe16d('0x2d')](_0x412dc3['model'],qs['fields'](_0x4045ff[_0xe16d('0x2c')][_0xe16d('0x30')]));_0x4fd909['attributes']=_0x4fd909['attributes'][_0xe16d('0x31')]?_0x4fd909['attributes']:_0x412dc3[_0xe16d('0x2e')];_0x4fd909[_0xe16d('0x33')]=qs[_0xe16d('0x34')](_0x4045ff['query'][_0xe16d('0x34')]);_0x4fd909['where']=qs['filters'](_[_0xe16d('0x36')](_0x4045ff[_0xe16d('0x2c')],_0x412dc3['filters']));if(_0x4045ff[_0xe16d('0x2c')][_0xe16d('0x38')]){_0x4fd909[_0xe16d('0x35')]=_[_0xe16d('0x39')](_0x4fd909[_0xe16d('0x35')],{'$or':_[_0xe16d('0x27')](_0x4fd909[_0xe16d('0x2f')],function(_0x4e2dd3){var _0x159912={};_0x159912[_0x4e2dd3]={'$like':'%'+_0x4045ff[_0xe16d('0x2c')][_0xe16d('0x38')]+'%'};return _0x159912;})});}_0x4fd909=_[_0xe16d('0x39')]({},_0x4fd909,_0x4045ff['options']);return _0x5e6c17[_0xe16d('0x47')](_0x4fd909);}})[_0xe16d('0x20')](function(_0x38e84a){if(_0x38e84a){_0x223cfc=_0x38e84a['length'];if(!_0x4045ff[_0xe16d('0x2c')]['hasOwnProperty'](_0xe16d('0x49'))){_0x4fd909['limit']=qs[_0xe16d('0x1a')](_0x4045ff['query'][_0xe16d('0x1a')]);_0x4fd909[_0xe16d('0x1c')]=qs['offset'](_0x4045ff['query'][_0xe16d('0x1c')]);}return _0x5e6c17[_0xe16d('0x47')](_0x4fd909);}})[_0xe16d('0x20')](function(_0x3ac632){if(_0x3ac632){return _0x3ac632?{'count':_0x223cfc,'rows':_0x3ac632}:null;}})[_0xe16d('0x20')](respondWithResult(_0x5262e1,null))[_0xe16d('0x40')](handleError(_0x5262e1,null));};exports[_0xe16d('0x4a')]=function(_0x36ad71,_0x123833,_0x22f10f){if(_0x36ad71[_0xe16d('0x46')]['id']){delete _0x36ad71['body']['id'];}return db['ZohoAccount'][_0xe16d('0x4b')]({'where':{'id':_0x36ad71[_0xe16d('0x42')]['id']}})[_0xe16d('0x20')](handleEntityNotFound(_0x123833,null))[_0xe16d('0x20')](function(_0x1f2414){if(_0x1f2414){_0x36ad71[_0xe16d('0x46')][_0xe16d('0x4c')]=_0x1f2414['id'];_0x36ad71['body'][_0xe16d('0x4d')]=integrations[_0xe16d('0x4e')](_0x36ad71[_0xe16d('0x46')][_0xe16d('0x4f')],_0x36ad71['body'][_0xe16d('0x2a')]);_0x36ad71[_0xe16d('0x46')][_0xe16d('0x50')]=integrations[_0xe16d('0x51')](_0x36ad71[_0xe16d('0x46')][_0xe16d('0x4f')],_0x36ad71['body'][_0xe16d('0x2a')]);return db[_0xe16d('0x48')][_0xe16d('0x45')](_0x36ad71[_0xe16d('0x46')],{'include':[{'model':db[_0xe16d('0x52')],'as':_0xe16d('0x4d')},{'model':db[_0xe16d('0x52')],'as':_0xe16d('0x50')}]});}return null;})[_0xe16d('0x20')](respondWithResult(_0x123833,null))[_0xe16d('0x40')](handleError(_0x123833,null));};function getAccessToken(_0x1c84a1){return new Promise(function(_0x544b50,_0x23bf1e){var _0x1db48a;switch(_0x1c84a1[_0xe16d('0x53')]){case'US':_0x1db48a=_0xe16d('0x54');break;case'AU':_0x1db48a=_0xe16d('0x55');break;case'EU':_0x1db48a='https://accounts.zoho.eu';break;case'IN':_0x1db48a=_0xe16d('0x56');break;case'CN':_0x1db48a=_0xe16d('0x57');break;default:_0x1db48a=_0xe16d('0x58');break;}var _0x398db3={'method':_0xe16d('0x59'),'uri':_0x1db48a+_0xe16d('0x5a'),'qs':{'refresh_token':_0x1c84a1['refreshToken'],'client_id':_0x1c84a1[_0xe16d('0x5b')],'client_secret':_0x1c84a1['clientSecret'],'grant_type':_0xe16d('0x5c')},'json':!![]};return rp(_0x398db3)[_0xe16d('0x20')](function(_0x57f123){if(_0x57f123[_0xe16d('0x5d')]){_0x544b50(_0x57f123['access_token']);}else{_0x23bf1e(_0xe16d('0x5e'));}})[_0xe16d('0x40')](function(_0x591b3d){_0x23bf1e(_0x591b3d);});});}exports[_0xe16d('0x5f')]=function(_0x2382ca,_0x277041,_0x26d6aa){var _0x334695,_0x2a36fb,_0x2e065d,_0x5a54e6,_0x278e78;return db[_0xe16d('0x28')][_0xe16d('0x4b')]({'where':{'id':_0x2382ca['params']['id']},'attributes':['id','host',_0xe16d('0x53'),_0xe16d('0x5b'),'clientSecret',_0xe16d('0x60'),_0xe16d('0x61'),_0xe16d('0x62')]})[_0xe16d('0x20')](handleEntityNotFound(_0x277041,null))[_0xe16d('0x20')](function(_0x22c05f){_0x278e78=_0x22c05f;_0x334695=_0x278e78[_0xe16d('0x63')];_0x2a36fb=_0x334695==='zoho.eu'?'eu':_0xe16d('0x64');_0x2e065d=_0x278e78[_0xe16d('0x60')];var _0x1c7920=_0x2e065d[_0xe16d('0x65')](-0x1);if(_0x1c7920==='/'||_0x1c7920==='\x5c'||_0x1c7920===':'){_0x2e065d=_0x2e065d['substring'](0x0,_0x2e065d[_0xe16d('0x66')](_0x1c7920));}if(!_0x278e78['refreshToken']){throw new Error(_0xe16d('0x67'));}return getAccessToken(_0x278e78);})[_0xe16d('0x20')](function(_0x52b9a1){if(_0x52b9a1){return rp({'method':'GET','uri':util['format'](_0xe16d('0x68'),_0x2a36fb),'qs':{'module':_0xe16d('0x69')},'headers':{'Authorization':_0xe16d('0x6a')+_0x52b9a1},'json':!![]});}})[_0xe16d('0x20')](function(_0x59945f){if(_0x59945f){if(_0x59945f['response']&&_0x59945f[_0xe16d('0x6b')][_0xe16d('0x6c')]){throw new Error(_0x59945f[_0xe16d('0x6b')]['error'][_0xe16d('0x6d')]);}var _0x8ec9c0=[];var _0x313d05=[];var _0x17511d=['Owner','Subject','Description',_0xe16d('0x6e'),_0xe16d('0x6f'),_0xe16d('0x70'),_0xe16d('0x71'),'Call_Type'];_0x313d05=_['remove'](_0x59945f[_0xe16d('0x30')],function(_0x27feea){return _0x17511d[_0xe16d('0x72')](_0x27feea[_0xe16d('0x73')]);});for(var _0x24d584=0x0;_0x24d584<_0x313d05[_0xe16d('0x31')];_0x24d584++){if(_0x313d05[_0x24d584][_0xe16d('0x74')]===![]){_0x8ec9c0[_0xe16d('0x75')]({'id':_0x313d05[_0x24d584]['id'],'name':_0x313d05[_0x24d584]['display_label'],'custom':_0x313d05[_0x24d584]['custom_field'],'options':_0x313d05[_0x24d584][_0xe16d('0x76')]==='picklist'&&_0x313d05[_0x24d584][_0xe16d('0x77')][_0xe16d('0x31')]>-0x1?_[_0xe16d('0x27')](_0x313d05[_0x24d584][_0xe16d('0x77')],function(_0xb31f10){return{'name':_0xb31f10,'value':_0xb31f10};}):[]});}}return{'count':_0x8ec9c0[_0xe16d('0x31')],'rows':_0x8ec9c0};}else{return{'count':0x0,'rows':[]};}})[_0xe16d('0x20')](respondWithResult(_0x277041,null))[_0xe16d('0x40')](function(_0x48069b){var _0x1e02d2=_0x2382ca['query']['test']?0x1f4:_0x48069b['statusCode']||0x1f4;logger[_0xe16d('0x6c')]('getFields,\x20%s,\x20%s,\x20%s',_0xe16d('0x5f'),_0x1e02d2,JSON[_0xe16d('0x78')](_0x48069b));delete _0x48069b[_0xe16d('0x25')];if(_0x1e02d2===0x191){_0x1e02d2=0x190;}_0x277041[_0xe16d('0x17')](_0x1e02d2)[_0xe16d('0x79')](_0x2382ca[_0xe16d('0x2c')][_0xe16d('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x48069b['statusCode']}:_0x48069b);});}; \ No newline at end of file +var _0x0ea1=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','params','length','create','body','catch','find','destroy','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x0ea1,0x1e4));var _0x10ea=function(_0x22a333,_0xb6f8){_0x22a333=_0x22a333-0x0;var _0x109061=_0x0ea1[_0x22a333];return _0x109061;};'use strict';var emlformat=require(_0x10ea('0x0'));var rimraf=require(_0x10ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10ea('0x2'));var rp=require(_0x10ea('0x3'));var moment=require(_0x10ea('0x4'));var BPromise=require(_0x10ea('0x5'));var Mustache=require(_0x10ea('0x6'));var util=require(_0x10ea('0x7'));var path=require(_0x10ea('0x8'));var sox=require(_0x10ea('0x9'));var csv=require('to-csv');var ejs=require(_0x10ea('0xa'));var fs=require('fs');var fs_extra=require(_0x10ea('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x10ea('0xc'));var jsforce=require(_0x10ea('0xd'));var deskjs=require(_0x10ea('0xe'));var toCsv=require(_0x10ea('0xf'));var querystring=require(_0x10ea('0x10'));var Papa=require(_0x10ea('0x11'));var Redis=require(_0x10ea('0x12'));var authService=require(_0x10ea('0x13'));var qs=require(_0x10ea('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x10ea('0x15'));var logger=require(_0x10ea('0x16'))(_0x10ea('0x17'));var utils=require(_0x10ea('0x18'));var config=require(_0x10ea('0x19'));var licenseUtil=require(_0x10ea('0x1a'));var db=require(_0x10ea('0x1b'))['db'];var integrations=require(_0x10ea('0x1c'));function respondWithStatusCode(_0x4e1d41,_0x513d30){_0x513d30=_0x513d30||0xcc;return function(_0x35161f){if(_0x35161f){return _0x4e1d41[_0x10ea('0x1d')](_0x513d30);}return _0x4e1d41[_0x10ea('0x1e')](_0x513d30)['end']();};}function respondWithResult(_0x1a4bf1,_0x30538e){_0x30538e=_0x30538e||0xc8;return function(_0x5507bf){if(_0x5507bf){return _0x1a4bf1[_0x10ea('0x1e')](_0x30538e)['json'](_0x5507bf);}};}function respondWithFilteredResult(_0x33859c,_0x3911b8){return function(_0x9c7314){if(_0x9c7314){var _0x4091a1=typeof _0x3911b8[_0x10ea('0x1f')]==='undefined'&&typeof _0x3911b8[_0x10ea('0x20')]===_0x10ea('0x21');var _0x2e21a7=_0x9c7314[_0x10ea('0x22')];var _0x4e6b05=_0x4091a1?0x0:_0x3911b8[_0x10ea('0x1f')];var _0x5545b5=_0x4091a1?_0x9c7314['count']:_0x3911b8['offset']+_0x3911b8[_0x10ea('0x20')];var _0x221317;if(_0x5545b5>=_0x2e21a7){_0x5545b5=_0x2e21a7;_0x221317=0xc8;}else{_0x221317=0xce;}_0x33859c[_0x10ea('0x1e')](_0x221317);return _0x33859c[_0x10ea('0x23')](_0x10ea('0x24'),_0x4e6b05+'-'+_0x5545b5+'/'+_0x2e21a7)[_0x10ea('0x25')](_0x9c7314);}return null;};}function patchUpdates(_0x373238){return function(_0x588100){try{jsonpatch[_0x10ea('0x26')](_0x588100,_0x373238,!![]);}catch(_0x1c51d6){return BPromise[_0x10ea('0x27')](_0x1c51d6);}return _0x588100[_0x10ea('0x28')]();};}function saveUpdates(_0x249fb8,_0x2d1137){return function(_0x47e105){if(_0x47e105){return _0x47e105[_0x10ea('0x29')](_0x249fb8)[_0x10ea('0x2a')](function(_0x289a7a){return _0x289a7a;});}return null;};}function removeEntity(_0x443e3e,_0x4442f6){return function(_0x2470e6){if(_0x2470e6){return _0x2470e6['destroy']()['then'](function(){_0x443e3e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c6b8b,_0x2932dc){return function(_0x50e5e8){if(!_0x50e5e8){_0x6c6b8b['sendStatus'](0x194);}return _0x50e5e8;};}function handleError(_0x213ac7,_0x1280a3){_0x1280a3=_0x1280a3||0x1f4;return function(_0x539f38){logger[_0x10ea('0x2b')](_0x539f38[_0x10ea('0x2c')]);if(_0x539f38[_0x10ea('0x2d')]){delete _0x539f38[_0x10ea('0x2d')];}_0x213ac7[_0x10ea('0x1e')](_0x1280a3)[_0x10ea('0x2e')](_0x539f38);};}exports[_0x10ea('0x2f')]=function(_0x40a3ab,_0x5c7aa2){var _0x64e44e={},_0x5794ef={},_0x1aaeea={'count':0x0,'rows':[]};var _0x1250c9=_[_0x10ea('0x30')](db[_0x10ea('0x31')][_0x10ea('0x32')],function(_0xc0b30e){return{'name':_0xc0b30e[_0x10ea('0x33')],'type':_0xc0b30e['type'][_0x10ea('0x34')]};});_0x5794ef[_0x10ea('0x35')]=_[_0x10ea('0x30')](_0x1250c9,'name');_0x5794ef[_0x10ea('0x36')]=_[_0x10ea('0x37')](_0x40a3ab[_0x10ea('0x36')]);_0x5794ef[_0x10ea('0x38')]=_['intersection'](_0x5794ef[_0x10ea('0x35')],_0x5794ef[_0x10ea('0x36')]);_0x64e44e['attributes']=_[_0x10ea('0x39')](_0x5794ef['model'],qs[_0x10ea('0x3a')](_0x40a3ab[_0x10ea('0x36')][_0x10ea('0x3a')]));_0x64e44e['attributes']=_0x64e44e['attributes']['length']?_0x64e44e[_0x10ea('0x3b')]:_0x5794ef[_0x10ea('0x35')];if(!_0x40a3ab[_0x10ea('0x36')][_0x10ea('0x3c')](_0x10ea('0x3d'))){_0x64e44e[_0x10ea('0x20')]=qs[_0x10ea('0x20')](_0x40a3ab['query']['limit']);_0x64e44e[_0x10ea('0x1f')]=qs[_0x10ea('0x1f')](_0x40a3ab['query'][_0x10ea('0x1f')]);}_0x64e44e[_0x10ea('0x3e')]=qs[_0x10ea('0x3f')](_0x40a3ab['query']['sort']);_0x64e44e[_0x10ea('0x40')]=qs[_0x10ea('0x38')](_['pick'](_0x40a3ab[_0x10ea('0x36')],_0x5794ef[_0x10ea('0x38')]),_0x1250c9);if(_0x40a3ab['query'][_0x10ea('0x41')]){_0x64e44e[_0x10ea('0x40')]=_[_0x10ea('0x42')](_0x64e44e[_0x10ea('0x40')],{'$or':_[_0x10ea('0x30')](_0x1250c9,function(_0x1c0008){if(_0x1c0008[_0x10ea('0x43')]!==_0x10ea('0x44')){var _0x3a9e9b={};_0x3a9e9b[_0x1c0008[_0x10ea('0x2d')]]={'$like':'%'+_0x40a3ab[_0x10ea('0x36')][_0x10ea('0x41')]+'%'};return _0x3a9e9b;}})});}_0x64e44e=_['merge']({},_0x64e44e,_0x40a3ab[_0x10ea('0x45')]);var _0x33f183={'where':_0x64e44e[_0x10ea('0x40')]};return db['ZohoAccount']['count'](_0x33f183)['then'](function(_0x141857){_0x1aaeea[_0x10ea('0x22')]=_0x141857;if(_0x40a3ab[_0x10ea('0x36')][_0x10ea('0x46')]){_0x64e44e[_0x10ea('0x47')]=[{'all':!![]}];}return db[_0x10ea('0x31')][_0x10ea('0x48')](_0x64e44e);})[_0x10ea('0x2a')](function(_0x2ca95a){_0x1aaeea['rows']=_0x2ca95a;return _0x1aaeea;})['then'](respondWithFilteredResult(_0x5c7aa2,_0x64e44e))['catch'](handleError(_0x5c7aa2,null));};exports['show']=function(_0x155d10,_0x27cbf6){var _0x243744={'raw':![],'where':{'id':_0x155d10[_0x10ea('0x49')]['id']}},_0x211722={};_0x211722['model']=_[_0x10ea('0x37')](db[_0x10ea('0x31')]['rawAttributes']);_0x211722[_0x10ea('0x36')]=_[_0x10ea('0x37')](_0x155d10[_0x10ea('0x36')]);_0x211722[_0x10ea('0x38')]=_[_0x10ea('0x39')](_0x211722[_0x10ea('0x35')],_0x211722[_0x10ea('0x36')]);_0x243744[_0x10ea('0x3b')]=_[_0x10ea('0x39')](_0x211722[_0x10ea('0x35')],qs['fields'](_0x155d10[_0x10ea('0x36')][_0x10ea('0x3a')]));_0x243744[_0x10ea('0x3b')]=_0x243744[_0x10ea('0x3b')][_0x10ea('0x4a')]?_0x243744[_0x10ea('0x3b')]:_0x211722[_0x10ea('0x35')];if(_0x155d10['query']['includeAll']){_0x243744[_0x10ea('0x47')]=[{'all':!![]}];}_0x243744=_['merge']({},_0x243744,_0x155d10[_0x10ea('0x45')]);return db[_0x10ea('0x31')]['find'](_0x243744)[_0x10ea('0x2a')](handleEntityNotFound(_0x27cbf6,null))[_0x10ea('0x2a')](respondWithResult(_0x27cbf6,null))['catch'](handleError(_0x27cbf6,null));};exports['create']=function(_0x7c0875,_0x55d137){return db[_0x10ea('0x31')][_0x10ea('0x4b')](_0x7c0875[_0x10ea('0x4c')],{})[_0x10ea('0x2a')](respondWithResult(_0x55d137,0xc9))[_0x10ea('0x4d')](handleError(_0x55d137,null));};exports[_0x10ea('0x29')]=function(_0xf8c017,_0xca5266){if(_0xf8c017['body']['id']){delete _0xf8c017[_0x10ea('0x4c')]['id'];}return db[_0x10ea('0x31')][_0x10ea('0x4e')]({'where':{'id':_0xf8c017[_0x10ea('0x49')]['id']}})[_0x10ea('0x2a')](handleEntityNotFound(_0xca5266,null))['then'](saveUpdates(_0xf8c017[_0x10ea('0x4c')],null))[_0x10ea('0x2a')](respondWithResult(_0xca5266,null))[_0x10ea('0x4d')](handleError(_0xca5266,null));};exports[_0x10ea('0x4f')]=function(_0x20cf4b,_0x58a0e7){return db[_0x10ea('0x31')][_0x10ea('0x4e')]({'where':{'id':_0x20cf4b['params']['id']}})[_0x10ea('0x2a')](handleEntityNotFound(_0x58a0e7,null))['then'](removeEntity(_0x58a0e7,null))[_0x10ea('0x4d')](handleError(_0x58a0e7,null));};exports[_0x10ea('0x50')]=function(_0x5eed84,_0x3cb72a,_0x527cec){var _0x4dbbd5={};var _0x56389c={};var _0x43d8d8;var _0x830344;return db[_0x10ea('0x31')][_0x10ea('0x51')]({'where':{'id':_0x5eed84['params']['id']}})['then'](handleEntityNotFound(_0x3cb72a,null))[_0x10ea('0x2a')](function(_0x561517){if(_0x561517){_0x43d8d8=_0x561517;_0x56389c['model']=_['keys'](db[_0x10ea('0x52')][_0x10ea('0x32')]);_0x56389c[_0x10ea('0x36')]=_[_0x10ea('0x37')](_0x5eed84[_0x10ea('0x36')]);_0x56389c[_0x10ea('0x38')]=_['intersection'](_0x56389c[_0x10ea('0x35')],_0x56389c[_0x10ea('0x36')]);_0x4dbbd5[_0x10ea('0x3b')]=_[_0x10ea('0x39')](_0x56389c[_0x10ea('0x35')],qs[_0x10ea('0x3a')](_0x5eed84[_0x10ea('0x36')]['fields']));_0x4dbbd5[_0x10ea('0x3b')]=_0x4dbbd5['attributes']['length']?_0x4dbbd5[_0x10ea('0x3b')]:_0x56389c[_0x10ea('0x35')];_0x4dbbd5['order']=qs[_0x10ea('0x3f')](_0x5eed84[_0x10ea('0x36')][_0x10ea('0x3f')]);_0x4dbbd5[_0x10ea('0x40')]=qs[_0x10ea('0x38')](_[_0x10ea('0x53')](_0x5eed84[_0x10ea('0x36')],_0x56389c[_0x10ea('0x38')]));if(_0x5eed84[_0x10ea('0x36')][_0x10ea('0x41')]){_0x4dbbd5[_0x10ea('0x40')]=_[_0x10ea('0x42')](_0x4dbbd5['where'],{'$or':_[_0x10ea('0x30')](_0x4dbbd5[_0x10ea('0x3b')],function(_0x3c4282){var _0x7fc87c={};_0x7fc87c[_0x3c4282]={'$like':'%'+_0x5eed84['query']['filter']+'%'};return _0x7fc87c;})});}_0x4dbbd5=_['merge']({},_0x4dbbd5,_0x5eed84[_0x10ea('0x45')]);return _0x43d8d8['getConfigurations'](_0x4dbbd5);}})['then'](function(_0x332070){if(_0x332070){_0x830344=_0x332070[_0x10ea('0x4a')];if(!_0x5eed84['query'][_0x10ea('0x3c')](_0x10ea('0x3d'))){_0x4dbbd5[_0x10ea('0x20')]=qs[_0x10ea('0x20')](_0x5eed84[_0x10ea('0x36')]['limit']);_0x4dbbd5[_0x10ea('0x1f')]=qs[_0x10ea('0x1f')](_0x5eed84[_0x10ea('0x36')]['offset']);}return _0x43d8d8['getConfigurations'](_0x4dbbd5);}})[_0x10ea('0x2a')](function(_0x56d38c){if(_0x56d38c){return _0x56d38c?{'count':_0x830344,'rows':_0x56d38c}:null;}})[_0x10ea('0x2a')](respondWithResult(_0x3cb72a,null))['catch'](handleError(_0x3cb72a,null));};exports[_0x10ea('0x54')]=function(_0x2bbb00,_0x183a12,_0x4c641d){if(_0x2bbb00[_0x10ea('0x4c')]['id']){delete _0x2bbb00[_0x10ea('0x4c')]['id'];}return db[_0x10ea('0x31')][_0x10ea('0x51')]({'where':{'id':_0x2bbb00[_0x10ea('0x49')]['id']}})['then'](handleEntityNotFound(_0x183a12,null))[_0x10ea('0x2a')](function(_0x48e3ac){if(_0x48e3ac){_0x2bbb00['body'][_0x10ea('0x55')]=_0x48e3ac['id'];_0x2bbb00[_0x10ea('0x4c')][_0x10ea('0x56')]=integrations['getSubjects'](_0x2bbb00['body'][_0x10ea('0x57')],_0x2bbb00[_0x10ea('0x4c')][_0x10ea('0x43')]);_0x2bbb00[_0x10ea('0x4c')][_0x10ea('0x58')]=integrations[_0x10ea('0x59')](_0x2bbb00[_0x10ea('0x4c')][_0x10ea('0x57')],_0x2bbb00[_0x10ea('0x4c')][_0x10ea('0x43')]);return db[_0x10ea('0x52')][_0x10ea('0x4b')](_0x2bbb00['body'],{'include':[{'model':db[_0x10ea('0x5a')],'as':'Subjects'},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x10ea('0x2a')](respondWithResult(_0x183a12,null))[_0x10ea('0x4d')](handleError(_0x183a12,null));};function getAccessToken(_0x2e76d9){return new Promise(function(_0x362131,_0x1a1884){var _0x34180d;switch(_0x2e76d9[_0x10ea('0x5b')]){case'US':_0x34180d=_0x10ea('0x5c');break;case'AU':_0x34180d=_0x10ea('0x5d');break;case'EU':_0x34180d=_0x10ea('0x5e');break;case'IN':_0x34180d='https://accounts.zoho.in';break;case'CN':_0x34180d=_0x10ea('0x5f');break;default:_0x34180d=_0x10ea('0x5e');break;}var _0x5dcb6d={'method':_0x10ea('0x60'),'uri':_0x34180d+_0x10ea('0x61'),'qs':{'refresh_token':_0x2e76d9[_0x10ea('0x62')],'client_id':_0x2e76d9[_0x10ea('0x63')],'client_secret':_0x2e76d9[_0x10ea('0x64')],'grant_type':_0x10ea('0x65')},'json':!![]};return rp(_0x5dcb6d)['then'](function(_0x11839c){if(_0x11839c[_0x10ea('0x66')]){_0x362131(_0x11839c[_0x10ea('0x66')]);}else{_0x1a1884(_0x10ea('0x67'));}})[_0x10ea('0x4d')](function(_0x3b9a76){_0x1a1884(_0x3b9a76);});});}exports[_0x10ea('0x68')]=function(_0x55eef5,_0x2f4b20,_0x599183){var _0x13a792,_0x5eae33,_0x43264b,_0x365198,_0x57871b;return db['ZohoAccount'][_0x10ea('0x51')]({'where':{'id':_0x55eef5[_0x10ea('0x49')]['id']},'attributes':['id',_0x10ea('0x69'),_0x10ea('0x5b'),'clientId',_0x10ea('0x64'),_0x10ea('0x6a'),_0x10ea('0x6b'),_0x10ea('0x62')]})[_0x10ea('0x2a')](handleEntityNotFound(_0x2f4b20,null))[_0x10ea('0x2a')](function(_0x133183){_0x57871b=_0x133183;_0x13a792=_0x57871b[_0x10ea('0x69')];_0x5eae33=_0x13a792===_0x10ea('0x6c')?'eu':'com';_0x43264b=_0x57871b[_0x10ea('0x6a')];var _0x3f1aba=_0x43264b[_0x10ea('0x6d')](-0x1);if(_0x3f1aba==='/'||_0x3f1aba==='\x5c'||_0x3f1aba===':'){_0x43264b=_0x43264b['substring'](0x0,_0x43264b['lastIndexOf'](_0x3f1aba));}if(!_0x57871b[_0x10ea('0x62')]){throw new Error(_0x10ea('0x6e'));}return getAccessToken(_0x57871b);})['then'](function(_0x348bc5){if(_0x348bc5){return rp({'method':_0x10ea('0x6f'),'uri':util[_0x10ea('0x70')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5eae33),'qs':{'module':_0x10ea('0x71')},'headers':{'Authorization':_0x10ea('0x72')+_0x348bc5},'json':!![]});}})['then'](function(_0x3fdde1){if(_0x3fdde1){if(_0x3fdde1[_0x10ea('0x73')]&&_0x3fdde1[_0x10ea('0x73')][_0x10ea('0x2b')]){throw new Error(_0x3fdde1[_0x10ea('0x73')][_0x10ea('0x2b')][_0x10ea('0x74')]);}var _0x40b839=[];var _0xaebc06=[];var _0x2f6bbf=['Owner','Subject',_0x10ea('0x75'),_0x10ea('0x76'),_0x10ea('0x77'),_0x10ea('0x78'),_0x10ea('0x79'),'Call_Type'];_0xaebc06=_[_0x10ea('0x7a')](_0x3fdde1[_0x10ea('0x3a')],function(_0x33d430){return _0x2f6bbf[_0x10ea('0x7b')](_0x33d430[_0x10ea('0x7c')]);});for(var _0x378c5d=0x0;_0x378c5d<_0xaebc06[_0x10ea('0x4a')];_0x378c5d++){if(_0xaebc06[_0x378c5d]['system_mandatory']===![]){_0x40b839[_0x10ea('0x7d')]({'id':_0xaebc06[_0x378c5d]['id'],'name':_0xaebc06[_0x378c5d][_0x10ea('0x7e')],'custom':_0xaebc06[_0x378c5d][_0x10ea('0x7f')],'options':_0xaebc06[_0x378c5d][_0x10ea('0x80')]==='picklist'&&_0xaebc06[_0x378c5d]['pick_list_values'][_0x10ea('0x4a')]>-0x1?_[_0x10ea('0x30')](_0xaebc06[_0x378c5d][_0x10ea('0x81')],function(_0x29604c){return{'name':_0x29604c,'value':_0x29604c};}):[]});}}return{'count':_0x40b839['length'],'rows':_0x40b839};}else{return{'count':0x0,'rows':[]};}})[_0x10ea('0x2a')](respondWithResult(_0x2f4b20,null))['catch'](function(_0x241b1a){var _0xdcedc2=_0x55eef5[_0x10ea('0x36')][_0x10ea('0x82')]?0x1f4:_0x241b1a[_0x10ea('0x83')]||0x1f4;logger[_0x10ea('0x2b')](_0x10ea('0x84'),_0x10ea('0x68'),_0xdcedc2,JSON['stringify'](_0x241b1a));delete _0x241b1a[_0x10ea('0x2d')];if(_0xdcedc2===0x191){_0xdcedc2=0x190;}_0x2f4b20[_0x10ea('0x1e')](_0xdcedc2)[_0x10ea('0x2e')](_0x55eef5[_0x10ea('0x36')][_0x10ea('0x82')]?{'message':_0x10ea('0x85'),'statusCode':_0x241b1a['statusCode']}:_0x241b1a);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e0eb875..18c30bc 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 _0x4330=['info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','application/x-www-form-urlencoded','then','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','parse','refreshToken','refresh_token'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x4330,0x13d));var _0x0433=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x4330[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0433('0x0'));var util=require(_0x0433('0x1'));var logger=require(_0x0433('0x2'))(_0x0433('0x3'));var moment=require(_0x0433('0x4'));var BPromise=require(_0x0433('0x5'));var rp=require(_0x0433('0x6'));var fs=require('fs');var path=require(_0x0433('0x7'));var rimraf=require(_0x0433('0x8'));var config=require(_0x0433('0x9'));var attributes=require(_0x0433('0xa'));var integrations=require(_0x0433('0xb'));module[_0x0433('0xc')]=function(_0x304eba,_0x5751fa){return _0x304eba['define'](_0x0433('0xd'),attributes,{'tableName':_0x0433('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x404a22,_0x220a36,_0x757581){if(_0x404a22['changed'](_0x0433('0xf'))||_0x404a22[_0x0433('0x10')](_0x0433('0x11'))||_0x404a22[_0x0433('0x10')](_0x0433('0x12'))||_0x404a22[_0x0433('0x10')]('clientSecret')||_0x404a22[_0x0433('0x10')](_0x0433('0x13'))||_0x404a22[_0x0433('0x10')](_0x0433('0x14'))){var _0x49a14e,_0x5a1edc;_0x49a14e=_0x404a22['serverUrl'];var _0x29e0c5=_0x49a14e[_0x0433('0x15')](-0x1);if(_0x29e0c5==='/'||_0x29e0c5==='\x5c'||_0x29e0c5===':'){_0x49a14e=_0x49a14e[_0x0433('0x16')](0x0,_0x49a14e['lastIndexOf'](_0x29e0c5));}switch(_0x404a22[_0x0433('0xf')]){case'US':_0x5a1edc=_0x0433('0x17');break;case'AU':_0x5a1edc=_0x0433('0x18');break;case'IN':_0x5a1edc=_0x0433('0x19');break;case'CN':_0x5a1edc=_0x0433('0x1a');break;default:_0x5a1edc=_0x0433('0x1b');break;}var _0x10ab77={'method':_0x0433('0x1c'),'uri':_0x5a1edc+_0x0433('0x1d'),'form':{'grant_type':_0x0433('0x1e'),'client_id':_0x404a22[_0x0433('0x12')],'client_secret':_0x404a22[_0x0433('0x1f')],'redirect_uri':_0x404a22['serverUrl'],'code':_0x404a22[_0x0433('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x10ab77)['then'](function(_0x2dccbc){var _0x2c0f11=JSON[_0x0433('0x20')](_0x2dccbc);if(_0x2c0f11['refresh_token']){_0x404a22[_0x0433('0x21')]=_0x2c0f11[_0x0433('0x22')];logger[_0x0433('0x23')](util[_0x0433('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x404a22[_0x0433('0x25')],_0x404a22['id']));}else{logger[_0x0433('0x26')](util[_0x0433('0x24')](_0x0433('0x27'),_0x404a22[_0x0433('0x25')],_0x404a22['id']),util['inspect'](_0x2c0f11,{'showHidden':![],'depth':null}));}return _0x757581(null,_0x220a36);})['catch'](function(_0x55bdba){logger[_0x0433('0x26')](util[_0x0433('0x24')](_0x0433('0x27'),_0x404a22[_0x0433('0x25')],_0x404a22['id']),util[_0x0433('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x757581(_0x55bdba);});}else{return _0x757581(null,_0x220a36);}},'beforeUpdate':function(_0x32e035,_0x36bd8b,_0x277deb){if(_0x32e035[_0x0433('0x10')](_0x0433('0xf'))||_0x32e035[_0x0433('0x10')]('serverUrl')||_0x32e035[_0x0433('0x10')](_0x0433('0x12'))||_0x32e035['changed']('clientSecret')||_0x32e035[_0x0433('0x10')](_0x0433('0x13'))||_0x32e035[_0x0433('0x10')](_0x0433('0x14'))){var _0x14cf16,_0x18b840;_0x14cf16=_0x32e035[_0x0433('0x11')];var _0x2d08cf=_0x14cf16[_0x0433('0x15')](-0x1);if(_0x2d08cf==='/'||_0x2d08cf==='\x5c'||_0x2d08cf===':'){_0x14cf16=_0x14cf16[_0x0433('0x16')](0x0,_0x14cf16['lastIndexOf'](_0x2d08cf));}switch(_0x32e035[_0x0433('0xf')]){case'US':_0x18b840=_0x0433('0x17');break;case'AU':_0x18b840=_0x0433('0x18');break;case'IN':_0x18b840='https://accounts.zoho.in';break;case'CN':_0x18b840=_0x0433('0x1a');break;default:_0x18b840=_0x0433('0x1b');break;}var _0x3df239={'method':_0x0433('0x1c'),'uri':_0x18b840+_0x0433('0x1d'),'form':{'grant_type':_0x0433('0x1e'),'client_id':_0x32e035[_0x0433('0x12')],'client_secret':_0x32e035[_0x0433('0x1f')],'redirect_uri':_0x32e035[_0x0433('0x11')],'code':_0x32e035[_0x0433('0x13')]},'headers':{'Content-Type':_0x0433('0x29')}};return rp(_0x3df239)[_0x0433('0x2a')](function(_0x24813d){var _0x1a0e3b=JSON[_0x0433('0x20')](_0x24813d);if(_0x1a0e3b[_0x0433('0x22')]){_0x32e035['refreshToken']=_0x1a0e3b[_0x0433('0x22')];logger['info'](util[_0x0433('0x24')](_0x0433('0x2b'),_0x32e035[_0x0433('0x25')],_0x32e035['id']));}else{logger['error'](util[_0x0433('0x24')](_0x0433('0x27'),_0x32e035['name'],_0x32e035['id']),util[_0x0433('0x28')](_0x1a0e3b,{'showHidden':![],'depth':null}));}return _0x277deb(null,_0x36bd8b);})['catch'](function(_0x5b6b3e){logger[_0x0433('0x26')](util[_0x0433('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x32e035['name'],_0x32e035['id']),util[_0x0433('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x277deb(_0x5b6b3e);});}else{return _0x277deb(null,_0x36bd8b);}}}});}; \ No newline at end of file +var _0xe62e=['POST','/oauth/v2/token','application/x-www-form-urlencoded','then','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','substring','https://accounts.zoho.com','https://accounts.zoho.in','authorization_code','parse','catch','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','slice','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xe62e,0x148));var _0xee62=function(_0x236279,_0x4fd187){_0x236279=_0x236279-0x0;var _0x2fdf2e=_0xe62e[_0x236279];return _0x2fdf2e;};'use strict';var _=require(_0xee62('0x0'));var util=require(_0xee62('0x1'));var logger=require(_0xee62('0x2'))(_0xee62('0x3'));var moment=require(_0xee62('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee62('0x5'));var rimraf=require(_0xee62('0x6'));var config=require(_0xee62('0x7'));var attributes=require(_0xee62('0x8'));var integrations=require(_0xee62('0x9'));module[_0xee62('0xa')]=function(_0x5839ea,_0x284fba){return _0x5839ea[_0xee62('0xb')](_0xee62('0xc'),attributes,{'tableName':_0xee62('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x262768,_0x1d648a,_0x1fb32f){if(_0x262768['changed']('zone')||_0x262768[_0xee62('0xe')](_0xee62('0xf'))||_0x262768[_0xee62('0xe')](_0xee62('0x10'))||_0x262768[_0xee62('0xe')](_0xee62('0x11'))||_0x262768[_0xee62('0xe')](_0xee62('0x12'))||_0x262768[_0xee62('0xe')]('host')){var _0x1bf14c,_0x3586ea;_0x1bf14c=_0x262768[_0xee62('0xf')];var _0x170229=_0x1bf14c[_0xee62('0x13')](-0x1);if(_0x170229==='/'||_0x170229==='\x5c'||_0x170229===':'){_0x1bf14c=_0x1bf14c['substring'](0x0,_0x1bf14c['lastIndexOf'](_0x170229));}switch(_0x262768[_0xee62('0x14')]){case'US':_0x3586ea='https://accounts.zoho.com';break;case'AU':_0x3586ea=_0xee62('0x15');break;case'IN':_0x3586ea='https://accounts.zoho.in';break;case'CN':_0x3586ea=_0xee62('0x16');break;default:_0x3586ea=_0xee62('0x17');break;}var _0x78427a={'method':_0xee62('0x18'),'uri':_0x3586ea+_0xee62('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x262768[_0xee62('0x10')],'client_secret':_0x262768[_0xee62('0x11')],'redirect_uri':_0x262768[_0xee62('0xf')],'code':_0x262768[_0xee62('0x12')]},'headers':{'Content-Type':_0xee62('0x1a')}};return rp(_0x78427a)[_0xee62('0x1b')](function(_0xe37024){var _0x54f3e9=JSON['parse'](_0xe37024);if(_0x54f3e9['refresh_token']){_0x262768[_0xee62('0x1c')]=_0x54f3e9[_0xee62('0x1d')];logger[_0xee62('0x1e')](util[_0xee62('0x1f')](_0xee62('0x20'),_0x262768[_0xee62('0x21')],_0x262768['id']));}else{logger[_0xee62('0x22')](util[_0xee62('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x262768['name'],_0x262768['id']),util['inspect'](_0x54f3e9,{'showHidden':![],'depth':null}));}return _0x1fb32f(null,_0x1d648a);})['catch'](function(_0x2d727f){logger[_0xee62('0x22')](util['format'](_0xee62('0x23'),_0x262768[_0xee62('0x21')],_0x262768['id']),util[_0xee62('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x1fb32f(_0x2d727f);});}else{return _0x1fb32f(null,_0x1d648a);}},'beforeUpdate':function(_0x9c3495,_0x37fdd1,_0x3da8aa){if(_0x9c3495[_0xee62('0xe')](_0xee62('0x14'))||_0x9c3495[_0xee62('0xe')](_0xee62('0xf'))||_0x9c3495['changed'](_0xee62('0x10'))||_0x9c3495[_0xee62('0xe')](_0xee62('0x11'))||_0x9c3495[_0xee62('0xe')]('code')||_0x9c3495[_0xee62('0xe')](_0xee62('0x25'))){var _0x1fca75,_0x2e08ce;_0x1fca75=_0x9c3495['serverUrl'];var _0x285c09=_0x1fca75[_0xee62('0x13')](-0x1);if(_0x285c09==='/'||_0x285c09==='\x5c'||_0x285c09===':'){_0x1fca75=_0x1fca75[_0xee62('0x26')](0x0,_0x1fca75['lastIndexOf'](_0x285c09));}switch(_0x9c3495[_0xee62('0x14')]){case'US':_0x2e08ce=_0xee62('0x27');break;case'AU':_0x2e08ce=_0xee62('0x15');break;case'IN':_0x2e08ce=_0xee62('0x28');break;case'CN':_0x2e08ce=_0xee62('0x16');break;default:_0x2e08ce=_0xee62('0x17');break;}var _0x6a5f9f={'method':_0xee62('0x18'),'uri':_0x2e08ce+'/oauth/v2/token','form':{'grant_type':_0xee62('0x29'),'client_id':_0x9c3495[_0xee62('0x10')],'client_secret':_0x9c3495['clientSecret'],'redirect_uri':_0x9c3495[_0xee62('0xf')],'code':_0x9c3495[_0xee62('0x12')]},'headers':{'Content-Type':_0xee62('0x1a')}};return rp(_0x6a5f9f)[_0xee62('0x1b')](function(_0x3a7420){var _0x2fbfb3=JSON[_0xee62('0x2a')](_0x3a7420);if(_0x2fbfb3[_0xee62('0x1d')]){_0x9c3495[_0xee62('0x1c')]=_0x2fbfb3[_0xee62('0x1d')];logger[_0xee62('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x9c3495['name'],_0x9c3495['id']));}else{logger[_0xee62('0x22')](util[_0xee62('0x1f')](_0xee62('0x23'),_0x9c3495[_0xee62('0x21')],_0x9c3495['id']),util['inspect'](_0x2fbfb3,{'showHidden':![],'depth':null}));}return _0x3da8aa(null,_0x37fdd1);})[_0xee62('0x2b')](function(_0x57f5b5){logger[_0xee62('0x22')](util['format'](_0xee62('0x23'),_0x9c3495[_0xee62('0x21')],_0x9c3495['id']),util[_0xee62('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x3da8aa(_0x57f5b5);});}else{return _0x3da8aa(null,_0x37fdd1);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2935509..4de80bb 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 _0x84c6=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','ZohoAccount,\x20%s,\x20%s','error','message','result','catch','GetZohoAccount','ZohoAccount','options','where','limit','map','include','model','attributes','ShowZohoAccount','raw','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x24c847,_0x13102e){var _0x1d8e52=function(_0x495974){while(--_0x495974){_0x24c847['push'](_0x24c847['shift']());}};_0x1d8e52(++_0x13102e);}(_0x84c6,0xe7));var _0x684c=function(_0x4e1afa,_0xfee3e){_0x4e1afa=_0x4e1afa-0x0;var _0x367b01=_0x84c6[_0x4e1afa];return _0x367b01;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x684c('0x0'));var BPromise=require(_0x684c('0x1'));var rs=require(_0x684c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x684c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x684c('0x4'))(_0x684c('0x5'));var config=require(_0x684c('0x6'));var jayson=require(_0x684c('0x7'));var client=jayson[_0x684c('0x8')][_0x684c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x209f74,_0x2c52dd,_0x168935){return new BPromise(function(_0x2fd628,_0x5824d8){return client[_0x684c('0xa')](_0x209f74,_0x168935)[_0x684c('0xb')](function(_0x5502ad){logger[_0x684c('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2c52dd,_0x684c('0xd'));logger[_0x684c('0xe')](_0x684c('0xf'),_0x2c52dd,_0x684c('0xd'),JSON[_0x684c('0x10')](_0x5502ad));if(_0x5502ad['error']){if(_0x5502ad['error'][_0x684c('0x11')]===0x1f4){logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);return _0x5824d8(_0x5502ad['error'][_0x684c('0x14')]);}logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);return _0x2fd628(_0x5502ad[_0x684c('0x13')][_0x684c('0x14')]);}else{logger[_0x684c('0xc')](_0x684c('0x12'),_0x2c52dd,_0x684c('0xd'));_0x2fd628(_0x5502ad[_0x684c('0x15')]['message']);}})[_0x684c('0x16')](function(_0x5dd4f1){logger['error'](_0x684c('0x12'),_0x2c52dd,_0x5dd4f1);_0x5824d8(_0x5dd4f1);});});}exports[_0x684c('0x17')]=function(_0x421404){var _0x1dc55d=this;return new Promise(function(_0x304099,_0x5d9905){return db[_0x684c('0x18')]['findAll']({'raw':_0x421404['options']?_0x421404[_0x684c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x421404[_0x684c('0x19')]?_0x421404['options'][_0x684c('0x1a')]||null:null,'attributes':_0x421404[_0x684c('0x19')]?_0x421404[_0x684c('0x19')]['attributes']||null:null,'limit':_0x421404[_0x684c('0x19')]?_0x421404[_0x684c('0x19')][_0x684c('0x1b')]||null:null,'include':_0x421404[_0x684c('0x19')]?_0x421404[_0x684c('0x19')]['include']?_[_0x684c('0x1c')](_0x421404[_0x684c('0x19')][_0x684c('0x1d')],function(_0x416912){return{'model':db[_0x416912[_0x684c('0x1e')]],'as':_0x416912['as'],'attributes':_0x416912[_0x684c('0x1f')],'include':_0x416912['include']?_[_0x684c('0x1c')](_0x416912[_0x684c('0x1d')],function(_0x1962a0){return{'model':db[_0x1962a0[_0x684c('0x1e')]],'as':_0x1962a0['as'],'attributes':_0x1962a0[_0x684c('0x1f')],'include':_0x1962a0[_0x684c('0x1d')]?_[_0x684c('0x1c')](_0x1962a0[_0x684c('0x1d')],function(_0xa2fbd9){return{'model':db[_0xa2fbd9['model']],'as':_0xa2fbd9['as'],'attributes':_0xa2fbd9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d3445){logger[_0x684c('0xc')](_0x684c('0x17'),_0x421404);logger[_0x684c('0xe')]('GetZohoAccount',_0x421404,JSON[_0x684c('0x10')](_0x1d3445));_0x304099(_0x1d3445);})['catch'](function(_0x63a41f){logger['error'](_0x684c('0x17'),_0x63a41f[_0x684c('0x14')],_0x421404);_0x5d9905(_0x1dc55d[_0x684c('0x13')](0x1f4,_0x63a41f['message']));});});};exports[_0x684c('0x20')]=function(_0x7b3900){var _0x5dedcb=this;return new Promise(function(_0xadb242,_0x1a944b){return db[_0x684c('0x18')]['find']({'raw':_0x7b3900[_0x684c('0x19')]?_0x7b3900[_0x684c('0x19')][_0x684c('0x21')]===undefined?!![]:![]:!![],'where':_0x7b3900[_0x684c('0x19')]?_0x7b3900['options'][_0x684c('0x1a')]||null:null,'attributes':_0x7b3900[_0x684c('0x19')]?_0x7b3900[_0x684c('0x19')][_0x684c('0x1f')]||null:null,'include':_0x7b3900['options']?_0x7b3900[_0x684c('0x19')]['include']?_[_0x684c('0x1c')](_0x7b3900[_0x684c('0x19')][_0x684c('0x1d')],function(_0x4d8d71){return{'model':db[_0x4d8d71[_0x684c('0x1e')]],'as':_0x4d8d71['as'],'attributes':_0x4d8d71[_0x684c('0x1f')],'include':_0x4d8d71[_0x684c('0x1d')]?_[_0x684c('0x1c')](_0x4d8d71[_0x684c('0x1d')],function(_0x2004d6){return{'model':db[_0x2004d6[_0x684c('0x1e')]],'as':_0x2004d6['as'],'attributes':_0x2004d6[_0x684c('0x1f')],'include':_0x2004d6[_0x684c('0x1d')]?_[_0x684c('0x1c')](_0x2004d6[_0x684c('0x1d')],function(_0xce6b24){return{'model':db[_0xce6b24['model']],'as':_0xce6b24['as'],'attributes':_0xce6b24[_0x684c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10c672){logger['info'](_0x684c('0x20'),_0x7b3900);logger['debug'](_0x684c('0x20'),_0x7b3900,JSON['stringify'](_0x10c672));_0xadb242(_0x10c672);})[_0x684c('0x16')](function(_0x524cf9){logger[_0x684c('0x13')](_0x684c('0x20'),_0x524cf9[_0x684c('0x14')],_0x7b3900);_0x1a944b(_0x5dedcb[_0x684c('0x13')](0x1f4,_0x524cf9[_0x684c('0x14')]));});});}; \ No newline at end of file +var _0xdec3=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','ZohoAccount','findAll','options','raw','where','attributes','map','include','model','GetZohoAccount','ShowZohoAccount','find','lodash','moment','bluebird'];(function(_0x49ba30,_0x5cb169){var _0x47d95f=function(_0x97768e){while(--_0x97768e){_0x49ba30['push'](_0x49ba30['shift']());}};_0x47d95f(++_0x5cb169);}(_0xdec3,0x89));var _0x3dec=function(_0x272e0e,_0x4c9099){_0x272e0e=_0x272e0e-0x0;var _0x34d639=_0xdec3[_0x272e0e];return _0x34d639;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var moment=require(_0x3dec('0x1'));var BPromise=require(_0x3dec('0x2'));var rs=require(_0x3dec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dec('0x4'))['db'];var utils=require(_0x3dec('0x5'));var logger=require(_0x3dec('0x6'))(_0x3dec('0x7'));var config=require('../../config/environment');var jayson=require(_0x3dec('0x8'));var client=jayson[_0x3dec('0x9')][_0x3dec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd3208e,_0x1826ab,_0x311a74){return new BPromise(function(_0x207dcf,_0x4b32d2){return client[_0x3dec('0xb')](_0xd3208e,_0x311a74)[_0x3dec('0xc')](function(_0x599552){logger[_0x3dec('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x1826ab,'request\x20sent');logger[_0x3dec('0xe')](_0x3dec('0xf'),_0x1826ab,'request\x20sent',JSON[_0x3dec('0x10')](_0x599552));if(_0x599552[_0x3dec('0x11')]){if(_0x599552['error'][_0x3dec('0x12')]===0x1f4){logger[_0x3dec('0x11')](_0x3dec('0x13'),_0x1826ab,_0x599552[_0x3dec('0x11')][_0x3dec('0x14')]);return _0x4b32d2(_0x599552[_0x3dec('0x11')]['message']);}logger['error'](_0x3dec('0x13'),_0x1826ab,_0x599552['error'][_0x3dec('0x14')]);return _0x207dcf(_0x599552[_0x3dec('0x11')]['message']);}else{logger['info'](_0x3dec('0x13'),_0x1826ab,'request\x20sent');_0x207dcf(_0x599552[_0x3dec('0x15')]['message']);}})[_0x3dec('0x16')](function(_0x51cb2c){logger[_0x3dec('0x11')](_0x3dec('0x13'),_0x1826ab,_0x51cb2c);_0x4b32d2(_0x51cb2c);});});}exports['GetZohoAccount']=function(_0x31ff6d){var _0x249bc2=this;return new Promise(function(_0x253af9,_0x2f2868){return db[_0x3dec('0x17')][_0x3dec('0x18')]({'raw':_0x31ff6d[_0x3dec('0x19')]?_0x31ff6d[_0x3dec('0x19')][_0x3dec('0x1a')]===undefined?!![]:![]:!![],'where':_0x31ff6d[_0x3dec('0x19')]?_0x31ff6d[_0x3dec('0x19')][_0x3dec('0x1b')]||null:null,'attributes':_0x31ff6d[_0x3dec('0x19')]?_0x31ff6d[_0x3dec('0x19')][_0x3dec('0x1c')]||null:null,'limit':_0x31ff6d[_0x3dec('0x19')]?_0x31ff6d[_0x3dec('0x19')]['limit']||null:null,'include':_0x31ff6d['options']?_0x31ff6d['options']['include']?_[_0x3dec('0x1d')](_0x31ff6d[_0x3dec('0x19')][_0x3dec('0x1e')],function(_0x15267f){return{'model':db[_0x15267f[_0x3dec('0x1f')]],'as':_0x15267f['as'],'attributes':_0x15267f[_0x3dec('0x1c')],'include':_0x15267f[_0x3dec('0x1e')]?_[_0x3dec('0x1d')](_0x15267f[_0x3dec('0x1e')],function(_0x559b91){return{'model':db[_0x559b91[_0x3dec('0x1f')]],'as':_0x559b91['as'],'attributes':_0x559b91[_0x3dec('0x1c')],'include':_0x559b91[_0x3dec('0x1e')]?_['map'](_0x559b91[_0x3dec('0x1e')],function(_0x2febf7){return{'model':db[_0x2febf7['model']],'as':_0x2febf7['as'],'attributes':_0x2febf7[_0x3dec('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3dec('0xc')](function(_0x5a578f){logger[_0x3dec('0xd')](_0x3dec('0x20'),_0x31ff6d);logger[_0x3dec('0xe')](_0x3dec('0x20'),_0x31ff6d,JSON[_0x3dec('0x10')](_0x5a578f));_0x253af9(_0x5a578f);})['catch'](function(_0x2d7db9){logger['error']('GetZohoAccount',_0x2d7db9[_0x3dec('0x14')],_0x31ff6d);_0x2f2868(_0x249bc2['error'](0x1f4,_0x2d7db9['message']));});});};exports[_0x3dec('0x21')]=function(_0x3c8d47){var _0x20ad4e=this;return new Promise(function(_0x127b17,_0x53b279){return db[_0x3dec('0x17')][_0x3dec('0x22')]({'raw':_0x3c8d47[_0x3dec('0x19')]?_0x3c8d47[_0x3dec('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3c8d47[_0x3dec('0x19')]?_0x3c8d47['options']['where']||null:null,'attributes':_0x3c8d47[_0x3dec('0x19')]?_0x3c8d47[_0x3dec('0x19')][_0x3dec('0x1c')]||null:null,'include':_0x3c8d47[_0x3dec('0x19')]?_0x3c8d47[_0x3dec('0x19')][_0x3dec('0x1e')]?_['map'](_0x3c8d47['options'][_0x3dec('0x1e')],function(_0x561906){return{'model':db[_0x561906[_0x3dec('0x1f')]],'as':_0x561906['as'],'attributes':_0x561906[_0x3dec('0x1c')],'include':_0x561906[_0x3dec('0x1e')]?_[_0x3dec('0x1d')](_0x561906['include'],function(_0x118b8b){return{'model':db[_0x118b8b['model']],'as':_0x118b8b['as'],'attributes':_0x118b8b[_0x3dec('0x1c')],'include':_0x118b8b[_0x3dec('0x1e')]?_[_0x3dec('0x1d')](_0x118b8b[_0x3dec('0x1e')],function(_0x5a7a41){return{'model':db[_0x5a7a41['model']],'as':_0x5a7a41['as'],'attributes':_0x5a7a41[_0x3dec('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3dec('0xc')](function(_0x5e8a49){logger[_0x3dec('0xd')](_0x3dec('0x21'),_0x3c8d47);logger[_0x3dec('0xe')](_0x3dec('0x21'),_0x3c8d47,JSON[_0x3dec('0x10')](_0x5e8a49));_0x127b17(_0x5e8a49);})['catch'](function(_0x5903cc){logger[_0x3dec('0x11')](_0x3dec('0x21'),_0x5903cc[_0x3dec('0x14')],_0x3c8d47);_0x53b279(_0x20ad4e[_0x3dec('0x11')](0x1f4,_0x5903cc[_0x3dec('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 80e6638..381770e 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 _0x0c9a=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x0c9a,0x12d));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa0c9('0x0'));var util=require('util');var path=require(_0xa0c9('0x1'));var timeout=require(_0xa0c9('0x2'));var express=require(_0xa0c9('0x3'));var router=express[_0xa0c9('0x4')]();var fs_extra=require(_0xa0c9('0x5'));var auth=require(_0xa0c9('0x6'));var interaction=require(_0xa0c9('0x7'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xa0c9('0x8')]('/',auth[_0xa0c9('0x9')](),controller['index']);router['get'](_0xa0c9('0xa'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0xb')]);router['get'](_0xa0c9('0xc'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0xd')]);router[_0xa0c9('0x8')](_0xa0c9('0xe'),auth[_0xa0c9('0x9')](),controller['getSubjects']);router[_0xa0c9('0x8')](_0xa0c9('0xf'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0x10')]);router[_0xa0c9('0x11')]('/',auth[_0xa0c9('0x9')](),controller['create']);router[_0xa0c9('0x12')](_0xa0c9('0xa'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0x13')]);router[_0xa0c9('0x14')](_0xa0c9('0xa'),auth[_0xa0c9('0x9')](),controller[_0xa0c9('0x15')]);module[_0xa0c9('0x16')]=router; \ No newline at end of file +var _0xc10c=['../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','index','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1f61b8,_0x3cc9b3){var _0x562337=function(_0x27e7a1){while(--_0x27e7a1){_0x1f61b8['push'](_0x1f61b8['shift']());}};_0x562337(++_0x3cc9b3);}(_0xc10c,0x169));var _0xcc10=function(_0xcfd44a,_0x165cc9){_0xcfd44a=_0xcfd44a-0x0;var _0x46af83=_0xc10c[_0xcfd44a];return _0x46af83;};'use strict';var multer=require(_0xcc10('0x0'));var util=require(_0xcc10('0x1'));var path=require(_0xcc10('0x2'));var timeout=require(_0xcc10('0x3'));var express=require(_0xcc10('0x4'));var router=express[_0xcc10('0x5')]();var fs_extra=require(_0xcc10('0x6'));var auth=require(_0xcc10('0x7'));var interaction=require(_0xcc10('0x8'));var config=require('../../config/environment');var controller=require(_0xcc10('0x9'));router[_0xcc10('0xa')]('/',auth['isAuthenticated'](),controller[_0xcc10('0xb')]);router[_0xcc10('0xa')]('/:id',auth[_0xcc10('0xc')](),controller['show']);router[_0xcc10('0xa')]('/:id/fields',auth[_0xcc10('0xc')](),controller[_0xcc10('0xd')]);router[_0xcc10('0xa')](_0xcc10('0xe'),auth[_0xcc10('0xc')](),controller[_0xcc10('0xf')]);router['get']('/:id/descriptions',auth[_0xcc10('0xc')](),controller[_0xcc10('0x10')]);router[_0xcc10('0x11')]('/',auth[_0xcc10('0xc')](),controller[_0xcc10('0x12')]);router['put'](_0xcc10('0x13'),auth['isAuthenticated'](),controller[_0xcc10('0x14')]);router['delete'](_0xcc10('0x13'),auth['isAuthenticated'](),controller[_0xcc10('0x15')]);module[_0xcc10('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e8712d8..4d2bbfa 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 _0x568a=['contact_lead','STRING','ENUM','lead','contact'];(function(_0x298112,_0x436478){var _0x561dc7=function(_0x2f2ce5){while(--_0x2f2ce5){_0x298112['push'](_0x298112['shift']());}};_0x561dc7(++_0x436478);}(_0x568a,0x1dc));var _0xa568=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x568a[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa568('0x0')]},'moduleCreate':{'type':Sequelize[_0xa568('0x1')](_0xa568('0x2'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa568('0x1')]('contact_lead',_0xa568('0x3'),'lead'),'defaultValue':_0xa568('0x4')},'description':{'type':Sequelize[_0xa568('0x0')]}}; \ No newline at end of file +var _0x885f=['contact','nothing','ENUM','contact_lead','sequelize','exports','STRING'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x885f,0xa5));var _0xf885=function(_0x491ded,_0x17abba){_0x491ded=_0x491ded-0x0;var _0x4ea2c9=_0x885f[_0x491ded];return _0x4ea2c9;};'use strict';var Sequelize=require(_0xf885('0x0'));module[_0xf885('0x1')]={'name':{'type':Sequelize[_0xf885('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0xf885('0x3'),_0xf885('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xf885('0x5')](_0xf885('0x6'),_0xf885('0x3'),'lead'),'defaultValue':_0xf885('0x6')},'description':{'type':Sequelize[_0xf885('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 69b3897..046fe23 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 _0x6daa=['end','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','ZohoConfiguration','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','getFields','findOne','ZohoField','map','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x4c2f48,_0x3b5a02){var _0x113d48=function(_0x1a8587){while(--_0x1a8587){_0x4c2f48['push'](_0x4c2f48['shift']());}};_0x113d48(++_0x3b5a02);}(_0x6daa,0x127));var _0xa6da=function(_0x43c6fa,_0x2744f5){_0x43c6fa=_0x43c6fa-0x0;var _0x2f08d7=_0x6daa[_0x43c6fa];return _0x2f08d7;};'use strict';var emlformat=require(_0xa6da('0x0'));var rimraf=require(_0xa6da('0x1'));var zipdir=require(_0xa6da('0x2'));var jsonpatch=require(_0xa6da('0x3'));var rp=require(_0xa6da('0x4'));var moment=require(_0xa6da('0x5'));var BPromise=require(_0xa6da('0x6'));var Mustache=require(_0xa6da('0x7'));var util=require(_0xa6da('0x8'));var path=require(_0xa6da('0x9'));var sox=require('sox');var csv=require(_0xa6da('0xa'));var ejs=require(_0xa6da('0xb'));var fs=require('fs');var fs_extra=require(_0xa6da('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa6da('0xd'));var jsforce=require(_0xa6da('0xe'));var deskjs=require(_0xa6da('0xf'));var toCsv=require(_0xa6da('0xa'));var querystring=require(_0xa6da('0x10'));var Papa=require(_0xa6da('0x11'));var Redis=require('ioredis');var authService=require(_0xa6da('0x12'));var qs=require(_0xa6da('0x13'));var as=require(_0xa6da('0x14'));var hardwareService=require(_0xa6da('0x15'));var logger=require('../../config/logger')(_0xa6da('0x16'));var utils=require(_0xa6da('0x17'));var config=require(_0xa6da('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa8a117,_0x568b77){_0x568b77=_0x568b77||0xcc;return function(_0x5a2867){if(_0x5a2867){return _0xa8a117['sendStatus'](_0x568b77);}return _0xa8a117['status'](_0x568b77)[_0xa6da('0x19')]();};}function respondWithResult(_0x45b485,_0x5832b8){_0x5832b8=_0x5832b8||0xc8;return function(_0x10c519){if(_0x10c519){return _0x45b485[_0xa6da('0x1a')](_0x5832b8)[_0xa6da('0x1b')](_0x10c519);}};}function respondWithFilteredResult(_0xf8e39,_0x2fc496){return function(_0x36541c){if(_0x36541c){var _0x4592d5=typeof _0x2fc496[_0xa6da('0x1c')]===_0xa6da('0x1d')&&typeof _0x2fc496['limit']===_0xa6da('0x1d');var _0x386043=_0x36541c[_0xa6da('0x1e')];var _0x220576=_0x4592d5?0x0:_0x2fc496[_0xa6da('0x1c')];var _0x10de8c=_0x4592d5?_0x36541c[_0xa6da('0x1e')]:_0x2fc496[_0xa6da('0x1c')]+_0x2fc496[_0xa6da('0x1f')];var _0xff03b6;if(_0x10de8c>=_0x386043){_0x10de8c=_0x386043;_0xff03b6=0xc8;}else{_0xff03b6=0xce;}_0xf8e39['status'](_0xff03b6);return _0xf8e39['set'](_0xa6da('0x20'),_0x220576+'-'+_0x10de8c+'/'+_0x386043)[_0xa6da('0x1b')](_0x36541c);}return null;};}function patchUpdates(_0x509eb2){return function(_0x5cf0f5){try{jsonpatch[_0xa6da('0x21')](_0x5cf0f5,_0x509eb2,!![]);}catch(_0x39655c){return BPromise['reject'](_0x39655c);}return _0x5cf0f5[_0xa6da('0x22')]();};}function saveUpdates(_0x51d6d9,_0x30f4da){return function(_0x3f94a3){if(_0x3f94a3){return _0x3f94a3[_0xa6da('0x23')](_0x51d6d9)[_0xa6da('0x24')](function(_0x10def0){return _0x10def0;});}return null;};}function removeEntity(_0x363437,_0x403698){return function(_0x452ead){if(_0x452ead){return _0x452ead[_0xa6da('0x25')]()['then'](function(){_0x363437['status'](0xcc)[_0xa6da('0x19')]();});}};}function handleEntityNotFound(_0x380870,_0x10a62c){return function(_0x9fd5eb){if(!_0x9fd5eb){_0x380870[_0xa6da('0x26')](0x194);}return _0x9fd5eb;};}function handleError(_0x446737,_0x43b206){_0x43b206=_0x43b206||0x1f4;return function(_0x333634){logger[_0xa6da('0x27')](_0x333634[_0xa6da('0x28')]);if(_0x333634[_0xa6da('0x29')]){delete _0x333634['name'];}_0x446737[_0xa6da('0x1a')](_0x43b206)['send'](_0x333634);};}exports[_0xa6da('0x2a')]=function(_0x1003f5,_0x354ce2){var _0x24f048={},_0x7161e2={},_0x17b361={'count':0x0,'rows':[]};var _0x33b0f8=_['map'](db[_0xa6da('0x2b')]['rawAttributes'],function(_0x31e903){return{'name':_0x31e903['fieldName'],'type':_0x31e903['type'][_0xa6da('0x2c')]};});_0x7161e2[_0xa6da('0x2d')]=_['map'](_0x33b0f8,_0xa6da('0x29'));_0x7161e2[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x1003f5[_0xa6da('0x2e')]);_0x7161e2[_0xa6da('0x30')]=_[_0xa6da('0x31')](_0x7161e2[_0xa6da('0x2d')],_0x7161e2[_0xa6da('0x2e')]);_0x24f048[_0xa6da('0x32')]=_[_0xa6da('0x31')](_0x7161e2[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x33')]));_0x24f048[_0xa6da('0x32')]=_0x24f048[_0xa6da('0x32')]['length']?_0x24f048['attributes']:_0x7161e2['model'];if(!_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x34')]('nolimit')){_0x24f048[_0xa6da('0x1f')]=qs[_0xa6da('0x1f')](_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x1f')]);_0x24f048[_0xa6da('0x1c')]=qs[_0xa6da('0x1c')](_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x1c')]);}_0x24f048[_0xa6da('0x35')]=qs[_0xa6da('0x36')](_0x1003f5['query']['sort']);_0x24f048[_0xa6da('0x37')]=qs['filters'](_[_0xa6da('0x38')](_0x1003f5[_0xa6da('0x2e')],_0x7161e2[_0xa6da('0x30')]),_0x33b0f8);if(_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x39')]){_0x24f048['where']=_['merge'](_0x24f048['where'],{'$or':_['map'](_0x33b0f8,function(_0x5e9f32){if(_0x5e9f32[_0xa6da('0x3a')]!==_0xa6da('0x3b')){var _0x2f6159={};_0x2f6159[_0x5e9f32[_0xa6da('0x29')]]={'$like':'%'+_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x39')]+'%'};return _0x2f6159;}})});}_0x24f048=_[_0xa6da('0x3c')]({},_0x24f048,_0x1003f5[_0xa6da('0x3d')]);var _0x494bfd={'where':_0x24f048[_0xa6da('0x37')]};return db[_0xa6da('0x2b')][_0xa6da('0x1e')](_0x494bfd)[_0xa6da('0x24')](function(_0x6e49c3){_0x17b361[_0xa6da('0x1e')]=_0x6e49c3;if(_0x1003f5[_0xa6da('0x2e')][_0xa6da('0x3e')]){_0x24f048[_0xa6da('0x3f')]=[{'all':!![]}];}return db[_0xa6da('0x2b')][_0xa6da('0x40')](_0x24f048);})[_0xa6da('0x24')](function(_0x399a78){_0x17b361['rows']=_0x399a78;return _0x17b361;})[_0xa6da('0x24')](respondWithFilteredResult(_0x354ce2,_0x24f048))[_0xa6da('0x41')](handleError(_0x354ce2,null));};exports[_0xa6da('0x42')]=function(_0x21c8c7,_0x463256){var _0x39e64b={'raw':![],'where':{'id':_0x21c8c7[_0xa6da('0x43')]['id']}},_0x51219e={};_0x51219e[_0xa6da('0x2d')]=_[_0xa6da('0x2f')](db[_0xa6da('0x2b')][_0xa6da('0x44')]);_0x51219e[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x21c8c7['query']);_0x51219e['filters']=_[_0xa6da('0x31')](_0x51219e[_0xa6da('0x2d')],_0x51219e[_0xa6da('0x2e')]);_0x39e64b['attributes']=_[_0xa6da('0x31')](_0x51219e[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x21c8c7[_0xa6da('0x2e')][_0xa6da('0x33')]));_0x39e64b[_0xa6da('0x32')]=_0x39e64b[_0xa6da('0x32')][_0xa6da('0x45')]?_0x39e64b[_0xa6da('0x32')]:_0x51219e[_0xa6da('0x2d')];if(_0x21c8c7[_0xa6da('0x2e')][_0xa6da('0x3e')]){_0x39e64b[_0xa6da('0x3f')]=[{'all':!![]}];}_0x39e64b=_[_0xa6da('0x3c')]({},_0x39e64b,_0x21c8c7[_0xa6da('0x3d')]);return db[_0xa6da('0x2b')][_0xa6da('0x46')](_0x39e64b)[_0xa6da('0x24')](handleEntityNotFound(_0x463256,null))['then'](respondWithResult(_0x463256,null))[_0xa6da('0x41')](handleError(_0x463256,null));};exports[_0xa6da('0x47')]=function(_0x2817e0,_0x5d36fb){return db['ZohoConfiguration'][_0xa6da('0x47')](_0x2817e0[_0xa6da('0x48')],{})[_0xa6da('0x24')](respondWithResult(_0x5d36fb,0xc9))[_0xa6da('0x41')](handleError(_0x5d36fb,null));};exports['update']=function(_0x1aade4,_0x20b86c){if(_0x1aade4['body']['id']){delete _0x1aade4[_0xa6da('0x48')]['id'];}return db['ZohoConfiguration'][_0xa6da('0x46')]({'where':{'id':_0x1aade4[_0xa6da('0x43')]['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x20b86c,null))[_0xa6da('0x24')](saveUpdates(_0x1aade4['body'],null))[_0xa6da('0x24')](respondWithResult(_0x20b86c,null))[_0xa6da('0x41')](handleError(_0x20b86c,null));};exports[_0xa6da('0x25')]=function(_0x4c8c0e,_0x3f163a){return db['ZohoConfiguration'][_0xa6da('0x46')]({'where':{'id':_0x4c8c0e['params']['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x3f163a,null))[_0xa6da('0x24')](removeEntity(_0x3f163a,null))[_0xa6da('0x41')](handleError(_0x3f163a,null));};exports[_0xa6da('0x49')]=function(_0x57bd45,_0x55e8dc,_0x3aa543){var _0x459b7e={};var _0x480c65={};var _0x361f4a;var _0x15fc7c;return db[_0xa6da('0x2b')][_0xa6da('0x4a')]({'where':{'id':_0x57bd45[_0xa6da('0x43')]['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x55e8dc,null))[_0xa6da('0x24')](function(_0x1bfc64){if(_0x1bfc64){_0x361f4a=_0x1bfc64;_0x480c65[_0xa6da('0x2d')]=_[_0xa6da('0x2f')](db[_0xa6da('0x4b')][_0xa6da('0x44')]);_0x480c65[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x57bd45[_0xa6da('0x2e')]);_0x480c65['filters']=_['intersection'](_0x480c65[_0xa6da('0x2d')],_0x480c65['query']);_0x459b7e[_0xa6da('0x32')]=_[_0xa6da('0x31')](_0x480c65[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x57bd45[_0xa6da('0x2e')]['fields']));_0x459b7e[_0xa6da('0x32')]=_0x459b7e[_0xa6da('0x32')][_0xa6da('0x45')]?_0x459b7e[_0xa6da('0x32')]:_0x480c65[_0xa6da('0x2d')];_0x459b7e[_0xa6da('0x35')]=qs['sort'](_0x57bd45[_0xa6da('0x2e')][_0xa6da('0x36')]);_0x459b7e[_0xa6da('0x37')]=qs[_0xa6da('0x30')](_[_0xa6da('0x38')](_0x57bd45[_0xa6da('0x2e')],_0x480c65[_0xa6da('0x30')]));if(_0x57bd45[_0xa6da('0x2e')][_0xa6da('0x39')]){_0x459b7e[_0xa6da('0x37')]=_[_0xa6da('0x3c')](_0x459b7e[_0xa6da('0x37')],{'$or':_[_0xa6da('0x4c')](_0x459b7e[_0xa6da('0x32')],function(_0x5469f6){var _0x1512dc={};_0x1512dc[_0x5469f6]={'$like':'%'+_0x57bd45[_0xa6da('0x2e')][_0xa6da('0x39')]+'%'};return _0x1512dc;})});}_0x459b7e=_[_0xa6da('0x3c')]({},_0x459b7e,_0x57bd45['options']);return _0x361f4a[_0xa6da('0x49')](_0x459b7e);}})[_0xa6da('0x24')](function(_0x2b9e78){if(_0x2b9e78){_0x15fc7c=_0x2b9e78[_0xa6da('0x45')];if(!_0x57bd45['query'][_0xa6da('0x34')](_0xa6da('0x4d'))){_0x459b7e[_0xa6da('0x1f')]=qs[_0xa6da('0x1f')](_0x57bd45[_0xa6da('0x2e')][_0xa6da('0x1f')]);_0x459b7e['offset']=qs['offset'](_0x57bd45['query']['offset']);}return _0x361f4a[_0xa6da('0x49')](_0x459b7e);}})[_0xa6da('0x24')](function(_0x526749){if(_0x526749){return _0x526749?{'count':_0x15fc7c,'rows':_0x526749}:null;}})[_0xa6da('0x24')](respondWithResult(_0x55e8dc,null))[_0xa6da('0x41')](handleError(_0x55e8dc,null));};exports[_0xa6da('0x4e')]=function(_0x45507c,_0x3abd29,_0x4a842f){var _0x35e16f={};var _0x4a7a50={};var _0x1d6814;var _0x560be5;return db['ZohoConfiguration'][_0xa6da('0x4a')]({'where':{'id':_0x45507c[_0xa6da('0x43')]['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x3abd29,null))[_0xa6da('0x24')](function(_0x38ac1c){if(_0x38ac1c){_0x1d6814=_0x38ac1c;_0x4a7a50[_0xa6da('0x2d')]=_[_0xa6da('0x2f')](db['ZohoField'][_0xa6da('0x44')]);_0x4a7a50[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x45507c['query']);_0x4a7a50[_0xa6da('0x30')]=_[_0xa6da('0x31')](_0x4a7a50['model'],_0x4a7a50[_0xa6da('0x2e')]);_0x35e16f[_0xa6da('0x32')]=_['intersection'](_0x4a7a50[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x45507c['query'][_0xa6da('0x33')]));_0x35e16f[_0xa6da('0x32')]=_0x35e16f[_0xa6da('0x32')]['length']?_0x35e16f[_0xa6da('0x32')]:_0x4a7a50[_0xa6da('0x2d')];_0x35e16f[_0xa6da('0x35')]=qs[_0xa6da('0x36')](_0x45507c[_0xa6da('0x2e')]['sort']);_0x35e16f['where']=qs['filters'](_['pick'](_0x45507c[_0xa6da('0x2e')],_0x4a7a50['filters']));if(_0x45507c[_0xa6da('0x2e')]['filter']){_0x35e16f[_0xa6da('0x37')]=_['merge'](_0x35e16f[_0xa6da('0x37')],{'$or':_[_0xa6da('0x4c')](_0x35e16f[_0xa6da('0x32')],function(_0x2233fe){var _0x4b4dc7={};_0x4b4dc7[_0x2233fe]={'$like':'%'+_0x45507c[_0xa6da('0x2e')][_0xa6da('0x39')]+'%'};return _0x4b4dc7;})});}_0x35e16f=_[_0xa6da('0x3c')]({},_0x35e16f,_0x45507c[_0xa6da('0x3d')]);return _0x1d6814[_0xa6da('0x4e')](_0x35e16f);}})[_0xa6da('0x24')](function(_0x2ec0df){if(_0x2ec0df){_0x560be5=_0x2ec0df[_0xa6da('0x45')];if(!_0x45507c['query'][_0xa6da('0x34')]('nolimit')){_0x35e16f[_0xa6da('0x1f')]=qs[_0xa6da('0x1f')](_0x45507c[_0xa6da('0x2e')][_0xa6da('0x1f')]);_0x35e16f[_0xa6da('0x1c')]=qs[_0xa6da('0x1c')](_0x45507c[_0xa6da('0x2e')]['offset']);}return _0x1d6814[_0xa6da('0x4e')](_0x35e16f);}})[_0xa6da('0x24')](function(_0x718893){if(_0x718893){return _0x718893?{'count':_0x560be5,'rows':_0x718893}:null;}})[_0xa6da('0x24')](respondWithResult(_0x3abd29,null))[_0xa6da('0x41')](handleError(_0x3abd29,null));};exports['getDescriptions']=function(_0x29dfbb,_0x1900cd,_0x41bc2d){var _0x14cbb8={};var _0x56f46e={};var _0x56b588;var _0x49b15b;return db[_0xa6da('0x2b')][_0xa6da('0x4a')]({'where':{'id':_0x29dfbb[_0xa6da('0x43')]['id']}})[_0xa6da('0x24')](handleEntityNotFound(_0x1900cd,null))[_0xa6da('0x24')](function(_0x5c2d71){if(_0x5c2d71){_0x56b588=_0x5c2d71;_0x56f46e['model']=_[_0xa6da('0x2f')](db['ZohoField'][_0xa6da('0x44')]);_0x56f46e[_0xa6da('0x2e')]=_[_0xa6da('0x2f')](_0x29dfbb[_0xa6da('0x2e')]);_0x56f46e[_0xa6da('0x30')]=_[_0xa6da('0x31')](_0x56f46e[_0xa6da('0x2d')],_0x56f46e[_0xa6da('0x2e')]);_0x14cbb8[_0xa6da('0x32')]=_[_0xa6da('0x31')](_0x56f46e[_0xa6da('0x2d')],qs[_0xa6da('0x33')](_0x29dfbb[_0xa6da('0x2e')]['fields']));_0x14cbb8['attributes']=_0x14cbb8[_0xa6da('0x32')][_0xa6da('0x45')]?_0x14cbb8[_0xa6da('0x32')]:_0x56f46e[_0xa6da('0x2d')];_0x14cbb8[_0xa6da('0x35')]=qs[_0xa6da('0x36')](_0x29dfbb[_0xa6da('0x2e')][_0xa6da('0x36')]);_0x14cbb8[_0xa6da('0x37')]=qs[_0xa6da('0x30')](_[_0xa6da('0x38')](_0x29dfbb[_0xa6da('0x2e')],_0x56f46e[_0xa6da('0x30')]));if(_0x29dfbb[_0xa6da('0x2e')]['filter']){_0x14cbb8[_0xa6da('0x37')]=_['merge'](_0x14cbb8['where'],{'$or':_[_0xa6da('0x4c')](_0x14cbb8[_0xa6da('0x32')],function(_0x2fb7cf){var _0x516722={};_0x516722[_0x2fb7cf]={'$like':'%'+_0x29dfbb[_0xa6da('0x2e')][_0xa6da('0x39')]+'%'};return _0x516722;})});}_0x14cbb8=_[_0xa6da('0x3c')]({},_0x14cbb8,_0x29dfbb[_0xa6da('0x3d')]);return _0x56b588[_0xa6da('0x4f')](_0x14cbb8);}})[_0xa6da('0x24')](function(_0x24570d){if(_0x24570d){_0x49b15b=_0x24570d[_0xa6da('0x45')];if(!_0x29dfbb['query']['hasOwnProperty'](_0xa6da('0x4d'))){_0x14cbb8[_0xa6da('0x1f')]=qs[_0xa6da('0x1f')](_0x29dfbb[_0xa6da('0x2e')][_0xa6da('0x1f')]);_0x14cbb8[_0xa6da('0x1c')]=qs[_0xa6da('0x1c')](_0x29dfbb['query'][_0xa6da('0x1c')]);}return _0x56b588[_0xa6da('0x4f')](_0x14cbb8);}})[_0xa6da('0x24')](function(_0x356582){if(_0x356582){return _0x356582?{'count':_0x49b15b,'rows':_0x356582}:null;}})[_0xa6da('0x24')](respondWithResult(_0x1900cd,null))[_0xa6da('0x41')](handleError(_0x1900cd,null));}; \ No newline at end of file +var _0xc7ac=['status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','create','body','findOne','ZohoField','filter','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','path','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','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0x26820d,_0x148ec5){var _0x5688b2=function(_0x5f4e65){while(--_0x5f4e65){_0x26820d['push'](_0x26820d['shift']());}};_0x5688b2(++_0x148ec5);}(_0xc7ac,0x89));var _0xcc7a=function(_0x4760d1,_0x6490d3){_0x4760d1=_0x4760d1-0x0;var _0x5870a4=_0xc7ac[_0x4760d1];return _0x5870a4;};'use strict';var emlformat=require(_0xcc7a('0x0'));var rimraf=require(_0xcc7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc7a('0x2'));var rp=require('request-promise');var moment=require(_0xcc7a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcc7a('0x4'));var util=require('util');var path=require(_0xcc7a('0x5'));var sox=require(_0xcc7a('0x6'));var csv=require(_0xcc7a('0x7'));var ejs=require(_0xcc7a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcc7a('0x9'));var squel=require(_0xcc7a('0xa'));var crypto=require('crypto');var jsforce=require(_0xcc7a('0xb'));var deskjs=require(_0xcc7a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcc7a('0xd'));var Papa=require(_0xcc7a('0xe'));var Redis=require(_0xcc7a('0xf'));var authService=require(_0xcc7a('0x10'));var qs=require(_0xcc7a('0x11'));var as=require(_0xcc7a('0x12'));var hardwareService=require(_0xcc7a('0x13'));var logger=require(_0xcc7a('0x14'))(_0xcc7a('0x15'));var utils=require(_0xcc7a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcc7a('0x17'))['db'];function respondWithStatusCode(_0x3ce7ae,_0x46c371){_0x46c371=_0x46c371||0xcc;return function(_0x7f7b2f){if(_0x7f7b2f){return _0x3ce7ae[_0xcc7a('0x18')](_0x46c371);}return _0x3ce7ae[_0xcc7a('0x19')](_0x46c371)[_0xcc7a('0x1a')]();};}function respondWithResult(_0x277fd5,_0x32288e){_0x32288e=_0x32288e||0xc8;return function(_0x2a08c4){if(_0x2a08c4){return _0x277fd5['status'](_0x32288e)[_0xcc7a('0x1b')](_0x2a08c4);}};}function respondWithFilteredResult(_0x5b719c,_0x264567){return function(_0x222594){if(_0x222594){var _0x50f197=typeof _0x264567['offset']===_0xcc7a('0x1c')&&typeof _0x264567['limit']===_0xcc7a('0x1c');var _0x229517=_0x222594[_0xcc7a('0x1d')];var _0x36fe48=_0x50f197?0x0:_0x264567[_0xcc7a('0x1e')];var _0x37a2c5=_0x50f197?_0x222594[_0xcc7a('0x1d')]:_0x264567[_0xcc7a('0x1e')]+_0x264567[_0xcc7a('0x1f')];var _0x4ccac3;if(_0x37a2c5>=_0x229517){_0x37a2c5=_0x229517;_0x4ccac3=0xc8;}else{_0x4ccac3=0xce;}_0x5b719c[_0xcc7a('0x19')](_0x4ccac3);return _0x5b719c[_0xcc7a('0x20')](_0xcc7a('0x21'),_0x36fe48+'-'+_0x37a2c5+'/'+_0x229517)[_0xcc7a('0x1b')](_0x222594);}return null;};}function patchUpdates(_0x2e5572){return function(_0x3f812b){try{jsonpatch[_0xcc7a('0x22')](_0x3f812b,_0x2e5572,!![]);}catch(_0x1b6485){return BPromise[_0xcc7a('0x23')](_0x1b6485);}return _0x3f812b[_0xcc7a('0x24')]();};}function saveUpdates(_0x2955b6,_0x144a36){return function(_0x5bb6f5){if(_0x5bb6f5){return _0x5bb6f5[_0xcc7a('0x25')](_0x2955b6)[_0xcc7a('0x26')](function(_0x1ae250){return _0x1ae250;});}return null;};}function removeEntity(_0x3b6736,_0x2b7c3a){return function(_0x354d55){if(_0x354d55){return _0x354d55[_0xcc7a('0x27')]()[_0xcc7a('0x26')](function(){_0x3b6736[_0xcc7a('0x19')](0xcc)[_0xcc7a('0x1a')]();});}};}function handleEntityNotFound(_0x206d1d,_0x500107){return function(_0x50098e){if(!_0x50098e){_0x206d1d[_0xcc7a('0x18')](0x194);}return _0x50098e;};}function handleError(_0x4f2b19,_0x2e604d){_0x2e604d=_0x2e604d||0x1f4;return function(_0x4a8a2c){logger['error'](_0x4a8a2c[_0xcc7a('0x28')]);if(_0x4a8a2c['name']){delete _0x4a8a2c[_0xcc7a('0x29')];}_0x4f2b19[_0xcc7a('0x19')](_0x2e604d)[_0xcc7a('0x2a')](_0x4a8a2c);};}exports['index']=function(_0x58c121,_0x31fa8e){var _0x1c4e2a={},_0x158be5={},_0x1a7f45={'count':0x0,'rows':[]};var _0x277f1a=_[_0xcc7a('0x2b')](db[_0xcc7a('0x2c')][_0xcc7a('0x2d')],function(_0x1e82c6){return{'name':_0x1e82c6[_0xcc7a('0x2e')],'type':_0x1e82c6[_0xcc7a('0x2f')][_0xcc7a('0x30')]};});_0x158be5[_0xcc7a('0x31')]=_[_0xcc7a('0x2b')](_0x277f1a,'name');_0x158be5[_0xcc7a('0x32')]=_[_0xcc7a('0x33')](_0x58c121[_0xcc7a('0x32')]);_0x158be5[_0xcc7a('0x34')]=_[_0xcc7a('0x35')](_0x158be5[_0xcc7a('0x31')],_0x158be5[_0xcc7a('0x32')]);_0x1c4e2a[_0xcc7a('0x36')]=_[_0xcc7a('0x35')](_0x158be5['model'],qs[_0xcc7a('0x37')](_0x58c121[_0xcc7a('0x32')]['fields']));_0x1c4e2a['attributes']=_0x1c4e2a[_0xcc7a('0x36')][_0xcc7a('0x38')]?_0x1c4e2a['attributes']:_0x158be5[_0xcc7a('0x31')];if(!_0x58c121['query']['hasOwnProperty'](_0xcc7a('0x39'))){_0x1c4e2a['limit']=qs['limit'](_0x58c121[_0xcc7a('0x32')][_0xcc7a('0x1f')]);_0x1c4e2a[_0xcc7a('0x1e')]=qs[_0xcc7a('0x1e')](_0x58c121[_0xcc7a('0x32')][_0xcc7a('0x1e')]);}_0x1c4e2a[_0xcc7a('0x3a')]=qs[_0xcc7a('0x3b')](_0x58c121['query'][_0xcc7a('0x3b')]);_0x1c4e2a[_0xcc7a('0x3c')]=qs['filters'](_[_0xcc7a('0x3d')](_0x58c121['query'],_0x158be5[_0xcc7a('0x34')]),_0x277f1a);if(_0x58c121[_0xcc7a('0x32')]['filter']){_0x1c4e2a[_0xcc7a('0x3c')]=_['merge'](_0x1c4e2a[_0xcc7a('0x3c')],{'$or':_['map'](_0x277f1a,function(_0x561e70){if(_0x561e70[_0xcc7a('0x2f')]!==_0xcc7a('0x3e')){var _0x1042e8={};_0x1042e8[_0x561e70[_0xcc7a('0x29')]]={'$like':'%'+_0x58c121['query']['filter']+'%'};return _0x1042e8;}})});}_0x1c4e2a=_[_0xcc7a('0x3f')]({},_0x1c4e2a,_0x58c121[_0xcc7a('0x40')]);var _0x4c4393={'where':_0x1c4e2a[_0xcc7a('0x3c')]};return db[_0xcc7a('0x2c')][_0xcc7a('0x1d')](_0x4c4393)['then'](function(_0x277370){_0x1a7f45[_0xcc7a('0x1d')]=_0x277370;if(_0x58c121[_0xcc7a('0x32')][_0xcc7a('0x41')]){_0x1c4e2a['include']=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x1c4e2a);})[_0xcc7a('0x26')](function(_0x19973e){_0x1a7f45[_0xcc7a('0x42')]=_0x19973e;return _0x1a7f45;})[_0xcc7a('0x26')](respondWithFilteredResult(_0x31fa8e,_0x1c4e2a))[_0xcc7a('0x43')](handleError(_0x31fa8e,null));};exports[_0xcc7a('0x44')]=function(_0x45f6b5,_0x4b78d2){var _0x1f2d55={'raw':![],'where':{'id':_0x45f6b5[_0xcc7a('0x45')]['id']}},_0x5aeeb4={};_0x5aeeb4[_0xcc7a('0x31')]=_[_0xcc7a('0x33')](db[_0xcc7a('0x2c')][_0xcc7a('0x2d')]);_0x5aeeb4[_0xcc7a('0x32')]=_['keys'](_0x45f6b5[_0xcc7a('0x32')]);_0x5aeeb4[_0xcc7a('0x34')]=_[_0xcc7a('0x35')](_0x5aeeb4['model'],_0x5aeeb4[_0xcc7a('0x32')]);_0x1f2d55[_0xcc7a('0x36')]=_[_0xcc7a('0x35')](_0x5aeeb4[_0xcc7a('0x31')],qs[_0xcc7a('0x37')](_0x45f6b5['query'][_0xcc7a('0x37')]));_0x1f2d55[_0xcc7a('0x36')]=_0x1f2d55[_0xcc7a('0x36')][_0xcc7a('0x38')]?_0x1f2d55[_0xcc7a('0x36')]:_0x5aeeb4['model'];if(_0x45f6b5[_0xcc7a('0x32')][_0xcc7a('0x41')]){_0x1f2d55[_0xcc7a('0x46')]=[{'all':!![]}];}_0x1f2d55=_[_0xcc7a('0x3f')]({},_0x1f2d55,_0x45f6b5[_0xcc7a('0x40')]);return db[_0xcc7a('0x2c')][_0xcc7a('0x47')](_0x1f2d55)[_0xcc7a('0x26')](handleEntityNotFound(_0x4b78d2,null))[_0xcc7a('0x26')](respondWithResult(_0x4b78d2,null))[_0xcc7a('0x43')](handleError(_0x4b78d2,null));};exports[_0xcc7a('0x48')]=function(_0x5286ce,_0x36669e){return db[_0xcc7a('0x2c')][_0xcc7a('0x48')](_0x5286ce[_0xcc7a('0x49')],{})[_0xcc7a('0x26')](respondWithResult(_0x36669e,0xc9))[_0xcc7a('0x43')](handleError(_0x36669e,null));};exports[_0xcc7a('0x25')]=function(_0x3b364b,_0x1291c2){if(_0x3b364b[_0xcc7a('0x49')]['id']){delete _0x3b364b[_0xcc7a('0x49')]['id'];}return db[_0xcc7a('0x2c')][_0xcc7a('0x47')]({'where':{'id':_0x3b364b[_0xcc7a('0x45')]['id']}})[_0xcc7a('0x26')](handleEntityNotFound(_0x1291c2,null))[_0xcc7a('0x26')](saveUpdates(_0x3b364b[_0xcc7a('0x49')],null))[_0xcc7a('0x26')](respondWithResult(_0x1291c2,null))[_0xcc7a('0x43')](handleError(_0x1291c2,null));};exports[_0xcc7a('0x27')]=function(_0x323625,_0x5e67d0){return db[_0xcc7a('0x2c')]['find']({'where':{'id':_0x323625[_0xcc7a('0x45')]['id']}})[_0xcc7a('0x26')](handleEntityNotFound(_0x5e67d0,null))[_0xcc7a('0x26')](removeEntity(_0x5e67d0,null))[_0xcc7a('0x43')](handleError(_0x5e67d0,null));};exports['getFields']=function(_0x303653,_0x994537,_0x124912){var _0x46dfcd={};var _0x14cf2d={};var _0x19691c;var _0x1ae705;return db[_0xcc7a('0x2c')][_0xcc7a('0x4a')]({'where':{'id':_0x303653[_0xcc7a('0x45')]['id']}})[_0xcc7a('0x26')](handleEntityNotFound(_0x994537,null))['then'](function(_0x391196){if(_0x391196){_0x19691c=_0x391196;_0x14cf2d['model']=_[_0xcc7a('0x33')](db[_0xcc7a('0x4b')][_0xcc7a('0x2d')]);_0x14cf2d['query']=_['keys'](_0x303653[_0xcc7a('0x32')]);_0x14cf2d[_0xcc7a('0x34')]=_[_0xcc7a('0x35')](_0x14cf2d[_0xcc7a('0x31')],_0x14cf2d['query']);_0x46dfcd['attributes']=_[_0xcc7a('0x35')](_0x14cf2d[_0xcc7a('0x31')],qs[_0xcc7a('0x37')](_0x303653[_0xcc7a('0x32')][_0xcc7a('0x37')]));_0x46dfcd[_0xcc7a('0x36')]=_0x46dfcd[_0xcc7a('0x36')]['length']?_0x46dfcd[_0xcc7a('0x36')]:_0x14cf2d[_0xcc7a('0x31')];_0x46dfcd[_0xcc7a('0x3a')]=qs[_0xcc7a('0x3b')](_0x303653[_0xcc7a('0x32')][_0xcc7a('0x3b')]);_0x46dfcd[_0xcc7a('0x3c')]=qs['filters'](_[_0xcc7a('0x3d')](_0x303653[_0xcc7a('0x32')],_0x14cf2d['filters']));if(_0x303653[_0xcc7a('0x32')][_0xcc7a('0x4c')]){_0x46dfcd[_0xcc7a('0x3c')]=_[_0xcc7a('0x3f')](_0x46dfcd[_0xcc7a('0x3c')],{'$or':_[_0xcc7a('0x2b')](_0x46dfcd[_0xcc7a('0x36')],function(_0x51df9a){var _0x913de9={};_0x913de9[_0x51df9a]={'$like':'%'+_0x303653[_0xcc7a('0x32')]['filter']+'%'};return _0x913de9;})});}_0x46dfcd=_[_0xcc7a('0x3f')]({},_0x46dfcd,_0x303653[_0xcc7a('0x40')]);return _0x19691c[_0xcc7a('0x4d')](_0x46dfcd);}})['then'](function(_0x4f36c1){if(_0x4f36c1){_0x1ae705=_0x4f36c1['length'];if(!_0x303653[_0xcc7a('0x32')][_0xcc7a('0x4e')]('nolimit')){_0x46dfcd[_0xcc7a('0x1f')]=qs[_0xcc7a('0x1f')](_0x303653[_0xcc7a('0x32')]['limit']);_0x46dfcd[_0xcc7a('0x1e')]=qs[_0xcc7a('0x1e')](_0x303653[_0xcc7a('0x32')]['offset']);}return _0x19691c['getFields'](_0x46dfcd);}})[_0xcc7a('0x26')](function(_0x1b167a){if(_0x1b167a){return _0x1b167a?{'count':_0x1ae705,'rows':_0x1b167a}:null;}})[_0xcc7a('0x26')](respondWithResult(_0x994537,null))[_0xcc7a('0x43')](handleError(_0x994537,null));};exports[_0xcc7a('0x4f')]=function(_0x41cf42,_0x225667,_0x529c4c){var _0x3d5508={};var _0x1133f4={};var _0x3c29b9;var _0x11a609;return db[_0xcc7a('0x2c')][_0xcc7a('0x4a')]({'where':{'id':_0x41cf42[_0xcc7a('0x45')]['id']}})['then'](handleEntityNotFound(_0x225667,null))[_0xcc7a('0x26')](function(_0x8d38b3){if(_0x8d38b3){_0x3c29b9=_0x8d38b3;_0x1133f4[_0xcc7a('0x31')]=_[_0xcc7a('0x33')](db[_0xcc7a('0x4b')][_0xcc7a('0x2d')]);_0x1133f4['query']=_[_0xcc7a('0x33')](_0x41cf42[_0xcc7a('0x32')]);_0x1133f4[_0xcc7a('0x34')]=_[_0xcc7a('0x35')](_0x1133f4['model'],_0x1133f4[_0xcc7a('0x32')]);_0x3d5508['attributes']=_[_0xcc7a('0x35')](_0x1133f4[_0xcc7a('0x31')],qs[_0xcc7a('0x37')](_0x41cf42[_0xcc7a('0x32')][_0xcc7a('0x37')]));_0x3d5508[_0xcc7a('0x36')]=_0x3d5508[_0xcc7a('0x36')][_0xcc7a('0x38')]?_0x3d5508[_0xcc7a('0x36')]:_0x1133f4['model'];_0x3d5508[_0xcc7a('0x3a')]=qs[_0xcc7a('0x3b')](_0x41cf42[_0xcc7a('0x32')][_0xcc7a('0x3b')]);_0x3d5508['where']=qs['filters'](_[_0xcc7a('0x3d')](_0x41cf42[_0xcc7a('0x32')],_0x1133f4[_0xcc7a('0x34')]));if(_0x41cf42[_0xcc7a('0x32')][_0xcc7a('0x4c')]){_0x3d5508[_0xcc7a('0x3c')]=_[_0xcc7a('0x3f')](_0x3d5508[_0xcc7a('0x3c')],{'$or':_['map'](_0x3d5508[_0xcc7a('0x36')],function(_0x39d11a){var _0x11c915={};_0x11c915[_0x39d11a]={'$like':'%'+_0x41cf42[_0xcc7a('0x32')][_0xcc7a('0x4c')]+'%'};return _0x11c915;})});}_0x3d5508=_['merge']({},_0x3d5508,_0x41cf42[_0xcc7a('0x40')]);return _0x3c29b9['getSubjects'](_0x3d5508);}})[_0xcc7a('0x26')](function(_0x1b1190){if(_0x1b1190){_0x11a609=_0x1b1190[_0xcc7a('0x38')];if(!_0x41cf42[_0xcc7a('0x32')][_0xcc7a('0x4e')](_0xcc7a('0x39'))){_0x3d5508[_0xcc7a('0x1f')]=qs[_0xcc7a('0x1f')](_0x41cf42['query'][_0xcc7a('0x1f')]);_0x3d5508[_0xcc7a('0x1e')]=qs['offset'](_0x41cf42['query']['offset']);}return _0x3c29b9[_0xcc7a('0x4f')](_0x3d5508);}})[_0xcc7a('0x26')](function(_0x51e2c9){if(_0x51e2c9){return _0x51e2c9?{'count':_0x11a609,'rows':_0x51e2c9}:null;}})[_0xcc7a('0x26')](respondWithResult(_0x225667,null))[_0xcc7a('0x43')](handleError(_0x225667,null));};exports[_0xcc7a('0x50')]=function(_0x150c37,_0x14a9e8,_0x2f0fab){var _0x4c3048={};var _0x39ff4b={};var _0xa32740;var _0x56c945;return db[_0xcc7a('0x2c')][_0xcc7a('0x4a')]({'where':{'id':_0x150c37[_0xcc7a('0x45')]['id']}})[_0xcc7a('0x26')](handleEntityNotFound(_0x14a9e8,null))['then'](function(_0x598c70){if(_0x598c70){_0xa32740=_0x598c70;_0x39ff4b[_0xcc7a('0x31')]=_[_0xcc7a('0x33')](db['ZohoField']['rawAttributes']);_0x39ff4b['query']=_[_0xcc7a('0x33')](_0x150c37[_0xcc7a('0x32')]);_0x39ff4b[_0xcc7a('0x34')]=_[_0xcc7a('0x35')](_0x39ff4b[_0xcc7a('0x31')],_0x39ff4b['query']);_0x4c3048['attributes']=_[_0xcc7a('0x35')](_0x39ff4b['model'],qs[_0xcc7a('0x37')](_0x150c37[_0xcc7a('0x32')]['fields']));_0x4c3048['attributes']=_0x4c3048[_0xcc7a('0x36')][_0xcc7a('0x38')]?_0x4c3048[_0xcc7a('0x36')]:_0x39ff4b[_0xcc7a('0x31')];_0x4c3048['order']=qs[_0xcc7a('0x3b')](_0x150c37[_0xcc7a('0x32')][_0xcc7a('0x3b')]);_0x4c3048[_0xcc7a('0x3c')]=qs[_0xcc7a('0x34')](_[_0xcc7a('0x3d')](_0x150c37[_0xcc7a('0x32')],_0x39ff4b[_0xcc7a('0x34')]));if(_0x150c37[_0xcc7a('0x32')][_0xcc7a('0x4c')]){_0x4c3048['where']=_['merge'](_0x4c3048[_0xcc7a('0x3c')],{'$or':_[_0xcc7a('0x2b')](_0x4c3048[_0xcc7a('0x36')],function(_0x446050){var _0x335036={};_0x335036[_0x446050]={'$like':'%'+_0x150c37[_0xcc7a('0x32')][_0xcc7a('0x4c')]+'%'};return _0x335036;})});}_0x4c3048=_[_0xcc7a('0x3f')]({},_0x4c3048,_0x150c37[_0xcc7a('0x40')]);return _0xa32740['getDescriptions'](_0x4c3048);}})[_0xcc7a('0x26')](function(_0x4c6133){if(_0x4c6133){_0x56c945=_0x4c6133[_0xcc7a('0x38')];if(!_0x150c37[_0xcc7a('0x32')]['hasOwnProperty'](_0xcc7a('0x39'))){_0x4c3048[_0xcc7a('0x1f')]=qs[_0xcc7a('0x1f')](_0x150c37[_0xcc7a('0x32')][_0xcc7a('0x1f')]);_0x4c3048[_0xcc7a('0x1e')]=qs['offset'](_0x150c37[_0xcc7a('0x32')][_0xcc7a('0x1e')]);}return _0xa32740[_0xcc7a('0x50')](_0x4c3048);}})[_0xcc7a('0x26')](function(_0xcbd6b8){if(_0xcbd6b8){return _0xcbd6b8?{'count':_0x56c945,'rows':_0xcbd6b8}:null;}})[_0xcc7a('0x26')](respondWithResult(_0x14a9e8,null))[_0xcc7a('0x43')](handleError(_0x14a9e8,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index bc55a4a..8431f3e 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 _0x87ac=['int_zoho_configurations','api','bluebird','path','rimraf','exports','define','ZohoConfiguration'];(function(_0x382a02,_0x3f63b4){var _0x358d3e=function(_0x903485){while(--_0x903485){_0x382a02['push'](_0x382a02['shift']());}};_0x358d3e(++_0x3f63b4);}(_0x87ac,0x111));var _0xc87a=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x87ac[_0x1e3671];return _0x48d5f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc87a('0x0'));var moment=require('moment');var BPromise=require(_0xc87a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc87a('0x2'));var rimraf=require(_0xc87a('0x3'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xc87a('0x4')]=function(_0x599d66,_0x19c5a8){return _0x599d66[_0xc87a('0x5')](_0xc87a('0x6'),attributes,{'tableName':_0xc87a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7128=['./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations','util','api','moment','request-promise','path','rimraf'];(function(_0x1ccd1e,_0x1e5c6a){var _0x2835f1=function(_0x408d2f){while(--_0x408d2f){_0x1ccd1e['push'](_0x1ccd1e['shift']());}};_0x2835f1(++_0x1e5c6a);}(_0x7128,0x72));var _0x8712=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x7128[_0x287a47];return _0x3fb726;};'use strict';var _=require('lodash');var util=require(_0x8712('0x0'));var logger=require('../../config/logger')(_0x8712('0x1'));var moment=require(_0x8712('0x2'));var BPromise=require('bluebird');var rp=require(_0x8712('0x3'));var fs=require('fs');var path=require(_0x8712('0x4'));var rimraf=require(_0x8712('0x5'));var config=require('../../config/environment');var attributes=require(_0x8712('0x6'));module['exports']=function(_0x192010,_0x8de9f3){return _0x192010[_0x8712('0x7')](_0x8712('0x8'),attributes,{'tableName':_0x8712('0x9'),'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 5dc815b..4d58da6 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 _0x7432=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x4f7115,_0x50a7a1){var _0x50db79=function(_0x239b9d){while(--_0x239b9d){_0x4f7115['push'](_0x4f7115['shift']());}};_0x50db79(++_0x50a7a1);}(_0x7432,0xcb));var _0x2743=function(_0x19f9dd,_0x1e4737){_0x19f9dd=_0x19f9dd-0x0;var _0x50f85d=_0x7432[_0x19f9dd];return _0x50f85d;};'use strict';var _=require(_0x2743('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2743('0x1'));var rs=require(_0x2743('0x2'));var fs=require('fs');var Redis=require(_0x2743('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2743('0x4'));var logger=require(_0x2743('0x5'))(_0x2743('0x6'));var config=require('../../config/environment');var jayson=require(_0x2743('0x7'));var client=jayson[_0x2743('0x8')][_0x2743('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a29bb,_0x170f5b,_0x19f139){return new BPromise(function(_0x167225,_0x31a174){return client[_0x2743('0xa')](_0x2a29bb,_0x19f139)[_0x2743('0xb')](function(_0x183013){logger[_0x2743('0xc')](_0x2743('0xd'),_0x170f5b,_0x2743('0xe'));logger[_0x2743('0xf')](_0x2743('0x10'),_0x170f5b,_0x2743('0xe'),JSON[_0x2743('0x11')](_0x183013));if(_0x183013[_0x2743('0x12')]){if(_0x183013[_0x2743('0x12')][_0x2743('0x13')]===0x1f4){logger[_0x2743('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x170f5b,_0x183013['error'][_0x2743('0x14')]);return _0x31a174(_0x183013['error']['message']);}logger[_0x2743('0x12')](_0x2743('0xd'),_0x170f5b,_0x183013[_0x2743('0x12')][_0x2743('0x14')]);return _0x167225(_0x183013[_0x2743('0x12')]['message']);}else{logger[_0x2743('0xc')](_0x2743('0xd'),_0x170f5b,'request\x20sent');_0x167225(_0x183013[_0x2743('0x15')]['message']);}})[_0x2743('0x16')](function(_0x57b794){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x170f5b,_0x57b794);_0x31a174(_0x57b794);});});} \ No newline at end of file +var _0x1c25=['info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3772e7,_0xa67875){var _0x30bab0=function(_0xe6f569){while(--_0xe6f569){_0x3772e7['push'](_0x3772e7['shift']());}};_0x30bab0(++_0xa67875);}(_0x1c25,0xf5));var _0x51c2=function(_0x4afc4f,_0xfecca5){_0x4afc4f=_0x4afc4f-0x0;var _0x31df41=_0x1c25[_0x4afc4f];return _0x31df41;};'use strict';var _=require('lodash');var util=require(_0x51c2('0x0'));var moment=require(_0x51c2('0x1'));var BPromise=require('bluebird');var rs=require(_0x51c2('0x2'));var fs=require('fs');var Redis=require(_0x51c2('0x3'));var db=require(_0x51c2('0x4'))['db'];var utils=require(_0x51c2('0x5'));var logger=require(_0x51c2('0x6'))(_0x51c2('0x7'));var config=require(_0x51c2('0x8'));var jayson=require(_0x51c2('0x9'));var client=jayson[_0x51c2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43ec6b,_0x334dad,_0x7edb03){return new BPromise(function(_0x2a95f8,_0x1c7b11){return client['request'](_0x43ec6b,_0x7edb03)[_0x51c2('0xb')](function(_0x37ffcc){logger['info'](_0x51c2('0xc'),_0x334dad,_0x51c2('0xd'));logger['debug'](_0x51c2('0xe'),_0x334dad,_0x51c2('0xd'),JSON[_0x51c2('0xf')](_0x37ffcc));if(_0x37ffcc[_0x51c2('0x10')]){if(_0x37ffcc[_0x51c2('0x10')][_0x51c2('0x11')]===0x1f4){logger[_0x51c2('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x334dad,_0x37ffcc['error'][_0x51c2('0x12')]);return _0x1c7b11(_0x37ffcc[_0x51c2('0x10')][_0x51c2('0x12')]);}logger['error'](_0x51c2('0xc'),_0x334dad,_0x37ffcc[_0x51c2('0x10')][_0x51c2('0x12')]);return _0x2a95f8(_0x37ffcc[_0x51c2('0x10')]['message']);}else{logger[_0x51c2('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x334dad,'request\x20sent');_0x2a95f8(_0x37ffcc[_0x51c2('0x14')][_0x51c2('0x12')]);}})[_0x51c2('0x15')](function(_0x43a497){logger[_0x51c2('0x10')](_0x51c2('0xc'),_0x334dad,_0x43a497);_0x1c7b11(_0x43a497);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index cd01154..938993f 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 _0xeb96=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0xeb96,0xf9));var _0x6eb9=function(_0x459207,_0x524e2c){_0x459207=_0x459207-0x0;var _0x577220=_0xeb96[_0x459207];return _0x577220;};'use strict';var multer=require(_0x6eb9('0x0'));var util=require(_0x6eb9('0x1'));var path=require(_0x6eb9('0x2'));var timeout=require(_0x6eb9('0x3'));var express=require(_0x6eb9('0x4'));var router=express[_0x6eb9('0x5')]();var fs_extra=require(_0x6eb9('0x6'));var auth=require(_0x6eb9('0x7'));var interaction=require(_0x6eb9('0x8'));var config=require('../../config/environment');var controller=require(_0x6eb9('0x9'));router['get']('/',auth[_0x6eb9('0xa')](),controller[_0x6eb9('0xb')]);router[_0x6eb9('0xc')](_0x6eb9('0xd'),auth[_0x6eb9('0xa')](),controller['show']);router[_0x6eb9('0xe')]('/',auth[_0x6eb9('0xa')](),controller[_0x6eb9('0xf')]);router[_0x6eb9('0x10')](_0x6eb9('0xd'),auth['isAuthenticated'](),controller[_0x6eb9('0x11')]);router[_0x6eb9('0x12')](_0x6eb9('0xd'),auth[_0x6eb9('0xa')](),controller[_0x6eb9('0x13')]);module[_0x6eb9('0x14')]=router; \ No newline at end of file +var _0xff9c=['multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xff9c,0x1a9));var _0xcff9=function(_0x3c9ac0,_0x3ec8c1){_0x3c9ac0=_0x3c9ac0-0x0;var _0x32ac83=_0xff9c[_0x3c9ac0];return _0x32ac83;};'use strict';var multer=require(_0xcff9('0x0'));var util=require(_0xcff9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcff9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcff9('0x3'));var interaction=require(_0xcff9('0x4'));var config=require(_0xcff9('0x5'));var controller=require('./intZohoField.controller');router[_0xcff9('0x6')]('/',auth[_0xcff9('0x7')](),controller[_0xcff9('0x8')]);router[_0xcff9('0x6')](_0xcff9('0x9'),auth[_0xcff9('0x7')](),controller[_0xcff9('0xa')]);router[_0xcff9('0xb')]('/',auth[_0xcff9('0x7')](),controller[_0xcff9('0xc')]);router['put']('/:id',auth[_0xcff9('0x7')](),controller[_0xcff9('0xd')]);router[_0xcff9('0xe')](_0xcff9('0x9'),auth[_0xcff9('0x7')](),controller[_0xcff9('0xf')]);module[_0xcff9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 33778ab..47af454 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 _0x437f=['customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x426f00,_0x4f7131){var _0x324a41=function(_0x30060c){while(--_0x30060c){_0x426f00['push'](_0x426f00['shift']());}};_0x324a41(++_0x4f7131);}(_0x437f,0x150));var _0xf437=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x437f[_0x599e60];return _0x468e19;};'use strict';var Sequelize=require(_0xf437('0x0'));module[_0xf437('0x1')]={'type':{'type':Sequelize[_0xf437('0x2')]('string',_0xf437('0x3'),_0xf437('0x4'),_0xf437('0x5'),_0xf437('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf437('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xf437('0x8'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf437('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf437('0x7')]},'customField':{'type':Sequelize[_0xf437('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf437('0x7')]}}; \ No newline at end of file +var _0xe219=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x4736dc,_0x237d41){var _0x519148=function(_0x67a7b3){while(--_0x67a7b3){_0x4736dc['push'](_0x4736dc['shift']());}};_0x519148(++_0x237d41);}(_0xe219,0x8c));var _0x9e21=function(_0x69bbfd,_0x11eb31){_0x69bbfd=_0x69bbfd-0x0;var _0x532165=_0xe219[_0x69bbfd];return _0x532165;};'use strict';var Sequelize=require(_0x9e21('0x0'));module[_0x9e21('0x1')]={'type':{'type':Sequelize[_0x9e21('0x2')](_0x9e21('0x3'),_0x9e21('0x4'),_0x9e21('0x5'),_0x9e21('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9e21('0x7')]},'keyType':{'type':Sequelize[_0x9e21('0x2')](_0x9e21('0x3'),_0x9e21('0x4'),_0x9e21('0x5'))},'keyContent':{'type':Sequelize[_0x9e21('0x7')]},'idField':{'type':Sequelize[_0x9e21('0x7')]},'nameField':{'type':Sequelize[_0x9e21('0x7')]},'customField':{'type':Sequelize[_0x9e21('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e21('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 16ef40b..98b7472 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 _0x93f4=['querystring','papaparse','ioredis','../../components/auth/service','../../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','apply','reject','save','update','then','destroy','error','name','send','index','type','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x56ee8c,_0xa57d1b){var _0x4a30e6=function(_0xfe2bd1){while(--_0xfe2bd1){_0x56ee8c['push'](_0x56ee8c['shift']());}};_0x4a30e6(++_0xa57d1b);}(_0x93f4,0x124));var _0x493f=function(_0x44c9b6,_0x54f1ed){_0x44c9b6=_0x44c9b6-0x0;var _0x33901c=_0x93f4[_0x44c9b6];return _0x33901c;};'use strict';var emlformat=require(_0x493f('0x0'));var rimraf=require(_0x493f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x493f('0x2'));var rp=require('request-promise');var moment=require(_0x493f('0x3'));var BPromise=require(_0x493f('0x4'));var Mustache=require(_0x493f('0x5'));var util=require(_0x493f('0x6'));var path=require(_0x493f('0x7'));var sox=require(_0x493f('0x8'));var csv=require(_0x493f('0x9'));var ejs=require(_0x493f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x493f('0xb'));var squel=require(_0x493f('0xc'));var crypto=require(_0x493f('0xd'));var jsforce=require(_0x493f('0xe'));var deskjs=require(_0x493f('0xf'));var toCsv=require(_0x493f('0x9'));var querystring=require(_0x493f('0x10'));var Papa=require(_0x493f('0x11'));var Redis=require(_0x493f('0x12'));var authService=require(_0x493f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x493f('0x14'));var hardwareService=require(_0x493f('0x15'));var logger=require('../../config/logger')(_0x493f('0x16'));var utils=require(_0x493f('0x17'));var config=require(_0x493f('0x18'));var licenseUtil=require(_0x493f('0x19'));var db=require(_0x493f('0x1a'))['db'];function respondWithStatusCode(_0x643216,_0x240def){_0x240def=_0x240def||0xcc;return function(_0x4bdc5e){if(_0x4bdc5e){return _0x643216[_0x493f('0x1b')](_0x240def);}return _0x643216[_0x493f('0x1c')](_0x240def)['end']();};}function respondWithResult(_0x11f542,_0x4204f3){_0x4204f3=_0x4204f3||0xc8;return function(_0x2e83df){if(_0x2e83df){return _0x11f542[_0x493f('0x1c')](_0x4204f3)[_0x493f('0x1d')](_0x2e83df);}};}function respondWithFilteredResult(_0x475e42,_0x3cf780){return function(_0x13884f){if(_0x13884f){var _0x408fe1=typeof _0x3cf780[_0x493f('0x1e')]===_0x493f('0x1f')&&typeof _0x3cf780[_0x493f('0x20')]==='undefined';var _0x47d837=_0x13884f[_0x493f('0x21')];var _0x208568=_0x408fe1?0x0:_0x3cf780[_0x493f('0x1e')];var _0x276eaf=_0x408fe1?_0x13884f['count']:_0x3cf780['offset']+_0x3cf780[_0x493f('0x20')];var _0x553ec4;if(_0x276eaf>=_0x47d837){_0x276eaf=_0x47d837;_0x553ec4=0xc8;}else{_0x553ec4=0xce;}_0x475e42[_0x493f('0x1c')](_0x553ec4);return _0x475e42[_0x493f('0x22')](_0x493f('0x23'),_0x208568+'-'+_0x276eaf+'/'+_0x47d837)[_0x493f('0x1d')](_0x13884f);}return null;};}function patchUpdates(_0x539b40){return function(_0x4556bb){try{jsonpatch[_0x493f('0x24')](_0x4556bb,_0x539b40,!![]);}catch(_0x1913ef){return BPromise[_0x493f('0x25')](_0x1913ef);}return _0x4556bb[_0x493f('0x26')]();};}function saveUpdates(_0x5a3cb6,_0x5d3782){return function(_0x43830c){if(_0x43830c){return _0x43830c[_0x493f('0x27')](_0x5a3cb6)[_0x493f('0x28')](function(_0x590125){return _0x590125;});}return null;};}function removeEntity(_0x1df625,_0x404d47){return function(_0x3eb068){if(_0x3eb068){return _0x3eb068[_0x493f('0x29')]()[_0x493f('0x28')](function(){_0x1df625[_0x493f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eb381,_0x3cb687){return function(_0x2b7108){if(!_0x2b7108){_0x3eb381[_0x493f('0x1b')](0x194);}return _0x2b7108;};}function handleError(_0x3d1948,_0x1bf593){_0x1bf593=_0x1bf593||0x1f4;return function(_0x5066a9){logger[_0x493f('0x2a')](_0x5066a9['stack']);if(_0x5066a9[_0x493f('0x2b')]){delete _0x5066a9[_0x493f('0x2b')];}_0x3d1948[_0x493f('0x1c')](_0x1bf593)[_0x493f('0x2c')](_0x5066a9);};}exports[_0x493f('0x2d')]=function(_0xc552c,_0x24681b){var _0x1dfa3e={},_0x352d99={},_0x445fd0={'count':0x0,'rows':[]};var _0x649ace=_['map'](db['ZohoField']['rawAttributes'],function(_0x15e5c2){return{'name':_0x15e5c2['fieldName'],'type':_0x15e5c2[_0x493f('0x2e')]['key']};});_0x352d99[_0x493f('0x2f')]=_[_0x493f('0x30')](_0x649ace,'name');_0x352d99['query']=_[_0x493f('0x31')](_0xc552c[_0x493f('0x32')]);_0x352d99[_0x493f('0x33')]=_['intersection'](_0x352d99[_0x493f('0x2f')],_0x352d99[_0x493f('0x32')]);_0x1dfa3e['attributes']=_[_0x493f('0x34')](_0x352d99['model'],qs[_0x493f('0x35')](_0xc552c['query'][_0x493f('0x35')]));_0x1dfa3e['attributes']=_0x1dfa3e[_0x493f('0x36')]['length']?_0x1dfa3e['attributes']:_0x352d99['model'];if(!_0xc552c[_0x493f('0x32')][_0x493f('0x37')]('nolimit')){_0x1dfa3e[_0x493f('0x20')]=qs[_0x493f('0x20')](_0xc552c[_0x493f('0x32')][_0x493f('0x20')]);_0x1dfa3e[_0x493f('0x1e')]=qs['offset'](_0xc552c[_0x493f('0x32')][_0x493f('0x1e')]);}_0x1dfa3e[_0x493f('0x38')]=qs[_0x493f('0x39')](_0xc552c[_0x493f('0x32')]['sort']);_0x1dfa3e[_0x493f('0x3a')]=qs['filters'](_[_0x493f('0x3b')](_0xc552c[_0x493f('0x32')],_0x352d99[_0x493f('0x33')]),_0x649ace);if(_0xc552c['query'][_0x493f('0x3c')]){_0x1dfa3e[_0x493f('0x3a')]=_[_0x493f('0x3d')](_0x1dfa3e['where'],{'$or':_[_0x493f('0x30')](_0x649ace,function(_0x5e14fd){if(_0x5e14fd[_0x493f('0x2e')]!==_0x493f('0x3e')){var _0x130d75={};_0x130d75[_0x5e14fd[_0x493f('0x2b')]]={'$like':'%'+_0xc552c[_0x493f('0x32')]['filter']+'%'};return _0x130d75;}})});}_0x1dfa3e=_['merge']({},_0x1dfa3e,_0xc552c[_0x493f('0x3f')]);var _0x432b8b={'where':_0x1dfa3e['where']};return db[_0x493f('0x40')]['count'](_0x432b8b)['then'](function(_0x5c332c){_0x445fd0[_0x493f('0x21')]=_0x5c332c;if(_0xc552c[_0x493f('0x32')][_0x493f('0x41')]){_0x1dfa3e[_0x493f('0x42')]=[{'all':!![]}];}return db['ZohoField'][_0x493f('0x43')](_0x1dfa3e);})['then'](function(_0x18594b){_0x445fd0[_0x493f('0x44')]=_0x18594b;return _0x445fd0;})['then'](respondWithFilteredResult(_0x24681b,_0x1dfa3e))[_0x493f('0x45')](handleError(_0x24681b,null));};exports[_0x493f('0x46')]=function(_0xa7f670,_0x43aa73){var _0x1b3342={'raw':!![],'where':{'id':_0xa7f670[_0x493f('0x47')]['id']}},_0x658054={};_0x658054[_0x493f('0x2f')]=_[_0x493f('0x31')](db[_0x493f('0x40')][_0x493f('0x48')]);_0x658054['query']=_[_0x493f('0x31')](_0xa7f670[_0x493f('0x32')]);_0x658054[_0x493f('0x33')]=_[_0x493f('0x34')](_0x658054['model'],_0x658054['query']);_0x1b3342['attributes']=_[_0x493f('0x34')](_0x658054[_0x493f('0x2f')],qs[_0x493f('0x35')](_0xa7f670['query']['fields']));_0x1b3342[_0x493f('0x36')]=_0x1b3342['attributes'][_0x493f('0x49')]?_0x1b3342[_0x493f('0x36')]:_0x658054['model'];if(_0xa7f670[_0x493f('0x32')][_0x493f('0x41')]){_0x1b3342['include']=[{'all':!![]}];}_0x1b3342=_[_0x493f('0x3d')]({},_0x1b3342,_0xa7f670[_0x493f('0x3f')]);return db[_0x493f('0x40')][_0x493f('0x4a')](_0x1b3342)['then'](handleEntityNotFound(_0x43aa73,null))[_0x493f('0x28')](respondWithResult(_0x43aa73,null))[_0x493f('0x45')](handleError(_0x43aa73,null));};exports[_0x493f('0x4b')]=function(_0x6ecd1f,_0x1fcac5){return db[_0x493f('0x40')]['create'](_0x6ecd1f[_0x493f('0x4c')],{})[_0x493f('0x28')](respondWithResult(_0x1fcac5,0xc9))[_0x493f('0x45')](handleError(_0x1fcac5,null));};exports[_0x493f('0x27')]=function(_0x5da7cf,_0x49eef6){if(_0x5da7cf['body']['id']){delete _0x5da7cf['body']['id'];}return db[_0x493f('0x40')][_0x493f('0x4a')]({'where':{'id':_0x5da7cf[_0x493f('0x47')]['id']}})[_0x493f('0x28')](handleEntityNotFound(_0x49eef6,null))[_0x493f('0x28')](saveUpdates(_0x5da7cf[_0x493f('0x4c')],null))[_0x493f('0x28')](respondWithResult(_0x49eef6,null))[_0x493f('0x45')](handleError(_0x49eef6,null));};exports[_0x493f('0x29')]=function(_0x48daa3,_0xd677a9){return db['ZohoField'][_0x493f('0x4a')]({'where':{'id':_0x48daa3[_0x493f('0x47')]['id']}})[_0x493f('0x28')](handleEntityNotFound(_0xd677a9,null))['then'](removeEntity(_0xd677a9,null))[_0x493f('0x45')](handleError(_0xd677a9,null));}; \ No newline at end of file +var _0x3d72=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','ZohoField','rows','catch','includeAll','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x399f3f,_0x4bd01b){var _0xb636e2=function(_0x3e0e19){while(--_0x3e0e19){_0x399f3f['push'](_0x399f3f['shift']());}};_0xb636e2(++_0x4bd01b);}(_0x3d72,0x162));var _0x23d7=function(_0x5822bc,_0x22ff9d){_0x5822bc=_0x5822bc-0x0;var _0x1844f5=_0x3d72[_0x5822bc];return _0x1844f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23d7('0x0'));var zipdir=require(_0x23d7('0x1'));var jsonpatch=require(_0x23d7('0x2'));var rp=require(_0x23d7('0x3'));var moment=require(_0x23d7('0x4'));var BPromise=require(_0x23d7('0x5'));var Mustache=require(_0x23d7('0x6'));var util=require(_0x23d7('0x7'));var path=require(_0x23d7('0x8'));var sox=require(_0x23d7('0x9'));var csv=require(_0x23d7('0xa'));var ejs=require(_0x23d7('0xb'));var fs=require('fs');var fs_extra=require(_0x23d7('0xc'));var _=require(_0x23d7('0xd'));var squel=require(_0x23d7('0xe'));var crypto=require('crypto');var jsforce=require(_0x23d7('0xf'));var deskjs=require(_0x23d7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x23d7('0x11'));var Papa=require('papaparse');var Redis=require(_0x23d7('0x12'));var authService=require(_0x23d7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x23d7('0x14'));var hardwareService=require(_0x23d7('0x15'));var logger=require(_0x23d7('0x16'))(_0x23d7('0x17'));var utils=require(_0x23d7('0x18'));var config=require(_0x23d7('0x19'));var licenseUtil=require(_0x23d7('0x1a'));var db=require(_0x23d7('0x1b'))['db'];function respondWithStatusCode(_0x23d5d9,_0x5d3783){_0x5d3783=_0x5d3783||0xcc;return function(_0x51730a){if(_0x51730a){return _0x23d5d9['sendStatus'](_0x5d3783);}return _0x23d5d9[_0x23d7('0x1c')](_0x5d3783)[_0x23d7('0x1d')]();};}function respondWithResult(_0x2d46ba,_0x4820ab){_0x4820ab=_0x4820ab||0xc8;return function(_0x39ef23){if(_0x39ef23){return _0x2d46ba[_0x23d7('0x1c')](_0x4820ab)[_0x23d7('0x1e')](_0x39ef23);}};}function respondWithFilteredResult(_0x2b9abe,_0x282631){return function(_0x4cb229){if(_0x4cb229){var _0xba8503=typeof _0x282631['offset']===_0x23d7('0x1f')&&typeof _0x282631[_0x23d7('0x20')]===_0x23d7('0x1f');var _0x321ac4=_0x4cb229[_0x23d7('0x21')];var _0x2cce5d=_0xba8503?0x0:_0x282631[_0x23d7('0x22')];var _0x3c7eb0=_0xba8503?_0x4cb229[_0x23d7('0x21')]:_0x282631[_0x23d7('0x22')]+_0x282631[_0x23d7('0x20')];var _0x3410fc;if(_0x3c7eb0>=_0x321ac4){_0x3c7eb0=_0x321ac4;_0x3410fc=0xc8;}else{_0x3410fc=0xce;}_0x2b9abe[_0x23d7('0x1c')](_0x3410fc);return _0x2b9abe[_0x23d7('0x23')](_0x23d7('0x24'),_0x2cce5d+'-'+_0x3c7eb0+'/'+_0x321ac4)[_0x23d7('0x1e')](_0x4cb229);}return null;};}function patchUpdates(_0x3a6b3d){return function(_0x535781){try{jsonpatch['apply'](_0x535781,_0x3a6b3d,!![]);}catch(_0x2955ff){return BPromise['reject'](_0x2955ff);}return _0x535781[_0x23d7('0x25')]();};}function saveUpdates(_0x2c236a,_0x3a7fcb){return function(_0x2756c6){if(_0x2756c6){return _0x2756c6[_0x23d7('0x26')](_0x2c236a)[_0x23d7('0x27')](function(_0x43bd7d){return _0x43bd7d;});}return null;};}function removeEntity(_0x396f7f,_0x2c1670){return function(_0x425b0f){if(_0x425b0f){return _0x425b0f[_0x23d7('0x28')]()[_0x23d7('0x27')](function(){_0x396f7f['status'](0xcc)[_0x23d7('0x1d')]();});}};}function handleEntityNotFound(_0x290ac6,_0x346ff8){return function(_0x1ac567){if(!_0x1ac567){_0x290ac6[_0x23d7('0x29')](0x194);}return _0x1ac567;};}function handleError(_0x375a63,_0x25542c){_0x25542c=_0x25542c||0x1f4;return function(_0x4f5a64){logger[_0x23d7('0x2a')](_0x4f5a64[_0x23d7('0x2b')]);if(_0x4f5a64[_0x23d7('0x2c')]){delete _0x4f5a64[_0x23d7('0x2c')];}_0x375a63[_0x23d7('0x1c')](_0x25542c)['send'](_0x4f5a64);};}exports[_0x23d7('0x2d')]=function(_0x1c5a3e,_0xf64f7c){var _0x465e2c={},_0x423707={},_0x3a0053={'count':0x0,'rows':[]};var _0x53eee7=_[_0x23d7('0x2e')](db['ZohoField'][_0x23d7('0x2f')],function(_0x26e08e){return{'name':_0x26e08e['fieldName'],'type':_0x26e08e[_0x23d7('0x30')][_0x23d7('0x31')]};});_0x423707['model']=_[_0x23d7('0x2e')](_0x53eee7,_0x23d7('0x2c'));_0x423707[_0x23d7('0x32')]=_[_0x23d7('0x33')](_0x1c5a3e[_0x23d7('0x32')]);_0x423707['filters']=_[_0x23d7('0x34')](_0x423707[_0x23d7('0x35')],_0x423707['query']);_0x465e2c[_0x23d7('0x36')]=_[_0x23d7('0x34')](_0x423707['model'],qs[_0x23d7('0x37')](_0x1c5a3e[_0x23d7('0x32')][_0x23d7('0x37')]));_0x465e2c[_0x23d7('0x36')]=_0x465e2c[_0x23d7('0x36')][_0x23d7('0x38')]?_0x465e2c[_0x23d7('0x36')]:_0x423707[_0x23d7('0x35')];if(!_0x1c5a3e[_0x23d7('0x32')][_0x23d7('0x39')](_0x23d7('0x3a'))){_0x465e2c['limit']=qs[_0x23d7('0x20')](_0x1c5a3e[_0x23d7('0x32')]['limit']);_0x465e2c['offset']=qs['offset'](_0x1c5a3e['query'][_0x23d7('0x22')]);}_0x465e2c[_0x23d7('0x3b')]=qs['sort'](_0x1c5a3e[_0x23d7('0x32')][_0x23d7('0x3c')]);_0x465e2c[_0x23d7('0x3d')]=qs[_0x23d7('0x3e')](_['pick'](_0x1c5a3e['query'],_0x423707[_0x23d7('0x3e')]),_0x53eee7);if(_0x1c5a3e[_0x23d7('0x32')][_0x23d7('0x3f')]){_0x465e2c[_0x23d7('0x3d')]=_[_0x23d7('0x40')](_0x465e2c[_0x23d7('0x3d')],{'$or':_[_0x23d7('0x2e')](_0x53eee7,function(_0x590841){if(_0x590841[_0x23d7('0x30')]!=='VIRTUAL'){var _0x300c18={};_0x300c18[_0x590841['name']]={'$like':'%'+_0x1c5a3e[_0x23d7('0x32')][_0x23d7('0x3f')]+'%'};return _0x300c18;}})});}_0x465e2c=_['merge']({},_0x465e2c,_0x1c5a3e[_0x23d7('0x41')]);var _0x2bcd84={'where':_0x465e2c[_0x23d7('0x3d')]};return db['ZohoField']['count'](_0x2bcd84)['then'](function(_0x2bcdb9){_0x3a0053[_0x23d7('0x21')]=_0x2bcdb9;if(_0x1c5a3e[_0x23d7('0x32')]['includeAll']){_0x465e2c['include']=[{'all':!![]}];}return db[_0x23d7('0x42')]['findAll'](_0x465e2c);})['then'](function(_0x17a267){_0x3a0053[_0x23d7('0x43')]=_0x17a267;return _0x3a0053;})['then'](respondWithFilteredResult(_0xf64f7c,_0x465e2c))[_0x23d7('0x44')](handleError(_0xf64f7c,null));};exports['show']=function(_0x53afcd,_0x437e66){var _0x58628f={'raw':!![],'where':{'id':_0x53afcd['params']['id']}},_0x254d52={};_0x254d52['model']=_[_0x23d7('0x33')](db[_0x23d7('0x42')]['rawAttributes']);_0x254d52[_0x23d7('0x32')]=_[_0x23d7('0x33')](_0x53afcd[_0x23d7('0x32')]);_0x254d52[_0x23d7('0x3e')]=_['intersection'](_0x254d52[_0x23d7('0x35')],_0x254d52[_0x23d7('0x32')]);_0x58628f['attributes']=_[_0x23d7('0x34')](_0x254d52['model'],qs[_0x23d7('0x37')](_0x53afcd[_0x23d7('0x32')][_0x23d7('0x37')]));_0x58628f[_0x23d7('0x36')]=_0x58628f['attributes'][_0x23d7('0x38')]?_0x58628f['attributes']:_0x254d52[_0x23d7('0x35')];if(_0x53afcd[_0x23d7('0x32')][_0x23d7('0x45')]){_0x58628f[_0x23d7('0x46')]=[{'all':!![]}];}_0x58628f=_['merge']({},_0x58628f,_0x53afcd[_0x23d7('0x41')]);return db[_0x23d7('0x42')][_0x23d7('0x47')](_0x58628f)[_0x23d7('0x27')](handleEntityNotFound(_0x437e66,null))[_0x23d7('0x27')](respondWithResult(_0x437e66,null))[_0x23d7('0x44')](handleError(_0x437e66,null));};exports['create']=function(_0x5ef0a4,_0x54a6ce){return db[_0x23d7('0x42')][_0x23d7('0x48')](_0x5ef0a4[_0x23d7('0x49')],{})['then'](respondWithResult(_0x54a6ce,0xc9))[_0x23d7('0x44')](handleError(_0x54a6ce,null));};exports[_0x23d7('0x26')]=function(_0x34f0ce,_0x82af00){if(_0x34f0ce[_0x23d7('0x49')]['id']){delete _0x34f0ce[_0x23d7('0x49')]['id'];}return db[_0x23d7('0x42')]['find']({'where':{'id':_0x34f0ce[_0x23d7('0x4a')]['id']}})[_0x23d7('0x27')](handleEntityNotFound(_0x82af00,null))[_0x23d7('0x27')](saveUpdates(_0x34f0ce[_0x23d7('0x49')],null))[_0x23d7('0x27')](respondWithResult(_0x82af00,null))['catch'](handleError(_0x82af00,null));};exports['destroy']=function(_0x5bcd86,_0x143a9b){return db[_0x23d7('0x42')][_0x23d7('0x47')]({'where':{'id':_0x5bcd86['params']['id']}})['then'](handleEntityNotFound(_0x143a9b,null))[_0x23d7('0x27')](removeEntity(_0x143a9b,null))[_0x23d7('0x44')](handleError(_0x143a9b,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 3cd7e29..f7d5e63 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 _0xdb28=['../../config/environment','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xa38cf2,_0x13e769){var _0x1c9a57=function(_0x3fdbd5){while(--_0x3fdbd5){_0xa38cf2['push'](_0xa38cf2['shift']());}};_0x1c9a57(++_0x13e769);}(_0xdb28,0x106));var _0x8db2=function(_0x2d5e3f,_0x4c27e0){_0x2d5e3f=_0x2d5e3f-0x0;var _0x5bf682=_0xdb28[_0x2d5e3f];return _0x5bf682;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./intZohoField.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'name':_0x8db2('0xc'),'fields':[_0x8db2('0xd'),_0x8db2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_zoho_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0x245283,_0x5d1064){var _0x41cf61=function(_0x3e920c){while(--_0x3e920c){_0x245283['push'](_0x245283['shift']());}};_0x41cf61(++_0x5d1064);}(_0x7a54,0x106));var _0x47a5=function(_0x1f59f8,_0x1a116c){_0x1f59f8=_0x1f59f8-0x0;var _0x55209d=_0x7a54[_0x1f59f8];return _0x55209d;};'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':'zoho_unique_index','fields':[_0x47a5('0xc'),'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 3fd9efe..95b8ef7 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 _0xce74=['stringify','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x5c9c31,_0x1885ed){var _0xbfcbd8=function(_0x34e04c){while(--_0x34e04c){_0x5c9c31['push'](_0x5c9c31['shift']());}};_0xbfcbd8(++_0x1885ed);}(_0xce74,0x1a9));var _0x4ce7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xce74[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x4ce7('0x0'));var util=require('util');var moment=require(_0x4ce7('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ce7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce7('0x3'))['db'];var utils=require(_0x4ce7('0x4'));var logger=require('../../config/logger')(_0x4ce7('0x5'));var config=require(_0x4ce7('0x6'));var jayson=require(_0x4ce7('0x7'));var client=jayson[_0x4ce7('0x8')][_0x4ce7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34d9a5,_0x55b87e,_0xc32e8){return new BPromise(function(_0x537deb,_0x1ea873){return client[_0x4ce7('0xa')](_0x34d9a5,_0xc32e8)[_0x4ce7('0xb')](function(_0x4fb530){logger[_0x4ce7('0xc')](_0x4ce7('0xd'),_0x55b87e,_0x4ce7('0xe'));logger['debug'](_0x4ce7('0xf'),_0x55b87e,_0x4ce7('0xe'),JSON[_0x4ce7('0x10')](_0x4fb530));if(_0x4fb530[_0x4ce7('0x11')]){if(_0x4fb530[_0x4ce7('0x11')][_0x4ce7('0x12')]===0x1f4){logger[_0x4ce7('0x11')]('ZohoField,\x20%s,\x20%s',_0x55b87e,_0x4fb530[_0x4ce7('0x11')]['message']);return _0x1ea873(_0x4fb530[_0x4ce7('0x11')][_0x4ce7('0x13')]);}logger['error'](_0x4ce7('0xd'),_0x55b87e,_0x4fb530[_0x4ce7('0x11')]['message']);return _0x537deb(_0x4fb530[_0x4ce7('0x11')]['message']);}else{logger[_0x4ce7('0xc')](_0x4ce7('0xd'),_0x55b87e,_0x4ce7('0xe'));_0x537deb(_0x4fb530[_0x4ce7('0x14')][_0x4ce7('0x13')]);}})['catch'](function(_0x188946){logger['error'](_0x4ce7('0xd'),_0x55b87e,_0x188946);_0x1ea873(_0x188946);});});} \ No newline at end of file +var _0x3c9a=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x3c9a,0x1a8));var _0xa3c9=function(_0x4077df,_0x10621c){_0x4077df=_0x4077df-0x0;var _0x57aeff=_0x3c9a[_0x4077df];return _0x57aeff;};'use strict';var _=require(_0xa3c9('0x0'));var util=require(_0xa3c9('0x1'));var moment=require(_0xa3c9('0x2'));var BPromise=require(_0xa3c9('0x3'));var rs=require(_0xa3c9('0x4'));var fs=require('fs');var Redis=require(_0xa3c9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3c9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa3c9('0x7'));var jayson=require(_0xa3c9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x212edf,_0x2bff6a,_0x31edc){return new BPromise(function(_0x45ae45,_0x4ae441){return client[_0xa3c9('0x9')](_0x212edf,_0x31edc)[_0xa3c9('0xa')](function(_0x39c504){logger[_0xa3c9('0xb')](_0xa3c9('0xc'),_0x2bff6a,'request\x20sent');logger[_0xa3c9('0xd')](_0xa3c9('0xe'),_0x2bff6a,_0xa3c9('0xf'),JSON['stringify'](_0x39c504));if(_0x39c504[_0xa3c9('0x10')]){if(_0x39c504[_0xa3c9('0x10')][_0xa3c9('0x11')]===0x1f4){logger[_0xa3c9('0x10')](_0xa3c9('0xc'),_0x2bff6a,_0x39c504[_0xa3c9('0x10')][_0xa3c9('0x12')]);return _0x4ae441(_0x39c504[_0xa3c9('0x10')]['message']);}logger[_0xa3c9('0x10')]('ZohoField,\x20%s,\x20%s',_0x2bff6a,_0x39c504['error'][_0xa3c9('0x12')]);return _0x45ae45(_0x39c504['error']['message']);}else{logger[_0xa3c9('0xb')](_0xa3c9('0xc'),_0x2bff6a,'request\x20sent');_0x45ae45(_0x39c504[_0xa3c9('0x13')][_0xa3c9('0x12')]);}})['catch'](function(_0x53f011){logger['error']('ZohoField,\x20%s,\x20%s',_0x2bff6a,_0x53f011);_0x4ae441(_0x53f011);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d31dc56..df897f8 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5f176a,_0x4138b6){var _0x2e9757=function(_0x2428c4){while(--_0x2428c4){_0x5f176a['push'](_0x5f176a['shift']());}};_0x2e9757(++_0x4138b6);}(_0xe706,0xa3));var _0x6e70=function(_0x5c0368,_0x423cf2){_0x5c0368=_0x5c0368-0x0;var _0x5b31b9=_0xe706[_0x5c0368];return _0x5b31b9;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x38b9f0,_0x4443b1){var _0x4bb1fa=function(_0x4860ce){while(--_0x4860ce){_0x38b9f0['push'](_0x38b9f0['shift']());}};_0x4bb1fa(++_0x4443b1);}(_0xe706,0xa3));var _0x6e70=function(_0x22d68a,_0x3f6978){_0x22d68a=_0x22d68a-0x0;var _0x131c53=_0xe706[_0x22d68a];return _0x131c53;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5069cc2..765c976 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 _0x95c7=['app.js','INTEGER','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x24765c,_0x5e3421){var _0x7de795=function(_0xbb23d8){while(--_0xbb23d8){_0x24765c['push'](_0x24765c['shift']());}};_0x7de795(++_0x5e3421);}(_0x95c7,0x1a7));var _0x795c=function(_0x4219e8,_0x5b47d0){_0x4219e8=_0x4219e8-0x0;var _0x48cfef=_0x95c7[_0x4219e8];return _0x48cfef;};'use strict';var Sequelize=require(_0x795c('0x0'));module[_0x795c('0x1')]={'name':{'type':Sequelize[_0x795c('0x2')],'allowNull':![],'unique':_0x795c('0x3')},'version':{'type':Sequelize[_0x795c('0x2')],'allowNull':![],'unique':_0x795c('0x3')},'main':{'type':Sequelize[_0x795c('0x2')],'defaultValue':_0x795c('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x795c('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x795c('0x2')]},'logo':{'type':Sequelize[_0x795c('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x795c('0x6')},'description':{'type':Sequelize[_0x795c('0x2')]},'title':{'type':Sequelize[_0x795c('0x2')]},'remoteUri':{'type':Sequelize[_0x795c('0x2')]},'link':{'type':Sequelize[_0x795c('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x047f=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','state'];(function(_0x48cbb8,_0x1c1230){var _0x574b03=function(_0x280152){while(--_0x280152){_0x48cbb8['push'](_0x48cbb8['shift']());}};_0x574b03(++_0x1c1230);}(_0x047f,0xfc));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf047('0x0'));module[_0xf047('0x1')]={'name':{'type':Sequelize[_0xf047('0x2')],'allowNull':![],'unique':_0xf047('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf047('0x3')},'main':{'type':Sequelize[_0xf047('0x2')],'defaultValue':_0xf047('0x4')},'filename':{'type':Sequelize[_0xf047('0x2')]},'path':{'type':Sequelize[_0xf047('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xf047('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xf047('0x2')]},'logo':{'type':Sequelize[_0xf047('0x2')]},'state':{'type':Sequelize[_0xf047('0x2')],'unique':_0xf047('0x6')},'description':{'type':Sequelize[_0xf047('0x2')]},'title':{'type':Sequelize[_0xf047('0x2')]},'remoteUri':{'type':Sequelize[_0xf047('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 41ed776..a43ee60 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21e408,_0x51cd13){_0x21e408=_0x21e408-0x0;var _0x336606=_0x5f2f[_0x21e408];return _0x336606;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0x01d9=['map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index'];(function(_0x1462c2,_0x234ef1){var _0x149dea=function(_0x33ad15){while(--_0x33ad15){_0x1462c2['push'](_0x1462c2['shift']());}};_0x149dea(++_0x234ef1);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['Integration'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['Integration'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 4ec28f3..3a10450 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 _0xd219=['lodash','../../config/logger','api','bluebird','request-promise','path','./integration.attributes','exports','define','integrations'];(function(_0x281d22,_0x7d58e1){var _0x38279e=function(_0x1db6ab){while(--_0x1db6ab){_0x281d22['push'](_0x281d22['shift']());}};_0x38279e(++_0x7d58e1);}(_0xd219,0xa0));var _0x9d21=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xd219[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x9d21('0x0'));var util=require('util');var logger=require(_0x9d21('0x1'))(_0x9d21('0x2'));var moment=require('moment');var BPromise=require(_0x9d21('0x3'));var rp=require(_0x9d21('0x4'));var fs=require('fs');var path=require(_0x9d21('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d21('0x6'));module[_0x9d21('0x7')]=function(_0x813bd7,_0x4b369c){return _0x813bd7[_0x9d21('0x8')]('Integration',attributes,{'tableName':_0x9d21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80ad=['api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','Integration','lodash','util'];(function(_0x2aba10,_0x50387f){var _0x3cd833=function(_0x26f971){while(--_0x26f971){_0x2aba10['push'](_0x2aba10['shift']());}};_0x3cd833(++_0x50387f);}(_0x80ad,0x148));var _0xd80a=function(_0x34520d,_0x31419e){_0x34520d=_0x34520d-0x0;var _0x8b8eb=_0x80ad[_0x34520d];return _0x8b8eb;};'use strict';var _=require(_0xd80a('0x0'));var util=require(_0xd80a('0x1'));var logger=require('../../config/logger')(_0xd80a('0x2'));var moment=require(_0xd80a('0x3'));var BPromise=require(_0xd80a('0x4'));var rp=require(_0xd80a('0x5'));var fs=require('fs');var path=require(_0xd80a('0x6'));var rimraf=require('rimraf');var config=require(_0xd80a('0x7'));var attributes=require(_0xd80a('0x8'));module[_0xd80a('0x9')]=function(_0x329f15,_0x488ee5){return _0x329f15['define'](_0xd80a('0xa'),attributes,{'tableName':'integrations','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 6d1b0d4..4bde1e1 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 _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52b1eb,_0x5d09a4){var _0x102d00=function(_0x259ad4){while(--_0x259ad4){_0x52b1eb['push'](_0x52b1eb['shift']());}};_0x102d00(++_0x5d09a4);}(_0x0295,0x1f0));var _0x5029=function(_0x129534,_0x560a44){_0x129534=_0x129534-0x0;var _0x430eb4=_0x0295[_0x129534];return _0x430eb4;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x229101,_0x31339d){var _0xc93cb=function(_0x461394){while(--_0x461394){_0x229101['push'](_0x229101['shift']());}};_0xc93cb(++_0x31339d);}(_0xd943,0x15d));var _0x3d94=function(_0x5676a2,_0x1f9f99){_0x5676a2=_0x5676a2-0x0;var _0x5d05bb=_0xd943[_0x5676a2];return _0x5d05bb;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 7ddeb0f..51041a7 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x432c02,_0x5c0a28){var _0x1a4544=function(_0x496d6b){while(--_0x496d6b){_0x432c02['push'](_0x432c02['shift']());}};_0x1a4544(++_0x5c0a28);}(_0x4975,0x86));var _0x5497=function(_0x3011a4,_0x41eac6){_0x3011a4=_0x3011a4-0x0;var _0x3847bd=_0x4975[_0x3011a4];return _0x3847bd;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x1967,0x173));var _0x7196=function(_0x388cfb,_0x5df8df){_0x388cfb=_0x388cfb-0x0;var _0x5a4a02=_0x1967[_0x388cfb];return _0x5a4a02;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1783286..e4af20d 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 _0xeb57=['BOOLEAN','DATE','TEXT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x2aefb6,_0x1bd384){var _0x202772=function(_0x507d3f){while(--_0x507d3f){_0x2aefb6['push'](_0x2aefb6['shift']());}};_0x202772(++_0x1bd384);}(_0xeb57,0x178));var _0x7eb5=function(_0x3efba9,_0x4c39c4){_0x3efba9=_0x3efba9-0x0;var _0x1bb06e=_0xeb57[_0x3efba9];return _0x1bb06e;};'use strict';var Sequelize=require(_0x7eb5('0x0'));module[_0x7eb5('0x1')]={'integration':{'type':Sequelize[_0x7eb5('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7eb5('0x2')]},'ticketId':{'type':Sequelize[_0x7eb5('0x2')]},'integrationId':{'type':Sequelize[_0x7eb5('0x3')]},'contacts':{'type':Sequelize[_0x7eb5('0x2')]},'uniqueid':{'type':Sequelize[_0x7eb5('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7eb5('0x2')]},'queue':{'type':Sequelize[_0x7eb5('0x2')]},'interface':{'type':Sequelize[_0x7eb5('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7eb5('0x3')]},'agentcomplete':{'type':Sequelize[_0x7eb5('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x7eb5('0x3')]},'agentacw':{'type':Sequelize[_0x7eb5('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7eb5('0x3')]},'reason':{'type':Sequelize[_0x7eb5('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7eb5('0x5')]},'agentdump':{'type':Sequelize[_0x7eb5('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7eb5('0x5')]},'lastevent':{'type':Sequelize[_0x7eb5('0x2')]},'channel':{'type':Sequelize[_0x7eb5('0x2')]},'channelstate':{'type':Sequelize[_0x7eb5('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x7eb5('0x2')]},'connectedlinename':{'type':Sequelize[_0x7eb5('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7eb5('0x2')]},'exten':{'type':Sequelize[_0x7eb5('0x2')]},'priority':{'type':Sequelize[_0x7eb5('0x2')]},'destchannel':{'type':Sequelize[_0x7eb5('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x7eb5('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7eb5('0x2')]},'destcalleridname':{'type':Sequelize[_0x7eb5('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7eb5('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7eb5('0x2')]},'destlanguage':{'type':Sequelize[_0x7eb5('0x2')]},'destaccountcode':{'type':Sequelize[_0x7eb5('0x2')]},'destcontext':{'type':Sequelize[_0x7eb5('0x2')]},'destexten':{'type':Sequelize[_0x7eb5('0x2')]},'destpriority':{'type':Sequelize[_0x7eb5('0x2')]},'destuniqueid':{'type':Sequelize[_0x7eb5('0x2')]},'messageId':{'type':Sequelize[_0x7eb5('0x2')]},'inReplyTo':{'type':Sequelize[_0x7eb5('0x2')]},'subject':{'type':Sequelize[_0x7eb5('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x7eb5('0x6')]},'status':{'type':Sequelize['ENUM']('SENT',_0x7eb5('0x7'),_0x7eb5('0x8'),_0x7eb5('0x9'))},'url':{'type':Sequelize[_0x7eb5('0x2')]},'app':{'type':Sequelize[_0x7eb5('0x2')]},'appdata':{'type':Sequelize[_0x7eb5('0x2')]},'projectId':{'type':Sequelize[_0x7eb5('0x3')]}}; \ No newline at end of file +var _0xac2e=['SENT','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM'];(function(_0x495054,_0x304104){var _0x146d2e=function(_0x350426){while(--_0x350426){_0x495054['push'](_0x495054['shift']());}};_0x146d2e(++_0x304104);}(_0xac2e,0xd9));var _0xeac2=function(_0x35559,_0x36ab81){_0x35559=_0x35559-0x0;var _0x368237=_0xac2e[_0x35559];return _0x368237;};'use strict';var Sequelize=require('sequelize');module[_0xeac2('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xeac2('0x1')]},'exitStatus':{'type':Sequelize[_0xeac2('0x1')]},'ticketId':{'type':Sequelize[_0xeac2('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xeac2('0x1')]},'uniqueid':{'type':Sequelize[_0xeac2('0x1')]},'calleridnum':{'type':Sequelize[_0xeac2('0x1')]},'calleridname':{'type':Sequelize[_0xeac2('0x1')]},'queue':{'type':Sequelize[_0xeac2('0x1')]},'interface':{'type':Sequelize[_0xeac2('0x1')]},'membername':{'type':Sequelize[_0xeac2('0x1')]},'agentcalledAt':{'type':Sequelize[_0xeac2('0x2')]},'agentconnectAt':{'type':Sequelize[_0xeac2('0x2')]},'holdtime':{'type':Sequelize[_0xeac2('0x3')]},'agentcomplete':{'type':Sequelize[_0xeac2('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xeac2('0x2')]},'talktime':{'type':Sequelize[_0xeac2('0x3')]},'agentacw':{'type':Sequelize[_0xeac2('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeac2('0x3')]},'reason':{'type':Sequelize[_0xeac2('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xeac2('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xeac2('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xeac2('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeac2('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xeac2('0x1')]},'language':{'type':Sequelize[_0xeac2('0x1')]},'accountcode':{'type':Sequelize[_0xeac2('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xeac2('0x1')]},'priority':{'type':Sequelize[_0xeac2('0x1')]},'destchannel':{'type':Sequelize[_0xeac2('0x1')]},'destchannelstate':{'type':Sequelize[_0xeac2('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xeac2('0x1')]},'destcalleridname':{'type':Sequelize[_0xeac2('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xeac2('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xeac2('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xeac2('0x1')]},'destcontext':{'type':Sequelize[_0xeac2('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xeac2('0x1')]},'to':{'type':Sequelize[_0xeac2('0x1')]},'cc':{'type':Sequelize[_0xeac2('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xeac2('0x5')]},'text':{'type':Sequelize[_0xeac2('0x5')]},'status':{'type':Sequelize[_0xeac2('0x6')](_0xeac2('0x7'),'SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0xeac2('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xeac2('0x1')]},'projectId':{'type':Sequelize[_0xeac2('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c8fffa1..27aac4c 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 _0x0a61=['end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','name','send','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x305ab4,_0x1e71ef){var _0x128ef2=function(_0x1c685e){while(--_0x1c685e){_0x305ab4['push'](_0x305ab4['shift']());}};_0x128ef2(++_0x1e71ef);}(_0x0a61,0xbd));var _0x10a6=function(_0x263faf,_0x4d1b79){_0x263faf=_0x263faf-0x0;var _0x3e3537=_0x0a61[_0x263faf];return _0x3e3537;};'use strict';var emlformat=require(_0x10a6('0x0'));var rimraf=require(_0x10a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x10a6('0x2'));var moment=require(_0x10a6('0x3'));var BPromise=require(_0x10a6('0x4'));var Mustache=require(_0x10a6('0x5'));var util=require(_0x10a6('0x6'));var path=require(_0x10a6('0x7'));var sox=require(_0x10a6('0x8'));var csv=require(_0x10a6('0x9'));var ejs=require(_0x10a6('0xa'));var fs=require('fs');var fs_extra=require(_0x10a6('0xb'));var _=require(_0x10a6('0xc'));var squel=require(_0x10a6('0xd'));var crypto=require('crypto');var jsforce=require(_0x10a6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x10a6('0x9'));var querystring=require(_0x10a6('0xf'));var Papa=require(_0x10a6('0x10'));var Redis=require(_0x10a6('0x11'));var authService=require(_0x10a6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x10a6('0x13'));var hardwareService=require(_0x10a6('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x10a6('0x15'));var db=require(_0x10a6('0x16'))['db'];function respondWithStatusCode(_0xfe63da,_0x4c4137){_0x4c4137=_0x4c4137||0xcc;return function(_0x375e81){if(_0x375e81){return _0xfe63da[_0x10a6('0x17')](_0x4c4137);}return _0xfe63da['status'](_0x4c4137)[_0x10a6('0x18')]();};}function respondWithResult(_0x532bf7,_0x214ab9){_0x214ab9=_0x214ab9||0xc8;return function(_0x29affd){if(_0x29affd){return _0x532bf7[_0x10a6('0x19')](_0x214ab9)[_0x10a6('0x1a')](_0x29affd);}};}function respondWithFilteredResult(_0x30fce1,_0x51846c){return function(_0x24475e){if(_0x24475e){var _0xa34766=typeof _0x51846c[_0x10a6('0x1b')]===_0x10a6('0x1c')&&typeof _0x51846c[_0x10a6('0x1d')]===_0x10a6('0x1c');var _0x238093=_0x24475e['count'];var _0x416737=_0xa34766?0x0:_0x51846c[_0x10a6('0x1b')];var _0x1f7def=_0xa34766?_0x24475e[_0x10a6('0x1e')]:_0x51846c[_0x10a6('0x1b')]+_0x51846c[_0x10a6('0x1d')];var _0xdd87f1;if(_0x1f7def>=_0x238093){_0x1f7def=_0x238093;_0xdd87f1=0xc8;}else{_0xdd87f1=0xce;}_0x30fce1[_0x10a6('0x19')](_0xdd87f1);return _0x30fce1[_0x10a6('0x1f')]('Content-Range',_0x416737+'-'+_0x1f7def+'/'+_0x238093)[_0x10a6('0x1a')](_0x24475e);}return null;};}function patchUpdates(_0x1b377b){return function(_0x399544){try{jsonpatch[_0x10a6('0x20')](_0x399544,_0x1b377b,!![]);}catch(_0x6368e0){return BPromise[_0x10a6('0x21')](_0x6368e0);}return _0x399544[_0x10a6('0x22')]();};}function saveUpdates(_0x4c40f0,_0x2b3d67){return function(_0xbfc209){if(_0xbfc209){return _0xbfc209['update'](_0x4c40f0)[_0x10a6('0x23')](function(_0xdf704a){return _0xdf704a;});}return null;};}function removeEntity(_0x2a173c,_0x5797a8){return function(_0x1475e6){if(_0x1475e6){return _0x1475e6[_0x10a6('0x24')]()[_0x10a6('0x23')](function(){_0x2a173c[_0x10a6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5688fc,_0x342143){return function(_0x4f07d2){if(!_0x4f07d2){_0x5688fc[_0x10a6('0x17')](0x194);}return _0x4f07d2;};}function handleError(_0x444dd4,_0x39e167){_0x39e167=_0x39e167||0x1f4;return function(_0x2b77cb){logger['error'](_0x2b77cb['stack']);if(_0x2b77cb[_0x10a6('0x25')]){delete _0x2b77cb[_0x10a6('0x25')];}_0x444dd4[_0x10a6('0x19')](_0x39e167)[_0x10a6('0x26')](_0x2b77cb);};}exports['index']=function(_0x2a9831,_0x4a544b){var _0x258166={},_0x4a7cd7={},_0x5ece8e={'count':0x0,'rows':[]};var _0x403a28=_[_0x10a6('0x27')](db[_0x10a6('0x28')]['rawAttributes'],function(_0x10170d){return{'name':_0x10170d[_0x10a6('0x29')],'type':_0x10170d[_0x10a6('0x2a')][_0x10a6('0x2b')]};});_0x4a7cd7[_0x10a6('0x2c')]=_[_0x10a6('0x27')](_0x403a28,_0x10a6('0x25'));_0x4a7cd7[_0x10a6('0x2d')]=_[_0x10a6('0x2e')](_0x2a9831[_0x10a6('0x2d')]);_0x4a7cd7[_0x10a6('0x2f')]=_[_0x10a6('0x30')](_0x4a7cd7[_0x10a6('0x2c')],_0x4a7cd7[_0x10a6('0x2d')]);_0x258166[_0x10a6('0x31')]=_['intersection'](_0x4a7cd7[_0x10a6('0x2c')],qs[_0x10a6('0x32')](_0x2a9831[_0x10a6('0x2d')]['fields']));_0x258166['attributes']=_0x258166['attributes'][_0x10a6('0x33')]?_0x258166[_0x10a6('0x31')]:_0x4a7cd7[_0x10a6('0x2c')];if(!_0x2a9831['query'][_0x10a6('0x34')]('nolimit')){_0x258166[_0x10a6('0x1d')]=qs['limit'](_0x2a9831[_0x10a6('0x2d')][_0x10a6('0x1d')]);_0x258166[_0x10a6('0x1b')]=qs[_0x10a6('0x1b')](_0x2a9831[_0x10a6('0x2d')]['offset']);}_0x258166[_0x10a6('0x35')]=qs['sort'](_0x2a9831[_0x10a6('0x2d')][_0x10a6('0x36')]);_0x258166[_0x10a6('0x37')]=qs[_0x10a6('0x2f')](_[_0x10a6('0x38')](_0x2a9831[_0x10a6('0x2d')],_0x4a7cd7[_0x10a6('0x2f')]),_0x403a28);if(_0x2a9831[_0x10a6('0x2d')][_0x10a6('0x39')]){_0x258166['where']=_[_0x10a6('0x3a')](_0x258166[_0x10a6('0x37')],{'$or':_[_0x10a6('0x27')](_0x403a28,function(_0x42b0e0){if(_0x42b0e0['type']!==_0x10a6('0x3b')){var _0x104c3b={};_0x104c3b[_0x42b0e0[_0x10a6('0x25')]]={'$like':'%'+_0x2a9831['query'][_0x10a6('0x39')]+'%'};return _0x104c3b;}})});}_0x258166=_[_0x10a6('0x3a')]({},_0x258166,_0x2a9831['options']);var _0x298610={'where':_0x258166['where']};return db[_0x10a6('0x28')][_0x10a6('0x1e')](_0x298610)[_0x10a6('0x23')](function(_0x3ea011){_0x5ece8e[_0x10a6('0x1e')]=_0x3ea011;if(_0x2a9831[_0x10a6('0x2d')]['includeAll']){_0x258166[_0x10a6('0x3c')]=[{'all':!![]}];}return db[_0x10a6('0x28')][_0x10a6('0x3d')](_0x258166);})['then'](function(_0x4c346f){_0x5ece8e[_0x10a6('0x3e')]=_0x4c346f;return _0x5ece8e;})['then'](respondWithFilteredResult(_0x4a544b,_0x258166))[_0x10a6('0x3f')](handleError(_0x4a544b,null));};exports[_0x10a6('0x40')]=function(_0x23d784,_0x496656){var _0x8c6f1e={'raw':![],'where':{'id':_0x23d784[_0x10a6('0x41')]['id']}},_0x34d432={};_0x34d432[_0x10a6('0x2c')]=_[_0x10a6('0x2e')](db[_0x10a6('0x28')]['rawAttributes']);_0x34d432['query']=_[_0x10a6('0x2e')](_0x23d784['query']);_0x34d432[_0x10a6('0x2f')]=_[_0x10a6('0x30')](_0x34d432[_0x10a6('0x2c')],_0x34d432[_0x10a6('0x2d')]);_0x8c6f1e['attributes']=_[_0x10a6('0x30')](_0x34d432['model'],qs[_0x10a6('0x32')](_0x23d784[_0x10a6('0x2d')][_0x10a6('0x32')]));_0x8c6f1e[_0x10a6('0x31')]=_0x8c6f1e['attributes']['length']?_0x8c6f1e[_0x10a6('0x31')]:_0x34d432[_0x10a6('0x2c')];if(_0x23d784[_0x10a6('0x2d')][_0x10a6('0x42')]){_0x8c6f1e['include']=[{'all':!![]}];}_0x8c6f1e=_[_0x10a6('0x3a')]({},_0x8c6f1e,_0x23d784['options']);return db[_0x10a6('0x28')][_0x10a6('0x43')](_0x8c6f1e)[_0x10a6('0x23')](handleEntityNotFound(_0x496656,null))[_0x10a6('0x23')](respondWithResult(_0x496656,null))[_0x10a6('0x3f')](handleError(_0x496656,null));};exports[_0x10a6('0x44')]=function(_0x1243fa,_0x4285f4){return db[_0x10a6('0x28')][_0x10a6('0x44')](_0x1243fa[_0x10a6('0x45')],{})[_0x10a6('0x23')](respondWithResult(_0x4285f4,0xc9))[_0x10a6('0x3f')](handleError(_0x4285f4,null));};exports['update']=function(_0x31734b,_0x2f268d){if(_0x31734b[_0x10a6('0x45')]['id']){delete _0x31734b[_0x10a6('0x45')]['id'];}return db[_0x10a6('0x28')][_0x10a6('0x43')]({'where':{'id':_0x31734b[_0x10a6('0x41')]['id']}})[_0x10a6('0x23')](handleEntityNotFound(_0x2f268d,null))['then'](saveUpdates(_0x31734b[_0x10a6('0x45')],null))[_0x10a6('0x23')](respondWithResult(_0x2f268d,null))[_0x10a6('0x3f')](handleError(_0x2f268d,null));};exports['destroy']=function(_0x28f815,_0x26d2e1){return db[_0x10a6('0x28')][_0x10a6('0x43')]({'where':{'id':_0x28f815[_0x10a6('0x41')]['id']}})[_0x10a6('0x23')](handleEntityNotFound(_0x26d2e1,null))[_0x10a6('0x23')](removeEntity(_0x26d2e1,null))[_0x10a6('0x3f')](handleError(_0x26d2e1,null));};exports[_0x10a6('0x46')]=function(_0x295132,_0x199509){return db['IntegrationReport']['describe']()[_0x10a6('0x23')](respondWithResult(_0x199509,null))[_0x10a6('0x3f')](handleError(_0x199509,null));}; \ No newline at end of file +var _0x397a=['send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','destroy','describe','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x397a,0x142));var _0xa397=function(_0x3ba7dc,_0x2aadf8){_0x3ba7dc=_0x3ba7dc-0x0;var _0x341325=_0x397a[_0x3ba7dc];return _0x341325;};'use strict';var emlformat=require(_0xa397('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa397('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa397('0x2'));var BPromise=require(_0xa397('0x3'));var Mustache=require('mustache');var util=require(_0xa397('0x4'));var path=require(_0xa397('0x5'));var sox=require(_0xa397('0x6'));var csv=require(_0xa397('0x7'));var ejs=require(_0xa397('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa397('0x9'));var crypto=require(_0xa397('0xa'));var jsforce=require(_0xa397('0xb'));var deskjs=require(_0xa397('0xc'));var toCsv=require(_0xa397('0x7'));var querystring=require('querystring');var Papa=require(_0xa397('0xd'));var Redis=require(_0xa397('0xe'));var authService=require(_0xa397('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa397('0x10'));var hardwareService=require(_0xa397('0x11'));var logger=require(_0xa397('0x12'))(_0xa397('0x13'));var utils=require(_0xa397('0x14'));var config=require(_0xa397('0x15'));var licenseUtil=require(_0xa397('0x16'));var db=require(_0xa397('0x17'))['db'];function respondWithStatusCode(_0x39b20a,_0x1249c1){_0x1249c1=_0x1249c1||0xcc;return function(_0x664a9e){if(_0x664a9e){return _0x39b20a[_0xa397('0x18')](_0x1249c1);}return _0x39b20a[_0xa397('0x19')](_0x1249c1)[_0xa397('0x1a')]();};}function respondWithResult(_0x59184a,_0x3d4094){_0x3d4094=_0x3d4094||0xc8;return function(_0x184113){if(_0x184113){return _0x59184a['status'](_0x3d4094)[_0xa397('0x1b')](_0x184113);}};}function respondWithFilteredResult(_0x33ff34,_0x4c9013){return function(_0x1c16f5){if(_0x1c16f5){var _0x2b7cef=typeof _0x4c9013[_0xa397('0x1c')]==='undefined'&&typeof _0x4c9013[_0xa397('0x1d')]===_0xa397('0x1e');var _0x27cdf4=_0x1c16f5[_0xa397('0x1f')];var _0x28a0da=_0x2b7cef?0x0:_0x4c9013[_0xa397('0x1c')];var _0x152338=_0x2b7cef?_0x1c16f5[_0xa397('0x1f')]:_0x4c9013['offset']+_0x4c9013['limit'];var _0x451a30;if(_0x152338>=_0x27cdf4){_0x152338=_0x27cdf4;_0x451a30=0xc8;}else{_0x451a30=0xce;}_0x33ff34[_0xa397('0x19')](_0x451a30);return _0x33ff34['set'](_0xa397('0x20'),_0x28a0da+'-'+_0x152338+'/'+_0x27cdf4)['json'](_0x1c16f5);}return null;};}function patchUpdates(_0x2b429c){return function(_0x5e92c2){try{jsonpatch[_0xa397('0x21')](_0x5e92c2,_0x2b429c,!![]);}catch(_0x55c2d8){return BPromise[_0xa397('0x22')](_0x55c2d8);}return _0x5e92c2['save']();};}function saveUpdates(_0x56425e,_0x3f3a47){return function(_0x4fbe45){if(_0x4fbe45){return _0x4fbe45[_0xa397('0x23')](_0x56425e)[_0xa397('0x24')](function(_0xde8a8e){return _0xde8a8e;});}return null;};}function removeEntity(_0xd621fe,_0x18b06d){return function(_0x3f1182){if(_0x3f1182){return _0x3f1182['destroy']()[_0xa397('0x24')](function(){_0xd621fe[_0xa397('0x19')](0xcc)[_0xa397('0x1a')]();});}};}function handleEntityNotFound(_0x20586a,_0x1c7d6f){return function(_0x3c73a3){if(!_0x3c73a3){_0x20586a[_0xa397('0x18')](0x194);}return _0x3c73a3;};}function handleError(_0x22f3fd,_0x48834b){_0x48834b=_0x48834b||0x1f4;return function(_0x208d97){logger['error'](_0x208d97['stack']);if(_0x208d97['name']){delete _0x208d97[_0xa397('0x25')];}_0x22f3fd[_0xa397('0x19')](_0x48834b)[_0xa397('0x26')](_0x208d97);};}exports[_0xa397('0x27')]=function(_0x31f928,_0x366e76){var _0x4f16e1={},_0xc9c97b={},_0x18b500={'count':0x0,'rows':[]};var _0x5c6640=_[_0xa397('0x28')](db[_0xa397('0x29')][_0xa397('0x2a')],function(_0xd1a500){return{'name':_0xd1a500[_0xa397('0x2b')],'type':_0xd1a500[_0xa397('0x2c')][_0xa397('0x2d')]};});_0xc9c97b[_0xa397('0x2e')]=_[_0xa397('0x28')](_0x5c6640,_0xa397('0x25'));_0xc9c97b['query']=_[_0xa397('0x2f')](_0x31f928[_0xa397('0x30')]);_0xc9c97b[_0xa397('0x31')]=_[_0xa397('0x32')](_0xc9c97b[_0xa397('0x2e')],_0xc9c97b['query']);_0x4f16e1[_0xa397('0x33')]=_[_0xa397('0x32')](_0xc9c97b[_0xa397('0x2e')],qs[_0xa397('0x34')](_0x31f928[_0xa397('0x30')][_0xa397('0x34')]));_0x4f16e1[_0xa397('0x33')]=_0x4f16e1[_0xa397('0x33')][_0xa397('0x35')]?_0x4f16e1[_0xa397('0x33')]:_0xc9c97b['model'];if(!_0x31f928[_0xa397('0x30')][_0xa397('0x36')]('nolimit')){_0x4f16e1[_0xa397('0x1d')]=qs['limit'](_0x31f928[_0xa397('0x30')][_0xa397('0x1d')]);_0x4f16e1[_0xa397('0x1c')]=qs['offset'](_0x31f928['query'][_0xa397('0x1c')]);}_0x4f16e1['order']=qs[_0xa397('0x37')](_0x31f928[_0xa397('0x30')][_0xa397('0x37')]);_0x4f16e1['where']=qs[_0xa397('0x31')](_['pick'](_0x31f928[_0xa397('0x30')],_0xc9c97b[_0xa397('0x31')]),_0x5c6640);if(_0x31f928['query'][_0xa397('0x38')]){_0x4f16e1[_0xa397('0x39')]=_[_0xa397('0x3a')](_0x4f16e1[_0xa397('0x39')],{'$or':_[_0xa397('0x28')](_0x5c6640,function(_0x1a109b){if(_0x1a109b['type']!==_0xa397('0x3b')){var _0x27e7f1={};_0x27e7f1[_0x1a109b[_0xa397('0x25')]]={'$like':'%'+_0x31f928[_0xa397('0x30')][_0xa397('0x38')]+'%'};return _0x27e7f1;}})});}_0x4f16e1=_[_0xa397('0x3a')]({},_0x4f16e1,_0x31f928[_0xa397('0x3c')]);var _0x57220e={'where':_0x4f16e1[_0xa397('0x39')]};return db['IntegrationReport'][_0xa397('0x1f')](_0x57220e)[_0xa397('0x24')](function(_0x40767e){_0x18b500['count']=_0x40767e;if(_0x31f928[_0xa397('0x30')][_0xa397('0x3d')]){_0x4f16e1['include']=[{'all':!![]}];}return db[_0xa397('0x29')][_0xa397('0x3e')](_0x4f16e1);})[_0xa397('0x24')](function(_0x1f45c7){_0x18b500['rows']=_0x1f45c7;return _0x18b500;})[_0xa397('0x24')](respondWithFilteredResult(_0x366e76,_0x4f16e1))[_0xa397('0x3f')](handleError(_0x366e76,null));};exports[_0xa397('0x40')]=function(_0x2e672c,_0x5ed73e){var _0x4d9e1d={'raw':![],'where':{'id':_0x2e672c[_0xa397('0x41')]['id']}},_0x2bb3cc={};_0x2bb3cc[_0xa397('0x2e')]=_['keys'](db[_0xa397('0x29')][_0xa397('0x2a')]);_0x2bb3cc[_0xa397('0x30')]=_['keys'](_0x2e672c[_0xa397('0x30')]);_0x2bb3cc[_0xa397('0x31')]=_['intersection'](_0x2bb3cc[_0xa397('0x2e')],_0x2bb3cc[_0xa397('0x30')]);_0x4d9e1d[_0xa397('0x33')]=_['intersection'](_0x2bb3cc[_0xa397('0x2e')],qs[_0xa397('0x34')](_0x2e672c[_0xa397('0x30')]['fields']));_0x4d9e1d[_0xa397('0x33')]=_0x4d9e1d[_0xa397('0x33')][_0xa397('0x35')]?_0x4d9e1d[_0xa397('0x33')]:_0x2bb3cc[_0xa397('0x2e')];if(_0x2e672c[_0xa397('0x30')][_0xa397('0x3d')]){_0x4d9e1d[_0xa397('0x42')]=[{'all':!![]}];}_0x4d9e1d=_[_0xa397('0x3a')]({},_0x4d9e1d,_0x2e672c[_0xa397('0x3c')]);return db['IntegrationReport'][_0xa397('0x43')](_0x4d9e1d)['then'](handleEntityNotFound(_0x5ed73e,null))['then'](respondWithResult(_0x5ed73e,null))[_0xa397('0x3f')](handleError(_0x5ed73e,null));};exports[_0xa397('0x44')]=function(_0x1b589a,_0x511406){return db['IntegrationReport'][_0xa397('0x44')](_0x1b589a[_0xa397('0x45')],{})[_0xa397('0x24')](respondWithResult(_0x511406,0xc9))['catch'](handleError(_0x511406,null));};exports[_0xa397('0x23')]=function(_0x4b7fe0,_0x3a07e6){if(_0x4b7fe0[_0xa397('0x45')]['id']){delete _0x4b7fe0[_0xa397('0x45')]['id'];}return db[_0xa397('0x29')][_0xa397('0x43')]({'where':{'id':_0x4b7fe0[_0xa397('0x41')]['id']}})[_0xa397('0x24')](handleEntityNotFound(_0x3a07e6,null))[_0xa397('0x24')](saveUpdates(_0x4b7fe0['body'],null))[_0xa397('0x24')](respondWithResult(_0x3a07e6,null))['catch'](handleError(_0x3a07e6,null));};exports[_0xa397('0x46')]=function(_0x1014f2,_0x3ca37c){return db[_0xa397('0x29')][_0xa397('0x43')]({'where':{'id':_0x1014f2[_0xa397('0x41')]['id']}})[_0xa397('0x24')](handleEntityNotFound(_0x3ca37c,null))[_0xa397('0x24')](removeEntity(_0x3ca37c,null))[_0xa397('0x3f')](handleError(_0x3ca37c,null));};exports[_0xa397('0x47')]=function(_0x4b1166,_0x4c8bd7){return db[_0xa397('0x29')][_0xa397('0x47')]()[_0xa397('0x24')](respondWithResult(_0x4c8bd7,null))[_0xa397('0x3f')](handleError(_0x4c8bd7,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0bd32ae..07a961f 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 _0x3224=['moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','lodash'];(function(_0x544e79,_0x1c0953){var _0x2270b2=function(_0x4a9d3a){while(--_0x4a9d3a){_0x544e79['push'](_0x544e79['shift']());}};_0x2270b2(++_0x1c0953);}(_0x3224,0x77));var _0x4322=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x3224[_0x4cbf20];return _0x582ae4;};'use strict';var _=require(_0x4322('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4322('0x1'));var BPromise=require('bluebird');var rp=require(_0x4322('0x2'));var fs=require('fs');var path=require(_0x4322('0x3'));var rimraf=require(_0x4322('0x4'));var config=require(_0x4322('0x5'));var attributes=require(_0x4322('0x6'));module[_0x4322('0x7')]=function(_0x4c9215,_0x3d80f3){return _0x4c9215[_0x4322('0x8')](_0x4322('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0fb=['IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x54da68,_0x4c80d9){var _0x525554=function(_0x59b575){while(--_0x59b575){_0x54da68['push'](_0x54da68['shift']());}};_0x525554(++_0x4c80d9);}(_0xe0fb,0x91));var _0xbe0f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe0fb[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xbe0f('0x0'));var util=require(_0xbe0f('0x1'));var logger=require(_0xbe0f('0x2'))(_0xbe0f('0x3'));var moment=require(_0xbe0f('0x4'));var BPromise=require(_0xbe0f('0x5'));var rp=require(_0xbe0f('0x6'));var fs=require('fs');var path=require(_0xbe0f('0x7'));var rimraf=require(_0xbe0f('0x8'));var config=require(_0xbe0f('0x9'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x264486,_0x27980f){return _0x264486[_0xbe0f('0xa')](_0xbe0f('0xb'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 10e72e3..8e74519 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(_0x1ce002,_0x4e05fa){var _0x3aaf77=function(_0xd7ad73){while(--_0xd7ad73){_0x1ce002['push'](_0x1ce002['shift']());}};_0x3aaf77(++_0x4e05fa);}(_0xdb28,0x106));var _0x8db2=function(_0x1df1e7,_0x38573b){_0x1df1e7=_0x1df1e7-0x0;var _0x4aaf73=_0xdb28[_0x1df1e7];return _0x4aaf73;};'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 _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x4975,0x86));var _0x5497=function(_0x557b73,_0x2b7a4b){_0x557b73=_0x557b73-0x0;var _0x78c308=_0x4975[_0x557b73];return _0x78c308;};'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')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ae7527a..9b0e659 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 _0x6317=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete'];(function(_0x3e07ab,_0x2530c9){var _0x3e1f5b=function(_0x58a635){while(--_0x58a635){_0x3e07ab['push'](_0x3e07ab['shift']());}};_0x3e1f5b(++_0x2530c9);}(_0x6317,0x11a));var _0x7631=function(_0x55b3bd,_0x1197d2){_0x55b3bd=_0x55b3bd-0x0;var _0x44cd44=_0x6317[_0x55b3bd];return _0x44cd44;};'use strict';var multer=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var path=require(_0x7631('0x2'));var timeout=require(_0x7631('0x3'));var express=require(_0x7631('0x4'));var router=express[_0x7631('0x5')]();var fs_extra=require(_0x7631('0x6'));var auth=require(_0x7631('0x7'));var interaction=require(_0x7631('0x8'));var config=require(_0x7631('0x9'));var controller=require(_0x7631('0xa'));router[_0x7631('0xb')]('/',auth['isAuthenticated'](),controller[_0x7631('0xc')]);router[_0x7631('0xb')](_0x7631('0xd'),auth[_0x7631('0xe')](),controller[_0x7631('0xf')]);router[_0x7631('0xb')](_0x7631('0x10'),auth[_0x7631('0xe')](),controller[_0x7631('0x11')]);router[_0x7631('0x12')]('/',auth[_0x7631('0xe')](),controller[_0x7631('0x13')]);router[_0x7631('0x12')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x7631('0x14')]);router[_0x7631('0x12')](_0x7631('0x15'),auth['isAuthenticated'](),controller[_0x7631('0x16')]);router[_0x7631('0x17')](_0x7631('0xd'),auth['isAuthenticated'](),controller[_0x7631('0x18')]);router[_0x7631('0x19')](_0x7631('0xd'),auth['isAuthenticated'](),controller[_0x7631('0x1a')]);module[_0x7631('0x1b')]=router; \ No newline at end of file +var _0x0ec6=['isAuthenticated','index','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x9ae685,_0x2c6652){var _0x4c492e=function(_0xde76ce){while(--_0xde76ce){_0x9ae685['push'](_0x9ae685['shift']());}};_0x4c492e(++_0x2c6652);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x1c56ae,_0x44673d){_0x1c56ae=_0x1c56ae-0x0;var _0x307c6a=_0x0ec6[_0x1c56ae];return _0x307c6a;};'use strict';var multer=require(_0x60ec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x60ec('0x1'));var express=require(_0x60ec('0x2'));var router=express[_0x60ec('0x3')]();var fs_extra=require(_0x60ec('0x4'));var auth=require(_0x60ec('0x5'));var interaction=require(_0x60ec('0x6'));var config=require(_0x60ec('0x7'));var controller=require('./interval.controller');router[_0x60ec('0x8')]('/',auth[_0x60ec('0x9')](),controller[_0x60ec('0xa')]);router[_0x60ec('0x8')]('/:id',auth[_0x60ec('0x9')](),controller['show']);router[_0x60ec('0x8')](_0x60ec('0xb'),auth[_0x60ec('0x9')](),controller[_0x60ec('0xc')]);router[_0x60ec('0xd')]('/',auth[_0x60ec('0x9')](),controller['create']);router['post'](_0x60ec('0xb'),auth[_0x60ec('0x9')](),controller[_0x60ec('0xe')]);router[_0x60ec('0xd')](_0x60ec('0xf'),auth['isAuthenticated'](),controller['addIntervals']);router[_0x60ec('0x10')](_0x60ec('0x11'),auth[_0x60ec('0x9')](),controller[_0x60ec('0x12')]);router[_0x60ec('0x13')]('/:id',auth[_0x60ec('0x9')](),controller[_0x60ec('0x14')]);module[_0x60ec('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b484b53..3dca889 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 _0xc946=['sequelize','exports','STRING'];(function(_0x62a56f,_0x4cedeb){var _0x156be0=function(_0x1bd40f){while(--_0x1bd40f){_0x62a56f['push'](_0x62a56f['shift']());}};_0x156be0(++_0x4cedeb);}(_0xc946,0xf6));var _0x6c94=function(_0x37e329,_0x2e483d){_0x37e329=_0x37e329-0x0;var _0x5c12f7=_0xc946[_0x37e329];return _0x5c12f7;};'use strict';var Sequelize=require(_0x6c94('0x0'));module[_0x6c94('0x1')]={'name':{'type':Sequelize[_0x6c94('0x2')]},'description':{'type':Sequelize[_0x6c94('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x4f29=['exports','STRING','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x4f29,0x1f4));var _0x94f2=function(_0x6a0e7d,_0x3a1831){_0x6a0e7d=_0x6a0e7d-0x0;var _0x39e492=_0x4f29[_0x6a0e7d];return _0x39e492;};'use strict';var Sequelize=require(_0x94f2('0x0'));module[_0x94f2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x94f2('0x2')]},'interval':{'type':Sequelize[_0x94f2('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 80804b5..739e57d 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 _0xe456=['find','create','body','user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','pick','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','Intervals','UserProfileResource','then','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','include','options'];(function(_0x3e5abf,_0x2d745c){var _0x24851c=function(_0x422a94){while(--_0x422a94){_0x3e5abf['push'](_0x3e5abf['shift']());}};_0x24851c(++_0x2d745c);}(_0xe456,0x1dd));var _0x6e45=function(_0x125e32,_0x5b4cda){_0x125e32=_0x125e32-0x0;var _0x52d904=_0xe456[_0x125e32];return _0x52d904;};'use strict';var emlformat=require(_0x6e45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e45('0x1'));var jsonpatch=require(_0x6e45('0x2'));var rp=require(_0x6e45('0x3'));var moment=require(_0x6e45('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e45('0x5'));var util=require(_0x6e45('0x6'));var path=require(_0x6e45('0x7'));var sox=require(_0x6e45('0x8'));var csv=require(_0x6e45('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e45('0xa'));var _=require(_0x6e45('0xb'));var squel=require(_0x6e45('0xc'));var crypto=require('crypto');var jsforce=require(_0x6e45('0xd'));var deskjs=require(_0x6e45('0xe'));var toCsv=require(_0x6e45('0x9'));var querystring=require(_0x6e45('0xf'));var Papa=require(_0x6e45('0x10'));var Redis=require(_0x6e45('0x11'));var authService=require(_0x6e45('0x12'));var qs=require(_0x6e45('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e45('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6e45('0x15'));var config=require(_0x6e45('0x16'));var licenseUtil=require(_0x6e45('0x17'));var db=require(_0x6e45('0x18'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3fe023,_0x929583){_0x929583=_0x929583||0xcc;return function(_0xdb5f66){if(_0xdb5f66){return _0x3fe023[_0x6e45('0x19')](_0x929583);}return _0x3fe023[_0x6e45('0x1a')](_0x929583)[_0x6e45('0x1b')]();};}function respondWithResult(_0x364b89,_0x4c0658){_0x4c0658=_0x4c0658||0xc8;return function(_0x37086c){if(_0x37086c){return _0x364b89[_0x6e45('0x1a')](_0x4c0658)['json'](_0x37086c);}};}function respondWithFilteredResult(_0x20e055,_0x3eea4c){return function(_0x586251){if(_0x586251){var _0xfcbfb8=typeof _0x3eea4c['offset']===_0x6e45('0x1c')&&typeof _0x3eea4c[_0x6e45('0x1d')]===_0x6e45('0x1c');var _0x43f1db=_0x586251[_0x6e45('0x1e')];var _0x2df5dc=_0xfcbfb8?0x0:_0x3eea4c[_0x6e45('0x1f')];var _0x1529f8=_0xfcbfb8?_0x586251['count']:_0x3eea4c[_0x6e45('0x1f')]+_0x3eea4c[_0x6e45('0x1d')];var _0x1e1d26;if(_0x1529f8>=_0x43f1db){_0x1529f8=_0x43f1db;_0x1e1d26=0xc8;}else{_0x1e1d26=0xce;}_0x20e055[_0x6e45('0x1a')](_0x1e1d26);return _0x20e055[_0x6e45('0x20')]('Content-Range',_0x2df5dc+'-'+_0x1529f8+'/'+_0x43f1db)[_0x6e45('0x21')](_0x586251);}return null;};}function patchUpdates(_0x44814f){return function(_0x45d331){try{jsonpatch[_0x6e45('0x22')](_0x45d331,_0x44814f,!![]);}catch(_0xfa8ea7){return BPromise[_0x6e45('0x23')](_0xfa8ea7);}return _0x45d331[_0x6e45('0x24')]();};}function saveUpdates(_0x148a78,_0x24b6a2){return function(_0xa10e2a){if(_0xa10e2a){return _0xa10e2a[_0x6e45('0x25')](_0x148a78)['then'](function(_0x52ee12){return _0x52ee12;});}return null;};}function removeEntity(_0x3b9b8b,_0x4f6319){return function(_0x22b0ac){if(_0x22b0ac){return _0x22b0ac[_0x6e45('0x26')]()['then'](function(){var _0x31803f=_0x22b0ac['get']({'plain':!![]});var _0x15319c=_0x6e45('0x27');return db[_0x6e45('0x28')][_0x6e45('0x26')]({'where':{'type':_0x15319c,'resourceId':_0x31803f['id']}})[_0x6e45('0x29')](function(){return _0x22b0ac;});})[_0x6e45('0x29')](function(){_0x3b9b8b[_0x6e45('0x1a')](0xcc)[_0x6e45('0x1b')]();});}};}function handleEntityNotFound(_0x5d0d64,_0x38941c){return function(_0x13361e){if(!_0x13361e){_0x5d0d64[_0x6e45('0x19')](0x194);}return _0x13361e;};}function handleError(_0x17678b,_0x46a596){_0x46a596=_0x46a596||0x1f4;return function(_0x5ed964){logger[_0x6e45('0x2a')](_0x5ed964[_0x6e45('0x2b')]);if(_0x5ed964[_0x6e45('0x2c')]){delete _0x5ed964[_0x6e45('0x2c')];}_0x17678b['status'](_0x46a596)[_0x6e45('0x2d')](_0x5ed964);};}exports[_0x6e45('0x2e')]=function(_0x6cf819,_0x1e76de){var _0x3e665e={},_0x41dbf8={},_0x166d3={'count':0x0,'rows':[]};var _0x34031d=_[_0x6e45('0x2f')](db[_0x6e45('0x30')][_0x6e45('0x31')],function(_0x5e9d7c){return{'name':_0x5e9d7c[_0x6e45('0x32')],'type':_0x5e9d7c[_0x6e45('0x33')][_0x6e45('0x34')]};});_0x41dbf8[_0x6e45('0x35')]=_[_0x6e45('0x2f')](_0x34031d,'name');_0x41dbf8[_0x6e45('0x36')]=_[_0x6e45('0x37')](_0x6cf819[_0x6e45('0x36')]);_0x41dbf8[_0x6e45('0x38')]=_[_0x6e45('0x39')](_0x41dbf8[_0x6e45('0x35')],_0x41dbf8[_0x6e45('0x36')]);_0x3e665e['attributes']=_[_0x6e45('0x39')](_0x41dbf8[_0x6e45('0x35')],qs['fields'](_0x6cf819[_0x6e45('0x36')][_0x6e45('0x3a')]));_0x3e665e['attributes']=_0x3e665e['attributes'][_0x6e45('0x3b')]?_0x3e665e[_0x6e45('0x3c')]:_0x41dbf8['model'];if(!_0x6cf819['query'][_0x6e45('0x3d')]('nolimit')){_0x3e665e[_0x6e45('0x1d')]=qs[_0x6e45('0x1d')](_0x6cf819[_0x6e45('0x36')][_0x6e45('0x1d')]);_0x3e665e[_0x6e45('0x1f')]=qs['offset'](_0x6cf819[_0x6e45('0x36')][_0x6e45('0x1f')]);}_0x3e665e[_0x6e45('0x3e')]=qs[_0x6e45('0x3f')](_0x6cf819['query'][_0x6e45('0x3f')]);_0x3e665e[_0x6e45('0x40')]=qs[_0x6e45('0x38')](_['pick'](_0x6cf819[_0x6e45('0x36')],_0x41dbf8[_0x6e45('0x38')]),_0x34031d);if(_0x6cf819[_0x6e45('0x36')][_0x6e45('0x41')]){_0x3e665e[_0x6e45('0x40')]=_[_0x6e45('0x42')](_0x3e665e[_0x6e45('0x40')],{'$or':_[_0x6e45('0x2f')](_0x34031d,function(_0x387a52){if(_0x387a52[_0x6e45('0x33')]!=='VIRTUAL'){var _0x308231={};_0x308231[_0x387a52['name']]={'$like':'%'+_0x6cf819['query']['filter']+'%'};return _0x308231;}})});}_0x3e665e=_[_0x6e45('0x42')]({},_0x3e665e,_0x6cf819['options']);var _0x30188f={'where':_0x3e665e['where']};return db['Interval']['count'](_0x30188f)[_0x6e45('0x29')](function(_0x5d38f8){_0x166d3['count']=_0x5d38f8;if(_0x6cf819['query'][_0x6e45('0x43')]){_0x3e665e['include']=[{'all':!![]}];}return db[_0x6e45('0x30')][_0x6e45('0x44')](_0x3e665e);})['then'](function(_0x1e9147){_0x166d3[_0x6e45('0x45')]=_0x1e9147;return _0x166d3;})[_0x6e45('0x29')](respondWithFilteredResult(_0x1e76de,_0x3e665e))[_0x6e45('0x46')](handleError(_0x1e76de,null));};exports[_0x6e45('0x47')]=function(_0x4e39a5,_0x23ef55){var _0x19bc7f={'raw':!![],'where':{'id':_0x4e39a5[_0x6e45('0x48')]['id']}},_0x290a0f={};_0x290a0f[_0x6e45('0x35')]=_[_0x6e45('0x37')](db[_0x6e45('0x30')]['rawAttributes']);_0x290a0f[_0x6e45('0x36')]=_[_0x6e45('0x37')](_0x4e39a5[_0x6e45('0x36')]);_0x290a0f[_0x6e45('0x38')]=_[_0x6e45('0x39')](_0x290a0f['model'],_0x290a0f[_0x6e45('0x36')]);_0x19bc7f[_0x6e45('0x3c')]=_[_0x6e45('0x39')](_0x290a0f[_0x6e45('0x35')],qs[_0x6e45('0x3a')](_0x4e39a5[_0x6e45('0x36')][_0x6e45('0x3a')]));_0x19bc7f[_0x6e45('0x3c')]=_0x19bc7f[_0x6e45('0x3c')][_0x6e45('0x3b')]?_0x19bc7f[_0x6e45('0x3c')]:_0x290a0f[_0x6e45('0x35')];if(_0x4e39a5[_0x6e45('0x36')][_0x6e45('0x43')]){_0x19bc7f[_0x6e45('0x49')]=[{'all':!![]}];}_0x19bc7f=_[_0x6e45('0x42')]({},_0x19bc7f,_0x4e39a5[_0x6e45('0x4a')]);return db['Interval'][_0x6e45('0x4b')](_0x19bc7f)[_0x6e45('0x29')](handleEntityNotFound(_0x23ef55,null))['then'](respondWithResult(_0x23ef55,null))[_0x6e45('0x46')](handleError(_0x23ef55,null));};exports['create']=function(_0x2db36e,_0x2d4cc6){return db[_0x6e45('0x30')][_0x6e45('0x4c')](_0x2db36e[_0x6e45('0x4d')],{})[_0x6e45('0x29')](function(_0x24e63){var _0x279713=_0x2db36e[_0x6e45('0x4e')]['get']({'plain':!![]});if(!_0x279713)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x279713[_0x6e45('0x4f')]===_0x6e45('0x4e')){var _0x3493ad=_0x24e63[_0x6e45('0x50')]({'plain':!![]});var _0x3e6574='Intervals';return db[_0x6e45('0x51')][_0x6e45('0x4b')]({'where':{'name':_0x3e6574,'userProfileId':_0x279713['userProfileId']},'raw':!![]})[_0x6e45('0x29')](function(_0x2b1348){if(_0x2b1348&&_0x2b1348['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3493ad[_0x6e45('0x2c')],'resourceId':_0x3493ad['id'],'type':_0x2b1348[_0x6e45('0x2c')],'sectionId':_0x2b1348['id']},{})[_0x6e45('0x29')](function(){return _0x24e63;});}else{return _0x24e63;}})[_0x6e45('0x46')](function(_0x243978){logger[_0x6e45('0x2a')](_0x6e45('0x52'),_0x243978);throw _0x243978;});}return _0x24e63;})[_0x6e45('0x29')](respondWithResult(_0x2d4cc6,0xc9))['catch'](handleError(_0x2d4cc6,null));};exports['update']=function(_0x20a0e9,_0x129be2){if(_0x20a0e9['body']['id']){delete _0x20a0e9[_0x6e45('0x4d')]['id'];}return db[_0x6e45('0x30')][_0x6e45('0x4b')]({'where':{'id':_0x20a0e9['params']['id']}})[_0x6e45('0x29')](handleEntityNotFound(_0x129be2,null))[_0x6e45('0x29')](saveUpdates(_0x20a0e9['body'],null))[_0x6e45('0x29')](respondWithResult(_0x129be2,null))[_0x6e45('0x46')](handleError(_0x129be2,null));};exports[_0x6e45('0x26')]=function(_0x9307a3,_0x504cc9){return db[_0x6e45('0x30')][_0x6e45('0x4b')]({'where':{'id':_0x9307a3[_0x6e45('0x48')]['id']}})[_0x6e45('0x29')](handleEntityNotFound(_0x504cc9,null))[_0x6e45('0x29')](removeEntity(_0x504cc9,null))[_0x6e45('0x46')](handleError(_0x504cc9,null));};exports[_0x6e45('0x53')]=function(_0x325a16,_0x2185b4,_0x240835){if(_0x325a16[_0x6e45('0x4d')]['id']){delete _0x325a16[_0x6e45('0x4d')]['id'];}return db['Interval'][_0x6e45('0x4b')]({'where':{'id':_0x325a16[_0x6e45('0x48')]['id']}})[_0x6e45('0x29')](handleEntityNotFound(_0x2185b4,null))['then'](function(_0x541779){if(_0x541779){_0x325a16[_0x6e45('0x4d')]['IntervalId']=_0x541779['id'];return db[_0x6e45('0x30')][_0x6e45('0x4c')](_0x325a16[_0x6e45('0x4d')]);}})[_0x6e45('0x29')](respondWithResult(_0x2185b4,null))[_0x6e45('0x46')](handleError(_0x2185b4,null));};exports[_0x6e45('0x54')]=function(_0x39f7c7,_0x541105,_0x230382){var _0x2dcf71={};var _0x7f220f={};var _0xf16570;var _0x1b2263;return db[_0x6e45('0x30')][_0x6e45('0x55')]({'where':{'id':_0x39f7c7[_0x6e45('0x48')]['id']}})[_0x6e45('0x29')](handleEntityNotFound(_0x541105,null))['then'](function(_0x19ab09){if(_0x19ab09){_0xf16570=_0x19ab09;_0x7f220f[_0x6e45('0x35')]=_['keys'](db[_0x6e45('0x30')]['rawAttributes']);_0x7f220f['query']=_[_0x6e45('0x37')](_0x39f7c7['query']);_0x7f220f[_0x6e45('0x38')]=_[_0x6e45('0x39')](_0x7f220f[_0x6e45('0x35')],_0x7f220f[_0x6e45('0x36')]);_0x2dcf71[_0x6e45('0x3c')]=_[_0x6e45('0x39')](_0x7f220f['model'],qs[_0x6e45('0x3a')](_0x39f7c7[_0x6e45('0x36')][_0x6e45('0x3a')]));_0x2dcf71[_0x6e45('0x3c')]=_0x2dcf71[_0x6e45('0x3c')]['length']?_0x2dcf71['attributes']:_0x7f220f[_0x6e45('0x35')];_0x2dcf71[_0x6e45('0x3e')]=qs[_0x6e45('0x3f')](_0x39f7c7[_0x6e45('0x36')][_0x6e45('0x3f')]);_0x2dcf71[_0x6e45('0x40')]=qs[_0x6e45('0x38')](_[_0x6e45('0x56')](_0x39f7c7[_0x6e45('0x36')],_0x7f220f[_0x6e45('0x38')]));if(_0x39f7c7[_0x6e45('0x36')]['filter']){_0x2dcf71[_0x6e45('0x40')]=_[_0x6e45('0x42')](_0x2dcf71[_0x6e45('0x40')],{'$or':_['map'](_0x2dcf71[_0x6e45('0x3c')],function(_0x25e4d9){var _0x2536a1={};_0x2536a1[_0x25e4d9]={'$like':'%'+_0x39f7c7[_0x6e45('0x36')]['filter']+'%'};return _0x2536a1;})});}_0x2dcf71=_[_0x6e45('0x42')]({},_0x2dcf71,_0x39f7c7[_0x6e45('0x4a')]);return _0xf16570[_0x6e45('0x54')](_0x2dcf71);}})[_0x6e45('0x29')](function(_0x465caf){if(_0x465caf){_0x1b2263=_0x465caf['length'];if(!_0x39f7c7[_0x6e45('0x36')]['hasOwnProperty']('nolimit')){_0x2dcf71['limit']=qs['limit'](_0x39f7c7[_0x6e45('0x36')]['limit']);_0x2dcf71[_0x6e45('0x1f')]=qs[_0x6e45('0x1f')](_0x39f7c7['query']['offset']);}return _0xf16570[_0x6e45('0x54')](_0x2dcf71);}})[_0x6e45('0x29')](function(_0x47bed5){if(_0x47bed5){return _0x47bed5?{'count':_0x1b2263,'rows':_0x47bed5}:null;}})[_0x6e45('0x29')](respondWithResult(_0x541105,null))['catch'](handleError(_0x541105,null));};exports[_0x6e45('0x57')]=function(_0x18ee54,_0x4e1161,_0x39385f){return db[_0x6e45('0x30')][_0x6e45('0x55')]({'where':{'id':_0x18ee54[_0x6e45('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e1161,null))[_0x6e45('0x29')](function(_0xdf7e65){if(_0xdf7e65){return db[_0x6e45('0x58')][_0x6e45('0x59')](function(_0x5e78e1){return db[_0x6e45('0x30')][_0x6e45('0x26')]({'where':{'IntervalId':_0x18ee54['params']['id']},'transaction':_0x5e78e1})[_0x6e45('0x29')](function(_0x5b219e){var _0x582cc9=_[_0x6e45('0x2f')](_0x18ee54[_0x6e45('0x4d')],function(_0x325c90){delete _0x325c90['id'];_0x325c90[_0x6e45('0x5a')]=_0x18ee54[_0x6e45('0x48')]['id'];return _0x325c90;});return db[_0x6e45('0x30')][_0x6e45('0x5b')](_0x582cc9,{'transaction':_0x5e78e1});});})['then'](function(){return db[_0x6e45('0x30')][_0x6e45('0x44')]({'where':{'IntervalId':_0x18ee54[_0x6e45('0x48')]['id']}});});}})[_0x6e45('0x29')](respondWithResult(_0x4e1161,null))[_0x6e45('0x46')](handleError(_0x4e1161,null));}; \ No newline at end of file +var _0x5bf0=['end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Intervals','UserProfileResource','stack','name','index','map','Interval','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','update','params','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status'];(function(_0xfe9f30,_0xf17d6){var _0x206e2a=function(_0x42b5d1){while(--_0x42b5d1){_0xfe9f30['push'](_0xfe9f30['shift']());}};_0x206e2a(++_0xf17d6);}(_0x5bf0,0x97));var _0x05bf=function(_0x45dcaa,_0x1652b1){_0x45dcaa=_0x45dcaa-0x0;var _0x54ffb1=_0x5bf0[_0x45dcaa];return _0x54ffb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05bf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05bf('0x1'));var rp=require(_0x05bf('0x2'));var moment=require(_0x05bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x05bf('0x4'));var util=require('util');var path=require(_0x05bf('0x5'));var sox=require(_0x05bf('0x6'));var csv=require('to-csv');var ejs=require(_0x05bf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05bf('0x8'));var squel=require(_0x05bf('0x9'));var crypto=require(_0x05bf('0xa'));var jsforce=require(_0x05bf('0xb'));var deskjs=require(_0x05bf('0xc'));var toCsv=require(_0x05bf('0xd'));var querystring=require('querystring');var Papa=require(_0x05bf('0xe'));var Redis=require(_0x05bf('0xf'));var authService=require(_0x05bf('0x10'));var qs=require(_0x05bf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05bf('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x05bf('0x13'));var config=require(_0x05bf('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x05bf('0x15'))['db'];var extensions=require(_0x05bf('0x16'));function respondWithStatusCode(_0x1a3d8b,_0x5ab6b5){_0x5ab6b5=_0x5ab6b5||0xcc;return function(_0x58d104){if(_0x58d104){return _0x1a3d8b[_0x05bf('0x17')](_0x5ab6b5);}return _0x1a3d8b[_0x05bf('0x18')](_0x5ab6b5)[_0x05bf('0x19')]();};}function respondWithResult(_0x4e25d2,_0x32bf90){_0x32bf90=_0x32bf90||0xc8;return function(_0x3b3533){if(_0x3b3533){return _0x4e25d2[_0x05bf('0x18')](_0x32bf90)[_0x05bf('0x1a')](_0x3b3533);}};}function respondWithFilteredResult(_0x15eb6e,_0x365654){return function(_0x35f73d){if(_0x35f73d){var _0x23fe99=typeof _0x365654[_0x05bf('0x1b')]===_0x05bf('0x1c')&&typeof _0x365654[_0x05bf('0x1d')]===_0x05bf('0x1c');var _0x3e1028=_0x35f73d[_0x05bf('0x1e')];var _0x527b8f=_0x23fe99?0x0:_0x365654['offset'];var _0x2594b4=_0x23fe99?_0x35f73d['count']:_0x365654[_0x05bf('0x1b')]+_0x365654[_0x05bf('0x1d')];var _0x437c73;if(_0x2594b4>=_0x3e1028){_0x2594b4=_0x3e1028;_0x437c73=0xc8;}else{_0x437c73=0xce;}_0x15eb6e[_0x05bf('0x18')](_0x437c73);return _0x15eb6e[_0x05bf('0x1f')](_0x05bf('0x20'),_0x527b8f+'-'+_0x2594b4+'/'+_0x3e1028)[_0x05bf('0x1a')](_0x35f73d);}return null;};}function patchUpdates(_0x262668){return function(_0x214e9c){try{jsonpatch['apply'](_0x214e9c,_0x262668,!![]);}catch(_0xeabde){return BPromise['reject'](_0xeabde);}return _0x214e9c[_0x05bf('0x21')]();};}function saveUpdates(_0x693545,_0x9b5d7c){return function(_0x12a42f){if(_0x12a42f){return _0x12a42f['update'](_0x693545)[_0x05bf('0x22')](function(_0x5c5a36){return _0x5c5a36;});}return null;};}function removeEntity(_0x20f78e,_0x1aae92){return function(_0x587b88){if(_0x587b88){return _0x587b88[_0x05bf('0x23')]()[_0x05bf('0x22')](function(){var _0x53d510=_0x587b88[_0x05bf('0x24')]({'plain':!![]});var _0x5b01c0=_0x05bf('0x25');return db[_0x05bf('0x26')][_0x05bf('0x23')]({'where':{'type':_0x5b01c0,'resourceId':_0x53d510['id']}})[_0x05bf('0x22')](function(){return _0x587b88;});})[_0x05bf('0x22')](function(){_0x20f78e[_0x05bf('0x18')](0xcc)[_0x05bf('0x19')]();});}};}function handleEntityNotFound(_0x1b52d8,_0x596b98){return function(_0x158530){if(!_0x158530){_0x1b52d8[_0x05bf('0x17')](0x194);}return _0x158530;};}function handleError(_0x144dcb,_0x3b83a7){_0x3b83a7=_0x3b83a7||0x1f4;return function(_0x305f47){logger['error'](_0x305f47[_0x05bf('0x27')]);if(_0x305f47[_0x05bf('0x28')]){delete _0x305f47[_0x05bf('0x28')];}_0x144dcb[_0x05bf('0x18')](_0x3b83a7)['send'](_0x305f47);};}exports[_0x05bf('0x29')]=function(_0x4236fc,_0x189935){var _0x52a071={},_0x541ca7={},_0x164d1c={'count':0x0,'rows':[]};var _0x1e2aa6=_[_0x05bf('0x2a')](db[_0x05bf('0x2b')][_0x05bf('0x2c')],function(_0x4f763e){return{'name':_0x4f763e[_0x05bf('0x2d')],'type':_0x4f763e[_0x05bf('0x2e')]['key']};});_0x541ca7['model']=_[_0x05bf('0x2a')](_0x1e2aa6,'name');_0x541ca7[_0x05bf('0x2f')]=_[_0x05bf('0x30')](_0x4236fc[_0x05bf('0x2f')]);_0x541ca7[_0x05bf('0x31')]=_[_0x05bf('0x32')](_0x541ca7['model'],_0x541ca7[_0x05bf('0x2f')]);_0x52a071[_0x05bf('0x33')]=_[_0x05bf('0x32')](_0x541ca7[_0x05bf('0x34')],qs[_0x05bf('0x35')](_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x35')]));_0x52a071['attributes']=_0x52a071[_0x05bf('0x33')][_0x05bf('0x36')]?_0x52a071['attributes']:_0x541ca7[_0x05bf('0x34')];if(!_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x37')]('nolimit')){_0x52a071[_0x05bf('0x1d')]=qs[_0x05bf('0x1d')](_0x4236fc[_0x05bf('0x2f')]['limit']);_0x52a071[_0x05bf('0x1b')]=qs['offset'](_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x1b')]);}_0x52a071[_0x05bf('0x38')]=qs[_0x05bf('0x39')](_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x39')]);_0x52a071[_0x05bf('0x3a')]=qs[_0x05bf('0x31')](_[_0x05bf('0x3b')](_0x4236fc[_0x05bf('0x2f')],_0x541ca7['filters']),_0x1e2aa6);if(_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x3c')]){_0x52a071['where']=_[_0x05bf('0x3d')](_0x52a071[_0x05bf('0x3a')],{'$or':_[_0x05bf('0x2a')](_0x1e2aa6,function(_0x53422d){if(_0x53422d[_0x05bf('0x2e')]!==_0x05bf('0x3e')){var _0x501d69={};_0x501d69[_0x53422d[_0x05bf('0x28')]]={'$like':'%'+_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x3c')]+'%'};return _0x501d69;}})});}_0x52a071=_[_0x05bf('0x3d')]({},_0x52a071,_0x4236fc['options']);var _0x1e1a40={'where':_0x52a071[_0x05bf('0x3a')]};return db[_0x05bf('0x2b')][_0x05bf('0x1e')](_0x1e1a40)[_0x05bf('0x22')](function(_0x7aefee){_0x164d1c['count']=_0x7aefee;if(_0x4236fc[_0x05bf('0x2f')][_0x05bf('0x3f')]){_0x52a071['include']=[{'all':!![]}];}return db[_0x05bf('0x2b')][_0x05bf('0x40')](_0x52a071);})[_0x05bf('0x22')](function(_0x534ddd){_0x164d1c[_0x05bf('0x41')]=_0x534ddd;return _0x164d1c;})['then'](respondWithFilteredResult(_0x189935,_0x52a071))[_0x05bf('0x42')](handleError(_0x189935,null));};exports[_0x05bf('0x43')]=function(_0x4a9bd3,_0x2d7c5e){var _0x40faa2={'raw':!![],'where':{'id':_0x4a9bd3['params']['id']}},_0x1a45c8={};_0x1a45c8['model']=_[_0x05bf('0x30')](db[_0x05bf('0x2b')][_0x05bf('0x2c')]);_0x1a45c8[_0x05bf('0x2f')]=_[_0x05bf('0x30')](_0x4a9bd3['query']);_0x1a45c8[_0x05bf('0x31')]=_[_0x05bf('0x32')](_0x1a45c8[_0x05bf('0x34')],_0x1a45c8['query']);_0x40faa2['attributes']=_['intersection'](_0x1a45c8[_0x05bf('0x34')],qs[_0x05bf('0x35')](_0x4a9bd3[_0x05bf('0x2f')][_0x05bf('0x35')]));_0x40faa2['attributes']=_0x40faa2[_0x05bf('0x33')][_0x05bf('0x36')]?_0x40faa2[_0x05bf('0x33')]:_0x1a45c8[_0x05bf('0x34')];if(_0x4a9bd3['query'][_0x05bf('0x3f')]){_0x40faa2[_0x05bf('0x44')]=[{'all':!![]}];}_0x40faa2=_[_0x05bf('0x3d')]({},_0x40faa2,_0x4a9bd3[_0x05bf('0x45')]);return db[_0x05bf('0x2b')][_0x05bf('0x46')](_0x40faa2)[_0x05bf('0x22')](handleEntityNotFound(_0x2d7c5e,null))[_0x05bf('0x22')](respondWithResult(_0x2d7c5e,null))[_0x05bf('0x42')](handleError(_0x2d7c5e,null));};exports[_0x05bf('0x47')]=function(_0x37adbe,_0x24e21a){return db[_0x05bf('0x2b')]['create'](_0x37adbe[_0x05bf('0x48')],{})['then'](function(_0x5bb5c1){var _0xc4fc8c=_0x37adbe['user']['get']({'plain':!![]});if(!_0xc4fc8c)throw new Error(_0x05bf('0x49'));if(_0xc4fc8c[_0x05bf('0x4a')]===_0x05bf('0x4b')){var _0x5bd113=_0x5bb5c1[_0x05bf('0x24')]({'plain':!![]});var _0x92c268='Intervals';return db[_0x05bf('0x4c')][_0x05bf('0x46')]({'where':{'name':_0x92c268,'userProfileId':_0xc4fc8c[_0x05bf('0x4d')]},'raw':!![]})[_0x05bf('0x22')](function(_0x3266d5){if(_0x3266d5&&_0x3266d5[_0x05bf('0x4e')]===0x0){return db[_0x05bf('0x26')][_0x05bf('0x47')]({'name':_0x5bd113[_0x05bf('0x28')],'resourceId':_0x5bd113['id'],'type':_0x3266d5[_0x05bf('0x28')],'sectionId':_0x3266d5['id']},{})[_0x05bf('0x22')](function(){return _0x5bb5c1;});}else{return _0x5bb5c1;}})[_0x05bf('0x42')](function(_0xf6c0f8){logger[_0x05bf('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf6c0f8);throw _0xf6c0f8;});}return _0x5bb5c1;})[_0x05bf('0x22')](respondWithResult(_0x24e21a,0xc9))[_0x05bf('0x42')](handleError(_0x24e21a,null));};exports[_0x05bf('0x50')]=function(_0x1a4ac1,_0x498a0d){if(_0x1a4ac1[_0x05bf('0x48')]['id']){delete _0x1a4ac1[_0x05bf('0x48')]['id'];}return db['Interval'][_0x05bf('0x46')]({'where':{'id':_0x1a4ac1[_0x05bf('0x51')]['id']}})[_0x05bf('0x22')](handleEntityNotFound(_0x498a0d,null))['then'](saveUpdates(_0x1a4ac1[_0x05bf('0x48')],null))[_0x05bf('0x22')](respondWithResult(_0x498a0d,null))[_0x05bf('0x42')](handleError(_0x498a0d,null));};exports['destroy']=function(_0x331c88,_0x5753c2){return db['Interval'][_0x05bf('0x46')]({'where':{'id':_0x331c88[_0x05bf('0x51')]['id']}})[_0x05bf('0x22')](handleEntityNotFound(_0x5753c2,null))[_0x05bf('0x22')](removeEntity(_0x5753c2,null))[_0x05bf('0x42')](handleError(_0x5753c2,null));};exports['addInterval']=function(_0x4048e0,_0x17dc59,_0x378932){if(_0x4048e0['body']['id']){delete _0x4048e0[_0x05bf('0x48')]['id'];}return db[_0x05bf('0x2b')][_0x05bf('0x46')]({'where':{'id':_0x4048e0['params']['id']}})[_0x05bf('0x22')](handleEntityNotFound(_0x17dc59,null))[_0x05bf('0x22')](function(_0x2dd43f){if(_0x2dd43f){_0x4048e0[_0x05bf('0x48')][_0x05bf('0x52')]=_0x2dd43f['id'];return db[_0x05bf('0x2b')][_0x05bf('0x47')](_0x4048e0['body']);}})[_0x05bf('0x22')](respondWithResult(_0x17dc59,null))[_0x05bf('0x42')](handleError(_0x17dc59,null));};exports[_0x05bf('0x53')]=function(_0x2ae2a3,_0x1641e5,_0x208759){var _0x578ebc={};var _0x37c8e4={};var _0x266164;var _0x4975d4;return db['Interval'][_0x05bf('0x54')]({'where':{'id':_0x2ae2a3[_0x05bf('0x51')]['id']}})[_0x05bf('0x22')](handleEntityNotFound(_0x1641e5,null))[_0x05bf('0x22')](function(_0x22690a){if(_0x22690a){_0x266164=_0x22690a;_0x37c8e4[_0x05bf('0x34')]=_[_0x05bf('0x30')](db['Interval'][_0x05bf('0x2c')]);_0x37c8e4[_0x05bf('0x2f')]=_[_0x05bf('0x30')](_0x2ae2a3[_0x05bf('0x2f')]);_0x37c8e4['filters']=_['intersection'](_0x37c8e4['model'],_0x37c8e4[_0x05bf('0x2f')]);_0x578ebc[_0x05bf('0x33')]=_[_0x05bf('0x32')](_0x37c8e4[_0x05bf('0x34')],qs[_0x05bf('0x35')](_0x2ae2a3['query']['fields']));_0x578ebc[_0x05bf('0x33')]=_0x578ebc['attributes'][_0x05bf('0x36')]?_0x578ebc[_0x05bf('0x33')]:_0x37c8e4[_0x05bf('0x34')];_0x578ebc['order']=qs['sort'](_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x39')]);_0x578ebc[_0x05bf('0x3a')]=qs[_0x05bf('0x31')](_[_0x05bf('0x3b')](_0x2ae2a3[_0x05bf('0x2f')],_0x37c8e4[_0x05bf('0x31')]));if(_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x3c')]){_0x578ebc['where']=_[_0x05bf('0x3d')](_0x578ebc['where'],{'$or':_[_0x05bf('0x2a')](_0x578ebc['attributes'],function(_0x421c45){var _0x53c89e={};_0x53c89e[_0x421c45]={'$like':'%'+_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x3c')]+'%'};return _0x53c89e;})});}_0x578ebc=_[_0x05bf('0x3d')]({},_0x578ebc,_0x2ae2a3['options']);return _0x266164[_0x05bf('0x53')](_0x578ebc);}})[_0x05bf('0x22')](function(_0x55989d){if(_0x55989d){_0x4975d4=_0x55989d[_0x05bf('0x36')];if(!_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x37')]('nolimit')){_0x578ebc['limit']=qs[_0x05bf('0x1d')](_0x2ae2a3[_0x05bf('0x2f')]['limit']);_0x578ebc[_0x05bf('0x1b')]=qs['offset'](_0x2ae2a3[_0x05bf('0x2f')][_0x05bf('0x1b')]);}return _0x266164['getIntervals'](_0x578ebc);}})[_0x05bf('0x22')](function(_0x3da5bb){if(_0x3da5bb){return _0x3da5bb?{'count':_0x4975d4,'rows':_0x3da5bb}:null;}})[_0x05bf('0x22')](respondWithResult(_0x1641e5,null))[_0x05bf('0x42')](handleError(_0x1641e5,null));};exports[_0x05bf('0x55')]=function(_0xb83ead,_0x1dd80c,_0x14cd3e){return db['Interval'][_0x05bf('0x54')]({'where':{'id':_0xb83ead[_0x05bf('0x51')]['id']}})['then'](handleEntityNotFound(_0x1dd80c,null))['then'](function(_0x1b8190){if(_0x1b8190){return db[_0x05bf('0x56')]['transaction'](function(_0x3fbd5b){return db[_0x05bf('0x2b')]['destroy']({'where':{'IntervalId':_0xb83ead[_0x05bf('0x51')]['id']},'transaction':_0x3fbd5b})[_0x05bf('0x22')](function(_0x5d3f81){var _0x1fc881=_[_0x05bf('0x2a')](_0xb83ead['body'],function(_0x98e135){delete _0x98e135['id'];_0x98e135['IntervalId']=_0xb83ead[_0x05bf('0x51')]['id'];return _0x98e135;});return db[_0x05bf('0x2b')][_0x05bf('0x57')](_0x1fc881,{'transaction':_0x3fbd5b});});})[_0x05bf('0x22')](function(){return db[_0x05bf('0x2b')][_0x05bf('0x40')]({'where':{'IntervalId':_0xb83ead[_0x05bf('0x51')]['id']}});});}})['then'](respondWithResult(_0x1dd80c,null))[_0x05bf('0x42')](handleError(_0x1dd80c,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 798800f..8c6758a 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 _0x9e46=['exports','define','Interval','tools_intervals','rewrite','interval','getIntervals','then','all','map','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime'];(function(_0x2075ed,_0xf386af){var _0xd47cc0=function(_0x468c89){while(--_0x468c89){_0x2075ed['push'](_0x2075ed['shift']());}};_0xd47cc0(++_0xf386af);}(_0x9e46,0x13e));var _0x69e4=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9e46[_0x1ac595];return _0x455fff;};'use strict';var attributes=require(_0x69e4('0x0'));var extensions=require(_0x69e4('0x1'));var iftime=require(_0x69e4('0x2'))[_0x69e4('0x3')];module[_0x69e4('0x4')]=function(_0x12f537){return _0x12f537[_0x69e4('0x5')](_0x69e4('0x6'),attributes,{'tableName':_0x69e4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cdeb0){extensions[_0x69e4('0x8')](_0x12f537,_0x1cdeb0);},'afterBulkCreate':function(_0x5983c1,_0x5bb9a3,_0x51fd2e){_0x51fd2e();extensions[_0x69e4('0x8')](_0x12f537,_0x5983c1[0x0]);},'afterUpdate':function(_0x2c574a){extensions[_0x69e4('0x8')](_0x12f537,_0x2c574a);},'afterDestroy':function(_0x5b7d04){extensions[_0x69e4('0x8')](_0x12f537,_0x5b7d04);}},'instanceMethods':{'ifTime':function(_0x3a6e30=undefined,_0xfd40f4=new Date()){if(typeof this[_0x69e4('0x9')]==='string'){return iftime(this[_0x69e4('0x9')],_0x3a6e30,_0xfd40f4);}else{return this[_0x69e4('0xa')]()[_0x69e4('0xb')](function(_0xe640bb){return Promise[_0x69e4('0xc')](_0xe640bb[_0x69e4('0xd')](function(_0x3b5fb5){return _0x3b5fb5['ifTime'](_0x3a6e30,_0xfd40f4);}));})[_0x69e4('0xb')](function(_0x123a68){return _0x123a68['reduce'](function(_0x2d3325,_0x42428e){return _0x2d3325||_0x42428e;},![]);});}}}});}; \ No newline at end of file +var _0xf19b=['getIntervals','then','map','ifTime','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','string'];(function(_0x5173b2,_0x53d4c4){var _0x448852=function(_0x134913){while(--_0x134913){_0x5173b2['push'](_0x5173b2['shift']());}};_0x448852(++_0x53d4c4);}(_0xf19b,0x19a));var _0xbf19=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xf19b[_0x3054be];return _0x3df150;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xbf19('0x0'));var iftime=require(_0xbf19('0x1'))[_0xbf19('0x2')];module[_0xbf19('0x3')]=function(_0x265e48){return _0x265e48[_0xbf19('0x4')](_0xbf19('0x5'),attributes,{'tableName':_0xbf19('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xc3b901){extensions[_0xbf19('0x7')](_0x265e48,_0xc3b901);},'afterBulkCreate':function(_0x166359,_0x3b3224,_0x46c867){_0x46c867();extensions[_0xbf19('0x7')](_0x265e48,_0x166359[0x0]);},'afterUpdate':function(_0x4029ec){extensions[_0xbf19('0x7')](_0x265e48,_0x4029ec);},'afterDestroy':function(_0x13ba57){extensions[_0xbf19('0x7')](_0x265e48,_0x13ba57);}},'instanceMethods':{'ifTime':function(_0x39df5f=undefined,_0x1c4bf0=new Date()){if(typeof this[_0xbf19('0x8')]===_0xbf19('0x9')){return iftime(this[_0xbf19('0x8')],_0x39df5f,_0x1c4bf0);}else{return this[_0xbf19('0xa')]()[_0xbf19('0xb')](function(_0x1ac724){return Promise['all'](_0x1ac724[_0xbf19('0xc')](function(_0xf437b4){return _0xf437b4[_0xbf19('0xd')](_0x39df5f,_0x1c4bf0);}));})[_0xbf19('0xb')](function(_0x59b769){return _0x59b769['reduce'](function(_0x3d18bc,_0x2a9e01){return _0x3d18bc||_0x2a9e01;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e9d05e9..9113722 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 _0x3cba=['string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','util','../../mysqldb','../../config/logger','rpc','Interval','findAll','options','raw','limit','include','map','model','attributes','then','info','GetInterval','catch','message','error','ShowInterval','find','where','debug','stringify','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervals'];(function(_0x2669b6,_0x282b1e){var _0x25d188=function(_0x5f2b61){while(--_0x5f2b61){_0x2669b6['push'](_0x2669b6['shift']());}};_0x25d188(++_0x282b1e);}(_0x3cba,0x161));var _0xa3cb=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x3cba[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require(_0xa3cb('0x0'));var util=require(_0xa3cb('0x1'));var db=require(_0xa3cb('0x2'))['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0xa3cb('0x3'))(_0xa3cb('0x4'));exports['GetInterval']=function(_0x2a1557){var _0x18d5ae=this;return new Promise(function(_0x124fc9,_0x513e3a){return db[_0xa3cb('0x5')][_0xa3cb('0x6')]({'raw':_0x2a1557[_0xa3cb('0x7')]?_0x2a1557['options'][_0xa3cb('0x8')]===undefined?!![]:![]:!![],'where':_0x2a1557['options']?_0x2a1557[_0xa3cb('0x7')]['where']||null:null,'attributes':_0x2a1557['options']?_0x2a1557['options']['attributes']||null:null,'limit':_0x2a1557['options']?_0x2a1557[_0xa3cb('0x7')][_0xa3cb('0x9')]||null:null,'include':_0x2a1557[_0xa3cb('0x7')]?_0x2a1557[_0xa3cb('0x7')][_0xa3cb('0xa')]?_[_0xa3cb('0xb')](_0x2a1557[_0xa3cb('0x7')][_0xa3cb('0xa')],function(_0x2e7a87){return{'model':db[_0x2e7a87[_0xa3cb('0xc')]],'as':_0x2e7a87['as'],'attributes':_0x2e7a87[_0xa3cb('0xd')],'include':_0x2e7a87[_0xa3cb('0xa')]?_[_0xa3cb('0xb')](_0x2e7a87[_0xa3cb('0xa')],function(_0x48856a){return{'model':db[_0x48856a[_0xa3cb('0xc')]],'as':_0x48856a['as'],'attributes':_0x48856a[_0xa3cb('0xd')],'include':_0x48856a[_0xa3cb('0xa')]?_['map'](_0x48856a[_0xa3cb('0xa')],function(_0x208056){return{'model':db[_0x208056[_0xa3cb('0xc')]],'as':_0x208056['as'],'attributes':_0x208056[_0xa3cb('0xd')]};}):[]};}):[]};}):[]:[]})[_0xa3cb('0xe')](function(_0x28c2b5){logger[_0xa3cb('0xf')](_0xa3cb('0x10'),_0x2a1557);logger['debug'](_0xa3cb('0x10'),_0x2a1557,JSON['stringify'](_0x28c2b5));_0x124fc9(_0x28c2b5);})[_0xa3cb('0x11')](function(_0x39f50d){logger['error'](_0xa3cb('0x10'),_0x39f50d[_0xa3cb('0x12')],_0x2a1557);_0x513e3a(_0x18d5ae[_0xa3cb('0x13')](0x1f4,_0x39f50d[_0xa3cb('0x12')]));});});};exports[_0xa3cb('0x14')]=function(_0x20199d){var _0x28f0d9=this;return new Promise(function(_0x5d8c33,_0x27a95c){return db['Interval'][_0xa3cb('0x15')]({'raw':_0x20199d['options']?_0x20199d[_0xa3cb('0x7')][_0xa3cb('0x8')]===undefined?!![]:![]:!![],'where':_0x20199d['options']?_0x20199d[_0xa3cb('0x7')][_0xa3cb('0x16')]||null:null,'attributes':_0x20199d[_0xa3cb('0x7')]?_0x20199d[_0xa3cb('0x7')][_0xa3cb('0xd')]||null:null,'include':_0x20199d[_0xa3cb('0x7')]?_0x20199d[_0xa3cb('0x7')][_0xa3cb('0xa')]?_[_0xa3cb('0xb')](_0x20199d[_0xa3cb('0x7')][_0xa3cb('0xa')],function(_0x27eb01){return{'model':db[_0x27eb01[_0xa3cb('0xc')]],'as':_0x27eb01['as'],'attributes':_0x27eb01['attributes'],'include':_0x27eb01[_0xa3cb('0xa')]?_[_0xa3cb('0xb')](_0x27eb01[_0xa3cb('0xa')],function(_0x365da7){return{'model':db[_0x365da7[_0xa3cb('0xc')]],'as':_0x365da7['as'],'attributes':_0x365da7[_0xa3cb('0xd')],'include':_0x365da7[_0xa3cb('0xa')]?_['map'](_0x365da7[_0xa3cb('0xa')],function(_0x579b8d){return{'model':db[_0x579b8d[_0xa3cb('0xc')]],'as':_0x579b8d['as'],'attributes':_0x579b8d[_0xa3cb('0xd')]};}):[]};}):[]};}):[]:[]})[_0xa3cb('0xe')](function(_0x16fd1e){logger['info']('ShowInterval',_0x20199d);logger[_0xa3cb('0x17')](_0xa3cb('0x14'),_0x20199d,JSON[_0xa3cb('0x18')](_0x16fd1e));_0x5d8c33(_0x16fd1e);})[_0xa3cb('0x11')](function(_0x2ee36a){logger[_0xa3cb('0x13')](_0xa3cb('0x14'),_0x2ee36a['message'],_0x20199d);_0x27a95c(_0x28f0d9[_0xa3cb('0x13')](0x1f4,_0x2ee36a[_0xa3cb('0x12')]));});});};function checkArrayOfIntervals(_0x4922e6,_0x47fa33){var _0x15e17c=[];return db['Interval'][_0xa3cb('0x6')]({'where':{'id':_0x4922e6}})[_0xa3cb('0xe')](function(_0x2e0825){_0x15e17c=_0x2e0825;return Promise['all'](_0x15e17c[_0xa3cb('0xb')](function(_0x484190){return _0x484190[_0xa3cb('0x19')](_0x47fa33);}));})['then'](function(_0xa103e2){var _0x1e291d=_0xa103e2[_0xa3cb('0x1a')](function(_0x276215,_0x5ba727){return _0x276215||_0x5ba727;},![]);logger[_0xa3cb('0xf')](util[_0xa3cb('0x1b')](_0xa3cb('0x1c'),_0x15e17c[_0xa3cb('0xb')](function(_0x4fdc8d){return _0x4fdc8d['name'];})[_0xa3cb('0x1d')](',\x20'),_0x15e17c[_0xa3cb('0xb')](function(_0x465c7b){return _0x465c7b['id'];})[_0xa3cb('0x1d')](',\x20')));return _0x1e291d;});}function checkSingleInterval(_0x1b6dc7,_0x68f7af){return db[_0xa3cb('0x5')][_0xa3cb('0x1e')](_0x1b6dc7)[_0xa3cb('0xe')](function(_0x7bbd62){if(_0x7bbd62){logger['info'](util['format'](_0xa3cb('0x1f'),_0x7bbd62[_0xa3cb('0x20')],_0x7bbd62['id']));return _0x7bbd62[_0xa3cb('0x19')](_0x68f7af);}});}exports['IntervalIftime']=function(_0x4abfa0){var _0xb1b0ae=_0x4abfa0['intervalIds'];var _0x47b0a0=Array['isArray'](_0x4abfa0[_0xa3cb('0x21')])?_0x4abfa0[_0xa3cb('0x21')]:typeof _0x4abfa0['intervals']===_0xa3cb('0x22')?[_0x4abfa0[_0xa3cb('0x21')]]:[];var _0x3ebe39=_0x4abfa0[_0xa3cb('0x23')]||undefined;var _0x27b5c4=![];if(_0x47b0a0[_0xa3cb('0x24')]){logger[_0xa3cb('0xf')](util['format'](_0xa3cb('0x25'),_0x47b0a0[_0xa3cb('0x1d')](';\x20')));}if(_0x3ebe39){logger['info'](util[_0xa3cb('0x1b')](_0xa3cb('0x26'),_0x3ebe39));}logger[_0xa3cb('0x17')](_0xa3cb('0x27'),_0x27b5c4);logger[_0xa3cb('0x28')](_0xa3cb('0x29'),_0x4abfa0);return Promise[_0xa3cb('0x2a')]()[_0xa3cb('0xe')](function(){if(Array['isArray'](_0xb1b0ae)){return checkArrayOfIntervals(_0xb1b0ae,_0x3ebe39);}else if(_0xb1b0ae){return checkSingleInterval(_0xb1b0ae,_0x3ebe39);}})[_0xa3cb('0xe')](function(_0x1b9a53){var _0x3a9982=_0x47b0a0['reduce'](function(_0x1ffbbd,_0x3cf71b){return _0x1ffbbd||iftime(_0x3cf71b,_0x3ebe39);},![]);_0x27b5c4=_0x1b9a53||_0x3a9982;return _0x27b5c4;})[_0xa3cb('0x11')](function(_0xa4e819){logger[_0xa3cb('0x13')](_0xa3cb('0x29'),_0x4abfa0,_0xa4e819);throw this[_0xa3cb('0x13')](0x1f4,_0xa4e819[_0xa3cb('0x12')]);});}; \ No newline at end of file +var _0x91d2=['silly','resolve','isArray','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','where','attributes','map','include','model','then','info','debug','stringify','catch','error','message','ShowInterval','Interval','find','raw','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','name','IntervalIftime','intervalIds','intervals','timezone','Iftime'];(function(_0x36aa05,_0x3117cc){var _0x293263=function(_0x1bdc70){while(--_0x1bdc70){_0x36aa05['push'](_0x36aa05['shift']());}};_0x293263(++_0x3117cc);}(_0x91d2,0x1d7));var _0x291d=function(_0x28f0a8,_0x2cfd26){_0x28f0a8=_0x28f0a8-0x0;var _0x33db97=_0x91d2[_0x28f0a8];return _0x33db97;};'use strict';var _=require('lodash');var util=require(_0x291d('0x0'));var db=require(_0x291d('0x1'))['db'];var iftime=require(_0x291d('0x2'))[_0x291d('0x3')];var logger=require(_0x291d('0x4'))(_0x291d('0x5'));exports[_0x291d('0x6')]=function(_0x166e3e){var _0x1a0237=this;return new Promise(function(_0x320106,_0x46bd26){return db['Interval'][_0x291d('0x7')]({'raw':_0x166e3e['options']?_0x166e3e[_0x291d('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x166e3e[_0x291d('0x8')]?_0x166e3e[_0x291d('0x8')][_0x291d('0x9')]||null:null,'attributes':_0x166e3e[_0x291d('0x8')]?_0x166e3e[_0x291d('0x8')][_0x291d('0xa')]||null:null,'limit':_0x166e3e['options']?_0x166e3e[_0x291d('0x8')]['limit']||null:null,'include':_0x166e3e['options']?_0x166e3e[_0x291d('0x8')]['include']?_[_0x291d('0xb')](_0x166e3e['options'][_0x291d('0xc')],function(_0x44d68a){return{'model':db[_0x44d68a[_0x291d('0xd')]],'as':_0x44d68a['as'],'attributes':_0x44d68a[_0x291d('0xa')],'include':_0x44d68a[_0x291d('0xc')]?_[_0x291d('0xb')](_0x44d68a['include'],function(_0x96c219){return{'model':db[_0x96c219[_0x291d('0xd')]],'as':_0x96c219['as'],'attributes':_0x96c219[_0x291d('0xa')],'include':_0x96c219['include']?_[_0x291d('0xb')](_0x96c219[_0x291d('0xc')],function(_0x2efec0){return{'model':db[_0x2efec0['model']],'as':_0x2efec0['as'],'attributes':_0x2efec0['attributes']};}):[]};}):[]};}):[]:[]})[_0x291d('0xe')](function(_0x3524cd){logger[_0x291d('0xf')](_0x291d('0x6'),_0x166e3e);logger[_0x291d('0x10')](_0x291d('0x6'),_0x166e3e,JSON[_0x291d('0x11')](_0x3524cd));_0x320106(_0x3524cd);})[_0x291d('0x12')](function(_0x1b8c9d){logger[_0x291d('0x13')](_0x291d('0x6'),_0x1b8c9d[_0x291d('0x14')],_0x166e3e);_0x46bd26(_0x1a0237[_0x291d('0x13')](0x1f4,_0x1b8c9d[_0x291d('0x14')]));});});};exports[_0x291d('0x15')]=function(_0x243bf9){var _0x4ddc7c=this;return new Promise(function(_0x2f9922,_0x1ff4a2){return db[_0x291d('0x16')][_0x291d('0x17')]({'raw':_0x243bf9[_0x291d('0x8')]?_0x243bf9[_0x291d('0x8')][_0x291d('0x18')]===undefined?!![]:![]:!![],'where':_0x243bf9[_0x291d('0x8')]?_0x243bf9['options'][_0x291d('0x9')]||null:null,'attributes':_0x243bf9[_0x291d('0x8')]?_0x243bf9['options']['attributes']||null:null,'include':_0x243bf9[_0x291d('0x8')]?_0x243bf9[_0x291d('0x8')]['include']?_[_0x291d('0xb')](_0x243bf9[_0x291d('0x8')][_0x291d('0xc')],function(_0x3b5b0e){return{'model':db[_0x3b5b0e['model']],'as':_0x3b5b0e['as'],'attributes':_0x3b5b0e[_0x291d('0xa')],'include':_0x3b5b0e[_0x291d('0xc')]?_[_0x291d('0xb')](_0x3b5b0e['include'],function(_0x2b9993){return{'model':db[_0x2b9993['model']],'as':_0x2b9993['as'],'attributes':_0x2b9993[_0x291d('0xa')],'include':_0x2b9993['include']?_['map'](_0x2b9993[_0x291d('0xc')],function(_0x466be4){return{'model':db[_0x466be4[_0x291d('0xd')]],'as':_0x466be4['as'],'attributes':_0x466be4[_0x291d('0xa')]};}):[]};}):[]};}):[]:[]})[_0x291d('0xe')](function(_0x3ccfd2){logger[_0x291d('0xf')](_0x291d('0x15'),_0x243bf9);logger[_0x291d('0x10')](_0x291d('0x15'),_0x243bf9,JSON[_0x291d('0x11')](_0x3ccfd2));_0x2f9922(_0x3ccfd2);})[_0x291d('0x12')](function(_0x11d8de){logger[_0x291d('0x13')](_0x291d('0x15'),_0x11d8de[_0x291d('0x14')],_0x243bf9);_0x1ff4a2(_0x4ddc7c[_0x291d('0x13')](0x1f4,_0x11d8de[_0x291d('0x14')]));});});};function checkArrayOfIntervals(_0x519c94,_0x2dca61){var _0x5c3c8c=[];return db['Interval']['findAll']({'where':{'id':_0x519c94}})['then'](function(_0x38ef35){_0x5c3c8c=_0x38ef35;return Promise['all'](_0x5c3c8c['map'](function(_0x53bd45){return _0x53bd45[_0x291d('0x19')](_0x2dca61);}));})['then'](function(_0x499989){var _0x47eca2=_0x499989[_0x291d('0x1a')](function(_0x5dc4de,_0x170ff9){return _0x5dc4de||_0x170ff9;},![]);logger[_0x291d('0xf')](util[_0x291d('0x1b')](_0x291d('0x1c'),_0x5c3c8c[_0x291d('0xb')](function(_0x1a8bf6){return _0x1a8bf6['name'];})[_0x291d('0x1d')](',\x20'),_0x5c3c8c['map'](function(_0x99c2f5){return _0x99c2f5['id'];})[_0x291d('0x1d')](',\x20')));return _0x47eca2;});}function checkSingleInterval(_0x53e72f,_0x40cc0e){return db[_0x291d('0x16')]['findById'](_0x53e72f)['then'](function(_0xa13e60){if(_0xa13e60){logger[_0x291d('0xf')](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0xa13e60[_0x291d('0x1e')],_0xa13e60['id']));return _0xa13e60[_0x291d('0x19')](_0x40cc0e);}});}exports[_0x291d('0x1f')]=function(_0x2694e5){var _0x310d71=_0x2694e5[_0x291d('0x20')];var _0x2c845f=Array['isArray'](_0x2694e5['intervals'])?_0x2694e5[_0x291d('0x21')]:typeof _0x2694e5[_0x291d('0x21')]==='string'?[_0x2694e5[_0x291d('0x21')]]:[];var _0x2bc3ac=_0x2694e5[_0x291d('0x22')]||undefined;var _0x28b0b5=![];if(_0x2c845f['length']){logger[_0x291d('0xf')](util[_0x291d('0x1b')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x2c845f[_0x291d('0x1d')](';\x20')));}if(_0x2bc3ac){logger[_0x291d('0xf')](util[_0x291d('0x1b')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x2bc3ac));}logger['debug'](_0x291d('0x23'),_0x28b0b5);logger[_0x291d('0x24')](_0x291d('0x1f'),_0x2694e5);return Promise[_0x291d('0x25')]()['then'](function(){if(Array[_0x291d('0x26')](_0x310d71)){return checkArrayOfIntervals(_0x310d71,_0x2bc3ac);}else if(_0x310d71){return checkSingleInterval(_0x310d71,_0x2bc3ac);}})[_0x291d('0xe')](function(_0xbb96fb){var _0x156fb1=_0x2c845f[_0x291d('0x1a')](function(_0x192674,_0x51dba4){return _0x192674||iftime(_0x51dba4,_0x2bc3ac);},![]);_0x28b0b5=_0xbb96fb||_0x156fb1;return _0x28b0b5;})[_0x291d('0x12')](function(_0x2c5a9a){logger[_0x291d('0x13')](_0x291d('0x1f'),_0x2694e5,_0x2c5a9a);throw this[_0x291d('0x13')](0x1f4,_0x2c5a9a[_0x291d('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 9ecc318..bd6fef3 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 _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x27a848,_0x2dfc9a){var _0x57dbb0=function(_0x403443){while(--_0x403443){_0x27a848['push'](_0x27a848['shift']());}};_0x57dbb0(++_0x2dfc9a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2feacb,_0x2ccc7c){_0x2feacb=_0x2feacb-0x0;var _0x35feb2=_0x5f2f[_0x2feacb];return _0x35feb2;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0xb5d522,_0x1544dd){var _0x4c71ea=function(_0x4c5738){while(--_0x4c5738){_0xb5d522['push'](_0xb5d522['shift']());}};_0x4c71ea(++_0x1544dd);}(_0x2ef3,0xba));var _0x32ef=function(_0x41e733,_0x57ad0c){_0x41e733=_0x41e733-0x0;var _0x320bad=_0x2ef3[_0x41e733];return _0x320bad;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b26c3ee..f51e985 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 _0x8c31=['error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','socket','remoteAddress','connection','https','../../config/logger','key','Report','\x20from\x20','description','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','toString','base64','stringify','request','utf8','status','statusCode','json'];(function(_0x3ee77f,_0x5c2dba){var _0x52697b=function(_0x131dc8){while(--_0x131dc8){_0x3ee77f['push'](_0x3ee77f['shift']());}};_0x52697b(++_0x5c2dba);}(_0x8c31,0x17c));var _0x18c3=function(_0x38e656,_0x21bcb0){_0x38e656=_0x38e656-0x0;var _0x411375=_0x8c31[_0x38e656];return _0x411375;};'use strict';var BPromise=require('bluebird');var https=require(_0x18c3('0x0'));var logger=require(_0x18c3('0x1'))('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5bb5c6,_0x1af668){var _0x5f1efe={'fields':{'project':{'key':_0x5bb5c6[_0x18c3('0x2')]||'MOTGUI'},'summary':(_0x5bb5c6['summary']||_0x18c3('0x3'))+_0x18c3('0x4')+_0x5bb5c6['ip'],'description':_0x5bb5c6[_0x18c3('0x5')]||JSON['stringify'](_0x5bb5c6),'issuetype':{'name':_0x5bb5c6['issuetype']||'Bug'}}};_0x5f1efe[_0x18c3('0x6')][_0x18c3('0x7')]=_0x5bb5c6[_0x18c3('0x8')];_0x5f1efe['fields'][_0x18c3('0x9')]=_0x5bb5c6['oldToken'];_0x5f1efe[_0x18c3('0x6')][_0x18c3('0xa')]=_0x5bb5c6[_0x18c3('0xb')];_0x5f1efe[_0x18c3('0x6')][_0x18c3('0xc')]=_0x5bb5c6[_0x18c3('0xd')];_0x5f1efe[_0x18c3('0x6')][_0x18c3('0xe')]=_0x5bb5c6[_0x18c3('0xf')];_0x5f1efe[_0x18c3('0x6')][_0x18c3('0x10')]=_0x5bb5c6['ip'];var _0x152d7c={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x18c3('0x11'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x18c3('0x12'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x18c3('0x13')](_0x18c3('0x14'))}};var _0x4cde3b=JSON[_0x18c3('0x15')](_0x5f1efe);var _0x54ea9e=https[_0x18c3('0x16')](_0x152d7c,function(_0x4c196c){_0x4c196c['setEncoding'](_0x18c3('0x17'));var _0x4e8812='';_0x4c196c['on']('data',function(_0x297f22){_0x4e8812+=_0x297f22;});_0x4c196c['on']('end',function(){if(_0x1af668){return _0x1af668[_0x18c3('0x18')](_0x4c196c[_0x18c3('0x19')])[_0x18c3('0x1a')](JSON['parse'](_0x4e8812));}});});_0x54ea9e['on'](_0x18c3('0x1b'),function(_0x4d4d2f){if(_0x1af668){return _0x1af668[_0x18c3('0x18')](0x1f4)['json']({'errors':[{'message':_0x18c3('0x1c'),'type':'api.jira'}]});}});_0x54ea9e[_0x18c3('0x1d')](_0x4cde3b);_0x54ea9e[_0x18c3('0x1e')]();}exports[_0x18c3('0x1f')]=openIssue;exports[_0x18c3('0x20')]=function(_0x2143fe,_0x17916b){_0x2143fe[_0x18c3('0x21')]['ip']=_0x2143fe['headers']['x-forwarded-for']||_0x2143fe['connection']['remoteAddress']||_0x2143fe[_0x18c3('0x22')][_0x18c3('0x23')]||_0x2143fe[_0x18c3('0x24')][_0x18c3('0x22')]['remoteAddress'];return openIssue(_0x2143fe['body'],_0x17916b);}; \ No newline at end of file +var _0xc813=['stringify','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','request','setEncoding','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','end','openIssue','send','body','headers','x-forwarded-for','remoteAddress','connection','bluebird','https','../../config/logger','key','MOTGUI','summary','\x20from\x20','description'];(function(_0x99d066,_0x13a9d0){var _0x548c90=function(_0x4cbe26){while(--_0x4cbe26){_0x99d066['push'](_0x99d066['shift']());}};_0x548c90(++_0x13a9d0);}(_0xc813,0xca));var _0x3c81=function(_0x165360,_0x5ca20b){_0x165360=_0x165360-0x0;var _0x5acc59=_0xc813[_0x165360];return _0x5acc59;};'use strict';var BPromise=require(_0x3c81('0x0'));var https=require(_0x3c81('0x1'));var logger=require(_0x3c81('0x2'))('api');var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x202238,_0x584c06){var _0xdeaeb={'fields':{'project':{'key':_0x202238[_0x3c81('0x3')]||_0x3c81('0x4')},'summary':(_0x202238[_0x3c81('0x5')]||'Report')+_0x3c81('0x6')+_0x202238['ip'],'description':_0x202238[_0x3c81('0x7')]||JSON[_0x3c81('0x8')](_0x202238),'issuetype':{'name':_0x202238['issuetype']||_0x3c81('0x9')}}};_0xdeaeb[_0x3c81('0xa')][_0x3c81('0xb')]=_0x202238['email'];_0xdeaeb[_0x3c81('0xa')][_0x3c81('0xc')]=_0x202238[_0x3c81('0xd')];_0xdeaeb['fields'][_0x3c81('0xe')]=_0x202238[_0x3c81('0xf')];_0xdeaeb[_0x3c81('0xa')][_0x3c81('0x10')]=_0x202238['name'];_0xdeaeb[_0x3c81('0xa')][_0x3c81('0x11')]=_0x202238[_0x3c81('0x12')];_0xdeaeb[_0x3c81('0xa')][_0x3c81('0x13')]=_0x202238['ip'];var _0x31cd24={'host':_0x3c81('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x3c81('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x3c81('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x3c81('0x17')](_0x3c81('0x18'))}};var _0x47600d=JSON[_0x3c81('0x8')](_0xdeaeb);var _0x29e783=https[_0x3c81('0x19')](_0x31cd24,function(_0x373359){_0x373359[_0x3c81('0x1a')]('utf8');var _0x57df22='';_0x373359['on'](_0x3c81('0x1b'),function(_0x1dad42){_0x57df22+=_0x1dad42;});_0x373359['on']('end',function(){if(_0x584c06){return _0x584c06[_0x3c81('0x1c')](_0x373359[_0x3c81('0x1d')])[_0x3c81('0x1e')](JSON[_0x3c81('0x1f')](_0x57df22));}});});_0x29e783['on'](_0x3c81('0x20'),function(_0x3e062b){if(_0x584c06){return _0x584c06['status'](0x1f4)['json']({'errors':[{'message':_0x3c81('0x21'),'type':'api.jira'}]});}});_0x29e783['write'](_0x47600d);_0x29e783[_0x3c81('0x22')]();}exports[_0x3c81('0x23')]=openIssue;exports[_0x3c81('0x24')]=function(_0x7197e8,_0x34f0e3){_0x7197e8[_0x3c81('0x25')]['ip']=_0x7197e8[_0x3c81('0x26')][_0x3c81('0x27')]||_0x7197e8['connection']['remoteAddress']||_0x7197e8['socket'][_0x3c81('0x28')]||_0x7197e8[_0x3c81('0x29')]['socket'][_0x3c81('0x28')];return openIssue(_0x7197e8[_0x3c81('0x25')],_0x34f0e3);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 03e35bc..358bf59 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 _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2dae,0xc3));var _0xe2da=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x2dae[_0x3da612];return _0x1a9d1d;};'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'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file +var _0xec56=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x15d412,_0x39f7de){var _0x2abc98=function(_0x603323){while(--_0x603323){_0x15d412['push'](_0x15d412['shift']());}};_0x2abc98(++_0x39f7de);}(_0xec56,0x1bd));var _0x6ec5=function(_0x41a3bb,_0x2034ac){_0x41a3bb=_0x41a3bb-0x0;var _0x5e80bb=_0xec56[_0x41a3bb];return _0x5e80bb;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['post']('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x10')]);router[_0x6ec5('0x11')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x12')]);router[_0x6ec5('0x13')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x14')]);module[_0x6ec5('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 3a99f9c..ef854ae 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x57085b,_0x5e2d8d){_0x57085b=_0x57085b-0x0;var _0x139a64=_0x7a54[_0x57085b];return _0x139a64;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x2f2ddb,_0x3272f9){_0x2f2ddb=_0x2f2ddb-0x0;var _0x49bec2=_0x7a54[_0x2f2ddb];return _0x49bec2;};'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 31a2ea6..6d21cde 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 _0x102b=['find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','then','destroy','sendStatus','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x102b,0x1be));var _0xb102=function(_0xa469b0,_0x4147c5){_0xa469b0=_0xa469b0-0x0;var _0x89bacc=_0x102b[_0xa469b0];return _0x89bacc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb102('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb102('0x1'));var rp=require(_0xb102('0x2'));var moment=require(_0xb102('0x3'));var BPromise=require(_0xb102('0x4'));var Mustache=require(_0xb102('0x5'));var util=require(_0xb102('0x6'));var path=require(_0xb102('0x7'));var sox=require(_0xb102('0x8'));var csv=require('to-csv');var ejs=require(_0xb102('0x9'));var fs=require('fs');var fs_extra=require(_0xb102('0xa'));var _=require(_0xb102('0xb'));var squel=require(_0xb102('0xc'));var crypto=require(_0xb102('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb102('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb102('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb102('0x10'));var as=require(_0xb102('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb102('0x12'))(_0xb102('0x13'));var utils=require(_0xb102('0x14'));var config=require(_0xb102('0x15'));var licenseUtil=require(_0xb102('0x16'));var db=require(_0xb102('0x17'))['db'];function respondWithStatusCode(_0x3d6aef,_0x5675f8){_0x5675f8=_0x5675f8||0xcc;return function(_0x122f05){if(_0x122f05){return _0x3d6aef['sendStatus'](_0x5675f8);}return _0x3d6aef[_0xb102('0x18')](_0x5675f8)[_0xb102('0x19')]();};}function respondWithResult(_0x5ca3f2,_0x1e19ab){_0x1e19ab=_0x1e19ab||0xc8;return function(_0x38db8c){if(_0x38db8c){return _0x5ca3f2['status'](_0x1e19ab)[_0xb102('0x1a')](_0x38db8c);}};}function respondWithFilteredResult(_0x2925fb,_0x2733c7){return function(_0x49a44c){if(_0x49a44c){var _0x4fd30d=typeof _0x2733c7['offset']===_0xb102('0x1b')&&typeof _0x2733c7[_0xb102('0x1c')]===_0xb102('0x1b');var _0xc80615=_0x49a44c['count'];var _0x58d1e4=_0x4fd30d?0x0:_0x2733c7[_0xb102('0x1d')];var _0x365c54=_0x4fd30d?_0x49a44c[_0xb102('0x1e')]:_0x2733c7[_0xb102('0x1d')]+_0x2733c7['limit'];var _0x57dc37;if(_0x365c54>=_0xc80615){_0x365c54=_0xc80615;_0x57dc37=0xc8;}else{_0x57dc37=0xce;}_0x2925fb[_0xb102('0x18')](_0x57dc37);return _0x2925fb[_0xb102('0x1f')](_0xb102('0x20'),_0x58d1e4+'-'+_0x365c54+'/'+_0xc80615)[_0xb102('0x1a')](_0x49a44c);}return null;};}function patchUpdates(_0x503001){return function(_0xd2206b){try{jsonpatch[_0xb102('0x21')](_0xd2206b,_0x503001,!![]);}catch(_0xd81b8d){return BPromise[_0xb102('0x22')](_0xd81b8d);}return _0xd2206b['save']();};}function saveUpdates(_0x4964e9,_0x26571d){return function(_0x404373){if(_0x404373){return _0x404373['update'](_0x4964e9)[_0xb102('0x23')](function(_0x53f5a5){return _0x53f5a5;});}return null;};}function removeEntity(_0x2d88f0,_0x18c147){return function(_0x30cbb0){if(_0x30cbb0){return _0x30cbb0[_0xb102('0x24')]()['then'](function(){_0x2d88f0['status'](0xcc)[_0xb102('0x19')]();});}};}function handleEntityNotFound(_0x40179e,_0x39c0f3){return function(_0x428ffb){if(!_0x428ffb){_0x40179e[_0xb102('0x25')](0x194);}return _0x428ffb;};}function handleError(_0x1d0f11,_0x14c7cd){_0x14c7cd=_0x14c7cd||0x1f4;return function(_0x40f33c){logger['error'](_0x40f33c['stack']);if(_0x40f33c[_0xb102('0x26')]){delete _0x40f33c[_0xb102('0x26')];}_0x1d0f11[_0xb102('0x18')](_0x14c7cd)[_0xb102('0x27')](_0x40f33c);};}exports['index']=function(_0xebba06,_0x4d4c17){var _0x8ab193={},_0x18633e={},_0x530195={'count':0x0,'rows':[]};var _0x37d4a2=_[_0xb102('0x28')](db[_0xb102('0x29')][_0xb102('0x2a')],function(_0x28c2ea){return{'name':_0x28c2ea[_0xb102('0x2b')],'type':_0x28c2ea[_0xb102('0x2c')][_0xb102('0x2d')]};});_0x18633e[_0xb102('0x2e')]=_['map'](_0x37d4a2,_0xb102('0x26'));_0x18633e[_0xb102('0x2f')]=_[_0xb102('0x30')](_0xebba06['query']);_0x18633e[_0xb102('0x31')]=_[_0xb102('0x32')](_0x18633e[_0xb102('0x2e')],_0x18633e[_0xb102('0x2f')]);_0x8ab193['attributes']=_['intersection'](_0x18633e['model'],qs['fields'](_0xebba06[_0xb102('0x2f')][_0xb102('0x33')]));_0x8ab193['attributes']=_0x8ab193[_0xb102('0x34')][_0xb102('0x35')]?_0x8ab193[_0xb102('0x34')]:_0x18633e[_0xb102('0x2e')];if(!_0xebba06[_0xb102('0x2f')][_0xb102('0x36')](_0xb102('0x37'))){_0x8ab193[_0xb102('0x1c')]=qs[_0xb102('0x1c')](_0xebba06[_0xb102('0x2f')][_0xb102('0x1c')]);_0x8ab193[_0xb102('0x1d')]=qs[_0xb102('0x1d')](_0xebba06[_0xb102('0x2f')][_0xb102('0x1d')]);}_0x8ab193[_0xb102('0x38')]=qs['sort'](_0xebba06[_0xb102('0x2f')][_0xb102('0x39')]);_0x8ab193['where']=qs[_0xb102('0x31')](_[_0xb102('0x3a')](_0xebba06[_0xb102('0x2f')],_0x18633e[_0xb102('0x31')]),_0x37d4a2);if(_0xebba06['query'][_0xb102('0x3b')]){_0x8ab193[_0xb102('0x3c')]=_[_0xb102('0x3d')](_0x8ab193[_0xb102('0x3c')],{'$or':_[_0xb102('0x28')](_0x37d4a2,function(_0x279334){if(_0x279334[_0xb102('0x2c')]!=='VIRTUAL'){var _0x1444d9={};_0x1444d9[_0x279334[_0xb102('0x26')]]={'$like':'%'+_0xebba06['query'][_0xb102('0x3b')]+'%'};return _0x1444d9;}})});}_0x8ab193=_[_0xb102('0x3d')]({},_0x8ab193,_0xebba06[_0xb102('0x3e')]);var _0x519bb0={'where':_0x8ab193[_0xb102('0x3c')]};return db[_0xb102('0x29')]['count'](_0x519bb0)[_0xb102('0x23')](function(_0x5de7a7){_0x530195['count']=_0x5de7a7;if(_0xebba06['query'][_0xb102('0x3f')]){_0x8ab193[_0xb102('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb102('0x41')](_0x8ab193);})[_0xb102('0x23')](function(_0x7dc750){_0x530195[_0xb102('0x42')]=_0x7dc750;return _0x530195;})[_0xb102('0x23')](respondWithFilteredResult(_0x4d4c17,_0x8ab193))[_0xb102('0x43')](handleError(_0x4d4c17,null));};exports[_0xb102('0x44')]=function(_0xbba70a,_0x131474){var _0x56d89d={'raw':!![],'where':{'id':_0xbba70a[_0xb102('0x45')]['id']}},_0x3b0fb1={};_0x3b0fb1[_0xb102('0x2e')]=_[_0xb102('0x30')](db[_0xb102('0x29')][_0xb102('0x2a')]);_0x3b0fb1['query']=_['keys'](_0xbba70a[_0xb102('0x2f')]);_0x3b0fb1[_0xb102('0x31')]=_[_0xb102('0x32')](_0x3b0fb1[_0xb102('0x2e')],_0x3b0fb1['query']);_0x56d89d['attributes']=_[_0xb102('0x32')](_0x3b0fb1[_0xb102('0x2e')],qs[_0xb102('0x33')](_0xbba70a[_0xb102('0x2f')][_0xb102('0x33')]));_0x56d89d['attributes']=_0x56d89d['attributes'][_0xb102('0x35')]?_0x56d89d[_0xb102('0x34')]:_0x3b0fb1['model'];if(_0xbba70a[_0xb102('0x2f')][_0xb102('0x3f')]){_0x56d89d['include']=[{'all':!![]}];}_0x56d89d=_['merge']({},_0x56d89d,_0xbba70a['options']);return db['JscriptyAnswerReport']['find'](_0x56d89d)[_0xb102('0x23')](handleEntityNotFound(_0x131474,null))[_0xb102('0x23')](respondWithResult(_0x131474,null))[_0xb102('0x43')](handleError(_0x131474,null));};exports['create']=function(_0x43538a,_0x1fd676){return db['JscriptyAnswerReport'][_0xb102('0x46')](_0x43538a[_0xb102('0x47')],{})['then'](respondWithResult(_0x1fd676,0xc9))[_0xb102('0x43')](handleError(_0x1fd676,null));};exports['update']=function(_0x5853c7,_0x272165){if(_0x5853c7['body']['id']){delete _0x5853c7[_0xb102('0x47')]['id'];}return db[_0xb102('0x29')][_0xb102('0x48')]({'where':{'id':_0x5853c7['params']['id']}})[_0xb102('0x23')](handleEntityNotFound(_0x272165,null))['then'](saveUpdates(_0x5853c7[_0xb102('0x47')],null))[_0xb102('0x23')](respondWithResult(_0x272165,null))[_0xb102('0x43')](handleError(_0x272165,null));};exports[_0xb102('0x24')]=function(_0x27b0c0,_0x1dc374){return db[_0xb102('0x29')][_0xb102('0x48')]({'where':{'id':_0x27b0c0['params']['id']}})[_0xb102('0x23')](handleEntityNotFound(_0x1dc374,null))[_0xb102('0x23')](removeEntity(_0x1dc374,null))['catch'](handleError(_0x1dc374,null));};exports[_0xb102('0x49')]=function(_0x574079,_0x57a04e){return db[_0xb102('0x29')]['describe']()[_0xb102('0x23')](respondWithResult(_0x57a04e,null))[_0xb102('0x43')](handleError(_0x57a04e,null));}; \ No newline at end of file +var _0xa7e6=['json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','JscriptyAnswerReport','include','rows','catch','show','params','includeAll','find','create','body','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x5d2c27,_0x4f29bd){var _0xe58191=function(_0x13175e){while(--_0x13175e){_0x5d2c27['push'](_0x5d2c27['shift']());}};_0xe58191(++_0x4f29bd);}(_0xa7e6,0x74));var _0x6a7e=function(_0x45a11e,_0x201134){_0x45a11e=_0x45a11e-0x0;var _0x54229c=_0xa7e6[_0x45a11e];return _0x54229c;};'use strict';var emlformat=require(_0x6a7e('0x0'));var rimraf=require(_0x6a7e('0x1'));var zipdir=require(_0x6a7e('0x2'));var jsonpatch=require(_0x6a7e('0x3'));var rp=require(_0x6a7e('0x4'));var moment=require(_0x6a7e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6a7e('0x6'));var util=require(_0x6a7e('0x7'));var path=require(_0x6a7e('0x8'));var sox=require(_0x6a7e('0x9'));var csv=require(_0x6a7e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a7e('0xb'));var _=require(_0x6a7e('0xc'));var squel=require(_0x6a7e('0xd'));var crypto=require(_0x6a7e('0xe'));var jsforce=require(_0x6a7e('0xf'));var deskjs=require(_0x6a7e('0x10'));var toCsv=require(_0x6a7e('0xa'));var querystring=require(_0x6a7e('0x11'));var Papa=require(_0x6a7e('0x12'));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(_0x6a7e('0x13'));var logger=require(_0x6a7e('0x14'))(_0x6a7e('0x15'));var utils=require(_0x6a7e('0x16'));var config=require(_0x6a7e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a7e('0x18'))['db'];function respondWithStatusCode(_0x4754ef,_0x5c0c74){_0x5c0c74=_0x5c0c74||0xcc;return function(_0x50dcc1){if(_0x50dcc1){return _0x4754ef[_0x6a7e('0x19')](_0x5c0c74);}return _0x4754ef[_0x6a7e('0x1a')](_0x5c0c74)[_0x6a7e('0x1b')]();};}function respondWithResult(_0x374763,_0x4faca9){_0x4faca9=_0x4faca9||0xc8;return function(_0x3137bc){if(_0x3137bc){return _0x374763[_0x6a7e('0x1a')](_0x4faca9)[_0x6a7e('0x1c')](_0x3137bc);}};}function respondWithFilteredResult(_0x4576fe,_0x465566){return function(_0x4b0893){if(_0x4b0893){var _0x16c9a5=typeof _0x465566['offset']==='undefined'&&typeof _0x465566[_0x6a7e('0x1d')]==='undefined';var _0x1d2abb=_0x4b0893[_0x6a7e('0x1e')];var _0x470197=_0x16c9a5?0x0:_0x465566[_0x6a7e('0x1f')];var _0x20e90a=_0x16c9a5?_0x4b0893['count']:_0x465566['offset']+_0x465566['limit'];var _0x102e83;if(_0x20e90a>=_0x1d2abb){_0x20e90a=_0x1d2abb;_0x102e83=0xc8;}else{_0x102e83=0xce;}_0x4576fe[_0x6a7e('0x1a')](_0x102e83);return _0x4576fe[_0x6a7e('0x20')](_0x6a7e('0x21'),_0x470197+'-'+_0x20e90a+'/'+_0x1d2abb)[_0x6a7e('0x1c')](_0x4b0893);}return null;};}function patchUpdates(_0x35b0ff){return function(_0x42eccc){try{jsonpatch[_0x6a7e('0x22')](_0x42eccc,_0x35b0ff,!![]);}catch(_0x5d5cbf){return BPromise[_0x6a7e('0x23')](_0x5d5cbf);}return _0x42eccc[_0x6a7e('0x24')]();};}function saveUpdates(_0x4f53c5,_0x3e1e64){return function(_0x3d0971){if(_0x3d0971){return _0x3d0971[_0x6a7e('0x25')](_0x4f53c5)['then'](function(_0x40c7f6){return _0x40c7f6;});}return null;};}function removeEntity(_0xd045ca,_0x4ee914){return function(_0x18f5e2){if(_0x18f5e2){return _0x18f5e2['destroy']()[_0x6a7e('0x26')](function(){_0xd045ca[_0x6a7e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29db13,_0x956eb6){return function(_0x46a15f){if(!_0x46a15f){_0x29db13[_0x6a7e('0x19')](0x194);}return _0x46a15f;};}function handleError(_0x3498c5,_0x380f2f){_0x380f2f=_0x380f2f||0x1f4;return function(_0x573bdc){logger[_0x6a7e('0x27')](_0x573bdc[_0x6a7e('0x28')]);if(_0x573bdc[_0x6a7e('0x29')]){delete _0x573bdc[_0x6a7e('0x29')];}_0x3498c5[_0x6a7e('0x1a')](_0x380f2f)['send'](_0x573bdc);};}exports['index']=function(_0x8b0439,_0x2e86f8){var _0x2723d0={},_0x525376={},_0xa324d0={'count':0x0,'rows':[]};var _0x57e642=_[_0x6a7e('0x2a')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x15c2b8){return{'name':_0x15c2b8['fieldName'],'type':_0x15c2b8[_0x6a7e('0x2b')]['key']};});_0x525376['model']=_[_0x6a7e('0x2a')](_0x57e642,_0x6a7e('0x29'));_0x525376[_0x6a7e('0x2c')]=_[_0x6a7e('0x2d')](_0x8b0439[_0x6a7e('0x2c')]);_0x525376[_0x6a7e('0x2e')]=_[_0x6a7e('0x2f')](_0x525376[_0x6a7e('0x30')],_0x525376[_0x6a7e('0x2c')]);_0x2723d0[_0x6a7e('0x31')]=_[_0x6a7e('0x2f')](_0x525376[_0x6a7e('0x30')],qs['fields'](_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x32')]));_0x2723d0[_0x6a7e('0x31')]=_0x2723d0['attributes'][_0x6a7e('0x33')]?_0x2723d0[_0x6a7e('0x31')]:_0x525376[_0x6a7e('0x30')];if(!_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x34')](_0x6a7e('0x35'))){_0x2723d0['limit']=qs['limit'](_0x8b0439[_0x6a7e('0x2c')]['limit']);_0x2723d0[_0x6a7e('0x1f')]=qs[_0x6a7e('0x1f')](_0x8b0439['query']['offset']);}_0x2723d0['order']=qs[_0x6a7e('0x36')](_0x8b0439['query']['sort']);_0x2723d0['where']=qs['filters'](_[_0x6a7e('0x37')](_0x8b0439['query'],_0x525376[_0x6a7e('0x2e')]),_0x57e642);if(_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x38')]){_0x2723d0[_0x6a7e('0x39')]=_[_0x6a7e('0x3a')](_0x2723d0['where'],{'$or':_[_0x6a7e('0x2a')](_0x57e642,function(_0x1db4e3){if(_0x1db4e3['type']!==_0x6a7e('0x3b')){var _0x2f58ac={};_0x2f58ac[_0x1db4e3['name']]={'$like':'%'+_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x38')]+'%'};return _0x2f58ac;}})});}_0x2723d0=_[_0x6a7e('0x3a')]({},_0x2723d0,_0x8b0439[_0x6a7e('0x3c')]);var _0x2827f7={'where':_0x2723d0[_0x6a7e('0x39')]};return db[_0x6a7e('0x3d')][_0x6a7e('0x1e')](_0x2827f7)[_0x6a7e('0x26')](function(_0x27434a){_0xa324d0[_0x6a7e('0x1e')]=_0x27434a;if(_0x8b0439['query']['includeAll']){_0x2723d0[_0x6a7e('0x3e')]=[{'all':!![]}];}return db[_0x6a7e('0x3d')]['findAll'](_0x2723d0);})[_0x6a7e('0x26')](function(_0x46799d){_0xa324d0[_0x6a7e('0x3f')]=_0x46799d;return _0xa324d0;})[_0x6a7e('0x26')](respondWithFilteredResult(_0x2e86f8,_0x2723d0))[_0x6a7e('0x40')](handleError(_0x2e86f8,null));};exports[_0x6a7e('0x41')]=function(_0x3d7266,_0x14cae5){var _0x2a3d31={'raw':!![],'where':{'id':_0x3d7266[_0x6a7e('0x42')]['id']}},_0x247efb={};_0x247efb[_0x6a7e('0x30')]=_[_0x6a7e('0x2d')](db[_0x6a7e('0x3d')]['rawAttributes']);_0x247efb['query']=_[_0x6a7e('0x2d')](_0x3d7266[_0x6a7e('0x2c')]);_0x247efb[_0x6a7e('0x2e')]=_[_0x6a7e('0x2f')](_0x247efb[_0x6a7e('0x30')],_0x247efb[_0x6a7e('0x2c')]);_0x2a3d31[_0x6a7e('0x31')]=_[_0x6a7e('0x2f')](_0x247efb['model'],qs[_0x6a7e('0x32')](_0x3d7266['query'][_0x6a7e('0x32')]));_0x2a3d31[_0x6a7e('0x31')]=_0x2a3d31[_0x6a7e('0x31')][_0x6a7e('0x33')]?_0x2a3d31['attributes']:_0x247efb[_0x6a7e('0x30')];if(_0x3d7266[_0x6a7e('0x2c')][_0x6a7e('0x43')]){_0x2a3d31['include']=[{'all':!![]}];}_0x2a3d31=_[_0x6a7e('0x3a')]({},_0x2a3d31,_0x3d7266['options']);return db[_0x6a7e('0x3d')][_0x6a7e('0x44')](_0x2a3d31)[_0x6a7e('0x26')](handleEntityNotFound(_0x14cae5,null))[_0x6a7e('0x26')](respondWithResult(_0x14cae5,null))['catch'](handleError(_0x14cae5,null));};exports[_0x6a7e('0x45')]=function(_0x47369f,_0x188ab5){return db[_0x6a7e('0x3d')]['create'](_0x47369f[_0x6a7e('0x46')],{})['then'](respondWithResult(_0x188ab5,0xc9))[_0x6a7e('0x40')](handleError(_0x188ab5,null));};exports[_0x6a7e('0x25')]=function(_0x25c2bb,_0x4a7465){if(_0x25c2bb[_0x6a7e('0x46')]['id']){delete _0x25c2bb['body']['id'];}return db[_0x6a7e('0x3d')]['find']({'where':{'id':_0x25c2bb[_0x6a7e('0x42')]['id']}})[_0x6a7e('0x26')](handleEntityNotFound(_0x4a7465,null))[_0x6a7e('0x26')](saveUpdates(_0x25c2bb[_0x6a7e('0x46')],null))[_0x6a7e('0x26')](respondWithResult(_0x4a7465,null))[_0x6a7e('0x40')](handleError(_0x4a7465,null));};exports['destroy']=function(_0x3d4395,_0x54f72b){return db[_0x6a7e('0x3d')][_0x6a7e('0x44')]({'where':{'id':_0x3d4395['params']['id']}})['then'](handleEntityNotFound(_0x54f72b,null))[_0x6a7e('0x26')](removeEntity(_0x54f72b,null))[_0x6a7e('0x40')](handleError(_0x54f72b,null));};exports[_0x6a7e('0x47')]=function(_0x251076,_0x43f5ac){return db['JscriptyAnswerReport'][_0x6a7e('0x47')]()[_0x6a7e('0x26')](respondWithResult(_0x43f5ac,null))[_0x6a7e('0x40')](handleError(_0x43f5ac,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index c0d9e3c..7d01035 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 _0x4e3c=['JscriptyAnswerReport','report_jscripty_answers','api','moment','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x4e3c,0x112));var _0xc4e3=function(_0x1caf3f,_0x1b4800){_0x1caf3f=_0x1caf3f-0x0;var _0x1905f0=_0x4e3c[_0x1caf3f];return _0x1905f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc4e3('0x0'));var moment=require(_0xc4e3('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc4e3('0x2'));var attributes=require(_0xc4e3('0x3'));module[_0xc4e3('0x4')]=function(_0xb8af41,_0x20e7f7){return _0xb8af41[_0xc4e3('0x5')](_0xc4e3('0x6'),attributes,{'tableName':_0xc4e3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff38=['./jscriptyAnswerReport.attributes','define','report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x261d9e,_0x4f0942){var _0x3f8a2c=function(_0x28aaf8){while(--_0x28aaf8){_0x261d9e['push'](_0x261d9e['shift']());}};_0x3f8a2c(++_0x4f0942);}(_0xff38,0x189));var _0x8ff3=function(_0x64e1a1,_0x207df3){_0x64e1a1=_0x64e1a1-0x0;var _0xcb1b7e=_0xff38[_0x64e1a1];return _0xcb1b7e;};'use strict';var _=require(_0x8ff3('0x0'));var util=require(_0x8ff3('0x1'));var logger=require(_0x8ff3('0x2'))('api');var moment=require(_0x8ff3('0x3'));var BPromise=require('bluebird');var rp=require(_0x8ff3('0x4'));var fs=require('fs');var path=require(_0x8ff3('0x5'));var rimraf=require(_0x8ff3('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ff3('0x7'));module['exports']=function(_0x5b20b4,_0x30b17e){return _0x5b20b4[_0x8ff3('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0x8ff3('0x9'),'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 0c130f5..c96c95f 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 _0xd4ae=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b05e4,_0x26e478){var _0x463942=function(_0x4892b5){while(--_0x4892b5){_0x5b05e4['push'](_0x5b05e4['shift']());}};_0x463942(++_0x26e478);}(_0xd4ae,0x90));var _0xed4a=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xd4ae[_0x349367];return _0x14179b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed4a('0x0'));var BPromise=require(_0xed4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed4a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xed4a('0x3'));var logger=require(_0xed4a('0x4'))(_0xed4a('0x5'));var config=require(_0xed4a('0x6'));var jayson=require(_0xed4a('0x7'));var client=jayson[_0xed4a('0x8')][_0xed4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42fc7d,_0x51fa3a,_0x10d5fd){return new BPromise(function(_0x48410c,_0x3ef449){return client[_0xed4a('0xa')](_0x42fc7d,_0x10d5fd)[_0xed4a('0xb')](function(_0x53c520){logger[_0xed4a('0xc')](_0xed4a('0xd'),_0x51fa3a,'request\x20sent');logger[_0xed4a('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x51fa3a,_0xed4a('0xf'),JSON[_0xed4a('0x10')](_0x53c520));if(_0x53c520[_0xed4a('0x11')]){if(_0x53c520[_0xed4a('0x11')][_0xed4a('0x12')]===0x1f4){logger['error'](_0xed4a('0xd'),_0x51fa3a,_0x53c520[_0xed4a('0x11')][_0xed4a('0x13')]);return _0x3ef449(_0x53c520['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x51fa3a,_0x53c520[_0xed4a('0x11')][_0xed4a('0x13')]);return _0x48410c(_0x53c520[_0xed4a('0x11')]['message']);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x51fa3a,_0xed4a('0xf'));_0x48410c(_0x53c520[_0xed4a('0x14')][_0xed4a('0x13')]);}})[_0xed4a('0x15')](function(_0x580f5b){logger['error'](_0xed4a('0xd'),_0x51fa3a,_0x580f5b);_0x3ef449(_0x580f5b);});});} \ No newline at end of file +var _0x9d3b=['../../config/environment','jayson/promise','http','request','info','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0x9d3b,0x86));var _0xb9d3=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x9d3b[_0x202d24];return _0x2b3a8e;};'use strict';var _=require(_0xb9d3('0x0'));var util=require(_0xb9d3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9d3('0x2'));var db=require(_0xb9d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9d3('0x4'))(_0xb9d3('0x5'));var config=require(_0xb9d3('0x6'));var jayson=require(_0xb9d3('0x7'));var client=jayson['client'][_0xb9d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45776f,_0x377aea,_0x192f97){return new BPromise(function(_0x168fcf,_0x41dccf){return client[_0xb9d3('0x9')](_0x45776f,_0x192f97)['then'](function(_0x49ea9b){logger[_0xb9d3('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x377aea,_0xb9d3('0xb'));logger['debug'](_0xb9d3('0xc'),_0x377aea,_0xb9d3('0xb'),JSON[_0xb9d3('0xd')](_0x49ea9b));if(_0x49ea9b['error']){if(_0x49ea9b[_0xb9d3('0xe')][_0xb9d3('0xf')]===0x1f4){logger[_0xb9d3('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x377aea,_0x49ea9b[_0xb9d3('0xe')]['message']);return _0x41dccf(_0x49ea9b[_0xb9d3('0xe')][_0xb9d3('0x10')]);}logger['error'](_0xb9d3('0x11'),_0x377aea,_0x49ea9b[_0xb9d3('0xe')][_0xb9d3('0x10')]);return _0x168fcf(_0x49ea9b[_0xb9d3('0xe')][_0xb9d3('0x10')]);}else{logger[_0xb9d3('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x377aea,_0xb9d3('0xb'));_0x168fcf(_0x49ea9b[_0xb9d3('0x12')][_0xb9d3('0x10')]);}})[_0xb9d3('0x13')](function(_0x307b99){logger[_0xb9d3('0xe')](_0xb9d3('0x11'),_0x377aea,_0x307b99);_0x41dccf(_0x307b99);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 71af311..1300c22 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 _0xa068=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','update'];(function(_0x92761d,_0xf63614){var _0x460dc5=function(_0x16a6fb){while(--_0x16a6fb){_0x92761d['push'](_0x92761d['shift']());}};_0x460dc5(++_0xf63614);}(_0xa068,0x189));var _0x8a06=function(_0x310e6a,_0x560852){_0x310e6a=_0x310e6a-0x0;var _0x52d780=_0xa068[_0x310e6a];return _0x52d780;};'use strict';var multer=require(_0x8a06('0x0'));var util=require(_0x8a06('0x1'));var path=require('path');var timeout=require(_0x8a06('0x2'));var express=require(_0x8a06('0x3'));var router=express[_0x8a06('0x4')]();var fs_extra=require(_0x8a06('0x5'));var auth=require(_0x8a06('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8a06('0x7'));var controller=require('./jscriptyProject.controller');router[_0x8a06('0x8')]('/',auth[_0x8a06('0x9')](),controller[_0x8a06('0xa')]);router[_0x8a06('0x8')](_0x8a06('0xb'),auth[_0x8a06('0x9')](),controller[_0x8a06('0xc')]);router[_0x8a06('0x8')]('/:id/sessions',auth[_0x8a06('0x9')](),controller[_0x8a06('0xd')]);router[_0x8a06('0x8')](_0x8a06('0xe'),auth[_0x8a06('0x9')](),controller[_0x8a06('0xf')]);router['get'](_0x8a06('0x10'),auth[_0x8a06('0x9')](),timeout(_0x8a06('0x11')),controller[_0x8a06('0x12')]);router[_0x8a06('0x13')]('/',auth[_0x8a06('0x9')](),controller[_0x8a06('0x14')]);router['post'](_0x8a06('0x15'),auth[_0x8a06('0x9')](),controller['clone']);router['put'](_0x8a06('0xb'),auth[_0x8a06('0x9')](),controller[_0x8a06('0x16')]);router[_0x8a06('0x17')]('/:id',auth[_0x8a06('0x9')](),controller[_0x8a06('0x18')]);module[_0x8a06('0x19')]=router; \ No newline at end of file +var _0xdf26=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','exports','util','connect-timeout'];(function(_0x1ab8d4,_0x2c88cc){var _0x2c4e44=function(_0x3e359f){while(--_0x3e359f){_0x1ab8d4['push'](_0x1ab8d4['shift']());}};_0x2c4e44(++_0x2c88cc);}(_0xdf26,0xf1));var _0x6df2=function(_0x210200,_0x150b2e){_0x210200=_0x210200-0x0;var _0x52e0e5=_0xdf26[_0x210200];return _0x52e0e5;};'use strict';var multer=require('multer');var util=require(_0x6df2('0x0'));var path=require('path');var timeout=require(_0x6df2('0x1'));var express=require(_0x6df2('0x2'));var router=express[_0x6df2('0x3')]();var fs_extra=require(_0x6df2('0x4'));var auth=require(_0x6df2('0x5'));var interaction=require(_0x6df2('0x6'));var config=require(_0x6df2('0x7'));var controller=require(_0x6df2('0x8'));router[_0x6df2('0x9')]('/',auth[_0x6df2('0xa')](),controller['index']);router[_0x6df2('0x9')](_0x6df2('0xb'),auth[_0x6df2('0xa')](),controller[_0x6df2('0xc')]);router[_0x6df2('0x9')](_0x6df2('0xd'),auth['isAuthenticated'](),controller[_0x6df2('0xe')]);router[_0x6df2('0x9')](_0x6df2('0xf'),auth[_0x6df2('0xa')](),controller[_0x6df2('0x10')]);router[_0x6df2('0x9')](_0x6df2('0x11'),auth[_0x6df2('0xa')](),timeout(_0x6df2('0x12')),controller[_0x6df2('0x13')]);router[_0x6df2('0x14')]('/',auth['isAuthenticated'](),controller[_0x6df2('0x15')]);router[_0x6df2('0x14')](_0x6df2('0x16'),auth['isAuthenticated'](),controller[_0x6df2('0x17')]);router['put'](_0x6df2('0xb'),auth[_0x6df2('0xa')](),controller[_0x6df2('0x18')]);router[_0x6df2('0x19')]('/:id',auth[_0x6df2('0xa')](),controller['destroy']);module[_0x6df2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 911e1fc..7d80e8b 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 _0xc11e=['long','isObjectLike','setDataValue','formData','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','exports','STRING'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0xc11e,0x110));var _0xec11=function(_0x50d16c,_0x5a452f){_0x50d16c=_0x50d16c-0x0;var _0x19bf9c=_0xc11e[_0x50d16c];return _0x19bf9c;};'use strict';var Sequelize=require(_0xec11('0x0'));var _=require('lodash');var util=require('util');module[_0xec11('0x1')]={'name':{'type':Sequelize[_0xec11('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xec11('0x2')]},'formData':{'type':Sequelize['TEXT'](_0xec11('0x3')),'set':function(_0x226a4d){if(_[_0xec11('0x4')](_0x226a4d)){this[_0xec11('0x5')](_0xec11('0x6'),JSON['stringify'](_0x226a4d));}else if(_[_0xec11('0x7')](_0x226a4d)){this[_0xec11('0x5')](_0xec11('0x6'),_0x226a4d);}else{this[_0xec11('0x5')](_0xec11('0x6'),util['format'](_0xec11('0x8'),this[_0xec11('0x9')]('name')||'',this['getDataValue'](_0xec11('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3e81=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','formData','stringify','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0xca48b5,_0x546b5a){var _0xc5390f=function(_0x40a1b7){while(--_0x40a1b7){_0xca48b5['push'](_0xca48b5['shift']());}};_0xc5390f(++_0x546b5a);}(_0x3e81,0x1d2));var _0x13e8=function(_0x3abf9a,_0x3d71df){_0x3abf9a=_0x3abf9a-0x0;var _0x1de11b=_0x3e81[_0x3abf9a];return _0x1de11b;};'use strict';var Sequelize=require(_0x13e8('0x0'));var _=require(_0x13e8('0x1'));var util=require(_0x13e8('0x2'));module[_0x13e8('0x3')]={'name':{'type':Sequelize[_0x13e8('0x4')],'unique':_0x13e8('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x13e8('0x6')](_0x13e8('0x7')),'set':function(_0x381c0c){if(_['isObjectLike'](_0x381c0c)){this['setDataValue'](_0x13e8('0x8'),JSON[_0x13e8('0x9')](_0x381c0c));}else if(_['isString'](_0x381c0c)){this[_0x13e8('0xa')](_0x13e8('0x8'),_0x381c0c);}else{this[_0x13e8('0xa')]('formData',util[_0x13e8('0xb')](_0x13e8('0xc'),this[_0x13e8('0xd')]('name')||'',this[_0x13e8('0xd')](_0x13e8('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x13e8('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x13e8('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 8996f07..5934b93 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 _0xb0d4=['text/csv','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','Projects','UserProfileResource','destroy','stack','name','index','JscriptyProject','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','merge','omit','createdAt','updatedAt','autoAssociation','error','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type'];(function(_0x49b48a,_0x22b01f){var _0x738495=function(_0x189c8f){while(--_0x189c8f){_0x49b48a['push'](_0x49b48a['shift']());}};_0x738495(++_0x22b01f);}(_0xb0d4,0x1e1));var _0x4b0d=function(_0x3599f0,_0x3000e0){_0x3599f0=_0x3599f0-0x0;var _0xa9a4f5=_0xb0d4[_0x3599f0];return _0xa9a4f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4b0d('0x0'));var jsonpatch=require(_0x4b0d('0x1'));var rp=require(_0x4b0d('0x2'));var moment=require(_0x4b0d('0x3'));var BPromise=require(_0x4b0d('0x4'));var Mustache=require(_0x4b0d('0x5'));var util=require(_0x4b0d('0x6'));var path=require('path');var sox=require(_0x4b0d('0x7'));var csv=require(_0x4b0d('0x8'));var ejs=require(_0x4b0d('0x9'));var fs=require('fs');var fs_extra=require(_0x4b0d('0xa'));var _=require(_0x4b0d('0xb'));var squel=require(_0x4b0d('0xc'));var crypto=require(_0x4b0d('0xd'));var jsforce=require(_0x4b0d('0xe'));var deskjs=require(_0x4b0d('0xf'));var toCsv=require(_0x4b0d('0x8'));var querystring=require('querystring');var Papa=require(_0x4b0d('0x10'));var Redis=require('ioredis');var authService=require(_0x4b0d('0x11'));var qs=require(_0x4b0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b0d('0x13'));var logger=require(_0x4b0d('0x14'))('api');var utils=require(_0x4b0d('0x15'));var config=require(_0x4b0d('0x16'));var licenseUtil=require(_0x4b0d('0x17'));var db=require(_0x4b0d('0x18'))['db'];function respondWithStatusCode(_0x3fd0be,_0x3f8efb){_0x3f8efb=_0x3f8efb||0xcc;return function(_0x5990b8){if(_0x5990b8){return _0x3fd0be[_0x4b0d('0x19')](_0x3f8efb);}return _0x3fd0be[_0x4b0d('0x1a')](_0x3f8efb)['end']();};}function respondWithResult(_0x377a08,_0x3865ed){_0x3865ed=_0x3865ed||0xc8;return function(_0x1919a3){if(_0x1919a3){return _0x377a08[_0x4b0d('0x1a')](_0x3865ed)[_0x4b0d('0x1b')](_0x1919a3);}};}function respondWithFilteredResult(_0x526700,_0x494844){return function(_0x4b008b){if(_0x4b008b){var _0x2aec2f=typeof _0x494844['offset']===_0x4b0d('0x1c')&&typeof _0x494844[_0x4b0d('0x1d')]===_0x4b0d('0x1c');var _0x50a0b2=_0x4b008b['count'];var _0x3f14c9=_0x2aec2f?0x0:_0x494844[_0x4b0d('0x1e')];var _0x4aa1df=_0x2aec2f?_0x4b008b[_0x4b0d('0x1f')]:_0x494844['offset']+_0x494844[_0x4b0d('0x1d')];var _0x140f13;if(_0x4aa1df>=_0x50a0b2){_0x4aa1df=_0x50a0b2;_0x140f13=0xc8;}else{_0x140f13=0xce;}_0x526700[_0x4b0d('0x1a')](_0x140f13);return _0x526700[_0x4b0d('0x20')](_0x4b0d('0x21'),_0x3f14c9+'-'+_0x4aa1df+'/'+_0x50a0b2)[_0x4b0d('0x1b')](_0x4b008b);}return null;};}function patchUpdates(_0x227c25){return function(_0x369072){try{jsonpatch[_0x4b0d('0x22')](_0x369072,_0x227c25,!![]);}catch(_0x3b2786){return BPromise[_0x4b0d('0x23')](_0x3b2786);}return _0x369072[_0x4b0d('0x24')]();};}function saveUpdates(_0x5b3a8a,_0x515c1b){return function(_0x48e28b){if(_0x48e28b){return _0x48e28b[_0x4b0d('0x25')](_0x5b3a8a)[_0x4b0d('0x26')](function(_0x301ca5){return _0x301ca5;});}return null;};}function removeEntity(_0x2be178,_0x3ccc22){return function(_0x57d1be){if(_0x57d1be){return _0x57d1be['destroy']()[_0x4b0d('0x26')](function(){var _0x13008b=_0x57d1be['get']({'plain':!![]});var _0x227e5e=_0x4b0d('0x27');return db[_0x4b0d('0x28')][_0x4b0d('0x29')]({'where':{'type':_0x227e5e,'resourceId':_0x13008b['id']}})['then'](function(){return _0x57d1be;});})[_0x4b0d('0x26')](function(){_0x2be178[_0x4b0d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8ffc,_0x421f50){return function(_0x15def5){if(!_0x15def5){_0x3a8ffc[_0x4b0d('0x19')](0x194);}return _0x15def5;};}function handleError(_0x248f16,_0x65d675){_0x65d675=_0x65d675||0x1f4;return function(_0x1a4ca4){logger['error'](_0x1a4ca4[_0x4b0d('0x2a')]);if(_0x1a4ca4['name']){delete _0x1a4ca4[_0x4b0d('0x2b')];}_0x248f16[_0x4b0d('0x1a')](_0x65d675)['send'](_0x1a4ca4);};}exports[_0x4b0d('0x2c')]=function(_0x5d3c0d,_0x27f657){var _0x1de93e={},_0x33d94b={},_0x1356d7={'count':0x0,'rows':[]};var _0x1074f4=_['map'](db[_0x4b0d('0x2d')][_0x4b0d('0x2e')],function(_0x319956){return{'name':_0x319956[_0x4b0d('0x2f')],'type':_0x319956[_0x4b0d('0x30')][_0x4b0d('0x31')]};});_0x33d94b['model']=_[_0x4b0d('0x32')](_0x1074f4,_0x4b0d('0x2b'));_0x33d94b[_0x4b0d('0x33')]=_['keys'](_0x5d3c0d[_0x4b0d('0x33')]);_0x33d94b[_0x4b0d('0x34')]=_['intersection'](_0x33d94b[_0x4b0d('0x35')],_0x33d94b[_0x4b0d('0x33')]);_0x1de93e[_0x4b0d('0x36')]=_[_0x4b0d('0x37')](_0x33d94b['model'],qs[_0x4b0d('0x38')](_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x38')]));_0x1de93e['attributes']=_0x1de93e[_0x4b0d('0x36')]['length']?_0x1de93e[_0x4b0d('0x36')]:_0x33d94b[_0x4b0d('0x35')];if(!_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x39')](_0x4b0d('0x3a'))){_0x1de93e['limit']=qs[_0x4b0d('0x1d')](_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x1d')]);_0x1de93e[_0x4b0d('0x1e')]=qs[_0x4b0d('0x1e')](_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x1e')]);}_0x1de93e[_0x4b0d('0x3b')]=qs[_0x4b0d('0x3c')](_0x5d3c0d[_0x4b0d('0x33')]['sort']);_0x1de93e[_0x4b0d('0x3d')]=qs[_0x4b0d('0x34')](_[_0x4b0d('0x3e')](_0x5d3c0d['query'],_0x33d94b[_0x4b0d('0x34')]),_0x1074f4);if(_0x5d3c0d['query'][_0x4b0d('0x3f')]){_0x1de93e[_0x4b0d('0x3d')]=_['merge'](_0x1de93e[_0x4b0d('0x3d')],{'$or':_['map'](_0x1074f4,function(_0x9c962){if(_0x9c962['type']!=='VIRTUAL'){var _0x2bffae={};_0x2bffae[_0x9c962[_0x4b0d('0x2b')]]={'$like':'%'+_0x5d3c0d[_0x4b0d('0x33')]['filter']+'%'};return _0x2bffae;}})});}_0x1de93e=_['merge']({},_0x1de93e,_0x5d3c0d[_0x4b0d('0x40')]);var _0x160878={'where':_0x1de93e[_0x4b0d('0x3d')]};return db[_0x4b0d('0x2d')]['count'](_0x160878)['then'](function(_0x2548a8){_0x1356d7[_0x4b0d('0x1f')]=_0x2548a8;if(_0x5d3c0d[_0x4b0d('0x33')][_0x4b0d('0x41')]){_0x1de93e[_0x4b0d('0x42')]=[{'all':!![]}];}return db[_0x4b0d('0x2d')][_0x4b0d('0x43')](_0x1de93e);})[_0x4b0d('0x26')](function(_0x26942e){_0x1356d7[_0x4b0d('0x44')]=_0x26942e;return _0x1356d7;})['then'](respondWithFilteredResult(_0x27f657,_0x1de93e))['catch'](handleError(_0x27f657,null));};exports[_0x4b0d('0x45')]=function(_0x2d1f5a,_0x2dc08f){var _0x4440ec={'raw':![],'where':{'id':_0x2d1f5a[_0x4b0d('0x46')]['id']}},_0x1e7221={};_0x1e7221['model']=_['keys'](db[_0x4b0d('0x2d')][_0x4b0d('0x2e')]);_0x1e7221['query']=_[_0x4b0d('0x47')](_0x2d1f5a[_0x4b0d('0x33')]);_0x1e7221[_0x4b0d('0x34')]=_[_0x4b0d('0x37')](_0x1e7221[_0x4b0d('0x35')],_0x1e7221[_0x4b0d('0x33')]);_0x4440ec[_0x4b0d('0x36')]=_[_0x4b0d('0x37')](_0x1e7221[_0x4b0d('0x35')],qs[_0x4b0d('0x38')](_0x2d1f5a[_0x4b0d('0x33')][_0x4b0d('0x38')]));_0x4440ec[_0x4b0d('0x36')]=_0x4440ec[_0x4b0d('0x36')][_0x4b0d('0x48')]?_0x4440ec[_0x4b0d('0x36')]:_0x1e7221[_0x4b0d('0x35')];if(_0x2d1f5a['query']['includeAll']){_0x4440ec[_0x4b0d('0x42')]=[{'all':!![]}];}_0x4440ec=_['merge']({},_0x4440ec,_0x2d1f5a[_0x4b0d('0x40')]);return db[_0x4b0d('0x2d')][_0x4b0d('0x49')](_0x4440ec)['then'](handleEntityNotFound(_0x2dc08f,null))[_0x4b0d('0x26')](respondWithResult(_0x2dc08f,null))[_0x4b0d('0x4a')](handleError(_0x2dc08f,null));};exports[_0x4b0d('0x4b')]=function(_0x30757a,_0x148380){return db[_0x4b0d('0x2d')][_0x4b0d('0x4b')](_0x30757a[_0x4b0d('0x4c')],{})[_0x4b0d('0x26')](function(_0x209af1){var _0x1a84d2=_0x30757a[_0x4b0d('0x4d')][_0x4b0d('0x4e')]({'plain':!![]});if(!_0x1a84d2)throw new Error(_0x4b0d('0x4f'));if(_0x1a84d2[_0x4b0d('0x50')]==='user'){var _0x7ffa4a=_0x209af1[_0x4b0d('0x4e')]({'plain':!![]});var _0x41b2f6=_0x4b0d('0x27');return db[_0x4b0d('0x51')][_0x4b0d('0x49')]({'where':{'name':_0x41b2f6,'userProfileId':_0x1a84d2[_0x4b0d('0x52')]},'raw':!![]})[_0x4b0d('0x26')](function(_0x2443ad){if(_0x2443ad&&_0x2443ad['autoAssociation']===0x0){return db[_0x4b0d('0x28')]['create']({'name':_0x7ffa4a['name'],'resourceId':_0x7ffa4a['id'],'type':_0x2443ad[_0x4b0d('0x2b')],'sectionId':_0x2443ad['id']},{})[_0x4b0d('0x26')](function(){return _0x209af1;});}else{return _0x209af1;}})[_0x4b0d('0x4a')](function(_0x54df1e){logger['error'](_0x4b0d('0x53'),_0x54df1e);throw _0x54df1e;});}return _0x209af1;})[_0x4b0d('0x26')](respondWithResult(_0x148380,0xc9))[_0x4b0d('0x4a')](handleError(_0x148380,null));};exports['clone']=function(_0x2d40bc,_0x5427e6){var _0x4044e4={'where':{'id':_0x2d40bc[_0x4b0d('0x46')]['id']}},_0x40a9f1={};_0x40a9f1[_0x4b0d('0x35')]=_['keys'](db['JscriptyProject'][_0x4b0d('0x2e')]);_0x4044e4[_0x4b0d('0x36')]=_[_0x4b0d('0x37')](_0x40a9f1[_0x4b0d('0x35')],qs[_0x4b0d('0x38')](_0x2d40bc[_0x4b0d('0x33')][_0x4b0d('0x38')]));_0x4044e4[_0x4b0d('0x36')]=_0x4044e4[_0x4b0d('0x36')]['length']?_0x4044e4[_0x4b0d('0x36')]:_0x40a9f1[_0x4b0d('0x35')];if(_0x2d40bc['query'][_0x4b0d('0x41')]){_0x4044e4[_0x4b0d('0x42')]=[{'all':!![]}];}_0x4044e4=_[_0x4b0d('0x54')]({},_0x4044e4,_0x2d40bc['options']);return db['JscriptyProject'][_0x4b0d('0x49')](_0x4044e4)[_0x4b0d('0x26')](handleEntityNotFound(_0x5427e6,null))['then'](function(_0x42e0c8){if(_0x42e0c8){var _0x14bb49=_0x42e0c8[_0x4b0d('0x4e')]({'plain':!![]});_0x14bb49=qs[_0x4b0d('0x55')](_0x14bb49,['id',_0x4b0d('0x56'),_0x4b0d('0x57')]);_0x2d40bc[_0x4b0d('0x4c')]=_[_0x4b0d('0x55')](_0x2d40bc[_0x4b0d('0x4c')],['id','createdAt','updatedAt']);return db[_0x4b0d('0x2d')][_0x4b0d('0x4b')](_[_0x4b0d('0x54')](_0x14bb49,_0x2d40bc[_0x4b0d('0x4c')]),{'include':_0x2d40bc[_0x4b0d('0x33')][_0x4b0d('0x41')]?[{'all':!![]}]:undefined})[_0x4b0d('0x26')](function(_0x89f177){var _0x16fb50=_0x2d40bc[_0x4b0d('0x4d')][_0x4b0d('0x4e')]({'plain':!![]});if(!_0x16fb50)throw new Error(_0x4b0d('0x4f'));if(_0x16fb50[_0x4b0d('0x50')]==='user'){var _0x251161=_0x89f177[_0x4b0d('0x4e')]({'plain':!![]});var _0x35c09d=_0x4b0d('0x27');return db[_0x4b0d('0x51')]['find']({'where':{'name':_0x35c09d,'userProfileId':_0x16fb50[_0x4b0d('0x52')]},'raw':!![]})[_0x4b0d('0x26')](function(_0x32a7de){if(_0x32a7de&&_0x32a7de[_0x4b0d('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x251161['name'],'resourceId':_0x251161['id'],'type':_0x32a7de[_0x4b0d('0x2b')],'sectionId':_0x32a7de['id']},{})['then'](function(){return _0x89f177;});}else{return _0x89f177;}})[_0x4b0d('0x4a')](function(_0x358ad7){logger[_0x4b0d('0x59')](_0x4b0d('0x53'),_0x358ad7);throw _0x358ad7;});}return _0x89f177;});}})[_0x4b0d('0x26')](respondWithResult(_0x5427e6,0xc9))[_0x4b0d('0x4a')](handleError(_0x5427e6,null));};exports[_0x4b0d('0x25')]=function(_0x3d1dbe,_0x424046){if(_0x3d1dbe[_0x4b0d('0x4c')]['id']){delete _0x3d1dbe[_0x4b0d('0x4c')]['id'];}return db[_0x4b0d('0x2d')][_0x4b0d('0x49')]({'where':{'id':_0x3d1dbe[_0x4b0d('0x46')]['id']}})[_0x4b0d('0x26')](handleEntityNotFound(_0x424046,null))[_0x4b0d('0x26')](saveUpdates(_0x3d1dbe[_0x4b0d('0x4c')],null))['then'](respondWithResult(_0x424046,null))[_0x4b0d('0x4a')](handleError(_0x424046,null));};exports[_0x4b0d('0x29')]=function(_0xf748a7,_0x36a955){return db[_0x4b0d('0x2d')][_0x4b0d('0x49')]({'where':{'id':_0xf748a7['params']['id']}})[_0x4b0d('0x26')](handleEntityNotFound(_0x36a955,null))[_0x4b0d('0x26')](removeEntity(_0x36a955,null))[_0x4b0d('0x4a')](handleError(_0x36a955,null));};exports[_0x4b0d('0x5a')]=function(_0x4a82e2,_0x10b7e6,_0x5bd277){var _0x2c894a={'raw':!![],'where':{}};var _0x227c1e={};var _0x510c5f={'count':0x0,'rows':[]};return db[_0x4b0d('0x2d')][_0x4b0d('0x5b')]({'where':{'id':_0x4a82e2[_0x4b0d('0x46')]['id']}})[_0x4b0d('0x26')](handleEntityNotFound(_0x10b7e6,null))[_0x4b0d('0x26')](function(_0x350d02){if(_0x350d02){_0x227c1e[_0x4b0d('0x35')]=_[_0x4b0d('0x47')](db['JscriptySessionReport'][_0x4b0d('0x2e')]);_0x227c1e['query']=_[_0x4b0d('0x47')](_0x4a82e2[_0x4b0d('0x33')]);_0x227c1e['filters']=_['intersection'](_0x227c1e[_0x4b0d('0x35')],_0x227c1e['query']);_0x2c894a[_0x4b0d('0x36')]=_['intersection'](_0x227c1e[_0x4b0d('0x35')],qs['fields'](_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x38')]));_0x2c894a[_0x4b0d('0x36')]=_0x2c894a[_0x4b0d('0x36')][_0x4b0d('0x48')]?_0x2c894a['attributes']:_0x227c1e[_0x4b0d('0x35')];if(!_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x39')](_0x4b0d('0x3a'))){_0x2c894a['limit']=qs[_0x4b0d('0x1d')](_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x1d')]);_0x2c894a[_0x4b0d('0x1e')]=qs[_0x4b0d('0x1e')](_0x4a82e2['query'][_0x4b0d('0x1e')]);}_0x2c894a[_0x4b0d('0x3b')]=qs[_0x4b0d('0x3c')](_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x3c')]);_0x2c894a['where']=qs[_0x4b0d('0x34')](_[_0x4b0d('0x3e')](_0x4a82e2[_0x4b0d('0x33')],_0x227c1e[_0x4b0d('0x34')]));_0x2c894a['where']['ProjectId']=_0x350d02['id'];if(_0x4a82e2[_0x4b0d('0x33')][_0x4b0d('0x3f')]){_0x2c894a[_0x4b0d('0x3d')]=_[_0x4b0d('0x54')](_0x2c894a['where'],{'$or':_[_0x4b0d('0x32')](_0x2c894a[_0x4b0d('0x36')],function(_0x5b09c5){var _0x5d3a6e={};_0x5d3a6e[_0x5b09c5]={'$like':'%'+_0x4a82e2[_0x4b0d('0x33')]['filter']+'%'};return _0x5d3a6e;})});}_0x2c894a=_['merge']({},_0x2c894a,_0x4a82e2['options']);return db[_0x4b0d('0x5c')][_0x4b0d('0x1f')]({'where':_0x2c894a[_0x4b0d('0x3d')]})[_0x4b0d('0x26')](function(_0x14e0d7){_0x510c5f[_0x4b0d('0x1f')]=_0x14e0d7;if(_0x4a82e2[_0x4b0d('0x33')]['includeAll']){_0x2c894a[_0x4b0d('0x42')]=[{'all':!![]}];}return db[_0x4b0d('0x5c')][_0x4b0d('0x43')](_0x2c894a);})[_0x4b0d('0x26')](function(_0x4451d9){_0x510c5f[_0x4b0d('0x44')]=_0x4451d9;return _0x510c5f;});}})[_0x4b0d('0x26')](respondWithFilteredResult(_0x10b7e6,_0x2c894a))[_0x4b0d('0x4a')](handleError(_0x10b7e6,null));};exports[_0x4b0d('0x5d')]=function(_0x265354,_0x321d00,_0x3dbc65){var _0x2d3bac={'raw':!![],'where':{}};var _0x5bd6b9={};var _0x486660={'count':0x0,'rows':[]};return db[_0x4b0d('0x2d')][_0x4b0d('0x5b')]({'where':{'id':_0x265354[_0x4b0d('0x46')]['id']}})['then'](handleEntityNotFound(_0x321d00,null))[_0x4b0d('0x26')](function(_0x52058d){if(_0x52058d){_0x5bd6b9['model']=_['keys'](db[_0x4b0d('0x5e')][_0x4b0d('0x2e')]);_0x5bd6b9['query']=_[_0x4b0d('0x47')](_0x265354[_0x4b0d('0x33')]);_0x5bd6b9[_0x4b0d('0x34')]=_[_0x4b0d('0x37')](_0x5bd6b9[_0x4b0d('0x35')],_0x5bd6b9[_0x4b0d('0x33')]);_0x2d3bac['attributes']=_['intersection'](_0x5bd6b9[_0x4b0d('0x35')],qs[_0x4b0d('0x38')](_0x265354['query'][_0x4b0d('0x38')]));_0x2d3bac[_0x4b0d('0x36')]=_0x2d3bac['attributes']['length']?_0x2d3bac[_0x4b0d('0x36')]:_0x5bd6b9[_0x4b0d('0x35')];if(!_0x265354[_0x4b0d('0x33')]['hasOwnProperty'](_0x4b0d('0x3a'))){_0x2d3bac[_0x4b0d('0x1d')]=qs[_0x4b0d('0x1d')](_0x265354[_0x4b0d('0x33')]['limit']);_0x2d3bac['offset']=qs['offset'](_0x265354['query'][_0x4b0d('0x1e')]);}_0x2d3bac[_0x4b0d('0x3b')]=qs[_0x4b0d('0x3c')](_0x265354['query'][_0x4b0d('0x3c')]);_0x2d3bac[_0x4b0d('0x3d')]=qs[_0x4b0d('0x34')](_[_0x4b0d('0x3e')](_0x265354['query'],_0x5bd6b9['filters']));_0x2d3bac['where'][_0x4b0d('0x5f')]=_0x52058d['id'];if(_0x265354[_0x4b0d('0x33')][_0x4b0d('0x3f')]){_0x2d3bac[_0x4b0d('0x3d')]=_[_0x4b0d('0x54')](_0x2d3bac[_0x4b0d('0x3d')],{'$or':_[_0x4b0d('0x32')](_0x2d3bac[_0x4b0d('0x36')],function(_0x294f00){var _0x31bad8={};_0x31bad8[_0x294f00]={'$like':'%'+_0x265354[_0x4b0d('0x33')][_0x4b0d('0x3f')]+'%'};return _0x31bad8;})});}_0x2d3bac=_['merge']({},_0x2d3bac,_0x265354['options']);return db[_0x4b0d('0x5e')][_0x4b0d('0x1f')]({'where':_0x2d3bac[_0x4b0d('0x3d')]})[_0x4b0d('0x26')](function(_0x5e0291){_0x486660[_0x4b0d('0x1f')]=_0x5e0291;if(_0x265354[_0x4b0d('0x33')]['includeAll']){_0x2d3bac[_0x4b0d('0x42')]=[{'all':!![]}];}return db[_0x4b0d('0x5e')]['findAll'](_0x2d3bac);})['then'](function(_0x47a27b){_0x486660['rows']=_0x47a27b;return _0x486660;});}})[_0x4b0d('0x26')](respondWithFilteredResult(_0x321d00,_0x2d3bac))[_0x4b0d('0x4a')](handleError(_0x321d00,null));};function char(_0x3382cc){return _0x4b0d('0x60')===typeof _0x3382cc?String['fromCharCode']['apply'](null,arguments):_0x3382cc;}function needsEncapsulation(_0x492a73){return!!_0x492a73&&(_0x492a73['toString']()['indexOf'](char(0xd))>=0x0||_0x492a73['toString']()[_0x4b0d('0x61')](char(0xa))>=0x0||_0x492a73[_0x4b0d('0x62')]()[_0x4b0d('0x61')](char(0x2c))>=0x0||_0x492a73[_0x4b0d('0x62')]()[_0x4b0d('0x61')](char(0x22))>=0x0);}function encapsulate(_0x501023){var _0x2b5ba5=char(0x22),_0x24b09d='\x5c'+char(0x22),_0x4dbf80=_0x501023[_0x4b0d('0x62')]()[_0x4b0d('0x63')](new RegExp(_0x2b5ba5,'g'),_0x24b09d);return _0x2b5ba5+_0x4dbf80+_0x2b5ba5;}exports[_0x4b0d('0x64')]=function(_0x3c2784,_0x56942b,_0x1e8002){var _0x1732d2,_0xa42db0;var _0x259a0d={'where':{'ProjectId':_0x3c2784[_0x4b0d('0x46')]['id']}};if(_0x3c2784[_0x4b0d('0x33')][_0x4b0d('0x65')]){_0x259a0d[_0x4b0d('0x3d')][_0x4b0d('0x66')]=JSON[_0x4b0d('0x67')](_0x3c2784[_0x4b0d('0x33')][_0x4b0d('0x65')]);}return db[_0x4b0d('0x5c')][_0x4b0d('0x43')](_0x259a0d)['then'](handleEntityNotFound(_0x56942b,null))[_0x4b0d('0x26')](function(_0x2cc436){if(_0x2cc436){_0x1732d2=_0x2cc436;return db[_0x4b0d('0x68')]['findAll']({'where':{'SessionId':{'$in':_[_0x4b0d('0x32')](_0x1732d2,'id')},'ProjectId':_0x3c2784['params']['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x56942b,null))[_0x4b0d('0x26')](function(_0x568ddd){if(_0x568ddd){_0xa42db0=_0x568ddd;var _0x20d9c9={};for(var _0x58c034=0x0,_0x567f5c=_0xa42db0['length'];_0x58c034<_0x567f5c;_0x58c034++){if(!_0x20d9c9['hasOwnProperty'](_0xa42db0[_0x58c034]['questionId'])){_0x20d9c9[_0xa42db0[_0x58c034]['questionId']]=needsEncapsulation(_0xa42db0[_0x58c034][_0x4b0d('0x69')])?encapsulate(_0xa42db0[_0x58c034][_0x4b0d('0x69')]):_0xa42db0[_0x58c034]['question'];}}var _0x3d9636=[],_0x355596={};for(var _0x31cc54=0x0,_0x2087b7=_0x1732d2['length'];_0x31cc54<_0x2087b7;_0x31cc54++){_0x355596={'ProjectId':_0x3c2784['params']['id'],'SessionId':_0x1732d2[_0x31cc54]['id'],'StartTime':moment(_0x1732d2[_0x31cc54][_0x4b0d('0x66')])[_0x4b0d('0x6a')](_0x4b0d('0x6b'))};for(var _0x44443a=0x0,_0xdc734b=_0xa42db0[_0x4b0d('0x48')];_0x44443a<_0xdc734b;_0x44443a++){if(_0xa42db0[_0x44443a][_0x4b0d('0x6c')]==_0x1732d2[_0x31cc54]['id']&&_0x20d9c9[_0x4b0d('0x39')](_0xa42db0[_0x44443a][_0x4b0d('0x6d')])){_0x355596[_0x20d9c9[_0xa42db0[_0x44443a][_0x4b0d('0x6d')]]]=_0xa42db0[_0x44443a][_0x4b0d('0x6e')];}}for(var _0x28e4e8 in _0x20d9c9){if(!_0x355596['hasOwnProperty'](_0x20d9c9[_0x28e4e8])){_0x355596[_0x20d9c9[_0x28e4e8]]=null;}}_0x3d9636[_0x4b0d('0x6f')](_0x355596);}return _0x3d9636;}})['then'](function(_0x40d2bd){if(!_[_0x4b0d('0x70')](_0x40d2bd)){var _0x510570=toCsv(_0x40d2bd);var _0xd56d90=Date[_0x4b0d('0x71')]();fs['writeFileSync'](util['format'](_0x4b0d('0x72'),_0x3c2784['params']['id'],_0xd56d90),_0x510570);_0x56942b[_0x4b0d('0x73')](_0x4b0d('0x74'),'attachment;\x20filename='+util['format'](_0x4b0d('0x75'),_0x3c2784['params']['id'],_0xd56d90));_0x56942b[_0x4b0d('0x73')](_0x4b0d('0x76'),_0x4b0d('0x77'));return _0x56942b['download'](util[_0x4b0d('0x6a')](_0x4b0d('0x72'),_0x3c2784[_0x4b0d('0x46')]['id'],_0xd56d90));}else{return _0x56942b['sendStatus'](0xcc);}})[_0x4b0d('0x4a')](handleError(_0x56942b,null));}; \ No newline at end of file +var _0xb13f=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','body','autoAssociation','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','fast-json-patch','moment','bluebird','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb13f,0x1de));var _0xfb13=function(_0x884ad9,_0x116c18){_0x884ad9=_0x884ad9-0x0;var _0x1fe627=_0xb13f[_0x884ad9];return _0x1fe627;};'use strict';var emlformat=require(_0xfb13('0x0'));var rimraf=require(_0xfb13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb13('0x2'));var rp=require('request-promise');var moment=require(_0xfb13('0x3'));var BPromise=require(_0xfb13('0x4'));var Mustache=require('mustache');var util=require(_0xfb13('0x5'));var path=require('path');var sox=require(_0xfb13('0x6'));var csv=require(_0xfb13('0x7'));var ejs=require(_0xfb13('0x8'));var fs=require('fs');var fs_extra=require(_0xfb13('0x9'));var _=require(_0xfb13('0xa'));var squel=require(_0xfb13('0xb'));var crypto=require(_0xfb13('0xc'));var jsforce=require(_0xfb13('0xd'));var deskjs=require(_0xfb13('0xe'));var toCsv=require(_0xfb13('0x7'));var querystring=require(_0xfb13('0xf'));var Papa=require('papaparse');var Redis=require(_0xfb13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfb13('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb13('0x12'));var logger=require(_0xfb13('0x13'))('api');var utils=require(_0xfb13('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfb13('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d0f65,_0x53269d){_0x53269d=_0x53269d||0xcc;return function(_0xc59fb2){if(_0xc59fb2){return _0x5d0f65[_0xfb13('0x16')](_0x53269d);}return _0x5d0f65[_0xfb13('0x17')](_0x53269d)['end']();};}function respondWithResult(_0x38a5d4,_0x71921c){_0x71921c=_0x71921c||0xc8;return function(_0x497b6a){if(_0x497b6a){return _0x38a5d4[_0xfb13('0x17')](_0x71921c)[_0xfb13('0x18')](_0x497b6a);}};}function respondWithFilteredResult(_0x109c69,_0x5e7c2f){return function(_0x3a892e){if(_0x3a892e){var _0x585525=typeof _0x5e7c2f[_0xfb13('0x19')]===_0xfb13('0x1a')&&typeof _0x5e7c2f[_0xfb13('0x1b')]===_0xfb13('0x1a');var _0x185ce6=_0x3a892e[_0xfb13('0x1c')];var _0x2b251a=_0x585525?0x0:_0x5e7c2f['offset'];var _0xda1dd4=_0x585525?_0x3a892e['count']:_0x5e7c2f[_0xfb13('0x19')]+_0x5e7c2f[_0xfb13('0x1b')];var _0x464cff;if(_0xda1dd4>=_0x185ce6){_0xda1dd4=_0x185ce6;_0x464cff=0xc8;}else{_0x464cff=0xce;}_0x109c69[_0xfb13('0x17')](_0x464cff);return _0x109c69[_0xfb13('0x1d')](_0xfb13('0x1e'),_0x2b251a+'-'+_0xda1dd4+'/'+_0x185ce6)['json'](_0x3a892e);}return null;};}function patchUpdates(_0xed05da){return function(_0x235c4d){try{jsonpatch[_0xfb13('0x1f')](_0x235c4d,_0xed05da,!![]);}catch(_0x55cdb1){return BPromise['reject'](_0x55cdb1);}return _0x235c4d['save']();};}function saveUpdates(_0x5dbc0f,_0x8bba8b){return function(_0x2f5a03){if(_0x2f5a03){return _0x2f5a03[_0xfb13('0x20')](_0x5dbc0f)[_0xfb13('0x21')](function(_0x110c00){return _0x110c00;});}return null;};}function removeEntity(_0x4c72ae,_0x100835){return function(_0x59cc67){if(_0x59cc67){return _0x59cc67['destroy']()['then'](function(){var _0x15792a=_0x59cc67[_0xfb13('0x22')]({'plain':!![]});var _0x1d0dcb='Projects';return db[_0xfb13('0x23')][_0xfb13('0x24')]({'where':{'type':_0x1d0dcb,'resourceId':_0x15792a['id']}})[_0xfb13('0x21')](function(){return _0x59cc67;});})[_0xfb13('0x21')](function(){_0x4c72ae[_0xfb13('0x17')](0xcc)[_0xfb13('0x25')]();});}};}function handleEntityNotFound(_0x88da70,_0x268133){return function(_0x17777a){if(!_0x17777a){_0x88da70['sendStatus'](0x194);}return _0x17777a;};}function handleError(_0x10c067,_0xa0273d){_0xa0273d=_0xa0273d||0x1f4;return function(_0xd5a724){logger[_0xfb13('0x26')](_0xd5a724[_0xfb13('0x27')]);if(_0xd5a724[_0xfb13('0x28')]){delete _0xd5a724['name'];}_0x10c067['status'](_0xa0273d)[_0xfb13('0x29')](_0xd5a724);};}exports['index']=function(_0x26b72c,_0x566a5a){var _0x4c9b59={},_0x9de296={},_0x20b66b={'count':0x0,'rows':[]};var _0x563778=_[_0xfb13('0x2a')](db[_0xfb13('0x2b')][_0xfb13('0x2c')],function(_0x7c7a7b){return{'name':_0x7c7a7b[_0xfb13('0x2d')],'type':_0x7c7a7b[_0xfb13('0x2e')][_0xfb13('0x2f')]};});_0x9de296[_0xfb13('0x30')]=_[_0xfb13('0x2a')](_0x563778,'name');_0x9de296['query']=_['keys'](_0x26b72c[_0xfb13('0x31')]);_0x9de296[_0xfb13('0x32')]=_[_0xfb13('0x33')](_0x9de296['model'],_0x9de296[_0xfb13('0x31')]);_0x4c9b59['attributes']=_[_0xfb13('0x33')](_0x9de296[_0xfb13('0x30')],qs[_0xfb13('0x34')](_0x26b72c[_0xfb13('0x31')]['fields']));_0x4c9b59[_0xfb13('0x35')]=_0x4c9b59[_0xfb13('0x35')]['length']?_0x4c9b59[_0xfb13('0x35')]:_0x9de296[_0xfb13('0x30')];if(!_0x26b72c[_0xfb13('0x31')][_0xfb13('0x36')](_0xfb13('0x37'))){_0x4c9b59[_0xfb13('0x1b')]=qs[_0xfb13('0x1b')](_0x26b72c['query'][_0xfb13('0x1b')]);_0x4c9b59[_0xfb13('0x19')]=qs[_0xfb13('0x19')](_0x26b72c[_0xfb13('0x31')][_0xfb13('0x19')]);}_0x4c9b59[_0xfb13('0x38')]=qs['sort'](_0x26b72c['query'][_0xfb13('0x39')]);_0x4c9b59['where']=qs[_0xfb13('0x32')](_[_0xfb13('0x3a')](_0x26b72c[_0xfb13('0x31')],_0x9de296[_0xfb13('0x32')]),_0x563778);if(_0x26b72c[_0xfb13('0x31')][_0xfb13('0x3b')]){_0x4c9b59[_0xfb13('0x3c')]=_[_0xfb13('0x3d')](_0x4c9b59[_0xfb13('0x3c')],{'$or':_[_0xfb13('0x2a')](_0x563778,function(_0x305e35){if(_0x305e35['type']!==_0xfb13('0x3e')){var _0x4a7f3f={};_0x4a7f3f[_0x305e35['name']]={'$like':'%'+_0x26b72c['query'][_0xfb13('0x3b')]+'%'};return _0x4a7f3f;}})});}_0x4c9b59=_['merge']({},_0x4c9b59,_0x26b72c[_0xfb13('0x3f')]);var _0x15b136={'where':_0x4c9b59[_0xfb13('0x3c')]};return db[_0xfb13('0x2b')][_0xfb13('0x1c')](_0x15b136)[_0xfb13('0x21')](function(_0x52905f){_0x20b66b[_0xfb13('0x1c')]=_0x52905f;if(_0x26b72c[_0xfb13('0x31')][_0xfb13('0x40')]){_0x4c9b59['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xfb13('0x41')](_0x4c9b59);})[_0xfb13('0x21')](function(_0x224788){_0x20b66b[_0xfb13('0x42')]=_0x224788;return _0x20b66b;})[_0xfb13('0x21')](respondWithFilteredResult(_0x566a5a,_0x4c9b59))[_0xfb13('0x43')](handleError(_0x566a5a,null));};exports[_0xfb13('0x44')]=function(_0x51192e,_0x1e611f){var _0x3cfb40={'raw':![],'where':{'id':_0x51192e[_0xfb13('0x45')]['id']}},_0x4308b0={};_0x4308b0['model']=_[_0xfb13('0x46')](db[_0xfb13('0x2b')][_0xfb13('0x2c')]);_0x4308b0[_0xfb13('0x31')]=_[_0xfb13('0x46')](_0x51192e[_0xfb13('0x31')]);_0x4308b0[_0xfb13('0x32')]=_['intersection'](_0x4308b0[_0xfb13('0x30')],_0x4308b0[_0xfb13('0x31')]);_0x3cfb40[_0xfb13('0x35')]=_[_0xfb13('0x33')](_0x4308b0[_0xfb13('0x30')],qs[_0xfb13('0x34')](_0x51192e[_0xfb13('0x31')][_0xfb13('0x34')]));_0x3cfb40[_0xfb13('0x35')]=_0x3cfb40[_0xfb13('0x35')][_0xfb13('0x47')]?_0x3cfb40[_0xfb13('0x35')]:_0x4308b0[_0xfb13('0x30')];if(_0x51192e['query'][_0xfb13('0x40')]){_0x3cfb40[_0xfb13('0x48')]=[{'all':!![]}];}_0x3cfb40=_[_0xfb13('0x3d')]({},_0x3cfb40,_0x51192e[_0xfb13('0x3f')]);return db[_0xfb13('0x2b')][_0xfb13('0x49')](_0x3cfb40)[_0xfb13('0x21')](handleEntityNotFound(_0x1e611f,null))['then'](respondWithResult(_0x1e611f,null))['catch'](handleError(_0x1e611f,null));};exports[_0xfb13('0x4a')]=function(_0x5eb851,_0x380950){return db[_0xfb13('0x2b')][_0xfb13('0x4a')](_0x5eb851['body'],{})[_0xfb13('0x21')](function(_0x1ae4b2){var _0x5c9200=_0x5eb851[_0xfb13('0x4b')][_0xfb13('0x22')]({'plain':!![]});if(!_0x5c9200)throw new Error(_0xfb13('0x4c'));if(_0x5c9200[_0xfb13('0x4d')]===_0xfb13('0x4b')){var _0x22a328=_0x1ae4b2['get']({'plain':!![]});var _0x315c27=_0xfb13('0x4e');return db[_0xfb13('0x4f')][_0xfb13('0x49')]({'where':{'name':_0x315c27,'userProfileId':_0x5c9200[_0xfb13('0x50')]},'raw':!![]})[_0xfb13('0x21')](function(_0x4336f9){if(_0x4336f9&&_0x4336f9['autoAssociation']===0x0){return db[_0xfb13('0x23')][_0xfb13('0x4a')]({'name':_0x22a328[_0xfb13('0x28')],'resourceId':_0x22a328['id'],'type':_0x4336f9[_0xfb13('0x28')],'sectionId':_0x4336f9['id']},{})[_0xfb13('0x21')](function(){return _0x1ae4b2;});}else{return _0x1ae4b2;}})[_0xfb13('0x43')](function(_0x3bf7b5){logger[_0xfb13('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bf7b5);throw _0x3bf7b5;});}return _0x1ae4b2;})[_0xfb13('0x21')](respondWithResult(_0x380950,0xc9))[_0xfb13('0x43')](handleError(_0x380950,null));};exports[_0xfb13('0x51')]=function(_0x2b00c1,_0x567211){var _0x2cf91c={'where':{'id':_0x2b00c1[_0xfb13('0x45')]['id']}},_0x10dc04={};_0x10dc04[_0xfb13('0x30')]=_[_0xfb13('0x46')](db[_0xfb13('0x2b')][_0xfb13('0x2c')]);_0x2cf91c[_0xfb13('0x35')]=_[_0xfb13('0x33')](_0x10dc04[_0xfb13('0x30')],qs[_0xfb13('0x34')](_0x2b00c1['query'][_0xfb13('0x34')]));_0x2cf91c['attributes']=_0x2cf91c['attributes'][_0xfb13('0x47')]?_0x2cf91c[_0xfb13('0x35')]:_0x10dc04['model'];if(_0x2b00c1['query']['includeAll']){_0x2cf91c['include']=[{'all':!![]}];}_0x2cf91c=_[_0xfb13('0x3d')]({},_0x2cf91c,_0x2b00c1[_0xfb13('0x3f')]);return db[_0xfb13('0x2b')][_0xfb13('0x49')](_0x2cf91c)[_0xfb13('0x21')](handleEntityNotFound(_0x567211,null))[_0xfb13('0x21')](function(_0x3b0d14){if(_0x3b0d14){var _0x1d1c06=_0x3b0d14[_0xfb13('0x22')]({'plain':!![]});_0x1d1c06=qs[_0xfb13('0x52')](_0x1d1c06,['id',_0xfb13('0x53'),_0xfb13('0x54')]);_0x2b00c1['body']=_[_0xfb13('0x52')](_0x2b00c1[_0xfb13('0x55')],['id',_0xfb13('0x53'),_0xfb13('0x54')]);return db[_0xfb13('0x2b')][_0xfb13('0x4a')](_['merge'](_0x1d1c06,_0x2b00c1['body']),{'include':_0x2b00c1[_0xfb13('0x31')][_0xfb13('0x40')]?[{'all':!![]}]:undefined})[_0xfb13('0x21')](function(_0x5bf52c){var _0x38e1c8=_0x2b00c1[_0xfb13('0x4b')]['get']({'plain':!![]});if(!_0x38e1c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38e1c8[_0xfb13('0x4d')]===_0xfb13('0x4b')){var _0x2c03f4=_0x5bf52c['get']({'plain':!![]});var _0x5080f8=_0xfb13('0x4e');return db[_0xfb13('0x4f')][_0xfb13('0x49')]({'where':{'name':_0x5080f8,'userProfileId':_0x38e1c8[_0xfb13('0x50')]},'raw':!![]})[_0xfb13('0x21')](function(_0x3e3f3a){if(_0x3e3f3a&&_0x3e3f3a[_0xfb13('0x56')]===0x0){return db[_0xfb13('0x23')][_0xfb13('0x4a')]({'name':_0x2c03f4['name'],'resourceId':_0x2c03f4['id'],'type':_0x3e3f3a[_0xfb13('0x28')],'sectionId':_0x3e3f3a['id']},{})['then'](function(){return _0x5bf52c;});}else{return _0x5bf52c;}})[_0xfb13('0x43')](function(_0x1b58e3){logger[_0xfb13('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b58e3);throw _0x1b58e3;});}return _0x5bf52c;});}})['then'](respondWithResult(_0x567211,0xc9))[_0xfb13('0x43')](handleError(_0x567211,null));};exports[_0xfb13('0x20')]=function(_0x18263c,_0x58b6e5){if(_0x18263c['body']['id']){delete _0x18263c[_0xfb13('0x55')]['id'];}return db['JscriptyProject'][_0xfb13('0x49')]({'where':{'id':_0x18263c[_0xfb13('0x45')]['id']}})[_0xfb13('0x21')](handleEntityNotFound(_0x58b6e5,null))[_0xfb13('0x21')](saveUpdates(_0x18263c[_0xfb13('0x55')],null))[_0xfb13('0x21')](respondWithResult(_0x58b6e5,null))[_0xfb13('0x43')](handleError(_0x58b6e5,null));};exports[_0xfb13('0x24')]=function(_0x426c38,_0x4b2107){return db[_0xfb13('0x2b')][_0xfb13('0x49')]({'where':{'id':_0x426c38[_0xfb13('0x45')]['id']}})[_0xfb13('0x21')](handleEntityNotFound(_0x4b2107,null))[_0xfb13('0x21')](removeEntity(_0x4b2107,null))[_0xfb13('0x43')](handleError(_0x4b2107,null));};exports[_0xfb13('0x57')]=function(_0x43f08a,_0x432ea2,_0x34a2ef){var _0x4d99ca={'raw':!![],'where':{}};var _0x32d065={};var _0x5424cd={'count':0x0,'rows':[]};return db[_0xfb13('0x2b')][_0xfb13('0x58')]({'where':{'id':_0x43f08a[_0xfb13('0x45')]['id']}})['then'](handleEntityNotFound(_0x432ea2,null))['then'](function(_0x24d494){if(_0x24d494){_0x32d065[_0xfb13('0x30')]=_[_0xfb13('0x46')](db[_0xfb13('0x59')][_0xfb13('0x2c')]);_0x32d065[_0xfb13('0x31')]=_['keys'](_0x43f08a[_0xfb13('0x31')]);_0x32d065[_0xfb13('0x32')]=_[_0xfb13('0x33')](_0x32d065['model'],_0x32d065['query']);_0x4d99ca[_0xfb13('0x35')]=_[_0xfb13('0x33')](_0x32d065[_0xfb13('0x30')],qs[_0xfb13('0x34')](_0x43f08a['query'][_0xfb13('0x34')]));_0x4d99ca['attributes']=_0x4d99ca[_0xfb13('0x35')][_0xfb13('0x47')]?_0x4d99ca[_0xfb13('0x35')]:_0x32d065[_0xfb13('0x30')];if(!_0x43f08a[_0xfb13('0x31')][_0xfb13('0x36')](_0xfb13('0x37'))){_0x4d99ca[_0xfb13('0x1b')]=qs[_0xfb13('0x1b')](_0x43f08a[_0xfb13('0x31')][_0xfb13('0x1b')]);_0x4d99ca[_0xfb13('0x19')]=qs[_0xfb13('0x19')](_0x43f08a[_0xfb13('0x31')][_0xfb13('0x19')]);}_0x4d99ca[_0xfb13('0x38')]=qs[_0xfb13('0x39')](_0x43f08a[_0xfb13('0x31')][_0xfb13('0x39')]);_0x4d99ca[_0xfb13('0x3c')]=qs[_0xfb13('0x32')](_[_0xfb13('0x3a')](_0x43f08a[_0xfb13('0x31')],_0x32d065[_0xfb13('0x32')]));_0x4d99ca['where'][_0xfb13('0x5a')]=_0x24d494['id'];if(_0x43f08a['query'][_0xfb13('0x3b')]){_0x4d99ca[_0xfb13('0x3c')]=_[_0xfb13('0x3d')](_0x4d99ca[_0xfb13('0x3c')],{'$or':_['map'](_0x4d99ca[_0xfb13('0x35')],function(_0x5cba41){var _0x17e88f={};_0x17e88f[_0x5cba41]={'$like':'%'+_0x43f08a[_0xfb13('0x31')][_0xfb13('0x3b')]+'%'};return _0x17e88f;})});}_0x4d99ca=_['merge']({},_0x4d99ca,_0x43f08a[_0xfb13('0x3f')]);return db[_0xfb13('0x59')]['count']({'where':_0x4d99ca[_0xfb13('0x3c')]})['then'](function(_0x3b6a3f){_0x5424cd[_0xfb13('0x1c')]=_0x3b6a3f;if(_0x43f08a[_0xfb13('0x31')]['includeAll']){_0x4d99ca[_0xfb13('0x48')]=[{'all':!![]}];}return db[_0xfb13('0x59')][_0xfb13('0x41')](_0x4d99ca);})['then'](function(_0x44d9ce){_0x5424cd[_0xfb13('0x42')]=_0x44d9ce;return _0x5424cd;});}})[_0xfb13('0x21')](respondWithFilteredResult(_0x432ea2,_0x4d99ca))['catch'](handleError(_0x432ea2,null));};exports[_0xfb13('0x5b')]=function(_0x361b42,_0x5c39fb,_0x20348b){var _0x1f9c5c={'raw':!![],'where':{}};var _0x4ed36a={};var _0x227e0d={'count':0x0,'rows':[]};return db[_0xfb13('0x2b')][_0xfb13('0x58')]({'where':{'id':_0x361b42[_0xfb13('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c39fb,null))[_0xfb13('0x21')](function(_0x2c5177){if(_0x2c5177){_0x4ed36a[_0xfb13('0x30')]=_[_0xfb13('0x46')](db['JscriptyAnswerReport'][_0xfb13('0x2c')]);_0x4ed36a['query']=_['keys'](_0x361b42[_0xfb13('0x31')]);_0x4ed36a[_0xfb13('0x32')]=_[_0xfb13('0x33')](_0x4ed36a[_0xfb13('0x30')],_0x4ed36a[_0xfb13('0x31')]);_0x1f9c5c['attributes']=_['intersection'](_0x4ed36a[_0xfb13('0x30')],qs[_0xfb13('0x34')](_0x361b42[_0xfb13('0x31')][_0xfb13('0x34')]));_0x1f9c5c[_0xfb13('0x35')]=_0x1f9c5c[_0xfb13('0x35')][_0xfb13('0x47')]?_0x1f9c5c[_0xfb13('0x35')]:_0x4ed36a[_0xfb13('0x30')];if(!_0x361b42[_0xfb13('0x31')]['hasOwnProperty'](_0xfb13('0x37'))){_0x1f9c5c[_0xfb13('0x1b')]=qs[_0xfb13('0x1b')](_0x361b42['query'][_0xfb13('0x1b')]);_0x1f9c5c[_0xfb13('0x19')]=qs[_0xfb13('0x19')](_0x361b42[_0xfb13('0x31')][_0xfb13('0x19')]);}_0x1f9c5c[_0xfb13('0x38')]=qs[_0xfb13('0x39')](_0x361b42[_0xfb13('0x31')][_0xfb13('0x39')]);_0x1f9c5c['where']=qs[_0xfb13('0x32')](_[_0xfb13('0x3a')](_0x361b42[_0xfb13('0x31')],_0x4ed36a[_0xfb13('0x32')]));_0x1f9c5c[_0xfb13('0x3c')][_0xfb13('0x5a')]=_0x2c5177['id'];if(_0x361b42['query']['filter']){_0x1f9c5c[_0xfb13('0x3c')]=_[_0xfb13('0x3d')](_0x1f9c5c[_0xfb13('0x3c')],{'$or':_['map'](_0x1f9c5c[_0xfb13('0x35')],function(_0x329e39){var _0x546289={};_0x546289[_0x329e39]={'$like':'%'+_0x361b42[_0xfb13('0x31')][_0xfb13('0x3b')]+'%'};return _0x546289;})});}_0x1f9c5c=_['merge']({},_0x1f9c5c,_0x361b42[_0xfb13('0x3f')]);return db['JscriptyAnswerReport'][_0xfb13('0x1c')]({'where':_0x1f9c5c[_0xfb13('0x3c')]})[_0xfb13('0x21')](function(_0xd9e247){_0x227e0d[_0xfb13('0x1c')]=_0xd9e247;if(_0x361b42[_0xfb13('0x31')][_0xfb13('0x40')]){_0x1f9c5c[_0xfb13('0x48')]=[{'all':!![]}];}return db[_0xfb13('0x5c')][_0xfb13('0x41')](_0x1f9c5c);})[_0xfb13('0x21')](function(_0x5ddcf8){_0x227e0d[_0xfb13('0x42')]=_0x5ddcf8;return _0x227e0d;});}})[_0xfb13('0x21')](respondWithFilteredResult(_0x5c39fb,_0x1f9c5c))['catch'](handleError(_0x5c39fb,null));};function char(_0x207959){return _0xfb13('0x5d')===typeof _0x207959?String[_0xfb13('0x5e')][_0xfb13('0x1f')](null,arguments):_0x207959;}function needsEncapsulation(_0x4818f3){return!!_0x4818f3&&(_0x4818f3[_0xfb13('0x5f')]()[_0xfb13('0x60')](char(0xd))>=0x0||_0x4818f3['toString']()[_0xfb13('0x60')](char(0xa))>=0x0||_0x4818f3[_0xfb13('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x4818f3[_0xfb13('0x5f')]()[_0xfb13('0x60')](char(0x22))>=0x0);}function encapsulate(_0x335ea5){var _0x5e4afe=char(0x22),_0x219190='\x5c'+char(0x22),_0x1aac45=_0x335ea5['toString']()[_0xfb13('0x61')](new RegExp(_0x5e4afe,'g'),_0x219190);return _0x5e4afe+_0x1aac45+_0x5e4afe;}exports[_0xfb13('0x62')]=function(_0x3ab8bd,_0xdcbcc0,_0x296c38){var _0x49544b,_0x23eabb;var _0x58fbda={'where':{'ProjectId':_0x3ab8bd[_0xfb13('0x45')]['id']}};if(_0x3ab8bd[_0xfb13('0x31')]['startTime']){_0x58fbda[_0xfb13('0x3c')][_0xfb13('0x63')]=JSON[_0xfb13('0x64')](_0x3ab8bd['query'][_0xfb13('0x65')]);}return db[_0xfb13('0x59')][_0xfb13('0x41')](_0x58fbda)[_0xfb13('0x21')](handleEntityNotFound(_0xdcbcc0,null))['then'](function(_0x55f94a){if(_0x55f94a){_0x49544b=_0x55f94a;return db[_0xfb13('0x66')][_0xfb13('0x41')]({'where':{'SessionId':{'$in':_[_0xfb13('0x2a')](_0x49544b,'id')},'ProjectId':_0x3ab8bd[_0xfb13('0x45')]['id']},'order':_0xfb13('0x67')});}})[_0xfb13('0x21')](handleEntityNotFound(_0xdcbcc0,null))['then'](function(_0xa04574){if(_0xa04574){_0x23eabb=_0xa04574;var _0x5dbf84={};for(var _0x4d5d6a=0x0,_0x101f99=_0x23eabb[_0xfb13('0x47')];_0x4d5d6a<_0x101f99;_0x4d5d6a++){if(!_0x5dbf84[_0xfb13('0x36')](_0x23eabb[_0x4d5d6a]['questionId'])){_0x5dbf84[_0x23eabb[_0x4d5d6a][_0xfb13('0x68')]]=needsEncapsulation(_0x23eabb[_0x4d5d6a][_0xfb13('0x69')])?encapsulate(_0x23eabb[_0x4d5d6a][_0xfb13('0x69')]):_0x23eabb[_0x4d5d6a][_0xfb13('0x69')];}}var _0x13383a=[],_0xd6b629={};for(var _0x2945b1=0x0,_0x1d6080=_0x49544b[_0xfb13('0x47')];_0x2945b1<_0x1d6080;_0x2945b1++){_0xd6b629={'ProjectId':_0x3ab8bd[_0xfb13('0x45')]['id'],'SessionId':_0x49544b[_0x2945b1]['id'],'StartTime':moment(_0x49544b[_0x2945b1][_0xfb13('0x63')])[_0xfb13('0x6a')](_0xfb13('0x6b'))};for(var _0xf748de=0x0,_0x442833=_0x23eabb[_0xfb13('0x47')];_0xf748de<_0x442833;_0xf748de++){if(_0x23eabb[_0xf748de][_0xfb13('0x6c')]==_0x49544b[_0x2945b1]['id']&&_0x5dbf84[_0xfb13('0x36')](_0x23eabb[_0xf748de]['questionId'])){_0xd6b629[_0x5dbf84[_0x23eabb[_0xf748de][_0xfb13('0x68')]]]=_0x23eabb[_0xf748de][_0xfb13('0x6d')];}}for(var _0x26f6ea in _0x5dbf84){if(!_0xd6b629['hasOwnProperty'](_0x5dbf84[_0x26f6ea])){_0xd6b629[_0x5dbf84[_0x26f6ea]]=null;}}_0x13383a[_0xfb13('0x6e')](_0xd6b629);}return _0x13383a;}})[_0xfb13('0x21')](function(_0x2d3cde){if(!_[_0xfb13('0x6f')](_0x2d3cde)){var _0x12c87d=toCsv(_0x2d3cde);var _0x79e37e=Date[_0xfb13('0x70')]();fs[_0xfb13('0x71')](util[_0xfb13('0x6a')](_0xfb13('0x72'),_0x3ab8bd[_0xfb13('0x45')]['id'],_0x79e37e),_0x12c87d);_0xdcbcc0[_0xfb13('0x73')](_0xfb13('0x74'),_0xfb13('0x75')+util[_0xfb13('0x6a')](_0xfb13('0x76'),_0x3ab8bd[_0xfb13('0x45')]['id'],_0x79e37e));_0xdcbcc0[_0xfb13('0x73')](_0xfb13('0x77'),_0xfb13('0x78'));return _0xdcbcc0['download'](util[_0xfb13('0x6a')](_0xfb13('0x72'),_0x3ab8bd[_0xfb13('0x45')]['id'],_0x79e37e));}else{return _0xdcbcc0[_0xfb13('0x16')](0xcc);}})[_0xfb13('0x43')](handleError(_0xdcbcc0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index dd2eb42..fa46b56 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 _0x96f1=['./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5db9ae,_0x2c8c69){var _0x2c88af=function(_0x3f112d){while(--_0x3f112d){_0x5db9ae['push'](_0x5db9ae['shift']());}};_0x2c88af(++_0x2c8c69);}(_0x96f1,0x19c));var _0x196f=function(_0x5dac6d,_0x14bd95){_0x5dac6d=_0x5dac6d-0x0;var _0x519a13=_0x96f1[_0x5dac6d];return _0x519a13;};'use strict';var _=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var logger=require(_0x196f('0x2'))(_0x196f('0x3'));var moment=require(_0x196f('0x4'));var BPromise=require(_0x196f('0x5'));var rp=require(_0x196f('0x6'));var fs=require('fs');var path=require(_0x196f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x196f('0x8'));module[_0x196f('0x9')]=function(_0x267906,_0x1f401c){return _0x267906[_0x196f('0xa')]('JscriptyProject',attributes,{'tableName':_0x196f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x770d=['moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api'];(function(_0x5bd9e3,_0x14cefe){var _0x3fc353=function(_0x285028){while(--_0x285028){_0x5bd9e3['push'](_0x5bd9e3['shift']());}};_0x3fc353(++_0x14cefe);}(_0x770d,0x122));var _0xd770=function(_0x106dbe,_0x35606d){_0x106dbe=_0x106dbe-0x0;var _0x4581a8=_0x770d[_0x106dbe];return _0x4581a8;};'use strict';var _=require(_0xd770('0x0'));var util=require(_0xd770('0x1'));var logger=require(_0xd770('0x2'))(_0xd770('0x3'));var moment=require(_0xd770('0x4'));var BPromise=require(_0xd770('0x5'));var rp=require(_0xd770('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd770('0x7'));var config=require(_0xd770('0x8'));var attributes=require(_0xd770('0x9'));module[_0xd770('0xa')]=function(_0x5d3b18,_0x554c5e){return _0x5d3b18[_0xd770('0xb')](_0xd770('0xc'),attributes,{'tableName':_0xd770('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 71cd1b4..810659d 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 _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4a9302,_0x3b4093){var _0x905595=function(_0x335489){while(--_0x335489){_0x4a9302['push'](_0x4a9302['shift']());}};_0x905595(++_0x3b4093);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x15c46b,_0x5d107b){var _0x1fc58d=function(_0x3b4807){while(--_0x3b4807){_0x15c46b['push'](_0x15c46b['shift']());}};_0x1fc58d(++_0x5d107b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5af528,_0x120db9){_0x5af528=_0x5af528-0x0;var _0x5b1634=_0x9bde[_0x5af528];return _0x5b1634;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index f4a6c80..e77821c 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 _0x031d=['isAuthenticated','describe','/:id','show','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe'];(function(_0x544baa,_0x1b17fe){var _0x5e8cc1=function(_0x1b55dc){while(--_0x1b55dc){_0x544baa['push'](_0x544baa['shift']());}};_0x5e8cc1(++_0x1b17fe);}(_0x031d,0x135));var _0xd031=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x031d[_0x1e4150];return _0x1ce3ee;};'use strict';var multer=require(_0xd031('0x0'));var util=require(_0xd031('0x1'));var path=require(_0xd031('0x2'));var timeout=require('connect-timeout');var express=require(_0xd031('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd031('0x4'));var interaction=require(_0xd031('0x5'));var config=require(_0xd031('0x6'));var controller=require(_0xd031('0x7'));router[_0xd031('0x8')]('/',auth['isAuthenticated'](),controller[_0xd031('0x9')]);router[_0xd031('0x8')](_0xd031('0xa'),auth[_0xd031('0xb')](),controller[_0xd031('0xc')]);router['get'](_0xd031('0xd'),auth['isAuthenticated'](),controller[_0xd031('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd031('0xf')]);router[_0xd031('0x10')](_0xd031('0xd'),auth[_0xd031('0xb')](),controller[_0xd031('0x11')]);router[_0xd031('0x12')](_0xd031('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd031('0x13')]=router; \ No newline at end of file +var _0xb06b=['describe','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','./jscriptyQuestionReport.controller','get','isAuthenticated'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb06b,0x1d4));var _0xbb06=function(_0x423dfd,_0x3ff7d2){_0x423dfd=_0x423dfd-0x0;var _0xba75de=_0xb06b[_0x423dfd];return _0xba75de;};'use strict';var multer=require('multer');var util=require(_0xbb06('0x0'));var path=require('path');var timeout=require(_0xbb06('0x1'));var express=require(_0xbb06('0x2'));var router=express[_0xbb06('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbb06('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb06('0x5'));router[_0xbb06('0x6')]('/',auth[_0xbb06('0x7')](),controller['index']);router[_0xbb06('0x6')]('/describe',auth[_0xbb06('0x7')](),controller[_0xbb06('0x8')]);router['get'](_0xbb06('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xbb06('0xa')]('/',auth[_0xbb06('0x7')](),controller[_0xbb06('0xb')]);router[_0xbb06('0xc')](_0xbb06('0x9'),auth[_0xbb06('0x7')](),controller[_0xbb06('0xd')]);router[_0xbb06('0xe')](_0xbb06('0x9'),auth[_0xbb06('0x7')](),controller[_0xbb06('0xf')]);module[_0xbb06('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 95bb558..5bf2e75 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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x8c6eec,_0x45529d){_0x8c6eec=_0x8c6eec-0x0;var _0x52b0a5=_0x7a54[_0x8c6eec];return _0x52b0a5;};'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(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7a54,0x106));var _0x47a5=function(_0x2f7ed0,_0x1ae72d){_0x2f7ed0=_0x2f7ed0-0x0;var _0x1a388d=_0x7a54[_0x2f7ed0];return _0x1a388d;};'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 1e7f88e..47f7ed4 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 _0x8832=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','JscriptyQuestionReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','apply','reject','save','then','sendStatus','error','name','send','map','fieldName','type','key','model','query'];(function(_0x3ac136,_0x2b1f66){var _0x6f5d91=function(_0x2c8738){while(--_0x2c8738){_0x3ac136['push'](_0x3ac136['shift']());}};_0x6f5d91(++_0x2b1f66);}(_0x8832,0x18a));var _0x2883=function(_0x2eeb73,_0x413219){_0x2eeb73=_0x2eeb73-0x0;var _0x421024=_0x8832[_0x2eeb73];return _0x421024;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2883('0x0'));var jsonpatch=require(_0x2883('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2883('0x2'));var Mustache=require('mustache');var util=require(_0x2883('0x3'));var path=require(_0x2883('0x4'));var sox=require(_0x2883('0x5'));var csv=require(_0x2883('0x6'));var ejs=require(_0x2883('0x7'));var fs=require('fs');var fs_extra=require(_0x2883('0x8'));var _=require('lodash');var squel=require(_0x2883('0x9'));var crypto=require(_0x2883('0xa'));var jsforce=require(_0x2883('0xb'));var deskjs=require(_0x2883('0xc'));var toCsv=require(_0x2883('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2883('0xd'));var authService=require(_0x2883('0xe'));var qs=require(_0x2883('0xf'));var as=require(_0x2883('0x10'));var hardwareService=require(_0x2883('0x11'));var logger=require(_0x2883('0x12'))('api');var utils=require(_0x2883('0x13'));var config=require(_0x2883('0x14'));var licenseUtil=require(_0x2883('0x15'));var db=require(_0x2883('0x16'))['db'];function respondWithStatusCode(_0x39e41b,_0x5b48b6){_0x5b48b6=_0x5b48b6||0xcc;return function(_0x1ac959){if(_0x1ac959){return _0x39e41b['sendStatus'](_0x5b48b6);}return _0x39e41b[_0x2883('0x17')](_0x5b48b6)[_0x2883('0x18')]();};}function respondWithResult(_0x3060a3,_0x37aa51){_0x37aa51=_0x37aa51||0xc8;return function(_0x1fef81){if(_0x1fef81){return _0x3060a3[_0x2883('0x17')](_0x37aa51)[_0x2883('0x19')](_0x1fef81);}};}function respondWithFilteredResult(_0x343cf5,_0x422d14){return function(_0x289602){if(_0x289602){var _0x24eb73=typeof _0x422d14['offset']===_0x2883('0x1a')&&typeof _0x422d14[_0x2883('0x1b')]===_0x2883('0x1a');var _0x13a09e=_0x289602[_0x2883('0x1c')];var _0x2732cf=_0x24eb73?0x0:_0x422d14[_0x2883('0x1d')];var _0x56e978=_0x24eb73?_0x289602['count']:_0x422d14['offset']+_0x422d14[_0x2883('0x1b')];var _0x79cd97;if(_0x56e978>=_0x13a09e){_0x56e978=_0x13a09e;_0x79cd97=0xc8;}else{_0x79cd97=0xce;}_0x343cf5[_0x2883('0x17')](_0x79cd97);return _0x343cf5['set']('Content-Range',_0x2732cf+'-'+_0x56e978+'/'+_0x13a09e)[_0x2883('0x19')](_0x289602);}return null;};}function patchUpdates(_0x574f00){return function(_0x43a328){try{jsonpatch[_0x2883('0x1e')](_0x43a328,_0x574f00,!![]);}catch(_0x26261b){return BPromise[_0x2883('0x1f')](_0x26261b);}return _0x43a328[_0x2883('0x20')]();};}function saveUpdates(_0x58c6b3,_0x12559f){return function(_0x2a1b14){if(_0x2a1b14){return _0x2a1b14['update'](_0x58c6b3)['then'](function(_0x5c0247){return _0x5c0247;});}return null;};}function removeEntity(_0x45abed,_0x53ed7e){return function(_0x33569f){if(_0x33569f){return _0x33569f['destroy']()[_0x2883('0x21')](function(){_0x45abed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x367b69,_0x320f3e){return function(_0x5f560e){if(!_0x5f560e){_0x367b69[_0x2883('0x22')](0x194);}return _0x5f560e;};}function handleError(_0x56b7c3,_0x1f13df){_0x1f13df=_0x1f13df||0x1f4;return function(_0x1f9324){logger[_0x2883('0x23')](_0x1f9324['stack']);if(_0x1f9324[_0x2883('0x24')]){delete _0x1f9324['name'];}_0x56b7c3['status'](_0x1f13df)[_0x2883('0x25')](_0x1f9324);};}exports['index']=function(_0x41b594,_0x9f2df4){var _0x5e2114={},_0x275efa={},_0x58164f={'count':0x0,'rows':[]};var _0x21952f=_[_0x2883('0x26')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x59a9d5){return{'name':_0x59a9d5[_0x2883('0x27')],'type':_0x59a9d5[_0x2883('0x28')][_0x2883('0x29')]};});_0x275efa[_0x2883('0x2a')]=_['map'](_0x21952f,_0x2883('0x24'));_0x275efa[_0x2883('0x2b')]=_[_0x2883('0x2c')](_0x41b594['query']);_0x275efa[_0x2883('0x2d')]=_[_0x2883('0x2e')](_0x275efa[_0x2883('0x2a')],_0x275efa[_0x2883('0x2b')]);_0x5e2114[_0x2883('0x2f')]=_[_0x2883('0x2e')](_0x275efa[_0x2883('0x2a')],qs[_0x2883('0x30')](_0x41b594[_0x2883('0x2b')][_0x2883('0x30')]));_0x5e2114[_0x2883('0x2f')]=_0x5e2114[_0x2883('0x2f')][_0x2883('0x31')]?_0x5e2114[_0x2883('0x2f')]:_0x275efa[_0x2883('0x2a')];if(!_0x41b594['query'][_0x2883('0x32')](_0x2883('0x33'))){_0x5e2114['limit']=qs[_0x2883('0x1b')](_0x41b594[_0x2883('0x2b')]['limit']);_0x5e2114['offset']=qs[_0x2883('0x1d')](_0x41b594['query']['offset']);}_0x5e2114[_0x2883('0x34')]=qs[_0x2883('0x35')](_0x41b594['query'][_0x2883('0x35')]);_0x5e2114[_0x2883('0x36')]=qs[_0x2883('0x2d')](_[_0x2883('0x37')](_0x41b594[_0x2883('0x2b')],_0x275efa[_0x2883('0x2d')]),_0x21952f);if(_0x41b594['query'][_0x2883('0x38')]){_0x5e2114[_0x2883('0x36')]=_[_0x2883('0x39')](_0x5e2114[_0x2883('0x36')],{'$or':_[_0x2883('0x26')](_0x21952f,function(_0x363011){if(_0x363011[_0x2883('0x28')]!=='VIRTUAL'){var _0x352ab2={};_0x352ab2[_0x363011['name']]={'$like':'%'+_0x41b594['query'][_0x2883('0x38')]+'%'};return _0x352ab2;}})});}_0x5e2114=_[_0x2883('0x39')]({},_0x5e2114,_0x41b594['options']);var _0x52402d={'where':_0x5e2114[_0x2883('0x36')]};return db[_0x2883('0x3a')][_0x2883('0x1c')](_0x52402d)[_0x2883('0x21')](function(_0x1721a5){_0x58164f['count']=_0x1721a5;if(_0x41b594[_0x2883('0x2b')][_0x2883('0x3b')]){_0x5e2114[_0x2883('0x3c')]=[{'all':!![]}];}return db[_0x2883('0x3a')][_0x2883('0x3d')](_0x5e2114);})[_0x2883('0x21')](function(_0x990340){_0x58164f[_0x2883('0x3e')]=_0x990340;return _0x58164f;})[_0x2883('0x21')](respondWithFilteredResult(_0x9f2df4,_0x5e2114))[_0x2883('0x3f')](handleError(_0x9f2df4,null));};exports[_0x2883('0x40')]=function(_0x928acb,_0x5aef93){var _0x465290={'raw':!![],'where':{'id':_0x928acb[_0x2883('0x41')]['id']}},_0x63a24e={};_0x63a24e[_0x2883('0x2a')]=_[_0x2883('0x2c')](db[_0x2883('0x3a')][_0x2883('0x42')]);_0x63a24e[_0x2883('0x2b')]=_[_0x2883('0x2c')](_0x928acb[_0x2883('0x2b')]);_0x63a24e['filters']=_[_0x2883('0x2e')](_0x63a24e[_0x2883('0x2a')],_0x63a24e[_0x2883('0x2b')]);_0x465290['attributes']=_[_0x2883('0x2e')](_0x63a24e[_0x2883('0x2a')],qs[_0x2883('0x30')](_0x928acb[_0x2883('0x2b')][_0x2883('0x30')]));_0x465290[_0x2883('0x2f')]=_0x465290[_0x2883('0x2f')][_0x2883('0x31')]?_0x465290[_0x2883('0x2f')]:_0x63a24e[_0x2883('0x2a')];if(_0x928acb['query'][_0x2883('0x3b')]){_0x465290[_0x2883('0x3c')]=[{'all':!![]}];}_0x465290=_[_0x2883('0x39')]({},_0x465290,_0x928acb['options']);return db[_0x2883('0x3a')][_0x2883('0x43')](_0x465290)[_0x2883('0x21')](handleEntityNotFound(_0x5aef93,null))[_0x2883('0x21')](respondWithResult(_0x5aef93,null))[_0x2883('0x3f')](handleError(_0x5aef93,null));};exports[_0x2883('0x44')]=function(_0x441c92,_0x40488e){return db[_0x2883('0x3a')]['create'](_0x441c92[_0x2883('0x45')],{})[_0x2883('0x21')](respondWithResult(_0x40488e,0xc9))[_0x2883('0x3f')](handleError(_0x40488e,null));};exports[_0x2883('0x46')]=function(_0x5424fc,_0x1d7155){if(_0x5424fc['body']['id']){delete _0x5424fc['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x5424fc[_0x2883('0x41')]['id']}})[_0x2883('0x21')](handleEntityNotFound(_0x1d7155,null))[_0x2883('0x21')](saveUpdates(_0x5424fc[_0x2883('0x45')],null))['then'](respondWithResult(_0x1d7155,null))['catch'](handleError(_0x1d7155,null));};exports[_0x2883('0x47')]=function(_0x360912,_0x28e630){return db[_0x2883('0x3a')][_0x2883('0x43')]({'where':{'id':_0x360912[_0x2883('0x41')]['id']}})['then'](handleEntityNotFound(_0x28e630,null))[_0x2883('0x21')](removeEntity(_0x28e630,null))[_0x2883('0x3f')](handleError(_0x28e630,null));};exports[_0x2883('0x48')]=function(_0x144e2b,_0x2d8f6d){return db[_0x2883('0x3a')][_0x2883('0x48')]()['then'](respondWithResult(_0x2d8f6d,null))['catch'](handleError(_0x2d8f6d,null));}; \ No newline at end of file +var _0x2b7d=['type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','map','options','includeAll','include','rows','catch','show','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','sendStatus','stack','name','index','JscriptyQuestionReport','rawAttributes','fieldName'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0x2b7d,0x1ba));var _0xd2b7=function(_0xde9959,_0x415b88){_0xde9959=_0xde9959-0x0;var _0x24d9d5=_0x2b7d[_0xde9959];return _0x24d9d5;};'use strict';var emlformat=require(_0xd2b7('0x0'));var rimraf=require(_0xd2b7('0x1'));var zipdir=require(_0xd2b7('0x2'));var jsonpatch=require(_0xd2b7('0x3'));var rp=require(_0xd2b7('0x4'));var moment=require(_0xd2b7('0x5'));var BPromise=require(_0xd2b7('0x6'));var Mustache=require('mustache');var util=require(_0xd2b7('0x7'));var path=require(_0xd2b7('0x8'));var sox=require('sox');var csv=require(_0xd2b7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd2b7('0xa'));var jsforce=require(_0xd2b7('0xb'));var deskjs=require(_0xd2b7('0xc'));var toCsv=require(_0xd2b7('0x9'));var querystring=require(_0xd2b7('0xd'));var Papa=require('papaparse');var Redis=require(_0xd2b7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd2b7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd2b7('0x10'));var logger=require(_0xd2b7('0x11'))(_0xd2b7('0x12'));var utils=require('../../config/utils');var config=require(_0xd2b7('0x13'));var licenseUtil=require(_0xd2b7('0x14'));var db=require(_0xd2b7('0x15'))['db'];function respondWithStatusCode(_0x387a3b,_0x646091){_0x646091=_0x646091||0xcc;return function(_0x1fcf39){if(_0x1fcf39){return _0x387a3b['sendStatus'](_0x646091);}return _0x387a3b[_0xd2b7('0x16')](_0x646091)[_0xd2b7('0x17')]();};}function respondWithResult(_0x177707,_0xd51b7b){_0xd51b7b=_0xd51b7b||0xc8;return function(_0x19091b){if(_0x19091b){return _0x177707[_0xd2b7('0x16')](_0xd51b7b)[_0xd2b7('0x18')](_0x19091b);}};}function respondWithFilteredResult(_0xf71740,_0x526f31){return function(_0x436807){if(_0x436807){var _0x461ca2=typeof _0x526f31['offset']===_0xd2b7('0x19')&&typeof _0x526f31[_0xd2b7('0x1a')]===_0xd2b7('0x19');var _0x37d18f=_0x436807[_0xd2b7('0x1b')];var _0x4da7be=_0x461ca2?0x0:_0x526f31[_0xd2b7('0x1c')];var _0x591485=_0x461ca2?_0x436807[_0xd2b7('0x1b')]:_0x526f31['offset']+_0x526f31[_0xd2b7('0x1a')];var _0x424a5f;if(_0x591485>=_0x37d18f){_0x591485=_0x37d18f;_0x424a5f=0xc8;}else{_0x424a5f=0xce;}_0xf71740[_0xd2b7('0x16')](_0x424a5f);return _0xf71740['set'](_0xd2b7('0x1d'),_0x4da7be+'-'+_0x591485+'/'+_0x37d18f)[_0xd2b7('0x18')](_0x436807);}return null;};}function patchUpdates(_0x23bb9b){return function(_0x1cdeea){try{jsonpatch[_0xd2b7('0x1e')](_0x1cdeea,_0x23bb9b,!![]);}catch(_0x388c94){return BPromise['reject'](_0x388c94);}return _0x1cdeea['save']();};}function saveUpdates(_0x2e2eb4,_0x55f1c9){return function(_0x2d2102){if(_0x2d2102){return _0x2d2102[_0xd2b7('0x1f')](_0x2e2eb4)[_0xd2b7('0x20')](function(_0x20a85a){return _0x20a85a;});}return null;};}function removeEntity(_0x558915,_0x3b4140){return function(_0x1da7aa){if(_0x1da7aa){return _0x1da7aa[_0xd2b7('0x21')]()[_0xd2b7('0x20')](function(){_0x558915[_0xd2b7('0x16')](0xcc)[_0xd2b7('0x17')]();});}};}function handleEntityNotFound(_0x4372a1,_0x50e5c3){return function(_0x3c7084){if(!_0x3c7084){_0x4372a1[_0xd2b7('0x22')](0x194);}return _0x3c7084;};}function handleError(_0x41afcb,_0x2d74c5){_0x2d74c5=_0x2d74c5||0x1f4;return function(_0x4e1b92){logger['error'](_0x4e1b92[_0xd2b7('0x23')]);if(_0x4e1b92['name']){delete _0x4e1b92[_0xd2b7('0x24')];}_0x41afcb[_0xd2b7('0x16')](_0x2d74c5)['send'](_0x4e1b92);};}exports[_0xd2b7('0x25')]=function(_0x1edb05,_0x16533f){var _0x4b18f1={},_0x283d97={},_0x220143={'count':0x0,'rows':[]};var _0x229b14=_['map'](db[_0xd2b7('0x26')][_0xd2b7('0x27')],function(_0xb372ff){return{'name':_0xb372ff[_0xd2b7('0x28')],'type':_0xb372ff[_0xd2b7('0x29')][_0xd2b7('0x2a')]};});_0x283d97[_0xd2b7('0x2b')]=_['map'](_0x229b14,_0xd2b7('0x24'));_0x283d97[_0xd2b7('0x2c')]=_[_0xd2b7('0x2d')](_0x1edb05[_0xd2b7('0x2c')]);_0x283d97[_0xd2b7('0x2e')]=_['intersection'](_0x283d97[_0xd2b7('0x2b')],_0x283d97[_0xd2b7('0x2c')]);_0x4b18f1[_0xd2b7('0x2f')]=_[_0xd2b7('0x30')](_0x283d97[_0xd2b7('0x2b')],qs[_0xd2b7('0x31')](_0x1edb05[_0xd2b7('0x2c')][_0xd2b7('0x31')]));_0x4b18f1[_0xd2b7('0x2f')]=_0x4b18f1[_0xd2b7('0x2f')][_0xd2b7('0x32')]?_0x4b18f1[_0xd2b7('0x2f')]:_0x283d97[_0xd2b7('0x2b')];if(!_0x1edb05['query'][_0xd2b7('0x33')](_0xd2b7('0x34'))){_0x4b18f1['limit']=qs['limit'](_0x1edb05[_0xd2b7('0x2c')][_0xd2b7('0x1a')]);_0x4b18f1[_0xd2b7('0x1c')]=qs[_0xd2b7('0x1c')](_0x1edb05[_0xd2b7('0x2c')]['offset']);}_0x4b18f1['order']=qs[_0xd2b7('0x35')](_0x1edb05[_0xd2b7('0x2c')][_0xd2b7('0x35')]);_0x4b18f1['where']=qs[_0xd2b7('0x2e')](_['pick'](_0x1edb05[_0xd2b7('0x2c')],_0x283d97[_0xd2b7('0x2e')]),_0x229b14);if(_0x1edb05[_0xd2b7('0x2c')][_0xd2b7('0x36')]){_0x4b18f1[_0xd2b7('0x37')]=_[_0xd2b7('0x38')](_0x4b18f1[_0xd2b7('0x37')],{'$or':_[_0xd2b7('0x39')](_0x229b14,function(_0x3385a8){if(_0x3385a8[_0xd2b7('0x29')]!=='VIRTUAL'){var _0xe3d7aa={};_0xe3d7aa[_0x3385a8[_0xd2b7('0x24')]]={'$like':'%'+_0x1edb05[_0xd2b7('0x2c')][_0xd2b7('0x36')]+'%'};return _0xe3d7aa;}})});}_0x4b18f1=_['merge']({},_0x4b18f1,_0x1edb05[_0xd2b7('0x3a')]);var _0x3fcae1={'where':_0x4b18f1[_0xd2b7('0x37')]};return db[_0xd2b7('0x26')]['count'](_0x3fcae1)['then'](function(_0x593572){_0x220143[_0xd2b7('0x1b')]=_0x593572;if(_0x1edb05[_0xd2b7('0x2c')][_0xd2b7('0x3b')]){_0x4b18f1[_0xd2b7('0x3c')]=[{'all':!![]}];}return db[_0xd2b7('0x26')]['findAll'](_0x4b18f1);})[_0xd2b7('0x20')](function(_0x1e2aa3){_0x220143[_0xd2b7('0x3d')]=_0x1e2aa3;return _0x220143;})['then'](respondWithFilteredResult(_0x16533f,_0x4b18f1))[_0xd2b7('0x3e')](handleError(_0x16533f,null));};exports[_0xd2b7('0x3f')]=function(_0x3b7a3f,_0x33eb86){var _0x5840e8={'raw':!![],'where':{'id':_0x3b7a3f['params']['id']}},_0x415a0f={};_0x415a0f['model']=_['keys'](db[_0xd2b7('0x26')][_0xd2b7('0x27')]);_0x415a0f[_0xd2b7('0x2c')]=_[_0xd2b7('0x2d')](_0x3b7a3f[_0xd2b7('0x2c')]);_0x415a0f[_0xd2b7('0x2e')]=_[_0xd2b7('0x30')](_0x415a0f[_0xd2b7('0x2b')],_0x415a0f['query']);_0x5840e8[_0xd2b7('0x2f')]=_[_0xd2b7('0x30')](_0x415a0f[_0xd2b7('0x2b')],qs[_0xd2b7('0x31')](_0x3b7a3f[_0xd2b7('0x2c')][_0xd2b7('0x31')]));_0x5840e8[_0xd2b7('0x2f')]=_0x5840e8[_0xd2b7('0x2f')][_0xd2b7('0x32')]?_0x5840e8[_0xd2b7('0x2f')]:_0x415a0f['model'];if(_0x3b7a3f[_0xd2b7('0x2c')][_0xd2b7('0x3b')]){_0x5840e8[_0xd2b7('0x3c')]=[{'all':!![]}];}_0x5840e8=_[_0xd2b7('0x38')]({},_0x5840e8,_0x3b7a3f[_0xd2b7('0x3a')]);return db[_0xd2b7('0x26')]['find'](_0x5840e8)[_0xd2b7('0x20')](handleEntityNotFound(_0x33eb86,null))[_0xd2b7('0x20')](respondWithResult(_0x33eb86,null))['catch'](handleError(_0x33eb86,null));};exports[_0xd2b7('0x40')]=function(_0x32bdf9,_0x1f4a29){return db[_0xd2b7('0x26')][_0xd2b7('0x40')](_0x32bdf9[_0xd2b7('0x41')],{})[_0xd2b7('0x20')](respondWithResult(_0x1f4a29,0xc9))[_0xd2b7('0x3e')](handleError(_0x1f4a29,null));};exports[_0xd2b7('0x1f')]=function(_0x1877dd,_0x2459e1){if(_0x1877dd[_0xd2b7('0x41')]['id']){delete _0x1877dd['body']['id'];}return db[_0xd2b7('0x26')][_0xd2b7('0x42')]({'where':{'id':_0x1877dd[_0xd2b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x2459e1,null))['then'](saveUpdates(_0x1877dd[_0xd2b7('0x41')],null))[_0xd2b7('0x20')](respondWithResult(_0x2459e1,null))['catch'](handleError(_0x2459e1,null));};exports[_0xd2b7('0x21')]=function(_0x58ad50,_0x464d22){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x58ad50[_0xd2b7('0x43')]['id']}})[_0xd2b7('0x20')](handleEntityNotFound(_0x464d22,null))[_0xd2b7('0x20')](removeEntity(_0x464d22,null))[_0xd2b7('0x3e')](handleError(_0x464d22,null));};exports['describe']=function(_0x552cba,_0x62fdbc){return db[_0xd2b7('0x26')][_0xd2b7('0x44')]()[_0xd2b7('0x20')](respondWithResult(_0x62fdbc,null))['catch'](handleError(_0x62fdbc,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c647631..dc8cba0 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 _0x3ed8=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger','api'];(function(_0x166bc4,_0xb45bc){var _0x96630f=function(_0x57ca6f){while(--_0x57ca6f){_0x166bc4['push'](_0x166bc4['shift']());}};_0x96630f(++_0xb45bc);}(_0x3ed8,0x110));var _0x83ed=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x3ed8[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x83ed('0x0'));var util=require('util');var logger=require(_0x83ed('0x1'))(_0x83ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x83ed('0x3'));var fs=require('fs');var path=require(_0x83ed('0x4'));var rimraf=require(_0x83ed('0x5'));var config=require(_0x83ed('0x6'));var attributes=require(_0x83ed('0x7'));module[_0x83ed('0x8')]=function(_0x3253cf,_0x5a8bb8){return _0x3253cf[_0x83ed('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x83ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf648=['bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment'];(function(_0x1140cd,_0x21642e){var _0x29e13b=function(_0x52b2bf){while(--_0x52b2bf){_0x1140cd['push'](_0x1140cd['shift']());}};_0x29e13b(++_0x21642e);}(_0xf648,0x1e9));var _0x8f64=function(_0x24bf2f,_0x1a0efa){_0x24bf2f=_0x24bf2f-0x0;var _0x1fa78f=_0xf648[_0x24bf2f];return _0x1fa78f;};'use strict';var _=require(_0x8f64('0x0'));var util=require(_0x8f64('0x1'));var logger=require(_0x8f64('0x2'))(_0x8f64('0x3'));var moment=require(_0x8f64('0x4'));var BPromise=require(_0x8f64('0x5'));var rp=require(_0x8f64('0x6'));var fs=require('fs');var path=require(_0x8f64('0x7'));var rimraf=require(_0x8f64('0x8'));var config=require(_0x8f64('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x186610,_0x2a6e5a){return _0x186610[_0x8f64('0xa')](_0x8f64('0xb'),attributes,{'tableName':_0x8f64('0xc'),'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 19347d8..06b8ba7 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 _0xade4=['info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x521711,_0x2d3851){var _0x43e92c=function(_0x183104){while(--_0x183104){_0x521711['push'](_0x521711['shift']());}};_0x43e92c(++_0x2d3851);}(_0xade4,0x136));var _0x4ade=function(_0x407f44,_0x3d0acc){_0x407f44=_0x407f44-0x0;var _0x509d0d=_0xade4[_0x407f44];return _0x509d0d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4ade('0x0'));var BPromise=require(_0x4ade('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ade('0x2'))['db'];var utils=require(_0x4ade('0x3'));var logger=require(_0x4ade('0x4'))(_0x4ade('0x5'));var config=require(_0x4ade('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4ade('0x7')][_0x4ade('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33be6e,_0x366dd1,_0x2edf1b){return new BPromise(function(_0x29a5f5,_0x44ceb4){return client['request'](_0x33be6e,_0x2edf1b)[_0x4ade('0x9')](function(_0x4ee815){logger[_0x4ade('0xa')](_0x4ade('0xb'),_0x366dd1,_0x4ade('0xc'));logger[_0x4ade('0xd')](_0x4ade('0xe'),_0x366dd1,_0x4ade('0xc'),JSON[_0x4ade('0xf')](_0x4ee815));if(_0x4ee815[_0x4ade('0x10')]){if(_0x4ee815[_0x4ade('0x10')][_0x4ade('0x11')]===0x1f4){logger['error'](_0x4ade('0xb'),_0x366dd1,_0x4ee815[_0x4ade('0x10')][_0x4ade('0x12')]);return _0x44ceb4(_0x4ee815['error'][_0x4ade('0x12')]);}logger[_0x4ade('0x10')](_0x4ade('0xb'),_0x366dd1,_0x4ee815[_0x4ade('0x10')][_0x4ade('0x12')]);return _0x29a5f5(_0x4ee815[_0x4ade('0x10')][_0x4ade('0x12')]);}else{logger['info'](_0x4ade('0xb'),_0x366dd1,_0x4ade('0xc'));_0x29a5f5(_0x4ee815[_0x4ade('0x13')][_0x4ade('0x12')]);}})['catch'](function(_0xca70ef){logger['error'](_0x4ade('0xb'),_0x366dd1,_0xca70ef);_0x44ceb4(_0xca70ef);});});} \ No newline at end of file +var _0x99d7=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b7173,_0x384a88){var _0x2d8a6f=function(_0x193226){while(--_0x193226){_0x4b7173['push'](_0x4b7173['shift']());}};_0x2d8a6f(++_0x384a88);}(_0x99d7,0x1d2));var _0x799d=function(_0x3854dd,_0x55f03f){_0x3854dd=_0x3854dd-0x0;var _0x152bd5=_0x99d7[_0x3854dd];return _0x152bd5;};'use strict';var _=require(_0x799d('0x0'));var util=require(_0x799d('0x1'));var moment=require('moment');var BPromise=require(_0x799d('0x2'));var rs=require(_0x799d('0x3'));var fs=require('fs');var Redis=require(_0x799d('0x4'));var db=require(_0x799d('0x5'))['db'];var utils=require(_0x799d('0x6'));var logger=require(_0x799d('0x7'))(_0x799d('0x8'));var config=require('../../config/environment');var jayson=require(_0x799d('0x9'));var client=jayson[_0x799d('0xa')][_0x799d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa3a1c4,_0xc46015,_0x192db4){return new BPromise(function(_0x485297,_0x3102b7){return client['request'](_0xa3a1c4,_0x192db4)[_0x799d('0xc')](function(_0x541022){logger[_0x799d('0xd')](_0x799d('0xe'),_0xc46015,_0x799d('0xf'));logger[_0x799d('0x10')](_0x799d('0x11'),_0xc46015,'request\x20sent',JSON[_0x799d('0x12')](_0x541022));if(_0x541022[_0x799d('0x13')]){if(_0x541022[_0x799d('0x13')]['code']===0x1f4){logger[_0x799d('0x13')](_0x799d('0xe'),_0xc46015,_0x541022[_0x799d('0x13')][_0x799d('0x14')]);return _0x3102b7(_0x541022[_0x799d('0x13')][_0x799d('0x14')]);}logger[_0x799d('0x13')](_0x799d('0xe'),_0xc46015,_0x541022[_0x799d('0x13')][_0x799d('0x14')]);return _0x485297(_0x541022[_0x799d('0x13')][_0x799d('0x14')]);}else{logger[_0x799d('0xd')](_0x799d('0xe'),_0xc46015,'request\x20sent');_0x485297(_0x541022[_0x799d('0x15')][_0x799d('0x14')]);}})[_0x799d('0x16')](function(_0x491ce4){logger[_0x799d('0x13')](_0x799d('0xe'),_0xc46015,_0x491ce4);_0x3102b7(_0x491ce4);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f227a7a..75e4e1c 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 _0xc086=['describe','/:id','show','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x7a9727,_0x306522){var _0x5c6430=function(_0x2d5a42){while(--_0x2d5a42){_0x7a9727['push'](_0x7a9727['shift']());}};_0x5c6430(++_0x306522);}(_0xc086,0x11f));var _0x6c08=function(_0x5383d4,_0x59338b){_0x5383d4=_0x5383d4-0x0;var _0x5919e0=_0xc086[_0x5383d4];return _0x5919e0;};'use strict';var multer=require(_0x6c08('0x0'));var util=require(_0x6c08('0x1'));var path=require(_0x6c08('0x2'));var timeout=require(_0x6c08('0x3'));var express=require(_0x6c08('0x4'));var router=express[_0x6c08('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6c08('0x6'));var interaction=require(_0x6c08('0x7'));var config=require(_0x6c08('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0x6c08('0x9')]('/',auth[_0x6c08('0xa')](),controller['index']);router[_0x6c08('0x9')](_0x6c08('0xb'),auth['isAuthenticated'](),controller[_0x6c08('0xc')]);router[_0x6c08('0x9')](_0x6c08('0xd'),auth[_0x6c08('0xa')](),controller[_0x6c08('0xe')]);router[_0x6c08('0x9')](_0x6c08('0xf'),auth[_0x6c08('0xa')](),controller[_0x6c08('0x10')]);router[_0x6c08('0x11')]('/',auth[_0x6c08('0xa')](),controller['create']);router[_0x6c08('0x12')](_0x6c08('0xd'),auth['isAuthenticated'](),controller[_0x6c08('0x13')]);router[_0x6c08('0x14')](_0x6c08('0xd'),auth[_0x6c08('0xa')](),controller[_0x6c08('0x15')]);module[_0x6c08('0x16')]=router; \ No newline at end of file +var _0xcee1=['../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','delete','exports','multer','util','path','express','fs-extra'];(function(_0x5bce33,_0x4a4b06){var _0x15bc20=function(_0x56c711){while(--_0x56c711){_0x5bce33['push'](_0x5bce33['shift']());}};_0x15bc20(++_0x4a4b06);}(_0xcee1,0xcd));var _0x1cee=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcee1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1cee('0x0'));var util=require(_0x1cee('0x1'));var path=require(_0x1cee('0x2'));var timeout=require('connect-timeout');var express=require(_0x1cee('0x3'));var router=express['Router']();var fs_extra=require(_0x1cee('0x4'));var auth=require(_0x1cee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1cee('0x6'));var controller=require(_0x1cee('0x7'));router[_0x1cee('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1cee('0x9'),auth[_0x1cee('0xa')](),controller[_0x1cee('0xb')]);router[_0x1cee('0x8')](_0x1cee('0xc'),auth['isAuthenticated'](),controller[_0x1cee('0xd')]);router[_0x1cee('0x8')](_0x1cee('0xe'),auth[_0x1cee('0xa')](),controller[_0x1cee('0xf')]);router[_0x1cee('0x10')]('/',auth[_0x1cee('0xa')](),controller[_0x1cee('0x11')]);router[_0x1cee('0x12')](_0x1cee('0xc'),auth[_0x1cee('0xa')](),controller['update']);router[_0x1cee('0x13')](_0x1cee('0xc'),auth[_0x1cee('0xa')](),controller['destroy']);module[_0x1cee('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 978f210..3fcf1b0 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 _0x5557=['STRING','BOOLEAN','moment','exports','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x2570fe,_0x19a948){var _0x12bcf7=function(_0x2adde7){while(--_0x2adde7){_0x2570fe['push'](_0x2570fe['shift']());}};_0x12bcf7(++_0x19a948);}(_0x5557,0x1ba));var _0x7555=function(_0x117701,_0xce7013){_0x117701=_0x117701-0x0;var _0x3fca2d=_0x5557[_0x117701];return _0x3fca2d;};'use strict';var moment=require(_0x7555('0x0'));var Sequelize=require('sequelize');module[_0x7555('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x398591){this[_0x7555('0x2')]('starttime',_0x398591);this[_0x7555('0x2')]('endtime',moment()[_0x7555('0x3')](_0x7555('0x4')));}},'endtime':{'type':Sequelize[_0x7555('0x5')]},'membername':{'type':Sequelize[_0x7555('0x6')]},'projectname':{'type':Sequelize[_0x7555('0x6')]},'queue':{'type':Sequelize[_0x7555('0x6')]},'uniqueid':{'type':Sequelize[_0x7555('0x6')]},'calleridname':{'type':Sequelize[_0x7555('0x6')]},'calleridnum':{'type':Sequelize[_0x7555('0x6')]},'completed':{'type':Sequelize[_0x7555('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x875a=['sequelize','exports','DATE','starttime','setDataValue','format','STRING','moment'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0x875a,0xaf));var _0xa875=function(_0x436dcc,_0x1e89c3){_0x436dcc=_0x436dcc-0x0;var _0x5dd52c=_0x875a[_0x436dcc];return _0x5dd52c;};'use strict';var moment=require(_0xa875('0x0'));var Sequelize=require(_0xa875('0x1'));module[_0xa875('0x2')]={'starttime':{'type':Sequelize[_0xa875('0x3')],'set':function(_0x251ca3){this['setDataValue'](_0xa875('0x4'),_0x251ca3);this[_0xa875('0x5')]('endtime',moment()[_0xa875('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xa875('0x3')]},'membername':{'type':Sequelize[_0xa875('0x7')]},'projectname':{'type':Sequelize[_0xa875('0x7')]},'queue':{'type':Sequelize[_0xa875('0x7')]},'uniqueid':{'type':Sequelize[_0xa875('0x7')]},'calleridname':{'type':Sequelize[_0xa875('0x7')]},'calleridnum':{'type':Sequelize[_0xa875('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 50a0e2b..01cde0e 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 _0xdde0=['then','destroy','sendStatus','stack','name','send','index','JscriptySessionReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','undefined','count','Content-Range','apply','update'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xdde0,0x1bc));var _0x0dde=function(_0xd476a8,_0x35c4bb){_0xd476a8=_0xd476a8-0x0;var _0x210b04=_0xdde0[_0xd476a8];return _0x210b04;};'use strict';var emlformat=require(_0x0dde('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dde('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0dde('0x2'));var moment=require(_0x0dde('0x3'));var BPromise=require(_0x0dde('0x4'));var Mustache=require(_0x0dde('0x5'));var util=require(_0x0dde('0x6'));var path=require(_0x0dde('0x7'));var sox=require(_0x0dde('0x8'));var csv=require(_0x0dde('0x9'));var ejs=require(_0x0dde('0xa'));var fs=require('fs');var fs_extra=require(_0x0dde('0xb'));var _=require(_0x0dde('0xc'));var squel=require(_0x0dde('0xd'));var crypto=require(_0x0dde('0xe'));var jsforce=require(_0x0dde('0xf'));var deskjs=require(_0x0dde('0x10'));var toCsv=require(_0x0dde('0x9'));var querystring=require('querystring');var Papa=require(_0x0dde('0x11'));var Redis=require(_0x0dde('0x12'));var authService=require(_0x0dde('0x13'));var qs=require(_0x0dde('0x14'));var as=require(_0x0dde('0x15'));var hardwareService=require(_0x0dde('0x16'));var logger=require(_0x0dde('0x17'))(_0x0dde('0x18'));var utils=require(_0x0dde('0x19'));var config=require(_0x0dde('0x1a'));var licenseUtil=require(_0x0dde('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fe653,_0x5f0fd3){_0x5f0fd3=_0x5f0fd3||0xcc;return function(_0x1acc50){if(_0x1acc50){return _0x2fe653['sendStatus'](_0x5f0fd3);}return _0x2fe653[_0x0dde('0x1c')](_0x5f0fd3)['end']();};}function respondWithResult(_0xb1064b,_0x3c377b){_0x3c377b=_0x3c377b||0xc8;return function(_0x4c66d4){if(_0x4c66d4){return _0xb1064b[_0x0dde('0x1c')](_0x3c377b)['json'](_0x4c66d4);}};}function respondWithFilteredResult(_0x3dfa66,_0x2e9298){return function(_0x336ae0){if(_0x336ae0){var _0x3c20ee=typeof _0x2e9298[_0x0dde('0x1d')]==='undefined'&&typeof _0x2e9298[_0x0dde('0x1e')]===_0x0dde('0x1f');var _0x84fb73=_0x336ae0['count'];var _0x13f32d=_0x3c20ee?0x0:_0x2e9298['offset'];var _0x1ec66f=_0x3c20ee?_0x336ae0[_0x0dde('0x20')]:_0x2e9298[_0x0dde('0x1d')]+_0x2e9298[_0x0dde('0x1e')];var _0x59a4fb;if(_0x1ec66f>=_0x84fb73){_0x1ec66f=_0x84fb73;_0x59a4fb=0xc8;}else{_0x59a4fb=0xce;}_0x3dfa66[_0x0dde('0x1c')](_0x59a4fb);return _0x3dfa66['set'](_0x0dde('0x21'),_0x13f32d+'-'+_0x1ec66f+'/'+_0x84fb73)['json'](_0x336ae0);}return null;};}function patchUpdates(_0x3a2927){return function(_0x5f3ccd){try{jsonpatch[_0x0dde('0x22')](_0x5f3ccd,_0x3a2927,!![]);}catch(_0x4255af){return BPromise['reject'](_0x4255af);}return _0x5f3ccd['save']();};}function saveUpdates(_0x1f2017,_0x4acdfe){return function(_0x213f0b){if(_0x213f0b){return _0x213f0b[_0x0dde('0x23')](_0x1f2017)[_0x0dde('0x24')](function(_0x4234f4){return _0x4234f4;});}return null;};}function removeEntity(_0xb0b9a9,_0x40fe59){return function(_0x4170f6){if(_0x4170f6){return _0x4170f6[_0x0dde('0x25')]()['then'](function(){_0xb0b9a9[_0x0dde('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5512bd,_0x2c6b91){return function(_0x3319a1){if(!_0x3319a1){_0x5512bd[_0x0dde('0x26')](0x194);}return _0x3319a1;};}function handleError(_0x55825e,_0x16d949){_0x16d949=_0x16d949||0x1f4;return function(_0x5e1d87){logger['error'](_0x5e1d87[_0x0dde('0x27')]);if(_0x5e1d87[_0x0dde('0x28')]){delete _0x5e1d87[_0x0dde('0x28')];}_0x55825e[_0x0dde('0x1c')](_0x16d949)[_0x0dde('0x29')](_0x5e1d87);};}exports[_0x0dde('0x2a')]=function(_0x1546b7,_0x34f5ec){var _0x4c0875={},_0x33394f={},_0x52248c={'count':0x0,'rows':[]};var _0x514ab3=_['map'](db[_0x0dde('0x2b')]['rawAttributes'],function(_0x1b4f66){return{'name':_0x1b4f66[_0x0dde('0x2c')],'type':_0x1b4f66[_0x0dde('0x2d')][_0x0dde('0x2e')]};});_0x33394f[_0x0dde('0x2f')]=_[_0x0dde('0x30')](_0x514ab3,_0x0dde('0x28'));_0x33394f[_0x0dde('0x31')]=_[_0x0dde('0x32')](_0x1546b7[_0x0dde('0x31')]);_0x33394f[_0x0dde('0x33')]=_[_0x0dde('0x34')](_0x33394f[_0x0dde('0x2f')],_0x33394f[_0x0dde('0x31')]);_0x4c0875[_0x0dde('0x35')]=_[_0x0dde('0x34')](_0x33394f[_0x0dde('0x2f')],qs[_0x0dde('0x36')](_0x1546b7[_0x0dde('0x31')][_0x0dde('0x36')]));_0x4c0875[_0x0dde('0x35')]=_0x4c0875[_0x0dde('0x35')][_0x0dde('0x37')]?_0x4c0875[_0x0dde('0x35')]:_0x33394f['model'];if(!_0x1546b7[_0x0dde('0x31')]['hasOwnProperty'](_0x0dde('0x38'))){_0x4c0875['limit']=qs[_0x0dde('0x1e')](_0x1546b7[_0x0dde('0x31')][_0x0dde('0x1e')]);_0x4c0875[_0x0dde('0x1d')]=qs[_0x0dde('0x1d')](_0x1546b7[_0x0dde('0x31')][_0x0dde('0x1d')]);}_0x4c0875[_0x0dde('0x39')]=qs['sort'](_0x1546b7[_0x0dde('0x31')][_0x0dde('0x3a')]);_0x4c0875[_0x0dde('0x3b')]=qs[_0x0dde('0x33')](_[_0x0dde('0x3c')](_0x1546b7[_0x0dde('0x31')],_0x33394f[_0x0dde('0x33')]),_0x514ab3);if(_0x1546b7[_0x0dde('0x31')][_0x0dde('0x3d')]){_0x4c0875[_0x0dde('0x3b')]=_[_0x0dde('0x3e')](_0x4c0875[_0x0dde('0x3b')],{'$or':_[_0x0dde('0x30')](_0x514ab3,function(_0x1da9ed){if(_0x1da9ed[_0x0dde('0x2d')]!==_0x0dde('0x3f')){var _0x13a2de={};_0x13a2de[_0x1da9ed[_0x0dde('0x28')]]={'$like':'%'+_0x1546b7[_0x0dde('0x31')][_0x0dde('0x3d')]+'%'};return _0x13a2de;}})});}_0x4c0875=_['merge']({},_0x4c0875,_0x1546b7['options']);var _0x1a4c5f={'where':_0x4c0875['where']};return db['JscriptySessionReport'][_0x0dde('0x20')](_0x1a4c5f)[_0x0dde('0x24')](function(_0x54c08c){_0x52248c[_0x0dde('0x20')]=_0x54c08c;if(_0x1546b7[_0x0dde('0x31')]['includeAll']){_0x4c0875[_0x0dde('0x40')]=[{'all':!![]}];}return db[_0x0dde('0x2b')][_0x0dde('0x41')](_0x4c0875);})['then'](function(_0x57f31f){_0x52248c[_0x0dde('0x42')]=_0x57f31f;return _0x52248c;})[_0x0dde('0x24')](respondWithFilteredResult(_0x34f5ec,_0x4c0875))[_0x0dde('0x43')](handleError(_0x34f5ec,null));};exports[_0x0dde('0x44')]=function(_0x45f943,_0x19e1e0){var _0x1e638a={'raw':!![],'where':{'id':_0x45f943[_0x0dde('0x45')]['id']}},_0x5c35b4={};_0x5c35b4[_0x0dde('0x2f')]=_[_0x0dde('0x32')](db[_0x0dde('0x2b')][_0x0dde('0x46')]);_0x5c35b4[_0x0dde('0x31')]=_[_0x0dde('0x32')](_0x45f943[_0x0dde('0x31')]);_0x5c35b4[_0x0dde('0x33')]=_[_0x0dde('0x34')](_0x5c35b4[_0x0dde('0x2f')],_0x5c35b4['query']);_0x1e638a[_0x0dde('0x35')]=_['intersection'](_0x5c35b4[_0x0dde('0x2f')],qs['fields'](_0x45f943['query'][_0x0dde('0x36')]));_0x1e638a[_0x0dde('0x35')]=_0x1e638a['attributes']['length']?_0x1e638a[_0x0dde('0x35')]:_0x5c35b4['model'];if(_0x45f943[_0x0dde('0x31')][_0x0dde('0x47')]){_0x1e638a[_0x0dde('0x40')]=[{'all':!![]}];}_0x1e638a=_[_0x0dde('0x3e')]({},_0x1e638a,_0x45f943[_0x0dde('0x48')]);return db[_0x0dde('0x2b')][_0x0dde('0x49')](_0x1e638a)['then'](handleEntityNotFound(_0x19e1e0,null))[_0x0dde('0x24')](respondWithResult(_0x19e1e0,null))[_0x0dde('0x43')](handleError(_0x19e1e0,null));};exports[_0x0dde('0x4a')]=function(_0x43abd0,_0x2a91f1){return db[_0x0dde('0x2b')][_0x0dde('0x4a')](_0x43abd0[_0x0dde('0x4b')],{})['then'](respondWithResult(_0x2a91f1,0xc9))[_0x0dde('0x43')](handleError(_0x2a91f1,null));};exports[_0x0dde('0x23')]=function(_0x8fb6fb,_0x18215c){if(_0x8fb6fb[_0x0dde('0x4b')]['id']){delete _0x8fb6fb[_0x0dde('0x4b')]['id'];}return db[_0x0dde('0x2b')][_0x0dde('0x49')]({'where':{'id':_0x8fb6fb[_0x0dde('0x45')]['id']}})[_0x0dde('0x24')](handleEntityNotFound(_0x18215c,null))[_0x0dde('0x24')](saveUpdates(_0x8fb6fb['body'],null))['then'](respondWithResult(_0x18215c,null))[_0x0dde('0x43')](handleError(_0x18215c,null));};exports[_0x0dde('0x25')]=function(_0x1b2e5c,_0x1061f5){return db[_0x0dde('0x2b')][_0x0dde('0x49')]({'where':{'id':_0x1b2e5c[_0x0dde('0x45')]['id']}})[_0x0dde('0x24')](handleEntityNotFound(_0x1061f5,null))[_0x0dde('0x24')](removeEntity(_0x1061f5,null))[_0x0dde('0x43')](handleError(_0x1061f5,null));};exports['describe']=function(_0xfa9aab,_0x3114db){return db[_0x0dde('0x2b')]['describe']()['then'](respondWithResult(_0x3114db,null))['catch'](handleError(_0x3114db,null));};exports[_0x0dde('0x4c')]=function(_0xc0f6a4,_0x2bb382,_0x584fc5){var _0x5dc02e={'raw':!![],'where':{}};var _0x3774c9={};var _0x253f06={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0dde('0x4d')]({'where':{'id':_0xc0f6a4[_0x0dde('0x45')]['id']}})[_0x0dde('0x24')](handleEntityNotFound(_0x2bb382,null))['then'](function(_0x3e061d){if(_0x3e061d){_0x3774c9['model']=_[_0x0dde('0x32')](db[_0x0dde('0x4e')][_0x0dde('0x46')]);_0x3774c9[_0x0dde('0x31')]=_[_0x0dde('0x32')](_0xc0f6a4[_0x0dde('0x31')]);_0x3774c9[_0x0dde('0x33')]=_['intersection'](_0x3774c9[_0x0dde('0x2f')],_0x3774c9[_0x0dde('0x31')]);_0x5dc02e[_0x0dde('0x35')]=_[_0x0dde('0x34')](_0x3774c9[_0x0dde('0x2f')],qs['fields'](_0xc0f6a4['query']['fields']));_0x5dc02e['attributes']=_0x5dc02e['attributes'][_0x0dde('0x37')]?_0x5dc02e['attributes']:_0x3774c9[_0x0dde('0x2f')];if(!_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x4f')]('nolimit')){_0x5dc02e[_0x0dde('0x1e')]=qs[_0x0dde('0x1e')](_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x1e')]);_0x5dc02e[_0x0dde('0x1d')]=qs[_0x0dde('0x1d')](_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x1d')]);}_0x5dc02e[_0x0dde('0x39')]=qs['sort'](_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x3a')]);_0x5dc02e[_0x0dde('0x3b')]=qs[_0x0dde('0x33')](_[_0x0dde('0x3c')](_0xc0f6a4[_0x0dde('0x31')],_0x3774c9[_0x0dde('0x33')]));_0x5dc02e['where']['SessionId']=_0x3e061d['id'];if(_0xc0f6a4[_0x0dde('0x31')][_0x0dde('0x3d')]){_0x5dc02e[_0x0dde('0x3b')]=_[_0x0dde('0x3e')](_0x5dc02e[_0x0dde('0x3b')],{'$or':_[_0x0dde('0x30')](_0x5dc02e[_0x0dde('0x35')],function(_0x44456c){var _0x6cd7bd={};_0x6cd7bd[_0x44456c]={'$like':'%'+_0xc0f6a4['query'][_0x0dde('0x3d')]+'%'};return _0x6cd7bd;})});}_0x5dc02e=_[_0x0dde('0x3e')]({},_0x5dc02e,_0xc0f6a4['options']);return db['JscriptyQuestionReport'][_0x0dde('0x20')]({'where':_0x5dc02e[_0x0dde('0x3b')]})['then'](function(_0x2ef9ea){_0x253f06[_0x0dde('0x20')]=_0x2ef9ea;if(_0xc0f6a4[_0x0dde('0x31')]['includeAll']){_0x5dc02e[_0x0dde('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x0dde('0x41')](_0x5dc02e);})[_0x0dde('0x24')](function(_0x189a9b){_0x253f06[_0x0dde('0x42')]=_0x189a9b;return _0x253f06;});}})['then'](respondWithFilteredResult(_0x2bb382,_0x5dc02e))[_0x0dde('0x43')](handleError(_0x2bb382,null));}; \ No newline at end of file +var _0x0a54=['send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','order','sort','where','filters','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','show','params','fields','find','create','catch','body','describe','JscriptyQuestionReport','hasOwnProperty','nolimit','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0a54,0x118));var _0x40a5=function(_0x48c2ae,_0x4cea90){_0x48c2ae=_0x48c2ae-0x0;var _0x8f7531=_0x0a54[_0x48c2ae];return _0x8f7531;};'use strict';var emlformat=require(_0x40a5('0x0'));var rimraf=require(_0x40a5('0x1'));var zipdir=require(_0x40a5('0x2'));var jsonpatch=require(_0x40a5('0x3'));var rp=require(_0x40a5('0x4'));var moment=require(_0x40a5('0x5'));var BPromise=require(_0x40a5('0x6'));var Mustache=require('mustache');var util=require(_0x40a5('0x7'));var path=require(_0x40a5('0x8'));var sox=require(_0x40a5('0x9'));var csv=require('to-csv');var ejs=require(_0x40a5('0xa'));var fs=require('fs');var fs_extra=require(_0x40a5('0xb'));var _=require(_0x40a5('0xc'));var squel=require(_0x40a5('0xd'));var crypto=require('crypto');var jsforce=require(_0x40a5('0xe'));var deskjs=require(_0x40a5('0xf'));var toCsv=require(_0x40a5('0x10'));var querystring=require('querystring');var Papa=require(_0x40a5('0x11'));var Redis=require('ioredis');var authService=require(_0x40a5('0x12'));var qs=require(_0x40a5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40a5('0x14'));var logger=require(_0x40a5('0x15'))('api');var utils=require(_0x40a5('0x16'));var config=require(_0x40a5('0x17'));var licenseUtil=require(_0x40a5('0x18'));var db=require(_0x40a5('0x19'))['db'];function respondWithStatusCode(_0x3a32f6,_0x1d8d05){_0x1d8d05=_0x1d8d05||0xcc;return function(_0x38c12a){if(_0x38c12a){return _0x3a32f6[_0x40a5('0x1a')](_0x1d8d05);}return _0x3a32f6['status'](_0x1d8d05)[_0x40a5('0x1b')]();};}function respondWithResult(_0x141a56,_0x5e68cf){_0x5e68cf=_0x5e68cf||0xc8;return function(_0x89bd4){if(_0x89bd4){return _0x141a56[_0x40a5('0x1c')](_0x5e68cf)[_0x40a5('0x1d')](_0x89bd4);}};}function respondWithFilteredResult(_0x2255d0,_0x5da1d3){return function(_0x39bb23){if(_0x39bb23){var _0x6d7204=typeof _0x5da1d3[_0x40a5('0x1e')]==='undefined'&&typeof _0x5da1d3[_0x40a5('0x1f')]==='undefined';var _0x341973=_0x39bb23[_0x40a5('0x20')];var _0x28a1c4=_0x6d7204?0x0:_0x5da1d3['offset'];var _0x2c6d8f=_0x6d7204?_0x39bb23[_0x40a5('0x20')]:_0x5da1d3[_0x40a5('0x1e')]+_0x5da1d3[_0x40a5('0x1f')];var _0x2474ea;if(_0x2c6d8f>=_0x341973){_0x2c6d8f=_0x341973;_0x2474ea=0xc8;}else{_0x2474ea=0xce;}_0x2255d0[_0x40a5('0x1c')](_0x2474ea);return _0x2255d0[_0x40a5('0x21')](_0x40a5('0x22'),_0x28a1c4+'-'+_0x2c6d8f+'/'+_0x341973)[_0x40a5('0x1d')](_0x39bb23);}return null;};}function patchUpdates(_0x1a2b9e){return function(_0x173853){try{jsonpatch[_0x40a5('0x23')](_0x173853,_0x1a2b9e,!![]);}catch(_0x577344){return BPromise[_0x40a5('0x24')](_0x577344);}return _0x173853[_0x40a5('0x25')]();};}function saveUpdates(_0x420256,_0x462788){return function(_0x4e5317){if(_0x4e5317){return _0x4e5317[_0x40a5('0x26')](_0x420256)[_0x40a5('0x27')](function(_0x25205d){return _0x25205d;});}return null;};}function removeEntity(_0x1d37e9,_0x5227da){return function(_0x3aa5ae){if(_0x3aa5ae){return _0x3aa5ae[_0x40a5('0x28')]()['then'](function(){_0x1d37e9['status'](0xcc)[_0x40a5('0x1b')]();});}};}function handleEntityNotFound(_0x637a2,_0x58d482){return function(_0x5d31df){if(!_0x5d31df){_0x637a2['sendStatus'](0x194);}return _0x5d31df;};}function handleError(_0x44a89e,_0x30a968){_0x30a968=_0x30a968||0x1f4;return function(_0x11d39c){logger[_0x40a5('0x29')](_0x11d39c[_0x40a5('0x2a')]);if(_0x11d39c[_0x40a5('0x2b')]){delete _0x11d39c[_0x40a5('0x2b')];}_0x44a89e[_0x40a5('0x1c')](_0x30a968)[_0x40a5('0x2c')](_0x11d39c);};}exports['index']=function(_0x2d29c8,_0x4da88e){var _0x4f7711={},_0x1c7982={},_0x143ae6={'count':0x0,'rows':[]};var _0x24dc61=_[_0x40a5('0x2d')](db['JscriptySessionReport'][_0x40a5('0x2e')],function(_0x1fc594){return{'name':_0x1fc594[_0x40a5('0x2f')],'type':_0x1fc594[_0x40a5('0x30')][_0x40a5('0x31')]};});_0x1c7982[_0x40a5('0x32')]=_[_0x40a5('0x2d')](_0x24dc61,_0x40a5('0x2b'));_0x1c7982[_0x40a5('0x33')]=_[_0x40a5('0x34')](_0x2d29c8['query']);_0x1c7982['filters']=_[_0x40a5('0x35')](_0x1c7982['model'],_0x1c7982[_0x40a5('0x33')]);_0x4f7711[_0x40a5('0x36')]=_['intersection'](_0x1c7982[_0x40a5('0x32')],qs['fields'](_0x2d29c8[_0x40a5('0x33')]['fields']));_0x4f7711[_0x40a5('0x36')]=_0x4f7711[_0x40a5('0x36')][_0x40a5('0x37')]?_0x4f7711[_0x40a5('0x36')]:_0x1c7982['model'];if(!_0x2d29c8['query']['hasOwnProperty']('nolimit')){_0x4f7711[_0x40a5('0x1f')]=qs[_0x40a5('0x1f')](_0x2d29c8['query'][_0x40a5('0x1f')]);_0x4f7711['offset']=qs['offset'](_0x2d29c8['query'][_0x40a5('0x1e')]);}_0x4f7711[_0x40a5('0x38')]=qs[_0x40a5('0x39')](_0x2d29c8[_0x40a5('0x33')]['sort']);_0x4f7711[_0x40a5('0x3a')]=qs[_0x40a5('0x3b')](_['pick'](_0x2d29c8['query'],_0x1c7982[_0x40a5('0x3b')]),_0x24dc61);if(_0x2d29c8[_0x40a5('0x33')][_0x40a5('0x3c')]){_0x4f7711[_0x40a5('0x3a')]=_[_0x40a5('0x3d')](_0x4f7711[_0x40a5('0x3a')],{'$or':_[_0x40a5('0x2d')](_0x24dc61,function(_0x1d356e){if(_0x1d356e[_0x40a5('0x30')]!==_0x40a5('0x3e')){var _0x3f2ada={};_0x3f2ada[_0x1d356e[_0x40a5('0x2b')]]={'$like':'%'+_0x2d29c8[_0x40a5('0x33')][_0x40a5('0x3c')]+'%'};return _0x3f2ada;}})});}_0x4f7711=_['merge']({},_0x4f7711,_0x2d29c8[_0x40a5('0x3f')]);var _0x3f305e={'where':_0x4f7711[_0x40a5('0x3a')]};return db[_0x40a5('0x40')][_0x40a5('0x20')](_0x3f305e)['then'](function(_0x5b21f8){_0x143ae6[_0x40a5('0x20')]=_0x5b21f8;if(_0x2d29c8['query'][_0x40a5('0x41')]){_0x4f7711[_0x40a5('0x42')]=[{'all':!![]}];}return db[_0x40a5('0x40')][_0x40a5('0x43')](_0x4f7711);})['then'](function(_0x1aa71f){_0x143ae6[_0x40a5('0x44')]=_0x1aa71f;return _0x143ae6;})[_0x40a5('0x27')](respondWithFilteredResult(_0x4da88e,_0x4f7711))['catch'](handleError(_0x4da88e,null));};exports[_0x40a5('0x45')]=function(_0x1cdbe6,_0x186986){var _0x3dd6a2={'raw':!![],'where':{'id':_0x1cdbe6[_0x40a5('0x46')]['id']}},_0x53e3d9={};_0x53e3d9['model']=_['keys'](db[_0x40a5('0x40')][_0x40a5('0x2e')]);_0x53e3d9[_0x40a5('0x33')]=_[_0x40a5('0x34')](_0x1cdbe6['query']);_0x53e3d9[_0x40a5('0x3b')]=_[_0x40a5('0x35')](_0x53e3d9['model'],_0x53e3d9['query']);_0x3dd6a2[_0x40a5('0x36')]=_[_0x40a5('0x35')](_0x53e3d9[_0x40a5('0x32')],qs['fields'](_0x1cdbe6[_0x40a5('0x33')][_0x40a5('0x47')]));_0x3dd6a2[_0x40a5('0x36')]=_0x3dd6a2[_0x40a5('0x36')][_0x40a5('0x37')]?_0x3dd6a2['attributes']:_0x53e3d9['model'];if(_0x1cdbe6[_0x40a5('0x33')][_0x40a5('0x41')]){_0x3dd6a2[_0x40a5('0x42')]=[{'all':!![]}];}_0x3dd6a2=_['merge']({},_0x3dd6a2,_0x1cdbe6[_0x40a5('0x3f')]);return db[_0x40a5('0x40')][_0x40a5('0x48')](_0x3dd6a2)['then'](handleEntityNotFound(_0x186986,null))[_0x40a5('0x27')](respondWithResult(_0x186986,null))['catch'](handleError(_0x186986,null));};exports[_0x40a5('0x49')]=function(_0x13da69,_0x4cfffb){return db[_0x40a5('0x40')][_0x40a5('0x49')](_0x13da69['body'],{})['then'](respondWithResult(_0x4cfffb,0xc9))[_0x40a5('0x4a')](handleError(_0x4cfffb,null));};exports['update']=function(_0x2f2260,_0x1a0625){if(_0x2f2260['body']['id']){delete _0x2f2260['body']['id'];}return db[_0x40a5('0x40')][_0x40a5('0x48')]({'where':{'id':_0x2f2260[_0x40a5('0x46')]['id']}})[_0x40a5('0x27')](handleEntityNotFound(_0x1a0625,null))['then'](saveUpdates(_0x2f2260[_0x40a5('0x4b')],null))[_0x40a5('0x27')](respondWithResult(_0x1a0625,null))[_0x40a5('0x4a')](handleError(_0x1a0625,null));};exports[_0x40a5('0x28')]=function(_0x76ec08,_0x1f48d0){return db['JscriptySessionReport'][_0x40a5('0x48')]({'where':{'id':_0x76ec08[_0x40a5('0x46')]['id']}})[_0x40a5('0x27')](handleEntityNotFound(_0x1f48d0,null))[_0x40a5('0x27')](removeEntity(_0x1f48d0,null))[_0x40a5('0x4a')](handleError(_0x1f48d0,null));};exports[_0x40a5('0x4c')]=function(_0x714abf,_0x574626){return db['JscriptySessionReport'][_0x40a5('0x4c')]()['then'](respondWithResult(_0x574626,null))[_0x40a5('0x4a')](handleError(_0x574626,null));};exports['getQuestions']=function(_0x4dd39f,_0x503bc5,_0x52414b){var _0x3de3a9={'raw':!![],'where':{}};var _0x54ab46={};var _0x25ce64={'count':0x0,'rows':[]};return db[_0x40a5('0x40')]['findOne']({'where':{'id':_0x4dd39f[_0x40a5('0x46')]['id']}})[_0x40a5('0x27')](handleEntityNotFound(_0x503bc5,null))[_0x40a5('0x27')](function(_0x2597d6){if(_0x2597d6){_0x54ab46[_0x40a5('0x32')]=_[_0x40a5('0x34')](db[_0x40a5('0x4d')][_0x40a5('0x2e')]);_0x54ab46[_0x40a5('0x33')]=_[_0x40a5('0x34')](_0x4dd39f['query']);_0x54ab46[_0x40a5('0x3b')]=_['intersection'](_0x54ab46['model'],_0x54ab46['query']);_0x3de3a9[_0x40a5('0x36')]=_['intersection'](_0x54ab46[_0x40a5('0x32')],qs[_0x40a5('0x47')](_0x4dd39f['query'][_0x40a5('0x47')]));_0x3de3a9[_0x40a5('0x36')]=_0x3de3a9[_0x40a5('0x36')][_0x40a5('0x37')]?_0x3de3a9['attributes']:_0x54ab46[_0x40a5('0x32')];if(!_0x4dd39f[_0x40a5('0x33')][_0x40a5('0x4e')](_0x40a5('0x4f'))){_0x3de3a9[_0x40a5('0x1f')]=qs[_0x40a5('0x1f')](_0x4dd39f[_0x40a5('0x33')][_0x40a5('0x1f')]);_0x3de3a9[_0x40a5('0x1e')]=qs[_0x40a5('0x1e')](_0x4dd39f['query'][_0x40a5('0x1e')]);}_0x3de3a9['order']=qs[_0x40a5('0x39')](_0x4dd39f[_0x40a5('0x33')]['sort']);_0x3de3a9[_0x40a5('0x3a')]=qs[_0x40a5('0x3b')](_['pick'](_0x4dd39f[_0x40a5('0x33')],_0x54ab46[_0x40a5('0x3b')]));_0x3de3a9[_0x40a5('0x3a')][_0x40a5('0x50')]=_0x2597d6['id'];if(_0x4dd39f[_0x40a5('0x33')][_0x40a5('0x3c')]){_0x3de3a9[_0x40a5('0x3a')]=_[_0x40a5('0x3d')](_0x3de3a9[_0x40a5('0x3a')],{'$or':_['map'](_0x3de3a9[_0x40a5('0x36')],function(_0x453311){var _0x77a1ad={};_0x77a1ad[_0x453311]={'$like':'%'+_0x4dd39f[_0x40a5('0x33')]['filter']+'%'};return _0x77a1ad;})});}_0x3de3a9=_[_0x40a5('0x3d')]({},_0x3de3a9,_0x4dd39f[_0x40a5('0x3f')]);return db['JscriptyQuestionReport']['count']({'where':_0x3de3a9[_0x40a5('0x3a')]})[_0x40a5('0x27')](function(_0x42643d){_0x25ce64[_0x40a5('0x20')]=_0x42643d;if(_0x4dd39f[_0x40a5('0x33')][_0x40a5('0x41')]){_0x3de3a9[_0x40a5('0x42')]=[{'all':!![]}];}return db[_0x40a5('0x4d')]['findAll'](_0x3de3a9);})['then'](function(_0x511c27){_0x25ce64[_0x40a5('0x44')]=_0x511c27;return _0x25ce64;});}})[_0x40a5('0x27')](respondWithFilteredResult(_0x503bc5,_0x3de3a9))[_0x40a5('0x4a')](handleError(_0x503bc5,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2014f55..389234a 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 _0x6b8f=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','request-promise','path','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x3a9b37,_0x4ab4e0){var _0xefd566=function(_0x19e246){while(--_0x19e246){_0x3a9b37['push'](_0x3a9b37['shift']());}};_0xefd566(++_0x4ab4e0);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x2afca7,_0xa1a787){_0x2afca7=_0x2afca7-0x0;var _0xa02f01=_0x6b8f[_0x2afca7];return _0xa02f01;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x4998bd,_0x3faca9){var _0x5d4b6c=function(_0x4b7f6e){while(--_0x4b7f6e){_0x4998bd['push'](_0x4998bd['shift']());}};_0x5d4b6c(++_0x3faca9);}(_0x7bd0,0x111));var _0x07bd=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x7bd0[_0x3fe393];return _0x534d14;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var logger=require(_0x07bd('0x2'))(_0x07bd('0x3'));var moment=require(_0x07bd('0x4'));var BPromise=require(_0x07bd('0x5'));var rp=require(_0x07bd('0x6'));var fs=require('fs');var path=require(_0x07bd('0x7'));var rimraf=require('rimraf');var config=require(_0x07bd('0x8'));var attributes=require(_0x07bd('0x9'));module[_0x07bd('0xa')]=function(_0x313548,_0x3e8349){return _0x313548[_0x07bd('0xb')](_0x07bd('0xc'),attributes,{'tableName':'report_jscripty_sessions','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 d38c73c..276b460 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 _0xd046=['ioredis','../../config/logger','../../config/environment','http','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xd046,0x129));var _0x6d04=function(_0x58b955,_0x19aae5){_0x58b955=_0x58b955-0x0;var _0x4f7953=_0xd046[_0x58b955];return _0x4f7953;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});} \ No newline at end of file +var _0x2542=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2495dc,_0x22055a){var _0x3260d4=function(_0x52741e){while(--_0x52741e){_0x2495dc['push'](_0x2495dc['shift']());}};_0x3260d4(++_0x22055a);}(_0x2542,0x169));var _0x2254=function(_0x207bd7,_0x2410ed){_0x207bd7=_0x207bd7-0x0;var _0x8670d=_0x2542[_0x207bd7];return _0x8670d;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 79f36c8..ee27757 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 _0x305a=['./license.controller','index','put','/:id','update','get','/download_log_file','isAuthenticated','downloadLogFile','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4ad878,_0x5d6b8f){var _0x1a562a=function(_0x252a18){while(--_0x252a18){_0x4ad878['push'](_0x4ad878['shift']());}};_0x1a562a(++_0x5d6b8f);}(_0x305a,0x89));var _0xa305=function(_0x1ffa39,_0x2e0533){_0x1ffa39=_0x1ffa39-0x0;var _0x1011de=_0x305a[_0x1ffa39];return _0x1011de;};'use strict';var multer=require(_0xa305('0x0'));var util=require(_0xa305('0x1'));var path=require(_0xa305('0x2'));var timeout=require(_0xa305('0x3'));var express=require(_0xa305('0x4'));var router=express[_0xa305('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa305('0x6'));var config=require('../../config/environment');var controller=require(_0xa305('0x7'));router['get']('/',controller[_0xa305('0x8')]);router[_0xa305('0x9')](_0xa305('0xa'),auth['isAuthenticated'](),controller[_0xa305('0xb')]);router[_0xa305('0xc')](_0xa305('0xd'),auth[_0xa305('0xe')](),controller[_0xa305('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1e55=['isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id'];(function(_0x499da4,_0x1cd4a5){var _0x32c7ec=function(_0x3cb854){while(--_0x3cb854){_0x499da4['push'](_0x499da4['shift']());}};_0x32c7ec(++_0x1cd4a5);}(_0x1e55,0x1bf));var _0x51e5=function(_0x1edb4e,_0x44f124){_0x1edb4e=_0x1edb4e-0x0;var _0x28a271=_0x1e55[_0x1edb4e];return _0x28a271;};'use strict';var multer=require('multer');var util=require(_0x51e5('0x0'));var path=require(_0x51e5('0x1'));var timeout=require(_0x51e5('0x2'));var express=require(_0x51e5('0x3'));var router=express[_0x51e5('0x4')]();var fs_extra=require(_0x51e5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x51e5('0x6'));var config=require(_0x51e5('0x7'));var controller=require(_0x51e5('0x8'));router[_0x51e5('0x9')]('/',controller[_0x51e5('0xa')]);router['put'](_0x51e5('0xb'),auth[_0x51e5('0xc')](),controller[_0x51e5('0xd')]);router['get'](_0x51e5('0xe'),auth[_0x51e5('0xc')](),controller[_0x51e5('0xf')]);module[_0x51e5('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a3cd469..26699e4 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 _0x3427=['STRING','TEXT'];(function(_0x5f4668,_0x3ccba7){var _0x265a7b=function(_0x4e6bed){while(--_0x4e6bed){_0x5f4668['push'](_0x5f4668['shift']());}};_0x265a7b(++_0x3ccba7);}(_0x3427,0x133));var _0x7342=function(_0x24c523,_0x5f4a6c){_0x24c523=_0x24c523-0x0;var _0x3d135e=_0x3427[_0x24c523];return _0x3d135e;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x7342('0x0')]},'data1':{'type':Sequelize[_0x7342('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5cd4=['sequelize','STRING','INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5cd4,0x150));var _0x45cd=function(_0x5d553f,_0x36f460){_0x5d553f=_0x5d553f-0x0;var _0x1dac63=_0x5cd4[_0x5d553f];return _0x1dac63;};'use strict';var Sequelize=require(_0x45cd('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x45cd('0x1')]},'data2':{'type':Sequelize[_0x45cd('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x45cd('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index e496a4f..5573ff2 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 _0xd47d=['text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','License','rawAttributes','query','filters','intersection','attributes','model','fields','length','options','getLicense','catch','body','params','get','checkLicense','key','demo','license-info.log','join','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type'];(function(_0x25cdb9,_0x4d338f){var _0x2ce804=function(_0xd1eb7e){while(--_0xd1eb7e){_0x25cdb9['push'](_0x25cdb9['shift']());}};_0x2ce804(++_0x4d338f);}(_0xd47d,0xd7));var _0xdd47=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0xd47d[_0x764874];return _0x29f9d5;};'use strict';var emlformat=require(_0xdd47('0x0'));var rimraf=require(_0xdd47('0x1'));var zipdir=require(_0xdd47('0x2'));var jsonpatch=require(_0xdd47('0x3'));var rp=require('request-promise');var moment=require(_0xdd47('0x4'));var BPromise=require(_0xdd47('0x5'));var Mustache=require(_0xdd47('0x6'));var util=require(_0xdd47('0x7'));var path=require('path');var sox=require(_0xdd47('0x8'));var csv=require(_0xdd47('0x9'));var ejs=require(_0xdd47('0xa'));var fs=require('fs');var fs_extra=require(_0xdd47('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdd47('0xc'));var jsforce=require(_0xdd47('0xd'));var deskjs=require(_0xdd47('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdd47('0xf'));var Papa=require(_0xdd47('0x10'));var Redis=require('ioredis');var authService=require(_0xdd47('0x11'));var qs=require(_0xdd47('0x12'));var as=require(_0xdd47('0x13'));var hardwareService=require(_0xdd47('0x14'));var logger=require(_0xdd47('0x15'))(_0xdd47('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd47('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9f12b6,_0x2894cc){_0x2894cc=_0x2894cc||0xcc;return function(_0x52a44c){if(_0x52a44c){return _0x9f12b6['sendStatus'](_0x2894cc);}return _0x9f12b6['status'](_0x2894cc)['end']();};}function respondWithResult(_0x20b89e,_0x25b133){_0x25b133=_0x25b133||0xc8;return function(_0x5b3332){if(_0x5b3332){return _0x20b89e[_0xdd47('0x18')](_0x25b133)[_0xdd47('0x19')](_0x5b3332);}};}function respondWithFilteredResult(_0x56da2e,_0x34782a){return function(_0x199142){if(_0x199142){var _0xc9c8f5=typeof _0x34782a[_0xdd47('0x1a')]==='undefined'&&typeof _0x34782a[_0xdd47('0x1b')]===_0xdd47('0x1c');var _0x3385e6=_0x199142[_0xdd47('0x1d')];var _0x41eed8=_0xc9c8f5?0x0:_0x34782a[_0xdd47('0x1a')];var _0x4f72fe=_0xc9c8f5?_0x199142[_0xdd47('0x1d')]:_0x34782a['offset']+_0x34782a['limit'];var _0xe3072a;if(_0x4f72fe>=_0x3385e6){_0x4f72fe=_0x3385e6;_0xe3072a=0xc8;}else{_0xe3072a=0xce;}_0x56da2e[_0xdd47('0x18')](_0xe3072a);return _0x56da2e['set'](_0xdd47('0x1e'),_0x41eed8+'-'+_0x4f72fe+'/'+_0x3385e6)[_0xdd47('0x19')](_0x199142);}return null;};}function patchUpdates(_0x23716f){return function(_0x677d5e){try{jsonpatch[_0xdd47('0x1f')](_0x677d5e,_0x23716f,!![]);}catch(_0x2d9cd7){return BPromise[_0xdd47('0x20')](_0x2d9cd7);}return _0x677d5e[_0xdd47('0x21')]();};}function saveUpdates(_0x2e3cb2,_0x8af625){return function(_0x3a6de4){if(_0x3a6de4){return _0x3a6de4[_0xdd47('0x22')](_0x2e3cb2)[_0xdd47('0x23')](function(_0x2ba237){return _0x2ba237;});}return null;};}function removeEntity(_0x293016,_0x54fa80){return function(_0x13d9b9){if(_0x13d9b9){return _0x13d9b9['destroy']()[_0xdd47('0x23')](function(){_0x293016[_0xdd47('0x18')](0xcc)[_0xdd47('0x24')]();});}};}function handleEntityNotFound(_0x5425f4,_0xfd389f){return function(_0xd77d25){if(!_0xd77d25){_0x5425f4[_0xdd47('0x25')](0x194);}return _0xd77d25;};}function handleError(_0x1a76e4,_0x347a0e){_0x347a0e=_0x347a0e||0x1f4;return function(_0x3b0af8){logger[_0xdd47('0x26')](_0x3b0af8[_0xdd47('0x27')]);if(_0x3b0af8[_0xdd47('0x28')]){delete _0x3b0af8['name'];}_0x1a76e4[_0xdd47('0x18')](_0x347a0e)[_0xdd47('0x29')](_0x3b0af8);};}var utilLicense=require('../../config/license/util');exports[_0xdd47('0x2a')]=function(_0x335d77,_0x12ba9f){var _0x4ea48e={'raw':!![],'where':{'id':0x1}},_0x121659={};_0x121659['model']=_['keys'](db[_0xdd47('0x2b')][_0xdd47('0x2c')]);_0x121659['query']=_['keys'](_0x335d77[_0xdd47('0x2d')]);_0x121659[_0xdd47('0x2e')]=_[_0xdd47('0x2f')](_0x121659['model'],_0x121659[_0xdd47('0x2d')]);_0x4ea48e[_0xdd47('0x30')]=_[_0xdd47('0x2f')](_0x121659[_0xdd47('0x31')],qs[_0xdd47('0x32')](_0x335d77[_0xdd47('0x2d')][_0xdd47('0x32')]));_0x4ea48e['attributes']=_0x4ea48e[_0xdd47('0x30')][_0xdd47('0x33')]?_0x4ea48e[_0xdd47('0x30')]:_0x121659[_0xdd47('0x31')];_0x4ea48e=_['merge']({},_0x4ea48e,_0x335d77[_0xdd47('0x34')]);return utilLicense[_0xdd47('0x35')](_0x4ea48e)['then'](respondWithResult(_0x12ba9f,null))[_0xdd47('0x36')](handleError(_0x12ba9f,null));};exports['update']=function(_0x4e2eb8,_0x3b63e2){if(_0x4e2eb8[_0xdd47('0x37')]['id']){delete _0x4e2eb8[_0xdd47('0x37')]['id'];}return db[_0xdd47('0x2b')]['find']({'where':{'id':_0x4e2eb8[_0xdd47('0x38')]['id']}})[_0xdd47('0x23')](handleEntityNotFound(_0x3b63e2,null))['then'](function(_0x5dad22){var _0x4da0ec=_0x5dad22[_0xdd47('0x39')]({'plain':!![]});return utilLicense[_0xdd47('0x3a')](_0x4da0ec,_0x4e2eb8[_0xdd47('0x37')][_0xdd47('0x3b')]);})[_0xdd47('0x23')](function(_0x14e359){if(!_0x14e359[_0xdd47('0x3c')]){return saveUpdates(_0x4e2eb8[_0xdd47('0x37')],null);}return _0x14e359;})[_0xdd47('0x23')](respondWithResult(_0x3b63e2,null))['catch'](handleError(_0x3b63e2,null));};exports['downloadLogFile']=function(_0x19e626,_0xedf42b){var _0x4efaca=_0xdd47('0x3d');var _0x48afc4=path[_0xdd47('0x3e')]('/var',_0xdd47('0x3f'),_0xdd47('0x40'),_0x4efaca);_0xedf42b['setHeader'](_0xdd47('0x41'),_0xdd47('0x42')+_0x4efaca);_0xedf42b[_0xdd47('0x43')](_0xdd47('0x44'),_0xdd47('0x45'));_0xedf42b[_0xdd47('0x46')](_0x48afc4);}; \ No newline at end of file +var _0x4206=['destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','merge','options','getLicense','catch','update','body','params','key','downloadLogFile','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','limit','set','reject','then'];(function(_0x1e369f,_0x26db32){var _0x126a31=function(_0x15ee32){while(--_0x15ee32){_0x1e369f['push'](_0x1e369f['shift']());}};_0x126a31(++_0x26db32);}(_0x4206,0x19c));var _0x6420=function(_0x2bb28f,_0xe8cb5a){_0x2bb28f=_0x2bb28f-0x0;var _0x53a47e=_0x4206[_0x2bb28f];return _0x53a47e;};'use strict';var emlformat=require(_0x6420('0x0'));var rimraf=require(_0x6420('0x1'));var zipdir=require(_0x6420('0x2'));var jsonpatch=require(_0x6420('0x3'));var rp=require(_0x6420('0x4'));var moment=require(_0x6420('0x5'));var BPromise=require(_0x6420('0x6'));var Mustache=require(_0x6420('0x7'));var util=require(_0x6420('0x8'));var path=require(_0x6420('0x9'));var sox=require(_0x6420('0xa'));var csv=require(_0x6420('0xb'));var ejs=require(_0x6420('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6420('0xd'));var squel=require(_0x6420('0xe'));var crypto=require(_0x6420('0xf'));var jsforce=require(_0x6420('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x6420('0xb'));var querystring=require(_0x6420('0x11'));var Papa=require('papaparse');var Redis=require(_0x6420('0x12'));var authService=require(_0x6420('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6420('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6420('0x15'))(_0x6420('0x16'));var utils=require(_0x6420('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6420('0x18'));var db=require(_0x6420('0x19'))['db'];function respondWithStatusCode(_0x41936f,_0x3ba5e4){_0x3ba5e4=_0x3ba5e4||0xcc;return function(_0x1d9875){if(_0x1d9875){return _0x41936f[_0x6420('0x1a')](_0x3ba5e4);}return _0x41936f['status'](_0x3ba5e4)[_0x6420('0x1b')]();};}function respondWithResult(_0x54e87a,_0x225506){_0x225506=_0x225506||0xc8;return function(_0x219d55){if(_0x219d55){return _0x54e87a[_0x6420('0x1c')](_0x225506)[_0x6420('0x1d')](_0x219d55);}};}function respondWithFilteredResult(_0x1b3a3b,_0x83f976){return function(_0x410208){if(_0x410208){var _0x157a3b=typeof _0x83f976['offset']===_0x6420('0x1e')&&typeof _0x83f976['limit']===_0x6420('0x1e');var _0x4c5327=_0x410208['count'];var _0x326d13=_0x157a3b?0x0:_0x83f976['offset'];var _0x5914bf=_0x157a3b?_0x410208['count']:_0x83f976[_0x6420('0x1f')]+_0x83f976[_0x6420('0x20')];var _0x56a8e1;if(_0x5914bf>=_0x4c5327){_0x5914bf=_0x4c5327;_0x56a8e1=0xc8;}else{_0x56a8e1=0xce;}_0x1b3a3b['status'](_0x56a8e1);return _0x1b3a3b[_0x6420('0x21')]('Content-Range',_0x326d13+'-'+_0x5914bf+'/'+_0x4c5327)[_0x6420('0x1d')](_0x410208);}return null;};}function patchUpdates(_0x2cf1ef){return function(_0x1f97b2){try{jsonpatch['apply'](_0x1f97b2,_0x2cf1ef,!![]);}catch(_0x269f38){return BPromise[_0x6420('0x22')](_0x269f38);}return _0x1f97b2['save']();};}function saveUpdates(_0x23d142,_0x2c46ef){return function(_0x1e4c55){if(_0x1e4c55){return _0x1e4c55['update'](_0x23d142)[_0x6420('0x23')](function(_0xc26b){return _0xc26b;});}return null;};}function removeEntity(_0x266ae8,_0x1397c6){return function(_0x475eb5){if(_0x475eb5){return _0x475eb5[_0x6420('0x24')]()[_0x6420('0x23')](function(){_0x266ae8['status'](0xcc)[_0x6420('0x1b')]();});}};}function handleEntityNotFound(_0x100ed6,_0xd45e3a){return function(_0x17441f){if(!_0x17441f){_0x100ed6[_0x6420('0x1a')](0x194);}return _0x17441f;};}function handleError(_0x11da50,_0x93ef71){_0x93ef71=_0x93ef71||0x1f4;return function(_0x24b213){logger[_0x6420('0x25')](_0x24b213[_0x6420('0x26')]);if(_0x24b213['name']){delete _0x24b213[_0x6420('0x27')];}_0x11da50[_0x6420('0x1c')](_0x93ef71)[_0x6420('0x28')](_0x24b213);};}var utilLicense=require(_0x6420('0x18'));exports[_0x6420('0x29')]=function(_0x4b0572,_0x267a95){var _0x12f167={'raw':!![],'where':{'id':0x1}},_0x4d3673={};_0x4d3673[_0x6420('0x2a')]=_[_0x6420('0x2b')](db[_0x6420('0x2c')]['rawAttributes']);_0x4d3673[_0x6420('0x2d')]=_[_0x6420('0x2b')](_0x4b0572[_0x6420('0x2d')]);_0x4d3673[_0x6420('0x2e')]=_[_0x6420('0x2f')](_0x4d3673['model'],_0x4d3673[_0x6420('0x2d')]);_0x12f167[_0x6420('0x30')]=_[_0x6420('0x2f')](_0x4d3673[_0x6420('0x2a')],qs[_0x6420('0x31')](_0x4b0572['query']['fields']));_0x12f167['attributes']=_0x12f167[_0x6420('0x30')]['length']?_0x12f167[_0x6420('0x30')]:_0x4d3673['model'];_0x12f167=_[_0x6420('0x32')]({},_0x12f167,_0x4b0572[_0x6420('0x33')]);return utilLicense[_0x6420('0x34')](_0x12f167)[_0x6420('0x23')](respondWithResult(_0x267a95,null))[_0x6420('0x35')](handleError(_0x267a95,null));};exports[_0x6420('0x36')]=function(_0x2299e3,_0xf12c1b){if(_0x2299e3[_0x6420('0x37')]['id']){delete _0x2299e3['body']['id'];}return db[_0x6420('0x2c')]['find']({'where':{'id':_0x2299e3[_0x6420('0x38')]['id']}})['then'](handleEntityNotFound(_0xf12c1b,null))[_0x6420('0x23')](function(_0xf44fae){var _0x4137df=_0xf44fae['get']({'plain':!![]});return utilLicense['checkLicense'](_0x4137df,_0x2299e3[_0x6420('0x37')][_0x6420('0x39')]);})['then'](function(_0x19d439){if(!_0x19d439['demo']){return saveUpdates(_0x2299e3[_0x6420('0x37')],null);}return _0x19d439;})[_0x6420('0x23')](respondWithResult(_0xf12c1b,null))[_0x6420('0x35')](handleError(_0xf12c1b,null));};exports[_0x6420('0x3a')]=function(_0xa89bed,_0x25bb9a){var _0x59c76e='license-info.log';var _0x38200e=path['join']('/var','log',_0x6420('0x3b'),_0x59c76e);_0x25bb9a[_0x6420('0x3c')](_0x6420('0x3d'),_0x6420('0x3e')+_0x59c76e);_0x25bb9a[_0x6420('0x21')](_0x6420('0x3f'),'text/plain');_0x25bb9a['download'](_0x38200e);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6cdbcf9..e511ce5 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 _0x5476=['path','./license.attributes','define','License','lodash','util','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5476,0x13f));var _0x6547=function(_0x3d70c7,_0x4801a1){_0x3d70c7=_0x3d70c7-0x0;var _0x2450e4=_0x5476[_0x3d70c7];return _0x2450e4;};'use strict';var _=require(_0x6547('0x0'));var util=require(_0x6547('0x1'));var logger=require('../../config/logger')(_0x6547('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6547('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6547('0x4'));module['exports']=function(_0xcfc5,_0xe9e0cd){return _0xcfc5[_0x6547('0x5')](_0x6547('0x6'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1ae=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0xe1ae,0x7e));var _0xee1a=function(_0x4fe77d,_0xaad1f1){_0x4fe77d=_0x4fe77d-0x0;var _0x296a48=_0xe1ae[_0x4fe77d];return _0x296a48;};'use strict';var _=require(_0xee1a('0x0'));var util=require(_0xee1a('0x1'));var logger=require('../../config/logger')(_0xee1a('0x2'));var moment=require(_0xee1a('0x3'));var BPromise=require(_0xee1a('0x4'));var rp=require(_0xee1a('0x5'));var fs=require('fs');var path=require(_0xee1a('0x6'));var rimraf=require(_0xee1a('0x7'));var config=require(_0xee1a('0x8'));var attributes=require(_0xee1a('0x9'));module[_0xee1a('0xa')]=function(_0x259353,_0x10bd35){return _0x259353[_0xee1a('0xb')](_0xee1a('0xc'),attributes,{'tableName':_0xee1a('0xd'),'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 0b99fc6..61f64a3 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 _0x12dc=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s'];(function(_0x2fdfb3,_0x1c8352){var _0x440d77=function(_0x3a8ab2){while(--_0x3a8ab2){_0x2fdfb3['push'](_0x2fdfb3['shift']());}};_0x440d77(++_0x1c8352);}(_0x12dc,0x140));var _0xc12d=function(_0x557450,_0x4f0819){_0x557450=_0x557450-0x0;var _0x3e137f=_0x12dc[_0x557450];return _0x3e137f;};'use strict';var _=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var moment=require('moment');var BPromise=require(_0xc12d('0x2'));var rs=require(_0xc12d('0x3'));var fs=require('fs');var Redis=require(_0xc12d('0x4'));var db=require(_0xc12d('0x5'))['db'];var utils=require(_0xc12d('0x6'));var logger=require(_0xc12d('0x7'))(_0xc12d('0x8'));var config=require(_0xc12d('0x9'));var jayson=require(_0xc12d('0xa'));var client=jayson[_0xc12d('0xb')][_0xc12d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38ad98,_0xa3f17b,_0x3457bb){return new BPromise(function(_0x5787bd,_0x36ee0c){return client['request'](_0x38ad98,_0x3457bb)[_0xc12d('0xd')](function(_0x18ac0e){logger[_0xc12d('0xe')](_0xc12d('0xf'),_0xa3f17b,'request\x20sent');logger[_0xc12d('0x10')]('License,\x20%s,\x20%s,\x20%s',_0xa3f17b,_0xc12d('0x11'),JSON[_0xc12d('0x12')](_0x18ac0e));if(_0x18ac0e[_0xc12d('0x13')]){if(_0x18ac0e[_0xc12d('0x13')][_0xc12d('0x14')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0xa3f17b,_0x18ac0e[_0xc12d('0x13')][_0xc12d('0x15')]);return _0x36ee0c(_0x18ac0e[_0xc12d('0x13')][_0xc12d('0x15')]);}logger[_0xc12d('0x13')]('License,\x20%s,\x20%s',_0xa3f17b,_0x18ac0e['error'][_0xc12d('0x15')]);return _0x5787bd(_0x18ac0e[_0xc12d('0x13')][_0xc12d('0x15')]);}else{logger[_0xc12d('0xe')](_0xc12d('0xf'),_0xa3f17b,_0xc12d('0x11'));_0x5787bd(_0x18ac0e[_0xc12d('0x16')][_0xc12d('0x15')]);}})[_0xc12d('0x17')](function(_0x3b6329){logger[_0xc12d('0x13')](_0xc12d('0xf'),_0xa3f17b,_0x3b6329);_0x36ee0c(_0x3b6329);});});} \ No newline at end of file +var _0x5256=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment'];(function(_0x4e8a2d,_0x111f7b){var _0x142b9e=function(_0x81ec44){while(--_0x81ec44){_0x4e8a2d['push'](_0x4e8a2d['shift']());}};_0x142b9e(++_0x111f7b);}(_0x5256,0x8a));var _0x6525=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x5256[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0x6525('0x0'));var util=require('util');var moment=require(_0x6525('0x1'));var BPromise=require(_0x6525('0x2'));var rs=require(_0x6525('0x3'));var fs=require('fs');var Redis=require(_0x6525('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6525('0x5'));var logger=require(_0x6525('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6525('0x7')][_0x6525('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1747e0,_0x2fd03d,_0x46d142){return new BPromise(function(_0x26556d,_0xb79007){return client['request'](_0x1747e0,_0x46d142)[_0x6525('0x9')](function(_0x44dc54){logger[_0x6525('0xa')](_0x6525('0xb'),_0x2fd03d,_0x6525('0xc'));logger[_0x6525('0xd')](_0x6525('0xe'),_0x2fd03d,_0x6525('0xc'),JSON[_0x6525('0xf')](_0x44dc54));if(_0x44dc54[_0x6525('0x10')]){if(_0x44dc54[_0x6525('0x10')]['code']===0x1f4){logger[_0x6525('0x10')](_0x6525('0xb'),_0x2fd03d,_0x44dc54[_0x6525('0x10')][_0x6525('0x11')]);return _0xb79007(_0x44dc54[_0x6525('0x10')]['message']);}logger[_0x6525('0x10')](_0x6525('0xb'),_0x2fd03d,_0x44dc54[_0x6525('0x10')][_0x6525('0x11')]);return _0x26556d(_0x44dc54[_0x6525('0x10')][_0x6525('0x11')]);}else{logger['info'](_0x6525('0xb'),_0x2fd03d,_0x6525('0xc'));_0x26556d(_0x44dc54[_0x6525('0x12')][_0x6525('0x11')]);}})[_0x6525('0x13')](function(_0x38e56c){logger[_0x6525('0x10')](_0x6525('0xb'),_0x2fd03d,_0x38e56c);_0xb79007(_0x38e56c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c85a691..9610176 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 _0xcc76=['index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addApplications','/:id/send','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x180b13,_0x48319d){var _0x3e9503=function(_0x438a31){while(--_0x438a31){_0x180b13['push'](_0x180b13['shift']());}};_0x3e9503(++_0x48319d);}(_0xcc76,0x7c));var _0x6cc7=function(_0x18fc76,_0x1737ca){_0x18fc76=_0x18fc76-0x0;var _0x335075=_0xcc76[_0x18fc76];return _0x335075;};'use strict';var multer=require(_0x6cc7('0x0'));var util=require(_0x6cc7('0x1'));var path=require(_0x6cc7('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cc7('0x3'));var router=express[_0x6cc7('0x4')]();var fs_extra=require(_0x6cc7('0x5'));var auth=require(_0x6cc7('0x6'));var interaction=require(_0x6cc7('0x7'));var config=require(_0x6cc7('0x8'));var controller=require('./mailAccount.controller');router[_0x6cc7('0x9')]('/',auth[_0x6cc7('0xa')](),controller[_0x6cc7('0xb')]);router[_0x6cc7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x6cc7('0xc')]);router['get'](_0x6cc7('0xd'),auth['isAuthenticated'](),controller[_0x6cc7('0xe')]);router[_0x6cc7('0x9')](_0x6cc7('0xf'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x10')]);router[_0x6cc7('0x9')](_0x6cc7('0x11'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x12')]);router[_0x6cc7('0x9')](_0x6cc7('0x13'),auth['isAuthenticated'](),controller[_0x6cc7('0x14')]);router[_0x6cc7('0x9')](_0x6cc7('0x15'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x16')]);router[_0x6cc7('0x9')](_0x6cc7('0x17'),auth[_0x6cc7('0xa')](),controller['getInteractions']);router['get'](_0x6cc7('0x18'),auth[_0x6cc7('0xa')](),controller['getApplications']);router[_0x6cc7('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6cc7('0x19')]);router[_0x6cc7('0x9')](_0x6cc7('0x1a'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x1b')]);router[_0x6cc7('0x9')](_0x6cc7('0x1c'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x1d')]);router[_0x6cc7('0x1e')](_0x6cc7('0xf'),auth['isAuthenticated'](),controller[_0x6cc7('0x1f')]);router[_0x6cc7('0x1e')](_0x6cc7('0x11'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x20')]);router['post']('/',auth[_0x6cc7('0xa')](),controller['create']);router[_0x6cc7('0x1e')](_0x6cc7('0x13'),auth['isAuthenticated'](),controller[_0x6cc7('0x21')]);router[_0x6cc7('0x1e')](_0x6cc7('0x15'),auth[_0x6cc7('0xa')](),controller['addSmtp']);router[_0x6cc7('0x1e')](_0x6cc7('0x17'),auth[_0x6cc7('0xa')](),controller['addInteraction']);router[_0x6cc7('0x1e')]('/:id/applications',auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x22')]);router[_0x6cc7('0x1e')](_0x6cc7('0x23'),auth[_0x6cc7('0xa')](),controller['send']);router[_0x6cc7('0x1e')]('/:id/users',auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x24')]);router['put'](_0x6cc7('0xd'),auth['isAuthenticated'](),controller[_0x6cc7('0x25')]);router[_0x6cc7('0x26')](_0x6cc7('0xf'),auth[_0x6cc7('0xa')](),controller['removeDispositions']);router[_0x6cc7('0x26')]('/:id/canned_answers',auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x27')]);router['delete'](_0x6cc7('0x13'),auth['isAuthenticated'](),controller[_0x6cc7('0x28')]);router[_0x6cc7('0x26')](_0x6cc7('0x15'),auth['isAuthenticated'](),controller[_0x6cc7('0x29')]);router[_0x6cc7('0x26')](_0x6cc7('0xd'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x2a')]);router[_0x6cc7('0x26')](_0x6cc7('0x1c'),auth[_0x6cc7('0xa')](),controller[_0x6cc7('0x2b')]);module[_0x6cc7('0x2c')]=router; \ No newline at end of file +var _0xb48f=['get','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/in_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb48f,0x160));var _0xfb48=function(_0x136659,_0x661891){_0x136659=_0x136659-0x0;var _0x192cd9=_0xb48f[_0x136659];return _0x192cd9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfb48('0x0'));var timeout=require(_0xfb48('0x1'));var express=require(_0xfb48('0x2'));var router=express[_0xfb48('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfb48('0x4'));var interaction=require(_0xfb48('0x5'));var config=require(_0xfb48('0x6'));var controller=require(_0xfb48('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfb48('0x8')]('/describe',auth[_0xfb48('0x9')](),controller['describe']);router[_0xfb48('0x8')](_0xfb48('0xa'),auth[_0xfb48('0x9')](),controller[_0xfb48('0xb')]);router[_0xfb48('0x8')]('/:id/dispositions',auth[_0xfb48('0x9')](),controller[_0xfb48('0xc')]);router[_0xfb48('0x8')](_0xfb48('0xd'),auth[_0xfb48('0x9')](),controller['getAnswers']);router['get']('/:id/in_servers',auth[_0xfb48('0x9')](),controller[_0xfb48('0xe')]);router[_0xfb48('0x8')](_0xfb48('0xf'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x10')]);router[_0xfb48('0x8')](_0xfb48('0x11'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x12')]);router[_0xfb48('0x8')](_0xfb48('0x13'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x14')]);router[_0xfb48('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0xfb48('0x15')]);router[_0xfb48('0x8')](_0xfb48('0x16'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x17')]);router[_0xfb48('0x8')](_0xfb48('0x18'),auth[_0xfb48('0x9')](),controller['getAgents']);router[_0xfb48('0x19')](_0xfb48('0x1a'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x1b')]);router['post'](_0xfb48('0xd'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x1c')]);router[_0xfb48('0x19')]('/',auth[_0xfb48('0x9')](),controller[_0xfb48('0x1d')]);router[_0xfb48('0x19')](_0xfb48('0x1e'),auth[_0xfb48('0x9')](),controller['addImap']);router[_0xfb48('0x19')](_0xfb48('0xf'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x1f')]);router['post'](_0xfb48('0x11'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x20')]);router[_0xfb48('0x19')](_0xfb48('0x13'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x21')]);router[_0xfb48('0x19')](_0xfb48('0x22'),auth['isAuthenticated'](),controller[_0xfb48('0x23')]);router[_0xfb48('0x19')](_0xfb48('0x18'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x24')]);router[_0xfb48('0x25')](_0xfb48('0xa'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x26')]);router[_0xfb48('0x27')](_0xfb48('0x1a'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xfb48('0xd'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x28')]);router[_0xfb48('0x27')](_0xfb48('0x1e'),auth['isAuthenticated'](),controller[_0xfb48('0x29')]);router[_0xfb48('0x27')](_0xfb48('0xf'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x2a')]);router[_0xfb48('0x27')](_0xfb48('0xa'),auth[_0xfb48('0x9')](),controller[_0xfb48('0x2b')]);router[_0xfb48('0x27')]('/:id/users',auth[_0xfb48('0x9')](),controller['removeAgents']);module[_0xfb48('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 8f3b50d..50e9676 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 _0x9fd5=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','provider','custom','getDataValue','sequelize','exports'];(function(_0x3c6539,_0x56cc1e){var _0x53a22b=function(_0x4d178c){while(--_0x4d178c){_0x3c6539['push'](_0x3c6539['shift']());}};_0x53a22b(++_0x56cc1e);}(_0x9fd5,0xae));var _0x59fd=function(_0xf9fc05,_0x6f36c){_0xf9fc05=_0xf9fc05-0x0;var _0x2140ad=_0x9fd5[_0xf9fc05];return _0x2140ad;};'use strict';var Sequelize=require(_0x59fd('0x0'));module[_0x59fd('0x1')]={'description':{'type':Sequelize[_0x59fd('0x2')]},'name':{'type':Sequelize[_0x59fd('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x59fd('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x59fd('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x59fd('0x4')},'fontSize':{'type':Sequelize[_0x59fd('0x5')](0x2)[_0x59fd('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x59fd('0x7');}},'notificationSound':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x59fd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x59fd('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x59fd('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x59fd('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x59fd('0x3')],'defaultValue':![],'comment':_0x59fd('0x9'),'set':function(_0x578c63){if(!_0x578c63)this[_0x59fd('0xa')]('mandatoryDispositionPauseId',null);this[_0x59fd('0xa')](_0x59fd('0xb'),_0x578c63);}},'provider':{'type':Sequelize[_0x59fd('0xc')]('gmail','hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x59fd('0xd')))return _0x59fd('0xe');return this[_0x59fd('0xf')]('provider');},'set':function(_0x34f69e){if(_0x34f69e===_0x59fd('0xe'))_0x34f69e=null;return this['setDataValue'](_0x59fd('0xd'),_0x34f69e);}}}; \ No newline at end of file +var _0x7dca=['yahoo','outlook365','getDataValue','custom','provider','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','ENUM','gmail'];(function(_0x5620ff,_0x2dc631){var _0x4cc585=function(_0xbc7d80){while(--_0xbc7d80){_0x5620ff['push'](_0x5620ff['shift']());}};_0x4cc585(++_0x2dc631);}(_0x7dca,0x1ba));var _0xa7dc=function(_0x2cc569,_0x4e9568){_0x2cc569=_0x2cc569-0x0;var _0x1bfc2e=_0x7dca[_0x2cc569];return _0x1bfc2e;};'use strict';var Sequelize=require(_0xa7dc('0x0'));module[_0xa7dc('0x1')]={'description':{'type':Sequelize[_0xa7dc('0x2')]},'name':{'type':Sequelize[_0xa7dc('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xa7dc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa7dc('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xa7dc('0x4')]},'markAsUnread':{'type':Sequelize[_0xa7dc('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xa7dc('0x2')],'allowNull':![],'defaultValue':_0xa7dc('0x5')},'fontSize':{'type':Sequelize[_0xa7dc('0x6')](0x2)[_0xa7dc('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xa7dc('0x4')],'defaultValue':function(){return _0xa7dc('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa7dc('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa7dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa7dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa7dc('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa7dc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa7dc('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xa7dc('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa7dc('0x3')],'defaultValue':![],'comment':_0xa7dc('0xa'),'set':function(_0x250e49){if(!_0x250e49)this[_0xa7dc('0xb')]('mandatoryDispositionPauseId',null);this[_0xa7dc('0xb')]('mandatoryDisposition',_0x250e49);}},'provider':{'type':Sequelize[_0xa7dc('0xc')](_0xa7dc('0xd'),'hotmail',_0xa7dc('0xe'),_0xa7dc('0xf')),'defaultValue':null,'get':function(){if(!this[_0xa7dc('0x10')]('provider'))return _0xa7dc('0x11');return this[_0xa7dc('0x10')]('provider');},'set':function(_0x597085){if(_0x597085===_0xa7dc('0x11'))_0x597085=null;return this[_0xa7dc('0xb')](_0xa7dc('0x12'),_0x597085);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 1c5c79c..d98dca0 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 _0xbc29=['removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','filter','removeAnswers','custom','email','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','User','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','format','MailMessage','inlineCss','true','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','isNil','from','%s\x20<%s>','attachments','join','root','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','subject','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','then','stack','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','host','port','secure','service','pass','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','name','options','MailAccount','includeAll','include','rows','catch','mandatoryDispositionPause','keys','length','body','provider','find','params','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','findAll'];(function(_0x85666,_0x403be2){var _0x233527=function(_0x31d496){while(--_0x31d496){_0x85666['push'](_0x85666['shift']());}};_0x233527(++_0x403be2);}(_0xbc29,0x1de));var _0x9bc2=function(_0x2ff205,_0x413c68){_0x2ff205=_0x2ff205-0x0;var _0x591903=_0xbc29[_0x2ff205];return _0x591903;};'use strict';var moment=require('moment');var BPromise=require(_0x9bc2('0x0'));var util=require(_0x9bc2('0x1'));var path=require(_0x9bc2('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x9bc2('0x3'));var qs=require(_0x9bc2('0x4'));var logger=require(_0x9bc2('0x5'))(_0x9bc2('0x6'));var config=require(_0x9bc2('0x7'));var db=require(_0x9bc2('0x8'))['db'];config[_0x9bc2('0x9')]=_[_0x9bc2('0xa')](config[_0x9bc2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bc2('0xb'))(new Redis(config[_0x9bc2('0x9')]));require('./mailAccount.socket')[_0x9bc2('0xc')](socket);var jayson=require(_0x9bc2('0xd'));var client=jayson[_0x9bc2('0xe')][_0x9bc2('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x4d56ec,_0x574a4a,_0x23d1a5,_0x52e3a1){return new BPromise(function(_0x3c89d5,_0x55482c){var _0x5891a8=_0x52e3a1||client;return _0x5891a8[_0x9bc2('0x10')](_0x4d56ec,_0x23d1a5)['then'](function(_0xdfe809){logger[_0x9bc2('0x11')](_0x9bc2('0x12'),_0x574a4a,_0x9bc2('0x13'));logger[_0x9bc2('0x14')](_0x9bc2('0x15'),_0x574a4a,'request\x20sent',JSON[_0x9bc2('0x16')](_0xdfe809));if(_0xdfe809['error']){if(_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x18')]===0x1f4){logger[_0x9bc2('0x17')](_0x9bc2('0x12'),_0x574a4a,_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x19')]);return _0x55482c(_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x19')]);}logger[_0x9bc2('0x17')](_0x9bc2('0x12'),_0x574a4a,_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x19')]);return _0x3c89d5(_0xdfe809[_0x9bc2('0x17')][_0x9bc2('0x19')]);}else{logger[_0x9bc2('0x11')](_0x9bc2('0x12'),_0x574a4a,_0x9bc2('0x13'));_0x3c89d5(_0xdfe809[_0x9bc2('0x1a')][_0x9bc2('0x19')]);}})['catch'](function(_0x2bec21){logger['error']('MailAccount,\x20%s,\x20%s',_0x574a4a,_0x2bec21);_0x55482c(_0x2bec21);});});}function respondWithStatusCode(_0x644233,_0x5bfb8f){_0x5bfb8f=_0x5bfb8f||0xcc;return function(_0x5d3238){if(_0x5d3238){return _0x644233[_0x9bc2('0x1b')](_0x5bfb8f);}return _0x644233[_0x9bc2('0x1c')](_0x5bfb8f)['end']();};}function respondWithResult(_0x405b7a,_0x4f3a50){_0x4f3a50=_0x4f3a50||0xc8;return function(_0x4e2f0f){if(_0x4e2f0f){return _0x405b7a[_0x9bc2('0x1c')](_0x4f3a50)[_0x9bc2('0x1d')](_0x4e2f0f);}};}function respondWithFilteredResult(_0x2ddffc,_0x4abe49){return function(_0x597b7c){if(_0x597b7c){var _0x5b72e5=typeof _0x4abe49[_0x9bc2('0x1e')]===_0x9bc2('0x1f')&&typeof _0x4abe49['limit']===_0x9bc2('0x1f');var _0x12ccd1=_0x597b7c[_0x9bc2('0x20')];var _0x184a04=_0x5b72e5?0x0:_0x4abe49['offset'];var _0x5aaa64=_0x5b72e5?_0x597b7c[_0x9bc2('0x20')]:_0x4abe49[_0x9bc2('0x1e')]+_0x4abe49[_0x9bc2('0x21')];var _0x383c52;if(_0x5aaa64>=_0x12ccd1){_0x5aaa64=_0x12ccd1;_0x383c52=0xc8;}else{_0x383c52=0xce;}_0x2ddffc[_0x9bc2('0x1c')](_0x383c52);return _0x2ddffc[_0x9bc2('0x22')](_0x9bc2('0x23'),_0x184a04+'-'+_0x5aaa64+'/'+_0x12ccd1)[_0x9bc2('0x1d')](_0x597b7c);}return null;};}function saveUpdates(_0x3a355f){return function(_0x362b4c){if(_0x362b4c){return _0x362b4c[_0x9bc2('0x24')](_0x3a355f)['then'](function(_0x51f001){return _0x51f001;});}return null;};}function removeEntity(_0xafc37d){return function(_0x9fab3a){if(_0x9fab3a){return _0x9fab3a[_0x9bc2('0x25')]()['then'](function(){var _0x507cee=_0x9fab3a[_0x9bc2('0x26')]({'plain':!![]});var _0x4bb80e=_0x9bc2('0x27');return db[_0x9bc2('0x28')][_0x9bc2('0x25')]({'where':{'type':_0x4bb80e,'resourceId':_0x507cee['id']}})[_0x9bc2('0x29')](function(){return _0x9fab3a;});})[_0x9bc2('0x29')](function(){_0xafc37d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43a82c){return function(_0x432881){if(!_0x432881){_0x43a82c['sendStatus'](0x194);}return _0x432881;};}function handleError(_0x477000,_0x1dba00){_0x1dba00=_0x1dba00||0x1f4;return function(_0x283d64){logger[_0x9bc2('0x17')](_0x283d64[_0x9bc2('0x2a')]);if(_0x283d64['name']){delete _0x283d64['name'];}_0x477000[_0x9bc2('0x1c')](_0x1dba00)[_0x9bc2('0x2b')](_0x283d64);};}function getImapHost(_0x431559){switch(_0x431559){case _0x9bc2('0x2c'):return _0x9bc2('0x2d');case'yahoo':return _0x9bc2('0x2e');case _0x9bc2('0x2f'):return _0x9bc2('0x30');case _0x9bc2('0x31'):return _0x9bc2('0x32');}throw new Error(_0x9bc2('0x33'),_0x431559);}function getSmtpHost(_0x5c023c){switch(_0x5c023c){case _0x9bc2('0x2c'):return _0x9bc2('0x34');case'yahoo':return _0x9bc2('0x35');case _0x9bc2('0x2f'):return _0x9bc2('0x36');case _0x9bc2('0x31'):return _0x9bc2('0x37');}throw new Error(_0x9bc2('0x33'),_0x5c023c);}function getAuthenticationOptions(_0x21e53c,_0x1691cc){var _0x118a95={};var _0x53f560={};if(_0x21e53c){_0x118a95[_0x9bc2('0x38')]=_0x53f560[_0x9bc2('0x38')]=_0x1691cc[_0x9bc2('0x39')];_0x118a95[_0x9bc2('0x3a')]=_0x53f560['pass']=_0x1691cc[_0x9bc2('0x3a')];if(_0x1691cc[_0x9bc2('0x3b')]){_0x118a95['modernAuthentication']=_0x53f560[_0x9bc2('0x3b')]=!![];_0x118a95[_0x9bc2('0x3c')]=_0x53f560['CloudProviderId']=_0x1691cc[_0x9bc2('0x3c')];_0x118a95['password']=_0x53f560['pass']=null;}else{_0x118a95[_0x9bc2('0x3c')]=_0x53f560[_0x9bc2('0x3c')]=null;}_0x118a95[_0x9bc2('0x3d')]=getImapHost(_0x21e53c);_0x118a95[_0x9bc2('0x3e')]=0x3e1;_0x53f560[_0x9bc2('0x3d')]=getSmtpHost(_0x21e53c);_0x53f560['port']=0x24b;_0x53f560[_0x9bc2('0x3f')]=![];_0x118a95[_0x9bc2('0x40')]=_0x53f560[_0x9bc2('0x40')]=null;}else{if(_0x1691cc['authentication']){_0x118a95[_0x9bc2('0x38')]=_0x53f560[_0x9bc2('0x38')]=_0x1691cc['username'];_0x118a95['password']=_0x53f560[_0x9bc2('0x41')]=_0x1691cc['password'];}else{_0x118a95[_0x9bc2('0x42')]=_0x53f560[_0x9bc2('0x42')]=![];_0x118a95[_0x9bc2('0x38')]=_0x53f560[_0x9bc2('0x38')]=null;_0x118a95[_0x9bc2('0x3a')]=_0x53f560[_0x9bc2('0x41')]=null;}_0x118a95[_0x9bc2('0x3d')]=_0x1691cc[_0x9bc2('0x43')][_0x9bc2('0x3d')];_0x118a95[_0x9bc2('0x3e')]=_0x1691cc[_0x9bc2('0x43')][_0x9bc2('0x3e')];_0x53f560[_0x9bc2('0x3d')]=_0x1691cc['Smtp'][_0x9bc2('0x3d')];_0x53f560[_0x9bc2('0x3e')]=_0x1691cc[_0x9bc2('0x44')][_0x9bc2('0x3e')];}return{'Imap':_0x118a95,'Smtp':_0x53f560};}exports[_0x9bc2('0x45')]=function(_0x12fb66,_0x52d641){var _0x1ef5f7={'include':[{'model':db[_0x9bc2('0x46')],'as':_0x9bc2('0x43')},{'model':db[_0x9bc2('0x47')],'as':_0x9bc2('0x44')},{'model':db[_0x9bc2('0x48')],'as':'mandatoryDispositionPause'}]},_0x26a994={},_0x1ee048={'count':0x0,'rows':[]};var _0x1c655f=_[_0x9bc2('0x49')](db['MailAccount'][_0x9bc2('0x4a')],function(_0x2fabf5){return{'name':_0x2fabf5['fieldName'],'type':_0x2fabf5[_0x9bc2('0x4b')][_0x9bc2('0x4c')]};});_0x26a994[_0x9bc2('0x4d')]=_[_0x9bc2('0x49')](_0x1c655f,'name');_0x26a994['query']=_['keys'](_0x12fb66[_0x9bc2('0x4e')]);_0x26a994[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x26a994[_0x9bc2('0x4d')],_0x26a994[_0x9bc2('0x4e')]);_0x1ef5f7[_0x9bc2('0x51')]=_['intersection'](_0x26a994[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x12fb66[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x1ef5f7[_0x9bc2('0x51')]=_0x1ef5f7[_0x9bc2('0x51')]['length']?_0x1ef5f7[_0x9bc2('0x51')]:_0x26a994[_0x9bc2('0x4d')];if(!_0x12fb66[_0x9bc2('0x4e')][_0x9bc2('0x53')](_0x9bc2('0x54'))){_0x1ef5f7[_0x9bc2('0x21')]=qs['limit'](_0x12fb66[_0x9bc2('0x4e')][_0x9bc2('0x21')]);_0x1ef5f7[_0x9bc2('0x1e')]=qs[_0x9bc2('0x1e')](_0x12fb66[_0x9bc2('0x4e')]['offset']);}_0x1ef5f7[_0x9bc2('0x55')]=qs[_0x9bc2('0x56')](_0x12fb66[_0x9bc2('0x4e')][_0x9bc2('0x56')]);_0x1ef5f7['where']=qs['filters'](_[_0x9bc2('0x57')](_0x12fb66[_0x9bc2('0x4e')],_0x26a994[_0x9bc2('0x4f')]),_0x1c655f);if(_0x12fb66[_0x9bc2('0x4e')]['filter']){_0x1ef5f7[_0x9bc2('0x58')]=_[_0x9bc2('0x59')](_0x1ef5f7['where'],{'$or':_[_0x9bc2('0x49')](_0x1c655f,function(_0x1806ea){if(_0x1806ea[_0x9bc2('0x4b')]!==_0x9bc2('0x5a')){var _0x4711c2={};_0x4711c2[_0x1806ea[_0x9bc2('0x5b')]]={'$like':'%'+_0x12fb66['query']['filter']+'%'};return _0x4711c2;}})});}_0x1ef5f7=_[_0x9bc2('0x59')]({},_0x1ef5f7,_0x12fb66[_0x9bc2('0x5c')]);var _0x3aff1d={'where':_0x1ef5f7[_0x9bc2('0x58')]};return db[_0x9bc2('0x5d')][_0x9bc2('0x20')](_0x3aff1d)[_0x9bc2('0x29')](function(_0x76d087){_0x1ee048[_0x9bc2('0x20')]=_0x76d087;if(_0x12fb66['query'][_0x9bc2('0x5e')]){_0x1ef5f7[_0x9bc2('0x5f')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x1ef5f7);})['then'](function(_0x587a90){_0x1ee048[_0x9bc2('0x60')]=_0x587a90;return _0x1ee048;})[_0x9bc2('0x29')](respondWithFilteredResult(_0x52d641,_0x1ef5f7))[_0x9bc2('0x61')](handleError(_0x52d641,null));};exports['show']=function(_0x5d5606,_0x48d6bd){var _0x266d48={'raw':![],'where':{'id':_0x5d5606['params']['id']},'include':[{'model':db[_0x9bc2('0x46')],'as':_0x9bc2('0x43')},{'model':db[_0x9bc2('0x47')],'as':'Smtp'},{'model':db[_0x9bc2('0x48')],'as':_0x9bc2('0x62')}]},_0x5d3140={};_0x5d3140[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db[_0x9bc2('0x5d')][_0x9bc2('0x4a')]);_0x5d3140[_0x9bc2('0x4e')]=_['keys'](_0x5d5606[_0x9bc2('0x4e')]);_0x5d3140[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x5d3140['model'],_0x5d3140['query']);_0x266d48[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x5d3140[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x5d5606[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x266d48[_0x9bc2('0x51')]=_0x266d48[_0x9bc2('0x51')][_0x9bc2('0x64')]?_0x266d48[_0x9bc2('0x51')]:_0x5d3140['model'];if(_0x5d5606[_0x9bc2('0x4e')][_0x9bc2('0x5e')]){_0x266d48[_0x9bc2('0x5f')]=[{'all':!![]}];}_0x266d48=_[_0x9bc2('0x59')]({},_0x266d48,_0x5d5606[_0x9bc2('0x5c')]);return db[_0x9bc2('0x5d')]['find'](_0x266d48)['then'](handleEntityNotFound(_0x48d6bd,null))[_0x9bc2('0x29')](respondWithResult(_0x48d6bd,null))[_0x9bc2('0x61')](handleError(_0x48d6bd,null));};exports[_0x9bc2('0x24')]=function(_0x2e4c89,_0x2cf8ae){if(_0x2e4c89[_0x9bc2('0x65')]['id']){delete _0x2e4c89['body']['id'];}var _0xbd61e=_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x66')]==='custom'?null:_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x66')];var _0x3fd4ad=_0x2e4c89['body']['Imap']||{};var _0x5929d9=_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x44')]||{};if(_0xbd61e){_0x3fd4ad[_0x9bc2('0x3d')]=getImapHost(_0xbd61e);_0x3fd4ad[_0x9bc2('0x3e')]=0x3e1;_0x5929d9['host']=getSmtpHost(_0xbd61e);_0x5929d9[_0x9bc2('0x3e')]=0x24b;_0x5929d9['secure']=![];}if(_0x5929d9[_0x9bc2('0x3b')]){_0x5929d9[_0x9bc2('0x3f')]=![];}else{_0x5929d9[_0x9bc2('0x3c')]=null;}if(!_0x3fd4ad[_0x9bc2('0x3b')])_0x3fd4ad[_0x9bc2('0x3c')]=null;_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x43')]=_0x3fd4ad;_0x2e4c89[_0x9bc2('0x65')]['Smtp']=_0x5929d9;return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x2e4c89[_0x9bc2('0x68')]['id']},'include':[{'model':db[_0x9bc2('0x46')],'as':'Imap'},{'model':db[_0x9bc2('0x47')],'as':'Smtp'},{'model':db[_0x9bc2('0x48')],'as':_0x9bc2('0x62')}]})['then'](handleEntityNotFound(_0x2cf8ae,null))[_0x9bc2('0x29')](function(_0xb78536){if(!_0xb78536)throw new Error('Mail\x20Account\x20not\x20found');if(_0xb78536[_0x9bc2('0x40')])delete _0x2e4c89['body'][_0x9bc2('0x43')];return _0xb78536;})['then'](saveUpdates(_0x2e4c89[_0x9bc2('0x65')],null))[_0x9bc2('0x29')](function(_0x1d35a9){if(!_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x43')])return _0x1d35a9;return db[_0x9bc2('0x46')][_0x9bc2('0x24')](_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x43')],{'where':{'MailAccountId':_0x1d35a9['id']}})[_0x9bc2('0x29')](function(){return _0x1d35a9;});})[_0x9bc2('0x29')](function(_0x30b927){if(!_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x44')])return _0x30b927;return db[_0x9bc2('0x47')][_0x9bc2('0x24')](_0x2e4c89[_0x9bc2('0x65')][_0x9bc2('0x44')],{'where':{'MailAccountId':_0x30b927['id']}})[_0x9bc2('0x29')](function(){return _0x30b927;});})[_0x9bc2('0x29')](respondWithResult(_0x2cf8ae,null))[_0x9bc2('0x61')](handleError(_0x2cf8ae,null));};exports[_0x9bc2('0x69')]=function(_0x58d79d,_0x45fe99){return db[_0x9bc2('0x5d')][_0x9bc2('0x69')]()['then'](respondWithResult(_0x45fe99,null))['catch'](handleError(_0x45fe99,null));};exports[_0x9bc2('0x6a')]=function(_0x403c3f,_0x1a709b){if(_0x403c3f['body']['id']){delete _0x403c3f['body']['id'];}return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x403c3f['params']['id']}})['then'](handleEntityNotFound(_0x1a709b,null))[_0x9bc2('0x29')](function(_0x4c1070){if(_0x4c1070){_0x403c3f[_0x9bc2('0x65')][_0x9bc2('0x6b')]=_0x4c1070['id'];return db[_0x9bc2('0x6c')][_0x9bc2('0x6d')](_0x403c3f[_0x9bc2('0x65')]);}})[_0x9bc2('0x29')](respondWithResult(_0x1a709b,null))[_0x9bc2('0x61')](handleError(_0x1a709b,null));};exports[_0x9bc2('0x6e')]=function(_0x46ce84,_0x415043){var _0x2560b1={'raw':![],'where':{}};var _0x76959b={};var _0x488cb6={'count':0x0,'rows':[]};return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x46ce84[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x415043,null))[_0x9bc2('0x29')](function(_0x409173){if(_0x409173){_0x76959b[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db[_0x9bc2('0x6c')][_0x9bc2('0x4a')]);_0x76959b[_0x9bc2('0x4e')]=_['keys'](_0x46ce84['query']);_0x76959b[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x76959b[_0x9bc2('0x4d')],_0x76959b[_0x9bc2('0x4e')]);_0x2560b1[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x76959b[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x46ce84[_0x9bc2('0x4e')]['fields']));_0x2560b1[_0x9bc2('0x51')]=_0x2560b1[_0x9bc2('0x51')][_0x9bc2('0x64')]?_0x2560b1[_0x9bc2('0x51')]:_0x76959b[_0x9bc2('0x4d')];if(!_0x46ce84['query']['hasOwnProperty']('nolimit')){_0x2560b1['limit']=qs['limit'](_0x46ce84['query'][_0x9bc2('0x21')]);_0x2560b1['offset']=qs['offset'](_0x46ce84[_0x9bc2('0x4e')]['offset']);}_0x2560b1[_0x9bc2('0x55')]=qs[_0x9bc2('0x56')](_0x46ce84[_0x9bc2('0x4e')][_0x9bc2('0x56')]);_0x2560b1[_0x9bc2('0x58')]=qs['filters'](_['pick'](_0x46ce84[_0x9bc2('0x4e')],_0x76959b[_0x9bc2('0x4f')]));_0x2560b1[_0x9bc2('0x58')]['MailAccountId']=_0x409173['id'];if(_0x46ce84[_0x9bc2('0x4e')]['filter']){_0x2560b1[_0x9bc2('0x58')]=_['merge'](_0x2560b1[_0x9bc2('0x58')],{'$or':_[_0x9bc2('0x49')](_0x2560b1[_0x9bc2('0x51')],function(_0x4317a3){var _0x47c3bb={};_0x47c3bb[_0x4317a3]={'$like':'%'+_0x46ce84[_0x9bc2('0x4e')]['filter']+'%'};return _0x47c3bb;})});}_0x2560b1=_['merge']({},_0x2560b1,_0x46ce84[_0x9bc2('0x5c')]);return db[_0x9bc2('0x6c')][_0x9bc2('0x20')]({'where':_0x2560b1[_0x9bc2('0x58')]})[_0x9bc2('0x29')](function(_0x4c0738){_0x488cb6[_0x9bc2('0x20')]=_0x4c0738;if(_0x46ce84[_0x9bc2('0x4e')]['includeAll']){_0x2560b1[_0x9bc2('0x5f')]=[{'all':!![]}];}return db[_0x9bc2('0x6c')][_0x9bc2('0x70')](_0x2560b1);})['then'](function(_0x118c7e){_0x488cb6[_0x9bc2('0x60')]=_0x118c7e;return _0x488cb6;});}})[_0x9bc2('0x29')](respondWithFilteredResult(_0x415043,_0x2560b1))[_0x9bc2('0x61')](handleError(_0x415043,null));};exports[_0x9bc2('0x71')]=function(_0x546d5f,_0x5268d2){return db[_0x9bc2('0x5d')]['find']({'where':{'id':_0x546d5f[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x5268d2,null))[_0x9bc2('0x29')](function(_0x591650){if(_0x591650){return _0x591650[_0x9bc2('0x71')](_0x546d5f[_0x9bc2('0x4e')][_0x9bc2('0x72')]);}})[_0x9bc2('0x29')](respondWithStatusCode(_0x5268d2,null))[_0x9bc2('0x61')](handleError(_0x5268d2,null));};exports[_0x9bc2('0x73')]=function(_0x500369,_0x4afeca){if(_0x500369[_0x9bc2('0x65')]['id']){delete _0x500369[_0x9bc2('0x65')]['id'];}return db[_0x9bc2('0x5d')]['find']({'where':{'id':_0x500369[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x4afeca,null))['then'](function(_0x13c880){if(_0x13c880){_0x500369['body'][_0x9bc2('0x6b')]=_0x13c880['id'];return db[_0x9bc2('0x74')][_0x9bc2('0x6d')](_0x500369['body']);}})['then'](respondWithResult(_0x4afeca,null))[_0x9bc2('0x61')](handleError(_0x4afeca,null));};exports[_0x9bc2('0x75')]=function(_0x929822,_0x4a3650){var _0x2eaec7={'raw':![],'where':{}};var _0x4625cb={};var _0x4bdeb5={'count':0x0,'rows':[]};return db[_0x9bc2('0x5d')]['findOne']({'where':{'id':_0x929822[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x4a3650,null))[_0x9bc2('0x29')](function(_0x5c75d0){if(_0x5c75d0){_0x4625cb[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db[_0x9bc2('0x74')][_0x9bc2('0x4a')]);_0x4625cb['query']=_['keys'](_0x929822[_0x9bc2('0x4e')]);_0x4625cb['filters']=_['intersection'](_0x4625cb[_0x9bc2('0x4d')],_0x4625cb['query']);_0x2eaec7[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x4625cb[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x2eaec7[_0x9bc2('0x51')]=_0x2eaec7[_0x9bc2('0x51')][_0x9bc2('0x64')]?_0x2eaec7['attributes']:_0x4625cb[_0x9bc2('0x4d')];if(!_0x929822[_0x9bc2('0x4e')]['hasOwnProperty'](_0x9bc2('0x54'))){_0x2eaec7[_0x9bc2('0x21')]=qs[_0x9bc2('0x21')](_0x929822['query'][_0x9bc2('0x21')]);_0x2eaec7[_0x9bc2('0x1e')]=qs[_0x9bc2('0x1e')](_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}_0x2eaec7[_0x9bc2('0x55')]=qs['sort'](_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x56')]);_0x2eaec7[_0x9bc2('0x58')]=qs[_0x9bc2('0x4f')](_[_0x9bc2('0x57')](_0x929822[_0x9bc2('0x4e')],_0x4625cb[_0x9bc2('0x4f')]));_0x2eaec7[_0x9bc2('0x58')][_0x9bc2('0x6b')]=_0x5c75d0['id'];if(_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x76')]){_0x2eaec7[_0x9bc2('0x58')]=_['merge'](_0x2eaec7[_0x9bc2('0x58')],{'$or':_[_0x9bc2('0x49')](_0x2eaec7['attributes'],function(_0x5a7c6b){var _0x144926={};_0x144926[_0x5a7c6b]={'$like':'%'+_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x76')]+'%'};return _0x144926;})});}_0x2eaec7=_[_0x9bc2('0x59')]({},_0x2eaec7,_0x929822[_0x9bc2('0x5c')]);return db[_0x9bc2('0x74')][_0x9bc2('0x20')]({'where':_0x2eaec7['where']})[_0x9bc2('0x29')](function(_0x2181df){_0x4bdeb5[_0x9bc2('0x20')]=_0x2181df;if(_0x929822[_0x9bc2('0x4e')][_0x9bc2('0x5e')]){_0x2eaec7[_0x9bc2('0x5f')]=[{'all':!![]}];}return db[_0x9bc2('0x74')][_0x9bc2('0x70')](_0x2eaec7);})['then'](function(_0x3b8b7c){_0x4bdeb5[_0x9bc2('0x60')]=_0x3b8b7c;return _0x4bdeb5;});}})[_0x9bc2('0x29')](respondWithFilteredResult(_0x4a3650,_0x2eaec7))['catch'](handleError(_0x4a3650,null));};exports['removeAnswers']=function(_0x137316,_0x564224){return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x137316[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x564224,null))[_0x9bc2('0x29')](function(_0xdebe00){if(_0xdebe00){return _0xdebe00[_0x9bc2('0x77')](_0x137316[_0x9bc2('0x4e')][_0x9bc2('0x72')]);}})[_0x9bc2('0x29')](respondWithStatusCode(_0x564224,null))[_0x9bc2('0x61')](handleError(_0x564224,null));};exports[_0x9bc2('0x6d')]=function(_0x126c13,_0x49ef53){var _0x2b5577={'name':_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x5b')],'key':_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x4c')],'provider':_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x66')]===_0x9bc2('0x78')?null:_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x66')],'email':_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x79')],'ListId':_0x126c13[_0x9bc2('0x65')]['ListId'],'active':!_['isNil'](_0x126c13[_0x9bc2('0x65')][_0x9bc2('0x7a')])?_0x126c13['body'][_0x9bc2('0x7a')]:!![],'description':_0x126c13['body'][_0x9bc2('0x7b')]||null};var _0x24cae8=getAuthenticationOptions(_0x2b5577[_0x9bc2('0x66')],_0x126c13[_0x9bc2('0x65')]);_0x2b5577['Imap']=_0x24cae8['Imap'];_0x2b5577[_0x9bc2('0x44')]=_0x24cae8['Smtp'];return db[_0x9bc2('0x5d')][_0x9bc2('0x6d')](_0x2b5577,{'include':[{'model':db[_0x9bc2('0x47')],'as':_0x9bc2('0x44')},{'model':db[_0x9bc2('0x46')],'as':_0x9bc2('0x43')}]})[_0x9bc2('0x29')](function(_0x65f36){var _0x591fd3=_0x126c13[_0x9bc2('0x38')][_0x9bc2('0x26')]({'plain':!![]});if(!_0x591fd3)throw new Error(_0x9bc2('0x7c'));if(_0x591fd3[_0x9bc2('0x7d')]===_0x9bc2('0x38')){var _0x2f6a0c=_0x65f36[_0x9bc2('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x9bc2('0x67')]({'where':{'name':'MailAccounts','userProfileId':_0x591fd3['userProfileId']},'raw':!![]})[_0x9bc2('0x29')](function(_0x5e2855){if(_0x5e2855&&_0x5e2855[_0x9bc2('0x7e')]===0x0){return db[_0x9bc2('0x28')][_0x9bc2('0x6d')]({'name':_0x2f6a0c['name'],'resourceId':_0x2f6a0c['id'],'type':_0x5e2855[_0x9bc2('0x5b')],'sectionId':_0x5e2855['id']},{})[_0x9bc2('0x29')](function(){return _0x65f36;});}else{return _0x65f36;}})['catch'](function(_0x27472f){logger[_0x9bc2('0x17')](_0x9bc2('0x7f'),_0x27472f);throw _0x27472f;});}return _0x65f36;})['then'](respondWithResult(_0x49ef53,0xc9))['catch'](handleError(_0x49ef53,null));};exports[_0x9bc2('0x80')]=function(_0x42ce50,_0x38822c){return db['MailAccount']['findOne']({'where':{'id':_0x42ce50['params']['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x38822c,null))[_0x9bc2('0x29')](function(_0x14734b){if(_0x14734b){return _0x14734b[_0x9bc2('0x80')]();}return null;})[_0x9bc2('0x29')](respondWithResult(_0x38822c,null))[_0x9bc2('0x61')](handleError(_0x38822c,null));};exports['addImap']=function(_0x51e4f8,_0x1a9160){if(_0x51e4f8[_0x9bc2('0x65')]['id']){delete _0x51e4f8[_0x9bc2('0x65')]['id'];}return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x51e4f8[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x1a9160,null))[_0x9bc2('0x29')](function(_0x51a84e){if(_0x51a84e){_0x51e4f8[_0x9bc2('0x65')]['MailAccountId']=_0x51a84e['id'];return db[_0x9bc2('0x46')][_0x9bc2('0x6d')](_0x51e4f8[_0x9bc2('0x65')]);}})[_0x9bc2('0x29')](respondWithResult(_0x1a9160,null))['catch'](handleError(_0x1a9160,null));};exports[_0x9bc2('0x81')]=function(_0x3e5cb6,_0x5386fe){return db['MailAccount'][_0x9bc2('0x6f')]({'where':{'id':_0x3e5cb6[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x5386fe,null))[_0x9bc2('0x29')](function(_0x2c00d4){if(_0x2c00d4){return _0x2c00d4['setImap'](null);}return null;})[_0x9bc2('0x29')](respondWithStatusCode(_0x5386fe,null))[_0x9bc2('0x61')](handleError(_0x5386fe,null));};exports[_0x9bc2('0x82')]=function(_0x120c39,_0xfed0b3){return db[_0x9bc2('0x5d')]['findOne']({'where':{'id':_0x120c39[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0xfed0b3,null))[_0x9bc2('0x29')](function(_0x46b731){if(_0x46b731){return _0x46b731[_0x9bc2('0x82')]();}return null;})[_0x9bc2('0x29')](respondWithResult(_0xfed0b3,null))[_0x9bc2('0x61')](handleError(_0xfed0b3,null));};exports[_0x9bc2('0x83')]=function(_0x243fef,_0x1f23e4){if(_0x243fef[_0x9bc2('0x65')]['id']){delete _0x243fef[_0x9bc2('0x65')]['id'];}return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x243fef['params']['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x1f23e4,null))[_0x9bc2('0x29')](function(_0x5acf35){if(_0x5acf35){_0x243fef['body']['MailAccountId']=_0x5acf35['id'];return db[_0x9bc2('0x47')][_0x9bc2('0x6d')](_0x243fef[_0x9bc2('0x65')]);}})[_0x9bc2('0x29')](respondWithResult(_0x1f23e4,null))[_0x9bc2('0x61')](handleError(_0x1f23e4,null));};exports[_0x9bc2('0x84')]=function(_0x289fbf,_0x3a2f5b){return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x289fbf[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x3a2f5b,null))[_0x9bc2('0x29')](function(_0x148aa){if(_0x148aa){return _0x148aa[_0x9bc2('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x3a2f5b,null))[_0x9bc2('0x61')](handleError(_0x3a2f5b,null));};exports[_0x9bc2('0x86')]=function(_0x11ebfd,_0x972250){return db[_0x9bc2('0x87')][_0x9bc2('0x67')]({'where':{'id':_0x11ebfd[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x972250,null))[_0x9bc2('0x29')](function(_0x47310a){if(_0x47310a){return _0x47310a[_0x9bc2('0x86')](_0x11ebfd[_0x9bc2('0x65')][_0x9bc2('0x72')],_[_0x9bc2('0x88')](_0x11ebfd[_0x9bc2('0x65')],[_0x9bc2('0x72'),'id'])||{});}})['then'](respondWithResult(_0x972250,null))['catch'](handleError(_0x972250,null));};exports['getInteractions']=function(_0x1eb5d2,_0x32975b){var _0x1022a0={'raw':![],'where':{}};var _0x1acad2={};var _0x1e5371={'count':0x0,'rows':[]};return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x1eb5d2['params']['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x32975b,null))['then'](function(_0x4005a8){if(_0x4005a8){_0x1acad2[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db['MailInteraction'][_0x9bc2('0x4a')]);_0x1acad2['query']=_[_0x9bc2('0x63')](_0x1eb5d2[_0x9bc2('0x4e')]);_0x1acad2[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x1acad2[_0x9bc2('0x4d')],_0x1acad2[_0x9bc2('0x4e')]);_0x1022a0[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x1acad2[_0x9bc2('0x4d')],qs['fields'](_0x1eb5d2[_0x9bc2('0x4e')]['fields']));_0x1022a0[_0x9bc2('0x51')]=_0x1022a0[_0x9bc2('0x51')]['length']?_0x1022a0[_0x9bc2('0x51')]:_0x1acad2[_0x9bc2('0x4d')];if(!_0x1eb5d2[_0x9bc2('0x4e')]['hasOwnProperty'](_0x9bc2('0x54'))){_0x1022a0['limit']=qs[_0x9bc2('0x21')](_0x1eb5d2['query'][_0x9bc2('0x21')]);_0x1022a0['offset']=qs[_0x9bc2('0x1e')](_0x1eb5d2[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}_0x1022a0[_0x9bc2('0x55')]=qs[_0x9bc2('0x56')](_0x1eb5d2[_0x9bc2('0x4e')]['sort']);_0x1022a0[_0x9bc2('0x58')]=qs[_0x9bc2('0x4f')](_[_0x9bc2('0x57')](_0x1eb5d2[_0x9bc2('0x4e')],_0x1acad2[_0x9bc2('0x4f')]));_0x1022a0[_0x9bc2('0x58')][_0x9bc2('0x6b')]=_0x4005a8['id'];if(_0x1eb5d2[_0x9bc2('0x4e')][_0x9bc2('0x76')]){_0x1022a0[_0x9bc2('0x58')]=_['merge'](_0x1022a0[_0x9bc2('0x58')],{'$or':_[_0x9bc2('0x49')](_0x1022a0[_0x9bc2('0x51')],function(_0x31b51a){var _0x18e1c7={};_0x18e1c7[_0x31b51a]={'$like':'%'+_0x1eb5d2['query'][_0x9bc2('0x76')]+'%'};return _0x18e1c7;})});}_0x1022a0=_[_0x9bc2('0x59')]({},_0x1022a0,_0x1eb5d2[_0x9bc2('0x5c')]);return db[_0x9bc2('0x87')][_0x9bc2('0x20')]({'where':_0x1022a0[_0x9bc2('0x58')]})[_0x9bc2('0x29')](function(_0x37b6eb){_0x1e5371[_0x9bc2('0x20')]=_0x37b6eb;if(_0x1eb5d2['query'][_0x9bc2('0x5e')]){_0x1022a0[_0x9bc2('0x5f')]=[{'model':db[_0x9bc2('0x89')],'as':'Contact','required':![]},{'model':db[_0x9bc2('0x8a')],'as':'Owner','attributes':[_0x9bc2('0x5b'),_0x9bc2('0x8b'),_0x9bc2('0x8c')],'required':![]},{'model':db[_0x9bc2('0x8d')],'as':_0x9bc2('0x8e'),'attributes':['id',_0x9bc2('0x5b'),_0x9bc2('0x8f')],'where':_0x1eb5d2['query'][_0x9bc2('0x90')]?{'id':_0x1eb5d2[_0x9bc2('0x4e')]['tag']}:undefined,'required':_0x1eb5d2[_0x9bc2('0x4e')][_0x9bc2('0x90')]?!![]:![]}];}return db[_0x9bc2('0x87')]['findAll'](_0x1022a0);})[_0x9bc2('0x29')](function(_0x43ffe3){_0x1e5371['rows']=_0x43ffe3;return _0x1e5371;});}})[_0x9bc2('0x29')](respondWithFilteredResult(_0x32975b,_0x1022a0))['catch'](handleError(_0x32975b,null));};exports['addApplications']=function addApplications(_0x2a4aa2,_0x1856c4){var _0x142bc9=_0x2a4aa2[_0x9bc2('0x68')]['id'];var _0x12190e=_0x2a4aa2['body'];var _0x119201=0xc8;var _0x31e21d=null;return db[_0x9bc2('0x91')][_0x9bc2('0x92')]({'isolationLevel':db[_0x9bc2('0x91')][_0x9bc2('0x93')]['ISOLATION_LEVELS'][_0x9bc2('0x94')]},function(_0x2b2d5b){return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x142bc9},'transaction':_0x2b2d5b})[_0x9bc2('0x29')](function(_0x43936a){if(_0x43936a){return db[_0x9bc2('0x95')][_0x9bc2('0x25')]({'where':{'MailAccountId':_0x142bc9},'transaction':_0x2b2d5b})[_0x9bc2('0x29')](function(){var _0x2cf766=_[_0x9bc2('0x49')](_0x12190e,function(_0x4146b4){_0x4146b4['MailAccountId']=_0x142bc9;return _0x4146b4;});return db[_0x9bc2('0x95')][_0x9bc2('0x96')](_0x2cf766,{'transaction':_0x2b2d5b});});}else{_0x119201=0x194;_0x31e21d=[];}});})[_0x9bc2('0x29')](function(){if(_0x119201!==0x194){return db[_0x9bc2('0x95')][_0x9bc2('0x97')]({'where':{'MailAccountId':_0x142bc9},'order':_0x9bc2('0x98')})[_0x9bc2('0x29')](function(_0x39d500){_0x31e21d=_0x39d500;});}})[_0x9bc2('0x61')](function(_0xa05297){_0x119201=0x1f4;logger[_0x9bc2('0x17')](_0xa05297[_0x9bc2('0x2a')]);if(_0xa05297[_0x9bc2('0x5b')]){delete _0xa05297['name'];}_0x31e21d=_0xa05297;})[_0x9bc2('0x99')](function(){if(_0x31e21d===null){_0x1856c4[_0x9bc2('0x1b')](_0x119201);}else{if(_0x119201===0x1f4){_0x1856c4[_0x9bc2('0x1c')](_0x119201)[_0x9bc2('0x2b')](_0x31e21d);}else{_0x1856c4[_0x9bc2('0x1c')](_0x119201)[_0x9bc2('0x1d')](_0x31e21d);}}});};exports[_0x9bc2('0x9a')]=function(_0x30ad78,_0x3626f8){var _0x183e92={};var _0x1fb452={};var _0x366237;var _0x39f238;return db[_0x9bc2('0x5d')][_0x9bc2('0x6f')]({'where':{'id':_0x30ad78[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x3626f8,null))[_0x9bc2('0x29')](function(_0x217dde){if(_0x217dde){_0x366237=_0x217dde;_0x1fb452[_0x9bc2('0x4d')]=_['keys'](db[_0x9bc2('0x95')][_0x9bc2('0x4a')]);_0x1fb452['query']=_[_0x9bc2('0x63')](_0x30ad78[_0x9bc2('0x4e')]);_0x1fb452[_0x9bc2('0x4f')]=_['intersection'](_0x1fb452[_0x9bc2('0x4d')],_0x1fb452[_0x9bc2('0x4e')]);_0x183e92[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x1fb452['model'],qs['fields'](_0x30ad78['query'][_0x9bc2('0x52')]));_0x183e92[_0x9bc2('0x51')]=_0x183e92[_0x9bc2('0x51')][_0x9bc2('0x64')]?_0x183e92['attributes']:_0x1fb452[_0x9bc2('0x4d')];_0x183e92['order']=qs['sort'](_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x56')]);_0x183e92[_0x9bc2('0x58')]=qs[_0x9bc2('0x4f')](_[_0x9bc2('0x57')](_0x30ad78[_0x9bc2('0x4e')],_0x1fb452[_0x9bc2('0x4f')]));if(_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x76')]){_0x183e92[_0x9bc2('0x58')]=_[_0x9bc2('0x59')](_0x183e92[_0x9bc2('0x58')],{'$or':_['map'](_0x183e92[_0x9bc2('0x51')],function(_0x4113b4){var _0x400adc={};_0x400adc[_0x4113b4]={'$like':'%'+_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x76')]+'%'};return _0x400adc;})});}_0x183e92=_[_0x9bc2('0x59')]({},_0x183e92,_0x30ad78[_0x9bc2('0x5c')]);return _0x366237[_0x9bc2('0x9a')](_0x183e92);}})[_0x9bc2('0x29')](function(_0x37724e){if(_0x37724e){_0x39f238=_0x37724e[_0x9bc2('0x64')];if(!_0x30ad78['query'][_0x9bc2('0x53')]('nolimit')){_0x183e92['limit']=qs[_0x9bc2('0x21')](_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x21')]);_0x183e92['offset']=qs['offset'](_0x30ad78[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}return _0x366237['getApplications'](_0x183e92);}})['then'](function(_0x5c6327){if(_0x5c6327){return _0x5c6327?{'count':_0x39f238,'rows':_0x5c6327}:null;}})[_0x9bc2('0x29')](respondWithResult(_0x3626f8,null))[_0x9bc2('0x61')](handleError(_0x3626f8,null));};exports[_0x9bc2('0x9b')]=function(_0x230cd2,_0x20cea3){var _0x2b96b0={'raw':!![],'where':{}};var _0x2e503d={};var _0x50d173={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x230cd2[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x20cea3,null))['then'](function(_0x347edc){if(_0x347edc){_0x2e503d['model']=_['keys'](db['MailMessage'][_0x9bc2('0x4a')]);_0x2e503d[_0x9bc2('0x4e')]=_['keys'](_0x230cd2[_0x9bc2('0x4e')]);_0x2e503d[_0x9bc2('0x4f')]=_[_0x9bc2('0x50')](_0x2e503d[_0x9bc2('0x4d')],_0x2e503d[_0x9bc2('0x4e')]);_0x2b96b0['attributes']=_[_0x9bc2('0x50')](_0x2e503d[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x2b96b0[_0x9bc2('0x51')]=_0x2b96b0['attributes'][_0x9bc2('0x64')]?_0x2b96b0[_0x9bc2('0x51')]:_0x2e503d[_0x9bc2('0x4d')];if(!_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x53')](_0x9bc2('0x54'))){_0x2b96b0['limit']=qs[_0x9bc2('0x21')](_0x230cd2[_0x9bc2('0x4e')]['limit']);_0x2b96b0[_0x9bc2('0x1e')]=qs[_0x9bc2('0x1e')](_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}_0x2b96b0[_0x9bc2('0x55')]=qs['sort'](_0x230cd2[_0x9bc2('0x4e')]['sort']);_0x2b96b0[_0x9bc2('0x58')]=qs[_0x9bc2('0x4f')](_[_0x9bc2('0x57')](_0x230cd2[_0x9bc2('0x4e')],_0x2e503d[_0x9bc2('0x4f')]));_0x2b96b0['where'][_0x9bc2('0x6b')]=_0x347edc['id'];if(_0x230cd2[_0x9bc2('0x4e')]['filter']){_0x2b96b0[_0x9bc2('0x58')]=_[_0x9bc2('0x59')](_0x2b96b0['where'],{'$or':_[_0x9bc2('0x49')](_0x2b96b0['attributes'],function(_0x1a17c7){var _0x18adf4={};_0x18adf4[_0x1a17c7]={'$like':'%'+_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x76')]+'%'};return _0x18adf4;})});}if(_0x230cd2[_0x9bc2('0x4e')]['$gte']){var _0x45b50f=_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x9c')][_0x9bc2('0x9d')](',');var _0xbd0b7b={};_0xbd0b7b[_0x45b50f[0x0]]={'$gte':moment(_0x45b50f[0x1])[_0x9bc2('0x9e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2b96b0['where']=_[_0x9bc2('0x59')](_0x2b96b0[_0x9bc2('0x58')],_0xbd0b7b);}_0x2b96b0=_['merge']({},_0x2b96b0,_0x230cd2[_0x9bc2('0x5c')]);return db[_0x9bc2('0x9f')][_0x9bc2('0x20')]({'where':_0x2b96b0[_0x9bc2('0x58')]})[_0x9bc2('0x29')](function(_0x19829b){_0x50d173[_0x9bc2('0x20')]=_0x19829b;if(_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0x5e')]){_0x2b96b0[_0x9bc2('0x5f')]=[{'all':!![]}];}return db[_0x9bc2('0x9f')][_0x9bc2('0x70')](_0x2b96b0);})[_0x9bc2('0x29')](function(_0x237781){if(_0x230cd2[_0x9bc2('0x4e')][_0x9bc2('0xa0')]===_0x9bc2('0xa1')){for(var _0x52a27a=0x0;_0x52a27a<_0x237781[_0x9bc2('0x64')];_0x52a27a++){_0x237781[_0x52a27a][_0x9bc2('0x65')]=juice(_0x237781[_0x52a27a]['body']);}}_0x50d173[_0x9bc2('0x60')]=_0x237781;return _0x50d173;});}})[_0x9bc2('0x29')](respondWithFilteredResult(_0x20cea3,_0x2b96b0))['catch'](handleError(_0x20cea3,null));};exports['send']=function(_0x28288c,_0x3e4768){var _0x3efe91,_0x541a90={},_0x316787;if(_0x28288c['body']['to']){_0x316787=_0x28288c['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x9bc2('0x67')]({'where':{'id':_0x28288c[_0x9bc2('0x68')]['id']},'include':[{'model':db[_0x9bc2('0xa2')],'as':_0x9bc2('0xa3'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x316787},'limit':0x1,'order':[[_0x9bc2('0xa4'),_0x9bc2('0xa5')]]}]},{'model':db[_0x9bc2('0x47')],'as':_0x9bc2('0x44'),'raw':!![],'include':[{'model':db[_0x9bc2('0xa6')],'as':_0x9bc2('0xa6'),'raw':!![]}]}]})[_0x9bc2('0x29')](handleEntityNotFound(_0x3e4768,null))[_0x9bc2('0x29')](function(_0x4cb5be){if(!_0x4cb5be)return;_0x3efe91=_0x4cb5be;if(!_0x4cb5be[_0x9bc2('0x44')])throw new Error(_0x9bc2('0xa7'));if(_[_0x9bc2('0xa8')](_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xa9')])){_0x28288c['body'][_0x9bc2('0xa9')]=util[_0x9bc2('0x9e')](_0x9bc2('0xaa'),_0x4cb5be[_0x9bc2('0x5b')],_0x4cb5be[_0x9bc2('0x79')]||_0x4cb5be[_0x9bc2('0x44')][_0x9bc2('0x38')]);}if(_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')]&&_0x28288c['body'][_0x9bc2('0xab')][_0x9bc2('0x64')]){for(var _0x5d799c=0x0;_0x5d799c<_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')][_0x9bc2('0x64')];_0x5d799c+=0x1){_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')][_0x5d799c]={'filename':_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')][_0x5d799c]['name'],'path':path[_0x9bc2('0xac')](config[_0x9bc2('0xad')],'server/files/attachments',_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xab')][_0x5d799c][_0x9bc2('0xae')])};}}var _0x1b69d7=_0x4cb5be[_0x9bc2('0xaf')]();return respondWithRpcPromise(_0x9bc2('0xb0'),_0x9bc2('0xb1'),{'account':_0x1b69d7,'message':_0x28288c[_0x9bc2('0x65')]});})[_0x9bc2('0x29')](function(_0x1021e7){if(!_0x1021e7)return;_0x541a90=_0x1021e7;if(!_0x3efe91[_0x9bc2('0xa3')])throw new Error(_0x9bc2('0xb2'));if(_0x3efe91[_0x9bc2('0xa3')][_0x9bc2('0xb3')][_0x9bc2('0x64')])return _0x3efe91[_0x9bc2('0xa3')]['Contacts'][0x0];return db[_0x9bc2('0x89')][_0x9bc2('0x6d')](_[_0x9bc2('0xa')](_0x28288c[_0x9bc2('0x65')],{'firstName':_0x28288c[_0x9bc2('0x65')]['to'],'email':_0x28288c[_0x9bc2('0x65')]['to'],'phone':_0x28288c[_0x9bc2('0x65')]['to'],'ListId':_0x3efe91[_0x9bc2('0xb4')]}));})[_0x9bc2('0x29')](function(_0x872c7e){if(!_0x872c7e)return;var _0x5cd338={'UserId':_0x28288c['user']['id'],'ContactId':_0x872c7e['id'],'MailAccountId':_0x3efe91['id'],'inReplyTo':_0x541a90['messageId'],'to':_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xa9')],'cc':_0x28288c['body']['cc'],'subject':_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xb5')],'attach':_0x28288c[_0x9bc2('0x65')]['attach'],'firstMsgDirection':_0x9bc2('0xb6'),'lastMsgAt':moment()['format'](_0x9bc2('0xb7')),'lastMsgDirection':_0x9bc2('0xb6'),'Messages':[_['merge'](_0x28288c['body'],{'messageId':_0x541a90[_0x9bc2('0xb8')],'sentAt':moment()[_0x9bc2('0x9e')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x3efe91['id'],'UserId':_0x28288c['user']['id'],'ContactId':_0x872c7e['id']})]};if(_0x28288c['body'][_0x9bc2('0xb9')]){_0x5cd338=_['merge'](_0x5cd338,_0x28288c[_0x9bc2('0x65')][_0x9bc2('0xb9')]);}return db[_0x9bc2('0x87')]['create'](_0x5cd338,{'include':[{'model':db[_0x9bc2('0x9f')],'as':'Messages'}]});})['then'](respondWithResult(_0x3e4768,null))[_0x9bc2('0x61')](handleError(_0x3e4768,null));};exports[_0x9bc2('0xba')]=function(_0x51b189,_0x29ed82){return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x51b189[_0x9bc2('0x68')]['id']},'include':[{'model':db[_0x9bc2('0x47')],'as':_0x9bc2('0x44'),'raw':!![],'include':[{'model':db[_0x9bc2('0xa6')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x29ed82,null))[_0x9bc2('0x29')](function(_0x3fdc07){if(!_0x3fdc07[_0x9bc2('0x44')])return;var _0x5b939a=_0x3fdc07[_0x9bc2('0xaf')]();return respondWithRpcPromise(_0x9bc2('0xbb'),_0x9bc2('0xba'),{'account':_0x5b939a});})[_0x9bc2('0x29')](respondWithResult(_0x29ed82,null))[_0x9bc2('0x61')](handleError(_0x29ed82,null));};exports['destroy']=function(_0x3b5f51,_0x2ba1c9){return db['MailAccount'][_0x9bc2('0x67')]({'where':{'id':_0x3b5f51[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x2ba1c9,null))[_0x9bc2('0x29')](function(_0xc6642d){if(_0xc6642d&&_0xc6642d[_0x9bc2('0x40')]){throw new db[(_0x9bc2('0xbc'))][(_0x9bc2('0xbd'))](_0x9bc2('0xbe'));}return _0xc6642d;})['then'](removeEntity(_0x2ba1c9,null))[_0x9bc2('0x61')](handleError(_0x2ba1c9,null));};exports['addAgents']=function(_0x135cfe,_0x205aed){return db[_0x9bc2('0x5d')][_0x9bc2('0x67')]({'where':{'id':_0x135cfe[_0x9bc2('0x68')]['id']}})['then'](handleEntityNotFound(_0x205aed,null))[_0x9bc2('0x29')](function(_0x2df765){if(_0x2df765){return _0x2df765['addAgents'](_0x135cfe[_0x9bc2('0x65')]['ids'],_['omit'](_0x135cfe[_0x9bc2('0x65')],[_0x9bc2('0x72'),'id'])||{})[_0x9bc2('0xbf')](function(_0x106ac2){for(var _0xd355d0=0x0;_0xd355d0<_0x135cfe[_0x9bc2('0x65')]['ids'][_0x9bc2('0x64')];_0xd355d0+=0x1){socket[_0x9bc2('0xc0')](_0x9bc2('0xc1'),{'UserId':Number(_0x135cfe['body'][_0x9bc2('0x72')][_0xd355d0]),'MailAccountId':Number(_0x135cfe['params']['id'])});}return _0x106ac2;});}})[_0x9bc2('0x29')](respondWithResult(_0x205aed,null))[_0x9bc2('0x61')](handleError(_0x205aed,null));};exports[_0x9bc2('0xc2')]=function(_0x2d8d56,_0x49d031){return db[_0x9bc2('0x5d')]['find']({'where':{'id':_0x2d8d56[_0x9bc2('0x68')]['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x49d031,null))[_0x9bc2('0x29')](function(_0x1a325b){if(_0x1a325b){return _0x1a325b[_0x9bc2('0xc2')](_0x2d8d56[_0x9bc2('0x4e')][_0x9bc2('0x72')])[_0x9bc2('0x29')](function(){if(_[_0x9bc2('0xc3')](_0x2d8d56[_0x9bc2('0x4e')][_0x9bc2('0x72')])){for(var _0x2fc6c1=0x0;_0x2fc6c1<_0x2d8d56[_0x9bc2('0x4e')]['ids'][_0x9bc2('0x64')];_0x2fc6c1+=0x1){socket[_0x9bc2('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x2d8d56[_0x9bc2('0x4e')][_0x9bc2('0x72')][_0x2fc6c1]),'MailAccountId':Number(_0x2d8d56['params']['id'])});}}else{socket[_0x9bc2('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x2d8d56[_0x9bc2('0x4e')][_0x9bc2('0x72')]),'MailAccountId':Number(_0x2d8d56[_0x9bc2('0x68')]['id'])});}});}})[_0x9bc2('0x29')](respondWithStatusCode(_0x49d031,null))['catch'](handleError(_0x49d031,null));};exports['getAgents']=function(_0x40199a,_0x26457a){var _0x28a074={};var _0x3a7282={};var _0x3b0684;var _0x2269bd;return db[_0x9bc2('0x5d')]['findOne']({'where':{'id':_0x40199a['params']['id']}})[_0x9bc2('0x29')](handleEntityNotFound(_0x26457a,null))[_0x9bc2('0x29')](function(_0x300068){if(_0x300068){_0x3b0684=_0x300068;_0x3a7282[_0x9bc2('0x4d')]=_[_0x9bc2('0x63')](db[_0x9bc2('0x8a')]['rawAttributes']);_0x3a7282[_0x9bc2('0x4e')]=_[_0x9bc2('0x63')](_0x40199a['query']);_0x3a7282['filters']=_['intersection'](_0x3a7282['model'],_0x3a7282['query']);_0x28a074[_0x9bc2('0x51')]=_[_0x9bc2('0x50')](_0x3a7282[_0x9bc2('0x4d')],qs[_0x9bc2('0x52')](_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x52')]));_0x28a074[_0x9bc2('0x51')]=_0x28a074[_0x9bc2('0x51')]['length']?_0x28a074[_0x9bc2('0x51')]:_0x3a7282[_0x9bc2('0x4d')];_0x28a074[_0x9bc2('0x55')]=qs[_0x9bc2('0x56')](_0x40199a['query']['sort']);_0x28a074[_0x9bc2('0x58')]=qs['filters'](_[_0x9bc2('0x57')](_0x40199a[_0x9bc2('0x4e')],_0x3a7282[_0x9bc2('0x4f')]));if(_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x76')]){_0x28a074[_0x9bc2('0x58')]=_[_0x9bc2('0x59')](_0x28a074[_0x9bc2('0x58')],{'$or':_[_0x9bc2('0x49')](_0x28a074[_0x9bc2('0x51')],function(_0x3d070e){var _0x4cd275={};_0x4cd275[_0x3d070e]={'$like':'%'+_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x76')]+'%'};return _0x4cd275;})});}_0x28a074=_[_0x9bc2('0x59')]({},_0x28a074,_0x40199a[_0x9bc2('0x5c')]);return _0x3b0684[_0x9bc2('0xc4')](_0x28a074);}})['then'](function(_0x47aac1){if(_0x47aac1){_0x2269bd=_0x47aac1[_0x9bc2('0x64')];if(!_0x40199a[_0x9bc2('0x4e')]['hasOwnProperty'](_0x9bc2('0x54'))){_0x28a074[_0x9bc2('0x21')]=qs['limit'](_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x21')]);_0x28a074[_0x9bc2('0x1e')]=qs[_0x9bc2('0x1e')](_0x40199a[_0x9bc2('0x4e')][_0x9bc2('0x1e')]);}return _0x3b0684[_0x9bc2('0xc4')](_0x28a074);}})['then'](function(_0x12faf0){if(_0x12faf0){return _0x12faf0?{'count':_0x2269bd,'rows':_0x12faf0}:null;}})['then'](respondWithResult(_0x26457a,null))[_0x9bc2('0x61')](handleError(_0x26457a,null));}; \ No newline at end of file +var _0x8b6d=['limit','json','update','destroy','MailAccounts','sendStatus','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','yahoo','user','username','pass','password','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','Pause','rawAttributes','length','includeAll','find','body','provider','describe','addDisposition','MailAccountId','getDispositions','findOne','Disposition','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','custom','email','isNil','active','description','get','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','server/files/attachments','basename','SendMail','ListId','messageId','attach','out','Interaction','Messages','CloudProvider','getSmtpOptions','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','undefined','offset','count'];(function(_0x3bfc8e,_0x22bcdb){var _0x74bb71=function(_0x327cc9){while(--_0x327cc9){_0x3bfc8e['push'](_0x3bfc8e['shift']());}};_0x74bb71(++_0x22bcdb);}(_0x8b6d,0x99));var _0xd8b6=function(_0x2efe75,_0x3cf3fb){_0x2efe75=_0x2efe75-0x0;var _0x6c6ef8=_0x8b6d[_0x2efe75];return _0x6c6ef8;};'use strict';var moment=require(_0xd8b6('0x0'));var BPromise=require(_0xd8b6('0x1'));var util=require(_0xd8b6('0x2'));var path=require(_0xd8b6('0x3'));var _=require(_0xd8b6('0x4'));var juice=require(_0xd8b6('0x5'));var Redis=require(_0xd8b6('0x6'));var qs=require(_0xd8b6('0x7'));var logger=require(_0xd8b6('0x8'))('api');var config=require(_0xd8b6('0x9'));var db=require(_0xd8b6('0xa'))['db'];config['redis']=_[_0xd8b6('0xb')](config[_0xd8b6('0xc')],{'host':_0xd8b6('0xd'),'port':0x18eb});var socket=require(_0xd8b6('0xe'))(new Redis(config[_0xd8b6('0xc')]));require(_0xd8b6('0xf'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd8b6('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x458b16,_0x53649e,_0xcfe1bd,_0x586b43){return new BPromise(function(_0x404581,_0x320001){var _0x137f2e=_0x586b43||client;return _0x137f2e[_0xd8b6('0x11')](_0x458b16,_0xcfe1bd)[_0xd8b6('0x12')](function(_0x173824){logger[_0xd8b6('0x13')](_0xd8b6('0x14'),_0x53649e,_0xd8b6('0x15'));logger['debug'](_0xd8b6('0x16'),_0x53649e,'request\x20sent',JSON[_0xd8b6('0x17')](_0x173824));if(_0x173824[_0xd8b6('0x18')]){if(_0x173824[_0xd8b6('0x18')]['code']===0x1f4){logger[_0xd8b6('0x18')](_0xd8b6('0x14'),_0x53649e,_0x173824[_0xd8b6('0x18')][_0xd8b6('0x19')]);return _0x320001(_0x173824[_0xd8b6('0x18')]['message']);}logger[_0xd8b6('0x18')](_0xd8b6('0x14'),_0x53649e,_0x173824[_0xd8b6('0x18')][_0xd8b6('0x19')]);return _0x404581(_0x173824[_0xd8b6('0x18')]['message']);}else{logger[_0xd8b6('0x13')]('MailAccount,\x20%s,\x20%s',_0x53649e,'request\x20sent');_0x404581(_0x173824[_0xd8b6('0x1a')][_0xd8b6('0x19')]);}})[_0xd8b6('0x1b')](function(_0x2f60a5){logger[_0xd8b6('0x18')]('MailAccount,\x20%s,\x20%s',_0x53649e,_0x2f60a5);_0x320001(_0x2f60a5);});});}function respondWithStatusCode(_0x4dcdd3,_0x1ef7ee){_0x1ef7ee=_0x1ef7ee||0xcc;return function(_0x420b18){if(_0x420b18){return _0x4dcdd3['sendStatus'](_0x1ef7ee);}return _0x4dcdd3[_0xd8b6('0x1c')](_0x1ef7ee)[_0xd8b6('0x1d')]();};}function respondWithResult(_0x2aa70d,_0x312896){_0x312896=_0x312896||0xc8;return function(_0x47d7ff){if(_0x47d7ff){return _0x2aa70d[_0xd8b6('0x1c')](_0x312896)['json'](_0x47d7ff);}};}function respondWithFilteredResult(_0x881a04,_0x278249){return function(_0x315c05){if(_0x315c05){var _0x1c0878=typeof _0x278249['offset']===_0xd8b6('0x1e')&&typeof _0x278249['limit']===_0xd8b6('0x1e');var _0x36bb07=_0x315c05['count'];var _0x416867=_0x1c0878?0x0:_0x278249[_0xd8b6('0x1f')];var _0x2e135f=_0x1c0878?_0x315c05[_0xd8b6('0x20')]:_0x278249[_0xd8b6('0x1f')]+_0x278249[_0xd8b6('0x21')];var _0x160793;if(_0x2e135f>=_0x36bb07){_0x2e135f=_0x36bb07;_0x160793=0xc8;}else{_0x160793=0xce;}_0x881a04[_0xd8b6('0x1c')](_0x160793);return _0x881a04['set']('Content-Range',_0x416867+'-'+_0x2e135f+'/'+_0x36bb07)[_0xd8b6('0x22')](_0x315c05);}return null;};}function saveUpdates(_0x5a4958){return function(_0x460b00){if(_0x460b00){return _0x460b00[_0xd8b6('0x23')](_0x5a4958)[_0xd8b6('0x12')](function(_0x2d9591){return _0x2d9591;});}return null;};}function removeEntity(_0x194d68){return function(_0x1cfbaa){if(_0x1cfbaa){return _0x1cfbaa[_0xd8b6('0x24')]()[_0xd8b6('0x12')](function(){var _0x2ca1e5=_0x1cfbaa['get']({'plain':!![]});var _0x2f896a=_0xd8b6('0x25');return db['UserProfileResource'][_0xd8b6('0x24')]({'where':{'type':_0x2f896a,'resourceId':_0x2ca1e5['id']}})['then'](function(){return _0x1cfbaa;});})[_0xd8b6('0x12')](function(){_0x194d68[_0xd8b6('0x1c')](0xcc)[_0xd8b6('0x1d')]();});}};}function handleEntityNotFound(_0x76caf6){return function(_0x370677){if(!_0x370677){_0x76caf6[_0xd8b6('0x26')](0x194);}return _0x370677;};}function handleError(_0x11b398,_0x5bc242){_0x5bc242=_0x5bc242||0x1f4;return function(_0x555376){logger[_0xd8b6('0x18')](_0x555376[_0xd8b6('0x27')]);if(_0x555376[_0xd8b6('0x28')]){delete _0x555376[_0xd8b6('0x28')];}_0x11b398[_0xd8b6('0x1c')](_0x5bc242)[_0xd8b6('0x29')](_0x555376);};}function getImapHost(_0x11211b){switch(_0x11211b){case _0xd8b6('0x2a'):return _0xd8b6('0x2b');case'yahoo':return _0xd8b6('0x2c');case _0xd8b6('0x2d'):return _0xd8b6('0x2e');case _0xd8b6('0x2f'):return _0xd8b6('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x11211b);}function getSmtpHost(_0x1d49ea){switch(_0x1d49ea){case _0xd8b6('0x2a'):return _0xd8b6('0x31');case _0xd8b6('0x32'):return'smtp.mail.yahoo.com';case _0xd8b6('0x2d'):return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x1d49ea);}function getAuthenticationOptions(_0x347f08,_0x7510da){var _0x31aab0={};var _0x2d54f5={};if(_0x347f08){_0x31aab0[_0xd8b6('0x33')]=_0x2d54f5[_0xd8b6('0x33')]=_0x7510da[_0xd8b6('0x34')];_0x31aab0['password']=_0x2d54f5[_0xd8b6('0x35')]=_0x7510da[_0xd8b6('0x36')];if(_0x7510da[_0xd8b6('0x37')]){_0x31aab0[_0xd8b6('0x37')]=_0x2d54f5[_0xd8b6('0x37')]=!![];_0x31aab0['CloudProviderId']=_0x2d54f5[_0xd8b6('0x38')]=_0x7510da[_0xd8b6('0x38')];_0x31aab0[_0xd8b6('0x36')]=_0x2d54f5[_0xd8b6('0x35')]=null;}else{_0x31aab0[_0xd8b6('0x38')]=_0x2d54f5[_0xd8b6('0x38')]=null;}_0x31aab0['host']=getImapHost(_0x347f08);_0x31aab0[_0xd8b6('0x39')]=0x3e1;_0x2d54f5[_0xd8b6('0x3a')]=getSmtpHost(_0x347f08);_0x2d54f5['port']=0x24b;_0x2d54f5[_0xd8b6('0x3b')]=![];_0x31aab0[_0xd8b6('0x3c')]=_0x2d54f5[_0xd8b6('0x3c')]=null;}else{if(_0x7510da[_0xd8b6('0x3d')]){_0x31aab0['user']=_0x2d54f5[_0xd8b6('0x33')]=_0x7510da[_0xd8b6('0x34')];_0x31aab0[_0xd8b6('0x36')]=_0x2d54f5[_0xd8b6('0x35')]=_0x7510da[_0xd8b6('0x36')];}else{_0x31aab0[_0xd8b6('0x3d')]=_0x2d54f5[_0xd8b6('0x3d')]=![];_0x31aab0[_0xd8b6('0x33')]=_0x2d54f5[_0xd8b6('0x33')]=null;_0x31aab0['password']=_0x2d54f5[_0xd8b6('0x35')]=null;}_0x31aab0['host']=_0x7510da['Imap'][_0xd8b6('0x3a')];_0x31aab0[_0xd8b6('0x39')]=_0x7510da[_0xd8b6('0x3e')][_0xd8b6('0x39')];_0x2d54f5[_0xd8b6('0x3a')]=_0x7510da[_0xd8b6('0x3f')][_0xd8b6('0x3a')];_0x2d54f5[_0xd8b6('0x39')]=_0x7510da[_0xd8b6('0x3f')][_0xd8b6('0x39')];}return{'Imap':_0x31aab0,'Smtp':_0x2d54f5};}exports[_0xd8b6('0x40')]=function(_0x849474,_0x12ab3a){var _0x40773f={'include':[{'model':db[_0xd8b6('0x41')],'as':_0xd8b6('0x3e')},{'model':db[_0xd8b6('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':_0xd8b6('0x43')}]},_0xf77cc={},_0x2944a1={'count':0x0,'rows':[]};var _0x484bf7=_[_0xd8b6('0x44')](db[_0xd8b6('0x45')]['rawAttributes'],function(_0x888561){return{'name':_0x888561['fieldName'],'type':_0x888561[_0xd8b6('0x46')][_0xd8b6('0x47')]};});_0xf77cc[_0xd8b6('0x48')]=_[_0xd8b6('0x44')](_0x484bf7,'name');_0xf77cc[_0xd8b6('0x49')]=_[_0xd8b6('0x4a')](_0x849474['query']);_0xf77cc[_0xd8b6('0x4b')]=_['intersection'](_0xf77cc['model'],_0xf77cc[_0xd8b6('0x49')]);_0x40773f['attributes']=_[_0xd8b6('0x4c')](_0xf77cc['model'],qs['fields'](_0x849474[_0xd8b6('0x49')][_0xd8b6('0x4d')]));_0x40773f[_0xd8b6('0x4e')]=_0x40773f['attributes']['length']?_0x40773f[_0xd8b6('0x4e')]:_0xf77cc[_0xd8b6('0x48')];if(!_0x849474[_0xd8b6('0x49')][_0xd8b6('0x4f')](_0xd8b6('0x50'))){_0x40773f['limit']=qs[_0xd8b6('0x21')](_0x849474['query'][_0xd8b6('0x21')]);_0x40773f[_0xd8b6('0x1f')]=qs['offset'](_0x849474[_0xd8b6('0x49')][_0xd8b6('0x1f')]);}_0x40773f[_0xd8b6('0x51')]=qs[_0xd8b6('0x52')](_0x849474[_0xd8b6('0x49')][_0xd8b6('0x52')]);_0x40773f[_0xd8b6('0x53')]=qs[_0xd8b6('0x4b')](_['pick'](_0x849474[_0xd8b6('0x49')],_0xf77cc['filters']),_0x484bf7);if(_0x849474[_0xd8b6('0x49')][_0xd8b6('0x54')]){_0x40773f['where']=_[_0xd8b6('0x55')](_0x40773f[_0xd8b6('0x53')],{'$or':_[_0xd8b6('0x44')](_0x484bf7,function(_0xbeb7ed){if(_0xbeb7ed[_0xd8b6('0x46')]!==_0xd8b6('0x56')){var _0xd721d0={};_0xd721d0[_0xbeb7ed[_0xd8b6('0x28')]]={'$like':'%'+_0x849474[_0xd8b6('0x49')][_0xd8b6('0x54')]+'%'};return _0xd721d0;}})});}_0x40773f=_[_0xd8b6('0x55')]({},_0x40773f,_0x849474[_0xd8b6('0x57')]);var _0xdfa311={'where':_0x40773f['where']};return db[_0xd8b6('0x45')]['count'](_0xdfa311)['then'](function(_0x2712b8){_0x2944a1['count']=_0x2712b8;if(_0x849474['query']['includeAll']){_0x40773f[_0xd8b6('0x58')]=[{'all':!![]}];}return db[_0xd8b6('0x45')][_0xd8b6('0x59')](_0x40773f);})[_0xd8b6('0x12')](function(_0x5683cd){_0x2944a1[_0xd8b6('0x5a')]=_0x5683cd;return _0x2944a1;})[_0xd8b6('0x12')](respondWithFilteredResult(_0x12ab3a,_0x40773f))[_0xd8b6('0x1b')](handleError(_0x12ab3a,null));};exports[_0xd8b6('0x5b')]=function(_0x347f34,_0x92ce50){var _0x5c87fe={'raw':![],'where':{'id':_0x347f34[_0xd8b6('0x5c')]['id']},'include':[{'model':db[_0xd8b6('0x41')],'as':_0xd8b6('0x3e')},{'model':db[_0xd8b6('0x42')],'as':'Smtp'},{'model':db[_0xd8b6('0x5d')],'as':_0xd8b6('0x43')}]},_0x5ad18a={};_0x5ad18a[_0xd8b6('0x48')]=_[_0xd8b6('0x4a')](db['MailAccount'][_0xd8b6('0x5e')]);_0x5ad18a['query']=_[_0xd8b6('0x4a')](_0x347f34[_0xd8b6('0x49')]);_0x5ad18a['filters']=_['intersection'](_0x5ad18a[_0xd8b6('0x48')],_0x5ad18a[_0xd8b6('0x49')]);_0x5c87fe[_0xd8b6('0x4e')]=_[_0xd8b6('0x4c')](_0x5ad18a[_0xd8b6('0x48')],qs[_0xd8b6('0x4d')](_0x347f34[_0xd8b6('0x49')][_0xd8b6('0x4d')]));_0x5c87fe['attributes']=_0x5c87fe[_0xd8b6('0x4e')][_0xd8b6('0x5f')]?_0x5c87fe[_0xd8b6('0x4e')]:_0x5ad18a['model'];if(_0x347f34[_0xd8b6('0x49')][_0xd8b6('0x60')]){_0x5c87fe['include']=[{'all':!![]}];}_0x5c87fe=_[_0xd8b6('0x55')]({},_0x5c87fe,_0x347f34['options']);return db['MailAccount'][_0xd8b6('0x61')](_0x5c87fe)[_0xd8b6('0x12')](handleEntityNotFound(_0x92ce50,null))[_0xd8b6('0x12')](respondWithResult(_0x92ce50,null))[_0xd8b6('0x1b')](handleError(_0x92ce50,null));};exports['update']=function(_0x3add41,_0x57f40d){if(_0x3add41[_0xd8b6('0x62')]['id']){delete _0x3add41[_0xd8b6('0x62')]['id'];}var _0x5c880b=_0x3add41[_0xd8b6('0x62')][_0xd8b6('0x63')]==='custom'?null:_0x3add41[_0xd8b6('0x62')][_0xd8b6('0x63')];var _0x242c21=_0x3add41[_0xd8b6('0x62')][_0xd8b6('0x3e')]||{};var _0x23767e=_0x3add41[_0xd8b6('0x62')][_0xd8b6('0x3f')]||{};if(_0x5c880b){_0x242c21['host']=getImapHost(_0x5c880b);_0x242c21[_0xd8b6('0x39')]=0x3e1;_0x23767e[_0xd8b6('0x3a')]=getSmtpHost(_0x5c880b);_0x23767e[_0xd8b6('0x39')]=0x24b;_0x23767e['secure']=![];}if(_0x23767e[_0xd8b6('0x37')]){_0x23767e[_0xd8b6('0x3b')]=![];}else{_0x23767e[_0xd8b6('0x38')]=null;}if(!_0x242c21[_0xd8b6('0x37')])_0x242c21[_0xd8b6('0x38')]=null;_0x3add41[_0xd8b6('0x62')][_0xd8b6('0x3e')]=_0x242c21;_0x3add41[_0xd8b6('0x62')]['Smtp']=_0x23767e;return db['MailAccount'][_0xd8b6('0x61')]({'where':{'id':_0x3add41[_0xd8b6('0x5c')]['id']},'include':[{'model':db[_0xd8b6('0x41')],'as':_0xd8b6('0x3e')},{'model':db[_0xd8b6('0x42')],'as':_0xd8b6('0x3f')},{'model':db['Pause'],'as':_0xd8b6('0x43')}]})[_0xd8b6('0x12')](handleEntityNotFound(_0x57f40d,null))['then'](function(_0x268072){if(!_0x268072)throw new Error('Mail\x20Account\x20not\x20found');if(_0x268072[_0xd8b6('0x3c')])delete _0x3add41[_0xd8b6('0x62')][_0xd8b6('0x3e')];return _0x268072;})[_0xd8b6('0x12')](saveUpdates(_0x3add41[_0xd8b6('0x62')],null))[_0xd8b6('0x12')](function(_0x43d319){if(!_0x3add41[_0xd8b6('0x62')]['Imap'])return _0x43d319;return db['MailServerIn'][_0xd8b6('0x23')](_0x3add41['body'][_0xd8b6('0x3e')],{'where':{'MailAccountId':_0x43d319['id']}})['then'](function(){return _0x43d319;});})[_0xd8b6('0x12')](function(_0x46746f){if(!_0x3add41['body'][_0xd8b6('0x3f')])return _0x46746f;return db[_0xd8b6('0x42')][_0xd8b6('0x23')](_0x3add41[_0xd8b6('0x62')][_0xd8b6('0x3f')],{'where':{'MailAccountId':_0x46746f['id']}})['then'](function(){return _0x46746f;});})[_0xd8b6('0x12')](respondWithResult(_0x57f40d,null))[_0xd8b6('0x1b')](handleError(_0x57f40d,null));};exports['describe']=function(_0x464449,_0x457c43){return db[_0xd8b6('0x45')][_0xd8b6('0x64')]()[_0xd8b6('0x12')](respondWithResult(_0x457c43,null))[_0xd8b6('0x1b')](handleError(_0x457c43,null));};exports[_0xd8b6('0x65')]=function(_0x4d66ef,_0x40b34d){if(_0x4d66ef[_0xd8b6('0x62')]['id']){delete _0x4d66ef[_0xd8b6('0x62')]['id'];}return db[_0xd8b6('0x45')][_0xd8b6('0x61')]({'where':{'id':_0x4d66ef[_0xd8b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x40b34d,null))[_0xd8b6('0x12')](function(_0x1bd530){if(_0x1bd530){_0x4d66ef[_0xd8b6('0x62')][_0xd8b6('0x66')]=_0x1bd530['id'];return db['Disposition']['create'](_0x4d66ef[_0xd8b6('0x62')]);}})[_0xd8b6('0x12')](respondWithResult(_0x40b34d,null))['catch'](handleError(_0x40b34d,null));};exports[_0xd8b6('0x67')]=function(_0x581da2,_0x549630){var _0x506710={'raw':![],'where':{}};var _0xe0c408={};var _0x2f0cc2={'count':0x0,'rows':[]};return db['MailAccount'][_0xd8b6('0x68')]({'where':{'id':_0x581da2[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x549630,null))[_0xd8b6('0x12')](function(_0x2a4297){if(_0x2a4297){_0xe0c408[_0xd8b6('0x48')]=_['keys'](db[_0xd8b6('0x69')][_0xd8b6('0x5e')]);_0xe0c408[_0xd8b6('0x49')]=_[_0xd8b6('0x4a')](_0x581da2['query']);_0xe0c408[_0xd8b6('0x4b')]=_[_0xd8b6('0x4c')](_0xe0c408[_0xd8b6('0x48')],_0xe0c408[_0xd8b6('0x49')]);_0x506710['attributes']=_[_0xd8b6('0x4c')](_0xe0c408['model'],qs['fields'](_0x581da2['query'][_0xd8b6('0x4d')]));_0x506710[_0xd8b6('0x4e')]=_0x506710[_0xd8b6('0x4e')][_0xd8b6('0x5f')]?_0x506710[_0xd8b6('0x4e')]:_0xe0c408[_0xd8b6('0x48')];if(!_0x581da2[_0xd8b6('0x49')][_0xd8b6('0x4f')](_0xd8b6('0x50'))){_0x506710[_0xd8b6('0x21')]=qs[_0xd8b6('0x21')](_0x581da2[_0xd8b6('0x49')]['limit']);_0x506710[_0xd8b6('0x1f')]=qs[_0xd8b6('0x1f')](_0x581da2['query'][_0xd8b6('0x1f')]);}_0x506710[_0xd8b6('0x51')]=qs['sort'](_0x581da2[_0xd8b6('0x49')]['sort']);_0x506710[_0xd8b6('0x53')]=qs[_0xd8b6('0x4b')](_['pick'](_0x581da2[_0xd8b6('0x49')],_0xe0c408[_0xd8b6('0x4b')]));_0x506710[_0xd8b6('0x53')][_0xd8b6('0x66')]=_0x2a4297['id'];if(_0x581da2[_0xd8b6('0x49')]['filter']){_0x506710[_0xd8b6('0x53')]=_['merge'](_0x506710[_0xd8b6('0x53')],{'$or':_[_0xd8b6('0x44')](_0x506710[_0xd8b6('0x4e')],function(_0x14f6b4){var _0x2a5e64={};_0x2a5e64[_0x14f6b4]={'$like':'%'+_0x581da2['query'][_0xd8b6('0x54')]+'%'};return _0x2a5e64;})});}_0x506710=_[_0xd8b6('0x55')]({},_0x506710,_0x581da2['options']);return db['Disposition']['count']({'where':_0x506710[_0xd8b6('0x53')]})[_0xd8b6('0x12')](function(_0x2174c4){_0x2f0cc2['count']=_0x2174c4;if(_0x581da2['query']['includeAll']){_0x506710[_0xd8b6('0x58')]=[{'all':!![]}];}return db['Disposition'][_0xd8b6('0x59')](_0x506710);})['then'](function(_0x3e66bd){_0x2f0cc2[_0xd8b6('0x5a')]=_0x3e66bd;return _0x2f0cc2;});}})[_0xd8b6('0x12')](respondWithFilteredResult(_0x549630,_0x506710))[_0xd8b6('0x1b')](handleError(_0x549630,null));};exports['removeDispositions']=function(_0x443c0c,_0x26f419){return db[_0xd8b6('0x45')]['find']({'where':{'id':_0x443c0c[_0xd8b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x26f419,null))[_0xd8b6('0x12')](function(_0x42de65){if(_0x42de65){return _0x42de65['removeDispositions'](_0x443c0c['query'][_0xd8b6('0x6a')]);}})[_0xd8b6('0x12')](respondWithStatusCode(_0x26f419,null))[_0xd8b6('0x1b')](handleError(_0x26f419,null));};exports[_0xd8b6('0x6b')]=function(_0x2b9f26,_0x19954d){if(_0x2b9f26['body']['id']){delete _0x2b9f26[_0xd8b6('0x62')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x2b9f26[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x19954d,null))['then'](function(_0x399421){if(_0x399421){_0x2b9f26[_0xd8b6('0x62')][_0xd8b6('0x66')]=_0x399421['id'];return db[_0xd8b6('0x6c')][_0xd8b6('0x6d')](_0x2b9f26[_0xd8b6('0x62')]);}})['then'](respondWithResult(_0x19954d,null))[_0xd8b6('0x1b')](handleError(_0x19954d,null));};exports[_0xd8b6('0x6e')]=function(_0x1438c7,_0x481d4e){var _0x7041fd={'raw':![],'where':{}};var _0x4f50bb={};var _0x4ea379={'count':0x0,'rows':[]};return db['MailAccount'][_0xd8b6('0x68')]({'where':{'id':_0x1438c7[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x481d4e,null))['then'](function(_0x50a6d1){if(_0x50a6d1){_0x4f50bb[_0xd8b6('0x48')]=_[_0xd8b6('0x4a')](db[_0xd8b6('0x6c')]['rawAttributes']);_0x4f50bb[_0xd8b6('0x49')]=_['keys'](_0x1438c7[_0xd8b6('0x49')]);_0x4f50bb[_0xd8b6('0x4b')]=_['intersection'](_0x4f50bb[_0xd8b6('0x48')],_0x4f50bb[_0xd8b6('0x49')]);_0x7041fd[_0xd8b6('0x4e')]=_['intersection'](_0x4f50bb['model'],qs[_0xd8b6('0x4d')](_0x1438c7[_0xd8b6('0x49')][_0xd8b6('0x4d')]));_0x7041fd['attributes']=_0x7041fd['attributes']['length']?_0x7041fd[_0xd8b6('0x4e')]:_0x4f50bb['model'];if(!_0x1438c7['query'][_0xd8b6('0x4f')]('nolimit')){_0x7041fd[_0xd8b6('0x21')]=qs[_0xd8b6('0x21')](_0x1438c7[_0xd8b6('0x49')][_0xd8b6('0x21')]);_0x7041fd[_0xd8b6('0x1f')]=qs[_0xd8b6('0x1f')](_0x1438c7['query'][_0xd8b6('0x1f')]);}_0x7041fd[_0xd8b6('0x51')]=qs[_0xd8b6('0x52')](_0x1438c7[_0xd8b6('0x49')]['sort']);_0x7041fd['where']=qs[_0xd8b6('0x4b')](_['pick'](_0x1438c7[_0xd8b6('0x49')],_0x4f50bb[_0xd8b6('0x4b')]));_0x7041fd[_0xd8b6('0x53')][_0xd8b6('0x66')]=_0x50a6d1['id'];if(_0x1438c7[_0xd8b6('0x49')][_0xd8b6('0x54')]){_0x7041fd[_0xd8b6('0x53')]=_['merge'](_0x7041fd[_0xd8b6('0x53')],{'$or':_[_0xd8b6('0x44')](_0x7041fd[_0xd8b6('0x4e')],function(_0x51a194){var _0x12b4cc={};_0x12b4cc[_0x51a194]={'$like':'%'+_0x1438c7[_0xd8b6('0x49')]['filter']+'%'};return _0x12b4cc;})});}_0x7041fd=_[_0xd8b6('0x55')]({},_0x7041fd,_0x1438c7[_0xd8b6('0x57')]);return db[_0xd8b6('0x6c')]['count']({'where':_0x7041fd['where']})['then'](function(_0x5a252a){_0x4ea379[_0xd8b6('0x20')]=_0x5a252a;if(_0x1438c7[_0xd8b6('0x49')][_0xd8b6('0x60')]){_0x7041fd[_0xd8b6('0x58')]=[{'all':!![]}];}return db[_0xd8b6('0x6c')][_0xd8b6('0x59')](_0x7041fd);})['then'](function(_0x413404){_0x4ea379[_0xd8b6('0x5a')]=_0x413404;return _0x4ea379;});}})[_0xd8b6('0x12')](respondWithFilteredResult(_0x481d4e,_0x7041fd))['catch'](handleError(_0x481d4e,null));};exports[_0xd8b6('0x6f')]=function(_0x2e2b39,_0x566fdd){return db['MailAccount'][_0xd8b6('0x61')]({'where':{'id':_0x2e2b39[_0xd8b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x566fdd,null))[_0xd8b6('0x12')](function(_0x2d7551){if(_0x2d7551){return _0x2d7551[_0xd8b6('0x6f')](_0x2e2b39[_0xd8b6('0x49')][_0xd8b6('0x6a')]);}})['then'](respondWithStatusCode(_0x566fdd,null))['catch'](handleError(_0x566fdd,null));};exports[_0xd8b6('0x6d')]=function(_0x1f868f,_0x40cd16){var _0x29a856={'name':_0x1f868f['body']['name'],'key':_0x1f868f['body'][_0xd8b6('0x47')],'provider':_0x1f868f[_0xd8b6('0x62')]['provider']===_0xd8b6('0x70')?null:_0x1f868f[_0xd8b6('0x62')][_0xd8b6('0x63')],'email':_0x1f868f[_0xd8b6('0x62')][_0xd8b6('0x71')],'ListId':_0x1f868f['body']['ListId'],'active':!_[_0xd8b6('0x72')](_0x1f868f[_0xd8b6('0x62')][_0xd8b6('0x73')])?_0x1f868f[_0xd8b6('0x62')][_0xd8b6('0x73')]:!![],'description':_0x1f868f[_0xd8b6('0x62')][_0xd8b6('0x74')]||null};var _0x5cd115=getAuthenticationOptions(_0x29a856[_0xd8b6('0x63')],_0x1f868f[_0xd8b6('0x62')]);_0x29a856[_0xd8b6('0x3e')]=_0x5cd115['Imap'];_0x29a856[_0xd8b6('0x3f')]=_0x5cd115[_0xd8b6('0x3f')];return db[_0xd8b6('0x45')][_0xd8b6('0x6d')](_0x29a856,{'include':[{'model':db[_0xd8b6('0x42')],'as':_0xd8b6('0x3f')},{'model':db[_0xd8b6('0x41')],'as':'Imap'}]})[_0xd8b6('0x12')](function(_0x59da2e){var _0x92fc3a=_0x1f868f[_0xd8b6('0x33')][_0xd8b6('0x75')]({'plain':!![]});if(!_0x92fc3a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x92fc3a['role']===_0xd8b6('0x33')){var _0xa02747=_0x59da2e[_0xd8b6('0x75')]({'plain':!![]});return db['UserProfileSection'][_0xd8b6('0x61')]({'where':{'name':_0xd8b6('0x25'),'userProfileId':_0x92fc3a['userProfileId']},'raw':!![]})['then'](function(_0x44958e){if(_0x44958e&&_0x44958e[_0xd8b6('0x76')]===0x0){return db[_0xd8b6('0x77')]['create']({'name':_0xa02747[_0xd8b6('0x28')],'resourceId':_0xa02747['id'],'type':_0x44958e[_0xd8b6('0x28')],'sectionId':_0x44958e['id']},{})[_0xd8b6('0x12')](function(){return _0x59da2e;});}else{return _0x59da2e;}})[_0xd8b6('0x1b')](function(_0x283965){logger[_0xd8b6('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x283965);throw _0x283965;});}return _0x59da2e;})['then'](respondWithResult(_0x40cd16,0xc9))[_0xd8b6('0x1b')](handleError(_0x40cd16,null));};exports[_0xd8b6('0x78')]=function(_0x3139b6,_0x2f96d8){return db[_0xd8b6('0x45')]['findOne']({'where':{'id':_0x3139b6[_0xd8b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2f96d8,null))[_0xd8b6('0x12')](function(_0x3da2ed){if(_0x3da2ed){return _0x3da2ed[_0xd8b6('0x78')]();}return null;})[_0xd8b6('0x12')](respondWithResult(_0x2f96d8,null))[_0xd8b6('0x1b')](handleError(_0x2f96d8,null));};exports[_0xd8b6('0x79')]=function(_0xda79d6,_0x18434a){if(_0xda79d6[_0xd8b6('0x62')]['id']){delete _0xda79d6[_0xd8b6('0x62')]['id'];}return db[_0xd8b6('0x45')][_0xd8b6('0x61')]({'where':{'id':_0xda79d6['params']['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x18434a,null))[_0xd8b6('0x12')](function(_0xe552b6){if(_0xe552b6){_0xda79d6[_0xd8b6('0x62')][_0xd8b6('0x66')]=_0xe552b6['id'];return db[_0xd8b6('0x41')][_0xd8b6('0x6d')](_0xda79d6[_0xd8b6('0x62')]);}})[_0xd8b6('0x12')](respondWithResult(_0x18434a,null))[_0xd8b6('0x1b')](handleError(_0x18434a,null));};exports[_0xd8b6('0x7a')]=function(_0x22c13a,_0xe07635){return db[_0xd8b6('0x45')]['findOne']({'where':{'id':_0x22c13a[_0xd8b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0xe07635,null))[_0xd8b6('0x12')](function(_0x2e5240){if(_0x2e5240){return _0x2e5240[_0xd8b6('0x7b')](null);}return null;})[_0xd8b6('0x12')](respondWithStatusCode(_0xe07635,null))[_0xd8b6('0x1b')](handleError(_0xe07635,null));};exports[_0xd8b6('0x7c')]=function(_0x22dd1f,_0x384a1){return db['MailAccount'][_0xd8b6('0x68')]({'where':{'id':_0x22dd1f[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x384a1,null))[_0xd8b6('0x12')](function(_0x1250bf){if(_0x1250bf){return _0x1250bf[_0xd8b6('0x7c')]();}return null;})['then'](respondWithResult(_0x384a1,null))[_0xd8b6('0x1b')](handleError(_0x384a1,null));};exports['addSmtp']=function(_0x45acd8,_0x148204){if(_0x45acd8['body']['id']){delete _0x45acd8['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x45acd8['params']['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x148204,null))[_0xd8b6('0x12')](function(_0x48a713){if(_0x48a713){_0x45acd8[_0xd8b6('0x62')][_0xd8b6('0x66')]=_0x48a713['id'];return db[_0xd8b6('0x42')][_0xd8b6('0x6d')](_0x45acd8[_0xd8b6('0x62')]);}})[_0xd8b6('0x12')](respondWithResult(_0x148204,null))[_0xd8b6('0x1b')](handleError(_0x148204,null));};exports['removeSmtp']=function(_0x27d04f,_0x45d383){return db['MailAccount'][_0xd8b6('0x68')]({'where':{'id':_0x27d04f[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x45d383,null))['then'](function(_0x339b9d){if(_0x339b9d){return _0x339b9d[_0xd8b6('0x7d')](null);}return null;})['then'](respondWithStatusCode(_0x45d383,null))[_0xd8b6('0x1b')](handleError(_0x45d383,null));};exports[_0xd8b6('0x7e')]=function(_0x2a7a92,_0x3c5235){return db[_0xd8b6('0x7f')]['find']({'where':{'id':_0x2a7a92['params']['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x3c5235,null))[_0xd8b6('0x12')](function(_0x4b457e){if(_0x4b457e){return _0x4b457e['addInteraction'](_0x2a7a92[_0xd8b6('0x62')][_0xd8b6('0x6a')],_[_0xd8b6('0x80')](_0x2a7a92[_0xd8b6('0x62')],[_0xd8b6('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x3c5235,null))[_0xd8b6('0x1b')](handleError(_0x3c5235,null));};exports['getInteractions']=function(_0x3f9cc8,_0x31ac14){var _0x39c1f1={'raw':![],'where':{}};var _0x3fb94a={};var _0x1d9ab5={'count':0x0,'rows':[]};return db[_0xd8b6('0x45')][_0xd8b6('0x68')]({'where':{'id':_0x3f9cc8[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x31ac14,null))[_0xd8b6('0x12')](function(_0x3b59c1){if(_0x3b59c1){_0x3fb94a[_0xd8b6('0x48')]=_[_0xd8b6('0x4a')](db['MailInteraction'][_0xd8b6('0x5e')]);_0x3fb94a[_0xd8b6('0x49')]=_[_0xd8b6('0x4a')](_0x3f9cc8[_0xd8b6('0x49')]);_0x3fb94a[_0xd8b6('0x4b')]=_[_0xd8b6('0x4c')](_0x3fb94a['model'],_0x3fb94a[_0xd8b6('0x49')]);_0x39c1f1[_0xd8b6('0x4e')]=_['intersection'](_0x3fb94a[_0xd8b6('0x48')],qs[_0xd8b6('0x4d')](_0x3f9cc8[_0xd8b6('0x49')][_0xd8b6('0x4d')]));_0x39c1f1[_0xd8b6('0x4e')]=_0x39c1f1['attributes'][_0xd8b6('0x5f')]?_0x39c1f1['attributes']:_0x3fb94a[_0xd8b6('0x48')];if(!_0x3f9cc8[_0xd8b6('0x49')][_0xd8b6('0x4f')]('nolimit')){_0x39c1f1[_0xd8b6('0x21')]=qs[_0xd8b6('0x21')](_0x3f9cc8[_0xd8b6('0x49')]['limit']);_0x39c1f1[_0xd8b6('0x1f')]=qs[_0xd8b6('0x1f')](_0x3f9cc8['query'][_0xd8b6('0x1f')]);}_0x39c1f1['order']=qs[_0xd8b6('0x52')](_0x3f9cc8[_0xd8b6('0x49')][_0xd8b6('0x52')]);_0x39c1f1[_0xd8b6('0x53')]=qs[_0xd8b6('0x4b')](_['pick'](_0x3f9cc8['query'],_0x3fb94a[_0xd8b6('0x4b')]));_0x39c1f1[_0xd8b6('0x53')][_0xd8b6('0x66')]=_0x3b59c1['id'];if(_0x3f9cc8['query']['filter']){_0x39c1f1[_0xd8b6('0x53')]=_[_0xd8b6('0x55')](_0x39c1f1[_0xd8b6('0x53')],{'$or':_[_0xd8b6('0x44')](_0x39c1f1['attributes'],function(_0x4c4080){var _0x7d1660={};_0x7d1660[_0x4c4080]={'$like':'%'+_0x3f9cc8[_0xd8b6('0x49')][_0xd8b6('0x54')]+'%'};return _0x7d1660;})});}_0x39c1f1=_[_0xd8b6('0x55')]({},_0x39c1f1,_0x3f9cc8[_0xd8b6('0x57')]);return db[_0xd8b6('0x7f')][_0xd8b6('0x20')]({'where':_0x39c1f1['where']})[_0xd8b6('0x12')](function(_0x324148){_0x1d9ab5[_0xd8b6('0x20')]=_0x324148;if(_0x3f9cc8[_0xd8b6('0x49')]['includeAll']){_0x39c1f1[_0xd8b6('0x58')]=[{'model':db['CmContact'],'as':_0xd8b6('0x81'),'required':![]},{'model':db[_0xd8b6('0x82')],'as':_0xd8b6('0x83'),'attributes':[_0xd8b6('0x28'),'fullname',_0xd8b6('0x84')],'required':![]},{'model':db[_0xd8b6('0x85')],'as':_0xd8b6('0x86'),'attributes':['id','name',_0xd8b6('0x87')],'where':_0x3f9cc8[_0xd8b6('0x49')][_0xd8b6('0x88')]?{'id':_0x3f9cc8[_0xd8b6('0x49')][_0xd8b6('0x88')]}:undefined,'required':_0x3f9cc8[_0xd8b6('0x49')]['tag']?!![]:![]}];}return db['MailInteraction'][_0xd8b6('0x59')](_0x39c1f1);})['then'](function(_0x5d55c6){_0x1d9ab5[_0xd8b6('0x5a')]=_0x5d55c6;return _0x1d9ab5;});}})['then'](respondWithFilteredResult(_0x31ac14,_0x39c1f1))[_0xd8b6('0x1b')](handleError(_0x31ac14,null));};exports[_0xd8b6('0x89')]=function addApplications(_0x316dd1,_0x112940){var _0x4808ab=_0x316dd1[_0xd8b6('0x5c')]['id'];var _0x5d53eb=_0x316dd1[_0xd8b6('0x62')];var _0x466bbc=0xc8;var _0x5a38b1=null;return db[_0xd8b6('0x8a')][_0xd8b6('0x8b')]({'isolationLevel':db[_0xd8b6('0x8a')][_0xd8b6('0x8c')][_0xd8b6('0x8d')][_0xd8b6('0x8e')]},function(_0x512526){return db[_0xd8b6('0x45')][_0xd8b6('0x68')]({'where':{'id':_0x4808ab},'transaction':_0x512526})[_0xd8b6('0x12')](function(_0x87c738){if(_0x87c738){return db[_0xd8b6('0x8f')][_0xd8b6('0x24')]({'where':{'MailAccountId':_0x4808ab},'transaction':_0x512526})['then'](function(){var _0x2f3404=_['map'](_0x5d53eb,function(_0x12d3e7){_0x12d3e7[_0xd8b6('0x66')]=_0x4808ab;return _0x12d3e7;});return db[_0xd8b6('0x8f')]['bulkCreate'](_0x2f3404,{'transaction':_0x512526});});}else{_0x466bbc=0x194;_0x5a38b1=[];}});})[_0xd8b6('0x12')](function(){if(_0x466bbc!==0x194){return db['MailApplication'][_0xd8b6('0x90')]({'where':{'MailAccountId':_0x4808ab},'order':_0xd8b6('0x91')})['then'](function(_0x245286){_0x5a38b1=_0x245286;});}})[_0xd8b6('0x1b')](function(_0x1792cc){_0x466bbc=0x1f4;logger[_0xd8b6('0x18')](_0x1792cc['stack']);if(_0x1792cc['name']){delete _0x1792cc['name'];}_0x5a38b1=_0x1792cc;})[_0xd8b6('0x92')](function(){if(_0x5a38b1===null){_0x112940['sendStatus'](_0x466bbc);}else{if(_0x466bbc===0x1f4){_0x112940[_0xd8b6('0x1c')](_0x466bbc)[_0xd8b6('0x29')](_0x5a38b1);}else{_0x112940[_0xd8b6('0x1c')](_0x466bbc)['json'](_0x5a38b1);}}});};exports['getApplications']=function(_0x2d8b4c,_0x5accd1){var _0x408694={};var _0x36b7b5={};var _0x21d55d;var _0x5096ba;return db[_0xd8b6('0x45')]['findOne']({'where':{'id':_0x2d8b4c['params']['id']}})['then'](handleEntityNotFound(_0x5accd1,null))[_0xd8b6('0x12')](function(_0xeee2d2){if(_0xeee2d2){_0x21d55d=_0xeee2d2;_0x36b7b5[_0xd8b6('0x48')]=_[_0xd8b6('0x4a')](db['MailApplication'][_0xd8b6('0x5e')]);_0x36b7b5[_0xd8b6('0x49')]=_[_0xd8b6('0x4a')](_0x2d8b4c[_0xd8b6('0x49')]);_0x36b7b5['filters']=_[_0xd8b6('0x4c')](_0x36b7b5[_0xd8b6('0x48')],_0x36b7b5[_0xd8b6('0x49')]);_0x408694[_0xd8b6('0x4e')]=_[_0xd8b6('0x4c')](_0x36b7b5['model'],qs['fields'](_0x2d8b4c[_0xd8b6('0x49')][_0xd8b6('0x4d')]));_0x408694[_0xd8b6('0x4e')]=_0x408694[_0xd8b6('0x4e')][_0xd8b6('0x5f')]?_0x408694[_0xd8b6('0x4e')]:_0x36b7b5[_0xd8b6('0x48')];_0x408694[_0xd8b6('0x51')]=qs[_0xd8b6('0x52')](_0x2d8b4c['query'][_0xd8b6('0x52')]);_0x408694['where']=qs['filters'](_['pick'](_0x2d8b4c['query'],_0x36b7b5[_0xd8b6('0x4b')]));if(_0x2d8b4c['query'][_0xd8b6('0x54')]){_0x408694[_0xd8b6('0x53')]=_[_0xd8b6('0x55')](_0x408694[_0xd8b6('0x53')],{'$or':_[_0xd8b6('0x44')](_0x408694[_0xd8b6('0x4e')],function(_0x282b56){var _0x194a7c={};_0x194a7c[_0x282b56]={'$like':'%'+_0x2d8b4c['query']['filter']+'%'};return _0x194a7c;})});}_0x408694=_['merge']({},_0x408694,_0x2d8b4c[_0xd8b6('0x57')]);return _0x21d55d[_0xd8b6('0x93')](_0x408694);}})[_0xd8b6('0x12')](function(_0x3d744a){if(_0x3d744a){_0x5096ba=_0x3d744a['length'];if(!_0x2d8b4c[_0xd8b6('0x49')][_0xd8b6('0x4f')](_0xd8b6('0x50'))){_0x408694[_0xd8b6('0x21')]=qs[_0xd8b6('0x21')](_0x2d8b4c[_0xd8b6('0x49')]['limit']);_0x408694['offset']=qs['offset'](_0x2d8b4c[_0xd8b6('0x49')][_0xd8b6('0x1f')]);}return _0x21d55d[_0xd8b6('0x93')](_0x408694);}})['then'](function(_0x508352){if(_0x508352){return _0x508352?{'count':_0x5096ba,'rows':_0x508352}:null;}})[_0xd8b6('0x12')](respondWithResult(_0x5accd1,null))[_0xd8b6('0x1b')](handleError(_0x5accd1,null));};exports[_0xd8b6('0x94')]=function(_0x20910f,_0x7fd2f3){var _0x2fece0={'raw':!![],'where':{}};var _0x54ef8b={};var _0x30c4a7={'count':0x0,'rows':[]};return db[_0xd8b6('0x45')][_0xd8b6('0x68')]({'where':{'id':_0x20910f[_0xd8b6('0x5c')]['id']}})['then'](handleEntityNotFound(_0x7fd2f3,null))[_0xd8b6('0x12')](function(_0x146019){if(_0x146019){_0x54ef8b['model']=_['keys'](db[_0xd8b6('0x95')]['rawAttributes']);_0x54ef8b[_0xd8b6('0x49')]=_[_0xd8b6('0x4a')](_0x20910f['query']);_0x54ef8b[_0xd8b6('0x4b')]=_[_0xd8b6('0x4c')](_0x54ef8b[_0xd8b6('0x48')],_0x54ef8b[_0xd8b6('0x49')]);_0x2fece0[_0xd8b6('0x4e')]=_[_0xd8b6('0x4c')](_0x54ef8b[_0xd8b6('0x48')],qs[_0xd8b6('0x4d')](_0x20910f[_0xd8b6('0x49')][_0xd8b6('0x4d')]));_0x2fece0[_0xd8b6('0x4e')]=_0x2fece0[_0xd8b6('0x4e')][_0xd8b6('0x5f')]?_0x2fece0[_0xd8b6('0x4e')]:_0x54ef8b[_0xd8b6('0x48')];if(!_0x20910f['query'][_0xd8b6('0x4f')](_0xd8b6('0x50'))){_0x2fece0[_0xd8b6('0x21')]=qs[_0xd8b6('0x21')](_0x20910f[_0xd8b6('0x49')][_0xd8b6('0x21')]);_0x2fece0[_0xd8b6('0x1f')]=qs[_0xd8b6('0x1f')](_0x20910f[_0xd8b6('0x49')][_0xd8b6('0x1f')]);}_0x2fece0[_0xd8b6('0x51')]=qs['sort'](_0x20910f['query'][_0xd8b6('0x52')]);_0x2fece0['where']=qs[_0xd8b6('0x4b')](_[_0xd8b6('0x96')](_0x20910f[_0xd8b6('0x49')],_0x54ef8b[_0xd8b6('0x4b')]));_0x2fece0[_0xd8b6('0x53')][_0xd8b6('0x66')]=_0x146019['id'];if(_0x20910f['query']['filter']){_0x2fece0[_0xd8b6('0x53')]=_[_0xd8b6('0x55')](_0x2fece0['where'],{'$or':_[_0xd8b6('0x44')](_0x2fece0[_0xd8b6('0x4e')],function(_0x2aa848){var _0x37e2fe={};_0x37e2fe[_0x2aa848]={'$like':'%'+_0x20910f[_0xd8b6('0x49')][_0xd8b6('0x54')]+'%'};return _0x37e2fe;})});}if(_0x20910f[_0xd8b6('0x49')]['$gte']){var _0x51ffc7=_0x20910f[_0xd8b6('0x49')][_0xd8b6('0x97')][_0xd8b6('0x98')](',');var _0x124137={};_0x124137[_0x51ffc7[0x0]]={'$gte':moment(_0x51ffc7[0x1])[_0xd8b6('0x99')](_0xd8b6('0x9a'))};_0x2fece0[_0xd8b6('0x53')]=_[_0xd8b6('0x55')](_0x2fece0[_0xd8b6('0x53')],_0x124137);}_0x2fece0=_[_0xd8b6('0x55')]({},_0x2fece0,_0x20910f['options']);return db[_0xd8b6('0x95')][_0xd8b6('0x20')]({'where':_0x2fece0[_0xd8b6('0x53')]})[_0xd8b6('0x12')](function(_0xd48b8){_0x30c4a7[_0xd8b6('0x20')]=_0xd48b8;if(_0x20910f[_0xd8b6('0x49')][_0xd8b6('0x60')]){_0x2fece0[_0xd8b6('0x58')]=[{'all':!![]}];}return db[_0xd8b6('0x95')][_0xd8b6('0x59')](_0x2fece0);})['then'](function(_0x6cb88b){if(_0x20910f[_0xd8b6('0x49')][_0xd8b6('0x9b')]==='true'){for(var _0x25695c=0x0;_0x25695c<_0x6cb88b[_0xd8b6('0x5f')];_0x25695c++){_0x6cb88b[_0x25695c][_0xd8b6('0x62')]=juice(_0x6cb88b[_0x25695c][_0xd8b6('0x62')]);}}_0x30c4a7[_0xd8b6('0x5a')]=_0x6cb88b;return _0x30c4a7;});}})[_0xd8b6('0x12')](respondWithFilteredResult(_0x7fd2f3,_0x2fece0))[_0xd8b6('0x1b')](handleError(_0x7fd2f3,null));};exports[_0xd8b6('0x29')]=function(_0x31737c,_0x464f6a){var _0x26eadb,_0x1d7ce9={},_0x2ebd14;if(_0x31737c[_0xd8b6('0x62')]['to']){_0x2ebd14=_0x31737c[_0xd8b6('0x62')]['to'][_0xd8b6('0x98')](',')[0x0];}return db[_0xd8b6('0x45')][_0xd8b6('0x61')]({'where':{'id':_0x31737c[_0xd8b6('0x5c')]['id']},'include':[{'model':db[_0xd8b6('0x9c')],'as':_0xd8b6('0x9d'),'include':[{'model':db[_0xd8b6('0x9e')],'as':_0xd8b6('0x9f'),'where':{'email':_0x2ebd14},'limit':0x1,'order':[[_0xd8b6('0xa0'),_0xd8b6('0xa1')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xd8b6('0x12')](handleEntityNotFound(_0x464f6a,null))[_0xd8b6('0x12')](function(_0x25e6cd){if(!_0x25e6cd)return;_0x26eadb=_0x25e6cd;if(!_0x25e6cd['Smtp'])throw new Error(_0xd8b6('0xa2'));if(_['isNil'](_0x31737c['body'][_0xd8b6('0xa3')])){_0x31737c[_0xd8b6('0x62')]['from']=util[_0xd8b6('0x99')](_0xd8b6('0xa4'),_0x25e6cd[_0xd8b6('0x28')],_0x25e6cd[_0xd8b6('0x71')]||_0x25e6cd['Smtp']['user']);}if(_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xa5')]&&_0x31737c['body'][_0xd8b6('0xa5')]['length']){for(var _0x487dd7=0x0;_0x487dd7<_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xa5')][_0xd8b6('0x5f')];_0x487dd7+=0x1){_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xa5')][_0x487dd7]={'filename':_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xa5')][_0x487dd7][_0xd8b6('0x28')],'path':path['join'](config['root'],_0xd8b6('0xa6'),_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xa5')][_0x487dd7][_0xd8b6('0xa7')])};}}var _0x32a3a1=_0x25e6cd['getSmtpOptions']();return respondWithRpcPromise(_0xd8b6('0xa8'),'sendMail',{'account':_0x32a3a1,'message':_0x31737c['body']});})['then'](function(_0xa5faa9){if(!_0xa5faa9)return;_0x1d7ce9=_0xa5faa9;if(!_0x26eadb[_0xd8b6('0x9d')])throw new Error('List\x20not\x20found');if(_0x26eadb[_0xd8b6('0x9d')][_0xd8b6('0x9f')][_0xd8b6('0x5f')])return _0x26eadb[_0xd8b6('0x9d')]['Contacts'][0x0];return db[_0xd8b6('0x9e')][_0xd8b6('0x6d')](_[_0xd8b6('0xb')](_0x31737c[_0xd8b6('0x62')],{'firstName':_0x31737c[_0xd8b6('0x62')]['to'],'email':_0x31737c[_0xd8b6('0x62')]['to'],'phone':_0x31737c[_0xd8b6('0x62')]['to'],'ListId':_0x26eadb[_0xd8b6('0xa9')]}));})[_0xd8b6('0x12')](function(_0x2e07c2){if(!_0x2e07c2)return;var _0x59acfd={'UserId':_0x31737c[_0xd8b6('0x33')]['id'],'ContactId':_0x2e07c2['id'],'MailAccountId':_0x26eadb['id'],'inReplyTo':_0x1d7ce9[_0xd8b6('0xaa')],'to':_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xa3')],'cc':_0x31737c[_0xd8b6('0x62')]['cc'],'subject':_0x31737c['body']['subject'],'attach':_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xab')],'firstMsgDirection':_0xd8b6('0xac'),'lastMsgAt':moment()[_0xd8b6('0x99')](_0xd8b6('0x9a')),'lastMsgDirection':_0xd8b6('0xac'),'Messages':[_[_0xd8b6('0x55')](_0x31737c[_0xd8b6('0x62')],{'messageId':_0x1d7ce9[_0xd8b6('0xaa')],'sentAt':moment()[_0xd8b6('0x99')](_0xd8b6('0x9a')),'read':!![],'MailAccountId':_0x26eadb['id'],'UserId':_0x31737c[_0xd8b6('0x33')]['id'],'ContactId':_0x2e07c2['id']})]};if(_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xad')]){_0x59acfd=_[_0xd8b6('0x55')](_0x59acfd,_0x31737c[_0xd8b6('0x62')][_0xd8b6('0xad')]);}return db[_0xd8b6('0x7f')][_0xd8b6('0x6d')](_0x59acfd,{'include':[{'model':db['MailMessage'],'as':_0xd8b6('0xae')}]});})[_0xd8b6('0x12')](respondWithResult(_0x464f6a,null))['catch'](handleError(_0x464f6a,null));};exports['verifySmtp']=function(_0xc32c08,_0x47ca3a){return db[_0xd8b6('0x45')][_0xd8b6('0x61')]({'where':{'id':_0xc32c08[_0xd8b6('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xd8b6('0x3f'),'raw':!![],'include':[{'model':db[_0xd8b6('0xaf')],'as':_0xd8b6('0xaf'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x47ca3a,null))[_0xd8b6('0x12')](function(_0x18a115){if(!_0x18a115[_0xd8b6('0x3f')])return;var _0x5561bb=_0x18a115[_0xd8b6('0xb0')]();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x5561bb});})[_0xd8b6('0x12')](respondWithResult(_0x47ca3a,null))[_0xd8b6('0x1b')](handleError(_0x47ca3a,null));};exports['destroy']=function(_0x3357dd,_0x3f0a31){return db[_0xd8b6('0x45')][_0xd8b6('0x61')]({'where':{'id':_0x3357dd['params']['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x3f0a31,null))[_0xd8b6('0x12')](function(_0x7d68c7){if(_0x7d68c7&&_0x7d68c7[_0xd8b6('0x3c')]){throw new db[(_0xd8b6('0xb1'))]['ValidationError'](_0xd8b6('0xb2'));}return _0x7d68c7;})[_0xd8b6('0x12')](removeEntity(_0x3f0a31,null))[_0xd8b6('0x1b')](handleError(_0x3f0a31,null));};exports['addAgents']=function(_0x501b53,_0x2b3f97){return db[_0xd8b6('0x45')][_0xd8b6('0x61')]({'where':{'id':_0x501b53[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x2b3f97,null))[_0xd8b6('0x12')](function(_0x33fdfa){if(_0x33fdfa){return _0x33fdfa[_0xd8b6('0xb3')](_0x501b53[_0xd8b6('0x62')][_0xd8b6('0x6a')],_[_0xd8b6('0x80')](_0x501b53['body'],[_0xd8b6('0x6a'),'id'])||{})[_0xd8b6('0xb4')](function(_0x3fce0b){for(var _0x11fdf8=0x0;_0x11fdf8<_0x501b53[_0xd8b6('0x62')]['ids']['length'];_0x11fdf8+=0x1){socket[_0xd8b6('0xb5')]('userMailAccount:save',{'UserId':Number(_0x501b53[_0xd8b6('0x62')]['ids'][_0x11fdf8]),'MailAccountId':Number(_0x501b53[_0xd8b6('0x5c')]['id'])});}return _0x3fce0b;});}})['then'](respondWithResult(_0x2b3f97,null))[_0xd8b6('0x1b')](handleError(_0x2b3f97,null));};exports[_0xd8b6('0xb6')]=function(_0x25e155,_0xb10b6d){return db[_0xd8b6('0x45')][_0xd8b6('0x61')]({'where':{'id':_0x25e155[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0xb10b6d,null))[_0xd8b6('0x12')](function(_0x18fec7){if(_0x18fec7){return _0x18fec7[_0xd8b6('0xb6')](_0x25e155['query'][_0xd8b6('0x6a')])[_0xd8b6('0x12')](function(){if(_[_0xd8b6('0xb7')](_0x25e155[_0xd8b6('0x49')][_0xd8b6('0x6a')])){for(var _0x2b23b6=0x0;_0x2b23b6<_0x25e155[_0xd8b6('0x49')][_0xd8b6('0x6a')][_0xd8b6('0x5f')];_0x2b23b6+=0x1){socket[_0xd8b6('0xb5')](_0xd8b6('0xb8'),{'UserId':Number(_0x25e155['query']['ids'][_0x2b23b6]),'MailAccountId':Number(_0x25e155[_0xd8b6('0x5c')]['id'])});}}else{socket[_0xd8b6('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x25e155['query']['ids']),'MailAccountId':Number(_0x25e155[_0xd8b6('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0xb10b6d,null))[_0xd8b6('0x1b')](handleError(_0xb10b6d,null));};exports[_0xd8b6('0xb9')]=function(_0x12a7ce,_0x58ca00){var _0xdb9bbc={};var _0x51ba97={};var _0x2fe5f3;var _0x58bcce;return db[_0xd8b6('0x45')][_0xd8b6('0x68')]({'where':{'id':_0x12a7ce[_0xd8b6('0x5c')]['id']}})[_0xd8b6('0x12')](handleEntityNotFound(_0x58ca00,null))[_0xd8b6('0x12')](function(_0x4bdedb){if(_0x4bdedb){_0x2fe5f3=_0x4bdedb;_0x51ba97[_0xd8b6('0x48')]=_[_0xd8b6('0x4a')](db['User']['rawAttributes']);_0x51ba97[_0xd8b6('0x49')]=_[_0xd8b6('0x4a')](_0x12a7ce[_0xd8b6('0x49')]);_0x51ba97['filters']=_[_0xd8b6('0x4c')](_0x51ba97['model'],_0x51ba97[_0xd8b6('0x49')]);_0xdb9bbc[_0xd8b6('0x4e')]=_[_0xd8b6('0x4c')](_0x51ba97[_0xd8b6('0x48')],qs[_0xd8b6('0x4d')](_0x12a7ce['query']['fields']));_0xdb9bbc['attributes']=_0xdb9bbc[_0xd8b6('0x4e')][_0xd8b6('0x5f')]?_0xdb9bbc[_0xd8b6('0x4e')]:_0x51ba97[_0xd8b6('0x48')];_0xdb9bbc['order']=qs[_0xd8b6('0x52')](_0x12a7ce[_0xd8b6('0x49')][_0xd8b6('0x52')]);_0xdb9bbc[_0xd8b6('0x53')]=qs[_0xd8b6('0x4b')](_[_0xd8b6('0x96')](_0x12a7ce['query'],_0x51ba97[_0xd8b6('0x4b')]));if(_0x12a7ce[_0xd8b6('0x49')][_0xd8b6('0x54')]){_0xdb9bbc[_0xd8b6('0x53')]=_[_0xd8b6('0x55')](_0xdb9bbc[_0xd8b6('0x53')],{'$or':_[_0xd8b6('0x44')](_0xdb9bbc[_0xd8b6('0x4e')],function(_0x1c239c){var _0x504a81={};_0x504a81[_0x1c239c]={'$like':'%'+_0x12a7ce['query'][_0xd8b6('0x54')]+'%'};return _0x504a81;})});}_0xdb9bbc=_[_0xd8b6('0x55')]({},_0xdb9bbc,_0x12a7ce['options']);return _0x2fe5f3[_0xd8b6('0xb9')](_0xdb9bbc);}})[_0xd8b6('0x12')](function(_0x211096){if(_0x211096){_0x58bcce=_0x211096[_0xd8b6('0x5f')];if(!_0x12a7ce[_0xd8b6('0x49')][_0xd8b6('0x4f')](_0xd8b6('0x50'))){_0xdb9bbc['limit']=qs[_0xd8b6('0x21')](_0x12a7ce[_0xd8b6('0x49')][_0xd8b6('0x21')]);_0xdb9bbc[_0xd8b6('0x1f')]=qs[_0xd8b6('0x1f')](_0x12a7ce[_0xd8b6('0x49')]['offset']);}return _0x2fe5f3[_0xd8b6('0xb9')](_0xdb9bbc);}})[_0xd8b6('0x12')](function(_0x588ded){if(_0x588ded){return _0x588ded?{'count':_0x58bcce,'rows':_0x588ded}:null;}})[_0xd8b6('0x12')](respondWithResult(_0x58ca00,null))[_0xd8b6('0x1b')](handleError(_0x58ca00,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index a8ea9ee..3793c8f 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 _0xac41=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x327455,_0x12e7fa){var _0x38885d=function(_0x523445){while(--_0x523445){_0x327455['push'](_0x327455['shift']());}};_0x38885d(++_0x12e7fa);}(_0xac41,0xdd));var _0x1ac4=function(_0x39ef42,_0x2741e4){_0x39ef42=_0x39ef42-0x0;var _0x20cad9=_0xac41[_0x39ef42];return _0x20cad9;};'use strict';var EventEmitter=require(_0x1ac4('0x0'));var MailAccount=require(_0x1ac4('0x1'))['db'][_0x1ac4('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1ac4('0x3')](0x0);var events={'afterCreate':_0x1ac4('0x4'),'afterUpdate':_0x1ac4('0x5'),'afterDestroy':_0x1ac4('0x6')};function emitEvent(_0x3a1763){return function(_0x54386c,_0x2c33d6,_0x216c0d){MailAccountEvents[_0x1ac4('0x7')](_0x3a1763+':'+_0x54386c['id'],_0x54386c);MailAccountEvents[_0x1ac4('0x7')](_0x3a1763,_0x54386c);_0x216c0d(null);};}for(var e in events){if(events[_0x1ac4('0x8')](e)){var event=events[e];MailAccount[_0x1ac4('0x9')](e,emitEvent(event));}}module[_0x1ac4('0xa')]=MailAccountEvents; \ No newline at end of file +var _0x81d4=['hook','exports','../../mysqldb','MailAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x5127a1,_0x3420bf){var _0x21b823=function(_0x5ab70a){while(--_0x5ab70a){_0x5127a1['push'](_0x5127a1['shift']());}};_0x21b823(++_0x3420bf);}(_0x81d4,0x197));var _0x481d=function(_0x223f62,_0xa003cd){_0x223f62=_0x223f62-0x0;var _0x5080f7=_0x81d4[_0x223f62];return _0x5080f7;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x481d('0x0'))['db'][_0x481d('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x481d('0x2'),'afterUpdate':_0x481d('0x3'),'afterDestroy':_0x481d('0x4')};function emitEvent(_0x5b69a0){return function(_0x5af777,_0x37813e,_0x1a9ee1){MailAccountEvents[_0x481d('0x5')](_0x5b69a0+':'+_0x5af777['id'],_0x5af777);MailAccountEvents['emit'](_0x5b69a0,_0x5af777);_0x1a9ee1(null);};}for(var e in events){if(events[_0x481d('0x6')](e)){var event=events[e];MailAccount[_0x481d('0x7')](e,emitEvent(event));}}module[_0x481d('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 17d260f..b1a45e5 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 _0x4e67=['define','MailAccount','provider','service','host','port','Smtp','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','CloudProvider','data5','auth','./mailAccount.attributes','exports'];(function(_0x228da4,_0x545ae8){var _0x86a145=function(_0x4dbc48){while(--_0x4dbc48){_0x228da4['push'](_0x228da4['shift']());}};_0x86a145(++_0x545ae8);}(_0x4e67,0x6a));var _0x74e6=function(_0x196e1b,_0x55fa06){_0x196e1b=_0x196e1b-0x0;var _0x5e1f18=_0x4e67[_0x196e1b];return _0x5e1f18;};'use strict';var attributes=require(_0x74e6('0x0'));module[_0x74e6('0x1')]=function(_0x34ba36){return _0x34ba36[_0x74e6('0x2')](_0x74e6('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1fafb3=this;var _0x23c686={'id':_0x1fafb3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1fafb3[_0x74e6('0x4')]!=='custom'){_0x23c686[_0x74e6('0x5')]=_0x1fafb3[_0x74e6('0x4')];}else{_0x23c686[_0x74e6('0x6')]=_0x1fafb3['Smtp'][_0x74e6('0x6')];_0x23c686[_0x74e6('0x7')]=_0x1fafb3[_0x74e6('0x8')]['port'];_0x23c686[_0x74e6('0x9')]=_0x1fafb3[_0x74e6('0x8')][_0x74e6('0x9')];}if(_0x1fafb3['Smtp'][_0x74e6('0xa')]){if(_0x1fafb3['Smtp'][_0x74e6('0xb')]){if(!_0x1fafb3[_0x74e6('0x8')]['CloudProvider'])throw new Error(_0x74e6('0xc'));_0x23c686['auth']={'type':_0x74e6('0xd'),'user':_0x1fafb3[_0x74e6('0x8')][_0x74e6('0xe')],'accessToken':_0x1fafb3[_0x74e6('0x8')][_0x74e6('0xf')][_0x74e6('0x10')]};}else{_0x23c686[_0x74e6('0x11')]={'user':_0x1fafb3[_0x74e6('0x8')][_0x74e6('0xe')],'pass':_0x1fafb3[_0x74e6('0x8')]['pass']};}}return _0x23c686;}}});}; \ No newline at end of file +var _0xe4cd=['host','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','CloudProvider','pass','./mailAccount.attributes','exports','define','provider','custom','service'];(function(_0x1c0f41,_0x26d95d){var _0x369a9f=function(_0x251234){while(--_0x251234){_0x1c0f41['push'](_0x1c0f41['shift']());}};_0x369a9f(++_0x26d95d);}(_0xe4cd,0x10a));var _0xde4c=function(_0x230740,_0x57a248){_0x230740=_0x230740-0x0;var _0x17dd77=_0xe4cd[_0x230740];return _0x17dd77;};'use strict';var attributes=require(_0xde4c('0x0'));module[_0xde4c('0x1')]=function(_0x4c5a3c){return _0x4c5a3c[_0xde4c('0x2')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x48f98=this;var _0x29fbd8={'id':_0x48f98['id'],'tls':{'rejectUnauthorized':![]}};if(_0x48f98[_0xde4c('0x3')]!==_0xde4c('0x4')){_0x29fbd8[_0xde4c('0x5')]=_0x48f98[_0xde4c('0x3')];}else{_0x29fbd8[_0xde4c('0x6')]=_0x48f98[_0xde4c('0x7')][_0xde4c('0x6')];_0x29fbd8[_0xde4c('0x8')]=_0x48f98['Smtp'][_0xde4c('0x8')];_0x29fbd8[_0xde4c('0x9')]=_0x48f98[_0xde4c('0x7')][_0xde4c('0x9')];}if(_0x48f98[_0xde4c('0x7')][_0xde4c('0xa')]){if(_0x48f98[_0xde4c('0x7')][_0xde4c('0xb')]){if(!_0x48f98[_0xde4c('0x7')]['CloudProvider'])throw new Error(_0xde4c('0xc'));_0x29fbd8[_0xde4c('0xd')]={'type':'OAuth2','user':_0x48f98[_0xde4c('0x7')][_0xde4c('0xe')],'accessToken':_0x48f98[_0xde4c('0x7')][_0xde4c('0xf')]['data5']};}else{_0x29fbd8[_0xde4c('0xd')]={'user':_0x48f98['Smtp'][_0xde4c('0xe')],'pass':_0x48f98[_0xde4c('0x7')][_0xde4c('0x10')]};}}return _0x29fbd8;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 4548b4f..16d445b 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','find','smtp','setDataValue','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','CloudProvider','get','account','omit','smtpOptions','applications','list','orderBy','asc','autoclose','push','length','close','create','List\x20not\x20found','contact','messageId','generate','subject','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','originCc','originChannel','Email','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash'];(function(_0x3ae57e,_0x3ef6e9){var _0x4c3f3e=function(_0x548451){while(--_0x548451){_0x3ae57e['push'](_0x3ae57e['shift']());}};_0x4c3f3e(++_0x3ef6e9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0xac4a('0x0'));var moment=require(_0xac4a('0x1'));var BPromise=require(_0xac4a('0x2'));var rs=require(_0xac4a('0x3'));var Redis=require(_0xac4a('0x4'));var db=require(_0xac4a('0x5'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xac4a('0x6'));var client=jayson[_0xac4a('0x7')][_0xac4a('0x8')]({'port':0x232c});config[_0xac4a('0x9')]=_[_0xac4a('0xa')](config[_0xac4a('0x9')],{'host':_0xac4a('0xb'),'port':0x18eb});var socket=require(_0xac4a('0xc'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xac4a('0xd')](socket);function respondWithRpcPromise(_0x2a4d53,_0x26ec84,_0x4f4146){return new BPromise(function(_0x1d182e,_0x3a82de){return client[_0xac4a('0xe')](_0x2a4d53,_0x4f4146)['then'](function(_0x30135d){logger['info'](_0xac4a('0xf'),_0x26ec84,'request\x20sent');logger[_0xac4a('0x10')](_0xac4a('0x11'),_0x26ec84,_0xac4a('0x12'),JSON['stringify'](_0x30135d));if(_0x30135d[_0xac4a('0x13')]){if(_0x30135d[_0xac4a('0x13')][_0xac4a('0x14')]===0x1f4){logger[_0xac4a('0x13')](_0xac4a('0xf'),_0x26ec84,_0x30135d[_0xac4a('0x13')][_0xac4a('0x15')]);return _0x3a82de(_0x30135d[_0xac4a('0x13')][_0xac4a('0x15')]);}logger[_0xac4a('0x13')](_0xac4a('0xf'),_0x26ec84,_0x30135d[_0xac4a('0x13')]['message']);return _0x1d182e(_0x30135d[_0xac4a('0x13')][_0xac4a('0x15')]);}else{logger[_0xac4a('0x16')](_0xac4a('0xf'),_0x26ec84,_0xac4a('0x12'));_0x1d182e(_0x30135d[_0xac4a('0x17')][_0xac4a('0x15')]);}})[_0xac4a('0x18')](function(_0x546c5d){logger['error'](_0xac4a('0xf'),_0x26ec84,_0x546c5d);_0x3a82de(_0x546c5d);});});}exports[_0xac4a('0x19')]=function(_0x39b691){var _0x4d837c=this;return new Promise(function(_0x39e83e,_0x15c223){return db[_0xac4a('0x1a')][_0xac4a('0x1b')]({'raw':_0x39b691[_0xac4a('0x1c')]?_0x39b691[_0xac4a('0x1c')][_0xac4a('0x1d')]===undefined?!![]:![]:!![],'where':_0x39b691[_0xac4a('0x1c')]?_0x39b691['options'][_0xac4a('0x1e')]||null:null,'attributes':_0x39b691[_0xac4a('0x1c')]?_0x39b691['options'][_0xac4a('0x1f')]||null:null,'limit':_0x39b691[_0xac4a('0x1c')]?_0x39b691[_0xac4a('0x1c')][_0xac4a('0x20')]||null:null,'include':_0x39b691['options']?_0x39b691[_0xac4a('0x1c')][_0xac4a('0x21')]?_[_0xac4a('0x22')](_0x39b691[_0xac4a('0x1c')][_0xac4a('0x21')],function(_0x2b0dc2){return{'model':db[_0x2b0dc2[_0xac4a('0x23')]],'as':_0x2b0dc2['as'],'attributes':_0x2b0dc2[_0xac4a('0x1f')],'include':_0x2b0dc2[_0xac4a('0x21')]?_[_0xac4a('0x22')](_0x2b0dc2[_0xac4a('0x21')],function(_0x215a31){return{'model':db[_0x215a31[_0xac4a('0x23')]],'as':_0x215a31['as'],'attributes':_0x215a31[_0xac4a('0x1f')],'include':_0x215a31[_0xac4a('0x21')]?_[_0xac4a('0x22')](_0x215a31['include'],function(_0x23b061){return{'model':db[_0x23b061[_0xac4a('0x23')]],'as':_0x23b061['as'],'attributes':_0x23b061[_0xac4a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xac4a('0x24')](function(_0x116700){logger['info']('GetMailAccount',_0x39b691);logger[_0xac4a('0x10')](_0xac4a('0x19'),_0x39b691,JSON[_0xac4a('0x25')](_0x116700));_0x39e83e(_0x116700);})['catch'](function(_0x4bda1f){logger[_0xac4a('0x13')](_0xac4a('0x19'),_0x4bda1f[_0xac4a('0x15')],_0x39b691);_0x15c223(_0x4d837c[_0xac4a('0x13')](0x1f4,_0x4bda1f[_0xac4a('0x15')]));});});};exports['ShowMailAccount']=function(_0x6dcc7f){var _0x482afc=this;return new Promise(function(_0x30364b,_0x57adcf){return db[_0xac4a('0x1a')][_0xac4a('0x26')]({'raw':_0x6dcc7f[_0xac4a('0x1c')]?_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x1d')]===undefined?!![]:![]:!![],'where':_0x6dcc7f[_0xac4a('0x1c')]?_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x1e')]||null:null,'attributes':_0x6dcc7f[_0xac4a('0x1c')]?_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x1f')]||null:null,'include':_0x6dcc7f[_0xac4a('0x1c')]?_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x21')]?_['map'](_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x21')],function(_0x5a4e2b){return{'model':db[_0x5a4e2b[_0xac4a('0x23')]],'as':_0x5a4e2b['as'],'attributes':_0x5a4e2b[_0xac4a('0x1f')],'include':_0x5a4e2b['include']?_['map'](_0x5a4e2b[_0xac4a('0x21')],function(_0x1ba096){return{'model':db[_0x1ba096[_0xac4a('0x23')]],'as':_0x1ba096['as'],'attributes':_0x1ba096[_0xac4a('0x1f')],'include':_0x1ba096['include']?_[_0xac4a('0x22')](_0x1ba096[_0xac4a('0x21')],function(_0x4e7630){return{'model':db[_0x4e7630[_0xac4a('0x23')]],'as':_0x4e7630['as'],'attributes':_0x4e7630[_0xac4a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xac4a('0x24')](function(_0x5f0eb8){if(_0x6dcc7f[_0xac4a('0x1c')][_0xac4a('0x27')]===!![])_0x5f0eb8[_0xac4a('0x28')]('smtpOptions',_0x5f0eb8[_0xac4a('0x29')]());logger[_0xac4a('0x16')]('ShowMailAccount',_0x6dcc7f);logger['debug'](_0xac4a('0x2a'),_0x6dcc7f,JSON['stringify'](_0x5f0eb8));_0x30364b(_0x5f0eb8);})['catch'](function(_0x5f0af0){logger['error'](_0xac4a('0x2a'),_0x5f0af0[_0xac4a('0x15')],_0x6dcc7f);_0x57adcf(_0x482afc[_0xac4a('0x13')](0x1f4,_0x5f0af0[_0xac4a('0x15')]));});});};exports[_0xac4a('0x2b')]=function(_0x415f31){var _0x4220e2=this;return new Promise(function(_0x2b16f0,_0x28292c){var _0x1f7721={'body':_0x415f31[_0xac4a('0x2c')],'channel':_0xac4a('0x2d')};var _0x4e4994=_['difference'](_['keys'](db[_0xac4a('0x2e')][_0xac4a('0x2f')]),[_0xac4a('0x30'),_0xac4a('0x31'),_0xac4a('0x32'),_0xac4a('0x33')]);var _0x8febf0=![];if(_0x415f31[_0xac4a('0x2c')]['id']){delete _0x415f31[_0xac4a('0x2c')]['id'];}if(_[_0xac4a('0x34')](_0x415f31['body'][_0xac4a('0x35')])){return _0x28292c(_0x4220e2[_0xac4a('0x13')](0x1f4,_0xac4a('0x36')));}if(_[_0xac4a('0x34')](_0x415f31[_0xac4a('0x2c')]['body'])||_0x415f31[_0xac4a('0x2c')][_0xac4a('0x2c')]===''){return _0x28292c(_0x4220e2['error'](0x1f4,_0xac4a('0x37')));}if(_['isNil'](_0x415f31[_0xac4a('0x2c')][_0xac4a('0x38')])){return _0x28292c(_0x4220e2[_0xac4a('0x13')](0x1f4,_0xac4a('0x39')+_0x4e4994));}if(!_[_0xac4a('0x3a')](_0x4e4994,_0x415f31[_0xac4a('0x2c')][_0xac4a('0x38')])){return _0x28292c(_0x4220e2[_0xac4a('0x13')](0x1f4,_0xac4a('0x3b')+_0x4e4994));}var _0xcb002b={};_0xcb002b[_0x415f31[_0xac4a('0x2c')][_0xac4a('0x38')]]=_0x415f31['body'][_0xac4a('0x35')];return db[_0xac4a('0x1a')][_0xac4a('0x26')]({'where':{'id':_0x415f31['account']['id']},'include':[{'model':db[_0xac4a('0x3c')],'as':_0xac4a('0x3d'),'include':[{'model':db['CmContact'],'as':_0xac4a('0x3e'),'where':_0xcb002b,'limit':0x1,'order':[['updatedAt',_0xac4a('0x3f')]]}]},{'model':db[_0xac4a('0x40')],'as':_0xac4a('0x41')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xac4a('0x42')],'as':'CloudProvider'}]}]})[_0xac4a('0x24')](function(_0x566258){if(_0x566258&&_0x566258[_0xac4a('0x3d')]){var _0x530bbb=_0x566258[_0xac4a('0x43')]({'plain':!![]});_0x1f7721[_0xac4a('0x44')]=_[_0xac4a('0x45')](_0x530bbb,[_0xac4a('0x41'),'List']);_0x1f7721[_0xac4a('0x44')][_0xac4a('0x46')]=_0x566258[_0xac4a('0x29')]();_0x1f7721[_0xac4a('0x47')]=_0x530bbb[_0xac4a('0x41')];_0x1f7721[_0xac4a('0x48')]=_0x530bbb[_0xac4a('0x3d')];_0x1f7721['applications']=_[_0xac4a('0x49')](_0x1f7721[_0xac4a('0x47')],['priority'],[_0xac4a('0x4a')]);if(_0x1f7721[_0xac4a('0x44')]&&_0x1f7721[_0xac4a('0x44')][_0xac4a('0x4b')]){_0x1f7721['applications'][_0xac4a('0x4c')]({'id':0x0,'priority':_0x1f7721[_0xac4a('0x47')][_0xac4a('0x4d')]+0x1,'app':_0xac4a('0x4e'),'appdata':_0xac4a('0x4b'),'interval':'*,*,*,*'});}if(_0x1f7721[_0xac4a('0x44')]['Applications']){delete _0x1f7721[_0xac4a('0x44')][_0xac4a('0x41')];}if(_0x1f7721['account']['List']){delete _0x1f7721[_0xac4a('0x44')][_0xac4a('0x3d')];}if(_0x530bbb['List'][_0xac4a('0x3e')][_0xac4a('0x4d')]){return _0x530bbb[_0xac4a('0x3d')][_0xac4a('0x3e')][0x0];}var _0x48900f=_[_0xac4a('0xa')](_0x415f31[_0xac4a('0x2c')],{'firstName':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x35')],'ListId':_0x530bbb[_0xac4a('0x33')]});_0x48900f[_0x415f31[_0xac4a('0x2c')][_0xac4a('0x38')]]=_0x415f31['body'][_0xac4a('0x35')];return db[_0xac4a('0x2e')][_0xac4a('0x4f')](_0x48900f);}else{throw new Error(_0xac4a('0x50'));}})[_0xac4a('0x24')](function(_0x2ac1e9){_0x1f7721[_0xac4a('0x51')]=_0x2ac1e9;if(_0x2ac1e9){if(!_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x52')]){_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x52')]=rs[_0xac4a('0x53')]()+'\x20'+_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['from'];}var _0x13a577={'ContactId':_0x2ac1e9['id'],'MailAccountId':_0x415f31['account']['id'],'inReplyTo':_0x415f31[_0xac4a('0x2c')]['message'][_0xac4a('0x52')],'to':_0x415f31['body'][_0xac4a('0x15')]['from'],'cc':_0x415f31['body'][_0xac4a('0x15')]['cc'],'subject':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x54')],'attach':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['attach'],'lastMsgAt':moment()[_0xac4a('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xac4a('0x56')]['find']({'where':{'closed':![],'MailAccountId':_0x415f31[_0xac4a('0x44')]['id']},'include':[{'model':db[_0xac4a('0x57')],'as':_0xac4a('0x58'),'attributes':[_0xac4a('0x52')],'where':{'messageId':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x59')]}}]})[_0xac4a('0x24')](function(_0x2ff07a){if(_0x2ff07a){return[_0x2ff07a,![]];}return db[_0xac4a('0x56')][_0xac4a('0x4f')](_0x13a577)[_0xac4a('0x24')](function(_0x1fe05a){return[_0x1fe05a,!![]];});});}else{throw new Error(_0xac4a('0x5a'));}})[_0xac4a('0x5b')](function(_0xf07212,_0x38cb4f){if(_0xf07212){_0x8febf0=_0x38cb4f;if(!_0x38cb4f){return _0xf07212['update']({'inReplyTo':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['messageId'],'to':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x35')],'cc':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['cc'],'subject':_0x415f31['body']['message'][_0xac4a('0x54')],'attach':_0xf07212[_0xac4a('0x5c')]?_0xf07212[_0xac4a('0x5c')]:_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x5c')],'substatus':null,'substatusAt':moment()[_0xac4a('0x55')](_0xac4a('0x5d')),'lastMsgAt':moment()[_0xac4a('0x55')](_0xac4a('0x5d')),'lastMsgDirection':'in'});}else{return _0xf07212;}}})[_0xac4a('0x24')](function(_0x49e5f5){_0x1f7721['interaction']=_0x49e5f5[_0xac4a('0x43')]({'plain':!![]});_0x1f7721[_0xac4a('0x5e')][_0xac4a('0x5f')]=_0x8febf0;return db[_0xac4a('0x57')][_0xac4a('0x4f')]({'body':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x2c')],'MailAccountId':_0x415f31[_0xac4a('0x44')]['id'],'MailInteractionId':_0x49e5f5['id'],'direction':'in','ContactId':_0x1f7721[_0xac4a('0x51')]['id'],'messageId':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')][_0xac4a('0x52')],'from':_0x415f31['body'][_0xac4a('0x15')][_0xac4a('0x35')],'to':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['to'],'cc':_0x415f31['body'][_0xac4a('0x15')]['cc'],'subject':_0x415f31['body'][_0xac4a('0x15')][_0xac4a('0x54')],'attach':_0x415f31['body']['message'][_0xac4a('0x5c')],'Attachments':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['attachments'],'originTo':_0x415f31[_0xac4a('0x2c')]['message'][_0xac4a('0x60')],'originCc':_0x415f31['body']['message'][_0xac4a('0x61')],'bcc':_0x415f31['body'][_0xac4a('0x15')]['bcc'],'ChatWebsiteId':_0x415f31[_0xac4a('0x2c')][_0xac4a('0x15')]['ChatWebsiteId']||null,'originChannel':_0x415f31[_0xac4a('0x2c')]['message'][_0xac4a('0x62')]||_0xac4a('0x63'),'ChatOfflineMessageId':_0x415f31['body'][_0xac4a('0x15')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xac4a('0x64')}]});})['then'](function(_0x26b962){_0x1f7721['message']=_0x26b962;if(_0x1f7721['interaction'][_0xac4a('0x65')]){return db[_0xac4a('0x66')][_0xac4a('0x26')]({'attributes':['id','name'],'where':{'id':_0x1f7721['interaction'][_0xac4a('0x65')]}})[_0xac4a('0x24')](function(_0x5ac8cc){if(_0x5ac8cc){_0x1f7721['applications'][_0xac4a('0x67')]({'id':0x0,'priority':0x0,'app':_0xac4a('0x68'),'appdata':_0x5ac8cc[_0xac4a('0x69')]+','+(_0x1f7721[_0xac4a('0x44')][_0xac4a('0x6a')]||0xa),'interval':_0xac4a('0x6b')});}return respondWithRpcPromise(_0xac4a('0x6c'),_0xac4a('0x6d'),_0x1f7721);});}return respondWithRpcPromise(_0xac4a('0x6c'),'startRouting',_0x1f7721);})[_0xac4a('0x24')](function(_0x440dc4){_0x2b16f0(_0x440dc4);})[_0xac4a('0x18')](function(_0x582e1e){_0x28292c(_0x4220e2[_0xac4a('0x13')](0x1f4,_0x582e1e[_0xac4a('0x15')]));});});}; \ No newline at end of file +var _0xe2fe=['list','List','priority','asc','autoclose','push','length','close','Contacts','defaults','ListId','CmContact','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','Contact\x20not\x20found','spread','interaction','MailMessage','originCc','Attachments','UserId','User','name','unshift','agent','*,*,*,*','Start','startRouting','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','then','debug','catch','ShowMailAccount','raw','smtp','smtpOptions','getSmtpOptions','body','mail','keys','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Smtp','CloudProvider','get','omit','Applications','applications'];(function(_0x3587d3,_0x2b51f5){var _0x27ed3a=function(_0x4ea1e2){while(--_0x4ea1e2){_0x3587d3['push'](_0x3587d3['shift']());}};_0x27ed3a(++_0x2b51f5);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xee2f('0x1'));var Redis=require('ioredis');var db=require(_0xee2f('0x2'))['db'];var logger=require(_0xee2f('0x3'))(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var jayson=require(_0xee2f('0x6'));var client=jayson['client'][_0xee2f('0x7')]({'port':0x232c});config[_0xee2f('0x8')]=_['defaults'](config[_0xee2f('0x8')],{'host':_0xee2f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xee2f('0x8')]));require('./mailAccount.socket')[_0xee2f('0xa')](socket);function respondWithRpcPromise(_0x36920f,_0x53f7dd,_0x3a49bb){return new BPromise(function(_0x43f451,_0x4bf3c3){return client['request'](_0x36920f,_0x3a49bb)['then'](function(_0x56bbea){logger[_0xee2f('0xb')]('MailAccount,\x20%s,\x20%s',_0x53f7dd,'request\x20sent');logger['debug'](_0xee2f('0xc'),_0x53f7dd,_0xee2f('0xd'),JSON[_0xee2f('0xe')](_0x56bbea));if(_0x56bbea[_0xee2f('0xf')]){if(_0x56bbea[_0xee2f('0xf')][_0xee2f('0x10')]===0x1f4){logger['error'](_0xee2f('0x11'),_0x53f7dd,_0x56bbea['error'][_0xee2f('0x12')]);return _0x4bf3c3(_0x56bbea[_0xee2f('0xf')]['message']);}logger[_0xee2f('0xf')](_0xee2f('0x11'),_0x53f7dd,_0x56bbea[_0xee2f('0xf')][_0xee2f('0x12')]);return _0x43f451(_0x56bbea[_0xee2f('0xf')]['message']);}else{logger[_0xee2f('0xb')]('MailAccount,\x20%s,\x20%s',_0x53f7dd,_0xee2f('0xd'));_0x43f451(_0x56bbea[_0xee2f('0x13')]['message']);}})['catch'](function(_0x40b5bc){logger['error'](_0xee2f('0x11'),_0x53f7dd,_0x40b5bc);_0x4bf3c3(_0x40b5bc);});});}exports[_0xee2f('0x14')]=function(_0x28549d){var _0x5b83b5=this;return new Promise(function(_0x35e1a4,_0x1e70aa){return db[_0xee2f('0x15')][_0xee2f('0x16')]({'raw':_0x28549d[_0xee2f('0x17')]?_0x28549d['options']['raw']===undefined?!![]:![]:!![],'where':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x18')]||null:null,'attributes':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x19')]||null:null,'limit':_0x28549d[_0xee2f('0x17')]?_0x28549d['options'][_0xee2f('0x1a')]||null:null,'include':_0x28549d[_0xee2f('0x17')]?_0x28549d[_0xee2f('0x17')][_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x28549d[_0xee2f('0x17')][_0xee2f('0x1b')],function(_0x13013f){return{'model':db[_0x13013f[_0xee2f('0x1d')]],'as':_0x13013f['as'],'attributes':_0x13013f[_0xee2f('0x19')],'include':_0x13013f[_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x13013f[_0xee2f('0x1b')],function(_0x45c4a0){return{'model':db[_0x45c4a0['model']],'as':_0x45c4a0['as'],'attributes':_0x45c4a0['attributes'],'include':_0x45c4a0['include']?_[_0xee2f('0x1c')](_0x45c4a0[_0xee2f('0x1b')],function(_0x2cb0cb){return{'model':db[_0x2cb0cb[_0xee2f('0x1d')]],'as':_0x2cb0cb['as'],'attributes':_0x2cb0cb[_0xee2f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0x1e')](function(_0x4d8398){logger[_0xee2f('0xb')]('GetMailAccount',_0x28549d);logger[_0xee2f('0x1f')](_0xee2f('0x14'),_0x28549d,JSON[_0xee2f('0xe')](_0x4d8398));_0x35e1a4(_0x4d8398);})[_0xee2f('0x20')](function(_0x3ddbe3){logger['error'](_0xee2f('0x14'),_0x3ddbe3[_0xee2f('0x12')],_0x28549d);_0x1e70aa(_0x5b83b5['error'](0x1f4,_0x3ddbe3['message']));});});};exports[_0xee2f('0x21')]=function(_0x574899){var _0x33c426=this;return new Promise(function(_0xc447e,_0x53d9b7){return db[_0xee2f('0x15')]['find']({'raw':_0x574899['options']?_0x574899['options'][_0xee2f('0x22')]===undefined?!![]:![]:!![],'where':_0x574899[_0xee2f('0x17')]?_0x574899['options'][_0xee2f('0x18')]||null:null,'attributes':_0x574899[_0xee2f('0x17')]?_0x574899[_0xee2f('0x17')][_0xee2f('0x19')]||null:null,'include':_0x574899[_0xee2f('0x17')]?_0x574899['options'][_0xee2f('0x1b')]?_['map'](_0x574899[_0xee2f('0x17')][_0xee2f('0x1b')],function(_0x3dcb9e){return{'model':db[_0x3dcb9e['model']],'as':_0x3dcb9e['as'],'attributes':_0x3dcb9e[_0xee2f('0x19')],'include':_0x3dcb9e['include']?_[_0xee2f('0x1c')](_0x3dcb9e['include'],function(_0x3e6dcc){return{'model':db[_0x3e6dcc[_0xee2f('0x1d')]],'as':_0x3e6dcc['as'],'attributes':_0x3e6dcc[_0xee2f('0x19')],'include':_0x3e6dcc[_0xee2f('0x1b')]?_[_0xee2f('0x1c')](_0x3e6dcc[_0xee2f('0x1b')],function(_0x24380b){return{'model':db[_0x24380b[_0xee2f('0x1d')]],'as':_0x24380b['as'],'attributes':_0x24380b[_0xee2f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xee2f('0x1e')](function(_0x433547){if(_0x574899['options'][_0xee2f('0x23')]===!![])_0x433547['setDataValue'](_0xee2f('0x24'),_0x433547[_0xee2f('0x25')]());logger[_0xee2f('0xb')](_0xee2f('0x21'),_0x574899);logger[_0xee2f('0x1f')](_0xee2f('0x21'),_0x574899,JSON[_0xee2f('0xe')](_0x433547));_0xc447e(_0x433547);})[_0xee2f('0x20')](function(_0x50ddd2){logger['error']('ShowMailAccount',_0x50ddd2[_0xee2f('0x12')],_0x574899);_0x53d9b7(_0x33c426['error'](0x1f4,_0x50ddd2[_0xee2f('0x12')]));});});};exports['NotifyMailAccount']=function(_0x558aa3){var _0x5027a6=this;return new Promise(function(_0x58e361,_0x430ac1){var _0x692686={'body':_0x558aa3[_0xee2f('0x26')],'channel':_0xee2f('0x27')};var _0x4823a7=_['difference'](_[_0xee2f('0x28')](db['CmContact']['rawAttributes']),[_0xee2f('0x29'),_0xee2f('0x2a'),_0xee2f('0x2b'),'ListId']);var _0x3bc173=![];if(_0x558aa3[_0xee2f('0x26')]['id']){delete _0x558aa3[_0xee2f('0x26')]['id'];}if(_['isNil'](_0x558aa3['body'][_0xee2f('0x2c')])){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x2d')));}if(_[_0xee2f('0x2e')](_0x558aa3['body'][_0xee2f('0x26')])||_0x558aa3[_0xee2f('0x26')][_0xee2f('0x26')]===''){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x2f')));}if(_[_0xee2f('0x2e')](_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')])){return _0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0xee2f('0x31')+_0x4823a7));}if(!_['includes'](_0x4823a7,_0x558aa3['body']['mapKey'])){return _0x430ac1(_0x5027a6['error'](0x1f4,_0xee2f('0x32')+_0x4823a7));}var _0x3e0d7b={};_0x3e0d7b[_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')]]=_0x558aa3[_0xee2f('0x26')]['from'];return db[_0xee2f('0x15')][_0xee2f('0x33')]({'where':{'id':_0x558aa3[_0xee2f('0x34')]['id']},'include':[{'model':db[_0xee2f('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3e0d7b,'limit':0x1,'order':[[_0xee2f('0x2a'),'DESC']]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xee2f('0x36'),'include':[{'model':db[_0xee2f('0x37')],'as':_0xee2f('0x37')}]}]})['then'](function(_0x22506e){if(_0x22506e&&_0x22506e['List']){var _0x3d95b8=_0x22506e[_0xee2f('0x38')]({'plain':!![]});_0x692686[_0xee2f('0x34')]=_[_0xee2f('0x39')](_0x3d95b8,[_0xee2f('0x3a'),'List']);_0x692686['account'][_0xee2f('0x24')]=_0x22506e['getSmtpOptions']();_0x692686[_0xee2f('0x3b')]=_0x3d95b8[_0xee2f('0x3a')];_0x692686[_0xee2f('0x3c')]=_0x3d95b8[_0xee2f('0x3d')];_0x692686['applications']=_['orderBy'](_0x692686[_0xee2f('0x3b')],[_0xee2f('0x3e')],[_0xee2f('0x3f')]);if(_0x692686[_0xee2f('0x34')]&&_0x692686[_0xee2f('0x34')][_0xee2f('0x40')]){_0x692686[_0xee2f('0x3b')][_0xee2f('0x41')]({'id':0x0,'priority':_0x692686[_0xee2f('0x3b')][_0xee2f('0x42')]+0x1,'app':_0xee2f('0x43'),'appdata':_0xee2f('0x40'),'interval':'*,*,*,*'});}if(_0x692686[_0xee2f('0x34')][_0xee2f('0x3a')]){delete _0x692686[_0xee2f('0x34')][_0xee2f('0x3a')];}if(_0x692686['account'][_0xee2f('0x3d')]){delete _0x692686[_0xee2f('0x34')][_0xee2f('0x3d')];}if(_0x3d95b8[_0xee2f('0x3d')][_0xee2f('0x44')]['length']){return _0x3d95b8[_0xee2f('0x3d')]['Contacts'][0x0];}var _0x4db455=_[_0xee2f('0x45')](_0x558aa3[_0xee2f('0x26')],{'firstName':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x2c')],'ListId':_0x3d95b8[_0xee2f('0x46')]});_0x4db455[_0x558aa3[_0xee2f('0x26')][_0xee2f('0x30')]]=_0x558aa3['body'][_0xee2f('0x2c')];return db[_0xee2f('0x47')][_0xee2f('0x48')](_0x4db455);}else{throw new Error(_0xee2f('0x49'));}})[_0xee2f('0x1e')](function(_0x3e1184){_0x692686[_0xee2f('0x4a')]=_0x3e1184;if(_0x3e1184){if(!_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['messageId']){_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4b')]=rs[_0xee2f('0x4c')]()+'\x20'+_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')];}var _0x5ee444={'ContactId':_0x3e1184['id'],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id'],'inReplyTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4b')],'to':_0x558aa3['body']['message']['from'],'cc':_0x558aa3['body']['message']['cc'],'subject':_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4d')],'attach':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4e')],'lastMsgAt':moment()[_0xee2f('0x4f')](_0xee2f('0x50')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':_0xee2f('0x51'),'attributes':['messageId'],'where':{'messageId':_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x52')]}}]})[_0xee2f('0x1e')](function(_0x2f419c){if(_0x2f419c){return[_0x2f419c,![]];}return db['MailInteraction'][_0xee2f('0x48')](_0x5ee444)[_0xee2f('0x1e')](function(_0x3bdfc5){return[_0x3bdfc5,!![]];});});}else{throw new Error(_0xee2f('0x53'));}})[_0xee2f('0x54')](function(_0x486146,_0xf0c721){if(_0x486146){_0x3bc173=_0xf0c721;if(!_0xf0c721){return _0x486146['update']({'inReplyTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4b')],'to':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')],'cc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['cc'],'subject':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4d')],'attach':_0x486146['attach']?_0x486146[_0xee2f('0x4e')]:_0x558aa3[_0xee2f('0x26')]['message'][_0xee2f('0x4e')],'substatus':null,'substatusAt':moment()['format'](_0xee2f('0x50')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x486146;}}})[_0xee2f('0x1e')](function(_0x46ecac){_0x692686[_0xee2f('0x55')]=_0x46ecac[_0xee2f('0x38')]({'plain':!![]});_0x692686[_0xee2f('0x55')]['created']=_0x3bc173;return db[_0xee2f('0x56')][_0xee2f('0x48')]({'body':_0x558aa3[_0xee2f('0x26')]['body'],'MailAccountId':_0x558aa3[_0xee2f('0x34')]['id'],'MailInteractionId':_0x46ecac['id'],'direction':'in','ContactId':_0x692686[_0xee2f('0x4a')]['id'],'messageId':_0x558aa3['body'][_0xee2f('0x12')][_0xee2f('0x4b')],'from':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x2c')],'to':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['to'],'cc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['cc'],'subject':_0x558aa3['body']['message']['subject'],'attach':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x4e')],'Attachments':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['attachments'],'originTo':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['originTo'],'originCc':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')][_0xee2f('0x57')],'bcc':_0x558aa3['body'][_0xee2f('0x12')]['bcc'],'ChatWebsiteId':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['ChatWebsiteId']||null,'originChannel':_0x558aa3[_0xee2f('0x26')][_0xee2f('0x12')]['originChannel']||'Email','ChatOfflineMessageId':_0x558aa3['body'][_0xee2f('0x12')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xee2f('0x58')}]});})[_0xee2f('0x1e')](function(_0x50a972){_0x692686[_0xee2f('0x12')]=_0x50a972;if(_0x692686['interaction'][_0xee2f('0x59')]){return db[_0xee2f('0x5a')][_0xee2f('0x33')]({'attributes':['id',_0xee2f('0x5b')],'where':{'id':_0x692686[_0xee2f('0x55')][_0xee2f('0x59')]}})[_0xee2f('0x1e')](function(_0x58da0d){if(_0x58da0d){_0x692686[_0xee2f('0x3b')][_0xee2f('0x5c')]({'id':0x0,'priority':0x0,'app':_0xee2f('0x5d'),'appdata':_0x58da0d[_0xee2f('0x5b')]+','+(_0x692686[_0xee2f('0x34')]['waitForTheAssignedAgent']||0xa),'interval':_0xee2f('0x5e')});}return respondWithRpcPromise(_0xee2f('0x5f'),_0xee2f('0x60'),_0x692686);});}return respondWithRpcPromise(_0xee2f('0x5f'),_0xee2f('0x60'),_0x692686);})[_0xee2f('0x1e')](function(_0x4c3b2f){_0x58e361(_0x4c3b2f);})['catch'](function(_0x4051a7){_0x430ac1(_0x5027a6[_0xee2f('0xf')](0x1f4,_0x4051a7[_0xee2f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 366c27b..755ecc8 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 _0xe06f=['removeListener','register','length','mailAccount:','save','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe06f,0x104));var _0xfe06=function(_0x4c01db,_0x5d8e62){_0x4c01db=_0x4c01db-0x0;var _0x9951f9=_0xe06f[_0x4c01db];return _0x9951f9;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xfe06('0x0'),_0xfe06('0x1'),_0xfe06('0x2')];function createListener(_0x5031b6,_0x493c5b){return function(_0x515368){_0x493c5b[_0xfe06('0x3')](_0x5031b6,_0x515368);};}function removeListener(_0x317628,_0x3e20fe){return function(){MailAccountEvents[_0xfe06('0x4')](_0x317628,_0x3e20fe);};}exports[_0xfe06('0x5')]=function(_0x10a093){for(var _0x15d18e=0x0,_0x132a8c=events[_0xfe06('0x6')];_0x15d18e<_0x132a8c;_0x15d18e++){var _0x462aae=events[_0x15d18e];var _0x4b6566=createListener(_0xfe06('0x7')+_0x462aae,_0x10a093);MailAccountEvents['on'](_0x462aae,_0x4b6566);}}; \ No newline at end of file +var _0x77f1=['emit','removeListener','register','save','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x77f1,0x1dd));var _0x177f=function(_0x48469b,_0x2a2f76){_0x48469b=_0x48469b-0x0;var _0x1b5f2a=_0x77f1[_0x48469b];return _0x1b5f2a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x177f('0x0'),_0x177f('0x1'),_0x177f('0x2')];function createListener(_0x4cb557,_0x5cec85){return function(_0x4f729a){_0x5cec85[_0x177f('0x3')](_0x4cb557,_0x4f729a);};}function removeListener(_0x139df2,_0x57dc73){return function(){MailAccountEvents[_0x177f('0x4')](_0x139df2,_0x57dc73);};}exports[_0x177f('0x5')]=function(_0x31c4de){for(var _0x3f30a3=0x0,_0x1bd6b3=events['length'];_0x3f30a3<_0x1bd6b3;_0x3f30a3++){var _0x3f43c1=events[_0x3f30a3];var _0xbbdec1=createListener('mailAccount:'+_0x3f43c1,_0x31c4de);MailAccountEvents['on'](_0x3f43c1,_0xbbdec1);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9f1b394..d03370e 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 _0xc552=['../../components/auth/service','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x45f0e2,_0x12026e){var _0x5c2103=function(_0x2eb050){while(--_0x2eb050){_0x45f0e2['push'](_0x45f0e2['shift']());}};_0x5c2103(++_0x12026e);}(_0xc552,0x181));var _0x2c55=function(_0x5207d3,_0x1b67d4){_0x5207d3=_0x5207d3-0x0;var _0x36785c=_0xc552[_0x5207d3];return _0x36785c;};'use strict';var multer=require(_0x2c55('0x0'));var util=require('util');var path=require(_0x2c55('0x1'));var timeout=require(_0x2c55('0x2'));var express=require(_0x2c55('0x3'));var router=express[_0x2c55('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2c55('0x5'));var interaction=require(_0x2c55('0x6'));var config=require('../../config/environment');var controller=require(_0x2c55('0x7'));router['get'](_0x2c55('0x8'),auth[_0x2c55('0x9')](),controller['show']);router[_0x2c55('0xa')](_0x2c55('0x8'),auth['isAuthenticated'](),controller[_0x2c55('0xb')]);router[_0x2c55('0xc')](_0x2c55('0x8'),auth[_0x2c55('0x9')](),controller[_0x2c55('0xd')]);module[_0x2c55('0xe')]=router; \ No newline at end of file +var _0xade2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller','get','/:id','show','put','isAuthenticated','exports','multer','util'];(function(_0x280440,_0xa2e401){var _0x2fd085=function(_0x387693){while(--_0x387693){_0x280440['push'](_0x280440['shift']());}};_0x2fd085(++_0xa2e401);}(_0xade2,0x94));var _0x2ade=function(_0x136ea7,_0x3680f8){_0x136ea7=_0x136ea7-0x0;var _0x33e1d8=_0xade2[_0x136ea7];return _0x33e1d8;};'use strict';var multer=require(_0x2ade('0x0'));var util=require(_0x2ade('0x1'));var path=require(_0x2ade('0x2'));var timeout=require(_0x2ade('0x3'));var express=require(_0x2ade('0x4'));var router=express[_0x2ade('0x5')]();var fs_extra=require(_0x2ade('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2ade('0x7'));var config=require('../../config/environment');var controller=require(_0x2ade('0x8'));router[_0x2ade('0x9')](_0x2ade('0xa'),auth['isAuthenticated'](),controller[_0x2ade('0xb')]);router[_0x2ade('0xc')](_0x2ade('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x2ade('0xa'),auth[_0x2ade('0xd')](),controller['destroy']);module[_0x2ade('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 51e461c..cdac3a0 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 _0xeb6c=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0xeb6c,0xda));var _0xceb6=function(_0x4c181a,_0x58548d){_0x4c181a=_0x4c181a-0x0;var _0x4a67d7=_0xeb6c[_0x4c181a];return _0x4a67d7;};'use strict';var Sequelize=require('sequelize');module[_0xceb6('0x0')]={'priority':{'type':Sequelize[_0xceb6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xceb6('0x2')],'allowNull':![],'defaultValue':_0xceb6('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xceb6('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xceb6('0x4')}}; \ No newline at end of file +var _0xa70f=['sequelize','exports','STRING','*,*,*,*'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xa70f,0xc8));var _0xfa70=function(_0x5f5008,_0x3cc6a9){_0x5f5008=_0x5f5008-0x0;var _0x3c9557=_0xa70f[_0x5f5008];return _0x3c9557;};'use strict';var Sequelize=require(_0xfa70('0x0'));module[_0xfa70('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfa70('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfa70('0x2')]},'interval':{'type':Sequelize[_0xfa70('0x2')],'defaultValue':_0xfa70('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e831231..212df37 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 _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x14d99c,_0xa1b029){var _0x2a8f65=function(_0xc51369){while(--_0xc51369){_0x14d99c['push'](_0x14d99c['shift']());}};_0x2a8f65(++_0xa1b029);}(_0xe706,0xa3));var _0x6e70=function(_0x3403d5,_0x3d99fc){_0x3403d5=_0x3403d5-0x0;var _0xf9df4f=_0xe706[_0x3403d5];return _0xf9df4f;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file +var _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','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','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x1a39e0,_0x3f7524){var _0x1e2044=function(_0x4e6e74){while(--_0x4e6e74){_0x1a39e0['push'](_0x1a39e0['shift']());}};_0x1e2044(++_0x3f7524);}(_0xda3f,0xec));var _0xfda3=function(_0x4e5e2b,_0x1df7ca){_0x4e5e2b=_0x4e5e2b-0x0;var _0x2e2a29=_0xda3f[_0x4e5e2b];return _0x2e2a29;};'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['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a576bea..698b04a 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 _0xd987=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x30e5b8,_0x915bbe){var _0x228816=function(_0x5ae735){while(--_0x5ae735){_0x30e5b8['push'](_0x30e5b8['shift']());}};_0x228816(++_0x915bbe);}(_0xd987,0x171));var _0x7d98=function(_0x3a8492,_0x2fb44e){_0x3a8492=_0x3a8492-0x0;var _0xadfa1a=_0xd987[_0x3a8492];return _0xadfa1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d98('0x0'))(_0x7d98('0x1'));var moment=require(_0x7d98('0x2'));var BPromise=require(_0x7d98('0x3'));var rp=require(_0x7d98('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d98('0x5'));var config=require(_0x7d98('0x6'));var attributes=require(_0x7d98('0x7'));module[_0x7d98('0x8')]=function(_0x5b9ab9,_0x16f6f6){return _0x5b9ab9[_0x7d98('0x9')](_0x7d98('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7d98('0xb')});}; \ No newline at end of file +var _0xd1fb=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications'];(function(_0x1c6ecc,_0x3acf07){var _0x428fef=function(_0x38def8){while(--_0x38def8){_0x1c6ecc['push'](_0x1c6ecc['shift']());}};_0x428fef(++_0x3acf07);}(_0xd1fb,0x82));var _0xbd1f=function(_0xa4340a,_0x500e62){_0xa4340a=_0xa4340a-0x0;var _0x5704ae=_0xd1fb[_0xa4340a];return _0x5704ae;};'use strict';var _=require(_0xbd1f('0x0'));var util=require(_0xbd1f('0x1'));var logger=require(_0xbd1f('0x2'))('api');var moment=require(_0xbd1f('0x3'));var BPromise=require(_0xbd1f('0x4'));var rp=require(_0xbd1f('0x5'));var fs=require('fs');var path=require(_0xbd1f('0x6'));var rimraf=require(_0xbd1f('0x7'));var config=require(_0xbd1f('0x8'));var attributes=require(_0xbd1f('0x9'));module[_0xbd1f('0xa')]=function(_0x150c31,_0x333869){return _0x150c31[_0xbd1f('0xb')](_0xbd1f('0xc'),attributes,{'tableName':_0xbd1f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbd1f('0xe'),'collate':_0xbd1f('0xf')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 05f7c5c..e19e0d1 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 _0xfaea=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','debug','catch','lodash','util','moment','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfaea,0x1a0));var _0xafae=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xfaea[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xafae('0x0'));var util=require(_0xafae('0x1'));var moment=require(_0xafae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafae('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xafae('0x4'));var logger=require(_0xafae('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xafae('0x6'));var client=jayson[_0xafae('0x7')][_0xafae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x571121,_0x14f0ee,_0x287a67){return new BPromise(function(_0x2a27ce,_0x22e545){return client['request'](_0x571121,_0x287a67)[_0xafae('0x9')](function(_0x5d2b2d){logger[_0xafae('0xa')](_0xafae('0xb'),_0x14f0ee,_0xafae('0xc'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x14f0ee,_0xafae('0xc'),JSON[_0xafae('0xd')](_0x5d2b2d));if(_0x5d2b2d[_0xafae('0xe')]){if(_0x5d2b2d[_0xafae('0xe')][_0xafae('0xf')]===0x1f4){logger[_0xafae('0xe')](_0xafae('0xb'),_0x14f0ee,_0x5d2b2d[_0xafae('0xe')][_0xafae('0x10')]);return _0x22e545(_0x5d2b2d[_0xafae('0xe')]['message']);}logger[_0xafae('0xe')](_0xafae('0xb'),_0x14f0ee,_0x5d2b2d[_0xafae('0xe')]['message']);return _0x2a27ce(_0x5d2b2d[_0xafae('0xe')][_0xafae('0x10')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x14f0ee,_0xafae('0xc'));_0x2a27ce(_0x5d2b2d[_0xafae('0x11')]['message']);}})['catch'](function(_0x258e33){logger['error'](_0xafae('0xb'),_0x14f0ee,_0x258e33);_0x22e545(_0x258e33);});});}exports[_0xafae('0x12')]=function(_0x34d1df){var _0x551855=this;return new Promise(function(_0xdd88ae,_0xa94575){return db[_0xafae('0x13')]['update'](_0x34d1df[_0xafae('0x14')],{'raw':_0x34d1df[_0xafae('0x15')]?_0x34d1df[_0xafae('0x15')][_0xafae('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d1df['options']?_0x34d1df[_0xafae('0x15')][_0xafae('0x17')]||null:null,'attributes':_0x34d1df[_0xafae('0x15')]?_0x34d1df[_0xafae('0x15')][_0xafae('0x18')]||null:null,'limit':_0x34d1df[_0xafae('0x15')]?_0x34d1df[_0xafae('0x15')][_0xafae('0x19')]||null:null})[_0xafae('0x9')](function(_0x1e73c0){logger['info'](_0xafae('0x12'),_0x34d1df);logger[_0xafae('0x1a')](_0xafae('0x12'),_0x34d1df,JSON[_0xafae('0xd')](_0x1e73c0));_0xdd88ae(_0x1e73c0);})[_0xafae('0x1b')](function(_0x1996db){logger['error']('UpdateMailApplication',_0x1996db[_0xafae('0x10')],_0x34d1df);_0xa94575(_0x551855[_0xafae('0xe')](0x1f4,_0x1996db[_0xafae('0x10')]));});});}; \ No newline at end of file +var _0x0c6c=['code','message','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x56dc84,_0x24fe7b){var _0x44c524=function(_0x11138b){while(--_0x11138b){_0x56dc84['push'](_0x56dc84['shift']());}};_0x44c524(++_0x24fe7b);}(_0x0c6c,0x18c));var _0xc0c6=function(_0x1f0464,_0x74c830){_0x1f0464=_0x1f0464-0x0;var _0x3b8414=_0x0c6c[_0x1f0464];return _0x3b8414;};'use strict';var _=require(_0xc0c6('0x0'));var util=require('util');var moment=require(_0xc0c6('0x1'));var BPromise=require(_0xc0c6('0x2'));var rs=require(_0xc0c6('0x3'));var fs=require('fs');var Redis=require(_0xc0c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0c6('0x5'));var logger=require(_0xc0c6('0x6'))(_0xc0c6('0x7'));var config=require(_0xc0c6('0x8'));var jayson=require(_0xc0c6('0x9'));var client=jayson[_0xc0c6('0xa')][_0xc0c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x94dc9d,_0x596959,_0x35ab8b){return new BPromise(function(_0x454f38,_0x1277aa){return client[_0xc0c6('0xc')](_0x94dc9d,_0x35ab8b)[_0xc0c6('0xd')](function(_0x17aee6){logger[_0xc0c6('0xe')](_0xc0c6('0xf'),_0x596959,_0xc0c6('0x10'));logger[_0xc0c6('0x11')](_0xc0c6('0x12'),_0x596959,_0xc0c6('0x10'),JSON['stringify'](_0x17aee6));if(_0x17aee6[_0xc0c6('0x13')]){if(_0x17aee6[_0xc0c6('0x13')][_0xc0c6('0x14')]===0x1f4){logger[_0xc0c6('0x13')](_0xc0c6('0xf'),_0x596959,_0x17aee6[_0xc0c6('0x13')]['message']);return _0x1277aa(_0x17aee6[_0xc0c6('0x13')]['message']);}logger[_0xc0c6('0x13')](_0xc0c6('0xf'),_0x596959,_0x17aee6[_0xc0c6('0x13')][_0xc0c6('0x15')]);return _0x454f38(_0x17aee6[_0xc0c6('0x13')]['message']);}else{logger[_0xc0c6('0xe')](_0xc0c6('0xf'),_0x596959,'request\x20sent');_0x454f38(_0x17aee6['result'][_0xc0c6('0x15')]);}})['catch'](function(_0x3ea929){logger[_0xc0c6('0x13')](_0xc0c6('0xf'),_0x596959,_0x3ea929);_0x1277aa(_0x3ea929);});});}exports[_0xc0c6('0x16')]=function(_0x2bf9e3){var _0x54ec9a=this;return new Promise(function(_0x162880,_0x53355d){return db[_0xc0c6('0x17')]['update'](_0x2bf9e3[_0xc0c6('0x18')],{'raw':_0x2bf9e3[_0xc0c6('0x19')]?_0x2bf9e3['options'][_0xc0c6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bf9e3[_0xc0c6('0x19')]?_0x2bf9e3[_0xc0c6('0x19')][_0xc0c6('0x1b')]||null:null,'attributes':_0x2bf9e3[_0xc0c6('0x19')]?_0x2bf9e3[_0xc0c6('0x19')][_0xc0c6('0x1c')]||null:null,'limit':_0x2bf9e3[_0xc0c6('0x19')]?_0x2bf9e3[_0xc0c6('0x19')][_0xc0c6('0x1d')]||null:null})[_0xc0c6('0xd')](function(_0x5aec2c){logger[_0xc0c6('0xe')](_0xc0c6('0x16'),_0x2bf9e3);logger[_0xc0c6('0x11')]('UpdateMailApplication',_0x2bf9e3,JSON[_0xc0c6('0x1e')](_0x5aec2c));_0x162880(_0x5aec2c);})[_0xc0c6('0x1f')](function(_0x3c037b){logger[_0xc0c6('0x13')]('UpdateMailApplication',_0x3c037b['message'],_0x2bf9e3);_0x53355d(_0x54ec9a[_0xc0c6('0x13')](0x1f4,_0x3c037b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 788e2d1..9fb7120 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 _0xa405=['../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','put','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router'];(function(_0x58b7a4,_0x3cf180){var _0x5aef32=function(_0x3d0e3){while(--_0x3d0e3){_0x58b7a4['push'](_0x58b7a4['shift']());}};_0x5aef32(++_0x3cf180);}(_0xa405,0x186));var _0x5a40=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa405[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0x5a40('0x0'));var router=express[_0x5a40('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x5a40('0x2'));var controller=require(_0x5a40('0x3'));router[_0x5a40('0x4')]('/',auth[_0x5a40('0x5')](),controller[_0x5a40('0x6')]);router[_0x5a40('0x4')](_0x5a40('0x7'),auth[_0x5a40('0x5')](),controller[_0x5a40('0x8')]);router['get'](_0x5a40('0x9'),auth['isAuthenticated'](),controller[_0x5a40('0xa')]);router[_0x5a40('0x4')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5a40('0xb')]);router[_0x5a40('0x4')]('/:id/download',auth[_0x5a40('0x5')](),controller[_0x5a40('0xc')]);router[_0x5a40('0xd')]('/',auth[_0x5a40('0x5')](),controller['create']);router[_0x5a40('0xd')](_0x5a40('0xe'),auth[_0x5a40('0x5')](),controller[_0x5a40('0xf')]);router[_0x5a40('0xd')](_0x5a40('0x10'),auth[_0x5a40('0x5')](),interaction[_0x5a40('0x11')]('mail',_0x5a40('0x12')),controller[_0x5a40('0x13')]);router[_0x5a40('0x14')](_0x5a40('0x9'),auth[_0x5a40('0x5')](),interaction['tracked'](_0x5a40('0x15'),_0x5a40('0x16')),controller['update']);router[_0x5a40('0x17')](_0x5a40('0x9'),auth[_0x5a40('0x5')](),interaction[_0x5a40('0x11')](_0x5a40('0x15'),_0x5a40('0x18')),controller[_0x5a40('0x19')]);router[_0x5a40('0x17')](_0x5a40('0x10'),auth[_0x5a40('0x5')](),controller[_0x5a40('0x1a')]);module[_0x5a40('0x1b')]=router; \ No newline at end of file +var _0xc0db=['get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','Router','../../components/auth/service'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0xc0db,0x18e));var _0xbc0d=function(_0x374b13,_0x33456c){_0x374b13=_0x374b13-0x0;var _0x101ba5=_0xc0db[_0x374b13];return _0x101ba5;};'use strict';var express=require('express');var router=express[_0xbc0d('0x0')]();var auth=require(_0xbc0d('0x1'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0xbc0d('0x2')]('/',auth[_0xbc0d('0x3')](),controller['index']);router[_0xbc0d('0x2')](_0xbc0d('0x4'),auth[_0xbc0d('0x3')](),controller[_0xbc0d('0x5')]);router[_0xbc0d('0x2')]('/:id',auth['isAuthenticated'](),controller[_0xbc0d('0x6')]);router[_0xbc0d('0x2')](_0xbc0d('0x7'),auth[_0xbc0d('0x3')](),controller[_0xbc0d('0x8')]);router[_0xbc0d('0x2')]('/:id/download',auth[_0xbc0d('0x3')](),controller[_0xbc0d('0x9')]);router[_0xbc0d('0xa')]('/',auth[_0xbc0d('0x3')](),controller[_0xbc0d('0xb')]);router[_0xbc0d('0xa')](_0xbc0d('0x7'),auth[_0xbc0d('0x3')](),controller[_0xbc0d('0xc')]);router[_0xbc0d('0xa')]('/:id/tags',auth[_0xbc0d('0x3')](),interaction[_0xbc0d('0xd')](_0xbc0d('0xe'),_0xbc0d('0xf')),controller[_0xbc0d('0x10')]);router[_0xbc0d('0x11')](_0xbc0d('0x12'),auth['isAuthenticated'](),interaction[_0xbc0d('0xd')](_0xbc0d('0xe'),_0xbc0d('0x13')),controller[_0xbc0d('0x14')]);router[_0xbc0d('0x15')](_0xbc0d('0x12'),auth[_0xbc0d('0x3')](),interaction['tracked'](_0xbc0d('0xe'),_0xbc0d('0x16')),controller[_0xbc0d('0x17')]);router['delete']('/:id/tags',auth[_0xbc0d('0x3')](),controller['removeTags']);module[_0xbc0d('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9f3d179..daa917f 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 _0xfc1a=['exports','DATE','STRING','TEXT','ENUM','out','BOOLEAN','sequelize','iconv'];(function(_0x153963,_0x5bc770){var _0x20c800=function(_0x2fdc87){while(--_0x2fdc87){_0x153963['push'](_0x153963['shift']());}};_0x20c800(++_0x5bc770);}(_0xfc1a,0x1c0));var _0xafc1=function(_0x187341,_0x400dc2){_0x187341=_0x187341-0x0;var _0x561252=_0xfc1a[_0x187341];return _0x561252;};'use strict';var Sequelize=require(_0xafc1('0x0'));var iconv=require(_0xafc1('0x1'));module[_0xafc1('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xafc1('0x3')]},'disposition':{'type':Sequelize[_0xafc1('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xafc1('0x4')]},'note':{'type':Sequelize[_0xafc1('0x4')]},'inReplyTo':{'type':Sequelize[_0xafc1('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xafc1('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xafc1('0x3')]},'substatus':{'type':Sequelize[_0xafc1('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xafc1('0x6')]('in',_0xafc1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xafc1('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xafc1('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xafc1('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xc01b=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x50488d,_0x7c940){var _0x12a3c5=function(_0x4b0da1){while(--_0x4b0da1){_0x50488d['push'](_0x50488d['shift']());}};_0x12a3c5(++_0x7c940);}(_0xc01b,0x74));var _0xbc01=function(_0x2b3555,_0x5442ba){_0x2b3555=_0x2b3555-0x0;var _0x25e388=_0xc01b[_0x2b3555];return _0x25e388;};'use strict';var Sequelize=require(_0xbc01('0x0'));var iconv=require(_0xbc01('0x1'));module[_0xbc01('0x2')]={'closed':{'type':Sequelize[_0xbc01('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbc01('0x4')]},'disposition':{'type':Sequelize[_0xbc01('0x5')]},'secondDisposition':{'type':Sequelize[_0xbc01('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbc01('0x5')]},'inReplyTo':{'type':Sequelize[_0xbc01('0x5')](0x1fe)},'to':{'type':Sequelize[_0xbc01('0x5')]},'cc':{'type':Sequelize[_0xbc01('0x6')](_0xbc01('0x7'))},'subject':{'type':Sequelize[_0xbc01('0x6')]()},'attach':{'type':Sequelize[_0xbc01('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xbc01('0x4')]},'substatus':{'type':Sequelize[_0xbc01('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xbc01('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xbc01('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xbc01('0x8')]('in',_0xbc01('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xbc01('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 b5dd982..d736eb0 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 _0xb4b0=['join','format','transcript-%d-%s.zip','push','from','bcc','subject','createdAt','Messages','get','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','type','readFileSync','build','writeFileSync','message%d.eml','rimraf','zip-dir','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','status','end','limit','offset','Content-Range','json','update','then','sendStatus','error','stack','name','MailInteraction','fieldName','findAll','mail','query','show','rawAttributes','keys','filters','intersection','model','attributes','fields','includeAll','include','merge','options','find','catch','create','body','destroy','params','describe','ids','getMessages','MailMessage','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','true','length','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','root','server','files','tmp','attachments'];(function(_0x4da566,_0x3778f8){var _0x1da163=function(_0x1e6759){while(--_0x1e6759){_0x4da566['push'](_0x4da566['shift']());}};_0x1da163(++_0x3778f8);}(_0xb4b0,0x89));var _0x0b4b=function(_0x46492d,_0x7296f4){_0x46492d=_0x46492d-0x0;var _0x113bb5=_0xb4b0[_0x46492d];return _0x113bb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0b4b('0x0'));var zipdir=require(_0x0b4b('0x1'));var moment=require('moment');var BPromise=require(_0x0b4b('0x2'));var util=require(_0x0b4b('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0b4b('0x4'));var juice=require(_0x0b4b('0x5'));var Redis=require(_0x0b4b('0x6'));var interaction=require(_0x0b4b('0x7'));var qs=require(_0x0b4b('0x8'));var logger=require(_0x0b4b('0x9'))(_0x0b4b('0xa'));var config=require(_0x0b4b('0xb'));var db=require(_0x0b4b('0xc'))['db'];var htmlEntities=require(_0x0b4b('0xd'));config[_0x0b4b('0xe')]=_[_0x0b4b('0xf')](config[_0x0b4b('0xe')],{'host':_0x0b4b('0x10'),'port':0x18eb});var socket=require(_0x0b4b('0x11'))(new Redis(config[_0x0b4b('0xe')]));require('./mailInteraction.socket')[_0x0b4b('0x12')](socket);function respondWithStatusCode(_0x26be05,_0x82f5a8){_0x82f5a8=_0x82f5a8||0xcc;return function(_0x27f80f){if(_0x27f80f){return _0x26be05['sendStatus'](_0x82f5a8);}return _0x26be05[_0x0b4b('0x13')](_0x82f5a8)[_0x0b4b('0x14')]();};}function respondWithResult(_0x1f6106,_0x36e372){_0x36e372=_0x36e372||0xc8;return function(_0x2c4da8){if(_0x2c4da8){return _0x1f6106[_0x0b4b('0x13')](_0x36e372)['json'](_0x2c4da8);}};}function respondWithFilteredResult(_0x449a6c,_0x217817){return function(_0x562144){if(_0x562144){var _0xef8427=typeof _0x217817['offset']==='undefined'&&typeof _0x217817[_0x0b4b('0x15')]==='undefined';var _0x475fb2=_0x562144['count'];var _0x27302e=_0xef8427?0x0:_0x217817['offset'];var _0x1737ce=_0xef8427?_0x562144['count']:_0x217817[_0x0b4b('0x16')]+_0x217817[_0x0b4b('0x15')];var _0x400901;if(_0x1737ce>=_0x475fb2){_0x1737ce=_0x475fb2;_0x400901=0xc8;}else{_0x400901=0xce;}_0x449a6c[_0x0b4b('0x13')](_0x400901);return _0x449a6c['set'](_0x0b4b('0x17'),_0x27302e+'-'+_0x1737ce+'/'+_0x475fb2)[_0x0b4b('0x18')](_0x562144);}return null;};}function saveUpdates(_0x369803){return function(_0x43c786){if(_0x43c786){return _0x43c786[_0x0b4b('0x19')](_0x369803)[_0x0b4b('0x1a')](function(_0xaca216){return _0xaca216;});}return null;};}function removeEntity(_0xe6c02f){return function(_0x11bd2e){if(_0x11bd2e){return _0x11bd2e['destroy']()[_0x0b4b('0x1a')](function(){_0xe6c02f[_0x0b4b('0x13')](0xcc)[_0x0b4b('0x14')]();});}};}function handleEntityNotFound(_0xa74937){return function(_0xc3a990){if(!_0xc3a990){_0xa74937[_0x0b4b('0x1b')](0x194);}return _0xc3a990;};}function handleError(_0x262856,_0x2bc345){_0x2bc345=_0x2bc345||0x1f4;return function(_0x2d5d98){logger[_0x0b4b('0x1c')](_0x2d5d98[_0x0b4b('0x1d')]);if(_0x2d5d98[_0x0b4b('0x1e')]){delete _0x2d5d98[_0x0b4b('0x1e')];}_0x262856[_0x0b4b('0x13')](_0x2bc345)['send'](_0x2d5d98);};}exports['index']=function(_0x119eb8,_0xb4e8b4){var _0x1fa174={};var _0x344d8e=_['map'](db[_0x0b4b('0x1f')]['rawAttributes'],function(_0x4d3c12){return{'name':_0x4d3c12[_0x0b4b('0x20')],'type':_0x4d3c12['type']['key']};});_0x1fa174=qs['getOptions'](_0x344d8e,_0x119eb8);return interaction[_0x0b4b('0x21')](_0x0b4b('0x22'),_0x119eb8[_0x0b4b('0x23')],_0x119eb8['user'],_0x1fa174,_0x344d8e)['then'](respondWithFilteredResult(_0xb4e8b4,_0x1fa174))['catch'](handleError(_0xb4e8b4,null));};exports[_0x0b4b('0x24')]=function(_0x33358e,_0x25668a){var _0x128548={'raw':![],'where':{'id':_0x33358e['params']['id']}},_0x2668d5={};_0x2668d5['model']=_['keys'](db[_0x0b4b('0x1f')][_0x0b4b('0x25')]);_0x2668d5['query']=_[_0x0b4b('0x26')](_0x33358e[_0x0b4b('0x23')]);_0x2668d5[_0x0b4b('0x27')]=_[_0x0b4b('0x28')](_0x2668d5[_0x0b4b('0x29')],_0x2668d5[_0x0b4b('0x23')]);_0x128548[_0x0b4b('0x2a')]=_[_0x0b4b('0x28')](_0x2668d5[_0x0b4b('0x29')],qs[_0x0b4b('0x2b')](_0x33358e[_0x0b4b('0x23')]['fields']));_0x128548['attributes']=_0x128548[_0x0b4b('0x2a')]['length']?_0x128548[_0x0b4b('0x2a')]:_0x2668d5[_0x0b4b('0x29')];if(_0x33358e['query'][_0x0b4b('0x2c')]){_0x128548[_0x0b4b('0x2d')]=[{'all':!![]}];}_0x128548=_[_0x0b4b('0x2e')]({},_0x128548,_0x33358e[_0x0b4b('0x2f')]);return db[_0x0b4b('0x1f')][_0x0b4b('0x30')](_0x128548)[_0x0b4b('0x1a')](handleEntityNotFound(_0x25668a,null))[_0x0b4b('0x1a')](respondWithResult(_0x25668a,null))[_0x0b4b('0x31')](handleError(_0x25668a,null));};exports[_0x0b4b('0x32')]=function(_0x11edcf,_0x3abc4b){return db['MailInteraction'][_0x0b4b('0x32')](_0x11edcf['body'],{})[_0x0b4b('0x1a')](respondWithResult(_0x3abc4b,0xc9))[_0x0b4b('0x31')](handleError(_0x3abc4b,null));};exports[_0x0b4b('0x19')]=function(_0x5e3273,_0x1a1f16){if(_0x5e3273['body']['id']){delete _0x5e3273['body']['id'];}return db[_0x0b4b('0x1f')][_0x0b4b('0x30')]({'where':{'id':_0x5e3273['params']['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0x1a1f16,null))[_0x0b4b('0x1a')](saveUpdates(_0x5e3273[_0x0b4b('0x33')],null))['then'](respondWithResult(_0x1a1f16,null))[_0x0b4b('0x31')](handleError(_0x1a1f16,null));};exports[_0x0b4b('0x34')]=function(_0x22143c,_0xd3f859){return db['MailInteraction'][_0x0b4b('0x30')]({'where':{'id':_0x22143c[_0x0b4b('0x35')]['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0xd3f859,null))[_0x0b4b('0x1a')](removeEntity(_0xd3f859,null))[_0x0b4b('0x31')](handleError(_0xd3f859,null));};exports[_0x0b4b('0x36')]=function(_0x551486,_0x30381c){return db[_0x0b4b('0x1f')][_0x0b4b('0x36')]()[_0x0b4b('0x1a')](respondWithResult(_0x30381c,null))[_0x0b4b('0x31')](handleError(_0x30381c,null));};exports['addMessage']=function(_0x4b5349,_0x8b4314){return db['MailMessage']['find']({'where':{'id':_0x4b5349[_0x0b4b('0x35')]['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0x8b4314,null))[_0x0b4b('0x1a')](function(_0x26e565){if(_0x26e565){return _0x26e565['addMessage'](_0x4b5349[_0x0b4b('0x33')][_0x0b4b('0x37')],_['omit'](_0x4b5349[_0x0b4b('0x33')],[_0x0b4b('0x37'),'id'])||{});}})[_0x0b4b('0x1a')](respondWithResult(_0x8b4314,null))[_0x0b4b('0x31')](handleError(_0x8b4314,null));};exports[_0x0b4b('0x38')]=function(_0x430bc6,_0x2809e2){var _0x30433a={'raw':![],'where':{}};var _0x485a33={};var _0x39c342={'count':0x0,'rows':[]};return db[_0x0b4b('0x1f')]['findOne']({'where':{'id':_0x430bc6[_0x0b4b('0x35')]['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0x2809e2,null))[_0x0b4b('0x1a')](function(_0x49ed1b){if(_0x49ed1b){_0x485a33[_0x0b4b('0x29')]=_[_0x0b4b('0x26')](db[_0x0b4b('0x39')][_0x0b4b('0x25')]);_0x485a33['query']=_[_0x0b4b('0x26')](_0x430bc6[_0x0b4b('0x23')]);_0x485a33['filters']=_[_0x0b4b('0x28')](_0x485a33[_0x0b4b('0x29')],_0x485a33[_0x0b4b('0x23')]);_0x30433a[_0x0b4b('0x2a')]=_[_0x0b4b('0x28')](_0x485a33['model'],qs['fields'](_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x2b')]));_0x30433a[_0x0b4b('0x2a')]=_0x30433a[_0x0b4b('0x2a')]['length']?_0x30433a['attributes']:_0x485a33[_0x0b4b('0x29')];if(!_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x3a')](_0x0b4b('0x3b'))){_0x30433a[_0x0b4b('0x15')]=qs['limit'](_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x15')]);_0x30433a[_0x0b4b('0x16')]=qs[_0x0b4b('0x16')](_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x16')]);}_0x30433a[_0x0b4b('0x3c')]=qs['sort'](_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x3d')]);_0x30433a[_0x0b4b('0x3e')]=qs[_0x0b4b('0x27')](_[_0x0b4b('0x3f')](_0x430bc6[_0x0b4b('0x23')],_0x485a33[_0x0b4b('0x27')]));_0x30433a[_0x0b4b('0x3e')][_0x0b4b('0x40')]=_0x49ed1b['id'];if(_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x41')]){_0x30433a[_0x0b4b('0x3e')]=_[_0x0b4b('0x2e')](_0x30433a[_0x0b4b('0x3e')],{'$or':_[_0x0b4b('0x42')](_0x30433a['attributes'],function(_0x4c0aeb){var _0x180758={};_0x180758[_0x4c0aeb]={'$like':'%'+_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x41')]+'%'};return _0x180758;})});}if(_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x43')]){var _0x10d773=_0x430bc6[_0x0b4b('0x23')][_0x0b4b('0x43')][_0x0b4b('0x44')](',');var _0x1b7936={};_0x1b7936[_0x10d773[0x0]]={'$gte':moment(_0x10d773[0x1])['format'](_0x0b4b('0x45'))};_0x30433a[_0x0b4b('0x3e')]=_[_0x0b4b('0x2e')](_0x30433a['where'],_0x1b7936);}_0x30433a=_[_0x0b4b('0x2e')]({},_0x30433a,_0x430bc6['options']);return db[_0x0b4b('0x39')][_0x0b4b('0x46')]({'where':_0x30433a[_0x0b4b('0x3e')]})[_0x0b4b('0x1a')](function(_0xe47cb8){_0x39c342['count']=_0xe47cb8;if(_0x430bc6['query'][_0x0b4b('0x2c')]){_0x30433a[_0x0b4b('0x2d')]=[{'all':!![]}];}return db[_0x0b4b('0x39')][_0x0b4b('0x21')](_0x30433a);})[_0x0b4b('0x1a')](function(_0x480fb7){if(_0x430bc6['query'][_0x0b4b('0x47')]===_0x0b4b('0x48')){for(var _0x5d24f0=0x0;_0x5d24f0<_0x480fb7[_0x0b4b('0x49')];_0x5d24f0++){_0x480fb7[_0x5d24f0][_0x0b4b('0x33')]=juice(_0x480fb7[_0x5d24f0]['body']);}}_0x39c342[_0x0b4b('0x4a')]=_0x480fb7;return _0x39c342;});}})[_0x0b4b('0x1a')](respondWithFilteredResult(_0x2809e2,_0x30433a))['catch'](handleError(_0x2809e2,null));};exports[_0x0b4b('0x4b')]=function(_0xaa965d,_0x1fbdaa){return db['MailInteraction'][_0x0b4b('0x30')]({'where':{'id':_0xaa965d[_0x0b4b('0x35')]['id']}})['then'](handleEntityNotFound(_0x1fbdaa,null))[_0x0b4b('0x1a')](function(_0xc415e1){if(_0xc415e1){return _0xc415e1[_0x0b4b('0x4c')](_0xaa965d[_0x0b4b('0x33')][_0x0b4b('0x37')],_[_0x0b4b('0x4d')](_0xaa965d[_0x0b4b('0x33')],[_0x0b4b('0x37'),'id'])||{})[_0x0b4b('0x4e')](function(){return db[_0x0b4b('0x4f')]['findAll']({'attributes':['id',_0x0b4b('0x1e'),_0x0b4b('0x50')],'where':{'id':_0xaa965d['body']['ids']}});})[_0x0b4b('0x1a')](function(_0x41769d){socket[_0x0b4b('0x51')](_0x0b4b('0x52'),{'id':Number(_0xaa965d[_0x0b4b('0x35')]['id']),'tags':_0x41769d||[]});return{'id':Number(_0xaa965d['params']['id']),'tags':_0x41769d||[]};});}})[_0x0b4b('0x1a')](respondWithResult(_0x1fbdaa,null))[_0x0b4b('0x31')](handleError(_0x1fbdaa,null));};exports[_0x0b4b('0x53')]=function(_0x3de3ab,_0x5a00fb){return db[_0x0b4b('0x1f')][_0x0b4b('0x30')]({'where':{'id':_0x3de3ab[_0x0b4b('0x35')]['id']}})[_0x0b4b('0x1a')](handleEntityNotFound(_0x5a00fb,null))['then'](function(_0x478551){if(_0x478551){return _0x478551['removeTags'](_0x3de3ab[_0x0b4b('0x23')][_0x0b4b('0x37')]);}})[_0x0b4b('0x1a')](respondWithStatusCode(_0x5a00fb,null))[_0x0b4b('0x31')](handleError(_0x5a00fb,null));};exports[_0x0b4b('0x54')]=function(_0x1f65c2,_0x153fef){var _0xfe515c=moment()['unix']()[_0x0b4b('0x55')]();var _0x33e25e=path['join'](config[_0x0b4b('0x56')],_0x0b4b('0x57'),_0x0b4b('0x58'),_0x0b4b('0x59'));var _0x358270=path['join'](config[_0x0b4b('0x56')],'server',_0x0b4b('0x58'),_0x0b4b('0x5a'));var _0x38f0d2=path[_0x0b4b('0x5b')](_0x33e25e,_0xfe515c);var _0x518e85=util[_0x0b4b('0x5c')](_0x0b4b('0x5d'),_0x1f65c2[_0x0b4b('0x35')]['id'],_0xfe515c);var _0x5e2cba=path[_0x0b4b('0x5b')](_0x33e25e,_0x518e85);var _0x59859d=[];if(_0x1f65c2[_0x0b4b('0x23')][_0x0b4b('0x5a')]){_0x59859d[_0x0b4b('0x5e')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0xbb1057=[{'model':db[_0x0b4b('0x39')],'as':'Messages','attributes':['id',_0x0b4b('0x33'),_0x0b4b('0x5f'),'to','cc',_0x0b4b('0x60'),_0x0b4b('0x61'),_0x0b4b('0x62')],'where':{'secret':![]},'order':qs[_0x0b4b('0x3d')]('id'),'include':_0x59859d}];return db[_0x0b4b('0x1f')][_0x0b4b('0x30')]({'where':{'id':_0x1f65c2[_0x0b4b('0x35')]['id']},'include':_0xbb1057})[_0x0b4b('0x1a')](handleEntityNotFound(_0x153fef,null))[_0x0b4b('0x1a')](function(_0x4bd088){if(_0x4bd088&&_0x4bd088[_0x0b4b('0x63')]){var _0x4da14b=_0x4bd088[_0x0b4b('0x64')]({'plain':!![]});fs[_0x0b4b('0x65')](_0x38f0d2);return BPromise[_0x0b4b('0x66')](_0x4da14b['Messages'],function(_0x52249c,_0x12dcdd){var _0x54771b={'from':_0x52249c[_0x0b4b('0x5f')],'to':_0x52249c['to']||_0x0b4b('0x67'),'subject':_0x52249c['subject'],'html':htmlEntities['decode'](_0x52249c[_0x0b4b('0x33')]),'headers':{'Date':moment(_0x52249c[_0x0b4b('0x62')])['format'](_0x0b4b('0x68'))},'attachments':[]};if(_0x52249c['cc']){_0x54771b[_0x0b4b('0x69')]['Cc']=_0x52249c['cc'];}if(_0x52249c[_0x0b4b('0x60')]){_0x54771b[_0x0b4b('0x69')]['Bcc']=_0x52249c[_0x0b4b('0x60')];}return new BPromise(function(_0x2c8b5e,_0x319da5){if(_0x52249c[_0x0b4b('0x6a')]){for(var _0x3c55f3=0x0;_0x3c55f3<_0x52249c[_0x0b4b('0x6a')][_0x0b4b('0x49')];_0x3c55f3++){var _0x1c6db3=_0x52249c[_0x0b4b('0x6a')][_0x3c55f3];var _0x15addb=path[_0x0b4b('0x5b')](_0x358270,_0x1c6db3[_0x0b4b('0x6b')]);if(fs[_0x0b4b('0x6c')](_0x15addb)){_0x54771b[_0x0b4b('0x5a')][_0x0b4b('0x5e')]({'name':_0x1c6db3['name'],'contentType':_0x1c6db3[_0x0b4b('0x6d')],'data':fs[_0x0b4b('0x6e')](_0x15addb)});}}}emlformat[_0x0b4b('0x6f')](_0x54771b,function(_0x33f346,_0x8fe309){if(_0x33f346)return _0x319da5(_0x33f346);fs[_0x0b4b('0x70')](path[_0x0b4b('0x5b')](_0x38f0d2,util['format'](_0x0b4b('0x71'),_0x12dcdd)),_0x8fe309);return _0x2c8b5e(_0x8fe309);});});})[_0x0b4b('0x1a')](function(){return new BPromise(function(_0x391c4c,_0x2a7cc0){zipdir(_0x38f0d2,{'saveTo':_0x5e2cba},function(_0x1d5341,_0xe6c9f2){if(_0x1d5341)return _0x2a7cc0(_0x1d5341);return _0x391c4c(_0xe6c9f2);});})[_0x0b4b('0x1a')](function(){return new BPromise(function(_0x2e3734,_0xc2422b){rimraf(_0x38f0d2,function(_0x61c44){if(_0x61c44)_0xc2422b(_0x61c44);return _0x2e3734();});});})['then'](function(){return _0x153fef[_0x0b4b('0x54')](_0x5e2cba,_0x518e85,function(_0x48da63){if(!_0x48da63)fs['unlinkSync'](_0x5e2cba);});});});}else{return _0x153fef[_0x0b4b('0x1b')](0xc8);}})['catch'](handleError(_0x153fef,null));}; \ No newline at end of file +var _0x8d98=['show','model','keys','intersection','fields','attributes','length','includeAll','include','merge','options','create','body','params','find','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','count','inlineCss','true','rows','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','root','server','files','tmp','join','attachments','push','Attachments','from','bcc','subject','createdAt','Messages','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','build','writeFileSync','message%d.eml','eml-format','zip-dir','moment','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch'];(function(_0x456055,_0x42791b){var _0x58a872=function(_0x5ba850){while(--_0x5ba850){_0x456055['push'](_0x456055['shift']());}};_0x58a872(++_0x42791b);}(_0x8d98,0xbc));var _0x88d9=function(_0x45cb89,_0x99520e){_0x45cb89=_0x45cb89-0x0;var _0x5948c1=_0x8d98[_0x45cb89];return _0x5948c1;};'use strict';var emlformat=require(_0x88d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88d9('0x1'));var moment=require(_0x88d9('0x2'));var BPromise=require(_0x88d9('0x3'));var util=require(_0x88d9('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x88d9('0x5'));var juice=require(_0x88d9('0x6'));var Redis=require(_0x88d9('0x7'));var interaction=require(_0x88d9('0x8'));var qs=require(_0x88d9('0x9'));var logger=require(_0x88d9('0xa'))(_0x88d9('0xb'));var config=require(_0x88d9('0xc'));var db=require(_0x88d9('0xd'))['db'];var htmlEntities=require(_0x88d9('0xe'));config['redis']=_[_0x88d9('0xf')](config['redis'],{'host':_0x88d9('0x10'),'port':0x18eb});var socket=require(_0x88d9('0x11'))(new Redis(config[_0x88d9('0x12')]));require(_0x88d9('0x13'))[_0x88d9('0x14')](socket);function respondWithStatusCode(_0x2c4e34,_0x38e5c5){_0x38e5c5=_0x38e5c5||0xcc;return function(_0x46d5d7){if(_0x46d5d7){return _0x2c4e34[_0x88d9('0x15')](_0x38e5c5);}return _0x2c4e34[_0x88d9('0x16')](_0x38e5c5)[_0x88d9('0x17')]();};}function respondWithResult(_0x38b676,_0x4ca236){_0x4ca236=_0x4ca236||0xc8;return function(_0x20d8b7){if(_0x20d8b7){return _0x38b676[_0x88d9('0x16')](_0x4ca236)[_0x88d9('0x18')](_0x20d8b7);}};}function respondWithFilteredResult(_0x4dc6e0,_0xf99437){return function(_0x184523){if(_0x184523){var _0xcb2246=typeof _0xf99437[_0x88d9('0x19')]===_0x88d9('0x1a')&&typeof _0xf99437['limit']===_0x88d9('0x1a');var _0x175ad7=_0x184523['count'];var _0x42e1f2=_0xcb2246?0x0:_0xf99437[_0x88d9('0x19')];var _0x3f0dea=_0xcb2246?_0x184523['count']:_0xf99437[_0x88d9('0x19')]+_0xf99437[_0x88d9('0x1b')];var _0x1c40ab;if(_0x3f0dea>=_0x175ad7){_0x3f0dea=_0x175ad7;_0x1c40ab=0xc8;}else{_0x1c40ab=0xce;}_0x4dc6e0[_0x88d9('0x16')](_0x1c40ab);return _0x4dc6e0[_0x88d9('0x1c')](_0x88d9('0x1d'),_0x42e1f2+'-'+_0x3f0dea+'/'+_0x175ad7)[_0x88d9('0x18')](_0x184523);}return null;};}function saveUpdates(_0x1d17cb){return function(_0x256f93){if(_0x256f93){return _0x256f93[_0x88d9('0x1e')](_0x1d17cb)[_0x88d9('0x1f')](function(_0x1203ea){return _0x1203ea;});}return null;};}function removeEntity(_0x1c83f9){return function(_0x3d8095){if(_0x3d8095){return _0x3d8095[_0x88d9('0x20')]()[_0x88d9('0x1f')](function(){_0x1c83f9[_0x88d9('0x16')](0xcc)[_0x88d9('0x17')]();});}};}function handleEntityNotFound(_0x33b210){return function(_0x1652b5){if(!_0x1652b5){_0x33b210[_0x88d9('0x15')](0x194);}return _0x1652b5;};}function handleError(_0x50dadb,_0x7c16af){_0x7c16af=_0x7c16af||0x1f4;return function(_0x40cc71){logger[_0x88d9('0x21')](_0x40cc71[_0x88d9('0x22')]);if(_0x40cc71[_0x88d9('0x23')]){delete _0x40cc71[_0x88d9('0x23')];}_0x50dadb['status'](_0x7c16af)[_0x88d9('0x24')](_0x40cc71);};}exports[_0x88d9('0x25')]=function(_0x1208a8,_0xb6f8f0){var _0x860922={};var _0xdbd559=_[_0x88d9('0x26')](db[_0x88d9('0x27')][_0x88d9('0x28')],function(_0x33bfc8){return{'name':_0x33bfc8[_0x88d9('0x29')],'type':_0x33bfc8[_0x88d9('0x2a')][_0x88d9('0x2b')]};});_0x860922=qs[_0x88d9('0x2c')](_0xdbd559,_0x1208a8);return interaction[_0x88d9('0x2d')](_0x88d9('0x2e'),_0x1208a8[_0x88d9('0x2f')],_0x1208a8[_0x88d9('0x30')],_0x860922,_0xdbd559)[_0x88d9('0x1f')](respondWithFilteredResult(_0xb6f8f0,_0x860922))[_0x88d9('0x31')](handleError(_0xb6f8f0,null));};exports[_0x88d9('0x32')]=function(_0x4eaeec,_0x358316){var _0x130456={'raw':![],'where':{'id':_0x4eaeec['params']['id']}},_0x2c814c={};_0x2c814c[_0x88d9('0x33')]=_[_0x88d9('0x34')](db['MailInteraction'][_0x88d9('0x28')]);_0x2c814c[_0x88d9('0x2f')]=_[_0x88d9('0x34')](_0x4eaeec['query']);_0x2c814c['filters']=_[_0x88d9('0x35')](_0x2c814c[_0x88d9('0x33')],_0x2c814c[_0x88d9('0x2f')]);_0x130456['attributes']=_[_0x88d9('0x35')](_0x2c814c[_0x88d9('0x33')],qs[_0x88d9('0x36')](_0x4eaeec[_0x88d9('0x2f')][_0x88d9('0x36')]));_0x130456[_0x88d9('0x37')]=_0x130456[_0x88d9('0x37')][_0x88d9('0x38')]?_0x130456[_0x88d9('0x37')]:_0x2c814c[_0x88d9('0x33')];if(_0x4eaeec[_0x88d9('0x2f')][_0x88d9('0x39')]){_0x130456[_0x88d9('0x3a')]=[{'all':!![]}];}_0x130456=_[_0x88d9('0x3b')]({},_0x130456,_0x4eaeec[_0x88d9('0x3c')]);return db['MailInteraction']['find'](_0x130456)[_0x88d9('0x1f')](handleEntityNotFound(_0x358316,null))['then'](respondWithResult(_0x358316,null))['catch'](handleError(_0x358316,null));};exports[_0x88d9('0x3d')]=function(_0x2c636f,_0x5b6d90){return db[_0x88d9('0x27')][_0x88d9('0x3d')](_0x2c636f[_0x88d9('0x3e')],{})[_0x88d9('0x1f')](respondWithResult(_0x5b6d90,0xc9))['catch'](handleError(_0x5b6d90,null));};exports['update']=function(_0x4df10d,_0x4e6214){if(_0x4df10d['body']['id']){delete _0x4df10d[_0x88d9('0x3e')]['id'];}return db[_0x88d9('0x27')]['find']({'where':{'id':_0x4df10d[_0x88d9('0x3f')]['id']}})[_0x88d9('0x1f')](handleEntityNotFound(_0x4e6214,null))[_0x88d9('0x1f')](saveUpdates(_0x4df10d['body'],null))[_0x88d9('0x1f')](respondWithResult(_0x4e6214,null))[_0x88d9('0x31')](handleError(_0x4e6214,null));};exports[_0x88d9('0x20')]=function(_0x4cdb7e,_0x3923f2){return db[_0x88d9('0x27')][_0x88d9('0x40')]({'where':{'id':_0x4cdb7e['params']['id']}})['then'](handleEntityNotFound(_0x3923f2,null))[_0x88d9('0x1f')](removeEntity(_0x3923f2,null))['catch'](handleError(_0x3923f2,null));};exports[_0x88d9('0x41')]=function(_0x10c447,_0x40d983){return db[_0x88d9('0x27')][_0x88d9('0x41')]()[_0x88d9('0x1f')](respondWithResult(_0x40d983,null))[_0x88d9('0x31')](handleError(_0x40d983,null));};exports[_0x88d9('0x42')]=function(_0x1744d3,_0x5c5582){return db[_0x88d9('0x43')][_0x88d9('0x40')]({'where':{'id':_0x1744d3[_0x88d9('0x3f')]['id']}})[_0x88d9('0x1f')](handleEntityNotFound(_0x5c5582,null))['then'](function(_0x2ca034){if(_0x2ca034){return _0x2ca034[_0x88d9('0x42')](_0x1744d3['body'][_0x88d9('0x44')],_[_0x88d9('0x45')](_0x1744d3[_0x88d9('0x3e')],[_0x88d9('0x44'),'id'])||{});}})[_0x88d9('0x1f')](respondWithResult(_0x5c5582,null))['catch'](handleError(_0x5c5582,null));};exports[_0x88d9('0x46')]=function(_0x4baddc,_0x43b59d){var _0x7aa9bd={'raw':![],'where':{}};var _0x44c2a0={};var _0x34cba2={'count':0x0,'rows':[]};return db[_0x88d9('0x27')][_0x88d9('0x47')]({'where':{'id':_0x4baddc[_0x88d9('0x3f')]['id']}})[_0x88d9('0x1f')](handleEntityNotFound(_0x43b59d,null))['then'](function(_0x511c46){if(_0x511c46){_0x44c2a0['model']=_[_0x88d9('0x34')](db['MailMessage']['rawAttributes']);_0x44c2a0[_0x88d9('0x2f')]=_[_0x88d9('0x34')](_0x4baddc[_0x88d9('0x2f')]);_0x44c2a0[_0x88d9('0x48')]=_[_0x88d9('0x35')](_0x44c2a0[_0x88d9('0x33')],_0x44c2a0[_0x88d9('0x2f')]);_0x7aa9bd['attributes']=_['intersection'](_0x44c2a0['model'],qs[_0x88d9('0x36')](_0x4baddc[_0x88d9('0x2f')][_0x88d9('0x36')]));_0x7aa9bd[_0x88d9('0x37')]=_0x7aa9bd[_0x88d9('0x37')][_0x88d9('0x38')]?_0x7aa9bd[_0x88d9('0x37')]:_0x44c2a0[_0x88d9('0x33')];if(!_0x4baddc[_0x88d9('0x2f')][_0x88d9('0x49')](_0x88d9('0x4a'))){_0x7aa9bd['limit']=qs[_0x88d9('0x1b')](_0x4baddc[_0x88d9('0x2f')][_0x88d9('0x1b')]);_0x7aa9bd[_0x88d9('0x19')]=qs[_0x88d9('0x19')](_0x4baddc[_0x88d9('0x2f')][_0x88d9('0x19')]);}_0x7aa9bd[_0x88d9('0x4b')]=qs[_0x88d9('0x4c')](_0x4baddc['query'][_0x88d9('0x4c')]);_0x7aa9bd[_0x88d9('0x4d')]=qs[_0x88d9('0x48')](_[_0x88d9('0x4e')](_0x4baddc[_0x88d9('0x2f')],_0x44c2a0[_0x88d9('0x48')]));_0x7aa9bd[_0x88d9('0x4d')]['MailInteractionId']=_0x511c46['id'];if(_0x4baddc['query'][_0x88d9('0x4f')]){_0x7aa9bd[_0x88d9('0x4d')]=_[_0x88d9('0x3b')](_0x7aa9bd[_0x88d9('0x4d')],{'$or':_[_0x88d9('0x26')](_0x7aa9bd[_0x88d9('0x37')],function(_0x1c53ca){var _0x18a802={};_0x18a802[_0x1c53ca]={'$like':'%'+_0x4baddc[_0x88d9('0x2f')][_0x88d9('0x4f')]+'%'};return _0x18a802;})});}if(_0x4baddc[_0x88d9('0x2f')][_0x88d9('0x50')]){var _0x50705a=_0x4baddc[_0x88d9('0x2f')]['$gte'][_0x88d9('0x51')](',');var _0x1c95fa={};_0x1c95fa[_0x50705a[0x0]]={'$gte':moment(_0x50705a[0x1])[_0x88d9('0x52')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7aa9bd[_0x88d9('0x4d')]=_[_0x88d9('0x3b')](_0x7aa9bd[_0x88d9('0x4d')],_0x1c95fa);}_0x7aa9bd=_[_0x88d9('0x3b')]({},_0x7aa9bd,_0x4baddc[_0x88d9('0x3c')]);return db[_0x88d9('0x43')][_0x88d9('0x53')]({'where':_0x7aa9bd[_0x88d9('0x4d')]})['then'](function(_0x3bdffe){_0x34cba2[_0x88d9('0x53')]=_0x3bdffe;if(_0x4baddc['query']['includeAll']){_0x7aa9bd[_0x88d9('0x3a')]=[{'all':!![]}];}return db[_0x88d9('0x43')][_0x88d9('0x2d')](_0x7aa9bd);})['then'](function(_0x21a6da){if(_0x4baddc['query'][_0x88d9('0x54')]===_0x88d9('0x55')){for(var _0x5f272d=0x0;_0x5f272d<_0x21a6da[_0x88d9('0x38')];_0x5f272d++){_0x21a6da[_0x5f272d][_0x88d9('0x3e')]=juice(_0x21a6da[_0x5f272d]['body']);}}_0x34cba2[_0x88d9('0x56')]=_0x21a6da;return _0x34cba2;});}})[_0x88d9('0x1f')](respondWithFilteredResult(_0x43b59d,_0x7aa9bd))[_0x88d9('0x31')](handleError(_0x43b59d,null));};exports[_0x88d9('0x57')]=function(_0xa7488b,_0x30cb69){return db['MailInteraction'][_0x88d9('0x40')]({'where':{'id':_0xa7488b['params']['id']}})[_0x88d9('0x1f')](handleEntityNotFound(_0x30cb69,null))[_0x88d9('0x1f')](function(_0x29a2e9){if(_0x29a2e9){return _0x29a2e9['setTags'](_0xa7488b[_0x88d9('0x3e')][_0x88d9('0x44')],_[_0x88d9('0x45')](_0xa7488b[_0x88d9('0x3e')],[_0x88d9('0x44'),'id'])||{})[_0x88d9('0x58')](function(){return db[_0x88d9('0x59')]['findAll']({'attributes':['id','name',_0x88d9('0x5a')],'where':{'id':_0xa7488b[_0x88d9('0x3e')][_0x88d9('0x44')]}});})[_0x88d9('0x1f')](function(_0x5413a1){socket[_0x88d9('0x5b')](_0x88d9('0x5c'),{'id':Number(_0xa7488b[_0x88d9('0x3f')]['id']),'tags':_0x5413a1||[]});return{'id':Number(_0xa7488b[_0x88d9('0x3f')]['id']),'tags':_0x5413a1||[]};});}})['then'](respondWithResult(_0x30cb69,null))[_0x88d9('0x31')](handleError(_0x30cb69,null));};exports['removeTags']=function(_0x166cd3,_0xf2774d){return db['MailInteraction']['find']({'where':{'id':_0x166cd3[_0x88d9('0x3f')]['id']}})['then'](handleEntityNotFound(_0xf2774d,null))['then'](function(_0x3c8416){if(_0x3c8416){return _0x3c8416[_0x88d9('0x5d')](_0x166cd3[_0x88d9('0x2f')][_0x88d9('0x44')]);}})[_0x88d9('0x1f')](respondWithStatusCode(_0xf2774d,null))[_0x88d9('0x31')](handleError(_0xf2774d,null));};exports[_0x88d9('0x5e')]=function(_0x3f2479,_0x121232){var _0x330787=moment()['unix']()['toString']();var _0x5bf8bb=path['join'](config[_0x88d9('0x5f')],_0x88d9('0x60'),_0x88d9('0x61'),_0x88d9('0x62'));var _0x5c1d21=path[_0x88d9('0x63')](config['root'],_0x88d9('0x60'),'files',_0x88d9('0x64'));var _0x1abcb7=path[_0x88d9('0x63')](_0x5bf8bb,_0x330787);var _0x221589=util[_0x88d9('0x52')]('transcript-%d-%s.zip',_0x3f2479['params']['id'],_0x330787);var _0x532c89=path[_0x88d9('0x63')](_0x5bf8bb,_0x221589);var _0x5d1078=[];if(_0x3f2479[_0x88d9('0x2f')][_0x88d9('0x64')]){_0x5d1078[_0x88d9('0x65')]({'model':db['Attachment'],'as':_0x88d9('0x66'),'raw':!![]});}var _0x99d0e7=[{'model':db[_0x88d9('0x43')],'as':'Messages','attributes':['id',_0x88d9('0x3e'),_0x88d9('0x67'),'to','cc',_0x88d9('0x68'),_0x88d9('0x69'),_0x88d9('0x6a')],'where':{'secret':![]},'order':qs[_0x88d9('0x4c')]('id'),'include':_0x5d1078}];return db[_0x88d9('0x27')]['find']({'where':{'id':_0x3f2479[_0x88d9('0x3f')]['id']},'include':_0x99d0e7})[_0x88d9('0x1f')](handleEntityNotFound(_0x121232,null))[_0x88d9('0x1f')](function(_0x4c4ff5){if(_0x4c4ff5&&_0x4c4ff5[_0x88d9('0x6b')]){var _0x3f51a6=_0x4c4ff5['get']({'plain':!![]});fs['mkdirSync'](_0x1abcb7);return BPromise[_0x88d9('0x6c')](_0x3f51a6[_0x88d9('0x6b')],function(_0x5cf4fb,_0x23c2fc){var _0x490ab1={'from':_0x5cf4fb['from'],'to':_0x5cf4fb['to']||_0x88d9('0x6d'),'subject':_0x5cf4fb['subject'],'html':htmlEntities[_0x88d9('0x6e')](_0x5cf4fb[_0x88d9('0x3e')]),'headers':{'Date':moment(_0x5cf4fb[_0x88d9('0x6a')])[_0x88d9('0x52')](_0x88d9('0x6f'))},'attachments':[]};if(_0x5cf4fb['cc']){_0x490ab1[_0x88d9('0x70')]['Cc']=_0x5cf4fb['cc'];}if(_0x5cf4fb[_0x88d9('0x68')]){_0x490ab1[_0x88d9('0x70')][_0x88d9('0x71')]=_0x5cf4fb['bcc'];}return new BPromise(function(_0x339190,_0x477845){if(_0x5cf4fb[_0x88d9('0x66')]){for(var _0x30ce29=0x0;_0x30ce29<_0x5cf4fb[_0x88d9('0x66')]['length'];_0x30ce29++){var _0x5c60cb=_0x5cf4fb[_0x88d9('0x66')][_0x30ce29];var _0x4040e8=path['join'](_0x5c1d21,_0x5c60cb[_0x88d9('0x72')]);if(fs[_0x88d9('0x73')](_0x4040e8)){_0x490ab1[_0x88d9('0x64')][_0x88d9('0x65')]({'name':_0x5c60cb[_0x88d9('0x23')],'contentType':_0x5c60cb[_0x88d9('0x2a')],'data':fs['readFileSync'](_0x4040e8)});}}}emlformat[_0x88d9('0x74')](_0x490ab1,function(_0x94ee1d,_0x1b5e7c){if(_0x94ee1d)return _0x477845(_0x94ee1d);fs[_0x88d9('0x75')](path[_0x88d9('0x63')](_0x1abcb7,util['format'](_0x88d9('0x76'),_0x23c2fc)),_0x1b5e7c);return _0x339190(_0x1b5e7c);});});})['then'](function(){return new BPromise(function(_0x76dcd7,_0x1242f6){zipdir(_0x1abcb7,{'saveTo':_0x532c89},function(_0x1e54c6,_0x45147c){if(_0x1e54c6)return _0x1242f6(_0x1e54c6);return _0x76dcd7(_0x45147c);});})[_0x88d9('0x1f')](function(){return new BPromise(function(_0x19722d,_0x19fad6){rimraf(_0x1abcb7,function(_0x674644){if(_0x674644)_0x19fad6(_0x674644);return _0x19722d();});});})[_0x88d9('0x1f')](function(){return _0x121232['download'](_0x532c89,_0x221589,function(_0x975607){if(!_0x975607)fs['unlinkSync'](_0x532c89);});});});}else{return _0x121232[_0x88d9('0x15')](0xc8);}})[_0x88d9('0x31')](handleError(_0x121232,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 17bb1b8..62ec18f 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 _0x347a=['../../mysqldb','MailMessage','update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','length','catch','hook','exports','events','MailInteraction'];(function(_0x407236,_0x4e45db){var _0x1c823e=function(_0x32cd8b){while(--_0x32cd8b){_0x407236['push'](_0x407236['shift']());}};_0x1c823e(++_0x4e45db);}(_0x347a,0x16e));var _0xa347=function(_0x1bfd25,_0x349005){_0x1bfd25=_0x1bfd25-0x0;var _0x11804d=_0x347a[_0x1bfd25];return _0x11804d;};'use strict';var EventEmitter=require(_0xa347('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xa347('0x1')];var MailMessage=require(_0xa347('0x2'))['db'][_0xa347('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa347('0x4'),'afterDestroy':_0xa347('0x5')};function emitEvent(_0x4d146a){return function(_0x240727,_0x9e8f1e,_0x7d35aa){_0x240727[_0xa347('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x14b381){_0x240727[_0xa347('0x7')](_0xa347('0x8'),_0x14b381[_0xa347('0x9')](function(_0x5c9674){return{'id':_0x5c9674['id']};}));return MailMessage[_0xa347('0xa')]({'where':{'MailInteractionId':_0x240727['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x29567a){_0x240727[_0xa347('0x7')](_0xa347('0xb'),_0x29567a[_0xa347('0xc')]);MailInteractionEvents['emit'](_0x4d146a+':'+_0x240727['id'],_0x240727);MailInteractionEvents['emit'](_0x4d146a,_0x240727);_0x7d35aa(null);})[_0xa347('0xd')](_0x7d35aa(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa347('0xe')](e,emitEvent(event));}}module[_0xa347('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0xb78b=['setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','MailMessage','setMaxListeners','update','remove','getUsers'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0xb78b,0x103));var _0xbb78=function(_0x243349,_0xbef353){_0x243349=_0x243349-0x0;var _0x40e334=_0xb78b[_0x243349];return _0x40e334;};'use strict';var EventEmitter=require(_0xbb78('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xbb78('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xbb78('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbb78('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb78('0x4'),'afterDestroy':_0xbb78('0x5')};function emitEvent(_0x3551d7){return function(_0x5ea284,_0x2a73f3,_0x409ddf){_0x5ea284[_0xbb78('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb6d68){_0x5ea284[_0xbb78('0x7')](_0xbb78('0x8'),_0xb6d68[_0xbb78('0x9')](function(_0x5d9e8b){return{'id':_0x5d9e8b['id']};}));return MailMessage[_0xbb78('0xa')]({'where':{'MailInteractionId':_0x5ea284['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbb78('0xb')](function(_0x142e0b){_0x5ea284[_0xbb78('0x7')](_0xbb78('0xc'),_0x142e0b[_0xbb78('0xd')]);MailInteractionEvents[_0xbb78('0xe')](_0x3551d7+':'+_0x5ea284['id'],_0x5ea284);MailInteractionEvents[_0xbb78('0xe')](_0x3551d7,_0x5ea284);_0x409ddf(null);})[_0xbb78('0xf')](_0x409ddf(null));};}for(var e in events){if(events[_0xbb78('0x10')](e)){var event=events[e];MailInteraction[_0xbb78('0x11')](e,emitEvent(event));}}module[_0xbb78('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 486c825..8c571db 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 _0xa73b=['./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','closed','models','get','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0xb73ab5,_0x57f8a6){var _0xa60755=function(_0x49b8dd){while(--_0x49b8dd){_0xb73ab5['push'](_0xb73ab5['shift']());}};_0xa60755(++_0x57f8a6);}(_0xa73b,0x173));var _0xba73=function(_0x1a1514,_0xf55b89){_0x1a1514=_0x1a1514-0x0;var _0x4a78f1=_0xa73b[_0x1a1514];return _0x4a78f1;};'use strict';var _=require(_0xba73('0x0'));var util=require(_0xba73('0x1'));var logger=require(_0xba73('0x2'))('api');var moment=require(_0xba73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba73('0x4'));var rimraf=require(_0xba73('0x5'));var config=require(_0xba73('0x6'));var attributes=require(_0xba73('0x7'));module[_0xba73('0x8')]=function(_0x512b84,_0x14cbf8){return _0x512b84[_0xba73('0x9')](_0xba73('0xa'),attributes,{'tableName':_0xba73('0xb'),'paranoid':![],'indexes':[{'name':_0xba73('0xc'),'fields':[_0xba73('0xd'),'to'],'type':_0xba73('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4d1280,_0xfdaadd,_0x5ebfc5){if(_0x4d1280[_0xba73('0xf')]){_0x4d1280['substatusAt']=moment()['format'](_0xba73('0x10'));}if(_0x4d1280['closed']){_0x4d1280[_0xba73('0x11')]=moment()[_0xba73('0x12')](_0xba73('0x10'));}_0x5ebfc5(null,_0xfdaadd);},'beforeUpdate':function(_0x1bac08,_0x37826d,_0x2b9e70){if(_0x1bac08['changed'](_0xba73('0xf'))){_0x1bac08['substatusAt']=_0x1bac08[_0xba73('0xf')]?moment()[_0xba73('0x12')](_0xba73('0x10')):null;}if(_0x1bac08[_0xba73('0x13')](_0xba73('0x14'))){_0x1bac08[_0xba73('0x11')]=moment()[_0xba73('0x12')](_0xba73('0x10'));_0x1bac08[_0xba73('0xf')]=null;_0x1bac08['substatusAt']=null;}_0x2b9e70(null,_0x1bac08);},'afterUpdate':function(_0xb4f575,_0x2c683d,_0x51b1f7){var _0x467f06=_0x512b84[_0xba73('0x15')];var _0x4d161c=_0xb4f575[_0xba73('0x16')]({'plain':!![]});if(_0x4d161c['closed']){return _0x467f06['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x4d161c['id']}})[_0xba73('0x17')](function(){_0x51b1f7();})[_0xba73('0x18')](function(_0x5e49e1){_0x51b1f7(_0x5e49e1);});}else{_0x51b1f7();}}},'charset':_0xba73('0x19'),'collate':_0xba73('0x1a')});}; \ No newline at end of file +var _0xd06f=['update','then','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','exports','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','substatusAt','closed','models','get','MailMessage'];(function(_0x36ad90,_0x15b1f9){var _0x710ae7=function(_0x40743e){while(--_0x40743e){_0x36ad90['push'](_0x36ad90['shift']());}};_0x710ae7(++_0x15b1f9);}(_0xd06f,0xa0));var _0xfd06=function(_0x521c76,_0x2d48f9){_0x521c76=_0x521c76-0x0;var _0x7fcf5f=_0xd06f[_0x521c76];return _0x7fcf5f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd06('0x0'))(_0xfd06('0x1'));var moment=require(_0xfd06('0x2'));var BPromise=require(_0xfd06('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfd06('0x4'));var config=require(_0xfd06('0x5'));var attributes=require(_0xfd06('0x6'));module[_0xfd06('0x7')]=function(_0x3f3044,_0x5198dc){return _0x3f3044['define']('MailInteraction',attributes,{'tableName':_0xfd06('0x8'),'paranoid':![],'indexes':[{'name':_0xfd06('0x9'),'fields':[_0xfd06('0xa'),'to'],'type':_0xfd06('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xddc56b,_0xe312eb,_0x308d92){if(_0xddc56b[_0xfd06('0xc')]){_0xddc56b['substatusAt']=moment()['format'](_0xfd06('0xd'));}if(_0xddc56b['closed']){_0xddc56b[_0xfd06('0xe')]=moment()[_0xfd06('0xf')](_0xfd06('0xd'));}_0x308d92(null,_0xe312eb);},'beforeUpdate':function(_0x398e76,_0x1282d2,_0x2709ce){if(_0x398e76[_0xfd06('0x10')](_0xfd06('0xc'))){_0x398e76[_0xfd06('0x11')]=_0x398e76[_0xfd06('0xc')]?moment()[_0xfd06('0xf')](_0xfd06('0xd')):null;}if(_0x398e76[_0xfd06('0x10')](_0xfd06('0x12'))){_0x398e76[_0xfd06('0xe')]=moment()[_0xfd06('0xf')](_0xfd06('0xd'));_0x398e76[_0xfd06('0xc')]=null;_0x398e76[_0xfd06('0x11')]=null;}_0x2709ce(null,_0x398e76);},'afterUpdate':function(_0x2c135b,_0x18e8a5,_0x313096){var _0x3f921b=_0x3f3044[_0xfd06('0x13')];var _0x475773=_0x2c135b[_0xfd06('0x14')]({'plain':!![]});if(_0x475773[_0xfd06('0x12')]){return _0x3f921b[_0xfd06('0x15')][_0xfd06('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x475773['id']}})[_0xfd06('0x17')](function(){_0x313096();})['catch'](function(_0x5c4a1e){_0x313096(_0x5c4a1e);});}else{_0x313096();}}},'charset':_0xfd06('0x18'),'collate':_0xfd06('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 077f4d9..b02cc50 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 _0x95eb=['redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x95eb,0x1cc));var _0xb95e=function(_0x5dbe1e,_0x544d98){_0x5dbe1e=_0x5dbe1e-0x0;var _0x278f00=_0x95eb[_0x5dbe1e];return _0x278f00;};'use strict';var _=require(_0xb95e('0x0'));var util=require(_0xb95e('0x1'));var moment=require(_0xb95e('0x2'));var BPromise=require(_0xb95e('0x3'));var rs=require(_0xb95e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb95e('0x5'))['db'];var utils=require(_0xb95e('0x6'));var logger=require(_0xb95e('0x7'))(_0xb95e('0x8'));var config=require(_0xb95e('0x9'));var jayson=require(_0xb95e('0xa'));var client=jayson[_0xb95e('0xb')][_0xb95e('0xc')]({'port':0x232a});config[_0xb95e('0xd')]=_[_0xb95e('0xe')](config[_0xb95e('0xd')],{'host':_0xb95e('0xf'),'port':0x18eb});var socket=require(_0xb95e('0x10'))(new Redis(config['redis']));require(_0xb95e('0x11'))['register'](socket);function respondWithRpcPromise(_0x1b2b3c,_0x224db2,_0x3800a2){return new BPromise(function(_0x432fb4,_0x410df2){return client['request'](_0x1b2b3c,_0x3800a2)[_0xb95e('0x12')](function(_0x292285){logger[_0xb95e('0x13')](_0xb95e('0x14'),_0x224db2,_0xb95e('0x15'));logger[_0xb95e('0x16')](_0xb95e('0x17'),_0x224db2,_0xb95e('0x15'),JSON[_0xb95e('0x18')](_0x292285));if(_0x292285[_0xb95e('0x19')]){if(_0x292285['error'][_0xb95e('0x1a')]===0x1f4){logger[_0xb95e('0x19')](_0xb95e('0x14'),_0x224db2,_0x292285[_0xb95e('0x19')]['message']);return _0x410df2(_0x292285[_0xb95e('0x19')]['message']);}logger[_0xb95e('0x19')](_0xb95e('0x14'),_0x224db2,_0x292285[_0xb95e('0x19')]['message']);return _0x432fb4(_0x292285['error'][_0xb95e('0x1b')]);}else{logger[_0xb95e('0x13')]('MailInteraction,\x20%s,\x20%s',_0x224db2,_0xb95e('0x15'));_0x432fb4(_0x292285[_0xb95e('0x1c')]['message']);}})[_0xb95e('0x1d')](function(_0x360d37){logger[_0xb95e('0x19')](_0xb95e('0x14'),_0x224db2,_0x360d37);_0x410df2(_0x360d37);});});}exports[_0xb95e('0x1e')]=function(_0x5eed71){var _0x31b605=this;return new Promise(function(_0x43af71,_0x53f8b9){return db[_0xb95e('0x1f')]['update'](_0x5eed71[_0xb95e('0x20')],{'raw':_0x5eed71[_0xb95e('0x21')]?_0x5eed71[_0xb95e('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eed71[_0xb95e('0x21')]?_0x5eed71[_0xb95e('0x21')][_0xb95e('0x22')]||null:null,'attributes':_0x5eed71[_0xb95e('0x21')]?_0x5eed71[_0xb95e('0x21')][_0xb95e('0x23')]||null:null,'limit':_0x5eed71[_0xb95e('0x21')]?_0x5eed71['options'][_0xb95e('0x24')]||null:null})[_0xb95e('0x12')](function(_0x1b962c){logger[_0xb95e('0x13')](_0xb95e('0x1e'),_0x5eed71);logger[_0xb95e('0x16')](_0xb95e('0x1e'),_0x5eed71,JSON[_0xb95e('0x18')](_0x1b962c));_0x43af71(_0x1b962c);})[_0xb95e('0x1d')](function(_0x2d067f){logger['error'](_0xb95e('0x1e'),_0x2d067f[_0xb95e('0x1b')],_0x5eed71);_0x53f8b9(_0x31b605[_0xb95e('0x19')](0x1f4,_0x2d067f[_0xb95e('0x1b')]));});});};exports[_0xb95e('0x25')]=function(_0x464859){return new Promise(function(_0x1d422c,_0x76e601){return db[_0xb95e('0x1f')][_0xb95e('0x26')]({'where':_0x464859['options']?_0x464859[_0xb95e('0x21')]['where']||null:null})[_0xb95e('0x12')](function(_0x4f8793){if(_0x4f8793){return _0x4f8793[_0xb95e('0x27')](_0x464859[_0xb95e('0x20')]['ids'],_[_0xb95e('0x28')](_0x464859[_0xb95e('0x20')],[_0xb95e('0x29'),'id'])||{});}})['spread'](function(_0xd1e738){logger[_0xb95e('0x13')](_0xb95e('0x2a'),_0x464859);logger[_0xb95e('0x16')](_0xb95e('0x2a'),_0x464859,JSON['stringify'](_0xd1e738));_0x1d422c(_0xd1e738);})[_0xb95e('0x1d')](function(_0x50651d){logger['error']('AddTags',_0x50651d['message'],_0x464859);_0x76e601(_this[_0xb95e('0x19')](0x1f4,_0x50651d[_0xb95e('0x1b')]));});});}; \ No newline at end of file +var _0x0f6a=['localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','stringify','find','addTags','ids','spread','AddTags','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0x0f6a,0x1b6));var _0xa0f6=function(_0x5c8b69,_0x135505){_0x5c8b69=_0x5c8b69-0x0;var _0x3750a1=_0x0f6a[_0x5c8b69];return _0x3750a1;};'use strict';var _=require('lodash');var util=require(_0xa0f6('0x0'));var moment=require(_0xa0f6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0f6('0x2'));var db=require(_0xa0f6('0x3'))['db'];var utils=require(_0xa0f6('0x4'));var logger=require(_0xa0f6('0x5'))(_0xa0f6('0x6'));var config=require(_0xa0f6('0x7'));var jayson=require(_0xa0f6('0x8'));var client=jayson[_0xa0f6('0x9')][_0xa0f6('0xa')]({'port':0x232a});config[_0xa0f6('0xb')]=_[_0xa0f6('0xc')](config['redis'],{'host':_0xa0f6('0xd'),'port':0x18eb});var socket=require(_0xa0f6('0xe'))(new Redis(config[_0xa0f6('0xb')]));require(_0xa0f6('0xf'))['register'](socket);function respondWithRpcPromise(_0x3dbe11,_0x309405,_0x56862a){return new BPromise(function(_0x2a6f4c,_0x1ae5a1){return client[_0xa0f6('0x10')](_0x3dbe11,_0x56862a)[_0xa0f6('0x11')](function(_0x6975c4){logger[_0xa0f6('0x12')]('MailInteraction,\x20%s,\x20%s',_0x309405,_0xa0f6('0x13'));logger[_0xa0f6('0x14')](_0xa0f6('0x15'),_0x309405,'request\x20sent',JSON['stringify'](_0x6975c4));if(_0x6975c4[_0xa0f6('0x16')]){if(_0x6975c4[_0xa0f6('0x16')][_0xa0f6('0x17')]===0x1f4){logger[_0xa0f6('0x16')](_0xa0f6('0x18'),_0x309405,_0x6975c4[_0xa0f6('0x16')][_0xa0f6('0x19')]);return _0x1ae5a1(_0x6975c4[_0xa0f6('0x16')][_0xa0f6('0x19')]);}logger[_0xa0f6('0x16')]('MailInteraction,\x20%s,\x20%s',_0x309405,_0x6975c4[_0xa0f6('0x16')]['message']);return _0x2a6f4c(_0x6975c4[_0xa0f6('0x16')]['message']);}else{logger[_0xa0f6('0x12')]('MailInteraction,\x20%s,\x20%s',_0x309405,_0xa0f6('0x13'));_0x2a6f4c(_0x6975c4[_0xa0f6('0x1a')]['message']);}})[_0xa0f6('0x1b')](function(_0x5f2130){logger[_0xa0f6('0x16')]('MailInteraction,\x20%s,\x20%s',_0x309405,_0x5f2130);_0x1ae5a1(_0x5f2130);});});}exports[_0xa0f6('0x1c')]=function(_0x1b4f8c){var _0x14c13d=this;return new Promise(function(_0x1d7649,_0x325374){return db['MailInteraction'][_0xa0f6('0x1d')](_0x1b4f8c[_0xa0f6('0x1e')],{'raw':_0x1b4f8c[_0xa0f6('0x1f')]?_0x1b4f8c[_0xa0f6('0x1f')][_0xa0f6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b4f8c[_0xa0f6('0x1f')]?_0x1b4f8c[_0xa0f6('0x1f')][_0xa0f6('0x21')]||null:null,'attributes':_0x1b4f8c[_0xa0f6('0x1f')]?_0x1b4f8c[_0xa0f6('0x1f')][_0xa0f6('0x22')]||null:null,'limit':_0x1b4f8c['options']?_0x1b4f8c[_0xa0f6('0x1f')]['limit']||null:null})[_0xa0f6('0x11')](function(_0x366099){logger[_0xa0f6('0x12')](_0xa0f6('0x1c'),_0x1b4f8c);logger['debug'](_0xa0f6('0x1c'),_0x1b4f8c,JSON[_0xa0f6('0x23')](_0x366099));_0x1d7649(_0x366099);})[_0xa0f6('0x1b')](function(_0x58d00c){logger[_0xa0f6('0x16')]('UpdateMailInteraction',_0x58d00c[_0xa0f6('0x19')],_0x1b4f8c);_0x325374(_0x14c13d[_0xa0f6('0x16')](0x1f4,_0x58d00c[_0xa0f6('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x175c29){return new Promise(function(_0x154968,_0x2c5c22){return db['MailInteraction'][_0xa0f6('0x24')]({'where':_0x175c29[_0xa0f6('0x1f')]?_0x175c29[_0xa0f6('0x1f')][_0xa0f6('0x21')]||null:null})['then'](function(_0x3af8db){if(_0x3af8db){return _0x3af8db[_0xa0f6('0x25')](_0x175c29[_0xa0f6('0x1e')][_0xa0f6('0x26')],_['omit'](_0x175c29[_0xa0f6('0x1e')],[_0xa0f6('0x26'),'id'])||{});}})[_0xa0f6('0x27')](function(_0x4ef1de){logger['info'](_0xa0f6('0x28'),_0x175c29);logger[_0xa0f6('0x14')](_0xa0f6('0x28'),_0x175c29,JSON[_0xa0f6('0x23')](_0x4ef1de));_0x154968(_0x4ef1de);})[_0xa0f6('0x1b')](function(_0x32b5ea){logger[_0xa0f6('0x16')](_0xa0f6('0x28'),_0x32b5ea['message'],_0x175c29);_0x2c5c22(_this['error'](0x1f4,_0x32b5ea[_0xa0f6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 55e188a..af01bdc 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 _0x875a=['save','update','emit','removeListener','register','mailInteraction:','./mailInteraction.events'];(function(_0x29737d,_0x34506a){var _0x465eed=function(_0x4c7393){while(--_0x4c7393){_0x29737d['push'](_0x29737d['shift']());}};_0x465eed(++_0x34506a);}(_0x875a,0x187));var _0xa875=function(_0x4f1b76,_0x3b75d2){_0x4f1b76=_0x4f1b76-0x0;var _0x3c68a7=_0x875a[_0x4f1b76];return _0x3c68a7;};'use strict';var MailInteractionEvents=require(_0xa875('0x0'));var events=[_0xa875('0x1'),'remove',_0xa875('0x2')];function createListener(_0x1222d3,_0x15ac80){return function(_0x3c93ac){_0x15ac80[_0xa875('0x3')](_0x1222d3,_0x3c93ac);};}function removeListener(_0xbd3d7,_0x158b91){return function(){MailInteractionEvents[_0xa875('0x4')](_0xbd3d7,_0x158b91);};}exports[_0xa875('0x5')]=function(_0x4d9c7b){for(var _0x61ddc9=0x0,_0x4ac4d1=events['length'];_0x61ddc9<_0x4ac4d1;_0x61ddc9++){var _0x576d81=events[_0x61ddc9];var _0x105b31=createListener(_0xa875('0x6')+_0x576d81,_0x4d9c7b);MailInteractionEvents['on'](_0x576d81,_0x105b31);}}; \ No newline at end of file +var _0x1118=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','removeListener'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x1118,0x15b));var _0x8111=function(_0x21f94b,_0x2c2ef6){_0x21f94b=_0x21f94b-0x0;var _0x3d7d0d=_0x1118[_0x21f94b];return _0x3d7d0d;};'use strict';var MailInteractionEvents=require(_0x8111('0x0'));var events=[_0x8111('0x1'),_0x8111('0x2'),_0x8111('0x3')];function createListener(_0x1779ba,_0x3aee26){return function(_0x4d4386){_0x3aee26['emit'](_0x1779ba,_0x4d4386);};}function removeListener(_0x5539e3,_0x14edef){return function(){MailInteractionEvents[_0x8111('0x4')](_0x5539e3,_0x14edef);};}exports[_0x8111('0x5')]=function(_0x32db3d){for(var _0x3e4ee6=0x0,_0x1a36ec=events[_0x8111('0x6')];_0x3e4ee6<_0x1a36ec;_0x3e4ee6++){var _0x167769=events[_0x3e4ee6];var _0x5122f1=createListener(_0x8111('0x7')+_0x167769,_0x32db3d);MailInteractionEvents['on'](_0x167769,_0x5122f1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 05ac87a..bc7d6b5 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 _0x7980=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path'];(function(_0x44a7c1,_0x2500e9){var _0x1966de=function(_0x2e6916){while(--_0x2e6916){_0x44a7c1['push'](_0x44a7c1['shift']());}};_0x1966de(++_0x2500e9);}(_0x7980,0xab));var _0x0798=function(_0x12bd92,_0x8c41ba){_0x12bd92=_0x12bd92-0x0;var _0x521cf7=_0x7980[_0x12bd92];return _0x521cf7;};'use strict';var multer=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var path=require(_0x0798('0x2'));var timeout=require(_0x0798('0x3'));var express=require(_0x0798('0x4'));var router=express['Router']();var fs_extra=require(_0x0798('0x5'));var auth=require(_0x0798('0x6'));var interaction=require(_0x0798('0x7'));var config=require(_0x0798('0x8'));var controller=require(_0x0798('0x9'));router['get']('/',auth[_0x0798('0xa')](),controller['index']);router[_0x0798('0xb')](_0x0798('0xc'),auth[_0x0798('0xa')](),controller['describe']);router['get'](_0x0798('0xd'),auth[_0x0798('0xa')](),controller[_0x0798('0xe')]);router[_0x0798('0xb')](_0x0798('0xf'),auth[_0x0798('0xa')](),controller[_0x0798('0x10')]);router[_0x0798('0x11')]('/',auth[_0x0798('0xa')](),interaction[_0x0798('0x12')]('mail',_0x0798('0x13')),controller[_0x0798('0x14')]);router['put']('/:id',auth[_0x0798('0xa')](),controller[_0x0798('0x15')]);router[_0x0798('0x16')](_0x0798('0x17'),auth[_0x0798('0xa')](),controller[_0x0798('0x18')]);router[_0x0798('0x16')]('/:id/reject',auth['isAuthenticated'](),controller[_0x0798('0x19')]);router[_0x0798('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x0798('0x1b')]);module[_0x0798('0x1c')]=router; \ No newline at end of file +var _0xf491=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','get','/:id','isAuthenticated','/:id/download','download','tracked','mail','mailmessage:create','update','put','/:id/accept','accept','/:id/reject'];(function(_0x14e393,_0x5ef7b3){var _0x5b5ffa=function(_0x133c89){while(--_0x133c89){_0x14e393['push'](_0x14e393['shift']());}};_0x5b5ffa(++_0x5ef7b3);}(_0xf491,0x178));var _0x1f49=function(_0x567538,_0x4d0dab){_0x567538=_0x567538-0x0;var _0x145719=_0xf491[_0x567538];return _0x145719;};'use strict';var multer=require(_0x1f49('0x0'));var util=require(_0x1f49('0x1'));var path=require(_0x1f49('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1f49('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1f49('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1f49('0x5'));var controller=require(_0x1f49('0x6'));router[_0x1f49('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1f49('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1f49('0x7')](_0x1f49('0x8'),auth[_0x1f49('0x9')](),controller['show']);router[_0x1f49('0x7')](_0x1f49('0xa'),auth[_0x1f49('0x9')](),controller[_0x1f49('0xb')]);router['post']('/',auth[_0x1f49('0x9')](),interaction[_0x1f49('0xc')](_0x1f49('0xd'),_0x1f49('0xe')),controller['create']);router['put'](_0x1f49('0x8'),auth[_0x1f49('0x9')](),controller[_0x1f49('0xf')]);router[_0x1f49('0x10')](_0x1f49('0x11'),auth[_0x1f49('0x9')](),controller[_0x1f49('0x12')]);router[_0x1f49('0x10')](_0x1f49('0x13'),auth[_0x1f49('0x9')](),controller['reject']);router['delete']('/:id',auth[_0x1f49('0x9')](),controller[_0x1f49('0x14')]);module[_0x1f49('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 93fdd20..688778d 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 _0xc9d4=['INTEGER','Email','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc9d4,0x183));var _0x4c9d=function(_0x5856c1,_0x2d02e2){_0x5856c1=_0x5856c1-0x0;var _0x174d4b=_0xc9d4[_0x5856c1];return _0x174d4b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4c9d('0x0'));module[_0x4c9d('0x1')]={'body':{'type':Sequelize[_0x4c9d('0x2')](_0x4c9d('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4c9d('0x2')](_0x4c9d('0x4'))},'read':{'type':Sequelize[_0x4c9d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4c9d('0x6')]('in',_0x4c9d('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x4c9d('0x3'))},'cc':{'type':Sequelize[_0x4c9d('0x2')](_0x4c9d('0x3'))},'bcc':{'type':Sequelize[_0x4c9d('0x2')]('long')},'subject':{'type':Sequelize[_0x4c9d('0x2')]},'sentAt':{'type':Sequelize[_0x4c9d('0x8')]},'attach':{'type':Sequelize[_0x4c9d('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4c9d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x4c9d('0x2')](_0x4c9d('0x3'))},'originCc':{'type':Sequelize[_0x4c9d('0x2')]('long')},'originChannel':{'type':Sequelize[_0x4c9d('0x6')](_0x4c9d('0xa'),'Chat'),'defaultValue':_0x4c9d('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x9b37=['exports','long','BOOLEAN','ENUM','out','STRING','TEXT','INTEGER','DATE','Email','Chat','sequelize','lodash'];(function(_0x15beba,_0x4c7578){var _0x222f59=function(_0xa37c0e){while(--_0xa37c0e){_0x15beba['push'](_0x15beba['shift']());}};_0x222f59(++_0x4c7578);}(_0x9b37,0x184));var _0x79b3=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x9b37[_0x2c1dcd];return _0x158ce5;};'use strict';var Sequelize=require(_0x79b3('0x0'));var _=require(_0x79b3('0x1'));module[_0x79b3('0x2')]={'body':{'type':Sequelize['TEXT'](_0x79b3('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x79b3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x79b3('0x5')]('in',_0x79b3('0x6')),'defaultValue':_0x79b3('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x79b3('0x7')](0x1fe)},'from':{'type':Sequelize[_0x79b3('0x7')]},'to':{'type':Sequelize[_0x79b3('0x8')](_0x79b3('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x79b3('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x79b3('0x3'))},'subject':{'type':Sequelize[_0x79b3('0x8')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x79b3('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x79b3('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x79b3('0xa')]},'originTo':{'type':Sequelize[_0x79b3('0x8')](_0x79b3('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x79b3('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0x79b3('0xb'),_0x79b3('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 6b139e7..d2cf460 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 _0x126d=['message-%s.eml','bcc','Attachment','Attachments','from','subject','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','end','stack','name','MailMessage','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','map','filter','options','includeAll','include','findAll','rows','show','rawAttributes','find','body','destroy','params','describe','create','out','secret','MailAccount','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','Contacts','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','email','rejectmessage','download','unix','files','tmp','server'];(function(_0x1e308e,_0x3bf35d){var _0x53d75e=function(_0xf69607){while(--_0xf69607){_0x1e308e['push'](_0x1e308e['shift']());}};_0x53d75e(++_0x3bf35d);}(_0x126d,0xae));var _0xd126=function(_0x1e6d84,_0x56d49c){_0x1e6d84=_0x1e6d84-0x0;var _0x336842=_0x126d[_0x1e6d84];return _0x336842;};'use strict';var emlformat=require(_0xd126('0x0'));var moment=require(_0xd126('0x1'));var BPromise=require(_0xd126('0x2'));var util=require(_0xd126('0x3'));var path=require(_0xd126('0x4'));var fs=require('fs');var _=require(_0xd126('0x5'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0xd126('0x6'));var logger=require(_0xd126('0x7'))(_0xd126('0x8'));var interaction_log=require(_0xd126('0x7'))(_0xd126('0x9'));var config=require(_0xd126('0xa'));var db=require(_0xd126('0xb'))['db'];config[_0xd126('0xc')]=_[_0xd126('0xd')](config[_0xd126('0xc')],{'host':_0xd126('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd126('0xc')]));var htmlEntities=require(_0xd126('0xf'));require(_0xd126('0x10'))[_0xd126('0x11')](socket);var jayson=require(_0xd126('0x12'));var client=jayson[_0xd126('0x13')][_0xd126('0x14')]({'port':0x232c});var client9003=jayson[_0xd126('0x13')][_0xd126('0x14')]({'port':0x232b});var client9002=jayson[_0xd126('0x13')][_0xd126('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x408e5e,_0x295618,_0x53e65c,_0x33422d){return new BPromise(function(_0x2900a2,_0x10fb7f){var _0x1c1805=_0x33422d||client;return _0x1c1805[_0xd126('0x15')](_0x408e5e,_0x53e65c)[_0xd126('0x16')](function(_0x2cc35e){logger[_0xd126('0x17')]('MailMessage,\x20%s,\x20%s',_0x295618,_0xd126('0x18'));logger['debug'](_0xd126('0x19'),_0x295618,_0xd126('0x18'),JSON[_0xd126('0x1a')](_0x2cc35e));if(_0x2cc35e['error']){if(_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1c')]===0x1f4){logger['error'](_0xd126('0x1d'),_0x295618,_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1e')]);return _0x10fb7f(_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1e')]);}logger[_0xd126('0x1b')]('MailMessage,\x20%s,\x20%s',_0x295618,_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1e')]);return _0x2900a2(_0x2cc35e[_0xd126('0x1b')][_0xd126('0x1e')]);}else{logger[_0xd126('0x17')](_0xd126('0x1d'),_0x295618,_0xd126('0x18'));_0x2900a2(_0x2cc35e[_0xd126('0x1f')][_0xd126('0x1e')]);}})[_0xd126('0x20')](function(_0xba08fc){logger[_0xd126('0x1b')](_0xd126('0x1d'),_0x295618,_0xba08fc);_0x10fb7f(_0xba08fc);});});}function respondWithResult(_0x27ba69,_0x209f31){_0x209f31=_0x209f31||0xc8;return function(_0x19d406){if(_0x19d406){return _0x27ba69['status'](_0x209f31)[_0xd126('0x21')](_0x19d406);}};}function respondWithFilteredResult(_0x40336c,_0x1f3238){return function(_0x3ee122){if(_0x3ee122){var _0x23700f=typeof _0x1f3238[_0xd126('0x22')]===_0xd126('0x23')&&typeof _0x1f3238[_0xd126('0x24')]===_0xd126('0x23');var _0xa2eb06=_0x3ee122['count'];var _0x50c879=_0x23700f?0x0:_0x1f3238['offset'];var _0x3b7388=_0x23700f?_0x3ee122[_0xd126('0x25')]:_0x1f3238[_0xd126('0x22')]+_0x1f3238['limit'];var _0x514ceb;if(_0x3b7388>=_0xa2eb06){_0x3b7388=_0xa2eb06;_0x514ceb=0xc8;}else{_0x514ceb=0xce;}_0x40336c[_0xd126('0x26')](_0x514ceb);return _0x40336c[_0xd126('0x27')](_0xd126('0x28'),_0x50c879+'-'+_0x3b7388+'/'+_0xa2eb06)[_0xd126('0x21')](_0x3ee122);}return null;};}function saveUpdates(_0xf833f3){return function(_0x175619){if(_0x175619){return _0x175619[_0xd126('0x29')](_0xf833f3)[_0xd126('0x16')](function(_0x55b935){return _0x55b935;});}return null;};}function removeEntity(_0x20cb83){return function(_0x11ea45){if(_0x11ea45){return _0x11ea45['destroy']()[_0xd126('0x16')](function(){_0x20cb83[_0xd126('0x26')](0xcc)[_0xd126('0x2a')]();});}};}function handleEntityNotFound(_0x3a8e19){return function(_0x18edbb){if(!_0x18edbb){_0x3a8e19['sendStatus'](0x194);}return _0x18edbb;};}function handleError(_0x22ba9e,_0x5e0dda){_0x5e0dda=_0x5e0dda||0x1f4;return function(_0x537a72){logger[_0xd126('0x1b')](_0x537a72[_0xd126('0x2b')]);if(_0x537a72[_0xd126('0x2c')]){delete _0x537a72[_0xd126('0x2c')];}_0x22ba9e[_0xd126('0x26')](_0x5e0dda)['send'](_0x537a72);};}exports['index']=function(_0x27f22c,_0x5be810){var _0x483a66={},_0x3c6205={},_0x236bbf={'count':0x0,'rows':[]};var _0x4d6b64=_['map'](db[_0xd126('0x2d')]['rawAttributes'],function(_0x10c5e9){return{'name':_0x10c5e9['fieldName'],'type':_0x10c5e9[_0xd126('0x2e')][_0xd126('0x2f')]};});_0x3c6205[_0xd126('0x30')]=_['map'](_0x4d6b64,_0xd126('0x2c'));_0x3c6205['query']=_[_0xd126('0x31')](_0x27f22c[_0xd126('0x32')]);_0x3c6205[_0xd126('0x33')]=_[_0xd126('0x34')](_0x3c6205[_0xd126('0x30')],_0x3c6205['query']);_0x483a66[_0xd126('0x35')]=_['intersection'](_0x3c6205[_0xd126('0x30')],qs[_0xd126('0x36')](_0x27f22c[_0xd126('0x32')]['fields']));_0x483a66[_0xd126('0x35')]=_0x483a66['attributes'][_0xd126('0x37')]?_0x483a66['attributes']:_0x3c6205[_0xd126('0x30')];if(!_0x27f22c[_0xd126('0x32')]['hasOwnProperty']('nolimit')){_0x483a66['limit']=qs[_0xd126('0x24')](_0x27f22c[_0xd126('0x32')][_0xd126('0x24')]);_0x483a66[_0xd126('0x22')]=qs['offset'](_0x27f22c[_0xd126('0x32')][_0xd126('0x22')]);}_0x483a66[_0xd126('0x38')]=qs[_0xd126('0x39')](_0x27f22c['query'][_0xd126('0x39')]);_0x483a66[_0xd126('0x3a')]=qs[_0xd126('0x33')](_['pick'](_0x27f22c[_0xd126('0x32')],_0x3c6205[_0xd126('0x33')]),_0x4d6b64);if(_0x27f22c[_0xd126('0x32')]['filter']){_0x483a66[_0xd126('0x3a')]=_['merge'](_0x483a66[_0xd126('0x3a')],{'$or':_[_0xd126('0x3b')](_0x4d6b64,function(_0x15a743){if(_0x15a743['type']!=='VIRTUAL'){var _0x2f1899={};_0x2f1899[_0x15a743[_0xd126('0x2c')]]={'$like':'%'+_0x27f22c[_0xd126('0x32')][_0xd126('0x3c')]+'%'};return _0x2f1899;}})});}_0x483a66=_['merge']({},_0x483a66,_0x27f22c[_0xd126('0x3d')]);var _0x674ebb={'where':_0x483a66[_0xd126('0x3a')]};return db[_0xd126('0x2d')]['count'](_0x674ebb)[_0xd126('0x16')](function(_0x451bce){_0x236bbf[_0xd126('0x25')]=_0x451bce;if(_0x27f22c['query'][_0xd126('0x3e')]){_0x483a66[_0xd126('0x3f')]=[{'all':!![]}];}return db[_0xd126('0x2d')][_0xd126('0x40')](_0x483a66);})[_0xd126('0x16')](function(_0x1901ab){_0x236bbf[_0xd126('0x41')]=_0x1901ab;return _0x236bbf;})[_0xd126('0x16')](respondWithFilteredResult(_0x5be810,_0x483a66))[_0xd126('0x20')](handleError(_0x5be810,null));};exports[_0xd126('0x42')]=function(_0x1e358a,_0x3cbeb4){var _0x1be7aa={'raw':!![],'where':{'id':_0x1e358a['params']['id']}},_0x4d7559={};_0x4d7559[_0xd126('0x30')]=_['keys'](db['MailMessage'][_0xd126('0x43')]);_0x4d7559[_0xd126('0x32')]=_['keys'](_0x1e358a[_0xd126('0x32')]);_0x4d7559['filters']=_[_0xd126('0x34')](_0x4d7559[_0xd126('0x30')],_0x4d7559[_0xd126('0x32')]);_0x1be7aa[_0xd126('0x35')]=_[_0xd126('0x34')](_0x4d7559[_0xd126('0x30')],qs['fields'](_0x1e358a[_0xd126('0x32')][_0xd126('0x36')]));_0x1be7aa[_0xd126('0x35')]=_0x1be7aa[_0xd126('0x35')][_0xd126('0x37')]?_0x1be7aa['attributes']:_0x4d7559[_0xd126('0x30')];if(_0x1e358a[_0xd126('0x32')][_0xd126('0x3e')]){_0x1be7aa['include']=[{'all':!![]}];}_0x1be7aa=_['merge']({},_0x1be7aa,_0x1e358a[_0xd126('0x3d')]);return db['MailMessage'][_0xd126('0x44')](_0x1be7aa)[_0xd126('0x16')](handleEntityNotFound(_0x3cbeb4,null))['then'](respondWithResult(_0x3cbeb4,null))[_0xd126('0x20')](handleError(_0x3cbeb4,null));};exports[_0xd126('0x29')]=function(_0x8c5e48,_0x317aaa){if(_0x8c5e48['body']['id']){delete _0x8c5e48['body']['id'];}return db['MailMessage']['find']({'where':{'id':_0x8c5e48['params']['id']}})[_0xd126('0x16')](handleEntityNotFound(_0x317aaa,null))['then'](saveUpdates(_0x8c5e48[_0xd126('0x45')],null))[_0xd126('0x16')](respondWithResult(_0x317aaa,null))[_0xd126('0x20')](handleError(_0x317aaa,null));};exports[_0xd126('0x46')]=function(_0x57cf27,_0x8bded){return db[_0xd126('0x2d')][_0xd126('0x44')]({'where':{'id':_0x57cf27[_0xd126('0x47')]['id']}})['then'](handleEntityNotFound(_0x8bded,null))[_0xd126('0x16')](removeEntity(_0x8bded,null))[_0xd126('0x20')](handleError(_0x8bded,null));};exports[_0xd126('0x48')]=function(_0xd63a77,_0x45c78d){return db[_0xd126('0x2d')]['describe']()[_0xd126('0x16')](respondWithResult(_0x45c78d,null))[_0xd126('0x20')](handleError(_0x45c78d,null));};exports[_0xd126('0x49')]=function(_0x3526c7,_0x115b4f){return db[_0xd126('0x2d')][_0xd126('0x49')](_0x3526c7[_0xd126('0x45')])[_0xd126('0x16')](function(_0x2fee48){if(_0x2fee48){if(_0x2fee48['direction']===_0xd126('0x4a')&&!_0x2fee48[_0xd126('0x4b')]){var _0x13e983,_0x5c2f0d,_0x1bbb65;if(_0x3526c7[_0xd126('0x45')]['to']){_0x5c2f0d=_0x3526c7[_0xd126('0x45')]['to']['split'](',')[0x0];}return db[_0xd126('0x4c')]['findOne']({'where':{'id':_0x2fee48[_0xd126('0x4d')]},'include':[{'model':db[_0xd126('0x4e')],'as':_0xd126('0x4f'),'include':[{'model':db[_0xd126('0x50')],'as':'Contacts','where':{'email':_0x5c2f0d},'limit':0x1,'order':[['updatedAt',_0xd126('0x51')]]}]},{'model':db[_0xd126('0x52')],'as':_0xd126('0x53'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xd126('0x54'),'raw':!![]}]}]})[_0xd126('0x16')](function(_0x466f70){_0x13e983=_0x466f70;if(!_0x13e983||!_0x13e983[_0xd126('0x53')])return;var _0x467489=_0x13e983['getSmtpOptions']();if(_0x3526c7[_0xd126('0x45')][_0xd126('0x55')]&&_0x3526c7['body'][_0xd126('0x55')][_0xd126('0x37')]){for(var _0x4d61e1=0x0;_0x4d61e1<_0x3526c7['body'][_0xd126('0x55')][_0xd126('0x37')];_0x4d61e1+=0x1){_0x3526c7[_0xd126('0x45')][_0xd126('0x55')][_0x4d61e1]={'filename':_0x3526c7['body'][_0xd126('0x55')][_0x4d61e1][_0xd126('0x2c')],'path':path[_0xd126('0x56')](config[_0xd126('0x57')],_0xd126('0x58'),_0x3526c7['body'][_0xd126('0x55')][_0x4d61e1][_0xd126('0x59')])};}}_0x1bbb65={'account':_0x467489,'message':_0x3526c7[_0xd126('0x45')]};return;})['then'](function(){if(_0x13e983[_0xd126('0x4f')]){if(_0x13e983[_0xd126('0x4f')][_0xd126('0x5a')][_0xd126('0x37')]){return _0x13e983[_0xd126('0x4f')][_0xd126('0x5a')][0x0];}else{return db['CmContact'][_0xd126('0x49')](_[_0xd126('0xd')](_0x3526c7[_0xd126('0x45')],{'firstName':_0x3526c7[_0xd126('0x45')]['to'],'email':_0x3526c7['body']['to'],'phone':_0x3526c7[_0xd126('0x45')]['to'],'ListId':_0x13e983['ListId']}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x1bbb65){return respondWithRpcPromise(_0xd126('0x5b'),_0xd126('0x5c'),_0x1bbb65,client9003)[_0xd126('0x16')](function(_0xc7f597){return _0x2fee48[_0xd126('0x29')]({'read':!![],'messageId':_0xc7f597[_0xd126('0x5d')],'sentAt':moment()[_0xd126('0x5e')](_0xd126('0x5f'))});})[_0xd126('0x20')](function(_0x45c2b7){logger[_0xd126('0x1b')]('%s',JSON[_0xd126('0x1a')](_0x45c2b7));return _0x2fee48;});}return _0x2fee48;});}return _0x2fee48;}})[_0xd126('0x16')](respondWithResult(_0x115b4f,0xc9))[_0xd126('0x20')](handleError(_0x115b4f,null));};exports['accept']=function(_0x4e3163,_0x3adc24){var _0x1dc793={'agent':{},'channel':_0xd126('0x60')};if(_0x4e3163[_0xd126('0x45')]['id']){delete _0x4e3163[_0xd126('0x45')]['id'];}_0x4e3163[_0xd126('0x45')][_0xd126('0x61')]=!![];_0x4e3163[_0xd126('0x45')][_0xd126('0x62')]=moment()[_0xd126('0x5e')](_0xd126('0x5f'));_0x4e3163['body'][_0xd126('0x63')]=_0x4e3163[_0xd126('0x45')][_0xd126('0x63')]||_0x4e3163[_0xd126('0x64')]['id'];_0x1dc793[_0xd126('0x65')]['id']=_0x4e3163[_0xd126('0x45')][_0xd126('0x63')];return db['MailMessage'][_0xd126('0x44')]({'where':{'id':_0x4e3163[_0xd126('0x47')]['id'],'UserId':null}})[_0xd126('0x16')](handleEntityNotFound(_0x3adc24,null))['then'](saveUpdates(_0x4e3163[_0xd126('0x45')],null))[_0xd126('0x16')](function(_0x41a149){if(_0x41a149){_0x1dc793['message']=_0x41a149['get']({'plain':!![]});return db[_0xd126('0x66')][_0xd126('0x44')]({'where':{'id':_0x41a149[_0xd126('0x67')]}});}return null;})[_0xd126('0x16')](handleEntityNotFound(_0x3adc24,null))['then'](function(_0xe67313){if(_0xe67313){return _0xe67313['update']({'UserId':_0x4e3163[_0xd126('0x45')]['UserId'],'read1stAt':_[_0xd126('0x68')](_0xe67313['read1stAt'])?moment()[_0xd126('0x5e')](_0xd126('0x5f')):undefined});}return null;})[_0xd126('0x16')](function(_0x5f1f49){if(_0x5f1f49){_0x1dc793['interaction']=_0x5f1f49[_0xd126('0x69')]({'plain':!![]});interaction_log[_0xd126('0x17')](_0xd126('0x6a'),_0x4e3163[_0xd126('0x64')]['id'],_0x4e3163[_0xd126('0x64')][_0xd126('0x2c')],_0x4e3163[_0xd126('0x64')]['role'],_0x1dc793[_0xd126('0x6b')]['id'],_0x4e3163['body']?JSON[_0xd126('0x1a')](_0x4e3163[_0xd126('0x45')]):_0xd126('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xd126('0x6d'),_0x1dc793);}return null;})[_0xd126('0x16')](function(_0x463ae6){var _0x5c01f0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x463ae6[_0xd126('0x1e')][_0xd126('0x6e')];return db[_0xd126('0x6f')][_0xd126('0x32')](_0x5c01f0,{'type':db[_0xd126('0x70')]['QueryTypes'][_0xd126('0x71')],'raw':!![]})[_0xd126('0x16')](function(_0x284d67){return _0x284d67;});})[_0xd126('0x16')](function(_0x52eea1){if(_0x52eea1){_0x1dc793[_0xd126('0x1e')][_0xd126('0x72')]=_0x52eea1[0x0];if(!_0x4e3163['body'][_0xd126('0x63')])return;return db[_0xd126('0x73')]['find']({'where':{'id':_0x4e3163[_0xd126('0x45')]['UserId'],'role':_0xd126('0x65')},'attributes':['id',_0xd126('0x2c'),'fullname','email',_0xd126('0x74')],'raw':!![]});}return null;})[_0xd126('0x16')](function(_0x581959){if(!_0x581959)return null;_0x1dc793[_0xd126('0x1e')]['agent']=_0x581959;return _0x1dc793;})['then'](function(_0x45604e){if(_0x45604e){if(_0x4e3163['body'][_0xd126('0x75')]){_0x1dc793[_0xd126('0x1e')][_0xd126('0x76')]=util[_0xd126('0x5e')](_0xd126('0x77'),_0x4e3163[_0xd126('0x64')][_0xd126('0x2c')]);_0x1dc793[_0xd126('0x1e')]['channel']=_0x1dc793[_0xd126('0x78')];_0x1dc793[_0xd126('0x1e')][_0xd126('0x79')]=_0x1dc793[_0xd126('0x78')];_0x1dc793[_0xd126('0x1e')][_0xd126('0x7a')]=_0xd126('0x7b');_0x1dc793[_0xd126('0x1e')][_0xd126('0x45')]=htmlToText[_0xd126('0x7c')](_0x1dc793[_0xd126('0x1e')]['body']);return respondWithRpcPromise(_0xd126('0x7d'),_0xd126('0x7d'),{'event':_0xd126('0x7e'),'message':_0x1dc793['message']},client9002)['then'](function(){return _0x1dc793;});}return _0x1dc793;}return null;})[_0xd126('0x16')](respondWithResult(_0x3adc24,null))['catch'](handleError(_0x3adc24,null));};exports[_0xd126('0x7f')]=function(_0xbbdc9c,_0x380429){var _0x22c2a8={'agent':{},'channel':_0xd126('0x60')};if(_0xbbdc9c['body']['id']){delete _0xbbdc9c['body']['id'];}_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')]=_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')]||_0xbbdc9c[_0xd126('0x64')]['id'];_0x22c2a8[_0xd126('0x65')]['id']=_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')];return db['MailMessage'][_0xd126('0x44')]({'where':{'id':_0xbbdc9c[_0xd126('0x47')]['id'],'UserId':null}})[_0xd126('0x16')](handleEntityNotFound(_0x380429,null))[_0xd126('0x16')](function(_0x1658fa){if(_0x1658fa){_0x22c2a8[_0xd126('0x1e')]=_0x1658fa['get']({'plain':!![]});return db['MailInteraction'][_0xd126('0x44')]({'where':{'id':_0x1658fa['MailInteractionId']}});}return null;})[_0xd126('0x16')](handleEntityNotFound(_0x380429,null))[_0xd126('0x16')](function(_0x266c0e){if(_0x266c0e){_0x22c2a8[_0xd126('0x6b')]=_0x266c0e[_0xd126('0x69')]({'plain':!![]});interaction_log[_0xd126('0x17')](_0xd126('0x80'),_0xbbdc9c[_0xd126('0x64')]['id'],_0xbbdc9c[_0xd126('0x64')][_0xd126('0x2c')],_0xbbdc9c[_0xd126('0x64')][_0xd126('0x81')],_0x22c2a8[_0xd126('0x6b')]['id'],_0xbbdc9c[_0xd126('0x45')]?JSON[_0xd126('0x1a')](_0xbbdc9c[_0xd126('0x45')]):_0xd126('0x6c'));return respondWithRpcPromise(_0xd126('0x82'),_0xd126('0x83'),_0x22c2a8);}return null;})[_0xd126('0x16')](function(_0x52ef81){var _0xd13485='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x52ef81['message'][_0xd126('0x6e')];return db['sequelize'][_0xd126('0x32')](_0xd13485,{'type':db[_0xd126('0x70')][_0xd126('0x84')]['SELECT'],'raw':!![]})['then'](function(_0x30c798){return _0x30c798;});})[_0xd126('0x16')](function(_0x2799dd){if(_0x2799dd){_0x22c2a8[_0xd126('0x1e')][_0xd126('0x72')]=_0x2799dd[0x0];if(!_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')])return;return db[_0xd126('0x73')][_0xd126('0x44')]({'where':{'id':_0xbbdc9c[_0xd126('0x45')][_0xd126('0x63')],'role':_0xd126('0x65')},'attributes':['id',_0xd126('0x2c'),'fullname',_0xd126('0x85'),_0xd126('0x74')],'raw':!![]});}return null;})['then'](function(_0x3590c9){if(!_0x3590c9)return null;_0x22c2a8[_0xd126('0x1e')]['agent']=_0x3590c9;return _0x22c2a8;})[_0xd126('0x16')](function(_0x5d6a08){if(_0x5d6a08){_0x5d6a08[_0xd126('0x1e')]['interface']=util[_0xd126('0x5e')](_0xd126('0x77'),_0xbbdc9c['user'][_0xd126('0x2c')]);_0x5d6a08['message'][_0xd126('0x78')]=_0x22c2a8['channel'];_0x5d6a08['message'][_0xd126('0x79')]=_0x22c2a8[_0xd126('0x78')];_0x5d6a08[_0xd126('0x1e')]['event']=_0xd126('0x7f');_0x5d6a08['message']['body']=htmlToText[_0xd126('0x7c')](_0x22c2a8['message']['body']);respondWithRpcPromise('EventManager','EventManager',{'event':_0xd126('0x86'),'message':_0x5d6a08['message']},client9002);return _0x22c2a8;}return null;})[_0xd126('0x16')](respondWithResult(_0x380429,null))['catch'](handleError(_0x380429,null));};exports[_0xd126('0x87')]=function(_0x2e918a,_0x515221){var _0x5e2ed7=moment()[_0xd126('0x88')]()['toString']();var _0x4445e7=path['join'](config[_0xd126('0x57')],'server',_0xd126('0x89'),_0xd126('0x8a'));var _0x35e8fa=path[_0xd126('0x56')](config[_0xd126('0x57')],_0xd126('0x8b'),_0xd126('0x89'),_0xd126('0x55'));var _0x457b6c=util[_0xd126('0x5e')](_0xd126('0x8c'),_0x5e2ed7);return db['MailMessage'][_0xd126('0x44')]({'where':{'id':_0x2e918a['params']['id']},'attributes':['id','body','from','to','cc',_0xd126('0x8d'),'subject','createdAt'],'include':_0x2e918a[_0xd126('0x32')][_0xd126('0x55')]?[{'model':db[_0xd126('0x8e')],'as':_0xd126('0x8f')}]:undefined})[_0xd126('0x16')](handleEntityNotFound(_0x515221,null))[_0xd126('0x16')](function(_0x4d98d0){if(_0x4d98d0){var _0x712314=_0x4d98d0;var _0x217a51={'from':_0x712314[_0xd126('0x90')],'to':_0x712314['to'],'subject':_0x712314[_0xd126('0x91')],'html':htmlEntities[_0xd126('0x92')](_0x712314['body']),'headers':{'Date':moment(_0x712314[_0xd126('0x93')])[_0xd126('0x5e')](_0xd126('0x94'))},'attachments':[]};if(_0x4d98d0['cc']){_0x217a51[_0xd126('0x95')]['Cc']=_0x4d98d0['cc'];}if(_0x4d98d0[_0xd126('0x8d')]){_0x217a51[_0xd126('0x95')][_0xd126('0x96')]=_0x4d98d0[_0xd126('0x8d')];}return new BPromise(function(_0x30d84b,_0x1bc558){if(_0x4d98d0['Attachments']){for(var _0x2c5f62=0x0;_0x2c5f62<_0x4d98d0[_0xd126('0x8f')][_0xd126('0x37')];_0x2c5f62++){var _0x52ed17=_0x4d98d0[_0xd126('0x8f')][_0x2c5f62];var _0x17f375=path['join'](_0x35e8fa,_0x52ed17[_0xd126('0x59')]);if(fs[_0xd126('0x97')](_0x17f375)){_0x217a51[_0xd126('0x55')][_0xd126('0x98')]({'name':_0x52ed17[_0xd126('0x2c')],'contentType':_0x52ed17[_0xd126('0x2e')],'data':fs[_0xd126('0x99')](_0x17f375)});}}}emlformat[_0xd126('0x9a')](_0x217a51,function(_0x3420a1,_0x3eff4b){if(_0x3420a1)return _0x1bc558(_0x3420a1);fs[_0xd126('0x9b')](path[_0xd126('0x56')](_0x4445e7,_0x457b6c),_0x3eff4b);return _0x30d84b(_0x3eff4b);});});}})[_0xd126('0x16')](function(_0x360485){if(_0x360485){return _0x515221[_0xd126('0x87')](path[_0xd126('0x56')](_0x4445e7,_0x457b6c),_0x457b6c,function(_0x4d4ab2){if(!_0x4d4ab2)fs[_0xd126('0x9c')](path[_0xd126('0x56')](_0x4445e7,_0x457b6c));});}})[_0xd126('0x20')](handleError(_0x515221,null));}; \ No newline at end of file +var _0x87d1=['../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','redis','localhost','html-entities','./mailMessage.socket','jayson/promise','client','http','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','offset','undefined','limit','count','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','then','includeAll','catch','show','include','body','find','params','describe','create','direction','secret','split','MailAccount','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','attachments','join','root','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteractionId','isNil','interaction','[MAILMESSAGE: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','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','SELECT','contact','fullname','SIP/%s','rejectmessage','unix','toString','server','files','message-%s.eml','subject','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis'];(function(_0x16f207,_0x4103bc){var _0x5e68c6=function(_0x171f68){while(--_0x171f68){_0x16f207['push'](_0x16f207['shift']());}};_0x5e68c6(++_0x4103bc);}(_0x87d1,0x95));var _0x187d=function(_0x4e8069,_0xed6894){_0x4e8069=_0x4e8069-0x0;var _0x55582c=_0x87d1[_0x4e8069];return _0x55582c;};'use strict';var emlformat=require(_0x187d('0x0'));var moment=require(_0x187d('0x1'));var BPromise=require(_0x187d('0x2'));var util=require(_0x187d('0x3'));var path=require(_0x187d('0x4'));var fs=require('fs');var _=require(_0x187d('0x5'));var Redis=require(_0x187d('0x6'));var htmlToText=require('html-to-text');var qs=require(_0x187d('0x7'));var logger=require(_0x187d('0x8'))('api');var interaction_log=require(_0x187d('0x8'))(_0x187d('0x9'));var config=require(_0x187d('0xa'));var db=require('../../mysqldb')['db'];config[_0x187d('0xb')]=_['defaults'](config[_0x187d('0xb')],{'host':_0x187d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x187d('0xb')]));var htmlEntities=require(_0x187d('0xd'));require(_0x187d('0xe'))['register'](socket);var jayson=require(_0x187d('0xf'));var client=jayson[_0x187d('0x10')][_0x187d('0x11')]({'port':0x232c});var client9003=jayson[_0x187d('0x10')][_0x187d('0x11')]({'port':0x232b});var client9002=jayson[_0x187d('0x10')][_0x187d('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2e7437,_0x2b6787,_0x143608,_0x5a868e){return new BPromise(function(_0x4da8d0,_0x23c7f3){var _0xada6a9=_0x5a868e||client;return _0xada6a9['request'](_0x2e7437,_0x143608)['then'](function(_0x5ae414){logger[_0x187d('0x12')]('MailMessage,\x20%s,\x20%s',_0x2b6787,_0x187d('0x13'));logger[_0x187d('0x14')](_0x187d('0x15'),_0x2b6787,'request\x20sent',JSON[_0x187d('0x16')](_0x5ae414));if(_0x5ae414[_0x187d('0x17')]){if(_0x5ae414[_0x187d('0x17')][_0x187d('0x18')]===0x1f4){logger['error'](_0x187d('0x19'),_0x2b6787,_0x5ae414['error'][_0x187d('0x1a')]);return _0x23c7f3(_0x5ae414[_0x187d('0x17')]['message']);}logger[_0x187d('0x17')](_0x187d('0x19'),_0x2b6787,_0x5ae414[_0x187d('0x17')][_0x187d('0x1a')]);return _0x4da8d0(_0x5ae414[_0x187d('0x17')]['message']);}else{logger[_0x187d('0x12')](_0x187d('0x19'),_0x2b6787,'request\x20sent');_0x4da8d0(_0x5ae414[_0x187d('0x1b')]['message']);}})['catch'](function(_0x41ac78){logger['error']('MailMessage,\x20%s,\x20%s',_0x2b6787,_0x41ac78);_0x23c7f3(_0x41ac78);});});}function respondWithResult(_0x2f1027,_0x57b75e){_0x57b75e=_0x57b75e||0xc8;return function(_0x16d451){if(_0x16d451){return _0x2f1027['status'](_0x57b75e)['json'](_0x16d451);}};}function respondWithFilteredResult(_0x720f4,_0x19c9ec){return function(_0x3df25e){if(_0x3df25e){var _0x3a8073=typeof _0x19c9ec[_0x187d('0x1c')]===_0x187d('0x1d')&&typeof _0x19c9ec[_0x187d('0x1e')]===_0x187d('0x1d');var _0x327829=_0x3df25e[_0x187d('0x1f')];var _0x5e7d34=_0x3a8073?0x0:_0x19c9ec[_0x187d('0x1c')];var _0x1162d1=_0x3a8073?_0x3df25e[_0x187d('0x1f')]:_0x19c9ec[_0x187d('0x1c')]+_0x19c9ec[_0x187d('0x1e')];var _0x82e5ef;if(_0x1162d1>=_0x327829){_0x1162d1=_0x327829;_0x82e5ef=0xc8;}else{_0x82e5ef=0xce;}_0x720f4[_0x187d('0x20')](_0x82e5ef);return _0x720f4[_0x187d('0x21')](_0x187d('0x22'),_0x5e7d34+'-'+_0x1162d1+'/'+_0x327829)['json'](_0x3df25e);}return null;};}function saveUpdates(_0x55807a){return function(_0xa8749c){if(_0xa8749c){return _0xa8749c[_0x187d('0x23')](_0x55807a)['then'](function(_0x5d84d1){return _0x5d84d1;});}return null;};}function removeEntity(_0x5ae536){return function(_0x4decd9){if(_0x4decd9){return _0x4decd9[_0x187d('0x24')]()['then'](function(){_0x5ae536[_0x187d('0x20')](0xcc)[_0x187d('0x25')]();});}};}function handleEntityNotFound(_0x4080fa){return function(_0x3aedd6){if(!_0x3aedd6){_0x4080fa[_0x187d('0x26')](0x194);}return _0x3aedd6;};}function handleError(_0x2115bb,_0xd35c8b){_0xd35c8b=_0xd35c8b||0x1f4;return function(_0x2cf94b){logger['error'](_0x2cf94b[_0x187d('0x27')]);if(_0x2cf94b[_0x187d('0x28')]){delete _0x2cf94b[_0x187d('0x28')];}_0x2115bb[_0x187d('0x20')](_0xd35c8b)['send'](_0x2cf94b);};}exports[_0x187d('0x29')]=function(_0x249f10,_0x46860a){var _0x239fcd={},_0x4b9b2f={},_0x286da2={'count':0x0,'rows':[]};var _0x1678d2=_[_0x187d('0x2a')](db[_0x187d('0x2b')][_0x187d('0x2c')],function(_0x17793c){return{'name':_0x17793c[_0x187d('0x2d')],'type':_0x17793c[_0x187d('0x2e')][_0x187d('0x2f')]};});_0x4b9b2f['model']=_[_0x187d('0x2a')](_0x1678d2,'name');_0x4b9b2f['query']=_[_0x187d('0x30')](_0x249f10[_0x187d('0x31')]);_0x4b9b2f[_0x187d('0x32')]=_[_0x187d('0x33')](_0x4b9b2f[_0x187d('0x34')],_0x4b9b2f[_0x187d('0x31')]);_0x239fcd[_0x187d('0x35')]=_[_0x187d('0x33')](_0x4b9b2f[_0x187d('0x34')],qs['fields'](_0x249f10[_0x187d('0x31')][_0x187d('0x36')]));_0x239fcd[_0x187d('0x35')]=_0x239fcd[_0x187d('0x35')][_0x187d('0x37')]?_0x239fcd[_0x187d('0x35')]:_0x4b9b2f[_0x187d('0x34')];if(!_0x249f10[_0x187d('0x31')]['hasOwnProperty'](_0x187d('0x38'))){_0x239fcd[_0x187d('0x1e')]=qs[_0x187d('0x1e')](_0x249f10[_0x187d('0x31')][_0x187d('0x1e')]);_0x239fcd[_0x187d('0x1c')]=qs['offset'](_0x249f10[_0x187d('0x31')][_0x187d('0x1c')]);}_0x239fcd[_0x187d('0x39')]=qs['sort'](_0x249f10[_0x187d('0x31')]['sort']);_0x239fcd[_0x187d('0x3a')]=qs[_0x187d('0x32')](_[_0x187d('0x3b')](_0x249f10[_0x187d('0x31')],_0x4b9b2f[_0x187d('0x32')]),_0x1678d2);if(_0x249f10['query'][_0x187d('0x3c')]){_0x239fcd['where']=_[_0x187d('0x3d')](_0x239fcd[_0x187d('0x3a')],{'$or':_[_0x187d('0x2a')](_0x1678d2,function(_0x284dd9){if(_0x284dd9['type']!=='VIRTUAL'){var _0x1c06fd={};_0x1c06fd[_0x284dd9[_0x187d('0x28')]]={'$like':'%'+_0x249f10[_0x187d('0x31')][_0x187d('0x3c')]+'%'};return _0x1c06fd;}})});}_0x239fcd=_['merge']({},_0x239fcd,_0x249f10[_0x187d('0x3e')]);var _0x1b0e44={'where':_0x239fcd[_0x187d('0x3a')]};return db[_0x187d('0x2b')][_0x187d('0x1f')](_0x1b0e44)[_0x187d('0x3f')](function(_0x16d685){_0x286da2[_0x187d('0x1f')]=_0x16d685;if(_0x249f10[_0x187d('0x31')][_0x187d('0x40')]){_0x239fcd['include']=[{'all':!![]}];}return db[_0x187d('0x2b')]['findAll'](_0x239fcd);})['then'](function(_0x31d159){_0x286da2['rows']=_0x31d159;return _0x286da2;})[_0x187d('0x3f')](respondWithFilteredResult(_0x46860a,_0x239fcd))[_0x187d('0x41')](handleError(_0x46860a,null));};exports[_0x187d('0x42')]=function(_0x17a97f,_0x56041e){var _0x450270={'raw':!![],'where':{'id':_0x17a97f['params']['id']}},_0x33dd91={};_0x33dd91[_0x187d('0x34')]=_[_0x187d('0x30')](db[_0x187d('0x2b')][_0x187d('0x2c')]);_0x33dd91[_0x187d('0x31')]=_[_0x187d('0x30')](_0x17a97f[_0x187d('0x31')]);_0x33dd91[_0x187d('0x32')]=_['intersection'](_0x33dd91[_0x187d('0x34')],_0x33dd91[_0x187d('0x31')]);_0x450270['attributes']=_[_0x187d('0x33')](_0x33dd91[_0x187d('0x34')],qs[_0x187d('0x36')](_0x17a97f['query'][_0x187d('0x36')]));_0x450270[_0x187d('0x35')]=_0x450270[_0x187d('0x35')][_0x187d('0x37')]?_0x450270[_0x187d('0x35')]:_0x33dd91['model'];if(_0x17a97f[_0x187d('0x31')][_0x187d('0x40')]){_0x450270[_0x187d('0x43')]=[{'all':!![]}];}_0x450270=_[_0x187d('0x3d')]({},_0x450270,_0x17a97f['options']);return db['MailMessage']['find'](_0x450270)[_0x187d('0x3f')](handleEntityNotFound(_0x56041e,null))[_0x187d('0x3f')](respondWithResult(_0x56041e,null))[_0x187d('0x41')](handleError(_0x56041e,null));};exports[_0x187d('0x23')]=function(_0x22f5cc,_0x39dbc8){if(_0x22f5cc[_0x187d('0x44')]['id']){delete _0x22f5cc[_0x187d('0x44')]['id'];}return db[_0x187d('0x2b')][_0x187d('0x45')]({'where':{'id':_0x22f5cc[_0x187d('0x46')]['id']}})[_0x187d('0x3f')](handleEntityNotFound(_0x39dbc8,null))[_0x187d('0x3f')](saveUpdates(_0x22f5cc[_0x187d('0x44')],null))['then'](respondWithResult(_0x39dbc8,null))[_0x187d('0x41')](handleError(_0x39dbc8,null));};exports['destroy']=function(_0x479b4e,_0x42791a){return db[_0x187d('0x2b')]['find']({'where':{'id':_0x479b4e[_0x187d('0x46')]['id']}})['then'](handleEntityNotFound(_0x42791a,null))[_0x187d('0x3f')](removeEntity(_0x42791a,null))[_0x187d('0x41')](handleError(_0x42791a,null));};exports[_0x187d('0x47')]=function(_0xef11e5,_0x1796b6){return db['MailMessage'][_0x187d('0x47')]()[_0x187d('0x3f')](respondWithResult(_0x1796b6,null))['catch'](handleError(_0x1796b6,null));};exports[_0x187d('0x48')]=function(_0x5b401b,_0x5ddfa6){return db[_0x187d('0x2b')][_0x187d('0x48')](_0x5b401b[_0x187d('0x44')])['then'](function(_0x1af469){if(_0x1af469){if(_0x1af469[_0x187d('0x49')]==='out'&&!_0x1af469[_0x187d('0x4a')]){var _0x41033d,_0x2ff5a4,_0x27c6cd;if(_0x5b401b[_0x187d('0x44')]['to']){_0x2ff5a4=_0x5b401b['body']['to'][_0x187d('0x4b')](',')[0x0];}return db[_0x187d('0x4c')]['findOne']({'where':{'id':_0x1af469['MailAccountId']},'include':[{'model':db[_0x187d('0x4d')],'as':_0x187d('0x4e'),'include':[{'model':db[_0x187d('0x4f')],'as':_0x187d('0x50'),'where':{'email':_0x2ff5a4},'limit':0x1,'order':[[_0x187d('0x51'),_0x187d('0x52')]]}]},{'model':db[_0x187d('0x53')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x187d('0x54')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x3fa44d){_0x41033d=_0x3fa44d;if(!_0x41033d||!_0x41033d['Smtp'])return;var _0x3ceb23=_0x41033d['getSmtpOptions']();if(_0x5b401b[_0x187d('0x44')][_0x187d('0x55')]&&_0x5b401b['body'][_0x187d('0x55')][_0x187d('0x37')]){for(var _0x7e8417=0x0;_0x7e8417<_0x5b401b[_0x187d('0x44')][_0x187d('0x55')]['length'];_0x7e8417+=0x1){_0x5b401b[_0x187d('0x44')][_0x187d('0x55')][_0x7e8417]={'filename':_0x5b401b[_0x187d('0x44')][_0x187d('0x55')][_0x7e8417][_0x187d('0x28')],'path':path[_0x187d('0x56')](config[_0x187d('0x57')],'server/files/attachments',_0x5b401b[_0x187d('0x44')][_0x187d('0x55')][_0x7e8417][_0x187d('0x58')])};}}_0x27c6cd={'account':_0x3ceb23,'message':_0x5b401b[_0x187d('0x44')]};return;})['then'](function(){if(_0x41033d[_0x187d('0x4e')]){if(_0x41033d[_0x187d('0x4e')]['Contacts'][_0x187d('0x37')]){return _0x41033d['List']['Contacts'][0x0];}else{return db[_0x187d('0x4f')][_0x187d('0x48')](_['defaults'](_0x5b401b[_0x187d('0x44')],{'firstName':_0x5b401b[_0x187d('0x44')]['to'],'email':_0x5b401b[_0x187d('0x44')]['to'],'phone':_0x5b401b[_0x187d('0x44')]['to'],'ListId':_0x41033d[_0x187d('0x59')]}));}}else{throw new Error(_0x187d('0x5a'));}})[_0x187d('0x3f')](function(){if(_0x27c6cd){return respondWithRpcPromise(_0x187d('0x5b'),_0x187d('0x5c'),_0x27c6cd,client9003)[_0x187d('0x3f')](function(_0x6c3c1f){return _0x1af469[_0x187d('0x23')]({'read':!![],'messageId':_0x6c3c1f['messageId'],'sentAt':moment()[_0x187d('0x5d')](_0x187d('0x5e'))});})[_0x187d('0x41')](function(_0x4ebfb2){logger[_0x187d('0x17')]('%s',JSON[_0x187d('0x16')](_0x4ebfb2));return _0x1af469;});}return _0x1af469;});}return _0x1af469;}})[_0x187d('0x3f')](respondWithResult(_0x5ddfa6,0xc9))[_0x187d('0x41')](handleError(_0x5ddfa6,null));};exports[_0x187d('0x5f')]=function(_0x165a20,_0x57cb90){var _0x3ebae5={'agent':{},'channel':_0x187d('0x60')};if(_0x165a20[_0x187d('0x44')]['id']){delete _0x165a20[_0x187d('0x44')]['id'];}_0x165a20[_0x187d('0x44')][_0x187d('0x61')]=!![];_0x165a20['body'][_0x187d('0x62')]=moment()[_0x187d('0x5d')](_0x187d('0x5e'));_0x165a20['body'][_0x187d('0x63')]=_0x165a20[_0x187d('0x44')][_0x187d('0x63')]||_0x165a20[_0x187d('0x64')]['id'];_0x3ebae5[_0x187d('0x65')]['id']=_0x165a20['body']['UserId'];return db[_0x187d('0x2b')]['find']({'where':{'id':_0x165a20[_0x187d('0x46')]['id'],'UserId':null}})[_0x187d('0x3f')](handleEntityNotFound(_0x57cb90,null))[_0x187d('0x3f')](saveUpdates(_0x165a20['body'],null))['then'](function(_0x21c421){if(_0x21c421){_0x3ebae5[_0x187d('0x1a')]=_0x21c421[_0x187d('0x66')]({'plain':!![]});return db['MailInteraction'][_0x187d('0x45')]({'where':{'id':_0x21c421[_0x187d('0x67')]}});}return null;})[_0x187d('0x3f')](handleEntityNotFound(_0x57cb90,null))[_0x187d('0x3f')](function(_0x1fe093){if(_0x1fe093){return _0x1fe093[_0x187d('0x23')]({'UserId':_0x165a20['body'][_0x187d('0x63')],'read1stAt':_[_0x187d('0x68')](_0x1fe093['read1stAt'])?moment()['format'](_0x187d('0x5e')):undefined});}return null;})['then'](function(_0x273a00){if(_0x273a00){_0x3ebae5[_0x187d('0x69')]=_0x273a00[_0x187d('0x66')]({'plain':!![]});interaction_log[_0x187d('0x12')](_0x187d('0x6a'),_0x165a20[_0x187d('0x64')]['id'],_0x165a20[_0x187d('0x64')][_0x187d('0x28')],_0x165a20[_0x187d('0x64')][_0x187d('0x6b')],_0x3ebae5[_0x187d('0x69')]['id'],_0x165a20[_0x187d('0x44')]?JSON[_0x187d('0x16')](_0x165a20[_0x187d('0x44')]):'null');return respondWithRpcPromise(_0x187d('0x6c'),_0x187d('0x6d'),_0x3ebae5);}return null;})['then'](function(_0xa5f950){var _0x2d4813=_0x187d('0x6e')+_0xa5f950[_0x187d('0x1a')][_0x187d('0x6f')];return db[_0x187d('0x70')]['query'](_0x2d4813,{'type':db[_0x187d('0x71')]['QueryTypes']['SELECT'],'raw':!![]})[_0x187d('0x3f')](function(_0x531561){return _0x531561;});})['then'](function(_0xd2d8e5){if(_0xd2d8e5){_0x3ebae5[_0x187d('0x1a')]['contact']=_0xd2d8e5[0x0];if(!_0x165a20[_0x187d('0x44')][_0x187d('0x63')])return;return db['User'][_0x187d('0x45')]({'where':{'id':_0x165a20[_0x187d('0x44')]['UserId'],'role':_0x187d('0x65')},'attributes':['id','name','fullname',_0x187d('0x72'),_0x187d('0x73')],'raw':!![]});}return null;})[_0x187d('0x3f')](function(_0x34a560){if(!_0x34a560)return null;_0x3ebae5[_0x187d('0x1a')][_0x187d('0x65')]=_0x34a560;return _0x3ebae5;})[_0x187d('0x3f')](function(_0x50dd8b){if(_0x50dd8b){if(_0x165a20[_0x187d('0x44')][_0x187d('0x74')]){_0x3ebae5[_0x187d('0x1a')][_0x187d('0x75')]=util[_0x187d('0x5d')]('SIP/%s',_0x165a20[_0x187d('0x64')]['name']);_0x3ebae5[_0x187d('0x1a')][_0x187d('0x76')]=_0x3ebae5[_0x187d('0x76')];_0x3ebae5['message'][_0x187d('0x77')]=_0x3ebae5['channel'];_0x3ebae5['message'][_0x187d('0x78')]=_0x187d('0x5f');_0x3ebae5[_0x187d('0x1a')][_0x187d('0x44')]=htmlToText['fromString'](_0x3ebae5[_0x187d('0x1a')][_0x187d('0x44')]);return respondWithRpcPromise(_0x187d('0x79'),_0x187d('0x79'),{'event':_0x187d('0x7a'),'message':_0x3ebae5[_0x187d('0x1a')]},client9002)['then'](function(){return _0x3ebae5;});}return _0x3ebae5;}return null;})['then'](respondWithResult(_0x57cb90,null))[_0x187d('0x41')](handleError(_0x57cb90,null));};exports[_0x187d('0x7b')]=function(_0x2f0ce2,_0x214d94){var _0x5a3871={'agent':{},'channel':'mail'};if(_0x2f0ce2['body']['id']){delete _0x2f0ce2[_0x187d('0x44')]['id'];}_0x2f0ce2['body'][_0x187d('0x63')]=_0x2f0ce2[_0x187d('0x44')]['UserId']||_0x2f0ce2[_0x187d('0x64')]['id'];_0x5a3871[_0x187d('0x65')]['id']=_0x2f0ce2[_0x187d('0x44')]['UserId'];return db[_0x187d('0x2b')]['find']({'where':{'id':_0x2f0ce2[_0x187d('0x46')]['id'],'UserId':null}})[_0x187d('0x3f')](handleEntityNotFound(_0x214d94,null))[_0x187d('0x3f')](function(_0xccedea){if(_0xccedea){_0x5a3871[_0x187d('0x1a')]=_0xccedea['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0xccedea[_0x187d('0x67')]}});}return null;})[_0x187d('0x3f')](handleEntityNotFound(_0x214d94,null))['then'](function(_0x2ad896){if(_0x2ad896){_0x5a3871[_0x187d('0x69')]=_0x2ad896[_0x187d('0x66')]({'plain':!![]});interaction_log[_0x187d('0x12')](_0x187d('0x7c'),_0x2f0ce2[_0x187d('0x64')]['id'],_0x2f0ce2['user'][_0x187d('0x28')],_0x2f0ce2[_0x187d('0x64')][_0x187d('0x6b')],_0x5a3871['interaction']['id'],_0x2f0ce2[_0x187d('0x44')]?JSON[_0x187d('0x16')](_0x2f0ce2[_0x187d('0x44')]):_0x187d('0x7d'));return respondWithRpcPromise(_0x187d('0x7e'),_0x187d('0x7f'),_0x5a3871);}return null;})[_0x187d('0x3f')](function(_0x36d2c3){var _0x3dd3cc=_0x187d('0x6e')+_0x36d2c3[_0x187d('0x1a')][_0x187d('0x6f')];return db[_0x187d('0x70')][_0x187d('0x31')](_0x3dd3cc,{'type':db['Sequelize'][_0x187d('0x80')][_0x187d('0x81')],'raw':!![]})[_0x187d('0x3f')](function(_0x9b7715){return _0x9b7715;});})[_0x187d('0x3f')](function(_0xc8eb01){if(_0xc8eb01){_0x5a3871[_0x187d('0x1a')][_0x187d('0x82')]=_0xc8eb01[0x0];if(!_0x2f0ce2[_0x187d('0x44')][_0x187d('0x63')])return;return db['User']['find']({'where':{'id':_0x2f0ce2[_0x187d('0x44')][_0x187d('0x63')],'role':_0x187d('0x65')},'attributes':['id',_0x187d('0x28'),_0x187d('0x83'),_0x187d('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0xbd0e36){if(!_0xbd0e36)return null;_0x5a3871[_0x187d('0x1a')][_0x187d('0x65')]=_0xbd0e36;return _0x5a3871;})[_0x187d('0x3f')](function(_0x1e3e94){if(_0x1e3e94){_0x1e3e94[_0x187d('0x1a')][_0x187d('0x75')]=util[_0x187d('0x5d')](_0x187d('0x84'),_0x2f0ce2[_0x187d('0x64')]['name']);_0x1e3e94[_0x187d('0x1a')][_0x187d('0x76')]=_0x5a3871[_0x187d('0x76')];_0x1e3e94['message'][_0x187d('0x77')]=_0x5a3871[_0x187d('0x76')];_0x1e3e94[_0x187d('0x1a')][_0x187d('0x78')]=_0x187d('0x7b');_0x1e3e94[_0x187d('0x1a')][_0x187d('0x44')]=htmlToText['fromString'](_0x5a3871[_0x187d('0x1a')][_0x187d('0x44')]);respondWithRpcPromise(_0x187d('0x79'),_0x187d('0x79'),{'event':_0x187d('0x85'),'message':_0x1e3e94[_0x187d('0x1a')]},client9002);return _0x5a3871;}return null;})[_0x187d('0x3f')](respondWithResult(_0x214d94,null))['catch'](handleError(_0x214d94,null));};exports['download']=function(_0x266245,_0x56d8e6){var _0x281e7d=moment()[_0x187d('0x86')]()[_0x187d('0x87')]();var _0xd68adb=path[_0x187d('0x56')](config[_0x187d('0x57')],_0x187d('0x88'),_0x187d('0x89'),'tmp');var _0x424fff=path[_0x187d('0x56')](config['root'],_0x187d('0x88'),'files',_0x187d('0x55'));var _0x5d91fb=util[_0x187d('0x5d')](_0x187d('0x8a'),_0x281e7d);return db['MailMessage'][_0x187d('0x45')]({'where':{'id':_0x266245['params']['id']},'attributes':['id',_0x187d('0x44'),'from','to','cc','bcc',_0x187d('0x8b'),_0x187d('0x8c')],'include':_0x266245[_0x187d('0x31')][_0x187d('0x55')]?[{'model':db[_0x187d('0x8d')],'as':_0x187d('0x8e')}]:undefined})[_0x187d('0x3f')](handleEntityNotFound(_0x56d8e6,null))[_0x187d('0x3f')](function(_0x55cf19){if(_0x55cf19){var _0x2c66f0=_0x55cf19;var _0x165e60={'from':_0x2c66f0[_0x187d('0x8f')],'to':_0x2c66f0['to'],'subject':_0x2c66f0[_0x187d('0x8b')],'html':htmlEntities[_0x187d('0x90')](_0x2c66f0[_0x187d('0x44')]),'headers':{'Date':moment(_0x2c66f0[_0x187d('0x8c')])['format'](_0x187d('0x91'))},'attachments':[]};if(_0x55cf19['cc']){_0x165e60[_0x187d('0x92')]['Cc']=_0x55cf19['cc'];}if(_0x55cf19[_0x187d('0x93')]){_0x165e60[_0x187d('0x92')][_0x187d('0x94')]=_0x55cf19[_0x187d('0x93')];}return new BPromise(function(_0x24c7ea,_0x39ebb5){if(_0x55cf19[_0x187d('0x8e')]){for(var _0x3299fa=0x0;_0x3299fa<_0x55cf19['Attachments'][_0x187d('0x37')];_0x3299fa++){var _0x2619d8=_0x55cf19['Attachments'][_0x3299fa];var _0x5841f1=path[_0x187d('0x56')](_0x424fff,_0x2619d8['basename']);if(fs[_0x187d('0x95')](_0x5841f1)){_0x165e60[_0x187d('0x55')][_0x187d('0x96')]({'name':_0x2619d8[_0x187d('0x28')],'contentType':_0x2619d8[_0x187d('0x2e')],'data':fs[_0x187d('0x97')](_0x5841f1)});}}}emlformat[_0x187d('0x98')](_0x165e60,function(_0x3e8bf3,_0x45a2d9){if(_0x3e8bf3)return _0x39ebb5(_0x3e8bf3);fs[_0x187d('0x99')](path[_0x187d('0x56')](_0xd68adb,_0x5d91fb),_0x45a2d9);return _0x24c7ea(_0x45a2d9);});});}})[_0x187d('0x3f')](function(_0x270e07){if(_0x270e07){return _0x56d8e6[_0x187d('0x9a')](path[_0x187d('0x56')](_0xd68adb,_0x5d91fb),_0x5d91fb,function(_0x3e1136){if(!_0x3e1136)fs[_0x187d('0x9b')](path[_0x187d('0x56')](_0xd68adb,_0x5d91fb));});}})[_0x187d('0x41')](handleError(_0x56d8e6,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3c24ea5..3c9467c 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 _0x43be=['emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','update','remove'];(function(_0x45e166,_0x30326a){var _0x9f835f=function(_0x28ffb4){while(--_0x28ffb4){_0x45e166['push'](_0x45e166['shift']());}};_0x9f835f(++_0x30326a);}(_0x43be,0x1ab));var _0xe43b=function(_0xc6379f,_0x5d0315){_0xc6379f=_0xc6379f-0x0;var _0x437fe8=_0x43be[_0xc6379f];return _0x437fe8;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe43b('0x0'))['db'][_0xe43b('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe43b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe43b('0x3'),'afterDestroy':_0xe43b('0x4')};function emitEvent(_0x233c1b){return function(_0x237980,_0x110636,_0x3f0757){MailMessageEvents[_0xe43b('0x5')](_0x233c1b+':'+_0x237980['id'],_0x237980);MailMessageEvents['emit'](_0x233c1b,_0x237980);_0x3f0757(null);};}for(var e in events){if(events[_0xe43b('0x6')](e)){var event=events[e];MailMessage[_0xe43b('0x7')](e,emitEvent(event));}}module[_0xe43b('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xe7e2=['events','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5363f0,_0x125a7e){var _0x52e283=function(_0x26e7d5){while(--_0x26e7d5){_0x5363f0['push'](_0x5363f0['shift']());}};_0x52e283(++_0x125a7e);}(_0xe7e2,0x118));var _0x2e7e=function(_0x588612,_0x2d0a1a){_0x588612=_0x588612-0x0;var _0xa8ff4f=_0xe7e2[_0x588612];return _0xa8ff4f;};'use strict';var EventEmitter=require(_0x2e7e('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x2e7e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2e7e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2e7e('0x3'),'afterDestroy':_0x2e7e('0x4')};function emitEvent(_0x1a6979){return function(_0x7210e,_0x23d64f,_0x253923){MailMessageEvents[_0x2e7e('0x5')](_0x1a6979+':'+_0x7210e['id'],_0x7210e);MailMessageEvents[_0x2e7e('0x5')](_0x1a6979,_0x7210e);_0x253923(null);};}for(var e in events){if(events[_0x2e7e('0x6')](e)){var event=events[e];MailMessage[_0x2e7e('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 3729d41..372d6d5 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 _0x84ef=['lodash','util','moment','request-promise','path','../../config/environment','exports','MailMessage','mail_messages','messageId','plainBody','subject','body','fromString','get','direction','toLowerCase','out','isNil','UserId','findOne','then','update','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x43bf25,_0x135bc9){var _0x288eba=function(_0x4eaff4){while(--_0x4eaff4){_0x43bf25['push'](_0x43bf25['shift']());}};_0x288eba(++_0x135bc9);}(_0x84ef,0x1ee));var _0xf84e=function(_0x33bc43,_0x5ae789){_0x33bc43=_0x33bc43-0x0;var _0x2465d1=_0x84ef[_0x33bc43];return _0x2465d1;};'use strict';var _=require(_0xf84e('0x0'));var util=require(_0xf84e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf84e('0x2'));var BPromise=require('bluebird');var rp=require(_0xf84e('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xf84e('0x4'));var rimraf=require('rimraf');var config=require(_0xf84e('0x5'));var attributes=require('./mailMessage.attributes');module[_0xf84e('0x6')]=function(_0x5161ba,_0x18f418){return _0x5161ba['define'](_0xf84e('0x7'),attributes,{'tableName':_0xf84e('0x8'),'paranoid':![],'indexes':[{'name':_0xf84e('0x9'),'fields':[_0xf84e('0x9')]},{'name':'fti_mail_messages','fields':[_0xf84e('0xa'),_0xf84e('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3011b5,_0x5812ce,_0x1ece57){if(_0x3011b5[_0xf84e('0xc')]){_0x3011b5[_0xf84e('0xa')]=htmlToText[_0xf84e('0xd')](_0x3011b5[_0xf84e('0xc')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1ece57(null,_0x5812ce);},'afterCreate':function(_0x2ddeb9,_0x34a823,_0x26a7fc){var _0xa9da1a=_0x5161ba['models'];var _0x23cd13=_0x2ddeb9[_0xf84e('0xe')]({'plain':!![]});if(_0x23cd13[_0xf84e('0xf')]['toLowerCase']()==='in'||_0x23cd13[_0xf84e('0xf')][_0xf84e('0x10')]()===_0xf84e('0x11')&&!_0x23cd13['secret']&&!_[_0xf84e('0x12')](_0x23cd13[_0xf84e('0x13')])){_0xa9da1a['MailInteraction'][_0xf84e('0x14')]({'where':{'id':_0x23cd13['MailInteractionId']}})[_0xf84e('0x15')](function(_0x5f0a0f){if(_0x5f0a0f){_0x5f0a0f[_0xf84e('0x16')]({'lastMsgAt':_0x23cd13['createdAt'],'lastMsgDirection':_0x23cd13[_0xf84e('0xf')]['toLowerCase']()});}})[_0xf84e('0x17')](function(_0x4de363){console['error'](_0x4de363);});}_0x26a7fc();}},'charset':_0xf84e('0x18'),'collate':_0xf84e('0x19')});}; \ No newline at end of file +var _0xceea=['api','moment','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger'];(function(_0x4a4947,_0x98abdb){var _0x10f182=function(_0x5c1b4a){while(--_0x5c1b4a){_0x4a4947['push'](_0x4a4947['shift']());}};_0x10f182(++_0x98abdb);}(_0xceea,0xdd));var _0xacee=function(_0x6fb7ec,_0x2cc36f){_0x6fb7ec=_0x6fb7ec-0x0;var _0x243017=_0xceea[_0x6fb7ec];return _0x243017;};'use strict';var _=require(_0xacee('0x0'));var util=require(_0xacee('0x1'));var logger=require(_0xacee('0x2'))(_0xacee('0x3'));var moment=require(_0xacee('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xacee('0x5'));var config=require(_0xacee('0x6'));var attributes=require(_0xacee('0x7'));module[_0xacee('0x8')]=function(_0x25f570,_0x200d11){return _0x25f570[_0xacee('0x9')](_0xacee('0xa'),attributes,{'tableName':_0xacee('0xb'),'paranoid':![],'indexes':[{'name':_0xacee('0xc'),'fields':[_0xacee('0xc')]},{'name':_0xacee('0xd'),'fields':['plainBody',_0xacee('0xe')],'type':_0xacee('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x485cbd,_0x11b560,_0x536126){if(_0x485cbd['body']){_0x485cbd[_0xacee('0x10')]=htmlToText['fromString'](_0x485cbd['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x536126(null,_0x11b560);},'afterCreate':function(_0x5bc4e8,_0x397057,_0x173546){var _0x2caa3d=_0x25f570[_0xacee('0x11')];var _0x2f0c1f=_0x5bc4e8[_0xacee('0x12')]({'plain':!![]});if(_0x2f0c1f[_0xacee('0x13')][_0xacee('0x14')]()==='in'||_0x2f0c1f[_0xacee('0x13')][_0xacee('0x14')]()==='out'&&!_0x2f0c1f[_0xacee('0x15')]&&!_[_0xacee('0x16')](_0x2f0c1f[_0xacee('0x17')])){_0x2caa3d['MailInteraction'][_0xacee('0x18')]({'where':{'id':_0x2f0c1f[_0xacee('0x19')]}})[_0xacee('0x1a')](function(_0xd772b8){if(_0xd772b8){_0xd772b8[_0xacee('0x1b')]({'lastMsgAt':_0x2f0c1f[_0xacee('0x1c')],'lastMsgDirection':_0x2f0c1f[_0xacee('0x13')][_0xacee('0x14')]()});}})[_0xacee('0x1d')](function(_0x5b4163){console[_0xacee('0x1e')](_0x5b4163);});}_0x173546();}},'charset':_0xacee('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c6cfd85..7341420 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 _0x7916=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','./mailMessage.socket','register'];(function(_0x27bfe3,_0x4061d7){var _0x51f9e3=function(_0x3b8137){while(--_0x3b8137){_0x27bfe3['push'](_0x27bfe3['shift']());}};_0x51f9e3(++_0x4061d7);}(_0x7916,0x128));var _0x6791=function(_0x357766,_0x1ade36){_0x357766=_0x357766-0x0;var _0xe28a73=_0x7916[_0x357766];return _0xe28a73;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});config['redis']=_[_0x6791('0xa')](config['redis'],{'host':_0x6791('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6791('0xc'))[_0x6791('0xd')](socket);function respondWithRpcPromise(_0x579950,_0xbc3bc6,_0x2769a4){return new BPromise(function(_0x2aeae9,_0x495d9c){return client[_0x6791('0xe')](_0x579950,_0x2769a4)[_0x6791('0xf')](function(_0x2025dd){logger[_0x6791('0x10')](_0x6791('0x11'),_0xbc3bc6,_0x6791('0x12'));logger[_0x6791('0x13')](_0x6791('0x14'),_0xbc3bc6,_0x6791('0x12'),JSON[_0x6791('0x15')](_0x2025dd));if(_0x2025dd[_0x6791('0x16')]){if(_0x2025dd['error']['code']===0x1f4){logger[_0x6791('0x16')]('MailMessage,\x20%s,\x20%s',_0xbc3bc6,_0x2025dd[_0x6791('0x16')]['message']);return _0x495d9c(_0x2025dd[_0x6791('0x16')][_0x6791('0x17')]);}logger['error'](_0x6791('0x11'),_0xbc3bc6,_0x2025dd['error'][_0x6791('0x17')]);return _0x2aeae9(_0x2025dd[_0x6791('0x16')]['message']);}else{logger[_0x6791('0x10')](_0x6791('0x11'),_0xbc3bc6,'request\x20sent');_0x2aeae9(_0x2025dd[_0x6791('0x18')]['message']);}})[_0x6791('0x19')](function(_0x126451){logger[_0x6791('0x16')](_0x6791('0x11'),_0xbc3bc6,_0x126451);_0x495d9c(_0x126451);});});}exports[_0x6791('0x1a')]=function(_0x2bc0ab){var _0x2ba11a=this;return new Promise(function(_0x581d51,_0x4a2922){return db[_0x6791('0x1b')]['create'](_0x2bc0ab[_0x6791('0x1c')],{'raw':_0x2bc0ab[_0x6791('0x1d')]?_0x2bc0ab['options'][_0x6791('0x1e')]===undefined?!![]:![]:!![]})[_0x6791('0xf')](function(_0x15b9ab){logger[_0x6791('0x10')]('CreateMailMessage',_0x2bc0ab);logger[_0x6791('0x13')](_0x6791('0x1a'),_0x2bc0ab,JSON['stringify'](_0x15b9ab));_0x581d51(_0x15b9ab);})['catch'](function(_0x4b23bc){logger[_0x6791('0x16')]('CreateMailMessage',_0x4b23bc[_0x6791('0x17')],_0x2bc0ab);_0x4a2922(_0x2ba11a['error'](0x1f4,_0x4b23bc['message']));});});}; \ No newline at end of file +var _0x63a5=['error','message','result','catch','body','options','raw','CreateMailMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x353352,_0x39fd67){var _0x30be20=function(_0x22e53c){while(--_0x22e53c){_0x353352['push'](_0x353352['shift']());}};_0x30be20(++_0x39fd67);}(_0x63a5,0x18e));var _0x563a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x63a5[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});config[_0x563a('0x9')]=_[_0x563a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x563a('0xb'))(new Redis(config[_0x563a('0x9')]));require(_0x563a('0xc'))[_0x563a('0xd')](socket);function respondWithRpcPromise(_0x255922,_0xa61ffa,_0xd1b480){return new BPromise(function(_0x381fab,_0x3e97a8){return client[_0x563a('0xe')](_0x255922,_0xd1b480)[_0x563a('0xf')](function(_0x2361dd){logger[_0x563a('0x10')](_0x563a('0x11'),_0xa61ffa,'request\x20sent');logger[_0x563a('0x12')](_0x563a('0x13'),_0xa61ffa,_0x563a('0x14'),JSON[_0x563a('0x15')](_0x2361dd));if(_0x2361dd[_0x563a('0x16')]){if(_0x2361dd[_0x563a('0x16')]['code']===0x1f4){logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);return _0x3e97a8(_0x2361dd['error']['message']);}logger[_0x563a('0x16')](_0x563a('0x11'),_0xa61ffa,_0x2361dd['error'][_0x563a('0x17')]);return _0x381fab(_0x2361dd[_0x563a('0x16')][_0x563a('0x17')]);}else{logger[_0x563a('0x10')]('MailMessage,\x20%s,\x20%s',_0xa61ffa,'request\x20sent');_0x381fab(_0x2361dd[_0x563a('0x18')][_0x563a('0x17')]);}})[_0x563a('0x19')](function(_0x526a51){logger['error']('MailMessage,\x20%s,\x20%s',_0xa61ffa,_0x526a51);_0x3e97a8(_0x526a51);});});}exports['CreateMailMessage']=function(_0x40916a){var _0x300956=this;return new Promise(function(_0x26061f,_0x43b7a8){return db['MailMessage']['create'](_0x40916a[_0x563a('0x1a')],{'raw':_0x40916a[_0x563a('0x1b')]?_0x40916a[_0x563a('0x1b')][_0x563a('0x1c')]===undefined?!![]:![]:!![]})[_0x563a('0xf')](function(_0x2dc7e2){logger[_0x563a('0x10')](_0x563a('0x1d'),_0x40916a);logger['debug'](_0x563a('0x1d'),_0x40916a,JSON['stringify'](_0x2dc7e2));_0x26061f(_0x2dc7e2);})[_0x563a('0x19')](function(_0xd3e0ae){logger[_0x563a('0x16')](_0x563a('0x1d'),_0xd3e0ae[_0x563a('0x17')],_0x40916a);_0x43b7a8(_0x300956[_0x563a('0x16')](0x1f4,_0xd3e0ae[_0x563a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ddb8a8a..f4b8669 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 _0xb37d=['mailMessage:','./mailMessage.events','save','remove','update','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb37d,0xbe));var _0xdb37=function(_0x4d7a04,_0x24c179){_0x4d7a04=_0x4d7a04-0x0;var _0x4eebbc=_0xb37d[_0x4d7a04];return _0x4eebbc;};'use strict';var MailMessageEvents=require(_0xdb37('0x0'));var events=[_0xdb37('0x1'),_0xdb37('0x2'),_0xdb37('0x3')];function createListener(_0x50de3b,_0x225ae3){return function(_0x48ff4f){_0x225ae3['emit'](_0x50de3b,_0x48ff4f);};}function removeListener(_0x44dc08,_0x508735){return function(){MailMessageEvents[_0xdb37('0x4')](_0x44dc08,_0x508735);};}exports[_0xdb37('0x5')]=function(_0x1fb485){for(var _0x539a5c=0x0,_0x96ed40=events['length'];_0x539a5c<_0x96ed40;_0x539a5c++){var _0x3e7839=events[_0x539a5c];var _0x63cba0=createListener(_0xdb37('0x6')+_0x3e7839,_0x1fb485);MailMessageEvents['on'](_0x3e7839,_0x63cba0);}}; \ No newline at end of file +var _0xe3a6=['mailMessage:','./mailMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x4c10f6,_0x2561d7){var _0x43651c=function(_0x1e6edf){while(--_0x1e6edf){_0x4c10f6['push'](_0x4c10f6['shift']());}};_0x43651c(++_0x2561d7);}(_0xe3a6,0x79));var _0x6e3a=function(_0xa86249,_0x4bc3c2){_0xa86249=_0xa86249-0x0;var _0x1ad08c=_0xe3a6[_0xa86249];return _0x1ad08c;};'use strict';var MailMessageEvents=require(_0x6e3a('0x0'));var events=['save',_0x6e3a('0x1'),_0x6e3a('0x2')];function createListener(_0x1d7fec,_0x4693da){return function(_0x291fcb){_0x4693da[_0x6e3a('0x3')](_0x1d7fec,_0x291fcb);};}function removeListener(_0x56a12a,_0x593749){return function(){MailMessageEvents[_0x6e3a('0x4')](_0x56a12a,_0x593749);};}exports[_0x6e3a('0x5')]=function(_0x4d7407){for(var _0x1c7840=0x0,_0x38f47a=events[_0x6e3a('0x6')];_0x1c7840<_0x38f47a;_0x1c7840++){var _0x4c945a=events[_0x1c7840];var _0x4cbd28=createListener(_0x6e3a('0x7')+_0x4c945a,_0x4d7407);MailMessageEvents['on'](_0x4c945a,_0x4cbd28);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 8ef9709..db2266b 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 _0x4fe6=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','util','path','connect-timeout'];(function(_0x2efb31,_0x2c0882){var _0x893d76=function(_0x45e5a8){while(--_0x45e5a8){_0x2efb31['push'](_0x2efb31['shift']());}};_0x893d76(++_0x2c0882);}(_0x4fe6,0xd6));var _0x64fe=function(_0x4c0e72,_0x12b5fe){_0x4c0e72=_0x4c0e72-0x0;var _0x2281a2=_0x4fe6[_0x4c0e72];return _0x2281a2;};'use strict';var multer=require('multer');var util=require(_0x64fe('0x0'));var path=require(_0x64fe('0x1'));var timeout=require(_0x64fe('0x2'));var express=require(_0x64fe('0x3'));var router=express[_0x64fe('0x4')]();var fs_extra=require(_0x64fe('0x5'));var auth=require(_0x64fe('0x6'));var interaction=require(_0x64fe('0x7'));var config=require(_0x64fe('0x8'));var controller=require(_0x64fe('0x9'));router[_0x64fe('0xa')]('/',auth['isAuthenticated'](),controller[_0x64fe('0xb')]);router[_0x64fe('0xa')]('/describe',auth[_0x64fe('0xc')](),controller[_0x64fe('0xd')]);router[_0x64fe('0xa')](_0x64fe('0xe'),auth[_0x64fe('0xc')](),controller[_0x64fe('0xf')]);router['get'](_0x64fe('0x10'),auth[_0x64fe('0xc')](),controller[_0x64fe('0x11')]);router[_0x64fe('0xa')](_0x64fe('0x12'),auth[_0x64fe('0xc')](),controller['getTeams']);router[_0x64fe('0xa')](_0x64fe('0x13'),auth['isAuthenticated'](),controller[_0x64fe('0x14')]);router[_0x64fe('0x15')]('/',auth[_0x64fe('0xc')](),controller[_0x64fe('0x16')]);router[_0x64fe('0x15')]('/:id/teams',auth[_0x64fe('0xc')](),controller[_0x64fe('0x17')]);router[_0x64fe('0x15')](_0x64fe('0x13'),auth[_0x64fe('0xc')](),controller[_0x64fe('0x18')]);router[_0x64fe('0x19')]('/:id',auth[_0x64fe('0xc')](),controller[_0x64fe('0x1a')]);router[_0x64fe('0x1b')](_0x64fe('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x64fe('0x1b')]('/:id/teams',auth[_0x64fe('0xc')](),controller[_0x64fe('0x1c')]);router[_0x64fe('0x1b')]('/:id/users',auth[_0x64fe('0xc')](),controller[_0x64fe('0x1d')]);module[_0x64fe('0x1e')]=router; \ No newline at end of file +var _0x21f1=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','index','/:id','isAuthenticated','show','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x21f1,0x1d2));var _0x121f=function(_0x16db8c,_0x5f40bb){_0x16db8c=_0x16db8c-0x0;var _0x2943b5=_0x21f1[_0x16db8c];return _0x2943b5;};'use strict';var multer=require('multer');var util=require(_0x121f('0x0'));var path=require(_0x121f('0x1'));var timeout=require(_0x121f('0x2'));var express=require('express');var router=express[_0x121f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x121f('0x4'));var interaction=require(_0x121f('0x5'));var config=require('../../config/environment');var controller=require(_0x121f('0x6'));router[_0x121f('0x7')]('/',auth['isAuthenticated'](),controller[_0x121f('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x121f('0x7')](_0x121f('0x9'),auth[_0x121f('0xa')](),controller[_0x121f('0xb')]);router['get']('/:id/members',auth[_0x121f('0xa')](),controller[_0x121f('0xc')]);router[_0x121f('0x7')](_0x121f('0xd'),auth[_0x121f('0xa')](),controller[_0x121f('0xe')]);router['get'](_0x121f('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x121f('0x10')]('/',auth[_0x121f('0xa')](),controller['create']);router[_0x121f('0x10')](_0x121f('0xd'),auth[_0x121f('0xa')](),controller[_0x121f('0x11')]);router[_0x121f('0x10')](_0x121f('0xf'),auth[_0x121f('0xa')](),controller[_0x121f('0x12')]);router[_0x121f('0x13')](_0x121f('0x9'),auth[_0x121f('0xa')](),controller[_0x121f('0x14')]);router[_0x121f('0x15')](_0x121f('0x9'),auth[_0x121f('0xa')](),controller[_0x121f('0x16')]);router[_0x121f('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x121f('0x17')]);router[_0x121f('0x15')](_0x121f('0xf'),auth[_0x121f('0xa')](),controller[_0x121f('0x18')]);module[_0x121f('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 01d4a8f..6d93ce1 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 _0xe729=['rrmemory','beepall','sequelize','exports','STRING','ENUM'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0xe729,0xe0));var _0x9e72=function(_0x138551,_0x1f5cdd){_0x138551=_0x138551-0x0;var _0x5ec63d=_0xe729[_0x138551];return _0x5ec63d;};'use strict';var Sequelize=require(_0x9e72('0x0'));module[_0x9e72('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e72('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9e72('0x3')](_0x9e72('0x4'),_0x9e72('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x56ea=['beepall','sequelize','exports','ENUM','rrmemory'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x56ea,0xc9));var _0xa56e=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x56ea[_0x35f7f5];return _0x5567a4;};'use strict';var Sequelize=require(_0xa56e('0x0'));module[_0xa56e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa56e('0x2')](_0xa56e('0x3'),_0xa56e('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 413c086..40cd2f2 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 _0xdf71=['each','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','ids','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','MailQueues','UserProfileResource','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','query','keys','model','attributes','hasOwnProperty','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','intersection','fields','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','get','UserMailQueue','order','MailQueueId','User','mailPause','createdAt','format','SIP','updatedAt','getTeams','Team','nolimit','addTeams','Agents','voicePause','flatMap','sequelize','transaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf71,0x1d2));var _0x1df7=function(_0x31edbe,_0x34d231){_0x31edbe=_0x31edbe-0x0;var _0x37fcee=_0xdf71[_0x31edbe];return _0x37fcee;};'use strict';var emlformat=require(_0x1df7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1df7('0x1'));var jsonpatch=require(_0x1df7('0x2'));var rp=require(_0x1df7('0x3'));var moment=require(_0x1df7('0x4'));var BPromise=require(_0x1df7('0x5'));var Mustache=require(_0x1df7('0x6'));var util=require(_0x1df7('0x7'));var path=require('path');var sox=require(_0x1df7('0x8'));var csv=require(_0x1df7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1df7('0xa'));var squel=require(_0x1df7('0xb'));var crypto=require('crypto');var jsforce=require(_0x1df7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1df7('0x9'));var querystring=require(_0x1df7('0xd'));var Papa=require(_0x1df7('0xe'));var Redis=require(_0x1df7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1df7('0x10'));var as=require(_0x1df7('0x11'));var hardwareService=require(_0x1df7('0x12'));var logger=require(_0x1df7('0x13'))(_0x1df7('0x14'));var utils=require(_0x1df7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1df7('0x16'));var db=require('../../mysqldb')['db'];config[_0x1df7('0x17')]=_[_0x1df7('0x18')](config[_0x1df7('0x17')],{'host':_0x1df7('0x19'),'port':0x18eb});var socket=require(_0x1df7('0x1a'))(new Redis(config['redis']));require(_0x1df7('0x1b'))[_0x1df7('0x1c')](socket);function respondWithStatusCode(_0xff1e2d,_0x57f931){_0x57f931=_0x57f931||0xcc;return function(_0x5b21f5){if(_0x5b21f5){return _0xff1e2d[_0x1df7('0x1d')](_0x57f931);}return _0xff1e2d['status'](_0x57f931)[_0x1df7('0x1e')]();};}function respondWithResult(_0x543af6,_0x191046){_0x191046=_0x191046||0xc8;return function(_0x3ef3b5){if(_0x3ef3b5){return _0x543af6[_0x1df7('0x1f')](_0x191046)[_0x1df7('0x20')](_0x3ef3b5);}};}function respondWithFilteredResult(_0x308522,_0x4ed830){return function(_0x3a3428){if(_0x3a3428){var _0x3535d6=typeof _0x4ed830[_0x1df7('0x21')]===_0x1df7('0x22')&&typeof _0x4ed830[_0x1df7('0x23')]===_0x1df7('0x22');var _0x5cc02f=_0x3a3428['count'];var _0x290abe=_0x3535d6?0x0:_0x4ed830[_0x1df7('0x21')];var _0x195ec2=_0x3535d6?_0x3a3428[_0x1df7('0x24')]:_0x4ed830[_0x1df7('0x21')]+_0x4ed830[_0x1df7('0x23')];var _0x56c6ce;if(_0x195ec2>=_0x5cc02f){_0x195ec2=_0x5cc02f;_0x56c6ce=0xc8;}else{_0x56c6ce=0xce;}_0x308522[_0x1df7('0x1f')](_0x56c6ce);return _0x308522[_0x1df7('0x25')](_0x1df7('0x26'),_0x290abe+'-'+_0x195ec2+'/'+_0x5cc02f)[_0x1df7('0x20')](_0x3a3428);}return null;};}function patchUpdates(_0x3b4fc2){return function(_0x2d06f4){try{jsonpatch['apply'](_0x2d06f4,_0x3b4fc2,!![]);}catch(_0x5c48ae){return BPromise[_0x1df7('0x27')](_0x5c48ae);}return _0x2d06f4[_0x1df7('0x28')]();};}function saveUpdates(_0x46b80e,_0x104952){return function(_0x1d3618){if(_0x1d3618){return _0x1d3618[_0x1df7('0x29')](_0x46b80e)['then'](function(_0x63cbb8){return _0x63cbb8;});}return null;};}function removeEntity(_0x254901,_0x15874f){return function(_0x25b739){if(_0x25b739){return _0x25b739[_0x1df7('0x2a')]()[_0x1df7('0x2b')](function(){var _0xce818f=_0x25b739['get']({'plain':!![]});var _0x3fda08=_0x1df7('0x2c');return db[_0x1df7('0x2d')][_0x1df7('0x2a')]({'where':{'type':_0x3fda08,'resourceId':_0xce818f['id']}})[_0x1df7('0x2b')](function(){return _0x25b739;});})[_0x1df7('0x2b')](function(){_0x254901['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3130cf,_0x595cbb){return function(_0x343452){if(!_0x343452){_0x3130cf[_0x1df7('0x1d')](0x194);}return _0x343452;};}function handleError(_0x22d567,_0x4ba0da){_0x4ba0da=_0x4ba0da||0x1f4;return function(_0x14009a){logger['error'](_0x14009a[_0x1df7('0x2e')]);if(_0x14009a[_0x1df7('0x2f')]){delete _0x14009a['name'];}_0x22d567[_0x1df7('0x1f')](_0x4ba0da)['send'](_0x14009a);};}exports[_0x1df7('0x30')]=function(_0x4965fa,_0x319304){var _0x665592={},_0x308873={},_0x1d1c19={'count':0x0,'rows':[]};var _0x53112d=_[_0x1df7('0x31')](db[_0x1df7('0x32')][_0x1df7('0x33')],function(_0x27c9f8){return{'name':_0x27c9f8[_0x1df7('0x34')],'type':_0x27c9f8['type'][_0x1df7('0x35')]};});_0x308873['model']=_['map'](_0x53112d,_0x1df7('0x2f'));_0x308873[_0x1df7('0x36')]=_[_0x1df7('0x37')](_0x4965fa[_0x1df7('0x36')]);_0x308873['filters']=_['intersection'](_0x308873[_0x1df7('0x38')],_0x308873[_0x1df7('0x36')]);_0x665592['attributes']=_['intersection'](_0x308873[_0x1df7('0x38')],qs['fields'](_0x4965fa[_0x1df7('0x36')]['fields']));_0x665592[_0x1df7('0x39')]=_0x665592[_0x1df7('0x39')]['length']?_0x665592[_0x1df7('0x39')]:_0x308873[_0x1df7('0x38')];if(!_0x4965fa[_0x1df7('0x36')][_0x1df7('0x3a')]('nolimit')){_0x665592[_0x1df7('0x23')]=qs['limit'](_0x4965fa['query']['limit']);_0x665592[_0x1df7('0x21')]=qs['offset'](_0x4965fa[_0x1df7('0x36')][_0x1df7('0x21')]);}_0x665592['order']=qs[_0x1df7('0x3b')](_0x4965fa['query'][_0x1df7('0x3b')]);_0x665592[_0x1df7('0x3c')]=qs[_0x1df7('0x3d')](_[_0x1df7('0x3e')](_0x4965fa[_0x1df7('0x36')],_0x308873['filters']),_0x53112d);if(_0x4965fa['query'][_0x1df7('0x3f')]){_0x665592[_0x1df7('0x3c')]=_['merge'](_0x665592[_0x1df7('0x3c')],{'$or':_[_0x1df7('0x31')](_0x53112d,function(_0x124c7a){if(_0x124c7a[_0x1df7('0x40')]!==_0x1df7('0x41')){var _0x434d6e={};_0x434d6e[_0x124c7a[_0x1df7('0x2f')]]={'$like':'%'+_0x4965fa[_0x1df7('0x36')][_0x1df7('0x3f')]+'%'};return _0x434d6e;}})});}_0x665592=_[_0x1df7('0x42')]({},_0x665592,_0x4965fa[_0x1df7('0x43')]);var _0x1f3c25={'where':_0x665592['where']};return db['MailQueue']['count'](_0x1f3c25)[_0x1df7('0x2b')](function(_0xf5b398){_0x1d1c19[_0x1df7('0x24')]=_0xf5b398;if(_0x4965fa[_0x1df7('0x36')][_0x1df7('0x44')]){_0x665592['include']=[{'all':!![]}];}return db['MailQueue'][_0x1df7('0x45')](_0x665592);})[_0x1df7('0x2b')](function(_0x3b8eae){_0x1d1c19[_0x1df7('0x46')]=_0x3b8eae;return _0x1d1c19;})['then'](respondWithFilteredResult(_0x319304,_0x665592))[_0x1df7('0x47')](handleError(_0x319304,null));};exports[_0x1df7('0x48')]=function(_0x18ae0e,_0x5403bb){var _0x108eae={'raw':!![],'where':{'id':_0x18ae0e['params']['id']}},_0x3a4bfc={};_0x3a4bfc['model']=_[_0x1df7('0x37')](db['MailQueue'][_0x1df7('0x33')]);_0x3a4bfc[_0x1df7('0x36')]=_['keys'](_0x18ae0e[_0x1df7('0x36')]);_0x3a4bfc['filters']=_[_0x1df7('0x49')](_0x3a4bfc[_0x1df7('0x38')],_0x3a4bfc['query']);_0x108eae[_0x1df7('0x39')]=_[_0x1df7('0x49')](_0x3a4bfc[_0x1df7('0x38')],qs[_0x1df7('0x4a')](_0x18ae0e[_0x1df7('0x36')][_0x1df7('0x4a')]));_0x108eae[_0x1df7('0x39')]=_0x108eae[_0x1df7('0x39')][_0x1df7('0x4b')]?_0x108eae[_0x1df7('0x39')]:_0x3a4bfc[_0x1df7('0x38')];if(_0x18ae0e[_0x1df7('0x36')][_0x1df7('0x44')]){_0x108eae[_0x1df7('0x4c')]=[{'all':!![]}];}_0x108eae=_[_0x1df7('0x42')]({},_0x108eae,_0x18ae0e[_0x1df7('0x43')]);return db[_0x1df7('0x32')][_0x1df7('0x4d')](_0x108eae)[_0x1df7('0x2b')](handleEntityNotFound(_0x5403bb,null))['then'](respondWithResult(_0x5403bb,null))['catch'](handleError(_0x5403bb,null));};exports[_0x1df7('0x4e')]=function(_0x133099,_0x1be253){return db[_0x1df7('0x32')][_0x1df7('0x4e')](_0x133099[_0x1df7('0x4f')],{})[_0x1df7('0x2b')](function(_0x10bf3d){var _0x4e4a6f=_0x133099[_0x1df7('0x50')]['get']({'plain':!![]});if(!_0x4e4a6f)throw new Error(_0x1df7('0x51'));if(_0x4e4a6f[_0x1df7('0x52')]===_0x1df7('0x50')){var _0x38b83c=_0x10bf3d['get']({'plain':!![]});var _0x527067=_0x1df7('0x2c');return db[_0x1df7('0x53')]['find']({'where':{'name':_0x527067,'userProfileId':_0x4e4a6f['userProfileId']},'raw':!![]})['then'](function(_0x1079b8){if(_0x1079b8&&_0x1079b8[_0x1df7('0x54')]===0x0){return db['UserProfileResource'][_0x1df7('0x4e')]({'name':_0x38b83c[_0x1df7('0x2f')],'resourceId':_0x38b83c['id'],'type':_0x1079b8[_0x1df7('0x2f')],'sectionId':_0x1079b8['id']},{})['then'](function(){return _0x10bf3d;});}else{return _0x10bf3d;}})[_0x1df7('0x47')](function(_0x1938ee){logger[_0x1df7('0x55')](_0x1df7('0x56'),_0x1938ee);throw _0x1938ee;});}return _0x10bf3d;})[_0x1df7('0x2b')](respondWithResult(_0x1be253,0xc9))[_0x1df7('0x47')](handleError(_0x1be253,null));};exports['update']=function(_0x393441,_0x4ad91b){if(_0x393441[_0x1df7('0x4f')]['id']){delete _0x393441[_0x1df7('0x4f')]['id'];}return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x393441[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x4ad91b,null))[_0x1df7('0x2b')](saveUpdates(_0x393441[_0x1df7('0x4f')],null))['then'](respondWithResult(_0x4ad91b,null))[_0x1df7('0x47')](handleError(_0x4ad91b,null));};exports[_0x1df7('0x2a')]=function(_0x84ebe,_0x4fa712){return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x84ebe[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x4fa712,null))['then'](removeEntity(_0x4fa712,null))['catch'](handleError(_0x4fa712,null));};exports[_0x1df7('0x58')]=function(_0x2921ed,_0x1726e0){return db[_0x1df7('0x32')][_0x1df7('0x58')]()[_0x1df7('0x2b')](respondWithResult(_0x1726e0,null))[_0x1df7('0x47')](handleError(_0x1726e0,null));};exports[_0x1df7('0x59')]=function(_0x119a7f,_0x483704,_0x3a7ec5){var _0xb13d10={'raw':!![],'where':{}},_0x1a9a10={},_0x4189c8;return db[_0x1df7('0x32')][_0x1df7('0x5a')]({'where':{'id':_0x119a7f[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x483704,null))[_0x1df7('0x2b')](function(_0x2c7ccf){if(_0x2c7ccf){_0x4189c8=_0x2c7ccf[_0x1df7('0x5b')]({'plain':!![]});_0x1a9a10[_0x1df7('0x38')]=_[_0x1df7('0x37')](db[_0x1df7('0x5c')][_0x1df7('0x33')]);_0x1a9a10[_0x1df7('0x36')]=_[_0x1df7('0x37')](_0x119a7f[_0x1df7('0x36')]);_0x1a9a10[_0x1df7('0x3d')]=_['intersection'](_0x1a9a10['model'],_0x1a9a10[_0x1df7('0x36')]);_0xb13d10[_0x1df7('0x39')]=_['intersection'](_0x1a9a10[_0x1df7('0x38')],qs[_0x1df7('0x4a')](_0x119a7f[_0x1df7('0x36')][_0x1df7('0x4a')]));_0xb13d10[_0x1df7('0x39')]=_0xb13d10[_0x1df7('0x39')][_0x1df7('0x4b')]?_0xb13d10[_0x1df7('0x39')]:_0x1a9a10[_0x1df7('0x38')];if(!_0x119a7f[_0x1df7('0x36')][_0x1df7('0x3a')]('nolimit')){_0xb13d10[_0x1df7('0x23')]=qs[_0x1df7('0x23')](_0x119a7f[_0x1df7('0x36')][_0x1df7('0x23')]);_0xb13d10['offset']=qs[_0x1df7('0x21')](_0x119a7f[_0x1df7('0x36')][_0x1df7('0x21')]);}_0xb13d10[_0x1df7('0x5d')]=qs['sort'](_0x119a7f[_0x1df7('0x36')][_0x1df7('0x3b')]);_0xb13d10[_0x1df7('0x3c')]=qs[_0x1df7('0x3d')](_[_0x1df7('0x3e')](_0x119a7f['query'],_0x1a9a10[_0x1df7('0x3d')]));_0xb13d10[_0x1df7('0x3c')][_0x1df7('0x5e')]=_0x2c7ccf['id'];if(_0x119a7f[_0x1df7('0x36')][_0x1df7('0x3f')]){_0xb13d10[_0x1df7('0x3c')]=_[_0x1df7('0x42')](_0xb13d10[_0x1df7('0x3c')],{'$or':_['map'](_0xb13d10[_0x1df7('0x39')],function(_0x435b4e){var _0x27ce5b={};_0x27ce5b[_0x435b4e]={'$like':'%'+_0x119a7f[_0x1df7('0x36')][_0x1df7('0x3f')]+'%'};return _0x27ce5b;})});}_0xb13d10=_[_0x1df7('0x42')]({},_0xb13d10,_0x119a7f[_0x1df7('0x43')]);return db[_0x1df7('0x5c')]['findAll'](_0xb13d10);}})['then'](function(_0x389243){if(_0x389243){return db[_0x1df7('0x5f')]['findAndCountAll']({'where':{'id':_[_0x1df7('0x31')](_0x389243,'UserId'),'role':'agent'},'attributes':['id',_0x1df7('0x2f'),_0x1df7('0x60'),'updatedAt',_0x1df7('0x61')]});}})[_0x1df7('0x2b')](function(_0x531fba){if(_0x531fba){return{'count':_0x531fba[_0x1df7('0x24')],'rows':_['map'](_0x531fba[_0x1df7('0x46')],function(_0x24024f){return{'membername':_0x24024f[_0x1df7('0x2f')],'UserId':_0x24024f['id'],'queue_name':_0x4189c8[_0x1df7('0x2f')],'MailQueueId':_0x4189c8['id'],'interface':util[_0x1df7('0x62')]('%s/%s',_0x1df7('0x63'),_0x24024f[_0x1df7('0x2f')]),'penalty':0x0,'paused':_0x24024f[_0x1df7('0x60')],'createdAt':_0x24024f['createdAt'],'updatedAt':_0x24024f[_0x1df7('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x483704,_0xb13d10))['catch'](handleError(_0x483704,null));};exports[_0x1df7('0x65')]=function(_0x5b8cbe,_0x3b4b9b,_0x49c722){var _0x22b3f1={};var _0x5d8291={};var _0x256bde;var _0x58d74e;return db[_0x1df7('0x32')][_0x1df7('0x5a')]({'where':{'id':_0x5b8cbe[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x3b4b9b,null))[_0x1df7('0x2b')](function(_0x29393b){if(_0x29393b){_0x256bde=_0x29393b;_0x5d8291[_0x1df7('0x38')]=_[_0x1df7('0x37')](db[_0x1df7('0x66')][_0x1df7('0x33')]);_0x5d8291[_0x1df7('0x36')]=_['keys'](_0x5b8cbe[_0x1df7('0x36')]);_0x5d8291['filters']=_[_0x1df7('0x49')](_0x5d8291['model'],_0x5d8291['query']);_0x22b3f1[_0x1df7('0x39')]=_[_0x1df7('0x49')](_0x5d8291[_0x1df7('0x38')],qs[_0x1df7('0x4a')](_0x5b8cbe['query'][_0x1df7('0x4a')]));_0x22b3f1[_0x1df7('0x39')]=_0x22b3f1['attributes'][_0x1df7('0x4b')]?_0x22b3f1[_0x1df7('0x39')]:_0x5d8291['model'];_0x22b3f1['order']=qs[_0x1df7('0x3b')](_0x5b8cbe[_0x1df7('0x36')][_0x1df7('0x3b')]);_0x22b3f1[_0x1df7('0x3c')]=qs[_0x1df7('0x3d')](_[_0x1df7('0x3e')](_0x5b8cbe['query'],_0x5d8291[_0x1df7('0x3d')]));if(_0x5b8cbe[_0x1df7('0x36')][_0x1df7('0x3f')]){_0x22b3f1['where']=_[_0x1df7('0x42')](_0x22b3f1[_0x1df7('0x3c')],{'$or':_[_0x1df7('0x31')](_0x22b3f1[_0x1df7('0x39')],function(_0x10b30f){var _0x2f1f02={};_0x2f1f02[_0x10b30f]={'$like':'%'+_0x5b8cbe['query'][_0x1df7('0x3f')]+'%'};return _0x2f1f02;})});}_0x22b3f1=_['merge']({},_0x22b3f1,_0x5b8cbe[_0x1df7('0x43')]);return _0x256bde[_0x1df7('0x65')](_0x22b3f1);}})[_0x1df7('0x2b')](function(_0x13878){if(_0x13878){_0x58d74e=_0x13878[_0x1df7('0x4b')];if(!_0x5b8cbe[_0x1df7('0x36')][_0x1df7('0x3a')](_0x1df7('0x67'))){_0x22b3f1[_0x1df7('0x23')]=qs[_0x1df7('0x23')](_0x5b8cbe[_0x1df7('0x36')]['limit']);_0x22b3f1[_0x1df7('0x21')]=qs[_0x1df7('0x21')](_0x5b8cbe[_0x1df7('0x36')]['offset']);}return _0x256bde[_0x1df7('0x65')](_0x22b3f1);}})[_0x1df7('0x2b')](function(_0x1bfb93){if(_0x1bfb93){return _0x1bfb93?{'count':_0x58d74e,'rows':_0x1bfb93}:null;}})['then'](respondWithResult(_0x3b4b9b,null))[_0x1df7('0x47')](handleError(_0x3b4b9b,null));};exports[_0x1df7('0x68')]=function(_0x23ce52,_0x1a496a,_0x3da51b){var _0x32f5bc=_0x23ce52[_0x1df7('0x4f')]['ids'];return db[_0x1df7('0x66')][_0x1df7('0x45')]({'where':{'id':_0x32f5bc},'attributes':['id'],'include':[{'model':db[_0x1df7('0x5f')],'as':_0x1df7('0x69'),'attributes':['id',_0x1df7('0x2f'),'online',_0x1df7('0x6a'),'interface'],'raw':!![]}]})[_0x1df7('0x2b')](function(_0x396980){if(_0x396980){var _0x4aa9f0=_[_0x1df7('0x6b')](_0x396980,function(_0x26a02c){var _0x46d7d5=_0x26a02c['get']({'plain':!![]});return _0x46d7d5[_0x1df7('0x69')];});return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x23ce52['params']['id']}})['then'](function(_0x4d116b){return db[_0x1df7('0x6c')][_0x1df7('0x6d')](function(_0xb8176){return _0x4d116b[_0x1df7('0x68')](_0x32f5bc,{'transaction':_0xb8176})[_0x1df7('0x2b')](function(){return BPromise[_0x1df7('0x6e')](_0x4aa9f0,function(_0x59bbf7){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x59bbf7['id'],'MailQueueId':_0x23ce52['params']['id']},'transaction':_0xb8176});});})[_0x1df7('0x2b')](function(){_0x4aa9f0[_0x1df7('0x6f')](function(_0x26b80d){socket['emit'](_0x1df7('0x70'),{'UserId':_0x26b80d['id'],'MailQueueId':_0x4d116b['id']});});});});});}})['then'](respondWithStatusCode(_0x1a496a,null))[_0x1df7('0x47')](handleError(_0x1a496a,null));};exports[_0x1df7('0x71')]=function(_0x3be875,_0x1cfd22,_0x28c87e){return db[_0x1df7('0x66')][_0x1df7('0x45')]({'where':{'id':_0x3be875[_0x1df7('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1df7('0x5f')],'as':_0x1df7('0x69'),'attributes':['id'],'raw':!![]}]})[_0x1df7('0x2b')](handleEntityNotFound(_0x1cfd22,null))[_0x1df7('0x2b')](function(_0x9b9234){var _0xcdd54a=_['map'](_0x9b9234,'id');var _0xa7ef57=[];var _0x2eaaa2=[];var _0x5e45b9=squel[_0x1df7('0x72')]();_0x5e45b9[_0x1df7('0x73')](_0x1df7('0x74'))[_0x1df7('0x75')]('team_has_mail_queues','tq')[_0x1df7('0x76')](_0x1df7('0x77'),'ut',_0x1df7('0x78'))[_0x1df7('0x3c')](_0x1df7('0x79'),_0x3be875[_0x1df7('0x57')]['id']);for(var _0x150d0d=0x0;_0x150d0d<_0x9b9234[_0x1df7('0x4b')];_0x150d0d+=0x1){let _0x441bc4=_0x9b9234[_0x150d0d];for(var _0x23ac30=0x0;_0x23ac30<_0x441bc4[_0x1df7('0x69')][_0x1df7('0x4b')];_0x23ac30+=0x1){let _0x4c6e69=_0x441bc4[_0x1df7('0x69')][_0x23ac30];var _0x5634eb=_0x5e45b9[_0x1df7('0x7a')]();_0x5634eb['where'](_0x1df7('0x7b'),_0x4c6e69['id']);_0x2eaaa2[_0x1df7('0x7c')](db['sequelize'][_0x1df7('0x36')](_0x5634eb[_0x1df7('0x7d')](),{'type':db['sequelize'][_0x1df7('0x7e')][_0x1df7('0x7f')]})['then'](function(_0x2dc803){if(_0x2dc803[_0x1df7('0x4b')]===0x1){return _0x4c6e69['id'];}else{var _0x5ab875=_[_0x1df7('0x80')](_[_0x1df7('0x31')](_0x2dc803,_0x1df7('0x81')),function(_0x3bacf6){return _[_0x1df7('0x82')](_0xcdd54a,_0x3bacf6);});if(_0x5ab875){return _0x4c6e69['id'];}}}));}}return BPromise[_0x1df7('0x83')](_0x2eaaa2)[_0x1df7('0x2b')](function(_0x5ee7cb){_0xa7ef57=_(_0xa7ef57)[_0x1df7('0x84')](_0x5ee7cb)['compact']()[_0x1df7('0x85')]();return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x3be875[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](function(_0x4b316c){return db[_0x1df7('0x6c')][_0x1df7('0x6d')](function(_0xffc3a8){return _0x4b316c[_0x1df7('0x71')](_0x3be875['query']['ids'],{'transaction':_0xffc3a8})['then'](function(){if(!_[_0x1df7('0x86')](_0xa7ef57)){return _0x4b316c[_0x1df7('0x87')](_0xa7ef57,{'transaction':_0xffc3a8});}})[_0x1df7('0x2b')](function(){_0xa7ef57[_0x1df7('0x6f')](function(_0x584798){socket[_0x1df7('0x88')](_0x1df7('0x89'),{'UserId':_0x584798,'MailQueueId':_0x4b316c['id']});});});});});});})[_0x1df7('0x2b')](respondWithStatusCode(_0x1cfd22,null))[_0x1df7('0x47')](handleError(_0x1cfd22,null));};exports[_0x1df7('0x8a')]=function(_0x4134ac,_0x56c5f8,_0x3fd9c6){return db[_0x1df7('0x32')]['find']({'where':{'id':_0x4134ac[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x56c5f8,null))['then'](function(_0x496055){if(_0x496055){return _0x496055[_0x1df7('0x8a')](_0x4134ac[_0x1df7('0x4f')][_0x1df7('0x8b')],_[_0x1df7('0x8c')](_0x4134ac[_0x1df7('0x4f')],[_0x1df7('0x8b'),'id'])||{})[_0x1df7('0x8d')](function(_0x1bdd8e){for(var _0x4880de=0x0;_0x4880de<_0x4134ac[_0x1df7('0x4f')][_0x1df7('0x8b')][_0x1df7('0x4b')];_0x4880de+=0x1){socket[_0x1df7('0x88')]('userMailQueue:save',{'UserId':Number(_0x4134ac[_0x1df7('0x4f')]['ids'][_0x4880de]),'MailQueueId':Number(_0x4134ac[_0x1df7('0x57')]['id'])});}return _0x1bdd8e;});}})[_0x1df7('0x2b')](respondWithResult(_0x56c5f8,null))['catch'](handleError(_0x56c5f8,null));};exports['removeAgents']=function(_0x3ff897,_0x23a57d,_0x2c0647){return db[_0x1df7('0x32')][_0x1df7('0x4d')]({'where':{'id':_0x3ff897[_0x1df7('0x57')]['id']}})[_0x1df7('0x2b')](handleEntityNotFound(_0x23a57d,null))[_0x1df7('0x2b')](function(_0x16d19a){if(_0x16d19a){return _0x16d19a[_0x1df7('0x87')](_0x3ff897['query'][_0x1df7('0x8b')])[_0x1df7('0x2b')](function(){if(_[_0x1df7('0x8e')](_0x3ff897['query']['ids'])){for(var _0x5ad330=0x0;_0x5ad330<_0x3ff897[_0x1df7('0x36')]['ids']['length'];_0x5ad330+=0x1){socket[_0x1df7('0x88')](_0x1df7('0x89'),{'UserId':Number(_0x3ff897[_0x1df7('0x36')][_0x1df7('0x8b')][_0x5ad330]),'MailQueueId':Number(_0x3ff897[_0x1df7('0x57')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3ff897['query']['ids']),'MailQueueId':Number(_0x3ff897[_0x1df7('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x23a57d,null))['catch'](handleError(_0x23a57d,null));};exports[_0x1df7('0x8f')]=function(_0x328ceb,_0x50c74d,_0x2adf51){var _0xe25a34={};var _0x1fe304={};var _0x5ddea1;var _0x14a336;return db[_0x1df7('0x32')]['findOne']({'where':{'id':_0x328ceb[_0x1df7('0x57')]['id']}})['then'](handleEntityNotFound(_0x50c74d,null))['then'](function(_0x4a7d30){if(_0x4a7d30){_0x5ddea1=_0x4a7d30;_0x1fe304['model']=_[_0x1df7('0x37')](db[_0x1df7('0x5f')]['rawAttributes']);_0x1fe304[_0x1df7('0x36')]=_[_0x1df7('0x37')](_0x328ceb[_0x1df7('0x36')]);_0x1fe304['filters']=_[_0x1df7('0x49')](_0x1fe304[_0x1df7('0x38')],_0x1fe304[_0x1df7('0x36')]);_0xe25a34[_0x1df7('0x39')]=_[_0x1df7('0x49')](_0x1fe304['model'],qs[_0x1df7('0x4a')](_0x328ceb[_0x1df7('0x36')][_0x1df7('0x4a')]));_0xe25a34[_0x1df7('0x39')]=_0xe25a34[_0x1df7('0x39')][_0x1df7('0x4b')]?_0xe25a34[_0x1df7('0x39')]:_0x1fe304[_0x1df7('0x38')];_0xe25a34[_0x1df7('0x5d')]=qs['sort'](_0x328ceb[_0x1df7('0x36')][_0x1df7('0x3b')]);_0xe25a34[_0x1df7('0x3c')]=qs[_0x1df7('0x3d')](_[_0x1df7('0x3e')](_0x328ceb['query'],_0x1fe304[_0x1df7('0x3d')]));if(_0x328ceb[_0x1df7('0x36')][_0x1df7('0x3f')]){_0xe25a34[_0x1df7('0x3c')]=_[_0x1df7('0x42')](_0xe25a34[_0x1df7('0x3c')],{'$or':_['map'](_0xe25a34[_0x1df7('0x39')],function(_0x573a14){var _0x5037d8={};_0x5037d8[_0x573a14]={'$like':'%'+_0x328ceb[_0x1df7('0x36')]['filter']+'%'};return _0x5037d8;})});}_0xe25a34=_[_0x1df7('0x42')]({},_0xe25a34,_0x328ceb[_0x1df7('0x43')]);return _0x5ddea1['getAgents'](_0xe25a34);}})[_0x1df7('0x2b')](function(_0x2f42eb){if(_0x2f42eb){_0x14a336=_0x2f42eb[_0x1df7('0x4b')];if(!_0x328ceb[_0x1df7('0x36')]['hasOwnProperty'](_0x1df7('0x67'))){_0xe25a34[_0x1df7('0x23')]=qs['limit'](_0x328ceb['query'][_0x1df7('0x23')]);_0xe25a34[_0x1df7('0x21')]=qs[_0x1df7('0x21')](_0x328ceb['query'][_0x1df7('0x21')]);}return _0x5ddea1[_0x1df7('0x8f')](_0xe25a34);}})[_0x1df7('0x2b')](function(_0x4a68d4){if(_0x4a68d4){return _0x4a68d4?{'count':_0x14a336,'rows':_0x4a68d4}:null;}})[_0x1df7('0x2b')](respondWithResult(_0x50c74d,null))[_0x1df7('0x47')](handleError(_0x50c74d,null));}; \ No newline at end of file +var _0xd20f=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','MailQueueId','UserMailQueue','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','mailPause','updatedAt','getTeams','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','userMailQueue:save','Team','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','all','compact','isEmpty','removeAgents','forEach','emit','addAgents','omit','userMailQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','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','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','Content-Range','reject','update','destroy','then','get','MailQueues','UserProfileResource','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x11f36a,_0x836436){var _0x1db606=function(_0x5a2045){while(--_0x5a2045){_0x11f36a['push'](_0x11f36a['shift']());}};_0x1db606(++_0x836436);}(_0xd20f,0xbf));var _0xfd20=function(_0x98f838,_0x588f04){_0x98f838=_0x98f838-0x0;var _0xaa9917=_0xd20f[_0x98f838];return _0xaa9917;};'use strict';var emlformat=require(_0xfd20('0x0'));var rimraf=require(_0xfd20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd20('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfd20('0x3'));var Mustache=require(_0xfd20('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfd20('0x5'));var fs=require('fs');var fs_extra=require(_0xfd20('0x6'));var _=require(_0xfd20('0x7'));var squel=require(_0xfd20('0x8'));var crypto=require(_0xfd20('0x9'));var jsforce=require(_0xfd20('0xa'));var deskjs=require(_0xfd20('0xb'));var toCsv=require(_0xfd20('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfd20('0xd'));var authService=require(_0xfd20('0xe'));var qs=require(_0xfd20('0xf'));var as=require(_0xfd20('0x10'));var hardwareService=require(_0xfd20('0x11'));var logger=require(_0xfd20('0x12'))('api');var utils=require(_0xfd20('0x13'));var config=require(_0xfd20('0x14'));var licenseUtil=require(_0xfd20('0x15'));var db=require(_0xfd20('0x16'))['db'];config[_0xfd20('0x17')]=_[_0xfd20('0x18')](config[_0xfd20('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd20('0x19'))(new Redis(config[_0xfd20('0x17')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0xf435a1,_0x505721){_0x505721=_0x505721||0xcc;return function(_0x5f1eb3){if(_0x5f1eb3){return _0xf435a1[_0xfd20('0x1a')](_0x505721);}return _0xf435a1['status'](_0x505721)[_0xfd20('0x1b')]();};}function respondWithResult(_0x4ea30e,_0x5ee62d){_0x5ee62d=_0x5ee62d||0xc8;return function(_0x460c99){if(_0x460c99){return _0x4ea30e[_0xfd20('0x1c')](_0x5ee62d)[_0xfd20('0x1d')](_0x460c99);}};}function respondWithFilteredResult(_0x29d5ca,_0x4a709f){return function(_0x40a350){if(_0x40a350){var _0x8f1136=typeof _0x4a709f[_0xfd20('0x1e')]===_0xfd20('0x1f')&&typeof _0x4a709f[_0xfd20('0x20')]===_0xfd20('0x1f');var _0x35bfd1=_0x40a350['count'];var _0x274087=_0x8f1136?0x0:_0x4a709f[_0xfd20('0x1e')];var _0x121488=_0x8f1136?_0x40a350['count']:_0x4a709f[_0xfd20('0x1e')]+_0x4a709f[_0xfd20('0x20')];var _0x4c40b3;if(_0x121488>=_0x35bfd1){_0x121488=_0x35bfd1;_0x4c40b3=0xc8;}else{_0x4c40b3=0xce;}_0x29d5ca[_0xfd20('0x1c')](_0x4c40b3);return _0x29d5ca['set'](_0xfd20('0x21'),_0x274087+'-'+_0x121488+'/'+_0x35bfd1)['json'](_0x40a350);}return null;};}function patchUpdates(_0x1bf08b){return function(_0xc3ecc4){try{jsonpatch['apply'](_0xc3ecc4,_0x1bf08b,!![]);}catch(_0x428186){return BPromise[_0xfd20('0x22')](_0x428186);}return _0xc3ecc4['save']();};}function saveUpdates(_0x219d9e,_0x150e5d){return function(_0xc1030a){if(_0xc1030a){return _0xc1030a[_0xfd20('0x23')](_0x219d9e)['then'](function(_0x19c03f){return _0x19c03f;});}return null;};}function removeEntity(_0x404607,_0x4cf477){return function(_0x2cc752){if(_0x2cc752){return _0x2cc752[_0xfd20('0x24')]()[_0xfd20('0x25')](function(){var _0x9c1be1=_0x2cc752[_0xfd20('0x26')]({'plain':!![]});var _0x1e64bf=_0xfd20('0x27');return db[_0xfd20('0x28')][_0xfd20('0x24')]({'where':{'type':_0x1e64bf,'resourceId':_0x9c1be1['id']}})['then'](function(){return _0x2cc752;});})[_0xfd20('0x25')](function(){_0x404607[_0xfd20('0x1c')](0xcc)[_0xfd20('0x1b')]();});}};}function handleEntityNotFound(_0x2fe947,_0x338d4b){return function(_0x4565fd){if(!_0x4565fd){_0x2fe947[_0xfd20('0x1a')](0x194);}return _0x4565fd;};}function handleError(_0x2bca22,_0x210730){_0x210730=_0x210730||0x1f4;return function(_0x47c922){logger['error'](_0x47c922[_0xfd20('0x29')]);if(_0x47c922[_0xfd20('0x2a')]){delete _0x47c922[_0xfd20('0x2a')];}_0x2bca22[_0xfd20('0x1c')](_0x210730)[_0xfd20('0x2b')](_0x47c922);};}exports[_0xfd20('0x2c')]=function(_0x161b8d,_0x1c4b3a){var _0x36ea97={},_0x4f3c38={},_0x2fd19c={'count':0x0,'rows':[]};var _0xae52eb=_['map'](db[_0xfd20('0x2d')][_0xfd20('0x2e')],function(_0x1014bf){return{'name':_0x1014bf[_0xfd20('0x2f')],'type':_0x1014bf[_0xfd20('0x30')][_0xfd20('0x31')]};});_0x4f3c38['model']=_[_0xfd20('0x32')](_0xae52eb,'name');_0x4f3c38[_0xfd20('0x33')]=_[_0xfd20('0x34')](_0x161b8d['query']);_0x4f3c38[_0xfd20('0x35')]=_[_0xfd20('0x36')](_0x4f3c38[_0xfd20('0x37')],_0x4f3c38[_0xfd20('0x33')]);_0x36ea97[_0xfd20('0x38')]=_['intersection'](_0x4f3c38[_0xfd20('0x37')],qs[_0xfd20('0x39')](_0x161b8d[_0xfd20('0x33')][_0xfd20('0x39')]));_0x36ea97['attributes']=_0x36ea97[_0xfd20('0x38')][_0xfd20('0x3a')]?_0x36ea97[_0xfd20('0x38')]:_0x4f3c38[_0xfd20('0x37')];if(!_0x161b8d[_0xfd20('0x33')][_0xfd20('0x3b')](_0xfd20('0x3c'))){_0x36ea97[_0xfd20('0x20')]=qs[_0xfd20('0x20')](_0x161b8d[_0xfd20('0x33')][_0xfd20('0x20')]);_0x36ea97[_0xfd20('0x1e')]=qs[_0xfd20('0x1e')](_0x161b8d[_0xfd20('0x33')][_0xfd20('0x1e')]);}_0x36ea97[_0xfd20('0x3d')]=qs[_0xfd20('0x3e')](_0x161b8d['query'][_0xfd20('0x3e')]);_0x36ea97[_0xfd20('0x3f')]=qs[_0xfd20('0x35')](_[_0xfd20('0x40')](_0x161b8d[_0xfd20('0x33')],_0x4f3c38[_0xfd20('0x35')]),_0xae52eb);if(_0x161b8d[_0xfd20('0x33')][_0xfd20('0x41')]){_0x36ea97[_0xfd20('0x3f')]=_['merge'](_0x36ea97[_0xfd20('0x3f')],{'$or':_['map'](_0xae52eb,function(_0x5e107b){if(_0x5e107b[_0xfd20('0x30')]!=='VIRTUAL'){var _0x2377b4={};_0x2377b4[_0x5e107b['name']]={'$like':'%'+_0x161b8d[_0xfd20('0x33')][_0xfd20('0x41')]+'%'};return _0x2377b4;}})});}_0x36ea97=_[_0xfd20('0x42')]({},_0x36ea97,_0x161b8d[_0xfd20('0x43')]);var _0x1a795c={'where':_0x36ea97[_0xfd20('0x3f')]};return db[_0xfd20('0x2d')]['count'](_0x1a795c)['then'](function(_0x986e29){_0x2fd19c[_0xfd20('0x44')]=_0x986e29;if(_0x161b8d[_0xfd20('0x33')][_0xfd20('0x45')]){_0x36ea97['include']=[{'all':!![]}];}return db['MailQueue'][_0xfd20('0x46')](_0x36ea97);})[_0xfd20('0x25')](function(_0x4b5002){_0x2fd19c[_0xfd20('0x47')]=_0x4b5002;return _0x2fd19c;})['then'](respondWithFilteredResult(_0x1c4b3a,_0x36ea97))[_0xfd20('0x48')](handleError(_0x1c4b3a,null));};exports[_0xfd20('0x49')]=function(_0x32b7f3,_0xd0cc00){var _0x58de5c={'raw':!![],'where':{'id':_0x32b7f3[_0xfd20('0x4a')]['id']}},_0xf0c94f={};_0xf0c94f['model']=_['keys'](db[_0xfd20('0x2d')][_0xfd20('0x2e')]);_0xf0c94f[_0xfd20('0x33')]=_['keys'](_0x32b7f3[_0xfd20('0x33')]);_0xf0c94f[_0xfd20('0x35')]=_['intersection'](_0xf0c94f[_0xfd20('0x37')],_0xf0c94f[_0xfd20('0x33')]);_0x58de5c[_0xfd20('0x38')]=_[_0xfd20('0x36')](_0xf0c94f['model'],qs[_0xfd20('0x39')](_0x32b7f3[_0xfd20('0x33')][_0xfd20('0x39')]));_0x58de5c['attributes']=_0x58de5c[_0xfd20('0x38')]['length']?_0x58de5c[_0xfd20('0x38')]:_0xf0c94f[_0xfd20('0x37')];if(_0x32b7f3[_0xfd20('0x33')][_0xfd20('0x45')]){_0x58de5c[_0xfd20('0x4b')]=[{'all':!![]}];}_0x58de5c=_[_0xfd20('0x42')]({},_0x58de5c,_0x32b7f3[_0xfd20('0x43')]);return db[_0xfd20('0x2d')][_0xfd20('0x4c')](_0x58de5c)['then'](handleEntityNotFound(_0xd0cc00,null))[_0xfd20('0x25')](respondWithResult(_0xd0cc00,null))['catch'](handleError(_0xd0cc00,null));};exports[_0xfd20('0x4d')]=function(_0x1ad607,_0x61b935){return db[_0xfd20('0x2d')][_0xfd20('0x4d')](_0x1ad607[_0xfd20('0x4e')],{})[_0xfd20('0x25')](function(_0x48e877){var _0x19c1a5=_0x1ad607[_0xfd20('0x4f')][_0xfd20('0x26')]({'plain':!![]});if(!_0x19c1a5)throw new Error(_0xfd20('0x50'));if(_0x19c1a5[_0xfd20('0x51')]===_0xfd20('0x4f')){var _0x4271f2=_0x48e877[_0xfd20('0x26')]({'plain':!![]});var _0x4c51a5=_0xfd20('0x27');return db['UserProfileSection'][_0xfd20('0x4c')]({'where':{'name':_0x4c51a5,'userProfileId':_0x19c1a5[_0xfd20('0x52')]},'raw':!![]})[_0xfd20('0x25')](function(_0x44a8fb){if(_0x44a8fb&&_0x44a8fb[_0xfd20('0x53')]===0x0){return db[_0xfd20('0x28')]['create']({'name':_0x4271f2[_0xfd20('0x2a')],'resourceId':_0x4271f2['id'],'type':_0x44a8fb[_0xfd20('0x2a')],'sectionId':_0x44a8fb['id']},{})['then'](function(){return _0x48e877;});}else{return _0x48e877;}})[_0xfd20('0x48')](function(_0x364f63){logger[_0xfd20('0x54')](_0xfd20('0x55'),_0x364f63);throw _0x364f63;});}return _0x48e877;})[_0xfd20('0x25')](respondWithResult(_0x61b935,0xc9))[_0xfd20('0x48')](handleError(_0x61b935,null));};exports['update']=function(_0x2df81b,_0x12f325){if(_0x2df81b[_0xfd20('0x4e')]['id']){delete _0x2df81b[_0xfd20('0x4e')]['id'];}return db[_0xfd20('0x2d')][_0xfd20('0x4c')]({'where':{'id':_0x2df81b['params']['id']}})[_0xfd20('0x25')](handleEntityNotFound(_0x12f325,null))[_0xfd20('0x25')](saveUpdates(_0x2df81b[_0xfd20('0x4e')],null))[_0xfd20('0x25')](respondWithResult(_0x12f325,null))[_0xfd20('0x48')](handleError(_0x12f325,null));};exports[_0xfd20('0x24')]=function(_0x31b712,_0x3e2fb8){return db[_0xfd20('0x2d')][_0xfd20('0x4c')]({'where':{'id':_0x31b712['params']['id']}})[_0xfd20('0x25')](handleEntityNotFound(_0x3e2fb8,null))[_0xfd20('0x25')](removeEntity(_0x3e2fb8,null))[_0xfd20('0x48')](handleError(_0x3e2fb8,null));};exports[_0xfd20('0x56')]=function(_0x2e9ac1,_0x3109c6){return db['MailQueue'][_0xfd20('0x56')]()[_0xfd20('0x25')](respondWithResult(_0x3109c6,null))[_0xfd20('0x48')](handleError(_0x3109c6,null));};exports[_0xfd20('0x57')]=function(_0x2054c0,_0x415a32,_0x12cc42){var _0x399e0c={'raw':!![],'where':{}},_0xa16550={},_0x1cc117;return db['MailQueue'][_0xfd20('0x58')]({'where':{'id':_0x2054c0[_0xfd20('0x4a')]['id']}})['then'](handleEntityNotFound(_0x415a32,null))[_0xfd20('0x25')](function(_0x4b3f46){if(_0x4b3f46){_0x1cc117=_0x4b3f46['get']({'plain':!![]});_0xa16550[_0xfd20('0x37')]=_[_0xfd20('0x34')](db['UserMailQueue'][_0xfd20('0x2e')]);_0xa16550[_0xfd20('0x33')]=_['keys'](_0x2054c0[_0xfd20('0x33')]);_0xa16550[_0xfd20('0x35')]=_[_0xfd20('0x36')](_0xa16550[_0xfd20('0x37')],_0xa16550[_0xfd20('0x33')]);_0x399e0c['attributes']=_[_0xfd20('0x36')](_0xa16550[_0xfd20('0x37')],qs['fields'](_0x2054c0[_0xfd20('0x33')][_0xfd20('0x39')]));_0x399e0c[_0xfd20('0x38')]=_0x399e0c[_0xfd20('0x38')][_0xfd20('0x3a')]?_0x399e0c[_0xfd20('0x38')]:_0xa16550[_0xfd20('0x37')];if(!_0x2054c0[_0xfd20('0x33')][_0xfd20('0x3b')](_0xfd20('0x3c'))){_0x399e0c[_0xfd20('0x20')]=qs['limit'](_0x2054c0[_0xfd20('0x33')]['limit']);_0x399e0c[_0xfd20('0x1e')]=qs[_0xfd20('0x1e')](_0x2054c0['query']['offset']);}_0x399e0c[_0xfd20('0x3d')]=qs[_0xfd20('0x3e')](_0x2054c0[_0xfd20('0x33')][_0xfd20('0x3e')]);_0x399e0c[_0xfd20('0x3f')]=qs[_0xfd20('0x35')](_[_0xfd20('0x40')](_0x2054c0[_0xfd20('0x33')],_0xa16550[_0xfd20('0x35')]));_0x399e0c[_0xfd20('0x3f')][_0xfd20('0x59')]=_0x4b3f46['id'];if(_0x2054c0[_0xfd20('0x33')][_0xfd20('0x41')]){_0x399e0c[_0xfd20('0x3f')]=_[_0xfd20('0x42')](_0x399e0c[_0xfd20('0x3f')],{'$or':_[_0xfd20('0x32')](_0x399e0c[_0xfd20('0x38')],function(_0x307f34){var _0x426d00={};_0x426d00[_0x307f34]={'$like':'%'+_0x2054c0[_0xfd20('0x33')]['filter']+'%'};return _0x426d00;})});}_0x399e0c=_[_0xfd20('0x42')]({},_0x399e0c,_0x2054c0['options']);return db[_0xfd20('0x5a')][_0xfd20('0x46')](_0x399e0c);}})[_0xfd20('0x25')](function(_0x5b2392){if(_0x5b2392){return db['User'][_0xfd20('0x5b')]({'where':{'id':_[_0xfd20('0x32')](_0x5b2392,_0xfd20('0x5c')),'role':_0xfd20('0x5d')},'attributes':['id','name','mailPause','updatedAt',_0xfd20('0x5e')]});}})[_0xfd20('0x25')](function(_0x5d78d3){if(_0x5d78d3){return{'count':_0x5d78d3['count'],'rows':_['map'](_0x5d78d3[_0xfd20('0x47')],function(_0x509931){return{'membername':_0x509931[_0xfd20('0x2a')],'UserId':_0x509931['id'],'queue_name':_0x1cc117[_0xfd20('0x2a')],'MailQueueId':_0x1cc117['id'],'interface':util[_0xfd20('0x5f')](_0xfd20('0x60'),_0xfd20('0x61'),_0x509931[_0xfd20('0x2a')]),'penalty':0x0,'paused':_0x509931[_0xfd20('0x62')],'createdAt':_0x509931[_0xfd20('0x5e')],'updatedAt':_0x509931[_0xfd20('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfd20('0x25')](respondWithFilteredResult(_0x415a32,_0x399e0c))[_0xfd20('0x48')](handleError(_0x415a32,null));};exports[_0xfd20('0x64')]=function(_0x1aa05a,_0x18cf5e,_0x4078cd){var _0x34e789={};var _0x5c843e={};var _0x50d367;var _0x41cab2;return db[_0xfd20('0x2d')]['findOne']({'where':{'id':_0x1aa05a[_0xfd20('0x4a')]['id']}})[_0xfd20('0x25')](handleEntityNotFound(_0x18cf5e,null))['then'](function(_0x567a3b){if(_0x567a3b){_0x50d367=_0x567a3b;_0x5c843e[_0xfd20('0x37')]=_[_0xfd20('0x34')](db['Team'][_0xfd20('0x2e')]);_0x5c843e[_0xfd20('0x33')]=_[_0xfd20('0x34')](_0x1aa05a['query']);_0x5c843e[_0xfd20('0x35')]=_[_0xfd20('0x36')](_0x5c843e['model'],_0x5c843e[_0xfd20('0x33')]);_0x34e789['attributes']=_[_0xfd20('0x36')](_0x5c843e['model'],qs[_0xfd20('0x39')](_0x1aa05a['query']['fields']));_0x34e789[_0xfd20('0x38')]=_0x34e789[_0xfd20('0x38')][_0xfd20('0x3a')]?_0x34e789['attributes']:_0x5c843e[_0xfd20('0x37')];_0x34e789[_0xfd20('0x3d')]=qs[_0xfd20('0x3e')](_0x1aa05a['query'][_0xfd20('0x3e')]);_0x34e789[_0xfd20('0x3f')]=qs[_0xfd20('0x35')](_['pick'](_0x1aa05a[_0xfd20('0x33')],_0x5c843e[_0xfd20('0x35')]));if(_0x1aa05a[_0xfd20('0x33')][_0xfd20('0x41')]){_0x34e789[_0xfd20('0x3f')]=_[_0xfd20('0x42')](_0x34e789[_0xfd20('0x3f')],{'$or':_[_0xfd20('0x32')](_0x34e789[_0xfd20('0x38')],function(_0x57f8fa){var _0x7b4ee5={};_0x7b4ee5[_0x57f8fa]={'$like':'%'+_0x1aa05a[_0xfd20('0x33')][_0xfd20('0x41')]+'%'};return _0x7b4ee5;})});}_0x34e789=_[_0xfd20('0x42')]({},_0x34e789,_0x1aa05a[_0xfd20('0x43')]);return _0x50d367[_0xfd20('0x64')](_0x34e789);}})[_0xfd20('0x25')](function(_0x22aed1){if(_0x22aed1){_0x41cab2=_0x22aed1[_0xfd20('0x3a')];if(!_0x1aa05a[_0xfd20('0x33')][_0xfd20('0x3b')]('nolimit')){_0x34e789['limit']=qs[_0xfd20('0x20')](_0x1aa05a['query'][_0xfd20('0x20')]);_0x34e789[_0xfd20('0x1e')]=qs[_0xfd20('0x1e')](_0x1aa05a[_0xfd20('0x33')]['offset']);}return _0x50d367[_0xfd20('0x64')](_0x34e789);}})[_0xfd20('0x25')](function(_0x2960de){if(_0x2960de){return _0x2960de?{'count':_0x41cab2,'rows':_0x2960de}:null;}})['then'](respondWithResult(_0x18cf5e,null))[_0xfd20('0x48')](handleError(_0x18cf5e,null));};exports[_0xfd20('0x65')]=function(_0x4beb06,_0xdd821a,_0x4299af){var _0xdf8dd1=_0x4beb06[_0xfd20('0x4e')][_0xfd20('0x66')];return db['Team'][_0xfd20('0x46')]({'where':{'id':_0xdf8dd1},'attributes':['id'],'include':[{'model':db[_0xfd20('0x67')],'as':_0xfd20('0x68'),'attributes':['id','name',_0xfd20('0x69'),_0xfd20('0x6a'),'interface'],'raw':!![]}]})[_0xfd20('0x25')](function(_0x574ebc){if(_0x574ebc){var _0xa6d1e8=_[_0xfd20('0x6b')](_0x574ebc,function(_0x190069){var _0x217458=_0x190069[_0xfd20('0x26')]({'plain':!![]});return _0x217458[_0xfd20('0x68')];});return db['MailQueue'][_0xfd20('0x4c')]({'where':{'id':_0x4beb06[_0xfd20('0x4a')]['id']}})['then'](function(_0x34e1d8){return db[_0xfd20('0x6c')][_0xfd20('0x6d')](function(_0x95cc40){return _0x34e1d8[_0xfd20('0x65')](_0xdf8dd1,{'transaction':_0x95cc40})[_0xfd20('0x25')](function(){return BPromise[_0xfd20('0x6e')](_0xa6d1e8,function(_0x154709){return db[_0xfd20('0x5a')][_0xfd20('0x6f')]({'where':{'UserId':_0x154709['id'],'MailQueueId':_0x4beb06[_0xfd20('0x4a')]['id']},'transaction':_0x95cc40});});})[_0xfd20('0x25')](function(){_0xa6d1e8['forEach'](function(_0x3c547b){socket['emit'](_0xfd20('0x70'),{'UserId':_0x3c547b['id'],'MailQueueId':_0x34e1d8['id']});});});});});}})['then'](respondWithStatusCode(_0xdd821a,null))['catch'](handleError(_0xdd821a,null));};exports['removeTeams']=function(_0x120ce1,_0x1b2983,_0x1a527c){return db[_0xfd20('0x71')][_0xfd20('0x46')]({'where':{'id':_0x120ce1[_0xfd20('0x33')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfd20('0x68'),'attributes':['id'],'raw':!![]}]})[_0xfd20('0x25')](handleEntityNotFound(_0x1b2983,null))[_0xfd20('0x25')](function(_0x1d7d80){var _0x3b50f7=_[_0xfd20('0x32')](_0x1d7d80,'id');var _0x57375a=[];var _0x8f3996=[];var _0x21703b=squel['select']();_0x21703b['field'](_0xfd20('0x72'))[_0xfd20('0x73')](_0xfd20('0x74'),'tq')[_0xfd20('0x75')](_0xfd20('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xfd20('0x77'),_0x120ce1[_0xfd20('0x4a')]['id']);for(var _0x4282b8=0x0;_0x4282b8<_0x1d7d80[_0xfd20('0x3a')];_0x4282b8+=0x1){let _0x251a64=_0x1d7d80[_0x4282b8];for(var _0xbdb879=0x0;_0xbdb879<_0x251a64['Agents'][_0xfd20('0x3a')];_0xbdb879+=0x1){let _0x31b7cc=_0x251a64['Agents'][_0xbdb879];var _0x509969=_0x21703b[_0xfd20('0x78')]();_0x509969[_0xfd20('0x3f')](_0xfd20('0x79'),_0x31b7cc['id']);_0x8f3996[_0xfd20('0x7a')](db['sequelize'][_0xfd20('0x33')](_0x509969['toString'](),{'type':db[_0xfd20('0x6c')][_0xfd20('0x7b')][_0xfd20('0x7c')]})[_0xfd20('0x25')](function(_0xa263d9){if(_0xa263d9[_0xfd20('0x3a')]===0x1){return _0x31b7cc['id'];}else{var _0x5cb44e=_[_0xfd20('0x7d')](_['map'](_0xa263d9,'TeamId'),function(_0x1cd126){return _[_0xfd20('0x7e')](_0x3b50f7,_0x1cd126);});if(_0x5cb44e){return _0x31b7cc['id'];}}}));}}return BPromise[_0xfd20('0x7f')](_0x8f3996)[_0xfd20('0x25')](function(_0x1d7bef){_0x57375a=_(_0x57375a)['union'](_0x1d7bef)[_0xfd20('0x80')]()['value']();return db[_0xfd20('0x2d')]['find']({'where':{'id':_0x120ce1['params']['id']}})[_0xfd20('0x25')](function(_0x21563f){return db[_0xfd20('0x6c')]['transaction'](function(_0x3d9411){return _0x21563f['removeTeams'](_0x120ce1[_0xfd20('0x33')][_0xfd20('0x66')],{'transaction':_0x3d9411})['then'](function(){if(!_[_0xfd20('0x81')](_0x57375a)){return _0x21563f[_0xfd20('0x82')](_0x57375a,{'transaction':_0x3d9411});}})['then'](function(){_0x57375a[_0xfd20('0x83')](function(_0x149689){socket[_0xfd20('0x84')]('userMailQueue:remove',{'UserId':_0x149689,'MailQueueId':_0x21563f['id']});});});});});});})[_0xfd20('0x25')](respondWithStatusCode(_0x1b2983,null))[_0xfd20('0x48')](handleError(_0x1b2983,null));};exports[_0xfd20('0x85')]=function(_0x57c63e,_0x52a8ce,_0x369af7){return db[_0xfd20('0x2d')][_0xfd20('0x4c')]({'where':{'id':_0x57c63e[_0xfd20('0x4a')]['id']}})[_0xfd20('0x25')](handleEntityNotFound(_0x52a8ce,null))[_0xfd20('0x25')](function(_0x518997){if(_0x518997){return _0x518997['addAgents'](_0x57c63e[_0xfd20('0x4e')][_0xfd20('0x66')],_[_0xfd20('0x86')](_0x57c63e[_0xfd20('0x4e')],[_0xfd20('0x66'),'id'])||{})['spread'](function(_0x3229e6){for(var _0x5dcce4=0x0;_0x5dcce4<_0x57c63e['body'][_0xfd20('0x66')][_0xfd20('0x3a')];_0x5dcce4+=0x1){socket[_0xfd20('0x84')](_0xfd20('0x70'),{'UserId':Number(_0x57c63e[_0xfd20('0x4e')][_0xfd20('0x66')][_0x5dcce4]),'MailQueueId':Number(_0x57c63e[_0xfd20('0x4a')]['id'])});}return _0x3229e6;});}})[_0xfd20('0x25')](respondWithResult(_0x52a8ce,null))[_0xfd20('0x48')](handleError(_0x52a8ce,null));};exports['removeAgents']=function(_0x50072c,_0x60c7dd,_0x2481d9){return db[_0xfd20('0x2d')][_0xfd20('0x4c')]({'where':{'id':_0x50072c[_0xfd20('0x4a')]['id']}})[_0xfd20('0x25')](handleEntityNotFound(_0x60c7dd,null))[_0xfd20('0x25')](function(_0x22bf3b){if(_0x22bf3b){return _0x22bf3b[_0xfd20('0x82')](_0x50072c[_0xfd20('0x33')]['ids'])['then'](function(){if(_['isArray'](_0x50072c['query'][_0xfd20('0x66')])){for(var _0x57eb09=0x0;_0x57eb09<_0x50072c['query'][_0xfd20('0x66')][_0xfd20('0x3a')];_0x57eb09+=0x1){socket[_0xfd20('0x84')]('userMailQueue:remove',{'UserId':Number(_0x50072c['query'][_0xfd20('0x66')][_0x57eb09]),'MailQueueId':Number(_0x50072c[_0xfd20('0x4a')]['id'])});}}else{socket['emit'](_0xfd20('0x87'),{'UserId':Number(_0x50072c[_0xfd20('0x33')][_0xfd20('0x66')]),'MailQueueId':Number(_0x50072c['params']['id'])});}});}})[_0xfd20('0x25')](respondWithStatusCode(_0x60c7dd,null))[_0xfd20('0x48')](handleError(_0x60c7dd,null));};exports[_0xfd20('0x88')]=function(_0xd256ae,_0x1961dd,_0x59ea0f){var _0xcdac00={};var _0x3ae082={};var _0x1861aa;var _0x1b7879;return db[_0xfd20('0x2d')][_0xfd20('0x58')]({'where':{'id':_0xd256ae[_0xfd20('0x4a')]['id']}})[_0xfd20('0x25')](handleEntityNotFound(_0x1961dd,null))[_0xfd20('0x25')](function(_0x30f1e7){if(_0x30f1e7){_0x1861aa=_0x30f1e7;_0x3ae082['model']=_['keys'](db[_0xfd20('0x67')][_0xfd20('0x2e')]);_0x3ae082[_0xfd20('0x33')]=_[_0xfd20('0x34')](_0xd256ae[_0xfd20('0x33')]);_0x3ae082[_0xfd20('0x35')]=_[_0xfd20('0x36')](_0x3ae082[_0xfd20('0x37')],_0x3ae082[_0xfd20('0x33')]);_0xcdac00['attributes']=_['intersection'](_0x3ae082[_0xfd20('0x37')],qs[_0xfd20('0x39')](_0xd256ae[_0xfd20('0x33')]['fields']));_0xcdac00[_0xfd20('0x38')]=_0xcdac00['attributes'][_0xfd20('0x3a')]?_0xcdac00[_0xfd20('0x38')]:_0x3ae082[_0xfd20('0x37')];_0xcdac00[_0xfd20('0x3d')]=qs[_0xfd20('0x3e')](_0xd256ae['query'][_0xfd20('0x3e')]);_0xcdac00[_0xfd20('0x3f')]=qs['filters'](_[_0xfd20('0x40')](_0xd256ae[_0xfd20('0x33')],_0x3ae082[_0xfd20('0x35')]));if(_0xd256ae['query'][_0xfd20('0x41')]){_0xcdac00[_0xfd20('0x3f')]=_[_0xfd20('0x42')](_0xcdac00[_0xfd20('0x3f')],{'$or':_[_0xfd20('0x32')](_0xcdac00[_0xfd20('0x38')],function(_0x44eee0){var _0x383faf={};_0x383faf[_0x44eee0]={'$like':'%'+_0xd256ae[_0xfd20('0x33')][_0xfd20('0x41')]+'%'};return _0x383faf;})});}_0xcdac00=_[_0xfd20('0x42')]({},_0xcdac00,_0xd256ae['options']);return _0x1861aa['getAgents'](_0xcdac00);}})[_0xfd20('0x25')](function(_0x44038e){if(_0x44038e){_0x1b7879=_0x44038e['length'];if(!_0xd256ae[_0xfd20('0x33')][_0xfd20('0x3b')](_0xfd20('0x3c'))){_0xcdac00['limit']=qs['limit'](_0xd256ae[_0xfd20('0x33')][_0xfd20('0x20')]);_0xcdac00['offset']=qs[_0xfd20('0x1e')](_0xd256ae[_0xfd20('0x33')][_0xfd20('0x1e')]);}return _0x1861aa[_0xfd20('0x88')](_0xcdac00);}})['then'](function(_0x48993b){if(_0x48993b){return _0x48993b?{'count':_0x1b7879,'rows':_0x48993b}:null;}})[_0xfd20('0x25')](respondWithResult(_0x1961dd,null))[_0xfd20('0x48')](handleError(_0x1961dd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 98f45c8..d505927 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 _0x81d1=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x384a78,_0x5ba914){var _0xf4933b=function(_0x550e1c){while(--_0x550e1c){_0x384a78['push'](_0x384a78['shift']());}};_0xf4933b(++_0x5ba914);}(_0x81d1,0xee));var _0x181d=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0x81d1[_0x11f5ff];return _0x46eefb;};'use strict';var EventEmitter=require(_0x181d('0x0'));var MailQueue=require(_0x181d('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x181d('0x2'),'afterUpdate':_0x181d('0x3'),'afterDestroy':_0x181d('0x4')};function emitEvent(_0x10add3){return function(_0x299acc,_0x514ba4,_0x28f11b){MailQueueEvents[_0x181d('0x5')](_0x10add3+':'+_0x299acc['id'],_0x299acc);MailQueueEvents[_0x181d('0x5')](_0x10add3,_0x299acc);_0x28f11b(null);};}for(var e in events){if(events[_0x181d('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x181d('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x923d=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x923d,0x126));var _0xd923=function(_0x78c638,_0x5bf830){_0x78c638=_0x78c638-0x0;var _0x5ddc25=_0x923d[_0x78c638];return _0x5ddc25;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xd923('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd923('0x1')](0x0);var events={'afterCreate':_0xd923('0x2'),'afterUpdate':_0xd923('0x3'),'afterDestroy':_0xd923('0x4')};function emitEvent(_0x259571){return function(_0x5a75c3,_0x2d16c7,_0x46fd3c){MailQueueEvents[_0xd923('0x5')](_0x259571+':'+_0x5a75c3['id'],_0x5a75c3);MailQueueEvents[_0xd923('0x5')](_0x259571,_0x5a75c3);_0x46fd3c(null);};}for(var e in events){if(events[_0xd923('0x6')](e)){var event=events[e];MailQueue[_0xd923('0x7')](e,emitEvent(event));}}module[_0xd923('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 d1fbf6e..244b700 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 _0xf21e=['MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x23a82e,_0x2d8bb9){var _0x3e8d19=function(_0x177f73){while(--_0x177f73){_0x23a82e['push'](_0x23a82e['shift']());}};_0x3e8d19(++_0x2d8bb9);}(_0xf21e,0x116));var _0xef21=function(_0x54fba0,_0x35decc){_0x54fba0=_0x54fba0-0x0;var _0x527d11=_0xf21e[_0x54fba0];return _0x527d11;};'use strict';var _=require(_0xef21('0x0'));var util=require(_0xef21('0x1'));var logger=require(_0xef21('0x2'))(_0xef21('0x3'));var moment=require(_0xef21('0x4'));var BPromise=require(_0xef21('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef21('0x6'));var rimraf=require('rimraf');var config=require(_0xef21('0x7'));var attributes=require('./mailQueue.attributes');module[_0xef21('0x8')]=function(_0x2d670f,_0x4995e9){return _0x2d670f[_0xef21('0x9')](_0xef21('0xa'),attributes,{'tableName':_0xef21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6ce=['util','../../config/logger','api','moment','bluebird','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x174c03,_0x2e8b12){var _0x9955=function(_0xa2211d){while(--_0xa2211d){_0x174c03['push'](_0x174c03['shift']());}};_0x9955(++_0x2e8b12);}(_0xa6ce,0x90));var _0xea6c=function(_0x21d0c3,_0x16c71c){_0x21d0c3=_0x21d0c3-0x0;var _0x4df18e=_0xa6ce[_0x21d0c3];return _0x4df18e;};'use strict';var _=require('lodash');var util=require(_0xea6c('0x0'));var logger=require(_0xea6c('0x1'))(_0xea6c('0x2'));var moment=require(_0xea6c('0x3'));var BPromise=require(_0xea6c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea6c('0x5'));var attributes=require(_0xea6c('0x6'));module[_0xea6c('0x7')]=function(_0x2db7f9,_0x2537bc){return _0x2db7f9[_0xea6c('0x8')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index e1c9e1c..cddf1a9 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 _0xdcb9=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','MailQueue','findAll','options','raw','limit','map','include','model','attributes','GetMailQueue','ShowMailQueue','find','where','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','then','info'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xdcb9,0xa7));var _0x9dcb=function(_0x260c94,_0x173070){_0x260c94=_0x260c94-0x0;var _0x5b909a=_0xdcb9[_0x260c94];return _0x5b909a;};'use strict';var _=require(_0x9dcb('0x0'));var util=require('util');var moment=require(_0x9dcb('0x1'));var BPromise=require(_0x9dcb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dcb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9dcb('0x4'));var config=require(_0x9dcb('0x5'));var jayson=require(_0x9dcb('0x6'));var client=jayson[_0x9dcb('0x7')]['http']({'port':0x232a});config[_0x9dcb('0x8')]=_['defaults'](config[_0x9dcb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9dcb('0x9'))(new Redis(config[_0x9dcb('0x8')]));require('./mailQueue.socket')[_0x9dcb('0xa')](socket);function respondWithRpcPromise(_0x53d700,_0x58b979,_0x130f04){return new BPromise(function(_0x46bd0a,_0x23773d){return client['request'](_0x53d700,_0x130f04)[_0x9dcb('0xb')](function(_0x4619c2){logger[_0x9dcb('0xc')]('MailQueue,\x20%s,\x20%s',_0x58b979,_0x9dcb('0xd'));logger[_0x9dcb('0xe')](_0x9dcb('0xf'),_0x58b979,_0x9dcb('0xd'),JSON[_0x9dcb('0x10')](_0x4619c2));if(_0x4619c2[_0x9dcb('0x11')]){if(_0x4619c2[_0x9dcb('0x11')][_0x9dcb('0x12')]===0x1f4){logger[_0x9dcb('0x11')]('MailQueue,\x20%s,\x20%s',_0x58b979,_0x4619c2[_0x9dcb('0x11')]['message']);return _0x23773d(_0x4619c2[_0x9dcb('0x11')]['message']);}logger[_0x9dcb('0x11')](_0x9dcb('0x13'),_0x58b979,_0x4619c2[_0x9dcb('0x11')][_0x9dcb('0x14')]);return _0x46bd0a(_0x4619c2[_0x9dcb('0x11')][_0x9dcb('0x14')]);}else{logger['info'](_0x9dcb('0x13'),_0x58b979,_0x9dcb('0xd'));_0x46bd0a(_0x4619c2[_0x9dcb('0x15')][_0x9dcb('0x14')]);}})[_0x9dcb('0x16')](function(_0x2559c4){logger[_0x9dcb('0x11')](_0x9dcb('0x13'),_0x58b979,_0x2559c4);_0x23773d(_0x2559c4);});});}exports['GetMailQueue']=function(_0xf52196){var _0x32e5ba=this;return new Promise(function(_0x41b93c,_0x33d6a5){return db[_0x9dcb('0x17')][_0x9dcb('0x18')]({'raw':_0xf52196[_0x9dcb('0x19')]?_0xf52196[_0x9dcb('0x19')][_0x9dcb('0x1a')]===undefined?!![]:![]:!![],'where':_0xf52196[_0x9dcb('0x19')]?_0xf52196['options']['where']||null:null,'attributes':_0xf52196[_0x9dcb('0x19')]?_0xf52196[_0x9dcb('0x19')]['attributes']||null:null,'limit':_0xf52196[_0x9dcb('0x19')]?_0xf52196[_0x9dcb('0x19')][_0x9dcb('0x1b')]||null:null,'include':_0xf52196[_0x9dcb('0x19')]?_0xf52196['options']['include']?_[_0x9dcb('0x1c')](_0xf52196[_0x9dcb('0x19')][_0x9dcb('0x1d')],function(_0x577cbe){return{'model':db[_0x577cbe[_0x9dcb('0x1e')]],'as':_0x577cbe['as'],'attributes':_0x577cbe[_0x9dcb('0x1f')],'include':_0x577cbe[_0x9dcb('0x1d')]?_['map'](_0x577cbe[_0x9dcb('0x1d')],function(_0x3c0f81){return{'model':db[_0x3c0f81[_0x9dcb('0x1e')]],'as':_0x3c0f81['as'],'attributes':_0x3c0f81['attributes'],'include':_0x3c0f81['include']?_[_0x9dcb('0x1c')](_0x3c0f81[_0x9dcb('0x1d')],function(_0x451092){return{'model':db[_0x451092[_0x9dcb('0x1e')]],'as':_0x451092['as'],'attributes':_0x451092[_0x9dcb('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9dcb('0xb')](function(_0x2ac638){logger[_0x9dcb('0xc')](_0x9dcb('0x20'),_0xf52196);logger[_0x9dcb('0xe')](_0x9dcb('0x20'),_0xf52196,JSON[_0x9dcb('0x10')](_0x2ac638));_0x41b93c(_0x2ac638);})['catch'](function(_0x1bcde0){logger[_0x9dcb('0x11')](_0x9dcb('0x20'),_0x1bcde0[_0x9dcb('0x14')],_0xf52196);_0x33d6a5(_0x32e5ba[_0x9dcb('0x11')](0x1f4,_0x1bcde0[_0x9dcb('0x14')]));});});};exports[_0x9dcb('0x21')]=function(_0x242800){var _0x2017dd=this;return new Promise(function(_0x2c00db,_0x494f61){return db['MailQueue'][_0x9dcb('0x22')]({'raw':_0x242800[_0x9dcb('0x19')]?_0x242800[_0x9dcb('0x19')][_0x9dcb('0x1a')]===undefined?!![]:![]:!![],'where':_0x242800[_0x9dcb('0x19')]?_0x242800[_0x9dcb('0x19')][_0x9dcb('0x23')]||null:null,'attributes':_0x242800[_0x9dcb('0x19')]?_0x242800[_0x9dcb('0x19')][_0x9dcb('0x1f')]||null:null,'include':_0x242800[_0x9dcb('0x19')]?_0x242800[_0x9dcb('0x19')][_0x9dcb('0x1d')]?_[_0x9dcb('0x1c')](_0x242800[_0x9dcb('0x19')][_0x9dcb('0x1d')],function(_0x121dbd){return{'model':db[_0x121dbd['model']],'as':_0x121dbd['as'],'attributes':_0x121dbd[_0x9dcb('0x1f')],'include':_0x121dbd['include']?_[_0x9dcb('0x1c')](_0x121dbd[_0x9dcb('0x1d')],function(_0x4da290){return{'model':db[_0x4da290[_0x9dcb('0x1e')]],'as':_0x4da290['as'],'attributes':_0x4da290[_0x9dcb('0x1f')],'include':_0x4da290['include']?_[_0x9dcb('0x1c')](_0x4da290[_0x9dcb('0x1d')],function(_0x3e4363){return{'model':db[_0x3e4363['model']],'as':_0x3e4363['as'],'attributes':_0x3e4363[_0x9dcb('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9dcb('0xb')](function(_0x353e75){logger[_0x9dcb('0xc')](_0x9dcb('0x21'),_0x242800);logger['debug'](_0x9dcb('0x21'),_0x242800,JSON[_0x9dcb('0x10')](_0x353e75));_0x2c00db(_0x353e75);})[_0x9dcb('0x16')](function(_0x3d948e){logger[_0x9dcb('0x11')]('ShowMailQueue',_0x3d948e[_0x9dcb('0x14')],_0x242800);_0x494f61(_0x2017dd['error'](0x1f4,_0x3d948e[_0x9dcb('0x14')]));});});}; \ No newline at end of file +var _0xd549=['code','error','message','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','map','include','model','ShowMailQueue','find','raw','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x45f426,_0x1db67b){var _0x3d1326=function(_0x1514a7){while(--_0x1514a7){_0x45f426['push'](_0x45f426['shift']());}};_0x3d1326(++_0x1db67b);}(_0xd549,0xde));var _0x9d54=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd549[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x9d54('0x0'));var util=require('util');var moment=require(_0x9d54('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d54('0x2'));var db=require(_0x9d54('0x3'))['db'];var utils=require(_0x9d54('0x4'));var logger=require(_0x9d54('0x5'))(_0x9d54('0x6'));var config=require(_0x9d54('0x7'));var jayson=require(_0x9d54('0x8'));var client=jayson[_0x9d54('0x9')]['http']({'port':0x232a});config[_0x9d54('0xa')]=_[_0x9d54('0xb')](config[_0x9d54('0xa')],{'host':_0x9d54('0xc'),'port':0x18eb});var socket=require(_0x9d54('0xd'))(new Redis(config['redis']));require(_0x9d54('0xe'))[_0x9d54('0xf')](socket);function respondWithRpcPromise(_0x15d401,_0x37fd0a,_0x254873){return new BPromise(function(_0x281ab9,_0x557efb){return client[_0x9d54('0x10')](_0x15d401,_0x254873)[_0x9d54('0x11')](function(_0xe62a87){logger[_0x9d54('0x12')](_0x9d54('0x13'),_0x37fd0a,_0x9d54('0x14'));logger[_0x9d54('0x15')](_0x9d54('0x16'),_0x37fd0a,_0x9d54('0x14'),JSON[_0x9d54('0x17')](_0xe62a87));if(_0xe62a87['error']){if(_0xe62a87['error'][_0x9d54('0x18')]===0x1f4){logger[_0x9d54('0x19')](_0x9d54('0x13'),_0x37fd0a,_0xe62a87[_0x9d54('0x19')][_0x9d54('0x1a')]);return _0x557efb(_0xe62a87[_0x9d54('0x19')][_0x9d54('0x1a')]);}logger[_0x9d54('0x19')]('MailQueue,\x20%s,\x20%s',_0x37fd0a,_0xe62a87['error'][_0x9d54('0x1a')]);return _0x281ab9(_0xe62a87[_0x9d54('0x19')][_0x9d54('0x1a')]);}else{logger[_0x9d54('0x12')](_0x9d54('0x13'),_0x37fd0a,_0x9d54('0x14'));_0x281ab9(_0xe62a87['result'][_0x9d54('0x1a')]);}})[_0x9d54('0x1b')](function(_0x2c512b){logger[_0x9d54('0x19')](_0x9d54('0x13'),_0x37fd0a,_0x2c512b);_0x557efb(_0x2c512b);});});}exports[_0x9d54('0x1c')]=function(_0x4b57fe){var _0x537152=this;return new Promise(function(_0x131dd1,_0x4f6580){return db[_0x9d54('0x1d')][_0x9d54('0x1e')]({'raw':_0x4b57fe[_0x9d54('0x1f')]?_0x4b57fe[_0x9d54('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4b57fe['options']?_0x4b57fe[_0x9d54('0x1f')][_0x9d54('0x20')]||null:null,'attributes':_0x4b57fe['options']?_0x4b57fe[_0x9d54('0x1f')][_0x9d54('0x21')]||null:null,'limit':_0x4b57fe[_0x9d54('0x1f')]?_0x4b57fe[_0x9d54('0x1f')][_0x9d54('0x22')]||null:null,'include':_0x4b57fe[_0x9d54('0x1f')]?_0x4b57fe[_0x9d54('0x1f')]['include']?_[_0x9d54('0x23')](_0x4b57fe[_0x9d54('0x1f')][_0x9d54('0x24')],function(_0xf17fd7){return{'model':db[_0xf17fd7[_0x9d54('0x25')]],'as':_0xf17fd7['as'],'attributes':_0xf17fd7[_0x9d54('0x21')],'include':_0xf17fd7['include']?_['map'](_0xf17fd7[_0x9d54('0x24')],function(_0x1ff003){return{'model':db[_0x1ff003['model']],'as':_0x1ff003['as'],'attributes':_0x1ff003[_0x9d54('0x21')],'include':_0x1ff003['include']?_[_0x9d54('0x23')](_0x1ff003[_0x9d54('0x24')],function(_0x3fb762){return{'model':db[_0x3fb762['model']],'as':_0x3fb762['as'],'attributes':_0x3fb762[_0x9d54('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9d54('0x11')](function(_0x5df09){logger[_0x9d54('0x12')](_0x9d54('0x1c'),_0x4b57fe);logger[_0x9d54('0x15')](_0x9d54('0x1c'),_0x4b57fe,JSON[_0x9d54('0x17')](_0x5df09));_0x131dd1(_0x5df09);})[_0x9d54('0x1b')](function(_0x16296f){logger[_0x9d54('0x19')](_0x9d54('0x1c'),_0x16296f[_0x9d54('0x1a')],_0x4b57fe);_0x4f6580(_0x537152[_0x9d54('0x19')](0x1f4,_0x16296f[_0x9d54('0x1a')]));});});};exports[_0x9d54('0x26')]=function(_0x29b22f){var _0x5ae871=this;return new Promise(function(_0x5c8e3b,_0x14811c){return db[_0x9d54('0x1d')][_0x9d54('0x27')]({'raw':_0x29b22f['options']?_0x29b22f[_0x9d54('0x1f')][_0x9d54('0x28')]===undefined?!![]:![]:!![],'where':_0x29b22f[_0x9d54('0x1f')]?_0x29b22f[_0x9d54('0x1f')][_0x9d54('0x20')]||null:null,'attributes':_0x29b22f['options']?_0x29b22f['options']['attributes']||null:null,'include':_0x29b22f[_0x9d54('0x1f')]?_0x29b22f['options'][_0x9d54('0x24')]?_['map'](_0x29b22f[_0x9d54('0x1f')][_0x9d54('0x24')],function(_0x2eb765){return{'model':db[_0x2eb765[_0x9d54('0x25')]],'as':_0x2eb765['as'],'attributes':_0x2eb765['attributes'],'include':_0x2eb765['include']?_[_0x9d54('0x23')](_0x2eb765['include'],function(_0x4f99bd){return{'model':db[_0x4f99bd[_0x9d54('0x25')]],'as':_0x4f99bd['as'],'attributes':_0x4f99bd[_0x9d54('0x21')],'include':_0x4f99bd[_0x9d54('0x24')]?_[_0x9d54('0x23')](_0x4f99bd[_0x9d54('0x24')],function(_0x24cc9c){return{'model':db[_0x24cc9c[_0x9d54('0x25')]],'as':_0x24cc9c['as'],'attributes':_0x24cc9c[_0x9d54('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9d54('0x11')](function(_0x2f5d5e){logger[_0x9d54('0x12')](_0x9d54('0x26'),_0x29b22f);logger[_0x9d54('0x15')](_0x9d54('0x26'),_0x29b22f,JSON[_0x9d54('0x17')](_0x2f5d5e));_0x5c8e3b(_0x2f5d5e);})['catch'](function(_0xd3798){logger['error'](_0x9d54('0x26'),_0xd3798[_0x9d54('0x1a')],_0x29b22f);_0x14811c(_0x5ae871[_0x9d54('0x19')](0x1f4,_0xd3798[_0x9d54('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index f991e9e..6eec5b2 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 _0xa643=['register','mailQueue:','./mailQueue.events','save','update','emit'];(function(_0x4826c2,_0x4112d8){var _0x250a64=function(_0x36f6e8){while(--_0x36f6e8){_0x4826c2['push'](_0x4826c2['shift']());}};_0x250a64(++_0x4112d8);}(_0xa643,0x11c));var _0x3a64=function(_0x44027c,_0x249879){_0x44027c=_0x44027c-0x0;var _0x3c01c3=_0xa643[_0x44027c];return _0x3c01c3;};'use strict';var MailQueueEvents=require(_0x3a64('0x0'));var events=[_0x3a64('0x1'),'remove',_0x3a64('0x2')];function createListener(_0x1639f2,_0x4dd79b){return function(_0x2c13fb){_0x4dd79b[_0x3a64('0x3')](_0x1639f2,_0x2c13fb);};}function removeListener(_0x21d5a8,_0x147eb0){return function(){MailQueueEvents['removeListener'](_0x21d5a8,_0x147eb0);};}exports[_0x3a64('0x4')]=function(_0x14e51b){for(var _0x207bec=0x0,_0x389fda=events['length'];_0x207bec<_0x389fda;_0x207bec++){var _0x313eda=events[_0x207bec];var _0x49dd47=createListener(_0x3a64('0x5')+_0x313eda,_0x14e51b);MailQueueEvents['on'](_0x313eda,_0x49dd47);}}; \ No newline at end of file +var _0x8b49=['remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0x8b49,0xb2));var _0x98b4=function(_0x10cfc2,_0x1cffff){_0x10cfc2=_0x10cfc2-0x0;var _0x19f55e=_0x8b49[_0x10cfc2];return _0x19f55e;};'use strict';var MailQueueEvents=require(_0x98b4('0x0'));var events=[_0x98b4('0x1'),_0x98b4('0x2'),_0x98b4('0x3')];function createListener(_0x4e0194,_0x32429){return function(_0x10da1d){_0x32429[_0x98b4('0x4')](_0x4e0194,_0x10da1d);};}function removeListener(_0x39e387,_0x36034b){return function(){MailQueueEvents[_0x98b4('0x5')](_0x39e387,_0x36034b);};}exports[_0x98b4('0x6')]=function(_0xb698fb){for(var _0x5c47f4=0x0,_0x39d3ac=events[_0x98b4('0x7')];_0x5c47f4<_0x39d3ac;_0x5c47f4++){var _0x10a466=events[_0x5c47f4];var _0x4ce75a=createListener(_0x98b4('0x8')+_0x10a466,_0xb698fb);MailQueueEvents['on'](_0x10a466,_0x4ce75a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6a97a01..e3fbde7 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 _0xf2c5=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x501c08,_0x5ba05c){var _0x499871=function(_0x34cf74){while(--_0x34cf74){_0x501c08['push'](_0x501c08['shift']());}};_0x499871(++_0x5ba05c);}(_0xf2c5,0x108));var _0x5f2c=function(_0x31de60,_0x3ef28e){_0x31de60=_0x31de60-0x0;var _0x99a68b=_0xf2c5[_0x31de60];return _0x99a68b;};'use strict';var multer=require(_0x5f2c('0x0'));var util=require(_0x5f2c('0x1'));var path=require(_0x5f2c('0x2'));var timeout=require(_0x5f2c('0x3'));var express=require(_0x5f2c('0x4'));var router=express[_0x5f2c('0x5')]();var fs_extra=require(_0x5f2c('0x6'));var auth=require(_0x5f2c('0x7'));var interaction=require(_0x5f2c('0x8'));var config=require(_0x5f2c('0x9'));var controller=require(_0x5f2c('0xa'));router[_0x5f2c('0xb')]('/',auth[_0x5f2c('0xc')](),controller['index']);router['get']('/describe',auth[_0x5f2c('0xc')](),controller[_0x5f2c('0xd')]);router[_0x5f2c('0xb')](_0x5f2c('0xe'),auth[_0x5f2c('0xc')](),controller[_0x5f2c('0xf')]);router[_0x5f2c('0x10')]('/',auth[_0x5f2c('0xc')](),controller['create']);router[_0x5f2c('0x11')](_0x5f2c('0xe'),auth['isAuthenticated'](),controller[_0x5f2c('0x12')]);router[_0x5f2c('0x13')](_0x5f2c('0xe'),auth[_0x5f2c('0xc')](),controller[_0x5f2c('0x14')]);module[_0x5f2c('0x15')]=router; \ No newline at end of file +var _0x4be1=['isAuthenticated','get','/describe','describe','/:id','post','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x32ad69,_0x518f0c){var _0x1062ef=function(_0x59b1c5){while(--_0x59b1c5){_0x32ad69['push'](_0x32ad69['shift']());}};_0x1062ef(++_0x518f0c);}(_0x4be1,0x173));var _0x14be=function(_0x435fa1,_0x58550a){_0x435fa1=_0x435fa1-0x0;var _0x845f9f=_0x4be1[_0x435fa1];return _0x845f9f;};'use strict';var multer=require(_0x14be('0x0'));var util=require(_0x14be('0x1'));var path=require(_0x14be('0x2'));var timeout=require('connect-timeout');var express=require(_0x14be('0x3'));var router=express[_0x14be('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x14be('0x5'));var interaction=require(_0x14be('0x6'));var config=require(_0x14be('0x7'));var controller=require(_0x14be('0x8'));router['get']('/',auth[_0x14be('0x9')](),controller['index']);router[_0x14be('0xa')](_0x14be('0xb'),auth[_0x14be('0x9')](),controller[_0x14be('0xc')]);router['get'](_0x14be('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x14be('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x14be('0xf')](_0x14be('0xd'),auth['isAuthenticated'](),controller[_0x14be('0x10')]);router['delete'](_0x14be('0xd'),auth[_0x14be('0x9')](),controller[_0x14be('0x11')]);module[_0x14be('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index edb6c08..7bc53c0 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 _0xd7ba=['sequelize','exports','STRING','DATE','moment'];(function(_0x4c378e,_0x286afb){var _0xf41ce7=function(_0x48d22e){while(--_0x48d22e){_0x4c378e['push'](_0x4c378e['shift']());}};_0xf41ce7(++_0x286afb);}(_0xd7ba,0xef));var _0xad7b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd7ba[_0x19e35c];return _0x3e1fe8;};'use strict';var moment=require(_0xad7b('0x0'));var Sequelize=require(_0xad7b('0x1'));module[_0xad7b('0x2')]={'uniqueid':{'type':Sequelize[_0xad7b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xad7b('0x3')]},'joinAt':{'type':Sequelize[_0xad7b('0x4')]},'leaveAt':{'type':Sequelize[_0xad7b('0x4')]},'acceptAt':{'type':Sequelize[_0xad7b('0x4')]},'exitAt':{'type':Sequelize[_0xad7b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x35b5=['STRING','DATE','moment','sequelize','exports'];(function(_0x5eef28,_0x45a351){var _0x507ab0=function(_0xf9bb3b){while(--_0xf9bb3b){_0x5eef28['push'](_0x5eef28['shift']());}};_0x507ab0(++_0x45a351);}(_0x35b5,0xd4));var _0x535b=function(_0x172b32,_0x37d267){_0x172b32=_0x172b32-0x0;var _0x2d8448=_0x35b5[_0x172b32];return _0x2d8448;};'use strict';var moment=require(_0x535b('0x0'));var Sequelize=require(_0x535b('0x1'));module[_0x535b('0x2')]={'uniqueid':{'type':Sequelize[_0x535b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x535b('0x3')]},'joinAt':{'type':Sequelize[_0x535b('0x4')]},'leaveAt':{'type':Sequelize[_0x535b('0x4')]},'acceptAt':{'type':Sequelize[_0x535b('0x4')]},'exitAt':{'type':Sequelize[_0x535b('0x4')]},'reason':{'type':Sequelize[_0x535b('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8afbafe..e28df03 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 _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailQueueReport','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range'];(function(_0x41d6e6,_0x4b6344){var _0x3ee029=function(_0x5275f0){while(--_0x5275f0){_0x41d6e6['push'](_0x41d6e6['shift']());}};_0x3ee029(++_0x4b6344);}(_0xef0f,0x168));var _0xfef0=function(_0x8afda5,_0x2e17be){_0x8afda5=_0x8afda5-0x0;var _0x3c6203=_0xef0f[_0x8afda5];return _0x3c6203;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['MailQueueReport']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':!![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file +var _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0xacf4,0xe7));var _0x4acf=function(_0x470b24,_0x58a01e){_0x470b24=_0x470b24-0x0;var _0xde9b3d=_0xacf4[_0x470b24];return _0xde9b3d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['MailQueueReport'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['MailQueueReport']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 954657f..3870f9e 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 _0x3051=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash'];(function(_0x5e3850,_0x5c24a6){var _0x256103=function(_0x5d5316){while(--_0x5d5316){_0x5e3850['push'](_0x5e3850['shift']());}};_0x256103(++_0x5c24a6);}(_0x3051,0x179));var _0x1305=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3051[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1305('0x0'));var util=require(_0x1305('0x1'));var logger=require(_0x1305('0x2'))(_0x1305('0x3'));var moment=require(_0x1305('0x4'));var BPromise=require(_0x1305('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1305('0x6'));var rimraf=require(_0x1305('0x7'));var config=require(_0x1305('0x8'));var attributes=require(_0x1305('0x9'));module[_0x1305('0xa')]=function(_0x2b8772,_0x33f08f){return _0x2b8772[_0x1305('0xb')]('MailQueueReport',attributes,{'tableName':_0x1305('0xc'),'paranoid':![],'indexes':[{'name':_0x1305('0xd'),'fields':[_0x1305('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07f8=['rimraf','../../config/environment','MailQueueReport','lodash','util','../../config/logger','api','path'];(function(_0x39919a,_0x41c002){var _0x555e5f=function(_0x19add4){while(--_0x19add4){_0x39919a['push'](_0x39919a['shift']());}};_0x555e5f(++_0x41c002);}(_0x07f8,0x10b));var _0x807f=function(_0x4bae1a,_0x5b0916){_0x4bae1a=_0x4bae1a-0x0;var _0x27f6d2=_0x07f8[_0x4bae1a];return _0x27f6d2;};'use strict';var _=require(_0x807f('0x0'));var util=require(_0x807f('0x1'));var logger=require(_0x807f('0x2'))(_0x807f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x807f('0x4'));var rimraf=require(_0x807f('0x5'));var config=require(_0x807f('0x6'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x264a9a,_0x8409b5){return _0x264a9a['define'](_0x807f('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c9e3fc8..fce25d4 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(_0x3ce3aa,_0x5d431a){var _0x183fdb=function(_0x521fa5){while(--_0x521fa5){_0x3ce3aa['push'](_0x3ce3aa['shift']());}};_0x183fdb(++_0x5d431a);}(_0x7a54,0x106));var _0x47a5=function(_0x35db58,_0x5a8266){_0x35db58=_0x35db58-0x0;var _0x185809=_0x7a54[_0x35db58];return _0x185809;};'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(_0x2689b7,_0x10f485){var _0x5b8d25=function(_0x3ff34f){while(--_0x3ff34f){_0x2689b7['push'](_0x2689b7['shift']());}};_0x5b8d25(++_0x10f485);}(_0x7a54,0x106));var _0x47a5=function(_0x665e23,_0x51b3c7){_0x665e23=_0x665e23-0x0;var _0x5772a1=_0x7a54[_0x665e23];return _0x5772a1;};'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 9289485..625bb93 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(_0x1c2364,_0x2ed7e7){var _0x377217=function(_0x5b6aeb){while(--_0x5b6aeb){_0x1c2364['push'](_0x1c2364['shift']());}};_0x377217(++_0x2ed7e7);}(_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(_0x142695,_0x87ea20){var _0x4a9256=function(_0x28e50a){while(--_0x28e50a){_0x142695['push'](_0x142695['shift']());}};_0x4a9256(++_0x87ea20);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xcb91[_0x465a0c];return _0x1e202e;};'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 305fd02..bc684b0 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 _0x32f7=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x24f5b1,_0x350007){var _0x451a13=function(_0x30d668){while(--_0x30d668){_0x24f5b1['push'](_0x24f5b1['shift']());}};_0x451a13(++_0x350007);}(_0x32f7,0x16e));var _0x732f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x732f('0x0'));module[_0x732f('0x1')]={'description':{'type':Sequelize[_0x732f('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x732f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x732f('0x2')]},'password':{'type':Sequelize[_0x732f('0x2')]},'port':{'type':Sequelize[_0x732f('0x4')]},'tls':{'type':Sequelize[_0x732f('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x732f('0x2')],'defaultValue':_0x732f('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x732f('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x732f('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4aa3=['INBOX','INTEGER','exports','STRING','BOOLEAN'];(function(_0x5e9c73,_0x3d4285){var _0x52a488=function(_0x45ab43){while(--_0x45ab43){_0x5e9c73['push'](_0x5e9c73['shift']());}};_0x52a488(++_0x3d4285);}(_0x4aa3,0x147));var _0x34aa=function(_0x3bdaf8,_0x337944){_0x3bdaf8=_0x3bdaf8-0x0;var _0x46ff45=_0x4aa3[_0x3bdaf8];return _0x46ff45;};'use strict';var Sequelize=require('sequelize');module[_0x34aa('0x0')]={'description':{'type':Sequelize[_0x34aa('0x1')]},'host':{'type':Sequelize[_0x34aa('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x34aa('0x1')]},'password':{'type':Sequelize[_0x34aa('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x34aa('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x34aa('0x1')],'defaultValue':_0x34aa('0x3')},'connTimeout':{'type':Sequelize[_0x34aa('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x34aa('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x34aa('0x1')]},'modernAuthentication':{'type':Sequelize[_0x34aa('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 8379141..fd2293d 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 _0x4303=['MailServerIn','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x20cae2,_0x378d30){var _0x32229b=function(_0x2eac7a){while(--_0x2eac7a){_0x20cae2['push'](_0x20cae2['shift']());}};_0x32229b(++_0x378d30);}(_0x4303,0x181));var _0x3430=function(_0x3e959d,_0xf99412){_0x3e959d=_0x3e959d-0x0;var _0x3ba243=_0x4303[_0x3e959d];return _0x3ba243;};'use strict';var _=require(_0x3430('0x0'));var util=require(_0x3430('0x1'));var logger=require('../../config/logger')(_0x3430('0x2'));var moment=require(_0x3430('0x3'));var BPromise=require(_0x3430('0x4'));var rp=require(_0x3430('0x5'));var fs=require('fs');var path=require(_0x3430('0x6'));var rimraf=require('rimraf');var config=require(_0x3430('0x7'));var attributes=require(_0x3430('0x8'));module[_0x3430('0x9')]=function(_0x3785ec,_0x2ad315){return _0x3785ec[_0x3430('0xa')](_0x3430('0xb'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa8e=['MailServerIn','mail_servers_in','lodash','util','api','moment','bluebird','../../config/environment','./mailServerIn.attributes','define'];(function(_0xd0ba37,_0x382102){var _0xfd29f7=function(_0x1df6b9){while(--_0x1df6b9){_0xd0ba37['push'](_0xd0ba37['shift']());}};_0xfd29f7(++_0x382102);}(_0xaa8e,0x17e));var _0xeaa8=function(_0x2204d6,_0x28a32c){_0x2204d6=_0x2204d6-0x0;var _0x310c00=_0xaa8e[_0x2204d6];return _0x310c00;};'use strict';var _=require(_0xeaa8('0x0'));var util=require(_0xeaa8('0x1'));var logger=require('../../config/logger')(_0xeaa8('0x2'));var moment=require(_0xeaa8('0x3'));var BPromise=require(_0xeaa8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeaa8('0x5'));var attributes=require(_0xeaa8('0x6'));module['exports']=function(_0x107e96,_0xc490b7){return _0x107e96[_0xeaa8('0x7')](_0xeaa8('0x8'),attributes,{'tableName':_0xeaa8('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 19f500a..82f1216 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 _0x5712=['findAll','options','raw','limit','map','include','attributes','model','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetMailServerIn'];(function(_0x5ef2db,_0x21cb97){var _0x47eb89=function(_0x43340b){while(--_0x43340b){_0x5ef2db['push'](_0x5ef2db['shift']());}};_0x47eb89(++_0x21cb97);}(_0x5712,0x140));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('MailServerIn,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});}exports[_0x2571('0x14')]=function(_0x75af2a){var _0x576222=this;return new Promise(function(_0x7707,_0x3f2e5f){return db['MailServerIn'][_0x2571('0x15')]({'raw':_0x75af2a[_0x2571('0x16')]?_0x75af2a[_0x2571('0x16')][_0x2571('0x17')]===undefined?!![]:![]:!![],'where':_0x75af2a[_0x2571('0x16')]?_0x75af2a['options']['where']||null:null,'attributes':_0x75af2a[_0x2571('0x16')]?_0x75af2a[_0x2571('0x16')]['attributes']||null:null,'limit':_0x75af2a['options']?_0x75af2a[_0x2571('0x16')][_0x2571('0x18')]||null:null,'include':_0x75af2a[_0x2571('0x16')]?_0x75af2a[_0x2571('0x16')]['include']?_[_0x2571('0x19')](_0x75af2a['options'][_0x2571('0x1a')],function(_0x4316b1){return{'model':db[_0x4316b1['model']],'as':_0x4316b1['as'],'attributes':_0x4316b1[_0x2571('0x1b')],'include':_0x4316b1[_0x2571('0x1a')]?_[_0x2571('0x19')](_0x4316b1['include'],function(_0x5d455d){return{'model':db[_0x5d455d[_0x2571('0x1c')]],'as':_0x5d455d['as'],'attributes':_0x5d455d[_0x2571('0x1b')],'include':_0x5d455d[_0x2571('0x1a')]?_[_0x2571('0x19')](_0x5d455d[_0x2571('0x1a')],function(_0x246bbd){return{'model':db[_0x246bbd['model']],'as':_0x246bbd['as'],'attributes':_0x246bbd['attributes']};}):[]};}):[]};}):[]:[]})[_0x2571('0x1d')](function(_0x426615){logger[_0x2571('0x13')](_0x2571('0x14'),_0x75af2a);logger[_0x2571('0xe')](_0x2571('0x14'),_0x75af2a,JSON[_0x2571('0x10')](_0x426615));_0x7707(_0x426615);})[_0x2571('0x1e')](function(_0x1f7562){logger[_0x2571('0x11')]('GetMailServerIn',_0x1f7562[_0x2571('0x12')],_0x75af2a);_0x3f2e5f(_0x576222[_0x2571('0x11')](0x1f4,_0x1f7562[_0x2571('0x12')]));});});}; \ No newline at end of file +var _0x2413=['attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0x2413,0x1a1));var _0x3241=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2413[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3241('0x0'));var util=require('util');var moment=require(_0x3241('0x1'));var BPromise=require('bluebird');var rs=require(_0x3241('0x2'));var fs=require('fs');var Redis=require(_0x3241('0x3'));var db=require(_0x3241('0x4'))['db'];var utils=require(_0x3241('0x5'));var logger=require(_0x3241('0x6'))('rpc');var config=require(_0x3241('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3241('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19bcef,_0x39a113,_0x3ea78e){return new BPromise(function(_0x3a7848,_0x26dc64){return client[_0x3241('0x9')](_0x19bcef,_0x3ea78e)[_0x3241('0xa')](function(_0x1f2659){logger[_0x3241('0xb')]('MailServerIn,\x20%s,\x20%s',_0x39a113,'request\x20sent');logger[_0x3241('0xc')](_0x3241('0xd'),_0x39a113,_0x3241('0xe'),JSON[_0x3241('0xf')](_0x1f2659));if(_0x1f2659[_0x3241('0x10')]){if(_0x1f2659[_0x3241('0x10')]['code']===0x1f4){logger['error'](_0x3241('0x11'),_0x39a113,_0x1f2659['error'][_0x3241('0x12')]);return _0x26dc64(_0x1f2659[_0x3241('0x10')][_0x3241('0x12')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x39a113,_0x1f2659[_0x3241('0x10')][_0x3241('0x12')]);return _0x3a7848(_0x1f2659[_0x3241('0x10')][_0x3241('0x12')]);}else{logger[_0x3241('0xb')](_0x3241('0x11'),_0x39a113,_0x3241('0xe'));_0x3a7848(_0x1f2659[_0x3241('0x13')]['message']);}})[_0x3241('0x14')](function(_0xf5ba32){logger['error'](_0x3241('0x11'),_0x39a113,_0xf5ba32);_0x26dc64(_0xf5ba32);});});}exports[_0x3241('0x15')]=function(_0x4cdd14){var _0x3e4f8c=this;return new Promise(function(_0x5879eb,_0x266e00){return db[_0x3241('0x16')][_0x3241('0x17')]({'raw':_0x4cdd14[_0x3241('0x18')]?_0x4cdd14[_0x3241('0x18')][_0x3241('0x19')]===undefined?!![]:![]:!![],'where':_0x4cdd14['options']?_0x4cdd14['options'][_0x3241('0x1a')]||null:null,'attributes':_0x4cdd14['options']?_0x4cdd14[_0x3241('0x18')]['attributes']||null:null,'limit':_0x4cdd14[_0x3241('0x18')]?_0x4cdd14[_0x3241('0x18')][_0x3241('0x1b')]||null:null,'include':_0x4cdd14[_0x3241('0x18')]?_0x4cdd14['options'][_0x3241('0x1c')]?_[_0x3241('0x1d')](_0x4cdd14[_0x3241('0x18')]['include'],function(_0x1edaa8){return{'model':db[_0x1edaa8[_0x3241('0x1e')]],'as':_0x1edaa8['as'],'attributes':_0x1edaa8[_0x3241('0x1f')],'include':_0x1edaa8[_0x3241('0x1c')]?_[_0x3241('0x1d')](_0x1edaa8['include'],function(_0x586e9d){return{'model':db[_0x586e9d[_0x3241('0x1e')]],'as':_0x586e9d['as'],'attributes':_0x586e9d[_0x3241('0x1f')],'include':_0x586e9d['include']?_[_0x3241('0x1d')](_0x586e9d[_0x3241('0x1c')],function(_0x2947e6){return{'model':db[_0x2947e6[_0x3241('0x1e')]],'as':_0x2947e6['as'],'attributes':_0x2947e6[_0x3241('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3241('0xa')](function(_0x3a1d12){logger[_0x3241('0xb')]('GetMailServerIn',_0x4cdd14);logger[_0x3241('0xc')](_0x3241('0x15'),_0x4cdd14,JSON[_0x3241('0xf')](_0x3a1d12));_0x5879eb(_0x3a1d12);})['catch'](function(_0x37a529){logger[_0x3241('0x10')](_0x3241('0x15'),_0x37a529[_0x3241('0x12')],_0x4cdd14);_0x266e00(_0x3e4f8c[_0x3241('0x10')](0x1f4,_0x37a529[_0x3241('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 09aa8b6..7e6b93c 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x4339e5,_0x8d4cdc){_0x4339e5=_0x4339e5-0x0;var _0x33e442=_0x7a54[_0x4339e5];return _0x33e442;};'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 2616c82..ccde955 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 _0xbfcc=['sequelize','STRING','INTEGER'];(function(_0x2cc3fe,_0xa7db29){var _0x27c340=function(_0x38fefa){while(--_0x38fefa){_0x2cc3fe['push'](_0x2cc3fe['shift']());}};_0x27c340(++_0xa7db29);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xbfcc[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcbfc('0x1')]},'user':{'type':Sequelize[_0xcbfc('0x1')]},'pass':{'type':Sequelize[_0xcbfc('0x1')]},'port':{'type':Sequelize[_0xcbfc('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6324=['STRING','BOOLEAN','sequelize','exports'];(function(_0x26a10d,_0xe5c001){var _0xf90201=function(_0x48535b){while(--_0x48535b){_0x26a10d['push'](_0x26a10d['shift']());}};_0xf90201(++_0xe5c001);}(_0x6324,0x142));var _0x4632=function(_0x45f6cb,_0x531af6){_0x45f6cb=_0x45f6cb-0x0;var _0x5b7f93=_0x6324[_0x45f6cb];return _0x5b7f93;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'description':{'type':Sequelize[_0x4632('0x2')]},'host':{'type':Sequelize[_0x4632('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4632('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4632('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x4632('0x3')],'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 04b0958..ad565a4 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 _0xa16e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa16e,0x178));var _0xea16=function(_0x555615,_0x5125de){_0x555615=_0x555615-0x0;var _0x52461a=_0xa16e[_0x555615];return _0x52461a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xea16('0x0'));var jsonpatch=require(_0xea16('0x1'));var rp=require(_0xea16('0x2'));var moment=require(_0xea16('0x3'));var BPromise=require(_0xea16('0x4'));var Mustache=require('mustache');var util=require(_0xea16('0x5'));var path=require(_0xea16('0x6'));var sox=require(_0xea16('0x7'));var csv=require(_0xea16('0x8'));var ejs=require(_0xea16('0x9'));var fs=require('fs');var fs_extra=require(_0xea16('0xa'));var _=require(_0xea16('0xb'));var squel=require(_0xea16('0xc'));var crypto=require(_0xea16('0xd'));var jsforce=require(_0xea16('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xea16('0x8'));var querystring=require(_0xea16('0xf'));var Papa=require(_0xea16('0x10'));var Redis=require(_0xea16('0x11'));var authService=require(_0xea16('0x12'));var qs=require(_0xea16('0x13'));var as=require(_0xea16('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea16('0x15'))(_0xea16('0x16'));var utils=require('../../config/utils');var config=require(_0xea16('0x17'));var licenseUtil=require(_0xea16('0x18'));var db=require(_0xea16('0x19'))['db'];function respondWithStatusCode(_0x4654b6,_0x2855ee){_0x2855ee=_0x2855ee||0xcc;return function(_0x4bad30){if(_0x4bad30){return _0x4654b6['sendStatus'](_0x2855ee);}return _0x4654b6[_0xea16('0x1a')](_0x2855ee)['end']();};}function respondWithResult(_0x40803,_0x527e4a){_0x527e4a=_0x527e4a||0xc8;return function(_0x2f3fe9){if(_0x2f3fe9){return _0x40803['status'](_0x527e4a)[_0xea16('0x1b')](_0x2f3fe9);}};}function respondWithFilteredResult(_0x395973,_0x5f0787){return function(_0x3ec7bc){if(_0x3ec7bc){var _0x130fd2=typeof _0x5f0787[_0xea16('0x1c')]===_0xea16('0x1d')&&typeof _0x5f0787[_0xea16('0x1e')]==='undefined';var _0x14f2b8=_0x3ec7bc['count'];var _0x3cf84e=_0x130fd2?0x0:_0x5f0787[_0xea16('0x1c')];var _0x4dfb1b=_0x130fd2?_0x3ec7bc[_0xea16('0x1f')]:_0x5f0787[_0xea16('0x1c')]+_0x5f0787[_0xea16('0x1e')];var _0x41eda9;if(_0x4dfb1b>=_0x14f2b8){_0x4dfb1b=_0x14f2b8;_0x41eda9=0xc8;}else{_0x41eda9=0xce;}_0x395973['status'](_0x41eda9);return _0x395973['set'](_0xea16('0x20'),_0x3cf84e+'-'+_0x4dfb1b+'/'+_0x14f2b8)['json'](_0x3ec7bc);}return null;};}function patchUpdates(_0x201072){return function(_0x10b05e){try{jsonpatch[_0xea16('0x21')](_0x10b05e,_0x201072,!![]);}catch(_0x3ba1ba){return BPromise[_0xea16('0x22')](_0x3ba1ba);}return _0x10b05e[_0xea16('0x23')]();};}function saveUpdates(_0x93f51c,_0x5ba752){return function(_0x491337){if(_0x491337){return _0x491337['update'](_0x93f51c)[_0xea16('0x24')](function(_0x103862){return _0x103862;});}return null;};}function removeEntity(_0x4d70e0,_0xc2dca7){return function(_0x45ddb8){if(_0x45ddb8){return _0x45ddb8[_0xea16('0x25')]()[_0xea16('0x24')](function(){_0x4d70e0[_0xea16('0x1a')](0xcc)[_0xea16('0x26')]();});}};}function handleEntityNotFound(_0x326a08,_0x1c024c){return function(_0x52e591){if(!_0x52e591){_0x326a08[_0xea16('0x27')](0x194);}return _0x52e591;};}function handleError(_0x2c2ff9,_0x55bbb5){_0x55bbb5=_0x55bbb5||0x1f4;return function(_0x10934c){logger[_0xea16('0x28')](_0x10934c[_0xea16('0x29')]);if(_0x10934c[_0xea16('0x2a')]){delete _0x10934c[_0xea16('0x2a')];}_0x2c2ff9[_0xea16('0x1a')](_0x55bbb5)[_0xea16('0x2b')](_0x10934c);};}exports[_0xea16('0x2c')]=function(_0x573f4d,_0x4047a4){var _0x28ee47={},_0x55ef3f={},_0x4a7c0e={'count':0x0,'rows':[]};var _0x2fef22=_[_0xea16('0x2d')](db[_0xea16('0x2e')][_0xea16('0x2f')],function(_0x3449de){return{'name':_0x3449de[_0xea16('0x30')],'type':_0x3449de[_0xea16('0x31')][_0xea16('0x32')]};});_0x55ef3f[_0xea16('0x33')]=_['map'](_0x2fef22,_0xea16('0x2a'));_0x55ef3f[_0xea16('0x34')]=_[_0xea16('0x35')](_0x573f4d['query']);_0x55ef3f[_0xea16('0x36')]=_[_0xea16('0x37')](_0x55ef3f['model'],_0x55ef3f[_0xea16('0x34')]);_0x28ee47[_0xea16('0x38')]=_[_0xea16('0x37')](_0x55ef3f['model'],qs[_0xea16('0x39')](_0x573f4d[_0xea16('0x34')][_0xea16('0x39')]));_0x28ee47[_0xea16('0x38')]=_0x28ee47[_0xea16('0x38')]['length']?_0x28ee47[_0xea16('0x38')]:_0x55ef3f[_0xea16('0x33')];if(!_0x573f4d[_0xea16('0x34')][_0xea16('0x3a')](_0xea16('0x3b'))){_0x28ee47[_0xea16('0x1e')]=qs[_0xea16('0x1e')](_0x573f4d['query'][_0xea16('0x1e')]);_0x28ee47[_0xea16('0x1c')]=qs[_0xea16('0x1c')](_0x573f4d[_0xea16('0x34')]['offset']);}_0x28ee47[_0xea16('0x3c')]=qs[_0xea16('0x3d')](_0x573f4d[_0xea16('0x34')][_0xea16('0x3d')]);_0x28ee47[_0xea16('0x3e')]=qs[_0xea16('0x36')](_[_0xea16('0x3f')](_0x573f4d[_0xea16('0x34')],_0x55ef3f[_0xea16('0x36')]),_0x2fef22);if(_0x573f4d['query']['filter']){_0x28ee47[_0xea16('0x3e')]=_['merge'](_0x28ee47[_0xea16('0x3e')],{'$or':_[_0xea16('0x2d')](_0x2fef22,function(_0x14b2fb){if(_0x14b2fb[_0xea16('0x31')]!==_0xea16('0x40')){var _0x12550b={};_0x12550b[_0x14b2fb['name']]={'$like':'%'+_0x573f4d[_0xea16('0x34')][_0xea16('0x41')]+'%'};return _0x12550b;}})});}_0x28ee47=_['merge']({},_0x28ee47,_0x573f4d[_0xea16('0x42')]);var _0x329b74={'where':_0x28ee47[_0xea16('0x3e')]};return db['MailServerOut'][_0xea16('0x1f')](_0x329b74)['then'](function(_0x4ccd46){_0x4a7c0e[_0xea16('0x1f')]=_0x4ccd46;if(_0x573f4d['query'][_0xea16('0x43')]){_0x28ee47[_0xea16('0x44')]=[{'all':!![]}];}return db['MailServerOut'][_0xea16('0x45')](_0x28ee47);})[_0xea16('0x24')](function(_0x3b3547){_0x4a7c0e[_0xea16('0x46')]=_0x3b3547;return _0x4a7c0e;})[_0xea16('0x24')](respondWithFilteredResult(_0x4047a4,_0x28ee47))[_0xea16('0x47')](handleError(_0x4047a4,null));};exports[_0xea16('0x48')]=function(_0x4f445e,_0x410b44){var _0x2187a1={'raw':!![],'where':{'id':_0x4f445e[_0xea16('0x49')]['id']}},_0x7c04c8={};_0x7c04c8[_0xea16('0x33')]=_[_0xea16('0x35')](db[_0xea16('0x2e')][_0xea16('0x2f')]);_0x7c04c8[_0xea16('0x34')]=_['keys'](_0x4f445e[_0xea16('0x34')]);_0x7c04c8[_0xea16('0x36')]=_['intersection'](_0x7c04c8[_0xea16('0x33')],_0x7c04c8[_0xea16('0x34')]);_0x2187a1[_0xea16('0x38')]=_['intersection'](_0x7c04c8[_0xea16('0x33')],qs['fields'](_0x4f445e[_0xea16('0x34')][_0xea16('0x39')]));_0x2187a1[_0xea16('0x38')]=_0x2187a1[_0xea16('0x38')]['length']?_0x2187a1[_0xea16('0x38')]:_0x7c04c8['model'];if(_0x4f445e[_0xea16('0x34')]['includeAll']){_0x2187a1[_0xea16('0x44')]=[{'all':!![]}];}_0x2187a1=_[_0xea16('0x4a')]({},_0x2187a1,_0x4f445e[_0xea16('0x42')]);return db[_0xea16('0x2e')][_0xea16('0x4b')](_0x2187a1)[_0xea16('0x24')](handleEntityNotFound(_0x410b44,null))['then'](respondWithResult(_0x410b44,null))['catch'](handleError(_0x410b44,null));};exports['create']=function(_0x23159c,_0x150d35){return db['MailServerOut'][_0xea16('0x4c')](_0x23159c[_0xea16('0x4d')],{})['then'](respondWithResult(_0x150d35,0xc9))[_0xea16('0x47')](handleError(_0x150d35,null));};exports[_0xea16('0x4e')]=function(_0x399fd2,_0x3f74a5){if(_0x399fd2[_0xea16('0x4d')]['id']){delete _0x399fd2[_0xea16('0x4d')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x399fd2[_0xea16('0x49')]['id']}})[_0xea16('0x24')](handleEntityNotFound(_0x3f74a5,null))[_0xea16('0x24')](saveUpdates(_0x399fd2[_0xea16('0x4d')],null))[_0xea16('0x24')](respondWithResult(_0x3f74a5,null))[_0xea16('0x47')](handleError(_0x3f74a5,null));};exports['destroy']=function(_0x792752,_0x74fa31){return db[_0xea16('0x2e')][_0xea16('0x4b')]({'where':{'id':_0x792752[_0xea16('0x49')]['id']}})[_0xea16('0x24')](handleEntityNotFound(_0x74fa31,null))[_0xea16('0x24')](removeEntity(_0x74fa31,null))[_0xea16('0x47')](handleError(_0x74fa31,null));}; \ No newline at end of file +var _0x10a7=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','MailServerOut','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring'];(function(_0x144b82,_0x31602f){var _0x32bda3=function(_0x1f159e){while(--_0x1f159e){_0x144b82['push'](_0x144b82['shift']());}};_0x32bda3(++_0x31602f);}(_0x10a7,0xc9));var _0x710a=function(_0x648409,_0x4312be){_0x648409=_0x648409-0x0;var _0x37d2c8=_0x10a7[_0x648409];return _0x37d2c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x710a('0x0'));var zipdir=require(_0x710a('0x1'));var jsonpatch=require(_0x710a('0x2'));var rp=require(_0x710a('0x3'));var moment=require('moment');var BPromise=require(_0x710a('0x4'));var Mustache=require(_0x710a('0x5'));var util=require('util');var path=require(_0x710a('0x6'));var sox=require(_0x710a('0x7'));var csv=require(_0x710a('0x8'));var ejs=require(_0x710a('0x9'));var fs=require('fs');var fs_extra=require(_0x710a('0xa'));var _=require('lodash');var squel=require(_0x710a('0xb'));var crypto=require(_0x710a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x710a('0xd'));var toCsv=require(_0x710a('0x8'));var querystring=require(_0x710a('0xe'));var Papa=require('papaparse');var Redis=require(_0x710a('0xf'));var authService=require(_0x710a('0x10'));var qs=require(_0x710a('0x11'));var as=require(_0x710a('0x12'));var hardwareService=require(_0x710a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x710a('0x14'));var config=require(_0x710a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x710a('0x16'))['db'];function respondWithStatusCode(_0x1019d7,_0x4f37e3){_0x4f37e3=_0x4f37e3||0xcc;return function(_0x1bcadb){if(_0x1bcadb){return _0x1019d7[_0x710a('0x17')](_0x4f37e3);}return _0x1019d7[_0x710a('0x18')](_0x4f37e3)['end']();};}function respondWithResult(_0x2c3fcd,_0x13bb53){_0x13bb53=_0x13bb53||0xc8;return function(_0x2d1fbd){if(_0x2d1fbd){return _0x2c3fcd[_0x710a('0x18')](_0x13bb53)['json'](_0x2d1fbd);}};}function respondWithFilteredResult(_0x11732c,_0x18524e){return function(_0x55fc5a){if(_0x55fc5a){var _0x3ed328=typeof _0x18524e[_0x710a('0x19')]===_0x710a('0x1a')&&typeof _0x18524e['limit']===_0x710a('0x1a');var _0x4f8cef=_0x55fc5a[_0x710a('0x1b')];var _0x259401=_0x3ed328?0x0:_0x18524e[_0x710a('0x19')];var _0x2586dd=_0x3ed328?_0x55fc5a[_0x710a('0x1b')]:_0x18524e[_0x710a('0x19')]+_0x18524e['limit'];var _0x2d97a6;if(_0x2586dd>=_0x4f8cef){_0x2586dd=_0x4f8cef;_0x2d97a6=0xc8;}else{_0x2d97a6=0xce;}_0x11732c['status'](_0x2d97a6);return _0x11732c[_0x710a('0x1c')](_0x710a('0x1d'),_0x259401+'-'+_0x2586dd+'/'+_0x4f8cef)[_0x710a('0x1e')](_0x55fc5a);}return null;};}function patchUpdates(_0xccbdcb){return function(_0x15ee00){try{jsonpatch[_0x710a('0x1f')](_0x15ee00,_0xccbdcb,!![]);}catch(_0x186373){return BPromise[_0x710a('0x20')](_0x186373);}return _0x15ee00[_0x710a('0x21')]();};}function saveUpdates(_0x284e48,_0x8ccf0b){return function(_0x2822dc){if(_0x2822dc){return _0x2822dc[_0x710a('0x22')](_0x284e48)[_0x710a('0x23')](function(_0x434eb3){return _0x434eb3;});}return null;};}function removeEntity(_0x218e1e,_0x3e294b){return function(_0x12778e){if(_0x12778e){return _0x12778e[_0x710a('0x24')]()[_0x710a('0x23')](function(){_0x218e1e['status'](0xcc)[_0x710a('0x25')]();});}};}function handleEntityNotFound(_0x2dcfb6,_0x15cbf1){return function(_0x3c17a1){if(!_0x3c17a1){_0x2dcfb6[_0x710a('0x17')](0x194);}return _0x3c17a1;};}function handleError(_0x12fd27,_0x2c7a2f){_0x2c7a2f=_0x2c7a2f||0x1f4;return function(_0x355ac9){logger[_0x710a('0x26')](_0x355ac9['stack']);if(_0x355ac9['name']){delete _0x355ac9[_0x710a('0x27')];}_0x12fd27[_0x710a('0x18')](_0x2c7a2f)[_0x710a('0x28')](_0x355ac9);};}exports[_0x710a('0x29')]=function(_0x58d56c,_0xf834d8){var _0x51f97b={},_0x510015={},_0x2293cb={'count':0x0,'rows':[]};var _0x532390=_[_0x710a('0x2a')](db[_0x710a('0x2b')][_0x710a('0x2c')],function(_0x4e0edd){return{'name':_0x4e0edd['fieldName'],'type':_0x4e0edd[_0x710a('0x2d')]['key']};});_0x510015[_0x710a('0x2e')]=_['map'](_0x532390,'name');_0x510015[_0x710a('0x2f')]=_[_0x710a('0x30')](_0x58d56c[_0x710a('0x2f')]);_0x510015[_0x710a('0x31')]=_[_0x710a('0x32')](_0x510015[_0x710a('0x2e')],_0x510015[_0x710a('0x2f')]);_0x51f97b[_0x710a('0x33')]=_[_0x710a('0x32')](_0x510015[_0x710a('0x2e')],qs[_0x710a('0x34')](_0x58d56c['query'][_0x710a('0x34')]));_0x51f97b[_0x710a('0x33')]=_0x51f97b[_0x710a('0x33')][_0x710a('0x35')]?_0x51f97b[_0x710a('0x33')]:_0x510015[_0x710a('0x2e')];if(!_0x58d56c[_0x710a('0x2f')]['hasOwnProperty']('nolimit')){_0x51f97b['limit']=qs[_0x710a('0x36')](_0x58d56c['query'][_0x710a('0x36')]);_0x51f97b['offset']=qs['offset'](_0x58d56c[_0x710a('0x2f')][_0x710a('0x19')]);}_0x51f97b[_0x710a('0x37')]=qs[_0x710a('0x38')](_0x58d56c['query'][_0x710a('0x38')]);_0x51f97b[_0x710a('0x39')]=qs[_0x710a('0x31')](_[_0x710a('0x3a')](_0x58d56c[_0x710a('0x2f')],_0x510015['filters']),_0x532390);if(_0x58d56c[_0x710a('0x2f')][_0x710a('0x3b')]){_0x51f97b['where']=_[_0x710a('0x3c')](_0x51f97b['where'],{'$or':_['map'](_0x532390,function(_0x5642d9){if(_0x5642d9[_0x710a('0x2d')]!==_0x710a('0x3d')){var _0x21ccb6={};_0x21ccb6[_0x5642d9[_0x710a('0x27')]]={'$like':'%'+_0x58d56c[_0x710a('0x2f')][_0x710a('0x3b')]+'%'};return _0x21ccb6;}})});}_0x51f97b=_[_0x710a('0x3c')]({},_0x51f97b,_0x58d56c[_0x710a('0x3e')]);var _0x41e674={'where':_0x51f97b['where']};return db[_0x710a('0x2b')][_0x710a('0x1b')](_0x41e674)['then'](function(_0x32b2bf){_0x2293cb[_0x710a('0x1b')]=_0x32b2bf;if(_0x58d56c[_0x710a('0x2f')]['includeAll']){_0x51f97b['include']=[{'all':!![]}];}return db[_0x710a('0x2b')][_0x710a('0x3f')](_0x51f97b);})[_0x710a('0x23')](function(_0x2a6c1e){_0x2293cb[_0x710a('0x40')]=_0x2a6c1e;return _0x2293cb;})[_0x710a('0x23')](respondWithFilteredResult(_0xf834d8,_0x51f97b))[_0x710a('0x41')](handleError(_0xf834d8,null));};exports[_0x710a('0x42')]=function(_0x3f1e8c,_0x3759fe){var _0x573de9={'raw':!![],'where':{'id':_0x3f1e8c['params']['id']}},_0x47f84c={};_0x47f84c[_0x710a('0x2e')]=_['keys'](db[_0x710a('0x2b')][_0x710a('0x2c')]);_0x47f84c[_0x710a('0x2f')]=_[_0x710a('0x30')](_0x3f1e8c[_0x710a('0x2f')]);_0x47f84c[_0x710a('0x31')]=_[_0x710a('0x32')](_0x47f84c['model'],_0x47f84c[_0x710a('0x2f')]);_0x573de9[_0x710a('0x33')]=_[_0x710a('0x32')](_0x47f84c['model'],qs['fields'](_0x3f1e8c[_0x710a('0x2f')][_0x710a('0x34')]));_0x573de9[_0x710a('0x33')]=_0x573de9[_0x710a('0x33')][_0x710a('0x35')]?_0x573de9[_0x710a('0x33')]:_0x47f84c['model'];if(_0x3f1e8c['query'][_0x710a('0x43')]){_0x573de9['include']=[{'all':!![]}];}_0x573de9=_[_0x710a('0x3c')]({},_0x573de9,_0x3f1e8c[_0x710a('0x3e')]);return db[_0x710a('0x2b')][_0x710a('0x44')](_0x573de9)[_0x710a('0x23')](handleEntityNotFound(_0x3759fe,null))[_0x710a('0x23')](respondWithResult(_0x3759fe,null))['catch'](handleError(_0x3759fe,null));};exports[_0x710a('0x45')]=function(_0x11c7d8,_0xc29374){return db[_0x710a('0x2b')][_0x710a('0x45')](_0x11c7d8[_0x710a('0x46')],{})[_0x710a('0x23')](respondWithResult(_0xc29374,0xc9))[_0x710a('0x41')](handleError(_0xc29374,null));};exports[_0x710a('0x22')]=function(_0x42cda2,_0x4817ae){if(_0x42cda2[_0x710a('0x46')]['id']){delete _0x42cda2[_0x710a('0x46')]['id'];}return db['MailServerOut'][_0x710a('0x44')]({'where':{'id':_0x42cda2[_0x710a('0x47')]['id']}})[_0x710a('0x23')](handleEntityNotFound(_0x4817ae,null))[_0x710a('0x23')](saveUpdates(_0x42cda2[_0x710a('0x46')],null))[_0x710a('0x23')](respondWithResult(_0x4817ae,null))['catch'](handleError(_0x4817ae,null));};exports[_0x710a('0x24')]=function(_0x3d0057,_0x4a3e01){return db[_0x710a('0x2b')]['find']({'where':{'id':_0x3d0057['params']['id']}})[_0x710a('0x23')](handleEntityNotFound(_0x4a3e01,null))[_0x710a('0x23')](removeEntity(_0x4a3e01,null))[_0x710a('0x41')](handleError(_0x4a3e01,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d3cbd3d..cd2525e 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 _0x5796=['MailServerOut','mail_servers_out','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x5796,0xa7));var _0x6579=function(_0x207187,_0x435f9d){_0x207187=_0x207187-0x0;var _0x1ce87f=_0x5796[_0x207187];return _0x1ce87f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6579('0x0'))(_0x6579('0x1'));var moment=require(_0x6579('0x2'));var BPromise=require(_0x6579('0x3'));var rp=require(_0x6579('0x4'));var fs=require('fs');var path=require(_0x6579('0x5'));var rimraf=require(_0x6579('0x6'));var config=require(_0x6579('0x7'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x381fa9,_0x2832bf){return _0x381fa9[_0x6579('0x8')](_0x6579('0x9'),attributes,{'tableName':_0x6579('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ed0=['api','request-promise','rimraf','../../config/environment','exports','MailServerOut','lodash','util','../../config/logger'];(function(_0x39d6c1,_0x2a7894){var _0x5da7bd=function(_0x118507){while(--_0x118507){_0x39d6c1['push'](_0x39d6c1['shift']());}};_0x5da7bd(++_0x2a7894);}(_0x3ed0,0xa8));var _0x03ed=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x3ed0[_0x154940];return _0x401409;};'use strict';var _=require(_0x03ed('0x0'));var util=require(_0x03ed('0x1'));var logger=require(_0x03ed('0x2'))(_0x03ed('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x03ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03ed('0x5'));var config=require(_0x03ed('0x6'));var attributes=require('./mailServerOut.attributes');module[_0x03ed('0x7')]=function(_0x2716ec,_0x573b3a){return _0x2716ec['define'](_0x03ed('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 71e3323..dd08d52 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x2fb3b1,_0x2f2a38){var _0x35ea87=function(_0x425b12){while(--_0x425b12){_0x2fb3b1['push'](_0x2fb3b1['shift']());}};_0x35ea87(++_0x2f2a38);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc4aa[_0x19950b];return _0x3c6b41;};'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')]('MailServerOut,\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 _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(_0x55d576,_0x219496){var _0x25f4ef=function(_0x465439){while(--_0x465439){_0x55d576['push'](_0x55d576['shift']());}};_0x25f4ef(++_0x219496);}(_0x2ef3,0xba));var _0x32ef=function(_0x137a39,_0x2f3b9e){_0x137a39=_0x137a39-0x0;var _0xc07f70=_0x2ef3[_0x137a39];return _0xc07f70;};'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 ca3d7cd..c47052d 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 _0xc67f=['delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','/:id','show','create','put','update'];(function(_0x589a64,_0x3016a4){var _0x485164=function(_0x347a11){while(--_0x347a11){_0x589a64['push'](_0x589a64['shift']());}};_0x485164(++_0x3016a4);}(_0xc67f,0x6d));var _0xfc67=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc67f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfc67('0x0'));var util=require(_0xfc67('0x1'));var path=require('path');var timeout=require(_0xfc67('0x2'));var express=require(_0xfc67('0x3'));var router=express[_0xfc67('0x4')]();var fs_extra=require(_0xfc67('0x5'));var auth=require(_0xfc67('0x6'));var interaction=require(_0xfc67('0x7'));var config=require('../../config/environment');var controller=require(_0xfc67('0x8'));router['get']('/',auth[_0xfc67('0x9')](),controller[_0xfc67('0xa')]);router[_0xfc67('0xb')]('/describe',auth[_0xfc67('0x9')](),controller['describe']);router['get'](_0xfc67('0xc'),auth[_0xfc67('0x9')](),controller[_0xfc67('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfc67('0xe')]);router[_0xfc67('0xf')](_0xfc67('0xc'),auth['isAuthenticated'](),controller[_0xfc67('0x10')]);router[_0xfc67('0x11')](_0xfc67('0xc'),auth[_0xfc67('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1539=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util'];(function(_0x4c6c46,_0x4d5b50){var _0x4eca5e=function(_0x2478b3){while(--_0x2478b3){_0x4c6c46['push'](_0x4c6c46['shift']());}};_0x4eca5e(++_0x4d5b50);}(_0x1539,0xc4));var _0x9153=function(_0x4c1ee4,_0x116b78){_0x4c1ee4=_0x4c1ee4-0x0;var _0x518ee7=_0x1539[_0x4c1ee4];return _0x518ee7;};'use strict';var multer=require(_0x9153('0x0'));var util=require(_0x9153('0x1'));var path=require(_0x9153('0x2'));var timeout=require(_0x9153('0x3'));var express=require(_0x9153('0x4'));var router=express[_0x9153('0x5')]();var fs_extra=require(_0x9153('0x6'));var auth=require(_0x9153('0x7'));var interaction=require(_0x9153('0x8'));var config=require(_0x9153('0x9'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x9153('0xa')](),controller[_0x9153('0xb')]);router[_0x9153('0xc')](_0x9153('0xd'),auth['isAuthenticated'](),controller[_0x9153('0xe')]);router[_0x9153('0xc')](_0x9153('0xf'),auth[_0x9153('0xa')](),controller[_0x9153('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9153('0x11')]);router[_0x9153('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9153('0x13')]);router['delete'](_0x9153('0xf'),auth['isAuthenticated'](),controller[_0x9153('0x14')]);module[_0x9153('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 5e45157..06b70cf 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 _0xae30=['exports','STRING','sequelize'];(function(_0x4f081b,_0x3ee9cb){var _0x151075=function(_0x28803a){while(--_0x28803a){_0x4f081b['push'](_0x4f081b['shift']());}};_0x151075(++_0x3ee9cb);}(_0xae30,0x10a));var _0x0ae3=function(_0x501d0d,_0x38b758){_0x501d0d=_0x501d0d-0x0;var _0x37a8b8=_0xae30[_0x501d0d];return _0x37a8b8;};'use strict';var Sequelize=require(_0x0ae3('0x0'));module[_0x0ae3('0x1')]={'name':{'type':Sequelize[_0x0ae3('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0ae3('0x2')]}}; \ No newline at end of file +var _0x4819=['name','exports','STRING'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4819,0xcd));var _0x9481=function(_0x2532a6,_0x25e8e9){_0x2532a6=_0x2532a6-0x0;var _0x1d6b92=_0x4819[_0x2532a6];return _0x1d6b92;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'unique':_0x9481('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9481('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2a9ef56..320693b 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 _0xd5f9=['map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','include','MailSubstatus','rows','catch','show','params','includeAll','find','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','fieldName','type','key','model'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd5f9,0x13b));var _0x9d5f=function(_0x1ff329,_0x33e086){_0x1ff329=_0x1ff329-0x0;var _0x28501d=_0xd5f9[_0x1ff329];return _0x28501d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d5f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d5f('0x1'));var rp=require(_0x9d5f('0x2'));var moment=require(_0x9d5f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9d5f('0x4'));var path=require(_0x9d5f('0x5'));var sox=require('sox');var csv=require(_0x9d5f('0x6'));var ejs=require(_0x9d5f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d5f('0x8'));var squel=require('squel');var crypto=require(_0x9d5f('0x9'));var jsforce=require(_0x9d5f('0xa'));var deskjs=require(_0x9d5f('0xb'));var toCsv=require(_0x9d5f('0x6'));var querystring=require(_0x9d5f('0xc'));var Papa=require(_0x9d5f('0xd'));var Redis=require(_0x9d5f('0xe'));var authService=require(_0x9d5f('0xf'));var qs=require(_0x9d5f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d5f('0x11'));var logger=require(_0x9d5f('0x12'))(_0x9d5f('0x13'));var utils=require(_0x9d5f('0x14'));var config=require(_0x9d5f('0x15'));var licenseUtil=require(_0x9d5f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dea97,_0x430c07){_0x430c07=_0x430c07||0xcc;return function(_0x305d6e){if(_0x305d6e){return _0x5dea97[_0x9d5f('0x17')](_0x430c07);}return _0x5dea97[_0x9d5f('0x18')](_0x430c07)[_0x9d5f('0x19')]();};}function respondWithResult(_0x3270ee,_0x86df82){_0x86df82=_0x86df82||0xc8;return function(_0x574e97){if(_0x574e97){return _0x3270ee[_0x9d5f('0x18')](_0x86df82)[_0x9d5f('0x1a')](_0x574e97);}};}function respondWithFilteredResult(_0x4cfc95,_0x2b5b15){return function(_0x46164b){if(_0x46164b){var _0x29f6ec=typeof _0x2b5b15[_0x9d5f('0x1b')]===_0x9d5f('0x1c')&&typeof _0x2b5b15['limit']===_0x9d5f('0x1c');var _0x3ddba1=_0x46164b[_0x9d5f('0x1d')];var _0x4b042d=_0x29f6ec?0x0:_0x2b5b15[_0x9d5f('0x1b')];var _0xc5dcce=_0x29f6ec?_0x46164b['count']:_0x2b5b15[_0x9d5f('0x1b')]+_0x2b5b15[_0x9d5f('0x1e')];var _0x12a0fc;if(_0xc5dcce>=_0x3ddba1){_0xc5dcce=_0x3ddba1;_0x12a0fc=0xc8;}else{_0x12a0fc=0xce;}_0x4cfc95[_0x9d5f('0x18')](_0x12a0fc);return _0x4cfc95[_0x9d5f('0x1f')](_0x9d5f('0x20'),_0x4b042d+'-'+_0xc5dcce+'/'+_0x3ddba1)[_0x9d5f('0x1a')](_0x46164b);}return null;};}function patchUpdates(_0x24a1f4){return function(_0x405c27){try{jsonpatch[_0x9d5f('0x21')](_0x405c27,_0x24a1f4,!![]);}catch(_0x55ea7e){return BPromise[_0x9d5f('0x22')](_0x55ea7e);}return _0x405c27['save']();};}function saveUpdates(_0x12e1ef,_0x55c59f){return function(_0x5d9a71){if(_0x5d9a71){return _0x5d9a71[_0x9d5f('0x23')](_0x12e1ef)[_0x9d5f('0x24')](function(_0x2ac9b9){return _0x2ac9b9;});}return null;};}function removeEntity(_0x2da20c,_0x23cd4a){return function(_0x543349){if(_0x543349){return _0x543349['destroy']()[_0x9d5f('0x24')](function(){_0x2da20c[_0x9d5f('0x18')](0xcc)[_0x9d5f('0x19')]();});}};}function handleEntityNotFound(_0x20b873,_0x4db063){return function(_0x136379){if(!_0x136379){_0x20b873['sendStatus'](0x194);}return _0x136379;};}function handleError(_0x5e25d1,_0x50f59d){_0x50f59d=_0x50f59d||0x1f4;return function(_0x5a8287){logger['error'](_0x5a8287[_0x9d5f('0x25')]);if(_0x5a8287[_0x9d5f('0x26')]){delete _0x5a8287['name'];}_0x5e25d1['status'](_0x50f59d)[_0x9d5f('0x27')](_0x5a8287);};}exports[_0x9d5f('0x28')]=function(_0xa98831,_0x314937){var _0x10db3a={},_0x516b90={},_0x208a3f={'count':0x0,'rows':[]};var _0x4577ef=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x3182c9){return{'name':_0x3182c9[_0x9d5f('0x29')],'type':_0x3182c9[_0x9d5f('0x2a')][_0x9d5f('0x2b')]};});_0x516b90[_0x9d5f('0x2c')]=_[_0x9d5f('0x2d')](_0x4577ef,_0x9d5f('0x26'));_0x516b90[_0x9d5f('0x2e')]=_[_0x9d5f('0x2f')](_0xa98831[_0x9d5f('0x2e')]);_0x516b90['filters']=_[_0x9d5f('0x30')](_0x516b90[_0x9d5f('0x2c')],_0x516b90[_0x9d5f('0x2e')]);_0x10db3a[_0x9d5f('0x31')]=_[_0x9d5f('0x30')](_0x516b90['model'],qs[_0x9d5f('0x32')](_0xa98831[_0x9d5f('0x2e')][_0x9d5f('0x32')]));_0x10db3a[_0x9d5f('0x31')]=_0x10db3a[_0x9d5f('0x31')][_0x9d5f('0x33')]?_0x10db3a[_0x9d5f('0x31')]:_0x516b90[_0x9d5f('0x2c')];if(!_0xa98831[_0x9d5f('0x2e')]['hasOwnProperty'](_0x9d5f('0x34'))){_0x10db3a[_0x9d5f('0x1e')]=qs['limit'](_0xa98831['query'][_0x9d5f('0x1e')]);_0x10db3a[_0x9d5f('0x1b')]=qs['offset'](_0xa98831['query']['offset']);}_0x10db3a[_0x9d5f('0x35')]=qs['sort'](_0xa98831[_0x9d5f('0x2e')][_0x9d5f('0x36')]);_0x10db3a['where']=qs[_0x9d5f('0x37')](_[_0x9d5f('0x38')](_0xa98831[_0x9d5f('0x2e')],_0x516b90[_0x9d5f('0x37')]),_0x4577ef);if(_0xa98831[_0x9d5f('0x2e')][_0x9d5f('0x39')]){_0x10db3a[_0x9d5f('0x3a')]=_[_0x9d5f('0x3b')](_0x10db3a[_0x9d5f('0x3a')],{'$or':_['map'](_0x4577ef,function(_0x5d55a6){if(_0x5d55a6[_0x9d5f('0x2a')]!=='VIRTUAL'){var _0x1777b3={};_0x1777b3[_0x5d55a6['name']]={'$like':'%'+_0xa98831['query'][_0x9d5f('0x39')]+'%'};return _0x1777b3;}})});}_0x10db3a=_[_0x9d5f('0x3b')]({},_0x10db3a,_0xa98831[_0x9d5f('0x3c')]);var _0x7d3126={'where':_0x10db3a[_0x9d5f('0x3a')]};return db['MailSubstatus'][_0x9d5f('0x1d')](_0x7d3126)[_0x9d5f('0x24')](function(_0x43edeb){_0x208a3f[_0x9d5f('0x1d')]=_0x43edeb;if(_0xa98831[_0x9d5f('0x2e')]['includeAll']){_0x10db3a[_0x9d5f('0x3d')]=[{'all':!![]}];}return db[_0x9d5f('0x3e')]['findAll'](_0x10db3a);})[_0x9d5f('0x24')](function(_0x114007){_0x208a3f[_0x9d5f('0x3f')]=_0x114007;return _0x208a3f;})[_0x9d5f('0x24')](respondWithFilteredResult(_0x314937,_0x10db3a))[_0x9d5f('0x40')](handleError(_0x314937,null));};exports[_0x9d5f('0x41')]=function(_0x595922,_0x5f2342){var _0x1df87d={'raw':!![],'where':{'id':_0x595922[_0x9d5f('0x42')]['id']}},_0x12bb22={};_0x12bb22[_0x9d5f('0x2c')]=_[_0x9d5f('0x2f')](db[_0x9d5f('0x3e')]['rawAttributes']);_0x12bb22[_0x9d5f('0x2e')]=_[_0x9d5f('0x2f')](_0x595922[_0x9d5f('0x2e')]);_0x12bb22['filters']=_[_0x9d5f('0x30')](_0x12bb22['model'],_0x12bb22[_0x9d5f('0x2e')]);_0x1df87d[_0x9d5f('0x31')]=_[_0x9d5f('0x30')](_0x12bb22['model'],qs['fields'](_0x595922[_0x9d5f('0x2e')]['fields']));_0x1df87d[_0x9d5f('0x31')]=_0x1df87d[_0x9d5f('0x31')][_0x9d5f('0x33')]?_0x1df87d[_0x9d5f('0x31')]:_0x12bb22[_0x9d5f('0x2c')];if(_0x595922[_0x9d5f('0x2e')][_0x9d5f('0x43')]){_0x1df87d['include']=[{'all':!![]}];}_0x1df87d=_[_0x9d5f('0x3b')]({},_0x1df87d,_0x595922[_0x9d5f('0x3c')]);return db[_0x9d5f('0x3e')][_0x9d5f('0x44')](_0x1df87d)[_0x9d5f('0x24')](handleEntityNotFound(_0x5f2342,null))['then'](respondWithResult(_0x5f2342,null))[_0x9d5f('0x40')](handleError(_0x5f2342,null));};exports['create']=function(_0x100174,_0x83c76c){return db['MailSubstatus']['create'](_0x100174['body'],{})[_0x9d5f('0x24')](respondWithResult(_0x83c76c,0xc9))[_0x9d5f('0x40')](handleError(_0x83c76c,null));};exports[_0x9d5f('0x23')]=function(_0x1503c4,_0x358fed){if(_0x1503c4[_0x9d5f('0x45')]['id']){delete _0x1503c4['body']['id'];}return db['MailSubstatus'][_0x9d5f('0x44')]({'where':{'id':_0x1503c4['params']['id']}})[_0x9d5f('0x24')](handleEntityNotFound(_0x358fed,null))[_0x9d5f('0x24')](saveUpdates(_0x1503c4[_0x9d5f('0x45')],null))['then'](respondWithResult(_0x358fed,null))[_0x9d5f('0x40')](handleError(_0x358fed,null));};exports[_0x9d5f('0x46')]=function(_0x58195d,_0x277ce6){return db[_0x9d5f('0x3e')][_0x9d5f('0x44')]({'where':{'id':_0x58195d[_0x9d5f('0x42')]['id']}})['then'](handleEntityNotFound(_0x277ce6,null))[_0x9d5f('0x24')](removeEntity(_0x277ce6,null))['catch'](handleError(_0x277ce6,null));};exports['describe']=function(_0x2fdf26,_0x3c8a8c){return db[_0x9d5f('0x3e')][_0x9d5f('0x47')]()['then'](respondWithResult(_0x3c8a8c,null))['catch'](handleError(_0x3c8a8c,null));}; \ No newline at end of file +var _0x8936=['attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','query','filters'];(function(_0x2dea58,_0x59d6f0){var _0x2b23c2=function(_0x3e5c44){while(--_0x3e5c44){_0x2dea58['push'](_0x2dea58['shift']());}};_0x2b23c2(++_0x59d6f0);}(_0x8936,0xed));var _0x6893=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0x8936[_0x4480b9];return _0x3f0f02;};'use strict';var emlformat=require(_0x6893('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6893('0x1'));var jsonpatch=require(_0x6893('0x2'));var rp=require('request-promise');var moment=require(_0x6893('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6893('0x4'));var util=require(_0x6893('0x5'));var path=require(_0x6893('0x6'));var sox=require(_0x6893('0x7'));var csv=require('to-csv');var ejs=require(_0x6893('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6893('0x9'));var squel=require(_0x6893('0xa'));var crypto=require('crypto');var jsforce=require(_0x6893('0xb'));var deskjs=require(_0x6893('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6893('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6893('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6893('0xf'));var logger=require('../../config/logger')(_0x6893('0x10'));var utils=require('../../config/utils');var config=require(_0x6893('0x11'));var licenseUtil=require(_0x6893('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38cce3,_0xacacc3){_0xacacc3=_0xacacc3||0xcc;return function(_0x2067e2){if(_0x2067e2){return _0x38cce3['sendStatus'](_0xacacc3);}return _0x38cce3['status'](_0xacacc3)[_0x6893('0x13')]();};}function respondWithResult(_0x51ead7,_0x1c0433){_0x1c0433=_0x1c0433||0xc8;return function(_0x35bca1){if(_0x35bca1){return _0x51ead7[_0x6893('0x14')](_0x1c0433)[_0x6893('0x15')](_0x35bca1);}};}function respondWithFilteredResult(_0x43d7b0,_0xe0692c){return function(_0x1dd7b6){if(_0x1dd7b6){var _0x2e1127=typeof _0xe0692c[_0x6893('0x16')]==='undefined'&&typeof _0xe0692c[_0x6893('0x17')]===_0x6893('0x18');var _0x6302c=_0x1dd7b6[_0x6893('0x19')];var _0x596833=_0x2e1127?0x0:_0xe0692c['offset'];var _0x596401=_0x2e1127?_0x1dd7b6['count']:_0xe0692c[_0x6893('0x16')]+_0xe0692c[_0x6893('0x17')];var _0x30b6a1;if(_0x596401>=_0x6302c){_0x596401=_0x6302c;_0x30b6a1=0xc8;}else{_0x30b6a1=0xce;}_0x43d7b0['status'](_0x30b6a1);return _0x43d7b0['set']('Content-Range',_0x596833+'-'+_0x596401+'/'+_0x6302c)[_0x6893('0x15')](_0x1dd7b6);}return null;};}function patchUpdates(_0x4c9c91){return function(_0x11ec53){try{jsonpatch[_0x6893('0x1a')](_0x11ec53,_0x4c9c91,!![]);}catch(_0x326d84){return BPromise[_0x6893('0x1b')](_0x326d84);}return _0x11ec53[_0x6893('0x1c')]();};}function saveUpdates(_0x203ef9,_0x4093cf){return function(_0x382683){if(_0x382683){return _0x382683['update'](_0x203ef9)[_0x6893('0x1d')](function(_0x59cc12){return _0x59cc12;});}return null;};}function removeEntity(_0x41f6fd,_0x19be49){return function(_0x3f4a74){if(_0x3f4a74){return _0x3f4a74['destroy']()[_0x6893('0x1d')](function(){_0x41f6fd[_0x6893('0x14')](0xcc)[_0x6893('0x13')]();});}};}function handleEntityNotFound(_0x16e463,_0x21c3ba){return function(_0x521447){if(!_0x521447){_0x16e463[_0x6893('0x1e')](0x194);}return _0x521447;};}function handleError(_0x59b5eb,_0x173cbf){_0x173cbf=_0x173cbf||0x1f4;return function(_0x22f1c3){logger[_0x6893('0x1f')](_0x22f1c3[_0x6893('0x20')]);if(_0x22f1c3[_0x6893('0x21')]){delete _0x22f1c3[_0x6893('0x21')];}_0x59b5eb[_0x6893('0x14')](_0x173cbf)[_0x6893('0x22')](_0x22f1c3);};}exports[_0x6893('0x23')]=function(_0x48de3f,_0x4f0b41){var _0x3ea7bb={},_0x191e5={},_0x406435={'count':0x0,'rows':[]};var _0x57122f=_[_0x6893('0x24')](db[_0x6893('0x25')]['rawAttributes'],function(_0x1d50c0){return{'name':_0x1d50c0[_0x6893('0x26')],'type':_0x1d50c0[_0x6893('0x27')][_0x6893('0x28')]};});_0x191e5['model']=_[_0x6893('0x24')](_0x57122f,'name');_0x191e5[_0x6893('0x29')]=_['keys'](_0x48de3f[_0x6893('0x29')]);_0x191e5[_0x6893('0x2a')]=_['intersection'](_0x191e5['model'],_0x191e5[_0x6893('0x29')]);_0x3ea7bb[_0x6893('0x2b')]=_['intersection'](_0x191e5['model'],qs['fields'](_0x48de3f[_0x6893('0x29')][_0x6893('0x2c')]));_0x3ea7bb[_0x6893('0x2b')]=_0x3ea7bb[_0x6893('0x2b')][_0x6893('0x2d')]?_0x3ea7bb['attributes']:_0x191e5[_0x6893('0x2e')];if(!_0x48de3f[_0x6893('0x29')][_0x6893('0x2f')](_0x6893('0x30'))){_0x3ea7bb['limit']=qs[_0x6893('0x17')](_0x48de3f['query']['limit']);_0x3ea7bb[_0x6893('0x16')]=qs[_0x6893('0x16')](_0x48de3f[_0x6893('0x29')][_0x6893('0x16')]);}_0x3ea7bb[_0x6893('0x31')]=qs[_0x6893('0x32')](_0x48de3f[_0x6893('0x29')][_0x6893('0x32')]);_0x3ea7bb[_0x6893('0x33')]=qs[_0x6893('0x2a')](_['pick'](_0x48de3f[_0x6893('0x29')],_0x191e5[_0x6893('0x2a')]),_0x57122f);if(_0x48de3f[_0x6893('0x29')]['filter']){_0x3ea7bb['where']=_[_0x6893('0x34')](_0x3ea7bb['where'],{'$or':_[_0x6893('0x24')](_0x57122f,function(_0x4f5b07){if(_0x4f5b07[_0x6893('0x27')]!==_0x6893('0x35')){var _0xaee811={};_0xaee811[_0x4f5b07['name']]={'$like':'%'+_0x48de3f[_0x6893('0x29')][_0x6893('0x36')]+'%'};return _0xaee811;}})});}_0x3ea7bb=_[_0x6893('0x34')]({},_0x3ea7bb,_0x48de3f[_0x6893('0x37')]);var _0x5b89b5={'where':_0x3ea7bb[_0x6893('0x33')]};return db[_0x6893('0x25')][_0x6893('0x19')](_0x5b89b5)[_0x6893('0x1d')](function(_0x51b299){_0x406435['count']=_0x51b299;if(_0x48de3f[_0x6893('0x29')][_0x6893('0x38')]){_0x3ea7bb[_0x6893('0x39')]=[{'all':!![]}];}return db[_0x6893('0x25')][_0x6893('0x3a')](_0x3ea7bb);})[_0x6893('0x1d')](function(_0x5b257a){_0x406435[_0x6893('0x3b')]=_0x5b257a;return _0x406435;})[_0x6893('0x1d')](respondWithFilteredResult(_0x4f0b41,_0x3ea7bb))[_0x6893('0x3c')](handleError(_0x4f0b41,null));};exports[_0x6893('0x3d')]=function(_0x3faaff,_0xcc92d5){var _0x122111={'raw':!![],'where':{'id':_0x3faaff[_0x6893('0x3e')]['id']}},_0x51a036={};_0x51a036[_0x6893('0x2e')]=_[_0x6893('0x3f')](db[_0x6893('0x25')]['rawAttributes']);_0x51a036[_0x6893('0x29')]=_[_0x6893('0x3f')](_0x3faaff[_0x6893('0x29')]);_0x51a036[_0x6893('0x2a')]=_[_0x6893('0x40')](_0x51a036[_0x6893('0x2e')],_0x51a036['query']);_0x122111[_0x6893('0x2b')]=_[_0x6893('0x40')](_0x51a036['model'],qs[_0x6893('0x2c')](_0x3faaff[_0x6893('0x29')][_0x6893('0x2c')]));_0x122111['attributes']=_0x122111[_0x6893('0x2b')]['length']?_0x122111[_0x6893('0x2b')]:_0x51a036[_0x6893('0x2e')];if(_0x3faaff[_0x6893('0x29')]['includeAll']){_0x122111[_0x6893('0x39')]=[{'all':!![]}];}_0x122111=_[_0x6893('0x34')]({},_0x122111,_0x3faaff[_0x6893('0x37')]);return db[_0x6893('0x25')][_0x6893('0x41')](_0x122111)[_0x6893('0x1d')](handleEntityNotFound(_0xcc92d5,null))[_0x6893('0x1d')](respondWithResult(_0xcc92d5,null))[_0x6893('0x3c')](handleError(_0xcc92d5,null));};exports[_0x6893('0x42')]=function(_0x288db8,_0x372841){return db[_0x6893('0x25')][_0x6893('0x42')](_0x288db8[_0x6893('0x43')],{})['then'](respondWithResult(_0x372841,0xc9))[_0x6893('0x3c')](handleError(_0x372841,null));};exports[_0x6893('0x44')]=function(_0x391cec,_0x4bdce4){if(_0x391cec[_0x6893('0x43')]['id']){delete _0x391cec[_0x6893('0x43')]['id'];}return db[_0x6893('0x25')][_0x6893('0x41')]({'where':{'id':_0x391cec[_0x6893('0x3e')]['id']}})[_0x6893('0x1d')](handleEntityNotFound(_0x4bdce4,null))[_0x6893('0x1d')](saveUpdates(_0x391cec[_0x6893('0x43')],null))[_0x6893('0x1d')](respondWithResult(_0x4bdce4,null))['catch'](handleError(_0x4bdce4,null));};exports['destroy']=function(_0x49a04a,_0x5df8ee){return db[_0x6893('0x25')][_0x6893('0x41')]({'where':{'id':_0x49a04a[_0x6893('0x3e')]['id']}})[_0x6893('0x1d')](handleEntityNotFound(_0x5df8ee,null))['then'](removeEntity(_0x5df8ee,null))[_0x6893('0x3c')](handleError(_0x5df8ee,null));};exports[_0x6893('0x45')]=function(_0x3e87cd,_0x3cf64b){return db['MailSubstatus'][_0x6893('0x45')]()[_0x6893('0x1d')](respondWithResult(_0x3cf64b,null))[_0x6893('0x3c')](handleError(_0x3cf64b,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 15f70f5..38a3b9f 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 _0x1060=['emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x392512,_0x24c175){var _0x240ea3=function(_0x2ea057){while(--_0x2ea057){_0x392512['push'](_0x392512['shift']());}};_0x240ea3(++_0x24c175);}(_0x1060,0x123));var _0x0106=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1060[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require(_0x0106('0x0'));var MailSubstatus=require(_0x0106('0x1'))['db'][_0x0106('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0106('0x3')](0x0);var events={'afterUpdate':_0x0106('0x4')};function emitEvent(_0xa25e7a){return function(_0x159ab5,_0x5c81d4,_0xaad245){MailSubstatusEvents[_0x0106('0x5')](_0xa25e7a+':'+_0x159ab5['id'],_0x159ab5);MailSubstatusEvents['emit'](_0xa25e7a,_0x159ab5);_0xaad245(null);};}for(var e in events){if(events[_0x0106('0x6')](e)){var event=events[e];MailSubstatus[_0x0106('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x7983=['update','emit','hasOwnProperty','hook','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x325144,_0x3daa25){var _0x3f0e07=function(_0x5276b5){while(--_0x5276b5){_0x325144['push'](_0x325144['shift']());}};_0x3f0e07(++_0x3daa25);}(_0x7983,0x1a1));var _0x3798=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7983[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x3798('0x0'))['db'][_0x3798('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x3798('0x2')](0x0);var events={'afterUpdate':_0x3798('0x3')};function emitEvent(_0x1f92d4){return function(_0x232188,_0x161aa1,_0x1c0d80){MailSubstatusEvents['emit'](_0x1f92d4+':'+_0x232188['id'],_0x232188);MailSubstatusEvents[_0x3798('0x4')](_0x1f92d4,_0x232188);_0x1c0d80(null);};}for(var e in events){if(events[_0x3798('0x5')](e)){var event=events[e];MailSubstatus[_0x3798('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 05ec266..03d18cd 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 _0xc35d=['./mailSubstatus.attributes','models','define','mail_substatuses','Condition','update','name','then'];(function(_0x3f2111,_0x345028){var _0x3258f7=function(_0x21178b){while(--_0x21178b){_0x3f2111['push'](_0x3f2111['shift']());}};_0x3258f7(++_0x345028);}(_0xc35d,0xd0));var _0xdc35=function(_0x2085b4,_0x3368a7){_0x2085b4=_0x2085b4-0x0;var _0x130563=_0xc35d[_0x2085b4];return _0x130563;};'use strict';var attributes=require(_0xdc35('0x0'));module['exports']=function(_0x1fd70e){var _0x4c21ca=_0x1fd70e[_0xdc35('0x1')];return _0x1fd70e[_0xdc35('0x2')]('MailSubstatus',attributes,{'tableName':_0xdc35('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4abfdd,_0xd687d6,_0x43745c){return _0x4c21ca[_0xdc35('0x4')][_0xdc35('0x5')]({'value':_0x4abfdd['name']},{'where':{'field':'mailSubstatus','value':_0x4abfdd['_previousDataValues'][_0xdc35('0x6')]}})[_0xdc35('0x7')](function(){_0x43745c();})['catch'](function(_0x3409fc){_0x43745c(_0x3409fc);});}}});}; \ No newline at end of file +var _0x7c94=['mail_substatuses','update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','models','MailSubstatus'];(function(_0x599a6f,_0x5acb08){var _0x2648db=function(_0x1e84d4){while(--_0x1e84d4){_0x599a6f['push'](_0x599a6f['shift']());}};_0x2648db(++_0x5acb08);}(_0x7c94,0x7b));var _0x47c9=function(_0x3c88e4,_0x2668b3){_0x3c88e4=_0x3c88e4-0x0;var _0x360eec=_0x7c94[_0x3c88e4];return _0x360eec;};'use strict';var attributes=require(_0x47c9('0x0'));module['exports']=function(_0x126367){var _0x2763ca=_0x126367[_0x47c9('0x1')];return _0x126367['define'](_0x47c9('0x2'),attributes,{'tableName':_0x47c9('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2eef0e,_0x2cdfe5,_0x6f738a){return _0x2763ca['Condition'][_0x47c9('0x4')]({'value':_0x2eef0e[_0x47c9('0x5')]},{'where':{'field':_0x47c9('0x6'),'value':_0x2eef0e[_0x47c9('0x7')][_0x47c9('0x5')]}})[_0x47c9('0x8')](function(){_0x6f738a();})['catch'](function(_0x318f31){_0x6f738a(_0x318f31);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 99b1a66..b9f25a1 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 _0xd252=['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','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3d15c3,_0x4e2751){var _0xb65746=function(_0x2c7f95){while(--_0x2c7f95){_0x3d15c3['push'](_0x3d15c3['shift']());}};_0xb65746(++_0x4e2751);}(_0xd252,0xb3));var _0x2d25=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0xd252[_0x427352];return _0x23e0e6;};'use strict';var _=require(_0x2d25('0x0'));var util=require(_0x2d25('0x1'));var moment=require(_0x2d25('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d25('0x3'));var fs=require('fs');var Redis=require(_0x2d25('0x4'));var db=require(_0x2d25('0x5'))['db'];var utils=require(_0x2d25('0x6'));var logger=require(_0x2d25('0x7'))(_0x2d25('0x8'));var config=require(_0x2d25('0x9'));var jayson=require(_0x2d25('0xa'));var client=jayson[_0x2d25('0xb')][_0x2d25('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ef7e0,_0xe47e7,_0x78f4e8){return new BPromise(function(_0xb91137,_0x1c49c4){return client[_0x2d25('0xd')](_0x4ef7e0,_0x78f4e8)[_0x2d25('0xe')](function(_0x10852b){logger[_0x2d25('0xf')](_0x2d25('0x10'),_0xe47e7,_0x2d25('0x11'));logger[_0x2d25('0x12')](_0x2d25('0x13'),_0xe47e7,_0x2d25('0x11'),JSON['stringify'](_0x10852b));if(_0x10852b[_0x2d25('0x14')]){if(_0x10852b[_0x2d25('0x14')]['code']===0x1f4){logger[_0x2d25('0x14')]('MailSubstatus,\x20%s,\x20%s',_0xe47e7,_0x10852b['error'][_0x2d25('0x15')]);return _0x1c49c4(_0x10852b[_0x2d25('0x14')][_0x2d25('0x15')]);}logger[_0x2d25('0x14')](_0x2d25('0x10'),_0xe47e7,_0x10852b['error'][_0x2d25('0x15')]);return _0xb91137(_0x10852b[_0x2d25('0x14')][_0x2d25('0x15')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0xe47e7,_0x2d25('0x11'));_0xb91137(_0x10852b[_0x2d25('0x16')][_0x2d25('0x15')]);}})[_0x2d25('0x17')](function(_0x20ff3a){logger['error'](_0x2d25('0x10'),_0xe47e7,_0x20ff3a);_0x1c49c4(_0x20ff3a);});});} \ No newline at end of file +var _0x1e0f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','MailSubstatus,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1e0f,0xc2));var _0xf1e0=function(_0x4104a1,_0x286062){_0x4104a1=_0x4104a1-0x0;var _0x57c55b=_0x1e0f[_0x4104a1];return _0x57c55b;};'use strict';var _=require(_0xf1e0('0x0'));var util=require('util');var moment=require(_0xf1e0('0x1'));var BPromise=require(_0xf1e0('0x2'));var rs=require(_0xf1e0('0x3'));var fs=require('fs');var Redis=require(_0xf1e0('0x4'));var db=require(_0xf1e0('0x5'))['db'];var utils=require(_0xf1e0('0x6'));var logger=require(_0xf1e0('0x7'))(_0xf1e0('0x8'));var config=require('../../config/environment');var jayson=require(_0xf1e0('0x9'));var client=jayson['client'][_0xf1e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58cc67,_0x23d425,_0x833201){return new BPromise(function(_0x2586eb,_0x1c6424){return client[_0xf1e0('0xb')](_0x58cc67,_0x833201)[_0xf1e0('0xc')](function(_0x1cb607){logger[_0xf1e0('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x23d425,_0xf1e0('0xe'));logger[_0xf1e0('0xf')](_0xf1e0('0x10'),_0x23d425,_0xf1e0('0xe'),JSON[_0xf1e0('0x11')](_0x1cb607));if(_0x1cb607[_0xf1e0('0x12')]){if(_0x1cb607['error']['code']===0x1f4){logger['error'](_0xf1e0('0x13'),_0x23d425,_0x1cb607[_0xf1e0('0x12')][_0xf1e0('0x14')]);return _0x1c6424(_0x1cb607[_0xf1e0('0x12')]['message']);}logger[_0xf1e0('0x12')](_0xf1e0('0x13'),_0x23d425,_0x1cb607[_0xf1e0('0x12')][_0xf1e0('0x14')]);return _0x2586eb(_0x1cb607[_0xf1e0('0x12')][_0xf1e0('0x14')]);}else{logger[_0xf1e0('0xd')](_0xf1e0('0x13'),_0x23d425,'request\x20sent');_0x2586eb(_0x1cb607[_0xf1e0('0x15')][_0xf1e0('0x14')]);}})['catch'](function(_0x4f8c24){logger['error'](_0xf1e0('0x13'),_0x23d425,_0x4f8c24);_0x1c6424(_0x4f8c24);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 0d09f87..c29a531 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 _0x785d=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','isAuthenticated','show','post','create','put'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x785d,0x1e4));var _0xd785=function(_0x43fa71,_0x3d0802){_0x43fa71=_0x43fa71-0x0;var _0x85379f=_0x785d[_0x43fa71];return _0x85379f;};'use strict';var multer=require(_0xd785('0x0'));var util=require('util');var path=require(_0xd785('0x1'));var timeout=require(_0xd785('0x2'));var express=require(_0xd785('0x3'));var router=express[_0xd785('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd785('0x5'));var interaction=require(_0xd785('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xd785('0x7')]('/',auth['isAuthenticated'](),controller[_0xd785('0x8')]);router[_0xd785('0x7')](_0xd785('0x9'),auth['isAuthenticated'](),controller[_0xd785('0xa')]);router[_0xd785('0x7')]('/:id',auth[_0xd785('0xb')](),controller[_0xd785('0xc')]);router[_0xd785('0xd')]('/',auth[_0xd785('0xb')](),controller[_0xd785('0xe')]);router[_0xd785('0xf')]('/:id',auth[_0xd785('0xb')](),controller[_0xd785('0x10')]);router[_0xd785('0x11')]('/:id',auth[_0xd785('0xb')](),controller[_0xd785('0x12')]);module[_0xd785('0x13')]=router; \ No newline at end of file +var _0x4f94=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','put','update','/:id','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c208e,_0x2a0a5b){var _0x5104ff=function(_0x3ca41f){while(--_0x3ca41f){_0x1c208e['push'](_0x1c208e['shift']());}};_0x5104ff(++_0x2a0a5b);}(_0x4f94,0xe7));var _0x44f9=function(_0x5f1d16,_0x79ecd0){_0x5f1d16=_0x5f1d16-0x0;var _0x4e49f6=_0x4f94[_0x5f1d16];return _0x4e49f6;};'use strict';var multer=require('multer');var util=require(_0x44f9('0x0'));var path=require(_0x44f9('0x1'));var timeout=require(_0x44f9('0x2'));var express=require(_0x44f9('0x3'));var router=express[_0x44f9('0x4')]();var fs_extra=require(_0x44f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44f9('0x6'));var config=require(_0x44f9('0x7'));var controller=require(_0x44f9('0x8'));router[_0x44f9('0x9')]('/',auth[_0x44f9('0xa')](),controller[_0x44f9('0xb')]);router['get']('/describe',auth[_0x44f9('0xa')](),controller[_0x44f9('0xc')]);router[_0x44f9('0x9')]('/:id',auth[_0x44f9('0xa')](),controller['show']);router['post']('/',auth[_0x44f9('0xa')](),controller['create']);router[_0x44f9('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x44f9('0xe')]);router['delete'](_0x44f9('0xf'),auth[_0x44f9('0xa')](),controller[_0x44f9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c09bf96..8880081 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x25a016,_0x32ebeb){var _0x26a6e0=function(_0x4d54e2){while(--_0x4d54e2){_0x25a016['push'](_0x25a016['shift']());}};_0x26a6e0(++_0x32ebeb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xcb91[_0x1f27df];return _0x286ee2;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x14bbf2,_0x1f1bc9){var _0xb1ee82=function(_0x816210){while(--_0x816210){_0x14bbf2['push'](_0x14bbf2['shift']());}};_0xb1ee82(++_0x1f1bc9);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 618c526..ee7bf07 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 _0x7790=['body','params','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','rows','find','catch','create','update'];(function(_0x299ff4,_0x1fe2f7){var _0x5564b5=function(_0x441381){while(--_0x441381){_0x299ff4['push'](_0x299ff4['shift']());}};_0x5564b5(++_0x1fe2f7);}(_0x7790,0xa4));var _0x0779=function(_0x24171e,_0x55421d){_0x24171e=_0x24171e-0x0;var _0x139d54=_0x7790[_0x24171e];return _0x139d54;};'use strict';var emlformat=require(_0x0779('0x0'));var rimraf=require(_0x0779('0x1'));var zipdir=require(_0x0779('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0779('0x3'));var BPromise=require(_0x0779('0x4'));var Mustache=require(_0x0779('0x5'));var util=require(_0x0779('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0779('0x7'));var ejs=require(_0x0779('0x8'));var fs=require('fs');var fs_extra=require(_0x0779('0x9'));var _=require(_0x0779('0xa'));var squel=require(_0x0779('0xb'));var crypto=require(_0x0779('0xc'));var jsforce=require(_0x0779('0xd'));var deskjs=require(_0x0779('0xe'));var toCsv=require(_0x0779('0x7'));var querystring=require(_0x0779('0xf'));var Papa=require(_0x0779('0x10'));var Redis=require(_0x0779('0x11'));var authService=require(_0x0779('0x12'));var qs=require(_0x0779('0x13'));var as=require(_0x0779('0x14'));var hardwareService=require(_0x0779('0x15'));var logger=require(_0x0779('0x16'))(_0x0779('0x17'));var utils=require('../../config/utils');var config=require(_0x0779('0x18'));var licenseUtil=require(_0x0779('0x19'));var db=require(_0x0779('0x1a'))['db'];function respondWithStatusCode(_0x5d0743,_0x3afafc){_0x3afafc=_0x3afafc||0xcc;return function(_0x178088){if(_0x178088){return _0x5d0743['sendStatus'](_0x3afafc);}return _0x5d0743[_0x0779('0x1b')](_0x3afafc)[_0x0779('0x1c')]();};}function respondWithResult(_0x23095f,_0x375b5a){_0x375b5a=_0x375b5a||0xc8;return function(_0x33d50b){if(_0x33d50b){return _0x23095f[_0x0779('0x1b')](_0x375b5a)['json'](_0x33d50b);}};}function respondWithFilteredResult(_0x2fcbab,_0x179e0b){return function(_0x394872){if(_0x394872){var _0x2b1c83=typeof _0x179e0b[_0x0779('0x1d')]===_0x0779('0x1e')&&typeof _0x179e0b[_0x0779('0x1f')]===_0x0779('0x1e');var _0x37de2a=_0x394872[_0x0779('0x20')];var _0x59eb39=_0x2b1c83?0x0:_0x179e0b[_0x0779('0x1d')];var _0x3ecdb0=_0x2b1c83?_0x394872[_0x0779('0x20')]:_0x179e0b[_0x0779('0x1d')]+_0x179e0b[_0x0779('0x1f')];var _0x39c137;if(_0x3ecdb0>=_0x37de2a){_0x3ecdb0=_0x37de2a;_0x39c137=0xc8;}else{_0x39c137=0xce;}_0x2fcbab[_0x0779('0x1b')](_0x39c137);return _0x2fcbab[_0x0779('0x21')](_0x0779('0x22'),_0x59eb39+'-'+_0x3ecdb0+'/'+_0x37de2a)[_0x0779('0x23')](_0x394872);}return null;};}function patchUpdates(_0x495f4f){return function(_0x3385ce){try{jsonpatch[_0x0779('0x24')](_0x3385ce,_0x495f4f,!![]);}catch(_0x176ca8){return BPromise[_0x0779('0x25')](_0x176ca8);}return _0x3385ce[_0x0779('0x26')]();};}function saveUpdates(_0x2f9341,_0x917f34){return function(_0x1e5615){if(_0x1e5615){return _0x1e5615['update'](_0x2f9341)[_0x0779('0x27')](function(_0x53863c){return _0x53863c;});}return null;};}function removeEntity(_0x218288,_0x2a0a8a){return function(_0x51fe56){if(_0x51fe56){return _0x51fe56['destroy']()[_0x0779('0x27')](function(){_0x218288['status'](0xcc)[_0x0779('0x1c')]();});}};}function handleEntityNotFound(_0x178fd3,_0x112215){return function(_0xa157f){if(!_0xa157f){_0x178fd3[_0x0779('0x28')](0x194);}return _0xa157f;};}function handleError(_0x5b55eb,_0x4d1ee8){_0x4d1ee8=_0x4d1ee8||0x1f4;return function(_0x189162){logger[_0x0779('0x29')](_0x189162[_0x0779('0x2a')]);if(_0x189162['name']){delete _0x189162[_0x0779('0x2b')];}_0x5b55eb[_0x0779('0x1b')](_0x4d1ee8)['send'](_0x189162);};}exports[_0x0779('0x2c')]=function(_0x4fda1c,_0x55b0e7){var _0x240cb1={},_0x4c585={},_0x5ebf08={'count':0x0,'rows':[]};var _0x2ed307=_[_0x0779('0x2d')](db['MailTransferReport'][_0x0779('0x2e')],function(_0x29c4e9){return{'name':_0x29c4e9[_0x0779('0x2f')],'type':_0x29c4e9['type'][_0x0779('0x30')]};});_0x4c585[_0x0779('0x31')]=_[_0x0779('0x2d')](_0x2ed307,_0x0779('0x2b'));_0x4c585[_0x0779('0x32')]=_[_0x0779('0x33')](_0x4fda1c[_0x0779('0x32')]);_0x4c585[_0x0779('0x34')]=_[_0x0779('0x35')](_0x4c585[_0x0779('0x31')],_0x4c585[_0x0779('0x32')]);_0x240cb1[_0x0779('0x36')]=_[_0x0779('0x35')](_0x4c585[_0x0779('0x31')],qs[_0x0779('0x37')](_0x4fda1c[_0x0779('0x32')][_0x0779('0x37')]));_0x240cb1[_0x0779('0x36')]=_0x240cb1[_0x0779('0x36')][_0x0779('0x38')]?_0x240cb1[_0x0779('0x36')]:_0x4c585[_0x0779('0x31')];if(!_0x4fda1c[_0x0779('0x32')][_0x0779('0x39')](_0x0779('0x3a'))){_0x240cb1[_0x0779('0x1f')]=qs[_0x0779('0x1f')](_0x4fda1c[_0x0779('0x32')][_0x0779('0x1f')]);_0x240cb1[_0x0779('0x1d')]=qs['offset'](_0x4fda1c[_0x0779('0x32')][_0x0779('0x1d')]);}_0x240cb1[_0x0779('0x3b')]=qs['sort'](_0x4fda1c[_0x0779('0x32')][_0x0779('0x3c')]);_0x240cb1[_0x0779('0x3d')]=qs[_0x0779('0x34')](_['pick'](_0x4fda1c[_0x0779('0x32')],_0x4c585['filters']),_0x2ed307);if(_0x4fda1c[_0x0779('0x32')][_0x0779('0x3e')]){_0x240cb1[_0x0779('0x3d')]=_[_0x0779('0x3f')](_0x240cb1[_0x0779('0x3d')],{'$or':_[_0x0779('0x2d')](_0x2ed307,function(_0xfc5812){if(_0xfc5812[_0x0779('0x40')]!==_0x0779('0x41')){var _0x3858aa={};_0x3858aa[_0xfc5812[_0x0779('0x2b')]]={'$like':'%'+_0x4fda1c[_0x0779('0x32')][_0x0779('0x3e')]+'%'};return _0x3858aa;}})});}_0x240cb1=_[_0x0779('0x3f')]({},_0x240cb1,_0x4fda1c[_0x0779('0x42')]);var _0x5b9bdb={'where':_0x240cb1[_0x0779('0x3d')]};return db['MailTransferReport']['count'](_0x5b9bdb)[_0x0779('0x27')](function(_0xd39f2b){_0x5ebf08[_0x0779('0x20')]=_0xd39f2b;if(_0x4fda1c['query'][_0x0779('0x43')]){_0x240cb1[_0x0779('0x44')]=[{'all':!![]}];}return db[_0x0779('0x45')][_0x0779('0x46')](_0x240cb1);})[_0x0779('0x27')](function(_0x45c3e6){_0x5ebf08[_0x0779('0x47')]=_0x45c3e6;return _0x5ebf08;})[_0x0779('0x27')](respondWithFilteredResult(_0x55b0e7,_0x240cb1))['catch'](handleError(_0x55b0e7,null));};exports['show']=function(_0x540874,_0x4db133){var _0x3527b0={'raw':!![],'where':{'id':_0x540874['params']['id']}},_0x161723={};_0x161723[_0x0779('0x31')]=_['keys'](db[_0x0779('0x45')][_0x0779('0x2e')]);_0x161723[_0x0779('0x32')]=_[_0x0779('0x33')](_0x540874['query']);_0x161723[_0x0779('0x34')]=_['intersection'](_0x161723[_0x0779('0x31')],_0x161723['query']);_0x3527b0['attributes']=_[_0x0779('0x35')](_0x161723[_0x0779('0x31')],qs['fields'](_0x540874[_0x0779('0x32')]['fields']));_0x3527b0[_0x0779('0x36')]=_0x3527b0['attributes'][_0x0779('0x38')]?_0x3527b0['attributes']:_0x161723['model'];if(_0x540874['query'][_0x0779('0x43')]){_0x3527b0[_0x0779('0x44')]=[{'all':!![]}];}_0x3527b0=_['merge']({},_0x3527b0,_0x540874[_0x0779('0x42')]);return db[_0x0779('0x45')][_0x0779('0x48')](_0x3527b0)[_0x0779('0x27')](handleEntityNotFound(_0x4db133,null))[_0x0779('0x27')](respondWithResult(_0x4db133,null))[_0x0779('0x49')](handleError(_0x4db133,null));};exports[_0x0779('0x4a')]=function(_0x2eb9f4,_0x404f73){return db[_0x0779('0x45')][_0x0779('0x4a')](_0x2eb9f4['body'],{})[_0x0779('0x27')](respondWithResult(_0x404f73,0xc9))['catch'](handleError(_0x404f73,null));};exports[_0x0779('0x4b')]=function(_0x31ff54,_0x594865){if(_0x31ff54[_0x0779('0x4c')]['id']){delete _0x31ff54[_0x0779('0x4c')]['id'];}return db[_0x0779('0x45')][_0x0779('0x48')]({'where':{'id':_0x31ff54[_0x0779('0x4d')]['id']}})[_0x0779('0x27')](handleEntityNotFound(_0x594865,null))['then'](saveUpdates(_0x31ff54['body'],null))['then'](respondWithResult(_0x594865,null))[_0x0779('0x49')](handleError(_0x594865,null));};exports[_0x0779('0x4e')]=function(_0xdc7c6b,_0x1f7276){return db[_0x0779('0x45')]['find']({'where':{'id':_0xdc7c6b[_0x0779('0x4d')]['id']}})[_0x0779('0x27')](handleEntityNotFound(_0x1f7276,null))[_0x0779('0x27')](removeEntity(_0x1f7276,null))[_0x0779('0x49')](handleError(_0x1f7276,null));};exports[_0x0779('0x4f')]=function(_0x2ffa7e,_0x362e02){return db[_0x0779('0x45')][_0x0779('0x4f')]()[_0x0779('0x27')](respondWithResult(_0x362e02,null))[_0x0779('0x49')](handleError(_0x362e02,null));}; \ No newline at end of file +var _0xc866=['includeAll','include','findAll','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x57716d,_0x391728){var _0x3e077e=function(_0x473844){while(--_0x473844){_0x57716d['push'](_0x57716d['shift']());}};_0x3e077e(++_0x391728);}(_0xc866,0xa3));var _0x6c86=function(_0x438bc2,_0x2f6217){_0x438bc2=_0x438bc2-0x0;var _0x450355=_0xc866[_0x438bc2];return _0x450355;};'use strict';var emlformat=require(_0x6c86('0x0'));var rimraf=require(_0x6c86('0x1'));var zipdir=require(_0x6c86('0x2'));var jsonpatch=require(_0x6c86('0x3'));var rp=require(_0x6c86('0x4'));var moment=require(_0x6c86('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6c86('0x6'));var util=require(_0x6c86('0x7'));var path=require(_0x6c86('0x8'));var sox=require(_0x6c86('0x9'));var csv=require(_0x6c86('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c86('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c86('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6c86('0xa'));var querystring=require('querystring');var Papa=require(_0x6c86('0xd'));var Redis=require('ioredis');var authService=require(_0x6c86('0xe'));var qs=require(_0x6c86('0xf'));var as=require(_0x6c86('0x10'));var hardwareService=require(_0x6c86('0x11'));var logger=require(_0x6c86('0x12'))(_0x6c86('0x13'));var utils=require(_0x6c86('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6c86('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30f3e7,_0x36b2dc){_0x36b2dc=_0x36b2dc||0xcc;return function(_0x48f223){if(_0x48f223){return _0x30f3e7[_0x6c86('0x16')](_0x36b2dc);}return _0x30f3e7['status'](_0x36b2dc)[_0x6c86('0x17')]();};}function respondWithResult(_0x3d98c3,_0x475acd){_0x475acd=_0x475acd||0xc8;return function(_0x9d4735){if(_0x9d4735){return _0x3d98c3[_0x6c86('0x18')](_0x475acd)[_0x6c86('0x19')](_0x9d4735);}};}function respondWithFilteredResult(_0x30e81f,_0x365b50){return function(_0x3e423f){if(_0x3e423f){var _0xb5664b=typeof _0x365b50[_0x6c86('0x1a')]==='undefined'&&typeof _0x365b50[_0x6c86('0x1b')]===_0x6c86('0x1c');var _0x41f298=_0x3e423f['count'];var _0x3a7794=_0xb5664b?0x0:_0x365b50[_0x6c86('0x1a')];var _0x1012a5=_0xb5664b?_0x3e423f[_0x6c86('0x1d')]:_0x365b50[_0x6c86('0x1a')]+_0x365b50[_0x6c86('0x1b')];var _0x1a96ea;if(_0x1012a5>=_0x41f298){_0x1012a5=_0x41f298;_0x1a96ea=0xc8;}else{_0x1a96ea=0xce;}_0x30e81f[_0x6c86('0x18')](_0x1a96ea);return _0x30e81f[_0x6c86('0x1e')](_0x6c86('0x1f'),_0x3a7794+'-'+_0x1012a5+'/'+_0x41f298)[_0x6c86('0x19')](_0x3e423f);}return null;};}function patchUpdates(_0x1551ef){return function(_0x47d9f3){try{jsonpatch[_0x6c86('0x20')](_0x47d9f3,_0x1551ef,!![]);}catch(_0x54b47b){return BPromise[_0x6c86('0x21')](_0x54b47b);}return _0x47d9f3[_0x6c86('0x22')]();};}function saveUpdates(_0x2cac88,_0x53870b){return function(_0x5387cb){if(_0x5387cb){return _0x5387cb[_0x6c86('0x23')](_0x2cac88)[_0x6c86('0x24')](function(_0x3a3503){return _0x3a3503;});}return null;};}function removeEntity(_0x4e3745,_0x25630c){return function(_0x398667){if(_0x398667){return _0x398667[_0x6c86('0x25')]()['then'](function(){_0x4e3745[_0x6c86('0x18')](0xcc)[_0x6c86('0x17')]();});}};}function handleEntityNotFound(_0xa005ee,_0x261399){return function(_0x3ea2ed){if(!_0x3ea2ed){_0xa005ee[_0x6c86('0x16')](0x194);}return _0x3ea2ed;};}function handleError(_0x403f25,_0x2f68ac){_0x2f68ac=_0x2f68ac||0x1f4;return function(_0x7fc101){logger[_0x6c86('0x26')](_0x7fc101[_0x6c86('0x27')]);if(_0x7fc101[_0x6c86('0x28')]){delete _0x7fc101[_0x6c86('0x28')];}_0x403f25[_0x6c86('0x18')](_0x2f68ac)[_0x6c86('0x29')](_0x7fc101);};}exports[_0x6c86('0x2a')]=function(_0x7c4eed,_0x119268){var _0x881a6b={},_0x9d324d={},_0x636ff1={'count':0x0,'rows':[]};var _0x381ec8=_[_0x6c86('0x2b')](db[_0x6c86('0x2c')][_0x6c86('0x2d')],function(_0x4dfb62){return{'name':_0x4dfb62['fieldName'],'type':_0x4dfb62[_0x6c86('0x2e')][_0x6c86('0x2f')]};});_0x9d324d[_0x6c86('0x30')]=_['map'](_0x381ec8,'name');_0x9d324d['query']=_[_0x6c86('0x31')](_0x7c4eed[_0x6c86('0x32')]);_0x9d324d[_0x6c86('0x33')]=_[_0x6c86('0x34')](_0x9d324d['model'],_0x9d324d['query']);_0x881a6b[_0x6c86('0x35')]=_[_0x6c86('0x34')](_0x9d324d[_0x6c86('0x30')],qs[_0x6c86('0x36')](_0x7c4eed[_0x6c86('0x32')][_0x6c86('0x36')]));_0x881a6b[_0x6c86('0x35')]=_0x881a6b[_0x6c86('0x35')][_0x6c86('0x37')]?_0x881a6b[_0x6c86('0x35')]:_0x9d324d[_0x6c86('0x30')];if(!_0x7c4eed[_0x6c86('0x32')][_0x6c86('0x38')](_0x6c86('0x39'))){_0x881a6b['limit']=qs[_0x6c86('0x1b')](_0x7c4eed[_0x6c86('0x32')][_0x6c86('0x1b')]);_0x881a6b['offset']=qs[_0x6c86('0x1a')](_0x7c4eed['query'][_0x6c86('0x1a')]);}_0x881a6b[_0x6c86('0x3a')]=qs[_0x6c86('0x3b')](_0x7c4eed[_0x6c86('0x32')]['sort']);_0x881a6b[_0x6c86('0x3c')]=qs[_0x6c86('0x33')](_[_0x6c86('0x3d')](_0x7c4eed['query'],_0x9d324d[_0x6c86('0x33')]),_0x381ec8);if(_0x7c4eed[_0x6c86('0x32')]['filter']){_0x881a6b[_0x6c86('0x3c')]=_[_0x6c86('0x3e')](_0x881a6b[_0x6c86('0x3c')],{'$or':_[_0x6c86('0x2b')](_0x381ec8,function(_0x3ebb04){if(_0x3ebb04[_0x6c86('0x2e')]!==_0x6c86('0x3f')){var _0x2c2d46={};_0x2c2d46[_0x3ebb04[_0x6c86('0x28')]]={'$like':'%'+_0x7c4eed[_0x6c86('0x32')][_0x6c86('0x40')]+'%'};return _0x2c2d46;}})});}_0x881a6b=_[_0x6c86('0x3e')]({},_0x881a6b,_0x7c4eed['options']);var _0xb7e0a7={'where':_0x881a6b[_0x6c86('0x3c')]};return db[_0x6c86('0x2c')][_0x6c86('0x1d')](_0xb7e0a7)[_0x6c86('0x24')](function(_0x37c122){_0x636ff1[_0x6c86('0x1d')]=_0x37c122;if(_0x7c4eed[_0x6c86('0x32')][_0x6c86('0x41')]){_0x881a6b[_0x6c86('0x42')]=[{'all':!![]}];}return db[_0x6c86('0x2c')][_0x6c86('0x43')](_0x881a6b);})[_0x6c86('0x24')](function(_0x391b96){_0x636ff1['rows']=_0x391b96;return _0x636ff1;})['then'](respondWithFilteredResult(_0x119268,_0x881a6b))[_0x6c86('0x44')](handleError(_0x119268,null));};exports[_0x6c86('0x45')]=function(_0x2e91a8,_0x3b2fd8){var _0x15a53e={'raw':!![],'where':{'id':_0x2e91a8[_0x6c86('0x46')]['id']}},_0x3ff9fe={};_0x3ff9fe[_0x6c86('0x30')]=_[_0x6c86('0x31')](db['MailTransferReport'][_0x6c86('0x2d')]);_0x3ff9fe['query']=_['keys'](_0x2e91a8[_0x6c86('0x32')]);_0x3ff9fe[_0x6c86('0x33')]=_[_0x6c86('0x34')](_0x3ff9fe[_0x6c86('0x30')],_0x3ff9fe[_0x6c86('0x32')]);_0x15a53e[_0x6c86('0x35')]=_[_0x6c86('0x34')](_0x3ff9fe[_0x6c86('0x30')],qs[_0x6c86('0x36')](_0x2e91a8['query'][_0x6c86('0x36')]));_0x15a53e[_0x6c86('0x35')]=_0x15a53e['attributes'][_0x6c86('0x37')]?_0x15a53e[_0x6c86('0x35')]:_0x3ff9fe[_0x6c86('0x30')];if(_0x2e91a8[_0x6c86('0x32')]['includeAll']){_0x15a53e[_0x6c86('0x42')]=[{'all':!![]}];}_0x15a53e=_[_0x6c86('0x3e')]({},_0x15a53e,_0x2e91a8[_0x6c86('0x47')]);return db['MailTransferReport'][_0x6c86('0x48')](_0x15a53e)['then'](handleEntityNotFound(_0x3b2fd8,null))[_0x6c86('0x24')](respondWithResult(_0x3b2fd8,null))['catch'](handleError(_0x3b2fd8,null));};exports['create']=function(_0x1bc409,_0x144909){return db[_0x6c86('0x2c')][_0x6c86('0x49')](_0x1bc409[_0x6c86('0x4a')],{})[_0x6c86('0x24')](respondWithResult(_0x144909,0xc9))[_0x6c86('0x44')](handleError(_0x144909,null));};exports[_0x6c86('0x23')]=function(_0x3b2a7d,_0x566495){if(_0x3b2a7d[_0x6c86('0x4a')]['id']){delete _0x3b2a7d['body']['id'];}return db[_0x6c86('0x2c')][_0x6c86('0x48')]({'where':{'id':_0x3b2a7d[_0x6c86('0x46')]['id']}})[_0x6c86('0x24')](handleEntityNotFound(_0x566495,null))[_0x6c86('0x24')](saveUpdates(_0x3b2a7d['body'],null))['then'](respondWithResult(_0x566495,null))[_0x6c86('0x44')](handleError(_0x566495,null));};exports['destroy']=function(_0x5d96d6,_0x51f96f){return db['MailTransferReport'][_0x6c86('0x48')]({'where':{'id':_0x5d96d6[_0x6c86('0x46')]['id']}})[_0x6c86('0x24')](handleEntityNotFound(_0x51f96f,null))['then'](removeEntity(_0x51f96f,null))[_0x6c86('0x44')](handleError(_0x51f96f,null));};exports[_0x6c86('0x4b')]=function(_0x3c584a,_0x3bf7b5){return db[_0x6c86('0x2c')][_0x6c86('0x4b')]()[_0x6c86('0x24')](respondWithResult(_0x3bf7b5,null))[_0x6c86('0x44')](handleError(_0x3bf7b5,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9fcd2df..745c735 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 _0x6c96=['../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x6c96,0x1c1));var _0x66c9=function(_0x120856,_0x2b0c42){_0x120856=_0x120856-0x0;var _0xa3ab9f=_0x6c96[_0x120856];return _0xa3ab9f;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var logger=require(_0x66c9('0x1'))(_0x66c9('0x2'));var moment=require('moment');var BPromise=require(_0x66c9('0x3'));var rp=require(_0x66c9('0x4'));var fs=require('fs');var path=require(_0x66c9('0x5'));var rimraf=require(_0x66c9('0x6'));var config=require(_0x66c9('0x7'));var attributes=require(_0x66c9('0x8'));module[_0x66c9('0x9')]=function(_0x55b24d,_0x1c8b59){return _0x55b24d['define'](_0x66c9('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x66c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ffb=['define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x3877b6,_0x34a518){var _0xf20535=function(_0x3c7b22){while(--_0x3c7b22){_0x3877b6['push'](_0x3877b6['shift']());}};_0xf20535(++_0x34a518);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x3895f4,_0x49e89f){_0x3895f4=_0x3895f4-0x0;var _0x517156=_0x3ffb[_0x3895f4];return _0x517156;};'use strict';var _=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var logger=require(_0xb3ff('0x2'))(_0xb3ff('0x3'));var moment=require(_0xb3ff('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3ff('0x5'));var fs=require('fs');var path=require(_0xb3ff('0x6'));var rimraf=require(_0xb3ff('0x7'));var config=require(_0xb3ff('0x8'));var attributes=require(_0xb3ff('0x9'));module[_0xb3ff('0xa')]=function(_0x45d514,_0x59bcb3){return _0x45d514[_0xb3ff('0xb')](_0xb3ff('0xc'),attributes,{'tableName':_0xb3ff('0xd'),'paranoid':![],'indexes':[{'name':_0xb3ff('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 4d8776d..7f933a4 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 _0x50d1=['request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','MailTransferReport,\x20%s,\x20%s'];(function(_0x50de90,_0x158e9f){var _0x141e90=function(_0x1ef6e7){while(--_0x1ef6e7){_0x50de90['push'](_0x50de90['shift']());}};_0x141e90(++_0x158e9f);}(_0x50d1,0x71));var _0x150d=function(_0x535581,_0x15d9cf){_0x535581=_0x535581-0x0;var _0x2bc1f0=_0x50d1[_0x535581];return _0x2bc1f0;};'use strict';var _=require(_0x150d('0x0'));var util=require('util');var moment=require(_0x150d('0x1'));var BPromise=require(_0x150d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x150d('0x3'));var db=require(_0x150d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x150d('0x5'))(_0x150d('0x6'));var config=require(_0x150d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x150d('0x8')][_0x150d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29fab1,_0x4619b2,_0x3c66d2){return new BPromise(function(_0x1fd0a0,_0x4ebc25){return client[_0x150d('0xa')](_0x29fab1,_0x3c66d2)[_0x150d('0xb')](function(_0x3dba8c){logger['info'](_0x150d('0xc'),_0x4619b2,_0x150d('0xd'));logger[_0x150d('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4619b2,_0x150d('0xd'),JSON[_0x150d('0xf')](_0x3dba8c));if(_0x3dba8c[_0x150d('0x10')]){if(_0x3dba8c[_0x150d('0x10')]['code']===0x1f4){logger[_0x150d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x4619b2,_0x3dba8c[_0x150d('0x10')][_0x150d('0x11')]);return _0x4ebc25(_0x3dba8c['error'][_0x150d('0x11')]);}logger['error'](_0x150d('0xc'),_0x4619b2,_0x3dba8c['error'][_0x150d('0x11')]);return _0x1fd0a0(_0x3dba8c[_0x150d('0x10')][_0x150d('0x11')]);}else{logger[_0x150d('0x12')](_0x150d('0xc'),_0x4619b2,_0x150d('0xd'));_0x1fd0a0(_0x3dba8c[_0x150d('0x13')][_0x150d('0x11')]);}})[_0x150d('0x14')](function(_0x46ec71){logger[_0x150d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x4619b2,_0x46ec71);_0x4ebc25(_0x46ec71);});});} \ No newline at end of file +var _0x7aab=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','client','http'];(function(_0x336304,_0x57db45){var _0x575904=function(_0x55f4a2){while(--_0x55f4a2){_0x336304['push'](_0x336304['shift']());}};_0x575904(++_0x57db45);}(_0x7aab,0x97));var _0xb7aa=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7aab[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xb7aa('0x0'));var util=require(_0xb7aa('0x1'));var moment=require(_0xb7aa('0x2'));var BPromise=require(_0xb7aa('0x3'));var rs=require(_0xb7aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb7aa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb7aa('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb7aa('0x7')][_0xb7aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa7666c,_0x3de72a,_0x58b1ba){return new BPromise(function(_0x2bbc01,_0x404620){return client[_0xb7aa('0x9')](_0xa7666c,_0x58b1ba)[_0xb7aa('0xa')](function(_0x34cbf4){logger[_0xb7aa('0xb')](_0xb7aa('0xc'),_0x3de72a,_0xb7aa('0xd'));logger[_0xb7aa('0xe')](_0xb7aa('0xf'),_0x3de72a,_0xb7aa('0xd'),JSON[_0xb7aa('0x10')](_0x34cbf4));if(_0x34cbf4[_0xb7aa('0x11')]){if(_0x34cbf4['error'][_0xb7aa('0x12')]===0x1f4){logger[_0xb7aa('0x11')](_0xb7aa('0xc'),_0x3de72a,_0x34cbf4[_0xb7aa('0x11')][_0xb7aa('0x13')]);return _0x404620(_0x34cbf4[_0xb7aa('0x11')][_0xb7aa('0x13')]);}logger[_0xb7aa('0x11')](_0xb7aa('0xc'),_0x3de72a,_0x34cbf4[_0xb7aa('0x11')]['message']);return _0x2bbc01(_0x34cbf4['error'][_0xb7aa('0x13')]);}else{logger[_0xb7aa('0xb')](_0xb7aa('0xc'),_0x3de72a,'request\x20sent');_0x2bbc01(_0x34cbf4['result'][_0xb7aa('0x13')]);}})['catch'](function(_0x5e4f2e){logger[_0xb7aa('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x3de72a,_0x5e4f2e);_0x404620(_0x5e4f2e);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 8955f54..5dfe400 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 _0x40d1=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x107e01,_0xe901a9){var _0x43d6ca=function(_0x17abfe){while(--_0x17abfe){_0x107e01['push'](_0x107e01['shift']());}};_0x43d6ca(++_0xe901a9);}(_0x40d1,0xfe));var _0x140d=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x40d1[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x140d('0x0'));var util=require(_0x140d('0x1'));var path=require('path');var timeout=require(_0x140d('0x2'));var express=require(_0x140d('0x3'));var router=express[_0x140d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x140d('0x5'));var config=require(_0x140d('0x6'));var controller=require(_0x140d('0x7'));router[_0x140d('0x8')]('/',auth[_0x140d('0x9')](),controller[_0x140d('0xa')]);router[_0x140d('0x8')]('/describe',auth[_0x140d('0x9')](),controller[_0x140d('0xb')]);router[_0x140d('0x8')](_0x140d('0xc'),auth[_0x140d('0x9')](),controller[_0x140d('0xd')]);router[_0x140d('0xe')]('/',auth[_0x140d('0x9')](),controller[_0x140d('0xf')]);router[_0x140d('0x10')](_0x140d('0xc'),auth['isAuthenticated'](),controller[_0x140d('0x11')]);router[_0x140d('0x12')](_0x140d('0xc'),auth['isAuthenticated'](),controller[_0x140d('0x13')]);module[_0x140d('0x14')]=router; \ No newline at end of file +var _0xf5c6=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update'];(function(_0x24cf7f,_0xcda231){var _0x4c6742=function(_0x2469db){while(--_0x2469db){_0x24cf7f['push'](_0x24cf7f['shift']());}};_0x4c6742(++_0xcda231);}(_0xf5c6,0x192));var _0x6f5c=function(_0x15753b,_0x43562e){_0x15753b=_0x15753b-0x0;var _0x22c790=_0xf5c6[_0x15753b];return _0x22c790;};'use strict';var multer=require(_0x6f5c('0x0'));var util=require(_0x6f5c('0x1'));var path=require(_0x6f5c('0x2'));var timeout=require(_0x6f5c('0x3'));var express=require('express');var router=express[_0x6f5c('0x4')]();var fs_extra=require(_0x6f5c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6f5c('0x6'));var config=require('../../config/environment');var controller=require(_0x6f5c('0x7'));router[_0x6f5c('0x8')]('/',auth[_0x6f5c('0x9')](),controller[_0x6f5c('0xa')]);router['get'](_0x6f5c('0xb'),auth[_0x6f5c('0x9')](),controller[_0x6f5c('0xc')]);router[_0x6f5c('0x8')](_0x6f5c('0xd'),auth[_0x6f5c('0x9')](),controller[_0x6f5c('0xe')]);router[_0x6f5c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6f5c('0x10')](_0x6f5c('0xd'),auth['isAuthenticated'](),controller[_0x6f5c('0x11')]);router[_0x6f5c('0x12')]('/:id',auth[_0x6f5c('0x9')](),controller['destroy']);module[_0x6f5c('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index b791a0e..126cc56 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 _0xbb6c=['getDataValue','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xbb6c,0x1c8));var _0xcbb6=function(_0x18c6cd,_0x3d50d2){_0x18c6cd=_0x18c6cd-0x0;var _0x450f8b=_0xbb6c[_0x18c6cd];return _0x450f8b;};'use strict';var Sequelize=require(_0xcbb6('0x0'));var moment=require('moment');module[_0xcbb6('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xcbb6('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xcbb6('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xcbb6('0x4')]},'enterAt':{'type':Sequelize[_0xcbb6('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x56dcdc){var _0x1d8403=moment(_0x56dcdc);var _0xe33ba7=moment(this[_0xcbb6('0x6')]('enterAt'));var _0x437a86=_0x1d8403['diff'](_0xe33ba7,'seconds');this[_0xcbb6('0x7')](_0xcbb6('0x8'),_0x56dcdc);this['setDataValue'](_0xcbb6('0x9'),_0x437a86>=0x0?_0x437a86:null);}},'data1':{'type':Sequelize[_0xcbb6('0x2')],'comment':_0xcbb6('0xa')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xcbb6('0x2')],'comment':_0xcbb6('0xb')},'data4':{'type':Sequelize[_0xcbb6('0x2')],'comment':_0xcbb6('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0xcbb6('0xd')},'role':{'type':Sequelize[_0xcbb6('0x2')]},'internal':{'type':Sequelize[_0xcbb6('0x4')]},'uniqueid':{'type':Sequelize[_0xcbb6('0x2')]}}; \ No newline at end of file +var _0x9a36=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','seconds','exitAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING'];(function(_0x526300,_0x4b6256){var _0x27f26b=function(_0x267ad9){while(--_0x267ad9){_0x526300['push'](_0x526300['shift']());}};_0x27f26b(++_0x4b6256);}(_0x9a36,0xfb));var _0x69a3=function(_0x48a80b,_0x4e6198){_0x48a80b=_0x48a80b-0x0;var _0x535637=_0x9a36[_0x48a80b];return _0x535637;};'use strict';var Sequelize=require(_0x69a3('0x0'));var moment=require(_0x69a3('0x1'));module[_0x69a3('0x2')]={'channel':{'type':Sequelize[_0x69a3('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x69a3('0x4'),'comment':_0x69a3('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x69a3('0x6')]},'exitAt':{'type':Sequelize[_0x69a3('0x6')],'set':function(_0x30695c){var _0xc75e42=moment(_0x30695c);var _0x8714a8=moment(this[_0x69a3('0x7')]('enterAt'));var _0xf036e9=_0xc75e42['diff'](_0x8714a8,_0x69a3('0x8'));this['setDataValue'](_0x69a3('0x9'),_0x30695c);this[_0x69a3('0xa')]('duration',_0xf036e9>=0x0?_0xf036e9:null);}},'data1':{'type':Sequelize[_0x69a3('0x3')],'comment':_0x69a3('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x69a3('0xc')},'data3':{'type':Sequelize[_0x69a3('0x3')],'comment':_0x69a3('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0x69a3('0xe')},'data5':{'type':Sequelize[_0x69a3('0x3')],'comment':_0x69a3('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x69a3('0x10')]},'uniqueid':{'type':Sequelize[_0x69a3('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1777120..abebc8a 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x66325a,_0x424442){var _0x5cc9d2=function(_0x392ccf){while(--_0x392ccf){_0x66325a['push'](_0x66325a['shift']());}};_0x5cc9d2(++_0x424442);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _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(_0x14472,_0x45223c){var _0x557fcb=function(_0x3aaad0){while(--_0x3aaad0){_0x14472['push'](_0x14472['shift']());}};_0x557fcb(++_0x45223c);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'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 e8d0b1a..3543abc 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 _0xef96=['rimraf','exports','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38bca2,_0x1c9bf2){var _0x82b6=function(_0x4fbb3f){while(--_0x4fbb3f){_0x38bca2['push'](_0x38bca2['shift']());}};_0x82b6(++_0x1c9bf2);}(_0xef96,0x162));var _0x6ef9=function(_0x1799e9,_0x43f13d){_0x1799e9=_0x1799e9-0x0;var _0x1f6923=_0xef96[_0x1799e9];return _0x1f6923;};'use strict';var _=require(_0x6ef9('0x0'));var util=require(_0x6ef9('0x1'));var logger=require(_0x6ef9('0x2'))(_0x6ef9('0x3'));var moment=require(_0x6ef9('0x4'));var BPromise=require(_0x6ef9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ef9('0x6'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0x6ef9('0x7')]=function(_0x1983df,_0x34ba12){return _0x1983df['define'](_0x6ef9('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x6ef9('0x9'),'fields':[_0x6ef9('0xa'),_0x6ef9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x291f=['request-promise','rimraf','exports','define','membername_interface','membername','../../config/logger','moment'];(function(_0x4ddfc9,_0x23f05f){var _0x47da83=function(_0xf31784){while(--_0xf31784){_0x4ddfc9['push'](_0x4ddfc9['shift']());}};_0x47da83(++_0x23f05f);}(_0x291f,0xa6));var _0xf291=function(_0x50a901,_0x586e64){_0x50a901=_0x50a901-0x0;var _0x17951b=_0x291f[_0x50a901];return _0x17951b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf291('0x0'))('api');var moment=require(_0xf291('0x1'));var BPromise=require('bluebird');var rp=require(_0xf291('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf291('0x3'));var config=require('../../config/environment');var attributes=require('./memberReport.attributes');module[_0xf291('0x4')]=function(_0x14faac,_0x1915e1){return _0x14faac[_0xf291('0x5')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xf291('0x6'),'fields':[_0xf291('0x7'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f016d82..23eafa2 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 _0xc03e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0xc03e,0x15a));var _0xec03=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xc03e[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xec03('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec03('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec03('0x3'));var logger=require(_0xec03('0x4'))(_0xec03('0x5'));var config=require(_0xec03('0x6'));var jayson=require(_0xec03('0x7'));var client=jayson[_0xec03('0x8')][_0xec03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcaaf03,_0x278f90,_0x529ebd){return new BPromise(function(_0x4205e9,_0xb0638e){return client[_0xec03('0xa')](_0xcaaf03,_0x529ebd)[_0xec03('0xb')](function(_0x4d7e09){logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));logger[_0xec03('0xf')](_0xec03('0x10'),_0x278f90,_0xec03('0xe'),JSON[_0xec03('0x11')](_0x4d7e09));if(_0x4d7e09[_0xec03('0x12')]){if(_0x4d7e09['error'][_0xec03('0x13')]===0x1f4){logger[_0xec03('0x12')](_0xec03('0xd'),_0x278f90,_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);return _0xb0638e(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}logger[_0xec03('0x12')]('MemberReport,\x20%s,\x20%s',_0x278f90,_0x4d7e09['error']['message']);return _0x4205e9(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}else{logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));_0x4205e9(_0x4d7e09[_0xec03('0x15')][_0xec03('0x14')]);}})[_0xec03('0x16')](function(_0x5c2f1a){logger[_0xec03('0x12')]('MemberReport,\x20%s,\x20%s',_0x278f90,_0x5c2f1a);_0xb0638e(_0x5c2f1a);});});}exports[_0xec03('0x17')]=function(_0x5e8ae2){var _0x25292d=this;return new Promise(function(_0x5b3e04,_0x57dc2d){return db[_0xec03('0x18')][_0xec03('0x19')]({'raw':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2['options'][_0xec03('0x1b')]||null:null,'attributes':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1c')]||null:null,'limit':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1d')]||null:null,'include':_0x5e8ae2[_0xec03('0x1a')]?_0x5e8ae2['options'][_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x5e8ae2[_0xec03('0x1a')][_0xec03('0x1e')],function(_0x33de1e){return{'model':db[_0x33de1e[_0xec03('0x20')]],'as':_0x33de1e['as'],'attributes':_0x33de1e['attributes'],'include':_0x33de1e[_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x33de1e['include'],function(_0x2bfcf6){return{'model':db[_0x2bfcf6[_0xec03('0x20')]],'as':_0x2bfcf6['as'],'attributes':_0x2bfcf6[_0xec03('0x1c')],'include':_0x2bfcf6[_0xec03('0x1e')]?_[_0xec03('0x1f')](_0x2bfcf6['include'],function(_0x73cc4f){return{'model':db[_0x73cc4f[_0xec03('0x20')]],'as':_0x73cc4f['as'],'attributes':_0x73cc4f[_0xec03('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xec03('0xb')](function(_0x29e904){logger['info'](_0xec03('0x17'),_0x5e8ae2);logger[_0xec03('0xf')]('GetMemberReport',_0x5e8ae2,JSON['stringify'](_0x29e904));_0x5b3e04(_0x29e904);})[_0xec03('0x16')](function(_0x12b5c9){logger[_0xec03('0x12')](_0xec03('0x17'),_0x12b5c9[_0xec03('0x14')],_0x5e8ae2);_0x57dc2d(_0x25292d[_0xec03('0x12')](0x1f4,_0x12b5c9[_0xec03('0x14')]));});});};exports[_0xec03('0x21')]=function(_0x51fad6){var _0x28f60c=this;return new Promise(function(_0x31c08d,_0x2bd889){return db[_0xec03('0x18')][_0xec03('0x22')](_0x51fad6[_0xec03('0x23')],{'raw':_0x51fad6[_0xec03('0x1a')]?_0x51fad6[_0xec03('0x1a')][_0xec03('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x5d441b){logger['info'](_0xec03('0x21'),_0x51fad6);logger[_0xec03('0xf')](_0xec03('0x21'),_0x51fad6,JSON[_0xec03('0x11')](_0x5d441b));_0x31c08d(_0x5d441b);})['catch'](function(_0x576d5e){logger['error']('CreateMemberReport',_0x576d5e[_0xec03('0x14')],_0x51fad6);_0x2bd889(_0x28f60c[_0xec03('0x12')](0x1f4,_0x576d5e[_0xec03('0x14')]));});});};exports[_0xec03('0x25')]=function(_0x11c75b){var _0x3d7d98=this;return new Promise(function(_0x23a26b,_0x1cee38){return db[_0xec03('0x18')][_0xec03('0x26')](_0x11c75b[_0xec03('0x23')],{'raw':_0x11c75b[_0xec03('0x1a')]?_0x11c75b['options'][_0xec03('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')]['where']||null:null,'attributes':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')][_0xec03('0x1c')]||null:null,'limit':_0x11c75b[_0xec03('0x1a')]?_0x11c75b[_0xec03('0x1a')][_0xec03('0x1d')]||null:null})[_0xec03('0xb')](function(_0x3c55b7){logger[_0xec03('0xc')](_0xec03('0x25'),_0x11c75b);logger[_0xec03('0xf')]('UpdateMemberReport',_0x11c75b,JSON[_0xec03('0x11')](_0x3c55b7));_0x23a26b(_0x3c55b7);})[_0xec03('0x16')](function(_0x37819a){logger[_0xec03('0x12')](_0xec03('0x25'),_0x37819a[_0xec03('0x14')],_0x11c75b);_0x1cee38(_0x3d7d98[_0xec03('0x12')](0x1f4,_0x37819a[_0xec03('0x14')]));});});}; \ No newline at end of file +var _0xe3da=['stringify','error','code','message','result','MemberReport','findAll','options','raw','attributes','limit','include','map','model','then','GetMemberReport','catch','CreateMemberReport','body','UpdateMemberReport','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s'];(function(_0x21d0a4,_0x265b35){var _0x1332ea=function(_0x2e7bfa){while(--_0x2e7bfa){_0x21d0a4['push'](_0x21d0a4['shift']());}};_0x1332ea(++_0x265b35);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'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});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['GetMemberReport']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')]({'raw':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f8cf9['options']?_0x3f8cf9[_0xae3d('0x1a')]['where']||null:null,'attributes':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'limit':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1d')]||null:null,'include':_0x3f8cf9[_0xae3d('0x1a')]?_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x3f8cf9[_0xae3d('0x1a')][_0xae3d('0x1e')],function(_0x37f5ff){return{'model':db[_0x37f5ff[_0xae3d('0x20')]],'as':_0x37f5ff['as'],'attributes':_0x37f5ff[_0xae3d('0x1c')],'include':_0x37f5ff[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x37f5ff[_0xae3d('0x1e')],function(_0x2131e9){return{'model':db[_0x2131e9[_0xae3d('0x20')]],'as':_0x2131e9['as'],'attributes':_0x2131e9['attributes'],'include':_0x2131e9[_0xae3d('0x1e')]?_[_0xae3d('0x1f')](_0x2131e9[_0xae3d('0x1e')],function(_0x52df0f){return{'model':db[_0x52df0f[_0xae3d('0x20')]],'as':_0x52df0f['as'],'attributes':_0x52df0f[_0xae3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xae3d('0x21')](function(_0x54c1e1){logger['info'](_0xae3d('0x22'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x22'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x54c1e1));_0x558e42(_0x54c1e1);})[_0xae3d('0x23')](function(_0x561371){logger[_0xae3d('0x14')](_0xae3d('0x22'),_0x561371['message'],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x561371[_0xae3d('0x16')]));});});};exports[_0xae3d('0x24')]=function(_0x46f484){var _0x432c04=this;return new Promise(function(_0x6ef13c,_0x5356d4){return db['MemberReport']['create'](_0x46f484[_0xae3d('0x25')],{'raw':_0x46f484[_0xae3d('0x1a')]?_0x46f484[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x31af1b){logger[_0xae3d('0xe')](_0xae3d('0x24'),_0x46f484);logger[_0xae3d('0x11')](_0xae3d('0x24'),_0x46f484,JSON[_0xae3d('0x13')](_0x31af1b));_0x6ef13c(_0x31af1b);})[_0xae3d('0x23')](function(_0x5ea647){logger[_0xae3d('0x14')]('CreateMemberReport',_0x5ea647['message'],_0x46f484);_0x5356d4(_0x432c04[_0xae3d('0x14')](0x1f4,_0x5ea647['message']));});});};exports[_0xae3d('0x26')]=function(_0x4b79ed){var _0x59425f=this;return new Promise(function(_0x1a28b5,_0x2e055a){return db[_0xae3d('0x18')]['update'](_0x4b79ed[_0xae3d('0x25')],{'raw':_0x4b79ed['options']?_0x4b79ed[_0xae3d('0x1a')][_0xae3d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b79ed[_0xae3d('0x1a')]?_0x4b79ed[_0xae3d('0x1a')][_0xae3d('0x27')]||null:null,'attributes':_0x4b79ed[_0xae3d('0x1a')]?_0x4b79ed[_0xae3d('0x1a')][_0xae3d('0x1c')]||null:null,'limit':_0x4b79ed[_0xae3d('0x1a')]?_0x4b79ed[_0xae3d('0x1a')][_0xae3d('0x1d')]||null:null})['then'](function(_0x544269){logger[_0xae3d('0xe')]('UpdateMemberReport',_0x4b79ed);logger[_0xae3d('0x11')](_0xae3d('0x26'),_0x4b79ed,JSON[_0xae3d('0x13')](_0x544269));_0x1a28b5(_0x544269);})[_0xae3d('0x23')](function(_0x2c2892){logger[_0xae3d('0x14')](_0xae3d('0x26'),_0x2c2892[_0xae3d('0x16')],_0x4b79ed);_0x2e055a(_0x59425f[_0xae3d('0x14')](0x1f4,_0x2c2892[_0xae3d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 371f5bc..db324b4 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 _0xc95f=['get','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x150aa3,_0x2d7de7){var _0x40347d=function(_0xda87be){while(--_0xda87be){_0x150aa3['push'](_0x150aa3['shift']());}};_0x40347d(++_0x2d7de7);}(_0xc95f,0xe2));var _0xfc95=function(_0x2ef16b,_0x4b612a){_0x2ef16b=_0x2ef16b-0x0;var _0x53a7eb=_0xc95f[_0x2ef16b];return _0x53a7eb;};'use strict';var multer=require(_0xfc95('0x0'));var util=require(_0xfc95('0x1'));var path=require(_0xfc95('0x2'));var timeout=require(_0xfc95('0x3'));var express=require(_0xfc95('0x4'));var router=express[_0xfc95('0x5')]();var fs_extra=require(_0xfc95('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfc95('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xfc95('0x8')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0xe407=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','index','multer','util'];(function(_0xfc3442,_0x1b1ea9){var _0x15a782=function(_0xe64966){while(--_0xe64966){_0xfc3442['push'](_0xfc3442['shift']());}};_0x15a782(++_0x1b1ea9);}(_0xe407,0x181));var _0x7e40=function(_0x211591,_0x3fb8f9){_0x211591=_0x211591-0x0;var _0x51414a=_0xe407[_0x211591];return _0x51414a;};'use strict';var multer=require(_0x7e40('0x0'));var util=require(_0x7e40('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e40('0x2'));var router=express[_0x7e40('0x3')]();var fs_extra=require(_0x7e40('0x4'));var auth=require(_0x7e40('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7e40('0x6'));var controller=require(_0x7e40('0x7'));router['get']('/',controller[_0x7e40('0x8')]);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 56363bb..e4e8691 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 _0x1f5f=['sequelize','STRING','version'];(function(_0x5485a2,_0x486c99){var _0x3cd67a=function(_0x522b4e){while(--_0x522b4e){_0x5485a2['push'](_0x5485a2['shift']());}};_0x3cd67a(++_0x486c99);}(_0x1f5f,0x1c5));var _0xf1f5=function(_0x2af3fb,_0x732372){_0x2af3fb=_0x2af3fb-0x0;var _0x237c02=_0x1f5f[_0x2af3fb];return _0x237c02;};'use strict';var Sequelize=require(_0xf1f5('0x0'));module['exports']={'version':{'type':Sequelize[_0xf1f5('0x1')],'unique':_0xf1f5('0x2')}}; \ No newline at end of file +var _0xa0af=['sequelize','exports','STRING'];(function(_0x2609ba,_0x37c1fc){var _0x298ab2=function(_0xf36661){while(--_0xf36661){_0x2609ba['push'](_0x2609ba['shift']());}};_0x298ab2(++_0x37c1fc);}(_0xa0af,0x1a7));var _0xfa0a=function(_0x11772b,_0x3dcf89){_0x11772b=_0x11772b-0x0;var _0x3b6219=_0xa0af[_0x11772b];return _0x3b6219;};'use strict';var Sequelize=require(_0xfa0a('0x0'));module[_0xfa0a('0x1')]={'version':{'type':Sequelize[_0xfa0a('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index b3f9c85..108b45d 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 _0xe963=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Migration','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xe963,0xfa));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e96('0x0'));var zipdir=require(_0x3e96('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3e96('0x2'));var BPromise=require(_0x3e96('0x3'));var Mustache=require(_0x3e96('0x4'));var util=require(_0x3e96('0x5'));var path=require(_0x3e96('0x6'));var sox=require(_0x3e96('0x7'));var csv=require('to-csv');var ejs=require(_0x3e96('0x8'));var fs=require('fs');var fs_extra=require(_0x3e96('0x9'));var _=require(_0x3e96('0xa'));var squel=require(_0x3e96('0xb'));var crypto=require(_0x3e96('0xc'));var jsforce=require(_0x3e96('0xd'));var deskjs=require(_0x3e96('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3e96('0xf'));var Papa=require(_0x3e96('0x10'));var Redis=require(_0x3e96('0x11'));var authService=require(_0x3e96('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3e96('0x13'));var hardwareService=require(_0x3e96('0x14'));var logger=require('../../config/logger')(_0x3e96('0x15'));var utils=require(_0x3e96('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3e96('0x17'));var db=require(_0x3e96('0x18'))['db'];function respondWithStatusCode(_0x6f4cba,_0x2b3f35){_0x2b3f35=_0x2b3f35||0xcc;return function(_0x1dbc8b){if(_0x1dbc8b){return _0x6f4cba['sendStatus'](_0x2b3f35);}return _0x6f4cba[_0x3e96('0x19')](_0x2b3f35)[_0x3e96('0x1a')]();};}function respondWithResult(_0x400b53,_0x2fd6ec){_0x2fd6ec=_0x2fd6ec||0xc8;return function(_0x2a8e36){if(_0x2a8e36){return _0x400b53[_0x3e96('0x19')](_0x2fd6ec)[_0x3e96('0x1b')](_0x2a8e36);}};}function respondWithFilteredResult(_0xfac72b,_0x2807d3){return function(_0x598b7c){if(_0x598b7c){var _0x118dd5=typeof _0x2807d3[_0x3e96('0x1c')]===_0x3e96('0x1d')&&typeof _0x2807d3[_0x3e96('0x1e')]==='undefined';var _0x5dd971=_0x598b7c[_0x3e96('0x1f')];var _0x2bcf71=_0x118dd5?0x0:_0x2807d3[_0x3e96('0x1c')];var _0x591c59=_0x118dd5?_0x598b7c['count']:_0x2807d3[_0x3e96('0x1c')]+_0x2807d3[_0x3e96('0x1e')];var _0x5069ce;if(_0x591c59>=_0x5dd971){_0x591c59=_0x5dd971;_0x5069ce=0xc8;}else{_0x5069ce=0xce;}_0xfac72b['status'](_0x5069ce);return _0xfac72b['set'](_0x3e96('0x20'),_0x2bcf71+'-'+_0x591c59+'/'+_0x5dd971)['json'](_0x598b7c);}return null;};}function patchUpdates(_0x2474c1){return function(_0x596e68){try{jsonpatch['apply'](_0x596e68,_0x2474c1,!![]);}catch(_0x3c3f59){return BPromise[_0x3e96('0x21')](_0x3c3f59);}return _0x596e68[_0x3e96('0x22')]();};}function saveUpdates(_0x20e447,_0x42fcac){return function(_0x3ec1f2){if(_0x3ec1f2){return _0x3ec1f2[_0x3e96('0x23')](_0x20e447)[_0x3e96('0x24')](function(_0x1dbf8a){return _0x1dbf8a;});}return null;};}function removeEntity(_0x4abe64,_0x2d283a){return function(_0xc68b74){if(_0xc68b74){return _0xc68b74[_0x3e96('0x25')]()[_0x3e96('0x24')](function(){_0x4abe64[_0x3e96('0x19')](0xcc)[_0x3e96('0x1a')]();});}};}function handleEntityNotFound(_0x2657fc,_0x53a19b){return function(_0x272739){if(!_0x272739){_0x2657fc[_0x3e96('0x26')](0x194);}return _0x272739;};}function handleError(_0x3fa33b,_0x104bd2){_0x104bd2=_0x104bd2||0x1f4;return function(_0x3c1fcd){logger[_0x3e96('0x27')](_0x3c1fcd[_0x3e96('0x28')]);if(_0x3c1fcd[_0x3e96('0x29')]){delete _0x3c1fcd[_0x3e96('0x29')];}_0x3fa33b[_0x3e96('0x19')](_0x104bd2)[_0x3e96('0x2a')](_0x3c1fcd);};}exports[_0x3e96('0x2b')]=function(_0x2e5a10,_0x4cfd25){var _0xcab454={},_0x5317a7={},_0x8649aa={'count':0x0,'rows':[]};var _0xf3ab59=_[_0x3e96('0x2c')](db[_0x3e96('0x2d')]['rawAttributes'],function(_0x4ed91d){return{'name':_0x4ed91d['fieldName'],'type':_0x4ed91d['type'][_0x3e96('0x2e')]};});_0x5317a7['model']=_[_0x3e96('0x2c')](_0xf3ab59,_0x3e96('0x29'));_0x5317a7[_0x3e96('0x2f')]=_['keys'](_0x2e5a10[_0x3e96('0x2f')]);_0x5317a7[_0x3e96('0x30')]=_[_0x3e96('0x31')](_0x5317a7['model'],_0x5317a7[_0x3e96('0x2f')]);_0xcab454['attributes']=_[_0x3e96('0x31')](_0x5317a7[_0x3e96('0x32')],qs[_0x3e96('0x33')](_0x2e5a10[_0x3e96('0x2f')][_0x3e96('0x33')]));_0xcab454[_0x3e96('0x34')]=_0xcab454[_0x3e96('0x34')][_0x3e96('0x35')]?_0xcab454[_0x3e96('0x34')]:_0x5317a7[_0x3e96('0x32')];if(!_0x2e5a10[_0x3e96('0x2f')][_0x3e96('0x36')](_0x3e96('0x37'))){_0xcab454[_0x3e96('0x1e')]=qs[_0x3e96('0x1e')](_0x2e5a10[_0x3e96('0x2f')][_0x3e96('0x1e')]);_0xcab454['offset']=qs[_0x3e96('0x1c')](_0x2e5a10['query'][_0x3e96('0x1c')]);}_0xcab454[_0x3e96('0x38')]=qs[_0x3e96('0x39')](_0x2e5a10[_0x3e96('0x2f')]['sort']);_0xcab454[_0x3e96('0x3a')]=qs[_0x3e96('0x30')](_[_0x3e96('0x3b')](_0x2e5a10[_0x3e96('0x2f')],_0x5317a7['filters']),_0xf3ab59);if(_0x2e5a10[_0x3e96('0x2f')][_0x3e96('0x3c')]){_0xcab454['where']=_[_0x3e96('0x3d')](_0xcab454['where'],{'$or':_[_0x3e96('0x2c')](_0xf3ab59,function(_0xb5dc21){if(_0xb5dc21[_0x3e96('0x3e')]!==_0x3e96('0x3f')){var _0x14e748={};_0x14e748[_0xb5dc21['name']]={'$like':'%'+_0x2e5a10['query'][_0x3e96('0x3c')]+'%'};return _0x14e748;}})});}_0xcab454=_[_0x3e96('0x3d')]({},_0xcab454,_0x2e5a10[_0x3e96('0x40')]);var _0x8983b0={'where':_0xcab454[_0x3e96('0x3a')]};return db[_0x3e96('0x2d')][_0x3e96('0x1f')](_0x8983b0)['then'](function(_0x23c65e){_0x8649aa['count']=_0x23c65e;if(_0x2e5a10[_0x3e96('0x2f')]['includeAll']){_0xcab454[_0x3e96('0x41')]=[{'all':!![]}];}return db[_0x3e96('0x2d')][_0x3e96('0x42')](_0xcab454);})[_0x3e96('0x24')](function(_0x254b4d){_0x8649aa['rows']=_0x254b4d;return _0x8649aa;})[_0x3e96('0x24')](respondWithFilteredResult(_0x4cfd25,_0xcab454))['catch'](handleError(_0x4cfd25,null));}; \ No newline at end of file +var _0x0e50=['destroy','error','stack','name','send','index','map','Migration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','reject','save','update','then'];(function(_0x52051f,_0x28eab0){var _0x5b8e8a=function(_0xbe492){while(--_0xbe492){_0x52051f['push'](_0x52051f['shift']());}};_0x5b8e8a(++_0x28eab0);}(_0x0e50,0x18c));var _0x00e5=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x0e50[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x00e5('0x0'));var rimraf=require(_0x00e5('0x1'));var zipdir=require(_0x00e5('0x2'));var jsonpatch=require(_0x00e5('0x3'));var rp=require(_0x00e5('0x4'));var moment=require(_0x00e5('0x5'));var BPromise=require(_0x00e5('0x6'));var Mustache=require(_0x00e5('0x7'));var util=require(_0x00e5('0x8'));var path=require('path');var sox=require(_0x00e5('0x9'));var csv=require('to-csv');var ejs=require(_0x00e5('0xa'));var fs=require('fs');var fs_extra=require(_0x00e5('0xb'));var _=require(_0x00e5('0xc'));var squel=require(_0x00e5('0xd'));var crypto=require(_0x00e5('0xe'));var jsforce=require(_0x00e5('0xf'));var deskjs=require(_0x00e5('0x10'));var toCsv=require(_0x00e5('0x11'));var querystring=require('querystring');var Papa=require(_0x00e5('0x12'));var Redis=require(_0x00e5('0x13'));var authService=require(_0x00e5('0x14'));var qs=require(_0x00e5('0x15'));var as=require(_0x00e5('0x16'));var hardwareService=require(_0x00e5('0x17'));var logger=require(_0x00e5('0x18'))(_0x00e5('0x19'));var utils=require(_0x00e5('0x1a'));var config=require(_0x00e5('0x1b'));var licenseUtil=require(_0x00e5('0x1c'));var db=require(_0x00e5('0x1d'))['db'];function respondWithStatusCode(_0x1afdaf,_0x5f18c4){_0x5f18c4=_0x5f18c4||0xcc;return function(_0x4325e6){if(_0x4325e6){return _0x1afdaf[_0x00e5('0x1e')](_0x5f18c4);}return _0x1afdaf[_0x00e5('0x1f')](_0x5f18c4)[_0x00e5('0x20')]();};}function respondWithResult(_0xb7eda4,_0x12ef51){_0x12ef51=_0x12ef51||0xc8;return function(_0x187f18){if(_0x187f18){return _0xb7eda4[_0x00e5('0x1f')](_0x12ef51)['json'](_0x187f18);}};}function respondWithFilteredResult(_0xe7cd29,_0x30c0b8){return function(_0x5afa0c){if(_0x5afa0c){var _0x5d556b=typeof _0x30c0b8[_0x00e5('0x21')]==='undefined'&&typeof _0x30c0b8[_0x00e5('0x22')]==='undefined';var _0x5f55b9=_0x5afa0c[_0x00e5('0x23')];var _0x41aada=_0x5d556b?0x0:_0x30c0b8[_0x00e5('0x21')];var _0x1cff65=_0x5d556b?_0x5afa0c[_0x00e5('0x23')]:_0x30c0b8['offset']+_0x30c0b8[_0x00e5('0x22')];var _0x4fb583;if(_0x1cff65>=_0x5f55b9){_0x1cff65=_0x5f55b9;_0x4fb583=0xc8;}else{_0x4fb583=0xce;}_0xe7cd29[_0x00e5('0x1f')](_0x4fb583);return _0xe7cd29[_0x00e5('0x24')]('Content-Range',_0x41aada+'-'+_0x1cff65+'/'+_0x5f55b9)[_0x00e5('0x25')](_0x5afa0c);}return null;};}function patchUpdates(_0xfddf1a){return function(_0x8c2736){try{jsonpatch['apply'](_0x8c2736,_0xfddf1a,!![]);}catch(_0x44e72a){return BPromise[_0x00e5('0x26')](_0x44e72a);}return _0x8c2736[_0x00e5('0x27')]();};}function saveUpdates(_0x120ed9,_0x34823e){return function(_0x29aa0c){if(_0x29aa0c){return _0x29aa0c[_0x00e5('0x28')](_0x120ed9)[_0x00e5('0x29')](function(_0x10ef44){return _0x10ef44;});}return null;};}function removeEntity(_0x147b58,_0x41295c){return function(_0x190375){if(_0x190375){return _0x190375[_0x00e5('0x2a')]()['then'](function(){_0x147b58[_0x00e5('0x1f')](0xcc)[_0x00e5('0x20')]();});}};}function handleEntityNotFound(_0x516edc,_0x2921d1){return function(_0x2503b9){if(!_0x2503b9){_0x516edc[_0x00e5('0x1e')](0x194);}return _0x2503b9;};}function handleError(_0x39d3bd,_0x127642){_0x127642=_0x127642||0x1f4;return function(_0x4ebc0b){logger[_0x00e5('0x2b')](_0x4ebc0b[_0x00e5('0x2c')]);if(_0x4ebc0b['name']){delete _0x4ebc0b[_0x00e5('0x2d')];}_0x39d3bd[_0x00e5('0x1f')](_0x127642)[_0x00e5('0x2e')](_0x4ebc0b);};}exports[_0x00e5('0x2f')]=function(_0x4240ee,_0x5d725c){var _0x3fe367={},_0x1a640b={},_0x14fbfc={'count':0x0,'rows':[]};var _0x39468f=_[_0x00e5('0x30')](db[_0x00e5('0x31')]['rawAttributes'],function(_0x26c3d7){return{'name':_0x26c3d7[_0x00e5('0x32')],'type':_0x26c3d7[_0x00e5('0x33')][_0x00e5('0x34')]};});_0x1a640b['model']=_[_0x00e5('0x30')](_0x39468f,_0x00e5('0x2d'));_0x1a640b[_0x00e5('0x35')]=_[_0x00e5('0x36')](_0x4240ee[_0x00e5('0x35')]);_0x1a640b[_0x00e5('0x37')]=_[_0x00e5('0x38')](_0x1a640b[_0x00e5('0x39')],_0x1a640b[_0x00e5('0x35')]);_0x3fe367[_0x00e5('0x3a')]=_[_0x00e5('0x38')](_0x1a640b[_0x00e5('0x39')],qs[_0x00e5('0x3b')](_0x4240ee['query'][_0x00e5('0x3b')]));_0x3fe367[_0x00e5('0x3a')]=_0x3fe367[_0x00e5('0x3a')][_0x00e5('0x3c')]?_0x3fe367['attributes']:_0x1a640b['model'];if(!_0x4240ee[_0x00e5('0x35')][_0x00e5('0x3d')](_0x00e5('0x3e'))){_0x3fe367[_0x00e5('0x22')]=qs['limit'](_0x4240ee[_0x00e5('0x35')]['limit']);_0x3fe367[_0x00e5('0x21')]=qs['offset'](_0x4240ee[_0x00e5('0x35')][_0x00e5('0x21')]);}_0x3fe367[_0x00e5('0x3f')]=qs['sort'](_0x4240ee[_0x00e5('0x35')][_0x00e5('0x40')]);_0x3fe367[_0x00e5('0x41')]=qs[_0x00e5('0x37')](_['pick'](_0x4240ee[_0x00e5('0x35')],_0x1a640b['filters']),_0x39468f);if(_0x4240ee[_0x00e5('0x35')][_0x00e5('0x42')]){_0x3fe367['where']=_[_0x00e5('0x43')](_0x3fe367[_0x00e5('0x41')],{'$or':_['map'](_0x39468f,function(_0x5f1cd0){if(_0x5f1cd0[_0x00e5('0x33')]!=='VIRTUAL'){var _0x28f4fe={};_0x28f4fe[_0x5f1cd0[_0x00e5('0x2d')]]={'$like':'%'+_0x4240ee[_0x00e5('0x35')]['filter']+'%'};return _0x28f4fe;}})});}_0x3fe367=_[_0x00e5('0x43')]({},_0x3fe367,_0x4240ee[_0x00e5('0x44')]);var _0x1ca20a={'where':_0x3fe367[_0x00e5('0x41')]};return db['Migration'][_0x00e5('0x23')](_0x1ca20a)[_0x00e5('0x29')](function(_0x437d9b){_0x14fbfc[_0x00e5('0x23')]=_0x437d9b;if(_0x4240ee['query'][_0x00e5('0x45')]){_0x3fe367[_0x00e5('0x46')]=[{'all':!![]}];}return db[_0x00e5('0x31')][_0x00e5('0x47')](_0x3fe367);})[_0x00e5('0x29')](function(_0x4920e9){_0x14fbfc['rows']=_0x4920e9;return _0x14fbfc;})[_0x00e5('0x29')](respondWithFilteredResult(_0x5d725c,_0x3fe367))[_0x00e5('0x48')](handleError(_0x5d725c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7b8ae0c..8273d0f 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 _0x078e=['path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14e3cf,_0x4c2a07){var _0x2db962=function(_0x39bc2d){while(--_0x39bc2d){_0x14e3cf['push'](_0x14e3cf['shift']());}};_0x2db962(++_0x4c2a07);}(_0x078e,0x19a));var _0xe078=function(_0x87bce7,_0x39b032){_0x87bce7=_0x87bce7-0x0;var _0x118f8e=_0x078e[_0x87bce7];return _0x118f8e;};'use strict';var _=require(_0xe078('0x0'));var util=require('util');var logger=require(_0xe078('0x1'))(_0xe078('0x2'));var moment=require(_0xe078('0x3'));var BPromise=require(_0xe078('0x4'));var rp=require(_0xe078('0x5'));var fs=require('fs');var path=require(_0xe078('0x6'));var rimraf=require(_0xe078('0x7'));var config=require('../../config/environment');var attributes=require(_0xe078('0x8'));module[_0xe078('0x9')]=function(_0x1a253e,_0x33b0aa){return _0x1a253e[_0xe078('0xa')](_0xe078('0xb'),attributes,{'tableName':_0xe078('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ae1=['migrations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./migration.attributes','exports','define','Migration'];(function(_0xeab168,_0x30d561){var _0xbbf818=function(_0x40ed65){while(--_0x40ed65){_0xeab168['push'](_0xeab168['shift']());}};_0xbbf818(++_0x30d561);}(_0x0ae1,0x83));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x10ae('0x0'));var util=require(_0x10ae('0x1'));var logger=require(_0x10ae('0x2'))(_0x10ae('0x3'));var moment=require(_0x10ae('0x4'));var BPromise=require('bluebird');var rp=require(_0x10ae('0x5'));var fs=require('fs');var path=require(_0x10ae('0x6'));var rimraf=require(_0x10ae('0x7'));var config=require('../../config/environment');var attributes=require(_0x10ae('0x8'));module[_0x10ae('0x9')]=function(_0x449bd7,_0x2721ed){return _0x449bd7[_0x10ae('0xa')](_0x10ae('0xb'),attributes,{'tableName':_0x10ae('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 76690a0..4378c52 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 _0xa45b=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','info','request\x20sent','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug'];(function(_0x34ed48,_0x2cc995){var _0x37da5c=function(_0x5b6e16){while(--_0x5b6e16){_0x34ed48['push'](_0x34ed48['shift']());}};_0x37da5c(++_0x2cc995);}(_0xa45b,0x199));var _0xba45=function(_0x39aa24,_0x14048f){_0x39aa24=_0x39aa24-0x0;var _0x501e38=_0xa45b[_0x39aa24];return _0x501e38;};'use strict';var _=require('lodash');var util=require(_0xba45('0x0'));var moment=require(_0xba45('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba45('0x2'))['db'];var utils=require(_0xba45('0x3'));var logger=require(_0xba45('0x4'))(_0xba45('0x5'));var config=require('../../config/environment');var jayson=require(_0xba45('0x6'));var client=jayson[_0xba45('0x7')][_0xba45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x298bfc,_0x404229,_0x20905f){return new BPromise(function(_0x1a7a40,_0x374412){return client['request'](_0x298bfc,_0x20905f)[_0xba45('0x9')](function(_0x495a41){logger['info']('Migration,\x20%s,\x20%s',_0x404229,'request\x20sent');logger[_0xba45('0xa')](_0xba45('0xb'),_0x404229,'request\x20sent',JSON[_0xba45('0xc')](_0x495a41));if(_0x495a41[_0xba45('0xd')]){if(_0x495a41[_0xba45('0xd')][_0xba45('0xe')]===0x1f4){logger[_0xba45('0xd')]('Migration,\x20%s,\x20%s',_0x404229,_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);return _0x374412(_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);}logger['error'](_0xba45('0x10'),_0x404229,_0x495a41['error'][_0xba45('0xf')]);return _0x1a7a40(_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);}else{logger[_0xba45('0x11')](_0xba45('0x10'),_0x404229,_0xba45('0x12'));_0x1a7a40(_0x495a41[_0xba45('0x13')][_0xba45('0xf')]);}})[_0xba45('0x14')](function(_0xe9a683){logger['error'](_0xba45('0x10'),_0x404229,_0xe9a683);_0x374412(_0xe9a683);});});} \ No newline at end of file +var _0x50a8=['info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Migration,\x20%s,\x20%s','message','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5bb0eb,_0x474fe5){var _0x522631=function(_0x10e905){while(--_0x10e905){_0x5bb0eb['push'](_0x5bb0eb['shift']());}};_0x522631(++_0x474fe5);}(_0x50a8,0x198));var _0x850a=function(_0x89a5f2,_0x1c0cfb){_0x89a5f2=_0x89a5f2-0x0;var _0x526482=_0x50a8[_0x89a5f2];return _0x526482;};'use strict';var _=require(_0x850a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x850a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x850a('0x2'))['db'];var utils=require(_0x850a('0x3'));var logger=require(_0x850a('0x4'))(_0x850a('0x5'));var config=require(_0x850a('0x6'));var jayson=require(_0x850a('0x7'));var client=jayson[_0x850a('0x8')][_0x850a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fdb41,_0x543ef0,_0x488676){return new BPromise(function(_0x3c138a,_0xf4dcd1){return client[_0x850a('0xa')](_0x3fdb41,_0x488676)[_0x850a('0xb')](function(_0x5c197f){logger[_0x850a('0xc')]('Migration,\x20%s,\x20%s',_0x543ef0,'request\x20sent');logger[_0x850a('0xd')](_0x850a('0xe'),_0x543ef0,_0x850a('0xf'),JSON[_0x850a('0x10')](_0x5c197f));if(_0x5c197f[_0x850a('0x11')]){if(_0x5c197f['error']['code']===0x1f4){logger['error'](_0x850a('0x12'),_0x543ef0,_0x5c197f['error'][_0x850a('0x13')]);return _0xf4dcd1(_0x5c197f[_0x850a('0x11')][_0x850a('0x13')]);}logger[_0x850a('0x11')](_0x850a('0x12'),_0x543ef0,_0x5c197f['error'][_0x850a('0x13')]);return _0x3c138a(_0x5c197f['error']['message']);}else{logger['info']('Migration,\x20%s,\x20%s',_0x543ef0,_0x850a('0xf'));_0x3c138a(_0x5c197f['result'][_0x850a('0x13')]);}})[_0x850a('0x14')](function(_0x3c90e6){logger[_0x850a('0x11')](_0x850a('0x12'),_0x543ef0,_0x3c90e6);_0xf4dcd1(_0x3c90e6);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2fed6c4..1b869f2 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 _0xdccd=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','show','create'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0xdccd,0x102));var _0xddcc=function(_0x59a289,_0x24d42d){_0x59a289=_0x59a289-0x0;var _0x14e766=_0xdccd[_0x59a289];return _0x14e766;};'use strict';var multer=require(_0xddcc('0x0'));var util=require(_0xddcc('0x1'));var path=require(_0xddcc('0x2'));var timeout=require(_0xddcc('0x3'));var express=require(_0xddcc('0x4'));var router=express['Router']();var fs_extra=require(_0xddcc('0x5'));var auth=require(_0xddcc('0x6'));var interaction=require(_0xddcc('0x7'));var config=require(_0xddcc('0x8'));var controller=require(_0xddcc('0x9'));router['get']('/',auth[_0xddcc('0xa')](),controller[_0xddcc('0xb')]);router[_0xddcc('0xc')]('/:id',auth[_0xddcc('0xa')](),controller[_0xddcc('0xd')]);router['post']('/',auth[_0xddcc('0xa')](),controller[_0xddcc('0xe')]);router[_0xddcc('0xf')](_0xddcc('0x10'),auth[_0xddcc('0xa')](),controller[_0xddcc('0x11')]);router[_0xddcc('0x12')]('/:id',auth[_0xddcc('0xa')](),controller[_0xddcc('0x13')]);module[_0xddcc('0x14')]=router; \ No newline at end of file +var _0x5a4f=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x458e87,_0xa72c8a){var _0x306bdb=function(_0x2a7040){while(--_0x2a7040){_0x458e87['push'](_0x458e87['shift']());}};_0x306bdb(++_0xa72c8a);}(_0x5a4f,0x10d));var _0xf5a4=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x5a4f[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0xf5a4('0x0'));var util=require('util');var path=require(_0xf5a4('0x1'));var timeout=require('connect-timeout');var express=require(_0xf5a4('0x2'));var router=express['Router']();var fs_extra=require(_0xf5a4('0x3'));var auth=require(_0xf5a4('0x4'));var interaction=require(_0xf5a4('0x5'));var config=require(_0xf5a4('0x6'));var controller=require(_0xf5a4('0x7'));router[_0xf5a4('0x8')]('/',auth[_0xf5a4('0x9')](),controller['index']);router[_0xf5a4('0x8')](_0xf5a4('0xa'),auth[_0xf5a4('0x9')](),controller[_0xf5a4('0xb')]);router[_0xf5a4('0xc')]('/',auth[_0xf5a4('0x9')](),controller[_0xf5a4('0xd')]);router[_0xf5a4('0xe')](_0xf5a4('0xa'),auth[_0xf5a4('0x9')](),controller[_0xf5a4('0xf')]);router['delete'](_0xf5a4('0xa'),auth[_0xf5a4('0x9')](),controller[_0xf5a4('0x10')]);module[_0xf5a4('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 99f7fcf..a1d7744 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 _0x37a8=['stun','turn','exports','ENUM','externip'];(function(_0x1b0452,_0x3c69a5){var _0x140bb1=function(_0x3a0e1d){while(--_0x3a0e1d){_0x1b0452['push'](_0x1b0452['shift']());}};_0x140bb1(++_0x3c69a5);}(_0x37a8,0x174));var _0x837a=function(_0x3dda00,_0x392dca){_0x3dda00=_0x3dda00-0x0;var _0x2a6b26=_0x37a8[_0x3dda00];return _0x2a6b26;};'use strict';var Sequelize=require('sequelize');module[_0x837a('0x0')]={'type':{'type':Sequelize[_0x837a('0x1')]('localnet',_0x837a('0x2'),_0x837a('0x3'),_0x837a('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf3fd=['localnet','externip','stun','turn','STRING','exports','ENUM'];(function(_0x5c2c19,_0x23c07b){var _0x23d31d=function(_0x1449a5){while(--_0x1449a5){_0x5c2c19['push'](_0x5c2c19['shift']());}};_0x23d31d(++_0x23c07b);}(_0xf3fd,0x15c));var _0xdf3f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xf3fd[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0xdf3f('0x0')]={'type':{'type':Sequelize[_0xdf3f('0x1')](_0xdf3f('0x2'),_0xdf3f('0x3'),_0xdf3f('0x4'),_0xdf3f('0x5'))},'value':{'type':Sequelize[_0xdf3f('0x6')]},'username':{'type':Sequelize[_0xdf3f('0x6')]},'password':{'type':Sequelize[_0xdf3f('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index dc21a8d..7c02b46 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 _0x4206=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','rows','catch','show','includeAll','find','create','findAll','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','chan_sip.so','params','format','/etc/asterisk/sip_xcally_%s.conf','TURN','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','offset','undefined','count','status','set','Content-Range','json','update','destroy','sendStatus','stack','name','index','map','Network'];(function(_0x19fa24,_0x249b23){var _0x5decaf=function(_0x359ded){while(--_0x359ded){_0x19fa24['push'](_0x19fa24['shift']());}};_0x5decaf(++_0x249b23);}(_0x4206,0x132));var _0x6420=function(_0x49b775,_0x37f97f){_0x49b775=_0x49b775-0x0;var _0xe31ed5=_0x4206[_0x49b775];return _0xe31ed5;};'use strict';var util=require(_0x6420('0x0'));var path=require(_0x6420('0x1'));var ejs=require(_0x6420('0x2'));var fs=require('fs');var _=require(_0x6420('0x3'));var qs=require(_0x6420('0x4'));var logger=require(_0x6420('0x5'))(_0x6420('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x6420('0x7'));var client=jayson[_0x6420('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7d57ac,_0x1fc988,_0x51d217,_0xd36cf4){return new Promise(function(_0x1fac52,_0x2db75d){var _0x30b754=_0xd36cf4||client;return _0x30b754[_0x6420('0x9')](_0x7d57ac,_0x51d217)[_0x6420('0xa')](function(_0x40ca2b){logger['info']('Network,\x20%s,\x20%s',_0x1fc988,_0x6420('0xb'));logger[_0x6420('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x1fc988,_0x6420('0xb'),JSON[_0x6420('0xd')](_0x40ca2b));if(_0x40ca2b[_0x6420('0xe')]){if(_0x40ca2b[_0x6420('0xe')][_0x6420('0xf')]===0x1f4){logger[_0x6420('0xe')](_0x6420('0x10'),_0x1fc988,_0x40ca2b[_0x6420('0xe')][_0x6420('0x11')]);return _0x2db75d(_0x40ca2b[_0x6420('0xe')][_0x6420('0x11')]);}logger[_0x6420('0xe')](_0x6420('0x10'),_0x1fc988,_0x40ca2b[_0x6420('0xe')]['message']);return _0x1fac52(_0x40ca2b['error']['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x1fc988,_0x6420('0xb'));_0x1fac52(_0x40ca2b[_0x6420('0x12')][_0x6420('0x11')]);}})['catch'](function(_0x3acad9){logger[_0x6420('0xe')]('Network,\x20%s,\x20%s',_0x1fc988,_0x3acad9);_0x2db75d(_0x3acad9);});});}function respondWithResult(_0x3abd07,_0x179ac0){_0x179ac0=_0x179ac0||0xc8;return function(_0x2eebac){if(_0x2eebac){return _0x3abd07['status'](_0x179ac0)['json'](_0x2eebac);}};}function respondWithFilteredResult(_0x1cf5dd,_0x26c421){return function(_0xa0ded4){if(_0xa0ded4){var _0x6edbca=typeof _0x26c421[_0x6420('0x13')]===_0x6420('0x14')&&typeof _0x26c421['limit']===_0x6420('0x14');var _0x10f8f6=_0xa0ded4['count'];var _0x5e3681=_0x6edbca?0x0:_0x26c421[_0x6420('0x13')];var _0x332aab=_0x6edbca?_0xa0ded4[_0x6420('0x15')]:_0x26c421[_0x6420('0x13')]+_0x26c421['limit'];var _0x5d0bcb;if(_0x332aab>=_0x10f8f6){_0x332aab=_0x10f8f6;_0x5d0bcb=0xc8;}else{_0x5d0bcb=0xce;}_0x1cf5dd[_0x6420('0x16')](_0x5d0bcb);return _0x1cf5dd[_0x6420('0x17')](_0x6420('0x18'),_0x5e3681+'-'+_0x332aab+'/'+_0x10f8f6)[_0x6420('0x19')](_0xa0ded4);}return null;};}function saveUpdates(_0xeec86){return function(_0x13e460){if(_0x13e460){return _0x13e460[_0x6420('0x1a')](_0xeec86)[_0x6420('0xa')](function(_0xe17a2){return _0xe17a2;});}return null;};}function removeEntity(_0x233362){return function(_0xc60685){if(_0xc60685){return _0xc60685[_0x6420('0x1b')]()[_0x6420('0xa')](function(){_0x233362[_0x6420('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x841a3f){return function(_0x1a0445){if(!_0x1a0445){_0x841a3f[_0x6420('0x1c')](0x194);}return _0x1a0445;};}function handleError(_0x3d83ff,_0x573971){_0x573971=_0x573971||0x1f4;return function(_0x1c3fb0){logger[_0x6420('0xe')](_0x1c3fb0[_0x6420('0x1d')]);if(_0x1c3fb0[_0x6420('0x1e')]){delete _0x1c3fb0[_0x6420('0x1e')];}_0x3d83ff['status'](_0x573971)['send'](_0x1c3fb0);};}exports[_0x6420('0x1f')]=function(_0x5260b8,_0x17c4db){var _0xa38094={},_0x4dbb9d={},_0x3abf29={'count':0x0,'rows':[]};var _0x39c428=_[_0x6420('0x20')](db[_0x6420('0x21')][_0x6420('0x22')],function(_0x2617be){return{'name':_0x2617be[_0x6420('0x23')],'type':_0x2617be[_0x6420('0x24')][_0x6420('0x25')]};});_0x4dbb9d[_0x6420('0x26')]=_['map'](_0x39c428,_0x6420('0x1e'));_0x4dbb9d[_0x6420('0x27')]=_[_0x6420('0x28')](_0x5260b8[_0x6420('0x27')]);_0x4dbb9d['filters']=_[_0x6420('0x29')](_0x4dbb9d[_0x6420('0x26')],_0x4dbb9d[_0x6420('0x27')]);_0xa38094[_0x6420('0x2a')]=_[_0x6420('0x29')](_0x4dbb9d[_0x6420('0x26')],qs[_0x6420('0x2b')](_0x5260b8[_0x6420('0x27')][_0x6420('0x2b')]));_0xa38094[_0x6420('0x2a')]=_0xa38094['attributes'][_0x6420('0x2c')]?_0xa38094[_0x6420('0x2a')]:_0x4dbb9d[_0x6420('0x26')];if(!_0x5260b8[_0x6420('0x27')][_0x6420('0x2d')]('nolimit')){_0xa38094[_0x6420('0x2e')]=qs[_0x6420('0x2e')](_0x5260b8[_0x6420('0x27')]['limit']);_0xa38094[_0x6420('0x13')]=qs[_0x6420('0x13')](_0x5260b8[_0x6420('0x27')][_0x6420('0x13')]);}_0xa38094[_0x6420('0x2f')]=qs[_0x6420('0x30')](_0x5260b8[_0x6420('0x27')][_0x6420('0x30')]);_0xa38094[_0x6420('0x31')]=qs[_0x6420('0x32')](_['pick'](_0x5260b8[_0x6420('0x27')],_0x4dbb9d['filters']),_0x39c428);if(_0x5260b8[_0x6420('0x27')][_0x6420('0x33')]){_0xa38094['where']=_['merge'](_0xa38094[_0x6420('0x31')],{'$or':_[_0x6420('0x20')](_0x39c428,function(_0x4e16e3){if(_0x4e16e3[_0x6420('0x24')]!==_0x6420('0x34')){var _0x17f23f={};_0x17f23f[_0x4e16e3['name']]={'$like':'%'+_0x5260b8[_0x6420('0x27')][_0x6420('0x33')]+'%'};return _0x17f23f;}})});}_0xa38094=_[_0x6420('0x35')]({},_0xa38094,_0x5260b8[_0x6420('0x36')]);var _0x14c15b={'where':_0xa38094[_0x6420('0x31')]};return db[_0x6420('0x21')][_0x6420('0x15')](_0x14c15b)[_0x6420('0xa')](function(_0x43c6bb){_0x3abf29[_0x6420('0x15')]=_0x43c6bb;if(_0x5260b8['query']['includeAll']){_0xa38094[_0x6420('0x37')]=[{'all':!![]}];}return db[_0x6420('0x21')]['findAll'](_0xa38094);})[_0x6420('0xa')](function(_0x2c88f5){_0x3abf29[_0x6420('0x38')]=_0x2c88f5;return _0x3abf29;})[_0x6420('0xa')](respondWithFilteredResult(_0x17c4db,_0xa38094))[_0x6420('0x39')](handleError(_0x17c4db,null));};exports[_0x6420('0x3a')]=function(_0x4cf3ee,_0x1cac82){var _0x2a3d41={'raw':!![],'where':{'id':_0x4cf3ee['params']['id']}},_0x4bf18a={};_0x4bf18a['model']=_['keys'](db[_0x6420('0x21')][_0x6420('0x22')]);_0x4bf18a[_0x6420('0x27')]=_[_0x6420('0x28')](_0x4cf3ee[_0x6420('0x27')]);_0x4bf18a['filters']=_[_0x6420('0x29')](_0x4bf18a[_0x6420('0x26')],_0x4bf18a[_0x6420('0x27')]);_0x2a3d41[_0x6420('0x2a')]=_[_0x6420('0x29')](_0x4bf18a[_0x6420('0x26')],qs[_0x6420('0x2b')](_0x4cf3ee[_0x6420('0x27')][_0x6420('0x2b')]));_0x2a3d41[_0x6420('0x2a')]=_0x2a3d41[_0x6420('0x2a')][_0x6420('0x2c')]?_0x2a3d41[_0x6420('0x2a')]:_0x4bf18a[_0x6420('0x26')];if(_0x4cf3ee[_0x6420('0x27')][_0x6420('0x3b')]){_0x2a3d41[_0x6420('0x37')]=[{'all':!![]}];}_0x2a3d41=_['merge']({},_0x2a3d41,_0x4cf3ee[_0x6420('0x36')]);return db[_0x6420('0x21')][_0x6420('0x3c')](_0x2a3d41)[_0x6420('0xa')](handleEntityNotFound(_0x1cac82,null))[_0x6420('0xa')](respondWithResult(_0x1cac82,null))[_0x6420('0x39')](handleError(_0x1cac82,null));};exports[_0x6420('0x3d')]=function(_0x911c94,_0x42d312){var _0x13fbc6;return db['Network'][_0x6420('0x3d')](_0x911c94['body'],{'raw':!![]})[_0x6420('0xa')](function(_0xf488d5){_0x13fbc6=_0xf488d5;return db[_0x6420('0x21')][_0x6420('0x3e')]({'where':{'type':_0x911c94[_0x6420('0x3f')]['type']},'raw':!![]});})['then'](function(_0x17ed76){if(_0x13fbc6['type'][_0x6420('0x40')]()==_0x6420('0x41')){var _0x385168=fs['readFileSync'](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x44')),_0x6420('0x45'));var _0x514cb6=ejs['render'](_0x385168,{'networks':_0x17ed76||[]});fs[_0x6420('0x46')](_0x6420('0x47'),_0x514cb6);return respondWithRpcPromise(_0x6420('0x48'),'create',{'module':'res_stun_monitor.so'});}else if(_0x13fbc6['type'][_0x6420('0x40')]()=='TURN'){var _0x58156a=fs[_0x6420('0x49')](path['join'](config[_0x6420('0x43')],_0x6420('0x4a')),_0x6420('0x45'));var _0x11e6a7=ejs[_0x6420('0x4b')](_0x58156a,{'networks':_0x17ed76||[]});fs['writeFileSync'](_0x6420('0x4c'),_0x11e6a7);return respondWithRpcPromise(_0x6420('0x48'),_0x6420('0x3d'),{'module':_0x6420('0x4d')});}else{var _0x5e1fa1=fs[_0x6420('0x49')](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x4e')),_0x6420('0x45'));var _0x405021=ejs[_0x6420('0x4b')](_0x5e1fa1,{'networks':_0x17ed76||[]});fs[_0x6420('0x46')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x911c94[_0x6420('0x3f')][_0x6420('0x24')]['toLowerCase']()),_0x405021);return respondWithRpcPromise(_0x6420('0x48'),'create',{'module':_0x6420('0x4f')});}})[_0x6420('0xa')](function(){return _0x13fbc6;})[_0x6420('0xa')](respondWithResult(_0x42d312,0xc9))[_0x6420('0x39')](handleError(_0x42d312,null));};exports[_0x6420('0x1a')]=function(_0x56d73f,_0x410620){var _0x526a9a;return db[_0x6420('0x21')][_0x6420('0x3c')]({'where':{'id':_0x56d73f[_0x6420('0x50')]['id']}})[_0x6420('0xa')](handleEntityNotFound(_0x410620,null))[_0x6420('0xa')](saveUpdates(_0x56d73f[_0x6420('0x3f')],null))[_0x6420('0xa')](function(_0xda5e68){if(_0xda5e68){_0x526a9a=_0xda5e68;return db[_0x6420('0x21')][_0x6420('0x3e')]({'where':{'type':_0x526a9a[_0x6420('0x24')]},'raw':!![]});}return null;})[_0x6420('0xa')](function(_0x3d71c4){if(_0x526a9a[_0x6420('0x24')]['toUpperCase']()==_0x6420('0x41')){var _0x3074f4=fs[_0x6420('0x49')](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x44')),_0x6420('0x45'));var _0x3fb2e6=ejs[_0x6420('0x4b')](_0x3074f4,{'networks':_0x3d71c4||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x3fb2e6);return respondWithRpcPromise(_0x6420('0x48'),_0x6420('0x1a'),{'module':_0x6420('0x4d')});}else if(_0x526a9a[_0x6420('0x24')][_0x6420('0x40')]()=='TURN'){var _0x512e05=fs[_0x6420('0x49')](path[_0x6420('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x6420('0x45'));var _0x5b631c=ejs[_0x6420('0x4b')](_0x512e05,{'networks':_0x3d71c4||[]});fs[_0x6420('0x46')]('/etc/asterisk/turn_xcally.conf',_0x5b631c);return respondWithRpcPromise(_0x6420('0x48'),_0x6420('0x1a'),{'module':_0x6420('0x4d')});}else{var _0x1dfb65=fs[_0x6420('0x49')](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x4e')),_0x6420('0x45'));var _0x5977c7=ejs[_0x6420('0x4b')](_0x1dfb65,{'networks':_0x3d71c4||[]});fs[_0x6420('0x46')](util[_0x6420('0x51')](_0x6420('0x52'),_0x56d73f['body'][_0x6420('0x24')]['toLowerCase']()),_0x5977c7);return respondWithRpcPromise('Reload',_0x6420('0x1a'),{'module':'chan_sip.so'});}})['then'](function(_0xb7b9c6){if(_0xb7b9c6){return _0x526a9a;}return null;})[_0x6420('0xa')](respondWithResult(_0x410620,null))[_0x6420('0x39')](handleError(_0x410620,null));};exports['destroy']=function(_0x11b22b,_0x5ad885){var _0x685225;return db['Network'][_0x6420('0x3c')]({'where':{'id':_0x11b22b[_0x6420('0x50')]['id']}})['then'](function(_0x346d4a){_0x685225=_0x346d4a;return _0x346d4a;})[_0x6420('0xa')](handleEntityNotFound(_0x5ad885,null))['then'](removeEntity(_0x5ad885,null))[_0x6420('0xa')](function(){if(_0x685225){return db[_0x6420('0x21')]['findAll']({'where':{'type':_0x685225[_0x6420('0x24')]},'raw':!![]});}})[_0x6420('0xa')](function(_0x41efa4){if(_0x685225[_0x6420('0x24')][_0x6420('0x40')]()==_0x6420('0x41')){var _0x276e53=fs['readFileSync'](path['join'](config[_0x6420('0x43')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x4b108b=ejs['render'](_0x276e53,{'networks':_0x41efa4||[]});fs['writeFileSync'](_0x6420('0x47'),_0x4b108b);return respondWithRpcPromise(_0x6420('0x48'),'destroy',{'module':_0x6420('0x4d')});}else if(_0x685225[_0x6420('0x24')][_0x6420('0x40')]()==_0x6420('0x53')){var _0x16bafc=fs[_0x6420('0x49')](path[_0x6420('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x530832=ejs[_0x6420('0x4b')](_0x16bafc,{'networks':_0x41efa4||[]});fs[_0x6420('0x46')](_0x6420('0x4c'),_0x530832);return respondWithRpcPromise('Reload',_0x6420('0x1b'),{'module':_0x6420('0x4d')});}else{var _0x70f892=fs[_0x6420('0x49')](path[_0x6420('0x42')](config[_0x6420('0x43')],_0x6420('0x4e')),_0x6420('0x45'));var _0x5a942f=ejs[_0x6420('0x4b')](_0x70f892,{'networks':_0x41efa4||[]});fs['writeFileSync'](util[_0x6420('0x51')](_0x6420('0x52'),_0x685225[_0x6420('0x24')][_0x6420('0x54')]()),_0x5a942f);return respondWithRpcPromise(_0x6420('0x48'),_0x6420('0x1b'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x5ad885,null));}; \ No newline at end of file +var _0xa792=['set','Content-Range','json','update','then','destroy','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','toUpperCase','STUN','readFileSync','root','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','TURN','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','toLowerCase','chan_sip.so','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','request','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','offset','undefined','count'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa792,0x18b));var _0x2a79=function(_0x4d79ca,_0x413286){_0x4d79ca=_0x4d79ca-0x0;var _0x57af1f=_0xa792[_0x4d79ca];return _0x57af1f;};'use strict';var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x2a79('0x0'))(_0x2a79('0x1'));var config=require(_0x2a79('0x2'));var db=require(_0x2a79('0x3'))['db'];var jayson=require(_0x2a79('0x4'));var client=jayson[_0x2a79('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9e43ca,_0x584674,_0x3fbc0a,_0x5b84bb){return new Promise(function(_0x55d124,_0x497694){var _0x31d78a=_0x5b84bb||client;return _0x31d78a[_0x2a79('0x6')](_0x9e43ca,_0x3fbc0a)['then'](function(_0x6b769c){logger['info'](_0x2a79('0x7'),_0x584674,_0x2a79('0x8'));logger['debug'](_0x2a79('0x9'),_0x584674,_0x2a79('0x8'),JSON[_0x2a79('0xa')](_0x6b769c));if(_0x6b769c['error']){if(_0x6b769c[_0x2a79('0xb')][_0x2a79('0xc')]===0x1f4){logger['error'](_0x2a79('0x7'),_0x584674,_0x6b769c[_0x2a79('0xb')]['message']);return _0x497694(_0x6b769c[_0x2a79('0xb')][_0x2a79('0xd')]);}logger[_0x2a79('0xb')](_0x2a79('0x7'),_0x584674,_0x6b769c[_0x2a79('0xb')][_0x2a79('0xd')]);return _0x55d124(_0x6b769c[_0x2a79('0xb')][_0x2a79('0xd')]);}else{logger[_0x2a79('0xe')](_0x2a79('0x7'),_0x584674,_0x2a79('0x8'));_0x55d124(_0x6b769c['result'][_0x2a79('0xd')]);}})[_0x2a79('0xf')](function(_0x5985cc){logger[_0x2a79('0xb')](_0x2a79('0x7'),_0x584674,_0x5985cc);_0x497694(_0x5985cc);});});}function respondWithResult(_0x34400d,_0x489e85){_0x489e85=_0x489e85||0xc8;return function(_0x2e46ee){if(_0x2e46ee){return _0x34400d[_0x2a79('0x10')](_0x489e85)['json'](_0x2e46ee);}};}function respondWithFilteredResult(_0x478b3f,_0x1a9200){return function(_0x5e84bf){if(_0x5e84bf){var _0x423ba4=typeof _0x1a9200[_0x2a79('0x11')]===_0x2a79('0x12')&&typeof _0x1a9200['limit']===_0x2a79('0x12');var _0x4f8795=_0x5e84bf[_0x2a79('0x13')];var _0x5ca7a4=_0x423ba4?0x0:_0x1a9200[_0x2a79('0x11')];var _0x4fddeb=_0x423ba4?_0x5e84bf[_0x2a79('0x13')]:_0x1a9200['offset']+_0x1a9200['limit'];var _0x248d37;if(_0x4fddeb>=_0x4f8795){_0x4fddeb=_0x4f8795;_0x248d37=0xc8;}else{_0x248d37=0xce;}_0x478b3f[_0x2a79('0x10')](_0x248d37);return _0x478b3f[_0x2a79('0x14')](_0x2a79('0x15'),_0x5ca7a4+'-'+_0x4fddeb+'/'+_0x4f8795)[_0x2a79('0x16')](_0x5e84bf);}return null;};}function saveUpdates(_0x13c8be){return function(_0x39e084){if(_0x39e084){return _0x39e084[_0x2a79('0x17')](_0x13c8be)[_0x2a79('0x18')](function(_0x434220){return _0x434220;});}return null;};}function removeEntity(_0x1509f8){return function(_0x1f132b){if(_0x1f132b){return _0x1f132b[_0x2a79('0x19')]()[_0x2a79('0x18')](function(){_0x1509f8[_0x2a79('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9ae912){return function(_0x3462e0){if(!_0x3462e0){_0x9ae912[_0x2a79('0x1a')](0x194);}return _0x3462e0;};}function handleError(_0x43f230,_0x374d59){_0x374d59=_0x374d59||0x1f4;return function(_0x58592f){logger[_0x2a79('0xb')](_0x58592f[_0x2a79('0x1b')]);if(_0x58592f[_0x2a79('0x1c')]){delete _0x58592f['name'];}_0x43f230[_0x2a79('0x10')](_0x374d59)[_0x2a79('0x1d')](_0x58592f);};}exports[_0x2a79('0x1e')]=function(_0xb2be76,_0x579192){var _0x59a8f3={},_0x49c7e1={},_0x40e78c={'count':0x0,'rows':[]};var _0x565bd4=_[_0x2a79('0x1f')](db[_0x2a79('0x20')][_0x2a79('0x21')],function(_0x449a19){return{'name':_0x449a19[_0x2a79('0x22')],'type':_0x449a19['type'][_0x2a79('0x23')]};});_0x49c7e1[_0x2a79('0x24')]=_[_0x2a79('0x1f')](_0x565bd4,_0x2a79('0x1c'));_0x49c7e1[_0x2a79('0x25')]=_[_0x2a79('0x26')](_0xb2be76[_0x2a79('0x25')]);_0x49c7e1[_0x2a79('0x27')]=_['intersection'](_0x49c7e1[_0x2a79('0x24')],_0x49c7e1[_0x2a79('0x25')]);_0x59a8f3[_0x2a79('0x28')]=_[_0x2a79('0x29')](_0x49c7e1['model'],qs['fields'](_0xb2be76[_0x2a79('0x25')][_0x2a79('0x2a')]));_0x59a8f3[_0x2a79('0x28')]=_0x59a8f3[_0x2a79('0x28')][_0x2a79('0x2b')]?_0x59a8f3['attributes']:_0x49c7e1[_0x2a79('0x24')];if(!_0xb2be76[_0x2a79('0x25')][_0x2a79('0x2c')](_0x2a79('0x2d'))){_0x59a8f3[_0x2a79('0x2e')]=qs[_0x2a79('0x2e')](_0xb2be76[_0x2a79('0x25')][_0x2a79('0x2e')]);_0x59a8f3[_0x2a79('0x11')]=qs[_0x2a79('0x11')](_0xb2be76[_0x2a79('0x25')][_0x2a79('0x11')]);}_0x59a8f3['order']=qs[_0x2a79('0x2f')](_0xb2be76['query']['sort']);_0x59a8f3[_0x2a79('0x30')]=qs[_0x2a79('0x27')](_[_0x2a79('0x31')](_0xb2be76[_0x2a79('0x25')],_0x49c7e1[_0x2a79('0x27')]),_0x565bd4);if(_0xb2be76[_0x2a79('0x25')][_0x2a79('0x32')]){_0x59a8f3['where']=_[_0x2a79('0x33')](_0x59a8f3[_0x2a79('0x30')],{'$or':_[_0x2a79('0x1f')](_0x565bd4,function(_0x561708){if(_0x561708[_0x2a79('0x34')]!==_0x2a79('0x35')){var _0x2ab886={};_0x2ab886[_0x561708[_0x2a79('0x1c')]]={'$like':'%'+_0xb2be76[_0x2a79('0x25')][_0x2a79('0x32')]+'%'};return _0x2ab886;}})});}_0x59a8f3=_['merge']({},_0x59a8f3,_0xb2be76[_0x2a79('0x36')]);var _0x3ce50f={'where':_0x59a8f3['where']};return db['Network']['count'](_0x3ce50f)['then'](function(_0x300da7){_0x40e78c['count']=_0x300da7;if(_0xb2be76[_0x2a79('0x25')][_0x2a79('0x37')]){_0x59a8f3[_0x2a79('0x38')]=[{'all':!![]}];}return db['Network'][_0x2a79('0x39')](_0x59a8f3);})[_0x2a79('0x18')](function(_0x126f3c){_0x40e78c[_0x2a79('0x3a')]=_0x126f3c;return _0x40e78c;})[_0x2a79('0x18')](respondWithFilteredResult(_0x579192,_0x59a8f3))[_0x2a79('0xf')](handleError(_0x579192,null));};exports['show']=function(_0xadabec,_0x47a76a){var _0x5bd4c7={'raw':!![],'where':{'id':_0xadabec[_0x2a79('0x3b')]['id']}},_0x51d7ce={};_0x51d7ce[_0x2a79('0x24')]=_[_0x2a79('0x26')](db[_0x2a79('0x20')][_0x2a79('0x21')]);_0x51d7ce[_0x2a79('0x25')]=_['keys'](_0xadabec[_0x2a79('0x25')]);_0x51d7ce[_0x2a79('0x27')]=_[_0x2a79('0x29')](_0x51d7ce[_0x2a79('0x24')],_0x51d7ce['query']);_0x5bd4c7[_0x2a79('0x28')]=_[_0x2a79('0x29')](_0x51d7ce[_0x2a79('0x24')],qs['fields'](_0xadabec[_0x2a79('0x25')][_0x2a79('0x2a')]));_0x5bd4c7[_0x2a79('0x28')]=_0x5bd4c7[_0x2a79('0x28')][_0x2a79('0x2b')]?_0x5bd4c7[_0x2a79('0x28')]:_0x51d7ce[_0x2a79('0x24')];if(_0xadabec[_0x2a79('0x25')]['includeAll']){_0x5bd4c7[_0x2a79('0x38')]=[{'all':!![]}];}_0x5bd4c7=_[_0x2a79('0x33')]({},_0x5bd4c7,_0xadabec[_0x2a79('0x36')]);return db['Network'][_0x2a79('0x3c')](_0x5bd4c7)[_0x2a79('0x18')](handleEntityNotFound(_0x47a76a,null))[_0x2a79('0x18')](respondWithResult(_0x47a76a,null))['catch'](handleError(_0x47a76a,null));};exports[_0x2a79('0x3d')]=function(_0x343f47,_0x3e794b){var _0x566277;return db[_0x2a79('0x20')]['create'](_0x343f47[_0x2a79('0x3e')],{'raw':!![]})[_0x2a79('0x18')](function(_0x575a6e){_0x566277=_0x575a6e;return db[_0x2a79('0x20')][_0x2a79('0x39')]({'where':{'type':_0x343f47[_0x2a79('0x3e')][_0x2a79('0x34')]},'raw':!![]});})[_0x2a79('0x18')](function(_0x400043){if(_0x566277[_0x2a79('0x34')][_0x2a79('0x3f')]()==_0x2a79('0x40')){var _0x52ef51=fs[_0x2a79('0x41')](path['join'](config[_0x2a79('0x42')],'server/files/templates/stun_multiple.ejs'),_0x2a79('0x43'));var _0x2543d8=ejs[_0x2a79('0x44')](_0x52ef51,{'networks':_0x400043||[]});fs['writeFileSync'](_0x2a79('0x45'),_0x2543d8);return respondWithRpcPromise(_0x2a79('0x46'),_0x2a79('0x3d'),{'module':'res_stun_monitor.so'});}else if(_0x566277['type']['toUpperCase']()==_0x2a79('0x47')){var _0x562fa3=fs['readFileSync'](path['join'](config[_0x2a79('0x42')],'server/files/templates/turn_multiple.ejs'),_0x2a79('0x43'));var _0x3cef14=ejs[_0x2a79('0x44')](_0x562fa3,{'networks':_0x400043||[]});fs[_0x2a79('0x48')](_0x2a79('0x49'),_0x3cef14);return respondWithRpcPromise('Reload',_0x2a79('0x3d'),{'module':_0x2a79('0x4a')});}else{var _0xc4baff=fs['readFileSync'](path[_0x2a79('0x4b')](config[_0x2a79('0x42')],_0x2a79('0x4c')),_0x2a79('0x43'));var _0xad9762=ejs[_0x2a79('0x44')](_0xc4baff,{'networks':_0x400043||[]});fs[_0x2a79('0x48')](util[_0x2a79('0x4d')](_0x2a79('0x4e'),_0x343f47[_0x2a79('0x3e')][_0x2a79('0x34')]['toLowerCase']()),_0xad9762);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}})[_0x2a79('0x18')](function(){return _0x566277;})[_0x2a79('0x18')](respondWithResult(_0x3e794b,0xc9))['catch'](handleError(_0x3e794b,null));};exports[_0x2a79('0x17')]=function(_0x2ae395,_0x1b056d){var _0x5313e3;return db['Network'][_0x2a79('0x3c')]({'where':{'id':_0x2ae395['params']['id']}})[_0x2a79('0x18')](handleEntityNotFound(_0x1b056d,null))[_0x2a79('0x18')](saveUpdates(_0x2ae395[_0x2a79('0x3e')],null))['then'](function(_0xbeeefd){if(_0xbeeefd){_0x5313e3=_0xbeeefd;return db[_0x2a79('0x20')][_0x2a79('0x39')]({'where':{'type':_0x5313e3['type']},'raw':!![]});}return null;})[_0x2a79('0x18')](function(_0x3af1b1){if(_0x5313e3[_0x2a79('0x34')][_0x2a79('0x3f')]()=='STUN'){var _0x3a2d5c=fs[_0x2a79('0x41')](path[_0x2a79('0x4b')](config['root'],_0x2a79('0x4f')),'utf8');var _0x135cf5=ejs[_0x2a79('0x44')](_0x3a2d5c,{'networks':_0x3af1b1||[]});fs[_0x2a79('0x48')]('/etc/asterisk/stun_xcally.conf',_0x135cf5);return respondWithRpcPromise(_0x2a79('0x46'),_0x2a79('0x17'),{'module':_0x2a79('0x4a')});}else if(_0x5313e3[_0x2a79('0x34')][_0x2a79('0x3f')]()==_0x2a79('0x47')){var _0x26425c=fs[_0x2a79('0x41')](path[_0x2a79('0x4b')](config[_0x2a79('0x42')],_0x2a79('0x50')),_0x2a79('0x43'));var _0x2540fa=ejs[_0x2a79('0x44')](_0x26425c,{'networks':_0x3af1b1||[]});fs[_0x2a79('0x48')](_0x2a79('0x49'),_0x2540fa);return respondWithRpcPromise(_0x2a79('0x46'),_0x2a79('0x17'),{'module':_0x2a79('0x4a')});}else{var _0x5a971e=fs[_0x2a79('0x41')](path[_0x2a79('0x4b')](config[_0x2a79('0x42')],_0x2a79('0x4c')),'utf8');var _0x18b11b=ejs[_0x2a79('0x44')](_0x5a971e,{'networks':_0x3af1b1||[]});fs[_0x2a79('0x48')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x2ae395[_0x2a79('0x3e')][_0x2a79('0x34')][_0x2a79('0x51')]()),_0x18b11b);return respondWithRpcPromise(_0x2a79('0x46'),_0x2a79('0x17'),{'module':_0x2a79('0x52')});}})[_0x2a79('0x18')](function(_0x4c1a29){if(_0x4c1a29){return _0x5313e3;}return null;})[_0x2a79('0x18')](respondWithResult(_0x1b056d,null))['catch'](handleError(_0x1b056d,null));};exports[_0x2a79('0x19')]=function(_0x22c5d3,_0x3785c4){var _0x29f99a;return db[_0x2a79('0x20')][_0x2a79('0x3c')]({'where':{'id':_0x22c5d3[_0x2a79('0x3b')]['id']}})[_0x2a79('0x18')](function(_0x422005){_0x29f99a=_0x422005;return _0x422005;})['then'](handleEntityNotFound(_0x3785c4,null))[_0x2a79('0x18')](removeEntity(_0x3785c4,null))['then'](function(){if(_0x29f99a){return db[_0x2a79('0x20')]['findAll']({'where':{'type':_0x29f99a[_0x2a79('0x34')]},'raw':!![]});}})[_0x2a79('0x18')](function(_0x1669a4){if(_0x29f99a[_0x2a79('0x34')]['toUpperCase']()=='STUN'){var _0x1f9e19=fs[_0x2a79('0x41')](path[_0x2a79('0x4b')](config[_0x2a79('0x42')],_0x2a79('0x4f')),_0x2a79('0x43'));var _0x7a88=ejs[_0x2a79('0x44')](_0x1f9e19,{'networks':_0x1669a4||[]});fs[_0x2a79('0x48')](_0x2a79('0x45'),_0x7a88);return respondWithRpcPromise(_0x2a79('0x46'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x29f99a[_0x2a79('0x34')]['toUpperCase']()==_0x2a79('0x47')){var _0x238d69=fs[_0x2a79('0x41')](path[_0x2a79('0x4b')](config[_0x2a79('0x42')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x48ad06=ejs[_0x2a79('0x44')](_0x238d69,{'networks':_0x1669a4||[]});fs[_0x2a79('0x48')]('/etc/asterisk/turn_xcally.conf',_0x48ad06);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x1a722a=fs[_0x2a79('0x41')](path['join'](config[_0x2a79('0x42')],_0x2a79('0x4c')),'utf8');var _0x5496e3=ejs[_0x2a79('0x44')](_0x1a722a,{'networks':_0x1669a4||[]});fs[_0x2a79('0x48')](util[_0x2a79('0x4d')](_0x2a79('0x4e'),_0x29f99a[_0x2a79('0x34')][_0x2a79('0x51')]()),_0x5496e3);return respondWithRpcPromise('Reload',_0x2a79('0x19'),{'module':_0x2a79('0x52')});}})[_0x2a79('0xf')](handleError(_0x3785c4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b26fc94..0821d29 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 _0x0e9f=['moment','path','./network.attributes','exports','Network','network','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0e9f,0x116));var _0xf0e9=function(_0x4563b2,_0x30a2bb){_0x4563b2=_0x4563b2-0x0;var _0x972995=_0x0e9f[_0x4563b2];return _0x972995;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0e9('0x4'));module[_0xf0e9('0x5')]=function(_0x59ac7e,_0x2322dc){return _0x59ac7e['define'](_0xf0e9('0x6'),attributes,{'tableName':_0xf0e9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x33eaa6,_0x34cad8){var _0x4a0c61=function(_0x4ca148){while(--_0x4ca148){_0x33eaa6['push'](_0x33eaa6['shift']());}};_0x4a0c61(++_0x34cad8);}(_0xee5b,0x1f4));var _0xbee5=function(_0x38b47d,_0x3077a4){_0x38b47d=_0x38b47d-0x0;var _0x4a24aa=_0xee5b[_0x38b47d];return _0x4a24aa;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('Network',attributes,{'tableName':'network','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 8e2f08d..38b0d8f 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(_0x418b2e,_0x2604a4){var _0x48d9d6=function(_0x37fa66){while(--_0x37fa66){_0x418b2e['push'](_0x418b2e['shift']());}};_0x48d9d6(++_0x2604a4);}(_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 db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a23ca,_0x47836b){var _0x39f446=function(_0x5a87a2){while(--_0x5a87a2){_0x4a23ca['push'](_0x4a23ca['shift']());}};_0x39f446(++_0x47836b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index f05c65a..c38edb4 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 _0x0aef=['../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x173269,_0x1c28da){var _0x3b411d=function(_0x43a298){while(--_0x43a298){_0x173269['push'](_0x173269['shift']());}};_0x3b411d(++_0x1c28da);}(_0x0aef,0x16c));var _0xf0ae=function(_0x304f83,_0x918b71){_0x304f83=_0x304f83-0x0;var _0x39d25b=_0x0aef[_0x304f83];return _0x39d25b;};'use strict';var multer=require('multer');var util=require(_0xf0ae('0x0'));var path=require(_0xf0ae('0x1'));var timeout=require(_0xf0ae('0x2'));var express=require(_0xf0ae('0x3'));var router=express[_0xf0ae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf0ae('0x5'));var interaction=require(_0xf0ae('0x6'));var config=require('../../config/environment');var controller=require(_0xf0ae('0x7'));router[_0xf0ae('0x8')]('/',auth[_0xf0ae('0x9')](),controller[_0xf0ae('0xa')]);router[_0xf0ae('0x8')](_0xf0ae('0xb'),auth[_0xf0ae('0x9')](),controller['describe']);router[_0xf0ae('0x8')](_0xf0ae('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf0ae('0x8')](_0xf0ae('0xd'),auth[_0xf0ae('0x9')](),controller['getDispositions']);router[_0xf0ae('0x8')](_0xf0ae('0xe'),auth['isAuthenticated'](),controller[_0xf0ae('0xf')]);router[_0xf0ae('0x8')](_0xf0ae('0x10'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x11')]);router[_0xf0ae('0x8')](_0xf0ae('0x12'),auth[_0xf0ae('0x9')](),controller['getInteractions']);router[_0xf0ae('0x8')](_0xf0ae('0x13'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x14')]);router[_0xf0ae('0x15')]('/',auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x16')]);router[_0xf0ae('0x15')](_0xf0ae('0xd'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x17')]);router['post']('/:id/canned_answers',auth[_0xf0ae('0x9')](),controller['addAnswer']);router['post'](_0xf0ae('0x18'),controller[_0xf0ae('0x19')]);router[_0xf0ae('0x15')](_0xf0ae('0x10'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x1a')]);router[_0xf0ae('0x15')](_0xf0ae('0x13'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x1b')]);router['post'](_0xf0ae('0x1c'),auth['isAuthenticated'](),controller['send']);router[_0xf0ae('0x1d')](_0xf0ae('0xc'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x1e')]);router['delete']('/:id',auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x1f')]);router[_0xf0ae('0x20')](_0xf0ae('0xd'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x21')]);router[_0xf0ae('0x20')](_0xf0ae('0xe'),auth['isAuthenticated'](),controller[_0xf0ae('0x22')]);router[_0xf0ae('0x20')](_0xf0ae('0x13'),auth[_0xf0ae('0x9')](),controller[_0xf0ae('0x23')]);module[_0xf0ae('0x24')]=router; \ No newline at end of file +var _0xe1d7=['../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','getAgents','create','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/users','addAgents','/:id/send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4648e2,_0x38b3a2){var _0x4e6005=function(_0x3ec64a){while(--_0x3ec64a){_0x4648e2['push'](_0x4648e2['shift']());}};_0x4e6005(++_0x38b3a2);}(_0xe1d7,0x129));var _0x7e1d=function(_0x4cbdc4,_0x8be7a8){_0x4cbdc4=_0x4cbdc4-0x0;var _0x413c70=_0xe1d7[_0x4cbdc4];return _0x413c70;};'use strict';var multer=require(_0x7e1d('0x0'));var util=require(_0x7e1d('0x1'));var path=require(_0x7e1d('0x2'));var timeout=require(_0x7e1d('0x3'));var express=require(_0x7e1d('0x4'));var router=express[_0x7e1d('0x5')]();var fs_extra=require(_0x7e1d('0x6'));var auth=require(_0x7e1d('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x7e1d('0x8')]('/',auth[_0x7e1d('0x9')](),controller[_0x7e1d('0xa')]);router['get'](_0x7e1d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7e1d('0xc'),auth[_0x7e1d('0x9')](),controller[_0x7e1d('0xd')]);router['get'](_0x7e1d('0xe'),auth['isAuthenticated'](),controller[_0x7e1d('0xf')]);router['get']('/:id/canned_answers',auth[_0x7e1d('0x9')](),controller[_0x7e1d('0x10')]);router[_0x7e1d('0x8')]('/:id/applications',auth[_0x7e1d('0x9')](),controller['getApplications']);router[_0x7e1d('0x8')](_0x7e1d('0x11'),auth[_0x7e1d('0x9')](),controller[_0x7e1d('0x12')]);router[_0x7e1d('0x8')]('/:id/users',auth[_0x7e1d('0x9')](),controller[_0x7e1d('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e1d('0x14')]);router[_0x7e1d('0x15')](_0x7e1d('0xe'),auth[_0x7e1d('0x9')](),controller[_0x7e1d('0x16')]);router[_0x7e1d('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7e1d('0x17')]);router['post'](_0x7e1d('0x18'),controller[_0x7e1d('0x19')]);router[_0x7e1d('0x15')](_0x7e1d('0x1a'),auth['isAuthenticated'](),controller[_0x7e1d('0x1b')]);router['post'](_0x7e1d('0x1c'),auth[_0x7e1d('0x9')](),controller[_0x7e1d('0x1d')]);router[_0x7e1d('0x15')](_0x7e1d('0x1e'),auth[_0x7e1d('0x9')](),controller['send']);router[_0x7e1d('0x1f')](_0x7e1d('0xc'),auth[_0x7e1d('0x9')](),controller['update']);router[_0x7e1d('0x20')](_0x7e1d('0xc'),auth[_0x7e1d('0x9')](),controller[_0x7e1d('0x21')]);router[_0x7e1d('0x20')]('/:id/dispositions',auth[_0x7e1d('0x9')](),controller[_0x7e1d('0x22')]);router[_0x7e1d('0x20')](_0x7e1d('0x23'),auth[_0x7e1d('0x9')](),controller['removeAnswers']);router[_0x7e1d('0x20')]('/:id/users',auth[_0x7e1d('0x9')](),controller[_0x7e1d('0x24')]);module[_0x7e1d('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 73c1a2c..a0bffe1 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 _0xd9db=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','name','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x450aeb,_0x599bf6){var _0x2126ce=function(_0x52b4f2){while(--_0x52b4f2){_0x450aeb['push'](_0x450aeb['shift']());}};_0x2126ce(++_0x599bf6);}(_0xd9db,0x147));var _0xbd9d=function(_0x1cb26e,_0x2be57a){_0x1cb26e=_0x1cb26e-0x0;var _0x5ce8b2=_0xd9db[_0x1cb26e];return _0x5ce8b2;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbd9d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbd9d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xbd9d('0x2')]},'token':{'type':Sequelize[_0xbd9d('0x2')],'defaultValue':function(){return rs[_0xbd9d('0x3')]();}},'replyUri':{'type':Sequelize[_0xbd9d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbd9d('0x4')],'defaultValue':function(){return _0xbd9d('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbd9d('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbd9d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbd9d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbd9d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbd9d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbd9d('0x7')],'defaultValue':![],'comment':_0xbd9d('0x9'),'set':function(_0x78c461){if(!_0x78c461)this['setDataValue'](_0xbd9d('0xa'),null);this['setDataValue'](_0xbd9d('0xb'),_0x78c461);}}}; \ No newline at end of file +var _0x9d83=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d83,0x108));var _0x39d8=function(_0x3ddb4e,_0x5d9ecf){_0x3ddb4e=_0x3ddb4e-0x0;var _0x16202e=_0x9d83[_0x3ddb4e];return _0x16202e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x39d8('0x0'));module[_0x39d8('0x1')]={'name':{'type':Sequelize[_0x39d8('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x39d8('0x2')]},'token':{'type':Sequelize[_0x39d8('0x2')],'defaultValue':function(){return rs[_0x39d8('0x3')]();}},'replyUri':{'type':Sequelize[_0x39d8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x39d8('0x4')],'defaultValue':function(){return _0x39d8('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x39d8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x39d8('0x2')]},'queueTransfer':{'type':Sequelize[_0x39d8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x39d8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x39d8('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x39d8('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x39d8('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x39d8('0x7')],'defaultValue':![],'comment':_0x39d8('0x9'),'set':function(_0x4b8d31){if(!_0x4b8d31)this[_0x39d8('0xa')](_0x39d8('0xb'),null);this[_0x39d8('0xa')](_0x39d8('0xc'),_0x4b8d31);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index e0aef6e..ddd2d5b 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 _0x861c=['Tag','Tags','color','tag','addAgents','omit','ids','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./openchannelAccount.socket','jayson/promise','client','http','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','end','sendStatus','stack','name','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelAccount','findAll','rows','catch','show','Pause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','userProfileId','params','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','nolimit','OpenchannelAccountId','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','openchannel','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from','Sequelize','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','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','contact','lastName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner'];(function(_0x5b60d2,_0x3ad129){var _0x4a7449=function(_0x1e08d7){while(--_0x1e08d7){_0x5b60d2['push'](_0x5b60d2['shift']());}};_0x4a7449(++_0x3ad129);}(_0x861c,0xdb));var _0xc861=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x861c[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xc861('0x0'));var rimraf=require(_0xc861('0x1'));var zipdir=require(_0xc861('0x2'));var jsonpatch=require(_0xc861('0x3'));var rp=require(_0xc861('0x4'));var moment=require(_0xc861('0x5'));var BPromise=require(_0xc861('0x6'));var Mustache=require(_0xc861('0x7'));var util=require(_0xc861('0x8'));var path=require(_0xc861('0x9'));var sox=require(_0xc861('0xa'));var csv=require(_0xc861('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc861('0xc'));var _=require(_0xc861('0xd'));var squel=require(_0xc861('0xe'));var crypto=require(_0xc861('0xf'));var jsforce=require(_0xc861('0x10'));var deskjs=require(_0xc861('0x11'));var toCsv=require(_0xc861('0xb'));var querystring=require(_0xc861('0x12'));var Papa=require(_0xc861('0x13'));var Redis=require(_0xc861('0x14'));var authService=require(_0xc861('0x15'));var qs=require(_0xc861('0x16'));var as=require(_0xc861('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc861('0x18'))(_0xc861('0x19'));var utils=require(_0xc861('0x1a'));var config=require(_0xc861('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xc861('0x1c'))['db'];config[_0xc861('0x1d')]=_[_0xc861('0x1e')](config[_0xc861('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc861('0x1d')]));require(_0xc861('0x1f'))['register'](socket);var jayson=require(_0xc861('0x20'));var client=jayson[_0xc861('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xc861('0x21')][_0xc861('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2e2b94,_0xd8e34a,_0x3af352,_0x8766eb){return new BPromise(function(_0x5d6040,_0x5f0883){var _0x44a1fb=_0x8766eb||client;return _0x44a1fb['request'](_0x2e2b94,_0x3af352)[_0xc861('0x23')](function(_0x3296c1){logger[_0xc861('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0xd8e34a,_0xc861('0x25'));logger['debug'](_0xc861('0x26'),_0xd8e34a,_0xc861('0x25'),JSON[_0xc861('0x27')](_0x3296c1));if(_0x3296c1[_0xc861('0x28')]){if(_0x3296c1[_0xc861('0x28')][_0xc861('0x29')]===0x1f4){logger[_0xc861('0x28')](_0xc861('0x2a'),_0xd8e34a,_0x3296c1[_0xc861('0x28')][_0xc861('0x2b')]);return _0x5f0883(_0x3296c1[_0xc861('0x28')][_0xc861('0x2b')]);}logger[_0xc861('0x28')](_0xc861('0x2a'),_0xd8e34a,_0x3296c1[_0xc861('0x28')][_0xc861('0x2b')]);return _0x5d6040(_0x3296c1['error'][_0xc861('0x2b')]);}else{logger[_0xc861('0x24')](_0xc861('0x2a'),_0xd8e34a,_0xc861('0x25'));_0x5d6040(_0x3296c1[_0xc861('0x2c')][_0xc861('0x2b')]);}})['catch'](function(_0x11abae){logger[_0xc861('0x28')](_0xc861('0x2a'),_0xd8e34a,_0x11abae);_0x5f0883(_0x11abae);});});}function respondWithStatusCode(_0x11884d,_0x38a737){_0x38a737=_0x38a737||0xcc;return function(_0x1cefa7){if(_0x1cefa7){return _0x11884d['sendStatus'](_0x38a737);}return _0x11884d[_0xc861('0x2d')](_0x38a737)['end']();};}function respondWithResult(_0x5af598,_0x546dbb){_0x546dbb=_0x546dbb||0xc8;return function(_0x13e4e2){if(_0x13e4e2){return _0x5af598[_0xc861('0x2d')](_0x546dbb)[_0xc861('0x2e')](_0x13e4e2);}};}function respondWithFilteredResult(_0x30b9f4,_0x2f3790){return function(_0xff9c32){if(_0xff9c32){var _0x431695=typeof _0x2f3790[_0xc861('0x2f')]==='undefined'&&typeof _0x2f3790[_0xc861('0x30')]===_0xc861('0x31');var _0x62317e=_0xff9c32['count'];var _0x3089dd=_0x431695?0x0:_0x2f3790['offset'];var _0x26da6e=_0x431695?_0xff9c32[_0xc861('0x32')]:_0x2f3790[_0xc861('0x2f')]+_0x2f3790[_0xc861('0x30')];var _0x509243;if(_0x26da6e>=_0x62317e){_0x26da6e=_0x62317e;_0x509243=0xc8;}else{_0x509243=0xce;}_0x30b9f4[_0xc861('0x2d')](_0x509243);return _0x30b9f4[_0xc861('0x33')](_0xc861('0x34'),_0x3089dd+'-'+_0x26da6e+'/'+_0x62317e)[_0xc861('0x2e')](_0xff9c32);}return null;};}function patchUpdates(_0x373193){return function(_0x2b9ee9){try{jsonpatch[_0xc861('0x35')](_0x2b9ee9,_0x373193,!![]);}catch(_0x1d5689){return BPromise[_0xc861('0x36')](_0x1d5689);}return _0x2b9ee9['save']();};}function saveUpdates(_0x10d61c,_0x514f54){return function(_0x285f84){if(_0x285f84){return _0x285f84[_0xc861('0x37')](_0x10d61c)[_0xc861('0x23')](function(_0x2061d5){return _0x2061d5;});}return null;};}function removeEntity(_0x14e16e,_0x2dbef7){return function(_0x11f57c){if(_0x11f57c){return _0x11f57c[_0xc861('0x38')]()[_0xc861('0x23')](function(){var _0xae9e69=_0x11f57c[_0xc861('0x39')]({'plain':!![]});var _0x3f967f='OpenchannelAccounts';return db[_0xc861('0x3a')][_0xc861('0x38')]({'where':{'type':_0x3f967f,'resourceId':_0xae9e69['id']}})[_0xc861('0x23')](function(){return _0x11f57c;});})[_0xc861('0x23')](function(){_0x14e16e[_0xc861('0x2d')](0xcc)[_0xc861('0x3b')]();});}};}function handleEntityNotFound(_0x3a80dd,_0x31a3e6){return function(_0x3934d7){if(!_0x3934d7){_0x3a80dd[_0xc861('0x3c')](0x194);}return _0x3934d7;};}function handleError(_0x568c47,_0x39555a){_0x39555a=_0x39555a||0x1f4;return function(_0x5b12e6){logger[_0xc861('0x28')](_0x5b12e6[_0xc861('0x3d')]);if(_0x5b12e6[_0xc861('0x3e')]){delete _0x5b12e6[_0xc861('0x3e')];}_0x568c47['status'](_0x39555a)['send'](_0x5b12e6);};}exports[_0xc861('0x3f')]=function(_0x480fd0,_0x6e3707){var _0x334e7f={'include':[{'model':db['Pause'],'as':_0xc861('0x40')}]},_0x420877={},_0x59626f={'count':0x0,'rows':[]};var _0x53783e=_[_0xc861('0x41')](db['OpenchannelAccount'][_0xc861('0x42')],function(_0x2b2d0f){return{'name':_0x2b2d0f[_0xc861('0x43')],'type':_0x2b2d0f[_0xc861('0x44')][_0xc861('0x45')]};});_0x420877[_0xc861('0x46')]=_[_0xc861('0x41')](_0x53783e,_0xc861('0x3e'));_0x420877[_0xc861('0x47')]=_[_0xc861('0x48')](_0x480fd0[_0xc861('0x47')]);_0x420877[_0xc861('0x49')]=_['intersection'](_0x420877[_0xc861('0x46')],_0x420877[_0xc861('0x47')]);_0x334e7f['attributes']=_[_0xc861('0x4a')](_0x420877[_0xc861('0x46')],qs[_0xc861('0x4b')](_0x480fd0[_0xc861('0x47')][_0xc861('0x4b')]));_0x334e7f['attributes']=_0x334e7f['attributes']['length']?_0x334e7f[_0xc861('0x4c')]:_0x420877[_0xc861('0x46')];if(!_0x480fd0[_0xc861('0x47')]['hasOwnProperty']('nolimit')){_0x334e7f[_0xc861('0x30')]=qs[_0xc861('0x30')](_0x480fd0[_0xc861('0x47')][_0xc861('0x30')]);_0x334e7f[_0xc861('0x2f')]=qs[_0xc861('0x2f')](_0x480fd0[_0xc861('0x47')]['offset']);}_0x334e7f[_0xc861('0x4d')]=qs[_0xc861('0x4e')](_0x480fd0[_0xc861('0x47')]['sort']);_0x334e7f[_0xc861('0x4f')]=qs['filters'](_[_0xc861('0x50')](_0x480fd0[_0xc861('0x47')],_0x420877['filters']),_0x53783e);if(_0x480fd0[_0xc861('0x47')][_0xc861('0x51')]){_0x334e7f[_0xc861('0x4f')]=_[_0xc861('0x52')](_0x334e7f[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0x53783e,function(_0x5aeb2f){if(_0x5aeb2f[_0xc861('0x44')]!==_0xc861('0x53')){var _0x58d060={};_0x58d060[_0x5aeb2f[_0xc861('0x3e')]]={'$like':'%'+_0x480fd0['query'][_0xc861('0x51')]+'%'};return _0x58d060;}})});}_0x334e7f=_[_0xc861('0x52')]({},_0x334e7f,_0x480fd0[_0xc861('0x54')]);var _0x3f846e={'where':_0x334e7f['where']};return db['OpenchannelAccount'][_0xc861('0x32')](_0x3f846e)[_0xc861('0x23')](function(_0x9e01f4){_0x59626f[_0xc861('0x32')]=_0x9e01f4;if(_0x480fd0[_0xc861('0x47')][_0xc861('0x55')]){_0x334e7f[_0xc861('0x56')]=[{'all':!![]}];}return db[_0xc861('0x57')][_0xc861('0x58')](_0x334e7f);})[_0xc861('0x23')](function(_0x2db99a){_0x59626f[_0xc861('0x59')]=_0x2db99a;return _0x59626f;})[_0xc861('0x23')](respondWithFilteredResult(_0x6e3707,_0x334e7f))[_0xc861('0x5a')](handleError(_0x6e3707,null));};exports[_0xc861('0x5b')]=function(_0x106b56,_0x58b1e5){var _0x401f0e={'raw':![],'where':{'id':_0x106b56['params']['id']},'include':[{'model':db[_0xc861('0x5c')],'as':_0xc861('0x40')}]},_0x5e4cf9={};_0x5e4cf9[_0xc861('0x46')]=_[_0xc861('0x48')](db[_0xc861('0x57')][_0xc861('0x42')]);_0x5e4cf9[_0xc861('0x47')]=_[_0xc861('0x48')](_0x106b56[_0xc861('0x47')]);_0x5e4cf9[_0xc861('0x49')]=_[_0xc861('0x4a')](_0x5e4cf9['model'],_0x5e4cf9[_0xc861('0x47')]);_0x401f0e[_0xc861('0x4c')]=_[_0xc861('0x4a')](_0x5e4cf9[_0xc861('0x46')],qs['fields'](_0x106b56[_0xc861('0x47')]['fields']));_0x401f0e[_0xc861('0x4c')]=_0x401f0e[_0xc861('0x4c')][_0xc861('0x5d')]?_0x401f0e[_0xc861('0x4c')]:_0x5e4cf9[_0xc861('0x46')];if(_0x106b56[_0xc861('0x47')][_0xc861('0x55')]){_0x401f0e['include']=[{'all':!![]}];}_0x401f0e=_[_0xc861('0x52')]({},_0x401f0e,_0x106b56[_0xc861('0x54')]);return db[_0xc861('0x57')][_0xc861('0x5e')](_0x401f0e)[_0xc861('0x23')](handleEntityNotFound(_0x58b1e5,null))[_0xc861('0x23')](respondWithResult(_0x58b1e5,null))[_0xc861('0x5a')](handleError(_0x58b1e5,null));};exports[_0xc861('0x5f')]=function(_0x1be63d,_0x5e6d4e){return db[_0xc861('0x57')]['create'](_0x1be63d[_0xc861('0x60')],{})['then'](function(_0x239339){var _0x543926=_0x1be63d[_0xc861('0x61')]['get']({'plain':!![]});if(!_0x543926)throw new Error(_0xc861('0x62'));if(_0x543926[_0xc861('0x63')]===_0xc861('0x61')){var _0x776a07=_0x239339['get']({'plain':!![]});var _0x44b3b2=_0xc861('0x64');return db['UserProfileSection']['find']({'where':{'name':_0x44b3b2,'userProfileId':_0x543926[_0xc861('0x65')]},'raw':!![]})[_0xc861('0x23')](function(_0x3c1569){if(_0x3c1569&&_0x3c1569['autoAssociation']===0x0){return db[_0xc861('0x3a')][_0xc861('0x5f')]({'name':_0x776a07[_0xc861('0x3e')],'resourceId':_0x776a07['id'],'type':_0x3c1569[_0xc861('0x3e')],'sectionId':_0x3c1569['id']},{})['then'](function(){return _0x239339;});}else{return _0x239339;}})[_0xc861('0x5a')](function(_0x203c80){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x203c80);throw _0x203c80;});}return _0x239339;})[_0xc861('0x23')](respondWithResult(_0x5e6d4e,0xc9))['catch'](handleError(_0x5e6d4e,null));};exports[_0xc861('0x37')]=function(_0x3b19b0,_0x97faa4){if(_0x3b19b0[_0xc861('0x60')]['id']){delete _0x3b19b0['body']['id'];}return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x3b19b0[_0xc861('0x66')]['id']},'include':[{'model':db[_0xc861('0x5c')],'as':_0xc861('0x40')}]})[_0xc861('0x23')](handleEntityNotFound(_0x97faa4,null))[_0xc861('0x23')](saveUpdates(_0x3b19b0[_0xc861('0x60')],null))[_0xc861('0x23')](respondWithResult(_0x97faa4,null))[_0xc861('0x5a')](handleError(_0x97faa4,null));};exports['destroy']=function(_0x4c2360,_0x3526b8){return db[_0xc861('0x57')]['find']({'where':{'id':_0x4c2360['params']['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x3526b8,null))[_0xc861('0x23')](removeEntity(_0x3526b8,null))[_0xc861('0x5a')](handleError(_0x3526b8,null));};exports[_0xc861('0x67')]=function(_0x5baa46,_0x3f959d){return db[_0xc861('0x57')][_0xc861('0x67')]()[_0xc861('0x23')](respondWithResult(_0x3f959d,null))[_0xc861('0x5a')](handleError(_0x3f959d,null));};exports[_0xc861('0x68')]=function(_0x51638f,_0x14ba0f,_0x1226be){if(_0x51638f[_0xc861('0x60')]['id']){delete _0x51638f[_0xc861('0x60')]['id'];}return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x51638f[_0xc861('0x66')]['id']}})['then'](handleEntityNotFound(_0x14ba0f,null))[_0xc861('0x23')](function(_0x349eb6){if(_0x349eb6){_0x51638f[_0xc861('0x60')]['OpenchannelAccountId']=_0x349eb6['id'];return db[_0xc861('0x69')][_0xc861('0x5f')](_0x51638f[_0xc861('0x60')]);}})[_0xc861('0x23')](respondWithResult(_0x14ba0f,null))[_0xc861('0x5a')](handleError(_0x14ba0f,null));};exports[_0xc861('0x6a')]=function(_0x4eff62,_0x575961,_0xe36feb){var _0xde2f63={'raw':![],'where':{}};var _0x521300={};var _0x2fc059={'count':0x0,'rows':[]};return db[_0xc861('0x57')]['findOne']({'where':{'id':_0x4eff62[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x575961,null))['then'](function(_0x1b26ec){if(_0x1b26ec){_0x521300[_0xc861('0x46')]=_[_0xc861('0x48')](db[_0xc861('0x69')][_0xc861('0x42')]);_0x521300['query']=_[_0xc861('0x48')](_0x4eff62[_0xc861('0x47')]);_0x521300[_0xc861('0x49')]=_['intersection'](_0x521300['model'],_0x521300['query']);_0xde2f63[_0xc861('0x4c')]=_[_0xc861('0x4a')](_0x521300['model'],qs[_0xc861('0x4b')](_0x4eff62[_0xc861('0x47')][_0xc861('0x4b')]));_0xde2f63['attributes']=_0xde2f63[_0xc861('0x4c')][_0xc861('0x5d')]?_0xde2f63[_0xc861('0x4c')]:_0x521300[_0xc861('0x46')];if(!_0x4eff62['query'][_0xc861('0x6b')](_0xc861('0x6c'))){_0xde2f63['limit']=qs[_0xc861('0x30')](_0x4eff62[_0xc861('0x47')][_0xc861('0x30')]);_0xde2f63['offset']=qs['offset'](_0x4eff62['query'][_0xc861('0x2f')]);}_0xde2f63['order']=qs['sort'](_0x4eff62[_0xc861('0x47')][_0xc861('0x4e')]);_0xde2f63[_0xc861('0x4f')]=qs[_0xc861('0x49')](_['pick'](_0x4eff62[_0xc861('0x47')],_0x521300['filters']));_0xde2f63[_0xc861('0x4f')][_0xc861('0x6d')]=_0x1b26ec['id'];if(_0x4eff62[_0xc861('0x47')][_0xc861('0x51')]){_0xde2f63[_0xc861('0x4f')]=_['merge'](_0xde2f63[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0xde2f63[_0xc861('0x4c')],function(_0x1e2321){var _0x6562a3={};_0x6562a3[_0x1e2321]={'$like':'%'+_0x4eff62[_0xc861('0x47')]['filter']+'%'};return _0x6562a3;})});}_0xde2f63=_[_0xc861('0x52')]({},_0xde2f63,_0x4eff62[_0xc861('0x54')]);return db[_0xc861('0x69')][_0xc861('0x32')]({'where':_0xde2f63[_0xc861('0x4f')]})[_0xc861('0x23')](function(_0x470041){_0x2fc059['count']=_0x470041;if(_0x4eff62[_0xc861('0x47')][_0xc861('0x55')]){_0xde2f63[_0xc861('0x56')]=[{'all':!![]}];}return db[_0xc861('0x69')][_0xc861('0x58')](_0xde2f63);})[_0xc861('0x23')](function(_0x2d5ff){_0x2fc059[_0xc861('0x59')]=_0x2d5ff;return _0x2fc059;});}})['then'](respondWithFilteredResult(_0x575961,_0xde2f63))['catch'](handleError(_0x575961,null));};exports[_0xc861('0x6e')]=function(_0x2debbe,_0x4bf852,_0x16899a){return db[_0xc861('0x57')]['find']({'where':{'id':_0x2debbe[_0xc861('0x66')]['id']}})['then'](handleEntityNotFound(_0x4bf852,null))[_0xc861('0x23')](function(_0x5b4269){if(_0x5b4269){return _0x5b4269[_0xc861('0x6e')](_0x2debbe[_0xc861('0x47')]['ids']);}})[_0xc861('0x23')](respondWithStatusCode(_0x4bf852,null))[_0xc861('0x5a')](handleError(_0x4bf852,null));};exports[_0xc861('0x6f')]=function(_0x23b709,_0x41a222,_0x512969){if(_0x23b709['body']['id']){delete _0x23b709[_0xc861('0x60')]['id'];}return db[_0xc861('0x57')]['find']({'where':{'id':_0x23b709[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x41a222,null))['then'](function(_0x5f0152){if(_0x5f0152){_0x23b709[_0xc861('0x60')][_0xc861('0x6d')]=_0x5f0152['id'];return db['CannedAnswer'][_0xc861('0x5f')](_0x23b709[_0xc861('0x60')]);}})[_0xc861('0x23')](respondWithResult(_0x41a222,null))[_0xc861('0x5a')](handleError(_0x41a222,null));};exports[_0xc861('0x70')]=function(_0x4b1ebd,_0x2c0715,_0x272cee){var _0x5b4791={'raw':![],'where':{}};var _0x1fa681={};var _0x69ca04={'count':0x0,'rows':[]};return db[_0xc861('0x57')]['findOne']({'where':{'id':_0x4b1ebd['params']['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x2c0715,null))['then'](function(_0x44e077){if(_0x44e077){_0x1fa681[_0xc861('0x46')]=_['keys'](db[_0xc861('0x71')][_0xc861('0x42')]);_0x1fa681[_0xc861('0x47')]=_[_0xc861('0x48')](_0x4b1ebd['query']);_0x1fa681['filters']=_[_0xc861('0x4a')](_0x1fa681[_0xc861('0x46')],_0x1fa681[_0xc861('0x47')]);_0x5b4791[_0xc861('0x4c')]=_['intersection'](_0x1fa681[_0xc861('0x46')],qs['fields'](_0x4b1ebd[_0xc861('0x47')][_0xc861('0x4b')]));_0x5b4791[_0xc861('0x4c')]=_0x5b4791[_0xc861('0x4c')][_0xc861('0x5d')]?_0x5b4791[_0xc861('0x4c')]:_0x1fa681[_0xc861('0x46')];if(!_0x4b1ebd['query'][_0xc861('0x6b')](_0xc861('0x6c'))){_0x5b4791[_0xc861('0x30')]=qs['limit'](_0x4b1ebd[_0xc861('0x47')]['limit']);_0x5b4791[_0xc861('0x2f')]=qs[_0xc861('0x2f')](_0x4b1ebd[_0xc861('0x47')][_0xc861('0x2f')]);}_0x5b4791['order']=qs['sort'](_0x4b1ebd[_0xc861('0x47')][_0xc861('0x4e')]);_0x5b4791[_0xc861('0x4f')]=qs['filters'](_[_0xc861('0x50')](_0x4b1ebd['query'],_0x1fa681[_0xc861('0x49')]));_0x5b4791[_0xc861('0x4f')][_0xc861('0x6d')]=_0x44e077['id'];if(_0x4b1ebd[_0xc861('0x47')][_0xc861('0x51')]){_0x5b4791[_0xc861('0x4f')]=_['merge'](_0x5b4791[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0x5b4791['attributes'],function(_0x1d090e){var _0x24f7ae={};_0x24f7ae[_0x1d090e]={'$like':'%'+_0x4b1ebd[_0xc861('0x47')][_0xc861('0x51')]+'%'};return _0x24f7ae;})});}_0x5b4791=_[_0xc861('0x52')]({},_0x5b4791,_0x4b1ebd['options']);return db[_0xc861('0x71')][_0xc861('0x32')]({'where':_0x5b4791['where']})['then'](function(_0x1b3a94){_0x69ca04[_0xc861('0x32')]=_0x1b3a94;if(_0x4b1ebd[_0xc861('0x47')][_0xc861('0x55')]){_0x5b4791[_0xc861('0x56')]=[{'all':!![]}];}return db[_0xc861('0x71')]['findAll'](_0x5b4791);})['then'](function(_0x1ebdc2){_0x69ca04[_0xc861('0x59')]=_0x1ebdc2;return _0x69ca04;});}})[_0xc861('0x23')](respondWithFilteredResult(_0x2c0715,_0x5b4791))['catch'](handleError(_0x2c0715,null));};exports[_0xc861('0x72')]=function(_0xbb952,_0xeda883,_0xdd7568){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0xbb952[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0xeda883,null))[_0xc861('0x23')](function(_0x1faf2a){if(_0x1faf2a){return _0x1faf2a[_0xc861('0x72')](_0xbb952['query']['ids']);}})[_0xc861('0x23')](respondWithStatusCode(_0xeda883,null))[_0xc861('0x5a')](handleError(_0xeda883,null));};exports[_0xc861('0x73')]=function(_0x5a5790,_0x54bf9c,_0x5b3b9b){var _0x580135={'body':_0x5a5790['body'],'channel':_0xc861('0x74')};var _0x1362cc=[];var _0x595117=[];var _0x3d2ce8={};var _0x3f2cdb=![];return db[_0xc861('0x75')][_0xc861('0x67')]()[_0xc861('0x23')](function(_0x931112){if(!_0x931112){throw new db['Sequelize']['ValidationError'](_0xc861('0x76'));}_0x1362cc=_[_0xc861('0x77')](_[_0xc861('0x48')](_0x931112),[_0xc861('0x78'),_0xc861('0x79')]);_0x595117=_[_0xc861('0x77')](_['keys'](_0x931112),['createdAt',_0xc861('0x79'),'CompanyId',_0xc861('0x7a')]);if(_0x5a5790[_0xc861('0x60')]['id']){delete _0x5a5790['body']['id'];}if(_[_0xc861('0x7b')](_0x5a5790[_0xc861('0x60')][_0xc861('0x7c')])){throw new db[(_0xc861('0x7d'))][(_0xc861('0x7e'))](_0xc861('0x7f'));}if(_[_0xc861('0x7b')](_0x5a5790[_0xc861('0x60')][_0xc861('0x60')])||_0x5a5790[_0xc861('0x60')]['body']===''){throw new db['Sequelize'][(_0xc861('0x7e'))](_0xc861('0x80'));}if(_[_0xc861('0x7b')](_0x5a5790[_0xc861('0x60')][_0xc861('0x81')])){throw new db[(_0xc861('0x7d'))]['ValidationError'](_0xc861('0x82')+_0x595117);}if(!_[_0xc861('0x83')](_0x595117,_0x5a5790[_0xc861('0x60')][_0xc861('0x81')])){throw new db['Sequelize'][(_0xc861('0x7e'))](_0xc861('0x84')+_0x595117);}_0x3d2ce8[_0x5a5790['body']['mapKey']]=_0x5a5790[_0xc861('0x60')]['from'];})[_0xc861('0x23')](function(){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x5a5790['params']['id']},'include':[{'model':db[_0xc861('0x85')],'as':_0xc861('0x86'),'include':[{'model':db[_0xc861('0x75')],'as':_0xc861('0x87'),'where':_0x3d2ce8,'limit':0x1,'order':[[_0xc861('0x79'),_0xc861('0x88')]]}]},{'model':db[_0xc861('0x89')],'as':_0xc861('0x8a')}]});})['then'](handleEntityNotFound(_0x54bf9c,null))[_0xc861('0x23')](function(_0x4c07cf){if(_0x4c07cf&&_0x4c07cf[_0xc861('0x86')]){_0x580135[_0xc861('0x8b')]=_0x4c07cf;_0x580135[_0xc861('0x8c')]=_0x4c07cf[_0xc861('0x8a')];_0x580135[_0xc861('0x8d')]=_0x4c07cf[_0xc861('0x86')];_0x580135['applications']=_[_0xc861('0x8e')](_0x580135[_0xc861('0x8c')],[_0xc861('0x8f')],[_0xc861('0x90')]);if(_0x580135[_0xc861('0x8b')][_0xc861('0x8a')]){delete _0x580135[_0xc861('0x8b')][_0xc861('0x8a')];}if(_0x580135['account'][_0xc861('0x86')]&&_0x580135[_0xc861('0x8b')][_0xc861('0x86')]['Contacts']['length']){return _0x580135[_0xc861('0x8b')]['List'][_0xc861('0x87')][0x0];}var _0x20afba=_[_0xc861('0x1e')](_0x5a5790[_0xc861('0x60')],{'firstName':_0x5a5790[_0xc861('0x60')][_0xc861('0x7c')],'ListId':_0x4c07cf['ListId']});_0x20afba[_0x5a5790['body']['mapKey']]=_0x5a5790[_0xc861('0x60')][_0xc861('0x7c')];return db[_0xc861('0x75')][_0xc861('0x5f')](_0x20afba,{'fields':_0x1362cc,'raw':!![]});}})[_0xc861('0x23')](handleEntityNotFound(_0x54bf9c,null))[_0xc861('0x23')](function(_0x495462){_0x580135['contact']=_0x495462;if(_0x495462){var _0x3ca1bd={'ContactId':_0x495462['id'],'OpenchannelAccountId':_0x5a5790[_0xc861('0x66')]['id'],'from':(_0x495462['firstName']||'')+'\x20'+(_0x495462['lastName']||'')};var _0x37f75a={'OpenchannelAccountId':_0x5a5790[_0xc861('0x66')]['id'],'closed':![]};if(_0x5a5790[_0xc861('0x60')][_0xc861('0x91')]){_0x37f75a[_0xc861('0x91')]=_0x5a5790[_0xc861('0x60')][_0xc861('0x91')];return db[_0xc861('0x92')][_0xc861('0x5e')]({'where':_0x37f75a})[_0xc861('0x23')](function(_0x33618e){if(_0x33618e){return[_0x33618e,![]];}_0x3ca1bd[_0xc861('0x91')]=_0x5a5790['body'][_0xc861('0x91')];_0x3ca1bd[_0xc861('0x93')]=_0x5a5790['body'][_0xc861('0x93')];return db[_0xc861('0x92')]['create'](_0x3ca1bd)['then'](function(_0x1a92a7){return[_0x1a92a7,!![]];});});}else{_0x37f75a['threadId']=null;}_0x37f75a[_0xc861('0x94')]=_0x495462['id'];return db[_0xc861('0x92')][_0xc861('0x5e')]({'where':_0x37f75a})[_0xc861('0x23')](function(_0x2a9bef){if(_0x2a9bef){return[_0x2a9bef,![]];}return db[_0xc861('0x92')][_0xc861('0x5f')](_0x3ca1bd)[_0xc861('0x23')](function(_0xa8adc1){return[_0xa8adc1,!![]];});});}})[_0xc861('0x95')](function(_0x546099,_0x238266){if(_0x546099){_0x3f2cdb=_0x238266;if(!_0x238266){var _0x268c25={'from':(_0x580135['contact'][_0xc861('0x96')]||'')+'\x20'+(_0x580135[_0xc861('0x97')][_0xc861('0x98')]||'')};if(_0x5a5790[_0xc861('0x60')][_0xc861('0x91')]&&_0x5a5790[_0xc861('0x60')][_0xc861('0x99')]&&_0x5a5790[_0xc861('0x60')][_0xc861('0x91')]!=_0x5a5790[_0xc861('0x60')][_0xc861('0x99')]){_0x268c25[_0xc861('0x91')]=_0x5a5790[_0xc861('0x60')][_0xc861('0x99')];}return _0x546099[_0xc861('0x37')](_0x268c25);}else{return _0x546099;}}})[_0xc861('0x23')](function(_0x4cb999){_0x580135[_0xc861('0x9a')]=_0x4cb999['get']({'plain':!![]});_0x580135[_0xc861('0x9a')][_0xc861('0x9b')]=_0x3f2cdb;if(_0x580135[_0xc861('0x9a')][_0xc861('0x9b')]){if(_0x580135['account'][_0xc861('0x9c')]){_0x580135['applications']['push']({'id':0x0,'priority':_0x580135[_0xc861('0x8c')][_0xc861('0x5d')]+0x1,'app':_0xc861('0x9d'),'appdata':_0xc861('0x9e'),'interval':_0xc861('0x9f')});}}return db[_0xc861('0xa0')]['create']({'body':_0x5a5790[_0xc861('0x60')][_0xc861('0x60')],'OpenchannelAccountId':_0x5a5790[_0xc861('0x66')]['id'],'OpenchannelInteractionId':_0x4cb999['id'],'direction':'in','ContactId':_0x580135[_0xc861('0x97')]['id'],'AttachmentId':_0x5a5790[_0xc861('0x60')][_0xc861('0xa1')]});})[_0xc861('0x23')](function(_0x5a8c20){_0x580135[_0xc861('0x2b')]=_0x5a8c20;if(_0x580135[_0xc861('0x9a')][_0xc861('0xa2')]){return db[_0xc861('0xa3')][_0xc861('0x5e')]({'attributes':['id',_0xc861('0x3e')],'where':{'id':_0x580135[_0xc861('0x9a')][_0xc861('0xa2')]}})[_0xc861('0x23')](function(_0x2f920e){if(_0x2f920e){_0x580135[_0xc861('0x8c')][_0xc861('0xa4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2f920e[_0xc861('0x3e')]+','+(_0x580135['account'][_0xc861('0xa5')]||0xa),'interval':'*,*,*,*'});_0x580135[_0xc861('0xa6')]=![];}return respondWithRpcPromise(_0xc861('0xa7'),_0xc861('0xa8'),_0x580135);});}return respondWithRpcPromise(_0xc861('0xa7'),_0xc861('0xa8'),_0x580135);})['then'](function(_0x119153){respondWithRpcPromise(_0xc861('0xa9'),_0xc861('0xa9'),{'event':_0xc861('0x73'),'message':_0x119153},client9002);return _0x119153;})['then'](respondWithResult(_0x54bf9c,null))[_0xc861('0x5a')](handleError(_0x54bf9c,null));};exports[_0xc861('0xaa')]=function(_0x3baeba,_0x50258a){var _0x3e05dd=_0x3baeba[_0xc861('0x66')]['id'];var _0x3fd37e=_0x3baeba[_0xc861('0x60')];var _0x4aed2b=0xc8;var _0x478bd3=null;return db[_0xc861('0xab')][_0xc861('0xac')]({'isolationLevel':db[_0xc861('0xab')][_0xc861('0xad')][_0xc861('0xae')][_0xc861('0xaf')]},function(_0x4f4217){return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x3e05dd},'transaction':_0x4f4217})[_0xc861('0x23')](function(_0xc2202d){if(_0xc2202d){return db[_0xc861('0x89')][_0xc861('0x38')]({'where':{'OpenchannelAccountId':_0x3e05dd},'transaction':_0x4f4217})[_0xc861('0x23')](function(){var _0x1e3a40=_[_0xc861('0x41')](_0x3fd37e,function(_0x56278d){_0x56278d[_0xc861('0x6d')]=_0x3e05dd;return _0x56278d;});return db[_0xc861('0x89')][_0xc861('0xb1')](_0x1e3a40,{'transaction':_0x4f4217});});}else{_0x4aed2b=0x194;_0x478bd3=[];}});})[_0xc861('0x23')](function(){if(_0x4aed2b!==0x194){return db['OpenchannelApplication'][_0xc861('0xb2')]({'where':{'OpenchannelAccountId':_0x3e05dd},'order':_0xc861('0x8f')})['then'](function(_0x18fcc6){_0x478bd3=_0x18fcc6;});}})[_0xc861('0x5a')](function(_0x12b0fb){_0x4aed2b=0x1f4;logger[_0xc861('0x28')](_0x12b0fb[_0xc861('0x3d')]);if(_0x12b0fb['name']){delete _0x12b0fb[_0xc861('0x3e')];}_0x478bd3=_0x12b0fb;})[_0xc861('0xb3')](function(){if(_0x478bd3===null){_0x50258a[_0xc861('0x3c')](_0x4aed2b);}else{if(_0x4aed2b===0x1f4){_0x50258a[_0xc861('0x2d')](_0x4aed2b)[_0xc861('0xb4')](_0x478bd3);}else{_0x50258a[_0xc861('0x2d')](_0x4aed2b)[_0xc861('0x2e')](_0x478bd3);}}});};exports[_0xc861('0xb5')]=function(_0x293329,_0x12a9b9,_0x316fb2){var _0x406431={};var _0x13708b={};var _0x4a270b;var _0x5585a8;return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x293329[_0xc861('0x66')]['id']}})['then'](handleEntityNotFound(_0x12a9b9,null))[_0xc861('0x23')](function(_0x3f5cd5){if(_0x3f5cd5){_0x4a270b=_0x3f5cd5;_0x13708b[_0xc861('0x46')]=_[_0xc861('0x48')](db['OpenchannelApplication'][_0xc861('0x42')]);_0x13708b[_0xc861('0x47')]=_[_0xc861('0x48')](_0x293329[_0xc861('0x47')]);_0x13708b[_0xc861('0x49')]=_['intersection'](_0x13708b['model'],_0x13708b[_0xc861('0x47')]);_0x406431['attributes']=_[_0xc861('0x4a')](_0x13708b[_0xc861('0x46')],qs[_0xc861('0x4b')](_0x293329[_0xc861('0x47')]['fields']));_0x406431[_0xc861('0x4c')]=_0x406431[_0xc861('0x4c')][_0xc861('0x5d')]?_0x406431[_0xc861('0x4c')]:_0x13708b[_0xc861('0x46')];_0x406431[_0xc861('0x4d')]=qs['sort'](_0x293329[_0xc861('0x47')][_0xc861('0x4e')]);_0x406431[_0xc861('0x4f')]=qs[_0xc861('0x49')](_[_0xc861('0x50')](_0x293329[_0xc861('0x47')],_0x13708b[_0xc861('0x49')]));if(_0x293329['query'][_0xc861('0x51')]){_0x406431['where']=_['merge'](_0x406431[_0xc861('0x4f')],{'$or':_['map'](_0x406431['attributes'],function(_0x30ea27){var _0x5c053c={};_0x5c053c[_0x30ea27]={'$like':'%'+_0x293329['query']['filter']+'%'};return _0x5c053c;})});}_0x406431=_[_0xc861('0x52')]({},_0x406431,_0x293329['options']);return _0x4a270b[_0xc861('0xb5')](_0x406431);}})['then'](function(_0x261bd0){if(_0x261bd0){_0x5585a8=_0x261bd0['length'];if(!_0x293329['query']['hasOwnProperty']('nolimit')){_0x406431[_0xc861('0x30')]=qs['limit'](_0x293329[_0xc861('0x47')][_0xc861('0x30')]);_0x406431[_0xc861('0x2f')]=qs[_0xc861('0x2f')](_0x293329[_0xc861('0x47')][_0xc861('0x2f')]);}return _0x4a270b[_0xc861('0xb5')](_0x406431);}})[_0xc861('0x23')](function(_0x4f70c5){if(_0x4f70c5){return _0x4f70c5?{'count':_0x5585a8,'rows':_0x4f70c5}:null;}})[_0xc861('0x23')](respondWithResult(_0x12a9b9,null))['catch'](handleError(_0x12a9b9,null));};exports[_0xc861('0xb6')]=function(_0x5242ec,_0x48630d,_0x1662d7){var _0x117694={'raw':![],'where':{}};var _0x27a044={};var _0x5ea04e={'count':0x0,'rows':[]};return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x5242ec[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x48630d,null))[_0xc861('0x23')](function(_0x4fffe3){if(_0x4fffe3){_0x27a044[_0xc861('0x46')]=_[_0xc861('0x48')](db['OpenchannelInteraction'][_0xc861('0x42')]);_0x27a044[_0xc861('0x47')]=_[_0xc861('0x48')](_0x5242ec[_0xc861('0x47')]);_0x27a044[_0xc861('0x49')]=_[_0xc861('0x4a')](_0x27a044[_0xc861('0x46')],_0x27a044[_0xc861('0x47')]);_0x117694[_0xc861('0x4c')]=_[_0xc861('0x4a')](_0x27a044['model'],qs[_0xc861('0x4b')](_0x5242ec[_0xc861('0x47')]['fields']));_0x117694[_0xc861('0x4c')]=_0x117694[_0xc861('0x4c')][_0xc861('0x5d')]?_0x117694[_0xc861('0x4c')]:_0x27a044[_0xc861('0x46')];if(!_0x5242ec[_0xc861('0x47')][_0xc861('0x6b')]('nolimit')){_0x117694['limit']=qs[_0xc861('0x30')](_0x5242ec[_0xc861('0x47')][_0xc861('0x30')]);_0x117694[_0xc861('0x2f')]=qs[_0xc861('0x2f')](_0x5242ec[_0xc861('0x47')][_0xc861('0x2f')]);}_0x117694[_0xc861('0x4d')]=qs['sort'](_0x5242ec[_0xc861('0x47')][_0xc861('0x4e')]);_0x117694[_0xc861('0x4f')]=qs['filters'](_['pick'](_0x5242ec[_0xc861('0x47')],_0x27a044['filters']));_0x117694[_0xc861('0x4f')][_0xc861('0x6d')]=_0x4fffe3['id'];if(_0x5242ec[_0xc861('0x47')][_0xc861('0x51')]){_0x117694['where']=_[_0xc861('0x52')](_0x117694[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0x117694['attributes'],function(_0x1dccad){var _0x34e57e={};_0x34e57e[_0x1dccad]={'$like':'%'+_0x5242ec['query'][_0xc861('0x51')]+'%'};return _0x34e57e;})});}_0x117694=_['merge']({},_0x117694,_0x5242ec[_0xc861('0x54')]);return db[_0xc861('0x92')]['count']({'where':_0x117694[_0xc861('0x4f')]})[_0xc861('0x23')](function(_0xe2d7b0){_0x5ea04e[_0xc861('0x32')]=_0xe2d7b0;if(_0x5242ec[_0xc861('0x47')][_0xc861('0x55')]){_0x117694[_0xc861('0x56')]=[{'model':db[_0xc861('0x75')],'as':_0xc861('0xb7'),'required':![]},{'model':db[_0xc861('0xa3')],'as':_0xc861('0xb8'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xc861('0xb9')],'as':_0xc861('0xba'),'attributes':['id',_0xc861('0x3e'),_0xc861('0xbb')],'where':_0x5242ec[_0xc861('0x47')]['tag']?{'id':_0x5242ec[_0xc861('0x47')]['tag']}:undefined,'required':_0x5242ec[_0xc861('0x47')][_0xc861('0xbc')]?!![]:![]}];}return db[_0xc861('0x92')][_0xc861('0x58')](_0x117694);})[_0xc861('0x23')](function(_0x2183cc){_0x5ea04e[_0xc861('0x59')]=_0x2183cc;return _0x5ea04e;});}})[_0xc861('0x23')](respondWithFilteredResult(_0x48630d,_0x117694))[_0xc861('0x5a')](handleError(_0x48630d,null));};exports[_0xc861('0xbd')]=function(_0x31896b,_0x44f994,_0xb42cea){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x31896b[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x44f994,null))[_0xc861('0x23')](function(_0x34e87d){if(_0x34e87d){return _0x34e87d['addAgents'](_0x31896b[_0xc861('0x60')]['ids'],_[_0xc861('0xbe')](_0x31896b['body'],[_0xc861('0xbf'),'id'])||{})[_0xc861('0x95')](function(_0x4a6851){for(var _0x109218=0x0;_0x109218<_0x31896b['body']['ids'][_0xc861('0x5d')];_0x109218+=0x1){socket[_0xc861('0xc0')](_0xc861('0xc1'),{'UserId':Number(_0x31896b[_0xc861('0x60')][_0xc861('0xbf')][_0x109218]),'OpenchannelAccountId':Number(_0x31896b[_0xc861('0x66')]['id'])});}return _0x4a6851;});}})[_0xc861('0x23')](respondWithResult(_0x44f994,null))[_0xc861('0x5a')](handleError(_0x44f994,null));};exports[_0xc861('0xc2')]=function(_0x50be39,_0x285651,_0x3947e1){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x50be39[_0xc861('0x66')]['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x285651,null))[_0xc861('0x23')](function(_0x279e68){if(_0x279e68){return _0x279e68[_0xc861('0xc2')](_0x50be39[_0xc861('0x47')][_0xc861('0xbf')])[_0xc861('0x23')](function(){if(_[_0xc861('0xc3')](_0x50be39[_0xc861('0x47')][_0xc861('0xbf')])){for(var _0xa11a49=0x0;_0xa11a49<_0x50be39[_0xc861('0x47')][_0xc861('0xbf')][_0xc861('0x5d')];_0xa11a49+=0x1){socket[_0xc861('0xc0')](_0xc861('0xc4'),{'UserId':Number(_0x50be39['query'][_0xc861('0xbf')][_0xa11a49]),'OpenchannelAccountId':Number(_0x50be39[_0xc861('0x66')]['id'])});}}else{socket[_0xc861('0xc0')](_0xc861('0xc4'),{'UserId':Number(_0x50be39[_0xc861('0x47')][_0xc861('0xbf')]),'OpenchannelAccountId':Number(_0x50be39[_0xc861('0x66')]['id'])});}});}})[_0xc861('0x23')](respondWithStatusCode(_0x285651,null))[_0xc861('0x5a')](handleError(_0x285651,null));};exports[_0xc861('0xc5')]=function(_0x22dee0,_0x3833c0,_0xbbeedd){var _0xa13d89={};var _0x4e78c7={};var _0x15e02e;var _0x24e9c8;return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x22dee0['params']['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x3833c0,null))[_0xc861('0x23')](function(_0x1a8df2){if(_0x1a8df2){_0x15e02e=_0x1a8df2;_0x4e78c7[_0xc861('0x46')]=_[_0xc861('0x48')](db[_0xc861('0xa3')][_0xc861('0x42')]);_0x4e78c7[_0xc861('0x47')]=_[_0xc861('0x48')](_0x22dee0[_0xc861('0x47')]);_0x4e78c7[_0xc861('0x49')]=_[_0xc861('0x4a')](_0x4e78c7[_0xc861('0x46')],_0x4e78c7['query']);_0xa13d89[_0xc861('0x4c')]=_['intersection'](_0x4e78c7[_0xc861('0x46')],qs[_0xc861('0x4b')](_0x22dee0[_0xc861('0x47')]['fields']));_0xa13d89[_0xc861('0x4c')]=_0xa13d89['attributes'][_0xc861('0x5d')]?_0xa13d89['attributes']:_0x4e78c7[_0xc861('0x46')];_0xa13d89[_0xc861('0x4d')]=qs['sort'](_0x22dee0['query'][_0xc861('0x4e')]);_0xa13d89[_0xc861('0x4f')]=qs['filters'](_[_0xc861('0x50')](_0x22dee0[_0xc861('0x47')],_0x4e78c7[_0xc861('0x49')]));if(_0x22dee0[_0xc861('0x47')]['filter']){_0xa13d89[_0xc861('0x4f')]=_[_0xc861('0x52')](_0xa13d89[_0xc861('0x4f')],{'$or':_[_0xc861('0x41')](_0xa13d89[_0xc861('0x4c')],function(_0x513d34){var _0x5a1e11={};_0x5a1e11[_0x513d34]={'$like':'%'+_0x22dee0[_0xc861('0x47')][_0xc861('0x51')]+'%'};return _0x5a1e11;})});}_0xa13d89=_['merge']({},_0xa13d89,_0x22dee0[_0xc861('0x54')]);return _0x15e02e[_0xc861('0xc5')](_0xa13d89);}})[_0xc861('0x23')](function(_0x2ef9c3){if(_0x2ef9c3){_0x24e9c8=_0x2ef9c3['length'];if(!_0x22dee0[_0xc861('0x47')]['hasOwnProperty']('nolimit')){_0xa13d89[_0xc861('0x30')]=qs[_0xc861('0x30')](_0x22dee0[_0xc861('0x47')][_0xc861('0x30')]);_0xa13d89[_0xc861('0x2f')]=qs['offset'](_0x22dee0[_0xc861('0x47')]['offset']);}return _0x15e02e[_0xc861('0xc5')](_0xa13d89);}})[_0xc861('0x23')](function(_0x5cb569){if(_0x5cb569){return _0x5cb569?{'count':_0x24e9c8,'rows':_0x5cb569}:null;}})[_0xc861('0x23')](respondWithResult(_0x3833c0,null))[_0xc861('0x5a')](handleError(_0x3833c0,null));};exports[_0xc861('0xb4')]=function(_0x349171,_0x4afead,_0x11b1a0){var _0x553b43,_0x39a370,_0xb1125a;if(_['isNil'](_0x349171[_0xc861('0x60')][_0xc861('0x60')])||_0x349171[_0xc861('0x60')][_0xc861('0x60')]===''){throw new db['Sequelize'][(_0xc861('0x7e'))](_0xc861('0x80'));}if(_[_0xc861('0x7b')](_0x349171[_0xc861('0x60')]['to'])){}_0x553b43=_0x349171['body']['to'];return db[_0xc861('0x57')][_0xc861('0xb0')]({'where':{'id':_0x349171['params']['id']}})[_0xc861('0x23')](handleEntityNotFound(_0x4afead,null))[_0xc861('0x23')](function(_0x13cf60){if(_0x13cf60){return db[_0xc861('0x57')][_0xc861('0x5e')]({'where':{'id':_0x13cf60['id']},'include':[{'model':db[_0xc861('0x85')],'as':_0xc861('0x86'),'include':[{'model':db[_0xc861('0x75')],'as':'Contacts','where':{[_0x13cf60[_0xc861('0x81')]]:_0x553b43},'limit':0x1,'order':[['updatedAt',_0xc861('0x88')]]}]}]})['then'](handleEntityNotFound(_0x4afead,null))[_0xc861('0x23')](function(_0x1a7a5c){if(_0x1a7a5c&&_0x1a7a5c['List']){_0x39a370=_0x1a7a5c[_0xc861('0x39')]({'plain':!![]});if(_0x39a370[_0xc861('0x86')]&&_0x39a370[_0xc861('0x86')][_0xc861('0x87')][_0xc861('0x5d')]){return _0x39a370['List']['Contacts'][0x0];}return db[_0xc861('0x75')][_0xc861('0x5f')](_['defaults'](_0x349171['body'],{'firstName':_0x553b43,[_0x1a7a5c['mapKey']]:_0x553b43,'phone':_0x553b43,'ListId':_0x39a370[_0xc861('0x7a')]}));}})['then'](handleEntityNotFound(_0x4afead,null))[_0xc861('0x23')](function(_0x7e7bf0){if(_0x7e7bf0){_0xb1125a=_0x7e7bf0;return db['OpenchannelInteraction'][_0xc861('0x5e')]({'where':{'ContactId':_0xb1125a['id'],'closed':![],'OpenchannelAccountId':_0x39a370['id']}})[_0xc861('0x23')](function(_0x4f086f){if(_0x4f086f){return[_0x4f086f,![]];}return db[_0xc861('0x92')][_0xc861('0x5f')]({'UserId':_0x349171[_0xc861('0x61')]['id'],'ContactId':_0xb1125a['id'],'OpenchannelAccountId':_0x39a370['id'],'lastMsgDirection':_0xc861('0xc6'),'firstMsgDirection':_0xc861('0xc6'),'Messages':[_[_0xc861('0x52')](_0x349171[_0xc861('0x60')],{'read':![],'body':_0x349171[_0xc861('0x60')]['body'],'OpenchannelAccountId':_0x39a370['id'],'UserId':_0x349171['user']['id'],'ContactId':_0xb1125a['id']})]},{'include':[{'model':db[_0xc861('0xa0')],'as':_0xc861('0xc7')}]})[_0xc861('0x23')](function(_0x35c853){return[_0x35c853,!![]];});});}})['spread'](function(_0x2b9d9d,_0x3ca740){if(_0x3ca740){return _0x2b9d9d;}return db[_0xc861('0xa0')]['create'](_[_0xc861('0x52')](_0x349171[_0xc861('0x60')],{'read':![],'body':_0x349171[_0xc861('0x60')][_0xc861('0x60')],'OpenchannelAccountId':_0x39a370['id'],'OpenchannelInteractionId':_0x2b9d9d['id'],'UserId':_0x349171[_0xc861('0x61')]['id'],'ContactId':_0xb1125a['id']}))['then'](function(_0x17104d){_0x2b9d9d[_0xc861('0xc8')][_0xc861('0xc7')]=[];_0x2b9d9d[_0xc861('0xc8')][_0xc861('0xc7')][_0xc861('0xc9')](_0x17104d[_0xc861('0xc8')]);return _0x2b9d9d;});});}})[_0xc861('0x23')](respondWithResult(_0x4afead,null))[_0xc861('0x5a')](handleError(_0x4afead,null));}; \ No newline at end of file +var _0x4711=['Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','CmContact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','notify','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','Contact','Owner','internal','Tag','color','tag','rows','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','spread','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','redis','defaults','localhost','./openchannelAccount.socket','register','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','UserProfileResource','destroy','stack','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','name','options','includeAll','include','findAll','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','openchannel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4711,0x10c));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1471('0x0'));var rimraf=require(_0x1471('0x1'));var zipdir=require(_0x1471('0x2'));var jsonpatch=require(_0x1471('0x3'));var rp=require(_0x1471('0x4'));var moment=require(_0x1471('0x5'));var BPromise=require(_0x1471('0x6'));var Mustache=require('mustache');var util=require(_0x1471('0x7'));var path=require('path');var sox=require(_0x1471('0x8'));var csv=require(_0x1471('0x9'));var ejs=require(_0x1471('0xa'));var fs=require('fs');var fs_extra=require(_0x1471('0xb'));var _=require(_0x1471('0xc'));var squel=require('squel');var crypto=require(_0x1471('0xd'));var jsforce=require(_0x1471('0xe'));var deskjs=require(_0x1471('0xf'));var toCsv=require(_0x1471('0x9'));var querystring=require(_0x1471('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1471('0x11'));var qs=require(_0x1471('0x12'));var as=require(_0x1471('0x13'));var hardwareService=require(_0x1471('0x14'));var logger=require(_0x1471('0x15'))(_0x1471('0x16'));var utils=require(_0x1471('0x17'));var config=require(_0x1471('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1471('0x19'))['db'];config[_0x1471('0x1a')]=_[_0x1471('0x1b')](config[_0x1471('0x1a')],{'host':_0x1471('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1471('0x1a')]));require(_0x1471('0x1d'))[_0x1471('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1471('0x1f')][_0x1471('0x20')]({'port':0x232c});var client9002=jayson[_0x1471('0x1f')][_0x1471('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3c1132,_0x254f2c,_0x33a6fc,_0x594cf2){return new BPromise(function(_0x11ea35,_0x2a321b){var _0x13479e=_0x594cf2||client;return _0x13479e['request'](_0x3c1132,_0x33a6fc)[_0x1471('0x21')](function(_0x19d1ed){logger[_0x1471('0x22')](_0x1471('0x23'),_0x254f2c,_0x1471('0x24'));logger[_0x1471('0x25')](_0x1471('0x26'),_0x254f2c,_0x1471('0x24'),JSON['stringify'](_0x19d1ed));if(_0x19d1ed[_0x1471('0x27')]){if(_0x19d1ed[_0x1471('0x27')][_0x1471('0x28')]===0x1f4){logger[_0x1471('0x27')](_0x1471('0x23'),_0x254f2c,_0x19d1ed[_0x1471('0x27')][_0x1471('0x29')]);return _0x2a321b(_0x19d1ed[_0x1471('0x27')][_0x1471('0x29')]);}logger[_0x1471('0x27')](_0x1471('0x23'),_0x254f2c,_0x19d1ed[_0x1471('0x27')][_0x1471('0x29')]);return _0x11ea35(_0x19d1ed[_0x1471('0x27')]['message']);}else{logger[_0x1471('0x22')](_0x1471('0x23'),_0x254f2c,'request\x20sent');_0x11ea35(_0x19d1ed[_0x1471('0x2a')][_0x1471('0x29')]);}})[_0x1471('0x2b')](function(_0x27cc4a){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x254f2c,_0x27cc4a);_0x2a321b(_0x27cc4a);});});}function respondWithStatusCode(_0x1afe54,_0x1abe58){_0x1abe58=_0x1abe58||0xcc;return function(_0x2a081e){if(_0x2a081e){return _0x1afe54[_0x1471('0x2c')](_0x1abe58);}return _0x1afe54[_0x1471('0x2d')](_0x1abe58)[_0x1471('0x2e')]();};}function respondWithResult(_0x52bb10,_0x44b7a1){_0x44b7a1=_0x44b7a1||0xc8;return function(_0x5158b2){if(_0x5158b2){return _0x52bb10[_0x1471('0x2d')](_0x44b7a1)[_0x1471('0x2f')](_0x5158b2);}};}function respondWithFilteredResult(_0x372d04,_0x4b8084){return function(_0x4bde40){if(_0x4bde40){var _0x2ebcf0=typeof _0x4b8084['offset']==='undefined'&&typeof _0x4b8084[_0x1471('0x30')]===_0x1471('0x31');var _0x1fa8dd=_0x4bde40[_0x1471('0x32')];var _0x450e90=_0x2ebcf0?0x0:_0x4b8084[_0x1471('0x33')];var _0x49ac80=_0x2ebcf0?_0x4bde40[_0x1471('0x32')]:_0x4b8084[_0x1471('0x33')]+_0x4b8084[_0x1471('0x30')];var _0x1e0c8a;if(_0x49ac80>=_0x1fa8dd){_0x49ac80=_0x1fa8dd;_0x1e0c8a=0xc8;}else{_0x1e0c8a=0xce;}_0x372d04[_0x1471('0x2d')](_0x1e0c8a);return _0x372d04[_0x1471('0x34')]('Content-Range',_0x450e90+'-'+_0x49ac80+'/'+_0x1fa8dd)[_0x1471('0x2f')](_0x4bde40);}return null;};}function patchUpdates(_0x44ea25){return function(_0x3e4f8c){try{jsonpatch[_0x1471('0x35')](_0x3e4f8c,_0x44ea25,!![]);}catch(_0x74647f){return BPromise['reject'](_0x74647f);}return _0x3e4f8c[_0x1471('0x36')]();};}function saveUpdates(_0x30825b,_0x50d5ac){return function(_0x2cd8b5){if(_0x2cd8b5){return _0x2cd8b5[_0x1471('0x37')](_0x30825b)[_0x1471('0x21')](function(_0xd2d7c9){return _0xd2d7c9;});}return null;};}function removeEntity(_0x1898c3,_0x223413){return function(_0x18334d){if(_0x18334d){return _0x18334d['destroy']()[_0x1471('0x21')](function(){var _0x1ee9d1=_0x18334d['get']({'plain':!![]});var _0x45fe12='OpenchannelAccounts';return db[_0x1471('0x38')][_0x1471('0x39')]({'where':{'type':_0x45fe12,'resourceId':_0x1ee9d1['id']}})[_0x1471('0x21')](function(){return _0x18334d;});})[_0x1471('0x21')](function(){_0x1898c3['status'](0xcc)[_0x1471('0x2e')]();});}};}function handleEntityNotFound(_0x53401f,_0x1e7965){return function(_0x510b39){if(!_0x510b39){_0x53401f[_0x1471('0x2c')](0x194);}return _0x510b39;};}function handleError(_0x4c4394,_0x3d2595){_0x3d2595=_0x3d2595||0x1f4;return function(_0x3835db){logger[_0x1471('0x27')](_0x3835db[_0x1471('0x3a')]);if(_0x3835db['name']){delete _0x3835db['name'];}_0x4c4394[_0x1471('0x2d')](_0x3d2595)[_0x1471('0x3b')](_0x3835db);};}exports[_0x1471('0x3c')]=function(_0x318f4b,_0x78d154){var _0x52f203={'include':[{'model':db[_0x1471('0x3d')],'as':_0x1471('0x3e')}]},_0x19be2c={},_0x448527={'count':0x0,'rows':[]};var _0x4bee0b=_[_0x1471('0x3f')](db[_0x1471('0x40')][_0x1471('0x41')],function(_0x24269d){return{'name':_0x24269d['fieldName'],'type':_0x24269d['type'][_0x1471('0x42')]};});_0x19be2c[_0x1471('0x43')]=_[_0x1471('0x3f')](_0x4bee0b,'name');_0x19be2c[_0x1471('0x44')]=_[_0x1471('0x45')](_0x318f4b[_0x1471('0x44')]);_0x19be2c[_0x1471('0x46')]=_['intersection'](_0x19be2c[_0x1471('0x43')],_0x19be2c['query']);_0x52f203[_0x1471('0x47')]=_[_0x1471('0x48')](_0x19be2c[_0x1471('0x43')],qs[_0x1471('0x49')](_0x318f4b[_0x1471('0x44')][_0x1471('0x49')]));_0x52f203[_0x1471('0x47')]=_0x52f203['attributes']['length']?_0x52f203['attributes']:_0x19be2c['model'];if(!_0x318f4b[_0x1471('0x44')]['hasOwnProperty'](_0x1471('0x4a'))){_0x52f203['limit']=qs[_0x1471('0x30')](_0x318f4b[_0x1471('0x44')]['limit']);_0x52f203[_0x1471('0x33')]=qs[_0x1471('0x33')](_0x318f4b[_0x1471('0x44')][_0x1471('0x33')]);}_0x52f203[_0x1471('0x4b')]=qs[_0x1471('0x4c')](_0x318f4b[_0x1471('0x44')][_0x1471('0x4c')]);_0x52f203['where']=qs['filters'](_[_0x1471('0x4d')](_0x318f4b[_0x1471('0x44')],_0x19be2c[_0x1471('0x46')]),_0x4bee0b);if(_0x318f4b[_0x1471('0x44')][_0x1471('0x4e')]){_0x52f203[_0x1471('0x4f')]=_[_0x1471('0x50')](_0x52f203[_0x1471('0x4f')],{'$or':_[_0x1471('0x3f')](_0x4bee0b,function(_0x3f1112){if(_0x3f1112[_0x1471('0x51')]!==_0x1471('0x52')){var _0x33b938={};_0x33b938[_0x3f1112[_0x1471('0x53')]]={'$like':'%'+_0x318f4b[_0x1471('0x44')][_0x1471('0x4e')]+'%'};return _0x33b938;}})});}_0x52f203=_['merge']({},_0x52f203,_0x318f4b[_0x1471('0x54')]);var _0x2449ed={'where':_0x52f203[_0x1471('0x4f')]};return db[_0x1471('0x40')][_0x1471('0x32')](_0x2449ed)['then'](function(_0x39ed64){_0x448527[_0x1471('0x32')]=_0x39ed64;if(_0x318f4b[_0x1471('0x44')][_0x1471('0x55')]){_0x52f203[_0x1471('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x1471('0x57')](_0x52f203);})[_0x1471('0x21')](function(_0x32e4f3){_0x448527['rows']=_0x32e4f3;return _0x448527;})[_0x1471('0x21')](respondWithFilteredResult(_0x78d154,_0x52f203))[_0x1471('0x2b')](handleError(_0x78d154,null));};exports['show']=function(_0x2eb2c8,_0x2571f2){var _0x2047e9={'raw':![],'where':{'id':_0x2eb2c8['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1a8769={};_0x1a8769[_0x1471('0x43')]=_[_0x1471('0x45')](db[_0x1471('0x40')][_0x1471('0x41')]);_0x1a8769[_0x1471('0x44')]=_[_0x1471('0x45')](_0x2eb2c8['query']);_0x1a8769[_0x1471('0x46')]=_['intersection'](_0x1a8769[_0x1471('0x43')],_0x1a8769[_0x1471('0x44')]);_0x2047e9[_0x1471('0x47')]=_[_0x1471('0x48')](_0x1a8769[_0x1471('0x43')],qs['fields'](_0x2eb2c8[_0x1471('0x44')][_0x1471('0x49')]));_0x2047e9['attributes']=_0x2047e9[_0x1471('0x47')][_0x1471('0x58')]?_0x2047e9['attributes']:_0x1a8769[_0x1471('0x43')];if(_0x2eb2c8[_0x1471('0x44')][_0x1471('0x55')]){_0x2047e9[_0x1471('0x56')]=[{'all':!![]}];}_0x2047e9=_[_0x1471('0x50')]({},_0x2047e9,_0x2eb2c8[_0x1471('0x54')]);return db['OpenchannelAccount'][_0x1471('0x59')](_0x2047e9)['then'](handleEntityNotFound(_0x2571f2,null))['then'](respondWithResult(_0x2571f2,null))[_0x1471('0x2b')](handleError(_0x2571f2,null));};exports['create']=function(_0x15621f,_0x1eb7ce){return db[_0x1471('0x40')][_0x1471('0x5a')](_0x15621f[_0x1471('0x5b')],{})[_0x1471('0x21')](function(_0x35a431){var _0x29c3af=_0x15621f[_0x1471('0x5c')][_0x1471('0x5d')]({'plain':!![]});if(!_0x29c3af)throw new Error(_0x1471('0x5e'));if(_0x29c3af['role']===_0x1471('0x5c')){var _0x20bde5=_0x35a431[_0x1471('0x5d')]({'plain':!![]});var _0x3c93f5='OpenchannelAccounts';return db[_0x1471('0x5f')][_0x1471('0x59')]({'where':{'name':_0x3c93f5,'userProfileId':_0x29c3af[_0x1471('0x60')]},'raw':!![]})[_0x1471('0x21')](function(_0x5aa239){if(_0x5aa239&&_0x5aa239['autoAssociation']===0x0){return db['UserProfileResource'][_0x1471('0x5a')]({'name':_0x20bde5['name'],'resourceId':_0x20bde5['id'],'type':_0x5aa239['name'],'sectionId':_0x5aa239['id']},{})[_0x1471('0x21')](function(){return _0x35a431;});}else{return _0x35a431;}})[_0x1471('0x2b')](function(_0xdad242){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdad242);throw _0xdad242;});}return _0x35a431;})[_0x1471('0x21')](respondWithResult(_0x1eb7ce,0xc9))[_0x1471('0x2b')](handleError(_0x1eb7ce,null));};exports['update']=function(_0x3f5da2,_0x305bc9){if(_0x3f5da2[_0x1471('0x5b')]['id']){delete _0x3f5da2[_0x1471('0x5b')]['id'];}return db[_0x1471('0x40')]['find']({'where':{'id':_0x3f5da2[_0x1471('0x61')]['id']},'include':[{'model':db[_0x1471('0x3d')],'as':_0x1471('0x3e')}]})[_0x1471('0x21')](handleEntityNotFound(_0x305bc9,null))[_0x1471('0x21')](saveUpdates(_0x3f5da2[_0x1471('0x5b')],null))[_0x1471('0x21')](respondWithResult(_0x305bc9,null))[_0x1471('0x2b')](handleError(_0x305bc9,null));};exports[_0x1471('0x39')]=function(_0x51a052,_0x4a9c01){return db[_0x1471('0x40')][_0x1471('0x59')]({'where':{'id':_0x51a052[_0x1471('0x61')]['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x4a9c01,null))[_0x1471('0x21')](removeEntity(_0x4a9c01,null))[_0x1471('0x2b')](handleError(_0x4a9c01,null));};exports['describe']=function(_0x488171,_0x2d1123){return db[_0x1471('0x40')][_0x1471('0x62')]()['then'](respondWithResult(_0x2d1123,null))[_0x1471('0x2b')](handleError(_0x2d1123,null));};exports[_0x1471('0x63')]=function(_0x42af88,_0x258033,_0x47983e){if(_0x42af88['body']['id']){delete _0x42af88[_0x1471('0x5b')]['id'];}return db[_0x1471('0x40')][_0x1471('0x59')]({'where':{'id':_0x42af88[_0x1471('0x61')]['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x258033,null))[_0x1471('0x21')](function(_0x3e4db8){if(_0x3e4db8){_0x42af88[_0x1471('0x5b')][_0x1471('0x64')]=_0x3e4db8['id'];return db[_0x1471('0x65')][_0x1471('0x5a')](_0x42af88[_0x1471('0x5b')]);}})[_0x1471('0x21')](respondWithResult(_0x258033,null))[_0x1471('0x2b')](handleError(_0x258033,null));};exports[_0x1471('0x66')]=function(_0x1c7ee7,_0x4e05b2,_0x55b438){var _0x2a10fb={'raw':![],'where':{}};var _0x10403c={};var _0x5c4ebc={'count':0x0,'rows':[]};return db[_0x1471('0x40')][_0x1471('0x67')]({'where':{'id':_0x1c7ee7[_0x1471('0x61')]['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x4e05b2,null))[_0x1471('0x21')](function(_0x309c08){if(_0x309c08){_0x10403c[_0x1471('0x43')]=_[_0x1471('0x45')](db[_0x1471('0x65')]['rawAttributes']);_0x10403c[_0x1471('0x44')]=_['keys'](_0x1c7ee7[_0x1471('0x44')]);_0x10403c[_0x1471('0x46')]=_[_0x1471('0x48')](_0x10403c[_0x1471('0x43')],_0x10403c[_0x1471('0x44')]);_0x2a10fb['attributes']=_[_0x1471('0x48')](_0x10403c['model'],qs[_0x1471('0x49')](_0x1c7ee7['query']['fields']));_0x2a10fb[_0x1471('0x47')]=_0x2a10fb[_0x1471('0x47')][_0x1471('0x58')]?_0x2a10fb['attributes']:_0x10403c[_0x1471('0x43')];if(!_0x1c7ee7[_0x1471('0x44')][_0x1471('0x68')](_0x1471('0x4a'))){_0x2a10fb['limit']=qs['limit'](_0x1c7ee7[_0x1471('0x44')]['limit']);_0x2a10fb[_0x1471('0x33')]=qs[_0x1471('0x33')](_0x1c7ee7[_0x1471('0x44')][_0x1471('0x33')]);}_0x2a10fb[_0x1471('0x4b')]=qs['sort'](_0x1c7ee7[_0x1471('0x44')]['sort']);_0x2a10fb[_0x1471('0x4f')]=qs[_0x1471('0x46')](_['pick'](_0x1c7ee7[_0x1471('0x44')],_0x10403c[_0x1471('0x46')]));_0x2a10fb[_0x1471('0x4f')]['OpenchannelAccountId']=_0x309c08['id'];if(_0x1c7ee7[_0x1471('0x44')][_0x1471('0x4e')]){_0x2a10fb[_0x1471('0x4f')]=_[_0x1471('0x50')](_0x2a10fb[_0x1471('0x4f')],{'$or':_[_0x1471('0x3f')](_0x2a10fb[_0x1471('0x47')],function(_0x1a0d9a){var _0x17a223={};_0x17a223[_0x1a0d9a]={'$like':'%'+_0x1c7ee7['query'][_0x1471('0x4e')]+'%'};return _0x17a223;})});}_0x2a10fb=_[_0x1471('0x50')]({},_0x2a10fb,_0x1c7ee7['options']);return db[_0x1471('0x65')]['count']({'where':_0x2a10fb['where']})[_0x1471('0x21')](function(_0x52f4ae){_0x5c4ebc[_0x1471('0x32')]=_0x52f4ae;if(_0x1c7ee7[_0x1471('0x44')]['includeAll']){_0x2a10fb[_0x1471('0x56')]=[{'all':!![]}];}return db[_0x1471('0x65')][_0x1471('0x57')](_0x2a10fb);})['then'](function(_0x1b5538){_0x5c4ebc['rows']=_0x1b5538;return _0x5c4ebc;});}})[_0x1471('0x21')](respondWithFilteredResult(_0x4e05b2,_0x2a10fb))[_0x1471('0x2b')](handleError(_0x4e05b2,null));};exports[_0x1471('0x69')]=function(_0x369916,_0x1bc221,_0x49061d){return db[_0x1471('0x40')]['find']({'where':{'id':_0x369916['params']['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x1bc221,null))[_0x1471('0x21')](function(_0x2bce85){if(_0x2bce85){return _0x2bce85[_0x1471('0x69')](_0x369916[_0x1471('0x44')]['ids']);}})[_0x1471('0x21')](respondWithStatusCode(_0x1bc221,null))[_0x1471('0x2b')](handleError(_0x1bc221,null));};exports[_0x1471('0x6a')]=function(_0x55c4ad,_0x4ed392,_0x3635a4){if(_0x55c4ad[_0x1471('0x5b')]['id']){delete _0x55c4ad['body']['id'];}return db[_0x1471('0x40')][_0x1471('0x59')]({'where':{'id':_0x55c4ad[_0x1471('0x61')]['id']}})['then'](handleEntityNotFound(_0x4ed392,null))[_0x1471('0x21')](function(_0x4eb909){if(_0x4eb909){_0x55c4ad['body']['OpenchannelAccountId']=_0x4eb909['id'];return db[_0x1471('0x6b')][_0x1471('0x5a')](_0x55c4ad[_0x1471('0x5b')]);}})['then'](respondWithResult(_0x4ed392,null))['catch'](handleError(_0x4ed392,null));};exports[_0x1471('0x6c')]=function(_0x158ffa,_0x536425,_0x540b71){var _0x5bafda={'raw':![],'where':{}};var _0x351281={};var _0xbabfb6={'count':0x0,'rows':[]};return db[_0x1471('0x40')][_0x1471('0x67')]({'where':{'id':_0x158ffa[_0x1471('0x61')]['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x536425,null))[_0x1471('0x21')](function(_0x36f32a){if(_0x36f32a){_0x351281['model']=_[_0x1471('0x45')](db[_0x1471('0x6b')]['rawAttributes']);_0x351281[_0x1471('0x44')]=_[_0x1471('0x45')](_0x158ffa[_0x1471('0x44')]);_0x351281[_0x1471('0x46')]=_[_0x1471('0x48')](_0x351281[_0x1471('0x43')],_0x351281[_0x1471('0x44')]);_0x5bafda[_0x1471('0x47')]=_[_0x1471('0x48')](_0x351281[_0x1471('0x43')],qs[_0x1471('0x49')](_0x158ffa['query']['fields']));_0x5bafda[_0x1471('0x47')]=_0x5bafda['attributes'][_0x1471('0x58')]?_0x5bafda[_0x1471('0x47')]:_0x351281[_0x1471('0x43')];if(!_0x158ffa['query'][_0x1471('0x68')](_0x1471('0x4a'))){_0x5bafda[_0x1471('0x30')]=qs['limit'](_0x158ffa[_0x1471('0x44')][_0x1471('0x30')]);_0x5bafda['offset']=qs[_0x1471('0x33')](_0x158ffa[_0x1471('0x44')][_0x1471('0x33')]);}_0x5bafda['order']=qs[_0x1471('0x4c')](_0x158ffa[_0x1471('0x44')][_0x1471('0x4c')]);_0x5bafda[_0x1471('0x4f')]=qs[_0x1471('0x46')](_['pick'](_0x158ffa[_0x1471('0x44')],_0x351281[_0x1471('0x46')]));_0x5bafda[_0x1471('0x4f')]['OpenchannelAccountId']=_0x36f32a['id'];if(_0x158ffa[_0x1471('0x44')][_0x1471('0x4e')]){_0x5bafda[_0x1471('0x4f')]=_[_0x1471('0x50')](_0x5bafda[_0x1471('0x4f')],{'$or':_[_0x1471('0x3f')](_0x5bafda['attributes'],function(_0x58261e){var _0x7769ba={};_0x7769ba[_0x58261e]={'$like':'%'+_0x158ffa['query']['filter']+'%'};return _0x7769ba;})});}_0x5bafda=_['merge']({},_0x5bafda,_0x158ffa[_0x1471('0x54')]);return db[_0x1471('0x6b')][_0x1471('0x32')]({'where':_0x5bafda[_0x1471('0x4f')]})[_0x1471('0x21')](function(_0x2de40e){_0xbabfb6[_0x1471('0x32')]=_0x2de40e;if(_0x158ffa[_0x1471('0x44')]['includeAll']){_0x5bafda['include']=[{'all':!![]}];}return db[_0x1471('0x6b')][_0x1471('0x57')](_0x5bafda);})[_0x1471('0x21')](function(_0x3d055e){_0xbabfb6['rows']=_0x3d055e;return _0xbabfb6;});}})[_0x1471('0x21')](respondWithFilteredResult(_0x536425,_0x5bafda))[_0x1471('0x2b')](handleError(_0x536425,null));};exports['removeAnswers']=function(_0x1bbadc,_0x191f62,_0x27842d){return db[_0x1471('0x40')][_0x1471('0x59')]({'where':{'id':_0x1bbadc[_0x1471('0x61')]['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x191f62,null))['then'](function(_0x3a4c30){if(_0x3a4c30){return _0x3a4c30[_0x1471('0x6d')](_0x1bbadc[_0x1471('0x44')][_0x1471('0x6e')]);}})[_0x1471('0x21')](respondWithStatusCode(_0x191f62,null))[_0x1471('0x2b')](handleError(_0x191f62,null));};exports['notify']=function(_0x245126,_0x1581f7,_0xdf0d25){var _0x2394bd={'body':_0x245126[_0x1471('0x5b')],'channel':_0x1471('0x6f')};var _0x410c84=[];var _0x4017c5=[];var _0x38f79d={};var _0x2504ef=![];return db['CmContact'][_0x1471('0x62')]()['then'](function(_0x21699){if(!_0x21699){throw new db[(_0x1471('0x70'))][(_0x1471('0x71'))](_0x1471('0x72'));}_0x410c84=_[_0x1471('0x73')](_[_0x1471('0x45')](_0x21699),[_0x1471('0x74'),_0x1471('0x75')]);_0x4017c5=_[_0x1471('0x73')](_[_0x1471('0x45')](_0x21699),[_0x1471('0x74'),_0x1471('0x75'),_0x1471('0x76'),_0x1471('0x77')]);if(_0x245126[_0x1471('0x5b')]['id']){delete _0x245126[_0x1471('0x5b')]['id'];}if(_[_0x1471('0x78')](_0x245126[_0x1471('0x5b')][_0x1471('0x79')])){throw new db[(_0x1471('0x70'))][(_0x1471('0x71'))](_0x1471('0x7a'));}if(_['isNil'](_0x245126['body'][_0x1471('0x5b')])||_0x245126[_0x1471('0x5b')][_0x1471('0x5b')]===''){throw new db[(_0x1471('0x70'))][(_0x1471('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1471('0x78')](_0x245126[_0x1471('0x5b')][_0x1471('0x7b')])){throw new db[(_0x1471('0x70'))][(_0x1471('0x71'))](_0x1471('0x7c')+_0x4017c5);}if(!_[_0x1471('0x7d')](_0x4017c5,_0x245126[_0x1471('0x5b')]['mapKey'])){throw new db[(_0x1471('0x70'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4017c5);}_0x38f79d[_0x245126[_0x1471('0x5b')][_0x1471('0x7b')]]=_0x245126['body'][_0x1471('0x79')];})[_0x1471('0x21')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x245126['params']['id']},'include':[{'model':db[_0x1471('0x7e')],'as':_0x1471('0x7f'),'include':[{'model':db['CmContact'],'as':_0x1471('0x80'),'where':_0x38f79d,'limit':0x1,'order':[[_0x1471('0x75'),_0x1471('0x81')]]}]},{'model':db[_0x1471('0x82')],'as':_0x1471('0x83')}]});})['then'](handleEntityNotFound(_0x1581f7,null))[_0x1471('0x21')](function(_0x29c883){if(_0x29c883&&_0x29c883[_0x1471('0x7f')]){_0x2394bd[_0x1471('0x84')]=_0x29c883;_0x2394bd['applications']=_0x29c883[_0x1471('0x83')];_0x2394bd['list']=_0x29c883['List'];_0x2394bd[_0x1471('0x85')]=_[_0x1471('0x86')](_0x2394bd['applications'],[_0x1471('0x87')],[_0x1471('0x88')]);if(_0x2394bd[_0x1471('0x84')]['Applications']){delete _0x2394bd[_0x1471('0x84')][_0x1471('0x83')];}if(_0x2394bd['account'][_0x1471('0x7f')]&&_0x2394bd['account'][_0x1471('0x7f')]['Contacts'][_0x1471('0x58')]){return _0x2394bd[_0x1471('0x84')][_0x1471('0x7f')][_0x1471('0x80')][0x0];}var _0x4681ac=_[_0x1471('0x1b')](_0x245126[_0x1471('0x5b')],{'firstName':_0x245126[_0x1471('0x5b')][_0x1471('0x79')],'ListId':_0x29c883[_0x1471('0x77')]});_0x4681ac[_0x245126[_0x1471('0x5b')][_0x1471('0x7b')]]=_0x245126[_0x1471('0x5b')][_0x1471('0x79')];return db[_0x1471('0x89')][_0x1471('0x5a')](_0x4681ac,{'fields':_0x410c84,'raw':!![]});}})['then'](handleEntityNotFound(_0x1581f7,null))['then'](function(_0x238c7f){_0x2394bd['contact']=_0x238c7f;if(_0x238c7f){var _0x5eec66={'ContactId':_0x238c7f['id'],'OpenchannelAccountId':_0x245126[_0x1471('0x61')]['id'],'from':(_0x238c7f['firstName']||'')+'\x20'+(_0x238c7f[_0x1471('0x8a')]||'')};var _0x4d9b59={'OpenchannelAccountId':_0x245126[_0x1471('0x61')]['id'],'closed':![]};if(_0x245126[_0x1471('0x5b')][_0x1471('0x8b')]){_0x4d9b59['threadId']=_0x245126[_0x1471('0x5b')][_0x1471('0x8b')];return db[_0x1471('0x8c')][_0x1471('0x59')]({'where':_0x4d9b59})[_0x1471('0x21')](function(_0x416594){if(_0x416594){return[_0x416594,![]];}_0x5eec66['threadId']=_0x245126[_0x1471('0x5b')]['threadId'];_0x5eec66[_0x1471('0x8d')]=_0x245126[_0x1471('0x5b')]['externalUrl'];return db[_0x1471('0x8c')][_0x1471('0x5a')](_0x5eec66)[_0x1471('0x21')](function(_0xbc20bc){return[_0xbc20bc,!![]];});});}else{_0x4d9b59[_0x1471('0x8b')]=null;}_0x4d9b59[_0x1471('0x8e')]=_0x238c7f['id'];return db['OpenchannelInteraction'][_0x1471('0x59')]({'where':_0x4d9b59})[_0x1471('0x21')](function(_0x480874){if(_0x480874){return[_0x480874,![]];}return db[_0x1471('0x8c')][_0x1471('0x5a')](_0x5eec66)[_0x1471('0x21')](function(_0x2fe52a){return[_0x2fe52a,!![]];});});}})['spread'](function(_0x5c54aa,_0x28150e){if(_0x5c54aa){_0x2504ef=_0x28150e;if(!_0x28150e){var _0x562429={'from':(_0x2394bd['contact'][_0x1471('0x8f')]||'')+'\x20'+(_0x2394bd[_0x1471('0x90')][_0x1471('0x8a')]||'')};if(_0x245126['body'][_0x1471('0x8b')]&&_0x245126[_0x1471('0x5b')][_0x1471('0x91')]&&_0x245126[_0x1471('0x5b')][_0x1471('0x8b')]!=_0x245126[_0x1471('0x5b')][_0x1471('0x91')]){_0x562429['threadId']=_0x245126[_0x1471('0x5b')][_0x1471('0x91')];}return _0x5c54aa['update'](_0x562429);}else{return _0x5c54aa;}}})[_0x1471('0x21')](function(_0x50e7f9){_0x2394bd[_0x1471('0x92')]=_0x50e7f9['get']({'plain':!![]});_0x2394bd[_0x1471('0x92')][_0x1471('0x93')]=_0x2504ef;if(_0x2394bd[_0x1471('0x92')][_0x1471('0x93')]){if(_0x2394bd['account'][_0x1471('0x94')]){_0x2394bd['applications'][_0x1471('0x95')]({'id':0x0,'priority':_0x2394bd[_0x1471('0x85')][_0x1471('0x58')]+0x1,'app':_0x1471('0x96'),'appdata':_0x1471('0x97'),'interval':_0x1471('0x98')});}}return db[_0x1471('0x99')][_0x1471('0x5a')]({'body':_0x245126[_0x1471('0x5b')][_0x1471('0x5b')],'OpenchannelAccountId':_0x245126[_0x1471('0x61')]['id'],'OpenchannelInteractionId':_0x50e7f9['id'],'direction':'in','ContactId':_0x2394bd[_0x1471('0x90')]['id'],'AttachmentId':_0x245126[_0x1471('0x5b')][_0x1471('0x9a')]});})['then'](function(_0xcc3c90){_0x2394bd[_0x1471('0x29')]=_0xcc3c90;if(_0x2394bd[_0x1471('0x92')][_0x1471('0x9b')]){return db[_0x1471('0x9c')][_0x1471('0x59')]({'attributes':['id','name'],'where':{'id':_0x2394bd[_0x1471('0x92')][_0x1471('0x9b')]}})[_0x1471('0x21')](function(_0xe69b8d){if(_0xe69b8d){_0x2394bd[_0x1471('0x85')][_0x1471('0x9d')]({'id':0x0,'priority':0x0,'app':_0x1471('0x9e'),'appdata':_0xe69b8d[_0x1471('0x53')]+','+(_0x2394bd[_0x1471('0x84')][_0x1471('0x9f')]||0xa),'interval':_0x1471('0x98')});_0x2394bd['forcedOwnership']=![];}return respondWithRpcPromise(_0x1471('0xa0'),_0x1471('0xa1'),_0x2394bd);});}return respondWithRpcPromise(_0x1471('0xa0'),'startRouting',_0x2394bd);})['then'](function(_0x3f378b){respondWithRpcPromise(_0x1471('0xa2'),_0x1471('0xa2'),{'event':_0x1471('0xa3'),'message':_0x3f378b},client9002);return _0x3f378b;})[_0x1471('0x21')](respondWithResult(_0x1581f7,null))[_0x1471('0x2b')](handleError(_0x1581f7,null));};exports[_0x1471('0xa4')]=function(_0xe56fd4,_0x12fbfb){var _0x3e6f40=_0xe56fd4[_0x1471('0x61')]['id'];var _0x1b3bdc=_0xe56fd4['body'];var _0x866e3d=0xc8;var _0x4faa8f=null;return db['sequelize'][_0x1471('0xa5')]({'isolationLevel':db['sequelize']['Transaction'][_0x1471('0xa6')][_0x1471('0xa7')]},function(_0x13e016){return db[_0x1471('0x40')][_0x1471('0x67')]({'where':{'id':_0x3e6f40},'transaction':_0x13e016})['then'](function(_0x5a5b72){if(_0x5a5b72){return db[_0x1471('0x82')][_0x1471('0x39')]({'where':{'OpenchannelAccountId':_0x3e6f40},'transaction':_0x13e016})['then'](function(){var _0x34d28e=_[_0x1471('0x3f')](_0x1b3bdc,function(_0x5a091d){_0x5a091d[_0x1471('0x64')]=_0x3e6f40;return _0x5a091d;});return db['OpenchannelApplication'][_0x1471('0xa8')](_0x34d28e,{'transaction':_0x13e016});});}else{_0x866e3d=0x194;_0x4faa8f=[];}});})[_0x1471('0x21')](function(){if(_0x866e3d!==0x194){return db['OpenchannelApplication'][_0x1471('0xa9')]({'where':{'OpenchannelAccountId':_0x3e6f40},'order':'priority'})[_0x1471('0x21')](function(_0x44cd1a){_0x4faa8f=_0x44cd1a;});}})['catch'](function(_0x4116c6){_0x866e3d=0x1f4;logger[_0x1471('0x27')](_0x4116c6[_0x1471('0x3a')]);if(_0x4116c6[_0x1471('0x53')]){delete _0x4116c6['name'];}_0x4faa8f=_0x4116c6;})['finally'](function(){if(_0x4faa8f===null){_0x12fbfb[_0x1471('0x2c')](_0x866e3d);}else{if(_0x866e3d===0x1f4){_0x12fbfb[_0x1471('0x2d')](_0x866e3d)[_0x1471('0x3b')](_0x4faa8f);}else{_0x12fbfb[_0x1471('0x2d')](_0x866e3d)[_0x1471('0x2f')](_0x4faa8f);}}});};exports[_0x1471('0xaa')]=function(_0x2c2688,_0x41b8ac,_0xf5267e){var _0x14fa11={};var _0x5d1b2f={};var _0x25d727;var _0x664955;return db['OpenchannelAccount'][_0x1471('0x67')]({'where':{'id':_0x2c2688[_0x1471('0x61')]['id']}})['then'](handleEntityNotFound(_0x41b8ac,null))[_0x1471('0x21')](function(_0x3d0461){if(_0x3d0461){_0x25d727=_0x3d0461;_0x5d1b2f[_0x1471('0x43')]=_[_0x1471('0x45')](db['OpenchannelApplication']['rawAttributes']);_0x5d1b2f[_0x1471('0x44')]=_[_0x1471('0x45')](_0x2c2688['query']);_0x5d1b2f[_0x1471('0x46')]=_[_0x1471('0x48')](_0x5d1b2f['model'],_0x5d1b2f['query']);_0x14fa11[_0x1471('0x47')]=_['intersection'](_0x5d1b2f[_0x1471('0x43')],qs['fields'](_0x2c2688[_0x1471('0x44')][_0x1471('0x49')]));_0x14fa11['attributes']=_0x14fa11['attributes'][_0x1471('0x58')]?_0x14fa11[_0x1471('0x47')]:_0x5d1b2f[_0x1471('0x43')];_0x14fa11[_0x1471('0x4b')]=qs[_0x1471('0x4c')](_0x2c2688[_0x1471('0x44')][_0x1471('0x4c')]);_0x14fa11['where']=qs['filters'](_[_0x1471('0x4d')](_0x2c2688[_0x1471('0x44')],_0x5d1b2f[_0x1471('0x46')]));if(_0x2c2688[_0x1471('0x44')][_0x1471('0x4e')]){_0x14fa11[_0x1471('0x4f')]=_['merge'](_0x14fa11[_0x1471('0x4f')],{'$or':_['map'](_0x14fa11[_0x1471('0x47')],function(_0x3a3bd5){var _0x223ce9={};_0x223ce9[_0x3a3bd5]={'$like':'%'+_0x2c2688[_0x1471('0x44')][_0x1471('0x4e')]+'%'};return _0x223ce9;})});}_0x14fa11=_[_0x1471('0x50')]({},_0x14fa11,_0x2c2688[_0x1471('0x54')]);return _0x25d727[_0x1471('0xaa')](_0x14fa11);}})[_0x1471('0x21')](function(_0x2ada31){if(_0x2ada31){_0x664955=_0x2ada31[_0x1471('0x58')];if(!_0x2c2688[_0x1471('0x44')][_0x1471('0x68')](_0x1471('0x4a'))){_0x14fa11[_0x1471('0x30')]=qs['limit'](_0x2c2688[_0x1471('0x44')][_0x1471('0x30')]);_0x14fa11[_0x1471('0x33')]=qs[_0x1471('0x33')](_0x2c2688[_0x1471('0x44')][_0x1471('0x33')]);}return _0x25d727['getApplications'](_0x14fa11);}})[_0x1471('0x21')](function(_0x38ba00){if(_0x38ba00){return _0x38ba00?{'count':_0x664955,'rows':_0x38ba00}:null;}})['then'](respondWithResult(_0x41b8ac,null))[_0x1471('0x2b')](handleError(_0x41b8ac,null));};exports['getInteractions']=function(_0x444a90,_0x49fb78,_0x1d80e4){var _0x27487c={'raw':![],'where':{}};var _0x138574={};var _0x407409={'count':0x0,'rows':[]};return db[_0x1471('0x40')][_0x1471('0x67')]({'where':{'id':_0x444a90['params']['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x49fb78,null))[_0x1471('0x21')](function(_0x4a98da){if(_0x4a98da){_0x138574[_0x1471('0x43')]=_[_0x1471('0x45')](db[_0x1471('0x8c')]['rawAttributes']);_0x138574[_0x1471('0x44')]=_['keys'](_0x444a90[_0x1471('0x44')]);_0x138574['filters']=_['intersection'](_0x138574[_0x1471('0x43')],_0x138574[_0x1471('0x44')]);_0x27487c[_0x1471('0x47')]=_[_0x1471('0x48')](_0x138574['model'],qs[_0x1471('0x49')](_0x444a90[_0x1471('0x44')][_0x1471('0x49')]));_0x27487c[_0x1471('0x47')]=_0x27487c['attributes']['length']?_0x27487c['attributes']:_0x138574[_0x1471('0x43')];if(!_0x444a90[_0x1471('0x44')][_0x1471('0x68')](_0x1471('0x4a'))){_0x27487c[_0x1471('0x30')]=qs['limit'](_0x444a90[_0x1471('0x44')][_0x1471('0x30')]);_0x27487c[_0x1471('0x33')]=qs[_0x1471('0x33')](_0x444a90[_0x1471('0x44')][_0x1471('0x33')]);}_0x27487c[_0x1471('0x4b')]=qs[_0x1471('0x4c')](_0x444a90[_0x1471('0x44')][_0x1471('0x4c')]);_0x27487c['where']=qs[_0x1471('0x46')](_[_0x1471('0x4d')](_0x444a90[_0x1471('0x44')],_0x138574[_0x1471('0x46')]));_0x27487c['where'][_0x1471('0x64')]=_0x4a98da['id'];if(_0x444a90['query'][_0x1471('0x4e')]){_0x27487c['where']=_[_0x1471('0x50')](_0x27487c[_0x1471('0x4f')],{'$or':_['map'](_0x27487c[_0x1471('0x47')],function(_0x13341a){var _0x68a97f={};_0x68a97f[_0x13341a]={'$like':'%'+_0x444a90['query'][_0x1471('0x4e')]+'%'};return _0x68a97f;})});}_0x27487c=_[_0x1471('0x50')]({},_0x27487c,_0x444a90[_0x1471('0x54')]);return db['OpenchannelInteraction'][_0x1471('0x32')]({'where':_0x27487c[_0x1471('0x4f')]})[_0x1471('0x21')](function(_0x3fdbd0){_0x407409[_0x1471('0x32')]=_0x3fdbd0;if(_0x444a90[_0x1471('0x44')][_0x1471('0x55')]){_0x27487c[_0x1471('0x56')]=[{'model':db[_0x1471('0x89')],'as':_0x1471('0xab'),'required':![]},{'model':db[_0x1471('0x9c')],'as':_0x1471('0xac'),'attributes':[_0x1471('0x53'),'fullname',_0x1471('0xad')],'required':![]},{'model':db[_0x1471('0xae')],'as':'Tags','attributes':['id',_0x1471('0x53'),_0x1471('0xaf')],'where':_0x444a90[_0x1471('0x44')][_0x1471('0xb0')]?{'id':_0x444a90[_0x1471('0x44')]['tag']}:undefined,'required':_0x444a90[_0x1471('0x44')][_0x1471('0xb0')]?!![]:![]}];}return db[_0x1471('0x8c')][_0x1471('0x57')](_0x27487c);})[_0x1471('0x21')](function(_0x12dd1a){_0x407409[_0x1471('0xb1')]=_0x12dd1a;return _0x407409;});}})[_0x1471('0x21')](respondWithFilteredResult(_0x49fb78,_0x27487c))[_0x1471('0x2b')](handleError(_0x49fb78,null));};exports['addAgents']=function(_0x30b8e1,_0x5ea713,_0x30bf14){return db['OpenchannelAccount'][_0x1471('0x59')]({'where':{'id':_0x30b8e1[_0x1471('0x61')]['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x5ea713,null))[_0x1471('0x21')](function(_0x1a71cc){if(_0x1a71cc){return _0x1a71cc[_0x1471('0xb2')](_0x30b8e1[_0x1471('0x5b')][_0x1471('0x6e')],_[_0x1471('0xb3')](_0x30b8e1[_0x1471('0x5b')],[_0x1471('0x6e'),'id'])||{})['spread'](function(_0x4c5da3){for(var _0x20d7e5=0x0;_0x20d7e5<_0x30b8e1[_0x1471('0x5b')][_0x1471('0x6e')]['length'];_0x20d7e5+=0x1){socket[_0x1471('0xb4')](_0x1471('0xb5'),{'UserId':Number(_0x30b8e1[_0x1471('0x5b')]['ids'][_0x20d7e5]),'OpenchannelAccountId':Number(_0x30b8e1[_0x1471('0x61')]['id'])});}return _0x4c5da3;});}})[_0x1471('0x21')](respondWithResult(_0x5ea713,null))[_0x1471('0x2b')](handleError(_0x5ea713,null));};exports[_0x1471('0xb6')]=function(_0x55ec2c,_0x2ebbff,_0x4d453d){return db[_0x1471('0x40')][_0x1471('0x59')]({'where':{'id':_0x55ec2c['params']['id']}})[_0x1471('0x21')](handleEntityNotFound(_0x2ebbff,null))['then'](function(_0x215b93){if(_0x215b93){return _0x215b93['removeAgents'](_0x55ec2c[_0x1471('0x44')][_0x1471('0x6e')])[_0x1471('0x21')](function(){if(_['isArray'](_0x55ec2c[_0x1471('0x44')]['ids'])){for(var _0x2a9265=0x0;_0x2a9265<_0x55ec2c['query'][_0x1471('0x6e')][_0x1471('0x58')];_0x2a9265+=0x1){socket[_0x1471('0xb4')](_0x1471('0xb7'),{'UserId':Number(_0x55ec2c[_0x1471('0x44')][_0x1471('0x6e')][_0x2a9265]),'OpenchannelAccountId':Number(_0x55ec2c[_0x1471('0x61')]['id'])});}}else{socket[_0x1471('0xb4')](_0x1471('0xb7'),{'UserId':Number(_0x55ec2c[_0x1471('0x44')][_0x1471('0x6e')]),'OpenchannelAccountId':Number(_0x55ec2c[_0x1471('0x61')]['id'])});}});}})[_0x1471('0x21')](respondWithStatusCode(_0x2ebbff,null))[_0x1471('0x2b')](handleError(_0x2ebbff,null));};exports[_0x1471('0xb8')]=function(_0x593d33,_0x4b6d8a,_0x2c0297){var _0x258fc4={};var _0x285e55={};var _0x14fd79;var _0x5f4937;return db[_0x1471('0x40')][_0x1471('0x67')]({'where':{'id':_0x593d33[_0x1471('0x61')]['id']}})['then'](handleEntityNotFound(_0x4b6d8a,null))[_0x1471('0x21')](function(_0x12951b){if(_0x12951b){_0x14fd79=_0x12951b;_0x285e55[_0x1471('0x43')]=_[_0x1471('0x45')](db[_0x1471('0x9c')][_0x1471('0x41')]);_0x285e55[_0x1471('0x44')]=_[_0x1471('0x45')](_0x593d33['query']);_0x285e55[_0x1471('0x46')]=_[_0x1471('0x48')](_0x285e55[_0x1471('0x43')],_0x285e55['query']);_0x258fc4['attributes']=_[_0x1471('0x48')](_0x285e55[_0x1471('0x43')],qs[_0x1471('0x49')](_0x593d33['query'][_0x1471('0x49')]));_0x258fc4[_0x1471('0x47')]=_0x258fc4[_0x1471('0x47')]['length']?_0x258fc4[_0x1471('0x47')]:_0x285e55[_0x1471('0x43')];_0x258fc4[_0x1471('0x4b')]=qs['sort'](_0x593d33[_0x1471('0x44')]['sort']);_0x258fc4[_0x1471('0x4f')]=qs['filters'](_['pick'](_0x593d33[_0x1471('0x44')],_0x285e55[_0x1471('0x46')]));if(_0x593d33[_0x1471('0x44')][_0x1471('0x4e')]){_0x258fc4[_0x1471('0x4f')]=_[_0x1471('0x50')](_0x258fc4['where'],{'$or':_['map'](_0x258fc4['attributes'],function(_0x4e201f){var _0x561b67={};_0x561b67[_0x4e201f]={'$like':'%'+_0x593d33[_0x1471('0x44')]['filter']+'%'};return _0x561b67;})});}_0x258fc4=_[_0x1471('0x50')]({},_0x258fc4,_0x593d33[_0x1471('0x54')]);return _0x14fd79[_0x1471('0xb8')](_0x258fc4);}})[_0x1471('0x21')](function(_0x3e65da){if(_0x3e65da){_0x5f4937=_0x3e65da[_0x1471('0x58')];if(!_0x593d33[_0x1471('0x44')][_0x1471('0x68')](_0x1471('0x4a'))){_0x258fc4[_0x1471('0x30')]=qs[_0x1471('0x30')](_0x593d33[_0x1471('0x44')]['limit']);_0x258fc4[_0x1471('0x33')]=qs[_0x1471('0x33')](_0x593d33[_0x1471('0x44')][_0x1471('0x33')]);}return _0x14fd79[_0x1471('0xb8')](_0x258fc4);}})[_0x1471('0x21')](function(_0x57675c){if(_0x57675c){return _0x57675c?{'count':_0x5f4937,'rows':_0x57675c}:null;}})['then'](respondWithResult(_0x4b6d8a,null))[_0x1471('0x2b')](handleError(_0x4b6d8a,null));};exports[_0x1471('0x3b')]=function(_0x57a587,_0x298ff4,_0x80bd29){var _0x4c6c7b,_0x13eba0,_0x225efa;if(_[_0x1471('0x78')](_0x57a587['body'][_0x1471('0x5b')])||_0x57a587[_0x1471('0x5b')]['body']===''){throw new db[(_0x1471('0x70'))]['ValidationError'](_0x1471('0xb9'));}if(_[_0x1471('0x78')](_0x57a587[_0x1471('0x5b')]['to'])){}_0x4c6c7b=_0x57a587[_0x1471('0x5b')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x57a587[_0x1471('0x61')]['id']}})['then'](handleEntityNotFound(_0x298ff4,null))[_0x1471('0x21')](function(_0x3fe7b7){if(_0x3fe7b7){return db[_0x1471('0x40')][_0x1471('0x59')]({'where':{'id':_0x3fe7b7['id']},'include':[{'model':db[_0x1471('0x7e')],'as':_0x1471('0x7f'),'include':[{'model':db['CmContact'],'as':_0x1471('0x80'),'where':{[_0x3fe7b7[_0x1471('0x7b')]]:_0x4c6c7b},'limit':0x1,'order':[[_0x1471('0x75'),'DESC']]}]}]})[_0x1471('0x21')](handleEntityNotFound(_0x298ff4,null))[_0x1471('0x21')](function(_0x3a81f0){if(_0x3a81f0&&_0x3a81f0['List']){_0x13eba0=_0x3a81f0['get']({'plain':!![]});if(_0x13eba0[_0x1471('0x7f')]&&_0x13eba0['List']['Contacts'][_0x1471('0x58')]){return _0x13eba0[_0x1471('0x7f')][_0x1471('0x80')][0x0];}return db['CmContact']['create'](_[_0x1471('0x1b')](_0x57a587['body'],{'firstName':_0x4c6c7b,[_0x3a81f0['mapKey']]:_0x4c6c7b,'phone':_0x4c6c7b,'ListId':_0x13eba0[_0x1471('0x77')]}));}})[_0x1471('0x21')](handleEntityNotFound(_0x298ff4,null))[_0x1471('0x21')](function(_0x2b8a5d){if(_0x2b8a5d){_0x225efa=_0x2b8a5d;return db[_0x1471('0x8c')][_0x1471('0x59')]({'where':{'ContactId':_0x225efa['id'],'closed':![],'OpenchannelAccountId':_0x13eba0['id']}})[_0x1471('0x21')](function(_0x53ef6e){if(_0x53ef6e){return[_0x53ef6e,![]];}return db[_0x1471('0x8c')][_0x1471('0x5a')]({'UserId':_0x57a587['user']['id'],'ContactId':_0x225efa['id'],'OpenchannelAccountId':_0x13eba0['id'],'lastMsgDirection':_0x1471('0xba'),'firstMsgDirection':_0x1471('0xba'),'Messages':[_[_0x1471('0x50')](_0x57a587[_0x1471('0x5b')],{'read':![],'body':_0x57a587[_0x1471('0x5b')]['body'],'OpenchannelAccountId':_0x13eba0['id'],'UserId':_0x57a587['user']['id'],'ContactId':_0x225efa['id']})]},{'include':[{'model':db[_0x1471('0x99')],'as':_0x1471('0xbb')}]})[_0x1471('0x21')](function(_0x469a0f){return[_0x469a0f,!![]];});});}})[_0x1471('0xbc')](function(_0x35689d,_0x4e8336){if(_0x4e8336){return _0x35689d;}return db['OpenchannelMessage'][_0x1471('0x5a')](_[_0x1471('0x50')](_0x57a587[_0x1471('0x5b')],{'read':![],'body':_0x57a587[_0x1471('0x5b')][_0x1471('0x5b')],'OpenchannelAccountId':_0x13eba0['id'],'OpenchannelInteractionId':_0x35689d['id'],'UserId':_0x57a587[_0x1471('0x5c')]['id'],'ContactId':_0x225efa['id']}))[_0x1471('0x21')](function(_0x16eb8d){_0x35689d[_0x1471('0xbd')][_0x1471('0xbb')]=[];_0x35689d[_0x1471('0xbd')][_0x1471('0xbb')]['push'](_0x16eb8d['dataValues']);return _0x35689d;});});}})[_0x1471('0x21')](respondWithResult(_0x298ff4,null))[_0x1471('0x2b')](handleError(_0x298ff4,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 964034e..7a3a450 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 _0x153f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount'];(function(_0x4b893c,_0x505a01){var _0x25e85a=function(_0x40c23e){while(--_0x40c23e){_0x4b893c['push'](_0x4b893c['shift']());}};_0x25e85a(++_0x505a01);}(_0x153f,0x15b));var _0xf153=function(_0x38ef88,_0x12d9fe){_0x38ef88=_0x38ef88-0x0;var _0x5dd001=_0x153f[_0x38ef88];return _0x5dd001;};'use strict';var EventEmitter=require(_0xf153('0x0'));var OpenchannelAccount=require(_0xf153('0x1'))['db'][_0xf153('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf153('0x3')](0x0);var events={'afterCreate':_0xf153('0x4'),'afterUpdate':_0xf153('0x5'),'afterDestroy':_0xf153('0x6')};function emitEvent(_0x59757c){return function(_0x364e65,_0x5c49c7,_0x1f9ead){OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c+':'+_0x364e65['id'],_0x364e65);OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c,_0x364e65);_0x1f9ead(null);};}for(var e in events){if(events[_0xf153('0x8')](e)){var event=events[e];OpenchannelAccount[_0xf153('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x6324=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit'];(function(_0x4eee11,_0x4a9b78){var _0x2d014f=function(_0xfb1e4e){while(--_0xfb1e4e){_0x4eee11['push'](_0x4eee11['shift']());}};_0x2d014f(++_0x4a9b78);}(_0x6324,0x142));var _0x4632=function(_0x10bbb8,_0x19e2eb){_0x10bbb8=_0x10bbb8-0x0;var _0x2026a0=_0x6324[_0x10bbb8];return _0x2026a0;};'use strict';var EventEmitter=require(_0x4632('0x0'));var OpenchannelAccount=require(_0x4632('0x1'))['db'][_0x4632('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4632('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4632('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3bea40){return function(_0x54c200,_0x13b218,_0x592e39){OpenchannelAccountEvents[_0x4632('0x5')](_0x3bea40+':'+_0x54c200['id'],_0x54c200);OpenchannelAccountEvents[_0x4632('0x5')](_0x3bea40,_0x54c200);_0x592e39(null);};}for(var e in events){if(events[_0x4632('0x6')](e)){var event=events[e];OpenchannelAccount[_0x4632('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index f5eea3b..7989548 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(_0x33e7e4,_0x223b3a){var _0x3e04d3=function(_0x2a4d33){while(--_0x2a4d33){_0x33e7e4['push'](_0x33e7e4['shift']());}};_0x3e04d3(++_0x223b3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x1d20a5,_0x345934){var _0x405d58=function(_0x50efe8){while(--_0x50efe8){_0x1d20a5['push'](_0x1d20a5['shift']());}};_0x405d58(++_0x345934);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 e01d2b3..f5af659 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 _0x0713=['socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x601573,_0x324781){var _0x1d25c6=function(_0x82d149){while(--_0x82d149){_0x601573['push'](_0x601573['shift']());}};_0x1d25c6(++_0x324781);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});config[_0x3071('0xb')]=_[_0x3071('0xc')](config[_0x3071('0xb')],{'host':_0x3071('0xd'),'port':0x18eb});var socket=require(_0x3071('0xe'))(new Redis(config[_0x3071('0xb')]));require(_0x3071('0xf'))['register'](socket);function respondWithRpcPromise(_0x3457cd,_0x2610b4,_0x937259){return new BPromise(function(_0xff9a29,_0x1ce844){return client['request'](_0x3457cd,_0x937259)[_0x3071('0x10')](function(_0x11a7ee){logger[_0x3071('0x11')](_0x3071('0x12'),_0x2610b4,_0x3071('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2610b4,_0x3071('0x13'),JSON['stringify'](_0x11a7ee));if(_0x11a7ee[_0x3071('0x14')]){if(_0x11a7ee[_0x3071('0x14')]['code']===0x1f4){logger[_0x3071('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x2610b4,_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);return _0x1ce844(_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);}logger[_0x3071('0x14')](_0x3071('0x12'),_0x2610b4,_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);return _0xff9a29(_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);}else{logger['info'](_0x3071('0x12'),_0x2610b4,_0x3071('0x13'));_0xff9a29(_0x11a7ee[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x17aee2){logger[_0x3071('0x14')](_0x3071('0x12'),_0x2610b4,_0x17aee2);_0x1ce844(_0x17aee2);});});} \ No newline at end of file +var _0xd64b=['http','redis','defaults','localhost','socket.io-emitter','request','then','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x15b33f,_0x49451c){var _0x27d7b5=function(_0x313758){while(--_0x313758){_0x15b33f['push'](_0x15b33f['shift']());}};_0x27d7b5(++_0x49451c);}(_0xd64b,0xc1));var _0xbd64=function(_0x503d48,_0x42e5a9){_0x503d48=_0x503d48-0x0;var _0x59743e=_0xd64b[_0x503d48];return _0x59743e;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd64('0x2'));var fs=require('fs');var Redis=require(_0xbd64('0x3'));var db=require(_0xbd64('0x4'))['db'];var utils=require(_0xbd64('0x5'));var logger=require(_0xbd64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd64('0x7')]({'port':0x232a});config[_0xbd64('0x8')]=_[_0xbd64('0x9')](config[_0xbd64('0x8')],{'host':_0xbd64('0xa'),'port':0x18eb});var socket=require(_0xbd64('0xb'))(new Redis(config[_0xbd64('0x8')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x40919e,_0xde7cc8,_0x1250be){return new BPromise(function(_0x4e1adb,_0xc80599){return client[_0xbd64('0xc')](_0x40919e,_0x1250be)[_0xbd64('0xd')](function(_0x18bde8){logger['info'](_0xbd64('0xe'),_0xde7cc8,'request\x20sent');logger[_0xbd64('0xf')](_0xbd64('0x10'),_0xde7cc8,_0xbd64('0x11'),JSON[_0xbd64('0x12')](_0x18bde8));if(_0x18bde8[_0xbd64('0x13')]){if(_0x18bde8[_0xbd64('0x13')][_0xbd64('0x14')]===0x1f4){logger[_0xbd64('0x13')](_0xbd64('0xe'),_0xde7cc8,_0x18bde8['error'][_0xbd64('0x15')]);return _0xc80599(_0x18bde8[_0xbd64('0x13')][_0xbd64('0x15')]);}logger[_0xbd64('0x13')](_0xbd64('0xe'),_0xde7cc8,_0x18bde8['error'][_0xbd64('0x15')]);return _0x4e1adb(_0x18bde8['error'][_0xbd64('0x15')]);}else{logger[_0xbd64('0x16')](_0xbd64('0xe'),_0xde7cc8,_0xbd64('0x11'));_0x4e1adb(_0x18bde8[_0xbd64('0x17')][_0xbd64('0x15')]);}})[_0xbd64('0x18')](function(_0x32c4c7){logger['error'](_0xbd64('0xe'),_0xde7cc8,_0x32c4c7);_0xc80599(_0x32c4c7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0f976b3..297ce93 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 _0xa1b9=['openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa1b9,0x71));var _0x9a1b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa1b9[_0xbb091];return _0x467a04;};'use strict';var OpenchannelAccountEvents=require(_0x9a1b('0x0'));var events=['save',_0x9a1b('0x1'),_0x9a1b('0x2')];function createListener(_0x52aa17,_0x3515cf){return function(_0x353bb4){_0x3515cf[_0x9a1b('0x3')](_0x52aa17,_0x353bb4);};}function removeListener(_0x226928,_0x59f846){return function(){OpenchannelAccountEvents[_0x9a1b('0x4')](_0x226928,_0x59f846);};}exports[_0x9a1b('0x5')]=function(_0x36712b){for(var _0x16ad8e=0x0,_0x47cb95=events[_0x9a1b('0x6')];_0x16ad8e<_0x47cb95;_0x16ad8e++){var _0x534151=events[_0x16ad8e];var _0x17b671=createListener(_0x9a1b('0x7')+_0x534151,_0x36712b);OpenchannelAccountEvents['on'](_0x534151,_0x17b671);}}; \ No newline at end of file +var _0x4899=['length','openchannelAccount:','./openchannelAccount.events','remove','emit','removeListener'];(function(_0xc1c67a,_0x2c3c88){var _0x3118ff=function(_0x3e9695){while(--_0x3e9695){_0xc1c67a['push'](_0xc1c67a['shift']());}};_0x3118ff(++_0x2c3c88);}(_0x4899,0x74));var _0x9489=function(_0x3aa590,_0x4c18f5){_0x3aa590=_0x3aa590-0x0;var _0xabb5f=_0x4899[_0x3aa590];return _0xabb5f;};'use strict';var OpenchannelAccountEvents=require(_0x9489('0x0'));var events=['save',_0x9489('0x1'),'update'];function createListener(_0x3e149b,_0x5a29ec){return function(_0x6a6532){_0x5a29ec[_0x9489('0x2')](_0x3e149b,_0x6a6532);};}function removeListener(_0x2a7d88,_0x2a8d19){return function(){OpenchannelAccountEvents[_0x9489('0x3')](_0x2a7d88,_0x2a8d19);};}exports['register']=function(_0x99c731){for(var _0x3d7499=0x0,_0x411ebe=events[_0x9489('0x4')];_0x3d7499<_0x411ebe;_0x3d7499++){var _0x574279=events[_0x3d7499];var _0x553c77=createListener(_0x9489('0x5')+_0x574279,_0x99c731);OpenchannelAccountEvents['on'](_0x574279,_0x553c77);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index a41fd43..5fe9969 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 _0xaf34=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','update','delete','multer','path','express','Router','fs-extra'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xaf34,0x163));var _0x4af3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xaf34[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x4af3('0x0'));var util=require('util');var path=require(_0x4af3('0x1'));var timeout=require('connect-timeout');var express=require(_0x4af3('0x2'));var router=express[_0x4af3('0x3')]();var fs_extra=require(_0x4af3('0x4'));var auth=require(_0x4af3('0x5'));var interaction=require(_0x4af3('0x6'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x4af3('0x7')](),controller[_0x4af3('0x8')]);router[_0x4af3('0x9')](_0x4af3('0xa'),auth['isAuthenticated'](),controller[_0x4af3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4af3('0xc')]);router['put'](_0x4af3('0xa'),auth[_0x4af3('0x7')](),controller[_0x4af3('0xd')]);router[_0x4af3('0xe')](_0x4af3('0xa'),auth[_0x4af3('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc44b=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0xc44b,0x16b));var _0xbc44=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0xc44b[_0x3f8759];return _0x2d33ca;};'use strict';var multer=require(_0xbc44('0x0'));var util=require('util');var path=require(_0xbc44('0x1'));var timeout=require(_0xbc44('0x2'));var express=require(_0xbc44('0x3'));var router=express['Router']();var fs_extra=require(_0xbc44('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc44('0x5'));var config=require('../../config/environment');var controller=require(_0xbc44('0x6'));router['get']('/',auth[_0xbc44('0x7')](),controller[_0xbc44('0x8')]);router[_0xbc44('0x9')](_0xbc44('0xa'),auth[_0xbc44('0x7')](),controller[_0xbc44('0xb')]);router[_0xbc44('0xc')]('/',auth['isAuthenticated'](),controller[_0xbc44('0xd')]);router[_0xbc44('0xe')](_0xbc44('0xa'),auth['isAuthenticated'](),controller[_0xbc44('0xf')]);router[_0xbc44('0x10')](_0xbc44('0xa'),auth[_0xbc44('0x7')](),controller[_0xbc44('0x11')]);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 0f10a33..d8eabc6 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 _0x9eea=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9eea,0x18e));var _0xa9ee=function(_0x1c7377,_0x8a8698){_0x1c7377=_0x1c7377-0x0;var _0x5d03e3=_0x9eea[_0x1c7377];return _0x5d03e3;};'use strict';var Sequelize=require(_0xa9ee('0x0'));module[_0xa9ee('0x1')]={'priority':{'type':Sequelize[_0xa9ee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa9ee('0x3')],'allowNull':![],'defaultValue':_0xa9ee('0x4')},'appdata':{'type':Sequelize[_0xa9ee('0x5')]()},'description':{'type':Sequelize[_0xa9ee('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa9ee('0x6')}}; \ No newline at end of file +var _0x15f6=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x15f6,0x1ed));var _0x615f=function(_0x276b16,_0x708971){_0x276b16=_0x276b16-0x0;var _0x3d4a3c=_0x15f6[_0x276b16];return _0x3d4a3c;};'use strict';var Sequelize=require(_0x615f('0x0'));module[_0x615f('0x1')]={'priority':{'type':Sequelize[_0x615f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x615f('0x3')],'allowNull':![],'defaultValue':_0x615f('0x4')},'appdata':{'type':Sequelize[_0x615f('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x615f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index b2f2c5a..009b95b 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 _0xdf99=['fieldName','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelApplication','findAll','rows','catch','show','params','rawAttributes','filters','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x1f64d9,_0x178b0d){var _0x5e868c=function(_0x2ced53){while(--_0x2ced53){_0x1f64d9['push'](_0x1f64d9['shift']());}};_0x5e868c(++_0x178b0d);}(_0xdf99,0x150));var _0x9df9=function(_0x2393c0,_0x5d5d61){_0x2393c0=_0x2393c0-0x0;var _0x188aa9=_0xdf99[_0x2393c0];return _0x188aa9;};'use strict';var emlformat=require(_0x9df9('0x0'));var rimraf=require(_0x9df9('0x1'));var zipdir=require(_0x9df9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9df9('0x3'));var moment=require('moment');var BPromise=require(_0x9df9('0x4'));var Mustache=require(_0x9df9('0x5'));var util=require(_0x9df9('0x6'));var path=require('path');var sox=require(_0x9df9('0x7'));var csv=require(_0x9df9('0x8'));var ejs=require(_0x9df9('0x9'));var fs=require('fs');var fs_extra=require(_0x9df9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9df9('0xb'));var jsforce=require(_0x9df9('0xc'));var deskjs=require(_0x9df9('0xd'));var toCsv=require(_0x9df9('0x8'));var querystring=require(_0x9df9('0xe'));var Papa=require(_0x9df9('0xf'));var Redis=require('ioredis');var authService=require(_0x9df9('0x10'));var qs=require(_0x9df9('0x11'));var as=require(_0x9df9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9df9('0x13'));var utils=require(_0x9df9('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9df9('0x15'))['db'];function respondWithStatusCode(_0x2c31d6,_0x3d10c4){_0x3d10c4=_0x3d10c4||0xcc;return function(_0x44f527){if(_0x44f527){return _0x2c31d6[_0x9df9('0x16')](_0x3d10c4);}return _0x2c31d6[_0x9df9('0x17')](_0x3d10c4)[_0x9df9('0x18')]();};}function respondWithResult(_0x5886de,_0x1f7b23){_0x1f7b23=_0x1f7b23||0xc8;return function(_0x4a52a9){if(_0x4a52a9){return _0x5886de[_0x9df9('0x17')](_0x1f7b23)['json'](_0x4a52a9);}};}function respondWithFilteredResult(_0x53391e,_0x3054b7){return function(_0x22c308){if(_0x22c308){var _0x543978=typeof _0x3054b7[_0x9df9('0x19')]==='undefined'&&typeof _0x3054b7[_0x9df9('0x1a')]===_0x9df9('0x1b');var _0x2c8513=_0x22c308[_0x9df9('0x1c')];var _0x2dbfae=_0x543978?0x0:_0x3054b7[_0x9df9('0x19')];var _0x2bc001=_0x543978?_0x22c308[_0x9df9('0x1c')]:_0x3054b7['offset']+_0x3054b7[_0x9df9('0x1a')];var _0x57f9e7;if(_0x2bc001>=_0x2c8513){_0x2bc001=_0x2c8513;_0x57f9e7=0xc8;}else{_0x57f9e7=0xce;}_0x53391e[_0x9df9('0x17')](_0x57f9e7);return _0x53391e[_0x9df9('0x1d')](_0x9df9('0x1e'),_0x2dbfae+'-'+_0x2bc001+'/'+_0x2c8513)[_0x9df9('0x1f')](_0x22c308);}return null;};}function patchUpdates(_0x3bf7bc){return function(_0x12d388){try{jsonpatch[_0x9df9('0x20')](_0x12d388,_0x3bf7bc,!![]);}catch(_0x4cce7e){return BPromise[_0x9df9('0x21')](_0x4cce7e);}return _0x12d388[_0x9df9('0x22')]();};}function saveUpdates(_0x1ad73c,_0x5bef38){return function(_0xcf3f47){if(_0xcf3f47){return _0xcf3f47[_0x9df9('0x23')](_0x1ad73c)[_0x9df9('0x24')](function(_0x4364f8){return _0x4364f8;});}return null;};}function removeEntity(_0x45936e,_0x2cbdac){return function(_0x1ecee8){if(_0x1ecee8){return _0x1ecee8[_0x9df9('0x25')]()[_0x9df9('0x24')](function(){_0x45936e['status'](0xcc)[_0x9df9('0x18')]();});}};}function handleEntityNotFound(_0x470974,_0x402f25){return function(_0x3795ea){if(!_0x3795ea){_0x470974[_0x9df9('0x16')](0x194);}return _0x3795ea;};}function handleError(_0x4aac8d,_0x5b76a0){_0x5b76a0=_0x5b76a0||0x1f4;return function(_0x3b1c45){logger[_0x9df9('0x26')](_0x3b1c45[_0x9df9('0x27')]);if(_0x3b1c45[_0x9df9('0x28')]){delete _0x3b1c45[_0x9df9('0x28')];}_0x4aac8d[_0x9df9('0x17')](_0x5b76a0)[_0x9df9('0x29')](_0x3b1c45);};}exports[_0x9df9('0x2a')]=function(_0x59dcd3,_0x143c0b){var _0x5bb769={},_0x6f1c7f={},_0xda81cf={'count':0x0,'rows':[]};var _0x596e8c=_[_0x9df9('0x2b')](db['OpenchannelApplication']['rawAttributes'],function(_0x5f454f){return{'name':_0x5f454f[_0x9df9('0x2c')],'type':_0x5f454f['type']['key']};});_0x6f1c7f[_0x9df9('0x2d')]=_[_0x9df9('0x2b')](_0x596e8c,_0x9df9('0x28'));_0x6f1c7f[_0x9df9('0x2e')]=_[_0x9df9('0x2f')](_0x59dcd3[_0x9df9('0x2e')]);_0x6f1c7f['filters']=_['intersection'](_0x6f1c7f[_0x9df9('0x2d')],_0x6f1c7f['query']);_0x5bb769['attributes']=_[_0x9df9('0x30')](_0x6f1c7f[_0x9df9('0x2d')],qs[_0x9df9('0x31')](_0x59dcd3[_0x9df9('0x2e')]['fields']));_0x5bb769['attributes']=_0x5bb769['attributes'][_0x9df9('0x32')]?_0x5bb769[_0x9df9('0x33')]:_0x6f1c7f[_0x9df9('0x2d')];if(!_0x59dcd3[_0x9df9('0x2e')][_0x9df9('0x34')](_0x9df9('0x35'))){_0x5bb769['limit']=qs[_0x9df9('0x1a')](_0x59dcd3['query'][_0x9df9('0x1a')]);_0x5bb769['offset']=qs[_0x9df9('0x19')](_0x59dcd3[_0x9df9('0x2e')]['offset']);}_0x5bb769[_0x9df9('0x36')]=qs[_0x9df9('0x37')](_0x59dcd3[_0x9df9('0x2e')][_0x9df9('0x37')]);_0x5bb769[_0x9df9('0x38')]=qs['filters'](_[_0x9df9('0x39')](_0x59dcd3[_0x9df9('0x2e')],_0x6f1c7f['filters']),_0x596e8c);if(_0x59dcd3[_0x9df9('0x2e')][_0x9df9('0x3a')]){_0x5bb769[_0x9df9('0x38')]=_[_0x9df9('0x3b')](_0x5bb769['where'],{'$or':_[_0x9df9('0x2b')](_0x596e8c,function(_0x6c3a2f){if(_0x6c3a2f[_0x9df9('0x3c')]!==_0x9df9('0x3d')){var _0x303761={};_0x303761[_0x6c3a2f[_0x9df9('0x28')]]={'$like':'%'+_0x59dcd3['query'][_0x9df9('0x3a')]+'%'};return _0x303761;}})});}_0x5bb769=_[_0x9df9('0x3b')]({},_0x5bb769,_0x59dcd3[_0x9df9('0x3e')]);var _0x497664={'where':_0x5bb769[_0x9df9('0x38')]};return db[_0x9df9('0x3f')][_0x9df9('0x1c')](_0x497664)[_0x9df9('0x24')](function(_0x4fc9c4){_0xda81cf['count']=_0x4fc9c4;if(_0x59dcd3[_0x9df9('0x2e')]['includeAll']){_0x5bb769['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x9df9('0x40')](_0x5bb769);})[_0x9df9('0x24')](function(_0x532e98){_0xda81cf[_0x9df9('0x41')]=_0x532e98;return _0xda81cf;})[_0x9df9('0x24')](respondWithFilteredResult(_0x143c0b,_0x5bb769))[_0x9df9('0x42')](handleError(_0x143c0b,null));};exports[_0x9df9('0x43')]=function(_0x2d2115,_0x21cfe6){var _0x133f2e={'raw':!![],'where':{'id':_0x2d2115[_0x9df9('0x44')]['id']}},_0x2a7c8e={};_0x2a7c8e[_0x9df9('0x2d')]=_['keys'](db[_0x9df9('0x3f')][_0x9df9('0x45')]);_0x2a7c8e['query']=_[_0x9df9('0x2f')](_0x2d2115[_0x9df9('0x2e')]);_0x2a7c8e[_0x9df9('0x46')]=_['intersection'](_0x2a7c8e['model'],_0x2a7c8e['query']);_0x133f2e[_0x9df9('0x33')]=_['intersection'](_0x2a7c8e[_0x9df9('0x2d')],qs[_0x9df9('0x31')](_0x2d2115[_0x9df9('0x2e')]['fields']));_0x133f2e[_0x9df9('0x33')]=_0x133f2e[_0x9df9('0x33')][_0x9df9('0x32')]?_0x133f2e['attributes']:_0x2a7c8e['model'];if(_0x2d2115[_0x9df9('0x2e')][_0x9df9('0x47')]){_0x133f2e[_0x9df9('0x48')]=[{'all':!![]}];}_0x133f2e=_[_0x9df9('0x3b')]({},_0x133f2e,_0x2d2115[_0x9df9('0x3e')]);return db[_0x9df9('0x3f')][_0x9df9('0x49')](_0x133f2e)[_0x9df9('0x24')](handleEntityNotFound(_0x21cfe6,null))[_0x9df9('0x24')](respondWithResult(_0x21cfe6,null))[_0x9df9('0x42')](handleError(_0x21cfe6,null));};exports[_0x9df9('0x4a')]=function(_0x24c927,_0x32494){return db['OpenchannelApplication']['create'](_0x24c927['body'],{})['then'](respondWithResult(_0x32494,0xc9))['catch'](handleError(_0x32494,null));};exports[_0x9df9('0x23')]=function(_0x19b894,_0x3bc1f4){if(_0x19b894[_0x9df9('0x4b')]['id']){delete _0x19b894[_0x9df9('0x4b')]['id'];}return db[_0x9df9('0x3f')][_0x9df9('0x49')]({'where':{'id':_0x19b894['params']['id']}})[_0x9df9('0x24')](handleEntityNotFound(_0x3bc1f4,null))[_0x9df9('0x24')](saveUpdates(_0x19b894[_0x9df9('0x4b')],null))[_0x9df9('0x24')](respondWithResult(_0x3bc1f4,null))[_0x9df9('0x42')](handleError(_0x3bc1f4,null));};exports['destroy']=function(_0x13df22,_0x3bf630){return db['OpenchannelApplication'][_0x9df9('0x49')]({'where':{'id':_0x13df22['params']['id']}})['then'](handleEntityNotFound(_0x3bf630,null))[_0x9df9('0x24')](removeEntity(_0x3bf630,null))[_0x9df9('0x42')](handleError(_0x3bf630,null));}; \ No newline at end of file +var _0x2e70=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','merge','map','VIRTUAL','options','OpenchannelApplication','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x2e70,0x18d));var _0x02e7=function(_0xefd94d,_0x26969e){_0xefd94d=_0xefd94d-0x0;var _0x2c771d=_0x2e70[_0xefd94d];return _0x2c771d;};'use strict';var emlformat=require(_0x02e7('0x0'));var rimraf=require(_0x02e7('0x1'));var zipdir=require(_0x02e7('0x2'));var jsonpatch=require(_0x02e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x02e7('0x4'));var util=require('util');var path=require(_0x02e7('0x5'));var sox=require(_0x02e7('0x6'));var csv=require(_0x02e7('0x7'));var ejs=require(_0x02e7('0x8'));var fs=require('fs');var fs_extra=require(_0x02e7('0x9'));var _=require(_0x02e7('0xa'));var squel=require(_0x02e7('0xb'));var crypto=require(_0x02e7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x02e7('0xd'));var Papa=require('papaparse');var Redis=require(_0x02e7('0xe'));var authService=require(_0x02e7('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x02e7('0x10'))(_0x02e7('0x11'));var utils=require(_0x02e7('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x02e7('0x13'))['db'];function respondWithStatusCode(_0xb70aef,_0x349bfa){_0x349bfa=_0x349bfa||0xcc;return function(_0x203e34){if(_0x203e34){return _0xb70aef[_0x02e7('0x14')](_0x349bfa);}return _0xb70aef['status'](_0x349bfa)[_0x02e7('0x15')]();};}function respondWithResult(_0x219345,_0x5041fa){_0x5041fa=_0x5041fa||0xc8;return function(_0x313aa9){if(_0x313aa9){return _0x219345[_0x02e7('0x16')](_0x5041fa)[_0x02e7('0x17')](_0x313aa9);}};}function respondWithFilteredResult(_0x1c417c,_0x4506de){return function(_0x3497a5){if(_0x3497a5){var _0x145c05=typeof _0x4506de[_0x02e7('0x18')]===_0x02e7('0x19')&&typeof _0x4506de[_0x02e7('0x1a')]===_0x02e7('0x19');var _0x92b9a6=_0x3497a5[_0x02e7('0x1b')];var _0x142a4e=_0x145c05?0x0:_0x4506de[_0x02e7('0x18')];var _0x5cf3c1=_0x145c05?_0x3497a5[_0x02e7('0x1b')]:_0x4506de[_0x02e7('0x18')]+_0x4506de[_0x02e7('0x1a')];var _0x45a444;if(_0x5cf3c1>=_0x92b9a6){_0x5cf3c1=_0x92b9a6;_0x45a444=0xc8;}else{_0x45a444=0xce;}_0x1c417c['status'](_0x45a444);return _0x1c417c[_0x02e7('0x1c')](_0x02e7('0x1d'),_0x142a4e+'-'+_0x5cf3c1+'/'+_0x92b9a6)[_0x02e7('0x17')](_0x3497a5);}return null;};}function patchUpdates(_0x70c56a){return function(_0x3e6380){try{jsonpatch[_0x02e7('0x1e')](_0x3e6380,_0x70c56a,!![]);}catch(_0x1663ab){return BPromise['reject'](_0x1663ab);}return _0x3e6380[_0x02e7('0x1f')]();};}function saveUpdates(_0x32e05e,_0x435aaf){return function(_0x12e94b){if(_0x12e94b){return _0x12e94b[_0x02e7('0x20')](_0x32e05e)['then'](function(_0x239117){return _0x239117;});}return null;};}function removeEntity(_0x42def6,_0x4e8e5c){return function(_0x2cc860){if(_0x2cc860){return _0x2cc860[_0x02e7('0x21')]()[_0x02e7('0x22')](function(){_0x42def6[_0x02e7('0x16')](0xcc)[_0x02e7('0x15')]();});}};}function handleEntityNotFound(_0x329363,_0x1850ff){return function(_0x46d932){if(!_0x46d932){_0x329363[_0x02e7('0x14')](0x194);}return _0x46d932;};}function handleError(_0x75676e,_0xfadf6d){_0xfadf6d=_0xfadf6d||0x1f4;return function(_0x29aa17){logger[_0x02e7('0x23')](_0x29aa17[_0x02e7('0x24')]);if(_0x29aa17[_0x02e7('0x25')]){delete _0x29aa17[_0x02e7('0x25')];}_0x75676e[_0x02e7('0x16')](_0xfadf6d)[_0x02e7('0x26')](_0x29aa17);};}exports['index']=function(_0x4c4644,_0x14dc00){var _0x1e35b4={},_0x345488={},_0xb73f7={'count':0x0,'rows':[]};var _0x115cd8=_['map'](db['OpenchannelApplication'][_0x02e7('0x27')],function(_0x1cc7ed){return{'name':_0x1cc7ed[_0x02e7('0x28')],'type':_0x1cc7ed[_0x02e7('0x29')][_0x02e7('0x2a')]};});_0x345488[_0x02e7('0x2b')]=_['map'](_0x115cd8,_0x02e7('0x25'));_0x345488[_0x02e7('0x2c')]=_[_0x02e7('0x2d')](_0x4c4644[_0x02e7('0x2c')]);_0x345488[_0x02e7('0x2e')]=_[_0x02e7('0x2f')](_0x345488[_0x02e7('0x2b')],_0x345488[_0x02e7('0x2c')]);_0x1e35b4['attributes']=_[_0x02e7('0x2f')](_0x345488[_0x02e7('0x2b')],qs[_0x02e7('0x30')](_0x4c4644[_0x02e7('0x2c')]['fields']));_0x1e35b4[_0x02e7('0x31')]=_0x1e35b4[_0x02e7('0x31')][_0x02e7('0x32')]?_0x1e35b4[_0x02e7('0x31')]:_0x345488[_0x02e7('0x2b')];if(!_0x4c4644['query']['hasOwnProperty'](_0x02e7('0x33'))){_0x1e35b4[_0x02e7('0x1a')]=qs[_0x02e7('0x1a')](_0x4c4644[_0x02e7('0x2c')][_0x02e7('0x1a')]);_0x1e35b4[_0x02e7('0x18')]=qs['offset'](_0x4c4644[_0x02e7('0x2c')][_0x02e7('0x18')]);}_0x1e35b4['order']=qs[_0x02e7('0x34')](_0x4c4644[_0x02e7('0x2c')]['sort']);_0x1e35b4[_0x02e7('0x35')]=qs[_0x02e7('0x2e')](_['pick'](_0x4c4644[_0x02e7('0x2c')],_0x345488[_0x02e7('0x2e')]),_0x115cd8);if(_0x4c4644['query']['filter']){_0x1e35b4[_0x02e7('0x35')]=_[_0x02e7('0x36')](_0x1e35b4[_0x02e7('0x35')],{'$or':_[_0x02e7('0x37')](_0x115cd8,function(_0x49b365){if(_0x49b365[_0x02e7('0x29')]!==_0x02e7('0x38')){var _0x2dcc41={};_0x2dcc41[_0x49b365[_0x02e7('0x25')]]={'$like':'%'+_0x4c4644['query']['filter']+'%'};return _0x2dcc41;}})});}_0x1e35b4=_[_0x02e7('0x36')]({},_0x1e35b4,_0x4c4644[_0x02e7('0x39')]);var _0x5ce200={'where':_0x1e35b4[_0x02e7('0x35')]};return db[_0x02e7('0x3a')]['count'](_0x5ce200)[_0x02e7('0x22')](function(_0x472634){_0xb73f7[_0x02e7('0x1b')]=_0x472634;if(_0x4c4644[_0x02e7('0x2c')][_0x02e7('0x3b')]){_0x1e35b4[_0x02e7('0x3c')]=[{'all':!![]}];}return db[_0x02e7('0x3a')]['findAll'](_0x1e35b4);})['then'](function(_0x51c5de){_0xb73f7['rows']=_0x51c5de;return _0xb73f7;})[_0x02e7('0x22')](respondWithFilteredResult(_0x14dc00,_0x1e35b4))[_0x02e7('0x3d')](handleError(_0x14dc00,null));};exports[_0x02e7('0x3e')]=function(_0x28b68d,_0x254210){var _0x4f1a87={'raw':!![],'where':{'id':_0x28b68d[_0x02e7('0x3f')]['id']}},_0x2c407e={};_0x2c407e['model']=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x2c407e[_0x02e7('0x2c')]=_[_0x02e7('0x2d')](_0x28b68d[_0x02e7('0x2c')]);_0x2c407e[_0x02e7('0x2e')]=_['intersection'](_0x2c407e[_0x02e7('0x2b')],_0x2c407e['query']);_0x4f1a87[_0x02e7('0x31')]=_[_0x02e7('0x2f')](_0x2c407e[_0x02e7('0x2b')],qs[_0x02e7('0x30')](_0x28b68d[_0x02e7('0x2c')]['fields']));_0x4f1a87[_0x02e7('0x31')]=_0x4f1a87[_0x02e7('0x31')][_0x02e7('0x32')]?_0x4f1a87[_0x02e7('0x31')]:_0x2c407e[_0x02e7('0x2b')];if(_0x28b68d['query'][_0x02e7('0x3b')]){_0x4f1a87[_0x02e7('0x3c')]=[{'all':!![]}];}_0x4f1a87=_['merge']({},_0x4f1a87,_0x28b68d[_0x02e7('0x39')]);return db[_0x02e7('0x3a')][_0x02e7('0x40')](_0x4f1a87)['then'](handleEntityNotFound(_0x254210,null))[_0x02e7('0x22')](respondWithResult(_0x254210,null))['catch'](handleError(_0x254210,null));};exports[_0x02e7('0x41')]=function(_0x5c1ffd,_0x378567){return db['OpenchannelApplication'][_0x02e7('0x41')](_0x5c1ffd[_0x02e7('0x42')],{})[_0x02e7('0x22')](respondWithResult(_0x378567,0xc9))['catch'](handleError(_0x378567,null));};exports['update']=function(_0x309550,_0x5b28a6){if(_0x309550[_0x02e7('0x42')]['id']){delete _0x309550[_0x02e7('0x42')]['id'];}return db[_0x02e7('0x3a')][_0x02e7('0x40')]({'where':{'id':_0x309550[_0x02e7('0x3f')]['id']}})[_0x02e7('0x22')](handleEntityNotFound(_0x5b28a6,null))['then'](saveUpdates(_0x309550['body'],null))['then'](respondWithResult(_0x5b28a6,null))[_0x02e7('0x3d')](handleError(_0x5b28a6,null));};exports['destroy']=function(_0x28663e,_0x327002){return db[_0x02e7('0x3a')]['find']({'where':{'id':_0x28663e[_0x02e7('0x3f')]['id']}})[_0x02e7('0x22')](handleEntityNotFound(_0x327002,null))[_0x02e7('0x22')](removeEntity(_0x327002,null))[_0x02e7('0x3d')](handleError(_0x327002,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 19791fa..56f2376 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 _0xd85d=['../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xd85d,0x193));var _0xdd85=function(_0x5f1a03,_0x4e886e){_0x5f1a03=_0x5f1a03-0x0;var _0x2ecb87=_0xd85d[_0x5f1a03];return _0x2ecb87;};'use strict';var _=require('lodash');var util=require(_0xdd85('0x0'));var logger=require(_0xdd85('0x1'))(_0xdd85('0x2'));var moment=require('moment');var BPromise=require(_0xdd85('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd85('0x4'));var rimraf=require('rimraf');var config=require(_0xdd85('0x5'));var attributes=require(_0xdd85('0x6'));module[_0xdd85('0x7')]=function(_0x43dcde,_0x250355){return _0x43dcde['define'](_0xdd85('0x8'),attributes,{'tableName':_0xdd85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd85('0xa'),'collate':_0xdd85('0xb')});}; \ No newline at end of file +var _0x6b28=['rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6b28,0x190));var _0x86b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x86b2('0x0'));var util=require('util');var logger=require(_0x86b2('0x1'))('api');var moment=require(_0x86b2('0x2'));var BPromise=require(_0x86b2('0x3'));var rp=require(_0x86b2('0x4'));var fs=require('fs');var path=require(_0x86b2('0x5'));var rimraf=require(_0x86b2('0x6'));var config=require(_0x86b2('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x86b2('0x8')]=function(_0x10170f,_0x263e90){return _0x10170f[_0x86b2('0x9')](_0x86b2('0xa'),attributes,{'tableName':_0x86b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86b2('0xc'),'collate':_0x86b2('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0e405d3..587394c 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 _0xd382=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x2eb9dc,_0xd46ecb){var _0x2332ac=function(_0x4784b2){while(--_0x4784b2){_0x2eb9dc['push'](_0x2eb9dc['shift']());}};_0x2332ac(++_0xd46ecb);}(_0xd382,0x84));var _0x2d38=function(_0x4af4a5,_0x4e18da){_0x4af4a5=_0x4af4a5-0x0;var _0xafb643=_0xd382[_0x4af4a5];return _0xafb643;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require(_0x2d38('0xa'));var jayson=require(_0x2d38('0xb'));var client=jayson[_0x2d38('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359fc0,_0x1edc71,_0x477e70){return new BPromise(function(_0x179b23,_0x3d5eb7){return client[_0x2d38('0xd')](_0x359fc0,_0x477e70)[_0x2d38('0xe')](function(_0x532916){logger[_0x2d38('0xf')](_0x2d38('0x10'),_0x1edc71,_0x2d38('0x11'));logger[_0x2d38('0x12')](_0x2d38('0x13'),_0x1edc71,_0x2d38('0x11'),JSON[_0x2d38('0x14')](_0x532916));if(_0x532916[_0x2d38('0x15')]){if(_0x532916[_0x2d38('0x15')][_0x2d38('0x16')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1edc71,_0x532916['error'][_0x2d38('0x17')]);return _0x3d5eb7(_0x532916[_0x2d38('0x15')][_0x2d38('0x17')]);}logger[_0x2d38('0x15')](_0x2d38('0x10'),_0x1edc71,_0x532916[_0x2d38('0x15')]['message']);return _0x179b23(_0x532916['error'][_0x2d38('0x17')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x1edc71,_0x2d38('0x11'));_0x179b23(_0x532916[_0x2d38('0x18')][_0x2d38('0x17')]);}})[_0x2d38('0x19')](function(_0x42893b){logger[_0x2d38('0x15')](_0x2d38('0x10'),_0x1edc71,_0x42893b);_0x3d5eb7(_0x42893b);});});}exports[_0x2d38('0x1a')]=function(_0x1e6176){var _0x4fe17e=this;return new Promise(function(_0x5c0b83,_0x523581){return db[_0x2d38('0x1b')]['update'](_0x1e6176[_0x2d38('0x1c')],{'raw':_0x1e6176[_0x2d38('0x1d')]?_0x1e6176[_0x2d38('0x1d')][_0x2d38('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6176[_0x2d38('0x1d')]?_0x1e6176[_0x2d38('0x1d')][_0x2d38('0x1f')]||null:null,'attributes':_0x1e6176[_0x2d38('0x1d')]?_0x1e6176[_0x2d38('0x1d')][_0x2d38('0x20')]||null:null,'limit':_0x1e6176[_0x2d38('0x1d')]?_0x1e6176[_0x2d38('0x1d')][_0x2d38('0x21')]||null:null})['then'](function(_0x34ad9c){logger[_0x2d38('0xf')](_0x2d38('0x1a'),_0x1e6176);logger[_0x2d38('0x12')](_0x2d38('0x1a'),_0x1e6176,JSON[_0x2d38('0x14')](_0x34ad9c));_0x5c0b83(_0x34ad9c);})[_0x2d38('0x19')](function(_0x1e5548){logger['error'](_0x2d38('0x1a'),_0x1e5548[_0x2d38('0x17')],_0x1e6176);_0x523581(_0x4fe17e[_0x2d38('0x15')](0x1f4,_0x1e5548['message']));});});}; \ No newline at end of file +var _0xd7b8=['result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4b19fe,_0x591eaf){var _0x1bd85a=function(_0x2933c7){while(--_0x2933c7){_0x4b19fe['push'](_0x4b19fe['shift']());}};_0x1bd85a(++_0x591eaf);}(_0xd7b8,0x169));var _0x8d7b=function(_0x213d74,_0x585ddc){_0x213d74=_0x213d74-0x0;var _0x19674d=_0xd7b8[_0x213d74];return _0x19674d;};'use strict';var _=require(_0x8d7b('0x0'));var util=require('util');var moment=require(_0x8d7b('0x1'));var BPromise=require(_0x8d7b('0x2'));var rs=require(_0x8d7b('0x3'));var fs=require('fs');var Redis=require(_0x8d7b('0x4'));var db=require(_0x8d7b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8d7b('0x6'))(_0x8d7b('0x7'));var config=require(_0x8d7b('0x8'));var jayson=require(_0x8d7b('0x9'));var client=jayson[_0x8d7b('0xa')][_0x8d7b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23bfe4,_0x37cf0d,_0x490929){return new BPromise(function(_0x3b602c,_0x29bced){return client[_0x8d7b('0xc')](_0x23bfe4,_0x490929)[_0x8d7b('0xd')](function(_0x1ae44c){logger[_0x8d7b('0xe')](_0x8d7b('0xf'),_0x37cf0d,_0x8d7b('0x10'));logger[_0x8d7b('0x11')](_0x8d7b('0x12'),_0x37cf0d,_0x8d7b('0x10'),JSON[_0x8d7b('0x13')](_0x1ae44c));if(_0x1ae44c['error']){if(_0x1ae44c[_0x8d7b('0x14')][_0x8d7b('0x15')]===0x1f4){logger[_0x8d7b('0x14')](_0x8d7b('0xf'),_0x37cf0d,_0x1ae44c[_0x8d7b('0x14')][_0x8d7b('0x16')]);return _0x29bced(_0x1ae44c[_0x8d7b('0x14')][_0x8d7b('0x16')]);}logger[_0x8d7b('0x14')](_0x8d7b('0xf'),_0x37cf0d,_0x1ae44c[_0x8d7b('0x14')][_0x8d7b('0x16')]);return _0x3b602c(_0x1ae44c[_0x8d7b('0x14')]['message']);}else{logger[_0x8d7b('0xe')](_0x8d7b('0xf'),_0x37cf0d,_0x8d7b('0x10'));_0x3b602c(_0x1ae44c[_0x8d7b('0x17')][_0x8d7b('0x16')]);}})[_0x8d7b('0x18')](function(_0x455418){logger[_0x8d7b('0x14')](_0x8d7b('0xf'),_0x37cf0d,_0x455418);_0x29bced(_0x455418);});});}exports[_0x8d7b('0x19')]=function(_0x2e6538){var _0x5572eb=this;return new Promise(function(_0x1b463d,_0x4ad68b){return db[_0x8d7b('0x1a')][_0x8d7b('0x1b')](_0x2e6538['body'],{'raw':_0x2e6538['options']?_0x2e6538[_0x8d7b('0x1c')][_0x8d7b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6538[_0x8d7b('0x1c')]?_0x2e6538['options'][_0x8d7b('0x1e')]||null:null,'attributes':_0x2e6538['options']?_0x2e6538['options']['attributes']||null:null,'limit':_0x2e6538[_0x8d7b('0x1c')]?_0x2e6538[_0x8d7b('0x1c')][_0x8d7b('0x1f')]||null:null})['then'](function(_0x3bd11c){logger['info']('UpdateOpenchannelApplication',_0x2e6538);logger[_0x8d7b('0x11')]('UpdateOpenchannelApplication',_0x2e6538,JSON[_0x8d7b('0x13')](_0x3bd11c));_0x1b463d(_0x3bd11c);})[_0x8d7b('0x18')](function(_0x4b9c30){logger['error'](_0x8d7b('0x19'),_0x4b9c30[_0x8d7b('0x16')],_0x2e6538);_0x4ad68b(_0x5572eb[_0x8d7b('0x14')](0x1f4,_0x4b9c30[_0x8d7b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 7a1d75b..4891b72 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 _0xd0b2=['destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannelinteraction:addtags','put','delete','openchannel','openchannelinteraction:destroy'];(function(_0x2a7bdc,_0x2bdd21){var _0x461816=function(_0x1d93ca){while(--_0x1d93ca){_0x2a7bdc['push'](_0x2a7bdc['shift']());}};_0x461816(++_0x2bdd21);}(_0xd0b2,0x17a));var _0x2d0b=function(_0x4769ea,_0x39386c){_0x4769ea=_0x4769ea-0x0;var _0x39ca7e=_0xd0b2[_0x4769ea];return _0x39ca7e;};'use strict';var multer=require('multer');var util=require(_0x2d0b('0x0'));var path=require(_0x2d0b('0x1'));var timeout=require(_0x2d0b('0x2'));var express=require(_0x2d0b('0x3'));var router=express[_0x2d0b('0x4')]();var fs_extra=require(_0x2d0b('0x5'));var auth=require(_0x2d0b('0x6'));var interaction=require(_0x2d0b('0x7'));var config=require(_0x2d0b('0x8'));var controller=require(_0x2d0b('0x9'));router[_0x2d0b('0xa')]('/',auth[_0x2d0b('0xb')](),controller[_0x2d0b('0xc')]);router[_0x2d0b('0xa')](_0x2d0b('0xd'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0xe')]);router['get'](_0x2d0b('0xf'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x10')]);router['get'](_0x2d0b('0x11'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x12')]);router[_0x2d0b('0xa')](_0x2d0b('0x13'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x14')]);router[_0x2d0b('0x15')]('/',auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x16')]);router[_0x2d0b('0x15')](_0x2d0b('0x11'),auth['isAuthenticated'](),controller[_0x2d0b('0x17')]);router[_0x2d0b('0x15')]('/:id/tags',auth[_0x2d0b('0xb')](),interaction[_0x2d0b('0x18')]('openchannel',_0x2d0b('0x19')),controller['addTags']);router[_0x2d0b('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x2d0b('0x18')]('openchannel','openchannelinteraction:update'),controller['update']);router[_0x2d0b('0x1b')](_0x2d0b('0xf'),auth[_0x2d0b('0xb')](),interaction[_0x2d0b('0x18')](_0x2d0b('0x1c'),_0x2d0b('0x1d')),controller[_0x2d0b('0x1e')]);router[_0x2d0b('0x1b')](_0x2d0b('0x1f'),auth[_0x2d0b('0xb')](),controller[_0x2d0b('0x20')]);module[_0x2d0b('0x21')]=router; \ No newline at end of file +var _0xcfe0=['getMessages','download','post','create','/:id/tags','tracked','openchannel','addTags','put','update','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x7a06d2,_0x215519){var _0x4fe872=function(_0xe76e64){while(--_0xe76e64){_0x7a06d2['push'](_0x7a06d2['shift']());}};_0x4fe872(++_0x215519);}(_0xcfe0,0x163));var _0x0cfe=function(_0x51424b,_0x3a6597){_0x51424b=_0x51424b-0x0;var _0x4dce4e=_0xcfe0[_0x51424b];return _0x4dce4e;};'use strict';var multer=require(_0x0cfe('0x0'));var util=require(_0x0cfe('0x1'));var path=require('path');var timeout=require(_0x0cfe('0x2'));var express=require('express');var router=express[_0x0cfe('0x3')]();var fs_extra=require(_0x0cfe('0x4'));var auth=require(_0x0cfe('0x5'));var interaction=require(_0x0cfe('0x6'));var config=require(_0x0cfe('0x7'));var controller=require(_0x0cfe('0x8'));router[_0x0cfe('0x9')]('/',auth[_0x0cfe('0xa')](),controller[_0x0cfe('0xb')]);router[_0x0cfe('0x9')](_0x0cfe('0xc'),auth['isAuthenticated'](),controller[_0x0cfe('0xd')]);router[_0x0cfe('0x9')](_0x0cfe('0xe'),auth[_0x0cfe('0xa')](),controller[_0x0cfe('0xf')]);router[_0x0cfe('0x9')](_0x0cfe('0x10'),auth['isAuthenticated'](),controller[_0x0cfe('0x11')]);router['get']('/:id/download',auth[_0x0cfe('0xa')](),controller[_0x0cfe('0x12')]);router[_0x0cfe('0x13')]('/',auth[_0x0cfe('0xa')](),controller[_0x0cfe('0x14')]);router['post'](_0x0cfe('0x10'),auth['isAuthenticated'](),controller['addMessage']);router[_0x0cfe('0x13')](_0x0cfe('0x15'),auth['isAuthenticated'](),interaction[_0x0cfe('0x16')](_0x0cfe('0x17'),'openchannelinteraction:addtags'),controller[_0x0cfe('0x18')]);router[_0x0cfe('0x19')](_0x0cfe('0xe'),auth[_0x0cfe('0xa')](),interaction[_0x0cfe('0x16')](_0x0cfe('0x17'),'openchannelinteraction:update'),controller[_0x0cfe('0x1a')]);router['delete'](_0x0cfe('0xe'),auth[_0x0cfe('0xa')](),interaction[_0x0cfe('0x16')](_0x0cfe('0x17'),_0x0cfe('0x1b')),controller[_0x0cfe('0x1c')]);router['delete'](_0x0cfe('0x15'),auth[_0x0cfe('0xa')](),controller[_0x0cfe('0x1d')]);module[_0x0cfe('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index dd34048..65d3f4a 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 _0x8c38=['DATE','STRING','ENUM','out','BOOLEAN','sequelize','exports'];(function(_0x354f9b,_0x19817d){var _0x49dbe4=function(_0x553ceb){while(--_0x553ceb){_0x354f9b['push'](_0x354f9b['shift']());}};_0x49dbe4(++_0x19817d);}(_0x8c38,0x83));var _0x88c3=function(_0x108b1e,_0x32cccd){_0x108b1e=_0x108b1e-0x0;var _0x334a72=_0x8c38[_0x108b1e];return _0x334a72;};'use strict';var Sequelize=require(_0x88c3('0x0'));module[_0x88c3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x88c3('0x2')]},'disposition':{'type':Sequelize[_0x88c3('0x3')]},'secondDisposition':{'type':Sequelize[_0x88c3('0x3')]},'thirdDisposition':{'type':Sequelize[_0x88c3('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x88c3('0x2')]},'threadId':{'type':Sequelize[_0x88c3('0x3')]},'externalUrl':{'type':Sequelize[_0x88c3('0x3')]},'lastMsgAt':{'type':Sequelize[_0x88c3('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x88c3('0x4')]('in',_0x88c3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x88c3('0x4')]('in',_0x88c3('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x88c3('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xc17f=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x122894,_0xca8a44){var _0xc4eb19=function(_0x7a3e81){while(--_0x7a3e81){_0x122894['push'](_0x122894['shift']());}};_0xc4eb19(++_0xca8a44);}(_0xc17f,0xb8));var _0xfc17=function(_0xbbf9a6,_0x1c79ee){_0xbbf9a6=_0xbbf9a6-0x0;var _0x4ddefd=_0xc17f[_0xbbf9a6];return _0x4ddefd;};'use strict';var Sequelize=require(_0xfc17('0x0'));module[_0xfc17('0x1')]={'closed':{'type':Sequelize[_0xfc17('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfc17('0x3')]},'disposition':{'type':Sequelize[_0xfc17('0x4')]},'secondDisposition':{'type':Sequelize[_0xfc17('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfc17('0x4')]},'read1stAt':{'type':Sequelize[_0xfc17('0x3')]},'threadId':{'type':Sequelize[_0xfc17('0x4')]},'externalUrl':{'type':Sequelize[_0xfc17('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xfc17('0x5')]('in',_0xfc17('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xfc17('0x5')]('in',_0xfc17('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xfc17('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xfc17('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 d7b2a0a..2757d42 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 _0xc54a=['send','map','fieldName','type','findAll','openchannel','user','then','catch','show','query','from','params','model','keys','rawAttributes','attributes','intersection','fields','length','include','merge','options','OpenchannelInteraction','create','body','find','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','filters','hasOwnProperty','limit','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','omit','spread','Tag','color','openchannelInteractionTags:save','removeTags','toString','join','root','server','tmp','files','push','User','CmContact','Contact','firstName','lastName','attachments','Attachment','secret','read','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','Openchannel','N.A.','createdAt','format','closed','closedAt','disposition','Public','Private','Messages','basename','existsSync','createReadStream','createWriteStream','out','System','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','update','destroy','name'];(function(_0x34929a,_0x457ed4){var _0x10d8ad=function(_0x570930){while(--_0x570930){_0x34929a['push'](_0x34929a['shift']());}};_0x10d8ad(++_0x457ed4);}(_0xc54a,0x64));var _0xac54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc54a[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xac54('0x0'));var zipdir=require(_0xac54('0x1'));var moment=require(_0xac54('0x2'));var util=require(_0xac54('0x3'));var path=require('path');var ejs=require(_0xac54('0x4'));var fs=require('fs');var _=require(_0xac54('0x5'));var Redis=require(_0xac54('0x6'));var interaction=require(_0xac54('0x7'));var qs=require(_0xac54('0x8'));var pdf=require(_0xac54('0x9'));var logger=require(_0xac54('0xa'))(_0xac54('0xb'));var config=require(_0xac54('0xc'));var db=require('../../mysqldb')['db'];config[_0xac54('0xd')]=_[_0xac54('0xe')](config['redis'],{'host':_0xac54('0xf'),'port':0x18eb});var socket=require(_0xac54('0x10'))(new Redis(config[_0xac54('0xd')]));require(_0xac54('0x11'))[_0xac54('0x12')](socket);function respondWithStatusCode(_0x1f94f4,_0x4fe46f){_0x4fe46f=_0x4fe46f||0xcc;return function(_0x2da09b){if(_0x2da09b){return _0x1f94f4[_0xac54('0x13')](_0x4fe46f);}return _0x1f94f4['status'](_0x4fe46f)[_0xac54('0x14')]();};}function respondWithResult(_0x10d85d,_0x111bee){_0x111bee=_0x111bee||0xc8;return function(_0x16992e){if(_0x16992e){return _0x10d85d[_0xac54('0x15')](_0x111bee)[_0xac54('0x16')](_0x16992e);}};}function respondWithFilteredResult(_0x198dc4,_0x3e117a){return function(_0x4ee5dd){if(_0x4ee5dd){var _0x29d565=typeof _0x3e117a[_0xac54('0x17')]==='undefined'&&typeof _0x3e117a['limit']===_0xac54('0x18');var _0x5eeec0=_0x4ee5dd[_0xac54('0x19')];var _0x14e72b=_0x29d565?0x0:_0x3e117a[_0xac54('0x17')];var _0x297178=_0x29d565?_0x4ee5dd['count']:_0x3e117a['offset']+_0x3e117a['limit'];var _0x144688;if(_0x297178>=_0x5eeec0){_0x297178=_0x5eeec0;_0x144688=0xc8;}else{_0x144688=0xce;}_0x198dc4[_0xac54('0x15')](_0x144688);return _0x198dc4[_0xac54('0x1a')](_0xac54('0x1b'),_0x14e72b+'-'+_0x297178+'/'+_0x5eeec0)[_0xac54('0x16')](_0x4ee5dd);}return null;};}function saveUpdates(_0x470923){return function(_0x39580e){if(_0x39580e){return _0x39580e[_0xac54('0x1c')](_0x470923)['then'](function(_0x36e7b1){return _0x36e7b1;});}return null;};}function removeEntity(_0x5dccc4){return function(_0x5f05a4){if(_0x5f05a4){return _0x5f05a4[_0xac54('0x1d')]()['then'](function(){_0x5dccc4[_0xac54('0x15')](0xcc)[_0xac54('0x14')]();});}};}function handleEntityNotFound(_0x3cae72){return function(_0x22afd5){if(!_0x22afd5){_0x3cae72[_0xac54('0x13')](0x194);}return _0x22afd5;};}function handleError(_0x39ff9d,_0x553413){_0x553413=_0x553413||0x1f4;return function(_0x394567){logger['error'](_0x394567['stack']);if(_0x394567[_0xac54('0x1e')]){delete _0x394567['name'];}_0x39ff9d['status'](_0x553413)[_0xac54('0x1f')](_0x394567);};}exports['index']=function(_0x3e0bbf,_0x485536){var _0x5d3c2f={};var _0x5a2569=_[_0xac54('0x20')](db['OpenchannelInteraction']['rawAttributes'],function(_0x54f259){return{'name':_0x54f259[_0xac54('0x21')],'type':_0x54f259[_0xac54('0x22')]['key']};});_0x5d3c2f=qs['getOptions'](_0x5a2569,_0x3e0bbf);return interaction[_0xac54('0x23')](_0xac54('0x24'),_0x3e0bbf['query'],_0x3e0bbf[_0xac54('0x25')],_0x5d3c2f,_0x5a2569)[_0xac54('0x26')](respondWithFilteredResult(_0x485536,_0x5d3c2f))[_0xac54('0x27')](handleError(_0x485536,null));};exports[_0xac54('0x28')]=function(_0x1b245f,_0x46048e){var _0x3896d9={};if(_0x1b245f['query'][_0xac54('0x22')]&&_0x1b245f[_0xac54('0x29')][_0xac54('0x22')]===_0xac54('0x2a')){_0x3896d9[_0xac54('0x2a')]=_0x1b245f[_0xac54('0x2b')]['id'];}else{_0x3896d9['id']=_0x1b245f[_0xac54('0x2b')]['id'];}var _0x4e81b3={'raw':![],'where':_0x3896d9},_0x19367c={};_0x19367c[_0xac54('0x2c')]=_[_0xac54('0x2d')](db['OpenchannelInteraction'][_0xac54('0x2e')]);_0x19367c[_0xac54('0x29')]=_[_0xac54('0x2d')](_0x1b245f['query']);_0x19367c['filters']=_['intersection'](_0x19367c[_0xac54('0x2c')],_0x19367c[_0xac54('0x29')]);_0x4e81b3[_0xac54('0x2f')]=_[_0xac54('0x30')](_0x19367c[_0xac54('0x2c')],qs['fields'](_0x1b245f[_0xac54('0x29')][_0xac54('0x31')]));_0x4e81b3[_0xac54('0x2f')]=_0x4e81b3[_0xac54('0x2f')][_0xac54('0x32')]?_0x4e81b3[_0xac54('0x2f')]:_0x19367c[_0xac54('0x2c')];if(_0x1b245f[_0xac54('0x29')]['includeAll']){_0x4e81b3[_0xac54('0x33')]=[{'all':!![]}];}_0x4e81b3=_[_0xac54('0x34')]({},_0x4e81b3,_0x1b245f[_0xac54('0x35')]);return db[_0xac54('0x36')]['find'](_0x4e81b3)[_0xac54('0x26')](handleEntityNotFound(_0x46048e,null))[_0xac54('0x26')](respondWithResult(_0x46048e,null))[_0xac54('0x27')](handleError(_0x46048e,null));};exports[_0xac54('0x37')]=function(_0x5695b1,_0x355272){return db['OpenchannelInteraction'][_0xac54('0x37')](_0x5695b1[_0xac54('0x38')],{})[_0xac54('0x26')](respondWithResult(_0x355272,0xc9))[_0xac54('0x27')](handleError(_0x355272,null));};exports['update']=function(_0x4c0506,_0x158b5e){if(_0x4c0506['body']['id']){delete _0x4c0506['body']['id'];}return db[_0xac54('0x36')][_0xac54('0x39')]({'where':{'id':_0x4c0506[_0xac54('0x2b')]['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x158b5e,null))[_0xac54('0x26')](saveUpdates(_0x4c0506[_0xac54('0x38')],null))[_0xac54('0x26')](respondWithResult(_0x158b5e,null))[_0xac54('0x27')](handleError(_0x158b5e,null));};exports[_0xac54('0x1d')]=function(_0x9828c9,_0x52b852){return db['OpenchannelInteraction'][_0xac54('0x39')]({'where':{'id':_0x9828c9[_0xac54('0x2b')]['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x52b852,null))['then'](removeEntity(_0x52b852,null))[_0xac54('0x27')](handleError(_0x52b852,null));};exports[_0xac54('0x3a')]=function(_0x3a4b7b,_0x324591){return db[_0xac54('0x36')][_0xac54('0x3a')]()['then'](respondWithResult(_0x324591,null))[_0xac54('0x27')](handleError(_0x324591,null));};exports[_0xac54('0x3b')]=function(_0x1e300a,_0x2d6f27){return db['OpenchannelMessage'][_0xac54('0x39')]({'where':{'id':_0x1e300a['params']['id']}})['then'](handleEntityNotFound(_0x2d6f27,null))['then'](function(_0xb7c44b){if(_0xb7c44b){return _0xb7c44b['addMessage'](_0x1e300a[_0xac54('0x38')][_0xac54('0x3c')],_['omit'](_0x1e300a['body'],[_0xac54('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x2d6f27,null))[_0xac54('0x27')](handleError(_0x2d6f27,null));};exports[_0xac54('0x3d')]=function(_0x21d713,_0x39a210){var _0x39a620={'raw':![],'where':{}};var _0x4ea24f={};var _0x4ccd4b={'count':0x0,'rows':[]};return db[_0xac54('0x36')][_0xac54('0x3e')]({'where':{'id':_0x21d713[_0xac54('0x2b')]['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x39a210,null))['then'](function(_0x3a7fe0){if(_0x3a7fe0){_0x4ea24f[_0xac54('0x2c')]=_[_0xac54('0x2d')](db[_0xac54('0x3f')][_0xac54('0x2e')]);_0x4ea24f[_0xac54('0x29')]=_['keys'](_0x21d713['query']);_0x4ea24f[_0xac54('0x40')]=_[_0xac54('0x30')](_0x4ea24f[_0xac54('0x2c')],_0x4ea24f['query']);_0x39a620[_0xac54('0x2f')]=_[_0xac54('0x30')](_0x4ea24f['model'],qs[_0xac54('0x31')](_0x21d713[_0xac54('0x29')][_0xac54('0x31')]));_0x39a620['attributes']=_0x39a620['attributes'][_0xac54('0x32')]?_0x39a620[_0xac54('0x2f')]:_0x4ea24f[_0xac54('0x2c')];if(!_0x21d713['query'][_0xac54('0x41')]('nolimit')){_0x39a620[_0xac54('0x42')]=qs[_0xac54('0x42')](_0x21d713[_0xac54('0x29')]['limit']);_0x39a620[_0xac54('0x17')]=qs['offset'](_0x21d713[_0xac54('0x29')][_0xac54('0x17')]);}_0x39a620['order']=qs['sort'](_0x21d713[_0xac54('0x29')]['sort']);_0x39a620[_0xac54('0x43')]=qs['filters'](_[_0xac54('0x44')](_0x21d713['query'],_0x4ea24f['filters']));_0x39a620[_0xac54('0x43')]['OpenchannelInteractionId']=_0x3a7fe0['id'];if(_0x21d713['query'][_0xac54('0x45')]){_0x39a620[_0xac54('0x43')]=_[_0xac54('0x34')](_0x39a620['where'],{'$or':_[_0xac54('0x20')](_0x39a620['attributes'],function(_0x3657d3){var _0x36323e={};_0x36323e[_0x3657d3]={'$like':'%'+_0x21d713['query'][_0xac54('0x45')]+'%'};return _0x36323e;})});}if(_0x21d713['query']['$gte']){var _0x28497e=_0x21d713['query'][_0xac54('0x46')][_0xac54('0x47')](',');var _0x362ce0={};_0x362ce0[_0x28497e[0x0]]={'$gte':moment(_0x28497e[0x1])['format'](_0xac54('0x48'))};_0x39a620[_0xac54('0x43')]=_[_0xac54('0x34')](_0x39a620[_0xac54('0x43')],_0x362ce0);}_0x39a620=_[_0xac54('0x34')]({},_0x39a620,_0x21d713[_0xac54('0x35')]);return db[_0xac54('0x3f')][_0xac54('0x19')]({'where':_0x39a620[_0xac54('0x43')]})['then'](function(_0x4a583f){_0x4ccd4b[_0xac54('0x19')]=_0x4a583f;if(_0x21d713[_0xac54('0x29')][_0xac54('0x49')]){_0x39a620[_0xac54('0x33')]=[{'all':!![]}];}return db[_0xac54('0x3f')][_0xac54('0x23')](_0x39a620);})[_0xac54('0x26')](function(_0x5b7767){_0x4ccd4b['rows']=_0x5b7767;return _0x4ccd4b;});}})[_0xac54('0x26')](respondWithFilteredResult(_0x39a210,_0x39a620))[_0xac54('0x27')](handleError(_0x39a210,null));};exports[_0xac54('0x4a')]=function(_0x31fe92,_0x512933){return db['OpenchannelInteraction'][_0xac54('0x39')]({'where':{'id':_0x31fe92['params']['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x512933,null))[_0xac54('0x26')](function(_0x1a7013){if(_0x1a7013){return _0x1a7013['setTags'](_0x31fe92[_0xac54('0x38')][_0xac54('0x3c')],_[_0xac54('0x4b')](_0x31fe92[_0xac54('0x38')],[_0xac54('0x3c'),'id'])||{})[_0xac54('0x4c')](function(){return db[_0xac54('0x4d')][_0xac54('0x23')]({'attributes':['id',_0xac54('0x1e'),_0xac54('0x4e')],'where':{'id':_0x31fe92['body']['ids']}});})['then'](function(_0x4460de){socket['emit'](_0xac54('0x4f'),{'id':Number(_0x31fe92[_0xac54('0x2b')]['id']),'tags':_0x4460de||[]});return{'id':Number(_0x31fe92['params']['id']),'tags':_0x4460de||[]};});}})[_0xac54('0x26')](respondWithResult(_0x512933,null))[_0xac54('0x27')](handleError(_0x512933,null));};exports[_0xac54('0x50')]=function(_0x333cce,_0x18e407){return db[_0xac54('0x36')][_0xac54('0x39')]({'where':{'id':_0x333cce[_0xac54('0x2b')]['id']}})[_0xac54('0x26')](handleEntityNotFound(_0x18e407,null))[_0xac54('0x26')](function(_0x5506e2){if(_0x5506e2){return _0x5506e2[_0xac54('0x50')](_0x333cce[_0xac54('0x29')][_0xac54('0x3c')]);}})[_0xac54('0x26')](respondWithStatusCode(_0x18e407,null))[_0xac54('0x27')](handleError(_0x18e407,null));};exports['download']=function(_0x4bbacc,_0x449f35){var _0x11ef59=moment()['unix']()[_0xac54('0x51')]();var _0x19a345=path[_0xac54('0x52')](config[_0xac54('0x53')],_0xac54('0x54'),'files',_0xac54('0x55'));var _0x5ca967=path[_0xac54('0x52')](config[_0xac54('0x53')],_0xac54('0x54'),_0xac54('0x56'),'attachments');var _0x2ff27f=path[_0xac54('0x52')](_0x19a345,_0x11ef59);var _0x34ba06=util['format']('transcript-%d-%s.zip',_0x4bbacc['params']['id'],_0x11ef59);var _0x2b090c=path[_0xac54('0x52')](_0x19a345,_0x34ba06);var _0xac9741=[];_0xac9741[_0xac54('0x57')]({'model':db[_0xac54('0x58')],'as':_0xac54('0x58'),'attributes':['id','fullname'],'raw':!![]});_0xac9741[_0xac54('0x57')]({'model':db[_0xac54('0x59')],'as':_0xac54('0x5a'),'attributes':['id',_0xac54('0x5b'),_0xac54('0x5c')],'raw':!![]});if(_0x4bbacc['query'][_0xac54('0x5d')]){_0xac9741['push']({'model':db['Attachment'],'as':_0xac54('0x5e'),'raw':!![]});}var _0xf345d5=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0xac54('0x38'),'createdAt','direction',_0xac54('0x5f'),_0xac54('0x60')],'include':_0xac9741}];_0xf345d5[_0xac54('0x57')]({'model':db[_0xac54('0x61')],'as':_0xac54('0x62'),'attributes':['id',_0xac54('0x1e')]});_0xf345d5[_0xac54('0x57')]({'model':db[_0xac54('0x58')],'as':_0xac54('0x63'),'attributes':['id',_0xac54('0x64')]});return db['OpenchannelInteraction'][_0xac54('0x39')]({'where':{'id':_0x4bbacc[_0xac54('0x2b')]['id']},'include':_0xf345d5})['then'](handleEntityNotFound(_0x449f35,null))[_0xac54('0x26')](function(_0x3eb246){if(_0x3eb246){var _0x8bac73=_0x3eb246[_0xac54('0x65')]({'plain':!![]});fs[_0xac54('0x66')](_0x2ff27f);var _0x185a19={'channel':_0xac54('0x67'),'account':_0x8bac73['Account']['name'],'agent':_0x8bac73[_0xac54('0x63')]?_0x8bac73['Owner'][_0xac54('0x64')]:_0xac54('0x68'),'createdAt':moment(_0x8bac73[_0xac54('0x69')])[_0xac54('0x6a')](_0xac54('0x48'))[_0xac54('0x51')](),'closedAt':_0x8bac73[_0xac54('0x6b')]?moment(_0x8bac73[_0xac54('0x6c')])[_0xac54('0x6a')](_0xac54('0x48'))['toString']():'','disposition':_0x8bac73[_0xac54('0x6d')],'visibility':_0x8bac73['threadId']?_0xac54('0x6e'):_0xac54('0x6f'),'messages':_(_0x8bac73[_0xac54('0x70')])[_0xac54('0x45')]({'secret':![]})[_0xac54('0x20')](function(_0x1e47f7){if(_0x1e47f7[_0xac54('0x5e')]){var _0x5c8b35=path['join'](_0x5ca967,_0x1e47f7[_0xac54('0x5e')][_0xac54('0x71')]);if(fs[_0xac54('0x72')](_0x5c8b35)){fs[_0xac54('0x73')](_0x5c8b35)['pipe'](fs[_0xac54('0x74')](path[_0xac54('0x52')](_0x2ff27f,_0x1e47f7[_0xac54('0x5e')][_0xac54('0x71')])));}}return{'date':moment(_0x1e47f7[_0xac54('0x69')])[_0xac54('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xac54('0x51')](),'sender':_0x1e47f7['direction']===_0xac54('0x75')?_0x1e47f7[_0xac54('0x58')]?_0x1e47f7['User'][_0xac54('0x64')]:_0xac54('0x76'):_0x1e47f7['Contact'][_0xac54('0x5b')]+(_0x1e47f7['Contact'][_0xac54('0x5c')]?'\x20'+_0x1e47f7[_0xac54('0x5a')][_0xac54('0x5c')]:''),'body':_0x1e47f7[_0xac54('0x5e')]?_0x1e47f7['Attachment'][_0xac54('0x71')]:_0x1e47f7[_0xac54('0x38')],'direction':_0x1e47f7[_0xac54('0x77')]===_0xac54('0x75')?'A':'C','secret':_0x1e47f7[_0xac54('0x5f')],'read':_0x1e47f7[_0xac54('0x60')],'attachment':_0x1e47f7[_0xac54('0x5e')]};})[_0xac54('0x78')]()};return ejs[_0xac54('0x79')](path[_0xac54('0x52')](config[_0xac54('0x53')],_0xac54('0x54'),_0xac54('0x7a'),_0xac54('0x7b')),{'interaction':_0x185a19})['then'](function(_0x2bde04){var _0x1725d2=path[_0xac54('0x52')](_0x2ff27f,_0xac54('0x7c')+_0x8bac73['id']+'-'+_0x11ef59+_0xac54('0x7d'));var _0x13dfe0={'path':_0x1725d2,'channel':_0xac54('0x67'),'interactionId':_0x8bac73['id']};return pdf[_0xac54('0x7e')](_0x2bde04,_0x13dfe0);})[_0xac54('0x26')](function(){return new Promise(function(_0x4d3d33,_0x1da5bf){zipdir(_0x2ff27f,{'saveTo':_0x2b090c},function(_0x2c097d,_0xcc3015){if(_0x2c097d)return _0x1da5bf(_0x2c097d);return _0x4d3d33(_0xcc3015);});})[_0xac54('0x26')](function(){return new Promise(function(_0x10fb1c,_0x160eeb){rimraf(_0x2ff27f,function(_0x29d060){if(_0x29d060)_0x160eeb(_0x29d060);return _0x10fb1c();});});})[_0xac54('0x26')](function(){return _0x449f35[_0xac54('0x7f')](_0x2b090c,_0x34ba06,function(_0x25070a){if(_0x25070a){logger[_0xac54('0x80')](_0xac54('0x81'),_0x25070a);}else{fs[_0xac54('0x82')](_0x2b090c);}});});});}else{return _0x449f35[_0xac54('0x13')](0xc8);}})[_0xac54('0x27')](handleError(_0x449f35,null));}; \ No newline at end of file +var _0x5b73=['nolimit','order','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','omit','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','read','Account','fullname','mkdirSync','Openchannel','Owner','closed','disposition','threadId','basename','existsSync','createReadStream','createWriteStream','direction','out','System','secret','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','user','query','from','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','describe','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty'];(function(_0x5acfcc,_0x543112){var _0x34cf81=function(_0x3a4f24){while(--_0x3a4f24){_0x5acfcc['push'](_0x5acfcc['shift']());}};_0x34cf81(++_0x543112);}(_0x5b73,0x143));var _0x35b7=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x5b73[_0x57d13b];return _0x467696;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x35b7('0x0'));var util=require(_0x35b7('0x1'));var path=require(_0x35b7('0x2'));var ejs=require(_0x35b7('0x3'));var fs=require('fs');var _=require(_0x35b7('0x4'));var Redis=require(_0x35b7('0x5'));var interaction=require(_0x35b7('0x6'));var qs=require(_0x35b7('0x7'));var pdf=require(_0x35b7('0x8'));var logger=require(_0x35b7('0x9'))(_0x35b7('0xa'));var config=require(_0x35b7('0xb'));var db=require(_0x35b7('0xc'))['db'];config[_0x35b7('0xd')]=_[_0x35b7('0xe')](config['redis'],{'host':_0x35b7('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35b7('0xd')]));require(_0x35b7('0x10'))[_0x35b7('0x11')](socket);function respondWithStatusCode(_0x4b8442,_0x466190){_0x466190=_0x466190||0xcc;return function(_0x198eeb){if(_0x198eeb){return _0x4b8442['sendStatus'](_0x466190);}return _0x4b8442['status'](_0x466190)[_0x35b7('0x12')]();};}function respondWithResult(_0x86c913,_0x404f59){_0x404f59=_0x404f59||0xc8;return function(_0x3db1d1){if(_0x3db1d1){return _0x86c913[_0x35b7('0x13')](_0x404f59)[_0x35b7('0x14')](_0x3db1d1);}};}function respondWithFilteredResult(_0x31d893,_0x554045){return function(_0x10cde4){if(_0x10cde4){var _0x4a28f8=typeof _0x554045['offset']===_0x35b7('0x15')&&typeof _0x554045[_0x35b7('0x16')]==='undefined';var _0x476a40=_0x10cde4[_0x35b7('0x17')];var _0x4e1f5f=_0x4a28f8?0x0:_0x554045[_0x35b7('0x18')];var _0x38d1de=_0x4a28f8?_0x10cde4[_0x35b7('0x17')]:_0x554045['offset']+_0x554045[_0x35b7('0x16')];var _0x30cdaa;if(_0x38d1de>=_0x476a40){_0x38d1de=_0x476a40;_0x30cdaa=0xc8;}else{_0x30cdaa=0xce;}_0x31d893['status'](_0x30cdaa);return _0x31d893[_0x35b7('0x19')](_0x35b7('0x1a'),_0x4e1f5f+'-'+_0x38d1de+'/'+_0x476a40)[_0x35b7('0x14')](_0x10cde4);}return null;};}function saveUpdates(_0xdb75e9){return function(_0x2e73a3){if(_0x2e73a3){return _0x2e73a3[_0x35b7('0x1b')](_0xdb75e9)[_0x35b7('0x1c')](function(_0x18cdbd){return _0x18cdbd;});}return null;};}function removeEntity(_0x12ba18){return function(_0x2cc5ec){if(_0x2cc5ec){return _0x2cc5ec[_0x35b7('0x1d')]()[_0x35b7('0x1c')](function(){_0x12ba18[_0x35b7('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x261cf0){return function(_0x29f2a4){if(!_0x29f2a4){_0x261cf0[_0x35b7('0x1e')](0x194);}return _0x29f2a4;};}function handleError(_0x415496,_0x41f948){_0x41f948=_0x41f948||0x1f4;return function(_0x745acd){logger[_0x35b7('0x1f')](_0x745acd[_0x35b7('0x20')]);if(_0x745acd[_0x35b7('0x21')]){delete _0x745acd[_0x35b7('0x21')];}_0x415496['status'](_0x41f948)[_0x35b7('0x22')](_0x745acd);};}exports[_0x35b7('0x23')]=function(_0x1ca75c,_0x5a498f){var _0x426ee7={};var _0x3b4e5d=_[_0x35b7('0x24')](db[_0x35b7('0x25')][_0x35b7('0x26')],function(_0x1a37b3){return{'name':_0x1a37b3[_0x35b7('0x27')],'type':_0x1a37b3[_0x35b7('0x28')][_0x35b7('0x29')]};});_0x426ee7=qs['getOptions'](_0x3b4e5d,_0x1ca75c);return interaction[_0x35b7('0x2a')]('openchannel',_0x1ca75c['query'],_0x1ca75c[_0x35b7('0x2b')],_0x426ee7,_0x3b4e5d)[_0x35b7('0x1c')](respondWithFilteredResult(_0x5a498f,_0x426ee7))['catch'](handleError(_0x5a498f,null));};exports['show']=function(_0x45b603,_0x153dd2){var _0x5d21cd={};if(_0x45b603[_0x35b7('0x2c')]['type']&&_0x45b603[_0x35b7('0x2c')][_0x35b7('0x28')]==='from'){_0x5d21cd[_0x35b7('0x2d')]=_0x45b603[_0x35b7('0x2e')]['id'];}else{_0x5d21cd['id']=_0x45b603[_0x35b7('0x2e')]['id'];}var _0x382b48={'raw':![],'where':_0x5d21cd},_0x5436a2={};_0x5436a2['model']=_[_0x35b7('0x2f')](db['OpenchannelInteraction']['rawAttributes']);_0x5436a2[_0x35b7('0x2c')]=_['keys'](_0x45b603[_0x35b7('0x2c')]);_0x5436a2[_0x35b7('0x30')]=_[_0x35b7('0x31')](_0x5436a2[_0x35b7('0x32')],_0x5436a2[_0x35b7('0x2c')]);_0x382b48[_0x35b7('0x33')]=_['intersection'](_0x5436a2['model'],qs[_0x35b7('0x34')](_0x45b603[_0x35b7('0x2c')][_0x35b7('0x34')]));_0x382b48[_0x35b7('0x33')]=_0x382b48['attributes'][_0x35b7('0x35')]?_0x382b48[_0x35b7('0x33')]:_0x5436a2[_0x35b7('0x32')];if(_0x45b603['query'][_0x35b7('0x36')]){_0x382b48['include']=[{'all':!![]}];}_0x382b48=_[_0x35b7('0x37')]({},_0x382b48,_0x45b603[_0x35b7('0x38')]);return db[_0x35b7('0x25')][_0x35b7('0x39')](_0x382b48)[_0x35b7('0x1c')](handleEntityNotFound(_0x153dd2,null))[_0x35b7('0x1c')](respondWithResult(_0x153dd2,null))[_0x35b7('0x3a')](handleError(_0x153dd2,null));};exports[_0x35b7('0x3b')]=function(_0x2cd52a,_0x29d0d9){return db['OpenchannelInteraction'][_0x35b7('0x3b')](_0x2cd52a[_0x35b7('0x3c')],{})[_0x35b7('0x1c')](respondWithResult(_0x29d0d9,0xc9))['catch'](handleError(_0x29d0d9,null));};exports[_0x35b7('0x1b')]=function(_0x3d50c0,_0x2b0866){if(_0x3d50c0[_0x35b7('0x3c')]['id']){delete _0x3d50c0['body']['id'];}return db['OpenchannelInteraction'][_0x35b7('0x39')]({'where':{'id':_0x3d50c0['params']['id']}})['then'](handleEntityNotFound(_0x2b0866,null))[_0x35b7('0x1c')](saveUpdates(_0x3d50c0[_0x35b7('0x3c')],null))['then'](respondWithResult(_0x2b0866,null))[_0x35b7('0x3a')](handleError(_0x2b0866,null));};exports[_0x35b7('0x1d')]=function(_0x4e5c97,_0x2dc8d5){return db[_0x35b7('0x25')][_0x35b7('0x39')]({'where':{'id':_0x4e5c97[_0x35b7('0x2e')]['id']}})[_0x35b7('0x1c')](handleEntityNotFound(_0x2dc8d5,null))[_0x35b7('0x1c')](removeEntity(_0x2dc8d5,null))[_0x35b7('0x3a')](handleError(_0x2dc8d5,null));};exports[_0x35b7('0x3d')]=function(_0x370d51,_0x2cd08d){return db['OpenchannelInteraction']['describe']()[_0x35b7('0x1c')](respondWithResult(_0x2cd08d,null))['catch'](handleError(_0x2cd08d,null));};exports['addMessage']=function(_0x2e194f,_0x1d6792){return db[_0x35b7('0x3e')][_0x35b7('0x39')]({'where':{'id':_0x2e194f[_0x35b7('0x2e')]['id']}})[_0x35b7('0x1c')](handleEntityNotFound(_0x1d6792,null))[_0x35b7('0x1c')](function(_0x1f62ff){if(_0x1f62ff){return _0x1f62ff['addMessage'](_0x2e194f[_0x35b7('0x3c')]['ids'],_['omit'](_0x2e194f[_0x35b7('0x3c')],[_0x35b7('0x3f'),'id'])||{});}})[_0x35b7('0x1c')](respondWithResult(_0x1d6792,null))['catch'](handleError(_0x1d6792,null));};exports[_0x35b7('0x40')]=function(_0x524d6,_0x7eb219){var _0x5bad21={'raw':![],'where':{}};var _0x1c33bb={};var _0x3bf184={'count':0x0,'rows':[]};return db[_0x35b7('0x25')][_0x35b7('0x41')]({'where':{'id':_0x524d6[_0x35b7('0x2e')]['id']}})[_0x35b7('0x1c')](handleEntityNotFound(_0x7eb219,null))[_0x35b7('0x1c')](function(_0x777421){if(_0x777421){_0x1c33bb[_0x35b7('0x32')]=_['keys'](db['OpenchannelMessage'][_0x35b7('0x26')]);_0x1c33bb[_0x35b7('0x2c')]=_[_0x35b7('0x2f')](_0x524d6['query']);_0x1c33bb[_0x35b7('0x30')]=_[_0x35b7('0x31')](_0x1c33bb[_0x35b7('0x32')],_0x1c33bb[_0x35b7('0x2c')]);_0x5bad21[_0x35b7('0x33')]=_['intersection'](_0x1c33bb['model'],qs[_0x35b7('0x34')](_0x524d6['query'][_0x35b7('0x34')]));_0x5bad21[_0x35b7('0x33')]=_0x5bad21['attributes'][_0x35b7('0x35')]?_0x5bad21[_0x35b7('0x33')]:_0x1c33bb[_0x35b7('0x32')];if(!_0x524d6[_0x35b7('0x2c')][_0x35b7('0x42')](_0x35b7('0x43'))){_0x5bad21[_0x35b7('0x16')]=qs[_0x35b7('0x16')](_0x524d6['query'][_0x35b7('0x16')]);_0x5bad21[_0x35b7('0x18')]=qs[_0x35b7('0x18')](_0x524d6[_0x35b7('0x2c')][_0x35b7('0x18')]);}_0x5bad21[_0x35b7('0x44')]=qs[_0x35b7('0x45')](_0x524d6[_0x35b7('0x2c')][_0x35b7('0x45')]);_0x5bad21[_0x35b7('0x46')]=qs[_0x35b7('0x30')](_['pick'](_0x524d6['query'],_0x1c33bb[_0x35b7('0x30')]));_0x5bad21[_0x35b7('0x46')][_0x35b7('0x47')]=_0x777421['id'];if(_0x524d6[_0x35b7('0x2c')][_0x35b7('0x48')]){_0x5bad21[_0x35b7('0x46')]=_[_0x35b7('0x37')](_0x5bad21['where'],{'$or':_[_0x35b7('0x24')](_0x5bad21[_0x35b7('0x33')],function(_0x5b83c0){var _0xd32015={};_0xd32015[_0x5b83c0]={'$like':'%'+_0x524d6['query'][_0x35b7('0x48')]+'%'};return _0xd32015;})});}if(_0x524d6[_0x35b7('0x2c')][_0x35b7('0x49')]){var _0xc74770=_0x524d6[_0x35b7('0x2c')][_0x35b7('0x49')][_0x35b7('0x4a')](',');var _0x115652={};_0x115652[_0xc74770[0x0]]={'$gte':moment(_0xc74770[0x1])[_0x35b7('0x4b')](_0x35b7('0x4c'))};_0x5bad21[_0x35b7('0x46')]=_[_0x35b7('0x37')](_0x5bad21[_0x35b7('0x46')],_0x115652);}_0x5bad21=_['merge']({},_0x5bad21,_0x524d6[_0x35b7('0x38')]);return db[_0x35b7('0x3e')][_0x35b7('0x17')]({'where':_0x5bad21[_0x35b7('0x46')]})[_0x35b7('0x1c')](function(_0x2f8717){_0x3bf184[_0x35b7('0x17')]=_0x2f8717;if(_0x524d6[_0x35b7('0x2c')][_0x35b7('0x36')]){_0x5bad21[_0x35b7('0x4d')]=[{'all':!![]}];}return db[_0x35b7('0x3e')][_0x35b7('0x2a')](_0x5bad21);})[_0x35b7('0x1c')](function(_0x5bf53d){_0x3bf184[_0x35b7('0x4e')]=_0x5bf53d;return _0x3bf184;});}})[_0x35b7('0x1c')](respondWithFilteredResult(_0x7eb219,_0x5bad21))[_0x35b7('0x3a')](handleError(_0x7eb219,null));};exports[_0x35b7('0x4f')]=function(_0x292e08,_0x2db141){return db[_0x35b7('0x25')][_0x35b7('0x39')]({'where':{'id':_0x292e08[_0x35b7('0x2e')]['id']}})[_0x35b7('0x1c')](handleEntityNotFound(_0x2db141,null))[_0x35b7('0x1c')](function(_0x26e049){if(_0x26e049){return _0x26e049[_0x35b7('0x50')](_0x292e08[_0x35b7('0x3c')]['ids'],_[_0x35b7('0x51')](_0x292e08[_0x35b7('0x3c')],['ids','id'])||{})['spread'](function(){return db[_0x35b7('0x52')][_0x35b7('0x2a')]({'attributes':['id',_0x35b7('0x21'),_0x35b7('0x53')],'where':{'id':_0x292e08['body'][_0x35b7('0x3f')]}});})[_0x35b7('0x1c')](function(_0x44a1a1){socket['emit'](_0x35b7('0x54'),{'id':Number(_0x292e08[_0x35b7('0x2e')]['id']),'tags':_0x44a1a1||[]});return{'id':Number(_0x292e08[_0x35b7('0x2e')]['id']),'tags':_0x44a1a1||[]};});}})[_0x35b7('0x1c')](respondWithResult(_0x2db141,null))['catch'](handleError(_0x2db141,null));};exports[_0x35b7('0x55')]=function(_0x9ea3f5,_0x18ea4f){return db['OpenchannelInteraction']['find']({'where':{'id':_0x9ea3f5[_0x35b7('0x2e')]['id']}})[_0x35b7('0x1c')](handleEntityNotFound(_0x18ea4f,null))[_0x35b7('0x1c')](function(_0x594a96){if(_0x594a96){return _0x594a96['removeTags'](_0x9ea3f5[_0x35b7('0x2c')][_0x35b7('0x3f')]);}})[_0x35b7('0x1c')](respondWithStatusCode(_0x18ea4f,null))['catch'](handleError(_0x18ea4f,null));};exports[_0x35b7('0x56')]=function(_0x30867c,_0x1ff3c8){var _0x2e049e=moment()[_0x35b7('0x57')]()[_0x35b7('0x58')]();var _0x4d92bf=path['join'](config[_0x35b7('0x59')],_0x35b7('0x5a'),_0x35b7('0x5b'),_0x35b7('0x5c'));var _0x588735=path[_0x35b7('0x5d')](config[_0x35b7('0x59')],'server','files',_0x35b7('0x5e'));var _0x4cb205=path[_0x35b7('0x5d')](_0x4d92bf,_0x2e049e);var _0x409af1=util['format'](_0x35b7('0x5f'),_0x30867c[_0x35b7('0x2e')]['id'],_0x2e049e);var _0x26184a=path[_0x35b7('0x5d')](_0x4d92bf,_0x409af1);var _0x1b7d27=[];_0x1b7d27['push']({'model':db[_0x35b7('0x60')],'as':_0x35b7('0x60'),'attributes':['id','fullname'],'raw':!![]});_0x1b7d27[_0x35b7('0x61')]({'model':db[_0x35b7('0x62')],'as':_0x35b7('0x63'),'attributes':['id',_0x35b7('0x64'),_0x35b7('0x65')],'raw':!![]});if(_0x30867c[_0x35b7('0x2c')]['attachments']){_0x1b7d27[_0x35b7('0x61')]({'model':db['Attachment'],'as':_0x35b7('0x66'),'raw':!![]});}var _0x512918=[{'model':db[_0x35b7('0x3e')],'as':_0x35b7('0x67'),'attributes':['id',_0x35b7('0x3c'),_0x35b7('0x68'),'direction','secret',_0x35b7('0x69')],'include':_0x1b7d27}];_0x512918[_0x35b7('0x61')]({'model':db['OpenchannelAccount'],'as':_0x35b7('0x6a'),'attributes':['id',_0x35b7('0x21')]});_0x512918['push']({'model':db[_0x35b7('0x60')],'as':'Owner','attributes':['id',_0x35b7('0x6b')]});return db[_0x35b7('0x25')][_0x35b7('0x39')]({'where':{'id':_0x30867c[_0x35b7('0x2e')]['id']},'include':_0x512918})[_0x35b7('0x1c')](handleEntityNotFound(_0x1ff3c8,null))[_0x35b7('0x1c')](function(_0x260e7f){if(_0x260e7f){var _0x67edbe=_0x260e7f['get']({'plain':!![]});fs[_0x35b7('0x6c')](_0x4cb205);var _0x150020={'channel':_0x35b7('0x6d'),'account':_0x67edbe[_0x35b7('0x6a')]['name'],'agent':_0x67edbe[_0x35b7('0x6e')]?_0x67edbe[_0x35b7('0x6e')]['fullname']:'N.A.','createdAt':moment(_0x67edbe[_0x35b7('0x68')])['format'](_0x35b7('0x4c'))[_0x35b7('0x58')](),'closedAt':_0x67edbe[_0x35b7('0x6f')]?moment(_0x67edbe['closedAt'])[_0x35b7('0x4b')](_0x35b7('0x4c'))[_0x35b7('0x58')]():'','disposition':_0x67edbe[_0x35b7('0x70')],'visibility':_0x67edbe[_0x35b7('0x71')]?'Public':'Private','messages':_(_0x67edbe[_0x35b7('0x67')])['filter']({'secret':![]})['map'](function(_0x4c15b6){if(_0x4c15b6[_0x35b7('0x66')]){var _0xc3f0dc=path['join'](_0x588735,_0x4c15b6[_0x35b7('0x66')][_0x35b7('0x72')]);if(fs[_0x35b7('0x73')](_0xc3f0dc)){fs[_0x35b7('0x74')](_0xc3f0dc)['pipe'](fs[_0x35b7('0x75')](path[_0x35b7('0x5d')](_0x4cb205,_0x4c15b6[_0x35b7('0x66')][_0x35b7('0x72')])));}}return{'date':moment(_0x4c15b6[_0x35b7('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x35b7('0x58')](),'sender':_0x4c15b6[_0x35b7('0x76')]===_0x35b7('0x77')?_0x4c15b6[_0x35b7('0x60')]?_0x4c15b6['User'][_0x35b7('0x6b')]:_0x35b7('0x78'):_0x4c15b6['Contact'][_0x35b7('0x64')]+(_0x4c15b6[_0x35b7('0x63')][_0x35b7('0x65')]?'\x20'+_0x4c15b6[_0x35b7('0x63')][_0x35b7('0x65')]:''),'body':_0x4c15b6[_0x35b7('0x66')]?_0x4c15b6[_0x35b7('0x66')][_0x35b7('0x72')]:_0x4c15b6[_0x35b7('0x3c')],'direction':_0x4c15b6[_0x35b7('0x76')]===_0x35b7('0x77')?'A':'C','secret':_0x4c15b6[_0x35b7('0x79')],'read':_0x4c15b6[_0x35b7('0x69')],'attachment':_0x4c15b6['Attachment']};})[_0x35b7('0x7a')]()};return ejs[_0x35b7('0x7b')](path[_0x35b7('0x5d')](config['root'],_0x35b7('0x5a'),_0x35b7('0x7c'),_0x35b7('0x7d')),{'interaction':_0x150020})[_0x35b7('0x1c')](function(_0x14af4c){var _0x5a53b9=path[_0x35b7('0x5d')](_0x4cb205,'transcript-'+_0x67edbe['id']+'-'+_0x2e049e+_0x35b7('0x7e'));var _0x2744fc={'path':_0x5a53b9,'channel':'Openchannel','interactionId':_0x67edbe['id']};return pdf[_0x35b7('0x7f')](_0x14af4c,_0x2744fc);})[_0x35b7('0x1c')](function(){return new Promise(function(_0x5337cc,_0xf54d61){zipdir(_0x4cb205,{'saveTo':_0x26184a},function(_0x3a2120,_0x8dfffb){if(_0x3a2120)return _0xf54d61(_0x3a2120);return _0x5337cc(_0x8dfffb);});})['then'](function(){return new Promise(function(_0x3a0d0a,_0x253064){rimraf(_0x4cb205,function(_0x51be87){if(_0x51be87)_0x253064(_0x51be87);return _0x3a0d0a();});});})[_0x35b7('0x1c')](function(){return _0x1ff3c8[_0x35b7('0x56')](_0x26184a,_0x409af1,function(_0x35e76b){if(_0x35e76b){logger[_0x35b7('0x1f')](_0x35b7('0x80'),_0x35e76b);}else{fs[_0x35b7('0x81')](_0x26184a);}});});});}else{return _0x1ff3c8[_0x35b7('0x1e')](0xc8);}})[_0x35b7('0x3a')](handleError(_0x1ff3c8,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index fa0a62f..8ceb824 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 _0x4384=['getUsers','setDataValue','Users','then','unreadMessages','length','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove'];(function(_0x4ec1a5,_0x580a0d){var _0x240044=function(_0x32b550){while(--_0x32b550){_0x4ec1a5['push'](_0x4ec1a5['shift']());}};_0x240044(++_0x580a0d);}(_0x4384,0x1d9));var _0x4438=function(_0x5f0ae8,_0x294815){_0x5f0ae8=_0x5f0ae8-0x0;var _0x3cbd29=_0x4384[_0x5f0ae8];return _0x3cbd29;};'use strict';var EventEmitter=require(_0x4438('0x0'));var OpenchannelInteraction=require(_0x4438('0x1'))['db'][_0x4438('0x2')];var OpenchannelMessage=require(_0x4438('0x1'))['db'][_0x4438('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4438('0x4')](0x0);var events={'afterCreate':_0x4438('0x5'),'afterUpdate':'update','afterDestroy':_0x4438('0x6')};function emitEvent(_0xae0a7f){return function(_0x4df9c3,_0x3660cf,_0x118705){_0x4df9c3[_0x4438('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1e735d){_0x4df9c3[_0x4438('0x8')](_0x4438('0x9'),_0x1e735d['map'](function(_0xc10c27){return{'id':_0xc10c27['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4df9c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4438('0xa')](function(_0x333ff3){_0x4df9c3['setDataValue'](_0x4438('0xb'),_0x333ff3[_0x4438('0xc')]);OpenchannelInteractionEvents['emit'](_0xae0a7f+':'+_0x4df9c3['id'],_0x4df9c3);OpenchannelInteractionEvents['emit'](_0xae0a7f,_0x4df9c3);_0x118705(null);})['catch'](_0x118705(null));};}for(var e in events){if(events[_0x4438('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x4438('0xe')](e,emitEvent(event));}}module[_0x4438('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x7fde=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch','hook','exports','events'];(function(_0x38a813,_0x4237ef){var _0x512d8c=function(_0x35d17b){while(--_0x35d17b){_0x38a813['push'](_0x38a813['shift']());}};_0x512d8c(++_0x4237ef);}(_0x7fde,0x155));var _0xe7fd=function(_0x2dc1bf,_0x27df12){_0x2dc1bf=_0x2dc1bf-0x0;var _0x4540f9=_0x7fde[_0x2dc1bf];return _0x4540f9;};'use strict';var EventEmitter=require(_0xe7fd('0x0'));var OpenchannelInteraction=require(_0xe7fd('0x1'))['db'][_0xe7fd('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xe7fd('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe7fd('0x4')](0x0);var events={'afterCreate':_0xe7fd('0x5'),'afterUpdate':_0xe7fd('0x6'),'afterDestroy':_0xe7fd('0x7')};function emitEvent(_0x3e4bce){return function(_0x496434,_0x4469a8,_0x39f3fa){_0x496434[_0xe7fd('0x8')]({'attributes':['id'],'raw':!![]})[_0xe7fd('0x9')](function(_0x462ebf){_0x496434[_0xe7fd('0xa')]('Users',_0x462ebf[_0xe7fd('0xb')](function(_0x243dad){return{'id':_0x243dad['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x496434['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe7fd('0x9')](function(_0x10b951){_0x496434[_0xe7fd('0xa')](_0xe7fd('0xc'),_0x10b951[_0xe7fd('0xd')]);OpenchannelInteractionEvents[_0xe7fd('0xe')](_0x3e4bce+':'+_0x496434['id'],_0x496434);OpenchannelInteractionEvents[_0xe7fd('0xe')](_0x3e4bce,_0x496434);_0x39f3fa(null);})[_0xe7fd('0xf')](_0x39f3fa(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xe7fd('0x10')](e,emitEvent(event));}}module[_0xe7fd('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 5f6b089..8f88dca 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 _0x1cb9=['rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x56baac,_0x3de33a){var _0x5b1c1f=function(_0x504359){while(--_0x504359){_0x56baac['push'](_0x56baac['shift']());}};_0x5b1c1f(++_0x3de33a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x13095f,_0x26a744){_0x13095f=_0x13095f-0x0;var _0x31670f=_0x1cb9[_0x13095f];return _0x31670f;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x91cb('0xb'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x2fdfce,_0x4cf9ed,_0xa43e7a){if(_0x2fdfce[_0x91cb('0xc')](_0x91cb('0xd'))){_0x2fdfce[_0x91cb('0xe')]=moment()[_0x91cb('0xf')](_0x91cb('0x10'));}_0xa43e7a(null,_0x2fdfce);}}});}; \ No newline at end of file +var _0x872f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x872f,0x143));var _0xf872=function(_0x107132,_0x13f848){_0x107132=_0x107132-0x0;var _0xeb25b1=_0x872f[_0x107132];return _0xeb25b1;};'use strict';var _=require(_0xf872('0x0'));var util=require(_0xf872('0x1'));var logger=require(_0xf872('0x2'))(_0xf872('0x3'));var moment=require(_0xf872('0x4'));var BPromise=require(_0xf872('0x5'));var rp=require(_0xf872('0x6'));var fs=require('fs');var path=require(_0xf872('0x7'));var rimraf=require(_0xf872('0x8'));var config=require(_0xf872('0x9'));var attributes=require('./openchannelInteraction.attributes');module[_0xf872('0xa')]=function(_0x51e579,_0x11759f){return _0x51e579['define']('OpenchannelInteraction',attributes,{'tableName':_0xf872('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf872('0xc'),'collate':_0xf872('0xd'),'hooks':{'beforeUpdate':function(_0x401ac0,_0x33ad35,_0x5eca3d){if(_0x401ac0[_0xf872('0xe')](_0xf872('0xf'))){_0x401ac0[_0xf872('0x10')]=moment()[_0xf872('0x11')](_0xf872('0x12'));}_0x5eca3d(null,_0x401ac0);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 0765673..a127d12 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 _0x5b63=['AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit'];(function(_0x58f61a,_0xc49331){var _0x37e947=function(_0x1c38c8){while(--_0x1c38c8){_0x58f61a['push'](_0x58f61a['shift']());}};_0x37e947(++_0xc49331);}(_0x5b63,0x135));var _0x35b6=function(_0x2f2a81,_0x1cdfbe){_0x2f2a81=_0x2f2a81-0x0;var _0xecefe8=_0x5b63[_0x2f2a81];return _0xecefe8;};'use strict';var _=require(_0x35b6('0x0'));var util=require(_0x35b6('0x1'));var moment=require(_0x35b6('0x2'));var BPromise=require(_0x35b6('0x3'));var rs=require(_0x35b6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x35b6('0x6'))(_0x35b6('0x7'));var config=require(_0x35b6('0x8'));var jayson=require(_0x35b6('0x9'));var client=jayson['client'][_0x35b6('0xa')]({'port':0x232a});config[_0x35b6('0xb')]=_[_0x35b6('0xc')](config[_0x35b6('0xb')],{'host':_0x35b6('0xd'),'port':0x18eb});var socket=require(_0x35b6('0xe'))(new Redis(config[_0x35b6('0xb')]));require(_0x35b6('0xf'))['register'](socket);function respondWithRpcPromise(_0x4ac87f,_0x4c955d,_0x105a66){return new BPromise(function(_0x23d665,_0x30c3df){return client['request'](_0x4ac87f,_0x105a66)[_0x35b6('0x10')](function(_0x35b767){logger[_0x35b6('0x11')](_0x35b6('0x12'),_0x4c955d,_0x35b6('0x13'));logger['debug'](_0x35b6('0x14'),_0x4c955d,_0x35b6('0x13'),JSON[_0x35b6('0x15')](_0x35b767));if(_0x35b767['error']){if(_0x35b767[_0x35b6('0x16')][_0x35b6('0x17')]===0x1f4){logger[_0x35b6('0x16')](_0x35b6('0x12'),_0x4c955d,_0x35b767['error']['message']);return _0x30c3df(_0x35b767['error']['message']);}logger[_0x35b6('0x16')](_0x35b6('0x12'),_0x4c955d,_0x35b767[_0x35b6('0x16')]['message']);return _0x23d665(_0x35b767[_0x35b6('0x16')]['message']);}else{logger[_0x35b6('0x11')](_0x35b6('0x12'),_0x4c955d,_0x35b6('0x13'));_0x23d665(_0x35b767[_0x35b6('0x18')][_0x35b6('0x19')]);}})[_0x35b6('0x1a')](function(_0x227b86){logger[_0x35b6('0x16')](_0x35b6('0x12'),_0x4c955d,_0x227b86);_0x30c3df(_0x227b86);});});}exports[_0x35b6('0x1b')]=function(_0x3f6911){var _0x14e3aa=this;return new Promise(function(_0xec5edc,_0x1dfee1){return db[_0x35b6('0x1c')][_0x35b6('0x1d')](_0x3f6911[_0x35b6('0x1e')],{'raw':_0x3f6911[_0x35b6('0x1f')]?_0x3f6911[_0x35b6('0x1f')][_0x35b6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f6911[_0x35b6('0x1f')]?_0x3f6911[_0x35b6('0x1f')][_0x35b6('0x21')]||null:null,'attributes':_0x3f6911[_0x35b6('0x1f')]?_0x3f6911['options']['attributes']||null:null,'limit':_0x3f6911[_0x35b6('0x1f')]?_0x3f6911[_0x35b6('0x1f')][_0x35b6('0x22')]||null:null})['then'](function(_0x97d774){logger[_0x35b6('0x11')](_0x35b6('0x1b'),_0x3f6911);logger['debug'](_0x35b6('0x1b'),_0x3f6911,JSON[_0x35b6('0x15')](_0x97d774));_0xec5edc(_0x97d774);})[_0x35b6('0x1a')](function(_0x45a13a){logger[_0x35b6('0x16')](_0x35b6('0x1b'),_0x45a13a[_0x35b6('0x19')],_0x3f6911);_0x1dfee1(_0x14e3aa[_0x35b6('0x16')](0x1f4,_0x45a13a['message']));});});};exports[_0x35b6('0x23')]=function(_0x2c4e33){return new Promise(function(_0x25d037,_0x38a574){return db[_0x35b6('0x1c')][_0x35b6('0x24')]({'where':_0x2c4e33[_0x35b6('0x1f')]?_0x2c4e33[_0x35b6('0x1f')]['where']||null:null})[_0x35b6('0x10')](function(_0x226a11){if(_0x226a11){return _0x226a11[_0x35b6('0x25')](_0x2c4e33['body'][_0x35b6('0x26')],_[_0x35b6('0x27')](_0x2c4e33[_0x35b6('0x1e')],['ids','id'])||{});}})[_0x35b6('0x28')](function(_0x59c1bd){logger[_0x35b6('0x11')](_0x35b6('0x29'),_0x2c4e33);logger[_0x35b6('0x2a')]('AddTags',_0x2c4e33,JSON[_0x35b6('0x15')](_0x59c1bd));_0x25d037(_0x59c1bd);})[_0x35b6('0x1a')](function(_0x5532a3){logger[_0x35b6('0x16')]('AddTags',_0x5532a3[_0x35b6('0x19')],_0x2c4e33);_0x38a574(_this[_0x35b6('0x16')](0x1f4,_0x5532a3[_0x35b6('0x19')]));});});}; \ No newline at end of file +var _0xdfa5=['AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','debug','request\x20sent','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','then','UpdateOpenchannelInteraction'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0xdfa5,0xe3));var _0x5dfa=function(_0x573941,_0x4d02bc){_0x573941=_0x573941-0x0;var _0x40c8d1=_0xdfa5[_0x573941];return _0x40c8d1;};'use strict';var _=require(_0x5dfa('0x0'));var util=require(_0x5dfa('0x1'));var moment=require(_0x5dfa('0x2'));var BPromise=require('bluebird');var rs=require(_0x5dfa('0x3'));var fs=require('fs');var Redis=require(_0x5dfa('0x4'));var db=require(_0x5dfa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dfa('0x6'))(_0x5dfa('0x7'));var config=require(_0x5dfa('0x8'));var jayson=require(_0x5dfa('0x9'));var client=jayson[_0x5dfa('0xa')][_0x5dfa('0xb')]({'port':0x232a});config[_0x5dfa('0xc')]=_[_0x5dfa('0xd')](config[_0x5dfa('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5dfa('0xe'))(new Redis(config[_0x5dfa('0xc')]));require('./openchannelInteraction.socket')[_0x5dfa('0xf')](socket);function respondWithRpcPromise(_0x5b717c,_0x3a4815,_0x5e3c35){return new BPromise(function(_0xce16db,_0x5097c6){return client[_0x5dfa('0x10')](_0x5b717c,_0x5e3c35)['then'](function(_0x8cd14f){logger[_0x5dfa('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3a4815,'request\x20sent');logger[_0x5dfa('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3a4815,_0x5dfa('0x13'),JSON[_0x5dfa('0x14')](_0x8cd14f));if(_0x8cd14f[_0x5dfa('0x15')]){if(_0x8cd14f['error'][_0x5dfa('0x16')]===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3a4815,_0x8cd14f[_0x5dfa('0x15')][_0x5dfa('0x17')]);return _0x5097c6(_0x8cd14f[_0x5dfa('0x15')]['message']);}logger[_0x5dfa('0x15')](_0x5dfa('0x18'),_0x3a4815,_0x8cd14f['error']['message']);return _0xce16db(_0x8cd14f[_0x5dfa('0x15')]['message']);}else{logger[_0x5dfa('0x11')](_0x5dfa('0x18'),_0x3a4815,_0x5dfa('0x13'));_0xce16db(_0x8cd14f[_0x5dfa('0x19')][_0x5dfa('0x17')]);}})[_0x5dfa('0x1a')](function(_0x5f21bf){logger[_0x5dfa('0x15')](_0x5dfa('0x18'),_0x3a4815,_0x5f21bf);_0x5097c6(_0x5f21bf);});});}exports['UpdateOpenchannelInteraction']=function(_0x3ebc6f){var _0x1b5236=this;return new Promise(function(_0xf1e016,_0x1fa869){return db[_0x5dfa('0x1b')][_0x5dfa('0x1c')](_0x3ebc6f[_0x5dfa('0x1d')],{'raw':_0x3ebc6f['options']?_0x3ebc6f[_0x5dfa('0x1e')][_0x5dfa('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ebc6f[_0x5dfa('0x1e')]?_0x3ebc6f[_0x5dfa('0x1e')][_0x5dfa('0x20')]||null:null,'attributes':_0x3ebc6f[_0x5dfa('0x1e')]?_0x3ebc6f[_0x5dfa('0x1e')][_0x5dfa('0x21')]||null:null,'limit':_0x3ebc6f[_0x5dfa('0x1e')]?_0x3ebc6f[_0x5dfa('0x1e')][_0x5dfa('0x22')]||null:null})[_0x5dfa('0x23')](function(_0x419ad4){logger['info'](_0x5dfa('0x24'),_0x3ebc6f);logger[_0x5dfa('0x12')](_0x5dfa('0x24'),_0x3ebc6f,JSON['stringify'](_0x419ad4));_0xf1e016(_0x419ad4);})['catch'](function(_0xb8ed5a){logger[_0x5dfa('0x15')](_0x5dfa('0x24'),_0xb8ed5a['message'],_0x3ebc6f);_0x1fa869(_0x1b5236['error'](0x1f4,_0xb8ed5a[_0x5dfa('0x17')]));});});};exports[_0x5dfa('0x25')]=function(_0x375451){return new Promise(function(_0x1826e8,_0x291bf0){return db[_0x5dfa('0x1b')][_0x5dfa('0x26')]({'where':_0x375451[_0x5dfa('0x1e')]?_0x375451[_0x5dfa('0x1e')][_0x5dfa('0x20')]||null:null})[_0x5dfa('0x23')](function(_0x268c9f){if(_0x268c9f){return _0x268c9f[_0x5dfa('0x27')](_0x375451[_0x5dfa('0x1d')][_0x5dfa('0x28')],_[_0x5dfa('0x29')](_0x375451[_0x5dfa('0x1d')],[_0x5dfa('0x28'),'id'])||{});}})[_0x5dfa('0x2a')](function(_0x3e7e1){logger[_0x5dfa('0x11')]('AddTags',_0x375451);logger['debug'](_0x5dfa('0x2b'),_0x375451,JSON[_0x5dfa('0x14')](_0x3e7e1));_0x1826e8(_0x3e7e1);})[_0x5dfa('0x1a')](function(_0x113c16){logger[_0x5dfa('0x15')](_0x5dfa('0x2b'),_0x113c16['message'],_0x375451);_0x291bf0(_this[_0x5dfa('0x15')](0x1f4,_0x113c16[_0x5dfa('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index bfdfdd0..ff8668f 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 _0xa6f4=['save','remove','update','removeListener','register','openchannelInteraction:'];(function(_0x1f52ea,_0x1dd436){var _0x2d4b16=function(_0x3cee20){while(--_0x3cee20){_0x1f52ea['push'](_0x1f52ea['shift']());}};_0x2d4b16(++_0x1dd436);}(_0xa6f4,0xf6));var _0x4a6f=function(_0x22907f,_0x4d4987){_0x22907f=_0x22907f-0x0;var _0x43b8f4=_0xa6f4[_0x22907f];return _0x43b8f4;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x4a6f('0x0'),_0x4a6f('0x1'),_0x4a6f('0x2')];function createListener(_0x5c1ad9,_0x5de6ed){return function(_0xe7617b){_0x5de6ed['emit'](_0x5c1ad9,_0xe7617b);};}function removeListener(_0x241248,_0x560cb3){return function(){OpenchannelInteractionEvents[_0x4a6f('0x3')](_0x241248,_0x560cb3);};}exports[_0x4a6f('0x4')]=function(_0x210c59){for(var _0x43821b=0x0,_0x25a618=events['length'];_0x43821b<_0x25a618;_0x43821b++){var _0x59d73f=events[_0x43821b];var _0x35a8e6=createListener(_0x4a6f('0x5')+_0x59d73f,_0x210c59);OpenchannelInteractionEvents['on'](_0x59d73f,_0x35a8e6);}}; \ No newline at end of file +var _0x9730=['emit','removeListener','register','openchannelInteraction:','remove','update'];(function(_0x340a19,_0x202a1a){var _0xf74ad4=function(_0x33a747){while(--_0x33a747){_0x340a19['push'](_0x340a19['shift']());}};_0xf74ad4(++_0x202a1a);}(_0x9730,0x94));var _0x0973=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9730[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x0973('0x0'),_0x0973('0x1')];function createListener(_0x44e926,_0x402e47){return function(_0x42c4da){_0x402e47[_0x0973('0x2')](_0x44e926,_0x42c4da);};}function removeListener(_0x1e2be6,_0x1206e7){return function(){OpenchannelInteractionEvents[_0x0973('0x3')](_0x1e2be6,_0x1206e7);};}exports[_0x0973('0x4')]=function(_0x5ab780){for(var _0x232857=0x0,_0x35d035=events['length'];_0x232857<_0x35d035;_0x232857++){var _0x2e741b=events[_0x232857];var _0x2c708e=createListener(_0x0973('0x5')+_0x2e741b,_0x5ab780);OpenchannelInteractionEvents['on'](_0x2e741b,_0x2c708e);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d514efb..d03d847 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x762d25,_0x2a0f34){var _0x15d568=function(_0x2ad0f9){while(--_0x2ad0f9){_0x762d25['push'](_0x762d25['shift']());}};_0x15d568(++_0x2a0f34);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +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(_0x367c0e,_0x1332d8){var _0x33509c=function(_0x1ce23b){while(--_0x1ce23b){_0x367c0e['push'](_0x367c0e['shift']());}};_0x33509c(++_0x1332d8);}(_0xe706,0xa3));var _0x6e70=function(_0x3b58e2,_0x4fbf5f){_0x3b58e2=_0x3b58e2-0x0;var _0x5a6677=_0xe706[_0x3b58e2];return _0x5a6677;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 50abda9..eac7e2f 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x117c=['ENUM','out','DATE','STRING','TEXT','medium'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x117c,0x71));var _0xc117=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x117c[_0x3a7a9c];return _0x59156e;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xc117('0x0')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc117('0x1')]('in',_0xc117('0x2')),'defaultValue':_0xc117('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc117('0x3')]},'providerName':{'type':Sequelize[_0xc117('0x4')]},'providerResponse':{'type':Sequelize[_0xc117('0x5')]}}; \ No newline at end of file +var _0x9000=['sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x54b513,_0x8099df){var _0x2fe99d=function(_0x5d3eff){while(--_0x5d3eff){_0x54b513['push'](_0x54b513['shift']());}};_0x2fe99d(++_0x8099df);}(_0x9000,0x19e));var _0x0900=function(_0x2ea20d,_0x5e8e3c){_0x2ea20d=_0x2ea20d-0x0;var _0x3ba66a=_0x9000[_0x2ea20d];return _0x3ba66a;};'use strict';var Sequelize=require(_0x0900('0x0'));module[_0x0900('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0900('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0900('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0900('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0900('0x4')]('in',_0x0900('0x5')),'defaultValue':_0x0900('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0900('0x6')]},'providerName':{'type':Sequelize[_0x0900('0x7')]},'providerResponse':{'type':Sequelize[_0x0900('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 146071f..a4e25eb 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 _0xc6aa=['bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','./openchannelMessage.socket','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','OpenchannelMessage','includeAll','findAll','show','params','include','create','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','User','internal','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x202174,_0x3b10d8){var _0x55cc42=function(_0x4e86f9){while(--_0x4e86f9){_0x202174['push'](_0x202174['shift']());}};_0x55cc42(++_0x3b10d8);}(_0xc6aa,0x1f4));var _0xac6a=function(_0x4deb0c,_0x2c2ef2){_0x4deb0c=_0x4deb0c-0x0;var _0x515a0b=_0xc6aa[_0x4deb0c];return _0x515a0b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xac6a('0x0'));var jsonpatch=require(_0xac6a('0x1'));var rp=require(_0xac6a('0x2'));var moment=require(_0xac6a('0x3'));var BPromise=require(_0xac6a('0x4'));var Mustache=require(_0xac6a('0x5'));var util=require('util');var path=require(_0xac6a('0x6'));var sox=require('sox');var csv=require(_0xac6a('0x7'));var ejs=require(_0xac6a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xac6a('0x9'));var crypto=require(_0xac6a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xac6a('0xb'));var toCsv=require(_0xac6a('0x7'));var querystring=require(_0xac6a('0xc'));var Papa=require(_0xac6a('0xd'));var Redis=require(_0xac6a('0xe'));var authService=require(_0xac6a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xac6a('0x10'))(_0xac6a('0x11'));var utils=require(_0xac6a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac6a('0x13'))['db'];config['redis']=_[_0xac6a('0x14')](config[_0xac6a('0x15')],{'host':_0xac6a('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac6a('0x15')]));require(_0xac6a('0x17'))[_0xac6a('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xac6a('0x19')][_0xac6a('0x1a')]({'port':0x232c});var client9002=jayson[_0xac6a('0x19')][_0xac6a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x57ebd2,_0x3b3354,_0x90c4d4,_0x3c99fc){return new BPromise(function(_0x4f923d,_0x4b7669){var _0x9a8158=_0x3c99fc||client;return _0x9a8158[_0xac6a('0x1b')](_0x57ebd2,_0x90c4d4)[_0xac6a('0x1c')](function(_0x134c94){logger[_0xac6a('0x1d')](_0xac6a('0x1e'),_0x3b3354,_0xac6a('0x1f'));logger[_0xac6a('0x20')](_0xac6a('0x21'),_0x3b3354,'request\x20sent',JSON[_0xac6a('0x22')](_0x134c94));if(_0x134c94[_0xac6a('0x23')]){if(_0x134c94['error'][_0xac6a('0x24')]===0x1f4){logger[_0xac6a('0x23')](_0xac6a('0x1e'),_0x3b3354,_0x134c94['error'][_0xac6a('0x25')]);return _0x4b7669(_0x134c94[_0xac6a('0x23')][_0xac6a('0x25')]);}logger[_0xac6a('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b3354,_0x134c94[_0xac6a('0x23')][_0xac6a('0x25')]);return _0x4f923d(_0x134c94[_0xac6a('0x23')][_0xac6a('0x25')]);}else{logger[_0xac6a('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b3354,_0xac6a('0x1f'));_0x4f923d(_0x134c94[_0xac6a('0x26')][_0xac6a('0x25')]);}})[_0xac6a('0x27')](function(_0x566362){logger[_0xac6a('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x3b3354,_0x566362);_0x4b7669(_0x566362);});});}function respondWithStatusCode(_0x53813b,_0x55e0bb){_0x55e0bb=_0x55e0bb||0xcc;return function(_0x3a0af5){if(_0x3a0af5){return _0x53813b['sendStatus'](_0x55e0bb);}return _0x53813b[_0xac6a('0x28')](_0x55e0bb)['end']();};}function respondWithResult(_0x27dd64,_0x3d9854){_0x3d9854=_0x3d9854||0xc8;return function(_0x5a2fcc){if(_0x5a2fcc){return _0x27dd64[_0xac6a('0x28')](_0x3d9854)['json'](_0x5a2fcc);}};}function respondWithFilteredResult(_0x2b4527,_0x159171){return function(_0x524336){if(_0x524336){var _0x4eeae0=typeof _0x159171[_0xac6a('0x29')]===_0xac6a('0x2a')&&typeof _0x159171[_0xac6a('0x2b')]==='undefined';var _0x4cb71e=_0x524336[_0xac6a('0x2c')];var _0x11e528=_0x4eeae0?0x0:_0x159171[_0xac6a('0x29')];var _0x242442=_0x4eeae0?_0x524336[_0xac6a('0x2c')]:_0x159171[_0xac6a('0x29')]+_0x159171[_0xac6a('0x2b')];var _0x39f0c6;if(_0x242442>=_0x4cb71e){_0x242442=_0x4cb71e;_0x39f0c6=0xc8;}else{_0x39f0c6=0xce;}_0x2b4527['status'](_0x39f0c6);return _0x2b4527['set']('Content-Range',_0x11e528+'-'+_0x242442+'/'+_0x4cb71e)['json'](_0x524336);}return null;};}function patchUpdates(_0x2e8010){return function(_0x556364){try{jsonpatch['apply'](_0x556364,_0x2e8010,!![]);}catch(_0x484f6d){return BPromise['reject'](_0x484f6d);}return _0x556364[_0xac6a('0x2d')]();};}function saveUpdates(_0x242566,_0x5d579c){return function(_0xf37edc){if(_0xf37edc){return _0xf37edc[_0xac6a('0x2e')](_0x242566)[_0xac6a('0x1c')](function(_0x38ccf5){return _0x38ccf5;});}return null;};}function removeEntity(_0x4b112f,_0x14d66a){return function(_0x5e39f3){if(_0x5e39f3){return _0x5e39f3[_0xac6a('0x2f')]()[_0xac6a('0x1c')](function(){_0x4b112f[_0xac6a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c0f68,_0x584ba2){return function(_0x1cf812){if(!_0x1cf812){_0x4c0f68[_0xac6a('0x30')](0x194);}return _0x1cf812;};}function handleError(_0x4a5de0,_0x36aa0a){_0x36aa0a=_0x36aa0a||0x1f4;return function(_0x4c7e10){logger[_0xac6a('0x23')](_0x4c7e10[_0xac6a('0x31')]);if(_0x4c7e10['name']){delete _0x4c7e10[_0xac6a('0x32')];}_0x4a5de0[_0xac6a('0x28')](_0x36aa0a)[_0xac6a('0x33')](_0x4c7e10);};}exports['index']=function(_0x3b1b7c,_0x2cb2a1){var _0x88bb0a={},_0x1a4bcd={},_0x514ccd={'count':0x0,'rows':[]};var _0x218e96=_[_0xac6a('0x34')](db['OpenchannelMessage'][_0xac6a('0x35')],function(_0x2b1fa5){return{'name':_0x2b1fa5['fieldName'],'type':_0x2b1fa5['type'][_0xac6a('0x36')]};});_0x1a4bcd[_0xac6a('0x37')]=_[_0xac6a('0x34')](_0x218e96,'name');_0x1a4bcd[_0xac6a('0x38')]=_[_0xac6a('0x39')](_0x3b1b7c[_0xac6a('0x38')]);_0x1a4bcd[_0xac6a('0x3a')]=_[_0xac6a('0x3b')](_0x1a4bcd['model'],_0x1a4bcd[_0xac6a('0x38')]);_0x88bb0a['attributes']=_[_0xac6a('0x3b')](_0x1a4bcd[_0xac6a('0x37')],qs[_0xac6a('0x3c')](_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x3c')]));_0x88bb0a[_0xac6a('0x3d')]=_0x88bb0a[_0xac6a('0x3d')][_0xac6a('0x3e')]?_0x88bb0a[_0xac6a('0x3d')]:_0x1a4bcd['model'];if(!_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x3f')](_0xac6a('0x40'))){_0x88bb0a['limit']=qs[_0xac6a('0x2b')](_0x3b1b7c[_0xac6a('0x38')]['limit']);_0x88bb0a[_0xac6a('0x29')]=qs['offset'](_0x3b1b7c['query'][_0xac6a('0x29')]);}_0x88bb0a[_0xac6a('0x41')]=qs[_0xac6a('0x42')](_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x42')]);_0x88bb0a[_0xac6a('0x43')]=qs['filters'](_['pick'](_0x3b1b7c[_0xac6a('0x38')],_0x1a4bcd[_0xac6a('0x3a')]),_0x218e96);if(_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x44')]){_0x88bb0a[_0xac6a('0x43')]=_['merge'](_0x88bb0a[_0xac6a('0x43')],{'$or':_[_0xac6a('0x34')](_0x218e96,function(_0x4df8c6){if(_0x4df8c6['type']!==_0xac6a('0x45')){var _0x4bbe01={};_0x4bbe01[_0x4df8c6[_0xac6a('0x32')]]={'$like':'%'+_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x44')]+'%'};return _0x4bbe01;}})});}_0x88bb0a=_[_0xac6a('0x46')]({},_0x88bb0a,_0x3b1b7c[_0xac6a('0x47')]);var _0xcec744={'where':_0x88bb0a[_0xac6a('0x43')]};return db[_0xac6a('0x48')][_0xac6a('0x2c')](_0xcec744)[_0xac6a('0x1c')](function(_0x1b0c51){_0x514ccd[_0xac6a('0x2c')]=_0x1b0c51;if(_0x3b1b7c[_0xac6a('0x38')][_0xac6a('0x49')]){_0x88bb0a['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xac6a('0x4a')](_0x88bb0a);})['then'](function(_0x46c61f){_0x514ccd['rows']=_0x46c61f;return _0x514ccd;})['then'](respondWithFilteredResult(_0x2cb2a1,_0x88bb0a))[_0xac6a('0x27')](handleError(_0x2cb2a1,null));};exports[_0xac6a('0x4b')]=function(_0x3fb683,_0x3d309e){var _0x1358fe={'raw':!![],'where':{'id':_0x3fb683[_0xac6a('0x4c')]['id']}},_0x47804a={};_0x47804a[_0xac6a('0x37')]=_[_0xac6a('0x39')](db[_0xac6a('0x48')][_0xac6a('0x35')]);_0x47804a[_0xac6a('0x38')]=_[_0xac6a('0x39')](_0x3fb683[_0xac6a('0x38')]);_0x47804a[_0xac6a('0x3a')]=_['intersection'](_0x47804a[_0xac6a('0x37')],_0x47804a[_0xac6a('0x38')]);_0x1358fe[_0xac6a('0x3d')]=_['intersection'](_0x47804a[_0xac6a('0x37')],qs[_0xac6a('0x3c')](_0x3fb683[_0xac6a('0x38')][_0xac6a('0x3c')]));_0x1358fe[_0xac6a('0x3d')]=_0x1358fe[_0xac6a('0x3d')][_0xac6a('0x3e')]?_0x1358fe[_0xac6a('0x3d')]:_0x47804a['model'];if(_0x3fb683[_0xac6a('0x38')][_0xac6a('0x49')]){_0x1358fe[_0xac6a('0x4d')]=[{'all':!![]}];}_0x1358fe=_[_0xac6a('0x46')]({},_0x1358fe,_0x3fb683[_0xac6a('0x47')]);return db[_0xac6a('0x48')]['find'](_0x1358fe)[_0xac6a('0x1c')](handleEntityNotFound(_0x3d309e,null))[_0xac6a('0x1c')](respondWithResult(_0x3d309e,null))[_0xac6a('0x27')](handleError(_0x3d309e,null));};exports[_0xac6a('0x4e')]=function(_0x49bc51,_0x120b8c){return db[_0xac6a('0x48')][_0xac6a('0x4e')](_0x49bc51[_0xac6a('0x4f')],{})['then'](respondWithResult(_0x120b8c,0xc9))[_0xac6a('0x27')](handleError(_0x120b8c,null));};exports[_0xac6a('0x2e')]=function(_0x54bfb0,_0x1f9c69){if(_0x54bfb0[_0xac6a('0x4f')]['id']){delete _0x54bfb0[_0xac6a('0x4f')]['id'];}return db[_0xac6a('0x48')][_0xac6a('0x50')]({'where':{'id':_0x54bfb0[_0xac6a('0x4c')]['id']}})[_0xac6a('0x1c')](handleEntityNotFound(_0x1f9c69,null))[_0xac6a('0x1c')](saveUpdates(_0x54bfb0[_0xac6a('0x4f')],null))[_0xac6a('0x1c')](respondWithResult(_0x1f9c69,null))['catch'](handleError(_0x1f9c69,null));};exports[_0xac6a('0x2f')]=function(_0x5ec7af,_0x1999e2){return db[_0xac6a('0x48')]['find']({'where':{'id':_0x5ec7af[_0xac6a('0x4c')]['id']}})[_0xac6a('0x1c')](handleEntityNotFound(_0x1999e2,null))[_0xac6a('0x1c')](removeEntity(_0x1999e2,null))[_0xac6a('0x27')](handleError(_0x1999e2,null));};exports[_0xac6a('0x51')]=function(_0xeff2a1,_0x509146){return db[_0xac6a('0x48')]['describe']()[_0xac6a('0x1c')](respondWithResult(_0x509146,null))['catch'](handleError(_0x509146,null));};var interaction_log=require('../../config/logger')(_0xac6a('0x52'));exports[_0xac6a('0x53')]=function(_0x29b686,_0x587262,_0x49f8de){var _0x1b9305={'agent':{},'channel':_0xac6a('0x54')};if(_0x29b686[_0xac6a('0x4f')]['id']){delete _0x29b686['body']['id'];}_0x29b686[_0xac6a('0x4f')][_0xac6a('0x55')]=!![];_0x29b686['body'][_0xac6a('0x56')]=moment()[_0xac6a('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')]=_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')]||_0x29b686[_0xac6a('0x59')]['id'];_0x1b9305[_0xac6a('0x5a')]['id']=_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')];return db[_0xac6a('0x48')][_0xac6a('0x50')]({'where':{'id':_0x29b686[_0xac6a('0x4c')]['id'],'UserId':null}})[_0xac6a('0x1c')](handleEntityNotFound(_0x587262,null))[_0xac6a('0x1c')](saveUpdates(_0x29b686[_0xac6a('0x4f')],null))[_0xac6a('0x1c')](function(_0x561ac5){if(_0x561ac5){_0x1b9305[_0xac6a('0x25')]=_0x561ac5['get']({'plain':!![]});return db[_0xac6a('0x5b')]['find']({'where':{'id':_0x561ac5[_0xac6a('0x5c')]}});}return null;})[_0xac6a('0x1c')](handleEntityNotFound(_0x587262,null))[_0xac6a('0x1c')](function(_0x231743){if(_0x231743){return _0x231743[_0xac6a('0x2e')]({'UserId':_0x29b686[_0xac6a('0x4f')]['UserId'],'read1stAt':_[_0xac6a('0x5d')](_0x231743[_0xac6a('0x5e')])?moment()['format'](_0xac6a('0x5f')):undefined});}return null;})[_0xac6a('0x1c')](function(_0x18cda){if(_0x18cda){_0x1b9305[_0xac6a('0x60')]=_0x18cda['get']({'plain':!![]});interaction_log[_0xac6a('0x1d')](_0xac6a('0x61'),_0x29b686[_0xac6a('0x59')]['id'],_0x29b686['user'][_0xac6a('0x32')],_0x29b686[_0xac6a('0x59')][_0xac6a('0x62')],_0x1b9305[_0xac6a('0x60')]['id'],_0x29b686[_0xac6a('0x4f')]?JSON['stringify'](_0x29b686[_0xac6a('0x4f')]):_0xac6a('0x63'));return respondWithRpcPromise(_0xac6a('0x64'),_0xac6a('0x65'),_0x1b9305);}return null;})[_0xac6a('0x1c')](function(_0x199c3b){var _0x562d49=_0xac6a('0x66')+_0x199c3b[_0xac6a('0x25')][_0xac6a('0x67')];return db[_0xac6a('0x68')][_0xac6a('0x38')](_0x562d49,{'type':db[_0xac6a('0x69')]['QueryTypes'][_0xac6a('0x6a')],'raw':!![]})['then'](function(_0x4c57ec){return _0x4c57ec;});})['then'](function(_0x5b7c44){if(_0x5b7c44){_0x1b9305['message'][_0xac6a('0x6b')]=_0x5b7c44[0x0];if(!_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')])return;return db['User'][_0xac6a('0x50')]({'where':{'id':_0x29b686[_0xac6a('0x4f')][_0xac6a('0x58')],'role':_0xac6a('0x5a')},'attributes':['id',_0xac6a('0x32'),_0xac6a('0x6c'),_0xac6a('0x6d'),'internal'],'raw':!![]});}return null;})[_0xac6a('0x1c')](function(_0x7798ec){if(!_0x7798ec)return null;_0x1b9305['message'][_0xac6a('0x5a')]=_0x7798ec;return _0x1b9305;})[_0xac6a('0x1c')](function(_0x58f659){if(_0x58f659){if(_0x29b686[_0xac6a('0x4f')][_0xac6a('0x6e')]){_0x1b9305[_0xac6a('0x25')][_0xac6a('0x6f')]=util[_0xac6a('0x57')](_0xac6a('0x70'),_0x29b686['user'][_0xac6a('0x32')]);_0x1b9305[_0xac6a('0x25')][_0xac6a('0x71')]=_0x1b9305[_0xac6a('0x71')];_0x1b9305[_0xac6a('0x25')][_0xac6a('0x72')]=_0x1b9305[_0xac6a('0x71')];_0x1b9305['message'][_0xac6a('0x73')]=_0xac6a('0x53');return respondWithRpcPromise(_0xac6a('0x74'),_0xac6a('0x74'),{'event':_0xac6a('0x75'),'message':_0x1b9305['message']},client9002)[_0xac6a('0x1c')](function(){return _0x1b9305;});}return _0x1b9305;}return null;})[_0xac6a('0x1c')](respondWithResult(_0x587262,null))[_0xac6a('0x27')](handleError(_0x587262,null));};var interaction_log=require(_0xac6a('0x10'))('openchannel-interactions');exports[_0xac6a('0x76')]=function(_0x24f735,_0x327adc,_0x107a7f){var _0x55f4f1={'agent':{},'channel':_0xac6a('0x54')};if(_0x24f735[_0xac6a('0x4f')]['id']){delete _0x24f735[_0xac6a('0x4f')]['id'];}_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')]=_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')]||_0x24f735[_0xac6a('0x59')]['id'];_0x55f4f1[_0xac6a('0x5a')]['id']=_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')];return db[_0xac6a('0x48')]['find']({'where':{'id':_0x24f735[_0xac6a('0x4c')]['id'],'UserId':null}})[_0xac6a('0x1c')](handleEntityNotFound(_0x327adc,null))['then'](function(_0x1308d1){if(_0x1308d1){_0x55f4f1['message']=_0x1308d1[_0xac6a('0x77')]({'plain':!![]});return db['OpenchannelInteraction'][_0xac6a('0x50')]({'where':{'id':_0x1308d1[_0xac6a('0x5c')]}});}return null;})['then'](handleEntityNotFound(_0x327adc,null))['then'](function(_0x232379){if(_0x232379){_0x55f4f1[_0xac6a('0x60')]=_0x232379[_0xac6a('0x77')]({'plain':!![]});interaction_log['info'](_0xac6a('0x78'),_0x24f735[_0xac6a('0x59')]['id'],_0x24f735[_0xac6a('0x59')]['name'],_0x24f735[_0xac6a('0x59')][_0xac6a('0x62')],_0x55f4f1[_0xac6a('0x60')]['id'],_0x24f735[_0xac6a('0x4f')]?JSON[_0xac6a('0x22')](_0x24f735['body']):_0xac6a('0x63'));return respondWithRpcPromise(_0xac6a('0x79'),_0xac6a('0x7a'),_0x55f4f1);}return null;})[_0xac6a('0x1c')](function(_0x212d05){var _0xf60c2b=_0xac6a('0x66')+_0x212d05[_0xac6a('0x25')]['ContactId'];return db['sequelize'][_0xac6a('0x38')](_0xf60c2b,{'type':db['Sequelize'][_0xac6a('0x7b')][_0xac6a('0x6a')],'raw':!![]})['then'](function(_0x50690a){return _0x50690a;});})[_0xac6a('0x1c')](function(_0x184df2){if(_0x184df2){_0x55f4f1[_0xac6a('0x25')][_0xac6a('0x6b')]=_0x184df2[0x0];if(!_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')])return;return db[_0xac6a('0x7c')][_0xac6a('0x50')]({'where':{'id':_0x24f735[_0xac6a('0x4f')][_0xac6a('0x58')],'role':_0xac6a('0x5a')},'attributes':['id','name',_0xac6a('0x6c'),_0xac6a('0x6d'),_0xac6a('0x7d')],'raw':!![]});}return null;})['then'](function(_0x1151fc){if(!_0x1151fc)return null;_0x55f4f1['message'][_0xac6a('0x5a')]=_0x1151fc;return _0x55f4f1;})[_0xac6a('0x1c')](function(_0x17e723){if(_0x17e723){_0x17e723[_0xac6a('0x25')][_0xac6a('0x6f')]=util[_0xac6a('0x57')](_0xac6a('0x70'),_0x24f735[_0xac6a('0x59')]['name']);_0x17e723['message']['channel']=_0x55f4f1[_0xac6a('0x71')];_0x17e723['message'][_0xac6a('0x72')]=_0x55f4f1['channel'];_0x17e723[_0xac6a('0x25')]['event']=_0xac6a('0x76');respondWithRpcPromise(_0xac6a('0x74'),'EventManager',{'event':'rejectmessage','message':_0x17e723[_0xac6a('0x25')]},client9002);return _0x55f4f1;}return null;})[_0xac6a('0x1c')](respondWithResult(_0x327adc,null))[_0xac6a('0x27')](handleError(_0x327adc,null));}; \ No newline at end of file +var _0x27d8=['model','keys','query','filters','intersection','attributes','fields','length','offset','order','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','fullname','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','SELECT','User','email','internal','event','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','undefined','count','limit','set','apply','reject','update','destroy','end','stack','name','index','map','OpenchannelMessage','rawAttributes','type'];(function(_0x5c4178,_0x11471c){var _0x384e71=function(_0x4ff0db){while(--_0x4ff0db){_0x5c4178['push'](_0x5c4178['shift']());}};_0x384e71(++_0x11471c);}(_0x27d8,0x13f));var _0x827d=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0x27d8[_0x17882c];return _0x355a59;};'use strict';var emlformat=require(_0x827d('0x0'));var rimraf=require(_0x827d('0x1'));var zipdir=require(_0x827d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x827d('0x3'));var moment=require(_0x827d('0x4'));var BPromise=require(_0x827d('0x5'));var Mustache=require(_0x827d('0x6'));var util=require(_0x827d('0x7'));var path=require(_0x827d('0x8'));var sox=require(_0x827d('0x9'));var csv=require(_0x827d('0xa'));var ejs=require(_0x827d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x827d('0xc'));var crypto=require(_0x827d('0xd'));var jsforce=require(_0x827d('0xe'));var deskjs=require(_0x827d('0xf'));var toCsv=require(_0x827d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x827d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x827d('0x11'));var hardwareService=require(_0x827d('0x12'));var logger=require(_0x827d('0x13'))(_0x827d('0x14'));var utils=require(_0x827d('0x15'));var config=require(_0x827d('0x16'));var licenseUtil=require(_0x827d('0x17'));var db=require(_0x827d('0x18'))['db'];config['redis']=_['defaults'](config[_0x827d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x827d('0x1a'))(new Redis(config[_0x827d('0x19')]));require(_0x827d('0x1b'))[_0x827d('0x1c')](socket);var jayson=require(_0x827d('0x1d'));var client=jayson[_0x827d('0x1e')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x198bd4,_0x3103e7,_0x2d94c6,_0x5406a7){return new BPromise(function(_0x116400,_0x3e715a){var _0x26f4de=_0x5406a7||client;return _0x26f4de[_0x827d('0x1f')](_0x198bd4,_0x2d94c6)[_0x827d('0x20')](function(_0x265ce3){logger[_0x827d('0x21')](_0x827d('0x22'),_0x3103e7,_0x827d('0x23'));logger[_0x827d('0x24')](_0x827d('0x25'),_0x3103e7,'request\x20sent',JSON[_0x827d('0x26')](_0x265ce3));if(_0x265ce3[_0x827d('0x27')]){if(_0x265ce3[_0x827d('0x27')][_0x827d('0x28')]===0x1f4){logger[_0x827d('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x3103e7,_0x265ce3[_0x827d('0x27')][_0x827d('0x29')]);return _0x3e715a(_0x265ce3[_0x827d('0x27')][_0x827d('0x29')]);}logger[_0x827d('0x27')](_0x827d('0x22'),_0x3103e7,_0x265ce3['error']['message']);return _0x116400(_0x265ce3[_0x827d('0x27')]['message']);}else{logger[_0x827d('0x21')](_0x827d('0x22'),_0x3103e7,_0x827d('0x23'));_0x116400(_0x265ce3[_0x827d('0x2a')][_0x827d('0x29')]);}})['catch'](function(_0x5f504c){logger[_0x827d('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x3103e7,_0x5f504c);_0x3e715a(_0x5f504c);});});}function respondWithStatusCode(_0x39611c,_0x267bde){_0x267bde=_0x267bde||0xcc;return function(_0x28a20f){if(_0x28a20f){return _0x39611c[_0x827d('0x2b')](_0x267bde);}return _0x39611c[_0x827d('0x2c')](_0x267bde)['end']();};}function respondWithResult(_0x324ae9,_0x3b2012){_0x3b2012=_0x3b2012||0xc8;return function(_0x383015){if(_0x383015){return _0x324ae9[_0x827d('0x2c')](_0x3b2012)[_0x827d('0x2d')](_0x383015);}};}function respondWithFilteredResult(_0x551a61,_0x1671a2){return function(_0x4b6759){if(_0x4b6759){var _0x544b16=typeof _0x1671a2['offset']===_0x827d('0x2e')&&typeof _0x1671a2['limit']==='undefined';var _0x40209e=_0x4b6759[_0x827d('0x2f')];var _0x3996a9=_0x544b16?0x0:_0x1671a2['offset'];var _0x2bfd70=_0x544b16?_0x4b6759[_0x827d('0x2f')]:_0x1671a2['offset']+_0x1671a2[_0x827d('0x30')];var _0x12b016;if(_0x2bfd70>=_0x40209e){_0x2bfd70=_0x40209e;_0x12b016=0xc8;}else{_0x12b016=0xce;}_0x551a61['status'](_0x12b016);return _0x551a61[_0x827d('0x31')]('Content-Range',_0x3996a9+'-'+_0x2bfd70+'/'+_0x40209e)[_0x827d('0x2d')](_0x4b6759);}return null;};}function patchUpdates(_0x41e17e){return function(_0x91ab6b){try{jsonpatch[_0x827d('0x32')](_0x91ab6b,_0x41e17e,!![]);}catch(_0x5f50e5){return BPromise[_0x827d('0x33')](_0x5f50e5);}return _0x91ab6b['save']();};}function saveUpdates(_0x2bef14,_0x24c711){return function(_0x3489bb){if(_0x3489bb){return _0x3489bb[_0x827d('0x34')](_0x2bef14)['then'](function(_0x16453b){return _0x16453b;});}return null;};}function removeEntity(_0x1f39cf,_0xb8c426){return function(_0x4e849c){if(_0x4e849c){return _0x4e849c[_0x827d('0x35')]()[_0x827d('0x20')](function(){_0x1f39cf[_0x827d('0x2c')](0xcc)[_0x827d('0x36')]();});}};}function handleEntityNotFound(_0x3ee06d,_0x2bdd3f){return function(_0x509f51){if(!_0x509f51){_0x3ee06d[_0x827d('0x2b')](0x194);}return _0x509f51;};}function handleError(_0x13db0e,_0x3fd4d7){_0x3fd4d7=_0x3fd4d7||0x1f4;return function(_0x566296){logger[_0x827d('0x27')](_0x566296[_0x827d('0x37')]);if(_0x566296[_0x827d('0x38')]){delete _0x566296[_0x827d('0x38')];}_0x13db0e[_0x827d('0x2c')](_0x3fd4d7)['send'](_0x566296);};}exports[_0x827d('0x39')]=function(_0x2fbd52,_0x371718){var _0x51b3ac={},_0x123108={},_0x2483ca={'count':0x0,'rows':[]};var _0xdd27a8=_[_0x827d('0x3a')](db[_0x827d('0x3b')][_0x827d('0x3c')],function(_0x19c33c){return{'name':_0x19c33c['fieldName'],'type':_0x19c33c[_0x827d('0x3d')]['key']};});_0x123108[_0x827d('0x3e')]=_[_0x827d('0x3a')](_0xdd27a8,_0x827d('0x38'));_0x123108['query']=_[_0x827d('0x3f')](_0x2fbd52[_0x827d('0x40')]);_0x123108[_0x827d('0x41')]=_[_0x827d('0x42')](_0x123108[_0x827d('0x3e')],_0x123108['query']);_0x51b3ac[_0x827d('0x43')]=_[_0x827d('0x42')](_0x123108[_0x827d('0x3e')],qs[_0x827d('0x44')](_0x2fbd52[_0x827d('0x40')][_0x827d('0x44')]));_0x51b3ac[_0x827d('0x43')]=_0x51b3ac[_0x827d('0x43')][_0x827d('0x45')]?_0x51b3ac[_0x827d('0x43')]:_0x123108[_0x827d('0x3e')];if(!_0x2fbd52[_0x827d('0x40')]['hasOwnProperty']('nolimit')){_0x51b3ac[_0x827d('0x30')]=qs['limit'](_0x2fbd52[_0x827d('0x40')][_0x827d('0x30')]);_0x51b3ac[_0x827d('0x46')]=qs[_0x827d('0x46')](_0x2fbd52[_0x827d('0x40')][_0x827d('0x46')]);}_0x51b3ac[_0x827d('0x47')]=qs['sort'](_0x2fbd52[_0x827d('0x40')]['sort']);_0x51b3ac['where']=qs[_0x827d('0x41')](_[_0x827d('0x48')](_0x2fbd52[_0x827d('0x40')],_0x123108[_0x827d('0x41')]),_0xdd27a8);if(_0x2fbd52['query'][_0x827d('0x49')]){_0x51b3ac['where']=_[_0x827d('0x4a')](_0x51b3ac[_0x827d('0x4b')],{'$or':_[_0x827d('0x3a')](_0xdd27a8,function(_0x46c36f){if(_0x46c36f[_0x827d('0x3d')]!==_0x827d('0x4c')){var _0x571087={};_0x571087[_0x46c36f[_0x827d('0x38')]]={'$like':'%'+_0x2fbd52['query'][_0x827d('0x49')]+'%'};return _0x571087;}})});}_0x51b3ac=_[_0x827d('0x4a')]({},_0x51b3ac,_0x2fbd52[_0x827d('0x4d')]);var _0x324b5b={'where':_0x51b3ac['where']};return db[_0x827d('0x3b')][_0x827d('0x2f')](_0x324b5b)[_0x827d('0x20')](function(_0x5122c2){_0x2483ca[_0x827d('0x2f')]=_0x5122c2;if(_0x2fbd52[_0x827d('0x40')]['includeAll']){_0x51b3ac[_0x827d('0x4e')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x827d('0x4f')](_0x51b3ac);})[_0x827d('0x20')](function(_0x301aec){_0x2483ca['rows']=_0x301aec;return _0x2483ca;})[_0x827d('0x20')](respondWithFilteredResult(_0x371718,_0x51b3ac))[_0x827d('0x50')](handleError(_0x371718,null));};exports[_0x827d('0x51')]=function(_0x275757,_0x1202ac){var _0x4c140b={'raw':!![],'where':{'id':_0x275757[_0x827d('0x52')]['id']}},_0x18a92a={};_0x18a92a['model']=_[_0x827d('0x3f')](db[_0x827d('0x3b')][_0x827d('0x3c')]);_0x18a92a[_0x827d('0x40')]=_[_0x827d('0x3f')](_0x275757[_0x827d('0x40')]);_0x18a92a[_0x827d('0x41')]=_['intersection'](_0x18a92a[_0x827d('0x3e')],_0x18a92a[_0x827d('0x40')]);_0x4c140b['attributes']=_[_0x827d('0x42')](_0x18a92a['model'],qs[_0x827d('0x44')](_0x275757[_0x827d('0x40')]['fields']));_0x4c140b['attributes']=_0x4c140b[_0x827d('0x43')][_0x827d('0x45')]?_0x4c140b[_0x827d('0x43')]:_0x18a92a[_0x827d('0x3e')];if(_0x275757[_0x827d('0x40')][_0x827d('0x53')]){_0x4c140b[_0x827d('0x4e')]=[{'all':!![]}];}_0x4c140b=_[_0x827d('0x4a')]({},_0x4c140b,_0x275757[_0x827d('0x4d')]);return db[_0x827d('0x3b')][_0x827d('0x54')](_0x4c140b)[_0x827d('0x20')](handleEntityNotFound(_0x1202ac,null))[_0x827d('0x20')](respondWithResult(_0x1202ac,null))['catch'](handleError(_0x1202ac,null));};exports['create']=function(_0x3262de,_0xc475c9){return db[_0x827d('0x3b')][_0x827d('0x55')](_0x3262de[_0x827d('0x56')],{})['then'](respondWithResult(_0xc475c9,0xc9))[_0x827d('0x50')](handleError(_0xc475c9,null));};exports[_0x827d('0x34')]=function(_0x1efd84,_0x1a6ba1){if(_0x1efd84['body']['id']){delete _0x1efd84[_0x827d('0x56')]['id'];}return db[_0x827d('0x3b')][_0x827d('0x54')]({'where':{'id':_0x1efd84[_0x827d('0x52')]['id']}})['then'](handleEntityNotFound(_0x1a6ba1,null))[_0x827d('0x20')](saveUpdates(_0x1efd84[_0x827d('0x56')],null))[_0x827d('0x20')](respondWithResult(_0x1a6ba1,null))[_0x827d('0x50')](handleError(_0x1a6ba1,null));};exports['destroy']=function(_0x546f38,_0x55ef44){return db['OpenchannelMessage']['find']({'where':{'id':_0x546f38[_0x827d('0x52')]['id']}})[_0x827d('0x20')](handleEntityNotFound(_0x55ef44,null))[_0x827d('0x20')](removeEntity(_0x55ef44,null))['catch'](handleError(_0x55ef44,null));};exports[_0x827d('0x57')]=function(_0x42b938,_0x33754d){return db[_0x827d('0x3b')][_0x827d('0x57')]()['then'](respondWithResult(_0x33754d,null))['catch'](handleError(_0x33754d,null));};var interaction_log=require(_0x827d('0x13'))(_0x827d('0x58'));exports[_0x827d('0x59')]=function(_0x34e1f8,_0x4b0f5a,_0x42f2c5){var _0xd587bb={'agent':{},'channel':_0x827d('0x5a')};if(_0x34e1f8[_0x827d('0x56')]['id']){delete _0x34e1f8[_0x827d('0x56')]['id'];}_0x34e1f8[_0x827d('0x56')][_0x827d('0x5b')]=!![];_0x34e1f8[_0x827d('0x56')][_0x827d('0x5c')]=moment()[_0x827d('0x5d')](_0x827d('0x5e'));_0x34e1f8[_0x827d('0x56')]['UserId']=_0x34e1f8[_0x827d('0x56')][_0x827d('0x5f')]||_0x34e1f8['user']['id'];_0xd587bb[_0x827d('0x60')]['id']=_0x34e1f8[_0x827d('0x56')][_0x827d('0x5f')];return db['OpenchannelMessage'][_0x827d('0x54')]({'where':{'id':_0x34e1f8['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4b0f5a,null))[_0x827d('0x20')](saveUpdates(_0x34e1f8[_0x827d('0x56')],null))[_0x827d('0x20')](function(_0x2de22a){if(_0x2de22a){_0xd587bb['message']=_0x2de22a[_0x827d('0x61')]({'plain':!![]});return db[_0x827d('0x62')][_0x827d('0x54')]({'where':{'id':_0x2de22a[_0x827d('0x63')]}});}return null;})[_0x827d('0x20')](handleEntityNotFound(_0x4b0f5a,null))[_0x827d('0x20')](function(_0x326bfa){if(_0x326bfa){return _0x326bfa['update']({'UserId':_0x34e1f8[_0x827d('0x56')][_0x827d('0x5f')],'read1stAt':_[_0x827d('0x64')](_0x326bfa['read1stAt'])?moment()[_0x827d('0x5d')](_0x827d('0x5e')):undefined});}return null;})[_0x827d('0x20')](function(_0xf72191){if(_0xf72191){_0xd587bb[_0x827d('0x65')]=_0xf72191['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x34e1f8[_0x827d('0x66')]['id'],_0x34e1f8[_0x827d('0x66')][_0x827d('0x38')],_0x34e1f8[_0x827d('0x66')][_0x827d('0x67')],_0xd587bb['interaction']['id'],_0x34e1f8['body']?JSON[_0x827d('0x26')](_0x34e1f8[_0x827d('0x56')]):_0x827d('0x68'));return respondWithRpcPromise(_0x827d('0x69'),_0x827d('0x6a'),_0xd587bb);}return null;})[_0x827d('0x20')](function(_0x449b2b){var _0x20d059=_0x827d('0x6b')+_0x449b2b[_0x827d('0x29')][_0x827d('0x6c')];return db['sequelize'][_0x827d('0x40')](_0x20d059,{'type':db[_0x827d('0x6d')][_0x827d('0x6e')]['SELECT'],'raw':!![]})[_0x827d('0x20')](function(_0x3f3f4d){return _0x3f3f4d;});})[_0x827d('0x20')](function(_0x523f73){if(_0x523f73){_0xd587bb['message'][_0x827d('0x6f')]=_0x523f73[0x0];if(!_0x34e1f8[_0x827d('0x56')][_0x827d('0x5f')])return;return db['User'][_0x827d('0x54')]({'where':{'id':_0x34e1f8[_0x827d('0x56')][_0x827d('0x5f')],'role':'agent'},'attributes':['id','name',_0x827d('0x70'),'email','internal'],'raw':!![]});}return null;})[_0x827d('0x20')](function(_0x501708){if(!_0x501708)return null;_0xd587bb['message'][_0x827d('0x60')]=_0x501708;return _0xd587bb;})['then'](function(_0x17f42c){if(_0x17f42c){if(_0x34e1f8[_0x827d('0x56')]['manual']){_0xd587bb[_0x827d('0x29')][_0x827d('0x71')]=util['format'](_0x827d('0x72'),_0x34e1f8['user']['name']);_0xd587bb[_0x827d('0x29')][_0x827d('0x73')]=_0xd587bb[_0x827d('0x73')];_0xd587bb[_0x827d('0x29')][_0x827d('0x74')]=_0xd587bb[_0x827d('0x73')];_0xd587bb[_0x827d('0x29')]['event']=_0x827d('0x59');return respondWithRpcPromise(_0x827d('0x75'),_0x827d('0x75'),{'event':_0x827d('0x76'),'message':_0xd587bb[_0x827d('0x29')]},client9002)[_0x827d('0x20')](function(){return _0xd587bb;});}return _0xd587bb;}return null;})[_0x827d('0x20')](respondWithResult(_0x4b0f5a,null))[_0x827d('0x50')](handleError(_0x4b0f5a,null));};var interaction_log=require(_0x827d('0x13'))(_0x827d('0x58'));exports['reject']=function(_0x376e80,_0x1ecd02,_0x372ca1){var _0x1f8c5b={'agent':{},'channel':_0x827d('0x5a')};if(_0x376e80[_0x827d('0x56')]['id']){delete _0x376e80[_0x827d('0x56')]['id'];}_0x376e80['body'][_0x827d('0x5f')]=_0x376e80[_0x827d('0x56')]['UserId']||_0x376e80[_0x827d('0x66')]['id'];_0x1f8c5b['agent']['id']=_0x376e80[_0x827d('0x56')]['UserId'];return db[_0x827d('0x3b')][_0x827d('0x54')]({'where':{'id':_0x376e80[_0x827d('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ecd02,null))[_0x827d('0x20')](function(_0x2f7da0){if(_0x2f7da0){_0x1f8c5b[_0x827d('0x29')]=_0x2f7da0[_0x827d('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x827d('0x54')]({'where':{'id':_0x2f7da0[_0x827d('0x63')]}});}return null;})[_0x827d('0x20')](handleEntityNotFound(_0x1ecd02,null))[_0x827d('0x20')](function(_0x4ac658){if(_0x4ac658){_0x1f8c5b[_0x827d('0x65')]=_0x4ac658[_0x827d('0x61')]({'plain':!![]});interaction_log[_0x827d('0x21')](_0x827d('0x77'),_0x376e80[_0x827d('0x66')]['id'],_0x376e80[_0x827d('0x66')][_0x827d('0x38')],_0x376e80['user']['role'],_0x1f8c5b[_0x827d('0x65')]['id'],_0x376e80[_0x827d('0x56')]?JSON[_0x827d('0x26')](_0x376e80['body']):_0x827d('0x68'));return respondWithRpcPromise('RejectMessage',_0x827d('0x78'),_0x1f8c5b);}return null;})[_0x827d('0x20')](function(_0x32f54d){var _0x12ee8c=_0x827d('0x6b')+_0x32f54d['message'][_0x827d('0x6c')];return db[_0x827d('0x79')][_0x827d('0x40')](_0x12ee8c,{'type':db[_0x827d('0x6d')]['QueryTypes'][_0x827d('0x7a')],'raw':!![]})[_0x827d('0x20')](function(_0x3c17f3){return _0x3c17f3;});})[_0x827d('0x20')](function(_0x27089e){if(_0x27089e){_0x1f8c5b[_0x827d('0x29')][_0x827d('0x6f')]=_0x27089e[0x0];if(!_0x376e80['body'][_0x827d('0x5f')])return;return db[_0x827d('0x7b')]['find']({'where':{'id':_0x376e80[_0x827d('0x56')][_0x827d('0x5f')],'role':_0x827d('0x60')},'attributes':['id',_0x827d('0x38'),_0x827d('0x70'),_0x827d('0x7c'),_0x827d('0x7d')],'raw':!![]});}return null;})[_0x827d('0x20')](function(_0x25aa7b){if(!_0x25aa7b)return null;_0x1f8c5b[_0x827d('0x29')]['agent']=_0x25aa7b;return _0x1f8c5b;})[_0x827d('0x20')](function(_0x4494e4){if(_0x4494e4){_0x4494e4['message'][_0x827d('0x71')]=util[_0x827d('0x5d')](_0x827d('0x72'),_0x376e80['user'][_0x827d('0x38')]);_0x4494e4[_0x827d('0x29')]['channel']=_0x1f8c5b[_0x827d('0x73')];_0x4494e4['message'][_0x827d('0x74')]=_0x1f8c5b['channel'];_0x4494e4[_0x827d('0x29')][_0x827d('0x7e')]=_0x827d('0x33');respondWithRpcPromise(_0x827d('0x75'),_0x827d('0x75'),{'event':'rejectmessage','message':_0x4494e4[_0x827d('0x29')]},client9002);return _0x1f8c5b;}return null;})['then'](respondWithResult(_0x1ecd02,null))[_0x827d('0x50')](handleError(_0x1ecd02,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index a76926e..f1a118b 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 _0x5358=['save','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x43c812,_0x5da4f7){var _0x309567=function(_0x9327af){while(--_0x9327af){_0x43c812['push'](_0x43c812['shift']());}};_0x309567(++_0x5da4f7);}(_0x5358,0x1ac));var _0x8535=function(_0x37492a,_0x46ff54){_0x37492a=_0x37492a-0x0;var _0x2c3693=_0x5358[_0x37492a];return _0x2c3693;};'use strict';var EventEmitter=require(_0x8535('0x0'));var OpenchannelMessage=require(_0x8535('0x1'))['db'][_0x8535('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8535('0x3')](0x0);var events={'afterCreate':_0x8535('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a5071){return function(_0x1adcc3,_0x78ca60,_0x5834bc){OpenchannelMessageEvents[_0x8535('0x5')](_0x1a5071+':'+_0x1adcc3['id'],_0x1adcc3);OpenchannelMessageEvents[_0x8535('0x5')](_0x1a5071,_0x1adcc3);_0x5834bc(null);};}for(var e in events){if(events[_0x8535('0x6')](e)){var event=events[e];OpenchannelMessage[_0x8535('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xbee3=['emit','events','update','remove'];(function(_0x1e7e4e,_0x373121){var _0x364667=function(_0x2da5e5){while(--_0x2da5e5){_0x1e7e4e['push'](_0x1e7e4e['shift']());}};_0x364667(++_0x373121);}(_0xbee3,0xe5));var _0x3bee=function(_0x356d15,_0x19b1f0){_0x356d15=_0x356d15-0x0;var _0x4a647c=_0xbee3[_0x356d15];return _0x4a647c;};'use strict';var EventEmitter=require(_0x3bee('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3bee('0x1'),'afterDestroy':_0x3bee('0x2')};function emitEvent(_0x14321b){return function(_0x2ddc24,_0x136e83,_0x23cd29){OpenchannelMessageEvents[_0x3bee('0x3')](_0x14321b+':'+_0x2ddc24['id'],_0x2ddc24);OpenchannelMessageEvents['emit'](_0x14321b,_0x2ddc24);_0x23cd29(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index f463737..3ae2fd4 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 _0x16f3=['get','direction','toLowerCase','out','secret','UserId','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelInteraction','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models'];(function(_0x14a8c4,_0x3ff392){var _0x3e3a53=function(_0x5a8efb){while(--_0x5a8efb){_0x14a8c4['push'](_0x14a8c4['shift']());}};_0x3e3a53(++_0x3ff392);}(_0x16f3,0xef));var _0x316f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16f3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x316f('0x0'));var util=require('util');var logger=require(_0x316f('0x1'))(_0x316f('0x2'));var moment=require(_0x316f('0x3'));var BPromise=require(_0x316f('0x4'));var rp=require(_0x316f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x316f('0x6'));var config=require(_0x316f('0x7'));var attributes=require(_0x316f('0x8'));module[_0x316f('0x9')]=function(_0x1a8f77,_0x1ca308){return _0x1a8f77[_0x316f('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x316f('0xb'),'paranoid':![],'indexes':[{'name':_0x316f('0xc'),'fields':[_0x316f('0xd')],'type':_0x316f('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a50c2,_0x481992,_0x3d09d7){var _0x58eeb3=_0x1a8f77[_0x316f('0xf')];var _0x35f5dc=_0x5a50c2[_0x316f('0x10')]({'plain':!![]});if(_0x35f5dc[_0x316f('0x11')][_0x316f('0x12')]()==='in'||_0x35f5dc[_0x316f('0x11')][_0x316f('0x12')]()===_0x316f('0x13')&&!_0x35f5dc[_0x316f('0x14')]&&!_['isNil'](_0x35f5dc[_0x316f('0x15')])){_0x58eeb3['OpenchannelInteraction']['findOne']({'where':{'id':_0x35f5dc[_0x316f('0x16')]}})[_0x316f('0x17')](function(_0x35abdb){if(_0x35abdb){_0x35abdb[_0x316f('0x18')]({'lastMsgAt':_0x35f5dc[_0x316f('0x19')],'lastMsgDirection':_0x35f5dc[_0x316f('0x11')][_0x316f('0x12')]()});}})[_0x316f('0x1a')](function(_0x24b901){console['error'](_0x24b901);});}if(_0x35f5dc[_0x316f('0x11')]===_0x316f('0x13')&&!_0x35f5dc[_0x316f('0x14')]){var _0x393510;_0x58eeb3[_0x316f('0x1b')][_0x316f('0x1c')]()[_0x316f('0x17')](function(_0x1a598a){return _0x58eeb3[_0x316f('0x1d')][_0x316f('0x1e')]({'where':{'id':_0x35f5dc['OpenchannelAccountId']},'include':[{'model':_0x58eeb3[_0x316f('0x1f')],'as':'Interactions','where':{'id':_0x35f5dc[_0x316f('0x16')]},'limit':0x1,'include':[{'model':_0x58eeb3['CmContact'],'as':_0x316f('0x20'),'attributes':_[_0x316f('0x21')](_0x1a598a)}]}]});})['then'](function(_0x47abc7){_0x393510=_0x47abc7['get']({'plain':!![]});if(_0x393510&&_0x393510[_0x316f('0x22')]){logger[_0x316f('0x23')](_0x316f('0x24'),_0x316f('0x25'),util[_0x316f('0x26')](_0x316f('0x27'),_0x35f5dc['id'],_0x393510[_0x316f('0x22')]));if(_0x393510[_0x316f('0x28')]&&_0x393510[_0x316f('0x28')][_0x316f('0x29')]){_0x35f5dc[_0x316f('0x2a')]=_[_0x316f('0x2b')](_0x393510[_0x316f('0x28')][0x0],_0x316f('0x20'));_0x35f5dc[_0x316f('0x20')]=_0x393510[_0x316f('0x28')][0x0][_0x316f('0x20')];}var _0x481992={'method':'POST','uri':encodeURI(_0x393510[_0x316f('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x481992[_0x316f('0x2c')]){case _0x316f('0x2d'):_0x481992['qs']=_0x35f5dc;break;case'POST':_0x481992[_0x316f('0xd')]=_0x35f5dc;break;}return rp(_0x481992)[_0x316f('0x17')](function(_0x429ed1){logger['info'](_0x316f('0x24'),_0x316f('0x25'),util['format'](_0x316f('0x2e'),_0x35f5dc['id'],_0x393510['replyUri']));if(_0x429ed1['body'][_0x316f('0x2f')]&&_0x429ed1[_0x316f('0xd')][_0x316f('0x2f')]!=_0x35f5dc[_0x316f('0x2a')][_0x316f('0x2f')]){return _0x58eeb3[_0x316f('0x1f')][_0x316f('0x18')]({'threadId':_0x429ed1[_0x316f('0xd')][_0x316f('0x2f')]},{'where':{'id':_0x35f5dc['Interaction']['id']}});}else{return;}})[_0x316f('0x17')](function(){return _0x5a50c2[_0x316f('0x18')]({'read':!![]});})[_0x316f('0x1a')](function(_0xf4cb2d){logger[_0x316f('0x30')](_0x316f('0x24'),_0x316f('0x25'),util[_0x316f('0x31')](_0xf4cb2d,{'showHidden':![],'depth':null}));_0x3d09d7();});}else{_0x3d09d7();}})['finally'](function(){_0x3d09d7();});}else{_0x3d09d7();}}},'charset':_0x316f('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x27a4=['findOne','update','createdAt','catch','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','Contact','POST','method','GET','info','threadId','then','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','OpenchannelInteraction'];(function(_0x218ca0,_0xe44a46){var _0x10ec3f=function(_0x51de19){while(--_0x51de19){_0x218ca0['push'](_0x218ca0['shift']());}};_0x10ec3f(++_0xe44a46);}(_0x27a4,0x1c0));var _0x427a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x27a4[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x427a('0x0'))('api');var moment=require(_0x427a('0x1'));var BPromise=require(_0x427a('0x2'));var rp=require(_0x427a('0x3'));var fs=require('fs');var path=require(_0x427a('0x4'));var rimraf=require(_0x427a('0x5'));var config=require(_0x427a('0x6'));var attributes=require(_0x427a('0x7'));module[_0x427a('0x8')]=function(_0x4dafc2,_0x46b59e){return _0x4dafc2[_0x427a('0x9')](_0x427a('0xa'),attributes,{'tableName':_0x427a('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x427a('0xc')],'type':_0x427a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1495a7,_0x866341,_0xe22e75){var _0x1978b9=_0x4dafc2[_0x427a('0xe')];var _0xf65db=_0x1495a7['get']({'plain':!![]});if(_0xf65db[_0x427a('0xf')]['toLowerCase']()==='in'||_0xf65db[_0x427a('0xf')][_0x427a('0x10')]()==='out'&&!_0xf65db[_0x427a('0x11')]&&!_[_0x427a('0x12')](_0xf65db['UserId'])){_0x1978b9[_0x427a('0x13')][_0x427a('0x14')]({'where':{'id':_0xf65db['OpenchannelInteractionId']}})['then'](function(_0x55143d){if(_0x55143d){_0x55143d[_0x427a('0x15')]({'lastMsgAt':_0xf65db[_0x427a('0x16')],'lastMsgDirection':_0xf65db[_0x427a('0xf')][_0x427a('0x10')]()});}})[_0x427a('0x17')](function(_0x4cff8a){console[_0x427a('0x18')](_0x4cff8a);});}if(_0xf65db[_0x427a('0xf')]===_0x427a('0x19')&&!_0xf65db['secret']){var _0x187e9e;_0x1978b9[_0x427a('0x1a')][_0x427a('0x1b')]()['then'](function(_0x2af0eb){return _0x1978b9[_0x427a('0x1c')][_0x427a('0x1d')]({'where':{'id':_0xf65db[_0x427a('0x1e')]},'include':[{'model':_0x1978b9[_0x427a('0x13')],'as':_0x427a('0x1f'),'where':{'id':_0xf65db[_0x427a('0x20')]},'limit':0x1,'include':[{'model':_0x1978b9[_0x427a('0x1a')],'as':'Contact','attributes':_[_0x427a('0x21')](_0x2af0eb)}]}]});})['then'](function(_0x447f62){_0x187e9e=_0x447f62['get']({'plain':!![]});if(_0x187e9e&&_0x187e9e[_0x427a('0x22')]){logger['info'](_0x427a('0x23'),_0x427a('0x24'),util[_0x427a('0x25')](_0x427a('0x26'),_0xf65db['id'],_0x187e9e[_0x427a('0x22')]));if(_0x187e9e['Interactions']&&_0x187e9e[_0x427a('0x1f')]['length']){_0xf65db[_0x427a('0x27')]=_[_0x427a('0x28')](_0x187e9e['Interactions'][0x0],_0x427a('0x29'));_0xf65db['Contact']=_0x187e9e[_0x427a('0x1f')][0x0][_0x427a('0x29')];}var _0x866341={'method':_0x427a('0x2a'),'uri':encodeURI(_0x187e9e[_0x427a('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x866341[_0x427a('0x2b')]){case _0x427a('0x2c'):_0x866341['qs']=_0xf65db;break;case _0x427a('0x2a'):_0x866341[_0x427a('0xc')]=_0xf65db;break;}return rp(_0x866341)['then'](function(_0xfa4fc7){logger[_0x427a('0x2d')](_0x427a('0x23'),'afterCreate',util[_0x427a('0x25')]('Message\x20%d\x20forwarded\x20to\x20%s',_0xf65db['id'],_0x187e9e[_0x427a('0x22')]));if(_0xfa4fc7[_0x427a('0xc')][_0x427a('0x2e')]&&_0xfa4fc7[_0x427a('0xc')][_0x427a('0x2e')]!=_0xf65db[_0x427a('0x27')][_0x427a('0x2e')]){return _0x1978b9[_0x427a('0x13')]['update']({'threadId':_0xfa4fc7[_0x427a('0xc')][_0x427a('0x2e')]},{'where':{'id':_0xf65db['Interaction']['id']}});}else{return;}})[_0x427a('0x2f')](function(){return _0x1495a7[_0x427a('0x15')]({'read':!![]});})[_0x427a('0x17')](function(_0x509c44){logger['error'](_0x427a('0x23'),_0x427a('0x24'),util[_0x427a('0x30')](_0x509c44,{'showHidden':![],'depth':null}));_0xe22e75();});}else{_0xe22e75();}})[_0x427a('0x31')](function(){_0xe22e75();});}else{_0xe22e75();}}},'charset':_0x427a('0x32'),'collate':_0x427a('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6388146..b25a3c1 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x22ba48,_0x20d547){var _0x2f5bcf=function(_0x54785c){while(--_0x54785c){_0x22ba48['push'](_0x22ba48['shift']());}};_0x2f5bcf(++_0x20d547);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +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(_0x3a4c0e,_0x514b23){var _0x2cc5ad=function(_0x1bfebd){while(--_0x1bfebd){_0x3a4c0e['push'](_0x3a4c0e['shift']());}};_0x2cc5ad(++_0x514b23);}(_0x7a54,0x106));var _0x47a5=function(_0x4f5a5d,_0x36f309){_0x4f5a5d=_0x4f5a5d-0x0;var _0x4ecc7a=_0x7a54[_0x4f5a5d];return _0x4ecc7a;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index eaf544b..662e939 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 _0x54ba=['save','remove','update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x54ba,0x170));var _0xa54b=function(_0x4a9c80,_0x2f0cd2){_0x4a9c80=_0x4a9c80-0x0;var _0x2a2494=_0x54ba[_0x4a9c80];return _0x2a2494;};'use strict';var OpenchannelMessageEvents=require(_0xa54b('0x0'));var events=[_0xa54b('0x1'),_0xa54b('0x2'),_0xa54b('0x3')];function createListener(_0x19e323,_0xea7291){return function(_0x53e1f3){_0xea7291[_0xa54b('0x4')](_0x19e323,_0x53e1f3);};}function removeListener(_0x4af786,_0x3e1157){return function(){OpenchannelMessageEvents[_0xa54b('0x5')](_0x4af786,_0x3e1157);};}exports[_0xa54b('0x6')]=function(_0x3ca5d5){for(var _0x574edb=0x0,_0x4e3dc1=events[_0xa54b('0x7')];_0x574edb<_0x4e3dc1;_0x574edb++){var _0xbd9471=events[_0x574edb];var _0x471566=createListener(_0xa54b('0x8')+_0xbd9471,_0x3ca5d5);OpenchannelMessageEvents['on'](_0xbd9471,_0x471566);}}; \ No newline at end of file +var _0xafca=['update','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events','remove'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xafca,0x1ef));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelMessageEvents=require(_0xaafc('0x0'));var events=['save',_0xaafc('0x1'),_0xaafc('0x2')];function createListener(_0x494c61,_0x484f85){return function(_0x1769ab){_0x484f85[_0xaafc('0x3')](_0x494c61,_0x1769ab);};}function removeListener(_0x379add,_0xd5021b){return function(){OpenchannelMessageEvents[_0xaafc('0x4')](_0x379add,_0xd5021b);};}exports['register']=function(_0x3db4ed){for(var _0x418fca=0x0,_0x978cf0=events[_0xaafc('0x5')];_0x418fca<_0x978cf0;_0x418fca++){var _0x83ea82=events[_0x418fca];var _0x2cf865=createListener(_0xaafc('0x6')+_0x83ea82,_0x3db4ed);OpenchannelMessageEvents['on'](_0x83ea82,_0x2cf865);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ab7d010..efc34c0 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 _0x0fd4=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members'];(function(_0x47a9a9,_0x302893){var _0x9f92d3=function(_0x4a56fa){while(--_0x4a56fa){_0x47a9a9['push'](_0x47a9a9['shift']());}};_0x9f92d3(++_0x302893);}(_0x0fd4,0xfd));var _0x40fd=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0x0fd4[_0x228ac9];return _0x69fe02;};'use strict';var multer=require(_0x40fd('0x0'));var util=require(_0x40fd('0x1'));var path=require(_0x40fd('0x2'));var timeout=require(_0x40fd('0x3'));var express=require(_0x40fd('0x4'));var router=express[_0x40fd('0x5')]();var fs_extra=require(_0x40fd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x40fd('0x7'));var config=require('../../config/environment');var controller=require(_0x40fd('0x8'));router[_0x40fd('0x9')]('/',auth['isAuthenticated'](),controller[_0x40fd('0xa')]);router['get'](_0x40fd('0xb'),auth[_0x40fd('0xc')](),controller[_0x40fd('0xd')]);router[_0x40fd('0x9')](_0x40fd('0xe'),auth[_0x40fd('0xc')](),controller[_0x40fd('0xf')]);router[_0x40fd('0x9')](_0x40fd('0x10'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x11')]);router[_0x40fd('0x9')](_0x40fd('0x12'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x13')]);router[_0x40fd('0x9')](_0x40fd('0x14'),auth['isAuthenticated'](),controller[_0x40fd('0x15')]);router[_0x40fd('0x16')]('/',auth[_0x40fd('0xc')](),controller[_0x40fd('0x17')]);router['post'](_0x40fd('0x12'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x18')]);router[_0x40fd('0x16')](_0x40fd('0x14'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x19')]);router['put']('/:id',auth[_0x40fd('0xc')](),controller['update']);router[_0x40fd('0x1a')](_0x40fd('0xe'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x1b')]);router['delete'](_0x40fd('0x12'),auth[_0x40fd('0xc')](),controller['removeTeams']);router['delete'](_0x40fd('0x14'),auth[_0x40fd('0xc')](),controller[_0x40fd('0x1c')]);module[_0x40fd('0x1d')]=router; \ No newline at end of file +var _0xd0df=['getAgents','post','addTeams','put','/:id','update','destroy','delete','/:id/teams','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','get','describe','show','/:id/members','getMembers','/:id/users'];(function(_0x201361,_0x3d6778){var _0x300db2=function(_0x3b3c10){while(--_0x3b3c10){_0x201361['push'](_0x201361['shift']());}};_0x300db2(++_0x3d6778);}(_0xd0df,0xe3));var _0xfd0d=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0xd0df[_0x5b1c50];return _0x2d379b;};'use strict';var multer=require(_0xfd0d('0x0'));var util=require(_0xfd0d('0x1'));var path=require('path');var timeout=require(_0xfd0d('0x2'));var express=require(_0xfd0d('0x3'));var router=express[_0xfd0d('0x4')]();var fs_extra=require(_0xfd0d('0x5'));var auth=require(_0xfd0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfd0d('0x7'));var controller=require(_0xfd0d('0x8'));router['get']('/',auth[_0xfd0d('0x9')](),controller['index']);router[_0xfd0d('0xa')]('/describe',auth[_0xfd0d('0x9')](),controller[_0xfd0d('0xb')]);router[_0xfd0d('0xa')]('/:id',auth[_0xfd0d('0x9')](),controller[_0xfd0d('0xc')]);router[_0xfd0d('0xa')](_0xfd0d('0xd'),auth[_0xfd0d('0x9')](),controller[_0xfd0d('0xe')]);router[_0xfd0d('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xfd0d('0xa')](_0xfd0d('0xf'),auth[_0xfd0d('0x9')](),controller[_0xfd0d('0x10')]);router[_0xfd0d('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfd0d('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xfd0d('0x12')]);router['post'](_0xfd0d('0xf'),auth[_0xfd0d('0x9')](),controller['addAgents']);router[_0xfd0d('0x13')](_0xfd0d('0x14'),auth[_0xfd0d('0x9')](),controller[_0xfd0d('0x15')]);router['delete'](_0xfd0d('0x14'),auth[_0xfd0d('0x9')](),controller[_0xfd0d('0x16')]);router[_0xfd0d('0x17')](_0xfd0d('0x18'),auth[_0xfd0d('0x9')](),controller[_0xfd0d('0x19')]);router['delete'](_0xfd0d('0xf'),auth[_0xfd0d('0x9')](),controller[_0xfd0d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 330a1da..91bdec9 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 _0xa2c6=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa2c6,0x1a4));var _0x6a2c=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xa2c6[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0x6a2c('0x0'));module[_0x6a2c('0x1')]={'name':{'type':Sequelize[_0x6a2c('0x2')],'unique':_0x6a2c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x6a2c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6a2c('0x5'),_0x6a2c('0x6'),_0x6a2c('0x7'))}}; \ No newline at end of file +var _0x743c=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x743c,0x139));var _0xc743=function(_0x117821,_0xaa1933){_0x117821=_0x117821-0x0;var _0x4ae9ff=_0x743c[_0x117821];return _0x4ae9ff;};'use strict';var Sequelize=require(_0xc743('0x0'));module[_0xc743('0x1')]={'name':{'type':Sequelize[_0xc743('0x2')],'unique':_0xc743('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc743('0x2')]},'timeout':{'type':Sequelize[_0xc743('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc743('0x5')](_0xc743('0x6'),_0xc743('0x7'),_0xc743('0x8'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 513fb5c..1a162e3 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 _0x2f6d=['UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','rawAttributes','hasOwnProperty','sort','pick','OpenchannelQueueId','findAndCountAll','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','User','interface','Agents','sequelize','transaction','each','findOrCreate','emit','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x57b3df,_0x445081){var _0x206656=function(_0x16aeb3){while(--_0x16aeb3){_0x57b3df['push'](_0x57b3df['shift']());}};_0x206656(++_0x445081);}(_0x2f6d,0xd3));var _0xd2f6=function(_0x340332,_0x5f02ac){_0x340332=_0x340332-0x0;var _0x4334fc=_0x2f6d[_0x340332];return _0x4334fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2f6('0x0'));var zipdir=require(_0xd2f6('0x1'));var jsonpatch=require(_0xd2f6('0x2'));var rp=require(_0xd2f6('0x3'));var moment=require(_0xd2f6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2f6('0x5'));var path=require(_0xd2f6('0x6'));var sox=require(_0xd2f6('0x7'));var csv=require(_0xd2f6('0x8'));var ejs=require(_0xd2f6('0x9'));var fs=require('fs');var fs_extra=require(_0xd2f6('0xa'));var _=require('lodash');var squel=require(_0xd2f6('0xb'));var crypto=require(_0xd2f6('0xc'));var jsforce=require(_0xd2f6('0xd'));var deskjs=require(_0xd2f6('0xe'));var toCsv=require(_0xd2f6('0x8'));var querystring=require(_0xd2f6('0xf'));var Papa=require('papaparse');var Redis=require(_0xd2f6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd2f6('0x11'));var as=require(_0xd2f6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2f6('0x13'))(_0xd2f6('0x14'));var utils=require('../../config/utils');var config=require(_0xd2f6('0x15'));var licenseUtil=require(_0xd2f6('0x16'));var db=require(_0xd2f6('0x17'))['db'];config[_0xd2f6('0x18')]=_[_0xd2f6('0x19')](config[_0xd2f6('0x18')],{'host':_0xd2f6('0x1a'),'port':0x18eb});var socket=require(_0xd2f6('0x1b'))(new Redis(config['redis']));require(_0xd2f6('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d7a16,_0x27b4a9){_0x27b4a9=_0x27b4a9||0xcc;return function(_0x5d7d16){if(_0x5d7d16){return _0x5d7a16[_0xd2f6('0x1d')](_0x27b4a9);}return _0x5d7a16[_0xd2f6('0x1e')](_0x27b4a9)[_0xd2f6('0x1f')]();};}function respondWithResult(_0x2b6838,_0x2e4330){_0x2e4330=_0x2e4330||0xc8;return function(_0x16cbb4){if(_0x16cbb4){return _0x2b6838['status'](_0x2e4330)[_0xd2f6('0x20')](_0x16cbb4);}};}function respondWithFilteredResult(_0x4efcf5,_0x59fe15){return function(_0xdf7d0a){if(_0xdf7d0a){var _0x3010d0=typeof _0x59fe15[_0xd2f6('0x21')]===_0xd2f6('0x22')&&typeof _0x59fe15[_0xd2f6('0x23')]===_0xd2f6('0x22');var _0x396ef5=_0xdf7d0a[_0xd2f6('0x24')];var _0x47219c=_0x3010d0?0x0:_0x59fe15['offset'];var _0x52d6d5=_0x3010d0?_0xdf7d0a[_0xd2f6('0x24')]:_0x59fe15['offset']+_0x59fe15['limit'];var _0x351d9a;if(_0x52d6d5>=_0x396ef5){_0x52d6d5=_0x396ef5;_0x351d9a=0xc8;}else{_0x351d9a=0xce;}_0x4efcf5[_0xd2f6('0x1e')](_0x351d9a);return _0x4efcf5[_0xd2f6('0x25')](_0xd2f6('0x26'),_0x47219c+'-'+_0x52d6d5+'/'+_0x396ef5)[_0xd2f6('0x20')](_0xdf7d0a);}return null;};}function patchUpdates(_0x440de0){return function(_0x119d22){try{jsonpatch[_0xd2f6('0x27')](_0x119d22,_0x440de0,!![]);}catch(_0x2917a3){return BPromise[_0xd2f6('0x28')](_0x2917a3);}return _0x119d22[_0xd2f6('0x29')]();};}function saveUpdates(_0x32b86f,_0xa9a267){return function(_0x20a132){if(_0x20a132){return _0x20a132[_0xd2f6('0x2a')](_0x32b86f)['then'](function(_0x54280a){return _0x54280a;});}return null;};}function removeEntity(_0x1d5d4d,_0x289e9a){return function(_0x177281){if(_0x177281){return _0x177281[_0xd2f6('0x2b')]()[_0xd2f6('0x2c')](function(){var _0x4ed1d9=_0x177281[_0xd2f6('0x2d')]({'plain':!![]});var _0x239537=_0xd2f6('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x239537,'resourceId':_0x4ed1d9['id']}})[_0xd2f6('0x2c')](function(){return _0x177281;});})[_0xd2f6('0x2c')](function(){_0x1d5d4d[_0xd2f6('0x1e')](0xcc)[_0xd2f6('0x1f')]();});}};}function handleEntityNotFound(_0x22c356,_0x1fd87a){return function(_0x5b81b4){if(!_0x5b81b4){_0x22c356['sendStatus'](0x194);}return _0x5b81b4;};}function handleError(_0x36a504,_0x3104d2){_0x3104d2=_0x3104d2||0x1f4;return function(_0x4ba66f){logger[_0xd2f6('0x2f')](_0x4ba66f['stack']);if(_0x4ba66f[_0xd2f6('0x30')]){delete _0x4ba66f[_0xd2f6('0x30')];}_0x36a504['status'](_0x3104d2)[_0xd2f6('0x31')](_0x4ba66f);};}exports[_0xd2f6('0x32')]=function(_0x4cd36b,_0x2d6b88){var _0x110554={},_0x31943d={},_0x4aaf6d={'count':0x0,'rows':[]};var _0x20d557=_[_0xd2f6('0x33')](db[_0xd2f6('0x34')]['rawAttributes'],function(_0xaecc2b){return{'name':_0xaecc2b[_0xd2f6('0x35')],'type':_0xaecc2b['type'][_0xd2f6('0x36')]};});_0x31943d['model']=_[_0xd2f6('0x33')](_0x20d557,_0xd2f6('0x30'));_0x31943d[_0xd2f6('0x37')]=_[_0xd2f6('0x38')](_0x4cd36b[_0xd2f6('0x37')]);_0x31943d[_0xd2f6('0x39')]=_[_0xd2f6('0x3a')](_0x31943d['model'],_0x31943d[_0xd2f6('0x37')]);_0x110554[_0xd2f6('0x3b')]=_[_0xd2f6('0x3a')](_0x31943d[_0xd2f6('0x3c')],qs[_0xd2f6('0x3d')](_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x3d')]));_0x110554[_0xd2f6('0x3b')]=_0x110554[_0xd2f6('0x3b')][_0xd2f6('0x3e')]?_0x110554[_0xd2f6('0x3b')]:_0x31943d[_0xd2f6('0x3c')];if(!_0x4cd36b[_0xd2f6('0x37')]['hasOwnProperty'](_0xd2f6('0x3f'))){_0x110554[_0xd2f6('0x23')]=qs[_0xd2f6('0x23')](_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x23')]);_0x110554[_0xd2f6('0x21')]=qs[_0xd2f6('0x21')](_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x21')]);}_0x110554[_0xd2f6('0x40')]=qs['sort'](_0x4cd36b[_0xd2f6('0x37')]['sort']);_0x110554[_0xd2f6('0x41')]=qs[_0xd2f6('0x39')](_['pick'](_0x4cd36b[_0xd2f6('0x37')],_0x31943d[_0xd2f6('0x39')]),_0x20d557);if(_0x4cd36b['query'][_0xd2f6('0x42')]){_0x110554[_0xd2f6('0x41')]=_['merge'](_0x110554[_0xd2f6('0x41')],{'$or':_[_0xd2f6('0x33')](_0x20d557,function(_0x46246d){if(_0x46246d[_0xd2f6('0x43')]!==_0xd2f6('0x44')){var _0x125ec6={};_0x125ec6[_0x46246d[_0xd2f6('0x30')]]={'$like':'%'+_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x42')]+'%'};return _0x125ec6;}})});}_0x110554=_['merge']({},_0x110554,_0x4cd36b[_0xd2f6('0x45')]);var _0x532114={'where':_0x110554[_0xd2f6('0x41')]};return db[_0xd2f6('0x34')][_0xd2f6('0x24')](_0x532114)[_0xd2f6('0x2c')](function(_0x24d80a){_0x4aaf6d[_0xd2f6('0x24')]=_0x24d80a;if(_0x4cd36b[_0xd2f6('0x37')][_0xd2f6('0x46')]){_0x110554[_0xd2f6('0x47')]=[{'all':!![]}];}return db[_0xd2f6('0x34')][_0xd2f6('0x48')](_0x110554);})[_0xd2f6('0x2c')](function(_0x595d84){_0x4aaf6d[_0xd2f6('0x49')]=_0x595d84;return _0x4aaf6d;})[_0xd2f6('0x2c')](respondWithFilteredResult(_0x2d6b88,_0x110554))['catch'](handleError(_0x2d6b88,null));};exports[_0xd2f6('0x4a')]=function(_0x33c430,_0x55e3ed){var _0x34444a={'raw':!![],'where':{'id':_0x33c430[_0xd2f6('0x4b')]['id']}},_0xfc17a9={};_0xfc17a9[_0xd2f6('0x3c')]=_[_0xd2f6('0x38')](db[_0xd2f6('0x34')]['rawAttributes']);_0xfc17a9[_0xd2f6('0x37')]=_['keys'](_0x33c430[_0xd2f6('0x37')]);_0xfc17a9[_0xd2f6('0x39')]=_[_0xd2f6('0x3a')](_0xfc17a9[_0xd2f6('0x3c')],_0xfc17a9[_0xd2f6('0x37')]);_0x34444a[_0xd2f6('0x3b')]=_[_0xd2f6('0x3a')](_0xfc17a9[_0xd2f6('0x3c')],qs[_0xd2f6('0x3d')](_0x33c430[_0xd2f6('0x37')][_0xd2f6('0x3d')]));_0x34444a[_0xd2f6('0x3b')]=_0x34444a['attributes']['length']?_0x34444a[_0xd2f6('0x3b')]:_0xfc17a9['model'];if(_0x33c430[_0xd2f6('0x37')][_0xd2f6('0x46')]){_0x34444a[_0xd2f6('0x47')]=[{'all':!![]}];}_0x34444a=_[_0xd2f6('0x4c')]({},_0x34444a,_0x33c430[_0xd2f6('0x45')]);return db[_0xd2f6('0x34')][_0xd2f6('0x4d')](_0x34444a)['then'](handleEntityNotFound(_0x55e3ed,null))[_0xd2f6('0x2c')](respondWithResult(_0x55e3ed,null))['catch'](handleError(_0x55e3ed,null));};exports[_0xd2f6('0x4e')]=function(_0x410032,_0x5d66eb){return db[_0xd2f6('0x34')][_0xd2f6('0x4e')](_0x410032[_0xd2f6('0x4f')],{})[_0xd2f6('0x2c')](function(_0x3eeef5){var _0x21fcc9=_0x410032[_0xd2f6('0x50')][_0xd2f6('0x2d')]({'plain':!![]});if(!_0x21fcc9)throw new Error(_0xd2f6('0x51'));if(_0x21fcc9[_0xd2f6('0x52')]===_0xd2f6('0x50')){var _0x4d83e4=_0x3eeef5[_0xd2f6('0x2d')]({'plain':!![]});var _0x2fa235='OpenchannelQueues';return db[_0xd2f6('0x53')][_0xd2f6('0x4d')]({'where':{'name':_0x2fa235,'userProfileId':_0x21fcc9[_0xd2f6('0x54')]},'raw':!![]})['then'](function(_0xed4ebb){if(_0xed4ebb&&_0xed4ebb[_0xd2f6('0x55')]===0x0){return db[_0xd2f6('0x56')][_0xd2f6('0x4e')]({'name':_0x4d83e4[_0xd2f6('0x30')],'resourceId':_0x4d83e4['id'],'type':_0xed4ebb['name'],'sectionId':_0xed4ebb['id']},{})[_0xd2f6('0x2c')](function(){return _0x3eeef5;});}else{return _0x3eeef5;}})[_0xd2f6('0x57')](function(_0x4a4ea3){logger[_0xd2f6('0x2f')](_0xd2f6('0x58'),_0x4a4ea3);throw _0x4a4ea3;});}return _0x3eeef5;})[_0xd2f6('0x2c')](respondWithResult(_0x5d66eb,0xc9))[_0xd2f6('0x57')](handleError(_0x5d66eb,null));};exports[_0xd2f6('0x2a')]=function(_0x2b5656,_0x49d613){if(_0x2b5656['body']['id']){delete _0x2b5656[_0xd2f6('0x4f')]['id'];}return db['OpenchannelQueue'][_0xd2f6('0x4d')]({'where':{'id':_0x2b5656[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x49d613,null))[_0xd2f6('0x2c')](saveUpdates(_0x2b5656[_0xd2f6('0x4f')],null))['then'](respondWithResult(_0x49d613,null))[_0xd2f6('0x57')](handleError(_0x49d613,null));};exports['destroy']=function(_0xd5fedf,_0x4f1525){return db[_0xd2f6('0x34')][_0xd2f6('0x4d')]({'where':{'id':_0xd5fedf['params']['id']}})['then'](handleEntityNotFound(_0x4f1525,null))[_0xd2f6('0x2c')](removeEntity(_0x4f1525,null))['catch'](handleError(_0x4f1525,null));};exports[_0xd2f6('0x59')]=function(_0x48f871,_0x251773){return db['OpenchannelQueue'][_0xd2f6('0x59')]()[_0xd2f6('0x2c')](respondWithResult(_0x251773,null))[_0xd2f6('0x57')](handleError(_0x251773,null));};exports[_0xd2f6('0x5a')]=function(_0x1955e2,_0x1282a9,_0x5382ed){var _0x20b7cb={'raw':!![],'where':{}},_0x4c0574={},_0x301a86;return db[_0xd2f6('0x34')][_0xd2f6('0x5b')]({'where':{'id':_0x1955e2[_0xd2f6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1282a9,null))[_0xd2f6('0x2c')](function(_0x4ab836){if(_0x4ab836){_0x301a86=_0x4ab836[_0xd2f6('0x2d')]({'plain':!![]});_0x4c0574[_0xd2f6('0x3c')]=_[_0xd2f6('0x38')](db[_0xd2f6('0x5c')][_0xd2f6('0x5d')]);_0x4c0574['query']=_[_0xd2f6('0x38')](_0x1955e2['query']);_0x4c0574['filters']=_[_0xd2f6('0x3a')](_0x4c0574[_0xd2f6('0x3c')],_0x4c0574[_0xd2f6('0x37')]);_0x20b7cb[_0xd2f6('0x3b')]=_[_0xd2f6('0x3a')](_0x4c0574[_0xd2f6('0x3c')],qs[_0xd2f6('0x3d')](_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x3d')]));_0x20b7cb[_0xd2f6('0x3b')]=_0x20b7cb[_0xd2f6('0x3b')][_0xd2f6('0x3e')]?_0x20b7cb[_0xd2f6('0x3b')]:_0x4c0574[_0xd2f6('0x3c')];if(!_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x5e')](_0xd2f6('0x3f'))){_0x20b7cb[_0xd2f6('0x23')]=qs[_0xd2f6('0x23')](_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x23')]);_0x20b7cb[_0xd2f6('0x21')]=qs[_0xd2f6('0x21')](_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x21')]);}_0x20b7cb[_0xd2f6('0x40')]=qs[_0xd2f6('0x5f')](_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x5f')]);_0x20b7cb[_0xd2f6('0x41')]=qs[_0xd2f6('0x39')](_[_0xd2f6('0x60')](_0x1955e2[_0xd2f6('0x37')],_0x4c0574[_0xd2f6('0x39')]));_0x20b7cb['where'][_0xd2f6('0x61')]=_0x4ab836['id'];if(_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x42')]){_0x20b7cb[_0xd2f6('0x41')]=_['merge'](_0x20b7cb[_0xd2f6('0x41')],{'$or':_[_0xd2f6('0x33')](_0x20b7cb['attributes'],function(_0x808200){var _0x2fe61a={};_0x2fe61a[_0x808200]={'$like':'%'+_0x1955e2[_0xd2f6('0x37')][_0xd2f6('0x42')]+'%'};return _0x2fe61a;})});}_0x20b7cb=_['merge']({},_0x20b7cb,_0x1955e2[_0xd2f6('0x45')]);return db[_0xd2f6('0x5c')][_0xd2f6('0x48')](_0x20b7cb);}})[_0xd2f6('0x2c')](function(_0x968c76){if(_0x968c76){return db['User'][_0xd2f6('0x62')]({'where':{'id':_[_0xd2f6('0x33')](_0x968c76,'UserId'),'role':'agent'},'attributes':['id',_0xd2f6('0x30'),_0xd2f6('0x63'),_0xd2f6('0x64'),_0xd2f6('0x65')]});}})[_0xd2f6('0x2c')](function(_0x3c9e77){if(_0x3c9e77){return{'count':_0x3c9e77[_0xd2f6('0x24')],'rows':_['map'](_0x3c9e77[_0xd2f6('0x49')],function(_0x5d9809){return{'membername':_0x5d9809[_0xd2f6('0x30')],'UserId':_0x5d9809['id'],'queue_name':_0x301a86['name'],'OpenchannelQueueId':_0x301a86['id'],'interface':util['format'](_0xd2f6('0x66'),_0xd2f6('0x67'),_0x5d9809['name']),'penalty':0x0,'paused':_0x5d9809[_0xd2f6('0x63')],'createdAt':_0x5d9809[_0xd2f6('0x65')],'updatedAt':_0x5d9809[_0xd2f6('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1282a9,_0x20b7cb))[_0xd2f6('0x57')](handleError(_0x1282a9,null));};exports['getTeams']=function(_0x30544f,_0x147caf,_0xd33384){var _0xcd9c64={};var _0x2da2a7={};var _0x1197bf;var _0x167d11;return db['OpenchannelQueue'][_0xd2f6('0x5b')]({'where':{'id':_0x30544f['params']['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x147caf,null))['then'](function(_0xbf152){if(_0xbf152){_0x1197bf=_0xbf152;_0x2da2a7[_0xd2f6('0x3c')]=_[_0xd2f6('0x38')](db['Team'][_0xd2f6('0x5d')]);_0x2da2a7['query']=_['keys'](_0x30544f[_0xd2f6('0x37')]);_0x2da2a7[_0xd2f6('0x39')]=_[_0xd2f6('0x3a')](_0x2da2a7[_0xd2f6('0x3c')],_0x2da2a7['query']);_0xcd9c64[_0xd2f6('0x3b')]=_['intersection'](_0x2da2a7['model'],qs[_0xd2f6('0x3d')](_0x30544f['query']['fields']));_0xcd9c64['attributes']=_0xcd9c64['attributes'][_0xd2f6('0x3e')]?_0xcd9c64[_0xd2f6('0x3b')]:_0x2da2a7['model'];_0xcd9c64[_0xd2f6('0x40')]=qs[_0xd2f6('0x5f')](_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x5f')]);_0xcd9c64[_0xd2f6('0x41')]=qs[_0xd2f6('0x39')](_[_0xd2f6('0x60')](_0x30544f[_0xd2f6('0x37')],_0x2da2a7[_0xd2f6('0x39')]));if(_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x42')]){_0xcd9c64[_0xd2f6('0x41')]=_['merge'](_0xcd9c64[_0xd2f6('0x41')],{'$or':_['map'](_0xcd9c64[_0xd2f6('0x3b')],function(_0x49b123){var _0x13c194={};_0x13c194[_0x49b123]={'$like':'%'+_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x42')]+'%'};return _0x13c194;})});}_0xcd9c64=_[_0xd2f6('0x4c')]({},_0xcd9c64,_0x30544f[_0xd2f6('0x45')]);return _0x1197bf[_0xd2f6('0x68')](_0xcd9c64);}})[_0xd2f6('0x2c')](function(_0x2e77fb){if(_0x2e77fb){_0x167d11=_0x2e77fb[_0xd2f6('0x3e')];if(!_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x5e')]('nolimit')){_0xcd9c64[_0xd2f6('0x23')]=qs[_0xd2f6('0x23')](_0x30544f[_0xd2f6('0x37')][_0xd2f6('0x23')]);_0xcd9c64[_0xd2f6('0x21')]=qs['offset'](_0x30544f[_0xd2f6('0x37')]['offset']);}return _0x1197bf[_0xd2f6('0x68')](_0xcd9c64);}})[_0xd2f6('0x2c')](function(_0x308261){if(_0x308261){return _0x308261?{'count':_0x167d11,'rows':_0x308261}:null;}})[_0xd2f6('0x2c')](respondWithResult(_0x147caf,null))[_0xd2f6('0x57')](handleError(_0x147caf,null));};exports[_0xd2f6('0x69')]=function(_0x4cd640,_0x3cd651,_0x2506a7){var _0x382dee=_0x4cd640[_0xd2f6('0x4f')][_0xd2f6('0x6a')];return db[_0xd2f6('0x6b')]['findAll']({'where':{'id':_0x382dee},'attributes':['id'],'include':[{'model':db[_0xd2f6('0x6c')],'as':'Agents','attributes':['id',_0xd2f6('0x30'),'online','voicePause',_0xd2f6('0x6d')],'raw':!![]}]})['then'](function(_0x4e34ce){if(_0x4e34ce){var _0x502c23=_['flatMap'](_0x4e34ce,function(_0x413b2d){var _0x1dc987=_0x413b2d[_0xd2f6('0x2d')]({'plain':!![]});return _0x1dc987[_0xd2f6('0x6e')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x4cd640[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](function(_0x41f34a){return db[_0xd2f6('0x6f')][_0xd2f6('0x70')](function(_0x4d14ba){return _0x41f34a[_0xd2f6('0x69')](_0x382dee,{'transaction':_0x4d14ba})['then'](function(){return BPromise[_0xd2f6('0x71')](_0x502c23,function(_0x2c3c8b){return db['UserOpenchannelQueue'][_0xd2f6('0x72')]({'where':{'UserId':_0x2c3c8b['id'],'OpenchannelQueueId':_0x4cd640[_0xd2f6('0x4b')]['id']},'transaction':_0x4d14ba});});})['then'](function(){_0x502c23['forEach'](function(_0x2ee0b6){socket[_0xd2f6('0x73')]('userOpenchannelQueue:save',{'UserId':_0x2ee0b6['id'],'OpenchannelQueueId':_0x41f34a['id']});});});});});}})['then'](respondWithStatusCode(_0x3cd651,null))[_0xd2f6('0x57')](handleError(_0x3cd651,null));};exports['removeTeams']=function(_0x56a0bc,_0x3aa1b3,_0x1c873f){return db['Team']['findAll']({'where':{'id':_0x56a0bc[_0xd2f6('0x37')][_0xd2f6('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd2f6('0x6c')],'as':_0xd2f6('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xd2f6('0x2c')](handleEntityNotFound(_0x3aa1b3,null))[_0xd2f6('0x2c')](function(_0x18e82d){var _0x2cf125=_[_0xd2f6('0x33')](_0x18e82d,'id');var _0x30f1ea=[];var _0x32b209=[];var _0x5308b8=squel[_0xd2f6('0x74')]();_0x5308b8[_0xd2f6('0x75')](_0xd2f6('0x76'))[_0xd2f6('0x77')](_0xd2f6('0x78'),'tq')[_0xd2f6('0x79')](_0xd2f6('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('OpenchannelQueueId\x20=\x20?',_0x56a0bc[_0xd2f6('0x4b')]['id']);for(var _0xf422d=0x0;_0xf422d<_0x18e82d[_0xd2f6('0x3e')];_0xf422d+=0x1){let _0x591814=_0x18e82d[_0xf422d];for(var _0x43f1a8=0x0;_0x43f1a8<_0x591814[_0xd2f6('0x6e')][_0xd2f6('0x3e')];_0x43f1a8+=0x1){let _0x18973b=_0x591814[_0xd2f6('0x6e')][_0x43f1a8];var _0x23e34c=_0x5308b8[_0xd2f6('0x7b')]();_0x23e34c['where'](_0xd2f6('0x7c'),_0x18973b['id']);_0x32b209[_0xd2f6('0x7d')](db[_0xd2f6('0x6f')][_0xd2f6('0x37')](_0x23e34c[_0xd2f6('0x7e')](),{'type':db[_0xd2f6('0x6f')][_0xd2f6('0x7f')][_0xd2f6('0x80')]})[_0xd2f6('0x2c')](function(_0x442c39){if(_0x442c39['length']===0x1){return _0x18973b['id'];}else{var _0xf7b596=_[_0xd2f6('0x81')](_[_0xd2f6('0x33')](_0x442c39,_0xd2f6('0x82')),function(_0x1389f0){return _[_0xd2f6('0x83')](_0x2cf125,_0x1389f0);});if(_0xf7b596){return _0x18973b['id'];}}}));}}return BPromise[_0xd2f6('0x84')](_0x32b209)['then'](function(_0x55caac){_0x30f1ea=_(_0x30f1ea)[_0xd2f6('0x85')](_0x55caac)[_0xd2f6('0x86')]()[_0xd2f6('0x87')]();return db[_0xd2f6('0x34')]['find']({'where':{'id':_0x56a0bc[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](function(_0x43db79){return db[_0xd2f6('0x6f')][_0xd2f6('0x70')](function(_0x350324){return _0x43db79[_0xd2f6('0x88')](_0x56a0bc['query'][_0xd2f6('0x6a')],{'transaction':_0x350324})['then'](function(){if(!_[_0xd2f6('0x89')](_0x30f1ea)){return _0x43db79[_0xd2f6('0x8a')](_0x30f1ea,{'transaction':_0x350324});}})[_0xd2f6('0x2c')](function(){_0x30f1ea[_0xd2f6('0x8b')](function(_0x481095){socket[_0xd2f6('0x73')](_0xd2f6('0x8c'),{'UserId':_0x481095,'OpenchannelQueueId':_0x43db79['id']});});});});});});})[_0xd2f6('0x2c')](respondWithStatusCode(_0x3aa1b3,null))[_0xd2f6('0x57')](handleError(_0x3aa1b3,null));};exports[_0xd2f6('0x8d')]=function(_0xe49071,_0x3d9877,_0x5bb7d3){return db[_0xd2f6('0x34')][_0xd2f6('0x4d')]({'where':{'id':_0xe49071[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x3d9877,null))['then'](function(_0x49faa9){if(_0x49faa9){return _0x49faa9[_0xd2f6('0x8d')](_0xe49071[_0xd2f6('0x4f')][_0xd2f6('0x6a')],_[_0xd2f6('0x8e')](_0xe49071[_0xd2f6('0x4f')],[_0xd2f6('0x6a'),'id'])||{})[_0xd2f6('0x8f')](function(_0x4ea554){for(var _0x6ce338=0x0;_0x6ce338<_0xe49071[_0xd2f6('0x4f')][_0xd2f6('0x6a')]['length'];_0x6ce338+=0x1){socket['emit'](_0xd2f6('0x90'),{'UserId':Number(_0xe49071['body'][_0xd2f6('0x6a')][_0x6ce338]),'OpenchannelQueueId':Number(_0xe49071[_0xd2f6('0x4b')]['id'])});}return _0x4ea554;});}})[_0xd2f6('0x2c')](respondWithResult(_0x3d9877,null))[_0xd2f6('0x57')](handleError(_0x3d9877,null));};exports[_0xd2f6('0x8a')]=function(_0x3d9d7f,_0x5f1517,_0x137c6e){return db[_0xd2f6('0x34')][_0xd2f6('0x4d')]({'where':{'id':_0x3d9d7f['params']['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x5f1517,null))['then'](function(_0x3f2cf1){if(_0x3f2cf1){return _0x3f2cf1[_0xd2f6('0x8a')](_0x3d9d7f[_0xd2f6('0x37')][_0xd2f6('0x6a')])['then'](function(){if(_[_0xd2f6('0x91')](_0x3d9d7f[_0xd2f6('0x37')]['ids'])){for(var _0x56308e=0x0;_0x56308e<_0x3d9d7f[_0xd2f6('0x37')][_0xd2f6('0x6a')][_0xd2f6('0x3e')];_0x56308e+=0x1){socket[_0xd2f6('0x73')](_0xd2f6('0x8c'),{'UserId':Number(_0x3d9d7f[_0xd2f6('0x37')]['ids'][_0x56308e]),'OpenchannelQueueId':Number(_0x3d9d7f[_0xd2f6('0x4b')]['id'])});}}else{socket['emit'](_0xd2f6('0x8c'),{'UserId':Number(_0x3d9d7f['query']['ids']),'OpenchannelQueueId':Number(_0x3d9d7f[_0xd2f6('0x4b')]['id'])});}});}})[_0xd2f6('0x2c')](respondWithStatusCode(_0x5f1517,null))[_0xd2f6('0x57')](handleError(_0x5f1517,null));};exports[_0xd2f6('0x92')]=function(_0x1c65a5,_0x1968ea,_0x50828f){var _0x2ed7d6={};var _0x55803a={};var _0x51d491;var _0x71ed16;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x1c65a5[_0xd2f6('0x4b')]['id']}})[_0xd2f6('0x2c')](handleEntityNotFound(_0x1968ea,null))[_0xd2f6('0x2c')](function(_0x2ec09a){if(_0x2ec09a){_0x51d491=_0x2ec09a;_0x55803a[_0xd2f6('0x3c')]=_[_0xd2f6('0x38')](db['User']['rawAttributes']);_0x55803a[_0xd2f6('0x37')]=_['keys'](_0x1c65a5[_0xd2f6('0x37')]);_0x55803a['filters']=_['intersection'](_0x55803a['model'],_0x55803a[_0xd2f6('0x37')]);_0x2ed7d6[_0xd2f6('0x3b')]=_[_0xd2f6('0x3a')](_0x55803a['model'],qs[_0xd2f6('0x3d')](_0x1c65a5[_0xd2f6('0x37')]['fields']));_0x2ed7d6[_0xd2f6('0x3b')]=_0x2ed7d6['attributes'][_0xd2f6('0x3e')]?_0x2ed7d6['attributes']:_0x55803a[_0xd2f6('0x3c')];_0x2ed7d6[_0xd2f6('0x40')]=qs[_0xd2f6('0x5f')](_0x1c65a5[_0xd2f6('0x37')][_0xd2f6('0x5f')]);_0x2ed7d6[_0xd2f6('0x41')]=qs[_0xd2f6('0x39')](_[_0xd2f6('0x60')](_0x1c65a5['query'],_0x55803a[_0xd2f6('0x39')]));if(_0x1c65a5['query'][_0xd2f6('0x42')]){_0x2ed7d6[_0xd2f6('0x41')]=_[_0xd2f6('0x4c')](_0x2ed7d6['where'],{'$or':_['map'](_0x2ed7d6['attributes'],function(_0x565e3e){var _0x5b7c92={};_0x5b7c92[_0x565e3e]={'$like':'%'+_0x1c65a5[_0xd2f6('0x37')][_0xd2f6('0x42')]+'%'};return _0x5b7c92;})});}_0x2ed7d6=_['merge']({},_0x2ed7d6,_0x1c65a5[_0xd2f6('0x45')]);return _0x51d491[_0xd2f6('0x92')](_0x2ed7d6);}})[_0xd2f6('0x2c')](function(_0x2488a7){if(_0x2488a7){_0x71ed16=_0x2488a7[_0xd2f6('0x3e')];if(!_0x1c65a5['query'][_0xd2f6('0x5e')](_0xd2f6('0x3f'))){_0x2ed7d6['limit']=qs[_0xd2f6('0x23')](_0x1c65a5[_0xd2f6('0x37')][_0xd2f6('0x23')]);_0x2ed7d6[_0xd2f6('0x21')]=qs['offset'](_0x1c65a5[_0xd2f6('0x37')][_0xd2f6('0x21')]);}return _0x51d491['getAgents'](_0x2ed7d6);}})[_0xd2f6('0x2c')](function(_0x266776){if(_0x266776){return _0x266776?{'count':_0x71ed16,'rows':_0x266776}:null;}})['then'](respondWithResult(_0x1968ea,null))['catch'](handleError(_0x1968ea,null));}; \ No newline at end of file +var _0x117a=['team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','toString','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','addAgents','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./openchannelQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','get','OpenchannelQueues','UserProfileResource','destroy','then','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserOpenchannelQueue','nolimit','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','from'];(function(_0x51de25,_0x1940a2){var _0x55e49b=function(_0x3f05bf){while(--_0x3f05bf){_0x51de25['push'](_0x51de25['shift']());}};_0x55e49b(++_0x1940a2);}(_0x117a,0xa3));var _0xa117=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x117a[_0x46a3ff];return _0x404bc2;};'use strict';var emlformat=require(_0xa117('0x0'));var rimraf=require(_0xa117('0x1'));var zipdir=require(_0xa117('0x2'));var jsonpatch=require(_0xa117('0x3'));var rp=require(_0xa117('0x4'));var moment=require(_0xa117('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa117('0x6'));var util=require(_0xa117('0x7'));var path=require(_0xa117('0x8'));var sox=require(_0xa117('0x9'));var csv=require(_0xa117('0xa'));var ejs=require(_0xa117('0xb'));var fs=require('fs');var fs_extra=require(_0xa117('0xc'));var _=require(_0xa117('0xd'));var squel=require(_0xa117('0xe'));var crypto=require('crypto');var jsforce=require(_0xa117('0xf'));var deskjs=require(_0xa117('0x10'));var toCsv=require(_0xa117('0xa'));var querystring=require(_0xa117('0x11'));var Papa=require(_0xa117('0x12'));var Redis=require(_0xa117('0x13'));var authService=require(_0xa117('0x14'));var qs=require(_0xa117('0x15'));var as=require(_0xa117('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa117('0x17'))(_0xa117('0x18'));var utils=require(_0xa117('0x19'));var config=require(_0xa117('0x1a'));var licenseUtil=require(_0xa117('0x1b'));var db=require('../../mysqldb')['db'];config[_0xa117('0x1c')]=_['defaults'](config['redis'],{'host':_0xa117('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa117('0x1e'))[_0xa117('0x1f')](socket);function respondWithStatusCode(_0x23df20,_0x494450){_0x494450=_0x494450||0xcc;return function(_0x16a12f){if(_0x16a12f){return _0x23df20['sendStatus'](_0x494450);}return _0x23df20[_0xa117('0x20')](_0x494450)[_0xa117('0x21')]();};}function respondWithResult(_0x4f711b,_0x4d1fcd){_0x4d1fcd=_0x4d1fcd||0xc8;return function(_0x3a4d9b){if(_0x3a4d9b){return _0x4f711b[_0xa117('0x20')](_0x4d1fcd)[_0xa117('0x22')](_0x3a4d9b);}};}function respondWithFilteredResult(_0x1a20b3,_0x45e68a){return function(_0x21ed66){if(_0x21ed66){var _0x9491fd=typeof _0x45e68a[_0xa117('0x23')]===_0xa117('0x24')&&typeof _0x45e68a['limit']===_0xa117('0x24');var _0x401d25=_0x21ed66['count'];var _0x43c20a=_0x9491fd?0x0:_0x45e68a[_0xa117('0x23')];var _0x1a3694=_0x9491fd?_0x21ed66[_0xa117('0x25')]:_0x45e68a[_0xa117('0x23')]+_0x45e68a[_0xa117('0x26')];var _0x2805f8;if(_0x1a3694>=_0x401d25){_0x1a3694=_0x401d25;_0x2805f8=0xc8;}else{_0x2805f8=0xce;}_0x1a20b3[_0xa117('0x20')](_0x2805f8);return _0x1a20b3[_0xa117('0x27')](_0xa117('0x28'),_0x43c20a+'-'+_0x1a3694+'/'+_0x401d25)['json'](_0x21ed66);}return null;};}function patchUpdates(_0x4fde8d){return function(_0x1e32e1){try{jsonpatch['apply'](_0x1e32e1,_0x4fde8d,!![]);}catch(_0x20dbf0){return BPromise[_0xa117('0x29')](_0x20dbf0);}return _0x1e32e1['save']();};}function saveUpdates(_0x233720,_0x57025b){return function(_0x312e28){if(_0x312e28){return _0x312e28['update'](_0x233720)['then'](function(_0x262d6e){return _0x262d6e;});}return null;};}function removeEntity(_0x16b627,_0x47f891){return function(_0x487b15){if(_0x487b15){return _0x487b15['destroy']()['then'](function(){var _0x70aa2a=_0x487b15[_0xa117('0x2a')]({'plain':!![]});var _0x1c34a1=_0xa117('0x2b');return db[_0xa117('0x2c')][_0xa117('0x2d')]({'where':{'type':_0x1c34a1,'resourceId':_0x70aa2a['id']}})['then'](function(){return _0x487b15;});})[_0xa117('0x2e')](function(){_0x16b627[_0xa117('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216840,_0x4388fb){return function(_0x2feae4){if(!_0x2feae4){_0x216840[_0xa117('0x2f')](0x194);}return _0x2feae4;};}function handleError(_0x1097a7,_0x52a748){_0x52a748=_0x52a748||0x1f4;return function(_0x3b5eb7){logger[_0xa117('0x30')](_0x3b5eb7[_0xa117('0x31')]);if(_0x3b5eb7[_0xa117('0x32')]){delete _0x3b5eb7[_0xa117('0x32')];}_0x1097a7[_0xa117('0x20')](_0x52a748)[_0xa117('0x33')](_0x3b5eb7);};}exports[_0xa117('0x34')]=function(_0xc76ed4,_0x427619){var _0x13a548={},_0x417b44={},_0x5470a0={'count':0x0,'rows':[]};var _0x2eadfa=_[_0xa117('0x35')](db[_0xa117('0x36')][_0xa117('0x37')],function(_0x17f8d3){return{'name':_0x17f8d3[_0xa117('0x38')],'type':_0x17f8d3['type'][_0xa117('0x39')]};});_0x417b44['model']=_['map'](_0x2eadfa,'name');_0x417b44[_0xa117('0x3a')]=_[_0xa117('0x3b')](_0xc76ed4['query']);_0x417b44[_0xa117('0x3c')]=_[_0xa117('0x3d')](_0x417b44['model'],_0x417b44['query']);_0x13a548[_0xa117('0x3e')]=_[_0xa117('0x3d')](_0x417b44[_0xa117('0x3f')],qs[_0xa117('0x40')](_0xc76ed4[_0xa117('0x3a')]['fields']));_0x13a548[_0xa117('0x3e')]=_0x13a548['attributes']['length']?_0x13a548[_0xa117('0x3e')]:_0x417b44['model'];if(!_0xc76ed4[_0xa117('0x3a')][_0xa117('0x41')]('nolimit')){_0x13a548[_0xa117('0x26')]=qs[_0xa117('0x26')](_0xc76ed4[_0xa117('0x3a')]['limit']);_0x13a548[_0xa117('0x23')]=qs[_0xa117('0x23')](_0xc76ed4[_0xa117('0x3a')][_0xa117('0x23')]);}_0x13a548[_0xa117('0x42')]=qs[_0xa117('0x43')](_0xc76ed4[_0xa117('0x3a')][_0xa117('0x43')]);_0x13a548['where']=qs[_0xa117('0x3c')](_[_0xa117('0x44')](_0xc76ed4[_0xa117('0x3a')],_0x417b44[_0xa117('0x3c')]),_0x2eadfa);if(_0xc76ed4['query'][_0xa117('0x45')]){_0x13a548['where']=_[_0xa117('0x46')](_0x13a548[_0xa117('0x47')],{'$or':_['map'](_0x2eadfa,function(_0x3cc56f){if(_0x3cc56f[_0xa117('0x48')]!==_0xa117('0x49')){var _0xbc17={};_0xbc17[_0x3cc56f[_0xa117('0x32')]]={'$like':'%'+_0xc76ed4[_0xa117('0x3a')][_0xa117('0x45')]+'%'};return _0xbc17;}})});}_0x13a548=_[_0xa117('0x46')]({},_0x13a548,_0xc76ed4[_0xa117('0x4a')]);var _0x24a65d={'where':_0x13a548['where']};return db[_0xa117('0x36')][_0xa117('0x25')](_0x24a65d)[_0xa117('0x2e')](function(_0x10ddec){_0x5470a0[_0xa117('0x25')]=_0x10ddec;if(_0xc76ed4[_0xa117('0x3a')][_0xa117('0x4b')]){_0x13a548[_0xa117('0x4c')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x13a548);})[_0xa117('0x2e')](function(_0x37a366){_0x5470a0[_0xa117('0x4d')]=_0x37a366;return _0x5470a0;})['then'](respondWithFilteredResult(_0x427619,_0x13a548))[_0xa117('0x4e')](handleError(_0x427619,null));};exports[_0xa117('0x4f')]=function(_0x35a2f5,_0x3ddf00){var _0x2b1aeb={'raw':!![],'where':{'id':_0x35a2f5[_0xa117('0x50')]['id']}},_0x4386fc={};_0x4386fc[_0xa117('0x3f')]=_[_0xa117('0x3b')](db['OpenchannelQueue'][_0xa117('0x37')]);_0x4386fc[_0xa117('0x3a')]=_[_0xa117('0x3b')](_0x35a2f5[_0xa117('0x3a')]);_0x4386fc[_0xa117('0x3c')]=_[_0xa117('0x3d')](_0x4386fc[_0xa117('0x3f')],_0x4386fc['query']);_0x2b1aeb['attributes']=_[_0xa117('0x3d')](_0x4386fc[_0xa117('0x3f')],qs[_0xa117('0x40')](_0x35a2f5[_0xa117('0x3a')][_0xa117('0x40')]));_0x2b1aeb[_0xa117('0x3e')]=_0x2b1aeb[_0xa117('0x3e')][_0xa117('0x51')]?_0x2b1aeb[_0xa117('0x3e')]:_0x4386fc[_0xa117('0x3f')];if(_0x35a2f5[_0xa117('0x3a')]['includeAll']){_0x2b1aeb[_0xa117('0x4c')]=[{'all':!![]}];}_0x2b1aeb=_[_0xa117('0x46')]({},_0x2b1aeb,_0x35a2f5[_0xa117('0x4a')]);return db['OpenchannelQueue'][_0xa117('0x52')](_0x2b1aeb)['then'](handleEntityNotFound(_0x3ddf00,null))['then'](respondWithResult(_0x3ddf00,null))[_0xa117('0x4e')](handleError(_0x3ddf00,null));};exports[_0xa117('0x53')]=function(_0xbb31b3,_0x6b6a1b){return db[_0xa117('0x36')]['create'](_0xbb31b3[_0xa117('0x54')],{})[_0xa117('0x2e')](function(_0x17451e){var _0x6efa8f=_0xbb31b3[_0xa117('0x55')][_0xa117('0x2a')]({'plain':!![]});if(!_0x6efa8f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6efa8f[_0xa117('0x56')]===_0xa117('0x55')){var _0xeaf7e0=_0x17451e[_0xa117('0x2a')]({'plain':!![]});var _0x246619=_0xa117('0x2b');return db[_0xa117('0x57')]['find']({'where':{'name':_0x246619,'userProfileId':_0x6efa8f[_0xa117('0x58')]},'raw':!![]})['then'](function(_0xcea10e){if(_0xcea10e&&_0xcea10e[_0xa117('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0xeaf7e0[_0xa117('0x32')],'resourceId':_0xeaf7e0['id'],'type':_0xcea10e[_0xa117('0x32')],'sectionId':_0xcea10e['id']},{})[_0xa117('0x2e')](function(){return _0x17451e;});}else{return _0x17451e;}})['catch'](function(_0x415333){logger[_0xa117('0x30')](_0xa117('0x5a'),_0x415333);throw _0x415333;});}return _0x17451e;})[_0xa117('0x2e')](respondWithResult(_0x6b6a1b,0xc9))[_0xa117('0x4e')](handleError(_0x6b6a1b,null));};exports[_0xa117('0x5b')]=function(_0xedfa56,_0x5339d6){if(_0xedfa56['body']['id']){delete _0xedfa56[_0xa117('0x54')]['id'];}return db[_0xa117('0x36')][_0xa117('0x52')]({'where':{'id':_0xedfa56[_0xa117('0x50')]['id']}})[_0xa117('0x2e')](handleEntityNotFound(_0x5339d6,null))[_0xa117('0x2e')](saveUpdates(_0xedfa56[_0xa117('0x54')],null))[_0xa117('0x2e')](respondWithResult(_0x5339d6,null))['catch'](handleError(_0x5339d6,null));};exports[_0xa117('0x2d')]=function(_0x19ffcc,_0x52a970){return db[_0xa117('0x36')][_0xa117('0x52')]({'where':{'id':_0x19ffcc[_0xa117('0x50')]['id']}})[_0xa117('0x2e')](handleEntityNotFound(_0x52a970,null))[_0xa117('0x2e')](removeEntity(_0x52a970,null))[_0xa117('0x4e')](handleError(_0x52a970,null));};exports[_0xa117('0x5c')]=function(_0x52afff,_0x16cfa4){return db['OpenchannelQueue']['describe']()[_0xa117('0x2e')](respondWithResult(_0x16cfa4,null))[_0xa117('0x4e')](handleError(_0x16cfa4,null));};exports['getMembers']=function(_0x37abb4,_0x1192db,_0x31d6dc){var _0x36aaf4={'raw':!![],'where':{}},_0x2471eb={},_0x42f6a1;return db[_0xa117('0x36')]['findOne']({'where':{'id':_0x37abb4[_0xa117('0x50')]['id']}})['then'](handleEntityNotFound(_0x1192db,null))[_0xa117('0x2e')](function(_0x30515c){if(_0x30515c){_0x42f6a1=_0x30515c['get']({'plain':!![]});_0x2471eb[_0xa117('0x3f')]=_[_0xa117('0x3b')](db[_0xa117('0x5d')][_0xa117('0x37')]);_0x2471eb[_0xa117('0x3a')]=_[_0xa117('0x3b')](_0x37abb4[_0xa117('0x3a')]);_0x2471eb[_0xa117('0x3c')]=_[_0xa117('0x3d')](_0x2471eb[_0xa117('0x3f')],_0x2471eb[_0xa117('0x3a')]);_0x36aaf4[_0xa117('0x3e')]=_[_0xa117('0x3d')](_0x2471eb['model'],qs[_0xa117('0x40')](_0x37abb4[_0xa117('0x3a')][_0xa117('0x40')]));_0x36aaf4[_0xa117('0x3e')]=_0x36aaf4[_0xa117('0x3e')][_0xa117('0x51')]?_0x36aaf4[_0xa117('0x3e')]:_0x2471eb['model'];if(!_0x37abb4['query']['hasOwnProperty'](_0xa117('0x5e'))){_0x36aaf4['limit']=qs['limit'](_0x37abb4[_0xa117('0x3a')][_0xa117('0x26')]);_0x36aaf4[_0xa117('0x23')]=qs['offset'](_0x37abb4['query'][_0xa117('0x23')]);}_0x36aaf4[_0xa117('0x42')]=qs[_0xa117('0x43')](_0x37abb4[_0xa117('0x3a')]['sort']);_0x36aaf4[_0xa117('0x47')]=qs[_0xa117('0x3c')](_[_0xa117('0x44')](_0x37abb4[_0xa117('0x3a')],_0x2471eb[_0xa117('0x3c')]));_0x36aaf4[_0xa117('0x47')][_0xa117('0x5f')]=_0x30515c['id'];if(_0x37abb4[_0xa117('0x3a')]['filter']){_0x36aaf4['where']=_[_0xa117('0x46')](_0x36aaf4['where'],{'$or':_['map'](_0x36aaf4[_0xa117('0x3e')],function(_0x52817f){var _0x43c7dc={};_0x43c7dc[_0x52817f]={'$like':'%'+_0x37abb4[_0xa117('0x3a')][_0xa117('0x45')]+'%'};return _0x43c7dc;})});}_0x36aaf4=_[_0xa117('0x46')]({},_0x36aaf4,_0x37abb4[_0xa117('0x4a')]);return db[_0xa117('0x5d')][_0xa117('0x60')](_0x36aaf4);}})['then'](function(_0x5b92ac){if(_0x5b92ac){return db[_0xa117('0x61')][_0xa117('0x62')]({'where':{'id':_[_0xa117('0x35')](_0x5b92ac,_0xa117('0x63')),'role':'agent'},'attributes':['id',_0xa117('0x32'),'openchannelPause',_0xa117('0x64'),_0xa117('0x65')]});}})['then'](function(_0x121bcd){if(_0x121bcd){return{'count':_0x121bcd[_0xa117('0x25')],'rows':_[_0xa117('0x35')](_0x121bcd[_0xa117('0x4d')],function(_0x4bfafe){return{'membername':_0x4bfafe['name'],'UserId':_0x4bfafe['id'],'queue_name':_0x42f6a1['name'],'OpenchannelQueueId':_0x42f6a1['id'],'interface':util[_0xa117('0x66')](_0xa117('0x67'),_0xa117('0x68'),_0x4bfafe[_0xa117('0x32')]),'penalty':0x0,'paused':_0x4bfafe['openchannelPause'],'createdAt':_0x4bfafe[_0xa117('0x65')],'updatedAt':_0x4bfafe[_0xa117('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa117('0x2e')](respondWithFilteredResult(_0x1192db,_0x36aaf4))[_0xa117('0x4e')](handleError(_0x1192db,null));};exports[_0xa117('0x69')]=function(_0x2b51bd,_0x5c3c61,_0x3a70e1){var _0x3164da={};var _0x1b2ee7={};var _0x424480;var _0x11fef6;return db['OpenchannelQueue'][_0xa117('0x6a')]({'where':{'id':_0x2b51bd[_0xa117('0x50')]['id']}})[_0xa117('0x2e')](handleEntityNotFound(_0x5c3c61,null))[_0xa117('0x2e')](function(_0xf7c49){if(_0xf7c49){_0x424480=_0xf7c49;_0x1b2ee7[_0xa117('0x3f')]=_[_0xa117('0x3b')](db[_0xa117('0x6b')][_0xa117('0x37')]);_0x1b2ee7['query']=_[_0xa117('0x3b')](_0x2b51bd['query']);_0x1b2ee7['filters']=_[_0xa117('0x3d')](_0x1b2ee7[_0xa117('0x3f')],_0x1b2ee7[_0xa117('0x3a')]);_0x3164da[_0xa117('0x3e')]=_['intersection'](_0x1b2ee7[_0xa117('0x3f')],qs['fields'](_0x2b51bd[_0xa117('0x3a')]['fields']));_0x3164da[_0xa117('0x3e')]=_0x3164da['attributes']['length']?_0x3164da['attributes']:_0x1b2ee7['model'];_0x3164da[_0xa117('0x42')]=qs['sort'](_0x2b51bd[_0xa117('0x3a')][_0xa117('0x43')]);_0x3164da[_0xa117('0x47')]=qs[_0xa117('0x3c')](_[_0xa117('0x44')](_0x2b51bd[_0xa117('0x3a')],_0x1b2ee7[_0xa117('0x3c')]));if(_0x2b51bd[_0xa117('0x3a')][_0xa117('0x45')]){_0x3164da['where']=_['merge'](_0x3164da[_0xa117('0x47')],{'$or':_[_0xa117('0x35')](_0x3164da[_0xa117('0x3e')],function(_0x5bddbf){var _0x326f35={};_0x326f35[_0x5bddbf]={'$like':'%'+_0x2b51bd[_0xa117('0x3a')]['filter']+'%'};return _0x326f35;})});}_0x3164da=_[_0xa117('0x46')]({},_0x3164da,_0x2b51bd[_0xa117('0x4a')]);return _0x424480['getTeams'](_0x3164da);}})[_0xa117('0x2e')](function(_0xc44937){if(_0xc44937){_0x11fef6=_0xc44937['length'];if(!_0x2b51bd[_0xa117('0x3a')][_0xa117('0x41')](_0xa117('0x5e'))){_0x3164da[_0xa117('0x26')]=qs[_0xa117('0x26')](_0x2b51bd[_0xa117('0x3a')]['limit']);_0x3164da[_0xa117('0x23')]=qs[_0xa117('0x23')](_0x2b51bd[_0xa117('0x3a')][_0xa117('0x23')]);}return _0x424480['getTeams'](_0x3164da);}})[_0xa117('0x2e')](function(_0x210ff6){if(_0x210ff6){return _0x210ff6?{'count':_0x11fef6,'rows':_0x210ff6}:null;}})[_0xa117('0x2e')](respondWithResult(_0x5c3c61,null))[_0xa117('0x4e')](handleError(_0x5c3c61,null));};exports[_0xa117('0x6c')]=function(_0x1a8408,_0x135f91,_0x1c37bb){var _0x55925f=_0x1a8408['body'][_0xa117('0x6d')];return db[_0xa117('0x6b')][_0xa117('0x60')]({'where':{'id':_0x55925f},'attributes':['id'],'include':[{'model':db[_0xa117('0x61')],'as':_0xa117('0x6e'),'attributes':['id',_0xa117('0x32'),_0xa117('0x6f'),_0xa117('0x70'),_0xa117('0x71')],'raw':!![]}]})['then'](function(_0x17ff59){if(_0x17ff59){var _0x26b7fb=_['flatMap'](_0x17ff59,function(_0x22fca2){var _0xcfa76d=_0x22fca2[_0xa117('0x2a')]({'plain':!![]});return _0xcfa76d[_0xa117('0x6e')];});return db[_0xa117('0x36')][_0xa117('0x52')]({'where':{'id':_0x1a8408['params']['id']}})[_0xa117('0x2e')](function(_0x33a76e){return db['sequelize'][_0xa117('0x72')](function(_0x27baae){return _0x33a76e[_0xa117('0x6c')](_0x55925f,{'transaction':_0x27baae})[_0xa117('0x2e')](function(){return BPromise[_0xa117('0x73')](_0x26b7fb,function(_0x2653dd){return db[_0xa117('0x5d')][_0xa117('0x74')]({'where':{'UserId':_0x2653dd['id'],'OpenchannelQueueId':_0x1a8408[_0xa117('0x50')]['id']},'transaction':_0x27baae});});})[_0xa117('0x2e')](function(){_0x26b7fb[_0xa117('0x75')](function(_0x4285f5){socket[_0xa117('0x76')](_0xa117('0x77'),{'UserId':_0x4285f5['id'],'OpenchannelQueueId':_0x33a76e['id']});});});});});}})[_0xa117('0x2e')](respondWithStatusCode(_0x135f91,null))[_0xa117('0x4e')](handleError(_0x135f91,null));};exports['removeTeams']=function(_0x1e2c01,_0x17e9fa,_0x124e9a){return db['Team'][_0xa117('0x60')]({'where':{'id':_0x1e2c01[_0xa117('0x3a')][_0xa117('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xa117('0x61')],'as':_0xa117('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xa117('0x2e')](handleEntityNotFound(_0x17e9fa,null))['then'](function(_0x216213){var _0x59a2ec=_['map'](_0x216213,'id');var _0x28e2ff=[];var _0x373abb=[];var _0x7a3172=squel[_0xa117('0x78')]();_0x7a3172[_0xa117('0x79')]('tq.TeamId')[_0xa117('0x7a')](_0xa117('0x7b'),'tq')[_0xa117('0x7c')](_0xa117('0x7d'),'ut',_0xa117('0x7e'))[_0xa117('0x47')]('OpenchannelQueueId\x20=\x20?',_0x1e2c01['params']['id']);for(var _0x1b4680=0x0;_0x1b4680<_0x216213[_0xa117('0x51')];_0x1b4680+=0x1){let _0x1d0d85=_0x216213[_0x1b4680];for(var _0x535ab6=0x0;_0x535ab6<_0x1d0d85[_0xa117('0x6e')][_0xa117('0x51')];_0x535ab6+=0x1){let _0x13134e=_0x1d0d85[_0xa117('0x6e')][_0x535ab6];var _0x1b2b28=_0x7a3172['clone']();_0x1b2b28[_0xa117('0x47')]('ut.UserId\x20=\x20?',_0x13134e['id']);_0x373abb['push'](db['sequelize'][_0xa117('0x3a')](_0x1b2b28[_0xa117('0x7f')](),{'type':db[_0xa117('0x80')]['QueryTypes'][_0xa117('0x81')]})[_0xa117('0x2e')](function(_0x45f5d9){if(_0x45f5d9[_0xa117('0x51')]===0x1){return _0x13134e['id'];}else{var _0xb9220=_[_0xa117('0x82')](_[_0xa117('0x35')](_0x45f5d9,_0xa117('0x83')),function(_0x5e3e45){return _[_0xa117('0x84')](_0x59a2ec,_0x5e3e45);});if(_0xb9220){return _0x13134e['id'];}}}));}}return BPromise[_0xa117('0x85')](_0x373abb)[_0xa117('0x2e')](function(_0x2cfb59){_0x28e2ff=_(_0x28e2ff)[_0xa117('0x86')](_0x2cfb59)[_0xa117('0x87')]()[_0xa117('0x88')]();return db['OpenchannelQueue'][_0xa117('0x52')]({'where':{'id':_0x1e2c01[_0xa117('0x50')]['id']}})[_0xa117('0x2e')](function(_0x37cec1){return db['sequelize'][_0xa117('0x72')](function(_0x226abf){return _0x37cec1[_0xa117('0x89')](_0x1e2c01[_0xa117('0x3a')][_0xa117('0x6d')],{'transaction':_0x226abf})[_0xa117('0x2e')](function(){if(!_['isEmpty'](_0x28e2ff)){return _0x37cec1[_0xa117('0x8a')](_0x28e2ff,{'transaction':_0x226abf});}})[_0xa117('0x2e')](function(){_0x28e2ff[_0xa117('0x75')](function(_0x8dd732){socket[_0xa117('0x76')]('userOpenchannelQueue:remove',{'UserId':_0x8dd732,'OpenchannelQueueId':_0x37cec1['id']});});});});});});})[_0xa117('0x2e')](respondWithStatusCode(_0x17e9fa,null))['catch'](handleError(_0x17e9fa,null));};exports['addAgents']=function(_0x5a0cf6,_0x6c973e,_0x1d3c25){return db[_0xa117('0x36')][_0xa117('0x52')]({'where':{'id':_0x5a0cf6[_0xa117('0x50')]['id']}})[_0xa117('0x2e')](handleEntityNotFound(_0x6c973e,null))[_0xa117('0x2e')](function(_0x14da3a){if(_0x14da3a){return _0x14da3a[_0xa117('0x8b')](_0x5a0cf6['body'][_0xa117('0x6d')],_['omit'](_0x5a0cf6['body'],[_0xa117('0x6d'),'id'])||{})['spread'](function(_0x2b8bd5){for(var _0x1aaf23=0x0;_0x1aaf23<_0x5a0cf6[_0xa117('0x54')][_0xa117('0x6d')][_0xa117('0x51')];_0x1aaf23+=0x1){socket[_0xa117('0x76')](_0xa117('0x77'),{'UserId':Number(_0x5a0cf6[_0xa117('0x54')][_0xa117('0x6d')][_0x1aaf23]),'OpenchannelQueueId':Number(_0x5a0cf6['params']['id'])});}return _0x2b8bd5;});}})[_0xa117('0x2e')](respondWithResult(_0x6c973e,null))['catch'](handleError(_0x6c973e,null));};exports['removeAgents']=function(_0x453451,_0x1abac7,_0x5ab9d5){return db[_0xa117('0x36')]['find']({'where':{'id':_0x453451[_0xa117('0x50')]['id']}})[_0xa117('0x2e')](handleEntityNotFound(_0x1abac7,null))[_0xa117('0x2e')](function(_0x358775){if(_0x358775){return _0x358775['removeAgents'](_0x453451[_0xa117('0x3a')]['ids'])[_0xa117('0x2e')](function(){if(_[_0xa117('0x8c')](_0x453451['query']['ids'])){for(var _0xc90168=0x0;_0xc90168<_0x453451['query'][_0xa117('0x6d')][_0xa117('0x51')];_0xc90168+=0x1){socket[_0xa117('0x76')](_0xa117('0x8d'),{'UserId':Number(_0x453451[_0xa117('0x3a')][_0xa117('0x6d')][_0xc90168]),'OpenchannelQueueId':Number(_0x453451[_0xa117('0x50')]['id'])});}}else{socket[_0xa117('0x76')](_0xa117('0x8d'),{'UserId':Number(_0x453451['query'][_0xa117('0x6d')]),'OpenchannelQueueId':Number(_0x453451['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1abac7,null))[_0xa117('0x4e')](handleError(_0x1abac7,null));};exports['getAgents']=function(_0x42055a,_0x1c1593,_0x575d8a){var _0x3cda02={};var _0x13c81c={};var _0x33c0a7;var _0x1d7e85;return db[_0xa117('0x36')][_0xa117('0x6a')]({'where':{'id':_0x42055a[_0xa117('0x50')]['id']}})[_0xa117('0x2e')](handleEntityNotFound(_0x1c1593,null))['then'](function(_0x3266ef){if(_0x3266ef){_0x33c0a7=_0x3266ef;_0x13c81c[_0xa117('0x3f')]=_[_0xa117('0x3b')](db[_0xa117('0x61')][_0xa117('0x37')]);_0x13c81c['query']=_[_0xa117('0x3b')](_0x42055a[_0xa117('0x3a')]);_0x13c81c[_0xa117('0x3c')]=_[_0xa117('0x3d')](_0x13c81c['model'],_0x13c81c['query']);_0x3cda02[_0xa117('0x3e')]=_[_0xa117('0x3d')](_0x13c81c['model'],qs['fields'](_0x42055a[_0xa117('0x3a')][_0xa117('0x40')]));_0x3cda02['attributes']=_0x3cda02[_0xa117('0x3e')][_0xa117('0x51')]?_0x3cda02[_0xa117('0x3e')]:_0x13c81c[_0xa117('0x3f')];_0x3cda02['order']=qs[_0xa117('0x43')](_0x42055a['query'][_0xa117('0x43')]);_0x3cda02['where']=qs['filters'](_[_0xa117('0x44')](_0x42055a[_0xa117('0x3a')],_0x13c81c[_0xa117('0x3c')]));if(_0x42055a['query'][_0xa117('0x45')]){_0x3cda02[_0xa117('0x47')]=_['merge'](_0x3cda02['where'],{'$or':_[_0xa117('0x35')](_0x3cda02[_0xa117('0x3e')],function(_0x1d28dd){var _0x5866de={};_0x5866de[_0x1d28dd]={'$like':'%'+_0x42055a['query'][_0xa117('0x45')]+'%'};return _0x5866de;})});}_0x3cda02=_[_0xa117('0x46')]({},_0x3cda02,_0x42055a[_0xa117('0x4a')]);return _0x33c0a7[_0xa117('0x8e')](_0x3cda02);}})[_0xa117('0x2e')](function(_0x351254){if(_0x351254){_0x1d7e85=_0x351254[_0xa117('0x51')];if(!_0x42055a[_0xa117('0x3a')]['hasOwnProperty']('nolimit')){_0x3cda02['limit']=qs[_0xa117('0x26')](_0x42055a[_0xa117('0x3a')][_0xa117('0x26')]);_0x3cda02[_0xa117('0x23')]=qs['offset'](_0x42055a['query'][_0xa117('0x23')]);}return _0x33c0a7['getAgents'](_0x3cda02);}})[_0xa117('0x2e')](function(_0xaf90b3){if(_0xaf90b3){return _0xaf90b3?{'count':_0x1d7e85,'rows':_0xaf90b3}:null;}})[_0xa117('0x2e')](respondWithResult(_0x1c1593,null))[_0xa117('0x4e')](handleError(_0x1c1593,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 200b927..736ceff 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 _0x796b=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3ffda4,_0x282865){var _0x4b1eed=function(_0x48a3f9){while(--_0x48a3f9){_0x3ffda4['push'](_0x3ffda4['shift']());}};_0x4b1eed(++_0x282865);}(_0x796b,0x1b2));var _0xb796=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x796b[_0x47a7d0];return _0xb9bd08;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xb796('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb796('0x1')](0x0);var events={'afterCreate':_0xb796('0x2'),'afterUpdate':_0xb796('0x3'),'afterDestroy':_0xb796('0x4')};function emitEvent(_0x417e41){return function(_0x10828a,_0x1f082c,_0x2d6cca){OpenchannelQueueEvents[_0xb796('0x5')](_0x417e41+':'+_0x10828a['id'],_0x10828a);OpenchannelQueueEvents[_0xb796('0x5')](_0x417e41,_0x10828a);_0x2d6cca(null);};}for(var e in events){if(events[_0xb796('0x6')](e)){var event=events[e];OpenchannelQueue[_0xb796('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xac12=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x5a99db,_0x1cece5){var _0x3aad62=function(_0x334cb7){while(--_0x334cb7){_0x5a99db['push'](_0x5a99db['shift']());}};_0x3aad62(++_0x1cece5);}(_0xac12,0x1f2));var _0x2ac1=function(_0x338443,_0x27571f){_0x338443=_0x338443-0x0;var _0x5dbcd2=_0xac12[_0x338443];return _0x5dbcd2;};'use strict';var EventEmitter=require(_0x2ac1('0x0'));var OpenchannelQueue=require(_0x2ac1('0x1'))['db'][_0x2ac1('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2ac1('0x3')](0x0);var events={'afterCreate':_0x2ac1('0x4'),'afterUpdate':_0x2ac1('0x5'),'afterDestroy':_0x2ac1('0x6')};function emitEvent(_0x1e5758){return function(_0x4ed7da,_0x1223c1,_0x222e60){OpenchannelQueueEvents[_0x2ac1('0x7')](_0x1e5758+':'+_0x4ed7da['id'],_0x4ed7da);OpenchannelQueueEvents[_0x2ac1('0x7')](_0x1e5758,_0x4ed7da);_0x222e60(null);};}for(var e in events){if(events[_0x2ac1('0x8')](e)){var event=events[e];OpenchannelQueue[_0x2ac1('0x9')](e,emitEvent(event));}}module[_0x2ac1('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 8a9f431..64f09f6 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 _0xdca5=['OpenchannelQueue','openchannel_queues','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define'];(function(_0x67f123,_0x261bd3){var _0x36b061=function(_0x1c8ec4){while(--_0x1c8ec4){_0x67f123['push'](_0x67f123['shift']());}};_0x36b061(++_0x261bd3);}(_0xdca5,0xa2));var _0x5dca=function(_0x2f2ce8,_0x496926){_0x2f2ce8=_0x2f2ce8-0x0;var _0xdf72df=_0xdca5[_0x2f2ce8];return _0xdf72df;};'use strict';var _=require(_0x5dca('0x0'));var util=require('util');var logger=require(_0x5dca('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5dca('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dca('0x3'));var config=require(_0x5dca('0x4'));var attributes=require(_0x5dca('0x5'));module[_0x5dca('0x6')]=function(_0xf1d8d8,_0xa20b8e){return _0xf1d8d8[_0x5dca('0x7')](_0x5dca('0x8'),attributes,{'tableName':_0x5dca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ae6=['exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x15b2fa,_0x234352){var _0x1d651a=function(_0x163595){while(--_0x163595){_0x15b2fa['push'](_0x15b2fa['shift']());}};_0x1d651a(++_0x234352);}(_0x3ae6,0x130));var _0x63ae=function(_0x529fba,_0x3949e9){_0x529fba=_0x529fba-0x0;var _0x217a67=_0x3ae6[_0x529fba];return _0x217a67;};'use strict';var _=require(_0x63ae('0x0'));var util=require(_0x63ae('0x1'));var logger=require('../../config/logger')(_0x63ae('0x2'));var moment=require('moment');var BPromise=require(_0x63ae('0x3'));var rp=require(_0x63ae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63ae('0x5'));var config=require(_0x63ae('0x6'));var attributes=require(_0x63ae('0x7'));module[_0x63ae('0x8')]=function(_0x3cb48e,_0x42e144){return _0x3cb48e[_0x63ae('0x9')](_0x63ae('0xa'),attributes,{'tableName':_0x63ae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 6dade2e..2fb3dcd 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 _0x8137=['request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','map','include','model','catch','ShowOpenchannelQueue','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x8137,0xaf));var _0x7813=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x8137[_0x1deb03];return _0x189fe7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7813('0x0'));var rs=require(_0x7813('0x1'));var fs=require('fs');var Redis=require(_0x7813('0x2'));var db=require(_0x7813('0x3'))['db'];var utils=require(_0x7813('0x4'));var logger=require('../../config/logger')(_0x7813('0x5'));var config=require(_0x7813('0x6'));var jayson=require(_0x7813('0x7'));var client=jayson[_0x7813('0x8')][_0x7813('0x9')]({'port':0x232a});config[_0x7813('0xa')]=_[_0x7813('0xb')](config[_0x7813('0xa')],{'host':_0x7813('0xc'),'port':0x18eb});var socket=require(_0x7813('0xd'))(new Redis(config[_0x7813('0xa')]));require('./openchannelQueue.socket')[_0x7813('0xe')](socket);function respondWithRpcPromise(_0x32967c,_0x4ffcfa,_0x44262e){return new BPromise(function(_0x584ccd,_0x3c4202){return client[_0x7813('0xf')](_0x32967c,_0x44262e)[_0x7813('0x10')](function(_0x515e94){logger[_0x7813('0x11')](_0x7813('0x12'),_0x4ffcfa,_0x7813('0x13'));logger[_0x7813('0x14')](_0x7813('0x15'),_0x4ffcfa,'request\x20sent',JSON[_0x7813('0x16')](_0x515e94));if(_0x515e94['error']){if(_0x515e94[_0x7813('0x17')][_0x7813('0x18')]===0x1f4){logger[_0x7813('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ffcfa,_0x515e94['error'][_0x7813('0x19')]);return _0x3c4202(_0x515e94['error'][_0x7813('0x19')]);}logger[_0x7813('0x17')](_0x7813('0x12'),_0x4ffcfa,_0x515e94[_0x7813('0x17')]['message']);return _0x584ccd(_0x515e94[_0x7813('0x17')]['message']);}else{logger[_0x7813('0x11')](_0x7813('0x12'),_0x4ffcfa,'request\x20sent');_0x584ccd(_0x515e94['result'][_0x7813('0x19')]);}})['catch'](function(_0xecab14){logger[_0x7813('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x4ffcfa,_0xecab14);_0x3c4202(_0xecab14);});});}exports[_0x7813('0x1a')]=function(_0x18dd5a){var _0x21677c=this;return new Promise(function(_0x30c122,_0x5542dd){return db[_0x7813('0x1b')]['findAll']({'raw':_0x18dd5a[_0x7813('0x1c')]?_0x18dd5a[_0x7813('0x1c')][_0x7813('0x1d')]===undefined?!![]:![]:!![],'where':_0x18dd5a['options']?_0x18dd5a[_0x7813('0x1c')][_0x7813('0x1e')]||null:null,'attributes':_0x18dd5a[_0x7813('0x1c')]?_0x18dd5a['options'][_0x7813('0x1f')]||null:null,'limit':_0x18dd5a[_0x7813('0x1c')]?_0x18dd5a[_0x7813('0x1c')][_0x7813('0x20')]||null:null,'include':_0x18dd5a['options']?_0x18dd5a['options']['include']?_[_0x7813('0x21')](_0x18dd5a['options'][_0x7813('0x22')],function(_0x43cc37){return{'model':db[_0x43cc37[_0x7813('0x23')]],'as':_0x43cc37['as'],'attributes':_0x43cc37[_0x7813('0x1f')],'include':_0x43cc37[_0x7813('0x22')]?_[_0x7813('0x21')](_0x43cc37[_0x7813('0x22')],function(_0x5a42a6){return{'model':db[_0x5a42a6['model']],'as':_0x5a42a6['as'],'attributes':_0x5a42a6['attributes'],'include':_0x5a42a6[_0x7813('0x22')]?_['map'](_0x5a42a6[_0x7813('0x22')],function(_0x252a3b){return{'model':db[_0x252a3b['model']],'as':_0x252a3b['as'],'attributes':_0x252a3b[_0x7813('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6a2765){logger[_0x7813('0x11')](_0x7813('0x1a'),_0x18dd5a);logger[_0x7813('0x14')](_0x7813('0x1a'),_0x18dd5a,JSON['stringify'](_0x6a2765));_0x30c122(_0x6a2765);})[_0x7813('0x24')](function(_0x3fd59c){logger[_0x7813('0x17')](_0x7813('0x1a'),_0x3fd59c[_0x7813('0x19')],_0x18dd5a);_0x5542dd(_0x21677c[_0x7813('0x17')](0x1f4,_0x3fd59c[_0x7813('0x19')]));});});};exports[_0x7813('0x25')]=function(_0x515ac4){var _0x886b62=this;return new Promise(function(_0x44b5b5,_0xe362c4){return db['OpenchannelQueue']['find']({'raw':_0x515ac4[_0x7813('0x1c')]?_0x515ac4[_0x7813('0x1c')][_0x7813('0x1d')]===undefined?!![]:![]:!![],'where':_0x515ac4[_0x7813('0x1c')]?_0x515ac4[_0x7813('0x1c')][_0x7813('0x1e')]||null:null,'attributes':_0x515ac4[_0x7813('0x1c')]?_0x515ac4[_0x7813('0x1c')]['attributes']||null:null,'include':_0x515ac4[_0x7813('0x1c')]?_0x515ac4[_0x7813('0x1c')][_0x7813('0x22')]?_[_0x7813('0x21')](_0x515ac4[_0x7813('0x1c')][_0x7813('0x22')],function(_0x433102){return{'model':db[_0x433102[_0x7813('0x23')]],'as':_0x433102['as'],'attributes':_0x433102['attributes'],'include':_0x433102[_0x7813('0x22')]?_[_0x7813('0x21')](_0x433102[_0x7813('0x22')],function(_0x2c6f2f){return{'model':db[_0x2c6f2f['model']],'as':_0x2c6f2f['as'],'attributes':_0x2c6f2f[_0x7813('0x1f')],'include':_0x2c6f2f[_0x7813('0x22')]?_[_0x7813('0x21')](_0x2c6f2f[_0x7813('0x22')],function(_0x18629b){return{'model':db[_0x18629b[_0x7813('0x23')]],'as':_0x18629b['as'],'attributes':_0x18629b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7813('0x10')](function(_0x30077f){logger['info']('ShowOpenchannelQueue',_0x515ac4);logger[_0x7813('0x14')]('ShowOpenchannelQueue',_0x515ac4,JSON[_0x7813('0x16')](_0x30077f));_0x44b5b5(_0x30077f);})[_0x7813('0x24')](function(_0x1e255d){logger[_0x7813('0x17')](_0x7813('0x25'),_0x1e255d['message'],_0x515ac4);_0xe362c4(_0x886b62[_0x7813('0x17')](0x1f4,_0x1e255d[_0x7813('0x19')]));});});}; \ No newline at end of file +var _0x68f1=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','include','map','model','attributes','ShowOpenchannelQueue','find','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x282f8d,_0x552dda){var _0x590b5a=function(_0x548c35){while(--_0x548c35){_0x282f8d['push'](_0x282f8d['shift']());}};_0x590b5a(++_0x552dda);}(_0x68f1,0x13a));var _0x168f=function(_0x3eaf5e,_0x3c9120){_0x3eaf5e=_0x3eaf5e-0x0;var _0x2e7aad=_0x68f1[_0x3eaf5e];return _0x2e7aad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x168f('0x0'));var BPromise=require(_0x168f('0x1'));var rs=require(_0x168f('0x2'));var fs=require('fs');var Redis=require(_0x168f('0x3'));var db=require(_0x168f('0x4'))['db'];var utils=require(_0x168f('0x5'));var logger=require(_0x168f('0x6'))('rpc');var config=require(_0x168f('0x7'));var jayson=require(_0x168f('0x8'));var client=jayson[_0x168f('0x9')][_0x168f('0xa')]({'port':0x232a});config[_0x168f('0xb')]=_[_0x168f('0xc')](config[_0x168f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x168f('0xb')]));require(_0x168f('0xd'))[_0x168f('0xe')](socket);function respondWithRpcPromise(_0x5142a7,_0x108fc6,_0x1a75cb){return new BPromise(function(_0xe6f4c8,_0x49c957){return client[_0x168f('0xf')](_0x5142a7,_0x1a75cb)[_0x168f('0x10')](function(_0x469bff){logger[_0x168f('0x11')](_0x168f('0x12'),_0x108fc6,_0x168f('0x13'));logger[_0x168f('0x14')](_0x168f('0x15'),_0x108fc6,_0x168f('0x13'),JSON[_0x168f('0x16')](_0x469bff));if(_0x469bff[_0x168f('0x17')]){if(_0x469bff['error'][_0x168f('0x18')]===0x1f4){logger[_0x168f('0x17')](_0x168f('0x12'),_0x108fc6,_0x469bff[_0x168f('0x17')][_0x168f('0x19')]);return _0x49c957(_0x469bff[_0x168f('0x17')][_0x168f('0x19')]);}logger[_0x168f('0x17')](_0x168f('0x12'),_0x108fc6,_0x469bff[_0x168f('0x17')][_0x168f('0x19')]);return _0xe6f4c8(_0x469bff[_0x168f('0x17')][_0x168f('0x19')]);}else{logger[_0x168f('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x108fc6,'request\x20sent');_0xe6f4c8(_0x469bff[_0x168f('0x1a')]['message']);}})['catch'](function(_0x2d39b8){logger[_0x168f('0x17')](_0x168f('0x12'),_0x108fc6,_0x2d39b8);_0x49c957(_0x2d39b8);});});}exports[_0x168f('0x1b')]=function(_0x33d853){var _0x2bd35f=this;return new Promise(function(_0xb47fa3,_0x5ec35b){return db[_0x168f('0x1c')][_0x168f('0x1d')]({'raw':_0x33d853[_0x168f('0x1e')]?_0x33d853[_0x168f('0x1e')][_0x168f('0x1f')]===undefined?!![]:![]:!![],'where':_0x33d853[_0x168f('0x1e')]?_0x33d853[_0x168f('0x1e')][_0x168f('0x20')]||null:null,'attributes':_0x33d853[_0x168f('0x1e')]?_0x33d853['options']['attributes']||null:null,'limit':_0x33d853[_0x168f('0x1e')]?_0x33d853[_0x168f('0x1e')]['limit']||null:null,'include':_0x33d853['options']?_0x33d853['options'][_0x168f('0x21')]?_[_0x168f('0x22')](_0x33d853[_0x168f('0x1e')][_0x168f('0x21')],function(_0x3c5f9a){return{'model':db[_0x3c5f9a[_0x168f('0x23')]],'as':_0x3c5f9a['as'],'attributes':_0x3c5f9a[_0x168f('0x24')],'include':_0x3c5f9a['include']?_[_0x168f('0x22')](_0x3c5f9a[_0x168f('0x21')],function(_0x1bef9a){return{'model':db[_0x1bef9a['model']],'as':_0x1bef9a['as'],'attributes':_0x1bef9a[_0x168f('0x24')],'include':_0x1bef9a[_0x168f('0x21')]?_[_0x168f('0x22')](_0x1bef9a['include'],function(_0x13c25f){return{'model':db[_0x13c25f['model']],'as':_0x13c25f['as'],'attributes':_0x13c25f[_0x168f('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f102d){logger[_0x168f('0x11')](_0x168f('0x1b'),_0x33d853);logger[_0x168f('0x14')](_0x168f('0x1b'),_0x33d853,JSON[_0x168f('0x16')](_0x4f102d));_0xb47fa3(_0x4f102d);})['catch'](function(_0x3e5441){logger[_0x168f('0x17')]('GetOpenchannelQueue',_0x3e5441[_0x168f('0x19')],_0x33d853);_0x5ec35b(_0x2bd35f[_0x168f('0x17')](0x1f4,_0x3e5441['message']));});});};exports[_0x168f('0x25')]=function(_0x38c75d){var _0x40c34a=this;return new Promise(function(_0x12dd79,_0x12859a){return db[_0x168f('0x1c')][_0x168f('0x26')]({'raw':_0x38c75d[_0x168f('0x1e')]?_0x38c75d[_0x168f('0x1e')][_0x168f('0x1f')]===undefined?!![]:![]:!![],'where':_0x38c75d[_0x168f('0x1e')]?_0x38c75d['options'][_0x168f('0x20')]||null:null,'attributes':_0x38c75d[_0x168f('0x1e')]?_0x38c75d[_0x168f('0x1e')][_0x168f('0x24')]||null:null,'include':_0x38c75d['options']?_0x38c75d[_0x168f('0x1e')][_0x168f('0x21')]?_[_0x168f('0x22')](_0x38c75d[_0x168f('0x1e')]['include'],function(_0x22c951){return{'model':db[_0x22c951[_0x168f('0x23')]],'as':_0x22c951['as'],'attributes':_0x22c951[_0x168f('0x24')],'include':_0x22c951['include']?_[_0x168f('0x22')](_0x22c951[_0x168f('0x21')],function(_0x43e5ae){return{'model':db[_0x43e5ae[_0x168f('0x23')]],'as':_0x43e5ae['as'],'attributes':_0x43e5ae['attributes'],'include':_0x43e5ae[_0x168f('0x21')]?_[_0x168f('0x22')](_0x43e5ae[_0x168f('0x21')],function(_0x4615b3){return{'model':db[_0x4615b3['model']],'as':_0x4615b3['as'],'attributes':_0x4615b3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x56a8a4){logger[_0x168f('0x11')](_0x168f('0x25'),_0x38c75d);logger[_0x168f('0x14')](_0x168f('0x25'),_0x38c75d,JSON['stringify'](_0x56a8a4));_0x12dd79(_0x56a8a4);})[_0x168f('0x27')](function(_0x1f5426){logger[_0x168f('0x17')](_0x168f('0x25'),_0x1f5426['message'],_0x38c75d);_0x12859a(_0x40c34a[_0x168f('0x17')](0x1f4,_0x1f5426[_0x168f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 9deb8cc..e05b1bc 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 _0x23da=['removeListener','register','length','openchannelQueue:','remove','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x23da,0xb2));var _0xa23d=function(_0x52c5d7,_0x16312c){_0x52c5d7=_0x52c5d7-0x0;var _0xf3b893=_0x23da[_0x52c5d7];return _0xf3b893;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0xa23d('0x0'),'update'];function createListener(_0x1df079,_0x4f976c){return function(_0x3cff01){_0x4f976c[_0xa23d('0x1')](_0x1df079,_0x3cff01);};}function removeListener(_0x390a63,_0x10ed52){return function(){OpenchannelQueueEvents[_0xa23d('0x2')](_0x390a63,_0x10ed52);};}exports[_0xa23d('0x3')]=function(_0x153419){for(var _0x13c2f8=0x0,_0x1a75d3=events[_0xa23d('0x4')];_0x13c2f8<_0x1a75d3;_0x13c2f8++){var _0x437722=events[_0x13c2f8];var _0x3053e4=createListener(_0xa23d('0x5')+_0x437722,_0x153419);OpenchannelQueueEvents['on'](_0x437722,_0x3053e4);}}; \ No newline at end of file +var _0x9533=['length','./openchannelQueue.events','remove','emit','removeListener','register'];(function(_0x3a96c7,_0x29d10f){var _0x496008=function(_0x2e6593){while(--_0x2e6593){_0x3a96c7['push'](_0x3a96c7['shift']());}};_0x496008(++_0x29d10f);}(_0x9533,0xf1));var _0x3953=function(_0x1d42f1,_0x100bf8){_0x1d42f1=_0x1d42f1-0x0;var _0x470ddd=_0x9533[_0x1d42f1];return _0x470ddd;};'use strict';var OpenchannelQueueEvents=require(_0x3953('0x0'));var events=['save',_0x3953('0x1'),'update'];function createListener(_0x7077cf,_0x4cb78b){return function(_0x312209){_0x4cb78b[_0x3953('0x2')](_0x7077cf,_0x312209);};}function removeListener(_0x769770,_0xcfe3d3){return function(){OpenchannelQueueEvents[_0x3953('0x3')](_0x769770,_0xcfe3d3);};}exports[_0x3953('0x4')]=function(_0x28098d){for(var _0x4d7458=0x0,_0xa98f17=events[_0x3953('0x5')];_0x4d7458<_0xa98f17;_0x4d7458++){var _0x3d319b=events[_0x4d7458];var _0xef28fa=createListener('openchannelQueue:'+_0x3d319b,_0x28098d);OpenchannelQueueEvents['on'](_0x3d319b,_0xef28fa);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 365a1d3..67bcafa 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 _0xbadd=['../../config/environment','get','isAuthenticated','index','describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55bd38,_0x48eacf){var _0x444323=function(_0x22c59c){while(--_0x22c59c){_0x55bd38['push'](_0x55bd38['shift']());}};_0x444323(++_0x48eacf);}(_0xbadd,0x1c5));var _0xdbad=function(_0x3b660f,_0x45c3db){_0x3b660f=_0x3b660f-0x0;var _0x187a29=_0xbadd[_0x3b660f];return _0x187a29;};'use strict';var multer=require(_0xdbad('0x0'));var util=require(_0xdbad('0x1'));var path=require(_0xdbad('0x2'));var timeout=require(_0xdbad('0x3'));var express=require(_0xdbad('0x4'));var router=express[_0xdbad('0x5')]();var fs_extra=require(_0xdbad('0x6'));var auth=require(_0xdbad('0x7'));var interaction=require(_0xdbad('0x8'));var config=require(_0xdbad('0x9'));var controller=require('./openchannelQueueReport.controller');router[_0xdbad('0xa')]('/',auth[_0xdbad('0xb')](),controller[_0xdbad('0xc')]);router['get']('/describe',auth[_0xdbad('0xb')](),controller[_0xdbad('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdbad('0xe')]);router[_0xdbad('0xf')]('/',auth[_0xdbad('0xb')](),controller[_0xdbad('0x10')]);router['put'](_0xdbad('0x11'),auth[_0xdbad('0xb')](),controller[_0xdbad('0x12')]);router[_0xdbad('0x13')](_0xdbad('0x11'),auth['isAuthenticated'](),controller[_0xdbad('0x14')]);module[_0xdbad('0x15')]=router; \ No newline at end of file +var _0x4d28=['../../config/environment','get','index','/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x113c43,_0x171537){var _0x25a1ac=function(_0x5544b2){while(--_0x5544b2){_0x113c43['push'](_0x113c43['shift']());}};_0x25a1ac(++_0x171537);}(_0x4d28,0x117));var _0x84d2=function(_0x3f9882,_0x4063bb){_0x3f9882=_0x3f9882-0x0;var _0x18b725=_0x4d28[_0x3f9882];return _0x18b725;};'use strict';var multer=require(_0x84d2('0x0'));var util=require(_0x84d2('0x1'));var path=require('path');var timeout=require(_0x84d2('0x2'));var express=require('express');var router=express[_0x84d2('0x3')]();var fs_extra=require(_0x84d2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x84d2('0x5'));var config=require(_0x84d2('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0x84d2('0x7')]('/',auth['isAuthenticated'](),controller[_0x84d2('0x8')]);router[_0x84d2('0x7')](_0x84d2('0x9'),auth[_0x84d2('0xa')](),controller['describe']);router[_0x84d2('0x7')](_0x84d2('0xb'),auth[_0x84d2('0xa')](),controller['show']);router[_0x84d2('0xc')]('/',auth[_0x84d2('0xa')](),controller[_0x84d2('0xd')]);router[_0x84d2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x84d2('0xf')]);router[_0x84d2('0x10')](_0x84d2('0xb'),auth[_0x84d2('0xa')](),controller[_0x84d2('0x11')]);module[_0x84d2('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 b4beb03..6265443 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 _0x321f=['DATE','moment','exports','STRING'];(function(_0xe4663b,_0x48ac30){var _0x203678=function(_0x637b25){while(--_0x637b25){_0xe4663b['push'](_0xe4663b['shift']());}};_0x203678(++_0x48ac30);}(_0x321f,0x91));var _0xf321=function(_0x59197b,_0x35ec49){_0x59197b=_0x59197b-0x0;var _0x2c5edf=_0x321f[_0x59197b];return _0x2c5edf;};'use strict';var moment=require(_0xf321('0x0'));var Sequelize=require('sequelize');module[_0xf321('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf321('0x2')]},'joinAt':{'type':Sequelize[_0xf321('0x3')]},'leaveAt':{'type':Sequelize[_0xf321('0x3')]},'acceptAt':{'type':Sequelize[_0xf321('0x3')]},'exitAt':{'type':Sequelize[_0xf321('0x3')]},'reason':{'type':Sequelize[_0xf321('0x2')]}}; \ No newline at end of file +var _0x2ce4=['DATE','moment','sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2ce4,0x141));var _0x42ce=function(_0x430646,_0x3de081){_0x430646=_0x430646-0x0;var _0x50004b=_0x2ce4[_0x430646];return _0x50004b;};'use strict';var moment=require(_0x42ce('0x0'));var Sequelize=require(_0x42ce('0x1'));module[_0x42ce('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x42ce('0x3')]},'joinAt':{'type':Sequelize[_0x42ce('0x4')]},'leaveAt':{'type':Sequelize[_0x42ce('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x42ce('0x4')]},'reason':{'type':Sequelize[_0x42ce('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3c58b9e..4561217 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 _0xef81=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x592125,_0x3c3e4a){var _0x536040=function(_0x2325d1){while(--_0x2325d1){_0x592125['push'](_0x592125['shift']());}};_0x536040(++_0x3c3e4a);}(_0xef81,0x67));var _0x1ef8=function(_0x3b8718,_0x3395d7){_0x3b8718=_0x3b8718-0x0;var _0x5bbce6=_0xef81[_0x3b8718];return _0x5bbce6;};'use strict';var emlformat=require(_0x1ef8('0x0'));var rimraf=require(_0x1ef8('0x1'));var zipdir=require(_0x1ef8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1ef8('0x3'));var BPromise=require(_0x1ef8('0x4'));var Mustache=require(_0x1ef8('0x5'));var util=require(_0x1ef8('0x6'));var path=require(_0x1ef8('0x7'));var sox=require(_0x1ef8('0x8'));var csv=require(_0x1ef8('0x9'));var ejs=require(_0x1ef8('0xa'));var fs=require('fs');var fs_extra=require(_0x1ef8('0xb'));var _=require(_0x1ef8('0xc'));var squel=require('squel');var crypto=require(_0x1ef8('0xd'));var jsforce=require(_0x1ef8('0xe'));var deskjs=require(_0x1ef8('0xf'));var toCsv=require(_0x1ef8('0x9'));var querystring=require(_0x1ef8('0x10'));var Papa=require(_0x1ef8('0x11'));var Redis=require('ioredis');var authService=require(_0x1ef8('0x12'));var qs=require(_0x1ef8('0x13'));var as=require(_0x1ef8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ef8('0x15'))(_0x1ef8('0x16'));var utils=require(_0x1ef8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ef8('0x18'));var db=require(_0x1ef8('0x19'))['db'];function respondWithStatusCode(_0x5467ff,_0x6981ac){_0x6981ac=_0x6981ac||0xcc;return function(_0x3781f2){if(_0x3781f2){return _0x5467ff['sendStatus'](_0x6981ac);}return _0x5467ff[_0x1ef8('0x1a')](_0x6981ac)['end']();};}function respondWithResult(_0x305cd5,_0x145b35){_0x145b35=_0x145b35||0xc8;return function(_0x2bb649){if(_0x2bb649){return _0x305cd5[_0x1ef8('0x1a')](_0x145b35)[_0x1ef8('0x1b')](_0x2bb649);}};}function respondWithFilteredResult(_0x1540b3,_0x4be83c){return function(_0x6d38e){if(_0x6d38e){var _0x46c322=typeof _0x4be83c[_0x1ef8('0x1c')]===_0x1ef8('0x1d')&&typeof _0x4be83c['limit']===_0x1ef8('0x1d');var _0x422103=_0x6d38e[_0x1ef8('0x1e')];var _0x56c094=_0x46c322?0x0:_0x4be83c[_0x1ef8('0x1c')];var _0x12c45d=_0x46c322?_0x6d38e[_0x1ef8('0x1e')]:_0x4be83c['offset']+_0x4be83c[_0x1ef8('0x1f')];var _0x2cba33;if(_0x12c45d>=_0x422103){_0x12c45d=_0x422103;_0x2cba33=0xc8;}else{_0x2cba33=0xce;}_0x1540b3[_0x1ef8('0x1a')](_0x2cba33);return _0x1540b3[_0x1ef8('0x20')](_0x1ef8('0x21'),_0x56c094+'-'+_0x12c45d+'/'+_0x422103)[_0x1ef8('0x1b')](_0x6d38e);}return null;};}function patchUpdates(_0x52eda3){return function(_0x2c2bb0){try{jsonpatch[_0x1ef8('0x22')](_0x2c2bb0,_0x52eda3,!![]);}catch(_0x475939){return BPromise['reject'](_0x475939);}return _0x2c2bb0[_0x1ef8('0x23')]();};}function saveUpdates(_0x3bce33,_0x2e0115){return function(_0x57e45a){if(_0x57e45a){return _0x57e45a[_0x1ef8('0x24')](_0x3bce33)['then'](function(_0x22a4de){return _0x22a4de;});}return null;};}function removeEntity(_0x449f17,_0x481bfb){return function(_0x39efce){if(_0x39efce){return _0x39efce[_0x1ef8('0x25')]()['then'](function(){_0x449f17[_0x1ef8('0x1a')](0xcc)[_0x1ef8('0x26')]();});}};}function handleEntityNotFound(_0x5a0cab,_0x3d7107){return function(_0xa9f682){if(!_0xa9f682){_0x5a0cab[_0x1ef8('0x27')](0x194);}return _0xa9f682;};}function handleError(_0x3fc93d,_0x5e59ee){_0x5e59ee=_0x5e59ee||0x1f4;return function(_0x4cc550){logger[_0x1ef8('0x28')](_0x4cc550[_0x1ef8('0x29')]);if(_0x4cc550[_0x1ef8('0x2a')]){delete _0x4cc550[_0x1ef8('0x2a')];}_0x3fc93d[_0x1ef8('0x1a')](_0x5e59ee)[_0x1ef8('0x2b')](_0x4cc550);};}exports[_0x1ef8('0x2c')]=function(_0x2ab607,_0x474e58){var _0x4149e9={},_0x4bb81e={},_0x24583c={'count':0x0,'rows':[]};var _0x314a85=_[_0x1ef8('0x2d')](db[_0x1ef8('0x2e')][_0x1ef8('0x2f')],function(_0x3d7c5c){return{'name':_0x3d7c5c[_0x1ef8('0x30')],'type':_0x3d7c5c[_0x1ef8('0x31')]['key']};});_0x4bb81e[_0x1ef8('0x32')]=_[_0x1ef8('0x2d')](_0x314a85,_0x1ef8('0x2a'));_0x4bb81e[_0x1ef8('0x33')]=_[_0x1ef8('0x34')](_0x2ab607[_0x1ef8('0x33')]);_0x4bb81e[_0x1ef8('0x35')]=_[_0x1ef8('0x36')](_0x4bb81e[_0x1ef8('0x32')],_0x4bb81e['query']);_0x4149e9[_0x1ef8('0x37')]=_[_0x1ef8('0x36')](_0x4bb81e[_0x1ef8('0x32')],qs[_0x1ef8('0x38')](_0x2ab607['query'][_0x1ef8('0x38')]));_0x4149e9[_0x1ef8('0x37')]=_0x4149e9[_0x1ef8('0x37')]['length']?_0x4149e9[_0x1ef8('0x37')]:_0x4bb81e[_0x1ef8('0x32')];if(!_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x39')](_0x1ef8('0x3a'))){_0x4149e9[_0x1ef8('0x1f')]=qs['limit'](_0x2ab607[_0x1ef8('0x33')]['limit']);_0x4149e9[_0x1ef8('0x1c')]=qs['offset'](_0x2ab607[_0x1ef8('0x33')]['offset']);}_0x4149e9[_0x1ef8('0x3b')]=qs[_0x1ef8('0x3c')](_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x3c')]);_0x4149e9[_0x1ef8('0x3d')]=qs[_0x1ef8('0x35')](_[_0x1ef8('0x3e')](_0x2ab607[_0x1ef8('0x33')],_0x4bb81e[_0x1ef8('0x35')]),_0x314a85);if(_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x3f')]){_0x4149e9[_0x1ef8('0x3d')]=_[_0x1ef8('0x40')](_0x4149e9[_0x1ef8('0x3d')],{'$or':_[_0x1ef8('0x2d')](_0x314a85,function(_0x439353){if(_0x439353['type']!==_0x1ef8('0x41')){var _0x266657={};_0x266657[_0x439353['name']]={'$like':'%'+_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x3f')]+'%'};return _0x266657;}})});}_0x4149e9=_[_0x1ef8('0x40')]({},_0x4149e9,_0x2ab607[_0x1ef8('0x42')]);var _0x565d37={'where':_0x4149e9[_0x1ef8('0x3d')]};return db[_0x1ef8('0x2e')][_0x1ef8('0x1e')](_0x565d37)[_0x1ef8('0x43')](function(_0x2c0ad8){_0x24583c[_0x1ef8('0x1e')]=_0x2c0ad8;if(_0x2ab607[_0x1ef8('0x33')][_0x1ef8('0x44')]){_0x4149e9[_0x1ef8('0x45')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x1ef8('0x46')](_0x4149e9);})['then'](function(_0xcca809){_0x24583c[_0x1ef8('0x47')]=_0xcca809;return _0x24583c;})['then'](respondWithFilteredResult(_0x474e58,_0x4149e9))[_0x1ef8('0x48')](handleError(_0x474e58,null));};exports['show']=function(_0x2cda55,_0x2a5e96){var _0x46f426={'raw':!![],'where':{'id':_0x2cda55[_0x1ef8('0x49')]['id']}},_0x12d9c8={};_0x12d9c8[_0x1ef8('0x32')]=_['keys'](db[_0x1ef8('0x2e')][_0x1ef8('0x2f')]);_0x12d9c8[_0x1ef8('0x33')]=_[_0x1ef8('0x34')](_0x2cda55[_0x1ef8('0x33')]);_0x12d9c8['filters']=_['intersection'](_0x12d9c8[_0x1ef8('0x32')],_0x12d9c8[_0x1ef8('0x33')]);_0x46f426['attributes']=_['intersection'](_0x12d9c8[_0x1ef8('0x32')],qs['fields'](_0x2cda55[_0x1ef8('0x33')][_0x1ef8('0x38')]));_0x46f426[_0x1ef8('0x37')]=_0x46f426['attributes'][_0x1ef8('0x4a')]?_0x46f426[_0x1ef8('0x37')]:_0x12d9c8[_0x1ef8('0x32')];if(_0x2cda55[_0x1ef8('0x33')][_0x1ef8('0x44')]){_0x46f426[_0x1ef8('0x45')]=[{'all':!![]}];}_0x46f426=_['merge']({},_0x46f426,_0x2cda55[_0x1ef8('0x42')]);return db[_0x1ef8('0x2e')][_0x1ef8('0x4b')](_0x46f426)[_0x1ef8('0x43')](handleEntityNotFound(_0x2a5e96,null))[_0x1ef8('0x43')](respondWithResult(_0x2a5e96,null))[_0x1ef8('0x48')](handleError(_0x2a5e96,null));};exports[_0x1ef8('0x4c')]=function(_0x2ce6f6,_0x21e6ce){return db[_0x1ef8('0x2e')][_0x1ef8('0x4c')](_0x2ce6f6[_0x1ef8('0x4d')],{})[_0x1ef8('0x43')](respondWithResult(_0x21e6ce,0xc9))['catch'](handleError(_0x21e6ce,null));};exports['update']=function(_0x5e2b6d,_0xc3e652){if(_0x5e2b6d['body']['id']){delete _0x5e2b6d[_0x1ef8('0x4d')]['id'];}return db[_0x1ef8('0x2e')][_0x1ef8('0x4b')]({'where':{'id':_0x5e2b6d[_0x1ef8('0x49')]['id']}})[_0x1ef8('0x43')](handleEntityNotFound(_0xc3e652,null))[_0x1ef8('0x43')](saveUpdates(_0x5e2b6d['body'],null))['then'](respondWithResult(_0xc3e652,null))['catch'](handleError(_0xc3e652,null));};exports[_0x1ef8('0x25')]=function(_0x629b4,_0x42338c){return db[_0x1ef8('0x2e')][_0x1ef8('0x4b')]({'where':{'id':_0x629b4[_0x1ef8('0x49')]['id']}})[_0x1ef8('0x43')](handleEntityNotFound(_0x42338c,null))['then'](removeEntity(_0x42338c,null))[_0x1ef8('0x48')](handleError(_0x42338c,null));};exports[_0x1ef8('0x4e')]=function(_0x1764f1,_0x3a1c17){return db[_0x1ef8('0x2e')][_0x1ef8('0x4e')]()[_0x1ef8('0x43')](respondWithResult(_0x3a1c17,null))[_0x1ef8('0x48')](handleError(_0x3a1c17,null));}; \ No newline at end of file +var _0x12e0=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','show','catch','create','body','params','describe','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x346b5e,_0x891003){var _0x18eea9=function(_0x5760db){while(--_0x5760db){_0x346b5e['push'](_0x346b5e['shift']());}};_0x18eea9(++_0x891003);}(_0x12e0,0xa2));var _0x012e=function(_0x549d2b,_0x2acfaa){_0x549d2b=_0x549d2b-0x0;var _0x2f7f64=_0x12e0[_0x549d2b];return _0x2f7f64;};'use strict';var emlformat=require(_0x012e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x012e('0x1'));var moment=require(_0x012e('0x2'));var BPromise=require(_0x012e('0x3'));var Mustache=require(_0x012e('0x4'));var util=require('util');var path=require(_0x012e('0x5'));var sox=require(_0x012e('0x6'));var csv=require(_0x012e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x012e('0x8'));var squel=require(_0x012e('0x9'));var crypto=require(_0x012e('0xa'));var jsforce=require(_0x012e('0xb'));var deskjs=require(_0x012e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x012e('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x012e('0xe'));var qs=require(_0x012e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x012e('0x10'));var logger=require('../../config/logger')(_0x012e('0x11'));var utils=require(_0x012e('0x12'));var config=require(_0x012e('0x13'));var licenseUtil=require(_0x012e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a1701,_0x1e228e){_0x1e228e=_0x1e228e||0xcc;return function(_0x501948){if(_0x501948){return _0x4a1701['sendStatus'](_0x1e228e);}return _0x4a1701[_0x012e('0x15')](_0x1e228e)['end']();};}function respondWithResult(_0x491994,_0x22c631){_0x22c631=_0x22c631||0xc8;return function(_0x322836){if(_0x322836){return _0x491994[_0x012e('0x15')](_0x22c631)[_0x012e('0x16')](_0x322836);}};}function respondWithFilteredResult(_0x45e97e,_0x26b863){return function(_0x516758){if(_0x516758){var _0x1561de=typeof _0x26b863[_0x012e('0x17')]===_0x012e('0x18')&&typeof _0x26b863[_0x012e('0x19')]==='undefined';var _0x45d4df=_0x516758[_0x012e('0x1a')];var _0x38779f=_0x1561de?0x0:_0x26b863[_0x012e('0x17')];var _0x36c17f=_0x1561de?_0x516758['count']:_0x26b863['offset']+_0x26b863['limit'];var _0x33232c;if(_0x36c17f>=_0x45d4df){_0x36c17f=_0x45d4df;_0x33232c=0xc8;}else{_0x33232c=0xce;}_0x45e97e[_0x012e('0x15')](_0x33232c);return _0x45e97e[_0x012e('0x1b')](_0x012e('0x1c'),_0x38779f+'-'+_0x36c17f+'/'+_0x45d4df)['json'](_0x516758);}return null;};}function patchUpdates(_0x44ed38){return function(_0x224c01){try{jsonpatch[_0x012e('0x1d')](_0x224c01,_0x44ed38,!![]);}catch(_0x3e99ff){return BPromise[_0x012e('0x1e')](_0x3e99ff);}return _0x224c01['save']();};}function saveUpdates(_0x280c89,_0x9e4794){return function(_0x5ee280){if(_0x5ee280){return _0x5ee280[_0x012e('0x1f')](_0x280c89)[_0x012e('0x20')](function(_0x25f07c){return _0x25f07c;});}return null;};}function removeEntity(_0x245967,_0x5e7a18){return function(_0x2f7f96){if(_0x2f7f96){return _0x2f7f96[_0x012e('0x21')]()[_0x012e('0x20')](function(){_0x245967[_0x012e('0x15')](0xcc)[_0x012e('0x22')]();});}};}function handleEntityNotFound(_0x31a8d0,_0xaa1eb3){return function(_0x33d2e5){if(!_0x33d2e5){_0x31a8d0['sendStatus'](0x194);}return _0x33d2e5;};}function handleError(_0xb4ce86,_0x36f012){_0x36f012=_0x36f012||0x1f4;return function(_0x2b9896){logger[_0x012e('0x23')](_0x2b9896[_0x012e('0x24')]);if(_0x2b9896['name']){delete _0x2b9896[_0x012e('0x25')];}_0xb4ce86[_0x012e('0x15')](_0x36f012)['send'](_0x2b9896);};}exports[_0x012e('0x26')]=function(_0x3f5a80,_0x3fb744){var _0x43dfd9={},_0x3f6e6a={},_0x43f58b={'count':0x0,'rows':[]};var _0x4121f0=_[_0x012e('0x27')](db[_0x012e('0x28')][_0x012e('0x29')],function(_0x590ea3){return{'name':_0x590ea3[_0x012e('0x2a')],'type':_0x590ea3[_0x012e('0x2b')][_0x012e('0x2c')]};});_0x3f6e6a[_0x012e('0x2d')]=_[_0x012e('0x27')](_0x4121f0,_0x012e('0x25'));_0x3f6e6a[_0x012e('0x2e')]=_['keys'](_0x3f5a80[_0x012e('0x2e')]);_0x3f6e6a[_0x012e('0x2f')]=_[_0x012e('0x30')](_0x3f6e6a[_0x012e('0x2d')],_0x3f6e6a[_0x012e('0x2e')]);_0x43dfd9[_0x012e('0x31')]=_[_0x012e('0x30')](_0x3f6e6a[_0x012e('0x2d')],qs['fields'](_0x3f5a80['query'][_0x012e('0x32')]));_0x43dfd9[_0x012e('0x31')]=_0x43dfd9[_0x012e('0x31')][_0x012e('0x33')]?_0x43dfd9[_0x012e('0x31')]:_0x3f6e6a[_0x012e('0x2d')];if(!_0x3f5a80[_0x012e('0x2e')][_0x012e('0x34')](_0x012e('0x35'))){_0x43dfd9['limit']=qs[_0x012e('0x19')](_0x3f5a80['query'][_0x012e('0x19')]);_0x43dfd9[_0x012e('0x17')]=qs[_0x012e('0x17')](_0x3f5a80[_0x012e('0x2e')][_0x012e('0x17')]);}_0x43dfd9[_0x012e('0x36')]=qs[_0x012e('0x37')](_0x3f5a80[_0x012e('0x2e')]['sort']);_0x43dfd9[_0x012e('0x38')]=qs[_0x012e('0x2f')](_[_0x012e('0x39')](_0x3f5a80['query'],_0x3f6e6a['filters']),_0x4121f0);if(_0x3f5a80['query']['filter']){_0x43dfd9[_0x012e('0x38')]=_[_0x012e('0x3a')](_0x43dfd9[_0x012e('0x38')],{'$or':_[_0x012e('0x27')](_0x4121f0,function(_0x19c80d){if(_0x19c80d[_0x012e('0x2b')]!==_0x012e('0x3b')){var _0xac08e8={};_0xac08e8[_0x19c80d[_0x012e('0x25')]]={'$like':'%'+_0x3f5a80['query'][_0x012e('0x3c')]+'%'};return _0xac08e8;}})});}_0x43dfd9=_[_0x012e('0x3a')]({},_0x43dfd9,_0x3f5a80[_0x012e('0x3d')]);var _0x34e2f9={'where':_0x43dfd9[_0x012e('0x38')]};return db[_0x012e('0x28')][_0x012e('0x1a')](_0x34e2f9)['then'](function(_0x46ef04){_0x43f58b[_0x012e('0x1a')]=_0x46ef04;if(_0x3f5a80[_0x012e('0x2e')][_0x012e('0x3e')]){_0x43dfd9[_0x012e('0x3f')]=[{'all':!![]}];}return db[_0x012e('0x28')]['findAll'](_0x43dfd9);})[_0x012e('0x20')](function(_0x10e190){_0x43f58b['rows']=_0x10e190;return _0x43f58b;})[_0x012e('0x20')](respondWithFilteredResult(_0x3fb744,_0x43dfd9))['catch'](handleError(_0x3fb744,null));};exports[_0x012e('0x40')]=function(_0x2baef,_0x4d39a7){var _0x232a9b={'raw':!![],'where':{'id':_0x2baef['params']['id']}},_0x4ae37d={};_0x4ae37d['model']=_['keys'](db[_0x012e('0x28')][_0x012e('0x29')]);_0x4ae37d[_0x012e('0x2e')]=_['keys'](_0x2baef[_0x012e('0x2e')]);_0x4ae37d[_0x012e('0x2f')]=_[_0x012e('0x30')](_0x4ae37d['model'],_0x4ae37d[_0x012e('0x2e')]);_0x232a9b[_0x012e('0x31')]=_[_0x012e('0x30')](_0x4ae37d[_0x012e('0x2d')],qs[_0x012e('0x32')](_0x2baef['query']['fields']));_0x232a9b['attributes']=_0x232a9b[_0x012e('0x31')][_0x012e('0x33')]?_0x232a9b[_0x012e('0x31')]:_0x4ae37d[_0x012e('0x2d')];if(_0x2baef[_0x012e('0x2e')][_0x012e('0x3e')]){_0x232a9b[_0x012e('0x3f')]=[{'all':!![]}];}_0x232a9b=_[_0x012e('0x3a')]({},_0x232a9b,_0x2baef[_0x012e('0x3d')]);return db[_0x012e('0x28')]['find'](_0x232a9b)['then'](handleEntityNotFound(_0x4d39a7,null))[_0x012e('0x20')](respondWithResult(_0x4d39a7,null))[_0x012e('0x41')](handleError(_0x4d39a7,null));};exports[_0x012e('0x42')]=function(_0x569138,_0x307d8b){return db[_0x012e('0x28')][_0x012e('0x42')](_0x569138[_0x012e('0x43')],{})['then'](respondWithResult(_0x307d8b,0xc9))[_0x012e('0x41')](handleError(_0x307d8b,null));};exports[_0x012e('0x1f')]=function(_0x11ca66,_0x30c935){if(_0x11ca66[_0x012e('0x43')]['id']){delete _0x11ca66[_0x012e('0x43')]['id'];}return db[_0x012e('0x28')]['find']({'where':{'id':_0x11ca66[_0x012e('0x44')]['id']}})[_0x012e('0x20')](handleEntityNotFound(_0x30c935,null))[_0x012e('0x20')](saveUpdates(_0x11ca66[_0x012e('0x43')],null))['then'](respondWithResult(_0x30c935,null))[_0x012e('0x41')](handleError(_0x30c935,null));};exports[_0x012e('0x21')]=function(_0x5190c5,_0xfc54e4){return db[_0x012e('0x28')]['find']({'where':{'id':_0x5190c5['params']['id']}})[_0x012e('0x20')](handleEntityNotFound(_0xfc54e4,null))[_0x012e('0x20')](removeEntity(_0xfc54e4,null))['catch'](handleError(_0xfc54e4,null));};exports[_0x012e('0x45')]=function(_0x2ff7a4,_0x97944d){return db[_0x012e('0x28')]['describe']()[_0x012e('0x20')](respondWithResult(_0x97944d,null))[_0x012e('0x41')](handleError(_0x97944d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 933f2ac..e5ac87c 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x3007da,_0x5b363c){var _0x20e187=function(_0x1118d5){while(--_0x1118d5){_0x3007da['push'](_0x3007da['shift']());}};_0x20e187(++_0x5b363c);}(_0x326f,0xd1));var _0xf326=function(_0x321ace,_0x306589){_0x321ace=_0x321ace-0x0;var _0x4cec9f=_0x326f[_0x321ace];return _0x4cec9f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x2339c7,_0x37216b){var _0x21db8b=function(_0x6d4967){while(--_0x6d4967){_0x2339c7['push'](_0x2339c7['shift']());}};_0x21db8b(++_0x37216b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0x5fc3[_0x4d8a8f];return _0xfc4adc;};'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')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index ea05659..f26b37e 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 _0x4b0f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','body','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5d9449,_0x5382b7){var _0x583cf7=function(_0x30464f){while(--_0x30464f){_0x5d9449['push'](_0x5d9449['shift']());}};_0x583cf7(++_0x5382b7);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x4e6fc7,_0x6b9a5d){_0x4e6fc7=_0x4e6fc7-0x0;var _0x3c2ef6=_0x4b0f[_0x4e6fc7];return _0x3c2ef6;};'use strict';var _=require('lodash');var util=require(_0xf4b0('0x0'));var moment=require(_0xf4b0('0x1'));var BPromise=require(_0xf4b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b0('0x3'));var db=require(_0xf4b0('0x4'))['db'];var utils=require(_0xf4b0('0x5'));var logger=require(_0xf4b0('0x6'))(_0xf4b0('0x7'));var config=require(_0xf4b0('0x8'));var jayson=require(_0xf4b0('0x9'));var client=jayson[_0xf4b0('0xa')][_0xf4b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x373042,_0x300b64,_0x35160f){return new BPromise(function(_0x3a2236,_0xd132d8){return client[_0xf4b0('0xc')](_0x373042,_0x35160f)[_0xf4b0('0xd')](function(_0x4906e9){logger[_0xf4b0('0xe')](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));logger[_0xf4b0('0x11')](_0xf4b0('0x12'),_0x300b64,_0xf4b0('0x10'),JSON[_0xf4b0('0x13')](_0x4906e9));if(_0x4906e9[_0xf4b0('0x14')]){if(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x15')]===0x1f4){logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0xd132d8(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0x3a2236(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}else{logger['info'](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));_0x3a2236(_0x4906e9[_0xf4b0('0x17')]['message']);}})[_0xf4b0('0x18')](function(_0x1f2d74){logger[_0xf4b0('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x300b64,_0x1f2d74);_0xd132d8(_0x1f2d74);});});}exports[_0xf4b0('0x19')]=function(_0x390dbd){var _0x3e8ade=this;return new Promise(function(_0x543c88,_0x4cffc2){return db[_0xf4b0('0x1a')][_0xf4b0('0x1b')](_0x390dbd['body'],{'raw':_0x390dbd['options']?_0x390dbd[_0xf4b0('0x1c')][_0xf4b0('0x1d')]===undefined?!![]:![]:!![]})[_0xf4b0('0xd')](function(_0x4e65cd){logger[_0xf4b0('0xe')](_0xf4b0('0x19'),_0x390dbd);logger[_0xf4b0('0x11')](_0xf4b0('0x19'),_0x390dbd,JSON[_0xf4b0('0x13')](_0x4e65cd));_0x543c88(_0x4e65cd);})[_0xf4b0('0x18')](function(_0x221b1d){logger['error'](_0xf4b0('0x19'),_0x221b1d[_0xf4b0('0x16')],_0x390dbd);_0x4cffc2(_0x3e8ade[_0xf4b0('0x14')](0x1f4,_0x221b1d[_0xf4b0('0x16')]));});});};exports[_0xf4b0('0x1e')]=function(_0x338975){var _0x28ecb0=this;return new Promise(function(_0x3d054e,_0x4a0da1){return db[_0xf4b0('0x1a')]['update'](_0x338975[_0xf4b0('0x1f')],{'raw':_0x338975[_0xf4b0('0x1c')]?_0x338975[_0xf4b0('0x1c')][_0xf4b0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x338975[_0xf4b0('0x1c')]?_0x338975[_0xf4b0('0x1c')]['where']||null:null,'attributes':_0x338975[_0xf4b0('0x1c')]?_0x338975[_0xf4b0('0x1c')][_0xf4b0('0x20')]||null:null,'limit':_0x338975['options']?_0x338975[_0xf4b0('0x1c')][_0xf4b0('0x21')]||null:null})[_0xf4b0('0xd')](function(_0x55bdc8){logger[_0xf4b0('0xe')](_0xf4b0('0x1e'),_0x338975);logger[_0xf4b0('0x11')](_0xf4b0('0x1e'),_0x338975,JSON[_0xf4b0('0x13')](_0x55bdc8));_0x3d054e(_0x55bdc8);})[_0xf4b0('0x18')](function(_0xd94c81){logger[_0xf4b0('0x14')]('UpdateOpenchannelQueueReport',_0xd94c81[_0xf4b0('0x16')],_0x338975);_0x4a0da1(_0x28ecb0[_0xf4b0('0x14')](0x1f4,_0xd94c81[_0xf4b0('0x16')]));});});}; \ No newline at end of file +var _0x4b17=['catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','OpenchannelQueueReport,\x20%s,\x20%s','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','limit'];(function(_0x28089e,_0x530f8a){var _0x46a73c=function(_0x461513){while(--_0x461513){_0x28089e['push'](_0x28089e['shift']());}};_0x46a73c(++_0x530f8a);}(_0x4b17,0x10f));var _0x74b1=function(_0x324fe8,_0x1ccb46){_0x324fe8=_0x324fe8-0x0;var _0x4a1cd9=_0x4b17[_0x324fe8];return _0x4a1cd9;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x371c3b,_0x191d2b,_0x16761b){return new BPromise(function(_0x4c293c,_0x287e3e){return client[_0x74b1('0x9')](_0x371c3b,_0x16761b)[_0x74b1('0xa')](function(_0x25382b){logger[_0x74b1('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'));logger[_0x74b1('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x191d2b,_0x74b1('0xc'),JSON[_0x74b1('0xe')](_0x25382b));if(_0x25382b[_0x74b1('0xf')]){if(_0x25382b[_0x74b1('0xf')]['code']===0x1f4){logger[_0x74b1('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x191d2b,_0x25382b['error'][_0x74b1('0x10')]);return _0x287e3e(_0x25382b[_0x74b1('0xf')]['message']);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x191d2b,_0x25382b[_0x74b1('0xf')]['message']);return _0x4c293c(_0x25382b['error'][_0x74b1('0x10')]);}else{logger[_0x74b1('0xb')](_0x74b1('0x11'),_0x191d2b,_0x74b1('0xc'));_0x4c293c(_0x25382b[_0x74b1('0x12')][_0x74b1('0x10')]);}})['catch'](function(_0x6237be){logger[_0x74b1('0xf')](_0x74b1('0x11'),_0x191d2b,_0x6237be);_0x287e3e(_0x6237be);});});}exports[_0x74b1('0x13')]=function(_0xde2736){var _0x8c9510=this;return new Promise(function(_0x1ab838,_0x4bb3d2){return db[_0x74b1('0x14')][_0x74b1('0x15')](_0xde2736['body'],{'raw':_0xde2736[_0x74b1('0x16')]?_0xde2736[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![]})[_0x74b1('0xa')](function(_0x13bb44){logger[_0x74b1('0xb')](_0x74b1('0x13'),_0xde2736);logger[_0x74b1('0xd')]('CreateOpenchannelQueueReport',_0xde2736,JSON[_0x74b1('0xe')](_0x13bb44));_0x1ab838(_0x13bb44);})['catch'](function(_0x5da0f7){logger['error'](_0x74b1('0x13'),_0x5da0f7[_0x74b1('0x10')],_0xde2736);_0x4bb3d2(_0x8c9510[_0x74b1('0xf')](0x1f4,_0x5da0f7[_0x74b1('0x10')]));});});};exports[_0x74b1('0x18')]=function(_0x4ee88b){var _0x3c78e5=this;return new Promise(function(_0x4eca36,_0x3a7ef9){return db[_0x74b1('0x14')][_0x74b1('0x19')](_0x4ee88b[_0x74b1('0x1a')],{'raw':_0x4ee88b[_0x74b1('0x16')]?_0x4ee88b[_0x74b1('0x16')][_0x74b1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ee88b[_0x74b1('0x16')]?_0x4ee88b['options'][_0x74b1('0x1b')]||null:null,'attributes':_0x4ee88b[_0x74b1('0x16')]?_0x4ee88b[_0x74b1('0x16')]['attributes']||null:null,'limit':_0x4ee88b[_0x74b1('0x16')]?_0x4ee88b[_0x74b1('0x16')][_0x74b1('0x1c')]||null:null})[_0x74b1('0xa')](function(_0x26d9f1){logger[_0x74b1('0xb')](_0x74b1('0x18'),_0x4ee88b);logger[_0x74b1('0xd')]('UpdateOpenchannelQueueReport',_0x4ee88b,JSON[_0x74b1('0xe')](_0x26d9f1));_0x4eca36(_0x26d9f1);})[_0x74b1('0x1d')](function(_0x51ce6d){logger[_0x74b1('0xf')](_0x74b1('0x18'),_0x51ce6d[_0x74b1('0x10')],_0x4ee88b);_0x3a7ef9(_0x3c78e5['error'](0x1f4,_0x51ce6d[_0x74b1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7904bc9..2e4e0a5 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 _0x29d4=['../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x273033,_0x24f181){var _0x1e6b54=function(_0x48750e){while(--_0x48750e){_0x273033['push'](_0x273033['shift']());}};_0x1e6b54(++_0x24f181);}(_0x29d4,0x1c7));var _0x429d=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x29d4[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x429d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x429d('0x5'));var controller=require(_0x429d('0x6'));router[_0x429d('0x7')]('/',auth[_0x429d('0x8')](),controller[_0x429d('0x9')]);router[_0x429d('0x7')](_0x429d('0xa'),auth[_0x429d('0x8')](),controller[_0x429d('0xb')]);router[_0x429d('0x7')](_0x429d('0xc'),auth[_0x429d('0x8')](),controller['show']);router[_0x429d('0xd')]('/',auth[_0x429d('0x8')](),controller[_0x429d('0xe')]);router[_0x429d('0xf')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0x10')]);router[_0x429d('0x11')](_0x429d('0xc'),auth[_0x429d('0x8')](),controller[_0x429d('0x12')]);module[_0x429d('0x13')]=router; \ No newline at end of file +var _0x050d=['../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1459cf,_0x1967a5){var _0x396ad3=function(_0x149fbc){while(--_0x149fbc){_0x1459cf['push'](_0x1459cf['shift']());}};_0x396ad3(++_0x1967a5);}(_0x050d,0x12e));var _0xd050=function(_0x1cb8b7,_0x1d6c64){_0x1cb8b7=_0x1cb8b7-0x0;var _0x40b7c1=_0x050d[_0x1cb8b7];return _0x40b7c1;};'use strict';var multer=require(_0xd050('0x0'));var util=require(_0xd050('0x1'));var path=require(_0xd050('0x2'));var timeout=require(_0xd050('0x3'));var express=require('express');var router=express[_0xd050('0x4')]();var fs_extra=require(_0xd050('0x5'));var auth=require(_0xd050('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd050('0x7'));var controller=require(_0xd050('0x8'));router[_0xd050('0x9')]('/',auth[_0xd050('0xa')](),controller['index']);router[_0xd050('0x9')](_0xd050('0xb'),auth['isAuthenticated'](),controller[_0xd050('0xc')]);router[_0xd050('0x9')](_0xd050('0xd'),auth[_0xd050('0xa')](),controller[_0xd050('0xe')]);router[_0xd050('0xf')]('/',auth[_0xd050('0xa')](),controller[_0xd050('0x10')]);router[_0xd050('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd050('0x12')]);router[_0xd050('0x13')](_0xd050('0xd'),auth['isAuthenticated'](),controller[_0xd050('0x14')]);module[_0xd050('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 0b69f6e..20789b0 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xc9fa38,_0x428f2d){var _0x3fd420=function(_0xd51986){while(--_0xd51986){_0xc9fa38['push'](_0xc9fa38['shift']());}};_0x3fd420(++_0x428f2d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x00bb[_0x37bd26];return _0xe83dc4;};'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 +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2b8537,_0x5355de){var _0x3e2320=function(_0x4a1d08){while(--_0x4a1d08){_0x2b8537['push'](_0x2b8537['shift']());}};_0x3e2320(++_0x5355de);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xcb91[_0x1f7413];return _0x2d2775;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8089c56..82be629 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 _0x4a6f=['zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','describe','eml-format'];(function(_0x28e68d,_0x29eb88){var _0x504faf=function(_0x412920){while(--_0x412920){_0x28e68d['push'](_0x28e68d['shift']());}};_0x504faf(++_0x29eb88);}(_0x4a6f,0xdd));var _0xf4a6=function(_0xd50b7f,_0x53c16c){_0xd50b7f=_0xd50b7f-0x0;var _0x380972=_0x4a6f[_0xd50b7f];return _0x380972;};'use strict';var emlformat=require(_0xf4a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4a6('0x1'));var jsonpatch=require(_0xf4a6('0x2'));var rp=require('request-promise');var moment=require(_0xf4a6('0x3'));var BPromise=require(_0xf4a6('0x4'));var Mustache=require(_0xf4a6('0x5'));var util=require('util');var path=require(_0xf4a6('0x6'));var sox=require('sox');var csv=require(_0xf4a6('0x7'));var ejs=require(_0xf4a6('0x8'));var fs=require('fs');var fs_extra=require(_0xf4a6('0x9'));var _=require(_0xf4a6('0xa'));var squel=require('squel');var crypto=require(_0xf4a6('0xb'));var jsforce=require(_0xf4a6('0xc'));var deskjs=require(_0xf4a6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf4a6('0xe'));var Papa=require(_0xf4a6('0xf'));var Redis=require(_0xf4a6('0x10'));var authService=require(_0xf4a6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf4a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4a6('0x13'))(_0xf4a6('0x14'));var utils=require(_0xf4a6('0x15'));var config=require(_0xf4a6('0x16'));var licenseUtil=require(_0xf4a6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f0d5d,_0x349f72){_0x349f72=_0x349f72||0xcc;return function(_0x377917){if(_0x377917){return _0x2f0d5d[_0xf4a6('0x18')](_0x349f72);}return _0x2f0d5d[_0xf4a6('0x19')](_0x349f72)[_0xf4a6('0x1a')]();};}function respondWithResult(_0x2a17e4,_0x3b1e4e){_0x3b1e4e=_0x3b1e4e||0xc8;return function(_0x446d8a){if(_0x446d8a){return _0x2a17e4[_0xf4a6('0x19')](_0x3b1e4e)['json'](_0x446d8a);}};}function respondWithFilteredResult(_0x1b56e7,_0x568b26){return function(_0x3b8999){if(_0x3b8999){var _0x58a280=typeof _0x568b26[_0xf4a6('0x1b')]===_0xf4a6('0x1c')&&typeof _0x568b26[_0xf4a6('0x1d')]==='undefined';var _0x10f5cc=_0x3b8999[_0xf4a6('0x1e')];var _0x54ea3e=_0x58a280?0x0:_0x568b26[_0xf4a6('0x1b')];var _0xaf4287=_0x58a280?_0x3b8999['count']:_0x568b26[_0xf4a6('0x1b')]+_0x568b26[_0xf4a6('0x1d')];var _0x3dac1e;if(_0xaf4287>=_0x10f5cc){_0xaf4287=_0x10f5cc;_0x3dac1e=0xc8;}else{_0x3dac1e=0xce;}_0x1b56e7[_0xf4a6('0x19')](_0x3dac1e);return _0x1b56e7[_0xf4a6('0x1f')](_0xf4a6('0x20'),_0x54ea3e+'-'+_0xaf4287+'/'+_0x10f5cc)[_0xf4a6('0x21')](_0x3b8999);}return null;};}function patchUpdates(_0x3fa8f9){return function(_0x1323f6){try{jsonpatch['apply'](_0x1323f6,_0x3fa8f9,!![]);}catch(_0x31d7a9){return BPromise['reject'](_0x31d7a9);}return _0x1323f6[_0xf4a6('0x22')]();};}function saveUpdates(_0x3b931b,_0x1364ed){return function(_0x21f62d){if(_0x21f62d){return _0x21f62d[_0xf4a6('0x23')](_0x3b931b)[_0xf4a6('0x24')](function(_0x55ba5d){return _0x55ba5d;});}return null;};}function removeEntity(_0x553115,_0x53b1b2){return function(_0x23c7d0){if(_0x23c7d0){return _0x23c7d0[_0xf4a6('0x25')]()[_0xf4a6('0x24')](function(){_0x553115['status'](0xcc)[_0xf4a6('0x1a')]();});}};}function handleEntityNotFound(_0x452f5b,_0x17f63d){return function(_0xecf6e5){if(!_0xecf6e5){_0x452f5b[_0xf4a6('0x18')](0x194);}return _0xecf6e5;};}function handleError(_0x52895d,_0xf30676){_0xf30676=_0xf30676||0x1f4;return function(_0x4bd97d){logger[_0xf4a6('0x26')](_0x4bd97d[_0xf4a6('0x27')]);if(_0x4bd97d[_0xf4a6('0x28')]){delete _0x4bd97d[_0xf4a6('0x28')];}_0x52895d[_0xf4a6('0x19')](_0xf30676)[_0xf4a6('0x29')](_0x4bd97d);};}exports[_0xf4a6('0x2a')]=function(_0x2b7d6d,_0x6d018a){var _0x526e7c={},_0x550bf0={},_0x321a8f={'count':0x0,'rows':[]};var _0x2c597e=_[_0xf4a6('0x2b')](db[_0xf4a6('0x2c')][_0xf4a6('0x2d')],function(_0x17ac08){return{'name':_0x17ac08['fieldName'],'type':_0x17ac08[_0xf4a6('0x2e')][_0xf4a6('0x2f')]};});_0x550bf0[_0xf4a6('0x30')]=_[_0xf4a6('0x2b')](_0x2c597e,_0xf4a6('0x28'));_0x550bf0[_0xf4a6('0x31')]=_['keys'](_0x2b7d6d[_0xf4a6('0x31')]);_0x550bf0[_0xf4a6('0x32')]=_[_0xf4a6('0x33')](_0x550bf0[_0xf4a6('0x30')],_0x550bf0[_0xf4a6('0x31')]);_0x526e7c[_0xf4a6('0x34')]=_[_0xf4a6('0x33')](_0x550bf0[_0xf4a6('0x30')],qs['fields'](_0x2b7d6d[_0xf4a6('0x31')][_0xf4a6('0x35')]));_0x526e7c[_0xf4a6('0x34')]=_0x526e7c[_0xf4a6('0x34')]['length']?_0x526e7c['attributes']:_0x550bf0[_0xf4a6('0x30')];if(!_0x2b7d6d[_0xf4a6('0x31')]['hasOwnProperty']('nolimit')){_0x526e7c[_0xf4a6('0x1d')]=qs[_0xf4a6('0x1d')](_0x2b7d6d['query'][_0xf4a6('0x1d')]);_0x526e7c[_0xf4a6('0x1b')]=qs['offset'](_0x2b7d6d[_0xf4a6('0x31')][_0xf4a6('0x1b')]);}_0x526e7c[_0xf4a6('0x36')]=qs[_0xf4a6('0x37')](_0x2b7d6d[_0xf4a6('0x31')]['sort']);_0x526e7c[_0xf4a6('0x38')]=qs[_0xf4a6('0x32')](_[_0xf4a6('0x39')](_0x2b7d6d[_0xf4a6('0x31')],_0x550bf0[_0xf4a6('0x32')]),_0x2c597e);if(_0x2b7d6d['query'][_0xf4a6('0x3a')]){_0x526e7c['where']=_[_0xf4a6('0x3b')](_0x526e7c[_0xf4a6('0x38')],{'$or':_['map'](_0x2c597e,function(_0x2da280){if(_0x2da280[_0xf4a6('0x2e')]!=='VIRTUAL'){var _0x1a373c={};_0x1a373c[_0x2da280[_0xf4a6('0x28')]]={'$like':'%'+_0x2b7d6d[_0xf4a6('0x31')][_0xf4a6('0x3a')]+'%'};return _0x1a373c;}})});}_0x526e7c=_['merge']({},_0x526e7c,_0x2b7d6d[_0xf4a6('0x3c')]);var _0x4c7c1f={'where':_0x526e7c[_0xf4a6('0x38')]};return db[_0xf4a6('0x2c')][_0xf4a6('0x1e')](_0x4c7c1f)[_0xf4a6('0x24')](function(_0x3d506d){_0x321a8f['count']=_0x3d506d;if(_0x2b7d6d[_0xf4a6('0x31')][_0xf4a6('0x3d')]){_0x526e7c[_0xf4a6('0x3e')]=[{'all':!![]}];}return db[_0xf4a6('0x2c')][_0xf4a6('0x3f')](_0x526e7c);})[_0xf4a6('0x24')](function(_0x457bd7){_0x321a8f[_0xf4a6('0x40')]=_0x457bd7;return _0x321a8f;})[_0xf4a6('0x24')](respondWithFilteredResult(_0x6d018a,_0x526e7c))[_0xf4a6('0x41')](handleError(_0x6d018a,null));};exports[_0xf4a6('0x42')]=function(_0x5807e7,_0x42fd53){var _0x560725={'raw':!![],'where':{'id':_0x5807e7[_0xf4a6('0x43')]['id']}},_0x252c1a={};_0x252c1a[_0xf4a6('0x30')]=_[_0xf4a6('0x44')](db[_0xf4a6('0x2c')][_0xf4a6('0x2d')]);_0x252c1a[_0xf4a6('0x31')]=_[_0xf4a6('0x44')](_0x5807e7[_0xf4a6('0x31')]);_0x252c1a[_0xf4a6('0x32')]=_[_0xf4a6('0x33')](_0x252c1a[_0xf4a6('0x30')],_0x252c1a['query']);_0x560725['attributes']=_['intersection'](_0x252c1a[_0xf4a6('0x30')],qs[_0xf4a6('0x35')](_0x5807e7[_0xf4a6('0x31')]['fields']));_0x560725[_0xf4a6('0x34')]=_0x560725[_0xf4a6('0x34')][_0xf4a6('0x45')]?_0x560725[_0xf4a6('0x34')]:_0x252c1a[_0xf4a6('0x30')];if(_0x5807e7['query'][_0xf4a6('0x3d')]){_0x560725[_0xf4a6('0x3e')]=[{'all':!![]}];}_0x560725=_[_0xf4a6('0x3b')]({},_0x560725,_0x5807e7[_0xf4a6('0x3c')]);return db[_0xf4a6('0x2c')]['find'](_0x560725)['then'](handleEntityNotFound(_0x42fd53,null))[_0xf4a6('0x24')](respondWithResult(_0x42fd53,null))['catch'](handleError(_0x42fd53,null));};exports[_0xf4a6('0x46')]=function(_0x5296b8,_0x557788){return db[_0xf4a6('0x2c')]['create'](_0x5296b8[_0xf4a6('0x47')],{})[_0xf4a6('0x24')](respondWithResult(_0x557788,0xc9))[_0xf4a6('0x41')](handleError(_0x557788,null));};exports[_0xf4a6('0x23')]=function(_0x4117b2,_0x25e4ae){if(_0x4117b2[_0xf4a6('0x47')]['id']){delete _0x4117b2[_0xf4a6('0x47')]['id'];}return db[_0xf4a6('0x2c')]['find']({'where':{'id':_0x4117b2['params']['id']}})[_0xf4a6('0x24')](handleEntityNotFound(_0x25e4ae,null))['then'](saveUpdates(_0x4117b2[_0xf4a6('0x47')],null))['then'](respondWithResult(_0x25e4ae,null))[_0xf4a6('0x41')](handleError(_0x25e4ae,null));};exports['destroy']=function(_0x28adaf,_0x177273){return db['OpenchannelTransferReport'][_0xf4a6('0x48')]({'where':{'id':_0x28adaf[_0xf4a6('0x43')]['id']}})[_0xf4a6('0x24')](handleEntityNotFound(_0x177273,null))[_0xf4a6('0x24')](removeEntity(_0x177273,null))[_0xf4a6('0x41')](handleError(_0x177273,null));};exports[_0xf4a6('0x49')]=function(_0x2afade,_0x456861){return db[_0xf4a6('0x2c')]['describe']()[_0xf4a6('0x24')](respondWithResult(_0x456861,null))[_0xf4a6('0x41')](handleError(_0x456861,null));}; \ No newline at end of file +var _0x199d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','OpenchannelTransferReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x7c5834,_0xa96cfb){var _0x40becf=function(_0x579649){while(--_0x579649){_0x7c5834['push'](_0x7c5834['shift']());}};_0x40becf(++_0xa96cfb);}(_0x199d,0x85));var _0xd199=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x199d[_0x4733d3];return _0x1b9a44;};'use strict';var emlformat=require(_0xd199('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd199('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd199('0x2'));var moment=require('moment');var BPromise=require(_0xd199('0x3'));var Mustache=require(_0xd199('0x4'));var util=require(_0xd199('0x5'));var path=require(_0xd199('0x6'));var sox=require(_0xd199('0x7'));var csv=require(_0xd199('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd199('0x9'));var squel=require(_0xd199('0xa'));var crypto=require(_0xd199('0xb'));var jsforce=require(_0xd199('0xc'));var deskjs=require(_0xd199('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd199('0xe'));var Redis=require(_0xd199('0xf'));var authService=require(_0xd199('0x10'));var qs=require(_0xd199('0x11'));var as=require(_0xd199('0x12'));var hardwareService=require(_0xd199('0x13'));var logger=require(_0xd199('0x14'))(_0xd199('0x15'));var utils=require(_0xd199('0x16'));var config=require(_0xd199('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd199('0x18'))['db'];function respondWithStatusCode(_0x2b53e1,_0x4445d7){_0x4445d7=_0x4445d7||0xcc;return function(_0x7da3e5){if(_0x7da3e5){return _0x2b53e1['sendStatus'](_0x4445d7);}return _0x2b53e1[_0xd199('0x19')](_0x4445d7)['end']();};}function respondWithResult(_0xf93fc5,_0x24f879){_0x24f879=_0x24f879||0xc8;return function(_0x189189){if(_0x189189){return _0xf93fc5[_0xd199('0x19')](_0x24f879)['json'](_0x189189);}};}function respondWithFilteredResult(_0x2f49a9,_0x5baca3){return function(_0x5a9d47){if(_0x5a9d47){var _0x2f00d8=typeof _0x5baca3['offset']===_0xd199('0x1a')&&typeof _0x5baca3[_0xd199('0x1b')]===_0xd199('0x1a');var _0x56198d=_0x5a9d47['count'];var _0x5e48ca=_0x2f00d8?0x0:_0x5baca3[_0xd199('0x1c')];var _0x3869ca=_0x2f00d8?_0x5a9d47['count']:_0x5baca3[_0xd199('0x1c')]+_0x5baca3['limit'];var _0x46b015;if(_0x3869ca>=_0x56198d){_0x3869ca=_0x56198d;_0x46b015=0xc8;}else{_0x46b015=0xce;}_0x2f49a9[_0xd199('0x19')](_0x46b015);return _0x2f49a9[_0xd199('0x1d')](_0xd199('0x1e'),_0x5e48ca+'-'+_0x3869ca+'/'+_0x56198d)['json'](_0x5a9d47);}return null;};}function patchUpdates(_0x3a1b6a){return function(_0x5d02c3){try{jsonpatch[_0xd199('0x1f')](_0x5d02c3,_0x3a1b6a,!![]);}catch(_0x282bae){return BPromise[_0xd199('0x20')](_0x282bae);}return _0x5d02c3[_0xd199('0x21')]();};}function saveUpdates(_0x57bc5d,_0x54aea7){return function(_0x4b35d1){if(_0x4b35d1){return _0x4b35d1[_0xd199('0x22')](_0x57bc5d)[_0xd199('0x23')](function(_0x46a954){return _0x46a954;});}return null;};}function removeEntity(_0x35e743,_0x21f0e1){return function(_0x59dc25){if(_0x59dc25){return _0x59dc25['destroy']()[_0xd199('0x23')](function(){_0x35e743[_0xd199('0x19')](0xcc)[_0xd199('0x24')]();});}};}function handleEntityNotFound(_0x3c5a71,_0x4a1192){return function(_0x3c1cf7){if(!_0x3c1cf7){_0x3c5a71[_0xd199('0x25')](0x194);}return _0x3c1cf7;};}function handleError(_0x9d762,_0x1963a9){_0x1963a9=_0x1963a9||0x1f4;return function(_0x1aeaa1){logger[_0xd199('0x26')](_0x1aeaa1[_0xd199('0x27')]);if(_0x1aeaa1[_0xd199('0x28')]){delete _0x1aeaa1['name'];}_0x9d762[_0xd199('0x19')](_0x1963a9)[_0xd199('0x29')](_0x1aeaa1);};}exports['index']=function(_0x4fb99c,_0x371542){var _0x2d2ee1={},_0x188f2f={},_0x2ca4f7={'count':0x0,'rows':[]};var _0x2b69bf=_['map'](db[_0xd199('0x2a')][_0xd199('0x2b')],function(_0x43e02b){return{'name':_0x43e02b[_0xd199('0x2c')],'type':_0x43e02b[_0xd199('0x2d')][_0xd199('0x2e')]};});_0x188f2f['model']=_[_0xd199('0x2f')](_0x2b69bf,_0xd199('0x28'));_0x188f2f[_0xd199('0x30')]=_['keys'](_0x4fb99c[_0xd199('0x30')]);_0x188f2f[_0xd199('0x31')]=_[_0xd199('0x32')](_0x188f2f[_0xd199('0x33')],_0x188f2f[_0xd199('0x30')]);_0x2d2ee1[_0xd199('0x34')]=_['intersection'](_0x188f2f[_0xd199('0x33')],qs[_0xd199('0x35')](_0x4fb99c[_0xd199('0x30')][_0xd199('0x35')]));_0x2d2ee1['attributes']=_0x2d2ee1[_0xd199('0x34')][_0xd199('0x36')]?_0x2d2ee1[_0xd199('0x34')]:_0x188f2f[_0xd199('0x33')];if(!_0x4fb99c[_0xd199('0x30')][_0xd199('0x37')](_0xd199('0x38'))){_0x2d2ee1[_0xd199('0x1b')]=qs[_0xd199('0x1b')](_0x4fb99c[_0xd199('0x30')][_0xd199('0x1b')]);_0x2d2ee1[_0xd199('0x1c')]=qs['offset'](_0x4fb99c[_0xd199('0x30')][_0xd199('0x1c')]);}_0x2d2ee1[_0xd199('0x39')]=qs[_0xd199('0x3a')](_0x4fb99c[_0xd199('0x30')][_0xd199('0x3a')]);_0x2d2ee1['where']=qs[_0xd199('0x31')](_[_0xd199('0x3b')](_0x4fb99c['query'],_0x188f2f['filters']),_0x2b69bf);if(_0x4fb99c[_0xd199('0x30')]['filter']){_0x2d2ee1[_0xd199('0x3c')]=_[_0xd199('0x3d')](_0x2d2ee1[_0xd199('0x3c')],{'$or':_['map'](_0x2b69bf,function(_0x554829){if(_0x554829[_0xd199('0x2d')]!=='VIRTUAL'){var _0x1b4135={};_0x1b4135[_0x554829['name']]={'$like':'%'+_0x4fb99c[_0xd199('0x30')]['filter']+'%'};return _0x1b4135;}})});}_0x2d2ee1=_[_0xd199('0x3d')]({},_0x2d2ee1,_0x4fb99c['options']);var _0x3bafb0={'where':_0x2d2ee1['where']};return db[_0xd199('0x2a')][_0xd199('0x3e')](_0x3bafb0)[_0xd199('0x23')](function(_0x5b778e){_0x2ca4f7[_0xd199('0x3e')]=_0x5b778e;if(_0x4fb99c[_0xd199('0x30')][_0xd199('0x3f')]){_0x2d2ee1['include']=[{'all':!![]}];}return db[_0xd199('0x2a')][_0xd199('0x40')](_0x2d2ee1);})[_0xd199('0x23')](function(_0x4182fb){_0x2ca4f7[_0xd199('0x41')]=_0x4182fb;return _0x2ca4f7;})[_0xd199('0x23')](respondWithFilteredResult(_0x371542,_0x2d2ee1))[_0xd199('0x42')](handleError(_0x371542,null));};exports[_0xd199('0x43')]=function(_0x4af7a4,_0xbf6885){var _0x3c1137={'raw':!![],'where':{'id':_0x4af7a4[_0xd199('0x44')]['id']}},_0x106730={};_0x106730['model']=_['keys'](db[_0xd199('0x2a')][_0xd199('0x2b')]);_0x106730[_0xd199('0x30')]=_[_0xd199('0x45')](_0x4af7a4[_0xd199('0x30')]);_0x106730[_0xd199('0x31')]=_['intersection'](_0x106730['model'],_0x106730['query']);_0x3c1137[_0xd199('0x34')]=_[_0xd199('0x32')](_0x106730[_0xd199('0x33')],qs[_0xd199('0x35')](_0x4af7a4[_0xd199('0x30')]['fields']));_0x3c1137[_0xd199('0x34')]=_0x3c1137['attributes']['length']?_0x3c1137[_0xd199('0x34')]:_0x106730[_0xd199('0x33')];if(_0x4af7a4[_0xd199('0x30')][_0xd199('0x3f')]){_0x3c1137[_0xd199('0x46')]=[{'all':!![]}];}_0x3c1137=_[_0xd199('0x3d')]({},_0x3c1137,_0x4af7a4['options']);return db[_0xd199('0x2a')][_0xd199('0x47')](_0x3c1137)[_0xd199('0x23')](handleEntityNotFound(_0xbf6885,null))[_0xd199('0x23')](respondWithResult(_0xbf6885,null))[_0xd199('0x42')](handleError(_0xbf6885,null));};exports[_0xd199('0x48')]=function(_0x3007a9,_0x407149){return db[_0xd199('0x2a')][_0xd199('0x48')](_0x3007a9[_0xd199('0x49')],{})[_0xd199('0x23')](respondWithResult(_0x407149,0xc9))[_0xd199('0x42')](handleError(_0x407149,null));};exports['update']=function(_0x91a85b,_0x217ff5){if(_0x91a85b[_0xd199('0x49')]['id']){delete _0x91a85b[_0xd199('0x49')]['id'];}return db[_0xd199('0x2a')]['find']({'where':{'id':_0x91a85b[_0xd199('0x44')]['id']}})[_0xd199('0x23')](handleEntityNotFound(_0x217ff5,null))[_0xd199('0x23')](saveUpdates(_0x91a85b[_0xd199('0x49')],null))[_0xd199('0x23')](respondWithResult(_0x217ff5,null))[_0xd199('0x42')](handleError(_0x217ff5,null));};exports['destroy']=function(_0x2d424a,_0x473cad){return db[_0xd199('0x2a')][_0xd199('0x47')]({'where':{'id':_0x2d424a[_0xd199('0x44')]['id']}})[_0xd199('0x23')](handleEntityNotFound(_0x473cad,null))[_0xd199('0x23')](removeEntity(_0x473cad,null))[_0xd199('0x42')](handleError(_0x473cad,null));};exports[_0xd199('0x4a')]=function(_0x1920f5,_0x417410){return db[_0xd199('0x2a')]['describe']()[_0xd199('0x23')](respondWithResult(_0x417410,null))[_0xd199('0x42')](handleError(_0x417410,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1eb5246..f4d433b 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 _0xbd0a=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0xbd0a,0xd8));var _0xabd0=function(_0x3d7edc,_0x2ebe98){_0x3d7edc=_0x3d7edc-0x0;var _0x286193=_0xbd0a[_0x3d7edc];return _0x286193;};'use strict';var _=require(_0xabd0('0x0'));var util=require(_0xabd0('0x1'));var logger=require(_0xabd0('0x2'))(_0xabd0('0x3'));var moment=require(_0xabd0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabd0('0x5'));var rimraf=require(_0xabd0('0x6'));var config=require(_0xabd0('0x7'));var attributes=require(_0xabd0('0x8'));module['exports']=function(_0x2a5605,_0x329603){return _0x2a5605[_0xabd0('0x9')](_0xabd0('0xa'),attributes,{'tableName':_0xabd0('0xb'),'paranoid':![],'indexes':[{'name':_0xabd0('0xc'),'fields':[_0xabd0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x642f=['exports','define','OpenchannelTransferReport','uniqueid','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x5022f7,_0x4ecca7){var _0x156363=function(_0x16f5a9){while(--_0x16f5a9){_0x5022f7['push'](_0x5022f7['shift']());}};_0x156363(++_0x4ecca7);}(_0x642f,0x1cc));var _0xf642=function(_0x202893,_0x47ed0f){_0x202893=_0x202893-0x0;var _0x56b8f0=_0x642f[_0x202893];return _0x56b8f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf642('0x0'))(_0xf642('0x1'));var moment=require(_0xf642('0x2'));var BPromise=require(_0xf642('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf642('0x4'));var rimraf=require(_0xf642('0x5'));var config=require(_0xf642('0x6'));var attributes=require(_0xf642('0x7'));module[_0xf642('0x8')]=function(_0x305dcc,_0x5e67b0){return _0x305dcc[_0xf642('0x9')](_0xf642('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xf642('0xb'),'fields':[_0xf642('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 04a74e1..26cfb0f 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 _0xa566=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','info'];(function(_0x2a7df0,_0x5fee0b){var _0x2a91c8=function(_0x244ec1){while(--_0x244ec1){_0x2a7df0['push'](_0x2a7df0['shift']());}};_0x2a91c8(++_0x5fee0b);}(_0xa566,0x1c1));var _0x6a56=function(_0xd67753,_0x99eac1){_0xd67753=_0xd67753-0x0;var _0x2e56c4=_0xa566[_0xd67753];return _0x2e56c4;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var moment=require(_0x6a56('0x2'));var BPromise=require('bluebird');var rs=require(_0x6a56('0x3'));var fs=require('fs');var Redis=require(_0x6a56('0x4'));var db=require(_0x6a56('0x5'))['db'];var utils=require(_0x6a56('0x6'));var logger=require('../../config/logger')(_0x6a56('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3712ee,_0x50ae34,_0x472c60){return new BPromise(function(_0x4947a9,_0x33240c){return client[_0x6a56('0x8')](_0x3712ee,_0x472c60)['then'](function(_0x2f49ab){logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));logger['debug'](_0x6a56('0xc'),_0x50ae34,_0x6a56('0xb'),JSON['stringify'](_0x2f49ab));if(_0x2f49ab['error']){if(_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xe')]===0x1f4){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x33240c(_0x2f49ab[_0x6a56('0xd')]['message']);}logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x2f49ab[_0x6a56('0xd')][_0x6a56('0xf')]);return _0x4947a9(_0x2f49ab[_0x6a56('0xd')]['message']);}else{logger[_0x6a56('0x9')](_0x6a56('0xa'),_0x50ae34,_0x6a56('0xb'));_0x4947a9(_0x2f49ab[_0x6a56('0x10')][_0x6a56('0xf')]);}})['catch'](function(_0x5e9895){logger[_0x6a56('0xd')](_0x6a56('0xa'),_0x50ae34,_0x5e9895);_0x33240c(_0x5e9895);});});} \ No newline at end of file +var _0x6363=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x6363,0x13a));var _0x3636=function(_0x5d3866,_0x1f3387){_0x5d3866=_0x5d3866-0x0;var _0x5c1102=_0x6363[_0x5d3866];return _0x5c1102;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var moment=require(_0x3636('0x1'));var BPromise=require(_0x3636('0x2'));var rs=require(_0x3636('0x3'));var fs=require('fs');var Redis=require(_0x3636('0x4'));var db=require(_0x3636('0x5'))['db'];var utils=require(_0x3636('0x6'));var logger=require(_0x3636('0x7'))(_0x3636('0x8'));var config=require(_0x3636('0x9'));var jayson=require(_0x3636('0xa'));var client=jayson[_0x3636('0xb')][_0x3636('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdc928c,_0x17b2a4,_0x583dec){return new BPromise(function(_0x19f917,_0x47f84e){return client[_0x3636('0xd')](_0xdc928c,_0x583dec)[_0x3636('0xe')](function(_0x23869b){logger[_0x3636('0xf')](_0x3636('0x10'),_0x17b2a4,_0x3636('0x11'));logger[_0x3636('0x12')](_0x3636('0x13'),_0x17b2a4,_0x3636('0x11'),JSON['stringify'](_0x23869b));if(_0x23869b['error']){if(_0x23869b[_0x3636('0x14')]['code']===0x1f4){logger[_0x3636('0x14')](_0x3636('0x10'),_0x17b2a4,_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);return _0x47f84e(_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);}logger[_0x3636('0x14')](_0x3636('0x10'),_0x17b2a4,_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);return _0x19f917(_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);}else{logger[_0x3636('0xf')](_0x3636('0x10'),_0x17b2a4,_0x3636('0x11'));_0x19f917(_0x23869b[_0x3636('0x16')][_0x3636('0x15')]);}})['catch'](function(_0x11b53e){logger[_0x3636('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x17b2a4,_0x11b53e);_0x47f84e(_0x11b53e);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 5fdf11f..f98da63 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 _0xe584=['/:id','show','post','create','put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index'];(function(_0x1beb62,_0x5cdc6f){var _0x3eed3a=function(_0x1bfa41){while(--_0x1bfa41){_0x1beb62['push'](_0x1beb62['shift']());}};_0x3eed3a(++_0x5cdc6f);}(_0xe584,0x14c));var _0x4e58=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xe584[_0x2df507];return _0x1f7167;};'use strict';var multer=require(_0x4e58('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e58('0x1'));var router=express[_0x4e58('0x2')]();var fs_extra=require(_0x4e58('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4e58('0x4'));var config=require(_0x4e58('0x5'));var controller=require(_0x4e58('0x6'));router[_0x4e58('0x7')]('/',auth[_0x4e58('0x8')](),controller[_0x4e58('0x9')]);router[_0x4e58('0x7')](_0x4e58('0xa'),auth['isAuthenticated'](),controller[_0x4e58('0xb')]);router[_0x4e58('0xc')]('/',auth[_0x4e58('0x8')](),controller[_0x4e58('0xd')]);router[_0x4e58('0xe')](_0x4e58('0xa'),auth[_0x4e58('0x8')](),controller['update']);router[_0x4e58('0xf')](_0x4e58('0xa'),auth[_0x4e58('0x8')](),controller[_0x4e58('0x10')]);module[_0x4e58('0x11')]=router; \ No newline at end of file +var _0xbd38=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','post','isAuthenticated','create','put','delete','destroy','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd38,0xe1));var _0x8bd3=function(_0x265701,_0x519b7d){_0x265701=_0x265701-0x0;var _0x1eacfc=_0xbd38[_0x265701];return _0x1eacfc;};'use strict';var multer=require(_0x8bd3('0x0'));var util=require(_0x8bd3('0x1'));var path=require(_0x8bd3('0x2'));var timeout=require(_0x8bd3('0x3'));var express=require('express');var router=express[_0x8bd3('0x4')]();var fs_extra=require(_0x8bd3('0x5'));var auth=require(_0x8bd3('0x6'));var interaction=require(_0x8bd3('0x7'));var config=require(_0x8bd3('0x8'));var controller=require(_0x8bd3('0x9'));router[_0x8bd3('0xa')]('/',auth['isAuthenticated'](),controller[_0x8bd3('0xb')]);router[_0x8bd3('0xa')](_0x8bd3('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8bd3('0xd')]('/',auth[_0x8bd3('0xe')](),controller[_0x8bd3('0xf')]);router[_0x8bd3('0x10')](_0x8bd3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8bd3('0x11')](_0x8bd3('0xc'),auth['isAuthenticated'](),controller[_0x8bd3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 9fb2e5a..321da9d 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 _0xf73c=['name','exports'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xf73c,0x79));var _0xcf73=function(_0x92fd77,_0x5a1e8a){_0x92fd77=_0x92fd77-0x0;var _0x492476=_0xf73c[_0x92fd77];return _0x492476;};'use strict';var Sequelize=require('sequelize');module[_0xcf73('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xcf73('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7af7=['STRING','name','sequelize'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x7af7,0x113));var _0x77af=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x7af7[_0x2118ad];return _0x4b5715;};'use strict';var Sequelize=require(_0x77af('0x0'));module['exports']={'name':{'type':Sequelize[_0x77af('0x1')],'unique':_0x77af('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x77af('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 7c4a522..d1a9993 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 _0x6d77=['fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','name','send','index','map','Pause','fieldName','key','model','keys','query','filters','intersection','attributes'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x6d77,0x160));var _0x76d7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x6d77[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76d7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76d7('0x1'));var rp=require(_0x76d7('0x2'));var moment=require(_0x76d7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x76d7('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x76d7('0x5'));var ejs=require(_0x76d7('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x76d7('0x7'));var crypto=require(_0x76d7('0x8'));var jsforce=require(_0x76d7('0x9'));var deskjs=require(_0x76d7('0xa'));var toCsv=require(_0x76d7('0x5'));var querystring=require(_0x76d7('0xb'));var Papa=require(_0x76d7('0xc'));var Redis=require(_0x76d7('0xd'));var authService=require(_0x76d7('0xe'));var qs=require(_0x76d7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76d7('0x10'));var logger=require(_0x76d7('0x11'))(_0x76d7('0x12'));var utils=require(_0x76d7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x76d7('0x14'));var db=require(_0x76d7('0x15'))['db'];function respondWithStatusCode(_0x5d9b52,_0x260454){_0x260454=_0x260454||0xcc;return function(_0x1c5723){if(_0x1c5723){return _0x5d9b52[_0x76d7('0x16')](_0x260454);}return _0x5d9b52[_0x76d7('0x17')](_0x260454)[_0x76d7('0x18')]();};}function respondWithResult(_0x9efe40,_0x4e2864){_0x4e2864=_0x4e2864||0xc8;return function(_0x535be0){if(_0x535be0){return _0x9efe40[_0x76d7('0x17')](_0x4e2864)[_0x76d7('0x19')](_0x535be0);}};}function respondWithFilteredResult(_0x328f83,_0xa2cbd7){return function(_0x129127){if(_0x129127){var _0x2f1223=typeof _0xa2cbd7[_0x76d7('0x1a')]==='undefined'&&typeof _0xa2cbd7[_0x76d7('0x1b')]===_0x76d7('0x1c');var _0x4dc8e2=_0x129127[_0x76d7('0x1d')];var _0xceb036=_0x2f1223?0x0:_0xa2cbd7[_0x76d7('0x1a')];var _0x5e7c2b=_0x2f1223?_0x129127['count']:_0xa2cbd7[_0x76d7('0x1a')]+_0xa2cbd7[_0x76d7('0x1b')];var _0x28768d;if(_0x5e7c2b>=_0x4dc8e2){_0x5e7c2b=_0x4dc8e2;_0x28768d=0xc8;}else{_0x28768d=0xce;}_0x328f83[_0x76d7('0x17')](_0x28768d);return _0x328f83[_0x76d7('0x1e')](_0x76d7('0x1f'),_0xceb036+'-'+_0x5e7c2b+'/'+_0x4dc8e2)[_0x76d7('0x19')](_0x129127);}return null;};}function patchUpdates(_0x54c686){return function(_0xbba942){try{jsonpatch[_0x76d7('0x20')](_0xbba942,_0x54c686,!![]);}catch(_0x4337aa){return BPromise[_0x76d7('0x21')](_0x4337aa);}return _0xbba942[_0x76d7('0x22')]();};}function saveUpdates(_0x30b6a3,_0x267b8c){return function(_0x130f6f){if(_0x130f6f){return _0x130f6f[_0x76d7('0x23')](_0x30b6a3)[_0x76d7('0x24')](function(_0x481647){return _0x481647;});}return null;};}function removeEntity(_0x4c5c37,_0x670582){return function(_0x16f54f){if(_0x16f54f){return _0x16f54f[_0x76d7('0x25')]()[_0x76d7('0x24')](function(){var _0x101943=_0x16f54f[_0x76d7('0x26')]({'plain':!![]});var _0x138e6c=_0x76d7('0x27');return db['UserProfileResource'][_0x76d7('0x25')]({'where':{'type':_0x138e6c,'resourceId':_0x101943['id']}})['then'](function(){return _0x16f54f;});})[_0x76d7('0x24')](function(){_0x4c5c37[_0x76d7('0x17')](0xcc)[_0x76d7('0x18')]();});}};}function handleEntityNotFound(_0x2cfbae,_0x35e9bd){return function(_0x2283f4){if(!_0x2283f4){_0x2cfbae['sendStatus'](0x194);}return _0x2283f4;};}function handleError(_0x427705,_0x19f36a){_0x19f36a=_0x19f36a||0x1f4;return function(_0x22da97){logger['error'](_0x22da97['stack']);if(_0x22da97[_0x76d7('0x28')]){delete _0x22da97[_0x76d7('0x28')];}_0x427705['status'](_0x19f36a)[_0x76d7('0x29')](_0x22da97);};}exports[_0x76d7('0x2a')]=function(_0x5d7825,_0x334030){var _0x435a91={},_0x85c2a4={},_0x47b219={'count':0x0,'rows':[]};var _0x52cb10=_[_0x76d7('0x2b')](db[_0x76d7('0x2c')]['rawAttributes'],function(_0x36d828){return{'name':_0x36d828[_0x76d7('0x2d')],'type':_0x36d828['type'][_0x76d7('0x2e')]};});_0x85c2a4[_0x76d7('0x2f')]=_['map'](_0x52cb10,_0x76d7('0x28'));_0x85c2a4['query']=_[_0x76d7('0x30')](_0x5d7825[_0x76d7('0x31')]);_0x85c2a4[_0x76d7('0x32')]=_[_0x76d7('0x33')](_0x85c2a4[_0x76d7('0x2f')],_0x85c2a4['query']);_0x435a91[_0x76d7('0x34')]=_[_0x76d7('0x33')](_0x85c2a4[_0x76d7('0x2f')],qs[_0x76d7('0x35')](_0x5d7825['query']['fields']));_0x435a91[_0x76d7('0x34')]=_0x435a91[_0x76d7('0x34')][_0x76d7('0x36')]?_0x435a91[_0x76d7('0x34')]:_0x85c2a4['model'];if(!_0x5d7825[_0x76d7('0x31')][_0x76d7('0x37')](_0x76d7('0x38'))){_0x435a91[_0x76d7('0x1b')]=qs['limit'](_0x5d7825['query'][_0x76d7('0x1b')]);_0x435a91[_0x76d7('0x1a')]=qs[_0x76d7('0x1a')](_0x5d7825['query'][_0x76d7('0x1a')]);}_0x435a91['order']=qs[_0x76d7('0x39')](_0x5d7825['query'][_0x76d7('0x39')]);_0x435a91['where']=qs[_0x76d7('0x32')](_[_0x76d7('0x3a')](_0x5d7825[_0x76d7('0x31')],_0x85c2a4['filters']),_0x52cb10);if(_0x5d7825[_0x76d7('0x31')][_0x76d7('0x3b')]){_0x435a91['where']=_[_0x76d7('0x3c')](_0x435a91[_0x76d7('0x3d')],{'$or':_[_0x76d7('0x2b')](_0x52cb10,function(_0x2b5baf){if(_0x2b5baf[_0x76d7('0x3e')]!==_0x76d7('0x3f')){var _0x5a2832={};_0x5a2832[_0x2b5baf[_0x76d7('0x28')]]={'$like':'%'+_0x5d7825['query'][_0x76d7('0x3b')]+'%'};return _0x5a2832;}})});}_0x435a91=_[_0x76d7('0x3c')]({},_0x435a91,_0x5d7825[_0x76d7('0x40')]);var _0x38961b={'where':_0x435a91[_0x76d7('0x3d')]};return db[_0x76d7('0x2c')][_0x76d7('0x1d')](_0x38961b)[_0x76d7('0x24')](function(_0xacfc83){_0x47b219['count']=_0xacfc83;if(_0x5d7825['query'][_0x76d7('0x41')]){_0x435a91[_0x76d7('0x42')]=[{'all':!![]}];}return db[_0x76d7('0x2c')][_0x76d7('0x43')](_0x435a91);})[_0x76d7('0x24')](function(_0x194cbc){_0x47b219['rows']=_0x194cbc;return _0x47b219;})[_0x76d7('0x24')](respondWithFilteredResult(_0x334030,_0x435a91))[_0x76d7('0x44')](handleError(_0x334030,null));};exports['show']=function(_0x9b68de,_0x37ef2c){var _0x4abe7d={'raw':!![],'where':{'id':_0x9b68de[_0x76d7('0x45')]['id']}},_0x2abe04={};_0x2abe04[_0x76d7('0x2f')]=_['keys'](db[_0x76d7('0x2c')]['rawAttributes']);_0x2abe04[_0x76d7('0x31')]=_[_0x76d7('0x30')](_0x9b68de['query']);_0x2abe04[_0x76d7('0x32')]=_[_0x76d7('0x33')](_0x2abe04[_0x76d7('0x2f')],_0x2abe04[_0x76d7('0x31')]);_0x4abe7d[_0x76d7('0x34')]=_['intersection'](_0x2abe04['model'],qs[_0x76d7('0x35')](_0x9b68de[_0x76d7('0x31')][_0x76d7('0x35')]));_0x4abe7d['attributes']=_0x4abe7d[_0x76d7('0x34')][_0x76d7('0x36')]?_0x4abe7d[_0x76d7('0x34')]:_0x2abe04[_0x76d7('0x2f')];if(_0x9b68de[_0x76d7('0x31')][_0x76d7('0x41')]){_0x4abe7d[_0x76d7('0x42')]=[{'all':!![]}];}_0x4abe7d=_[_0x76d7('0x3c')]({},_0x4abe7d,_0x9b68de[_0x76d7('0x40')]);return db['Pause'][_0x76d7('0x46')](_0x4abe7d)[_0x76d7('0x24')](handleEntityNotFound(_0x37ef2c,null))['then'](respondWithResult(_0x37ef2c,null))['catch'](handleError(_0x37ef2c,null));};exports[_0x76d7('0x47')]=function(_0xe1075c,_0x1ab54a){return db[_0x76d7('0x2c')][_0x76d7('0x47')](_0xe1075c[_0x76d7('0x48')],{})[_0x76d7('0x24')](function(_0x2a5c81){var _0x8d44f0=_0xe1075c[_0x76d7('0x49')][_0x76d7('0x26')]({'plain':!![]});if(!_0x8d44f0)throw new Error(_0x76d7('0x4a'));if(_0x8d44f0[_0x76d7('0x4b')]===_0x76d7('0x49')){var _0xfbf575=_0x2a5c81[_0x76d7('0x26')]({'plain':!![]});var _0x5a6ea2=_0x76d7('0x27');return db['UserProfileSection'][_0x76d7('0x46')]({'where':{'name':_0x5a6ea2,'userProfileId':_0x8d44f0[_0x76d7('0x4c')]},'raw':!![]})[_0x76d7('0x24')](function(_0x6ed545){if(_0x6ed545&&_0x6ed545[_0x76d7('0x4d')]===0x0){return db[_0x76d7('0x4e')]['create']({'name':_0xfbf575[_0x76d7('0x28')],'resourceId':_0xfbf575['id'],'type':_0x6ed545[_0x76d7('0x28')],'sectionId':_0x6ed545['id']},{})[_0x76d7('0x24')](function(){return _0x2a5c81;});}else{return _0x2a5c81;}})[_0x76d7('0x44')](function(_0x54fd7f){logger[_0x76d7('0x4f')](_0x76d7('0x50'),_0x54fd7f);throw _0x54fd7f;});}return _0x2a5c81;})[_0x76d7('0x24')](respondWithResult(_0x1ab54a,0xc9))[_0x76d7('0x44')](handleError(_0x1ab54a,null));};exports[_0x76d7('0x23')]=function(_0x329e2c,_0x4f3cb5){if(_0x329e2c[_0x76d7('0x48')]['id']){delete _0x329e2c[_0x76d7('0x48')]['id'];}return db[_0x76d7('0x2c')]['find']({'where':{'id':_0x329e2c[_0x76d7('0x45')]['id']}})[_0x76d7('0x24')](handleEntityNotFound(_0x4f3cb5,null))[_0x76d7('0x24')](saveUpdates(_0x329e2c[_0x76d7('0x48')],null))[_0x76d7('0x24')](respondWithResult(_0x4f3cb5,null))[_0x76d7('0x44')](handleError(_0x4f3cb5,null));};exports[_0x76d7('0x25')]=function(_0x4dd706,_0x1d3e28){return db[_0x76d7('0x2c')]['find']({'where':{'id':_0x4dd706['params']['id']}})[_0x76d7('0x24')](handleEntityNotFound(_0x1d3e28,null))['then'](removeEntity(_0x1d3e28,null))['catch'](handleError(_0x1d3e28,null));}; \ No newline at end of file +var _0xab4a=['index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','filters','length','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','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','update','destroy','get','Pauses','UserProfileResource','then','error','stack','name','send'];(function(_0x5c1353,_0x328298){var _0x31e2e6=function(_0x5d37e4){while(--_0x5d37e4){_0x5c1353['push'](_0x5c1353['shift']());}};_0x31e2e6(++_0x328298);}(_0xab4a,0x117));var _0xaab4=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xab4a[_0x5f519b];return _0x2461e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaab4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaab4('0x1'));var rp=require(_0xaab4('0x2'));var moment=require(_0xaab4('0x3'));var BPromise=require(_0xaab4('0x4'));var Mustache=require(_0xaab4('0x5'));var util=require('util');var path=require(_0xaab4('0x6'));var sox=require(_0xaab4('0x7'));var csv=require(_0xaab4('0x8'));var ejs=require(_0xaab4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaab4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaab4('0xb'));var toCsv=require(_0xaab4('0x8'));var querystring=require(_0xaab4('0xc'));var Papa=require('papaparse');var Redis=require(_0xaab4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xaab4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaab4('0xf'));var logger=require('../../config/logger')(_0xaab4('0x10'));var utils=require(_0xaab4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xaab4('0x12'));var db=require(_0xaab4('0x13'))['db'];function respondWithStatusCode(_0x2803ae,_0x377393){_0x377393=_0x377393||0xcc;return function(_0x1d3162){if(_0x1d3162){return _0x2803ae[_0xaab4('0x14')](_0x377393);}return _0x2803ae[_0xaab4('0x15')](_0x377393)[_0xaab4('0x16')]();};}function respondWithResult(_0x2ea194,_0x498523){_0x498523=_0x498523||0xc8;return function(_0x1de4d4){if(_0x1de4d4){return _0x2ea194[_0xaab4('0x15')](_0x498523)['json'](_0x1de4d4);}};}function respondWithFilteredResult(_0xa22056,_0x285397){return function(_0xf8e996){if(_0xf8e996){var _0x1af6f1=typeof _0x285397[_0xaab4('0x17')]===_0xaab4('0x18')&&typeof _0x285397['limit']==='undefined';var _0x3d3fc7=_0xf8e996[_0xaab4('0x19')];var _0x4dc0d1=_0x1af6f1?0x0:_0x285397['offset'];var _0x2b53be=_0x1af6f1?_0xf8e996[_0xaab4('0x19')]:_0x285397[_0xaab4('0x17')]+_0x285397[_0xaab4('0x1a')];var _0x165073;if(_0x2b53be>=_0x3d3fc7){_0x2b53be=_0x3d3fc7;_0x165073=0xc8;}else{_0x165073=0xce;}_0xa22056[_0xaab4('0x15')](_0x165073);return _0xa22056[_0xaab4('0x1b')](_0xaab4('0x1c'),_0x4dc0d1+'-'+_0x2b53be+'/'+_0x3d3fc7)[_0xaab4('0x1d')](_0xf8e996);}return null;};}function patchUpdates(_0x422fc0){return function(_0x48ef0d){try{jsonpatch['apply'](_0x48ef0d,_0x422fc0,!![]);}catch(_0x1e48da){return BPromise[_0xaab4('0x1e')](_0x1e48da);}return _0x48ef0d['save']();};}function saveUpdates(_0x38e9e7,_0x9fa85a){return function(_0x1b3342){if(_0x1b3342){return _0x1b3342[_0xaab4('0x1f')](_0x38e9e7)['then'](function(_0x16b9d3){return _0x16b9d3;});}return null;};}function removeEntity(_0x990833,_0x59b563){return function(_0x2abeb7){if(_0x2abeb7){return _0x2abeb7[_0xaab4('0x20')]()['then'](function(){var _0x8c7ab4=_0x2abeb7[_0xaab4('0x21')]({'plain':!![]});var _0x4c2a66=_0xaab4('0x22');return db[_0xaab4('0x23')]['destroy']({'where':{'type':_0x4c2a66,'resourceId':_0x8c7ab4['id']}})[_0xaab4('0x24')](function(){return _0x2abeb7;});})[_0xaab4('0x24')](function(){_0x990833[_0xaab4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e92ed,_0x36763a){return function(_0x255b74){if(!_0x255b74){_0x5e92ed['sendStatus'](0x194);}return _0x255b74;};}function handleError(_0x3ff6f1,_0x304c18){_0x304c18=_0x304c18||0x1f4;return function(_0xf6a101){logger[_0xaab4('0x25')](_0xf6a101[_0xaab4('0x26')]);if(_0xf6a101[_0xaab4('0x27')]){delete _0xf6a101['name'];}_0x3ff6f1[_0xaab4('0x15')](_0x304c18)[_0xaab4('0x28')](_0xf6a101);};}exports[_0xaab4('0x29')]=function(_0x1040e3,_0x448b95){var _0x426f98={},_0x25c235={},_0x4bd375={'count':0x0,'rows':[]};var _0x4e2fd1=_[_0xaab4('0x2a')](db[_0xaab4('0x2b')][_0xaab4('0x2c')],function(_0x2471a8){return{'name':_0x2471a8[_0xaab4('0x2d')],'type':_0x2471a8[_0xaab4('0x2e')][_0xaab4('0x2f')]};});_0x25c235[_0xaab4('0x30')]=_[_0xaab4('0x2a')](_0x4e2fd1,_0xaab4('0x27'));_0x25c235['query']=_[_0xaab4('0x31')](_0x1040e3[_0xaab4('0x32')]);_0x25c235['filters']=_[_0xaab4('0x33')](_0x25c235[_0xaab4('0x30')],_0x25c235[_0xaab4('0x32')]);_0x426f98[_0xaab4('0x34')]=_[_0xaab4('0x33')](_0x25c235[_0xaab4('0x30')],qs[_0xaab4('0x35')](_0x1040e3[_0xaab4('0x32')]['fields']));_0x426f98[_0xaab4('0x34')]=_0x426f98[_0xaab4('0x34')]['length']?_0x426f98[_0xaab4('0x34')]:_0x25c235['model'];if(!_0x1040e3['query'][_0xaab4('0x36')]('nolimit')){_0x426f98['limit']=qs['limit'](_0x1040e3['query'][_0xaab4('0x1a')]);_0x426f98[_0xaab4('0x17')]=qs[_0xaab4('0x17')](_0x1040e3[_0xaab4('0x32')][_0xaab4('0x17')]);}_0x426f98[_0xaab4('0x37')]=qs['sort'](_0x1040e3[_0xaab4('0x32')][_0xaab4('0x38')]);_0x426f98[_0xaab4('0x39')]=qs['filters'](_[_0xaab4('0x3a')](_0x1040e3[_0xaab4('0x32')],_0x25c235['filters']),_0x4e2fd1);if(_0x1040e3[_0xaab4('0x32')][_0xaab4('0x3b')]){_0x426f98['where']=_['merge'](_0x426f98[_0xaab4('0x39')],{'$or':_[_0xaab4('0x2a')](_0x4e2fd1,function(_0x5a6255){if(_0x5a6255[_0xaab4('0x2e')]!==_0xaab4('0x3c')){var _0x5a9372={};_0x5a9372[_0x5a6255[_0xaab4('0x27')]]={'$like':'%'+_0x1040e3[_0xaab4('0x32')][_0xaab4('0x3b')]+'%'};return _0x5a9372;}})});}_0x426f98=_[_0xaab4('0x3d')]({},_0x426f98,_0x1040e3[_0xaab4('0x3e')]);var _0x43c706={'where':_0x426f98['where']};return db[_0xaab4('0x2b')][_0xaab4('0x19')](_0x43c706)[_0xaab4('0x24')](function(_0x2ac1e0){_0x4bd375[_0xaab4('0x19')]=_0x2ac1e0;if(_0x1040e3[_0xaab4('0x32')][_0xaab4('0x3f')]){_0x426f98[_0xaab4('0x40')]=[{'all':!![]}];}return db[_0xaab4('0x2b')]['findAll'](_0x426f98);})[_0xaab4('0x24')](function(_0xcceca4){_0x4bd375[_0xaab4('0x41')]=_0xcceca4;return _0x4bd375;})[_0xaab4('0x24')](respondWithFilteredResult(_0x448b95,_0x426f98))[_0xaab4('0x42')](handleError(_0x448b95,null));};exports['show']=function(_0x4eca32,_0xaab06){var _0x1cc9bd={'raw':!![],'where':{'id':_0x4eca32[_0xaab4('0x43')]['id']}},_0x6d6001={};_0x6d6001[_0xaab4('0x30')]=_[_0xaab4('0x31')](db[_0xaab4('0x2b')]['rawAttributes']);_0x6d6001[_0xaab4('0x32')]=_['keys'](_0x4eca32['query']);_0x6d6001[_0xaab4('0x44')]=_['intersection'](_0x6d6001[_0xaab4('0x30')],_0x6d6001[_0xaab4('0x32')]);_0x1cc9bd['attributes']=_[_0xaab4('0x33')](_0x6d6001[_0xaab4('0x30')],qs[_0xaab4('0x35')](_0x4eca32[_0xaab4('0x32')][_0xaab4('0x35')]));_0x1cc9bd['attributes']=_0x1cc9bd[_0xaab4('0x34')][_0xaab4('0x45')]?_0x1cc9bd[_0xaab4('0x34')]:_0x6d6001[_0xaab4('0x30')];if(_0x4eca32[_0xaab4('0x32')][_0xaab4('0x3f')]){_0x1cc9bd[_0xaab4('0x40')]=[{'all':!![]}];}_0x1cc9bd=_[_0xaab4('0x3d')]({},_0x1cc9bd,_0x4eca32[_0xaab4('0x3e')]);return db[_0xaab4('0x2b')][_0xaab4('0x46')](_0x1cc9bd)[_0xaab4('0x24')](handleEntityNotFound(_0xaab06,null))[_0xaab4('0x24')](respondWithResult(_0xaab06,null))[_0xaab4('0x42')](handleError(_0xaab06,null));};exports['create']=function(_0x2faf9b,_0x28fada){return db['Pause'][_0xaab4('0x47')](_0x2faf9b[_0xaab4('0x48')],{})[_0xaab4('0x24')](function(_0x151284){var _0x1e45f6=_0x2faf9b[_0xaab4('0x49')][_0xaab4('0x21')]({'plain':!![]});if(!_0x1e45f6)throw new Error(_0xaab4('0x4a'));if(_0x1e45f6[_0xaab4('0x4b')]===_0xaab4('0x49')){var _0x14f816=_0x151284['get']({'plain':!![]});var _0x51b372='Pauses';return db[_0xaab4('0x4c')][_0xaab4('0x46')]({'where':{'name':_0x51b372,'userProfileId':_0x1e45f6[_0xaab4('0x4d')]},'raw':!![]})[_0xaab4('0x24')](function(_0x28fb4a){if(_0x28fb4a&&_0x28fb4a[_0xaab4('0x4e')]===0x0){return db[_0xaab4('0x23')][_0xaab4('0x47')]({'name':_0x14f816[_0xaab4('0x27')],'resourceId':_0x14f816['id'],'type':_0x28fb4a[_0xaab4('0x27')],'sectionId':_0x28fb4a['id']},{})[_0xaab4('0x24')](function(){return _0x151284;});}else{return _0x151284;}})[_0xaab4('0x42')](function(_0x3c8cc4){logger['error'](_0xaab4('0x4f'),_0x3c8cc4);throw _0x3c8cc4;});}return _0x151284;})[_0xaab4('0x24')](respondWithResult(_0x28fada,0xc9))[_0xaab4('0x42')](handleError(_0x28fada,null));};exports[_0xaab4('0x1f')]=function(_0x5dd18d,_0x17452c){if(_0x5dd18d[_0xaab4('0x48')]['id']){delete _0x5dd18d[_0xaab4('0x48')]['id'];}return db[_0xaab4('0x2b')][_0xaab4('0x46')]({'where':{'id':_0x5dd18d[_0xaab4('0x43')]['id']}})['then'](handleEntityNotFound(_0x17452c,null))['then'](saveUpdates(_0x5dd18d['body'],null))[_0xaab4('0x24')](respondWithResult(_0x17452c,null))[_0xaab4('0x42')](handleError(_0x17452c,null));};exports[_0xaab4('0x20')]=function(_0x461c57,_0x231372){return db[_0xaab4('0x2b')]['find']({'where':{'id':_0x461c57[_0xaab4('0x43')]['id']}})[_0xaab4('0x24')](handleEntityNotFound(_0x231372,null))[_0xaab4('0x24')](removeEntity(_0x231372,null))['catch'](handleError(_0x231372,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 273ad18..9b17cfa 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x177fc0,_0x5924d9){var _0x1319c6=function(_0x40ad4c){while(--_0x40ad4c){_0x177fc0['push'](_0x177fc0['shift']());}};_0x1319c6(++_0x5924d9);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3f28d9,_0x36e68c){_0x3f28d9=_0x3f28d9-0x0;var _0x46e11b=_0x1cb9[_0x3f28d9];return _0x46e11b;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./pause.attributes','exports','define','tools_pauses','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x55ca,0x126));var _0xa55c=function(_0x5230eb,_0x29ec8a){_0x5230eb=_0x5230eb-0x0;var _0x23e301=_0x55ca[_0x5230eb];return _0x23e301;};'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')]('Pause',attributes,{'tableName':_0xa55c('0x9'),'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 c510506..cc4e1ff 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(_0xd638af,_0x435907){var _0x5c4d93=function(_0x1f1357){while(--_0x1f1357){_0xd638af['push'](_0xd638af['shift']());}};_0x5c4d93(++_0x435907);}(_0x7a54,0x106));var _0x47a5=function(_0x4ba2f3,_0x22777c){_0x4ba2f3=_0x4ba2f3-0x0;var _0x1c5c08=_0x7a54[_0x4ba2f3];return _0x1c5c08;};'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(_0x178d2e,_0x1d09ad){var _0x2ae0c2=function(_0x1e36df){while(--_0x1e36df){_0x178d2e['push'](_0x178d2e['shift']());}};_0x2ae0c2(++_0x1d09ad);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fb930,_0x4141c4){_0x4fb930=_0x4fb930-0x0;var _0x59adc4=_0xb10b[_0x4fb930];return _0x59adc4;};'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 9879c84..7ecd263 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 _0xed1f=['basename','originalname','now','extname','single','upload','post','webhookPost','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','diskStorage','server/files/plugins','replace','format'];(function(_0x5d58c5,_0x5490d1){var _0x1650bd=function(_0x535cb2){while(--_0x535cb2){_0x5d58c5['push'](_0x5d58c5['shift']());}};_0x1650bd(++_0x5490d1);}(_0xed1f,0x6a));var _0xfed1=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xed1f[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',auth[_0xfed1('0xc')](),controller[_0xfed1('0xd')]);router[_0xfed1('0xb')](_0xfed1('0xe'),controller[_0xfed1('0xf')]);router[_0xfed1('0xb')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x10')]);router['get'](_0xfed1('0x11'),auth[_0xfed1('0xc')](),controller['download']);var upload=multer({'storage':multer[_0xfed1('0x12')]({'destination':function(_0x48c338,_0x1c3f40,_0x234f4e){_0x234f4e(null,path['join'](config['root'],_0xfed1('0x13')));},'filename':function(_0xe84ba6,_0x569a6e,_0x17f4fe){_0x569a6e['originalname']=_0x569a6e['originalname'][_0xfed1('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17f4fe(null,util[_0xfed1('0x15')]('%s-%s%s',path[_0xfed1('0x16')](_0x569a6e['originalname'],path['extname'](_0x569a6e[_0xfed1('0x17')])),Date[_0xfed1('0x18')](),path[_0xfed1('0x19')](_0x569a6e[_0xfed1('0x17')])));}})});router['post']('/',upload[_0xfed1('0x1a')]('file'),controller[_0xfed1('0x1b')]);router[_0xfed1('0x1c')]('/webhook',controller[_0xfed1('0x1d')]);router[_0xfed1('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfed1('0x1f')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xcea2=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post','single','file','upload','put','update','delete','multer','path'];(function(_0x2c8b33,_0x1fc585){var _0x471f41=function(_0x496098){while(--_0x496098){_0x2c8b33['push'](_0x2c8b33['shift']());}};_0x471f41(++_0x1fc585);}(_0xcea2,0x15a));var _0x2cea=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcea2[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller['show']);router[_0x2cea('0x9')](_0x2cea('0xd'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xe')]);var upload=multer({'storage':multer[_0x2cea('0xf')]({'destination':function(_0x439c4d,_0x4298a4,_0x1c9142){_0x1c9142(null,path['join'](config['root'],_0x2cea('0x10')));},'filename':function(_0x2db0ff,_0x528c1d,_0x4bd265){_0x528c1d[_0x2cea('0x11')]=_0x528c1d['originalname'][_0x2cea('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bd265(null,util[_0x2cea('0x13')](_0x2cea('0x14'),path['basename'](_0x528c1d['originalname'],path['extname'](_0x528c1d[_0x2cea('0x11')])),Date['now'](),path[_0x2cea('0x15')](_0x528c1d[_0x2cea('0x11')])));}})});router[_0x2cea('0x16')]('/',upload[_0x2cea('0x17')](_0x2cea('0x18')),controller[_0x2cea('0x19')]);router[_0x2cea('0x16')](_0x2cea('0xa'),controller['webhookPost']);router[_0x2cea('0x1a')](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x1b')]);router[_0x2cea('0x1c')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 8edbbb0..49593f1 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 _0x8dbd=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x1f7377,_0x57f371){var _0x70b51f=function(_0x1d0200){while(--_0x1d0200){_0x1f7377['push'](_0x1f7377['shift']());}};_0x70b51f(++_0x57f371);}(_0x8dbd,0x165));var _0xd8db=function(_0x1bc8d0,_0x5194bd){_0x1bc8d0=_0x1bc8d0-0x0;var _0x10ec49=_0x8dbd[_0x1bc8d0];return _0x10ec49;};'use strict';var Sequelize=require('sequelize');module[_0xd8db('0x0')]={'name':{'type':Sequelize[_0xd8db('0x1')]},'type':{'type':Sequelize[_0xd8db('0x2')](_0xd8db('0x3'),_0xd8db('0x4'))},'description':{'type':Sequelize[_0xd8db('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd8db('0x1')],'comment':_0xd8db('0x6')},'active':{'type':Sequelize[_0xd8db('0x7')],'defaultValue':0x0,'comment':_0xd8db('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xd8db('0x9'),_0xd8db('0xa'),_0xd8db('0xb'),_0xd8db('0xc')),'defaultValue':_0xd8db('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xd8db('0x1')]},'adminUrl':{'type':Sequelize[_0xd8db('0x1')]},'agentUrl':{'type':Sequelize[_0xd8db('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbdcf=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x4de578,_0x5ed9be){var _0x187318=function(_0x44a7a3){while(--_0x44a7a3){_0x4de578['push'](_0x4de578['shift']());}};_0x187318(++_0x5ed9be);}(_0xbdcf,0x173));var _0xfbdc=function(_0x24fa54,_0x285192){_0x24fa54=_0x24fa54-0x0;var _0x37ed66=_0xbdcf[_0x24fa54];return _0x37ed66;};'use strict';var Sequelize=require(_0xfbdc('0x0'));module[_0xfbdc('0x1')]={'name':{'type':Sequelize[_0xfbdc('0x2')]},'type':{'type':Sequelize[_0xfbdc('0x3')](_0xfbdc('0x4'),'script')},'description':{'type':Sequelize[_0xfbdc('0x5')]},'version':{'type':Sequelize[_0xfbdc('0x5')]},'path':{'type':Sequelize[_0xfbdc('0x2')],'comment':_0xfbdc('0x6')},'active':{'type':Sequelize[_0xfbdc('0x7')],'defaultValue':0x0,'comment':_0xfbdc('0x8')},'sidebar':{'type':Sequelize[_0xfbdc('0x3')](_0xfbdc('0x9'),_0xfbdc('0xa'),_0xfbdc('0xb'),_0xfbdc('0xc')),'defaultValue':_0xfbdc('0xb'),'comment':_0xfbdc('0xd')},'icon':{'type':Sequelize[_0xfbdc('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xfbdc('0x2')]},'scriptName':{'type':Sequelize[_0xfbdc('0x2')]},'scriptPath':{'type':Sequelize[_0xfbdc('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index efbb006..8c8f97a 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 _0xe5fa=['icon','icon-apps','version','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','agent','create','body','userProfileId','role','user','UserProfileSection','Plugins','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','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','statusCode','webhookPost','content-type','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','rimraf','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','download','join','root','server/files/plugins','format','%s.zip','basename','zip','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','description','sidebar','always'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xe5fa,0x186));var _0xae5f=function(_0x82fa7e,_0xd127a){_0x82fa7e=_0x82fa7e-0x0;var _0x226def=_0xe5fa[_0x82fa7e];return _0x226def;};'use strict';var emlformat=require(_0xae5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae5f('0x1'));var jsonpatch=require(_0xae5f('0x2'));var rp=require(_0xae5f('0x3'));var moment=require(_0xae5f('0x4'));var BPromise=require(_0xae5f('0x5'));var Mustache=require(_0xae5f('0x6'));var util=require(_0xae5f('0x7'));var path=require(_0xae5f('0x8'));var sox=require(_0xae5f('0x9'));var csv=require(_0xae5f('0xa'));var ejs=require(_0xae5f('0xb'));var fs=require('fs');var fs_extra=require(_0xae5f('0xc'));var _=require(_0xae5f('0xd'));var squel=require(_0xae5f('0xe'));var crypto=require(_0xae5f('0xf'));var jsforce=require(_0xae5f('0x10'));var deskjs=require(_0xae5f('0x11'));var toCsv=require(_0xae5f('0xa'));var querystring=require('querystring');var Papa=require(_0xae5f('0x12'));var extract=require(_0xae5f('0x13'));var rimraf=require(_0xae5f('0x14'));var archiver=require('archiver');var Redis=require(_0xae5f('0x15'));var authService=require(_0xae5f('0x16'));var qs=require(_0xae5f('0x17'));var as=require(_0xae5f('0x18'));var hardwareService=require(_0xae5f('0x19'));var logger=require(_0xae5f('0x1a'))(_0xae5f('0x1b'));var utils=require('../../config/utils');var config=require(_0xae5f('0x1c'));var licenseUtil=require(_0xae5f('0x1d'));var db=require(_0xae5f('0x1e'))['db'];config[_0xae5f('0x1f')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xae5f('0x20'))(new Redis(config[_0xae5f('0x1f')]));require(_0xae5f('0x21'))[_0xae5f('0x22')](socket);function respondWithStatusCode(_0x5c2534,_0x5224b2){_0x5224b2=_0x5224b2||0xcc;return function(_0x567900){if(_0x567900){return _0x5c2534[_0xae5f('0x23')](_0x5224b2);}return _0x5c2534[_0xae5f('0x24')](_0x5224b2)[_0xae5f('0x25')]();};}function respondWithResult(_0x38da87,_0x17495a){_0x17495a=_0x17495a||0xc8;return function(_0x191e9b){if(_0x191e9b){return _0x38da87[_0xae5f('0x24')](_0x17495a)[_0xae5f('0x26')](_0x191e9b);}};}function respondWithFilteredResult(_0xe949ff,_0x23b54e){return function(_0x1a238c){if(_0x1a238c){var _0x31a669=typeof _0x23b54e[_0xae5f('0x27')]===_0xae5f('0x28')&&typeof _0x23b54e['limit']===_0xae5f('0x28');var _0x4173e9=_0x1a238c[_0xae5f('0x29')];var _0x57e0fc=_0x31a669?0x0:_0x23b54e[_0xae5f('0x27')];var _0x1993dd=_0x31a669?_0x1a238c[_0xae5f('0x29')]:_0x23b54e[_0xae5f('0x27')]+_0x23b54e['limit'];var _0x55bd7c;if(_0x1993dd>=_0x4173e9){_0x1993dd=_0x4173e9;_0x55bd7c=0xc8;}else{_0x55bd7c=0xce;}_0xe949ff[_0xae5f('0x24')](_0x55bd7c);return _0xe949ff[_0xae5f('0x2a')]('Content-Range',_0x57e0fc+'-'+_0x1993dd+'/'+_0x4173e9)['json'](_0x1a238c);}return null;};}function patchUpdates(_0x7cd086){return function(_0x4c28b8){try{jsonpatch[_0xae5f('0x2b')](_0x4c28b8,_0x7cd086,!![]);}catch(_0x1db556){return BPromise[_0xae5f('0x2c')](_0x1db556);}return _0x4c28b8[_0xae5f('0x2d')]();};}function saveUpdates(_0x213a20,_0x4f4b68){return function(_0x260ea6){if(_0x260ea6){return _0x260ea6[_0xae5f('0x2e')](_0x213a20)[_0xae5f('0x2f')](function(_0x3c0053){return _0x3c0053;});}return null;};}function removeEntity(_0x537020,_0x5a500b){return function(_0x3181e0){if(_0x3181e0){return _0x3181e0[_0xae5f('0x30')]()['then'](function(){var _0x1f2ab8=_0x3181e0[_0xae5f('0x31')]({'plain':!![]});var _0x154034='Plugins';return db[_0xae5f('0x32')][_0xae5f('0x30')]({'where':{'type':_0x154034,'resourceId':_0x1f2ab8['id']}})[_0xae5f('0x2f')](function(){return _0x3181e0;});})[_0xae5f('0x2f')](function(){_0x537020[_0xae5f('0x24')](0xcc)[_0xae5f('0x25')]();});}};}function handleEntityNotFound(_0xdfb95a,_0x1feb10){return function(_0x3a4449){if(!_0x3a4449){_0xdfb95a['sendStatus'](0x194);}return _0x3a4449;};}function handleError(_0x7bca3e,_0x5d914a){_0x5d914a=_0x5d914a||0x1f4;return function(_0x20dba0){logger[_0xae5f('0x33')](_0x20dba0[_0xae5f('0x34')]);if(_0x20dba0[_0xae5f('0x35')]){delete _0x20dba0[_0xae5f('0x35')];}_0x7bca3e[_0xae5f('0x24')](_0x5d914a)[_0xae5f('0x36')](_0x20dba0);};}exports[_0xae5f('0x37')]=function(_0x52d3b5,_0x14b0e2){var _0x229b21={},_0x162854={},_0x19e6b2={'count':0x0,'rows':[]};var _0x48768d=_[_0xae5f('0x38')](db[_0xae5f('0x39')][_0xae5f('0x3a')],function(_0x388b24){return{'name':_0x388b24[_0xae5f('0x3b')],'type':_0x388b24[_0xae5f('0x3c')][_0xae5f('0x3d')]};});_0x162854[_0xae5f('0x3e')]=_[_0xae5f('0x38')](_0x48768d,'name');_0x162854[_0xae5f('0x3f')]=_[_0xae5f('0x40')](_0x52d3b5['query']);_0x162854['filters']=_['intersection'](_0x162854[_0xae5f('0x3e')],_0x162854[_0xae5f('0x3f')]);_0x229b21[_0xae5f('0x41')]=_[_0xae5f('0x42')](_0x162854[_0xae5f('0x3e')],qs[_0xae5f('0x43')](_0x52d3b5['query'][_0xae5f('0x43')]));_0x229b21['attributes']=_0x229b21[_0xae5f('0x41')]['length']?_0x229b21['attributes']:_0x162854['model'];if(!_0x52d3b5[_0xae5f('0x3f')]['hasOwnProperty'](_0xae5f('0x44'))){_0x229b21[_0xae5f('0x45')]=qs[_0xae5f('0x45')](_0x52d3b5[_0xae5f('0x3f')][_0xae5f('0x45')]);_0x229b21['offset']=qs[_0xae5f('0x27')](_0x52d3b5[_0xae5f('0x3f')][_0xae5f('0x27')]);}_0x229b21['order']=qs[_0xae5f('0x46')](_0x52d3b5[_0xae5f('0x3f')][_0xae5f('0x46')]);_0x229b21[_0xae5f('0x47')]=qs[_0xae5f('0x48')](_[_0xae5f('0x49')](_0x52d3b5[_0xae5f('0x3f')],_0x162854[_0xae5f('0x48')]),_0x48768d);if(_0x52d3b5['query'][_0xae5f('0x4a')]){_0x229b21[_0xae5f('0x47')]=_[_0xae5f('0x4b')](_0x229b21[_0xae5f('0x47')],{'$or':_[_0xae5f('0x38')](_0x48768d,function(_0x111dcf){if(_0x111dcf['type']!==_0xae5f('0x4c')){var _0x204b5e={};_0x204b5e[_0x111dcf['name']]={'$like':'%'+_0x52d3b5['query'][_0xae5f('0x4a')]+'%'};return _0x204b5e;}})});}_0x229b21=_[_0xae5f('0x4b')]({},_0x229b21,_0x52d3b5['options']);var _0x5e8220={'where':_0x229b21[_0xae5f('0x47')]};return db[_0xae5f('0x39')][_0xae5f('0x29')](_0x5e8220)[_0xae5f('0x2f')](function(_0xb9daa){_0x19e6b2[_0xae5f('0x29')]=_0xb9daa;if(_0x52d3b5['query'][_0xae5f('0x4d')]){_0x229b21[_0xae5f('0x4e')]=[{'all':!![]}];}return db[_0xae5f('0x39')][_0xae5f('0x4f')](_0x229b21);})[_0xae5f('0x2f')](function(_0x512ddb){_0x19e6b2[_0xae5f('0x50')]=_0x512ddb;return _0x19e6b2;})[_0xae5f('0x2f')](respondWithFilteredResult(_0x14b0e2,_0x229b21))[_0xae5f('0x51')](handleError(_0x14b0e2,null));};exports[_0xae5f('0x52')]=function(_0x3d8083,_0x3d1471){var _0x5a3108={'raw':!![],'where':{'id':_0x3d8083[_0xae5f('0x53')]['id']}},_0xd0e2e8={};_0xd0e2e8['model']=_[_0xae5f('0x40')](db[_0xae5f('0x39')]['rawAttributes']);_0xd0e2e8[_0xae5f('0x3f')]=_[_0xae5f('0x40')](_0x3d8083[_0xae5f('0x3f')]);_0xd0e2e8[_0xae5f('0x48')]=_[_0xae5f('0x42')](_0xd0e2e8[_0xae5f('0x3e')],_0xd0e2e8[_0xae5f('0x3f')]);_0x5a3108[_0xae5f('0x41')]=_['intersection'](_0xd0e2e8[_0xae5f('0x3e')],qs[_0xae5f('0x43')](_0x3d8083[_0xae5f('0x3f')]['fields']));_0x5a3108[_0xae5f('0x41')]=_0x5a3108[_0xae5f('0x41')][_0xae5f('0x54')]?_0x5a3108[_0xae5f('0x41')]:_0xd0e2e8[_0xae5f('0x3e')];if(_0x3d8083[_0xae5f('0x3f')][_0xae5f('0x4d')]){_0x5a3108[_0xae5f('0x4e')]=[{'all':!![]}];}_0x5a3108=_['merge']({},_0x5a3108,_0x3d8083[_0xae5f('0x55')]);return db[_0xae5f('0x39')][_0xae5f('0x56')](_0x5a3108)[_0xae5f('0x2f')](handleEntityNotFound(_0x3d1471,null))[_0xae5f('0x2f')](respondWithResult(_0x3d1471,null))['catch'](handleError(_0x3d1471,null));};exports[_0xae5f('0x57')]=function(_0x10829e,_0x2c62bf,_0x2a44cc){return db[_0xae5f('0x39')][_0xae5f('0x56')]({'where':{'id':_0x10829e[_0xae5f('0x53')]['id']},'attributes':[_0xae5f('0x35'),_0xae5f('0x8')],'raw':!![]})[_0xae5f('0x2f')](handleEntityNotFound(_0x2c62bf,null))[_0xae5f('0x2f')](function(_0x49cd11){if(_0x49cd11){var _0x236fce=path[_0xae5f('0x58')](config[_0xae5f('0x59')],_0xae5f('0x5a'),util[_0xae5f('0x5b')](_0xae5f('0x5c'),path[_0xae5f('0x5d')](_0x49cd11[_0xae5f('0x8')])));var _0x138bd7=fs['createWriteStream'](_0x236fce);var _0x2c1907=archiver(_0xae5f('0x5e'),{'zlib':{'level':0x9}});_0x2c1907['on']('warning',function(_0x33e90f){if(_0x33e90f['code']==='ENOENT'){logger[_0xae5f('0x33')](_0x33e90f);}else{throw new db[(_0xae5f('0x5f'))][(_0xae5f('0x60'))](_0xae5f('0x61'));}});_0x2c1907['on'](_0xae5f('0x33'),function(_0x1be7df){throw new db[(_0xae5f('0x5f'))][(_0xae5f('0x60'))](_0xae5f('0x61'));});_0x2c1907[_0xae5f('0x62')](_0x138bd7);_0x2c1907[_0xae5f('0x63')](_0xae5f('0x64'),{'cwd':path[_0xae5f('0x58')](config[_0xae5f('0x59')],_0xae5f('0x5a'),path[_0xae5f('0x65')](_0x49cd11[_0xae5f('0x8')])),'ignore':[path[_0xae5f('0x58')](path['basename'](_0x49cd11[_0xae5f('0x8')]),_0xae5f('0x66')),path[_0xae5f('0x58')](path[_0xae5f('0x5d')](_0x49cd11['path']),_0xae5f('0x67'))],'nodir':!![]})[_0xae5f('0x68')]();_0x138bd7['on']('close',function(){if(!fs[_0xae5f('0x69')](_0x236fce)){throw new db['Sequelize'][(_0xae5f('0x60'))](_0xae5f('0x6a'));}return _0x2c62bf[_0xae5f('0x57')](_0x236fce,util[_0xae5f('0x5b')](_0xae5f('0x5c'),path['basename'](_0x49cd11[_0xae5f('0x8')])),function(_0x592547){if(_0x592547){throw new db[(_0xae5f('0x5f'))][(_0xae5f('0x60'))](_0xae5f('0x6b'));}fs[_0xae5f('0x6c')](_0x236fce);logger[_0xae5f('0x6d')](_0xae5f('0x6e'));logger['info'](_0xae5f('0x6f'));});});}return null;})[_0xae5f('0x51')](handleError(_0x2c62bf,null));};exports[_0xae5f('0x70')]=function(_0x4ed85d,_0x3da1e5,_0x4de929){var _0x148793=path['basename'](_0x4ed85d['file'][_0xae5f('0x71')],path[_0xae5f('0x72')](_0x4ed85d[_0xae5f('0x73')]['filename']));var _0x32a0a5=path[_0xae5f('0x58')](config['root'],_0xae5f('0x5a'),_0x4ed85d[_0xae5f('0x73')][_0xae5f('0x71')]);var _0x1de721=path[_0xae5f('0x58')](config['root'],_0xae5f('0x5a'),_0x148793);logger[_0xae5f('0x6d')](_0xae5f('0x74'),_0x32a0a5);logger[_0xae5f('0x6d')]('Plugin\x20upload\x20destination:\x20%s',_0x1de721);try{fs[_0xae5f('0x75')](_0x32a0a5,parseInt(_0xae5f('0x76'),0x8));extract(_0x32a0a5,{'dir':_0x1de721},function(_0x37c89a){if(_0x37c89a){logger[_0xae5f('0x33')](_0x37c89a);handleError(_0x37c89a,!![]);};var _0x5ac0b9=fs['readdirSync'](_0x1de721);if(_0x5ac0b9[_0xae5f('0x54')]>0x1){removeReferences(_0x32a0a5,_0x1de721);logger[_0xae5f('0x33')](_0xae5f('0x77'));return _0x4de929(new Error(_0xae5f('0x77')));}var _0x401352=fs[_0xae5f('0x78')](path[_0xae5f('0x58')](_0x1de721,_0x5ac0b9[0x0]));if(_0x401352[_0xae5f('0x79')]()){removeReferences(_0x32a0a5,_0x1de721);logger[_0xae5f('0x33')]('Invalid\x20plugin\x20structure');return _0x4de929(new Error('Invalid\x20plugin\x20structure'));}if(_0x401352[_0xae5f('0x7a')]()){var _0x1e7b23=fs[_0xae5f('0x7b')](path[_0xae5f('0x58')](_0x1de721,_0x5ac0b9[0x0]));if(_0x1e7b23[_0xae5f('0x54')]===0x0){removeReferences(_0x32a0a5,_0x1de721);logger['error'](_0xae5f('0x77'));return _0x4de929(new Error(_0xae5f('0x77')));}var _0x5b2380=_0x1e7b23[_0xae5f('0x7c')](function(_0x423f6e){return _0x423f6e===_0xae5f('0x7d');});if(!_0x5b2380){return _0x4de929(new Error(_0xae5f('0x7e')));}var _0x55497f=fs[_0xae5f('0x7f')](path[_0xae5f('0x58')](_0x1de721,_0x5ac0b9[0x0],_0xae5f('0x7d')));var _0x187ada=JSON[_0xae5f('0x80')](_0x55497f);if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x35')]){return _0x4de929(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x187ada[_0xae5f('0x3c')]){return _0x4de929(new Error(_0xae5f('0x81')));}if(_0xae5f('0x28')==typeof _0x187ada['version']){return _0x4de929(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')]){return _0x4de929(new Error(_0xae5f('0x83')));}if(_0x187ada[_0xae5f('0x3c')]===_0xae5f('0x84')){if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]){return _0x4de929(new Error(_0xae5f('0x86')));}if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')][_0xae5f('0x87')]&&_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]['agent']){return _0x4de929(new Error(_0xae5f('0x88')));}}else if(_0x187ada['type']===_0xae5f('0x89')){if(_0xae5f('0x28')==typeof _0x187ada['parameters'][_0xae5f('0x8a')]){return _0x4de929(new Error(_0xae5f('0x8b')));}if(_0xae5f('0x28')==typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x8c')]){return _0x4de929(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4de929(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x4ec848=_0x187ada[_0xae5f('0x35')];var _0x20518d=_0x187ada[_0xae5f('0x8d')];var _0x55e0d2=_0x187ada[_0xae5f('0x3c')];var _0x4bcec0=_0x187ada[_0xae5f('0x8e')]?_0x187ada[_0xae5f('0x8e')]:_0xae5f('0x8f');var _0x3959c5=_0x187ada[_0xae5f('0x90')]?_0x187ada['icon']:_0xae5f('0x91');var _0xee8b72='';var _0x6267b1='';var _0x5e6d90='';var _0x5c8232='';var _0x3f69dd=_0x187ada[_0xae5f('0x92')];if(_0x55e0d2===_0xae5f('0x84')){if(_0xae5f('0x28')!=typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')][_0xae5f('0x87')]){var _0x34d1af=_0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x34d1af)){_0xee8b72=path[_0xae5f('0x58')]('plugins',_0x148793,_0x5ac0b9[0x0],_0x34d1af);}else{_0xee8b72=_0x34d1af;}}else{logger[_0xae5f('0x6d')](_0xae5f('0x93'));}if(_0xae5f('0x28')!=typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]['agent']){var _0x4f08c4=_0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xae5f('0x94')](_0x4f08c4)){_0x6267b1=path[_0xae5f('0x58')](_0xae5f('0x95'),_0x148793,_0x5ac0b9[0x0],_0x4f08c4);}else{_0x6267b1=_0x4f08c4;}}else{logger[_0xae5f('0x6d')](_0xae5f('0x96'));}}else if(_0x55e0d2===_0xae5f('0x89')){_0x5e6d90=_0x187ada[_0xae5f('0x82')][_0xae5f('0x8a')];_0x5c8232=_0x187ada[_0xae5f('0x82')][_0xae5f('0x8c')];if('undefined'!=typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')]){if(_0xae5f('0x28')!=typeof _0x187ada['parameters'][_0xae5f('0x85')][_0xae5f('0x87')]){var _0x34d1af=_0x187ada['parameters'][_0xae5f('0x85')][_0xae5f('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x34d1af)){_0xee8b72=path[_0xae5f('0x58')]('plugins',_0x148793,_0x5ac0b9[0x0],_0x34d1af);}else{_0xee8b72=_0x34d1af;}}if(_0xae5f('0x28')!=typeof _0x187ada[_0xae5f('0x82')][_0xae5f('0x85')][_0xae5f('0x97')]){var _0x4f08c4=_0x187ada[_0xae5f('0x82')][_0xae5f('0x85')][_0xae5f('0x97')];if(!/^(f|ht)tps?:\/\//i[_0xae5f('0x94')](_0x4f08c4)){_0x6267b1=path[_0xae5f('0x58')](_0xae5f('0x95'),_0x148793,_0x5ac0b9[0x0],_0x4f08c4);}else{_0x6267b1=_0x4f08c4;}}}}var _0x2ec1c4={'name':_0x4ec848,'description':_0x20518d,'path':path[_0xae5f('0x58')](_0x148793,_0x5ac0b9[0x0]),'type':_0x55e0d2,'sidebar':_0x4bcec0,'icon':_0x3959c5,'adminUrl':_0xee8b72,'agentUrl':_0x6267b1,'scriptName':_0x5e6d90,'scriptPath':_0x5c8232,'version':_0x3f69dd};removeReferences(_0x32a0a5,null);return db['Plugin'][_0xae5f('0x98')](_0x2ec1c4)[_0xae5f('0x2f')](function(_0x7a94f6){var _0x8ab6c8={'role':_0x4ed85d['body']['role'],'userProfileId':_0x4ed85d[_0xae5f('0x99')][_0xae5f('0x9a')]};if(!_0x8ab6c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8ab6c8[_0xae5f('0x9b')]===_0xae5f('0x9c')){var _0x5e5b19=_0x7a94f6['get']({'plain':!![]});return db[_0xae5f('0x9d')][_0xae5f('0x56')]({'where':{'name':_0xae5f('0x9e'),'userProfileId':_0x8ab6c8[_0xae5f('0x9a')]},'raw':!![]})[_0xae5f('0x2f')](function(_0x47b694){if(_0x47b694&&_0x47b694['autoAssociation']===0x0){return db[_0xae5f('0x32')][_0xae5f('0x98')]({'name':_0x5e5b19[_0xae5f('0x35')],'resourceId':_0x5e5b19['id'],'type':_0x47b694[_0xae5f('0x35')],'sectionId':_0x47b694['id']},{})[_0xae5f('0x2f')](function(){return _0x7a94f6;});}else{return _0x7a94f6;}})[_0xae5f('0x51')](function(_0x3e9396){logger[_0xae5f('0x33')](_0xae5f('0x9f'),_0x3e9396);throw _0x3e9396;});}return _0x7a94f6;})[_0xae5f('0x2f')](respondWithResult(_0x3da1e5,null))['catch'](handleError(_0x3da1e5,null));}});}catch(_0x2a086b){_0x3da1e5['status'](0x1f4)[_0xae5f('0x36')](_0x2a086b);}};function removeReferences(_0x500b56,_0xc1fc7b){try{if(_0x500b56){fs[_0xae5f('0x6c')](_0x500b56);logger[_0xae5f('0x6d')](_0xae5f('0xa0'));}if(_0xc1fc7b){rimraf(_0xc1fc7b,function(){});logger[_0xae5f('0x6d')](_0xae5f('0xa1'));}}catch(_0x5e4b8e){logger[_0xae5f('0x33')](_0x5e4b8e);}}exports[_0xae5f('0x2e')]=function(_0x4c1400,_0x174d3c,_0x3af222){return db[_0xae5f('0x39')][_0xae5f('0x56')]({'where':{'id':_0x4c1400['params']['id']}})[_0xae5f('0x2f')](handleEntityNotFound(_0x174d3c,null))['then'](saveUpdates(_0x4c1400[_0xae5f('0x99')],null))[_0xae5f('0x2f')](respondWithResult(_0x174d3c,null))[_0xae5f('0x51')](handleError(_0x174d3c,null));};exports[_0xae5f('0xa2')]=function(_0x3542b9,_0x54d38e,_0x385bc7){return db[_0xae5f('0x39')]['find']({'where':{'id':_0x3542b9[_0xae5f('0x53')]['id']}})[_0xae5f('0x2f')](function(_0x35e3cd){if(_0x35e3cd){return _0x35e3cd[_0xae5f('0x30')]();}})['then'](function(_0x5c424e){rimraf(path[_0xae5f('0x58')](config[_0xae5f('0x59')],_0xae5f('0x5a'),path[_0xae5f('0x65')](_0x5c424e[_0xae5f('0x8')])),function(){});return _0x5c424e;})[_0xae5f('0x2f')](handleEntityNotFound(_0x54d38e,null))[_0xae5f('0x2f')](respondWithStatusCode(_0x54d38e,null))[_0xae5f('0x51')](handleError(_0x54d38e,null));};exports[_0xae5f('0xa3')]=function(_0x50bcfa,_0x721cf3,_0x5d59ef){return BPromise[_0xae5f('0xa4')]()['then'](function(){if(!_0x50bcfa[_0xae5f('0x3f')][_0xae5f('0x8')]){throw new Error(_0xae5f('0xa5'));}if(!_0x50bcfa[_0xae5f('0x3f')][_0xae5f('0xa6')]){throw new Error(_0xae5f('0xa7'));}var _0x1feba7=_0x50bcfa['query'][_0xae5f('0xa8')]?_0x50bcfa['query'][_0xae5f('0xa8')]+':'+_0x50bcfa[_0xae5f('0x3f')][_0xae5f('0xa6')]:_0xae5f('0xa9')+_0x50bcfa['query']['port'];var _0x5636ac=_0x50bcfa['query'][_0xae5f('0x26')]?_0x50bcfa[_0xae5f('0x3f')]['json']:!![];var _0x522d65=_0x50bcfa['query'][_0xae5f('0xaa')]?_0x50bcfa[_0xae5f('0x3f')][_0xae5f('0xaa')]:null;var _0x1e857c={'method':_0x50bcfa[_0xae5f('0xab')],'uri':util[_0xae5f('0x5b')](_0xae5f('0xac'),_0x1feba7,_0x50bcfa['query']['path']),'json':_0x5636ac,'resolveWithFullResponse':!![],'encoding':_0x522d65,'qs':_0x50bcfa[_0xae5f('0x3f')]};if(_0x50bcfa[_0xae5f('0xad')]){_0x1e857c[_0xae5f('0xad')]=_0x50bcfa[_0xae5f('0xad')];if(_0x1e857c[_0xae5f('0xad')]['content-length']){delete _0x1e857c[_0xae5f('0xad')][_0xae5f('0xae')];}}if(_0x1e857c['headers']['content-type']){delete _0x1e857c[_0xae5f('0xad')]['content-type'];}return rp(_0x1e857c);})['then'](function(_0x31b818){if(_0x31b818){_0x721cf3[_0xae5f('0x2a')](_0x31b818[_0xae5f('0xad')]);logger[_0xae5f('0x6d')](_0x31b818['body']);if(_['endsWith'](_0x50bcfa['query']['path'],_0xae5f('0x57'))&&_0x31b818['statusCode']==0x1f4){return _0x721cf3[_0xae5f('0x23')](_0x31b818[_0xae5f('0xaf')]);}else{return _0x721cf3['status'](_0x31b818[_0xae5f('0xaf')])['send'](_0x31b818[_0xae5f('0x99')]);}}else{return _0x721cf3['sendStatus'](0xc8);}})[_0xae5f('0x51')](handleError(_0x721cf3,null));};exports[_0xae5f('0xb0')]=function(_0x4c2290,_0xd17a9,_0x3f52f0){return BPromise[_0xae5f('0xa4')]()['then'](function(){if(!_0x4c2290['query'][_0xae5f('0x8')]){throw new Error(_0xae5f('0xa5'));}if(!_0x4c2290[_0xae5f('0x3f')][_0xae5f('0xa6')]){throw new Error(_0xae5f('0xa7'));}var _0x21c045=_0x4c2290[_0xae5f('0x3f')][_0xae5f('0xa8')]?_0x4c2290[_0xae5f('0x3f')]['hostname']+':'+_0x4c2290[_0xae5f('0x3f')][_0xae5f('0xa6')]:_0xae5f('0xa9')+_0x4c2290['query'][_0xae5f('0xa6')];var _0x56c273=_0x4c2290[_0xae5f('0x3f')][_0xae5f('0x26')]?_0x4c2290[_0xae5f('0x3f')][_0xae5f('0x26')]:!![];var _0x39c80d=_0x4c2290[_0xae5f('0x3f')][_0xae5f('0xaa')]?_0x4c2290['query'][_0xae5f('0xaa')]:null;var _0x3f86d8={'method':_0x4c2290[_0xae5f('0xab')],'uri':util['format'](_0xae5f('0xac'),_0x21c045,_0x4c2290[_0xae5f('0x3f')]['path']),'json':_0x56c273,'resolveWithFullResponse':!![],'encoding':_0x39c80d,'body':_0x4c2290[_0xae5f('0x99')]};if(_0x4c2290['headers']){_0x3f86d8[_0xae5f('0xad')]=_0x4c2290[_0xae5f('0xad')];if(_0x3f86d8[_0xae5f('0xad')][_0xae5f('0xae')]){delete _0x3f86d8[_0xae5f('0xad')][_0xae5f('0xae')];}}if(_0x3f86d8[_0xae5f('0xad')][_0xae5f('0xb1')]){delete _0x3f86d8[_0xae5f('0xad')]['content-type'];}return rp(_0x3f86d8);})[_0xae5f('0x2f')](function(_0x6b19da){if(_0x6b19da){_0xd17a9[_0xae5f('0x2a')](_0x6b19da['headers']);logger['info'](_0x6b19da[_0xae5f('0x99')]);return _0xd17a9['status'](_0x6b19da[_0xae5f('0xaf')])['send'](_0x6b19da[_0xae5f('0x99')]);}else{return _0xd17a9[_0xae5f('0x23')](0xc8);}})['catch'](handleError(_0xd17a9,null));}; \ No newline at end of file +var _0x67df=['to-csv','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','get','Plugins','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','options','Plugin','includeAll','include','findAll','catch','show','params','keys','merge','find','download','path','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','node_modules/**/*','attachments/**/*','finalize','existsSync','Download\x20completed','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','Plugin\x20manifest\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','sidebar','always','icon','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Extracted\x20folder\x20removed','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x248cfc,_0x4876d0){var _0x98d945=function(_0x5a5bd8){while(--_0x5a5bd8){_0x248cfc['push'](_0x248cfc['shift']());}};_0x98d945(++_0x4876d0);}(_0x67df,0x1ee));var _0xf67d=function(_0x5252b6,_0x110cc0){_0x5252b6=_0x5252b6-0x0;var _0x1f6983=_0x67df[_0x5252b6];return _0x1f6983;};'use strict';var emlformat=require(_0xf67d('0x0'));var rimraf=require(_0xf67d('0x1'));var zipdir=require(_0xf67d('0x2'));var jsonpatch=require(_0xf67d('0x3'));var rp=require(_0xf67d('0x4'));var moment=require(_0xf67d('0x5'));var BPromise=require(_0xf67d('0x6'));var Mustache=require(_0xf67d('0x7'));var util=require(_0xf67d('0x8'));var path=require('path');var sox=require(_0xf67d('0x9'));var csv=require('to-csv');var ejs=require(_0xf67d('0xa'));var fs=require('fs');var fs_extra=require(_0xf67d('0xb'));var _=require(_0xf67d('0xc'));var squel=require(_0xf67d('0xd'));var crypto=require(_0xf67d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf67d('0xf'));var toCsv=require(_0xf67d('0x10'));var querystring=require(_0xf67d('0x11'));var Papa=require(_0xf67d('0x12'));var extract=require(_0xf67d('0x13'));var rimraf=require('rimraf');var archiver=require(_0xf67d('0x14'));var Redis=require('ioredis');var authService=require(_0xf67d('0x15'));var qs=require(_0xf67d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf67d('0x17'))('api');var utils=require(_0xf67d('0x18'));var config=require(_0xf67d('0x19'));var licenseUtil=require(_0xf67d('0x1a'));var db=require(_0xf67d('0x1b'))['db'];config['redis']=_[_0xf67d('0x1c')](config[_0xf67d('0x1d')],{'host':_0xf67d('0x1e'),'port':0x18eb});var socket=require(_0xf67d('0x1f'))(new Redis(config[_0xf67d('0x1d')]));require(_0xf67d('0x20'))[_0xf67d('0x21')](socket);function respondWithStatusCode(_0x5d12b8,_0x52d677){_0x52d677=_0x52d677||0xcc;return function(_0x43bcf2){if(_0x43bcf2){return _0x5d12b8[_0xf67d('0x22')](_0x52d677);}return _0x5d12b8[_0xf67d('0x23')](_0x52d677)[_0xf67d('0x24')]();};}function respondWithResult(_0xedd078,_0x294ed7){_0x294ed7=_0x294ed7||0xc8;return function(_0x10ac66){if(_0x10ac66){return _0xedd078[_0xf67d('0x23')](_0x294ed7)[_0xf67d('0x25')](_0x10ac66);}};}function respondWithFilteredResult(_0x403906,_0x181b7f){return function(_0x4cd87c){if(_0x4cd87c){var _0x5c435f=typeof _0x181b7f['offset']===_0xf67d('0x26')&&typeof _0x181b7f[_0xf67d('0x27')]===_0xf67d('0x26');var _0x385494=_0x4cd87c[_0xf67d('0x28')];var _0x3c0943=_0x5c435f?0x0:_0x181b7f[_0xf67d('0x29')];var _0x1f3154=_0x5c435f?_0x4cd87c[_0xf67d('0x28')]:_0x181b7f[_0xf67d('0x29')]+_0x181b7f[_0xf67d('0x27')];var _0x18d66f;if(_0x1f3154>=_0x385494){_0x1f3154=_0x385494;_0x18d66f=0xc8;}else{_0x18d66f=0xce;}_0x403906[_0xf67d('0x23')](_0x18d66f);return _0x403906['set'](_0xf67d('0x2a'),_0x3c0943+'-'+_0x1f3154+'/'+_0x385494)['json'](_0x4cd87c);}return null;};}function patchUpdates(_0x59536d){return function(_0x499c27){try{jsonpatch['apply'](_0x499c27,_0x59536d,!![]);}catch(_0x293217){return BPromise[_0xf67d('0x2b')](_0x293217);}return _0x499c27['save']();};}function saveUpdates(_0x35f1ff,_0x2e8a73){return function(_0x5470ba){if(_0x5470ba){return _0x5470ba[_0xf67d('0x2c')](_0x35f1ff)[_0xf67d('0x2d')](function(_0x3c6867){return _0x3c6867;});}return null;};}function removeEntity(_0x28bd0c,_0x24705d){return function(_0x1f89b0){if(_0x1f89b0){return _0x1f89b0['destroy']()[_0xf67d('0x2d')](function(){var _0x33b06a=_0x1f89b0[_0xf67d('0x2e')]({'plain':!![]});var _0x845126=_0xf67d('0x2f');return db[_0xf67d('0x30')][_0xf67d('0x31')]({'where':{'type':_0x845126,'resourceId':_0x33b06a['id']}})[_0xf67d('0x2d')](function(){return _0x1f89b0;});})[_0xf67d('0x2d')](function(){_0x28bd0c[_0xf67d('0x23')](0xcc)[_0xf67d('0x24')]();});}};}function handleEntityNotFound(_0xaad494,_0x37595c){return function(_0x4c3142){if(!_0x4c3142){_0xaad494[_0xf67d('0x22')](0x194);}return _0x4c3142;};}function handleError(_0x2c47dc,_0x3483e5){_0x3483e5=_0x3483e5||0x1f4;return function(_0x1ce266){logger[_0xf67d('0x32')](_0x1ce266[_0xf67d('0x33')]);if(_0x1ce266[_0xf67d('0x34')]){delete _0x1ce266[_0xf67d('0x34')];}_0x2c47dc[_0xf67d('0x23')](_0x3483e5)[_0xf67d('0x35')](_0x1ce266);};}exports[_0xf67d('0x36')]=function(_0x33185e,_0x530e19){var _0x41c11c={},_0x5b0f48={},_0x521a1e={'count':0x0,'rows':[]};var _0x5ef97f=_[_0xf67d('0x37')](db['Plugin'][_0xf67d('0x38')],function(_0x14fcab){return{'name':_0x14fcab[_0xf67d('0x39')],'type':_0x14fcab[_0xf67d('0x3a')][_0xf67d('0x3b')]};});_0x5b0f48['model']=_[_0xf67d('0x37')](_0x5ef97f,'name');_0x5b0f48[_0xf67d('0x3c')]=_['keys'](_0x33185e[_0xf67d('0x3c')]);_0x5b0f48[_0xf67d('0x3d')]=_[_0xf67d('0x3e')](_0x5b0f48[_0xf67d('0x3f')],_0x5b0f48[_0xf67d('0x3c')]);_0x41c11c[_0xf67d('0x40')]=_['intersection'](_0x5b0f48[_0xf67d('0x3f')],qs[_0xf67d('0x41')](_0x33185e[_0xf67d('0x3c')][_0xf67d('0x41')]));_0x41c11c[_0xf67d('0x40')]=_0x41c11c['attributes'][_0xf67d('0x42')]?_0x41c11c[_0xf67d('0x40')]:_0x5b0f48[_0xf67d('0x3f')];if(!_0x33185e[_0xf67d('0x3c')]['hasOwnProperty'](_0xf67d('0x43'))){_0x41c11c[_0xf67d('0x27')]=qs[_0xf67d('0x27')](_0x33185e['query']['limit']);_0x41c11c[_0xf67d('0x29')]=qs[_0xf67d('0x29')](_0x33185e[_0xf67d('0x3c')][_0xf67d('0x29')]);}_0x41c11c[_0xf67d('0x44')]=qs[_0xf67d('0x45')](_0x33185e[_0xf67d('0x3c')][_0xf67d('0x45')]);_0x41c11c[_0xf67d('0x46')]=qs['filters'](_[_0xf67d('0x47')](_0x33185e[_0xf67d('0x3c')],_0x5b0f48[_0xf67d('0x3d')]),_0x5ef97f);if(_0x33185e[_0xf67d('0x3c')][_0xf67d('0x48')]){_0x41c11c[_0xf67d('0x46')]=_['merge'](_0x41c11c[_0xf67d('0x46')],{'$or':_[_0xf67d('0x37')](_0x5ef97f,function(_0x5de902){if(_0x5de902[_0xf67d('0x3a')]!=='VIRTUAL'){var _0x53c298={};_0x53c298[_0x5de902['name']]={'$like':'%'+_0x33185e['query'][_0xf67d('0x48')]+'%'};return _0x53c298;}})});}_0x41c11c=_['merge']({},_0x41c11c,_0x33185e[_0xf67d('0x49')]);var _0x59121d={'where':_0x41c11c[_0xf67d('0x46')]};return db[_0xf67d('0x4a')][_0xf67d('0x28')](_0x59121d)[_0xf67d('0x2d')](function(_0x9b646b){_0x521a1e[_0xf67d('0x28')]=_0x9b646b;if(_0x33185e['query'][_0xf67d('0x4b')]){_0x41c11c[_0xf67d('0x4c')]=[{'all':!![]}];}return db[_0xf67d('0x4a')][_0xf67d('0x4d')](_0x41c11c);})[_0xf67d('0x2d')](function(_0x1bf7a5){_0x521a1e['rows']=_0x1bf7a5;return _0x521a1e;})[_0xf67d('0x2d')](respondWithFilteredResult(_0x530e19,_0x41c11c))[_0xf67d('0x4e')](handleError(_0x530e19,null));};exports[_0xf67d('0x4f')]=function(_0x380f86,_0x9e8369){var _0x4631eb={'raw':!![],'where':{'id':_0x380f86[_0xf67d('0x50')]['id']}},_0x522c30={};_0x522c30[_0xf67d('0x3f')]=_[_0xf67d('0x51')](db['Plugin'][_0xf67d('0x38')]);_0x522c30[_0xf67d('0x3c')]=_['keys'](_0x380f86['query']);_0x522c30[_0xf67d('0x3d')]=_[_0xf67d('0x3e')](_0x522c30[_0xf67d('0x3f')],_0x522c30[_0xf67d('0x3c')]);_0x4631eb[_0xf67d('0x40')]=_[_0xf67d('0x3e')](_0x522c30[_0xf67d('0x3f')],qs[_0xf67d('0x41')](_0x380f86[_0xf67d('0x3c')][_0xf67d('0x41')]));_0x4631eb[_0xf67d('0x40')]=_0x4631eb[_0xf67d('0x40')]['length']?_0x4631eb['attributes']:_0x522c30[_0xf67d('0x3f')];if(_0x380f86['query'][_0xf67d('0x4b')]){_0x4631eb[_0xf67d('0x4c')]=[{'all':!![]}];}_0x4631eb=_[_0xf67d('0x52')]({},_0x4631eb,_0x380f86[_0xf67d('0x49')]);return db[_0xf67d('0x4a')][_0xf67d('0x53')](_0x4631eb)[_0xf67d('0x2d')](handleEntityNotFound(_0x9e8369,null))[_0xf67d('0x2d')](respondWithResult(_0x9e8369,null))[_0xf67d('0x4e')](handleError(_0x9e8369,null));};exports[_0xf67d('0x54')]=function(_0x3397b9,_0x5c8bd7,_0x4ec5f9){return db[_0xf67d('0x4a')]['find']({'where':{'id':_0x3397b9[_0xf67d('0x50')]['id']},'attributes':[_0xf67d('0x34'),_0xf67d('0x55')],'raw':!![]})[_0xf67d('0x2d')](handleEntityNotFound(_0x5c8bd7,null))[_0xf67d('0x2d')](function(_0x466797){if(_0x466797){var _0x359804=path[_0xf67d('0x56')](config['root'],_0xf67d('0x57'),util[_0xf67d('0x58')](_0xf67d('0x59'),path[_0xf67d('0x5a')](_0x466797['path'])));var _0x53f2ea=fs[_0xf67d('0x5b')](_0x359804);var _0x4bd623=archiver(_0xf67d('0x5c'),{'zlib':{'level':0x9}});_0x4bd623['on']('warning',function(_0x2eb736){if(_0x2eb736['code']===_0xf67d('0x5d')){logger[_0xf67d('0x32')](_0x2eb736);}else{throw new db[(_0xf67d('0x5e'))][(_0xf67d('0x5f'))](_0xf67d('0x60'));}});_0x4bd623['on'](_0xf67d('0x32'),function(_0x28f149){throw new db[(_0xf67d('0x5e'))][(_0xf67d('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4bd623[_0xf67d('0x61')](_0x53f2ea);_0x4bd623[_0xf67d('0x62')](_0xf67d('0x63'),{'cwd':path[_0xf67d('0x56')](config[_0xf67d('0x64')],_0xf67d('0x57'),path['dirname'](_0x466797[_0xf67d('0x55')])),'ignore':[path['join'](path[_0xf67d('0x5a')](_0x466797[_0xf67d('0x55')]),_0xf67d('0x65')),path[_0xf67d('0x56')](path[_0xf67d('0x5a')](_0x466797[_0xf67d('0x55')]),_0xf67d('0x66'))],'nodir':!![]})[_0xf67d('0x67')]();_0x53f2ea['on']('close',function(){if(!fs[_0xf67d('0x68')](_0x359804)){throw new db[(_0xf67d('0x5e'))][(_0xf67d('0x5f'))]('Plugin\x20not\x20found');}return _0x5c8bd7[_0xf67d('0x54')](_0x359804,util[_0xf67d('0x58')](_0xf67d('0x59'),path[_0xf67d('0x5a')](_0x466797['path'])),function(_0x1df08a){if(_0x1df08a){throw new db[(_0xf67d('0x5e'))][(_0xf67d('0x5f'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x359804);logger['info'](_0xf67d('0x69'));logger[_0xf67d('0x6a')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x5c8bd7,null));};exports[_0xf67d('0x6b')]=function(_0x3de5a6,_0x25dc27,_0x4f46fd){var _0x4f0336=path[_0xf67d('0x5a')](_0x3de5a6[_0xf67d('0x6c')][_0xf67d('0x6d')],path['extname'](_0x3de5a6[_0xf67d('0x6c')]['filename']));var _0x2ad59a=path[_0xf67d('0x56')](config[_0xf67d('0x64')],_0xf67d('0x57'),_0x3de5a6[_0xf67d('0x6c')][_0xf67d('0x6d')]);var _0x3e9fdb=path[_0xf67d('0x56')](config['root'],_0xf67d('0x57'),_0x4f0336);logger[_0xf67d('0x6a')](_0xf67d('0x6e'),_0x2ad59a);logger[_0xf67d('0x6a')](_0xf67d('0x6f'),_0x3e9fdb);try{fs[_0xf67d('0x70')](_0x2ad59a,parseInt(_0xf67d('0x71'),0x8));extract(_0x2ad59a,{'dir':_0x3e9fdb},function(_0x1630a0){if(_0x1630a0){logger[_0xf67d('0x32')](_0x1630a0);handleError(_0x1630a0,!![]);};var _0xc5768b=fs[_0xf67d('0x72')](_0x3e9fdb);if(_0xc5768b['length']>0x1){removeReferences(_0x2ad59a,_0x3e9fdb);logger[_0xf67d('0x32')](_0xf67d('0x73'));return _0x4f46fd(new Error(_0xf67d('0x73')));}var _0x516a35=fs[_0xf67d('0x74')](path[_0xf67d('0x56')](_0x3e9fdb,_0xc5768b[0x0]));if(_0x516a35['isFile']()){removeReferences(_0x2ad59a,_0x3e9fdb);logger[_0xf67d('0x32')](_0xf67d('0x73'));return _0x4f46fd(new Error(_0xf67d('0x73')));}if(_0x516a35[_0xf67d('0x75')]()){var _0x4daf67=fs[_0xf67d('0x72')](path['join'](_0x3e9fdb,_0xc5768b[0x0]));if(_0x4daf67['length']===0x0){removeReferences(_0x2ad59a,_0x3e9fdb);logger[_0xf67d('0x32')]('Invalid\x20plugin\x20structure');return _0x4f46fd(new Error(_0xf67d('0x73')));}var _0x362b74=_0x4daf67['some'](function(_0x189d5f){return _0x189d5f===_0xf67d('0x76');});if(!_0x362b74){return _0x4f46fd(new Error(_0xf67d('0x77')));}var _0x3758c1=fs['readFileSync'](path[_0xf67d('0x56')](_0x3e9fdb,_0xc5768b[0x0],_0xf67d('0x76')));var _0x117611=JSON['parse'](_0x3758c1);if(_0xf67d('0x26')==typeof _0x117611[_0xf67d('0x34')]){return _0x4f46fd(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x117611[_0xf67d('0x3a')]){return _0x4f46fd(new Error(_0xf67d('0x78')));}if('undefined'==typeof _0x117611[_0xf67d('0x79')]){return _0x4f46fd(new Error(_0xf67d('0x7a')));}if(_0xf67d('0x26')==typeof _0x117611['parameters']){return _0x4f46fd(new Error(_0xf67d('0x7b')));}if(_0x117611[_0xf67d('0x3a')]===_0xf67d('0x7c')){if('undefined'==typeof _0x117611[_0xf67d('0x7d')]['views']){return _0x4f46fd(new Error(_0xf67d('0x7e')));}if(_0xf67d('0x26')==typeof _0x117611[_0xf67d('0x7d')][_0xf67d('0x7f')]['admin']&&'undefined'==typeof _0x117611[_0xf67d('0x7d')][_0xf67d('0x7f')][_0xf67d('0x80')]){return _0x4f46fd(new Error(_0xf67d('0x81')));}}else if(_0x117611[_0xf67d('0x3a')]===_0xf67d('0x82')){if(_0xf67d('0x26')==typeof _0x117611[_0xf67d('0x7d')][_0xf67d('0x83')]){return _0x4f46fd(new Error(_0xf67d('0x84')));}if(_0xf67d('0x26')==typeof _0x117611['parameters'][_0xf67d('0x85')]){return _0x4f46fd(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4f46fd(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xaad048=_0x117611[_0xf67d('0x34')];var _0x448607=_0x117611['description'];var _0xec5600=_0x117611[_0xf67d('0x3a')];var _0x5578dc=_0x117611['sidebar']?_0x117611[_0xf67d('0x86')]:_0xf67d('0x87');var _0x1faa8c=_0x117611['icon']?_0x117611[_0xf67d('0x88')]:'icon-apps';var _0x284648='';var _0x51bc39='';var _0x472067='';var _0x3521a0='';var _0x28bac0=_0x117611[_0xf67d('0x79')];if(_0xec5600===_0xf67d('0x7c')){if('undefined'!=typeof _0x117611[_0xf67d('0x7d')]['views']['admin']){var _0x5f2e37=_0x117611[_0xf67d('0x7d')]['views'][_0xf67d('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xf67d('0x8a')](_0x5f2e37)){_0x284648=path['join']('plugins',_0x4f0336,_0xc5768b[0x0],_0x5f2e37);}else{_0x284648=_0x5f2e37;}}else{logger['info'](_0xf67d('0x8b'));}if(_0xf67d('0x26')!=typeof _0x117611[_0xf67d('0x7d')][_0xf67d('0x7f')]['agent']){var _0x29d77c=_0x117611[_0xf67d('0x7d')][_0xf67d('0x7f')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xf67d('0x8a')](_0x29d77c)){_0x51bc39=path[_0xf67d('0x56')](_0xf67d('0x8c'),_0x4f0336,_0xc5768b[0x0],_0x29d77c);}else{_0x51bc39=_0x29d77c;}}else{logger[_0xf67d('0x6a')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xec5600===_0xf67d('0x82')){_0x472067=_0x117611[_0xf67d('0x7d')][_0xf67d('0x83')];_0x3521a0=_0x117611[_0xf67d('0x7d')][_0xf67d('0x85')];if(_0xf67d('0x26')!=typeof _0x117611['parameters'][_0xf67d('0x7f')]){if(_0xf67d('0x26')!=typeof _0x117611['parameters'][_0xf67d('0x7f')][_0xf67d('0x89')]){var _0x5f2e37=_0x117611[_0xf67d('0x7d')][_0xf67d('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xf67d('0x8a')](_0x5f2e37)){_0x284648=path['join'](_0xf67d('0x8c'),_0x4f0336,_0xc5768b[0x0],_0x5f2e37);}else{_0x284648=_0x5f2e37;}}if(_0xf67d('0x26')!=typeof _0x117611['parameters'][_0xf67d('0x7f')][_0xf67d('0x80')]){var _0x29d77c=_0x117611[_0xf67d('0x7d')]['views'][_0xf67d('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xf67d('0x8a')](_0x29d77c)){_0x51bc39=path[_0xf67d('0x56')](_0xf67d('0x8c'),_0x4f0336,_0xc5768b[0x0],_0x29d77c);}else{_0x51bc39=_0x29d77c;}}}}var _0xcfe4ca={'name':_0xaad048,'description':_0x448607,'path':path[_0xf67d('0x56')](_0x4f0336,_0xc5768b[0x0]),'type':_0xec5600,'sidebar':_0x5578dc,'icon':_0x1faa8c,'adminUrl':_0x284648,'agentUrl':_0x51bc39,'scriptName':_0x472067,'scriptPath':_0x3521a0,'version':_0x28bac0};removeReferences(_0x2ad59a,null);return db['Plugin'][_0xf67d('0x8d')](_0xcfe4ca)[_0xf67d('0x2d')](function(_0x843e23){var _0x5533c4={'role':_0x3de5a6[_0xf67d('0x8e')]['role'],'userProfileId':_0x3de5a6[_0xf67d('0x8e')][_0xf67d('0x8f')]};if(!_0x5533c4)throw new Error(_0xf67d('0x90'));if(_0x5533c4[_0xf67d('0x91')]===_0xf67d('0x92')){var _0x123681=_0x843e23[_0xf67d('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0xf67d('0x53')]({'where':{'name':_0xf67d('0x2f'),'userProfileId':_0x5533c4['userProfileId']},'raw':!![]})[_0xf67d('0x2d')](function(_0x31b548){if(_0x31b548&&_0x31b548[_0xf67d('0x93')]===0x0){return db[_0xf67d('0x30')]['create']({'name':_0x123681['name'],'resourceId':_0x123681['id'],'type':_0x31b548[_0xf67d('0x34')],'sectionId':_0x31b548['id']},{})['then'](function(){return _0x843e23;});}else{return _0x843e23;}})[_0xf67d('0x4e')](function(_0x698851){logger[_0xf67d('0x32')](_0xf67d('0x94'),_0x698851);throw _0x698851;});}return _0x843e23;})['then'](respondWithResult(_0x25dc27,null))[_0xf67d('0x4e')](handleError(_0x25dc27,null));}});}catch(_0x5c567a){_0x25dc27['status'](0x1f4)[_0xf67d('0x35')](_0x5c567a);}};function removeReferences(_0x12d8ab,_0x4fc412){try{if(_0x12d8ab){fs[_0xf67d('0x95')](_0x12d8ab);logger[_0xf67d('0x6a')]('Zip\x20archive\x20removed');}if(_0x4fc412){rimraf(_0x4fc412,function(){});logger[_0xf67d('0x6a')](_0xf67d('0x96'));}}catch(_0x476569){logger[_0xf67d('0x32')](_0x476569);}}exports[_0xf67d('0x2c')]=function(_0xf20a01,_0x97383c,_0x484650){return db['Plugin'][_0xf67d('0x53')]({'where':{'id':_0xf20a01['params']['id']}})[_0xf67d('0x2d')](handleEntityNotFound(_0x97383c,null))[_0xf67d('0x2d')](saveUpdates(_0xf20a01[_0xf67d('0x8e')],null))['then'](respondWithResult(_0x97383c,null))[_0xf67d('0x4e')](handleError(_0x97383c,null));};exports[_0xf67d('0x97')]=function(_0x530ae3,_0x797be7,_0x4820da){return db[_0xf67d('0x4a')][_0xf67d('0x53')]({'where':{'id':_0x530ae3['params']['id']}})[_0xf67d('0x2d')](function(_0x4f3315){if(_0x4f3315){return _0x4f3315[_0xf67d('0x31')]();}})[_0xf67d('0x2d')](function(_0x2b7d88){rimraf(path[_0xf67d('0x56')](config[_0xf67d('0x64')],_0xf67d('0x57'),path[_0xf67d('0x98')](_0x2b7d88['path'])),function(){});return _0x2b7d88;})[_0xf67d('0x2d')](handleEntityNotFound(_0x797be7,null))[_0xf67d('0x2d')](respondWithStatusCode(_0x797be7,null))[_0xf67d('0x4e')](handleError(_0x797be7,null));};exports[_0xf67d('0x99')]=function(_0x246029,_0x85a37d,_0xbde67f){return BPromise['resolve']()[_0xf67d('0x2d')](function(){if(!_0x246029[_0xf67d('0x3c')][_0xf67d('0x55')]){throw new Error(_0xf67d('0x9a'));}if(!_0x246029[_0xf67d('0x3c')]['port']){throw new Error(_0xf67d('0x9b'));}var _0x386c98=_0x246029['query']['hostname']?_0x246029[_0xf67d('0x3c')][_0xf67d('0x9c')]+':'+_0x246029[_0xf67d('0x3c')][_0xf67d('0x9d')]:_0xf67d('0x9e')+_0x246029['query'][_0xf67d('0x9d')];var _0x101dbe=_0x246029[_0xf67d('0x3c')][_0xf67d('0x25')]?_0x246029[_0xf67d('0x3c')][_0xf67d('0x25')]:!![];var _0x4da2ee=_0x246029[_0xf67d('0x3c')][_0xf67d('0x9f')]?_0x246029['query'][_0xf67d('0x9f')]:null;var _0x2b787f={'method':_0x246029[_0xf67d('0xa0')],'uri':util[_0xf67d('0x58')](_0xf67d('0xa1'),_0x386c98,_0x246029['query'][_0xf67d('0x55')]),'json':_0x101dbe,'resolveWithFullResponse':!![],'encoding':_0x4da2ee,'qs':_0x246029[_0xf67d('0x3c')]};if(_0x246029['headers']){_0x2b787f[_0xf67d('0xa2')]=_0x246029[_0xf67d('0xa2')];if(_0x2b787f[_0xf67d('0xa2')][_0xf67d('0xa3')]){delete _0x2b787f['headers'][_0xf67d('0xa3')];}}if(_0x2b787f[_0xf67d('0xa2')][_0xf67d('0xa4')]){delete _0x2b787f[_0xf67d('0xa2')][_0xf67d('0xa4')];}return rp(_0x2b787f);})[_0xf67d('0x2d')](function(_0x2ac3eb){if(_0x2ac3eb){_0x85a37d[_0xf67d('0xa5')](_0x2ac3eb['headers']);logger[_0xf67d('0x6a')](_0x2ac3eb[_0xf67d('0x8e')]);if(_[_0xf67d('0xa6')](_0x246029[_0xf67d('0x3c')][_0xf67d('0x55')],_0xf67d('0x54'))&&_0x2ac3eb[_0xf67d('0xa7')]==0x1f4){return _0x85a37d[_0xf67d('0x22')](_0x2ac3eb[_0xf67d('0xa7')]);}else{return _0x85a37d['status'](_0x2ac3eb[_0xf67d('0xa7')])[_0xf67d('0x35')](_0x2ac3eb[_0xf67d('0x8e')]);}}else{return _0x85a37d['sendStatus'](0xc8);}})[_0xf67d('0x4e')](handleError(_0x85a37d,null));};exports[_0xf67d('0xa8')]=function(_0x49dee3,_0x1c2867,_0x1aa098){return BPromise[_0xf67d('0xa9')]()[_0xf67d('0x2d')](function(){if(!_0x49dee3[_0xf67d('0x3c')]['path']){throw new Error(_0xf67d('0x9a'));}if(!_0x49dee3[_0xf67d('0x3c')][_0xf67d('0x9d')]){throw new Error(_0xf67d('0x9b'));}var _0x3bdf72=_0x49dee3['query'][_0xf67d('0x9c')]?_0x49dee3['query'][_0xf67d('0x9c')]+':'+_0x49dee3[_0xf67d('0x3c')]['port']:_0xf67d('0x9e')+_0x49dee3['query'][_0xf67d('0x9d')];var _0x58bbef=_0x49dee3['query']['json']?_0x49dee3[_0xf67d('0x3c')]['json']:!![];var _0xdf2d7a=_0x49dee3[_0xf67d('0x3c')][_0xf67d('0x9f')]?_0x49dee3[_0xf67d('0x3c')][_0xf67d('0x9f')]:null;var _0x38bbb5={'method':_0x49dee3[_0xf67d('0xa0')],'uri':util[_0xf67d('0x58')](_0xf67d('0xa1'),_0x3bdf72,_0x49dee3['query'][_0xf67d('0x55')]),'json':_0x58bbef,'resolveWithFullResponse':!![],'encoding':_0xdf2d7a,'body':_0x49dee3[_0xf67d('0x8e')]};if(_0x49dee3[_0xf67d('0xa2')]){_0x38bbb5[_0xf67d('0xa2')]=_0x49dee3[_0xf67d('0xa2')];if(_0x38bbb5[_0xf67d('0xa2')]['content-length']){delete _0x38bbb5['headers'][_0xf67d('0xa3')];}}if(_0x38bbb5[_0xf67d('0xa2')]['content-type']){delete _0x38bbb5[_0xf67d('0xa2')][_0xf67d('0xa4')];}return rp(_0x38bbb5);})[_0xf67d('0x2d')](function(_0x1cc816){if(_0x1cc816){_0x1c2867[_0xf67d('0xa5')](_0x1cc816['headers']);logger[_0xf67d('0x6a')](_0x1cc816['body']);return _0x1c2867[_0xf67d('0x23')](_0x1cc816[_0xf67d('0xa7')])[_0xf67d('0x35')](_0x1cc816[_0xf67d('0x8e')]);}else{return _0x1c2867[_0xf67d('0x22')](0xc8);}})[_0xf67d('0x4e')](handleError(_0x1c2867,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 7dec845..6add86f 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 _0xb89c=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','update','remove'];(function(_0x16bfc5,_0x4f9dc3){var _0x43b820=function(_0x363ced){while(--_0x363ced){_0x16bfc5['push'](_0x16bfc5['shift']());}};_0x43b820(++_0x4f9dc3);}(_0xb89c,0x198));var _0xcb89=function(_0x1e0464,_0x5d01cc){_0x1e0464=_0x1e0464-0x0;var _0x16a278=_0xb89c[_0x1e0464];return _0x16a278;};'use strict';var EventEmitter=require(_0xcb89('0x0'));var Plugin=require(_0xcb89('0x1'))['db'][_0xcb89('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xcb89('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb89('0x4'),'afterDestroy':_0xcb89('0x5')};function emitEvent(_0x57c08c){return function(_0x387b27,_0x777f33,_0x49bdbe){PluginEvents['emit'](_0x57c08c+':'+_0x387b27['id'],_0x387b27);PluginEvents['emit'](_0x57c08c,_0x387b27);_0x49bdbe(null);};}for(var e in events){if(events[_0xcb89('0x6')](e)){var event=events[e];Plugin[_0xcb89('0x7')](e,emitEvent(event));}}module[_0xcb89('0x8')]=PluginEvents; \ No newline at end of file +var _0x3d49=['emit','../../mysqldb','Plugin','setMaxListeners','save','remove'];(function(_0x3e66c0,_0x16035d){var _0x52526d=function(_0x24bf5b){while(--_0x24bf5b){_0x3e66c0['push'](_0x3e66c0['shift']());}};_0x52526d(++_0x16035d);}(_0x3d49,0x151));var _0x93d4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d49[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x93d4('0x0'))['db'][_0x93d4('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x93d4('0x2')](0x0);var events={'afterCreate':_0x93d4('0x3'),'afterUpdate':'update','afterDestroy':_0x93d4('0x4')};function emitEvent(_0x9846c2){return function(_0xa1de2e,_0x41313a,_0x20e6c7){PluginEvents[_0x93d4('0x5')](_0x9846c2+':'+_0xa1de2e['id'],_0xa1de2e);PluginEvents['emit'](_0x9846c2,_0xa1de2e);_0x20e6c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](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 8f3186f..ba6f408 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 _0xb607=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x43f53d,_0x361cd2){var _0xe7eb42=function(_0x484ddd){while(--_0x484ddd){_0x43f53d['push'](_0x43f53d['shift']());}};_0xe7eb42(++_0x361cd2);}(_0xb607,0x1bc));var _0x7b60=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb607[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7b60('0x0'));var util=require(_0x7b60('0x1'));var logger=require(_0x7b60('0x2'))(_0x7b60('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b60('0x4'));var rimraf=require(_0x7b60('0x5'));var config=require(_0x7b60('0x6'));var attributes=require(_0x7b60('0x7'));module[_0x7b60('0x8')]=function(_0x45e0c4,_0x34328d){return _0x45e0c4[_0x7b60('0x9')](_0x7b60('0xa'),attributes,{'tableName':_0x7b60('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ac8=['exports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./plugin.attributes'];(function(_0x36b1e7,_0x3a466e){var _0x2f5dd1=function(_0x254565){while(--_0x254565){_0x36b1e7['push'](_0x36b1e7['shift']());}};_0x2f5dd1(++_0x3a466e);}(_0x7ac8,0xfb));var _0x87ac=function(_0x25a928,_0x1c3cb3){_0x25a928=_0x25a928-0x0;var _0x49ea9b=_0x7ac8[_0x25a928];return _0x49ea9b;};'use strict';var _=require(_0x87ac('0x0'));var util=require(_0x87ac('0x1'));var logger=require(_0x87ac('0x2'))('api');var moment=require(_0x87ac('0x3'));var BPromise=require(_0x87ac('0x4'));var rp=require(_0x87ac('0x5'));var fs=require('fs');var path=require(_0x87ac('0x6'));var rimraf=require('rimraf');var config=require(_0x87ac('0x7'));var attributes=require(_0x87ac('0x8'));module[_0x87ac('0x9')]=function(_0x3a71f6,_0x26d6bb){return _0x3a71f6['define']('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 7a11de2..e913e9d 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 _0xb87d=['CreatePlugin','Plugin','create','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','Plugin,\x20%s,\x20%s','message','info','request\x20sent','catch'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xb87d,0x8d));var _0xdb87=function(_0x383379,_0x27448a){_0x383379=_0x383379-0x0;var _0xb78982=_0xb87d[_0x383379];return _0xb78982;};'use strict';var _=require(_0xdb87('0x0'));var util=require(_0xdb87('0x1'));var moment=require(_0xdb87('0x2'));var BPromise=require(_0xdb87('0x3'));var rs=require(_0xdb87('0x4'));var fs=require('fs');var Redis=require(_0xdb87('0x5'));var db=require(_0xdb87('0x6'))['db'];var utils=require(_0xdb87('0x7'));var logger=require(_0xdb87('0x8'))(_0xdb87('0x9'));var config=require('../../config/environment');var jayson=require(_0xdb87('0xa'));var client=jayson[_0xdb87('0xb')][_0xdb87('0xc')]({'port':0x232a});config[_0xdb87('0xd')]=_[_0xdb87('0xe')](config[_0xdb87('0xd')],{'host':_0xdb87('0xf'),'port':0x18eb});var socket=require(_0xdb87('0x10'))(new Redis(config[_0xdb87('0xd')]));require(_0xdb87('0x11'))[_0xdb87('0x12')](socket);function respondWithRpcPromise(_0x5808f9,_0x25ccf5,_0x37fc46){return new BPromise(function(_0x12bad0,_0x4401bc){return client[_0xdb87('0x13')](_0x5808f9,_0x37fc46)[_0xdb87('0x14')](function(_0x143fca){logger['info']('Plugin,\x20%s,\x20%s',_0x25ccf5,'request\x20sent');logger['debug'](_0xdb87('0x15'),_0x25ccf5,'request\x20sent',JSON[_0xdb87('0x16')](_0x143fca));if(_0x143fca[_0xdb87('0x17')]){if(_0x143fca[_0xdb87('0x17')]['code']===0x1f4){logger['error'](_0xdb87('0x18'),_0x25ccf5,_0x143fca[_0xdb87('0x17')][_0xdb87('0x19')]);return _0x4401bc(_0x143fca['error'][_0xdb87('0x19')]);}logger[_0xdb87('0x17')]('Plugin,\x20%s,\x20%s',_0x25ccf5,_0x143fca[_0xdb87('0x17')][_0xdb87('0x19')]);return _0x12bad0(_0x143fca[_0xdb87('0x17')][_0xdb87('0x19')]);}else{logger[_0xdb87('0x1a')]('Plugin,\x20%s,\x20%s',_0x25ccf5,_0xdb87('0x1b'));_0x12bad0(_0x143fca['result']['message']);}})[_0xdb87('0x1c')](function(_0x33652c){logger['error']('Plugin,\x20%s,\x20%s',_0x25ccf5,_0x33652c);_0x4401bc(_0x33652c);});});}exports[_0xdb87('0x1d')]=function(_0xd28977){var _0xa58fa4=this;return new Promise(function(_0x15823a,_0x20a07b){return db[_0xdb87('0x1e')][_0xdb87('0x1f')](_0xd28977['body'],{'raw':_0xd28977[_0xdb87('0x20')]?_0xd28977[_0xdb87('0x20')]['raw']===undefined?!![]:![]:!![]})[_0xdb87('0x14')](function(_0x1e6ca0){logger[_0xdb87('0x1a')](_0xdb87('0x1d'),_0xd28977);logger[_0xdb87('0x21')]('CreatePlugin',_0xd28977,JSON[_0xdb87('0x16')](_0x1e6ca0));_0x15823a(_0x1e6ca0);})['catch'](function(_0x3e0a3c){logger[_0xdb87('0x17')](_0xdb87('0x1d'),_0x3e0a3c[_0xdb87('0x19')],_0xd28977);_0x20a07b(_0xa58fa4[_0xdb87('0x17')](0x1f4,_0x3e0a3c[_0xdb87('0x19')]));});});}; \ No newline at end of file +var _0xd690=['message','Plugin','create','options','raw','then','CreatePlugin','stringify','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd690,0xd4));var _0x0d69=function(_0x1ee491,_0x466f00){_0x1ee491=_0x1ee491-0x0;var _0x39fca5=_0xd690[_0x1ee491];return _0x39fca5;};'use strict';var _=require(_0x0d69('0x0'));var util=require(_0x0d69('0x1'));var moment=require('moment');var BPromise=require(_0x0d69('0x2'));var rs=require(_0x0d69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d69('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0d69('0x6')]({'port':0x232a});config[_0x0d69('0x7')]=_[_0x0d69('0x8')](config[_0x0d69('0x7')],{'host':_0x0d69('0x9'),'port':0x18eb});var socket=require(_0x0d69('0xa'))(new Redis(config[_0x0d69('0x7')]));require(_0x0d69('0xb'))[_0x0d69('0xc')](socket);function respondWithRpcPromise(_0x521a4e,_0x558837,_0x14435a){return new BPromise(function(_0x166a65,_0x11b84f){return client[_0x0d69('0xd')](_0x521a4e,_0x14435a)['then'](function(_0x5d600d){logger[_0x0d69('0xe')](_0x0d69('0xf'),_0x558837,_0x0d69('0x10'));logger[_0x0d69('0x11')](_0x0d69('0x12'),_0x558837,'request\x20sent',JSON['stringify'](_0x5d600d));if(_0x5d600d[_0x0d69('0x13')]){if(_0x5d600d[_0x0d69('0x13')]['code']===0x1f4){logger[_0x0d69('0x13')](_0x0d69('0xf'),_0x558837,_0x5d600d[_0x0d69('0x13')]['message']);return _0x11b84f(_0x5d600d[_0x0d69('0x13')][_0x0d69('0x14')]);}logger[_0x0d69('0x13')](_0x0d69('0xf'),_0x558837,_0x5d600d[_0x0d69('0x13')]['message']);return _0x166a65(_0x5d600d[_0x0d69('0x13')][_0x0d69('0x14')]);}else{logger[_0x0d69('0xe')](_0x0d69('0xf'),_0x558837,_0x0d69('0x10'));_0x166a65(_0x5d600d['result']['message']);}})['catch'](function(_0x58eac2){logger[_0x0d69('0x13')](_0x0d69('0xf'),_0x558837,_0x58eac2);_0x11b84f(_0x58eac2);});});}exports['CreatePlugin']=function(_0x1e242d){var _0x2a5076=this;return new Promise(function(_0x503dee,_0x218efa){return db[_0x0d69('0x15')][_0x0d69('0x16')](_0x1e242d['body'],{'raw':_0x1e242d[_0x0d69('0x17')]?_0x1e242d[_0x0d69('0x17')][_0x0d69('0x18')]===undefined?!![]:![]:!![]})[_0x0d69('0x19')](function(_0x4ecaeb){logger[_0x0d69('0xe')](_0x0d69('0x1a'),_0x1e242d);logger[_0x0d69('0x11')]('CreatePlugin',_0x1e242d,JSON[_0x0d69('0x1b')](_0x4ecaeb));_0x503dee(_0x4ecaeb);})[_0x0d69('0x1c')](function(_0x397506){logger['error'](_0x0d69('0x1a'),_0x397506[_0x0d69('0x14')],_0x1e242d);_0x218efa(_0x2a5076[_0x0d69('0x13')](0x1f4,_0x397506['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c8f6938..f7992cc 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 _0x1010=['save','remove','update','emit','removeListener','length','./plugin.events'];(function(_0x42c75f,_0x1571b5){var _0x22ce48=function(_0x317534){while(--_0x317534){_0x42c75f['push'](_0x42c75f['shift']());}};_0x22ce48(++_0x1571b5);}(_0x1010,0x172));var _0x0101=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x1010[_0xdd0313];return _0x2bd7e8;};'use strict';var PluginEvents=require(_0x0101('0x0'));var events=[_0x0101('0x1'),_0x0101('0x2'),_0x0101('0x3')];function createListener(_0x40be4d,_0x5ea56f){return function(_0x412b94){_0x5ea56f[_0x0101('0x4')](_0x40be4d,_0x412b94);};}function removeListener(_0x7415b9,_0x34d3b7){return function(){PluginEvents[_0x0101('0x5')](_0x7415b9,_0x34d3b7);};}exports['register']=function(_0x65d064){for(var _0x3ff68e=0x0,_0x3d1cc2=events[_0x0101('0x6')];_0x3ff68e<_0x3d1cc2;_0x3ff68e++){var _0x444f1c=events[_0x3ff68e];var _0x8a27bf=createListener('plugin:'+_0x444f1c,_0x65d064);PluginEvents['on'](_0x444f1c,_0x8a27bf);}}; \ No newline at end of file +var _0xd5b7=['./plugin.events','save','remove','update','removeListener','register','length','plugin:'];(function(_0x205dad,_0x15d56d){var _0x39d8b9=function(_0x4ae995){while(--_0x4ae995){_0x205dad['push'](_0x205dad['shift']());}};_0x39d8b9(++_0x15d56d);}(_0xd5b7,0xd0));var _0x7d5b=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0xd5b7[_0x18b191];return _0x43e146;};'use strict';var PluginEvents=require(_0x7d5b('0x0'));var events=[_0x7d5b('0x1'),_0x7d5b('0x2'),_0x7d5b('0x3')];function createListener(_0x5b4043,_0x128249){return function(_0x1bb87a){_0x128249['emit'](_0x5b4043,_0x1bb87a);};}function removeListener(_0x27a1cb,_0x43712f){return function(){PluginEvents[_0x7d5b('0x4')](_0x27a1cb,_0x43712f);};}exports[_0x7d5b('0x5')]=function(_0x4529e6){for(var _0x2ec485=0x0,_0x107cfb=events[_0x7d5b('0x6')];_0x2ec485<_0x107cfb;_0x2ec485++){var _0x1a41f7=events[_0x2ec485];var _0x39e718=createListener(_0x7d5b('0x7')+_0x1a41f7,_0x4529e6);PluginEvents['on'](_0x1a41f7,_0x39e718);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index c604299..d986b84 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(_0x875b3b,_0x172523){var _0x233370=function(_0x58177e){while(--_0x58177e){_0x875b3b['push'](_0x875b3b['shift']());}};_0x233370(++_0x172523);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0xe84a92,_0x55de4a){var _0x3f5dfc=function(_0x47c250){while(--_0x47c250){_0xe84a92['push'](_0xe84a92['shift']());}};_0x3f5dfc(++_0x55de4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 228070c..aa86825 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 _0x34e5=['info','error','list','then','reject','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','name','npm\x20install'];(function(_0x2b93bb,_0x51002a){var _0x2bedc9=function(_0x3ba914){while(--_0x3ba914){_0x2b93bb['push'](_0x2b93bb['shift']());}};_0x2bedc9(++_0x51002a);}(_0x34e5,0x172));var _0x534e=function(_0x5d492b,_0x38fad7){_0x5d492b=_0x5d492b-0x0;var _0x46650=_0x34e5[_0x5d492b];return _0x46650;};'use strict';var _=require('lodash');var pm2=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var path=require(_0x534e('0x2'));var exec=require(_0x534e('0x3'))[_0x534e('0x4')];var BPromise=require(_0x534e('0x5'));function handleEntityNotFound(_0x50b790,_0x11a158){return function(_0x3d8287){if(!_0x3d8287){_0x50b790[_0x534e('0x6')](0x194);;}return _0x3d8287;};}function respondWithResult(_0x117f0c,_0x436a92){_0x436a92=_0x436a92||0xc8;return function(_0x2d0370){if(_0x2d0370){return _0x117f0c[_0x534e('0x7')](_0x436a92)['json'](_0x2d0370);}return null;};}function handleError(_0x24d562,_0x929597){_0x929597=_0x929597||0x1f4;return function(_0xa836bb){logger['error'](_0xa836bb['stack']);if(_0xa836bb[_0x534e('0x8')]){delete _0xa836bb['name'];}_0x24d562[_0x534e('0x7')](_0x929597)['send'](_0xa836bb);};}function execChildProcess(){return new BPromise(function(_0xb30dd6,_0x310b6d){exec(_0x534e('0x9'),function(_0x529726,_0x1b7a5a,_0x229352){logger[_0x534e('0xa')](_0x1b7a5a);logger[_0x534e('0xa')](_0x229352);if(_0x529726){logger[_0x534e('0xb')](_0x529726);return _0x310b6d(_0x529726);}return _0xb30dd6(_0x1b7a5a);});});}exports['index']=function(_0x31d764,_0x23c11c){return pm2[_0x534e('0xc')]()[_0x534e('0xd')](function(_0x359565){if(_0x359565){var _0x478027=_[_0x534e('0xe')](_0x359565,function(_0x17c068){return _0x17c068[_0x534e('0x8')]==='express'||_0x17c068[_0x534e('0x8')]===_0x534e('0xf');});return{'rows':_0x478027,'count':_0x478027['length']};}return null;})['then'](respondWithResult(_0x23c11c,null))[_0x534e('0x10')](handleError(_0x23c11c,null));};exports[_0x534e('0x11')]=function(_0x9297b6,_0x16ad40){return pm2[_0x534e('0x12')](_0x9297b6[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x16ad40,null))['then'](handleEntityNotFound(_0x16ad40,null))[_0x534e('0x10')](handleError(_0x16ad40,null));};exports[_0x534e('0x14')]=function(_0x466d74,_0x1bef0a){if(_0x466d74[_0x534e('0x15')]['name']&&_0x466d74[_0x534e('0x15')][_0x534e('0x16')]){var _0x5f9ae9=path[_0x534e('0x17')](__dirname,_0x534e('0x18'),_0x466d74[_0x534e('0x15')][_0x534e('0x16')]);var _0x85188b=process[_0x534e('0x19')]();process['chdir'](path[_0x534e('0x1a')](_0x5f9ae9));return execChildProcess()[_0x534e('0xd')](function(_0x39466c){process[_0x534e('0x1b')](_0x85188b);return pm2[_0x534e('0x1c')]({'name':_0x466d74[_0x534e('0x15')][_0x534e('0x8')],'script':_0x5f9ae9});})[_0x534e('0xd')](function(_0x53a6ef){pm2[_0x534e('0x1d')]();return _0x53a6ef[0x0];})['then'](respondWithResult(_0x1bef0a,0xc9))[_0x534e('0x10')](handleError(_0x1bef0a,null));}else{return _0x1bef0a[_0x534e('0x7')](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x1f')});}};exports[_0x534e('0x20')]=function(_0x57b216,_0x743974){if(_0x57b216[_0x534e('0x15')]['id']){delete _0x57b216['body']['id'];}var _0x4bd073={'online':_0x534e('0x21'),'stopped':'stop'};if(_0x4bd073[_0x534e('0x22')](_0x57b216[_0x534e('0x15')][_0x534e('0x7')])){return pm2[_0x4bd073[_0x57b216[_0x534e('0x15')][_0x534e('0x7')]]](_0x57b216[_0x534e('0x13')]['id'])[_0x534e('0xd')](respondWithResult(_0x743974,0xc8))['catch'](handleError(_0x743974,null));}else{return _0x743974['status'](0x1f4)[_0x534e('0x1e')]({'message':_0x534e('0x23')});}};exports[_0x534e('0x24')]=function(_0x2f1c49,_0x423502){if(_0x2f1c49[_0x534e('0x15')]['id']){delete _0x2f1c49[_0x534e('0x15')]['id'];}if(_0x2f1c49[_0x534e('0x13')]['id']){return pm2[_0x534e('0x25')](_0x2f1c49[_0x534e('0x13')]['id'])[_0x534e('0xd')](function(_0x1d6fb1){pm2['dump']();return _0x1d6fb1[0x0];})[_0x534e('0xd')](respondWithResult(_0x423502,null))[_0x534e('0x10')](handleError(_0x423502,null));}else{return _0x423502['status'](0x1f4)[_0x534e('0x1e')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x2f68=['dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','sendStatus','status','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','delete'];(function(_0x5c709b,_0x5d2155){var _0x3f000a=function(_0x318f9b){while(--_0x318f9b){_0x5c709b['push'](_0x5c709b['shift']());}};_0x3f000a(++_0x5d2155);}(_0x2f68,0x9a));var _0x82f6=function(_0x488bfb,_0x4e0ed7){_0x488bfb=_0x488bfb-0x0;var _0x1678f6=_0x2f68[_0x488bfb];return _0x1678f6;};'use strict';var _=require('lodash');var pm2=require(_0x82f6('0x0'));var logger=require(_0x82f6('0x1'))(_0x82f6('0x2'));var path=require(_0x82f6('0x3'));var exec=require('child_process')[_0x82f6('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x2a06dc,_0x2ab73d){return function(_0x5dad09){if(!_0x5dad09){_0x2a06dc[_0x82f6('0x5')](0x194);;}return _0x5dad09;};}function respondWithResult(_0x2c4302,_0x542737){_0x542737=_0x542737||0xc8;return function(_0x5a8089){if(_0x5a8089){return _0x2c4302[_0x82f6('0x6')](_0x542737)['json'](_0x5a8089);}return null;};}function handleError(_0x5daa3c,_0x864400){_0x864400=_0x864400||0x1f4;return function(_0xbd30d5){logger[_0x82f6('0x7')](_0xbd30d5['stack']);if(_0xbd30d5[_0x82f6('0x8')]){delete _0xbd30d5[_0x82f6('0x8')];}_0x5daa3c['status'](_0x864400)[_0x82f6('0x9')](_0xbd30d5);};}function execChildProcess(){return new BPromise(function(_0x1eec2f,_0x3f8320){exec(_0x82f6('0xa'),function(_0x1a68c4,_0x34bd7c,_0x4c870e){logger[_0x82f6('0xb')](_0x34bd7c);logger[_0x82f6('0xb')](_0x4c870e);if(_0x1a68c4){logger['error'](_0x1a68c4);return _0x3f8320(_0x1a68c4);}return _0x1eec2f(_0x34bd7c);});});}exports[_0x82f6('0xc')]=function(_0x1f8bf5,_0x397527){return pm2[_0x82f6('0xd')]()[_0x82f6('0xe')](function(_0xa00275){if(_0xa00275){var _0x115c7b=_[_0x82f6('0xf')](_0xa00275,function(_0x1e7cbc){return _0x1e7cbc['name']===_0x82f6('0x10')||_0x1e7cbc['name']===_0x82f6('0x11');});return{'rows':_0x115c7b,'count':_0x115c7b[_0x82f6('0x12')]};}return null;})[_0x82f6('0xe')](respondWithResult(_0x397527,null))[_0x82f6('0x13')](handleError(_0x397527,null));};exports[_0x82f6('0x14')]=function(_0x2326ae,_0x326378){return pm2[_0x82f6('0x15')](_0x2326ae[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x326378,null))[_0x82f6('0xe')](handleEntityNotFound(_0x326378,null))[_0x82f6('0x13')](handleError(_0x326378,null));};exports[_0x82f6('0x17')]=function(_0x4fe226,_0x3a8269){if(_0x4fe226['body'][_0x82f6('0x8')]&&_0x4fe226[_0x82f6('0x18')]['script']){var _0x2b03ad=path[_0x82f6('0x19')](__dirname,_0x82f6('0x1a'),_0x4fe226[_0x82f6('0x18')]['script']);var _0xdc4dea=process['cwd']();process[_0x82f6('0x1b')](path[_0x82f6('0x1c')](_0x2b03ad));return execChildProcess()['then'](function(_0x516deb){process[_0x82f6('0x1b')](_0xdc4dea);return pm2[_0x82f6('0x1d')]({'name':_0x4fe226['body']['name'],'script':_0x2b03ad});})[_0x82f6('0xe')](function(_0x31face){pm2['dump']();return _0x31face[0x0];})[_0x82f6('0xe')](respondWithResult(_0x3a8269,0xc9))[_0x82f6('0x13')](handleError(_0x3a8269,null));}else{return _0x3a8269['status'](0x1f4)['send']({'message':_0x82f6('0x1e')});}};exports['update']=function(_0x469b6b,_0x5a6d69){if(_0x469b6b['body']['id']){delete _0x469b6b[_0x82f6('0x18')]['id'];}var _0x15c9b7={'online':_0x82f6('0x1f'),'stopped':_0x82f6('0x20')};if(_0x15c9b7['hasOwnProperty'](_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')])){return pm2[_0x15c9b7[_0x469b6b[_0x82f6('0x18')][_0x82f6('0x6')]]](_0x469b6b[_0x82f6('0x16')]['id'])[_0x82f6('0xe')](respondWithResult(_0x5a6d69,0xc8))[_0x82f6('0x13')](handleError(_0x5a6d69,null));}else{return _0x5a6d69[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x21')});}};exports[_0x82f6('0x22')]=function(_0x20d1c5,_0x6ce179){if(_0x20d1c5[_0x82f6('0x18')]['id']){delete _0x20d1c5['body']['id'];}if(_0x20d1c5[_0x82f6('0x16')]['id']){return pm2[_0x82f6('0x23')](_0x20d1c5[_0x82f6('0x16')]['id'])['then'](function(_0x36f37a){pm2[_0x82f6('0x24')]();return _0x36f37a[0x0];})[_0x82f6('0xe')](respondWithResult(_0x6ce179,null))[_0x82f6('0x13')](handleError(_0x6ce179,null));}else{return _0x6ce179[_0x82f6('0x6')](0x1f4)[_0x82f6('0x9')]({'message':_0x82f6('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 6167db1..c05f9e1 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 _0x724e=['isAuthenticated','getAgents','/queues','getQueues','exports','express','../../components/auth/service','./realtime.controller','/agents'];(function(_0x325216,_0x5d9ca7){var _0x470f64=function(_0x3589f1){while(--_0x3589f1){_0x325216['push'](_0x325216['shift']());}};_0x470f64(++_0x5d9ca7);}(_0x724e,0xc2));var _0xe724=function(_0xa09260,_0x4d9ca9){_0xa09260=_0xa09260-0x0;var _0x10f4c3=_0x724e[_0xa09260];return _0x10f4c3;};'use strict';var express=require(_0xe724('0x0'));var router=express['Router']();var auth=require(_0xe724('0x1'));var controller=require(_0xe724('0x2'));router['get'](_0xe724('0x3'),auth[_0xe724('0x4')](),controller[_0xe724('0x5')]);router['get'](_0xe724('0x6'),auth[_0xe724('0x4')](),controller[_0xe724('0x7')]);module[_0xe724('0x8')]=router; \ No newline at end of file +var _0x8cb9=['getAgents','get','isAuthenticated','getQueues','express','Router','/agents'];(function(_0x36feb2,_0x53abef){var _0x292b43=function(_0x52a460){while(--_0x52a460){_0x36feb2['push'](_0x36feb2['shift']());}};_0x292b43(++_0x53abef);}(_0x8cb9,0xa5));var _0x98cb=function(_0x20e4e6,_0x5c5aee){_0x20e4e6=_0x20e4e6-0x0;var _0x3177e9=_0x8cb9[_0x20e4e6];return _0x3177e9;};'use strict';var express=require(_0x98cb('0x0'));var router=express[_0x98cb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./realtime.controller');router['get'](_0x98cb('0x2'),auth['isAuthenticated'](),controller[_0x98cb('0x3')]);router[_0x98cb('0x4')]('/queues',auth[_0x98cb('0x5')](),controller[_0x98cb('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index c5d1f41..49bfa83 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 _0x4e40=['*pause','Pause','where','merge','role','user','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','pause','forEach','sortAgentsByStatus','pick','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','rawAttributes','name','outbound','dialMethod','getOptions','userProfileId','voice','QueueCampaigns','startCase','Queues','initializeQueues','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','resolve','then','channel','isValidChannel','format','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','agent','raw','push','literal'];(function(_0x151e3e,_0x32b18b){var _0x4f1640=function(_0x123c44){while(--_0x123c44){_0x151e3e['push'](_0x151e3e['shift']());}};_0x4f1640(++_0x32b18b);}(_0x4e40,0xba));var _0x04e4=function(_0x38fea1,_0x14ac08){_0x38fea1=_0x38fea1-0x0;var _0x57ca5e=_0x4e40[_0x38fea1];return _0x57ca5e;};'use strict';var _=require(_0x04e4('0x0'));var util=require(_0x04e4('0x1'));var rta=require(_0x04e4('0x2'));var rtq=require(_0x04e4('0x3'));var qs=require(_0x04e4('0x4'));var utils=require(_0x04e4('0x5'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x04e4('0x6'))[_0x04e4('0x7')];var APIHandleError=require(_0x04e4('0x6'))[_0x04e4('0x8')];function respondWithFilteredResult(_0x644b3a,_0x395edc){return function(_0x5d2c8b){if(_0x5d2c8b){var _0x288a14=typeof _0x395edc[_0x04e4('0x9')]===_0x04e4('0xa')&&typeof _0x395edc['limit']==='undefined';var _0x197d20=_0x5d2c8b[_0x04e4('0xb')];var _0x2198e3=_0x288a14?0x0:_0x395edc[_0x04e4('0x9')];var _0x214874=_0x288a14?_0x5d2c8b[_0x04e4('0xb')]:_0x395edc[_0x04e4('0x9')]+_0x395edc[_0x04e4('0xc')];var _0x17e2e4;if(_0x214874>=_0x197d20){_0x214874=_0x197d20;_0x17e2e4=0xc8;}else{_0x17e2e4=0xce;}_0x644b3a['status'](_0x17e2e4);return _0x644b3a['set'](_0x04e4('0xd'),_0x2198e3+'-'+_0x214874+'/'+_0x197d20)[_0x04e4('0xe')](_0x5d2c8b);}return null;};}exports[_0x04e4('0xf')]=function(_0x84a66b,_0x10264e){var _0x202c9c={'count':0x0,'rows':[]};var _0x9a7435={};var _0x408dc3;var _0x371069=utils[_0x04e4('0x10')]();var _0x11e367;var _0x2fbdca;var _0x5cb218=_0x84a66b[_0x04e4('0x11')][_0x04e4('0x12')];var _0x44af52=_0x84a66b[_0x04e4('0x11')][_0x04e4('0x13')];var _0x2f1f30=_0x84a66b['query']['pauseTypeFilter'];var _0x58caf4=_0x44af52==='pause'||_0x44af52==='*pause'?!![]:![];var _0x3be0a9=[];var _0x5db21f;var _0x29f685;Promise[_0x04e4('0x14')]()[_0x04e4('0x15')](function(){if(_0x84a66b[_0x04e4('0x11')][_0x04e4('0x16')]){if(!utils[_0x04e4('0x17')](_0x84a66b['query'][_0x04e4('0x16')])){throw new APIBadRequestError(util[_0x04e4('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x84a66b[_0x04e4('0x11')]['channel']));}_0x408dc3=_0x84a66b[_0x04e4('0x11')][_0x04e4('0x16')]['toLowerCase']();}if(!_0x84a66b[_0x04e4('0x11')][_0x04e4('0x19')]||!_0x84a66b[_0x04e4('0x11')][_0x04e4('0x19')][_0x04e4('0x1a')](_0x04e4('0x1b'))){_0x84a66b['query'][_0x04e4('0x19')]=rta[_0x04e4('0x1c')](_0x84a66b[_0x04e4('0x11')][_0x04e4('0x19')]);return;}var _0x1d7629=rta[_0x04e4('0x1d')](_0x84a66b['query']['sort']);_0x84a66b['query']['sort']=_0x1d7629[_0x04e4('0x1e')][_0x04e4('0x1f')](',');_0x5db21f=_0x1d7629[_0x04e4('0x20')];})[_0x04e4('0x15')](function(){if(!_0x5cb218){return[];}return rta[_0x04e4('0x21')](_0x5cb218,_0x408dc3);})[_0x04e4('0x15')](function(_0x3e2a06){_0x3be0a9=_0x3e2a06;return rta[_0x04e4('0x22')]();})[_0x04e4('0x15')](function(_0x18a72d){_0x2fbdca=_0x18a72d[_0x04e4('0x23')];if((!_0x44af52||_0x58caf4)&&!_0x5db21f){return _0x3be0a9;}if(_0x5db21f&&!_0x44af52){return rta[_0x04e4('0x24')](_0x2fbdca,_0x3be0a9,_0x5db21f);}else{return rta[_0x04e4('0x25')](_0x2fbdca,_0x3be0a9,_0x44af52);}})[_0x04e4('0x15')](function(_0x2ddbf8){_0x3be0a9=_0x2ddbf8;var _0x42db0a=![];if(_0x3be0a9[_0x04e4('0x26')]===0x0){if(_0x5cb218||_0x44af52){_0x42db0a=!![];}if(_0x58caf4){_0x42db0a=![];}}if(_0x42db0a){return _0x202c9c;}var _0x46b6a4=_[_0x04e4('0x27')](db[_0x04e4('0x28')]['rawAttributes'],function(_0x41871e){return{'name':_0x41871e[_0x04e4('0x29')],'type':_0x41871e[_0x04e4('0x2a')][_0x04e4('0x2b')]};});_0x84a66b[_0x04e4('0x11')]['role']=_0x04e4('0x2c');_0x84a66b['query']['online']=!![];_0x9a7435=qs['getOptions'](_0x46b6a4,_0x84a66b);_0x9a7435[_0x04e4('0x2d')]=!![];var _0x2707f5=[];if(_0x3be0a9[_0x04e4('0x26')]>0x0){_0x2707f5[_0x04e4('0x2e')]({'id':{'$in':_0x3be0a9}});if(_0x5db21f&&!_0x44af52){_0x29f685=[db['sequelize'][_0x04e4('0x2f')]('FIELD(id,'+_0x3be0a9+')')];_0x9a7435['order']=_0x29f685;}}if(_0x58caf4){_0x371069['forEach'](function(_0x6832b3){var _0x6eb7d6=!![];if(_0x44af52===_0x04e4('0x30')&&_0x408dc3!==_0x6832b3){_0x6eb7d6=![];}_0x2707f5[_0x04e4('0x2e')]({[_0x6832b3+_0x04e4('0x31')]:_0x6eb7d6});});if(_0x2f1f30){_0x2707f5['push']({'pauseType':_0x2f1f30});}}else if(_0x44af52){_0x371069['forEach'](function(_0x419a6f){_0x2707f5[_0x04e4('0x2e')]({[_0x419a6f+_0x04e4('0x31')]:![]});});}_0x9a7435[_0x04e4('0x32')]=_[_0x04e4('0x33')](_0x9a7435[_0x04e4('0x32')],{'$and':_0x2707f5});if(_0x84a66b['user'][_0x04e4('0x34')]===_0x04e4('0x35')){var _0x393bdc={'params':{'id':_0x84a66b[_0x04e4('0x35')]['userProfileId']},'query':{'section':'Agents','role':_0x04e4('0x2c'),'online':!![],'raw':!![],'ids':_0x3be0a9,'customSorting':_0x29f685}};if(_0x58caf4){_0x393bdc[_0x04e4('0x11')][_0x04e4('0x36')]=_0x2707f5;}_0x393bdc[_0x04e4('0x11')]=Object[_0x04e4('0x37')](_0x393bdc[_0x04e4('0x11')],_0x84a66b[_0x04e4('0x11')]);delete _0x393bdc[_0x04e4('0x11')]['id'];return db[_0x04e4('0x38')][_0x04e4('0x39')](_0x393bdc);}return db[_0x04e4('0x28')][_0x04e4('0x3a')](_0x9a7435);})['then'](function(_0xd5b145){_0x202c9c[_0x04e4('0xb')]=_0xd5b145[_0x04e4('0xb')];_0x11e367=_0xd5b145[_0x04e4('0x23')];return _0x11e367[_0x04e4('0x27')](function(_0x533b3a){var _0x5a5925=_['find'](_0x2fbdca,['id',_0x533b3a['id']]);if(_0x5a5925){var _0x409be8=rta[_0x04e4('0x3b')](_0x5a5925);_[_0x04e4('0x33')](_0x533b3a,_0x409be8);}_0x533b3a['globalStatus']=rta['getAgentStatus'](_0x533b3a);if(_0x533b3a[_0x04e4('0x1b')][_0x04e4('0x1a')](_0x04e4('0x3c'))){_0x371069[_0x04e4('0x3d')](function(_0x368c14){if(_0x533b3a[_0x368c14+_0x04e4('0x31')]){_0x533b3a[_0x368c14+'Status']=_0x04e4('0x3c');}});}return _0x533b3a;});})['then'](function(_0xeaba78){if(!_0x5db21f||_0x29f685){return _0xeaba78;}return rta[_0x04e4('0x3e')](_0xeaba78,_0x5db21f);})['then'](function(_0x25e439){var _0x10b800=null;if(_0x84a66b[_0x04e4('0x11')][_0x04e4('0x1e')]){var _0x2bd383=_0x84a66b[_0x04e4('0x11')][_0x04e4('0x1e')]['split'](',');_0x10b800=_0x25e439[_0x04e4('0x27')](function(_0x22860c){return _[_0x04e4('0x3f')](_0x22860c,_0x2bd383);});}_0x202c9c[_0x04e4('0x23')]=_0x10b800||_0x25e439;return _0x202c9c;})[_0x04e4('0x15')](respondWithFilteredResult(_0x10264e,_0x9a7435))['catch'](APIHandleError(_0x10264e));};exports['getQueues']=function(_0x1ebdc8,_0x523ee2){var _0x2963f4={'count':0x0,'rows':[]};var _0xebc8fe={};var _0x408bf3;var _0xe9a47f;var _0x5b39bb;Promise['resolve']()[_0x04e4('0x15')](function(){if(_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x16')]){if(!utils[_0x04e4('0x17')](_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x16')])){throw new APIBadRequestError(util[_0x04e4('0x18')](_0x04e4('0x40'),_0x1ebdc8[_0x04e4('0x11')]['channel']));}_0x408bf3=_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x16')][_0x04e4('0x41')]();}var _0x6b2b03=_['startCase'](_0x408bf3)+'Queue';var _0x2afd55=_[_0x04e4('0x27')](db[_0x6b2b03][_0x04e4('0x42')],function(_0x375b1d){return{'name':_0x375b1d[_0x04e4('0x29')],'type':_0x375b1d[_0x04e4('0x2a')][_0x04e4('0x2b')]};});if(!_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x1e')]){var _0x129e86=['id',_0x04e4('0x43')];if(_0x408bf3==='voice'){_0x129e86[_0x04e4('0x2e')](_0x04e4('0x2a'));if(_0x1ebdc8[_0x04e4('0x11')]['type']===_0x04e4('0x44')){_0x129e86['push'](['dialActive',_0x04e4('0x45')]);}}_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x1e')]=_0x129e86[_0x04e4('0x1f')](',');}_0xebc8fe=qs[_0x04e4('0x46')](_0x2afd55,_0x1ebdc8);if(_0x1ebdc8[_0x04e4('0x35')][_0x04e4('0x34')]===_0x04e4('0x35')){var _0x5d0807={'params':{'id':_0x1ebdc8['user'][_0x04e4('0x47')]},'query':{'section':_0x408bf3===_0x04e4('0x48')&&_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x2a')]===_0x04e4('0x44')?_0x04e4('0x49'):_[_0x04e4('0x4a')](_0x408bf3)+_0x04e4('0x4b'),'type':_0x1ebdc8[_0x04e4('0x11')][_0x04e4('0x2a')],'nolimit':!![],'sort':'name','filter':_0x1ebdc8[_0x04e4('0x11')]['filter']}};return db[_0x04e4('0x38')][_0x04e4('0x39')](_0x5d0807);}return db[_0x6b2b03][_0x04e4('0x3a')](_0xebc8fe);})[_0x04e4('0x15')](function(_0x50d31d){_0x2963f4[_0x04e4('0xb')]=_0x50d31d[_0x04e4('0xb')];_0xe9a47f=_0x50d31d[_0x04e4('0x23')];return rtq['getRealtimeQueues'](_0x1ebdc8,_0x408bf3);})[_0x04e4('0x15')](function(_0x51cd67){_0x5b39bb=_0x51cd67[_0x04e4('0x23')];return rtq[_0x04e4('0x4c')](_0xe9a47f,_0x5b39bb,_0x408bf3,_0x1ebdc8[_0x04e4('0x11')]['type']);})[_0x04e4('0x15')](function(_0x280fb1){_0x2963f4[_0x04e4('0x23')]=_0x280fb1;return _0x2963f4;})[_0x04e4('0x15')](respondWithFilteredResult(_0x523ee2,_0xebc8fe))[_0x04e4('0x4d')](APIHandleError(_0x523ee2));}; \ No newline at end of file +var _0x5f36=['includes','globalStatus','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','type','key','role','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','userProfileId','Agents','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','merge','getAgentStatus','Status','sortAgentsByStatus','split','toLowerCase','startCase','Queue','name','voice','outbound','dialActive','dialMethod','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','sort'];(function(_0x153aed,_0x17ddf7){var _0x43e0a9=function(_0x6acf33){while(--_0x6acf33){_0x153aed['push'](_0x153aed['shift']());}};_0x43e0a9(++_0x17ddf7);}(_0x5f36,0x17c));var _0x65f3=function(_0x6ac820,_0x37a3c9){_0x6ac820=_0x6ac820-0x0;var _0x178c30=_0x5f36[_0x6ac820];return _0x178c30;};'use strict';var _=require(_0x65f3('0x0'));var util=require(_0x65f3('0x1'));var rta=require(_0x65f3('0x2'));var rtq=require(_0x65f3('0x3'));var qs=require(_0x65f3('0x4'));var utils=require(_0x65f3('0x5'));var db=require(_0x65f3('0x6'))['db'];var APIBadRequestError=require(_0x65f3('0x7'))[_0x65f3('0x8')];var APIHandleError=require(_0x65f3('0x7'))[_0x65f3('0x9')];function respondWithFilteredResult(_0x173350,_0x54aa39){return function(_0x4eef52){if(_0x4eef52){var _0x775adc=typeof _0x54aa39[_0x65f3('0xa')]===_0x65f3('0xb')&&typeof _0x54aa39[_0x65f3('0xc')]===_0x65f3('0xb');var _0x183779=_0x4eef52[_0x65f3('0xd')];var _0x19d5cd=_0x775adc?0x0:_0x54aa39[_0x65f3('0xa')];var _0x4c7f14=_0x775adc?_0x4eef52[_0x65f3('0xd')]:_0x54aa39[_0x65f3('0xa')]+_0x54aa39[_0x65f3('0xc')];var _0x85b41a;if(_0x4c7f14>=_0x183779){_0x4c7f14=_0x183779;_0x85b41a=0xc8;}else{_0x85b41a=0xce;}_0x173350[_0x65f3('0xe')](_0x85b41a);return _0x173350[_0x65f3('0xf')](_0x65f3('0x10'),_0x19d5cd+'-'+_0x4c7f14+'/'+_0x183779)[_0x65f3('0x11')](_0x4eef52);}return null;};}exports[_0x65f3('0x12')]=function(_0x1a73cd,_0x34156b){var _0xe4a323={'count':0x0,'rows':[]};var _0x1f5a4c={};var _0x2249ab;var _0x19acee=utils[_0x65f3('0x13')]();var _0x1930b3;var _0x453739;var _0xce4321=_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x15')];var _0x6fa452=_0x1a73cd['query']['globalStatusFilter'];var _0x437621=_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x16')];var _0x57b9ae=_0x6fa452===_0x65f3('0x17')||_0x6fa452==='*pause'?!![]:![];var _0x19d531=[];var _0x463fef;var _0x3feec2;Promise[_0x65f3('0x18')]()[_0x65f3('0x19')](function(){if(_0x1a73cd['query'][_0x65f3('0x1a')]){if(!utils[_0x65f3('0x1b')](_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x1a')])){throw new APIBadRequestError(util[_0x65f3('0x1c')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1a73cd[_0x65f3('0x14')]['channel']));}_0x2249ab=_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x1a')]['toLowerCase']();}if(!_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x1d')]||!_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x1d')][_0x65f3('0x1e')](_0x65f3('0x1f'))){_0x1a73cd[_0x65f3('0x14')]['sort']=rta['validateSortParameter'](_0x1a73cd[_0x65f3('0x14')]['sort']);return;}var _0x1721e5=rta[_0x65f3('0x20')](_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x1d')]);_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x1d')]=_0x1721e5[_0x65f3('0x21')][_0x65f3('0x22')](',');_0x463fef=_0x1721e5[_0x65f3('0x23')];})[_0x65f3('0x19')](function(){if(!_0xce4321){return[];}return rta[_0x65f3('0x24')](_0xce4321,_0x2249ab);})[_0x65f3('0x19')](function(_0x2e9d1f){_0x19d531=_0x2e9d1f;return rta[_0x65f3('0x25')]();})['then'](function(_0x4bb3bf){_0x453739=_0x4bb3bf[_0x65f3('0x26')];if((!_0x6fa452||_0x57b9ae)&&!_0x463fef){return _0x19d531;}if(_0x463fef&&!_0x6fa452){return rta[_0x65f3('0x27')](_0x453739,_0x19d531,_0x463fef);}else{return rta[_0x65f3('0x28')](_0x453739,_0x19d531,_0x6fa452);}})[_0x65f3('0x19')](function(_0x1956cb){_0x19d531=_0x1956cb;var _0x14d9d0=![];if(_0x19d531[_0x65f3('0x29')]===0x0){if(_0xce4321||_0x6fa452){_0x14d9d0=!![];}if(_0x57b9ae){_0x14d9d0=![];}}if(_0x14d9d0){return _0xe4a323;}var _0x73a340=_[_0x65f3('0x2a')](db[_0x65f3('0x2b')][_0x65f3('0x2c')],function(_0x1d2328){return{'name':_0x1d2328['fieldName'],'type':_0x1d2328[_0x65f3('0x2d')][_0x65f3('0x2e')]};});_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x2f')]='agent';_0x1a73cd[_0x65f3('0x14')]['online']=!![];_0x1f5a4c=qs[_0x65f3('0x30')](_0x73a340,_0x1a73cd);_0x1f5a4c[_0x65f3('0x31')]=!![];var _0x41919d=[];if(_0x19d531['length']>0x0){_0x41919d[_0x65f3('0x32')]({'id':{'$in':_0x19d531}});if(_0x463fef&&!_0x6fa452){_0x3feec2=[db[_0x65f3('0x33')][_0x65f3('0x34')](_0x65f3('0x35')+_0x19d531+')')];_0x1f5a4c[_0x65f3('0x23')]=_0x3feec2;}}if(_0x57b9ae){_0x19acee[_0x65f3('0x36')](function(_0x17d2e9){var _0x42c80f=!![];if(_0x6fa452==='*pause'&&_0x2249ab!==_0x17d2e9){_0x42c80f=![];}_0x41919d['push']({[_0x17d2e9+_0x65f3('0x37')]:_0x42c80f});});if(_0x437621){_0x41919d[_0x65f3('0x32')]({'pauseType':_0x437621});}}else if(_0x6fa452){_0x19acee['forEach'](function(_0x16d14b){_0x41919d['push']({[_0x16d14b+_0x65f3('0x37')]:![]});});}_0x1f5a4c[_0x65f3('0x38')]=_['merge'](_0x1f5a4c[_0x65f3('0x38')],{'$and':_0x41919d});if(_0x1a73cd[_0x65f3('0x39')][_0x65f3('0x2f')]===_0x65f3('0x39')){var _0x3da66b={'params':{'id':_0x1a73cd[_0x65f3('0x39')][_0x65f3('0x3a')]},'query':{'section':_0x65f3('0x3b'),'role':'agent','online':!![],'raw':!![],'ids':_0x19d531,'customSorting':_0x3feec2}};if(_0x57b9ae){_0x3da66b[_0x65f3('0x14')]['extraQueryConditions']=_0x41919d;}_0x3da66b['query']=Object['assign'](_0x3da66b[_0x65f3('0x14')],_0x1a73cd[_0x65f3('0x14')]);delete _0x3da66b[_0x65f3('0x14')]['id'];return db[_0x65f3('0x3c')][_0x65f3('0x3d')](_0x3da66b);}return db['User'][_0x65f3('0x3e')](_0x1f5a4c);})['then'](function(_0x3130ef){_0xe4a323['count']=_0x3130ef[_0x65f3('0xd')];_0x1930b3=_0x3130ef[_0x65f3('0x26')];return _0x1930b3[_0x65f3('0x2a')](function(_0x280404){var _0x2bd210=_[_0x65f3('0x3f')](_0x453739,['id',_0x280404['id']]);if(_0x2bd210){var _0x32bf71=rta[_0x65f3('0x40')](_0x2bd210);_[_0x65f3('0x41')](_0x280404,_0x32bf71);}_0x280404[_0x65f3('0x1f')]=rta[_0x65f3('0x42')](_0x280404);if(_0x280404['globalStatus'][_0x65f3('0x1e')](_0x65f3('0x17'))){_0x19acee[_0x65f3('0x36')](function(_0x29a434){if(_0x280404[_0x29a434+'Pause']){_0x280404[_0x29a434+_0x65f3('0x43')]=_0x65f3('0x17');}});}return _0x280404;});})['then'](function(_0x580a1c){if(!_0x463fef||_0x3feec2){return _0x580a1c;}return rta[_0x65f3('0x44')](_0x580a1c,_0x463fef);})[_0x65f3('0x19')](function(_0x5f0e2c){var _0x5c086b=null;if(_0x1a73cd[_0x65f3('0x14')]['fields']){var _0x45911a=_0x1a73cd[_0x65f3('0x14')][_0x65f3('0x21')][_0x65f3('0x45')](',');_0x5c086b=_0x5f0e2c['map'](function(_0x189baf){return _['pick'](_0x189baf,_0x45911a);});}_0xe4a323[_0x65f3('0x26')]=_0x5c086b||_0x5f0e2c;return _0xe4a323;})['then'](respondWithFilteredResult(_0x34156b,_0x1f5a4c))['catch'](APIHandleError(_0x34156b));};exports['getQueues']=function(_0x584cdf,_0x216042){var _0x205023={'count':0x0,'rows':[]};var _0x1c3622={};var _0x2f6ead;var _0x144045;var _0x59e5b5;Promise[_0x65f3('0x18')]()[_0x65f3('0x19')](function(){if(_0x584cdf[_0x65f3('0x14')]['channel']){if(!utils[_0x65f3('0x1b')](_0x584cdf[_0x65f3('0x14')][_0x65f3('0x1a')])){throw new APIBadRequestError(util[_0x65f3('0x1c')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x584cdf[_0x65f3('0x14')][_0x65f3('0x1a')]));}_0x2f6ead=_0x584cdf[_0x65f3('0x14')][_0x65f3('0x1a')][_0x65f3('0x46')]();}var _0x29a069=_[_0x65f3('0x47')](_0x2f6ead)+_0x65f3('0x48');var _0x5e586e=_[_0x65f3('0x2a')](db[_0x29a069]['rawAttributes'],function(_0x13af2b){return{'name':_0x13af2b['fieldName'],'type':_0x13af2b[_0x65f3('0x2d')][_0x65f3('0x2e')]};});if(!_0x584cdf['query']['fields']){var _0xea9593=['id',_0x65f3('0x49')];if(_0x2f6ead===_0x65f3('0x4a')){_0xea9593[_0x65f3('0x32')](_0x65f3('0x2d'));if(_0x584cdf[_0x65f3('0x14')][_0x65f3('0x2d')]===_0x65f3('0x4b')){_0xea9593['push']([_0x65f3('0x4c'),_0x65f3('0x4d')]);}}_0x584cdf['query'][_0x65f3('0x21')]=_0xea9593[_0x65f3('0x22')](',');}_0x1c3622=qs['getOptions'](_0x5e586e,_0x584cdf);if(_0x584cdf['user']['role']===_0x65f3('0x39')){var _0x5b20d9={'params':{'id':_0x584cdf[_0x65f3('0x39')][_0x65f3('0x3a')]},'query':{'section':_0x2f6ead===_0x65f3('0x4a')&&_0x584cdf[_0x65f3('0x14')][_0x65f3('0x2d')]===_0x65f3('0x4b')?'QueueCampaigns':_[_0x65f3('0x47')](_0x2f6ead)+_0x65f3('0x4e'),'type':_0x584cdf[_0x65f3('0x14')][_0x65f3('0x2d')],'nolimit':!![],'sort':_0x65f3('0x49'),'filter':_0x584cdf[_0x65f3('0x14')][_0x65f3('0x4f')]}};return db[_0x65f3('0x3c')][_0x65f3('0x3d')](_0x5b20d9);}return db[_0x29a069][_0x65f3('0x3e')](_0x1c3622);})['then'](function(_0x1ca83c){_0x205023['count']=_0x1ca83c['count'];_0x144045=_0x1ca83c['rows'];return rtq[_0x65f3('0x50')](_0x584cdf,_0x2f6ead);})[_0x65f3('0x19')](function(_0x4c58dc){_0x59e5b5=_0x4c58dc[_0x65f3('0x26')];return rtq[_0x65f3('0x51')](_0x144045,_0x59e5b5,_0x2f6ead,_0x584cdf['query'][_0x65f3('0x2d')]);})[_0x65f3('0x19')](function(_0x3e89a1){_0x205023[_0x65f3('0x26')]=_0x3e89a1;return _0x205023;})[_0x65f3('0x19')](respondWithFilteredResult(_0x216042,_0x1c3622))['catch'](APIHandleError(_0x216042));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 374ff57..0ce2a03 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x388fa6,_0x31a305){var _0x38608b=function(_0x350604){while(--_0x350604){_0x388fa6['push'](_0x388fa6['shift']());}};_0x38608b(++_0x31a305);}(_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(_0xd948e7,_0x2f9dd1){var _0x323d00=function(_0x4a3b72){while(--_0x4a3b72){_0xd948e7['push'](_0xd948e7['shift']());}};_0x323d00(++_0x2f9dd1);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 86f687e..482c8e7 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 _0x7d10=['DATE','STRING','exports','INTEGER'];(function(_0xa1dd6e,_0x240caa){var _0x5463da=function(_0x5f2834){while(--_0x5f2834){_0xa1dd6e['push'](_0xa1dd6e['shift']());}};_0x5463da(++_0x240caa);}(_0x7d10,0x1ce));var _0x07d1=function(_0x292e26,_0x5884a2){_0x292e26=_0x292e26-0x0;var _0x55e14f=_0x7d10[_0x292e26];return _0x55e14f;};'use strict';var Sequelize=require('sequelize');module[_0x07d1('0x0')]={'state':{'type':Sequelize[_0x07d1('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x07d1('0x2')]},'uniqueid':{'type':Sequelize[_0x07d1('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x07d1('0x2')]},'ringtime':{'type':Sequelize[_0x07d1('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x07d1('0x3')]},'membername':{'type':Sequelize[_0x07d1('0x3')]}}; \ No newline at end of file +var _0xd819=['DATE','exports','INTEGER','STRING'];(function(_0x1738cb,_0x380e13){var _0x5772cf=function(_0x38c832){while(--_0x38c832){_0x1738cb['push'](_0x1738cb['shift']());}};_0x5772cf(++_0x380e13);}(_0xd819,0x181));var _0x9d81=function(_0x5524a1,_0x37c171){_0x5524a1=_0x5524a1-0x0;var _0x4ea5e3=_0xd819[_0x5524a1];return _0x4ea5e3;};'use strict';var Sequelize=require('sequelize');module[_0x9d81('0x0')]={'state':{'type':Sequelize[_0x9d81('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x9d81('0x2')]},'scheduledat':{'type':Sequelize[_0x9d81('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9d81('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9d81('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x9d81('0x2')]},'membername':{'type':Sequelize[_0x9d81('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 1b5eae7..65d69b1 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 _0x17fb=['report_agent_preview','util','api','moment','bluebird','request-promise','path','./reportAgentPreview.attributes','exports','define','ReportAgentPreview'];(function(_0x1a07bb,_0x4fb447){var _0x5af6e1=function(_0x2d8ceb){while(--_0x2d8ceb){_0x1a07bb['push'](_0x1a07bb['shift']());}};_0x5af6e1(++_0x4fb447);}(_0x17fb,0x18d));var _0xb17f=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x17fb[_0x420d8d];return _0x4865d7;};'use strict';var _=require('lodash');var util=require(_0xb17f('0x0'));var logger=require('../../config/logger')(_0xb17f('0x1'));var moment=require(_0xb17f('0x2'));var BPromise=require(_0xb17f('0x3'));var rp=require(_0xb17f('0x4'));var fs=require('fs');var path=require(_0xb17f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb17f('0x6'));module[_0xb17f('0x7')]=function(_0x3594dd,_0x2725f1){return _0x3594dd[_0xb17f('0x8')](_0xb17f('0x9'),attributes,{'tableName':_0xb17f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb55f=['../../config/logger','api','moment','bluebird','path','../../config/environment','./reportAgentPreview.attributes','exports','report_agent_preview','lodash'];(function(_0x1839fc,_0x117f31){var _0x20a925=function(_0x4e9072){while(--_0x4e9072){_0x1839fc['push'](_0x1839fc['shift']());}};_0x20a925(++_0x117f31);}(_0xb55f,0x81));var _0xfb55=function(_0x916883,_0x47c168){_0x916883=_0x916883-0x0;var _0x1f5382=_0xb55f[_0x916883];return _0x1f5382;};'use strict';var _=require(_0xfb55('0x0'));var util=require('util');var logger=require(_0xfb55('0x1'))(_0xfb55('0x2'));var moment=require(_0xfb55('0x3'));var BPromise=require(_0xfb55('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb55('0x5'));var rimraf=require('rimraf');var config=require(_0xfb55('0x6'));var attributes=require(_0xfb55('0x7'));module[_0xfb55('0x8')]=function(_0x5275e,_0x13037f){return _0x5275e['define']('ReportAgentPreview',attributes,{'tableName':_0xfb55('0x9'),'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 6198aa6..ebf1b2e 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 _0x5ad9=['result','catch','create','options','info','CreateReportAgentPreview','debug','lodash','util','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x32f80d,_0x4e5317){var _0x1d2111=function(_0x49eecd){while(--_0x49eecd){_0x32f80d['push'](_0x32f80d['shift']());}};_0x1d2111(++_0x4e5317);}(_0x5ad9,0x91));var _0x95ad=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5ad9[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x95ad('0x0'));var util=require(_0x95ad('0x1'));var moment=require(_0x95ad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ad('0x3'));var logger=require('../../config/logger')(_0x95ad('0x4'));var config=require(_0x95ad('0x5'));var jayson=require(_0x95ad('0x6'));var client=jayson[_0x95ad('0x7')][_0x95ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f0f40,_0x4ff18a,_0x5e715e){return new BPromise(function(_0x157d51,_0x2a6bf4){return client['request'](_0x5f0f40,_0x5e715e)[_0x95ad('0x9')](function(_0x227cb4){logger['info'](_0x95ad('0xa'),_0x4ff18a,'request\x20sent');logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x4ff18a,'request\x20sent',JSON[_0x95ad('0xb')](_0x227cb4));if(_0x227cb4['error']){if(_0x227cb4[_0x95ad('0xc')][_0x95ad('0xd')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x4ff18a,_0x227cb4[_0x95ad('0xc')][_0x95ad('0xe')]);return _0x2a6bf4(_0x227cb4[_0x95ad('0xc')][_0x95ad('0xe')]);}logger['error'](_0x95ad('0xa'),_0x4ff18a,_0x227cb4[_0x95ad('0xc')][_0x95ad('0xe')]);return _0x157d51(_0x227cb4[_0x95ad('0xc')][_0x95ad('0xe')]);}else{logger['info'](_0x95ad('0xa'),_0x4ff18a,_0x95ad('0xf'));_0x157d51(_0x227cb4[_0x95ad('0x10')][_0x95ad('0xe')]);}})[_0x95ad('0x11')](function(_0x384924){logger[_0x95ad('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x4ff18a,_0x384924);_0x2a6bf4(_0x384924);});});}exports['CreateReportAgentPreview']=function(_0xf9a6c2){var _0x119c5d=this;return new Promise(function(_0x414350,_0x2e9f38){return db['ReportAgentPreview'][_0x95ad('0x12')](_0xf9a6c2['body'],{'raw':_0xf9a6c2[_0x95ad('0x13')]?_0xf9a6c2['options']['raw']===undefined?!![]:![]:!![]})[_0x95ad('0x9')](function(_0x2f3a7b){logger[_0x95ad('0x14')](_0x95ad('0x15'),_0xf9a6c2);logger[_0x95ad('0x16')]('CreateReportAgentPreview',_0xf9a6c2,JSON[_0x95ad('0xb')](_0x2f3a7b));_0x414350(_0x2f3a7b);})[_0x95ad('0x11')](function(_0x1d6839){logger[_0x95ad('0xc')](_0x95ad('0x15'),_0x1d6839[_0x95ad('0xe')],_0xf9a6c2);_0x2e9f38(_0x119c5d[_0x95ad('0xc')](0x1f4,_0x1d6839[_0x95ad('0xe')]));});});}; \ No newline at end of file +var _0xc459=['request','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x8cdad8,_0x5a2b10){var _0x34adad=function(_0x1b33aa){while(--_0x1b33aa){_0x8cdad8['push'](_0x8cdad8['shift']());}};_0x34adad(++_0x5a2b10);}(_0xc459,0xc5));var _0x9c45=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc459[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9c45('0x0'));var util=require(_0x9c45('0x1'));var moment=require(_0x9c45('0x2'));var BPromise=require(_0x9c45('0x3'));var rs=require(_0x9c45('0x4'));var fs=require('fs');var Redis=require(_0x9c45('0x5'));var db=require(_0x9c45('0x6'))['db'];var utils=require(_0x9c45('0x7'));var logger=require(_0x9c45('0x8'))(_0x9c45('0x9'));var config=require(_0x9c45('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x9c45('0xb')][_0x9c45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5960b4,_0x2efac3,_0x120aa9){return new BPromise(function(_0x8f4649,_0x26ad86){return client[_0x9c45('0xd')](_0x5960b4,_0x120aa9)['then'](function(_0x3764bf){logger[_0x9c45('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x2efac3,_0x9c45('0xf'));logger[_0x9c45('0x10')](_0x9c45('0x11'),_0x2efac3,'request\x20sent',JSON[_0x9c45('0x12')](_0x3764bf));if(_0x3764bf[_0x9c45('0x13')]){if(_0x3764bf['error']['code']===0x1f4){logger['error'](_0x9c45('0x14'),_0x2efac3,_0x3764bf[_0x9c45('0x13')][_0x9c45('0x15')]);return _0x26ad86(_0x3764bf['error'][_0x9c45('0x15')]);}logger[_0x9c45('0x13')](_0x9c45('0x14'),_0x2efac3,_0x3764bf[_0x9c45('0x13')][_0x9c45('0x15')]);return _0x8f4649(_0x3764bf[_0x9c45('0x13')][_0x9c45('0x15')]);}else{logger[_0x9c45('0xe')](_0x9c45('0x14'),_0x2efac3,_0x9c45('0xf'));_0x8f4649(_0x3764bf[_0x9c45('0x16')][_0x9c45('0x15')]);}})['catch'](function(_0x188eea){logger[_0x9c45('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x2efac3,_0x188eea);_0x26ad86(_0x188eea);});});}exports[_0x9c45('0x17')]=function(_0x2a3d22){var _0x1594d3=this;return new Promise(function(_0x20bbbb,_0x372f75){return db[_0x9c45('0x18')][_0x9c45('0x19')](_0x2a3d22[_0x9c45('0x1a')],{'raw':_0x2a3d22[_0x9c45('0x1b')]?_0x2a3d22[_0x9c45('0x1b')][_0x9c45('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x273966){logger[_0x9c45('0xe')](_0x9c45('0x17'),_0x2a3d22);logger[_0x9c45('0x10')](_0x9c45('0x17'),_0x2a3d22,JSON[_0x9c45('0x12')](_0x273966));_0x20bbbb(_0x273966);})[_0x9c45('0x1d')](function(_0x2d8e93){logger['error'](_0x9c45('0x17'),_0x2d8e93[_0x9c45('0x15')],_0x2a3d22);_0x372f75(_0x1594d3[_0x9c45('0x13')](0x1f4,_0x2d8e93[_0x9c45('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 291c9a6..210da30 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 _0xb503=['/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','post','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','express','Router','../../components/auth/service','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','/agents','agents','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xb503,0x161));var _0x3b50=function(_0x3aa1f5,_0x118a87){_0x3aa1f5=_0x3aa1f5-0x0;var _0x13b0af=_0xb503[_0x3aa1f5];return _0x13b0af;};'use strict';var multer=require(_0x3b50('0x0'));var util=require(_0x3b50('0x1'));var path=require(_0x3b50('0x2'));var express=require(_0x3b50('0x3'));var router=express[_0x3b50('0x4')]();var auth=require(_0x3b50('0x5'));var controller=require('./rpc.controller');router['get'](_0x3b50('0x6'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x8')]);router[_0x3b50('0x9')](_0x3b50('0xa'),auth[_0x3b50('0x7')](),controller[_0x3b50('0xb')]);router['get'](_0x3b50('0xc'),auth['isAuthenticated'](),controller[_0x3b50('0xd')]);router[_0x3b50('0x9')](_0x3b50('0xe'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x3b50('0x9')](_0x3b50('0xf'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x10')]);router[_0x3b50('0x9')](_0x3b50('0x11'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x12')]);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0x3b50('0x13')]);router[_0x3b50('0x9')](_0x3b50('0x14'),auth[_0x3b50('0x7')](),controller['openchannelQueues']);router[_0x3b50('0x9')]('/sms/queues',auth[_0x3b50('0x7')](),controller[_0x3b50('0x15')]);router[_0x3b50('0x9')](_0x3b50('0x16'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x17')]);router['get'](_0x3b50('0x18'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x19')]);router[_0x3b50('0x9')](_0x3b50('0x1a'),auth['isAuthenticated'](),controller[_0x3b50('0x1b')]);router['get'](_0x3b50('0x1c'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x1d')]);router[_0x3b50('0x9')](_0x3b50('0x1e'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x1f')]);router[_0x3b50('0x9')](_0x3b50('0x20'),auth['isAuthenticated'](),controller[_0x3b50('0x21')]);router[_0x3b50('0x9')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x3b50('0x22')]);router[_0x3b50('0x9')](_0x3b50('0x23'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x24')]);router[_0x3b50('0x25')](_0x3b50('0x23'),auth[_0x3b50('0x7')](),controller['updateVoiceQueue']);router[_0x3b50('0x9')](_0x3b50('0x26'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x27')]);router[_0x3b50('0x9')](_0x3b50('0x28'),auth[_0x3b50('0x7')](),controller['outboundChannels']);router[_0x3b50('0x9')](_0x3b50('0x29'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x2a')]);router[_0x3b50('0x25')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0x3b50('0x9')]('/telephones',auth[_0x3b50('0x7')](),controller[_0x3b50('0x2b')]);router['get'](_0x3b50('0x2c'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x2d')]);router['get'](_0x3b50('0x2e'),auth[_0x3b50('0x7')](),controller['campaigns']);router['get']('/fax/accounts',auth[_0x3b50('0x7')](),controller[_0x3b50('0x2f')]);router[_0x3b50('0x9')](_0x3b50('0x30'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x31')]);router[_0x3b50('0x9')](_0x3b50('0x32'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x33')]);router[_0x3b50('0x9')](_0x3b50('0x34'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x35')]);router[_0x3b50('0x9')](_0x3b50('0x36'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x37')]);router[_0x3b50('0x9')]('/sms/queues/waitinginteractions',auth[_0x3b50('0x7')](),controller['smsQueuesWaitingInteractions']);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x3b50('0x7')](),controller[_0x3b50('0x38')]);router[_0x3b50('0x9')](_0x3b50('0x39'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x3a')]);router['post']('/mail/queues/:id/notify',auth[_0x3b50('0x7')](),controller[_0x3b50('0x3b')](_0x3b50('0x3c')));router[_0x3b50('0x9')](_0x3b50('0x3d'),auth[_0x3b50('0x7')](),controller['showMailQueues']);router[_0x3b50('0x3e')]('/chat/queues/:id/notify',auth[_0x3b50('0x7')](),controller[_0x3b50('0x3b')](_0x3b50('0x3f')));router[_0x3b50('0x9')](_0x3b50('0x40'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x41')]);router['post'](_0x3b50('0x42'),auth['isAuthenticated'](),controller[_0x3b50('0x3b')](_0x3b50('0x43')));router[_0x3b50('0x9')](_0x3b50('0x44'),auth['isAuthenticated'](),controller[_0x3b50('0x45')]);router['post'](_0x3b50('0x46'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x3b')]('openchannel'));router['get']('/openchannel/queues/:id',auth[_0x3b50('0x7')](),controller[_0x3b50('0x47')]);router[_0x3b50('0x3e')](_0x3b50('0x48'),auth['isAuthenticated'](),controller[_0x3b50('0x3b')](_0x3b50('0x49')));router[_0x3b50('0x3e')]('/whatsapp/queues/:id/notify',auth[_0x3b50('0x7')](),controller[_0x3b50('0x3b')](_0x3b50('0x4a')));router[_0x3b50('0x9')](_0x3b50('0x4b'),auth[_0x3b50('0x7')](),controller[_0x3b50('0x4c')]);router[_0x3b50('0x9')](_0x3b50('0x4d'),auth['isAuthenticated'](),controller[_0x3b50('0x4e')]);router['post'](_0x3b50('0x4f'),auth[_0x3b50('0x7')](),controller['agentNotify']);module[_0x3b50('0x50')]=router; \ No newline at end of file +var _0xa008=['/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/trunks','trunks'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0xa008,0x11a));var _0x8a00=function(_0x4221d5,_0x1d1ea2){_0x4221d5=_0x4221d5-0x0;var _0x107774=_0xa008[_0x4221d5];return _0x107774;};'use strict';var multer=require(_0x8a00('0x0'));var util=require(_0x8a00('0x1'));var path=require(_0x8a00('0x2'));var express=require(_0x8a00('0x3'));var router=express[_0x8a00('0x4')]();var auth=require(_0x8a00('0x5'));var controller=require(_0x8a00('0x6'));router['get']('/voice/channels',auth[_0x8a00('0x7')](),controller['voiceChannels']);router[_0x8a00('0x8')](_0x8a00('0x9'),auth[_0x8a00('0x7')](),controller[_0x8a00('0xa')]);router[_0x8a00('0x8')](_0x8a00('0xb'),auth['isAuthenticated'](),controller[_0x8a00('0xc')]);router[_0x8a00('0x8')](_0x8a00('0xd'),auth[_0x8a00('0x7')](),controller['voiceQueues']);router[_0x8a00('0x8')](_0x8a00('0xe'),auth[_0x8a00('0x7')](),controller[_0x8a00('0xf')]);router[_0x8a00('0x8')](_0x8a00('0x10'),auth[_0x8a00('0x7')](),controller['mailQueues']);router[_0x8a00('0x8')](_0x8a00('0x11'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x12')]);router[_0x8a00('0x8')](_0x8a00('0x13'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x14')]);router[_0x8a00('0x8')]('/sms/queues',auth[_0x8a00('0x7')](),controller[_0x8a00('0x15')]);router['get'](_0x8a00('0x16'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x17')]);router[_0x8a00('0x8')](_0x8a00('0x18'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x19')]);router['get'](_0x8a00('0x1a'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x1b')]);router[_0x8a00('0x8')](_0x8a00('0x1c'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x1d')]);router[_0x8a00('0x8')]('/voice/queues/channels/:uniqueid',auth[_0x8a00('0x7')](),controller[_0x8a00('0x1e')]);router[_0x8a00('0x8')](_0x8a00('0x1f'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x20')]);router[_0x8a00('0x8')](_0x8a00('0x21'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x22')]);router[_0x8a00('0x8')](_0x8a00('0x23'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x8a00('0x24')](_0x8a00('0x23'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x25')]);router['get']('/outbound',auth[_0x8a00('0x7')](),controller[_0x8a00('0x26')]);router[_0x8a00('0x8')](_0x8a00('0x27'),auth[_0x8a00('0x7')](),controller['outboundChannels']);router['get'](_0x8a00('0x28'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x29')]);router[_0x8a00('0x24')](_0x8a00('0x2a'),auth['isAuthenticated'](),controller[_0x8a00('0x2b')]);router[_0x8a00('0x8')]('/telephones',auth[_0x8a00('0x7')](),controller['telephones']);router[_0x8a00('0x8')](_0x8a00('0x2c'),auth['isAuthenticated'](),controller[_0x8a00('0x2d')]);router[_0x8a00('0x8')](_0x8a00('0x2e'),auth['isAuthenticated'](),controller[_0x8a00('0x2f')]);router[_0x8a00('0x8')](_0x8a00('0x30'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x31')]);router[_0x8a00('0x8')](_0x8a00('0x32'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x33')]);router[_0x8a00('0x8')](_0x8a00('0x34'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x35')]);router[_0x8a00('0x8')](_0x8a00('0x36'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x37')]);router[_0x8a00('0x8')](_0x8a00('0x38'),auth[_0x8a00('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x8a00('0x8')](_0x8a00('0x39'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x3a')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x8a00('0x7')](),controller[_0x8a00('0x3b')]);router[_0x8a00('0x8')]('/fax/queues/waitinginteractions',auth[_0x8a00('0x7')](),controller[_0x8a00('0x3c')]);router[_0x8a00('0x3d')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x8a00('0x3e')](_0x8a00('0x3f')));router['get'](_0x8a00('0x40'),auth['isAuthenticated'](),controller[_0x8a00('0x41')]);router[_0x8a00('0x3d')](_0x8a00('0x42'),auth['isAuthenticated'](),controller[_0x8a00('0x3e')]('chat'));router[_0x8a00('0x8')](_0x8a00('0x43'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x8a00('0x3d')](_0x8a00('0x44'),auth['isAuthenticated'](),controller[_0x8a00('0x3e')](_0x8a00('0x45')));router[_0x8a00('0x8')](_0x8a00('0x46'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x47')]);router[_0x8a00('0x3d')]('/openchannel/queues/:id/notify',auth[_0x8a00('0x7')](),controller['queueNotify'](_0x8a00('0x48')));router[_0x8a00('0x8')]('/openchannel/queues/:id',auth[_0x8a00('0x7')](),controller['showOpenchannelQueues']);router['post'](_0x8a00('0x49'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x3e')](_0x8a00('0x4a')));router[_0x8a00('0x3d')](_0x8a00('0x4b'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x3e')]('whatsapp'));router[_0x8a00('0x8')](_0x8a00('0x4c'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x4d')]);router[_0x8a00('0x8')]('/whatsapp/queues/:id',auth[_0x8a00('0x7')](),controller[_0x8a00('0x4e')]);router[_0x8a00('0x3d')](_0x8a00('0x4f'),auth[_0x8a00('0x7')](),controller[_0x8a00('0x50')]);module[_0x8a00('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 304283b..dac6c6e 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 _0x032e=['MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','queue_id','uniq','value','filter','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','Interaction','update','queue','MessageId','InteractionId','From','TransferReport','agentNotify','Channel\x20field\x20is\x20mandatory','channel','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','create','Start','bluebird','lodash','util','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','params','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesChannels','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x032e,0x124));var _0xe032=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x032e[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0xe032('0x0'));var moment=require('moment');var _=require(_0xe032('0x1'));var util=require(_0xe032('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xe032('0x3'));var jayson=require(_0xe032('0x4'));var amiClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232a});var mailClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232b});var routingClient=jayson[_0xe032('0x5')][_0xe032('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){var _0x3b0ef8=_0x3289b0?_0x3289b0:amiClient;return _0x3b0ef8[_0xe032('0x7')](_0x37432f,_0x1576c8)[_0xe032('0x8')](function(_0x2dc9e5){if(_0x2dc9e5[_0xe032('0x9')]){if(_0x2dc9e5['error'][_0xe032('0xa')]===0x1f4){return _0xaf3907(_0x2dc9e5[_0xe032('0x9')][_0xe032('0xb')]);}return _0xd84027(_0x2dc9e5[_0xe032('0x9')][_0xe032('0xb')]);}else{_0xd84027(_0x2dc9e5[_0xe032('0xc')]);}})[_0xe032('0xd')](function(_0x5bcb5b){_0xaf3907(_0x5bcb5b);});});}function respondWithResult(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xc8;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0xe')](_0x266d71)['json'](_0x28c2b6);}return _0x646979[_0xe032('0xf')](0x194);};}function handleError(_0x2e267b,_0x176547){_0x176547=_0x176547||0x1f4;return function(_0x422e96){logger[_0xe032('0x9')](_0x422e96[_0xe032('0x10')]);if(_0x422e96[_0xe032('0x11')]){delete _0x422e96['name'];}_0x2e267b[_0xe032('0xe')](_0x176547)[_0xe032('0x12')](_0x422e96);};}function findById(_0x36fb7c){return function(_0x3b57d3){if(!_[_0xe032('0x13')](_0x36fb7c)&&!_[_0xe032('0x13')](_0x3b57d3)&&!_['isNil'](_0x3b57d3[_0xe032('0x14')])){return _[_0xe032('0x15')](_0x3b57d3[_0xe032('0x14')],function(_0x41d2a5){return _0x41d2a5['id']==_0x36fb7c;});}return null;};}exports[_0xe032('0x16')]=function(_0x5721ce,_0x4b644b){return respondWithRpcPromise('VoiceChannels',_0x5721ce[_0xe032('0x17')])['then'](respondWithResult(_0x4b644b,null))[_0xe032('0xd')](handleError(_0x4b644b,null));};exports[_0xe032('0x18')]=function(_0x3f0257,_0x2aa342){return respondWithRpcPromise(_0xe032('0x19'),_[_0xe032('0x1a')](_0x3f0257[_0xe032('0x17')],_0x3f0257['params']))[_0xe032('0x8')](respondWithResult(_0x2aa342,null))[_0xe032('0xd')](handleError(_0x2aa342,null));};exports[_0xe032('0x1b')]=function(_0x2be433,_0x2ca592){return respondWithRpcPromise(_0xe032('0x1c'),_[_0xe032('0x1a')](_0x2be433[_0xe032('0x17')],_0x2be433['params']))['then'](respondWithResult(_0x2ca592,null))['catch'](handleError(_0x2ca592,null));};exports[_0xe032('0x1d')]=function(_0x2568ce,_0x302559){return respondWithRpcPromise(_0xe032('0x1e'),_0x2568ce[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x302559,null))[_0xe032('0xd')](handleError(_0x302559,null));};exports[_0xe032('0x1f')]=function(_0x4dcbf1,_0x1ac20b){return respondWithRpcPromise('VoiceQueues',_0x4dcbf1[_0xe032('0x17')])[_0xe032('0x8')](findById(_0x4dcbf1[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x1ac20b,null))['catch'](handleError(_0x1ac20b,null));};exports['updateVoiceQueue']=function(_0x3e2575,_0x38e7ea){return respondWithRpcPromise(_0xe032('0x21'),_[_0xe032('0x1a')](_0x3e2575['body'],_0x3e2575['params']))['then'](respondWithResult(_0x38e7ea,null))[_0xe032('0xd')](handleError(_0x38e7ea,null));};exports[_0xe032('0x22')]=function(_0x5518ac,_0x707b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xe032('0x1a')](_0x5518ac[_0xe032('0x17')],_0x5518ac[_0xe032('0x20')]))[_0xe032('0x8')](respondWithResult(_0x707b,null))[_0xe032('0xd')](handleError(_0x707b,null));};exports['voiceQueuesChannels']=function(_0xd90bd5,_0x33634c){return respondWithRpcPromise(_0xe032('0x23'),_0xd90bd5[_0xe032('0x17')])['then'](respondWithResult(_0x33634c,null))[_0xe032('0xd')](handleError(_0x33634c,null));};exports['voiceQueuesChannel']=function(_0x2f3e59,_0x53df28){return respondWithRpcPromise(_0xe032('0x24'),_['merge'](_0x2f3e59[_0xe032('0x17')],_0x2f3e59['params']))[_0xe032('0x8')](respondWithResult(_0x53df28,null))[_0xe032('0xd')](handleError(_0x53df28,null));};exports['voiceQueuesChannelHangup']=function(_0x3e3598,_0x2fdf41){return respondWithRpcPromise(_0xe032('0x25'),_[_0xe032('0x1a')](_0x3e3598['query'],_0x3e3598[_0xe032('0x20')]))['then'](respondWithResult(_0x2fdf41,null))[_0xe032('0xd')](handleError(_0x2fdf41,null));};exports[_0xe032('0x26')]=function(_0x5d02c1,_0x450ba4){return respondWithRpcPromise(_0xe032('0x27'),_['merge'](_0x5d02c1[_0xe032('0x17')],_0x5d02c1[_0xe032('0x20')]))[_0xe032('0x8')](respondWithResult(_0x450ba4,null))[_0xe032('0xd')](handleError(_0x450ba4,null));};exports[_0xe032('0x28')]=function(_0x42f58a,_0x19ee0a){return respondWithRpcPromise(_0xe032('0x29'),_0x42f58a[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x19ee0a,null))[_0xe032('0xd')](handleError(_0x19ee0a,null));};exports[_0xe032('0x2a')]=function(_0x30571c,_0x28ba5d){return respondWithRpcPromise(_0xe032('0x2b'),_0x30571c[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x28ba5d,null))['catch'](handleError(_0x28ba5d,null));};exports[_0xe032('0x2c')]=function(_0x536c76,_0x3d02c1){var _0x2bcfb4;return respondWithRpcPromise(_0xe032('0x2d'),_0x536c76[_0xe032('0x17')])[_0xe032('0x8')](function(_0x5eccad){_0x2bcfb4=_0x5eccad;return respondWithRpcPromise(_0xe032('0x2d'),_0x536c76['query'],routingClient);})[_0xe032('0x8')](function(_0x590be2){return _[_0xe032('0x1a')]({},_0x590be2,_0x2bcfb4);})[_0xe032('0x8')](respondWithResult(_0x3d02c1,null))[_0xe032('0xd')](handleError(_0x3d02c1,null));};exports[_0xe032('0x2e')]=function(_0x4dc836,_0x477360){if(_0x4dc836['body']&&_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')]&&_0x4dc836[_0xe032('0x31')]&&_0x4dc836[_0xe032('0x31')]['name']){for(var _0x513b0c in _0x4dc836[_0xe032('0x2f')][_0xe032('0x30')]){if(_0x4dc836['body'][_0xe032('0x30')][_0xe032('0x32')](_0x513b0c)){db[_0xe032('0x33')][_0xe032('0x34')]({'where':{'channel':_0x513b0c,'membername':_0x4dc836[_0xe032('0x31')]['name'],'type':_0xe032('0x35'),'exitAt':null,'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c]&&_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0xe032('0x36')]?{'$notIn':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c]}:{'$ne':null}}})['then'](function(_0x535f34){var _0x1b0e28=moment()['format'](_0xe032('0x37'));for(var _0x277207=0x0,_0x1873a6=_0x535f34[_0xe032('0x36')];_0x277207<_0x1873a6;_0x277207+=0x1){_0x535f34[_0x277207][_0xe032('0x38')]({'exitAt':_0x1b0e28});}});for(var _0x3dfb51=0x0;_0x3dfb51<_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0xe032('0x36')];_0x3dfb51+=0x1){db['MemberReport'][_0xe032('0x39')]({'where':{'channel':_0x513b0c,'membername':_0x4dc836['user']['name'],'type':_0xe032('0x35'),'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0x3dfb51],'exitAt':null},'defaults':{'channel':_0x513b0c,'membername':_0x4dc836[_0xe032('0x31')]['name'],'interface':_[_0xe032('0x13')](_0x4dc836[_0xe032('0x31')][_0xe032('0x3a')])?util[_0xe032('0x3b')](_0xe032('0x3c'),_0x4dc836[_0xe032('0x31')][_0xe032('0x11')]):_0x4dc836['user'][_0xe032('0x3a')],'type':_0xe032('0x35'),'enterAt':moment()['format'](_0xe032('0x37')),'role':_0xe032('0x3d'),'internal':_0x4dc836[_0xe032('0x31')][_0xe032('0x3e')],'uniqueid':_0x4dc836[_0xe032('0x2f')][_0xe032('0x30')][_0x513b0c][_0x3dfb51]}});}}}}return respondWithRpcPromise(_0xe032('0x3f'),{'id':_0x4dc836[_0xe032('0x20')]['id'],'capacity':_0x4dc836[_0xe032('0x2f')][_0xe032('0x40')]},routingClient)[_0xe032('0x8')](respondWithResult(_0x477360,null))[_0xe032('0xd')](handleError(_0x477360,null));};exports[_0xe032('0x41')]=function(_0x2f8114,_0x4eabfc){return respondWithRpcPromise(_0xe032('0x42'),_0x2f8114['query'])[_0xe032('0x8')](respondWithResult(_0x4eabfc,null))[_0xe032('0xd')](handleError(_0x4eabfc,null));};exports[_0xe032('0x43')]=function(_0x11ae58,_0x41289d){return respondWithRpcPromise(_0xe032('0x44'),_0x11ae58[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x41289d,null))[_0xe032('0xd')](handleError(_0x41289d,null));};exports[_0xe032('0x45')]=function(_0x1b9012,_0x564fe0){return respondWithRpcPromise(_0xe032('0x46'),_0x1b9012[_0xe032('0x17')])['then'](respondWithResult(_0x564fe0,null))[_0xe032('0xd')](handleError(_0x564fe0,null));};exports['chatQueues']=function(_0x39b878,_0x1f2422){return respondWithRpcPromise(_0xe032('0x47'),_0x39b878[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1f2422,null))['catch'](handleError(_0x1f2422,null));};exports[_0xe032('0x48')]=function(_0x2dbc33,_0x1e1277){return respondWithRpcPromise(_0xe032('0x47'),_0x2dbc33[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x2dbc33[_0xe032('0x20')]['id']))['then'](respondWithResult(_0x1e1277,null))[_0xe032('0xd')](handleError(_0x1e1277,null));};exports[_0xe032('0x49')]=function(_0x454b29,_0x15325e){return respondWithRpcPromise(_0xe032('0x4a'),_0x454b29[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x15325e,null))[_0xe032('0xd')](handleError(_0x15325e,null));};exports[_0xe032('0x4b')]=function(_0x54c0b0,_0x795a58){return respondWithRpcPromise(_0xe032('0x4a'),_0x54c0b0[_0xe032('0x17')],routingClient)['then'](findById(_0x54c0b0[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x795a58,null))['catch'](handleError(_0x795a58,null));};exports[_0xe032('0x4c')]=function(_0x29dfa7,_0x43ad0d){return respondWithRpcPromise(_0xe032('0x4d'),_0x29dfa7[_0xe032('0x17')],mailClient)[_0xe032('0x8')](respondWithResult(_0x43ad0d,null))[_0xe032('0xd')](handleError(_0x43ad0d,null));};exports[_0xe032('0x4e')]=function(_0x1aa18e,_0x19ce2b){return respondWithRpcPromise(_0xe032('0x4f'),_0x1aa18e['query'],routingClient)[_0xe032('0x8')](respondWithResult(_0x19ce2b,null))[_0xe032('0xd')](handleError(_0x19ce2b,null));};exports[_0xe032('0x50')]=function(_0xd5cf55,_0x3d7a3f){return respondWithRpcPromise('OpenchannelQueues',_0xd5cf55[_0xe032('0x17')],routingClient)['then'](findById(_0xd5cf55[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x3d7a3f,null))[_0xe032('0xd')](handleError(_0x3d7a3f,null));};exports[_0xe032('0x51')]=function(_0x3c5eb8,_0x1ddb11){return respondWithRpcPromise(_0xe032('0x52'),_0x3c5eb8[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1ddb11,null))['catch'](handleError(_0x1ddb11,null));};exports['showSmsQueues']=function(_0x5c516a,_0x221473){return respondWithRpcPromise(_0xe032('0x52'),_0x5c516a[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x5c516a[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x221473,null))['catch'](handleError(_0x221473,null));};exports[_0xe032('0x53')]=function(_0x1d66c3,_0x1018d4){return respondWithRpcPromise('WhatsappQueues',_0x1d66c3[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x1018d4,null))[_0xe032('0xd')](handleError(_0x1018d4,null));};exports[_0xe032('0x54')]=function(_0x48063d,_0x590905){return respondWithRpcPromise('WhatsappQueues',_0x48063d[_0xe032('0x17')],routingClient)['then'](findById(_0x48063d['params']['id']))[_0xe032('0x8')](respondWithResult(_0x590905,null))[_0xe032('0xd')](handleError(_0x590905,null));};exports[_0xe032('0x55')]=function(_0x4ed078,_0x193a0f){return respondWithRpcPromise('FaxQueues',_0x4ed078[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x193a0f,null))[_0xe032('0xd')](handleError(_0x193a0f,null));};exports[_0xe032('0x56')]=function(_0x1f24ec,_0x2b987b){return respondWithRpcPromise(_0xe032('0x57'),_0x1f24ec[_0xe032('0x17')],routingClient)[_0xe032('0x8')](findById(_0x1f24ec[_0xe032('0x20')]['id']))[_0xe032('0x8')](respondWithResult(_0x2b987b,null))['catch'](handleError(_0x2b987b,null));};exports[_0xe032('0x58')]=function(_0x338ef2,_0x5aa7a6){return respondWithRpcPromise('FaxAccounts',_0x338ef2[_0xe032('0x17')])[_0xe032('0x8')](respondWithResult(_0x5aa7a6,null))[_0xe032('0xd')](handleError(_0x5aa7a6,null));};exports[_0xe032('0x59')]=function(_0x1e38bd,_0x23922e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x1e38bd[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x23922e,null))['catch'](handleError(_0x23922e,null));};exports[_0xe032('0x5a')]=function(_0x2ea4a5,_0x1c3601){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2ea4a5[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0x1c3601,null))[_0xe032('0xd')](handleError(_0x1c3601,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x52dfa0,_0xdd691c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x52dfa0[_0xe032('0x17')],routingClient)[_0xe032('0x8')](respondWithResult(_0xdd691c,null))[_0xe032('0xd')](handleError(_0xdd691c,null));};exports[_0xe032('0x5b')]=function(_0x37af62,_0x443fcc){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x37af62[_0xe032('0x17')],routingClient)[_0xe032('0x8')](function(_0x33e7c3){if(_0x37af62['query'][_0xe032('0x5c')]!==undefined){var _0x48e9c9=_(_0x33e7c3[_0xe032('0x14')])['filter']([_0x37af62[_0xe032('0x17')][_0xe032('0x5c')],_0x37af62[_0xe032('0x20')]['id']])['map'](_0xe032('0x5d'))[_0xe032('0x5e')]()[_0xe032('0x5f')]();return _0x33e7c3[_0xe032('0x14')][_0xe032('0x60')](function(_0x2a2c98){return _0x48e9c9['indexOf'](_0x2a2c98[_0xe032('0x5d')])>-0x1;});}else{return _0x33e7c3[_0xe032('0x14')]['filter'](function(_0x50fd01){return _0x50fd01[_0xe032('0x5d')]===parseInt(_0x37af62[_0xe032('0x20')]['id']);});}})[_0xe032('0x8')](respondWithResult(_0x443fcc,null))[_0xe032('0xd')](handleError(_0x443fcc,null));};exports[_0xe032('0x61')]=function(_0x54803e,_0x3a04b9){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x54803e[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x3a04b9,null))[_0xe032('0xd')](handleError(_0x3a04b9,null));};exports[_0xe032('0x62')]=function(_0x36137b,_0x2ecdc7){return respondWithRpcPromise(_0xe032('0x63'),_0x36137b[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x2ecdc7,null))[_0xe032('0xd')](handleError(_0x2ecdc7,null));};exports['faxQueuesWaitingInteractions']=function(_0x4ee54a,_0x485458){return respondWithRpcPromise(_0xe032('0x64'),_0x4ee54a[_0xe032('0x17')],routingClient)['then'](respondWithResult(_0x485458,null))[_0xe032('0xd')](handleError(_0x485458,null));};exports['queueNotify']=function(_0x5f42b1){return function(_0x2f2b74,_0x10873b){var _0x577f56,_0x4ab179;var _0x45e28d=_[_0xe032('0x65')](_0x5f42b1);var _0x51d89a=_0x5f42b1===_0xe032('0x66')?_0xe032('0x67'):_0xe032('0x68');return db[_0x45e28d+_0xe032('0x69')]['findOne']({'raw':!![],'where':{'id':_0x2f2b74[_0xe032('0x20')]['id']}})['then'](function(_0x1caebf){if(_[_0xe032('0x13')](_0x1caebf)){throw new Error(_0x45e28d+_0xe032('0x6a'));}_0x577f56=_0x1caebf;return db[_0x45e28d+'Message'][_0xe032('0x6b')]({'where':{'id':_0x2f2b74[_0xe032('0x2f')]['messageId']},'include':[{'model':db[_0x45e28d+_0xe032('0x6c')],'as':_0xe032('0x6c')},{'model':db[_0x45e28d+_0x51d89a],'as':_0xe032('0x68')}]});})[_0xe032('0x8')](function(_0x3c1b08){if(_[_0xe032('0x13')](_0x3c1b08)){throw new Error(_0x45e28d+'\x20Message\x20not\x20found');}_0x4ab179=_0x3c1b08;return _0x3c1b08[_0xe032('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0xe032('0x8')](function(){var _0x27eb0c={'uniqueid':_0x5f42b1+'.'+_0x4ab179['id']+'.'+_0x4ab179[_0xe032('0x6c')]['id'],'FromUserId':_0x2f2b74[_0xe032('0x31')]['id'],'type':_0xe032('0x6e')};_0x27eb0c[_0x45e28d+_0xe032('0x6f')]=_0x4ab179['id'];_0x27eb0c[_0x45e28d+_0xe032('0x70')]=_0x4ab179[_0xe032('0x6c')]['id'];_0x27eb0c[_0xe032('0x71')+_0x45e28d+_0x51d89a+'Id']=_0x4ab179[_0xe032('0x68')]['id'];_0x27eb0c['To'+_0x45e28d+'QueueId']=_0x577f56['id'];return db[_0x45e28d+_0xe032('0x72')]['create'](_0x27eb0c);})[_0xe032('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x5f42b1,'interaction':_0x4ab179[_0xe032('0x6c')],'message':_0x4ab179,'account':_0x4ab179[_0xe032('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x577f56[_0xe032('0x11')]+','+(_0x4ab179['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe032('0x8')](respondWithResult(_0x10873b,null))[_0xe032('0xd')](handleError(_0x10873b,null));};};exports[_0xe032('0x73')]=function(_0x4e9f83,_0x210e7a){var _0x2e6dad,_0x2d68aa;if(_['isNil'](_0x4e9f83[_0xe032('0x2f')]['channel'])){throw new Error(_0xe032('0x74'));}var _0x868fad=_0x4e9f83[_0xe032('0x2f')][_0xe032('0x75')];var _0x3ee725=_[_0xe032('0x65')](_0x868fad);var _0x205058=_0x868fad===_0xe032('0x66')?_0xe032('0x67'):_0xe032('0x68');return db['User']['findOne']({'raw':!![],'where':{'id':_0x4e9f83[_0xe032('0x20')]['id'],'role':_0xe032('0x3d')}})[_0xe032('0x8')](function(_0x1d9498){if(_['isNil'](_0x1d9498)){throw new Error(_0xe032('0x76'));}_0x2e6dad=_0x1d9498;return db[_0x3ee725+_0xe032('0x77')][_0xe032('0x6b')]({'where':{'id':_0x4e9f83[_0xe032('0x2f')]['messageId']},'include':[{'model':db[_0x3ee725+_0xe032('0x6c')],'as':_0xe032('0x6c')},{'model':db[_0x3ee725+_0x205058],'as':_0xe032('0x68')}]});})[_0xe032('0x8')](function(_0x3cf0bc){if(_[_0xe032('0x13')](_0x3cf0bc)){throw new Error(_0x3ee725+_0xe032('0x78'));}_0x2d68aa=_0x3cf0bc;return _0x3cf0bc['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x56523f={'uniqueid':_0x868fad+'.'+_0x2d68aa['id']+'.'+_0x2d68aa['Interaction']['id'],'FromUserId':_0x4e9f83['user']['id'],'type':_0xe032('0x6e'),'ToUserId':_0x2e6dad['id']};_0x56523f[_0x3ee725+_0xe032('0x6f')]=_0x2d68aa['id'];_0x56523f[_0x3ee725+_0xe032('0x70')]=_0x2d68aa[_0xe032('0x6c')]['id'];_0x56523f[_0xe032('0x71')+_0x3ee725+_0x205058+'Id']=_0x2d68aa['Account']['id'];return db[_0x3ee725+_0xe032('0x72')][_0xe032('0x79')](_0x56523f);})[_0xe032('0x8')](function(){return respondWithRpcPromise(_0xe032('0x7a'),{'channel':_0x868fad,'interaction':_0x2d68aa[_0xe032('0x6c')],'message':_0x2d68aa,'account':_0x2d68aa[_0xe032('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe032('0x3d'),'appdata':_0x2e6dad[_0xe032('0x11')]+','+(_0x2d68aa[_0xe032('0x68')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x210e7a,null))[_0xe032('0xd')](handleError(_0x210e7a,null));}; \ No newline at end of file +var _0xae24=['InteractionId','From','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','bluebird','lodash','../../mysqldb','../../config/logger','client','http','then','error','code','message','result','catch','status','json','sendStatus','name','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','params','voiceQueuesPreview','VoiceQueuesPreview','merge','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','format','length','updateAttributes','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','OpenchannelQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId'];(function(_0x5668ac,_0x220cce){var _0x56d127=function(_0xefe1cd){while(--_0xefe1cd){_0x5668ac['push'](_0x5668ac['shift']());}};_0x56d127(++_0x220cce);}(_0xae24,0x182));var _0x4ae2=function(_0x5f5604,_0x483b62){_0x5f5604=_0x5f5604-0x0;var _0x1879db=_0xae24[_0x5f5604];return _0x1879db;};'use strict';var BPromise=require(_0x4ae2('0x0'));var moment=require('moment');var _=require(_0x4ae2('0x1'));var util=require('util');var db=require(_0x4ae2('0x2'))['db'];var logger=require(_0x4ae2('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x4ae2('0x4')]['http']({'port':0x232a});var mailClient=jayson[_0x4ae2('0x4')][_0x4ae2('0x5')]({'port':0x232b});var routingClient=jayson[_0x4ae2('0x4')][_0x4ae2('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x428054,_0x307247,_0x4f2e84){return new BPromise(function(_0x5f589a,_0x41cdf1){var _0x4d3d8a=_0x4f2e84?_0x4f2e84:amiClient;return _0x4d3d8a['request'](_0x428054,_0x307247)[_0x4ae2('0x6')](function(_0xb01e8e){if(_0xb01e8e['error']){if(_0xb01e8e[_0x4ae2('0x7')][_0x4ae2('0x8')]===0x1f4){return _0x41cdf1(_0xb01e8e[_0x4ae2('0x7')][_0x4ae2('0x9')]);}return _0x5f589a(_0xb01e8e['error'][_0x4ae2('0x9')]);}else{_0x5f589a(_0xb01e8e[_0x4ae2('0xa')]);}})[_0x4ae2('0xb')](function(_0x4d7dc3){_0x41cdf1(_0x4d7dc3);});});}function respondWithResult(_0x25d2b4,_0x22ac1e){_0x22ac1e=_0x22ac1e||0xc8;return function(_0x30d6c4){if(_0x30d6c4){return _0x25d2b4[_0x4ae2('0xc')](_0x22ac1e)[_0x4ae2('0xd')](_0x30d6c4);}return _0x25d2b4[_0x4ae2('0xe')](0x194);};}function handleError(_0x145287,_0x3cabc9){_0x3cabc9=_0x3cabc9||0x1f4;return function(_0xd527a0){logger['error'](_0xd527a0['stack']);if(_0xd527a0['name']){delete _0xd527a0[_0x4ae2('0xf')];}_0x145287[_0x4ae2('0xc')](_0x3cabc9)['send'](_0xd527a0);};}function findById(_0x463765){return function(_0x9fb8db){if(!_[_0x4ae2('0x10')](_0x463765)&&!_[_0x4ae2('0x10')](_0x9fb8db)&&!_[_0x4ae2('0x10')](_0x9fb8db[_0x4ae2('0x11')])){return _[_0x4ae2('0x12')](_0x9fb8db[_0x4ae2('0x11')],function(_0x41b672){return _0x41b672['id']==_0x463765;});}return null;};}exports[_0x4ae2('0x13')]=function(_0x4d5071,_0x4a97af){return respondWithRpcPromise(_0x4ae2('0x14'),_0x4d5071[_0x4ae2('0x15')])['then'](respondWithResult(_0x4a97af,null))[_0x4ae2('0xb')](handleError(_0x4a97af,null));};exports[_0x4ae2('0x16')]=function(_0xccb3b,_0x2ad222){return respondWithRpcPromise(_0x4ae2('0x17'),_['merge'](_0xccb3b[_0x4ae2('0x15')],_0xccb3b['params']))['then'](respondWithResult(_0x2ad222,null))[_0x4ae2('0xb')](handleError(_0x2ad222,null));};exports[_0x4ae2('0x18')]=function(_0x802bf0,_0x17041e){return respondWithRpcPromise(_0x4ae2('0x19'),_['merge'](_0x802bf0[_0x4ae2('0x15')],_0x802bf0['params']))[_0x4ae2('0x6')](respondWithResult(_0x17041e,null))[_0x4ae2('0xb')](handleError(_0x17041e,null));};exports[_0x4ae2('0x1a')]=function(_0x57933b,_0x43f112){return respondWithRpcPromise(_0x4ae2('0x1b'),_0x57933b[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x43f112,null))[_0x4ae2('0xb')](handleError(_0x43f112,null));};exports[_0x4ae2('0x1c')]=function(_0x5b2e65,_0x5962b0){return respondWithRpcPromise(_0x4ae2('0x1b'),_0x5b2e65[_0x4ae2('0x15')])[_0x4ae2('0x6')](findById(_0x5b2e65[_0x4ae2('0x1d')]['id']))[_0x4ae2('0x6')](respondWithResult(_0x5962b0,null))[_0x4ae2('0xb')](handleError(_0x5962b0,null));};exports['updateVoiceQueue']=function(_0x5ec1fd,_0x3e2666){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x5ec1fd['body'],_0x5ec1fd[_0x4ae2('0x1d')]))[_0x4ae2('0x6')](respondWithResult(_0x3e2666,null))['catch'](handleError(_0x3e2666,null));};exports[_0x4ae2('0x1e')]=function(_0x37e3e5,_0x3d56ea){return respondWithRpcPromise(_0x4ae2('0x1f'),_[_0x4ae2('0x20')](_0x37e3e5[_0x4ae2('0x15')],_0x37e3e5[_0x4ae2('0x1d')]))[_0x4ae2('0x6')](respondWithResult(_0x3d56ea,null))[_0x4ae2('0xb')](handleError(_0x3d56ea,null));};exports[_0x4ae2('0x21')]=function(_0x386687,_0x12815f){return respondWithRpcPromise(_0x4ae2('0x22'),_0x386687[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x12815f,null))[_0x4ae2('0xb')](handleError(_0x12815f,null));};exports[_0x4ae2('0x23')]=function(_0x4bd47f,_0xdcd11e){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x4ae2('0x20')](_0x4bd47f[_0x4ae2('0x15')],_0x4bd47f['params']))[_0x4ae2('0x6')](respondWithResult(_0xdcd11e,null))[_0x4ae2('0xb')](handleError(_0xdcd11e,null));};exports[_0x4ae2('0x24')]=function(_0x2dde26,_0x5256d3){return respondWithRpcPromise(_0x4ae2('0x25'),_[_0x4ae2('0x20')](_0x2dde26[_0x4ae2('0x15')],_0x2dde26[_0x4ae2('0x1d')]))[_0x4ae2('0x6')](respondWithResult(_0x5256d3,null))[_0x4ae2('0xb')](handleError(_0x5256d3,null));};exports[_0x4ae2('0x26')]=function(_0x46f3a2,_0xe99f9d){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x4ae2('0x20')](_0x46f3a2['query'],_0x46f3a2[_0x4ae2('0x1d')]))[_0x4ae2('0x6')](respondWithResult(_0xe99f9d,null))[_0x4ae2('0xb')](handleError(_0xe99f9d,null));};exports[_0x4ae2('0x27')]=function(_0x771c14,_0x129adf){return respondWithRpcPromise('Outbound',_0x771c14[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x129adf,null))[_0x4ae2('0xb')](handleError(_0x129adf,null));};exports[_0x4ae2('0x28')]=function(_0x49baf9,_0x2d4737){return respondWithRpcPromise(_0x4ae2('0x29'),_0x49baf9[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x2d4737,null))[_0x4ae2('0xb')](handleError(_0x2d4737,null));};exports[_0x4ae2('0x2a')]=function(_0x1fdc61,_0x1b04ee){var _0x1d5888;return respondWithRpcPromise(_0x4ae2('0x2b'),_0x1fdc61[_0x4ae2('0x15')])['then'](function(_0x2c3676){_0x1d5888=_0x2c3676;return respondWithRpcPromise(_0x4ae2('0x2b'),_0x1fdc61[_0x4ae2('0x15')],routingClient);})[_0x4ae2('0x6')](function(_0x5bade3){return _['merge']({},_0x5bade3,_0x1d5888);})[_0x4ae2('0x6')](respondWithResult(_0x1b04ee,null))[_0x4ae2('0xb')](handleError(_0x1b04ee,null));};exports[_0x4ae2('0x2c')]=function(_0x3cdf23,_0x567371){if(_0x3cdf23[_0x4ae2('0x2d')]&&_0x3cdf23[_0x4ae2('0x2d')]['interaction']&&_0x3cdf23[_0x4ae2('0x2e')]&&_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0xf')]){for(var _0x5a9126 in _0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')]){if(_0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')][_0x4ae2('0x30')](_0x5a9126)){db[_0x4ae2('0x31')][_0x4ae2('0x32')]({'where':{'channel':_0x5a9126,'membername':_0x3cdf23[_0x4ae2('0x2e')]['name'],'type':_0x4ae2('0x33'),'exitAt':null,'uniqueid':_0x3cdf23[_0x4ae2('0x2d')]['interaction'][_0x5a9126]&&_0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')][_0x5a9126]['length']?{'$notIn':_0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')][_0x5a9126]}:{'$ne':null}}})['then'](function(_0x21baf4){var _0x2ab00f=moment()[_0x4ae2('0x34')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4fc82f=0x0,_0x26681b=_0x21baf4[_0x4ae2('0x35')];_0x4fc82f<_0x26681b;_0x4fc82f+=0x1){_0x21baf4[_0x4fc82f][_0x4ae2('0x36')]({'exitAt':_0x2ab00f});}});for(var _0x8a17a4=0x0;_0x8a17a4<_0x3cdf23['body'][_0x4ae2('0x2f')][_0x5a9126][_0x4ae2('0x35')];_0x8a17a4+=0x1){db[_0x4ae2('0x31')]['findOrCreate']({'where':{'channel':_0x5a9126,'membername':_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0xf')],'type':_0x4ae2('0x33'),'uniqueid':_0x3cdf23['body'][_0x4ae2('0x2f')][_0x5a9126][_0x8a17a4],'exitAt':null},'defaults':{'channel':_0x5a9126,'membername':_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0xf')],'interface':_[_0x4ae2('0x10')](_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0x37')])?util[_0x4ae2('0x34')](_0x4ae2('0x38'),_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0xf')]):_0x3cdf23['user'][_0x4ae2('0x37')],'type':_0x4ae2('0x33'),'enterAt':moment()[_0x4ae2('0x34')](_0x4ae2('0x39')),'role':_0x4ae2('0x3a'),'internal':_0x3cdf23[_0x4ae2('0x2e')][_0x4ae2('0x3b')],'uniqueid':_0x3cdf23[_0x4ae2('0x2d')]['interaction'][_0x5a9126][_0x8a17a4]}});}}}}return respondWithRpcPromise(_0x4ae2('0x3c'),{'id':_0x3cdf23[_0x4ae2('0x1d')]['id'],'capacity':_0x3cdf23['body'][_0x4ae2('0x3d')]},routingClient)[_0x4ae2('0x6')](respondWithResult(_0x567371,null))['catch'](handleError(_0x567371,null));};exports[_0x4ae2('0x3e')]=function(_0x4d6560,_0x426d29){return respondWithRpcPromise('Telephones',_0x4d6560[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x426d29,null))[_0x4ae2('0xb')](handleError(_0x426d29,null));};exports[_0x4ae2('0x3f')]=function(_0x8525c4,_0x153673){return respondWithRpcPromise(_0x4ae2('0x40'),_0x8525c4[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x153673,null))['catch'](handleError(_0x153673,null));};exports[_0x4ae2('0x41')]=function(_0x4284b4,_0x825c3a){return respondWithRpcPromise(_0x4ae2('0x42'),_0x4284b4['query'])[_0x4ae2('0x6')](respondWithResult(_0x825c3a,null))[_0x4ae2('0xb')](handleError(_0x825c3a,null));};exports[_0x4ae2('0x43')]=function(_0x49029e,_0x51f845){return respondWithRpcPromise(_0x4ae2('0x44'),_0x49029e[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x51f845,null))[_0x4ae2('0xb')](handleError(_0x51f845,null));};exports[_0x4ae2('0x45')]=function(_0x28d68e,_0x18a8e6){return respondWithRpcPromise(_0x4ae2('0x44'),_0x28d68e[_0x4ae2('0x15')],routingClient)['then'](findById(_0x28d68e[_0x4ae2('0x1d')]['id']))['then'](respondWithResult(_0x18a8e6,null))[_0x4ae2('0xb')](handleError(_0x18a8e6,null));};exports[_0x4ae2('0x46')]=function(_0x28e7a8,_0x2143fe){return respondWithRpcPromise(_0x4ae2('0x47'),_0x28e7a8[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x2143fe,null))[_0x4ae2('0xb')](handleError(_0x2143fe,null));};exports['showMailQueues']=function(_0x496f98,_0x33fb77){return respondWithRpcPromise(_0x4ae2('0x47'),_0x496f98[_0x4ae2('0x15')],routingClient)['then'](findById(_0x496f98['params']['id']))[_0x4ae2('0x6')](respondWithResult(_0x33fb77,null))[_0x4ae2('0xb')](handleError(_0x33fb77,null));};exports[_0x4ae2('0x48')]=function(_0x201b25,_0x41601d){return respondWithRpcPromise('MailAccounts',_0x201b25['query'],mailClient)['then'](respondWithResult(_0x41601d,null))[_0x4ae2('0xb')](handleError(_0x41601d,null));};exports['openchannelQueues']=function(_0x4e54d1,_0x17f023){return respondWithRpcPromise('OpenchannelQueues',_0x4e54d1[_0x4ae2('0x15')],routingClient)['then'](respondWithResult(_0x17f023,null))[_0x4ae2('0xb')](handleError(_0x17f023,null));};exports['showOpenchannelQueues']=function(_0xf417c0,_0x51141d){return respondWithRpcPromise(_0x4ae2('0x49'),_0xf417c0[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](findById(_0xf417c0[_0x4ae2('0x1d')]['id']))[_0x4ae2('0x6')](respondWithResult(_0x51141d,null))['catch'](handleError(_0x51141d,null));};exports['smsQueues']=function(_0x344963,_0x256d2f){return respondWithRpcPromise('SmsQueues',_0x344963[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x256d2f,null))['catch'](handleError(_0x256d2f,null));};exports[_0x4ae2('0x4a')]=function(_0xefd494,_0x49c58c){return respondWithRpcPromise('SmsQueues',_0xefd494[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](findById(_0xefd494['params']['id']))[_0x4ae2('0x6')](respondWithResult(_0x49c58c,null))[_0x4ae2('0xb')](handleError(_0x49c58c,null));};exports[_0x4ae2('0x4b')]=function(_0x30003b,_0x5af418){return respondWithRpcPromise(_0x4ae2('0x4c'),_0x30003b[_0x4ae2('0x15')],routingClient)['then'](respondWithResult(_0x5af418,null))[_0x4ae2('0xb')](handleError(_0x5af418,null));};exports[_0x4ae2('0x4d')]=function(_0x3412a1,_0x525cc5){return respondWithRpcPromise('WhatsappQueues',_0x3412a1[_0x4ae2('0x15')],routingClient)['then'](findById(_0x3412a1[_0x4ae2('0x1d')]['id']))['then'](respondWithResult(_0x525cc5,null))[_0x4ae2('0xb')](handleError(_0x525cc5,null));};exports['faxQueues']=function(_0x2758c0,_0x519763){return respondWithRpcPromise(_0x4ae2('0x4e'),_0x2758c0['query'],routingClient)['then'](respondWithResult(_0x519763,null))[_0x4ae2('0xb')](handleError(_0x519763,null));};exports[_0x4ae2('0x4f')]=function(_0x1a603b,_0xde3aac){return respondWithRpcPromise(_0x4ae2('0x4e'),_0x1a603b[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](findById(_0x1a603b[_0x4ae2('0x1d')]['id']))[_0x4ae2('0x6')](respondWithResult(_0xde3aac,null))[_0x4ae2('0xb')](handleError(_0xde3aac,null));};exports[_0x4ae2('0x50')]=function(_0x4403ed,_0x55f1fe){return respondWithRpcPromise(_0x4ae2('0x51'),_0x4403ed[_0x4ae2('0x15')])[_0x4ae2('0x6')](respondWithResult(_0x55f1fe,null))[_0x4ae2('0xb')](handleError(_0x55f1fe,null));};exports['chatQueuesWaitingInteractions']=function(_0x18f568,_0x5add54){return respondWithRpcPromise(_0x4ae2('0x52'),_0x18f568[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x5add54,null))[_0x4ae2('0xb')](handleError(_0x5add54,null));};exports[_0x4ae2('0x53')]=function(_0x318b4a,_0x4ed285){return respondWithRpcPromise(_0x4ae2('0x54'),_0x318b4a[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x4ed285,null))['catch'](handleError(_0x4ed285,null));};exports[_0x4ae2('0x55')]=function(_0x36f5c4,_0x4082d4){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x36f5c4[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x4082d4,null))[_0x4ae2('0xb')](handleError(_0x4082d4,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2bb165,_0x278c5e){return respondWithRpcPromise(_0x4ae2('0x56'),_0x2bb165[_0x4ae2('0x15')],routingClient)['then'](function(_0x390c71){if(_0x2bb165[_0x4ae2('0x15')][_0x4ae2('0x57')]!==undefined){var _0x98272b=_(_0x390c71[_0x4ae2('0x11')])[_0x4ae2('0x58')]([_0x2bb165[_0x4ae2('0x15')]['type'],_0x2bb165['params']['id']])[_0x4ae2('0x59')](_0x4ae2('0x5a'))[_0x4ae2('0x5b')]()[_0x4ae2('0x5c')]();return _0x390c71[_0x4ae2('0x11')][_0x4ae2('0x58')](function(_0x4b0606){return _0x98272b[_0x4ae2('0x5d')](_0x4b0606[_0x4ae2('0x5a')])>-0x1;});}else{return _0x390c71[_0x4ae2('0x11')][_0x4ae2('0x58')](function(_0x22a880){return _0x22a880[_0x4ae2('0x5a')]===parseInt(_0x2bb165['params']['id']);});}})[_0x4ae2('0x6')](respondWithResult(_0x278c5e,null))[_0x4ae2('0xb')](handleError(_0x278c5e,null));};exports[_0x4ae2('0x5e')]=function(_0x3a84d7,_0x1bf2a4){return respondWithRpcPromise(_0x4ae2('0x5f'),_0x3a84d7['query'],routingClient)['then'](respondWithResult(_0x1bf2a4,null))[_0x4ae2('0xb')](handleError(_0x1bf2a4,null));};exports[_0x4ae2('0x60')]=function(_0x517ecb,_0x9320c1){return respondWithRpcPromise(_0x4ae2('0x61'),_0x517ecb[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x9320c1,null))[_0x4ae2('0xb')](handleError(_0x9320c1,null));};exports[_0x4ae2('0x62')]=function(_0xc4748b,_0x51cbf9){return respondWithRpcPromise(_0x4ae2('0x63'),_0xc4748b[_0x4ae2('0x15')],routingClient)[_0x4ae2('0x6')](respondWithResult(_0x51cbf9,null))[_0x4ae2('0xb')](handleError(_0x51cbf9,null));};exports[_0x4ae2('0x64')]=function(_0x29b0d0){return function(_0x555d17,_0x2cba96){var _0x417774,_0x17f398;var _0x58474e=_[_0x4ae2('0x65')](_0x29b0d0);var _0x49da03=_0x29b0d0===_0x4ae2('0x66')?_0x4ae2('0x67'):_0x4ae2('0x68');return db[_0x58474e+_0x4ae2('0x69')][_0x4ae2('0x6a')]({'raw':!![],'where':{'id':_0x555d17['params']['id']}})[_0x4ae2('0x6')](function(_0x384c7e){if(_[_0x4ae2('0x10')](_0x384c7e)){throw new Error(_0x58474e+_0x4ae2('0x6b'));}_0x417774=_0x384c7e;return db[_0x58474e+'Message'][_0x4ae2('0x6a')]({'where':{'id':_0x555d17['body'][_0x4ae2('0x6c')]},'include':[{'model':db[_0x58474e+_0x4ae2('0x6d')],'as':'Interaction'},{'model':db[_0x58474e+_0x49da03],'as':_0x4ae2('0x68')}]});})[_0x4ae2('0x6')](function(_0x29eaf4){if(_[_0x4ae2('0x10')](_0x29eaf4)){throw new Error(_0x58474e+_0x4ae2('0x6e'));}_0x17f398=_0x29eaf4;return _0x29eaf4[_0x4ae2('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2f97d7={'uniqueid':_0x29b0d0+'.'+_0x17f398['id']+'.'+_0x17f398['Interaction']['id'],'FromUserId':_0x555d17[_0x4ae2('0x2e')]['id'],'type':_0x4ae2('0x70')};_0x2f97d7[_0x58474e+_0x4ae2('0x71')]=_0x17f398['id'];_0x2f97d7[_0x58474e+_0x4ae2('0x72')]=_0x17f398[_0x4ae2('0x6d')]['id'];_0x2f97d7[_0x4ae2('0x73')+_0x58474e+_0x49da03+'Id']=_0x17f398['Account']['id'];_0x2f97d7['To'+_0x58474e+'QueueId']=_0x417774['id'];return db[_0x58474e+_0x4ae2('0x74')][_0x4ae2('0x75')](_0x2f97d7);})[_0x4ae2('0x6')](function(){return respondWithRpcPromise(_0x4ae2('0x76'),{'channel':_0x29b0d0,'interaction':_0x17f398[_0x4ae2('0x6d')],'message':_0x17f398,'account':_0x17f398[_0x4ae2('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ae2('0x70'),'appdata':_0x417774[_0x4ae2('0xf')]+','+(_0x17f398['Account'][_0x4ae2('0x77')]||0x12c),'interval':_0x4ae2('0x78')}]},routingClient);})[_0x4ae2('0x6')](respondWithResult(_0x2cba96,null))[_0x4ae2('0xb')](handleError(_0x2cba96,null));};};exports[_0x4ae2('0x79')]=function(_0xa79171,_0xa42e4d){var _0x1deb7d,_0x8d0217;if(_[_0x4ae2('0x10')](_0xa79171[_0x4ae2('0x2d')][_0x4ae2('0x7a')])){throw new Error(_0x4ae2('0x7b'));}var _0x310f93=_0xa79171[_0x4ae2('0x2d')][_0x4ae2('0x7a')];var _0x31c1f7=_['capitalize'](_0x310f93);var _0x3de590=_0x310f93===_0x4ae2('0x66')?_0x4ae2('0x67'):'Account';return db['User'][_0x4ae2('0x6a')]({'raw':!![],'where':{'id':_0xa79171[_0x4ae2('0x1d')]['id'],'role':'agent'}})[_0x4ae2('0x6')](function(_0x21c4ec){if(_['isNil'](_0x21c4ec)){throw new Error(_0x4ae2('0x7c'));}_0x1deb7d=_0x21c4ec;return db[_0x31c1f7+'Message']['findOne']({'where':{'id':_0xa79171['body'][_0x4ae2('0x6c')]},'include':[{'model':db[_0x31c1f7+'Interaction'],'as':_0x4ae2('0x6d')},{'model':db[_0x31c1f7+_0x3de590],'as':_0x4ae2('0x68')}]});})[_0x4ae2('0x6')](function(_0x232e64){if(_[_0x4ae2('0x10')](_0x232e64)){throw new Error(_0x31c1f7+_0x4ae2('0x6e'));}_0x8d0217=_0x232e64;return _0x232e64[_0x4ae2('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4ae2('0x6')](function(){var _0x386c80={'uniqueid':_0x310f93+'.'+_0x8d0217['id']+'.'+_0x8d0217['Interaction']['id'],'FromUserId':_0xa79171[_0x4ae2('0x2e')]['id'],'type':_0x4ae2('0x70'),'ToUserId':_0x1deb7d['id']};_0x386c80[_0x31c1f7+_0x4ae2('0x71')]=_0x8d0217['id'];_0x386c80[_0x31c1f7+_0x4ae2('0x72')]=_0x8d0217['Interaction']['id'];_0x386c80[_0x4ae2('0x73')+_0x31c1f7+_0x3de590+'Id']=_0x8d0217[_0x4ae2('0x68')]['id'];return db[_0x31c1f7+_0x4ae2('0x74')]['create'](_0x386c80);})[_0x4ae2('0x6')](function(){return respondWithRpcPromise(_0x4ae2('0x76'),{'channel':_0x310f93,'interaction':_0x8d0217[_0x4ae2('0x6d')],'message':_0x8d0217,'account':_0x8d0217[_0x4ae2('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4ae2('0x3a'),'appdata':_0x1deb7d[_0x4ae2('0xf')]+','+(_0x8d0217[_0x4ae2('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x4ae2('0x78')}]},routingClient);})[_0x4ae2('0x6')](respondWithResult(_0xa42e4d,null))[_0x4ae2('0xb')](handleError(_0xa42e4d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index bcdf31c..9473b8a 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 _0xde4f=['/:id/run','post','create','put','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x34179f,_0x2def62){var _0xa31230=function(_0x2c4aee){while(--_0x2c4aee){_0x34179f['push'](_0x34179f['shift']());}};_0xa31230(++_0x2def62);}(_0xde4f,0xbb));var _0xfde4=function(_0x5e00d8,_0x5c5e9e){_0x5e00d8=_0x5e00d8-0x0;var _0x4ceaf7=_0xde4f[_0x5e00d8];return _0x4ceaf7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfde4('0x0'));var timeout=require('connect-timeout');var express=require(_0xfde4('0x1'));var router=express[_0xfde4('0x2')]();var fs_extra=require(_0xfde4('0x3'));var auth=require(_0xfde4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfde4('0x5'));var controller=require('./schedule.controller');router[_0xfde4('0x6')]('/',auth[_0xfde4('0x7')](),controller[_0xfde4('0x8')]);router[_0xfde4('0x6')](_0xfde4('0x9'),auth['isAuthenticated'](),controller[_0xfde4('0xa')]);router[_0xfde4('0x6')](_0xfde4('0xb'),auth[_0xfde4('0x7')](),controller['run']);router[_0xfde4('0xc')]('/',auth[_0xfde4('0x7')](),controller[_0xfde4('0xd')]);router[_0xfde4('0xe')]('/:id',auth[_0xfde4('0x7')](),controller[_0xfde4('0xf')]);router['delete'](_0xfde4('0x9'),auth[_0xfde4('0x7')](),controller[_0xfde4('0x10')]);module[_0xfde4('0x11')]=router; \ No newline at end of file +var _0xbc06=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','run','create','put','multer','util','path'];(function(_0x37e655,_0x57e6da){var _0xc0dda1=function(_0x4bdaaa){while(--_0x4bdaaa){_0x37e655['push'](_0x37e655['shift']());}};_0xc0dda1(++_0x57e6da);}(_0xbc06,0x7b));var _0x6bc0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc06[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6bc0('0x0'));var util=require(_0x6bc0('0x1'));var path=require(_0x6bc0('0x2'));var timeout=require(_0x6bc0('0x3'));var express=require(_0x6bc0('0x4'));var router=express[_0x6bc0('0x5')]();var fs_extra=require(_0x6bc0('0x6'));var auth=require(_0x6bc0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6bc0('0x8'));var controller=require(_0x6bc0('0x9'));router['get']('/',auth[_0x6bc0('0xa')](),controller[_0x6bc0('0xb')]);router[_0x6bc0('0xc')](_0x6bc0('0xd'),auth[_0x6bc0('0xa')](),controller['show']);router[_0x6bc0('0xc')](_0x6bc0('0xe'),auth[_0x6bc0('0xa')](),controller[_0x6bc0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6bc0('0x10')]);router[_0x6bc0('0x11')]('/:id',auth[_0x6bc0('0xa')](),controller['update']);router['delete'](_0x6bc0('0xd'),auth[_0x6bc0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 18f5a2d..341fa2b 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 _0x95d6=['hours','pdf','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','quarters','months'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x95d6,0xe6));var _0x695d=function(_0x2f7892,_0x1c26c5){_0x2f7892=_0x2f7892-0x0;var _0x2f9e9c=_0x95d6[_0x2f7892];return _0x2f9e9c;};'use strict';var Sequelize=require(_0x695d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x695d('0x1')]},'active':{'type':Sequelize[_0x695d('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x695d('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x695d('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x695d('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x695d('0x5')]('years',_0x695d('0x6'),_0x695d('0x7'),'weeks','days',_0x695d('0x8'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x695d('0x5')]('csv',_0x695d('0x9'),_0x695d('0xa')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x695d('0x5')](_0x695d('0xb'),_0x695d('0xc')),'allowNull':![],'defaultValue':_0x695d('0xb')},'sendMail':{'type':Sequelize[_0x695d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x695d('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x695d('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x695d('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc8ba=['BOOLEAN','DATE','INTEGER','years','quarters','months','days','hours','minutes','pdf','xlsx','ENUM','custom','default','TEXT','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8ba,0x97));var _0xac8b=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xc8ba[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require('sequelize');module[_0xac8b('0x0')]={'name':{'type':Sequelize[_0xac8b('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xac8b('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xac8b('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xac8b('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xac8b('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xac8b('0x5'),_0xac8b('0x6'),_0xac8b('0x7'),'weeks',_0xac8b('0x8'),_0xac8b('0x9'),_0xac8b('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv',_0xac8b('0xb'),_0xac8b('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xac8b('0xd')](_0xac8b('0xe'),_0xac8b('0xf')),'allowNull':![],'defaultValue':_0xac8b('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xac8b('0x1')]},'cc':{'type':Sequelize[_0xac8b('0x10')]},'bcc':{'type':Sequelize[_0xac8b('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xac8b('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 9ef08cc..9785cd4 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 _0x0bce=['offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Scheduler','UserProfileResource','sendStatus','stack','name','index','map','Schedule','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x0bce,0x1f4));var _0xe0bc=function(_0x1f8da0,_0xbb56b0){_0x1f8da0=_0x1f8da0-0x0;var _0x3c779c=_0x0bce[_0x1f8da0];return _0x3c779c;};'use strict';var emlformat=require(_0xe0bc('0x0'));var rimraf=require(_0xe0bc('0x1'));var zipdir=require(_0xe0bc('0x2'));var jsonpatch=require(_0xe0bc('0x3'));var rp=require(_0xe0bc('0x4'));var moment=require('moment');var BPromise=require(_0xe0bc('0x5'));var Mustache=require('mustache');var util=require(_0xe0bc('0x6'));var path=require(_0xe0bc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0bc('0x8'));var squel=require(_0xe0bc('0x9'));var crypto=require(_0xe0bc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe0bc('0xb'));var toCsv=require(_0xe0bc('0xc'));var querystring=require(_0xe0bc('0xd'));var Papa=require(_0xe0bc('0xe'));var Redis=require(_0xe0bc('0xf'));var authService=require(_0xe0bc('0x10'));var qs=require(_0xe0bc('0x11'));var as=require(_0xe0bc('0x12'));var hardwareService=require(_0xe0bc('0x13'));var logger=require(_0xe0bc('0x14'))(_0xe0bc('0x15'));var utils=require('../../config/utils');var config=require(_0xe0bc('0x16'));var licenseUtil=require(_0xe0bc('0x17'));var db=require(_0xe0bc('0x18'))['db'];function respondWithStatusCode(_0x4acd64,_0x40e384){_0x40e384=_0x40e384||0xcc;return function(_0x503abc){if(_0x503abc){return _0x4acd64['sendStatus'](_0x40e384);}return _0x4acd64['status'](_0x40e384)[_0xe0bc('0x19')]();};}function respondWithResult(_0x139069,_0x38ef73){_0x38ef73=_0x38ef73||0xc8;return function(_0x4494ab){if(_0x4494ab){return _0x139069[_0xe0bc('0x1a')](_0x38ef73)[_0xe0bc('0x1b')](_0x4494ab);}};}function respondWithFilteredResult(_0xefe1e0,_0x32b57e){return function(_0x20013a){if(_0x20013a){var _0x4e1cb4=typeof _0x32b57e[_0xe0bc('0x1c')]===_0xe0bc('0x1d')&&typeof _0x32b57e[_0xe0bc('0x1e')]==='undefined';var _0x3e6d13=_0x20013a[_0xe0bc('0x1f')];var _0x3c8ee2=_0x4e1cb4?0x0:_0x32b57e['offset'];var _0x25084c=_0x4e1cb4?_0x20013a[_0xe0bc('0x1f')]:_0x32b57e[_0xe0bc('0x1c')]+_0x32b57e[_0xe0bc('0x1e')];var _0x15fd42;if(_0x25084c>=_0x3e6d13){_0x25084c=_0x3e6d13;_0x15fd42=0xc8;}else{_0x15fd42=0xce;}_0xefe1e0['status'](_0x15fd42);return _0xefe1e0[_0xe0bc('0x20')](_0xe0bc('0x21'),_0x3c8ee2+'-'+_0x25084c+'/'+_0x3e6d13)['json'](_0x20013a);}return null;};}function patchUpdates(_0x38bbf0){return function(_0xbb98ca){try{jsonpatch[_0xe0bc('0x22')](_0xbb98ca,_0x38bbf0,!![]);}catch(_0x4218cd){return BPromise['reject'](_0x4218cd);}return _0xbb98ca[_0xe0bc('0x23')]();};}function saveUpdates(_0x436196,_0x308f6d){return function(_0x2185f0){if(_0x2185f0){return _0x2185f0[_0xe0bc('0x24')](_0x436196)[_0xe0bc('0x25')](function(_0x165eb9){return _0x165eb9;});}return null;};}function removeEntity(_0x2d61c8,_0x1f2454){return function(_0xc9b322){if(_0xc9b322){return _0xc9b322[_0xe0bc('0x26')]()[_0xe0bc('0x25')](function(){var _0x5dcc4e=_0xc9b322['get']({'plain':!![]});var _0x1f244e=_0xe0bc('0x27');return db[_0xe0bc('0x28')][_0xe0bc('0x26')]({'where':{'type':_0x1f244e,'resourceId':_0x5dcc4e['id']}})['then'](function(){return _0xc9b322;});})[_0xe0bc('0x25')](function(){_0x2d61c8[_0xe0bc('0x1a')](0xcc)[_0xe0bc('0x19')]();});}};}function handleEntityNotFound(_0x41fcc1,_0x39794c){return function(_0x411534){if(!_0x411534){_0x41fcc1[_0xe0bc('0x29')](0x194);}return _0x411534;};}function handleError(_0x290402,_0x2b8bf6){_0x2b8bf6=_0x2b8bf6||0x1f4;return function(_0x1655af){logger['error'](_0x1655af[_0xe0bc('0x2a')]);if(_0x1655af['name']){delete _0x1655af[_0xe0bc('0x2b')];}_0x290402[_0xe0bc('0x1a')](_0x2b8bf6)['send'](_0x1655af);};}exports[_0xe0bc('0x2c')]=function(_0x279df5,_0x388832){var _0x5f166b={},_0x4a8c3b={},_0x50eb70={'count':0x0,'rows':[]};var _0x2d2364=_[_0xe0bc('0x2d')](db[_0xe0bc('0x2e')][_0xe0bc('0x2f')],function(_0xd8eff6){return{'name':_0xd8eff6['fieldName'],'type':_0xd8eff6['type'][_0xe0bc('0x30')]};});_0x4a8c3b[_0xe0bc('0x31')]=_['map'](_0x2d2364,_0xe0bc('0x2b'));_0x4a8c3b[_0xe0bc('0x32')]=_[_0xe0bc('0x33')](_0x279df5[_0xe0bc('0x32')]);_0x4a8c3b['filters']=_[_0xe0bc('0x34')](_0x4a8c3b[_0xe0bc('0x31')],_0x4a8c3b[_0xe0bc('0x32')]);_0x5f166b[_0xe0bc('0x35')]=_[_0xe0bc('0x34')](_0x4a8c3b[_0xe0bc('0x31')],qs[_0xe0bc('0x36')](_0x279df5[_0xe0bc('0x32')]['fields']));_0x5f166b[_0xe0bc('0x35')]=_0x5f166b[_0xe0bc('0x35')][_0xe0bc('0x37')]?_0x5f166b[_0xe0bc('0x35')]:_0x4a8c3b[_0xe0bc('0x31')];if(!_0x279df5['query'][_0xe0bc('0x38')](_0xe0bc('0x39'))){_0x5f166b[_0xe0bc('0x1e')]=qs['limit'](_0x279df5[_0xe0bc('0x32')][_0xe0bc('0x1e')]);_0x5f166b[_0xe0bc('0x1c')]=qs['offset'](_0x279df5['query'][_0xe0bc('0x1c')]);}_0x5f166b[_0xe0bc('0x3a')]=qs[_0xe0bc('0x3b')](_0x279df5[_0xe0bc('0x32')][_0xe0bc('0x3b')]);_0x5f166b[_0xe0bc('0x3c')]=qs[_0xe0bc('0x3d')](_[_0xe0bc('0x3e')](_0x279df5['query'],_0x4a8c3b[_0xe0bc('0x3d')]),_0x2d2364);if(_0x279df5[_0xe0bc('0x32')][_0xe0bc('0x3f')]){_0x5f166b[_0xe0bc('0x3c')]=_[_0xe0bc('0x40')](_0x5f166b[_0xe0bc('0x3c')],{'$or':_['map'](_0x2d2364,function(_0x23bd27){if(_0x23bd27[_0xe0bc('0x41')]!==_0xe0bc('0x42')){var _0x38c4cf={};_0x38c4cf[_0x23bd27['name']]={'$like':'%'+_0x279df5[_0xe0bc('0x32')]['filter']+'%'};return _0x38c4cf;}})});}_0x5f166b=_[_0xe0bc('0x40')]({},_0x5f166b,_0x279df5[_0xe0bc('0x43')]);var _0x1d7a09={'where':_0x5f166b[_0xe0bc('0x3c')]};return db['Schedule'][_0xe0bc('0x1f')](_0x1d7a09)[_0xe0bc('0x25')](function(_0x11e199){_0x50eb70['count']=_0x11e199;if(_0x279df5[_0xe0bc('0x32')]['includeAll']){_0x5f166b[_0xe0bc('0x44')]=[{'all':!![]}];}return db[_0xe0bc('0x2e')][_0xe0bc('0x45')](_0x5f166b);})[_0xe0bc('0x25')](function(_0x5859ec){_0x50eb70[_0xe0bc('0x46')]=_0x5859ec;return _0x50eb70;})[_0xe0bc('0x25')](respondWithFilteredResult(_0x388832,_0x5f166b))[_0xe0bc('0x47')](handleError(_0x388832,null));};exports[_0xe0bc('0x48')]=function(_0x4741b5,_0x4a1c23){var _0xd97995={'raw':![],'where':{'id':_0x4741b5[_0xe0bc('0x49')]['id']}},_0x4ed99c={};_0x4ed99c[_0xe0bc('0x31')]=_[_0xe0bc('0x33')](db['Schedule']['rawAttributes']);_0x4ed99c[_0xe0bc('0x32')]=_['keys'](_0x4741b5[_0xe0bc('0x32')]);_0x4ed99c[_0xe0bc('0x3d')]=_[_0xe0bc('0x34')](_0x4ed99c['model'],_0x4ed99c[_0xe0bc('0x32')]);_0xd97995[_0xe0bc('0x35')]=_['intersection'](_0x4ed99c['model'],qs[_0xe0bc('0x36')](_0x4741b5[_0xe0bc('0x32')][_0xe0bc('0x36')]));_0xd97995[_0xe0bc('0x35')]=_0xd97995['attributes'][_0xe0bc('0x37')]?_0xd97995[_0xe0bc('0x35')]:_0x4ed99c[_0xe0bc('0x31')];if(_0x4741b5[_0xe0bc('0x32')][_0xe0bc('0x4a')]){_0xd97995[_0xe0bc('0x44')]=[{'all':!![]}];}_0xd97995=_[_0xe0bc('0x40')]({},_0xd97995,_0x4741b5[_0xe0bc('0x43')]);return db[_0xe0bc('0x2e')][_0xe0bc('0x4b')](_0xd97995)['then'](handleEntityNotFound(_0x4a1c23,null))[_0xe0bc('0x25')](respondWithResult(_0x4a1c23,null))['catch'](handleError(_0x4a1c23,null));};exports[_0xe0bc('0x4c')]=function(_0x442992,_0x47f937){return db[_0xe0bc('0x2e')]['create'](_0x442992[_0xe0bc('0x4d')],{})[_0xe0bc('0x25')](function(_0x175744){var _0x223a67=_0x442992[_0xe0bc('0x4e')][_0xe0bc('0x4f')]({'plain':!![]});if(!_0x223a67)throw new Error(_0xe0bc('0x50'));if(_0x223a67[_0xe0bc('0x51')]===_0xe0bc('0x4e')){var _0x2adc76=_0x175744[_0xe0bc('0x4f')]({'plain':!![]});var _0x2b4da9=_0xe0bc('0x27');return db[_0xe0bc('0x52')][_0xe0bc('0x4b')]({'where':{'name':_0x2b4da9,'userProfileId':_0x223a67[_0xe0bc('0x53')]},'raw':!![]})[_0xe0bc('0x25')](function(_0x48d477){if(_0x48d477&&_0x48d477[_0xe0bc('0x54')]===0x0){return db[_0xe0bc('0x28')][_0xe0bc('0x4c')]({'name':_0x2adc76[_0xe0bc('0x2b')],'resourceId':_0x2adc76['id'],'type':_0x48d477[_0xe0bc('0x2b')],'sectionId':_0x48d477['id']},{})['then'](function(){return _0x175744;});}else{return _0x175744;}})[_0xe0bc('0x47')](function(_0x22ab8a){logger[_0xe0bc('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22ab8a);throw _0x22ab8a;});}return _0x175744;})[_0xe0bc('0x25')](respondWithResult(_0x47f937,0xc9))[_0xe0bc('0x47')](handleError(_0x47f937,null));};exports[_0xe0bc('0x24')]=function(_0x3515dd,_0x1a800){if(_0x3515dd['body']['id']){delete _0x3515dd[_0xe0bc('0x4d')]['id'];}return db['Schedule'][_0xe0bc('0x4b')]({'where':{'id':_0x3515dd[_0xe0bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a800,null))[_0xe0bc('0x25')](saveUpdates(_0x3515dd[_0xe0bc('0x4d')],null))[_0xe0bc('0x25')](respondWithResult(_0x1a800,null))[_0xe0bc('0x47')](handleError(_0x1a800,null));};exports[_0xe0bc('0x26')]=function(_0x4698ac,_0x106820){return db[_0xe0bc('0x2e')][_0xe0bc('0x4b')]({'where':{'id':_0x4698ac[_0xe0bc('0x49')]['id']}})[_0xe0bc('0x25')](handleEntityNotFound(_0x106820,null))[_0xe0bc('0x25')](removeEntity(_0x106820,null))[_0xe0bc('0x47')](handleError(_0x106820,null));};exports[_0xe0bc('0x56')]=function(_0x55792f,_0x3d06ee,_0x21e852){var _0xbfb165=require(_0xe0bc('0x57'));return db['Schedule'][_0xe0bc('0x4b')]({'where':{'id':_0x55792f['params']['id']},'raw':!![]})[_0xe0bc('0x25')](handleEntityNotFound(_0x3d06ee,null))[_0xe0bc('0x25')](function(){_0xbfb165[_0xe0bc('0x56')](_0x55792f[_0xe0bc('0x49')]['id']);})[_0xe0bc('0x25')](respondWithStatusCode(_0x3d06ee,null))[_0xe0bc('0x47')](handleError(_0x3d06ee,null));}; \ No newline at end of file +var _0xf206=['length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Schedule','include','findAll','rows','catch','params','keys','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','Scheduler','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields'];(function(_0x3b9db8,_0x324c01){var _0x2fe742=function(_0x5254){while(--_0x5254){_0x3b9db8['push'](_0x3b9db8['shift']());}};_0x2fe742(++_0x324c01);}(_0xf206,0x17f));var _0x6f20=function(_0xa2a01b,_0x373790){_0xa2a01b=_0xa2a01b-0x0;var _0x18768b=_0xf206[_0xa2a01b];return _0x18768b;};'use strict';var emlformat=require(_0x6f20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f20('0x1'));var jsonpatch=require(_0x6f20('0x2'));var rp=require(_0x6f20('0x3'));var moment=require('moment');var BPromise=require(_0x6f20('0x4'));var Mustache=require(_0x6f20('0x5'));var util=require(_0x6f20('0x6'));var path=require(_0x6f20('0x7'));var sox=require(_0x6f20('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f20('0x9'));var squel=require(_0x6f20('0xa'));var crypto=require(_0x6f20('0xb'));var jsforce=require(_0x6f20('0xc'));var deskjs=require(_0x6f20('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6f20('0xe'));var Papa=require(_0x6f20('0xf'));var Redis=require(_0x6f20('0x10'));var authService=require(_0x6f20('0x11'));var qs=require(_0x6f20('0x12'));var as=require(_0x6f20('0x13'));var hardwareService=require(_0x6f20('0x14'));var logger=require(_0x6f20('0x15'))(_0x6f20('0x16'));var utils=require(_0x6f20('0x17'));var config=require(_0x6f20('0x18'));var licenseUtil=require(_0x6f20('0x19'));var db=require(_0x6f20('0x1a'))['db'];function respondWithStatusCode(_0x2b69ad,_0x536703){_0x536703=_0x536703||0xcc;return function(_0x3a8a0d){if(_0x3a8a0d){return _0x2b69ad[_0x6f20('0x1b')](_0x536703);}return _0x2b69ad['status'](_0x536703)[_0x6f20('0x1c')]();};}function respondWithResult(_0x170d30,_0x52eed0){_0x52eed0=_0x52eed0||0xc8;return function(_0x5aac0e){if(_0x5aac0e){return _0x170d30[_0x6f20('0x1d')](_0x52eed0)[_0x6f20('0x1e')](_0x5aac0e);}};}function respondWithFilteredResult(_0x5337fa,_0x1a9962){return function(_0x2f62a6){if(_0x2f62a6){var _0x107c56=typeof _0x1a9962['offset']===_0x6f20('0x1f')&&typeof _0x1a9962[_0x6f20('0x20')]===_0x6f20('0x1f');var _0x3ca7f9=_0x2f62a6[_0x6f20('0x21')];var _0x45e869=_0x107c56?0x0:_0x1a9962[_0x6f20('0x22')];var _0x1fc4fd=_0x107c56?_0x2f62a6['count']:_0x1a9962[_0x6f20('0x22')]+_0x1a9962[_0x6f20('0x20')];var _0xed2c1e;if(_0x1fc4fd>=_0x3ca7f9){_0x1fc4fd=_0x3ca7f9;_0xed2c1e=0xc8;}else{_0xed2c1e=0xce;}_0x5337fa[_0x6f20('0x1d')](_0xed2c1e);return _0x5337fa[_0x6f20('0x23')](_0x6f20('0x24'),_0x45e869+'-'+_0x1fc4fd+'/'+_0x3ca7f9)['json'](_0x2f62a6);}return null;};}function patchUpdates(_0x5bbf83){return function(_0x11f16a){try{jsonpatch[_0x6f20('0x25')](_0x11f16a,_0x5bbf83,!![]);}catch(_0x189688){return BPromise['reject'](_0x189688);}return _0x11f16a[_0x6f20('0x26')]();};}function saveUpdates(_0x7c1347,_0x1492cc){return function(_0x48db65){if(_0x48db65){return _0x48db65[_0x6f20('0x27')](_0x7c1347)['then'](function(_0x50bebf){return _0x50bebf;});}return null;};}function removeEntity(_0x486899,_0x483a9c){return function(_0x327f1d){if(_0x327f1d){return _0x327f1d[_0x6f20('0x28')]()[_0x6f20('0x29')](function(){var _0x26fa6c=_0x327f1d['get']({'plain':!![]});var _0xb896bb=_0x6f20('0x2a');return db[_0x6f20('0x2b')][_0x6f20('0x28')]({'where':{'type':_0xb896bb,'resourceId':_0x26fa6c['id']}})[_0x6f20('0x29')](function(){return _0x327f1d;});})[_0x6f20('0x29')](function(){_0x486899['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59dd93,_0x4397aa){return function(_0x5d06f8){if(!_0x5d06f8){_0x59dd93[_0x6f20('0x1b')](0x194);}return _0x5d06f8;};}function handleError(_0x46cb16,_0x41578c){_0x41578c=_0x41578c||0x1f4;return function(_0x55236d){logger['error'](_0x55236d[_0x6f20('0x2c')]);if(_0x55236d['name']){delete _0x55236d[_0x6f20('0x2d')];}_0x46cb16[_0x6f20('0x1d')](_0x41578c)[_0x6f20('0x2e')](_0x55236d);};}exports['index']=function(_0x5cd7ac,_0x4a87d7){var _0x5dc54e={},_0x302a03={},_0x45535f={'count':0x0,'rows':[]};var _0x52d009=_[_0x6f20('0x2f')](db['Schedule'][_0x6f20('0x30')],function(_0x4cd855){return{'name':_0x4cd855[_0x6f20('0x31')],'type':_0x4cd855['type'][_0x6f20('0x32')]};});_0x302a03[_0x6f20('0x33')]=_['map'](_0x52d009,_0x6f20('0x2d'));_0x302a03[_0x6f20('0x34')]=_['keys'](_0x5cd7ac[_0x6f20('0x34')]);_0x302a03[_0x6f20('0x35')]=_['intersection'](_0x302a03[_0x6f20('0x33')],_0x302a03[_0x6f20('0x34')]);_0x5dc54e[_0x6f20('0x36')]=_[_0x6f20('0x37')](_0x302a03['model'],qs[_0x6f20('0x38')](_0x5cd7ac[_0x6f20('0x34')][_0x6f20('0x38')]));_0x5dc54e[_0x6f20('0x36')]=_0x5dc54e[_0x6f20('0x36')][_0x6f20('0x39')]?_0x5dc54e[_0x6f20('0x36')]:_0x302a03[_0x6f20('0x33')];if(!_0x5cd7ac[_0x6f20('0x34')][_0x6f20('0x3a')](_0x6f20('0x3b'))){_0x5dc54e[_0x6f20('0x20')]=qs[_0x6f20('0x20')](_0x5cd7ac[_0x6f20('0x34')][_0x6f20('0x20')]);_0x5dc54e[_0x6f20('0x22')]=qs[_0x6f20('0x22')](_0x5cd7ac[_0x6f20('0x34')][_0x6f20('0x22')]);}_0x5dc54e['order']=qs[_0x6f20('0x3c')](_0x5cd7ac[_0x6f20('0x34')][_0x6f20('0x3c')]);_0x5dc54e[_0x6f20('0x3d')]=qs['filters'](_[_0x6f20('0x3e')](_0x5cd7ac[_0x6f20('0x34')],_0x302a03['filters']),_0x52d009);if(_0x5cd7ac[_0x6f20('0x34')][_0x6f20('0x3f')]){_0x5dc54e[_0x6f20('0x3d')]=_['merge'](_0x5dc54e[_0x6f20('0x3d')],{'$or':_['map'](_0x52d009,function(_0xa08d1d){if(_0xa08d1d['type']!==_0x6f20('0x40')){var _0x22e8a6={};_0x22e8a6[_0xa08d1d[_0x6f20('0x2d')]]={'$like':'%'+_0x5cd7ac[_0x6f20('0x34')][_0x6f20('0x3f')]+'%'};return _0x22e8a6;}})});}_0x5dc54e=_[_0x6f20('0x41')]({},_0x5dc54e,_0x5cd7ac[_0x6f20('0x42')]);var _0x174b5b={'where':_0x5dc54e[_0x6f20('0x3d')]};return db[_0x6f20('0x43')][_0x6f20('0x21')](_0x174b5b)[_0x6f20('0x29')](function(_0x718dfe){_0x45535f[_0x6f20('0x21')]=_0x718dfe;if(_0x5cd7ac[_0x6f20('0x34')]['includeAll']){_0x5dc54e[_0x6f20('0x44')]=[{'all':!![]}];}return db[_0x6f20('0x43')][_0x6f20('0x45')](_0x5dc54e);})[_0x6f20('0x29')](function(_0x25a588){_0x45535f[_0x6f20('0x46')]=_0x25a588;return _0x45535f;})[_0x6f20('0x29')](respondWithFilteredResult(_0x4a87d7,_0x5dc54e))[_0x6f20('0x47')](handleError(_0x4a87d7,null));};exports['show']=function(_0x5ee780,_0x4e6f87){var _0x49c78b={'raw':![],'where':{'id':_0x5ee780[_0x6f20('0x48')]['id']}},_0x3dda69={};_0x3dda69['model']=_[_0x6f20('0x49')](db['Schedule'][_0x6f20('0x30')]);_0x3dda69['query']=_[_0x6f20('0x49')](_0x5ee780[_0x6f20('0x34')]);_0x3dda69[_0x6f20('0x35')]=_[_0x6f20('0x37')](_0x3dda69['model'],_0x3dda69[_0x6f20('0x34')]);_0x49c78b['attributes']=_[_0x6f20('0x37')](_0x3dda69[_0x6f20('0x33')],qs['fields'](_0x5ee780[_0x6f20('0x34')][_0x6f20('0x38')]));_0x49c78b[_0x6f20('0x36')]=_0x49c78b[_0x6f20('0x36')][_0x6f20('0x39')]?_0x49c78b[_0x6f20('0x36')]:_0x3dda69[_0x6f20('0x33')];if(_0x5ee780['query'][_0x6f20('0x4a')]){_0x49c78b[_0x6f20('0x44')]=[{'all':!![]}];}_0x49c78b=_[_0x6f20('0x41')]({},_0x49c78b,_0x5ee780[_0x6f20('0x42')]);return db[_0x6f20('0x43')][_0x6f20('0x4b')](_0x49c78b)[_0x6f20('0x29')](handleEntityNotFound(_0x4e6f87,null))[_0x6f20('0x29')](respondWithResult(_0x4e6f87,null))[_0x6f20('0x47')](handleError(_0x4e6f87,null));};exports[_0x6f20('0x4c')]=function(_0x28812a,_0x5e9720){return db[_0x6f20('0x43')][_0x6f20('0x4c')](_0x28812a[_0x6f20('0x4d')],{})[_0x6f20('0x29')](function(_0x5513a0){var _0x18c4db=_0x28812a[_0x6f20('0x4e')][_0x6f20('0x4f')]({'plain':!![]});if(!_0x18c4db)throw new Error(_0x6f20('0x50'));if(_0x18c4db[_0x6f20('0x51')]===_0x6f20('0x4e')){var _0x397a76=_0x5513a0[_0x6f20('0x4f')]({'plain':!![]});var _0x237e22='Scheduler';return db['UserProfileSection'][_0x6f20('0x4b')]({'where':{'name':_0x237e22,'userProfileId':_0x18c4db[_0x6f20('0x52')]},'raw':!![]})['then'](function(_0x2ab799){if(_0x2ab799&&_0x2ab799[_0x6f20('0x53')]===0x0){return db[_0x6f20('0x2b')][_0x6f20('0x4c')]({'name':_0x397a76[_0x6f20('0x2d')],'resourceId':_0x397a76['id'],'type':_0x2ab799['name'],'sectionId':_0x2ab799['id']},{})[_0x6f20('0x29')](function(){return _0x5513a0;});}else{return _0x5513a0;}})[_0x6f20('0x47')](function(_0x4d7a3c){logger[_0x6f20('0x54')](_0x6f20('0x55'),_0x4d7a3c);throw _0x4d7a3c;});}return _0x5513a0;})[_0x6f20('0x29')](respondWithResult(_0x5e9720,0xc9))[_0x6f20('0x47')](handleError(_0x5e9720,null));};exports[_0x6f20('0x27')]=function(_0x3b2309,_0x62e1b4){if(_0x3b2309[_0x6f20('0x4d')]['id']){delete _0x3b2309[_0x6f20('0x4d')]['id'];}return db[_0x6f20('0x43')][_0x6f20('0x4b')]({'where':{'id':_0x3b2309[_0x6f20('0x48')]['id']}})['then'](handleEntityNotFound(_0x62e1b4,null))[_0x6f20('0x29')](saveUpdates(_0x3b2309['body'],null))['then'](respondWithResult(_0x62e1b4,null))[_0x6f20('0x47')](handleError(_0x62e1b4,null));};exports[_0x6f20('0x28')]=function(_0x2878f4,_0x3655b9){return db[_0x6f20('0x43')][_0x6f20('0x4b')]({'where':{'id':_0x2878f4[_0x6f20('0x48')]['id']}})[_0x6f20('0x29')](handleEntityNotFound(_0x3655b9,null))[_0x6f20('0x29')](removeEntity(_0x3655b9,null))[_0x6f20('0x47')](handleError(_0x3655b9,null));};exports[_0x6f20('0x56')]=function(_0x182214,_0x56b4b7,_0x3a0ca5){var _0x5d1a13=require(_0x6f20('0x57'));return db[_0x6f20('0x43')]['find']({'where':{'id':_0x182214[_0x6f20('0x48')]['id']},'raw':!![]})[_0x6f20('0x29')](handleEntityNotFound(_0x56b4b7,null))['then'](function(){_0x5d1a13[_0x6f20('0x56')](_0x182214['params']['id']);})['then'](respondWithStatusCode(_0x56b4b7,null))['catch'](handleError(_0x56b4b7,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9a39511..1c8e60c 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 _0x89e6=['util','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','tools_schedules','lodash'];(function(_0x19b8b3,_0x17b4e5){var _0x136051=function(_0x1b52e0){while(--_0x1b52e0){_0x19b8b3['push'](_0x19b8b3['shift']());}};_0x136051(++_0x17b4e5);}(_0x89e6,0xdb));var _0x689e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x89e6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x689e('0x0'));var util=require(_0x689e('0x1'));var logger=require('../../config/logger')(_0x689e('0x2'));var moment=require(_0x689e('0x3'));var BPromise=require(_0x689e('0x4'));var rp=require(_0x689e('0x5'));var fs=require('fs');var path=require(_0x689e('0x6'));var rimraf=require(_0x689e('0x7'));var config=require('../../config/environment');var attributes=require(_0x689e('0x8'));module['exports']=function(_0xd73728,_0x11c703){return _0xd73728['define']('Schedule',attributes,{'tableName':_0x689e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44a4=['bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x44a4,0x15e));var _0x444a=function(_0x329ebb,_0x2033ea){_0x329ebb=_0x329ebb-0x0;var _0x3a37eb=_0x44a4[_0x329ebb];return _0x3a37eb;};'use strict';var _=require(_0x444a('0x0'));var util=require('util');var logger=require(_0x444a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x444a('0x2'));var rp=require(_0x444a('0x3'));var fs=require('fs');var path=require(_0x444a('0x4'));var rimraf=require('rimraf');var config=require(_0x444a('0x5'));var attributes=require(_0x444a('0x6'));module[_0x444a('0x7')]=function(_0x1edd95,_0x3bc1c0){return _0x1edd95[_0x444a('0x8')](_0x444a('0x9'),attributes,{'tableName':_0x444a('0xa'),'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 2a2b2fa..7288f9b 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 _0x9b91=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1af7c3,_0x5cd4b5){var _0x302dd3=function(_0x279865){while(--_0x279865){_0x1af7c3['push'](_0x1af7c3['shift']());}};_0x302dd3(++_0x5cd4b5);}(_0x9b91,0x117));var _0x19b9=function(_0x2067e9,_0x5e6a97){_0x2067e9=_0x2067e9-0x0;var _0x280ce4=_0x9b91[_0x2067e9];return _0x280ce4;};'use strict';var _=require('lodash');var util=require(_0x19b9('0x0'));var moment=require(_0x19b9('0x1'));var BPromise=require(_0x19b9('0x2'));var rs=require(_0x19b9('0x3'));var fs=require('fs');var Redis=require(_0x19b9('0x4'));var db=require(_0x19b9('0x5'))['db'];var utils=require(_0x19b9('0x6'));var logger=require(_0x19b9('0x7'))(_0x19b9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x19b9('0x9')][_0x19b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44c6d2,_0x59e045,_0x22c647){return new BPromise(function(_0x5f509f,_0x26d3ec){return client[_0x19b9('0xb')](_0x44c6d2,_0x22c647)[_0x19b9('0xc')](function(_0x5b2d88){logger[_0x19b9('0xd')](_0x19b9('0xe'),_0x59e045,_0x19b9('0xf'));logger[_0x19b9('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x59e045,'request\x20sent',JSON[_0x19b9('0x11')](_0x5b2d88));if(_0x5b2d88[_0x19b9('0x12')]){if(_0x5b2d88[_0x19b9('0x12')][_0x19b9('0x13')]===0x1f4){logger[_0x19b9('0x12')](_0x19b9('0xe'),_0x59e045,_0x5b2d88[_0x19b9('0x12')][_0x19b9('0x14')]);return _0x26d3ec(_0x5b2d88[_0x19b9('0x12')][_0x19b9('0x14')]);}logger[_0x19b9('0x12')]('Schedule,\x20%s,\x20%s',_0x59e045,_0x5b2d88[_0x19b9('0x12')]['message']);return _0x5f509f(_0x5b2d88[_0x19b9('0x12')][_0x19b9('0x14')]);}else{logger['info'](_0x19b9('0xe'),_0x59e045,_0x19b9('0xf'));_0x5f509f(_0x5b2d88[_0x19b9('0x15')]['message']);}})[_0x19b9('0x16')](function(_0x14b39d){logger[_0x19b9('0x12')](_0x19b9('0xe'),_0x59e045,_0x14b39d);_0x26d3ec(_0x14b39d);});});} \ No newline at end of file +var _0x0e22=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x0e22,0x1a9));var _0x20e2=function(_0x486ab6,_0x257c0a){_0x486ab6=_0x486ab6-0x0;var _0x1ce5ea=_0x0e22[_0x486ab6];return _0x1ce5ea;};'use strict';var _=require(_0x20e2('0x0'));var util=require(_0x20e2('0x1'));var moment=require(_0x20e2('0x2'));var BPromise=require(_0x20e2('0x3'));var rs=require(_0x20e2('0x4'));var fs=require('fs');var Redis=require(_0x20e2('0x5'));var db=require(_0x20e2('0x6'))['db'];var utils=require(_0x20e2('0x7'));var logger=require('../../config/logger')(_0x20e2('0x8'));var config=require(_0x20e2('0x9'));var jayson=require(_0x20e2('0xa'));var client=jayson[_0x20e2('0xb')][_0x20e2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c5f8a,_0x4b8be,_0x136e4d){return new BPromise(function(_0x2b3387,_0x10d243){return client[_0x20e2('0xd')](_0x2c5f8a,_0x136e4d)[_0x20e2('0xe')](function(_0x3472f6){logger[_0x20e2('0xf')](_0x20e2('0x10'),_0x4b8be,'request\x20sent');logger[_0x20e2('0x11')](_0x20e2('0x12'),_0x4b8be,_0x20e2('0x13'),JSON['stringify'](_0x3472f6));if(_0x3472f6[_0x20e2('0x14')]){if(_0x3472f6[_0x20e2('0x14')][_0x20e2('0x15')]===0x1f4){logger[_0x20e2('0x14')](_0x20e2('0x10'),_0x4b8be,_0x3472f6[_0x20e2('0x14')][_0x20e2('0x16')]);return _0x10d243(_0x3472f6['error'][_0x20e2('0x16')]);}logger[_0x20e2('0x14')](_0x20e2('0x10'),_0x4b8be,_0x3472f6[_0x20e2('0x14')][_0x20e2('0x16')]);return _0x2b3387(_0x3472f6[_0x20e2('0x14')][_0x20e2('0x16')]);}else{logger['info'](_0x20e2('0x10'),_0x4b8be,_0x20e2('0x13'));_0x2b3387(_0x3472f6[_0x20e2('0x17')]['message']);}})[_0x20e2('0x18')](function(_0x4effca){logger[_0x20e2('0x14')](_0x20e2('0x10'),_0x4b8be,_0x4effca);_0x10d243(_0x4effca);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 9af2e91..4ad63b6 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 _0xf444=['post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./screenRecording.controller','get','/describe','/:id','show','/:id/download','isAuthenticated'];(function(_0x11dbb9,_0x21f0fc){var _0x40fecc=function(_0x33f896){while(--_0x33f896){_0x11dbb9['push'](_0x11dbb9['shift']());}};_0x40fecc(++_0x21f0fc);}(_0xf444,0x15a));var _0x4f44=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0xf444[_0x6dd5c];return _0x5a87fa;};'use strict';var multer=require(_0x4f44('0x0'));var util=require(_0x4f44('0x1'));var path=require(_0x4f44('0x2'));var timeout=require(_0x4f44('0x3'));var express=require(_0x4f44('0x4'));var router=express[_0x4f44('0x5')]();var fs_extra=require(_0x4f44('0x6'));var auth=require(_0x4f44('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4f44('0x8'));router[_0x4f44('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f44('0x9')](_0x4f44('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4f44('0xb'),auth['isAuthenticated'](),controller[_0x4f44('0xc')]);router[_0x4f44('0x9')](_0x4f44('0xd'),auth[_0x4f44('0xe')](),controller['download']);router[_0x4f44('0xf')]('/',auth[_0x4f44('0xe')](),controller['create']);router[_0x4f44('0x10')](_0x4f44('0xb'),auth[_0x4f44('0xe')](),controller[_0x4f44('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4f44('0x12')]=router; \ No newline at end of file +var _0x74f9=['isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get'];(function(_0xf3833d,_0x26127d){var _0x25b6e2=function(_0x43201d){while(--_0x43201d){_0xf3833d['push'](_0xf3833d['shift']());}};_0x25b6e2(++_0x26127d);}(_0x74f9,0x185));var _0x974f=function(_0x56b6ad,_0x16fbd1){_0x56b6ad=_0x56b6ad-0x0;var _0x48a26f=_0x74f9[_0x56b6ad];return _0x48a26f;};'use strict';var multer=require(_0x974f('0x0'));var util=require(_0x974f('0x1'));var path=require(_0x974f('0x2'));var timeout=require(_0x974f('0x3'));var express=require('express');var router=express[_0x974f('0x4')]();var fs_extra=require(_0x974f('0x5'));var auth=require(_0x974f('0x6'));var interaction=require(_0x974f('0x7'));var config=require(_0x974f('0x8'));var controller=require(_0x974f('0x9'));router[_0x974f('0xa')]('/',auth[_0x974f('0xb')](),controller[_0x974f('0xc')]);router['get'](_0x974f('0xd'),auth['isAuthenticated'](),controller[_0x974f('0xe')]);router[_0x974f('0xa')](_0x974f('0xf'),auth['isAuthenticated'](),controller[_0x974f('0x10')]);router[_0x974f('0xa')](_0x974f('0x11'),auth['isAuthenticated'](),controller[_0x974f('0x12')]);router[_0x974f('0x13')]('/',auth[_0x974f('0xb')](),controller['create']);router[_0x974f('0x14')](_0x974f('0xf'),auth['isAuthenticated'](),controller[_0x974f('0x15')]);router[_0x974f('0x16')]('/:id',auth[_0x974f('0xb')](),controller[_0x974f('0x17')]);module[_0x974f('0x18')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 336ed25..e320096 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 _0x672a=['exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','closedAt','sequelize','moment','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x672a,0x122));var _0xa672=function(_0x33d208,_0x280e78){_0x33d208=_0x33d208-0x0;var _0x41ad6a=_0x672a[_0x33d208];return _0x41ad6a;};'use strict';var Sequelize=require(_0xa672('0x0'));var moment=require(_0xa672('0x1'));var path=require(_0xa672('0x2'));var config=require(_0xa672('0x3'));module[_0xa672('0x4')]={'format':{'type':Sequelize[_0xa672('0x5')],'get':function(){return this[_0xa672('0x6')](_0xa672('0x7'))?path[_0xa672('0x8')](this[_0xa672('0x6')](_0xa672('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa672('0x9')]},'value':{'type':Sequelize[_0xa672('0x9')],'set':function(_0x3a4797){var _0x33dd0c=_0x3a4797[_0xa672('0xa')](/\\/g,'/');this[_0xa672('0xb')](_0xa672('0x7'),_0x33dd0c);}},'rating':{'type':Sequelize[_0xa672('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa672('0xc')],'set':function(_0x370f20){this[_0xa672('0xb')](_0xa672('0xd'),moment()[_0xa672('0xe')](_0x370f20,'ms'));this[_0xa672('0xb')]('closedAt',moment());this[_0xa672('0xb')](_0xa672('0xf'),_0x370f20);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa672('0x6')](_0xa672('0xd')))[_0xa672('0x10')](_0xa672('0x11'))[_0xa672('0x12')]();}},'closedAt':{'type':Sequelize[_0xa672('0x13')],'get':function(){return moment(this[_0xa672('0x6')](_0xa672('0x14')))[_0xa672('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xa672('0x12')]();}},'createdAt':{'type':Sequelize[_0xa672('0x13')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xa672('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa672('0x6')]('updatedAt'))['format'](_0xa672('0x11'))[_0xa672('0x12')]();}}}; \ No newline at end of file +var _0x8603=['updatedAt','moment','path','../../config/environment','getDataValue','value','extname','STRING','replace','INTEGER','startedAt','subtract','closedAt','setDataValue','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8603,0x190));var _0x3860=function(_0x3f4c7a,_0x510df5){_0x3f4c7a=_0x3f4c7a-0x0;var _0x13367f=_0x8603[_0x3f4c7a];return _0x13367f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var config=require(_0x3860('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3860('0x3')](_0x3860('0x4'))?path[_0x3860('0x5')](this['getDataValue'](_0x3860('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3860('0x6')]},'value':{'type':Sequelize[_0x3860('0x6')],'set':function(_0x1eca44){var _0xd3ce26=_0x1eca44[_0x3860('0x7')](/\\/g,'/');this['setDataValue']('value',_0xd3ce26);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x3860('0x8')],'set':function(_0x441dc4){this['setDataValue'](_0x3860('0x9'),moment()[_0x3860('0xa')](_0x441dc4,'ms'));this['setDataValue'](_0x3860('0xb'),moment());this[_0x3860('0xc')]('duration',_0x441dc4);}},'startedAt':{'type':Sequelize[_0x3860('0xd')],'get':function(){return moment(this[_0x3860('0x3')]('startedAt'))[_0x3860('0xe')](_0x3860('0xf'))[_0x3860('0x10')]();}},'closedAt':{'type':Sequelize[_0x3860('0xd')],'get':function(){return moment(this[_0x3860('0x3')](_0x3860('0xb')))[_0x3860('0xe')](_0x3860('0xf'))[_0x3860('0x10')]();}},'createdAt':{'type':Sequelize[_0x3860('0xd')],'get':function(){return moment(this['getDataValue'](_0x3860('0x11')))[_0x3860('0xe')](_0x3860('0xf'))[_0x3860('0x10')]();}},'updatedAt':{'type':Sequelize[_0x3860('0xd')],'get':function(){return moment(this[_0x3860('0x3')](_0x3860('0x12')))[_0x3860('0xe')](_0x3860('0xf'))[_0x3860('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 15fe699..f540100 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 _0x7dfd=['../../components/encryptor','uniqueid','join','%s.cypher','existsSync','decryptFile','secrets','root','server/files/screen_recordings','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','stack','name','send','index','ScreenRecording','fieldName','key','model','map','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','duration','createdAt','closedAt','value','find','describe','download'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd7df('0x0'));var rimraf=require(_0xd7df('0x1'));var zipdir=require(_0xd7df('0x2'));var jsonpatch=require(_0xd7df('0x3'));var rp=require(_0xd7df('0x4'));var moment=require(_0xd7df('0x5'));var BPromise=require(_0xd7df('0x6'));var Mustache=require(_0xd7df('0x7'));var util=require(_0xd7df('0x8'));var path=require(_0xd7df('0x9'));var sox=require(_0xd7df('0xa'));var csv=require(_0xd7df('0xb'));var ejs=require(_0xd7df('0xc'));var fs=require('fs');var fs_extra=require(_0xd7df('0xd'));var _=require(_0xd7df('0xe'));var squel=require(_0xd7df('0xf'));var crypto=require(_0xd7df('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xd7df('0x11'));var toCsv=require(_0xd7df('0xb'));var querystring=require(_0xd7df('0x12'));var Papa=require(_0xd7df('0x13'));var Redis=require('ioredis');var authService=require(_0xd7df('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd7df('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7df('0x16'))(_0xd7df('0x17'));var utils=require(_0xd7df('0x18'));var config=require(_0xd7df('0x19'));var licenseUtil=require(_0xd7df('0x1a'));var db=require(_0xd7df('0x1b'))['db'];function respondWithStatusCode(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xcc;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x1c')](_0x3da618);}return _0x2e8187[_0xd7df('0x1d')](_0x3da618)[_0xd7df('0x1e')]();};}function respondWithResult(_0xe1595f,_0x196632){_0x196632=_0x196632||0xc8;return function(_0x3b2559){if(_0x3b2559){return _0xe1595f[_0xd7df('0x1d')](_0x196632)[_0xd7df('0x1f')](_0x3b2559);}};}function respondWithFilteredResult(_0x57b8be,_0x4c5cf){return function(_0x23cdbc){if(_0x23cdbc){var _0x513b13=typeof _0x4c5cf[_0xd7df('0x20')]===_0xd7df('0x21')&&typeof _0x4c5cf['limit']===_0xd7df('0x21');var _0x30ee65=_0x23cdbc[_0xd7df('0x22')];var _0x5210e5=_0x513b13?0x0:_0x4c5cf[_0xd7df('0x20')];var _0x471621=_0x513b13?_0x23cdbc[_0xd7df('0x22')]:_0x4c5cf['offset']+_0x4c5cf[_0xd7df('0x23')];var _0x20dc3e;if(_0x471621>=_0x30ee65){_0x471621=_0x30ee65;_0x20dc3e=0xc8;}else{_0x20dc3e=0xce;}_0x57b8be[_0xd7df('0x1d')](_0x20dc3e);return _0x57b8be['set'](_0xd7df('0x24'),_0x5210e5+'-'+_0x471621+'/'+_0x30ee65)['json'](_0x23cdbc);}return null;};}function patchUpdates(_0x225e33){return function(_0x5ab737){try{jsonpatch[_0xd7df('0x25')](_0x5ab737,_0x225e33,!![]);}catch(_0x342b54){return BPromise[_0xd7df('0x26')](_0x342b54);}return _0x5ab737['save']();};}function saveUpdates(_0xc50077,_0x502ae8){return function(_0x44079b){if(_0x44079b){return _0x44079b[_0xd7df('0x27')](_0xc50077)[_0xd7df('0x28')](function(_0x29f354){return _0x29f354;});}return null;};}function removeEntity(_0x1c774b,_0xa80cbf){return function(_0x1e3bf3){if(_0x1e3bf3){return _0x1e3bf3['destroy']()['then'](function(){_0x1c774b[_0xd7df('0x1d')](0xcc)[_0xd7df('0x1e')]();});}};}function handleEntityNotFound(_0x26047f,_0x459f11){return function(_0x13f190){if(!_0x13f190){_0x26047f[_0xd7df('0x1c')](0x194);}return _0x13f190;};}function handleError(_0x373359,_0x2b6fde){_0x2b6fde=_0x2b6fde||0x1f4;return function(_0x163904){logger['error'](_0x163904[_0xd7df('0x29')]);if(_0x163904[_0xd7df('0x2a')]){delete _0x163904[_0xd7df('0x2a')];}_0x373359[_0xd7df('0x1d')](_0x2b6fde)[_0xd7df('0x2b')](_0x163904);};}exports[_0xd7df('0x2c')]=function(_0x3f78fa,_0x36de76){var _0x5195cf={},_0x4ba779={},_0x52b56a={'count':0x0,'rows':[]};var _0x58584d=_['map'](db[_0xd7df('0x2d')]['rawAttributes'],function(_0xd366b){return{'name':_0xd366b[_0xd7df('0x2e')],'type':_0xd366b['type'][_0xd7df('0x2f')]};});_0x4ba779[_0xd7df('0x30')]=_['differenceBy'](_[_0xd7df('0x31')](_0x58584d,_0xd7df('0x2a')),[_0xd7df('0x32')]);_0x4ba779[_0xd7df('0x33')]=_[_0xd7df('0x34')](_0x3f78fa[_0xd7df('0x33')]);_0x4ba779['filters']=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],_0x4ba779[_0xd7df('0x33')]);_0x5195cf[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0x4ba779[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5195cf[_0xd7df('0x36')]=_0x5195cf[_0xd7df('0x36')]['length']?_0x5195cf['attributes']:_0x4ba779[_0xd7df('0x30')];if(!_0x3f78fa['query'][_0xd7df('0x38')](_0xd7df('0x39'))){_0x5195cf[_0xd7df('0x23')]=qs[_0xd7df('0x23')](_0x3f78fa['query']['limit']);_0x5195cf['offset']=qs[_0xd7df('0x20')](_0x3f78fa[_0xd7df('0x33')]['offset']);}_0x5195cf[_0xd7df('0x3a')]=qs[_0xd7df('0x3b')](_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3b')]);_0x5195cf['where']=qs[_0xd7df('0x3c')](_[_0xd7df('0x3d')](_0x3f78fa['query'],_0x4ba779[_0xd7df('0x3c')]),_0x58584d);if(_0x3f78fa['query'][_0xd7df('0x3e')]){_0x5195cf[_0xd7df('0x3f')]=_[_0xd7df('0x40')](_0x5195cf['where'],{'$or':_[_0xd7df('0x31')](_0x58584d,function(_0x2a7252){if(_0x2a7252[_0xd7df('0x41')]!==_0xd7df('0x42')){var _0x54ea42={};_0x54ea42[_0x2a7252[_0xd7df('0x2a')]]={'$like':'%'+_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x3e')]+'%'};return _0x54ea42;}})});}_0x5195cf=_['merge']({},_0x5195cf,_0x3f78fa[_0xd7df('0x43')]);var _0x207852={'where':_0x5195cf[_0xd7df('0x3f')]};return db['ScreenRecording'][_0xd7df('0x22')](_0x207852)[_0xd7df('0x28')](function(_0x4910cb){_0x52b56a['count']=_0x4910cb;if(_0x3f78fa[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5195cf[_0xd7df('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x5195cf);})[_0xd7df('0x28')](function(_0x4ebdbe){_0x52b56a[_0xd7df('0x46')]=_0x4ebdbe;return _0x52b56a;})['then'](respondWithFilteredResult(_0x36de76,_0x5195cf))['catch'](handleError(_0x36de76,null));};exports[_0xd7df('0x47')]=function(_0x579d0f,_0x18ef10){var _0x5302f4={'raw':![],'where':{'id':_0x579d0f[_0xd7df('0x48')]['id']}},_0xad2d69={};_0xad2d69[_0xd7df('0x30')]=_[_0xd7df('0x34')](db[_0xd7df('0x2d')][_0xd7df('0x49')]);_0xad2d69[_0xd7df('0x33')]=_['keys'](_0x579d0f[_0xd7df('0x33')]);_0xad2d69['filters']=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],_0xad2d69[_0xd7df('0x33')]);_0x5302f4[_0xd7df('0x36')]=_[_0xd7df('0x35')](_0xad2d69[_0xd7df('0x30')],qs[_0xd7df('0x37')](_0x579d0f[_0xd7df('0x33')][_0xd7df('0x37')]));_0x5302f4['attributes']=_0x5302f4[_0xd7df('0x36')][_0xd7df('0x4a')]?_0x5302f4['attributes']:_0xad2d69['model'];if(_0x579d0f[_0xd7df('0x33')][_0xd7df('0x44')]){_0x5302f4[_0xd7df('0x45')]=[{'all':!![]}];}_0x5302f4=_['merge']({},_0x5302f4,_0x579d0f['options']);return db[_0xd7df('0x2d')]['find'](_0x5302f4)[_0xd7df('0x28')](handleEntityNotFound(_0x18ef10,null))[_0xd7df('0x28')](respondWithResult(_0x18ef10,null))[_0xd7df('0x4b')](handleError(_0x18ef10,null));};exports[_0xd7df('0x4c')]=function(_0x1838aa,_0x28c13f){return db[_0xd7df('0x2d')][_0xd7df('0x4c')](_0x1838aa[_0xd7df('0x4d')],{})[_0xd7df('0x28')](respondWithResult(_0x28c13f,0xc9))[_0xd7df('0x4b')](handleError(_0x28c13f,null));};exports[_0xd7df('0x27')]=function(_0x54222c,_0x1f2f99){if(_0x54222c[_0xd7df('0x4d')]['id']){delete _0x54222c[_0xd7df('0x4d')]['id'];}delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x4e')];delete _0x54222c['body'][_0xd7df('0x4f')];delete _0x54222c[_0xd7df('0x4d')][_0xd7df('0x50')];delete _0x54222c['body'][_0xd7df('0x51')];return db['ScreenRecording'][_0xd7df('0x52')]({'where':{'id':_0x54222c[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](handleEntityNotFound(_0x1f2f99,null))[_0xd7df('0x28')](saveUpdates(_0x54222c[_0xd7df('0x4d')],null))['then'](respondWithResult(_0x1f2f99,null))['catch'](handleError(_0x1f2f99,null));};exports['describe']=function(_0xe4b221,_0x4a6cf5){return db[_0xd7df('0x2d')][_0xd7df('0x53')]()[_0xd7df('0x28')](respondWithResult(_0x4a6cf5,null))[_0xd7df('0x4b')](handleError(_0x4a6cf5,null));};exports[_0xd7df('0x54')]=function(_0x418da,_0xf72803,_0xb054d7){var _0x453876=require(_0xd7df('0x55'));var _0x382d11=![];var _0x327365={};if(_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]&&_0x418da[_0xd7df('0x33')][_0xd7df('0x41')]==='uniqueid'){_0x327365[_0xd7df('0x56')]=_0x418da[_0xd7df('0x48')]['id'];}else{_0x327365['id']=_0x418da['params']['id'];}return db['ScreenRecording'][_0xd7df('0x52')]({'where':_0x327365,'attributes':['id','value'],'raw':!![]})[_0xd7df('0x28')](handleEntityNotFound(_0xf72803,null))['then'](function(_0x1f34c2){if(_0x1f34c2){var _0x28151a=path[_0xd7df('0x57')](config['root'],'server/files/screen_recordings',_0x1f34c2['value']);var _0x3666ba=util[_0xd7df('0x32')](_0xd7df('0x58'),_0x28151a);if(fs[_0xd7df('0x59')](_0x3666ba)){_0x382d11=!![];return _0x453876[_0xd7df('0x5a')](_0x3666ba,_0x28151a,config[_0xd7df('0x5b')]['recording'])[_0xd7df('0x28')](function(){return _0x1f34c2;});}return _0x1f34c2;}})[_0xd7df('0x28')](function(_0x35204f){if(_0x35204f){var _0x25d187=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x35204f[_0xd7df('0x51')]);if(!fs[_0xd7df('0x59')](_0x25d187)){throw new db[(_0xd7df('0x5e'))][(_0xd7df('0x5f'))](_0xd7df('0x60'));}if(_0x35204f[_0xd7df('0x61')]){return _0xf72803[_0xd7df('0x54')](_0x25d187,_0x35204f[_0xd7df('0x61')]+path[_0xd7df('0x62')](_0x25d187),function(){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}else{return _0xf72803[_0xd7df('0x54')](_0x25d187,function(_0x3f2775){if(_0x382d11){fs[_0xd7df('0x63')](_0x25d187);}});}}})[_0xd7df('0x4b')](function(_0x393a3a){if(_0x393a3a[_0xd7df('0x64')]===_0xd7df('0x60')){_0xf72803[_0xd7df('0x1d')](0x194)[_0xd7df('0x2b')]('Not\x20found');}else{return handleError(_0xf72803,null);}});};exports['destroy']=function(_0x327402,_0x28f550){return db[_0xd7df('0x2d')]['find']({'where':{'id':_0x327402[_0xd7df('0x48')]['id']}})[_0xd7df('0x28')](function(_0x1e87aa){if(_[_0xd7df('0x65')](_0x1e87aa)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1e87aa;})[_0xd7df('0x28')](function(_0x20ad50){var _0xb06a56=path[_0xd7df('0x57')](config[_0xd7df('0x5c')],_0xd7df('0x5d'),_0x20ad50[_0xd7df('0x51')]);logger[_0xd7df('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0xb06a56);if(!_[_0xd7df('0x65')](_0x20ad50[_0xd7df('0x51')])&&fs['existsSync'](_0xb06a56)){logger['info']('File:\x20\x22'+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}_0xb06a56=_0xb06a56+_0xd7df('0x69');if(!_[_0xd7df('0x65')](_0x20ad50['value'])&&fs[_0xd7df('0x59')](_0xb06a56)){logger[_0xd7df('0x66')](_0xd7df('0x6a')+_0xb06a56+_0xd7df('0x67'));fs[_0xd7df('0x68')](_0xb06a56);}return _0x20ad50;})[_0xd7df('0x28')](function(_0x4124b8){if(!_0x4124b8)throw new InternalError();return _0x4124b8['destroy']();})['then'](function(){_0x28f550[_0xd7df('0x1d')](0xcc)['end']();})[_0xd7df('0x4b')](handleError(_0x28f550,null));}; \ No newline at end of file +var _0x7fbe=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','end','error','stack','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','format','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','find','catch','create','body','duration','createdAt','closedAt','params','describe','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x455353,_0x36e376){var _0x18952f=function(_0xbf9937){while(--_0xbf9937){_0x455353['push'](_0x455353['shift']());}};_0x18952f(++_0x36e376);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x45e56c,_0x4235d0){_0x45e56c=_0x45e56c-0x0;var _0x4826ef=_0x7fbe[_0x45e56c];return _0x4826ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();});}};}function handleEntityNotFound(_0x2996ae,_0x4f6c73){return function(_0x6c930){if(!_0x6c930){_0x2996ae[_0xe7fb('0x1b')](0x194);}return _0x6c930;};}function handleError(_0x390f32,_0x1ceed8){_0x1ceed8=_0x1ceed8||0x1f4;return function(_0x392d75){logger[_0xe7fb('0x28')](_0x392d75[_0xe7fb('0x29')]);if(_0x392d75['name']){delete _0x392d75['name'];}_0x390f32[_0xe7fb('0x1c')](_0x1ceed8)[_0xe7fb('0x2a')](_0x392d75);};}exports[_0xe7fb('0x2b')]=function(_0x4fd290,_0xb1f2f4){var _0x251807={},_0xd3fffe={},_0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x2c')](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x2f')],'type':_0x4ce993[_0xe7fb('0x30')][_0xe7fb('0x31')]};});_0xd3fffe['model']=_['differenceBy'](_[_0xe7fb('0x2c')](_0x219554,'name'),[_0xe7fb('0x32')]);_0xd3fffe[_0xe7fb('0x33')]=_[_0xe7fb('0x34')](_0x4fd290[_0xe7fb('0x33')]);_0xd3fffe['filters']=_[_0xe7fb('0x35')](_0xd3fffe[_0xe7fb('0x36')],_0xd3fffe[_0xe7fb('0x33')]);_0x251807[_0xe7fb('0x37')]=_[_0xe7fb('0x35')](_0xd3fffe['model'],qs[_0xe7fb('0x38')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x38')]));_0x251807[_0xe7fb('0x37')]=_0x251807[_0xe7fb('0x37')][_0xe7fb('0x39')]?_0x251807[_0xe7fb('0x37')]:_0xd3fffe[_0xe7fb('0x36')];if(!_0x4fd290[_0xe7fb('0x33')]['hasOwnProperty'](_0xe7fb('0x3a'))){_0x251807[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x4fd290['query'][_0xe7fb('0x20')]);_0x251807[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x1e')]);}_0x251807[_0xe7fb('0x3b')]=qs[_0xe7fb('0x3c')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x3c')]);_0x251807[_0xe7fb('0x3d')]=qs[_0xe7fb('0x3e')](_[_0xe7fb('0x3f')](_0x4fd290[_0xe7fb('0x33')],_0xd3fffe[_0xe7fb('0x3e')]),_0x219554);if(_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x40')]){_0x251807[_0xe7fb('0x3d')]=_[_0xe7fb('0x41')](_0x251807[_0xe7fb('0x3d')],{'$or':_['map'](_0x219554,function(_0x261ec5){if(_0x261ec5[_0xe7fb('0x30')]!==_0xe7fb('0x42')){var _0x444f98={};_0x444f98[_0x261ec5['name']]={'$like':'%'+_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x40')]+'%'};return _0x444f98;}})});}_0x251807=_[_0xe7fb('0x41')]({},_0x251807,_0x4fd290[_0xe7fb('0x43')]);var _0x49fe9d={'where':_0x251807[_0xe7fb('0x3d')]};return db[_0xe7fb('0x2d')][_0xe7fb('0x21')](_0x49fe9d)[_0xe7fb('0x26')](function(_0x468d16){_0x5f265f[_0xe7fb('0x21')]=_0x468d16;if(_0x4fd290['query'][_0xe7fb('0x44')]){_0x251807[_0xe7fb('0x45')]=[{'all':!![]}];}return db[_0xe7fb('0x2d')]['findAll'](_0x251807);})[_0xe7fb('0x26')](function(_0x3a8c52){_0x5f265f['rows']=_0x3a8c52;return _0x5f265f;})['then'](respondWithFilteredResult(_0xb1f2f4,_0x251807))['catch'](handleError(_0xb1f2f4,null));};exports['show']=function(_0x5e0153,_0x900d67){var _0x957ca3={'raw':![],'where':{'id':_0x5e0153['params']['id']}},_0xed62e9={};_0xed62e9[_0xe7fb('0x36')]=_['keys'](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')]);_0xed62e9['query']=_[_0xe7fb('0x34')](_0x5e0153[_0xe7fb('0x33')]);_0xed62e9[_0xe7fb('0x3e')]=_[_0xe7fb('0x35')](_0xed62e9['model'],_0xed62e9[_0xe7fb('0x33')]);_0x957ca3[_0xe7fb('0x37')]=_[_0xe7fb('0x35')](_0xed62e9['model'],qs[_0xe7fb('0x38')](_0x5e0153[_0xe7fb('0x33')][_0xe7fb('0x38')]));_0x957ca3[_0xe7fb('0x37')]=_0x957ca3[_0xe7fb('0x37')]['length']?_0x957ca3[_0xe7fb('0x37')]:_0xed62e9['model'];if(_0x5e0153[_0xe7fb('0x33')][_0xe7fb('0x44')]){_0x957ca3[_0xe7fb('0x45')]=[{'all':!![]}];}_0x957ca3=_[_0xe7fb('0x41')]({},_0x957ca3,_0x5e0153[_0xe7fb('0x43')]);return db['ScreenRecording'][_0xe7fb('0x46')](_0x957ca3)['then'](handleEntityNotFound(_0x900d67,null))['then'](respondWithResult(_0x900d67,null))[_0xe7fb('0x47')](handleError(_0x900d67,null));};exports[_0xe7fb('0x48')]=function(_0x16327f,_0x589555){return db[_0xe7fb('0x2d')][_0xe7fb('0x48')](_0x16327f['body'],{})['then'](respondWithResult(_0x589555,0xc9))[_0xe7fb('0x47')](handleError(_0x589555,null));};exports[_0xe7fb('0x25')]=function(_0x1cbf34,_0x3dd6bf){if(_0x1cbf34[_0xe7fb('0x49')]['id']){delete _0x1cbf34[_0xe7fb('0x49')]['id'];}delete _0x1cbf34[_0xe7fb('0x49')][_0xe7fb('0x4a')];delete _0x1cbf34['body'][_0xe7fb('0x4b')];delete _0x1cbf34['body'][_0xe7fb('0x4c')];delete _0x1cbf34[_0xe7fb('0x49')]['value'];return db[_0xe7fb('0x2d')]['find']({'where':{'id':_0x1cbf34[_0xe7fb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3dd6bf,null))[_0xe7fb('0x26')](saveUpdates(_0x1cbf34['body'],null))[_0xe7fb('0x26')](respondWithResult(_0x3dd6bf,null))['catch'](handleError(_0x3dd6bf,null));};exports[_0xe7fb('0x4e')]=function(_0x1b6442,_0x41fcfb){return db[_0xe7fb('0x2d')][_0xe7fb('0x4e')]()[_0xe7fb('0x26')](respondWithResult(_0x41fcfb,null))[_0xe7fb('0x47')](handleError(_0x41fcfb,null));};exports['download']=function(_0x5d20dc,_0x20aa55,_0x4948a7){var _0x4f4240=require('../../components/encryptor');var _0x50b8df=![];var _0x539252={};if(_0x5d20dc[_0xe7fb('0x33')][_0xe7fb('0x30')]&&_0x5d20dc[_0xe7fb('0x33')][_0xe7fb('0x30')]==='uniqueid'){_0x539252[_0xe7fb('0x4f')]=_0x5d20dc[_0xe7fb('0x4d')]['id'];}else{_0x539252['id']=_0x5d20dc[_0xe7fb('0x4d')]['id'];}return db['ScreenRecording']['find']({'where':_0x539252,'attributes':['id',_0xe7fb('0x50')],'raw':!![]})[_0xe7fb('0x26')](handleEntityNotFound(_0x20aa55,null))[_0xe7fb('0x26')](function(_0x4f4ba3){if(_0x4f4ba3){var _0x27f860=path[_0xe7fb('0x51')](config[_0xe7fb('0x52')],_0xe7fb('0x53'),_0x4f4ba3['value']);var _0x4b35f9=util[_0xe7fb('0x32')](_0xe7fb('0x54'),_0x27f860);if(fs[_0xe7fb('0x55')](_0x4b35f9)){_0x50b8df=!![];return _0x4f4240[_0xe7fb('0x56')](_0x4b35f9,_0x27f860,config[_0xe7fb('0x57')]['recording'])[_0xe7fb('0x26')](function(){return _0x4f4ba3;});}return _0x4f4ba3;}})[_0xe7fb('0x26')](function(_0x23755b){if(_0x23755b){var _0x590d7a=path['join'](config[_0xe7fb('0x52')],_0xe7fb('0x53'),_0x23755b[_0xe7fb('0x50')]);if(!fs[_0xe7fb('0x55')](_0x590d7a)){throw new db[(_0xe7fb('0x58'))][(_0xe7fb('0x59'))]('ScreenRecording\x20not\x20found');}if(_0x23755b[_0xe7fb('0x5a')]){return _0x20aa55[_0xe7fb('0x5b')](_0x590d7a,_0x23755b[_0xe7fb('0x5a')]+path[_0xe7fb('0x5c')](_0x590d7a),function(){if(_0x50b8df){fs[_0xe7fb('0x5d')](_0x590d7a);}});}else{return _0x20aa55[_0xe7fb('0x5b')](_0x590d7a,function(_0x554092){if(_0x50b8df){fs[_0xe7fb('0x5d')](_0x590d7a);}});}}})['catch'](function(_0x1eda1d){if(_0x1eda1d[_0xe7fb('0x5e')]===_0xe7fb('0x5f')){_0x20aa55[_0xe7fb('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x20aa55,null);}});};exports[_0xe7fb('0x60')]=function(_0x11e15a,_0x25aeb2){return db[_0xe7fb('0x2d')][_0xe7fb('0x46')]({'where':{'id':_0x11e15a['params']['id']}})[_0xe7fb('0x26')](function(_0x58d4ec){if(_[_0xe7fb('0x61')](_0x58d4ec)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58d4ec;})['then'](function(_0xc13fac){var _0x203da3=path[_0xe7fb('0x51')](config['root'],_0xe7fb('0x53'),_0xc13fac[_0xe7fb('0x50')]);logger[_0xe7fb('0x62')](_0xe7fb('0x63'),_0x203da3);if(!_[_0xe7fb('0x61')](_0xc13fac['value'])&&fs[_0xe7fb('0x55')](_0x203da3)){logger[_0xe7fb('0x62')]('File:\x20\x22'+_0x203da3+_0xe7fb('0x64'));fs[_0xe7fb('0x65')](_0x203da3);}_0x203da3=_0x203da3+'.cypher';if(!_[_0xe7fb('0x61')](_0xc13fac['value'])&&fs[_0xe7fb('0x55')](_0x203da3)){logger[_0xe7fb('0x62')](_0xe7fb('0x66')+_0x203da3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7fb('0x65')](_0x203da3);}return _0xc13fac;})[_0xe7fb('0x26')](function(_0x2c558a){if(!_0x2c558a)throw new InternalError();return _0x2c558a[_0xe7fb('0x60')]();})[_0xe7fb('0x26')](function(){_0x25aeb2[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();})[_0xe7fb('0x47')](handleError(_0x25aeb2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 82d5d64..d1d5dfb 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 _0xe44c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','interactionid','util','../../config/logger','api'];(function(_0x163268,_0x24c75d){var _0x5dda3b=function(_0x196d81){while(--_0x196d81){_0x163268['push'](_0x163268['shift']());}};_0x5dda3b(++_0x24c75d);}(_0xe44c,0x10e));var _0xce44=function(_0x1ca8d8,_0x17aa35){_0x1ca8d8=_0x1ca8d8-0x0;var _0x1161d8=_0xe44c[_0x1ca8d8];return _0x1161d8;};'use strict';var _=require('lodash');var util=require(_0xce44('0x0'));var logger=require(_0xce44('0x1'))(_0xce44('0x2'));var moment=require(_0xce44('0x3'));var BPromise=require(_0xce44('0x4'));var rp=require(_0xce44('0x5'));var fs=require('fs');var path=require(_0xce44('0x6'));var rimraf=require(_0xce44('0x7'));var config=require(_0xce44('0x8'));var attributes=require('./screenRecording.attributes');module[_0xce44('0x9')]=function(_0x300911,_0x4d93ff){return _0x300911[_0xce44('0xa')](_0xce44('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xce44('0xc'),'fields':[_0xce44('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a24=['interactionid','lodash','util','api','moment','bluebird','path','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings'];(function(_0x3b93ac,_0x49f816){var _0xc9ab75=function(_0x444e70){while(--_0x444e70){_0x3b93ac['push'](_0x3b93ac['shift']());}};_0xc9ab75(++_0x49f816);}(_0x2a24,0x1c9));var _0x42a2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2a24[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x42a2('0x0'));var util=require(_0x42a2('0x1'));var logger=require('../../config/logger')(_0x42a2('0x2'));var moment=require(_0x42a2('0x3'));var BPromise=require(_0x42a2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42a2('0x5'));var rimraf=require('rimraf');var config=require(_0x42a2('0x6'));var attributes=require(_0x42a2('0x7'));module[_0x42a2('0x8')]=function(_0x1b97a4,_0x4f6071){return _0x1b97a4[_0x42a2('0x9')]('ScreenRecording',attributes,{'tableName':_0x42a2('0xa'),'paranoid':![],'indexes':[{'name':_0x42a2('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 8b4cab5..be61968 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 _0x95e7=['error','code','ScreenRecording,\x20%s,\x20%s','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5f164a,_0x1bcf3a){var _0x2f73fb=function(_0x2cf315){while(--_0x2cf315){_0x5f164a['push'](_0x5f164a['shift']());}};_0x2f73fb(++_0x1bcf3a);}(_0x95e7,0x1bd));var _0x795e=function(_0x544ec7,_0x2d94bb){_0x544ec7=_0x544ec7-0x0;var _0xd9f1ce=_0x95e7[_0x544ec7];return _0xd9f1ce;};'use strict';var _=require(_0x795e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x795e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x795e('0x2'));var db=require(_0x795e('0x3'))['db'];var utils=require(_0x795e('0x4'));var logger=require(_0x795e('0x5'))(_0x795e('0x6'));var config=require(_0x795e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x795e('0x8')][_0x795e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cd8c2,_0x1608bb,_0xb964f2){return new BPromise(function(_0x37ba11,_0x503d21){return client[_0x795e('0xa')](_0x3cd8c2,_0xb964f2)[_0x795e('0xb')](function(_0x4e7f44){logger[_0x795e('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x1608bb,_0x795e('0xd'));logger[_0x795e('0xe')](_0x795e('0xf'),_0x1608bb,_0x795e('0xd'),JSON[_0x795e('0x10')](_0x4e7f44));if(_0x4e7f44[_0x795e('0x11')]){if(_0x4e7f44[_0x795e('0x11')][_0x795e('0x12')]===0x1f4){logger[_0x795e('0x11')](_0x795e('0x13'),_0x1608bb,_0x4e7f44[_0x795e('0x11')][_0x795e('0x14')]);return _0x503d21(_0x4e7f44[_0x795e('0x11')][_0x795e('0x14')]);}logger['error'](_0x795e('0x13'),_0x1608bb,_0x4e7f44[_0x795e('0x11')][_0x795e('0x14')]);return _0x37ba11(_0x4e7f44[_0x795e('0x11')][_0x795e('0x14')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1608bb,_0x795e('0xd'));_0x37ba11(_0x4e7f44[_0x795e('0x15')][_0x795e('0x14')]);}})['catch'](function(_0x228695){logger[_0x795e('0x11')](_0x795e('0x13'),_0x1608bb,_0x228695);_0x503d21(_0x228695);});});} \ No newline at end of file +var _0x41e7=['../../config/environment','jayson/promise','client','http','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0x41e7,0xcf));var _0x741e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x41e7[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x741e('0x0'));var moment=require(_0x741e('0x1'));var BPromise=require(_0x741e('0x2'));var rs=require(_0x741e('0x3'));var fs=require('fs');var Redis=require(_0x741e('0x4'));var db=require(_0x741e('0x5'))['db'];var utils=require(_0x741e('0x6'));var logger=require(_0x741e('0x7'))(_0x741e('0x8'));var config=require(_0x741e('0x9'));var jayson=require(_0x741e('0xa'));var client=jayson[_0x741e('0xb')][_0x741e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30978a,_0x4ed6ea,_0x23225b){return new BPromise(function(_0x3a1f9e,_0x39ca18){return client['request'](_0x30978a,_0x23225b)[_0x741e('0xd')](function(_0x420bf9){logger['info'](_0x741e('0xe'),_0x4ed6ea,_0x741e('0xf'));logger[_0x741e('0x10')](_0x741e('0x11'),_0x4ed6ea,_0x741e('0xf'),JSON[_0x741e('0x12')](_0x420bf9));if(_0x420bf9[_0x741e('0x13')]){if(_0x420bf9[_0x741e('0x13')][_0x741e('0x14')]===0x1f4){logger[_0x741e('0x13')](_0x741e('0xe'),_0x4ed6ea,_0x420bf9['error'][_0x741e('0x15')]);return _0x39ca18(_0x420bf9['error'][_0x741e('0x15')]);}logger[_0x741e('0x13')]('ScreenRecording,\x20%s,\x20%s',_0x4ed6ea,_0x420bf9['error']['message']);return _0x3a1f9e(_0x420bf9['error'][_0x741e('0x15')]);}else{logger[_0x741e('0x16')](_0x741e('0xe'),_0x4ed6ea,_0x741e('0xf'));_0x3a1f9e(_0x420bf9['result'][_0x741e('0x15')]);}})[_0x741e('0x17')](function(_0x4e2165){logger[_0x741e('0x13')](_0x741e('0xe'),_0x4ed6ea,_0x4e2165);_0x39ca18(_0x4e2165);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4dca379..c10e8ec 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 _0x6606=['isAuthenticated','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','index','/now','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','originalname','post','/:id/logo','single','file','logologin','addLogoLogin','preferred','addFavicon','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6606,0x1ba));var _0x6660=function(_0x5e3959,_0x56d974){_0x5e3959=_0x5e3959-0x0;var _0x4ca4fd=_0x6606[_0x5e3959];return _0x4ca4fd;};'use strict';var multer=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var path=require(_0x6660('0x2'));var timeout=require(_0x6660('0x3'));var express=require('express');var router=express[_0x6660('0x4')]();var fs_extra=require(_0x6660('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6660('0x6'));var controller=require('./setting.controller');router[_0x6660('0x7')]('/',auth['isAuthenticated'](),controller[_0x6660('0x8')]);router[_0x6660('0x7')](_0x6660('0x9'),controller['getDate']);router[_0x6660('0x7')](_0x6660('0xa'),controller[_0x6660('0xb')]);router[_0x6660('0x7')]('/:id/logo',controller[_0x6660('0xc')]);router['get'](_0x6660('0xd'),controller[_0x6660('0xe')]);router[_0x6660('0x7')](_0x6660('0xf'),controller[_0x6660('0x10')]);router['get'](_0x6660('0x11'),controller[_0x6660('0x12')]);router[_0x6660('0x7')](_0x6660('0x13'),controller[_0x6660('0x14')]);var upload=multer({'storage':multer[_0x6660('0x15')]({'destination':function(_0x4070f7,_0x413749,_0x55c50f){_0x55c50f(null,path[_0x6660('0x16')](config[_0x6660('0x17')],_0x6660('0x18')));},'filename':function(_0x963b07,_0x24933c,_0x1f4413){_0x1f4413(null,util[_0x6660('0x19')](_0x6660('0x1a'),_0x6660('0x1b'),path['extname'](_0x24933c[_0x6660('0x1c')])));}})});router[_0x6660('0x1d')](_0x6660('0x1e'),upload[_0x6660('0x1f')](_0x6660('0x20')),controller['addLogo']);var upload=multer({'storage':multer[_0x6660('0x15')]({'destination':function(_0x3fb1c4,_0x5dabeb,_0x8186f){_0x8186f(null,path[_0x6660('0x16')](config[_0x6660('0x17')],_0x6660('0x18')));},'filename':function(_0x4c4e75,_0x3504da,_0x41d049){_0x41d049(null,util[_0x6660('0x19')](_0x6660('0x1a'),_0x6660('0x21'),path['extname'](_0x3504da[_0x6660('0x1c')])));}})});router['post']('/:id/logo_login',upload[_0x6660('0x1f')](_0x6660('0x20')),controller[_0x6660('0x22')]);var upload=multer({'storage':multer[_0x6660('0x15')]({'destination':function(_0x58aa74,_0x350b6e,_0x16f4c0){_0x16f4c0(null,path[_0x6660('0x16')](config[_0x6660('0x17')],_0x6660('0x18')));},'filename':function(_0x31b42e,_0x54b5b8,_0x2bab15){_0x2bab15(null,util[_0x6660('0x19')](_0x6660('0x1a'),_0x6660('0x23'),path['extname'](_0x54b5b8[_0x6660('0x1c')])));}})});router[_0x6660('0x1d')]('/:id/preferred',upload[_0x6660('0x1f')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x6660('0x15')]({'destination':function(_0x25dcdc,_0x399326,_0x1eef7c){_0x1eef7c(null,path[_0x6660('0x16')](config['root'],_0x6660('0x18')));},'filename':function(_0x1ea0a2,_0x3fb510,_0xcfba25){_0xcfba25(null,util[_0x6660('0x19')](_0x6660('0x1a'),'favicon',path['extname'](_0x3fb510[_0x6660('0x1c')])));}})});router[_0x6660('0x1d')](_0x6660('0x13'),upload[_0x6660('0x1f')](_0x6660('0x20')),controller[_0x6660('0x24')]);router[_0x6660('0x25')](_0x6660('0xa'),auth[_0x6660('0x26')](),controller['update']);module[_0x6660('0x27')]=router; \ No newline at end of file +var _0x05a8=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','getLogo','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','file','addLogo','logologin','/:id/logo_login','single','preferred','favicon','addFavicon','put','isAuthenticated','update','util'];(function(_0x269ad7,_0xdb2d78){var _0x288391=function(_0x47da69){while(--_0x47da69){_0x269ad7['push'](_0x269ad7['shift']());}};_0x288391(++_0xdb2d78);}(_0x05a8,0xef));var _0x805a=function(_0x4d18da,_0x1fd074){_0x4d18da=_0x4d18da-0x0;var _0x2774af=_0x05a8[_0x4d18da];return _0x2774af;};'use strict';var multer=require('multer');var util=require(_0x805a('0x0'));var path=require(_0x805a('0x1'));var timeout=require(_0x805a('0x2'));var express=require(_0x805a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x805a('0x4'));var interaction=require(_0x805a('0x5'));var config=require(_0x805a('0x6'));var controller=require(_0x805a('0x7'));router[_0x805a('0x8')]('/',auth['isAuthenticated'](),controller[_0x805a('0x9')]);router[_0x805a('0x8')](_0x805a('0xa'),controller['getDate']);router['get'](_0x805a('0xb'),controller['show']);router[_0x805a('0x8')]('/:id/logo',controller[_0x805a('0xc')]);router[_0x805a('0x8')]('/:id/logo_login',controller['getLogoLogin']);router[_0x805a('0x8')](_0x805a('0xd'),controller[_0x805a('0xe')]);router[_0x805a('0x8')](_0x805a('0xf'),controller[_0x805a('0x10')]);router['get']('/:id/favicon',controller[_0x805a('0x11')]);var upload=multer({'storage':multer[_0x805a('0x12')]({'destination':function(_0x32c4f0,_0x3ad364,_0x5423cc){_0x5423cc(null,path[_0x805a('0x13')](config[_0x805a('0x14')],_0x805a('0x15')));},'filename':function(_0x4647b8,_0x58bb57,_0x3410c0){_0x3410c0(null,util[_0x805a('0x16')](_0x805a('0x17'),_0x805a('0x18'),path[_0x805a('0x19')](_0x58bb57[_0x805a('0x1a')])));}})});router[_0x805a('0x1b')](_0x805a('0x1c'),upload['single'](_0x805a('0x1d')),controller[_0x805a('0x1e')]);var upload=multer({'storage':multer[_0x805a('0x12')]({'destination':function(_0x1706bc,_0x23e4b0,_0x5e7539){_0x5e7539(null,path[_0x805a('0x13')](config[_0x805a('0x14')],_0x805a('0x15')));},'filename':function(_0x1af1e5,_0x8a4e20,_0x5b32e5){_0x5b32e5(null,util[_0x805a('0x16')](_0x805a('0x17'),_0x805a('0x1f'),path[_0x805a('0x19')](_0x8a4e20[_0x805a('0x1a')])));}})});router[_0x805a('0x1b')](_0x805a('0x20'),upload[_0x805a('0x21')](_0x805a('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x805a('0x12')]({'destination':function(_0x568f42,_0x712787,_0xc70a7){_0xc70a7(null,path[_0x805a('0x13')](config[_0x805a('0x14')],_0x805a('0x15')));},'filename':function(_0x3e87f0,_0x594d12,_0x49456a){_0x49456a(null,util[_0x805a('0x16')](_0x805a('0x17'),_0x805a('0x22'),path[_0x805a('0x19')](_0x594d12['originalname'])));}})});router[_0x805a('0x1b')]('/:id/preferred',upload[_0x805a('0x21')]('file'),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x284272,_0x2ad06d,_0x3f2000){_0x3f2000(null,path[_0x805a('0x13')](config[_0x805a('0x14')],_0x805a('0x15')));},'filename':function(_0x4f577e,_0x45fef4,_0x1115be){_0x1115be(null,util[_0x805a('0x16')](_0x805a('0x17'),_0x805a('0x23'),path[_0x805a('0x19')](_0x45fef4[_0x805a('0x1a')])));}})});router['post']('/:id/favicon',upload['single']('file'),controller[_0x805a('0x24')]);router[_0x805a('0x25')]('/:id',auth[_0x805a('0x26')](),controller[_0x805a('0x27')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 0f26745..9539e83 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(_0x2d1f7b,_0xf88bac){var _0x4bf52a=function(_0x1b15a3){while(--_0x1b15a3){_0x2d1f7b['push'](_0x2d1f7b['shift']());}};_0x4bf52a(++_0xf88bac);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x12316b,_0x2a68ec){var _0x5d1e5f=function(_0x5d9b39){while(--_0x5d9b39){_0x12316b['push'](_0x12316b['shift']());}};_0x5d1e5f(++_0x2a68ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 d339c90..9c8d2aa 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 _0xf9a6=['code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','stack','name','index','map','Setting','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','keys','rawAttributes','length','include','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','upperFirst','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c2c8f,_0x2812fc){var _0x1e1a39=function(_0x45babd){while(--_0x45babd){_0x1c2c8f['push'](_0x1c2c8f['shift']());}};_0x1e1a39(++_0x2812fc);}(_0xf9a6,0xd8));var _0x6f9a=function(_0x466f86,_0x3fa609){_0x466f86=_0x466f86-0x0;var _0x371d6a=_0xf9a6[_0x466f86];return _0x371d6a;};'use strict';var emlformat=require(_0x6f9a('0x0'));var rimraf=require(_0x6f9a('0x1'));var zipdir=require(_0x6f9a('0x2'));var jsonpatch=require(_0x6f9a('0x3'));var rp=require(_0x6f9a('0x4'));var moment=require('moment');var BPromise=require(_0x6f9a('0x5'));var Mustache=require(_0x6f9a('0x6'));var util=require('util');var path=require(_0x6f9a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6f9a('0x8'));var fs=require('fs');var fs_extra=require(_0x6f9a('0x9'));var _=require(_0x6f9a('0xa'));var squel=require(_0x6f9a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f9a('0xc'));var deskjs=require(_0x6f9a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f9a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6f9a('0xf'));var as=require(_0x6f9a('0x10'));var hardwareService=require(_0x6f9a('0x11'));var logger=require(_0x6f9a('0x12'))(_0x6f9a('0x13'));var utils=require('../../config/utils');var config=require(_0x6f9a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f9a('0x15'))['db'];var jayson=require(_0x6f9a('0x16'));var client=jayson[_0x6f9a('0x17')][_0x6f9a('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4d98d7,_0x109ff5,_0x286cde,_0x13295a){return new BPromise(function(_0xc6ee81,_0x377646){var _0x4d811f=_0x13295a||client;return _0x4d811f[_0x6f9a('0x19')](_0x4d98d7,_0x286cde)[_0x6f9a('0x1a')](function(_0x1bf480){logger[_0x6f9a('0x1b')](_0x6f9a('0x1c'),_0x109ff5,_0x6f9a('0x1d'));logger[_0x6f9a('0x1e')](_0x6f9a('0x1f'),_0x109ff5,_0x6f9a('0x1d'),JSON[_0x6f9a('0x20')](_0x1bf480));if(_0x1bf480[_0x6f9a('0x21')]){if(_0x1bf480['error'][_0x6f9a('0x22')]===0x1f4){logger[_0x6f9a('0x21')]('Setting,\x20%s,\x20%s',_0x109ff5,_0x1bf480['error'][_0x6f9a('0x23')]);return _0x377646(_0x1bf480[_0x6f9a('0x21')][_0x6f9a('0x23')]);}logger[_0x6f9a('0x21')](_0x6f9a('0x1c'),_0x109ff5,_0x1bf480[_0x6f9a('0x21')]['message']);return _0xc6ee81(_0x1bf480[_0x6f9a('0x21')][_0x6f9a('0x23')]);}else{logger['info'](_0x6f9a('0x1c'),_0x109ff5,_0x6f9a('0x1d'));_0xc6ee81(_0x1bf480['result']['message']);}})[_0x6f9a('0x24')](function(_0x3687fd){logger[_0x6f9a('0x21')](_0x6f9a('0x1c'),_0x109ff5,_0x3687fd);_0x377646(_0x3687fd);});});}function respondWithStatusCode(_0x264fcb,_0x3e9363){_0x3e9363=_0x3e9363||0xcc;return function(_0x40a075){if(_0x40a075){return _0x264fcb[_0x6f9a('0x25')](_0x3e9363);}return _0x264fcb[_0x6f9a('0x26')](_0x3e9363)[_0x6f9a('0x27')]();};}function respondWithResult(_0x6ca0aa,_0x22aa95){_0x22aa95=_0x22aa95||0xc8;return function(_0x60e863){if(_0x60e863){return _0x6ca0aa[_0x6f9a('0x26')](_0x22aa95)[_0x6f9a('0x28')](_0x60e863);}};}function respondWithFilteredResult(_0x452cc2,_0x1cfcc0){return function(_0x568ef6){if(_0x568ef6){var _0x47f7b3=typeof _0x1cfcc0[_0x6f9a('0x29')]===_0x6f9a('0x2a')&&typeof _0x1cfcc0[_0x6f9a('0x2b')]==='undefined';var _0x4e91de=_0x568ef6[_0x6f9a('0x2c')];var _0x579a36=_0x47f7b3?0x0:_0x1cfcc0[_0x6f9a('0x29')];var _0x169f7a=_0x47f7b3?_0x568ef6[_0x6f9a('0x2c')]:_0x1cfcc0[_0x6f9a('0x29')]+_0x1cfcc0['limit'];var _0x5758c4;if(_0x169f7a>=_0x4e91de){_0x169f7a=_0x4e91de;_0x5758c4=0xc8;}else{_0x5758c4=0xce;}_0x452cc2['status'](_0x5758c4);return _0x452cc2['set'](_0x6f9a('0x2d'),_0x579a36+'-'+_0x169f7a+'/'+_0x4e91de)['json'](_0x568ef6);}return null;};}function patchUpdates(_0x171587){return function(_0x41cb42){try{jsonpatch[_0x6f9a('0x2e')](_0x41cb42,_0x171587,!![]);}catch(_0x4f179a){return BPromise[_0x6f9a('0x2f')](_0x4f179a);}return _0x41cb42['save']();};}function saveUpdates(_0x813ff0,_0x585c19){return function(_0x578dd5){if(_0x578dd5){return _0x578dd5[_0x6f9a('0x30')](_0x813ff0)['then'](function(_0x384cab){return _0x384cab;});}return null;};}function removeEntity(_0x1c4ae4,_0x3199d1){return function(_0x506453){if(_0x506453){return _0x506453[_0x6f9a('0x31')]()['then'](function(){_0x1c4ae4[_0x6f9a('0x26')](0xcc)[_0x6f9a('0x27')]();});}};}function handleEntityNotFound(_0x1c2115,_0x38ce6d){return function(_0x3002b8){if(!_0x3002b8){_0x1c2115['sendStatus'](0x194);}return _0x3002b8;};}function handleError(_0x3a695f,_0x133157){_0x133157=_0x133157||0x1f4;return function(_0x3abe21){logger[_0x6f9a('0x21')](_0x3abe21[_0x6f9a('0x32')]);if(_0x3abe21[_0x6f9a('0x33')]){delete _0x3abe21['name'];}_0x3a695f['status'](_0x133157)['send'](_0x3abe21);};}exports[_0x6f9a('0x34')]=function(_0x4b552d,_0x7c637c){var _0x407b1f={},_0x3c2eee={},_0x4862ec={'count':0x0,'rows':[]};var _0x83682f=_[_0x6f9a('0x35')](db[_0x6f9a('0x36')]['rawAttributes'],function(_0x50d731){return{'name':_0x50d731[_0x6f9a('0x37')],'type':_0x50d731[_0x6f9a('0x38')][_0x6f9a('0x39')]};});_0x3c2eee[_0x6f9a('0x3a')]=_[_0x6f9a('0x35')](_0x83682f,_0x6f9a('0x33'));_0x3c2eee[_0x6f9a('0x3b')]=_['keys'](_0x4b552d[_0x6f9a('0x3b')]);_0x3c2eee[_0x6f9a('0x3c')]=_['intersection'](_0x3c2eee['model'],_0x3c2eee[_0x6f9a('0x3b')]);_0x407b1f['attributes']=_[_0x6f9a('0x3d')](_0x3c2eee[_0x6f9a('0x3a')],qs[_0x6f9a('0x3e')](_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x3e')]));_0x407b1f[_0x6f9a('0x3f')]=_0x407b1f[_0x6f9a('0x3f')]['length']?_0x407b1f[_0x6f9a('0x3f')]:_0x3c2eee[_0x6f9a('0x3a')];if(!_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x40')](_0x6f9a('0x41'))){_0x407b1f[_0x6f9a('0x2b')]=qs['limit'](_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x2b')]);_0x407b1f['offset']=qs[_0x6f9a('0x29')](_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x29')]);}_0x407b1f[_0x6f9a('0x42')]=qs[_0x6f9a('0x43')](_0x4b552d[_0x6f9a('0x3b')]['sort']);_0x407b1f[_0x6f9a('0x44')]=qs['filters'](_[_0x6f9a('0x45')](_0x4b552d[_0x6f9a('0x3b')],_0x3c2eee[_0x6f9a('0x3c')]),_0x83682f);if(_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x46')]){_0x407b1f[_0x6f9a('0x44')]=_[_0x6f9a('0x47')](_0x407b1f[_0x6f9a('0x44')],{'$or':_['map'](_0x83682f,function(_0x388d3a){if(_0x388d3a['type']!==_0x6f9a('0x48')){var _0x2fee1c={};_0x2fee1c[_0x388d3a[_0x6f9a('0x33')]]={'$like':'%'+_0x4b552d['query']['filter']+'%'};return _0x2fee1c;}})});}_0x407b1f=_[_0x6f9a('0x47')]({},_0x407b1f,_0x4b552d['options']);var _0x588da9={'where':_0x407b1f['where']};return db['Setting']['count'](_0x588da9)[_0x6f9a('0x1a')](function(_0x4e01f0){_0x4862ec[_0x6f9a('0x2c')]=_0x4e01f0;if(_0x4b552d[_0x6f9a('0x3b')][_0x6f9a('0x49')]){_0x407b1f['include']=[{'all':!![]}];}return db['Setting'][_0x6f9a('0x4a')](_0x407b1f);})[_0x6f9a('0x1a')](function(_0x73f6d5){_0x4862ec[_0x6f9a('0x4b')]=_0x73f6d5;return _0x4862ec;})['then'](respondWithFilteredResult(_0x7c637c,_0x407b1f))[_0x6f9a('0x24')](handleError(_0x7c637c,null));};exports['show']=function(_0x7aa81e,_0x3e6e5c){var _0x1c5c34={'raw':![],'where':{'id':_0x7aa81e[_0x6f9a('0x4c')]['id']}},_0x5ae309={};_0x5ae309[_0x6f9a('0x3a')]=_[_0x6f9a('0x4d')](db[_0x6f9a('0x36')][_0x6f9a('0x4e')]);_0x5ae309[_0x6f9a('0x3b')]=_['keys'](_0x7aa81e[_0x6f9a('0x3b')]);_0x5ae309['filters']=_['intersection'](_0x5ae309[_0x6f9a('0x3a')],_0x5ae309['query']);_0x1c5c34[_0x6f9a('0x3f')]=_['intersection'](_0x5ae309[_0x6f9a('0x3a')],qs[_0x6f9a('0x3e')](_0x7aa81e[_0x6f9a('0x3b')][_0x6f9a('0x3e')]));_0x1c5c34[_0x6f9a('0x3f')]=_0x1c5c34[_0x6f9a('0x3f')][_0x6f9a('0x4f')]?_0x1c5c34[_0x6f9a('0x3f')]:_0x5ae309['model'];if(_0x7aa81e[_0x6f9a('0x3b')][_0x6f9a('0x49')]){_0x1c5c34[_0x6f9a('0x50')]=[{'all':!![]}];}_0x1c5c34=_[_0x6f9a('0x47')]({},_0x1c5c34,_0x7aa81e[_0x6f9a('0x51')]);return db[_0x6f9a('0x36')][_0x6f9a('0x52')](_0x1c5c34)['then'](handleEntityNotFound(_0x3e6e5c,null))[_0x6f9a('0x1a')](respondWithResult(_0x3e6e5c,null))[_0x6f9a('0x24')](handleError(_0x3e6e5c,null));};exports['update']=function(_0x37fd1a,_0x47e122){if(_0x37fd1a[_0x6f9a('0x53')]['id']){delete _0x37fd1a[_0x6f9a('0x53')]['id'];}return db[_0x6f9a('0x36')]['find']({'where':{'id':_0x37fd1a[_0x6f9a('0x4c')]['id']}})[_0x6f9a('0x1a')](handleEntityNotFound(_0x47e122,null))[_0x6f9a('0x1a')](saveUpdates(_0x37fd1a[_0x6f9a('0x53')],null))[_0x6f9a('0x1a')](respondWithResult(_0x47e122,null))[_0x6f9a('0x24')](handleError(_0x47e122,null));};exports[_0x6f9a('0x54')]=function(_0x1605ef,_0x9ca14e,_0x578ea4){if(_0x1605ef[_0x6f9a('0x55')]&&_0x1605ef['file'][_0x6f9a('0x56')]){_0x1605ef[_0x6f9a('0x53')][_0x6f9a('0x57')]=_0x1605ef[_0x6f9a('0x55')]['filename'];}return db[_0x6f9a('0x36')]['find']({'where':{'id':_0x1605ef[_0x6f9a('0x4c')]['id']}})[_0x6f9a('0x1a')](handleEntityNotFound(_0x9ca14e,null))[_0x6f9a('0x1a')](saveUpdates(_0x1605ef[_0x6f9a('0x53')],null))[_0x6f9a('0x1a')](respondWithResult(_0x9ca14e,null))[_0x6f9a('0x24')](handleError(_0x9ca14e,null));};exports[_0x6f9a('0x58')]=function(_0x3b44cf,_0x4d3784,_0x3fbd18){if(_0x3b44cf[_0x6f9a('0x55')]&&_0x3b44cf[_0x6f9a('0x55')][_0x6f9a('0x56')]){_0x3b44cf[_0x6f9a('0x53')][_0x6f9a('0x59')]=_0x3b44cf[_0x6f9a('0x55')]['filename'];}return db[_0x6f9a('0x36')][_0x6f9a('0x52')]({'where':{'id':_0x3b44cf[_0x6f9a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d3784,null))['then'](saveUpdates(_0x3b44cf[_0x6f9a('0x53')],null))['then'](respondWithResult(_0x4d3784,null))[_0x6f9a('0x24')](handleError(_0x4d3784,null));};var utilLicense=require(_0x6f9a('0x5a'));exports['getLogo']=function(_0x2b1c22,_0x33c3f0,_0x171c2f){var _0xa57da3=_0x6f9a('0x5b');var _0x1ca292={'custom':![]};return utilLicense[_0x6f9a('0x5c')]()[_0x6f9a('0x1a')](function(_0x3d7a0d){if(_0x3d7a0d){_0x1ca292=_0x3d7a0d;}return db[_0x6f9a('0x36')][_0x6f9a('0x52')]({'where':{'id':_0x2b1c22[_0x6f9a('0x4c')]['id']},'attributes':['logo',_0x6f9a('0x59'),_0x6f9a('0x5d'),_0x6f9a('0x5e'),_0x6f9a('0x5f'),_0x6f9a('0x60'),_0x6f9a('0x61'),_0x6f9a('0x62')],'raw':!![]});})[_0x6f9a('0x1a')](handleEntityNotFound(_0x33c3f0,null))[_0x6f9a('0x1a')](function(_0x125929){if(_0x125929){var _0xa84a9b=_0x125929[_0x6f9a('0x57')]&&fs[_0x6f9a('0x63')](path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xa57da3,_['toLower'](_0x125929['logo'])))?path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xa57da3,_[_0x6f9a('0x66')](_0x125929[_0x6f9a('0x57')])):path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xa57da3,_[_0x6f9a('0x66')](_0x6f9a('0x67')));var _0x20ef7f=_0x6f9a('0x68')+_['upperFirst']('logo');if(_0x125929[_0x20ef7f]||!_0x1ca292[_0x6f9a('0x69')]){_0xa84a9b=path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xa57da3,_[_0x6f9a('0x66')]('default_logo.svg'));}if(!fs[_0x6f9a('0x63')](_0xa84a9b)){throw new db[(_0x6f9a('0x6a'))][(_0x6f9a('0x6b'))](_['upperFirst'](_0x6f9a('0x57'))+_0x6f9a('0x6c'));}return _0x33c3f0[_0x6f9a('0x6d')](_0xa84a9b);}})[_0x6f9a('0x24')](handleError(_0x33c3f0,null));};var utilLicense=require(_0x6f9a('0x5a'));exports[_0x6f9a('0x6e')]=function(_0x3586d4,_0x5eeff8,_0x5649d5){var _0x1c9fc3=_0x6f9a('0x5b');var _0x5ae2f6={'custom':![]};return utilLicense['getLicense']()[_0x6f9a('0x1a')](function(_0xfa28f0){if(_0xfa28f0){_0x5ae2f6=_0xfa28f0;}return db[_0x6f9a('0x36')][_0x6f9a('0x52')]({'where':{'id':_0x3586d4[_0x6f9a('0x4c')]['id']},'attributes':[_0x6f9a('0x57'),_0x6f9a('0x59'),_0x6f9a('0x5d'),_0x6f9a('0x5e'),_0x6f9a('0x5f'),'defaultLoginLogo',_0x6f9a('0x61'),_0x6f9a('0x62')],'raw':!![]});})[_0x6f9a('0x1a')](handleEntityNotFound(_0x5eeff8,null))['then'](function(_0x2dece4){if(_0x2dece4){var _0x5ccd5d=_0x2dece4[_0x6f9a('0x59')]&&fs[_0x6f9a('0x63')](path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x1c9fc3,_[_0x6f9a('0x66')](_0x2dece4[_0x6f9a('0x59')])))?path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x1c9fc3,_['toLower'](_0x2dece4[_0x6f9a('0x59')])):path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x1c9fc3,_[_0x6f9a('0x66')](_0x6f9a('0x6f')));var _0x52b1c0=_0x6f9a('0x68')+_[_0x6f9a('0x70')](_0x6f9a('0x59'));if(_0x2dece4[_0x52b1c0]||!_0x5ae2f6[_0x6f9a('0x69')]){_0x5ccd5d=path[_0x6f9a('0x64')](config['root'],_0x1c9fc3,_[_0x6f9a('0x66')](_0x6f9a('0x6f')));}if(!fs[_0x6f9a('0x63')](_0x5ccd5d)){throw new db[(_0x6f9a('0x6a'))][(_0x6f9a('0x6b'))](_['upperFirst'](_0x6f9a('0x59'))+'\x20not\x20found');}return _0x5eeff8['download'](_0x5ccd5d);}})[_0x6f9a('0x24')](handleError(_0x5eeff8,null));};exports[_0x6f9a('0x71')]=function(_0x3ae946,_0x4c0a00){return db['Setting']['find']({'where':{'id':_0x3ae946['params']['id']},'attributes':[_0x6f9a('0x72')]})[_0x6f9a('0x1a')](respondWithResult(_0x4c0a00,null))[_0x6f9a('0x24')](handleError(_0x4c0a00,null));};exports['addPreferred']=function(_0x173b6a,_0x51475a,_0x5a507c){if(_0x173b6a[_0x6f9a('0x55')]&&_0x173b6a[_0x6f9a('0x55')]['filename']){_0x173b6a['body'][_0x6f9a('0x5d')]=_0x173b6a['file'][_0x6f9a('0x56')];}return db['Setting'][_0x6f9a('0x52')]({'where':{'id':_0x173b6a[_0x6f9a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51475a,null))[_0x6f9a('0x1a')](saveUpdates(_0x173b6a['body'],null))[_0x6f9a('0x1a')](respondWithResult(_0x51475a,null))[_0x6f9a('0x24')](handleError(_0x51475a,null));};var utilLicense=require(_0x6f9a('0x5a'));exports['getPreferred']=function(_0x18d5c1,_0x487bda,_0x11da7b){var _0x72cc98=_0x6f9a('0x5b');var _0x17a64c={'custom':![]};return utilLicense[_0x6f9a('0x5c')]()[_0x6f9a('0x1a')](function(_0x54d88f){if(_0x54d88f){_0x17a64c=_0x54d88f;}return db['Setting'][_0x6f9a('0x52')]({'where':{'id':_0x18d5c1[_0x6f9a('0x4c')]['id']},'attributes':['logo',_0x6f9a('0x59'),'preferred',_0x6f9a('0x5e'),_0x6f9a('0x5f'),_0x6f9a('0x60'),_0x6f9a('0x61'),_0x6f9a('0x62')],'raw':!![]});})[_0x6f9a('0x1a')](handleEntityNotFound(_0x487bda,null))[_0x6f9a('0x1a')](function(_0x1715c6){if(_0x1715c6){var _0x471da0=_0x1715c6[_0x6f9a('0x5d')]&&fs[_0x6f9a('0x63')](path['join'](config['root'],_0x72cc98,_[_0x6f9a('0x66')](_0x1715c6[_0x6f9a('0x5d')])))?path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x72cc98,_[_0x6f9a('0x66')](_0x1715c6['preferred'])):path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x72cc98,_['toLower'](_0x6f9a('0x73')));var _0x959f17=_0x6f9a('0x68')+_[_0x6f9a('0x70')](_0x6f9a('0x5d'));if(_0x1715c6[_0x959f17]||!_0x17a64c[_0x6f9a('0x69')]||!_0x17a64c[_0x6f9a('0x5d')]){_0x471da0=path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0x72cc98,_[_0x6f9a('0x66')](_0x6f9a('0x73')));}if(!fs['existsSync'](_0x471da0)){throw new db[(_0x6f9a('0x6a'))][(_0x6f9a('0x6b'))](_[_0x6f9a('0x70')]('preferred')+_0x6f9a('0x6c'));}return _0x487bda[_0x6f9a('0x6d')](_0x471da0);}})['catch'](handleError(_0x487bda,null));};exports[_0x6f9a('0x74')]=function(_0xc60dfd,_0x4f034e,_0x5ef4d7){if(_0xc60dfd[_0x6f9a('0x55')]&&_0xc60dfd['file'][_0x6f9a('0x56')]){_0xc60dfd[_0x6f9a('0x53')][_0x6f9a('0x5e')]=_0xc60dfd[_0x6f9a('0x55')]['filename'];}return db[_0x6f9a('0x36')][_0x6f9a('0x52')]({'where':{'id':_0xc60dfd[_0x6f9a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4f034e,null))[_0x6f9a('0x1a')](saveUpdates(_0xc60dfd[_0x6f9a('0x53')],null))[_0x6f9a('0x1a')](respondWithResult(_0x4f034e,null))[_0x6f9a('0x24')](handleError(_0x4f034e,null));};var utilLicense=require('../../config/license/util');exports[_0x6f9a('0x75')]=function(_0x335c6b,_0x298134,_0x50f91a){var _0xc82ce2='server/files/images/logos';var _0x2d77a6={'custom':![]};return utilLicense[_0x6f9a('0x5c')]()['then'](function(_0x262781){if(_0x262781){_0x2d77a6=_0x262781;}return db[_0x6f9a('0x36')]['find']({'where':{'id':_0x335c6b[_0x6f9a('0x4c')]['id']},'attributes':[_0x6f9a('0x57'),_0x6f9a('0x59'),_0x6f9a('0x5d'),_0x6f9a('0x5e'),_0x6f9a('0x5f'),'defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x6f9a('0x1a')](handleEntityNotFound(_0x298134,null))[_0x6f9a('0x1a')](function(_0x302b70){if(_0x302b70){var _0x5c916e=_0x302b70[_0x6f9a('0x5e')]&&fs['existsSync'](path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xc82ce2,_[_0x6f9a('0x66')](_0x302b70['favicon'])))?path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xc82ce2,_['toLower'](_0x302b70['favicon'])):path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xc82ce2,_[_0x6f9a('0x66')](_0x6f9a('0x76')));var _0x3584c8='default'+_[_0x6f9a('0x70')](_0x6f9a('0x5e'));if(_0x302b70[_0x3584c8]||!_0x2d77a6['custom']){_0x5c916e=path[_0x6f9a('0x64')](config[_0x6f9a('0x65')],_0xc82ce2,_[_0x6f9a('0x66')](_0x6f9a('0x76')));}if(!fs[_0x6f9a('0x63')](_0x5c916e)){throw new db['Sequelize'][(_0x6f9a('0x6b'))](_[_0x6f9a('0x70')]('favicon')+_0x6f9a('0x6c'));}return _0x298134[_0x6f9a('0x6d')](_0x5c916e);}})['catch'](handleError(_0x298134,null));};exports[_0x6f9a('0x77')]=function(_0x5f415d,_0x1e2baf){var _0x2fa4d9={'offset':moment()['utcOffset']()};_0x2fa4d9[_0x6f9a('0x78')]=moment()[_0x6f9a('0x79')](_0x2fa4d9['offset'])[_0x6f9a('0x7a')](_0x6f9a('0x7b'));return _0x1e2baf['status'](0xc8)[_0x6f9a('0x7c')](_0x2fa4d9);}; \ No newline at end of file +var _0xab44=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','keys','include','options','body','find','params','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','defaultLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','getLogoLogin','getLicense','favicon','defaultLoginLogo','default_loginLogo.svg','existsSync','gdpr','addPreferred','preferred','getPreferred','ValidationError','download','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xab44,0xe2));var _0x4ab4=function(_0x3b2b7b,_0x57b978){_0x3b2b7b=_0x3b2b7b-0x0;var _0x221f5b=_0xab44[_0x3b2b7b];return _0x221f5b;};'use strict';var emlformat=require(_0x4ab4('0x0'));var rimraf=require(_0x4ab4('0x1'));var zipdir=require(_0x4ab4('0x2'));var jsonpatch=require(_0x4ab4('0x3'));var rp=require(_0x4ab4('0x4'));var moment=require(_0x4ab4('0x5'));var BPromise=require(_0x4ab4('0x6'));var Mustache=require(_0x4ab4('0x7'));var util=require('util');var path=require('path');var sox=require(_0x4ab4('0x8'));var csv=require(_0x4ab4('0x9'));var ejs=require(_0x4ab4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ab4('0xb'));var squel=require(_0x4ab4('0xc'));var crypto=require('crypto');var jsforce=require(_0x4ab4('0xd'));var deskjs=require(_0x4ab4('0xe'));var toCsv=require(_0x4ab4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4ab4('0xf'));var authService=require(_0x4ab4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4ab4('0x11'));var hardwareService=require(_0x4ab4('0x12'));var logger=require(_0x4ab4('0x13'))(_0x4ab4('0x14'));var utils=require(_0x4ab4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4ab4('0x16'));var db=require(_0x4ab4('0x17'))['db'];var jayson=require(_0x4ab4('0x18'));var client=jayson[_0x4ab4('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e5e3f,_0x123c89,_0x5af697,_0x16d910){return new BPromise(function(_0x201c2c,_0x41ccbf){var _0x17feac=_0x16d910||client;return _0x17feac[_0x4ab4('0x1a')](_0x4e5e3f,_0x5af697)[_0x4ab4('0x1b')](function(_0x4a51bd){logger[_0x4ab4('0x1c')](_0x4ab4('0x1d'),_0x123c89,'request\x20sent');logger['debug'](_0x4ab4('0x1e'),_0x123c89,_0x4ab4('0x1f'),JSON[_0x4ab4('0x20')](_0x4a51bd));if(_0x4a51bd[_0x4ab4('0x21')]){if(_0x4a51bd[_0x4ab4('0x21')][_0x4ab4('0x22')]===0x1f4){logger[_0x4ab4('0x21')](_0x4ab4('0x1d'),_0x123c89,_0x4a51bd[_0x4ab4('0x21')]['message']);return _0x41ccbf(_0x4a51bd['error']['message']);}logger['error'](_0x4ab4('0x1d'),_0x123c89,_0x4a51bd[_0x4ab4('0x21')][_0x4ab4('0x23')]);return _0x201c2c(_0x4a51bd[_0x4ab4('0x21')][_0x4ab4('0x23')]);}else{logger[_0x4ab4('0x1c')](_0x4ab4('0x1d'),_0x123c89,_0x4ab4('0x1f'));_0x201c2c(_0x4a51bd[_0x4ab4('0x24')][_0x4ab4('0x23')]);}})['catch'](function(_0x359ddd){logger[_0x4ab4('0x21')](_0x4ab4('0x1d'),_0x123c89,_0x359ddd);_0x41ccbf(_0x359ddd);});});}function respondWithStatusCode(_0x29d5c5,_0x59ea69){_0x59ea69=_0x59ea69||0xcc;return function(_0xbc71cc){if(_0xbc71cc){return _0x29d5c5[_0x4ab4('0x25')](_0x59ea69);}return _0x29d5c5['status'](_0x59ea69)[_0x4ab4('0x26')]();};}function respondWithResult(_0x48e866,_0x15135c){_0x15135c=_0x15135c||0xc8;return function(_0x356363){if(_0x356363){return _0x48e866[_0x4ab4('0x27')](_0x15135c)[_0x4ab4('0x28')](_0x356363);}};}function respondWithFilteredResult(_0x5c3935,_0x2c58c1){return function(_0x398273){if(_0x398273){var _0x147ee2=typeof _0x2c58c1[_0x4ab4('0x29')]===_0x4ab4('0x2a')&&typeof _0x2c58c1[_0x4ab4('0x2b')]===_0x4ab4('0x2a');var _0x4f3a61=_0x398273['count'];var _0x3337eb=_0x147ee2?0x0:_0x2c58c1[_0x4ab4('0x29')];var _0x1502df=_0x147ee2?_0x398273[_0x4ab4('0x2c')]:_0x2c58c1['offset']+_0x2c58c1[_0x4ab4('0x2b')];var _0x2d399e;if(_0x1502df>=_0x4f3a61){_0x1502df=_0x4f3a61;_0x2d399e=0xc8;}else{_0x2d399e=0xce;}_0x5c3935['status'](_0x2d399e);return _0x5c3935[_0x4ab4('0x2d')](_0x4ab4('0x2e'),_0x3337eb+'-'+_0x1502df+'/'+_0x4f3a61)[_0x4ab4('0x28')](_0x398273);}return null;};}function patchUpdates(_0x188877){return function(_0x3a5078){try{jsonpatch[_0x4ab4('0x2f')](_0x3a5078,_0x188877,!![]);}catch(_0x5915d5){return BPromise[_0x4ab4('0x30')](_0x5915d5);}return _0x3a5078[_0x4ab4('0x31')]();};}function saveUpdates(_0xeecdf,_0x11d287){return function(_0x65fee9){if(_0x65fee9){return _0x65fee9[_0x4ab4('0x32')](_0xeecdf)[_0x4ab4('0x1b')](function(_0x498a1a){return _0x498a1a;});}return null;};}function removeEntity(_0x14c132,_0x5b4994){return function(_0x520671){if(_0x520671){return _0x520671['destroy']()['then'](function(){_0x14c132[_0x4ab4('0x27')](0xcc)[_0x4ab4('0x26')]();});}};}function handleEntityNotFound(_0x4f61fe,_0x14472f){return function(_0x21bceb){if(!_0x21bceb){_0x4f61fe[_0x4ab4('0x25')](0x194);}return _0x21bceb;};}function handleError(_0x8d3929,_0x415643){_0x415643=_0x415643||0x1f4;return function(_0x4663b1){logger[_0x4ab4('0x21')](_0x4663b1[_0x4ab4('0x33')]);if(_0x4663b1['name']){delete _0x4663b1[_0x4ab4('0x34')];}_0x8d3929[_0x4ab4('0x27')](_0x415643)[_0x4ab4('0x35')](_0x4663b1);};}exports['index']=function(_0x101c70,_0x3f8382){var _0x2c98ec={},_0x572423={},_0x498194={'count':0x0,'rows':[]};var _0x48a76d=_[_0x4ab4('0x36')](db[_0x4ab4('0x37')][_0x4ab4('0x38')],function(_0xda6b9e){return{'name':_0xda6b9e[_0x4ab4('0x39')],'type':_0xda6b9e[_0x4ab4('0x3a')][_0x4ab4('0x3b')]};});_0x572423[_0x4ab4('0x3c')]=_['map'](_0x48a76d,_0x4ab4('0x34'));_0x572423[_0x4ab4('0x3d')]=_['keys'](_0x101c70[_0x4ab4('0x3d')]);_0x572423[_0x4ab4('0x3e')]=_['intersection'](_0x572423['model'],_0x572423['query']);_0x2c98ec['attributes']=_[_0x4ab4('0x3f')](_0x572423['model'],qs[_0x4ab4('0x40')](_0x101c70[_0x4ab4('0x3d')][_0x4ab4('0x40')]));_0x2c98ec['attributes']=_0x2c98ec[_0x4ab4('0x41')][_0x4ab4('0x42')]?_0x2c98ec['attributes']:_0x572423[_0x4ab4('0x3c')];if(!_0x101c70[_0x4ab4('0x3d')]['hasOwnProperty']('nolimit')){_0x2c98ec['limit']=qs['limit'](_0x101c70['query'][_0x4ab4('0x2b')]);_0x2c98ec[_0x4ab4('0x29')]=qs[_0x4ab4('0x29')](_0x101c70[_0x4ab4('0x3d')][_0x4ab4('0x29')]);}_0x2c98ec[_0x4ab4('0x43')]=qs[_0x4ab4('0x44')](_0x101c70['query']['sort']);_0x2c98ec[_0x4ab4('0x45')]=qs[_0x4ab4('0x3e')](_[_0x4ab4('0x46')](_0x101c70[_0x4ab4('0x3d')],_0x572423[_0x4ab4('0x3e')]),_0x48a76d);if(_0x101c70[_0x4ab4('0x3d')][_0x4ab4('0x47')]){_0x2c98ec[_0x4ab4('0x45')]=_[_0x4ab4('0x48')](_0x2c98ec['where'],{'$or':_['map'](_0x48a76d,function(_0x49ebc2){if(_0x49ebc2[_0x4ab4('0x3a')]!==_0x4ab4('0x49')){var _0x44a2e2={};_0x44a2e2[_0x49ebc2[_0x4ab4('0x34')]]={'$like':'%'+_0x101c70[_0x4ab4('0x3d')]['filter']+'%'};return _0x44a2e2;}})});}_0x2c98ec=_['merge']({},_0x2c98ec,_0x101c70['options']);var _0x572c08={'where':_0x2c98ec[_0x4ab4('0x45')]};return db[_0x4ab4('0x37')][_0x4ab4('0x2c')](_0x572c08)[_0x4ab4('0x1b')](function(_0x438936){_0x498194[_0x4ab4('0x2c')]=_0x438936;if(_0x101c70[_0x4ab4('0x3d')][_0x4ab4('0x4a')]){_0x2c98ec['include']=[{'all':!![]}];}return db[_0x4ab4('0x37')]['findAll'](_0x2c98ec);})['then'](function(_0x31e6fe){_0x498194[_0x4ab4('0x4b')]=_0x31e6fe;return _0x498194;})[_0x4ab4('0x1b')](respondWithFilteredResult(_0x3f8382,_0x2c98ec))[_0x4ab4('0x4c')](handleError(_0x3f8382,null));};exports['show']=function(_0x37e523,_0x1b53d8){var _0x2d377f={'raw':![],'where':{'id':_0x37e523['params']['id']}},_0xc5cc48={};_0xc5cc48[_0x4ab4('0x3c')]=_['keys'](db[_0x4ab4('0x37')][_0x4ab4('0x38')]);_0xc5cc48['query']=_[_0x4ab4('0x4d')](_0x37e523[_0x4ab4('0x3d')]);_0xc5cc48[_0x4ab4('0x3e')]=_[_0x4ab4('0x3f')](_0xc5cc48[_0x4ab4('0x3c')],_0xc5cc48[_0x4ab4('0x3d')]);_0x2d377f[_0x4ab4('0x41')]=_['intersection'](_0xc5cc48[_0x4ab4('0x3c')],qs[_0x4ab4('0x40')](_0x37e523[_0x4ab4('0x3d')][_0x4ab4('0x40')]));_0x2d377f[_0x4ab4('0x41')]=_0x2d377f[_0x4ab4('0x41')][_0x4ab4('0x42')]?_0x2d377f['attributes']:_0xc5cc48['model'];if(_0x37e523[_0x4ab4('0x3d')][_0x4ab4('0x4a')]){_0x2d377f[_0x4ab4('0x4e')]=[{'all':!![]}];}_0x2d377f=_[_0x4ab4('0x48')]({},_0x2d377f,_0x37e523[_0x4ab4('0x4f')]);return db[_0x4ab4('0x37')]['find'](_0x2d377f)[_0x4ab4('0x1b')](handleEntityNotFound(_0x1b53d8,null))['then'](respondWithResult(_0x1b53d8,null))['catch'](handleError(_0x1b53d8,null));};exports['update']=function(_0x155432,_0x239d93){if(_0x155432[_0x4ab4('0x50')]['id']){delete _0x155432['body']['id'];}return db[_0x4ab4('0x37')][_0x4ab4('0x51')]({'where':{'id':_0x155432[_0x4ab4('0x52')]['id']}})['then'](handleEntityNotFound(_0x239d93,null))[_0x4ab4('0x1b')](saveUpdates(_0x155432[_0x4ab4('0x50')],null))[_0x4ab4('0x1b')](respondWithResult(_0x239d93,null))[_0x4ab4('0x4c')](handleError(_0x239d93,null));};exports[_0x4ab4('0x53')]=function(_0x13be60,_0x3280bb,_0x27a614){if(_0x13be60[_0x4ab4('0x54')]&&_0x13be60[_0x4ab4('0x54')][_0x4ab4('0x55')]){_0x13be60['body'][_0x4ab4('0x56')]=_0x13be60[_0x4ab4('0x54')][_0x4ab4('0x55')];}return db['Setting'][_0x4ab4('0x51')]({'where':{'id':_0x13be60[_0x4ab4('0x52')]['id']}})[_0x4ab4('0x1b')](handleEntityNotFound(_0x3280bb,null))[_0x4ab4('0x1b')](saveUpdates(_0x13be60['body'],null))['then'](respondWithResult(_0x3280bb,null))[_0x4ab4('0x4c')](handleError(_0x3280bb,null));};exports['addLogoLogin']=function(_0x518193,_0x32e3ba,_0x114c12){if(_0x518193[_0x4ab4('0x54')]&&_0x518193[_0x4ab4('0x54')][_0x4ab4('0x55')]){_0x518193[_0x4ab4('0x50')][_0x4ab4('0x57')]=_0x518193[_0x4ab4('0x54')]['filename'];}return db['Setting'][_0x4ab4('0x51')]({'where':{'id':_0x518193[_0x4ab4('0x52')]['id']}})[_0x4ab4('0x1b')](handleEntityNotFound(_0x32e3ba,null))[_0x4ab4('0x1b')](saveUpdates(_0x518193['body'],null))[_0x4ab4('0x1b')](respondWithResult(_0x32e3ba,null))[_0x4ab4('0x4c')](handleError(_0x32e3ba,null));};var utilLicense=require(_0x4ab4('0x16'));exports[_0x4ab4('0x58')]=function(_0x367067,_0x3e3901,_0xbfadab){var _0x3f9b6b=_0x4ab4('0x59');var _0x211a33={'custom':![]};return utilLicense['getLicense']()[_0x4ab4('0x1b')](function(_0x49c9c1){if(_0x49c9c1){_0x211a33=_0x49c9c1;}return db['Setting']['find']({'where':{'id':_0x367067[_0x4ab4('0x52')]['id']},'attributes':[_0x4ab4('0x56'),'loginLogo','preferred','favicon',_0x4ab4('0x5a'),'defaultLoginLogo',_0x4ab4('0x5b'),_0x4ab4('0x5c')],'raw':!![]});})[_0x4ab4('0x1b')](handleEntityNotFound(_0x3e3901,null))[_0x4ab4('0x1b')](function(_0x296e4b){if(_0x296e4b){var _0x4420e6=_0x296e4b[_0x4ab4('0x56')]&&fs['existsSync'](path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x3f9b6b,_['toLower'](_0x296e4b['logo'])))?path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x3f9b6b,_[_0x4ab4('0x5f')](_0x296e4b['logo'])):path['join'](config[_0x4ab4('0x5e')],_0x3f9b6b,_[_0x4ab4('0x5f')](_0x4ab4('0x60')));var _0x4f8926=_0x4ab4('0x61')+_[_0x4ab4('0x62')](_0x4ab4('0x56'));if(_0x296e4b[_0x4f8926]||!_0x211a33[_0x4ab4('0x63')]){_0x4420e6=path['join'](config[_0x4ab4('0x5e')],_0x3f9b6b,_[_0x4ab4('0x5f')]('default_logo.svg'));}if(!fs['existsSync'](_0x4420e6)){throw new db[(_0x4ab4('0x64'))]['ValidationError'](_['upperFirst'](_0x4ab4('0x56'))+_0x4ab4('0x65'));}return _0x3e3901['download'](_0x4420e6);}})[_0x4ab4('0x4c')](handleError(_0x3e3901,null));};var utilLicense=require(_0x4ab4('0x16'));exports[_0x4ab4('0x66')]=function(_0x3d9ee9,_0x4453e8,_0x4e6bc6){var _0x235385=_0x4ab4('0x59');var _0x37f421={'custom':![]};return utilLicense[_0x4ab4('0x67')]()[_0x4ab4('0x1b')](function(_0x16ef05){if(_0x16ef05){_0x37f421=_0x16ef05;}return db[_0x4ab4('0x37')][_0x4ab4('0x51')]({'where':{'id':_0x3d9ee9[_0x4ab4('0x52')]['id']},'attributes':[_0x4ab4('0x56'),_0x4ab4('0x57'),'preferred',_0x4ab4('0x68'),_0x4ab4('0x5a'),_0x4ab4('0x69'),'defaultPreferred',_0x4ab4('0x5c')],'raw':!![]});})[_0x4ab4('0x1b')](handleEntityNotFound(_0x4453e8,null))[_0x4ab4('0x1b')](function(_0x1e427b){if(_0x1e427b){var _0x460914=_0x1e427b[_0x4ab4('0x57')]&&fs['existsSync'](path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x235385,_[_0x4ab4('0x5f')](_0x1e427b[_0x4ab4('0x57')])))?path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x235385,_[_0x4ab4('0x5f')](_0x1e427b[_0x4ab4('0x57')])):path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x235385,_[_0x4ab4('0x5f')](_0x4ab4('0x6a')));var _0x4c3408=_0x4ab4('0x61')+_['upperFirst'](_0x4ab4('0x57'));if(_0x1e427b[_0x4c3408]||!_0x37f421['custom']){_0x460914=path[_0x4ab4('0x5d')](config['root'],_0x235385,_['toLower'](_0x4ab4('0x6a')));}if(!fs[_0x4ab4('0x6b')](_0x460914)){throw new db[(_0x4ab4('0x64'))]['ValidationError'](_[_0x4ab4('0x62')](_0x4ab4('0x57'))+_0x4ab4('0x65'));}return _0x4453e8['download'](_0x460914);}})[_0x4ab4('0x4c')](handleError(_0x4453e8,null));};exports[_0x4ab4('0x6c')]=function(_0x39bfe3,_0x5a7a2e){return db['Setting'][_0x4ab4('0x51')]({'where':{'id':_0x39bfe3['params']['id']},'attributes':['securePassword']})[_0x4ab4('0x1b')](respondWithResult(_0x5a7a2e,null))['catch'](handleError(_0x5a7a2e,null));};exports[_0x4ab4('0x6d')]=function(_0x561c2,_0x27d1b6,_0x1b5b7d){if(_0x561c2[_0x4ab4('0x54')]&&_0x561c2[_0x4ab4('0x54')][_0x4ab4('0x55')]){_0x561c2['body'][_0x4ab4('0x6e')]=_0x561c2[_0x4ab4('0x54')][_0x4ab4('0x55')];}return db['Setting']['find']({'where':{'id':_0x561c2[_0x4ab4('0x52')]['id']}})[_0x4ab4('0x1b')](handleEntityNotFound(_0x27d1b6,null))[_0x4ab4('0x1b')](saveUpdates(_0x561c2[_0x4ab4('0x50')],null))[_0x4ab4('0x1b')](respondWithResult(_0x27d1b6,null))[_0x4ab4('0x4c')](handleError(_0x27d1b6,null));};var utilLicense=require(_0x4ab4('0x16'));exports[_0x4ab4('0x6f')]=function(_0x1ad485,_0x3fa4e1,_0x1e05a6){var _0x39c040=_0x4ab4('0x59');var _0x56ff08={'custom':![]};return utilLicense[_0x4ab4('0x67')]()[_0x4ab4('0x1b')](function(_0x54d684){if(_0x54d684){_0x56ff08=_0x54d684;}return db[_0x4ab4('0x37')][_0x4ab4('0x51')]({'where':{'id':_0x1ad485['params']['id']},'attributes':[_0x4ab4('0x56'),'loginLogo','preferred','favicon',_0x4ab4('0x5a'),_0x4ab4('0x69'),'defaultPreferred',_0x4ab4('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x3fa4e1,null))[_0x4ab4('0x1b')](function(_0x7f45ea){if(_0x7f45ea){var _0x216854=_0x7f45ea['preferred']&&fs[_0x4ab4('0x6b')](path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x39c040,_[_0x4ab4('0x5f')](_0x7f45ea[_0x4ab4('0x6e')])))?path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x39c040,_[_0x4ab4('0x5f')](_0x7f45ea[_0x4ab4('0x6e')])):path['join'](config[_0x4ab4('0x5e')],_0x39c040,_[_0x4ab4('0x5f')]('default_preferred.png'));var _0x33fdd8=_0x4ab4('0x61')+_['upperFirst'](_0x4ab4('0x6e'));if(_0x7f45ea[_0x33fdd8]||!_0x56ff08[_0x4ab4('0x63')]||!_0x56ff08['preferred']){_0x216854=path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x39c040,_[_0x4ab4('0x5f')]('default_preferred.png'));}if(!fs[_0x4ab4('0x6b')](_0x216854)){throw new db[(_0x4ab4('0x64'))][(_0x4ab4('0x70'))](_[_0x4ab4('0x62')](_0x4ab4('0x6e'))+_0x4ab4('0x65'));}return _0x3fa4e1[_0x4ab4('0x71')](_0x216854);}})['catch'](handleError(_0x3fa4e1,null));};exports[_0x4ab4('0x72')]=function(_0xa59516,_0x3ec448,_0x155034){if(_0xa59516[_0x4ab4('0x54')]&&_0xa59516[_0x4ab4('0x54')]['filename']){_0xa59516[_0x4ab4('0x50')][_0x4ab4('0x68')]=_0xa59516[_0x4ab4('0x54')][_0x4ab4('0x55')];}return db[_0x4ab4('0x37')][_0x4ab4('0x51')]({'where':{'id':_0xa59516[_0x4ab4('0x52')]['id']}})[_0x4ab4('0x1b')](handleEntityNotFound(_0x3ec448,null))['then'](saveUpdates(_0xa59516[_0x4ab4('0x50')],null))[_0x4ab4('0x1b')](respondWithResult(_0x3ec448,null))[_0x4ab4('0x4c')](handleError(_0x3ec448,null));};var utilLicense=require(_0x4ab4('0x16'));exports['getFavicon']=function(_0x4b4e70,_0x3766b9,_0x3c9c61){var _0x22ac57=_0x4ab4('0x59');var _0x3d55db={'custom':![]};return utilLicense['getLicense']()[_0x4ab4('0x1b')](function(_0x467cfe){if(_0x467cfe){_0x3d55db=_0x467cfe;}return db['Setting'][_0x4ab4('0x51')]({'where':{'id':_0x4b4e70[_0x4ab4('0x52')]['id']},'attributes':[_0x4ab4('0x56'),'loginLogo',_0x4ab4('0x6e'),_0x4ab4('0x68'),_0x4ab4('0x5a'),_0x4ab4('0x69'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3766b9,null))[_0x4ab4('0x1b')](function(_0x504393){if(_0x504393){var _0x5ac272=_0x504393[_0x4ab4('0x68')]&&fs[_0x4ab4('0x6b')](path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x22ac57,_['toLower'](_0x504393['favicon'])))?path[_0x4ab4('0x5d')](config[_0x4ab4('0x5e')],_0x22ac57,_[_0x4ab4('0x5f')](_0x504393[_0x4ab4('0x68')])):path[_0x4ab4('0x5d')](config['root'],_0x22ac57,_[_0x4ab4('0x5f')](_0x4ab4('0x73')));var _0xe24a9d='default'+_[_0x4ab4('0x62')](_0x4ab4('0x68'));if(_0x504393[_0xe24a9d]||!_0x3d55db[_0x4ab4('0x63')]){_0x5ac272=path['join'](config[_0x4ab4('0x5e')],_0x22ac57,_[_0x4ab4('0x5f')]('default_favicon.ico'));}if(!fs[_0x4ab4('0x6b')](_0x5ac272)){throw new db[(_0x4ab4('0x64'))][(_0x4ab4('0x70'))](_[_0x4ab4('0x62')](_0x4ab4('0x68'))+_0x4ab4('0x65'));}return _0x3766b9[_0x4ab4('0x71')](_0x5ac272);}})['catch'](handleError(_0x3766b9,null));};exports[_0x4ab4('0x74')]=function(_0x38bd05,_0x1c4bf9){var _0x5de92e={'offset':moment()[_0x4ab4('0x75')]()};_0x5de92e[_0x4ab4('0x76')]=moment()['utcOffset'](_0x5de92e[_0x4ab4('0x29')])[_0x4ab4('0x77')](_0x4ab4('0x78'));return _0x1c4bf9['status'](0xc8)[_0x4ab4('0x35')](_0x5de92e);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index b6687bb..6d3ed62 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(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x55ca,0x126));var _0xa55c=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x55ca[_0x4cd846];return _0x2f2a7d;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 76fc131..3788414 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 _0xa9ad=['jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','where','attributes','include','model','map','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x206137,_0x2a56c7){var _0x96c5f7=function(_0x3f72d7){while(--_0x3f72d7){_0x206137['push'](_0x206137['shift']());}};_0x96c5f7(++_0x2a56c7);}(_0xa9ad,0x1ca));var _0xda9a=function(_0x48102,_0x4e5030){_0x48102=_0x48102-0x0;var _0xbcbafa=_0xa9ad[_0x48102];return _0xbcbafa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda9a('0x0'));var BPromise=require(_0xda9a('0x1'));var rs=require(_0xda9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xda9a('0x4'))(_0xda9a('0x5'));var config=require(_0xda9a('0x6'));var jayson=require(_0xda9a('0x7'));var client=jayson[_0xda9a('0x8')][_0xda9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x251836,_0x55bbb6,_0x2dad19){return new BPromise(function(_0x4d29fa,_0x1785c4){return client['request'](_0x251836,_0x2dad19)[_0xda9a('0xa')](function(_0xcfd9fd){logger[_0xda9a('0xb')](_0xda9a('0xc'),_0x55bbb6,_0xda9a('0xd'));logger[_0xda9a('0xe')](_0xda9a('0xf'),_0x55bbb6,_0xda9a('0xd'),JSON[_0xda9a('0x10')](_0xcfd9fd));if(_0xcfd9fd[_0xda9a('0x11')]){if(_0xcfd9fd[_0xda9a('0x11')][_0xda9a('0x12')]===0x1f4){logger[_0xda9a('0x11')](_0xda9a('0xc'),_0x55bbb6,_0xcfd9fd[_0xda9a('0x11')][_0xda9a('0x13')]);return _0x1785c4(_0xcfd9fd['error'][_0xda9a('0x13')]);}logger[_0xda9a('0x11')]('Setting,\x20%s,\x20%s',_0x55bbb6,_0xcfd9fd['error'][_0xda9a('0x13')]);return _0x4d29fa(_0xcfd9fd['error'][_0xda9a('0x13')]);}else{logger[_0xda9a('0xb')](_0xda9a('0xc'),_0x55bbb6,_0xda9a('0xd'));_0x4d29fa(_0xcfd9fd[_0xda9a('0x14')][_0xda9a('0x13')]);}})[_0xda9a('0x15')](function(_0x249d4f){logger['error'](_0xda9a('0xc'),_0x55bbb6,_0x249d4f);_0x1785c4(_0x249d4f);});});}exports[_0xda9a('0x16')]=function(_0x45e83a){var _0x19fa32=this;return new Promise(function(_0x1e3dc7,_0x5cebb1){return db[_0xda9a('0x17')][_0xda9a('0x18')]({'raw':_0x45e83a[_0xda9a('0x19')]?_0x45e83a[_0xda9a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x45e83a[_0xda9a('0x19')]?_0x45e83a[_0xda9a('0x19')][_0xda9a('0x1a')]||null:null,'attributes':_0x45e83a[_0xda9a('0x19')]?_0x45e83a[_0xda9a('0x19')][_0xda9a('0x1b')]||null:null,'include':_0x45e83a['options']?_0x45e83a[_0xda9a('0x19')][_0xda9a('0x1c')]?_['map'](_0x45e83a[_0xda9a('0x19')]['include'],function(_0x5434c9){return{'model':db[_0x5434c9[_0xda9a('0x1d')]],'as':_0x5434c9['as'],'attributes':_0x5434c9[_0xda9a('0x1b')],'include':_0x5434c9[_0xda9a('0x1c')]?_[_0xda9a('0x1e')](_0x5434c9[_0xda9a('0x1c')],function(_0x262078){return{'model':db[_0x262078[_0xda9a('0x1d')]],'as':_0x262078['as'],'attributes':_0x262078['attributes'],'include':_0x262078[_0xda9a('0x1c')]?_[_0xda9a('0x1e')](_0x262078[_0xda9a('0x1c')],function(_0x20784d){return{'model':db[_0x20784d[_0xda9a('0x1d')]],'as':_0x20784d['as'],'attributes':_0x20784d[_0xda9a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xda9a('0xa')](function(_0x230193){logger['info'](_0xda9a('0x16'),_0x45e83a);logger[_0xda9a('0xe')](_0xda9a('0x16'),_0x45e83a,JSON[_0xda9a('0x10')](_0x230193));_0x1e3dc7(_0x230193);})['catch'](function(_0x416474){logger[_0xda9a('0x11')](_0xda9a('0x16'),_0x416474['message'],_0x45e83a);_0x5cebb1(_0x19fa32['error'](0x1f4,_0x416474['message']));});});}; \ No newline at end of file +var _0x5e07=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','ShowSetting','Setting','options','attributes','include','map','model','debug','catch'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0x5e07,0x1c2));var _0x75e0=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5e07[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0x75e0('0x0'));var moment=require(_0x75e0('0x1'));var BPromise=require(_0x75e0('0x2'));var rs=require(_0x75e0('0x3'));var fs=require('fs');var Redis=require(_0x75e0('0x4'));var db=require(_0x75e0('0x5'))['db'];var utils=require(_0x75e0('0x6'));var logger=require(_0x75e0('0x7'))(_0x75e0('0x8'));var config=require(_0x75e0('0x9'));var jayson=require(_0x75e0('0xa'));var client=jayson[_0x75e0('0xb')][_0x75e0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x789500,_0x1c0e24,_0x18d1c3){return new BPromise(function(_0x2a8dd8,_0x5eaa2b){return client[_0x75e0('0xd')](_0x789500,_0x18d1c3)[_0x75e0('0xe')](function(_0x24b9bf){logger[_0x75e0('0xf')](_0x75e0('0x10'),_0x1c0e24,_0x75e0('0x11'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x1c0e24,'request\x20sent',JSON[_0x75e0('0x12')](_0x24b9bf));if(_0x24b9bf[_0x75e0('0x13')]){if(_0x24b9bf[_0x75e0('0x13')]['code']===0x1f4){logger[_0x75e0('0x13')](_0x75e0('0x10'),_0x1c0e24,_0x24b9bf['error'][_0x75e0('0x14')]);return _0x5eaa2b(_0x24b9bf[_0x75e0('0x13')][_0x75e0('0x14')]);}logger['error']('Setting,\x20%s,\x20%s',_0x1c0e24,_0x24b9bf[_0x75e0('0x13')][_0x75e0('0x14')]);return _0x2a8dd8(_0x24b9bf['error'][_0x75e0('0x14')]);}else{logger[_0x75e0('0xf')](_0x75e0('0x10'),_0x1c0e24,_0x75e0('0x11'));_0x2a8dd8(_0x24b9bf['result'][_0x75e0('0x14')]);}})['catch'](function(_0x24d727){logger[_0x75e0('0x13')]('Setting,\x20%s,\x20%s',_0x1c0e24,_0x24d727);_0x5eaa2b(_0x24d727);});});}exports[_0x75e0('0x15')]=function(_0x272d14){var _0x3e2704=this;return new Promise(function(_0x47dc20,_0x3406b6){return db[_0x75e0('0x16')]['find']({'raw':_0x272d14['options']?_0x272d14[_0x75e0('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x272d14[_0x75e0('0x17')]?_0x272d14[_0x75e0('0x17')]['where']||null:null,'attributes':_0x272d14[_0x75e0('0x17')]?_0x272d14[_0x75e0('0x17')][_0x75e0('0x18')]||null:null,'include':_0x272d14[_0x75e0('0x17')]?_0x272d14[_0x75e0('0x17')][_0x75e0('0x19')]?_[_0x75e0('0x1a')](_0x272d14[_0x75e0('0x17')][_0x75e0('0x19')],function(_0x21175f){return{'model':db[_0x21175f[_0x75e0('0x1b')]],'as':_0x21175f['as'],'attributes':_0x21175f[_0x75e0('0x18')],'include':_0x21175f[_0x75e0('0x19')]?_[_0x75e0('0x1a')](_0x21175f[_0x75e0('0x19')],function(_0x3ff4a6){return{'model':db[_0x3ff4a6[_0x75e0('0x1b')]],'as':_0x3ff4a6['as'],'attributes':_0x3ff4a6[_0x75e0('0x18')],'include':_0x3ff4a6[_0x75e0('0x19')]?_[_0x75e0('0x1a')](_0x3ff4a6['include'],function(_0x42e18d){return{'model':db[_0x42e18d[_0x75e0('0x1b')]],'as':_0x42e18d['as'],'attributes':_0x42e18d[_0x75e0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x75e0('0xe')](function(_0x31e3f5){logger[_0x75e0('0xf')](_0x75e0('0x15'),_0x272d14);logger[_0x75e0('0x1c')]('ShowSetting',_0x272d14,JSON['stringify'](_0x31e3f5));_0x47dc20(_0x31e3f5);})[_0x75e0('0x1d')](function(_0x11b4d2){logger['error'](_0x75e0('0x15'),_0x11b4d2[_0x75e0('0x14')],_0x272d14);_0x3406b6(_0x3e2704[_0x75e0('0x13')](0x1f4,_0x11b4d2[_0x75e0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 9993e2f..45e0101 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x1d5b02,_0x41d9a5){var _0x442dd8=function(_0x2859dc){while(--_0x2859dc){_0x1d5b02['push'](_0x1d5b02['shift']());}};_0x442dd8(++_0x41d9a5);}(_0x53ec,0x192));var _0xc53e=function(_0x22d7e6,_0xa620e7){_0x22d7e6=_0x22d7e6-0x0;var _0x72bc58=_0x53ec[_0x22d7e6];return _0x72bc58;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x3e74f5,_0x238ff3){var _0x22152e=function(_0x3c0da3){while(--_0x3c0da3){_0x3e74f5['push'](_0x3e74f5['shift']());}};_0x22152e(++_0x238ff3);}(_0x53ec,0x192));var _0xc53e=function(_0x5a2065,_0x19c4fb){_0x5a2065=_0x5a2065-0x0;var _0x218567=_0x53ec[_0x5a2065];return _0x218567;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 39f280a..00336fb 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 _0xd3fe=['csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xd3fe,0x1d3));var _0xed3f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd3fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xed3f('0x0'));var rs=require(_0xed3f('0x1'));module[_0xed3f('0x2')]={'name':{'type':Sequelize[_0xed3f('0x3')],'unique':_0xed3f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xed3f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xed3f('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xed3f('0x3')],'defaultValue':function(){return rs[_0xed3f('0x5')]();}},'phone':{'type':Sequelize[_0xed3f('0x3')]},'type':{'type':Sequelize[_0xed3f('0x6')](_0xed3f('0x7'),_0xed3f('0x8'),_0xed3f('0x9'),_0xed3f('0xa'),_0xed3f('0xb'),_0xed3f('0xc'),'bandwidth',_0xed3f('0xd'),_0xed3f('0xe'),_0xed3f('0xf'))},'accountSid':{'type':Sequelize[_0xed3f('0x3')]},'authId':{'type':Sequelize[_0xed3f('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xed3f('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xed3f('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xed3f('0x3')]},'applicationId':{'type':Sequelize[_0xed3f('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xed3f('0x3')]},'deliveryReport':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0xed3f('0x3')]},'notificationTemplate':{'type':Sequelize[_0xed3f('0x11')],'defaultValue':function(){return _0xed3f('0x12');}},'notificationSound':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xed3f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xed3f('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xed3f('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed3f('0x13')],'comment':_0xed3f('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xed3f('0x10')],'defaultValue':![],'comment':_0xed3f('0x15'),'set':function(_0x57f577){if(!_0x57f577)this[_0xed3f('0x16')](_0xed3f('0x17'),null);this[_0xed3f('0x16')]('mandatoryDisposition',_0x57f577);}}}; \ No newline at end of file +var _0x0bcb=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x0bcb,0x1ba));var _0xb0bc=function(_0x2ac4f,_0x55e484){_0x2ac4f=_0x2ac4f-0x0;var _0x46d87a=_0x0bcb[_0x2ac4f];return _0x46d87a;};'use strict';var Sequelize=require(_0xb0bc('0x0'));var rs=require(_0xb0bc('0x1'));module[_0xb0bc('0x2')]={'name':{'type':Sequelize[_0xb0bc('0x3')],'unique':_0xb0bc('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xb0bc('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb0bc('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb0bc('0x3')],'defaultValue':function(){return rs[_0xb0bc('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb0bc('0x6')](_0xb0bc('0x7'),_0xb0bc('0x8'),_0xb0bc('0x9'),_0xb0bc('0xa'),_0xb0bc('0xb'),'clickatell',_0xb0bc('0xc'),_0xb0bc('0xd'),_0xb0bc('0xe'),_0xb0bc('0xf'))},'accountSid':{'type':Sequelize[_0xb0bc('0x3')]},'authId':{'type':Sequelize[_0xb0bc('0x3')]},'authToken':{'type':Sequelize[_0xb0bc('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xb0bc('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xb0bc('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xb0bc('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xb0bc('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0xb0bc('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb0bc('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb0bc('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb0bc('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb0bc('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb0bc('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb0bc('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb0bc('0x12')],'comment':_0xb0bc('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb0bc('0x14'),'set':function(_0x7332a8){if(!_0x7332a8)this[_0xb0bc('0x15')]('mandatoryDispositionPauseId',null);this[_0xb0bc('0x15')](_0xb0bc('0x16'),_0x7332a8);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2143715..db76ed2 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 _0x8d5b=['localhost','register','client','http','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsAccount,\x20%s,\x20%s','message','catch','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','intersection','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','Disposition','findOne','hasOwnProperty','SmsAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sms','Applications','account','applications','priority','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','Body','messageId','skebby','from','sender','text','connectel','clicksend','Text','results','csc','segmentedMessage','clickatell','replyMessageId','intelepeer','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','created','close','unmanaged','*,*,*,*','ContactId','AttachmentId','interaction','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','SmsApplication','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','DELIVERED','bandwidth','redif','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x64d7f,_0x43ed82){var _0x177546=function(_0x4891d4){while(--_0x4891d4){_0x64d7f['push'](_0x64d7f['shift']());}};_0x177546(++_0x43ed82);}(_0x8d5b,0xc8));var _0xb8d5=function(_0x41094d,_0x4ca21d){_0x41094d=_0x41094d-0x0;var _0x503ee1=_0x8d5b[_0x41094d];return _0x503ee1;};'use strict';var emlformat=require(_0xb8d5('0x0'));var rimraf=require(_0xb8d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8d5('0x2'));var rp=require(_0xb8d5('0x3'));var moment=require(_0xb8d5('0x4'));var BPromise=require(_0xb8d5('0x5'));var Mustache=require(_0xb8d5('0x6'));var util=require('util');var path=require(_0xb8d5('0x7'));var sox=require(_0xb8d5('0x8'));var csv=require(_0xb8d5('0x9'));var ejs=require(_0xb8d5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8d5('0xb'));var squel=require(_0xb8d5('0xc'));var crypto=require(_0xb8d5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb8d5('0xe'));var toCsv=require(_0xb8d5('0x9'));var querystring=require(_0xb8d5('0xf'));var Papa=require(_0xb8d5('0x10'));var Redis=require(_0xb8d5('0x11'));var authService=require(_0xb8d5('0x12'));var qs=require(_0xb8d5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8d5('0x14'));var logger=require('../../config/logger')(_0xb8d5('0x15'));var utils=require(_0xb8d5('0x16'));var config=require(_0xb8d5('0x17'));var licenseUtil=require(_0xb8d5('0x18'));var db=require(_0xb8d5('0x19'))['db'];config[_0xb8d5('0x1a')]=_['defaults'](config[_0xb8d5('0x1a')],{'host':_0xb8d5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0xb8d5('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb8d5('0x1d')][_0xb8d5('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x595ddb,_0x7f3ebd,_0x5313c5,_0x4de236){return new BPromise(function(_0x56bacf,_0x367feb){var _0x3ad837=_0x4de236||client;return _0x3ad837[_0xb8d5('0x1f')](_0x595ddb,_0x5313c5)[_0xb8d5('0x20')](function(_0x55892e){logger[_0xb8d5('0x21')]('SmsAccount,\x20%s,\x20%s',_0x7f3ebd,'request\x20sent');logger[_0xb8d5('0x22')](_0xb8d5('0x23'),_0x7f3ebd,_0xb8d5('0x24'),JSON[_0xb8d5('0x25')](_0x55892e));if(_0x55892e[_0xb8d5('0x26')]){if(_0x55892e[_0xb8d5('0x26')]['code']===0x1f4){logger[_0xb8d5('0x26')](_0xb8d5('0x27'),_0x7f3ebd,_0x55892e['error']['message']);return _0x367feb(_0x55892e['error']['message']);}logger['error'](_0xb8d5('0x27'),_0x7f3ebd,_0x55892e[_0xb8d5('0x26')][_0xb8d5('0x28')]);return _0x56bacf(_0x55892e['error']['message']);}else{logger[_0xb8d5('0x21')](_0xb8d5('0x27'),_0x7f3ebd,_0xb8d5('0x24'));_0x56bacf(_0x55892e['result'][_0xb8d5('0x28')]);}})[_0xb8d5('0x29')](function(_0x57e6d2){logger[_0xb8d5('0x26')]('SmsAccount,\x20%s,\x20%s',_0x7f3ebd,_0x57e6d2);_0x367feb(_0x57e6d2);});});}function respondWithStatusCode(_0x297ebe,_0x42cb11){_0x42cb11=_0x42cb11||0xcc;return function(_0x10ef6f){if(_0x10ef6f){return _0x297ebe['sendStatus'](_0x42cb11);}return _0x297ebe[_0xb8d5('0x2a')](_0x42cb11)[_0xb8d5('0x2b')]();};}function respondWithResult(_0x5b1a27,_0xc05d7b){_0xc05d7b=_0xc05d7b||0xc8;return function(_0x35a071){if(_0x35a071){return _0x5b1a27[_0xb8d5('0x2a')](_0xc05d7b)['json'](_0x35a071);}};}function respondWithFilteredResult(_0x473fd6,_0xba06c1){return function(_0x585c70){if(_0x585c70){var _0x5f0362=typeof _0xba06c1[_0xb8d5('0x2c')]==='undefined'&&typeof _0xba06c1[_0xb8d5('0x2d')]===_0xb8d5('0x2e');var _0x2df16a=_0x585c70['count'];var _0x4c56cb=_0x5f0362?0x0:_0xba06c1[_0xb8d5('0x2c')];var _0x4fd235=_0x5f0362?_0x585c70['count']:_0xba06c1[_0xb8d5('0x2c')]+_0xba06c1[_0xb8d5('0x2d')];var _0x1a55af;if(_0x4fd235>=_0x2df16a){_0x4fd235=_0x2df16a;_0x1a55af=0xc8;}else{_0x1a55af=0xce;}_0x473fd6[_0xb8d5('0x2a')](_0x1a55af);return _0x473fd6[_0xb8d5('0x2f')](_0xb8d5('0x30'),_0x4c56cb+'-'+_0x4fd235+'/'+_0x2df16a)[_0xb8d5('0x31')](_0x585c70);}return null;};}function patchUpdates(_0x420fd1){return function(_0x2e52e9){try{jsonpatch[_0xb8d5('0x32')](_0x2e52e9,_0x420fd1,!![]);}catch(_0x2d88ee){return BPromise[_0xb8d5('0x33')](_0x2d88ee);}return _0x2e52e9[_0xb8d5('0x34')]();};}function saveUpdates(_0x5665a3,_0xbbe0de){return function(_0x567dde){if(_0x567dde){return _0x567dde[_0xb8d5('0x35')](_0x5665a3)[_0xb8d5('0x20')](function(_0x574014){return _0x574014;});}return null;};}function removeEntity(_0x4154d3,_0x4594c6){return function(_0x111a84){if(_0x111a84){return _0x111a84[_0xb8d5('0x36')]()[_0xb8d5('0x20')](function(){var _0x4dcebd=_0x111a84[_0xb8d5('0x37')]({'plain':!![]});var _0x5b17aa='SmsAccounts';return db[_0xb8d5('0x38')][_0xb8d5('0x36')]({'where':{'type':_0x5b17aa,'resourceId':_0x4dcebd['id']}})[_0xb8d5('0x20')](function(){return _0x111a84;});})[_0xb8d5('0x20')](function(){_0x4154d3[_0xb8d5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dbcff,_0x2a60de){return function(_0x5d4a35){if(!_0x5d4a35){_0x5dbcff[_0xb8d5('0x39')](0x194);}return _0x5d4a35;};}function handleError(_0x55a219,_0x2e6040){_0x2e6040=_0x2e6040||0x1f4;return function(_0x1166b4){logger[_0xb8d5('0x26')](_0x1166b4['stack']);if(_0x1166b4[_0xb8d5('0x3a')]){delete _0x1166b4[_0xb8d5('0x3a')];}_0x55a219['status'](_0x2e6040)[_0xb8d5('0x3b')](_0x1166b4);};}exports[_0xb8d5('0x3c')]=function(_0x29ff0d,_0x19e443){var _0x5ba0c3={'include':[{'model':db[_0xb8d5('0x3d')],'as':_0xb8d5('0x3e')}]},_0x4dea7d={},_0x52914b={'count':0x0,'rows':[]};var _0x4fb852=_[_0xb8d5('0x3f')](db[_0xb8d5('0x40')][_0xb8d5('0x41')],function(_0x33bf51){return{'name':_0x33bf51['fieldName'],'type':_0x33bf51[_0xb8d5('0x42')][_0xb8d5('0x43')]};});_0x4dea7d[_0xb8d5('0x44')]=_[_0xb8d5('0x3f')](_0x4fb852,_0xb8d5('0x3a'));_0x4dea7d[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x29ff0d[_0xb8d5('0x45')]);_0x4dea7d[_0xb8d5('0x47')]=_['intersection'](_0x4dea7d[_0xb8d5('0x44')],_0x4dea7d[_0xb8d5('0x45')]);_0x5ba0c3['attributes']=_['intersection'](_0x4dea7d[_0xb8d5('0x44')],qs['fields'](_0x29ff0d['query']['fields']));_0x5ba0c3[_0xb8d5('0x48')]=_0x5ba0c3[_0xb8d5('0x48')]['length']?_0x5ba0c3[_0xb8d5('0x48')]:_0x4dea7d[_0xb8d5('0x44')];if(!_0x29ff0d[_0xb8d5('0x45')]['hasOwnProperty'](_0xb8d5('0x49'))){_0x5ba0c3[_0xb8d5('0x2d')]=qs[_0xb8d5('0x2d')](_0x29ff0d['query'][_0xb8d5('0x2d')]);_0x5ba0c3[_0xb8d5('0x2c')]=qs[_0xb8d5('0x2c')](_0x29ff0d[_0xb8d5('0x45')][_0xb8d5('0x2c')]);}_0x5ba0c3[_0xb8d5('0x4a')]=qs[_0xb8d5('0x4b')](_0x29ff0d[_0xb8d5('0x45')][_0xb8d5('0x4b')]);_0x5ba0c3[_0xb8d5('0x4c')]=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x29ff0d[_0xb8d5('0x45')],_0x4dea7d[_0xb8d5('0x47')]),_0x4fb852);if(_0x29ff0d['query'][_0xb8d5('0x4e')]){_0x5ba0c3[_0xb8d5('0x4c')]=_[_0xb8d5('0x4f')](_0x5ba0c3[_0xb8d5('0x4c')],{'$or':_[_0xb8d5('0x3f')](_0x4fb852,function(_0x9b48a4){if(_0x9b48a4[_0xb8d5('0x42')]!==_0xb8d5('0x50')){var _0x353dc2={};_0x353dc2[_0x9b48a4['name']]={'$like':'%'+_0x29ff0d[_0xb8d5('0x45')][_0xb8d5('0x4e')]+'%'};return _0x353dc2;}})});}_0x5ba0c3=_[_0xb8d5('0x4f')]({},_0x5ba0c3,_0x29ff0d[_0xb8d5('0x51')]);var _0xbecf26={'where':_0x5ba0c3[_0xb8d5('0x4c')]};return db[_0xb8d5('0x40')][_0xb8d5('0x52')](_0xbecf26)[_0xb8d5('0x20')](function(_0x1172ce){_0x52914b[_0xb8d5('0x52')]=_0x1172ce;if(_0x29ff0d[_0xb8d5('0x45')][_0xb8d5('0x53')]){_0x5ba0c3[_0xb8d5('0x54')]=[{'all':!![]}];}return db[_0xb8d5('0x40')][_0xb8d5('0x55')](_0x5ba0c3);})[_0xb8d5('0x20')](function(_0x2128a6){_0x52914b[_0xb8d5('0x56')]=_0x2128a6;return _0x52914b;})[_0xb8d5('0x20')](respondWithFilteredResult(_0x19e443,_0x5ba0c3))[_0xb8d5('0x29')](handleError(_0x19e443,null));};exports[_0xb8d5('0x57')]=function(_0x154278,_0x2e307e){var _0x4a4ee9={'raw':![],'where':{'id':_0x154278['params']['id']},'include':[{'model':db[_0xb8d5('0x3d')],'as':_0xb8d5('0x3e')}]},_0x274fb7={};_0x274fb7[_0xb8d5('0x44')]=_['keys'](db[_0xb8d5('0x40')][_0xb8d5('0x41')]);_0x274fb7['query']=_[_0xb8d5('0x46')](_0x154278[_0xb8d5('0x45')]);_0x274fb7[_0xb8d5('0x47')]=_[_0xb8d5('0x58')](_0x274fb7['model'],_0x274fb7[_0xb8d5('0x45')]);_0x4a4ee9[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x274fb7[_0xb8d5('0x44')],qs['fields'](_0x154278[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x4a4ee9[_0xb8d5('0x48')]=_0x4a4ee9[_0xb8d5('0x48')][_0xb8d5('0x5a')]?_0x4a4ee9[_0xb8d5('0x48')]:_0x274fb7[_0xb8d5('0x44')];if(_0x154278[_0xb8d5('0x45')]['includeAll']){_0x4a4ee9[_0xb8d5('0x54')]=[{'all':!![]}];}_0x4a4ee9=_[_0xb8d5('0x4f')]({},_0x4a4ee9,_0x154278[_0xb8d5('0x51')]);return db['SmsAccount'][_0xb8d5('0x5b')](_0x4a4ee9)['then'](handleEntityNotFound(_0x2e307e,null))['then'](respondWithResult(_0x2e307e,null))[_0xb8d5('0x29')](handleError(_0x2e307e,null));};exports[_0xb8d5('0x5c')]=function(_0x16d0f0,_0x1ff294){return db[_0xb8d5('0x40')][_0xb8d5('0x5c')](_0x16d0f0['body'],{})['then'](function(_0x5337e5){var _0x35c778=_0x16d0f0[_0xb8d5('0x5d')][_0xb8d5('0x37')]({'plain':!![]});if(!_0x35c778)throw new Error(_0xb8d5('0x5e'));if(_0x35c778['role']===_0xb8d5('0x5d')){var _0x3d8fd3=_0x5337e5['get']({'plain':!![]});var _0x13937a=_0xb8d5('0x5f');return db[_0xb8d5('0x60')][_0xb8d5('0x5b')]({'where':{'name':_0x13937a,'userProfileId':_0x35c778[_0xb8d5('0x61')]},'raw':!![]})[_0xb8d5('0x20')](function(_0x53de31){if(_0x53de31&&_0x53de31[_0xb8d5('0x62')]===0x0){return db[_0xb8d5('0x38')][_0xb8d5('0x5c')]({'name':_0x3d8fd3[_0xb8d5('0x3a')],'resourceId':_0x3d8fd3['id'],'type':_0x53de31[_0xb8d5('0x3a')],'sectionId':_0x53de31['id']},{})[_0xb8d5('0x20')](function(){return _0x5337e5;});}else{return _0x5337e5;}})['catch'](function(_0x48da15){logger['error'](_0xb8d5('0x63'),_0x48da15);throw _0x48da15;});}return _0x5337e5;})[_0xb8d5('0x20')](respondWithResult(_0x1ff294,0xc9))[_0xb8d5('0x29')](handleError(_0x1ff294,null));};exports[_0xb8d5('0x35')]=function(_0x31d1d4,_0x39a316){if(_0x31d1d4['body']['id']){delete _0x31d1d4[_0xb8d5('0x64')]['id'];}return db['SmsAccount'][_0xb8d5('0x5b')]({'where':{'id':_0x31d1d4[_0xb8d5('0x65')]['id']},'include':[{'model':db[_0xb8d5('0x3d')],'as':'mandatoryDispositionPause'}]})[_0xb8d5('0x20')](handleEntityNotFound(_0x39a316,null))[_0xb8d5('0x20')](saveUpdates(_0x31d1d4[_0xb8d5('0x64')],null))[_0xb8d5('0x20')](respondWithResult(_0x39a316,null))[_0xb8d5('0x29')](handleError(_0x39a316,null));};exports[_0xb8d5('0x36')]=function(_0xb45488,_0x2313ec){return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0xb45488['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x2313ec,null))[_0xb8d5('0x20')](removeEntity(_0x2313ec,null))[_0xb8d5('0x29')](handleError(_0x2313ec,null));};exports[_0xb8d5('0x66')]=function(_0x424594,_0x5dddc1){return db[_0xb8d5('0x40')][_0xb8d5('0x66')]()['then'](respondWithResult(_0x5dddc1,null))[_0xb8d5('0x29')](handleError(_0x5dddc1,null));};exports[_0xb8d5('0x67')]=function(_0x562fe9,_0x341bc1,_0x3f7f28){if(_0x562fe9[_0xb8d5('0x64')]['id']){delete _0x562fe9[_0xb8d5('0x64')]['id'];}return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x562fe9[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x341bc1,null))[_0xb8d5('0x20')](function(_0x12a27d){if(_0x12a27d){_0x562fe9['body']['SmsAccountId']=_0x12a27d['id'];return db[_0xb8d5('0x68')][_0xb8d5('0x5c')](_0x562fe9['body']);}})[_0xb8d5('0x20')](respondWithResult(_0x341bc1,null))[_0xb8d5('0x29')](handleError(_0x341bc1,null));};exports['getDispositions']=function(_0x37f7f4,_0x2ebcbc,_0x7c6df0){var _0x4165f1={'raw':![],'where':{}};var _0x5abb39={};var _0x46b939={'count':0x0,'rows':[]};return db[_0xb8d5('0x40')][_0xb8d5('0x69')]({'where':{'id':_0x37f7f4['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x2ebcbc,null))[_0xb8d5('0x20')](function(_0x9af3d6){if(_0x9af3d6){_0x5abb39[_0xb8d5('0x44')]=_[_0xb8d5('0x46')](db['Disposition']['rawAttributes']);_0x5abb39['query']=_[_0xb8d5('0x46')](_0x37f7f4[_0xb8d5('0x45')]);_0x5abb39['filters']=_[_0xb8d5('0x58')](_0x5abb39['model'],_0x5abb39[_0xb8d5('0x45')]);_0x4165f1[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x5abb39[_0xb8d5('0x44')],qs[_0xb8d5('0x59')](_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x4165f1[_0xb8d5('0x48')]=_0x4165f1['attributes'][_0xb8d5('0x5a')]?_0x4165f1[_0xb8d5('0x48')]:_0x5abb39[_0xb8d5('0x44')];if(!_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x6a')]('nolimit')){_0x4165f1['limit']=qs['limit'](_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x2d')]);_0x4165f1['offset']=qs[_0xb8d5('0x2c')](_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x2c')]);}_0x4165f1['order']=qs[_0xb8d5('0x4b')](_0x37f7f4[_0xb8d5('0x45')]['sort']);_0x4165f1[_0xb8d5('0x4c')]=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x37f7f4[_0xb8d5('0x45')],_0x5abb39[_0xb8d5('0x47')]));_0x4165f1[_0xb8d5('0x4c')][_0xb8d5('0x6b')]=_0x9af3d6['id'];if(_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x4e')]){_0x4165f1[_0xb8d5('0x4c')]=_['merge'](_0x4165f1[_0xb8d5('0x4c')],{'$or':_[_0xb8d5('0x3f')](_0x4165f1[_0xb8d5('0x48')],function(_0x2cb9ee){var _0x1cc337={};_0x1cc337[_0x2cb9ee]={'$like':'%'+_0x37f7f4[_0xb8d5('0x45')][_0xb8d5('0x4e')]+'%'};return _0x1cc337;})});}_0x4165f1=_[_0xb8d5('0x4f')]({},_0x4165f1,_0x37f7f4[_0xb8d5('0x51')]);return db['Disposition'][_0xb8d5('0x52')]({'where':_0x4165f1[_0xb8d5('0x4c')]})['then'](function(_0x4670ab){_0x46b939[_0xb8d5('0x52')]=_0x4670ab;if(_0x37f7f4[_0xb8d5('0x45')]['includeAll']){_0x4165f1[_0xb8d5('0x54')]=[{'all':!![]}];}return db[_0xb8d5('0x68')][_0xb8d5('0x55')](_0x4165f1);})[_0xb8d5('0x20')](function(_0x4de435){_0x46b939[_0xb8d5('0x56')]=_0x4de435;return _0x46b939;});}})[_0xb8d5('0x20')](respondWithFilteredResult(_0x2ebcbc,_0x4165f1))[_0xb8d5('0x29')](handleError(_0x2ebcbc,null));};exports[_0xb8d5('0x6c')]=function(_0x4d42d0,_0x287880,_0x4000a3){return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x4d42d0[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x287880,null))[_0xb8d5('0x20')](function(_0x25f71f){if(_0x25f71f){return _0x25f71f['removeDispositions'](_0x4d42d0['query'][_0xb8d5('0x6d')]);}})[_0xb8d5('0x20')](respondWithStatusCode(_0x287880,null))['catch'](handleError(_0x287880,null));};exports[_0xb8d5('0x6e')]=function(_0xda372b,_0x51e35d,_0x3851a1){if(_0xda372b[_0xb8d5('0x64')]['id']){delete _0xda372b[_0xb8d5('0x64')]['id'];}return db[_0xb8d5('0x40')]['find']({'where':{'id':_0xda372b[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x51e35d,null))[_0xb8d5('0x20')](function(_0x39c023){if(_0x39c023){_0xda372b[_0xb8d5('0x64')][_0xb8d5('0x6b')]=_0x39c023['id'];return db['CannedAnswer'][_0xb8d5('0x5c')](_0xda372b[_0xb8d5('0x64')]);}})[_0xb8d5('0x20')](respondWithResult(_0x51e35d,null))[_0xb8d5('0x29')](handleError(_0x51e35d,null));};exports[_0xb8d5('0x6f')]=function(_0x4ba1ee,_0x4af0bb,_0x4881d8){var _0x469cf7={'raw':![],'where':{}};var _0x3f5b04={};var _0x274207={'count':0x0,'rows':[]};return db[_0xb8d5('0x40')][_0xb8d5('0x69')]({'where':{'id':_0x4ba1ee['params']['id']}})['then'](handleEntityNotFound(_0x4af0bb,null))[_0xb8d5('0x20')](function(_0x28d344){if(_0x28d344){_0x3f5b04[_0xb8d5('0x44')]=_[_0xb8d5('0x46')](db[_0xb8d5('0x70')]['rawAttributes']);_0x3f5b04[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x4ba1ee[_0xb8d5('0x45')]);_0x3f5b04[_0xb8d5('0x47')]=_['intersection'](_0x3f5b04[_0xb8d5('0x44')],_0x3f5b04[_0xb8d5('0x45')]);_0x469cf7[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x3f5b04[_0xb8d5('0x44')],qs['fields'](_0x4ba1ee[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x469cf7['attributes']=_0x469cf7['attributes'][_0xb8d5('0x5a')]?_0x469cf7['attributes']:_0x3f5b04[_0xb8d5('0x44')];if(!_0x4ba1ee['query'][_0xb8d5('0x6a')](_0xb8d5('0x49'))){_0x469cf7['limit']=qs[_0xb8d5('0x2d')](_0x4ba1ee[_0xb8d5('0x45')][_0xb8d5('0x2d')]);_0x469cf7[_0xb8d5('0x2c')]=qs[_0xb8d5('0x2c')](_0x4ba1ee['query'][_0xb8d5('0x2c')]);}_0x469cf7[_0xb8d5('0x4a')]=qs[_0xb8d5('0x4b')](_0x4ba1ee['query'][_0xb8d5('0x4b')]);_0x469cf7[_0xb8d5('0x4c')]=qs['filters'](_[_0xb8d5('0x4d')](_0x4ba1ee[_0xb8d5('0x45')],_0x3f5b04[_0xb8d5('0x47')]));_0x469cf7['where'][_0xb8d5('0x6b')]=_0x28d344['id'];if(_0x4ba1ee[_0xb8d5('0x45')]['filter']){_0x469cf7[_0xb8d5('0x4c')]=_[_0xb8d5('0x4f')](_0x469cf7[_0xb8d5('0x4c')],{'$or':_['map'](_0x469cf7[_0xb8d5('0x48')],function(_0x405e6e){var _0x176863={};_0x176863[_0x405e6e]={'$like':'%'+_0x4ba1ee[_0xb8d5('0x45')]['filter']+'%'};return _0x176863;})});}_0x469cf7=_[_0xb8d5('0x4f')]({},_0x469cf7,_0x4ba1ee['options']);return db[_0xb8d5('0x70')][_0xb8d5('0x52')]({'where':_0x469cf7[_0xb8d5('0x4c')]})['then'](function(_0x212b57){_0x274207[_0xb8d5('0x52')]=_0x212b57;if(_0x4ba1ee[_0xb8d5('0x45')][_0xb8d5('0x53')]){_0x469cf7[_0xb8d5('0x54')]=[{'all':!![]}];}return db[_0xb8d5('0x70')][_0xb8d5('0x55')](_0x469cf7);})[_0xb8d5('0x20')](function(_0x2d9339){_0x274207[_0xb8d5('0x56')]=_0x2d9339;return _0x274207;});}})[_0xb8d5('0x20')](respondWithFilteredResult(_0x4af0bb,_0x469cf7))[_0xb8d5('0x29')](handleError(_0x4af0bb,null));};exports[_0xb8d5('0x71')]=function(_0x489b82,_0x1d6ee1,_0x46a65a){return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x489b82['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x1d6ee1,null))[_0xb8d5('0x20')](function(_0x260966){if(_0x260966){return _0x260966[_0xb8d5('0x71')](_0x489b82[_0xb8d5('0x45')][_0xb8d5('0x6d')]);}})[_0xb8d5('0x20')](respondWithStatusCode(_0x1d6ee1,null))['catch'](handleError(_0x1d6ee1,null));};exports['notify']=function(_0x2de832,_0x2c9770,_0xd0d4e6){var _0x2cf829={'channel':_0xb8d5('0x72')};var _0x327d42=[];var _0x64b63a=[];var _0x522043={};return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x2de832[_0xb8d5('0x65')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xb8d5('0x73')}]})[_0xb8d5('0x20')](handleEntityNotFound(_0x2c9770,null))['then'](function(_0x345e60){_0x2cf829[_0xb8d5('0x74')]=_0x345e60;_0x2cf829[_0xb8d5('0x75')]=_['orderBy'](_0x345e60[_0xb8d5('0x73')],[_0xb8d5('0x76')],['asc']);if(_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x73')]){delete _0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x73')];}return db['CmContact'][_0xb8d5('0x66')]();})[_0xb8d5('0x20')](function(_0x516021){if(!_0x516021){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0x79'));}_0x327d42=_[_0xb8d5('0x7a')](_[_0xb8d5('0x46')](_0x516021),[_0xb8d5('0x7b'),_0xb8d5('0x7c')]);_0x64b63a=_['difference'](_[_0xb8d5('0x46')](_0x516021),[_0xb8d5('0x7b'),_0xb8d5('0x7c'),_0xb8d5('0x7d'),_0xb8d5('0x7e')]);_0x2cf829[_0xb8d5('0x64')]={'mapKey':_0xb8d5('0x7f')};if(_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x42')]){switch(_0x2cf829['account'][_0xb8d5('0x42')]){case'twilio':_0x2cf829[_0xb8d5('0x64')]['from']=_0x2de832[_0xb8d5('0x64')]['From'];_0x2cf829['body']['body']=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x80')];_0x2cf829['body'][_0xb8d5('0x81')]=_0x2de832[_0xb8d5('0x64')]['MessageSid'];break;case _0xb8d5('0x82'):_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]='+'+_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x84')];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x85')];break;case _0xb8d5('0x86'):_0x2cf829['body'][_0xb8d5('0x83')]=_0x2de832['body']['from'];_0x2cf829['body'][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x28')];break;case _0xb8d5('0x87'):_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x83')];_0x2cf829[_0xb8d5('0x64')]['body']=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x64')];_0x2cf829['body']['messageId']=_0x2de832[_0xb8d5('0x64')]['message_id'];break;case'plivo':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')]['From'];_0x2cf829['body'][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x88')];_0x2cf829['body']['messageId']=_0x2de832[_0xb8d5('0x64')]['MessageUUID'];break;case'infobip':_0x2cf829['body'][_0xb8d5('0x83')]='+'+_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x89')][0x0][_0xb8d5('0x83')];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x89')][0x0][_0xb8d5('0x85')];_0x2cf829[_0xb8d5('0x64')]['messageId']=_0x2de832['body'][_0xb8d5('0x89')][0x0][_0xb8d5('0x81')];break;case _0xb8d5('0x8a'):_0x2cf829['body'][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')]['originatingAddress'];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832['body'][_0xb8d5('0x8b')][_0xb8d5('0x28')];break;case _0xb8d5('0x8c'):_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')]['fromNumber'];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')]['text'];_0x2cf829[_0xb8d5('0x64')]['messageId']=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x8d')];break;case'bandwidth':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x81')]=_0x2de832[_0xb8d5('0x64')][0x0][_0xb8d5('0x28')]['id'];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')][0x0][_0xb8d5('0x28')]['from'];_0x2cf829[_0xb8d5('0x64')]['body']=_0x2de832[_0xb8d5('0x64')][0x0]['message']['text'];break;case _0xb8d5('0x8e'):_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x83')];_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]=_0x2de832[_0xb8d5('0x64')][_0xb8d5('0x28')];_0x2cf829['body'][_0xb8d5('0x81')]=_0x2de832['body']['refid'];break;}}if(_0x2cf829[_0xb8d5('0x64')]['id']){delete _0x2cf829[_0xb8d5('0x64')]['id'];}if(_[_0xb8d5('0x8f')](_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')])){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0x90'));}if(_['isNil'](_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')])||_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x64')]===''){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb8d5('0x8f')](_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x91')])){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0x92')+_0x64b63a);}if(!_[_0xb8d5('0x93')](_0x64b63a,_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x91')])){throw new db[(_0xb8d5('0x77'))]['ValidationError'](_0xb8d5('0x94')+_0x64b63a);}_0x522043[_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x91')]]=_0x2cf829[_0xb8d5('0x64')]['from'];return db[_0xb8d5('0x95')][_0xb8d5('0x5b')]({'where':{'id':_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x7e')]},'include':[{'model':db[_0xb8d5('0x96')],'as':_0xb8d5('0x97'),'where':_0x522043,'limit':0x1,'order':[['updatedAt',_0xb8d5('0x98')]]}]});})[_0xb8d5('0x20')](handleEntityNotFound(_0x2c9770,null))[_0xb8d5('0x20')](function(_0x1646dd){if(_0x1646dd){_0x2cf829[_0xb8d5('0x99')]=_[_0xb8d5('0x9a')](_0x1646dd,[_0xb8d5('0x97')]);if(_0x1646dd[_0xb8d5('0x97')]['length']){return _0x1646dd[_0xb8d5('0x97')][0x0];}var _0x4f10f8=_[_0xb8d5('0x9b')](_0x2cf829[_0xb8d5('0x64')],{'firstName':_0x2cf829['body'][_0xb8d5('0x83')],'ListId':_0x1646dd['id']});_0x4f10f8[_0x2cf829[_0xb8d5('0x64')]['mapKey']]=_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')];return db[_0xb8d5('0x96')][_0xb8d5('0x5c')](_0x4f10f8,{'fields':_0x327d42,'raw':!![]});}})[_0xb8d5('0x20')](handleEntityNotFound(_0x2c9770,null))['then'](function(_0x471460){if(_0x471460){_0x2cf829[_0xb8d5('0x9c')]=_0x471460;var _0x5b7d93={'ContactId':_0x471460['id'],'phone':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')],'SmsAccountId':_0x2de832['params']['id']};var _0xf5ba5={'ContactId':_0x471460['id'],'SmsAccountId':_0x2de832[_0xb8d5('0x65')]['id'],'closed':![]};return db[_0xb8d5('0x9d')][_0xb8d5('0x5b')]({'where':_0xf5ba5})['then'](function(_0x42dfaf){if(_0x42dfaf){return[_0x42dfaf,![]];}return db[_0xb8d5('0x9d')]['create'](_0x5b7d93)[_0xb8d5('0x20')](function(_0x37d9a5){return[_0x37d9a5,!![]];});});}})[_0xb8d5('0x9e')](function(_0x19986b,_0x2dfd41){_0x2cf829['interaction']=_0x19986b[_0xb8d5('0x37')]({'plain':!![]});_0x2cf829['interaction'][_0xb8d5('0x9f')]=![];if(_0x2dfd41){if(_0x2cf829['account']['autoclose']){_0x2cf829[_0xb8d5('0x75')]['push']({'id':0x0,'priority':_0x2cf829[_0xb8d5('0x75')]['length']+0x1,'app':_0xb8d5('0xa0'),'appdata':_0xb8d5('0xa1'),'interval':_0xb8d5('0xa2')});}_0x2cf829['interaction']['created']=!![];}return db['SmsMessage'][_0xb8d5('0x5c')]({'phone':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0x83')],'messageId':_0x2cf829[_0xb8d5('0x64')]['messageId'],'body':_0x2cf829[_0xb8d5('0x64')]['body'],'SmsAccountId':_0x2de832[_0xb8d5('0x65')]['id'],'SmsInteractionId':_0x19986b['id'],'direction':'in','ContactId':_0x19986b[_0xb8d5('0xa3')],'AttachmentId':_0x2cf829[_0xb8d5('0x64')][_0xb8d5('0xa4')]});})[_0xb8d5('0x20')](function(_0x2aaa13){_0x2cf829['message']=_0x2aaa13;if(_0x2cf829[_0xb8d5('0xa5')][_0xb8d5('0xa6')]){return db[_0xb8d5('0xa7')][_0xb8d5('0x5b')]({'attributes':['id',_0xb8d5('0x3a')],'where':{'id':_0x2cf829[_0xb8d5('0xa5')]['UserId']}})['then'](function(_0x1bd5b5){if(_0x1bd5b5){_0x2cf829['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xb8d5('0xa8'),'appdata':_0x1bd5b5[_0xb8d5('0x3a')]+','+(_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0xa9')]||0xa),'interval':_0xb8d5('0xa2')});}return respondWithRpcPromise(_0xb8d5('0xaa'),_0xb8d5('0xab'),_0x2cf829);});}return respondWithRpcPromise(_0xb8d5('0xaa'),'startRouting',_0x2cf829);})[_0xb8d5('0x20')](function(_0x528418){if(_0x528418){var _0x252c34=0xc8;var _0x557a22=_0xb8d5('0xac');logger[_0xb8d5('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x557a22,_0x252c34,_0xb8d5('0xad'));logger[_0xb8d5('0x22')](_0xb8d5('0xae'),_0x557a22,_0x252c34,'entity\x20found',JSON['stringify'](_0x528418));if(_0x2cf829[_0xb8d5('0x74')][_0xb8d5('0x42')]===_0xb8d5('0xaf')){return _0x2c9770[_0xb8d5('0x2a')](_0x252c34)[_0xb8d5('0x2f')](_0xb8d5('0xb0'),_0xb8d5('0xb1'))['send'](_0xb8d5('0xb2'));}else{return _0x2c9770[_0xb8d5('0x2a')](_0x252c34)['json'](_0x528418);}}})[_0xb8d5('0x29')](handleError(_0x2c9770,null));};exports[_0xb8d5('0xb3')]=function(_0x201e48,_0x3b6d30){var _0x23aed7=_0x201e48[_0xb8d5('0x65')]['id'];var _0x4f2591=_0x201e48[_0xb8d5('0x64')];var _0x5c04f8=0xc8;var _0x56e868=null;return db['sequelize'][_0xb8d5('0xb4')]({'isolationLevel':db[_0xb8d5('0xb5')][_0xb8d5('0xb6')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1b40b2){return db[_0xb8d5('0x40')][_0xb8d5('0x69')]({'where':{'id':_0x23aed7},'transaction':_0x1b40b2})[_0xb8d5('0x20')](function(_0x96fbc0){if(_0x96fbc0){return db[_0xb8d5('0xb7')][_0xb8d5('0x36')]({'where':{'SmsAccountId':_0x23aed7},'transaction':_0x1b40b2})[_0xb8d5('0x20')](function(){var _0x4ffd73=_[_0xb8d5('0x3f')](_0x4f2591,function(_0x2f772f){_0x2f772f[_0xb8d5('0x6b')]=_0x23aed7;return _0x2f772f;});return db[_0xb8d5('0xb7')]['bulkCreate'](_0x4ffd73,{'transaction':_0x1b40b2});});}else{_0x5c04f8=0x194;_0x56e868=[];}});})[_0xb8d5('0x20')](function(){if(_0x5c04f8!==0x194){return db[_0xb8d5('0xb7')][_0xb8d5('0xb8')]({'where':{'SmsAccountId':_0x23aed7},'order':_0xb8d5('0x76')})[_0xb8d5('0x20')](function(_0xc8a20b){_0x56e868=_0xc8a20b;});}})[_0xb8d5('0x29')](function(_0x325b28){_0x5c04f8=0x1f4;logger[_0xb8d5('0x26')](_0x325b28[_0xb8d5('0xb9')]);if(_0x325b28[_0xb8d5('0x3a')]){delete _0x325b28['name'];}_0x56e868=_0x325b28;})[_0xb8d5('0xba')](function(){if(_0x56e868===null){_0x3b6d30['sendStatus'](_0x5c04f8);}else{if(_0x5c04f8===0x1f4){_0x3b6d30['status'](_0x5c04f8)[_0xb8d5('0x3b')](_0x56e868);}else{_0x3b6d30[_0xb8d5('0x2a')](_0x5c04f8)[_0xb8d5('0x31')](_0x56e868);}}});};exports[_0xb8d5('0xbb')]=function(_0x37f876,_0x4d3dff,_0x301702){var _0x100181={};var _0x145b0d={};var _0x3ab086;var _0x32863c;return db[_0xb8d5('0x40')][_0xb8d5('0x69')]({'where':{'id':_0x37f876[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x4d3dff,null))['then'](function(_0x18ff02){if(_0x18ff02){_0x3ab086=_0x18ff02;_0x145b0d[_0xb8d5('0x44')]=_['keys'](db[_0xb8d5('0xb7')][_0xb8d5('0x41')]);_0x145b0d[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x37f876[_0xb8d5('0x45')]);_0x145b0d[_0xb8d5('0x47')]=_[_0xb8d5('0x58')](_0x145b0d['model'],_0x145b0d['query']);_0x100181[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x145b0d['model'],qs[_0xb8d5('0x59')](_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x100181[_0xb8d5('0x48')]=_0x100181[_0xb8d5('0x48')][_0xb8d5('0x5a')]?_0x100181[_0xb8d5('0x48')]:_0x145b0d[_0xb8d5('0x44')];_0x100181[_0xb8d5('0x4a')]=qs['sort'](_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x4b')]);_0x100181['where']=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x37f876[_0xb8d5('0x45')],_0x145b0d[_0xb8d5('0x47')]));if(_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x4e')]){_0x100181[_0xb8d5('0x4c')]=_[_0xb8d5('0x4f')](_0x100181['where'],{'$or':_['map'](_0x100181[_0xb8d5('0x48')],function(_0x3af0a7){var _0x22bec2={};_0x22bec2[_0x3af0a7]={'$like':'%'+_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x4e')]+'%'};return _0x22bec2;})});}_0x100181=_[_0xb8d5('0x4f')]({},_0x100181,_0x37f876[_0xb8d5('0x51')]);return _0x3ab086[_0xb8d5('0xbb')](_0x100181);}})[_0xb8d5('0x20')](function(_0x15511e){if(_0x15511e){_0x32863c=_0x15511e[_0xb8d5('0x5a')];if(!_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x6a')](_0xb8d5('0x49'))){_0x100181[_0xb8d5('0x2d')]=qs[_0xb8d5('0x2d')](_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x2d')]);_0x100181[_0xb8d5('0x2c')]=qs[_0xb8d5('0x2c')](_0x37f876[_0xb8d5('0x45')][_0xb8d5('0x2c')]);}return _0x3ab086[_0xb8d5('0xbb')](_0x100181);}})[_0xb8d5('0x20')](function(_0x2ee35d){if(_0x2ee35d){return _0x2ee35d?{'count':_0x32863c,'rows':_0x2ee35d}:null;}})[_0xb8d5('0x20')](respondWithResult(_0x4d3dff,null))[_0xb8d5('0x29')](handleError(_0x4d3dff,null));};exports[_0xb8d5('0xbc')]=function(_0x38b2aa,_0x84bc79,_0x16b523){var _0x3fa765={'raw':![],'where':{}};var _0x3449bf={};var _0x3a0120={'count':0x0,'rows':[]};return db['SmsAccount'][_0xb8d5('0x69')]({'where':{'id':_0x38b2aa[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x84bc79,null))[_0xb8d5('0x20')](function(_0x34a6be){if(_0x34a6be){_0x3449bf[_0xb8d5('0x44')]=_['keys'](db[_0xb8d5('0x9d')][_0xb8d5('0x41')]);_0x3449bf[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x38b2aa[_0xb8d5('0x45')]);_0x3449bf[_0xb8d5('0x47')]=_['intersection'](_0x3449bf[_0xb8d5('0x44')],_0x3449bf[_0xb8d5('0x45')]);_0x3fa765['attributes']=_[_0xb8d5('0x58')](_0x3449bf[_0xb8d5('0x44')],qs[_0xb8d5('0x59')](_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x3fa765[_0xb8d5('0x48')]=_0x3fa765[_0xb8d5('0x48')][_0xb8d5('0x5a')]?_0x3fa765[_0xb8d5('0x48')]:_0x3449bf['model'];if(!_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0x6a')]('nolimit')){_0x3fa765[_0xb8d5('0x2d')]=qs[_0xb8d5('0x2d')](_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0x2d')]);_0x3fa765[_0xb8d5('0x2c')]=qs[_0xb8d5('0x2c')](_0x38b2aa['query'][_0xb8d5('0x2c')]);}_0x3fa765['order']=qs[_0xb8d5('0x4b')](_0x38b2aa[_0xb8d5('0x45')]['sort']);_0x3fa765[_0xb8d5('0x4c')]=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x38b2aa[_0xb8d5('0x45')],_0x3449bf[_0xb8d5('0x47')]));_0x3fa765[_0xb8d5('0x4c')][_0xb8d5('0x6b')]=_0x34a6be['id'];if(_0x38b2aa['query'][_0xb8d5('0x4e')]){_0x3fa765[_0xb8d5('0x4c')]=_[_0xb8d5('0x4f')](_0x3fa765[_0xb8d5('0x4c')],{'$or':_[_0xb8d5('0x3f')](_0x3fa765[_0xb8d5('0x48')],function(_0x3a3226){var _0x448e9c={};_0x448e9c[_0x3a3226]={'$like':'%'+_0x38b2aa[_0xb8d5('0x45')]['filter']+'%'};return _0x448e9c;})});}_0x3fa765=_['merge']({},_0x3fa765,_0x38b2aa['options']);return db['SmsInteraction']['count']({'where':_0x3fa765[_0xb8d5('0x4c')]})[_0xb8d5('0x20')](function(_0x3032bd){_0x3a0120['count']=_0x3032bd;if(_0x38b2aa[_0xb8d5('0x45')]['includeAll']){_0x3fa765['include']=[{'model':db[_0xb8d5('0x96')],'as':_0xb8d5('0xbd'),'required':![]},{'model':db[_0xb8d5('0xa7')],'as':_0xb8d5('0xbe'),'attributes':[_0xb8d5('0x3a'),_0xb8d5('0xbf'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xb8d5('0xc0'),'attributes':['id','name',_0xb8d5('0xc1')],'where':_0x38b2aa['query'][_0xb8d5('0xc2')]?{'id':_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0xc2')]}:undefined,'required':_0x38b2aa[_0xb8d5('0x45')][_0xb8d5('0xc2')]?!![]:![]}];}return db[_0xb8d5('0x9d')]['findAll'](_0x3fa765);})['then'](function(_0x2a3593){_0x3a0120[_0xb8d5('0x56')]=_0x2a3593;return _0x3a0120;});}})['then'](respondWithFilteredResult(_0x84bc79,_0x3fa765))['catch'](handleError(_0x84bc79,null));};exports[_0xb8d5('0x3b')]=function(_0x4429ba,_0x1250f9,_0x25eb65){var _0x319f28,_0x4edbb9,_0x27e429;if(_[_0xb8d5('0x8f')](_0x4429ba[_0xb8d5('0x64')]['body'])||_0x4429ba[_0xb8d5('0x64')][_0xb8d5('0x64')]===''){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0xc3'));}if(_[_0xb8d5('0x8f')](_0x4429ba[_0xb8d5('0x64')]['to'])){throw new db[(_0xb8d5('0x77'))][(_0xb8d5('0x78'))](_0xb8d5('0xc4'));}_0x319f28=_0x4429ba['body']['to'];return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x4429ba[_0xb8d5('0x65')]['id']},'include':[{'model':db[_0xb8d5('0x95')],'as':_0xb8d5('0xc5'),'include':[{'model':db[_0xb8d5('0x96')],'as':_0xb8d5('0x97'),'where':{'mobile':_0x319f28},'limit':0x1,'order':[[_0xb8d5('0x7c'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1250f9,null))[_0xb8d5('0x20')](function(_0x676207){if(_0x676207&&_0x676207[_0xb8d5('0xc5')]){_0x4edbb9=_0x676207[_0xb8d5('0x37')]({'plain':!![]});if(_0x4edbb9[_0xb8d5('0xc5')]&&_0x4edbb9['List'][_0xb8d5('0x97')]['length']){return _0x4edbb9[_0xb8d5('0xc5')]['Contacts'][0x0];}return db['CmContact'][_0xb8d5('0x5c')](_['defaults'](_0x4429ba[_0xb8d5('0x64')],{'firstName':_0x319f28,'mobile':_0x319f28,'phone':_0x319f28,'ListId':_0x4edbb9[_0xb8d5('0x7e')]}));}})[_0xb8d5('0x20')](handleEntityNotFound(_0x1250f9,null))['then'](function(_0x1f0da0){if(_0x1f0da0){_0x27e429=_0x1f0da0;return db[_0xb8d5('0x9d')][_0xb8d5('0x5b')]({'where':{'ContactId':_0x27e429['id'],'closed':![],'SmsAccountId':_0x4edbb9['id']}})[_0xb8d5('0x20')](function(_0xb676f5){if(_0xb676f5){return[_0xb676f5,![]];}return db[_0xb8d5('0x9d')][_0xb8d5('0x5c')]({'UserId':_0x4429ba[_0xb8d5('0x5d')]['id'],'ContactId':_0x27e429['id'],'SmsAccountId':_0x4edbb9['id'],'phone':_0x319f28,'firstMsgDirection':_0xb8d5('0xc6'),'Messages':[_[_0xb8d5('0x4f')](_0x4429ba[_0xb8d5('0x64')],{'read':![],'body':_0x4429ba[_0xb8d5('0x64')]['body'],'phone':_0x319f28,'SmsAccountId':_0x4edbb9['id'],'UserId':_0x4429ba[_0xb8d5('0x5d')]['id'],'ContactId':_0x27e429['id']})]},{'include':[{'model':db[_0xb8d5('0xc7')],'as':_0xb8d5('0xc8')}]})['then'](function(_0x1e84f9){return[_0x1e84f9,!![]];});});}})[_0xb8d5('0x9e')](function(_0x5ec1f1,_0x148b15){if(_0x148b15){return _0x5ec1f1;}return db[_0xb8d5('0xc7')][_0xb8d5('0x5c')](_[_0xb8d5('0x4f')](_0x4429ba[_0xb8d5('0x64')],{'read':![],'body':_0x4429ba['body'][_0xb8d5('0x64')],'phone':_0x319f28,'SmsAccountId':_0x4edbb9['id'],'SmsInteractionId':_0x5ec1f1['id'],'UserId':_0x4429ba[_0xb8d5('0x5d')]['id'],'ContactId':_0x27e429['id']}))[_0xb8d5('0x20')](function(_0x16d337){_0x5ec1f1[_0xb8d5('0xc9')][_0xb8d5('0xc8')]=[];_0x5ec1f1[_0xb8d5('0xc9')][_0xb8d5('0xc8')]['push'](_0x16d337[_0xb8d5('0xc9')]);return _0x5ec1f1;});})[_0xb8d5('0x20')](respondWithResult(_0x1250f9,null))['catch'](handleError(_0x1250f9,null));};exports['status']=function(_0x2da472,_0x35605d,_0x1647a8){if(_0x2da472['body']['id']){delete _0x2da472[_0xb8d5('0x64')]['id'];}var _0x462a40,_0xd4c22f,_0x261323;return db[_0xb8d5('0x40')]['find']({'where':{'id':_0x2da472[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x35605d,null))['then'](function(_0x36d510){if(_0x36d510){_0x261323=_0x36d510;logger[_0xb8d5('0x22')](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0xca'),_0x36d510[_0xb8d5('0x42')],util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));switch(_0x36d510[_0xb8d5('0x42')]){case _0xb8d5('0x82'):if(_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcc')]&&_0x2da472[_0xb8d5('0x64')][_0xb8d5('0x2a')]){_0xd4c22f=_0x2da472[_0xb8d5('0x64')]['status'];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcc')]}});}break;case'connectel':if(_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcd')]&&_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xce')]){_0xd4c22f=_0x2da472[_0xb8d5('0x64')]['statusInt'];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcd')]}});}break;case _0xb8d5('0x87'):if(_0x2da472[_0xb8d5('0x64')]['message_id']&&_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcf')]){_0xd4c22f=_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xcf')];return db[_0xb8d5('0xc7')]['find']({'where':{'messageId':_0x2da472[_0xb8d5('0x64')]['message_id']}});}break;case _0xb8d5('0xd0'):var _0x3a5c23=_0x2da472['body'][_0xb8d5('0x89')][0x0];if(_0x3a5c23['messageId']&&_0x3a5c23[_0xb8d5('0x2a')][_0xb8d5('0xd1')]===_0xb8d5('0xd2')){_0xd4c22f=_0x3a5c23[_0xb8d5('0x2a')][_0xb8d5('0xd1')];return db['SmsMessage'][_0xb8d5('0x5b')]({'where':{'messageId':_0x3a5c23[_0xb8d5('0x81')]}});}break;case'clickatell':if(_0x2da472[_0xb8d5('0x64')]['messageId']&&_0x2da472[_0xb8d5('0x64')][_0xb8d5('0x2a')]){_0xd4c22f=_0x2da472[_0xb8d5('0x64')]['status'];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x2da472[_0xb8d5('0x64')]['messageId']}});}break;case _0xb8d5('0xd3'):if(_0x2da472[_0xb8d5('0x64')][0x0]['message']['id']){_0xd4c22f=_0x2da472[_0xb8d5('0x64')][0x0][_0xb8d5('0x42')];return db[_0xb8d5('0xc7')]['find']({'where':{'messageId':_0x2da472[_0xb8d5('0x64')][0x0][_0xb8d5('0x28')]['id']}});}break;case _0xb8d5('0x8e'):if(_0x2da472[_0xb8d5('0x64')]['redif']&&_0x2da472['body']['status']){_0xd4c22f=_0x2da472[_0xb8d5('0x64')]['status'];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x2da472[_0xb8d5('0x64')][_0xb8d5('0xd4')]}});}break;}}})[_0xb8d5('0x20')](handleEntityNotFound(_0x35605d,null))[_0xb8d5('0x20')](function(_0x15269b){if(_0x15269b){_0x462a40=_0x15269b;switch(_0x261323[_0xb8d5('0x42')]){case _0xb8d5('0x82'):if(_0xd4c22f===_0xb8d5('0xd2')){return _0x462a40['update']({'read':!![]});}else{logger[_0xb8d5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d5('0x2a'),'skebby',util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));}break;case _0xb8d5('0x86'):if(_0xd4c22f==='1'){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0x82'),util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));}break;case _0xb8d5('0x87'):if(!_0x2da472['body']['error_code']&&_0xd4c22f>=0xc8&&_0xd4c22f<=0xce){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')](_0xb8d5('0x23'),'status',_0xb8d5('0x87'),util[_0xb8d5('0xcb')](_0x2da472['body'],{'showHidden':![],'depth':null}));}break;case _0xb8d5('0xd0'):var _0x552434=_0x2da472['body'][_0xb8d5('0x89')][0x0];if(_0x552434['status'][_0xb8d5('0xd1')]===_0xb8d5('0xd2')){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')](_0xb8d5('0x23'),_0xb8d5('0x2a'),'infobip',util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xd4c22f==_0xb8d5('0xd5')||_0xd4c22f=='RECEIVED_BY_RECIPIENT'){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger['error'](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0x8c'),util[_0xb8d5('0xcb')](_0x2da472['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0xd4c22f==_0xb8d5('0xd6')){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger['error'](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0xd3'),util[_0xb8d5('0xcb')](_0x2da472['body'],{'showHidden':![],'depth':null}));}break;case _0xb8d5('0x8e'):if(_0xd4c22f===_0xb8d5('0xd7')||_0xd4c22f===_0xb8d5('0xd8')){return _0x462a40[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8d5('0x2a'),'intelepeer',util[_0xb8d5('0xcb')](_0x2da472[_0xb8d5('0x64')],{'showHidden':![],'depth':null}));}break;}return _0x462a40;}})['then'](respondWithResult(_0x35605d,null))[_0xb8d5('0x29')](handleError(_0x35605d,null));};exports[_0xb8d5('0xd9')]=function(_0x23d3c5,_0xb965bf,_0x3912c6){var _0x37cae4,_0x3a698b,_0x5f256f;return db[_0xb8d5('0x40')]['find']({'where':{'id':_0x23d3c5[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0xb965bf,null))[_0xb8d5('0x20')](function(_0x1ac545){if(_0x1ac545){_0x5f256f=_0x1ac545;logger[_0xb8d5('0x22')](_0xb8d5('0x23'),_0xb8d5('0x2a'),_0xb8d5('0xca'),_0x1ac545['type'],util[_0xb8d5('0xcb')](_0x23d3c5[_0xb8d5('0x45')],{'showHidden':![],'depth':null}));switch(_0x1ac545[_0xb8d5('0x42')]){case _0xb8d5('0x8a'):if(_0x23d3c5['query'][_0xb8d5('0xda')]&&_0x23d3c5[_0xb8d5('0x45')][_0xb8d5('0xdb')]){_0x3a698b=_0x23d3c5[_0xb8d5('0x45')][_0xb8d5('0xdb')];return db[_0xb8d5('0xc7')][_0xb8d5('0x5b')]({'where':{'messageId':_0x23d3c5[_0xb8d5('0x45')][_0xb8d5('0xda')]}});}break;}}})[_0xb8d5('0x20')](handleEntityNotFound(_0xb965bf,null))['then'](function(_0x427f94){if(_0x427f94){_0x37cae4=_0x427f94;switch(_0x5f256f[_0xb8d5('0x42')]){case _0xb8d5('0x8a'):if(_0x3a698b==='2'||_0x3a698b==='6'){return _0x37cae4[_0xb8d5('0x35')]({'read':!![]});}else{logger[_0xb8d5('0x26')](_0xb8d5('0x23'),_0xb8d5('0x2a'),'csc',util['inspect'](_0x23d3c5['query'],{'showHidden':![],'depth':null}));};break;}return _0x37cae4;}})[_0xb8d5('0x20')](respondWithResult(_0xb965bf,null))[_0xb8d5('0x29')](handleError(_0xb965bf,null));};exports[_0xb8d5('0xdc')]=function(_0x8ef2,_0x48705,_0x2fa941){return db[_0xb8d5('0x40')][_0xb8d5('0x5b')]({'where':{'id':_0x8ef2['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x48705,null))['then'](function(_0x2c6321){if(_0x2c6321){return _0x2c6321[_0xb8d5('0xdc')](_0x8ef2[_0xb8d5('0x64')]['ids'],_[_0xb8d5('0x9a')](_0x8ef2[_0xb8d5('0x64')],[_0xb8d5('0x6d'),'id'])||{})[_0xb8d5('0x9e')](function(_0xf39d72){for(var _0x12ace3=0x0;_0x12ace3<_0x8ef2['body'][_0xb8d5('0x6d')][_0xb8d5('0x5a')];_0x12ace3+=0x1){socket[_0xb8d5('0xdd')](_0xb8d5('0xde'),{'UserId':Number(_0x8ef2[_0xb8d5('0x64')]['ids'][_0x12ace3]),'SmsAccountId':Number(_0x8ef2[_0xb8d5('0x65')]['id'])});}return _0xf39d72;});}})['then'](respondWithResult(_0x48705,null))[_0xb8d5('0x29')](handleError(_0x48705,null));};exports[_0xb8d5('0xdf')]=function(_0xdeaae9,_0x479673,_0x527ff3){return db['SmsAccount'][_0xb8d5('0x5b')]({'where':{'id':_0xdeaae9['params']['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x479673,null))['then'](function(_0x52a053){if(_0x52a053){return _0x52a053[_0xb8d5('0xdf')](_0xdeaae9['query']['ids'])['then'](function(){if(_[_0xb8d5('0xe0')](_0xdeaae9['query']['ids'])){for(var _0x4dc519=0x0;_0x4dc519<_0xdeaae9['query']['ids'][_0xb8d5('0x5a')];_0x4dc519+=0x1){socket[_0xb8d5('0xdd')](_0xb8d5('0xe1'),{'UserId':Number(_0xdeaae9[_0xb8d5('0x45')][_0xb8d5('0x6d')][_0x4dc519]),'SmsAccountId':Number(_0xdeaae9[_0xb8d5('0x65')]['id'])});}}else{socket[_0xb8d5('0xdd')]('userSmsAccount:remove',{'UserId':Number(_0xdeaae9[_0xb8d5('0x45')][_0xb8d5('0x6d')]),'SmsAccountId':Number(_0xdeaae9[_0xb8d5('0x65')]['id'])});}});}})[_0xb8d5('0x20')](respondWithStatusCode(_0x479673,null))[_0xb8d5('0x29')](handleError(_0x479673,null));};exports[_0xb8d5('0xe2')]=function(_0x36fd3a,_0x42f918,_0x212cb8){var _0x39bd5b={};var _0x3be7de={};var _0x49215d;var _0x127661;return db['SmsAccount'][_0xb8d5('0x69')]({'where':{'id':_0x36fd3a[_0xb8d5('0x65')]['id']}})[_0xb8d5('0x20')](handleEntityNotFound(_0x42f918,null))[_0xb8d5('0x20')](function(_0x5cf6a7){if(_0x5cf6a7){_0x49215d=_0x5cf6a7;_0x3be7de[_0xb8d5('0x44')]=_[_0xb8d5('0x46')](db[_0xb8d5('0xa7')][_0xb8d5('0x41')]);_0x3be7de[_0xb8d5('0x45')]=_[_0xb8d5('0x46')](_0x36fd3a[_0xb8d5('0x45')]);_0x3be7de['filters']=_[_0xb8d5('0x58')](_0x3be7de[_0xb8d5('0x44')],_0x3be7de[_0xb8d5('0x45')]);_0x39bd5b[_0xb8d5('0x48')]=_[_0xb8d5('0x58')](_0x3be7de[_0xb8d5('0x44')],qs['fields'](_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x59')]));_0x39bd5b[_0xb8d5('0x48')]=_0x39bd5b[_0xb8d5('0x48')][_0xb8d5('0x5a')]?_0x39bd5b[_0xb8d5('0x48')]:_0x3be7de[_0xb8d5('0x44')];_0x39bd5b['order']=qs['sort'](_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x4b')]);_0x39bd5b[_0xb8d5('0x4c')]=qs[_0xb8d5('0x47')](_[_0xb8d5('0x4d')](_0x36fd3a[_0xb8d5('0x45')],_0x3be7de[_0xb8d5('0x47')]));if(_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x4e')]){_0x39bd5b[_0xb8d5('0x4c')]=_['merge'](_0x39bd5b['where'],{'$or':_['map'](_0x39bd5b[_0xb8d5('0x48')],function(_0x229d5a){var _0x5e5157={};_0x5e5157[_0x229d5a]={'$like':'%'+_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x4e')]+'%'};return _0x5e5157;})});}_0x39bd5b=_[_0xb8d5('0x4f')]({},_0x39bd5b,_0x36fd3a[_0xb8d5('0x51')]);return _0x49215d['getAgents'](_0x39bd5b);}})[_0xb8d5('0x20')](function(_0x5df5f5){if(_0x5df5f5){_0x127661=_0x5df5f5[_0xb8d5('0x5a')];if(!_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x6a')](_0xb8d5('0x49'))){_0x39bd5b[_0xb8d5('0x2d')]=qs[_0xb8d5('0x2d')](_0x36fd3a['query'][_0xb8d5('0x2d')]);_0x39bd5b[_0xb8d5('0x2c')]=qs['offset'](_0x36fd3a[_0xb8d5('0x45')][_0xb8d5('0x2c')]);}return _0x49215d['getAgents'](_0x39bd5b);}})[_0xb8d5('0x20')](function(_0xce0604){if(_0xce0604){return _0xce0604?{'count':_0x127661,'rows':_0xce0604}:null;}})[_0xb8d5('0x20')](respondWithResult(_0x42f918,null))[_0xb8d5('0x29')](handleError(_0x42f918,null));}; \ No newline at end of file +var _0xbe61=['groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','ACCEPTD','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','get','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','intersection','fields','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsAccounts','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','create','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','sms','Applications','applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','Contacts','DESC','defaults','contact','SmsInteraction','interaction','created','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','text/xml','send','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','finally','sendStatus','getApplications','getInteractions','Contact','User','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','CmList','List','out','Messages','spread','dataValues','push','inspect','skebby_dispatch_id','requestid','status_code'];(function(_0x29f2dd,_0xa55841){var _0x3fb9d4=function(_0x4f6033){while(--_0x4f6033){_0x29f2dd['push'](_0x29f2dd['shift']());}};_0x3fb9d4(++_0xa55841);}(_0xbe61,0x1d5));var _0x1be6=function(_0x505b90,_0x42a543){_0x505b90=_0x505b90-0x0;var _0x12b382=_0xbe61[_0x505b90];return _0x12b382;};'use strict';var emlformat=require(_0x1be6('0x0'));var rimraf=require(_0x1be6('0x1'));var zipdir=require(_0x1be6('0x2'));var jsonpatch=require(_0x1be6('0x3'));var rp=require(_0x1be6('0x4'));var moment=require(_0x1be6('0x5'));var BPromise=require(_0x1be6('0x6'));var Mustache=require(_0x1be6('0x7'));var util=require('util');var path=require(_0x1be6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1be6('0x9'));var fs=require('fs');var fs_extra=require(_0x1be6('0xa'));var _=require(_0x1be6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1be6('0xc'));var deskjs=require(_0x1be6('0xd'));var toCsv=require(_0x1be6('0xe'));var querystring=require('querystring');var Papa=require(_0x1be6('0xf'));var Redis=require(_0x1be6('0x10'));var authService=require(_0x1be6('0x11'));var qs=require(_0x1be6('0x12'));var as=require(_0x1be6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1be6('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1be6('0x15'));var db=require(_0x1be6('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x1be6('0x17'),'port':0x18eb});var socket=require(_0x1be6('0x18'))(new Redis(config[_0x1be6('0x19')]));require(_0x1be6('0x1a'))[_0x1be6('0x1b')](socket);var jayson=require(_0x1be6('0x1c'));var client=jayson[_0x1be6('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x16b666,_0x36dfaf,_0x276630,_0x29d506){return new BPromise(function(_0x48d282,_0x221383){var _0x57e40f=_0x29d506||client;return _0x57e40f[_0x1be6('0x1e')](_0x16b666,_0x276630)[_0x1be6('0x1f')](function(_0x2649a5){logger[_0x1be6('0x20')](_0x1be6('0x21'),_0x36dfaf,_0x1be6('0x22'));logger[_0x1be6('0x23')](_0x1be6('0x24'),_0x36dfaf,_0x1be6('0x22'),JSON[_0x1be6('0x25')](_0x2649a5));if(_0x2649a5[_0x1be6('0x26')]){if(_0x2649a5[_0x1be6('0x26')][_0x1be6('0x27')]===0x1f4){logger[_0x1be6('0x26')](_0x1be6('0x21'),_0x36dfaf,_0x2649a5[_0x1be6('0x26')][_0x1be6('0x28')]);return _0x221383(_0x2649a5[_0x1be6('0x26')][_0x1be6('0x28')]);}logger[_0x1be6('0x26')]('SmsAccount,\x20%s,\x20%s',_0x36dfaf,_0x2649a5[_0x1be6('0x26')][_0x1be6('0x28')]);return _0x48d282(_0x2649a5[_0x1be6('0x26')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x36dfaf,_0x1be6('0x22'));_0x48d282(_0x2649a5['result'][_0x1be6('0x28')]);}})[_0x1be6('0x29')](function(_0x3f96cf){logger['error'](_0x1be6('0x21'),_0x36dfaf,_0x3f96cf);_0x221383(_0x3f96cf);});});}function respondWithStatusCode(_0x2f07f8,_0x53edd1){_0x53edd1=_0x53edd1||0xcc;return function(_0x2b1488){if(_0x2b1488){return _0x2f07f8['sendStatus'](_0x53edd1);}return _0x2f07f8[_0x1be6('0x2a')](_0x53edd1)[_0x1be6('0x2b')]();};}function respondWithResult(_0x4e0844,_0x418a54){_0x418a54=_0x418a54||0xc8;return function(_0x4fb31b){if(_0x4fb31b){return _0x4e0844[_0x1be6('0x2a')](_0x418a54)['json'](_0x4fb31b);}};}function respondWithFilteredResult(_0x27b439,_0x4bca1d){return function(_0x289d2c){if(_0x289d2c){var _0x34b822=typeof _0x4bca1d['offset']===_0x1be6('0x2c')&&typeof _0x4bca1d['limit']===_0x1be6('0x2c');var _0x5bdedc=_0x289d2c['count'];var _0x17e762=_0x34b822?0x0:_0x4bca1d['offset'];var _0x394677=_0x34b822?_0x289d2c[_0x1be6('0x2d')]:_0x4bca1d[_0x1be6('0x2e')]+_0x4bca1d[_0x1be6('0x2f')];var _0x178124;if(_0x394677>=_0x5bdedc){_0x394677=_0x5bdedc;_0x178124=0xc8;}else{_0x178124=0xce;}_0x27b439[_0x1be6('0x2a')](_0x178124);return _0x27b439[_0x1be6('0x30')](_0x1be6('0x31'),_0x17e762+'-'+_0x394677+'/'+_0x5bdedc)[_0x1be6('0x32')](_0x289d2c);}return null;};}function patchUpdates(_0xe01d76){return function(_0x42b81f){try{jsonpatch['apply'](_0x42b81f,_0xe01d76,!![]);}catch(_0x11e830){return BPromise[_0x1be6('0x33')](_0x11e830);}return _0x42b81f[_0x1be6('0x34')]();};}function saveUpdates(_0x46ca79,_0x5f4361){return function(_0x308afd){if(_0x308afd){return _0x308afd[_0x1be6('0x35')](_0x46ca79)[_0x1be6('0x1f')](function(_0x2b273b){return _0x2b273b;});}return null;};}function removeEntity(_0x103099,_0xb11bc){return function(_0x19405b){if(_0x19405b){return _0x19405b['destroy']()[_0x1be6('0x1f')](function(){var _0x28044b=_0x19405b[_0x1be6('0x36')]({'plain':!![]});var _0x49a6d3='SmsAccounts';return db['UserProfileResource'][_0x1be6('0x37')]({'where':{'type':_0x49a6d3,'resourceId':_0x28044b['id']}})[_0x1be6('0x1f')](function(){return _0x19405b;});})[_0x1be6('0x1f')](function(){_0x103099[_0x1be6('0x2a')](0xcc)[_0x1be6('0x2b')]();});}};}function handleEntityNotFound(_0x497e69,_0x1c3cf5){return function(_0x82e30d){if(!_0x82e30d){_0x497e69['sendStatus'](0x194);}return _0x82e30d;};}function handleError(_0x549ccf,_0x4b95f1){_0x4b95f1=_0x4b95f1||0x1f4;return function(_0x232218){logger[_0x1be6('0x26')](_0x232218[_0x1be6('0x38')]);if(_0x232218[_0x1be6('0x39')]){delete _0x232218[_0x1be6('0x39')];}_0x549ccf[_0x1be6('0x2a')](_0x4b95f1)['send'](_0x232218);};}exports[_0x1be6('0x3a')]=function(_0x1bdf3b,_0x398905){var _0x57c1d2={'include':[{'model':db[_0x1be6('0x3b')],'as':_0x1be6('0x3c')}]},_0x463a11={},_0x6a1c84={'count':0x0,'rows':[]};var _0x33b36f=_[_0x1be6('0x3d')](db[_0x1be6('0x3e')][_0x1be6('0x3f')],function(_0x180990){return{'name':_0x180990[_0x1be6('0x40')],'type':_0x180990[_0x1be6('0x41')]['key']};});_0x463a11[_0x1be6('0x42')]=_[_0x1be6('0x3d')](_0x33b36f,'name');_0x463a11[_0x1be6('0x43')]=_[_0x1be6('0x44')](_0x1bdf3b[_0x1be6('0x43')]);_0x463a11[_0x1be6('0x45')]=_['intersection'](_0x463a11[_0x1be6('0x42')],_0x463a11[_0x1be6('0x43')]);_0x57c1d2[_0x1be6('0x46')]=_['intersection'](_0x463a11['model'],qs['fields'](_0x1bdf3b['query']['fields']));_0x57c1d2['attributes']=_0x57c1d2[_0x1be6('0x46')][_0x1be6('0x47')]?_0x57c1d2[_0x1be6('0x46')]:_0x463a11[_0x1be6('0x42')];if(!_0x1bdf3b['query'][_0x1be6('0x48')](_0x1be6('0x49'))){_0x57c1d2[_0x1be6('0x2f')]=qs[_0x1be6('0x2f')](_0x1bdf3b['query'][_0x1be6('0x2f')]);_0x57c1d2[_0x1be6('0x2e')]=qs[_0x1be6('0x2e')](_0x1bdf3b['query']['offset']);}_0x57c1d2[_0x1be6('0x4a')]=qs[_0x1be6('0x4b')](_0x1bdf3b[_0x1be6('0x43')][_0x1be6('0x4b')]);_0x57c1d2[_0x1be6('0x4c')]=qs[_0x1be6('0x45')](_[_0x1be6('0x4d')](_0x1bdf3b['query'],_0x463a11[_0x1be6('0x45')]),_0x33b36f);if(_0x1bdf3b[_0x1be6('0x43')][_0x1be6('0x4e')]){_0x57c1d2[_0x1be6('0x4c')]=_[_0x1be6('0x4f')](_0x57c1d2[_0x1be6('0x4c')],{'$or':_['map'](_0x33b36f,function(_0x45caae){if(_0x45caae[_0x1be6('0x41')]!==_0x1be6('0x50')){var _0x2bf5d8={};_0x2bf5d8[_0x45caae[_0x1be6('0x39')]]={'$like':'%'+_0x1bdf3b['query'][_0x1be6('0x4e')]+'%'};return _0x2bf5d8;}})});}_0x57c1d2=_[_0x1be6('0x4f')]({},_0x57c1d2,_0x1bdf3b[_0x1be6('0x51')]);var _0x270c0d={'where':_0x57c1d2['where']};return db[_0x1be6('0x3e')][_0x1be6('0x2d')](_0x270c0d)[_0x1be6('0x1f')](function(_0x18349b){_0x6a1c84[_0x1be6('0x2d')]=_0x18349b;if(_0x1bdf3b['query'][_0x1be6('0x52')]){_0x57c1d2[_0x1be6('0x53')]=[{'all':!![]}];}return db[_0x1be6('0x3e')][_0x1be6('0x54')](_0x57c1d2);})[_0x1be6('0x1f')](function(_0x320e2a){_0x6a1c84['rows']=_0x320e2a;return _0x6a1c84;})[_0x1be6('0x1f')](respondWithFilteredResult(_0x398905,_0x57c1d2))['catch'](handleError(_0x398905,null));};exports['show']=function(_0x519178,_0x4a2599){var _0x2d7d6f={'raw':![],'where':{'id':_0x519178[_0x1be6('0x55')]['id']},'include':[{'model':db[_0x1be6('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4768d8={};_0x4768d8[_0x1be6('0x42')]=_[_0x1be6('0x44')](db[_0x1be6('0x3e')][_0x1be6('0x3f')]);_0x4768d8[_0x1be6('0x43')]=_[_0x1be6('0x44')](_0x519178[_0x1be6('0x43')]);_0x4768d8[_0x1be6('0x45')]=_[_0x1be6('0x56')](_0x4768d8[_0x1be6('0x42')],_0x4768d8[_0x1be6('0x43')]);_0x2d7d6f['attributes']=_['intersection'](_0x4768d8[_0x1be6('0x42')],qs[_0x1be6('0x57')](_0x519178[_0x1be6('0x43')][_0x1be6('0x57')]));_0x2d7d6f[_0x1be6('0x46')]=_0x2d7d6f[_0x1be6('0x46')][_0x1be6('0x47')]?_0x2d7d6f[_0x1be6('0x46')]:_0x4768d8[_0x1be6('0x42')];if(_0x519178[_0x1be6('0x43')][_0x1be6('0x52')]){_0x2d7d6f[_0x1be6('0x53')]=[{'all':!![]}];}_0x2d7d6f=_[_0x1be6('0x4f')]({},_0x2d7d6f,_0x519178['options']);return db['SmsAccount'][_0x1be6('0x58')](_0x2d7d6f)['then'](handleEntityNotFound(_0x4a2599,null))['then'](respondWithResult(_0x4a2599,null))['catch'](handleError(_0x4a2599,null));};exports['create']=function(_0x47fa49,_0x447565){return db['SmsAccount']['create'](_0x47fa49[_0x1be6('0x59')],{})['then'](function(_0x704acf){var _0x161deb=_0x47fa49['user']['get']({'plain':!![]});if(!_0x161deb)throw new Error(_0x1be6('0x5a'));if(_0x161deb[_0x1be6('0x5b')]===_0x1be6('0x5c')){var _0x18a57e=_0x704acf['get']({'plain':!![]});var _0xba1108=_0x1be6('0x5d');return db['UserProfileSection'][_0x1be6('0x58')]({'where':{'name':_0xba1108,'userProfileId':_0x161deb[_0x1be6('0x5e')]},'raw':!![]})[_0x1be6('0x1f')](function(_0x3cdcc6){if(_0x3cdcc6&&_0x3cdcc6['autoAssociation']===0x0){return db[_0x1be6('0x5f')]['create']({'name':_0x18a57e[_0x1be6('0x39')],'resourceId':_0x18a57e['id'],'type':_0x3cdcc6[_0x1be6('0x39')],'sectionId':_0x3cdcc6['id']},{})['then'](function(){return _0x704acf;});}else{return _0x704acf;}})[_0x1be6('0x29')](function(_0x2e0fa2){logger[_0x1be6('0x26')](_0x1be6('0x60'),_0x2e0fa2);throw _0x2e0fa2;});}return _0x704acf;})['then'](respondWithResult(_0x447565,0xc9))[_0x1be6('0x29')](handleError(_0x447565,null));};exports[_0x1be6('0x35')]=function(_0x30626c,_0x2707a0){if(_0x30626c[_0x1be6('0x59')]['id']){delete _0x30626c[_0x1be6('0x59')]['id'];}return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x30626c[_0x1be6('0x55')]['id']},'include':[{'model':db[_0x1be6('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x1be6('0x1f')](handleEntityNotFound(_0x2707a0,null))[_0x1be6('0x1f')](saveUpdates(_0x30626c[_0x1be6('0x59')],null))['then'](respondWithResult(_0x2707a0,null))[_0x1be6('0x29')](handleError(_0x2707a0,null));};exports['destroy']=function(_0x4d8c3e,_0x13a05d){return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x4d8c3e[_0x1be6('0x55')]['id']}})['then'](handleEntityNotFound(_0x13a05d,null))[_0x1be6('0x1f')](removeEntity(_0x13a05d,null))[_0x1be6('0x29')](handleError(_0x13a05d,null));};exports[_0x1be6('0x61')]=function(_0x44005e,_0x49ecb2){return db[_0x1be6('0x3e')][_0x1be6('0x61')]()[_0x1be6('0x1f')](respondWithResult(_0x49ecb2,null))[_0x1be6('0x29')](handleError(_0x49ecb2,null));};exports[_0x1be6('0x62')]=function(_0x3d9c1a,_0x20acff,_0x1d7da8){if(_0x3d9c1a[_0x1be6('0x59')]['id']){delete _0x3d9c1a[_0x1be6('0x59')]['id'];}return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x3d9c1a[_0x1be6('0x55')]['id']}})[_0x1be6('0x1f')](handleEntityNotFound(_0x20acff,null))[_0x1be6('0x1f')](function(_0x572e75){if(_0x572e75){_0x3d9c1a['body']['SmsAccountId']=_0x572e75['id'];return db[_0x1be6('0x63')][_0x1be6('0x64')](_0x3d9c1a[_0x1be6('0x59')]);}})['then'](respondWithResult(_0x20acff,null))[_0x1be6('0x29')](handleError(_0x20acff,null));};exports[_0x1be6('0x65')]=function(_0x2754a4,_0x39a6e6,_0x6694e2){var _0x40f078={'raw':![],'where':{}};var _0x2f6c3a={};var _0xbb0727={'count':0x0,'rows':[]};return db[_0x1be6('0x3e')][_0x1be6('0x66')]({'where':{'id':_0x2754a4[_0x1be6('0x55')]['id']}})[_0x1be6('0x1f')](handleEntityNotFound(_0x39a6e6,null))[_0x1be6('0x1f')](function(_0x212760){if(_0x212760){_0x2f6c3a['model']=_['keys'](db[_0x1be6('0x63')]['rawAttributes']);_0x2f6c3a['query']=_['keys'](_0x2754a4[_0x1be6('0x43')]);_0x2f6c3a[_0x1be6('0x45')]=_[_0x1be6('0x56')](_0x2f6c3a[_0x1be6('0x42')],_0x2f6c3a['query']);_0x40f078[_0x1be6('0x46')]=_[_0x1be6('0x56')](_0x2f6c3a['model'],qs[_0x1be6('0x57')](_0x2754a4[_0x1be6('0x43')][_0x1be6('0x57')]));_0x40f078[_0x1be6('0x46')]=_0x40f078[_0x1be6('0x46')]['length']?_0x40f078[_0x1be6('0x46')]:_0x2f6c3a[_0x1be6('0x42')];if(!_0x2754a4[_0x1be6('0x43')][_0x1be6('0x48')](_0x1be6('0x49'))){_0x40f078[_0x1be6('0x2f')]=qs[_0x1be6('0x2f')](_0x2754a4[_0x1be6('0x43')][_0x1be6('0x2f')]);_0x40f078['offset']=qs[_0x1be6('0x2e')](_0x2754a4[_0x1be6('0x43')][_0x1be6('0x2e')]);}_0x40f078[_0x1be6('0x4a')]=qs[_0x1be6('0x4b')](_0x2754a4[_0x1be6('0x43')][_0x1be6('0x4b')]);_0x40f078[_0x1be6('0x4c')]=qs['filters'](_[_0x1be6('0x4d')](_0x2754a4['query'],_0x2f6c3a[_0x1be6('0x45')]));_0x40f078[_0x1be6('0x4c')]['SmsAccountId']=_0x212760['id'];if(_0x2754a4[_0x1be6('0x43')][_0x1be6('0x4e')]){_0x40f078[_0x1be6('0x4c')]=_[_0x1be6('0x4f')](_0x40f078[_0x1be6('0x4c')],{'$or':_[_0x1be6('0x3d')](_0x40f078[_0x1be6('0x46')],function(_0x66cc93){var _0x3af4a5={};_0x3af4a5[_0x66cc93]={'$like':'%'+_0x2754a4['query'][_0x1be6('0x4e')]+'%'};return _0x3af4a5;})});}_0x40f078=_[_0x1be6('0x4f')]({},_0x40f078,_0x2754a4['options']);return db[_0x1be6('0x63')][_0x1be6('0x2d')]({'where':_0x40f078['where']})['then'](function(_0x4ebaa1){_0xbb0727['count']=_0x4ebaa1;if(_0x2754a4[_0x1be6('0x43')][_0x1be6('0x52')]){_0x40f078[_0x1be6('0x53')]=[{'all':!![]}];}return db[_0x1be6('0x63')][_0x1be6('0x54')](_0x40f078);})[_0x1be6('0x1f')](function(_0x3439b6){_0xbb0727[_0x1be6('0x67')]=_0x3439b6;return _0xbb0727;});}})[_0x1be6('0x1f')](respondWithFilteredResult(_0x39a6e6,_0x40f078))[_0x1be6('0x29')](handleError(_0x39a6e6,null));};exports[_0x1be6('0x68')]=function(_0x1441d9,_0x1ebe21,_0x20c48a){return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x1441d9[_0x1be6('0x55')]['id']}})[_0x1be6('0x1f')](handleEntityNotFound(_0x1ebe21,null))[_0x1be6('0x1f')](function(_0x2c8cbb){if(_0x2c8cbb){return _0x2c8cbb[_0x1be6('0x68')](_0x1441d9[_0x1be6('0x43')][_0x1be6('0x69')]);}})[_0x1be6('0x1f')](respondWithStatusCode(_0x1ebe21,null))[_0x1be6('0x29')](handleError(_0x1ebe21,null));};exports[_0x1be6('0x6a')]=function(_0x203800,_0x1434e3,_0x3a4fff){if(_0x203800[_0x1be6('0x59')]['id']){delete _0x203800['body']['id'];}return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x203800[_0x1be6('0x55')]['id']}})['then'](handleEntityNotFound(_0x1434e3,null))[_0x1be6('0x1f')](function(_0x34ede3){if(_0x34ede3){_0x203800[_0x1be6('0x59')][_0x1be6('0x6b')]=_0x34ede3['id'];return db[_0x1be6('0x6c')]['create'](_0x203800[_0x1be6('0x59')]);}})['then'](respondWithResult(_0x1434e3,null))['catch'](handleError(_0x1434e3,null));};exports[_0x1be6('0x6d')]=function(_0x5a01eb,_0x477b48,_0x14c055){var _0x795c7b={'raw':![],'where':{}};var _0x264d9a={};var _0x54fa51={'count':0x0,'rows':[]};return db[_0x1be6('0x3e')][_0x1be6('0x66')]({'where':{'id':_0x5a01eb['params']['id']}})[_0x1be6('0x1f')](handleEntityNotFound(_0x477b48,null))[_0x1be6('0x1f')](function(_0x5d905d){if(_0x5d905d){_0x264d9a[_0x1be6('0x42')]=_[_0x1be6('0x44')](db[_0x1be6('0x6c')][_0x1be6('0x3f')]);_0x264d9a['query']=_[_0x1be6('0x44')](_0x5a01eb['query']);_0x264d9a[_0x1be6('0x45')]=_[_0x1be6('0x56')](_0x264d9a[_0x1be6('0x42')],_0x264d9a['query']);_0x795c7b['attributes']=_[_0x1be6('0x56')](_0x264d9a[_0x1be6('0x42')],qs[_0x1be6('0x57')](_0x5a01eb['query']['fields']));_0x795c7b[_0x1be6('0x46')]=_0x795c7b[_0x1be6('0x46')][_0x1be6('0x47')]?_0x795c7b[_0x1be6('0x46')]:_0x264d9a[_0x1be6('0x42')];if(!_0x5a01eb['query'][_0x1be6('0x48')](_0x1be6('0x49'))){_0x795c7b[_0x1be6('0x2f')]=qs['limit'](_0x5a01eb[_0x1be6('0x43')]['limit']);_0x795c7b[_0x1be6('0x2e')]=qs['offset'](_0x5a01eb[_0x1be6('0x43')][_0x1be6('0x2e')]);}_0x795c7b['order']=qs[_0x1be6('0x4b')](_0x5a01eb[_0x1be6('0x43')]['sort']);_0x795c7b['where']=qs[_0x1be6('0x45')](_[_0x1be6('0x4d')](_0x5a01eb[_0x1be6('0x43')],_0x264d9a[_0x1be6('0x45')]));_0x795c7b[_0x1be6('0x4c')]['SmsAccountId']=_0x5d905d['id'];if(_0x5a01eb[_0x1be6('0x43')][_0x1be6('0x4e')]){_0x795c7b[_0x1be6('0x4c')]=_['merge'](_0x795c7b[_0x1be6('0x4c')],{'$or':_[_0x1be6('0x3d')](_0x795c7b['attributes'],function(_0x3f89c8){var _0x534a68={};_0x534a68[_0x3f89c8]={'$like':'%'+_0x5a01eb[_0x1be6('0x43')][_0x1be6('0x4e')]+'%'};return _0x534a68;})});}_0x795c7b=_['merge']({},_0x795c7b,_0x5a01eb['options']);return db['CannedAnswer'][_0x1be6('0x2d')]({'where':_0x795c7b[_0x1be6('0x4c')]})[_0x1be6('0x1f')](function(_0x416aa5){_0x54fa51['count']=_0x416aa5;if(_0x5a01eb[_0x1be6('0x43')][_0x1be6('0x52')]){_0x795c7b[_0x1be6('0x53')]=[{'all':!![]}];}return db[_0x1be6('0x6c')]['findAll'](_0x795c7b);})['then'](function(_0x2a0595){_0x54fa51[_0x1be6('0x67')]=_0x2a0595;return _0x54fa51;});}})[_0x1be6('0x1f')](respondWithFilteredResult(_0x477b48,_0x795c7b))[_0x1be6('0x29')](handleError(_0x477b48,null));};exports[_0x1be6('0x6e')]=function(_0x15a6ce,_0x390bf4,_0x33438c){return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x15a6ce['params']['id']}})['then'](handleEntityNotFound(_0x390bf4,null))['then'](function(_0x9ab615){if(_0x9ab615){return _0x9ab615[_0x1be6('0x6e')](_0x15a6ce[_0x1be6('0x43')][_0x1be6('0x69')]);}})[_0x1be6('0x1f')](respondWithStatusCode(_0x390bf4,null))[_0x1be6('0x29')](handleError(_0x390bf4,null));};exports['notify']=function(_0x30cb0b,_0x1a6200,_0x196974){var _0x342258={'channel':_0x1be6('0x6f')};var _0x266e3b=[];var _0x18dbe0=[];var _0x483a47={};return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x30cb0b[_0x1be6('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x1be6('0x70')}]})[_0x1be6('0x1f')](handleEntityNotFound(_0x1a6200,null))[_0x1be6('0x1f')](function(_0x474722){_0x342258['account']=_0x474722;_0x342258[_0x1be6('0x71')]=_['orderBy'](_0x474722[_0x1be6('0x70')],[_0x1be6('0x72')],[_0x1be6('0x73')]);if(_0x342258[_0x1be6('0x74')]['Applications']){delete _0x342258[_0x1be6('0x74')][_0x1be6('0x70')];}return db[_0x1be6('0x75')][_0x1be6('0x61')]();})[_0x1be6('0x1f')](function(_0xfc4c3d){if(!_0xfc4c3d){throw new db[(_0x1be6('0x76'))][(_0x1be6('0x77'))](_0x1be6('0x78'));}_0x266e3b=_[_0x1be6('0x79')](_[_0x1be6('0x44')](_0xfc4c3d),[_0x1be6('0x7a'),_0x1be6('0x7b')]);_0x18dbe0=_[_0x1be6('0x79')](_[_0x1be6('0x44')](_0xfc4c3d),[_0x1be6('0x7a'),_0x1be6('0x7b'),_0x1be6('0x7c'),_0x1be6('0x7d')]);_0x342258['body']={'mapKey':_0x1be6('0x7e')};if(_0x342258[_0x1be6('0x74')]['type']){switch(_0x342258[_0x1be6('0x74')]['type']){case'twilio':_0x342258['body'][_0x1be6('0x7f')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x80')];_0x342258[_0x1be6('0x59')][_0x1be6('0x59')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x81')];_0x342258[_0x1be6('0x59')][_0x1be6('0x82')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x83')];break;case _0x1be6('0x84'):_0x342258[_0x1be6('0x59')]['from']='+'+_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x85')];_0x342258[_0x1be6('0x59')]['body']=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x86')];break;case _0x1be6('0x87'):_0x342258[_0x1be6('0x59')]['from']=_0x30cb0b[_0x1be6('0x59')]['from'];_0x342258['body']['body']=_0x30cb0b['body'][_0x1be6('0x28')];break;case _0x1be6('0x88'):_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x7f')];_0x342258[_0x1be6('0x59')][_0x1be6('0x59')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x59')];_0x342258[_0x1be6('0x59')]['messageId']=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x89')];break;case'plivo':_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x80')];_0x342258[_0x1be6('0x59')]['body']=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x8a')];_0x342258['body']['messageId']=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x8b')];break;case _0x1be6('0x8c'):_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')]='+'+_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x8d')][0x0][_0x1be6('0x7f')];_0x342258[_0x1be6('0x59')][_0x1be6('0x59')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x8d')][0x0][_0x1be6('0x86')];_0x342258[_0x1be6('0x59')][_0x1be6('0x82')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x8d')][0x0][_0x1be6('0x82')];break;case _0x1be6('0x8e'):_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')]=_0x30cb0b[_0x1be6('0x59')]['originatingAddress'];_0x342258['body'][_0x1be6('0x59')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x8f')][_0x1be6('0x28')];break;case _0x1be6('0x90'):_0x342258[_0x1be6('0x59')]['from']=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x91')];_0x342258[_0x1be6('0x59')]['body']=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x86')];_0x342258['body']['messageId']=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x92')];break;case _0x1be6('0x93'):_0x342258['body']['messageId']=_0x30cb0b[_0x1be6('0x59')][0x0][_0x1be6('0x28')]['id'];_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')]=_0x30cb0b[_0x1be6('0x59')][0x0][_0x1be6('0x28')]['from'];_0x342258[_0x1be6('0x59')][_0x1be6('0x59')]=_0x30cb0b[_0x1be6('0x59')][0x0][_0x1be6('0x28')][_0x1be6('0x86')];break;case _0x1be6('0x94'):_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')]=_0x30cb0b[_0x1be6('0x59')][_0x1be6('0x7f')];_0x342258[_0x1be6('0x59')]['body']=_0x30cb0b['body'][_0x1be6('0x28')];_0x342258['body'][_0x1be6('0x82')]=_0x30cb0b[_0x1be6('0x59')]['refid'];break;}}if(_0x342258[_0x1be6('0x59')]['id']){delete _0x342258[_0x1be6('0x59')]['id'];}if(_[_0x1be6('0x95')](_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')])){throw new db[(_0x1be6('0x76'))][(_0x1be6('0x77'))](_0x1be6('0x96'));}if(_[_0x1be6('0x95')](_0x342258['body']['body'])||_0x342258[_0x1be6('0x59')][_0x1be6('0x59')]===''){throw new db[(_0x1be6('0x76'))][(_0x1be6('0x77'))](_0x1be6('0x97'));}if(_[_0x1be6('0x95')](_0x342258[_0x1be6('0x59')]['mapKey'])){throw new db[(_0x1be6('0x76'))][(_0x1be6('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18dbe0);}if(!_[_0x1be6('0x98')](_0x18dbe0,_0x342258[_0x1be6('0x59')][_0x1be6('0x99')])){throw new db[(_0x1be6('0x76'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18dbe0);}_0x483a47[_0x342258['body'][_0x1be6('0x99')]]=_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')];return db['CmList'][_0x1be6('0x58')]({'where':{'id':_0x342258[_0x1be6('0x74')]['ListId']},'include':[{'model':db[_0x1be6('0x75')],'as':_0x1be6('0x9a'),'where':_0x483a47,'limit':0x1,'order':[[_0x1be6('0x7b'),_0x1be6('0x9b')]]}]});})[_0x1be6('0x1f')](handleEntityNotFound(_0x1a6200,null))[_0x1be6('0x1f')](function(_0x6b9d66){if(_0x6b9d66){_0x342258['list']=_['omit'](_0x6b9d66,[_0x1be6('0x9a')]);if(_0x6b9d66[_0x1be6('0x9a')][_0x1be6('0x47')]){return _0x6b9d66[_0x1be6('0x9a')][0x0];}var _0x1f3c3b=_[_0x1be6('0x9c')](_0x342258['body'],{'firstName':_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')],'ListId':_0x6b9d66['id']});_0x1f3c3b[_0x342258[_0x1be6('0x59')]['mapKey']]=_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')];return db['CmContact']['create'](_0x1f3c3b,{'fields':_0x266e3b,'raw':!![]});}})['then'](handleEntityNotFound(_0x1a6200,null))[_0x1be6('0x1f')](function(_0x1cd042){if(_0x1cd042){_0x342258[_0x1be6('0x9d')]=_0x1cd042;var _0x1acef1={'ContactId':_0x1cd042['id'],'phone':_0x342258['body']['from'],'SmsAccountId':_0x30cb0b[_0x1be6('0x55')]['id']};var _0x1c44ca={'ContactId':_0x1cd042['id'],'SmsAccountId':_0x30cb0b[_0x1be6('0x55')]['id'],'closed':![]};return db['SmsInteraction'][_0x1be6('0x58')]({'where':_0x1c44ca})[_0x1be6('0x1f')](function(_0x1e800a){if(_0x1e800a){return[_0x1e800a,![]];}return db[_0x1be6('0x9e')][_0x1be6('0x64')](_0x1acef1)[_0x1be6('0x1f')](function(_0x39ba9f){return[_0x39ba9f,!![]];});});}})['spread'](function(_0x3d0f30,_0x140256){_0x342258[_0x1be6('0x9f')]=_0x3d0f30[_0x1be6('0x36')]({'plain':!![]});_0x342258[_0x1be6('0x9f')][_0x1be6('0xa0')]=![];if(_0x140256){if(_0x342258[_0x1be6('0x74')]['autoclose']){_0x342258[_0x1be6('0x71')]['push']({'id':0x0,'priority':_0x342258[_0x1be6('0x71')][_0x1be6('0x47')]+0x1,'app':_0x1be6('0xa1'),'appdata':'unmanaged','interval':_0x1be6('0xa2')});}_0x342258[_0x1be6('0x9f')]['created']=!![];}return db[_0x1be6('0xa3')][_0x1be6('0x64')]({'phone':_0x342258[_0x1be6('0x59')][_0x1be6('0x7f')],'messageId':_0x342258[_0x1be6('0x59')][_0x1be6('0x82')],'body':_0x342258[_0x1be6('0x59')]['body'],'SmsAccountId':_0x30cb0b[_0x1be6('0x55')]['id'],'SmsInteractionId':_0x3d0f30['id'],'direction':'in','ContactId':_0x3d0f30[_0x1be6('0xa4')],'AttachmentId':_0x342258[_0x1be6('0x59')][_0x1be6('0xa5')]});})[_0x1be6('0x1f')](function(_0x52d9f0){_0x342258[_0x1be6('0x28')]=_0x52d9f0;if(_0x342258[_0x1be6('0x9f')]['UserId']){return db['User'][_0x1be6('0x58')]({'attributes':['id',_0x1be6('0x39')],'where':{'id':_0x342258[_0x1be6('0x9f')][_0x1be6('0xa6')]}})[_0x1be6('0x1f')](function(_0x359546){if(_0x359546){_0x342258[_0x1be6('0x71')][_0x1be6('0xa7')]({'id':0x0,'priority':0x0,'app':_0x1be6('0xa8'),'appdata':_0x359546[_0x1be6('0x39')]+','+(_0x342258[_0x1be6('0x74')][_0x1be6('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x1be6('0xaa'),_0x342258);});}return respondWithRpcPromise('Start',_0x1be6('0xaa'),_0x342258);})['then'](function(_0x52cd6a){if(_0x52cd6a){var _0x420fd5=0xc8;var _0x26fe5b=_0x1be6('0xab');logger[_0x1be6('0x20')](_0x1be6('0x24'),_0x26fe5b,_0x420fd5,'entity\x20found');logger[_0x1be6('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x26fe5b,_0x420fd5,_0x1be6('0xac'),JSON['stringify'](_0x52cd6a));if(_0x342258[_0x1be6('0x74')][_0x1be6('0x41')]===_0x1be6('0xad')){return _0x1a6200[_0x1be6('0x2a')](_0x420fd5)[_0x1be6('0x30')](_0x1be6('0xae'),_0x1be6('0xaf'))[_0x1be6('0xb0')](_0x1be6('0xb1'));}else{return _0x1a6200[_0x1be6('0x2a')](_0x420fd5)[_0x1be6('0x32')](_0x52cd6a);}}})[_0x1be6('0x29')](handleError(_0x1a6200,null));};exports[_0x1be6('0xb2')]=function(_0x5aaec0,_0x5d9b8b){var _0x5e23e8=_0x5aaec0[_0x1be6('0x55')]['id'];var _0x4effa6=_0x5aaec0[_0x1be6('0x59')];var _0x44f059=0xc8;var _0x16f234=null;return db['sequelize'][_0x1be6('0xb3')]({'isolationLevel':db[_0x1be6('0xb4')][_0x1be6('0xb5')][_0x1be6('0xb6')]['READ_COMMITTED']},function(_0x1fc841){return db['SmsAccount']['findOne']({'where':{'id':_0x5e23e8},'transaction':_0x1fc841})[_0x1be6('0x1f')](function(_0x48b042){if(_0x48b042){return db[_0x1be6('0xb7')][_0x1be6('0x37')]({'where':{'SmsAccountId':_0x5e23e8},'transaction':_0x1fc841})[_0x1be6('0x1f')](function(){var _0x3b62a9=_[_0x1be6('0x3d')](_0x4effa6,function(_0x1380bf){_0x1380bf['SmsAccountId']=_0x5e23e8;return _0x1380bf;});return db[_0x1be6('0xb7')][_0x1be6('0xb8')](_0x3b62a9,{'transaction':_0x1fc841});});}else{_0x44f059=0x194;_0x16f234=[];}});})[_0x1be6('0x1f')](function(){if(_0x44f059!==0x194){return db[_0x1be6('0xb7')][_0x1be6('0xb9')]({'where':{'SmsAccountId':_0x5e23e8},'order':_0x1be6('0x72')})[_0x1be6('0x1f')](function(_0x3b343c){_0x16f234=_0x3b343c;});}})['catch'](function(_0x225473){_0x44f059=0x1f4;logger[_0x1be6('0x26')](_0x225473['stack']);if(_0x225473[_0x1be6('0x39')]){delete _0x225473['name'];}_0x16f234=_0x225473;})[_0x1be6('0xba')](function(){if(_0x16f234===null){_0x5d9b8b[_0x1be6('0xbb')](_0x44f059);}else{if(_0x44f059===0x1f4){_0x5d9b8b[_0x1be6('0x2a')](_0x44f059)[_0x1be6('0xb0')](_0x16f234);}else{_0x5d9b8b['status'](_0x44f059)[_0x1be6('0x32')](_0x16f234);}}});};exports[_0x1be6('0xbc')]=function(_0x37116b,_0xa6a6aa,_0x9d401){var _0x461d46={};var _0x4fcef2={};var _0x2346f2;var _0xa133d4;return db['SmsAccount'][_0x1be6('0x66')]({'where':{'id':_0x37116b[_0x1be6('0x55')]['id']}})['then'](handleEntityNotFound(_0xa6a6aa,null))['then'](function(_0x475560){if(_0x475560){_0x2346f2=_0x475560;_0x4fcef2[_0x1be6('0x42')]=_[_0x1be6('0x44')](db['SmsApplication'][_0x1be6('0x3f')]);_0x4fcef2[_0x1be6('0x43')]=_[_0x1be6('0x44')](_0x37116b[_0x1be6('0x43')]);_0x4fcef2[_0x1be6('0x45')]=_['intersection'](_0x4fcef2[_0x1be6('0x42')],_0x4fcef2[_0x1be6('0x43')]);_0x461d46[_0x1be6('0x46')]=_[_0x1be6('0x56')](_0x4fcef2[_0x1be6('0x42')],qs[_0x1be6('0x57')](_0x37116b[_0x1be6('0x43')][_0x1be6('0x57')]));_0x461d46['attributes']=_0x461d46[_0x1be6('0x46')][_0x1be6('0x47')]?_0x461d46[_0x1be6('0x46')]:_0x4fcef2[_0x1be6('0x42')];_0x461d46[_0x1be6('0x4a')]=qs[_0x1be6('0x4b')](_0x37116b['query'][_0x1be6('0x4b')]);_0x461d46[_0x1be6('0x4c')]=qs[_0x1be6('0x45')](_[_0x1be6('0x4d')](_0x37116b['query'],_0x4fcef2['filters']));if(_0x37116b['query']['filter']){_0x461d46['where']=_[_0x1be6('0x4f')](_0x461d46[_0x1be6('0x4c')],{'$or':_[_0x1be6('0x3d')](_0x461d46['attributes'],function(_0x327ee1){var _0x227fa0={};_0x227fa0[_0x327ee1]={'$like':'%'+_0x37116b['query'][_0x1be6('0x4e')]+'%'};return _0x227fa0;})});}_0x461d46=_[_0x1be6('0x4f')]({},_0x461d46,_0x37116b['options']);return _0x2346f2['getApplications'](_0x461d46);}})[_0x1be6('0x1f')](function(_0x17a87f){if(_0x17a87f){_0xa133d4=_0x17a87f[_0x1be6('0x47')];if(!_0x37116b['query'][_0x1be6('0x48')](_0x1be6('0x49'))){_0x461d46[_0x1be6('0x2f')]=qs[_0x1be6('0x2f')](_0x37116b['query'][_0x1be6('0x2f')]);_0x461d46[_0x1be6('0x2e')]=qs['offset'](_0x37116b[_0x1be6('0x43')]['offset']);}return _0x2346f2[_0x1be6('0xbc')](_0x461d46);}})['then'](function(_0x3cc658){if(_0x3cc658){return _0x3cc658?{'count':_0xa133d4,'rows':_0x3cc658}:null;}})[_0x1be6('0x1f')](respondWithResult(_0xa6a6aa,null))['catch'](handleError(_0xa6a6aa,null));};exports[_0x1be6('0xbd')]=function(_0x148553,_0x39cba2,_0x4295f5){var _0x43123c={'raw':![],'where':{}};var _0x571f57={};var _0x297d4a={'count':0x0,'rows':[]};return db[_0x1be6('0x3e')][_0x1be6('0x66')]({'where':{'id':_0x148553[_0x1be6('0x55')]['id']}})[_0x1be6('0x1f')](handleEntityNotFound(_0x39cba2,null))[_0x1be6('0x1f')](function(_0x48350c){if(_0x48350c){_0x571f57[_0x1be6('0x42')]=_[_0x1be6('0x44')](db[_0x1be6('0x9e')][_0x1be6('0x3f')]);_0x571f57[_0x1be6('0x43')]=_[_0x1be6('0x44')](_0x148553[_0x1be6('0x43')]);_0x571f57[_0x1be6('0x45')]=_[_0x1be6('0x56')](_0x571f57[_0x1be6('0x42')],_0x571f57['query']);_0x43123c['attributes']=_[_0x1be6('0x56')](_0x571f57[_0x1be6('0x42')],qs[_0x1be6('0x57')](_0x148553['query'][_0x1be6('0x57')]));_0x43123c[_0x1be6('0x46')]=_0x43123c[_0x1be6('0x46')]['length']?_0x43123c[_0x1be6('0x46')]:_0x571f57[_0x1be6('0x42')];if(!_0x148553[_0x1be6('0x43')]['hasOwnProperty'](_0x1be6('0x49'))){_0x43123c[_0x1be6('0x2f')]=qs[_0x1be6('0x2f')](_0x148553[_0x1be6('0x43')][_0x1be6('0x2f')]);_0x43123c[_0x1be6('0x2e')]=qs[_0x1be6('0x2e')](_0x148553[_0x1be6('0x43')][_0x1be6('0x2e')]);}_0x43123c[_0x1be6('0x4a')]=qs['sort'](_0x148553[_0x1be6('0x43')]['sort']);_0x43123c[_0x1be6('0x4c')]=qs['filters'](_[_0x1be6('0x4d')](_0x148553[_0x1be6('0x43')],_0x571f57[_0x1be6('0x45')]));_0x43123c['where'][_0x1be6('0x6b')]=_0x48350c['id'];if(_0x148553[_0x1be6('0x43')]['filter']){_0x43123c['where']=_['merge'](_0x43123c['where'],{'$or':_[_0x1be6('0x3d')](_0x43123c[_0x1be6('0x46')],function(_0x2ff535){var _0x30c4c9={};_0x30c4c9[_0x2ff535]={'$like':'%'+_0x148553[_0x1be6('0x43')][_0x1be6('0x4e')]+'%'};return _0x30c4c9;})});}_0x43123c=_[_0x1be6('0x4f')]({},_0x43123c,_0x148553[_0x1be6('0x51')]);return db[_0x1be6('0x9e')][_0x1be6('0x2d')]({'where':_0x43123c[_0x1be6('0x4c')]})[_0x1be6('0x1f')](function(_0x29e25e){_0x297d4a[_0x1be6('0x2d')]=_0x29e25e;if(_0x148553[_0x1be6('0x43')]['includeAll']){_0x43123c[_0x1be6('0x53')]=[{'model':db[_0x1be6('0x75')],'as':_0x1be6('0xbe'),'required':![]},{'model':db[_0x1be6('0xbf')],'as':'Owner','attributes':['name',_0x1be6('0xc0'),_0x1be6('0xc1')],'required':![]},{'model':db[_0x1be6('0xc2')],'as':'Tags','attributes':['id',_0x1be6('0x39'),_0x1be6('0xc3')],'where':_0x148553['query']['tag']?{'id':_0x148553[_0x1be6('0x43')]['tag']}:undefined,'required':_0x148553[_0x1be6('0x43')][_0x1be6('0xc4')]?!![]:![]}];}return db[_0x1be6('0x9e')]['findAll'](_0x43123c);})[_0x1be6('0x1f')](function(_0x12f709){_0x297d4a[_0x1be6('0x67')]=_0x12f709;return _0x297d4a;});}})[_0x1be6('0x1f')](respondWithFilteredResult(_0x39cba2,_0x43123c))[_0x1be6('0x29')](handleError(_0x39cba2,null));};exports['send']=function(_0x56a2bb,_0x289b2e,_0x5ebb47){var _0x4fd903,_0x56a301,_0x1c0a45;if(_[_0x1be6('0x95')](_0x56a2bb[_0x1be6('0x59')][_0x1be6('0x59')])||_0x56a2bb[_0x1be6('0x59')][_0x1be6('0x59')]===''){throw new db[(_0x1be6('0x76'))][(_0x1be6('0x77'))](_0x1be6('0x97'));}if(_['isNil'](_0x56a2bb[_0x1be6('0x59')]['to'])){throw new db[(_0x1be6('0x76'))]['ValidationError'](_0x1be6('0xc5'));}_0x4fd903=_0x56a2bb[_0x1be6('0x59')]['to'];return db[_0x1be6('0x3e')]['find']({'where':{'id':_0x56a2bb[_0x1be6('0x55')]['id']},'include':[{'model':db[_0x1be6('0xc6')],'as':_0x1be6('0xc7'),'include':[{'model':db[_0x1be6('0x75')],'as':_0x1be6('0x9a'),'where':{'mobile':_0x4fd903},'limit':0x1,'order':[[_0x1be6('0x7b'),'DESC']]}]}]})[_0x1be6('0x1f')](handleEntityNotFound(_0x289b2e,null))[_0x1be6('0x1f')](function(_0xfc299a){if(_0xfc299a&&_0xfc299a['List']){_0x56a301=_0xfc299a['get']({'plain':!![]});if(_0x56a301['List']&&_0x56a301['List'][_0x1be6('0x9a')]['length']){return _0x56a301[_0x1be6('0xc7')][_0x1be6('0x9a')][0x0];}return db['CmContact'][_0x1be6('0x64')](_[_0x1be6('0x9c')](_0x56a2bb[_0x1be6('0x59')],{'firstName':_0x4fd903,'mobile':_0x4fd903,'phone':_0x4fd903,'ListId':_0x56a301[_0x1be6('0x7d')]}));}})[_0x1be6('0x1f')](handleEntityNotFound(_0x289b2e,null))[_0x1be6('0x1f')](function(_0x4774ab){if(_0x4774ab){_0x1c0a45=_0x4774ab;return db[_0x1be6('0x9e')][_0x1be6('0x58')]({'where':{'ContactId':_0x1c0a45['id'],'closed':![],'SmsAccountId':_0x56a301['id']}})[_0x1be6('0x1f')](function(_0x422c47){if(_0x422c47){return[_0x422c47,![]];}return db[_0x1be6('0x9e')][_0x1be6('0x64')]({'UserId':_0x56a2bb[_0x1be6('0x5c')]['id'],'ContactId':_0x1c0a45['id'],'SmsAccountId':_0x56a301['id'],'phone':_0x4fd903,'firstMsgDirection':_0x1be6('0xc8'),'Messages':[_[_0x1be6('0x4f')](_0x56a2bb[_0x1be6('0x59')],{'read':![],'body':_0x56a2bb['body'][_0x1be6('0x59')],'phone':_0x4fd903,'SmsAccountId':_0x56a301['id'],'UserId':_0x56a2bb[_0x1be6('0x5c')]['id'],'ContactId':_0x1c0a45['id']})]},{'include':[{'model':db[_0x1be6('0xa3')],'as':_0x1be6('0xc9')}]})[_0x1be6('0x1f')](function(_0x49a68c){return[_0x49a68c,!![]];});});}})[_0x1be6('0xca')](function(_0x3d9e9c,_0x372a04){if(_0x372a04){return _0x3d9e9c;}return db[_0x1be6('0xa3')]['create'](_[_0x1be6('0x4f')](_0x56a2bb[_0x1be6('0x59')],{'read':![],'body':_0x56a2bb[_0x1be6('0x59')][_0x1be6('0x59')],'phone':_0x4fd903,'SmsAccountId':_0x56a301['id'],'SmsInteractionId':_0x3d9e9c['id'],'UserId':_0x56a2bb[_0x1be6('0x5c')]['id'],'ContactId':_0x1c0a45['id']}))[_0x1be6('0x1f')](function(_0x1937bf){_0x3d9e9c[_0x1be6('0xcb')][_0x1be6('0xc9')]=[];_0x3d9e9c['dataValues']['Messages'][_0x1be6('0xcc')](_0x1937bf[_0x1be6('0xcb')]);return _0x3d9e9c;});})[_0x1be6('0x1f')](respondWithResult(_0x289b2e,null))[_0x1be6('0x29')](handleError(_0x289b2e,null));};exports[_0x1be6('0x2a')]=function(_0x27266c,_0x2e26f7,_0x5ed7df){if(_0x27266c[_0x1be6('0x59')]['id']){delete _0x27266c[_0x1be6('0x59')]['id'];}var _0x70ebb6,_0x33ef6a,_0x8157b;return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x27266c[_0x1be6('0x55')]['id']}})[_0x1be6('0x1f')](handleEntityNotFound(_0x2e26f7,null))[_0x1be6('0x1f')](function(_0x488c86){if(_0x488c86){_0x8157b=_0x488c86;logger[_0x1be6('0x23')](_0x1be6('0x24'),_0x1be6('0x2a'),'received\x20delivery\x20report\x20from',_0x488c86[_0x1be6('0x41')],util[_0x1be6('0xcd')](_0x27266c[_0x1be6('0x59')],{'showHidden':![],'depth':null}));switch(_0x488c86[_0x1be6('0x41')]){case _0x1be6('0x84'):if(_0x27266c[_0x1be6('0x59')][_0x1be6('0xce')]&&_0x27266c['body']['status']){_0x33ef6a=_0x27266c[_0x1be6('0x59')][_0x1be6('0x2a')];return db[_0x1be6('0xa3')][_0x1be6('0x58')]({'where':{'messageId':_0x27266c[_0x1be6('0x59')][_0x1be6('0xce')]}});}break;case _0x1be6('0x87'):if(_0x27266c['body']['requestid']&&_0x27266c[_0x1be6('0x59')]['statusInt']){_0x33ef6a=_0x27266c[_0x1be6('0x59')]['statusInt'];return db[_0x1be6('0xa3')][_0x1be6('0x58')]({'where':{'messageId':_0x27266c['body'][_0x1be6('0xcf')]}});}break;case _0x1be6('0x88'):if(_0x27266c[_0x1be6('0x59')]['message_id']&&_0x27266c[_0x1be6('0x59')]['status_code']){_0x33ef6a=_0x27266c[_0x1be6('0x59')][_0x1be6('0xd0')];return db[_0x1be6('0xa3')]['find']({'where':{'messageId':_0x27266c[_0x1be6('0x59')]['message_id']}});}break;case _0x1be6('0x8c'):var _0x53c47f=_0x27266c[_0x1be6('0x59')][_0x1be6('0x8d')][0x0];if(_0x53c47f[_0x1be6('0x82')]&&_0x53c47f[_0x1be6('0x2a')][_0x1be6('0xd1')]===_0x1be6('0xd2')){_0x33ef6a=_0x53c47f['status'][_0x1be6('0xd1')];return db[_0x1be6('0xa3')][_0x1be6('0x58')]({'where':{'messageId':_0x53c47f[_0x1be6('0x82')]}});}break;case'clickatell':if(_0x27266c['body'][_0x1be6('0x82')]&&_0x27266c[_0x1be6('0x59')][_0x1be6('0x2a')]){_0x33ef6a=_0x27266c[_0x1be6('0x59')]['status'];return db['SmsMessage'][_0x1be6('0x58')]({'where':{'messageId':_0x27266c[_0x1be6('0x59')]['messageId']}});}break;case _0x1be6('0x93'):if(_0x27266c[_0x1be6('0x59')][0x0]['message']['id']){_0x33ef6a=_0x27266c['body'][0x0][_0x1be6('0x41')];return db[_0x1be6('0xa3')][_0x1be6('0x58')]({'where':{'messageId':_0x27266c['body'][0x0]['message']['id']}});}break;case _0x1be6('0x94'):if(_0x27266c[_0x1be6('0x59')]['redif']&&_0x27266c[_0x1be6('0x59')][_0x1be6('0x2a')]){_0x33ef6a=_0x27266c[_0x1be6('0x59')]['status'];return db[_0x1be6('0xa3')]['find']({'where':{'messageId':_0x27266c[_0x1be6('0x59')][_0x1be6('0xd3')]}});}break;}}})[_0x1be6('0x1f')](handleEntityNotFound(_0x2e26f7,null))['then'](function(_0x524c5a){if(_0x524c5a){_0x70ebb6=_0x524c5a;switch(_0x8157b['type']){case'skebby':if(_0x33ef6a===_0x1be6('0xd2')){return _0x70ebb6[_0x1be6('0x35')]({'read':!![]});}else{logger[_0x1be6('0x26')](_0x1be6('0x24'),_0x1be6('0x2a'),_0x1be6('0x84'),util[_0x1be6('0xcd')](_0x27266c[_0x1be6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1be6('0x87'):if(_0x33ef6a==='1'){return _0x70ebb6[_0x1be6('0x35')]({'read':!![]});}else{logger['error'](_0x1be6('0x24'),_0x1be6('0x2a'),'skebby',util[_0x1be6('0xcd')](_0x27266c['body'],{'showHidden':![],'depth':null}));}break;case _0x1be6('0x88'):if(!_0x27266c[_0x1be6('0x59')][_0x1be6('0xd4')]&&_0x33ef6a>=0xc8&&_0x33ef6a<=0xce){return _0x70ebb6[_0x1be6('0x35')]({'read':!![]});}else{logger[_0x1be6('0x26')](_0x1be6('0x24'),_0x1be6('0x2a'),'clicksend',util[_0x1be6('0xcd')](_0x27266c[_0x1be6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1be6('0x8c'):var _0xa0c22=_0x27266c[_0x1be6('0x59')][_0x1be6('0x8d')][0x0];if(_0xa0c22[_0x1be6('0x2a')]['groupName']===_0x1be6('0xd2')){return _0x70ebb6[_0x1be6('0x35')]({'read':!![]});}else{logger['error'](_0x1be6('0x24'),'status',_0x1be6('0x8c'),util[_0x1be6('0xcd')](_0x27266c[_0x1be6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1be6('0x90'):if(_0x33ef6a==_0x1be6('0xd5')||_0x33ef6a=='RECEIVED_BY_RECIPIENT'){return _0x70ebb6[_0x1be6('0x35')]({'read':!![]});}else{logger[_0x1be6('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1be6('0x2a'),'clickatell',util[_0x1be6('0xcd')](_0x27266c[_0x1be6('0x59')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x33ef6a==_0x1be6('0xd6')){return _0x70ebb6[_0x1be6('0x35')]({'read':!![]});}else{logger[_0x1be6('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1be6('0x2a'),_0x1be6('0x93'),util['inspect'](_0x27266c[_0x1be6('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1be6('0x94'):if(_0x33ef6a==='DELIVRD'||_0x33ef6a===_0x1be6('0xd7')){return _0x70ebb6[_0x1be6('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1be6('0x2a'),_0x1be6('0x94'),util[_0x1be6('0xcd')](_0x27266c[_0x1be6('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x70ebb6;}})['then'](respondWithResult(_0x2e26f7,null))[_0x1be6('0x29')](handleError(_0x2e26f7,null));};exports['statusGet']=function(_0x3fa2fe,_0x385724,_0x470e75){var _0x297faa,_0x38121b,_0x1edd48;return db['SmsAccount'][_0x1be6('0x58')]({'where':{'id':_0x3fa2fe[_0x1be6('0x55')]['id']}})[_0x1be6('0x1f')](handleEntityNotFound(_0x385724,null))[_0x1be6('0x1f')](function(_0x14c114){if(_0x14c114){_0x1edd48=_0x14c114;logger[_0x1be6('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1be6('0xd8'),_0x14c114['type'],util[_0x1be6('0xcd')](_0x3fa2fe[_0x1be6('0x43')],{'showHidden':![],'depth':null}));switch(_0x14c114[_0x1be6('0x41')]){case _0x1be6('0x8e'):if(_0x3fa2fe[_0x1be6('0x43')][_0x1be6('0xd9')]&&_0x3fa2fe[_0x1be6('0x43')][_0x1be6('0xda')]){_0x38121b=_0x3fa2fe['query'][_0x1be6('0xda')];return db[_0x1be6('0xa3')]['find']({'where':{'messageId':_0x3fa2fe[_0x1be6('0x43')][_0x1be6('0xd9')]}});}break;}}})[_0x1be6('0x1f')](handleEntityNotFound(_0x385724,null))[_0x1be6('0x1f')](function(_0x3c9825){if(_0x3c9825){_0x297faa=_0x3c9825;switch(_0x1edd48[_0x1be6('0x41')]){case _0x1be6('0x8e'):if(_0x38121b==='2'||_0x38121b==='6'){return _0x297faa['update']({'read':!![]});}else{logger[_0x1be6('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util[_0x1be6('0xcd')](_0x3fa2fe['query'],{'showHidden':![],'depth':null}));};break;}return _0x297faa;}})[_0x1be6('0x1f')](respondWithResult(_0x385724,null))[_0x1be6('0x29')](handleError(_0x385724,null));};exports['addAgents']=function(_0x58305e,_0x370c99,_0x161f2a){return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x58305e[_0x1be6('0x55')]['id']}})['then'](handleEntityNotFound(_0x370c99,null))[_0x1be6('0x1f')](function(_0x510697){if(_0x510697){return _0x510697[_0x1be6('0xdb')](_0x58305e[_0x1be6('0x59')][_0x1be6('0x69')],_[_0x1be6('0xdc')](_0x58305e[_0x1be6('0x59')],[_0x1be6('0x69'),'id'])||{})[_0x1be6('0xca')](function(_0x1a4e06){for(var _0x5d9d2a=0x0;_0x5d9d2a<_0x58305e[_0x1be6('0x59')]['ids'][_0x1be6('0x47')];_0x5d9d2a+=0x1){socket[_0x1be6('0xdd')](_0x1be6('0xde'),{'UserId':Number(_0x58305e['body']['ids'][_0x5d9d2a]),'SmsAccountId':Number(_0x58305e[_0x1be6('0x55')]['id'])});}return _0x1a4e06;});}})[_0x1be6('0x1f')](respondWithResult(_0x370c99,null))[_0x1be6('0x29')](handleError(_0x370c99,null));};exports['removeAgents']=function(_0x2212ac,_0x23e2bf,_0x514ca1){return db[_0x1be6('0x3e')][_0x1be6('0x58')]({'where':{'id':_0x2212ac[_0x1be6('0x55')]['id']}})[_0x1be6('0x1f')](handleEntityNotFound(_0x23e2bf,null))[_0x1be6('0x1f')](function(_0x552f3d){if(_0x552f3d){return _0x552f3d[_0x1be6('0xdf')](_0x2212ac['query'][_0x1be6('0x69')])[_0x1be6('0x1f')](function(){if(_['isArray'](_0x2212ac[_0x1be6('0x43')]['ids'])){for(var _0x1fdda7=0x0;_0x1fdda7<_0x2212ac[_0x1be6('0x43')]['ids']['length'];_0x1fdda7+=0x1){socket[_0x1be6('0xdd')](_0x1be6('0xe0'),{'UserId':Number(_0x2212ac[_0x1be6('0x43')][_0x1be6('0x69')][_0x1fdda7]),'SmsAccountId':Number(_0x2212ac[_0x1be6('0x55')]['id'])});}}else{socket[_0x1be6('0xdd')](_0x1be6('0xe0'),{'UserId':Number(_0x2212ac[_0x1be6('0x43')][_0x1be6('0x69')]),'SmsAccountId':Number(_0x2212ac[_0x1be6('0x55')]['id'])});}});}})[_0x1be6('0x1f')](respondWithStatusCode(_0x23e2bf,null))['catch'](handleError(_0x23e2bf,null));};exports[_0x1be6('0xe1')]=function(_0xed4d70,_0x3c38ce,_0x455d15){var _0x4e3963={};var _0x1a7b04={};var _0x124f0f;var _0x123d61;return db[_0x1be6('0x3e')][_0x1be6('0x66')]({'where':{'id':_0xed4d70[_0x1be6('0x55')]['id']}})['then'](handleEntityNotFound(_0x3c38ce,null))[_0x1be6('0x1f')](function(_0x15ea07){if(_0x15ea07){_0x124f0f=_0x15ea07;_0x1a7b04[_0x1be6('0x42')]=_[_0x1be6('0x44')](db[_0x1be6('0xbf')][_0x1be6('0x3f')]);_0x1a7b04[_0x1be6('0x43')]=_[_0x1be6('0x44')](_0xed4d70[_0x1be6('0x43')]);_0x1a7b04[_0x1be6('0x45')]=_[_0x1be6('0x56')](_0x1a7b04[_0x1be6('0x42')],_0x1a7b04[_0x1be6('0x43')]);_0x4e3963[_0x1be6('0x46')]=_[_0x1be6('0x56')](_0x1a7b04[_0x1be6('0x42')],qs[_0x1be6('0x57')](_0xed4d70[_0x1be6('0x43')][_0x1be6('0x57')]));_0x4e3963[_0x1be6('0x46')]=_0x4e3963[_0x1be6('0x46')][_0x1be6('0x47')]?_0x4e3963[_0x1be6('0x46')]:_0x1a7b04['model'];_0x4e3963[_0x1be6('0x4a')]=qs[_0x1be6('0x4b')](_0xed4d70[_0x1be6('0x43')][_0x1be6('0x4b')]);_0x4e3963[_0x1be6('0x4c')]=qs['filters'](_[_0x1be6('0x4d')](_0xed4d70['query'],_0x1a7b04[_0x1be6('0x45')]));if(_0xed4d70[_0x1be6('0x43')][_0x1be6('0x4e')]){_0x4e3963[_0x1be6('0x4c')]=_[_0x1be6('0x4f')](_0x4e3963[_0x1be6('0x4c')],{'$or':_['map'](_0x4e3963[_0x1be6('0x46')],function(_0x159d84){var _0x35fa15={};_0x35fa15[_0x159d84]={'$like':'%'+_0xed4d70[_0x1be6('0x43')]['filter']+'%'};return _0x35fa15;})});}_0x4e3963=_[_0x1be6('0x4f')]({},_0x4e3963,_0xed4d70[_0x1be6('0x51')]);return _0x124f0f['getAgents'](_0x4e3963);}})['then'](function(_0x27f620){if(_0x27f620){_0x123d61=_0x27f620[_0x1be6('0x47')];if(!_0xed4d70[_0x1be6('0x43')][_0x1be6('0x48')](_0x1be6('0x49'))){_0x4e3963['limit']=qs[_0x1be6('0x2f')](_0xed4d70['query'][_0x1be6('0x2f')]);_0x4e3963[_0x1be6('0x2e')]=qs[_0x1be6('0x2e')](_0xed4d70[_0x1be6('0x43')][_0x1be6('0x2e')]);}return _0x124f0f[_0x1be6('0xe1')](_0x4e3963);}})[_0x1be6('0x1f')](function(_0x529661){if(_0x529661){return _0x529661?{'count':_0x123d61,'rows':_0x529661}:null;}})[_0x1be6('0x1f')](respondWithResult(_0x3c38ce,null))['catch'](handleError(_0x3c38ce,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3767ae3..edc66f6 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 _0xf62a=['remove','emit','hasOwnProperty','hook','exports','SmsAccount','save'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0xf62a,0x116));var _0xaf62=function(_0x11fa6d,_0x2aba36){_0x11fa6d=_0x11fa6d-0x0;var _0x503048=_0xf62a[_0x11fa6d];return _0x503048;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0xaf62('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf62('0x1'),'afterUpdate':'update','afterDestroy':_0xaf62('0x2')};function emitEvent(_0x1f749b){return function(_0x5c7450,_0x4681ac,_0x46b9c3){SmsAccountEvents[_0xaf62('0x3')](_0x1f749b+':'+_0x5c7450['id'],_0x5c7450);SmsAccountEvents[_0xaf62('0x3')](_0x1f749b,_0x5c7450);_0x46b9c3(null);};}for(var e in events){if(events[_0xaf62('0x4')](e)){var event=events[e];SmsAccount[_0xaf62('0x5')](e,emitEvent(event));}}module[_0xaf62('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xc3e7=['SmsAccount','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0xc3e7,0x1de));var _0x7c3e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xc3e7[_0x187ee1];return _0x388160;};'use strict';var EventEmitter=require(_0x7c3e('0x0'));var SmsAccount=require(_0x7c3e('0x1'))['db'][_0x7c3e('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c3e('0x3'),'afterDestroy':_0x7c3e('0x4')};function emitEvent(_0x262246){return function(_0x4cb17b,_0xb3d031,_0x305d6f){SmsAccountEvents['emit'](_0x262246+':'+_0x4cb17b['id'],_0x4cb17b);SmsAccountEvents['emit'](_0x262246,_0x4cb17b);_0x305d6f(null);};}for(var e in events){if(events[_0x7c3e('0x5')](e)){var event=events[e];SmsAccount[_0x7c3e('0x6')](e,emitEvent(event));}}module[_0x7c3e('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 713f08c..4611cdb 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 _0x606b=['define','SmsAccount','sms_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x606b,0xc3));var _0xb606=function(_0x1d2986,_0x40f595){_0x1d2986=_0x1d2986-0x0;var _0x5a272b=_0x606b[_0x1d2986];return _0x5a272b;};'use strict';var _=require(_0xb606('0x0'));var util=require('util');var logger=require(_0xb606('0x1'))('api');var moment=require(_0xb606('0x2'));var BPromise=require(_0xb606('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb606('0x4'));var rimraf=require(_0xb606('0x5'));var config=require(_0xb606('0x6'));var attributes=require(_0xb606('0x7'));module[_0xb606('0x8')]=function(_0x2062f0,_0x135730){return _0x2062f0[_0xb606('0x9')](_0xb606('0xa'),attributes,{'tableName':_0xb606('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x436c=['path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','api','bluebird'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x436c,0x151));var _0xc436=function(_0x400b29,_0x15c287){_0x400b29=_0x400b29-0x0;var _0x553d8d=_0x436c[_0x400b29];return _0x553d8d;};'use strict';var _=require(_0xc436('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc436('0x1'));var moment=require('moment');var BPromise=require(_0xc436('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc436('0x3'));var rimraf=require(_0xc436('0x4'));var config=require('../../config/environment');var attributes=require(_0xc436('0x5'));module[_0xc436('0x6')]=function(_0x57f1a6,_0x26a8eb){return _0x57f1a6[_0xc436('0x7')](_0xc436('0x8'),attributes,{'tableName':_0xc436('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 5944872..abc965c 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 _0x1f68=['map','model','attributes','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./smsAccount.socket','register','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount,\x20%s,\x20%s','catch','ShowSmsAccount','SmsAccount','find','options','where','include'];(function(_0x3849e6,_0x540408){var _0x42f017=function(_0x4972c5){while(--_0x4972c5){_0x3849e6['push'](_0x3849e6['shift']());}};_0x42f017(++_0x540408);}(_0x1f68,0xf2));var _0x81f6=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1f68[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x81f6('0x0'));var util=require(_0x81f6('0x1'));var moment=require('moment');var BPromise=require(_0x81f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81f6('0x3'));var db=require(_0x81f6('0x4'))['db'];var utils=require(_0x81f6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x81f6('0x6'));var jayson=require(_0x81f6('0x7'));var client=jayson[_0x81f6('0x8')][_0x81f6('0x9')]({'port':0x232a});config[_0x81f6('0xa')]=_[_0x81f6('0xb')](config[_0x81f6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x81f6('0xa')]));require(_0x81f6('0xc'))[_0x81f6('0xd')](socket);function respondWithRpcPromise(_0x5ecd8e,_0x12caa4,_0x171f2c){return new BPromise(function(_0x247b87,_0x32ed2c){return client[_0x81f6('0xe')](_0x5ecd8e,_0x171f2c)[_0x81f6('0xf')](function(_0x3a11e6){logger[_0x81f6('0x10')]('SmsAccount,\x20%s,\x20%s',_0x12caa4,_0x81f6('0x11'));logger['debug'](_0x81f6('0x12'),_0x12caa4,_0x81f6('0x11'),JSON[_0x81f6('0x13')](_0x3a11e6));if(_0x3a11e6[_0x81f6('0x14')]){if(_0x3a11e6['error']['code']===0x1f4){logger[_0x81f6('0x14')]('SmsAccount,\x20%s,\x20%s',_0x12caa4,_0x3a11e6['error'][_0x81f6('0x15')]);return _0x32ed2c(_0x3a11e6[_0x81f6('0x14')]['message']);}logger['error'](_0x81f6('0x16'),_0x12caa4,_0x3a11e6['error'][_0x81f6('0x15')]);return _0x247b87(_0x3a11e6[_0x81f6('0x14')][_0x81f6('0x15')]);}else{logger[_0x81f6('0x10')](_0x81f6('0x16'),_0x12caa4,'request\x20sent');_0x247b87(_0x3a11e6['result'][_0x81f6('0x15')]);}})[_0x81f6('0x17')](function(_0x428b56){logger[_0x81f6('0x14')](_0x81f6('0x16'),_0x12caa4,_0x428b56);_0x32ed2c(_0x428b56);});});}exports[_0x81f6('0x18')]=function(_0x1f4bfa){var _0x8177a7=this;return new Promise(function(_0xa3cc06,_0x2ee334){return db[_0x81f6('0x19')][_0x81f6('0x1a')]({'raw':_0x1f4bfa[_0x81f6('0x1b')]?_0x1f4bfa['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f4bfa[_0x81f6('0x1b')]?_0x1f4bfa['options'][_0x81f6('0x1c')]||null:null,'attributes':_0x1f4bfa[_0x81f6('0x1b')]?_0x1f4bfa[_0x81f6('0x1b')]['attributes']||null:null,'include':_0x1f4bfa[_0x81f6('0x1b')]?_0x1f4bfa[_0x81f6('0x1b')][_0x81f6('0x1d')]?_[_0x81f6('0x1e')](_0x1f4bfa[_0x81f6('0x1b')]['include'],function(_0x11a998){return{'model':db[_0x11a998[_0x81f6('0x1f')]],'as':_0x11a998['as'],'attributes':_0x11a998['attributes'],'include':_0x11a998['include']?_['map'](_0x11a998[_0x81f6('0x1d')],function(_0x3fd797){return{'model':db[_0x3fd797['model']],'as':_0x3fd797['as'],'attributes':_0x3fd797['attributes'],'include':_0x3fd797[_0x81f6('0x1d')]?_[_0x81f6('0x1e')](_0x3fd797[_0x81f6('0x1d')],function(_0x727907){return{'model':db[_0x727907[_0x81f6('0x1f')]],'as':_0x727907['as'],'attributes':_0x727907[_0x81f6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x81f6('0xf')](function(_0x49f5ac){logger[_0x81f6('0x10')](_0x81f6('0x18'),_0x1f4bfa);logger[_0x81f6('0x21')](_0x81f6('0x18'),_0x1f4bfa,JSON[_0x81f6('0x13')](_0x49f5ac));_0xa3cc06(_0x49f5ac);})[_0x81f6('0x17')](function(_0x4ca60b){logger[_0x81f6('0x14')]('ShowSmsAccount',_0x4ca60b[_0x81f6('0x15')],_0x1f4bfa);_0x2ee334(_0x8177a7['error'](0x1f4,_0x4ca60b[_0x81f6('0x15')]));});});}; \ No newline at end of file +var _0xd9a0=['attributes','map','include','model','ShowSmsAccount','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsAccount','find','options','raw','where'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xd9a0,0xdf));var _0x0d9a=function(_0x5dd7ff,_0x513663){_0x5dd7ff=_0x5dd7ff-0x0;var _0xa5d617=_0xd9a0[_0x5dd7ff];return _0xa5d617;};'use strict';var _=require(_0x0d9a('0x0'));var util=require(_0x0d9a('0x1'));var moment=require(_0x0d9a('0x2'));var BPromise=require(_0x0d9a('0x3'));var rs=require(_0x0d9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d9a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d9a('0x6'))(_0x0d9a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d9a('0x8')][_0x0d9a('0x9')]({'port':0x232a});config[_0x0d9a('0xa')]=_['defaults'](config[_0x0d9a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d9a('0xb'))(new Redis(config['redis']));require(_0x0d9a('0xc'))[_0x0d9a('0xd')](socket);function respondWithRpcPromise(_0x4ee9a0,_0x477422,_0x1610c9){return new BPromise(function(_0x14e170,_0x1ddd11){return client['request'](_0x4ee9a0,_0x1610c9)[_0x0d9a('0xe')](function(_0x3f8cf8){logger[_0x0d9a('0xf')](_0x0d9a('0x10'),_0x477422,_0x0d9a('0x11'));logger['debug'](_0x0d9a('0x12'),_0x477422,_0x0d9a('0x11'),JSON['stringify'](_0x3f8cf8));if(_0x3f8cf8[_0x0d9a('0x13')]){if(_0x3f8cf8['error'][_0x0d9a('0x14')]===0x1f4){logger[_0x0d9a('0x13')](_0x0d9a('0x10'),_0x477422,_0x3f8cf8[_0x0d9a('0x13')][_0x0d9a('0x15')]);return _0x1ddd11(_0x3f8cf8[_0x0d9a('0x13')][_0x0d9a('0x15')]);}logger[_0x0d9a('0x13')](_0x0d9a('0x10'),_0x477422,_0x3f8cf8[_0x0d9a('0x13')][_0x0d9a('0x15')]);return _0x14e170(_0x3f8cf8[_0x0d9a('0x13')][_0x0d9a('0x15')]);}else{logger[_0x0d9a('0xf')]('SmsAccount,\x20%s,\x20%s',_0x477422,_0x0d9a('0x11'));_0x14e170(_0x3f8cf8[_0x0d9a('0x16')][_0x0d9a('0x15')]);}})[_0x0d9a('0x17')](function(_0x379d10){logger[_0x0d9a('0x13')](_0x0d9a('0x10'),_0x477422,_0x379d10);_0x1ddd11(_0x379d10);});});}exports['ShowSmsAccount']=function(_0x3d72cc){var _0x21a572=this;return new Promise(function(_0x500ef9,_0x55b0e6){return db[_0x0d9a('0x18')][_0x0d9a('0x19')]({'raw':_0x3d72cc['options']?_0x3d72cc[_0x0d9a('0x1a')][_0x0d9a('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d72cc[_0x0d9a('0x1a')]?_0x3d72cc['options'][_0x0d9a('0x1c')]||null:null,'attributes':_0x3d72cc['options']?_0x3d72cc[_0x0d9a('0x1a')][_0x0d9a('0x1d')]||null:null,'include':_0x3d72cc[_0x0d9a('0x1a')]?_0x3d72cc['options']['include']?_[_0x0d9a('0x1e')](_0x3d72cc['options'][_0x0d9a('0x1f')],function(_0x1e1dae){return{'model':db[_0x1e1dae[_0x0d9a('0x20')]],'as':_0x1e1dae['as'],'attributes':_0x1e1dae[_0x0d9a('0x1d')],'include':_0x1e1dae[_0x0d9a('0x1f')]?_[_0x0d9a('0x1e')](_0x1e1dae[_0x0d9a('0x1f')],function(_0x428bed){return{'model':db[_0x428bed[_0x0d9a('0x20')]],'as':_0x428bed['as'],'attributes':_0x428bed[_0x0d9a('0x1d')],'include':_0x428bed['include']?_['map'](_0x428bed[_0x0d9a('0x1f')],function(_0x3cdb9c){return{'model':db[_0x3cdb9c[_0x0d9a('0x20')]],'as':_0x3cdb9c['as'],'attributes':_0x3cdb9c[_0x0d9a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0d9a('0xe')](function(_0x5e01ad){logger[_0x0d9a('0xf')](_0x0d9a('0x21'),_0x3d72cc);logger[_0x0d9a('0x22')](_0x0d9a('0x21'),_0x3d72cc,JSON[_0x0d9a('0x23')](_0x5e01ad));_0x500ef9(_0x5e01ad);})[_0x0d9a('0x17')](function(_0x54c6ca){logger[_0x0d9a('0x13')](_0x0d9a('0x21'),_0x54c6ca[_0x0d9a('0x15')],_0x3d72cc);_0x55b0e6(_0x21a572[_0x0d9a('0x13')](0x1f4,_0x54c6ca[_0x0d9a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 1ef3741..c975e44 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 bd4c179..52130f7 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x5bb341,_0x4bf271){var _0x26f3e5=function(_0x1b35ed){while(--_0x1b35ed){_0x5bb341['push'](_0x5bb341['shift']());}};_0x26f3e5(++_0x4bf271);}(_0x008c,0x188));var _0xc008=function(_0x1165ff,_0x375a85){_0x1165ff=_0x1165ff-0x0;var _0x169b79=_0x008c[_0x1165ff];return _0x169b79;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x54478d,_0x119ad0){var _0x51ceb8=function(_0x7a1b19){while(--_0x7a1b19){_0x54478d['push'](_0x54478d['shift']());}};_0x51ceb8(++_0x119ad0);}(_0x3e74,0x175));var _0x43e7=function(_0x1afa10,_0x3ebc12){_0x1afa10=_0x1afa10-0x0;var _0x31d07b=_0x3e74[_0x1afa10];return _0x31d07b;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b103aed..a4a3fb6 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 _0x595d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0x595d,0x1a8));var _0xd595=function(_0x30faee,_0x1c3794){_0x30faee=_0x30faee-0x0;var _0x3a90ab=_0x595d[_0x30faee];return _0x3a90ab;};'use strict';var Sequelize=require(_0xd595('0x0'));module[_0xd595('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd595('0x2')],'allowNull':![],'defaultValue':_0xd595('0x3')},'appdata':{'type':Sequelize[_0xd595('0x4')]()},'description':{'type':Sequelize[_0xd595('0x2')]},'interval':{'type':Sequelize[_0xd595('0x2')],'defaultValue':_0xd595('0x5')}}; \ No newline at end of file +var _0x7ab6=['exports','TEXT','STRING','*,*,*,*'];(function(_0x214d3c,_0x36ec63){var _0x3ee658=function(_0x1cfeb2){while(--_0x1cfeb2){_0x214d3c['push'](_0x214d3c['shift']());}};_0x3ee658(++_0x36ec63);}(_0x7ab6,0xb8));var _0x67ab=function(_0x22e9e2,_0x2fccc3){_0x22e9e2=_0x22e9e2-0x0;var _0x8d7925=_0x7ab6[_0x22e9e2];return _0x8d7925;};'use strict';var Sequelize=require('sequelize');module[_0x67ab('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x67ab('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x67ab('0x2')],'defaultValue':_0x67ab('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index caeeec6..6763be8 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 _0x8dc8=['mustache','util','path','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/utils','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x8dc8,0x8e));var _0x88dc=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8dc8[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x88dc('0x0'));var rimraf=require(_0x88dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88dc('0x2'));var rp=require(_0x88dc('0x3'));var moment=require(_0x88dc('0x4'));var BPromise=require(_0x88dc('0x5'));var Mustache=require(_0x88dc('0x6'));var util=require(_0x88dc('0x7'));var path=require(_0x88dc('0x8'));var sox=require(_0x88dc('0x9'));var csv=require(_0x88dc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x88dc('0xb'));var _=require(_0x88dc('0xc'));var squel=require(_0x88dc('0xd'));var crypto=require('crypto');var jsforce=require(_0x88dc('0xe'));var deskjs=require(_0x88dc('0xf'));var toCsv=require(_0x88dc('0xa'));var querystring=require(_0x88dc('0x10'));var Papa=require(_0x88dc('0x11'));var Redis=require(_0x88dc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x88dc('0x13'));var as=require(_0x88dc('0x14'));var hardwareService=require(_0x88dc('0x15'));var logger=require(_0x88dc('0x16'))(_0x88dc('0x17'));var utils=require(_0x88dc('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x88dc('0x19'))['db'];function respondWithStatusCode(_0x1a7192,_0x5b0ad3){_0x5b0ad3=_0x5b0ad3||0xcc;return function(_0x4f0913){if(_0x4f0913){return _0x1a7192[_0x88dc('0x1a')](_0x5b0ad3);}return _0x1a7192['status'](_0x5b0ad3)[_0x88dc('0x1b')]();};}function respondWithResult(_0x3e5c23,_0x250674){_0x250674=_0x250674||0xc8;return function(_0x5d1e62){if(_0x5d1e62){return _0x3e5c23[_0x88dc('0x1c')](_0x250674)['json'](_0x5d1e62);}};}function respondWithFilteredResult(_0x14037b,_0x218206){return function(_0x19aa0c){if(_0x19aa0c){var _0x3880ea=typeof _0x218206[_0x88dc('0x1d')]===_0x88dc('0x1e')&&typeof _0x218206[_0x88dc('0x1f')]==='undefined';var _0x559f38=_0x19aa0c[_0x88dc('0x20')];var _0x341f5c=_0x3880ea?0x0:_0x218206[_0x88dc('0x1d')];var _0xbc43ba=_0x3880ea?_0x19aa0c[_0x88dc('0x20')]:_0x218206[_0x88dc('0x1d')]+_0x218206['limit'];var _0x35167b;if(_0xbc43ba>=_0x559f38){_0xbc43ba=_0x559f38;_0x35167b=0xc8;}else{_0x35167b=0xce;}_0x14037b[_0x88dc('0x1c')](_0x35167b);return _0x14037b['set'](_0x88dc('0x21'),_0x341f5c+'-'+_0xbc43ba+'/'+_0x559f38)[_0x88dc('0x22')](_0x19aa0c);}return null;};}function patchUpdates(_0x796ca0){return function(_0x3ef567){try{jsonpatch[_0x88dc('0x23')](_0x3ef567,_0x796ca0,!![]);}catch(_0x74f37c){return BPromise[_0x88dc('0x24')](_0x74f37c);}return _0x3ef567[_0x88dc('0x25')]();};}function saveUpdates(_0xb76f65,_0x4e3525){return function(_0x39b935){if(_0x39b935){return _0x39b935[_0x88dc('0x26')](_0xb76f65)[_0x88dc('0x27')](function(_0x58c963){return _0x58c963;});}return null;};}function removeEntity(_0x72edb,_0x14f8bf){return function(_0x13fd7c){if(_0x13fd7c){return _0x13fd7c[_0x88dc('0x28')]()[_0x88dc('0x27')](function(){_0x72edb[_0x88dc('0x1c')](0xcc)[_0x88dc('0x1b')]();});}};}function handleEntityNotFound(_0x4ec523,_0x3b9adb){return function(_0x967158){if(!_0x967158){_0x4ec523[_0x88dc('0x1a')](0x194);}return _0x967158;};}function handleError(_0x3867e2,_0x4517af){_0x4517af=_0x4517af||0x1f4;return function(_0x38e47c){logger[_0x88dc('0x29')](_0x38e47c[_0x88dc('0x2a')]);if(_0x38e47c[_0x88dc('0x2b')]){delete _0x38e47c['name'];}_0x3867e2['status'](_0x4517af)[_0x88dc('0x2c')](_0x38e47c);};}exports['index']=function(_0x22e25b,_0x5fde8c){var _0xbf06f6={},_0x3cbca5={},_0x583bb9={'count':0x0,'rows':[]};var _0x51011f=_[_0x88dc('0x2d')](db[_0x88dc('0x2e')][_0x88dc('0x2f')],function(_0x7d0e7c){return{'name':_0x7d0e7c[_0x88dc('0x30')],'type':_0x7d0e7c['type'][_0x88dc('0x31')]};});_0x3cbca5[_0x88dc('0x32')]=_[_0x88dc('0x2d')](_0x51011f,_0x88dc('0x2b'));_0x3cbca5[_0x88dc('0x33')]=_[_0x88dc('0x34')](_0x22e25b[_0x88dc('0x33')]);_0x3cbca5[_0x88dc('0x35')]=_[_0x88dc('0x36')](_0x3cbca5[_0x88dc('0x32')],_0x3cbca5[_0x88dc('0x33')]);_0xbf06f6[_0x88dc('0x37')]=_[_0x88dc('0x36')](_0x3cbca5[_0x88dc('0x32')],qs[_0x88dc('0x38')](_0x22e25b[_0x88dc('0x33')][_0x88dc('0x38')]));_0xbf06f6[_0x88dc('0x37')]=_0xbf06f6[_0x88dc('0x37')][_0x88dc('0x39')]?_0xbf06f6[_0x88dc('0x37')]:_0x3cbca5['model'];if(!_0x22e25b[_0x88dc('0x33')]['hasOwnProperty'](_0x88dc('0x3a'))){_0xbf06f6[_0x88dc('0x1f')]=qs[_0x88dc('0x1f')](_0x22e25b['query']['limit']);_0xbf06f6['offset']=qs[_0x88dc('0x1d')](_0x22e25b[_0x88dc('0x33')][_0x88dc('0x1d')]);}_0xbf06f6['order']=qs['sort'](_0x22e25b[_0x88dc('0x33')][_0x88dc('0x3b')]);_0xbf06f6[_0x88dc('0x3c')]=qs['filters'](_[_0x88dc('0x3d')](_0x22e25b[_0x88dc('0x33')],_0x3cbca5[_0x88dc('0x35')]),_0x51011f);if(_0x22e25b[_0x88dc('0x33')][_0x88dc('0x3e')]){_0xbf06f6['where']=_['merge'](_0xbf06f6[_0x88dc('0x3c')],{'$or':_[_0x88dc('0x2d')](_0x51011f,function(_0x3db8fa){if(_0x3db8fa[_0x88dc('0x3f')]!=='VIRTUAL'){var _0x55c442={};_0x55c442[_0x3db8fa[_0x88dc('0x2b')]]={'$like':'%'+_0x22e25b[_0x88dc('0x33')][_0x88dc('0x3e')]+'%'};return _0x55c442;}})});}_0xbf06f6=_['merge']({},_0xbf06f6,_0x22e25b[_0x88dc('0x40')]);var _0x538b83={'where':_0xbf06f6['where']};return db[_0x88dc('0x2e')]['count'](_0x538b83)[_0x88dc('0x27')](function(_0x2d3d7a){_0x583bb9['count']=_0x2d3d7a;if(_0x22e25b['query'][_0x88dc('0x41')]){_0xbf06f6['include']=[{'all':!![]}];}return db[_0x88dc('0x2e')][_0x88dc('0x42')](_0xbf06f6);})[_0x88dc('0x27')](function(_0x56a14a){_0x583bb9[_0x88dc('0x43')]=_0x56a14a;return _0x583bb9;})[_0x88dc('0x27')](respondWithFilteredResult(_0x5fde8c,_0xbf06f6))[_0x88dc('0x44')](handleError(_0x5fde8c,null));};exports[_0x88dc('0x45')]=function(_0x3be2d5,_0x191e3a){var _0x33b40f={'raw':!![],'where':{'id':_0x3be2d5[_0x88dc('0x46')]['id']}},_0x582fae={};_0x582fae['model']=_[_0x88dc('0x34')](db[_0x88dc('0x2e')][_0x88dc('0x2f')]);_0x582fae[_0x88dc('0x33')]=_[_0x88dc('0x34')](_0x3be2d5['query']);_0x582fae[_0x88dc('0x35')]=_[_0x88dc('0x36')](_0x582fae[_0x88dc('0x32')],_0x582fae[_0x88dc('0x33')]);_0x33b40f[_0x88dc('0x37')]=_['intersection'](_0x582fae['model'],qs[_0x88dc('0x38')](_0x3be2d5['query']['fields']));_0x33b40f[_0x88dc('0x37')]=_0x33b40f['attributes'][_0x88dc('0x39')]?_0x33b40f[_0x88dc('0x37')]:_0x582fae[_0x88dc('0x32')];if(_0x3be2d5[_0x88dc('0x33')]['includeAll']){_0x33b40f['include']=[{'all':!![]}];}_0x33b40f=_['merge']({},_0x33b40f,_0x3be2d5['options']);return db[_0x88dc('0x2e')][_0x88dc('0x47')](_0x33b40f)['then'](handleEntityNotFound(_0x191e3a,null))[_0x88dc('0x27')](respondWithResult(_0x191e3a,null))['catch'](handleError(_0x191e3a,null));};exports[_0x88dc('0x48')]=function(_0x34fa3e,_0x1e76f7){return db[_0x88dc('0x2e')]['create'](_0x34fa3e[_0x88dc('0x49')],{})['then'](respondWithResult(_0x1e76f7,0xc9))[_0x88dc('0x44')](handleError(_0x1e76f7,null));};exports['update']=function(_0x4f3f32,_0x114896){if(_0x4f3f32['body']['id']){delete _0x4f3f32['body']['id'];}return db[_0x88dc('0x2e')][_0x88dc('0x47')]({'where':{'id':_0x4f3f32[_0x88dc('0x46')]['id']}})[_0x88dc('0x27')](handleEntityNotFound(_0x114896,null))[_0x88dc('0x27')](saveUpdates(_0x4f3f32['body'],null))[_0x88dc('0x27')](respondWithResult(_0x114896,null))[_0x88dc('0x44')](handleError(_0x114896,null));};exports[_0x88dc('0x28')]=function(_0x4b10d2,_0xc5c2f8){return db[_0x88dc('0x2e')][_0x88dc('0x47')]({'where':{'id':_0x4b10d2['params']['id']}})[_0x88dc('0x27')](handleEntityNotFound(_0xc5c2f8,null))[_0x88dc('0x27')](removeEntity(_0xc5c2f8,null))[_0x88dc('0x44')](handleError(_0xc5c2f8,null));}; \ No newline at end of file +var _0x0a34=['reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsApplication','includeAll','rows','show','params','catch','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x5aa77c,_0x42c60b){var _0x579eb4=function(_0x31f3a2){while(--_0x31f3a2){_0x5aa77c['push'](_0x5aa77c['shift']());}};_0x579eb4(++_0x42c60b);}(_0x0a34,0x113));var _0x40a3=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x0a34[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x40a3('0x0'));var rimraf=require(_0x40a3('0x1'));var zipdir=require(_0x40a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40a3('0x3'));var moment=require(_0x40a3('0x4'));var BPromise=require(_0x40a3('0x5'));var Mustache=require(_0x40a3('0x6'));var util=require(_0x40a3('0x7'));var path=require(_0x40a3('0x8'));var sox=require('sox');var csv=require(_0x40a3('0x9'));var ejs=require(_0x40a3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40a3('0xb'));var squel=require(_0x40a3('0xc'));var crypto=require(_0x40a3('0xd'));var jsforce=require(_0x40a3('0xe'));var deskjs=require(_0x40a3('0xf'));var toCsv=require(_0x40a3('0x9'));var querystring=require(_0x40a3('0x10'));var Papa=require(_0x40a3('0x11'));var Redis=require(_0x40a3('0x12'));var authService=require(_0x40a3('0x13'));var qs=require(_0x40a3('0x14'));var as=require(_0x40a3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40a3('0x16'))(_0x40a3('0x17'));var utils=require(_0x40a3('0x18'));var config=require(_0x40a3('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x40a3('0x1a'))['db'];function respondWithStatusCode(_0x3f0b10,_0x33c014){_0x33c014=_0x33c014||0xcc;return function(_0x45fa6f){if(_0x45fa6f){return _0x3f0b10[_0x40a3('0x1b')](_0x33c014);}return _0x3f0b10[_0x40a3('0x1c')](_0x33c014)[_0x40a3('0x1d')]();};}function respondWithResult(_0x1ff59f,_0x3e84dc){_0x3e84dc=_0x3e84dc||0xc8;return function(_0x14d539){if(_0x14d539){return _0x1ff59f[_0x40a3('0x1c')](_0x3e84dc)[_0x40a3('0x1e')](_0x14d539);}};}function respondWithFilteredResult(_0x346bb3,_0x33caa9){return function(_0x207de1){if(_0x207de1){var _0x44c824=typeof _0x33caa9[_0x40a3('0x1f')]===_0x40a3('0x20')&&typeof _0x33caa9[_0x40a3('0x21')]===_0x40a3('0x20');var _0x157cfb=_0x207de1[_0x40a3('0x22')];var _0x5ae5a0=_0x44c824?0x0:_0x33caa9[_0x40a3('0x1f')];var _0x1cef0b=_0x44c824?_0x207de1[_0x40a3('0x22')]:_0x33caa9[_0x40a3('0x1f')]+_0x33caa9['limit'];var _0x2701fe;if(_0x1cef0b>=_0x157cfb){_0x1cef0b=_0x157cfb;_0x2701fe=0xc8;}else{_0x2701fe=0xce;}_0x346bb3['status'](_0x2701fe);return _0x346bb3[_0x40a3('0x23')](_0x40a3('0x24'),_0x5ae5a0+'-'+_0x1cef0b+'/'+_0x157cfb)[_0x40a3('0x1e')](_0x207de1);}return null;};}function patchUpdates(_0x563e33){return function(_0x41b747){try{jsonpatch['apply'](_0x41b747,_0x563e33,!![]);}catch(_0x19fd05){return BPromise[_0x40a3('0x25')](_0x19fd05);}return _0x41b747[_0x40a3('0x26')]();};}function saveUpdates(_0x24cf1b,_0x3b07bb){return function(_0x575ff3){if(_0x575ff3){return _0x575ff3[_0x40a3('0x27')](_0x24cf1b)[_0x40a3('0x28')](function(_0x431a93){return _0x431a93;});}return null;};}function removeEntity(_0x1ebefb,_0x1723b8){return function(_0x170d02){if(_0x170d02){return _0x170d02[_0x40a3('0x29')]()[_0x40a3('0x28')](function(){_0x1ebefb[_0x40a3('0x1c')](0xcc)[_0x40a3('0x1d')]();});}};}function handleEntityNotFound(_0x57d7ce,_0x94ed42){return function(_0x2df168){if(!_0x2df168){_0x57d7ce[_0x40a3('0x1b')](0x194);}return _0x2df168;};}function handleError(_0x11ae8c,_0x47c78f){_0x47c78f=_0x47c78f||0x1f4;return function(_0x351b4b){logger[_0x40a3('0x2a')](_0x351b4b[_0x40a3('0x2b')]);if(_0x351b4b[_0x40a3('0x2c')]){delete _0x351b4b['name'];}_0x11ae8c[_0x40a3('0x1c')](_0x47c78f)[_0x40a3('0x2d')](_0x351b4b);};}exports[_0x40a3('0x2e')]=function(_0x5417c8,_0x2dc3ae){var _0x2eb66e={},_0x4ca358={},_0x5866ee={'count':0x0,'rows':[]};var _0x2f4639=_[_0x40a3('0x2f')](db['SmsApplication'][_0x40a3('0x30')],function(_0x534120){return{'name':_0x534120[_0x40a3('0x31')],'type':_0x534120[_0x40a3('0x32')][_0x40a3('0x33')]};});_0x4ca358[_0x40a3('0x34')]=_[_0x40a3('0x2f')](_0x2f4639,_0x40a3('0x2c'));_0x4ca358[_0x40a3('0x35')]=_[_0x40a3('0x36')](_0x5417c8[_0x40a3('0x35')]);_0x4ca358[_0x40a3('0x37')]=_['intersection'](_0x4ca358['model'],_0x4ca358[_0x40a3('0x35')]);_0x2eb66e['attributes']=_[_0x40a3('0x38')](_0x4ca358['model'],qs[_0x40a3('0x39')](_0x5417c8['query']['fields']));_0x2eb66e['attributes']=_0x2eb66e['attributes'][_0x40a3('0x3a')]?_0x2eb66e[_0x40a3('0x3b')]:_0x4ca358[_0x40a3('0x34')];if(!_0x5417c8['query'][_0x40a3('0x3c')](_0x40a3('0x3d'))){_0x2eb66e['limit']=qs[_0x40a3('0x21')](_0x5417c8['query'][_0x40a3('0x21')]);_0x2eb66e['offset']=qs[_0x40a3('0x1f')](_0x5417c8[_0x40a3('0x35')]['offset']);}_0x2eb66e[_0x40a3('0x3e')]=qs[_0x40a3('0x3f')](_0x5417c8[_0x40a3('0x35')][_0x40a3('0x3f')]);_0x2eb66e[_0x40a3('0x40')]=qs[_0x40a3('0x37')](_[_0x40a3('0x41')](_0x5417c8[_0x40a3('0x35')],_0x4ca358[_0x40a3('0x37')]),_0x2f4639);if(_0x5417c8['query'][_0x40a3('0x42')]){_0x2eb66e[_0x40a3('0x40')]=_[_0x40a3('0x43')](_0x2eb66e['where'],{'$or':_['map'](_0x2f4639,function(_0x23bb47){if(_0x23bb47[_0x40a3('0x32')]!==_0x40a3('0x44')){var _0x51a16a={};_0x51a16a[_0x23bb47[_0x40a3('0x2c')]]={'$like':'%'+_0x5417c8['query'][_0x40a3('0x42')]+'%'};return _0x51a16a;}})});}_0x2eb66e=_['merge']({},_0x2eb66e,_0x5417c8[_0x40a3('0x45')]);var _0x1c1a66={'where':_0x2eb66e['where']};return db[_0x40a3('0x46')][_0x40a3('0x22')](_0x1c1a66)[_0x40a3('0x28')](function(_0x23edec){_0x5866ee[_0x40a3('0x22')]=_0x23edec;if(_0x5417c8[_0x40a3('0x35')][_0x40a3('0x47')]){_0x2eb66e['include']=[{'all':!![]}];}return db[_0x40a3('0x46')]['findAll'](_0x2eb66e);})[_0x40a3('0x28')](function(_0x526d6f){_0x5866ee[_0x40a3('0x48')]=_0x526d6f;return _0x5866ee;})[_0x40a3('0x28')](respondWithFilteredResult(_0x2dc3ae,_0x2eb66e))['catch'](handleError(_0x2dc3ae,null));};exports[_0x40a3('0x49')]=function(_0xdf20f4,_0x1b7aba){var _0x22ad37={'raw':!![],'where':{'id':_0xdf20f4[_0x40a3('0x4a')]['id']}},_0x375cfe={};_0x375cfe[_0x40a3('0x34')]=_[_0x40a3('0x36')](db[_0x40a3('0x46')]['rawAttributes']);_0x375cfe[_0x40a3('0x35')]=_[_0x40a3('0x36')](_0xdf20f4[_0x40a3('0x35')]);_0x375cfe['filters']=_[_0x40a3('0x38')](_0x375cfe['model'],_0x375cfe[_0x40a3('0x35')]);_0x22ad37[_0x40a3('0x3b')]=_[_0x40a3('0x38')](_0x375cfe[_0x40a3('0x34')],qs[_0x40a3('0x39')](_0xdf20f4[_0x40a3('0x35')]['fields']));_0x22ad37[_0x40a3('0x3b')]=_0x22ad37[_0x40a3('0x3b')][_0x40a3('0x3a')]?_0x22ad37['attributes']:_0x375cfe[_0x40a3('0x34')];if(_0xdf20f4[_0x40a3('0x35')][_0x40a3('0x47')]){_0x22ad37['include']=[{'all':!![]}];}_0x22ad37=_[_0x40a3('0x43')]({},_0x22ad37,_0xdf20f4[_0x40a3('0x45')]);return db['SmsApplication']['find'](_0x22ad37)['then'](handleEntityNotFound(_0x1b7aba,null))[_0x40a3('0x28')](respondWithResult(_0x1b7aba,null))[_0x40a3('0x4b')](handleError(_0x1b7aba,null));};exports['create']=function(_0x283bef,_0x5c3789){return db['SmsApplication']['create'](_0x283bef[_0x40a3('0x4c')],{})[_0x40a3('0x28')](respondWithResult(_0x5c3789,0xc9))[_0x40a3('0x4b')](handleError(_0x5c3789,null));};exports[_0x40a3('0x27')]=function(_0xf20650,_0x7da239){if(_0xf20650['body']['id']){delete _0xf20650[_0x40a3('0x4c')]['id'];}return db[_0x40a3('0x46')][_0x40a3('0x4d')]({'where':{'id':_0xf20650[_0x40a3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7da239,null))[_0x40a3('0x28')](saveUpdates(_0xf20650[_0x40a3('0x4c')],null))[_0x40a3('0x28')](respondWithResult(_0x7da239,null))['catch'](handleError(_0x7da239,null));};exports[_0x40a3('0x29')]=function(_0x35549a,_0xa378fe){return db['SmsApplication'][_0x40a3('0x4d')]({'where':{'id':_0x35549a['params']['id']}})[_0x40a3('0x28')](handleEntityNotFound(_0xa378fe,null))[_0x40a3('0x28')](removeEntity(_0xa378fe,null))[_0x40a3('0x4b')](handleError(_0xa378fe,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0f29f84..24a84d1 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 _0xb733=['sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x669d6d,_0x5a5a02){var _0x3cb975=function(_0x7f00ea){while(--_0x7f00ea){_0x669d6d['push'](_0x669d6d['shift']());}};_0x3cb975(++_0x5a5a02);}(_0xb733,0xab));var _0x3b73=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb733[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x3b73('0x0'));var util=require('util');var logger=require(_0x3b73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3b73('0x2'));var rp=require(_0x3b73('0x3'));var fs=require('fs');var path=require(_0x3b73('0x4'));var rimraf=require(_0x3b73('0x5'));var config=require(_0x3b73('0x6'));var attributes=require(_0x3b73('0x7'));module[_0x3b73('0x8')]=function(_0x4e445a,_0x26bfa8){return _0x4e445a[_0x3b73('0x9')](_0x3b73('0xa'),attributes,{'tableName':_0x3b73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3b73('0xc')});}; \ No newline at end of file +var _0xdb90=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x3ea820,_0x4ea3b8){var _0x24bce6=function(_0x51805a){while(--_0x51805a){_0x3ea820['push'](_0x3ea820['shift']());}};_0x24bce6(++_0x4ea3b8);}(_0xdb90,0xcb));var _0x0db9=function(_0x8c318b,_0x309481){_0x8c318b=_0x8c318b-0x0;var _0x3c000a=_0xdb90[_0x8c318b];return _0x3c000a;};'use strict';var _=require(_0x0db9('0x0'));var util=require(_0x0db9('0x1'));var logger=require('../../config/logger')(_0x0db9('0x2'));var moment=require(_0x0db9('0x3'));var BPromise=require('bluebird');var rp=require(_0x0db9('0x4'));var fs=require('fs');var path=require(_0x0db9('0x5'));var rimraf=require(_0x0db9('0x6'));var config=require(_0x0db9('0x7'));var attributes=require(_0x0db9('0x8'));module[_0x0db9('0x9')]=function(_0x227647,_0x513a01){return _0x227647[_0x0db9('0xa')](_0x0db9('0xb'),attributes,{'tableName':_0x0db9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0db9('0xd'),'collate':_0x0db9('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 8fa6107..643338b 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 _0xf0f4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4b0ebb,_0x39009a){var _0x31f3c0=function(_0x349ec4){while(--_0x349ec4){_0x4b0ebb['push'](_0x4b0ebb['shift']());}};_0x31f3c0(++_0x39009a);}(_0xf0f4,0x182));var _0x4f0f=function(_0x19dffc,_0x4d9a91){_0x19dffc=_0x19dffc-0x0;var _0x21294c=_0xf0f4[_0x19dffc];return _0x21294c;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47faf5,_0x39ad76,_0x1dd6bd){return new BPromise(function(_0x95b1cf,_0x5da92f){return client[_0x4f0f('0xa')](_0x47faf5,_0x1dd6bd)[_0x4f0f('0xb')](function(_0x19cecb){logger[_0x4f0f('0xc')](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));logger[_0x4f0f('0xf')](_0x4f0f('0x10'),_0x39ad76,'request\x20sent',JSON[_0x4f0f('0x11')](_0x19cecb));if(_0x19cecb[_0x4f0f('0x12')]){if(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x13')]===0x1f4){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x5da92f(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}logger[_0x4f0f('0x12')]('SmsApplication,\x20%s,\x20%s',_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x95b1cf(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}else{logger['info'](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));_0x95b1cf(_0x19cecb[_0x4f0f('0x15')][_0x4f0f('0x14')]);}})[_0x4f0f('0x16')](function(_0x5f171b){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x5f171b);_0x5da92f(_0x5f171b);});});} \ No newline at end of file +var _0x86c0=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x86c0,0x133));var _0x086c=function(_0x177275,_0xacee86){_0x177275=_0x177275-0x0;var _0x4a33d0=_0x86c0[_0x177275];return _0x4a33d0;};'use strict';var _=require(_0x086c('0x0'));var util=require('util');var moment=require(_0x086c('0x1'));var BPromise=require(_0x086c('0x2'));var rs=require(_0x086c('0x3'));var fs=require('fs');var Redis=require(_0x086c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x086c('0x5'));var logger=require(_0x086c('0x6'))(_0x086c('0x7'));var config=require(_0x086c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x086c('0x9')][_0x086c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e27a8,_0x387428,_0x117df9){return new BPromise(function(_0x25e437,_0x52b942){return client[_0x086c('0xb')](_0x2e27a8,_0x117df9)[_0x086c('0xc')](function(_0xa1b79a){logger['info']('SmsApplication,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));logger[_0x086c('0xe')](_0x086c('0xf'),_0x387428,_0x086c('0xd'),JSON[_0x086c('0x10')](_0xa1b79a));if(_0xa1b79a['error']){if(_0xa1b79a[_0x086c('0x11')][_0x086c('0x12')]===0x1f4){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error']['message']);return _0x52b942(_0xa1b79a[_0x086c('0x11')]['message']);}logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error'][_0x086c('0x14')]);return _0x25e437(_0xa1b79a[_0x086c('0x11')][_0x086c('0x14')]);}else{logger[_0x086c('0x15')]('SmsApplication,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));_0x25e437(_0xa1b79a[_0x086c('0x16')][_0x086c('0x14')]);}})['catch'](function(_0x34e74f){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0x34e74f);_0x52b942(_0x34e74f);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index b71e008..d0d9d68 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 _0xed3c=['sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x32a449,_0x19b59d){var _0x16860b=function(_0x1510cd){while(--_0x1510cd){_0x32a449['push'](_0x32a449['shift']());}};_0x16860b(++_0x19b59d);}(_0xed3c,0x1a6));var _0xced3=function(_0x85666,_0x403be2){_0x85666=_0x85666-0x0;var _0x233527=_0xed3c[_0x85666];return _0x233527;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xc')]);router[_0xced3('0x8')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router['get'](_0xced3('0xf'),auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);router['post']('/',auth[_0xced3('0x9')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0x13')]);router[_0xced3('0x12')]('/:id/tags',auth[_0xced3('0x9')](),interaction['tracked'](_0xced3('0x14'),_0xced3('0x15')),controller[_0xced3('0x16')]);router[_0xced3('0x17')]('/:id',auth[_0xced3('0x9')](),interaction[_0xced3('0x18')]('sms',_0xced3('0x19')),controller[_0xced3('0x1a')]);router[_0xced3('0x1b')](_0xced3('0x1c'),auth['isAuthenticated'](),interaction[_0xced3('0x18')]('sms',_0xced3('0x1d')),controller[_0xced3('0x1e')]);router[_0xced3('0x1b')](_0xced3('0x1f'),auth[_0xced3('0x9')](),controller[_0xced3('0x20')]);module[_0xced3('0x21')]=router; \ No newline at end of file +var _0xb62e=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x523fee,_0x384a2f){var _0x233784=function(_0x4dceac){while(--_0x4dceac){_0x523fee['push'](_0x523fee['shift']());}};_0x233784(++_0x384a2f);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/describe',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0xc')](_0xeb62('0x11'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x13')]('/',auth[_0xeb62('0xa')](),controller['create']);router[_0xeb62('0x13')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x14')]);router['post'](_0xeb62('0x15'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')]('sms',_0xeb62('0x17')),controller[_0xeb62('0x18')]);router[_0xeb62('0x19')]('/:id',auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1b')),controller[_0xeb62('0x1c')]);router[_0xeb62('0x1d')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1e')),controller[_0xeb62('0x1f')]);router[_0xeb62('0x1d')]('/:id/tags',auth[_0xeb62('0xa')](),controller[_0xeb62('0x20')]);module[_0xeb62('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 685b814..183a75e 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 _0x2d17=['BOOLEAN','DATE','STRING','ENUM','sequelize','moment'];(function(_0x5d1525,_0x22e410){var _0xef73f0=function(_0x122761){while(--_0x122761){_0x5d1525['push'](_0x5d1525['shift']());}};_0xef73f0(++_0x22e410);}(_0x2d17,0x17e));var _0x72d1=function(_0x1ff52b,_0x12906d){_0x1ff52b=_0x1ff52b-0x0;var _0x32c990=_0x2d17[_0x1ff52b];return _0x32c990;};'use strict';var Sequelize=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));module['exports']={'closed':{'type':Sequelize[_0x72d1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x72d1('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x72d1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x72d1('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x72d1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x72d1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72d1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x72d1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x72d1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x535f=['STRING','ENUM','out','moment','exports','DATE'];(function(_0x34efa6,_0x343fe2){var _0x469490=function(_0xc1d725){while(--_0xc1d725){_0x34efa6['push'](_0x34efa6['shift']());}};_0x469490(++_0x343fe2);}(_0x535f,0x111));var _0xf535=function(_0x54e4fd,_0x4059d4){_0x54e4fd=_0x54e4fd-0x0;var _0x50cbb2=_0x535f[_0x54e4fd];return _0x50cbb2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf535('0x0'));module[_0xf535('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf535('0x2')]},'disposition':{'type':Sequelize[_0xf535('0x3')]},'secondDisposition':{'type':Sequelize[_0xf535('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf535('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf535('0x3')]},'read1stAt':{'type':Sequelize[_0xf535('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf535('0x4')]('in',_0xf535('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf535('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf535('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index dd8cd00..b5761e6 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 _0xe59a=['SmsInteractionId','merge','filter','$gte','format','addTags','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','User','fullname','push','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','get','mkdirSync','Sms','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','Contact','value','root','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where'];(function(_0x4d1c7e,_0x12abcd){var _0x2c77b3=function(_0x549bb0){while(--_0x549bb0){_0x4d1c7e['push'](_0x4d1c7e['shift']());}};_0x2c77b3(++_0x12abcd);}(_0xe59a,0x19f));var _0xae59=function(_0x841ff6,_0xb59a97){_0x841ff6=_0x841ff6-0x0;var _0x1be58a=_0xe59a[_0x841ff6];return _0x1be58a;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xae59('0x0'));var BPromise=require('bluebird');var util=require(_0xae59('0x1'));var path=require(_0xae59('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae59('0x3'));var Redis=require(_0xae59('0x4'));var interaction=require(_0xae59('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xae59('0x6'));var logger=require(_0xae59('0x7'))('api');var config=require(_0xae59('0x8'));var db=require(_0xae59('0x9'))['db'];config[_0xae59('0xa')]=_[_0xae59('0xb')](config[_0xae59('0xa')],{'host':_0xae59('0xc'),'port':0x18eb});var socket=require(_0xae59('0xd'))(new Redis(config[_0xae59('0xa')]));require(_0xae59('0xe'))[_0xae59('0xf')](socket);function respondWithStatusCode(_0x1bdcdd,_0x4f70bc){_0x4f70bc=_0x4f70bc||0xcc;return function(_0x3f102d){if(_0x3f102d){return _0x1bdcdd[_0xae59('0x10')](_0x4f70bc);}return _0x1bdcdd['status'](_0x4f70bc)[_0xae59('0x11')]();};}function respondWithResult(_0x2d0cd7,_0x5d7464){_0x5d7464=_0x5d7464||0xc8;return function(_0x35b6ab){if(_0x35b6ab){return _0x2d0cd7['status'](_0x5d7464)[_0xae59('0x12')](_0x35b6ab);}};}function respondWithFilteredResult(_0x175e9e,_0x353206){return function(_0x20627e){if(_0x20627e){var _0x379478=typeof _0x353206['offset']===_0xae59('0x13')&&typeof _0x353206[_0xae59('0x14')]==='undefined';var _0x3d6c4c=_0x20627e[_0xae59('0x15')];var _0x340447=_0x379478?0x0:_0x353206[_0xae59('0x16')];var _0x4f9cde=_0x379478?_0x20627e['count']:_0x353206[_0xae59('0x16')]+_0x353206[_0xae59('0x14')];var _0xd3414;if(_0x4f9cde>=_0x3d6c4c){_0x4f9cde=_0x3d6c4c;_0xd3414=0xc8;}else{_0xd3414=0xce;}_0x175e9e[_0xae59('0x17')](_0xd3414);return _0x175e9e[_0xae59('0x18')]('Content-Range',_0x340447+'-'+_0x4f9cde+'/'+_0x3d6c4c)[_0xae59('0x12')](_0x20627e);}return null;};}function saveUpdates(_0x1afb13){return function(_0x1a3190){if(_0x1a3190){return _0x1a3190[_0xae59('0x19')](_0x1afb13)[_0xae59('0x1a')](function(_0x247fc7){return _0x247fc7;});}return null;};}function removeEntity(_0xe9fa2a){return function(_0x553a49){if(_0x553a49){return _0x553a49[_0xae59('0x1b')]()[_0xae59('0x1a')](function(){_0xe9fa2a[_0xae59('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x401e8d){return function(_0x43617a){if(!_0x43617a){_0x401e8d[_0xae59('0x10')](0x194);}return _0x43617a;};}function handleError(_0x562ea7,_0x395f00){_0x395f00=_0x395f00||0x1f4;return function(_0x2e9a3d){logger[_0xae59('0x1c')](_0x2e9a3d[_0xae59('0x1d')]);if(_0x2e9a3d[_0xae59('0x1e')]){delete _0x2e9a3d[_0xae59('0x1e')];}_0x562ea7[_0xae59('0x17')](_0x395f00)[_0xae59('0x1f')](_0x2e9a3d);};}exports[_0xae59('0x20')]=function(_0x1bf448,_0x45ff31){var _0xcfb97a={};var _0x5501e7=_[_0xae59('0x21')](db[_0xae59('0x22')][_0xae59('0x23')],function(_0x438ba2){return{'name':_0x438ba2[_0xae59('0x24')],'type':_0x438ba2[_0xae59('0x25')]['key']};});_0xcfb97a=qs[_0xae59('0x26')](_0x5501e7,_0x1bf448);return interaction[_0xae59('0x27')](_0xae59('0x28'),_0x1bf448[_0xae59('0x29')],_0x1bf448['user'],_0xcfb97a,_0x5501e7)[_0xae59('0x1a')](respondWithFilteredResult(_0x45ff31,_0xcfb97a))[_0xae59('0x2a')](handleError(_0x45ff31,null));};exports[_0xae59('0x2b')]=function(_0x3127cb,_0xddc205){var _0x32d78b={'raw':![],'where':{'id':_0x3127cb[_0xae59('0x2c')]['id']}},_0x2b56b1={};_0x2b56b1[_0xae59('0x2d')]=_[_0xae59('0x2e')](db[_0xae59('0x22')][_0xae59('0x23')]);_0x2b56b1[_0xae59('0x29')]=_['keys'](_0x3127cb[_0xae59('0x29')]);_0x2b56b1[_0xae59('0x2f')]=_[_0xae59('0x30')](_0x2b56b1[_0xae59('0x2d')],_0x2b56b1[_0xae59('0x29')]);_0x32d78b[_0xae59('0x31')]=_[_0xae59('0x30')](_0x2b56b1[_0xae59('0x2d')],qs[_0xae59('0x32')](_0x3127cb[_0xae59('0x29')]['fields']));_0x32d78b['attributes']=_0x32d78b[_0xae59('0x31')][_0xae59('0x33')]?_0x32d78b[_0xae59('0x31')]:_0x2b56b1['model'];if(_0x3127cb[_0xae59('0x29')][_0xae59('0x34')]){_0x32d78b[_0xae59('0x35')]=[{'all':!![]}];}_0x32d78b=_['merge']({},_0x32d78b,_0x3127cb[_0xae59('0x36')]);return db['SmsInteraction'][_0xae59('0x37')](_0x32d78b)[_0xae59('0x1a')](handleEntityNotFound(_0xddc205,null))[_0xae59('0x1a')](respondWithResult(_0xddc205,null))[_0xae59('0x2a')](handleError(_0xddc205,null));};exports[_0xae59('0x38')]=function(_0x4ce40e,_0x3eea54){return db[_0xae59('0x22')]['create'](_0x4ce40e[_0xae59('0x39')],{})['then'](respondWithResult(_0x3eea54,0xc9))['catch'](handleError(_0x3eea54,null));};exports[_0xae59('0x19')]=function(_0x45eef7,_0x30ddb9){if(_0x45eef7['body']['id']){delete _0x45eef7[_0xae59('0x39')]['id'];}return db[_0xae59('0x22')][_0xae59('0x37')]({'where':{'id':_0x45eef7[_0xae59('0x2c')]['id']}})[_0xae59('0x1a')](handleEntityNotFound(_0x30ddb9,null))[_0xae59('0x1a')](saveUpdates(_0x45eef7[_0xae59('0x39')],null))[_0xae59('0x1a')](respondWithResult(_0x30ddb9,null))[_0xae59('0x2a')](handleError(_0x30ddb9,null));};exports[_0xae59('0x1b')]=function(_0x57a068,_0x3f1e2c){return db[_0xae59('0x22')][_0xae59('0x37')]({'where':{'id':_0x57a068[_0xae59('0x2c')]['id']}})[_0xae59('0x1a')](handleEntityNotFound(_0x3f1e2c,null))['then'](removeEntity(_0x3f1e2c,null))[_0xae59('0x2a')](handleError(_0x3f1e2c,null));};exports[_0xae59('0x3a')]=function(_0x4a997e,_0x5e0640){return db['SmsInteraction'][_0xae59('0x3a')]()[_0xae59('0x1a')](respondWithResult(_0x5e0640,null))[_0xae59('0x2a')](handleError(_0x5e0640,null));};exports[_0xae59('0x3b')]=function(_0x202076,_0x1be213){return db[_0xae59('0x3c')][_0xae59('0x37')]({'where':{'id':_0x202076[_0xae59('0x2c')]['id']}})[_0xae59('0x1a')](handleEntityNotFound(_0x1be213,null))[_0xae59('0x1a')](function(_0xe85616){if(_0xe85616){return _0xe85616[_0xae59('0x3b')](_0x202076['body'][_0xae59('0x3d')],_[_0xae59('0x3e')](_0x202076['body'],[_0xae59('0x3d'),'id'])||{});}})[_0xae59('0x1a')](respondWithResult(_0x1be213,null))[_0xae59('0x2a')](handleError(_0x1be213,null));};exports[_0xae59('0x3f')]=function(_0x3c9c15,_0x396b37){var _0xcda9b3={'raw':![],'where':{}};var _0x47200e={};var _0xd6d2b2={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xae59('0x40')]({'where':{'id':_0x3c9c15['params']['id']}})['then'](handleEntityNotFound(_0x396b37,null))[_0xae59('0x1a')](function(_0x447a30){if(_0x447a30){_0x47200e[_0xae59('0x2d')]=_[_0xae59('0x2e')](db[_0xae59('0x3c')]['rawAttributes']);_0x47200e['query']=_[_0xae59('0x2e')](_0x3c9c15[_0xae59('0x29')]);_0x47200e[_0xae59('0x2f')]=_[_0xae59('0x30')](_0x47200e[_0xae59('0x2d')],_0x47200e['query']);_0xcda9b3[_0xae59('0x31')]=_[_0xae59('0x30')](_0x47200e['model'],qs[_0xae59('0x32')](_0x3c9c15[_0xae59('0x29')]['fields']));_0xcda9b3[_0xae59('0x31')]=_0xcda9b3['attributes'][_0xae59('0x33')]?_0xcda9b3[_0xae59('0x31')]:_0x47200e[_0xae59('0x2d')];if(!_0x3c9c15['query'][_0xae59('0x41')]('nolimit')){_0xcda9b3[_0xae59('0x14')]=qs['limit'](_0x3c9c15[_0xae59('0x29')]['limit']);_0xcda9b3[_0xae59('0x16')]=qs[_0xae59('0x16')](_0x3c9c15[_0xae59('0x29')][_0xae59('0x16')]);}_0xcda9b3[_0xae59('0x42')]=qs[_0xae59('0x43')](_0x3c9c15[_0xae59('0x29')]['sort']);_0xcda9b3[_0xae59('0x44')]=qs[_0xae59('0x2f')](_['pick'](_0x3c9c15['query'],_0x47200e[_0xae59('0x2f')]));_0xcda9b3[_0xae59('0x44')][_0xae59('0x45')]=_0x447a30['id'];if(_0x3c9c15[_0xae59('0x29')]['filter']){_0xcda9b3['where']=_[_0xae59('0x46')](_0xcda9b3[_0xae59('0x44')],{'$or':_[_0xae59('0x21')](_0xcda9b3[_0xae59('0x31')],function(_0x4f61c4){var _0x4e8912={};_0x4e8912[_0x4f61c4]={'$like':'%'+_0x3c9c15['query'][_0xae59('0x47')]+'%'};return _0x4e8912;})});}if(_0x3c9c15[_0xae59('0x29')]['$gte']){var _0x1b7a7f=_0x3c9c15[_0xae59('0x29')][_0xae59('0x48')]['split'](',');var _0x58976e={};_0x58976e[_0x1b7a7f[0x0]]={'$gte':moment(_0x1b7a7f[0x1])[_0xae59('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0xcda9b3['where']=_['merge'](_0xcda9b3[_0xae59('0x44')],_0x58976e);}_0xcda9b3=_[_0xae59('0x46')]({},_0xcda9b3,_0x3c9c15['options']);return db['SmsMessage'][_0xae59('0x15')]({'where':_0xcda9b3[_0xae59('0x44')]})['then'](function(_0x1ab276){_0xd6d2b2[_0xae59('0x15')]=_0x1ab276;if(_0x3c9c15['query'][_0xae59('0x34')]){_0xcda9b3[_0xae59('0x35')]=[{'all':!![]}];}return db[_0xae59('0x3c')][_0xae59('0x27')](_0xcda9b3);})[_0xae59('0x1a')](function(_0x10e941){_0xd6d2b2['rows']=_0x10e941;return _0xd6d2b2;});}})['then'](respondWithFilteredResult(_0x396b37,_0xcda9b3))[_0xae59('0x2a')](handleError(_0x396b37,null));};exports[_0xae59('0x4a')]=function(_0x264ecd,_0x6e7586){return db['SmsInteraction'][_0xae59('0x37')]({'where':{'id':_0x264ecd[_0xae59('0x2c')]['id']}})[_0xae59('0x1a')](handleEntityNotFound(_0x6e7586,null))['then'](function(_0xe690e3){if(_0xe690e3){return _0xe690e3[_0xae59('0x4b')](_0x264ecd['body']['ids'],_['omit'](_0x264ecd[_0xae59('0x39')],['ids','id'])||{})[_0xae59('0x4c')](function(){return db[_0xae59('0x4d')][_0xae59('0x27')]({'attributes':['id',_0xae59('0x1e'),_0xae59('0x4e')],'where':{'id':_0x264ecd[_0xae59('0x39')][_0xae59('0x3d')]}});})[_0xae59('0x1a')](function(_0x37e245){socket['emit'](_0xae59('0x4f'),{'id':Number(_0x264ecd['params']['id']),'tags':_0x37e245||[]});return{'id':Number(_0x264ecd[_0xae59('0x2c')]['id']),'tags':_0x37e245||[]};});}})[_0xae59('0x1a')](respondWithResult(_0x6e7586,null))[_0xae59('0x2a')](handleError(_0x6e7586,null));};exports[_0xae59('0x50')]=function(_0x45bdb2,_0x441cdb){return db[_0xae59('0x22')][_0xae59('0x37')]({'where':{'id':_0x45bdb2[_0xae59('0x2c')]['id']}})['then'](handleEntityNotFound(_0x441cdb,null))[_0xae59('0x1a')](function(_0x91e887){if(_0x91e887){return _0x91e887['removeTags'](_0x45bdb2['query'][_0xae59('0x3d')]);}})[_0xae59('0x1a')](respondWithStatusCode(_0x441cdb,null))[_0xae59('0x2a')](handleError(_0x441cdb,null));};exports['download']=function(_0x20115d,_0x3bc127){var _0x4b64db=moment()[_0xae59('0x51')]()[_0xae59('0x52')]();var _0x367d91=path[_0xae59('0x53')](config['root'],_0xae59('0x54'),_0xae59('0x55'),_0xae59('0x56'));var _0x7e3dde=path[_0xae59('0x53')](_0x367d91,_0x4b64db);var _0x4af976=util[_0xae59('0x49')]('transcript-%d-%s.zip',_0x20115d[_0xae59('0x2c')]['id'],_0x4b64db);var _0x45af0c=path[_0xae59('0x53')](_0x367d91,_0x4af976);var _0x3483b1=[];_0x3483b1['push']({'model':db[_0xae59('0x57')],'as':_0xae59('0x57'),'attributes':['id',_0xae59('0x58')],'raw':!![]});_0x3483b1[_0xae59('0x59')]({'model':db[_0xae59('0x5a')],'as':'Contact','attributes':['id',_0xae59('0x5b'),_0xae59('0x5c')],'raw':!![]});var _0x5e6991=[{'model':db[_0xae59('0x3c')],'as':_0xae59('0x5d'),'attributes':['id',_0xae59('0x39'),_0xae59('0x5e'),_0xae59('0x5f'),_0xae59('0x60'),_0xae59('0x61')],'include':_0x3483b1}];_0x5e6991[_0xae59('0x59')]({'model':db[_0xae59('0x62')],'as':'Account','attributes':['id',_0xae59('0x1e')]});_0x5e6991[_0xae59('0x59')]({'model':db[_0xae59('0x57')],'as':'Owner','attributes':['id','fullname']});return db[_0xae59('0x22')][_0xae59('0x37')]({'where':{'id':_0x20115d[_0xae59('0x2c')]['id']},'include':_0x5e6991})[_0xae59('0x1a')](handleEntityNotFound(_0x3bc127,null))[_0xae59('0x1a')](function(_0x1b8499){if(_0x1b8499){var _0x409581=_0x1b8499[_0xae59('0x63')]({'plain':!![]});fs[_0xae59('0x64')](_0x7e3dde);var _0x32eb66={'channel':_0xae59('0x65'),'account':_0x409581[_0xae59('0x66')]['name'],'agent':_0x409581[_0xae59('0x67')]?_0x409581[_0xae59('0x67')][_0xae59('0x58')]:_0xae59('0x68'),'createdAt':moment(_0x409581[_0xae59('0x5e')])['format'](_0xae59('0x69'))[_0xae59('0x52')](),'closedAt':_0x409581[_0xae59('0x6a')]?moment(_0x409581[_0xae59('0x6b')])[_0xae59('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae59('0x52')]():'','disposition':_0x409581[_0xae59('0x6c')],'messages':_(_0x409581['Messages'])[_0xae59('0x47')]({'secret':![]})[_0xae59('0x21')](function(_0x54bdc1){return{'date':moment(_0x54bdc1[_0xae59('0x5e')])[_0xae59('0x49')](_0xae59('0x69'))[_0xae59('0x52')](),'sender':_0x54bdc1[_0xae59('0x5f')]===_0xae59('0x6d')?_0x54bdc1[_0xae59('0x57')]?_0x54bdc1[_0xae59('0x57')][_0xae59('0x58')]:_0xae59('0x6e'):_0x54bdc1[_0xae59('0x6f')][_0xae59('0x5b')]+(_0x54bdc1[_0xae59('0x6f')][_0xae59('0x5c')]?'\x20'+_0x54bdc1['Contact'][_0xae59('0x5c')]:''),'body':_0x54bdc1[_0xae59('0x39')],'direction':_0x54bdc1[_0xae59('0x5f')]===_0xae59('0x6d')?'A':'C','secret':_0x54bdc1[_0xae59('0x60')],'read':_0x54bdc1['read']};})[_0xae59('0x70')]()};return ejs['renderFile'](path[_0xae59('0x53')](config[_0xae59('0x71')],_0xae59('0x54'),_0xae59('0x72'),_0xae59('0x73')),{'interaction':_0x32eb66})[_0xae59('0x1a')](function(_0x6a7f2c){var _0x43133a=path[_0xae59('0x53')](_0x7e3dde,_0xae59('0x74')+_0x409581['id']+'-'+_0x4b64db+_0xae59('0x75'));var _0x5ed0cd={'path':_0x43133a,'channel':_0xae59('0x65'),'interactionId':_0x409581['id']};return pdf['createPdfFromHTML'](_0x6a7f2c,_0x5ed0cd);})[_0xae59('0x1a')](function(){return new BPromise(function(_0x3ab68d,_0x36dc36){zipdir(_0x7e3dde,{'saveTo':_0x45af0c},function(_0x178fc4,_0xd8aa04){if(_0x178fc4)return _0x36dc36(_0x178fc4);return _0x3ab68d(_0xd8aa04);});})['then'](function(){return new BPromise(function(_0x391bd8,_0xa98ccf){rimraf(_0x7e3dde,function(_0x47e51e){if(_0x47e51e)_0xa98ccf(_0x47e51e);return _0x391bd8();});});})[_0xae59('0x1a')](function(){return _0x3bc127['download'](_0x45af0c,_0x4af976,function(_0x5240e3){if(_0x5240e3){console[_0xae59('0x76')](_0xae59('0x77'),_0x5240e3);}else{fs[_0xae59('0x78')](_0x45af0c);}});});});}else{return _0x3bc127[_0xae59('0x10')](0xc8);}})[_0xae59('0x2a')](handleError(_0x3bc127,null));}; \ No newline at end of file +var _0xda8f=['defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','update','destroy','then','error','send','SmsInteraction','fieldName','key','findAll','sms','query','user','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','include','merge','options','find','catch','create','body','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','map','$gte','split','includeAll','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','format','transcript-%d-%s.zip','User','push','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','name','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','out','value','renderFile','downloadInteraction.ejs','.pdf','log','err','unlinkSync','moment','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis'];(function(_0x415985,_0x592597){var _0x48185c=function(_0x1145de){while(--_0x1145de){_0x415985['push'](_0x415985['shift']());}};_0x48185c(++_0x592597);}(_0xda8f,0xe9));var _0xfda8=function(_0x1ef4be,_0x306cfb){_0x1ef4be=_0x1ef4be-0x0;var _0x27c876=_0xda8f[_0x1ef4be];return _0x27c876;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xfda8('0x0'));var BPromise=require(_0xfda8('0x1'));var util=require(_0xfda8('0x2'));var path=require('path');var ejs=require(_0xfda8('0x3'));var fs=require('fs');var _=require(_0xfda8('0x4'));var Redis=require('ioredis');var interaction=require(_0xfda8('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xfda8('0x6'));var logger=require(_0xfda8('0x7'))(_0xfda8('0x8'));var config=require('../../config/environment');var db=require(_0xfda8('0x9'))['db'];config[_0xfda8('0xa')]=_[_0xfda8('0xb')](config['redis'],{'host':_0xfda8('0xc'),'port':0x18eb});var socket=require(_0xfda8('0xd'))(new Redis(config[_0xfda8('0xa')]));require(_0xfda8('0xe'))[_0xfda8('0xf')](socket);function respondWithStatusCode(_0x4f0f4f,_0x47a39b){_0x47a39b=_0x47a39b||0xcc;return function(_0x57ce4b){if(_0x57ce4b){return _0x4f0f4f[_0xfda8('0x10')](_0x47a39b);}return _0x4f0f4f[_0xfda8('0x11')](_0x47a39b)[_0xfda8('0x12')]();};}function respondWithResult(_0x41be5a,_0xdd79ef){_0xdd79ef=_0xdd79ef||0xc8;return function(_0x26d1ac){if(_0x26d1ac){return _0x41be5a['status'](_0xdd79ef)[_0xfda8('0x13')](_0x26d1ac);}};}function respondWithFilteredResult(_0x542fc7,_0x39f52c){return function(_0xa5949c){if(_0xa5949c){var _0x1a57df=typeof _0x39f52c[_0xfda8('0x14')]==='undefined'&&typeof _0x39f52c[_0xfda8('0x15')]==='undefined';var _0x5ec8d6=_0xa5949c['count'];var _0xfa6fb4=_0x1a57df?0x0:_0x39f52c[_0xfda8('0x14')];var _0xd20ab7=_0x1a57df?_0xa5949c[_0xfda8('0x16')]:_0x39f52c[_0xfda8('0x14')]+_0x39f52c[_0xfda8('0x15')];var _0x25c75c;if(_0xd20ab7>=_0x5ec8d6){_0xd20ab7=_0x5ec8d6;_0x25c75c=0xc8;}else{_0x25c75c=0xce;}_0x542fc7[_0xfda8('0x11')](_0x25c75c);return _0x542fc7['set']('Content-Range',_0xfa6fb4+'-'+_0xd20ab7+'/'+_0x5ec8d6)[_0xfda8('0x13')](_0xa5949c);}return null;};}function saveUpdates(_0x178445){return function(_0x4a11ae){if(_0x4a11ae){return _0x4a11ae[_0xfda8('0x17')](_0x178445)['then'](function(_0x820ffe){return _0x820ffe;});}return null;};}function removeEntity(_0x5be4a5){return function(_0x3d8b66){if(_0x3d8b66){return _0x3d8b66[_0xfda8('0x18')]()[_0xfda8('0x19')](function(){_0x5be4a5[_0xfda8('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aa79b){return function(_0x37016e){if(!_0x37016e){_0x1aa79b[_0xfda8('0x10')](0x194);}return _0x37016e;};}function handleError(_0x1183fa,_0x1c29d5){_0x1c29d5=_0x1c29d5||0x1f4;return function(_0x306c5d){logger[_0xfda8('0x1a')](_0x306c5d['stack']);if(_0x306c5d['name']){delete _0x306c5d['name'];}_0x1183fa[_0xfda8('0x11')](_0x1c29d5)[_0xfda8('0x1b')](_0x306c5d);};}exports['index']=function(_0xd9e178,_0x55ac16){var _0x3effe1={};var _0x2bd983=_['map'](db[_0xfda8('0x1c')]['rawAttributes'],function(_0xc057d0){return{'name':_0xc057d0[_0xfda8('0x1d')],'type':_0xc057d0['type'][_0xfda8('0x1e')]};});_0x3effe1=qs['getOptions'](_0x2bd983,_0xd9e178);return interaction[_0xfda8('0x1f')](_0xfda8('0x20'),_0xd9e178[_0xfda8('0x21')],_0xd9e178[_0xfda8('0x22')],_0x3effe1,_0x2bd983)[_0xfda8('0x19')](respondWithFilteredResult(_0x55ac16,_0x3effe1))['catch'](handleError(_0x55ac16,null));};exports[_0xfda8('0x23')]=function(_0x29a651,_0x36fb10){var _0x1cb20d={'raw':![],'where':{'id':_0x29a651[_0xfda8('0x24')]['id']}},_0x25fc7f={};_0x25fc7f[_0xfda8('0x25')]=_[_0xfda8('0x26')](db[_0xfda8('0x1c')][_0xfda8('0x27')]);_0x25fc7f[_0xfda8('0x21')]=_[_0xfda8('0x26')](_0x29a651['query']);_0x25fc7f[_0xfda8('0x28')]=_[_0xfda8('0x29')](_0x25fc7f[_0xfda8('0x25')],_0x25fc7f['query']);_0x1cb20d['attributes']=_[_0xfda8('0x29')](_0x25fc7f['model'],qs[_0xfda8('0x2a')](_0x29a651[_0xfda8('0x21')][_0xfda8('0x2a')]));_0x1cb20d[_0xfda8('0x2b')]=_0x1cb20d['attributes'][_0xfda8('0x2c')]?_0x1cb20d['attributes']:_0x25fc7f['model'];if(_0x29a651[_0xfda8('0x21')]['includeAll']){_0x1cb20d[_0xfda8('0x2d')]=[{'all':!![]}];}_0x1cb20d=_[_0xfda8('0x2e')]({},_0x1cb20d,_0x29a651[_0xfda8('0x2f')]);return db[_0xfda8('0x1c')][_0xfda8('0x30')](_0x1cb20d)[_0xfda8('0x19')](handleEntityNotFound(_0x36fb10,null))[_0xfda8('0x19')](respondWithResult(_0x36fb10,null))[_0xfda8('0x31')](handleError(_0x36fb10,null));};exports['create']=function(_0x4eaf86,_0x3fb01e){return db['SmsInteraction'][_0xfda8('0x32')](_0x4eaf86[_0xfda8('0x33')],{})[_0xfda8('0x19')](respondWithResult(_0x3fb01e,0xc9))['catch'](handleError(_0x3fb01e,null));};exports['update']=function(_0x58afcf,_0x19b688){if(_0x58afcf[_0xfda8('0x33')]['id']){delete _0x58afcf[_0xfda8('0x33')]['id'];}return db[_0xfda8('0x1c')][_0xfda8('0x30')]({'where':{'id':_0x58afcf[_0xfda8('0x24')]['id']}})['then'](handleEntityNotFound(_0x19b688,null))['then'](saveUpdates(_0x58afcf[_0xfda8('0x33')],null))[_0xfda8('0x19')](respondWithResult(_0x19b688,null))['catch'](handleError(_0x19b688,null));};exports[_0xfda8('0x18')]=function(_0x25357b,_0x5e4c4e){return db[_0xfda8('0x1c')][_0xfda8('0x30')]({'where':{'id':_0x25357b[_0xfda8('0x24')]['id']}})[_0xfda8('0x19')](handleEntityNotFound(_0x5e4c4e,null))['then'](removeEntity(_0x5e4c4e,null))[_0xfda8('0x31')](handleError(_0x5e4c4e,null));};exports[_0xfda8('0x34')]=function(_0x2e510e,_0x5c6d54){return db[_0xfda8('0x1c')][_0xfda8('0x34')]()[_0xfda8('0x19')](respondWithResult(_0x5c6d54,null))[_0xfda8('0x31')](handleError(_0x5c6d54,null));};exports[_0xfda8('0x35')]=function(_0x13211f,_0x21425b){return db['SmsMessage'][_0xfda8('0x30')]({'where':{'id':_0x13211f[_0xfda8('0x24')]['id']}})[_0xfda8('0x19')](handleEntityNotFound(_0x21425b,null))['then'](function(_0x3e2bba){if(_0x3e2bba){return _0x3e2bba[_0xfda8('0x35')](_0x13211f[_0xfda8('0x33')][_0xfda8('0x36')],_[_0xfda8('0x37')](_0x13211f[_0xfda8('0x33')],[_0xfda8('0x36'),'id'])||{});}})[_0xfda8('0x19')](respondWithResult(_0x21425b,null))['catch'](handleError(_0x21425b,null));};exports[_0xfda8('0x38')]=function(_0x2154b0,_0x561b78){var _0x148794={'raw':![],'where':{}};var _0x5efd8e={};var _0x11d16c={'count':0x0,'rows':[]};return db[_0xfda8('0x1c')][_0xfda8('0x39')]({'where':{'id':_0x2154b0[_0xfda8('0x24')]['id']}})[_0xfda8('0x19')](handleEntityNotFound(_0x561b78,null))[_0xfda8('0x19')](function(_0x3fb51b){if(_0x3fb51b){_0x5efd8e[_0xfda8('0x25')]=_['keys'](db[_0xfda8('0x3a')]['rawAttributes']);_0x5efd8e[_0xfda8('0x21')]=_[_0xfda8('0x26')](_0x2154b0['query']);_0x5efd8e[_0xfda8('0x28')]=_[_0xfda8('0x29')](_0x5efd8e[_0xfda8('0x25')],_0x5efd8e[_0xfda8('0x21')]);_0x148794[_0xfda8('0x2b')]=_[_0xfda8('0x29')](_0x5efd8e['model'],qs[_0xfda8('0x2a')](_0x2154b0['query'][_0xfda8('0x2a')]));_0x148794[_0xfda8('0x2b')]=_0x148794[_0xfda8('0x2b')][_0xfda8('0x2c')]?_0x148794[_0xfda8('0x2b')]:_0x5efd8e[_0xfda8('0x25')];if(!_0x2154b0[_0xfda8('0x21')][_0xfda8('0x3b')](_0xfda8('0x3c'))){_0x148794[_0xfda8('0x15')]=qs['limit'](_0x2154b0[_0xfda8('0x21')][_0xfda8('0x15')]);_0x148794[_0xfda8('0x14')]=qs['offset'](_0x2154b0[_0xfda8('0x21')][_0xfda8('0x14')]);}_0x148794[_0xfda8('0x3d')]=qs[_0xfda8('0x3e')](_0x2154b0[_0xfda8('0x21')][_0xfda8('0x3e')]);_0x148794[_0xfda8('0x3f')]=qs[_0xfda8('0x28')](_[_0xfda8('0x40')](_0x2154b0['query'],_0x5efd8e[_0xfda8('0x28')]));_0x148794['where'][_0xfda8('0x41')]=_0x3fb51b['id'];if(_0x2154b0[_0xfda8('0x21')][_0xfda8('0x42')]){_0x148794[_0xfda8('0x3f')]=_[_0xfda8('0x2e')](_0x148794[_0xfda8('0x3f')],{'$or':_[_0xfda8('0x43')](_0x148794[_0xfda8('0x2b')],function(_0x2ae506){var _0x5c92f6={};_0x5c92f6[_0x2ae506]={'$like':'%'+_0x2154b0[_0xfda8('0x21')][_0xfda8('0x42')]+'%'};return _0x5c92f6;})});}if(_0x2154b0[_0xfda8('0x21')]['$gte']){var _0x27d0df=_0x2154b0[_0xfda8('0x21')][_0xfda8('0x44')][_0xfda8('0x45')](',');var _0x35a884={};_0x35a884[_0x27d0df[0x0]]={'$gte':moment(_0x27d0df[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x148794[_0xfda8('0x3f')]=_[_0xfda8('0x2e')](_0x148794[_0xfda8('0x3f')],_0x35a884);}_0x148794=_[_0xfda8('0x2e')]({},_0x148794,_0x2154b0[_0xfda8('0x2f')]);return db[_0xfda8('0x3a')]['count']({'where':_0x148794[_0xfda8('0x3f')]})[_0xfda8('0x19')](function(_0x39628e){_0x11d16c['count']=_0x39628e;if(_0x2154b0[_0xfda8('0x21')][_0xfda8('0x46')]){_0x148794[_0xfda8('0x2d')]=[{'all':!![]}];}return db[_0xfda8('0x3a')][_0xfda8('0x1f')](_0x148794);})[_0xfda8('0x19')](function(_0x53eb57){_0x11d16c[_0xfda8('0x47')]=_0x53eb57;return _0x11d16c;});}})[_0xfda8('0x19')](respondWithFilteredResult(_0x561b78,_0x148794))[_0xfda8('0x31')](handleError(_0x561b78,null));};exports[_0xfda8('0x48')]=function(_0x474ea9,_0x255818){return db[_0xfda8('0x1c')][_0xfda8('0x30')]({'where':{'id':_0x474ea9[_0xfda8('0x24')]['id']}})[_0xfda8('0x19')](handleEntityNotFound(_0x255818,null))[_0xfda8('0x19')](function(_0x1d9573){if(_0x1d9573){return _0x1d9573[_0xfda8('0x49')](_0x474ea9[_0xfda8('0x33')][_0xfda8('0x36')],_[_0xfda8('0x37')](_0x474ea9[_0xfda8('0x33')],['ids','id'])||{})[_0xfda8('0x4a')](function(){return db[_0xfda8('0x4b')][_0xfda8('0x1f')]({'attributes':['id','name',_0xfda8('0x4c')],'where':{'id':_0x474ea9[_0xfda8('0x33')][_0xfda8('0x36')]}});})['then'](function(_0x44ccb5){socket[_0xfda8('0x4d')](_0xfda8('0x4e'),{'id':Number(_0x474ea9[_0xfda8('0x24')]['id']),'tags':_0x44ccb5||[]});return{'id':Number(_0x474ea9['params']['id']),'tags':_0x44ccb5||[]};});}})['then'](respondWithResult(_0x255818,null))[_0xfda8('0x31')](handleError(_0x255818,null));};exports[_0xfda8('0x4f')]=function(_0x4d0bce,_0x3a5900){return db['SmsInteraction']['find']({'where':{'id':_0x4d0bce['params']['id']}})[_0xfda8('0x19')](handleEntityNotFound(_0x3a5900,null))[_0xfda8('0x19')](function(_0x499c22){if(_0x499c22){return _0x499c22[_0xfda8('0x4f')](_0x4d0bce[_0xfda8('0x21')][_0xfda8('0x36')]);}})[_0xfda8('0x19')](respondWithStatusCode(_0x3a5900,null))[_0xfda8('0x31')](handleError(_0x3a5900,null));};exports[_0xfda8('0x50')]=function(_0x4d6a89,_0x306a12){var _0x143a9f=moment()[_0xfda8('0x51')]()[_0xfda8('0x52')]();var _0x5391c6=path['join'](config[_0xfda8('0x53')],_0xfda8('0x54'),_0xfda8('0x55'),_0xfda8('0x56'));var _0x459da4=path[_0xfda8('0x57')](_0x5391c6,_0x143a9f);var _0x16916c=util[_0xfda8('0x58')](_0xfda8('0x59'),_0x4d6a89[_0xfda8('0x24')]['id'],_0x143a9f);var _0x2c72d4=path[_0xfda8('0x57')](_0x5391c6,_0x16916c);var _0x28a6bf=[];_0x28a6bf['push']({'model':db[_0xfda8('0x5a')],'as':_0xfda8('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x28a6bf[_0xfda8('0x5b')]({'model':db[_0xfda8('0x5c')],'as':_0xfda8('0x5d'),'attributes':['id',_0xfda8('0x5e'),_0xfda8('0x5f')],'raw':!![]});var _0x8f98af=[{'model':db[_0xfda8('0x3a')],'as':_0xfda8('0x60'),'attributes':['id',_0xfda8('0x33'),_0xfda8('0x61'),_0xfda8('0x62'),_0xfda8('0x63'),_0xfda8('0x64')],'include':_0x28a6bf}];_0x8f98af[_0xfda8('0x5b')]({'model':db[_0xfda8('0x65')],'as':_0xfda8('0x66'),'attributes':['id','name']});_0x8f98af[_0xfda8('0x5b')]({'model':db['User'],'as':_0xfda8('0x67'),'attributes':['id',_0xfda8('0x68')]});return db[_0xfda8('0x1c')][_0xfda8('0x30')]({'where':{'id':_0x4d6a89['params']['id']},'include':_0x8f98af})['then'](handleEntityNotFound(_0x306a12,null))[_0xfda8('0x19')](function(_0x2e819b){if(_0x2e819b){var _0x1f1edd=_0x2e819b[_0xfda8('0x69')]({'plain':!![]});fs[_0xfda8('0x6a')](_0x459da4);var _0x2c462b={'channel':_0xfda8('0x6b'),'account':_0x1f1edd[_0xfda8('0x66')][_0xfda8('0x6c')],'agent':_0x1f1edd[_0xfda8('0x67')]?_0x1f1edd[_0xfda8('0x67')][_0xfda8('0x68')]:_0xfda8('0x6d'),'createdAt':moment(_0x1f1edd[_0xfda8('0x61')])[_0xfda8('0x58')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfda8('0x52')](),'closedAt':_0x1f1edd[_0xfda8('0x6e')]?moment(_0x1f1edd[_0xfda8('0x6f')])[_0xfda8('0x58')](_0xfda8('0x70'))[_0xfda8('0x52')]():'','disposition':_0x1f1edd[_0xfda8('0x71')],'messages':_(_0x1f1edd['Messages'])[_0xfda8('0x42')]({'secret':![]})[_0xfda8('0x43')](function(_0x157444){return{'date':moment(_0x157444['createdAt'])['format'](_0xfda8('0x70'))[_0xfda8('0x52')](),'sender':_0x157444[_0xfda8('0x62')]===_0xfda8('0x72')?_0x157444[_0xfda8('0x5a')]?_0x157444[_0xfda8('0x5a')][_0xfda8('0x68')]:'System':_0x157444[_0xfda8('0x5d')][_0xfda8('0x5e')]+(_0x157444[_0xfda8('0x5d')][_0xfda8('0x5f')]?'\x20'+_0x157444[_0xfda8('0x5d')]['lastName']:''),'body':_0x157444['body'],'direction':_0x157444['direction']==='out'?'A':'C','secret':_0x157444[_0xfda8('0x63')],'read':_0x157444[_0xfda8('0x64')]};})[_0xfda8('0x73')]()};return ejs[_0xfda8('0x74')](path['join'](config[_0xfda8('0x53')],'server','views',_0xfda8('0x75')),{'interaction':_0x2c462b})[_0xfda8('0x19')](function(_0x276f6a){var _0x4befca=path[_0xfda8('0x57')](_0x459da4,'transcript-'+_0x1f1edd['id']+'-'+_0x143a9f+_0xfda8('0x76'));var _0x15d66d={'path':_0x4befca,'channel':_0xfda8('0x6b'),'interactionId':_0x1f1edd['id']};return pdf['createPdfFromHTML'](_0x276f6a,_0x15d66d);})[_0xfda8('0x19')](function(){return new BPromise(function(_0x501207,_0x1dd018){zipdir(_0x459da4,{'saveTo':_0x2c72d4},function(_0x4e874d,_0x55f356){if(_0x4e874d)return _0x1dd018(_0x4e874d);return _0x501207(_0x55f356);});})[_0xfda8('0x19')](function(){return new BPromise(function(_0x2122fb,_0x491172){rimraf(_0x459da4,function(_0x9003e8){if(_0x9003e8)_0x491172(_0x9003e8);return _0x2122fb();});});})[_0xfda8('0x19')](function(){return _0x306a12[_0xfda8('0x50')](_0x2c72d4,_0x16916c,function(_0x19de6a){if(_0x19de6a){console[_0xfda8('0x77')](_0xfda8('0x78'),_0x19de6a);}else{fs[_0xfda8('0x79')](_0x2c72d4);}});});});}else{return _0x306a12[_0xfda8('0x10')](0xc8);}})[_0xfda8('0x31')](handleError(_0x306a12,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a531992..fb98c33 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 _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x4e4774,_0x2eff7a){var _0x1a990a=function(_0x36a8a6){while(--_0x36a8a6){_0x4e4774['push'](_0x4e4774['shift']());}};_0x1a990a(++_0x2eff7a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x42aef4,_0x27af05){_0x42aef4=_0x42aef4-0x0;var _0x45eae2=_0xdd4f[_0x42aef4];return _0x45eae2;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0xdd4f=['setMaxListeners','update','remove','getUsers','then','Users','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x2c1400,_0x298195){var _0x33c0ad=function(_0x2eeccd){while(--_0x2eeccd){_0x2c1400['push'](_0x2c1400['shift']());}};_0x33c0ad(++_0x298195);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2dcd5e,_0x324f7c){_0x2dcd5e=_0x2dcd5e-0x0;var _0x4da185=_0xdd4f[_0x2dcd5e];return _0x4da185;};'use strict';var EventEmitter=require(_0xfdd4('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xfdd4('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfdd4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdd4('0x3'),'afterDestroy':_0xfdd4('0x4')};function emitEvent(_0x6b2b0d){return function(_0x554e44,_0x398015,_0x43cbcf){_0x554e44[_0xfdd4('0x5')]({'attributes':['id'],'raw':!![]})[_0xfdd4('0x6')](function(_0x3c72d4){_0x554e44['setDataValue'](_0xfdd4('0x7'),_0x3c72d4['map'](function(_0x4181d6){return{'id':_0x4181d6['id']};}));return SmsMessage[_0xfdd4('0x8')]({'where':{'SmsInteractionId':_0x554e44['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfdd4('0x6')](function(_0x4ee02f){_0x554e44[_0xfdd4('0x9')]('unreadMessages',_0x4ee02f[_0xfdd4('0xa')]);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d+':'+_0x554e44['id'],_0x554e44);SmsInteractionEvents[_0xfdd4('0xb')](_0x6b2b0d,_0x554e44);_0x43cbcf(null);})[_0xfdd4('0xc')](_0x43cbcf(null));};}for(var e in events){if(events[_0xfdd4('0xd')](e)){var event=events[e];SmsInteraction[_0xfdd4('0xe')](e,emitEvent(event));}}module[_0xfdd4('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c46432f..c282d5f 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 _0xb46e=['../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb46e,0x1ca));var _0xeb46=function(_0x2cb1bd,_0x42b64c){_0x2cb1bd=_0x2cb1bd-0x0;var _0x393fdf=_0xb46e[_0x2cb1bd];return _0x393fdf;};'use strict';var _=require(_0xeb46('0x0'));var util=require(_0xeb46('0x1'));var logger=require('../../config/logger')(_0xeb46('0x2'));var moment=require('moment');var BPromise=require(_0xeb46('0x3'));var rp=require(_0xeb46('0x4'));var fs=require('fs');var path=require(_0xeb46('0x5'));var rimraf=require(_0xeb46('0x6'));var config=require(_0xeb46('0x7'));var attributes=require(_0xeb46('0x8'));module[_0xeb46('0x9')]=function(_0x59bca1,_0x3ac2d8){return _0x59bca1[_0xeb46('0xa')](_0xeb46('0xb'),attributes,{'tableName':_0xeb46('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b868d,_0x1f345a,_0x4ebde4){if(_0x4b868d['changed'](_0xeb46('0xd'))){_0x4b868d[_0xeb46('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4ebde4(null,_0x4b868d);}}});}; \ No newline at end of file +var _0xbdf9=['./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x57b365,_0xa63024){var _0x5b3768=function(_0x54a1d3){while(--_0x54a1d3){_0x57b365['push'](_0x57b365['shift']());}};_0x5b3768(++_0xa63024);}(_0xbdf9,0x112));var _0x9bdf=function(_0x3b20c2,_0x888661){_0x3b20c2=_0x3b20c2-0x0;var _0x5b4482=_0xbdf9[_0x3b20c2];return _0x5b4482;};'use strict';var _=require('lodash');var util=require(_0x9bdf('0x0'));var logger=require(_0x9bdf('0x1'))(_0x9bdf('0x2'));var moment=require('moment');var BPromise=require(_0x9bdf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9bdf('0x4'));var rimraf=require('rimraf');var config=require(_0x9bdf('0x5'));var attributes=require(_0x9bdf('0x6'));module[_0x9bdf('0x7')]=function(_0x35d35d,_0x7d21a){return _0x35d35d['define'](_0x9bdf('0x8'),attributes,{'tableName':_0x9bdf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a683e,_0x15daf3,_0x34b3e2){if(_0x2a683e[_0x9bdf('0xa')](_0x9bdf('0xb'))){_0x2a683e[_0x9bdf('0xc')]=moment()[_0x9bdf('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x34b3e2(null,_0x2a683e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 174f555..6a00bba 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 _0xc3ba=['catch','SmsInteraction','update','body','options','raw','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','where','then','addTags','ids','omit','spread','AddTags','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xc3ba,0xf5));var _0xac3b=function(_0xb4b9a5,_0x14f810){_0xb4b9a5=_0xb4b9a5-0x0;var _0x3673f2=_0xc3ba[_0xb4b9a5];return _0x3673f2;};'use strict';var _=require(_0xac3b('0x0'));var util=require('util');var moment=require(_0xac3b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac3b('0x2'))['db'];var utils=require(_0xac3b('0x3'));var logger=require(_0xac3b('0x4'))(_0xac3b('0x5'));var config=require('../../config/environment');var jayson=require(_0xac3b('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xac3b('0x7')]=_[_0xac3b('0x8')](config[_0xac3b('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xac3b('0x9'))(new Redis(config[_0xac3b('0x7')]));require(_0xac3b('0xa'))[_0xac3b('0xb')](socket);function respondWithRpcPromise(_0x56a138,_0x26e9fd,_0x47ff60){return new BPromise(function(_0x579151,_0x300c78){return client[_0xac3b('0xc')](_0x56a138,_0x47ff60)['then'](function(_0x3ecfd2){logger[_0xac3b('0xd')](_0xac3b('0xe'),_0x26e9fd,'request\x20sent');logger[_0xac3b('0xf')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x26e9fd,'request\x20sent',JSON['stringify'](_0x3ecfd2));if(_0x3ecfd2[_0xac3b('0x10')]){if(_0x3ecfd2[_0xac3b('0x10')][_0xac3b('0x11')]===0x1f4){logger[_0xac3b('0x10')](_0xac3b('0xe'),_0x26e9fd,_0x3ecfd2['error'][_0xac3b('0x12')]);return _0x300c78(_0x3ecfd2[_0xac3b('0x10')][_0xac3b('0x12')]);}logger[_0xac3b('0x10')](_0xac3b('0xe'),_0x26e9fd,_0x3ecfd2['error'][_0xac3b('0x12')]);return _0x579151(_0x3ecfd2[_0xac3b('0x10')][_0xac3b('0x12')]);}else{logger[_0xac3b('0xd')](_0xac3b('0xe'),_0x26e9fd,_0xac3b('0x13'));_0x579151(_0x3ecfd2[_0xac3b('0x14')][_0xac3b('0x12')]);}})[_0xac3b('0x15')](function(_0x4f6929){logger[_0xac3b('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x26e9fd,_0x4f6929);_0x300c78(_0x4f6929);});});}exports['UpdateSmsInteraction']=function(_0x59edb2){var _0x4cc5c5=this;return new Promise(function(_0x306be2,_0x5c49af){return db[_0xac3b('0x16')][_0xac3b('0x17')](_0x59edb2[_0xac3b('0x18')],{'raw':_0x59edb2[_0xac3b('0x19')]?_0x59edb2[_0xac3b('0x19')][_0xac3b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59edb2[_0xac3b('0x19')]?_0x59edb2[_0xac3b('0x19')]['where']||null:null,'attributes':_0x59edb2['options']?_0x59edb2[_0xac3b('0x19')]['attributes']||null:null,'limit':_0x59edb2['options']?_0x59edb2[_0xac3b('0x19')]['limit']||null:null})['then'](function(_0x2562fb){logger[_0xac3b('0xd')](_0xac3b('0x1b'),_0x59edb2);logger[_0xac3b('0xf')]('UpdateSmsInteraction',_0x59edb2,JSON[_0xac3b('0x1c')](_0x2562fb));_0x306be2(_0x2562fb);})['catch'](function(_0x5add7e){logger[_0xac3b('0x10')](_0xac3b('0x1b'),_0x5add7e[_0xac3b('0x12')],_0x59edb2);_0x5c49af(_0x4cc5c5[_0xac3b('0x10')](0x1f4,_0x5add7e['message']));});});};exports[_0xac3b('0x1d')]=function(_0x31e506){return new Promise(function(_0x3b0959,_0x11acef){return db[_0xac3b('0x16')][_0xac3b('0x1e')]({'where':_0x31e506['options']?_0x31e506[_0xac3b('0x19')][_0xac3b('0x1f')]||null:null})[_0xac3b('0x20')](function(_0x55d2f2){if(_0x55d2f2){return _0x55d2f2[_0xac3b('0x21')](_0x31e506[_0xac3b('0x18')][_0xac3b('0x22')],_[_0xac3b('0x23')](_0x31e506[_0xac3b('0x18')],['ids','id'])||{});}})[_0xac3b('0x24')](function(_0x1138fb){logger[_0xac3b('0xd')](_0xac3b('0x25'),_0x31e506);logger[_0xac3b('0xf')](_0xac3b('0x25'),_0x31e506,JSON['stringify'](_0x1138fb));_0x3b0959(_0x1138fb);})[_0xac3b('0x15')](function(_0x108fee){logger[_0xac3b('0x10')](_0xac3b('0x25'),_0x108fee['message'],_0x31e506);_0x11acef(_this['error'](0x1f4,_0x108fee[_0xac3b('0x12')]));});});}; \ No newline at end of file +var _0x0bea=['SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','limit','then','catch','find','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x0bea,0x1da));var _0xa0be=function(_0x24721a,_0x1ac53c){_0x24721a=_0x24721a-0x0;var _0x6a9880=_0x0bea[_0x24721a];return _0x6a9880;};'use strict';var _=require(_0xa0be('0x0'));var util=require(_0xa0be('0x1'));var moment=require('moment');var BPromise=require(_0xa0be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0be('0x3'))['db'];var utils=require(_0xa0be('0x4'));var logger=require(_0xa0be('0x5'))('rpc');var config=require(_0xa0be('0x6'));var jayson=require(_0xa0be('0x7'));var client=jayson[_0xa0be('0x8')]['http']({'port':0x232a});config['redis']=_[_0xa0be('0x9')](config[_0xa0be('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0be('0xb'))(new Redis(config[_0xa0be('0xa')]));require(_0xa0be('0xc'))[_0xa0be('0xd')](socket);function respondWithRpcPromise(_0x4f59ea,_0x394098,_0x464117){return new BPromise(function(_0xdca831,_0x43e908){return client[_0xa0be('0xe')](_0x4f59ea,_0x464117)['then'](function(_0x1492ac){logger['info'](_0xa0be('0xf'),_0x394098,_0xa0be('0x10'));logger[_0xa0be('0x11')](_0xa0be('0x12'),_0x394098,_0xa0be('0x10'),JSON[_0xa0be('0x13')](_0x1492ac));if(_0x1492ac[_0xa0be('0x14')]){if(_0x1492ac[_0xa0be('0x14')][_0xa0be('0x15')]===0x1f4){logger[_0xa0be('0x14')](_0xa0be('0xf'),_0x394098,_0x1492ac[_0xa0be('0x14')]['message']);return _0x43e908(_0x1492ac[_0xa0be('0x14')][_0xa0be('0x16')]);}logger['error'](_0xa0be('0xf'),_0x394098,_0x1492ac[_0xa0be('0x14')][_0xa0be('0x16')]);return _0xdca831(_0x1492ac[_0xa0be('0x14')]['message']);}else{logger[_0xa0be('0x17')](_0xa0be('0xf'),_0x394098,_0xa0be('0x10'));_0xdca831(_0x1492ac[_0xa0be('0x18')][_0xa0be('0x16')]);}})['catch'](function(_0x568300){logger[_0xa0be('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x394098,_0x568300);_0x43e908(_0x568300);});});}exports[_0xa0be('0x19')]=function(_0x5b330e){var _0x19fd0a=this;return new Promise(function(_0x182f0c,_0x1ca4c4){return db[_0xa0be('0x1a')][_0xa0be('0x1b')](_0x5b330e[_0xa0be('0x1c')],{'raw':_0x5b330e[_0xa0be('0x1d')]?_0x5b330e[_0xa0be('0x1d')][_0xa0be('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b330e[_0xa0be('0x1d')]?_0x5b330e[_0xa0be('0x1d')]['where']||null:null,'attributes':_0x5b330e[_0xa0be('0x1d')]?_0x5b330e[_0xa0be('0x1d')]['attributes']||null:null,'limit':_0x5b330e[_0xa0be('0x1d')]?_0x5b330e[_0xa0be('0x1d')][_0xa0be('0x1f')]||null:null})[_0xa0be('0x20')](function(_0x42a7f6){logger[_0xa0be('0x17')](_0xa0be('0x19'),_0x5b330e);logger[_0xa0be('0x11')](_0xa0be('0x19'),_0x5b330e,JSON['stringify'](_0x42a7f6));_0x182f0c(_0x42a7f6);})[_0xa0be('0x21')](function(_0x564e90){logger[_0xa0be('0x14')](_0xa0be('0x19'),_0x564e90[_0xa0be('0x16')],_0x5b330e);_0x1ca4c4(_0x19fd0a[_0xa0be('0x14')](0x1f4,_0x564e90[_0xa0be('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4a9d1a){return new Promise(function(_0x2ab98f,_0x6c3e4f){return db[_0xa0be('0x1a')][_0xa0be('0x22')]({'where':_0x4a9d1a['options']?_0x4a9d1a[_0xa0be('0x1d')][_0xa0be('0x23')]||null:null})[_0xa0be('0x20')](function(_0xa839b1){if(_0xa839b1){return _0xa839b1[_0xa0be('0x24')](_0x4a9d1a['body'][_0xa0be('0x25')],_[_0xa0be('0x26')](_0x4a9d1a[_0xa0be('0x1c')],['ids','id'])||{});}})[_0xa0be('0x27')](function(_0x2720d0){logger[_0xa0be('0x17')](_0xa0be('0x28'),_0x4a9d1a);logger[_0xa0be('0x11')](_0xa0be('0x28'),_0x4a9d1a,JSON[_0xa0be('0x13')](_0x2720d0));_0x2ab98f(_0x2720d0);})[_0xa0be('0x21')](function(_0x3b7684){logger[_0xa0be('0x14')]('AddTags',_0x3b7684[_0xa0be('0x16')],_0x4a9d1a);_0x6c3e4f(_this[_0xa0be('0x14')](0x1f4,_0x3b7684['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2b5ed88..3e0c23e 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 _0x18db=['length','smsInteraction:','./smsInteraction.events','save','remove','emit','register'];(function(_0x10fe02,_0x6cae7b){var _0x33a915=function(_0x448ef7){while(--_0x448ef7){_0x10fe02['push'](_0x10fe02['shift']());}};_0x33a915(++_0x6cae7b);}(_0x18db,0x1ad));var _0xb18d=function(_0x39059e,_0x4f3f20){_0x39059e=_0x39059e-0x0;var _0x473ec5=_0x18db[_0x39059e];return _0x473ec5;};'use strict';var SmsInteractionEvents=require(_0xb18d('0x0'));var events=[_0xb18d('0x1'),_0xb18d('0x2'),'update'];function createListener(_0x488787,_0x59ac2d){return function(_0x1d5eed){_0x59ac2d[_0xb18d('0x3')](_0x488787,_0x1d5eed);};}function removeListener(_0x315a91,_0x57c47f){return function(){SmsInteractionEvents['removeListener'](_0x315a91,_0x57c47f);};}exports[_0xb18d('0x4')]=function(_0x328568){for(var _0x287907=0x0,_0x37a70c=events[_0xb18d('0x5')];_0x287907<_0x37a70c;_0x287907++){var _0xb15783=events[_0x287907];var _0x5b9c43=createListener(_0xb18d('0x6')+_0xb15783,_0x328568);SmsInteractionEvents['on'](_0xb15783,_0x5b9c43);}}; \ No newline at end of file +var _0xc5ee=['length','smsInteraction:','./smsInteraction.events','remove','update','emit','removeListener','register'];(function(_0x2f19d9,_0x3beba5){var _0x5ab4ea=function(_0x305ba4){while(--_0x305ba4){_0x2f19d9['push'](_0x2f19d9['shift']());}};_0x5ab4ea(++_0x3beba5);}(_0xc5ee,0x1ba));var _0xec5e=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0xc5ee[_0x4e9274];return _0x8b474c;};'use strict';var SmsInteractionEvents=require(_0xec5e('0x0'));var events=['save',_0xec5e('0x1'),_0xec5e('0x2')];function createListener(_0x1e61a1,_0x562128){return function(_0x2f7644){_0x562128[_0xec5e('0x3')](_0x1e61a1,_0x2f7644);};}function removeListener(_0x2a0db8,_0x6599e4){return function(){SmsInteractionEvents[_0xec5e('0x4')](_0x2a0db8,_0x6599e4);};}exports[_0xec5e('0x5')]=function(_0x19266d){for(var _0x879894=0x0,_0x64a96b=events[_0xec5e('0x6')];_0x879894<_0x64a96b;_0x879894++){var _0x47c7fb=events[_0x879894];var _0x4583db=createListener(_0xec5e('0x7')+_0x47c7fb,_0x19266d);SmsInteractionEvents['on'](_0x47c7fb,_0x4583db);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 2a521fb..1305dcd 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 _0x4a0e=['post','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create'];(function(_0x154980,_0x2710e5){var _0x55a463=function(_0x4c0389){while(--_0x4c0389){_0x154980['push'](_0x154980['shift']());}};_0x55a463(++_0x2710e5);}(_0x4a0e,0xab));var _0xe4a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4a0e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe4a0('0x0'));var util=require(_0xe4a0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe4a0('0x2'));var router=express[_0xe4a0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe4a0('0x4'));var interaction=require(_0xe4a0('0x5'));var config=require(_0xe4a0('0x6'));var controller=require('./smsMessage.controller');router[_0xe4a0('0x7')]('/',auth[_0xe4a0('0x8')](),controller[_0xe4a0('0x9')]);router['get'](_0xe4a0('0xa'),auth[_0xe4a0('0x8')](),controller[_0xe4a0('0xb')]);router[_0xe4a0('0x7')](_0xe4a0('0xc'),auth[_0xe4a0('0x8')](),controller[_0xe4a0('0xd')]);router['post']('/',auth[_0xe4a0('0x8')](),interaction[_0xe4a0('0xe')](_0xe4a0('0xf'),_0xe4a0('0x10')),controller[_0xe4a0('0x11')]);router[_0xe4a0('0x12')](_0xe4a0('0x13'),controller[_0xe4a0('0x14')]);router[_0xe4a0('0x15')](_0xe4a0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe4a0('0x15')](_0xe4a0('0x16'),auth['isAuthenticated'](),controller[_0xe4a0('0x17')]);router[_0xe4a0('0x15')](_0xe4a0('0x18'),auth['isAuthenticated'](),controller[_0xe4a0('0x19')]);router['delete']('/:id',auth[_0xe4a0('0x8')](),controller['destroy']);module[_0xe4a0('0x1a')]=router; \ No newline at end of file +var _0x500c=['/:id','show','post','sms','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index'];(function(_0x5d867e,_0x4bf471){var _0x2924ea=function(_0x5ada6d){while(--_0x5ada6d){_0x5d867e['push'](_0x5d867e['shift']());}};_0x2924ea(++_0x4bf471);}(_0x500c,0x188));var _0xc500=function(_0x1cb1a0,_0x4f2037){_0x1cb1a0=_0x1cb1a0-0x0;var _0x58830e=_0x500c[_0x1cb1a0];return _0x58830e;};'use strict';var multer=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var path=require(_0xc500('0x2'));var timeout=require(_0xc500('0x3'));var express=require(_0xc500('0x4'));var router=express[_0xc500('0x5')]();var fs_extra=require(_0xc500('0x6'));var auth=require(_0xc500('0x7'));var interaction=require(_0xc500('0x8'));var config=require(_0xc500('0x9'));var controller=require(_0xc500('0xa'));router[_0xc500('0xb')]('/',auth[_0xc500('0xc')](),controller[_0xc500('0xd')]);router[_0xc500('0xb')]('/describe',auth[_0xc500('0xc')](),controller['describe']);router[_0xc500('0xb')](_0xc500('0xe'),auth[_0xc500('0xc')](),controller[_0xc500('0xf')]);router[_0xc500('0x10')]('/',auth[_0xc500('0xc')](),interaction['tracked'](_0xc500('0x11'),'smsmessage:create'),controller[_0xc500('0x12')]);router['post']('/:id/status',controller[_0xc500('0x13')]);router[_0xc500('0x14')]('/:id',auth[_0xc500('0xc')](),controller[_0xc500('0x15')]);router[_0xc500('0x14')](_0xc500('0x16'),auth[_0xc500('0xc')](),controller[_0xc500('0x17')]);router[_0xc500('0x14')](_0xc500('0x18'),auth['isAuthenticated'](),controller[_0xc500('0x19')]);router[_0xc500('0x1a')]('/:id',auth[_0xc500('0xc')](),controller[_0xc500('0x1b')]);module[_0xc500('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d7fb14d..8b3e178 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 _0x52ad=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x1233d2,_0x5416f4){var _0x22759e=function(_0xb516aa){while(--_0xb516aa){_0x1233d2['push'](_0x1233d2['shift']());}};_0x22759e(++_0x5416f4);}(_0x52ad,0x1d8));var _0xd52a=function(_0x134ee1,_0x1b726f){_0x134ee1=_0x134ee1-0x0;var _0x391f03=_0x52ad[_0x134ee1];return _0x391f03;};'use strict';var Sequelize=require(_0xd52a('0x0'));module[_0xd52a('0x1')]={'body':{'type':Sequelize[_0xd52a('0x2')](_0xd52a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd52a('0x4')]('in',_0xd52a('0x5')),'defaultValue':_0xd52a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd52a('0x6')](0xbe)},'phone':{'type':Sequelize[_0xd52a('0x6')]},'readAt':{'type':Sequelize[_0xd52a('0x7')]},'secret':{'type':Sequelize[_0xd52a('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd52a('0x6')]},'providerResponse':{'type':Sequelize[_0xd52a('0x2')]}}; \ No newline at end of file +var _0x321f=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT'];(function(_0x5e772e,_0x10855d){var _0x496510=function(_0x25d78e){while(--_0x25d78e){_0x5e772e['push'](_0x5e772e['shift']());}};_0x496510(++_0x10855d);}(_0x321f,0x91));var _0xf321=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x321f[_0x34d346];return _0x122d76;};'use strict';var Sequelize=require(_0xf321('0x0'));module['exports']={'body':{'type':Sequelize[_0xf321('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf321('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf321('0x3')]('in',_0xf321('0x4')),'defaultValue':_0xf321('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf321('0x5')](0xbe)},'phone':{'type':Sequelize[_0xf321('0x5')]},'readAt':{'type':Sequelize[_0xf321('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf321('0x5')]},'providerResponse':{'type':Sequelize[_0xf321('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f7786e9..353e255 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 _0xa742=['create','body','destroy','describe','../../config/logger','sms-interactions','accept','readAt','format','UserId','user','get','SmsInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','manual','interface','channel','event','EventManager','acceptmessage','sms','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','internal','SIP/%s','motionChannel','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','MessageUUID','indexOf','sent','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','DELIVERED','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','SmsMessage','includeAll','include','rows','catch','params','rawAttributes','find'];(function(_0x1487f4,_0x1c2765){var _0x2a98d9=function(_0x143bbe){while(--_0x143bbe){_0x1487f4['push'](_0x1487f4['shift']());}};_0x2a98d9(++_0x1c2765);}(_0xa742,0xc7));var _0x2a74=function(_0x556d13,_0x48317d){_0x556d13=_0x556d13-0x0;var _0x311eff=_0xa742[_0x556d13];return _0x311eff;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2a74('0x0'));var rp=require(_0x2a74('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a74('0x2'));var util=require('util');var path=require(_0x2a74('0x3'));var sox=require(_0x2a74('0x4'));var csv=require(_0x2a74('0x5'));var ejs=require(_0x2a74('0x6'));var fs=require('fs');var fs_extra=require(_0x2a74('0x7'));var _=require(_0x2a74('0x8'));var squel=require(_0x2a74('0x9'));var crypto=require(_0x2a74('0xa'));var jsforce=require(_0x2a74('0xb'));var deskjs=require(_0x2a74('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2a74('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2a74('0xe'));var qs=require(_0x2a74('0xf'));var as=require(_0x2a74('0x10'));var hardwareService=require(_0x2a74('0x11'));var logger=require('../../config/logger')(_0x2a74('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2a74('0x13')]=_['defaults'](config['redis'],{'host':_0x2a74('0x14'),'port':0x18eb});var socket=require(_0x2a74('0x15'))(new Redis(config[_0x2a74('0x13')]));require(_0x2a74('0x16'))[_0x2a74('0x17')](socket);var jayson=require(_0x2a74('0x18'));var client=jayson[_0x2a74('0x19')][_0x2a74('0x1a')]({'port':0x232c});var client9002=jayson[_0x2a74('0x19')][_0x2a74('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x39788d,_0x27a446,_0x396fd0,_0x57004c){return new BPromise(function(_0x1f9fd6,_0x5760d6){var _0x695e54=_0x57004c||client;return _0x695e54[_0x2a74('0x1b')](_0x39788d,_0x396fd0)[_0x2a74('0x1c')](function(_0x115064){logger[_0x2a74('0x1d')](_0x2a74('0x1e'),_0x27a446,_0x2a74('0x1f'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27a446,_0x2a74('0x1f'),JSON['stringify'](_0x115064));if(_0x115064[_0x2a74('0x20')]){if(_0x115064[_0x2a74('0x20')][_0x2a74('0x21')]===0x1f4){logger[_0x2a74('0x20')](_0x2a74('0x1e'),_0x27a446,_0x115064[_0x2a74('0x20')][_0x2a74('0x22')]);return _0x5760d6(_0x115064[_0x2a74('0x20')][_0x2a74('0x22')]);}logger[_0x2a74('0x20')]('SmsMessage,\x20%s,\x20%s',_0x27a446,_0x115064['error'][_0x2a74('0x22')]);return _0x1f9fd6(_0x115064[_0x2a74('0x20')][_0x2a74('0x22')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x27a446,_0x2a74('0x1f'));_0x1f9fd6(_0x115064[_0x2a74('0x23')][_0x2a74('0x22')]);}})['catch'](function(_0xd4201){logger[_0x2a74('0x20')](_0x2a74('0x1e'),_0x27a446,_0xd4201);_0x5760d6(_0xd4201);});});}function respondWithStatusCode(_0x151b26,_0x2149e9){_0x2149e9=_0x2149e9||0xcc;return function(_0x49d068){if(_0x49d068){return _0x151b26['sendStatus'](_0x2149e9);}return _0x151b26[_0x2a74('0x24')](_0x2149e9)[_0x2a74('0x25')]();};}function respondWithResult(_0x4c04b1,_0x156b12){_0x156b12=_0x156b12||0xc8;return function(_0x86e836){if(_0x86e836){return _0x4c04b1[_0x2a74('0x24')](_0x156b12)[_0x2a74('0x26')](_0x86e836);}};}function respondWithFilteredResult(_0x59fbcf,_0x221179){return function(_0x191e15){if(_0x191e15){var _0x3087eb=typeof _0x221179[_0x2a74('0x27')]===_0x2a74('0x28')&&typeof _0x221179[_0x2a74('0x29')]===_0x2a74('0x28');var _0xf78e97=_0x191e15[_0x2a74('0x2a')];var _0x34d08e=_0x3087eb?0x0:_0x221179['offset'];var _0x772f30=_0x3087eb?_0x191e15[_0x2a74('0x2a')]:_0x221179[_0x2a74('0x27')]+_0x221179[_0x2a74('0x29')];var _0x5d3877;if(_0x772f30>=_0xf78e97){_0x772f30=_0xf78e97;_0x5d3877=0xc8;}else{_0x5d3877=0xce;}_0x59fbcf['status'](_0x5d3877);return _0x59fbcf[_0x2a74('0x2b')]('Content-Range',_0x34d08e+'-'+_0x772f30+'/'+_0xf78e97)[_0x2a74('0x26')](_0x191e15);}return null;};}function patchUpdates(_0x5ca94d){return function(_0x17c7ff){try{jsonpatch[_0x2a74('0x2c')](_0x17c7ff,_0x5ca94d,!![]);}catch(_0x5bbe7f){return BPromise[_0x2a74('0x2d')](_0x5bbe7f);}return _0x17c7ff[_0x2a74('0x2e')]();};}function saveUpdates(_0x228d1b,_0x4a8856){return function(_0xd2e0c9){if(_0xd2e0c9){return _0xd2e0c9[_0x2a74('0x2f')](_0x228d1b)[_0x2a74('0x1c')](function(_0x2ad323){return _0x2ad323;});}return null;};}function removeEntity(_0x5d0e24,_0x58b33f){return function(_0x257a49){if(_0x257a49){return _0x257a49['destroy']()[_0x2a74('0x1c')](function(){_0x5d0e24['status'](0xcc)[_0x2a74('0x25')]();});}};}function handleEntityNotFound(_0x200f9,_0x36d3ce){return function(_0x455f85){if(!_0x455f85){_0x200f9[_0x2a74('0x30')](0x194);}return _0x455f85;};}function handleError(_0x3e70c8,_0x3d8612){_0x3d8612=_0x3d8612||0x1f4;return function(_0x5e3d7e){logger[_0x2a74('0x20')](_0x5e3d7e[_0x2a74('0x31')]);if(_0x5e3d7e[_0x2a74('0x32')]){delete _0x5e3d7e['name'];}_0x3e70c8[_0x2a74('0x24')](_0x3d8612)[_0x2a74('0x33')](_0x5e3d7e);};}exports[_0x2a74('0x34')]=function(_0x522df6,_0x47c41f){var _0x2cef59={},_0x3fd012={},_0x5cb0a2={'count':0x0,'rows':[]};var _0x5f0faf=_[_0x2a74('0x35')](db['SmsMessage']['rawAttributes'],function(_0x3ef60a){return{'name':_0x3ef60a[_0x2a74('0x36')],'type':_0x3ef60a[_0x2a74('0x37')][_0x2a74('0x38')]};});_0x3fd012[_0x2a74('0x39')]=_['map'](_0x5f0faf,_0x2a74('0x32'));_0x3fd012[_0x2a74('0x3a')]=_[_0x2a74('0x3b')](_0x522df6[_0x2a74('0x3a')]);_0x3fd012['filters']=_[_0x2a74('0x3c')](_0x3fd012[_0x2a74('0x39')],_0x3fd012['query']);_0x2cef59[_0x2a74('0x3d')]=_[_0x2a74('0x3c')](_0x3fd012[_0x2a74('0x39')],qs['fields'](_0x522df6[_0x2a74('0x3a')][_0x2a74('0x3e')]));_0x2cef59[_0x2a74('0x3d')]=_0x2cef59[_0x2a74('0x3d')][_0x2a74('0x3f')]?_0x2cef59['attributes']:_0x3fd012['model'];if(!_0x522df6['query'][_0x2a74('0x40')](_0x2a74('0x41'))){_0x2cef59[_0x2a74('0x29')]=qs[_0x2a74('0x29')](_0x522df6[_0x2a74('0x3a')][_0x2a74('0x29')]);_0x2cef59[_0x2a74('0x27')]=qs[_0x2a74('0x27')](_0x522df6['query'][_0x2a74('0x27')]);}_0x2cef59[_0x2a74('0x42')]=qs['sort'](_0x522df6['query'][_0x2a74('0x43')]);_0x2cef59[_0x2a74('0x44')]=qs[_0x2a74('0x45')](_['pick'](_0x522df6['query'],_0x3fd012['filters']),_0x5f0faf);if(_0x522df6[_0x2a74('0x3a')]['filter']){_0x2cef59[_0x2a74('0x44')]=_[_0x2a74('0x46')](_0x2cef59[_0x2a74('0x44')],{'$or':_['map'](_0x5f0faf,function(_0x346f0d){if(_0x346f0d['type']!==_0x2a74('0x47')){var _0x5d69b7={};_0x5d69b7[_0x346f0d['name']]={'$like':'%'+_0x522df6['query']['filter']+'%'};return _0x5d69b7;}})});}_0x2cef59=_[_0x2a74('0x46')]({},_0x2cef59,_0x522df6[_0x2a74('0x48')]);var _0x110636={'where':_0x2cef59[_0x2a74('0x44')]};return db[_0x2a74('0x49')][_0x2a74('0x2a')](_0x110636)['then'](function(_0x3fb3a9){_0x5cb0a2['count']=_0x3fb3a9;if(_0x522df6[_0x2a74('0x3a')][_0x2a74('0x4a')]){_0x2cef59[_0x2a74('0x4b')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2cef59);})['then'](function(_0x33412f){_0x5cb0a2[_0x2a74('0x4c')]=_0x33412f;return _0x5cb0a2;})[_0x2a74('0x1c')](respondWithFilteredResult(_0x47c41f,_0x2cef59))[_0x2a74('0x4d')](handleError(_0x47c41f,null));};exports['show']=function(_0xb0c50e,_0x577196){var _0x180bc6={'raw':!![],'where':{'id':_0xb0c50e[_0x2a74('0x4e')]['id']}},_0x164297={};_0x164297[_0x2a74('0x39')]=_['keys'](db[_0x2a74('0x49')][_0x2a74('0x4f')]);_0x164297[_0x2a74('0x3a')]=_['keys'](_0xb0c50e[_0x2a74('0x3a')]);_0x164297[_0x2a74('0x45')]=_[_0x2a74('0x3c')](_0x164297[_0x2a74('0x39')],_0x164297[_0x2a74('0x3a')]);_0x180bc6[_0x2a74('0x3d')]=_[_0x2a74('0x3c')](_0x164297['model'],qs[_0x2a74('0x3e')](_0xb0c50e[_0x2a74('0x3a')][_0x2a74('0x3e')]));_0x180bc6['attributes']=_0x180bc6[_0x2a74('0x3d')][_0x2a74('0x3f')]?_0x180bc6['attributes']:_0x164297[_0x2a74('0x39')];if(_0xb0c50e[_0x2a74('0x3a')][_0x2a74('0x4a')]){_0x180bc6['include']=[{'all':!![]}];}_0x180bc6=_[_0x2a74('0x46')]({},_0x180bc6,_0xb0c50e['options']);return db[_0x2a74('0x49')][_0x2a74('0x50')](_0x180bc6)[_0x2a74('0x1c')](handleEntityNotFound(_0x577196,null))[_0x2a74('0x1c')](respondWithResult(_0x577196,null))[_0x2a74('0x4d')](handleError(_0x577196,null));};exports['create']=function(_0x3dea41,_0xbc11c2){return db[_0x2a74('0x49')][_0x2a74('0x51')](_0x3dea41['body'],{})[_0x2a74('0x1c')](respondWithResult(_0xbc11c2,0xc9))['catch'](handleError(_0xbc11c2,null));};exports[_0x2a74('0x2f')]=function(_0x4c724e,_0x3db512){if(_0x4c724e[_0x2a74('0x52')]['id']){delete _0x4c724e[_0x2a74('0x52')]['id'];}return db['SmsMessage'][_0x2a74('0x50')]({'where':{'id':_0x4c724e[_0x2a74('0x4e')]['id']}})[_0x2a74('0x1c')](handleEntityNotFound(_0x3db512,null))[_0x2a74('0x1c')](saveUpdates(_0x4c724e[_0x2a74('0x52')],null))[_0x2a74('0x1c')](respondWithResult(_0x3db512,null))[_0x2a74('0x4d')](handleError(_0x3db512,null));};exports[_0x2a74('0x53')]=function(_0x257b89,_0x16fd6e){return db['SmsMessage'][_0x2a74('0x50')]({'where':{'id':_0x257b89[_0x2a74('0x4e')]['id']}})[_0x2a74('0x1c')](handleEntityNotFound(_0x16fd6e,null))[_0x2a74('0x1c')](removeEntity(_0x16fd6e,null))[_0x2a74('0x4d')](handleError(_0x16fd6e,null));};exports['describe']=function(_0x260e4d,_0x4b0c2e){return db[_0x2a74('0x49')][_0x2a74('0x54')]()[_0x2a74('0x1c')](respondWithResult(_0x4b0c2e,null))[_0x2a74('0x4d')](handleError(_0x4b0c2e,null));};var interaction_log=require(_0x2a74('0x55'))(_0x2a74('0x56'));exports[_0x2a74('0x57')]=function(_0x34e586,_0x2d2ac8,_0x4d5fd3){var _0x146540={'agent':{},'channel':'sms'};if(_0x34e586[_0x2a74('0x52')]['id']){delete _0x34e586[_0x2a74('0x52')]['id'];}_0x34e586[_0x2a74('0x52')]['read']=!![];_0x34e586[_0x2a74('0x52')][_0x2a74('0x58')]=moment()[_0x2a74('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')]=_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')]||_0x34e586[_0x2a74('0x5b')]['id'];_0x146540['agent']['id']=_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')];return db['SmsMessage']['find']({'where':{'id':_0x34e586[_0x2a74('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d2ac8,null))['then'](saveUpdates(_0x34e586['body'],null))[_0x2a74('0x1c')](function(_0x3b3f6d){if(_0x3b3f6d){_0x146540[_0x2a74('0x22')]=_0x3b3f6d[_0x2a74('0x5c')]({'plain':!![]});return db[_0x2a74('0x5d')][_0x2a74('0x50')]({'where':{'id':_0x3b3f6d['SmsInteractionId']}});}return null;})[_0x2a74('0x1c')](handleEntityNotFound(_0x2d2ac8,null))[_0x2a74('0x1c')](function(_0x390812){if(_0x390812){return _0x390812[_0x2a74('0x2f')]({'UserId':_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')],'read1stAt':_[_0x2a74('0x5e')](_0x390812['read1stAt'])?moment()[_0x2a74('0x59')](_0x2a74('0x5f')):undefined});}return null;})[_0x2a74('0x1c')](function(_0x28baf3){if(_0x28baf3){_0x146540['interaction']=_0x28baf3[_0x2a74('0x5c')]({'plain':!![]});interaction_log[_0x2a74('0x1d')](_0x2a74('0x60'),_0x34e586['user']['id'],_0x34e586[_0x2a74('0x5b')][_0x2a74('0x32')],_0x34e586[_0x2a74('0x5b')][_0x2a74('0x61')],_0x146540['interaction']['id'],_0x34e586[_0x2a74('0x52')]?JSON['stringify'](_0x34e586['body']):_0x2a74('0x62'));return respondWithRpcPromise(_0x2a74('0x63'),'acceptMessage',_0x146540);}return null;})['then'](function(_0x14427f){var _0x511e18=_0x2a74('0x64')+_0x14427f[_0x2a74('0x22')]['ContactId'];return db[_0x2a74('0x65')][_0x2a74('0x3a')](_0x511e18,{'type':db[_0x2a74('0x66')][_0x2a74('0x67')]['SELECT'],'raw':!![]})[_0x2a74('0x1c')](function(_0x3dec02){return _0x3dec02;});})[_0x2a74('0x1c')](function(_0x474cf4){if(_0x474cf4){_0x146540['message'][_0x2a74('0x68')]=_0x474cf4[0x0];if(!_0x34e586[_0x2a74('0x52')][_0x2a74('0x5a')])return;return db[_0x2a74('0x69')]['find']({'where':{'id':_0x34e586['body']['UserId'],'role':_0x2a74('0x6a')},'attributes':['id',_0x2a74('0x32'),_0x2a74('0x6b'),_0x2a74('0x6c'),'internal'],'raw':!![]});}return null;})[_0x2a74('0x1c')](function(_0x4fbd8f){if(!_0x4fbd8f)return null;_0x146540['message']['agent']=_0x4fbd8f;return _0x146540;})['then'](function(_0x2bf81f){if(_0x2bf81f){if(_0x34e586[_0x2a74('0x52')][_0x2a74('0x6d')]){_0x146540[_0x2a74('0x22')][_0x2a74('0x6e')]=util[_0x2a74('0x59')]('SIP/%s',_0x34e586[_0x2a74('0x5b')][_0x2a74('0x32')]);_0x146540[_0x2a74('0x22')][_0x2a74('0x6f')]=_0x146540[_0x2a74('0x6f')];_0x146540['message']['motionChannel']=_0x146540[_0x2a74('0x6f')];_0x146540['message'][_0x2a74('0x70')]=_0x2a74('0x57');return respondWithRpcPromise(_0x2a74('0x71'),_0x2a74('0x71'),{'event':_0x2a74('0x72'),'message':_0x146540[_0x2a74('0x22')]},client9002)[_0x2a74('0x1c')](function(){return _0x146540;});}return _0x146540;}return null;})[_0x2a74('0x1c')](respondWithResult(_0x2d2ac8,null))[_0x2a74('0x4d')](handleError(_0x2d2ac8,null));};var interaction_log=require('../../config/logger')(_0x2a74('0x56'));exports[_0x2a74('0x2d')]=function(_0x1fefb0,_0x59497f,_0x202d16){var _0x3efa32={'agent':{},'channel':_0x2a74('0x73')};if(_0x1fefb0['body']['id']){delete _0x1fefb0[_0x2a74('0x52')]['id'];}_0x1fefb0[_0x2a74('0x52')]['UserId']=_0x1fefb0['body']['UserId']||_0x1fefb0['user']['id'];_0x3efa32[_0x2a74('0x6a')]['id']=_0x1fefb0[_0x2a74('0x52')]['UserId'];return db[_0x2a74('0x49')][_0x2a74('0x50')]({'where':{'id':_0x1fefb0[_0x2a74('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x59497f,null))[_0x2a74('0x1c')](function(_0x2f6818){if(_0x2f6818){_0x3efa32['message']=_0x2f6818[_0x2a74('0x5c')]({'plain':!![]});return db[_0x2a74('0x5d')][_0x2a74('0x50')]({'where':{'id':_0x2f6818[_0x2a74('0x74')]}});}return null;})[_0x2a74('0x1c')](handleEntityNotFound(_0x59497f,null))[_0x2a74('0x1c')](function(_0x385d14){if(_0x385d14){_0x3efa32[_0x2a74('0x75')]=_0x385d14[_0x2a74('0x5c')]({'plain':!![]});interaction_log[_0x2a74('0x1d')](_0x2a74('0x76'),_0x1fefb0[_0x2a74('0x5b')]['id'],_0x1fefb0['user'][_0x2a74('0x32')],_0x1fefb0['user']['role'],_0x3efa32['interaction']['id'],_0x1fefb0['body']?JSON['stringify'](_0x1fefb0[_0x2a74('0x52')]):_0x2a74('0x62'));return respondWithRpcPromise(_0x2a74('0x77'),'rejectMessage',_0x3efa32);}return null;})[_0x2a74('0x1c')](function(_0x509315){var _0x4f603b=_0x2a74('0x64')+_0x509315[_0x2a74('0x22')]['ContactId'];return db[_0x2a74('0x65')]['query'](_0x4f603b,{'type':db['Sequelize'][_0x2a74('0x67')][_0x2a74('0x78')],'raw':!![]})[_0x2a74('0x1c')](function(_0x5cd1ea){return _0x5cd1ea;});})[_0x2a74('0x1c')](function(_0xeb8ab9){if(_0xeb8ab9){_0x3efa32[_0x2a74('0x22')]['contact']=_0xeb8ab9[0x0];if(!_0x1fefb0[_0x2a74('0x52')][_0x2a74('0x5a')])return;return db[_0x2a74('0x69')]['find']({'where':{'id':_0x1fefb0[_0x2a74('0x52')][_0x2a74('0x5a')],'role':_0x2a74('0x6a')},'attributes':['id',_0x2a74('0x32'),_0x2a74('0x6b'),_0x2a74('0x6c'),_0x2a74('0x79')],'raw':!![]});}return null;})[_0x2a74('0x1c')](function(_0x5f518d){if(!_0x5f518d)return null;_0x3efa32['message'][_0x2a74('0x6a')]=_0x5f518d;return _0x3efa32;})['then'](function(_0x593f58){if(_0x593f58){_0x593f58[_0x2a74('0x22')]['interface']=util[_0x2a74('0x59')](_0x2a74('0x7a'),_0x1fefb0[_0x2a74('0x5b')][_0x2a74('0x32')]);_0x593f58[_0x2a74('0x22')]['channel']=_0x3efa32[_0x2a74('0x6f')];_0x593f58[_0x2a74('0x22')][_0x2a74('0x7b')]=_0x3efa32[_0x2a74('0x6f')];_0x593f58['message'][_0x2a74('0x70')]=_0x2a74('0x2d');respondWithRpcPromise(_0x2a74('0x71'),_0x2a74('0x71'),{'event':'rejectmessage','message':_0x593f58[_0x2a74('0x22')]},client9002);return _0x3efa32;}return null;})['then'](respondWithResult(_0x59497f,null))[_0x2a74('0x4d')](handleError(_0x59497f,null));};exports[_0x2a74('0x24')]=function(_0x5ac2fd,_0x311424,_0x593bf5){if(_0x5ac2fd[_0x2a74('0x52')]['id']){delete _0x5ac2fd['body']['id'];}var _0x44d3d4;return db[_0x2a74('0x49')][_0x2a74('0x50')]({'where':{'id':_0x5ac2fd[_0x2a74('0x4e')]['id']}})[_0x2a74('0x1c')](handleEntityNotFound(_0x311424,null))['then'](function(_0x1604e7){if(_0x1604e7){_0x44d3d4=_0x1604e7;return db[_0x2a74('0x7c')][_0x2a74('0x50')]({'where':{'id':_0x1604e7[_0x2a74('0x7d')]}});}})[_0x2a74('0x1c')](handleEntityNotFound(_0x311424,null))[_0x2a74('0x1c')](function(_0x8b7c59){if(_0x8b7c59){logger[_0x2a74('0x7e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2a74('0x24'),_0x2a74('0x7f'),_0x8b7c59[_0x2a74('0x37')],util[_0x2a74('0x80')](_0x5ac2fd['body'],{'showHidden':![],'depth':null}));switch(_0x8b7c59[_0x2a74('0x37')]){case'twilio':if(_0x5ac2fd['body'][_0x2a74('0x81')]&&_0x5ac2fd[_0x2a74('0x52')][_0x2a74('0x81')]===_0x44d3d4[_0x2a74('0x82')]){return _0x44d3d4[_0x2a74('0x2f')]({'read':!![]});}else{logger[_0x2a74('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a74('0x24'),_0x2a74('0x83'),util[_0x2a74('0x80')](_0x5ac2fd[_0x2a74('0x52')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5ac2fd['body']['MessageUUID']&&_0x5ac2fd[_0x2a74('0x52')][_0x2a74('0x84')]===_0x44d3d4['messageId']&&_[_0x2a74('0x85')]([_0x2a74('0x86'),'delivered'],_0x5ac2fd['body']['Status'])>=0x0){return _0x44d3d4[_0x2a74('0x2f')]({'read':!![]});}else{logger[_0x2a74('0x20')](_0x2a74('0x87'),'status',_0x2a74('0x88'),util[_0x2a74('0x80')](_0x5ac2fd[_0x2a74('0x52')],{'showHidden':![],'depth':null}));}break;case _0x2a74('0x89'):var _0x41cdf7=_0x5ac2fd[_0x2a74('0x52')]['results'][0x0];if(_0x41cdf7['status'][_0x2a74('0x8a')]===_0x2a74('0x8b')){return _0x44d3d4[_0x2a74('0x2f')]({'read':!![]});}else{logger[_0x2a74('0x20')](_0x2a74('0x87'),_0x2a74('0x24'),_0x2a74('0x89'),util[_0x2a74('0x80')](_0x5ac2fd[_0x2a74('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x44d3d4;}})['then'](respondWithResult(_0x311424,null))[_0x2a74('0x4d')](handleError(_0x311424,null));}; \ No newline at end of file +var _0xcfcb=['../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./smsMessage.socket','register','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','name','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','SmsMessage','findAll','rows','catch','params','keys','rawAttributes','length','find','create','body','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','channel','motionChannel','acceptmessage','reject','role','RejectMessage','rejectMessage','User','SIP/%s','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','DELIVERED','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5cca9f,_0x154684){var _0x55edda=function(_0x115aa2){while(--_0x115aa2){_0x5cca9f['push'](_0x5cca9f['shift']());}};_0x55edda(++_0x154684);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xcfcb[_0x3fe6df];return _0x372a0e;};'use strict';var emlformat=require(_0xbcfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbcfc('0x1'));var moment=require(_0xbcfc('0x2'));var BPromise=require(_0xbcfc('0x3'));var Mustache=require(_0xbcfc('0x4'));var util=require(_0xbcfc('0x5'));var path=require(_0xbcfc('0x6'));var sox=require(_0xbcfc('0x7'));var csv=require(_0xbcfc('0x8'));var ejs=require(_0xbcfc('0x9'));var fs=require('fs');var fs_extra=require(_0xbcfc('0xa'));var _=require(_0xbcfc('0xb'));var squel=require(_0xbcfc('0xc'));var crypto=require(_0xbcfc('0xd'));var jsforce=require(_0xbcfc('0xe'));var deskjs=require(_0xbcfc('0xf'));var toCsv=require(_0xbcfc('0x8'));var querystring=require(_0xbcfc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbcfc('0x11'));var hardwareService=require(_0xbcfc('0x12'));var logger=require(_0xbcfc('0x13'))(_0xbcfc('0x14'));var utils=require(_0xbcfc('0x15'));var config=require(_0xbcfc('0x16'));var licenseUtil=require(_0xbcfc('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xbcfc('0x18')](config[_0xbcfc('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbcfc('0x1a'))(new Redis(config['redis']));require(_0xbcfc('0x1b'))[_0xbcfc('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbcfc('0x1d')][_0xbcfc('0x1e')]({'port':0x232c});var client9002=jayson[_0xbcfc('0x1d')][_0xbcfc('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2053a3,_0x175407,_0x4cbac8,_0x3ec18c){return new BPromise(function(_0x125773,_0x4ba60c){var _0x1b38ec=_0x3ec18c||client;return _0x1b38ec[_0xbcfc('0x1f')](_0x2053a3,_0x4cbac8)['then'](function(_0x5550a6){logger[_0xbcfc('0x20')](_0xbcfc('0x21'),_0x175407,_0xbcfc('0x22'));logger['debug'](_0xbcfc('0x23'),_0x175407,_0xbcfc('0x22'),JSON[_0xbcfc('0x24')](_0x5550a6));if(_0x5550a6[_0xbcfc('0x25')]){if(_0x5550a6[_0xbcfc('0x25')]['code']===0x1f4){logger[_0xbcfc('0x25')](_0xbcfc('0x21'),_0x175407,_0x5550a6[_0xbcfc('0x25')]['message']);return _0x4ba60c(_0x5550a6['error'][_0xbcfc('0x26')]);}logger[_0xbcfc('0x25')](_0xbcfc('0x21'),_0x175407,_0x5550a6[_0xbcfc('0x25')][_0xbcfc('0x26')]);return _0x125773(_0x5550a6[_0xbcfc('0x25')][_0xbcfc('0x26')]);}else{logger['info'](_0xbcfc('0x21'),_0x175407,_0xbcfc('0x22'));_0x125773(_0x5550a6['result'][_0xbcfc('0x26')]);}})['catch'](function(_0x9a013f){logger[_0xbcfc('0x25')]('SmsMessage,\x20%s,\x20%s',_0x175407,_0x9a013f);_0x4ba60c(_0x9a013f);});});}function respondWithStatusCode(_0x31a504,_0x7f4bf4){_0x7f4bf4=_0x7f4bf4||0xcc;return function(_0x11a1ef){if(_0x11a1ef){return _0x31a504[_0xbcfc('0x27')](_0x7f4bf4);}return _0x31a504[_0xbcfc('0x28')](_0x7f4bf4)[_0xbcfc('0x29')]();};}function respondWithResult(_0x582e45,_0xcf366e){_0xcf366e=_0xcf366e||0xc8;return function(_0x53e9d9){if(_0x53e9d9){return _0x582e45[_0xbcfc('0x28')](_0xcf366e)['json'](_0x53e9d9);}};}function respondWithFilteredResult(_0x276165,_0x37d305){return function(_0x2a03b2){if(_0x2a03b2){var _0x2d5219=typeof _0x37d305[_0xbcfc('0x2a')]===_0xbcfc('0x2b')&&typeof _0x37d305[_0xbcfc('0x2c')]===_0xbcfc('0x2b');var _0x9bb1b7=_0x2a03b2[_0xbcfc('0x2d')];var _0xfc665d=_0x2d5219?0x0:_0x37d305['offset'];var _0x183cdb=_0x2d5219?_0x2a03b2['count']:_0x37d305[_0xbcfc('0x2a')]+_0x37d305[_0xbcfc('0x2c')];var _0x421925;if(_0x183cdb>=_0x9bb1b7){_0x183cdb=_0x9bb1b7;_0x421925=0xc8;}else{_0x421925=0xce;}_0x276165[_0xbcfc('0x28')](_0x421925);return _0x276165[_0xbcfc('0x2e')]('Content-Range',_0xfc665d+'-'+_0x183cdb+'/'+_0x9bb1b7)[_0xbcfc('0x2f')](_0x2a03b2);}return null;};}function patchUpdates(_0x236637){return function(_0x15f9d9){try{jsonpatch[_0xbcfc('0x30')](_0x15f9d9,_0x236637,!![]);}catch(_0x36be70){return BPromise['reject'](_0x36be70);}return _0x15f9d9[_0xbcfc('0x31')]();};}function saveUpdates(_0x3853c4,_0x5e57b3){return function(_0x3eec4b){if(_0x3eec4b){return _0x3eec4b[_0xbcfc('0x32')](_0x3853c4)['then'](function(_0x5cdc5d){return _0x5cdc5d;});}return null;};}function removeEntity(_0xbb0f2b,_0x378d2d){return function(_0x257024){if(_0x257024){return _0x257024[_0xbcfc('0x33')]()[_0xbcfc('0x34')](function(){_0xbb0f2b[_0xbcfc('0x28')](0xcc)[_0xbcfc('0x29')]();});}};}function handleEntityNotFound(_0x10f222,_0x1c4bb7){return function(_0x1dc0b7){if(!_0x1dc0b7){_0x10f222['sendStatus'](0x194);}return _0x1dc0b7;};}function handleError(_0xa0844b,_0x376bd7){_0x376bd7=_0x376bd7||0x1f4;return function(_0x50e895){logger[_0xbcfc('0x25')](_0x50e895['stack']);if(_0x50e895[_0xbcfc('0x35')]){delete _0x50e895[_0xbcfc('0x35')];}_0xa0844b[_0xbcfc('0x28')](_0x376bd7)['send'](_0x50e895);};}exports['index']=function(_0x3d7f82,_0xfe8fdd){var _0x174698={},_0x513e88={},_0x354d10={'count':0x0,'rows':[]};var _0x9b7eed=_['map'](db['SmsMessage']['rawAttributes'],function(_0x54d90d){return{'name':_0x54d90d['fieldName'],'type':_0x54d90d['type']['key']};});_0x513e88[_0xbcfc('0x36')]=_[_0xbcfc('0x37')](_0x9b7eed,'name');_0x513e88['query']=_['keys'](_0x3d7f82[_0xbcfc('0x38')]);_0x513e88[_0xbcfc('0x39')]=_[_0xbcfc('0x3a')](_0x513e88['model'],_0x513e88['query']);_0x174698[_0xbcfc('0x3b')]=_[_0xbcfc('0x3a')](_0x513e88[_0xbcfc('0x36')],qs[_0xbcfc('0x3c')](_0x3d7f82['query']['fields']));_0x174698[_0xbcfc('0x3b')]=_0x174698['attributes']['length']?_0x174698['attributes']:_0x513e88[_0xbcfc('0x36')];if(!_0x3d7f82[_0xbcfc('0x38')][_0xbcfc('0x3d')](_0xbcfc('0x3e'))){_0x174698['limit']=qs[_0xbcfc('0x2c')](_0x3d7f82[_0xbcfc('0x38')][_0xbcfc('0x2c')]);_0x174698['offset']=qs[_0xbcfc('0x2a')](_0x3d7f82[_0xbcfc('0x38')][_0xbcfc('0x2a')]);}_0x174698[_0xbcfc('0x3f')]=qs[_0xbcfc('0x40')](_0x3d7f82[_0xbcfc('0x38')]['sort']);_0x174698[_0xbcfc('0x41')]=qs[_0xbcfc('0x39')](_[_0xbcfc('0x42')](_0x3d7f82[_0xbcfc('0x38')],_0x513e88[_0xbcfc('0x39')]),_0x9b7eed);if(_0x3d7f82['query'][_0xbcfc('0x43')]){_0x174698[_0xbcfc('0x41')]=_['merge'](_0x174698[_0xbcfc('0x41')],{'$or':_[_0xbcfc('0x37')](_0x9b7eed,function(_0x531b48){if(_0x531b48[_0xbcfc('0x44')]!==_0xbcfc('0x45')){var _0xe6f9e7={};_0xe6f9e7[_0x531b48[_0xbcfc('0x35')]]={'$like':'%'+_0x3d7f82[_0xbcfc('0x38')]['filter']+'%'};return _0xe6f9e7;}})});}_0x174698=_[_0xbcfc('0x46')]({},_0x174698,_0x3d7f82[_0xbcfc('0x47')]);var _0x16c272={'where':_0x174698[_0xbcfc('0x41')]};return db['SmsMessage'][_0xbcfc('0x2d')](_0x16c272)[_0xbcfc('0x34')](function(_0x49edd8){_0x354d10['count']=_0x49edd8;if(_0x3d7f82[_0xbcfc('0x38')][_0xbcfc('0x48')]){_0x174698[_0xbcfc('0x49')]=[{'all':!![]}];}return db[_0xbcfc('0x4a')][_0xbcfc('0x4b')](_0x174698);})[_0xbcfc('0x34')](function(_0x535db7){_0x354d10[_0xbcfc('0x4c')]=_0x535db7;return _0x354d10;})[_0xbcfc('0x34')](respondWithFilteredResult(_0xfe8fdd,_0x174698))[_0xbcfc('0x4d')](handleError(_0xfe8fdd,null));};exports['show']=function(_0x25c3b9,_0x445d4a){var _0x2fea33={'raw':!![],'where':{'id':_0x25c3b9[_0xbcfc('0x4e')]['id']}},_0x249010={};_0x249010[_0xbcfc('0x36')]=_[_0xbcfc('0x4f')](db['SmsMessage'][_0xbcfc('0x50')]);_0x249010[_0xbcfc('0x38')]=_[_0xbcfc('0x4f')](_0x25c3b9[_0xbcfc('0x38')]);_0x249010[_0xbcfc('0x39')]=_[_0xbcfc('0x3a')](_0x249010[_0xbcfc('0x36')],_0x249010[_0xbcfc('0x38')]);_0x2fea33[_0xbcfc('0x3b')]=_[_0xbcfc('0x3a')](_0x249010[_0xbcfc('0x36')],qs[_0xbcfc('0x3c')](_0x25c3b9['query'][_0xbcfc('0x3c')]));_0x2fea33[_0xbcfc('0x3b')]=_0x2fea33[_0xbcfc('0x3b')][_0xbcfc('0x51')]?_0x2fea33[_0xbcfc('0x3b')]:_0x249010[_0xbcfc('0x36')];if(_0x25c3b9['query'][_0xbcfc('0x48')]){_0x2fea33[_0xbcfc('0x49')]=[{'all':!![]}];}_0x2fea33=_[_0xbcfc('0x46')]({},_0x2fea33,_0x25c3b9[_0xbcfc('0x47')]);return db[_0xbcfc('0x4a')][_0xbcfc('0x52')](_0x2fea33)[_0xbcfc('0x34')](handleEntityNotFound(_0x445d4a,null))[_0xbcfc('0x34')](respondWithResult(_0x445d4a,null))['catch'](handleError(_0x445d4a,null));};exports['create']=function(_0x4ba5ed,_0xd0af26){return db[_0xbcfc('0x4a')][_0xbcfc('0x53')](_0x4ba5ed['body'],{})[_0xbcfc('0x34')](respondWithResult(_0xd0af26,0xc9))[_0xbcfc('0x4d')](handleError(_0xd0af26,null));};exports[_0xbcfc('0x32')]=function(_0x4d04c8,_0x4b2cdc){if(_0x4d04c8[_0xbcfc('0x54')]['id']){delete _0x4d04c8[_0xbcfc('0x54')]['id'];}return db['SmsMessage'][_0xbcfc('0x52')]({'where':{'id':_0x4d04c8['params']['id']}})[_0xbcfc('0x34')](handleEntityNotFound(_0x4b2cdc,null))[_0xbcfc('0x34')](saveUpdates(_0x4d04c8[_0xbcfc('0x54')],null))[_0xbcfc('0x34')](respondWithResult(_0x4b2cdc,null))['catch'](handleError(_0x4b2cdc,null));};exports['destroy']=function(_0xcacfa2,_0x55b7e2){return db[_0xbcfc('0x4a')]['find']({'where':{'id':_0xcacfa2[_0xbcfc('0x4e')]['id']}})[_0xbcfc('0x34')](handleEntityNotFound(_0x55b7e2,null))['then'](removeEntity(_0x55b7e2,null))[_0xbcfc('0x4d')](handleError(_0x55b7e2,null));};exports[_0xbcfc('0x55')]=function(_0x596b0c,_0x51aedc){return db[_0xbcfc('0x4a')][_0xbcfc('0x55')]()[_0xbcfc('0x34')](respondWithResult(_0x51aedc,null))[_0xbcfc('0x4d')](handleError(_0x51aedc,null));};var interaction_log=require(_0xbcfc('0x13'))(_0xbcfc('0x56'));exports[_0xbcfc('0x57')]=function(_0x24fc06,_0x43cf6b,_0x1ab2fd){var _0x3eaf1d={'agent':{},'channel':_0xbcfc('0x58')};if(_0x24fc06[_0xbcfc('0x54')]['id']){delete _0x24fc06[_0xbcfc('0x54')]['id'];}_0x24fc06[_0xbcfc('0x54')]['read']=!![];_0x24fc06[_0xbcfc('0x54')][_0xbcfc('0x59')]=moment()[_0xbcfc('0x5a')](_0xbcfc('0x5b'));_0x24fc06[_0xbcfc('0x54')][_0xbcfc('0x5c')]=_0x24fc06[_0xbcfc('0x54')][_0xbcfc('0x5c')]||_0x24fc06[_0xbcfc('0x5d')]['id'];_0x3eaf1d[_0xbcfc('0x5e')]['id']=_0x24fc06[_0xbcfc('0x54')][_0xbcfc('0x5c')];return db['SmsMessage'][_0xbcfc('0x52')]({'where':{'id':_0x24fc06['params']['id'],'UserId':null}})[_0xbcfc('0x34')](handleEntityNotFound(_0x43cf6b,null))['then'](saveUpdates(_0x24fc06['body'],null))[_0xbcfc('0x34')](function(_0x1b4d3a){if(_0x1b4d3a){_0x3eaf1d[_0xbcfc('0x26')]=_0x1b4d3a[_0xbcfc('0x5f')]({'plain':!![]});return db[_0xbcfc('0x60')]['find']({'where':{'id':_0x1b4d3a[_0xbcfc('0x61')]}});}return null;})[_0xbcfc('0x34')](handleEntityNotFound(_0x43cf6b,null))[_0xbcfc('0x34')](function(_0x2411b9){if(_0x2411b9){return _0x2411b9['update']({'UserId':_0x24fc06[_0xbcfc('0x54')]['UserId'],'read1stAt':_['isNil'](_0x2411b9['read1stAt'])?moment()[_0xbcfc('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xbcfc('0x34')](function(_0xf593c3){if(_0xf593c3){_0x3eaf1d[_0xbcfc('0x62')]=_0xf593c3['get']({'plain':!![]});interaction_log[_0xbcfc('0x20')](_0xbcfc('0x63'),_0x24fc06[_0xbcfc('0x5d')]['id'],_0x24fc06[_0xbcfc('0x5d')][_0xbcfc('0x35')],_0x24fc06[_0xbcfc('0x5d')]['role'],_0x3eaf1d['interaction']['id'],_0x24fc06['body']?JSON['stringify'](_0x24fc06[_0xbcfc('0x54')]):_0xbcfc('0x64'));return respondWithRpcPromise(_0xbcfc('0x65'),_0xbcfc('0x66'),_0x3eaf1d);}return null;})[_0xbcfc('0x34')](function(_0x1c8109){var _0x15f915='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c8109[_0xbcfc('0x26')]['ContactId'];return db[_0xbcfc('0x67')][_0xbcfc('0x38')](_0x15f915,{'type':db[_0xbcfc('0x68')][_0xbcfc('0x69')][_0xbcfc('0x6a')],'raw':!![]})['then'](function(_0x14ec22){return _0x14ec22;});})[_0xbcfc('0x34')](function(_0x393841){if(_0x393841){_0x3eaf1d[_0xbcfc('0x26')][_0xbcfc('0x6b')]=_0x393841[0x0];if(!_0x24fc06[_0xbcfc('0x54')][_0xbcfc('0x5c')])return;return db['User']['find']({'where':{'id':_0x24fc06[_0xbcfc('0x54')][_0xbcfc('0x5c')],'role':'agent'},'attributes':['id',_0xbcfc('0x35'),_0xbcfc('0x6c'),_0xbcfc('0x6d'),_0xbcfc('0x6e')],'raw':!![]});}return null;})[_0xbcfc('0x34')](function(_0x48846a){if(!_0x48846a)return null;_0x3eaf1d[_0xbcfc('0x26')][_0xbcfc('0x5e')]=_0x48846a;return _0x3eaf1d;})[_0xbcfc('0x34')](function(_0x170f09){if(_0x170f09){if(_0x24fc06[_0xbcfc('0x54')][_0xbcfc('0x6f')]){_0x3eaf1d['message'][_0xbcfc('0x70')]=util[_0xbcfc('0x5a')]('SIP/%s',_0x24fc06[_0xbcfc('0x5d')][_0xbcfc('0x35')]);_0x3eaf1d[_0xbcfc('0x26')][_0xbcfc('0x71')]=_0x3eaf1d[_0xbcfc('0x71')];_0x3eaf1d[_0xbcfc('0x26')][_0xbcfc('0x72')]=_0x3eaf1d[_0xbcfc('0x71')];_0x3eaf1d['message']['event']=_0xbcfc('0x57');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xbcfc('0x73'),'message':_0x3eaf1d[_0xbcfc('0x26')]},client9002)[_0xbcfc('0x34')](function(){return _0x3eaf1d;});}return _0x3eaf1d;}return null;})[_0xbcfc('0x34')](respondWithResult(_0x43cf6b,null))['catch'](handleError(_0x43cf6b,null));};var interaction_log=require('../../config/logger')(_0xbcfc('0x56'));exports[_0xbcfc('0x74')]=function(_0x51a4b3,_0x462c6e,_0x469949){var _0x215126={'agent':{},'channel':'sms'};if(_0x51a4b3[_0xbcfc('0x54')]['id']){delete _0x51a4b3[_0xbcfc('0x54')]['id'];}_0x51a4b3[_0xbcfc('0x54')][_0xbcfc('0x5c')]=_0x51a4b3[_0xbcfc('0x54')][_0xbcfc('0x5c')]||_0x51a4b3[_0xbcfc('0x5d')]['id'];_0x215126[_0xbcfc('0x5e')]['id']=_0x51a4b3[_0xbcfc('0x54')]['UserId'];return db[_0xbcfc('0x4a')][_0xbcfc('0x52')]({'where':{'id':_0x51a4b3[_0xbcfc('0x4e')]['id'],'UserId':null}})[_0xbcfc('0x34')](handleEntityNotFound(_0x462c6e,null))[_0xbcfc('0x34')](function(_0xed6823){if(_0xed6823){_0x215126['message']=_0xed6823[_0xbcfc('0x5f')]({'plain':!![]});return db['SmsInteraction'][_0xbcfc('0x52')]({'where':{'id':_0xed6823[_0xbcfc('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x462c6e,null))[_0xbcfc('0x34')](function(_0x15d102){if(_0x15d102){_0x215126[_0xbcfc('0x62')]=_0x15d102[_0xbcfc('0x5f')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51a4b3[_0xbcfc('0x5d')]['id'],_0x51a4b3[_0xbcfc('0x5d')][_0xbcfc('0x35')],_0x51a4b3['user'][_0xbcfc('0x75')],_0x215126['interaction']['id'],_0x51a4b3[_0xbcfc('0x54')]?JSON[_0xbcfc('0x24')](_0x51a4b3[_0xbcfc('0x54')]):_0xbcfc('0x64'));return respondWithRpcPromise(_0xbcfc('0x76'),_0xbcfc('0x77'),_0x215126);}return null;})[_0xbcfc('0x34')](function(_0x6724d){var _0x341d7f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x6724d[_0xbcfc('0x26')]['ContactId'];return db[_0xbcfc('0x67')][_0xbcfc('0x38')](_0x341d7f,{'type':db['Sequelize'][_0xbcfc('0x69')]['SELECT'],'raw':!![]})[_0xbcfc('0x34')](function(_0x1382e9){return _0x1382e9;});})[_0xbcfc('0x34')](function(_0xc401d0){if(_0xc401d0){_0x215126[_0xbcfc('0x26')]['contact']=_0xc401d0[0x0];if(!_0x51a4b3[_0xbcfc('0x54')][_0xbcfc('0x5c')])return;return db[_0xbcfc('0x78')][_0xbcfc('0x52')]({'where':{'id':_0x51a4b3['body'][_0xbcfc('0x5c')],'role':_0xbcfc('0x5e')},'attributes':['id','name',_0xbcfc('0x6c'),'email',_0xbcfc('0x6e')],'raw':!![]});}return null;})['then'](function(_0x4c9b55){if(!_0x4c9b55)return null;_0x215126['message'][_0xbcfc('0x5e')]=_0x4c9b55;return _0x215126;})[_0xbcfc('0x34')](function(_0x1bad06){if(_0x1bad06){_0x1bad06[_0xbcfc('0x26')]['interface']=util[_0xbcfc('0x5a')](_0xbcfc('0x79'),_0x51a4b3['user'][_0xbcfc('0x35')]);_0x1bad06[_0xbcfc('0x26')][_0xbcfc('0x71')]=_0x215126[_0xbcfc('0x71')];_0x1bad06[_0xbcfc('0x26')][_0xbcfc('0x72')]=_0x215126[_0xbcfc('0x71')];_0x1bad06['message'][_0xbcfc('0x7a')]=_0xbcfc('0x74');respondWithRpcPromise(_0xbcfc('0x7b'),_0xbcfc('0x7b'),{'event':_0xbcfc('0x7c'),'message':_0x1bad06['message']},client9002);return _0x215126;}return null;})[_0xbcfc('0x34')](respondWithResult(_0x462c6e,null))[_0xbcfc('0x4d')](handleError(_0x462c6e,null));};exports[_0xbcfc('0x28')]=function(_0x3f276b,_0x29d6a6,_0x1e1beb){if(_0x3f276b[_0xbcfc('0x54')]['id']){delete _0x3f276b['body']['id'];}var _0xaf7451;return db[_0xbcfc('0x4a')][_0xbcfc('0x52')]({'where':{'id':_0x3f276b[_0xbcfc('0x4e')]['id']}})[_0xbcfc('0x34')](handleEntityNotFound(_0x29d6a6,null))[_0xbcfc('0x34')](function(_0x427617){if(_0x427617){_0xaf7451=_0x427617;return db[_0xbcfc('0x7d')][_0xbcfc('0x52')]({'where':{'id':_0x427617[_0xbcfc('0x7e')]}});}})['then'](handleEntityNotFound(_0x29d6a6,null))['then'](function(_0x28fbb6){if(_0x28fbb6){logger[_0xbcfc('0x7f')](_0xbcfc('0x23'),_0xbcfc('0x28'),_0xbcfc('0x80'),_0x28fbb6[_0xbcfc('0x44')],util[_0xbcfc('0x81')](_0x3f276b[_0xbcfc('0x54')],{'showHidden':![],'depth':null}));switch(_0x28fbb6[_0xbcfc('0x44')]){case'twilio':if(_0x3f276b[_0xbcfc('0x54')][_0xbcfc('0x82')]&&_0x3f276b[_0xbcfc('0x54')]['MessageSid']===_0xaf7451[_0xbcfc('0x83')]){return _0xaf7451[_0xbcfc('0x32')]({'read':!![]});}else{logger[_0xbcfc('0x25')](_0xbcfc('0x84'),_0xbcfc('0x28'),_0xbcfc('0x85'),util[_0xbcfc('0x81')](_0x3f276b[_0xbcfc('0x54')],{'showHidden':![],'depth':null}));}break;case _0xbcfc('0x86'):if(_0x3f276b[_0xbcfc('0x54')][_0xbcfc('0x87')]&&_0x3f276b[_0xbcfc('0x54')][_0xbcfc('0x87')]===_0xaf7451['messageId']&&_[_0xbcfc('0x88')]([_0xbcfc('0x89'),_0xbcfc('0x8a')],_0x3f276b[_0xbcfc('0x54')]['Status'])>=0x0){return _0xaf7451[_0xbcfc('0x32')]({'read':!![]});}else{logger[_0xbcfc('0x25')](_0xbcfc('0x84'),'status',_0xbcfc('0x8b'),util[_0xbcfc('0x81')](_0x3f276b[_0xbcfc('0x54')],{'showHidden':![],'depth':null}));}break;case _0xbcfc('0x8c'):var _0x573112=_0x3f276b[_0xbcfc('0x54')][_0xbcfc('0x8d')][0x0];if(_0x573112['status']['groupName']===_0xbcfc('0x8e')){return _0xaf7451[_0xbcfc('0x32')]({'read':!![]});}else{logger[_0xbcfc('0x25')](_0xbcfc('0x84'),_0xbcfc('0x28'),_0xbcfc('0x8c'),util['inspect'](_0x3f276b[_0xbcfc('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xaf7451;}})[_0xbcfc('0x34')](respondWithResult(_0x29d6a6,null))[_0xbcfc('0x4d')](handleError(_0x29d6a6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1f33b00..adfc2cc 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 _0xa7b2=['hook','events','../../mysqldb','save','remove','emit'];(function(_0x257841,_0x389b4d){var _0x1b87ed=function(_0xceb19e){while(--_0xceb19e){_0x257841['push'](_0x257841['shift']());}};_0x1b87ed(++_0x389b4d);}(_0xa7b2,0x151));var _0x2a7b=function(_0x392a95,_0x1e4fbf){_0x392a95=_0x392a95-0x0;var _0x148306=_0xa7b2[_0x392a95];return _0x148306;};'use strict';var EventEmitter=require(_0x2a7b('0x0'));var SmsMessage=require(_0x2a7b('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a7b('0x2'),'afterUpdate':'update','afterDestroy':_0x2a7b('0x3')};function emitEvent(_0x3c5d34){return function(_0x571adf,_0x4c2869,_0x4d38d3){SmsMessageEvents[_0x2a7b('0x4')](_0x3c5d34+':'+_0x571adf['id'],_0x571adf);SmsMessageEvents[_0x2a7b('0x4')](_0x3c5d34,_0x571adf);_0x4d38d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x2a7b('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x6ce6=['../../mysqldb','SmsMessage','save','remove','emit','hook','exports','events'];(function(_0x44aad1,_0x1dc0ee){var _0x34356e=function(_0x45c212){while(--_0x45c212){_0x44aad1['push'](_0x44aad1['shift']());}};_0x34356e(++_0x1dc0ee);}(_0x6ce6,0x9f));var _0x66ce=function(_0x2e578b,_0x35e250){_0x2e578b=_0x2e578b-0x0;var _0x1cf29b=_0x6ce6[_0x2e578b];return _0x1cf29b;};'use strict';var EventEmitter=require(_0x66ce('0x0'));var SmsMessage=require(_0x66ce('0x1'))['db'][_0x66ce('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66ce('0x3'),'afterUpdate':'update','afterDestroy':_0x66ce('0x4')};function emitEvent(_0x5df3e6){return function(_0x1a463c,_0x4875c4,_0x300bc6){SmsMessageEvents[_0x66ce('0x5')](_0x5df3e6+':'+_0x1a463c['id'],_0x1a463c);SmsMessageEvents[_0x66ce('0x5')](_0x5df3e6,_0x1a463c);_0x300bc6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x66ce('0x6')](e,emitEvent(event));}}module[_0x66ce('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 7c1f1b6..f560881 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 _0x3afd=['accountSid','authToken','messages','phone','remote','/status?token=','token','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','smsMethod','login?username=','username','&password=','password','GET','split','sms','POST','user_key','total_sent','deliveryReport','read','update','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','%s:%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','text','timestamp','keys','length','apiKey','createHash','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','sms_messages','messageId','body','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','then','createdAt','SmsAccount','SmsAccountId','type','twilio'];(function(_0x520e33,_0x3d40d4){var _0x426cd3=function(_0x3fe952){while(--_0x3fe952){_0x520e33['push'](_0x520e33['shift']());}};_0x426cd3(++_0x3d40d4);}(_0x3afd,0x1c8));var _0xd3af=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x3afd[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0xd3af('0x0'));var util=require('util');var logger=require(_0xd3af('0x1'))(_0xd3af('0x2'));var moment=require(_0xd3af('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3af('0x4'));var fs=require('fs');var path=require(_0xd3af('0x5'));var rimraf=require(_0xd3af('0x6'));var config=require(_0xd3af('0x7'));var attributes=require(_0xd3af('0x8'));module['exports']=function(_0x592592,_0x23f7d3){return _0x592592['define'](_0xd3af('0x9'),attributes,{'tableName':_0xd3af('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd3af('0xb')]},{'name':'fti_sms_messages','fields':[_0xd3af('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2232b3,_0xc121ae,_0x6e3b1b){var _0x426ecc=_0x592592[_0xd3af('0xd')];var _0x14fb5e=_0x2232b3['get']({'plain':!![]});if(_0x14fb5e[_0xd3af('0xe')][_0xd3af('0xf')]()==='in'||_0x14fb5e[_0xd3af('0xe')][_0xd3af('0xf')]()===_0xd3af('0x10')&&!_0x14fb5e[_0xd3af('0x11')]&&!_[_0xd3af('0x12')](_0x14fb5e[_0xd3af('0x13')])&&!_['isNil'](_0x14fb5e[_0xd3af('0x14')])){_0x426ecc['SmsInteraction'][_0xd3af('0x15')]({'where':{'id':_0x14fb5e[_0xd3af('0x14')]}})[_0xd3af('0x16')](function(_0x237ac7){if(_0x237ac7){_0x237ac7['update']({'lastMsgAt':_0x14fb5e[_0xd3af('0x17')],'lastMsgDirection':_0x14fb5e[_0xd3af('0xe')][_0xd3af('0xf')]()});}})['catch'](function(_0x48490c){console['error'](_0x48490c);});}if(_0x14fb5e[_0xd3af('0xe')]===_0xd3af('0x10')&&!_0x14fb5e[_0xd3af('0x11')]){var _0x39eac1;_0x426ecc[_0xd3af('0x18')]['find']({'where':{'id':_0x14fb5e[_0xd3af('0x19')]},'raw':!![]})['then'](function(_0x4f7004){_0x39eac1=_0x4f7004;if(_0x39eac1&&_0x39eac1[_0xd3af('0x1a')]){switch(_0x39eac1[_0xd3af('0x1a')]){case'twilio':var _0x45b796=require(_0xd3af('0x1b'));if(_0x39eac1[_0xd3af('0x1c')]&&_0x39eac1['authToken']&&_0x39eac1['phone']){var _0xf232d=new _0x45b796(_0x39eac1[_0xd3af('0x1c')],_0x39eac1[_0xd3af('0x1d')]);_0xf232d[_0xd3af('0x1e')]['create']({'body':_0x14fb5e[_0xd3af('0xc')],'to':_0x14fb5e[_0xd3af('0x1f')],'from':_0x39eac1[_0xd3af('0x1f')],'statusCallback':_0x39eac1[_0xd3af('0x20')]+'/api/sms/messages/'+_0x14fb5e['id']+_0xd3af('0x21')+_0x39eac1[_0xd3af('0x22')]})[_0xd3af('0x16')](function(_0x2acee8){if(_0x2acee8[_0xd3af('0x23')]){return _0x2232b3['update']({'messageId':_0x2acee8[_0xd3af('0x23')]});}})[_0xd3af('0x24')](function(_0x1f0e8c){logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x1b'),util[_0xd3af('0x28')](_0x1f0e8c,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate',_0xd3af('0x1b'),_0xd3af('0x29'));}break;case _0xd3af('0x2a'):var _0x29025b='https://api.skebby.it/API/v1.0/REST/';if(_0x39eac1['username']&&_0x39eac1['password']){var _0x320ec2={'recipient':[_0x14fb5e[_0xd3af('0x1f')]],'message':_0x14fb5e[_0xd3af('0xc')],'message_type':_0x39eac1[_0xd3af('0x2b')]};if(_0x39eac1['smsMethod']&&_0x39eac1[_0xd3af('0x2b')]!=='SI'){_0x320ec2['sender']=_0x39eac1[_0xd3af('0x1f')];}var _0x2d4cf3={'url':_0x29025b+_0xd3af('0x2c')+_0x39eac1[_0xd3af('0x2d')]+_0xd3af('0x2e')+_0x39eac1[_0xd3af('0x2f')],'method':_0xd3af('0x30')};rp(_0x2d4cf3)[_0xd3af('0x16')](function(_0x3e7219){var _0x5aa70d=_0x3e7219[_0xd3af('0x31')](';');var _0x5e8f1b={'user_key':_0x5aa70d[0x0],'session_key':_0x5aa70d[0x1]};_0x2d4cf3={'url':_0x29025b+_0xd3af('0x32'),'method':_0xd3af('0x33'),'headers':{'user_key':_0x5e8f1b[_0xd3af('0x34')],'Session_key':_0x5e8f1b['session_key']},'json':!![],'body':_0x320ec2};return rp(_0x2d4cf3);})[_0xd3af('0x16')](function(_0x1ec8be){if(_0x1ec8be[_0xd3af('0x35')]>=0x1){var _0x43598c={'messageId':_0x1ec8be['internal_order_id']};if(_0x39eac1['smsMethod']!=='GP'||!_0x39eac1[_0xd3af('0x36')]){_0x43598c[_0xd3af('0x37')]=!![];}return _0x2232b3[_0xd3af('0x38')](_0x43598c);}else{return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x2a'),util[_0xd3af('0x28')](_0x1ec8be,{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x471ead){return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x2a'),util[_0xd3af('0x28')](_0x471ead,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x2a'),_0xd3af('0x39'));}break;case _0xd3af('0x3a'):if(_0x39eac1['authToken']){var _0x2f9470={'recipient':_0x14fb5e[_0xd3af('0x1f')],'message':_0x14fb5e[_0xd3af('0xc')],'sender':_0x39eac1[_0xd3af('0x3b')]||_0x39eac1['phone'],'authorization':_0x39eac1['authToken']};var _0xc121ae={'method':_0xd3af('0x33'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2f9470,'json':!![]};rp(_0xc121ae)[_0xd3af('0x16')](function(_0x3c56fe){var _0x23265d={'messageId':_0x3c56fe[_0xd3af('0x3c')]};if(!_0x39eac1[_0xd3af('0x36')]){_0x23265d[_0xd3af('0x37')]=!![];}return _0x2232b3[_0xd3af('0x38')](_0x23265d);})[_0xd3af('0x24')](function(_0x2d46bb){logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),'connectel',util[_0xd3af('0x28')](_0x2d46bb,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),'connectel',_0xd3af('0x3d'));}break;case _0xd3af('0x3e'):if(_0x39eac1[_0xd3af('0x2d')]&&_0x39eac1[_0xd3af('0x2f')]){var _0x2f9470={'messages':[{'source':_0xd3af('0x3f'),'to':_0x14fb5e[_0xd3af('0x1f')],'body':_0x14fb5e[_0xd3af('0xc')],'from':_0x39eac1[_0xd3af('0x3b')]||_0x39eac1[_0xd3af('0x1f')]}]};var _0x1e6314=util[_0xd3af('0x40')]('%s:%s',_0x39eac1[_0xd3af('0x2d')],_0x39eac1['password']);var _0xc121ae={'method':_0xd3af('0x33'),'uri':_0xd3af('0x41'),'body':_0x2f9470,'headers':{'Authorization':util['format'](_0xd3af('0x42'),new Buffer(_0x1e6314)[_0xd3af('0x43')](_0xd3af('0x44')))},'json':!![]};rp(_0xc121ae)[_0xd3af('0x16')](function(_0x3ddb07){if(_0x3ddb07[_0xd3af('0x45')]>=0xc8&&_0x3ddb07[_0xd3af('0x45')]<=0xce){if(_0x3ddb07[_0xd3af('0x46')]&&_0x3ddb07[_0xd3af('0x46')][_0xd3af('0x47')]>0x0){var _0x4efbda=_[_0xd3af('0x48')](_0x3ddb07[_0xd3af('0x46')][_0xd3af('0x1e')]);var _0x4f89c5={'messageId':_0x4efbda[_0xd3af('0x49')]};if(!_0x39eac1[_0xd3af('0x36')]){_0x4f89c5[_0xd3af('0x37')]=!![];}return _0x2232b3['update'](_0x4f89c5);}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x4a'),util['inspect'](_0x3ddb07,{'showHidden':![],'depth':null}));}}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate',_0xd3af('0x4a'),util['inspect'](_0x3ddb07,{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x2beb78){logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),'clickSend',util[_0xd3af('0x28')](_0x2beb78,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x4a'),_0xd3af('0x39'));}break;case _0xd3af('0x4b'):if(_0x39eac1[_0xd3af('0x4c')]&&_0x39eac1[_0xd3af('0x1d')]){var _0x2f9470={'dst':_0x14fb5e['phone'],'text':_0x14fb5e[_0xd3af('0xc')],'src':_0x39eac1[_0xd3af('0x3b')]||_0x39eac1[_0xd3af('0x1f')],'url':_0x39eac1[_0xd3af('0x20')]+_0xd3af('0x4d')+_0x14fb5e['id']+_0xd3af('0x21')+_0x39eac1['token']};var _0x1e6314=util[_0xd3af('0x40')](_0xd3af('0x4e'),_0x39eac1[_0xd3af('0x4c')],_0x39eac1[_0xd3af('0x1d')]);var _0xc121ae={'method':_0xd3af('0x33'),'uri':util[_0xd3af('0x40')]('https://api.plivo.com/v1/Account/%s/Message/',_0x39eac1[_0xd3af('0x4c')]),'body':_0x2f9470,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x1e6314)[_0xd3af('0x43')](_0xd3af('0x44')))},'json':!![]};rp(_0xc121ae)[_0xd3af('0x16')](function(_0x4fff8c){var _0x11f4f8={'messageId':_0x4fff8c[_0xd3af('0x4f')][0x0]};return _0x2232b3[_0xd3af('0x38')](_0x11f4f8);})[_0xd3af('0x24')](function(_0x5820e2){logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate',_0xd3af('0x4b'),util[_0xd3af('0x28')](_0x5820e2,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),'plivo',_0xd3af('0x50'));}break;case _0xd3af('0x51'):if(_0x39eac1[_0xd3af('0x2d')]&&_0x39eac1[_0xd3af('0x2f')]){if(_0x39eac1[_0xd3af('0x52')]){var _0x59430a={'method':_0xd3af('0x33'),'uri':_0x39eac1[_0xd3af('0x52')]+'/auth/1/session','body':{'username':_0x39eac1[_0xd3af('0x2d')],'password':_0x39eac1[_0xd3af('0x2f')]},'json':!![]};return rp(_0x59430a)[_0xd3af('0x16')](function(_0x2658d1){var _0x2c6a38={'method':_0xd3af('0x33'),'uri':_0x39eac1[_0xd3af('0x52')]+_0xd3af('0x53'),'body':{'messages':[{'from':_0x39eac1['phone'],'destinations':[{'to':_0x14fb5e[_0xd3af('0x1f')]}],'text':_0x14fb5e[_0xd3af('0xc')],'notifyUrl':_0x39eac1['remote']+_0xd3af('0x4d')+_0x14fb5e['id']+_0xd3af('0x21')+_0x39eac1['token'],'notifyContentType':_0xd3af('0x54'),'callbackData':_0x39eac1['phone']+';'+_0x14fb5e[_0xd3af('0xc')]}]},'headers':{'Authorization':_0xd3af('0x55')+_0x2658d1[_0xd3af('0x22')]},'json':!![]};return rp(_0x2c6a38)[_0xd3af('0x16')](function(_0x32db5e){if(_0x32db5e['messages']){var _0x243cd2={'messageId':_0x32db5e[_0xd3af('0x1e')][0x0][_0xd3af('0xb')]};if(!_0x39eac1[_0xd3af('0x36')]){_0x243cd2[_0xd3af('0x37')]=!![];}return _0x2232b3[_0xd3af('0x38')](_0x243cd2);}else{return logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd3af('0x51'),util[_0xd3af('0x28')](_0x32db5e,{'showHidden':![],'depth':null}));}});})[_0xd3af('0x24')](function(_0x209b1a){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),_0xd3af('0x51'),util[_0xd3af('0x28')](_0x209b1a,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate',_0xd3af('0x51'),_0xd3af('0x56'));}}else{logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),_0xd3af('0x51'),_0xd3af('0x39'));}break;case _0xd3af('0x57'):var _0x3ea47a=require('crypto');if(_0x39eac1['apiKey']){var _0x542cfe={};_0x542cfe['login']=_0x39eac1['username'];_0x542cfe[_0xd3af('0x1f')]=_0x14fb5e[_0xd3af('0x1f')];_0x542cfe['sender']=_0x39eac1[_0xd3af('0x1f')];_0x542cfe[_0xd3af('0x58')]=_0x14fb5e[_0xd3af('0xc')];_0x542cfe[_0xd3af('0x59')]=+new Date();var _0x1efa34='';var _0x3c1eda='';var _0x40e501=Object[_0xd3af('0x5a')](_0x542cfe);_0x40e501['sort']();for(var _0x31f938=0x0;_0x31f938<_0x40e501[_0xd3af('0x5b')];_0x31f938++){if(_0x1efa34!=''){_0x1efa34+='&';}_0x1efa34+=_0x40e501[_0x31f938]+'='+encodeURIComponent(_0x542cfe[_0x40e501[_0x31f938]]);_0x3c1eda+=_0x542cfe[_0x40e501[_0x31f938]];}_0x3c1eda+=_0x39eac1[_0xd3af('0x5c')];_0x3c1eda=_0x3ea47a[_0xd3af('0x5d')](_0xd3af('0x5e'))['update'](_0x3c1eda)[_0xd3af('0x5f')]('hex');if(_0x1efa34!==''){_0x1efa34+='&';}_0x1efa34+=_0xd3af('0x60')+_0x3c1eda;var _0x2d4cf3={'method':_0xd3af('0x30'),'uri':_0x39eac1['baseUrl']+_0xd3af('0x61')+_0x1efa34,'json':!![]};return rp(_0x2d4cf3)['then'](function(_0x4878ac){var _0x4a259e=Object[_0xd3af('0x5a')](_0x4878ac);if(_0x4878ac[_0x4a259e[0x0]]['error']&&parseInt(_0x4878ac[_0x4a259e[0x0]][_0xd3af('0x25')])===0x0){var _0x509387={'messageId':_0x4878ac[_0x4a259e[0x0]][_0xd3af('0x62')]};if(!_0x39eac1['deliveryReport']){_0x509387['read']=!![];}return _0x2232b3[_0xd3af('0x38')](_0x509387);}else{return logger['error'](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x57'),util[_0xd3af('0x28')](_0x4878ac['error'],{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x118876){return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x57'),util['inspect'](_0x118876,{'showHidden':![],'depth':null}));});}else{logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd3af('0x57'),_0xd3af('0x63'));}break;case _0xd3af('0x64'):if(_0x39eac1[_0xd3af('0x5c')]){var _0x4f2c34={'method':_0xd3af('0x33'),'uri':_0xd3af('0x65'),'headers':{'Authorization':_0x39eac1['apiKey']},'body':{'content':_0x14fb5e[_0xd3af('0xc')],'to':[_0x14fb5e[_0xd3af('0x1f')]],'from':_0x39eac1[_0xd3af('0x1f')],'binary':![],'clientMessageId':'uuid','charset':_0xd3af('0x66')},'json':!![]};rp(_0x4f2c34)[_0xd3af('0x16')](function(_0x3b8897){if(!_0x3b8897['error']){var _0x319864={'messageId':_0x3b8897[_0xd3af('0x1e')][0x0][_0xd3af('0x67')]};if(!_0x39eac1[_0xd3af('0x36')]){_0x319864[_0xd3af('0x37')]=!![];}return _0x2232b3[_0xd3af('0x38')](_0x319864);}else{return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x64'),util[_0xd3af('0x28')](_0x3b8897[_0xd3af('0x25')],{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x4e6a28){return logger[_0xd3af('0x25')](_0xd3af('0x26'),'afterCreate','clickatell',util[_0xd3af('0x28')](_0x4e6a28,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x64'),_0xd3af('0x63'));}break;case _0xd3af('0x68'):if(_0x39eac1['username']&&_0x39eac1[_0xd3af('0x2f')]){var _0x1e6314=util['format']('%s:%s',_0x39eac1[_0xd3af('0x2d')],_0x39eac1[_0xd3af('0x2f')]);var _0xc121ae={'method':_0xd3af('0x33'),'uri':_0xd3af('0x69')+_0x39eac1[_0xd3af('0x6a')]+_0xd3af('0x6b'),'body':{'to':[_0x14fb5e[_0xd3af('0x1f')]],'text':_0x14fb5e[_0xd3af('0xc')],'from':_0x39eac1[_0xd3af('0x1f')],'applicationId':_0x39eac1[_0xd3af('0x6c')]},'headers':{'Authorization':util[_0xd3af('0x40')](_0xd3af('0x42'),new Buffer(_0x1e6314)[_0xd3af('0x43')](_0xd3af('0x44')))},'json':!![]};rp(_0xc121ae)[_0xd3af('0x16')](function(_0x301c8e){if(_0x301c8e['id']){var _0x501726={'messageId':_0x301c8e['id']};return _0x2232b3[_0xd3af('0x38')](_0x501726);}else{logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x68'),util[_0xd3af('0x28')](_0x301c8e,{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x50cfb1){logger[_0xd3af('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3af('0x27'),_0xd3af('0x68'),util[_0xd3af('0x28')](_0x50cfb1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x68'),_0xd3af('0x39'));}break;case _0xd3af('0x6d'):if(_0x39eac1['apiKey']){var _0x3709d4={};var _0x2d4cf3={'method':_0xd3af('0x33'),'uri':_0xd3af('0x6e'),'headers':{'Authorization':_0xd3af('0x6f')+_0x39eac1[_0xd3af('0x5c')],'Content-Type':_0xd3af('0x54')},'body':{'from':_0x39eac1['phone'],'to':_0x14fb5e[_0xd3af('0x1f')],'text':_0x14fb5e[_0xd3af('0xc')]},'json':!![]};return rp(_0x2d4cf3)[_0xd3af('0x16')](function(_0x54d66d){if(_0x54d66d[_0xd3af('0x70')]==0xca){_0x3709d4[_0xd3af('0x71')]=_0x54d66d;var _0x39e4ca={'method':_0xd3af('0x33'),'uri':_0xd3af('0x72'),'headers':{'Authorization':_0xd3af('0x6f')+_0x39eac1[_0xd3af('0x5c')],'Content-Type':_0xd3af('0x54')},'body':{'refid':_0x3709d4[_0xd3af('0x71')][_0xd3af('0x73')]},'json':!![]};return rp(_0x39e4ca)[_0xd3af('0x16')](function(_0x1b431d){_0x3709d4[_0xd3af('0x74')]=_0x1b431d;var _0x40d8fd={'messageId':_0x3709d4['message'][_0xd3af('0x73')],'read':!![]};return _0x2232b3[_0xd3af('0x38')](_0x40d8fd);});}else{return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),'intelepeer',util[_0xd3af('0x28')](_0x54d66d,{'showHidden':![],'depth':null}));}})[_0xd3af('0x24')](function(_0x1dccd9){return logger[_0xd3af('0x25')](_0xd3af('0x26'),_0xd3af('0x27'),_0xd3af('0x6d'),util[_0xd3af('0x28')](_0x1dccd9,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd3af('0x6d'),_0xd3af('0x75'));}break;}}})[_0xd3af('0x76')](function(){_0x6e3b1b();});}else{_0x6e3b1b();}}},'charset':_0xd3af('0x77'),'collate':_0xd3af('0x78')});}; \ No newline at end of file +var _0x0d05=['clicksend','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','apiKey','login','sender','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','GET','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','Basic\x20%s','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','refid','status','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','direction','toLowerCase','secret','UserId','isNil','SmsInteractionId','SmsInteraction','then','update','createdAt','error','out','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','catch','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','split','sms','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken'];(function(_0x3fc59a,_0x5c0c1d){var _0x2af724=function(_0xa23f3e){while(--_0xa23f3e){_0x3fc59a['push'](_0x3fc59a['shift']());}};_0x2af724(++_0x5c0c1d);}(_0x0d05,0x1a7));var _0x50d0=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x0d05[_0x412e27];return _0x53da42;};'use strict';var _=require(_0x50d0('0x0'));var util=require(_0x50d0('0x1'));var logger=require(_0x50d0('0x2'))(_0x50d0('0x3'));var moment=require('moment');var BPromise=require(_0x50d0('0x4'));var rp=require(_0x50d0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x50d0('0x6'));module[_0x50d0('0x7')]=function(_0x1930b9,_0x9c722c){return _0x1930b9[_0x50d0('0x8')](_0x50d0('0x9'),attributes,{'tableName':_0x50d0('0xa'),'paranoid':![],'indexes':[{'name':_0x50d0('0xb'),'fields':[_0x50d0('0xb')]},{'name':'fti_sms_messages','fields':[_0x50d0('0xc')],'type':_0x50d0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bcfa2,_0x2458a9,_0x47d0f6){var _0x17d8a0=_0x1930b9[_0x50d0('0xe')];var _0x43432a=_0x2bcfa2['get']({'plain':!![]});if(_0x43432a[_0x50d0('0xf')][_0x50d0('0x10')]()==='in'||_0x43432a[_0x50d0('0xf')][_0x50d0('0x10')]()==='out'&&!_0x43432a[_0x50d0('0x11')]&&!_['isNil'](_0x43432a[_0x50d0('0x12')])&&!_[_0x50d0('0x13')](_0x43432a[_0x50d0('0x14')])){_0x17d8a0[_0x50d0('0x15')]['findOne']({'where':{'id':_0x43432a[_0x50d0('0x14')]}})[_0x50d0('0x16')](function(_0xb8f813){if(_0xb8f813){_0xb8f813[_0x50d0('0x17')]({'lastMsgAt':_0x43432a[_0x50d0('0x18')],'lastMsgDirection':_0x43432a[_0x50d0('0xf')]['toLowerCase']()});}})['catch'](function(_0x20146d){console[_0x50d0('0x19')](_0x20146d);});}if(_0x43432a[_0x50d0('0xf')]===_0x50d0('0x1a')&&!_0x43432a[_0x50d0('0x11')]){var _0x348120;_0x17d8a0[_0x50d0('0x1b')][_0x50d0('0x1c')]({'where':{'id':_0x43432a[_0x50d0('0x1d')]},'raw':!![]})[_0x50d0('0x16')](function(_0x1d0087){_0x348120=_0x1d0087;if(_0x348120&&_0x348120[_0x50d0('0x1e')]){switch(_0x348120[_0x50d0('0x1e')]){case _0x50d0('0x1f'):var _0x2b7952=require(_0x50d0('0x1f'));if(_0x348120['accountSid']&&_0x348120[_0x50d0('0x20')]&&_0x348120[_0x50d0('0x21')]){var _0x355e5b=new _0x2b7952(_0x348120['accountSid'],_0x348120[_0x50d0('0x20')]);_0x355e5b[_0x50d0('0x22')][_0x50d0('0x23')]({'body':_0x43432a[_0x50d0('0xc')],'to':_0x43432a[_0x50d0('0x21')],'from':_0x348120[_0x50d0('0x21')],'statusCallback':_0x348120[_0x50d0('0x24')]+_0x50d0('0x25')+_0x43432a['id']+_0x50d0('0x26')+_0x348120[_0x50d0('0x27')]})[_0x50d0('0x16')](function(_0x5e9493){if(_0x5e9493[_0x50d0('0x28')]){return _0x2bcfa2['update']({'messageId':_0x5e9493[_0x50d0('0x28')]});}})[_0x50d0('0x29')](function(_0x499a21){logger[_0x50d0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x50d0('0x2a'),'twilio',util[_0x50d0('0x2b')](_0x499a21,{'showHidden':![],'depth':null}));});}else{logger[_0x50d0('0x19')](_0x50d0('0x2c'),'afterCreate',_0x50d0('0x1f'),_0x50d0('0x2d'));}break;case _0x50d0('0x2e'):var _0x4bbefa=_0x50d0('0x2f');if(_0x348120[_0x50d0('0x30')]&&_0x348120[_0x50d0('0x31')]){var _0x7052e6={'recipient':[_0x43432a[_0x50d0('0x21')]],'message':_0x43432a[_0x50d0('0xc')],'message_type':_0x348120['smsMethod']};if(_0x348120[_0x50d0('0x32')]&&_0x348120[_0x50d0('0x32')]!=='SI'){_0x7052e6['sender']=_0x348120[_0x50d0('0x21')];}var _0xb22d78={'url':_0x4bbefa+_0x50d0('0x33')+_0x348120[_0x50d0('0x30')]+'&password='+_0x348120['password'],'method':'GET'};rp(_0xb22d78)[_0x50d0('0x16')](function(_0x27406d){var _0x1c407c=_0x27406d[_0x50d0('0x34')](';');var _0x4b2f61={'user_key':_0x1c407c[0x0],'session_key':_0x1c407c[0x1]};_0xb22d78={'url':_0x4bbefa+_0x50d0('0x35'),'method':'POST','headers':{'user_key':_0x4b2f61['user_key'],'Session_key':_0x4b2f61[_0x50d0('0x36')]},'json':!![],'body':_0x7052e6};return rp(_0xb22d78);})['then'](function(_0x2266fe){if(_0x2266fe[_0x50d0('0x37')]>=0x1){var _0xf25069={'messageId':_0x2266fe[_0x50d0('0x38')]};if(_0x348120[_0x50d0('0x32')]!=='GP'||!_0x348120[_0x50d0('0x39')]){_0xf25069[_0x50d0('0x3a')]=!![];}return _0x2bcfa2[_0x50d0('0x17')](_0xf25069);}else{return logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),'skebby',util[_0x50d0('0x2b')](_0x2266fe,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2d353e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x50d0('0x2a'),_0x50d0('0x2e'),util[_0x50d0('0x2b')](_0x2d353e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x50d0('0x2c'),_0x50d0('0x2a'),'skebby',_0x50d0('0x3b'));}break;case _0x50d0('0x3c'):if(_0x348120[_0x50d0('0x20')]){var _0x575b64={'recipient':_0x43432a[_0x50d0('0x21')],'message':_0x43432a['body'],'sender':_0x348120[_0x50d0('0x3d')]||_0x348120['phone'],'authorization':_0x348120[_0x50d0('0x20')]};var _0x2458a9={'method':'POST','uri':_0x50d0('0x3e'),'body':_0x575b64,'json':!![]};rp(_0x2458a9)['then'](function(_0x871aea){var _0x168bb8={'messageId':_0x871aea[_0x50d0('0x3f')]};if(!_0x348120['deliveryReport']){_0x168bb8[_0x50d0('0x3a')]=!![];}return _0x2bcfa2['update'](_0x168bb8);})[_0x50d0('0x29')](function(_0x4ead0e){logger[_0x50d0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x50d0('0x3c'),util[_0x50d0('0x2b')](_0x4ead0e,{'showHidden':![],'depth':null}));});}else{logger[_0x50d0('0x19')](_0x50d0('0x2c'),'afterCreate',_0x50d0('0x3c'),_0x50d0('0x40'));}break;case _0x50d0('0x41'):if(_0x348120['username']&&_0x348120[_0x50d0('0x31')]){var _0x575b64={'messages':[{'source':_0x50d0('0x42'),'to':_0x43432a['phone'],'body':_0x43432a['body'],'from':_0x348120['senderString']||_0x348120[_0x50d0('0x21')]}]};var _0x9eeeb2=util[_0x50d0('0x43')](_0x50d0('0x44'),_0x348120['username'],_0x348120['password']);var _0x2458a9={'method':_0x50d0('0x45'),'uri':_0x50d0('0x46'),'body':_0x575b64,'headers':{'Authorization':util[_0x50d0('0x43')]('Basic\x20%s',new Buffer(_0x9eeeb2)[_0x50d0('0x47')]('base64'))},'json':!![]};rp(_0x2458a9)[_0x50d0('0x16')](function(_0x104515){if(_0x104515[_0x50d0('0x48')]>=0xc8&&_0x104515['http_code']<=0xce){if(_0x104515[_0x50d0('0x49')]&&_0x104515['data']['queued_count']>0x0){var _0x3a1e74=_[_0x50d0('0x4a')](_0x104515[_0x50d0('0x49')][_0x50d0('0x22')]);var _0x5d35f9={'messageId':_0x3a1e74[_0x50d0('0x4b')]};if(!_0x348120[_0x50d0('0x39')]){_0x5d35f9[_0x50d0('0x3a')]=!![];}return _0x2bcfa2['update'](_0x5d35f9);}else{logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),'clickSend',util[_0x50d0('0x2b')](_0x104515,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x50d0('0x2c'),_0x50d0('0x2a'),_0x50d0('0x4c'),util[_0x50d0('0x2b')](_0x104515,{'showHidden':![],'depth':null}));}})[_0x50d0('0x29')](function(_0x2ed2fc){logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),'clickSend',util['inspect'](_0x2ed2fc,{'showHidden':![],'depth':null}));});}else{logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),'clickSend',_0x50d0('0x3b'));}break;case _0x50d0('0x4d'):if(_0x348120[_0x50d0('0x4e')]&&_0x348120[_0x50d0('0x20')]){var _0x575b64={'dst':_0x43432a['phone'],'text':_0x43432a[_0x50d0('0xc')],'src':_0x348120['senderString']||_0x348120[_0x50d0('0x21')],'url':_0x348120[_0x50d0('0x24')]+_0x50d0('0x25')+_0x43432a['id']+_0x50d0('0x26')+_0x348120[_0x50d0('0x27')]};var _0x9eeeb2=util[_0x50d0('0x43')](_0x50d0('0x44'),_0x348120[_0x50d0('0x4e')],_0x348120[_0x50d0('0x20')]);var _0x2458a9={'method':'POST','uri':util['format'](_0x50d0('0x4f'),_0x348120[_0x50d0('0x4e')]),'body':_0x575b64,'headers':{'Authorization':util[_0x50d0('0x43')]('Basic\x20%s',new Buffer(_0x9eeeb2)[_0x50d0('0x47')]('base64'))},'json':!![]};rp(_0x2458a9)[_0x50d0('0x16')](function(_0x31d06c){var _0x3c748e={'messageId':_0x31d06c[_0x50d0('0x50')][0x0]};return _0x2bcfa2['update'](_0x3c748e);})[_0x50d0('0x29')](function(_0x13c7ff){logger['error'](_0x50d0('0x2c'),_0x50d0('0x2a'),_0x50d0('0x4d'),util['inspect'](_0x13c7ff,{'showHidden':![],'depth':null}));});}else{logger[_0x50d0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x50d0('0x2a'),_0x50d0('0x4d'),_0x50d0('0x51'));}break;case _0x50d0('0x52'):if(_0x348120[_0x50d0('0x30')]&&_0x348120['password']){if(_0x348120['baseUrl']){var _0x5c90ff={'method':_0x50d0('0x45'),'uri':_0x348120[_0x50d0('0x53')]+_0x50d0('0x54'),'body':{'username':_0x348120[_0x50d0('0x30')],'password':_0x348120[_0x50d0('0x31')]},'json':!![]};return rp(_0x5c90ff)[_0x50d0('0x16')](function(_0x14e12a){var _0x5cd1b0={'method':_0x50d0('0x45'),'uri':_0x348120[_0x50d0('0x53')]+_0x50d0('0x55'),'body':{'messages':[{'from':_0x348120[_0x50d0('0x21')],'destinations':[{'to':_0x43432a[_0x50d0('0x21')]}],'text':_0x43432a[_0x50d0('0xc')],'notifyUrl':_0x348120['remote']+'/api/sms/messages/'+_0x43432a['id']+_0x50d0('0x26')+_0x348120[_0x50d0('0x27')],'notifyContentType':_0x50d0('0x56'),'callbackData':_0x348120['phone']+';'+_0x43432a[_0x50d0('0xc')]}]},'headers':{'Authorization':_0x50d0('0x57')+_0x14e12a[_0x50d0('0x27')]},'json':!![]};return rp(_0x5cd1b0)[_0x50d0('0x16')](function(_0x381c95){if(_0x381c95['messages']){var _0x55aab2={'messageId':_0x381c95[_0x50d0('0x22')][0x0][_0x50d0('0xb')]};if(!_0x348120[_0x50d0('0x39')]){_0x55aab2[_0x50d0('0x3a')]=!![];}return _0x2bcfa2['update'](_0x55aab2);}else{return logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),_0x50d0('0x52'),util[_0x50d0('0x2b')](_0x381c95,{'showHidden':![],'depth':null}));}});})[_0x50d0('0x29')](function(_0x34e337){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x50d0('0x2a'),_0x50d0('0x52'),util['inspect'](_0x34e337,{'showHidden':![],'depth':null}));});}else{logger[_0x50d0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x50d0('0x2a'),_0x50d0('0x52'),_0x50d0('0x58'));}}else{logger['error'](_0x50d0('0x2c'),_0x50d0('0x2a'),'infobip',_0x50d0('0x3b'));}break;case'csc':var _0x2c7738=require('crypto');if(_0x348120[_0x50d0('0x59')]){var _0x2c7d42={};_0x2c7d42[_0x50d0('0x5a')]=_0x348120['username'];_0x2c7d42[_0x50d0('0x21')]=_0x43432a['phone'];_0x2c7d42[_0x50d0('0x5b')]=_0x348120['phone'];_0x2c7d42[_0x50d0('0x5c')]=_0x43432a[_0x50d0('0xc')];_0x2c7d42[_0x50d0('0x5d')]=+new Date();var _0x822d22='';var _0x2a0ccc='';var _0x6cde28=Object[_0x50d0('0x5e')](_0x2c7d42);_0x6cde28[_0x50d0('0x5f')]();for(var _0x24dd3b=0x0;_0x24dd3b<_0x6cde28['length'];_0x24dd3b++){if(_0x822d22!=''){_0x822d22+='&';}_0x822d22+=_0x6cde28[_0x24dd3b]+'='+encodeURIComponent(_0x2c7d42[_0x6cde28[_0x24dd3b]]);_0x2a0ccc+=_0x2c7d42[_0x6cde28[_0x24dd3b]];}_0x2a0ccc+=_0x348120['apiKey'];_0x2a0ccc=_0x2c7738[_0x50d0('0x60')](_0x50d0('0x61'))[_0x50d0('0x17')](_0x2a0ccc)[_0x50d0('0x62')](_0x50d0('0x63'));if(_0x822d22!==''){_0x822d22+='&';}_0x822d22+=_0x50d0('0x64')+_0x2a0ccc;var _0xb22d78={'method':_0x50d0('0x65'),'uri':_0x348120[_0x50d0('0x53')]+'/external/get/send.php?'+_0x822d22,'json':!![]};return rp(_0xb22d78)[_0x50d0('0x16')](function(_0x40251b){var _0x329588=Object['keys'](_0x40251b);if(_0x40251b[_0x329588[0x0]]['error']&&parseInt(_0x40251b[_0x329588[0x0]][_0x50d0('0x19')])===0x0){var _0x136db7={'messageId':_0x40251b[_0x329588[0x0]][_0x50d0('0x66')]};if(!_0x348120[_0x50d0('0x39')]){_0x136db7['read']=!![];}return _0x2bcfa2['update'](_0x136db7);}else{return logger[_0x50d0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x50d0('0x2a'),_0x50d0('0x67'),util['inspect'](_0x40251b[_0x50d0('0x19')],{'showHidden':![],'depth':null}));}})[_0x50d0('0x29')](function(_0x8e278f){return logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),_0x50d0('0x67'),util[_0x50d0('0x2b')](_0x8e278f,{'showHidden':![],'depth':null}));});}else{logger[_0x50d0('0x19')](_0x50d0('0x2c'),'afterCreate','csc',_0x50d0('0x68'));}break;case'clickatell':if(_0x348120['apiKey']){var _0xc720c0={'method':'POST','uri':_0x50d0('0x69'),'headers':{'Authorization':_0x348120[_0x50d0('0x59')]},'body':{'content':_0x43432a['body'],'to':[_0x43432a[_0x50d0('0x21')]],'from':_0x348120['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x50d0('0x6a')},'json':!![]};rp(_0xc720c0)[_0x50d0('0x16')](function(_0x39e9d5){if(!_0x39e9d5['error']){var _0x4464c6={'messageId':_0x39e9d5[_0x50d0('0x22')][0x0][_0x50d0('0x6b')]};if(!_0x348120[_0x50d0('0x39')]){_0x4464c6[_0x50d0('0x3a')]=!![];}return _0x2bcfa2[_0x50d0('0x17')](_0x4464c6);}else{return logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),_0x50d0('0x6c'),util[_0x50d0('0x2b')](_0x39e9d5[_0x50d0('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xd97ef1){return logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),_0x50d0('0x6c'),util[_0x50d0('0x2b')](_0xd97ef1,{'showHidden':![],'depth':null}));});}else{logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),'clickatell',_0x50d0('0x68'));}break;case _0x50d0('0x6d'):if(_0x348120[_0x50d0('0x30')]&&_0x348120[_0x50d0('0x31')]){var _0x9eeeb2=util[_0x50d0('0x43')]('%s:%s',_0x348120[_0x50d0('0x30')],_0x348120[_0x50d0('0x31')]);var _0x2458a9={'method':_0x50d0('0x45'),'uri':_0x50d0('0x6e')+_0x348120[_0x50d0('0x6f')]+_0x50d0('0x70'),'body':{'to':[_0x43432a[_0x50d0('0x21')]],'text':_0x43432a[_0x50d0('0xc')],'from':_0x348120[_0x50d0('0x21')],'applicationId':_0x348120['applicationId']},'headers':{'Authorization':util[_0x50d0('0x43')](_0x50d0('0x71'),new Buffer(_0x9eeeb2)['toString']('base64'))},'json':!![]};rp(_0x2458a9)[_0x50d0('0x16')](function(_0x5e0998){if(_0x5e0998['id']){var _0x3a56f1={'messageId':_0x5e0998['id']};return _0x2bcfa2[_0x50d0('0x17')](_0x3a56f1);}else{logger[_0x50d0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x50d0('0x2a'),_0x50d0('0x6d'),util[_0x50d0('0x2b')](_0x5e0998,{'showHidden':![],'depth':null}));}})[_0x50d0('0x29')](function(_0x4c588d){logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),'bandwidth',util[_0x50d0('0x2b')](_0x4c588d,{'showHidden':![],'depth':null}));});}else{logger[_0x50d0('0x19')](_0x50d0('0x2c'),_0x50d0('0x2a'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0x50d0('0x72'):if(_0x348120[_0x50d0('0x59')]){var _0x4833a7={};var _0xb22d78={'method':_0x50d0('0x45'),'uri':_0x50d0('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x348120[_0x50d0('0x59')],'Content-Type':_0x50d0('0x56')},'body':{'from':_0x348120['phone'],'to':_0x43432a[_0x50d0('0x21')],'text':_0x43432a[_0x50d0('0xc')]},'json':!![]};return rp(_0xb22d78)[_0x50d0('0x16')](function(_0x269586){if(_0x269586[_0x50d0('0x74')]==0xca){_0x4833a7[_0x50d0('0x75')]=_0x269586;var _0x4500cd={'method':_0x50d0('0x45'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x348120['apiKey'],'Content-Type':_0x50d0('0x56')},'body':{'refid':_0x4833a7[_0x50d0('0x75')][_0x50d0('0x76')]},'json':!![]};return rp(_0x4500cd)[_0x50d0('0x16')](function(_0x4375e9){_0x4833a7[_0x50d0('0x77')]=_0x4375e9;var _0x1e23f0={'messageId':_0x4833a7['message'][_0x50d0('0x76')],'read':!![]};return _0x2bcfa2[_0x50d0('0x17')](_0x1e23f0);});}else{return logger[_0x50d0('0x19')](_0x50d0('0x2c'),'afterCreate',_0x50d0('0x72'),util[_0x50d0('0x2b')](_0x269586,{'showHidden':![],'depth':null}));}})[_0x50d0('0x29')](function(_0x24839f){return logger['error'](_0x50d0('0x2c'),'afterCreate',_0x50d0('0x72'),util[_0x50d0('0x2b')](_0x24839f,{'showHidden':![],'depth':null}));});}else{return logger[_0x50d0('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x50d0('0x2a'),'intelepeer','Token\x20not\x20received');}break;}}})['finally'](function(){_0x47d0f6();});}else{_0x47d0f6();}}},'charset':_0x50d0('0x78'),'collate':_0x50d0('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index a435530..967a8d9 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 _0x747e=['redis','localhost','socket.io-emitter','./smsMessage.socket','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x2c0cb6,_0x58d6b2){var _0x43f396=function(_0x15a7aa){while(--_0x15a7aa){_0x2c0cb6['push'](_0x2c0cb6['shift']());}};_0x43f396(++_0x58d6b2);}(_0x747e,0x19c));var _0xe747=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x747e[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0xe747('0x0'));var util=require(_0xe747('0x1'));var moment=require('moment');var BPromise=require(_0xe747('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe747('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe747('0x4'))(_0xe747('0x5'));var config=require(_0xe747('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe747('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe747('0x8')],{'host':_0xe747('0x9'),'port':0x18eb});var socket=require(_0xe747('0xa'))(new Redis(config[_0xe747('0x8')]));require(_0xe747('0xb'))['register'](socket);function respondWithRpcPromise(_0x49f75a,_0x558452,_0x2104ea){return new BPromise(function(_0x1e59d9,_0x506c68){return client['request'](_0x49f75a,_0x2104ea)['then'](function(_0x579713){logger[_0xe747('0xc')](_0xe747('0xd'),_0x558452,'request\x20sent');logger['debug'](_0xe747('0xe'),_0x558452,_0xe747('0xf'),JSON[_0xe747('0x10')](_0x579713));if(_0x579713[_0xe747('0x11')]){if(_0x579713[_0xe747('0x11')][_0xe747('0x12')]===0x1f4){logger[_0xe747('0x11')](_0xe747('0xd'),_0x558452,_0x579713[_0xe747('0x11')]['message']);return _0x506c68(_0x579713[_0xe747('0x11')][_0xe747('0x13')]);}logger['error'](_0xe747('0xd'),_0x558452,_0x579713[_0xe747('0x11')][_0xe747('0x13')]);return _0x1e59d9(_0x579713[_0xe747('0x11')]['message']);}else{logger[_0xe747('0xc')](_0xe747('0xd'),_0x558452,_0xe747('0xf'));_0x1e59d9(_0x579713['result'][_0xe747('0x13')]);}})[_0xe747('0x14')](function(_0x95435){logger['error'](_0xe747('0xd'),_0x558452,_0x95435);_0x506c68(_0x95435);});});}exports[_0xe747('0x15')]=function(_0x35460a){var _0x33cd26=this;return new Promise(function(_0x5c4286,_0x40bb27){return db[_0xe747('0x16')][_0xe747('0x17')](_0x35460a[_0xe747('0x18')],{'raw':_0x35460a[_0xe747('0x19')]?_0x35460a[_0xe747('0x19')][_0xe747('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1721a7){logger[_0xe747('0xc')](_0xe747('0x15'),_0x35460a);logger[_0xe747('0x1b')](_0xe747('0x15'),_0x35460a,JSON[_0xe747('0x10')](_0x1721a7));_0x5c4286(_0x1721a7);})['catch'](function(_0x3eb036){logger[_0xe747('0x11')]('CreateSmsMessage',_0x3eb036[_0xe747('0x13')],_0x35460a);_0x40bb27(_0x33cd26[_0xe747('0x11')](0x1f4,_0x3eb036['message']));});});}; \ No newline at end of file +var _0x5167=['register','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./smsMessage.socket'];(function(_0x1899c8,_0xf052a7){var _0x3b03f9=function(_0x396047){while(--_0x396047){_0x1899c8['push'](_0x1899c8['shift']());}};_0x3b03f9(++_0xf052a7);}(_0x5167,0x189));var _0x7516=function(_0x1dc842,_0x53fd4){_0x1dc842=_0x1dc842-0x0;var _0x2410f5=_0x5167[_0x1dc842];return _0x2410f5;};'use strict';var _=require('lodash');var util=require(_0x7516('0x0'));var moment=require(_0x7516('0x1'));var BPromise=require(_0x7516('0x2'));var rs=require(_0x7516('0x3'));var fs=require('fs');var Redis=require(_0x7516('0x4'));var db=require(_0x7516('0x5'))['db'];var utils=require(_0x7516('0x6'));var logger=require('../../config/logger')(_0x7516('0x7'));var config=require(_0x7516('0x8'));var jayson=require(_0x7516('0x9'));var client=jayson['client'][_0x7516('0xa')]({'port':0x232a});config['redis']=_[_0x7516('0xb')](config[_0x7516('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7516('0xd'))(new Redis(config[_0x7516('0xc')]));require(_0x7516('0xe'))[_0x7516('0xf')](socket);function respondWithRpcPromise(_0x10bd6c,_0x24afa8,_0x446b66){return new BPromise(function(_0x21404c,_0x373edf){return client[_0x7516('0x10')](_0x10bd6c,_0x446b66)[_0x7516('0x11')](function(_0x22e7b1){logger[_0x7516('0x12')](_0x7516('0x13'),_0x24afa8,'request\x20sent');logger[_0x7516('0x14')](_0x7516('0x15'),_0x24afa8,_0x7516('0x16'),JSON[_0x7516('0x17')](_0x22e7b1));if(_0x22e7b1['error']){if(_0x22e7b1['error'][_0x7516('0x18')]===0x1f4){logger[_0x7516('0x19')](_0x7516('0x13'),_0x24afa8,_0x22e7b1[_0x7516('0x19')][_0x7516('0x1a')]);return _0x373edf(_0x22e7b1[_0x7516('0x19')][_0x7516('0x1a')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x24afa8,_0x22e7b1[_0x7516('0x19')][_0x7516('0x1a')]);return _0x21404c(_0x22e7b1[_0x7516('0x19')][_0x7516('0x1a')]);}else{logger[_0x7516('0x12')](_0x7516('0x13'),_0x24afa8,_0x7516('0x16'));_0x21404c(_0x22e7b1[_0x7516('0x1b')]['message']);}})[_0x7516('0x1c')](function(_0x5c782c){logger['error'](_0x7516('0x13'),_0x24afa8,_0x5c782c);_0x373edf(_0x5c782c);});});}exports[_0x7516('0x1d')]=function(_0x1cea0c){var _0x5f01cb=this;return new Promise(function(_0x2942d2,_0x34cf8d){return db[_0x7516('0x1e')][_0x7516('0x1f')](_0x1cea0c[_0x7516('0x20')],{'raw':_0x1cea0c[_0x7516('0x21')]?_0x1cea0c[_0x7516('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x7516('0x11')](function(_0x30a359){logger[_0x7516('0x12')](_0x7516('0x1d'),_0x1cea0c);logger[_0x7516('0x14')]('CreateSmsMessage',_0x1cea0c,JSON['stringify'](_0x30a359));_0x2942d2(_0x30a359);})[_0x7516('0x1c')](function(_0x3abe0e){logger[_0x7516('0x19')]('CreateSmsMessage',_0x3abe0e['message'],_0x1cea0c);_0x34cf8d(_0x5f01cb[_0x7516('0x19')](0x1f4,_0x3abe0e[_0x7516('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 906733a..90b07d8 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 _0x4e4e=['removeListener','register','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x563190,_0x248c05){var _0x5213dc=function(_0xc3d5f4){while(--_0xc3d5f4){_0x563190['push'](_0x563190['shift']());}};_0x5213dc(++_0x248c05);}(_0x4e4e,0x115));var _0xe4e4=function(_0x184111,_0x225454){_0x184111=_0x184111-0x0;var _0x2df0a6=_0x4e4e[_0x184111];return _0x2df0a6;};'use strict';var SmsMessageEvents=require(_0xe4e4('0x0'));var events=['save',_0xe4e4('0x1'),_0xe4e4('0x2')];function createListener(_0xd533e3,_0x168fd3){return function(_0x5a50f5){_0x168fd3['emit'](_0xd533e3,_0x5a50f5);};}function removeListener(_0x490fe0,_0x536cb6){return function(){SmsMessageEvents[_0xe4e4('0x3')](_0x490fe0,_0x536cb6);};}exports[_0xe4e4('0x4')]=function(_0x18dbe7){for(var _0x5bcc58=0x0,_0x4f240d=events[_0xe4e4('0x5')];_0x5bcc58<_0x4f240d;_0x5bcc58++){var _0x5d892f=events[_0x5bcc58];var _0x4f00f0=createListener(_0xe4e4('0x6')+_0x5d892f,_0x18dbe7);SmsMessageEvents['on'](_0x5d892f,_0x4f00f0);}}; \ No newline at end of file +var _0x8b77=['./smsMessage.events','save','remove','update','emit','removeListener','register','length','smsMessage:'];(function(_0x7abcd6,_0x36548c){var _0x329aea=function(_0x55b0a3){while(--_0x55b0a3){_0x7abcd6['push'](_0x7abcd6['shift']());}};_0x329aea(++_0x36548c);}(_0x8b77,0xea));var _0x78b7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8b77[_0x1facfa];return _0x9ec701;};'use strict';var SmsMessageEvents=require(_0x78b7('0x0'));var events=[_0x78b7('0x1'),_0x78b7('0x2'),_0x78b7('0x3')];function createListener(_0x3965c5,_0x2031fc){return function(_0x28a8e8){_0x2031fc[_0x78b7('0x4')](_0x3965c5,_0x28a8e8);};}function removeListener(_0x5153e5,_0x1547ae){return function(){SmsMessageEvents[_0x78b7('0x5')](_0x5153e5,_0x1547ae);};}exports[_0x78b7('0x6')]=function(_0x490972){for(var _0x48d0f1=0x0,_0x5bf5f3=events[_0x78b7('0x7')];_0x48d0f1<_0x5bf5f3;_0x48d0f1++){var _0x5938e5=events[_0x48d0f1];var _0xd92e8e=createListener(_0x78b7('0x8')+_0x5938e5,_0x490972);SmsMessageEvents['on'](_0x5938e5,_0xd92e8e);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 814f2f1..0786de2 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 _0xe240=['addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','getAgents','create','post'];(function(_0x1179c5,_0x47e895){var _0x331854=function(_0x2b1c33){while(--_0x2b1c33){_0x1179c5['push'](_0x1179c5['shift']());}};_0x331854(++_0x47e895);}(_0xe240,0x14d));var _0x0e24=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xe240[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require(_0x0e24('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e24('0x1'));var router=express['Router']();var fs_extra=require(_0x0e24('0x2'));var auth=require(_0x0e24('0x3'));var interaction=require(_0x0e24('0x4'));var config=require('../../config/environment');var controller=require(_0x0e24('0x5'));router[_0x0e24('0x6')]('/',auth[_0x0e24('0x7')](),controller[_0x0e24('0x8')]);router[_0x0e24('0x6')](_0x0e24('0x9'),auth[_0x0e24('0x7')](),controller[_0x0e24('0xa')]);router[_0x0e24('0x6')](_0x0e24('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0e24('0xc'),auth['isAuthenticated'](),controller[_0x0e24('0xd')]);router['get']('/:id/teams',auth[_0x0e24('0x7')](),controller[_0x0e24('0xe')]);router[_0x0e24('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x0e24('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e24('0x10')]);router[_0x0e24('0x11')]('/:id/teams',auth[_0x0e24('0x7')](),controller[_0x0e24('0x12')]);router[_0x0e24('0x11')]('/:id/users',auth[_0x0e24('0x7')](),controller[_0x0e24('0x13')]);router[_0x0e24('0x14')](_0x0e24('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0e24('0x15')](_0x0e24('0xb'),auth[_0x0e24('0x7')](),controller[_0x0e24('0x16')]);router[_0x0e24('0x15')](_0x0e24('0x17'),auth['isAuthenticated'](),controller[_0x0e24('0x18')]);router[_0x0e24('0x15')]('/:id/users',auth[_0x0e24('0x7')](),controller[_0x0e24('0x19')]);module[_0x0e24('0x1a')]=router; \ No newline at end of file +var _0x96c5=['create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','show','/:id/members','/:id/teams','isAuthenticated','getTeams','/:id/users','getAgents','post'];(function(_0x4dd54a,_0x46baca){var _0x1468aa=function(_0x4ebcd1){while(--_0x4ebcd1){_0x4dd54a['push'](_0x4dd54a['shift']());}};_0x1468aa(++_0x46baca);}(_0x96c5,0xb7));var _0x596c=function(_0x5c25ed,_0x54b40b){_0x5c25ed=_0x5c25ed-0x0;var _0x3eb331=_0x96c5[_0x5c25ed];return _0x3eb331;};'use strict';var multer=require(_0x596c('0x0'));var util=require(_0x596c('0x1'));var path=require(_0x596c('0x2'));var timeout=require(_0x596c('0x3'));var express=require('express');var router=express[_0x596c('0x4')]();var fs_extra=require(_0x596c('0x5'));var auth=require(_0x596c('0x6'));var interaction=require(_0x596c('0x7'));var config=require(_0x596c('0x8'));var controller=require('./smsQueue.controller');router[_0x596c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x596c('0x9')](_0x596c('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x596c('0x9')](_0x596c('0xb'),auth['isAuthenticated'](),controller[_0x596c('0xc')]);router[_0x596c('0x9')](_0x596c('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0x596c('0x9')](_0x596c('0xe'),auth[_0x596c('0xf')](),controller[_0x596c('0x10')]);router[_0x596c('0x9')](_0x596c('0x11'),auth['isAuthenticated'](),controller[_0x596c('0x12')]);router[_0x596c('0x13')]('/',auth[_0x596c('0xf')](),controller[_0x596c('0x14')]);router[_0x596c('0x13')](_0x596c('0xe'),auth[_0x596c('0xf')](),controller[_0x596c('0x15')]);router[_0x596c('0x13')](_0x596c('0x11'),auth[_0x596c('0xf')](),controller[_0x596c('0x16')]);router[_0x596c('0x17')](_0x596c('0xb'),auth[_0x596c('0xf')](),controller['update']);router[_0x596c('0x18')](_0x596c('0xb'),auth[_0x596c('0xf')](),controller[_0x596c('0x19')]);router[_0x596c('0x18')](_0x596c('0xe'),auth[_0x596c('0xf')](),controller[_0x596c('0x1a')]);router['delete'](_0x596c('0x11'),auth['isAuthenticated'](),controller[_0x596c('0x1b')]);module[_0x596c('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 75ec6c8..3edb2dc 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 _0xc68b=['roundrobin','exports','STRING','name','ENUM','rrmemory'];(function(_0x1a93a5,_0x13f256){var _0x4893a2=function(_0x4a176c){while(--_0x4a176c){_0x1a93a5['push'](_0x1a93a5['shift']());}};_0x4893a2(++_0x13f256);}(_0xc68b,0x7f));var _0xbc68=function(_0x118e05,_0x29a45f){_0x118e05=_0x118e05-0x0;var _0x5be5c7=_0xc68b[_0x118e05];return _0x5be5c7;};'use strict';var Sequelize=require('sequelize');module[_0xbc68('0x0')]={'name':{'type':Sequelize[_0xbc68('0x1')],'unique':_0xbc68('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbc68('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbc68('0x3')](_0xbc68('0x4'),'beepall',_0xbc68('0x5'))}}; \ No newline at end of file +var _0x79b3=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5e9018,_0x5d3a28){var _0x2062e2=function(_0x4aa0d8){while(--_0x4aa0d8){_0x5e9018['push'](_0x5e9018['shift']());}};_0x2062e2(++_0x5d3a28);}(_0x79b3,0xe7));var _0x379b=function(_0x304158,_0x4f25c6){_0x304158=_0x304158-0x0;var _0x39b587=_0x79b3[_0x304158];return _0x39b587;};'use strict';var Sequelize=require(_0x379b('0x0'));module[_0x379b('0x1')]={'name':{'type':Sequelize[_0x379b('0x2')],'unique':_0x379b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x379b('0x2')]},'timeout':{'type':Sequelize[_0x379b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x379b('0x5')](_0x379b('0x6'),_0x379b('0x7'),_0x379b('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 9772344..b12d43d 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 _0x85f4=['pick','UserSmsQueue','findAll','findAndCountAll','agent','smsPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','ids','Team','User','Agents','online','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','userSmsQueue:remove','addAgents','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','SmsQueues','stack','name','send','index','map','rawAttributes','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','SmsQueue','show','params','keys','intersection','includeAll','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne'];(function(_0x2f8bc4,_0x4f40a1){var _0x2315fa=function(_0x486d12){while(--_0x486d12){_0x2f8bc4['push'](_0x2f8bc4['shift']());}};_0x2315fa(++_0x4f40a1);}(_0x85f4,0xc3));var _0x485f=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x85f4[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0x485f('0x0'));var rimraf=require(_0x485f('0x1'));var zipdir=require(_0x485f('0x2'));var jsonpatch=require(_0x485f('0x3'));var rp=require(_0x485f('0x4'));var moment=require(_0x485f('0x5'));var BPromise=require(_0x485f('0x6'));var Mustache=require(_0x485f('0x7'));var util=require(_0x485f('0x8'));var path=require(_0x485f('0x9'));var sox=require('sox');var csv=require(_0x485f('0xa'));var ejs=require(_0x485f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x485f('0xc'));var squel=require(_0x485f('0xd'));var crypto=require('crypto');var jsforce=require(_0x485f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x485f('0xa'));var querystring=require(_0x485f('0xf'));var Papa=require(_0x485f('0x10'));var Redis=require(_0x485f('0x11'));var authService=require(_0x485f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x485f('0x13'));var hardwareService=require(_0x485f('0x14'));var logger=require(_0x485f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x485f('0x16'))['db'];config[_0x485f('0x17')]=_[_0x485f('0x18')](config[_0x485f('0x17')],{'host':_0x485f('0x19'),'port':0x18eb});var socket=require(_0x485f('0x1a'))(new Redis(config[_0x485f('0x17')]));require('./smsQueue.socket')[_0x485f('0x1b')](socket);function respondWithStatusCode(_0x33c98d,_0x55b1ae){_0x55b1ae=_0x55b1ae||0xcc;return function(_0x2c88b8){if(_0x2c88b8){return _0x33c98d[_0x485f('0x1c')](_0x55b1ae);}return _0x33c98d[_0x485f('0x1d')](_0x55b1ae)[_0x485f('0x1e')]();};}function respondWithResult(_0x286646,_0x3870a5){_0x3870a5=_0x3870a5||0xc8;return function(_0x15f7f5){if(_0x15f7f5){return _0x286646['status'](_0x3870a5)['json'](_0x15f7f5);}};}function respondWithFilteredResult(_0x57bbc3,_0x9fa32){return function(_0xc19b4c){if(_0xc19b4c){var _0x57c1a4=typeof _0x9fa32[_0x485f('0x1f')]===_0x485f('0x20')&&typeof _0x9fa32[_0x485f('0x21')]==='undefined';var _0x2dbde3=_0xc19b4c[_0x485f('0x22')];var _0x1de5fa=_0x57c1a4?0x0:_0x9fa32['offset'];var _0x383d44=_0x57c1a4?_0xc19b4c[_0x485f('0x22')]:_0x9fa32['offset']+_0x9fa32[_0x485f('0x21')];var _0x41c155;if(_0x383d44>=_0x2dbde3){_0x383d44=_0x2dbde3;_0x41c155=0xc8;}else{_0x41c155=0xce;}_0x57bbc3[_0x485f('0x1d')](_0x41c155);return _0x57bbc3[_0x485f('0x23')]('Content-Range',_0x1de5fa+'-'+_0x383d44+'/'+_0x2dbde3)['json'](_0xc19b4c);}return null;};}function patchUpdates(_0x4821b1){return function(_0x155968){try{jsonpatch[_0x485f('0x24')](_0x155968,_0x4821b1,!![]);}catch(_0x1e39a4){return BPromise[_0x485f('0x25')](_0x1e39a4);}return _0x155968[_0x485f('0x26')]();};}function saveUpdates(_0x41ca17,_0x261702){return function(_0x2a89fc){if(_0x2a89fc){return _0x2a89fc[_0x485f('0x27')](_0x41ca17)[_0x485f('0x28')](function(_0x212341){return _0x212341;});}return null;};}function removeEntity(_0x33c48a,_0x51d094){return function(_0x33ede4){if(_0x33ede4){return _0x33ede4[_0x485f('0x29')]()[_0x485f('0x28')](function(){var _0x22c5b3=_0x33ede4[_0x485f('0x2a')]({'plain':!![]});var _0x43855f=_0x485f('0x2b');return db['UserProfileResource'][_0x485f('0x29')]({'where':{'type':_0x43855f,'resourceId':_0x22c5b3['id']}})[_0x485f('0x28')](function(){return _0x33ede4;});})['then'](function(){_0x33c48a['status'](0xcc)[_0x485f('0x1e')]();});}};}function handleEntityNotFound(_0x2e51c7,_0x2c3e95){return function(_0x42e92a){if(!_0x42e92a){_0x2e51c7[_0x485f('0x1c')](0x194);}return _0x42e92a;};}function handleError(_0x3847a7,_0x3155e6){_0x3155e6=_0x3155e6||0x1f4;return function(_0x3fe70a){logger['error'](_0x3fe70a[_0x485f('0x2c')]);if(_0x3fe70a[_0x485f('0x2d')]){delete _0x3fe70a[_0x485f('0x2d')];}_0x3847a7['status'](_0x3155e6)[_0x485f('0x2e')](_0x3fe70a);};}exports[_0x485f('0x2f')]=function(_0x4c2007,_0x18986b){var _0x5490d5={},_0x5524b1={},_0x39f422={'count':0x0,'rows':[]};var _0x1c04b4=_[_0x485f('0x30')](db['SmsQueue'][_0x485f('0x31')],function(_0x5adf22){return{'name':_0x5adf22['fieldName'],'type':_0x5adf22['type'][_0x485f('0x32')]};});_0x5524b1[_0x485f('0x33')]=_[_0x485f('0x30')](_0x1c04b4,_0x485f('0x2d'));_0x5524b1[_0x485f('0x34')]=_['keys'](_0x4c2007['query']);_0x5524b1[_0x485f('0x35')]=_['intersection'](_0x5524b1[_0x485f('0x33')],_0x5524b1[_0x485f('0x34')]);_0x5490d5[_0x485f('0x36')]=_['intersection'](_0x5524b1[_0x485f('0x33')],qs[_0x485f('0x37')](_0x4c2007[_0x485f('0x34')]['fields']));_0x5490d5[_0x485f('0x36')]=_0x5490d5[_0x485f('0x36')][_0x485f('0x38')]?_0x5490d5[_0x485f('0x36')]:_0x5524b1[_0x485f('0x33')];if(!_0x4c2007[_0x485f('0x34')][_0x485f('0x39')](_0x485f('0x3a'))){_0x5490d5[_0x485f('0x21')]=qs[_0x485f('0x21')](_0x4c2007[_0x485f('0x34')]['limit']);_0x5490d5[_0x485f('0x1f')]=qs[_0x485f('0x1f')](_0x4c2007[_0x485f('0x34')][_0x485f('0x1f')]);}_0x5490d5[_0x485f('0x3b')]=qs[_0x485f('0x3c')](_0x4c2007[_0x485f('0x34')][_0x485f('0x3c')]);_0x5490d5[_0x485f('0x3d')]=qs[_0x485f('0x35')](_['pick'](_0x4c2007[_0x485f('0x34')],_0x5524b1[_0x485f('0x35')]),_0x1c04b4);if(_0x4c2007[_0x485f('0x34')][_0x485f('0x3e')]){_0x5490d5['where']=_[_0x485f('0x3f')](_0x5490d5[_0x485f('0x3d')],{'$or':_['map'](_0x1c04b4,function(_0x772362){if(_0x772362[_0x485f('0x40')]!==_0x485f('0x41')){var _0x54da58={};_0x54da58[_0x772362[_0x485f('0x2d')]]={'$like':'%'+_0x4c2007[_0x485f('0x34')][_0x485f('0x3e')]+'%'};return _0x54da58;}})});}_0x5490d5=_[_0x485f('0x3f')]({},_0x5490d5,_0x4c2007['options']);var _0x3fffc3={'where':_0x5490d5['where']};return db['SmsQueue'][_0x485f('0x22')](_0x3fffc3)[_0x485f('0x28')](function(_0x4e5e08){_0x39f422[_0x485f('0x22')]=_0x4e5e08;if(_0x4c2007['query']['includeAll']){_0x5490d5[_0x485f('0x42')]=[{'all':!![]}];}return db[_0x485f('0x43')]['findAll'](_0x5490d5);})['then'](function(_0x4663a0){_0x39f422['rows']=_0x4663a0;return _0x39f422;})[_0x485f('0x28')](respondWithFilteredResult(_0x18986b,_0x5490d5))['catch'](handleError(_0x18986b,null));};exports[_0x485f('0x44')]=function(_0xdc3043,_0x1abf1e){var _0x447765={'raw':!![],'where':{'id':_0xdc3043[_0x485f('0x45')]['id']}},_0x25f328={};_0x25f328['model']=_[_0x485f('0x46')](db[_0x485f('0x43')][_0x485f('0x31')]);_0x25f328[_0x485f('0x34')]=_[_0x485f('0x46')](_0xdc3043[_0x485f('0x34')]);_0x25f328['filters']=_[_0x485f('0x47')](_0x25f328[_0x485f('0x33')],_0x25f328[_0x485f('0x34')]);_0x447765[_0x485f('0x36')]=_['intersection'](_0x25f328['model'],qs['fields'](_0xdc3043[_0x485f('0x34')]['fields']));_0x447765['attributes']=_0x447765['attributes']['length']?_0x447765['attributes']:_0x25f328['model'];if(_0xdc3043[_0x485f('0x34')][_0x485f('0x48')]){_0x447765['include']=[{'all':!![]}];}_0x447765=_[_0x485f('0x3f')]({},_0x447765,_0xdc3043[_0x485f('0x49')]);return db[_0x485f('0x43')][_0x485f('0x4a')](_0x447765)[_0x485f('0x28')](handleEntityNotFound(_0x1abf1e,null))[_0x485f('0x28')](respondWithResult(_0x1abf1e,null))[_0x485f('0x4b')](handleError(_0x1abf1e,null));};exports[_0x485f('0x4c')]=function(_0x6a9a54,_0x285af9){return db['SmsQueue'][_0x485f('0x4c')](_0x6a9a54['body'],{})[_0x485f('0x28')](function(_0x56bee8){var _0x227071=_0x6a9a54['user'][_0x485f('0x2a')]({'plain':!![]});if(!_0x227071)throw new Error(_0x485f('0x4d'));if(_0x227071[_0x485f('0x4e')]===_0x485f('0x4f')){var _0x38c87f=_0x56bee8[_0x485f('0x2a')]({'plain':!![]});var _0x2bc90f='SmsQueues';return db[_0x485f('0x50')][_0x485f('0x4a')]({'where':{'name':_0x2bc90f,'userProfileId':_0x227071[_0x485f('0x51')]},'raw':!![]})['then'](function(_0x126fd6){if(_0x126fd6&&_0x126fd6[_0x485f('0x52')]===0x0){return db[_0x485f('0x53')][_0x485f('0x4c')]({'name':_0x38c87f[_0x485f('0x2d')],'resourceId':_0x38c87f['id'],'type':_0x126fd6[_0x485f('0x2d')],'sectionId':_0x126fd6['id']},{})[_0x485f('0x28')](function(){return _0x56bee8;});}else{return _0x56bee8;}})['catch'](function(_0x36cace){logger[_0x485f('0x54')](_0x485f('0x55'),_0x36cace);throw _0x36cace;});}return _0x56bee8;})[_0x485f('0x28')](respondWithResult(_0x285af9,0xc9))[_0x485f('0x4b')](handleError(_0x285af9,null));};exports[_0x485f('0x27')]=function(_0xe692ca,_0x4d0baf){if(_0xe692ca[_0x485f('0x56')]['id']){delete _0xe692ca[_0x485f('0x56')]['id'];}return db[_0x485f('0x43')]['find']({'where':{'id':_0xe692ca[_0x485f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d0baf,null))['then'](saveUpdates(_0xe692ca[_0x485f('0x56')],null))[_0x485f('0x28')](respondWithResult(_0x4d0baf,null))['catch'](handleError(_0x4d0baf,null));};exports[_0x485f('0x29')]=function(_0xb814f2,_0x7737a4){return db['SmsQueue'][_0x485f('0x4a')]({'where':{'id':_0xb814f2[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x7737a4,null))[_0x485f('0x28')](removeEntity(_0x7737a4,null))[_0x485f('0x4b')](handleError(_0x7737a4,null));};exports[_0x485f('0x57')]=function(_0x2c5f40,_0x1182dd){return db['SmsQueue'][_0x485f('0x57')]()[_0x485f('0x28')](respondWithResult(_0x1182dd,null))[_0x485f('0x4b')](handleError(_0x1182dd,null));};exports['getMembers']=function(_0x186e29,_0x14d2e5,_0x2f7008){var _0x475b6d={'raw':!![],'where':{}},_0x5886f7={},_0x45d061;return db[_0x485f('0x43')][_0x485f('0x58')]({'where':{'id':_0x186e29[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x14d2e5,null))[_0x485f('0x28')](function(_0x2d0d09){if(_0x2d0d09){_0x45d061=_0x2d0d09[_0x485f('0x2a')]({'plain':!![]});_0x5886f7['model']=_['keys'](db['UserSmsQueue'][_0x485f('0x31')]);_0x5886f7['query']=_['keys'](_0x186e29[_0x485f('0x34')]);_0x5886f7[_0x485f('0x35')]=_['intersection'](_0x5886f7[_0x485f('0x33')],_0x5886f7[_0x485f('0x34')]);_0x475b6d[_0x485f('0x36')]=_['intersection'](_0x5886f7[_0x485f('0x33')],qs[_0x485f('0x37')](_0x186e29[_0x485f('0x34')]['fields']));_0x475b6d[_0x485f('0x36')]=_0x475b6d['attributes']['length']?_0x475b6d[_0x485f('0x36')]:_0x5886f7[_0x485f('0x33')];if(!_0x186e29[_0x485f('0x34')][_0x485f('0x39')](_0x485f('0x3a'))){_0x475b6d[_0x485f('0x21')]=qs['limit'](_0x186e29[_0x485f('0x34')][_0x485f('0x21')]);_0x475b6d[_0x485f('0x1f')]=qs['offset'](_0x186e29[_0x485f('0x34')][_0x485f('0x1f')]);}_0x475b6d[_0x485f('0x3b')]=qs[_0x485f('0x3c')](_0x186e29[_0x485f('0x34')][_0x485f('0x3c')]);_0x475b6d['where']=qs[_0x485f('0x35')](_[_0x485f('0x59')](_0x186e29['query'],_0x5886f7[_0x485f('0x35')]));_0x475b6d[_0x485f('0x3d')]['SmsQueueId']=_0x2d0d09['id'];if(_0x186e29[_0x485f('0x34')]['filter']){_0x475b6d[_0x485f('0x3d')]=_['merge'](_0x475b6d[_0x485f('0x3d')],{'$or':_[_0x485f('0x30')](_0x475b6d['attributes'],function(_0x15942f){var _0x4e1b12={};_0x4e1b12[_0x15942f]={'$like':'%'+_0x186e29[_0x485f('0x34')]['filter']+'%'};return _0x4e1b12;})});}_0x475b6d=_[_0x485f('0x3f')]({},_0x475b6d,_0x186e29[_0x485f('0x49')]);return db[_0x485f('0x5a')][_0x485f('0x5b')](_0x475b6d);}})[_0x485f('0x28')](function(_0x3298c0){if(_0x3298c0){return db['User'][_0x485f('0x5c')]({'where':{'id':_[_0x485f('0x30')](_0x3298c0,'UserId'),'role':_0x485f('0x5d')},'attributes':['id',_0x485f('0x2d'),_0x485f('0x5e'),_0x485f('0x5f'),_0x485f('0x60')]});}})['then'](function(_0x4aebd4){if(_0x4aebd4){return{'count':_0x4aebd4[_0x485f('0x22')],'rows':_['map'](_0x4aebd4[_0x485f('0x61')],function(_0x333390){return{'membername':_0x333390[_0x485f('0x2d')],'UserId':_0x333390['id'],'queue_name':_0x45d061['name'],'SmsQueueId':_0x45d061['id'],'interface':util['format'](_0x485f('0x62'),_0x485f('0x63'),_0x333390[_0x485f('0x2d')]),'penalty':0x0,'paused':_0x333390['smsPause'],'createdAt':_0x333390[_0x485f('0x60')],'updatedAt':_0x333390[_0x485f('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x485f('0x28')](respondWithFilteredResult(_0x14d2e5,_0x475b6d))[_0x485f('0x4b')](handleError(_0x14d2e5,null));};exports[_0x485f('0x64')]=function(_0x4efd7e,_0x29f53d,_0x32fc7d){var _0x1117ba={};var _0x416749={};var _0x1910f5;var _0xfc5cd1;return db[_0x485f('0x43')][_0x485f('0x58')]({'where':{'id':_0x4efd7e[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x29f53d,null))[_0x485f('0x28')](function(_0x4b5caf){if(_0x4b5caf){_0x1910f5=_0x4b5caf;_0x416749[_0x485f('0x33')]=_[_0x485f('0x46')](db['Team'][_0x485f('0x31')]);_0x416749['query']=_[_0x485f('0x46')](_0x4efd7e[_0x485f('0x34')]);_0x416749[_0x485f('0x35')]=_[_0x485f('0x47')](_0x416749['model'],_0x416749[_0x485f('0x34')]);_0x1117ba[_0x485f('0x36')]=_[_0x485f('0x47')](_0x416749[_0x485f('0x33')],qs['fields'](_0x4efd7e[_0x485f('0x34')]['fields']));_0x1117ba[_0x485f('0x36')]=_0x1117ba[_0x485f('0x36')]['length']?_0x1117ba[_0x485f('0x36')]:_0x416749[_0x485f('0x33')];_0x1117ba[_0x485f('0x3b')]=qs[_0x485f('0x3c')](_0x4efd7e[_0x485f('0x34')][_0x485f('0x3c')]);_0x1117ba['where']=qs[_0x485f('0x35')](_[_0x485f('0x59')](_0x4efd7e[_0x485f('0x34')],_0x416749['filters']));if(_0x4efd7e['query'][_0x485f('0x3e')]){_0x1117ba[_0x485f('0x3d')]=_[_0x485f('0x3f')](_0x1117ba[_0x485f('0x3d')],{'$or':_[_0x485f('0x30')](_0x1117ba[_0x485f('0x36')],function(_0x1f47a8){var _0x2c3511={};_0x2c3511[_0x1f47a8]={'$like':'%'+_0x4efd7e[_0x485f('0x34')][_0x485f('0x3e')]+'%'};return _0x2c3511;})});}_0x1117ba=_[_0x485f('0x3f')]({},_0x1117ba,_0x4efd7e[_0x485f('0x49')]);return _0x1910f5[_0x485f('0x64')](_0x1117ba);}})[_0x485f('0x28')](function(_0x4f1558){if(_0x4f1558){_0xfc5cd1=_0x4f1558['length'];if(!_0x4efd7e[_0x485f('0x34')][_0x485f('0x39')](_0x485f('0x3a'))){_0x1117ba[_0x485f('0x21')]=qs[_0x485f('0x21')](_0x4efd7e[_0x485f('0x34')][_0x485f('0x21')]);_0x1117ba['offset']=qs[_0x485f('0x1f')](_0x4efd7e[_0x485f('0x34')]['offset']);}return _0x1910f5[_0x485f('0x64')](_0x1117ba);}})['then'](function(_0x59406a){if(_0x59406a){return _0x59406a?{'count':_0xfc5cd1,'rows':_0x59406a}:null;}})[_0x485f('0x28')](respondWithResult(_0x29f53d,null))['catch'](handleError(_0x29f53d,null));};exports['addTeams']=function(_0x76ed10,_0x2b13d5,_0x1eafe2){var _0x3ac664=_0x76ed10[_0x485f('0x56')][_0x485f('0x65')];return db[_0x485f('0x66')][_0x485f('0x5b')]({'where':{'id':_0x3ac664},'attributes':['id'],'include':[{'model':db[_0x485f('0x67')],'as':_0x485f('0x68'),'attributes':['id','name',_0x485f('0x69'),'voicePause',_0x485f('0x6a')],'raw':!![]}]})[_0x485f('0x28')](function(_0x43a728){if(_0x43a728){var _0x38e823=_[_0x485f('0x6b')](_0x43a728,function(_0x23e8b1){var _0x48f600=_0x23e8b1[_0x485f('0x2a')]({'plain':!![]});return _0x48f600[_0x485f('0x68')];});return db[_0x485f('0x43')][_0x485f('0x4a')]({'where':{'id':_0x76ed10[_0x485f('0x45')]['id']}})['then'](function(_0x4c2c18){return db['sequelize'][_0x485f('0x6c')](function(_0x45eeb1){return _0x4c2c18[_0x485f('0x6d')](_0x3ac664,{'transaction':_0x45eeb1})[_0x485f('0x28')](function(){return BPromise[_0x485f('0x6e')](_0x38e823,function(_0x54531f){return db[_0x485f('0x5a')][_0x485f('0x6f')]({'where':{'UserId':_0x54531f['id'],'SmsQueueId':_0x76ed10['params']['id']},'transaction':_0x45eeb1});});})[_0x485f('0x28')](function(){_0x38e823[_0x485f('0x70')](function(_0x2c15b6){socket[_0x485f('0x71')](_0x485f('0x72'),{'UserId':_0x2c15b6['id'],'SmsQueueId':_0x4c2c18['id']});});});});});}})[_0x485f('0x28')](respondWithStatusCode(_0x2b13d5,null))[_0x485f('0x4b')](handleError(_0x2b13d5,null));};exports[_0x485f('0x73')]=function(_0x30df6c,_0x58dc85,_0xdc1d14){return db[_0x485f('0x66')][_0x485f('0x5b')]({'where':{'id':_0x30df6c[_0x485f('0x34')][_0x485f('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x485f('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x58dc85,null))[_0x485f('0x28')](function(_0x20ef2a){var _0x49d2be=_[_0x485f('0x30')](_0x20ef2a,'id');var _0xbb79cb=[];var _0x14e537=[];var _0x2fb5e5=squel[_0x485f('0x74')]();_0x2fb5e5[_0x485f('0x75')](_0x485f('0x76'))[_0x485f('0x77')](_0x485f('0x78'),'tq')[_0x485f('0x79')](_0x485f('0x7a'),'ut',_0x485f('0x7b'))[_0x485f('0x3d')](_0x485f('0x7c'),_0x30df6c[_0x485f('0x45')]['id']);for(var _0xfa5009=0x0;_0xfa5009<_0x20ef2a[_0x485f('0x38')];_0xfa5009+=0x1){let _0x172cb8=_0x20ef2a[_0xfa5009];for(var _0xb31e2=0x0;_0xb31e2<_0x172cb8[_0x485f('0x68')][_0x485f('0x38')];_0xb31e2+=0x1){let _0x4a3862=_0x172cb8[_0x485f('0x68')][_0xb31e2];var _0x47b8c9=_0x2fb5e5['clone']();_0x47b8c9[_0x485f('0x3d')]('ut.UserId\x20=\x20?',_0x4a3862['id']);_0x14e537[_0x485f('0x7d')](db['sequelize'][_0x485f('0x34')](_0x47b8c9[_0x485f('0x7e')](),{'type':db[_0x485f('0x7f')][_0x485f('0x80')][_0x485f('0x81')]})[_0x485f('0x28')](function(_0x2b39c7){if(_0x2b39c7['length']===0x1){return _0x4a3862['id'];}else{var _0x3b2b68=_[_0x485f('0x82')](_[_0x485f('0x30')](_0x2b39c7,_0x485f('0x83')),function(_0x54a23b){return _[_0x485f('0x84')](_0x49d2be,_0x54a23b);});if(_0x3b2b68){return _0x4a3862['id'];}}}));}}return BPromise['all'](_0x14e537)['then'](function(_0xd7b1dd){_0xbb79cb=_(_0xbb79cb)[_0x485f('0x85')](_0xd7b1dd)[_0x485f('0x86')]()[_0x485f('0x87')]();return db[_0x485f('0x43')][_0x485f('0x4a')]({'where':{'id':_0x30df6c[_0x485f('0x45')]['id']}})[_0x485f('0x28')](function(_0x4f1411){return db[_0x485f('0x7f')][_0x485f('0x6c')](function(_0x50bf96){return _0x4f1411[_0x485f('0x73')](_0x30df6c[_0x485f('0x34')][_0x485f('0x65')],{'transaction':_0x50bf96})[_0x485f('0x28')](function(){if(!_[_0x485f('0x88')](_0xbb79cb)){return _0x4f1411['removeAgents'](_0xbb79cb,{'transaction':_0x50bf96});}})[_0x485f('0x28')](function(){_0xbb79cb[_0x485f('0x70')](function(_0x48fb96){socket[_0x485f('0x71')](_0x485f('0x89'),{'UserId':_0x48fb96,'SmsQueueId':_0x4f1411['id']});});});});});});})[_0x485f('0x28')](respondWithStatusCode(_0x58dc85,null))[_0x485f('0x4b')](handleError(_0x58dc85,null));};exports[_0x485f('0x8a')]=function(_0xe01620,_0x191aee,_0x1518bb){return db[_0x485f('0x43')][_0x485f('0x4a')]({'where':{'id':_0xe01620[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x191aee,null))[_0x485f('0x28')](function(_0x3b0ac9){if(_0x3b0ac9){return _0x3b0ac9[_0x485f('0x8a')](_0xe01620[_0x485f('0x56')]['ids'],_['omit'](_0xe01620[_0x485f('0x56')],['ids','id'])||{})['spread'](function(_0xed7658){for(var _0x3a32a1=0x0;_0x3a32a1<_0xe01620[_0x485f('0x56')]['ids'][_0x485f('0x38')];_0x3a32a1+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0xe01620[_0x485f('0x56')]['ids'][_0x3a32a1]),'SmsQueueId':Number(_0xe01620['params']['id'])});}return _0xed7658;});}})[_0x485f('0x28')](respondWithResult(_0x191aee,null))[_0x485f('0x4b')](handleError(_0x191aee,null));};exports['removeAgents']=function(_0x396f89,_0x38b3ba,_0x3f7a8e){return db[_0x485f('0x43')][_0x485f('0x4a')]({'where':{'id':_0x396f89[_0x485f('0x45')]['id']}})[_0x485f('0x28')](handleEntityNotFound(_0x38b3ba,null))[_0x485f('0x28')](function(_0x281e56){if(_0x281e56){return _0x281e56[_0x485f('0x8b')](_0x396f89['query'][_0x485f('0x65')])[_0x485f('0x28')](function(){if(_[_0x485f('0x8c')](_0x396f89[_0x485f('0x34')][_0x485f('0x65')])){for(var _0x9caa0e=0x0;_0x9caa0e<_0x396f89[_0x485f('0x34')][_0x485f('0x65')]['length'];_0x9caa0e+=0x1){socket['emit'](_0x485f('0x89'),{'UserId':Number(_0x396f89[_0x485f('0x34')]['ids'][_0x9caa0e]),'SmsQueueId':Number(_0x396f89['params']['id'])});}}else{socket[_0x485f('0x71')]('userSmsQueue:remove',{'UserId':Number(_0x396f89[_0x485f('0x34')][_0x485f('0x65')]),'SmsQueueId':Number(_0x396f89['params']['id'])});}});}})[_0x485f('0x28')](respondWithStatusCode(_0x38b3ba,null))[_0x485f('0x4b')](handleError(_0x38b3ba,null));};exports['getAgents']=function(_0x5a9091,_0xf51887,_0x258330){var _0x1229ea={};var _0x310fec={};var _0x5ec3b7;var _0x13d553;return db[_0x485f('0x43')][_0x485f('0x58')]({'where':{'id':_0x5a9091['params']['id']}})[_0x485f('0x28')](handleEntityNotFound(_0xf51887,null))[_0x485f('0x28')](function(_0x19845c){if(_0x19845c){_0x5ec3b7=_0x19845c;_0x310fec['model']=_[_0x485f('0x46')](db['User'][_0x485f('0x31')]);_0x310fec[_0x485f('0x34')]=_[_0x485f('0x46')](_0x5a9091[_0x485f('0x34')]);_0x310fec[_0x485f('0x35')]=_[_0x485f('0x47')](_0x310fec['model'],_0x310fec['query']);_0x1229ea[_0x485f('0x36')]=_[_0x485f('0x47')](_0x310fec['model'],qs[_0x485f('0x37')](_0x5a9091[_0x485f('0x34')]['fields']));_0x1229ea[_0x485f('0x36')]=_0x1229ea[_0x485f('0x36')][_0x485f('0x38')]?_0x1229ea['attributes']:_0x310fec[_0x485f('0x33')];_0x1229ea[_0x485f('0x3b')]=qs[_0x485f('0x3c')](_0x5a9091[_0x485f('0x34')][_0x485f('0x3c')]);_0x1229ea[_0x485f('0x3d')]=qs[_0x485f('0x35')](_[_0x485f('0x59')](_0x5a9091[_0x485f('0x34')],_0x310fec[_0x485f('0x35')]));if(_0x5a9091['query'][_0x485f('0x3e')]){_0x1229ea[_0x485f('0x3d')]=_[_0x485f('0x3f')](_0x1229ea[_0x485f('0x3d')],{'$or':_[_0x485f('0x30')](_0x1229ea[_0x485f('0x36')],function(_0x2f44fd){var _0x5d0fc3={};_0x5d0fc3[_0x2f44fd]={'$like':'%'+_0x5a9091['query'][_0x485f('0x3e')]+'%'};return _0x5d0fc3;})});}_0x1229ea=_[_0x485f('0x3f')]({},_0x1229ea,_0x5a9091[_0x485f('0x49')]);return _0x5ec3b7[_0x485f('0x8d')](_0x1229ea);}})[_0x485f('0x28')](function(_0x4142db){if(_0x4142db){_0x13d553=_0x4142db[_0x485f('0x38')];if(!_0x5a9091['query'][_0x485f('0x39')](_0x485f('0x3a'))){_0x1229ea['limit']=qs[_0x485f('0x21')](_0x5a9091[_0x485f('0x34')][_0x485f('0x21')]);_0x1229ea[_0x485f('0x1f')]=qs['offset'](_0x5a9091[_0x485f('0x34')][_0x485f('0x1f')]);}return _0x5ec3b7[_0x485f('0x8d')](_0x1229ea);}})[_0x485f('0x28')](function(_0x552b41){if(_0x552b41){return _0x552b41?{'count':_0x13d553,'rows':_0x552b41}:null;}})[_0x485f('0x28')](respondWithResult(_0xf51887,null))['catch'](handleError(_0xf51887,null));}; \ No newline at end of file +var _0x9219=['compact','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne','request-promise','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','autoAssociation','update','getMembers','UserSmsQueue','length','order','SmsQueueId','findAndCountAll','smsPause','updatedAt','format','SIP','createdAt','getTeams','Team','User','Agents','online','voicePause','sequelize','transaction','addTeams','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union'];(function(_0x215de4,_0x2ba2b4){var _0x3607d2=function(_0x35e6c6){while(--_0x35e6c6){_0x215de4['push'](_0x215de4['shift']());}};_0x3607d2(++_0x2ba2b4);}(_0x9219,0x19e));var _0x9921=function(_0x1d03f8,_0x555618){_0x1d03f8=_0x1d03f8-0x0;var _0x2b05b3=_0x9219[_0x1d03f8];return _0x2b05b3;};'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(_0x9921('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9921('0x1'));var util=require('util');var path=require('path');var sox=require(_0x9921('0x2'));var csv=require(_0x9921('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9921('0x4'));var _=require(_0x9921('0x5'));var squel=require(_0x9921('0x6'));var crypto=require(_0x9921('0x7'));var jsforce=require(_0x9921('0x8'));var deskjs=require(_0x9921('0x9'));var toCsv=require(_0x9921('0x3'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9921('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x9921('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9921('0xc'));var utils=require(_0x9921('0xd'));var config=require(_0x9921('0xe'));var licenseUtil=require(_0x9921('0xf'));var db=require('../../mysqldb')['db'];config[_0x9921('0x10')]=_['defaults'](config['redis'],{'host':_0x9921('0x11'),'port':0x18eb});var socket=require(_0x9921('0x12'))(new Redis(config['redis']));require(_0x9921('0x13'))[_0x9921('0x14')](socket);function respondWithStatusCode(_0x51638f,_0x94dcf2){_0x94dcf2=_0x94dcf2||0xcc;return function(_0x2be2ee){if(_0x2be2ee){return _0x51638f[_0x9921('0x15')](_0x94dcf2);}return _0x51638f['status'](_0x94dcf2)[_0x9921('0x16')]();};}function respondWithResult(_0x258116,_0xde0720){_0xde0720=_0xde0720||0xc8;return function(_0x4ad6e1){if(_0x4ad6e1){return _0x258116[_0x9921('0x17')](_0xde0720)[_0x9921('0x18')](_0x4ad6e1);}};}function respondWithFilteredResult(_0x47cd77,_0x37c5d3){return function(_0x566838){if(_0x566838){var _0x1e8306=typeof _0x37c5d3[_0x9921('0x19')]===_0x9921('0x1a')&&typeof _0x37c5d3['limit']===_0x9921('0x1a');var _0x823824=_0x566838[_0x9921('0x1b')];var _0x3b5968=_0x1e8306?0x0:_0x37c5d3[_0x9921('0x19')];var _0x1fb798=_0x1e8306?_0x566838['count']:_0x37c5d3[_0x9921('0x19')]+_0x37c5d3[_0x9921('0x1c')];var _0x27f246;if(_0x1fb798>=_0x823824){_0x1fb798=_0x823824;_0x27f246=0xc8;}else{_0x27f246=0xce;}_0x47cd77[_0x9921('0x17')](_0x27f246);return _0x47cd77['set'](_0x9921('0x1d'),_0x3b5968+'-'+_0x1fb798+'/'+_0x823824)[_0x9921('0x18')](_0x566838);}return null;};}function patchUpdates(_0x24023b){return function(_0x2046db){try{jsonpatch[_0x9921('0x1e')](_0x2046db,_0x24023b,!![]);}catch(_0x32c5f3){return BPromise[_0x9921('0x1f')](_0x32c5f3);}return _0x2046db[_0x9921('0x20')]();};}function saveUpdates(_0x2bc3f7,_0x223be2){return function(_0x526d0e){if(_0x526d0e){return _0x526d0e['update'](_0x2bc3f7)[_0x9921('0x21')](function(_0x1e7076){return _0x1e7076;});}return null;};}function removeEntity(_0x51e115,_0x5e0da7){return function(_0x2cdbe4){if(_0x2cdbe4){return _0x2cdbe4[_0x9921('0x22')]()[_0x9921('0x21')](function(){var _0xfa470=_0x2cdbe4['get']({'plain':!![]});var _0x20e97b='SmsQueues';return db[_0x9921('0x23')][_0x9921('0x22')]({'where':{'type':_0x20e97b,'resourceId':_0xfa470['id']}})[_0x9921('0x21')](function(){return _0x2cdbe4;});})['then'](function(){_0x51e115[_0x9921('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x115ee9,_0x3a36c5){return function(_0x1607e6){if(!_0x1607e6){_0x115ee9['sendStatus'](0x194);}return _0x1607e6;};}function handleError(_0x13248a,_0x1d753c){_0x1d753c=_0x1d753c||0x1f4;return function(_0x4ab2cf){logger[_0x9921('0x24')](_0x4ab2cf[_0x9921('0x25')]);if(_0x4ab2cf[_0x9921('0x26')]){delete _0x4ab2cf[_0x9921('0x26')];}_0x13248a[_0x9921('0x17')](_0x1d753c)[_0x9921('0x27')](_0x4ab2cf);};}exports[_0x9921('0x28')]=function(_0x4629e3,_0x4c54e5){var _0xc4cdcf={},_0x2da5a8={},_0x4f1346={'count':0x0,'rows':[]};var _0x45f4d5=_[_0x9921('0x29')](db[_0x9921('0x2a')][_0x9921('0x2b')],function(_0x2fc13c){return{'name':_0x2fc13c[_0x9921('0x2c')],'type':_0x2fc13c[_0x9921('0x2d')]['key']};});_0x2da5a8[_0x9921('0x2e')]=_[_0x9921('0x29')](_0x45f4d5,_0x9921('0x26'));_0x2da5a8[_0x9921('0x2f')]=_[_0x9921('0x30')](_0x4629e3[_0x9921('0x2f')]);_0x2da5a8['filters']=_[_0x9921('0x31')](_0x2da5a8['model'],_0x2da5a8['query']);_0xc4cdcf[_0x9921('0x32')]=_[_0x9921('0x31')](_0x2da5a8[_0x9921('0x2e')],qs['fields'](_0x4629e3[_0x9921('0x2f')][_0x9921('0x33')]));_0xc4cdcf[_0x9921('0x32')]=_0xc4cdcf['attributes']['length']?_0xc4cdcf[_0x9921('0x32')]:_0x2da5a8[_0x9921('0x2e')];if(!_0x4629e3[_0x9921('0x2f')][_0x9921('0x34')](_0x9921('0x35'))){_0xc4cdcf[_0x9921('0x1c')]=qs[_0x9921('0x1c')](_0x4629e3[_0x9921('0x2f')][_0x9921('0x1c')]);_0xc4cdcf['offset']=qs[_0x9921('0x19')](_0x4629e3[_0x9921('0x2f')][_0x9921('0x19')]);}_0xc4cdcf['order']=qs[_0x9921('0x36')](_0x4629e3[_0x9921('0x2f')][_0x9921('0x36')]);_0xc4cdcf['where']=qs[_0x9921('0x37')](_[_0x9921('0x38')](_0x4629e3[_0x9921('0x2f')],_0x2da5a8['filters']),_0x45f4d5);if(_0x4629e3[_0x9921('0x2f')][_0x9921('0x39')]){_0xc4cdcf[_0x9921('0x3a')]=_['merge'](_0xc4cdcf[_0x9921('0x3a')],{'$or':_[_0x9921('0x29')](_0x45f4d5,function(_0x5955e7){if(_0x5955e7[_0x9921('0x2d')]!==_0x9921('0x3b')){var _0x5dcbb2={};_0x5dcbb2[_0x5955e7[_0x9921('0x26')]]={'$like':'%'+_0x4629e3[_0x9921('0x2f')][_0x9921('0x39')]+'%'};return _0x5dcbb2;}})});}_0xc4cdcf=_[_0x9921('0x3c')]({},_0xc4cdcf,_0x4629e3[_0x9921('0x3d')]);var _0x8d4f62={'where':_0xc4cdcf[_0x9921('0x3a')]};return db[_0x9921('0x2a')]['count'](_0x8d4f62)['then'](function(_0x4286f9){_0x4f1346['count']=_0x4286f9;if(_0x4629e3[_0x9921('0x2f')][_0x9921('0x3e')]){_0xc4cdcf[_0x9921('0x3f')]=[{'all':!![]}];}return db[_0x9921('0x2a')][_0x9921('0x40')](_0xc4cdcf);})['then'](function(_0x238fce){_0x4f1346[_0x9921('0x41')]=_0x238fce;return _0x4f1346;})[_0x9921('0x21')](respondWithFilteredResult(_0x4c54e5,_0xc4cdcf))[_0x9921('0x42')](handleError(_0x4c54e5,null));};exports[_0x9921('0x43')]=function(_0x4ed810,_0x431ed5){var _0x396e87={'raw':!![],'where':{'id':_0x4ed810[_0x9921('0x44')]['id']}},_0x4f9e25={};_0x4f9e25[_0x9921('0x2e')]=_[_0x9921('0x30')](db['SmsQueue'][_0x9921('0x2b')]);_0x4f9e25[_0x9921('0x2f')]=_[_0x9921('0x30')](_0x4ed810[_0x9921('0x2f')]);_0x4f9e25[_0x9921('0x37')]=_[_0x9921('0x31')](_0x4f9e25[_0x9921('0x2e')],_0x4f9e25[_0x9921('0x2f')]);_0x396e87['attributes']=_[_0x9921('0x31')](_0x4f9e25[_0x9921('0x2e')],qs[_0x9921('0x33')](_0x4ed810['query'][_0x9921('0x33')]));_0x396e87[_0x9921('0x32')]=_0x396e87[_0x9921('0x32')]['length']?_0x396e87[_0x9921('0x32')]:_0x4f9e25['model'];if(_0x4ed810[_0x9921('0x2f')][_0x9921('0x3e')]){_0x396e87[_0x9921('0x3f')]=[{'all':!![]}];}_0x396e87=_['merge']({},_0x396e87,_0x4ed810[_0x9921('0x3d')]);return db[_0x9921('0x2a')]['find'](_0x396e87)[_0x9921('0x21')](handleEntityNotFound(_0x431ed5,null))[_0x9921('0x21')](respondWithResult(_0x431ed5,null))['catch'](handleError(_0x431ed5,null));};exports[_0x9921('0x45')]=function(_0x1a5406,_0x5023e5){return db[_0x9921('0x2a')][_0x9921('0x45')](_0x1a5406[_0x9921('0x46')],{})['then'](function(_0x52c7fe){var _0x480477=_0x1a5406[_0x9921('0x47')][_0x9921('0x48')]({'plain':!![]});if(!_0x480477)throw new Error(_0x9921('0x49'));if(_0x480477[_0x9921('0x4a')]===_0x9921('0x47')){var _0x4ea3df=_0x52c7fe[_0x9921('0x48')]({'plain':!![]});var _0x501e6a=_0x9921('0x4b');return db['UserProfileSection'][_0x9921('0x4c')]({'where':{'name':_0x501e6a,'userProfileId':_0x480477[_0x9921('0x4d')]},'raw':!![]})[_0x9921('0x21')](function(_0x28e7db){if(_0x28e7db&&_0x28e7db[_0x9921('0x4e')]===0x0){return db[_0x9921('0x23')][_0x9921('0x45')]({'name':_0x4ea3df[_0x9921('0x26')],'resourceId':_0x4ea3df['id'],'type':_0x28e7db[_0x9921('0x26')],'sectionId':_0x28e7db['id']},{})[_0x9921('0x21')](function(){return _0x52c7fe;});}else{return _0x52c7fe;}})[_0x9921('0x42')](function(_0x351177){logger[_0x9921('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x351177);throw _0x351177;});}return _0x52c7fe;})[_0x9921('0x21')](respondWithResult(_0x5023e5,0xc9))[_0x9921('0x42')](handleError(_0x5023e5,null));};exports[_0x9921('0x4f')]=function(_0x9c49f5,_0x31edf7){if(_0x9c49f5[_0x9921('0x46')]['id']){delete _0x9c49f5[_0x9921('0x46')]['id'];}return db[_0x9921('0x2a')]['find']({'where':{'id':_0x9c49f5[_0x9921('0x44')]['id']}})[_0x9921('0x21')](handleEntityNotFound(_0x31edf7,null))[_0x9921('0x21')](saveUpdates(_0x9c49f5['body'],null))['then'](respondWithResult(_0x31edf7,null))[_0x9921('0x42')](handleError(_0x31edf7,null));};exports[_0x9921('0x22')]=function(_0x5bebf9,_0x16a22b){return db['SmsQueue'][_0x9921('0x4c')]({'where':{'id':_0x5bebf9[_0x9921('0x44')]['id']}})['then'](handleEntityNotFound(_0x16a22b,null))[_0x9921('0x21')](removeEntity(_0x16a22b,null))['catch'](handleError(_0x16a22b,null));};exports['describe']=function(_0x51c5ab,_0x2c1e12){return db[_0x9921('0x2a')]['describe']()[_0x9921('0x21')](respondWithResult(_0x2c1e12,null))[_0x9921('0x42')](handleError(_0x2c1e12,null));};exports[_0x9921('0x50')]=function(_0x37617f,_0x21a3a5,_0x44bd47){var _0x341107={'raw':!![],'where':{}},_0x18b8de={},_0xc45b0c;return db[_0x9921('0x2a')]['findOne']({'where':{'id':_0x37617f[_0x9921('0x44')]['id']}})[_0x9921('0x21')](handleEntityNotFound(_0x21a3a5,null))[_0x9921('0x21')](function(_0x4a7d8f){if(_0x4a7d8f){_0xc45b0c=_0x4a7d8f[_0x9921('0x48')]({'plain':!![]});_0x18b8de['model']=_[_0x9921('0x30')](db[_0x9921('0x51')][_0x9921('0x2b')]);_0x18b8de['query']=_[_0x9921('0x30')](_0x37617f[_0x9921('0x2f')]);_0x18b8de['filters']=_[_0x9921('0x31')](_0x18b8de[_0x9921('0x2e')],_0x18b8de['query']);_0x341107['attributes']=_[_0x9921('0x31')](_0x18b8de[_0x9921('0x2e')],qs[_0x9921('0x33')](_0x37617f[_0x9921('0x2f')][_0x9921('0x33')]));_0x341107['attributes']=_0x341107[_0x9921('0x32')][_0x9921('0x52')]?_0x341107[_0x9921('0x32')]:_0x18b8de[_0x9921('0x2e')];if(!_0x37617f[_0x9921('0x2f')][_0x9921('0x34')](_0x9921('0x35'))){_0x341107['limit']=qs[_0x9921('0x1c')](_0x37617f[_0x9921('0x2f')]['limit']);_0x341107['offset']=qs['offset'](_0x37617f[_0x9921('0x2f')]['offset']);}_0x341107[_0x9921('0x53')]=qs[_0x9921('0x36')](_0x37617f[_0x9921('0x2f')][_0x9921('0x36')]);_0x341107[_0x9921('0x3a')]=qs[_0x9921('0x37')](_[_0x9921('0x38')](_0x37617f[_0x9921('0x2f')],_0x18b8de['filters']));_0x341107['where'][_0x9921('0x54')]=_0x4a7d8f['id'];if(_0x37617f[_0x9921('0x2f')][_0x9921('0x39')]){_0x341107[_0x9921('0x3a')]=_[_0x9921('0x3c')](_0x341107['where'],{'$or':_[_0x9921('0x29')](_0x341107['attributes'],function(_0x598283){var _0x5c8a78={};_0x5c8a78[_0x598283]={'$like':'%'+_0x37617f['query'][_0x9921('0x39')]+'%'};return _0x5c8a78;})});}_0x341107=_[_0x9921('0x3c')]({},_0x341107,_0x37617f['options']);return db[_0x9921('0x51')][_0x9921('0x40')](_0x341107);}})['then'](function(_0xcae168){if(_0xcae168){return db['User'][_0x9921('0x55')]({'where':{'id':_[_0x9921('0x29')](_0xcae168,'UserId'),'role':'agent'},'attributes':['id','name',_0x9921('0x56'),_0x9921('0x57'),'createdAt']});}})[_0x9921('0x21')](function(_0x29512c){if(_0x29512c){return{'count':_0x29512c[_0x9921('0x1b')],'rows':_[_0x9921('0x29')](_0x29512c[_0x9921('0x41')],function(_0x5186f6){return{'membername':_0x5186f6['name'],'UserId':_0x5186f6['id'],'queue_name':_0xc45b0c[_0x9921('0x26')],'SmsQueueId':_0xc45b0c['id'],'interface':util[_0x9921('0x58')]('%s/%s',_0x9921('0x59'),_0x5186f6[_0x9921('0x26')]),'penalty':0x0,'paused':_0x5186f6[_0x9921('0x56')],'createdAt':_0x5186f6[_0x9921('0x5a')],'updatedAt':_0x5186f6[_0x9921('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9921('0x21')](respondWithFilteredResult(_0x21a3a5,_0x341107))[_0x9921('0x42')](handleError(_0x21a3a5,null));};exports[_0x9921('0x5b')]=function(_0x3df38c,_0x34994a,_0x3f1ac5){var _0x3ede3a={};var _0x3c14f9={};var _0x33e952;var _0x36415f;return db[_0x9921('0x2a')]['findOne']({'where':{'id':_0x3df38c[_0x9921('0x44')]['id']}})['then'](handleEntityNotFound(_0x34994a,null))[_0x9921('0x21')](function(_0x262d14){if(_0x262d14){_0x33e952=_0x262d14;_0x3c14f9[_0x9921('0x2e')]=_[_0x9921('0x30')](db[_0x9921('0x5c')][_0x9921('0x2b')]);_0x3c14f9[_0x9921('0x2f')]=_[_0x9921('0x30')](_0x3df38c['query']);_0x3c14f9[_0x9921('0x37')]=_[_0x9921('0x31')](_0x3c14f9['model'],_0x3c14f9['query']);_0x3ede3a[_0x9921('0x32')]=_[_0x9921('0x31')](_0x3c14f9[_0x9921('0x2e')],qs[_0x9921('0x33')](_0x3df38c['query'][_0x9921('0x33')]));_0x3ede3a[_0x9921('0x32')]=_0x3ede3a[_0x9921('0x32')][_0x9921('0x52')]?_0x3ede3a[_0x9921('0x32')]:_0x3c14f9[_0x9921('0x2e')];_0x3ede3a[_0x9921('0x53')]=qs[_0x9921('0x36')](_0x3df38c[_0x9921('0x2f')][_0x9921('0x36')]);_0x3ede3a[_0x9921('0x3a')]=qs['filters'](_[_0x9921('0x38')](_0x3df38c[_0x9921('0x2f')],_0x3c14f9[_0x9921('0x37')]));if(_0x3df38c['query'][_0x9921('0x39')]){_0x3ede3a[_0x9921('0x3a')]=_[_0x9921('0x3c')](_0x3ede3a['where'],{'$or':_['map'](_0x3ede3a[_0x9921('0x32')],function(_0x2142e9){var _0xdfcbc3={};_0xdfcbc3[_0x2142e9]={'$like':'%'+_0x3df38c['query'][_0x9921('0x39')]+'%'};return _0xdfcbc3;})});}_0x3ede3a=_[_0x9921('0x3c')]({},_0x3ede3a,_0x3df38c['options']);return _0x33e952['getTeams'](_0x3ede3a);}})[_0x9921('0x21')](function(_0x5804a8){if(_0x5804a8){_0x36415f=_0x5804a8[_0x9921('0x52')];if(!_0x3df38c[_0x9921('0x2f')][_0x9921('0x34')](_0x9921('0x35'))){_0x3ede3a[_0x9921('0x1c')]=qs['limit'](_0x3df38c[_0x9921('0x2f')][_0x9921('0x1c')]);_0x3ede3a[_0x9921('0x19')]=qs[_0x9921('0x19')](_0x3df38c[_0x9921('0x2f')][_0x9921('0x19')]);}return _0x33e952['getTeams'](_0x3ede3a);}})[_0x9921('0x21')](function(_0x1cdf4f){if(_0x1cdf4f){return _0x1cdf4f?{'count':_0x36415f,'rows':_0x1cdf4f}:null;}})[_0x9921('0x21')](respondWithResult(_0x34994a,null))[_0x9921('0x42')](handleError(_0x34994a,null));};exports['addTeams']=function(_0x289acf,_0x28a218,_0x484beb){var _0x3b5e17=_0x289acf['body']['ids'];return db['Team'][_0x9921('0x40')]({'where':{'id':_0x3b5e17},'attributes':['id'],'include':[{'model':db[_0x9921('0x5d')],'as':_0x9921('0x5e'),'attributes':['id','name',_0x9921('0x5f'),_0x9921('0x60'),'interface'],'raw':!![]}]})[_0x9921('0x21')](function(_0x544ae6){if(_0x544ae6){var _0x2be294=_['flatMap'](_0x544ae6,function(_0x524420){var _0x3cfadf=_0x524420[_0x9921('0x48')]({'plain':!![]});return _0x3cfadf[_0x9921('0x5e')];});return db[_0x9921('0x2a')][_0x9921('0x4c')]({'where':{'id':_0x289acf[_0x9921('0x44')]['id']}})[_0x9921('0x21')](function(_0x35ba1e){return db[_0x9921('0x61')][_0x9921('0x62')](function(_0x5173c1){return _0x35ba1e[_0x9921('0x63')](_0x3b5e17,{'transaction':_0x5173c1})[_0x9921('0x21')](function(){return BPromise[_0x9921('0x64')](_0x2be294,function(_0x17ff7d){return db[_0x9921('0x51')][_0x9921('0x65')]({'where':{'UserId':_0x17ff7d['id'],'SmsQueueId':_0x289acf[_0x9921('0x44')]['id']},'transaction':_0x5173c1});});})[_0x9921('0x21')](function(){_0x2be294[_0x9921('0x66')](function(_0x4c5957){socket['emit'](_0x9921('0x67'),{'UserId':_0x4c5957['id'],'SmsQueueId':_0x35ba1e['id']});});});});});}})[_0x9921('0x21')](respondWithStatusCode(_0x28a218,null))['catch'](handleError(_0x28a218,null));};exports[_0x9921('0x68')]=function(_0x545414,_0x5eddd9,_0x5ced07){return db[_0x9921('0x5c')][_0x9921('0x40')]({'where':{'id':_0x545414[_0x9921('0x2f')][_0x9921('0x69')]},'attributes':['id'],'include':[{'model':db[_0x9921('0x5d')],'as':_0x9921('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5eddd9,null))[_0x9921('0x21')](function(_0x2e7e72){var _0x2f9d49=_['map'](_0x2e7e72,'id');var _0x4293a4=[];var _0x13e820=[];var _0x43ae74=squel[_0x9921('0x6a')]();_0x43ae74[_0x9921('0x6b')]('tq.TeamId')[_0x9921('0x6c')](_0x9921('0x6d'),'tq')[_0x9921('0x6e')]('user_has_teams','ut',_0x9921('0x6f'))[_0x9921('0x3a')](_0x9921('0x70'),_0x545414[_0x9921('0x44')]['id']);for(var _0x1e49eb=0x0;_0x1e49eb<_0x2e7e72['length'];_0x1e49eb+=0x1){let _0x3373e0=_0x2e7e72[_0x1e49eb];for(var _0x48d089=0x0;_0x48d089<_0x3373e0[_0x9921('0x5e')][_0x9921('0x52')];_0x48d089+=0x1){let _0x12e484=_0x3373e0['Agents'][_0x48d089];var _0x2620bc=_0x43ae74[_0x9921('0x71')]();_0x2620bc[_0x9921('0x3a')](_0x9921('0x72'),_0x12e484['id']);_0x13e820[_0x9921('0x73')](db[_0x9921('0x61')][_0x9921('0x2f')](_0x2620bc[_0x9921('0x74')](),{'type':db[_0x9921('0x61')][_0x9921('0x75')][_0x9921('0x76')]})[_0x9921('0x21')](function(_0x337ccb){if(_0x337ccb[_0x9921('0x52')]===0x1){return _0x12e484['id'];}else{var _0x31d40e=_[_0x9921('0x77')](_[_0x9921('0x29')](_0x337ccb,'TeamId'),function(_0x324f45){return _[_0x9921('0x78')](_0x2f9d49,_0x324f45);});if(_0x31d40e){return _0x12e484['id'];}}}));}}return BPromise['all'](_0x13e820)[_0x9921('0x21')](function(_0x45b045){_0x4293a4=_(_0x4293a4)[_0x9921('0x79')](_0x45b045)[_0x9921('0x7a')]()[_0x9921('0x7b')]();return db[_0x9921('0x2a')][_0x9921('0x4c')]({'where':{'id':_0x545414[_0x9921('0x44')]['id']}})['then'](function(_0x43f586){return db['sequelize'][_0x9921('0x62')](function(_0x30169e){return _0x43f586[_0x9921('0x68')](_0x545414['query'][_0x9921('0x69')],{'transaction':_0x30169e})[_0x9921('0x21')](function(){if(!_[_0x9921('0x7c')](_0x4293a4)){return _0x43f586[_0x9921('0x7d')](_0x4293a4,{'transaction':_0x30169e});}})[_0x9921('0x21')](function(){_0x4293a4[_0x9921('0x66')](function(_0xe223a0){socket[_0x9921('0x7e')](_0x9921('0x7f'),{'UserId':_0xe223a0,'SmsQueueId':_0x43f586['id']});});});});});});})[_0x9921('0x21')](respondWithStatusCode(_0x5eddd9,null))[_0x9921('0x42')](handleError(_0x5eddd9,null));};exports['addAgents']=function(_0x5cbe16,_0x3dc6c7,_0x210e82){return db[_0x9921('0x2a')]['find']({'where':{'id':_0x5cbe16['params']['id']}})[_0x9921('0x21')](handleEntityNotFound(_0x3dc6c7,null))[_0x9921('0x21')](function(_0x520538){if(_0x520538){return _0x520538[_0x9921('0x80')](_0x5cbe16[_0x9921('0x46')][_0x9921('0x69')],_[_0x9921('0x81')](_0x5cbe16['body'],['ids','id'])||{})[_0x9921('0x82')](function(_0x48e2aa){for(var _0x4634ad=0x0;_0x4634ad<_0x5cbe16[_0x9921('0x46')][_0x9921('0x69')][_0x9921('0x52')];_0x4634ad+=0x1){socket[_0x9921('0x7e')](_0x9921('0x67'),{'UserId':Number(_0x5cbe16['body']['ids'][_0x4634ad]),'SmsQueueId':Number(_0x5cbe16[_0x9921('0x44')]['id'])});}return _0x48e2aa;});}})[_0x9921('0x21')](respondWithResult(_0x3dc6c7,null))[_0x9921('0x42')](handleError(_0x3dc6c7,null));};exports[_0x9921('0x7d')]=function(_0x27c126,_0x542f57,_0x596659){return db[_0x9921('0x2a')][_0x9921('0x4c')]({'where':{'id':_0x27c126[_0x9921('0x44')]['id']}})[_0x9921('0x21')](handleEntityNotFound(_0x542f57,null))[_0x9921('0x21')](function(_0x4c76dc){if(_0x4c76dc){return _0x4c76dc[_0x9921('0x7d')](_0x27c126[_0x9921('0x2f')]['ids'])['then'](function(){if(_[_0x9921('0x83')](_0x27c126[_0x9921('0x2f')][_0x9921('0x69')])){for(var _0x589c42=0x0;_0x589c42<_0x27c126[_0x9921('0x2f')][_0x9921('0x69')][_0x9921('0x52')];_0x589c42+=0x1){socket[_0x9921('0x7e')]('userSmsQueue:remove',{'UserId':Number(_0x27c126[_0x9921('0x2f')][_0x9921('0x69')][_0x589c42]),'SmsQueueId':Number(_0x27c126[_0x9921('0x44')]['id'])});}}else{socket[_0x9921('0x7e')](_0x9921('0x7f'),{'UserId':Number(_0x27c126[_0x9921('0x2f')][_0x9921('0x69')]),'SmsQueueId':Number(_0x27c126['params']['id'])});}});}})[_0x9921('0x21')](respondWithStatusCode(_0x542f57,null))[_0x9921('0x42')](handleError(_0x542f57,null));};exports[_0x9921('0x84')]=function(_0x2b11a0,_0x4a8a80,_0x4665a0){var _0x186699={};var _0x421d6b={};var _0x13eaac;var _0x5aead7;return db[_0x9921('0x2a')][_0x9921('0x85')]({'where':{'id':_0x2b11a0[_0x9921('0x44')]['id']}})[_0x9921('0x21')](handleEntityNotFound(_0x4a8a80,null))['then'](function(_0x3a5932){if(_0x3a5932){_0x13eaac=_0x3a5932;_0x421d6b[_0x9921('0x2e')]=_['keys'](db[_0x9921('0x5d')][_0x9921('0x2b')]);_0x421d6b[_0x9921('0x2f')]=_[_0x9921('0x30')](_0x2b11a0['query']);_0x421d6b[_0x9921('0x37')]=_[_0x9921('0x31')](_0x421d6b['model'],_0x421d6b[_0x9921('0x2f')]);_0x186699['attributes']=_[_0x9921('0x31')](_0x421d6b[_0x9921('0x2e')],qs[_0x9921('0x33')](_0x2b11a0[_0x9921('0x2f')][_0x9921('0x33')]));_0x186699[_0x9921('0x32')]=_0x186699[_0x9921('0x32')][_0x9921('0x52')]?_0x186699[_0x9921('0x32')]:_0x421d6b['model'];_0x186699['order']=qs[_0x9921('0x36')](_0x2b11a0[_0x9921('0x2f')][_0x9921('0x36')]);_0x186699['where']=qs[_0x9921('0x37')](_['pick'](_0x2b11a0[_0x9921('0x2f')],_0x421d6b[_0x9921('0x37')]));if(_0x2b11a0[_0x9921('0x2f')][_0x9921('0x39')]){_0x186699['where']=_[_0x9921('0x3c')](_0x186699[_0x9921('0x3a')],{'$or':_[_0x9921('0x29')](_0x186699[_0x9921('0x32')],function(_0xf4223f){var _0x12d61f={};_0x12d61f[_0xf4223f]={'$like':'%'+_0x2b11a0[_0x9921('0x2f')][_0x9921('0x39')]+'%'};return _0x12d61f;})});}_0x186699=_['merge']({},_0x186699,_0x2b11a0['options']);return _0x13eaac[_0x9921('0x84')](_0x186699);}})['then'](function(_0x233074){if(_0x233074){_0x5aead7=_0x233074[_0x9921('0x52')];if(!_0x2b11a0['query'][_0x9921('0x34')](_0x9921('0x35'))){_0x186699[_0x9921('0x1c')]=qs['limit'](_0x2b11a0[_0x9921('0x2f')][_0x9921('0x1c')]);_0x186699['offset']=qs['offset'](_0x2b11a0[_0x9921('0x2f')][_0x9921('0x19')]);}return _0x13eaac[_0x9921('0x84')](_0x186699);}})[_0x9921('0x21')](function(_0x2738d2){if(_0x2738d2){return _0x2738d2?{'count':_0x5aead7,'rows':_0x2738d2}:null;}})[_0x9921('0x21')](respondWithResult(_0x4a8a80,null))[_0x9921('0x42')](handleError(_0x4a8a80,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 050ec46..773ab5a 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 _0x54c4=['exports','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4271af,_0x3e029a){var _0xd7968b=function(_0x281889){while(--_0x281889){_0x4271af['push'](_0x4271af['shift']());}};_0xd7968b(++_0x3e029a);}(_0x54c4,0xeb));var _0x454c=function(_0x4381f6,_0x2ce6a9){_0x4381f6=_0x4381f6-0x0;var _0x400b46=_0x54c4[_0x4381f6];return _0x400b46;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x454c('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x454c('0x1')](0x0);var events={'afterCreate':_0x454c('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4702d8){return function(_0x19c1b0,_0x14a661,_0x5c586d){SmsQueueEvents[_0x454c('0x3')](_0x4702d8+':'+_0x19c1b0['id'],_0x19c1b0);SmsQueueEvents['emit'](_0x4702d8,_0x19c1b0);_0x5c586d(null);};}for(var e in events){if(events[_0x454c('0x4')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x454c('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0xeed7=['hook','exports','events','../../mysqldb','SmsQueue','save','update','remove','emit'];(function(_0xb214cc,_0x269734){var _0x1e3067=function(_0xa6ef05){while(--_0xa6ef05){_0xb214cc['push'](_0xb214cc['shift']());}};_0x1e3067(++_0x269734);}(_0xeed7,0x12b));var _0x7eed=function(_0x52abfb,_0x5b55b8){_0x52abfb=_0x52abfb-0x0;var _0xcbae29=_0xeed7[_0x52abfb];return _0xcbae29;};'use strict';var EventEmitter=require(_0x7eed('0x0'));var SmsQueue=require(_0x7eed('0x1'))['db'][_0x7eed('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7eed('0x3'),'afterUpdate':_0x7eed('0x4'),'afterDestroy':_0x7eed('0x5')};function emitEvent(_0xf6f19b){return function(_0x270461,_0x2d3302,_0x45c243){SmsQueueEvents[_0x7eed('0x6')](_0xf6f19b+':'+_0x270461['id'],_0x270461);SmsQueueEvents['emit'](_0xf6f19b,_0x270461);_0x45c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x7eed('0x7')](e,emitEvent(event));}}module[_0x7eed('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 cdc048f..7632ada 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 _0xf989=['../../config/environment','SmsQueue','util','../../config/logger','api','moment','bluebird','path'];(function(_0x54daa6,_0x20bd95){var _0x5eea2e=function(_0x508973){while(--_0x508973){_0x54daa6['push'](_0x54daa6['shift']());}};_0x5eea2e(++_0x20bd95);}(_0xf989,0x19a));var _0x9f98=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xf989[_0x5e9a69];return _0x5979c8;};'use strict';var _=require('lodash');var util=require(_0x9f98('0x0'));var logger=require(_0x9f98('0x1'))(_0x9f98('0x2'));var moment=require(_0x9f98('0x3'));var BPromise=require(_0x9f98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f98('0x5'));var rimraf=require('rimraf');var config=require(_0x9f98('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x4a8108,_0x43a45e){return _0x4a8108['define'](_0x9f98('0x7'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6dda=['exports','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','./smsQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6dda,0x7b));var _0xa6dd=function(_0x3cbee6,_0x42183f){_0x3cbee6=_0x3cbee6-0x0;var _0x4e03db=_0x6dda[_0x3cbee6];return _0x4e03db;};'use strict';var _=require(_0xa6dd('0x0'));var util=require('util');var logger=require(_0xa6dd('0x1'))(_0xa6dd('0x2'));var moment=require(_0xa6dd('0x3'));var BPromise=require(_0xa6dd('0x4'));var rp=require(_0xa6dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa6dd('0x6'));module[_0xa6dd('0x7')]=function(_0x4921cc,_0x250397){return _0x4921cc['define'](_0xa6dd('0x8'),attributes,{'tableName':_0xa6dd('0x9'),'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 8c487f6..95c5048 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 _0xb50f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','SmsQueue','findAll','options','where','attributes','map','include','model','GetSmsQueue','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring'];(function(_0xf0ab7c,_0x23bbc2){var _0x198144=function(_0x1c3a40){while(--_0x1c3a40){_0xf0ab7c['push'](_0xf0ab7c['shift']());}};_0x198144(++_0x23bbc2);}(_0xb50f,0xf7));var _0xfb50=function(_0x9d39e9,_0x3aebc9){_0x9d39e9=_0x9d39e9-0x0;var _0x4ac75b=_0xb50f[_0x9d39e9];return _0x4ac75b;};'use strict';var _=require(_0xfb50('0x0'));var util=require(_0xfb50('0x1'));var moment=require(_0xfb50('0x2'));var BPromise=require(_0xfb50('0x3'));var rs=require(_0xfb50('0x4'));var fs=require('fs');var Redis=require(_0xfb50('0x5'));var db=require(_0xfb50('0x6'))['db'];var utils=require(_0xfb50('0x7'));var logger=require(_0xfb50('0x8'))(_0xfb50('0x9'));var config=require('../../config/environment');var jayson=require(_0xfb50('0xa'));var client=jayson[_0xfb50('0xb')][_0xfb50('0xc')]({'port':0x232a});config[_0xfb50('0xd')]=_[_0xfb50('0xe')](config[_0xfb50('0xd')],{'host':_0xfb50('0xf'),'port':0x18eb});var socket=require(_0xfb50('0x10'))(new Redis(config[_0xfb50('0xd')]));require(_0xfb50('0x11'))[_0xfb50('0x12')](socket);function respondWithRpcPromise(_0x554238,_0x56a3d3,_0x43e560){return new BPromise(function(_0x40d03d,_0x154a6a){return client[_0xfb50('0x13')](_0x554238,_0x43e560)[_0xfb50('0x14')](function(_0x126667){logger['info'](_0xfb50('0x15'),_0x56a3d3,'request\x20sent');logger[_0xfb50('0x16')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x56a3d3,_0xfb50('0x17'),JSON[_0xfb50('0x18')](_0x126667));if(_0x126667['error']){if(_0x126667[_0xfb50('0x19')]['code']===0x1f4){logger[_0xfb50('0x19')](_0xfb50('0x15'),_0x56a3d3,_0x126667[_0xfb50('0x19')][_0xfb50('0x1a')]);return _0x154a6a(_0x126667[_0xfb50('0x19')][_0xfb50('0x1a')]);}logger[_0xfb50('0x19')](_0xfb50('0x15'),_0x56a3d3,_0x126667[_0xfb50('0x19')][_0xfb50('0x1a')]);return _0x40d03d(_0x126667[_0xfb50('0x19')][_0xfb50('0x1a')]);}else{logger[_0xfb50('0x1b')](_0xfb50('0x15'),_0x56a3d3,_0xfb50('0x17'));_0x40d03d(_0x126667[_0xfb50('0x1c')][_0xfb50('0x1a')]);}})[_0xfb50('0x1d')](function(_0x5080a0){logger['error'](_0xfb50('0x15'),_0x56a3d3,_0x5080a0);_0x154a6a(_0x5080a0);});});}exports['GetSmsQueue']=function(_0x297460){var _0x51f5ad=this;return new Promise(function(_0x15e28c,_0x384858){return db[_0xfb50('0x1e')][_0xfb50('0x1f')]({'raw':_0x297460['options']?_0x297460['options']['raw']===undefined?!![]:![]:!![],'where':_0x297460[_0xfb50('0x20')]?_0x297460[_0xfb50('0x20')][_0xfb50('0x21')]||null:null,'attributes':_0x297460[_0xfb50('0x20')]?_0x297460[_0xfb50('0x20')][_0xfb50('0x22')]||null:null,'limit':_0x297460[_0xfb50('0x20')]?_0x297460[_0xfb50('0x20')]['limit']||null:null,'include':_0x297460[_0xfb50('0x20')]?_0x297460[_0xfb50('0x20')]['include']?_[_0xfb50('0x23')](_0x297460[_0xfb50('0x20')][_0xfb50('0x24')],function(_0x424f3b){return{'model':db[_0x424f3b['model']],'as':_0x424f3b['as'],'attributes':_0x424f3b['attributes'],'include':_0x424f3b['include']?_[_0xfb50('0x23')](_0x424f3b[_0xfb50('0x24')],function(_0x4aa5cc){return{'model':db[_0x4aa5cc[_0xfb50('0x25')]],'as':_0x4aa5cc['as'],'attributes':_0x4aa5cc[_0xfb50('0x22')],'include':_0x4aa5cc[_0xfb50('0x24')]?_[_0xfb50('0x23')](_0x4aa5cc[_0xfb50('0x24')],function(_0x5e9810){return{'model':db[_0x5e9810[_0xfb50('0x25')]],'as':_0x5e9810['as'],'attributes':_0x5e9810[_0xfb50('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfb50('0x14')](function(_0x1bcf3c){logger[_0xfb50('0x1b')]('GetSmsQueue',_0x297460);logger['debug'](_0xfb50('0x26'),_0x297460,JSON['stringify'](_0x1bcf3c));_0x15e28c(_0x1bcf3c);})[_0xfb50('0x1d')](function(_0x184f38){logger[_0xfb50('0x19')](_0xfb50('0x26'),_0x184f38[_0xfb50('0x1a')],_0x297460);_0x384858(_0x51f5ad[_0xfb50('0x19')](0x1f4,_0x184f38[_0xfb50('0x1a')]));});});};exports[_0xfb50('0x27')]=function(_0x592fe3){var _0x4e5e41=this;return new Promise(function(_0x3d052c,_0x13e588){return db[_0xfb50('0x1e')][_0xfb50('0x28')]({'raw':_0x592fe3['options']?_0x592fe3[_0xfb50('0x20')][_0xfb50('0x29')]===undefined?!![]:![]:!![],'where':_0x592fe3[_0xfb50('0x20')]?_0x592fe3['options'][_0xfb50('0x21')]||null:null,'attributes':_0x592fe3[_0xfb50('0x20')]?_0x592fe3[_0xfb50('0x20')][_0xfb50('0x22')]||null:null,'include':_0x592fe3[_0xfb50('0x20')]?_0x592fe3['options'][_0xfb50('0x24')]?_[_0xfb50('0x23')](_0x592fe3[_0xfb50('0x20')][_0xfb50('0x24')],function(_0x27341b){return{'model':db[_0x27341b[_0xfb50('0x25')]],'as':_0x27341b['as'],'attributes':_0x27341b[_0xfb50('0x22')],'include':_0x27341b[_0xfb50('0x24')]?_[_0xfb50('0x23')](_0x27341b[_0xfb50('0x24')],function(_0x4f29c5){return{'model':db[_0x4f29c5[_0xfb50('0x25')]],'as':_0x4f29c5['as'],'attributes':_0x4f29c5[_0xfb50('0x22')],'include':_0x4f29c5[_0xfb50('0x24')]?_['map'](_0x4f29c5[_0xfb50('0x24')],function(_0x34b6e1){return{'model':db[_0x34b6e1[_0xfb50('0x25')]],'as':_0x34b6e1['as'],'attributes':_0x34b6e1[_0xfb50('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb82579){logger[_0xfb50('0x1b')]('ShowSmsQueue',_0x592fe3);logger[_0xfb50('0x16')]('ShowSmsQueue',_0x592fe3,JSON[_0xfb50('0x18')](_0xb82579));_0x3d052c(_0xb82579);})[_0xfb50('0x1d')](function(_0x6829f4){logger[_0xfb50('0x19')](_0xfb50('0x27'),_0x6829f4[_0xfb50('0x1a')],_0x592fe3);_0x13e588(_0x4e5e41[_0xfb50('0x19')](0x1f4,_0x6829f4[_0xfb50('0x1a')]));});});}; \ No newline at end of file +var _0xb7ad=['error','code','message','SmsQueue,\x20%s,\x20%s','request\x20sent','result','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','map','include','model','then','ShowSmsQueue','find','where','catch','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb7ad,0xa9));var _0xdb7a=function(_0x3e6ea7,_0x5695ef){_0x3e6ea7=_0x3e6ea7-0x0;var _0x159f02=_0xb7ad[_0x3e6ea7];return _0x159f02;};'use strict';var _=require('lodash');var util=require(_0xdb7a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb7a('0x1'));var db=require(_0xdb7a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb7a('0x3'))(_0xdb7a('0x4'));var config=require(_0xdb7a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdb7a('0x6')][_0xdb7a('0x7')]({'port':0x232a});config[_0xdb7a('0x8')]=_[_0xdb7a('0x9')](config[_0xdb7a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb7a('0xa'))(new Redis(config[_0xdb7a('0x8')]));require('./smsQueue.socket')[_0xdb7a('0xb')](socket);function respondWithRpcPromise(_0x55cfff,_0xb57a0c,_0x3d6ee3){return new BPromise(function(_0x13b039,_0x52b47b){return client['request'](_0x55cfff,_0x3d6ee3)['then'](function(_0x1fb806){logger[_0xdb7a('0xc')]('SmsQueue,\x20%s,\x20%s',_0xb57a0c,'request\x20sent');logger[_0xdb7a('0xd')](_0xdb7a('0xe'),_0xb57a0c,'request\x20sent',JSON[_0xdb7a('0xf')](_0x1fb806));if(_0x1fb806[_0xdb7a('0x10')]){if(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x11')]===0x1f4){logger[_0xdb7a('0x10')]('SmsQueue,\x20%s,\x20%s',_0xb57a0c,_0x1fb806[_0xdb7a('0x10')]['message']);return _0x52b47b(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);}logger[_0xdb7a('0x10')](_0xdb7a('0x13'),_0xb57a0c,_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);return _0x13b039(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);}else{logger[_0xdb7a('0xc')](_0xdb7a('0x13'),_0xb57a0c,_0xdb7a('0x14'));_0x13b039(_0x1fb806[_0xdb7a('0x15')][_0xdb7a('0x12')]);}})['catch'](function(_0x1d8993){logger['error'](_0xdb7a('0x13'),_0xb57a0c,_0x1d8993);_0x52b47b(_0x1d8993);});});}exports[_0xdb7a('0x16')]=function(_0x20674b){var _0x3f90cc=this;return new Promise(function(_0x46ac0d,_0x49e9c7){return db[_0xdb7a('0x17')][_0xdb7a('0x18')]({'raw':_0x20674b[_0xdb7a('0x19')]?_0x20674b['options'][_0xdb7a('0x1a')]===undefined?!![]:![]:!![],'where':_0x20674b[_0xdb7a('0x19')]?_0x20674b['options']['where']||null:null,'attributes':_0x20674b[_0xdb7a('0x19')]?_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1b')]||null:null,'limit':_0x20674b[_0xdb7a('0x19')]?_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1c')]||null:null,'include':_0x20674b['options']?_0x20674b[_0xdb7a('0x19')]['include']?_[_0xdb7a('0x1d')](_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1e')],function(_0x550d02){return{'model':db[_0x550d02[_0xdb7a('0x1f')]],'as':_0x550d02['as'],'attributes':_0x550d02[_0xdb7a('0x1b')],'include':_0x550d02[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0x550d02[_0xdb7a('0x1e')],function(_0x4ce062){return{'model':db[_0x4ce062[_0xdb7a('0x1f')]],'as':_0x4ce062['as'],'attributes':_0x4ce062[_0xdb7a('0x1b')],'include':_0x4ce062[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0x4ce062[_0xdb7a('0x1e')],function(_0x454770){return{'model':db[_0x454770[_0xdb7a('0x1f')]],'as':_0x454770['as'],'attributes':_0x454770['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb7a('0x20')](function(_0x3ced59){logger[_0xdb7a('0xc')](_0xdb7a('0x16'),_0x20674b);logger[_0xdb7a('0xd')]('GetSmsQueue',_0x20674b,JSON[_0xdb7a('0xf')](_0x3ced59));_0x46ac0d(_0x3ced59);})['catch'](function(_0x4db3c9){logger['error'](_0xdb7a('0x16'),_0x4db3c9['message'],_0x20674b);_0x49e9c7(_0x3f90cc['error'](0x1f4,_0x4db3c9[_0xdb7a('0x12')]));});});};exports[_0xdb7a('0x21')]=function(_0x3145f3){var _0x520977=this;return new Promise(function(_0x2db3b0,_0x354ba9){return db['SmsQueue'][_0xdb7a('0x22')]({'raw':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3[_0xdb7a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3['options'][_0xdb7a('0x23')]||null:null,'attributes':_0x3145f3['options']?_0x3145f3[_0xdb7a('0x19')]['attributes']||null:null,'include':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3[_0xdb7a('0x19')]['include']?_[_0xdb7a('0x1d')](_0x3145f3[_0xdb7a('0x19')][_0xdb7a('0x1e')],function(_0xf33f1c){return{'model':db[_0xf33f1c['model']],'as':_0xf33f1c['as'],'attributes':_0xf33f1c[_0xdb7a('0x1b')],'include':_0xf33f1c[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0xf33f1c[_0xdb7a('0x1e')],function(_0xac76d2){return{'model':db[_0xac76d2[_0xdb7a('0x1f')]],'as':_0xac76d2['as'],'attributes':_0xac76d2[_0xdb7a('0x1b')],'include':_0xac76d2['include']?_[_0xdb7a('0x1d')](_0xac76d2['include'],function(_0x589d0c){return{'model':db[_0x589d0c['model']],'as':_0x589d0c['as'],'attributes':_0x589d0c[_0xdb7a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30ae17){logger['info'](_0xdb7a('0x21'),_0x3145f3);logger[_0xdb7a('0xd')](_0xdb7a('0x21'),_0x3145f3,JSON[_0xdb7a('0xf')](_0x30ae17));_0x2db3b0(_0x30ae17);})[_0xdb7a('0x24')](function(_0x4e037d){logger[_0xdb7a('0x10')](_0xdb7a('0x21'),_0x4e037d[_0xdb7a('0x12')],_0x3145f3);_0x354ba9(_0x520977[_0xdb7a('0x10')](0x1f4,_0x4e037d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 60d57a1..7f013f1 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 _0x67c7=['emit','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x1334fd,_0x32c3cf){var _0x95cbc3=function(_0x4d8871){while(--_0x4d8871){_0x1334fd['push'](_0x1334fd['shift']());}};_0x95cbc3(++_0x32c3cf);}(_0x67c7,0xd6));var _0x767c=function(_0x18b931,_0x2cad1d){_0x18b931=_0x18b931-0x0;var _0x114958=_0x67c7[_0x18b931];return _0x114958;};'use strict';var SmsQueueEvents=require(_0x767c('0x0'));var events=[_0x767c('0x1'),_0x767c('0x2'),'update'];function createListener(_0x4ce604,_0x58981f){return function(_0x1b8483){_0x58981f[_0x767c('0x3')](_0x4ce604,_0x1b8483);};}function removeListener(_0x4491e0,_0x59c58c){return function(){SmsQueueEvents['removeListener'](_0x4491e0,_0x59c58c);};}exports[_0x767c('0x4')]=function(_0x27d04f){for(var _0x19a6cf=0x0,_0x12b68f=events[_0x767c('0x5')];_0x19a6cf<_0x12b68f;_0x19a6cf++){var _0x274a9d=events[_0x19a6cf];var _0x1b2802=createListener(_0x767c('0x6')+_0x274a9d,_0x27d04f);SmsQueueEvents['on'](_0x274a9d,_0x1b2802);}}; \ No newline at end of file +var _0x6637=['register','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x3fd4e0,_0x1e38a4){var _0x4d53f1=function(_0x51890b){while(--_0x51890b){_0x3fd4e0['push'](_0x3fd4e0['shift']());}};_0x4d53f1(++_0x1e38a4);}(_0x6637,0x158));var _0x7663=function(_0x548a97,_0x158795){_0x548a97=_0x548a97-0x0;var _0x1ed152=_0x6637[_0x548a97];return _0x1ed152;};'use strict';var SmsQueueEvents=require(_0x7663('0x0'));var events=[_0x7663('0x1'),_0x7663('0x2'),_0x7663('0x3')];function createListener(_0x5298f7,_0x130217){return function(_0xff3db){_0x130217[_0x7663('0x4')](_0x5298f7,_0xff3db);};}function removeListener(_0x3cdd69,_0xf39f59){return function(){SmsQueueEvents[_0x7663('0x5')](_0x3cdd69,_0xf39f59);};}exports[_0x7663('0x6')]=function(_0x2aa60a){for(var _0x23286b=0x0,_0x5a8671=events['length'];_0x23286b<_0x5a8671;_0x23286b++){var _0x3baee6=events[_0x23286b];var _0x599161=createListener('smsQueue:'+_0x3baee6,_0x2aa60a);SmsQueueEvents['on'](_0x3baee6,_0x599161);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 23af7db..fe53b7f 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 _0x59ec=['/describe','/:id','show','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index'];(function(_0x127c99,_0x21a74c){var _0xde5427=function(_0x5f0123){while(--_0x5f0123){_0x127c99['push'](_0x127c99['shift']());}};_0xde5427(++_0x21a74c);}(_0x59ec,0x102));var _0xc59e=function(_0x306ba5,_0x100287){_0x306ba5=_0x306ba5-0x0;var _0xe2e6db=_0x59ec[_0x306ba5];return _0xe2e6db;};'use strict';var multer=require(_0xc59e('0x0'));var util=require(_0xc59e('0x1'));var path=require('path');var timeout=require(_0xc59e('0x2'));var express=require(_0xc59e('0x3'));var router=express['Router']();var fs_extra=require(_0xc59e('0x4'));var auth=require(_0xc59e('0x5'));var interaction=require(_0xc59e('0x6'));var config=require(_0xc59e('0x7'));var controller=require(_0xc59e('0x8'));router[_0xc59e('0x9')]('/',auth[_0xc59e('0xa')](),controller[_0xc59e('0xb')]);router[_0xc59e('0x9')](_0xc59e('0xc'),auth[_0xc59e('0xa')](),controller['describe']);router[_0xc59e('0x9')](_0xc59e('0xd'),auth['isAuthenticated'](),controller[_0xc59e('0xe')]);router['post']('/',auth[_0xc59e('0xa')](),controller['create']);router['put'](_0xc59e('0xd'),auth[_0xc59e('0xa')](),controller[_0xc59e('0xf')]);router[_0xc59e('0x10')]('/:id',auth[_0xc59e('0xa')](),controller['destroy']);module[_0xc59e('0x11')]=router; \ No newline at end of file +var _0x2882=['show','post','create','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/describe'];(function(_0x2fe12f,_0x32f4fa){var _0x2fcc2a=function(_0x5f43fb){while(--_0x5f43fb){_0x2fe12f['push'](_0x2fe12f['shift']());}};_0x2fcc2a(++_0x32f4fa);}(_0x2882,0x1db));var _0x2288=function(_0x4e0a37,_0x1ec9d5){_0x4e0a37=_0x4e0a37-0x0;var _0x291e06=_0x2882[_0x4e0a37];return _0x291e06;};'use strict';var multer=require(_0x2288('0x0'));var util=require('util');var path=require(_0x2288('0x1'));var timeout=require(_0x2288('0x2'));var express=require(_0x2288('0x3'));var router=express[_0x2288('0x4')]();var fs_extra=require(_0x2288('0x5'));var auth=require(_0x2288('0x6'));var interaction=require(_0x2288('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x2288('0x8')](),controller['index']);router[_0x2288('0x9')](_0x2288('0xa'),auth[_0x2288('0x8')](),controller['describe']);router[_0x2288('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2288('0xb')]);router[_0x2288('0xc')]('/',auth[_0x2288('0x8')](),controller[_0x2288('0xd')]);router[_0x2288('0xe')]('/:id',auth[_0x2288('0x8')](),controller['update']);router['delete'](_0x2288('0xf'),auth[_0x2288('0x8')](),controller[_0x2288('0x10')]);module[_0x2288('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index d3012fe..cfd9f55 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 _0xd9d6=['moment','exports','STRING','DATE'];(function(_0x504910,_0x4b33a0){var _0x24da1d=function(_0x2eece3){while(--_0x2eece3){_0x504910['push'](_0x504910['shift']());}};_0x24da1d(++_0x4b33a0);}(_0xd9d6,0x184));var _0x6d9d=function(_0x151ff0,_0x58f275){_0x151ff0=_0x151ff0-0x0;var _0x43075b=_0xd9d6[_0x151ff0];return _0x43075b;};'use strict';var moment=require(_0x6d9d('0x0'));var Sequelize=require('sequelize');module[_0x6d9d('0x1')]={'uniqueid':{'type':Sequelize[_0x6d9d('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6d9d('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6d9d('0x3')]},'exitAt':{'type':Sequelize[_0x6d9d('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x616d=['exports','STRING','DATE','sequelize'];(function(_0x43fda2,_0x1c5662){var _0xa492a2=function(_0x3a92c4){while(--_0x3a92c4){_0x43fda2['push'](_0x43fda2['shift']());}};_0xa492a2(++_0x1c5662);}(_0x616d,0x1c3));var _0xd616=function(_0x5c1083,_0x21d209){_0x5c1083=_0x5c1083-0x0;var _0x16ffa4=_0x616d[_0x5c1083];return _0x16ffa4;};'use strict';var moment=require('moment');var Sequelize=require(_0xd616('0x0'));module[_0xd616('0x1')]={'uniqueid':{'type':Sequelize[_0xd616('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd616('0x2')]},'joinAt':{'type':Sequelize[_0xd616('0x3')]},'leaveAt':{'type':Sequelize[_0xd616('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd616('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0e84ee1..248e193 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 _0xfea5=['hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','include','findAll','catch','params','rawAttributes','length','includeAll','options','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SmsQueueReport','type','key','model','query','keys','attributes','intersection','fields'];(function(_0x522a93,_0x25147d){var _0x2ea295=function(_0x5b32e9){while(--_0x5b32e9){_0x522a93['push'](_0x522a93['shift']());}};_0x2ea295(++_0x25147d);}(_0xfea5,0x1d1));var _0x5fea=function(_0x2c8d58,_0x5706d1){_0x2c8d58=_0x2c8d58-0x0;var _0x1b00c9=_0xfea5[_0x2c8d58];return _0x1b00c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5fea('0x0'));var jsonpatch=require(_0x5fea('0x1'));var rp=require(_0x5fea('0x2'));var moment=require(_0x5fea('0x3'));var BPromise=require(_0x5fea('0x4'));var Mustache=require(_0x5fea('0x5'));var util=require(_0x5fea('0x6'));var path=require(_0x5fea('0x7'));var sox=require('sox');var csv=require(_0x5fea('0x8'));var ejs=require(_0x5fea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5fea('0xa'));var crypto=require(_0x5fea('0xb'));var jsforce=require(_0x5fea('0xc'));var deskjs=require(_0x5fea('0xd'));var toCsv=require(_0x5fea('0x8'));var querystring=require(_0x5fea('0xe'));var Papa=require(_0x5fea('0xf'));var Redis=require('ioredis');var authService=require(_0x5fea('0x10'));var qs=require(_0x5fea('0x11'));var as=require(_0x5fea('0x12'));var hardwareService=require(_0x5fea('0x13'));var logger=require(_0x5fea('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5fea('0x15'));var licenseUtil=require(_0x5fea('0x16'));var db=require(_0x5fea('0x17'))['db'];function respondWithStatusCode(_0x30cb11,_0xd172ed){_0xd172ed=_0xd172ed||0xcc;return function(_0xc1fe4){if(_0xc1fe4){return _0x30cb11['sendStatus'](_0xd172ed);}return _0x30cb11[_0x5fea('0x18')](_0xd172ed)[_0x5fea('0x19')]();};}function respondWithResult(_0xe07167,_0x2840d5){_0x2840d5=_0x2840d5||0xc8;return function(_0x4bdd86){if(_0x4bdd86){return _0xe07167[_0x5fea('0x18')](_0x2840d5)[_0x5fea('0x1a')](_0x4bdd86);}};}function respondWithFilteredResult(_0x29bd90,_0xb1f85){return function(_0x5d7e5a){if(_0x5d7e5a){var _0x58c128=typeof _0xb1f85[_0x5fea('0x1b')]==='undefined'&&typeof _0xb1f85[_0x5fea('0x1c')]===_0x5fea('0x1d');var _0x1bc80c=_0x5d7e5a[_0x5fea('0x1e')];var _0x4ca8e1=_0x58c128?0x0:_0xb1f85['offset'];var _0x2d890b=_0x58c128?_0x5d7e5a['count']:_0xb1f85[_0x5fea('0x1b')]+_0xb1f85[_0x5fea('0x1c')];var _0x3d6673;if(_0x2d890b>=_0x1bc80c){_0x2d890b=_0x1bc80c;_0x3d6673=0xc8;}else{_0x3d6673=0xce;}_0x29bd90[_0x5fea('0x18')](_0x3d6673);return _0x29bd90['set'](_0x5fea('0x1f'),_0x4ca8e1+'-'+_0x2d890b+'/'+_0x1bc80c)['json'](_0x5d7e5a);}return null;};}function patchUpdates(_0x358104){return function(_0xb22f32){try{jsonpatch[_0x5fea('0x20')](_0xb22f32,_0x358104,!![]);}catch(_0x53f0af){return BPromise[_0x5fea('0x21')](_0x53f0af);}return _0xb22f32[_0x5fea('0x22')]();};}function saveUpdates(_0x5662d1,_0x3a4d2f){return function(_0x4607e9){if(_0x4607e9){return _0x4607e9[_0x5fea('0x23')](_0x5662d1)[_0x5fea('0x24')](function(_0x4bc6c6){return _0x4bc6c6;});}return null;};}function removeEntity(_0x54d2b0,_0x3fb871){return function(_0x3174ea){if(_0x3174ea){return _0x3174ea[_0x5fea('0x25')]()[_0x5fea('0x24')](function(){_0x54d2b0[_0x5fea('0x18')](0xcc)[_0x5fea('0x19')]();});}};}function handleEntityNotFound(_0x1845d7,_0x1aa471){return function(_0x509543){if(!_0x509543){_0x1845d7[_0x5fea('0x26')](0x194);}return _0x509543;};}function handleError(_0x39bcc2,_0x2dab5b){_0x2dab5b=_0x2dab5b||0x1f4;return function(_0x26c0a1){logger[_0x5fea('0x27')](_0x26c0a1[_0x5fea('0x28')]);if(_0x26c0a1[_0x5fea('0x29')]){delete _0x26c0a1[_0x5fea('0x29')];}_0x39bcc2[_0x5fea('0x18')](_0x2dab5b)['send'](_0x26c0a1);};}exports[_0x5fea('0x2a')]=function(_0x11ccde,_0x4d2c17){var _0x3438a9={},_0x36ab92={},_0x3ca83b={'count':0x0,'rows':[]};var _0x1da973=_[_0x5fea('0x2b')](db[_0x5fea('0x2c')]['rawAttributes'],function(_0x412d74){return{'name':_0x412d74['fieldName'],'type':_0x412d74[_0x5fea('0x2d')][_0x5fea('0x2e')]};});_0x36ab92[_0x5fea('0x2f')]=_['map'](_0x1da973,'name');_0x36ab92[_0x5fea('0x30')]=_[_0x5fea('0x31')](_0x11ccde[_0x5fea('0x30')]);_0x36ab92['filters']=_['intersection'](_0x36ab92[_0x5fea('0x2f')],_0x36ab92[_0x5fea('0x30')]);_0x3438a9[_0x5fea('0x32')]=_[_0x5fea('0x33')](_0x36ab92[_0x5fea('0x2f')],qs[_0x5fea('0x34')](_0x11ccde['query'][_0x5fea('0x34')]));_0x3438a9[_0x5fea('0x32')]=_0x3438a9['attributes']['length']?_0x3438a9[_0x5fea('0x32')]:_0x36ab92[_0x5fea('0x2f')];if(!_0x11ccde[_0x5fea('0x30')][_0x5fea('0x35')](_0x5fea('0x36'))){_0x3438a9[_0x5fea('0x1c')]=qs[_0x5fea('0x1c')](_0x11ccde[_0x5fea('0x30')][_0x5fea('0x1c')]);_0x3438a9[_0x5fea('0x1b')]=qs['offset'](_0x11ccde[_0x5fea('0x30')][_0x5fea('0x1b')]);}_0x3438a9[_0x5fea('0x37')]=qs[_0x5fea('0x38')](_0x11ccde['query'][_0x5fea('0x38')]);_0x3438a9['where']=qs[_0x5fea('0x39')](_[_0x5fea('0x3a')](_0x11ccde['query'],_0x36ab92['filters']),_0x1da973);if(_0x11ccde[_0x5fea('0x30')][_0x5fea('0x3b')]){_0x3438a9[_0x5fea('0x3c')]=_['merge'](_0x3438a9[_0x5fea('0x3c')],{'$or':_[_0x5fea('0x2b')](_0x1da973,function(_0x393d23){if(_0x393d23['type']!=='VIRTUAL'){var _0x19165a={};_0x19165a[_0x393d23[_0x5fea('0x29')]]={'$like':'%'+_0x11ccde[_0x5fea('0x30')]['filter']+'%'};return _0x19165a;}})});}_0x3438a9=_[_0x5fea('0x3d')]({},_0x3438a9,_0x11ccde['options']);var _0x563f6c={'where':_0x3438a9['where']};return db[_0x5fea('0x2c')][_0x5fea('0x1e')](_0x563f6c)[_0x5fea('0x24')](function(_0x2cef98){_0x3ca83b[_0x5fea('0x1e')]=_0x2cef98;if(_0x11ccde[_0x5fea('0x30')]['includeAll']){_0x3438a9[_0x5fea('0x3e')]=[{'all':!![]}];}return db[_0x5fea('0x2c')][_0x5fea('0x3f')](_0x3438a9);})[_0x5fea('0x24')](function(_0x24ed7e){_0x3ca83b['rows']=_0x24ed7e;return _0x3ca83b;})[_0x5fea('0x24')](respondWithFilteredResult(_0x4d2c17,_0x3438a9))[_0x5fea('0x40')](handleError(_0x4d2c17,null));};exports['show']=function(_0x48d8ee,_0x2f4035){var _0x2b1a0c={'raw':!![],'where':{'id':_0x48d8ee[_0x5fea('0x41')]['id']}},_0x9a87b={};_0x9a87b[_0x5fea('0x2f')]=_['keys'](db[_0x5fea('0x2c')][_0x5fea('0x42')]);_0x9a87b['query']=_['keys'](_0x48d8ee[_0x5fea('0x30')]);_0x9a87b[_0x5fea('0x39')]=_['intersection'](_0x9a87b[_0x5fea('0x2f')],_0x9a87b[_0x5fea('0x30')]);_0x2b1a0c['attributes']=_[_0x5fea('0x33')](_0x9a87b[_0x5fea('0x2f')],qs[_0x5fea('0x34')](_0x48d8ee[_0x5fea('0x30')]['fields']));_0x2b1a0c['attributes']=_0x2b1a0c[_0x5fea('0x32')][_0x5fea('0x43')]?_0x2b1a0c[_0x5fea('0x32')]:_0x9a87b[_0x5fea('0x2f')];if(_0x48d8ee[_0x5fea('0x30')][_0x5fea('0x44')]){_0x2b1a0c[_0x5fea('0x3e')]=[{'all':!![]}];}_0x2b1a0c=_[_0x5fea('0x3d')]({},_0x2b1a0c,_0x48d8ee[_0x5fea('0x45')]);return db[_0x5fea('0x2c')]['find'](_0x2b1a0c)[_0x5fea('0x24')](handleEntityNotFound(_0x2f4035,null))[_0x5fea('0x24')](respondWithResult(_0x2f4035,null))['catch'](handleError(_0x2f4035,null));};exports[_0x5fea('0x46')]=function(_0x421705,_0x5525da){return db[_0x5fea('0x2c')]['create'](_0x421705[_0x5fea('0x47')],{})[_0x5fea('0x24')](respondWithResult(_0x5525da,0xc9))[_0x5fea('0x40')](handleError(_0x5525da,null));};exports[_0x5fea('0x23')]=function(_0x730148,_0x45abf5){if(_0x730148[_0x5fea('0x47')]['id']){delete _0x730148['body']['id'];}return db[_0x5fea('0x2c')][_0x5fea('0x48')]({'where':{'id':_0x730148[_0x5fea('0x41')]['id']}})[_0x5fea('0x24')](handleEntityNotFound(_0x45abf5,null))[_0x5fea('0x24')](saveUpdates(_0x730148['body'],null))['then'](respondWithResult(_0x45abf5,null))[_0x5fea('0x40')](handleError(_0x45abf5,null));};exports[_0x5fea('0x25')]=function(_0x509639,_0x25f95d){return db[_0x5fea('0x2c')][_0x5fea('0x48')]({'where':{'id':_0x509639['params']['id']}})[_0x5fea('0x24')](handleEntityNotFound(_0x25f95d,null))[_0x5fea('0x24')](removeEntity(_0x25f95d,null))['catch'](handleError(_0x25f95d,null));};exports[_0x5fea('0x49')]=function(_0xdaa384,_0x440505){return db[_0x5fea('0x2c')][_0x5fea('0x49')]()[_0x5fea('0x24')](respondWithResult(_0x440505,null))[_0x5fea('0x40')](handleError(_0x440505,null));}; \ No newline at end of file +var _0xddfb=['key','model','keys','query','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','then','catch','show','params','intersection','includeAll','find','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','end','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xddfb,0x1f1));var _0xbddf=function(_0x2f9efb,_0x1844c5){_0x2f9efb=_0x2f9efb-0x0;var _0x45e8cc=_0xddfb[_0x2f9efb];return _0x45e8cc;};'use strict';var emlformat=require(_0xbddf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbddf('0x1'));var rp=require('request-promise');var moment=require(_0xbddf('0x2'));var BPromise=require(_0xbddf('0x3'));var Mustache=require(_0xbddf('0x4'));var util=require(_0xbddf('0x5'));var path=require(_0xbddf('0x6'));var sox=require(_0xbddf('0x7'));var csv=require(_0xbddf('0x8'));var ejs=require(_0xbddf('0x9'));var fs=require('fs');var fs_extra=require(_0xbddf('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbddf('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbddf('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbddf('0xd'));var Papa=require(_0xbddf('0xe'));var Redis=require(_0xbddf('0xf'));var authService=require(_0xbddf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbddf('0x11'));var hardwareService=require(_0xbddf('0x12'));var logger=require(_0xbddf('0x13'))(_0xbddf('0x14'));var utils=require(_0xbddf('0x15'));var config=require(_0xbddf('0x16'));var licenseUtil=require(_0xbddf('0x17'));var db=require(_0xbddf('0x18'))['db'];function respondWithStatusCode(_0x57178b,_0x24ef57){_0x24ef57=_0x24ef57||0xcc;return function(_0x5a7533){if(_0x5a7533){return _0x57178b['sendStatus'](_0x24ef57);}return _0x57178b[_0xbddf('0x19')](_0x24ef57)['end']();};}function respondWithResult(_0x6fff35,_0x101156){_0x101156=_0x101156||0xc8;return function(_0x1ec734){if(_0x1ec734){return _0x6fff35['status'](_0x101156)[_0xbddf('0x1a')](_0x1ec734);}};}function respondWithFilteredResult(_0xea1783,_0x1a3fbe){return function(_0x50c535){if(_0x50c535){var _0x46757e=typeof _0x1a3fbe[_0xbddf('0x1b')]==='undefined'&&typeof _0x1a3fbe[_0xbddf('0x1c')]===_0xbddf('0x1d');var _0x414822=_0x50c535[_0xbddf('0x1e')];var _0x3cf810=_0x46757e?0x0:_0x1a3fbe[_0xbddf('0x1b')];var _0x1094a9=_0x46757e?_0x50c535[_0xbddf('0x1e')]:_0x1a3fbe[_0xbddf('0x1b')]+_0x1a3fbe[_0xbddf('0x1c')];var _0x4af9a8;if(_0x1094a9>=_0x414822){_0x1094a9=_0x414822;_0x4af9a8=0xc8;}else{_0x4af9a8=0xce;}_0xea1783[_0xbddf('0x19')](_0x4af9a8);return _0xea1783[_0xbddf('0x1f')](_0xbddf('0x20'),_0x3cf810+'-'+_0x1094a9+'/'+_0x414822)['json'](_0x50c535);}return null;};}function patchUpdates(_0x2f5ba6){return function(_0x145a3f){try{jsonpatch[_0xbddf('0x21')](_0x145a3f,_0x2f5ba6,!![]);}catch(_0x331735){return BPromise[_0xbddf('0x22')](_0x331735);}return _0x145a3f[_0xbddf('0x23')]();};}function saveUpdates(_0x13fa56,_0x10b8ab){return function(_0x9f8dad){if(_0x9f8dad){return _0x9f8dad[_0xbddf('0x24')](_0x13fa56)['then'](function(_0x39ff44){return _0x39ff44;});}return null;};}function removeEntity(_0x192ff0,_0x55bc95){return function(_0x65259){if(_0x65259){return _0x65259['destroy']()['then'](function(){_0x192ff0[_0xbddf('0x19')](0xcc)[_0xbddf('0x25')]();});}};}function handleEntityNotFound(_0x473556,_0x5d8544){return function(_0x4856e3){if(!_0x4856e3){_0x473556[_0xbddf('0x26')](0x194);}return _0x4856e3;};}function handleError(_0x2bbd9e,_0x4d6585){_0x4d6585=_0x4d6585||0x1f4;return function(_0x565aea){logger[_0xbddf('0x27')](_0x565aea[_0xbddf('0x28')]);if(_0x565aea[_0xbddf('0x29')]){delete _0x565aea[_0xbddf('0x29')];}_0x2bbd9e[_0xbddf('0x19')](_0x4d6585)[_0xbddf('0x2a')](_0x565aea);};}exports[_0xbddf('0x2b')]=function(_0x3664a1,_0x71ae4e){var _0x5a1bf8={},_0x36b183={},_0x411f9a={'count':0x0,'rows':[]};var _0x5abe21=_[_0xbddf('0x2c')](db[_0xbddf('0x2d')][_0xbddf('0x2e')],function(_0x5be5dd){return{'name':_0x5be5dd[_0xbddf('0x2f')],'type':_0x5be5dd[_0xbddf('0x30')][_0xbddf('0x31')]};});_0x36b183[_0xbddf('0x32')]=_[_0xbddf('0x2c')](_0x5abe21,'name');_0x36b183['query']=_[_0xbddf('0x33')](_0x3664a1[_0xbddf('0x34')]);_0x36b183['filters']=_['intersection'](_0x36b183[_0xbddf('0x32')],_0x36b183[_0xbddf('0x34')]);_0x5a1bf8['attributes']=_['intersection'](_0x36b183['model'],qs[_0xbddf('0x35')](_0x3664a1['query'][_0xbddf('0x35')]));_0x5a1bf8[_0xbddf('0x36')]=_0x5a1bf8[_0xbddf('0x36')][_0xbddf('0x37')]?_0x5a1bf8['attributes']:_0x36b183[_0xbddf('0x32')];if(!_0x3664a1[_0xbddf('0x34')]['hasOwnProperty'](_0xbddf('0x38'))){_0x5a1bf8['limit']=qs[_0xbddf('0x1c')](_0x3664a1[_0xbddf('0x34')][_0xbddf('0x1c')]);_0x5a1bf8['offset']=qs[_0xbddf('0x1b')](_0x3664a1[_0xbddf('0x34')][_0xbddf('0x1b')]);}_0x5a1bf8[_0xbddf('0x39')]=qs[_0xbddf('0x3a')](_0x3664a1[_0xbddf('0x34')][_0xbddf('0x3a')]);_0x5a1bf8[_0xbddf('0x3b')]=qs[_0xbddf('0x3c')](_[_0xbddf('0x3d')](_0x3664a1[_0xbddf('0x34')],_0x36b183[_0xbddf('0x3c')]),_0x5abe21);if(_0x3664a1[_0xbddf('0x34')][_0xbddf('0x3e')]){_0x5a1bf8['where']=_[_0xbddf('0x3f')](_0x5a1bf8[_0xbddf('0x3b')],{'$or':_['map'](_0x5abe21,function(_0xb1e373){if(_0xb1e373[_0xbddf('0x30')]!==_0xbddf('0x40')){var _0x48172f={};_0x48172f[_0xb1e373['name']]={'$like':'%'+_0x3664a1[_0xbddf('0x34')][_0xbddf('0x3e')]+'%'};return _0x48172f;}})});}_0x5a1bf8=_['merge']({},_0x5a1bf8,_0x3664a1[_0xbddf('0x41')]);var _0x5205a1={'where':_0x5a1bf8[_0xbddf('0x3b')]};return db[_0xbddf('0x2d')][_0xbddf('0x1e')](_0x5205a1)['then'](function(_0x2ca7a1){_0x411f9a[_0xbddf('0x1e')]=_0x2ca7a1;if(_0x3664a1[_0xbddf('0x34')]['includeAll']){_0x5a1bf8[_0xbddf('0x42')]=[{'all':!![]}];}return db[_0xbddf('0x2d')][_0xbddf('0x43')](_0x5a1bf8);})[_0xbddf('0x44')](function(_0x9921e7){_0x411f9a['rows']=_0x9921e7;return _0x411f9a;})[_0xbddf('0x44')](respondWithFilteredResult(_0x71ae4e,_0x5a1bf8))[_0xbddf('0x45')](handleError(_0x71ae4e,null));};exports[_0xbddf('0x46')]=function(_0x181a13,_0x1157b0){var _0x13195d={'raw':!![],'where':{'id':_0x181a13[_0xbddf('0x47')]['id']}},_0x5ddedc={};_0x5ddedc[_0xbddf('0x32')]=_['keys'](db[_0xbddf('0x2d')]['rawAttributes']);_0x5ddedc['query']=_['keys'](_0x181a13[_0xbddf('0x34')]);_0x5ddedc['filters']=_[_0xbddf('0x48')](_0x5ddedc['model'],_0x5ddedc['query']);_0x13195d['attributes']=_[_0xbddf('0x48')](_0x5ddedc[_0xbddf('0x32')],qs[_0xbddf('0x35')](_0x181a13[_0xbddf('0x34')]['fields']));_0x13195d[_0xbddf('0x36')]=_0x13195d[_0xbddf('0x36')]['length']?_0x13195d['attributes']:_0x5ddedc[_0xbddf('0x32')];if(_0x181a13[_0xbddf('0x34')][_0xbddf('0x49')]){_0x13195d[_0xbddf('0x42')]=[{'all':!![]}];}_0x13195d=_[_0xbddf('0x3f')]({},_0x13195d,_0x181a13[_0xbddf('0x41')]);return db[_0xbddf('0x2d')][_0xbddf('0x4a')](_0x13195d)[_0xbddf('0x44')](handleEntityNotFound(_0x1157b0,null))[_0xbddf('0x44')](respondWithResult(_0x1157b0,null))[_0xbddf('0x45')](handleError(_0x1157b0,null));};exports[_0xbddf('0x4b')]=function(_0x2474e0,_0x159dbf){return db[_0xbddf('0x2d')][_0xbddf('0x4b')](_0x2474e0[_0xbddf('0x4c')],{})[_0xbddf('0x44')](respondWithResult(_0x159dbf,0xc9))[_0xbddf('0x45')](handleError(_0x159dbf,null));};exports[_0xbddf('0x24')]=function(_0x34f90b,_0x2d7e20){if(_0x34f90b['body']['id']){delete _0x34f90b[_0xbddf('0x4c')]['id'];}return db[_0xbddf('0x2d')][_0xbddf('0x4a')]({'where':{'id':_0x34f90b[_0xbddf('0x47')]['id']}})[_0xbddf('0x44')](handleEntityNotFound(_0x2d7e20,null))[_0xbddf('0x44')](saveUpdates(_0x34f90b[_0xbddf('0x4c')],null))[_0xbddf('0x44')](respondWithResult(_0x2d7e20,null))[_0xbddf('0x45')](handleError(_0x2d7e20,null));};exports['destroy']=function(_0x40002b,_0x12cc7c){return db['SmsQueueReport']['find']({'where':{'id':_0x40002b[_0xbddf('0x47')]['id']}})[_0xbddf('0x44')](handleEntityNotFound(_0x12cc7c,null))[_0xbddf('0x44')](removeEntity(_0x12cc7c,null))['catch'](handleError(_0x12cc7c,null));};exports[_0xbddf('0x4d')]=function(_0x419418,_0x4a239a){return db[_0xbddf('0x2d')]['describe']()[_0xbddf('0x44')](respondWithResult(_0x4a239a,null))[_0xbddf('0x45')](handleError(_0x4a239a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4b25ae4..5e9e6c1 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x3cb445,_0x12497f){var _0x18ee80=function(_0x3ccb9e){while(--_0x3ccb9e){_0x3cb445['push'](_0x3cb445['shift']());}};_0x18ee80(++_0x12497f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xb7e7[_0x1abb09];return _0xea1c07;};'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_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'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(_0x4131c2,_0x26ccce){var _0x1ca43f=function(_0x1dc3e7){while(--_0x1dc3e7){_0x4131c2['push'](_0x4131c2['shift']());}};_0x1ca43f(++_0x26ccce);}(_0xe706,0xa3));var _0x6e70=function(_0x450d4e,_0xcacc3){_0x450d4e=_0x450d4e-0x0;var _0x300304=_0xe706[_0x450d4e];return _0x300304;};'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 0122821..85088d4 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 _0xc08a=['limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','SmsQueueReport','body','options','raw','CreateSmsQueueReport','where','attributes'];(function(_0x22d2a8,_0x34224b){var _0x4c6392=function(_0x3ddcc5){while(--_0x3ddcc5){_0x22d2a8['push'](_0x22d2a8['shift']());}};_0x4c6392(++_0x34224b);}(_0xc08a,0xbc));var _0xac08=function(_0x42c165,_0x18a3e1){_0x42c165=_0x42c165-0x0;var _0x232268=_0xc08a[_0x42c165];return _0x232268;};'use strict';var _=require(_0xac08('0x0'));var util=require(_0xac08('0x1'));var moment=require(_0xac08('0x2'));var BPromise=require(_0xac08('0x3'));var rs=require(_0xac08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac08('0x5'));var logger=require(_0xac08('0x6'))(_0xac08('0x7'));var config=require('../../config/environment');var jayson=require(_0xac08('0x8'));var client=jayson['client'][_0xac08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a5ec7,_0x179c3e,_0x29e15b){return new BPromise(function(_0x1609f9,_0x30f84e){return client[_0xac08('0xa')](_0x8a5ec7,_0x29e15b)[_0xac08('0xb')](function(_0x59a162){logger[_0xac08('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x179c3e,_0xac08('0xd'));logger[_0xac08('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x179c3e,'request\x20sent',JSON[_0xac08('0xf')](_0x59a162));if(_0x59a162[_0xac08('0x10')]){if(_0x59a162[_0xac08('0x10')][_0xac08('0x11')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x179c3e,_0x59a162[_0xac08('0x10')]['message']);return _0x30f84e(_0x59a162['error'][_0xac08('0x12')]);}logger[_0xac08('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x179c3e,_0x59a162[_0xac08('0x10')]['message']);return _0x1609f9(_0x59a162[_0xac08('0x10')][_0xac08('0x12')]);}else{logger['info'](_0xac08('0x13'),_0x179c3e,_0xac08('0xd'));_0x1609f9(_0x59a162[_0xac08('0x14')][_0xac08('0x12')]);}})[_0xac08('0x15')](function(_0x38a5b9){logger[_0xac08('0x10')](_0xac08('0x13'),_0x179c3e,_0x38a5b9);_0x30f84e(_0x38a5b9);});});}exports['CreateSmsQueueReport']=function(_0x2c6d4d){var _0x365bbe=this;return new Promise(function(_0x5836ea,_0x3483ef){return db[_0xac08('0x16')]['create'](_0x2c6d4d[_0xac08('0x17')],{'raw':_0x2c6d4d['options']?_0x2c6d4d[_0xac08('0x18')][_0xac08('0x19')]===undefined?!![]:![]:!![]})[_0xac08('0xb')](function(_0x41634a){logger['info'](_0xac08('0x1a'),_0x2c6d4d);logger[_0xac08('0xe')]('CreateSmsQueueReport',_0x2c6d4d,JSON[_0xac08('0xf')](_0x41634a));_0x5836ea(_0x41634a);})[_0xac08('0x15')](function(_0x596345){logger[_0xac08('0x10')](_0xac08('0x1a'),_0x596345['message'],_0x2c6d4d);_0x3483ef(_0x365bbe[_0xac08('0x10')](0x1f4,_0x596345[_0xac08('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x507fc0){var _0x188b50=this;return new Promise(function(_0x27e3bb,_0x36c0b8){return db[_0xac08('0x16')]['update'](_0x507fc0[_0xac08('0x17')],{'raw':_0x507fc0['options']?_0x507fc0[_0xac08('0x18')][_0xac08('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x507fc0[_0xac08('0x18')]?_0x507fc0[_0xac08('0x18')][_0xac08('0x1b')]||null:null,'attributes':_0x507fc0['options']?_0x507fc0[_0xac08('0x18')][_0xac08('0x1c')]||null:null,'limit':_0x507fc0[_0xac08('0x18')]?_0x507fc0[_0xac08('0x18')][_0xac08('0x1d')]||null:null})['then'](function(_0x298b93){logger[_0xac08('0xc')]('UpdateSmsQueueReport',_0x507fc0);logger[_0xac08('0xe')](_0xac08('0x1e'),_0x507fc0,JSON[_0xac08('0xf')](_0x298b93));_0x27e3bb(_0x298b93);})[_0xac08('0x15')](function(_0x5d48b0){logger[_0xac08('0x10')](_0xac08('0x1e'),_0x5d48b0[_0xac08('0x12')],_0x507fc0);_0x36c0b8(_0x188b50[_0xac08('0x10')](0x1f4,_0x5d48b0[_0xac08('0x12')]));});});}; \ No newline at end of file +var _0x3e5e=['where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','error','code','SmsQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','SmsQueueReport','body','options','raw','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x3e5e,0xd5));var _0xe3e5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3e5e[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xe3e5('0x0'));var moment=require(_0xe3e5('0x1'));var BPromise=require(_0xe3e5('0x2'));var rs=require(_0xe3e5('0x3'));var fs=require('fs');var Redis=require(_0xe3e5('0x4'));var db=require(_0xe3e5('0x5'))['db'];var utils=require(_0xe3e5('0x6'));var logger=require(_0xe3e5('0x7'))(_0xe3e5('0x8'));var config=require(_0xe3e5('0x9'));var jayson=require(_0xe3e5('0xa'));var client=jayson[_0xe3e5('0xb')][_0xe3e5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x285667,_0x5a7de0,_0x145671){return new BPromise(function(_0x50c176,_0x8acbd7){return client[_0xe3e5('0xd')](_0x285667,_0x145671)[_0xe3e5('0xe')](function(_0x362586){logger[_0xe3e5('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x5a7de0,'request\x20sent');logger[_0xe3e5('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5a7de0,'request\x20sent',JSON['stringify'](_0x362586));if(_0x362586[_0xe3e5('0x11')]){if(_0x362586[_0xe3e5('0x11')][_0xe3e5('0x12')]===0x1f4){logger[_0xe3e5('0x11')](_0xe3e5('0x13'),_0x5a7de0,_0x362586[_0xe3e5('0x11')]['message']);return _0x8acbd7(_0x362586['error'][_0xe3e5('0x14')]);}logger[_0xe3e5('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x5a7de0,_0x362586[_0xe3e5('0x11')]['message']);return _0x50c176(_0x362586[_0xe3e5('0x11')][_0xe3e5('0x14')]);}else{logger['info'](_0xe3e5('0x13'),_0x5a7de0,_0xe3e5('0x15'));_0x50c176(_0x362586[_0xe3e5('0x16')][_0xe3e5('0x14')]);}})[_0xe3e5('0x17')](function(_0x4a0ba6){logger[_0xe3e5('0x11')](_0xe3e5('0x13'),_0x5a7de0,_0x4a0ba6);_0x8acbd7(_0x4a0ba6);});});}exports['CreateSmsQueueReport']=function(_0x303708){var _0x65b2f5=this;return new Promise(function(_0x150c18,_0x2c2c70){return db[_0xe3e5('0x18')]['create'](_0x303708[_0xe3e5('0x19')],{'raw':_0x303708[_0xe3e5('0x1a')]?_0x303708[_0xe3e5('0x1a')][_0xe3e5('0x1b')]===undefined?!![]:![]:!![]})[_0xe3e5('0xe')](function(_0x6dd200){logger[_0xe3e5('0xf')]('CreateSmsQueueReport',_0x303708);logger[_0xe3e5('0x10')](_0xe3e5('0x1c'),_0x303708,JSON[_0xe3e5('0x1d')](_0x6dd200));_0x150c18(_0x6dd200);})[_0xe3e5('0x17')](function(_0x1558f8){logger[_0xe3e5('0x11')](_0xe3e5('0x1c'),_0x1558f8[_0xe3e5('0x14')],_0x303708);_0x2c2c70(_0x65b2f5[_0xe3e5('0x11')](0x1f4,_0x1558f8['message']));});});};exports[_0xe3e5('0x1e')]=function(_0x40be1d){var _0x200db9=this;return new Promise(function(_0x5f1f36,_0x20201b){return db[_0xe3e5('0x18')][_0xe3e5('0x1f')](_0x40be1d[_0xe3e5('0x19')],{'raw':_0x40be1d[_0xe3e5('0x1a')]?_0x40be1d['options'][_0xe3e5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40be1d[_0xe3e5('0x1a')]?_0x40be1d['options'][_0xe3e5('0x20')]||null:null,'attributes':_0x40be1d['options']?_0x40be1d['options'][_0xe3e5('0x21')]||null:null,'limit':_0x40be1d[_0xe3e5('0x1a')]?_0x40be1d[_0xe3e5('0x1a')][_0xe3e5('0x22')]||null:null})[_0xe3e5('0xe')](function(_0xff1ff){logger[_0xe3e5('0xf')](_0xe3e5('0x1e'),_0x40be1d);logger[_0xe3e5('0x10')](_0xe3e5('0x1e'),_0x40be1d,JSON[_0xe3e5('0x1d')](_0xff1ff));_0x5f1f36(_0xff1ff);})[_0xe3e5('0x17')](function(_0x4ccf10){logger[_0xe3e5('0x11')](_0xe3e5('0x1e'),_0x4ccf10[_0xe3e5('0x14')],_0x40be1d);_0x20201b(_0x200db9[_0xe3e5('0x11')](0x1f4,_0x4ccf10['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1c6d9db..84ff74e 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 _0x3e74=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsTransferReport.controller'];(function(_0x1beb72,_0x5ab126){var _0x4d2049=function(_0x14c38f){while(--_0x14c38f){_0x1beb72['push'](_0x1beb72['shift']());}};_0x4d2049(++_0x5ab126);}(_0x3e74,0x175));var _0x43e7=function(_0x6092cb,_0x5095db){_0x6092cb=_0x6092cb-0x0;var _0x22822f=_0x3e74[_0x6092cb];return _0x22822f;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x46ed=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','multer'];(function(_0xa21c85,_0x1dabfa){var _0x490538=function(_0x1f92c9){while(--_0x1f92c9){_0xa21c85['push'](_0xa21c85['shift']());}};_0x490538(++_0x1dabfa);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x8')](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x8')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller['show']);router[_0xd46e('0xe')]('/',auth[_0xd46e('0x9')](),controller['create']);router[_0xd46e('0xf')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x10')]);router[_0xd46e('0x11')](_0xd46e('0xd'),auth['isAuthenticated'](),controller[_0xd46e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f1d49aa..de42d49 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x169dff,_0x57be0){var _0x91cf22=function(_0x527498){while(--_0x527498){_0x169dff['push'](_0x169dff['shift']());}};_0x91cf22(++_0x57be0);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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 +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3b2244,_0x54873f){var _0x2dcc14=function(_0x53d73f){while(--_0x53d73f){_0x3b2244['push'](_0x3b2244['shift']());}};_0x2dcc14(++_0x54873f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4285a7,_0x263f0a){_0x4285a7=_0x4285a7-0x0;var _0x311103=_0x9bde[_0x4285a7];return _0x311103;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index fbdee3b..661b72b 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 _0xe4f1=['reject','update','then','sendStatus','error','stack','index','map','rawAttributes','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply'];(function(_0x21df69,_0x587407){var _0x15ad23=function(_0x192add){while(--_0x192add){_0x21df69['push'](_0x21df69['shift']());}};_0x15ad23(++_0x587407);}(_0xe4f1,0x102));var _0x1e4f=function(_0x414b65,_0x15871f){_0x414b65=_0x414b65-0x0;var _0xd85ffa=_0xe4f1[_0x414b65];return _0xd85ffa;};'use strict';var emlformat=require(_0x1e4f('0x0'));var rimraf=require(_0x1e4f('0x1'));var zipdir=require(_0x1e4f('0x2'));var jsonpatch=require(_0x1e4f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1e4f('0x4'));var util=require(_0x1e4f('0x5'));var path=require(_0x1e4f('0x6'));var sox=require('sox');var csv=require(_0x1e4f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e4f('0x8'));var _=require('lodash');var squel=require(_0x1e4f('0x9'));var crypto=require(_0x1e4f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1e4f('0xb'));var toCsv=require(_0x1e4f('0x7'));var querystring=require(_0x1e4f('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1e4f('0xd'));var qs=require(_0x1e4f('0xe'));var as=require(_0x1e4f('0xf'));var hardwareService=require(_0x1e4f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x1e4f('0x11'));var config=require(_0x1e4f('0x12'));var licenseUtil=require(_0x1e4f('0x13'));var db=require(_0x1e4f('0x14'))['db'];function respondWithStatusCode(_0x5157f3,_0x1a643b){_0x1a643b=_0x1a643b||0xcc;return function(_0x168a08){if(_0x168a08){return _0x5157f3['sendStatus'](_0x1a643b);}return _0x5157f3['status'](_0x1a643b)[_0x1e4f('0x15')]();};}function respondWithResult(_0x472b89,_0x36f467){_0x36f467=_0x36f467||0xc8;return function(_0x281799){if(_0x281799){return _0x472b89[_0x1e4f('0x16')](_0x36f467)[_0x1e4f('0x17')](_0x281799);}};}function respondWithFilteredResult(_0x150e12,_0x39482c){return function(_0x458db8){if(_0x458db8){var _0x577aab=typeof _0x39482c[_0x1e4f('0x18')]===_0x1e4f('0x19')&&typeof _0x39482c[_0x1e4f('0x1a')]===_0x1e4f('0x19');var _0x388771=_0x458db8[_0x1e4f('0x1b')];var _0x551d9a=_0x577aab?0x0:_0x39482c['offset'];var _0xff651d=_0x577aab?_0x458db8[_0x1e4f('0x1b')]:_0x39482c[_0x1e4f('0x18')]+_0x39482c[_0x1e4f('0x1a')];var _0x467430;if(_0xff651d>=_0x388771){_0xff651d=_0x388771;_0x467430=0xc8;}else{_0x467430=0xce;}_0x150e12['status'](_0x467430);return _0x150e12['set'](_0x1e4f('0x1c'),_0x551d9a+'-'+_0xff651d+'/'+_0x388771)['json'](_0x458db8);}return null;};}function patchUpdates(_0x3fb5d8){return function(_0x272ecc){try{jsonpatch[_0x1e4f('0x1d')](_0x272ecc,_0x3fb5d8,!![]);}catch(_0x3a1f74){return BPromise[_0x1e4f('0x1e')](_0x3a1f74);}return _0x272ecc['save']();};}function saveUpdates(_0x3b1772,_0x339a86){return function(_0x1779b6){if(_0x1779b6){return _0x1779b6[_0x1e4f('0x1f')](_0x3b1772)['then'](function(_0x175757){return _0x175757;});}return null;};}function removeEntity(_0x16236e,_0x25ec1b){return function(_0x464b90){if(_0x464b90){return _0x464b90['destroy']()[_0x1e4f('0x20')](function(){_0x16236e[_0x1e4f('0x16')](0xcc)[_0x1e4f('0x15')]();});}};}function handleEntityNotFound(_0x13aea5,_0x31269a){return function(_0x31fc7f){if(!_0x31fc7f){_0x13aea5[_0x1e4f('0x21')](0x194);}return _0x31fc7f;};}function handleError(_0xb2a79c,_0x2fd016){_0x2fd016=_0x2fd016||0x1f4;return function(_0x21f92d){logger[_0x1e4f('0x22')](_0x21f92d[_0x1e4f('0x23')]);if(_0x21f92d['name']){delete _0x21f92d['name'];}_0xb2a79c[_0x1e4f('0x16')](_0x2fd016)['send'](_0x21f92d);};}exports[_0x1e4f('0x24')]=function(_0x4d0ffb,_0x247f8e){var _0x30e3f0={},_0x4227bc={},_0x1dbf1d={'count':0x0,'rows':[]};var _0x4615f5=_[_0x1e4f('0x25')](db['SmsTransferReport'][_0x1e4f('0x26')],function(_0x3ff4ef){return{'name':_0x3ff4ef['fieldName'],'type':_0x3ff4ef[_0x1e4f('0x27')]['key']};});_0x4227bc[_0x1e4f('0x28')]=_[_0x1e4f('0x25')](_0x4615f5,_0x1e4f('0x29'));_0x4227bc[_0x1e4f('0x2a')]=_[_0x1e4f('0x2b')](_0x4d0ffb[_0x1e4f('0x2a')]);_0x4227bc[_0x1e4f('0x2c')]=_[_0x1e4f('0x2d')](_0x4227bc['model'],_0x4227bc['query']);_0x30e3f0['attributes']=_[_0x1e4f('0x2d')](_0x4227bc[_0x1e4f('0x28')],qs[_0x1e4f('0x2e')](_0x4d0ffb[_0x1e4f('0x2a')]['fields']));_0x30e3f0['attributes']=_0x30e3f0[_0x1e4f('0x2f')][_0x1e4f('0x30')]?_0x30e3f0['attributes']:_0x4227bc[_0x1e4f('0x28')];if(!_0x4d0ffb['query'][_0x1e4f('0x31')](_0x1e4f('0x32'))){_0x30e3f0[_0x1e4f('0x1a')]=qs[_0x1e4f('0x1a')](_0x4d0ffb[_0x1e4f('0x2a')][_0x1e4f('0x1a')]);_0x30e3f0[_0x1e4f('0x18')]=qs[_0x1e4f('0x18')](_0x4d0ffb['query'][_0x1e4f('0x18')]);}_0x30e3f0[_0x1e4f('0x33')]=qs[_0x1e4f('0x34')](_0x4d0ffb[_0x1e4f('0x2a')][_0x1e4f('0x34')]);_0x30e3f0['where']=qs[_0x1e4f('0x2c')](_[_0x1e4f('0x35')](_0x4d0ffb[_0x1e4f('0x2a')],_0x4227bc[_0x1e4f('0x2c')]),_0x4615f5);if(_0x4d0ffb['query']['filter']){_0x30e3f0[_0x1e4f('0x36')]=_[_0x1e4f('0x37')](_0x30e3f0[_0x1e4f('0x36')],{'$or':_[_0x1e4f('0x25')](_0x4615f5,function(_0x1ee43f){if(_0x1ee43f[_0x1e4f('0x27')]!==_0x1e4f('0x38')){var _0x59e614={};_0x59e614[_0x1ee43f['name']]={'$like':'%'+_0x4d0ffb[_0x1e4f('0x2a')][_0x1e4f('0x39')]+'%'};return _0x59e614;}})});}_0x30e3f0=_[_0x1e4f('0x37')]({},_0x30e3f0,_0x4d0ffb[_0x1e4f('0x3a')]);var _0x3a8f2a={'where':_0x30e3f0['where']};return db[_0x1e4f('0x3b')][_0x1e4f('0x1b')](_0x3a8f2a)[_0x1e4f('0x20')](function(_0x1afe82){_0x1dbf1d[_0x1e4f('0x1b')]=_0x1afe82;if(_0x4d0ffb['query'][_0x1e4f('0x3c')]){_0x30e3f0[_0x1e4f('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x1e4f('0x3e')](_0x30e3f0);})[_0x1e4f('0x20')](function(_0xa98485){_0x1dbf1d[_0x1e4f('0x3f')]=_0xa98485;return _0x1dbf1d;})[_0x1e4f('0x20')](respondWithFilteredResult(_0x247f8e,_0x30e3f0))[_0x1e4f('0x40')](handleError(_0x247f8e,null));};exports[_0x1e4f('0x41')]=function(_0x1b5f4e,_0x5d0c04){var _0x372faf={'raw':!![],'where':{'id':_0x1b5f4e[_0x1e4f('0x42')]['id']}},_0x1d2497={};_0x1d2497['model']=_['keys'](db[_0x1e4f('0x3b')]['rawAttributes']);_0x1d2497['query']=_[_0x1e4f('0x2b')](_0x1b5f4e[_0x1e4f('0x2a')]);_0x1d2497['filters']=_[_0x1e4f('0x2d')](_0x1d2497['model'],_0x1d2497[_0x1e4f('0x2a')]);_0x372faf[_0x1e4f('0x2f')]=_[_0x1e4f('0x2d')](_0x1d2497['model'],qs[_0x1e4f('0x2e')](_0x1b5f4e['query'][_0x1e4f('0x2e')]));_0x372faf[_0x1e4f('0x2f')]=_0x372faf[_0x1e4f('0x2f')][_0x1e4f('0x30')]?_0x372faf['attributes']:_0x1d2497[_0x1e4f('0x28')];if(_0x1b5f4e['query'][_0x1e4f('0x3c')]){_0x372faf['include']=[{'all':!![]}];}_0x372faf=_[_0x1e4f('0x37')]({},_0x372faf,_0x1b5f4e['options']);return db[_0x1e4f('0x3b')][_0x1e4f('0x43')](_0x372faf)[_0x1e4f('0x20')](handleEntityNotFound(_0x5d0c04,null))[_0x1e4f('0x20')](respondWithResult(_0x5d0c04,null))[_0x1e4f('0x40')](handleError(_0x5d0c04,null));};exports[_0x1e4f('0x44')]=function(_0x14a37b,_0x5305b9){return db['SmsTransferReport'][_0x1e4f('0x44')](_0x14a37b[_0x1e4f('0x45')],{})[_0x1e4f('0x20')](respondWithResult(_0x5305b9,0xc9))[_0x1e4f('0x40')](handleError(_0x5305b9,null));};exports[_0x1e4f('0x1f')]=function(_0x29eb1f,_0xad2d25){if(_0x29eb1f[_0x1e4f('0x45')]['id']){delete _0x29eb1f['body']['id'];}return db['SmsTransferReport'][_0x1e4f('0x43')]({'where':{'id':_0x29eb1f[_0x1e4f('0x42')]['id']}})[_0x1e4f('0x20')](handleEntityNotFound(_0xad2d25,null))[_0x1e4f('0x20')](saveUpdates(_0x29eb1f[_0x1e4f('0x45')],null))[_0x1e4f('0x20')](respondWithResult(_0xad2d25,null))[_0x1e4f('0x40')](handleError(_0xad2d25,null));};exports[_0x1e4f('0x46')]=function(_0x3d3060,_0x42a075){return db['SmsTransferReport'][_0x1e4f('0x43')]({'where':{'id':_0x3d3060[_0x1e4f('0x42')]['id']}})[_0x1e4f('0x20')](handleEntityNotFound(_0x42a075,null))[_0x1e4f('0x20')](removeEntity(_0x42a075,null))[_0x1e4f('0x40')](handleError(_0x42a075,null));};exports[_0x1e4f('0x47')]=function(_0x603af2,_0x543567){return db['SmsTransferReport']['describe']()[_0x1e4f('0x20')](respondWithResult(_0x543567,null))[_0x1e4f('0x40')](handleError(_0x543567,null));}; \ No newline at end of file +var _0xbb70=['filter','where','merge','options','count','includeAll','include','findAll','rows','show','params','fields','length','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','then','end','error','stack','name','index','SmsTransferReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','nolimit','order','sort','filters','pick'];(function(_0x9464df,_0x2876db){var _0x4099ce=function(_0x4f9d32){while(--_0x4f9d32){_0x9464df['push'](_0x9464df['shift']());}};_0x4099ce(++_0x2876db);}(_0xbb70,0x153));var _0x0bb7=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xbb70[_0xac151d];return _0x111dba;};'use strict';var emlformat=require(_0x0bb7('0x0'));var rimraf=require(_0x0bb7('0x1'));var zipdir=require(_0x0bb7('0x2'));var jsonpatch=require(_0x0bb7('0x3'));var rp=require(_0x0bb7('0x4'));var moment=require(_0x0bb7('0x5'));var BPromise=require(_0x0bb7('0x6'));var Mustache=require('mustache');var util=require(_0x0bb7('0x7'));var path=require(_0x0bb7('0x8'));var sox=require(_0x0bb7('0x9'));var csv=require(_0x0bb7('0xa'));var ejs=require(_0x0bb7('0xb'));var fs=require('fs');var fs_extra=require(_0x0bb7('0xc'));var _=require(_0x0bb7('0xd'));var squel=require(_0x0bb7('0xe'));var crypto=require(_0x0bb7('0xf'));var jsforce=require(_0x0bb7('0x10'));var deskjs=require(_0x0bb7('0x11'));var toCsv=require(_0x0bb7('0xa'));var querystring=require(_0x0bb7('0x12'));var Papa=require(_0x0bb7('0x13'));var Redis=require(_0x0bb7('0x14'));var authService=require(_0x0bb7('0x15'));var qs=require(_0x0bb7('0x16'));var as=require(_0x0bb7('0x17'));var hardwareService=require(_0x0bb7('0x18'));var logger=require(_0x0bb7('0x19'))(_0x0bb7('0x1a'));var utils=require(_0x0bb7('0x1b'));var config=require(_0x0bb7('0x1c'));var licenseUtil=require(_0x0bb7('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x559b06,_0x4e6fba){_0x4e6fba=_0x4e6fba||0xcc;return function(_0x4ef5f1){if(_0x4ef5f1){return _0x559b06[_0x0bb7('0x1e')](_0x4e6fba);}return _0x559b06[_0x0bb7('0x1f')](_0x4e6fba)['end']();};}function respondWithResult(_0x1e2dd3,_0x238c42){_0x238c42=_0x238c42||0xc8;return function(_0x7491d2){if(_0x7491d2){return _0x1e2dd3['status'](_0x238c42)[_0x0bb7('0x20')](_0x7491d2);}};}function respondWithFilteredResult(_0x5ed8aa,_0x438606){return function(_0x13e510){if(_0x13e510){var _0x43ddab=typeof _0x438606[_0x0bb7('0x21')]===_0x0bb7('0x22')&&typeof _0x438606['limit']===_0x0bb7('0x22');var _0x4b6772=_0x13e510['count'];var _0x1958b2=_0x43ddab?0x0:_0x438606[_0x0bb7('0x21')];var _0x584141=_0x43ddab?_0x13e510['count']:_0x438606['offset']+_0x438606[_0x0bb7('0x23')];var _0x5424d4;if(_0x584141>=_0x4b6772){_0x584141=_0x4b6772;_0x5424d4=0xc8;}else{_0x5424d4=0xce;}_0x5ed8aa[_0x0bb7('0x1f')](_0x5424d4);return _0x5ed8aa['set']('Content-Range',_0x1958b2+'-'+_0x584141+'/'+_0x4b6772)[_0x0bb7('0x20')](_0x13e510);}return null;};}function patchUpdates(_0x1f066b){return function(_0x5b0d37){try{jsonpatch[_0x0bb7('0x24')](_0x5b0d37,_0x1f066b,!![]);}catch(_0x5df613){return BPromise[_0x0bb7('0x25')](_0x5df613);}return _0x5b0d37[_0x0bb7('0x26')]();};}function saveUpdates(_0x1115a8,_0x12019c){return function(_0x5624da){if(_0x5624da){return _0x5624da[_0x0bb7('0x27')](_0x1115a8)[_0x0bb7('0x28')](function(_0x50ebe6){return _0x50ebe6;});}return null;};}function removeEntity(_0x362757,_0x34bb66){return function(_0x2c210e){if(_0x2c210e){return _0x2c210e['destroy']()[_0x0bb7('0x28')](function(){_0x362757['status'](0xcc)[_0x0bb7('0x29')]();});}};}function handleEntityNotFound(_0x7c0a78,_0x45198e){return function(_0x1de7b1){if(!_0x1de7b1){_0x7c0a78[_0x0bb7('0x1e')](0x194);}return _0x1de7b1;};}function handleError(_0xc041c1,_0x223882){_0x223882=_0x223882||0x1f4;return function(_0x4589f9){logger[_0x0bb7('0x2a')](_0x4589f9[_0x0bb7('0x2b')]);if(_0x4589f9[_0x0bb7('0x2c')]){delete _0x4589f9['name'];}_0xc041c1['status'](_0x223882)['send'](_0x4589f9);};}exports[_0x0bb7('0x2d')]=function(_0x46cc72,_0x8b6bf6){var _0x115d92={},_0x1517ff={},_0x582e8e={'count':0x0,'rows':[]};var _0xc84d4=_['map'](db[_0x0bb7('0x2e')][_0x0bb7('0x2f')],function(_0x1bbd48){return{'name':_0x1bbd48[_0x0bb7('0x30')],'type':_0x1bbd48[_0x0bb7('0x31')]['key']};});_0x1517ff[_0x0bb7('0x32')]=_[_0x0bb7('0x33')](_0xc84d4,_0x0bb7('0x2c'));_0x1517ff[_0x0bb7('0x34')]=_[_0x0bb7('0x35')](_0x46cc72[_0x0bb7('0x34')]);_0x1517ff['filters']=_[_0x0bb7('0x36')](_0x1517ff[_0x0bb7('0x32')],_0x1517ff[_0x0bb7('0x34')]);_0x115d92[_0x0bb7('0x37')]=_['intersection'](_0x1517ff[_0x0bb7('0x32')],qs['fields'](_0x46cc72[_0x0bb7('0x34')]['fields']));_0x115d92[_0x0bb7('0x37')]=_0x115d92[_0x0bb7('0x37')]['length']?_0x115d92[_0x0bb7('0x37')]:_0x1517ff['model'];if(!_0x46cc72[_0x0bb7('0x34')]['hasOwnProperty'](_0x0bb7('0x38'))){_0x115d92['limit']=qs['limit'](_0x46cc72[_0x0bb7('0x34')][_0x0bb7('0x23')]);_0x115d92[_0x0bb7('0x21')]=qs[_0x0bb7('0x21')](_0x46cc72[_0x0bb7('0x34')][_0x0bb7('0x21')]);}_0x115d92[_0x0bb7('0x39')]=qs[_0x0bb7('0x3a')](_0x46cc72[_0x0bb7('0x34')][_0x0bb7('0x3a')]);_0x115d92['where']=qs[_0x0bb7('0x3b')](_[_0x0bb7('0x3c')](_0x46cc72['query'],_0x1517ff['filters']),_0xc84d4);if(_0x46cc72['query'][_0x0bb7('0x3d')]){_0x115d92[_0x0bb7('0x3e')]=_[_0x0bb7('0x3f')](_0x115d92[_0x0bb7('0x3e')],{'$or':_[_0x0bb7('0x33')](_0xc84d4,function(_0x435425){if(_0x435425[_0x0bb7('0x31')]!=='VIRTUAL'){var _0x34431b={};_0x34431b[_0x435425[_0x0bb7('0x2c')]]={'$like':'%'+_0x46cc72[_0x0bb7('0x34')]['filter']+'%'};return _0x34431b;}})});}_0x115d92=_[_0x0bb7('0x3f')]({},_0x115d92,_0x46cc72[_0x0bb7('0x40')]);var _0x12db1e={'where':_0x115d92[_0x0bb7('0x3e')]};return db[_0x0bb7('0x2e')][_0x0bb7('0x41')](_0x12db1e)['then'](function(_0x3b8aa7){_0x582e8e[_0x0bb7('0x41')]=_0x3b8aa7;if(_0x46cc72[_0x0bb7('0x34')][_0x0bb7('0x42')]){_0x115d92[_0x0bb7('0x43')]=[{'all':!![]}];}return db[_0x0bb7('0x2e')][_0x0bb7('0x44')](_0x115d92);})[_0x0bb7('0x28')](function(_0x1694a0){_0x582e8e[_0x0bb7('0x45')]=_0x1694a0;return _0x582e8e;})['then'](respondWithFilteredResult(_0x8b6bf6,_0x115d92))['catch'](handleError(_0x8b6bf6,null));};exports[_0x0bb7('0x46')]=function(_0x229183,_0x17e1b3){var _0x27f62d={'raw':!![],'where':{'id':_0x229183[_0x0bb7('0x47')]['id']}},_0x147859={};_0x147859[_0x0bb7('0x32')]=_[_0x0bb7('0x35')](db[_0x0bb7('0x2e')][_0x0bb7('0x2f')]);_0x147859['query']=_[_0x0bb7('0x35')](_0x229183[_0x0bb7('0x34')]);_0x147859[_0x0bb7('0x3b')]=_[_0x0bb7('0x36')](_0x147859[_0x0bb7('0x32')],_0x147859['query']);_0x27f62d[_0x0bb7('0x37')]=_[_0x0bb7('0x36')](_0x147859['model'],qs[_0x0bb7('0x48')](_0x229183[_0x0bb7('0x34')][_0x0bb7('0x48')]));_0x27f62d[_0x0bb7('0x37')]=_0x27f62d[_0x0bb7('0x37')][_0x0bb7('0x49')]?_0x27f62d[_0x0bb7('0x37')]:_0x147859[_0x0bb7('0x32')];if(_0x229183[_0x0bb7('0x34')]['includeAll']){_0x27f62d[_0x0bb7('0x43')]=[{'all':!![]}];}_0x27f62d=_[_0x0bb7('0x3f')]({},_0x27f62d,_0x229183[_0x0bb7('0x40')]);return db[_0x0bb7('0x2e')][_0x0bb7('0x4a')](_0x27f62d)['then'](handleEntityNotFound(_0x17e1b3,null))['then'](respondWithResult(_0x17e1b3,null))[_0x0bb7('0x4b')](handleError(_0x17e1b3,null));};exports[_0x0bb7('0x4c')]=function(_0x29c4e2,_0x4da0bf){return db[_0x0bb7('0x2e')][_0x0bb7('0x4c')](_0x29c4e2[_0x0bb7('0x4d')],{})['then'](respondWithResult(_0x4da0bf,0xc9))[_0x0bb7('0x4b')](handleError(_0x4da0bf,null));};exports[_0x0bb7('0x27')]=function(_0x7bd6fe,_0x325fdc){if(_0x7bd6fe[_0x0bb7('0x4d')]['id']){delete _0x7bd6fe[_0x0bb7('0x4d')]['id'];}return db[_0x0bb7('0x2e')][_0x0bb7('0x4a')]({'where':{'id':_0x7bd6fe[_0x0bb7('0x47')]['id']}})['then'](handleEntityNotFound(_0x325fdc,null))['then'](saveUpdates(_0x7bd6fe['body'],null))[_0x0bb7('0x28')](respondWithResult(_0x325fdc,null))['catch'](handleError(_0x325fdc,null));};exports[_0x0bb7('0x4e')]=function(_0x4b89e3,_0x59579b){return db['SmsTransferReport'][_0x0bb7('0x4a')]({'where':{'id':_0x4b89e3[_0x0bb7('0x47')]['id']}})[_0x0bb7('0x28')](handleEntityNotFound(_0x59579b,null))[_0x0bb7('0x28')](removeEntity(_0x59579b,null))[_0x0bb7('0x4b')](handleError(_0x59579b,null));};exports[_0x0bb7('0x4f')]=function(_0x5a5bfc,_0x3998a6){return db[_0x0bb7('0x2e')][_0x0bb7('0x4f')]()['then'](respondWithResult(_0x3998a6,null))['catch'](handleError(_0x3998a6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 188fc92..b41d04a 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 _0xf531=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0xf531,0x7d));var _0x1f53=function(_0x5322e3,_0x20d04c){_0x5322e3=_0x5322e3-0x0;var _0x31b51b=_0xf531[_0x5322e3];return _0x31b51b;};'use strict';var _=require(_0x1f53('0x0'));var util=require('util');var logger=require(_0x1f53('0x1'))(_0x1f53('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1f53('0x3'));var config=require(_0x1f53('0x4'));var attributes=require(_0x1f53('0x5'));module[_0x1f53('0x6')]=function(_0x1d1ada,_0x5711b8){return _0x1d1ada[_0x1f53('0x7')](_0x1f53('0x8'),attributes,{'tableName':_0x1f53('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1f53('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x403a=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','api','bluebird','path','rimraf','../../config/environment'];(function(_0x55efce,_0x35e9bf){var _0x2b9640=function(_0x403973){while(--_0x403973){_0x55efce['push'](_0x55efce['shift']());}};_0x2b9640(++_0x35e9bf);}(_0x403a,0x19e));var _0xa403=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x403a[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0xa403('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa403('0x1'));var moment=require('moment');var BPromise=require(_0xa403('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa403('0x3'));var rimraf=require(_0xa403('0x4'));var config=require(_0xa403('0x5'));var attributes=require(_0xa403('0x6'));module[_0xa403('0x7')]=function(_0x4666b3,_0x1b1c9f){return _0x4666b3[_0xa403('0x8')](_0xa403('0x9'),attributes,{'tableName':_0xa403('0xa'),'paranoid':![],'indexes':[{'name':_0xa403('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 86fb401..a6508d4 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 _0x0be3=['catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x4e5065,_0x2745ff){var _0x1c1f30=function(_0x171eef){while(--_0x171eef){_0x4e5065['push'](_0x4e5065['shift']());}};_0x1c1f30(++_0x2745ff);}(_0x0be3,0x9a));var _0x30be=function(_0x2a2ef3,_0x25cbea){_0x2a2ef3=_0x2a2ef3-0x0;var _0x50c9e4=_0x0be3[_0x2a2ef3];return _0x50c9e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30be('0x0'));var BPromise=require(_0x30be('0x1'));var rs=require(_0x30be('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30be('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x30be('0x4'))(_0x30be('0x5'));var config=require(_0x30be('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x30be('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xdc3ff5,_0x4b45a7,_0x124baf){return new BPromise(function(_0x4207d3,_0x403e5c){return client['request'](_0xdc3ff5,_0x124baf)[_0x30be('0x8')](function(_0x3cc6e7){logger[_0x30be('0x9')](_0x30be('0xa'),_0x4b45a7,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x4b45a7,_0x30be('0xb'),JSON['stringify'](_0x3cc6e7));if(_0x3cc6e7[_0x30be('0xc')]){if(_0x3cc6e7[_0x30be('0xc')][_0x30be('0xd')]===0x1f4){logger[_0x30be('0xc')](_0x30be('0xa'),_0x4b45a7,_0x3cc6e7[_0x30be('0xc')][_0x30be('0xe')]);return _0x403e5c(_0x3cc6e7[_0x30be('0xc')][_0x30be('0xe')]);}logger['error'](_0x30be('0xa'),_0x4b45a7,_0x3cc6e7['error'][_0x30be('0xe')]);return _0x4207d3(_0x3cc6e7[_0x30be('0xc')]['message']);}else{logger[_0x30be('0x9')](_0x30be('0xa'),_0x4b45a7,'request\x20sent');_0x4207d3(_0x3cc6e7[_0x30be('0xf')][_0x30be('0xe')]);}})[_0x30be('0x10')](function(_0x40a4c7){logger[_0x30be('0xc')](_0x30be('0xa'),_0x4b45a7,_0x40a4c7);_0x403e5c(_0x40a4c7);});});} \ No newline at end of file +var _0x6688=['stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x5c2606,_0x116832){var _0x1f0fb7=function(_0x489f7e){while(--_0x489f7e){_0x5c2606['push'](_0x5c2606['shift']());}};_0x1f0fb7(++_0x116832);}(_0x6688,0x10e));var _0x8668=function(_0x989b83,_0x1e2117){_0x989b83=_0x989b83-0x0;var _0x1fffb3=_0x6688[_0x989b83];return _0x1fffb3;};'use strict';var _=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var moment=require(_0x8668('0x2'));var BPromise=require('bluebird');var rs=require(_0x8668('0x3'));var fs=require('fs');var Redis=require(_0x8668('0x4'));var db=require(_0x8668('0x5'))['db'];var utils=require(_0x8668('0x6'));var logger=require(_0x8668('0x7'))(_0x8668('0x8'));var config=require(_0x8668('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8668('0xa')][_0x8668('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51c691,_0x1b9518,_0xf3b726){return new BPromise(function(_0xb4ac50,_0x15e42d){return client[_0x8668('0xc')](_0x51c691,_0xf3b726)[_0x8668('0xd')](function(_0x21315c){logger[_0x8668('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x1b9518,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1b9518,_0x8668('0xf'),JSON[_0x8668('0x10')](_0x21315c));if(_0x21315c[_0x8668('0x11')]){if(_0x21315c[_0x8668('0x11')][_0x8668('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1b9518,_0x21315c[_0x8668('0x11')][_0x8668('0x13')]);return _0x15e42d(_0x21315c[_0x8668('0x11')]['message']);}logger[_0x8668('0x11')](_0x8668('0x14'),_0x1b9518,_0x21315c[_0x8668('0x11')]['message']);return _0xb4ac50(_0x21315c['error'][_0x8668('0x13')]);}else{logger[_0x8668('0xe')](_0x8668('0x14'),_0x1b9518,_0x8668('0xf'));_0xb4ac50(_0x21315c['result']['message']);}})[_0x8668('0x15')](function(_0x191220){logger[_0x8668('0x11')](_0x8668('0x14'),_0x1b9518,_0x191220);_0x15e42d(_0x191220);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 8e491ed..914c5f9 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 _0x46ae=['show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','create','put','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x46ae,0x163));var _0xe46a=function(_0x2def5b,_0x526837){_0x2def5b=_0x2def5b-0x0;var _0x41b2aa=_0x46ae[_0x2def5b];return _0x41b2aa;};'use strict';var multer=require('multer');var util=require(_0xe46a('0x0'));var path=require('path');var timeout=require(_0xe46a('0x1'));var express=require(_0xe46a('0x2'));var router=express['Router']();var fs_extra=require(_0xe46a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe46a('0x4'));var config=require('../../config/environment');var controller=require('./sound.controller');router['get']('/',auth[_0xe46a('0x5')](),controller[_0xe46a('0x6')]);router[_0xe46a('0x7')](_0xe46a('0x8'),auth[_0xe46a('0x5')](),controller[_0xe46a('0x9')]);router[_0xe46a('0x7')](_0xe46a('0xa'),auth[_0xe46a('0x5')](),controller[_0xe46a('0xb')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ecb60,_0x2004d,_0x45e7d3){_0x45e7d3(null,path[_0xe46a('0xc')](config[_0xe46a('0xd')],_0xe46a('0xe')));},'filename':function(_0x2bc9b2,_0x540c14,_0xf13f9){_0x540c14[_0xe46a('0xf')]=_0x540c14['originalname'][_0xe46a('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xf13f9(null,util[_0xe46a('0x11')]('%s-%s%s',path[_0xe46a('0x12')](_0x540c14['originalname'],path[_0xe46a('0x13')](_0x540c14[_0xe46a('0xf')])),Date['now'](),path['extname'](_0x540c14['originalname'])));}})});router[_0xe46a('0x14')]('/',upload[_0xe46a('0x15')](_0xe46a('0x16')),controller[_0xe46a('0x17')]);router[_0xe46a('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xe46a('0x19')]);router['delete'](_0xe46a('0x8'),auth[_0xe46a('0x5')](),controller[_0xe46a('0x1a')]);module[_0xe46a('0x1b')]=router; \ No newline at end of file +var _0x9dbc=['isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','single','file','create','put','update','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x17dac2,_0x405e5e){var _0x2bd440=function(_0x16a0eb){while(--_0x16a0eb){_0x17dac2['push'](_0x17dac2['shift']());}};_0x2bd440(++_0x405e5e);}(_0x9dbc,0x152));var _0xc9db=function(_0x5b31da,_0x1714d2){_0x5b31da=_0x5b31da-0x0;var _0xd2754f=_0x9dbc[_0x5b31da];return _0xd2754f;};'use strict';var multer=require('multer');var util=require(_0xc9db('0x0'));var path=require(_0xc9db('0x1'));var timeout=require(_0xc9db('0x2'));var express=require(_0xc9db('0x3'));var router=express['Router']();var fs_extra=require(_0xc9db('0x4'));var auth=require(_0xc9db('0x5'));var interaction=require(_0xc9db('0x6'));var config=require(_0xc9db('0x7'));var controller=require(_0xc9db('0x8'));router[_0xc9db('0x9')]('/',auth[_0xc9db('0xa')](),controller['index']);router[_0xc9db('0x9')]('/:id',auth[_0xc9db('0xa')](),controller[_0xc9db('0xb')]);router[_0xc9db('0x9')]('/:id/download',auth[_0xc9db('0xa')](),controller[_0xc9db('0xc')]);var upload=multer({'storage':multer[_0xc9db('0xd')]({'destination':function(_0x1f2b93,_0x5262c3,_0x4e8ce9){_0x4e8ce9(null,path[_0xc9db('0xe')](config[_0xc9db('0xf')],_0xc9db('0x10')));},'filename':function(_0x5edebf,_0x4bcef1,_0x1d8675){_0x4bcef1[_0xc9db('0x11')]=_0x4bcef1[_0xc9db('0x11')][_0xc9db('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d8675(null,util[_0xc9db('0x13')](_0xc9db('0x14'),path['basename'](_0x4bcef1[_0xc9db('0x11')],path[_0xc9db('0x15')](_0x4bcef1[_0xc9db('0x11')])),Date[_0xc9db('0x16')](),path[_0xc9db('0x15')](_0x4bcef1['originalname'])));}})});router['post']('/',upload[_0xc9db('0x17')](_0xc9db('0x18')),controller[_0xc9db('0x19')]);router[_0xc9db('0x1a')]('/:id',auth[_0xc9db('0xa')](),controller[_0xc9db('0x1b')]);router['delete']('/:id',auth[_0xc9db('0xa')](),controller['delete']);module[_0xc9db('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 1a0f222..ee18a1b 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 _0x007b=['FLOAT','STRING','name','BIGINT','INTEGER'];(function(_0x595b9b,_0xa58ff){var _0x3be4c6=function(_0x324f94){while(--_0x324f94){_0x595b9b['push'](_0x595b9b['shift']());}};_0x3be4c6(++_0xa58ff);}(_0x007b,0x164));var _0xb007=function(_0x3bbf37,_0x1bcef5){_0x3bbf37=_0x3bbf37-0x0;var _0x368eb3=_0x007b[_0x3bbf37];return _0x368eb3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb007('0x0')],'unique':_0xb007('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb007('0x0')]},'display_name':{'type':Sequelize[_0xb007('0x0')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xb007('0x0')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xb007('0x2')]},'original_channelCount':{'type':Sequelize[_0xb007('0x3')]},'original_bitRate':{'type':Sequelize[_0xb007('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xb007('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xb007('0x2')]},'converted_channelCount':{'type':Sequelize[_0xb007('0x3')]},'converted_bitRate':{'type':Sequelize[_0xb007('0x2')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xadff=['INTEGER','BIGINT','exports','STRING','name','FLOAT'];(function(_0x1bbcd4,_0x3ed594){var _0x5a3f32=function(_0x44db6c){while(--_0x44db6c){_0x1bbcd4['push'](_0x1bbcd4['shift']());}};_0x5a3f32(++_0x3ed594);}(_0xadff,0xf8));var _0xfadf=function(_0x451baf,_0x2faf74){_0x451baf=_0x451baf-0x0;var _0x1ddcaa=_0xadff[_0x451baf];return _0x1ddcaa;};'use strict';var Sequelize=require('sequelize');module[_0xfadf('0x0')]={'name':{'type':Sequelize[_0xfadf('0x1')],'unique':_0xfadf('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xfadf('0x1')]},'display_name':{'type':Sequelize[_0xfadf('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xfadf('0x1')]},'original_format':{'type':Sequelize[_0xfadf('0x1')]},'original_duration':{'type':Sequelize[_0xfadf('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xfadf('0x4')]},'original_bitRate':{'type':Sequelize[_0xfadf('0x5')]},'original_sampleRate':{'type':Sequelize[_0xfadf('0x4')]},'converted_format':{'type':Sequelize[_0xfadf('0x1')]},'converted_duration':{'type':Sequelize[_0xfadf('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xfadf('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xfadf('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8ce8647..41b8d47 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 _0xb716=['bluebird','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/environment','../../mysqldb','status','limit','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','rows','catch','params','merge','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','end','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Sounds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb716,0x179));var _0x6b71=function(_0x599eee,_0x154fb0){_0x599eee=_0x599eee-0x0;var _0x266943=_0xb716[_0x599eee];return _0x266943;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b71('0x0'));var zipdir=require(_0x6b71('0x1'));var jsonpatch=require(_0x6b71('0x2'));var rp=require(_0x6b71('0x3'));var moment=require('moment');var BPromise=require(_0x6b71('0x4'));var Mustache=require('mustache');var util=require(_0x6b71('0x5'));var path=require('path');var sox=require(_0x6b71('0x6'));var csv=require(_0x6b71('0x7'));var ejs=require(_0x6b71('0x8'));var fs=require('fs');var fs_extra=require(_0x6b71('0x9'));var _=require(_0x6b71('0xa'));var squel=require(_0x6b71('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b71('0xc'));var deskjs=require(_0x6b71('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b71('0xe'));var Papa=require(_0x6b71('0xf'));var Redis=require(_0x6b71('0x10'));var authService=require(_0x6b71('0x11'));var qs=require(_0x6b71('0x12'));var as=require(_0x6b71('0x13'));var hardwareService=require(_0x6b71('0x14'));var logger=require('../../config/logger')(_0x6b71('0x15'));var utils=require(_0x6b71('0x16'));var config=require(_0x6b71('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b71('0x18'))['db'];function respondWithStatusCode(_0x2e193c,_0x3c15f5){_0x3c15f5=_0x3c15f5||0xcc;return function(_0x247600){if(_0x247600){return _0x2e193c['sendStatus'](_0x3c15f5);}return _0x2e193c[_0x6b71('0x19')](_0x3c15f5)['end']();};}function respondWithResult(_0x478c5b,_0xb80a50){_0xb80a50=_0xb80a50||0xc8;return function(_0x4d442c){if(_0x4d442c){return _0x478c5b[_0x6b71('0x19')](_0xb80a50)['json'](_0x4d442c);}};}function respondWithFilteredResult(_0xd9f3af,_0x43b880){return function(_0x4d4ff2){if(_0x4d4ff2){var _0x40b50c=typeof _0x43b880['offset']==='undefined'&&typeof _0x43b880[_0x6b71('0x1a')]===_0x6b71('0x1b');var _0xbdb227=_0x4d4ff2[_0x6b71('0x1c')];var _0x1038d0=_0x40b50c?0x0:_0x43b880[_0x6b71('0x1d')];var _0x4ac262=_0x40b50c?_0x4d4ff2[_0x6b71('0x1c')]:_0x43b880['offset']+_0x43b880['limit'];var _0x8217f1;if(_0x4ac262>=_0xbdb227){_0x4ac262=_0xbdb227;_0x8217f1=0xc8;}else{_0x8217f1=0xce;}_0xd9f3af[_0x6b71('0x19')](_0x8217f1);return _0xd9f3af[_0x6b71('0x1e')]('Content-Range',_0x1038d0+'-'+_0x4ac262+'/'+_0xbdb227)[_0x6b71('0x1f')](_0x4d4ff2);}return null;};}function patchUpdates(_0x59eb8c){return function(_0xd33a8d){try{jsonpatch[_0x6b71('0x20')](_0xd33a8d,_0x59eb8c,!![]);}catch(_0x120446){return BPromise[_0x6b71('0x21')](_0x120446);}return _0xd33a8d[_0x6b71('0x22')]();};}function saveUpdates(_0x14cc2f,_0x43c292){return function(_0x3c2642){if(_0x3c2642){return _0x3c2642[_0x6b71('0x23')](_0x14cc2f)[_0x6b71('0x24')](function(_0x397102){return _0x397102;});}return null;};}function removeEntity(_0x1efc53,_0xb80514){return function(_0x284580){if(_0x284580){return _0x284580[_0x6b71('0x25')]()[_0x6b71('0x24')](function(){var _0x32e76e=_0x284580[_0x6b71('0x26')]({'plain':!![]});var _0x712674='Sounds';return db[_0x6b71('0x27')][_0x6b71('0x25')]({'where':{'type':_0x712674,'resourceId':_0x32e76e['id']}})[_0x6b71('0x24')](function(){return _0x284580;});})[_0x6b71('0x24')](function(){_0x1efc53['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d8a6,_0x48cf98){return function(_0x259bd7){if(!_0x259bd7){_0x24d8a6[_0x6b71('0x28')](0x194);}return _0x259bd7;};}function handleError(_0x112c50,_0x50fc0a){_0x50fc0a=_0x50fc0a||0x1f4;return function(_0x927d1b){logger['error'](_0x927d1b[_0x6b71('0x29')]);if(_0x927d1b[_0x6b71('0x2a')]){delete _0x927d1b[_0x6b71('0x2a')];}_0x112c50['status'](_0x50fc0a)[_0x6b71('0x2b')](_0x927d1b);};}exports[_0x6b71('0x2c')]=function(_0xad9398,_0x529e9e){var _0x37c0e0={},_0x45e8ab={},_0x1e87d9={'count':0x0,'rows':[]};var _0x56baac=_[_0x6b71('0x2d')](db[_0x6b71('0x2e')][_0x6b71('0x2f')],function(_0xe9b0de){return{'name':_0xe9b0de[_0x6b71('0x30')],'type':_0xe9b0de[_0x6b71('0x31')][_0x6b71('0x32')]};});_0x45e8ab[_0x6b71('0x33')]=_['map'](_0x56baac,_0x6b71('0x2a'));_0x45e8ab['query']=_[_0x6b71('0x34')](_0xad9398[_0x6b71('0x35')]);_0x45e8ab[_0x6b71('0x36')]=_['intersection'](_0x45e8ab[_0x6b71('0x33')],_0x45e8ab[_0x6b71('0x35')]);_0x37c0e0[_0x6b71('0x37')]=_[_0x6b71('0x38')](_0x45e8ab[_0x6b71('0x33')],qs[_0x6b71('0x39')](_0xad9398[_0x6b71('0x35')]['fields']));_0x37c0e0[_0x6b71('0x37')]=_0x37c0e0[_0x6b71('0x37')]['length']?_0x37c0e0['attributes']:_0x45e8ab[_0x6b71('0x33')];if(!_0xad9398[_0x6b71('0x35')][_0x6b71('0x3a')](_0x6b71('0x3b'))){_0x37c0e0['limit']=qs[_0x6b71('0x1a')](_0xad9398['query'][_0x6b71('0x1a')]);_0x37c0e0[_0x6b71('0x1d')]=qs[_0x6b71('0x1d')](_0xad9398[_0x6b71('0x35')]['offset']);}_0x37c0e0[_0x6b71('0x3c')]=qs[_0x6b71('0x3d')](_0xad9398['query'][_0x6b71('0x3d')]);_0x37c0e0['where']=qs[_0x6b71('0x36')](_['pick'](_0xad9398[_0x6b71('0x35')],_0x45e8ab[_0x6b71('0x36')]),_0x56baac);if(_0xad9398[_0x6b71('0x35')]['filter']){_0x37c0e0[_0x6b71('0x3e')]=_['merge'](_0x37c0e0['where'],{'$or':_[_0x6b71('0x2d')](_0x56baac,function(_0x213799){if(_0x213799[_0x6b71('0x31')]!=='VIRTUAL'){var _0x248a4a={};_0x248a4a[_0x213799[_0x6b71('0x2a')]]={'$like':'%'+_0xad9398[_0x6b71('0x35')][_0x6b71('0x3f')]+'%'};return _0x248a4a;}})});}_0x37c0e0=_['merge']({},_0x37c0e0,_0xad9398[_0x6b71('0x40')]);var _0x4871ce={'where':_0x37c0e0[_0x6b71('0x3e')]};return db[_0x6b71('0x2e')][_0x6b71('0x1c')](_0x4871ce)['then'](function(_0x203af7){_0x1e87d9[_0x6b71('0x1c')]=_0x203af7;if(_0xad9398['query'][_0x6b71('0x41')]){_0x37c0e0[_0x6b71('0x42')]=[{'all':!![]}];}return db[_0x6b71('0x2e')]['findAll'](_0x37c0e0);})[_0x6b71('0x24')](function(_0x4bbb6e){_0x1e87d9[_0x6b71('0x43')]=_0x4bbb6e;return _0x1e87d9;})[_0x6b71('0x24')](respondWithFilteredResult(_0x529e9e,_0x37c0e0))[_0x6b71('0x44')](handleError(_0x529e9e,null));};exports['show']=function(_0x545a52,_0x438276){var _0x103498={'raw':!![],'where':{'id':_0x545a52[_0x6b71('0x45')]['id']}},_0x3e0ac1={};_0x3e0ac1[_0x6b71('0x33')]=_['keys'](db[_0x6b71('0x2e')]['rawAttributes']);_0x3e0ac1[_0x6b71('0x35')]=_[_0x6b71('0x34')](_0x545a52['query']);_0x3e0ac1[_0x6b71('0x36')]=_[_0x6b71('0x38')](_0x3e0ac1['model'],_0x3e0ac1[_0x6b71('0x35')]);_0x103498[_0x6b71('0x37')]=_[_0x6b71('0x38')](_0x3e0ac1['model'],qs[_0x6b71('0x39')](_0x545a52[_0x6b71('0x35')][_0x6b71('0x39')]));_0x103498[_0x6b71('0x37')]=_0x103498[_0x6b71('0x37')]['length']?_0x103498[_0x6b71('0x37')]:_0x3e0ac1[_0x6b71('0x33')];if(_0x545a52[_0x6b71('0x35')][_0x6b71('0x41')]){_0x103498['include']=[{'all':!![]}];}_0x103498=_[_0x6b71('0x46')]({},_0x103498,_0x545a52[_0x6b71('0x40')]);return db[_0x6b71('0x2e')][_0x6b71('0x47')](_0x103498)[_0x6b71('0x24')](handleEntityNotFound(_0x438276,null))[_0x6b71('0x24')](respondWithResult(_0x438276,null))[_0x6b71('0x44')](handleError(_0x438276,null));};exports[_0x6b71('0x48')]=function(_0x431e73,_0x3e1fe1,_0x1435f1){return db[_0x6b71('0x2e')][_0x6b71('0x47')]({'where':{'id':_0x431e73[_0x6b71('0x45')]['id']},'attributes':['name',_0x6b71('0x49'),_0x6b71('0x4a')],'raw':!![]})[_0x6b71('0x24')](handleEntityNotFound(_0x3e1fe1,null))['then'](function(_0x422aa9){if(_0x422aa9){if(!fs[_0x6b71('0x4b')](path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x4e'),_0x422aa9[_0x6b71('0x49')]+'.'+_0x422aa9['converted_format']))){throw new db[(_0x6b71('0x4f'))]['ValidationError'](_0x6b71('0x50'));}return _0x3e1fe1[_0x6b71('0x48')](path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x4e'),util[_0x6b71('0x51')](_0x6b71('0x52'),_0x422aa9[_0x6b71('0x49')],_0x422aa9[_0x6b71('0x4a')])),util['format'](_0x6b71('0x52'),_0x422aa9[_0x6b71('0x2a')],_0x422aa9[_0x6b71('0x4a')]));}return null;})[_0x6b71('0x44')](handleError(_0x3e1fe1,null));};exports[_0x6b71('0x53')]=function(_0x55421d,_0x2e60ac,_0x1d1813){var _0x27ff91={'name':path[_0x6b71('0x54')](_0x55421d[_0x6b71('0x55')]['originalname'],path[_0x6b71('0x56')](_0x55421d[_0x6b71('0x55')][_0x6b71('0x57')])),'save_name':path['basename'](_0x55421d['file'][_0x6b71('0x58')],path[_0x6b71('0x56')](_0x55421d[_0x6b71('0x55')][_0x6b71('0x58')])),'original_format':path[_0x6b71('0x56')](_0x55421d[_0x6b71('0x55')][_0x6b71('0x57')])[_0x6b71('0x59')](0x1),'converted_format':_0x6b71('0x5a')};var _0x109c9c=path['join'](config[_0x6b71('0x4d')],_0x6b71('0x5b'),_0x55421d['file'][_0x6b71('0x58')]);var _0xc3f310=path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x4e'),util[_0x6b71('0x51')](_0x6b71('0x52'),path[_0x6b71('0x54')](_0x55421d['file'][_0x6b71('0x58')],path[_0x6b71('0x56')](_0x55421d['file']['filename'])),_0x27ff91['converted_format']));logger[_0x6b71('0x5c')]('Sound\x20upload\x20filepath:\x20%s',_0x109c9c);logger[_0x6b71('0x5c')](_0x6b71('0x5d'),_0xc3f310);try{fs[_0x6b71('0x5e')](_0x109c9c,parseInt(_0x6b71('0x5f'),0x8));var _0x45f654=sox[_0x6b71('0x60')](_0x109c9c,_0xc3f310,{'sampleRate':0x1f40,'format':_0x6b71('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45f654['on'](_0x6b71('0x61'),function(_0x3df7dd){fs['unlinkSync'](_0x109c9c);_0x2e60ac[_0x6b71('0x19')](0x1f4)['send'](_0x3df7dd);});_0x45f654['on'](_0x6b71('0x62'),function(_0x39e27c){_0x27ff91[_0x6b71('0x63')]=isNaN(_0x39e27c[_0x6b71('0x64')])?null:_0x39e27c[_0x6b71('0x64')]*0x3e8;_0x27ff91[_0x6b71('0x65')]=isNaN(_0x39e27c[_0x6b71('0x66')])?null:_0x39e27c[_0x6b71('0x66')];_0x27ff91[_0x6b71('0x67')]=isNaN(_0x39e27c[_0x6b71('0x68')])?null:_0x39e27c[_0x6b71('0x68')];_0x27ff91[_0x6b71('0x69')]=isNaN(_0x39e27c['bitRate'])?null:_0x39e27c[_0x6b71('0x6a')];_0x27ff91[_0x6b71('0x6b')]=isNaN(_0x39e27c['sampleRate'])?null:_0x39e27c[_0x6b71('0x6c')];});_0x45f654['on'](_0x6b71('0x6d'),function(_0x56f247){_0x27ff91[_0x6b71('0x6e')]=isNaN(_0x56f247[_0x6b71('0x64')])?null:_0x56f247[_0x6b71('0x64')]*0x3e8;_0x27ff91[_0x6b71('0x6f')]=isNaN(_0x56f247[_0x6b71('0x66')])?null:_0x56f247[_0x6b71('0x66')];_0x27ff91['converted_channelCount']=isNaN(_0x56f247[_0x6b71('0x68')])?null:_0x56f247[_0x6b71('0x68')];_0x27ff91[_0x6b71('0x70')]=isNaN(_0x56f247[_0x6b71('0x6a')])?null:_0x56f247[_0x6b71('0x6a')];_0x27ff91['converted_sampleRate']=isNaN(_0x56f247[_0x6b71('0x6c')])?null:_0x56f247[_0x6b71('0x6c')];});_0x45f654['on'](_0x6b71('0x71'),function(){fs[_0x6b71('0x5e')](_0xc3f310,parseInt('0777',0x8));return db[_0x6b71('0x2e')][_0x6b71('0x53')](_0x27ff91)['then'](function(_0xe06830){var _0x1b183a={'role':_0x55421d['body']['role'],'userProfileId':_0x55421d[_0x6b71('0x72')]['userProfileId']};if(!_0x1b183a)throw new Error(_0x6b71('0x73'));if(_0x1b183a[_0x6b71('0x74')]==='user'){var _0x3eb54e=_0xe06830[_0x6b71('0x26')]({'plain':!![]});return db[_0x6b71('0x75')][_0x6b71('0x47')]({'where':{'name':_0x6b71('0x76'),'userProfileId':_0x1b183a[_0x6b71('0x77')]},'raw':!![]})[_0x6b71('0x24')](function(_0x4070b9){if(_0x4070b9&&_0x4070b9['autoAssociation']===0x0){return db[_0x6b71('0x27')]['create']({'name':_0x3eb54e[_0x6b71('0x2a')],'resourceId':_0x3eb54e['id'],'type':_0x4070b9[_0x6b71('0x2a')],'sectionId':_0x4070b9['id']},{})[_0x6b71('0x24')](function(){return _0xe06830;});}else{return _0xe06830;}})[_0x6b71('0x44')](function(_0x50971c){logger[_0x6b71('0x61')](_0x6b71('0x78'),_0x50971c);throw _0x50971c;});}return _0xe06830;})[_0x6b71('0x24')](respondWithResult(_0x2e60ac,null))['catch'](handleError(_0x2e60ac,null));});_0x45f654[_0x6b71('0x79')]();}catch(_0x3213a3){_0x2e60ac['status'](0x1f4)[_0x6b71('0x2b')](_0x3213a3);}};exports[_0x6b71('0x23')]=function(_0x562edf,_0x42f491,_0x4b8bbb){return db[_0x6b71('0x2e')][_0x6b71('0x47')]({'where':{'id':_0x562edf[_0x6b71('0x45')]['id']}})[_0x6b71('0x24')](handleEntityNotFound(_0x42f491,null))[_0x6b71('0x24')](saveUpdates(_[_0x6b71('0x7a')](_0x562edf['body'],[_0x6b71('0x2a'),_0x6b71('0x7b')]),null))[_0x6b71('0x24')](respondWithResult(_0x42f491,null))[_0x6b71('0x44')](handleError(_0x42f491,null));};exports[_0x6b71('0x7c')]=function(_0x37fc7b,_0x16b1fd,_0x5155d9){return db[_0x6b71('0x2e')][_0x6b71('0x47')]({'where':{'id':_0x37fc7b[_0x6b71('0x45')]['id']}})['then'](function(_0x254bdb){if(_0x254bdb){return _0x254bdb[_0x6b71('0x25')]();}})['then'](function(_0x5aa2f0){var _0x11bf2a=path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x5b'),util[_0x6b71('0x51')]('%s.%s',_0x5aa2f0[_0x6b71('0x49')],_0x5aa2f0[_0x6b71('0x7d')]));var _0x8ccf0b=path[_0x6b71('0x4c')](config[_0x6b71('0x4d')],_0x6b71('0x4e'),util[_0x6b71('0x51')](_0x6b71('0x52'),_0x5aa2f0[_0x6b71('0x49')],_0x5aa2f0[_0x6b71('0x4a')]));fs['unlinkSync'](_0x11bf2a);fs[_0x6b71('0x7e')](_0x8ccf0b);return _0x5aa2f0;})[_0x6b71('0x24')](function(_0x57073a){if(_0x57073a){return _0x16b1fd[_0x6b71('0x19')](0xcc)[_0x6b71('0x71')]();}})[_0x6b71('0x24')](handleEntityNotFound(_0x16b1fd,null))[_0x6b71('0x44')](handleError(_0x16b1fd,null));}; \ No newline at end of file +var _0x0fa1=['format','create','basename','originalname','extname','file','filename','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','Sounds','UserProfileResource','destroy','then','error','stack','name','index','Sound','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','params','fields','includeAll','options','find','download','save_name','existsSync','join','root','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','converted_format'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0fa1,0x128));var _0x10fa=function(_0x5bf4ed,_0xb54e4f){_0x5bf4ed=_0x5bf4ed-0x0;var _0x14e79b=_0x0fa1[_0x5bf4ed];return _0x14e79b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x10fa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10fa('0x1'));var rp=require(_0x10fa('0x2'));var moment=require(_0x10fa('0x3'));var BPromise=require(_0x10fa('0x4'));var Mustache=require(_0x10fa('0x5'));var util=require(_0x10fa('0x6'));var path=require(_0x10fa('0x7'));var sox=require('sox');var csv=require(_0x10fa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x10fa('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x10fa('0xa'));var jsforce=require(_0x10fa('0xb'));var deskjs=require(_0x10fa('0xc'));var toCsv=require('to-csv');var querystring=require(_0x10fa('0xd'));var Papa=require(_0x10fa('0xe'));var Redis=require('ioredis');var authService=require(_0x10fa('0xf'));var qs=require(_0x10fa('0x10'));var as=require(_0x10fa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10fa('0x12'))(_0x10fa('0x13'));var utils=require(_0x10fa('0x14'));var config=require(_0x10fa('0x15'));var licenseUtil=require(_0x10fa('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d087,_0x108b13){_0x108b13=_0x108b13||0xcc;return function(_0xe5a9fe){if(_0xe5a9fe){return _0x22d087[_0x10fa('0x17')](_0x108b13);}return _0x22d087['status'](_0x108b13)[_0x10fa('0x18')]();};}function respondWithResult(_0x305899,_0x27620a){_0x27620a=_0x27620a||0xc8;return function(_0x8daa6b){if(_0x8daa6b){return _0x305899[_0x10fa('0x19')](_0x27620a)['json'](_0x8daa6b);}};}function respondWithFilteredResult(_0x9485b6,_0x23b84f){return function(_0x4f7c2d){if(_0x4f7c2d){var _0x1407a9=typeof _0x23b84f[_0x10fa('0x1a')]===_0x10fa('0x1b')&&typeof _0x23b84f[_0x10fa('0x1c')]===_0x10fa('0x1b');var _0x578dc1=_0x4f7c2d[_0x10fa('0x1d')];var _0x101d0d=_0x1407a9?0x0:_0x23b84f[_0x10fa('0x1a')];var _0x2f15cc=_0x1407a9?_0x4f7c2d['count']:_0x23b84f[_0x10fa('0x1a')]+_0x23b84f[_0x10fa('0x1c')];var _0x1e32af;if(_0x2f15cc>=_0x578dc1){_0x2f15cc=_0x578dc1;_0x1e32af=0xc8;}else{_0x1e32af=0xce;}_0x9485b6['status'](_0x1e32af);return _0x9485b6[_0x10fa('0x1e')](_0x10fa('0x1f'),_0x101d0d+'-'+_0x2f15cc+'/'+_0x578dc1)['json'](_0x4f7c2d);}return null;};}function patchUpdates(_0xfbd585){return function(_0x1100ac){try{jsonpatch[_0x10fa('0x20')](_0x1100ac,_0xfbd585,!![]);}catch(_0x2a4e16){return BPromise[_0x10fa('0x21')](_0x2a4e16);}return _0x1100ac['save']();};}function saveUpdates(_0x2a0cf5,_0x568d71){return function(_0x5a2ce9){if(_0x5a2ce9){return _0x5a2ce9[_0x10fa('0x22')](_0x2a0cf5)['then'](function(_0xefe7b8){return _0xefe7b8;});}return null;};}function removeEntity(_0xe00d5e,_0x54b559){return function(_0x3ae5bb){if(_0x3ae5bb){return _0x3ae5bb['destroy']()['then'](function(){var _0x5efcaf=_0x3ae5bb['get']({'plain':!![]});var _0xefade6=_0x10fa('0x23');return db[_0x10fa('0x24')][_0x10fa('0x25')]({'where':{'type':_0xefade6,'resourceId':_0x5efcaf['id']}})[_0x10fa('0x26')](function(){return _0x3ae5bb;});})['then'](function(){_0xe00d5e[_0x10fa('0x19')](0xcc)[_0x10fa('0x18')]();});}};}function handleEntityNotFound(_0x1766fc,_0x49ae65){return function(_0x3205c9){if(!_0x3205c9){_0x1766fc[_0x10fa('0x17')](0x194);}return _0x3205c9;};}function handleError(_0x1ff939,_0x4eea18){_0x4eea18=_0x4eea18||0x1f4;return function(_0x3146d2){logger[_0x10fa('0x27')](_0x3146d2[_0x10fa('0x28')]);if(_0x3146d2[_0x10fa('0x29')]){delete _0x3146d2['name'];}_0x1ff939[_0x10fa('0x19')](_0x4eea18)['send'](_0x3146d2);};}exports[_0x10fa('0x2a')]=function(_0x736d18,_0x5e5740){var _0x11b49b={},_0x3e263a={},_0x4916c2={'count':0x0,'rows':[]};var _0x108b00=_['map'](db[_0x10fa('0x2b')][_0x10fa('0x2c')],function(_0x109173){return{'name':_0x109173[_0x10fa('0x2d')],'type':_0x109173['type']['key']};});_0x3e263a[_0x10fa('0x2e')]=_['map'](_0x108b00,'name');_0x3e263a[_0x10fa('0x2f')]=_[_0x10fa('0x30')](_0x736d18[_0x10fa('0x2f')]);_0x3e263a[_0x10fa('0x31')]=_[_0x10fa('0x32')](_0x3e263a['model'],_0x3e263a[_0x10fa('0x2f')]);_0x11b49b[_0x10fa('0x33')]=_[_0x10fa('0x32')](_0x3e263a[_0x10fa('0x2e')],qs['fields'](_0x736d18[_0x10fa('0x2f')]['fields']));_0x11b49b[_0x10fa('0x33')]=_0x11b49b['attributes'][_0x10fa('0x34')]?_0x11b49b[_0x10fa('0x33')]:_0x3e263a[_0x10fa('0x2e')];if(!_0x736d18['query'][_0x10fa('0x35')](_0x10fa('0x36'))){_0x11b49b['limit']=qs[_0x10fa('0x1c')](_0x736d18['query'][_0x10fa('0x1c')]);_0x11b49b['offset']=qs['offset'](_0x736d18[_0x10fa('0x2f')]['offset']);}_0x11b49b[_0x10fa('0x37')]=qs[_0x10fa('0x38')](_0x736d18[_0x10fa('0x2f')][_0x10fa('0x38')]);_0x11b49b[_0x10fa('0x39')]=qs['filters'](_[_0x10fa('0x3a')](_0x736d18[_0x10fa('0x2f')],_0x3e263a[_0x10fa('0x31')]),_0x108b00);if(_0x736d18['query'][_0x10fa('0x3b')]){_0x11b49b[_0x10fa('0x39')]=_[_0x10fa('0x3c')](_0x11b49b[_0x10fa('0x39')],{'$or':_['map'](_0x108b00,function(_0x2424cc){if(_0x2424cc[_0x10fa('0x3d')]!=='VIRTUAL'){var _0x4eaca7={};_0x4eaca7[_0x2424cc[_0x10fa('0x29')]]={'$like':'%'+_0x736d18[_0x10fa('0x2f')][_0x10fa('0x3b')]+'%'};return _0x4eaca7;}})});}_0x11b49b=_[_0x10fa('0x3c')]({},_0x11b49b,_0x736d18['options']);var _0x56a1ac={'where':_0x11b49b['where']};return db[_0x10fa('0x2b')][_0x10fa('0x1d')](_0x56a1ac)[_0x10fa('0x26')](function(_0x4fbb8f){_0x4916c2[_0x10fa('0x1d')]=_0x4fbb8f;if(_0x736d18[_0x10fa('0x2f')]['includeAll']){_0x11b49b[_0x10fa('0x3e')]=[{'all':!![]}];}return db['Sound'][_0x10fa('0x3f')](_0x11b49b);})[_0x10fa('0x26')](function(_0x21ac30){_0x4916c2[_0x10fa('0x40')]=_0x21ac30;return _0x4916c2;})[_0x10fa('0x26')](respondWithFilteredResult(_0x5e5740,_0x11b49b))[_0x10fa('0x41')](handleError(_0x5e5740,null));};exports[_0x10fa('0x42')]=function(_0x15bc6d,_0x58e525){var _0x5425a7={'raw':!![],'where':{'id':_0x15bc6d[_0x10fa('0x43')]['id']}},_0x410a28={};_0x410a28[_0x10fa('0x2e')]=_[_0x10fa('0x30')](db[_0x10fa('0x2b')][_0x10fa('0x2c')]);_0x410a28['query']=_[_0x10fa('0x30')](_0x15bc6d[_0x10fa('0x2f')]);_0x410a28[_0x10fa('0x31')]=_['intersection'](_0x410a28[_0x10fa('0x2e')],_0x410a28[_0x10fa('0x2f')]);_0x5425a7[_0x10fa('0x33')]=_[_0x10fa('0x32')](_0x410a28['model'],qs[_0x10fa('0x44')](_0x15bc6d[_0x10fa('0x2f')][_0x10fa('0x44')]));_0x5425a7[_0x10fa('0x33')]=_0x5425a7[_0x10fa('0x33')][_0x10fa('0x34')]?_0x5425a7[_0x10fa('0x33')]:_0x410a28['model'];if(_0x15bc6d[_0x10fa('0x2f')][_0x10fa('0x45')]){_0x5425a7[_0x10fa('0x3e')]=[{'all':!![]}];}_0x5425a7=_['merge']({},_0x5425a7,_0x15bc6d[_0x10fa('0x46')]);return db['Sound'][_0x10fa('0x47')](_0x5425a7)[_0x10fa('0x26')](handleEntityNotFound(_0x58e525,null))[_0x10fa('0x26')](respondWithResult(_0x58e525,null))[_0x10fa('0x41')](handleError(_0x58e525,null));};exports[_0x10fa('0x48')]=function(_0x39b753,_0x546417,_0x23dcef){return db['Sound'][_0x10fa('0x47')]({'where':{'id':_0x39b753[_0x10fa('0x43')]['id']},'attributes':['name',_0x10fa('0x49'),'converted_format'],'raw':!![]})[_0x10fa('0x26')](handleEntityNotFound(_0x546417,null))[_0x10fa('0x26')](function(_0x14a250){if(_0x14a250){if(!fs[_0x10fa('0x4a')](path[_0x10fa('0x4b')](config[_0x10fa('0x4c')],'server/files/sounds/converted',_0x14a250[_0x10fa('0x49')]+'.'+_0x14a250['converted_format']))){throw new db['Sequelize'][(_0x10fa('0x4d'))](_0x10fa('0x4e'));}return _0x546417[_0x10fa('0x48')](path[_0x10fa('0x4b')](config[_0x10fa('0x4c')],_0x10fa('0x4f'),util['format'](_0x10fa('0x50'),_0x14a250['save_name'],_0x14a250[_0x10fa('0x51')])),util[_0x10fa('0x52')](_0x10fa('0x50'),_0x14a250['name'],_0x14a250[_0x10fa('0x51')]));}return null;})[_0x10fa('0x41')](handleError(_0x546417,null));};exports[_0x10fa('0x53')]=function(_0x714499,_0x3c1447,_0x2a33b0){var _0x52f795={'name':path[_0x10fa('0x54')](_0x714499['file'][_0x10fa('0x55')],path[_0x10fa('0x56')](_0x714499[_0x10fa('0x57')][_0x10fa('0x55')])),'save_name':path[_0x10fa('0x54')](_0x714499['file'][_0x10fa('0x58')],path[_0x10fa('0x56')](_0x714499[_0x10fa('0x57')]['filename'])),'original_format':path[_0x10fa('0x56')](_0x714499[_0x10fa('0x57')][_0x10fa('0x55')])[_0x10fa('0x59')](0x1),'converted_format':'wav'};var _0x35d861=path[_0x10fa('0x4b')](config[_0x10fa('0x4c')],_0x10fa('0x5a'),_0x714499[_0x10fa('0x57')]['filename']);var _0x401bb9=path['join'](config[_0x10fa('0x4c')],'server/files/sounds/converted',util[_0x10fa('0x52')]('%s.%s',path['basename'](_0x714499[_0x10fa('0x57')][_0x10fa('0x58')],path['extname'](_0x714499['file'][_0x10fa('0x58')])),_0x52f795['converted_format']));logger['info'](_0x10fa('0x5b'),_0x35d861);logger[_0x10fa('0x5c')](_0x10fa('0x5d'),_0x401bb9);try{fs[_0x10fa('0x5e')](_0x35d861,parseInt(_0x10fa('0x5f'),0x8));var _0x2739d3=sox[_0x10fa('0x60')](_0x35d861,_0x401bb9,{'sampleRate':0x1f40,'format':_0x10fa('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2739d3['on'](_0x10fa('0x27'),function(_0x30fef1){fs[_0x10fa('0x62')](_0x35d861);_0x3c1447[_0x10fa('0x19')](0x1f4)['send'](_0x30fef1);});_0x2739d3['on'](_0x10fa('0x63'),function(_0x47d4d6){_0x52f795[_0x10fa('0x64')]=isNaN(_0x47d4d6[_0x10fa('0x65')])?null:_0x47d4d6[_0x10fa('0x65')]*0x3e8;_0x52f795[_0x10fa('0x66')]=isNaN(_0x47d4d6[_0x10fa('0x67')])?null:_0x47d4d6[_0x10fa('0x67')];_0x52f795[_0x10fa('0x68')]=isNaN(_0x47d4d6[_0x10fa('0x69')])?null:_0x47d4d6[_0x10fa('0x69')];_0x52f795[_0x10fa('0x6a')]=isNaN(_0x47d4d6[_0x10fa('0x6b')])?null:_0x47d4d6[_0x10fa('0x6b')];_0x52f795[_0x10fa('0x6c')]=isNaN(_0x47d4d6[_0x10fa('0x6d')])?null:_0x47d4d6['sampleRate'];});_0x2739d3['on'](_0x10fa('0x6e'),function(_0x542345){_0x52f795[_0x10fa('0x6f')]=isNaN(_0x542345[_0x10fa('0x65')])?null:_0x542345[_0x10fa('0x65')]*0x3e8;_0x52f795[_0x10fa('0x70')]=isNaN(_0x542345[_0x10fa('0x67')])?null:_0x542345['sampleCount'];_0x52f795[_0x10fa('0x71')]=isNaN(_0x542345[_0x10fa('0x69')])?null:_0x542345[_0x10fa('0x69')];_0x52f795['converted_bitRate']=isNaN(_0x542345[_0x10fa('0x6b')])?null:_0x542345[_0x10fa('0x6b')];_0x52f795[_0x10fa('0x72')]=isNaN(_0x542345[_0x10fa('0x6d')])?null:_0x542345[_0x10fa('0x6d')];});_0x2739d3['on']('end',function(){fs[_0x10fa('0x5e')](_0x401bb9,parseInt(_0x10fa('0x5f'),0x8));return db[_0x10fa('0x2b')][_0x10fa('0x53')](_0x52f795)[_0x10fa('0x26')](function(_0x59bb0a){var _0x3e4242={'role':_0x714499[_0x10fa('0x73')][_0x10fa('0x74')],'userProfileId':_0x714499[_0x10fa('0x73')]['userProfileId']};if(!_0x3e4242)throw new Error(_0x10fa('0x75'));if(_0x3e4242[_0x10fa('0x74')]===_0x10fa('0x76')){var _0x32f30e=_0x59bb0a[_0x10fa('0x77')]({'plain':!![]});return db[_0x10fa('0x78')][_0x10fa('0x47')]({'where':{'name':'Sounds','userProfileId':_0x3e4242[_0x10fa('0x79')]},'raw':!![]})[_0x10fa('0x26')](function(_0x23c82e){if(_0x23c82e&&_0x23c82e[_0x10fa('0x7a')]===0x0){return db[_0x10fa('0x24')][_0x10fa('0x53')]({'name':_0x32f30e[_0x10fa('0x29')],'resourceId':_0x32f30e['id'],'type':_0x23c82e[_0x10fa('0x29')],'sectionId':_0x23c82e['id']},{})['then'](function(){return _0x59bb0a;});}else{return _0x59bb0a;}})[_0x10fa('0x41')](function(_0x3487e9){logger['error'](_0x10fa('0x7b'),_0x3487e9);throw _0x3487e9;});}return _0x59bb0a;})[_0x10fa('0x26')](respondWithResult(_0x3c1447,null))[_0x10fa('0x41')](handleError(_0x3c1447,null));});_0x2739d3['start']();}catch(_0x204bf8){_0x3c1447['status'](0x1f4)['send'](_0x204bf8);}};exports['update']=function(_0xc95ce1,_0x82dd47,_0x387978){return db['Sound'][_0x10fa('0x47')]({'where':{'id':_0xc95ce1[_0x10fa('0x43')]['id']}})[_0x10fa('0x26')](handleEntityNotFound(_0x82dd47,null))[_0x10fa('0x26')](saveUpdates(_[_0x10fa('0x3a')](_0xc95ce1[_0x10fa('0x73')],[_0x10fa('0x29'),'description']),null))[_0x10fa('0x26')](respondWithResult(_0x82dd47,null))[_0x10fa('0x41')](handleError(_0x82dd47,null));};exports[_0x10fa('0x7c')]=function(_0x5849c8,_0x2b1f05,_0x1e9a0d){return db['Sound'][_0x10fa('0x47')]({'where':{'id':_0x5849c8[_0x10fa('0x43')]['id']}})[_0x10fa('0x26')](function(_0x33f647){if(_0x33f647){return _0x33f647[_0x10fa('0x25')]();}})[_0x10fa('0x26')](function(_0x122ddc){var _0x30169d=path['join'](config[_0x10fa('0x4c')],_0x10fa('0x5a'),util[_0x10fa('0x52')]('%s.%s',_0x122ddc['save_name'],_0x122ddc[_0x10fa('0x7d')]));var _0x14bfbc=path[_0x10fa('0x4b')](config[_0x10fa('0x4c')],_0x10fa('0x4f'),util[_0x10fa('0x52')]('%s.%s',_0x122ddc[_0x10fa('0x49')],_0x122ddc[_0x10fa('0x51')]));fs[_0x10fa('0x62')](_0x30169d);fs[_0x10fa('0x62')](_0x14bfbc);return _0x122ddc;})['then'](function(_0x5d80d4){if(_0x5d80d4){return _0x2b1f05['status'](0xcc)[_0x10fa('0x18')]();}})[_0x10fa('0x26')](handleEntityNotFound(_0x2b1f05,null))['catch'](handleError(_0x2b1f05,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index b5d7323..426888e 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 _0x9770=['rimraf','./sound.attributes','exports','define','Sound','lodash','util','bluebird','request-promise','path'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0x9770,0x1c7));var _0x0977=function(_0x2f278d,_0x2064b9){_0x2f278d=_0x2f278d-0x0;var _0x34c4ab=_0x9770[_0x2f278d];return _0x34c4ab;};'use strict';var _=require(_0x0977('0x0'));var util=require(_0x0977('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0977('0x2'));var rp=require(_0x0977('0x3'));var fs=require('fs');var path=require(_0x0977('0x4'));var rimraf=require(_0x0977('0x5'));var config=require('../../config/environment');var attributes=require(_0x0977('0x6'));module[_0x0977('0x7')]=function(_0x3db1d7,_0x2071c5){return _0x3db1d7[_0x0977('0x8')](_0x0977('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9b=['exports','lodash','../../config/logger','request-promise','../../config/environment','./sound.attributes'];(function(_0x21fdce,_0x3b4c0e){var _0xcdf7d6=function(_0x4f74b5){while(--_0x4f74b5){_0x21fdce['push'](_0x21fdce['shift']());}};_0xcdf7d6(++_0x3b4c0e);}(_0x0a9b,0x181));var _0xb0a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a9b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb0a9('0x0'));var util=require('util');var logger=require(_0xb0a9('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb0a9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0a9('0x3'));var attributes=require(_0xb0a9('0x4'));module[_0xb0a9('0x5')]=function(_0x3e62bb,_0xaf4cee){return _0x3e62bb['define']('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 72ad5eb..9753227 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 _0xec66=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x3b7f47,_0x501172){var _0x270b0b=function(_0x1021f7){while(--_0x1021f7){_0x3b7f47['push'](_0x3b7f47['shift']());}};_0x270b0b(++_0x501172);}(_0xec66,0x1eb));var _0x6ec6=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0xec66[_0x1486e5];return _0x29d89b;};'use strict';var _=require(_0x6ec6('0x0'));var util=require(_0x6ec6('0x1'));var moment=require(_0x6ec6('0x2'));var BPromise=require(_0x6ec6('0x3'));var rs=require(_0x6ec6('0x4'));var fs=require('fs');var Redis=require(_0x6ec6('0x5'));var db=require(_0x6ec6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ec6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ec6('0x8'));var client=jayson[_0x6ec6('0x9')][_0x6ec6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42762b,_0x51f710,_0x264ecc){return new BPromise(function(_0x1c8db2,_0x4e3092){return client['request'](_0x42762b,_0x264ecc)['then'](function(_0x56d4bd){logger['info'](_0x6ec6('0xb'),_0x51f710,_0x6ec6('0xc'));logger[_0x6ec6('0xd')](_0x6ec6('0xe'),_0x51f710,_0x6ec6('0xc'),JSON['stringify'](_0x56d4bd));if(_0x56d4bd[_0x6ec6('0xf')]){if(_0x56d4bd[_0x6ec6('0xf')][_0x6ec6('0x10')]===0x1f4){logger[_0x6ec6('0xf')](_0x6ec6('0xb'),_0x51f710,_0x56d4bd[_0x6ec6('0xf')][_0x6ec6('0x11')]);return _0x4e3092(_0x56d4bd[_0x6ec6('0xf')][_0x6ec6('0x11')]);}logger['error'](_0x6ec6('0xb'),_0x51f710,_0x56d4bd['error'][_0x6ec6('0x11')]);return _0x1c8db2(_0x56d4bd[_0x6ec6('0xf')][_0x6ec6('0x11')]);}else{logger[_0x6ec6('0x12')](_0x6ec6('0xb'),_0x51f710,_0x6ec6('0xc'));_0x1c8db2(_0x56d4bd['result'][_0x6ec6('0x11')]);}})[_0x6ec6('0x13')](function(_0x480637){logger['error'](_0x6ec6('0xb'),_0x51f710,_0x480637);_0x4e3092(_0x480637);});});}exports['ShowSound']=function(_0x2db746){var _0x4bdb12=this;return new Promise(function(_0xbb8ddc,_0x96573f){return db[_0x6ec6('0x14')][_0x6ec6('0x15')]({'raw':_0x2db746[_0x6ec6('0x16')]?_0x2db746[_0x6ec6('0x16')][_0x6ec6('0x17')]===undefined?!![]:![]:!![],'where':_0x2db746[_0x6ec6('0x16')]?_0x2db746[_0x6ec6('0x16')][_0x6ec6('0x18')]||null:null,'attributes':_0x2db746['options']?_0x2db746[_0x6ec6('0x16')][_0x6ec6('0x19')]||null:null,'include':_0x2db746[_0x6ec6('0x16')]?_0x2db746[_0x6ec6('0x16')]['include']?_['map'](_0x2db746[_0x6ec6('0x16')][_0x6ec6('0x1a')],function(_0x1ec4db){return{'model':db[_0x1ec4db['model']],'as':_0x1ec4db['as'],'attributes':_0x1ec4db[_0x6ec6('0x19')],'include':_0x1ec4db['include']?_['map'](_0x1ec4db[_0x6ec6('0x1a')],function(_0x24431f){return{'model':db[_0x24431f['model']],'as':_0x24431f['as'],'attributes':_0x24431f[_0x6ec6('0x19')],'include':_0x24431f['include']?_[_0x6ec6('0x1b')](_0x24431f[_0x6ec6('0x1a')],function(_0x309ed5){return{'model':db[_0x309ed5[_0x6ec6('0x1c')]],'as':_0x309ed5['as'],'attributes':_0x309ed5[_0x6ec6('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e920b){logger[_0x6ec6('0x12')](_0x6ec6('0x1d'),_0x2db746);logger[_0x6ec6('0xd')](_0x6ec6('0x1d'),_0x2db746,JSON[_0x6ec6('0x1e')](_0x1e920b));_0xbb8ddc(_0x1e920b);})[_0x6ec6('0x13')](function(_0x1e71d6){logger[_0x6ec6('0xf')](_0x6ec6('0x1d'),_0x1e71d6[_0x6ec6('0x11')],_0x2db746);_0x96573f(_0x4bdb12[_0x6ec6('0xf')](0x1f4,_0x1e71d6[_0x6ec6('0x11')]));});});}; \ No newline at end of file +var _0xe31a=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code','Sound,\x20%s,\x20%s','message','info','ShowSound','Sound','find','options','raw','where','attributes','include','model','map','stringify','lodash','util'];(function(_0x13ca9e,_0x597770){var _0x1ccec8=function(_0xebe7bc){while(--_0xebe7bc){_0x13ca9e['push'](_0x13ca9e['shift']());}};_0x1ccec8(++_0x597770);}(_0xe31a,0x19e));var _0xae31=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xe31a[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xae31('0x0'));var util=require(_0xae31('0x1'));var moment=require(_0xae31('0x2'));var BPromise=require(_0xae31('0x3'));var rs=require(_0xae31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae31('0x5'))['db'];var utils=require(_0xae31('0x6'));var logger=require(_0xae31('0x7'))('rpc');var config=require(_0xae31('0x8'));var jayson=require(_0xae31('0x9'));var client=jayson[_0xae31('0xa')][_0xae31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5043af,_0x535e16,_0x2b455d){return new BPromise(function(_0x546c70,_0x25e80c){return client[_0xae31('0xc')](_0x5043af,_0x2b455d)[_0xae31('0xd')](function(_0x53651e){logger['info']('Sound,\x20%s,\x20%s',_0x535e16,_0xae31('0xe'));logger[_0xae31('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x535e16,_0xae31('0xe'),JSON['stringify'](_0x53651e));if(_0x53651e['error']){if(_0x53651e[_0xae31('0x10')][_0xae31('0x11')]===0x1f4){logger['error'](_0xae31('0x12'),_0x535e16,_0x53651e['error'][_0xae31('0x13')]);return _0x25e80c(_0x53651e[_0xae31('0x10')][_0xae31('0x13')]);}logger[_0xae31('0x10')](_0xae31('0x12'),_0x535e16,_0x53651e['error'][_0xae31('0x13')]);return _0x546c70(_0x53651e[_0xae31('0x10')][_0xae31('0x13')]);}else{logger[_0xae31('0x14')]('Sound,\x20%s,\x20%s',_0x535e16,_0xae31('0xe'));_0x546c70(_0x53651e['result']['message']);}})['catch'](function(_0x3ff9bb){logger[_0xae31('0x10')]('Sound,\x20%s,\x20%s',_0x535e16,_0x3ff9bb);_0x25e80c(_0x3ff9bb);});});}exports[_0xae31('0x15')]=function(_0x37874b){var _0x4a7c2a=this;return new Promise(function(_0x160b42,_0x48fd30){return db[_0xae31('0x16')][_0xae31('0x17')]({'raw':_0x37874b[_0xae31('0x18')]?_0x37874b[_0xae31('0x18')][_0xae31('0x19')]===undefined?!![]:![]:!![],'where':_0x37874b[_0xae31('0x18')]?_0x37874b[_0xae31('0x18')][_0xae31('0x1a')]||null:null,'attributes':_0x37874b[_0xae31('0x18')]?_0x37874b[_0xae31('0x18')][_0xae31('0x1b')]||null:null,'include':_0x37874b['options']?_0x37874b[_0xae31('0x18')][_0xae31('0x1c')]?_['map'](_0x37874b[_0xae31('0x18')]['include'],function(_0x15f401){return{'model':db[_0x15f401[_0xae31('0x1d')]],'as':_0x15f401['as'],'attributes':_0x15f401['attributes'],'include':_0x15f401[_0xae31('0x1c')]?_[_0xae31('0x1e')](_0x15f401[_0xae31('0x1c')],function(_0x16dcea){return{'model':db[_0x16dcea['model']],'as':_0x16dcea['as'],'attributes':_0x16dcea['attributes'],'include':_0x16dcea[_0xae31('0x1c')]?_[_0xae31('0x1e')](_0x16dcea[_0xae31('0x1c')],function(_0x176de9){return{'model':db[_0x176de9['model']],'as':_0x176de9['as'],'attributes':_0x176de9[_0xae31('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f0798){logger['info'](_0xae31('0x15'),_0x37874b);logger[_0xae31('0xf')]('ShowSound',_0x37874b,JSON[_0xae31('0x1f')](_0x4f0798));_0x160b42(_0x4f0798);})['catch'](function(_0x2dc04d){logger['error'](_0xae31('0x15'),_0x2dc04d[_0xae31('0x13')],_0x37874b);_0x48fd30(_0x4a7c2a[_0xae31('0x10')](0x1f4,_0x2dc04d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 256b0be..1d02389 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x3aea93,_0x4bd632){var _0x1adb9b=function(_0xe756ab){while(--_0xe756ab){_0x3aea93['push'](_0x3aea93['shift']());}};_0x1adb9b(++_0x4bd632);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x196e67,_0x68c695){var _0x35bc1e=function(_0x16e6ef){while(--_0x16e6ef){_0x196e67['push'](_0x196e67['shift']());}};_0x35bc1e(++_0x68c695);}(_0xb7e7,0x121));var _0x7b7e=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xb7e7[_0x17928f];return _0x500b63;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b070adb..c62b081 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 _0x41dd=['TEXT','out','sequelize','exports','STRING'];(function(_0x265878,_0x48f44c){var _0xf6a139=function(_0xe31091){while(--_0xe31091){_0x265878['push'](_0x265878['shift']());}};_0xf6a139(++_0x48f44c);}(_0x41dd,0x1bf));var _0xd41d=function(_0x2b358e,_0x46fc58){_0x2b358e=_0x2b358e-0x0;var _0x3bb291=_0x41dd[_0x2b358e];return _0x3bb291;};'use strict';var Sequelize=require(_0xd41d('0x0'));module[_0xd41d('0x1')]={'uniqueid':{'type':Sequelize[_0xd41d('0x2')]},'body':{'type':Sequelize[_0xd41d('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd41d('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xd41d('0x2')]},'providerResponse':{'type':Sequelize[_0xd41d('0x3')]}}; \ No newline at end of file +var _0x770f=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0xfe36de,_0x303b03){var _0x2072ce=function(_0x1cb93f){while(--_0x1cb93f){_0xfe36de['push'](_0xfe36de['shift']());}};_0x2072ce(++_0x303b03);}(_0x770f,0xef));var _0xf770=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0x770f[_0x30b159];return _0x23c3f9;};'use strict';var Sequelize=require(_0xf770('0x0'));module[_0xf770('0x1')]={'uniqueid':{'type':Sequelize[_0xf770('0x2')]},'body':{'type':Sequelize[_0xf770('0x3')](_0xf770('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xf770('0x5')]('in','out'),'defaultValue':_0xf770('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xf770('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 350285d..5089c54 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 _0x5f11=['SquareMessage','count','include','rows','catch','show','params','intersection','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','update','then','destroy','error','name','index','rawAttributes','fieldName','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options'];(function(_0x1ed792,_0x476ac4){var _0x3087cc=function(_0x21dd34){while(--_0x21dd34){_0x1ed792['push'](_0x1ed792['shift']());}};_0x3087cc(++_0x476ac4);}(_0x5f11,0x98));var _0x15f1=function(_0x1033b9,_0x101673){_0x1033b9=_0x1033b9-0x0;var _0x292719=_0x5f11[_0x1033b9];return _0x292719;};'use strict';var emlformat=require(_0x15f1('0x0'));var rimraf=require(_0x15f1('0x1'));var zipdir=require(_0x15f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15f1('0x3'));var moment=require(_0x15f1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15f1('0x5'));var util=require('util');var path=require(_0x15f1('0x6'));var sox=require(_0x15f1('0x7'));var csv=require(_0x15f1('0x8'));var ejs=require(_0x15f1('0x9'));var fs=require('fs');var fs_extra=require(_0x15f1('0xa'));var _=require(_0x15f1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x15f1('0xc'));var deskjs=require(_0x15f1('0xd'));var toCsv=require(_0x15f1('0x8'));var querystring=require(_0x15f1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x15f1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x15f1('0x10'));var hardwareService=require(_0x15f1('0x11'));var logger=require(_0x15f1('0x12'))('api');var utils=require(_0x15f1('0x13'));var config=require(_0x15f1('0x14'));var licenseUtil=require(_0x15f1('0x15'));var db=require(_0x15f1('0x16'))['db'];function respondWithStatusCode(_0x13fe7b,_0xb42d4c){_0xb42d4c=_0xb42d4c||0xcc;return function(_0x25c461){if(_0x25c461){return _0x13fe7b[_0x15f1('0x17')](_0xb42d4c);}return _0x13fe7b[_0x15f1('0x18')](_0xb42d4c)[_0x15f1('0x19')]();};}function respondWithResult(_0x52ff82,_0x5b64b6){_0x5b64b6=_0x5b64b6||0xc8;return function(_0x4d5e26){if(_0x4d5e26){return _0x52ff82[_0x15f1('0x18')](_0x5b64b6)['json'](_0x4d5e26);}};}function respondWithFilteredResult(_0xd28a30,_0x311ff1){return function(_0x5a9883){if(_0x5a9883){var _0x4ffef4=typeof _0x311ff1[_0x15f1('0x1a')]===_0x15f1('0x1b')&&typeof _0x311ff1[_0x15f1('0x1c')]===_0x15f1('0x1b');var _0x277781=_0x5a9883['count'];var _0x3e37f6=_0x4ffef4?0x0:_0x311ff1[_0x15f1('0x1a')];var _0x179a30=_0x4ffef4?_0x5a9883['count']:_0x311ff1[_0x15f1('0x1a')]+_0x311ff1[_0x15f1('0x1c')];var _0x3dc37a;if(_0x179a30>=_0x277781){_0x179a30=_0x277781;_0x3dc37a=0xc8;}else{_0x3dc37a=0xce;}_0xd28a30[_0x15f1('0x18')](_0x3dc37a);return _0xd28a30['set'](_0x15f1('0x1d'),_0x3e37f6+'-'+_0x179a30+'/'+_0x277781)[_0x15f1('0x1e')](_0x5a9883);}return null;};}function patchUpdates(_0x5d21b2){return function(_0x5c6ba2){try{jsonpatch[_0x15f1('0x1f')](_0x5c6ba2,_0x5d21b2,!![]);}catch(_0x350581){return BPromise[_0x15f1('0x20')](_0x350581);}return _0x5c6ba2['save']();};}function saveUpdates(_0x584f22,_0x1190a9){return function(_0x254c2a){if(_0x254c2a){return _0x254c2a[_0x15f1('0x21')](_0x584f22)[_0x15f1('0x22')](function(_0x10d18e){return _0x10d18e;});}return null;};}function removeEntity(_0x94e50b,_0xd72faa){return function(_0x48038d){if(_0x48038d){return _0x48038d[_0x15f1('0x23')]()[_0x15f1('0x22')](function(){_0x94e50b['status'](0xcc)[_0x15f1('0x19')]();});}};}function handleEntityNotFound(_0x152d4d,_0x4fcb25){return function(_0x27d7ae){if(!_0x27d7ae){_0x152d4d['sendStatus'](0x194);}return _0x27d7ae;};}function handleError(_0x5c71da,_0x339a22){_0x339a22=_0x339a22||0x1f4;return function(_0x11db76){logger[_0x15f1('0x24')](_0x11db76['stack']);if(_0x11db76[_0x15f1('0x25')]){delete _0x11db76['name'];}_0x5c71da[_0x15f1('0x18')](_0x339a22)['send'](_0x11db76);};}exports[_0x15f1('0x26')]=function(_0x453eb3,_0x4ea68e){var _0x623bf8={},_0x1c854b={},_0x3bfd5c={'count':0x0,'rows':[]};var _0x1e0d18=_['map'](db['SquareMessage'][_0x15f1('0x27')],function(_0x538377){return{'name':_0x538377[_0x15f1('0x28')],'type':_0x538377['type']['key']};});_0x1c854b[_0x15f1('0x29')]=_[_0x15f1('0x2a')](_0x1e0d18,_0x15f1('0x25'));_0x1c854b['query']=_[_0x15f1('0x2b')](_0x453eb3[_0x15f1('0x2c')]);_0x1c854b[_0x15f1('0x2d')]=_['intersection'](_0x1c854b['model'],_0x1c854b[_0x15f1('0x2c')]);_0x623bf8[_0x15f1('0x2e')]=_['intersection'](_0x1c854b[_0x15f1('0x29')],qs[_0x15f1('0x2f')](_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x2f')]));_0x623bf8[_0x15f1('0x2e')]=_0x623bf8[_0x15f1('0x2e')][_0x15f1('0x30')]?_0x623bf8['attributes']:_0x1c854b[_0x15f1('0x29')];if(!_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x31')](_0x15f1('0x32'))){_0x623bf8[_0x15f1('0x1c')]=qs['limit'](_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x1c')]);_0x623bf8['offset']=qs[_0x15f1('0x1a')](_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x1a')]);}_0x623bf8['order']=qs[_0x15f1('0x33')](_0x453eb3['query'][_0x15f1('0x33')]);_0x623bf8[_0x15f1('0x34')]=qs[_0x15f1('0x2d')](_[_0x15f1('0x35')](_0x453eb3[_0x15f1('0x2c')],_0x1c854b['filters']),_0x1e0d18);if(_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x36')]){_0x623bf8[_0x15f1('0x34')]=_[_0x15f1('0x37')](_0x623bf8['where'],{'$or':_[_0x15f1('0x2a')](_0x1e0d18,function(_0x1bad37){if(_0x1bad37[_0x15f1('0x38')]!=='VIRTUAL'){var _0x99d8ba={};_0x99d8ba[_0x1bad37[_0x15f1('0x25')]]={'$like':'%'+_0x453eb3[_0x15f1('0x2c')][_0x15f1('0x36')]+'%'};return _0x99d8ba;}})});}_0x623bf8=_[_0x15f1('0x37')]({},_0x623bf8,_0x453eb3[_0x15f1('0x39')]);var _0x3216f1={'where':_0x623bf8[_0x15f1('0x34')]};return db[_0x15f1('0x3a')][_0x15f1('0x3b')](_0x3216f1)[_0x15f1('0x22')](function(_0x52e2b8){_0x3bfd5c[_0x15f1('0x3b')]=_0x52e2b8;if(_0x453eb3[_0x15f1('0x2c')]['includeAll']){_0x623bf8[_0x15f1('0x3c')]=[{'all':!![]}];}return db[_0x15f1('0x3a')]['findAll'](_0x623bf8);})[_0x15f1('0x22')](function(_0x100120){_0x3bfd5c[_0x15f1('0x3d')]=_0x100120;return _0x3bfd5c;})['then'](respondWithFilteredResult(_0x4ea68e,_0x623bf8))[_0x15f1('0x3e')](handleError(_0x4ea68e,null));};exports[_0x15f1('0x3f')]=function(_0x370eea,_0x1c87da){var _0x3b7426={'raw':!![],'where':{'id':_0x370eea[_0x15f1('0x40')]['id']}},_0x3870ad={};_0x3870ad[_0x15f1('0x29')]=_['keys'](db[_0x15f1('0x3a')][_0x15f1('0x27')]);_0x3870ad[_0x15f1('0x2c')]=_['keys'](_0x370eea['query']);_0x3870ad[_0x15f1('0x2d')]=_['intersection'](_0x3870ad[_0x15f1('0x29')],_0x3870ad[_0x15f1('0x2c')]);_0x3b7426[_0x15f1('0x2e')]=_[_0x15f1('0x41')](_0x3870ad[_0x15f1('0x29')],qs['fields'](_0x370eea[_0x15f1('0x2c')]['fields']));_0x3b7426['attributes']=_0x3b7426[_0x15f1('0x2e')][_0x15f1('0x30')]?_0x3b7426[_0x15f1('0x2e')]:_0x3870ad['model'];if(_0x370eea[_0x15f1('0x2c')][_0x15f1('0x42')]){_0x3b7426[_0x15f1('0x3c')]=[{'all':!![]}];}_0x3b7426=_[_0x15f1('0x37')]({},_0x3b7426,_0x370eea[_0x15f1('0x39')]);return db[_0x15f1('0x3a')][_0x15f1('0x43')](_0x3b7426)[_0x15f1('0x22')](handleEntityNotFound(_0x1c87da,null))[_0x15f1('0x22')](respondWithResult(_0x1c87da,null))[_0x15f1('0x3e')](handleError(_0x1c87da,null));};exports[_0x15f1('0x44')]=function(_0x1e19ad,_0x14531d){return db['SquareMessage'][_0x15f1('0x44')](_0x1e19ad[_0x15f1('0x45')],{})[_0x15f1('0x22')](respondWithResult(_0x14531d,0xc9))[_0x15f1('0x3e')](handleError(_0x14531d,null));};exports[_0x15f1('0x21')]=function(_0x15051f,_0x445d1b){if(_0x15051f[_0x15f1('0x45')]['id']){delete _0x15051f[_0x15f1('0x45')]['id'];}return db[_0x15f1('0x3a')]['find']({'where':{'id':_0x15051f[_0x15f1('0x40')]['id']}})[_0x15f1('0x22')](handleEntityNotFound(_0x445d1b,null))[_0x15f1('0x22')](saveUpdates(_0x15051f[_0x15f1('0x45')],null))[_0x15f1('0x22')](respondWithResult(_0x445d1b,null))[_0x15f1('0x3e')](handleError(_0x445d1b,null));};exports[_0x15f1('0x23')]=function(_0x1b6e77,_0x535184){return db[_0x15f1('0x3a')][_0x15f1('0x43')]({'where':{'id':_0x1b6e77[_0x15f1('0x40')]['id']}})[_0x15f1('0x22')](handleEntityNotFound(_0x535184,null))['then'](removeEntity(_0x535184,null))[_0x15f1('0x3e')](handleError(_0x535184,null));}; \ No newline at end of file +var _0x3cd0=['eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','name','send','map','SquareMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body'];(function(_0x45f1c6,_0x4f87e8){var _0x49dd1f=function(_0x2aa72d){while(--_0x2aa72d){_0x45f1c6['push'](_0x45f1c6['shift']());}};_0x49dd1f(++_0x4f87e8);}(_0x3cd0,0x8a));var _0x03cd=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x3cd0[_0x38b2d9];return _0x23a3e1;};'use strict';var emlformat=require(_0x03cd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x03cd('0x1'));var rp=require('request-promise');var moment=require(_0x03cd('0x2'));var BPromise=require(_0x03cd('0x3'));var Mustache=require(_0x03cd('0x4'));var util=require(_0x03cd('0x5'));var path=require(_0x03cd('0x6'));var sox=require('sox');var csv=require(_0x03cd('0x7'));var ejs=require(_0x03cd('0x8'));var fs=require('fs');var fs_extra=require(_0x03cd('0x9'));var _=require(_0x03cd('0xa'));var squel=require(_0x03cd('0xb'));var crypto=require('crypto');var jsforce=require(_0x03cd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x03cd('0x7'));var querystring=require(_0x03cd('0xd'));var Papa=require(_0x03cd('0xe'));var Redis=require(_0x03cd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x03cd('0x10'));var as=require(_0x03cd('0x11'));var hardwareService=require(_0x03cd('0x12'));var logger=require(_0x03cd('0x13'))(_0x03cd('0x14'));var utils=require(_0x03cd('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x03cd('0x16'))['db'];function respondWithStatusCode(_0x315a6c,_0xaa6a21){_0xaa6a21=_0xaa6a21||0xcc;return function(_0x1d88e6){if(_0x1d88e6){return _0x315a6c['sendStatus'](_0xaa6a21);}return _0x315a6c[_0x03cd('0x17')](_0xaa6a21)[_0x03cd('0x18')]();};}function respondWithResult(_0x5d0c1c,_0x4f8f17){_0x4f8f17=_0x4f8f17||0xc8;return function(_0x58c000){if(_0x58c000){return _0x5d0c1c[_0x03cd('0x17')](_0x4f8f17)[_0x03cd('0x19')](_0x58c000);}};}function respondWithFilteredResult(_0x17961d,_0x77b1bf){return function(_0x526102){if(_0x526102){var _0xdf7488=typeof _0x77b1bf[_0x03cd('0x1a')]===_0x03cd('0x1b')&&typeof _0x77b1bf[_0x03cd('0x1c')]===_0x03cd('0x1b');var _0x5ac997=_0x526102[_0x03cd('0x1d')];var _0x27de4f=_0xdf7488?0x0:_0x77b1bf[_0x03cd('0x1a')];var _0x12b3ea=_0xdf7488?_0x526102[_0x03cd('0x1d')]:_0x77b1bf['offset']+_0x77b1bf[_0x03cd('0x1c')];var _0xa1122b;if(_0x12b3ea>=_0x5ac997){_0x12b3ea=_0x5ac997;_0xa1122b=0xc8;}else{_0xa1122b=0xce;}_0x17961d[_0x03cd('0x17')](_0xa1122b);return _0x17961d[_0x03cd('0x1e')]('Content-Range',_0x27de4f+'-'+_0x12b3ea+'/'+_0x5ac997)[_0x03cd('0x19')](_0x526102);}return null;};}function patchUpdates(_0x4d0a58){return function(_0x1d51fa){try{jsonpatch[_0x03cd('0x1f')](_0x1d51fa,_0x4d0a58,!![]);}catch(_0x85ac1b){return BPromise['reject'](_0x85ac1b);}return _0x1d51fa['save']();};}function saveUpdates(_0x255c96,_0x19ad78){return function(_0x4e8ff6){if(_0x4e8ff6){return _0x4e8ff6[_0x03cd('0x20')](_0x255c96)[_0x03cd('0x21')](function(_0x56ec2b){return _0x56ec2b;});}return null;};}function removeEntity(_0x440df7,_0x514c11){return function(_0x4f1b33){if(_0x4f1b33){return _0x4f1b33[_0x03cd('0x22')]()[_0x03cd('0x21')](function(){_0x440df7[_0x03cd('0x17')](0xcc)[_0x03cd('0x18')]();});}};}function handleEntityNotFound(_0x5173e9,_0x2f32df){return function(_0x4d64a6){if(!_0x4d64a6){_0x5173e9['sendStatus'](0x194);}return _0x4d64a6;};}function handleError(_0x245154,_0x491b16){_0x491b16=_0x491b16||0x1f4;return function(_0x3203b1){logger['error'](_0x3203b1['stack']);if(_0x3203b1[_0x03cd('0x23')]){delete _0x3203b1['name'];}_0x245154[_0x03cd('0x17')](_0x491b16)[_0x03cd('0x24')](_0x3203b1);};}exports['index']=function(_0x13242a,_0x38117e){var _0xb5eb0={},_0x12ec99={},_0x1d3309={'count':0x0,'rows':[]};var _0x49693c=_[_0x03cd('0x25')](db[_0x03cd('0x26')][_0x03cd('0x27')],function(_0x1e8827){return{'name':_0x1e8827['fieldName'],'type':_0x1e8827[_0x03cd('0x28')][_0x03cd('0x29')]};});_0x12ec99[_0x03cd('0x2a')]=_[_0x03cd('0x25')](_0x49693c,_0x03cd('0x23'));_0x12ec99[_0x03cd('0x2b')]=_[_0x03cd('0x2c')](_0x13242a[_0x03cd('0x2b')]);_0x12ec99[_0x03cd('0x2d')]=_[_0x03cd('0x2e')](_0x12ec99[_0x03cd('0x2a')],_0x12ec99[_0x03cd('0x2b')]);_0xb5eb0[_0x03cd('0x2f')]=_['intersection'](_0x12ec99['model'],qs[_0x03cd('0x30')](_0x13242a['query'][_0x03cd('0x30')]));_0xb5eb0[_0x03cd('0x2f')]=_0xb5eb0['attributes']['length']?_0xb5eb0[_0x03cd('0x2f')]:_0x12ec99[_0x03cd('0x2a')];if(!_0x13242a[_0x03cd('0x2b')][_0x03cd('0x31')]('nolimit')){_0xb5eb0[_0x03cd('0x1c')]=qs[_0x03cd('0x1c')](_0x13242a[_0x03cd('0x2b')][_0x03cd('0x1c')]);_0xb5eb0[_0x03cd('0x1a')]=qs[_0x03cd('0x1a')](_0x13242a['query'][_0x03cd('0x1a')]);}_0xb5eb0[_0x03cd('0x32')]=qs[_0x03cd('0x33')](_0x13242a['query'][_0x03cd('0x33')]);_0xb5eb0[_0x03cd('0x34')]=qs[_0x03cd('0x2d')](_[_0x03cd('0x35')](_0x13242a[_0x03cd('0x2b')],_0x12ec99[_0x03cd('0x2d')]),_0x49693c);if(_0x13242a[_0x03cd('0x2b')]['filter']){_0xb5eb0[_0x03cd('0x34')]=_[_0x03cd('0x36')](_0xb5eb0['where'],{'$or':_[_0x03cd('0x25')](_0x49693c,function(_0x43c266){if(_0x43c266[_0x03cd('0x28')]!==_0x03cd('0x37')){var _0x4f54f5={};_0x4f54f5[_0x43c266[_0x03cd('0x23')]]={'$like':'%'+_0x13242a[_0x03cd('0x2b')][_0x03cd('0x38')]+'%'};return _0x4f54f5;}})});}_0xb5eb0=_[_0x03cd('0x36')]({},_0xb5eb0,_0x13242a[_0x03cd('0x39')]);var _0x3be9c2={'where':_0xb5eb0[_0x03cd('0x34')]};return db[_0x03cd('0x26')]['count'](_0x3be9c2)['then'](function(_0x7a788e){_0x1d3309[_0x03cd('0x1d')]=_0x7a788e;if(_0x13242a[_0x03cd('0x2b')][_0x03cd('0x3a')]){_0xb5eb0[_0x03cd('0x3b')]=[{'all':!![]}];}return db['SquareMessage'][_0x03cd('0x3c')](_0xb5eb0);})[_0x03cd('0x21')](function(_0x473e2f){_0x1d3309[_0x03cd('0x3d')]=_0x473e2f;return _0x1d3309;})[_0x03cd('0x21')](respondWithFilteredResult(_0x38117e,_0xb5eb0))[_0x03cd('0x3e')](handleError(_0x38117e,null));};exports[_0x03cd('0x3f')]=function(_0xb07f50,_0x36eb53){var _0x28e481={'raw':!![],'where':{'id':_0xb07f50[_0x03cd('0x40')]['id']}},_0x59de59={};_0x59de59[_0x03cd('0x2a')]=_[_0x03cd('0x2c')](db[_0x03cd('0x26')][_0x03cd('0x27')]);_0x59de59[_0x03cd('0x2b')]=_[_0x03cd('0x2c')](_0xb07f50['query']);_0x59de59['filters']=_[_0x03cd('0x2e')](_0x59de59[_0x03cd('0x2a')],_0x59de59[_0x03cd('0x2b')]);_0x28e481[_0x03cd('0x2f')]=_[_0x03cd('0x2e')](_0x59de59[_0x03cd('0x2a')],qs[_0x03cd('0x30')](_0xb07f50['query'][_0x03cd('0x30')]));_0x28e481[_0x03cd('0x2f')]=_0x28e481[_0x03cd('0x2f')][_0x03cd('0x41')]?_0x28e481[_0x03cd('0x2f')]:_0x59de59[_0x03cd('0x2a')];if(_0xb07f50['query']['includeAll']){_0x28e481['include']=[{'all':!![]}];}_0x28e481=_['merge']({},_0x28e481,_0xb07f50[_0x03cd('0x39')]);return db[_0x03cd('0x26')][_0x03cd('0x42')](_0x28e481)[_0x03cd('0x21')](handleEntityNotFound(_0x36eb53,null))[_0x03cd('0x21')](respondWithResult(_0x36eb53,null))[_0x03cd('0x3e')](handleError(_0x36eb53,null));};exports[_0x03cd('0x43')]=function(_0x318d87,_0x51f648){return db['SquareMessage'][_0x03cd('0x43')](_0x318d87[_0x03cd('0x44')],{})['then'](respondWithResult(_0x51f648,0xc9))['catch'](handleError(_0x51f648,null));};exports['update']=function(_0xbb7b57,_0x2e10c4){if(_0xbb7b57['body']['id']){delete _0xbb7b57[_0x03cd('0x44')]['id'];}return db[_0x03cd('0x26')][_0x03cd('0x42')]({'where':{'id':_0xbb7b57['params']['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x2e10c4,null))[_0x03cd('0x21')](saveUpdates(_0xbb7b57[_0x03cd('0x44')],null))[_0x03cd('0x21')](respondWithResult(_0x2e10c4,null))[_0x03cd('0x3e')](handleError(_0x2e10c4,null));};exports['destroy']=function(_0x27107b,_0x18d4fc){return db[_0x03cd('0x26')][_0x03cd('0x42')]({'where':{'id':_0x27107b[_0x03cd('0x40')]['id']}})[_0x03cd('0x21')](handleEntityNotFound(_0x18d4fc,null))[_0x03cd('0x21')](removeEntity(_0x18d4fc,null))['catch'](handleError(_0x18d4fc,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 23d4d33..e108112 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 _0x6bd1=['../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x20a356,_0x7313f6){var _0x454c50=function(_0x3725b6){while(--_0x3725b6){_0x20a356['push'](_0x20a356['shift']());}};_0x454c50(++_0x7313f6);}(_0x6bd1,0x1c6));var _0x16bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6bd1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x16bd('0x0'));var util=require(_0x16bd('0x1'));var logger=require(_0x16bd('0x2'))(_0x16bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16bd('0x5'));var config=require(_0x16bd('0x6'));var attributes=require(_0x16bd('0x7'));module['exports']=function(_0x206b88,_0x2de8a2){return _0x206b88['define'](_0x16bd('0x8'),attributes,{'tableName':_0x16bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1da9=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','api','request-promise'];(function(_0x5e37d3,_0x1ce196){var _0x17684c=function(_0x260c66){while(--_0x260c66){_0x5e37d3['push'](_0x5e37d3['shift']());}};_0x17684c(++_0x1ce196);}(_0x1da9,0xcb));var _0x91da=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1da9[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x91da('0x0'));var util=require(_0x91da('0x1'));var logger=require('../../config/logger')(_0x91da('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x91da('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91da('0x4'));var config=require(_0x91da('0x5'));var attributes=require(_0x91da('0x6'));module[_0x91da('0x7')]=function(_0x3ef123,_0x438348){return _0x3ef123[_0x91da('0x8')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 6863383..1cc781d 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 _0x3d18=['SquareMessage,\x20%s,\x20%s','info','result','catch','CreateSquareMessage','create','raw','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','message'];(function(_0x84bd8a,_0x5dbba2){var _0x4ca232=function(_0x1209c3){while(--_0x1209c3){_0x84bd8a['push'](_0x84bd8a['shift']());}};_0x4ca232(++_0x5dbba2);}(_0x3d18,0x102));var _0x83d1=function(_0x3f8032,_0x14bee7){_0x3f8032=_0x3f8032-0x0;var _0x4b67dd=_0x3d18[_0x3f8032];return _0x4b67dd;};'use strict';var _=require(_0x83d1('0x0'));var util=require(_0x83d1('0x1'));var moment=require(_0x83d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x83d1('0x3'));var fs=require('fs');var Redis=require(_0x83d1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x83d1('0x5'));var logger=require(_0x83d1('0x6'))(_0x83d1('0x7'));var config=require(_0x83d1('0x8'));var jayson=require(_0x83d1('0x9'));var client=jayson[_0x83d1('0xa')][_0x83d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d3dd9,_0x3c4499,_0xcf4a49){return new BPromise(function(_0x2f53e4,_0x2af3e8){return client['request'](_0x2d3dd9,_0xcf4a49)[_0x83d1('0xc')](function(_0x49e7a2){logger['info']('SquareMessage,\x20%s,\x20%s',_0x3c4499,_0x83d1('0xd'));logger[_0x83d1('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3c4499,'request\x20sent',JSON['stringify'](_0x49e7a2));if(_0x49e7a2[_0x83d1('0xf')]){if(_0x49e7a2[_0x83d1('0xf')]['code']===0x1f4){logger[_0x83d1('0xf')]('SquareMessage,\x20%s,\x20%s',_0x3c4499,_0x49e7a2[_0x83d1('0xf')][_0x83d1('0x10')]);return _0x2af3e8(_0x49e7a2[_0x83d1('0xf')]['message']);}logger[_0x83d1('0xf')](_0x83d1('0x11'),_0x3c4499,_0x49e7a2[_0x83d1('0xf')][_0x83d1('0x10')]);return _0x2f53e4(_0x49e7a2[_0x83d1('0xf')][_0x83d1('0x10')]);}else{logger[_0x83d1('0x12')]('SquareMessage,\x20%s,\x20%s',_0x3c4499,_0x83d1('0xd'));_0x2f53e4(_0x49e7a2[_0x83d1('0x13')][_0x83d1('0x10')]);}})[_0x83d1('0x14')](function(_0x35fe43){logger['error'](_0x83d1('0x11'),_0x3c4499,_0x35fe43);_0x2af3e8(_0x35fe43);});});}exports[_0x83d1('0x15')]=function(_0x118e04){var _0x18678d=this;return new Promise(function(_0x139a59,_0x299ee7){return db['SquareMessage'][_0x83d1('0x16')](_0x118e04['body'],{'raw':_0x118e04['options']?_0x118e04['options'][_0x83d1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2b7586){logger[_0x83d1('0x12')]('CreateSquareMessage',_0x118e04);logger[_0x83d1('0xe')]('CreateSquareMessage',_0x118e04,JSON[_0x83d1('0x18')](_0x2b7586));_0x139a59(_0x2b7586);})['catch'](function(_0x46801e){logger[_0x83d1('0xf')](_0x83d1('0x15'),_0x46801e[_0x83d1('0x10')],_0x118e04);_0x299ee7(_0x18678d['error'](0x1f4,_0x46801e[_0x83d1('0x10')]));});});}; \ No newline at end of file +var _0x20f1=['request\x20sent','stringify','error','code','message','result','catch','CreateSquareMessage','create','options','raw','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x20f1,0x194));var _0x120f=function(_0x4610b1,_0x1d49c2){_0x4610b1=_0x4610b1-0x0;var _0x2ac81b=_0x20f1[_0x4610b1];return _0x2ac81b;};'use strict';var _=require(_0x120f('0x0'));var util=require('util');var moment=require(_0x120f('0x1'));var BPromise=require(_0x120f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x120f('0x3'));var db=require(_0x120f('0x4'))['db'];var utils=require(_0x120f('0x5'));var logger=require(_0x120f('0x6'))('rpc');var config=require(_0x120f('0x7'));var jayson=require(_0x120f('0x8'));var client=jayson[_0x120f('0x9')][_0x120f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4baf0e,_0x565038,_0x4a5135){return new BPromise(function(_0x42a2af,_0x264d47){return client[_0x120f('0xb')](_0x4baf0e,_0x4a5135)[_0x120f('0xc')](function(_0x10a0eb){logger[_0x120f('0xd')](_0x120f('0xe'),_0x565038,'request\x20sent');logger['debug'](_0x120f('0xf'),_0x565038,_0x120f('0x10'),JSON[_0x120f('0x11')](_0x10a0eb));if(_0x10a0eb[_0x120f('0x12')]){if(_0x10a0eb[_0x120f('0x12')][_0x120f('0x13')]===0x1f4){logger[_0x120f('0x12')](_0x120f('0xe'),_0x565038,_0x10a0eb['error'][_0x120f('0x14')]);return _0x264d47(_0x10a0eb['error'][_0x120f('0x14')]);}logger['error'](_0x120f('0xe'),_0x565038,_0x10a0eb[_0x120f('0x12')][_0x120f('0x14')]);return _0x42a2af(_0x10a0eb[_0x120f('0x12')][_0x120f('0x14')]);}else{logger['info'](_0x120f('0xe'),_0x565038,_0x120f('0x10'));_0x42a2af(_0x10a0eb[_0x120f('0x15')][_0x120f('0x14')]);}})[_0x120f('0x16')](function(_0x1633d2){logger['error'](_0x120f('0xe'),_0x565038,_0x1633d2);_0x264d47(_0x1633d2);});});}exports[_0x120f('0x17')]=function(_0x14e3f5){var _0x201cbf=this;return new Promise(function(_0x2f7866,_0x4df278){return db['SquareMessage'][_0x120f('0x18')](_0x14e3f5['body'],{'raw':_0x14e3f5[_0x120f('0x19')]?_0x14e3f5[_0x120f('0x19')][_0x120f('0x1a')]===undefined?!![]:![]:!![]})[_0x120f('0xc')](function(_0x1b3e8d){logger[_0x120f('0xd')](_0x120f('0x17'),_0x14e3f5);logger[_0x120f('0x1b')](_0x120f('0x17'),_0x14e3f5,JSON['stringify'](_0x1b3e8d));_0x2f7866(_0x1b3e8d);})[_0x120f('0x16')](function(_0xbe70b3){logger['error'](_0x120f('0x17'),_0xbe70b3['message'],_0x14e3f5);_0x4df278(_0x201cbf[_0x120f('0x12')](0x1f4,_0xbe70b3[_0x120f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a136b1e..40e1362 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 _0xec6b=['get','isAuthenticated','index','/:id','show','/:id/test','15s','test','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x57c8ca,_0x4ef57f){var _0x58588c=function(_0x323240){while(--_0x323240){_0x57c8ca['push'](_0x57c8ca['shift']());}};_0x58588c(++_0x4ef57f);}(_0xec6b,0x12b));var _0xbec6=function(_0x481fa8,_0x22f4b5){_0x481fa8=_0x481fa8-0x0;var _0x39df0c=_0xec6b[_0x481fa8];return _0x39df0c;};'use strict';var multer=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var path=require(_0xbec6('0x2'));var timeout=require(_0xbec6('0x3'));var express=require(_0xbec6('0x4'));var router=express['Router']();var fs_extra=require(_0xbec6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbec6('0x6'));var config=require(_0xbec6('0x7'));var controller=require(_0xbec6('0x8'));router[_0xbec6('0x9')]('/',auth[_0xbec6('0xa')](),controller[_0xbec6('0xb')]);router[_0xbec6('0x9')](_0xbec6('0xc'),auth[_0xbec6('0xa')](),controller[_0xbec6('0xd')]);router['get'](_0xbec6('0xe'),auth[_0xbec6('0xa')](),timeout(_0xbec6('0xf')),controller[_0xbec6('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbec6('0x11')]);router[_0xbec6('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbec6('0x13')]);router['delete'](_0xbec6('0xc'),auth[_0xbec6('0xa')](),controller[_0xbec6('0x14')]);module[_0xbec6('0x15')]=router; \ No newline at end of file +var _0xc941=['post','create','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','/:id','show','/:id/test','isAuthenticated','15s','test'];(function(_0x27154c,_0x1bb0e2){var _0x2420d7=function(_0x4a5185){while(--_0x4a5185){_0x27154c['push'](_0x27154c['shift']());}};_0x2420d7(++_0x1bb0e2);}(_0xc941,0x1aa));var _0x1c94=function(_0x17df89,_0x1c05ea){_0x17df89=_0x17df89-0x0;var _0x596a5f=_0xc941[_0x17df89];return _0x596a5f;};'use strict';var multer=require(_0x1c94('0x0'));var util=require('util');var path=require(_0x1c94('0x1'));var timeout=require(_0x1c94('0x2'));var express=require(_0x1c94('0x3'));var router=express['Router']();var fs_extra=require(_0x1c94('0x4'));var auth=require(_0x1c94('0x5'));var interaction=require(_0x1c94('0x6'));var config=require('../../config/environment');var controller=require(_0x1c94('0x7'));router[_0x1c94('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1c94('0x9'),auth['isAuthenticated'](),controller[_0x1c94('0xa')]);router['get'](_0x1c94('0xb'),auth[_0x1c94('0xc')](),timeout(_0x1c94('0xd')),controller[_0x1c94('0xe')]);router[_0x1c94('0xf')]('/',auth[_0x1c94('0xc')](),controller[_0x1c94('0x10')]);router[_0x1c94('0x11')](_0x1c94('0x9'),auth['isAuthenticated'](),controller[_0x1c94('0x12')]);router[_0x1c94('0x13')](_0x1c94('0x9'),auth[_0x1c94('0xc')](),controller[_0x1c94('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 43dd4d8..4b5e60e 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 _0x117b=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x117b,0x77));var _0xb117=function(_0x211b21,_0x12f0f7){_0x211b21=_0x211b21-0x0;var _0x29ca41=_0x117b[_0x211b21];return _0x29ca41;};'use strict';var Sequelize=require('sequelize');module[_0xb117('0x0')]={'name':{'type':Sequelize[_0xb117('0x1')],'unique':_0xb117('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb117('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3381=['exports','STRING','name','sequelize'];(function(_0x244716,_0x1e6caf){var _0x2e5b9d=function(_0x2028e6){while(--_0x2028e6){_0x244716['push'](_0x244716['shift']());}};_0x2e5b9d(++_0x1e6caf);}(_0x3381,0x67));var _0x1338=function(_0x4b35ff,_0x5605df){_0x4b35ff=_0x4b35ff-0x0;var _0xaf99ba=_0x3381[_0x4b35ff];return _0xaf99ba;};'use strict';var Sequelize=require(_0x1338('0x0'));module[_0x1338('0x1')]={'name':{'type':Sequelize[_0x1338('0x2')],'unique':_0x1338('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 79f4ffb..cfd9d66 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 _0x5db4=['sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5db4,0x197));var _0x45db=function(_0x15447d,_0x19d97c){_0x15447d=_0x15447d-0x0;var _0x4cc882=_0x5db4[_0x15447d];return _0x4cc882;};'use strict';var emlformat=require(_0x45db('0x0'));var rimraf=require(_0x45db('0x1'));var zipdir=require(_0x45db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45db('0x3'));var moment=require(_0x45db('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x45db('0x5'));var util=require(_0x45db('0x6'));var path=require(_0x45db('0x7'));var sox=require('sox');var csv=require(_0x45db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x45db('0x9'));var _=require(_0x45db('0xa'));var squel=require(_0x45db('0xb'));var crypto=require('crypto');var jsforce=require(_0x45db('0xc'));var deskjs=require(_0x45db('0xd'));var toCsv=require(_0x45db('0x8'));var querystring=require(_0x45db('0xe'));var Papa=require(_0x45db('0xf'));var Redis=require('ioredis');var authService=require(_0x45db('0x10'));var qs=require(_0x45db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45db('0x12'));var logger=require('../../config/logger')(_0x45db('0x13'));var utils=require('../../config/utils');var config=require(_0x45db('0x14'));var licenseUtil=require(_0x45db('0x15'));var db=require(_0x45db('0x16'))['db'];function respondWithStatusCode(_0x498b4a,_0x3f3496){_0x3f3496=_0x3f3496||0xcc;return function(_0x33ff0a){if(_0x33ff0a){return _0x498b4a[_0x45db('0x17')](_0x3f3496);}return _0x498b4a[_0x45db('0x18')](_0x3f3496)['end']();};}function respondWithResult(_0x4c8b53,_0x5f39c6){_0x5f39c6=_0x5f39c6||0xc8;return function(_0x5b7661){if(_0x5b7661){return _0x4c8b53[_0x45db('0x18')](_0x5f39c6)[_0x45db('0x19')](_0x5b7661);}};}function respondWithFilteredResult(_0x27cc1,_0x18a331){return function(_0x5c4936){if(_0x5c4936){var _0x4d4527=typeof _0x18a331['offset']===_0x45db('0x1a')&&typeof _0x18a331[_0x45db('0x1b')]===_0x45db('0x1a');var _0x298d63=_0x5c4936[_0x45db('0x1c')];var _0x1accc2=_0x4d4527?0x0:_0x18a331[_0x45db('0x1d')];var _0x115f56=_0x4d4527?_0x5c4936[_0x45db('0x1c')]:_0x18a331[_0x45db('0x1d')]+_0x18a331['limit'];var _0x1ecfdc;if(_0x115f56>=_0x298d63){_0x115f56=_0x298d63;_0x1ecfdc=0xc8;}else{_0x1ecfdc=0xce;}_0x27cc1['status'](_0x1ecfdc);return _0x27cc1[_0x45db('0x1e')](_0x45db('0x1f'),_0x1accc2+'-'+_0x115f56+'/'+_0x298d63)[_0x45db('0x19')](_0x5c4936);}return null;};}function patchUpdates(_0x3954b3){return function(_0x3d2a82){try{jsonpatch[_0x45db('0x20')](_0x3d2a82,_0x3954b3,!![]);}catch(_0x1418df){return BPromise[_0x45db('0x21')](_0x1418df);}return _0x3d2a82[_0x45db('0x22')]();};}function saveUpdates(_0x4559fc,_0xbeec9b){return function(_0x59e1c3){if(_0x59e1c3){return _0x59e1c3[_0x45db('0x23')](_0x4559fc)['then'](function(_0xb14d90){return _0xb14d90;});}return null;};}function removeEntity(_0x1c66d1,_0x5e924f){return function(_0x47ecc7){if(_0x47ecc7){return _0x47ecc7[_0x45db('0x24')]()[_0x45db('0x25')](function(){var _0x3a583b=_0x47ecc7[_0x45db('0x26')]({'plain':!![]});var _0x54cdf1=_0x45db('0x27');return db[_0x45db('0x28')][_0x45db('0x24')]({'where':{'type':_0x54cdf1,'resourceId':_0x3a583b['id']}})['then'](function(){return _0x47ecc7;});})[_0x45db('0x25')](function(){_0x1c66d1[_0x45db('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c8885,_0x51ed23){return function(_0x846d91){if(!_0x846d91){_0x1c8885[_0x45db('0x17')](0x194);}return _0x846d91;};}function handleError(_0x6aa570,_0x237740){_0x237740=_0x237740||0x1f4;return function(_0x5a88c2){logger[_0x45db('0x29')](_0x5a88c2[_0x45db('0x2a')]);if(_0x5a88c2['name']){delete _0x5a88c2[_0x45db('0x2b')];}_0x6aa570[_0x45db('0x18')](_0x237740)[_0x45db('0x2c')](_0x5a88c2);};}exports[_0x45db('0x2d')]=function(_0x5bbc7e,_0x42f020){var _0x46e3e3={},_0x357ce4={},_0x5bed6b={'count':0x0,'rows':[]};var _0x2b7c24=_[_0x45db('0x2e')](db[_0x45db('0x2f')][_0x45db('0x30')],function(_0x320659){return{'name':_0x320659[_0x45db('0x31')],'type':_0x320659[_0x45db('0x32')]['key']};});_0x357ce4[_0x45db('0x33')]=_[_0x45db('0x2e')](_0x2b7c24,_0x45db('0x2b'));_0x357ce4[_0x45db('0x34')]=_[_0x45db('0x35')](_0x5bbc7e[_0x45db('0x34')]);_0x357ce4[_0x45db('0x36')]=_[_0x45db('0x37')](_0x357ce4[_0x45db('0x33')],_0x357ce4[_0x45db('0x34')]);_0x46e3e3[_0x45db('0x38')]=_[_0x45db('0x37')](_0x357ce4[_0x45db('0x33')],qs['fields'](_0x5bbc7e[_0x45db('0x34')][_0x45db('0x39')]));_0x46e3e3[_0x45db('0x38')]=_0x46e3e3[_0x45db('0x38')][_0x45db('0x3a')]?_0x46e3e3[_0x45db('0x38')]:_0x357ce4['model'];if(!_0x5bbc7e[_0x45db('0x34')]['hasOwnProperty'](_0x45db('0x3b'))){_0x46e3e3[_0x45db('0x1b')]=qs[_0x45db('0x1b')](_0x5bbc7e[_0x45db('0x34')]['limit']);_0x46e3e3['offset']=qs[_0x45db('0x1d')](_0x5bbc7e['query']['offset']);}_0x46e3e3[_0x45db('0x3c')]=qs['sort'](_0x5bbc7e[_0x45db('0x34')][_0x45db('0x3d')]);_0x46e3e3[_0x45db('0x3e')]=qs[_0x45db('0x36')](_['pick'](_0x5bbc7e[_0x45db('0x34')],_0x357ce4[_0x45db('0x36')]),_0x2b7c24);if(_0x5bbc7e[_0x45db('0x34')][_0x45db('0x3f')]){_0x46e3e3[_0x45db('0x3e')]=_[_0x45db('0x40')](_0x46e3e3[_0x45db('0x3e')],{'$or':_[_0x45db('0x2e')](_0x2b7c24,function(_0x3e71c2){if(_0x3e71c2[_0x45db('0x32')]!==_0x45db('0x41')){var _0x382b2c={};_0x382b2c[_0x3e71c2[_0x45db('0x2b')]]={'$like':'%'+_0x5bbc7e[_0x45db('0x34')][_0x45db('0x3f')]+'%'};return _0x382b2c;}})});}_0x46e3e3=_[_0x45db('0x40')]({},_0x46e3e3,_0x5bbc7e[_0x45db('0x42')]);var _0xc0b963={'where':_0x46e3e3[_0x45db('0x3e')]};return db['SquareOdbc'][_0x45db('0x1c')](_0xc0b963)[_0x45db('0x25')](function(_0x35b8a4){_0x5bed6b[_0x45db('0x1c')]=_0x35b8a4;if(_0x5bbc7e[_0x45db('0x34')]['includeAll']){_0x46e3e3[_0x45db('0x43')]=[{'all':!![]}];}return db[_0x45db('0x2f')][_0x45db('0x44')](_0x46e3e3);})[_0x45db('0x25')](function(_0x551c30){_0x5bed6b[_0x45db('0x45')]=_0x551c30;return _0x5bed6b;})['then'](respondWithFilteredResult(_0x42f020,_0x46e3e3))[_0x45db('0x46')](handleError(_0x42f020,null));};exports['show']=function(_0x1f5459,_0x46a4db){var _0x3fe5ad={'raw':!![],'where':{'id':_0x1f5459['params']['id']}},_0x472217={};_0x472217[_0x45db('0x33')]=_[_0x45db('0x35')](db['SquareOdbc'][_0x45db('0x30')]);_0x472217['query']=_[_0x45db('0x35')](_0x1f5459[_0x45db('0x34')]);_0x472217[_0x45db('0x36')]=_['intersection'](_0x472217[_0x45db('0x33')],_0x472217[_0x45db('0x34')]);_0x3fe5ad['attributes']=_[_0x45db('0x37')](_0x472217['model'],qs[_0x45db('0x39')](_0x1f5459['query'][_0x45db('0x39')]));_0x3fe5ad[_0x45db('0x38')]=_0x3fe5ad[_0x45db('0x38')][_0x45db('0x3a')]?_0x3fe5ad[_0x45db('0x38')]:_0x472217[_0x45db('0x33')];if(_0x1f5459[_0x45db('0x34')][_0x45db('0x47')]){_0x3fe5ad[_0x45db('0x43')]=[{'all':!![]}];}_0x3fe5ad=_[_0x45db('0x40')]({},_0x3fe5ad,_0x1f5459[_0x45db('0x42')]);return db[_0x45db('0x2f')][_0x45db('0x48')](_0x3fe5ad)['then'](handleEntityNotFound(_0x46a4db,null))[_0x45db('0x25')](respondWithResult(_0x46a4db,null))['catch'](handleError(_0x46a4db,null));};exports[_0x45db('0x49')]=function(_0x576726,_0x5b7633){return db[_0x45db('0x2f')][_0x45db('0x49')](_0x576726['body'],{})[_0x45db('0x25')](function(_0x4d82fa){var _0x4028f6=_0x576726[_0x45db('0x4a')][_0x45db('0x26')]({'plain':!![]});if(!_0x4028f6)throw new Error(_0x45db('0x4b'));if(_0x4028f6['role']==='user'){var _0x23120e=_0x4d82fa['get']({'plain':!![]});var _0x2156e8='ODBC';return db[_0x45db('0x4c')][_0x45db('0x48')]({'where':{'name':_0x2156e8,'userProfileId':_0x4028f6[_0x45db('0x4d')]},'raw':!![]})['then'](function(_0x1c7381){if(_0x1c7381&&_0x1c7381['autoAssociation']===0x0){return db[_0x45db('0x28')][_0x45db('0x49')]({'name':_0x23120e[_0x45db('0x2b')],'resourceId':_0x23120e['id'],'type':_0x1c7381[_0x45db('0x2b')],'sectionId':_0x1c7381['id']},{})['then'](function(){return _0x4d82fa;});}else{return _0x4d82fa;}})['catch'](function(_0x4330b4){logger['error'](_0x45db('0x4e'),_0x4330b4);throw _0x4330b4;});}return _0x4d82fa;})[_0x45db('0x25')](respondWithResult(_0x5b7633,0xc9))[_0x45db('0x46')](handleError(_0x5b7633,null));};exports['update']=function(_0x1a665d,_0xe82099){if(_0x1a665d[_0x45db('0x4f')]['id']){delete _0x1a665d['body']['id'];}return db[_0x45db('0x2f')][_0x45db('0x48')]({'where':{'id':_0x1a665d[_0x45db('0x50')]['id']}})['then'](handleEntityNotFound(_0xe82099,null))[_0x45db('0x25')](saveUpdates(_0x1a665d[_0x45db('0x4f')],null))[_0x45db('0x25')](respondWithResult(_0xe82099,null))[_0x45db('0x46')](handleError(_0xe82099,null));};exports[_0x45db('0x24')]=function(_0x5944ea,_0x896dba){return db[_0x45db('0x2f')][_0x45db('0x48')]({'where':{'id':_0x5944ea[_0x45db('0x50')]['id']}})[_0x45db('0x25')](handleEntityNotFound(_0x896dba,null))[_0x45db('0x25')](removeEntity(_0x896dba,null))[_0x45db('0x46')](handleError(_0x896dba,null));};exports[_0x45db('0x51')]=function(_0x4349c1,_0x5cbbc1,_0x5495da){var _0x26b6c0;return db[_0x45db('0x2f')][_0x45db('0x48')]({'where':{'id':_0x4349c1[_0x45db('0x50')]['id']},'attributes':['id',_0x45db('0x52')]})[_0x45db('0x25')](handleEntityNotFound(_0x5cbbc1,null))['then'](function(_0x4dbdd4){if(_0x4dbdd4){var _0xae19e3=require(_0x45db('0x53'))();_0xae19e3[_0x45db('0x54')](_0x4dbdd4[_0x45db('0x52')]);_0xae19e3[_0x45db('0x55')]();return _0x4dbdd4;}})['then'](respondWithResult(_0x5cbbc1,null))[_0x45db('0x46')](handleError(_0x5cbbc1,null));}; \ No newline at end of file +var _0x6a96=['count','set','Content-Range','apply','reject','save','destroy','then','get','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x287854,_0x1c6ae2){var _0x2638f6=function(_0x5eedd5){while(--_0x5eedd5){_0x287854['push'](_0x287854['shift']());}};_0x2638f6(++_0x1c6ae2);}(_0x6a96,0x92));var _0x66a9=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x6a96[_0x21b706];return _0x13b94a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66a9('0x0'));var zipdir=require(_0x66a9('0x1'));var jsonpatch=require(_0x66a9('0x2'));var rp=require(_0x66a9('0x3'));var moment=require(_0x66a9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x66a9('0x5'));var util=require(_0x66a9('0x6'));var path=require(_0x66a9('0x7'));var sox=require(_0x66a9('0x8'));var csv=require('to-csv');var ejs=require(_0x66a9('0x9'));var fs=require('fs');var fs_extra=require(_0x66a9('0xa'));var _=require(_0x66a9('0xb'));var squel=require(_0x66a9('0xc'));var crypto=require(_0x66a9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x66a9('0xe'));var querystring=require(_0x66a9('0xf'));var Papa=require(_0x66a9('0x10'));var Redis=require(_0x66a9('0x11'));var authService=require(_0x66a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x66a9('0x13'));var hardwareService=require(_0x66a9('0x14'));var logger=require(_0x66a9('0x15'))(_0x66a9('0x16'));var utils=require('../../config/utils');var config=require(_0x66a9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x66a9('0x18'))['db'];function respondWithStatusCode(_0x55610e,_0x6cd3dd){_0x6cd3dd=_0x6cd3dd||0xcc;return function(_0x29b4ac){if(_0x29b4ac){return _0x55610e[_0x66a9('0x19')](_0x6cd3dd);}return _0x55610e[_0x66a9('0x1a')](_0x6cd3dd)['end']();};}function respondWithResult(_0x5e763f,_0x39fbbb){_0x39fbbb=_0x39fbbb||0xc8;return function(_0x286260){if(_0x286260){return _0x5e763f[_0x66a9('0x1a')](_0x39fbbb)[_0x66a9('0x1b')](_0x286260);}};}function respondWithFilteredResult(_0x15e969,_0x175a2c){return function(_0x137e9f){if(_0x137e9f){var _0x364c80=typeof _0x175a2c[_0x66a9('0x1c')]===_0x66a9('0x1d')&&typeof _0x175a2c['limit']===_0x66a9('0x1d');var _0x189981=_0x137e9f[_0x66a9('0x1e')];var _0xbf486b=_0x364c80?0x0:_0x175a2c['offset'];var _0xba116b=_0x364c80?_0x137e9f[_0x66a9('0x1e')]:_0x175a2c[_0x66a9('0x1c')]+_0x175a2c['limit'];var _0x47c9fa;if(_0xba116b>=_0x189981){_0xba116b=_0x189981;_0x47c9fa=0xc8;}else{_0x47c9fa=0xce;}_0x15e969[_0x66a9('0x1a')](_0x47c9fa);return _0x15e969[_0x66a9('0x1f')](_0x66a9('0x20'),_0xbf486b+'-'+_0xba116b+'/'+_0x189981)[_0x66a9('0x1b')](_0x137e9f);}return null;};}function patchUpdates(_0xb74b23){return function(_0x504c03){try{jsonpatch[_0x66a9('0x21')](_0x504c03,_0xb74b23,!![]);}catch(_0x596edc){return BPromise[_0x66a9('0x22')](_0x596edc);}return _0x504c03[_0x66a9('0x23')]();};}function saveUpdates(_0x5e9f52,_0x169e0b){return function(_0x7ac161){if(_0x7ac161){return _0x7ac161['update'](_0x5e9f52)['then'](function(_0x2a7d1c){return _0x2a7d1c;});}return null;};}function removeEntity(_0x51ea34,_0x2e8312){return function(_0x3fd60a){if(_0x3fd60a){return _0x3fd60a[_0x66a9('0x24')]()[_0x66a9('0x25')](function(){var _0x3aba4c=_0x3fd60a[_0x66a9('0x26')]({'plain':!![]});var _0x562ab8='ODBC';return db['UserProfileResource'][_0x66a9('0x24')]({'where':{'type':_0x562ab8,'resourceId':_0x3aba4c['id']}})[_0x66a9('0x25')](function(){return _0x3fd60a;});})[_0x66a9('0x25')](function(){_0x51ea34[_0x66a9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4349b3,_0x4a2086){return function(_0x37b066){if(!_0x37b066){_0x4349b3[_0x66a9('0x19')](0x194);}return _0x37b066;};}function handleError(_0x2d8d04,_0x36ea85){_0x36ea85=_0x36ea85||0x1f4;return function(_0x392401){logger[_0x66a9('0x27')](_0x392401[_0x66a9('0x28')]);if(_0x392401['name']){delete _0x392401[_0x66a9('0x29')];}_0x2d8d04[_0x66a9('0x1a')](_0x36ea85)[_0x66a9('0x2a')](_0x392401);};}exports[_0x66a9('0x2b')]=function(_0x24a8b8,_0x377d14){var _0x542b76={},_0x41e33f={},_0x19bc72={'count':0x0,'rows':[]};var _0x48fe02=_[_0x66a9('0x2c')](db[_0x66a9('0x2d')][_0x66a9('0x2e')],function(_0x31babe){return{'name':_0x31babe[_0x66a9('0x2f')],'type':_0x31babe[_0x66a9('0x30')][_0x66a9('0x31')]};});_0x41e33f[_0x66a9('0x32')]=_[_0x66a9('0x2c')](_0x48fe02,_0x66a9('0x29'));_0x41e33f['query']=_[_0x66a9('0x33')](_0x24a8b8[_0x66a9('0x34')]);_0x41e33f[_0x66a9('0x35')]=_[_0x66a9('0x36')](_0x41e33f[_0x66a9('0x32')],_0x41e33f[_0x66a9('0x34')]);_0x542b76['attributes']=_[_0x66a9('0x36')](_0x41e33f[_0x66a9('0x32')],qs[_0x66a9('0x37')](_0x24a8b8[_0x66a9('0x34')][_0x66a9('0x37')]));_0x542b76[_0x66a9('0x38')]=_0x542b76['attributes'][_0x66a9('0x39')]?_0x542b76[_0x66a9('0x38')]:_0x41e33f[_0x66a9('0x32')];if(!_0x24a8b8[_0x66a9('0x34')][_0x66a9('0x3a')](_0x66a9('0x3b'))){_0x542b76['limit']=qs['limit'](_0x24a8b8[_0x66a9('0x34')]['limit']);_0x542b76[_0x66a9('0x1c')]=qs[_0x66a9('0x1c')](_0x24a8b8[_0x66a9('0x34')][_0x66a9('0x1c')]);}_0x542b76[_0x66a9('0x3c')]=qs[_0x66a9('0x3d')](_0x24a8b8[_0x66a9('0x34')]['sort']);_0x542b76[_0x66a9('0x3e')]=qs['filters'](_[_0x66a9('0x3f')](_0x24a8b8[_0x66a9('0x34')],_0x41e33f[_0x66a9('0x35')]),_0x48fe02);if(_0x24a8b8[_0x66a9('0x34')][_0x66a9('0x40')]){_0x542b76[_0x66a9('0x3e')]=_[_0x66a9('0x41')](_0x542b76[_0x66a9('0x3e')],{'$or':_[_0x66a9('0x2c')](_0x48fe02,function(_0x4a232f){if(_0x4a232f[_0x66a9('0x30')]!==_0x66a9('0x42')){var _0x22b94c={};_0x22b94c[_0x4a232f['name']]={'$like':'%'+_0x24a8b8[_0x66a9('0x34')]['filter']+'%'};return _0x22b94c;}})});}_0x542b76=_[_0x66a9('0x41')]({},_0x542b76,_0x24a8b8[_0x66a9('0x43')]);var _0x25a6cd={'where':_0x542b76['where']};return db[_0x66a9('0x2d')]['count'](_0x25a6cd)[_0x66a9('0x25')](function(_0xaf1a05){_0x19bc72[_0x66a9('0x1e')]=_0xaf1a05;if(_0x24a8b8['query'][_0x66a9('0x44')]){_0x542b76[_0x66a9('0x45')]=[{'all':!![]}];}return db[_0x66a9('0x2d')][_0x66a9('0x46')](_0x542b76);})[_0x66a9('0x25')](function(_0x2772ea){_0x19bc72['rows']=_0x2772ea;return _0x19bc72;})['then'](respondWithFilteredResult(_0x377d14,_0x542b76))[_0x66a9('0x47')](handleError(_0x377d14,null));};exports[_0x66a9('0x48')]=function(_0x199f1f,_0x25347f){var _0x18754b={'raw':!![],'where':{'id':_0x199f1f[_0x66a9('0x49')]['id']}},_0x57e389={};_0x57e389[_0x66a9('0x32')]=_['keys'](db[_0x66a9('0x2d')][_0x66a9('0x2e')]);_0x57e389['query']=_[_0x66a9('0x33')](_0x199f1f[_0x66a9('0x34')]);_0x57e389[_0x66a9('0x35')]=_[_0x66a9('0x36')](_0x57e389[_0x66a9('0x32')],_0x57e389[_0x66a9('0x34')]);_0x18754b[_0x66a9('0x38')]=_[_0x66a9('0x36')](_0x57e389['model'],qs['fields'](_0x199f1f['query']['fields']));_0x18754b[_0x66a9('0x38')]=_0x18754b[_0x66a9('0x38')][_0x66a9('0x39')]?_0x18754b[_0x66a9('0x38')]:_0x57e389[_0x66a9('0x32')];if(_0x199f1f['query'][_0x66a9('0x44')]){_0x18754b['include']=[{'all':!![]}];}_0x18754b=_['merge']({},_0x18754b,_0x199f1f[_0x66a9('0x43')]);return db['SquareOdbc'][_0x66a9('0x4a')](_0x18754b)[_0x66a9('0x25')](handleEntityNotFound(_0x25347f,null))[_0x66a9('0x25')](respondWithResult(_0x25347f,null))[_0x66a9('0x47')](handleError(_0x25347f,null));};exports[_0x66a9('0x4b')]=function(_0x135e7d,_0x267e4a){return db['SquareOdbc'][_0x66a9('0x4b')](_0x135e7d[_0x66a9('0x4c')],{})[_0x66a9('0x25')](function(_0xa9fb99){var _0xfc7f59=_0x135e7d[_0x66a9('0x4d')]['get']({'plain':!![]});if(!_0xfc7f59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfc7f59[_0x66a9('0x4e')]==='user'){var _0x3c7352=_0xa9fb99[_0x66a9('0x26')]({'plain':!![]});var _0x50ef5=_0x66a9('0x4f');return db[_0x66a9('0x50')][_0x66a9('0x4a')]({'where':{'name':_0x50ef5,'userProfileId':_0xfc7f59[_0x66a9('0x51')]},'raw':!![]})[_0x66a9('0x25')](function(_0x3b1ede){if(_0x3b1ede&&_0x3b1ede[_0x66a9('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x3c7352[_0x66a9('0x29')],'resourceId':_0x3c7352['id'],'type':_0x3b1ede['name'],'sectionId':_0x3b1ede['id']},{})['then'](function(){return _0xa9fb99;});}else{return _0xa9fb99;}})['catch'](function(_0x2e20a8){logger[_0x66a9('0x27')](_0x66a9('0x53'),_0x2e20a8);throw _0x2e20a8;});}return _0xa9fb99;})[_0x66a9('0x25')](respondWithResult(_0x267e4a,0xc9))['catch'](handleError(_0x267e4a,null));};exports['update']=function(_0x3de332,_0x41ebfe){if(_0x3de332[_0x66a9('0x4c')]['id']){delete _0x3de332[_0x66a9('0x4c')]['id'];}return db[_0x66a9('0x2d')][_0x66a9('0x4a')]({'where':{'id':_0x3de332[_0x66a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x41ebfe,null))[_0x66a9('0x25')](saveUpdates(_0x3de332[_0x66a9('0x4c')],null))[_0x66a9('0x25')](respondWithResult(_0x41ebfe,null))['catch'](handleError(_0x41ebfe,null));};exports['destroy']=function(_0x125d2e,_0x27d6cc){return db[_0x66a9('0x2d')][_0x66a9('0x4a')]({'where':{'id':_0x125d2e[_0x66a9('0x49')]['id']}})[_0x66a9('0x25')](handleEntityNotFound(_0x27d6cc,null))[_0x66a9('0x25')](removeEntity(_0x27d6cc,null))[_0x66a9('0x47')](handleError(_0x27d6cc,null));};exports[_0x66a9('0x54')]=function(_0x53293e,_0x3f2f82,_0x5b25ef){var _0xf40715;return db[_0x66a9('0x2d')][_0x66a9('0x4a')]({'where':{'id':_0x53293e['params']['id']},'attributes':['id',_0x66a9('0x55')]})[_0x66a9('0x25')](handleEntityNotFound(_0x3f2f82,null))[_0x66a9('0x25')](function(_0xe41ebc){if(_0xe41ebc){var _0x22c0ea=require('odbc')();_0x22c0ea[_0x66a9('0x56')](_0xe41ebc[_0x66a9('0x55')]);_0x22c0ea[_0x66a9('0x57')]();return _0xe41ebc;}})[_0x66a9('0x25')](respondWithResult(_0x3f2f82,null))[_0x66a9('0x47')](handleError(_0x3f2f82,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 471bac7..4fd2339 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 _0xf4d4=['request-promise','rimraf','../../config/environment','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x51252f,_0x51a2fd){var _0x54b853=function(_0x45ab03){while(--_0x45ab03){_0x51252f['push'](_0x51252f['shift']());}};_0x54b853(++_0x51a2fd);}(_0xf4d4,0xae));var _0x4f4d=function(_0x453f54,_0x28ebf2){_0x453f54=_0x453f54-0x0;var _0x46f6cc=_0xf4d4[_0x453f54];return _0x46f6cc;};'use strict';var _=require(_0x4f4d('0x0'));var util=require(_0x4f4d('0x1'));var logger=require(_0x4f4d('0x2'))(_0x4f4d('0x3'));var moment=require(_0x4f4d('0x4'));var BPromise=require(_0x4f4d('0x5'));var rp=require(_0x4f4d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f4d('0x7'));var config=require(_0x4f4d('0x8'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x136d5d,_0x44165a){return _0x136d5d[_0x4f4d('0x9')](_0x4f4d('0xa'),attributes,{'tableName':_0x4f4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x658a=['define','square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x511c89,_0x3c03be){var _0x36810d=function(_0x1200b4){while(--_0x1200b4){_0x511c89['push'](_0x511c89['shift']());}};_0x36810d(++_0x3c03be);}(_0x658a,0x14c));var _0xa658=function(_0x118012,_0x5b20db){_0x118012=_0x118012-0x0;var _0xf8c0d3=_0x658a[_0x118012];return _0xf8c0d3;};'use strict';var _=require(_0xa658('0x0'));var util=require(_0xa658('0x1'));var logger=require(_0xa658('0x2'))(_0xa658('0x3'));var moment=require('moment');var BPromise=require(_0xa658('0x4'));var rp=require(_0xa658('0x5'));var fs=require('fs');var path=require(_0xa658('0x6'));var rimraf=require(_0xa658('0x7'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x18ab52,_0x410063){return _0x18ab52[_0xa658('0x8')]('SquareOdbc',attributes,{'tableName':_0xa658('0x9'),'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 b90d908..ec5dea2 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 _0x9fa2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model','attributes','then'];(function(_0x4859ff,_0x1b0362){var _0x446603=function(_0x4d81a8){while(--_0x4d81a8){_0x4859ff['push'](_0x4859ff['shift']());}};_0x446603(++_0x1b0362);}(_0x9fa2,0x120));var _0x29fa=function(_0x33be9d,_0x41618e){_0x33be9d=_0x33be9d-0x0;var _0x4a9267=_0x9fa2[_0x33be9d];return _0x4a9267;};'use strict';var _=require('lodash');var util=require(_0x29fa('0x0'));var moment=require(_0x29fa('0x1'));var BPromise=require(_0x29fa('0x2'));var rs=require(_0x29fa('0x3'));var fs=require('fs');var Redis=require(_0x29fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29fa('0x5'));var logger=require('../../config/logger')(_0x29fa('0x6'));var config=require('../../config/environment');var jayson=require(_0x29fa('0x7'));var client=jayson[_0x29fa('0x8')][_0x29fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147b99,_0x4c7293,_0x544a12){return new BPromise(function(_0x24900b,_0x1a8355){return client[_0x29fa('0xa')](_0x147b99,_0x544a12)['then'](function(_0x38732e){logger[_0x29fa('0xb')](_0x29fa('0xc'),_0x4c7293,_0x29fa('0xd'));logger[_0x29fa('0xe')](_0x29fa('0xf'),_0x4c7293,'request\x20sent',JSON[_0x29fa('0x10')](_0x38732e));if(_0x38732e[_0x29fa('0x11')]){if(_0x38732e[_0x29fa('0x11')][_0x29fa('0x12')]===0x1f4){logger['error'](_0x29fa('0xc'),_0x4c7293,_0x38732e['error'][_0x29fa('0x13')]);return _0x1a8355(_0x38732e[_0x29fa('0x11')][_0x29fa('0x13')]);}logger['error'](_0x29fa('0xc'),_0x4c7293,_0x38732e[_0x29fa('0x11')][_0x29fa('0x13')]);return _0x24900b(_0x38732e[_0x29fa('0x11')][_0x29fa('0x13')]);}else{logger[_0x29fa('0xb')](_0x29fa('0xc'),_0x4c7293,_0x29fa('0xd'));_0x24900b(_0x38732e['result'][_0x29fa('0x13')]);}})[_0x29fa('0x14')](function(_0x55be87){logger[_0x29fa('0x11')](_0x29fa('0xc'),_0x4c7293,_0x55be87);_0x1a8355(_0x55be87);});});}exports[_0x29fa('0x15')]=function(_0x5db485){var _0x107edc=this;return new Promise(function(_0x45af71,_0x32e214){return db[_0x29fa('0x16')][_0x29fa('0x17')]({'raw':_0x5db485[_0x29fa('0x18')]?_0x5db485[_0x29fa('0x18')][_0x29fa('0x19')]===undefined?!![]:![]:!![],'where':_0x5db485[_0x29fa('0x18')]?_0x5db485[_0x29fa('0x18')][_0x29fa('0x1a')]||null:null,'attributes':_0x5db485['options']?_0x5db485['options']['attributes']||null:null,'include':_0x5db485['options']?_0x5db485[_0x29fa('0x18')][_0x29fa('0x1b')]?_[_0x29fa('0x1c')](_0x5db485[_0x29fa('0x18')][_0x29fa('0x1b')],function(_0x160713){return{'model':db[_0x160713[_0x29fa('0x1d')]],'as':_0x160713['as'],'attributes':_0x160713[_0x29fa('0x1e')],'include':_0x160713['include']?_[_0x29fa('0x1c')](_0x160713[_0x29fa('0x1b')],function(_0x59e206){return{'model':db[_0x59e206[_0x29fa('0x1d')]],'as':_0x59e206['as'],'attributes':_0x59e206['attributes'],'include':_0x59e206[_0x29fa('0x1b')]?_[_0x29fa('0x1c')](_0x59e206[_0x29fa('0x1b')],function(_0x518522){return{'model':db[_0x518522[_0x29fa('0x1d')]],'as':_0x518522['as'],'attributes':_0x518522['attributes']};}):[]};}):[]};}):[]:[]})[_0x29fa('0x1f')](function(_0x5aa663){logger['info']('ShowSquareOdbc',_0x5db485);logger[_0x29fa('0xe')](_0x29fa('0x15'),_0x5db485,JSON[_0x29fa('0x10')](_0x5aa663));_0x45af71(_0x5aa663);})[_0x29fa('0x14')](function(_0x2090e5){logger[_0x29fa('0x11')](_0x29fa('0x15'),_0x2090e5[_0x29fa('0x13')],_0x5db485);_0x32e214(_0x107edc['error'](0x1f4,_0x2090e5[_0x29fa('0x13')]));});});}; \ No newline at end of file +var _0x209b=['ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','SquareOdbc','find','options','raw','where','map','include','attributes','model','then','info'];(function(_0x2f1579,_0x451ff9){var _0x4af2fd=function(_0x1ed616){while(--_0x1ed616){_0x2f1579['push'](_0x2f1579['shift']());}};_0x4af2fd(++_0x451ff9);}(_0x209b,0x89));var _0xb209=function(_0x379b0f,_0x1c3fd3){_0x379b0f=_0x379b0f-0x0;var _0x1175d0=_0x209b[_0x379b0f];return _0x1175d0;};'use strict';var _=require(_0xb209('0x0'));var util=require(_0xb209('0x1'));var moment=require(_0xb209('0x2'));var BPromise=require(_0xb209('0x3'));var rs=require(_0xb209('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb209('0x5'));var logger=require(_0xb209('0x6'))(_0xb209('0x7'));var config=require(_0xb209('0x8'));var jayson=require(_0xb209('0x9'));var client=jayson[_0xb209('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48dfcb,_0x515b1e,_0x1b6bde){return new BPromise(function(_0x28e7fa,_0x59e5f3){return client[_0xb209('0xb')](_0x48dfcb,_0x1b6bde)['then'](function(_0x1cf5e1){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x515b1e,_0xb209('0xc'));logger[_0xb209('0xd')](_0xb209('0xe'),_0x515b1e,'request\x20sent',JSON[_0xb209('0xf')](_0x1cf5e1));if(_0x1cf5e1[_0xb209('0x10')]){if(_0x1cf5e1[_0xb209('0x10')][_0xb209('0x11')]===0x1f4){logger[_0xb209('0x10')](_0xb209('0x12'),_0x515b1e,_0x1cf5e1[_0xb209('0x10')][_0xb209('0x13')]);return _0x59e5f3(_0x1cf5e1['error']['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x515b1e,_0x1cf5e1[_0xb209('0x10')][_0xb209('0x13')]);return _0x28e7fa(_0x1cf5e1[_0xb209('0x10')][_0xb209('0x13')]);}else{logger['info'](_0xb209('0x12'),_0x515b1e,'request\x20sent');_0x28e7fa(_0x1cf5e1[_0xb209('0x14')][_0xb209('0x13')]);}})[_0xb209('0x15')](function(_0x39634e){logger[_0xb209('0x10')](_0xb209('0x12'),_0x515b1e,_0x39634e);_0x59e5f3(_0x39634e);});});}exports['ShowSquareOdbc']=function(_0x82bf4f){var _0x1a6f3c=this;return new Promise(function(_0x4a3bf1,_0x2d1dbd){return db[_0xb209('0x16')][_0xb209('0x17')]({'raw':_0x82bf4f[_0xb209('0x18')]?_0x82bf4f[_0xb209('0x18')][_0xb209('0x19')]===undefined?!![]:![]:!![],'where':_0x82bf4f[_0xb209('0x18')]?_0x82bf4f[_0xb209('0x18')][_0xb209('0x1a')]||null:null,'attributes':_0x82bf4f[_0xb209('0x18')]?_0x82bf4f[_0xb209('0x18')]['attributes']||null:null,'include':_0x82bf4f[_0xb209('0x18')]?_0x82bf4f[_0xb209('0x18')]['include']?_[_0xb209('0x1b')](_0x82bf4f[_0xb209('0x18')][_0xb209('0x1c')],function(_0x3afa6f){return{'model':db[_0x3afa6f['model']],'as':_0x3afa6f['as'],'attributes':_0x3afa6f[_0xb209('0x1d')],'include':_0x3afa6f[_0xb209('0x1c')]?_[_0xb209('0x1b')](_0x3afa6f[_0xb209('0x1c')],function(_0x5914e1){return{'model':db[_0x5914e1[_0xb209('0x1e')]],'as':_0x5914e1['as'],'attributes':_0x5914e1[_0xb209('0x1d')],'include':_0x5914e1[_0xb209('0x1c')]?_['map'](_0x5914e1['include'],function(_0x5474d8){return{'model':db[_0x5474d8[_0xb209('0x1e')]],'as':_0x5474d8['as'],'attributes':_0x5474d8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb209('0x1f')](function(_0x43a396){logger[_0xb209('0x20')](_0xb209('0x21'),_0x82bf4f);logger[_0xb209('0xd')](_0xb209('0x21'),_0x82bf4f,JSON[_0xb209('0xf')](_0x43a396));_0x4a3bf1(_0x43a396);})['catch'](function(_0x5a8371){logger['error']('ShowSquareOdbc',_0x5a8371['message'],_0x82bf4f);_0x2d1dbd(_0x1a6f3c[_0xb209('0x10')](0x1f4,_0x5a8371[_0xb209('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 03cdcd2..4d9eb54 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 _0xd157=['post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x346fd9,_0x105fa8){var _0xa84be=function(_0x14ab15){while(--_0x14ab15){_0x346fd9['push'](_0x346fd9['shift']());}};_0xa84be(++_0x105fa8);}(_0xd157,0x1af));var _0x7d15=function(_0x544419,_0x37287e){_0x544419=_0x544419-0x0;var _0x328b19=_0xd157[_0x544419];return _0x328b19;};'use strict';var multer=require(_0x7d15('0x0'));var util=require('util');var path=require(_0x7d15('0x1'));var timeout=require(_0x7d15('0x2'));var express=require('express');var router=express[_0x7d15('0x3')]();var fs_extra=require(_0x7d15('0x4'));var auth=require(_0x7d15('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d15('0x6'));var controller=require('./squareProject.controller');router[_0x7d15('0x7')]('/',auth[_0x7d15('0x8')](),controller[_0x7d15('0x9')]);router[_0x7d15('0x7')](_0x7d15('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7d15('0xb')]('/',auth[_0x7d15('0x8')](),controller[_0x7d15('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7d15('0xd')]);router[_0x7d15('0xe')](_0x7d15('0xa'),auth[_0x7d15('0x8')](),controller[_0x7d15('0xf')]);module[_0x7d15('0x10')]=router; \ No newline at end of file +var _0xace3=['/:id','show','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index'];(function(_0x2ab2cc,_0xe88512){var _0x4f89f6=function(_0x3f6e6c){while(--_0x3f6e6c){_0x2ab2cc['push'](_0x2ab2cc['shift']());}};_0x4f89f6(++_0xe88512);}(_0xace3,0x96));var _0x3ace=function(_0x3e19b1,_0x13a94a){_0x3e19b1=_0x3e19b1-0x0;var _0x55a5a7=_0xace3[_0x3e19b1];return _0x55a5a7;};'use strict';var multer=require(_0x3ace('0x0'));var util=require(_0x3ace('0x1'));var path=require(_0x3ace('0x2'));var timeout=require(_0x3ace('0x3'));var express=require(_0x3ace('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3ace('0x5'));var interaction=require(_0x3ace('0x6'));var config=require(_0x3ace('0x7'));var controller=require(_0x3ace('0x8'));router[_0x3ace('0x9')]('/',auth[_0x3ace('0xa')](),controller[_0x3ace('0xb')]);router['get'](_0x3ace('0xc'),auth['isAuthenticated'](),controller[_0x3ace('0xd')]);router['post']('/',auth[_0x3ace('0xa')](),controller['create']);router[_0x3ace('0xe')](_0x3ace('0xc'),auth[_0x3ace('0xa')](),controller[_0x3ace('0xf')]);router['delete']('/:id',auth[_0x3ace('0xa')](),controller[_0x3ace('0x10')]);module[_0x3ace('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4902894..4b01d6a 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 _0x8014=['production','toString','DATE','sequelize','STRING','name','BLOB','long','getDataValue','preproduction','utf8'];(function(_0x1f9ca4,_0x3276ff){var _0xfedbdd=function(_0x2da635){while(--_0x2da635){_0x1f9ca4['push'](_0x1f9ca4['shift']());}};_0xfedbdd(++_0x3276ff);}(_0x8014,0x163));var _0x4801=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x8014[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0x4801('0x0'));module['exports']={'name':{'type':Sequelize[_0x4801('0x1')],'unique':_0x4801('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4801('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x4801('0x3')](_0x4801('0x4')),'get':function(){if(this[_0x4801('0x5')](_0x4801('0x6'))){return this['getDataValue'](_0x4801('0x6'))['toString'](_0x4801('0x7'));}}},'production':{'type':Sequelize[_0x4801('0x3')]('long'),'get':function(){if(this[_0x4801('0x5')](_0x4801('0x8'))){return this[_0x4801('0x5')](_0x4801('0x8'))[_0x4801('0x9')](_0x4801('0x7'));}}},'savedAt':{'type':Sequelize[_0x4801('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x9147=['name','TEXT','BLOB','getDataValue','preproduction','toString','production','utf8','DATE','sequelize','exports','STRING'];(function(_0x4b33ff,_0x34193c){var _0x24c2f7=function(_0x2e4e49){while(--_0x2e4e49){_0x4b33ff['push'](_0x4b33ff['shift']());}};_0x24c2f7(++_0x34193c);}(_0x9147,0x81));var _0x7914=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x9147[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x7914('0x0'));module[_0x7914('0x1')]={'name':{'type':Sequelize[_0x7914('0x2')],'unique':_0x7914('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7914('0x2')]},'notes':{'type':Sequelize[_0x7914('0x4')]},'preproduction':{'type':Sequelize[_0x7914('0x5')]('long'),'get':function(){if(this[_0x7914('0x6')](_0x7914('0x7'))){return this[_0x7914('0x6')](_0x7914('0x7'))[_0x7914('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x7914('0x5')]('long'),'get':function(){if(this[_0x7914('0x6')]('production')){return this['getDataValue'](_0x7914('0x9'))[_0x7914('0x8')](_0x7914('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x7914('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index add9086..8d3ff17 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 _0xeccc=['stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','status','json','offset','limit','count','set','Content-Range','then','destroy','get','SquareProjects','publish','agi','end','sendStatus','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SquareProject','includeAll','include','findAll','rows','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','update','body'];(function(_0x202b44,_0x5addf7){var _0x12139d=function(_0x52f7a9){while(--_0x52f7a9){_0x202b44['push'](_0x202b44['shift']());}};_0x12139d(++_0x5addf7);}(_0xeccc,0xd6));var _0xcecc=function(_0x4f3242,_0x391954){_0x4f3242=_0x4f3242-0x0;var _0x49844f=_0xeccc[_0x4f3242];return _0x49844f;};'use strict';var _=require(_0xcecc('0x0'));var Redis=require(_0xcecc('0x1'));var qs=require(_0xcecc('0x2'));var logger=require(_0xcecc('0x3'))('api');var config=require(_0xcecc('0x4'));var db=require(_0xcecc('0x5'))['db'];config['redis']=_['defaults'](config[_0xcecc('0x6')],{'host':_0xcecc('0x7'),'port':0x18eb});var socket=require(_0xcecc('0x8'))(new Redis(config[_0xcecc('0x6')]));require(_0xcecc('0x9'))['register'](socket);function respondWithResult(_0x21d743,_0x3617f3){_0x3617f3=_0x3617f3||0xc8;return function(_0xc9622b){if(_0xc9622b){return _0x21d743[_0xcecc('0xa')](_0x3617f3)[_0xcecc('0xb')](_0xc9622b);}};}function respondWithFilteredResult(_0x3a2212,_0x5f0d61){return function(_0x1aa10d){if(_0x1aa10d){var _0xfd141a=typeof _0x5f0d61[_0xcecc('0xc')]==='undefined'&&typeof _0x5f0d61[_0xcecc('0xd')]==='undefined';var _0xe53336=_0x1aa10d['count'];var _0x2535aa=_0xfd141a?0x0:_0x5f0d61[_0xcecc('0xc')];var _0x298ad7=_0xfd141a?_0x1aa10d[_0xcecc('0xe')]:_0x5f0d61['offset']+_0x5f0d61[_0xcecc('0xd')];var _0x3b5492;if(_0x298ad7>=_0xe53336){_0x298ad7=_0xe53336;_0x3b5492=0xc8;}else{_0x3b5492=0xce;}_0x3a2212[_0xcecc('0xa')](_0x3b5492);return _0x3a2212[_0xcecc('0xf')](_0xcecc('0x10'),_0x2535aa+'-'+_0x298ad7+'/'+_0xe53336)[_0xcecc('0xb')](_0x1aa10d);}return null;};}function saveUpdates(_0x2c70e4){return function(_0x503ff8){if(_0x503ff8){return _0x503ff8['update'](_0x2c70e4)[_0xcecc('0x11')](function(_0x36ea71){return _0x36ea71;});}return null;};}function removeEntity(_0x3eff20){return function(_0x3a9b61){if(_0x3a9b61){return _0x3a9b61[_0xcecc('0x12')]()[_0xcecc('0x11')](function(){var _0x272da9=_0x3a9b61[_0xcecc('0x13')]({'plain':!![]});var _0x4fc17b=_0xcecc('0x14');return db['UserProfileResource'][_0xcecc('0x12')]({'where':{'type':_0x4fc17b,'resourceId':_0x272da9['id']}})[_0xcecc('0x11')](function(){return _0x3a9b61;});})[_0xcecc('0x11')](function(){var _0x4fbd93=new Redis(config['redis']);_0x4fbd93[_0xcecc('0x15')](_0xcecc('0x16'),JSON['stringify']({'id':_0x3a9b61['id'],'deleted':!![]}));})[_0xcecc('0x11')](function(){_0x3eff20[_0xcecc('0xa')](0xcc)[_0xcecc('0x17')]();});}};}function handleEntityNotFound(_0x40579b){return function(_0x525363){if(!_0x525363){_0x40579b[_0xcecc('0x18')](0x194);}return _0x525363;};}function handleError(_0x1cbf49,_0x34fc48){_0x34fc48=_0x34fc48||0x1f4;return function(_0x6f809){logger[_0xcecc('0x19')](_0x6f809[_0xcecc('0x1a')]);if(_0x6f809[_0xcecc('0x1b')]){delete _0x6f809['name'];}_0x1cbf49[_0xcecc('0xa')](_0x34fc48)[_0xcecc('0x1c')](_0x6f809);};}exports['index']=function(_0x57ef8f,_0x305718){var _0x55ee47={},_0x438c6c={},_0x446880={'count':0x0,'rows':[]};var _0x485867=_['map'](db['SquareProject'][_0xcecc('0x1d')],function(_0x164854){return{'name':_0x164854[_0xcecc('0x1e')],'type':_0x164854['type'][_0xcecc('0x1f')]};});_0x438c6c[_0xcecc('0x20')]=_[_0xcecc('0x21')](_0x485867,_0xcecc('0x1b'));_0x438c6c[_0xcecc('0x22')]=_[_0xcecc('0x23')](_0x57ef8f[_0xcecc('0x22')]);_0x438c6c[_0xcecc('0x24')]=_[_0xcecc('0x25')](_0x438c6c[_0xcecc('0x20')],_0x438c6c[_0xcecc('0x22')]);_0x55ee47['attributes']=_[_0xcecc('0x25')](_0x438c6c['model'],qs[_0xcecc('0x26')](_0x57ef8f[_0xcecc('0x22')]['fields']));_0x55ee47['attributes']=_0x55ee47[_0xcecc('0x27')][_0xcecc('0x28')]?_0x55ee47['attributes']:_0x438c6c[_0xcecc('0x20')];if(!_0x57ef8f[_0xcecc('0x22')]['hasOwnProperty'](_0xcecc('0x29'))){_0x55ee47[_0xcecc('0xd')]=qs[_0xcecc('0xd')](_0x57ef8f['query'][_0xcecc('0xd')]);_0x55ee47['offset']=qs[_0xcecc('0xc')](_0x57ef8f[_0xcecc('0x22')][_0xcecc('0xc')]);}_0x55ee47[_0xcecc('0x2a')]=qs[_0xcecc('0x2b')](_0x57ef8f[_0xcecc('0x22')]['sort']);_0x55ee47[_0xcecc('0x2c')]=qs[_0xcecc('0x24')](_[_0xcecc('0x2d')](_0x57ef8f[_0xcecc('0x22')],_0x438c6c[_0xcecc('0x24')]),_0x485867);if(_0x57ef8f[_0xcecc('0x22')]['filter']){_0x55ee47['where']=_[_0xcecc('0x2e')](_0x55ee47[_0xcecc('0x2c')],{'$or':_[_0xcecc('0x21')](_0x485867,function(_0x5a5bfc){if(_0x5a5bfc[_0xcecc('0x2f')]!==_0xcecc('0x30')){var _0x38935a={};_0x38935a[_0x5a5bfc[_0xcecc('0x1b')]]={'$like':'%'+_0x57ef8f['query'][_0xcecc('0x31')]+'%'};return _0x38935a;}})});}_0x55ee47=_[_0xcecc('0x2e')]({},_0x55ee47,_0x57ef8f[_0xcecc('0x32')]);var _0x1c179e={'where':_0x55ee47[_0xcecc('0x2c')]};return db[_0xcecc('0x33')][_0xcecc('0xe')](_0x1c179e)[_0xcecc('0x11')](function(_0x4219dd){_0x446880[_0xcecc('0xe')]=_0x4219dd;if(_0x57ef8f[_0xcecc('0x22')][_0xcecc('0x34')]){_0x55ee47[_0xcecc('0x35')]=[{'all':!![]}];}return db['SquareProject'][_0xcecc('0x36')](_0x55ee47);})[_0xcecc('0x11')](function(_0x4c2038){_0x446880[_0xcecc('0x37')]=_0x4c2038;return _0x446880;})[_0xcecc('0x11')](respondWithFilteredResult(_0x305718,_0x55ee47))['catch'](handleError(_0x305718,null));};exports[_0xcecc('0x38')]=function(_0xdead15,_0x400d6d){var _0x496a3c={'raw':![],'where':{'id':_0xdead15[_0xcecc('0x39')]['id']}},_0x53ed57={};_0x53ed57[_0xcecc('0x20')]=_['keys'](db[_0xcecc('0x33')]['rawAttributes']);_0x53ed57[_0xcecc('0x22')]=_['keys'](_0xdead15[_0xcecc('0x22')]);_0x53ed57[_0xcecc('0x24')]=_[_0xcecc('0x25')](_0x53ed57[_0xcecc('0x20')],_0x53ed57[_0xcecc('0x22')]);_0x496a3c[_0xcecc('0x27')]=_[_0xcecc('0x25')](_0x53ed57[_0xcecc('0x20')],qs[_0xcecc('0x26')](_0xdead15[_0xcecc('0x22')][_0xcecc('0x26')]));_0x496a3c[_0xcecc('0x27')]=_0x496a3c[_0xcecc('0x27')][_0xcecc('0x28')]?_0x496a3c['attributes']:_0x53ed57[_0xcecc('0x20')];if(_0xdead15['query'][_0xcecc('0x34')]){_0x496a3c[_0xcecc('0x35')]=[{'all':!![]}];}_0x496a3c=_[_0xcecc('0x2e')]({},_0x496a3c,_0xdead15['options']);return db['SquareProject']['find'](_0x496a3c)[_0xcecc('0x11')](handleEntityNotFound(_0x400d6d,null))[_0xcecc('0x11')](respondWithResult(_0x400d6d,null))['catch'](handleError(_0x400d6d,null));};exports[_0xcecc('0x3a')]=function(_0x1031a3,_0x1d63f8){return db[_0xcecc('0x33')][_0xcecc('0x3a')](_0x1031a3['body'],{})['then'](function(_0x232dce){var _0x1dc322=_0x1031a3[_0xcecc('0x3b')][_0xcecc('0x13')]({'plain':!![]});if(!_0x1dc322)throw new Error(_0xcecc('0x3c'));if(_0x1dc322[_0xcecc('0x3d')]===_0xcecc('0x3b')){var _0x1483eb=_0x232dce[_0xcecc('0x13')]({'plain':!![]});var _0x573069=_0xcecc('0x14');return db[_0xcecc('0x3e')][_0xcecc('0x3f')]({'where':{'name':_0x573069,'userProfileId':_0x1dc322[_0xcecc('0x40')]},'raw':!![]})[_0xcecc('0x11')](function(_0x2c8acf){if(_0x2c8acf&&_0x2c8acf[_0xcecc('0x41')]===0x0){return db[_0xcecc('0x42')][_0xcecc('0x3a')]({'name':_0x1483eb[_0xcecc('0x1b')],'resourceId':_0x1483eb['id'],'type':_0x2c8acf[_0xcecc('0x1b')],'sectionId':_0x2c8acf['id']},{})['then'](function(){return _0x232dce;});}else{return _0x232dce;}})['catch'](function(_0x13296d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13296d);throw _0x13296d;});}return _0x232dce;})[_0xcecc('0x11')](respondWithResult(_0x1d63f8,0xc9))[_0xcecc('0x43')](handleError(_0x1d63f8,null));};exports[_0xcecc('0x44')]=function(_0x260852,_0x299bf6){if(_0x260852[_0xcecc('0x45')]['id']){delete _0x260852[_0xcecc('0x45')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x260852['params']['id']}})[_0xcecc('0x11')](handleEntityNotFound(_0x299bf6,null))['then'](saveUpdates(_0x260852[_0xcecc('0x45')],null))['then'](function(_0xb7bd89){if(!_0xb7bd89)return;var _0x22a09a=_0xb7bd89[_0xcecc('0x13')]({'plain':!![]});return _0x22a09a;})[_0xcecc('0x11')](function(_0x30a5a5){var _0xf69089=new Redis(config['redis']);_0xf69089[_0xcecc('0x15')]('agi',JSON[_0xcecc('0x46')](_[_0xcecc('0x2d')](_0x30a5a5,['id',_0xcecc('0x1b'),'production'])));return _0x30a5a5;})[_0xcecc('0x11')](respondWithResult(_0x299bf6,null))[_0xcecc('0x43')](handleError(_0x299bf6,null));};exports[_0xcecc('0x12')]=function(_0x5150fb,_0x40d014){return db[_0xcecc('0x33')][_0xcecc('0x3f')]({'where':{'id':_0x5150fb[_0xcecc('0x39')]['id']}})['then'](handleEntityNotFound(_0x40d014,null))['then'](removeEntity(_0x40d014,null))[_0xcecc('0x43')](handleError(_0x40d014,null));}; \ No newline at end of file +var _0x925b=['redis','localhost','socket.io-emitter','status','json','undefined','limit','count','offset','set','update','then','destroy','get','UserProfileResource','publish','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x925b,0x1b4));var _0xb925=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x925b[_0x4350c2];return _0x8b6406;};'use strict';var _=require(_0xb925('0x0'));var Redis=require(_0xb925('0x1'));var qs=require(_0xb925('0x2'));var logger=require(_0xb925('0x3'))(_0xb925('0x4'));var config=require(_0xb925('0x5'));var db=require(_0xb925('0x6'))['db'];config['redis']=_[_0xb925('0x7')](config[_0xb925('0x8')],{'host':_0xb925('0x9'),'port':0x18eb});var socket=require(_0xb925('0xa'))(new Redis(config[_0xb925('0x8')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x3cee96,_0x43de44){_0x43de44=_0x43de44||0xc8;return function(_0x4e4049){if(_0x4e4049){return _0x3cee96[_0xb925('0xb')](_0x43de44)[_0xb925('0xc')](_0x4e4049);}};}function respondWithFilteredResult(_0x3b7d1e,_0x58cbc7){return function(_0x49ab49){if(_0x49ab49){var _0x1a5b25=typeof _0x58cbc7['offset']===_0xb925('0xd')&&typeof _0x58cbc7[_0xb925('0xe')]===_0xb925('0xd');var _0x22f69f=_0x49ab49[_0xb925('0xf')];var _0x3e5206=_0x1a5b25?0x0:_0x58cbc7[_0xb925('0x10')];var _0x1fbd4c=_0x1a5b25?_0x49ab49[_0xb925('0xf')]:_0x58cbc7[_0xb925('0x10')]+_0x58cbc7['limit'];var _0x398e6b;if(_0x1fbd4c>=_0x22f69f){_0x1fbd4c=_0x22f69f;_0x398e6b=0xc8;}else{_0x398e6b=0xce;}_0x3b7d1e[_0xb925('0xb')](_0x398e6b);return _0x3b7d1e[_0xb925('0x11')]('Content-Range',_0x3e5206+'-'+_0x1fbd4c+'/'+_0x22f69f)[_0xb925('0xc')](_0x49ab49);}return null;};}function saveUpdates(_0x383d1b){return function(_0x59fed5){if(_0x59fed5){return _0x59fed5[_0xb925('0x12')](_0x383d1b)[_0xb925('0x13')](function(_0x5d6132){return _0x5d6132;});}return null;};}function removeEntity(_0x3a7fee){return function(_0x37ce17){if(_0x37ce17){return _0x37ce17[_0xb925('0x14')]()[_0xb925('0x13')](function(){var _0x118083=_0x37ce17[_0xb925('0x15')]({'plain':!![]});var _0x5142b9='SquareProjects';return db[_0xb925('0x16')][_0xb925('0x14')]({'where':{'type':_0x5142b9,'resourceId':_0x118083['id']}})[_0xb925('0x13')](function(){return _0x37ce17;});})['then'](function(){var _0xd293da=new Redis(config[_0xb925('0x8')]);_0xd293da[_0xb925('0x17')]('agi',JSON['stringify']({'id':_0x37ce17['id'],'deleted':!![]}));})['then'](function(){_0x3a7fee[_0xb925('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb86e36){return function(_0x38db12){if(!_0x38db12){_0xb86e36[_0xb925('0x18')](0x194);}return _0x38db12;};}function handleError(_0xa82c7,_0x46ced5){_0x46ced5=_0x46ced5||0x1f4;return function(_0x766b9f){logger[_0xb925('0x19')](_0x766b9f[_0xb925('0x1a')]);if(_0x766b9f['name']){delete _0x766b9f[_0xb925('0x1b')];}_0xa82c7[_0xb925('0xb')](_0x46ced5)[_0xb925('0x1c')](_0x766b9f);};}exports[_0xb925('0x1d')]=function(_0x37fb47,_0x237da8){var _0x56c224={},_0x52994c={},_0x3929d7={'count':0x0,'rows':[]};var _0x1602df=_[_0xb925('0x1e')](db[_0xb925('0x1f')][_0xb925('0x20')],function(_0x44c25d){return{'name':_0x44c25d[_0xb925('0x21')],'type':_0x44c25d['type'][_0xb925('0x22')]};});_0x52994c[_0xb925('0x23')]=_[_0xb925('0x1e')](_0x1602df,_0xb925('0x1b'));_0x52994c['query']=_[_0xb925('0x24')](_0x37fb47['query']);_0x52994c['filters']=_[_0xb925('0x25')](_0x52994c[_0xb925('0x23')],_0x52994c[_0xb925('0x26')]);_0x56c224[_0xb925('0x27')]=_['intersection'](_0x52994c[_0xb925('0x23')],qs[_0xb925('0x28')](_0x37fb47[_0xb925('0x26')][_0xb925('0x28')]));_0x56c224[_0xb925('0x27')]=_0x56c224[_0xb925('0x27')][_0xb925('0x29')]?_0x56c224[_0xb925('0x27')]:_0x52994c[_0xb925('0x23')];if(!_0x37fb47[_0xb925('0x26')][_0xb925('0x2a')](_0xb925('0x2b'))){_0x56c224[_0xb925('0xe')]=qs[_0xb925('0xe')](_0x37fb47['query']['limit']);_0x56c224[_0xb925('0x10')]=qs[_0xb925('0x10')](_0x37fb47['query'][_0xb925('0x10')]);}_0x56c224[_0xb925('0x2c')]=qs[_0xb925('0x2d')](_0x37fb47[_0xb925('0x26')][_0xb925('0x2d')]);_0x56c224[_0xb925('0x2e')]=qs[_0xb925('0x2f')](_[_0xb925('0x30')](_0x37fb47[_0xb925('0x26')],_0x52994c[_0xb925('0x2f')]),_0x1602df);if(_0x37fb47[_0xb925('0x26')][_0xb925('0x31')]){_0x56c224[_0xb925('0x2e')]=_[_0xb925('0x32')](_0x56c224[_0xb925('0x2e')],{'$or':_[_0xb925('0x1e')](_0x1602df,function(_0x115143){if(_0x115143[_0xb925('0x33')]!==_0xb925('0x34')){var _0x59b8fd={};_0x59b8fd[_0x115143[_0xb925('0x1b')]]={'$like':'%'+_0x37fb47[_0xb925('0x26')]['filter']+'%'};return _0x59b8fd;}})});}_0x56c224=_[_0xb925('0x32')]({},_0x56c224,_0x37fb47[_0xb925('0x35')]);var _0x305fc0={'where':_0x56c224[_0xb925('0x2e')]};return db[_0xb925('0x1f')]['count'](_0x305fc0)['then'](function(_0x437335){_0x3929d7[_0xb925('0xf')]=_0x437335;if(_0x37fb47[_0xb925('0x26')][_0xb925('0x36')]){_0x56c224[_0xb925('0x37')]=[{'all':!![]}];}return db['SquareProject'][_0xb925('0x38')](_0x56c224);})[_0xb925('0x13')](function(_0x906947){_0x3929d7[_0xb925('0x39')]=_0x906947;return _0x3929d7;})[_0xb925('0x13')](respondWithFilteredResult(_0x237da8,_0x56c224))['catch'](handleError(_0x237da8,null));};exports[_0xb925('0x3a')]=function(_0x23f82a,_0x52c655){var _0x305018={'raw':![],'where':{'id':_0x23f82a[_0xb925('0x3b')]['id']}},_0x1574af={};_0x1574af[_0xb925('0x23')]=_[_0xb925('0x24')](db[_0xb925('0x1f')][_0xb925('0x20')]);_0x1574af[_0xb925('0x26')]=_[_0xb925('0x24')](_0x23f82a['query']);_0x1574af[_0xb925('0x2f')]=_[_0xb925('0x25')](_0x1574af[_0xb925('0x23')],_0x1574af[_0xb925('0x26')]);_0x305018[_0xb925('0x27')]=_[_0xb925('0x25')](_0x1574af[_0xb925('0x23')],qs[_0xb925('0x28')](_0x23f82a[_0xb925('0x26')][_0xb925('0x28')]));_0x305018[_0xb925('0x27')]=_0x305018[_0xb925('0x27')]['length']?_0x305018[_0xb925('0x27')]:_0x1574af[_0xb925('0x23')];if(_0x23f82a[_0xb925('0x26')]['includeAll']){_0x305018[_0xb925('0x37')]=[{'all':!![]}];}_0x305018=_['merge']({},_0x305018,_0x23f82a['options']);return db['SquareProject'][_0xb925('0x3c')](_0x305018)['then'](handleEntityNotFound(_0x52c655,null))['then'](respondWithResult(_0x52c655,null))[_0xb925('0x3d')](handleError(_0x52c655,null));};exports[_0xb925('0x3e')]=function(_0xd20b7b,_0x2c002c){return db[_0xb925('0x1f')][_0xb925('0x3e')](_0xd20b7b[_0xb925('0x3f')],{})[_0xb925('0x13')](function(_0x2e418b){var _0x63e6f6=_0xd20b7b[_0xb925('0x40')][_0xb925('0x15')]({'plain':!![]});if(!_0x63e6f6)throw new Error(_0xb925('0x41'));if(_0x63e6f6[_0xb925('0x42')]==='user'){var _0x19e873=_0x2e418b[_0xb925('0x15')]({'plain':!![]});var _0x1fd1df=_0xb925('0x43');return db[_0xb925('0x44')][_0xb925('0x3c')]({'where':{'name':_0x1fd1df,'userProfileId':_0x63e6f6[_0xb925('0x45')]},'raw':!![]})[_0xb925('0x13')](function(_0x210b92){if(_0x210b92&&_0x210b92[_0xb925('0x46')]===0x0){return db[_0xb925('0x16')][_0xb925('0x3e')]({'name':_0x19e873[_0xb925('0x1b')],'resourceId':_0x19e873['id'],'type':_0x210b92[_0xb925('0x1b')],'sectionId':_0x210b92['id']},{})[_0xb925('0x13')](function(){return _0x2e418b;});}else{return _0x2e418b;}})[_0xb925('0x3d')](function(_0x28027c){logger['error'](_0xb925('0x47'),_0x28027c);throw _0x28027c;});}return _0x2e418b;})[_0xb925('0x13')](respondWithResult(_0x2c002c,0xc9))[_0xb925('0x3d')](handleError(_0x2c002c,null));};exports[_0xb925('0x12')]=function(_0x2d4ae1,_0x4c9574){if(_0x2d4ae1[_0xb925('0x3f')]['id']){delete _0x2d4ae1[_0xb925('0x3f')]['id'];}return db[_0xb925('0x1f')][_0xb925('0x3c')]({'where':{'id':_0x2d4ae1[_0xb925('0x3b')]['id']}})[_0xb925('0x13')](handleEntityNotFound(_0x4c9574,null))[_0xb925('0x13')](saveUpdates(_0x2d4ae1[_0xb925('0x3f')],null))[_0xb925('0x13')](function(_0x40ffbe){if(!_0x40ffbe)return;var _0x49bb2e=_0x40ffbe[_0xb925('0x15')]({'plain':!![]});return _0x49bb2e;})[_0xb925('0x13')](function(_0xc2ed22){var _0x53c7f3=new Redis(config[_0xb925('0x8')]);_0x53c7f3[_0xb925('0x17')]('agi',JSON[_0xb925('0x48')](_[_0xb925('0x30')](_0xc2ed22,['id',_0xb925('0x1b'),_0xb925('0x49')])));return _0xc2ed22;})[_0xb925('0x13')](respondWithResult(_0x4c9574,null))[_0xb925('0x3d')](handleError(_0x4c9574,null));};exports[_0xb925('0x14')]=function(_0x480ee8,_0x16a63a){return db['SquareProject'][_0xb925('0x3c')]({'where':{'id':_0x480ee8['params']['id']}})[_0xb925('0x13')](handleEntityNotFound(_0x16a63a,null))[_0xb925('0x13')](removeEntity(_0x16a63a,null))[_0xb925('0x3d')](handleError(_0x16a63a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 64ba375..a49b051 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 _0xc5ad=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0xc5ad,0xb7));var _0xdc5a=function(_0x36b71a,_0x542b85){_0x36b71a=_0x36b71a-0x0;var _0xe6009a=_0xc5ad[_0x36b71a];return _0xe6009a;};'use strict';var EventEmitter=require(_0xdc5a('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xdc5a('0x1')](0x0);var events={'afterCreate':_0xdc5a('0x2'),'afterUpdate':_0xdc5a('0x3'),'afterDestroy':_0xdc5a('0x4')};function emitEvent(_0x326877){return function(_0x34c564,_0x46e403,_0x39af51){SquareProjectEvents[_0xdc5a('0x5')](_0x326877+':'+_0x34c564['id'],_0x34c564);SquareProjectEvents[_0xdc5a('0x5')](_0x326877,_0x34c564);_0x39af51(null);};}for(var e in events){if(events[_0xdc5a('0x6')](e)){var event=events[e];SquareProject[_0xdc5a('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x2d99=['remove','emit','hasOwnProperty','exports','events','SquareProject','setMaxListeners','save','update'];(function(_0x5c7fd9,_0x189d2b){var _0x5a79b3=function(_0x1d52af){while(--_0x1d52af){_0x5c7fd9['push'](_0x5c7fd9['shift']());}};_0x5a79b3(++_0x189d2b);}(_0x2d99,0xee));var _0x92d9=function(_0x365620,_0x581e8e){_0x365620=_0x365620-0x0;var _0x193aa8=_0x2d99[_0x365620];return _0x193aa8;};'use strict';var EventEmitter=require(_0x92d9('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x92d9('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x92d9('0x2')](0x0);var events={'afterCreate':_0x92d9('0x3'),'afterUpdate':_0x92d9('0x4'),'afterDestroy':_0x92d9('0x5')};function emitEvent(_0x420360){return function(_0x342f14,_0x48ca5a,_0x18a92a){SquareProjectEvents['emit'](_0x420360+':'+_0x342f14['id'],_0x342f14);SquareProjectEvents[_0x92d9('0x6')](_0x420360,_0x342f14);_0x18a92a(null);};}for(var e in events){if(events[_0x92d9('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x92d9('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 1cf3cf8..1ebac0c 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 _0x8000=['savedAt','publishedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','SquareProject','square_projects','changed','preproduction'];(function(_0x1f46b8,_0x15f6d1){var _0xcae172=function(_0x2f1bf9){while(--_0x2f1bf9){_0x1f46b8['push'](_0x1f46b8['shift']());}};_0xcae172(++_0x15f6d1);}(_0x8000,0xa6));var _0x0800=function(_0x120599,_0x5a335d){_0x120599=_0x120599-0x0;var _0x2ad666=_0x8000[_0x120599];return _0x2ad666;};'use strict';var _=require(_0x0800('0x0'));var util=require(_0x0800('0x1'));var logger=require(_0x0800('0x2'))(_0x0800('0x3'));var moment=require(_0x0800('0x4'));var BPromise=require('bluebird');var rp=require(_0x0800('0x5'));var fs=require('fs');var path=require(_0x0800('0x6'));var rimraf=require(_0x0800('0x7'));var config=require(_0x0800('0x8'));var attributes=require('./squareProject.attributes');module[_0x0800('0x9')]=function(_0x52a028,_0x4b877a){return _0x52a028['define'](_0x0800('0xa'),attributes,{'tableName':_0x0800('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e33c4,_0x2344b0,_0x30bb06){if(_0x5e33c4[_0x0800('0xc')](_0x0800('0xd'))){_0x5e33c4[_0x0800('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x5e33c4[_0x0800('0xc')]('production')){_0x5e33c4[_0x0800('0xf')]=moment()[_0x0800('0x10')](_0x0800('0x11'));}_0x30bb06(null,_0x5e33c4);}}});}; \ No newline at end of file +var _0xc14a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','util','../../config/logger'];(function(_0x355a4b,_0x40a067){var _0x5109ec=function(_0x10b043){while(--_0x10b043){_0x355a4b['push'](_0x355a4b['shift']());}};_0x5109ec(++_0x40a067);}(_0xc14a,0x11e));var _0xac14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc14a[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xac14('0x0'));var logger=require(_0xac14('0x1'))(_0xac14('0x2'));var moment=require(_0xac14('0x3'));var BPromise=require(_0xac14('0x4'));var rp=require(_0xac14('0x5'));var fs=require('fs');var path=require(_0xac14('0x6'));var rimraf=require(_0xac14('0x7'));var config=require(_0xac14('0x8'));var attributes=require('./squareProject.attributes');module[_0xac14('0x9')]=function(_0x4cb46b,_0x1bcb1c){return _0x4cb46b['define']('SquareProject',attributes,{'tableName':_0xac14('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x546fb3,_0x3b3bb1,_0x49888e){if(_0x546fb3['changed'](_0xac14('0xb'))){_0x546fb3[_0xac14('0xc')]=moment()[_0xac14('0xd')](_0xac14('0xe'));}if(_0x546fb3[_0xac14('0xf')](_0xac14('0x10'))){_0x546fb3[_0xac14('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x49888e(null,_0x546fb3);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 552c24e..b4fddc8 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 _0x7a74=['SquareProject','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','error','message','find','ShowSquareProject','catch','lodash','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects'];(function(_0x1d6a97,_0x32f3eb){var _0x18a5fe=function(_0x178595){while(--_0x178595){_0x1d6a97['push'](_0x1d6a97['shift']());}};_0x18a5fe(++_0x32f3eb);}(_0x7a74,0xf2));var _0x47a7=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7a74[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x47a7('0x0'));var Redis=require(_0x47a7('0x1'));var db=require(_0x47a7('0x2'))['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');config[_0x47a7('0x3')]=_[_0x47a7('0x4')](config[_0x47a7('0x3')],{'host':_0x47a7('0x5'),'port':0x18eb});var socket=require(_0x47a7('0x6'))(new Redis(config['redis']));require(_0x47a7('0x7'))[_0x47a7('0x8')](socket);exports[_0x47a7('0x9')]=function(_0x59ac17){var _0x53f7ec=this;return new Promise(function(_0x3f6fef,_0x2ed012){return db[_0x47a7('0xa')]['findAll']({'raw':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')][_0x47a7('0xc')]===undefined?!![]:![]:!![],'where':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')][_0x47a7('0xd')]||null:null,'attributes':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')]['attributes']||null:null,'limit':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')][_0x47a7('0xe')]||null:null,'include':_0x59ac17[_0x47a7('0xb')]?_0x59ac17[_0x47a7('0xb')][_0x47a7('0xf')]?_[_0x47a7('0x10')](_0x59ac17[_0x47a7('0xb')][_0x47a7('0xf')],function(_0x353012){return{'model':db[_0x353012[_0x47a7('0x11')]],'as':_0x353012['as'],'attributes':_0x353012[_0x47a7('0x12')],'include':_0x353012[_0x47a7('0xf')]?_[_0x47a7('0x10')](_0x353012[_0x47a7('0xf')],function(_0x3d5aed){return{'model':db[_0x3d5aed[_0x47a7('0x11')]],'as':_0x3d5aed['as'],'attributes':_0x3d5aed[_0x47a7('0x12')],'include':_0x3d5aed['include']?_[_0x47a7('0x10')](_0x3d5aed[_0x47a7('0xf')],function(_0x2a3811){return{'model':db[_0x2a3811['model']],'as':_0x2a3811['as'],'attributes':_0x2a3811['attributes']};}):[]};}):[]};}):[]:[]})[_0x47a7('0x13')](function(_0x57977b){logger[_0x47a7('0x14')](_0x47a7('0x9'),_0x59ac17);logger[_0x47a7('0x15')](_0x47a7('0x9'),_0x59ac17,JSON[_0x47a7('0x16')](_0x57977b));_0x3f6fef(_0x57977b);})['catch'](function(_0x1734b1){logger[_0x47a7('0x17')](_0x47a7('0x9'),_0x1734b1['message'],_0x59ac17);_0x2ed012(_0x53f7ec[_0x47a7('0x17')](0x1f4,_0x1734b1[_0x47a7('0x18')]));});});};exports['ShowSquareProject']=function(_0x33338d){var _0x1808cb=this;return new Promise(function(_0x251c8c,_0x19abed){return db[_0x47a7('0xa')][_0x47a7('0x19')]({'raw':_0x33338d[_0x47a7('0xb')]?_0x33338d[_0x47a7('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x33338d[_0x47a7('0xb')]?_0x33338d[_0x47a7('0xb')][_0x47a7('0xd')]||null:null,'attributes':_0x33338d[_0x47a7('0xb')]?_0x33338d[_0x47a7('0xb')]['attributes']||null:null,'include':_0x33338d['options']?_0x33338d['options']['include']?_[_0x47a7('0x10')](_0x33338d[_0x47a7('0xb')][_0x47a7('0xf')],function(_0x4a6f0c){return{'model':db[_0x4a6f0c[_0x47a7('0x11')]],'as':_0x4a6f0c['as'],'attributes':_0x4a6f0c[_0x47a7('0x12')],'include':_0x4a6f0c['include']?_[_0x47a7('0x10')](_0x4a6f0c[_0x47a7('0xf')],function(_0x12f8a3){return{'model':db[_0x12f8a3[_0x47a7('0x11')]],'as':_0x12f8a3['as'],'attributes':_0x12f8a3['attributes'],'include':_0x12f8a3['include']?_[_0x47a7('0x10')](_0x12f8a3[_0x47a7('0xf')],function(_0x2e2f1f){return{'model':db[_0x2e2f1f[_0x47a7('0x11')]],'as':_0x2e2f1f['as'],'attributes':_0x2e2f1f[_0x47a7('0x12')]};}):[]};}):[]};}):[]:[]})[_0x47a7('0x13')](function(_0x4741fa){logger[_0x47a7('0x14')](_0x47a7('0x1a'),_0x33338d);logger['debug'](_0x47a7('0x1a'),_0x33338d,JSON[_0x47a7('0x16')](_0x4741fa));_0x251c8c(_0x4741fa);})[_0x47a7('0x1b')](function(_0xd28e3b){logger[_0x47a7('0x17')](_0x47a7('0x1a'),_0xd28e3b[_0x47a7('0x18')],_0x33338d);_0x19abed(_0x1808cb[_0x47a7('0x17')](0x1f4,_0xd28e3b[_0x47a7('0x18')]));});});}; \ No newline at end of file +var _0xb270=['localhost','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','then','stringify','catch','error','message','ShowSquareProject','find','info','debug','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis'];(function(_0x992f81,_0x2ac0bc){var _0x54937e=function(_0x5db8f2){while(--_0x5db8f2){_0x992f81['push'](_0x992f81['shift']());}};_0x54937e(++_0x2ac0bc);}(_0xb270,0x18b));var _0x0b27=function(_0x3f37c8,_0x2de1ad){_0x3f37c8=_0x3f37c8-0x0;var _0x1c3bc2=_0xb270[_0x3f37c8];return _0x1c3bc2;};'use strict';var _=require(_0x0b27('0x0'));var Redis=require(_0x0b27('0x1'));var db=require(_0x0b27('0x2'))['db'];var logger=require(_0x0b27('0x3'))(_0x0b27('0x4'));var config=require(_0x0b27('0x5'));config['redis']=_[_0x0b27('0x6')](config[_0x0b27('0x7')],{'host':_0x0b27('0x8'),'port':0x18eb});var socket=require(_0x0b27('0x9'))(new Redis(config[_0x0b27('0x7')]));require('./squareProject.socket')[_0x0b27('0xa')](socket);exports[_0x0b27('0xb')]=function(_0x29a050){var _0x94b32a=this;return new Promise(function(_0x44a303,_0x5163b5){return db[_0x0b27('0xc')][_0x0b27('0xd')]({'raw':_0x29a050[_0x0b27('0xe')]?_0x29a050[_0x0b27('0xe')][_0x0b27('0xf')]===undefined?!![]:![]:!![],'where':_0x29a050[_0x0b27('0xe')]?_0x29a050[_0x0b27('0xe')][_0x0b27('0x10')]||null:null,'attributes':_0x29a050['options']?_0x29a050[_0x0b27('0xe')][_0x0b27('0x11')]||null:null,'limit':_0x29a050[_0x0b27('0xe')]?_0x29a050[_0x0b27('0xe')][_0x0b27('0x12')]||null:null,'include':_0x29a050['options']?_0x29a050[_0x0b27('0xe')][_0x0b27('0x13')]?_['map'](_0x29a050[_0x0b27('0xe')][_0x0b27('0x13')],function(_0x2c04a1){return{'model':db[_0x2c04a1[_0x0b27('0x14')]],'as':_0x2c04a1['as'],'attributes':_0x2c04a1[_0x0b27('0x11')],'include':_0x2c04a1[_0x0b27('0x13')]?_[_0x0b27('0x15')](_0x2c04a1[_0x0b27('0x13')],function(_0x47d5fe){return{'model':db[_0x47d5fe[_0x0b27('0x14')]],'as':_0x47d5fe['as'],'attributes':_0x47d5fe[_0x0b27('0x11')],'include':_0x47d5fe[_0x0b27('0x13')]?_[_0x0b27('0x15')](_0x47d5fe['include'],function(_0x3d8c5b){return{'model':db[_0x3d8c5b[_0x0b27('0x14')]],'as':_0x3d8c5b['as'],'attributes':_0x3d8c5b['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b27('0x16')](function(_0x372801){logger['info'](_0x0b27('0xb'),_0x29a050);logger['debug'](_0x0b27('0xb'),_0x29a050,JSON[_0x0b27('0x17')](_0x372801));_0x44a303(_0x372801);})[_0x0b27('0x18')](function(_0x554635){logger[_0x0b27('0x19')](_0x0b27('0xb'),_0x554635[_0x0b27('0x1a')],_0x29a050);_0x5163b5(_0x94b32a[_0x0b27('0x19')](0x1f4,_0x554635['message']));});});};exports[_0x0b27('0x1b')]=function(_0x292a14){var _0x488463=this;return new Promise(function(_0x20202e,_0x29c9c2){return db[_0x0b27('0xc')][_0x0b27('0x1c')]({'raw':_0x292a14['options']?_0x292a14[_0x0b27('0xe')][_0x0b27('0xf')]===undefined?!![]:![]:!![],'where':_0x292a14[_0x0b27('0xe')]?_0x292a14['options']['where']||null:null,'attributes':_0x292a14[_0x0b27('0xe')]?_0x292a14[_0x0b27('0xe')]['attributes']||null:null,'include':_0x292a14['options']?_0x292a14[_0x0b27('0xe')][_0x0b27('0x13')]?_[_0x0b27('0x15')](_0x292a14[_0x0b27('0xe')]['include'],function(_0x5a91a2){return{'model':db[_0x5a91a2[_0x0b27('0x14')]],'as':_0x5a91a2['as'],'attributes':_0x5a91a2[_0x0b27('0x11')],'include':_0x5a91a2[_0x0b27('0x13')]?_['map'](_0x5a91a2[_0x0b27('0x13')],function(_0x138e95){return{'model':db[_0x138e95[_0x0b27('0x14')]],'as':_0x138e95['as'],'attributes':_0x138e95['attributes'],'include':_0x138e95['include']?_[_0x0b27('0x15')](_0x138e95['include'],function(_0x89868f){return{'model':db[_0x89868f[_0x0b27('0x14')]],'as':_0x89868f['as'],'attributes':_0x89868f[_0x0b27('0x11')]};}):[]};}):[]};}):[]:[]})[_0x0b27('0x16')](function(_0x42d8a8){logger[_0x0b27('0x1d')](_0x0b27('0x1b'),_0x292a14);logger[_0x0b27('0x1e')](_0x0b27('0x1b'),_0x292a14,JSON[_0x0b27('0x17')](_0x42d8a8));_0x20202e(_0x42d8a8);})[_0x0b27('0x18')](function(_0x59daec){logger['error'](_0x0b27('0x1b'),_0x59daec[_0x0b27('0x1a')],_0x292a14);_0x29c9c2(_0x488463[_0x0b27('0x19')](0x1f4,_0x59daec[_0x0b27('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 055ca34..ee5bd36 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 _0x7586=['length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x289fd7,_0x341a58){var _0x44f7e0=function(_0x3e33cf){while(--_0x3e33cf){_0x289fd7['push'](_0x289fd7['shift']());}};_0x44f7e0(++_0x341a58);}(_0x7586,0x18e));var _0x6758=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x7586[_0x594ece];return _0x471bc4;};'use strict';var SquareProjectEvents=require(_0x6758('0x0'));var events=[_0x6758('0x1'),_0x6758('0x2'),_0x6758('0x3')];function createListener(_0x3a2338,_0x52664f){return function(_0x4ef73e){_0x52664f[_0x6758('0x4')](_0x3a2338,_0x4ef73e);};}function removeListener(_0x327db1,_0xef50f1){return function(){SquareProjectEvents[_0x6758('0x5')](_0x327db1,_0xef50f1);};}exports[_0x6758('0x6')]=function(_0x3bc514){for(var _0x1487dd=0x0,_0x15e443=events[_0x6758('0x7')];_0x1487dd<_0x15e443;_0x1487dd++){var _0x205dbb=events[_0x1487dd];var _0x4b1abb=createListener(_0x6758('0x8')+_0x205dbb,_0x3bc514);SquareProjectEvents['on'](_0x205dbb,_0x4b1abb);}}; \ No newline at end of file +var _0xce58=['emit','removeListener','register','squareProject:','./squareProject.events','remove','update'];(function(_0x296092,_0x3683ef){var _0x41cd58=function(_0x18d0d4){while(--_0x18d0d4){_0x296092['push'](_0x296092['shift']());}};_0x41cd58(++_0x3683ef);}(_0xce58,0xc1));var _0x8ce5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce58[_0x3dd15e];return _0x231fd0;};'use strict';var SquareProjectEvents=require(_0x8ce5('0x0'));var events=['save',_0x8ce5('0x1'),_0x8ce5('0x2')];function createListener(_0x4b6f4b,_0x44ec6c){return function(_0x4a40c3){_0x44ec6c[_0x8ce5('0x3')](_0x4b6f4b,_0x4a40c3);};}function removeListener(_0xd31ba0,_0x237a38){return function(){SquareProjectEvents[_0x8ce5('0x4')](_0xd31ba0,_0x237a38);};}exports[_0x8ce5('0x5')]=function(_0x59a9b0){for(var _0x1874bf=0x0,_0x2f1f2e=events['length'];_0x1874bf<_0x2f1f2e;_0x1874bf++){var _0xbb55c1=events[_0x1874bf];var _0x11c1b4=createListener(_0x8ce5('0x6')+_0xbb55c1,_0x59a9b0);SquareProjectEvents['on'](_0xbb55c1,_0x11c1b4);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b297cf5..11b23f1 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x8b8863,_0x5c7366){var _0x7d1752=function(_0x53aeae){while(--_0x53aeae){_0x8b8863['push'](_0x8b8863['shift']());}};_0x7d1752(++_0x5c7366);}(_0x5fc3,0xa8));var _0x35fc=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x5fc3[_0x529f1c];return _0x4d57ab;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +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(_0x4b870e,_0x390eca){var _0x234d51=function(_0x22133a){while(--_0x22133a){_0x4b870e['push'](_0x4b870e['shift']());}};_0x234d51(++_0x390eca);}(_0x326f,0xd1));var _0xf326=function(_0x576e35,_0x36fbe4){_0x576e35=_0x576e35-0x0;var _0x2c870c=_0x326f[_0x576e35];return _0x2c870c;};'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 diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index ad3a56f..5ea97fd 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 _0xeec6=['sequelize','exports','STRING','getDataValue','savePath','lastIndexOf'];(function(_0xd9eaa6,_0x3faff0){var _0x3c7319=function(_0x385625){while(--_0x385625){_0xd9eaa6['push'](_0xd9eaa6['shift']());}};_0x3c7319(++_0x3faff0);}(_0xeec6,0x1c2));var _0x6eec=function(_0x37d4ac,_0x4e47d6){_0x37d4ac=_0x37d4ac-0x0;var _0x5e727a=_0xeec6[_0x37d4ac];return _0x5e727a;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'callerid':{'type':Sequelize[_0x6eec('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'extension':{'type':Sequelize[_0x6eec('0x2')]},'priority':{'type':Sequelize[_0x6eec('0x2')]},'accountcode':{'type':Sequelize[_0x6eec('0x2')]},'dnid':{'type':Sequelize[_0x6eec('0x2')]},'projectName':{'type':Sequelize[_0x6eec('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x6eec('0x2')]},'savePath':{'type':Sequelize[_0x6eec('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5a5e47='';var _0x1c810e=this[_0x6eec('0x3')](_0x6eec('0x4'));if(_0x1c810e){_0x5a5e47=_0x1c810e['substring'](_0x1c810e[_0x6eec('0x5')]('.'));}return _0x5a5e47;}}}; \ No newline at end of file +var _0x6f47=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0xfeca59,_0x4e804f){var _0x442757=function(_0x312b16){while(--_0x312b16){_0xfeca59['push'](_0xfeca59['shift']());}};_0x442757(++_0x4e804f);}(_0x6f47,0xc7));var _0x76f4=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x6f47[_0x39d544];return _0x5a5ff2;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'uniqueid':{'type':Sequelize[_0x76f4('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'dnid':{'type':Sequelize[_0x76f4('0x1')]},'projectName':{'type':Sequelize[_0x76f4('0x1')]},'saveName':{'type':Sequelize[_0x76f4('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x76f4('0x1')]},'format':{'type':Sequelize[_0x76f4('0x2')],'get':function(){var _0x2176a7='';var _0x497f99=this[_0x76f4('0x3')](_0x76f4('0x4'));if(_0x497f99){_0x2176a7=_0x497f99[_0x76f4('0x5')](_0x497f99[_0x76f4('0x6')]('.'));}return _0x2176a7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4989c26..c2ac8e7 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 _0xc08d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','end','error','stack','name','send','SquareRecording','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','create','body','catch','download','../../components/encryptor','uniqueid','params','savePath','filename','format','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xc08d,0xae));var _0xdc08=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xc08d[_0x46f1a6];return _0x38429a;};'use strict';var emlformat=require(_0xdc08('0x0'));var rimraf=require(_0xdc08('0x1'));var zipdir=require(_0xdc08('0x2'));var jsonpatch=require(_0xdc08('0x3'));var rp=require(_0xdc08('0x4'));var moment=require(_0xdc08('0x5'));var BPromise=require(_0xdc08('0x6'));var Mustache=require('mustache');var util=require(_0xdc08('0x7'));var path=require(_0xdc08('0x8'));var sox=require(_0xdc08('0x9'));var csv=require(_0xdc08('0xa'));var ejs=require(_0xdc08('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc08('0xc'));var squel=require(_0xdc08('0xd'));var crypto=require(_0xdc08('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdc08('0xa'));var querystring=require(_0xdc08('0xf'));var Papa=require(_0xdc08('0x10'));var Redis=require(_0xdc08('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc08('0x12'));var as=require(_0xdc08('0x13'));var hardwareService=require(_0xdc08('0x14'));var logger=require(_0xdc08('0x15'))('api');var utils=require(_0xdc08('0x16'));var config=require(_0xdc08('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc08('0x18'))['db'];function respondWithStatusCode(_0x5f32fa,_0x94cf15){_0x94cf15=_0x94cf15||0xcc;return function(_0x1f1b4b){if(_0x1f1b4b){return _0x5f32fa[_0xdc08('0x19')](_0x94cf15);}return _0x5f32fa[_0xdc08('0x1a')](_0x94cf15)['end']();};}function respondWithResult(_0x39c20f,_0x59fb1f){_0x59fb1f=_0x59fb1f||0xc8;return function(_0x2f3721){if(_0x2f3721){return _0x39c20f[_0xdc08('0x1a')](_0x59fb1f)[_0xdc08('0x1b')](_0x2f3721);}};}function respondWithFilteredResult(_0x67ca8d,_0x5b5ae9){return function(_0x31f3ef){if(_0x31f3ef){var _0x166838=typeof _0x5b5ae9[_0xdc08('0x1c')]===_0xdc08('0x1d')&&typeof _0x5b5ae9[_0xdc08('0x1e')]===_0xdc08('0x1d');var _0x2c60c8=_0x31f3ef[_0xdc08('0x1f')];var _0x37c1a8=_0x166838?0x0:_0x5b5ae9['offset'];var _0xe94637=_0x166838?_0x31f3ef[_0xdc08('0x1f')]:_0x5b5ae9[_0xdc08('0x1c')]+_0x5b5ae9[_0xdc08('0x1e')];var _0xc129a8;if(_0xe94637>=_0x2c60c8){_0xe94637=_0x2c60c8;_0xc129a8=0xc8;}else{_0xc129a8=0xce;}_0x67ca8d[_0xdc08('0x1a')](_0xc129a8);return _0x67ca8d[_0xdc08('0x20')]('Content-Range',_0x37c1a8+'-'+_0xe94637+'/'+_0x2c60c8)['json'](_0x31f3ef);}return null;};}function patchUpdates(_0x108bd8){return function(_0x3a9ad8){try{jsonpatch[_0xdc08('0x21')](_0x3a9ad8,_0x108bd8,!![]);}catch(_0x113294){return BPromise['reject'](_0x113294);}return _0x3a9ad8[_0xdc08('0x22')]();};}function saveUpdates(_0x44f7e9,_0x174999){return function(_0x425a69){if(_0x425a69){return _0x425a69[_0xdc08('0x23')](_0x44f7e9)['then'](function(_0x575a56){return _0x575a56;});}return null;};}function removeEntity(_0x3ba22b,_0x183fbe){return function(_0x23797c){if(_0x23797c){return _0x23797c[_0xdc08('0x24')]()[_0xdc08('0x25')](function(){_0x3ba22b[_0xdc08('0x1a')](0xcc)[_0xdc08('0x26')]();});}};}function handleEntityNotFound(_0x8f698c,_0x271fed){return function(_0x5942a7){if(!_0x5942a7){_0x8f698c[_0xdc08('0x19')](0x194);}return _0x5942a7;};}function handleError(_0x1209f7,_0x30fea3){_0x30fea3=_0x30fea3||0x1f4;return function(_0x3355c5){logger[_0xdc08('0x27')](_0x3355c5[_0xdc08('0x28')]);if(_0x3355c5['name']){delete _0x3355c5[_0xdc08('0x29')];}_0x1209f7[_0xdc08('0x1a')](_0x30fea3)[_0xdc08('0x2a')](_0x3355c5);};}exports['index']=function(_0x417ada,_0x139f84){var _0x3c1df9={},_0x23af8e={},_0x7172b1={'count':0x0,'rows':[]};var _0x17c827=_['map'](db[_0xdc08('0x2b')]['rawAttributes'],function(_0x292ad2){return{'name':_0x292ad2[_0xdc08('0x2c')],'type':_0x292ad2[_0xdc08('0x2d')][_0xdc08('0x2e')]};});_0x23af8e[_0xdc08('0x2f')]=_[_0xdc08('0x30')](_0x17c827,_0xdc08('0x29'));_0x23af8e[_0xdc08('0x31')]=_[_0xdc08('0x32')](_0x417ada[_0xdc08('0x31')]);_0x23af8e[_0xdc08('0x33')]=_['intersection'](_0x23af8e['model'],_0x23af8e['query']);_0x3c1df9[_0xdc08('0x34')]=_[_0xdc08('0x35')](_0x23af8e[_0xdc08('0x2f')],qs['fields'](_0x417ada[_0xdc08('0x31')][_0xdc08('0x36')]));_0x3c1df9['attributes']=_0x3c1df9[_0xdc08('0x34')]['length']?_0x3c1df9[_0xdc08('0x34')]:_0x23af8e['model'];if(!_0x417ada['query'][_0xdc08('0x37')]('nolimit')){_0x3c1df9['limit']=qs['limit'](_0x417ada[_0xdc08('0x31')][_0xdc08('0x1e')]);_0x3c1df9[_0xdc08('0x1c')]=qs[_0xdc08('0x1c')](_0x417ada[_0xdc08('0x31')][_0xdc08('0x1c')]);}_0x3c1df9['order']=qs[_0xdc08('0x38')](_0x417ada[_0xdc08('0x31')][_0xdc08('0x38')]);_0x3c1df9['where']=qs['filters'](_[_0xdc08('0x39')](_0x417ada['query'],_0x23af8e[_0xdc08('0x33')]),_0x17c827);if(_0x417ada[_0xdc08('0x31')][_0xdc08('0x3a')]){_0x3c1df9[_0xdc08('0x3b')]=_[_0xdc08('0x3c')](_0x3c1df9[_0xdc08('0x3b')],{'$or':_['map'](_0x17c827,function(_0x1ae760){if(_0x1ae760[_0xdc08('0x2d')]!==_0xdc08('0x3d')){var _0x5548aa={};_0x5548aa[_0x1ae760['name']]={'$like':'%'+_0x417ada[_0xdc08('0x31')][_0xdc08('0x3a')]+'%'};return _0x5548aa;}})});}_0x3c1df9=_[_0xdc08('0x3c')]({},_0x3c1df9,_0x417ada[_0xdc08('0x3e')]);var _0xce8fc1={'where':_0x3c1df9['where']};return db[_0xdc08('0x2b')][_0xdc08('0x1f')](_0xce8fc1)[_0xdc08('0x25')](function(_0x5bec88){_0x7172b1[_0xdc08('0x1f')]=_0x5bec88;if(_0x417ada['query'][_0xdc08('0x3f')]){_0x3c1df9['include']=[{'all':!![]}];}return db['SquareRecording'][_0xdc08('0x40')](_0x3c1df9);})[_0xdc08('0x25')](function(_0x4d9815){_0x7172b1[_0xdc08('0x41')]=_0x4d9815;return _0x7172b1;})[_0xdc08('0x25')](respondWithFilteredResult(_0x139f84,_0x3c1df9))['catch'](handleError(_0x139f84,null));};exports[_0xdc08('0x42')]=function(_0x16e15e,_0x3af12a){var _0x40d582={'raw':!![],'where':{'id':_0x16e15e['params']['id']}},_0x31b222={};_0x31b222[_0xdc08('0x2f')]=_[_0xdc08('0x32')](db['SquareRecording']['rawAttributes']);_0x31b222[_0xdc08('0x31')]=_['keys'](_0x16e15e[_0xdc08('0x31')]);_0x31b222[_0xdc08('0x33')]=_[_0xdc08('0x35')](_0x31b222['model'],_0x31b222['query']);_0x40d582['attributes']=_[_0xdc08('0x35')](_0x31b222[_0xdc08('0x2f')],qs['fields'](_0x16e15e[_0xdc08('0x31')][_0xdc08('0x36')]));_0x40d582['attributes']=_0x40d582['attributes']['length']?_0x40d582[_0xdc08('0x34')]:_0x31b222[_0xdc08('0x2f')];if(_0x16e15e['query'][_0xdc08('0x3f')]){_0x40d582[_0xdc08('0x43')]=[{'all':!![]}];}_0x40d582=_[_0xdc08('0x3c')]({},_0x40d582,_0x16e15e[_0xdc08('0x3e')]);return db[_0xdc08('0x2b')][_0xdc08('0x44')](_0x40d582)[_0xdc08('0x25')](handleEntityNotFound(_0x3af12a,null))[_0xdc08('0x25')](respondWithResult(_0x3af12a,null))['catch'](handleError(_0x3af12a,null));};exports[_0xdc08('0x45')]=function(_0x359e5e,_0x42db05){return db[_0xdc08('0x2b')][_0xdc08('0x45')](_0x359e5e[_0xdc08('0x46')],{})['then'](respondWithResult(_0x42db05,0xc9))['catch'](handleError(_0x42db05,null));};exports[_0xdc08('0x23')]=function(_0x6b7634,_0x16e91e){if(_0x6b7634[_0xdc08('0x46')]['id']){delete _0x6b7634[_0xdc08('0x46')]['id'];}return db[_0xdc08('0x2b')]['find']({'where':{'id':_0x6b7634['params']['id']}})[_0xdc08('0x25')](handleEntityNotFound(_0x16e91e,null))[_0xdc08('0x25')](saveUpdates(_0x6b7634[_0xdc08('0x46')],null))[_0xdc08('0x25')](respondWithResult(_0x16e91e,null))[_0xdc08('0x47')](handleError(_0x16e91e,null));};exports[_0xdc08('0x48')]=function(_0x5ba613,_0x384525,_0x1e7aab){var _0x217746=require(_0xdc08('0x49'));var _0x4d30ad=![];var _0x174e5f={};if(_0x5ba613[_0xdc08('0x31')][_0xdc08('0x2d')]&&_0x5ba613[_0xdc08('0x31')][_0xdc08('0x2d')]===_0xdc08('0x4a')){_0x174e5f[_0xdc08('0x4a')]=_0x5ba613[_0xdc08('0x4b')]['id'];}else{_0x174e5f['id']=_0x5ba613['params']['id'];}return db[_0xdc08('0x2b')][_0xdc08('0x44')]({'where':_0x174e5f,'attributes':['id',_0xdc08('0x4c'),_0xdc08('0x4d')],'raw':!![]})[_0xdc08('0x25')](handleEntityNotFound(_0x384525,null))['then'](function(_0x5d3b84){if(_0x5d3b84){var _0x6b2d16=_0x5d3b84[_0xdc08('0x4c')];var _0x18ba32=util[_0xdc08('0x4e')](_0xdc08('0x4f'),_0x6b2d16);if(fs[_0xdc08('0x50')](_0x18ba32)){_0x4d30ad=!![];return _0x217746[_0xdc08('0x51')](_0x18ba32,_0x6b2d16,config['secrets']['recording'])[_0xdc08('0x25')](function(){return _0x5d3b84;});}return _0x5d3b84;}})[_0xdc08('0x25')](function(_0x32da68){if(_0x32da68){var _0x14712c=_0x32da68[_0xdc08('0x4c')];if(!fs[_0xdc08('0x50')](_0x14712c)){throw new db[(_0xdc08('0x52'))][(_0xdc08('0x53'))](_0xdc08('0x54'));}if(_0x32da68[_0xdc08('0x4d')]){return _0x384525[_0xdc08('0x48')](_0x14712c,_0x32da68[_0xdc08('0x4d')]+path[_0xdc08('0x55')](_0x14712c),function(){if(_0x4d30ad){fs[_0xdc08('0x56')](_0x14712c);}});}else{return _0x384525[_0xdc08('0x48')](_0x14712c,function(_0x287e99){if(_0x4d30ad){fs[_0xdc08('0x56')](_0x14712c);}});}}})['catch'](function(_0x48eb08){if(_0x48eb08[_0xdc08('0x57')]===_0xdc08('0x54')){_0x384525[_0xdc08('0x1a')](0x194)[_0xdc08('0x2a')]('Not\x20found');}else{return handleError(_0x384525,null);}});};exports[_0xdc08('0x24')]=function(_0x563929,_0x322dfd){return db[_0xdc08('0x2b')][_0xdc08('0x44')]({'where':{'id':_0x563929[_0xdc08('0x4b')]['id']}})['then'](function(_0x524835){if(_[_0xdc08('0x58')](_0x524835)){throw new ReferenceError(_0xdc08('0x59'));}return _0x524835;})[_0xdc08('0x25')](function(_0x4e00ef){var _0x428305=_0x4e00ef[_0xdc08('0x4c')];logger['info'](_0xdc08('0x5a'),_0x428305);if(!_[_0xdc08('0x58')](_0x4e00ef[_0xdc08('0x4c')])&&fs[_0xdc08('0x50')](_0x428305)){logger['info'](_0xdc08('0x5b')+_0x428305+_0xdc08('0x5c'));fs[_0xdc08('0x5d')](_0x428305);}_0x428305=_0x428305+_0xdc08('0x5e');if(!_[_0xdc08('0x58')](_0x4e00ef[_0xdc08('0x4c')])&&fs['existsSync'](_0x428305)){logger[_0xdc08('0x5f')](_0xdc08('0x5b')+_0x428305+_0xdc08('0x5c'));fs[_0xdc08('0x5d')](_0x428305);}return _0x4e00ef;})[_0xdc08('0x25')](function(_0x17fbad){if(!_0x17fbad)throw new InternalError();return _0x17fbad['destroy']();})[_0xdc08('0x25')](function(){_0x322dfd[_0xdc08('0x1a')](0xcc)[_0xdc08('0x26')]();})[_0xdc08('0x47')](handleError(_0x322dfd,null));}; \ No newline at end of file +var _0x0135=['VIRTUAL','options','SquareRecording','includeAll','include','findAll','catch','params','body','find','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','request-promise','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x217b17,_0x35fc8d){var _0x150d1b=function(_0x34296c){while(--_0x34296c){_0x217b17['push'](_0x217b17['shift']());}};_0x150d1b(++_0x35fc8d);}(_0x0135,0xda));var _0x5013=function(_0x14287f,_0xd411f4){_0x14287f=_0x14287f-0x0;var _0x2f5b88=_0x0135[_0x14287f];return _0x2f5b88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5013('0x0'));var zipdir=require(_0x5013('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5013('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5013('0x3'));var util=require('util');var path=require('path');var sox=require(_0x5013('0x4'));var csv=require('to-csv');var ejs=require(_0x5013('0x5'));var fs=require('fs');var fs_extra=require(_0x5013('0x6'));var _=require(_0x5013('0x7'));var squel=require(_0x5013('0x8'));var crypto=require('crypto');var jsforce=require(_0x5013('0x9'));var deskjs=require(_0x5013('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5013('0xb'));var Papa=require('papaparse');var Redis=require(_0x5013('0xc'));var authService=require(_0x5013('0xd'));var qs=require(_0x5013('0xe'));var as=require(_0x5013('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5013('0x10'))('api');var utils=require(_0x5013('0x11'));var config=require(_0x5013('0x12'));var licenseUtil=require(_0x5013('0x13'));var db=require(_0x5013('0x14'))['db'];function respondWithStatusCode(_0xdfc877,_0x348d0a){_0x348d0a=_0x348d0a||0xcc;return function(_0x535733){if(_0x535733){return _0xdfc877[_0x5013('0x15')](_0x348d0a);}return _0xdfc877[_0x5013('0x16')](_0x348d0a)[_0x5013('0x17')]();};}function respondWithResult(_0x1b1e80,_0x386b18){_0x386b18=_0x386b18||0xc8;return function(_0x4c539b){if(_0x4c539b){return _0x1b1e80[_0x5013('0x16')](_0x386b18)[_0x5013('0x18')](_0x4c539b);}};}function respondWithFilteredResult(_0x1489d8,_0xc1ee57){return function(_0x1e0480){if(_0x1e0480){var _0x3998b0=typeof _0xc1ee57[_0x5013('0x19')]===_0x5013('0x1a')&&typeof _0xc1ee57[_0x5013('0x1b')]===_0x5013('0x1a');var _0x555690=_0x1e0480[_0x5013('0x1c')];var _0x201526=_0x3998b0?0x0:_0xc1ee57[_0x5013('0x19')];var _0x260025=_0x3998b0?_0x1e0480['count']:_0xc1ee57[_0x5013('0x19')]+_0xc1ee57[_0x5013('0x1b')];var _0x3fe8b5;if(_0x260025>=_0x555690){_0x260025=_0x555690;_0x3fe8b5=0xc8;}else{_0x3fe8b5=0xce;}_0x1489d8[_0x5013('0x16')](_0x3fe8b5);return _0x1489d8[_0x5013('0x1d')](_0x5013('0x1e'),_0x201526+'-'+_0x260025+'/'+_0x555690)[_0x5013('0x18')](_0x1e0480);}return null;};}function patchUpdates(_0x398249){return function(_0x84a1d7){try{jsonpatch['apply'](_0x84a1d7,_0x398249,!![]);}catch(_0x26c8c4){return BPromise[_0x5013('0x1f')](_0x26c8c4);}return _0x84a1d7[_0x5013('0x20')]();};}function saveUpdates(_0x4daeb4,_0x1cc686){return function(_0x3f1f7c){if(_0x3f1f7c){return _0x3f1f7c[_0x5013('0x21')](_0x4daeb4)[_0x5013('0x22')](function(_0x53887c){return _0x53887c;});}return null;};}function removeEntity(_0x16fdb6,_0x4b7daf){return function(_0x36142d){if(_0x36142d){return _0x36142d[_0x5013('0x23')]()['then'](function(){_0x16fdb6[_0x5013('0x16')](0xcc)[_0x5013('0x17')]();});}};}function handleEntityNotFound(_0x2f1fa7,_0x238790){return function(_0x485004){if(!_0x485004){_0x2f1fa7[_0x5013('0x15')](0x194);}return _0x485004;};}function handleError(_0x83bf73,_0x4d4f8c){_0x4d4f8c=_0x4d4f8c||0x1f4;return function(_0x134b25){logger[_0x5013('0x24')](_0x134b25[_0x5013('0x25')]);if(_0x134b25[_0x5013('0x26')]){delete _0x134b25[_0x5013('0x26')];}_0x83bf73['status'](_0x4d4f8c)[_0x5013('0x27')](_0x134b25);};}exports[_0x5013('0x28')]=function(_0x1757c5,_0x191e74){var _0x1a11ff={},_0x20cc33={},_0x589659={'count':0x0,'rows':[]};var _0x251332=_[_0x5013('0x29')](db['SquareRecording']['rawAttributes'],function(_0x14b0d7){return{'name':_0x14b0d7[_0x5013('0x2a')],'type':_0x14b0d7[_0x5013('0x2b')][_0x5013('0x2c')]};});_0x20cc33[_0x5013('0x2d')]=_[_0x5013('0x29')](_0x251332,_0x5013('0x26'));_0x20cc33[_0x5013('0x2e')]=_[_0x5013('0x2f')](_0x1757c5[_0x5013('0x2e')]);_0x20cc33[_0x5013('0x30')]=_[_0x5013('0x31')](_0x20cc33[_0x5013('0x2d')],_0x20cc33[_0x5013('0x2e')]);_0x1a11ff[_0x5013('0x32')]=_['intersection'](_0x20cc33[_0x5013('0x2d')],qs[_0x5013('0x33')](_0x1757c5[_0x5013('0x2e')][_0x5013('0x33')]));_0x1a11ff[_0x5013('0x32')]=_0x1a11ff['attributes'][_0x5013('0x34')]?_0x1a11ff[_0x5013('0x32')]:_0x20cc33[_0x5013('0x2d')];if(!_0x1757c5['query'][_0x5013('0x35')](_0x5013('0x36'))){_0x1a11ff['limit']=qs['limit'](_0x1757c5[_0x5013('0x2e')]['limit']);_0x1a11ff['offset']=qs['offset'](_0x1757c5[_0x5013('0x2e')][_0x5013('0x19')]);}_0x1a11ff[_0x5013('0x37')]=qs[_0x5013('0x38')](_0x1757c5[_0x5013('0x2e')][_0x5013('0x38')]);_0x1a11ff[_0x5013('0x39')]=qs[_0x5013('0x30')](_[_0x5013('0x3a')](_0x1757c5[_0x5013('0x2e')],_0x20cc33[_0x5013('0x30')]),_0x251332);if(_0x1757c5[_0x5013('0x2e')][_0x5013('0x3b')]){_0x1a11ff[_0x5013('0x39')]=_[_0x5013('0x3c')](_0x1a11ff[_0x5013('0x39')],{'$or':_['map'](_0x251332,function(_0x522f2d){if(_0x522f2d['type']!==_0x5013('0x3d')){var _0x5e14e3={};_0x5e14e3[_0x522f2d[_0x5013('0x26')]]={'$like':'%'+_0x1757c5[_0x5013('0x2e')]['filter']+'%'};return _0x5e14e3;}})});}_0x1a11ff=_[_0x5013('0x3c')]({},_0x1a11ff,_0x1757c5[_0x5013('0x3e')]);var _0x21dcd6={'where':_0x1a11ff[_0x5013('0x39')]};return db[_0x5013('0x3f')][_0x5013('0x1c')](_0x21dcd6)['then'](function(_0x2eb49d){_0x589659['count']=_0x2eb49d;if(_0x1757c5['query'][_0x5013('0x40')]){_0x1a11ff[_0x5013('0x41')]=[{'all':!![]}];}return db[_0x5013('0x3f')][_0x5013('0x42')](_0x1a11ff);})[_0x5013('0x22')](function(_0x2ca4b4){_0x589659['rows']=_0x2ca4b4;return _0x589659;})[_0x5013('0x22')](respondWithFilteredResult(_0x191e74,_0x1a11ff))[_0x5013('0x43')](handleError(_0x191e74,null));};exports['show']=function(_0x2fcda6,_0x264dce){var _0x1f93cb={'raw':!![],'where':{'id':_0x2fcda6[_0x5013('0x44')]['id']}},_0x45b352={};_0x45b352['model']=_[_0x5013('0x2f')](db[_0x5013('0x3f')]['rawAttributes']);_0x45b352['query']=_['keys'](_0x2fcda6[_0x5013('0x2e')]);_0x45b352['filters']=_['intersection'](_0x45b352[_0x5013('0x2d')],_0x45b352[_0x5013('0x2e')]);_0x1f93cb[_0x5013('0x32')]=_['intersection'](_0x45b352[_0x5013('0x2d')],qs[_0x5013('0x33')](_0x2fcda6['query'][_0x5013('0x33')]));_0x1f93cb['attributes']=_0x1f93cb[_0x5013('0x32')][_0x5013('0x34')]?_0x1f93cb['attributes']:_0x45b352[_0x5013('0x2d')];if(_0x2fcda6[_0x5013('0x2e')][_0x5013('0x40')]){_0x1f93cb['include']=[{'all':!![]}];}_0x1f93cb=_[_0x5013('0x3c')]({},_0x1f93cb,_0x2fcda6[_0x5013('0x3e')]);return db[_0x5013('0x3f')]['find'](_0x1f93cb)[_0x5013('0x22')](handleEntityNotFound(_0x264dce,null))['then'](respondWithResult(_0x264dce,null))[_0x5013('0x43')](handleError(_0x264dce,null));};exports['create']=function(_0x20a245,_0x23e664){return db[_0x5013('0x3f')]['create'](_0x20a245[_0x5013('0x45')],{})[_0x5013('0x22')](respondWithResult(_0x23e664,0xc9))[_0x5013('0x43')](handleError(_0x23e664,null));};exports[_0x5013('0x21')]=function(_0x28fc3c,_0x117f6f){if(_0x28fc3c[_0x5013('0x45')]['id']){delete _0x28fc3c[_0x5013('0x45')]['id'];}return db[_0x5013('0x3f')][_0x5013('0x46')]({'where':{'id':_0x28fc3c[_0x5013('0x44')]['id']}})['then'](handleEntityNotFound(_0x117f6f,null))[_0x5013('0x22')](saveUpdates(_0x28fc3c[_0x5013('0x45')],null))['then'](respondWithResult(_0x117f6f,null))[_0x5013('0x43')](handleError(_0x117f6f,null));};exports[_0x5013('0x47')]=function(_0x5a4a5a,_0x28feee,_0x2680c3){var _0x1773d9=require(_0x5013('0x48'));var _0x5d5ec9=![];var _0x28d4f8={};if(_0x5a4a5a[_0x5013('0x2e')][_0x5013('0x2b')]&&_0x5a4a5a['query'][_0x5013('0x2b')]===_0x5013('0x49')){_0x28d4f8[_0x5013('0x49')]=_0x5a4a5a['params']['id'];}else{_0x28d4f8['id']=_0x5a4a5a['params']['id'];}return db[_0x5013('0x3f')][_0x5013('0x46')]({'where':_0x28d4f8,'attributes':['id',_0x5013('0x4a'),_0x5013('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x28feee,null))[_0x5013('0x22')](function(_0x1d8839){if(_0x1d8839){var _0x226c16=_0x1d8839[_0x5013('0x4a')];var _0x2db896=util['format'](_0x5013('0x4c'),_0x226c16);if(fs['existsSync'](_0x2db896)){_0x5d5ec9=!![];return _0x1773d9['decryptFile'](_0x2db896,_0x226c16,config['secrets'][_0x5013('0x4d')])[_0x5013('0x22')](function(){return _0x1d8839;});}return _0x1d8839;}})['then'](function(_0x48fb61){if(_0x48fb61){var _0x2a3b6f=_0x48fb61[_0x5013('0x4a')];if(!fs[_0x5013('0x4e')](_0x2a3b6f)){throw new db[(_0x5013('0x4f'))][(_0x5013('0x50'))](_0x5013('0x51'));}if(_0x48fb61['filename']){return _0x28feee[_0x5013('0x47')](_0x2a3b6f,_0x48fb61[_0x5013('0x4b')]+path[_0x5013('0x52')](_0x2a3b6f),function(){if(_0x5d5ec9){fs[_0x5013('0x53')](_0x2a3b6f);}});}else{return _0x28feee['download'](_0x2a3b6f,function(_0x182a35){if(_0x5d5ec9){fs[_0x5013('0x53')](_0x2a3b6f);}});}}})[_0x5013('0x43')](function(_0x27d8be){if(_0x27d8be[_0x5013('0x54')]===_0x5013('0x51')){_0x28feee[_0x5013('0x16')](0x194)[_0x5013('0x27')](_0x5013('0x55'));}else{return handleError(_0x28feee,null);}});};exports[_0x5013('0x23')]=function(_0x4d82e2,_0x62dabe){return db[_0x5013('0x3f')][_0x5013('0x46')]({'where':{'id':_0x4d82e2['params']['id']}})['then'](function(_0x2d9cc1){if(_[_0x5013('0x56')](_0x2d9cc1)){throw new ReferenceError(_0x5013('0x57'));}return _0x2d9cc1;})['then'](function(_0x1e5fe0){var _0x48e115=_0x1e5fe0[_0x5013('0x4a')];logger[_0x5013('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x48e115);if(!_[_0x5013('0x56')](_0x1e5fe0[_0x5013('0x4a')])&&fs[_0x5013('0x4e')](_0x48e115)){logger[_0x5013('0x58')](_0x5013('0x59')+_0x48e115+_0x5013('0x5a'));fs[_0x5013('0x5b')](_0x48e115);}_0x48e115=_0x48e115+_0x5013('0x5c');if(!_['isNil'](_0x1e5fe0[_0x5013('0x4a')])&&fs[_0x5013('0x4e')](_0x48e115)){logger['info'](_0x5013('0x59')+_0x48e115+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5013('0x5b')](_0x48e115);}return _0x1e5fe0;})['then'](function(_0xe5406e){if(!_0xe5406e)throw new InternalError();return _0xe5406e['destroy']();})['then'](function(){_0x62dabe[_0x5013('0x16')](0xcc)[_0x5013('0x17')]();})['catch'](handleError(_0x62dabe,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 30f03bc..6e9ebaa 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 _0x4325=['moment','bluebird','rimraf','../../config/environment','./squareRecording.attributes','SquareRecording','lodash','util','api'];(function(_0x2458c4,_0xe564b){var _0x3c8325=function(_0x89452c){while(--_0x89452c){_0x2458c4['push'](_0x2458c4['shift']());}};_0x3c8325(++_0xe564b);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var logger=require('../../config/logger')(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var attributes=require(_0x5432('0x7'));module['exports']=function(_0x209e2e,_0xbb0075){return _0x209e2e['define'](_0x5432('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fd4=['./squareRecording.attributes','define','SquareRecording','square_recordings','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x504dc5,_0xd04d65){var _0x557d48=function(_0x4a57ca){while(--_0x4a57ca){_0x504dc5['push'](_0x504dc5['shift']());}};_0x557d48(++_0xd04d65);}(_0x8fd4,0x178));var _0x48fd=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x8fd4[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require('lodash');var util=require(_0x48fd('0x0'));var logger=require(_0x48fd('0x1'))(_0x48fd('0x2'));var moment=require(_0x48fd('0x3'));var BPromise=require(_0x48fd('0x4'));var rp=require(_0x48fd('0x5'));var fs=require('fs');var path=require(_0x48fd('0x6'));var rimraf=require('rimraf');var config=require(_0x48fd('0x7'));var attributes=require(_0x48fd('0x8'));module['exports']=function(_0x2b7864,_0x1d3c43){return _0x2b7864[_0x48fd('0x9')](_0x48fd('0xa'),attributes,{'tableName':_0x48fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index d371e5e..853b939 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 _0xbac1=['message','info','result','CreateSquareRecording','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3010f3,_0x5f49da){var _0x34cd9e=function(_0x56a2df){while(--_0x56a2df){_0x3010f3['push'](_0x3010f3['shift']());}};_0x34cd9e(++_0x5f49da);}(_0xbac1,0x9f));var _0x1bac=function(_0x5df2e1,_0x512639){_0x5df2e1=_0x5df2e1-0x0;var _0x3c288c=_0xbac1[_0x5df2e1];return _0x3c288c;};'use strict';var _=require(_0x1bac('0x0'));var util=require(_0x1bac('0x1'));var moment=require(_0x1bac('0x2'));var BPromise=require(_0x1bac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bac('0x4'));var db=require(_0x1bac('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1bac('0x6'));var config=require(_0x1bac('0x7'));var jayson=require(_0x1bac('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ec3af,_0x259b28,_0x37f956){return new BPromise(function(_0x15aba4,_0x302d36){return client[_0x1bac('0x9')](_0x3ec3af,_0x37f956)['then'](function(_0x19a528){logger['info'](_0x1bac('0xa'),_0x259b28,_0x1bac('0xb'));logger[_0x1bac('0xc')](_0x1bac('0xd'),_0x259b28,'request\x20sent',JSON[_0x1bac('0xe')](_0x19a528));if(_0x19a528['error']){if(_0x19a528[_0x1bac('0xf')]['code']===0x1f4){logger[_0x1bac('0xf')](_0x1bac('0xa'),_0x259b28,_0x19a528[_0x1bac('0xf')][_0x1bac('0x10')]);return _0x302d36(_0x19a528[_0x1bac('0xf')]['message']);}logger[_0x1bac('0xf')]('SquareRecording,\x20%s,\x20%s',_0x259b28,_0x19a528[_0x1bac('0xf')][_0x1bac('0x10')]);return _0x15aba4(_0x19a528[_0x1bac('0xf')][_0x1bac('0x10')]);}else{logger[_0x1bac('0x11')](_0x1bac('0xa'),_0x259b28,_0x1bac('0xb'));_0x15aba4(_0x19a528[_0x1bac('0x12')][_0x1bac('0x10')]);}})['catch'](function(_0x51dba8){logger[_0x1bac('0xf')](_0x1bac('0xa'),_0x259b28,_0x51dba8);_0x302d36(_0x51dba8);});});}exports[_0x1bac('0x13')]=function(_0x288001){var _0x5b7e9f=this;return new Promise(function(_0x2ae2da,_0x4e0e68){return db['SquareRecording'][_0x1bac('0x14')](_0x288001[_0x1bac('0x15')],{'raw':_0x288001[_0x1bac('0x16')]?_0x288001['options'][_0x1bac('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x117a6e){logger[_0x1bac('0x11')](_0x1bac('0x13'),_0x288001);logger[_0x1bac('0xc')](_0x1bac('0x13'),_0x288001,JSON[_0x1bac('0xe')](_0x117a6e));_0x2ae2da(_0x117a6e);})[_0x1bac('0x18')](function(_0x41b3cc){logger[_0x1bac('0xf')](_0x1bac('0x13'),_0x41b3cc['message'],_0x288001);_0x4e0e68(_0x5b7e9f[_0x1bac('0xf')](0x1f4,_0x41b3cc[_0x1bac('0x10')]));});});}; \ No newline at end of file +var _0x8e05=['../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2a6d8c,_0x19c800){var _0x31a401=function(_0x2bd376){while(--_0x2bd376){_0x2a6d8c['push'](_0x2a6d8c['shift']());}};_0x31a401(++_0x19c800);}(_0x8e05,0x6c));var _0x58e0=function(_0x187399,_0x40c56d){_0x187399=_0x187399-0x0;var _0x40fa92=_0x8e05[_0x187399];return _0x40fa92;};'use strict';var _=require('lodash');var util=require(_0x58e0('0x0'));var moment=require(_0x58e0('0x1'));var BPromise=require(_0x58e0('0x2'));var rs=require(_0x58e0('0x3'));var fs=require('fs');var Redis=require(_0x58e0('0x4'));var db=require(_0x58e0('0x5'))['db'];var utils=require(_0x58e0('0x6'));var logger=require('../../config/logger')(_0x58e0('0x7'));var config=require(_0x58e0('0x8'));var jayson=require(_0x58e0('0x9'));var client=jayson[_0x58e0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373c9b,_0x25e990,_0x60629a){return new BPromise(function(_0x15ef88,_0x199b65){return client[_0x58e0('0xb')](_0x373c9b,_0x60629a)[_0x58e0('0xc')](function(_0x37d72c){logger[_0x58e0('0xd')](_0x58e0('0xe'),_0x25e990,_0x58e0('0xf'));logger[_0x58e0('0x10')](_0x58e0('0x11'),_0x25e990,_0x58e0('0xf'),JSON['stringify'](_0x37d72c));if(_0x37d72c['error']){if(_0x37d72c[_0x58e0('0x12')][_0x58e0('0x13')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x25e990,_0x37d72c[_0x58e0('0x12')][_0x58e0('0x14')]);return _0x199b65(_0x37d72c[_0x58e0('0x12')]['message']);}logger['error'](_0x58e0('0xe'),_0x25e990,_0x37d72c['error'][_0x58e0('0x14')]);return _0x15ef88(_0x37d72c[_0x58e0('0x12')][_0x58e0('0x14')]);}else{logger[_0x58e0('0xd')](_0x58e0('0xe'),_0x25e990,_0x58e0('0xf'));_0x15ef88(_0x37d72c[_0x58e0('0x15')]['message']);}})[_0x58e0('0x16')](function(_0x447f6d){logger[_0x58e0('0x12')](_0x58e0('0xe'),_0x25e990,_0x447f6d);_0x199b65(_0x447f6d);});});}exports[_0x58e0('0x17')]=function(_0x5523f8){var _0x5d6eaa=this;return new Promise(function(_0x27ffbf,_0x4520c1){return db['SquareRecording'][_0x58e0('0x18')](_0x5523f8[_0x58e0('0x19')],{'raw':_0x5523f8[_0x58e0('0x1a')]?_0x5523f8[_0x58e0('0x1a')][_0x58e0('0x1b')]===undefined?!![]:![]:!![]})[_0x58e0('0xc')](function(_0x40a62b){logger['info']('CreateSquareRecording',_0x5523f8);logger[_0x58e0('0x10')](_0x58e0('0x17'),_0x5523f8,JSON[_0x58e0('0x1c')](_0x40a62b));_0x27ffbf(_0x40a62b);})[_0x58e0('0x16')](function(_0x27a17d){logger['error'](_0x58e0('0x17'),_0x27a17d[_0x58e0('0x14')],_0x5523f8);_0x4520c1(_0x5d6eaa[_0x58e0('0x12')](0x1f4,_0x27a17d[_0x58e0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index fe953fb..630a287 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 _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(_0x4d9c3b,_0x3c4663){var _0x35c391=function(_0x22ac2e){while(--_0x22ac2e){_0x4d9c3b['push'](_0x4d9c3b['shift']());}};_0x35c391(++_0x3c4663);}(_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('./squareReport.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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4e4841,_0x366c96){var _0x9d22b0=function(_0x1f3f1f){while(--_0x1f3f1f){_0x4e4841['push'](_0x4e4841['shift']());}};_0x9d22b0(++_0x366c96);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 3bef285..5d1cd6f 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 _0x3c69=['BOOLEAN','STRING','DATE'];(function(_0x1b2626,_0x2b8a50){var _0x3b2a61=function(_0x28b22d){while(--_0x28b22d){_0x1b2626['push'](_0x1b2626['shift']());}};_0x3b2a61(++_0x2b8a50);}(_0x3c69,0x1bd));var _0x93c6=function(_0x599fdc,_0x1f1138){_0x599fdc=_0x599fdc-0x0;var _0x98ea0f=_0x3c69[_0x599fdc];return _0x98ea0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x93c6('0x0')]},'request':{'type':Sequelize[_0x93c6('0x0')]},'channel':{'type':Sequelize[_0x93c6('0x0')]},'language':{'type':Sequelize[_0x93c6('0x0')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x93c6('0x0')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x93c6('0x0')]},'callingani2':{'type':Sequelize[_0x93c6('0x0')]},'callington':{'type':Sequelize[_0x93c6('0x0')]},'callingtns':{'type':Sequelize[_0x93c6('0x0')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x93c6('0x0')]},'context':{'type':Sequelize[_0x93c6('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x93c6('0x0')]},'enhanced':{'type':Sequelize[_0x93c6('0x0')]},'accountcode':{'type':Sequelize[_0x93c6('0x0')]},'threadid':{'type':Sequelize[_0x93c6('0x0')]},'project_name':{'type':Sequelize[_0x93c6('0x0')]},'joinAt':{'type':Sequelize[_0x93c6('0x1')]},'leaveAt':{'type':Sequelize[_0x93c6('0x1')]},'bot':{'type':Sequelize[_0x93c6('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x20a1=['STRING','DATE','sequelize','exports'];(function(_0x5de6f7,_0x297876){var _0x140a10=function(_0x57edc9){while(--_0x57edc9){_0x5de6f7['push'](_0x5de6f7['shift']());}};_0x140a10(++_0x297876);}(_0x20a1,0x166));var _0x120a=function(_0x2ff9a0,_0x56adf2){_0x2ff9a0=_0x2ff9a0-0x0;var _0x1c5735=_0x20a1[_0x2ff9a0];return _0x1c5735;};'use strict';var Sequelize=require(_0x120a('0x0'));module[_0x120a('0x1')]={'network':{'type':Sequelize[_0x120a('0x2')]},'network_script':{'type':Sequelize[_0x120a('0x2')]},'request':{'type':Sequelize[_0x120a('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x120a('0x2')]},'type':{'type':Sequelize[_0x120a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x120a('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x120a('0x2')]},'callingpres':{'type':Sequelize[_0x120a('0x2')]},'callingani2':{'type':Sequelize[_0x120a('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x120a('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x120a('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x120a('0x2')]},'enhanced':{'type':Sequelize[_0x120a('0x2')]},'accountcode':{'type':Sequelize[_0x120a('0x2')]},'threadid':{'type':Sequelize[_0x120a('0x2')]},'project_name':{'type':Sequelize[_0x120a('0x2')]},'joinAt':{'type':Sequelize[_0x120a('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6cc87d2..35174c4 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 _0x731b=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filters','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x731b,0x190));var _0xb731=function(_0x27ca5b,_0x41becd){_0x27ca5b=_0x27ca5b-0x0;var _0x57021e=_0x731b[_0x27ca5b];return _0x57021e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb731('0x0'));var zipdir=require(_0xb731('0x1'));var jsonpatch=require(_0xb731('0x2'));var rp=require(_0xb731('0x3'));var moment=require(_0xb731('0x4'));var BPromise=require(_0xb731('0x5'));var Mustache=require('mustache');var util=require(_0xb731('0x6'));var path=require('path');var sox=require(_0xb731('0x7'));var csv=require(_0xb731('0x8'));var ejs=require(_0xb731('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb731('0xa'));var crypto=require('crypto');var jsforce=require(_0xb731('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb731('0x8'));var querystring=require(_0xb731('0xc'));var Papa=require(_0xb731('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb731('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb731('0xf'));var logger=require(_0xb731('0x10'))(_0xb731('0x11'));var utils=require(_0xb731('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb731('0x13'))['db'];function respondWithStatusCode(_0x4a2c03,_0x102ff6){_0x102ff6=_0x102ff6||0xcc;return function(_0x1f2bb8){if(_0x1f2bb8){return _0x4a2c03[_0xb731('0x14')](_0x102ff6);}return _0x4a2c03[_0xb731('0x15')](_0x102ff6)[_0xb731('0x16')]();};}function respondWithResult(_0x2eb73d,_0x559e37){_0x559e37=_0x559e37||0xc8;return function(_0x1d940e){if(_0x1d940e){return _0x2eb73d['status'](_0x559e37)[_0xb731('0x17')](_0x1d940e);}};}function respondWithFilteredResult(_0x4e75b3,_0x5de223){return function(_0x2485e0){if(_0x2485e0){var _0x18d61a=typeof _0x5de223[_0xb731('0x18')]===_0xb731('0x19')&&typeof _0x5de223['limit']==='undefined';var _0x599b24=_0x2485e0[_0xb731('0x1a')];var _0x1d2f7e=_0x18d61a?0x0:_0x5de223[_0xb731('0x18')];var _0x5ef6fc=_0x18d61a?_0x2485e0[_0xb731('0x1a')]:_0x5de223['offset']+_0x5de223[_0xb731('0x1b')];var _0x562417;if(_0x5ef6fc>=_0x599b24){_0x5ef6fc=_0x599b24;_0x562417=0xc8;}else{_0x562417=0xce;}_0x4e75b3[_0xb731('0x15')](_0x562417);return _0x4e75b3['set'](_0xb731('0x1c'),_0x1d2f7e+'-'+_0x5ef6fc+'/'+_0x599b24)[_0xb731('0x17')](_0x2485e0);}return null;};}function patchUpdates(_0x302049){return function(_0x3f7c9d){try{jsonpatch['apply'](_0x3f7c9d,_0x302049,!![]);}catch(_0x13c3e3){return BPromise[_0xb731('0x1d')](_0x13c3e3);}return _0x3f7c9d[_0xb731('0x1e')]();};}function saveUpdates(_0x829da,_0x5b2ca0){return function(_0x4c5471){if(_0x4c5471){return _0x4c5471[_0xb731('0x1f')](_0x829da)['then'](function(_0x9f7cb4){return _0x9f7cb4;});}return null;};}function removeEntity(_0x1aa981,_0x31dcc6){return function(_0x44d775){if(_0x44d775){return _0x44d775[_0xb731('0x20')]()[_0xb731('0x21')](function(){_0x1aa981[_0xb731('0x15')](0xcc)[_0xb731('0x16')]();});}};}function handleEntityNotFound(_0x4d918c,_0x56dcac){return function(_0x4127bf){if(!_0x4127bf){_0x4d918c[_0xb731('0x14')](0x194);}return _0x4127bf;};}function handleError(_0xdaea94,_0x48450f){_0x48450f=_0x48450f||0x1f4;return function(_0x177ab3){logger[_0xb731('0x22')](_0x177ab3[_0xb731('0x23')]);if(_0x177ab3[_0xb731('0x24')]){delete _0x177ab3[_0xb731('0x24')];}_0xdaea94['status'](_0x48450f)['send'](_0x177ab3);};}exports[_0xb731('0x25')]=function(_0x1f8230,_0x4c0707){var _0x44e69e={},_0x355d14={},_0x57f09e={'count':0x0,'rows':[]};var _0x235182=_[_0xb731('0x26')](db[_0xb731('0x27')][_0xb731('0x28')],function(_0x48f34f){return{'name':_0x48f34f[_0xb731('0x29')],'type':_0x48f34f['type'][_0xb731('0x2a')]};});_0x355d14[_0xb731('0x2b')]=_[_0xb731('0x26')](_0x235182,_0xb731('0x24'));_0x355d14[_0xb731('0x2c')]=_[_0xb731('0x2d')](_0x1f8230[_0xb731('0x2c')]);_0x355d14['filters']=_['intersection'](_0x355d14[_0xb731('0x2b')],_0x355d14['query']);_0x44e69e[_0xb731('0x2e')]=_[_0xb731('0x2f')](_0x355d14[_0xb731('0x2b')],qs[_0xb731('0x30')](_0x1f8230[_0xb731('0x2c')]['fields']));_0x44e69e[_0xb731('0x2e')]=_0x44e69e['attributes'][_0xb731('0x31')]?_0x44e69e[_0xb731('0x2e')]:_0x355d14[_0xb731('0x2b')];if(!_0x1f8230[_0xb731('0x2c')][_0xb731('0x32')](_0xb731('0x33'))){_0x44e69e[_0xb731('0x1b')]=qs['limit'](_0x1f8230[_0xb731('0x2c')][_0xb731('0x1b')]);_0x44e69e[_0xb731('0x18')]=qs[_0xb731('0x18')](_0x1f8230[_0xb731('0x2c')][_0xb731('0x18')]);}_0x44e69e['order']=qs['sort'](_0x1f8230[_0xb731('0x2c')]['sort']);_0x44e69e[_0xb731('0x34')]=qs['filters'](_[_0xb731('0x35')](_0x1f8230['query'],_0x355d14['filters']),_0x235182);if(_0x1f8230[_0xb731('0x2c')][_0xb731('0x36')]){_0x44e69e['where']=_[_0xb731('0x37')](_0x44e69e[_0xb731('0x34')],{'$or':_[_0xb731('0x26')](_0x235182,function(_0x4dffa6){if(_0x4dffa6[_0xb731('0x38')]!==_0xb731('0x39')){var _0x10d82e={};_0x10d82e[_0x4dffa6[_0xb731('0x24')]]={'$like':'%'+_0x1f8230[_0xb731('0x2c')][_0xb731('0x36')]+'%'};return _0x10d82e;}})});}_0x44e69e=_['merge']({},_0x44e69e,_0x1f8230[_0xb731('0x3a')]);var _0x104b7d={'where':_0x44e69e[_0xb731('0x34')]};return db[_0xb731('0x27')][_0xb731('0x1a')](_0x104b7d)[_0xb731('0x21')](function(_0x5dd7fb){_0x57f09e[_0xb731('0x1a')]=_0x5dd7fb;if(_0x1f8230['query'][_0xb731('0x3b')]){_0x44e69e[_0xb731('0x3c')]=[{'all':!![]}];}return db[_0xb731('0x27')][_0xb731('0x3d')](_0x44e69e);})[_0xb731('0x21')](function(_0x3a851e){_0x57f09e[_0xb731('0x3e')]=_0x3a851e;return _0x57f09e;})[_0xb731('0x21')](respondWithFilteredResult(_0x4c0707,_0x44e69e))[_0xb731('0x3f')](handleError(_0x4c0707,null));};exports[_0xb731('0x40')]=function(_0x8b9f95,_0x5e408d){var _0x586dc2={'raw':!![],'where':{'id':_0x8b9f95[_0xb731('0x41')]['id']}},_0x126c31={};_0x126c31[_0xb731('0x2b')]=_[_0xb731('0x2d')](db['SquareReport'][_0xb731('0x28')]);_0x126c31[_0xb731('0x2c')]=_[_0xb731('0x2d')](_0x8b9f95[_0xb731('0x2c')]);_0x126c31[_0xb731('0x42')]=_[_0xb731('0x2f')](_0x126c31['model'],_0x126c31[_0xb731('0x2c')]);_0x586dc2[_0xb731('0x2e')]=_['intersection'](_0x126c31[_0xb731('0x2b')],qs[_0xb731('0x30')](_0x8b9f95[_0xb731('0x2c')][_0xb731('0x30')]));_0x586dc2['attributes']=_0x586dc2['attributes'][_0xb731('0x31')]?_0x586dc2[_0xb731('0x2e')]:_0x126c31[_0xb731('0x2b')];if(_0x8b9f95['query'][_0xb731('0x3b')]){_0x586dc2['include']=[{'all':!![]}];}_0x586dc2=_[_0xb731('0x37')]({},_0x586dc2,_0x8b9f95[_0xb731('0x3a')]);return db[_0xb731('0x27')][_0xb731('0x43')](_0x586dc2)[_0xb731('0x21')](handleEntityNotFound(_0x5e408d,null))[_0xb731('0x21')](respondWithResult(_0x5e408d,null))['catch'](handleError(_0x5e408d,null));};exports['create']=function(_0x17669d,_0x3d10db){return db['SquareReport']['create'](_0x17669d[_0xb731('0x44')],{})[_0xb731('0x21')](respondWithResult(_0x3d10db,0xc9))[_0xb731('0x3f')](handleError(_0x3d10db,null));};exports['update']=function(_0x46546d,_0x374c28){if(_0x46546d[_0xb731('0x44')]['id']){delete _0x46546d['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x46546d[_0xb731('0x41')]['id']}})[_0xb731('0x21')](handleEntityNotFound(_0x374c28,null))['then'](saveUpdates(_0x46546d[_0xb731('0x44')],null))[_0xb731('0x21')](respondWithResult(_0x374c28,null))[_0xb731('0x3f')](handleError(_0x374c28,null));};exports[_0xb731('0x20')]=function(_0x43341a,_0x13d345){return db[_0xb731('0x27')][_0xb731('0x43')]({'where':{'id':_0x43341a['params']['id']}})[_0xb731('0x21')](handleEntityNotFound(_0x13d345,null))[_0xb731('0x21')](removeEntity(_0x13d345,null))[_0xb731('0x3f')](handleError(_0x13d345,null));};exports[_0xb731('0x45')]=function(_0x5e9286,_0xeeef65){return db[_0xb731('0x27')][_0xb731('0x45')]()[_0xb731('0x21')](respondWithResult(_0xeeef65,null))[_0xb731('0x3f')](handleError(_0xeeef65,null));}; \ No newline at end of file +var _0xbcf1=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','then','destroy','stack','name','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','SquareReport','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x290c31,_0x534b8a){var _0x2eb0ac=function(_0x54bd7){while(--_0x54bd7){_0x290c31['push'](_0x290c31['shift']());}};_0x2eb0ac(++_0x534b8a);}(_0xbcf1,0x16a));var _0x1bcf=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xbcf1[_0x23b655];return _0x364b32;};'use strict';var emlformat=require(_0x1bcf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1bcf('0x1'));var jsonpatch=require(_0x1bcf('0x2'));var rp=require(_0x1bcf('0x3'));var moment=require('moment');var BPromise=require(_0x1bcf('0x4'));var Mustache=require(_0x1bcf('0x5'));var util=require(_0x1bcf('0x6'));var path=require(_0x1bcf('0x7'));var sox=require(_0x1bcf('0x8'));var csv=require(_0x1bcf('0x9'));var ejs=require(_0x1bcf('0xa'));var fs=require('fs');var fs_extra=require(_0x1bcf('0xb'));var _=require(_0x1bcf('0xc'));var squel=require(_0x1bcf('0xd'));var crypto=require(_0x1bcf('0xe'));var jsforce=require(_0x1bcf('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1bcf('0x10'));var Papa=require(_0x1bcf('0x11'));var Redis=require(_0x1bcf('0x12'));var authService=require(_0x1bcf('0x13'));var qs=require(_0x1bcf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1bcf('0x15'));var logger=require(_0x1bcf('0x16'))(_0x1bcf('0x17'));var utils=require(_0x1bcf('0x18'));var config=require(_0x1bcf('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1bcf('0x1a'))['db'];function respondWithStatusCode(_0x307509,_0x4c834f){_0x4c834f=_0x4c834f||0xcc;return function(_0x52a899){if(_0x52a899){return _0x307509[_0x1bcf('0x1b')](_0x4c834f);}return _0x307509['status'](_0x4c834f)[_0x1bcf('0x1c')]();};}function respondWithResult(_0x3cd14e,_0xa3952d){_0xa3952d=_0xa3952d||0xc8;return function(_0x28ddf7){if(_0x28ddf7){return _0x3cd14e['status'](_0xa3952d)[_0x1bcf('0x1d')](_0x28ddf7);}};}function respondWithFilteredResult(_0x1e8e2c,_0x3c5c8a){return function(_0x170476){if(_0x170476){var _0x4f40f4=typeof _0x3c5c8a[_0x1bcf('0x1e')]===_0x1bcf('0x1f')&&typeof _0x3c5c8a[_0x1bcf('0x20')]===_0x1bcf('0x1f');var _0x2ac6d7=_0x170476[_0x1bcf('0x21')];var _0x3601c3=_0x4f40f4?0x0:_0x3c5c8a[_0x1bcf('0x1e')];var _0x350f9a=_0x4f40f4?_0x170476[_0x1bcf('0x21')]:_0x3c5c8a[_0x1bcf('0x1e')]+_0x3c5c8a[_0x1bcf('0x20')];var _0x2ff94a;if(_0x350f9a>=_0x2ac6d7){_0x350f9a=_0x2ac6d7;_0x2ff94a=0xc8;}else{_0x2ff94a=0xce;}_0x1e8e2c[_0x1bcf('0x22')](_0x2ff94a);return _0x1e8e2c[_0x1bcf('0x23')](_0x1bcf('0x24'),_0x3601c3+'-'+_0x350f9a+'/'+_0x2ac6d7)['json'](_0x170476);}return null;};}function patchUpdates(_0xb714a0){return function(_0x170ff9){try{jsonpatch['apply'](_0x170ff9,_0xb714a0,!![]);}catch(_0x54140b){return BPromise['reject'](_0x54140b);}return _0x170ff9[_0x1bcf('0x25')]();};}function saveUpdates(_0x4c593e,_0x44b691){return function(_0x4f6fa3){if(_0x4f6fa3){return _0x4f6fa3[_0x1bcf('0x26')](_0x4c593e)[_0x1bcf('0x27')](function(_0x16b2a2){return _0x16b2a2;});}return null;};}function removeEntity(_0x42b1b5,_0x5abaea){return function(_0x220aeb){if(_0x220aeb){return _0x220aeb[_0x1bcf('0x28')]()[_0x1bcf('0x27')](function(){_0x42b1b5[_0x1bcf('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x464176,_0x291e37){return function(_0x4d09e0){if(!_0x4d09e0){_0x464176[_0x1bcf('0x1b')](0x194);}return _0x4d09e0;};}function handleError(_0x1f2859,_0x17f1da){_0x17f1da=_0x17f1da||0x1f4;return function(_0x3a9b38){logger['error'](_0x3a9b38[_0x1bcf('0x29')]);if(_0x3a9b38[_0x1bcf('0x2a')]){delete _0x3a9b38['name'];}_0x1f2859['status'](_0x17f1da)['send'](_0x3a9b38);};}exports[_0x1bcf('0x2b')]=function(_0x172933,_0x55ee91){var _0x2aa1ce={},_0xe12161={},_0x29be9d={'count':0x0,'rows':[]};var _0x256f69=_['map'](db['SquareReport']['rawAttributes'],function(_0x58bf4d){return{'name':_0x58bf4d[_0x1bcf('0x2c')],'type':_0x58bf4d[_0x1bcf('0x2d')]['key']};});_0xe12161[_0x1bcf('0x2e')]=_[_0x1bcf('0x2f')](_0x256f69,'name');_0xe12161[_0x1bcf('0x30')]=_[_0x1bcf('0x31')](_0x172933[_0x1bcf('0x30')]);_0xe12161[_0x1bcf('0x32')]=_[_0x1bcf('0x33')](_0xe12161[_0x1bcf('0x2e')],_0xe12161[_0x1bcf('0x30')]);_0x2aa1ce[_0x1bcf('0x34')]=_[_0x1bcf('0x33')](_0xe12161[_0x1bcf('0x2e')],qs[_0x1bcf('0x35')](_0x172933['query'][_0x1bcf('0x35')]));_0x2aa1ce[_0x1bcf('0x34')]=_0x2aa1ce['attributes'][_0x1bcf('0x36')]?_0x2aa1ce[_0x1bcf('0x34')]:_0xe12161[_0x1bcf('0x2e')];if(!_0x172933[_0x1bcf('0x30')][_0x1bcf('0x37')](_0x1bcf('0x38'))){_0x2aa1ce[_0x1bcf('0x20')]=qs['limit'](_0x172933[_0x1bcf('0x30')]['limit']);_0x2aa1ce[_0x1bcf('0x1e')]=qs[_0x1bcf('0x1e')](_0x172933[_0x1bcf('0x30')][_0x1bcf('0x1e')]);}_0x2aa1ce[_0x1bcf('0x39')]=qs[_0x1bcf('0x3a')](_0x172933['query'][_0x1bcf('0x3a')]);_0x2aa1ce[_0x1bcf('0x3b')]=qs['filters'](_[_0x1bcf('0x3c')](_0x172933[_0x1bcf('0x30')],_0xe12161[_0x1bcf('0x32')]),_0x256f69);if(_0x172933['query'][_0x1bcf('0x3d')]){_0x2aa1ce[_0x1bcf('0x3b')]=_[_0x1bcf('0x3e')](_0x2aa1ce[_0x1bcf('0x3b')],{'$or':_[_0x1bcf('0x2f')](_0x256f69,function(_0x52ac70){if(_0x52ac70[_0x1bcf('0x2d')]!==_0x1bcf('0x3f')){var _0x11fe60={};_0x11fe60[_0x52ac70[_0x1bcf('0x2a')]]={'$like':'%'+_0x172933[_0x1bcf('0x30')]['filter']+'%'};return _0x11fe60;}})});}_0x2aa1ce=_[_0x1bcf('0x3e')]({},_0x2aa1ce,_0x172933[_0x1bcf('0x40')]);var _0x17dc91={'where':_0x2aa1ce['where']};return db['SquareReport']['count'](_0x17dc91)[_0x1bcf('0x27')](function(_0x5e6bcc){_0x29be9d[_0x1bcf('0x21')]=_0x5e6bcc;if(_0x172933['query']['includeAll']){_0x2aa1ce[_0x1bcf('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0x1bcf('0x42')](_0x2aa1ce);})[_0x1bcf('0x27')](function(_0x61c695){_0x29be9d[_0x1bcf('0x43')]=_0x61c695;return _0x29be9d;})[_0x1bcf('0x27')](respondWithFilteredResult(_0x55ee91,_0x2aa1ce))[_0x1bcf('0x44')](handleError(_0x55ee91,null));};exports['show']=function(_0x19078d,_0x1045d9){var _0x5df187={'raw':!![],'where':{'id':_0x19078d[_0x1bcf('0x45')]['id']}},_0x5096e8={};_0x5096e8[_0x1bcf('0x2e')]=_[_0x1bcf('0x31')](db[_0x1bcf('0x46')][_0x1bcf('0x47')]);_0x5096e8[_0x1bcf('0x30')]=_[_0x1bcf('0x31')](_0x19078d[_0x1bcf('0x30')]);_0x5096e8[_0x1bcf('0x32')]=_[_0x1bcf('0x33')](_0x5096e8['model'],_0x5096e8[_0x1bcf('0x30')]);_0x5df187[_0x1bcf('0x34')]=_[_0x1bcf('0x33')](_0x5096e8['model'],qs[_0x1bcf('0x35')](_0x19078d['query']['fields']));_0x5df187[_0x1bcf('0x34')]=_0x5df187[_0x1bcf('0x34')][_0x1bcf('0x36')]?_0x5df187['attributes']:_0x5096e8[_0x1bcf('0x2e')];if(_0x19078d[_0x1bcf('0x30')][_0x1bcf('0x48')]){_0x5df187[_0x1bcf('0x41')]=[{'all':!![]}];}_0x5df187=_[_0x1bcf('0x3e')]({},_0x5df187,_0x19078d['options']);return db['SquareReport'][_0x1bcf('0x49')](_0x5df187)[_0x1bcf('0x27')](handleEntityNotFound(_0x1045d9,null))[_0x1bcf('0x27')](respondWithResult(_0x1045d9,null))[_0x1bcf('0x44')](handleError(_0x1045d9,null));};exports[_0x1bcf('0x4a')]=function(_0x45c9e1,_0x529010){return db[_0x1bcf('0x46')][_0x1bcf('0x4a')](_0x45c9e1[_0x1bcf('0x4b')],{})[_0x1bcf('0x27')](respondWithResult(_0x529010,0xc9))[_0x1bcf('0x44')](handleError(_0x529010,null));};exports[_0x1bcf('0x26')]=function(_0x30e8f6,_0x51015a){if(_0x30e8f6[_0x1bcf('0x4b')]['id']){delete _0x30e8f6[_0x1bcf('0x4b')]['id'];}return db[_0x1bcf('0x46')]['find']({'where':{'id':_0x30e8f6[_0x1bcf('0x45')]['id']}})[_0x1bcf('0x27')](handleEntityNotFound(_0x51015a,null))[_0x1bcf('0x27')](saveUpdates(_0x30e8f6[_0x1bcf('0x4b')],null))[_0x1bcf('0x27')](respondWithResult(_0x51015a,null))[_0x1bcf('0x44')](handleError(_0x51015a,null));};exports['destroy']=function(_0x20f7a3,_0xcc2dfc){return db[_0x1bcf('0x46')][_0x1bcf('0x49')]({'where':{'id':_0x20f7a3['params']['id']}})[_0x1bcf('0x27')](handleEntityNotFound(_0xcc2dfc,null))['then'](removeEntity(_0xcc2dfc,null))['catch'](handleError(_0xcc2dfc,null));};exports['describe']=function(_0x338981,_0x1bec53){return db['SquareReport'][_0x1bcf('0x4c')]()[_0x1bcf('0x27')](respondWithResult(_0x1bec53,null))[_0x1bcf('0x44')](handleError(_0x1bec53,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 49a9e85..c6d1f3b 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 _0x0691=['../../config/environment','define','SquareReport','report_square','uniqueid','project_name','leaveAt','util','moment','bluebird','path','rimraf'];(function(_0x5622d4,_0x396780){var _0x353176=function(_0x3d1ede){while(--_0x3d1ede){_0x5622d4['push'](_0x5622d4['shift']());}};_0x353176(++_0x396780);}(_0x0691,0x133));var _0x1069=function(_0x5ee908,_0x1ef159){_0x5ee908=_0x5ee908-0x0;var _0x4aebf3=_0x0691[_0x5ee908];return _0x4aebf3;};'use strict';var _=require('lodash');var util=require(_0x1069('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1069('0x1'));var BPromise=require(_0x1069('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1069('0x3'));var rimraf=require(_0x1069('0x4'));var config=require(_0x1069('0x5'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x1a0a7e,_0x3f2ddb){return _0x1a0a7e[_0x1069('0x6')](_0x1069('0x7'),attributes,{'tableName':_0x1069('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1069('0x9'),_0x1069('0xa')]},{'name':_0x1069('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x86fa=['define','SquareReport','project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x86fa,0x100));var _0xa86f=function(_0x1efec5,_0x309f56){_0x1efec5=_0x1efec5-0x0;var _0x1a9079=_0x86fa[_0x1efec5];return _0x1a9079;};'use strict';var _=require(_0xa86f('0x0'));var util=require(_0xa86f('0x1'));var logger=require(_0xa86f('0x2'))(_0xa86f('0x3'));var moment=require(_0xa86f('0x4'));var BPromise=require('bluebird');var rp=require(_0xa86f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa86f('0x6'));var config=require(_0xa86f('0x7'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x443825,_0x59fd0b){return _0x443825[_0xa86f('0x8')](_0xa86f('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0xa86f('0xa')]},{'name':_0xa86f('0xb'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 83999dc..92f9df7 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 _0x471a=['UpdateSquareReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','raw','update','where','attributes','limit'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x471a,0xa6));var _0xa471=function(_0xf549a4,_0x58c9cd){_0xf549a4=_0xf549a4-0x0;var _0x57bf42=_0x471a[_0xf549a4];return _0x57bf42;};'use strict';var _=require('lodash');var util=require(_0xa471('0x0'));var moment=require(_0xa471('0x1'));var BPromise=require('bluebird');var rs=require(_0xa471('0x2'));var fs=require('fs');var Redis=require(_0xa471('0x3'));var db=require(_0xa471('0x4'))['db'];var utils=require(_0xa471('0x5'));var logger=require(_0xa471('0x6'))('rpc');var config=require(_0xa471('0x7'));var jayson=require(_0xa471('0x8'));var client=jayson[_0xa471('0x9')][_0xa471('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7e7d19,_0x24e934,_0x537702){return new BPromise(function(_0x33df99,_0x239fb8){return client[_0xa471('0xb')](_0x7e7d19,_0x537702)[_0xa471('0xc')](function(_0x11dccf){logger[_0xa471('0xd')]('SquareReport,\x20%s,\x20%s',_0x24e934,_0xa471('0xe'));logger['debug'](_0xa471('0xf'),_0x24e934,'request\x20sent',JSON[_0xa471('0x10')](_0x11dccf));if(_0x11dccf[_0xa471('0x11')]){if(_0x11dccf[_0xa471('0x11')][_0xa471('0x12')]===0x1f4){logger[_0xa471('0x11')](_0xa471('0x13'),_0x24e934,_0x11dccf[_0xa471('0x11')][_0xa471('0x14')]);return _0x239fb8(_0x11dccf['error'][_0xa471('0x14')]);}logger[_0xa471('0x11')](_0xa471('0x13'),_0x24e934,_0x11dccf['error'][_0xa471('0x14')]);return _0x33df99(_0x11dccf[_0xa471('0x11')][_0xa471('0x14')]);}else{logger[_0xa471('0xd')](_0xa471('0x13'),_0x24e934,_0xa471('0xe'));_0x33df99(_0x11dccf[_0xa471('0x15')][_0xa471('0x14')]);}})[_0xa471('0x16')](function(_0x426641){logger[_0xa471('0x11')](_0xa471('0x13'),_0x24e934,_0x426641);_0x239fb8(_0x426641);});});}exports[_0xa471('0x17')]=function(_0x28e71c){var _0x455a71=this;return new Promise(function(_0xca39f,_0x22f3b9){return db['SquareReport'][_0xa471('0x18')](_0x28e71c[_0xa471('0x19')],{'raw':_0x28e71c['options']?_0x28e71c[_0xa471('0x1a')][_0xa471('0x1b')]===undefined?!![]:![]:!![]})[_0xa471('0xc')](function(_0xae7633){logger[_0xa471('0xd')]('CreateSquareReport',_0x28e71c);logger['debug'](_0xa471('0x17'),_0x28e71c,JSON[_0xa471('0x10')](_0xae7633));_0xca39f(_0xae7633);})[_0xa471('0x16')](function(_0x4f476a){logger[_0xa471('0x11')](_0xa471('0x17'),_0x4f476a[_0xa471('0x14')],_0x28e71c);_0x22f3b9(_0x455a71[_0xa471('0x11')](0x1f4,_0x4f476a['message']));});});};exports['UpdateSquareReport']=function(_0x4b101b){var _0x3a04b2=this;return new Promise(function(_0x5f3f3d,_0x42ae0f){return db['SquareReport'][_0xa471('0x1c')](_0x4b101b[_0xa471('0x19')],{'raw':_0x4b101b[_0xa471('0x1a')]?_0x4b101b[_0xa471('0x1a')][_0xa471('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b101b[_0xa471('0x1a')]?_0x4b101b[_0xa471('0x1a')][_0xa471('0x1d')]||null:null,'attributes':_0x4b101b['options']?_0x4b101b[_0xa471('0x1a')][_0xa471('0x1e')]||null:null,'limit':_0x4b101b[_0xa471('0x1a')]?_0x4b101b[_0xa471('0x1a')][_0xa471('0x1f')]||null:null})[_0xa471('0xc')](function(_0x582693){logger[_0xa471('0xd')](_0xa471('0x20'),_0x4b101b);logger['debug']('UpdateSquareReport',_0x4b101b,JSON[_0xa471('0x10')](_0x582693));_0x5f3f3d(_0x582693);})[_0xa471('0x16')](function(_0x438f3a){logger[_0xa471('0x11')](_0xa471('0x20'),_0x438f3a[_0xa471('0x14')],_0x4b101b);_0x42ae0f(_0x3a04b2['error'](0x1f4,_0x438f3a[_0xa471('0x14')]));});});}; \ No newline at end of file +var _0x37c4=['raw','CreateSquareReport','UpdateSquareReport','update','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SquareReport','create','body','options'];(function(_0x4d82ea,_0x4d459f){var _0x257f4a=function(_0x424c4f){while(--_0x424c4f){_0x4d82ea['push'](_0x4d82ea['shift']());}};_0x257f4a(++_0x4d459f);}(_0x37c4,0x1a9));var _0x437c=function(_0x6b0c06,_0x5062e7){_0x6b0c06=_0x6b0c06-0x0;var _0x2f6326=_0x37c4[_0x6b0c06];return _0x2f6326;};'use strict';var _=require(_0x437c('0x0'));var util=require('util');var moment=require(_0x437c('0x1'));var BPromise=require(_0x437c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x437c('0x3'));var db=require(_0x437c('0x4'))['db'];var utils=require(_0x437c('0x5'));var logger=require(_0x437c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x437c('0x7'));var client=jayson['client'][_0x437c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d59c6,_0x1e1bf7,_0x230f29){return new BPromise(function(_0x38e3f6,_0x50755b){return client[_0x437c('0x9')](_0x5d59c6,_0x230f29)[_0x437c('0xa')](function(_0x412fd2){logger[_0x437c('0xb')](_0x437c('0xc'),_0x1e1bf7,'request\x20sent');logger[_0x437c('0xd')](_0x437c('0xe'),_0x1e1bf7,_0x437c('0xf'),JSON[_0x437c('0x10')](_0x412fd2));if(_0x412fd2[_0x437c('0x11')]){if(_0x412fd2[_0x437c('0x11')]['code']===0x1f4){logger[_0x437c('0x11')](_0x437c('0xc'),_0x1e1bf7,_0x412fd2[_0x437c('0x11')]['message']);return _0x50755b(_0x412fd2[_0x437c('0x11')][_0x437c('0x12')]);}logger['error'](_0x437c('0xc'),_0x1e1bf7,_0x412fd2[_0x437c('0x11')]['message']);return _0x38e3f6(_0x412fd2['error']['message']);}else{logger[_0x437c('0xb')]('SquareReport,\x20%s,\x20%s',_0x1e1bf7,_0x437c('0xf'));_0x38e3f6(_0x412fd2['result'][_0x437c('0x12')]);}})['catch'](function(_0x4dae25){logger[_0x437c('0x11')]('SquareReport,\x20%s,\x20%s',_0x1e1bf7,_0x4dae25);_0x50755b(_0x4dae25);});});}exports['CreateSquareReport']=function(_0x57026a){var _0x35b943=this;return new Promise(function(_0x66ae19,_0x48e99d){return db[_0x437c('0x13')][_0x437c('0x14')](_0x57026a[_0x437c('0x15')],{'raw':_0x57026a[_0x437c('0x16')]?_0x57026a[_0x437c('0x16')][_0x437c('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x14119a){logger['info'](_0x437c('0x18'),_0x57026a);logger[_0x437c('0xd')](_0x437c('0x18'),_0x57026a,JSON['stringify'](_0x14119a));_0x66ae19(_0x14119a);})['catch'](function(_0x5610f6){logger[_0x437c('0x11')]('CreateSquareReport',_0x5610f6['message'],_0x57026a);_0x48e99d(_0x35b943[_0x437c('0x11')](0x1f4,_0x5610f6['message']));});});};exports[_0x437c('0x19')]=function(_0xfb40dc){var _0x253a2f=this;return new Promise(function(_0x53f256,_0x2ba43c){return db[_0x437c('0x13')][_0x437c('0x1a')](_0xfb40dc[_0x437c('0x15')],{'raw':_0xfb40dc[_0x437c('0x16')]?_0xfb40dc[_0x437c('0x16')][_0x437c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfb40dc[_0x437c('0x16')]?_0xfb40dc[_0x437c('0x16')][_0x437c('0x1b')]||null:null,'attributes':_0xfb40dc[_0x437c('0x16')]?_0xfb40dc['options']['attributes']||null:null,'limit':_0xfb40dc[_0x437c('0x16')]?_0xfb40dc[_0x437c('0x16')]['limit']||null:null})[_0x437c('0xa')](function(_0x988c46){logger[_0x437c('0xb')]('UpdateSquareReport',_0xfb40dc);logger[_0x437c('0xd')]('UpdateSquareReport',_0xfb40dc,JSON[_0x437c('0x10')](_0x988c46));_0x53f256(_0x988c46);})['catch'](function(_0x54ca7a){logger[_0x437c('0x11')]('UpdateSquareReport',_0x54ca7a['message'],_0xfb40dc);_0x2ba43c(_0x253a2f['error'](0x1f4,_0x54ca7a[_0x437c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d8e79f9..521a26d 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 _0x0d03=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','show','create','put','delete','/:id','destroy','multer','util'];(function(_0xe47217,_0x3a35db){var _0x3dc84c=function(_0x2b5480){while(--_0x2b5480){_0xe47217['push'](_0xe47217['shift']());}};_0x3dc84c(++_0x3a35db);}(_0x0d03,0xfa));var _0x30d0=function(_0x3bedc9,_0x5587e9){_0x3bedc9=_0x3bedc9-0x0;var _0x1e86aa=_0x0d03[_0x3bedc9];return _0x1e86aa;};'use strict';var multer=require(_0x30d0('0x0'));var util=require(_0x30d0('0x1'));var path=require(_0x30d0('0x2'));var timeout=require(_0x30d0('0x3'));var express=require(_0x30d0('0x4'));var router=express['Router']();var fs_extra=require(_0x30d0('0x5'));var auth=require(_0x30d0('0x6'));var interaction=require(_0x30d0('0x7'));var config=require(_0x30d0('0x8'));var controller=require(_0x30d0('0x9'));router[_0x30d0('0xa')]('/',auth['isAuthenticated'](),controller[_0x30d0('0xb')]);router[_0x30d0('0xa')](_0x30d0('0xc'),auth[_0x30d0('0xd')](),controller[_0x30d0('0xe')]);router[_0x30d0('0xa')]('/:id',auth[_0x30d0('0xd')](),controller[_0x30d0('0xf')]);router['post']('/',auth[_0x30d0('0xd')](),controller[_0x30d0('0x10')]);router[_0x30d0('0x11')]('/:id',auth[_0x30d0('0xd')](),controller['update']);router[_0x30d0('0x12')](_0x30d0('0x13'),auth[_0x30d0('0xd')](),controller[_0x30d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8e93=['show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x45f07b,_0x4c5a66){var _0x1f19f0=function(_0x27c7f4){while(--_0x27c7f4){_0x45f07b['push'](_0x45f07b['shift']());}};_0x1f19f0(++_0x4c5a66);}(_0x8e93,0x158));var _0x38e9=function(_0x535b22,_0x3025c5){_0x535b22=_0x535b22-0x0;var _0xc3ca90=_0x8e93[_0x535b22];return _0xc3ca90;};'use strict';var multer=require('multer');var util=require(_0x38e9('0x0'));var path=require(_0x38e9('0x1'));var timeout=require(_0x38e9('0x2'));var express=require('express');var router=express[_0x38e9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x38e9('0x4'));var interaction=require(_0x38e9('0x5'));var config=require(_0x38e9('0x6'));var controller=require('./squareReportDetail.controller');router[_0x38e9('0x7')]('/',auth[_0x38e9('0x8')](),controller[_0x38e9('0x9')]);router[_0x38e9('0x7')](_0x38e9('0xa'),auth['isAuthenticated'](),controller[_0x38e9('0xb')]);router[_0x38e9('0x7')](_0x38e9('0xc'),auth['isAuthenticated'](),controller[_0x38e9('0xd')]);router[_0x38e9('0xe')]('/',auth['isAuthenticated'](),controller[_0x38e9('0xf')]);router[_0x38e9('0x10')](_0x38e9('0xc'),auth['isAuthenticated'](),controller[_0x38e9('0x11')]);router[_0x38e9('0x12')]('/:id',auth[_0x38e9('0x8')](),controller[_0x38e9('0x13')]);module[_0x38e9('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index e43510c..07f9d10 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 _0x895c=['STRING','sequelize','exports'];(function(_0xc8ffa5,_0x1fd15f){var _0x35bc1b=function(_0x41bfa9){while(--_0x41bfa9){_0xc8ffa5['push'](_0xc8ffa5['shift']());}};_0x35bc1b(++_0x1fd15f);}(_0x895c,0xdc));var _0xc895=function(_0x1db9e7,_0xc84467){_0x1db9e7=_0x1db9e7-0x0;var _0x8109c8=_0x895c[_0x1db9e7];return _0x8109c8;};'use strict';var Sequelize=require(_0xc895('0x0'));module[_0xc895('0x1')]={'uniqueid':{'type':Sequelize[_0xc895('0x2')]},'node':{'type':Sequelize[_0xc895('0x2')]},'application':{'type':Sequelize[_0xc895('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc895('0x2')]},'callerid':{'type':Sequelize[_0xc895('0x2')]}}; \ No newline at end of file +var _0x49ee=['TEXT','sequelize','exports','STRING'];(function(_0x5c59f0,_0x222e3d){var _0x1c87e8=function(_0x5ecba3){while(--_0x5ecba3){_0x5c59f0['push'](_0x5c59f0['shift']());}};_0x1c87e8(++_0x222e3d);}(_0x49ee,0x1e1));var _0xe49e=function(_0x4f40fd,_0x36c17c){_0x4f40fd=_0x4f40fd-0x0;var _0x1b70a3=_0x49ee[_0x4f40fd];return _0x1b70a3;};'use strict';var Sequelize=require(_0xe49e('0x0'));module[_0xe49e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xe49e('0x2')]},'application':{'type':Sequelize[_0xe49e('0x2')]},'data':{'type':Sequelize[_0xe49e('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe49e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 2e4039a..402f06b 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 _0x4b46=['json','apply','reject','then','destroy','error','name','index','map','SquareDetailsReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','update','body','describe','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','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','../../mysqldb','sendStatus','end','status','undefined','count','offset','set'];(function(_0x38e407,_0x419b6e){var _0x5f3dbf=function(_0x430626){while(--_0x430626){_0x38e407['push'](_0x38e407['shift']());}};_0x5f3dbf(++_0x419b6e);}(_0x4b46,0x75));var _0x64b4=function(_0x211289,_0x2f9e0){_0x211289=_0x211289-0x0;var _0x145db5=_0x4b46[_0x211289];return _0x145db5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x64b4('0x0'));var jsonpatch=require(_0x64b4('0x1'));var rp=require('request-promise');var moment=require(_0x64b4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x64b4('0x3'));var util=require(_0x64b4('0x4'));var path=require(_0x64b4('0x5'));var sox=require(_0x64b4('0x6'));var csv=require('to-csv');var ejs=require(_0x64b4('0x7'));var fs=require('fs');var fs_extra=require(_0x64b4('0x8'));var _=require('lodash');var squel=require(_0x64b4('0x9'));var crypto=require(_0x64b4('0xa'));var jsforce=require(_0x64b4('0xb'));var deskjs=require(_0x64b4('0xc'));var toCsv=require(_0x64b4('0xd'));var querystring=require('querystring');var Papa=require(_0x64b4('0xe'));var Redis=require(_0x64b4('0xf'));var authService=require(_0x64b4('0x10'));var qs=require(_0x64b4('0x11'));var as=require(_0x64b4('0x12'));var hardwareService=require(_0x64b4('0x13'));var logger=require(_0x64b4('0x14'))(_0x64b4('0x15'));var utils=require(_0x64b4('0x16'));var config=require(_0x64b4('0x17'));var licenseUtil=require(_0x64b4('0x18'));var db=require(_0x64b4('0x19'))['db'];function respondWithStatusCode(_0x3f8018,_0xa821ae){_0xa821ae=_0xa821ae||0xcc;return function(_0x15cc5d){if(_0x15cc5d){return _0x3f8018[_0x64b4('0x1a')](_0xa821ae);}return _0x3f8018['status'](_0xa821ae)[_0x64b4('0x1b')]();};}function respondWithResult(_0x1f9e2b,_0x16ef12){_0x16ef12=_0x16ef12||0xc8;return function(_0x491e04){if(_0x491e04){return _0x1f9e2b[_0x64b4('0x1c')](_0x16ef12)['json'](_0x491e04);}};}function respondWithFilteredResult(_0x4cdebe,_0x3d1d44){return function(_0x1d855e){if(_0x1d855e){var _0x10646f=typeof _0x3d1d44['offset']==='undefined'&&typeof _0x3d1d44['limit']===_0x64b4('0x1d');var _0x855b74=_0x1d855e[_0x64b4('0x1e')];var _0x378a3f=_0x10646f?0x0:_0x3d1d44[_0x64b4('0x1f')];var _0xf9b734=_0x10646f?_0x1d855e['count']:_0x3d1d44['offset']+_0x3d1d44['limit'];var _0x5e5f68;if(_0xf9b734>=_0x855b74){_0xf9b734=_0x855b74;_0x5e5f68=0xc8;}else{_0x5e5f68=0xce;}_0x4cdebe[_0x64b4('0x1c')](_0x5e5f68);return _0x4cdebe[_0x64b4('0x20')]('Content-Range',_0x378a3f+'-'+_0xf9b734+'/'+_0x855b74)[_0x64b4('0x21')](_0x1d855e);}return null;};}function patchUpdates(_0x5d3879){return function(_0xd0758e){try{jsonpatch[_0x64b4('0x22')](_0xd0758e,_0x5d3879,!![]);}catch(_0xc68b32){return BPromise[_0x64b4('0x23')](_0xc68b32);}return _0xd0758e['save']();};}function saveUpdates(_0x1931b8,_0x34dc23){return function(_0x3397dd){if(_0x3397dd){return _0x3397dd['update'](_0x1931b8)[_0x64b4('0x24')](function(_0x32923e){return _0x32923e;});}return null;};}function removeEntity(_0x29e9df,_0x13c468){return function(_0x3d771c){if(_0x3d771c){return _0x3d771c[_0x64b4('0x25')]()[_0x64b4('0x24')](function(){_0x29e9df[_0x64b4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x174955,_0x5c71a3){return function(_0x486a10){if(!_0x486a10){_0x174955[_0x64b4('0x1a')](0x194);}return _0x486a10;};}function handleError(_0x2c1a5f,_0x36c827){_0x36c827=_0x36c827||0x1f4;return function(_0x22f3c7){logger[_0x64b4('0x26')](_0x22f3c7['stack']);if(_0x22f3c7['name']){delete _0x22f3c7[_0x64b4('0x27')];}_0x2c1a5f[_0x64b4('0x1c')](_0x36c827)['send'](_0x22f3c7);};}exports[_0x64b4('0x28')]=function(_0x2ed6fb,_0x18f0db){var _0x154830={},_0xd2e90d={},_0x448035={'count':0x0,'rows':[]};var _0x2ea14f=_[_0x64b4('0x29')](db[_0x64b4('0x2a')][_0x64b4('0x2b')],function(_0x840816){return{'name':_0x840816[_0x64b4('0x2c')],'type':_0x840816['type'][_0x64b4('0x2d')]};});_0xd2e90d['model']=_[_0x64b4('0x29')](_0x2ea14f,_0x64b4('0x27'));_0xd2e90d[_0x64b4('0x2e')]=_[_0x64b4('0x2f')](_0x2ed6fb['query']);_0xd2e90d[_0x64b4('0x30')]=_[_0x64b4('0x31')](_0xd2e90d[_0x64b4('0x32')],_0xd2e90d[_0x64b4('0x2e')]);_0x154830[_0x64b4('0x33')]=_[_0x64b4('0x31')](_0xd2e90d[_0x64b4('0x32')],qs[_0x64b4('0x34')](_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x34')]));_0x154830[_0x64b4('0x33')]=_0x154830['attributes'][_0x64b4('0x35')]?_0x154830[_0x64b4('0x33')]:_0xd2e90d[_0x64b4('0x32')];if(!_0x2ed6fb['query'][_0x64b4('0x36')](_0x64b4('0x37'))){_0x154830['limit']=qs[_0x64b4('0x38')](_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x38')]);_0x154830[_0x64b4('0x1f')]=qs[_0x64b4('0x1f')](_0x2ed6fb[_0x64b4('0x2e')]['offset']);}_0x154830[_0x64b4('0x39')]=qs['sort'](_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x3a')]);_0x154830[_0x64b4('0x3b')]=qs['filters'](_['pick'](_0x2ed6fb[_0x64b4('0x2e')],_0xd2e90d[_0x64b4('0x30')]),_0x2ea14f);if(_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x3c')]){_0x154830[_0x64b4('0x3b')]=_[_0x64b4('0x3d')](_0x154830[_0x64b4('0x3b')],{'$or':_[_0x64b4('0x29')](_0x2ea14f,function(_0x5b77ae){if(_0x5b77ae[_0x64b4('0x3e')]!==_0x64b4('0x3f')){var _0x248a1e={};_0x248a1e[_0x5b77ae[_0x64b4('0x27')]]={'$like':'%'+_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x3c')]+'%'};return _0x248a1e;}})});}_0x154830=_[_0x64b4('0x3d')]({},_0x154830,_0x2ed6fb[_0x64b4('0x40')]);var _0x1c1d65={'where':_0x154830[_0x64b4('0x3b')]};return db[_0x64b4('0x2a')]['count'](_0x1c1d65)[_0x64b4('0x24')](function(_0xb422f){_0x448035[_0x64b4('0x1e')]=_0xb422f;if(_0x2ed6fb[_0x64b4('0x2e')][_0x64b4('0x41')]){_0x154830[_0x64b4('0x42')]=[{'all':!![]}];}return db[_0x64b4('0x2a')]['findAll'](_0x154830);})[_0x64b4('0x24')](function(_0x20146f){_0x448035[_0x64b4('0x43')]=_0x20146f;return _0x448035;})['then'](respondWithFilteredResult(_0x18f0db,_0x154830))[_0x64b4('0x44')](handleError(_0x18f0db,null));};exports['show']=function(_0x5761ac,_0x13a518){var _0x241fca={'raw':!![],'where':{'id':_0x5761ac[_0x64b4('0x45')]['id']}},_0x51eaf9={};_0x51eaf9[_0x64b4('0x32')]=_[_0x64b4('0x2f')](db['SquareDetailsReport'][_0x64b4('0x2b')]);_0x51eaf9[_0x64b4('0x2e')]=_[_0x64b4('0x2f')](_0x5761ac[_0x64b4('0x2e')]);_0x51eaf9[_0x64b4('0x30')]=_['intersection'](_0x51eaf9[_0x64b4('0x32')],_0x51eaf9[_0x64b4('0x2e')]);_0x241fca[_0x64b4('0x33')]=_[_0x64b4('0x31')](_0x51eaf9[_0x64b4('0x32')],qs[_0x64b4('0x34')](_0x5761ac[_0x64b4('0x2e')][_0x64b4('0x34')]));_0x241fca[_0x64b4('0x33')]=_0x241fca[_0x64b4('0x33')][_0x64b4('0x35')]?_0x241fca[_0x64b4('0x33')]:_0x51eaf9[_0x64b4('0x32')];if(_0x5761ac[_0x64b4('0x2e')]['includeAll']){_0x241fca[_0x64b4('0x42')]=[{'all':!![]}];}_0x241fca=_[_0x64b4('0x3d')]({},_0x241fca,_0x5761ac[_0x64b4('0x40')]);return db[_0x64b4('0x2a')][_0x64b4('0x46')](_0x241fca)[_0x64b4('0x24')](handleEntityNotFound(_0x13a518,null))[_0x64b4('0x24')](respondWithResult(_0x13a518,null))[_0x64b4('0x44')](handleError(_0x13a518,null));};exports[_0x64b4('0x47')]=function(_0x26345b,_0x33d8b0){return db[_0x64b4('0x2a')][_0x64b4('0x47')](_0x26345b['body'],{})[_0x64b4('0x24')](respondWithResult(_0x33d8b0,0xc9))[_0x64b4('0x44')](handleError(_0x33d8b0,null));};exports[_0x64b4('0x48')]=function(_0x5c40f9,_0x372d21){if(_0x5c40f9[_0x64b4('0x49')]['id']){delete _0x5c40f9[_0x64b4('0x49')]['id'];}return db[_0x64b4('0x2a')]['find']({'where':{'id':_0x5c40f9[_0x64b4('0x45')]['id']}})['then'](handleEntityNotFound(_0x372d21,null))[_0x64b4('0x24')](saveUpdates(_0x5c40f9[_0x64b4('0x49')],null))[_0x64b4('0x24')](respondWithResult(_0x372d21,null))[_0x64b4('0x44')](handleError(_0x372d21,null));};exports[_0x64b4('0x25')]=function(_0x445207,_0x3a39a3){return db['SquareDetailsReport'][_0x64b4('0x46')]({'where':{'id':_0x445207['params']['id']}})[_0x64b4('0x24')](handleEntityNotFound(_0x3a39a3,null))[_0x64b4('0x24')](removeEntity(_0x3a39a3,null))[_0x64b4('0x44')](handleError(_0x3a39a3,null));};exports[_0x64b4('0x4a')]=function(_0x5856a9,_0x19c2f8){return db['SquareDetailsReport'][_0x64b4('0x4a')]()[_0x64b4('0x24')](respondWithResult(_0x19c2f8,null))[_0x64b4('0x44')](handleError(_0x19c2f8,null));}; \ No newline at end of file +var _0x8100=['params','keys','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','index','map','SquareDetailsReport','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','includeAll','include','rows','show'];(function(_0x5d2523,_0x14bc7e){var _0x4b0e39=function(_0x2661ab){while(--_0x2661ab){_0x5d2523['push'](_0x5d2523['shift']());}};_0x4b0e39(++_0x14bc7e);}(_0x8100,0x199));var _0x0810=function(_0x5a2624,_0x43a619){_0x5a2624=_0x5a2624-0x0;var _0x372a30=_0x8100[_0x5a2624];return _0x372a30;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0810('0x0'));var zipdir=require(_0x0810('0x1'));var jsonpatch=require(_0x0810('0x2'));var rp=require(_0x0810('0x3'));var moment=require('moment');var BPromise=require(_0x0810('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0810('0x5'));var csv=require(_0x0810('0x6'));var ejs=require(_0x0810('0x7'));var fs=require('fs');var fs_extra=require(_0x0810('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0810('0x9'));var jsforce=require(_0x0810('0xa'));var deskjs=require(_0x0810('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0810('0xc'));var Papa=require(_0x0810('0xd'));var Redis=require('ioredis');var authService=require(_0x0810('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0810('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0810('0x10'))('api');var utils=require(_0x0810('0x11'));var config=require(_0x0810('0x12'));var licenseUtil=require(_0x0810('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14f374,_0x3dc20c){_0x3dc20c=_0x3dc20c||0xcc;return function(_0x4877c0){if(_0x4877c0){return _0x14f374['sendStatus'](_0x3dc20c);}return _0x14f374[_0x0810('0x14')](_0x3dc20c)[_0x0810('0x15')]();};}function respondWithResult(_0x2e6e40,_0x454789){_0x454789=_0x454789||0xc8;return function(_0x556272){if(_0x556272){return _0x2e6e40[_0x0810('0x14')](_0x454789)[_0x0810('0x16')](_0x556272);}};}function respondWithFilteredResult(_0x1c606c,_0x2deaec){return function(_0x189e11){if(_0x189e11){var _0x5b5cb4=typeof _0x2deaec['offset']===_0x0810('0x17')&&typeof _0x2deaec[_0x0810('0x18')]===_0x0810('0x17');var _0x219f2a=_0x189e11[_0x0810('0x19')];var _0xff61a3=_0x5b5cb4?0x0:_0x2deaec['offset'];var _0x31e9b0=_0x5b5cb4?_0x189e11[_0x0810('0x19')]:_0x2deaec['offset']+_0x2deaec[_0x0810('0x18')];var _0x5f58e3;if(_0x31e9b0>=_0x219f2a){_0x31e9b0=_0x219f2a;_0x5f58e3=0xc8;}else{_0x5f58e3=0xce;}_0x1c606c[_0x0810('0x14')](_0x5f58e3);return _0x1c606c[_0x0810('0x1a')](_0x0810('0x1b'),_0xff61a3+'-'+_0x31e9b0+'/'+_0x219f2a)[_0x0810('0x16')](_0x189e11);}return null;};}function patchUpdates(_0x373f29){return function(_0x14a39f){try{jsonpatch[_0x0810('0x1c')](_0x14a39f,_0x373f29,!![]);}catch(_0x567940){return BPromise['reject'](_0x567940);}return _0x14a39f[_0x0810('0x1d')]();};}function saveUpdates(_0x37eed8,_0x581416){return function(_0xc8b196){if(_0xc8b196){return _0xc8b196[_0x0810('0x1e')](_0x37eed8)['then'](function(_0x329aab){return _0x329aab;});}return null;};}function removeEntity(_0x575bd1,_0x17c858){return function(_0x38b059){if(_0x38b059){return _0x38b059[_0x0810('0x1f')]()[_0x0810('0x20')](function(){_0x575bd1[_0x0810('0x14')](0xcc)[_0x0810('0x15')]();});}};}function handleEntityNotFound(_0x4359f6,_0x35d9b9){return function(_0x36a18d){if(!_0x36a18d){_0x4359f6[_0x0810('0x21')](0x194);}return _0x36a18d;};}function handleError(_0x1dec40,_0x2330a0){_0x2330a0=_0x2330a0||0x1f4;return function(_0x46d584){logger[_0x0810('0x22')](_0x46d584['stack']);if(_0x46d584['name']){delete _0x46d584[_0x0810('0x23')];}_0x1dec40[_0x0810('0x14')](_0x2330a0)['send'](_0x46d584);};}exports[_0x0810('0x24')]=function(_0xd1d107,_0x10f426){var _0x173dad={},_0x42e880={},_0xa86b46={'count':0x0,'rows':[]};var _0x336021=_[_0x0810('0x25')](db[_0x0810('0x26')][_0x0810('0x27')],function(_0xc5b0cd){return{'name':_0xc5b0cd['fieldName'],'type':_0xc5b0cd[_0x0810('0x28')]['key']};});_0x42e880[_0x0810('0x29')]=_['map'](_0x336021,_0x0810('0x23'));_0x42e880['query']=_['keys'](_0xd1d107[_0x0810('0x2a')]);_0x42e880[_0x0810('0x2b')]=_[_0x0810('0x2c')](_0x42e880['model'],_0x42e880['query']);_0x173dad['attributes']=_['intersection'](_0x42e880[_0x0810('0x29')],qs[_0x0810('0x2d')](_0xd1d107[_0x0810('0x2a')][_0x0810('0x2d')]));_0x173dad[_0x0810('0x2e')]=_0x173dad[_0x0810('0x2e')][_0x0810('0x2f')]?_0x173dad[_0x0810('0x2e')]:_0x42e880[_0x0810('0x29')];if(!_0xd1d107['query'][_0x0810('0x30')](_0x0810('0x31'))){_0x173dad['limit']=qs[_0x0810('0x18')](_0xd1d107[_0x0810('0x2a')]['limit']);_0x173dad['offset']=qs[_0x0810('0x32')](_0xd1d107[_0x0810('0x2a')][_0x0810('0x32')]);}_0x173dad['order']=qs[_0x0810('0x33')](_0xd1d107[_0x0810('0x2a')][_0x0810('0x33')]);_0x173dad[_0x0810('0x34')]=qs[_0x0810('0x2b')](_['pick'](_0xd1d107[_0x0810('0x2a')],_0x42e880[_0x0810('0x2b')]),_0x336021);if(_0xd1d107[_0x0810('0x2a')][_0x0810('0x35')]){_0x173dad[_0x0810('0x34')]=_[_0x0810('0x36')](_0x173dad['where'],{'$or':_[_0x0810('0x25')](_0x336021,function(_0x3e2910){if(_0x3e2910['type']!=='VIRTUAL'){var _0x456e13={};_0x456e13[_0x3e2910[_0x0810('0x23')]]={'$like':'%'+_0xd1d107[_0x0810('0x2a')][_0x0810('0x35')]+'%'};return _0x456e13;}})});}_0x173dad=_['merge']({},_0x173dad,_0xd1d107[_0x0810('0x37')]);var _0xcb8317={'where':_0x173dad['where']};return db['SquareDetailsReport']['count'](_0xcb8317)[_0x0810('0x20')](function(_0x34490d){_0xa86b46[_0x0810('0x19')]=_0x34490d;if(_0xd1d107[_0x0810('0x2a')][_0x0810('0x38')]){_0x173dad[_0x0810('0x39')]=[{'all':!![]}];}return db[_0x0810('0x26')]['findAll'](_0x173dad);})[_0x0810('0x20')](function(_0x52d340){_0xa86b46[_0x0810('0x3a')]=_0x52d340;return _0xa86b46;})['then'](respondWithFilteredResult(_0x10f426,_0x173dad))['catch'](handleError(_0x10f426,null));};exports[_0x0810('0x3b')]=function(_0x35b4ce,_0x42b3a3){var _0x143489={'raw':!![],'where':{'id':_0x35b4ce[_0x0810('0x3c')]['id']}},_0x53cb13={};_0x53cb13[_0x0810('0x29')]=_[_0x0810('0x3d')](db[_0x0810('0x26')][_0x0810('0x27')]);_0x53cb13[_0x0810('0x2a')]=_[_0x0810('0x3d')](_0x35b4ce[_0x0810('0x2a')]);_0x53cb13[_0x0810('0x2b')]=_[_0x0810('0x2c')](_0x53cb13[_0x0810('0x29')],_0x53cb13[_0x0810('0x2a')]);_0x143489[_0x0810('0x2e')]=_[_0x0810('0x2c')](_0x53cb13[_0x0810('0x29')],qs[_0x0810('0x2d')](_0x35b4ce[_0x0810('0x2a')][_0x0810('0x2d')]));_0x143489['attributes']=_0x143489[_0x0810('0x2e')][_0x0810('0x2f')]?_0x143489[_0x0810('0x2e')]:_0x53cb13[_0x0810('0x29')];if(_0x35b4ce[_0x0810('0x2a')][_0x0810('0x38')]){_0x143489[_0x0810('0x39')]=[{'all':!![]}];}_0x143489=_[_0x0810('0x36')]({},_0x143489,_0x35b4ce[_0x0810('0x37')]);return db['SquareDetailsReport'][_0x0810('0x3e')](_0x143489)[_0x0810('0x20')](handleEntityNotFound(_0x42b3a3,null))[_0x0810('0x20')](respondWithResult(_0x42b3a3,null))[_0x0810('0x3f')](handleError(_0x42b3a3,null));};exports[_0x0810('0x40')]=function(_0x51a200,_0x3ee366){return db[_0x0810('0x26')][_0x0810('0x40')](_0x51a200[_0x0810('0x41')],{})[_0x0810('0x20')](respondWithResult(_0x3ee366,0xc9))[_0x0810('0x3f')](handleError(_0x3ee366,null));};exports['update']=function(_0x208475,_0x50e346){if(_0x208475[_0x0810('0x41')]['id']){delete _0x208475[_0x0810('0x41')]['id'];}return db['SquareDetailsReport'][_0x0810('0x3e')]({'where':{'id':_0x208475[_0x0810('0x3c')]['id']}})[_0x0810('0x20')](handleEntityNotFound(_0x50e346,null))[_0x0810('0x20')](saveUpdates(_0x208475[_0x0810('0x41')],null))[_0x0810('0x20')](respondWithResult(_0x50e346,null))[_0x0810('0x3f')](handleError(_0x50e346,null));};exports['destroy']=function(_0x550262,_0x3cda24){return db[_0x0810('0x26')][_0x0810('0x3e')]({'where':{'id':_0x550262['params']['id']}})[_0x0810('0x20')](handleEntityNotFound(_0x3cda24,null))[_0x0810('0x20')](removeEntity(_0x3cda24,null))[_0x0810('0x3f')](handleError(_0x3cda24,null));};exports['describe']=function(_0xc5e8bc,_0x366eb1){return db[_0x0810('0x26')][_0x0810('0x42')]()[_0x0810('0x20')](respondWithResult(_0x366eb1,null))[_0x0810('0x3f')](handleError(_0x366eb1,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 6a6e303..bef8cc2 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 _0xae91=['lodash','api','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','report_square_details'];(function(_0x4e7c7e,_0x4c5955){var _0x344839=function(_0x110ca7){while(--_0x110ca7){_0x4e7c7e['push'](_0x4e7c7e['shift']());}};_0x344839(++_0x4c5955);}(_0xae91,0x7e));var _0x1ae9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xae91[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x1ae9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1ae9('0x1'));var moment=require(_0x1ae9('0x2'));var BPromise=require('bluebird');var rp=require(_0x1ae9('0x3'));var fs=require('fs');var path=require(_0x1ae9('0x4'));var rimraf=require(_0x1ae9('0x5'));var config=require(_0x1ae9('0x6'));var attributes=require(_0x1ae9('0x7'));module['exports']=function(_0x1cd164,_0x4010fb){return _0x1cd164['define']('SquareDetailsReport',attributes,{'tableName':_0x1ae9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66b6=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird'];(function(_0x15ac53,_0x38ae68){var _0x5adc85=function(_0x5580c1){while(--_0x5580c1){_0x15ac53['push'](_0x15ac53['shift']());}};_0x5adc85(++_0x38ae68);}(_0x66b6,0x1dc));var _0x666b=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x66b6[_0x41382c];return _0x4da35b;};'use strict';var _=require(_0x666b('0x0'));var util=require(_0x666b('0x1'));var logger=require(_0x666b('0x2'))(_0x666b('0x3'));var moment=require('moment');var BPromise=require(_0x666b('0x4'));var rp=require(_0x666b('0x5'));var fs=require('fs');var path=require(_0x666b('0x6'));var rimraf=require(_0x666b('0x7'));var config=require(_0x666b('0x8'));var attributes=require(_0x666b('0x9'));module[_0x666b('0xa')]=function(_0x1c9557,_0x48d56c){return _0x1c9557['define'](_0x666b('0xb'),attributes,{'tableName':_0x666b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 618d255..29d9f9c 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 _0x36ee=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw'];(function(_0x52f2ed,_0x3efc6b){var _0x2f3229=function(_0x55e50d){while(--_0x55e50d){_0x52f2ed['push'](_0x52f2ed['shift']());}};_0x2f3229(++_0x3efc6b);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')](_0x2184ae['body'],{'raw':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x21e95e){logger[_0xe36e('0x15')](_0xe36e('0x18'),_0x2184ae);logger[_0xe36e('0xe')](_0xe36e('0x18'),_0x2184ae,JSON[_0xe36e('0x11')](_0x21e95e));_0x21d9a3(_0x21e95e);})['catch'](function(_0xd71137){logger[_0xe36e('0x12')](_0xe36e('0x18'),_0xd71137[_0xe36e('0x14')],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0xd71137['message']));});});}; \ No newline at end of file +var _0x6cb4=['raw','then','CreateSquareDetailsReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','SquareDetailsReport','create','body','options'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x6cb4,0xff));var _0x46cb=function(_0x4617a8,_0x39152e){_0x4617a8=_0x4617a8-0x0;var _0x40e95a=_0x6cb4[_0x4617a8];return _0x40e95a;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11262d,_0x148d0f,_0x31b35b){return new BPromise(function(_0x2d6c29,_0x24b4f5){return client[_0x46cb('0xb')](_0x11262d,_0x31b35b)['then'](function(_0x3d7663){logger[_0x46cb('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'));logger[_0x46cb('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x148d0f,_0x46cb('0xd'),JSON[_0x46cb('0xf')](_0x3d7663));if(_0x3d7663['error']){if(_0x3d7663['error']['code']===0x1f4){logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x24b4f5(_0x3d7663['error'][_0x46cb('0x12')]);}logger[_0x46cb('0x10')](_0x46cb('0x11'),_0x148d0f,_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);return _0x2d6c29(_0x3d7663[_0x46cb('0x10')][_0x46cb('0x12')]);}else{logger[_0x46cb('0xc')](_0x46cb('0x11'),_0x148d0f,_0x46cb('0xd'));_0x2d6c29(_0x3d7663[_0x46cb('0x13')]['message']);}})[_0x46cb('0x14')](function(_0x5796d2){logger[_0x46cb('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x148d0f,_0x5796d2);_0x24b4f5(_0x5796d2);});});}exports['CreateSquareDetailsReport']=function(_0x4e3454){var _0x1b6646=this;return new Promise(function(_0x1f2891,_0x4df1f0){return db[_0x46cb('0x15')][_0x46cb('0x16')](_0x4e3454[_0x46cb('0x17')],{'raw':_0x4e3454[_0x46cb('0x18')]?_0x4e3454[_0x46cb('0x18')][_0x46cb('0x19')]===undefined?!![]:![]:!![]})[_0x46cb('0x1a')](function(_0x149483){logger[_0x46cb('0xc')](_0x46cb('0x1b'),_0x4e3454);logger[_0x46cb('0xe')](_0x46cb('0x1b'),_0x4e3454,JSON[_0x46cb('0xf')](_0x149483));_0x1f2891(_0x149483);})[_0x46cb('0x14')](function(_0x1fb467){logger[_0x46cb('0x10')](_0x46cb('0x1b'),_0x1fb467[_0x46cb('0x12')],_0x4e3454);_0x4df1f0(_0x1b6646[_0x46cb('0x10')](0x1f4,_0x1fb467[_0x46cb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f1d1fd9..ac8d552 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 _0xc974=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router','../../components/auth/service'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0xc974,0x72));var _0x4c97=function(_0x406720,_0x4502fc){_0x406720=_0x406720-0x0;var _0x3c0262=_0xc974[_0x406720];return _0x3c0262;};'use strict';var express=require(_0x4c97('0x0'));var router=express[_0x4c97('0x1')]();var auth=require(_0x4c97('0x2'));var controller=require(_0x4c97('0x3'));router[_0x4c97('0x4')]('/',auth[_0x4c97('0x5')](),controller[_0x4c97('0x6')]);router[_0x4c97('0x4')](_0x4c97('0x7'),auth[_0x4c97('0x5')](),controller[_0x4c97('0x8')]);module['exports']=router; \ No newline at end of file +var _0xe833=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','Router','../../components/auth/service'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xe833,0xa9));var _0x3e83=function(_0x5e546d,_0xa0f866){_0x5e546d=_0x5e546d-0x0;var _0x8de50f=_0xe833[_0x5e546d];return _0x8de50f;};'use strict';var express=require('express');var router=express[_0x3e83('0x0')]();var auth=require(_0x3e83('0x1'));var controller=require(_0x3e83('0x2'));router[_0x3e83('0x3')]('/',auth[_0x3e83('0x4')](),controller[_0x3e83('0x5')]);router[_0x3e83('0x3')](_0x3e83('0x6'),auth[_0x3e83('0x4')](),controller[_0x3e83('0x7')]);module[_0x3e83('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 7fa5714..1d0220d 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 _0xa7a0=['util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','status','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api'];(function(_0x3c0c96,_0x449674){var _0x1780ec=function(_0x395465){while(--_0x395465){_0x3c0c96['push'](_0x3c0c96['shift']());}};_0x1780ec(++_0x449674);}(_0xa7a0,0x183));var _0x0a7a=function(_0x23ba67,_0x1915ab){_0x23ba67=_0x23ba67-0x0;var _0x54e34f=_0xa7a0[_0x23ba67];return _0x54e34f;};'use strict';var info=require(_0x0a7a('0x0'));var exec=require(_0x0a7a('0x1'))[_0x0a7a('0x2')];var logger=require(_0x0a7a('0x3'))(_0x0a7a('0x4'));var util=require(_0x0a7a('0x5'));var BPromise=require('bluebird');var _=require(_0x0a7a('0x6'));function handleError(_0x3746ee,_0x5ec939,_0x44bc76){_0x5ec939=_0x5ec939||0x1f4;return function(_0x35480c){logger[_0x0a7a('0x7')](_0x0a7a('0x8'),_0x44bc76,_0x5ec939,util[_0x0a7a('0x9')](_0x35480c,{'showHidden':![],'depth':null}));delete _0x35480c[_0x0a7a('0xa')];_0x3746ee['status'](_0x5ec939)[_0x0a7a('0xb')](_0x35480c);};}exports[_0x0a7a('0xc')]=function(_0xc1dbfc,_0xeb0127){return info[_0x0a7a('0xd')]()['then'](function(_0x3bc357){return _0xeb0127[_0x0a7a('0xe')](0xc8)[_0x0a7a('0xf')](_0x3bc357);})[_0x0a7a('0x10')](function(_0x1f5ec4){return _0xeb0127['status'](0x1f4)[_0x0a7a('0xf')](_0x1f5ec4);});};exports[_0x0a7a('0x11')]=function(_0x313904,_0x351c54){var _0x31a0b5=['components/import/cm'];return new BPromise(function(_0x681c39,_0x3d27b9){return exec(util['format'](_0x0a7a('0x12'),_0x313904[_0x0a7a('0x13')][_0x0a7a('0x14')]),function(_0x339eb4,_0x7ea397,_0x48cbf9){if(_0x339eb4){return _0x3d27b9(_0x339eb4);}return _0x681c39(_0x7ea397);});})['then'](function(_0x5881f7){var _0x3c57b2=![];var _0x2340b2=_0x5881f7[_0x0a7a('0x15')](/\n/);for(var _0x3cfdc3=0x0,_0x323419=_0x31a0b5[_0x0a7a('0x16')];_0x3cfdc3<_0x323419,_0x3c57b2===![];_0x3cfdc3+=0x1){if(_0x5881f7[_0x0a7a('0x17')](_0x31a0b5[_0x3cfdc3])>=0x0){_0x3c57b2=!![];}}if(!_0x3c57b2){throw new Error(util['format'](_0x0a7a('0x18'),_0x313904[_0x0a7a('0x13')][_0x0a7a('0x14')]));}process[_0x0a7a('0x19')](_0x313904[_0x0a7a('0x13')][_0x0a7a('0x14')],_0x0a7a('0x1a'));return _0x351c54['status'](0xc8)[_0x0a7a('0xf')]({'message':util['format'](_0x0a7a('0x1b'),_0x313904[_0x0a7a('0x13')][_0x0a7a('0x14')])});})[_0x0a7a('0x10')](handleError(_0x351c54,null,_0x0a7a('0x11')));}; \ No newline at end of file +var _0x7c6e=['index','then','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','format','kill','SIGINT','catch','systeminformation','child_process','exec','../../config/logger','api','util','lodash','error','inspect','status'];(function(_0x199e6a,_0x4e3e09){var _0xeae5e8=function(_0x2ad2e2){while(--_0x2ad2e2){_0x199e6a['push'](_0x199e6a['shift']());}};_0xeae5e8(++_0x4e3e09);}(_0x7c6e,0xce));var _0xe7c6=function(_0x19ff25,_0xed6579){_0x19ff25=_0x19ff25-0x0;var _0x1c817d=_0x7c6e[_0x19ff25];return _0x1c817d;};'use strict';var info=require(_0xe7c6('0x0'));var exec=require(_0xe7c6('0x1'))[_0xe7c6('0x2')];var logger=require(_0xe7c6('0x3'))(_0xe7c6('0x4'));var util=require(_0xe7c6('0x5'));var BPromise=require('bluebird');var _=require(_0xe7c6('0x6'));function handleError(_0x4ad4fe,_0x46ffd7,_0x2ba8d3){_0x46ffd7=_0x46ffd7||0x1f4;return function(_0x21d4ad){logger[_0xe7c6('0x7')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x2ba8d3,_0x46ffd7,util[_0xe7c6('0x8')](_0x21d4ad,{'showHidden':![],'depth':null}));delete _0x21d4ad['name'];_0x4ad4fe[_0xe7c6('0x9')](_0x46ffd7)['send'](_0x21d4ad);};}exports[_0xe7c6('0xa')]=function(_0x5046a6,_0x3dc50b){return info['getAllData']()[_0xe7c6('0xb')](function(_0x5ad675){return _0x3dc50b['status'](0xc8)[_0xe7c6('0xc')](_0x5ad675);})['catch'](function(_0x2fb85d){return _0x3dc50b[_0xe7c6('0x9')](0x1f4)['json'](_0x2fb85d);});};exports[_0xe7c6('0xd')]=function(_0x34ee86,_0x528f83){var _0x46edaa=[_0xe7c6('0xe')];return new BPromise(function(_0x379b2c,_0x382608){return exec(util['format'](_0xe7c6('0xf'),_0x34ee86[_0xe7c6('0x10')][_0xe7c6('0x11')]),function(_0x3a797d,_0x7ddfce,_0x107b6f){if(_0x3a797d){return _0x382608(_0x3a797d);}return _0x379b2c(_0x7ddfce);});})[_0xe7c6('0xb')](function(_0x1cd07e){var _0x1ff51f=![];var _0x4c4910=_0x1cd07e['split'](/\n/);for(var _0x29b6af=0x0,_0xdae757=_0x46edaa[_0xe7c6('0x12')];_0x29b6af<_0xdae757,_0x1ff51f===![];_0x29b6af+=0x1){if(_0x1cd07e[_0xe7c6('0x13')](_0x46edaa[_0x29b6af])>=0x0){_0x1ff51f=!![];}}if(!_0x1ff51f){throw new Error(util[_0xe7c6('0x14')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x34ee86[_0xe7c6('0x10')][_0xe7c6('0x11')]));}process[_0xe7c6('0x15')](_0x34ee86[_0xe7c6('0x10')][_0xe7c6('0x11')],_0xe7c6('0x16'));return _0x528f83[_0xe7c6('0x9')](0xc8)['json']({'message':util[_0xe7c6('0x14')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x34ee86['params'][_0xe7c6('0x11')])});})[_0xe7c6('0x17')](handleError(_0x528f83,null,_0xe7c6('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b337588..8ab0456 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 _0xff99=['get','/:id','isAuthenticated','post','create','put','update','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','index'];(function(_0xc7a7f0,_0x48c403){var _0x100926=function(_0x4bc8e6){while(--_0x4bc8e6){_0xc7a7f0['push'](_0xc7a7f0['shift']());}};_0x100926(++_0x48c403);}(_0xff99,0x129));var _0x9ff9=function(_0x1bb1d5,_0x4dd8fc){_0x1bb1d5=_0x1bb1d5-0x0;var _0x4436c1=_0xff99[_0x1bb1d5];return _0x4436c1;};'use strict';var multer=require('multer');var util=require(_0x9ff9('0x0'));var path=require('path');var timeout=require(_0x9ff9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9ff9('0x2'));var interaction=require(_0x9ff9('0x3'));var config=require(_0x9ff9('0x4'));var controller=require(_0x9ff9('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x9ff9('0x6')]);router[_0x9ff9('0x7')](_0x9ff9('0x8'),auth[_0x9ff9('0x9')](),controller['show']);router[_0x9ff9('0xa')]('/',auth['isAuthenticated'](),controller[_0x9ff9('0xb')]);router[_0x9ff9('0xc')](_0x9ff9('0x8'),auth[_0x9ff9('0x9')](),controller[_0x9ff9('0xd')]);router[_0x9ff9('0xe')]('/:id',auth[_0x9ff9('0x9')](),controller['destroy']);module[_0x9ff9('0xf')]=router; \ No newline at end of file +var _0x95fc=['/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','index','show','post','isAuthenticated','create'];(function(_0x38e106,_0x66d38a){var _0x41ba17=function(_0x152e53){while(--_0x152e53){_0x38e106['push'](_0x38e106['shift']());}};_0x41ba17(++_0x66d38a);}(_0x95fc,0x1a8));var _0xc95f=function(_0x315f1a,_0x323780){_0x315f1a=_0x315f1a-0x0;var _0x5dc556=_0x95fc[_0x315f1a];return _0x5dc556;};'use strict';var multer=require(_0xc95f('0x0'));var util=require(_0xc95f('0x1'));var path=require(_0xc95f('0x2'));var timeout=require(_0xc95f('0x3'));var express=require(_0xc95f('0x4'));var router=express[_0xc95f('0x5')]();var fs_extra=require(_0xc95f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc95f('0x7'));var config=require(_0xc95f('0x8'));var controller=require(_0xc95f('0x9'));router[_0xc95f('0xa')]('/',auth['isAuthenticated'](),controller[_0xc95f('0xb')]);router[_0xc95f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc95f('0xc')]);router[_0xc95f('0xd')]('/',auth[_0xc95f('0xe')](),controller[_0xc95f('0xf')]);router['put'](_0xc95f('0x10'),auth[_0xc95f('0xe')](),controller[_0xc95f('0x11')]);router['delete']('/:id',auth[_0xc95f('0xe')](),controller[_0xc95f('0x12')]);module[_0xc95f('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 764a2c5..ffc893f 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 _0x6e1c=['STRING','#0091EA','sequelize','name'];(function(_0x27964e,_0x2609a2){var _0x4d304c=function(_0x2e8992){while(--_0x2e8992){_0x27964e['push'](_0x27964e['shift']());}};_0x4d304c(++_0x2609a2);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc6e1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc6e1('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc6e1('0x2')],'defaultValue':_0xc6e1('0x3')},'description':{'type':Sequelize[_0xc6e1('0x2')]}}; \ No newline at end of file +var _0x7633=['sequelize','exports','STRING','name'];(function(_0x332998,_0x2d99c7){var _0x460be7=function(_0x1a4d24){while(--_0x1a4d24){_0x332998['push'](_0x332998['shift']());}};_0x460be7(++_0x2d99c7);}(_0x7633,0x1c4));var _0x3763=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x7633[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x3763('0x0'));module[_0x3763('0x1')]={'name':{'type':Sequelize[_0x3763('0x2')],'unique':_0x3763('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3763('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x3763('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a1926f4..bd4ecee 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 _0x0624=['count','offset','set','json','apply','reject','save','then','get','Tags','UserProfileResource','destroy','end','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','Tag','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit'];(function(_0x1899dd,_0x5cd649){var _0x5ec613=function(_0x58e14e){while(--_0x58e14e){_0x1899dd['push'](_0x1899dd['shift']());}};_0x5ec613(++_0x5cd649);}(_0x0624,0x132));var _0x4062=function(_0x3857f9,_0x29640b){_0x3857f9=_0x3857f9-0x0;var _0x1b4dfe=_0x0624[_0x3857f9];return _0x1b4dfe;};'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(_0x4062('0x0'));var moment=require(_0x4062('0x1'));var BPromise=require(_0x4062('0x2'));var Mustache=require(_0x4062('0x3'));var util=require(_0x4062('0x4'));var path=require(_0x4062('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4062('0x6'));var fs=require('fs');var fs_extra=require(_0x4062('0x7'));var _=require(_0x4062('0x8'));var squel=require(_0x4062('0x9'));var crypto=require(_0x4062('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4062('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4062('0xc'));var Papa=require(_0x4062('0xd'));var Redis=require(_0x4062('0xe'));var authService=require(_0x4062('0xf'));var qs=require(_0x4062('0x10'));var as=require(_0x4062('0x11'));var hardwareService=require(_0x4062('0x12'));var logger=require('../../config/logger')(_0x4062('0x13'));var utils=require('../../config/utils');var config=require(_0x4062('0x14'));var licenseUtil=require(_0x4062('0x15'));var db=require(_0x4062('0x16'))['db'];function respondWithStatusCode(_0x3146e2,_0x160b6d){_0x160b6d=_0x160b6d||0xcc;return function(_0x57e04b){if(_0x57e04b){return _0x3146e2[_0x4062('0x17')](_0x160b6d);}return _0x3146e2[_0x4062('0x18')](_0x160b6d)['end']();};}function respondWithResult(_0x32ced6,_0x42859d){_0x42859d=_0x42859d||0xc8;return function(_0x95bb42){if(_0x95bb42){return _0x32ced6['status'](_0x42859d)['json'](_0x95bb42);}};}function respondWithFilteredResult(_0x25a717,_0x467ac7){return function(_0x48ea2b){if(_0x48ea2b){var _0x4d7166=typeof _0x467ac7['offset']==='undefined'&&typeof _0x467ac7[_0x4062('0x19')]==='undefined';var _0x2efc3c=_0x48ea2b[_0x4062('0x1a')];var _0x3d14bb=_0x4d7166?0x0:_0x467ac7[_0x4062('0x1b')];var _0x2a04c7=_0x4d7166?_0x48ea2b[_0x4062('0x1a')]:_0x467ac7[_0x4062('0x1b')]+_0x467ac7['limit'];var _0x324bb3;if(_0x2a04c7>=_0x2efc3c){_0x2a04c7=_0x2efc3c;_0x324bb3=0xc8;}else{_0x324bb3=0xce;}_0x25a717['status'](_0x324bb3);return _0x25a717[_0x4062('0x1c')]('Content-Range',_0x3d14bb+'-'+_0x2a04c7+'/'+_0x2efc3c)[_0x4062('0x1d')](_0x48ea2b);}return null;};}function patchUpdates(_0x31777f){return function(_0x12c6a3){try{jsonpatch[_0x4062('0x1e')](_0x12c6a3,_0x31777f,!![]);}catch(_0x3cb45d){return BPromise[_0x4062('0x1f')](_0x3cb45d);}return _0x12c6a3[_0x4062('0x20')]();};}function saveUpdates(_0x341310,_0xc6c0ba){return function(_0x53648a){if(_0x53648a){return _0x53648a['update'](_0x341310)[_0x4062('0x21')](function(_0xc5e4a0){return _0xc5e4a0;});}return null;};}function removeEntity(_0x23f81c,_0x1fa194){return function(_0x59d19f){if(_0x59d19f){return _0x59d19f['destroy']()['then'](function(){var _0x11e837=_0x59d19f[_0x4062('0x22')]({'plain':!![]});var _0x11b962=_0x4062('0x23');return db[_0x4062('0x24')][_0x4062('0x25')]({'where':{'type':_0x11b962,'resourceId':_0x11e837['id']}})['then'](function(){return _0x59d19f;});})[_0x4062('0x21')](function(){_0x23f81c[_0x4062('0x18')](0xcc)[_0x4062('0x26')]();});}};}function handleEntityNotFound(_0x28e9e4,_0xb7f7c7){return function(_0x5934d2){if(!_0x5934d2){_0x28e9e4[_0x4062('0x17')](0x194);}return _0x5934d2;};}function handleError(_0x4a0312,_0x4de5c0){_0x4de5c0=_0x4de5c0||0x1f4;return function(_0x391065){logger['error'](_0x391065[_0x4062('0x27')]);if(_0x391065[_0x4062('0x28')]){delete _0x391065[_0x4062('0x28')];}_0x4a0312[_0x4062('0x18')](_0x4de5c0)[_0x4062('0x29')](_0x391065);};}exports[_0x4062('0x2a')]=function(_0xd818bc,_0x253bcf){var _0x5f569c={},_0x592fca={},_0x51de11={'count':0x0,'rows':[]};var _0x70dfdc=_[_0x4062('0x2b')](db['Tag'][_0x4062('0x2c')],function(_0x5ad1a3){return{'name':_0x5ad1a3['fieldName'],'type':_0x5ad1a3['type'][_0x4062('0x2d')]};});_0x592fca[_0x4062('0x2e')]=_[_0x4062('0x2b')](_0x70dfdc,_0x4062('0x28'));_0x592fca[_0x4062('0x2f')]=_[_0x4062('0x30')](_0xd818bc[_0x4062('0x2f')]);_0x592fca[_0x4062('0x31')]=_[_0x4062('0x32')](_0x592fca[_0x4062('0x2e')],_0x592fca[_0x4062('0x2f')]);_0x5f569c[_0x4062('0x33')]=_['intersection'](_0x592fca[_0x4062('0x2e')],qs['fields'](_0xd818bc[_0x4062('0x2f')][_0x4062('0x34')]));_0x5f569c[_0x4062('0x33')]=_0x5f569c['attributes'][_0x4062('0x35')]?_0x5f569c[_0x4062('0x33')]:_0x592fca[_0x4062('0x2e')];if(!_0xd818bc[_0x4062('0x2f')][_0x4062('0x36')](_0x4062('0x37'))){_0x5f569c[_0x4062('0x19')]=qs[_0x4062('0x19')](_0xd818bc[_0x4062('0x2f')]['limit']);_0x5f569c[_0x4062('0x1b')]=qs[_0x4062('0x1b')](_0xd818bc[_0x4062('0x2f')][_0x4062('0x1b')]);}_0x5f569c[_0x4062('0x38')]=qs[_0x4062('0x39')](_0xd818bc['query'][_0x4062('0x39')]);_0x5f569c[_0x4062('0x3a')]=qs[_0x4062('0x31')](_[_0x4062('0x3b')](_0xd818bc[_0x4062('0x2f')],_0x592fca['filters']),_0x70dfdc);if(_0xd818bc['query'][_0x4062('0x3c')]){_0x5f569c[_0x4062('0x3a')]=_['merge'](_0x5f569c[_0x4062('0x3a')],{'$or':_[_0x4062('0x2b')](_0x70dfdc,function(_0x3d4fab){if(_0x3d4fab[_0x4062('0x3d')]!==_0x4062('0x3e')){var _0x218864={};_0x218864[_0x3d4fab[_0x4062('0x28')]]={'$like':'%'+_0xd818bc[_0x4062('0x2f')][_0x4062('0x3c')]+'%'};return _0x218864;}})});}_0x5f569c=_[_0x4062('0x3f')]({},_0x5f569c,_0xd818bc['options']);var _0x32debb={'where':_0x5f569c[_0x4062('0x3a')]};return db['Tag']['count'](_0x32debb)['then'](function(_0x3e903b){_0x51de11[_0x4062('0x1a')]=_0x3e903b;if(_0xd818bc[_0x4062('0x2f')][_0x4062('0x40')]){_0x5f569c['include']=[{'all':!![]}];}return db['Tag'][_0x4062('0x41')](_0x5f569c);})[_0x4062('0x21')](function(_0x39c9ef){_0x51de11[_0x4062('0x42')]=_0x39c9ef;return _0x51de11;})['then'](respondWithFilteredResult(_0x253bcf,_0x5f569c))['catch'](handleError(_0x253bcf,null));};exports[_0x4062('0x43')]=function(_0x2ac3b5,_0x1c4259){var _0x1b3897={'raw':!![],'where':{'id':_0x2ac3b5[_0x4062('0x44')]['id']}},_0x9ab8ac={};_0x9ab8ac[_0x4062('0x2e')]=_[_0x4062('0x30')](db['Tag'][_0x4062('0x2c')]);_0x9ab8ac[_0x4062('0x2f')]=_[_0x4062('0x30')](_0x2ac3b5['query']);_0x9ab8ac[_0x4062('0x31')]=_['intersection'](_0x9ab8ac['model'],_0x9ab8ac[_0x4062('0x2f')]);_0x1b3897[_0x4062('0x33')]=_['intersection'](_0x9ab8ac[_0x4062('0x2e')],qs[_0x4062('0x34')](_0x2ac3b5[_0x4062('0x2f')][_0x4062('0x34')]));_0x1b3897[_0x4062('0x33')]=_0x1b3897['attributes']['length']?_0x1b3897[_0x4062('0x33')]:_0x9ab8ac[_0x4062('0x2e')];if(_0x2ac3b5[_0x4062('0x2f')]['includeAll']){_0x1b3897[_0x4062('0x45')]=[{'all':!![]}];}_0x1b3897=_[_0x4062('0x3f')]({},_0x1b3897,_0x2ac3b5['options']);return db[_0x4062('0x46')][_0x4062('0x47')](_0x1b3897)['then'](handleEntityNotFound(_0x1c4259,null))['then'](respondWithResult(_0x1c4259,null))['catch'](handleError(_0x1c4259,null));};exports[_0x4062('0x48')]=function(_0x560b20,_0x58921a){return db[_0x4062('0x46')]['create'](_0x560b20['body'],{})[_0x4062('0x21')](function(_0x15819a){var _0x1f6df9=_0x560b20['user'][_0x4062('0x22')]({'plain':!![]});if(!_0x1f6df9)throw new Error(_0x4062('0x49'));if(_0x1f6df9[_0x4062('0x4a')]==='user'){var _0x5c75b6=_0x15819a[_0x4062('0x22')]({'plain':!![]});var _0x1e9b7a='Tags';return db[_0x4062('0x4b')][_0x4062('0x47')]({'where':{'name':_0x1e9b7a,'userProfileId':_0x1f6df9[_0x4062('0x4c')]},'raw':!![]})['then'](function(_0x53729d){if(_0x53729d&&_0x53729d[_0x4062('0x4d')]===0x0){return db[_0x4062('0x24')][_0x4062('0x48')]({'name':_0x5c75b6[_0x4062('0x28')],'resourceId':_0x5c75b6['id'],'type':_0x53729d[_0x4062('0x28')],'sectionId':_0x53729d['id']},{})['then'](function(){return _0x15819a;});}else{return _0x15819a;}})['catch'](function(_0x6797c6){logger[_0x4062('0x4e')](_0x4062('0x4f'),_0x6797c6);throw _0x6797c6;});}return _0x15819a;})[_0x4062('0x21')](respondWithResult(_0x58921a,0xc9))[_0x4062('0x50')](handleError(_0x58921a,null));};exports[_0x4062('0x51')]=function(_0x2180ae,_0x2afcc7){if(_0x2180ae[_0x4062('0x52')]['id']){delete _0x2180ae[_0x4062('0x52')]['id'];}return db[_0x4062('0x46')][_0x4062('0x47')]({'where':{'id':_0x2180ae['params']['id']}})[_0x4062('0x21')](handleEntityNotFound(_0x2afcc7,null))[_0x4062('0x21')](saveUpdates(_0x2180ae['body'],null))[_0x4062('0x21')](respondWithResult(_0x2afcc7,null))[_0x4062('0x50')](handleError(_0x2afcc7,null));};exports['destroy']=function(_0x24e98c,_0x5c76e7){return db['Tag'][_0x4062('0x47')]({'where':{'id':_0x24e98c[_0x4062('0x44')]['id']}})[_0x4062('0x21')](handleEntityNotFound(_0x5c76e7,null))[_0x4062('0x21')](removeEntity(_0x5c76e7,null))[_0x4062('0x50')](handleError(_0x5c76e7,null));}; \ No newline at end of file +var _0xb821=['create','body','user','get','role','Tags','find','catch','update','rimraf','zip-dir','moment','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/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','include','findAll','show','params','keys','includeAll','options'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb821,0xa7));var _0x1b82=function(_0x3672f8,_0x1b122e){_0x3672f8=_0x3672f8-0x0;var _0x4bdf01=_0xb821[_0x3672f8];return _0x4bdf01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];function respondWithStatusCode(_0x241d11,_0x2391f5){_0x2391f5=_0x2391f5||0xcc;return function(_0x61b6eb){if(_0x61b6eb){return _0x241d11['sendStatus'](_0x2391f5);}return _0x241d11[_0x1b82('0x18')](_0x2391f5)['end']();};}function respondWithResult(_0x54915f,_0x1e553a){_0x1e553a=_0x1e553a||0xc8;return function(_0x4bf75b){if(_0x4bf75b){return _0x54915f[_0x1b82('0x18')](_0x1e553a)[_0x1b82('0x19')](_0x4bf75b);}};}function respondWithFilteredResult(_0x5d4cf1,_0x46c2cf){return function(_0x5dab7d){if(_0x5dab7d){var _0x563261=typeof _0x46c2cf[_0x1b82('0x1a')]==='undefined'&&typeof _0x46c2cf[_0x1b82('0x1b')]===_0x1b82('0x1c');var _0xf42818=_0x5dab7d['count'];var _0x514082=_0x563261?0x0:_0x46c2cf[_0x1b82('0x1a')];var _0x5d66c3=_0x563261?_0x5dab7d[_0x1b82('0x1d')]:_0x46c2cf[_0x1b82('0x1a')]+_0x46c2cf[_0x1b82('0x1b')];var _0x594a63;if(_0x5d66c3>=_0xf42818){_0x5d66c3=_0xf42818;_0x594a63=0xc8;}else{_0x594a63=0xce;}_0x5d4cf1[_0x1b82('0x18')](_0x594a63);return _0x5d4cf1[_0x1b82('0x1e')](_0x1b82('0x1f'),_0x514082+'-'+_0x5d66c3+'/'+_0xf42818)[_0x1b82('0x19')](_0x5dab7d);}return null;};}function patchUpdates(_0x10d45c){return function(_0x47e99b){try{jsonpatch[_0x1b82('0x20')](_0x47e99b,_0x10d45c,!![]);}catch(_0x1892b0){return BPromise[_0x1b82('0x21')](_0x1892b0);}return _0x47e99b[_0x1b82('0x22')]();};}function saveUpdates(_0x26e481,_0x31fd64){return function(_0x2d07f4){if(_0x2d07f4){return _0x2d07f4['update'](_0x26e481)[_0x1b82('0x23')](function(_0x233740){return _0x233740;});}return null;};}function removeEntity(_0x5b8d09,_0x561d78){return function(_0x225b81){if(_0x225b81){return _0x225b81[_0x1b82('0x24')]()['then'](function(){var _0x3a1226=_0x225b81['get']({'plain':!![]});var _0x5cd458='Tags';return db[_0x1b82('0x25')][_0x1b82('0x24')]({'where':{'type':_0x5cd458,'resourceId':_0x3a1226['id']}})[_0x1b82('0x23')](function(){return _0x225b81;});})[_0x1b82('0x23')](function(){_0x5b8d09['status'](0xcc)[_0x1b82('0x26')]();});}};}function handleEntityNotFound(_0x165b45,_0x1b5260){return function(_0x7455e8){if(!_0x7455e8){_0x165b45[_0x1b82('0x27')](0x194);}return _0x7455e8;};}function handleError(_0x1b8b6f,_0x223b6a){_0x223b6a=_0x223b6a||0x1f4;return function(_0x21ea34){logger[_0x1b82('0x28')](_0x21ea34[_0x1b82('0x29')]);if(_0x21ea34[_0x1b82('0x2a')]){delete _0x21ea34[_0x1b82('0x2a')];}_0x1b8b6f[_0x1b82('0x18')](_0x223b6a)['send'](_0x21ea34);};}exports[_0x1b82('0x2b')]=function(_0x2931d0,_0x155a34){var _0x457dbb={},_0x18e4ff={},_0x115ce7={'count':0x0,'rows':[]};var _0xd3c4a=_[_0x1b82('0x2c')](db[_0x1b82('0x2d')][_0x1b82('0x2e')],function(_0x501ab0){return{'name':_0x501ab0[_0x1b82('0x2f')],'type':_0x501ab0[_0x1b82('0x30')][_0x1b82('0x31')]};});_0x18e4ff[_0x1b82('0x32')]=_['map'](_0xd3c4a,_0x1b82('0x2a'));_0x18e4ff[_0x1b82('0x33')]=_['keys'](_0x2931d0[_0x1b82('0x33')]);_0x18e4ff[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x18e4ff['model'],_0x18e4ff['query']);_0x457dbb[_0x1b82('0x36')]=_['intersection'](_0x18e4ff['model'],qs[_0x1b82('0x37')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x37')]));_0x457dbb['attributes']=_0x457dbb[_0x1b82('0x36')][_0x1b82('0x38')]?_0x457dbb[_0x1b82('0x36')]:_0x18e4ff[_0x1b82('0x32')];if(!_0x2931d0['query'][_0x1b82('0x39')](_0x1b82('0x3a'))){_0x457dbb[_0x1b82('0x1b')]=qs['limit'](_0x2931d0['query'][_0x1b82('0x1b')]);_0x457dbb['offset']=qs[_0x1b82('0x1a')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x1a')]);}_0x457dbb[_0x1b82('0x3b')]=qs[_0x1b82('0x3c')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x3c')]);_0x457dbb[_0x1b82('0x3d')]=qs['filters'](_['pick'](_0x2931d0[_0x1b82('0x33')],_0x18e4ff['filters']),_0xd3c4a);if(_0x2931d0[_0x1b82('0x33')]['filter']){_0x457dbb[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x457dbb[_0x1b82('0x3d')],{'$or':_[_0x1b82('0x2c')](_0xd3c4a,function(_0x2af0bd){if(_0x2af0bd[_0x1b82('0x30')]!=='VIRTUAL'){var _0x17d214={};_0x17d214[_0x2af0bd['name']]={'$like':'%'+_0x2931d0[_0x1b82('0x33')]['filter']+'%'};return _0x17d214;}})});}_0x457dbb=_[_0x1b82('0x3e')]({},_0x457dbb,_0x2931d0['options']);var _0x5aeac1={'where':_0x457dbb[_0x1b82('0x3d')]};return db[_0x1b82('0x2d')][_0x1b82('0x1d')](_0x5aeac1)[_0x1b82('0x23')](function(_0x3eb429){_0x115ce7['count']=_0x3eb429;if(_0x2931d0[_0x1b82('0x33')]['includeAll']){_0x457dbb[_0x1b82('0x3f')]=[{'all':!![]}];}return db[_0x1b82('0x2d')][_0x1b82('0x40')](_0x457dbb);})[_0x1b82('0x23')](function(_0x365ab4){_0x115ce7['rows']=_0x365ab4;return _0x115ce7;})[_0x1b82('0x23')](respondWithFilteredResult(_0x155a34,_0x457dbb))['catch'](handleError(_0x155a34,null));};exports[_0x1b82('0x41')]=function(_0x14b3ab,_0x5a50ba){var _0xa88eb2={'raw':!![],'where':{'id':_0x14b3ab[_0x1b82('0x42')]['id']}},_0x225f6b={};_0x225f6b[_0x1b82('0x32')]=_[_0x1b82('0x43')](db[_0x1b82('0x2d')][_0x1b82('0x2e')]);_0x225f6b['query']=_[_0x1b82('0x43')](_0x14b3ab['query']);_0x225f6b[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],_0x225f6b[_0x1b82('0x33')]);_0xa88eb2[_0x1b82('0x36')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],qs[_0x1b82('0x37')](_0x14b3ab[_0x1b82('0x33')][_0x1b82('0x37')]));_0xa88eb2[_0x1b82('0x36')]=_0xa88eb2[_0x1b82('0x36')][_0x1b82('0x38')]?_0xa88eb2[_0x1b82('0x36')]:_0x225f6b['model'];if(_0x14b3ab['query'][_0x1b82('0x44')]){_0xa88eb2['include']=[{'all':!![]}];}_0xa88eb2=_[_0x1b82('0x3e')]({},_0xa88eb2,_0x14b3ab[_0x1b82('0x45')]);return db[_0x1b82('0x2d')]['find'](_0xa88eb2)[_0x1b82('0x23')](handleEntityNotFound(_0x5a50ba,null))['then'](respondWithResult(_0x5a50ba,null))['catch'](handleError(_0x5a50ba,null));};exports[_0x1b82('0x46')]=function(_0x2aadf7,_0x242324){return db['Tag'][_0x1b82('0x46')](_0x2aadf7[_0x1b82('0x47')],{})['then'](function(_0x5ca898){var _0x106282=_0x2aadf7[_0x1b82('0x48')][_0x1b82('0x49')]({'plain':!![]});if(!_0x106282)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106282[_0x1b82('0x4a')]===_0x1b82('0x48')){var _0x31fb5d=_0x5ca898[_0x1b82('0x49')]({'plain':!![]});var _0xbba448=_0x1b82('0x4b');return db['UserProfileSection'][_0x1b82('0x4c')]({'where':{'name':_0xbba448,'userProfileId':_0x106282['userProfileId']},'raw':!![]})[_0x1b82('0x23')](function(_0x247cb7){if(_0x247cb7&&_0x247cb7['autoAssociation']===0x0){return db[_0x1b82('0x25')]['create']({'name':_0x31fb5d[_0x1b82('0x2a')],'resourceId':_0x31fb5d['id'],'type':_0x247cb7[_0x1b82('0x2a')],'sectionId':_0x247cb7['id']},{})[_0x1b82('0x23')](function(){return _0x5ca898;});}else{return _0x5ca898;}})[_0x1b82('0x4d')](function(_0xd46842){logger[_0x1b82('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd46842);throw _0xd46842;});}return _0x5ca898;})['then'](respondWithResult(_0x242324,0xc9))[_0x1b82('0x4d')](handleError(_0x242324,null));};exports[_0x1b82('0x4e')]=function(_0x1b9e81,_0x26c1ec){if(_0x1b9e81[_0x1b82('0x47')]['id']){delete _0x1b9e81[_0x1b82('0x47')]['id'];}return db[_0x1b82('0x2d')][_0x1b82('0x4c')]({'where':{'id':_0x1b9e81['params']['id']}})['then'](handleEntityNotFound(_0x26c1ec,null))['then'](saveUpdates(_0x1b9e81[_0x1b82('0x47')],null))[_0x1b82('0x23')](respondWithResult(_0x26c1ec,null))[_0x1b82('0x4d')](handleError(_0x26c1ec,null));};exports[_0x1b82('0x24')]=function(_0x1eb4a4,_0x15b0d3){return db[_0x1b82('0x2d')]['find']({'where':{'id':_0x1eb4a4[_0x1b82('0x42')]['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x15b0d3,null))[_0x1b82('0x23')](removeEntity(_0x15b0d3,null))[_0x1b82('0x4d')](handleError(_0x15b0d3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index ca67d37..6e55e22 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 _0x842a=['bluebird','request-promise','path','rimraf','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x1b637b,_0x18155b){var _0x456ee3=function(_0x59ac87){while(--_0x59ac87){_0x1b637b['push'](_0x1b637b['shift']());}};_0x456ee3(++_0x18155b);}(_0x842a,0x133));var _0xa842=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x842a[_0x57474e];return _0xfaae8c;};'use strict';var _=require(_0xa842('0x0'));var util=require(_0xa842('0x1'));var logger=require(_0xa842('0x2'))(_0xa842('0x3'));var moment=require(_0xa842('0x4'));var BPromise=require(_0xa842('0x5'));var rp=require(_0xa842('0x6'));var fs=require('fs');var path=require(_0xa842('0x7'));var rimraf=require(_0xa842('0x8'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xa842('0x9')]=function(_0x55c8ed,_0x3a78ae){return _0x55c8ed[_0xa842('0xa')](_0xa842('0xb'),attributes,{'tableName':_0xa842('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccd5=['tools_tags','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xccd5,0xa6));var _0x5ccd=function(_0x340da7,_0x13d6fc){_0x340da7=_0x340da7-0x0;var _0x43b466=_0xccd5[_0x340da7];return _0x43b466;};'use strict';var _=require('lodash');var util=require(_0x5ccd('0x0'));var logger=require(_0x5ccd('0x1'))(_0x5ccd('0x2'));var moment=require(_0x5ccd('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ccd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ccd('0x5'));var config=require(_0x5ccd('0x6'));var attributes=require(_0x5ccd('0x7'));module[_0x5ccd('0x8')]=function(_0x567800,_0x3404fe){return _0x567800[_0x5ccd('0x9')]('Tag',attributes,{'tableName':_0x5ccd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 5ec6149..732d6e5 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 _0xaf93=['jayson/promise','client','http','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','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0xaf93,0x151));var _0x3af9=function(_0x2f0418,_0x505390){_0x2f0418=_0x2f0418-0x0;var _0x9cbea4=_0xaf93[_0x2f0418];return _0x9cbea4;};'use strict';var _=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3af9('0x2'));var fs=require('fs');var Redis=require(_0x3af9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3af9('0x4'));var logger=require(_0x3af9('0x5'))(_0x3af9('0x6'));var config=require(_0x3af9('0x7'));var jayson=require(_0x3af9('0x8'));var client=jayson[_0x3af9('0x9')][_0x3af9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x535583,_0x2ac1a2,_0x56e4c2){return new BPromise(function(_0x133672,_0x53b5ba){return client['request'](_0x535583,_0x56e4c2)[_0x3af9('0xb')](function(_0x5d655f){logger['info'](_0x3af9('0xc'),_0x2ac1a2,_0x3af9('0xd'));logger[_0x3af9('0xe')](_0x3af9('0xf'),_0x2ac1a2,'request\x20sent',JSON[_0x3af9('0x10')](_0x5d655f));if(_0x5d655f[_0x3af9('0x11')]){if(_0x5d655f[_0x3af9('0x11')][_0x3af9('0x12')]===0x1f4){logger[_0x3af9('0x11')](_0x3af9('0xc'),_0x2ac1a2,_0x5d655f[_0x3af9('0x11')][_0x3af9('0x13')]);return _0x53b5ba(_0x5d655f['error'][_0x3af9('0x13')]);}logger['error'](_0x3af9('0xc'),_0x2ac1a2,_0x5d655f[_0x3af9('0x11')][_0x3af9('0x13')]);return _0x133672(_0x5d655f['error'][_0x3af9('0x13')]);}else{logger[_0x3af9('0x14')](_0x3af9('0xc'),_0x2ac1a2,'request\x20sent');_0x133672(_0x5d655f[_0x3af9('0x15')][_0x3af9('0x13')]);}})[_0x3af9('0x16')](function(_0x29dc4b){logger['error'](_0x3af9('0xc'),_0x2ac1a2,_0x29dc4b);_0x53b5ba(_0x29dc4b);});});} \ No newline at end of file +var _0xd2ea=['../../config/environment','jayson/promise','client','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1eb7e6,_0xf0ce67){var _0x1a6bc6=function(_0x31f996){while(--_0x31f996){_0x1eb7e6['push'](_0x1eb7e6['shift']());}};_0x1a6bc6(++_0xf0ce67);}(_0xd2ea,0x15f));var _0xad2e=function(_0x300ca3,_0x1b2ffb){_0x300ca3=_0x300ca3-0x0;var _0x1c83f8=_0xd2ea[_0x300ca3];return _0x1c83f8;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6a3f3fb..210f4c1 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 30e5655..c0c595d 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x182439,_0x768e81){var _0x4a8633=function(_0x3a1d09){while(--_0x3a1d09){_0x182439['push'](_0x182439['shift']());}};_0x4a8633(++_0x768e81);}(_0x2032,0xd9));var _0x2203=function(_0x20e51a,_0x3af51f){_0x20e51a=_0x20e51a-0x0;var _0x29ca98=_0x2032[_0x20e51a];return _0x29ca98;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x4d2073,_0x37d13c){var _0x132940=function(_0x402e78){while(--_0x402e78){_0x4d2073['push'](_0x4d2073['shift']());}};_0x132940(++_0x37d13c);}(_0x757a,0xde));var _0xa757=function(_0x72dfed,_0x55d6ce){_0x72dfed=_0x72dfed-0x0;var _0x52e5c9=_0x757a[_0x72dfed];return _0x52e5c9;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 75153c7..b4d059d 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 _0xea53=['query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','Sequelize','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','getQueues','isValidChannel','channel','ValidationError','capitalize','toLowerCase','Queues','addQueues','findOne','ids','removeQueues','Unknown\x20channel','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','TeamVoiceQueue','Queue','findOrCreate','emit','Queue:save','User','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','addAgents','spread','removeAgents','Queue:remove','getAgents','nolimit','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','error','name','send','map','Team','rawAttributes','fieldName','type','key','model'];(function(_0x3bfaec,_0x52c9a2){var _0x1c002a=function(_0x4492a3){while(--_0x4492a3){_0x3bfaec['push'](_0x3bfaec['shift']());}};_0x1c002a(++_0x52c9a2);}(_0xea53,0x102));var _0x3ea5=function(_0x34d9e8,_0x3a6afb){_0x34d9e8=_0x34d9e8-0x0;var _0x48127d=_0xea53[_0x34d9e8];return _0x48127d;};'use strict';var emlformat=require(_0x3ea5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3ea5('0x1'));var moment=require(_0x3ea5('0x2'));var BPromise=require(_0x3ea5('0x3'));var Mustache=require(_0x3ea5('0x4'));var util=require(_0x3ea5('0x5'));var path=require('path');var sox=require(_0x3ea5('0x6'));var csv=require(_0x3ea5('0x7'));var ejs=require(_0x3ea5('0x8'));var fs=require('fs');var fs_extra=require(_0x3ea5('0x9'));var _=require(_0x3ea5('0xa'));var squel=require(_0x3ea5('0xb'));var crypto=require(_0x3ea5('0xc'));var jsforce=require(_0x3ea5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3ea5('0x7'));var querystring=require(_0x3ea5('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3ea5('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ea5('0x10'))(_0x3ea5('0x11'));var utils=require(_0x3ea5('0x12'));var config=require(_0x3ea5('0x13'));var licenseUtil=require(_0x3ea5('0x14'));var db=require(_0x3ea5('0x15'))['db'];config[_0x3ea5('0x16')]=_[_0x3ea5('0x17')](config[_0x3ea5('0x16')],{'host':_0x3ea5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ea5('0x16')]));require('./team.socket')[_0x3ea5('0x19')](socket);function respondWithStatusCode(_0x9acf14,_0x4d2689){_0x4d2689=_0x4d2689||0xcc;return function(_0x12c22e){if(_0x12c22e){return _0x9acf14[_0x3ea5('0x1a')](_0x4d2689);}return _0x9acf14[_0x3ea5('0x1b')](_0x4d2689)['end']();};}function respondWithResult(_0x52b4db,_0x5e85c5){_0x5e85c5=_0x5e85c5||0xc8;return function(_0x598375){if(_0x598375){return _0x52b4db[_0x3ea5('0x1b')](_0x5e85c5)[_0x3ea5('0x1c')](_0x598375);}};}function respondWithFilteredResult(_0x2884aa,_0x497242){return function(_0x541476){if(_0x541476){var _0x3094bc=typeof _0x497242['offset']===_0x3ea5('0x1d')&&typeof _0x497242['limit']===_0x3ea5('0x1d');var _0x4c444b=_0x541476[_0x3ea5('0x1e')];var _0x1bf000=_0x3094bc?0x0:_0x497242[_0x3ea5('0x1f')];var _0x477f97=_0x3094bc?_0x541476[_0x3ea5('0x1e')]:_0x497242[_0x3ea5('0x1f')]+_0x497242[_0x3ea5('0x20')];var _0x2dbdc2;if(_0x477f97>=_0x4c444b){_0x477f97=_0x4c444b;_0x2dbdc2=0xc8;}else{_0x2dbdc2=0xce;}_0x2884aa[_0x3ea5('0x1b')](_0x2dbdc2);return _0x2884aa[_0x3ea5('0x21')](_0x3ea5('0x22'),_0x1bf000+'-'+_0x477f97+'/'+_0x4c444b)[_0x3ea5('0x1c')](_0x541476);}return null;};}function patchUpdates(_0x541d7b){return function(_0x2f8eb6){try{jsonpatch[_0x3ea5('0x23')](_0x2f8eb6,_0x541d7b,!![]);}catch(_0x549b15){return BPromise['reject'](_0x549b15);}return _0x2f8eb6[_0x3ea5('0x24')]();};}function saveUpdates(_0x5690d9,_0x397f55){return function(_0x59a21e){if(_0x59a21e){return _0x59a21e[_0x3ea5('0x25')](_0x5690d9)['then'](function(_0x3e9beb){return _0x3e9beb;});}return null;};}function handleEntityNotFound(_0x2ee378,_0x166f95){return function(_0x55800c){if(!_0x55800c){_0x2ee378[_0x3ea5('0x1a')](0x194);}return _0x55800c;};}function handleError(_0x4a0d2d,_0x5d213a){_0x5d213a=_0x5d213a||0x1f4;return function(_0x6009c4){logger[_0x3ea5('0x26')](_0x6009c4['stack']);if(_0x6009c4[_0x3ea5('0x27')]){delete _0x6009c4[_0x3ea5('0x27')];}_0x4a0d2d['status'](_0x5d213a)[_0x3ea5('0x28')](_0x6009c4);};}exports['index']=function(_0x24a151,_0x48f6a4){var _0x4a7221={},_0x25adf4={},_0x316d90={'count':0x0,'rows':[]};var _0x1452c9=_[_0x3ea5('0x29')](db[_0x3ea5('0x2a')][_0x3ea5('0x2b')],function(_0x10d6c3){return{'name':_0x10d6c3[_0x3ea5('0x2c')],'type':_0x10d6c3[_0x3ea5('0x2d')][_0x3ea5('0x2e')]};});_0x25adf4[_0x3ea5('0x2f')]=_[_0x3ea5('0x29')](_0x1452c9,_0x3ea5('0x27'));_0x25adf4[_0x3ea5('0x30')]=_[_0x3ea5('0x31')](_0x24a151[_0x3ea5('0x30')]);_0x25adf4['filters']=_['intersection'](_0x25adf4[_0x3ea5('0x2f')],_0x25adf4[_0x3ea5('0x30')]);_0x4a7221[_0x3ea5('0x32')]=_[_0x3ea5('0x33')](_0x25adf4[_0x3ea5('0x2f')],qs[_0x3ea5('0x34')](_0x24a151['query'][_0x3ea5('0x34')]));_0x4a7221['attributes']=_0x4a7221['attributes'][_0x3ea5('0x35')]?_0x4a7221['attributes']:_0x25adf4[_0x3ea5('0x2f')];if(!_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x36')]('nolimit')){_0x4a7221[_0x3ea5('0x20')]=qs['limit'](_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x20')]);_0x4a7221['offset']=qs['offset'](_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x1f')]);}_0x4a7221[_0x3ea5('0x37')]=qs['sort'](_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x38')]);_0x4a7221['where']=qs[_0x3ea5('0x39')](_[_0x3ea5('0x3a')](_0x24a151['query'],_0x25adf4[_0x3ea5('0x39')]),_0x1452c9);if(_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x3b')]){_0x4a7221[_0x3ea5('0x3c')]=_[_0x3ea5('0x3d')](_0x4a7221[_0x3ea5('0x3c')],{'$or':_[_0x3ea5('0x29')](_0x1452c9,function(_0x5b81f6){if(_0x5b81f6[_0x3ea5('0x2d')]!==_0x3ea5('0x3e')){var _0x1bb6f8={};_0x1bb6f8[_0x5b81f6[_0x3ea5('0x27')]]={'$like':'%'+_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x3b')]+'%'};return _0x1bb6f8;}})});}_0x4a7221=_[_0x3ea5('0x3d')]({},_0x4a7221,_0x24a151[_0x3ea5('0x3f')]);var _0x2a508b={'where':_0x4a7221[_0x3ea5('0x3c')]};return db['Team']['count'](_0x2a508b)[_0x3ea5('0x40')](function(_0x3ab814){_0x316d90['count']=_0x3ab814;if(_0x24a151[_0x3ea5('0x30')][_0x3ea5('0x41')]){_0x4a7221[_0x3ea5('0x42')]=[{'all':!![]}];}return db[_0x3ea5('0x2a')][_0x3ea5('0x43')](_0x4a7221);})[_0x3ea5('0x40')](function(_0x51792b){_0x316d90[_0x3ea5('0x44')]=_0x51792b;return _0x316d90;})[_0x3ea5('0x40')](respondWithFilteredResult(_0x48f6a4,_0x4a7221))['catch'](handleError(_0x48f6a4,null));};exports[_0x3ea5('0x45')]=function(_0x13c539,_0x359b12){var _0x2af4ae={'raw':![],'where':{'id':_0x13c539[_0x3ea5('0x46')]['id']}},_0x5803c2={};_0x5803c2[_0x3ea5('0x2f')]=_[_0x3ea5('0x31')](db[_0x3ea5('0x2a')][_0x3ea5('0x2b')]);_0x5803c2['query']=_[_0x3ea5('0x31')](_0x13c539[_0x3ea5('0x30')]);_0x5803c2['filters']=_['intersection'](_0x5803c2[_0x3ea5('0x2f')],_0x5803c2[_0x3ea5('0x30')]);_0x2af4ae[_0x3ea5('0x32')]=_[_0x3ea5('0x33')](_0x5803c2[_0x3ea5('0x2f')],qs[_0x3ea5('0x34')](_0x13c539[_0x3ea5('0x30')]['fields']));_0x2af4ae[_0x3ea5('0x32')]=_0x2af4ae[_0x3ea5('0x32')][_0x3ea5('0x35')]?_0x2af4ae[_0x3ea5('0x32')]:_0x5803c2[_0x3ea5('0x2f')];if(_0x13c539[_0x3ea5('0x30')][_0x3ea5('0x41')]){_0x2af4ae[_0x3ea5('0x42')]=[{'all':!![]}];}_0x2af4ae=_['merge']({},_0x2af4ae,_0x13c539['options']);return db[_0x3ea5('0x2a')][_0x3ea5('0x47')](_0x2af4ae)['then'](handleEntityNotFound(_0x359b12,null))['then'](respondWithResult(_0x359b12,null))[_0x3ea5('0x48')](handleError(_0x359b12,null));};exports['create']=function(_0x58ee39,_0x2c7513){return db['Team'][_0x3ea5('0x49')](_0x58ee39[_0x3ea5('0x4a')],{})[_0x3ea5('0x40')](function(_0x5d17ed){var _0x3c0615=_0x58ee39[_0x3ea5('0x4b')]['get']({'plain':!![]});if(!_0x3c0615)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c0615[_0x3ea5('0x4c')]===_0x3ea5('0x4b')){var _0x301b47=_0x5d17ed[_0x3ea5('0x4d')]({'plain':!![]});var _0x573171=_0x3ea5('0x4e');return db[_0x3ea5('0x4f')][_0x3ea5('0x47')]({'where':{'name':_0x573171,'userProfileId':_0x3c0615[_0x3ea5('0x50')]},'raw':!![]})[_0x3ea5('0x40')](function(_0x33555e){if(_0x33555e&&_0x33555e[_0x3ea5('0x51')]===0x0){return db[_0x3ea5('0x52')]['create']({'name':_0x301b47[_0x3ea5('0x27')],'resourceId':_0x301b47['id'],'type':_0x33555e[_0x3ea5('0x27')],'sectionId':_0x33555e['id']},{})['then'](function(){return _0x5d17ed;});}else{return _0x5d17ed;}})[_0x3ea5('0x48')](function(_0x4d4885){logger['error'](_0x3ea5('0x53'),_0x4d4885);throw _0x4d4885;});}return _0x5d17ed;})['then'](respondWithResult(_0x2c7513,0xc9))[_0x3ea5('0x48')](handleError(_0x2c7513,null));};exports[_0x3ea5('0x25')]=function(_0xd2bdea,_0x1dbaa4){if(_0xd2bdea[_0x3ea5('0x4a')]['id']){delete _0xd2bdea[_0x3ea5('0x4a')]['id'];}return db[_0x3ea5('0x2a')]['find']({'where':{'id':_0xd2bdea[_0x3ea5('0x46')]['id']}})['then'](handleEntityNotFound(_0x1dbaa4,null))[_0x3ea5('0x40')](saveUpdates(_0xd2bdea['body'],null))[_0x3ea5('0x40')](respondWithResult(_0x1dbaa4,null))[_0x3ea5('0x48')](handleError(_0x1dbaa4,null));};exports[_0x3ea5('0x54')]=function(_0x445166,_0x51659f){var _0x5bf195=_0x445166[_0x3ea5('0x46')]['id'];var _0x316165=[];return db[_0x3ea5('0x55')][_0x3ea5('0x56')](function(_0x590230){var _0x537207=_0x3ea5('0x57')+_0x5bf195;return db[_0x3ea5('0x55')][_0x3ea5('0x30')](_0x537207,{'type':db['Sequelize'][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230})[_0x3ea5('0x40')](function(_0x4706c3){_0x316165=_['map'](_0x4706c3,function(_0x20d9a6){return Number(_0x20d9a6['UserId']);});})[_0x3ea5('0x40')](function(){var _0x5ed9c8='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5bf195;return db[_0x3ea5('0x55')]['query'](_0x5ed9c8,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')]['SELECT'],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0x2f1535){var _0x1972b2=_['map'](_0x2f1535,function(_0x1ad935){return Number(_0x1ad935['VoiceQueueId']);});return db[_0x3ea5('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x316165},'VoiceQueueId':{'$in':_0x1972b2}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x2971b1=_0x3ea5('0x5c')+_0x5bf195;return db[_0x3ea5('0x55')][_0x3ea5('0x30')](_0x2971b1,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})['then'](function(_0xa94ada){var _0x3c350c=_[_0x3ea5('0x29')](_0xa94ada,function(_0x250412){return Number(_0x250412[_0x3ea5('0x5d')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x316165},'MailQueueId':{'$in':_0x3c350c}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x2c5cf2=_0x3ea5('0x5e')+_0x5bf195;return db['sequelize']['query'](_0x2c5cf2,{'type':db['Sequelize'][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0x5cf741){var _0x528eed=_[_0x3ea5('0x29')](_0x5cf741,function(_0x100d09){return Number(_0x100d09[_0x3ea5('0x5f')]);});return db[_0x3ea5('0x60')]['destroy']({'where':{'UserId':{'$in':_0x316165},'SmsQueueId':{'$in':_0x528eed}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x40c1a7='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5bf195;return db[_0x3ea5('0x55')]['query'](_0x40c1a7,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0x233baf){var _0x4daab9=_[_0x3ea5('0x29')](_0x233baf,function(_0x23778d){return Number(_0x23778d[_0x3ea5('0x61')]);});return db[_0x3ea5('0x62')][_0x3ea5('0x54')]({'where':{'UserId':{'$in':_0x316165},'ChatQueueId':{'$in':_0x4daab9}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x1773f8=_0x3ea5('0x63')+_0x5bf195;return db[_0x3ea5('0x55')]['query'](_0x1773f8,{'type':db[_0x3ea5('0x5a')]['QueryTypes'][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0xe60073){var _0x129da0=_['map'](_0xe60073,function(_0x1aec80){return Number(_0x1aec80['FaxQueueId']);});return db[_0x3ea5('0x64')]['destroy']({'where':{'UserId':{'$in':_0x316165},'FaxQueueId':{'$in':_0x129da0}},'transaction':_0x590230});})['then'](function(){var _0x4e17d6=_0x3ea5('0x65')+_0x5bf195;return db[_0x3ea5('0x55')][_0x3ea5('0x30')](_0x4e17d6,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')][_0x3ea5('0x59')],'raw':!![],'transaction':_0x590230});})['then'](function(_0xd686da){var _0x510aea=_[_0x3ea5('0x29')](_0xd686da,function(_0x50227f){return Number(_0x50227f[_0x3ea5('0x66')]);});return db[_0x3ea5('0x67')][_0x3ea5('0x54')]({'where':{'UserId':{'$in':_0x316165},'OpenchannelQueueId':{'$in':_0x510aea}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){var _0x2dc08d=_0x3ea5('0x68')+_0x5bf195;return db[_0x3ea5('0x55')][_0x3ea5('0x30')](_0x2dc08d,{'type':db[_0x3ea5('0x5a')][_0x3ea5('0x58')]['SELECT'],'raw':!![],'transaction':_0x590230});})[_0x3ea5('0x40')](function(_0x1dca7f){var _0x3d6df8=_['map'](_0x1dca7f,function(_0x3587aa){return Number(_0x3587aa[_0x3ea5('0x69')]);});return db[_0x3ea5('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x316165},'WhatsappQueueId':{'$in':_0x3d6df8}},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){return db[_0x3ea5('0x6b')]['find']({'where':{'TeamId':_0x5bf195}});})[_0x3ea5('0x40')](function(_0x2f805c){if(_0x2f805c===null){return;}return db[_0x3ea5('0x6c')]['destroy']({'where':{'UserId':{'$in':_0x316165},'VoicePrefixId':_0x2f805c[_0x3ea5('0x6d')]},'transaction':_0x590230});})[_0x3ea5('0x40')](function(){return db['Team'][_0x3ea5('0x54')]({'where':{'id':_0x5bf195},'cascade':!![],'transaction':_0x590230});})['then'](function(_0x221f66){if(_0x221f66===0x0){_0x51659f[_0x3ea5('0x1a')](0x194);}else{return db[_0x3ea5('0x52')][_0x3ea5('0x54')]({'where':{'type':_0x3ea5('0x4e'),'resourceId':_0x5bf195},'cascade':!![],'transaction':_0x590230})[_0x3ea5('0x40')](function(){_0x51659f['status'](0xcc)[_0x3ea5('0x6e')]();});}})[_0x3ea5('0x48')](function(_0x196109){_0x51659f[_0x3ea5('0x1b')](0x1f4)['send'](_0x196109);});});};exports[_0x3ea5('0x6f')]=function(_0x4e0564,_0x43f6dd,_0x8e3935){return db[_0x3ea5('0x2a')]['findOne']({'where':{'id':_0x4e0564['params']['id']}})[_0x3ea5('0x40')](handleEntityNotFound(_0x43f6dd,null))[_0x3ea5('0x40')](function(_0x5a4b45){if(!_0x4e0564[_0x3ea5('0x30')]['channel']||!utils[_0x3ea5('0x70')](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x71')])){throw new db[(_0x3ea5('0x5a'))][(_0x3ea5('0x72'))]('Unknown\x20channel');}var _0x549f33={};var _0x4c7556={};_0x4c7556[_0x3ea5('0x2f')]=_[_0x3ea5('0x31')](db[_[_0x3ea5('0x73')](_0x4e0564['query'][_0x3ea5('0x71')]['toLowerCase']())+'Queue'][_0x3ea5('0x2b')]);_0x4c7556['query']=_[_0x3ea5('0x31')](_0x4e0564[_0x3ea5('0x30')]);_0x4c7556[_0x3ea5('0x39')]=_[_0x3ea5('0x33')](_0x4c7556['model'],_0x4c7556[_0x3ea5('0x30')]);_0x549f33['attributes']=_['intersection'](_0x4c7556[_0x3ea5('0x2f')],qs['fields'](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x34')]));_0x549f33[_0x3ea5('0x32')]=_0x549f33[_0x3ea5('0x32')]['length']?_0x549f33[_0x3ea5('0x32')]:_0x4c7556[_0x3ea5('0x2f')];_0x549f33[_0x3ea5('0x20')]=qs[_0x3ea5('0x20')](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x20')]);_0x549f33[_0x3ea5('0x1f')]=qs['offset'](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x1f')]);_0x549f33[_0x3ea5('0x37')]=qs['sort'](_0x4e0564['query'][_0x3ea5('0x38')]);_0x549f33[_0x3ea5('0x3c')]=qs[_0x3ea5('0x39')](_['pick'](_0x4e0564[_0x3ea5('0x30')],_0x4c7556[_0x3ea5('0x39')]));_0x549f33=_[_0x3ea5('0x3d')]({},_0x549f33,_0x4e0564[_0x3ea5('0x3f')]);return _0x5a4b45[_0x3ea5('0x4d')+_[_0x3ea5('0x73')](_0x4e0564[_0x3ea5('0x30')][_0x3ea5('0x71')][_0x3ea5('0x74')]())+_0x3ea5('0x75')](_0x549f33);})[_0x3ea5('0x40')](respondWithResult(_0x43f6dd,null))[_0x3ea5('0x48')](handleError(_0x43f6dd,null));};exports[_0x3ea5('0x76')]=function(_0x43efff,_0x1e70e5,_0xcc3856){return db[_0x3ea5('0x2a')][_0x3ea5('0x77')]({'where':{'id':_0x43efff[_0x3ea5('0x46')]['id']}})['then'](function(_0x4f6a63){if(_0x4f6a63){if(!_0x43efff[_0x3ea5('0x4a')]['channel']||!utils['isValidChannel'](_0x43efff['body'][_0x3ea5('0x71')])){throw new db[(_0x3ea5('0x5a'))][(_0x3ea5('0x72'))]('Unknown\x20channel');}return _0x4f6a63['add'+_[_0x3ea5('0x73')](_0x43efff[_0x3ea5('0x4a')]['channel'][_0x3ea5('0x74')]())+_0x3ea5('0x75')](_0x43efff['body'][_0x3ea5('0x78')]);}return null;})[_0x3ea5('0x40')](handleEntityNotFound(_0x1e70e5,null))[_0x3ea5('0x40')](respondWithStatusCode(_0x1e70e5,null))[_0x3ea5('0x48')](handleError(_0x1e70e5,null));};exports[_0x3ea5('0x79')]=function(_0x371012,_0x54a48a,_0x5b77c8){return db[_0x3ea5('0x2a')][_0x3ea5('0x77')]({'where':{'id':_0x371012['params']['id']}})[_0x3ea5('0x40')](function(_0x3af58b){if(_0x3af58b){if(!_0x371012[_0x3ea5('0x30')][_0x3ea5('0x71')]||!utils[_0x3ea5('0x70')](_0x371012['query']['channel'])){throw new db[(_0x3ea5('0x5a'))][(_0x3ea5('0x72'))](_0x3ea5('0x7a'));}return _0x3af58b['remove'+_[_0x3ea5('0x73')](_0x371012['query'][_0x3ea5('0x71')]['toLowerCase']())+_0x3ea5('0x75')](_0x371012[_0x3ea5('0x30')][_0x3ea5('0x78')]);}return null;})[_0x3ea5('0x40')](handleEntityNotFound(_0x54a48a,null))[_0x3ea5('0x40')](respondWithStatusCode(_0x54a48a,null))[_0x3ea5('0x48')](handleError(_0x54a48a,null));};exports['addAgents']=function(_0x178fcd,_0x459606){var _0x23cfae=_[_0x3ea5('0x7b')](_0x178fcd[_0x3ea5('0x4a')][_0x3ea5('0x78')])?_0x178fcd['body']['ids']:[_0x178fcd[_0x3ea5('0x4a')][_0x3ea5('0x78')]];var _0x45f455=_0x178fcd['params']['id'];return db[_0x3ea5('0x2a')][_0x3ea5('0x47')]({'where':{'id':_0x45f455}})[_0x3ea5('0x40')](handleEntityNotFound(_0x459606,null))['then'](function(_0x3ff3ea){if(_0x3ff3ea){var _0x372e15=[_0x3ea5('0x7c'),_0x3ea5('0x7d'),_0x3ea5('0x7e'),_0x3ea5('0x7f'),_0x3ea5('0x80'),_0x3ea5('0x81'),_0x3ea5('0x82')];return db['sequelize']['transaction'](function(_0x592466){var _0x1accb8=_[_0x3ea5('0x29')](_0x372e15,function(_0x442b1d){var _0x573654={'attributes':['id',_0x3ea5('0x27')]};if(_0x442b1d===_0x3ea5('0x7c')){_0x573654['through']={'attributes':[_0x3ea5('0x83')]};}return _0x3ff3ea[_0x3ea5('0x4d')+_0x442b1d+_0x3ea5('0x75')](_0x573654)[_0x3ea5('0x40')](function(_0xe74972){var _0x4a8cf9=_[_0x3ea5('0x29')](_0xe74972,function(_0x1bf6ea){var _0x3700a2=_['map'](_0x23cfae,function(_0xee266b){var _0x3b1906={'where':{'UserId':_0xee266b,[_0x442b1d+_0x3ea5('0x84')]:_0x1bf6ea['id']},'transaction':_0x592466};if(_0x442b1d===_0x3ea5('0x7c')){_0x3b1906[_0x3ea5('0x17')]={'penalty':_0x1bf6ea[_0x3ea5('0x85')]['penalty']};}return db['User'+_0x442b1d+_0x3ea5('0x86')][_0x3ea5('0x87')](_0x3b1906)['then'](function(){socket[_0x3ea5('0x88')](_0x3ea5('0x4b')+_0x442b1d+_0x3ea5('0x89'),{'UserId':_0xee266b,[_0x442b1d+_0x3ea5('0x84')]:_0x1bf6ea['id']});if(_0x442b1d!=='Voice'){return;}return db[_0x3ea5('0x8a')][_0x3ea5('0x43')]({'where':{'id':_0x23cfae,'online':0x1},'attributes':['id',_0x3ea5('0x27'),'online',_0x3ea5('0x8b'),'interface'],'raw':!![]})[_0x3ea5('0x40')](function(_0x45f689){var _0x112e89=_[_0x3ea5('0x29')](_0x45f689,function(_0x401151){return db[_0x3ea5('0x8c')][_0x3ea5('0x8d')]({'membername':_0x401151[_0x3ea5('0x27')],'UserId':_0x401151['id'],'queue_name':_0x1bf6ea['name'],'VoiceQueueId':_0x1bf6ea['id'],'interface':_[_0x3ea5('0x8e')](_0x401151[_0x3ea5('0x8f')])?util[_0x3ea5('0x90')](_0x3ea5('0x91'),_0x401151[_0x3ea5('0x27')]):_0x401151[_0x3ea5('0x8f')],'paused':_0x401151[_0x3ea5('0x8b')]||![],'penalty':_0x1bf6ea[_0x3ea5('0x85')][_0x3ea5('0x83')]},{'transaction':_0x592466});});return Promise['all'](_0x112e89);});});});return Promise[_0x3ea5('0x92')](_0x3700a2);});return Promise[_0x3ea5('0x92')](_0x4a8cf9);})[_0x3ea5('0x40')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x45f455}})[_0x3ea5('0x40')](function(_0x4731a5){if(_0x4731a5){var _0x50536a=_[_0x3ea5('0x29')](_0x23cfae,function(_0x86ce6d){db[_0x3ea5('0x6c')][_0x3ea5('0x8d')]({'UserId':_0x86ce6d,'VoicePrefixId':_0x4731a5[_0x3ea5('0x6d')]});});return Promise[_0x3ea5('0x92')](_0x50536a);}});});});return Promise[_0x3ea5('0x92')](_0x1accb8)[_0x3ea5('0x40')](function(){return _0x3ff3ea[_0x3ea5('0x93')](_0x23cfae,{'transaction':_0x592466})[_0x3ea5('0x94')](function(_0x24f873){return _0x24f873;});});});}})[_0x3ea5('0x40')](respondWithResult(_0x459606,null))[_0x3ea5('0x48')](handleError(_0x459606,null));};exports[_0x3ea5('0x95')]=function(_0x331210,_0x2020ac){var _0x48f87b=_['isArray'](_0x331210[_0x3ea5('0x30')][_0x3ea5('0x78')])?_0x331210['query']['ids']:[_0x331210['query'][_0x3ea5('0x78')]];var _0x520265=_0x331210[_0x3ea5('0x46')]['id'];return db[_0x3ea5('0x2a')][_0x3ea5('0x47')]({'where':{'id':_0x520265}})['then'](handleEntityNotFound(_0x2020ac,null))['then'](function(_0x58527d){if(_0x58527d){var _0x480f6c=[_0x3ea5('0x7c'),_0x3ea5('0x7d'),_0x3ea5('0x7e'),_0x3ea5('0x7f'),'Fax',_0x3ea5('0x81'),_0x3ea5('0x82')];return db[_0x3ea5('0x55')][_0x3ea5('0x56')](function(_0x1a1289){var _0x10d234=_[_0x3ea5('0x29')](_0x480f6c,function(_0x3ea95b){var _0x13b4c2={'attributes':['id',_0x3ea5('0x27')]};return _0x58527d[_0x3ea5('0x4d')+_0x3ea95b+_0x3ea5('0x75')](_0x13b4c2)['then'](function(_0x4f7a67){var _0x3426da=_['map'](_0x4f7a67,function(_0x46722b){return _0x46722b['removeAgents'](_0x48f87b,{'transaction':_0x1a1289})[_0x3ea5('0x40')](function(){var _0x76ad6f=_[_0x3ea5('0x29')](_0x48f87b,function(_0x47143f){socket[_0x3ea5('0x88')](_0x3ea5('0x4b')+_0x3ea95b+_0x3ea5('0x96'),{'UserId':Number(_0x47143f),[_0x3ea95b+'QueueId']:_0x46722b['id']});if(_0x3ea95b!==_0x3ea5('0x7c')){return;}return db[_0x3ea5('0x8c')]['destroy']({'where':{'VoiceQueueId':_0x46722b['id'],'UserId':_0x47143f},'transaction':_0x1a1289});});return Promise[_0x3ea5('0x92')](_0x76ad6f);});});return Promise[_0x3ea5('0x92')](_0x3426da);});});return Promise[_0x3ea5('0x92')](_0x10d234)[_0x3ea5('0x40')](function(){return _0x58527d['removeAgents'](_0x48f87b,{'transaction':_0x1a1289});})[_0x3ea5('0x40')](function(){return db[_0x3ea5('0x6b')][_0x3ea5('0x77')]({'where':{'teamId':_0x520265}})[_0x3ea5('0x40')](function(_0x274700){if(_0x274700){var _0x23fcb2=_[_0x3ea5('0x29')](_0x48f87b,function(_0x1af62d){db[_0x3ea5('0x6c')][_0x3ea5('0x54')]({'where':{'UserId':_0x1af62d,'VoicePrefixId':_0x274700[_0x3ea5('0x6d')]}});});return Promise[_0x3ea5('0x92')](_0x23fcb2);}});});});}})['then'](respondWithStatusCode(_0x2020ac,null))[_0x3ea5('0x48')](handleError(_0x2020ac,null));};exports[_0x3ea5('0x97')]=function(_0x4011ec,_0xc50b2b,_0x1ec1cc){var _0x32cdd2={};var _0x315d81={};var _0x2f9208;var _0x482303;return db[_0x3ea5('0x2a')][_0x3ea5('0x77')]({'where':{'id':_0x4011ec[_0x3ea5('0x46')]['id']}})['then'](handleEntityNotFound(_0xc50b2b,null))[_0x3ea5('0x40')](function(_0x233df6){if(_0x233df6){_0x2f9208=_0x233df6;_0x315d81[_0x3ea5('0x2f')]=_[_0x3ea5('0x31')](db[_0x3ea5('0x8a')][_0x3ea5('0x2b')]);_0x315d81[_0x3ea5('0x30')]=_[_0x3ea5('0x31')](_0x4011ec[_0x3ea5('0x30')]);_0x315d81['filters']=_[_0x3ea5('0x33')](_0x315d81['model'],_0x315d81[_0x3ea5('0x30')]);_0x32cdd2['attributes']=_['intersection'](_0x315d81[_0x3ea5('0x2f')],qs[_0x3ea5('0x34')](_0x4011ec['query'][_0x3ea5('0x34')]));_0x32cdd2[_0x3ea5('0x32')]=_0x32cdd2[_0x3ea5('0x32')][_0x3ea5('0x35')]?_0x32cdd2['attributes']:_0x315d81[_0x3ea5('0x2f')];_0x32cdd2[_0x3ea5('0x37')]=qs[_0x3ea5('0x38')](_0x4011ec['query']['sort']);_0x32cdd2['where']=qs[_0x3ea5('0x39')](_[_0x3ea5('0x3a')](_0x4011ec['query'],_0x315d81['filters']));if(_0x4011ec[_0x3ea5('0x30')]['filter']){_0x32cdd2[_0x3ea5('0x3c')]=_[_0x3ea5('0x3d')](_0x32cdd2[_0x3ea5('0x3c')],{'$or':_[_0x3ea5('0x29')](_0x32cdd2[_0x3ea5('0x32')],function(_0x538bdf){var _0x41370c={};_0x41370c[_0x538bdf]={'$like':'%'+_0x4011ec[_0x3ea5('0x30')][_0x3ea5('0x3b')]+'%'};return _0x41370c;})});}_0x32cdd2=_[_0x3ea5('0x3d')]({},_0x32cdd2,_0x4011ec[_0x3ea5('0x3f')]);return _0x2f9208[_0x3ea5('0x97')](_0x32cdd2);}})[_0x3ea5('0x40')](function(_0x52e1db){if(_0x52e1db){_0x482303=_0x52e1db['length'];if(!_0x4011ec['query'][_0x3ea5('0x36')](_0x3ea5('0x98'))){_0x32cdd2['limit']=qs[_0x3ea5('0x20')](_0x4011ec[_0x3ea5('0x30')]['limit']);_0x32cdd2[_0x3ea5('0x1f')]=qs[_0x3ea5('0x1f')](_0x4011ec['query']['offset']);}return _0x2f9208[_0x3ea5('0x97')](_0x32cdd2);}})[_0x3ea5('0x40')](function(_0xd21a5d){if(_0xd21a5d){return _0xd21a5d?{'count':_0x482303,'rows':_0xd21a5d}:null;}})['then'](respondWithResult(_0xc50b2b,null))[_0x3ea5('0x48')](handleError(_0xc50b2b,null));}; \ No newline at end of file +var _0x018d=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','user','get','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','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','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queues','addQueues','findOne','Unknown\x20channel','ids','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','defaults','TeamVoiceQueue','User','Queue','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','spread','removeAgents','Queue:remove','getAgents','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x5d4b8b,_0x58ce2b){var _0x4fcb37=function(_0x5a4f6c){while(--_0x5a4f6c){_0x5d4b8b['push'](_0x5d4b8b['shift']());}};_0x4fcb37(++_0x58ce2b);}(_0x018d,0x137));var _0xd018=function(_0x4d8536,_0x2acb73){_0x4d8536=_0x4d8536-0x0;var _0x496b14=_0x018d[_0x4d8536];return _0x496b14;};'use strict';var emlformat=require(_0xd018('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd018('0x1'));var jsonpatch=require(_0xd018('0x2'));var rp=require(_0xd018('0x3'));var moment=require(_0xd018('0x4'));var BPromise=require(_0xd018('0x5'));var Mustache=require(_0xd018('0x6'));var util=require(_0xd018('0x7'));var path=require(_0xd018('0x8'));var sox=require(_0xd018('0x9'));var csv=require(_0xd018('0xa'));var ejs=require(_0xd018('0xb'));var fs=require('fs');var fs_extra=require(_0xd018('0xc'));var _=require(_0xd018('0xd'));var squel=require('squel');var crypto=require(_0xd018('0xe'));var jsforce=require(_0xd018('0xf'));var deskjs=require(_0xd018('0x10'));var toCsv=require(_0xd018('0xa'));var querystring=require(_0xd018('0x11'));var Papa=require(_0xd018('0x12'));var Redis=require(_0xd018('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd018('0x14'));var as=require(_0xd018('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd018('0x16'));var config=require(_0xd018('0x17'));var licenseUtil=require(_0xd018('0x18'));var db=require(_0xd018('0x19'))['db'];config[_0xd018('0x1a')]=_['defaults'](config[_0xd018('0x1a')],{'host':_0xd018('0x1b'),'port':0x18eb});var socket=require(_0xd018('0x1c'))(new Redis(config[_0xd018('0x1a')]));require(_0xd018('0x1d'))[_0xd018('0x1e')](socket);function respondWithStatusCode(_0x541dc4,_0x5e81a6){_0x5e81a6=_0x5e81a6||0xcc;return function(_0x2a4055){if(_0x2a4055){return _0x541dc4[_0xd018('0x1f')](_0x5e81a6);}return _0x541dc4['status'](_0x5e81a6)[_0xd018('0x20')]();};}function respondWithResult(_0xf1dda3,_0x3aab21){_0x3aab21=_0x3aab21||0xc8;return function(_0x48198b){if(_0x48198b){return _0xf1dda3[_0xd018('0x21')](_0x3aab21)[_0xd018('0x22')](_0x48198b);}};}function respondWithFilteredResult(_0x3808e8,_0x3650b6){return function(_0x470a4b){if(_0x470a4b){var _0x492b0c=typeof _0x3650b6[_0xd018('0x23')]==='undefined'&&typeof _0x3650b6[_0xd018('0x24')]===_0xd018('0x25');var _0x1c2804=_0x470a4b[_0xd018('0x26')];var _0x3bc47d=_0x492b0c?0x0:_0x3650b6[_0xd018('0x23')];var _0x469d88=_0x492b0c?_0x470a4b['count']:_0x3650b6['offset']+_0x3650b6[_0xd018('0x24')];var _0x327910;if(_0x469d88>=_0x1c2804){_0x469d88=_0x1c2804;_0x327910=0xc8;}else{_0x327910=0xce;}_0x3808e8['status'](_0x327910);return _0x3808e8[_0xd018('0x27')](_0xd018('0x28'),_0x3bc47d+'-'+_0x469d88+'/'+_0x1c2804)[_0xd018('0x22')](_0x470a4b);}return null;};}function patchUpdates(_0x1b2b3a){return function(_0x4c4bbb){try{jsonpatch[_0xd018('0x29')](_0x4c4bbb,_0x1b2b3a,!![]);}catch(_0x1bbbd1){return BPromise[_0xd018('0x2a')](_0x1bbbd1);}return _0x4c4bbb[_0xd018('0x2b')]();};}function saveUpdates(_0x563d91,_0x434934){return function(_0x4c2529){if(_0x4c2529){return _0x4c2529['update'](_0x563d91)['then'](function(_0x18430a){return _0x18430a;});}return null;};}function handleEntityNotFound(_0x46e163,_0x11ea3b){return function(_0x50bc8f){if(!_0x50bc8f){_0x46e163['sendStatus'](0x194);}return _0x50bc8f;};}function handleError(_0x2d59b1,_0x51744e){_0x51744e=_0x51744e||0x1f4;return function(_0x8d23aa){logger[_0xd018('0x2c')](_0x8d23aa[_0xd018('0x2d')]);if(_0x8d23aa[_0xd018('0x2e')]){delete _0x8d23aa[_0xd018('0x2e')];}_0x2d59b1[_0xd018('0x21')](_0x51744e)[_0xd018('0x2f')](_0x8d23aa);};}exports[_0xd018('0x30')]=function(_0x4c73aa,_0x2236bd){var _0x52b713={},_0x2eb45c={},_0x540cd9={'count':0x0,'rows':[]};var _0x5417a5=_[_0xd018('0x31')](db[_0xd018('0x32')][_0xd018('0x33')],function(_0x12d25f){return{'name':_0x12d25f[_0xd018('0x34')],'type':_0x12d25f[_0xd018('0x35')][_0xd018('0x36')]};});_0x2eb45c[_0xd018('0x37')]=_[_0xd018('0x31')](_0x5417a5,'name');_0x2eb45c[_0xd018('0x38')]=_[_0xd018('0x39')](_0x4c73aa[_0xd018('0x38')]);_0x2eb45c[_0xd018('0x3a')]=_['intersection'](_0x2eb45c[_0xd018('0x37')],_0x2eb45c[_0xd018('0x38')]);_0x52b713[_0xd018('0x3b')]=_[_0xd018('0x3c')](_0x2eb45c[_0xd018('0x37')],qs[_0xd018('0x3d')](_0x4c73aa[_0xd018('0x38')][_0xd018('0x3d')]));_0x52b713[_0xd018('0x3b')]=_0x52b713[_0xd018('0x3b')]['length']?_0x52b713[_0xd018('0x3b')]:_0x2eb45c[_0xd018('0x37')];if(!_0x4c73aa[_0xd018('0x38')]['hasOwnProperty'](_0xd018('0x3e'))){_0x52b713[_0xd018('0x24')]=qs[_0xd018('0x24')](_0x4c73aa[_0xd018('0x38')][_0xd018('0x24')]);_0x52b713[_0xd018('0x23')]=qs['offset'](_0x4c73aa[_0xd018('0x38')]['offset']);}_0x52b713[_0xd018('0x3f')]=qs['sort'](_0x4c73aa['query'][_0xd018('0x40')]);_0x52b713[_0xd018('0x41')]=qs[_0xd018('0x3a')](_[_0xd018('0x42')](_0x4c73aa[_0xd018('0x38')],_0x2eb45c[_0xd018('0x3a')]),_0x5417a5);if(_0x4c73aa[_0xd018('0x38')][_0xd018('0x43')]){_0x52b713[_0xd018('0x41')]=_['merge'](_0x52b713[_0xd018('0x41')],{'$or':_['map'](_0x5417a5,function(_0x108588){if(_0x108588[_0xd018('0x35')]!==_0xd018('0x44')){var _0x3e1084={};_0x3e1084[_0x108588[_0xd018('0x2e')]]={'$like':'%'+_0x4c73aa[_0xd018('0x38')][_0xd018('0x43')]+'%'};return _0x3e1084;}})});}_0x52b713=_['merge']({},_0x52b713,_0x4c73aa[_0xd018('0x45')]);var _0x87ad1c={'where':_0x52b713[_0xd018('0x41')]};return db[_0xd018('0x32')][_0xd018('0x26')](_0x87ad1c)[_0xd018('0x46')](function(_0x496dbc){_0x540cd9[_0xd018('0x26')]=_0x496dbc;if(_0x4c73aa[_0xd018('0x38')][_0xd018('0x47')]){_0x52b713[_0xd018('0x48')]=[{'all':!![]}];}return db[_0xd018('0x32')][_0xd018('0x49')](_0x52b713);})[_0xd018('0x46')](function(_0x2805a1){_0x540cd9[_0xd018('0x4a')]=_0x2805a1;return _0x540cd9;})[_0xd018('0x46')](respondWithFilteredResult(_0x2236bd,_0x52b713))[_0xd018('0x4b')](handleError(_0x2236bd,null));};exports[_0xd018('0x4c')]=function(_0x3684ff,_0x5238a4){var _0xfbcaa9={'raw':![],'where':{'id':_0x3684ff[_0xd018('0x4d')]['id']}},_0xe83b64={};_0xe83b64['model']=_['keys'](db[_0xd018('0x32')][_0xd018('0x33')]);_0xe83b64[_0xd018('0x38')]=_['keys'](_0x3684ff['query']);_0xe83b64['filters']=_['intersection'](_0xe83b64[_0xd018('0x37')],_0xe83b64[_0xd018('0x38')]);_0xfbcaa9[_0xd018('0x3b')]=_[_0xd018('0x3c')](_0xe83b64['model'],qs['fields'](_0x3684ff[_0xd018('0x38')][_0xd018('0x3d')]));_0xfbcaa9[_0xd018('0x3b')]=_0xfbcaa9[_0xd018('0x3b')][_0xd018('0x4e')]?_0xfbcaa9[_0xd018('0x3b')]:_0xe83b64[_0xd018('0x37')];if(_0x3684ff['query'][_0xd018('0x47')]){_0xfbcaa9['include']=[{'all':!![]}];}_0xfbcaa9=_[_0xd018('0x4f')]({},_0xfbcaa9,_0x3684ff[_0xd018('0x45')]);return db[_0xd018('0x32')][_0xd018('0x50')](_0xfbcaa9)[_0xd018('0x46')](handleEntityNotFound(_0x5238a4,null))[_0xd018('0x46')](respondWithResult(_0x5238a4,null))['catch'](handleError(_0x5238a4,null));};exports['create']=function(_0x41fc0a,_0x44ed3c){return db[_0xd018('0x32')][_0xd018('0x51')](_0x41fc0a[_0xd018('0x52')],{})[_0xd018('0x46')](function(_0x3ee8df){var _0x4c76d8=_0x41fc0a[_0xd018('0x53')][_0xd018('0x54')]({'plain':!![]});if(!_0x4c76d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c76d8['role']===_0xd018('0x53')){var _0x4db31e=_0x3ee8df[_0xd018('0x54')]({'plain':!![]});var _0x3c72ca=_0xd018('0x55');return db[_0xd018('0x56')][_0xd018('0x50')]({'where':{'name':_0x3c72ca,'userProfileId':_0x4c76d8[_0xd018('0x57')]},'raw':!![]})[_0xd018('0x46')](function(_0x4b71d8){if(_0x4b71d8&&_0x4b71d8['autoAssociation']===0x0){return db['UserProfileResource'][_0xd018('0x51')]({'name':_0x4db31e[_0xd018('0x2e')],'resourceId':_0x4db31e['id'],'type':_0x4b71d8[_0xd018('0x2e')],'sectionId':_0x4b71d8['id']},{})['then'](function(){return _0x3ee8df;});}else{return _0x3ee8df;}})[_0xd018('0x4b')](function(_0x1e42bc){logger[_0xd018('0x2c')](_0xd018('0x58'),_0x1e42bc);throw _0x1e42bc;});}return _0x3ee8df;})[_0xd018('0x46')](respondWithResult(_0x44ed3c,0xc9))[_0xd018('0x4b')](handleError(_0x44ed3c,null));};exports[_0xd018('0x59')]=function(_0x46cb0b,_0x213e1b){if(_0x46cb0b[_0xd018('0x52')]['id']){delete _0x46cb0b[_0xd018('0x52')]['id'];}return db[_0xd018('0x32')]['find']({'where':{'id':_0x46cb0b['params']['id']}})[_0xd018('0x46')](handleEntityNotFound(_0x213e1b,null))['then'](saveUpdates(_0x46cb0b['body'],null))['then'](respondWithResult(_0x213e1b,null))[_0xd018('0x4b')](handleError(_0x213e1b,null));};exports['destroy']=function(_0xf029f1,_0x149ae3){var _0x5918c9=_0xf029f1[_0xd018('0x4d')]['id'];var _0x20ab37=[];return db['sequelize']['transaction'](function(_0x4fbd1b){var _0x4a73cb='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5918c9;return db[_0xd018('0x5a')]['query'](_0x4a73cb,{'type':db[_0xd018('0x5b')]['QueryTypes'][_0xd018('0x5c')],'raw':!![],'transaction':_0x4fbd1b})[_0xd018('0x46')](function(_0x5e415d){_0x20ab37=_[_0xd018('0x31')](_0x5e415d,function(_0x1e3ec8){return Number(_0x1e3ec8[_0xd018('0x5d')]);});})['then'](function(){var _0x26e043=_0xd018('0x5e')+_0x5918c9;return db[_0xd018('0x5a')][_0xd018('0x38')](_0x26e043,{'type':db[_0xd018('0x5b')][_0xd018('0x5f')][_0xd018('0x5c')],'raw':!![],'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(_0x4c4828){var _0x4e42f7=_[_0xd018('0x31')](_0x4c4828,function(_0xc05dde){return Number(_0xc05dde['VoiceQueueId']);});return db['UserVoiceQueue'][_0xd018('0x60')]({'where':{'UserId':{'$in':_0x20ab37},'VoiceQueueId':{'$in':_0x4e42f7}},'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(){var _0x2f0be4=_0xd018('0x61')+_0x5918c9;return db[_0xd018('0x5a')][_0xd018('0x38')](_0x2f0be4,{'type':db[_0xd018('0x5b')][_0xd018('0x5f')]['SELECT'],'raw':!![],'transaction':_0x4fbd1b});})['then'](function(_0x7618ec){var _0x54ebfd=_[_0xd018('0x31')](_0x7618ec,function(_0x332ddd){return Number(_0x332ddd[_0xd018('0x62')]);});return db[_0xd018('0x63')][_0xd018('0x60')]({'where':{'UserId':{'$in':_0x20ab37},'MailQueueId':{'$in':_0x54ebfd}},'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(){var _0x4e017e=_0xd018('0x64')+_0x5918c9;return db['sequelize'][_0xd018('0x38')](_0x4e017e,{'type':db[_0xd018('0x5b')][_0xd018('0x5f')]['SELECT'],'raw':!![],'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(_0x1a3ed2){var _0x4185f1=_[_0xd018('0x31')](_0x1a3ed2,function(_0x4d099c){return Number(_0x4d099c[_0xd018('0x65')]);});return db[_0xd018('0x66')][_0xd018('0x60')]({'where':{'UserId':{'$in':_0x20ab37},'SmsQueueId':{'$in':_0x4185f1}},'transaction':_0x4fbd1b});})['then'](function(){var _0x832a09=_0xd018('0x67')+_0x5918c9;return db[_0xd018('0x5a')][_0xd018('0x38')](_0x832a09,{'type':db[_0xd018('0x5b')]['QueryTypes'][_0xd018('0x5c')],'raw':!![],'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(_0x4a97b3){var _0x26fa36=_[_0xd018('0x31')](_0x4a97b3,function(_0x73164e){return Number(_0x73164e[_0xd018('0x68')]);});return db[_0xd018('0x69')][_0xd018('0x60')]({'where':{'UserId':{'$in':_0x20ab37},'ChatQueueId':{'$in':_0x26fa36}},'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(){var _0x1a47b6=_0xd018('0x6a')+_0x5918c9;return db['sequelize'][_0xd018('0x38')](_0x1a47b6,{'type':db['Sequelize'][_0xd018('0x5f')][_0xd018('0x5c')],'raw':!![],'transaction':_0x4fbd1b});})['then'](function(_0x36b0b6){var _0x31957b=_['map'](_0x36b0b6,function(_0x553760){return Number(_0x553760[_0xd018('0x6b')]);});return db[_0xd018('0x6c')][_0xd018('0x60')]({'where':{'UserId':{'$in':_0x20ab37},'FaxQueueId':{'$in':_0x31957b}},'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(){var _0x173f6d=_0xd018('0x6d')+_0x5918c9;return db['sequelize'][_0xd018('0x38')](_0x173f6d,{'type':db[_0xd018('0x5b')]['QueryTypes'][_0xd018('0x5c')],'raw':!![],'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(_0x2d96b9){var _0xeece54=_[_0xd018('0x31')](_0x2d96b9,function(_0x515153){return Number(_0x515153[_0xd018('0x6e')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x20ab37},'OpenchannelQueueId':{'$in':_0xeece54}},'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(){var _0x1f066b='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5918c9;return db[_0xd018('0x5a')]['query'](_0x1f066b,{'type':db[_0xd018('0x5b')][_0xd018('0x5f')][_0xd018('0x5c')],'raw':!![],'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(_0x38e808){var _0x3cd074=_[_0xd018('0x31')](_0x38e808,function(_0x54ca76){return Number(_0x54ca76[_0xd018('0x6f')]);});return db[_0xd018('0x70')][_0xd018('0x60')]({'where':{'UserId':{'$in':_0x20ab37},'WhatsappQueueId':{'$in':_0x3cd074}},'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(){return db[_0xd018('0x71')]['find']({'where':{'TeamId':_0x5918c9}});})['then'](function(_0x4eb591){if(_0x4eb591===null){return;}return db[_0xd018('0x72')][_0xd018('0x60')]({'where':{'UserId':{'$in':_0x20ab37},'VoicePrefixId':_0x4eb591[_0xd018('0x73')]},'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(){return db[_0xd018('0x32')][_0xd018('0x60')]({'where':{'id':_0x5918c9},'cascade':!![],'transaction':_0x4fbd1b});})[_0xd018('0x46')](function(_0x30059f){if(_0x30059f===0x0){_0x149ae3[_0xd018('0x1f')](0x194);}else{return db['UserProfileResource'][_0xd018('0x60')]({'where':{'type':_0xd018('0x55'),'resourceId':_0x5918c9},'cascade':!![],'transaction':_0x4fbd1b})['then'](function(){_0x149ae3[_0xd018('0x21')](0xcc)[_0xd018('0x20')]();});}})['catch'](function(_0x5ad09){_0x149ae3[_0xd018('0x21')](0x1f4)[_0xd018('0x2f')](_0x5ad09);});});};exports['getQueues']=function(_0x6f95bc,_0x2c067e,_0x495ee8){return db['Team']['findOne']({'where':{'id':_0x6f95bc['params']['id']}})[_0xd018('0x46')](handleEntityNotFound(_0x2c067e,null))[_0xd018('0x46')](function(_0x30eaab){if(!_0x6f95bc[_0xd018('0x38')][_0xd018('0x74')]||!utils[_0xd018('0x75')](_0x6f95bc['query'][_0xd018('0x74')])){throw new db[(_0xd018('0x5b'))][(_0xd018('0x76'))]('Unknown\x20channel');}var _0x152dc6={};var _0x10aa6d={};_0x10aa6d[_0xd018('0x37')]=_[_0xd018('0x39')](db[_[_0xd018('0x77')](_0x6f95bc[_0xd018('0x38')]['channel']['toLowerCase']())+'Queue'][_0xd018('0x33')]);_0x10aa6d[_0xd018('0x38')]=_[_0xd018('0x39')](_0x6f95bc['query']);_0x10aa6d[_0xd018('0x3a')]=_[_0xd018('0x3c')](_0x10aa6d[_0xd018('0x37')],_0x10aa6d['query']);_0x152dc6[_0xd018('0x3b')]=_[_0xd018('0x3c')](_0x10aa6d[_0xd018('0x37')],qs[_0xd018('0x3d')](_0x6f95bc[_0xd018('0x38')][_0xd018('0x3d')]));_0x152dc6[_0xd018('0x3b')]=_0x152dc6[_0xd018('0x3b')][_0xd018('0x4e')]?_0x152dc6[_0xd018('0x3b')]:_0x10aa6d[_0xd018('0x37')];_0x152dc6[_0xd018('0x24')]=qs[_0xd018('0x24')](_0x6f95bc['query'][_0xd018('0x24')]);_0x152dc6[_0xd018('0x23')]=qs['offset'](_0x6f95bc[_0xd018('0x38')][_0xd018('0x23')]);_0x152dc6[_0xd018('0x3f')]=qs[_0xd018('0x40')](_0x6f95bc[_0xd018('0x38')][_0xd018('0x40')]);_0x152dc6['where']=qs[_0xd018('0x3a')](_[_0xd018('0x42')](_0x6f95bc[_0xd018('0x38')],_0x10aa6d[_0xd018('0x3a')]));_0x152dc6=_[_0xd018('0x4f')]({},_0x152dc6,_0x6f95bc[_0xd018('0x45')]);return _0x30eaab[_0xd018('0x54')+_['capitalize'](_0x6f95bc[_0xd018('0x38')][_0xd018('0x74')][_0xd018('0x78')]())+_0xd018('0x79')](_0x152dc6);})[_0xd018('0x46')](respondWithResult(_0x2c067e,null))[_0xd018('0x4b')](handleError(_0x2c067e,null));};exports[_0xd018('0x7a')]=function(_0x3e6673,_0x2c1cdb,_0x303049){return db['Team'][_0xd018('0x7b')]({'where':{'id':_0x3e6673[_0xd018('0x4d')]['id']}})[_0xd018('0x46')](function(_0x2dc619){if(_0x2dc619){if(!_0x3e6673['body'][_0xd018('0x74')]||!utils['isValidChannel'](_0x3e6673[_0xd018('0x52')][_0xd018('0x74')])){throw new db[(_0xd018('0x5b'))][(_0xd018('0x76'))](_0xd018('0x7c'));}return _0x2dc619['add'+_[_0xd018('0x77')](_0x3e6673[_0xd018('0x52')][_0xd018('0x74')][_0xd018('0x78')]())+'Queues'](_0x3e6673['body'][_0xd018('0x7d')]);}return null;})[_0xd018('0x46')](handleEntityNotFound(_0x2c1cdb,null))[_0xd018('0x46')](respondWithStatusCode(_0x2c1cdb,null))[_0xd018('0x4b')](handleError(_0x2c1cdb,null));};exports['removeQueues']=function(_0x1304cf,_0x2c81f5,_0x349084){return db[_0xd018('0x32')][_0xd018('0x7b')]({'where':{'id':_0x1304cf[_0xd018('0x4d')]['id']}})[_0xd018('0x46')](function(_0x278398){if(_0x278398){if(!_0x1304cf[_0xd018('0x38')][_0xd018('0x74')]||!utils[_0xd018('0x75')](_0x1304cf[_0xd018('0x38')]['channel'])){throw new db['Sequelize'][(_0xd018('0x76'))](_0xd018('0x7c'));}return _0x278398[_0xd018('0x7e')+_[_0xd018('0x77')](_0x1304cf[_0xd018('0x38')][_0xd018('0x74')][_0xd018('0x78')]())+_0xd018('0x79')](_0x1304cf[_0xd018('0x38')][_0xd018('0x7d')]);}return null;})[_0xd018('0x46')](handleEntityNotFound(_0x2c81f5,null))[_0xd018('0x46')](respondWithStatusCode(_0x2c81f5,null))[_0xd018('0x4b')](handleError(_0x2c81f5,null));};exports[_0xd018('0x7f')]=function(_0x49b77c,_0x19a78c){var _0x2e1942=_[_0xd018('0x80')](_0x49b77c[_0xd018('0x52')][_0xd018('0x7d')])?_0x49b77c[_0xd018('0x52')][_0xd018('0x7d')]:[_0x49b77c[_0xd018('0x52')]['ids']];var _0x5b441f=_0x49b77c[_0xd018('0x4d')]['id'];return db[_0xd018('0x32')]['find']({'where':{'id':_0x5b441f}})['then'](handleEntityNotFound(_0x19a78c,null))[_0xd018('0x46')](function(_0x30a57b){if(_0x30a57b){var _0x2a4588=[_0xd018('0x81'),_0xd018('0x82'),_0xd018('0x83'),_0xd018('0x84'),_0xd018('0x85'),_0xd018('0x86'),_0xd018('0x87')];return db[_0xd018('0x5a')][_0xd018('0x88')](function(_0x1efb0d){var _0x12553e=_[_0xd018('0x31')](_0x2a4588,function(_0x2780dc){var _0x2dfe5d={'attributes':['id',_0xd018('0x2e')]};if(_0x2780dc===_0xd018('0x81')){_0x2dfe5d[_0xd018('0x89')]={'attributes':[_0xd018('0x8a')]};}return _0x30a57b[_0xd018('0x54')+_0x2780dc+'Queues'](_0x2dfe5d)[_0xd018('0x46')](function(_0x3840a3){var _0x4fd1ea=_[_0xd018('0x31')](_0x3840a3,function(_0x22d043){var _0x131e80=_[_0xd018('0x31')](_0x2e1942,function(_0x1bcecb){var _0x1909b3={'where':{'UserId':_0x1bcecb,[_0x2780dc+_0xd018('0x8b')]:_0x22d043['id']},'transaction':_0x1efb0d};if(_0x2780dc===_0xd018('0x81')){_0x1909b3[_0xd018('0x8c')]={'penalty':_0x22d043[_0xd018('0x8d')][_0xd018('0x8a')]};}return db[_0xd018('0x8e')+_0x2780dc+_0xd018('0x8f')]['findOrCreate'](_0x1909b3)[_0xd018('0x46')](function(){socket[_0xd018('0x90')]('user'+_0x2780dc+_0xd018('0x91'),{'UserId':_0x1bcecb,[_0x2780dc+_0xd018('0x8b')]:_0x22d043['id']});if(_0x2780dc!==_0xd018('0x81')){return;}return db[_0xd018('0x8e')][_0xd018('0x49')]({'where':{'id':_0x2e1942,'online':0x1},'attributes':['id','name',_0xd018('0x92'),_0xd018('0x93'),_0xd018('0x94')],'raw':!![]})[_0xd018('0x46')](function(_0x2777ce){var _0x1c029d=_['map'](_0x2777ce,function(_0x22ae77){return db[_0xd018('0x95')][_0xd018('0x96')]({'membername':_0x22ae77['name'],'UserId':_0x22ae77['id'],'queue_name':_0x22d043[_0xd018('0x2e')],'VoiceQueueId':_0x22d043['id'],'interface':_['isNil'](_0x22ae77['interface'])?util[_0xd018('0x97')](_0xd018('0x98'),_0x22ae77[_0xd018('0x2e')]):_0x22ae77[_0xd018('0x94')],'paused':_0x22ae77[_0xd018('0x93')]||![],'penalty':_0x22d043[_0xd018('0x8d')]['penalty']},{'transaction':_0x1efb0d});});return Promise[_0xd018('0x99')](_0x1c029d);});});});return Promise['all'](_0x131e80);});return Promise[_0xd018('0x99')](_0x4fd1ea);})[_0xd018('0x46')](function(){return db[_0xd018('0x71')][_0xd018('0x7b')]({'where':{'teamId':_0x5b441f}})[_0xd018('0x46')](function(_0x18668b){if(_0x18668b){var _0x47ce1f=_[_0xd018('0x31')](_0x2e1942,function(_0x4fd761){db[_0xd018('0x72')][_0xd018('0x96')]({'UserId':_0x4fd761,'VoicePrefixId':_0x18668b[_0xd018('0x73')]});});return Promise['all'](_0x47ce1f);}});});});return Promise[_0xd018('0x99')](_0x12553e)['then'](function(){return _0x30a57b[_0xd018('0x7f')](_0x2e1942,{'transaction':_0x1efb0d})[_0xd018('0x9a')](function(_0x372358){return _0x372358;});});});}})[_0xd018('0x46')](respondWithResult(_0x19a78c,null))[_0xd018('0x4b')](handleError(_0x19a78c,null));};exports[_0xd018('0x9b')]=function(_0x3eb66e,_0x5cde5a){var _0x234985=_[_0xd018('0x80')](_0x3eb66e[_0xd018('0x38')][_0xd018('0x7d')])?_0x3eb66e['query']['ids']:[_0x3eb66e[_0xd018('0x38')][_0xd018('0x7d')]];var _0x29dd1e=_0x3eb66e[_0xd018('0x4d')]['id'];return db[_0xd018('0x32')][_0xd018('0x50')]({'where':{'id':_0x29dd1e}})[_0xd018('0x46')](handleEntityNotFound(_0x5cde5a,null))[_0xd018('0x46')](function(_0x8cd87c){if(_0x8cd87c){var _0x1ca549=[_0xd018('0x81'),_0xd018('0x82'),'Mail','Sms',_0xd018('0x85'),_0xd018('0x86'),'Whatsapp'];return db[_0xd018('0x5a')][_0xd018('0x88')](function(_0x21a2e4){var _0x3574e8=_[_0xd018('0x31')](_0x1ca549,function(_0x70bedd){var _0x311367={'attributes':['id',_0xd018('0x2e')]};return _0x8cd87c[_0xd018('0x54')+_0x70bedd+_0xd018('0x79')](_0x311367)['then'](function(_0x339a17){var _0x1007cd=_[_0xd018('0x31')](_0x339a17,function(_0x596dc3){return _0x596dc3[_0xd018('0x9b')](_0x234985,{'transaction':_0x21a2e4})[_0xd018('0x46')](function(){var _0x57ccab=_['map'](_0x234985,function(_0x5d1dd4){socket[_0xd018('0x90')](_0xd018('0x53')+_0x70bedd+_0xd018('0x9c'),{'UserId':Number(_0x5d1dd4),[_0x70bedd+_0xd018('0x8b')]:_0x596dc3['id']});if(_0x70bedd!==_0xd018('0x81')){return;}return db[_0xd018('0x95')][_0xd018('0x60')]({'where':{'VoiceQueueId':_0x596dc3['id'],'UserId':_0x5d1dd4},'transaction':_0x21a2e4});});return Promise[_0xd018('0x99')](_0x57ccab);});});return Promise[_0xd018('0x99')](_0x1007cd);});});return Promise['all'](_0x3574e8)[_0xd018('0x46')](function(){return _0x8cd87c[_0xd018('0x9b')](_0x234985,{'transaction':_0x21a2e4});})['then'](function(){return db['TeamVoicePrefix'][_0xd018('0x7b')]({'where':{'teamId':_0x29dd1e}})[_0xd018('0x46')](function(_0x505957){if(_0x505957){var _0x4012a6=_[_0xd018('0x31')](_0x234985,function(_0x1054ad){db[_0xd018('0x72')]['destroy']({'where':{'UserId':_0x1054ad,'VoicePrefixId':_0x505957['VoicePrefixId']}});});return Promise[_0xd018('0x99')](_0x4012a6);}});});});}})['then'](respondWithStatusCode(_0x5cde5a,null))[_0xd018('0x4b')](handleError(_0x5cde5a,null));};exports['getAgents']=function(_0x40f39f,_0x2dc10a,_0x1005b7){var _0x3dc057={};var _0x334106={};var _0x2e9de7;var _0x3ed42f;return db[_0xd018('0x32')][_0xd018('0x7b')]({'where':{'id':_0x40f39f[_0xd018('0x4d')]['id']}})[_0xd018('0x46')](handleEntityNotFound(_0x2dc10a,null))[_0xd018('0x46')](function(_0x15bc76){if(_0x15bc76){_0x2e9de7=_0x15bc76;_0x334106['model']=_[_0xd018('0x39')](db[_0xd018('0x8e')][_0xd018('0x33')]);_0x334106[_0xd018('0x38')]=_['keys'](_0x40f39f[_0xd018('0x38')]);_0x334106[_0xd018('0x3a')]=_['intersection'](_0x334106[_0xd018('0x37')],_0x334106[_0xd018('0x38')]);_0x3dc057[_0xd018('0x3b')]=_[_0xd018('0x3c')](_0x334106[_0xd018('0x37')],qs[_0xd018('0x3d')](_0x40f39f['query'][_0xd018('0x3d')]));_0x3dc057[_0xd018('0x3b')]=_0x3dc057['attributes']['length']?_0x3dc057[_0xd018('0x3b')]:_0x334106[_0xd018('0x37')];_0x3dc057['order']=qs['sort'](_0x40f39f[_0xd018('0x38')]['sort']);_0x3dc057['where']=qs[_0xd018('0x3a')](_[_0xd018('0x42')](_0x40f39f[_0xd018('0x38')],_0x334106[_0xd018('0x3a')]));if(_0x40f39f[_0xd018('0x38')]['filter']){_0x3dc057['where']=_[_0xd018('0x4f')](_0x3dc057[_0xd018('0x41')],{'$or':_['map'](_0x3dc057[_0xd018('0x3b')],function(_0x2c446c){var _0x3c74f4={};_0x3c74f4[_0x2c446c]={'$like':'%'+_0x40f39f[_0xd018('0x38')]['filter']+'%'};return _0x3c74f4;})});}_0x3dc057=_[_0xd018('0x4f')]({},_0x3dc057,_0x40f39f['options']);return _0x2e9de7[_0xd018('0x9d')](_0x3dc057);}})[_0xd018('0x46')](function(_0x524cc0){if(_0x524cc0){_0x3ed42f=_0x524cc0[_0xd018('0x4e')];if(!_0x40f39f[_0xd018('0x38')][_0xd018('0x9e')](_0xd018('0x3e'))){_0x3dc057['limit']=qs['limit'](_0x40f39f[_0xd018('0x38')][_0xd018('0x24')]);_0x3dc057[_0xd018('0x23')]=qs[_0xd018('0x23')](_0x40f39f[_0xd018('0x38')][_0xd018('0x23')]);}return _0x2e9de7[_0xd018('0x9d')](_0x3dc057);}})['then'](function(_0x497f2e){if(_0x497f2e){return _0x497f2e?{'count':_0x3ed42f,'rows':_0x497f2e}:null;}})[_0xd018('0x46')](respondWithResult(_0x2dc10a,null))[_0xd018('0x4b')](handleError(_0x2dc10a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 37f7098..6116056 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 _0x114f=['save','remove','emit','hook','exports','events','../../mysqldb','Team'];(function(_0x5f36fb,_0x562c4f){var _0x2e9f8a=function(_0x473b4a){while(--_0x473b4a){_0x5f36fb['push'](_0x5f36fb['shift']());}};_0x2e9f8a(++_0x562c4f);}(_0x114f,0x145));var _0xf114=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x114f[_0x2f62aa];return _0x1a341f;};'use strict';var EventEmitter=require(_0xf114('0x0'));var Team=require(_0xf114('0x1'))['db'][_0xf114('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf114('0x3'),'afterUpdate':'update','afterDestroy':_0xf114('0x4')};function emitEvent(_0x48c0d2){return function(_0x3b7071,_0x263cb9,_0x3848f2){TeamEvents[_0xf114('0x5')](_0x48c0d2+':'+_0x3b7071['id'],_0x3b7071);TeamEvents['emit'](_0x48c0d2,_0x3b7071);_0x3848f2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xf114('0x6')](e,emitEvent(event));}}module[_0xf114('0x7')]=TeamEvents; \ No newline at end of file +var _0xc5d3=['exports','events','../../mysqldb','setMaxListeners','save','update','hasOwnProperty','hook'];(function(_0x44ab0b,_0x3564f3){var _0x635ced=function(_0x43c1c6){while(--_0x43c1c6){_0x44ab0b['push'](_0x44ab0b['shift']());}};_0x635ced(++_0x3564f3);}(_0xc5d3,0x101));var _0x3c5d=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xc5d3[_0x45d3f0];return _0x314b79;};'use strict';var EventEmitter=require(_0x3c5d('0x0'));var Team=require(_0x3c5d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x3c5d('0x2')](0x0);var events={'afterCreate':_0x3c5d('0x3'),'afterUpdate':_0x3c5d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29641e){return function(_0x3afa29,_0x46bb2c,_0x5c2413){TeamEvents['emit'](_0x29641e+':'+_0x3afa29['id'],_0x3afa29);TeamEvents['emit'](_0x29641e,_0x3afa29);_0x5c2413(null);};}for(var e in events){if(events[_0x3c5d('0x5')](e)){var event=events[e];Team[_0x3c5d('0x6')](e,emitEvent(event));}}module[_0x3c5d('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4b2fd4a..34d2e12 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 _0x1547=['Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','define','teams','Chat','Fax'];(function(_0x1eb1c2,_0x54d65c){var _0x3a5f7e=function(_0x2f43a8){while(--_0x2f43a8){_0x1eb1c2['push'](_0x1eb1c2['shift']());}};_0x3a5f7e(++_0x54d65c);}(_0x1547,0x1bf));var _0x7154=function(_0x42f374,_0x1d445f){_0x42f374=_0x42f374-0x0;var _0x361747=_0x1547[_0x42f374];return _0x361747;};'use strict';var _=require(_0x7154('0x0'));var attributes=require(_0x7154('0x1'));function getQueuesByChannel(_0x4724b5,_0x5aa017){var _0x24ccd1=_0x7154('0x2')+_0x5aa017+_0x7154('0x3');return _0x4724b5[_0x24ccd1]()[_0x7154('0x4')](function(_0x2a1aab){return _[_0x7154('0x5')](_0x2a1aab,function(_0x4c2199){_0x4c2199[_0x7154('0x6')](_0x7154('0x7'),_0x5aa017);return _0x4c2199;});})[_0x7154('0x8')](function(_0x4fd789){throw _0x4fd789;});}module['exports']=function(_0xa4474b){return _0xa4474b[_0x7154('0x9')]('Team',attributes,{'tableName':_0x7154('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x653da=this;var _0x368d1b=[_0x7154('0xb'),_0x7154('0xc'),_0x7154('0xd'),_0x7154('0xe'),_0x7154('0xf'),_0x7154('0x10'),_0x7154('0x11')];return Promise[_0x7154('0x12')]()[_0x7154('0x4')](function(){var _0xbc6cba=_[_0x7154('0x5')](_0x368d1b,function(_0x3d9abd){return getQueuesByChannel(_0x653da,_0x3d9abd);});return Promise[_0x7154('0x13')](_0xbc6cba);})['catch'](function(_0x550f92){throw _0x550f92;});}}});}; \ No newline at end of file +var _0x41f2=['all','lodash','./team.attributes','get','Queues','then','setDataValue','channel','catch','exports','Team','teams','Chat','Fax','Mail','Openchannel','Voice','resolve','map'];(function(_0x42935b,_0x31ed72){var _0x4dbc15=function(_0x375c72){while(--_0x375c72){_0x42935b['push'](_0x42935b['shift']());}};_0x4dbc15(++_0x31ed72);}(_0x41f2,0x1ef));var _0x241f=function(_0x1963f6,_0x2c4d5f){_0x1963f6=_0x1963f6-0x0;var _0x42f8a6=_0x41f2[_0x1963f6];return _0x42f8a6;};'use strict';var _=require(_0x241f('0x0'));var attributes=require(_0x241f('0x1'));function getQueuesByChannel(_0x5cc5a1,_0x2be82b){var _0x374aca=_0x241f('0x2')+_0x2be82b+_0x241f('0x3');return _0x5cc5a1[_0x374aca]()[_0x241f('0x4')](function(_0x20e2dd){return _['map'](_0x20e2dd,function(_0x37dcfe){_0x37dcfe[_0x241f('0x5')](_0x241f('0x6'),_0x2be82b);return _0x37dcfe;});})[_0x241f('0x7')](function(_0x561f65){throw _0x561f65;});}module[_0x241f('0x8')]=function(_0x4a3421){return _0x4a3421['define'](_0x241f('0x9'),attributes,{'tableName':_0x241f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x42f362=this;var _0x3bde9b=[_0x241f('0xb'),_0x241f('0xc'),_0x241f('0xd'),_0x241f('0xe'),'Sms',_0x241f('0xf'),'Whatsapp'];return Promise[_0x241f('0x10')]()[_0x241f('0x4')](function(){var _0x539e50=_[_0x241f('0x11')](_0x3bde9b,function(_0x3b7f3d){return getQueuesByChannel(_0x42f362,_0x3b7f3d);});return Promise[_0x241f('0x12')](_0x539e50);})[_0x241f('0x7')](function(_0x161af1){throw _0x161af1;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index df9f662..602f078 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 _0x71b8=['./team.socket','register','request','info','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x154e4c,_0x28ee85){var _0x335d4a=function(_0x9fd158){while(--_0x9fd158){_0x154e4c['push'](_0x154e4c['shift']());}};_0x335d4a(++_0x28ee85);}(_0x71b8,0x109));var _0x871b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x71b8[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x871b('0x0'));var util=require(_0x871b('0x1'));var moment=require(_0x871b('0x2'));var BPromise=require(_0x871b('0x3'));var rs=require(_0x871b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x871b('0x5'))['db'];var utils=require(_0x871b('0x6'));var logger=require('../../config/logger')(_0x871b('0x7'));var config=require('../../config/environment');var jayson=require(_0x871b('0x8'));var client=jayson[_0x871b('0x9')][_0x871b('0xa')]({'port':0x232a});config['redis']=_[_0x871b('0xb')](config[_0x871b('0xc')],{'host':_0x871b('0xd'),'port':0x18eb});var socket=require(_0x871b('0xe'))(new Redis(config['redis']));require(_0x871b('0xf'))[_0x871b('0x10')](socket);function respondWithRpcPromise(_0x50994c,_0x4aae77,_0x349a4a){return new BPromise(function(_0x5ddabe,_0x499a6d){return client[_0x871b('0x11')](_0x50994c,_0x349a4a)['then'](function(_0x664418){logger[_0x871b('0x12')]('Team,\x20%s,\x20%s',_0x4aae77,_0x871b('0x13'));logger[_0x871b('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x4aae77,_0x871b('0x13'),JSON[_0x871b('0x15')](_0x664418));if(_0x664418[_0x871b('0x16')]){if(_0x664418[_0x871b('0x16')][_0x871b('0x17')]===0x1f4){logger[_0x871b('0x16')](_0x871b('0x18'),_0x4aae77,_0x664418[_0x871b('0x16')][_0x871b('0x19')]);return _0x499a6d(_0x664418[_0x871b('0x16')][_0x871b('0x19')]);}logger[_0x871b('0x16')](_0x871b('0x18'),_0x4aae77,_0x664418[_0x871b('0x16')]['message']);return _0x5ddabe(_0x664418[_0x871b('0x16')][_0x871b('0x19')]);}else{logger['info'](_0x871b('0x18'),_0x4aae77,_0x871b('0x13'));_0x5ddabe(_0x664418[_0x871b('0x1a')]['message']);}})[_0x871b('0x1b')](function(_0x3c5088){logger[_0x871b('0x16')](_0x871b('0x18'),_0x4aae77,_0x3c5088);_0x499a6d(_0x3c5088);});});} \ No newline at end of file +var _0x95c3=['request','then','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','register'];(function(_0x1b341b,_0x1e081d){var _0x4a36ca=function(_0x7a76ae){while(--_0x7a76ae){_0x1b341b['push'](_0x1b341b['shift']());}};_0x4a36ca(++_0x1e081d);}(_0x95c3,0xfb));var _0x395c=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x95c3[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x395c('0x0'));var util=require('util');var moment=require(_0x395c('0x1'));var BPromise=require(_0x395c('0x2'));var rs=require(_0x395c('0x3'));var fs=require('fs');var Redis=require(_0x395c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x395c('0x5'))(_0x395c('0x6'));var config=require(_0x395c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x395c('0x8')][_0x395c('0x9')]({'port':0x232a});config[_0x395c('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x395c('0xb'))(new Redis(config[_0x395c('0xa')]));require('./team.socket')[_0x395c('0xc')](socket);function respondWithRpcPromise(_0x217a2c,_0x1ace84,_0x4ed6a9){return new BPromise(function(_0x20391b,_0x1a3452){return client[_0x395c('0xd')](_0x217a2c,_0x4ed6a9)[_0x395c('0xe')](function(_0x4c7d60){logger[_0x395c('0xf')](_0x395c('0x10'),_0x1ace84,'request\x20sent');logger['debug'](_0x395c('0x11'),_0x1ace84,_0x395c('0x12'),JSON['stringify'](_0x4c7d60));if(_0x4c7d60[_0x395c('0x13')]){if(_0x4c7d60[_0x395c('0x13')][_0x395c('0x14')]===0x1f4){logger['error'](_0x395c('0x10'),_0x1ace84,_0x4c7d60[_0x395c('0x13')][_0x395c('0x15')]);return _0x1a3452(_0x4c7d60['error'][_0x395c('0x15')]);}logger[_0x395c('0x13')]('Team,\x20%s,\x20%s',_0x1ace84,_0x4c7d60[_0x395c('0x13')]['message']);return _0x20391b(_0x4c7d60[_0x395c('0x13')][_0x395c('0x15')]);}else{logger[_0x395c('0xf')](_0x395c('0x10'),_0x1ace84,_0x395c('0x12'));_0x20391b(_0x4c7d60[_0x395c('0x16')][_0x395c('0x15')]);}})[_0x395c('0x17')](function(_0x1c50f2){logger[_0x395c('0x13')](_0x395c('0x10'),_0x1ace84,_0x1c50f2);_0x1a3452(_0x1c50f2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 41f9967..c6d582d 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 _0x13cc=['update','emit','removeListener','length','team:','remove'];(function(_0x5d0e57,_0xdb5c66){var _0x24934c=function(_0x4c60eb){while(--_0x4c60eb){_0x5d0e57['push'](_0x5d0e57['shift']());}};_0x24934c(++_0xdb5c66);}(_0x13cc,0x161));var _0xc13c=function(_0x56d17c,_0x1a21af){_0x56d17c=_0x56d17c-0x0;var _0x2c4bfd=_0x13cc[_0x56d17c];return _0x2c4bfd;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xc13c('0x0'),_0xc13c('0x1')];function createListener(_0x4e5b66,_0x280439){return function(_0x34dc01){_0x280439[_0xc13c('0x2')](_0x4e5b66,_0x34dc01);};}function removeListener(_0xd65d02,_0x7e5e19){return function(){TeamEvents[_0xc13c('0x3')](_0xd65d02,_0x7e5e19);};}exports['register']=function(_0x98e54d){for(var _0x4c9afa=0x0,_0x18b0b4=events[_0xc13c('0x4')];_0x4c9afa<_0x18b0b4;_0x4c9afa++){var _0x4889d6=events[_0x4c9afa];var _0x318eab=createListener(_0xc13c('0x5')+_0x4889d6,_0x98e54d);TeamEvents['on'](_0x4889d6,_0x318eab);}}; \ No newline at end of file +var _0xa195=['./team.events','save','update','removeListener','register','length','team:'];(function(_0x2a27fc,_0x15f938){var _0x5cc6da=function(_0x2efb42){while(--_0x2efb42){_0x2a27fc['push'](_0x2a27fc['shift']());}};_0x5cc6da(++_0x15f938);}(_0xa195,0x1b2));var _0x5a19=function(_0x43614e,_0x515792){_0x43614e=_0x43614e-0x0;var _0x52f449=_0xa195[_0x43614e];return _0x52f449;};'use strict';var TeamEvents=require(_0x5a19('0x0'));var events=[_0x5a19('0x1'),'remove',_0x5a19('0x2')];function createListener(_0x1c1f91,_0x567087){return function(_0x3887ab){_0x567087['emit'](_0x1c1f91,_0x3887ab);};}function removeListener(_0x1779be,_0x4c4c09){return function(){TeamEvents[_0x5a19('0x3')](_0x1779be,_0x4c4c09);};}exports[_0x5a19('0x4')]=function(_0x59873a){for(var _0x3bdfd4=0x0,_0x23632a=events[_0x5a19('0x5')];_0x3bdfd4<_0x23632a;_0x3bdfd4++){var _0x235e1b=events[_0x3bdfd4];var _0x328c98=createListener(_0x5a19('0x6')+_0x235e1b,_0x59873a);TeamEvents['on'](_0x235e1b,_0x328c98);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 31bc31a..43831e5 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 _0x58e5=['exports','INTEGER','sequelize'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x58e5,0xd1));var _0x558e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x58e5[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x558e('0x0'));module[_0x558e('0x1')]={'TeamId':{'type':Sequelize[_0x558e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x558e('0x2')]}}; \ No newline at end of file +var _0x4a3d=['INTEGER','sequelize','exports'];(function(_0x261c53,_0x497f83){var _0xa39042=function(_0x2673fb){while(--_0x2673fb){_0x261c53['push'](_0x261c53['shift']());}};_0xa39042(++_0x497f83);}(_0x4a3d,0x79));var _0xd4a3=function(_0x1c06d9,_0x24ad96){_0x1c06d9=_0x1c06d9-0x0;var _0x3da9fa=_0x4a3d[_0x1c06d9];return _0x3da9fa;};'use strict';var Sequelize=require(_0xd4a3('0x0'));module[_0xd4a3('0x1')]={'TeamId':{'type':Sequelize[_0xd4a3('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd4a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index bd05931..ef76809 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 _0x0db9=['team_has_voice_prefixes','lodash','moment','bluebird','path','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix'];(function(_0x46d6d3,_0x31982b){var _0x393eac=function(_0x2d82a5){while(--_0x2d82a5){_0x46d6d3['push'](_0x46d6d3['shift']());}};_0x393eac(++_0x31982b);}(_0x0db9,0xa3));var _0x90db=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0x0db9[_0x1dbaf7];return _0x593f05;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90db('0x1'));var BPromise=require(_0x90db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90db('0x3'));var rimraf=require('rimraf');var config=require(_0x90db('0x4'));var attributes=require(_0x90db('0x5'));module['exports']=function(_0x2d02a1,_0x242774){return _0x2d02a1[_0x90db('0x6')](_0x90db('0x7'),attributes,{'tableName':_0x90db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ae2=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x1a7fc9,_0x1ceb8d){_0x1a7fc9=_0x1a7fc9-0x0;var _0x30990f=_0x6ae2[_0x1a7fc9];return _0x30990f;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));var logger=require(_0x26ae('0x2'))(_0x26ae('0x3'));var moment=require(_0x26ae('0x4'));var BPromise=require(_0x26ae('0x5'));var rp=require(_0x26ae('0x6'));var fs=require('fs');var path=require(_0x26ae('0x7'));var rimraf=require(_0x26ae('0x8'));var config=require('../../config/environment');var attributes=require(_0x26ae('0x9'));module[_0x26ae('0xa')]=function(_0x595da8,_0x5609b0){return _0x595da8[_0x26ae('0xb')](_0x26ae('0xc'),attributes,{'tableName':_0x26ae('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d8298c2..ad9a7b1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x55c99e,_0x46d478){var _0x5a89be=function(_0x481293){while(--_0x481293){_0x55c99e['push'](_0x55c99e['shift']());}};_0x5a89be(++_0x46d478);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2d4a7b,_0x5ed5ba){var _0xe81d34=function(_0x273463){while(--_0x273463){_0x2d4a7b['push'](_0x2d4a7b['shift']());}};_0xe81d34(++_0x5ed5ba);}(_0xe706,0xa3));var _0x6e70=function(_0x569744,_0x30c532){_0x569744=_0x569744-0x0;var _0x57e918=_0xe706[_0x569744];return _0x57e918;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index c7ca742..7f241d8 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 _0x8795=['sequelize','exports','INTEGER'];(function(_0xde1348,_0x5205b6){var _0x32c5e0=function(_0x4fcf88){while(--_0x4fcf88){_0xde1348['push'](_0xde1348['shift']());}};_0x32c5e0(++_0x5205b6);}(_0x8795,0x14a));var _0x5879=function(_0x559d3b,_0x2121c6){_0x559d3b=_0x559d3b-0x0;var _0x494fd6=_0x8795[_0x559d3b];return _0x494fd6;};'use strict';var Sequelize=require(_0x5879('0x0'));module[_0x5879('0x1')]={'penalty':{'type':Sequelize[_0x5879('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc5b4=['sequelize','exports','INTEGER'];(function(_0x5cf275,_0x5280b6){var _0x1b689a=function(_0x40aba7){while(--_0x40aba7){_0x5cf275['push'](_0x5cf275['shift']());}};_0x1b689a(++_0x5280b6);}(_0xc5b4,0x1cb));var _0x4c5b=function(_0x2dae0c,_0x3b578c){_0x2dae0c=_0x2dae0c-0x0;var _0x36c35b=_0xc5b4[_0x2dae0c];return _0x36c35b;};'use strict';var Sequelize=require(_0x4c5b('0x0'));module[_0x4c5b('0x1')]={'penalty':{'type':Sequelize[_0x4c5b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 05b1ba9..0e73b4a 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 _0xdab2=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var logger=require('../../config/logger')(_0x2dab('0x2'));var moment=require(_0x2dab('0x3'));var BPromise=require(_0x2dab('0x4'));var rp=require(_0x2dab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var attributes=require(_0x2dab('0x8'));module[_0x2dab('0x9')]=function(_0x4562bb,_0x1421d5){return _0x4562bb[_0x2dab('0xa')](_0x2dab('0xb'),attributes,{'tableName':_0x2dab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd691=['exports','team_has_voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x904f36,_0x1f2eac){var _0xc2645c=function(_0x40e08b){while(--_0x40e08b){_0x904f36['push'](_0x904f36['shift']());}};_0xc2645c(++_0x1f2eac);}(_0xd691,0xe6));var _0x1d69=function(_0x3917d3,_0xab2510){_0x3917d3=_0x3917d3-0x0;var _0x36b6fa=_0xd691[_0x3917d3];return _0x36b6fa;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var logger=require(_0x1d69('0x2'))('api');var moment=require(_0x1d69('0x3'));var BPromise=require(_0x1d69('0x4'));var rp=require(_0x1d69('0x5'));var fs=require('fs');var path=require(_0x1d69('0x6'));var rimraf=require(_0x1d69('0x7'));var config=require(_0x1d69('0x8'));var attributes=require(_0x1d69('0x9'));module[_0x1d69('0xa')]=function(_0xdbf1f2,_0x3b36f5){return _0xdbf1f2['define']('TeamVoiceQueue',attributes,{'tableName':_0x1d69('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 4ca682b..9739f40 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 _0x6082=['TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x6082,0x134));var _0x2608=function(_0x2eac9d,_0x56138c){_0x2eac9d=_0x2eac9d-0x0;var _0x13c11b=_0x6082[_0x2eac9d];return _0x13c11b;};'use strict';var _=require(_0x2608('0x0'));var util=require(_0x2608('0x1'));var moment=require('moment');var BPromise=require(_0x2608('0x2'));var rs=require(_0x2608('0x3'));var fs=require('fs');var Redis=require(_0x2608('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2608('0x5'));var logger=require(_0x2608('0x6'))(_0x2608('0x7'));var config=require(_0x2608('0x8'));var jayson=require(_0x2608('0x9'));var client=jayson[_0x2608('0xa')][_0x2608('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54384c,_0x47ef56,_0x34fa79){return new BPromise(function(_0x13a64a,_0x6c393){return client['request'](_0x54384c,_0x34fa79)[_0x2608('0xc')](function(_0x2a7967){logger[_0x2608('0xd')](_0x2608('0xe'),_0x47ef56,_0x2608('0xf'));logger[_0x2608('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x47ef56,'request\x20sent',JSON[_0x2608('0x11')](_0x2a7967));if(_0x2a7967[_0x2608('0x12')]){if(_0x2a7967[_0x2608('0x12')][_0x2608('0x13')]===0x1f4){logger['error'](_0x2608('0xe'),_0x47ef56,_0x2a7967['error'][_0x2608('0x14')]);return _0x6c393(_0x2a7967['error'][_0x2608('0x14')]);}logger['error'](_0x2608('0xe'),_0x47ef56,_0x2a7967[_0x2608('0x12')][_0x2608('0x14')]);return _0x13a64a(_0x2a7967[_0x2608('0x12')]['message']);}else{logger['info'](_0x2608('0xe'),_0x47ef56,_0x2608('0xf'));_0x13a64a(_0x2a7967[_0x2608('0x15')][_0x2608('0x14')]);}})[_0x2608('0x16')](function(_0x36b739){logger[_0x2608('0x12')](_0x2608('0xe'),_0x47ef56,_0x36b739);_0x6c393(_0x36b739);});});} \ No newline at end of file +var _0x90c7=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x90c7,0x9c));var _0x790c=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x90c7[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x790c('0x0'));var util=require(_0x790c('0x1'));var moment=require(_0x790c('0x2'));var BPromise=require(_0x790c('0x3'));var rs=require(_0x790c('0x4'));var fs=require('fs');var Redis=require(_0x790c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x790c('0x6'));var logger=require(_0x790c('0x7'))('rpc');var config=require(_0x790c('0x8'));var jayson=require(_0x790c('0x9'));var client=jayson[_0x790c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5e96,_0x245625,_0x8e8cca){return new BPromise(function(_0x10b607,_0x2d5ffa){return client[_0x790c('0xb')](_0x2f5e96,_0x8e8cca)[_0x790c('0xc')](function(_0x521fef){logger[_0x790c('0xd')](_0x790c('0xe'),_0x245625,'request\x20sent');logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x245625,_0x790c('0xf'),JSON[_0x790c('0x10')](_0x521fef));if(_0x521fef[_0x790c('0x11')]){if(_0x521fef[_0x790c('0x11')][_0x790c('0x12')]===0x1f4){logger[_0x790c('0x11')](_0x790c('0xe'),_0x245625,_0x521fef['error']['message']);return _0x2d5ffa(_0x521fef['error'][_0x790c('0x13')]);}logger[_0x790c('0x11')](_0x790c('0xe'),_0x245625,_0x521fef[_0x790c('0x11')][_0x790c('0x13')]);return _0x10b607(_0x521fef[_0x790c('0x11')][_0x790c('0x13')]);}else{logger[_0x790c('0xd')](_0x790c('0xe'),_0x245625,'request\x20sent');_0x10b607(_0x521fef['result'][_0x790c('0x13')]);}})['catch'](function(_0x102235){logger['error'](_0x790c('0xe'),_0x245625,_0x102235);_0x2d5ffa(_0x102235);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 286a107..e099878 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 _0xc177=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1b2eea,_0x2ac071){var _0x2a81cf=function(_0xacc88f){while(--_0xacc88f){_0x1b2eea['push'](_0x1b2eea['shift']());}};_0x2a81cf(++_0x2ac071);}(_0xc177,0x1b2));var _0x7c17=function(_0x21cbec,_0x2f7d5f){_0x21cbec=_0x21cbec-0x0;var _0x35376f=_0xc177[_0x21cbec];return _0x35376f;};'use strict';var multer=require(_0x7c17('0x0'));var util=require(_0x7c17('0x1'));var path=require(_0x7c17('0x2'));var timeout=require(_0x7c17('0x3'));var express=require(_0x7c17('0x4'));var router=express['Router']();var fs_extra=require(_0x7c17('0x5'));var auth=require(_0x7c17('0x6'));var interaction=require(_0x7c17('0x7'));var config=require(_0x7c17('0x8'));var controller=require('./template.controller');router[_0x7c17('0x9')]('/',auth[_0x7c17('0xa')](),controller[_0x7c17('0xb')]);router['get'](_0x7c17('0xc'),auth[_0x7c17('0xa')](),controller[_0x7c17('0xd')]);router[_0x7c17('0xe')]('/',auth[_0x7c17('0xa')](),controller[_0x7c17('0xf')]);router[_0x7c17('0x10')](_0x7c17('0xc'),auth[_0x7c17('0xa')](),controller[_0x7c17('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7c17('0x12')]);module[_0x7c17('0x13')]=router; \ No newline at end of file +var _0x095b=['get','isAuthenticated','index','/:id','post','create','put','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x095b,0x6e));var _0xb095=function(_0x20a50a,_0x26a0e1){_0x20a50a=_0x20a50a-0x0;var _0x15ce5a=_0x095b[_0x20a50a];return _0x15ce5a;};'use strict';var multer=require(_0xb095('0x0'));var util=require('util');var path=require(_0xb095('0x1'));var timeout=require(_0xb095('0x2'));var express=require(_0xb095('0x3'));var router=express[_0xb095('0x4')]();var fs_extra=require(_0xb095('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb095('0x6'));var config=require(_0xb095('0x7'));var controller=require(_0xb095('0x8'));router[_0xb095('0x9')]('/',auth[_0xb095('0xa')](),controller[_0xb095('0xb')]);router[_0xb095('0x9')](_0xb095('0xc'),auth[_0xb095('0xa')](),controller['show']);router[_0xb095('0xd')]('/',auth[_0xb095('0xa')](),controller[_0xb095('0xe')]);router[_0xb095('0xf')](_0xb095('0xc'),auth[_0xb095('0xa')](),controller['update']);router['delete'](_0xb095('0xc'),auth[_0xb095('0xa')](),controller['destroy']);module[_0xb095('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0d4bb9a..5042f69 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 _0x176b=['TEXT','sequelize','exports','STRING'];(function(_0x5b3333,_0x52d211){var _0x6fe2df=function(_0x1166a3){while(--_0x1166a3){_0x5b3333['push'](_0x5b3333['shift']());}};_0x6fe2df(++_0x52d211);}(_0x176b,0x1b5));var _0xb176=function(_0xb7cb72,_0x19d391){_0xb7cb72=_0xb7cb72-0x0;var _0x4b7570=_0x176b[_0xb7cb72];return _0x4b7570;};'use strict';var Sequelize=require(_0xb176('0x0'));module[_0xb176('0x1')]={'name':{'type':Sequelize[_0xb176('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb176('0x3')]}}; \ No newline at end of file +var _0x79e8=['sequelize','exports','STRING'];(function(_0x1c8d2b,_0x3e9532){var _0x122d2a=function(_0x4fd043){while(--_0x4fd043){_0x1c8d2b['push'](_0x1c8d2b['shift']());}};_0x122d2a(++_0x3e9532);}(_0x79e8,0x1da));var _0x879e=function(_0x3c1ce9,_0x5cbaa6){_0x3c1ce9=_0x3c1ce9-0x0;var _0x39980e=_0x79e8[_0x3c1ce9];return _0x39980e;};'use strict';var Sequelize=require(_0x879e('0x0'));module[_0x879e('0x1')]={'name':{'type':Sequelize[_0x879e('0x2')]},'description':{'type':Sequelize[_0x879e('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 37739e2..149a691 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 _0x0e22=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','Templates','UserProfileResource','then','error','stack','name','send','map','Template','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','status'];(function(_0x208b37,_0x14f91a){var _0x1b54e5=function(_0x395de8){while(--_0x395de8){_0x208b37['push'](_0x208b37['shift']());}};_0x1b54e5(++_0x14f91a);}(_0x0e22,0x84));var _0x20e2=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x0e22[_0x5ebc04];return _0x17845c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20e2('0x0'));var zipdir=require(_0x20e2('0x1'));var jsonpatch=require(_0x20e2('0x2'));var rp=require(_0x20e2('0x3'));var moment=require(_0x20e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20e2('0x5'));var util=require(_0x20e2('0x6'));var path=require(_0x20e2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20e2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x20e2('0x9'));var jsforce=require(_0x20e2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x20e2('0xb'));var querystring=require(_0x20e2('0xc'));var Papa=require(_0x20e2('0xd'));var Redis=require(_0x20e2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x20e2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x20e2('0x10'))('api');var utils=require(_0x20e2('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x20e2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11cbed,_0xa56d74){_0xa56d74=_0xa56d74||0xcc;return function(_0x24f7b9){if(_0x24f7b9){return _0x11cbed['sendStatus'](_0xa56d74);}return _0x11cbed[_0x20e2('0x13')](_0xa56d74)[_0x20e2('0x14')]();};}function respondWithResult(_0x5f0b1c,_0x2ee675){_0x2ee675=_0x2ee675||0xc8;return function(_0x2ca37d){if(_0x2ca37d){return _0x5f0b1c[_0x20e2('0x13')](_0x2ee675)[_0x20e2('0x15')](_0x2ca37d);}};}function respondWithFilteredResult(_0x6c8ed,_0x421f76){return function(_0x3096c8){if(_0x3096c8){var _0xb3eb65=typeof _0x421f76[_0x20e2('0x16')]===_0x20e2('0x17')&&typeof _0x421f76[_0x20e2('0x18')]===_0x20e2('0x17');var _0x1ef476=_0x3096c8[_0x20e2('0x19')];var _0x5b0bdd=_0xb3eb65?0x0:_0x421f76[_0x20e2('0x16')];var _0x2c6acc=_0xb3eb65?_0x3096c8[_0x20e2('0x19')]:_0x421f76['offset']+_0x421f76[_0x20e2('0x18')];var _0x35597f;if(_0x2c6acc>=_0x1ef476){_0x2c6acc=_0x1ef476;_0x35597f=0xc8;}else{_0x35597f=0xce;}_0x6c8ed[_0x20e2('0x13')](_0x35597f);return _0x6c8ed[_0x20e2('0x1a')](_0x20e2('0x1b'),_0x5b0bdd+'-'+_0x2c6acc+'/'+_0x1ef476)['json'](_0x3096c8);}return null;};}function patchUpdates(_0x497a84){return function(_0xbd33be){try{jsonpatch['apply'](_0xbd33be,_0x497a84,!![]);}catch(_0xc18a46){return BPromise[_0x20e2('0x1c')](_0xc18a46);}return _0xbd33be[_0x20e2('0x1d')]();};}function saveUpdates(_0x737758,_0x2e44a2){return function(_0x46666a){if(_0x46666a){return _0x46666a[_0x20e2('0x1e')](_0x737758)['then'](function(_0x3b7004){return _0x3b7004;});}return null;};}function removeEntity(_0x2102e3,_0x3a703d){return function(_0x48aa4f){if(_0x48aa4f){return _0x48aa4f[_0x20e2('0x1f')]()['then'](function(){var _0x3e0647=_0x48aa4f[_0x20e2('0x20')]({'plain':!![]});var _0x4d37d5=_0x20e2('0x21');return db[_0x20e2('0x22')][_0x20e2('0x1f')]({'where':{'type':_0x4d37d5,'resourceId':_0x3e0647['id']}})[_0x20e2('0x23')](function(){return _0x48aa4f;});})[_0x20e2('0x23')](function(){_0x2102e3[_0x20e2('0x13')](0xcc)[_0x20e2('0x14')]();});}};}function handleEntityNotFound(_0x54bf27,_0x4f611d){return function(_0xd2417c){if(!_0xd2417c){_0x54bf27['sendStatus'](0x194);}return _0xd2417c;};}function handleError(_0x4dcf4f,_0x538166){_0x538166=_0x538166||0x1f4;return function(_0x221152){logger[_0x20e2('0x24')](_0x221152[_0x20e2('0x25')]);if(_0x221152['name']){delete _0x221152[_0x20e2('0x26')];}_0x4dcf4f[_0x20e2('0x13')](_0x538166)[_0x20e2('0x27')](_0x221152);};}exports['index']=function(_0x18c15a,_0x5632e5){var _0x5556b9={},_0x7e1438={},_0x407d9f={'count':0x0,'rows':[]};var _0x27e248=_[_0x20e2('0x28')](db[_0x20e2('0x29')][_0x20e2('0x2a')],function(_0x5bdf2a){return{'name':_0x5bdf2a[_0x20e2('0x2b')],'type':_0x5bdf2a['type'][_0x20e2('0x2c')]};});_0x7e1438[_0x20e2('0x2d')]=_[_0x20e2('0x28')](_0x27e248,_0x20e2('0x26'));_0x7e1438[_0x20e2('0x2e')]=_[_0x20e2('0x2f')](_0x18c15a[_0x20e2('0x2e')]);_0x7e1438[_0x20e2('0x30')]=_[_0x20e2('0x31')](_0x7e1438[_0x20e2('0x2d')],_0x7e1438['query']);_0x5556b9[_0x20e2('0x32')]=_['intersection'](_0x7e1438[_0x20e2('0x2d')],qs[_0x20e2('0x33')](_0x18c15a['query']['fields']));_0x5556b9[_0x20e2('0x32')]=_0x5556b9[_0x20e2('0x32')][_0x20e2('0x34')]?_0x5556b9['attributes']:_0x7e1438[_0x20e2('0x2d')];if(!_0x18c15a[_0x20e2('0x2e')]['hasOwnProperty'](_0x20e2('0x35'))){_0x5556b9['limit']=qs[_0x20e2('0x18')](_0x18c15a['query'][_0x20e2('0x18')]);_0x5556b9[_0x20e2('0x16')]=qs[_0x20e2('0x16')](_0x18c15a['query'][_0x20e2('0x16')]);}_0x5556b9[_0x20e2('0x36')]=qs[_0x20e2('0x37')](_0x18c15a[_0x20e2('0x2e')][_0x20e2('0x37')]);_0x5556b9['where']=qs[_0x20e2('0x30')](_[_0x20e2('0x38')](_0x18c15a[_0x20e2('0x2e')],_0x7e1438[_0x20e2('0x30')]),_0x27e248);if(_0x18c15a['query'][_0x20e2('0x39')]){_0x5556b9['where']=_[_0x20e2('0x3a')](_0x5556b9['where'],{'$or':_['map'](_0x27e248,function(_0x3780d2){if(_0x3780d2[_0x20e2('0x3b')]!==_0x20e2('0x3c')){var _0x3864eb={};_0x3864eb[_0x3780d2[_0x20e2('0x26')]]={'$like':'%'+_0x18c15a[_0x20e2('0x2e')][_0x20e2('0x39')]+'%'};return _0x3864eb;}})});}_0x5556b9=_[_0x20e2('0x3a')]({},_0x5556b9,_0x18c15a['options']);var _0x3456c9={'where':_0x5556b9['where']};return db[_0x20e2('0x29')]['count'](_0x3456c9)[_0x20e2('0x23')](function(_0x2d558f){_0x407d9f[_0x20e2('0x19')]=_0x2d558f;if(_0x18c15a[_0x20e2('0x2e')][_0x20e2('0x3d')]){_0x5556b9[_0x20e2('0x3e')]=[{'all':!![]}];}return db['Template']['findAll'](_0x5556b9);})[_0x20e2('0x23')](function(_0x29f6a8){_0x407d9f['rows']=_0x29f6a8;return _0x407d9f;})['then'](respondWithFilteredResult(_0x5632e5,_0x5556b9))[_0x20e2('0x3f')](handleError(_0x5632e5,null));};exports[_0x20e2('0x40')]=function(_0x2ca835,_0x2ef33d){var _0x8d0314={'raw':!![],'where':{'id':_0x2ca835['params']['id']}},_0x2b8f87={};_0x2b8f87[_0x20e2('0x2d')]=_[_0x20e2('0x2f')](db['Template'][_0x20e2('0x2a')]);_0x2b8f87['query']=_['keys'](_0x2ca835[_0x20e2('0x2e')]);_0x2b8f87['filters']=_[_0x20e2('0x31')](_0x2b8f87[_0x20e2('0x2d')],_0x2b8f87[_0x20e2('0x2e')]);_0x8d0314[_0x20e2('0x32')]=_['intersection'](_0x2b8f87[_0x20e2('0x2d')],qs[_0x20e2('0x33')](_0x2ca835[_0x20e2('0x2e')]['fields']));_0x8d0314[_0x20e2('0x32')]=_0x8d0314[_0x20e2('0x32')]['length']?_0x8d0314[_0x20e2('0x32')]:_0x2b8f87[_0x20e2('0x2d')];if(_0x2ca835['query'][_0x20e2('0x3d')]){_0x8d0314[_0x20e2('0x3e')]=[{'all':!![]}];}_0x8d0314=_['merge']({},_0x8d0314,_0x2ca835[_0x20e2('0x41')]);return db[_0x20e2('0x29')][_0x20e2('0x42')](_0x8d0314)[_0x20e2('0x23')](handleEntityNotFound(_0x2ef33d,null))['then'](respondWithResult(_0x2ef33d,null))[_0x20e2('0x3f')](handleError(_0x2ef33d,null));};exports[_0x20e2('0x43')]=function(_0x1bb0fc,_0x500027){return db['Template'][_0x20e2('0x43')](_0x1bb0fc['body'],{})[_0x20e2('0x23')](function(_0x5854de){var _0x350479=_0x1bb0fc[_0x20e2('0x44')][_0x20e2('0x20')]({'plain':!![]});if(!_0x350479)throw new Error(_0x20e2('0x45'));if(_0x350479[_0x20e2('0x46')]===_0x20e2('0x44')){var _0x81ff18=_0x5854de[_0x20e2('0x20')]({'plain':!![]});var _0xcc19d5=_0x20e2('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xcc19d5,'userProfileId':_0x350479[_0x20e2('0x47')]},'raw':!![]})[_0x20e2('0x23')](function(_0x4f26fd){if(_0x4f26fd&&_0x4f26fd[_0x20e2('0x48')]===0x0){return db['UserProfileResource'][_0x20e2('0x43')]({'name':_0x81ff18[_0x20e2('0x26')],'resourceId':_0x81ff18['id'],'type':_0x4f26fd[_0x20e2('0x26')],'sectionId':_0x4f26fd['id']},{})[_0x20e2('0x23')](function(){return _0x5854de;});}else{return _0x5854de;}})[_0x20e2('0x3f')](function(_0x1e68c5){logger['error'](_0x20e2('0x49'),_0x1e68c5);throw _0x1e68c5;});}return _0x5854de;})[_0x20e2('0x23')](respondWithResult(_0x500027,0xc9))['catch'](handleError(_0x500027,null));};exports['update']=function(_0x17e25f,_0x2c6a4a){if(_0x17e25f[_0x20e2('0x4a')]['id']){delete _0x17e25f[_0x20e2('0x4a')]['id'];}return db[_0x20e2('0x29')][_0x20e2('0x42')]({'where':{'id':_0x17e25f[_0x20e2('0x4b')]['id']}})[_0x20e2('0x23')](handleEntityNotFound(_0x2c6a4a,null))['then'](saveUpdates(_0x17e25f[_0x20e2('0x4a')],null))[_0x20e2('0x23')](respondWithResult(_0x2c6a4a,null))[_0x20e2('0x3f')](handleError(_0x2c6a4a,null));};exports['destroy']=function(_0x38fdd3,_0x3fbd1c){return db[_0x20e2('0x29')][_0x20e2('0x42')]({'where':{'id':_0x38fdd3[_0x20e2('0x4b')]['id']}})[_0x20e2('0x23')](handleEntityNotFound(_0x3fbd1c,null))[_0x20e2('0x23')](removeEntity(_0x3fbd1c,null))[_0x20e2('0x3f')](handleError(_0x3fbd1c,null));}; \ No newline at end of file +var _0xf8d5=['path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','then','destroy','Templates','error','stack','name','index','Template','rawAttributes','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','where','merge','type','options','count','includeAll','include','findAll','show','find','catch','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0xf8d5,0xe6));var _0x5f8d=function(_0x58f24e,_0x49ea3c){_0x58f24e=_0x58f24e-0x0;var _0x464f14=_0xf8d5[_0x58f24e];return _0x464f14;};'use strict';var emlformat=require(_0x5f8d('0x0'));var rimraf=require(_0x5f8d('0x1'));var zipdir=require(_0x5f8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f8d('0x3'));var moment=require(_0x5f8d('0x4'));var BPromise=require(_0x5f8d('0x5'));var Mustache=require('mustache');var util=require(_0x5f8d('0x6'));var path=require(_0x5f8d('0x7'));var sox=require(_0x5f8d('0x8'));var csv=require('to-csv');var ejs=require(_0x5f8d('0x9'));var fs=require('fs');var fs_extra=require(_0x5f8d('0xa'));var _=require('lodash');var squel=require(_0x5f8d('0xb'));var crypto=require(_0x5f8d('0xc'));var jsforce=require(_0x5f8d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5f8d('0xe'));var querystring=require('querystring');var Papa=require(_0x5f8d('0xf'));var Redis=require('ioredis');var authService=require(_0x5f8d('0x10'));var qs=require(_0x5f8d('0x11'));var as=require(_0x5f8d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f8d('0x13'))(_0x5f8d('0x14'));var utils=require(_0x5f8d('0x15'));var config=require(_0x5f8d('0x16'));var licenseUtil=require(_0x5f8d('0x17'));var db=require(_0x5f8d('0x18'))['db'];function respondWithStatusCode(_0x301f92,_0x325924){_0x325924=_0x325924||0xcc;return function(_0x5c0dbf){if(_0x5c0dbf){return _0x301f92[_0x5f8d('0x19')](_0x325924);}return _0x301f92[_0x5f8d('0x1a')](_0x325924)[_0x5f8d('0x1b')]();};}function respondWithResult(_0x343713,_0x36a620){_0x36a620=_0x36a620||0xc8;return function(_0x295fb6){if(_0x295fb6){return _0x343713[_0x5f8d('0x1a')](_0x36a620)['json'](_0x295fb6);}};}function respondWithFilteredResult(_0x2693a2,_0x5361c4){return function(_0x519e82){if(_0x519e82){var _0x233842=typeof _0x5361c4[_0x5f8d('0x1c')]===_0x5f8d('0x1d')&&typeof _0x5361c4['limit']==='undefined';var _0x5bea5a=_0x519e82['count'];var _0x23ca29=_0x233842?0x0:_0x5361c4[_0x5f8d('0x1c')];var _0x575fe0=_0x233842?_0x519e82['count']:_0x5361c4['offset']+_0x5361c4[_0x5f8d('0x1e')];var _0x3fb011;if(_0x575fe0>=_0x5bea5a){_0x575fe0=_0x5bea5a;_0x3fb011=0xc8;}else{_0x3fb011=0xce;}_0x2693a2[_0x5f8d('0x1a')](_0x3fb011);return _0x2693a2[_0x5f8d('0x1f')]('Content-Range',_0x23ca29+'-'+_0x575fe0+'/'+_0x5bea5a)[_0x5f8d('0x20')](_0x519e82);}return null;};}function patchUpdates(_0x320c22){return function(_0x40f47a){try{jsonpatch[_0x5f8d('0x21')](_0x40f47a,_0x320c22,!![]);}catch(_0x298627){return BPromise[_0x5f8d('0x22')](_0x298627);}return _0x40f47a['save']();};}function saveUpdates(_0x5c0e2a,_0x5bcff1){return function(_0x1c76b6){if(_0x1c76b6){return _0x1c76b6['update'](_0x5c0e2a)[_0x5f8d('0x23')](function(_0xf46808){return _0xf46808;});}return null;};}function removeEntity(_0x309408,_0x1f895a){return function(_0xe8ff58){if(_0xe8ff58){return _0xe8ff58[_0x5f8d('0x24')]()[_0x5f8d('0x23')](function(){var _0x2acecc=_0xe8ff58['get']({'plain':!![]});var _0x187199=_0x5f8d('0x25');return db['UserProfileResource'][_0x5f8d('0x24')]({'where':{'type':_0x187199,'resourceId':_0x2acecc['id']}})[_0x5f8d('0x23')](function(){return _0xe8ff58;});})['then'](function(){_0x309408[_0x5f8d('0x1a')](0xcc)[_0x5f8d('0x1b')]();});}};}function handleEntityNotFound(_0x2ef069,_0x380767){return function(_0x3337da){if(!_0x3337da){_0x2ef069[_0x5f8d('0x19')](0x194);}return _0x3337da;};}function handleError(_0x1edc51,_0x1947e0){_0x1947e0=_0x1947e0||0x1f4;return function(_0x75b739){logger[_0x5f8d('0x26')](_0x75b739[_0x5f8d('0x27')]);if(_0x75b739[_0x5f8d('0x28')]){delete _0x75b739[_0x5f8d('0x28')];}_0x1edc51[_0x5f8d('0x1a')](_0x1947e0)['send'](_0x75b739);};}exports[_0x5f8d('0x29')]=function(_0x3cc355,_0x19e144){var _0x3012ce={},_0x5e7053={},_0x2ec620={'count':0x0,'rows':[]};var _0x5bcc97=_['map'](db[_0x5f8d('0x2a')][_0x5f8d('0x2b')],function(_0x290ef6){return{'name':_0x290ef6['fieldName'],'type':_0x290ef6['type'][_0x5f8d('0x2c')]};});_0x5e7053['model']=_[_0x5f8d('0x2d')](_0x5bcc97,_0x5f8d('0x28'));_0x5e7053[_0x5f8d('0x2e')]=_[_0x5f8d('0x2f')](_0x3cc355[_0x5f8d('0x2e')]);_0x5e7053[_0x5f8d('0x30')]=_[_0x5f8d('0x31')](_0x5e7053['model'],_0x5e7053[_0x5f8d('0x2e')]);_0x3012ce['attributes']=_[_0x5f8d('0x31')](_0x5e7053[_0x5f8d('0x32')],qs[_0x5f8d('0x33')](_0x3cc355[_0x5f8d('0x2e')][_0x5f8d('0x33')]));_0x3012ce[_0x5f8d('0x34')]=_0x3012ce[_0x5f8d('0x34')][_0x5f8d('0x35')]?_0x3012ce[_0x5f8d('0x34')]:_0x5e7053['model'];if(!_0x3cc355[_0x5f8d('0x2e')]['hasOwnProperty'](_0x5f8d('0x36'))){_0x3012ce['limit']=qs['limit'](_0x3cc355[_0x5f8d('0x2e')][_0x5f8d('0x1e')]);_0x3012ce['offset']=qs['offset'](_0x3cc355[_0x5f8d('0x2e')][_0x5f8d('0x1c')]);}_0x3012ce['order']=qs[_0x5f8d('0x37')](_0x3cc355[_0x5f8d('0x2e')][_0x5f8d('0x37')]);_0x3012ce['where']=qs['filters'](_[_0x5f8d('0x38')](_0x3cc355[_0x5f8d('0x2e')],_0x5e7053[_0x5f8d('0x30')]),_0x5bcc97);if(_0x3cc355[_0x5f8d('0x2e')][_0x5f8d('0x39')]){_0x3012ce[_0x5f8d('0x3a')]=_[_0x5f8d('0x3b')](_0x3012ce[_0x5f8d('0x3a')],{'$or':_[_0x5f8d('0x2d')](_0x5bcc97,function(_0x58a044){if(_0x58a044[_0x5f8d('0x3c')]!=='VIRTUAL'){var _0x18c7f8={};_0x18c7f8[_0x58a044[_0x5f8d('0x28')]]={'$like':'%'+_0x3cc355[_0x5f8d('0x2e')][_0x5f8d('0x39')]+'%'};return _0x18c7f8;}})});}_0x3012ce=_['merge']({},_0x3012ce,_0x3cc355[_0x5f8d('0x3d')]);var _0x21ecf2={'where':_0x3012ce['where']};return db['Template'][_0x5f8d('0x3e')](_0x21ecf2)[_0x5f8d('0x23')](function(_0x4e03b1){_0x2ec620[_0x5f8d('0x3e')]=_0x4e03b1;if(_0x3cc355[_0x5f8d('0x2e')][_0x5f8d('0x3f')]){_0x3012ce[_0x5f8d('0x40')]=[{'all':!![]}];}return db[_0x5f8d('0x2a')][_0x5f8d('0x41')](_0x3012ce);})[_0x5f8d('0x23')](function(_0x136030){_0x2ec620['rows']=_0x136030;return _0x2ec620;})[_0x5f8d('0x23')](respondWithFilteredResult(_0x19e144,_0x3012ce))['catch'](handleError(_0x19e144,null));};exports[_0x5f8d('0x42')]=function(_0x2a15b7,_0x5879f1){var _0x528f1c={'raw':!![],'where':{'id':_0x2a15b7['params']['id']}},_0x205dff={};_0x205dff[_0x5f8d('0x32')]=_[_0x5f8d('0x2f')](db[_0x5f8d('0x2a')][_0x5f8d('0x2b')]);_0x205dff['query']=_[_0x5f8d('0x2f')](_0x2a15b7[_0x5f8d('0x2e')]);_0x205dff['filters']=_[_0x5f8d('0x31')](_0x205dff[_0x5f8d('0x32')],_0x205dff[_0x5f8d('0x2e')]);_0x528f1c[_0x5f8d('0x34')]=_[_0x5f8d('0x31')](_0x205dff[_0x5f8d('0x32')],qs[_0x5f8d('0x33')](_0x2a15b7[_0x5f8d('0x2e')][_0x5f8d('0x33')]));_0x528f1c[_0x5f8d('0x34')]=_0x528f1c[_0x5f8d('0x34')][_0x5f8d('0x35')]?_0x528f1c[_0x5f8d('0x34')]:_0x205dff['model'];if(_0x2a15b7[_0x5f8d('0x2e')][_0x5f8d('0x3f')]){_0x528f1c[_0x5f8d('0x40')]=[{'all':!![]}];}_0x528f1c=_[_0x5f8d('0x3b')]({},_0x528f1c,_0x2a15b7['options']);return db[_0x5f8d('0x2a')][_0x5f8d('0x43')](_0x528f1c)['then'](handleEntityNotFound(_0x5879f1,null))[_0x5f8d('0x23')](respondWithResult(_0x5879f1,null))[_0x5f8d('0x44')](handleError(_0x5879f1,null));};exports['create']=function(_0x225a47,_0xae49d6){return db[_0x5f8d('0x2a')][_0x5f8d('0x45')](_0x225a47[_0x5f8d('0x46')],{})[_0x5f8d('0x23')](function(_0x224ba3){var _0x43abda=_0x225a47['user']['get']({'plain':!![]});if(!_0x43abda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43abda['role']===_0x5f8d('0x47')){var _0x59e10c=_0x224ba3[_0x5f8d('0x48')]({'plain':!![]});var _0xfa8e19=_0x5f8d('0x25');return db[_0x5f8d('0x49')][_0x5f8d('0x43')]({'where':{'name':_0xfa8e19,'userProfileId':_0x43abda[_0x5f8d('0x4a')]},'raw':!![]})[_0x5f8d('0x23')](function(_0x28a98b){if(_0x28a98b&&_0x28a98b[_0x5f8d('0x4b')]===0x0){return db[_0x5f8d('0x4c')][_0x5f8d('0x45')]({'name':_0x59e10c[_0x5f8d('0x28')],'resourceId':_0x59e10c['id'],'type':_0x28a98b[_0x5f8d('0x28')],'sectionId':_0x28a98b['id']},{})[_0x5f8d('0x23')](function(){return _0x224ba3;});}else{return _0x224ba3;}})[_0x5f8d('0x44')](function(_0xb7231a){logger[_0x5f8d('0x26')](_0x5f8d('0x4d'),_0xb7231a);throw _0xb7231a;});}return _0x224ba3;})[_0x5f8d('0x23')](respondWithResult(_0xae49d6,0xc9))[_0x5f8d('0x44')](handleError(_0xae49d6,null));};exports['update']=function(_0x2490d0,_0x48994f){if(_0x2490d0[_0x5f8d('0x46')]['id']){delete _0x2490d0[_0x5f8d('0x46')]['id'];}return db[_0x5f8d('0x2a')][_0x5f8d('0x43')]({'where':{'id':_0x2490d0[_0x5f8d('0x4e')]['id']}})[_0x5f8d('0x23')](handleEntityNotFound(_0x48994f,null))['then'](saveUpdates(_0x2490d0[_0x5f8d('0x46')],null))[_0x5f8d('0x23')](respondWithResult(_0x48994f,null))[_0x5f8d('0x44')](handleError(_0x48994f,null));};exports['destroy']=function(_0x20d85b,_0x492209){return db['Template'][_0x5f8d('0x43')]({'where':{'id':_0x20d85b['params']['id']}})[_0x5f8d('0x23')](handleEntityNotFound(_0x492209,null))['then'](removeEntity(_0x492209,null))[_0x5f8d('0x44')](handleError(_0x492209,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 24ffbb0..95dfca3 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 _0x5bfe=['tools_templates','util','moment','bluebird','./template.attributes','exports','define','Template'];(function(_0x31405e,_0x5b6141){var _0x4c28e4=function(_0x690ef9){while(--_0x690ef9){_0x31405e['push'](_0x31405e['shift']());}};_0x4c28e4(++_0x5b6141);}(_0x5bfe,0xe9));var _0xe5bf=function(_0x313803,_0x53a75c){_0x313803=_0x313803-0x0;var _0xf2c9ab=_0x5bfe[_0x313803];return _0xf2c9ab;};'use strict';var _=require('lodash');var util=require(_0xe5bf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe5bf('0x1'));var BPromise=require(_0xe5bf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe5bf('0x3'));module[_0xe5bf('0x4')]=function(_0x29824d,_0x1de07b){return _0x29824d[_0xe5bf('0x5')](_0xe5bf('0x6'),attributes,{'tableName':_0xe5bf('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x675f=['request-promise','path','rimraf','./template.attributes','exports','define','Template','tools_templates','lodash','api','moment','bluebird'];(function(_0x1bbbd7,_0x3bb396){var _0xc66887=function(_0xf06ad3){while(--_0xf06ad3){_0x1bbbd7['push'](_0x1bbbd7['shift']());}};_0xc66887(++_0x3bb396);}(_0x675f,0x1c4));var _0xf675=function(_0x7f8085,_0xdf2ccb){_0x7f8085=_0x7f8085-0x0;var _0x552a28=_0x675f[_0x7f8085];return _0x552a28;};'use strict';var _=require(_0xf675('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf675('0x1'));var moment=require(_0xf675('0x2'));var BPromise=require(_0xf675('0x3'));var rp=require(_0xf675('0x4'));var fs=require('fs');var path=require(_0xf675('0x5'));var rimraf=require(_0xf675('0x6'));var config=require('../../config/environment');var attributes=require(_0xf675('0x7'));module[_0xf675('0x8')]=function(_0x51c2ab,_0x30f9b3){return _0x51c2ab[_0xf675('0x9')](_0xf675('0xa'),attributes,{'tableName':_0xf675('0xb'),'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 d161722..ef87beb 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 _0xd882=['map','model','then','debug','GetTemplate','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','result','Template','findAll','options','raw','where','attributes','limit','include'];(function(_0x3bf0bc,_0x39732e){var _0x12f9e3=function(_0x258c0c){while(--_0x258c0c){_0x3bf0bc['push'](_0x3bf0bc['shift']());}};_0x12f9e3(++_0x39732e);}(_0xd882,0xfb));var _0x2d88=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0xd882[_0x20b29c];return _0x20d81b;};'use strict';var _=require(_0x2d88('0x0'));var util=require(_0x2d88('0x1'));var moment=require(_0x2d88('0x2'));var BPromise=require(_0x2d88('0x3'));var rs=require(_0x2d88('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d88('0x5'));var logger=require(_0x2d88('0x6'))(_0x2d88('0x7'));var config=require(_0x2d88('0x8'));var jayson=require(_0x2d88('0x9'));var client=jayson['client'][_0x2d88('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d771f,_0x501d7b,_0xdc8be2){return new BPromise(function(_0x29aa2d,_0x3500db){return client[_0x2d88('0xb')](_0x4d771f,_0xdc8be2)['then'](function(_0x54b2c5){logger[_0x2d88('0xc')]('Template,\x20%s,\x20%s',_0x501d7b,_0x2d88('0xd'));logger['debug'](_0x2d88('0xe'),_0x501d7b,_0x2d88('0xd'),JSON[_0x2d88('0xf')](_0x54b2c5));if(_0x54b2c5['error']){if(_0x54b2c5[_0x2d88('0x10')][_0x2d88('0x11')]===0x1f4){logger[_0x2d88('0x10')]('Template,\x20%s,\x20%s',_0x501d7b,_0x54b2c5['error'][_0x2d88('0x12')]);return _0x3500db(_0x54b2c5[_0x2d88('0x10')]['message']);}logger['error']('Template,\x20%s,\x20%s',_0x501d7b,_0x54b2c5[_0x2d88('0x10')]['message']);return _0x29aa2d(_0x54b2c5['error'][_0x2d88('0x12')]);}else{logger['info'](_0x2d88('0x13'),_0x501d7b,_0x2d88('0xd'));_0x29aa2d(_0x54b2c5[_0x2d88('0x14')]['message']);}})['catch'](function(_0xde4241){logger['error'](_0x2d88('0x13'),_0x501d7b,_0xde4241);_0x3500db(_0xde4241);});});}exports['GetTemplate']=function(_0x18aafb){var _0x50eee4=this;return new Promise(function(_0x491973,_0x10f345){return db[_0x2d88('0x15')][_0x2d88('0x16')]({'raw':_0x18aafb['options']?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x18')]===undefined?!![]:![]:!![],'where':_0x18aafb[_0x2d88('0x17')]?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x19')]||null:null,'attributes':_0x18aafb['options']?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x1a')]||null:null,'limit':_0x18aafb[_0x2d88('0x17')]?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x1b')]||null:null,'include':_0x18aafb['options']?_0x18aafb[_0x2d88('0x17')][_0x2d88('0x1c')]?_[_0x2d88('0x1d')](_0x18aafb['options'][_0x2d88('0x1c')],function(_0x3b76ba){return{'model':db[_0x3b76ba['model']],'as':_0x3b76ba['as'],'attributes':_0x3b76ba[_0x2d88('0x1a')],'include':_0x3b76ba[_0x2d88('0x1c')]?_[_0x2d88('0x1d')](_0x3b76ba[_0x2d88('0x1c')],function(_0x1d9ac6){return{'model':db[_0x1d9ac6[_0x2d88('0x1e')]],'as':_0x1d9ac6['as'],'attributes':_0x1d9ac6[_0x2d88('0x1a')],'include':_0x1d9ac6[_0x2d88('0x1c')]?_['map'](_0x1d9ac6[_0x2d88('0x1c')],function(_0x2f333e){return{'model':db[_0x2f333e[_0x2d88('0x1e')]],'as':_0x2f333e['as'],'attributes':_0x2f333e[_0x2d88('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2d88('0x1f')](function(_0x1210bb){logger[_0x2d88('0xc')]('GetTemplate',_0x18aafb);logger[_0x2d88('0x20')](_0x2d88('0x21'),_0x18aafb,JSON[_0x2d88('0xf')](_0x1210bb));_0x491973(_0x1210bb);})[_0x2d88('0x22')](function(_0x2d4aa7){logger['error'](_0x2d88('0x21'),_0x2d4aa7[_0x2d88('0x12')],_0x18aafb);_0x10f345(_0x50eee4['error'](0x1f4,_0x2d4aa7[_0x2d88('0x12')]));});});}; \ No newline at end of file +var _0x4998=['findAll','raw','where','options','attributes','limit','include','map','model','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetTemplate','Template'];(function(_0x10a2ea,_0x487cf2){var _0x347b66=function(_0x592edb){while(--_0x592edb){_0x10a2ea['push'](_0x10a2ea['shift']());}};_0x347b66(++_0x487cf2);}(_0x4998,0x89));var _0x8499=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x4998[_0x5a2285];return _0x48f6ed;};'use strict';var _=require(_0x8499('0x0'));var util=require('util');var moment=require(_0x8499('0x1'));var BPromise=require(_0x8499('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8499('0x3'))['db'];var utils=require(_0x8499('0x4'));var logger=require(_0x8499('0x5'))(_0x8499('0x6'));var config=require(_0x8499('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8499('0x8')][_0x8499('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a92a3,_0x57b0b5,_0x11ccd8){return new BPromise(function(_0x226b7f,_0x42dfd2){return client[_0x8499('0xa')](_0x2a92a3,_0x11ccd8)[_0x8499('0xb')](function(_0x5e8c65){logger['info'](_0x8499('0xc'),_0x57b0b5,_0x8499('0xd'));logger[_0x8499('0xe')](_0x8499('0xf'),_0x57b0b5,_0x8499('0xd'),JSON[_0x8499('0x10')](_0x5e8c65));if(_0x5e8c65[_0x8499('0x11')]){if(_0x5e8c65[_0x8499('0x11')]['code']===0x1f4){logger[_0x8499('0x11')](_0x8499('0xc'),_0x57b0b5,_0x5e8c65[_0x8499('0x11')][_0x8499('0x12')]);return _0x42dfd2(_0x5e8c65[_0x8499('0x11')]['message']);}logger[_0x8499('0x11')](_0x8499('0xc'),_0x57b0b5,_0x5e8c65[_0x8499('0x11')]['message']);return _0x226b7f(_0x5e8c65[_0x8499('0x11')][_0x8499('0x12')]);}else{logger[_0x8499('0x13')](_0x8499('0xc'),_0x57b0b5,'request\x20sent');_0x226b7f(_0x5e8c65['result']['message']);}})[_0x8499('0x14')](function(_0x1d62a9){logger[_0x8499('0x11')](_0x8499('0xc'),_0x57b0b5,_0x1d62a9);_0x42dfd2(_0x1d62a9);});});}exports[_0x8499('0x15')]=function(_0x26767e){var _0x63f715=this;return new Promise(function(_0x5903b6,_0x6b536c){return db[_0x8499('0x16')][_0x8499('0x17')]({'raw':_0x26767e['options']?_0x26767e['options'][_0x8499('0x18')]===undefined?!![]:![]:!![],'where':_0x26767e['options']?_0x26767e['options'][_0x8499('0x19')]||null:null,'attributes':_0x26767e[_0x8499('0x1a')]?_0x26767e['options'][_0x8499('0x1b')]||null:null,'limit':_0x26767e['options']?_0x26767e[_0x8499('0x1a')][_0x8499('0x1c')]||null:null,'include':_0x26767e[_0x8499('0x1a')]?_0x26767e[_0x8499('0x1a')][_0x8499('0x1d')]?_[_0x8499('0x1e')](_0x26767e['options'][_0x8499('0x1d')],function(_0xa8e6f1){return{'model':db[_0xa8e6f1[_0x8499('0x1f')]],'as':_0xa8e6f1['as'],'attributes':_0xa8e6f1[_0x8499('0x1b')],'include':_0xa8e6f1[_0x8499('0x1d')]?_[_0x8499('0x1e')](_0xa8e6f1[_0x8499('0x1d')],function(_0x10b172){return{'model':db[_0x10b172[_0x8499('0x1f')]],'as':_0x10b172['as'],'attributes':_0x10b172['attributes'],'include':_0x10b172[_0x8499('0x1d')]?_[_0x8499('0x1e')](_0x10b172[_0x8499('0x1d')],function(_0x41444d){return{'model':db[_0x41444d[_0x8499('0x1f')]],'as':_0x41444d['as'],'attributes':_0x41444d[_0x8499('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8499('0xb')](function(_0x31b6b5){logger[_0x8499('0x13')]('GetTemplate',_0x26767e);logger[_0x8499('0xe')](_0x8499('0x15'),_0x26767e,JSON[_0x8499('0x10')](_0x31b6b5));_0x5903b6(_0x31b6b5);})[_0x8499('0x14')](function(_0x144708){logger[_0x8499('0x11')](_0x8499('0x15'),_0x144708[_0x8499('0x12')],_0x26767e);_0x6b536c(_0x63f715[_0x8499('0x11')](0x1f4,_0x144708[_0x8499('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a2e797c..2064ce5 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 _0x8c43=['getAnyConditions','/:id/actions','create','post','addAllCondition','addAction','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions'];(function(_0x5ae9a7,_0x31a592){var _0x53caca=function(_0x1ea41d){while(--_0x1ea41d){_0x5ae9a7['push'](_0x5ae9a7['shift']());}};_0x53caca(++_0x31a592);}(_0x8c43,0x1e5));var _0x38c4=function(_0x2095cf,_0x12058b){_0x2095cf=_0x2095cf-0x0;var _0x293cba=_0x8c43[_0x2095cf];return _0x293cba;};'use strict';var multer=require(_0x38c4('0x0'));var util=require(_0x38c4('0x1'));var path=require(_0x38c4('0x2'));var timeout=require(_0x38c4('0x3'));var express=require(_0x38c4('0x4'));var router=express['Router']();var fs_extra=require(_0x38c4('0x5'));var auth=require(_0x38c4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x38c4('0x7'));router[_0x38c4('0x8')]('/',auth[_0x38c4('0x9')](),controller['index']);router[_0x38c4('0x8')](_0x38c4('0xa'),auth[_0x38c4('0x9')](),controller[_0x38c4('0xb')]);router[_0x38c4('0x8')](_0x38c4('0xc'),auth[_0x38c4('0x9')](),controller[_0x38c4('0xd')]);router['get'](_0x38c4('0xe'),auth['isAuthenticated'](),controller[_0x38c4('0xf')]);router[_0x38c4('0x8')](_0x38c4('0x10'),auth[_0x38c4('0x9')](),controller['getActions']);router['post']('/',auth[_0x38c4('0x9')](),controller[_0x38c4('0x11')]);router[_0x38c4('0x12')]('/:id/all_conditions',auth[_0x38c4('0x9')](),controller[_0x38c4('0x13')]);router[_0x38c4('0x12')](_0x38c4('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0x38c4('0x14')]);router['put'](_0x38c4('0xa'),auth['isAuthenticated'](),controller[_0x38c4('0x15')]);router[_0x38c4('0x16')](_0x38c4('0xa'),auth[_0x38c4('0x9')](),controller[_0x38c4('0x17')]);module[_0x38c4('0x18')]=router; \ No newline at end of file +var _0xbf56=['put','update','delete','destroy','exports','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','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','addAction'];(function(_0x3031d3,_0x5b5637){var _0x4b4de9=function(_0x5bf828){while(--_0x5bf828){_0x3031d3['push'](_0x3031d3['shift']());}};_0x4b4de9(++_0x5b5637);}(_0xbf56,0x12e));var _0x6bf5=function(_0x564c7a,_0x2ef21e){_0x564c7a=_0x564c7a-0x0;var _0x1f3b52=_0xbf56[_0x564c7a];return _0x1f3b52;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6bf5('0x0'));var router=express[_0x6bf5('0x1')]();var fs_extra=require(_0x6bf5('0x2'));var auth=require(_0x6bf5('0x3'));var interaction=require(_0x6bf5('0x4'));var config=require(_0x6bf5('0x5'));var controller=require(_0x6bf5('0x6'));router[_0x6bf5('0x7')]('/',auth[_0x6bf5('0x8')](),controller[_0x6bf5('0x9')]);router[_0x6bf5('0x7')](_0x6bf5('0xa'),auth['isAuthenticated'](),controller[_0x6bf5('0xb')]);router[_0x6bf5('0x7')](_0x6bf5('0xc'),auth['isAuthenticated'](),controller[_0x6bf5('0xd')]);router[_0x6bf5('0x7')](_0x6bf5('0xe'),auth[_0x6bf5('0x8')](),controller[_0x6bf5('0xf')]);router[_0x6bf5('0x7')]('/:id/actions',auth[_0x6bf5('0x8')](),controller[_0x6bf5('0x10')]);router[_0x6bf5('0x11')]('/',auth['isAuthenticated'](),controller[_0x6bf5('0x12')]);router[_0x6bf5('0x11')](_0x6bf5('0xc'),auth[_0x6bf5('0x8')](),controller[_0x6bf5('0x13')]);router['post'](_0x6bf5('0xe'),auth[_0x6bf5('0x8')](),controller[_0x6bf5('0x14')]);router[_0x6bf5('0x11')]('/:id/actions',auth[_0x6bf5('0x8')](),controller[_0x6bf5('0x15')]);router[_0x6bf5('0x16')](_0x6bf5('0xa'),auth[_0x6bf5('0x8')](),controller[_0x6bf5('0x17')]);router[_0x6bf5('0x18')](_0x6bf5('0xa'),auth[_0x6bf5('0x8')](),controller[_0x6bf5('0x19')]);module[_0x6bf5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6f240de..51e9ba0 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 _0x317a=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5ed036,_0x433b87){var _0x4b9180=function(_0x34c6c7){while(--_0x34c6c7){_0x5ed036['push'](_0x5ed036['shift']());}};_0x4b9180(++_0x433b87);}(_0x317a,0x1d5));var _0xa317=function(_0x4cecf8,_0x522f97){_0x4cecf8=_0x4cecf8-0x0;var _0x311797=_0x317a[_0x4cecf8];return _0x311797;};'use strict';var Sequelize=require(_0xa317('0x0'));module[_0xa317('0x1')]={'name':{'type':Sequelize[_0xa317('0x2')]},'channel':{'type':Sequelize[_0xa317('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa317('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b6b=['STRING','BOOLEAN','exports'];(function(_0x543389,_0x4addd5){var _0x584492=function(_0x137d0d){while(--_0x137d0d){_0x543389['push'](_0x543389['shift']());}};_0x584492(++_0x4addd5);}(_0x4b6b,0x1b2));var _0xb4b6=function(_0x52fe64,_0x2374cf){_0x52fe64=_0x52fe64-0x0;var _0x4b63d4=_0x4b6b[_0x52fe64];return _0x4b63d4;};'use strict';var Sequelize=require('sequelize');module[_0xb4b6('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb4b6('0x1')]},'status':{'type':Sequelize[_0xb4b6('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index c2fa71f..31614e4 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 _0x6537=['fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Trigger','includeAll','include','findAll','rows','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','TriggerAnyId','order','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','get','Triggers','UserProfileResource','then','end','error','stack','name','send','map','rawAttributes'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x6537,0x87));var _0x7653=function(_0x401004,_0x5061d5){_0x401004=_0x401004-0x0;var _0x228719=_0x6537[_0x401004];return _0x228719;};'use strict';var emlformat=require(_0x7653('0x0'));var rimraf=require(_0x7653('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7653('0x2'));var rp=require(_0x7653('0x3'));var moment=require(_0x7653('0x4'));var BPromise=require(_0x7653('0x5'));var Mustache=require(_0x7653('0x6'));var util=require(_0x7653('0x7'));var path=require(_0x7653('0x8'));var sox=require(_0x7653('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7653('0xa'));var _=require(_0x7653('0xb'));var squel=require(_0x7653('0xc'));var crypto=require('crypto');var jsforce=require(_0x7653('0xd'));var deskjs=require(_0x7653('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7653('0xf'));var Papa=require(_0x7653('0x10'));var Redis=require(_0x7653('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7653('0x12'));var as=require(_0x7653('0x13'));var hardwareService=require(_0x7653('0x14'));var logger=require(_0x7653('0x15'))(_0x7653('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x257f73,_0x2559e5){_0x2559e5=_0x2559e5||0xcc;return function(_0x3f43ae){if(_0x3f43ae){return _0x257f73[_0x7653('0x17')](_0x2559e5);}return _0x257f73['status'](_0x2559e5)['end']();};}function respondWithResult(_0x2fbcf1,_0x509edb){_0x509edb=_0x509edb||0xc8;return function(_0x310cf1){if(_0x310cf1){return _0x2fbcf1[_0x7653('0x18')](_0x509edb)[_0x7653('0x19')](_0x310cf1);}};}function respondWithFilteredResult(_0x23db69,_0x409f7c){return function(_0x32e35e){if(_0x32e35e){var _0x200ba7=typeof _0x409f7c[_0x7653('0x1a')]==='undefined'&&typeof _0x409f7c[_0x7653('0x1b')]===_0x7653('0x1c');var _0x7fe3de=_0x32e35e['count'];var _0x2ae953=_0x200ba7?0x0:_0x409f7c['offset'];var _0x9de27=_0x200ba7?_0x32e35e['count']:_0x409f7c[_0x7653('0x1a')]+_0x409f7c[_0x7653('0x1b')];var _0x5f1bec;if(_0x9de27>=_0x7fe3de){_0x9de27=_0x7fe3de;_0x5f1bec=0xc8;}else{_0x5f1bec=0xce;}_0x23db69['status'](_0x5f1bec);return _0x23db69[_0x7653('0x1d')](_0x7653('0x1e'),_0x2ae953+'-'+_0x9de27+'/'+_0x7fe3de)[_0x7653('0x19')](_0x32e35e);}return null;};}function patchUpdates(_0x337909){return function(_0x465f4d){try{jsonpatch[_0x7653('0x1f')](_0x465f4d,_0x337909,!![]);}catch(_0x38f964){return BPromise[_0x7653('0x20')](_0x38f964);}return _0x465f4d[_0x7653('0x21')]();};}function saveUpdates(_0x3b976b,_0x50f684){return function(_0x3d18f7){if(_0x3d18f7){return _0x3d18f7[_0x7653('0x22')](_0x3b976b)['then'](function(_0x45d498){return _0x45d498;});}return null;};}function removeEntity(_0x266df9,_0x46d323){return function(_0x291a4f){if(_0x291a4f){return _0x291a4f[_0x7653('0x23')]()['then'](function(){var _0x1f8771=_0x291a4f[_0x7653('0x24')]({'plain':!![]});var _0x27c840=_0x7653('0x25');return db[_0x7653('0x26')][_0x7653('0x23')]({'where':{'type':_0x27c840,'resourceId':_0x1f8771['id']}})[_0x7653('0x27')](function(){return _0x291a4f;});})[_0x7653('0x27')](function(){_0x266df9[_0x7653('0x18')](0xcc)[_0x7653('0x28')]();});}};}function handleEntityNotFound(_0xf718f,_0x2dae7f){return function(_0x3a64d6){if(!_0x3a64d6){_0xf718f[_0x7653('0x17')](0x194);}return _0x3a64d6;};}function handleError(_0xc16391,_0x4b81c3){_0x4b81c3=_0x4b81c3||0x1f4;return function(_0x672fb2){logger[_0x7653('0x29')](_0x672fb2[_0x7653('0x2a')]);if(_0x672fb2[_0x7653('0x2b')]){delete _0x672fb2['name'];}_0xc16391[_0x7653('0x18')](_0x4b81c3)[_0x7653('0x2c')](_0x672fb2);};}exports['index']=function(_0x83009c,_0x3b5ea5){var _0x482d41={},_0x4ed060={},_0x387bf4={'count':0x0,'rows':[]};var _0x1a9b63=_[_0x7653('0x2d')](db['Trigger'][_0x7653('0x2e')],function(_0x11173b){return{'name':_0x11173b[_0x7653('0x2f')],'type':_0x11173b[_0x7653('0x30')]['key']};});_0x4ed060[_0x7653('0x31')]=_[_0x7653('0x2d')](_0x1a9b63,_0x7653('0x2b'));_0x4ed060[_0x7653('0x32')]=_['keys'](_0x83009c[_0x7653('0x32')]);_0x4ed060[_0x7653('0x33')]=_[_0x7653('0x34')](_0x4ed060['model'],_0x4ed060[_0x7653('0x32')]);_0x482d41[_0x7653('0x35')]=_['intersection'](_0x4ed060[_0x7653('0x31')],qs['fields'](_0x83009c[_0x7653('0x32')][_0x7653('0x36')]));_0x482d41[_0x7653('0x35')]=_0x482d41['attributes'][_0x7653('0x37')]?_0x482d41[_0x7653('0x35')]:_0x4ed060[_0x7653('0x31')];if(!_0x83009c[_0x7653('0x32')][_0x7653('0x38')](_0x7653('0x39'))){_0x482d41[_0x7653('0x1b')]=qs['limit'](_0x83009c[_0x7653('0x32')][_0x7653('0x1b')]);_0x482d41['offset']=qs[_0x7653('0x1a')](_0x83009c[_0x7653('0x32')]['offset']);}_0x482d41['order']=qs[_0x7653('0x3a')](_0x83009c[_0x7653('0x32')][_0x7653('0x3a')]);_0x482d41[_0x7653('0x3b')]=qs[_0x7653('0x33')](_[_0x7653('0x3c')](_0x83009c['query'],_0x4ed060['filters']),_0x1a9b63);if(_0x83009c[_0x7653('0x32')][_0x7653('0x3d')]){_0x482d41[_0x7653('0x3b')]=_['merge'](_0x482d41[_0x7653('0x3b')],{'$or':_[_0x7653('0x2d')](_0x1a9b63,function(_0x44324a){if(_0x44324a['type']!==_0x7653('0x3e')){var _0x3d5a7d={};_0x3d5a7d[_0x44324a['name']]={'$like':'%'+_0x83009c[_0x7653('0x32')][_0x7653('0x3d')]+'%'};return _0x3d5a7d;}})});}_0x482d41=_[_0x7653('0x3f')]({},_0x482d41,_0x83009c[_0x7653('0x40')]);var _0x29c110={'where':_0x482d41[_0x7653('0x3b')]};return db[_0x7653('0x41')]['count'](_0x29c110)[_0x7653('0x27')](function(_0x4b0bd4){_0x387bf4['count']=_0x4b0bd4;if(_0x83009c[_0x7653('0x32')][_0x7653('0x42')]){_0x482d41[_0x7653('0x43')]=[{'all':!![]}];}return db[_0x7653('0x41')][_0x7653('0x44')](_0x482d41);})[_0x7653('0x27')](function(_0x143efe){_0x387bf4[_0x7653('0x45')]=_0x143efe;return _0x387bf4;})[_0x7653('0x27')](respondWithFilteredResult(_0x3b5ea5,_0x482d41))[_0x7653('0x46')](handleError(_0x3b5ea5,null));};exports['show']=function(_0x231f9d,_0x3e012e){var _0x182b7d={'raw':![],'where':{'id':_0x231f9d[_0x7653('0x47')]['id']}},_0x23a39f={};_0x23a39f[_0x7653('0x31')]=_[_0x7653('0x48')](db['Trigger']['rawAttributes']);_0x23a39f['query']=_[_0x7653('0x48')](_0x231f9d[_0x7653('0x32')]);_0x23a39f[_0x7653('0x33')]=_[_0x7653('0x34')](_0x23a39f[_0x7653('0x31')],_0x23a39f[_0x7653('0x32')]);_0x182b7d[_0x7653('0x35')]=_[_0x7653('0x34')](_0x23a39f[_0x7653('0x31')],qs['fields'](_0x231f9d['query'][_0x7653('0x36')]));_0x182b7d['attributes']=_0x182b7d[_0x7653('0x35')][_0x7653('0x37')]?_0x182b7d[_0x7653('0x35')]:_0x23a39f['model'];if(_0x231f9d[_0x7653('0x32')][_0x7653('0x42')]){_0x182b7d[_0x7653('0x43')]=[{'all':!![]}];}_0x182b7d=_['merge']({},_0x182b7d,_0x231f9d['options']);return db[_0x7653('0x41')]['find'](_0x182b7d)[_0x7653('0x27')](handleEntityNotFound(_0x3e012e,null))[_0x7653('0x27')](respondWithResult(_0x3e012e,null))['catch'](handleError(_0x3e012e,null));};exports[_0x7653('0x49')]=function(_0x280ea0,_0x538bb8){return db[_0x7653('0x41')][_0x7653('0x49')](_0x280ea0[_0x7653('0x4a')],{})[_0x7653('0x27')](function(_0x36da0e){var _0x304a22=_0x280ea0['user']['get']({'plain':!![]});if(!_0x304a22)throw new Error(_0x7653('0x4b'));if(_0x304a22[_0x7653('0x4c')]==='user'){var _0x225f76=_0x36da0e[_0x7653('0x24')]({'plain':!![]});var _0x342808=_0x7653('0x25');return db['UserProfileSection'][_0x7653('0x4d')]({'where':{'name':_0x342808,'userProfileId':_0x304a22[_0x7653('0x4e')]},'raw':!![]})[_0x7653('0x27')](function(_0x1efd86){if(_0x1efd86&&_0x1efd86[_0x7653('0x4f')]===0x0){return db[_0x7653('0x26')][_0x7653('0x49')]({'name':_0x225f76[_0x7653('0x2b')],'resourceId':_0x225f76['id'],'type':_0x1efd86[_0x7653('0x2b')],'sectionId':_0x1efd86['id']},{})[_0x7653('0x27')](function(){return _0x36da0e;});}else{return _0x36da0e;}})['catch'](function(_0x5260d8){logger[_0x7653('0x29')](_0x7653('0x50'),_0x5260d8);throw _0x5260d8;});}return _0x36da0e;})[_0x7653('0x27')](respondWithResult(_0x538bb8,0xc9))[_0x7653('0x46')](handleError(_0x538bb8,null));};exports[_0x7653('0x22')]=function(_0x1b0882,_0x460f08){if(_0x1b0882[_0x7653('0x4a')]['id']){delete _0x1b0882[_0x7653('0x4a')]['id'];}return db[_0x7653('0x41')]['find']({'where':{'id':_0x1b0882[_0x7653('0x47')]['id']}})['then'](handleEntityNotFound(_0x460f08,null))['then'](saveUpdates(_0x1b0882['body'],null))[_0x7653('0x27')](respondWithResult(_0x460f08,null))[_0x7653('0x46')](handleError(_0x460f08,null));};exports[_0x7653('0x23')]=function(_0x34c503,_0x5cb4df){return db['Trigger']['find']({'where':{'id':_0x34c503['params']['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x5cb4df,null))['then'](removeEntity(_0x5cb4df,null))[_0x7653('0x46')](handleError(_0x5cb4df,null));};exports[_0x7653('0x51')]=function(_0x2f3ef7,_0x20897c,_0x23b1af){if(_0x2f3ef7[_0x7653('0x4a')]['id']){delete _0x2f3ef7[_0x7653('0x4a')]['id'];}return db['Trigger'][_0x7653('0x4d')]({'where':{'id':_0x2f3ef7[_0x7653('0x47')]['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x20897c,null))[_0x7653('0x27')](function(_0x2c3f05){if(_0x2c3f05){_0x2f3ef7[_0x7653('0x4a')]['TriggerAllId']=_0x2c3f05['id'];return db[_0x7653('0x52')][_0x7653('0x49')](_0x2f3ef7['body']);}})[_0x7653('0x27')](respondWithResult(_0x20897c,null))[_0x7653('0x46')](handleError(_0x20897c,null));};exports['addAnyCondition']=function(_0x40a19c,_0x44e994,_0xe79f99){if(_0x40a19c['body']['id']){delete _0x40a19c['body']['id'];}return db['Trigger'][_0x7653('0x4d')]({'where':{'id':_0x40a19c[_0x7653('0x47')]['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x44e994,null))[_0x7653('0x27')](function(_0x533969){if(_0x533969){_0x40a19c[_0x7653('0x4a')][_0x7653('0x53')]=_0x533969['id'];return db[_0x7653('0x52')][_0x7653('0x49')](_0x40a19c[_0x7653('0x4a')]);}})[_0x7653('0x27')](respondWithResult(_0x44e994,null))[_0x7653('0x46')](handleError(_0x44e994,null));};exports['getAllConditions']=function(_0x55cd52,_0x47c8af,_0xf0d7a4){var _0x4ff06c={};var _0x59d54e={};var _0x263643;var _0x169bcb;return db[_0x7653('0x41')]['findOne']({'where':{'id':_0x55cd52['params']['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x47c8af,null))['then'](function(_0x17c7cb){if(_0x17c7cb){_0x263643=_0x17c7cb;_0x59d54e['model']=_[_0x7653('0x48')](db[_0x7653('0x52')][_0x7653('0x2e')]);_0x59d54e[_0x7653('0x32')]=_['keys'](_0x55cd52[_0x7653('0x32')]);_0x59d54e[_0x7653('0x33')]=_[_0x7653('0x34')](_0x59d54e['model'],_0x59d54e[_0x7653('0x32')]);_0x4ff06c['attributes']=_[_0x7653('0x34')](_0x59d54e['model'],qs[_0x7653('0x36')](_0x55cd52[_0x7653('0x32')][_0x7653('0x36')]));_0x4ff06c[_0x7653('0x35')]=_0x4ff06c[_0x7653('0x35')][_0x7653('0x37')]?_0x4ff06c['attributes']:_0x59d54e[_0x7653('0x31')];_0x4ff06c[_0x7653('0x54')]=qs[_0x7653('0x3a')](_0x55cd52['query'][_0x7653('0x3a')]);_0x4ff06c['where']=qs[_0x7653('0x33')](_['pick'](_0x55cd52['query'],_0x59d54e[_0x7653('0x33')]));if(_0x55cd52['query'][_0x7653('0x3d')]){_0x4ff06c[_0x7653('0x3b')]=_[_0x7653('0x3f')](_0x4ff06c[_0x7653('0x3b')],{'$or':_[_0x7653('0x2d')](_0x4ff06c[_0x7653('0x35')],function(_0x396b7c){var _0xf20cbd={};_0xf20cbd[_0x396b7c]={'$like':'%'+_0x55cd52[_0x7653('0x32')]['filter']+'%'};return _0xf20cbd;})});}_0x4ff06c=_[_0x7653('0x3f')]({},_0x4ff06c,_0x55cd52[_0x7653('0x40')]);return _0x263643[_0x7653('0x55')](_0x4ff06c);}})['then'](function(_0x518811){if(_0x518811){_0x169bcb=_0x518811[_0x7653('0x37')];if(!_0x55cd52[_0x7653('0x32')][_0x7653('0x38')](_0x7653('0x39'))){_0x4ff06c[_0x7653('0x1b')]=qs[_0x7653('0x1b')](_0x55cd52[_0x7653('0x32')][_0x7653('0x1b')]);_0x4ff06c[_0x7653('0x1a')]=qs[_0x7653('0x1a')](_0x55cd52[_0x7653('0x32')][_0x7653('0x1a')]);}return _0x263643[_0x7653('0x55')](_0x4ff06c);}})[_0x7653('0x27')](function(_0x5d7549){if(_0x5d7549){return _0x5d7549?{'count':_0x169bcb,'rows':_0x5d7549}:null;}})[_0x7653('0x27')](respondWithResult(_0x47c8af,null))[_0x7653('0x46')](handleError(_0x47c8af,null));};exports['getAnyConditions']=function(_0x1c450,_0x324877,_0x147242){var _0x56e18f={};var _0x47804a={};var _0x1a395c;var _0x54aa88;return db[_0x7653('0x41')][_0x7653('0x56')]({'where':{'id':_0x1c450[_0x7653('0x47')]['id']}})['then'](handleEntityNotFound(_0x324877,null))[_0x7653('0x27')](function(_0x5a5257){if(_0x5a5257){_0x1a395c=_0x5a5257;_0x47804a[_0x7653('0x31')]=_[_0x7653('0x48')](db[_0x7653('0x52')][_0x7653('0x2e')]);_0x47804a[_0x7653('0x32')]=_[_0x7653('0x48')](_0x1c450[_0x7653('0x32')]);_0x47804a[_0x7653('0x33')]=_[_0x7653('0x34')](_0x47804a['model'],_0x47804a[_0x7653('0x32')]);_0x56e18f[_0x7653('0x35')]=_[_0x7653('0x34')](_0x47804a['model'],qs[_0x7653('0x36')](_0x1c450[_0x7653('0x32')]['fields']));_0x56e18f['attributes']=_0x56e18f['attributes'][_0x7653('0x37')]?_0x56e18f[_0x7653('0x35')]:_0x47804a[_0x7653('0x31')];_0x56e18f['order']=qs['sort'](_0x1c450[_0x7653('0x32')][_0x7653('0x3a')]);_0x56e18f['where']=qs['filters'](_[_0x7653('0x3c')](_0x1c450[_0x7653('0x32')],_0x47804a['filters']));if(_0x1c450[_0x7653('0x32')][_0x7653('0x3d')]){_0x56e18f['where']=_['merge'](_0x56e18f[_0x7653('0x3b')],{'$or':_[_0x7653('0x2d')](_0x56e18f[_0x7653('0x35')],function(_0x121f0f){var _0x4ac0da={};_0x4ac0da[_0x121f0f]={'$like':'%'+_0x1c450['query'][_0x7653('0x3d')]+'%'};return _0x4ac0da;})});}_0x56e18f=_['merge']({},_0x56e18f,_0x1c450[_0x7653('0x40')]);return _0x1a395c['getAnyConditions'](_0x56e18f);}})[_0x7653('0x27')](function(_0x238ecb){if(_0x238ecb){_0x54aa88=_0x238ecb['length'];if(!_0x1c450[_0x7653('0x32')][_0x7653('0x38')](_0x7653('0x39'))){_0x56e18f[_0x7653('0x1b')]=qs[_0x7653('0x1b')](_0x1c450[_0x7653('0x32')][_0x7653('0x1b')]);_0x56e18f[_0x7653('0x1a')]=qs[_0x7653('0x1a')](_0x1c450[_0x7653('0x32')][_0x7653('0x1a')]);}return _0x1a395c[_0x7653('0x57')](_0x56e18f);}})[_0x7653('0x27')](function(_0x53fe64){if(_0x53fe64){return _0x53fe64?{'count':_0x54aa88,'rows':_0x53fe64}:null;}})['then'](respondWithResult(_0x324877,null))[_0x7653('0x46')](handleError(_0x324877,null));};exports[_0x7653('0x58')]=function(_0x448edc,_0x154dbd,_0x5e8355){if(_0x448edc['body']['id']){delete _0x448edc[_0x7653('0x4a')]['id'];}return db[_0x7653('0x41')][_0x7653('0x4d')]({'where':{'id':_0x448edc[_0x7653('0x47')]['id']}})[_0x7653('0x27')](handleEntityNotFound(_0x154dbd,null))['then'](function(_0x40ebc7){if(_0x40ebc7){_0x448edc[_0x7653('0x4a')]['TriggerId']=_0x40ebc7['id'];return db[_0x7653('0x59')][_0x7653('0x49')](_0x448edc[_0x7653('0x4a')]);}})['then'](respondWithResult(_0x154dbd,null))['catch'](handleError(_0x154dbd,null));};exports[_0x7653('0x5a')]=function(_0x29a2fb,_0x11d00a,_0x337037){var _0x1ccaf3={};var _0x212150={};var _0x8bf5de;var _0xb2d199;return db['Trigger']['findOne']({'where':{'id':_0x29a2fb[_0x7653('0x47')]['id']}})['then'](handleEntityNotFound(_0x11d00a,null))[_0x7653('0x27')](function(_0x341fb8){if(_0x341fb8){_0x8bf5de=_0x341fb8;_0x212150[_0x7653('0x31')]=_[_0x7653('0x48')](db[_0x7653('0x59')]['rawAttributes']);_0x212150['query']=_[_0x7653('0x48')](_0x29a2fb[_0x7653('0x32')]);_0x212150['filters']=_[_0x7653('0x34')](_0x212150[_0x7653('0x31')],_0x212150[_0x7653('0x32')]);_0x1ccaf3[_0x7653('0x35')]=_[_0x7653('0x34')](_0x212150[_0x7653('0x31')],qs[_0x7653('0x36')](_0x29a2fb[_0x7653('0x32')]['fields']));_0x1ccaf3[_0x7653('0x35')]=_0x1ccaf3['attributes'][_0x7653('0x37')]?_0x1ccaf3[_0x7653('0x35')]:_0x212150[_0x7653('0x31')];_0x1ccaf3[_0x7653('0x54')]=qs[_0x7653('0x3a')](_0x29a2fb[_0x7653('0x32')]['sort']);_0x1ccaf3['where']=qs[_0x7653('0x33')](_[_0x7653('0x3c')](_0x29a2fb[_0x7653('0x32')],_0x212150['filters']));if(_0x29a2fb[_0x7653('0x32')][_0x7653('0x3d')]){_0x1ccaf3[_0x7653('0x3b')]=_[_0x7653('0x3f')](_0x1ccaf3[_0x7653('0x3b')],{'$or':_[_0x7653('0x2d')](_0x1ccaf3['attributes'],function(_0x271fcc){var _0x57b327={};_0x57b327[_0x271fcc]={'$like':'%'+_0x29a2fb[_0x7653('0x32')][_0x7653('0x3d')]+'%'};return _0x57b327;})});}_0x1ccaf3=_[_0x7653('0x3f')]({},_0x1ccaf3,_0x29a2fb[_0x7653('0x40')]);return _0x8bf5de['getActions'](_0x1ccaf3);}})['then'](function(_0x13e8d6){if(_0x13e8d6){_0xb2d199=_0x13e8d6[_0x7653('0x37')];if(!_0x29a2fb['query'][_0x7653('0x38')](_0x7653('0x39'))){_0x1ccaf3[_0x7653('0x1b')]=qs[_0x7653('0x1b')](_0x29a2fb[_0x7653('0x32')][_0x7653('0x1b')]);_0x1ccaf3[_0x7653('0x1a')]=qs[_0x7653('0x1a')](_0x29a2fb[_0x7653('0x32')][_0x7653('0x1a')]);}return _0x8bf5de[_0x7653('0x5a')](_0x1ccaf3);}})['then'](function(_0x2f93b4){if(_0x2f93b4){return _0x2f93b4?{'count':_0xb2d199,'rows':_0x2f93b4}:null;}})['then'](respondWithResult(_0x11d00a,null))[_0x7653('0x46')](handleError(_0x11d00a,null));}; \ No newline at end of file +var _0xdd86=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','rawAttributes','filter','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','update','destroy','then','get','Triggers','stack','send','index','map','Trigger','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0xdd86,0x190));var _0x6dd8=function(_0x2bd20a,_0x53be0d){_0x2bd20a=_0x2bd20a-0x0;var _0x199a13=_0xdd86[_0x2bd20a];return _0x199a13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dd8('0x0'));var zipdir=require(_0x6dd8('0x1'));var jsonpatch=require(_0x6dd8('0x2'));var rp=require(_0x6dd8('0x3'));var moment=require(_0x6dd8('0x4'));var BPromise=require(_0x6dd8('0x5'));var Mustache=require(_0x6dd8('0x6'));var util=require(_0x6dd8('0x7'));var path=require(_0x6dd8('0x8'));var sox=require(_0x6dd8('0x9'));var csv=require('to-csv');var ejs=require(_0x6dd8('0xa'));var fs=require('fs');var fs_extra=require(_0x6dd8('0xb'));var _=require(_0x6dd8('0xc'));var squel=require(_0x6dd8('0xd'));var crypto=require('crypto');var jsforce=require(_0x6dd8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6dd8('0xf'));var Papa=require(_0x6dd8('0x10'));var Redis=require(_0x6dd8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6dd8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dd8('0x13'))(_0x6dd8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6dd8('0x15'));var db=require(_0x6dd8('0x16'))['db'];function respondWithStatusCode(_0x38b5e6,_0x2b78fd){_0x2b78fd=_0x2b78fd||0xcc;return function(_0x3c50e8){if(_0x3c50e8){return _0x38b5e6[_0x6dd8('0x17')](_0x2b78fd);}return _0x38b5e6[_0x6dd8('0x18')](_0x2b78fd)[_0x6dd8('0x19')]();};}function respondWithResult(_0x4858e5,_0x31a080){_0x31a080=_0x31a080||0xc8;return function(_0x1c5123){if(_0x1c5123){return _0x4858e5[_0x6dd8('0x18')](_0x31a080)['json'](_0x1c5123);}};}function respondWithFilteredResult(_0x67a4f0,_0x47ea8d){return function(_0x5aea29){if(_0x5aea29){var _0x4e5950=typeof _0x47ea8d['offset']===_0x6dd8('0x1a')&&typeof _0x47ea8d[_0x6dd8('0x1b')]===_0x6dd8('0x1a');var _0x3aed3c=_0x5aea29[_0x6dd8('0x1c')];var _0x619321=_0x4e5950?0x0:_0x47ea8d['offset'];var _0x5d28ef=_0x4e5950?_0x5aea29[_0x6dd8('0x1c')]:_0x47ea8d[_0x6dd8('0x1d')]+_0x47ea8d[_0x6dd8('0x1b')];var _0x4a6302;if(_0x5d28ef>=_0x3aed3c){_0x5d28ef=_0x3aed3c;_0x4a6302=0xc8;}else{_0x4a6302=0xce;}_0x67a4f0['status'](_0x4a6302);return _0x67a4f0[_0x6dd8('0x1e')](_0x6dd8('0x1f'),_0x619321+'-'+_0x5d28ef+'/'+_0x3aed3c)[_0x6dd8('0x20')](_0x5aea29);}return null;};}function patchUpdates(_0x2b5d9f){return function(_0x2f9484){try{jsonpatch[_0x6dd8('0x21')](_0x2f9484,_0x2b5d9f,!![]);}catch(_0x3862af){return BPromise['reject'](_0x3862af);}return _0x2f9484['save']();};}function saveUpdates(_0x3d3c31,_0x580f6e){return function(_0x53e689){if(_0x53e689){return _0x53e689[_0x6dd8('0x22')](_0x3d3c31)['then'](function(_0x33308c){return _0x33308c;});}return null;};}function removeEntity(_0x76b9c5,_0x2f7c12){return function(_0x1cf050){if(_0x1cf050){return _0x1cf050[_0x6dd8('0x23')]()[_0x6dd8('0x24')](function(){var _0x337ff3=_0x1cf050[_0x6dd8('0x25')]({'plain':!![]});var _0x352362=_0x6dd8('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x352362,'resourceId':_0x337ff3['id']}})[_0x6dd8('0x24')](function(){return _0x1cf050;});})[_0x6dd8('0x24')](function(){_0x76b9c5[_0x6dd8('0x18')](0xcc)[_0x6dd8('0x19')]();});}};}function handleEntityNotFound(_0x44e9fd,_0xa46b7){return function(_0x2d40b4){if(!_0x2d40b4){_0x44e9fd['sendStatus'](0x194);}return _0x2d40b4;};}function handleError(_0x32cd41,_0x20bf02){_0x20bf02=_0x20bf02||0x1f4;return function(_0x278d87){logger['error'](_0x278d87[_0x6dd8('0x27')]);if(_0x278d87['name']){delete _0x278d87['name'];}_0x32cd41[_0x6dd8('0x18')](_0x20bf02)[_0x6dd8('0x28')](_0x278d87);};}exports[_0x6dd8('0x29')]=function(_0x1581d0,_0x3d691a){var _0x4c2d55={},_0x1eefeb={},_0x19b0e0={'count':0x0,'rows':[]};var _0x310c68=_[_0x6dd8('0x2a')](db[_0x6dd8('0x2b')]['rawAttributes'],function(_0x3e34ed){return{'name':_0x3e34ed['fieldName'],'type':_0x3e34ed[_0x6dd8('0x2c')][_0x6dd8('0x2d')]};});_0x1eefeb[_0x6dd8('0x2e')]=_[_0x6dd8('0x2a')](_0x310c68,_0x6dd8('0x2f'));_0x1eefeb[_0x6dd8('0x30')]=_[_0x6dd8('0x31')](_0x1581d0['query']);_0x1eefeb[_0x6dd8('0x32')]=_[_0x6dd8('0x33')](_0x1eefeb[_0x6dd8('0x2e')],_0x1eefeb[_0x6dd8('0x30')]);_0x4c2d55[_0x6dd8('0x34')]=_['intersection'](_0x1eefeb['model'],qs['fields'](_0x1581d0[_0x6dd8('0x30')][_0x6dd8('0x35')]));_0x4c2d55[_0x6dd8('0x34')]=_0x4c2d55['attributes'][_0x6dd8('0x36')]?_0x4c2d55[_0x6dd8('0x34')]:_0x1eefeb[_0x6dd8('0x2e')];if(!_0x1581d0['query']['hasOwnProperty'](_0x6dd8('0x37'))){_0x4c2d55[_0x6dd8('0x1b')]=qs['limit'](_0x1581d0['query'][_0x6dd8('0x1b')]);_0x4c2d55[_0x6dd8('0x1d')]=qs[_0x6dd8('0x1d')](_0x1581d0['query'][_0x6dd8('0x1d')]);}_0x4c2d55[_0x6dd8('0x38')]=qs[_0x6dd8('0x39')](_0x1581d0['query']['sort']);_0x4c2d55['where']=qs['filters'](_[_0x6dd8('0x3a')](_0x1581d0[_0x6dd8('0x30')],_0x1eefeb[_0x6dd8('0x32')]),_0x310c68);if(_0x1581d0[_0x6dd8('0x30')]['filter']){_0x4c2d55[_0x6dd8('0x3b')]=_[_0x6dd8('0x3c')](_0x4c2d55[_0x6dd8('0x3b')],{'$or':_[_0x6dd8('0x2a')](_0x310c68,function(_0x4fab1b){if(_0x4fab1b['type']!==_0x6dd8('0x3d')){var _0x21178e={};_0x21178e[_0x4fab1b[_0x6dd8('0x2f')]]={'$like':'%'+_0x1581d0['query']['filter']+'%'};return _0x21178e;}})});}_0x4c2d55=_['merge']({},_0x4c2d55,_0x1581d0[_0x6dd8('0x3e')]);var _0x49e196={'where':_0x4c2d55[_0x6dd8('0x3b')]};return db[_0x6dd8('0x2b')][_0x6dd8('0x1c')](_0x49e196)[_0x6dd8('0x24')](function(_0x41849c){_0x19b0e0['count']=_0x41849c;if(_0x1581d0[_0x6dd8('0x30')][_0x6dd8('0x3f')]){_0x4c2d55[_0x6dd8('0x40')]=[{'all':!![]}];}return db['Trigger'][_0x6dd8('0x41')](_0x4c2d55);})['then'](function(_0x123806){_0x19b0e0[_0x6dd8('0x42')]=_0x123806;return _0x19b0e0;})[_0x6dd8('0x24')](respondWithFilteredResult(_0x3d691a,_0x4c2d55))[_0x6dd8('0x43')](handleError(_0x3d691a,null));};exports[_0x6dd8('0x44')]=function(_0x54d452,_0x51e62c){var _0x2d6606={'raw':![],'where':{'id':_0x54d452[_0x6dd8('0x45')]['id']}},_0x4b7507={};_0x4b7507[_0x6dd8('0x2e')]=_[_0x6dd8('0x31')](db[_0x6dd8('0x2b')]['rawAttributes']);_0x4b7507['query']=_[_0x6dd8('0x31')](_0x54d452[_0x6dd8('0x30')]);_0x4b7507['filters']=_[_0x6dd8('0x33')](_0x4b7507[_0x6dd8('0x2e')],_0x4b7507[_0x6dd8('0x30')]);_0x2d6606[_0x6dd8('0x34')]=_[_0x6dd8('0x33')](_0x4b7507['model'],qs[_0x6dd8('0x35')](_0x54d452[_0x6dd8('0x30')][_0x6dd8('0x35')]));_0x2d6606['attributes']=_0x2d6606[_0x6dd8('0x34')]['length']?_0x2d6606[_0x6dd8('0x34')]:_0x4b7507['model'];if(_0x54d452[_0x6dd8('0x30')][_0x6dd8('0x3f')]){_0x2d6606[_0x6dd8('0x40')]=[{'all':!![]}];}_0x2d6606=_['merge']({},_0x2d6606,_0x54d452[_0x6dd8('0x3e')]);return db[_0x6dd8('0x2b')][_0x6dd8('0x46')](_0x2d6606)[_0x6dd8('0x24')](handleEntityNotFound(_0x51e62c,null))['then'](respondWithResult(_0x51e62c,null))[_0x6dd8('0x43')](handleError(_0x51e62c,null));};exports['create']=function(_0x4e3839,_0x34c10e){return db['Trigger'][_0x6dd8('0x47')](_0x4e3839[_0x6dd8('0x48')],{})[_0x6dd8('0x24')](function(_0x8d668c){var _0x556eea=_0x4e3839[_0x6dd8('0x49')][_0x6dd8('0x25')]({'plain':!![]});if(!_0x556eea)throw new Error(_0x6dd8('0x4a'));if(_0x556eea[_0x6dd8('0x4b')]==='user'){var _0xbc0d99=_0x8d668c[_0x6dd8('0x25')]({'plain':!![]});var _0x5c7e08=_0x6dd8('0x26');return db[_0x6dd8('0x4c')][_0x6dd8('0x46')]({'where':{'name':_0x5c7e08,'userProfileId':_0x556eea[_0x6dd8('0x4d')]},'raw':!![]})[_0x6dd8('0x24')](function(_0x5a7cf0){if(_0x5a7cf0&&_0x5a7cf0[_0x6dd8('0x4e')]===0x0){return db[_0x6dd8('0x4f')]['create']({'name':_0xbc0d99[_0x6dd8('0x2f')],'resourceId':_0xbc0d99['id'],'type':_0x5a7cf0[_0x6dd8('0x2f')],'sectionId':_0x5a7cf0['id']},{})['then'](function(){return _0x8d668c;});}else{return _0x8d668c;}})[_0x6dd8('0x43')](function(_0x3ee363){logger[_0x6dd8('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ee363);throw _0x3ee363;});}return _0x8d668c;})['then'](respondWithResult(_0x34c10e,0xc9))[_0x6dd8('0x43')](handleError(_0x34c10e,null));};exports[_0x6dd8('0x22')]=function(_0x44374b,_0x20da67){if(_0x44374b[_0x6dd8('0x48')]['id']){delete _0x44374b[_0x6dd8('0x48')]['id'];}return db['Trigger'][_0x6dd8('0x46')]({'where':{'id':_0x44374b['params']['id']}})[_0x6dd8('0x24')](handleEntityNotFound(_0x20da67,null))[_0x6dd8('0x24')](saveUpdates(_0x44374b[_0x6dd8('0x48')],null))[_0x6dd8('0x24')](respondWithResult(_0x20da67,null))[_0x6dd8('0x43')](handleError(_0x20da67,null));};exports[_0x6dd8('0x23')]=function(_0x3111b8,_0xed9073){return db['Trigger'][_0x6dd8('0x46')]({'where':{'id':_0x3111b8[_0x6dd8('0x45')]['id']}})[_0x6dd8('0x24')](handleEntityNotFound(_0xed9073,null))['then'](removeEntity(_0xed9073,null))[_0x6dd8('0x43')](handleError(_0xed9073,null));};exports[_0x6dd8('0x51')]=function(_0xd2a4c9,_0x395675,_0x4f4144){if(_0xd2a4c9[_0x6dd8('0x48')]['id']){delete _0xd2a4c9['body']['id'];}return db[_0x6dd8('0x2b')][_0x6dd8('0x46')]({'where':{'id':_0xd2a4c9[_0x6dd8('0x45')]['id']}})[_0x6dd8('0x24')](handleEntityNotFound(_0x395675,null))[_0x6dd8('0x24')](function(_0x1871a0){if(_0x1871a0){_0xd2a4c9['body'][_0x6dd8('0x52')]=_0x1871a0['id'];return db[_0x6dd8('0x53')][_0x6dd8('0x47')](_0xd2a4c9[_0x6dd8('0x48')]);}})[_0x6dd8('0x24')](respondWithResult(_0x395675,null))['catch'](handleError(_0x395675,null));};exports[_0x6dd8('0x54')]=function(_0x450073,_0x1229c5,_0x58ffab){if(_0x450073[_0x6dd8('0x48')]['id']){delete _0x450073['body']['id'];}return db[_0x6dd8('0x2b')][_0x6dd8('0x46')]({'where':{'id':_0x450073[_0x6dd8('0x45')]['id']}})[_0x6dd8('0x24')](handleEntityNotFound(_0x1229c5,null))[_0x6dd8('0x24')](function(_0x4a2b27){if(_0x4a2b27){_0x450073[_0x6dd8('0x48')]['TriggerAnyId']=_0x4a2b27['id'];return db[_0x6dd8('0x53')][_0x6dd8('0x47')](_0x450073[_0x6dd8('0x48')]);}})[_0x6dd8('0x24')](respondWithResult(_0x1229c5,null))[_0x6dd8('0x43')](handleError(_0x1229c5,null));};exports[_0x6dd8('0x55')]=function(_0x2eecc2,_0x3717c1,_0x2ffa2d){var _0x183621={};var _0x4d83f4={};var _0x2452ae;var _0x40c46a;return db[_0x6dd8('0x2b')][_0x6dd8('0x56')]({'where':{'id':_0x2eecc2[_0x6dd8('0x45')]['id']}})[_0x6dd8('0x24')](handleEntityNotFound(_0x3717c1,null))[_0x6dd8('0x24')](function(_0xe3838f){if(_0xe3838f){_0x2452ae=_0xe3838f;_0x4d83f4[_0x6dd8('0x2e')]=_[_0x6dd8('0x31')](db[_0x6dd8('0x53')]['rawAttributes']);_0x4d83f4[_0x6dd8('0x30')]=_[_0x6dd8('0x31')](_0x2eecc2['query']);_0x4d83f4['filters']=_[_0x6dd8('0x33')](_0x4d83f4[_0x6dd8('0x2e')],_0x4d83f4[_0x6dd8('0x30')]);_0x183621[_0x6dd8('0x34')]=_['intersection'](_0x4d83f4[_0x6dd8('0x2e')],qs['fields'](_0x2eecc2[_0x6dd8('0x30')][_0x6dd8('0x35')]));_0x183621['attributes']=_0x183621[_0x6dd8('0x34')][_0x6dd8('0x36')]?_0x183621['attributes']:_0x4d83f4[_0x6dd8('0x2e')];_0x183621[_0x6dd8('0x38')]=qs[_0x6dd8('0x39')](_0x2eecc2[_0x6dd8('0x30')][_0x6dd8('0x39')]);_0x183621[_0x6dd8('0x3b')]=qs[_0x6dd8('0x32')](_[_0x6dd8('0x3a')](_0x2eecc2[_0x6dd8('0x30')],_0x4d83f4['filters']));if(_0x2eecc2[_0x6dd8('0x30')]['filter']){_0x183621[_0x6dd8('0x3b')]=_[_0x6dd8('0x3c')](_0x183621['where'],{'$or':_['map'](_0x183621['attributes'],function(_0x279a83){var _0x71da30={};_0x71da30[_0x279a83]={'$like':'%'+_0x2eecc2[_0x6dd8('0x30')]['filter']+'%'};return _0x71da30;})});}_0x183621=_['merge']({},_0x183621,_0x2eecc2[_0x6dd8('0x3e')]);return _0x2452ae['getAllConditions'](_0x183621);}})[_0x6dd8('0x24')](function(_0x40ae4a){if(_0x40ae4a){_0x40c46a=_0x40ae4a[_0x6dd8('0x36')];if(!_0x2eecc2[_0x6dd8('0x30')]['hasOwnProperty'](_0x6dd8('0x37'))){_0x183621['limit']=qs[_0x6dd8('0x1b')](_0x2eecc2[_0x6dd8('0x30')][_0x6dd8('0x1b')]);_0x183621[_0x6dd8('0x1d')]=qs[_0x6dd8('0x1d')](_0x2eecc2['query'][_0x6dd8('0x1d')]);}return _0x2452ae[_0x6dd8('0x55')](_0x183621);}})[_0x6dd8('0x24')](function(_0x293f18){if(_0x293f18){return _0x293f18?{'count':_0x40c46a,'rows':_0x293f18}:null;}})[_0x6dd8('0x24')](respondWithResult(_0x3717c1,null))[_0x6dd8('0x43')](handleError(_0x3717c1,null));};exports['getAnyConditions']=function(_0x20bc71,_0x163083,_0x2bdf0e){var _0xeb0a82={};var _0x399238={};var _0x3948c9;var _0x410111;return db[_0x6dd8('0x2b')][_0x6dd8('0x56')]({'where':{'id':_0x20bc71['params']['id']}})[_0x6dd8('0x24')](handleEntityNotFound(_0x163083,null))[_0x6dd8('0x24')](function(_0x580e9c){if(_0x580e9c){_0x3948c9=_0x580e9c;_0x399238[_0x6dd8('0x2e')]=_[_0x6dd8('0x31')](db[_0x6dd8('0x53')][_0x6dd8('0x57')]);_0x399238[_0x6dd8('0x30')]=_[_0x6dd8('0x31')](_0x20bc71['query']);_0x399238[_0x6dd8('0x32')]=_[_0x6dd8('0x33')](_0x399238[_0x6dd8('0x2e')],_0x399238['query']);_0xeb0a82['attributes']=_['intersection'](_0x399238['model'],qs['fields'](_0x20bc71['query'][_0x6dd8('0x35')]));_0xeb0a82[_0x6dd8('0x34')]=_0xeb0a82[_0x6dd8('0x34')][_0x6dd8('0x36')]?_0xeb0a82[_0x6dd8('0x34')]:_0x399238[_0x6dd8('0x2e')];_0xeb0a82[_0x6dd8('0x38')]=qs['sort'](_0x20bc71[_0x6dd8('0x30')][_0x6dd8('0x39')]);_0xeb0a82['where']=qs[_0x6dd8('0x32')](_[_0x6dd8('0x3a')](_0x20bc71[_0x6dd8('0x30')],_0x399238[_0x6dd8('0x32')]));if(_0x20bc71[_0x6dd8('0x30')][_0x6dd8('0x58')]){_0xeb0a82[_0x6dd8('0x3b')]=_[_0x6dd8('0x3c')](_0xeb0a82[_0x6dd8('0x3b')],{'$or':_['map'](_0xeb0a82[_0x6dd8('0x34')],function(_0x70cee7){var _0x24c460={};_0x24c460[_0x70cee7]={'$like':'%'+_0x20bc71[_0x6dd8('0x30')][_0x6dd8('0x58')]+'%'};return _0x24c460;})});}_0xeb0a82=_[_0x6dd8('0x3c')]({},_0xeb0a82,_0x20bc71[_0x6dd8('0x3e')]);return _0x3948c9['getAnyConditions'](_0xeb0a82);}})[_0x6dd8('0x24')](function(_0x5b3bda){if(_0x5b3bda){_0x410111=_0x5b3bda['length'];if(!_0x20bc71[_0x6dd8('0x30')][_0x6dd8('0x59')](_0x6dd8('0x37'))){_0xeb0a82[_0x6dd8('0x1b')]=qs[_0x6dd8('0x1b')](_0x20bc71[_0x6dd8('0x30')][_0x6dd8('0x1b')]);_0xeb0a82[_0x6dd8('0x1d')]=qs[_0x6dd8('0x1d')](_0x20bc71[_0x6dd8('0x30')]['offset']);}return _0x3948c9[_0x6dd8('0x5a')](_0xeb0a82);}})['then'](function(_0x5d4f4e){if(_0x5d4f4e){return _0x5d4f4e?{'count':_0x410111,'rows':_0x5d4f4e}:null;}})['then'](respondWithResult(_0x163083,null))[_0x6dd8('0x43')](handleError(_0x163083,null));};exports[_0x6dd8('0x5b')]=function(_0x331fb7,_0x52a8d5,_0x4e04cb){if(_0x331fb7['body']['id']){delete _0x331fb7[_0x6dd8('0x48')]['id'];}return db[_0x6dd8('0x2b')]['find']({'where':{'id':_0x331fb7[_0x6dd8('0x45')]['id']}})[_0x6dd8('0x24')](handleEntityNotFound(_0x52a8d5,null))['then'](function(_0x2500b0){if(_0x2500b0){_0x331fb7[_0x6dd8('0x48')][_0x6dd8('0x5c')]=_0x2500b0['id'];return db[_0x6dd8('0x5d')][_0x6dd8('0x47')](_0x331fb7[_0x6dd8('0x48')]);}})['then'](respondWithResult(_0x52a8d5,null))['catch'](handleError(_0x52a8d5,null));};exports[_0x6dd8('0x5e')]=function(_0x3f89ad,_0x572d98,_0x4571cb){var _0x424d9c={};var _0x395663={};var _0x5f4ce8;var _0x554ae1;return db[_0x6dd8('0x2b')][_0x6dd8('0x56')]({'where':{'id':_0x3f89ad['params']['id']}})[_0x6dd8('0x24')](handleEntityNotFound(_0x572d98,null))[_0x6dd8('0x24')](function(_0x16f3f5){if(_0x16f3f5){_0x5f4ce8=_0x16f3f5;_0x395663[_0x6dd8('0x2e')]=_[_0x6dd8('0x31')](db[_0x6dd8('0x5d')]['rawAttributes']);_0x395663[_0x6dd8('0x30')]=_[_0x6dd8('0x31')](_0x3f89ad[_0x6dd8('0x30')]);_0x395663['filters']=_[_0x6dd8('0x33')](_0x395663['model'],_0x395663[_0x6dd8('0x30')]);_0x424d9c['attributes']=_[_0x6dd8('0x33')](_0x395663[_0x6dd8('0x2e')],qs['fields'](_0x3f89ad[_0x6dd8('0x30')][_0x6dd8('0x35')]));_0x424d9c[_0x6dd8('0x34')]=_0x424d9c['attributes'][_0x6dd8('0x36')]?_0x424d9c[_0x6dd8('0x34')]:_0x395663[_0x6dd8('0x2e')];_0x424d9c[_0x6dd8('0x38')]=qs['sort'](_0x3f89ad[_0x6dd8('0x30')][_0x6dd8('0x39')]);_0x424d9c['where']=qs[_0x6dd8('0x32')](_['pick'](_0x3f89ad['query'],_0x395663[_0x6dd8('0x32')]));if(_0x3f89ad[_0x6dd8('0x30')][_0x6dd8('0x58')]){_0x424d9c['where']=_[_0x6dd8('0x3c')](_0x424d9c[_0x6dd8('0x3b')],{'$or':_[_0x6dd8('0x2a')](_0x424d9c[_0x6dd8('0x34')],function(_0x3fa4ad){var _0x323675={};_0x323675[_0x3fa4ad]={'$like':'%'+_0x3f89ad[_0x6dd8('0x30')][_0x6dd8('0x58')]+'%'};return _0x323675;})});}_0x424d9c=_[_0x6dd8('0x3c')]({},_0x424d9c,_0x3f89ad['options']);return _0x5f4ce8[_0x6dd8('0x5e')](_0x424d9c);}})['then'](function(_0x2c6c07){if(_0x2c6c07){_0x554ae1=_0x2c6c07['length'];if(!_0x3f89ad['query'][_0x6dd8('0x59')](_0x6dd8('0x37'))){_0x424d9c[_0x6dd8('0x1b')]=qs[_0x6dd8('0x1b')](_0x3f89ad[_0x6dd8('0x30')][_0x6dd8('0x1b')]);_0x424d9c[_0x6dd8('0x1d')]=qs['offset'](_0x3f89ad['query'][_0x6dd8('0x1d')]);}return _0x5f4ce8[_0x6dd8('0x5e')](_0x424d9c);}})['then'](function(_0x6d9d80){if(_0x6d9d80){return _0x6d9d80?{'count':_0x554ae1,'rows':_0x6d9d80}:null;}})['then'](respondWithResult(_0x572d98,null))['catch'](handleError(_0x572d98,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 9c98033..0b79766 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 _0x255f=['../../config/environment','./trigger.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2709cf,_0x3f0472){var _0x3afeca=function(_0x4057c1){while(--_0x4057c1){_0x2709cf['push'](_0x2709cf['shift']());}};_0x3afeca(++_0x3f0472);}(_0x255f,0x185));var _0xf255=function(_0x33c310,_0x9647a4){_0x33c310=_0x33c310-0x0;var _0x54a097=_0x255f[_0x33c310];return _0x54a097;};'use strict';var _=require(_0xf255('0x0'));var util=require('util');var logger=require(_0xf255('0x1'))(_0xf255('0x2'));var moment=require(_0xf255('0x3'));var BPromise=require('bluebird');var rp=require(_0xf255('0x4'));var fs=require('fs');var path=require(_0xf255('0x5'));var rimraf=require(_0xf255('0x6'));var config=require(_0xf255('0x7'));var attributes=require(_0xf255('0x8'));module[_0xf255('0x9')]=function(_0xc1d19f,_0x5bbed0){return _0xc1d19f[_0xf255('0xa')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4d9=['./trigger.attributes','define','tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x20601c,_0x55df83){var _0x4d70f3=function(_0x4b0eaa){while(--_0x4b0eaa){_0x20601c['push'](_0x20601c['shift']());}};_0x4d70f3(++_0x55df83);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x590227,_0x1f2b24){_0x590227=_0x590227-0x0;var _0x26a89b=_0xf4d9[_0x590227];return _0x26a89b;};'use strict';var _=require(_0x9f4d('0x0'));var util=require('util');var logger=require(_0x9f4d('0x1'))(_0x9f4d('0x2'));var moment=require(_0x9f4d('0x3'));var BPromise=require(_0x9f4d('0x4'));var rp=require(_0x9f4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f4d('0x6'));var config=require(_0x9f4d('0x7'));var attributes=require(_0x9f4d('0x8'));module['exports']=function(_0x191f1c,_0x370059){return _0x191f1c[_0x9f4d('0x9')]('Trigger',attributes,{'tableName':_0x9f4d('0xa'),'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 b29b585..563c850 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 _0x15dc=['GetTrigger','catch','ShowTrigger','find','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','stringify','code','error','Trigger,\x20%s,\x20%s','message','info','Trigger','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x25f265,_0xfac482){var _0x451499=function(_0x2a7d5a){while(--_0x2a7d5a){_0x25f265['push'](_0x25f265['shift']());}};_0x451499(++_0xfac482);}(_0x15dc,0x91));var _0xc15d=function(_0x5bd072,_0x3f02d6){_0x5bd072=_0x5bd072-0x0;var _0x17c868=_0x15dc[_0x5bd072];return _0x17c868;};'use strict';var _=require('lodash');var util=require(_0xc15d('0x0'));var moment=require(_0xc15d('0x1'));var BPromise=require(_0xc15d('0x2'));var rs=require(_0xc15d('0x3'));var fs=require('fs');var Redis=require(_0xc15d('0x4'));var db=require(_0xc15d('0x5'))['db'];var utils=require(_0xc15d('0x6'));var logger=require('../../config/logger')(_0xc15d('0x7'));var config=require(_0xc15d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc15d('0x9')][_0xc15d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8bbb5d,_0x249019,_0x204f7e){return new BPromise(function(_0x19386e,_0x298dae){return client[_0xc15d('0xb')](_0x8bbb5d,_0x204f7e)[_0xc15d('0xc')](function(_0x543c4b){logger['info']('Trigger,\x20%s,\x20%s',_0x249019,_0xc15d('0xd'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x249019,_0xc15d('0xd'),JSON[_0xc15d('0xe')](_0x543c4b));if(_0x543c4b['error']){if(_0x543c4b['error'][_0xc15d('0xf')]===0x1f4){logger[_0xc15d('0x10')](_0xc15d('0x11'),_0x249019,_0x543c4b[_0xc15d('0x10')][_0xc15d('0x12')]);return _0x298dae(_0x543c4b[_0xc15d('0x10')][_0xc15d('0x12')]);}logger['error'](_0xc15d('0x11'),_0x249019,_0x543c4b['error']['message']);return _0x19386e(_0x543c4b[_0xc15d('0x10')][_0xc15d('0x12')]);}else{logger[_0xc15d('0x13')](_0xc15d('0x11'),_0x249019,_0xc15d('0xd'));_0x19386e(_0x543c4b['result']['message']);}})['catch'](function(_0x54f901){logger['error'](_0xc15d('0x11'),_0x249019,_0x54f901);_0x298dae(_0x54f901);});});}exports['GetTrigger']=function(_0x2af02f){var _0x35a4c5=this;return new Promise(function(_0x2daa7e,_0x7fce90){return db[_0xc15d('0x14')][_0xc15d('0x15')]({'raw':_0x2af02f[_0xc15d('0x16')]?_0x2af02f[_0xc15d('0x16')][_0xc15d('0x17')]===undefined?!![]:![]:!![],'where':_0x2af02f[_0xc15d('0x16')]?_0x2af02f[_0xc15d('0x16')][_0xc15d('0x18')]||null:null,'attributes':_0x2af02f[_0xc15d('0x16')]?_0x2af02f['options'][_0xc15d('0x19')]||null:null,'limit':_0x2af02f[_0xc15d('0x16')]?_0x2af02f[_0xc15d('0x16')][_0xc15d('0x1a')]||null:null,'include':_0x2af02f[_0xc15d('0x16')]?_0x2af02f[_0xc15d('0x16')][_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x2af02f[_0xc15d('0x16')]['include'],function(_0x49b34c){return{'model':db[_0x49b34c['model']],'as':_0x49b34c['as'],'attributes':_0x49b34c[_0xc15d('0x19')],'include':_0x49b34c[_0xc15d('0x1b')]?_['map'](_0x49b34c[_0xc15d('0x1b')],function(_0x4f18ad){return{'model':db[_0x4f18ad['model']],'as':_0x4f18ad['as'],'attributes':_0x4f18ad['attributes'],'include':_0x4f18ad['include']?_[_0xc15d('0x1c')](_0x4f18ad[_0xc15d('0x1b')],function(_0x31592a){return{'model':db[_0x31592a[_0xc15d('0x1d')]],'as':_0x31592a['as'],'attributes':_0x31592a[_0xc15d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d0edb){logger[_0xc15d('0x13')](_0xc15d('0x1e'),_0x2af02f);logger['debug'](_0xc15d('0x1e'),_0x2af02f,JSON[_0xc15d('0xe')](_0x4d0edb));_0x2daa7e(_0x4d0edb);})[_0xc15d('0x1f')](function(_0x4c99be){logger[_0xc15d('0x10')](_0xc15d('0x1e'),_0x4c99be['message'],_0x2af02f);_0x7fce90(_0x35a4c5[_0xc15d('0x10')](0x1f4,_0x4c99be[_0xc15d('0x12')]));});});};exports[_0xc15d('0x20')]=function(_0x2319da){var _0x20b1f6=this;return new Promise(function(_0xc08b5b,_0x535e2d){return db[_0xc15d('0x14')][_0xc15d('0x21')]({'raw':_0x2319da['options']?_0x2319da['options'][_0xc15d('0x17')]===undefined?!![]:![]:!![],'where':_0x2319da[_0xc15d('0x16')]?_0x2319da[_0xc15d('0x16')][_0xc15d('0x18')]||null:null,'attributes':_0x2319da['options']?_0x2319da[_0xc15d('0x16')][_0xc15d('0x19')]||null:null,'include':_0x2319da['options']?_0x2319da[_0xc15d('0x16')][_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x2319da[_0xc15d('0x16')][_0xc15d('0x1b')],function(_0x1fb6f2){return{'model':db[_0x1fb6f2[_0xc15d('0x1d')]],'as':_0x1fb6f2['as'],'attributes':_0x1fb6f2[_0xc15d('0x19')],'include':_0x1fb6f2[_0xc15d('0x1b')]?_['map'](_0x1fb6f2[_0xc15d('0x1b')],function(_0x229c3e){return{'model':db[_0x229c3e[_0xc15d('0x1d')]],'as':_0x229c3e['as'],'attributes':_0x229c3e[_0xc15d('0x19')],'include':_0x229c3e[_0xc15d('0x1b')]?_[_0xc15d('0x1c')](_0x229c3e['include'],function(_0xc1309){return{'model':db[_0xc1309['model']],'as':_0xc1309['as'],'attributes':_0xc1309[_0xc15d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc15d('0xc')](function(_0x45a7e7){logger[_0xc15d('0x13')]('ShowTrigger',_0x2319da);logger[_0xc15d('0x22')](_0xc15d('0x20'),_0x2319da,JSON[_0xc15d('0xe')](_0x45a7e7));_0xc08b5b(_0x45a7e7);})[_0xc15d('0x1f')](function(_0x852fb4){logger[_0xc15d('0x10')](_0xc15d('0x20'),_0x852fb4['message'],_0x2319da);_0x535e2d(_0x20b1f6['error'](0x1f4,_0x852fb4['message']));});});}; \ No newline at end of file +var _0x745f=['../../config/environment','http','request','then','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','find','debug','ShowTrigger','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40df5f,_0x8fd59f){var _0x1573f1=function(_0x57b8b8){while(--_0x57b8b8){_0x40df5f['push'](_0x40df5f['shift']());}};_0x1573f1(++_0x8fd59f);}(_0x745f,0x1b3));var _0xf745=function(_0x262323,_0x4a81f1){_0x262323=_0x262323-0x0;var _0xa963c3=_0x745f[_0x262323];return _0xa963c3;};'use strict';var _=require('lodash');var util=require(_0xf745('0x0'));var moment=require(_0xf745('0x1'));var BPromise=require(_0xf745('0x2'));var rs=require(_0xf745('0x3'));var fs=require('fs');var Redis=require(_0xf745('0x4'));var db=require(_0xf745('0x5'))['db'];var utils=require(_0xf745('0x6'));var logger=require(_0xf745('0x7'))(_0xf745('0x8'));var config=require(_0xf745('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf745('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x590806,_0x59a06f,_0x241ea5){return new BPromise(function(_0x37aa4a,_0x35bcfe){return client[_0xf745('0xb')](_0x590806,_0x241ea5)[_0xf745('0xc')](function(_0x9e818f){logger[_0xf745('0xd')](_0xf745('0xe'),_0x59a06f,'request\x20sent');logger['debug'](_0xf745('0xf'),_0x59a06f,_0xf745('0x10'),JSON[_0xf745('0x11')](_0x9e818f));if(_0x9e818f['error']){if(_0x9e818f[_0xf745('0x12')][_0xf745('0x13')]===0x1f4){logger[_0xf745('0x12')](_0xf745('0xe'),_0x59a06f,_0x9e818f[_0xf745('0x12')][_0xf745('0x14')]);return _0x35bcfe(_0x9e818f[_0xf745('0x12')][_0xf745('0x14')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x59a06f,_0x9e818f[_0xf745('0x12')][_0xf745('0x14')]);return _0x37aa4a(_0x9e818f['error'][_0xf745('0x14')]);}else{logger[_0xf745('0xd')](_0xf745('0xe'),_0x59a06f,'request\x20sent');_0x37aa4a(_0x9e818f[_0xf745('0x15')][_0xf745('0x14')]);}})['catch'](function(_0x21088f){logger[_0xf745('0x12')](_0xf745('0xe'),_0x59a06f,_0x21088f);_0x35bcfe(_0x21088f);});});}exports[_0xf745('0x16')]=function(_0xaf2b0a){var _0x16dcec=this;return new Promise(function(_0x17c282,_0x339f23){return db[_0xf745('0x17')][_0xf745('0x18')]({'raw':_0xaf2b0a[_0xf745('0x19')]?_0xaf2b0a[_0xf745('0x19')][_0xf745('0x1a')]===undefined?!![]:![]:!![],'where':_0xaf2b0a['options']?_0xaf2b0a[_0xf745('0x19')][_0xf745('0x1b')]||null:null,'attributes':_0xaf2b0a[_0xf745('0x19')]?_0xaf2b0a[_0xf745('0x19')]['attributes']||null:null,'limit':_0xaf2b0a[_0xf745('0x19')]?_0xaf2b0a[_0xf745('0x19')][_0xf745('0x1c')]||null:null,'include':_0xaf2b0a[_0xf745('0x19')]?_0xaf2b0a[_0xf745('0x19')][_0xf745('0x1d')]?_[_0xf745('0x1e')](_0xaf2b0a[_0xf745('0x19')]['include'],function(_0x218ddf){return{'model':db[_0x218ddf[_0xf745('0x1f')]],'as':_0x218ddf['as'],'attributes':_0x218ddf[_0xf745('0x20')],'include':_0x218ddf[_0xf745('0x1d')]?_['map'](_0x218ddf[_0xf745('0x1d')],function(_0x3a0bd6){return{'model':db[_0x3a0bd6[_0xf745('0x1f')]],'as':_0x3a0bd6['as'],'attributes':_0x3a0bd6[_0xf745('0x20')],'include':_0x3a0bd6[_0xf745('0x1d')]?_[_0xf745('0x1e')](_0x3a0bd6[_0xf745('0x1d')],function(_0x283611){return{'model':db[_0x283611[_0xf745('0x1f')]],'as':_0x283611['as'],'attributes':_0x283611[_0xf745('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf745('0xc')](function(_0xe95a64){logger[_0xf745('0xd')]('GetTrigger',_0xaf2b0a);logger['debug'](_0xf745('0x16'),_0xaf2b0a,JSON[_0xf745('0x11')](_0xe95a64));_0x17c282(_0xe95a64);})['catch'](function(_0x5a982e){logger[_0xf745('0x12')]('GetTrigger',_0x5a982e['message'],_0xaf2b0a);_0x339f23(_0x16dcec[_0xf745('0x12')](0x1f4,_0x5a982e[_0xf745('0x14')]));});});};exports['ShowTrigger']=function(_0x834821){var _0xed6a68=this;return new Promise(function(_0x27d1a8,_0x5d1331){return db[_0xf745('0x17')][_0xf745('0x21')]({'raw':_0x834821[_0xf745('0x19')]?_0x834821['options'][_0xf745('0x1a')]===undefined?!![]:![]:!![],'where':_0x834821[_0xf745('0x19')]?_0x834821[_0xf745('0x19')][_0xf745('0x1b')]||null:null,'attributes':_0x834821[_0xf745('0x19')]?_0x834821['options'][_0xf745('0x20')]||null:null,'include':_0x834821[_0xf745('0x19')]?_0x834821[_0xf745('0x19')]['include']?_[_0xf745('0x1e')](_0x834821['options'][_0xf745('0x1d')],function(_0x1a05aa){return{'model':db[_0x1a05aa[_0xf745('0x1f')]],'as':_0x1a05aa['as'],'attributes':_0x1a05aa[_0xf745('0x20')],'include':_0x1a05aa[_0xf745('0x1d')]?_[_0xf745('0x1e')](_0x1a05aa[_0xf745('0x1d')],function(_0x147a09){return{'model':db[_0x147a09[_0xf745('0x1f')]],'as':_0x147a09['as'],'attributes':_0x147a09[_0xf745('0x20')],'include':_0x147a09['include']?_['map'](_0x147a09[_0xf745('0x1d')],function(_0x200dea){return{'model':db[_0x200dea['model']],'as':_0x200dea['as'],'attributes':_0x200dea[_0xf745('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf745('0xc')](function(_0x99f176){logger[_0xf745('0xd')]('ShowTrigger',_0x834821);logger[_0xf745('0x22')](_0xf745('0x23'),_0x834821,JSON[_0xf745('0x11')](_0x99f176));_0x27d1a8(_0x99f176);})[_0xf745('0x24')](function(_0xac9a62){logger[_0xf745('0x12')]('ShowTrigger',_0xac9a62[_0xf745('0x14')],_0x834821);_0x5d1331(_0xed6a68[_0xf745('0x12')](0x1f4,_0xac9a62[_0xf745('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6252eab..41a4ca8 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 _0x765a=['clone','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','post','/:id/clone'];(function(_0x2db983,_0x48f63d){var _0x368dda=function(_0x5c6b05){while(--_0x5c6b05){_0x2db983['push'](_0x2db983['shift']());}};_0x368dda(++_0x48f63d);}(_0x765a,0x1bf));var _0xa765=function(_0xde0155,_0x197649){_0xde0155=_0xde0155-0x0;var _0x41f706=_0x765a[_0xde0155];return _0x41f706;};'use strict';var multer=require(_0xa765('0x0'));var util=require(_0xa765('0x1'));var path=require('path');var timeout=require(_0xa765('0x2'));var express=require(_0xa765('0x3'));var router=express[_0xa765('0x4')]();var fs_extra=require(_0xa765('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa765('0x6'));var config=require(_0xa765('0x7'));var controller=require(_0xa765('0x8'));router[_0xa765('0x9')]('/',auth[_0xa765('0xa')](),controller[_0xa765('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa765('0xc')]);router[_0xa765('0xd')](_0xa765('0xe'),auth[_0xa765('0xa')](),controller[_0xa765('0xf')]);router[_0xa765('0xd')]('/',auth['isAuthenticated'](),controller[_0xa765('0x10')]);router[_0xa765('0x11')](_0xa765('0x12'),auth[_0xa765('0xa')](),controller[_0xa765('0x13')]);router['delete'](_0xa765('0x12'),auth[_0xa765('0xa')](),controller[_0xa765('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1fae=['get','isAuthenticated','/:id','show','/:id/clone','clone','post','put','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x349915,_0x124261){var _0x8be4f3=function(_0x3a82a9){while(--_0x3a82a9){_0x349915['push'](_0x349915['shift']());}};_0x8be4f3(++_0x124261);}(_0x1fae,0xea));var _0xe1fa=function(_0x1be3ed,_0x5a01ca){_0x1be3ed=_0x1be3ed-0x0;var _0x1fac22=_0x1fae[_0x1be3ed];return _0x1fac22;};'use strict';var multer=require(_0xe1fa('0x0'));var util=require(_0xe1fa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe1fa('0x2'));var router=express['Router']();var fs_extra=require(_0xe1fa('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe1fa('0x4'));var config=require(_0xe1fa('0x5'));var controller=require('./trunk.controller');router[_0xe1fa('0x6')]('/',auth[_0xe1fa('0x7')](),controller['index']);router['get'](_0xe1fa('0x8'),auth[_0xe1fa('0x7')](),controller[_0xe1fa('0x9')]);router['post'](_0xe1fa('0xa'),auth[_0xe1fa('0x7')](),controller[_0xe1fa('0xb')]);router[_0xe1fa('0xc')]('/',auth[_0xe1fa('0x7')](),controller['create']);router[_0xe1fa('0xd')](_0xe1fa('0x8'),auth[_0xe1fa('0x7')](),controller['update']);router['delete'](_0xe1fa('0x8'),auth[_0xe1fa('0x7')](),controller[_0xe1fa('0xe')]);module[_0xe1fa('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7be2e31..0bfddca 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 _0xab93=['update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','yes','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','dynamic','BOOLEAN','sequelize','name','ENUM','friend','STRING','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','nonat'];(function(_0x4d7634,_0x23ac0f){var _0x56e536=function(_0x207294){while(--_0x207294){_0x4d7634['push'](_0x4d7634['shift']());}};_0x56e536(++_0x23ac0f);}(_0xab93,0x1a3));var _0x3ab9=function(_0x4bd7aa,_0xf33452){_0x4bd7aa=_0x4bd7aa-0x0;var _0x2bea8a=_0xab93[_0x4bd7aa];return _0x2bea8a;};'use strict';var Sequelize=require(_0x3ab9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ab9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x3'),'user','peer'),'allowNull':![],'defaultValue':_0x3ab9('0x3')},'context':{'type':Sequelize[_0x3ab9('0x4')],'allowNull':![],'defaultValue':_0x3ab9('0x5')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x3ab9('0x6'),_0x3ab9('0x7'),'ALLOWED',_0x3ab9('0x8'),'PROHIB_PASSED_SCREEN',_0x3ab9('0x9'),_0x3ab9('0xa'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x3ab9('0x4')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x3ab9('0x4')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':_0x3ab9('0xb'),'set':function(_0x582f49){this['setDataValue'](_0x3ab9('0xc'),_0x582f49?_0x582f49[_0x3ab9('0xd')](','):null);},'get':function(){return this['getDataValue'](_0x3ab9('0xc'))?this[_0x3ab9('0xe')](_0x3ab9('0xc'))[_0x3ab9('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x3ab9('0x10'),_0x3ab9('0x11'),_0x3ab9('0x12'),_0x3ab9('0x13'),_0x3ab9('0x14')),'defaultValue':_0x3ab9('0x10')},'directmedia':{'type':Sequelize[_0x3ab9('0x2')]('yes','no',_0x3ab9('0x15'),_0x3ab9('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3ab9('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3ab9('0x4')]},'directmediadeny':{'type':Sequelize[_0x3ab9('0x4')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x535b16){this['setDataValue']('nat',_0x535b16?_0x535b16[_0x3ab9('0xd')](','):null);},'get':function(){return this[_0x3ab9('0xe')](_0x3ab9('0x17'))?this[_0x3ab9('0xe')]('nat')[_0x3ab9('0xf')](','):null;},'comment':_0x3ab9('0x18')},'callgroup':{'type':Sequelize[_0x3ab9('0x4')]},'namedcallgroup':{'type':Sequelize[_0x3ab9('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3ab9('0x4')]},'language':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3ab9('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':_0x3ab9('0x19')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3ab9('0x1a'),'set':function(_0x4ffa9c){this[_0x3ab9('0x1b')](_0x3ab9('0x1c'),_0x4ffa9c?_0x4ffa9c[_0x3ab9('0xd')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x3ab9('0x1c'))?this[_0x3ab9('0xe')](_0x3ab9('0x1c'))[_0x3ab9('0xf')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'insecure':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':'port,invite','set':function(_0x5dfd78){this['setDataValue'](_0x3ab9('0x1e'),_0x5dfd78?_0x5dfd78[_0x3ab9('0xd')](','):null);},'get':function(){return this[_0x3ab9('0xe')](_0x3ab9('0x1e'))?this['getDataValue']('insecure')[_0x3ab9('0xf')](','):null;},'comment':_0x3ab9('0x1f')},'trustrpid':{'type':Sequelize[_0x3ab9('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no',_0x3ab9('0x20'))},'promiscredir':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'useclientcode':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'accountcode':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'setvar':{'type':Sequelize[_0x3ab9('0x4')]},'callerid':{'type':Sequelize[_0x3ab9('0x4')],'defaultValue':_0x3ab9('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no'),'defaultValue':_0x3ab9('0x1d')},'busylevel':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'allowsubscribe':{'type':Sequelize[_0x3ab9('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3ab9('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x3ab9('0x4')]},'videosupport':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no',_0x3ab9('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'mailbox':{'type':Sequelize[_0x3ab9('0x4')]},'session_timers':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x24'),_0x3ab9('0x25'),_0x3ab9('0x26'))},'session_expires':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x27'),_0x3ab9('0x28')),'defaultValue':_0x3ab9('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x3ab9('0x4')]},'regexten':{'type':Sequelize[_0x3ab9('0x4')]},'fromdomain':{'type':Sequelize[_0x3ab9('0x4')]},'fromuser':{'type':Sequelize[_0x3ab9('0x4')]},'port':{'type':Sequelize[_0x3ab9('0x21')](0x5)},'qualify':{'type':Sequelize[_0x3ab9('0x2')]('yes','no'),'defaultValue':_0x3ab9('0x1d')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3ab9('0x4')]},'defaultuser':{'type':Sequelize[_0x3ab9('0x4')]},'rtptimeout':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no',_0x3ab9('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3ab9('0x4')]},'callbackextension':{'type':Sequelize[_0x3ab9('0x4')]},'timert1':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'timerb':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x3ab9('0x4')]},'contactdeny':{'type':Sequelize[_0x3ab9('0x4')]},'contactacl':{'type':Sequelize[_0x3ab9('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0x3ab9('0x4')]},'use_q850_reason':{'type':Sequelize[_0x3ab9('0x4')]},'maxforwards':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'encryption':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3ab9('0x1d'),'no')},'force_avp':{'type':Sequelize[_0x3ab9('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'dtlsenable':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'dtlsverify':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no',_0x3ab9('0x2a'),_0x3ab9('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x3ab9('0x21')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x3ab9('0x4')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x3ab9('0x4')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3ab9('0x2c'),_0x3ab9('0x2d'),_0x3ab9('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3ab9('0x4')]},'usereqphone':{'type':Sequelize[_0x3ab9('0x2')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'subscribemwi':{'type':Sequelize[_0x3ab9('0x2')](_0x3ab9('0x1d'),'no')},'vmexten':{'type':Sequelize[_0x3ab9('0x4')]},'mohinterpret':{'type':Sequelize[_0x3ab9('0x4')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x3ab9('0x4')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x3ab9('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x3ab9('0x1d'),'no',_0x3ab9('0x15'),_0x3ab9('0x16'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3ab9('0x4')]},'otherFields':{'type':Sequelize[_0x3ab9('0x4')]},'active':{'type':Sequelize[_0x3ab9('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x2fc0=['insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','active','actpass','dynamic','update','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','outgoing','yes','nat','split','all','ulaw;alaw;gsm','allow','port,invite'];(function(_0x12ad1b,_0x106d01){var _0x22efbb=function(_0x468f70){while(--_0x468f70){_0x12ad1b['push'](_0x12ad1b['shift']());}};_0x22efbb(++_0x106d01);}(_0x2fc0,0xda));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x02fc('0x0')]={'name':{'type':Sequelize[_0x02fc('0x1')],'allowNull':![],'unique':_0x02fc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x4'),'user',_0x02fc('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x02fc('0x6')},'callingpres':{'type':Sequelize[_0x02fc('0x3')]('ALLOWED_NOT_SCREENED',_0x02fc('0x7'),'ALLOWED_FAILED_SCREEN',_0x02fc('0x8'),_0x02fc('0x9'),'PROHIB_PASSED_SCREEN',_0x02fc('0xa'),_0x02fc('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x02fc('0x1')]},'secret':{'type':Sequelize[_0x02fc('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x02fc('0x1')]},'transport':{'type':Sequelize[_0x02fc('0x1')],'defaultValue':_0x02fc('0xc'),'set':function(_0x1a9372){this[_0x02fc('0xd')](_0x02fc('0xe'),_0x1a9372?_0x1a9372[_0x02fc('0xf')](','):null);},'get':function(){return this[_0x02fc('0x10')](_0x02fc('0xe'))?this[_0x02fc('0x10')](_0x02fc('0xe'))['split'](','):null;},'comment':_0x02fc('0x11')},'dtmfmode':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x12'),_0x02fc('0x13'),_0x02fc('0x14'),_0x02fc('0x15'),_0x02fc('0x16')),'defaultValue':_0x02fc('0x12')},'directmedia':{'type':Sequelize[_0x02fc('0x3')]('yes','no',_0x02fc('0x17'),'update',_0x02fc('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x02fc('0x1')]},'directmediadeny':{'type':Sequelize[_0x02fc('0x1')]},'nat':{'type':Sequelize[_0x02fc('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x11fc27){this['setDataValue']('nat',_0x11fc27?_0x11fc27[_0x02fc('0xf')](','):null);},'get':function(){return this[_0x02fc('0x10')](_0x02fc('0x1a'))?this['getDataValue'](_0x02fc('0x1a'))[_0x02fc('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x02fc('0x1')]},'namedcallgroup':{'type':Sequelize[_0x02fc('0x1')]},'pickupgroup':{'type':Sequelize[_0x02fc('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x02fc('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x02fc('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x02fc('0x1')],'defaultValue':_0x02fc('0x1c')},'allow':{'type':Sequelize[_0x02fc('0x1')],'allowNull':![],'defaultValue':_0x02fc('0x1d'),'set':function(_0x3dd9db){this['setDataValue']('allow',_0x3dd9db?_0x3dd9db[_0x02fc('0xf')](';'):_0x02fc('0x1d'));},'get':function(){return this[_0x02fc('0x10')](_0x02fc('0x1e'))?this[_0x02fc('0x10')](_0x02fc('0x1e'))[_0x02fc('0x1b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'insecure':{'type':Sequelize[_0x02fc('0x1')],'defaultValue':_0x02fc('0x1f'),'set':function(_0x405a8d){this[_0x02fc('0xd')](_0x02fc('0x20'),_0x405a8d?_0x405a8d['join'](','):null);},'get':function(){return this[_0x02fc('0x10')](_0x02fc('0x20'))?this[_0x02fc('0x10')](_0x02fc('0x20'))['split'](','):null;},'comment':_0x02fc('0x21')},'trustrpid':{'type':Sequelize['ENUM'](_0x02fc('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x02fc('0x3')]('yes','no',_0x02fc('0x22'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'accountcode':{'type':Sequelize[_0x02fc('0x23')](0xb)},'setvar':{'type':Sequelize[_0x02fc('0x1')]},'callerid':{'type':Sequelize[_0x02fc('0x1')],'defaultValue':_0x02fc('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x02fc('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x02fc('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x02fc('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x02fc('0x19'),'no',_0x02fc('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'mailbox':{'type':Sequelize[_0x02fc('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x02fc('0x26'),'refuse',_0x02fc('0x27'))},'session_expires':{'type':Sequelize[_0x02fc('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x02fc('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x28'),_0x02fc('0x29')),'defaultValue':_0x02fc('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x02fc('0x1')]},'regexten':{'type':Sequelize[_0x02fc('0x1')]},'fromdomain':{'type':Sequelize[_0x02fc('0x1')]},'fromuser':{'type':Sequelize[_0x02fc('0x1')]},'port':{'type':Sequelize[_0x02fc('0x23')](0x5)},'qualify':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no'),'defaultValue':_0x02fc('0x19')},'keepalive':{'type':Sequelize[_0x02fc('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x02fc('0x1')]},'defaultuser':{'type':Sequelize[_0x02fc('0x1')]},'rtptimeout':{'type':Sequelize[_0x02fc('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x02fc('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x02fc('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x02fc('0x1')]},'callbackextension':{'type':Sequelize[_0x02fc('0x1')]},'timert1':{'type':Sequelize[_0x02fc('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x02fc('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x02fc('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x02fc('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x02fc('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'force_avp':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'icesupport':{'type':Sequelize[_0x02fc('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no',_0x02fc('0x2a'),_0x02fc('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x02fc('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x02fc('0x1')]},'dtlscipher':{'type':Sequelize[_0x02fc('0x1')]},'dtlscafile':{'type':Sequelize[_0x02fc('0x1')]},'dtlscapath':{'type':Sequelize[_0x02fc('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x02fc('0x2c'),'passive',_0x02fc('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x02fc('0x1')]},'usereqphone':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x02fc('0x1')]},'recordofffeature':{'type':Sequelize[_0x02fc('0x1')]},'call_limit':{'type':Sequelize[_0x02fc('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x02fc('0x1')]},'parkinglot':{'type':Sequelize[_0x02fc('0x1')]},'description':{'type':Sequelize[_0x02fc('0x1')]},'host':{'type':Sequelize[_0x02fc('0x1')],'defaultValue':_0x02fc('0x2e')},'canreinvite':{'type':Sequelize[_0x02fc('0x3')](_0x02fc('0x19'),'no',_0x02fc('0x17'),_0x02fc('0x2f'),_0x02fc('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x02fc('0x1')]},'otherFields':{'type':Sequelize[_0x02fc('0x1')]},'active':{'type':Sequelize[_0x02fc('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x02fc('0x1')],'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 0e5f635..fc6f9f0 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 _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0x4b84[_0x333798];return _0x389f4e;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0xd8e459,_0x3c08d1){var _0x50d66d=function(_0x1ce601){while(--_0x1ce601){_0xd8e459['push'](_0xd8e459['shift']());}};_0x50d66d(++_0x3c08d1);}(_0x34e8,0x12c));var _0x834e=function(_0x52f0ee,_0x13e4f5){_0x52f0ee=_0x52f0ee-0x0;var _0x30eee5=_0x34e8[_0x52f0ee];return _0x30eee5;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7b9f0f3..695a992 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 _0xcca0=['define','Trunk','tools_trunks','lodash','../../config/logger','api','request-promise','../../config/environment','exports'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0xcca0,0xf6));var _0x0cca=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xcca0[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x0cca('0x0'));var util=require('util');var logger=require(_0x0cca('0x1'))(_0x0cca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0cca('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0cca('0x4'));var attributes=require('./trunk.attributes');module[_0x0cca('0x5')]=function(_0x449db7,_0x407329){return _0x449db7[_0x0cca('0x6')](_0x0cca('0x7'),attributes,{'tableName':_0x0cca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a95=['define','Trunk','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x303a0c,_0x25964e){var _0x2f4aa5=function(_0x4e0269){while(--_0x4e0269){_0x303a0c['push'](_0x303a0c['shift']());}};_0x2f4aa5(++_0x25964e);}(_0x3a95,0x110));var _0x53a9=function(_0x46de2e,_0x43781c){_0x46de2e=_0x46de2e-0x0;var _0x5e9362=_0x3a95[_0x46de2e];return _0x5e9362;};'use strict';var _=require('lodash');var util=require(_0x53a9('0x0'));var logger=require('../../config/logger')(_0x53a9('0x1'));var moment=require(_0x53a9('0x2'));var BPromise=require(_0x53a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53a9('0x4'));var rimraf=require(_0x53a9('0x5'));var config=require(_0x53a9('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x424907,_0x1fdda3){return _0x424907[_0x53a9('0x7')](_0x53a9('0x8'),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 f05bf0b..ef88f6c 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 _0x026b=['model','stringify','find','map','ShowTrunk','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include'];(function(_0xb6790e,_0x38fbe3){var _0x3b1955=function(_0x43155e){while(--_0x43155e){_0xb6790e['push'](_0xb6790e['shift']());}};_0x3b1955(++_0x38fbe3);}(_0x026b,0x192));var _0xb026=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x026b[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xb026('0x0'));var util=require(_0xb026('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb026('0x2'));var fs=require('fs');var Redis=require(_0xb026('0x3'));var db=require(_0xb026('0x4'))['db'];var utils=require(_0xb026('0x5'));var logger=require(_0xb026('0x6'))(_0xb026('0x7'));var config=require(_0xb026('0x8'));var jayson=require(_0xb026('0x9'));var client=jayson[_0xb026('0xa')][_0xb026('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53caed,_0x559b88,_0x32bdd6){return new BPromise(function(_0x477f20,_0x26f6a5){return client[_0xb026('0xc')](_0x53caed,_0x32bdd6)[_0xb026('0xd')](function(_0x5ba938){logger['info'](_0xb026('0xe'),_0x559b88,'request\x20sent');logger[_0xb026('0xf')](_0xb026('0x10'),_0x559b88,'request\x20sent',JSON['stringify'](_0x5ba938));if(_0x5ba938[_0xb026('0x11')]){if(_0x5ba938[_0xb026('0x11')]['code']===0x1f4){logger[_0xb026('0x11')](_0xb026('0xe'),_0x559b88,_0x5ba938['error'][_0xb026('0x12')]);return _0x26f6a5(_0x5ba938[_0xb026('0x11')]['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x559b88,_0x5ba938[_0xb026('0x11')][_0xb026('0x12')]);return _0x477f20(_0x5ba938[_0xb026('0x11')][_0xb026('0x12')]);}else{logger[_0xb026('0x13')](_0xb026('0xe'),_0x559b88,_0xb026('0x14'));_0x477f20(_0x5ba938['result'][_0xb026('0x12')]);}})['catch'](function(_0x1d192c){logger['error'](_0xb026('0xe'),_0x559b88,_0x1d192c);_0x26f6a5(_0x1d192c);});});}exports[_0xb026('0x15')]=function(_0x4cfc96){var _0x4acf3d=this;return new Promise(function(_0xcf144e,_0x5d03b7){return db[_0xb026('0x16')][_0xb026('0x17')]({'raw':_0x4cfc96['options']?_0x4cfc96[_0xb026('0x18')][_0xb026('0x19')]===undefined?!![]:![]:!![],'where':_0x4cfc96['options']?_0x4cfc96[_0xb026('0x18')][_0xb026('0x1a')]||null:null,'attributes':_0x4cfc96[_0xb026('0x18')]?_0x4cfc96[_0xb026('0x18')][_0xb026('0x1b')]||null:null,'limit':_0x4cfc96[_0xb026('0x18')]?_0x4cfc96[_0xb026('0x18')][_0xb026('0x1c')]||null:null,'include':_0x4cfc96[_0xb026('0x18')]?_0x4cfc96['options'][_0xb026('0x1d')]?_['map'](_0x4cfc96[_0xb026('0x18')][_0xb026('0x1d')],function(_0x3ad296){return{'model':db[_0x3ad296[_0xb026('0x1e')]],'as':_0x3ad296['as'],'attributes':_0x3ad296[_0xb026('0x1b')],'include':_0x3ad296[_0xb026('0x1d')]?_['map'](_0x3ad296[_0xb026('0x1d')],function(_0x3c944e){return{'model':db[_0x3c944e['model']],'as':_0x3c944e['as'],'attributes':_0x3c944e['attributes'],'include':_0x3c944e[_0xb026('0x1d')]?_['map'](_0x3c944e[_0xb026('0x1d')],function(_0x445d24){return{'model':db[_0x445d24[_0xb026('0x1e')]],'as':_0x445d24['as'],'attributes':_0x445d24[_0xb026('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16bbeb){logger['info']('GetTrunk',_0x4cfc96);logger[_0xb026('0xf')]('GetTrunk',_0x4cfc96,JSON[_0xb026('0x1f')](_0x16bbeb));_0xcf144e(_0x16bbeb);})['catch'](function(_0x4fb953){logger['error'](_0xb026('0x15'),_0x4fb953[_0xb026('0x12')],_0x4cfc96);_0x5d03b7(_0x4acf3d[_0xb026('0x11')](0x1f4,_0x4fb953[_0xb026('0x12')]));});});};exports['ShowTrunk']=function(_0x54d4f1){var _0x42aa63=this;return new Promise(function(_0x252969,_0x41f585){return db[_0xb026('0x16')][_0xb026('0x20')]({'raw':_0x54d4f1[_0xb026('0x18')]?_0x54d4f1['options'][_0xb026('0x19')]===undefined?!![]:![]:!![],'where':_0x54d4f1[_0xb026('0x18')]?_0x54d4f1[_0xb026('0x18')][_0xb026('0x1a')]||null:null,'attributes':_0x54d4f1['options']?_0x54d4f1[_0xb026('0x18')][_0xb026('0x1b')]||null:null,'include':_0x54d4f1[_0xb026('0x18')]?_0x54d4f1[_0xb026('0x18')][_0xb026('0x1d')]?_['map'](_0x54d4f1['options'][_0xb026('0x1d')],function(_0x389fc2){return{'model':db[_0x389fc2[_0xb026('0x1e')]],'as':_0x389fc2['as'],'attributes':_0x389fc2[_0xb026('0x1b')],'include':_0x389fc2[_0xb026('0x1d')]?_[_0xb026('0x21')](_0x389fc2[_0xb026('0x1d')],function(_0x56f684){return{'model':db[_0x56f684[_0xb026('0x1e')]],'as':_0x56f684['as'],'attributes':_0x56f684[_0xb026('0x1b')],'include':_0x56f684[_0xb026('0x1d')]?_[_0xb026('0x21')](_0x56f684[_0xb026('0x1d')],function(_0x58af8d){return{'model':db[_0x58af8d[_0xb026('0x1e')]],'as':_0x58af8d['as'],'attributes':_0x58af8d[_0xb026('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb026('0xd')](function(_0x1691e5){logger[_0xb026('0x13')](_0xb026('0x22'),_0x54d4f1);logger[_0xb026('0xf')](_0xb026('0x22'),_0x54d4f1,JSON[_0xb026('0x1f')](_0x1691e5));_0x252969(_0x1691e5);})[_0xb026('0x23')](function(_0x5d7ee3){logger[_0xb026('0x11')]('ShowTrunk',_0x5d7ee3['message'],_0x54d4f1);_0x41f585(_0x42aa63[_0xb026('0x11')](0x1f4,_0x5d7ee3[_0xb026('0x12')]));});});}; \ No newline at end of file +var _0xa9c2=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','limit','include','map','model','attributes','ShowTrunk','find','where'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xa9c2,0xd8));var _0x2a9c=function(_0x540036,_0xd8faf3){_0x540036=_0x540036-0x0;var _0x3db117=_0xa9c2[_0x540036];return _0x3db117;};'use strict';var _=require('lodash');var util=require(_0x2a9c('0x0'));var moment=require(_0x2a9c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2a9c('0x2'));var fs=require('fs');var Redis=require(_0x2a9c('0x3'));var db=require(_0x2a9c('0x4'))['db'];var utils=require(_0x2a9c('0x5'));var logger=require('../../config/logger')(_0x2a9c('0x6'));var config=require(_0x2a9c('0x7'));var jayson=require(_0x2a9c('0x8'));var client=jayson[_0x2a9c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x576a96,_0x47c010,_0x1718ab){return new BPromise(function(_0x2a9e65,_0x5c5722){return client[_0x2a9c('0xa')](_0x576a96,_0x1718ab)[_0x2a9c('0xb')](function(_0x7ece30){logger[_0x2a9c('0xc')](_0x2a9c('0xd'),_0x47c010,_0x2a9c('0xe'));logger[_0x2a9c('0xf')](_0x2a9c('0x10'),_0x47c010,_0x2a9c('0xe'),JSON[_0x2a9c('0x11')](_0x7ece30));if(_0x7ece30['error']){if(_0x7ece30[_0x2a9c('0x12')][_0x2a9c('0x13')]===0x1f4){logger[_0x2a9c('0x12')](_0x2a9c('0xd'),_0x47c010,_0x7ece30['error'][_0x2a9c('0x14')]);return _0x5c5722(_0x7ece30[_0x2a9c('0x12')][_0x2a9c('0x14')]);}logger[_0x2a9c('0x12')]('Trunk,\x20%s,\x20%s',_0x47c010,_0x7ece30['error'][_0x2a9c('0x14')]);return _0x2a9e65(_0x7ece30[_0x2a9c('0x12')][_0x2a9c('0x14')]);}else{logger[_0x2a9c('0xc')]('Trunk,\x20%s,\x20%s',_0x47c010,_0x2a9c('0xe'));_0x2a9e65(_0x7ece30[_0x2a9c('0x15')][_0x2a9c('0x14')]);}})[_0x2a9c('0x16')](function(_0x5262fc){logger['error'](_0x2a9c('0xd'),_0x47c010,_0x5262fc);_0x5c5722(_0x5262fc);});});}exports[_0x2a9c('0x17')]=function(_0x5bd011){var _0x227d69=this;return new Promise(function(_0x59cb37,_0x442b58){return db[_0x2a9c('0x18')][_0x2a9c('0x19')]({'raw':_0x5bd011[_0x2a9c('0x1a')]?_0x5bd011[_0x2a9c('0x1a')][_0x2a9c('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bd011[_0x2a9c('0x1a')]?_0x5bd011[_0x2a9c('0x1a')]['where']||null:null,'attributes':_0x5bd011[_0x2a9c('0x1a')]?_0x5bd011[_0x2a9c('0x1a')]['attributes']||null:null,'limit':_0x5bd011[_0x2a9c('0x1a')]?_0x5bd011[_0x2a9c('0x1a')][_0x2a9c('0x1c')]||null:null,'include':_0x5bd011[_0x2a9c('0x1a')]?_0x5bd011[_0x2a9c('0x1a')][_0x2a9c('0x1d')]?_[_0x2a9c('0x1e')](_0x5bd011[_0x2a9c('0x1a')][_0x2a9c('0x1d')],function(_0x3c28a6){return{'model':db[_0x3c28a6['model']],'as':_0x3c28a6['as'],'attributes':_0x3c28a6['attributes'],'include':_0x3c28a6[_0x2a9c('0x1d')]?_['map'](_0x3c28a6[_0x2a9c('0x1d')],function(_0x380459){return{'model':db[_0x380459[_0x2a9c('0x1f')]],'as':_0x380459['as'],'attributes':_0x380459[_0x2a9c('0x20')],'include':_0x380459[_0x2a9c('0x1d')]?_['map'](_0x380459[_0x2a9c('0x1d')],function(_0x2c6fb3){return{'model':db[_0x2c6fb3['model']],'as':_0x2c6fb3['as'],'attributes':_0x2c6fb3['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a9c('0xb')](function(_0x57a59b){logger[_0x2a9c('0xc')](_0x2a9c('0x17'),_0x5bd011);logger[_0x2a9c('0xf')]('GetTrunk',_0x5bd011,JSON['stringify'](_0x57a59b));_0x59cb37(_0x57a59b);})['catch'](function(_0x20e39f){logger[_0x2a9c('0x12')]('GetTrunk',_0x20e39f[_0x2a9c('0x14')],_0x5bd011);_0x442b58(_0x227d69[_0x2a9c('0x12')](0x1f4,_0x20e39f[_0x2a9c('0x14')]));});});};exports[_0x2a9c('0x21')]=function(_0x1499a0){var _0x1b85ae=this;return new Promise(function(_0x2ffea6,_0x549e9e){return db[_0x2a9c('0x18')][_0x2a9c('0x22')]({'raw':_0x1499a0['options']?_0x1499a0[_0x2a9c('0x1a')][_0x2a9c('0x1b')]===undefined?!![]:![]:!![],'where':_0x1499a0['options']?_0x1499a0[_0x2a9c('0x1a')][_0x2a9c('0x23')]||null:null,'attributes':_0x1499a0[_0x2a9c('0x1a')]?_0x1499a0[_0x2a9c('0x1a')]['attributes']||null:null,'include':_0x1499a0['options']?_0x1499a0[_0x2a9c('0x1a')][_0x2a9c('0x1d')]?_[_0x2a9c('0x1e')](_0x1499a0[_0x2a9c('0x1a')]['include'],function(_0x209e0a){return{'model':db[_0x209e0a[_0x2a9c('0x1f')]],'as':_0x209e0a['as'],'attributes':_0x209e0a[_0x2a9c('0x20')],'include':_0x209e0a['include']?_[_0x2a9c('0x1e')](_0x209e0a[_0x2a9c('0x1d')],function(_0x5d8e5e){return{'model':db[_0x5d8e5e[_0x2a9c('0x1f')]],'as':_0x5d8e5e['as'],'attributes':_0x5d8e5e[_0x2a9c('0x20')],'include':_0x5d8e5e[_0x2a9c('0x1d')]?_[_0x2a9c('0x1e')](_0x5d8e5e['include'],function(_0x4c292f){return{'model':db[_0x4c292f[_0x2a9c('0x1f')]],'as':_0x4c292f['as'],'attributes':_0x4c292f[_0x2a9c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ca035){logger['info'](_0x2a9c('0x21'),_0x1499a0);logger[_0x2a9c('0xf')](_0x2a9c('0x21'),_0x1499a0,JSON[_0x2a9c('0x11')](_0x5ca035));_0x2ffea6(_0x5ca035);})[_0x2a9c('0x16')](function(_0xfd1cdc){logger['error']('ShowTrunk',_0xfd1cdc[_0x2a9c('0x14')],_0x1499a0);_0x549e9e(_0x1b85ae[_0x2a9c('0x12')](0x1f4,_0xfd1cdc['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index f736138..64e79ad 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 _0x6661=['../../components/auth/service','./user-setting.controller','put','update','exports','express','Router'];(function(_0xa388eb,_0x3660c2){var _0x481ab0=function(_0x2ddade){while(--_0x2ddade){_0xa388eb['push'](_0xa388eb['shift']());}};_0x481ab0(++_0x3660c2);}(_0x6661,0x11d));var _0x1666=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x6661[_0x45783c];return _0x1161da;};'use strict';var express=require(_0x1666('0x0'));var router=express[_0x1666('0x1')]();var auth=require(_0x1666('0x2'));var controller=require(_0x1666('0x3'));router[_0x1666('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x1666('0x5')]);module[_0x1666('0x6')]=router; \ No newline at end of file +var _0x1afa=['put','/:id','isAuthenticated','update','express','Router','./user-setting.controller'];(function(_0x45289b,_0x2e2b71){var _0x8b611a=function(_0x42a85b){while(--_0x42a85b){_0x45289b['push'](_0x45289b['shift']());}};_0x8b611a(++_0x2e2b71);}(_0x1afa,0x138));var _0xa1af=function(_0x4c465a,_0x59403a){_0x4c465a=_0x4c465a-0x0;var _0x5223cb=_0x1afa[_0x4c465a];return _0x5223cb;};'use strict';var express=require(_0xa1af('0x0'));var router=express[_0xa1af('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa1af('0x2'));router[_0xa1af('0x3')](_0xa1af('0x4'),auth[_0xa1af('0x5')](),controller[_0xa1af('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 1eb5aab..f696fd0 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 _0x1317=['warning','info','debug','exports','TEXT','error'];(function(_0x3e76d1,_0x96e1ac){var _0x379c03=function(_0x5ea233){while(--_0x5ea233){_0x3e76d1['push'](_0x3e76d1['shift']());}};_0x379c03(++_0x96e1ac);}(_0x1317,0x149));var _0x7131=function(_0x5101f4,_0x5dd286){_0x5101f4=_0x5101f4-0x0;var _0x5aa86c=_0x1317[_0x5101f4];return _0x5aa86c;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x7131('0x0'),_0x7131('0x1'),_0x7131('0x2'),_0x7131('0x3')];module[_0x7131('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7131('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x308a=['UserId','warning','debug','exports','ENUM','BOOLEAN','TEXT','INTEGER'];(function(_0x50268e,_0xe4c01b){var _0x3352a1=function(_0x337082){while(--_0x337082){_0x50268e['push'](_0x50268e['shift']());}};_0x3352a1(++_0xe4c01b);}(_0x308a,0x1e9));var _0xa308=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x308a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0xa308('0x0'),'info',_0xa308('0x1')];module[_0xa308('0x2')]={'clientSideLoggingLevel':{'type':Sequelize[_0xa308('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa308('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xa308('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa308('0x6')],'unique':_0xa308('0x7')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 98a9afa..3866815 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 _0xf3dc=['then','error','stack','name','send','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','status','json','update'];(function(_0xf64e5,_0x4a3232){var _0x5f312c=function(_0x4d816c){while(--_0x4d816c){_0xf64e5['push'](_0xf64e5['shift']());}};_0x5f312c(++_0x4a3232);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x575446,_0x1a13fa){_0x575446=_0x575446-0x0;var _0x2fb644=_0xf3dc[_0x575446];return _0x2fb644;};'use strict';var _=require(_0xcf3d('0x0'));var Redis=require(_0xcf3d('0x1'));var logger=require(_0xcf3d('0x2'))('api');var config=require(_0xcf3d('0x3'));var db=require(_0xcf3d('0x4'))['db'];var socket=require(_0xcf3d('0x5'))(new Redis(config[_0xcf3d('0x6')]));require(_0xcf3d('0x7'))[_0xcf3d('0x8')](socket);config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x4e3427,_0x5bc3d6){_0x5bc3d6=_0x5bc3d6||0xc8;return function(_0x1a69de){if(_0x1a69de){return _0x4e3427[_0xcf3d('0x9')](_0x5bc3d6)[_0xcf3d('0xa')](_0x1a69de);}};}function saveUpdates(_0x1acad0){return function(_0x368e74){if(_0x368e74){return _0x368e74[_0xcf3d('0xb')](_0x1acad0)[_0xcf3d('0xc')](function(_0x4106fe){return _0x4106fe;});}return null;};}function handleEntityNotFound(_0x1b0dea){return function(_0x5e1d45){if(!_0x5e1d45){_0x1b0dea['sendStatus'](0x194);}return _0x5e1d45;};}function handleError(_0x4a52c3,_0x468f7e){_0x468f7e=_0x468f7e||0x1f4;return function(_0x5047b9){logger[_0xcf3d('0xd')](_0x5047b9[_0xcf3d('0xe')]);if(_0x5047b9[_0xcf3d('0xf')]){delete _0x5047b9[_0xcf3d('0xf')];}_0x4a52c3[_0xcf3d('0x9')](_0x468f7e)[_0xcf3d('0x10')](_0x5047b9);};}exports[_0xcf3d('0xb')]=function(_0x115fca,_0xd36708){if(_0x115fca['user']['role']!==_0xcf3d('0x11'))throw new Error(_0xcf3d('0x12'));if(isNaN(Number(_0x115fca[_0xcf3d('0x13')]['id'])))throw new Error(_0xcf3d('0x14'));return db[_0xcf3d('0x15')][_0xcf3d('0x16')]({'where':{'id':_0x115fca[_0xcf3d('0x13')]['id']}})[_0xcf3d('0xc')](handleEntityNotFound(_0xd36708,null))[_0xcf3d('0xc')](saveUpdates(_0x115fca[_0xcf3d('0x17')],null))['then'](respondWithResult(_0xd36708,null))['catch'](handleError(_0xd36708,null));}; \ No newline at end of file +var _0x55a5=['role','admin','Unauthorized','params','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','json','update','then','error','stack','user'];(function(_0x3b02cf,_0x41b354){var _0x27c8d3=function(_0x132c48){while(--_0x132c48){_0x3b02cf['push'](_0x3b02cf['shift']());}};_0x27c8d3(++_0x41b354);}(_0x55a5,0xf7));var _0x555a=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x55a5[_0x1e081a];return _0x428209;};'use strict';var _=require(_0x555a('0x0'));var Redis=require('ioredis');var logger=require(_0x555a('0x1'))(_0x555a('0x2'));var config=require(_0x555a('0x3'));var db=require(_0x555a('0x4'))['db'];var socket=require(_0x555a('0x5'))(new Redis(config[_0x555a('0x6')]));require(_0x555a('0x7'))[_0x555a('0x8')](socket);config[_0x555a('0x6')]=_[_0x555a('0x9')](config[_0x555a('0x6')],{'host':_0x555a('0xa'),'port':0x18eb});function respondWithResult(_0x365c37,_0x347461){_0x347461=_0x347461||0xc8;return function(_0x475b8d){if(_0x475b8d){return _0x365c37['status'](_0x347461)[_0x555a('0xb')](_0x475b8d);}};}function saveUpdates(_0xc16527){return function(_0x172117){if(_0x172117){return _0x172117[_0x555a('0xc')](_0xc16527)[_0x555a('0xd')](function(_0xd6ec1b){return _0xd6ec1b;});}return null;};}function handleEntityNotFound(_0x273c20){return function(_0x3e4af3){if(!_0x3e4af3){_0x273c20['sendStatus'](0x194);}return _0x3e4af3;};}function handleError(_0xc9e4b4,_0x2868ae){_0x2868ae=_0x2868ae||0x1f4;return function(_0x411ff1){logger[_0x555a('0xe')](_0x411ff1[_0x555a('0xf')]);if(_0x411ff1['name']){delete _0x411ff1['name'];}_0xc9e4b4['status'](_0x2868ae)['send'](_0x411ff1);};}exports[_0x555a('0xc')]=function(_0x29a124,_0xdf5d6f){if(_0x29a124[_0x555a('0x10')][_0x555a('0x11')]!==_0x555a('0x12'))throw new Error(_0x555a('0x13'));if(isNaN(Number(_0x29a124[_0x555a('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting']['find']({'where':{'id':_0x29a124[_0x555a('0x14')]['id']}})[_0x555a('0xd')](handleEntityNotFound(_0xdf5d6f,null))[_0x555a('0xd')](saveUpdates(_0x29a124['body'],null))[_0x555a('0xd')](respondWithResult(_0xdf5d6f,null))[_0x555a('0x15')](handleError(_0xdf5d6f,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 adc9ac4..4cb7370 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 _0x845c=['../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x334713,_0x5e6776){var _0x376838=function(_0x32b98a){while(--_0x32b98a){_0x334713['push'](_0x334713['shift']());}};_0x376838(++_0x5e6776);}(_0x845c,0x10e));var _0xc845=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x845c[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xc845('0x0'))['db'][_0xc845('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc845('0x2')](0x0);var events={'afterCreate':_0xc845('0x3'),'afterUpdate':_0xc845('0x4'),'afterDestroy':_0xc845('0x5')};function emitEvent(_0x163fe2){return function(_0x51299e,_0x419f15,_0x1d6645){UserSettingEvents[_0xc845('0x6')](_0x163fe2+':'+_0x51299e['id'],_0x51299e);UserSettingEvents[_0xc845('0x6')](_0x163fe2,_0x51299e);_0x1d6645(null);};}for(var e in events){if(events[_0xc845('0x7')](e)){var event=events[e];UserSetting[_0xc845('0x8')](e,emitEvent(event));}}module[_0xc845('0x9')]=UserSettingEvents; \ No newline at end of file +var _0xb8bf=['hasOwnProperty','events','../../mysqldb','save','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb8bf,0x135));var _0xfb8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb8bf[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xfb8b('0x0'));var UserSetting=require(_0xfb8b('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb8b('0x2'),'afterUpdate':_0xfb8b('0x3'),'afterDestroy':_0xfb8b('0x4')};function emitEvent(_0x21d19c){return function(_0x245df1,_0x15af54,_0x132efb){UserSettingEvents[_0xfb8b('0x5')](_0x21d19c+':'+_0x245df1['id'],_0x245df1);UserSettingEvents['emit'](_0x21d19c,_0x245df1);_0x132efb(null);};}for(var e in events){if(events[_0xfb8b('0x6')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index eb64630..8acaabe 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 _0x4e81=['./user-setting.attributes','exports','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x112a3e,_0x23f15c){var _0x577bfc=function(_0x4c47c0){while(--_0x4c47c0){_0x112a3e['push'](_0x112a3e['shift']());}};_0x577bfc(++_0x23f15c);}(_0x4e81,0x1bc));var _0x14e8=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0x4e81[_0x266ddc];return _0x39c1d7;};'use strict';var attributes=require(_0x14e8('0x0'));module[_0x14e8('0x1')]=function(_0x354aac){return _0x354aac['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2184fc){if(!_0x2184fc[_0x14e8('0x2')])_0x2184fc[_0x14e8('0x3')]=null;else if(_0x2184fc[_0x14e8('0x3')]===null)_0x2184fc[_0x14e8('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x0db9=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','UserSetting'];(function(_0x3ddd61,_0x2e79e9){var _0x49712d=function(_0x511735){while(--_0x511735){_0x3ddd61['push'](_0x3ddd61['shift']());}};_0x49712d(++_0x2e79e9);}(_0x0db9,0xa3));var _0x90db=function(_0x2650e9,_0xb91cc){_0x2650e9=_0x2650e9-0x0;var _0x3511c8=_0x0db9[_0x2650e9];return _0x3511c8;};'use strict';var attributes=require(_0x90db('0x0'));module['exports']=function(_0x48d572){return _0x48d572['define'](_0x90db('0x1'),attributes,{'tableName':_0x90db('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x553431){if(!_0x553431[_0x90db('0x3')])_0x553431['clientSideLoggingEnabledSince']=null;else if(_0x553431[_0x90db('0x4')]===null)_0x553431[_0x90db('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index f4fc5ab..10d9638 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 _0x8b98=['user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','length'];(function(_0x56f14,_0x4c1ee2){var _0x429577=function(_0x21d141){while(--_0x21d141){_0x56f14['push'](_0x56f14['shift']());}};_0x429577(++_0x4c1ee2);}(_0x8b98,0x1cc));var _0x88b9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x8b98[_0x4cf98e];return _0x1623ac;};'use strict';var UserSettingEvents=require(_0x88b9('0x0'));var events=['save',_0x88b9('0x1'),_0x88b9('0x2')];function createListener(_0x3a6662,_0x4d3e94){return function(_0x4dba57){_0x4d3e94[_0x88b9('0x3')](_0x3a6662,_0x4dba57);if(_0x3a6662===_0x88b9('0x4')){_0x4d3e94[_0x88b9('0x3')](_0x88b9('0x5')+_0x4dba57[_0x88b9('0x6')],_0x4dba57);}};}exports['register']=function(_0x26da1b){for(var _0x3666e3=0x0,_0x4d45b5=events[_0x88b9('0x7')];_0x3666e3<_0x4d45b5;_0x3666e3++){var _0x3c44be=events[_0x3666e3];var _0x486976=createListener(_0x88b9('0x8')+_0x3c44be,_0x26da1b);UserSettingEvents['on'](_0x3c44be,_0x486976);}}; \ No newline at end of file +var _0x2008=['user-setting:update:user-','UserId','register','./user-setting.events','save','remove','update','user-setting:update','emit'];(function(_0x4fbf1b,_0x4150ec){var _0x532847=function(_0x59ac2a){while(--_0x59ac2a){_0x4fbf1b['push'](_0x4fbf1b['shift']());}};_0x532847(++_0x4150ec);}(_0x2008,0x1e9));var _0x8200=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0x2008[_0x54ea7a];return _0x65a10d;};'use strict';var UserSettingEvents=require(_0x8200('0x0'));var events=[_0x8200('0x1'),_0x8200('0x2'),_0x8200('0x3')];function createListener(_0x30b4a5,_0xe0c62e){return function(_0x5f02f6){_0xe0c62e['emit'](_0x30b4a5,_0x5f02f6);if(_0x30b4a5===_0x8200('0x4')){_0xe0c62e[_0x8200('0x5')](_0x8200('0x6')+_0x5f02f6[_0x8200('0x7')],_0x5f02f6);}};}exports[_0x8200('0x8')]=function(_0x2b83ba){for(var _0x415cd9=0x0,_0x5c84e1=events['length'];_0x415cd9<_0x5c84e1;_0x415cd9++){var _0x25f7c8=events[_0x415cd9];var _0x99a0f7=createListener('user-setting:'+_0x25f7c8,_0x2b83ba);UserSettingEvents['on'](_0x25f7c8,_0x99a0f7);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index e6dc25a..045beeb 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 _0x4458=['/:id','update','changePassword','delete','removeTeams','destroy','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put'];(function(_0x324870,_0x11431a){var _0x2d81be=function(_0x4e1e24){while(--_0x4e1e24){_0x324870['push'](_0x324870['shift']());}};_0x2d81be(++_0x11431a);}(_0x4458,0x1e4));var _0x8445=function(_0x3bad26,_0x356e96){_0x3bad26=_0x3bad26-0x0;var _0x236ba2=_0x4458[_0x3bad26];return _0x236ba2;};'use strict';var multer=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var path=require(_0x8445('0x2'));var timeout=require(_0x8445('0x3'));var express=require(_0x8445('0x4'));var router=express[_0x8445('0x5')]();var fs_extra=require(_0x8445('0x6'));var auth=require(_0x8445('0x7'));var interaction=require(_0x8445('0x8'));var config=require(_0x8445('0x9'));var controller=require(_0x8445('0xa'));router['get']('/',auth[_0x8445('0xb')](),controller[_0x8445('0xc')]);router[_0x8445('0xd')]('/describe',auth['isAuthenticated'](),controller[_0x8445('0xe')]);router[_0x8445('0xd')](_0x8445('0xf'),auth['isAuthenticated'](),controller[_0x8445('0x10')]);router[_0x8445('0xd')]('/presence',auth[_0x8445('0xb')](),controller[_0x8445('0x11')]);router[_0x8445('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8445('0x12')]);router[_0x8445('0xd')](_0x8445('0x13'),controller[_0x8445('0x14')]);router[_0x8445('0xd')](_0x8445('0x15'),auth[_0x8445('0xb')](),controller['getOpenTabs']);router[_0x8445('0xd')](_0x8445('0x16'),auth[_0x8445('0xb')](),controller[_0x8445('0x17')]);router[_0x8445('0xd')](_0x8445('0x18'),auth[_0x8445('0xb')](),controller[_0x8445('0x19')]);router[_0x8445('0xd')](_0x8445('0x1a'),auth[_0x8445('0xb')](),controller[_0x8445('0x1b')]);router[_0x8445('0xd')](_0x8445('0x1c'),auth['isAuthenticated'](),controller[_0x8445('0x1d')]);router[_0x8445('0xd')]('/:id/recordings',auth[_0x8445('0xb')](),controller['getRecordings']);router[_0x8445('0xd')](_0x8445('0x1e'),auth[_0x8445('0xb')](),controller[_0x8445('0x1f')]);router['get'](_0x8445('0x20'),auth['isAuthenticated'](),controller[_0x8445('0x21')]);router[_0x8445('0xd')](_0x8445('0x22'),auth['isAuthenticated'](),controller[_0x8445('0x23')]);router[_0x8445('0xd')](_0x8445('0x24'),auth[_0x8445('0xb')](),controller[_0x8445('0x25')]);router[_0x8445('0xd')](_0x8445('0x26'),auth['isAuthenticated'](),controller[_0x8445('0x27')]);router[_0x8445('0xd')](_0x8445('0x28'),auth[_0x8445('0xb')](),controller[_0x8445('0x29')]);router['get'](_0x8445('0x2a'),auth['isAuthenticated'](),controller[_0x8445('0x2b')]);router['get'](_0x8445('0x2c'),auth[_0x8445('0xb')](),controller[_0x8445('0x2d')]);router['get'](_0x8445('0x2e'),auth[_0x8445('0xb')](),controller[_0x8445('0x2f')]);router[_0x8445('0xd')]('/:id/agents',auth[_0x8445('0xb')](),controller[_0x8445('0x30')]);router[_0x8445('0xd')](_0x8445('0x31'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x8445('0xd')](_0x8445('0x32'),auth['isAuthenticated'](),controller[_0x8445('0x33')]);router['get'](_0x8445('0x34'),auth[_0x8445('0xb')](),controller[_0x8445('0x35')]);router[_0x8445('0xd')](_0x8445('0x36'),auth[_0x8445('0xb')](),controller['getOpenchannelAccounts']);router[_0x8445('0xd')]('/:id/sms_accounts',auth[_0x8445('0xb')](),controller[_0x8445('0x37')]);router[_0x8445('0xd')](_0x8445('0x38'),auth[_0x8445('0xb')](),controller[_0x8445('0x39')]);router[_0x8445('0xd')](_0x8445('0x3a'),auth[_0x8445('0xb')](),controller[_0x8445('0x3b')]);router[_0x8445('0xd')](_0x8445('0x3c'),auth[_0x8445('0xb')](),controller['getScheduledCalls']);router[_0x8445('0xd')](_0x8445('0x3d'),auth[_0x8445('0xb')](),controller[_0x8445('0x3e')]);router[_0x8445('0x3f')](_0x8445('0x16'),auth[_0x8445('0xb')](),controller[_0x8445('0x40')]);router['post']('/',auth[_0x8445('0xb')](),controller[_0x8445('0x41')]);router[_0x8445('0x3f')]('/create_many',auth[_0x8445('0xb')](),controller[_0x8445('0x42')]);router[_0x8445('0x3f')]('/:id/queues',auth[_0x8445('0xb')](),controller[_0x8445('0x43')]);var upload=multer({'storage':multer[_0x8445('0x44')]({'destination':function(_0x3b56de,_0xdfac2c,_0x271afb){_0x271afb(null,path[_0x8445('0x45')](config[_0x8445('0x46')],'server/files/images/'));},'filename':function(_0x13b641,_0x359a16,_0x3c1797){_0x3c1797(null,util[_0x8445('0x47')](_0x8445('0x48'),Date[_0x8445('0x49')](),_0x359a16[_0x8445('0x4a')]));}})});router[_0x8445('0x3f')]('/:id/avatar',upload[_0x8445('0x4b')](_0x8445('0x4c')),controller[_0x8445('0x4d')]);router[_0x8445('0x3f')](_0x8445('0x4e'),auth['isAuthenticated'](),controller['login']);router[_0x8445('0x3f')](_0x8445('0x4f'),auth[_0x8445('0xb')](),controller[_0x8445('0x50')]);router[_0x8445('0x3f')]('/:id/pause',auth[_0x8445('0xb')](),controller['pause']);router[_0x8445('0x3f')](_0x8445('0x51'),auth['isAuthenticated'](),controller['unpause']);router[_0x8445('0x3f')](_0x8445('0x2c'),auth[_0x8445('0xb')](),controller[_0x8445('0x52')]);router[_0x8445('0x3f')](_0x8445('0x53'),auth['isAuthenticated'](),controller['addChatInteractions']);router['post'](_0x8445('0x54'),auth[_0x8445('0xb')](),controller[_0x8445('0x55')]);router[_0x8445('0x3f')](_0x8445('0x56'),auth['isAuthenticated'](),controller[_0x8445('0x57')]);router[_0x8445('0x3f')](_0x8445('0x58'),auth['isAuthenticated'](),controller[_0x8445('0x59')]);router[_0x8445('0x3f')](_0x8445('0x5a'),auth[_0x8445('0xb')](),controller[_0x8445('0x5b')]);router[_0x8445('0x3f')](_0x8445('0x5c'),auth[_0x8445('0xb')](),controller[_0x8445('0x5d')]);router['post'](_0x8445('0x32'),auth[_0x8445('0xb')](),controller[_0x8445('0x5e')]);router[_0x8445('0x3f')](_0x8445('0x34'),auth[_0x8445('0xb')](),controller[_0x8445('0x5f')]);router[_0x8445('0x3f')](_0x8445('0x36'),auth[_0x8445('0xb')](),controller[_0x8445('0x60')]);router['post']('/:id/sms_accounts',auth[_0x8445('0xb')](),controller[_0x8445('0x61')]);router[_0x8445('0x3f')]('/:id/chat_websites',auth[_0x8445('0xb')](),controller[_0x8445('0x62')]);router[_0x8445('0x3f')](_0x8445('0x3a'),auth[_0x8445('0xb')](),controller[_0x8445('0x63')]);router['post'](_0x8445('0x3d'),auth[_0x8445('0xb')](),controller['createApiKey']);router[_0x8445('0x64')](_0x8445('0x65'),auth['isAuthenticated'](),controller[_0x8445('0x66')]);router[_0x8445('0x64')]('/:id/password',auth['isAuthenticated'](),controller[_0x8445('0x67')]);router[_0x8445('0x68')](_0x8445('0x18'),auth[_0x8445('0xb')](),controller['removeQueues']);router[_0x8445('0x68')](_0x8445('0x2c'),auth[_0x8445('0xb')](),controller[_0x8445('0x69')]);router['delete'](_0x8445('0x65'),auth[_0x8445('0xb')](),controller[_0x8445('0x6a')]);router[_0x8445('0x68')]('/:id/chat_interactions',auth[_0x8445('0xb')](),controller['removeChatInteractions']);router[_0x8445('0x68')](_0x8445('0x54'),auth[_0x8445('0xb')](),controller['removeMailInteractions']);router[_0x8445('0x68')](_0x8445('0x56'),auth[_0x8445('0xb')](),controller[_0x8445('0x6b')]);router[_0x8445('0x68')](_0x8445('0x58'),auth[_0x8445('0xb')](),controller[_0x8445('0x6c')]);router[_0x8445('0x68')]('/:id/openchannel_interactions',auth[_0x8445('0xb')](),controller[_0x8445('0x6d')]);router['delete']('/:id/whatsapp_interactions',auth[_0x8445('0xb')](),controller[_0x8445('0x6e')]);router[_0x8445('0x68')](_0x8445('0x32'),auth[_0x8445('0xb')](),controller['removeFaxAccounts']);router[_0x8445('0x68')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x8445('0x68')](_0x8445('0x36'),auth['isAuthenticated'](),controller[_0x8445('0x6f')]);router[_0x8445('0x68')](_0x8445('0x70'),auth['isAuthenticated'](),controller[_0x8445('0x71')]);router[_0x8445('0x68')](_0x8445('0x38'),auth['isAuthenticated'](),controller[_0x8445('0x72')]);router[_0x8445('0x68')]('/:id/whatsapp_accounts',auth[_0x8445('0xb')](),controller[_0x8445('0x73')]);router[_0x8445('0x68')]('/:id/api_key',auth[_0x8445('0xb')](),controller['removeApiKey']);module[_0x8445('0x74')]=router; \ No newline at end of file +var _0xe1aa=['join','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/login','logout','/:id/pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','put','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','describe','/whoami','get','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getScheduledCalls','/:id/api_key','post','create','/:id/queues','addQueues','diskStorage'];(function(_0x2ec7f2,_0xe24da3){var _0x29de00=function(_0x383338){while(--_0x383338){_0x2ec7f2['push'](_0x2ec7f2['shift']());}};_0x29de00(++_0xe24da3);}(_0xe1aa,0xfc));var _0xae1a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xe1aa[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xae1a('0x2'));var router=express[_0xae1a('0x3')]();var fs_extra=require(_0xae1a('0x4'));var auth=require(_0xae1a('0x5'));var interaction=require(_0xae1a('0x6'));var config=require('../../config/environment');var controller=require(_0xae1a('0x7'));router['get']('/',auth[_0xae1a('0x8')](),controller[_0xae1a('0x9')]);router['get']('/describe',auth[_0xae1a('0x8')](),controller[_0xae1a('0xa')]);router['get'](_0xae1a('0xb'),auth[_0xae1a('0x8')](),controller['whoami']);router[_0xae1a('0xc')](_0xae1a('0xd'),auth[_0xae1a('0x8')](),controller[_0xae1a('0xe')]);router['get'](_0xae1a('0xf'),auth[_0xae1a('0x8')](),controller['show']);router[_0xae1a('0xc')](_0xae1a('0x10'),controller[_0xae1a('0x11')]);router[_0xae1a('0xc')](_0xae1a('0x12'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x13')]);router[_0xae1a('0xc')](_0xae1a('0x14'),auth[_0xae1a('0x8')](),controller['getContacts']);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0xae1a('0x15')]);router[_0xae1a('0xc')](_0xae1a('0x16'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x17')]);router['get'](_0xae1a('0x18'),auth[_0xae1a('0x8')](),controller['getGroups']);router[_0xae1a('0xc')](_0xae1a('0x19'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x1a')]);router[_0xae1a('0xc')](_0xae1a('0x1b'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x1c')]);router[_0xae1a('0xc')](_0xae1a('0x1d'),auth['isAuthenticated'](),controller[_0xae1a('0x1e')]);router[_0xae1a('0xc')](_0xae1a('0x1f'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x20')]);router['get'](_0xae1a('0x21'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x22')]);router['get'](_0xae1a('0x23'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x24')]);router[_0xae1a('0xc')](_0xae1a('0x25'),auth[_0xae1a('0x8')](),controller['getFaxInteractions']);router[_0xae1a('0xc')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xae1a('0x26')]);router[_0xae1a('0xc')](_0xae1a('0x27'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x28')]);router['get'](_0xae1a('0x29'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x2a')]);router['get']('/:id/agents',auth['isAuthenticated'](),controller[_0xae1a('0x2b')]);router[_0xae1a('0xc')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xae1a('0x2c')]);router[_0xae1a('0xc')](_0xae1a('0x2d'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x2e')]);router[_0xae1a('0xc')](_0xae1a('0x2f'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xae1a('0xc')](_0xae1a('0x30'),auth[_0xae1a('0x8')](),controller['getOpenchannelAccounts']);router[_0xae1a('0xc')](_0xae1a('0x31'),auth[_0xae1a('0x8')](),controller['getSmsAccounts']);router[_0xae1a('0xc')](_0xae1a('0x32'),auth['isAuthenticated'](),controller[_0xae1a('0x33')]);router[_0xae1a('0xc')](_0xae1a('0x34'),auth[_0xae1a('0x8')](),controller['getWhatsappAccounts']);router['get']('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xae1a('0x35')]);router['get'](_0xae1a('0x36'),auth['isAuthenticated'](),controller['getApiKey']);router[_0xae1a('0x37')](_0xae1a('0x14'),auth[_0xae1a('0x8')](),controller['addContacts']);router[_0xae1a('0x37')]('/',auth[_0xae1a('0x8')](),controller[_0xae1a('0x38')]);router[_0xae1a('0x37')]('/create_many',auth['isAuthenticated'](),controller['bulkCreate']);router[_0xae1a('0x37')](_0xae1a('0x39'),auth['isAuthenticated'](),controller[_0xae1a('0x3a')]);var upload=multer({'storage':multer[_0xae1a('0x3b')]({'destination':function(_0x283148,_0x32e596,_0x5e104b){_0x5e104b(null,path[_0xae1a('0x3c')](config['root'],_0xae1a('0x3d')));},'filename':function(_0x15a28c,_0x15349f,_0x1559ca){_0x1559ca(null,util[_0xae1a('0x3e')](_0xae1a('0x3f'),Date[_0xae1a('0x40')](),_0x15349f['originalname']));}})});router[_0xae1a('0x37')](_0xae1a('0x10'),upload[_0xae1a('0x41')](_0xae1a('0x42')),controller[_0xae1a('0x43')]);router[_0xae1a('0x37')](_0xae1a('0x44'),auth['isAuthenticated'](),controller['login']);router[_0xae1a('0x37')]('/:id/logout',auth[_0xae1a('0x8')](),controller[_0xae1a('0x45')]);router[_0xae1a('0x37')](_0xae1a('0x46'),auth[_0xae1a('0x8')](),controller['pause']);router['post'](_0xae1a('0x47'),auth['isAuthenticated'](),controller[_0xae1a('0x48')]);router[_0xae1a('0x37')]('/:id/teams',auth[_0xae1a('0x8')](),controller['addTeams']);router['post'](_0xae1a('0x49'),auth['isAuthenticated'](),controller[_0xae1a('0x4a')]);router['post'](_0xae1a('0x4b'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x4c')]);router[_0xae1a('0x37')](_0xae1a('0x4d'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xae1a('0x4e')]);router[_0xae1a('0x37')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0xae1a('0x37')](_0xae1a('0x4f'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x50')]);router[_0xae1a('0x37')](_0xae1a('0x2d'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x51')]);router[_0xae1a('0x37')](_0xae1a('0x2f'),auth[_0xae1a('0x8')](),controller['addMailAccounts']);router[_0xae1a('0x37')]('/:id/openchannel_accounts',auth[_0xae1a('0x8')](),controller[_0xae1a('0x52')]);router[_0xae1a('0x37')](_0xae1a('0x31'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x53')]);router[_0xae1a('0x37')](_0xae1a('0x32'),auth[_0xae1a('0x8')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth[_0xae1a('0x8')](),controller[_0xae1a('0x54')]);router['post'](_0xae1a('0x36'),auth[_0xae1a('0x8')](),controller['createApiKey']);router[_0xae1a('0x55')](_0xae1a('0xf'),auth[_0xae1a('0x8')](),controller['update']);router[_0xae1a('0x55')]('/:id/password',auth['isAuthenticated'](),controller[_0xae1a('0x56')]);router[_0xae1a('0x57')](_0xae1a('0x39'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x58')]);router[_0xae1a('0x57')]('/:id/teams',auth[_0xae1a('0x8')](),controller[_0xae1a('0x59')]);router[_0xae1a('0x57')](_0xae1a('0xf'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x5a')]);router[_0xae1a('0x57')](_0xae1a('0x49'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x5b')]);router[_0xae1a('0x57')](_0xae1a('0x4b'),auth[_0xae1a('0x8')](),controller['removeMailInteractions']);router[_0xae1a('0x57')](_0xae1a('0x4d'),auth[_0xae1a('0x8')](),controller['removeFaxInteractions']);router[_0xae1a('0x57')](_0xae1a('0x5c'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x5d')]);router[_0xae1a('0x57')](_0xae1a('0x5e'),auth['isAuthenticated'](),controller[_0xae1a('0x5f')]);router[_0xae1a('0x57')]('/:id/whatsapp_interactions',auth[_0xae1a('0x8')](),controller['removeWhatsappInteractions']);router[_0xae1a('0x57')](_0xae1a('0x2d'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x60')]);router[_0xae1a('0x57')](_0xae1a('0x2f'),auth['isAuthenticated'](),controller[_0xae1a('0x61')]);router[_0xae1a('0x57')](_0xae1a('0x30'),auth['isAuthenticated'](),controller[_0xae1a('0x62')]);router[_0xae1a('0x57')](_0xae1a('0x31'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x63')]);router[_0xae1a('0x57')](_0xae1a('0x32'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x64')]);router[_0xae1a('0x57')]('/:id/whatsapp_accounts',auth[_0xae1a('0x8')](),controller[_0xae1a('0x65')]);router[_0xae1a('0x57')](_0xae1a('0x36'),auth[_0xae1a('0x8')](),controller[_0xae1a('0x66')]);module[_0xae1a('0x67')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 15fdbf3..ef11ca2 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'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 0ebdbdd..8371d64 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 _0xfdb8=['idle','unknown','unavailable','ringing','voiceStatus','busy','slice','toUpperCase','field','ui.','InteractionId','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','jayson/promise','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','defaults','localhost','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','undefined','limit','offset','count','set','update','then','agent','userNotification:recalc:','destroy','get','role','Users','user','Agents','Telephones','filter','ignore','map','value','includes','find','UserProfileResource','sendStatus','stack','name','send','index','User','rawAttributes','fieldName','type','password','where','includeAll','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','dataValues','sms','mail','openchannel','whatsapp','all','show','params','differenceBy','salt','keys','filters','model','intersection','fields','fax','body','describe','addContacts','findById','securePassword','validatePasswordPattern','max','internal','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','113','110','104','106','109','100','111','114','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','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','telephone','UserProfileSection','changePassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Wrong\x20credentials','Sequelize','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','channel','online','loginInPause','interface','Unknown\x20channel','add','capitalize','toLowerCase','ids','penalty','spread','emit','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','isArray','QueueId','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','existsSync','root','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','findOne','CmContact','sort','pick','merge','List','Tag','color','tag','nolimit','Queue','Queues','Unknown\x20role','getVoiceQueuesRt','hasOwnProperty','ChatGroup','options','getGroups','getRecordings','VoiceRecording','order','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','resolve','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','getLists','CmList','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$lt','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','createApiKey','generateApiKey','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','isEmpty','inbound','flatten','getAgents','lower','toString','asc','desc','substring','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0xfdb8,0x1a1));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x8fdb('0x0'));var util=require(_0x8fdb('0x1'));var path=require(_0x8fdb('0x2'));var fs=require('fs');var _=require(_0x8fdb('0x3'));var squel=require('squel');var jayson=require(_0x8fdb('0x4'));var Redis=require(_0x8fdb('0x5'));var authService=require(_0x8fdb('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x8fdb('0x7'))(_0x8fdb('0x8'));var utils=require(_0x8fdb('0x9'));var config=require(_0x8fdb('0xa'));var licenseUtil=require(_0x8fdb('0xb'));var APIBadRequestError=require(_0x8fdb('0xc'))[_0x8fdb('0xd')];var APINotFoundError=require(_0x8fdb('0xc'))['APINotFoundError'];var APIHandleError=require(_0x8fdb('0xc'))[_0x8fdb('0xe')];var db=require(_0x8fdb('0xf'))['db'];var socket=require(_0x8fdb('0x10'))(new Redis(config[_0x8fdb('0x11')]));require('./user.socket')['register'](socket);config[_0x8fdb('0x11')]=_[_0x8fdb('0x12')](config[_0x8fdb('0x11')],{'host':_0x8fdb('0x13'),'port':0x18eb});var amiClient=jayson[_0x8fdb('0x14')][_0x8fdb('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0x31ddfe,_0xf8dd0e,_0xaa56fa,_0x3f4f37){return new Promise(function(_0x5aef57,_0x408630){var _0x26c9fd=_0x3f4f37||amiClient;return _0x26c9fd[_0x8fdb('0x16')](_0x31ddfe,_0xaa56fa)['then'](function(_0x33be0d){logger[_0x8fdb('0x17')](_0x8fdb('0x18'),_0xf8dd0e,_0x8fdb('0x19'));logger[_0x8fdb('0x1a')](_0x8fdb('0x1b'),_0xf8dd0e,_0x8fdb('0x19'),JSON['stringify'](_0x33be0d));if(_0x33be0d[_0x8fdb('0x1c')]){if(_0x33be0d[_0x8fdb('0x1c')]['code']===0x1f4){logger[_0x8fdb('0x1c')](_0x8fdb('0x18'),_0xf8dd0e,_0x33be0d[_0x8fdb('0x1c')][_0x8fdb('0x1d')]);return _0x408630(_0x33be0d['error'][_0x8fdb('0x1d')]);}logger[_0x8fdb('0x1c')](_0x8fdb('0x18'),_0xf8dd0e,_0x33be0d[_0x8fdb('0x1c')][_0x8fdb('0x1d')]);return _0x5aef57(_0x33be0d[_0x8fdb('0x1c')]['message']);}else{logger[_0x8fdb('0x17')](_0x8fdb('0x18'),_0xf8dd0e,_0x8fdb('0x19'));_0x5aef57(_0x33be0d[_0x8fdb('0x1e')][_0x8fdb('0x1d')]);}})[_0x8fdb('0x1f')](function(_0x1f2a31){logger['error']('User,\x20%s,\x20%s',_0xf8dd0e,_0x1f2a31);_0x408630(_0x1f2a31);});});}function respondWithStatusCode(_0x39c406,_0x1ca052){_0x1ca052=_0x1ca052||0xcc;return function(_0x266873){if(_0x266873){return _0x39c406['sendStatus'](_0x1ca052);}return _0x39c406[_0x8fdb('0x20')](_0x1ca052)[_0x8fdb('0x21')]();};}function respondWithResult(_0x2e1e44,_0x559f43){_0x559f43=_0x559f43||0xc8;return function(_0x2c64bd){if(_0x2c64bd){return _0x2e1e44['status'](_0x559f43)[_0x8fdb('0x22')](_0x2c64bd);}};}function respondWithFilteredResult(_0x56ac9f,_0x50545c){return function(_0x3101f0){if(_0x3101f0){var _0x8e597e=typeof _0x50545c['offset']===_0x8fdb('0x23')&&typeof _0x50545c[_0x8fdb('0x24')]===_0x8fdb('0x23');var _0x5d26d5=_0x3101f0['count'];var _0x5e126b=_0x8e597e?0x0:_0x50545c[_0x8fdb('0x25')];var _0x3d0f1a=_0x8e597e?_0x3101f0[_0x8fdb('0x26')]:_0x50545c['offset']+_0x50545c[_0x8fdb('0x24')];var _0x19a2df;if(_0x3d0f1a>=_0x5d26d5){_0x3d0f1a=_0x5d26d5;_0x19a2df=0xc8;}else{_0x19a2df=0xce;}_0x56ac9f['status'](_0x19a2df);return _0x56ac9f[_0x8fdb('0x27')]('Content-Range',_0x5e126b+'-'+_0x3d0f1a+'/'+_0x5d26d5)[_0x8fdb('0x22')](_0x3101f0);}return null;};}function saveUpdates(_0x74bf4a){return function(_0x45e297){if(_0x45e297){return _0x45e297[_0x8fdb('0x28')](_0x74bf4a)[_0x8fdb('0x29')](function(_0xbf0143){if(_0xbf0143['role']===_0x8fdb('0x2a')){socket['emit'](_0x8fdb('0x2b')+_0xbf0143['id'],_0xbf0143);}return _0xbf0143;});}return null;};}function removeEntity(_0x512354){return function(_0x54a322){if(_0x54a322){return _0x54a322[_0x8fdb('0x2c')]()[_0x8fdb('0x29')](function(){var _0x9824b3=_0x54a322[_0x8fdb('0x2d')]({'plain':!![]});if(_0x9824b3[_0x8fdb('0x2e')]==='admin')return;var _0x2fe19f=[{'name':_0x8fdb('0x2f'),'value':_0x8fdb('0x30'),'ignore':!![]},{'name':_0x8fdb('0x31'),'value':_0x8fdb('0x2a'),'ignore':![]},{'name':_0x8fdb('0x32'),'value':'telephone','ignore':![]}];var _0x390feb=_(_0x2fe19f)[_0x8fdb('0x33')](_0x8fdb('0x34'))[_0x8fdb('0x35')](_0x8fdb('0x36'))[_0x8fdb('0x36')]();if(_[_0x8fdb('0x37')](_0x390feb,_0x9824b3[_0x8fdb('0x2e')])){return;}var _0x22368c=_[_0x8fdb('0x38')](_0x2fe19f,[_0x8fdb('0x36'),_0x9824b3[_0x8fdb('0x2e')]])['name'];return db[_0x8fdb('0x39')][_0x8fdb('0x2c')]({'where':{'type':_0x22368c,'resourceId':_0x9824b3['id']}})[_0x8fdb('0x29')](function(){return _0x54a322;});})[_0x8fdb('0x29')](function(){_0x512354[_0x8fdb('0x20')](0xcc)[_0x8fdb('0x21')]();});}};}function handleEntityNotFound(_0x4b88fd){return function(_0x25bf0e){if(!_0x25bf0e){_0x4b88fd[_0x8fdb('0x3a')](0x194);}return _0x25bf0e;};}function handleError(_0x16d63d,_0x454c79){_0x454c79=_0x454c79||0x1f4;return function(_0x64e605){logger['error'](_0x64e605[_0x8fdb('0x3b')]);if(_0x64e605[_0x8fdb('0x3c')]){delete _0x64e605[_0x8fdb('0x3c')];}_0x16d63d[_0x8fdb('0x20')](_0x454c79)[_0x8fdb('0x3d')](_0x64e605);};}exports[_0x8fdb('0x3e')]=function(_0x47916f,_0x361d86){var _0x24ed6c={},_0x49c423={'count':0x0,'rows':[]};var _0x3224aa=_(db[_0x8fdb('0x3f')][_0x8fdb('0x40')])['map'](function(_0x36e756){return{'name':_0x36e756[_0x8fdb('0x41')],'type':_0x36e756[_0x8fdb('0x42')]['key']};})[_0x8fdb('0x33')](function(_0xb7c745){return!_['includes']([_0x8fdb('0x43'),'salt'],_0xb7c745[_0x8fdb('0x3c')]);})[_0x8fdb('0x36')]();_0x24ed6c=qs['getOptions'](_0x3224aa,_0x47916f);var _0x50e116={'where':_0x24ed6c[_0x8fdb('0x44')]};return db['User']['count'](_0x50e116)[_0x8fdb('0x29')](function(_0x4cf021){_0x49c423[_0x8fdb('0x26')]=_0x4cf021;if(_0x47916f['query'][_0x8fdb('0x45')]){_0x24ed6c[_0x8fdb('0x46')]=[{'all':!![]}];}if(_0x47916f[_0x8fdb('0x47')][_0x8fdb('0x48')]===_0x8fdb('0x49')){_0x24ed6c[_0x8fdb('0x46')]=[{'model':db[_0x8fdb('0x4a')],'as':_0x8fdb('0x48')}];}if(!_[_0x8fdb('0x37')](_0x24ed6c[_0x8fdb('0x4b')],'id')){_0x24ed6c[_0x8fdb('0x4b')][_0x8fdb('0x4c')]('id');}return db['User'][_0x8fdb('0x4d')](_0x24ed6c);})[_0x8fdb('0x29')](function(_0x4c81ce){_0x49c423[_0x8fdb('0x4e')]=_0x4c81ce;if(_0x47916f[_0x8fdb('0x47')][_0x8fdb('0x4f')]===_0x8fdb('0x49')){var _0x2302c5=[];for(var _0x55b0de=0x0;_0x55b0de<_0x49c423[_0x8fdb('0x4e')][_0x8fdb('0x50')];_0x55b0de++){_0x2302c5[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x51'),_0x49c423['rows'][_0x55b0de][_0x8fdb('0x52')]));_0x2302c5[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x53'),_0x49c423[_0x8fdb('0x4e')][_0x55b0de][_0x8fdb('0x52')]));_0x2302c5[_0x8fdb('0x4c')](get_open_tabs('fax',_0x49c423['rows'][_0x55b0de]['dataValues']));_0x2302c5['push'](get_open_tabs(_0x8fdb('0x54'),_0x49c423[_0x8fdb('0x4e')][_0x55b0de][_0x8fdb('0x52')]));_0x2302c5['push'](get_open_tabs(_0x8fdb('0x55'),_0x49c423['rows'][_0x55b0de]['dataValues']));_0x2302c5[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x56'),_0x49c423[_0x8fdb('0x4e')][_0x55b0de][_0x8fdb('0x52')]));}return Promise[_0x8fdb('0x57')](_0x2302c5)[_0x8fdb('0x29')](function(){return _0x49c423;});}else{return _0x49c423;}})['then'](respondWithFilteredResult(_0x361d86,_0x24ed6c))[_0x8fdb('0x1f')](handleError(_0x361d86,null));};exports[_0x8fdb('0x58')]=function(_0x4264aa,_0x921358){var _0x9213={'raw':![],'where':{'id':_0x4264aa[_0x8fdb('0x59')]['id']}},_0x3fd56e={};_0x3fd56e['model']=_[_0x8fdb('0x5a')](_['keys'](db[_0x8fdb('0x3f')][_0x8fdb('0x40')]),[_0x8fdb('0x43'),_0x8fdb('0x5b')]);_0x3fd56e[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x4264aa[_0x8fdb('0x47')]);_0x3fd56e[_0x8fdb('0x5d')]=_['intersection'](_0x3fd56e[_0x8fdb('0x5e')],_0x3fd56e[_0x8fdb('0x47')]);_0x9213[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x3fd56e[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x4264aa[_0x8fdb('0x47')]['fields']));_0x9213[_0x8fdb('0x4b')]=_0x9213[_0x8fdb('0x4b')]['length']?_0x9213[_0x8fdb('0x4b')]:_0x3fd56e[_0x8fdb('0x5e')];if(_0x4264aa[_0x8fdb('0x47')][_0x8fdb('0x45')]){_0x9213[_0x8fdb('0x46')]=[{'all':!![]}];}if(_0x4264aa['query'][_0x8fdb('0x48')]===_0x8fdb('0x49')){_0x9213[_0x8fdb('0x46')]=[{'model':db['UserSetting'],'as':_0x8fdb('0x48')}];}_0x9213=_['merge']({},_0x9213,_0x4264aa['options']);if(!_[_0x8fdb('0x37')](_0x9213[_0x8fdb('0x4b')],'id')){_0x9213[_0x8fdb('0x4b')][_0x8fdb('0x4c')]('id');}return db['User']['find'](_0x9213)[_0x8fdb('0x29')](handleEntityNotFound(_0x921358,null))[_0x8fdb('0x29')](function(_0x2e0f3e){var _0x173996=[];values=_0x2e0f3e;if(_0x4264aa[_0x8fdb('0x47')][_0x8fdb('0x4f')]===_0x8fdb('0x49')){_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x51'),_0x2e0f3e['dataValues']));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x53'),_0x2e0f3e[_0x8fdb('0x52')]));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x55'),_0x2e0f3e[_0x8fdb('0x52')]));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x56'),_0x2e0f3e['dataValues']));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x61'),_0x2e0f3e[_0x8fdb('0x52')]));_0x173996[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x54'),_0x2e0f3e['dataValues']));return Promise[_0x8fdb('0x57')](_0x173996);}else{return values;}})['then'](function(){return values;})[_0x8fdb('0x29')](respondWithResult(_0x921358,null))[_0x8fdb('0x1f')](handleError(_0x921358,null));};exports['update']=function(_0x44f2d1,_0x5a095d){if(_0x44f2d1[_0x8fdb('0x62')]['id']){delete _0x44f2d1[_0x8fdb('0x62')]['id'];}delete _0x44f2d1[_0x8fdb('0x62')][_0x8fdb('0x2e')];return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x44f2d1['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x5a095d,null))[_0x8fdb('0x29')](saveUpdates(_0x44f2d1[_0x8fdb('0x62')],null))[_0x8fdb('0x29')](respondWithResult(_0x5a095d,null))[_0x8fdb('0x1f')](handleError(_0x5a095d,null));};exports[_0x8fdb('0x63')]=function(_0xa6d3b2,_0x4f2d1a){return db[_0x8fdb('0x3f')]['describe']()[_0x8fdb('0x29')](respondWithResult(_0x4f2d1a,null))['catch'](handleError(_0x4f2d1a,null));};exports[_0x8fdb('0x64')]=function(_0x2ec7f8,_0x4ce38c){return db['User']['find']({'where':{'id':_0x2ec7f8['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x4ce38c,null))[_0x8fdb('0x29')](function(_0x127fd7){if(_0x127fd7){return _0x127fd7[_0x8fdb('0x64')](_0x2ec7f8['body']['ids'],_['omit'](_0x2ec7f8['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4ce38c,null))[_0x8fdb('0x1f')](handleError(_0x4ce38c,null));};function validateUser(_0x43494d){return new Promise(function(_0x622aac,_0x256a59){if(_0x43494d['internal'])return _0x622aac(_0x43494d);return db['Setting'][_0x8fdb('0x65')](0x1)[_0x8fdb('0x29')](function(_0x27bd5f){if(_0x27bd5f[_0x8fdb('0x66')])authService[_0x8fdb('0x67')](_0x43494d[_0x8fdb('0x43')]);db['User'][_0x8fdb('0x68')](_0x8fdb('0x69'))[_0x8fdb('0x29')](function(_0x207f42){if(_[_0x8fdb('0x6a')](_0x207f42)){_0x43494d[_0x8fdb('0x69')]=_0x27bd5f['min_internal']||0x1;return;}if(_[_0x8fdb('0x6a')](_0x27bd5f[_0x8fdb('0x6b')])||_0x27bd5f['min_internal']===_0x207f42){_0x43494d[_0x8fdb('0x69')]=_0x207f42+0x1;return;}if(_0x27bd5f[_0x8fdb('0x6b')]>_0x207f42){_0x43494d['internal']=_0x27bd5f[_0x8fdb('0x6b')];return;}return db[_0x8fdb('0x6c')]['query']('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)',{'type':db[_0x8fdb('0x6c')][_0x8fdb('0x6d')][_0x8fdb('0x6e')]})[_0x8fdb('0x29')](function(_0x5504f1){if(_0x5504f1&&_0x5504f1[_0x8fdb('0x50')]){for(var _0x4e5a81=0x0,_0x337e40=_0x5504f1[_0x8fdb('0x50')];_0x4e5a81<_0x337e40&&_['isNil'](_0x43494d['internal']);_0x4e5a81++){if(_0x27bd5f['min_internal']<=_0x5504f1[_0x4e5a81][_0x8fdb('0x6f')]){_0x43494d['internal']=_0x5504f1[_0x4e5a81][_0x8fdb('0x6f')];}else if(_0x27bd5f[_0x8fdb('0x6b')]>_0x5504f1[_0x4e5a81][_0x8fdb('0x6f')]&&_0x27bd5f[_0x8fdb('0x6b')]<=_0x5504f1[_0x4e5a81]['to']){_0x43494d[_0x8fdb('0x69')]=_0x27bd5f[_0x8fdb('0x6b')];}}}if(_[_0x8fdb('0x6a')](_0x43494d[_0x8fdb('0x69')])){_0x43494d[_0x8fdb('0x69')]=_0x207f42+0x1;}return _0x622aac(_0x43494d);});});})[_0x8fdb('0x1f')](function(_0x5d640e){_0x256a59(_0x5d640e);});});}function updateUser(_0x2b6f95){return new Promise(function(_0x50f42a,_0x4121d9){try{if(_0x2b6f95[_0x8fdb('0x70')]){_0x2b6f95[_0x8fdb('0x71')]=_0x2b6f95['internal'];_0x2b6f95[_0x8fdb('0x72')]={'mailbox':_0x2b6f95[_0x8fdb('0x69')],'password':_0x2b6f95['password'],'fullname':_0x2b6f95[_0x8fdb('0x73')],'email':_0x2b6f95[_0x8fdb('0x74')]};}if(_0x2b6f95[_0x8fdb('0x2e')]===_0x8fdb('0x2a')){if(!_0x2b6f95[_0x8fdb('0x75')])_0x2b6f95['permissions']=[_0x8fdb('0x76'),_0x8fdb('0x77'),'103',_0x8fdb('0x78'),_0x8fdb('0x79'),_0x8fdb('0x7a'),'105',_0x8fdb('0x7b'),'107','108',_0x8fdb('0x7c'),_0x8fdb('0x7d'),_0x8fdb('0x7e'),_0x8fdb('0x7f'),'115'];}_0x50f42a(_0x2b6f95);}catch(_0x408f91){_0x4121d9(_0x408f91);}});}exports[_0x8fdb('0x80')]=function(_0x401caf,_0x4b7883){if(_0x401caf[_0x8fdb('0x30')]['role']===_0x8fdb('0x2a'))throw new Error(_0x8fdb('0x81'));if(_0x401caf[_0x8fdb('0x62')][_0x8fdb('0x2e')]===_0x8fdb('0x30')&&_0x401caf['user'][_0x8fdb('0x2e')]!==_0x8fdb('0x82')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x401caf[_0x8fdb('0x62')][_0x8fdb('0x2e')]===_0x8fdb('0x82')&&_0x401caf[_0x8fdb('0x30')]['role']!==_0x8fdb('0x82')){throw new Error(_0x8fdb('0x83'));}return licenseUtil[_0x8fdb('0x84')]([_0x401caf[_0x8fdb('0x62')]])[_0x8fdb('0x29')](function(){return validateUser(_0x401caf[_0x8fdb('0x62')]);})[_0x8fdb('0x29')](function(_0x471b68){return updateUser(_0x471b68)['then'](function(_0x8cabb4){if(_0x8cabb4[_0x8fdb('0x2e')]==='admin'){_0x8cabb4[_0x8fdb('0x85')]=_0x401caf['user'][_0x8fdb('0x85')];delete _0x8cabb4['userProfileId'];}return _0x8cabb4;});})[_0x8fdb('0x29')](function(_0x16e257){return db[_0x8fdb('0x3f')][_0x8fdb('0x80')](_0x16e257,{'include':[{'model':db[_0x8fdb('0x72')],'as':_0x8fdb('0x72')}]});})[_0x8fdb('0x29')](function(_0x381f9b){if(_0x401caf[_0x8fdb('0x62')][_0x8fdb('0x2e')]===_0x8fdb('0x30'))return _0x381f9b;if(_0x401caf[_0x8fdb('0x30')]['role']!=='user')return _0x381f9b;return db['UserProfileSection']['find']({'where':{'name':_0x381f9b[_0x8fdb('0x2e')]===_0x8fdb('0x2a')?_0x8fdb('0x31'):'Telephones','userProfileId':_0x401caf[_0x8fdb('0x30')][_0x8fdb('0x86')]},'raw':!![]})['then'](function(_0xc71b6c){if(!_0xc71b6c||_0xc71b6c[_0x8fdb('0x87')]!=0x0)return _0x381f9b;return db['UserProfileResource'][_0x8fdb('0x80')]({'name':_0x381f9b[_0x8fdb('0x3c')],'resourceId':_0x381f9b['id'],'type':_0xc71b6c[_0x8fdb('0x3c')],'sectionId':_0xc71b6c['id']},{})[_0x8fdb('0x29')](function(){return _0x381f9b;});})['catch'](function(_0xb8e330){logger[_0x8fdb('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb8e330);throw _0xb8e330;});})[_0x8fdb('0x29')](respondWithResult(_0x4b7883,0xc9))['catch'](handleError(_0x4b7883,null));};exports[_0x8fdb('0x88')]=function(_0x20444a,_0x5edcb9){var _0xd3377f=_0x20444a['body'];var _0x41446f=[];if(_0x20444a[_0x8fdb('0x30')][_0x8fdb('0x2e')]===_0x8fdb('0x2a'))throw new Error(_0x8fdb('0x81'));if(_[_0x8fdb('0x89')](_0xd3377f,['role',_0x8fdb('0x30')])&&_0x20444a[_0x8fdb('0x30')]['role']!==_0x8fdb('0x82')){throw new Error(_0x8fdb('0x8a'));}if(_['some'](_0xd3377f,['role',_0x8fdb('0x82')])&&_0x20444a[_0x8fdb('0x30')]['role']!==_0x8fdb('0x82')){throw new Error(_0x8fdb('0x8b'));}return licenseUtil[_0x8fdb('0x84')](_0xd3377f)[_0x8fdb('0x29')](function(){return validateUser(_0xd3377f[0x0]);})[_0x8fdb('0x29')](function(){for(var _0x207c00=0x1;_0x207c00<_0xd3377f[_0x8fdb('0x50')];_0x207c00++){var _0x26167c=_0xd3377f[_0x207c00-0x1][_0x8fdb('0x69')];if(!_0xd3377f[_0x207c00][_0x8fdb('0x69')])_0xd3377f[_0x207c00][_0x8fdb('0x69')]=_0x26167c+0x1;_0x41446f['push'](validateUser(_0xd3377f[_0x207c00]));}return Promise['all'](_0x41446f);})['then'](function(){_0x41446f=[];for(var _0x1c05ca=0x0;_0x1c05ca<_0xd3377f[_0x8fdb('0x50')];_0x1c05ca++){_0x41446f[_0x8fdb('0x4c')](updateUser(_0xd3377f[_0x1c05ca]));}return Promise['all'](_0x41446f);})[_0x8fdb('0x29')](function(){_0x41446f=_0xd3377f[_0x8fdb('0x35')](function(_0x13fd70){return db['User']['create'](_0x13fd70,{'include':[{'model':db[_0x8fdb('0x72')],'as':'VoiceMail'}]})[_0x8fdb('0x29')](function(_0x40cb8d){_0x13fd70['id']=_0x40cb8d['id'];return _0x13fd70;});});return Promise[_0x8fdb('0x57')](_0x41446f);})['then'](function(_0x44ab9c){if(_0x20444a[_0x8fdb('0x62')]['role']===_0x8fdb('0x30'))return _0x44ab9c;if(_0x20444a[_0x8fdb('0x30')][_0x8fdb('0x2e')]!==_0x8fdb('0x30'))return _0x44ab9c;var _0x2953ce=_[_0x8fdb('0x89')](_0x44ab9c,function(_0x9f81c0){return _0x9f81c0[_0x8fdb('0x2e')]==='agent'||_0x9f81c0[_0x8fdb('0x2e')]===_0x8fdb('0x8c');});if(!_0x2953ce)return _0x44ab9c;return db[_0x8fdb('0x8d')][_0x8fdb('0x4d')]({'where':{'name':{'$or':[_0x8fdb('0x31'),_0x8fdb('0x32')]},'userProfileId':_0x20444a[_0x8fdb('0x30')][_0x8fdb('0x86')]},'raw':!![]})[_0x8fdb('0x29')](function(_0x58312b){if(_['isEmpty'](_0x58312b)||!_[_0x8fdb('0x89')](_0x58312b,[_0x8fdb('0x87'),0x0]))return _0x44ab9c;_0x41446f=[];var _0x1f3231=_(_0x58312b)[_0x8fdb('0x35')](function(_0x286f06){if(_0x286f06['autoAssociation']===0x1)return;return _0x286f06[_0x8fdb('0x3c')]==='Agents'?_0x8fdb('0x2a'):'telephone';})['compact']()[_0x8fdb('0x36')]();for(var _0x1793a8=0x0;_0x1793a8<_0x44ab9c[_0x8fdb('0x50')];_0x1793a8++){if(!_['includes'](_0x1f3231,_0x44ab9c[_0x1793a8]['role']))return;var _0x43d9ba=_0x44ab9c[_0x1793a8]['role']==='agent'?'Agents':_0x8fdb('0x32');_0x41446f['push'](db['UserProfileResource'][_0x8fdb('0x80')]({'name':_0x44ab9c[_0x1793a8][_0x8fdb('0x3c')],'resourceId':_0x44ab9c[_0x1793a8]['id'],'type':_0x43d9ba,'sectionId':_[_0x8fdb('0x38')](_0x58312b,[_0x8fdb('0x3c'),_0x43d9ba])['id']},{}));}return Promise[_0x8fdb('0x57')](_0x41446f);});})[_0x8fdb('0x29')](respondWithResult(_0x5edcb9,0xc9))[_0x8fdb('0x1f')](handleError(_0x5edcb9,null));};exports[_0x8fdb('0x8e')]=function(_0x17b9e8,_0x56c88f){if(_0x17b9e8['body']['id']){delete _0x17b9e8[_0x8fdb('0x62')]['id'];}return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x17b9e8[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](function(_0x56c547){if(!_0x56c547)return null;if(_0x56c547['id']===_0x17b9e8[_0x8fdb('0x30')]['id']){if(!_0x17b9e8['body']['oldPassword']||!_0x17b9e8[_0x8fdb('0x62')][_0x8fdb('0x8f')]){throw new db['Sequelize'][(_0x8fdb('0x90'))](_0x8fdb('0x91'));}if(!_0x56c547[_0x8fdb('0x92')](_0x17b9e8['body'][_0x8fdb('0x93')])){throw new db['Sequelize'][(_0x8fdb('0x90'))](_0x8fdb('0x94'));}if(_0x17b9e8[_0x8fdb('0x62')][_0x8fdb('0x93')]===_0x17b9e8[_0x8fdb('0x62')]['newPassword']){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0x96'));}}else if(_0x17b9e8[_0x8fdb('0x30')]['role']===_0x8fdb('0x82')){if(!_0x17b9e8[_0x8fdb('0x62')][_0x8fdb('0x8f')]){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0x97'));}}else if(_0x17b9e8[_0x8fdb('0x30')][_0x8fdb('0x2e')]===_0x8fdb('0x30')){if(!_0x17b9e8['body']['newPassword']){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x56c547[_0x8fdb('0x2e')]!==_0x8fdb('0x2a')){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0x81'));}}else{throw new db['Sequelize'][(_0x8fdb('0x90'))]('Unauthorized');}return _0x56c547;})[_0x8fdb('0x29')](handleEntityNotFound(_0x56c88f,null))[_0x8fdb('0x29')](function(_0xf42c1e){return db[_0x8fdb('0x98')]['findOne']({'attributes':['id',_0x8fdb('0x66'),_0x8fdb('0x99'),_0x8fdb('0x9a')]})[_0x8fdb('0x29')](function(_0x5bc5a3){if(_0x5bc5a3[_0x8fdb('0x66')])authService[_0x8fdb('0x67')](_0x17b9e8[_0x8fdb('0x62')]['newPassword']);if(!_0x5bc5a3[_0x8fdb('0x99')]||!_0xf42c1e['previousPasswords'])return _0xf42c1e;authService['validatePasswordHistory'](_0x17b9e8['body'][_0x8fdb('0x8f')],_0xf42c1e['previousPasswords'],_0x5bc5a3[_0x8fdb('0x9a')]);return _0xf42c1e;})[_0x8fdb('0x29')](saveUpdates({'password':_0x17b9e8['body'][_0x8fdb('0x8f')],'passwordResetAt':_0x17b9e8[_0x8fdb('0x30')]['id']==_0x17b9e8[_0x8fdb('0x59')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x17b9e8['body']['newPassword'],_0xf42c1e[_0x8fdb('0x9b')])},null));})[_0x8fdb('0x29')](respondWithResult(_0x56c88f,null))[_0x8fdb('0x1f')](handleError(_0x56c88f,null));};exports['addQueues']=function(_0x2d7767,_0x674fca){var _0x3898e5=_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0x9c')];return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x2d7767[_0x8fdb('0x59')]['id']},'attributes':['id','name',_0x8fdb('0x2e'),_0x8fdb('0x9d'),_0x8fdb('0x9e'),'voicePause',_0x8fdb('0x9f')]})[_0x8fdb('0x29')](handleEntityNotFound(_0x674fca,null))[_0x8fdb('0x29')](function(_0x31cd09){if(_0x31cd09){if(!utils['isValidChannel'](_0x3898e5)){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0xa0'));}return _0x31cd09[_0x8fdb('0xa1')+_[_0x8fdb('0xa2')](_0x3898e5[_0x8fdb('0xa3')]())+'Queues'](_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa4')],{'penalty':_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa5')]||0x0})[_0x8fdb('0xa6')](function(_0x5a09e3){for(var _0x17aa77=0x0;_0x17aa77<_0x2d7767['body'][_0x8fdb('0xa4')]['length'];_0x17aa77+=0x1){var _0xce7557={'UserId':Number(_0x2d7767[_0x8fdb('0x59')]['id'])};_0xce7557[_['capitalize'](_0x3898e5[_0x8fdb('0xa3')]())+'QueueId']=Number(_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa4')][_0x17aa77]);socket[_0x8fdb('0xa7')](_0x8fdb('0x30')+_[_0x8fdb('0xa2')](_0x3898e5[_0x8fdb('0xa3')]())+_0x8fdb('0xa8'),_0xce7557);}return _0x5a09e3;})[_0x8fdb('0x29')](function(){if(_0x3898e5===_0x8fdb('0xa9')){return db[_0x8fdb('0xaa')][_0x8fdb('0x4d')]({'where':{'id':_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa4')]||[]},'raw':!![],'attributes':['id',_0x8fdb('0x3c')]});}})[_0x8fdb('0x29')](function(_0x4ae24e){var _0x248ab2=_0x31cd09['get']({'plain':!![]});var _0x5c5548=[];if(_0x3898e5==='voice'&&_0x248ab2[_0x8fdb('0x2e')]==='agent'&&_0x248ab2[_0x8fdb('0x9d')]){for(let _0x134eba=0x0;_0x134eba<_0x4ae24e[_0x8fdb('0x50')];_0x134eba+=0x1){_0x5c5548['push']({'membername':_0x248ab2[_0x8fdb('0x3c')],'UserId':_0x248ab2['id'],'queue_name':_0x4ae24e[_0x134eba][_0x8fdb('0x3c')],'VoiceQueueId':_0x4ae24e[_0x134eba]['id'],'interface':_[_0x8fdb('0x6a')](_0x248ab2[_0x8fdb('0x9f')])?util[_0x8fdb('0xab')](_0x8fdb('0xac'),_0x248ab2[_0x8fdb('0x3c')]):_0x248ab2[_0x8fdb('0x9f')],'paused':_0x248ab2['voicePause']||![],'penalty':_0x2d7767[_0x8fdb('0x62')][_0x8fdb('0xa5')]||0x0});}return Promise[_0x8fdb('0x57')](_0x5c5548[_0x8fdb('0x35')](function(_0x198dd6){return db[_0x8fdb('0xad')][_0x8fdb('0xae')](_0x198dd6);}));}return _0x31cd09;});}})['then'](respondWithStatusCode(_0x674fca,null))[_0x8fdb('0x1f')](handleError(_0x674fca,null));};exports[_0x8fdb('0xaf')]=function(_0x55c1b2,_0x2a3e5b){var _0x23cf9f,_0x439825;return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x55c1b2['params']['id']},'attributes':['id','name','role']})[_0x8fdb('0x29')](handleEntityNotFound(_0x2a3e5b,null))[_0x8fdb('0x29')](function(_0x1ab973){if(_0x1ab973){_0x23cf9f=_0x1ab973;if(!_0x55c1b2['query'][_0x8fdb('0x9c')]||!utils[_0x8fdb('0xb0')](_0x55c1b2[_0x8fdb('0x47')]['channel'])){throw new db[(_0x8fdb('0x95'))]['ValidationError'](_0x8fdb('0xa0'));}return _0x1ab973[_0x8fdb('0xb1')+_[_0x8fdb('0xa2')](_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0x9c')][_0x8fdb('0xa3')]())+'Queues'](_0x55c1b2[_0x8fdb('0x47')]['ids']);}})[_0x8fdb('0x29')](function(_0x1882f7){if(_[_0x8fdb('0xb2')](_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0xa4')])){for(var _0xc16f4c=0x0;_0xc16f4c<_0x55c1b2[_0x8fdb('0x47')]['ids']['length'];_0xc16f4c+=0x1){_0x439825={'UserId':Number(_0x55c1b2[_0x8fdb('0x59')]['id'])};_0x439825[_[_0x8fdb('0xa2')](_0x55c1b2['query'][_0x8fdb('0x9c')][_0x8fdb('0xa3')]())+_0x8fdb('0xb3')]=Number(_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0xa4')][_0xc16f4c]);socket[_0x8fdb('0xa7')]('user'+_[_0x8fdb('0xa2')](_0x55c1b2['query'][_0x8fdb('0x9c')][_0x8fdb('0xa3')]())+_0x8fdb('0xb4'),_0x439825);}}else{_0x439825={'UserId':Number(_0x55c1b2[_0x8fdb('0x59')]['id'])};_0x439825[_[_0x8fdb('0xa2')](_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0x9c')][_0x8fdb('0xa3')]())+_0x8fdb('0xb3')]=Number(_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0xa4')]);socket[_0x8fdb('0xa7')](_0x8fdb('0x30')+_[_0x8fdb('0xa2')](_0x55c1b2[_0x8fdb('0x47')]['channel'][_0x8fdb('0xa3')]())+_0x8fdb('0xb4'),_0x439825);}return _0x1882f7;})[_0x8fdb('0x29')](function(){if(_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0x9c')]===_0x8fdb('0xa9')){return db[_0x8fdb('0xad')]['destroy']({'where':{'UserId':_0x55c1b2[_0x8fdb('0x59')]['id'],'VoiceQueueId':_0x55c1b2[_0x8fdb('0x47')][_0x8fdb('0xa4')]},'individualHooks':!![]})['then'](function(){return _0x23cf9f;});}return _0x23cf9f;})[_0x8fdb('0x29')](respondWithStatusCode(_0x2a3e5b,null))[_0x8fdb('0x1f')](handleError(_0x2a3e5b,null));};exports[_0x8fdb('0xb5')]=function(_0x4fde63,_0x3862cc){_0x4fde63[_0x8fdb('0x62')][_0x8fdb('0xb6')]=_0x4fde63[_0x8fdb('0xb7')][_0x8fdb('0xb8')];return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x4fde63['params']['id']}})['then'](handleEntityNotFound(_0x3862cc,null))[_0x8fdb('0x29')](saveUpdates(_0x4fde63['body'],null))[_0x8fdb('0x29')](respondWithResult(_0x3862cc,null))[_0x8fdb('0x1f')](handleError(_0x3862cc,null));};exports[_0x8fdb('0xb9')]=function(_0xb910c1,_0x38a2d6){var _0x661cb4=path[_0x8fdb('0xba')](config['root'],_0x8fdb('0xbb'));return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0xb910c1[_0x8fdb('0x59')]['id']},'attributes':['id',_0x8fdb('0xb6')],'raw':!![]})[_0x8fdb('0x29')](handleEntityNotFound(_0x38a2d6,null))[_0x8fdb('0x29')](function(_0x14c7a6){if(_0x14c7a6){if(_['isNil'](_0x14c7a6['userpic'])){return _0x38a2d6['download'](_0x661cb4);}else{if(!fs[_0x8fdb('0xbc')](path[_0x8fdb('0xba')](config[_0x8fdb('0xbd')],_0x8fdb('0xbe'),_0x14c7a6[_0x8fdb('0xb6')]))){return _0x38a2d6['download'](_0x661cb4);}return _0x38a2d6[_0x8fdb('0xbf')](path[_0x8fdb('0xba')](config[_0x8fdb('0xbd')],_0x8fdb('0xbe'),_0x14c7a6['userpic']));}}})['catch'](handleError(_0x38a2d6,null));};exports[_0x8fdb('0xc0')]=function(_0x55997f,_0x535d36){return db[_0x8fdb('0x3f')]['find']({'where':{'id':_0x55997f[_0x8fdb('0x59')]['id']},'attributes':['id']})[_0x8fdb('0x29')](handleEntityNotFound(_0x535d36,null))[_0x8fdb('0x29')](function(_0x55d561){var _0x59d4d8=[];values=_0x55d561[_0x8fdb('0x52')];_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs('chat',_0x55d561['dataValues']));_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x53'),_0x55d561[_0x8fdb('0x52')]));_0x59d4d8['push'](get_open_tabs('openchannel',_0x55d561[_0x8fdb('0x52')]));_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x56'),_0x55d561['dataValues']));_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x61'),_0x55d561[_0x8fdb('0x52')]));_0x59d4d8[_0x8fdb('0x4c')](get_open_tabs(_0x8fdb('0x54'),_0x55d561[_0x8fdb('0x52')]));return Promise['all'](_0x59d4d8);})[_0x8fdb('0x29')](function(_0x1adeca){if(_0x1adeca){var _0x12f5f7=_['map'](values[_0x8fdb('0xc1')],function(_0x33c50b){return{'channel':_0x8fdb('0xc2'),'id':_0x33c50b['id'],'createdAt':_0x33c50b[_0x8fdb('0xc3')]};});var _0x2db42c=_[_0x8fdb('0x35')](values[_0x8fdb('0xc4')],function(_0x307b79){return{'channel':_0x8fdb('0xc5'),'id':_0x307b79['id'],'createdAt':_0x307b79[_0x8fdb('0xc3')]};});var _0x21125a=_[_0x8fdb('0x35')](values[_0x8fdb('0xc6')],function(_0x436d89){return{'channel':_0x8fdb('0xc7'),'id':_0x436d89['id'],'createdAt':_0x436d89['createdAt']};});var _0x559eb3=_[_0x8fdb('0x35')](values[_0x8fdb('0xc8')],function(_0x15371f){return{'channel':'MAIL','id':_0x15371f['id'],'createdAt':_0x15371f['createdAt']};});var _0x994794=_['map'](values[_0x8fdb('0xc9')],function(_0x5d90e5){return{'channel':_0x8fdb('0xca'),'id':_0x5d90e5['id'],'createdAt':_0x5d90e5['createdAt']};});var _0x3f009a=_[_0x8fdb('0x35')](values[_0x8fdb('0xcb')],function(_0x1b16fb){return{'channel':_0x8fdb('0xcc'),'id':_0x1b16fb['id'],'createdAt':_0x1b16fb[_0x8fdb('0xc3')]};});var _0x1747e1=_[_0x8fdb('0xcd')](_0x12f5f7,_0x2db42c,_0x21125a,_0x559eb3,_0x994794,_0x3f009a);var _0xc92c5d={'count':_0x1747e1['length'],'rows':_0x1747e1};return _0xc92c5d;}else return null;})[_0x8fdb('0x29')](respondWithResult(_0x535d36,null))[_0x8fdb('0x1f')](handleError(_0x535d36,null));};exports[_0x8fdb('0xce')]=function(_0x219590,_0x381ce7){var _0xf3fd={};var _0x2521f7={};var _0x588c75;var _0x8d1ff5;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x219590[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x381ce7,null))[_0x8fdb('0x29')](function(_0x2cb47a){if(_0x2cb47a){_0x588c75=_0x2cb47a;_0x2521f7[_0x8fdb('0x5e')]=_['keys'](db[_0x8fdb('0xd0')][_0x8fdb('0x40')]);_0x2521f7[_0x8fdb('0x47')]=_['keys'](_0x219590[_0x8fdb('0x47')]);_0x2521f7[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x2521f7[_0x8fdb('0x5e')],_0x2521f7[_0x8fdb('0x47')]);_0xf3fd[_0x8fdb('0x4b')]=_['intersection'](_0x2521f7[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x219590[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0xf3fd[_0x8fdb('0x4b')]=_0xf3fd[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0xf3fd[_0x8fdb('0x4b')]:_0x2521f7[_0x8fdb('0x5e')];_0xf3fd['order']=qs[_0x8fdb('0xd1')](_0x219590[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0xf3fd[_0x8fdb('0x44')]=qs['filters'](_[_0x8fdb('0xd2')](_0x219590[_0x8fdb('0x47')],_0x2521f7['filters']));if(_0x219590[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0xf3fd[_0x8fdb('0x44')]=_['merge'](_0xf3fd['where'],{'$or':_[_0x8fdb('0x35')](_0xf3fd['attributes'],function(_0x370be2){var _0x1e904f={};_0x1e904f[_0x370be2]={'$like':'%'+_0x219590[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x1e904f;})});}_0xf3fd=_[_0x8fdb('0xd3')]({},_0xf3fd,_0x219590['options']);return _0x588c75['getContacts'](_0xf3fd);}})[_0x8fdb('0x29')](function(_0x4949d7){if(_0x4949d7){_0x8d1ff5=_0x4949d7['length'];if(_0x219590[_0x8fdb('0x47')]['hasOwnProperty'](_0x8fdb('0x45'))){_0xf3fd['include']=[{'model':db['CmList'],'as':_0x8fdb('0xd4'),'required':![]},{'model':db[_0x8fdb('0xd5')],'as':'Tags','attributes':['id','name',_0x8fdb('0xd6')],'where':_0x219590['query'][_0x8fdb('0xd7')]?{'id':_0x219590[_0x8fdb('0x47')]['tag']}:undefined,'required':_0x219590[_0x8fdb('0x47')][_0x8fdb('0xd7')]?!![]:![]}];}if(!_0x219590['query']['hasOwnProperty'](_0x8fdb('0xd8'))){_0xf3fd['limit']=qs[_0x8fdb('0x24')](_0x219590[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0xf3fd[_0x8fdb('0x25')]=qs['offset'](_0x219590['query'][_0x8fdb('0x25')]);}return _0x588c75['getContacts'](_0xf3fd);}})['then'](function(_0x378c5a){if(_0x378c5a){return _0x378c5a?{'count':_0x8d1ff5,'rows':_0x378c5a}:null;}})['then'](respondWithResult(_0x381ce7,null))[_0x8fdb('0x1f')](handleError(_0x381ce7,null));};exports['getQueues']=function(_0x5f1c60,_0x38d045){var _0x435662;var _0x45a570={};var _0x52112f;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x5f1c60['params']['id']},'attributes':['id','name',_0x8fdb('0x2e')]})[_0x8fdb('0x29')](handleEntityNotFound(_0x38d045,null))[_0x8fdb('0x29')](function(_0x18913c){if(!utils[_0x8fdb('0xb0')](_0x5f1c60['query'][_0x8fdb('0x9c')])){throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0xa0'));}_0x435662=_0x18913c;var _0x1a61cb={};_0x1a61cb[_0x8fdb('0x5e')]=_['keys'](db[_[_0x8fdb('0xa2')](_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x9c')])+_0x8fdb('0xd9')][_0x8fdb('0x40')]);_0x1a61cb[_0x8fdb('0x47')]=_['keys'](_0x5f1c60['query']);_0x1a61cb[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x1a61cb[_0x8fdb('0x5e')],_0x1a61cb[_0x8fdb('0x47')]);_0x45a570[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x1a61cb['model'],qs[_0x8fdb('0x60')](_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x45a570['attributes']=_0x45a570[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x45a570[_0x8fdb('0x4b')]:_0x1a61cb[_0x8fdb('0x5e')];_0x45a570['order']=qs['sort'](_0x5f1c60[_0x8fdb('0x47')]['sort']);_0x45a570[_0x8fdb('0x44')]=qs['filters'](_[_0x8fdb('0xd2')](_0x5f1c60[_0x8fdb('0x47')],_0x1a61cb[_0x8fdb('0x5d')]));if(_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x45a570[_0x8fdb('0x44')]=_['merge'](_0x45a570[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x45a570['attributes'],function(_0x37aadd){var _0xbc8dbe={};_0xbc8dbe[_0x37aadd]={'$like':'%'+_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0xbc8dbe;})});}_0x45a570=_['merge']({},_0x45a570,_0x5f1c60['options']);switch(_0x435662['role']){case'admin':return db[_[_0x8fdb('0xa2')](_0x5f1c60[_0x8fdb('0x47')]['channel'])+_0x8fdb('0xd9')][_0x8fdb('0x4d')](_0x45a570);case _0x8fdb('0x30'):case'agent':return _0x435662[_0x8fdb('0x2d')+_['capitalize'](_0x5f1c60['query']['channel'])+_0x8fdb('0xda')](_0x45a570);default:throw new db[(_0x8fdb('0x95'))][(_0x8fdb('0x90'))](_0x8fdb('0xdb'));}})['then'](function(_0x547a1c){_0x52112f=_0x547a1c[_0x8fdb('0x50')];if(!_0x5f1c60['query']['hasOwnProperty']('nolimit')){_0x45a570[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x45a570[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x5f1c60['query']['offset']);}switch(_0x435662[_0x8fdb('0x2e')]){case _0x8fdb('0x82'):return db[_['capitalize'](_0x5f1c60[_0x8fdb('0x47')][_0x8fdb('0x9c')])+_0x8fdb('0xd9')][_0x8fdb('0x4d')](_0x45a570);case _0x8fdb('0x30'):case'agent':return _0x435662[_0x8fdb('0x2d')+_[_0x8fdb('0xa2')](_0x5f1c60[_0x8fdb('0x47')]['channel'])+'Queues'](_0x45a570);}})[_0x8fdb('0x29')](function(_0x1e063e){return{'count':_0x52112f,'rows':_0x1e063e};})[_0x8fdb('0x29')](respondWithResult(_0x38d045,null))[_0x8fdb('0x1f')](handleError(_0x38d045,null));};exports[_0x8fdb('0xdc')]=function(_0x2f0e01,_0x19ea2b){var _0x299e09={};var _0xab44da={};var _0x4300ef;var _0x1f6642;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x2f0e01[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x19ea2b,null))[_0x8fdb('0x29')](function(_0x526792){if(_0x526792){_0x4300ef=_0x526792;_0xab44da[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db['UserVoiceQueueRt'][_0x8fdb('0x40')]);_0xab44da['query']=_['keys'](_0x2f0e01['query']);_0xab44da['filters']=_[_0x8fdb('0x5f')](_0xab44da['model'],_0xab44da[_0x8fdb('0x47')]);_0x299e09['attributes']=_['intersection'](_0xab44da[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x2f0e01[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x299e09[_0x8fdb('0x4b')]=_0x299e09['attributes'][_0x8fdb('0x50')]?_0x299e09['attributes']:_0xab44da[_0x8fdb('0x5e')];_0x299e09['order']=qs[_0x8fdb('0xd1')](_0x2f0e01['query'][_0x8fdb('0xd1')]);_0x299e09[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x2f0e01['query'],_0xab44da['filters']));if(_0x2f0e01[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x299e09[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x299e09[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x299e09[_0x8fdb('0x4b')],function(_0x432adb){var _0x310c7a={};_0x310c7a[_0x432adb]={'$like':'%'+_0x2f0e01['query']['filter']+'%'};return _0x310c7a;})});}_0x299e09=_[_0x8fdb('0xd3')]({},_0x299e09,_0x2f0e01['options']);return _0x4300ef[_0x8fdb('0xdc')](_0x299e09);}})[_0x8fdb('0x29')](function(_0x160259){if(_0x160259){_0x1f6642=_0x160259['length'];if(!_0x2f0e01[_0x8fdb('0x47')][_0x8fdb('0xdd')]('nolimit')){_0x299e09['limit']=qs[_0x8fdb('0x24')](_0x2f0e01[_0x8fdb('0x47')]['limit']);_0x299e09['offset']=qs[_0x8fdb('0x25')](_0x2f0e01['query'][_0x8fdb('0x25')]);}return _0x4300ef[_0x8fdb('0xdc')](_0x299e09);}})[_0x8fdb('0x29')](function(_0x1f148){if(_0x1f148){return _0x1f148?{'count':_0x1f6642,'rows':_0x1f148}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x19ea2b,null))[_0x8fdb('0x1f')](handleError(_0x19ea2b,null));};exports['getGroups']=function(_0x44f734,_0x5f3d84){var _0x2e2f3e={};var _0x1840e5={};var _0x216c4d;var _0x2b2b0c;return db[_0x8fdb('0x3f')]['findOne']({'where':{'id':_0x44f734['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x5f3d84,null))[_0x8fdb('0x29')](function(_0x400872){if(_0x400872){_0x216c4d=_0x400872;_0x1840e5[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xde')][_0x8fdb('0x40')]);_0x1840e5['query']=_['keys'](_0x44f734[_0x8fdb('0x47')]);_0x1840e5[_0x8fdb('0x5d')]=_['intersection'](_0x1840e5[_0x8fdb('0x5e')],_0x1840e5['query']);_0x2e2f3e[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x1840e5[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x44f734[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x2e2f3e[_0x8fdb('0x4b')]=_0x2e2f3e[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x2e2f3e[_0x8fdb('0x4b')]:_0x1840e5[_0x8fdb('0x5e')];_0x2e2f3e['order']=qs['sort'](_0x44f734[_0x8fdb('0x47')]['sort']);_0x2e2f3e[_0x8fdb('0x44')]=qs['filters'](_[_0x8fdb('0xd2')](_0x44f734[_0x8fdb('0x47')],_0x1840e5[_0x8fdb('0x5d')]));if(_0x44f734[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x2e2f3e['where']=_[_0x8fdb('0xd3')](_0x2e2f3e[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x2e2f3e[_0x8fdb('0x4b')],function(_0x19108e){var _0x413d18={};_0x413d18[_0x19108e]={'$like':'%'+_0x44f734[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x413d18;})});}_0x2e2f3e=_[_0x8fdb('0xd3')]({},_0x2e2f3e,_0x44f734[_0x8fdb('0xdf')]);return _0x216c4d[_0x8fdb('0xe0')](_0x2e2f3e);}})[_0x8fdb('0x29')](function(_0x39850d){if(_0x39850d){_0x2b2b0c=_0x39850d[_0x8fdb('0x50')];if(!_0x44f734['query'][_0x8fdb('0xdd')](_0x8fdb('0xd8'))){_0x2e2f3e[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x44f734[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x2e2f3e[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x44f734[_0x8fdb('0x47')]['offset']);}return _0x216c4d[_0x8fdb('0xe0')](_0x2e2f3e);}})['then'](function(_0x457b4a){if(_0x457b4a){return _0x457b4a?{'count':_0x2b2b0c,'rows':_0x457b4a}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x5f3d84,null))[_0x8fdb('0x1f')](handleError(_0x5f3d84,null));};exports[_0x8fdb('0xe1')]=function(_0x543ff0,_0x207209){var _0x205e48={'raw':!![],'where':{}};var _0x3395cc={};var _0x91fc05={'count':0x0,'rows':[]};return db['User'][_0x8fdb('0xcf')]({'where':{'id':_0x543ff0[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x207209,null))[_0x8fdb('0x29')](function(_0xc96a49){if(_0xc96a49){_0x3395cc['model']=_[_0x8fdb('0x5c')](db[_0x8fdb('0xe2')]['rawAttributes']);_0x3395cc[_0x8fdb('0x47')]=_['keys'](_0x543ff0[_0x8fdb('0x47')]);_0x3395cc[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x3395cc[_0x8fdb('0x5e')],_0x3395cc['query']);_0x205e48['attributes']=_[_0x8fdb('0x5f')](_0x3395cc[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x543ff0['query']['fields']));_0x205e48[_0x8fdb('0x4b')]=_0x205e48[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x205e48['attributes']:_0x3395cc[_0x8fdb('0x5e')];if(!_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0xdd')]('nolimit')){_0x205e48[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x205e48[_0x8fdb('0x25')]=qs['offset'](_0x543ff0['query']['offset']);}_0x205e48[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0x205e48['where']=qs[_0x8fdb('0x5d')](_['pick'](_0x543ff0[_0x8fdb('0x47')],_0x3395cc['filters']));_0x205e48['where']['UserId']=_0xc96a49['id'];if(_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x205e48['where']=_[_0x8fdb('0xd3')](_0x205e48[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x205e48[_0x8fdb('0x4b')],function(_0x302b85){var _0x70c7ed={};_0x70c7ed[_0x302b85]={'$like':'%'+_0x543ff0['query']['filter']+'%'};return _0x70c7ed;})});}_0x205e48=_['merge']({},_0x205e48,_0x543ff0[_0x8fdb('0xdf')]);return db['VoiceRecording'][_0x8fdb('0x26')]({'where':_0x205e48[_0x8fdb('0x44')]})['then'](function(_0x528ba1){_0x91fc05[_0x8fdb('0x26')]=_0x528ba1;if(_0x543ff0[_0x8fdb('0x47')][_0x8fdb('0x45')]){_0x205e48[_0x8fdb('0x46')]=[{'all':!![]}];}return db[_0x8fdb('0xe2')][_0x8fdb('0x4d')](_0x205e48);})[_0x8fdb('0x29')](function(_0x513d3f){_0x91fc05[_0x8fdb('0x4e')]=_0x513d3f;return _0x91fc05;});}})[_0x8fdb('0x29')](respondWithFilteredResult(_0x207209,_0x205e48))[_0x8fdb('0x1f')](handleError(_0x207209,null));};exports[_0x8fdb('0xe4')]=function(_0x5b1cd6,_0x2ada5d){var _0x5f4785={'raw':!![],'where':{}};var _0xf101f7={};var _0x5de1a1={'count':0x0,'rows':[]};return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x5b1cd6[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x2ada5d,null))[_0x8fdb('0x29')](function(_0x4f0a28){if(_0x4f0a28){_0xf101f7[_0x8fdb('0x5e')]=_['keys'](db[_0x8fdb('0xe5')][_0x8fdb('0x40')]);_0xf101f7[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x5b1cd6[_0x8fdb('0x47')]);_0xf101f7['filters']=_[_0x8fdb('0x5f')](_0xf101f7['model'],_0xf101f7[_0x8fdb('0x47')]);_0x5f4785[_0x8fdb('0x4b')]=_['intersection'](_0xf101f7[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x5b1cd6['query']['fields']));_0x5f4785[_0x8fdb('0x4b')]=_0x5f4785['attributes'][_0x8fdb('0x50')]?_0x5f4785[_0x8fdb('0x4b')]:_0xf101f7[_0x8fdb('0x5e')];if(!_0x5b1cd6['query']['hasOwnProperty'](_0x8fdb('0xd8'))){_0x5f4785[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x5b1cd6[_0x8fdb('0x47')]['limit']);_0x5f4785[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x5b1cd6[_0x8fdb('0x47')][_0x8fdb('0x25')]);}_0x5f4785[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x5b1cd6['query'][_0x8fdb('0xd1')]);_0x5f4785[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x5b1cd6['query'],_0xf101f7[_0x8fdb('0x5d')]));_0x5f4785[_0x8fdb('0x44')][_0x8fdb('0xe6')]=_0x4f0a28['id'];if(_0x5b1cd6[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x5f4785[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x5f4785['where'],{'$or':_[_0x8fdb('0x35')](_0x5f4785['attributes'],function(_0x3e2014){var _0x349397={};_0x349397[_0x3e2014]={'$like':'%'+_0x5b1cd6[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x349397;})});}_0x5f4785=_[_0x8fdb('0xd3')]({},_0x5f4785,_0x5b1cd6['options']);return db[_0x8fdb('0xe5')][_0x8fdb('0x26')]({'where':_0x5f4785[_0x8fdb('0x44')]})[_0x8fdb('0x29')](function(_0x70915f){_0x5de1a1['count']=_0x70915f;if(_0x5b1cd6[_0x8fdb('0x47')][_0x8fdb('0x45')]){_0x5f4785[_0x8fdb('0x46')]=[{'all':!![]}];}return db[_0x8fdb('0xe5')][_0x8fdb('0x4d')](_0x5f4785);})[_0x8fdb('0x29')](function(_0x31d250){_0x5de1a1['rows']=_0x31d250;return _0x5de1a1;});}})[_0x8fdb('0x29')](respondWithFilteredResult(_0x2ada5d,_0x5f4785))[_0x8fdb('0x1f')](handleError(_0x2ada5d,null));};exports[_0x8fdb('0xe7')]=function(_0x437fdf,_0x1e13e3){var _0x22d6f4={};var _0x1eab3a={};var _0x19bb38;var _0x147c3e;return db[_0x8fdb('0x3f')]['findOne']({'where':{'id':_0x437fdf[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x1e13e3,null))[_0x8fdb('0x29')](function(_0x35a982){if(_0x35a982){_0x19bb38=_0x35a982;_0x1eab3a[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xe8')]['rawAttributes']);_0x1eab3a[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x437fdf[_0x8fdb('0x47')]);_0x1eab3a['filters']=_[_0x8fdb('0x5f')](_0x1eab3a[_0x8fdb('0x5e')],_0x1eab3a[_0x8fdb('0x47')]);_0x22d6f4[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x1eab3a[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x437fdf[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x22d6f4[_0x8fdb('0x4b')]=_0x22d6f4[_0x8fdb('0x4b')]['length']?_0x22d6f4[_0x8fdb('0x4b')]:_0x1eab3a[_0x8fdb('0x5e')];_0x22d6f4['order']=qs['sort'](_0x437fdf['query'][_0x8fdb('0xd1')]);_0x22d6f4[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x437fdf[_0x8fdb('0x47')],_0x1eab3a[_0x8fdb('0x5d')]));if(_0x437fdf['query'][_0x8fdb('0x33')]){_0x22d6f4[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x22d6f4['where'],{'$or':_[_0x8fdb('0x35')](_0x22d6f4['attributes'],function(_0x4d3b52){var _0x2aea33={};_0x2aea33[_0x4d3b52]={'$like':'%'+_0x437fdf[_0x8fdb('0x47')]['filter']+'%'};return _0x2aea33;})});}_0x22d6f4=_[_0x8fdb('0xd3')]({},_0x22d6f4,_0x437fdf[_0x8fdb('0xdf')]);return _0x19bb38[_0x8fdb('0xe7')](_0x22d6f4);}})[_0x8fdb('0x29')](function(_0x4ab28a){if(_0x4ab28a){_0x147c3e=_0x4ab28a[_0x8fdb('0x50')];if(!_0x437fdf['query'][_0x8fdb('0xdd')]('nolimit')){_0x22d6f4[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x437fdf[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x22d6f4[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x437fdf[_0x8fdb('0x47')]['offset']);}return _0x19bb38['getChatInteractions'](_0x22d6f4);}})[_0x8fdb('0x29')](function(_0x3f4745){if(_0x3f4745){return _0x3f4745?{'count':_0x147c3e,'rows':_0x3f4745}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x1e13e3,null))[_0x8fdb('0x1f')](handleError(_0x1e13e3,null));};exports[_0x8fdb('0xe9')]=function(_0x300e99,_0x18e12f){var _0x41ba18={};var _0xaa127f={};var _0x12d12b;var _0x79b9b6;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x300e99['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x18e12f,null))[_0x8fdb('0x29')](function(_0x450743){if(_0x450743){_0x12d12b=_0x450743;_0xaa127f['model']=_[_0x8fdb('0x5c')](db[_0x8fdb('0xea')][_0x8fdb('0x40')]);_0xaa127f[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x300e99[_0x8fdb('0x47')]);_0xaa127f[_0x8fdb('0x5d')]=_['intersection'](_0xaa127f[_0x8fdb('0x5e')],_0xaa127f[_0x8fdb('0x47')]);_0x41ba18[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0xaa127f[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x300e99[_0x8fdb('0x47')]['fields']));_0x41ba18[_0x8fdb('0x4b')]=_0x41ba18[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x41ba18['attributes']:_0xaa127f[_0x8fdb('0x5e')];_0x41ba18[_0x8fdb('0xe3')]=qs['sort'](_0x300e99['query']['sort']);_0x41ba18[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x300e99[_0x8fdb('0x47')],_0xaa127f['filters']));if(_0x300e99[_0x8fdb('0x47')]['filter']){_0x41ba18[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x41ba18[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x41ba18['attributes'],function(_0x4182f1){var _0x4c2027={};_0x4c2027[_0x4182f1]={'$like':'%'+_0x300e99['query'][_0x8fdb('0x33')]+'%'};return _0x4c2027;})});}_0x41ba18=_[_0x8fdb('0xd3')]({},_0x41ba18,_0x300e99[_0x8fdb('0xdf')]);return _0x12d12b[_0x8fdb('0xe9')](_0x41ba18);}})['then'](function(_0x559352){if(_0x559352){_0x79b9b6=_0x559352[_0x8fdb('0x50')];if(!_0x300e99[_0x8fdb('0x47')][_0x8fdb('0xdd')](_0x8fdb('0xd8'))){_0x41ba18[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x300e99[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x41ba18[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x300e99[_0x8fdb('0x47')]['offset']);}return _0x12d12b['getOpenchannelInteractions'](_0x41ba18);}})[_0x8fdb('0x29')](function(_0x4ec8a5){if(_0x4ec8a5){return _0x4ec8a5?{'count':_0x79b9b6,'rows':_0x4ec8a5}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x18e12f,null))['catch'](handleError(_0x18e12f,null));};exports[_0x8fdb('0xeb')]=function(_0x55ad66,_0x70dd3c){var _0x59e4dd={'raw':!![],'where':{}};var _0x1cb3a8={};var _0x56e220={'count':0x0,'rows':[]};return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x55ad66['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x70dd3c,null))[_0x8fdb('0x29')](function(_0x390def){if(_0x390def){_0x1cb3a8[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xec')][_0x8fdb('0x40')]);_0x1cb3a8[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x55ad66['query']);_0x1cb3a8[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x1cb3a8[_0x8fdb('0x5e')],_0x1cb3a8[_0x8fdb('0x47')]);_0x59e4dd[_0x8fdb('0x4b')]=_['intersection'](_0x1cb3a8[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x59e4dd[_0x8fdb('0x4b')]=_0x59e4dd[_0x8fdb('0x4b')]['length']?_0x59e4dd[_0x8fdb('0x4b')]:_0x1cb3a8['model'];if(!_0x55ad66[_0x8fdb('0x47')]['hasOwnProperty'](_0x8fdb('0xd8'))){_0x59e4dd['limit']=qs[_0x8fdb('0x24')](_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x59e4dd['offset']=qs['offset'](_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x25')]);}_0x59e4dd[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0x59e4dd['where']=qs['filters'](_[_0x8fdb('0xd2')](_0x55ad66[_0x8fdb('0x47')],_0x1cb3a8[_0x8fdb('0x5d')]));_0x59e4dd[_0x8fdb('0x44')][_0x8fdb('0xe6')]=_0x390def['id'];if(_0x55ad66['query'][_0x8fdb('0x33')]){_0x59e4dd['where']=_[_0x8fdb('0xd3')](_0x59e4dd[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x59e4dd[_0x8fdb('0x4b')],function(_0x281300){var _0x4d7e73={};_0x4d7e73[_0x281300]={'$like':'%'+_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x4d7e73;})});}_0x59e4dd=_[_0x8fdb('0xd3')]({},_0x59e4dd,_0x55ad66[_0x8fdb('0xdf')]);return db[_0x8fdb('0xec')][_0x8fdb('0x26')]({'where':_0x59e4dd[_0x8fdb('0x44')]})[_0x8fdb('0x29')](function(_0x243a5f){_0x56e220[_0x8fdb('0x26')]=_0x243a5f;if(_0x55ad66[_0x8fdb('0x47')][_0x8fdb('0x45')]){_0x59e4dd['include']=[{'all':!![]}];}return db[_0x8fdb('0xec')][_0x8fdb('0x4d')](_0x59e4dd);})[_0x8fdb('0x29')](function(_0x2e14da){_0x56e220[_0x8fdb('0x4e')]=_0x2e14da;return _0x56e220;});}})[_0x8fdb('0x29')](respondWithFilteredResult(_0x70dd3c,_0x59e4dd))[_0x8fdb('0x1f')](handleError(_0x70dd3c,null));};exports[_0x8fdb('0xed')]=function(_0x114f96,_0x728b36){var _0x1b1eb8={};var _0x3003d8={};var _0xdf426c;var _0xc47a9c;return db[_0x8fdb('0x3f')]['findOne']({'where':{'id':_0x114f96[_0x8fdb('0x59')]['id']}})['then'](handleEntityNotFound(_0x728b36,null))[_0x8fdb('0x29')](function(_0x40c111){if(_0x40c111){_0xdf426c=_0x40c111;_0x3003d8[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xee')][_0x8fdb('0x40')]);_0x3003d8[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x114f96[_0x8fdb('0x47')]);_0x3003d8[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x3003d8[_0x8fdb('0x5e')],_0x3003d8[_0x8fdb('0x47')]);_0x1b1eb8[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x3003d8[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x114f96['query'][_0x8fdb('0x60')]));_0x1b1eb8[_0x8fdb('0x4b')]=_0x1b1eb8[_0x8fdb('0x4b')]['length']?_0x1b1eb8[_0x8fdb('0x4b')]:_0x3003d8['model'];_0x1b1eb8[_0x8fdb('0xe3')]=qs['sort'](_0x114f96[_0x8fdb('0x47')]['sort']);_0x1b1eb8['where']=qs['filters'](_[_0x8fdb('0xd2')](_0x114f96[_0x8fdb('0x47')],_0x3003d8[_0x8fdb('0x5d')]));if(_0x114f96['query'][_0x8fdb('0x33')]){_0x1b1eb8[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x1b1eb8[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x1b1eb8[_0x8fdb('0x4b')],function(_0x5e0d8b){var _0x7ed2f2={};_0x7ed2f2[_0x5e0d8b]={'$like':'%'+_0x114f96[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x7ed2f2;})});}_0x1b1eb8=_['merge']({},_0x1b1eb8,_0x114f96[_0x8fdb('0xdf')]);return _0xdf426c[_0x8fdb('0xed')](_0x1b1eb8);}})['then'](function(_0x1f3088){if(_0x1f3088){_0xc47a9c=_0x1f3088['length'];if(!_0x114f96['query']['hasOwnProperty'](_0x8fdb('0xd8'))){_0x1b1eb8['limit']=qs[_0x8fdb('0x24')](_0x114f96[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x1b1eb8[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x114f96[_0x8fdb('0x47')][_0x8fdb('0x25')]);}return _0xdf426c[_0x8fdb('0xed')](_0x1b1eb8);}})[_0x8fdb('0x29')](function(_0x592856){if(_0x592856){return _0x592856?{'count':_0xc47a9c,'rows':_0x592856}:null;}})['then'](respondWithResult(_0x728b36,null))['catch'](handleError(_0x728b36,null));};exports['getFaxInteractions']=function(_0xfbaaa9,_0x590022){var _0x3764ab={};var _0x488324={};var _0x3e1a21;var _0x23ef6b;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0xfbaaa9[_0x8fdb('0x59')]['id']}})['then'](handleEntityNotFound(_0x590022,null))[_0x8fdb('0x29')](function(_0xdebcf0){if(_0xdebcf0){_0x3e1a21=_0xdebcf0;_0x488324[_0x8fdb('0x5e')]=_[_0x8fdb('0x5c')](db[_0x8fdb('0xef')][_0x8fdb('0x40')]);_0x488324[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0xfbaaa9['query']);_0x488324[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x488324[_0x8fdb('0x5e')],_0x488324[_0x8fdb('0x47')]);_0x3764ab['attributes']=_['intersection'](_0x488324[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0xfbaaa9[_0x8fdb('0x47')]['fields']));_0x3764ab[_0x8fdb('0x4b')]=_0x3764ab[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x3764ab['attributes']:_0x488324['model'];_0x3764ab[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0xfbaaa9['query']['sort']);_0x3764ab['where']=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0xfbaaa9[_0x8fdb('0x47')],_0x488324[_0x8fdb('0x5d')]));if(_0xfbaaa9[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x3764ab[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x3764ab['where'],{'$or':_['map'](_0x3764ab[_0x8fdb('0x4b')],function(_0x5edea5){var _0x3bfc97={};_0x3bfc97[_0x5edea5]={'$like':'%'+_0xfbaaa9[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x3bfc97;})});}_0x3764ab=_[_0x8fdb('0xd3')]({},_0x3764ab,_0xfbaaa9[_0x8fdb('0xdf')]);return _0x3e1a21['getFaxInteractions'](_0x3764ab);}})[_0x8fdb('0x29')](function(_0x522c06){if(_0x522c06){_0x23ef6b=_0x522c06[_0x8fdb('0x50')];if(!_0xfbaaa9['query']['hasOwnProperty'](_0x8fdb('0xd8'))){_0x3764ab['limit']=qs[_0x8fdb('0x24')](_0xfbaaa9[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x3764ab[_0x8fdb('0x25')]=qs['offset'](_0xfbaaa9[_0x8fdb('0x47')][_0x8fdb('0x25')]);}return _0x3e1a21['getFaxInteractions'](_0x3764ab);}})['then'](function(_0x3fcb82){if(_0x3fcb82){return _0x3fcb82?{'count':_0x23ef6b,'rows':_0x3fcb82}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x590022,null))[_0x8fdb('0x1f')](handleError(_0x590022,null));};exports['getWhatsappInteractions']=function(_0x472dbd,_0x3b1f9c){var _0x551083={};var _0x34b121={};var _0x25a5b3;var _0x342a1a;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x472dbd[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x3b1f9c,null))[_0x8fdb('0x29')](function(_0x4e06f1){if(_0x4e06f1){_0x25a5b3=_0x4e06f1;_0x34b121['model']=_['keys'](db[_0x8fdb('0xf0')][_0x8fdb('0x40')]);_0x34b121[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x472dbd['query']);_0x34b121[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x34b121[_0x8fdb('0x5e')],_0x34b121[_0x8fdb('0x47')]);_0x551083[_0x8fdb('0x4b')]=_['intersection'](_0x34b121['model'],qs[_0x8fdb('0x60')](_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x551083[_0x8fdb('0x4b')]=_0x551083[_0x8fdb('0x4b')]['length']?_0x551083['attributes']:_0x34b121[_0x8fdb('0x5e')];_0x551083[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0x551083['where']=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x472dbd['query'],_0x34b121[_0x8fdb('0x5d')]));if(_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x551083[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x551083['where'],{'$or':_[_0x8fdb('0x35')](_0x551083['attributes'],function(_0x1a6353){var _0x1327c4={};_0x1327c4[_0x1a6353]={'$like':'%'+_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x1327c4;})});}_0x551083=_[_0x8fdb('0xd3')]({},_0x551083,_0x472dbd[_0x8fdb('0xdf')]);return _0x25a5b3[_0x8fdb('0xf1')](_0x551083);}})[_0x8fdb('0x29')](function(_0x3894a1){if(_0x3894a1){_0x342a1a=_0x3894a1[_0x8fdb('0x50')];if(!_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0xdd')](_0x8fdb('0xd8'))){_0x551083['limit']=qs[_0x8fdb('0x24')](_0x472dbd[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x551083[_0x8fdb('0x25')]=qs['offset'](_0x472dbd['query'][_0x8fdb('0x25')]);}return _0x25a5b3[_0x8fdb('0xf1')](_0x551083);}})[_0x8fdb('0x29')](function(_0x257441){if(_0x257441){return _0x257441?{'count':_0x342a1a,'rows':_0x257441}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x3b1f9c,null))['catch'](handleError(_0x3b1f9c,null));};exports['login']=function(_0x40fbb1,_0x5240b9,_0x56a5db){var _0x80184b;var _0x309dd1;var _0x331f71;var _0x4abec8=!_['isNil'](_0x40fbb1[_0x8fdb('0x59')]['id'])?_0x40fbb1[_0x8fdb('0x59')]['id']:!_[_0x8fdb('0x6a')](_0x40fbb1[_0x8fdb('0x30')]['id'])?_0x40fbb1['user']['id']:null;return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x4abec8,'role':{'$or':[_0x8fdb('0x82'),'user',_0x8fdb('0x2a')]}},'attributes':['id',_0x8fdb('0x3c'),_0x8fdb('0xf2'),_0x8fdb('0xf3'),_0x8fdb('0x2e'),_0x8fdb('0x69'),'loginInPause']})[_0x8fdb('0x29')](function(_0x536fbf){if(_0x536fbf){if(_0x536fbf[_0x8fdb('0x2e')]===_0x8fdb('0x2a')){_0x80184b=_0x536fbf;if(_0x40fbb1[_0x8fdb('0x62')][_0x8fdb('0x9f')]){_0x331f71=util['format'](_0x8fdb('0xf4'),_0x80184b[_0x40fbb1[_0x8fdb('0x62')]['interface']]);}else if(_0x40fbb1['body']['intrf']){_0x331f71=util[_0x8fdb('0xab')](_0x8fdb('0xac'),_0x40fbb1[_0x8fdb('0x62')][_0x8fdb('0xf5')]);}else{_0x331f71=util['format'](_0x8fdb('0xac'),_0x80184b['name']);}socket['to'](util['format'](_0x8fdb('0xf6'),_0x80184b[_0x8fdb('0x3c')]))[_0x8fdb('0xa7')]('user:forcelogout',{'user':{'id':_0x80184b['id'],'name':_0x80184b[_0x8fdb('0x3c')]},'ip':_0x40fbb1[_0x8fdb('0xf7')][_0x8fdb('0xf8')]||_0x40fbb1[_0x8fdb('0xf9')]['remoteAddress']||_0x40fbb1['socket']['remoteAddress']||_0x40fbb1['connection'][_0x8fdb('0xfa')][_0x8fdb('0xfb')]});return db[_0x8fdb('0xad')][_0x8fdb('0x2c')]({'where':{'membername':_0x80184b[_0x8fdb('0x3c')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0x8fdb('0xfc'));}})[_0x8fdb('0x29')](function(){if(_0x80184b){return _0x80184b[_0x8fdb('0xfd')]({'raw':!![]});}})['then'](function(_0x528766){if(_0x80184b){if(_0x528766){_0x309dd1=_0x528766;if(_0x309dd1['length']){var _0x2928c2=_0x309dd1[_0x8fdb('0x35')](function(_0x254b99){var _0x2677e2={'membername':_0x80184b[_0x8fdb('0x3c')],'UserId':_0x80184b['id'],'queue_name':_0x254b99[_0x8fdb('0x3c')],'VoiceQueueId':_0x254b99['id'],'interface':_0x331f71,'paused':_0x80184b[_0x8fdb('0x9e')]||![],'penalty':_0x254b99[_0x8fdb('0xfe')]||0x0};return db[_0x8fdb('0xad')][_0x8fdb('0xae')](_0x2677e2);});return Promise['all'](_0x2928c2);}}}})['then'](function(){if(_0x80184b){return db['MemberReport'][_0x8fdb('0x4d')]({'where':{'membername':_0x80184b['name'],'exitAt':null}});}})[_0x8fdb('0x29')](function(_0x39ed86){if(_0x80184b){var _0x2f2415=[];_0x39ed86['forEach'](function(_0x2fe3d7){_0x2f2415[_0x8fdb('0x4c')](_0x2fe3d7['update']({'exitAt':moment()['format'](_0x8fdb('0xff'))}));});return Promise['all'](_0x2f2415);}})[_0x8fdb('0x29')](function(){if(_0x80184b){var _0x569903=[];var _0x341fdb=[];var _0x54c24b=utils[_0x8fdb('0x100')]();var _0xdc4a05={'membername':_0x80184b['name'],'interface':_0x331f71,'enterAt':moment()[_0x8fdb('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x80184b['role'],'internal':_0x80184b[_0x8fdb('0x69')]};_0x54c24b[_0x8fdb('0x101')](function(_0x4a2af4){_0x569903[_0x8fdb('0x4c')](_[_0x8fdb('0xd3')]({'channel':_0x4a2af4,'type':_0x8fdb('0x102'),'data1':_0x40fbb1['body'][_0x8fdb('0x103')],'data2':_0x331f71},_0xdc4a05));if(_0x80184b[_0x8fdb('0x9e')]){_0x341fdb['push'](_[_0x8fdb('0xd3')]({'channel':_0x4a2af4,'type':_0x8fdb('0x104'),'data1':_0x8fdb('0x105')},_0xdc4a05));}});return db[_0x8fdb('0x106')][_0x8fdb('0x88')](_0x569903[_0x8fdb('0xcd')](_0x341fdb),{'individualHooks':!![]});}})[_0x8fdb('0x29')](function(){if(_0x80184b){return _0x80184b[_0x8fdb('0x28')]({'online':!![],'lastLoginAt':moment()[_0x8fdb('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x80184b['loginInPause']||![],'mailPause':_0x80184b[_0x8fdb('0x9e')]||![],'chatPause':_0x80184b[_0x8fdb('0x9e')]||![],'faxPause':_0x80184b['loginInPause']||![],'smsPause':_0x80184b[_0x8fdb('0x9e')]||![],'openchannelPause':_0x80184b[_0x8fdb('0x9e')]||![],'whatsappPause':_0x80184b['loginInPause']||![],'pauseType':_0x80184b[_0x8fdb('0x9e')]?_0x8fdb('0x105'):null,'interface':_0x331f71,'lastPauseAt':moment()['format'](_0x8fdb('0xff'))});}})['then'](function(_0x489a75){if(_0x40fbb1['isMiddleware']){return _0x56a5db();}else{return Promise[_0x8fdb('0x107')](_0x489a75)[_0x8fdb('0x29')](respondWithResult(_0x5240b9,null));}})[_0x8fdb('0x1f')](handleError(_0x5240b9,null));};exports['logout']=function(_0x182cb7,_0x402cc9){var _0x4d548c;return db[_0x8fdb('0x3f')][_0x8fdb('0x38')]({'where':{'id':_0x182cb7[_0x8fdb('0x59')]['id'],'role':_0x8fdb('0x2a')},'attributes':['id',_0x8fdb('0x3c'),_0x8fdb('0x2e')]})[_0x8fdb('0x29')](handleEntityNotFound(_0x402cc9,null))[_0x8fdb('0x29')](function(_0x14e5ae){if(_0x14e5ae){_0x4d548c=_0x14e5ae;return db[_0x8fdb('0xad')][_0x8fdb('0x2c')]({'where':{'membername':_0x4d548c[_0x8fdb('0x3c')]},'individualHooks':!![]});}})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x106')]['findAll']({'where':{'membername':_0x4d548c['name'],'exitAt':null}});})[_0x8fdb('0x29')](function(_0x5855fb){var _0x34e5c7=[];_0x5855fb[_0x8fdb('0x101')](function(_0x2849a9){_0x34e5c7['push'](_0x2849a9[_0x8fdb('0x28')]({'exitAt':moment()['format'](_0x8fdb('0xff'))}));});return Promise[_0x8fdb('0x57')](_0x34e5c7);})['then'](function(){return _0x4d548c[_0x8fdb('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8fdb('0x29')](respondWithResult(_0x402cc9,null))[_0x8fdb('0x1f')](handleError(_0x402cc9,null));};exports[_0x8fdb('0x108')]=function(_0x4b06ba,_0x119418){var _0x366a9f;return db[_0x8fdb('0xad')][_0x8fdb('0x28')]({'paused':0x1},{'where':{'UserId':_0x4b06ba[_0x8fdb('0x59')]['id']},'individualHooks':!![]})[_0x8fdb('0x29')](function(){return db['User'][_0x8fdb('0x38')]({'where':{'id':_0x4b06ba[_0x8fdb('0x59')]['id'],'role':'agent'},'attributes':['id','name',_0x8fdb('0x2e'),_0x8fdb('0x69'),_0x8fdb('0x9f'),_0x8fdb('0x9d')]});})['then'](handleEntityNotFound(_0x119418,null))[_0x8fdb('0x29')](function(_0xc9d0b5){if(_0xc9d0b5){_0x366a9f=_0xc9d0b5;return respondWithRpcPromise(_0x8fdb('0x109'),_0x8fdb('0x108'),{'id':_0x366a9f['id'],'name':_0x366a9f[_0x8fdb('0x3c')],'pause':!![]});}})['then'](function(){if(_0x366a9f){return db[_0x8fdb('0x106')][_0x8fdb('0x4d')]({'where':{'membername':_0x366a9f[_0x8fdb('0x3c')],'type':_0x8fdb('0x104'),'exitAt':null}});}})[_0x8fdb('0x29')](function(_0x4f902b){if(_0x4f902b['length']){var _0x47cc6d=moment()[_0x8fdb('0xab')](_0x8fdb('0xff'));for(var _0x46393a=0x0,_0xde41a0=_0x4f902b['length'];_0x46393a<_0xde41a0;_0x46393a++){_0x4f902b[_0x46393a][_0x8fdb('0x10a')]({'exitAt':_0x47cc6d});}}})[_0x8fdb('0x29')](function(){var _0x1e2acb=[];var _0x3d2778=utils[_0x8fdb('0x100')]();_0x3d2778[_0x8fdb('0x101')](function(_0x1df630){_0x1e2acb['push']({'channel':_0x1df630,'membername':_0x366a9f['name'],'interface':_[_0x8fdb('0x6a')](_0x366a9f[_0x8fdb('0x9f')])?util[_0x8fdb('0xab')](_0x8fdb('0xac'),_0x366a9f[_0x8fdb('0x3c')]):_0x366a9f['interface'],'type':_0x8fdb('0x104'),'enterAt':moment()[_0x8fdb('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4b06ba['body'][_0x8fdb('0x42')]||_0x8fdb('0x10b'),'role':_0x366a9f[_0x8fdb('0x2e')],'internal':_0x366a9f[_0x8fdb('0x69')]});});return db[_0x8fdb('0x106')][_0x8fdb('0x88')](_0x1e2acb,{'individualHooks':!![]});})[_0x8fdb('0x29')](function(){return _0x366a9f[_0x8fdb('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4b06ba[_0x8fdb('0x62')][_0x8fdb('0x42')]||_0x8fdb('0x10b'),'lastPauseAt':moment()[_0x8fdb('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x119418,null))[_0x8fdb('0x1f')](handleError(_0x119418,null));};exports[_0x8fdb('0x10c')]=function(_0x38be32,_0xb90d1){if(_0x38be32['body'][_0x8fdb('0x9c')]&&!utils[_0x8fdb('0xb0')](_0x38be32[_0x8fdb('0x62')][_0x8fdb('0x9c')])){throw new APIBadRequestError(util['format'](_0x8fdb('0x10d'),_0x38be32[_0x8fdb('0x62')][_0x8fdb('0x9c')]));}return db[_0x8fdb('0x3f')]['find']({'where':{'id':_0x38be32[_0x8fdb('0x59')]['id']},'attributes':['id',_0x8fdb('0x3c'),_0x8fdb('0x2e'),_0x8fdb('0x69'),_0x8fdb('0x9f'),_0x8fdb('0x9d'),_0x8fdb('0x10e'),_0x8fdb('0x10f'),'chatPause',_0x8fdb('0x110'),_0x8fdb('0x111'),'smsPause',_0x8fdb('0x112'),_0x8fdb('0x113'),_0x8fdb('0x114')]})[_0x8fdb('0x29')](function(_0x4b9774){if(!_0x4b9774){throw new APINotFoundError(util[_0x8fdb('0xab')](_0x8fdb('0x115'),_0x38be32[_0x8fdb('0x59')]['id']));}return _0x4b9774[_0x8fdb('0x10c')](_0x38be32[_0x8fdb('0x62')][_0x8fdb('0x9c')]);})[_0x8fdb('0x29')](respondWithResult(_0xb90d1,null))[_0x8fdb('0x1f')](APIHandleError(_0xb90d1));};exports['getTeams']=function(_0x40ab44,_0x5015de){var _0x58065f={};var _0x5a3948={};var _0xfc5335;var _0x1864f8;return db['User'][_0x8fdb('0xcf')]({'where':{'id':_0x40ab44['params']['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x5015de,null))[_0x8fdb('0x29')](function(_0x2d74ac){if(_0x2d74ac){_0xfc5335=_0x2d74ac;_0x5a3948['model']=_[_0x8fdb('0x5c')](db[_0x8fdb('0x116')]['rawAttributes']);_0x5a3948['query']=_[_0x8fdb('0x5c')](_0x40ab44['query']);_0x5a3948[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x5a3948[_0x8fdb('0x5e')],_0x5a3948[_0x8fdb('0x47')]);_0x58065f['attributes']=_[_0x8fdb('0x5f')](_0x5a3948[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x40ab44[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x58065f['attributes']=_0x58065f['attributes'][_0x8fdb('0x50')]?_0x58065f['attributes']:_0x5a3948['model'];_0x58065f[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x40ab44['query'][_0x8fdb('0xd1')]);_0x58065f[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x40ab44[_0x8fdb('0x47')],_0x5a3948[_0x8fdb('0x5d')]));if(_0x40ab44[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x58065f[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x58065f[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x58065f[_0x8fdb('0x4b')],function(_0x33144a){var _0x15cb8a={};_0x15cb8a[_0x33144a]={'$like':'%'+_0x40ab44['query'][_0x8fdb('0x33')]+'%'};return _0x15cb8a;})});}_0x58065f=_[_0x8fdb('0xd3')]({},_0x58065f,_0x40ab44[_0x8fdb('0xdf')]);return _0xfc5335['getTeams'](_0x58065f);}})[_0x8fdb('0x29')](function(_0x343403){if(_0x343403){_0x1864f8=_0x343403[_0x8fdb('0x50')];if(!_0x40ab44[_0x8fdb('0x47')][_0x8fdb('0xdd')]('nolimit')){_0x58065f['limit']=qs[_0x8fdb('0x24')](_0x40ab44['query']['limit']);_0x58065f[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x40ab44[_0x8fdb('0x47')][_0x8fdb('0x25')]);}return _0xfc5335['getTeams'](_0x58065f);}})[_0x8fdb('0x29')](function(_0x49cdd4){if(_0x49cdd4){return _0x49cdd4?{'count':_0x1864f8,'rows':_0x49cdd4}:null;}})['then'](respondWithResult(_0x5015de,null))['catch'](handleError(_0x5015de,null));};exports[_0x8fdb('0x117')]=function(_0x1e4d3c,_0xbb0b30){var _0x133450=_0x1e4d3c[_0x8fdb('0x59')]['id'];var _0x2e7cb2=_0x1e4d3c[_0x8fdb('0x62')]?_0x1e4d3c[_0x8fdb('0x62')]['ids']:null;var _0x2235c3=[];return Promise['resolve']()[_0x8fdb('0x29')](function(){if(!_0x2e7cb2)throw new APIBadRequestError(_0x8fdb('0x118'));})['then'](function(){return db['User'][_0x8fdb('0xcf')]({'where':{'id':_0x133450}});})[_0x8fdb('0x29')](function(_0x272b4f){if(!_0x272b4f)throw new APINotFoundError(util[_0x8fdb('0xab')](_0x8fdb('0x115'),_0x1e4d3c[_0x8fdb('0x59')]['id']));return db[_0x8fdb('0x6c')]['transaction'](function(_0x59c6cb){return _0x272b4f['addTeams'](_0x2e7cb2,{'transaction':_0x59c6cb})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x116')][_0x8fdb('0x4d')]({'where':{'id':{'$in':_0x2e7cb2}}});})[_0x8fdb('0x29')](function(_0x23da3c){var _0x538bab=_['map'](_0x23da3c,function(_0x450aba){return _0x450aba[_0x8fdb('0x119')]();});return Promise[_0x8fdb('0x57')](_0x538bab);})[_0x8fdb('0x29')](function(_0x5eafc5){_0x2235c3=_['flattenDeep'](_0x5eafc5);var _0x127914=_[_0x8fdb('0x35')](_0x2235c3,function(_0xee00ea){return _0xee00ea[_0x8fdb('0x11a')](_0x272b4f['id'],{'transaction':_0x59c6cb});});return Promise['all'](_0x127914);})[_0x8fdb('0x29')](function(){if(!_0x272b4f['online'])return;var _0x862a=_[_0x8fdb('0x33')](_0x2235c3,function(_0x7141b3){return _0x7141b3[_0x8fdb('0x11b')](_0x8fdb('0x9c'))===_0x8fdb('0x11c');});var _0x316aa6=_[_0x8fdb('0x35')](_0x862a,function(_0x7f37db){return db['UserVoiceQueueRt']['upsert']({'membername':_0x272b4f[_0x8fdb('0x3c')],'UserId':_0x272b4f['id'],'queue_name':_0x7f37db[_0x8fdb('0x3c')],'VoiceQueueId':_0x7f37db['id'],'interface':_[_0x8fdb('0x6a')](_0x272b4f[_0x8fdb('0x9f')])?util[_0x8fdb('0xab')](_0x8fdb('0xac'),_0x272b4f[_0x8fdb('0x3c')]):_0x272b4f[_0x8fdb('0x9f')],'paused':_0x272b4f[_0x8fdb('0x10e')]||![],'penalty':_0x272b4f[_0x8fdb('0xa5')]},{'transaction':_0x59c6cb});});return Promise['all'](_0x316aa6);})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x11d')][_0x8fdb('0x4d')]({'where':{'teamId':{'$in':_0x2e7cb2}}});})[_0x8fdb('0x29')](function(_0x58dba7){var _0x2a5df0=_[_0x8fdb('0x35')](_0x58dba7,function(_0x571fcf){return db[_0x8fdb('0x11e')]['create']({'UserId':_0x272b4f['id'],'VoicePrefixId':_0x571fcf[_0x8fdb('0x11f')]},{'transaction':_0x59c6cb});});return Promise[_0x8fdb('0x57')](_0x2a5df0);});});})['then'](function(){for(var _0x17eba1=0x0;_0x17eba1<_0x2235c3[_0x8fdb('0x50')];_0x17eba1++){var _0x427f79=_0x2235c3[_0x17eba1][_0x8fdb('0x11b')](_0x8fdb('0x9c'));var _0x287d08=_0x427f79+_0x8fdb('0xb3');socket['emit'](_0x8fdb('0x30')+_0x427f79+_0x8fdb('0xa8'),{'UserId':_0x133450,['queueField']:_0x2235c3[_0x17eba1]['id']});}})['then'](respondWithStatusCode(_0xbb0b30,null))['catch'](APIHandleError(_0xbb0b30));};exports[_0x8fdb('0x120')]=function(_0x33e1c8,_0x195e05){var _0x399d35=_0x33e1c8[_0x8fdb('0x59')]['id'];var _0x436646=null;if(_0x33e1c8[_0x8fdb('0x47')][_0x8fdb('0xa4')]){_0x436646=_[_0x8fdb('0xb2')](_0x33e1c8['query'][_0x8fdb('0xa4')])?_0x33e1c8[_0x8fdb('0x47')][_0x8fdb('0xa4')]:[_0x33e1c8[_0x8fdb('0x47')]['ids']];}var _0x5563f7=[];return Promise['resolve']()[_0x8fdb('0x29')](function(){if(!_0x436646)throw new APIBadRequestError(_0x8fdb('0x121'));})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x3f')]['findOne']({'where':{'id':_0x399d35}});})[_0x8fdb('0x29')](function(_0x4066c4){if(!_0x4066c4)throw new APINotFoundError(util['format'](_0x8fdb('0x115'),_0x33e1c8[_0x8fdb('0x59')]['id']));return db['sequelize']['transaction'](function(_0x29c71d){return _0x4066c4[_0x8fdb('0x120')](_0x436646,{'transaction':_0x29c71d})[_0x8fdb('0x29')](function(){return db[_0x8fdb('0x116')][_0x8fdb('0x4d')]({'where':{'id':{'$in':_0x436646}}});})[_0x8fdb('0x29')](function(_0x5e3710){var _0x59175f=_[_0x8fdb('0x35')](_0x5e3710,function(_0x43de12){return _0x43de12['getAssociatedQueues']();});return Promise[_0x8fdb('0x57')](_0x59175f);})[_0x8fdb('0x29')](function(_0x470bae){_0x5563f7=_[_0x8fdb('0x122')](_0x470bae);var _0x1ab0a4=_[_0x8fdb('0x35')](_0x5563f7,function(_0x5b17f1){return _0x5b17f1[_0x8fdb('0x123')](_0x4066c4['id'],{'transaction':_0x29c71d});});return Promise[_0x8fdb('0x57')](_0x1ab0a4);})[_0x8fdb('0x29')](function(){if(!_0x4066c4[_0x8fdb('0x9d')])return;var _0xbde909=_[_0x8fdb('0x33')](_0x5563f7,function(_0x40952c){return _0x40952c[_0x8fdb('0x11b')]('channel')===_0x8fdb('0x11c');});var _0x495c68=_[_0x8fdb('0x35')](_0xbde909,function(_0x4a29d9){return db[_0x8fdb('0xad')][_0x8fdb('0x2c')]({'where':{'VoiceQueueId':_0x4a29d9['id'],'UserId':_0x4066c4['id']},'transaction':_0x29c71d});});return Promise['all'](_0x495c68);})[_0x8fdb('0x29')](function(){return db['TeamVoicePrefix'][_0x8fdb('0x4d')]({'where':{'teamId':{'$in':_0x436646}}});})[_0x8fdb('0x29')](function(_0x12dbe1){var _0x240456=_[_0x8fdb('0x35')](_0x12dbe1,function(_0x37db70){return db[_0x8fdb('0x11e')][_0x8fdb('0x2c')]({'where':{'UserId':_0x4066c4['id'],'VoicePrefixId':_0x37db70[_0x8fdb('0x11f')]}},{'transaction':_0x29c71d});});return Promise[_0x8fdb('0x57')](_0x240456);});});})[_0x8fdb('0x29')](function(){for(var _0x57eb13=0x0;_0x57eb13<_0x5563f7['length'];_0x57eb13++){var _0xf72bb1=_0x5563f7[_0x57eb13][_0x8fdb('0x11b')](_0x8fdb('0x9c'));var _0x2266b8=_0xf72bb1+_0x8fdb('0xb3');socket[_0x8fdb('0xa7')](_0x8fdb('0x30')+_0xf72bb1+_0x8fdb('0xb4'),{'UserId':_0x399d35,['queueField']:_0x5563f7[_0x57eb13]['id']});}})['then'](respondWithStatusCode(_0x195e05,null))['catch'](APIHandleError(_0x195e05));};exports[_0x8fdb('0x124')]=function(_0x2671d4,_0x5136b5){var _0x4b9197={};var _0x4102e8={};var _0x14bb15;var _0x9c629c;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x2671d4['params']['id']}})['then'](handleEntityNotFound(_0x5136b5,null))[_0x8fdb('0x29')](function(_0xbeea92){if(_0xbeea92){_0x14bb15=_0xbeea92;_0x4102e8[_0x8fdb('0x5e')]=_['keys'](db[_0x8fdb('0x125')]['rawAttributes']);_0x4102e8[_0x8fdb('0x47')]=_[_0x8fdb('0x5c')](_0x2671d4[_0x8fdb('0x47')]);_0x4102e8[_0x8fdb('0x5d')]=_['intersection'](_0x4102e8['model'],_0x4102e8['query']);_0x4b9197[_0x8fdb('0x4b')]=_[_0x8fdb('0x5f')](_0x4102e8[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x2671d4[_0x8fdb('0x47')]['fields']));_0x4b9197['attributes']=_0x4b9197[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x4b9197['attributes']:_0x4102e8['model'];_0x4b9197[_0x8fdb('0xe3')]=qs[_0x8fdb('0xd1')](_0x2671d4[_0x8fdb('0x47')][_0x8fdb('0xd1')]);_0x4b9197[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_['pick'](_0x2671d4['query'],_0x4102e8[_0x8fdb('0x5d')]));if(_0x2671d4[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x4b9197['where']=_[_0x8fdb('0xd3')](_0x4b9197[_0x8fdb('0x44')],{'$or':_['map'](_0x4b9197[_0x8fdb('0x4b')],function(_0x4f0649){var _0x17bb17={};_0x17bb17[_0x4f0649]={'$like':'%'+_0x2671d4[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x17bb17;})});}_0x4b9197=_[_0x8fdb('0xd3')]({},_0x4b9197,_0x2671d4[_0x8fdb('0xdf')]);return _0x14bb15[_0x8fdb('0x124')](_0x4b9197);}})[_0x8fdb('0x29')](function(_0x115b45){if(_0x115b45){_0x9c629c=_0x115b45['length'];if(!_0x2671d4['query'][_0x8fdb('0xdd')]('nolimit')){_0x4b9197[_0x8fdb('0x24')]=qs[_0x8fdb('0x24')](_0x2671d4[_0x8fdb('0x47')][_0x8fdb('0x24')]);_0x4b9197[_0x8fdb('0x25')]=qs[_0x8fdb('0x25')](_0x2671d4['query']['offset']);}return _0x14bb15[_0x8fdb('0x124')](_0x4b9197);}})[_0x8fdb('0x29')](function(_0x4fe35f){if(_0x4fe35f){return _0x4fe35f?{'count':_0x9c629c,'rows':_0x4fe35f}:null;}})[_0x8fdb('0x29')](respondWithResult(_0x5136b5,null))[_0x8fdb('0x1f')](handleError(_0x5136b5,null));};exports['getAgents']=function(_0x204422,_0x45ac13){var _0x42f88a={};var _0x12873f={};var _0xab6790;return db[_0x8fdb('0x3f')][_0x8fdb('0xcf')]({'where':{'id':_0x204422[_0x8fdb('0x59')]['id']}})[_0x8fdb('0x29')](handleEntityNotFound(_0x45ac13,null))[_0x8fdb('0x29')](function(_0x485bea){if(_0x485bea){_0xab6790=_0x485bea;_0x12873f[_0x8fdb('0x5e')]=_['keys'](db[_0x8fdb('0x3f')][_0x8fdb('0x40')]);_0x12873f['query']=_[_0x8fdb('0x5c')](_0x204422[_0x8fdb('0x47')]);_0x12873f[_0x8fdb('0x5d')]=_[_0x8fdb('0x5f')](_0x12873f['model'],_0x12873f[_0x8fdb('0x47')]);_0x42f88a['attributes']=_[_0x8fdb('0x5f')](_0x12873f[_0x8fdb('0x5e')],qs[_0x8fdb('0x60')](_0x204422[_0x8fdb('0x47')][_0x8fdb('0x60')]));_0x42f88a[_0x8fdb('0x4b')]=_0x42f88a[_0x8fdb('0x4b')][_0x8fdb('0x50')]?_0x42f88a[_0x8fdb('0x4b')]:_0x12873f[_0x8fdb('0x5e')];_0x42f88a[_0x8fdb('0xe3')]=qs['sort'](_0x204422['query'][_0x8fdb('0xd1')]);_0x42f88a[_0x8fdb('0x44')]=qs[_0x8fdb('0x5d')](_[_0x8fdb('0xd2')](_0x204422['query'],_0x12873f[_0x8fdb('0x5d')]));if(_0x204422[_0x8fdb('0x47')][_0x8fdb('0x33')]){_0x42f88a[_0x8fdb('0x44')]=_[_0x8fdb('0xd3')](_0x42f88a[_0x8fdb('0x44')],{'$or':_[_0x8fdb('0x35')](_0x42f88a[_0x8fdb('0x4b')],function(_0x90810d){var _0x1ac5b2={};_0x1ac5b2[_0x90810d]={'$like':'%'+_0x204422[_0x8fdb('0x47')][_0x8fdb('0x33')]+'%'};return _0x1ac5b2;})});}_0x42f88a[_0x8fdb('0x5e')]=db[_0x8fdb('0x3f')];_0x42f88a['as']=_0x8fdb('0x31');_0x42f88a=_[_0x8fdb('0xd3')]({},_0x42f88a,_0x204422['options']);return _0xab6790['getVoiceQueues']({'include':[_0x42f88a]});}})[_0x8fdb('0x29')](function(_0x1d7ffb){if(_0x1d7ffb){var _0x6fa177={},_0x128383=[];for(var _0x885d17=0x0;_0x885d17<_0x1d7ffb[_0x8fdb('0x50')];_0x885d17+=0x1){for(var _0x182e4b=0x0,_0x12d3b8;_0x182e4b<_0x1d7ffb[_0x885d17]['Agents'][_0x8fdb('0x50')];_0x182e4b+=0x1){_0x12d3b8=_0x1d7ffb[_0x885d17][_0x8fdb('0x31')][_0x182e4b]['get']({'plain':!![]});_0x6fa177[_0x12d3b8['id']]=_0x12d3b8;}}_0x6fa177=_[_0x8fdb('0x126')](_0x6fa177);for(var _0x11a941=qs[_0x8fdb('0x25')](_0x204422['query'][_0x8fdb('0x25')]);_0x11a941<_0x6fa177['length']&&_0x128383[_0x8fdb('0x50')]=_0x5c728e){_0x16d243=_0x5c728e;_0xb0e953=0xc8;}else{_0xb0e953=0xce;}_0x4a4e8b['status'](_0xb0e953);return _0x4a4e8b[_0x86c8('0x24')](_0x86c8('0x25'),_0x53d606+'-'+_0x16d243+'/'+_0x5c728e)[_0x86c8('0x26')](_0x4606dc);}return null;};}function saveUpdates(_0x4f5cab){return function(_0x44709c){if(_0x44709c){return _0x44709c[_0x86c8('0x27')](_0x4f5cab)[_0x86c8('0x13')](function(_0x35f1c4){if(_0x35f1c4[_0x86c8('0x28')]===_0x86c8('0x29')){socket[_0x86c8('0x2a')](_0x86c8('0x2b')+_0x35f1c4['id'],_0x35f1c4);}return _0x35f1c4;});}return null;};}function removeEntity(_0x468e21){return function(_0x12d852){if(_0x12d852){return _0x12d852[_0x86c8('0x2c')]()[_0x86c8('0x13')](function(){var _0x3ad4a3=_0x12d852[_0x86c8('0x2d')]({'plain':!![]});if(_0x3ad4a3[_0x86c8('0x28')]===_0x86c8('0x2e'))return;var _0xcee529=[{'name':_0x86c8('0x2f'),'value':_0x86c8('0x30'),'ignore':!![]},{'name':_0x86c8('0x31'),'value':_0x86c8('0x29'),'ignore':![]},{'name':_0x86c8('0x32'),'value':_0x86c8('0x33'),'ignore':![]}];var _0x3d2f10=_(_0xcee529)['filter']('ignore')[_0x86c8('0x34')]('value')[_0x86c8('0x35')]();if(_['includes'](_0x3d2f10,_0x3ad4a3['role'])){return;}var _0x117e45=_[_0x86c8('0x36')](_0xcee529,[_0x86c8('0x35'),_0x3ad4a3[_0x86c8('0x28')]])[_0x86c8('0x37')];return db[_0x86c8('0x38')][_0x86c8('0x2c')]({'where':{'type':_0x117e45,'resourceId':_0x3ad4a3['id']}})[_0x86c8('0x13')](function(){return _0x12d852;});})['then'](function(){_0x468e21[_0x86c8('0x1e')](0xcc)[_0x86c8('0x1f')]();});}};}function handleEntityNotFound(_0x3d7682){return function(_0x584c60){if(!_0x584c60){_0x3d7682[_0x86c8('0x39')](0x194);}return _0x584c60;};}function handleError(_0x2ff7e9,_0x5dbade){_0x5dbade=_0x5dbade||0x1f4;return function(_0x13ad14){logger[_0x86c8('0x19')](_0x13ad14[_0x86c8('0x3a')]);if(_0x13ad14[_0x86c8('0x37')]){delete _0x13ad14[_0x86c8('0x37')];}_0x2ff7e9[_0x86c8('0x1e')](_0x5dbade)[_0x86c8('0x3b')](_0x13ad14);};}exports['index']=function(_0x4b2411,_0x590f60){var _0x4269e8={},_0x485b1e={'count':0x0,'rows':[]};var _0x313840=_(db[_0x86c8('0x3c')][_0x86c8('0x3d')])[_0x86c8('0x34')](function(_0x3cb73c){return{'name':_0x3cb73c[_0x86c8('0x3e')],'type':_0x3cb73c[_0x86c8('0x3f')][_0x86c8('0x40')]};})[_0x86c8('0x41')](function(_0x225cab){return!_[_0x86c8('0x42')]([_0x86c8('0x43'),_0x86c8('0x44')],_0x225cab['name']);})['value']();_0x4269e8=qs[_0x86c8('0x45')](_0x313840,_0x4b2411);var _0x343cba={'where':_0x4269e8[_0x86c8('0x46')]};return db['User'][_0x86c8('0x22')](_0x343cba)[_0x86c8('0x13')](function(_0x5eb4f1){_0x485b1e[_0x86c8('0x22')]=_0x5eb4f1;if(_0x4b2411[_0x86c8('0x47')][_0x86c8('0x48')]){_0x4269e8['include']=[{'all':!![]}];}if(_0x4b2411[_0x86c8('0x47')][_0x86c8('0x49')]===_0x86c8('0x4a')){_0x4269e8[_0x86c8('0x4b')]=[{'model':db[_0x86c8('0x4c')],'as':_0x86c8('0x49')}];}if(!_[_0x86c8('0x42')](_0x4269e8['attributes'],'id')){_0x4269e8[_0x86c8('0x4d')][_0x86c8('0x4e')]('id');}return db[_0x86c8('0x3c')]['findAll'](_0x4269e8);})[_0x86c8('0x13')](function(_0x31d5bd){_0x485b1e[_0x86c8('0x4f')]=_0x31d5bd;if(_0x4b2411[_0x86c8('0x47')][_0x86c8('0x50')]===_0x86c8('0x4a')){var _0x2722be=[];for(var _0xa30bff=0x0;_0xa30bff<_0x485b1e['rows'][_0x86c8('0x51')];_0xa30bff++){_0x2722be[_0x86c8('0x4e')](get_open_tabs('chat',_0x485b1e[_0x86c8('0x4f')][_0xa30bff][_0x86c8('0x52')]));_0x2722be[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x53'),_0x485b1e[_0x86c8('0x4f')][_0xa30bff][_0x86c8('0x52')]));_0x2722be[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x54'),_0x485b1e[_0x86c8('0x4f')][_0xa30bff][_0x86c8('0x52')]));_0x2722be[_0x86c8('0x4e')](get_open_tabs('mail',_0x485b1e[_0x86c8('0x4f')][_0xa30bff][_0x86c8('0x52')]));_0x2722be[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x55'),_0x485b1e[_0x86c8('0x4f')][_0xa30bff]['dataValues']));_0x2722be[_0x86c8('0x4e')](get_open_tabs('whatsapp',_0x485b1e[_0x86c8('0x4f')][_0xa30bff][_0x86c8('0x52')]));}return Promise['all'](_0x2722be)[_0x86c8('0x13')](function(){return _0x485b1e;});}else{return _0x485b1e;}})['then'](respondWithFilteredResult(_0x590f60,_0x4269e8))['catch'](handleError(_0x590f60,null));};exports['show']=function(_0x184ec7,_0x344081){var _0xb5f438={'raw':![],'where':{'id':_0x184ec7[_0x86c8('0x56')]['id']}},_0x4df749={};_0x4df749['model']=_['differenceBy'](_[_0x86c8('0x57')](db[_0x86c8('0x3c')][_0x86c8('0x3d')]),['password',_0x86c8('0x44')]);_0x4df749[_0x86c8('0x47')]=_['keys'](_0x184ec7[_0x86c8('0x47')]);_0x4df749['filters']=_[_0x86c8('0x58')](_0x4df749[_0x86c8('0x59')],_0x4df749[_0x86c8('0x47')]);_0xb5f438[_0x86c8('0x4d')]=_['intersection'](_0x4df749[_0x86c8('0x59')],qs[_0x86c8('0x5a')](_0x184ec7[_0x86c8('0x47')][_0x86c8('0x5a')]));_0xb5f438[_0x86c8('0x4d')]=_0xb5f438[_0x86c8('0x4d')]['length']?_0xb5f438[_0x86c8('0x4d')]:_0x4df749['model'];if(_0x184ec7['query'][_0x86c8('0x48')]){_0xb5f438['include']=[{'all':!![]}];}if(_0x184ec7[_0x86c8('0x47')][_0x86c8('0x49')]==='true'){_0xb5f438['include']=[{'model':db[_0x86c8('0x4c')],'as':_0x86c8('0x49')}];}_0xb5f438=_[_0x86c8('0x5b')]({},_0xb5f438,_0x184ec7[_0x86c8('0x5c')]);if(!_[_0x86c8('0x42')](_0xb5f438[_0x86c8('0x4d')],'id')){_0xb5f438[_0x86c8('0x4d')][_0x86c8('0x4e')]('id');}return db['User']['find'](_0xb5f438)[_0x86c8('0x13')](handleEntityNotFound(_0x344081,null))['then'](function(_0x9d7369){var _0x3667ce=[];values=_0x9d7369;if(_0x184ec7[_0x86c8('0x47')][_0x86c8('0x50')]===_0x86c8('0x4a')){_0x3667ce[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x5d'),_0x9d7369['dataValues']));_0x3667ce[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x53'),_0x9d7369[_0x86c8('0x52')]));_0x3667ce[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x55'),_0x9d7369['dataValues']));_0x3667ce[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x5e'),_0x9d7369[_0x86c8('0x52')]));_0x3667ce[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x54'),_0x9d7369[_0x86c8('0x52')]));_0x3667ce[_0x86c8('0x4e')](get_open_tabs('mail',_0x9d7369[_0x86c8('0x52')]));return Promise['all'](_0x3667ce);}else{return values;}})[_0x86c8('0x13')](function(){return values;})['then'](respondWithResult(_0x344081,null))[_0x86c8('0x1d')](handleError(_0x344081,null));};exports[_0x86c8('0x27')]=function(_0x272236,_0x14e6e3){if(_0x272236[_0x86c8('0x5f')]['id']){delete _0x272236[_0x86c8('0x5f')]['id'];}delete _0x272236['body'][_0x86c8('0x28')];return db[_0x86c8('0x3c')][_0x86c8('0x36')]({'where':{'id':_0x272236[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x14e6e3,null))[_0x86c8('0x13')](saveUpdates(_0x272236[_0x86c8('0x5f')],null))[_0x86c8('0x13')](respondWithResult(_0x14e6e3,null))[_0x86c8('0x1d')](handleError(_0x14e6e3,null));};exports[_0x86c8('0x60')]=function(_0x2be59c,_0x289a7a){return db['User'][_0x86c8('0x60')]()[_0x86c8('0x13')](respondWithResult(_0x289a7a,null))[_0x86c8('0x1d')](handleError(_0x289a7a,null));};exports[_0x86c8('0x61')]=function(_0x2d27f6,_0x4789f4){return db['User']['find']({'where':{'id':_0x2d27f6[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x4789f4,null))[_0x86c8('0x13')](function(_0x1a9d9f){if(_0x1a9d9f){return _0x1a9d9f[_0x86c8('0x61')](_0x2d27f6['body']['ids'],_[_0x86c8('0x62')](_0x2d27f6[_0x86c8('0x5f')],['ids','id'])||{});}})[_0x86c8('0x13')](respondWithResult(_0x4789f4,null))['catch'](handleError(_0x4789f4,null));};function validateUser(_0xa04ef3){return new Promise(function(_0x5786ad,_0x59e93d){if(_0xa04ef3[_0x86c8('0x63')])return _0x5786ad(_0xa04ef3);return db[_0x86c8('0x64')][_0x86c8('0x65')](0x1)['then'](function(_0x2b955e){if(_0x2b955e[_0x86c8('0x66')])authService[_0x86c8('0x67')](_0xa04ef3[_0x86c8('0x43')]);db[_0x86c8('0x3c')][_0x86c8('0x68')](_0x86c8('0x63'))[_0x86c8('0x13')](function(_0x1c8128){if(_[_0x86c8('0x69')](_0x1c8128)){_0xa04ef3[_0x86c8('0x63')]=_0x2b955e[_0x86c8('0x6a')]||0x1;return;}if(_[_0x86c8('0x69')](_0x2b955e[_0x86c8('0x6a')])||_0x2b955e[_0x86c8('0x6a')]===_0x1c8128){_0xa04ef3['internal']=_0x1c8128+0x1;return;}if(_0x2b955e[_0x86c8('0x6a')]>_0x1c8128){_0xa04ef3[_0x86c8('0x63')]=_0x2b955e[_0x86c8('0x6a')];return;}return db[_0x86c8('0x6b')]['query'](_0x86c8('0x6c'),{'type':db[_0x86c8('0x6b')][_0x86c8('0x6d')][_0x86c8('0x6e')]})[_0x86c8('0x13')](function(_0x2817b3){if(_0x2817b3&&_0x2817b3[_0x86c8('0x51')]){for(var _0x173b32=0x0,_0x30c81e=_0x2817b3[_0x86c8('0x51')];_0x173b32<_0x30c81e&&_['isNil'](_0xa04ef3[_0x86c8('0x63')]);_0x173b32++){if(_0x2b955e[_0x86c8('0x6a')]<=_0x2817b3[_0x173b32][_0x86c8('0x6f')]){_0xa04ef3['internal']=_0x2817b3[_0x173b32][_0x86c8('0x6f')];}else if(_0x2b955e['min_internal']>_0x2817b3[_0x173b32][_0x86c8('0x6f')]&&_0x2b955e[_0x86c8('0x6a')]<=_0x2817b3[_0x173b32]['to']){_0xa04ef3[_0x86c8('0x63')]=_0x2b955e[_0x86c8('0x6a')];}}}if(_[_0x86c8('0x69')](_0xa04ef3[_0x86c8('0x63')])){_0xa04ef3['internal']=_0x1c8128+0x1;}return _0x5786ad(_0xa04ef3);});});})[_0x86c8('0x1d')](function(_0x473f6c){_0x59e93d(_0x473f6c);});});}function updateUser(_0x35a8ce){return new Promise(function(_0x5068cb,_0x46b0f4){try{if(_0x35a8ce[_0x86c8('0x70')]){_0x35a8ce['mailbox']=_0x35a8ce[_0x86c8('0x63')];_0x35a8ce[_0x86c8('0x71')]={'mailbox':_0x35a8ce[_0x86c8('0x63')],'password':_0x35a8ce[_0x86c8('0x43')],'fullname':_0x35a8ce[_0x86c8('0x72')],'email':_0x35a8ce['email']};}if(_0x35a8ce[_0x86c8('0x28')]==='agent'){if(!_0x35a8ce['permissions'])_0x35a8ce[_0x86c8('0x73')]=[_0x86c8('0x74'),_0x86c8('0x75'),_0x86c8('0x76'),_0x86c8('0x77'),_0x86c8('0x78'),_0x86c8('0x79'),'105','106',_0x86c8('0x7a'),_0x86c8('0x7b'),'109','100',_0x86c8('0x7c'),_0x86c8('0x7d'),'115'];}_0x5068cb(_0x35a8ce);}catch(_0x34ca18){_0x46b0f4(_0x34ca18);}});}exports[_0x86c8('0x7e')]=function(_0x44b4cf,_0x592294){if(_0x44b4cf[_0x86c8('0x30')][_0x86c8('0x28')]===_0x86c8('0x29'))throw new Error(_0x86c8('0x7f'));if(_0x44b4cf['body']['role']===_0x86c8('0x30')&&_0x44b4cf[_0x86c8('0x30')][_0x86c8('0x28')]!==_0x86c8('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x44b4cf[_0x86c8('0x5f')][_0x86c8('0x28')]===_0x86c8('0x2e')&&_0x44b4cf[_0x86c8('0x30')]['role']!=='admin'){throw new Error(_0x86c8('0x80'));}return licenseUtil[_0x86c8('0x81')]([_0x44b4cf[_0x86c8('0x5f')]])[_0x86c8('0x13')](function(){return validateUser(_0x44b4cf[_0x86c8('0x5f')]);})[_0x86c8('0x13')](function(_0x3a52b3){return updateUser(_0x3a52b3)['then'](function(_0x4ef4e5){if(_0x4ef4e5['role']===_0x86c8('0x2e')){_0x4ef4e5[_0x86c8('0x82')]=_0x44b4cf[_0x86c8('0x30')][_0x86c8('0x82')];delete _0x4ef4e5[_0x86c8('0x83')];}return _0x4ef4e5;});})[_0x86c8('0x13')](function(_0x2efb29){return db['User'][_0x86c8('0x7e')](_0x2efb29,{'include':[{'model':db[_0x86c8('0x71')],'as':'VoiceMail'}]});})[_0x86c8('0x13')](function(_0x5e862b){if(_0x44b4cf[_0x86c8('0x5f')][_0x86c8('0x28')]==='user')return _0x5e862b;if(_0x44b4cf[_0x86c8('0x30')][_0x86c8('0x28')]!==_0x86c8('0x30'))return _0x5e862b;return db[_0x86c8('0x84')][_0x86c8('0x36')]({'where':{'name':_0x5e862b[_0x86c8('0x28')]===_0x86c8('0x29')?'Agents':_0x86c8('0x32'),'userProfileId':_0x44b4cf[_0x86c8('0x30')]['userProfileId']},'raw':!![]})['then'](function(_0x35750e){if(!_0x35750e||_0x35750e[_0x86c8('0x85')]!=0x0)return _0x5e862b;return db[_0x86c8('0x38')]['create']({'name':_0x5e862b[_0x86c8('0x37')],'resourceId':_0x5e862b['id'],'type':_0x35750e[_0x86c8('0x37')],'sectionId':_0x35750e['id']},{})[_0x86c8('0x13')](function(){return _0x5e862b;});})[_0x86c8('0x1d')](function(_0x106622){logger[_0x86c8('0x19')](_0x86c8('0x86'),_0x106622);throw _0x106622;});})[_0x86c8('0x13')](respondWithResult(_0x592294,0xc9))['catch'](handleError(_0x592294,null));};exports['bulkCreate']=function(_0x1e7753,_0x5adf61){var _0x33339d=_0x1e7753[_0x86c8('0x5f')];var _0x3a191f=[];if(_0x1e7753[_0x86c8('0x30')][_0x86c8('0x28')]===_0x86c8('0x29'))throw new Error(_0x86c8('0x7f'));if(_[_0x86c8('0x87')](_0x33339d,['role',_0x86c8('0x30')])&&_0x1e7753[_0x86c8('0x30')][_0x86c8('0x28')]!==_0x86c8('0x2e')){throw new Error(_0x86c8('0x88'));}if(_['some'](_0x33339d,[_0x86c8('0x28'),_0x86c8('0x2e')])&&_0x1e7753[_0x86c8('0x30')][_0x86c8('0x28')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x86c8('0x81')](_0x33339d)[_0x86c8('0x13')](function(){return validateUser(_0x33339d[0x0]);})[_0x86c8('0x13')](function(){for(var _0x20a12c=0x1;_0x20a12c<_0x33339d[_0x86c8('0x51')];_0x20a12c++){var _0x139400=_0x33339d[_0x20a12c-0x1]['internal'];if(!_0x33339d[_0x20a12c][_0x86c8('0x63')])_0x33339d[_0x20a12c]['internal']=_0x139400+0x1;_0x3a191f['push'](validateUser(_0x33339d[_0x20a12c]));}return Promise[_0x86c8('0x89')](_0x3a191f);})[_0x86c8('0x13')](function(){_0x3a191f=[];for(var _0x4eb2d8=0x0;_0x4eb2d8<_0x33339d[_0x86c8('0x51')];_0x4eb2d8++){_0x3a191f[_0x86c8('0x4e')](updateUser(_0x33339d[_0x4eb2d8]));}return Promise[_0x86c8('0x89')](_0x3a191f);})['then'](function(){_0x3a191f=_0x33339d[_0x86c8('0x34')](function(_0x37e5f8){return db['User']['create'](_0x37e5f8,{'include':[{'model':db['VoiceMail'],'as':_0x86c8('0x71')}]})[_0x86c8('0x13')](function(_0x28d1e7){_0x37e5f8['id']=_0x28d1e7['id'];return _0x37e5f8;});});return Promise[_0x86c8('0x89')](_0x3a191f);})[_0x86c8('0x13')](function(_0x410599){if(_0x1e7753[_0x86c8('0x5f')][_0x86c8('0x28')]===_0x86c8('0x30'))return _0x410599;if(_0x1e7753[_0x86c8('0x30')][_0x86c8('0x28')]!=='user')return _0x410599;var _0x1bf304=_[_0x86c8('0x87')](_0x410599,function(_0x404ede){return _0x404ede[_0x86c8('0x28')]===_0x86c8('0x29')||_0x404ede[_0x86c8('0x28')]==='telephone';});if(!_0x1bf304)return _0x410599;return db[_0x86c8('0x84')][_0x86c8('0x8a')]({'where':{'name':{'$or':[_0x86c8('0x31'),_0x86c8('0x32')]},'userProfileId':_0x1e7753['user']['userProfileId']},'raw':!![]})[_0x86c8('0x13')](function(_0x5ac4a3){if(_[_0x86c8('0x8b')](_0x5ac4a3)||!_[_0x86c8('0x87')](_0x5ac4a3,[_0x86c8('0x85'),0x0]))return _0x410599;_0x3a191f=[];var _0x102242=_(_0x5ac4a3)['map'](function(_0x252e27){if(_0x252e27['autoAssociation']===0x1)return;return _0x252e27[_0x86c8('0x37')]==='Agents'?'agent':_0x86c8('0x33');})[_0x86c8('0x8c')]()[_0x86c8('0x35')]();for(var _0x4736b7=0x0;_0x4736b7<_0x410599['length'];_0x4736b7++){if(!_[_0x86c8('0x42')](_0x102242,_0x410599[_0x4736b7][_0x86c8('0x28')]))return;var _0x28a5e9=_0x410599[_0x4736b7][_0x86c8('0x28')]==='agent'?'Agents':_0x86c8('0x32');_0x3a191f[_0x86c8('0x4e')](db[_0x86c8('0x38')][_0x86c8('0x7e')]({'name':_0x410599[_0x4736b7][_0x86c8('0x37')],'resourceId':_0x410599[_0x4736b7]['id'],'type':_0x28a5e9,'sectionId':_['find'](_0x5ac4a3,[_0x86c8('0x37'),_0x28a5e9])['id']},{}));}return Promise['all'](_0x3a191f);});})[_0x86c8('0x13')](respondWithResult(_0x5adf61,0xc9))[_0x86c8('0x1d')](handleError(_0x5adf61,null));};exports[_0x86c8('0x8d')]=function(_0x155321,_0x115b56){if(_0x155321[_0x86c8('0x5f')]['id']){delete _0x155321[_0x86c8('0x5f')]['id'];}return db[_0x86c8('0x3c')][_0x86c8('0x36')]({'where':{'id':_0x155321[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](function(_0x1fe873){if(!_0x1fe873)return null;if(_0x1fe873['id']===_0x155321[_0x86c8('0x30')]['id']){if(!_0x155321[_0x86c8('0x5f')]['oldPassword']||!_0x155321[_0x86c8('0x5f')][_0x86c8('0x8e')]){throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x1fe873['authenticate'](_0x155321[_0x86c8('0x5f')][_0x86c8('0x91')])){throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))](_0x86c8('0x92'));}if(_0x155321[_0x86c8('0x5f')][_0x86c8('0x91')]===_0x155321[_0x86c8('0x5f')]['newPassword']){throw new db['Sequelize'][(_0x86c8('0x90'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x155321[_0x86c8('0x30')][_0x86c8('0x28')]===_0x86c8('0x2e')){if(!_0x155321[_0x86c8('0x5f')][_0x86c8('0x8e')]){throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x155321['user'][_0x86c8('0x28')]===_0x86c8('0x30')){if(!_0x155321[_0x86c8('0x5f')][_0x86c8('0x8e')]){throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))](_0x86c8('0x93'));}if(_0x1fe873[_0x86c8('0x28')]!==_0x86c8('0x29')){throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))](_0x86c8('0x7f'));}}else{throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))]('Unauthorized');}return _0x1fe873;})[_0x86c8('0x13')](handleEntityNotFound(_0x115b56,null))[_0x86c8('0x13')](function(_0x5bbc30){return db[_0x86c8('0x64')][_0x86c8('0x94')]({'attributes':['id','securePassword',_0x86c8('0x95'),_0x86c8('0x96')]})['then'](function(_0x3a106e){if(_0x3a106e[_0x86c8('0x66')])authService['validatePasswordPattern'](_0x155321[_0x86c8('0x5f')][_0x86c8('0x8e')]);if(!_0x3a106e[_0x86c8('0x95')]||!_0x5bbc30[_0x86c8('0x97')])return _0x5bbc30;authService[_0x86c8('0x98')](_0x155321['body'][_0x86c8('0x8e')],_0x5bbc30['previousPasswords'],_0x3a106e['passwordHistoryLimit']);return _0x5bbc30;})[_0x86c8('0x13')](saveUpdates({'password':_0x155321[_0x86c8('0x5f')][_0x86c8('0x8e')],'passwordResetAt':_0x155321[_0x86c8('0x30')]['id']==_0x155321[_0x86c8('0x56')]['id']?moment():null,'previousPasswords':authService[_0x86c8('0x99')](_0x155321[_0x86c8('0x5f')][_0x86c8('0x8e')],_0x5bbc30[_0x86c8('0x97')])},null));})[_0x86c8('0x13')](respondWithResult(_0x115b56,null))[_0x86c8('0x1d')](handleError(_0x115b56,null));};exports[_0x86c8('0x9a')]=function(_0x5414c5,_0x1df49c){var _0x460714=_0x5414c5[_0x86c8('0x5f')][_0x86c8('0x9b')];return db[_0x86c8('0x3c')][_0x86c8('0x36')]({'where':{'id':_0x5414c5['params']['id']},'attributes':['id',_0x86c8('0x37'),_0x86c8('0x28'),_0x86c8('0x9c'),_0x86c8('0x9d'),'voicePause',_0x86c8('0x9e')]})[_0x86c8('0x13')](handleEntityNotFound(_0x1df49c,null))['then'](function(_0x9d1571){if(_0x9d1571){if(!utils['isValidChannel'](_0x460714)){throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))]('Unknown\x20channel');}return _0x9d1571['add'+_[_0x86c8('0x9f')](_0x460714[_0x86c8('0xa0')]())+'Queues'](_0x5414c5[_0x86c8('0x5f')][_0x86c8('0xa1')],{'penalty':_0x5414c5[_0x86c8('0x5f')][_0x86c8('0xa2')]||0x0})[_0x86c8('0xa3')](function(_0x8fd3f9){for(var _0x1f05a5=0x0;_0x1f05a5<_0x5414c5[_0x86c8('0x5f')][_0x86c8('0xa1')]['length'];_0x1f05a5+=0x1){var _0x1fe5ff={'UserId':Number(_0x5414c5[_0x86c8('0x56')]['id'])};_0x1fe5ff[_['capitalize'](_0x460714[_0x86c8('0xa0')]())+_0x86c8('0xa4')]=Number(_0x5414c5['body'][_0x86c8('0xa1')][_0x1f05a5]);socket['emit'](_0x86c8('0x30')+_[_0x86c8('0x9f')](_0x460714[_0x86c8('0xa0')]())+_0x86c8('0xa5'),_0x1fe5ff);}return _0x8fd3f9;})[_0x86c8('0x13')](function(){if(_0x460714===_0x86c8('0xa6')){return db[_0x86c8('0xa7')]['findAll']({'where':{'id':_0x5414c5[_0x86c8('0x5f')][_0x86c8('0xa1')]||[]},'raw':!![],'attributes':['id',_0x86c8('0x37')]});}})[_0x86c8('0x13')](function(_0x24ee25){var _0x522c81=_0x9d1571[_0x86c8('0x2d')]({'plain':!![]});var _0x2b1d16=[];if(_0x460714===_0x86c8('0xa6')&&_0x522c81[_0x86c8('0x28')]===_0x86c8('0x29')&&_0x522c81[_0x86c8('0x9c')]){for(let _0x4ede4b=0x0;_0x4ede4b<_0x24ee25['length'];_0x4ede4b+=0x1){_0x2b1d16[_0x86c8('0x4e')]({'membername':_0x522c81[_0x86c8('0x37')],'UserId':_0x522c81['id'],'queue_name':_0x24ee25[_0x4ede4b]['name'],'VoiceQueueId':_0x24ee25[_0x4ede4b]['id'],'interface':_[_0x86c8('0x69')](_0x522c81[_0x86c8('0x9e')])?util[_0x86c8('0xa8')](_0x86c8('0xa9'),_0x522c81['name']):_0x522c81['interface'],'paused':_0x522c81[_0x86c8('0xaa')]||![],'penalty':_0x5414c5[_0x86c8('0x5f')]['penalty']||0x0});}return Promise[_0x86c8('0x89')](_0x2b1d16['map'](function(_0x492b84){return db[_0x86c8('0xab')][_0x86c8('0xac')](_0x492b84);}));}return _0x9d1571;});}})[_0x86c8('0x13')](respondWithStatusCode(_0x1df49c,null))[_0x86c8('0x1d')](handleError(_0x1df49c,null));};exports[_0x86c8('0xad')]=function(_0x5403e2,_0x416c51){var _0x43e5bb,_0x2cd169;return db[_0x86c8('0x3c')][_0x86c8('0x36')]({'where':{'id':_0x5403e2[_0x86c8('0x56')]['id']},'attributes':['id',_0x86c8('0x37'),_0x86c8('0x28')]})['then'](handleEntityNotFound(_0x416c51,null))['then'](function(_0x4c1bd1){if(_0x4c1bd1){_0x43e5bb=_0x4c1bd1;if(!_0x5403e2[_0x86c8('0x47')][_0x86c8('0x9b')]||!utils[_0x86c8('0xae')](_0x5403e2[_0x86c8('0x47')][_0x86c8('0x9b')])){throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))](_0x86c8('0xaf'));}return _0x4c1bd1['remove'+_[_0x86c8('0x9f')](_0x5403e2['query'][_0x86c8('0x9b')][_0x86c8('0xa0')]())+_0x86c8('0xb0')](_0x5403e2['query'][_0x86c8('0xa1')]);}})[_0x86c8('0x13')](function(_0x2f6c8f){if(_[_0x86c8('0xb1')](_0x5403e2[_0x86c8('0x47')]['ids'])){for(var _0x167caf=0x0;_0x167caf<_0x5403e2[_0x86c8('0x47')][_0x86c8('0xa1')][_0x86c8('0x51')];_0x167caf+=0x1){_0x2cd169={'UserId':Number(_0x5403e2[_0x86c8('0x56')]['id'])};_0x2cd169[_[_0x86c8('0x9f')](_0x5403e2[_0x86c8('0x47')][_0x86c8('0x9b')][_0x86c8('0xa0')]())+'QueueId']=Number(_0x5403e2[_0x86c8('0x47')]['ids'][_0x167caf]);socket[_0x86c8('0x2a')](_0x86c8('0x30')+_[_0x86c8('0x9f')](_0x5403e2[_0x86c8('0x47')][_0x86c8('0x9b')][_0x86c8('0xa0')]())+_0x86c8('0xb2'),_0x2cd169);}}else{_0x2cd169={'UserId':Number(_0x5403e2['params']['id'])};_0x2cd169[_[_0x86c8('0x9f')](_0x5403e2[_0x86c8('0x47')][_0x86c8('0x9b')][_0x86c8('0xa0')]())+'QueueId']=Number(_0x5403e2['query'][_0x86c8('0xa1')]);socket['emit'](_0x86c8('0x30')+_[_0x86c8('0x9f')](_0x5403e2[_0x86c8('0x47')][_0x86c8('0x9b')]['toLowerCase']())+_0x86c8('0xb2'),_0x2cd169);}return _0x2f6c8f;})['then'](function(){if(_0x5403e2[_0x86c8('0x47')][_0x86c8('0x9b')]===_0x86c8('0xa6')){return db[_0x86c8('0xab')][_0x86c8('0x2c')]({'where':{'UserId':_0x5403e2['params']['id'],'VoiceQueueId':_0x5403e2[_0x86c8('0x47')][_0x86c8('0xa1')]},'individualHooks':!![]})[_0x86c8('0x13')](function(){return _0x43e5bb;});}return _0x43e5bb;})[_0x86c8('0x13')](respondWithStatusCode(_0x416c51,null))[_0x86c8('0x1d')](handleError(_0x416c51,null));};exports['addAvatar']=function(_0x2e879d,_0x19958b){_0x2e879d['body'][_0x86c8('0xb3')]=_0x2e879d[_0x86c8('0xb4')][_0x86c8('0xb5')];return db[_0x86c8('0x3c')][_0x86c8('0x36')]({'where':{'id':_0x2e879d['params']['id']}})['then'](handleEntityNotFound(_0x19958b,null))[_0x86c8('0x13')](saveUpdates(_0x2e879d['body'],null))[_0x86c8('0x13')](respondWithResult(_0x19958b,null))[_0x86c8('0x1d')](handleError(_0x19958b,null));};exports[_0x86c8('0xb6')]=function(_0x4e0607,_0x251d40){var _0x44462a=path[_0x86c8('0xb7')](config['root'],_0x86c8('0xb8'));return db[_0x86c8('0x3c')][_0x86c8('0x36')]({'where':{'id':_0x4e0607[_0x86c8('0x56')]['id']},'attributes':['id',_0x86c8('0xb3')],'raw':!![]})[_0x86c8('0x13')](handleEntityNotFound(_0x251d40,null))['then'](function(_0x54ddf6){if(_0x54ddf6){if(_[_0x86c8('0x69')](_0x54ddf6[_0x86c8('0xb3')])){return _0x251d40['download'](_0x44462a);}else{if(!fs[_0x86c8('0xb9')](path[_0x86c8('0xb7')](config[_0x86c8('0xba')],'server/files/images/',_0x54ddf6[_0x86c8('0xb3')]))){return _0x251d40[_0x86c8('0xbb')](_0x44462a);}return _0x251d40[_0x86c8('0xbb')](path[_0x86c8('0xb7')](config['root'],'server/files/images/',_0x54ddf6['userpic']));}}})[_0x86c8('0x1d')](handleError(_0x251d40,null));};exports[_0x86c8('0xbc')]=function(_0x295b2c,_0x315360){return db[_0x86c8('0x3c')]['find']({'where':{'id':_0x295b2c[_0x86c8('0x56')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x315360,null))[_0x86c8('0x13')](function(_0x5ce2a5){var _0x829ac2=[];values=_0x5ce2a5['dataValues'];_0x829ac2[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x5d'),_0x5ce2a5[_0x86c8('0x52')]));_0x829ac2[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x53'),_0x5ce2a5[_0x86c8('0x52')]));_0x829ac2[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x55'),_0x5ce2a5['dataValues']));_0x829ac2['push'](get_open_tabs(_0x86c8('0x5e'),_0x5ce2a5[_0x86c8('0x52')]));_0x829ac2[_0x86c8('0x4e')](get_open_tabs(_0x86c8('0x54'),_0x5ce2a5[_0x86c8('0x52')]));_0x829ac2[_0x86c8('0x4e')](get_open_tabs('mail',_0x5ce2a5[_0x86c8('0x52')]));return Promise['all'](_0x829ac2);})[_0x86c8('0x13')](function(_0x5916ab){if(_0x5916ab){var _0x3a779e=_['map'](values['ChatOpenTabs'],function(_0x1d7424){return{'channel':_0x86c8('0xbd'),'id':_0x1d7424['id'],'createdAt':_0x1d7424[_0x86c8('0xbe')]};});var _0x2f7859=_[_0x86c8('0x34')](values[_0x86c8('0xbf')],function(_0xcb5e23){return{'channel':'FAX','id':_0xcb5e23['id'],'createdAt':_0xcb5e23[_0x86c8('0xbe')]};});var _0x1421cc=_[_0x86c8('0x34')](values[_0x86c8('0xc0')],function(_0x510ef3){return{'channel':'OPENCHANNEL','id':_0x510ef3['id'],'createdAt':_0x510ef3[_0x86c8('0xbe')]};});var _0x2dc793=_[_0x86c8('0x34')](values[_0x86c8('0xc1')],function(_0x2801c9){return{'channel':'MAIL','id':_0x2801c9['id'],'createdAt':_0x2801c9[_0x86c8('0xbe')]};});var _0x171170=_[_0x86c8('0x34')](values[_0x86c8('0xc2')],function(_0xd80fcb){return{'channel':_0x86c8('0xc3'),'id':_0xd80fcb['id'],'createdAt':_0xd80fcb[_0x86c8('0xbe')]};});var _0x453526=_[_0x86c8('0x34')](values[_0x86c8('0xc4')],function(_0x2fb50b){return{'channel':_0x86c8('0xc5'),'id':_0x2fb50b['id'],'createdAt':_0x2fb50b[_0x86c8('0xbe')]};});var _0x21c91a=_[_0x86c8('0xc6')](_0x3a779e,_0x2f7859,_0x1421cc,_0x2dc793,_0x171170,_0x453526);var _0x4a0530={'count':_0x21c91a['length'],'rows':_0x21c91a};return _0x4a0530;}else return null;})[_0x86c8('0x13')](respondWithResult(_0x315360,null))[_0x86c8('0x1d')](handleError(_0x315360,null));};exports[_0x86c8('0xc7')]=function(_0x352bae,_0x112259){var _0x2e04be={};var _0x1c5d1f={};var _0x1af474;var _0x55b2b8;return db['User'][_0x86c8('0x94')]({'where':{'id':_0x352bae['params']['id']}})['then'](handleEntityNotFound(_0x112259,null))[_0x86c8('0x13')](function(_0x334ab9){if(_0x334ab9){_0x1af474=_0x334ab9;_0x1c5d1f[_0x86c8('0x59')]=_['keys'](db['CmContact']['rawAttributes']);_0x1c5d1f[_0x86c8('0x47')]=_['keys'](_0x352bae['query']);_0x1c5d1f[_0x86c8('0xc8')]=_[_0x86c8('0x58')](_0x1c5d1f[_0x86c8('0x59')],_0x1c5d1f[_0x86c8('0x47')]);_0x2e04be[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x1c5d1f[_0x86c8('0x59')],qs[_0x86c8('0x5a')](_0x352bae[_0x86c8('0x47')][_0x86c8('0x5a')]));_0x2e04be[_0x86c8('0x4d')]=_0x2e04be[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x2e04be[_0x86c8('0x4d')]:_0x1c5d1f['model'];_0x2e04be[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x352bae['query'][_0x86c8('0xca')]);_0x2e04be[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x352bae[_0x86c8('0x47')],_0x1c5d1f[_0x86c8('0xc8')]));if(_0x352bae[_0x86c8('0x47')][_0x86c8('0x41')]){_0x2e04be[_0x86c8('0x46')]=_[_0x86c8('0x5b')](_0x2e04be[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x2e04be[_0x86c8('0x4d')],function(_0x30431e){var _0x505fdd={};_0x505fdd[_0x30431e]={'$like':'%'+_0x352bae[_0x86c8('0x47')][_0x86c8('0x41')]+'%'};return _0x505fdd;})});}_0x2e04be=_[_0x86c8('0x5b')]({},_0x2e04be,_0x352bae[_0x86c8('0x5c')]);return _0x1af474['getContacts'](_0x2e04be);}})[_0x86c8('0x13')](function(_0x56ebc9){if(_0x56ebc9){_0x55b2b8=_0x56ebc9['length'];if(_0x352bae['query']['hasOwnProperty']('includeAll')){_0x2e04be[_0x86c8('0x4b')]=[{'model':db[_0x86c8('0xcc')],'as':_0x86c8('0xcd'),'required':![]},{'model':db[_0x86c8('0xce')],'as':_0x86c8('0xcf'),'attributes':['id','name',_0x86c8('0xd0')],'where':_0x352bae['query'][_0x86c8('0xd1')]?{'id':_0x352bae[_0x86c8('0x47')][_0x86c8('0xd1')]}:undefined,'required':_0x352bae[_0x86c8('0x47')]['tag']?!![]:![]}];}if(!_0x352bae[_0x86c8('0x47')][_0x86c8('0xd2')](_0x86c8('0xd3'))){_0x2e04be[_0x86c8('0x21')]=qs[_0x86c8('0x21')](_0x352bae[_0x86c8('0x47')][_0x86c8('0x21')]);_0x2e04be['offset']=qs['offset'](_0x352bae['query'][_0x86c8('0x23')]);}return _0x1af474[_0x86c8('0xc7')](_0x2e04be);}})['then'](function(_0x60f6cc){if(_0x60f6cc){return _0x60f6cc?{'count':_0x55b2b8,'rows':_0x60f6cc}:null;}})[_0x86c8('0x13')](respondWithResult(_0x112259,null))['catch'](handleError(_0x112259,null));};exports[_0x86c8('0xd4')]=function(_0x4038a5,_0x335315){var _0x1b7be4;var _0x1ac1b5={};var _0x37a0d3;return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x4038a5[_0x86c8('0x56')]['id']},'attributes':['id',_0x86c8('0x37'),'role']})[_0x86c8('0x13')](handleEntityNotFound(_0x335315,null))[_0x86c8('0x13')](function(_0x31daa3){if(!utils[_0x86c8('0xae')](_0x4038a5[_0x86c8('0x47')][_0x86c8('0x9b')])){throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))](_0x86c8('0xaf'));}_0x1b7be4=_0x31daa3;var _0x570a68={};_0x570a68['model']=_[_0x86c8('0x57')](db[_[_0x86c8('0x9f')](_0x4038a5[_0x86c8('0x47')][_0x86c8('0x9b')])+_0x86c8('0xd5')][_0x86c8('0x3d')]);_0x570a68['query']=_[_0x86c8('0x57')](_0x4038a5[_0x86c8('0x47')]);_0x570a68[_0x86c8('0xc8')]=_[_0x86c8('0x58')](_0x570a68[_0x86c8('0x59')],_0x570a68[_0x86c8('0x47')]);_0x1ac1b5['attributes']=_[_0x86c8('0x58')](_0x570a68[_0x86c8('0x59')],qs[_0x86c8('0x5a')](_0x4038a5['query'][_0x86c8('0x5a')]));_0x1ac1b5[_0x86c8('0x4d')]=_0x1ac1b5[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x1ac1b5[_0x86c8('0x4d')]:_0x570a68[_0x86c8('0x59')];_0x1ac1b5[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x4038a5[_0x86c8('0x47')][_0x86c8('0xca')]);_0x1ac1b5[_0x86c8('0x46')]=qs['filters'](_['pick'](_0x4038a5['query'],_0x570a68[_0x86c8('0xc8')]));if(_0x4038a5['query'][_0x86c8('0x41')]){_0x1ac1b5['where']=_['merge'](_0x1ac1b5[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x1ac1b5['attributes'],function(_0x133af1){var _0x19da82={};_0x19da82[_0x133af1]={'$like':'%'+_0x4038a5['query'][_0x86c8('0x41')]+'%'};return _0x19da82;})});}_0x1ac1b5=_[_0x86c8('0x5b')]({},_0x1ac1b5,_0x4038a5[_0x86c8('0x5c')]);switch(_0x1b7be4[_0x86c8('0x28')]){case _0x86c8('0x2e'):return db[_[_0x86c8('0x9f')](_0x4038a5[_0x86c8('0x47')]['channel'])+_0x86c8('0xd5')][_0x86c8('0x8a')](_0x1ac1b5);case _0x86c8('0x30'):case _0x86c8('0x29'):return _0x1b7be4[_0x86c8('0x2d')+_['capitalize'](_0x4038a5[_0x86c8('0x47')][_0x86c8('0x9b')])+'Queues'](_0x1ac1b5);default:throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))]('Unknown\x20role');}})[_0x86c8('0x13')](function(_0xab7a5e){_0x37a0d3=_0xab7a5e[_0x86c8('0x51')];if(!_0x4038a5['query'][_0x86c8('0xd2')]('nolimit')){_0x1ac1b5['limit']=qs['limit'](_0x4038a5['query']['limit']);_0x1ac1b5[_0x86c8('0x23')]=qs['offset'](_0x4038a5[_0x86c8('0x47')][_0x86c8('0x23')]);}switch(_0x1b7be4[_0x86c8('0x28')]){case _0x86c8('0x2e'):return db[_[_0x86c8('0x9f')](_0x4038a5[_0x86c8('0x47')][_0x86c8('0x9b')])+_0x86c8('0xd5')][_0x86c8('0x8a')](_0x1ac1b5);case _0x86c8('0x30'):case _0x86c8('0x29'):return _0x1b7be4['get'+_[_0x86c8('0x9f')](_0x4038a5[_0x86c8('0x47')][_0x86c8('0x9b')])+_0x86c8('0xb0')](_0x1ac1b5);}})[_0x86c8('0x13')](function(_0xfad38){return{'count':_0x37a0d3,'rows':_0xfad38};})[_0x86c8('0x13')](respondWithResult(_0x335315,null))[_0x86c8('0x1d')](handleError(_0x335315,null));};exports[_0x86c8('0xd6')]=function(_0x1658ce,_0x2199d4){var _0x5606a7={};var _0x2995d1={};var _0x37353f;var _0x2ce48a;return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x1658ce[_0x86c8('0x56')]['id']}})['then'](handleEntityNotFound(_0x2199d4,null))['then'](function(_0x3f20e2){if(_0x3f20e2){_0x37353f=_0x3f20e2;_0x2995d1[_0x86c8('0x59')]=_[_0x86c8('0x57')](db[_0x86c8('0xab')][_0x86c8('0x3d')]);_0x2995d1['query']=_['keys'](_0x1658ce[_0x86c8('0x47')]);_0x2995d1[_0x86c8('0xc8')]=_['intersection'](_0x2995d1['model'],_0x2995d1[_0x86c8('0x47')]);_0x5606a7[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x2995d1['model'],qs[_0x86c8('0x5a')](_0x1658ce['query'][_0x86c8('0x5a')]));_0x5606a7[_0x86c8('0x4d')]=_0x5606a7[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x5606a7[_0x86c8('0x4d')]:_0x2995d1[_0x86c8('0x59')];_0x5606a7[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x1658ce[_0x86c8('0x47')][_0x86c8('0xca')]);_0x5606a7[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x1658ce[_0x86c8('0x47')],_0x2995d1[_0x86c8('0xc8')]));if(_0x1658ce[_0x86c8('0x47')][_0x86c8('0x41')]){_0x5606a7[_0x86c8('0x46')]=_[_0x86c8('0x5b')](_0x5606a7['where'],{'$or':_[_0x86c8('0x34')](_0x5606a7[_0x86c8('0x4d')],function(_0x520be7){var _0x306e39={};_0x306e39[_0x520be7]={'$like':'%'+_0x1658ce[_0x86c8('0x47')]['filter']+'%'};return _0x306e39;})});}_0x5606a7=_['merge']({},_0x5606a7,_0x1658ce['options']);return _0x37353f[_0x86c8('0xd6')](_0x5606a7);}})[_0x86c8('0x13')](function(_0x434eed){if(_0x434eed){_0x2ce48a=_0x434eed[_0x86c8('0x51')];if(!_0x1658ce[_0x86c8('0x47')][_0x86c8('0xd2')](_0x86c8('0xd3'))){_0x5606a7['limit']=qs[_0x86c8('0x21')](_0x1658ce[_0x86c8('0x47')][_0x86c8('0x21')]);_0x5606a7[_0x86c8('0x23')]=qs[_0x86c8('0x23')](_0x1658ce[_0x86c8('0x47')][_0x86c8('0x23')]);}return _0x37353f[_0x86c8('0xd6')](_0x5606a7);}})[_0x86c8('0x13')](function(_0x1482b8){if(_0x1482b8){return _0x1482b8?{'count':_0x2ce48a,'rows':_0x1482b8}:null;}})[_0x86c8('0x13')](respondWithResult(_0x2199d4,null))['catch'](handleError(_0x2199d4,null));};exports[_0x86c8('0xd7')]=function(_0x2eb7e9,_0x27cc0e){var _0x5c7d18={};var _0x24ed35={};var _0x591ed1;var _0x343b13;return db['User'][_0x86c8('0x94')]({'where':{'id':_0x2eb7e9[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x27cc0e,null))[_0x86c8('0x13')](function(_0x30820a){if(_0x30820a){_0x591ed1=_0x30820a;_0x24ed35['model']=_[_0x86c8('0x57')](db[_0x86c8('0xd8')]['rawAttributes']);_0x24ed35[_0x86c8('0x47')]=_['keys'](_0x2eb7e9[_0x86c8('0x47')]);_0x24ed35[_0x86c8('0xc8')]=_[_0x86c8('0x58')](_0x24ed35[_0x86c8('0x59')],_0x24ed35['query']);_0x5c7d18['attributes']=_['intersection'](_0x24ed35[_0x86c8('0x59')],qs[_0x86c8('0x5a')](_0x2eb7e9[_0x86c8('0x47')][_0x86c8('0x5a')]));_0x5c7d18['attributes']=_0x5c7d18['attributes']['length']?_0x5c7d18[_0x86c8('0x4d')]:_0x24ed35['model'];_0x5c7d18[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x2eb7e9[_0x86c8('0x47')][_0x86c8('0xca')]);_0x5c7d18[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x2eb7e9['query'],_0x24ed35[_0x86c8('0xc8')]));if(_0x2eb7e9[_0x86c8('0x47')][_0x86c8('0x41')]){_0x5c7d18[_0x86c8('0x46')]=_['merge'](_0x5c7d18[_0x86c8('0x46')],{'$or':_['map'](_0x5c7d18['attributes'],function(_0x46ef91){var _0x1290b6={};_0x1290b6[_0x46ef91]={'$like':'%'+_0x2eb7e9[_0x86c8('0x47')][_0x86c8('0x41')]+'%'};return _0x1290b6;})});}_0x5c7d18=_['merge']({},_0x5c7d18,_0x2eb7e9[_0x86c8('0x5c')]);return _0x591ed1[_0x86c8('0xd7')](_0x5c7d18);}})['then'](function(_0x267335){if(_0x267335){_0x343b13=_0x267335[_0x86c8('0x51')];if(!_0x2eb7e9[_0x86c8('0x47')][_0x86c8('0xd2')](_0x86c8('0xd3'))){_0x5c7d18[_0x86c8('0x21')]=qs[_0x86c8('0x21')](_0x2eb7e9[_0x86c8('0x47')][_0x86c8('0x21')]);_0x5c7d18['offset']=qs[_0x86c8('0x23')](_0x2eb7e9[_0x86c8('0x47')][_0x86c8('0x23')]);}return _0x591ed1[_0x86c8('0xd7')](_0x5c7d18);}})[_0x86c8('0x13')](function(_0x27e1d7){if(_0x27e1d7){return _0x27e1d7?{'count':_0x343b13,'rows':_0x27e1d7}:null;}})[_0x86c8('0x13')](respondWithResult(_0x27cc0e,null))[_0x86c8('0x1d')](handleError(_0x27cc0e,null));};exports[_0x86c8('0xd9')]=function(_0x42d5ff,_0x5e45f7){var _0x1c9515={'raw':!![],'where':{}};var _0x16eb4d={};var _0x796e84={'count':0x0,'rows':[]};return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x42d5ff[_0x86c8('0x56')]['id']}})['then'](handleEntityNotFound(_0x5e45f7,null))['then'](function(_0x1cb0e2){if(_0x1cb0e2){_0x16eb4d[_0x86c8('0x59')]=_[_0x86c8('0x57')](db[_0x86c8('0xda')][_0x86c8('0x3d')]);_0x16eb4d[_0x86c8('0x47')]=_['keys'](_0x42d5ff[_0x86c8('0x47')]);_0x16eb4d[_0x86c8('0xc8')]=_[_0x86c8('0x58')](_0x16eb4d[_0x86c8('0x59')],_0x16eb4d[_0x86c8('0x47')]);_0x1c9515[_0x86c8('0x4d')]=_['intersection'](_0x16eb4d[_0x86c8('0x59')],qs['fields'](_0x42d5ff[_0x86c8('0x47')][_0x86c8('0x5a')]));_0x1c9515[_0x86c8('0x4d')]=_0x1c9515['attributes'][_0x86c8('0x51')]?_0x1c9515[_0x86c8('0x4d')]:_0x16eb4d['model'];if(!_0x42d5ff['query'][_0x86c8('0xd2')](_0x86c8('0xd3'))){_0x1c9515[_0x86c8('0x21')]=qs['limit'](_0x42d5ff[_0x86c8('0x47')][_0x86c8('0x21')]);_0x1c9515[_0x86c8('0x23')]=qs[_0x86c8('0x23')](_0x42d5ff[_0x86c8('0x47')][_0x86c8('0x23')]);}_0x1c9515[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x42d5ff['query'][_0x86c8('0xca')]);_0x1c9515[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x42d5ff[_0x86c8('0x47')],_0x16eb4d['filters']));_0x1c9515[_0x86c8('0x46')][_0x86c8('0xdb')]=_0x1cb0e2['id'];if(_0x42d5ff[_0x86c8('0x47')][_0x86c8('0x41')]){_0x1c9515[_0x86c8('0x46')]=_['merge'](_0x1c9515[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x1c9515[_0x86c8('0x4d')],function(_0x425486){var _0x3d3741={};_0x3d3741[_0x425486]={'$like':'%'+_0x42d5ff['query'][_0x86c8('0x41')]+'%'};return _0x3d3741;})});}_0x1c9515=_['merge']({},_0x1c9515,_0x42d5ff[_0x86c8('0x5c')]);return db[_0x86c8('0xda')][_0x86c8('0x22')]({'where':_0x1c9515[_0x86c8('0x46')]})[_0x86c8('0x13')](function(_0x32d875){_0x796e84[_0x86c8('0x22')]=_0x32d875;if(_0x42d5ff['query'][_0x86c8('0x48')]){_0x1c9515['include']=[{'all':!![]}];}return db[_0x86c8('0xda')][_0x86c8('0x8a')](_0x1c9515);})['then'](function(_0x4889bd){_0x796e84[_0x86c8('0x4f')]=_0x4889bd;return _0x796e84;});}})[_0x86c8('0x13')](respondWithFilteredResult(_0x5e45f7,_0x1c9515))[_0x86c8('0x1d')](handleError(_0x5e45f7,null));};exports[_0x86c8('0xdc')]=function(_0x1de52b,_0x43f6d0){var _0x256698={'raw':!![],'where':{}};var _0x1d53ff={};var _0x464b72={'count':0x0,'rows':[]};return db['User'][_0x86c8('0x94')]({'where':{'id':_0x1de52b[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x43f6d0,null))[_0x86c8('0x13')](function(_0x5c401c){if(_0x5c401c){_0x1d53ff[_0x86c8('0x59')]=_[_0x86c8('0x57')](db['ScreenRecording'][_0x86c8('0x3d')]);_0x1d53ff[_0x86c8('0x47')]=_[_0x86c8('0x57')](_0x1de52b['query']);_0x1d53ff['filters']=_[_0x86c8('0x58')](_0x1d53ff['model'],_0x1d53ff[_0x86c8('0x47')]);_0x256698[_0x86c8('0x4d')]=_['intersection'](_0x1d53ff[_0x86c8('0x59')],qs[_0x86c8('0x5a')](_0x1de52b[_0x86c8('0x47')][_0x86c8('0x5a')]));_0x256698[_0x86c8('0x4d')]=_0x256698[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x256698['attributes']:_0x1d53ff[_0x86c8('0x59')];if(!_0x1de52b[_0x86c8('0x47')]['hasOwnProperty']('nolimit')){_0x256698['limit']=qs[_0x86c8('0x21')](_0x1de52b[_0x86c8('0x47')]['limit']);_0x256698[_0x86c8('0x23')]=qs['offset'](_0x1de52b[_0x86c8('0x47')]['offset']);}_0x256698[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x1de52b[_0x86c8('0x47')][_0x86c8('0xca')]);_0x256698[_0x86c8('0x46')]=qs['filters'](_['pick'](_0x1de52b[_0x86c8('0x47')],_0x1d53ff['filters']));_0x256698['where'][_0x86c8('0xdb')]=_0x5c401c['id'];if(_0x1de52b[_0x86c8('0x47')][_0x86c8('0x41')]){_0x256698['where']=_['merge'](_0x256698[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x256698[_0x86c8('0x4d')],function(_0x4a7eb1){var _0x3fb40a={};_0x3fb40a[_0x4a7eb1]={'$like':'%'+_0x1de52b['query']['filter']+'%'};return _0x3fb40a;})});}_0x256698=_[_0x86c8('0x5b')]({},_0x256698,_0x1de52b[_0x86c8('0x5c')]);return db[_0x86c8('0xdd')][_0x86c8('0x22')]({'where':_0x256698[_0x86c8('0x46')]})[_0x86c8('0x13')](function(_0xdc6dc0){_0x464b72[_0x86c8('0x22')]=_0xdc6dc0;if(_0x1de52b[_0x86c8('0x47')][_0x86c8('0x48')]){_0x256698[_0x86c8('0x4b')]=[{'all':!![]}];}return db[_0x86c8('0xdd')]['findAll'](_0x256698);})[_0x86c8('0x13')](function(_0x12d5c3){_0x464b72['rows']=_0x12d5c3;return _0x464b72;});}})[_0x86c8('0x13')](respondWithFilteredResult(_0x43f6d0,_0x256698))[_0x86c8('0x1d')](handleError(_0x43f6d0,null));};exports[_0x86c8('0xde')]=function(_0x48fa40,_0x24eb50){var _0x338531={};var _0x3d189b={};var _0x282d1b;var _0x241fa2;return db['User'][_0x86c8('0x94')]({'where':{'id':_0x48fa40[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x24eb50,null))['then'](function(_0x35283f){if(_0x35283f){_0x282d1b=_0x35283f;_0x3d189b[_0x86c8('0x59')]=_[_0x86c8('0x57')](db[_0x86c8('0xdf')][_0x86c8('0x3d')]);_0x3d189b[_0x86c8('0x47')]=_[_0x86c8('0x57')](_0x48fa40['query']);_0x3d189b[_0x86c8('0xc8')]=_['intersection'](_0x3d189b[_0x86c8('0x59')],_0x3d189b[_0x86c8('0x47')]);_0x338531[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x3d189b['model'],qs[_0x86c8('0x5a')](_0x48fa40[_0x86c8('0x47')]['fields']));_0x338531['attributes']=_0x338531['attributes'][_0x86c8('0x51')]?_0x338531['attributes']:_0x3d189b[_0x86c8('0x59')];_0x338531[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x48fa40[_0x86c8('0x47')]['sort']);_0x338531['where']=qs['filters'](_['pick'](_0x48fa40[_0x86c8('0x47')],_0x3d189b[_0x86c8('0xc8')]));if(_0x48fa40[_0x86c8('0x47')][_0x86c8('0x41')]){_0x338531[_0x86c8('0x46')]=_[_0x86c8('0x5b')](_0x338531[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x338531['attributes'],function(_0x5f7233){var _0xcae7b4={};_0xcae7b4[_0x5f7233]={'$like':'%'+_0x48fa40[_0x86c8('0x47')]['filter']+'%'};return _0xcae7b4;})});}_0x338531=_[_0x86c8('0x5b')]({},_0x338531,_0x48fa40['options']);return _0x282d1b['getChatInteractions'](_0x338531);}})[_0x86c8('0x13')](function(_0x1cc63a){if(_0x1cc63a){_0x241fa2=_0x1cc63a[_0x86c8('0x51')];if(!_0x48fa40[_0x86c8('0x47')][_0x86c8('0xd2')](_0x86c8('0xd3'))){_0x338531[_0x86c8('0x21')]=qs[_0x86c8('0x21')](_0x48fa40[_0x86c8('0x47')][_0x86c8('0x21')]);_0x338531[_0x86c8('0x23')]=qs[_0x86c8('0x23')](_0x48fa40[_0x86c8('0x47')]['offset']);}return _0x282d1b[_0x86c8('0xde')](_0x338531);}})[_0x86c8('0x13')](function(_0x17c9be){if(_0x17c9be){return _0x17c9be?{'count':_0x241fa2,'rows':_0x17c9be}:null;}})[_0x86c8('0x13')](respondWithResult(_0x24eb50,null))['catch'](handleError(_0x24eb50,null));};exports[_0x86c8('0xe0')]=function(_0x443578,_0x56b1ef){var _0x219519={};var _0x1121bb={};var _0x256357;var _0x529fd2;return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x443578[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x56b1ef,null))[_0x86c8('0x13')](function(_0x219d4f){if(_0x219d4f){_0x256357=_0x219d4f;_0x1121bb['model']=_[_0x86c8('0x57')](db[_0x86c8('0xe1')][_0x86c8('0x3d')]);_0x1121bb[_0x86c8('0x47')]=_[_0x86c8('0x57')](_0x443578[_0x86c8('0x47')]);_0x1121bb[_0x86c8('0xc8')]=_[_0x86c8('0x58')](_0x1121bb[_0x86c8('0x59')],_0x1121bb[_0x86c8('0x47')]);_0x219519[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x1121bb['model'],qs[_0x86c8('0x5a')](_0x443578['query']['fields']));_0x219519[_0x86c8('0x4d')]=_0x219519[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x219519['attributes']:_0x1121bb['model'];_0x219519[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x443578['query']['sort']);_0x219519['where']=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x443578[_0x86c8('0x47')],_0x1121bb[_0x86c8('0xc8')]));if(_0x443578[_0x86c8('0x47')]['filter']){_0x219519[_0x86c8('0x46')]=_[_0x86c8('0x5b')](_0x219519[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x219519[_0x86c8('0x4d')],function(_0x2c35a8){var _0x447631={};_0x447631[_0x2c35a8]={'$like':'%'+_0x443578['query'][_0x86c8('0x41')]+'%'};return _0x447631;})});}_0x219519=_[_0x86c8('0x5b')]({},_0x219519,_0x443578['options']);return _0x256357['getOpenchannelInteractions'](_0x219519);}})['then'](function(_0x21d62e){if(_0x21d62e){_0x529fd2=_0x21d62e[_0x86c8('0x51')];if(!_0x443578[_0x86c8('0x47')][_0x86c8('0xd2')](_0x86c8('0xd3'))){_0x219519[_0x86c8('0x21')]=qs[_0x86c8('0x21')](_0x443578[_0x86c8('0x47')][_0x86c8('0x21')]);_0x219519[_0x86c8('0x23')]=qs[_0x86c8('0x23')](_0x443578[_0x86c8('0x47')][_0x86c8('0x23')]);}return _0x256357[_0x86c8('0xe0')](_0x219519);}})['then'](function(_0x5bec54){if(_0x5bec54){return _0x5bec54?{'count':_0x529fd2,'rows':_0x5bec54}:null;}})[_0x86c8('0x13')](respondWithResult(_0x56b1ef,null))[_0x86c8('0x1d')](handleError(_0x56b1ef,null));};exports[_0x86c8('0xe2')]=function(_0x13af63,_0x41ee2c){var _0x239c24={'raw':!![],'where':{}};var _0x2bc460={};var _0x20fe1c={'count':0x0,'rows':[]};return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x13af63[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x41ee2c,null))['then'](function(_0x2a8374){if(_0x2a8374){_0x2bc460['model']=_[_0x86c8('0x57')](db['MailInteraction'][_0x86c8('0x3d')]);_0x2bc460['query']=_[_0x86c8('0x57')](_0x13af63[_0x86c8('0x47')]);_0x2bc460[_0x86c8('0xc8')]=_['intersection'](_0x2bc460[_0x86c8('0x59')],_0x2bc460['query']);_0x239c24[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x2bc460[_0x86c8('0x59')],qs['fields'](_0x13af63[_0x86c8('0x47')][_0x86c8('0x5a')]));_0x239c24[_0x86c8('0x4d')]=_0x239c24[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x239c24[_0x86c8('0x4d')]:_0x2bc460['model'];if(!_0x13af63[_0x86c8('0x47')]['hasOwnProperty'](_0x86c8('0xd3'))){_0x239c24['limit']=qs[_0x86c8('0x21')](_0x13af63[_0x86c8('0x47')]['limit']);_0x239c24[_0x86c8('0x23')]=qs[_0x86c8('0x23')](_0x13af63[_0x86c8('0x47')]['offset']);}_0x239c24[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x13af63[_0x86c8('0x47')][_0x86c8('0xca')]);_0x239c24[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x13af63[_0x86c8('0x47')],_0x2bc460['filters']));_0x239c24[_0x86c8('0x46')][_0x86c8('0xdb')]=_0x2a8374['id'];if(_0x13af63[_0x86c8('0x47')]['filter']){_0x239c24[_0x86c8('0x46')]=_[_0x86c8('0x5b')](_0x239c24['where'],{'$or':_[_0x86c8('0x34')](_0x239c24[_0x86c8('0x4d')],function(_0x37b90d){var _0x40a2f3={};_0x40a2f3[_0x37b90d]={'$like':'%'+_0x13af63[_0x86c8('0x47')][_0x86c8('0x41')]+'%'};return _0x40a2f3;})});}_0x239c24=_[_0x86c8('0x5b')]({},_0x239c24,_0x13af63[_0x86c8('0x5c')]);return db[_0x86c8('0xe3')][_0x86c8('0x22')]({'where':_0x239c24[_0x86c8('0x46')]})['then'](function(_0x16da2f){_0x20fe1c[_0x86c8('0x22')]=_0x16da2f;if(_0x13af63[_0x86c8('0x47')]['includeAll']){_0x239c24[_0x86c8('0x4b')]=[{'all':!![]}];}return db[_0x86c8('0xe3')][_0x86c8('0x8a')](_0x239c24);})[_0x86c8('0x13')](function(_0x95ba26){_0x20fe1c[_0x86c8('0x4f')]=_0x95ba26;return _0x20fe1c;});}})[_0x86c8('0x13')](respondWithFilteredResult(_0x41ee2c,_0x239c24))['catch'](handleError(_0x41ee2c,null));};exports['getSmsInteractions']=function(_0xa1cc92,_0x3ed921){var _0x2374c6={};var _0x44c934={};var _0x43ddef;var _0x33c905;return db[_0x86c8('0x3c')]['findOne']({'where':{'id':_0xa1cc92[_0x86c8('0x56')]['id']}})['then'](handleEntityNotFound(_0x3ed921,null))[_0x86c8('0x13')](function(_0x32e57f){if(_0x32e57f){_0x43ddef=_0x32e57f;_0x44c934[_0x86c8('0x59')]=_['keys'](db[_0x86c8('0xe4')]['rawAttributes']);_0x44c934['query']=_[_0x86c8('0x57')](_0xa1cc92[_0x86c8('0x47')]);_0x44c934[_0x86c8('0xc8')]=_['intersection'](_0x44c934[_0x86c8('0x59')],_0x44c934[_0x86c8('0x47')]);_0x2374c6[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x44c934[_0x86c8('0x59')],qs[_0x86c8('0x5a')](_0xa1cc92[_0x86c8('0x47')]['fields']));_0x2374c6[_0x86c8('0x4d')]=_0x2374c6[_0x86c8('0x4d')]['length']?_0x2374c6[_0x86c8('0x4d')]:_0x44c934['model'];_0x2374c6[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0xa1cc92[_0x86c8('0x47')][_0x86c8('0xca')]);_0x2374c6[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0xa1cc92[_0x86c8('0x47')],_0x44c934[_0x86c8('0xc8')]));if(_0xa1cc92[_0x86c8('0x47')][_0x86c8('0x41')]){_0x2374c6[_0x86c8('0x46')]=_[_0x86c8('0x5b')](_0x2374c6[_0x86c8('0x46')],{'$or':_['map'](_0x2374c6[_0x86c8('0x4d')],function(_0x51371b){var _0x128e54={};_0x128e54[_0x51371b]={'$like':'%'+_0xa1cc92[_0x86c8('0x47')][_0x86c8('0x41')]+'%'};return _0x128e54;})});}_0x2374c6=_['merge']({},_0x2374c6,_0xa1cc92[_0x86c8('0x5c')]);return _0x43ddef[_0x86c8('0xe5')](_0x2374c6);}})[_0x86c8('0x13')](function(_0x5ebba6){if(_0x5ebba6){_0x33c905=_0x5ebba6[_0x86c8('0x51')];if(!_0xa1cc92[_0x86c8('0x47')]['hasOwnProperty'](_0x86c8('0xd3'))){_0x2374c6[_0x86c8('0x21')]=qs[_0x86c8('0x21')](_0xa1cc92[_0x86c8('0x47')][_0x86c8('0x21')]);_0x2374c6[_0x86c8('0x23')]=qs[_0x86c8('0x23')](_0xa1cc92['query']['offset']);}return _0x43ddef[_0x86c8('0xe5')](_0x2374c6);}})[_0x86c8('0x13')](function(_0x29c00b){if(_0x29c00b){return _0x29c00b?{'count':_0x33c905,'rows':_0x29c00b}:null;}})[_0x86c8('0x13')](respondWithResult(_0x3ed921,null))[_0x86c8('0x1d')](handleError(_0x3ed921,null));};exports['getFaxInteractions']=function(_0x4670c2,_0x3030df){var _0x43dbad={};var _0x3f166a={};var _0x49327f;var _0x38ebf1;return db['User'][_0x86c8('0x94')]({'where':{'id':_0x4670c2['params']['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x3030df,null))[_0x86c8('0x13')](function(_0x377fc6){if(_0x377fc6){_0x49327f=_0x377fc6;_0x3f166a[_0x86c8('0x59')]=_[_0x86c8('0x57')](db[_0x86c8('0xe6')][_0x86c8('0x3d')]);_0x3f166a['query']=_[_0x86c8('0x57')](_0x4670c2[_0x86c8('0x47')]);_0x3f166a[_0x86c8('0xc8')]=_[_0x86c8('0x58')](_0x3f166a[_0x86c8('0x59')],_0x3f166a['query']);_0x43dbad[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x3f166a[_0x86c8('0x59')],qs[_0x86c8('0x5a')](_0x4670c2[_0x86c8('0x47')][_0x86c8('0x5a')]));_0x43dbad[_0x86c8('0x4d')]=_0x43dbad[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x43dbad[_0x86c8('0x4d')]:_0x3f166a[_0x86c8('0x59')];_0x43dbad[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x4670c2[_0x86c8('0x47')][_0x86c8('0xca')]);_0x43dbad[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x4670c2['query'],_0x3f166a[_0x86c8('0xc8')]));if(_0x4670c2[_0x86c8('0x47')]['filter']){_0x43dbad[_0x86c8('0x46')]=_['merge'](_0x43dbad[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x43dbad['attributes'],function(_0x3ed026){var _0x54ca15={};_0x54ca15[_0x3ed026]={'$like':'%'+_0x4670c2[_0x86c8('0x47')][_0x86c8('0x41')]+'%'};return _0x54ca15;})});}_0x43dbad=_['merge']({},_0x43dbad,_0x4670c2[_0x86c8('0x5c')]);return _0x49327f['getFaxInteractions'](_0x43dbad);}})[_0x86c8('0x13')](function(_0x32a03b){if(_0x32a03b){_0x38ebf1=_0x32a03b[_0x86c8('0x51')];if(!_0x4670c2[_0x86c8('0x47')][_0x86c8('0xd2')](_0x86c8('0xd3'))){_0x43dbad['limit']=qs[_0x86c8('0x21')](_0x4670c2[_0x86c8('0x47')][_0x86c8('0x21')]);_0x43dbad['offset']=qs['offset'](_0x4670c2[_0x86c8('0x47')][_0x86c8('0x23')]);}return _0x49327f[_0x86c8('0xe7')](_0x43dbad);}})[_0x86c8('0x13')](function(_0xe6691e){if(_0xe6691e){return _0xe6691e?{'count':_0x38ebf1,'rows':_0xe6691e}:null;}})[_0x86c8('0x13')](respondWithResult(_0x3030df,null))[_0x86c8('0x1d')](handleError(_0x3030df,null));};exports[_0x86c8('0xe8')]=function(_0x5d4bfb,_0x553198){var _0x2445f8={};var _0x4f5c4c={};var _0x5b25be;var _0x2ecf75;return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x5d4bfb[_0x86c8('0x56')]['id']}})['then'](handleEntityNotFound(_0x553198,null))[_0x86c8('0x13')](function(_0x153d37){if(_0x153d37){_0x5b25be=_0x153d37;_0x4f5c4c[_0x86c8('0x59')]=_[_0x86c8('0x57')](db[_0x86c8('0xe9')][_0x86c8('0x3d')]);_0x4f5c4c[_0x86c8('0x47')]=_[_0x86c8('0x57')](_0x5d4bfb[_0x86c8('0x47')]);_0x4f5c4c['filters']=_['intersection'](_0x4f5c4c['model'],_0x4f5c4c[_0x86c8('0x47')]);_0x2445f8['attributes']=_[_0x86c8('0x58')](_0x4f5c4c[_0x86c8('0x59')],qs['fields'](_0x5d4bfb['query'][_0x86c8('0x5a')]));_0x2445f8['attributes']=_0x2445f8[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x2445f8[_0x86c8('0x4d')]:_0x4f5c4c[_0x86c8('0x59')];_0x2445f8['order']=qs[_0x86c8('0xca')](_0x5d4bfb[_0x86c8('0x47')][_0x86c8('0xca')]);_0x2445f8[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_['pick'](_0x5d4bfb[_0x86c8('0x47')],_0x4f5c4c[_0x86c8('0xc8')]));if(_0x5d4bfb[_0x86c8('0x47')][_0x86c8('0x41')]){_0x2445f8[_0x86c8('0x46')]=_['merge'](_0x2445f8[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x2445f8[_0x86c8('0x4d')],function(_0x3b3280){var _0x57753d={};_0x57753d[_0x3b3280]={'$like':'%'+_0x5d4bfb[_0x86c8('0x47')][_0x86c8('0x41')]+'%'};return _0x57753d;})});}_0x2445f8=_[_0x86c8('0x5b')]({},_0x2445f8,_0x5d4bfb[_0x86c8('0x5c')]);return _0x5b25be[_0x86c8('0xe8')](_0x2445f8);}})[_0x86c8('0x13')](function(_0x123c0d){if(_0x123c0d){_0x2ecf75=_0x123c0d['length'];if(!_0x5d4bfb[_0x86c8('0x47')][_0x86c8('0xd2')](_0x86c8('0xd3'))){_0x2445f8['limit']=qs['limit'](_0x5d4bfb[_0x86c8('0x47')]['limit']);_0x2445f8[_0x86c8('0x23')]=qs['offset'](_0x5d4bfb[_0x86c8('0x47')][_0x86c8('0x23')]);}return _0x5b25be[_0x86c8('0xe8')](_0x2445f8);}})[_0x86c8('0x13')](function(_0x2fa47e){if(_0x2fa47e){return _0x2fa47e?{'count':_0x2ecf75,'rows':_0x2fa47e}:null;}})[_0x86c8('0x13')](respondWithResult(_0x553198,null))[_0x86c8('0x1d')](handleError(_0x553198,null));};exports[_0x86c8('0xea')]=function(_0x402b55,_0x3f8487,_0x55af18){var _0x2c50de;var _0x553090;var _0x4c0f9b;var _0x57d7d9=!_[_0x86c8('0x69')](_0x402b55[_0x86c8('0x56')]['id'])?_0x402b55[_0x86c8('0x56')]['id']:!_[_0x86c8('0x69')](_0x402b55[_0x86c8('0x30')]['id'])?_0x402b55['user']['id']:null;return db[_0x86c8('0x3c')]['find']({'where':{'id':_0x57d7d9,'role':{'$or':[_0x86c8('0x2e'),'user',_0x86c8('0x29')]}},'attributes':['id',_0x86c8('0x37'),_0x86c8('0xeb'),_0x86c8('0xec'),_0x86c8('0x28'),'internal','loginInPause']})['then'](function(_0x539e33){if(_0x539e33){if(_0x539e33['role']===_0x86c8('0x29')){_0x2c50de=_0x539e33;if(_0x402b55['body'][_0x86c8('0x9e')]){_0x4c0f9b=util[_0x86c8('0xa8')](_0x86c8('0xed'),_0x2c50de[_0x402b55[_0x86c8('0x5f')][_0x86c8('0x9e')]]);}else if(_0x402b55['body'][_0x86c8('0xee')]){_0x4c0f9b=util[_0x86c8('0xa8')](_0x86c8('0xa9'),_0x402b55['body']['intrf']);}else{_0x4c0f9b=util[_0x86c8('0xa8')](_0x86c8('0xa9'),_0x2c50de[_0x86c8('0x37')]);}socket['to'](util[_0x86c8('0xa8')](_0x86c8('0xef'),_0x2c50de[_0x86c8('0x37')]))[_0x86c8('0x2a')]('user:forcelogout',{'user':{'id':_0x2c50de['id'],'name':_0x2c50de['name']},'ip':_0x402b55[_0x86c8('0xf0')]['x-forwarded-for']||_0x402b55[_0x86c8('0xf1')][_0x86c8('0xf2')]||_0x402b55[_0x86c8('0xf3')][_0x86c8('0xf2')]||_0x402b55['connection'][_0x86c8('0xf3')][_0x86c8('0xf2')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x2c50de[_0x86c8('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x86c8('0x8f'))][(_0x86c8('0x90'))](_0x86c8('0xf4'));}})[_0x86c8('0x13')](function(){if(_0x2c50de){return _0x2c50de[_0x86c8('0xf5')]({'raw':!![]});}})['then'](function(_0x3e7dc4){if(_0x2c50de){if(_0x3e7dc4){_0x553090=_0x3e7dc4;if(_0x553090[_0x86c8('0x51')]){var _0x40f381=_0x553090['map'](function(_0x419041){var _0x2b6d88={'membername':_0x2c50de[_0x86c8('0x37')],'UserId':_0x2c50de['id'],'queue_name':_0x419041['name'],'VoiceQueueId':_0x419041['id'],'interface':_0x4c0f9b,'paused':_0x2c50de['loginInPause']||![],'penalty':_0x419041[_0x86c8('0xf6')]||0x0};return db[_0x86c8('0xab')]['upsert'](_0x2b6d88);});return Promise[_0x86c8('0x89')](_0x40f381);}}}})[_0x86c8('0x13')](function(){if(_0x2c50de){return db[_0x86c8('0xf7')][_0x86c8('0x8a')]({'where':{'membername':_0x2c50de['name'],'exitAt':null}});}})['then'](function(_0x46fd81){if(_0x2c50de){var _0x4cc569=[];_0x46fd81[_0x86c8('0xf8')](function(_0x3a5f3f){_0x4cc569[_0x86c8('0x4e')](_0x3a5f3f['update']({'exitAt':moment()['format'](_0x86c8('0xf9'))}));});return Promise['all'](_0x4cc569);}})[_0x86c8('0x13')](function(){if(_0x2c50de){var _0x556704=[];var _0x3c5ee3=[];var _0x2669a4=utils[_0x86c8('0xfa')]();var _0x3c2cc9={'membername':_0x2c50de[_0x86c8('0x37')],'interface':_0x4c0f9b,'enterAt':moment()[_0x86c8('0xa8')](_0x86c8('0xf9')),'role':_0x2c50de['role'],'internal':_0x2c50de['internal']};_0x2669a4[_0x86c8('0xf8')](function(_0x4d13a0){_0x556704[_0x86c8('0x4e')](_[_0x86c8('0x5b')]({'channel':_0x4d13a0,'type':_0x86c8('0xfb'),'data1':_0x402b55[_0x86c8('0x5f')][_0x86c8('0xfc')],'data2':_0x4c0f9b},_0x3c2cc9));if(_0x2c50de[_0x86c8('0x9d')]){_0x3c5ee3[_0x86c8('0x4e')](_[_0x86c8('0x5b')]({'channel':_0x4d13a0,'type':_0x86c8('0xfd'),'data1':'LOGININPAUSE'},_0x3c2cc9));}});return db[_0x86c8('0xf7')]['bulkCreate'](_0x556704['concat'](_0x3c5ee3),{'individualHooks':!![]});}})[_0x86c8('0x13')](function(){if(_0x2c50de){return _0x2c50de[_0x86c8('0x27')]({'online':!![],'lastLoginAt':moment()[_0x86c8('0xa8')](_0x86c8('0xf9')),'voicePause':_0x2c50de[_0x86c8('0x9d')]||![],'mailPause':_0x2c50de['loginInPause']||![],'chatPause':_0x2c50de[_0x86c8('0x9d')]||![],'faxPause':_0x2c50de[_0x86c8('0x9d')]||![],'smsPause':_0x2c50de[_0x86c8('0x9d')]||![],'openchannelPause':_0x2c50de[_0x86c8('0x9d')]||![],'whatsappPause':_0x2c50de[_0x86c8('0x9d')]||![],'pauseType':_0x2c50de[_0x86c8('0x9d')]?_0x86c8('0xfe'):null,'interface':_0x4c0f9b,'lastPauseAt':moment()[_0x86c8('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x2f3e8f){if(_0x402b55['isMiddleware']){return _0x55af18();}else{return Promise[_0x86c8('0xff')](_0x2f3e8f)[_0x86c8('0x13')](respondWithResult(_0x3f8487,null));}})[_0x86c8('0x1d')](handleError(_0x3f8487,null));};exports[_0x86c8('0x100')]=function(_0xc8df,_0x312016){var _0x3ed20a;return db[_0x86c8('0x3c')]['find']({'where':{'id':_0xc8df[_0x86c8('0x56')]['id'],'role':'agent'},'attributes':['id',_0x86c8('0x37'),_0x86c8('0x28')]})[_0x86c8('0x13')](handleEntityNotFound(_0x312016,null))[_0x86c8('0x13')](function(_0xc835a5){if(_0xc835a5){_0x3ed20a=_0xc835a5;return db[_0x86c8('0xab')][_0x86c8('0x2c')]({'where':{'membername':_0x3ed20a['name']},'individualHooks':!![]});}})[_0x86c8('0x13')](function(){return db[_0x86c8('0xf7')][_0x86c8('0x8a')]({'where':{'membername':_0x3ed20a['name'],'exitAt':null}});})[_0x86c8('0x13')](function(_0x1cbcca){var _0x13ea7c=[];_0x1cbcca['forEach'](function(_0x3f7bc8){_0x13ea7c[_0x86c8('0x4e')](_0x3f7bc8[_0x86c8('0x27')]({'exitAt':moment()['format'](_0x86c8('0xf9'))}));});return Promise[_0x86c8('0x89')](_0x13ea7c);})[_0x86c8('0x13')](function(){return _0x3ed20a[_0x86c8('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x312016,null))[_0x86c8('0x1d')](handleError(_0x312016,null));};exports[_0x86c8('0x101')]=function(_0x5e1d77,_0x6031a8){var _0x22d0a4;return db[_0x86c8('0xab')][_0x86c8('0x27')]({'paused':0x1},{'where':{'UserId':_0x5e1d77['params']['id']},'individualHooks':!![]})[_0x86c8('0x13')](function(){return db[_0x86c8('0x3c')][_0x86c8('0x36')]({'where':{'id':_0x5e1d77['params']['id'],'role':_0x86c8('0x29')},'attributes':['id','name',_0x86c8('0x28'),_0x86c8('0x63'),_0x86c8('0x9e'),_0x86c8('0x9c')]});})[_0x86c8('0x13')](handleEntityNotFound(_0x6031a8,null))[_0x86c8('0x13')](function(_0x46932e){if(_0x46932e){_0x22d0a4=_0x46932e;return respondWithRpcPromise(_0x86c8('0x102'),_0x86c8('0x101'),{'id':_0x22d0a4['id'],'name':_0x22d0a4[_0x86c8('0x37')],'pause':!![]});}})[_0x86c8('0x13')](function(){if(_0x22d0a4){return db[_0x86c8('0xf7')][_0x86c8('0x8a')]({'where':{'membername':_0x22d0a4[_0x86c8('0x37')],'type':'PAUSE','exitAt':null}});}})[_0x86c8('0x13')](function(_0x1f030e){if(_0x1f030e['length']){var _0x26de87=moment()[_0x86c8('0xa8')](_0x86c8('0xf9'));for(var _0x19fa6a=0x0,_0x5032aa=_0x1f030e[_0x86c8('0x51')];_0x19fa6a<_0x5032aa;_0x19fa6a++){_0x1f030e[_0x19fa6a]['updateAttributes']({'exitAt':_0x26de87});}}})[_0x86c8('0x13')](function(){var _0x5a4790=[];var _0x5767b5=utils[_0x86c8('0xfa')]();_0x5767b5['forEach'](function(_0x61a4da){_0x5a4790[_0x86c8('0x4e')]({'channel':_0x61a4da,'membername':_0x22d0a4[_0x86c8('0x37')],'interface':_['isNil'](_0x22d0a4[_0x86c8('0x9e')])?util['format'](_0x86c8('0xa9'),_0x22d0a4[_0x86c8('0x37')]):_0x22d0a4[_0x86c8('0x9e')],'type':'PAUSE','enterAt':moment()['format'](_0x86c8('0xf9')),'data1':_0x5e1d77[_0x86c8('0x5f')][_0x86c8('0x3f')]||_0x86c8('0x103'),'role':_0x22d0a4[_0x86c8('0x28')],'internal':_0x22d0a4['internal']});});return db['MemberReport'][_0x86c8('0x104')](_0x5a4790,{'individualHooks':!![]});})[_0x86c8('0x13')](function(){return _0x22d0a4[_0x86c8('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5e1d77[_0x86c8('0x5f')]['type']||_0x86c8('0x103'),'lastPauseAt':moment()['format'](_0x86c8('0xf9'))});})[_0x86c8('0x13')](respondWithResult(_0x6031a8,null))[_0x86c8('0x1d')](handleError(_0x6031a8,null));};exports[_0x86c8('0x105')]=function(_0x4d8123,_0xfd3b68){if(_0x4d8123['body']['channel']&&!utils[_0x86c8('0xae')](_0x4d8123[_0x86c8('0x5f')][_0x86c8('0x9b')])){throw new APIBadRequestError(util[_0x86c8('0xa8')](_0x86c8('0x106'),_0x4d8123[_0x86c8('0x5f')]['channel']));}return db[_0x86c8('0x3c')][_0x86c8('0x36')]({'where':{'id':_0x4d8123[_0x86c8('0x56')]['id']},'attributes':['id',_0x86c8('0x37'),_0x86c8('0x28'),'internal',_0x86c8('0x9e'),_0x86c8('0x9c'),_0x86c8('0xaa'),_0x86c8('0x107'),_0x86c8('0x108'),_0x86c8('0x109'),_0x86c8('0x10a'),_0x86c8('0x10b'),_0x86c8('0x10c'),_0x86c8('0x10d'),_0x86c8('0x10e')]})[_0x86c8('0x13')](function(_0x28d29f){if(!_0x28d29f){throw new APINotFoundError(util[_0x86c8('0xa8')](_0x86c8('0x10f'),_0x4d8123[_0x86c8('0x56')]['id']));}return _0x28d29f[_0x86c8('0x105')](_0x4d8123['body']['channel']);})[_0x86c8('0x13')](respondWithResult(_0xfd3b68,null))[_0x86c8('0x1d')](APIHandleError(_0xfd3b68));};exports[_0x86c8('0x110')]=function(_0x2e6379,_0x428ec7){var _0x53da07={};var _0x325c54={};var _0x5d3227;var _0x247dd3;return db['User'][_0x86c8('0x94')]({'where':{'id':_0x2e6379[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x428ec7,null))[_0x86c8('0x13')](function(_0x599da4){if(_0x599da4){_0x5d3227=_0x599da4;_0x325c54[_0x86c8('0x59')]=_[_0x86c8('0x57')](db[_0x86c8('0x111')][_0x86c8('0x3d')]);_0x325c54[_0x86c8('0x47')]=_[_0x86c8('0x57')](_0x2e6379[_0x86c8('0x47')]);_0x325c54['filters']=_[_0x86c8('0x58')](_0x325c54[_0x86c8('0x59')],_0x325c54['query']);_0x53da07[_0x86c8('0x4d')]=_['intersection'](_0x325c54['model'],qs[_0x86c8('0x5a')](_0x2e6379[_0x86c8('0x47')][_0x86c8('0x5a')]));_0x53da07[_0x86c8('0x4d')]=_0x53da07[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x53da07[_0x86c8('0x4d')]:_0x325c54[_0x86c8('0x59')];_0x53da07[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x2e6379['query'][_0x86c8('0xca')]);_0x53da07[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x2e6379[_0x86c8('0x47')],_0x325c54[_0x86c8('0xc8')]));if(_0x2e6379[_0x86c8('0x47')]['filter']){_0x53da07[_0x86c8('0x46')]=_[_0x86c8('0x5b')](_0x53da07['where'],{'$or':_[_0x86c8('0x34')](_0x53da07[_0x86c8('0x4d')],function(_0x3a2a47){var _0x1ba5e8={};_0x1ba5e8[_0x3a2a47]={'$like':'%'+_0x2e6379[_0x86c8('0x47')][_0x86c8('0x41')]+'%'};return _0x1ba5e8;})});}_0x53da07=_[_0x86c8('0x5b')]({},_0x53da07,_0x2e6379[_0x86c8('0x5c')]);return _0x5d3227[_0x86c8('0x110')](_0x53da07);}})[_0x86c8('0x13')](function(_0x4e6815){if(_0x4e6815){_0x247dd3=_0x4e6815[_0x86c8('0x51')];if(!_0x2e6379[_0x86c8('0x47')][_0x86c8('0xd2')]('nolimit')){_0x53da07[_0x86c8('0x21')]=qs[_0x86c8('0x21')](_0x2e6379[_0x86c8('0x47')][_0x86c8('0x21')]);_0x53da07[_0x86c8('0x23')]=qs['offset'](_0x2e6379['query'][_0x86c8('0x23')]);}return _0x5d3227[_0x86c8('0x110')](_0x53da07);}})['then'](function(_0x2cd0bd){if(_0x2cd0bd){return _0x2cd0bd?{'count':_0x247dd3,'rows':_0x2cd0bd}:null;}})[_0x86c8('0x13')](respondWithResult(_0x428ec7,null))[_0x86c8('0x1d')](handleError(_0x428ec7,null));};exports[_0x86c8('0x112')]=function(_0x3714ba,_0x89b9b5){var _0x497944=_0x3714ba['params']['id'];var _0x3a1ce6=_0x3714ba['body']?_0x3714ba[_0x86c8('0x5f')][_0x86c8('0xa1')]:null;var _0x21de41=[];return Promise[_0x86c8('0xff')]()['then'](function(){if(!_0x3a1ce6)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x86c8('0x13')](function(){return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x497944}});})['then'](function(_0x4b3b12){if(!_0x4b3b12)throw new APINotFoundError(util[_0x86c8('0xa8')](_0x86c8('0x10f'),_0x3714ba[_0x86c8('0x56')]['id']));return db[_0x86c8('0x6b')][_0x86c8('0x113')](function(_0x46840a){return _0x4b3b12[_0x86c8('0x112')](_0x3a1ce6,{'transaction':_0x46840a})['then'](function(){return db[_0x86c8('0x111')][_0x86c8('0x8a')]({'where':{'id':{'$in':_0x3a1ce6}}});})[_0x86c8('0x13')](function(_0x3eb7d0){var _0x1f7e0f=_['map'](_0x3eb7d0,function(_0x5d169a){return _0x5d169a[_0x86c8('0x114')]();});return Promise[_0x86c8('0x89')](_0x1f7e0f);})[_0x86c8('0x13')](function(_0x19dff2){_0x21de41=_[_0x86c8('0x115')](_0x19dff2);var _0x303cea=_[_0x86c8('0x34')](_0x21de41,function(_0x41a3c8){return _0x41a3c8['addAgent'](_0x4b3b12['id'],{'transaction':_0x46840a});});return Promise['all'](_0x303cea);})[_0x86c8('0x13')](function(){if(!_0x4b3b12[_0x86c8('0x9c')])return;var _0x156a97=_['filter'](_0x21de41,function(_0x115cf1){return _0x115cf1[_0x86c8('0x116')](_0x86c8('0x9b'))===_0x86c8('0x117');});var _0x213df2=_[_0x86c8('0x34')](_0x156a97,function(_0x3ef3af){return db[_0x86c8('0xab')][_0x86c8('0xac')]({'membername':_0x4b3b12[_0x86c8('0x37')],'UserId':_0x4b3b12['id'],'queue_name':_0x3ef3af['name'],'VoiceQueueId':_0x3ef3af['id'],'interface':_[_0x86c8('0x69')](_0x4b3b12[_0x86c8('0x9e')])?util['format'](_0x86c8('0xa9'),_0x4b3b12[_0x86c8('0x37')]):_0x4b3b12['interface'],'paused':_0x4b3b12[_0x86c8('0xaa')]||![],'penalty':_0x4b3b12[_0x86c8('0xa2')]},{'transaction':_0x46840a});});return Promise['all'](_0x213df2);})['then'](function(){return db[_0x86c8('0x118')]['findAll']({'where':{'teamId':{'$in':_0x3a1ce6}}});})['then'](function(_0x183848){var _0x5834f2=_[_0x86c8('0x34')](_0x183848,function(_0x2b318a){return db[_0x86c8('0x119')][_0x86c8('0x7e')]({'UserId':_0x4b3b12['id'],'VoicePrefixId':_0x2b318a['VoicePrefixId']},{'transaction':_0x46840a});});return Promise[_0x86c8('0x89')](_0x5834f2);});});})['then'](function(){for(var _0xb9ced9=0x0;_0xb9ced9<_0x21de41[_0x86c8('0x51')];_0xb9ced9++){var _0x9a0520=_0x21de41[_0xb9ced9]['getDataValue']('channel');var _0x111471=_0x9a0520+_0x86c8('0xa4');socket[_0x86c8('0x2a')]('user'+_0x9a0520+_0x86c8('0xa5'),{'UserId':_0x497944,['queueField']:_0x21de41[_0xb9ced9]['id']});}})[_0x86c8('0x13')](respondWithStatusCode(_0x89b9b5,null))['catch'](APIHandleError(_0x89b9b5));};exports[_0x86c8('0x11a')]=function(_0x578c1c,_0x510e3d){var _0x3acf2c=_0x578c1c[_0x86c8('0x56')]['id'];var _0x2f54e3=null;if(_0x578c1c[_0x86c8('0x47')]['ids']){_0x2f54e3=_[_0x86c8('0xb1')](_0x578c1c[_0x86c8('0x47')][_0x86c8('0xa1')])?_0x578c1c['query'][_0x86c8('0xa1')]:[_0x578c1c['query'][_0x86c8('0xa1')]];}var _0x4f9962=[];return Promise[_0x86c8('0xff')]()[_0x86c8('0x13')](function(){if(!_0x2f54e3)throw new APIBadRequestError(_0x86c8('0x11b'));})[_0x86c8('0x13')](function(){return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x3acf2c}});})['then'](function(_0xe31c01){if(!_0xe31c01)throw new APINotFoundError(util['format'](_0x86c8('0x10f'),_0x578c1c[_0x86c8('0x56')]['id']));return db['sequelize']['transaction'](function(_0x3e702c){return _0xe31c01[_0x86c8('0x11a')](_0x2f54e3,{'transaction':_0x3e702c})[_0x86c8('0x13')](function(){return db[_0x86c8('0x111')][_0x86c8('0x8a')]({'where':{'id':{'$in':_0x2f54e3}}});})['then'](function(_0xff4d55){var _0x467d4d=_[_0x86c8('0x34')](_0xff4d55,function(_0x3e7fce){return _0x3e7fce[_0x86c8('0x114')]();});return Promise['all'](_0x467d4d);})['then'](function(_0x2de067){_0x4f9962=_[_0x86c8('0x115')](_0x2de067);var _0x1d8d41=_['map'](_0x4f9962,function(_0x26c948){return _0x26c948[_0x86c8('0x11c')](_0xe31c01['id'],{'transaction':_0x3e702c});});return Promise[_0x86c8('0x89')](_0x1d8d41);})[_0x86c8('0x13')](function(){if(!_0xe31c01[_0x86c8('0x9c')])return;var _0x15432a=_['filter'](_0x4f9962,function(_0x4fc90c){return _0x4fc90c[_0x86c8('0x116')](_0x86c8('0x9b'))===_0x86c8('0x117');});var _0x155db4=_[_0x86c8('0x34')](_0x15432a,function(_0x27d92d){return db['UserVoiceQueueRt'][_0x86c8('0x2c')]({'where':{'VoiceQueueId':_0x27d92d['id'],'UserId':_0xe31c01['id']},'transaction':_0x3e702c});});return Promise[_0x86c8('0x89')](_0x155db4);})[_0x86c8('0x13')](function(){return db[_0x86c8('0x118')][_0x86c8('0x8a')]({'where':{'teamId':{'$in':_0x2f54e3}}});})[_0x86c8('0x13')](function(_0x2d245b){var _0x11eeb2=_['map'](_0x2d245b,function(_0x354265){return db['UserVoicePrefix'][_0x86c8('0x2c')]({'where':{'UserId':_0xe31c01['id'],'VoicePrefixId':_0x354265[_0x86c8('0x11d')]}},{'transaction':_0x3e702c});});return Promise[_0x86c8('0x89')](_0x11eeb2);});});})[_0x86c8('0x13')](function(){for(var _0x2ec252=0x0;_0x2ec252<_0x4f9962['length'];_0x2ec252++){var _0x1bffa5=_0x4f9962[_0x2ec252]['getDataValue'](_0x86c8('0x9b'));var _0x557da2=_0x1bffa5+_0x86c8('0xa4');socket[_0x86c8('0x2a')]('user'+_0x1bffa5+'Queue:remove',{'UserId':_0x3acf2c,['queueField']:_0x4f9962[_0x2ec252]['id']});}})[_0x86c8('0x13')](respondWithStatusCode(_0x510e3d,null))['catch'](APIHandleError(_0x510e3d));};exports[_0x86c8('0x11e')]=function(_0x30e20a,_0x3b2684){var _0x173c5e={};var _0x40ba4e={};var _0x513501;var _0x355477;return db[_0x86c8('0x3c')]['findOne']({'where':{'id':_0x30e20a['params']['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x3b2684,null))[_0x86c8('0x13')](function(_0x5ca8a3){if(_0x5ca8a3){_0x513501=_0x5ca8a3;_0x40ba4e[_0x86c8('0x59')]=_[_0x86c8('0x57')](db['CmList'][_0x86c8('0x3d')]);_0x40ba4e['query']=_['keys'](_0x30e20a[_0x86c8('0x47')]);_0x40ba4e['filters']=_[_0x86c8('0x58')](_0x40ba4e[_0x86c8('0x59')],_0x40ba4e[_0x86c8('0x47')]);_0x173c5e[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x40ba4e['model'],qs[_0x86c8('0x5a')](_0x30e20a['query'][_0x86c8('0x5a')]));_0x173c5e[_0x86c8('0x4d')]=_0x173c5e[_0x86c8('0x4d')]['length']?_0x173c5e[_0x86c8('0x4d')]:_0x40ba4e[_0x86c8('0x59')];_0x173c5e[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x30e20a['query'][_0x86c8('0xca')]);_0x173c5e[_0x86c8('0x46')]=qs[_0x86c8('0xc8')](_[_0x86c8('0xcb')](_0x30e20a['query'],_0x40ba4e[_0x86c8('0xc8')]));if(_0x30e20a[_0x86c8('0x47')]['filter']){_0x173c5e['where']=_[_0x86c8('0x5b')](_0x173c5e[_0x86c8('0x46')],{'$or':_[_0x86c8('0x34')](_0x173c5e['attributes'],function(_0x565188){var _0x5dd0c6={};_0x5dd0c6[_0x565188]={'$like':'%'+_0x30e20a['query'][_0x86c8('0x41')]+'%'};return _0x5dd0c6;})});}_0x173c5e=_['merge']({},_0x173c5e,_0x30e20a[_0x86c8('0x5c')]);return _0x513501[_0x86c8('0x11e')](_0x173c5e);}})[_0x86c8('0x13')](function(_0x262dca){if(_0x262dca){_0x355477=_0x262dca[_0x86c8('0x51')];if(!_0x30e20a['query'][_0x86c8('0xd2')]('nolimit')){_0x173c5e['limit']=qs[_0x86c8('0x21')](_0x30e20a[_0x86c8('0x47')][_0x86c8('0x21')]);_0x173c5e[_0x86c8('0x23')]=qs[_0x86c8('0x23')](_0x30e20a['query']['offset']);}return _0x513501['getLists'](_0x173c5e);}})[_0x86c8('0x13')](function(_0x23045b){if(_0x23045b){return _0x23045b?{'count':_0x355477,'rows':_0x23045b}:null;}})[_0x86c8('0x13')](respondWithResult(_0x3b2684,null))['catch'](handleError(_0x3b2684,null));};exports[_0x86c8('0x11f')]=function(_0x1ca774,_0x16f121){var _0x269578={};var _0x40fe6f={};var _0x2f826e;return db[_0x86c8('0x3c')][_0x86c8('0x94')]({'where':{'id':_0x1ca774[_0x86c8('0x56')]['id']}})[_0x86c8('0x13')](handleEntityNotFound(_0x16f121,null))['then'](function(_0xcfb1b1){if(_0xcfb1b1){_0x2f826e=_0xcfb1b1;_0x40fe6f[_0x86c8('0x59')]=_[_0x86c8('0x57')](db['User'][_0x86c8('0x3d')]);_0x40fe6f[_0x86c8('0x47')]=_['keys'](_0x1ca774[_0x86c8('0x47')]);_0x40fe6f[_0x86c8('0xc8')]=_['intersection'](_0x40fe6f[_0x86c8('0x59')],_0x40fe6f[_0x86c8('0x47')]);_0x269578[_0x86c8('0x4d')]=_[_0x86c8('0x58')](_0x40fe6f[_0x86c8('0x59')],qs[_0x86c8('0x5a')](_0x1ca774['query']['fields']));_0x269578['attributes']=_0x269578[_0x86c8('0x4d')][_0x86c8('0x51')]?_0x269578[_0x86c8('0x4d')]:_0x40fe6f['model'];_0x269578[_0x86c8('0xc9')]=qs[_0x86c8('0xca')](_0x1ca774[_0x86c8('0x47')]['sort']);_0x269578[_0x86c8('0x46')]=qs['filters'](_[_0x86c8('0xcb')](_0x1ca774[_0x86c8('0x47')],_0x40fe6f[_0x86c8('0xc8')]));if(_0x1ca774[_0x86c8('0x47')]['filter']){_0x269578['where']=_[_0x86c8('0x5b')](_0x269578[_0x86c8('0x46')],{'$or':_['map'](_0x269578[_0x86c8('0x4d')],function(_0xd21ae3){var _0x19aaf3={};_0x19aaf3[_0xd21ae3]={'$like':'%'+_0x1ca774[_0x86c8('0x47')][_0x86c8('0x41')]+'%'};return _0x19aaf3;})});}_0x269578[_0x86c8('0x59')]=db['User'];_0x269578['as']='Agents';_0x269578=_['merge']({},_0x269578,_0x1ca774[_0x86c8('0x5c')]);return _0x2f826e[_0x86c8('0xf5')]({'include':[_0x269578]});}})[_0x86c8('0x13')](function(_0x27ca9b){if(_0x27ca9b){var _0x391083={},_0x4f47ae=[];for(var _0x303a71=0x0;_0x303a71<_0x27ca9b[_0x86c8('0x51')];_0x303a71+=0x1){for(var _0x1fc88c=0x0,_0x1f5d5f;_0x1fc88c<_0x27ca9b[_0x303a71]['Agents']['length'];_0x1fc88c+=0x1){_0x1f5d5f=_0x27ca9b[_0x303a71]['Agents'][_0x1fc88c][_0x86c8('0x2d')]({'plain':!![]});_0x391083[_0x1f5d5f['id']]=_0x1f5d5f;}}_0x391083=_[_0x86c8('0x120')](_0x391083);for(var _0x1e0df0=qs[_0x86c8('0x23')](_0x1ca774[_0x86c8('0x47')][_0x86c8('0x23')]);_0x1e0df0<_0x391083[_0x86c8('0x51')]&&_0x4f47ae[_0x86c8('0x51')]=_0x57d093[_0x34d1('0x53')]){throw new Error(_0x34d1('0x54'));}})[_0x34d1('0x18')](function(){if(_0x315bed){return db[_0x34d1('0x26')][_0x34d1('0x47')]({'where':{'membername':_0x315bed[_0x34d1('0x29')]},'individualHooks':!![]});}})[_0x34d1('0x18')](function(){if(_0x315bed){return _0x315bed[_0x34d1('0x55')]({'raw':!![]});}})[_0x34d1('0x18')](function(_0x3eacad){if(_0x315bed){if(_0x3eacad){var _0x204914=[];_0x264e0f=_0x3eacad;if(_0x264e0f['length']){for(var _0x5aacc1=0x0;_0x5aacc1<_0x264e0f['length'];_0x5aacc1++){_0x204914[_0x34d1('0x49')](db[_0x34d1('0x26')][_0x34d1('0x56')]({'membername':_0x315bed[_0x34d1('0x29')],'UserId':_0x315bed['id'],'queue_name':_0x264e0f[_0x5aacc1]['name'],'VoiceQueueId':_0x264e0f[_0x5aacc1]['id'],'interface':_0x20b232,'paused':_0x315bed[_0x34d1('0x4e')]||![],'penalty':_0x264e0f[_0x5aacc1][_0x34d1('0x57')]||0x0}));}return BPromise['all'](_0x204914);}}}})[_0x34d1('0x18')](function(){if(_0x315bed){return db['MemberReport'][_0x34d1('0x10')]({'where':{'membername':_0x315bed[_0x34d1('0x29')],'exitAt':null}});}})[_0x34d1('0x18')](function(_0x595d93){if(_0x315bed){if(_0x595d93&&_0x595d93[_0x34d1('0x2a')]){var _0x9c1ff1=[];_0x595d93['forEach'](function(_0x2a864d){_0x9c1ff1[_0x34d1('0x49')](_0x2a864d[_0x34d1('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x34d1('0x4a')](_0x9c1ff1);}}})[_0x34d1('0x18')](function(){if(_0x315bed){var _0x3a3b7b=[];var _0x33ae3e=[];var _0x27f069=utils[_0x34d1('0x2d')]();var _0x241b38={'membername':_0x315bed[_0x34d1('0x29')],'interface':_0x20b232,'enterAt':moment()[_0x34d1('0x24')](_0x34d1('0x2b')),'role':_0x315bed[_0x34d1('0x3c')],'internal':_0x315bed[_0x34d1('0x22')]};_0x27f069[_0x34d1('0x48')](function(_0x27f825){_0x3a3b7b['push'](_[_0x34d1('0x58')]({'channel':_0x27f825,'type':_0x34d1('0x59'),'data1':_0x34d1('0x5a'),'data2':_0x20b232},_0x241b38));if(_0x315bed[_0x34d1('0x4e')]){_0x33ae3e['push'](_[_0x34d1('0x58')]({'channel':_0x27f825,'type':_0x34d1('0x30'),'data1':'LOGININPAUSE'},_0x241b38));}});return db[_0x34d1('0x28')]['bulkCreate'](_0x3a3b7b[_0x34d1('0x5b')](_0x33ae3e),{'individualHooks':!![]});}})['then'](function(){if(_0x315bed){return _0x315bed[_0x34d1('0x27')]({'online':!![],'lastLoginAt':moment()[_0x34d1('0x24')](_0x34d1('0x2b')),'voicePause':_0x315bed[_0x34d1('0x4e')]||![],'mailPause':_0x315bed[_0x34d1('0x4e')]||![],'chatPause':_0x315bed['loginInPause']||![],'faxPause':_0x315bed[_0x34d1('0x4e')]||![],'smsPause':_0x315bed[_0x34d1('0x4e')]||![],'openchannelPause':_0x315bed[_0x34d1('0x4e')]||![],'pauseType':_0x315bed[_0x34d1('0x4e')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format'](_0x34d1('0x2b')),'interface':_0x20b232});}})[_0x34d1('0x18')](function(_0x1c4933){_0x2a754b(_0x1c4933);})[_0x34d1('0x1b')](function(_0xca53ca){_0x1530e6(_0x315c13[_0x34d1('0x1c')](0x1f4,_0xca53ca[_0x34d1('0x1d')]));});});}; \ No newline at end of file +var _0x67e8=['where','attributes','limit','include','model','map','then','info','debug','stringify','error','message','ShowUser','User','find','catch','name','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','body','DEFAULT\x20PAUSE','role','uniqueid','type','UnpauseUser','resolve','channel','isValidChannel','online','voicePause','mailPause','chatPause','smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','findOne','destroy','all','LoginUser','phone','loginInPause','SIP/%s','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','GetUser','findAll','options','raw'];(function(_0x5411ce,_0x299a25){var _0x3890e8=function(_0x56b36e){while(--_0x56b36e){_0x5411ce['push'](_0x5411ce['shift']());}};_0x3890e8(++_0x299a25);}(_0x67e8,0xf6));var _0x867e=function(_0x48a8b6,_0x32282d){_0x48a8b6=_0x48a8b6-0x0;var _0x3835a4=_0x67e8[_0x48a8b6];return _0x3835a4;};'use strict';var _=require('lodash');var util=require(_0x867e('0x0'));var moment=require('moment');var BPromise=require(_0x867e('0x1'));var Redis=require(_0x867e('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x867e('0x3'))(_0x867e('0x4'));var config=require(_0x867e('0x5'));config[_0x867e('0x6')]=_[_0x867e('0x7')](config[_0x867e('0x6')],{'host':_0x867e('0x8'),'port':0x18eb});var socket=require(_0x867e('0x9'))(new Redis(config['redis']));require('./user.socket')[_0x867e('0xa')](socket);exports[_0x867e('0xb')]=function(_0x365b26){var _0x4a3484=this;return new Promise(function(_0x24db4a,_0x572cdb){return db['User'][_0x867e('0xc')]({'raw':_0x365b26['options']?_0x365b26[_0x867e('0xd')][_0x867e('0xe')]===undefined?!![]:![]:!![],'where':_0x365b26[_0x867e('0xd')]?_0x365b26[_0x867e('0xd')][_0x867e('0xf')]||null:null,'attributes':_0x365b26[_0x867e('0xd')]?_0x365b26[_0x867e('0xd')][_0x867e('0x10')]||null:null,'limit':_0x365b26['options']?_0x365b26[_0x867e('0xd')][_0x867e('0x11')]||null:null,'include':_0x365b26[_0x867e('0xd')]?_0x365b26[_0x867e('0xd')]['include']?_['map'](_0x365b26[_0x867e('0xd')][_0x867e('0x12')],function(_0x5ceb47){return{'model':db[_0x5ceb47[_0x867e('0x13')]],'as':_0x5ceb47['as'],'attributes':_0x5ceb47['attributes'],'include':_0x5ceb47[_0x867e('0x12')]?_[_0x867e('0x14')](_0x5ceb47['include'],function(_0x85d3a){return{'model':db[_0x85d3a[_0x867e('0x13')]],'as':_0x85d3a['as'],'attributes':_0x85d3a[_0x867e('0x10')],'include':_0x85d3a[_0x867e('0x12')]?_[_0x867e('0x14')](_0x85d3a[_0x867e('0x12')],function(_0x67c8d0){return{'model':db[_0x67c8d0[_0x867e('0x13')]],'as':_0x67c8d0['as'],'attributes':_0x67c8d0[_0x867e('0x10')]};}):[]};}):[]};}):[]:[]})[_0x867e('0x15')](function(_0x48b09e){logger[_0x867e('0x16')](_0x867e('0xb'),_0x365b26);logger[_0x867e('0x17')](_0x867e('0xb'),_0x365b26,JSON[_0x867e('0x18')](_0x48b09e));_0x24db4a(_0x48b09e);})['catch'](function(_0x11b832){logger[_0x867e('0x19')]('GetUser',_0x11b832['message'],_0x365b26);_0x572cdb(_0x4a3484[_0x867e('0x19')](0x1f4,_0x11b832[_0x867e('0x1a')]));});});};exports[_0x867e('0x1b')]=function(_0xb9148){var _0x43ae5b=this;return new Promise(function(_0x1e4c68,_0xabd6){return db[_0x867e('0x1c')][_0x867e('0x1d')]({'raw':_0xb9148[_0x867e('0xd')]?_0xb9148[_0x867e('0xd')][_0x867e('0xe')]===undefined?!![]:![]:!![],'where':_0xb9148['options']?_0xb9148[_0x867e('0xd')][_0x867e('0xf')]||null:null,'attributes':_0xb9148[_0x867e('0xd')]?_0xb9148[_0x867e('0xd')][_0x867e('0x10')]||null:null,'include':_0xb9148[_0x867e('0xd')]?_0xb9148[_0x867e('0xd')][_0x867e('0x12')]?_[_0x867e('0x14')](_0xb9148['options']['include'],function(_0x55db94){return{'model':db[_0x55db94[_0x867e('0x13')]],'as':_0x55db94['as'],'attributes':_0x55db94[_0x867e('0x10')],'include':_0x55db94['include']?_['map'](_0x55db94[_0x867e('0x12')],function(_0x4d86d6){return{'model':db[_0x4d86d6[_0x867e('0x13')]],'as':_0x4d86d6['as'],'attributes':_0x4d86d6[_0x867e('0x10')],'include':_0x4d86d6[_0x867e('0x12')]?_['map'](_0x4d86d6[_0x867e('0x12')],function(_0xf662d0){return{'model':db[_0xf662d0[_0x867e('0x13')]],'as':_0xf662d0['as'],'attributes':_0xf662d0[_0x867e('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b6413){logger[_0x867e('0x16')]('ShowUser',_0xb9148);logger[_0x867e('0x17')](_0x867e('0x1b'),_0xb9148,JSON[_0x867e('0x18')](_0x4b6413));_0x1e4c68(_0x4b6413);})[_0x867e('0x1e')](function(_0x17caa6){logger[_0x867e('0x19')]('ShowUser',_0x17caa6['message'],_0xb9148);_0xabd6(_0x43ae5b[_0x867e('0x19')](0x1f4,_0x17caa6[_0x867e('0x1a')]));});});};exports['PauseUser']=function(_0x314643){var _0x355afa;return db[_0x867e('0x1c')]['find']({'where':_0x314643[_0x867e('0xd')]['where']||{},'attributes':['id',_0x867e('0x1f'),'role',_0x867e('0x20'),_0x867e('0x21')]})['then'](function(_0x57689c){if(!_0x57689c){throw new Error(util[_0x867e('0x22')](_0x867e('0x23'),_0x314643['params']['id']));}_0x355afa=_0x57689c;return db[_0x867e('0x24')][_0x867e('0x25')]({'paused':0x1},{'where':{'UserId':_0x355afa['id']},'individualHooks':!![]});})[_0x867e('0x15')](function(){return db[_0x867e('0x26')]['findAll']({'where':{'membername':_0x355afa['name'],'type':_0x867e('0x27'),'exitAt':null}});})[_0x867e('0x15')](function(_0x1a49b4){if(_0x1a49b4&&_0x1a49b4[_0x867e('0x28')]){var _0x510665=moment()[_0x867e('0x22')](_0x867e('0x29'));for(var _0x53a88d=0x0,_0x3b6b4e=_0x1a49b4[_0x867e('0x28')];_0x53a88d<_0x3b6b4e;_0x53a88d++){_0x1a49b4[_0x53a88d][_0x867e('0x2a')]({'exitAt':_0x510665});}}})['then'](function(){var _0xe099a0=[];var _0x524c44=utils[_0x867e('0x2b')]();_0x524c44[_0x867e('0x2c')](function(_0xaae493){_0xe099a0[_0x867e('0x2d')]({'channel':_0xaae493,'membername':_0x355afa[_0x867e('0x1f')],'interface':_[_0x867e('0x2e')](_0x355afa[_0x867e('0x21')])?util['format']('SIP/%s',_0x355afa[_0x867e('0x1f')]):_0x355afa['interface'],'type':_0x867e('0x27'),'enterAt':moment()[_0x867e('0x22')](_0x867e('0x29')),'data1':_0x314643[_0x867e('0x2f')]['type']||_0x867e('0x30'),'role':_0x355afa[_0x867e('0x31')],'internal':_0x355afa['internal'],'uniqueid':_0x314643['body'][_0x867e('0x32')]||null});});return db[_0x867e('0x26')]['bulkCreate'](_0xe099a0,{'individualHooks':!![]});})[_0x867e('0x15')](function(){return _0x355afa[_0x867e('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x314643[_0x867e('0x2f')][_0x867e('0x33')]||_0x867e('0x30'),'lastPauseAt':moment()[_0x867e('0x22')](_0x867e('0x29'))});})[_0x867e('0x1e')](function(_0x357224){throw _0x357224;});};exports[_0x867e('0x34')]=function(_0x5f4c5d){return Promise[_0x867e('0x35')]()[_0x867e('0x15')](function(){if(_0x5f4c5d[_0x867e('0x2f')][_0x867e('0x36')]&&!utils[_0x867e('0x37')](_0x5f4c5d[_0x867e('0x2f')][_0x867e('0x36')])){throw new Error(util[_0x867e('0x22')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x5f4c5d['body'][_0x867e('0x36')]));}return db[_0x867e('0x1c')]['findOne']({'where':_0x5f4c5d[_0x867e('0xd')]['where']||{},'attributes':['id',_0x867e('0x1f'),'role',_0x867e('0x20'),'interface',_0x867e('0x38'),_0x867e('0x39'),_0x867e('0x3a'),_0x867e('0x3b'),'faxPause','openchannelPause',_0x867e('0x3c'),_0x867e('0x3d'),_0x867e('0x3e'),'lastPauseAt']});})[_0x867e('0x15')](function(_0x419933){if(!_0x419933){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x5f4c5d['params']['id']));}return _0x419933[_0x867e('0x3f')](_0x5f4c5d[_0x867e('0x2f')][_0x867e('0x36')],_0x867e('0x40'));})[_0x867e('0x1e')](function(_0x4ad592){throw _0x4ad592;});};exports[_0x867e('0x41')]=function(_0x521b5a){var _0xd3112=this;return new Promise(function(_0xeaaedf,_0x2eefa5){var _0x530b54;return db[_0x867e('0x1c')][_0x867e('0x42')]({'where':_0x521b5a[_0x867e('0xd')][_0x867e('0xf')]||{},'attributes':['id',_0x867e('0x1f')]})[_0x867e('0x15')](function(_0x12cc55){if(_0x12cc55){_0x530b54=_0x12cc55;return db[_0x867e('0x24')][_0x867e('0x43')]({'where':{'membername':_0x530b54[_0x867e('0x1f')]},'individualHooks':!![]});}})[_0x867e('0x15')](function(){if(_0x530b54){return db['MemberReport'][_0x867e('0xc')]({'where':{'membername':_0x530b54[_0x867e('0x1f')],'exitAt':null}});}})[_0x867e('0x15')](function(_0x552ad7){if(_0x530b54){if(_0x552ad7&&_0x552ad7['length']){var _0x152730=[];_0x552ad7[_0x867e('0x2c')](function(_0x41371c){_0x152730[_0x867e('0x2d')](_0x41371c[_0x867e('0x25')]({'exitAt':moment()[_0x867e('0x22')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x867e('0x44')](_0x152730);}}})[_0x867e('0x15')](function(){if(_0x530b54){return _0x530b54[_0x867e('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x867e('0x15')](function(_0x2273e0){_0xeaaedf(_0x2273e0);})[_0x867e('0x1e')](function(_0x407a04){_0x2eefa5(_0xd3112[_0x867e('0x19')](0x1f4,_0x407a04[_0x867e('0x1a')]));});});};exports[_0x867e('0x45')]=function(_0x4821a9){var _0x25f051=this;return new Promise(function(_0x312f63,_0x32aa8a){var _0x13b7be;var _0x1846d6;var _0x253247;var _0x188613;return db[_0x867e('0x1c')][_0x867e('0x42')]({'where':_0x4821a9['options'][_0x867e('0xf')]||{},'attributes':['id',_0x867e('0x1f'),_0x867e('0x31'),'mobile',_0x867e('0x46'),_0x867e('0x20'),_0x867e('0x47'),_0x867e('0x21')]})[_0x867e('0x15')](function(_0x4784c7){if(_0x4784c7){_0x13b7be=_0x4784c7;_0x188613=_0x4821a9[_0x867e('0x2f')][_0x867e('0x21')]?_0x4821a9[_0x867e('0x2f')]['interface']:util[_0x867e('0x22')](_0x867e('0x48'),_0x13b7be[_0x867e('0x1f')]);return db['User'][_0x867e('0x49')]({'where':{'role':_0x867e('0x4a'),'online':!![],'id':{'$ne':_0x13b7be['id']}}});}})['then'](function(_0x174b7e){if(_0x174b7e){_0x253247=_0x174b7e;return require(_0x867e('0x4b'))[_0x867e('0x4c')]();}})[_0x867e('0x15')](function(_0x337dc1){if(_0x337dc1&&_0x337dc1[_0x867e('0x4d')]&&_0x253247>=_0x337dc1[_0x867e('0x4d')]){throw new Error(_0x867e('0x4e'));}})[_0x867e('0x15')](function(){if(_0x13b7be){return db[_0x867e('0x24')][_0x867e('0x43')]({'where':{'membername':_0x13b7be[_0x867e('0x1f')]},'individualHooks':!![]});}})[_0x867e('0x15')](function(){if(_0x13b7be){return _0x13b7be[_0x867e('0x4f')]({'raw':!![]});}})['then'](function(_0x174ab0){if(_0x13b7be){if(_0x174ab0){var _0x45268e=[];_0x1846d6=_0x174ab0;if(_0x1846d6[_0x867e('0x28')]){for(var _0x3232da=0x0;_0x3232da<_0x1846d6[_0x867e('0x28')];_0x3232da++){_0x45268e[_0x867e('0x2d')](db['UserVoiceQueueRt'][_0x867e('0x50')]({'membername':_0x13b7be[_0x867e('0x1f')],'UserId':_0x13b7be['id'],'queue_name':_0x1846d6[_0x3232da][_0x867e('0x1f')],'VoiceQueueId':_0x1846d6[_0x3232da]['id'],'interface':_0x188613,'paused':_0x13b7be[_0x867e('0x47')]||![],'penalty':_0x1846d6[_0x3232da][_0x867e('0x51')]||0x0}));}return BPromise[_0x867e('0x44')](_0x45268e);}}}})['then'](function(){if(_0x13b7be){return db[_0x867e('0x26')][_0x867e('0xc')]({'where':{'membername':_0x13b7be[_0x867e('0x1f')],'exitAt':null}});}})[_0x867e('0x15')](function(_0x258912){if(_0x13b7be){if(_0x258912&&_0x258912[_0x867e('0x28')]){var _0x12d378=[];_0x258912['forEach'](function(_0x1270bc){_0x12d378[_0x867e('0x2d')](_0x1270bc[_0x867e('0x25')]({'exitAt':moment()[_0x867e('0x22')](_0x867e('0x29'))}));});return BPromise[_0x867e('0x44')](_0x12d378);}}})[_0x867e('0x15')](function(){if(_0x13b7be){var _0x4c3c15=[];var _0x1ce5e8=[];var _0x4cd3a5=utils['getChannels']();var _0x38f740={'membername':_0x13b7be['name'],'interface':_0x188613,'enterAt':moment()[_0x867e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x13b7be['role'],'internal':_0x13b7be['internal']};_0x4cd3a5[_0x867e('0x2c')](function(_0xf9b863){_0x4c3c15[_0x867e('0x2d')](_[_0x867e('0x52')]({'channel':_0xf9b863,'type':_0x867e('0x53'),'data1':_0x867e('0x54'),'data2':_0x188613},_0x38f740));if(_0x13b7be[_0x867e('0x47')]){_0x1ce5e8['push'](_['merge']({'channel':_0xf9b863,'type':_0x867e('0x27'),'data1':_0x867e('0x55')},_0x38f740));}});return db['MemberReport'][_0x867e('0x56')](_0x4c3c15['concat'](_0x1ce5e8),{'individualHooks':!![]});}})[_0x867e('0x15')](function(){if(_0x13b7be){return _0x13b7be[_0x867e('0x25')]({'online':!![],'lastLoginAt':moment()[_0x867e('0x22')](_0x867e('0x29')),'voicePause':_0x13b7be['loginInPause']||![],'mailPause':_0x13b7be[_0x867e('0x47')]||![],'chatPause':_0x13b7be['loginInPause']||![],'faxPause':_0x13b7be[_0x867e('0x47')]||![],'smsPause':_0x13b7be[_0x867e('0x47')]||![],'openchannelPause':_0x13b7be['loginInPause']||![],'pauseType':_0x13b7be[_0x867e('0x47')]?_0x867e('0x55'):null,'lastPauseAt':moment()[_0x867e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x188613});}})[_0x867e('0x15')](function(_0x4c3e70){_0x312f63(_0x4c3e70);})[_0x867e('0x1e')](function(_0x51f64d){_0x32aa8a(_0x25f051[_0x867e('0x19')](0x1f4,_0x51f64d[_0x867e('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 482da50..5be63df 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 _0x3d33=['length','user:','./user.events','save','update','emit','register'];(function(_0x10e164,_0x246406){var _0x3a89f0=function(_0x4fe71c){while(--_0x4fe71c){_0x10e164['push'](_0x10e164['shift']());}};_0x3a89f0(++_0x246406);}(_0x3d33,0xb1));var _0x33d3=function(_0x34f254,_0x2e31b4){_0x34f254=_0x34f254-0x0;var _0x31ea95=_0x3d33[_0x34f254];return _0x31ea95;};'use strict';var UserEvents=require(_0x33d3('0x0'));var events=[_0x33d3('0x1'),'remove',_0x33d3('0x2')];function createListener(_0x3f24e4,_0x3c08b0){return function(_0x517c51){_0x3c08b0[_0x33d3('0x3')](_0x3f24e4,_0x517c51);};}function removeListener(_0x4aba38,_0x31e0ad){return function(){UserEvents['removeListener'](_0x4aba38,_0x31e0ad);};}exports[_0x33d3('0x4')]=function(_0x19b175){for(var _0x3466b0=0x0,_0x1c3c49=events[_0x33d3('0x5')];_0x3466b0<_0x1c3c49;_0x3466b0++){var _0x33be07=events[_0x3466b0];var _0x2c1f55=createListener(_0x33d3('0x6')+_0x33be07,_0x19b175);UserEvents['on'](_0x33be07,_0x2c1f55);}}; \ No newline at end of file +var _0x1a40=['emit','removeListener','register','user:','./user.events','save'];(function(_0x33d9a2,_0x1d635){var _0x328cc8=function(_0x43fce0){while(--_0x43fce0){_0x33d9a2['push'](_0x33d9a2['shift']());}};_0x328cc8(++_0x1d635);}(_0x1a40,0x1cc));var _0x01a4=function(_0x238213,_0x49d283){_0x238213=_0x238213-0x0;var _0x347299=_0x1a40[_0x238213];return _0x347299;};'use strict';var UserEvents=require(_0x01a4('0x0'));var events=[_0x01a4('0x1'),'remove','update'];function createListener(_0x3614a2,_0x3419d2){return function(_0x123b08){_0x3419d2[_0x01a4('0x2')](_0x3614a2,_0x123b08);};}function removeListener(_0x2e0edf,_0x143bae){return function(){UserEvents[_0x01a4('0x3')](_0x2e0edf,_0x143bae);};}exports[_0x01a4('0x4')]=function(_0x298d15){for(var _0x3a4405=0x0,_0xb2197c=events['length'];_0x3a4405<_0xb2197c;_0x3a4405++){var _0x190f2e=events[_0x3a4405];var _0x2c0727=createListener(_0x01a4('0x5')+_0x190f2e,_0x298d15);UserEvents['on'](_0x190f2e,_0x2c0727);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 9db8d12..912ae32 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4e7afb,_0x23f6ee){var _0x2532d9=function(_0x137f3b){while(--_0x137f3b){_0x4e7afb['push'](_0x4e7afb['shift']());}};_0x2532d9(++_0x23f6ee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0xcb91[_0x553a87];return _0x12d1e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3cc72f,_0x341543){var _0x279269=function(_0xf5aa0b){while(--_0xf5aa0b){_0x3cc72f['push'](_0x3cc72f['shift']());}};_0x279269(++_0x341543);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0xcb91[_0x4de1b1];return _0x639f27;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9006424..6b07b8d 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2e0c=['INTEGER','sequelize','exports'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x2e0c,0x187));var _0xc2e0=function(_0x563bd0,_0x8f5aa2){_0x563bd0=_0x563bd0-0x0;var _0x39bd1a=_0x2e0c[_0x563bd0];return _0x39bd1a;};'use strict';var Sequelize=require(_0xc2e0('0x0'));module[_0xc2e0('0x1')]={'penalty':{'type':Sequelize[_0xc2e0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 722d415..d7c19ac 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 _0xb265=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb265,0xc2));var _0x5b26=function(_0x1e64f9,_0x6741b7){_0x1e64f9=_0x1e64f9-0x0;var _0x3008ff=_0xb265[_0x1e64f9];return _0x3008ff;};'use strict';var _=require(_0x5b26('0x0'));var util=require(_0x5b26('0x1'));var logger=require(_0x5b26('0x2'))(_0x5b26('0x3'));var moment=require('moment');var BPromise=require(_0x5b26('0x4'));var rp=require(_0x5b26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b26('0x6'));var config=require(_0x5b26('0x7'));var attributes=require(_0x5b26('0x8'));module['exports']=function(_0x9ed0eb,_0x556292){return _0x9ed0eb[_0x5b26('0x9')](_0x5b26('0xa'),attributes,{'tableName':_0x5b26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcacb=['api','moment','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','util','../../config/logger'];(function(_0x58373e,_0xd1030c){var _0x488792=function(_0x598ebd){while(--_0x598ebd){_0x58373e['push'](_0x58373e['shift']());}};_0x488792(++_0xd1030c);}(_0xcacb,0x152));var _0xbcac=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0xcacb[_0x92713a];return _0x1893e1;};'use strict';var _=require('lodash');var util=require(_0xbcac('0x0'));var logger=require(_0xbcac('0x1'))(_0xbcac('0x2'));var moment=require(_0xbcac('0x3'));var BPromise=require('bluebird');var rp=require(_0xbcac('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbcac('0x5'));var config=require(_0xbcac('0x6'));var attributes=require(_0xbcac('0x7'));module[_0xbcac('0x8')]=function(_0x5b4bdb,_0x3a7b1a){return _0x5b4bdb['define'](_0xbcac('0x9'),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 70ee90c..691d581 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 _0x172f=['request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x2bcede,_0x5e8f52){var _0xb11943=function(_0x4a03e6){while(--_0x4a03e6){_0x2bcede['push'](_0x2bcede['shift']());}};_0xb11943(++_0x5e8f52);}(_0x172f,0x170));var _0xf172=function(_0x731aa2,_0x30a2de){_0x731aa2=_0x731aa2-0x0;var _0xf3690a=_0x172f[_0x731aa2];return _0xf3690a;};'use strict';var _=require(_0xf172('0x0'));var util=require(_0xf172('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf172('0x2'));var fs=require('fs');var Redis=require(_0xf172('0x3'));var db=require(_0xf172('0x4'))['db'];var utils=require(_0xf172('0x5'));var logger=require('../../config/logger')(_0xf172('0x6'));var config=require(_0xf172('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf172('0x8')][_0xf172('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1120dd,_0x541a67,_0x2e36ba){return new BPromise(function(_0x21489c,_0x15b758){return client[_0xf172('0xa')](_0x1120dd,_0x2e36ba)[_0xf172('0xb')](function(_0x466c48){logger[_0xf172('0xc')](_0xf172('0xd'),_0x541a67,_0xf172('0xe'));logger[_0xf172('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x541a67,_0xf172('0xe'),JSON[_0xf172('0x10')](_0x466c48));if(_0x466c48[_0xf172('0x11')]){if(_0x466c48['error'][_0xf172('0x12')]===0x1f4){logger['error'](_0xf172('0xd'),_0x541a67,_0x466c48[_0xf172('0x11')][_0xf172('0x13')]);return _0x15b758(_0x466c48[_0xf172('0x11')]['message']);}logger['error'](_0xf172('0xd'),_0x541a67,_0x466c48[_0xf172('0x11')][_0xf172('0x13')]);return _0x21489c(_0x466c48[_0xf172('0x11')][_0xf172('0x13')]);}else{logger[_0xf172('0xc')](_0xf172('0xd'),_0x541a67,_0xf172('0xe'));_0x21489c(_0x466c48['result'][_0xf172('0x13')]);}})[_0xf172('0x14')](function(_0x10510e){logger[_0xf172('0x11')](_0xf172('0xd'),_0x541a67,_0x10510e);_0x15b758(_0x10510e);});});} \ No newline at end of file +var _0xe61b=['client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe61b,0x1ad));var _0xbe61=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0xe61b[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0xbe61('0x0'));var util=require('util');var moment=require(_0xbe61('0x1'));var BPromise=require(_0xbe61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe61('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe61('0x4'));var logger=require(_0xbe61('0x5'))(_0xbe61('0x6'));var config=require('../../config/environment');var jayson=require(_0xbe61('0x7'));var client=jayson[_0xbe61('0x8')][_0xbe61('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e6d59,_0x4a2c8a,_0x11da49){return new BPromise(function(_0x551793,_0x175e34){return client[_0xbe61('0xa')](_0x3e6d59,_0x11da49)[_0xbe61('0xb')](function(_0x322d25){logger[_0xbe61('0xc')](_0xbe61('0xd'),_0x4a2c8a,_0xbe61('0xe'));logger[_0xbe61('0xf')](_0xbe61('0x10'),_0x4a2c8a,_0xbe61('0xe'),JSON[_0xbe61('0x11')](_0x322d25));if(_0x322d25[_0xbe61('0x12')]){if(_0x322d25[_0xbe61('0x12')][_0xbe61('0x13')]===0x1f4){logger[_0xbe61('0x12')](_0xbe61('0xd'),_0x4a2c8a,_0x322d25[_0xbe61('0x12')][_0xbe61('0x14')]);return _0x175e34(_0x322d25[_0xbe61('0x12')][_0xbe61('0x14')]);}logger[_0xbe61('0x12')](_0xbe61('0xd'),_0x4a2c8a,_0x322d25[_0xbe61('0x12')][_0xbe61('0x14')]);return _0x551793(_0x322d25['error']['message']);}else{logger[_0xbe61('0xc')](_0xbe61('0xd'),_0x4a2c8a,_0xbe61('0xe'));_0x551793(_0x322d25[_0xbe61('0x15')][_0xbe61('0x14')]);}})[_0xbe61('0x16')](function(_0xaf6364){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x4a2c8a,_0xaf6364);_0x175e34(_0xaf6364);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 0f36454..a384304 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5a442e,_0x470676){var _0x495b90=function(_0x127f14){while(--_0x127f14){_0x5a442e['push'](_0x5a442e['shift']());}};_0x495b90(++_0x470676);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0xcb91[_0xfedc72];return _0x2c7c78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1e9ff4,_0x57c05e){var _0x338a4c=function(_0x413f41){while(--_0x413f41){_0x1e9ff4['push'](_0x1e9ff4['shift']());}};_0x338a4c(++_0x57c05e);}(_0xe706,0xa3));var _0x6e70=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0xe706[_0x16eb11];return _0x3ae7ef;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index cd5ae3b..d8e82fe 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 _0x1991=['exports','INTEGER','STRING','sequelize'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x1991,0x187));var _0x1199=function(_0x19b2bd,_0x3fe339){_0x19b2bd=_0x19b2bd-0x0;var _0x38bd2b=_0x1991[_0x19b2bd];return _0x38bd2b;};'use strict';var Sequelize=require(_0x1199('0x0'));module[_0x1199('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1199('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1199('0x3')]}}; \ No newline at end of file +var _0x0102=['INTEGER','sequelize','exports'];(function(_0x5d6877,_0xcd8ad7){var _0x454c60=function(_0x5e34a7){while(--_0x5e34a7){_0x5d6877['push'](_0x5d6877['shift']());}};_0x454c60(++_0xcd8ad7);}(_0x0102,0x1a8));var _0x2010=function(_0x293d7e,_0x5f2229){_0x293d7e=_0x293d7e-0x0;var _0x673b32=_0x0102[_0x293d7e];return _0x673b32;};'use strict';var Sequelize=require(_0x2010('0x0'));module[_0x2010('0x1')]={'penalty':{'type':Sequelize[_0x2010('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2010('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index b69b7c4..c3a6a99 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 _0x4028=['bluebird','request-promise','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','moment'];(function(_0x1476ba,_0x446421){var _0x5e7bc1=function(_0x4aa99c){while(--_0x4aa99c){_0x1476ba['push'](_0x1476ba['shift']());}};_0x5e7bc1(++_0x446421);}(_0x4028,0xf8));var _0x8402=function(_0x4f0e8e,_0x4b637d){_0x4f0e8e=_0x4f0e8e-0x0;var _0x5e1f42=_0x4028[_0x4f0e8e];return _0x5e1f42;};'use strict';var _=require(_0x8402('0x0'));var util=require('util');var logger=require(_0x8402('0x1'))(_0x8402('0x2'));var moment=require(_0x8402('0x3'));var BPromise=require(_0x8402('0x4'));var rp=require(_0x8402('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8402('0x6'));var config=require(_0x8402('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x8402('0x8')]=function(_0x401802,_0x2e6fd0){return _0x401802[_0x8402('0x9')](_0x8402('0xa'),attributes,{'tableName':_0x8402('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bf9=['define','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x103077,_0x55a8b2){var _0x260e26=function(_0x4c57e){while(--_0x4c57e){_0x103077['push'](_0x103077['shift']());}};_0x260e26(++_0x55a8b2);}(_0x5bf9,0xce));var _0x95bf=function(_0x2bb332,_0x2136e8){_0x2bb332=_0x2bb332-0x0;var _0x37dff2=_0x5bf9[_0x2bb332];return _0x37dff2;};'use strict';var _=require(_0x95bf('0x0'));var util=require('util');var logger=require(_0x95bf('0x1'))(_0x95bf('0x2'));var moment=require(_0x95bf('0x3'));var BPromise=require(_0x95bf('0x4'));var rp=require(_0x95bf('0x5'));var fs=require('fs');var path=require(_0x95bf('0x6'));var rimraf=require(_0x95bf('0x7'));var config=require(_0x95bf('0x8'));var attributes=require(_0x95bf('0x9'));module['exports']=function(_0x32fad4,_0x1f1417){return _0x32fad4[_0x95bf('0xa')]('UserFaxQueue',attributes,{'tableName':_0x95bf('0xb'),'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 270fe28..4a62813 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 _0x8944=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x17e849,_0x588a88){var _0x35d503=function(_0x1d7eb7){while(--_0x1d7eb7){_0x17e849['push'](_0x17e849['shift']());}};_0x35d503(++_0x588a88);}(_0x8944,0x1c6));var _0x4894=function(_0x5bdc4e,_0x3c78c4){_0x5bdc4e=_0x5bdc4e-0x0;var _0x22c216=_0x8944[_0x5bdc4e];return _0x22c216;};'use strict';var _=require(_0x4894('0x0'));var util=require(_0x4894('0x1'));var moment=require('moment');var BPromise=require(_0x4894('0x2'));var rs=require(_0x4894('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4894('0x4'))['db'];var utils=require(_0x4894('0x5'));var logger=require(_0x4894('0x6'))(_0x4894('0x7'));var config=require(_0x4894('0x8'));var jayson=require(_0x4894('0x9'));var client=jayson[_0x4894('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11bef9,_0x2a0c91,_0x33177c){return new BPromise(function(_0x938cea,_0x4f01eb){return client['request'](_0x11bef9,_0x33177c)[_0x4894('0xb')](function(_0x151e14){logger[_0x4894('0xc')](_0x4894('0xd'),_0x2a0c91,_0x4894('0xe'));logger[_0x4894('0xf')](_0x4894('0x10'),_0x2a0c91,_0x4894('0xe'),JSON[_0x4894('0x11')](_0x151e14));if(_0x151e14['error']){if(_0x151e14[_0x4894('0x12')][_0x4894('0x13')]===0x1f4){logger[_0x4894('0x12')](_0x4894('0xd'),_0x2a0c91,_0x151e14[_0x4894('0x12')][_0x4894('0x14')]);return _0x4f01eb(_0x151e14[_0x4894('0x12')][_0x4894('0x14')]);}logger['error'](_0x4894('0xd'),_0x2a0c91,_0x151e14[_0x4894('0x12')]['message']);return _0x938cea(_0x151e14[_0x4894('0x12')][_0x4894('0x14')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x2a0c91,'request\x20sent');_0x938cea(_0x151e14[_0x4894('0x15')]['message']);}})[_0x4894('0x16')](function(_0x455d40){logger[_0x4894('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x2a0c91,_0x455d40);_0x4f01eb(_0x455d40);});});} \ No newline at end of file +var _0x3c4d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserFaxQueue,\x20%s,\x20%s','result','lodash','util'];(function(_0x56b30a,_0x9d4097){var _0x3ca005=function(_0x140287){while(--_0x140287){_0x56b30a['push'](_0x56b30a['shift']());}};_0x3ca005(++_0x9d4097);}(_0x3c4d,0xe5));var _0xd3c4=function(_0x2465b7,_0xc7d7e){_0x2465b7=_0x2465b7-0x0;var _0x2039ae=_0x3c4d[_0x2465b7];return _0x2039ae;};'use strict';var _=require(_0xd3c4('0x0'));var util=require(_0xd3c4('0x1'));var moment=require('moment');var BPromise=require(_0xd3c4('0x2'));var rs=require(_0xd3c4('0x3'));var fs=require('fs');var Redis=require(_0xd3c4('0x4'));var db=require(_0xd3c4('0x5'))['db'];var utils=require(_0xd3c4('0x6'));var logger=require(_0xd3c4('0x7'))(_0xd3c4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3c4('0x9')][_0xd3c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc421e2,_0x27f4ac,_0x13bfa0){return new BPromise(function(_0x579019,_0x1e99b4){return client['request'](_0xc421e2,_0x13bfa0)[_0xd3c4('0xb')](function(_0x46c09f){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x27f4ac,_0xd3c4('0xc'));logger[_0xd3c4('0xd')](_0xd3c4('0xe'),_0x27f4ac,_0xd3c4('0xc'),JSON[_0xd3c4('0xf')](_0x46c09f));if(_0x46c09f[_0xd3c4('0x10')]){if(_0x46c09f['error'][_0xd3c4('0x11')]===0x1f4){logger[_0xd3c4('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x27f4ac,_0x46c09f[_0xd3c4('0x10')][_0xd3c4('0x12')]);return _0x1e99b4(_0x46c09f['error']['message']);}logger[_0xd3c4('0x10')](_0xd3c4('0x13'),_0x27f4ac,_0x46c09f[_0xd3c4('0x10')][_0xd3c4('0x12')]);return _0x579019(_0x46c09f['error'][_0xd3c4('0x12')]);}else{logger['info'](_0xd3c4('0x13'),_0x27f4ac,'request\x20sent');_0x579019(_0x46c09f[_0xd3c4('0x14')][_0xd3c4('0x12')]);}})['catch'](function(_0xe868c3){logger['error'](_0xd3c4('0x13'),_0x27f4ac,_0xe868c3);_0x1e99b4(_0xe868c3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 080c3a7..01ef9e9 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x125c6b,_0x3396bd){var _0x49b36f=function(_0x14a408){while(--_0x14a408){_0x125c6b['push'](_0x125c6b['shift']());}};_0x49b36f(++_0x3396bd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x25e557,_0x23df3a){var _0x3d64e4=function(_0x26762a){while(--_0x26762a){_0x25e557['push'](_0x25e557['shift']());}};_0x3d64e4(++_0x23df3a);}(_0xedd9,0xfc));var _0x9edd=function(_0x41943c,_0x38e921){_0x41943c=_0x41943c-0x0;var _0x3f5c1a=_0xedd9[_0x41943c];return _0x3f5c1a;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 87ba11d..6878bb8 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 _0x32c2=['sequelize','exports','INTEGER'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x32c2,0x90));var _0x232c=function(_0x583278,_0x5474fa){_0x583278=_0x583278-0x0;var _0x7af2fe=_0x32c2[_0x583278];return _0x7af2fe;};'use strict';var Sequelize=require(_0x232c('0x0'));module[_0x232c('0x1')]={'penalty':{'type':Sequelize[_0x232c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8f27=['exports','sequelize'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x8f27,0x11d));var _0x78f2=function(_0x35cc99,_0x5bb972){_0x35cc99=_0x35cc99-0x0;var _0x14373c=_0x8f27[_0x35cc99];return _0x14373c;};'use strict';var Sequelize=require(_0x78f2('0x0'));module[_0x78f2('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 99a32ba..4f8507a 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 _0xd8f0=['moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger'];(function(_0x272573,_0x354a17){var _0x35de24=function(_0x2faf6c){while(--_0x2faf6c){_0x272573['push'](_0x272573['shift']());}};_0x35de24(++_0x354a17);}(_0xd8f0,0xbe));var _0x0d8f=function(_0x4e936b,_0x193d71){_0x4e936b=_0x4e936b-0x0;var _0xda6dd6=_0xd8f0[_0x4e936b];return _0xda6dd6;};'use strict';var _=require(_0x0d8f('0x0'));var util=require('util');var logger=require(_0x0d8f('0x1'))('api');var moment=require(_0x0d8f('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d8f('0x3'));var fs=require('fs');var path=require(_0x0d8f('0x4'));var rimraf=require(_0x0d8f('0x5'));var config=require(_0x0d8f('0x6'));var attributes=require(_0x0d8f('0x7'));module[_0x0d8f('0x8')]=function(_0x546b72,_0x5109b2){return _0x546b72[_0x0d8f('0x9')](_0x0d8f('0xa'),attributes,{'tableName':_0x0d8f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3559=['lodash','moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x3559,0x1e4));var _0x9355=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3559[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9355('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9355('0x1'));var BPromise=require(_0x9355('0x2'));var rp=require(_0x9355('0x3'));var fs=require('fs');var path=require(_0x9355('0x4'));var rimraf=require(_0x9355('0x5'));var config=require('../../config/environment');var attributes=require(_0x9355('0x6'));module[_0x9355('0x7')]=function(_0x32fc73,_0x5e2189){return _0x32fc73[_0x9355('0x8')](_0x9355('0x9'),attributes,{'tableName':_0x9355('0xa'),'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 74ed527..bfa2d04 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x008c,0x188));var _0xc008=function(_0x437abe,_0x3e33a8){_0x437abe=_0x437abe-0x0;var _0x51189b=_0x008c[_0x437abe];return _0x51189b;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x2233dd,_0x311a7a){var _0x38dcdb=function(_0x2f98c4){while(--_0x2f98c4){_0x2233dd['push'](_0x2233dd['shift']());}};_0x38dcdb(++_0x311a7a);}(_0x3e74,0x175));var _0x43e7=function(_0x478a2d,_0x2af21e){_0x478a2d=_0x478a2d-0x0;var _0x54b06c=_0x3e74[_0x478a2d];return _0x54b06c;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index c0fc9d4..cdcbbd5 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 _0xe169=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','sendUserNotification'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xe169,0x1cb));var _0x9e16=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe169[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x9e16('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9e16('0x1'));var express=require(_0x9e16('0x2'));var router=express['Router']();var fs_extra=require(_0x9e16('0x3'));var auth=require(_0x9e16('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9e16('0x5'));var controller=require(_0x9e16('0x6'));router[_0x9e16('0x7')]('/',auth['isAuthenticated'](),controller[_0x9e16('0x8')]);module['exports']=router; \ No newline at end of file +var _0x8bc9=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8bc9,0x12d));var _0x98bc=function(_0x6ababc,_0x1ac8cc){_0x6ababc=_0x6ababc-0x0;var _0x28d76d=_0x8bc9[_0x6ababc];return _0x28d76d;};'use strict';var multer=require(_0x98bc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x98bc('0x1'));var express=require(_0x98bc('0x2'));var router=express[_0x98bc('0x3')]();var fs_extra=require(_0x98bc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x98bc('0x5'));var config=require(_0x98bc('0x6'));var controller=require(_0x98bc('0x7'));router['post']('/',auth[_0x98bc('0x8')](),controller['sendUserNotification']);module[_0x98bc('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 8962371..a9d7e49 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 _0xfa86=['sequelize','TEXT','STRING'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0xfa86,0x1a4));var _0x6fa8=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xfa86[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0x6fa8('0x0'));module['exports']={'body':{'type':Sequelize[_0x6fa8('0x1')]},'senderName':{'type':Sequelize[_0x6fa8('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xe438=['BOOLEAN','exports','TEXT','STRING'];(function(_0x3867ef,_0x1caac6){var _0x12f1ca=function(_0x3f6500){while(--_0x3f6500){_0x3867ef['push'](_0x3867ef['shift']());}};_0x12f1ca(++_0x1caac6);}(_0xe438,0x1cd));var _0x8e43=function(_0x1dc8c5,_0x277b8f){_0x1dc8c5=_0x1dc8c5-0x0;var _0x202db8=_0xe438[_0x1dc8c5];return _0x202db8;};'use strict';var Sequelize=require('sequelize');module[_0x8e43('0x0')]={'body':{'type':Sequelize[_0x8e43('0x1')]},'senderName':{'type':Sequelize[_0x8e43('0x2')]},'recipientsId':{'type':Sequelize[_0x8e43('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x8e43('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 74e142b..b429b00 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 _0x5448=['union','ids','includes','queue','replace','Queue','push','all','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userNotification.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','some','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User'];(function(_0x214403,_0x1b71ce){var _0xd1faf3=function(_0x38eb37){while(--_0x38eb37){_0x214403['push'](_0x214403['shift']());}};_0xd1faf3(++_0x1b71ce);}(_0x5448,0x138));var _0x8544=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5448[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x8544('0x0'));var rimraf=require(_0x8544('0x1'));var zipdir=require(_0x8544('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8544('0x3'));var moment=require(_0x8544('0x4'));var BPromise=require(_0x8544('0x5'));var Mustache=require(_0x8544('0x6'));var util=require(_0x8544('0x7'));var path=require('path');var sox=require(_0x8544('0x8'));var csv=require(_0x8544('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8544('0xa'));var _=require('lodash');var squel=require(_0x8544('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8544('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8544('0xd'));var Papa=require(_0x8544('0xe'));var Redis=require(_0x8544('0xf'));var authService=require(_0x8544('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8544('0x11'));var logger=require(_0x8544('0x12'))(_0x8544('0x13'));var utils=require(_0x8544('0x14'));var config=require(_0x8544('0x15'));var licenseUtil=require(_0x8544('0x16'));var db=require('../../mysqldb')['db'];config[_0x8544('0x17')]=_[_0x8544('0x18')](config[_0x8544('0x17')],{'host':_0x8544('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8544('0x1a'))[_0x8544('0x1b')](socket);function respondWithStatusCode(_0x3b140b,_0x5839d5){_0x5839d5=_0x5839d5||0xcc;return function(_0x466ffb){if(_0x466ffb){return _0x3b140b[_0x8544('0x1c')](_0x5839d5);}return _0x3b140b['status'](_0x5839d5)[_0x8544('0x1d')]();};}function respondWithResult(_0x11f892,_0x3a8ee6){_0x3a8ee6=_0x3a8ee6||0xc8;return function(_0x318e18){if(_0x318e18){return _0x11f892['status'](_0x3a8ee6)[_0x8544('0x1e')](_0x318e18);}};}function respondWithFilteredResult(_0x30d46c,_0x23c3c0){return function(_0xa4e8ed){if(_0xa4e8ed){var _0x48e541=typeof _0x23c3c0['offset']===_0x8544('0x1f')&&typeof _0x23c3c0[_0x8544('0x20')]===_0x8544('0x1f');var _0x43927e=_0xa4e8ed[_0x8544('0x21')];var _0x536394=_0x48e541?0x0:_0x23c3c0[_0x8544('0x22')];var _0x28ad53=_0x48e541?_0xa4e8ed[_0x8544('0x21')]:_0x23c3c0[_0x8544('0x22')]+_0x23c3c0[_0x8544('0x20')];var _0x428b35;if(_0x28ad53>=_0x43927e){_0x28ad53=_0x43927e;_0x428b35=0xc8;}else{_0x428b35=0xce;}_0x30d46c[_0x8544('0x23')](_0x428b35);return _0x30d46c[_0x8544('0x24')]('Content-Range',_0x536394+'-'+_0x28ad53+'/'+_0x43927e)[_0x8544('0x1e')](_0xa4e8ed);}return null;};}function patchUpdates(_0x2c98eb){return function(_0x256bb1){try{jsonpatch[_0x8544('0x25')](_0x256bb1,_0x2c98eb,!![]);}catch(_0x40f0ef){return BPromise[_0x8544('0x26')](_0x40f0ef);}return _0x256bb1[_0x8544('0x27')]();};}function saveUpdates(_0x581606,_0x68bc17){return function(_0x18cdf3){if(_0x18cdf3){return _0x18cdf3[_0x8544('0x28')](_0x581606)[_0x8544('0x29')](function(_0x95bea9){return _0x95bea9;});}return null;};}function removeEntity(_0x6abd6e,_0x32a13f){return function(_0x4eacba){if(_0x4eacba){return _0x4eacba[_0x8544('0x2a')]()[_0x8544('0x29')](function(){_0x6abd6e[_0x8544('0x23')](0xcc)[_0x8544('0x1d')]();});}};}function handleEntityNotFound(_0xe3d21b,_0x20213d){return function(_0x5f4596){if(!_0x5f4596){_0xe3d21b[_0x8544('0x1c')](0x194);}return _0x5f4596;};}function handleError(_0x4e693d,_0x3c75cf){_0x3c75cf=_0x3c75cf||0x1f4;return function(_0x3236c9){logger[_0x8544('0x2b')](_0x3236c9[_0x8544('0x2c')]);if(_0x3236c9['name']){delete _0x3236c9[_0x8544('0x2d')];}_0x4e693d[_0x8544('0x23')](_0x3c75cf)[_0x8544('0x2e')](_0x3236c9);};}exports['sendUserNotification']=function(_0x35dddd,_0x117133,_0xc08b9e){if(!_0x35dddd[_0x8544('0x2f')][_0x8544('0x30')](_0x8544('0x31'))&&!_0x35dddd[_0x8544('0x2f')]['hasOwnProperty'](_0x8544('0x32'))){throw new db[(_0x8544('0x33'))]['ValidationError'](_0x8544('0x34'));}else{if(_0x35dddd[_0x8544('0x2f')][_0x8544('0x30')](_0x8544('0x32'))&&!_0x35dddd[_0x8544('0x2f')][_0x8544('0x30')](_0x8544('0x35'))){throw new db[(_0x8544('0x33'))]['ValidationError'](_0x8544('0x36'));}if(!_0x35dddd[_0x8544('0x2f')]['hasOwnProperty']('recipients')){throw new db[(_0x8544('0x33'))][(_0x8544('0x37'))](_0x8544('0x38'));}else{try{var _0x2e4b6c=JSON[_0x8544('0x39')](_0x35dddd[_0x8544('0x2f')]['recipients']);}catch(_0xdb9118){logger['error'](_0xdb9118);throw new db[(_0x8544('0x33'))][(_0x8544('0x37'))](_0x8544('0x3a'));}var _0x5678d0=['chatqueue',_0x8544('0x3b'),_0x8544('0x3c'),_0x8544('0x3d'),_0x8544('0x3e'),_0x8544('0x3f'),'whatsappqueue','team','user'];if(_[_0x8544('0x40')](_0x2e4b6c,function(_0x254251){return!_['includes'](_0x5678d0,_0x254251[_0x8544('0x41')]['toLowerCase']());})){throw new db[(_0x8544('0x33'))][(_0x8544('0x37'))](_0x8544('0x42'));}}}var _0x17376f={};_0x17376f[_0x8544('0x43')]=_0x35dddd['body'][_0x8544('0x30')](_0x8544('0x43'))?_0x35dddd[_0x8544('0x2f')][_0x8544('0x43')]:_0x35dddd[_0x8544('0x44')][_0x8544('0x45')];_0x17376f[_0x8544('0x46')]=_['isEmpty'](_0x35dddd[_0x8544('0x2f')]['recipientsDescription'])?null:_0x35dddd['body'][_0x8544('0x46')];_0x17376f['beep']=_0x35dddd[_0x8544('0x2f')][_0x8544('0x47')]||![];_0x17376f[_0x8544('0x48')]=_0x35dddd['user']['id'];return getContent(_0x35dddd['body'])[_0x8544('0x29')](function(_0x328bd0){_0x17376f[_0x8544('0x2f')]=_0x328bd0;return getRecipients(_0x2e4b6c);})[_0x8544('0x29')](function(_0x4f1632){_0x17376f[_0x8544('0x49')]=_[_0x8544('0x4a')](_0x4f1632)[_0x8544('0x4b')](',');return db[_0x8544('0x4c')][_0x8544('0x4d')](function(_0x51d1f5){return db['UserNotification'][_0x8544('0x4e')](_0x17376f,{'raw':!![],'transaction':_0x51d1f5})['then'](function(_0x16d750){var _0x3d4ca7={'sender':_0x17376f[_0x8544('0x43')],'description':_0x17376f['recipientsDescription'],'content':_0x17376f[_0x8544('0x2f')],'beep':_0x17376f['beep']};_0x4f1632[_0x8544('0x4f')](function(_0x564370){_0x3d4ca7[_0x8544('0x50')]=_0x564370;socket[_0x8544('0x51')]('userNotification:send',_0x3d4ca7);});return _0x16d750;});});})[_0x8544('0x29')](respondWithResult(_0x117133,0xc9))[_0x8544('0x52')](handleError(_0x117133,null));};function getContent(_0x331077){return new BPromise(function(_0xa5b14b,_0x33c06b){if(_0x331077[_0x8544('0x31')]){_0xa5b14b(_0x331077['text']);return;}return db['Template']['findOne']({'attributes':[_0x8544('0x53')],'where':{'id':_0x331077[_0x8544('0x32')]},'raw':!![]})['then'](function(_0x156ad1){if(!_0x156ad1)throw new db[(_0x8544('0x33'))][(_0x8544('0x37'))](_0x8544('0x54'));var _0x37e0cf=Mustache[_0x8544('0x55')](_0x156ad1[_0x8544('0x53')],_0x331077['view']);_0xa5b14b(_0x37e0cf);})[_0x8544('0x52')](function(_0x1929f1){_0x33c06b(_0x1929f1);});});}function getRecipients(_0xbd050){return new BPromise(function(_0x32d6dd,_0x86d524){var _0x16da7c=[];var _0x10f5d1=[];_0xbd050[_0x8544('0x4f')](function(_0xe68cc8){var _0xd20a7e=_[_0x8544('0x56')](_0xe68cc8[_0x8544('0x41')]['toLowerCase']());if(_0xd20a7e===_0x8544('0x57')){_0x16da7c=_[_0x8544('0x58')](_0x16da7c,_0xe68cc8[_0x8544('0x59')]);}else{if(_[_0x8544('0x5a')](_0xd20a7e,_0x8544('0x5b')))_0xd20a7e=_0xd20a7e[_0x8544('0x5c')]('queue',_0x8544('0x5d'));_0xe68cc8[_0x8544('0x59')]['forEach'](function(_0x2c7a45){_0x10f5d1[_0x8544('0x5e')](getAgents(_0xd20a7e,_0x2c7a45));});}});return BPromise[_0x8544('0x5f')](_0x10f5d1)[_0x8544('0x29')](function(_0x17a811){_0x16da7c=_[_0x8544('0x58')](_0x16da7c,_[_0x8544('0x60')](_0x17a811));_0x32d6dd(_0x16da7c);})[_0x8544('0x52')](function(_0x57e115){_0x86d524(_0x57e115);});});}function getAgents(_0x105398,_0x300ee8){return new BPromise(function(_0x244d3e,_0xb597e4){return db[_0x105398][_0x8544('0x61')]({'where':{'id':_0x300ee8}})[_0x8544('0x29')](function(_0x4efc5d){return _0x4efc5d[_0x8544('0x62')]({'attributes':['id'],'raw':!![]})[_0x8544('0x29')](function(_0x42d91f){var _0x39a045=_[_0x8544('0x63')](_0x42d91f,'id');_0x244d3e(_0x39a045);});})[_0x8544('0x52')](function(_0x297b0b){_0xb597e4(_0x297b0b);});});} \ No newline at end of file +var _0xb5a9=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','error','name','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','join','UserNotification','create','forEach','recipient','emit','catch','text','findOne','html','startCase','toLowerCase','User','union','queue','replace','Queue','all','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x16cf36,_0x11dac5){var _0x2c5e6d=function(_0x1450f0){while(--_0x1450f0){_0x16cf36['push'](_0x16cf36['shift']());}};_0x2c5e6d(++_0x11dac5);}(_0xb5a9,0x171));var _0x9b5a=function(_0x3b13c4,_0x1ae7d4){_0x3b13c4=_0x3b13c4-0x0;var _0x407b78=_0xb5a9[_0x3b13c4];return _0x407b78;};'use strict';var emlformat=require(_0x9b5a('0x0'));var rimraf=require(_0x9b5a('0x1'));var zipdir=require(_0x9b5a('0x2'));var jsonpatch=require(_0x9b5a('0x3'));var rp=require(_0x9b5a('0x4'));var moment=require(_0x9b5a('0x5'));var BPromise=require(_0x9b5a('0x6'));var Mustache=require(_0x9b5a('0x7'));var util=require('util');var path=require(_0x9b5a('0x8'));var sox=require('sox');var csv=require(_0x9b5a('0x9'));var ejs=require(_0x9b5a('0xa'));var fs=require('fs');var fs_extra=require(_0x9b5a('0xb'));var _=require(_0x9b5a('0xc'));var squel=require(_0x9b5a('0xd'));var crypto=require(_0x9b5a('0xe'));var jsforce=require(_0x9b5a('0xf'));var deskjs=require(_0x9b5a('0x10'));var toCsv=require(_0x9b5a('0x9'));var querystring=require(_0x9b5a('0x11'));var Papa=require(_0x9b5a('0x12'));var Redis=require(_0x9b5a('0x13'));var authService=require(_0x9b5a('0x14'));var qs=require(_0x9b5a('0x15'));var as=require(_0x9b5a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9b5a('0x17'));var utils=require(_0x9b5a('0x18'));var config=require(_0x9b5a('0x19'));var licenseUtil=require(_0x9b5a('0x1a'));var db=require(_0x9b5a('0x1b'))['db'];config['redis']=_[_0x9b5a('0x1c')](config[_0x9b5a('0x1d')],{'host':_0x9b5a('0x1e'),'port':0x18eb});var socket=require(_0x9b5a('0x1f'))(new Redis(config[_0x9b5a('0x1d')]));require(_0x9b5a('0x20'))[_0x9b5a('0x21')](socket);function respondWithStatusCode(_0x34586b,_0x3aa196){_0x3aa196=_0x3aa196||0xcc;return function(_0x3a9ec0){if(_0x3a9ec0){return _0x34586b[_0x9b5a('0x22')](_0x3aa196);}return _0x34586b[_0x9b5a('0x23')](_0x3aa196)[_0x9b5a('0x24')]();};}function respondWithResult(_0x1622cd,_0x55f1a2){_0x55f1a2=_0x55f1a2||0xc8;return function(_0x28e1ee){if(_0x28e1ee){return _0x1622cd['status'](_0x55f1a2)[_0x9b5a('0x25')](_0x28e1ee);}};}function respondWithFilteredResult(_0x487139,_0x349aaa){return function(_0x10dd7e){if(_0x10dd7e){var _0x5bfadb=typeof _0x349aaa['offset']===_0x9b5a('0x26')&&typeof _0x349aaa[_0x9b5a('0x27')]===_0x9b5a('0x26');var _0x18a876=_0x10dd7e[_0x9b5a('0x28')];var _0x39ab06=_0x5bfadb?0x0:_0x349aaa[_0x9b5a('0x29')];var _0x40a10e=_0x5bfadb?_0x10dd7e[_0x9b5a('0x28')]:_0x349aaa['offset']+_0x349aaa[_0x9b5a('0x27')];var _0x4bdb5e;if(_0x40a10e>=_0x18a876){_0x40a10e=_0x18a876;_0x4bdb5e=0xc8;}else{_0x4bdb5e=0xce;}_0x487139[_0x9b5a('0x23')](_0x4bdb5e);return _0x487139[_0x9b5a('0x2a')](_0x9b5a('0x2b'),_0x39ab06+'-'+_0x40a10e+'/'+_0x18a876)[_0x9b5a('0x25')](_0x10dd7e);}return null;};}function patchUpdates(_0x45f3f8){return function(_0x434adf){try{jsonpatch[_0x9b5a('0x2c')](_0x434adf,_0x45f3f8,!![]);}catch(_0x1755ae){return BPromise['reject'](_0x1755ae);}return _0x434adf[_0x9b5a('0x2d')]();};}function saveUpdates(_0xd40e59,_0x58af81){return function(_0x3891d2){if(_0x3891d2){return _0x3891d2[_0x9b5a('0x2e')](_0xd40e59)['then'](function(_0x577123){return _0x577123;});}return null;};}function removeEntity(_0x30dd85,_0x1e4025){return function(_0x28d3fb){if(_0x28d3fb){return _0x28d3fb[_0x9b5a('0x2f')]()[_0x9b5a('0x30')](function(){_0x30dd85['status'](0xcc)[_0x9b5a('0x24')]();});}};}function handleEntityNotFound(_0x49a2c3,_0x366401){return function(_0x44b1ab){if(!_0x44b1ab){_0x49a2c3['sendStatus'](0x194);}return _0x44b1ab;};}function handleError(_0x1dc69c,_0x41ca33){_0x41ca33=_0x41ca33||0x1f4;return function(_0x3176ce){logger[_0x9b5a('0x31')](_0x3176ce['stack']);if(_0x3176ce[_0x9b5a('0x32')]){delete _0x3176ce[_0x9b5a('0x32')];}_0x1dc69c[_0x9b5a('0x23')](_0x41ca33)['send'](_0x3176ce);};}exports[_0x9b5a('0x33')]=function(_0x10154d,_0x3d2d54,_0x29df01){if(!_0x10154d[_0x9b5a('0x34')][_0x9b5a('0x35')]('text')&&!_0x10154d['body'][_0x9b5a('0x35')]('TemplateId')){throw new db[(_0x9b5a('0x36'))][(_0x9b5a('0x37'))](_0x9b5a('0x38'));}else{if(_0x10154d[_0x9b5a('0x34')][_0x9b5a('0x35')](_0x9b5a('0x39'))&&!_0x10154d['body'][_0x9b5a('0x35')](_0x9b5a('0x3a'))){throw new db[(_0x9b5a('0x36'))][(_0x9b5a('0x37'))](_0x9b5a('0x3b'));}if(!_0x10154d[_0x9b5a('0x34')]['hasOwnProperty'](_0x9b5a('0x3c'))){throw new db[(_0x9b5a('0x36'))][(_0x9b5a('0x37'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x44ede4=JSON[_0x9b5a('0x3d')](_0x10154d[_0x9b5a('0x34')][_0x9b5a('0x3c')]);}catch(_0x348192){logger['error'](_0x348192);throw new db['Sequelize'][(_0x9b5a('0x37'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x4e418b=[_0x9b5a('0x3e'),_0x9b5a('0x3f'),_0x9b5a('0x40'),_0x9b5a('0x41'),'smsqueue',_0x9b5a('0x42'),_0x9b5a('0x43'),'team',_0x9b5a('0x44')];if(_['some'](_0x44ede4,function(_0x422005){return!_[_0x9b5a('0x45')](_0x4e418b,_0x422005[_0x9b5a('0x46')]['toLowerCase']());})){throw new db[(_0x9b5a('0x36'))][(_0x9b5a('0x37'))](_0x9b5a('0x47'));}}}var _0x1acb12={};_0x1acb12[_0x9b5a('0x48')]=_0x10154d[_0x9b5a('0x34')]['hasOwnProperty']('senderName')?_0x10154d[_0x9b5a('0x34')][_0x9b5a('0x48')]:_0x10154d[_0x9b5a('0x44')]['fullname'];_0x1acb12['recipientsDescription']=_[_0x9b5a('0x49')](_0x10154d[_0x9b5a('0x34')][_0x9b5a('0x4a')])?null:_0x10154d[_0x9b5a('0x34')][_0x9b5a('0x4a')];_0x1acb12['beep']=_0x10154d[_0x9b5a('0x34')][_0x9b5a('0x4b')]||![];_0x1acb12['SenderId']=_0x10154d[_0x9b5a('0x44')]['id'];return getContent(_0x10154d[_0x9b5a('0x34')])[_0x9b5a('0x30')](function(_0x57ecc0){_0x1acb12['body']=_0x57ecc0;return getRecipients(_0x44ede4);})[_0x9b5a('0x30')](function(_0x2c1d75){_0x1acb12['recipientsId']=_['sortBy'](_0x2c1d75)[_0x9b5a('0x4c')](',');return db['sequelize']['transaction'](function(_0x4ad058){return db[_0x9b5a('0x4d')][_0x9b5a('0x4e')](_0x1acb12,{'raw':!![],'transaction':_0x4ad058})[_0x9b5a('0x30')](function(_0x43be2f){var _0x2c38a3={'sender':_0x1acb12[_0x9b5a('0x48')],'description':_0x1acb12['recipientsDescription'],'content':_0x1acb12[_0x9b5a('0x34')],'beep':_0x1acb12[_0x9b5a('0x4b')]};_0x2c1d75[_0x9b5a('0x4f')](function(_0x4fca2d){_0x2c38a3[_0x9b5a('0x50')]=_0x4fca2d;socket[_0x9b5a('0x51')]('userNotification:send',_0x2c38a3);});return _0x43be2f;});});})[_0x9b5a('0x30')](respondWithResult(_0x3d2d54,0xc9))[_0x9b5a('0x52')](handleError(_0x3d2d54,null));};function getContent(_0x2eb123){return new BPromise(function(_0x52234b,_0x20934a){if(_0x2eb123[_0x9b5a('0x53')]){_0x52234b(_0x2eb123['text']);return;}return db['Template'][_0x9b5a('0x54')]({'attributes':[_0x9b5a('0x55')],'where':{'id':_0x2eb123[_0x9b5a('0x39')]},'raw':!![]})[_0x9b5a('0x30')](function(_0x477f12){if(!_0x477f12)throw new db['Sequelize'][(_0x9b5a('0x37'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x462771=Mustache['render'](_0x477f12['html'],_0x2eb123[_0x9b5a('0x3a')]);_0x52234b(_0x462771);})['catch'](function(_0x1a491a){_0x20934a(_0x1a491a);});});}function getRecipients(_0x58d6b1){return new BPromise(function(_0xc4f81b,_0x30a354){var _0x298cd6=[];var _0x2da74f=[];_0x58d6b1[_0x9b5a('0x4f')](function(_0x5874fc){var _0x4c8064=_[_0x9b5a('0x56')](_0x5874fc[_0x9b5a('0x46')][_0x9b5a('0x57')]());if(_0x4c8064===_0x9b5a('0x58')){_0x298cd6=_[_0x9b5a('0x59')](_0x298cd6,_0x5874fc['ids']);}else{if(_[_0x9b5a('0x45')](_0x4c8064,_0x9b5a('0x5a')))_0x4c8064=_0x4c8064[_0x9b5a('0x5b')](_0x9b5a('0x5a'),_0x9b5a('0x5c'));_0x5874fc['ids'][_0x9b5a('0x4f')](function(_0x574013){_0x2da74f['push'](getAgents(_0x4c8064,_0x574013));});}});return BPromise[_0x9b5a('0x5d')](_0x2da74f)[_0x9b5a('0x30')](function(_0x361249){_0x298cd6=_[_0x9b5a('0x59')](_0x298cd6,_[_0x9b5a('0x5e')](_0x361249));_0xc4f81b(_0x298cd6);})[_0x9b5a('0x52')](function(_0x5458c7){_0x30a354(_0x5458c7);});});}function getAgents(_0x17cfaa,_0x331d80){return new BPromise(function(_0x1672fb,_0x13c191){return db[_0x17cfaa][_0x9b5a('0x54')]({'where':{'id':_0x331d80}})[_0x9b5a('0x30')](function(_0x4e62d0){return _0x4e62d0[_0x9b5a('0x5f')]({'attributes':['id'],'raw':!![]})[_0x9b5a('0x30')](function(_0x2c3a31){var _0x55ef70=_['map'](_0x2c3a31,'id');_0x1672fb(_0x55ef70);});})[_0x9b5a('0x52')](function(_0x4420a8){_0x13c191(_0x4420a8);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index d3c481f..8a12003 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 _0xeb55=['hook','events','../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x56fc1f,_0x23e840){var _0x2aea15=function(_0x5ee54f){while(--_0x5ee54f){_0x56fc1f['push'](_0x56fc1f['shift']());}};_0x2aea15(++_0x23e840);}(_0xeb55,0x1cc));var _0x5eb5=function(_0x245dbe,_0x3e0831){_0x245dbe=_0x245dbe-0x0;var _0x597415=_0xeb55[_0x245dbe];return _0x597415;};'use strict';var EventEmitter=require(_0x5eb5('0x0'));var UserNotification=require(_0x5eb5('0x1'))['db'][_0x5eb5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5eb5('0x3')](0x0);var events={'afterCreate':_0x5eb5('0x4'),'afterUpdate':'update','afterDestroy':_0x5eb5('0x5')};function emitEvent(_0x1a0bb1){return function(_0x45b47b,_0x1c953f,_0xe3284c){UserNotificationEvents[_0x5eb5('0x6')](_0x1a0bb1+':'+_0x45b47b['id'],_0x45b47b);UserNotificationEvents[_0x5eb5('0x6')](_0x1a0bb1,_0x45b47b);_0xe3284c(null);};}for(var e in events){if(events[_0x5eb5('0x7')](e)){var event=events[e];UserNotification[_0x5eb5('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xcfde=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5ec09c,_0x40f6b4){var _0x2259f1=function(_0x45df9d){while(--_0x45df9d){_0x5ec09c['push'](_0x5ec09c['shift']());}};_0x2259f1(++_0x40f6b4);}(_0xcfde,0x1e1));var _0xecfd=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xcfde[_0x59c301];return _0x3866b9;};'use strict';var EventEmitter=require(_0xecfd('0x0'));var UserNotification=require(_0xecfd('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xecfd('0x2')](0x0);var events={'afterCreate':_0xecfd('0x3'),'afterUpdate':_0xecfd('0x4'),'afterDestroy':_0xecfd('0x5')};function emitEvent(_0xca25f9){return function(_0x54ff6b,_0x539b53,_0x28398f){UserNotificationEvents['emit'](_0xca25f9+':'+_0x54ff6b['id'],_0x54ff6b);UserNotificationEvents[_0xecfd('0x6')](_0xca25f9,_0x54ff6b);_0x28398f(null);};}for(var e in events){if(events[_0xecfd('0x7')](e)){var event=events[e];UserNotification[_0xecfd('0x8')](e,emitEvent(event));}}module[_0xecfd('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 e2da9d5..d94d70c 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 _0x0347=['moment','bluebird','request-promise','rimraf','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4e3e48,_0x4ebb2e){var _0x5eda66=function(_0x15e187){while(--_0x15e187){_0x4e3e48['push'](_0x4e3e48['shift']());}};_0x5eda66(++_0x4ebb2e);}(_0x0347,0x1d8));var _0x7034=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0347[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7034('0x0'));var util=require(_0x7034('0x1'));var logger=require(_0x7034('0x2'))(_0x7034('0x3'));var moment=require(_0x7034('0x4'));var BPromise=require(_0x7034('0x5'));var rp=require(_0x7034('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7034('0x7'));var config=require('../../config/environment');var attributes=require(_0x7034('0x8'));module[_0x7034('0x9')]=function(_0x59b527,_0x54039a){return _0x59b527[_0x7034('0xa')]('UserNotification',attributes,{'tableName':_0x7034('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7034('0xc'),'collate':_0x7034('0xd')});}; \ No newline at end of file +var _0xe33a=['moment','request-promise','path','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x41352a,_0x246ea2){var _0x3e392f=function(_0x11a5a6){while(--_0x11a5a6){_0x41352a['push'](_0x41352a['shift']());}};_0x3e392f(++_0x246ea2);}(_0xe33a,0x1e6));var _0xae33=function(_0x8777ef,_0x3c94e7){_0x8777ef=_0x8777ef-0x0;var _0x361643=_0xe33a[_0x8777ef];return _0x361643;};'use strict';var _=require(_0xae33('0x0'));var util=require(_0xae33('0x1'));var logger=require(_0xae33('0x2'))(_0xae33('0x3'));var moment=require(_0xae33('0x4'));var BPromise=require('bluebird');var rp=require(_0xae33('0x5'));var fs=require('fs');var path=require(_0xae33('0x6'));var rimraf=require('rimraf');var config=require(_0xae33('0x7'));var attributes=require('./userNotification.attributes');module[_0xae33('0x8')]=function(_0x31ec12,_0x4a513d){return _0x31ec12[_0xae33('0x9')](_0xae33('0xa'),attributes,{'tableName':_0xae33('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xae33('0xc'),'collate':_0xae33('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 3ecd4d2..9b65bae 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 _0x684f=['code','message','UserNotification,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x56e172,_0x59bedb){var _0xc92dd7=function(_0x4ae9ca){while(--_0x4ae9ca){_0x56e172['push'](_0x56e172['shift']());}};_0xc92dd7(++_0x59bedb);}(_0x684f,0x1e1));var _0xf684=function(_0x2aaa60,_0x4148dc){_0x2aaa60=_0x2aaa60-0x0;var _0x344bfc=_0x684f[_0x2aaa60];return _0x344bfc;};'use strict';var _=require(_0xf684('0x0'));var util=require(_0xf684('0x1'));var moment=require(_0xf684('0x2'));var BPromise=require('bluebird');var rs=require(_0xf684('0x3'));var fs=require('fs');var Redis=require(_0xf684('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf684('0x5'));var logger=require(_0xf684('0x6'))(_0xf684('0x7'));var config=require(_0xf684('0x8'));var jayson=require(_0xf684('0x9'));var client=jayson[_0xf684('0xa')][_0xf684('0xb')]({'port':0x232a});config[_0xf684('0xc')]=_[_0xf684('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf684('0xe'))(new Redis(config[_0xf684('0xc')]));require(_0xf684('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b7f75,_0x673a19,_0xf45c6f){return new BPromise(function(_0x1b86b0,_0x4e799d){return client[_0xf684('0x10')](_0x5b7f75,_0xf45c6f)[_0xf684('0x11')](function(_0x485eb9){logger[_0xf684('0x12')]('UserNotification,\x20%s,\x20%s',_0x673a19,'request\x20sent');logger['debug'](_0xf684('0x13'),_0x673a19,_0xf684('0x14'),JSON[_0xf684('0x15')](_0x485eb9));if(_0x485eb9[_0xf684('0x16')]){if(_0x485eb9[_0xf684('0x16')][_0xf684('0x17')]===0x1f4){logger[_0xf684('0x16')]('UserNotification,\x20%s,\x20%s',_0x673a19,_0x485eb9[_0xf684('0x16')][_0xf684('0x18')]);return _0x4e799d(_0x485eb9[_0xf684('0x16')][_0xf684('0x18')]);}logger[_0xf684('0x16')](_0xf684('0x19'),_0x673a19,_0x485eb9[_0xf684('0x16')][_0xf684('0x18')]);return _0x1b86b0(_0x485eb9[_0xf684('0x16')][_0xf684('0x18')]);}else{logger[_0xf684('0x12')](_0xf684('0x19'),_0x673a19,'request\x20sent');_0x1b86b0(_0x485eb9[_0xf684('0x1a')][_0xf684('0x18')]);}})[_0xf684('0x1b')](function(_0x40e221){logger[_0xf684('0x16')](_0xf684('0x19'),_0x673a19,_0x40e221);_0x4e799d(_0x40e221);});});} \ No newline at end of file +var _0x2852=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x2d3074,_0x2cdb3e){var _0x162abf=function(_0x5e396f){while(--_0x5e396f){_0x2d3074['push'](_0x2d3074['shift']());}};_0x162abf(++_0x2cdb3e);}(_0x2852,0x1a8));var _0x2285=function(_0x1334ba,_0x308492){_0x1334ba=_0x1334ba-0x0;var _0x29c319=_0x2852[_0x1334ba];return _0x29c319;};'use strict';var _=require(_0x2285('0x0'));var util=require('util');var moment=require(_0x2285('0x1'));var BPromise=require('bluebird');var rs=require(_0x2285('0x2'));var fs=require('fs');var Redis=require(_0x2285('0x3'));var db=require(_0x2285('0x4'))['db'];var utils=require(_0x2285('0x5'));var logger=require(_0x2285('0x6'))(_0x2285('0x7'));var config=require(_0x2285('0x8'));var jayson=require(_0x2285('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x2285('0xa')](config[_0x2285('0xb')],{'host':_0x2285('0xc'),'port':0x18eb});var socket=require(_0x2285('0xd'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x34c948,_0x28023b,_0x4d247f){return new BPromise(function(_0x588ca4,_0x34aa40){return client[_0x2285('0xe')](_0x34c948,_0x4d247f)[_0x2285('0xf')](function(_0x5071fe){logger[_0x2285('0x10')](_0x2285('0x11'),_0x28023b,_0x2285('0x12'));logger['debug'](_0x2285('0x13'),_0x28023b,'request\x20sent',JSON['stringify'](_0x5071fe));if(_0x5071fe[_0x2285('0x14')]){if(_0x5071fe['error'][_0x2285('0x15')]===0x1f4){logger[_0x2285('0x14')]('UserNotification,\x20%s,\x20%s',_0x28023b,_0x5071fe['error']['message']);return _0x34aa40(_0x5071fe[_0x2285('0x14')][_0x2285('0x16')]);}logger[_0x2285('0x14')](_0x2285('0x11'),_0x28023b,_0x5071fe[_0x2285('0x14')][_0x2285('0x16')]);return _0x588ca4(_0x5071fe['error'][_0x2285('0x16')]);}else{logger[_0x2285('0x10')](_0x2285('0x11'),_0x28023b,'request\x20sent');_0x588ca4(_0x5071fe[_0x2285('0x17')][_0x2285('0x16')]);}})[_0x2285('0x18')](function(_0x16031d){logger[_0x2285('0x14')](_0x2285('0x11'),_0x28023b,_0x16031d);_0x34aa40(_0x16031d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 44274a0..17c616a 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 _0xcda2=['remove','emit','register','length','userNotification:','./userNotification.events','save'];(function(_0x441dd4,_0x582db9){var _0x54ea8b=function(_0x308f42){while(--_0x308f42){_0x441dd4['push'](_0x441dd4['shift']());}};_0x54ea8b(++_0x582db9);}(_0xcda2,0x9f));var _0x2cda=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0xcda2[_0x328ac9];return _0x2b3a0a;};'use strict';var UserNotificationEvents=require(_0x2cda('0x0'));var events=[_0x2cda('0x1'),_0x2cda('0x2'),'update'];function createListener(_0x4e8dba,_0x5e7b3f){return function(_0x56af98){_0x5e7b3f[_0x2cda('0x3')](_0x4e8dba,_0x56af98);};}function removeListener(_0x2693d0,_0x5c6b3c){return function(){UserNotificationEvents['removeListener'](_0x2693d0,_0x5c6b3c);};}exports[_0x2cda('0x4')]=function(_0x20adc9){for(var _0xfc0daa=0x0,_0x445212=events[_0x2cda('0x5')];_0xfc0daa<_0x445212;_0xfc0daa++){var _0x11d999=events[_0xfc0daa];var _0x3ae1b5=createListener(_0x2cda('0x6')+_0x11d999,_0x20adc9);UserNotificationEvents['on'](_0x11d999,_0x3ae1b5);}}; \ No newline at end of file +var _0x30a7=['removeListener','register','length','userNotification:','./userNotification.events','save','remove','update'];(function(_0x3e14fc,_0x343e7f){var _0x5123d1=function(_0x42ffaa){while(--_0x42ffaa){_0x3e14fc['push'](_0x3e14fc['shift']());}};_0x5123d1(++_0x343e7f);}(_0x30a7,0x9c));var _0x730a=function(_0x594c7e,_0x5bd652){_0x594c7e=_0x594c7e-0x0;var _0x517aa3=_0x30a7[_0x594c7e];return _0x517aa3;};'use strict';var UserNotificationEvents=require(_0x730a('0x0'));var events=[_0x730a('0x1'),_0x730a('0x2'),_0x730a('0x3')];function createListener(_0x4aa334,_0x21058e){return function(_0x25d2ba){_0x21058e['emit'](_0x4aa334,_0x25d2ba);};}function removeListener(_0x39312a,_0xb6a188){return function(){UserNotificationEvents[_0x730a('0x4')](_0x39312a,_0xb6a188);};}exports[_0x730a('0x5')]=function(_0x2a2384){for(var _0x1a3f46=0x0,_0x466d44=events[_0x730a('0x6')];_0x1a3f46<_0x466d44;_0x1a3f46++){var _0x5b7df5=events[_0x1a3f46];var _0x22c69f=createListener(_0x730a('0x7')+_0x5b7df5,_0x2a2384);UserNotificationEvents['on'](_0x5b7df5,_0x22c69f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 8ee24fd..b928138 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(_0xbb9492,_0xad1af1){var _0x5e401a=function(_0x136740){while(--_0x136740){_0xbb9492['push'](_0xbb9492['shift']());}};_0x5e401a(++_0xad1af1);}(_0xedd9,0xfc));var _0x9edd=function(_0x53bdbb,_0x631e8){_0x53bdbb=_0x53bdbb-0x0;var _0x1398b1=_0xedd9[_0x53bdbb];return _0x1398b1;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 38bc941..83b10a8 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 _0xe2ac=['sequelize','exports','INTEGER'];(function(_0x39bfb6,_0x4272c8){var _0x23fef9=function(_0x5f83c1){while(--_0x5f83c1){_0x39bfb6['push'](_0x39bfb6['shift']());}};_0x23fef9(++_0x4272c8);}(_0xe2ac,0xfc));var _0xce2a=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xe2ac[_0x1ab0e6];return _0x248815;};'use strict';var Sequelize=require(_0xce2a('0x0'));module[_0xce2a('0x1')]={'penalty':{'type':Sequelize[_0xce2a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0694=['exports','sequelize'];(function(_0x5a2d06,_0x12d3c6){var _0x123789=function(_0x17e797){while(--_0x17e797){_0x5a2d06['push'](_0x5a2d06['shift']());}};_0x123789(++_0x12d3c6);}(_0x0694,0x183));var _0x4069=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x0694[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0x4069('0x0'));module[_0x4069('0x1')]={'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 1055239..a455a72 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 _0xfafb=['UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes'];(function(_0x1230e9,_0x27ce36){var _0x194a09=function(_0x4cd12f){while(--_0x4cd12f){_0x1230e9['push'](_0x1230e9['shift']());}};_0x194a09(++_0x27ce36);}(_0xfafb,0x8e));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbfaf('0x0'));var logger=require(_0xbfaf('0x1'))('api');var moment=require(_0xbfaf('0x2'));var BPromise=require(_0xbfaf('0x3'));var rp=require(_0xbfaf('0x4'));var fs=require('fs');var path=require(_0xbfaf('0x5'));var rimraf=require(_0xbfaf('0x6'));var config=require('../../config/environment');var attributes=require(_0xbfaf('0x7'));module['exports']=function(_0x413e2e,_0x402855){return _0x413e2e['define'](_0xbfaf('0x8'),attributes,{'tableName':_0xbfaf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a99=['request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','util','api','moment','bluebird'];(function(_0x3d61af,_0x32856b){var _0x39e93e=function(_0x416418){while(--_0x416418){_0x3d61af['push'](_0x3d61af['shift']());}};_0x39e93e(++_0x32856b);}(_0x9a99,0x100));var _0x99a9=function(_0xaa70c4,_0x2750f8){_0xaa70c4=_0xaa70c4-0x0;var _0x13e6a8=_0x9a99[_0xaa70c4];return _0x13e6a8;};'use strict';var _=require('lodash');var util=require(_0x99a9('0x0'));var logger=require('../../config/logger')(_0x99a9('0x1'));var moment=require(_0x99a9('0x2'));var BPromise=require(_0x99a9('0x3'));var rp=require(_0x99a9('0x4'));var fs=require('fs');var path=require(_0x99a9('0x5'));var rimraf=require('rimraf');var config=require(_0x99a9('0x6'));var attributes=require(_0x99a9('0x7'));module[_0x99a9('0x8')]=function(_0x2fd25b,_0x148143){return _0x2fd25b['define']('UserOpenchannelQueue',attributes,{'tableName':_0x99a9('0x9'),'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 96d9eba..60c2ba3 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 _0xf8ae=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x285b13,_0x448696){var _0x53b0da=function(_0x28bd70){while(--_0x28bd70){_0x285b13['push'](_0x285b13['shift']());}};_0x53b0da(++_0x448696);}(_0xf8ae,0x1df));var _0xef8a=function(_0x3cba1d,_0x2825ae){_0x3cba1d=_0x3cba1d-0x0;var _0x5f192b=_0xf8ae[_0x3cba1d];return _0x5f192b;};'use strict';var _=require(_0xef8a('0x0'));var util=require(_0xef8a('0x1'));var moment=require(_0xef8a('0x2'));var BPromise=require(_0xef8a('0x3'));var rs=require(_0xef8a('0x4'));var fs=require('fs');var Redis=require(_0xef8a('0x5'));var db=require(_0xef8a('0x6'))['db'];var utils=require(_0xef8a('0x7'));var logger=require(_0xef8a('0x8'))(_0xef8a('0x9'));var config=require('../../config/environment');var jayson=require(_0xef8a('0xa'));var client=jayson[_0xef8a('0xb')][_0xef8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ec4dc,_0x5b72a2,_0x37c90f){return new BPromise(function(_0x54a7c8,_0x32f4a7){return client[_0xef8a('0xd')](_0x2ec4dc,_0x37c90f)[_0xef8a('0xe')](function(_0x29ab8b){logger[_0xef8a('0xf')](_0xef8a('0x10'),_0x5b72a2,_0xef8a('0x11'));logger[_0xef8a('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5b72a2,_0xef8a('0x11'),JSON[_0xef8a('0x13')](_0x29ab8b));if(_0x29ab8b[_0xef8a('0x14')]){if(_0x29ab8b[_0xef8a('0x14')][_0xef8a('0x15')]===0x1f4){logger['error'](_0xef8a('0x10'),_0x5b72a2,_0x29ab8b[_0xef8a('0x14')][_0xef8a('0x16')]);return _0x32f4a7(_0x29ab8b[_0xef8a('0x14')]['message']);}logger[_0xef8a('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b72a2,_0x29ab8b[_0xef8a('0x14')][_0xef8a('0x16')]);return _0x54a7c8(_0x29ab8b['error'][_0xef8a('0x16')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b72a2,_0xef8a('0x11'));_0x54a7c8(_0x29ab8b[_0xef8a('0x17')][_0xef8a('0x16')]);}})[_0xef8a('0x18')](function(_0x11f5d1){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5b72a2,_0x11f5d1);_0x32f4a7(_0x11f5d1);});});} \ No newline at end of file +var _0xd9dd=['http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','message','info','result','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client'];(function(_0x188cb8,_0x3b12b3){var _0x25eb9b=function(_0x11770b){while(--_0x11770b){_0x188cb8['push'](_0x188cb8['shift']());}};_0x25eb9b(++_0x3b12b3);}(_0xd9dd,0x134));var _0xdd9d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9dd[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdd9d('0x0'));var BPromise=require(_0xdd9d('0x1'));var rs=require(_0xdd9d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd9d('0x3'));var logger=require('../../config/logger')(_0xdd9d('0x4'));var config=require(_0xdd9d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdd9d('0x6')][_0xdd9d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42c193,_0xf26224,_0x4a15da){return new BPromise(function(_0x4ec311,_0x3f8f10){return client['request'](_0x42c193,_0x4a15da)[_0xdd9d('0x8')](function(_0x367ff9){logger['info'](_0xdd9d('0x9'),_0xf26224,_0xdd9d('0xa'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xf26224,_0xdd9d('0xa'),JSON['stringify'](_0x367ff9));if(_0x367ff9[_0xdd9d('0xb')]){if(_0x367ff9['error']['code']===0x1f4){logger[_0xdd9d('0xb')](_0xdd9d('0x9'),_0xf26224,_0x367ff9[_0xdd9d('0xb')][_0xdd9d('0xc')]);return _0x3f8f10(_0x367ff9[_0xdd9d('0xb')]['message']);}logger[_0xdd9d('0xb')](_0xdd9d('0x9'),_0xf26224,_0x367ff9['error'][_0xdd9d('0xc')]);return _0x4ec311(_0x367ff9['error'][_0xdd9d('0xc')]);}else{logger[_0xdd9d('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xf26224,_0xdd9d('0xa'));_0x4ec311(_0x367ff9[_0xdd9d('0xe')][_0xdd9d('0xc')]);}})['catch'](function(_0x2f38ed){logger[_0xdd9d('0xb')](_0xdd9d('0x9'),_0xf26224,_0x2f38ed);_0x3f8f10(_0x2f38ed);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 9e2ace8..0ec8d9f 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 _0xa536=['/:id/sections','getSections','post','/:id/clone','addSections','addResources','update','delete','destroy','/:id/resources','removeResources','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0xcbd7ae,_0x60d37d){var _0x334d47=function(_0x29ffa8){while(--_0x29ffa8){_0xcbd7ae['push'](_0xcbd7ae['shift']());}};_0x334d47(++_0x60d37d);}(_0xa536,0x73));var _0x6a53=function(_0x45c982,_0x15739a){_0x45c982=_0x45c982-0x0;var _0x552646=_0xa536[_0x45c982];return _0x552646;};'use strict';var multer=require(_0x6a53('0x0'));var util=require(_0x6a53('0x1'));var path=require(_0x6a53('0x2'));var timeout=require(_0x6a53('0x3'));var express=require(_0x6a53('0x4'));var router=express[_0x6a53('0x5')]();var fs_extra=require(_0x6a53('0x6'));var auth=require(_0x6a53('0x7'));var interaction=require(_0x6a53('0x8'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x6a53('0x9')]('/',auth['isAuthenticated'](),controller[_0x6a53('0xa')]);router[_0x6a53('0x9')](_0x6a53('0xb'),auth[_0x6a53('0xc')](),controller[_0x6a53('0xd')]);router[_0x6a53('0x9')](_0x6a53('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6a53('0x9')](_0x6a53('0xf'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x10')]);router[_0x6a53('0x9')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router[_0x6a53('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6a53('0x11')](_0x6a53('0x12'),auth[_0x6a53('0xc')](),controller['clone']);router[_0x6a53('0x11')](_0x6a53('0xf'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x13')]);router[_0x6a53('0x11')]('/:id/resources',auth[_0x6a53('0xc')](),controller[_0x6a53('0x14')]);router['put'](_0x6a53('0xe'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x15')]);router[_0x6a53('0x16')](_0x6a53('0xe'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x17')]);router[_0x6a53('0x16')](_0x6a53('0xf'),auth[_0x6a53('0xc')](),controller['removeSections']);router[_0x6a53('0x16')](_0x6a53('0x18'),auth[_0x6a53('0xc')](),controller[_0x6a53('0x19')]);module['exports']=router; \ No newline at end of file +var _0xa648=['addSections','/:id/resources','addResources','put','update','removeSections','delete','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/sections','getSections','getResources','create','post','clone'];(function(_0xda9382,_0x42c141){var _0x5f1297=function(_0x2b6fe5){while(--_0x2b6fe5){_0xda9382['push'](_0xda9382['shift']());}};_0x5f1297(++_0x42c141);}(_0xa648,0x1e9));var _0x8a64=function(_0x294b28,_0x5ced59){_0x294b28=_0x294b28-0x0;var _0x4120e7=_0xa648[_0x294b28];return _0x4120e7;};'use strict';var multer=require(_0x8a64('0x0'));var util=require(_0x8a64('0x1'));var path=require(_0x8a64('0x2'));var timeout=require(_0x8a64('0x3'));var express=require(_0x8a64('0x4'));var router=express[_0x8a64('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8a64('0x6'));var interaction=require(_0x8a64('0x7'));var config=require(_0x8a64('0x8'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x8a64('0x9')](),controller[_0x8a64('0xa')]);router[_0x8a64('0xb')]('/describe',auth[_0x8a64('0x9')](),controller[_0x8a64('0xc')]);router[_0x8a64('0xb')](_0x8a64('0xd'),auth['isAuthenticated'](),controller[_0x8a64('0xe')]);router['get'](_0x8a64('0xf'),auth[_0x8a64('0x9')](),controller[_0x8a64('0x10')]);router[_0x8a64('0xb')]('/:id/resources',auth['isAuthenticated'](),controller[_0x8a64('0x11')]);router['post']('/',auth[_0x8a64('0x9')](),controller[_0x8a64('0x12')]);router[_0x8a64('0x13')]('/:id/clone',auth[_0x8a64('0x9')](),controller[_0x8a64('0x14')]);router[_0x8a64('0x13')]('/:id/sections',auth[_0x8a64('0x9')](),controller[_0x8a64('0x15')]);router[_0x8a64('0x13')](_0x8a64('0x16'),auth['isAuthenticated'](),controller[_0x8a64('0x17')]);router[_0x8a64('0x18')](_0x8a64('0xd'),auth[_0x8a64('0x9')](),controller[_0x8a64('0x19')]);router['delete'](_0x8a64('0xd'),auth[_0x8a64('0x9')](),controller['destroy']);router['delete'](_0x8a64('0xf'),auth[_0x8a64('0x9')](),controller[_0x8a64('0x1a')]);router[_0x8a64('0x1b')]('/:id/resources',auth[_0x8a64('0x9')](),controller[_0x8a64('0x1c')]);module[_0x8a64('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b88bfed..d950c34 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 _0x9724=['sequelize','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x4e881d,_0x129963){var _0x321e0d=function(_0x2b2340){while(--_0x2b2340){_0x4e881d['push'](_0x4e881d['shift']());}};_0x321e0d(++_0x129963);}(_0x9724,0x8c));var _0x4972=function(_0xa32065,_0x482469){_0xa32065=_0xa32065-0x0;var _0x182cde=_0x9724[_0xa32065];return _0x182cde;};'use strict';var Sequelize=require(_0x4972('0x0'));module[_0x4972('0x1')]={'name':{'type':Sequelize[_0x4972('0x2')],'allowNull':![],'unique':_0x4972('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x254f04){this[_0x4972('0x4')](_0x4972('0x5'),_0x254f04?_0x254f04[_0x4972('0x6')](''):[]);},'get':function(){return this[_0x4972('0x7')]('crudPermissions')?this[_0x4972('0x7')](_0x4972('0x5'))[_0x4972('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4972('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x4972('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7113=['name','join','getDataValue','crudPermissions','BOOLEAN','sequelize','exports','STRING'];(function(_0x1868ed,_0x9afeea){var _0xfbaa9d=function(_0x12a64b){while(--_0x12a64b){_0x1868ed['push'](_0x1868ed['shift']());}};_0xfbaa9d(++_0x9afeea);}(_0x7113,0xad));var _0x3711=function(_0x1ef23d,_0x18607f){_0x1ef23d=_0x1ef23d-0x0;var _0x4632f0=_0x7113[_0x1ef23d];return _0x4632f0;};'use strict';var Sequelize=require(_0x3711('0x0'));module[_0x3711('0x1')]={'name':{'type':Sequelize[_0x3711('0x2')],'allowNull':![],'unique':_0x3711('0x3')},'crudPermissions':{'type':Sequelize[_0x3711('0x2')],'set':function(_0x69f412){this['setDataValue']('crudPermissions',_0x69f412?_0x69f412[_0x3711('0x4')](''):[]);},'get':function(){return this[_0x3711('0x5')]('crudPermissions')?this[_0x3711('0x5')](_0x3711('0x6'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x3711('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x3711('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x3711('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x3711('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x3711('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x3711('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3711('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c3d5b36..a77fc84 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 _0x92c4=['sendStatus','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','merge','options','where','includeAll','include','findAll','params','find','catch','create','body','length','get','omit','createdAt','crudPermissions','updatedAt','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','describe','addSections','sequelize','transaction','push','removeSections','ids','getSections','includes','isEmpty','subsections','concat','enabled','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','redis','defaults','./userProfile.socket','status','json','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end'];(function(_0x59836c,_0x468f70){var _0x3b38a6=function(_0x3f7538){while(--_0x3f7538){_0x59836c['push'](_0x59836c['shift']());}};_0x3b38a6(++_0x468f70);}(_0x92c4,0x1a8));var _0x492c=function(_0x1c2311,_0x11d54f){_0x1c2311=_0x1c2311-0x0;var _0x3fd970=_0x92c4[_0x1c2311];return _0x3fd970;};'use strict';var emlformat=require(_0x492c('0x0'));var rimraf=require(_0x492c('0x1'));var zipdir=require(_0x492c('0x2'));var jsonpatch=require(_0x492c('0x3'));var rp=require(_0x492c('0x4'));var moment=require(_0x492c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x492c('0x6'));var util=require(_0x492c('0x7'));var path=require(_0x492c('0x8'));var sox=require(_0x492c('0x9'));var csv=require(_0x492c('0xa'));var ejs=require(_0x492c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x492c('0xc'));var squel=require(_0x492c('0xd'));var crypto=require(_0x492c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x492c('0xf'));var toCsv=require(_0x492c('0xa'));var querystring=require(_0x492c('0x10'));var Papa=require(_0x492c('0x11'));var Redis=require(_0x492c('0x12'));var authService=require(_0x492c('0x13'));var qs=require(_0x492c('0x14'));var as=require(_0x492c('0x15'));var hardwareService=require(_0x492c('0x16'));var logger=require(_0x492c('0x17'))(_0x492c('0x18'));var utils=require(_0x492c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x492c('0x1a'));var db=require(_0x492c('0x1b'))['db'];config[_0x492c('0x1c')]=_[_0x492c('0x1d')](config[_0x492c('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x492c('0x1e'))['register'](socket);function respondWithStatusCode(_0x216666,_0x4bf1a9){_0x4bf1a9=_0x4bf1a9||0xcc;return function(_0x324715){if(_0x324715){return _0x216666['sendStatus'](_0x4bf1a9);}return _0x216666[_0x492c('0x1f')](_0x4bf1a9)['end']();};}function respondWithResult(_0x167237,_0x49831e){_0x49831e=_0x49831e||0xc8;return function(_0x127649){if(_0x127649){return _0x167237['status'](_0x49831e)[_0x492c('0x20')](_0x127649);}};}function respondWithFilteredResult(_0x39f7ff,_0x1ddc01){return function(_0x44b3d4){if(_0x44b3d4){var _0x28c9f0=typeof _0x1ddc01['offset']==='undefined'&&typeof _0x1ddc01[_0x492c('0x21')]==='undefined';var _0x5e0685=_0x44b3d4[_0x492c('0x22')];var _0x4f2fdb=_0x28c9f0?0x0:_0x1ddc01[_0x492c('0x23')];var _0x26948f=_0x28c9f0?_0x44b3d4[_0x492c('0x22')]:_0x1ddc01['offset']+_0x1ddc01[_0x492c('0x21')];var _0x1ed7ac;if(_0x26948f>=_0x5e0685){_0x26948f=_0x5e0685;_0x1ed7ac=0xc8;}else{_0x1ed7ac=0xce;}_0x39f7ff[_0x492c('0x1f')](_0x1ed7ac);return _0x39f7ff[_0x492c('0x24')](_0x492c('0x25'),_0x4f2fdb+'-'+_0x26948f+'/'+_0x5e0685)['json'](_0x44b3d4);}return null;};}function patchUpdates(_0x1544be){return function(_0x2ee6b9){try{jsonpatch[_0x492c('0x26')](_0x2ee6b9,_0x1544be,!![]);}catch(_0x3c53e8){return BPromise[_0x492c('0x27')](_0x3c53e8);}return _0x2ee6b9[_0x492c('0x28')]();};}function saveUpdates(_0x204ec1,_0x3c3684){return function(_0x367175){if(_0x367175){return _0x367175['update'](_0x204ec1)[_0x492c('0x29')](function(_0x243327){return _0x243327;});}return null;};}function removeEntity(_0x2cbfee,_0x470e94){return function(_0x1cfa47){if(_0x1cfa47){return _0x1cfa47[_0x492c('0x2a')]()[_0x492c('0x29')](function(){_0x2cbfee['status'](0xcc)[_0x492c('0x2b')]();});}};}function handleEntityNotFound(_0x3439dd,_0x3de196){return function(_0x8b49f9){if(!_0x8b49f9){_0x3439dd[_0x492c('0x2c')](0x194);}return _0x8b49f9;};}function handleError(_0x235c7a,_0x35d4b2){_0x35d4b2=_0x35d4b2||0x1f4;return function(_0x47831a){logger[_0x492c('0x2d')](_0x47831a[_0x492c('0x2e')]);if(_0x47831a['name']){delete _0x47831a[_0x492c('0x2f')];}_0x235c7a[_0x492c('0x1f')](_0x35d4b2)['send'](_0x47831a);};}exports[_0x492c('0x30')]=function(_0x2da009,_0x1ffcca){var _0x592a46={},_0x48a1c5={},_0x2c8cc4={'count':0x0,'rows':[]};var _0x3e70d4=_[_0x492c('0x31')](db[_0x492c('0x32')][_0x492c('0x33')],function(_0x3a1048){return{'name':_0x3a1048[_0x492c('0x34')],'type':_0x3a1048[_0x492c('0x35')][_0x492c('0x36')]};});_0x48a1c5['model']=_[_0x492c('0x31')](_0x3e70d4,_0x492c('0x2f'));_0x48a1c5[_0x492c('0x37')]=_[_0x492c('0x38')](_0x2da009[_0x492c('0x37')]);_0x48a1c5[_0x492c('0x39')]=_[_0x492c('0x3a')](_0x48a1c5['model'],_0x48a1c5['query']);_0x592a46[_0x492c('0x3b')]=_[_0x492c('0x3a')](_0x48a1c5[_0x492c('0x3c')],qs['fields'](_0x2da009[_0x492c('0x37')][_0x492c('0x3d')]));_0x592a46['attributes']=_0x592a46[_0x492c('0x3b')]['length']?_0x592a46[_0x492c('0x3b')]:_0x48a1c5[_0x492c('0x3c')];if(!_0x2da009[_0x492c('0x37')][_0x492c('0x3e')](_0x492c('0x3f'))){_0x592a46[_0x492c('0x21')]=qs[_0x492c('0x21')](_0x2da009[_0x492c('0x37')][_0x492c('0x21')]);_0x592a46[_0x492c('0x23')]=qs[_0x492c('0x23')](_0x2da009[_0x492c('0x37')]['offset']);}_0x592a46[_0x492c('0x40')]=qs[_0x492c('0x41')](_0x2da009[_0x492c('0x37')]['sort']);_0x592a46['where']=qs['filters'](_['pick'](_0x2da009[_0x492c('0x37')],_0x48a1c5[_0x492c('0x39')]),_0x3e70d4);if(_0x2da009[_0x492c('0x37')][_0x492c('0x42')]){_0x592a46['where']=_['merge'](_0x592a46['where'],{'$or':_[_0x492c('0x31')](_0x3e70d4,function(_0x58bec7){if(_0x58bec7[_0x492c('0x35')]!==_0x492c('0x43')){var _0x5a626a={};_0x5a626a[_0x58bec7[_0x492c('0x2f')]]={'$like':'%'+_0x2da009[_0x492c('0x37')][_0x492c('0x42')]+'%'};return _0x5a626a;}})});}_0x592a46=_[_0x492c('0x44')]({},_0x592a46,_0x2da009[_0x492c('0x45')]);var _0x5886f5={'where':_0x592a46[_0x492c('0x46')]};return db[_0x492c('0x32')][_0x492c('0x22')](_0x5886f5)[_0x492c('0x29')](function(_0x3f02d0){_0x2c8cc4['count']=_0x3f02d0;if(_0x2da009[_0x492c('0x37')][_0x492c('0x47')]){_0x592a46[_0x492c('0x48')]=[{'all':!![]}];}return db[_0x492c('0x32')][_0x492c('0x49')](_0x592a46);})[_0x492c('0x29')](function(_0x34d330){_0x2c8cc4['rows']=_0x34d330;return _0x2c8cc4;})[_0x492c('0x29')](respondWithFilteredResult(_0x1ffcca,_0x592a46))['catch'](handleError(_0x1ffcca,null));};exports['show']=function(_0x1ab4e9,_0x466d7c){var _0x499cac={'raw':![],'where':{'id':_0x1ab4e9[_0x492c('0x4a')]['id']}},_0x11c442={};_0x11c442[_0x492c('0x3c')]=_[_0x492c('0x38')](db[_0x492c('0x32')][_0x492c('0x33')]);_0x11c442['query']=_[_0x492c('0x38')](_0x1ab4e9[_0x492c('0x37')]);_0x11c442[_0x492c('0x39')]=_['intersection'](_0x11c442[_0x492c('0x3c')],_0x11c442['query']);_0x499cac[_0x492c('0x3b')]=_[_0x492c('0x3a')](_0x11c442[_0x492c('0x3c')],qs[_0x492c('0x3d')](_0x1ab4e9['query'][_0x492c('0x3d')]));_0x499cac[_0x492c('0x3b')]=_0x499cac[_0x492c('0x3b')]['length']?_0x499cac[_0x492c('0x3b')]:_0x11c442[_0x492c('0x3c')];if(_0x1ab4e9[_0x492c('0x37')]['includeAll']){_0x499cac[_0x492c('0x48')]=[{'all':!![]}];}_0x499cac=_[_0x492c('0x44')]({},_0x499cac,_0x1ab4e9['options']);return db[_0x492c('0x32')][_0x492c('0x4b')](_0x499cac)[_0x492c('0x29')](handleEntityNotFound(_0x466d7c,null))[_0x492c('0x29')](respondWithResult(_0x466d7c,null))[_0x492c('0x4c')](handleError(_0x466d7c,null));};exports[_0x492c('0x4d')]=function(_0x2a452c,_0x1c4821){return db[_0x492c('0x32')][_0x492c('0x4d')](_0x2a452c[_0x492c('0x4e')],{})[_0x492c('0x29')](respondWithResult(_0x1c4821,0xc9))[_0x492c('0x4c')](handleError(_0x1c4821,null));};exports['clone']=function(_0x2597a5,_0x17fc97){var _0x34037f={'where':{'id':_0x2597a5[_0x492c('0x4a')]['id']}},_0x2dacc5={};_0x2dacc5[_0x492c('0x3c')]=_['keys'](db['UserProfile'][_0x492c('0x33')]);_0x34037f[_0x492c('0x3b')]=_[_0x492c('0x3a')](_0x2dacc5[_0x492c('0x3c')],qs['fields'](_0x2597a5[_0x492c('0x37')][_0x492c('0x3d')]));_0x34037f[_0x492c('0x3b')]=_0x34037f[_0x492c('0x3b')][_0x492c('0x4f')]?_0x34037f[_0x492c('0x3b')]:_0x2dacc5[_0x492c('0x3c')];if(_0x2597a5['query'][_0x492c('0x47')]){_0x34037f['include']=[{'all':!![]}];}_0x34037f=_[_0x492c('0x44')]({},_0x34037f,_0x2597a5[_0x492c('0x45')]);return db[_0x492c('0x32')][_0x492c('0x4b')](_0x34037f)[_0x492c('0x29')](handleEntityNotFound(_0x17fc97,null))[_0x492c('0x29')](function(_0x113af4){if(_0x113af4){var _0x40be05=_0x113af4[_0x492c('0x50')]({'plain':!![]});_0x40be05=qs[_0x492c('0x51')](_0x40be05,['id',_0x492c('0x52'),'updatedAt',_0x492c('0x53')]);_0x2597a5[_0x492c('0x4e')]=_[_0x492c('0x51')](_0x2597a5[_0x492c('0x4e')],['id','createdAt',_0x492c('0x54')]);return db['sequelize']['transaction'](function(_0x30e800){return db[_0x492c('0x32')][_0x492c('0x4d')](_[_0x492c('0x44')](_0x40be05,_0x2597a5[_0x492c('0x4e')]),{'include':_0x2597a5[_0x492c('0x37')][_0x492c('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x30e800})[_0x492c('0x29')](function(_0x5613ff){var _0x4edcd0=_0x5613ff['get']({'plain':!![]});return db[_0x492c('0x55')][_0x492c('0x49')]({'where':{'userProfileId':_0x2597a5[_0x492c('0x4a')]['id']},'raw':!![]})['then'](function(_0xb3f35f){if(_0xb3f35f){return BPromise[_0x492c('0x56')](_0xb3f35f,function(_0x4e0153){return new BPromise(function(_0xca67a4,_0x138e9a){if(_0x4e0153['autoAssociation']===null||_0x4e0153[_0x492c('0x57')]===0x1)_0xca67a4(null);return db['UserProfileResource'][_0x492c('0x49')]({'where':{'sectionId':_0x4e0153['id']},'raw':!![]})[_0x492c('0x29')](function(_0x2e85e7){var _0x7715b4=_[_0x492c('0x31')](_0x2e85e7,function(_0x2079c){return qs[_0x492c('0x51')](_0x2079c,['id',_0x492c('0x52'),_0x492c('0x54'),_0x492c('0x58')]);});_0xca67a4(_0x7715b4);})[_0x492c('0x4c')](function(_0x1a9b2d){_0x138e9a(_0x1a9b2d);});})[_0x492c('0x29')](function(_0x4bf52e){var _0x27a4c4=qs[_0x492c('0x51')](_0x4e0153,['id',_0x492c('0x52'),'updatedAt']);_0x27a4c4[_0x492c('0x59')]=_0x4edcd0['id'];if(_0x4bf52e)_0x27a4c4[_0x492c('0x5a')]=_0x4bf52e;return _0x27a4c4;})[_0x492c('0x29')](function(_0x292fd8){return db[_0x492c('0x55')][_0x492c('0x4d')](_0x292fd8,{'include':[{'model':db[_0x492c('0x5b')],'as':_0x492c('0x5a')}],'raw':!![],'transaction':_0x30e800});});})[_0x492c('0x29')](function(){return _0x4edcd0;});}});});});}})['then'](respondWithResult(_0x17fc97,0xc9))[_0x492c('0x4c')](handleError(_0x17fc97,null));};exports[_0x492c('0x5c')]=function(_0x517eb9,_0xd312ac){if(_0x517eb9[_0x492c('0x4e')]['id']){delete _0x517eb9['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x517eb9['params']['id']}})[_0x492c('0x29')](handleEntityNotFound(_0xd312ac,null))[_0x492c('0x29')](saveUpdates(_0x517eb9[_0x492c('0x4e')],null))[_0x492c('0x29')](respondWithResult(_0xd312ac,null))[_0x492c('0x4c')](handleError(_0xd312ac,null));};exports[_0x492c('0x2a')]=function(_0x2d617a,_0x123936){return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x2d617a[_0x492c('0x4a')]['id']}})[_0x492c('0x29')](handleEntityNotFound(_0x123936,null))[_0x492c('0x29')](removeEntity(_0x123936,null))['catch'](handleError(_0x123936,null));};exports[_0x492c('0x5d')]=function(_0x2aa20d,_0x4f00e8){return db[_0x492c('0x32')]['describe']()['then'](respondWithResult(_0x4f00e8,null))[_0x492c('0x4c')](handleError(_0x4f00e8,null));};exports[_0x492c('0x5e')]=function(_0x2f531f,_0x512b1b){var _0xd7ae1c=_0x2f531f[_0x492c('0x4e')];return db['UserProfile'][_0x492c('0x4b')]({'where':{'id':_0x2f531f['params']['id']}})['then'](handleEntityNotFound(_0x512b1b,null))[_0x492c('0x29')](function(_0x349a4a){if(_0x349a4a){return db[_0x492c('0x5f')][_0x492c('0x60')](function(_0xc638d2){return db[_0x492c('0x55')][_0x492c('0x2a')]({'where':{'userProfileId':_0x2f531f['params']['id'],'sectionId':_[_0x492c('0x31')](_0xd7ae1c,function(_0x1f5cf1){return _0x1f5cf1[_0x492c('0x58')];})},'transaction':_0xc638d2})['then'](function(){var _0x434274=_[_0x492c('0x31')](_0xd7ae1c,function(_0x407101){_0x407101['userProfileId']=_0x2f531f[_0x492c('0x4a')]['id'];return _0x407101;});var _0x1ba869=[];return BPromise[_0x492c('0x56')](_0x434274,function(_0x5a51a1){return db[_0x492c('0x55')][_0x492c('0x4d')](_0x5a51a1,{'include':[{'model':db[_0x492c('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0xc638d2})[_0x492c('0x29')](function(_0x3c809d){_0x1ba869[_0x492c('0x61')](_0x3c809d[_0x492c('0x50')]({'plain':!![]}));});})[_0x492c('0x29')](function(){return _0x1ba869;});});});}})[_0x492c('0x29')](function(_0x41dfbc){return _0x41dfbc;})[_0x492c('0x29')](respondWithResult(_0x512b1b,null))['catch'](handleError(_0x512b1b,null));};exports[_0x492c('0x62')]=function(_0x435343,_0x28be0b){var _0x4747f6;return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x435343[_0x492c('0x4a')]['id']},'attributes':['id',_0x492c('0x2f')]})[_0x492c('0x29')](handleEntityNotFound(_0x28be0b,null))['then'](function(_0x511044){if(_0x511044){_0x4747f6=_0x511044;return db['UserProfileSection'][_0x492c('0x2a')]({'where':{'userProfileId':_0x435343[_0x492c('0x4a')]['id'],'sectionId':_0x435343[_0x492c('0x37')][_0x492c('0x63')]}});}})[_0x492c('0x29')](function(){return _0x4747f6;})[_0x492c('0x29')](respondWithStatusCode(_0x28be0b,null))['catch'](handleError(_0x28be0b,null));};exports[_0x492c('0x64')]=function(_0x409367,_0x590e76){var _0x5154b7=[];var _0x4d7587=[];return db['UserProfileSection'][_0x492c('0x49')]({'where':{'userProfileId':_0x409367[_0x492c('0x4a')]['id']},'raw':!![]})['then'](function(_0x578e78){_0x5154b7=_['filter'](_0x578e78,function(_0x3e0a4e){return _0x3e0a4e['enabled']===0x1||_[_0x492c('0x65')]([0x3eb,0x709],_0x3e0a4e[_0x492c('0x58')]);});if(!_[_0x492c('0x66')](_0x5154b7)){return _['map'](_0x5154b7,function(_0x73ee04){return _0x73ee04[_0x492c('0x58')];});}else{return;}})[_0x492c('0x29')](function(_0x65c1ba){if(_0x65c1ba)_0x4d7587=_0x65c1ba;if(_[_0x492c('0x65')](_0x4d7587,0x64)){var _0x1b1d77=_[_0x492c('0x4b')](_0x5154b7,{'sectionId':0x64});return hasDefaultDashboard(_0x1b1d77)[_0x492c('0x29')](function(_0x422869){return _[_0x492c('0x31')](_0x5154b7,function(_0x2af46f){if(_0x2af46f[_0x492c('0x58')]===0x64){_0x2af46f[_0x492c('0x67')]=_0x422869;}return _0x2af46f;});});}else{return;}})[_0x492c('0x29')](function(_0x1d5824){if(_0x1d5824)_0x5154b7=_0x1d5824;if(_[_0x492c('0x65')](_0x4d7587,0x3eb)){var _0x5a7bd5=_['find'](_0x5154b7,{'sectionId':0x3eb});return getCustomDashboards(_0x5a7bd5)['then'](function(_0x1aa2c3){return _['map'](_0x5154b7,function(_0x330716){if(_0x5a7bd5['enabled']){if(_0x330716[_0x492c('0x58')]===0x3eb){_0x330716[_0x492c('0x67')]=_0x1aa2c3;}}else{if(_0x330716[_0x492c('0x58')]===0x64){if(!_0x330716[_0x492c('0x67')]){_0x330716[_0x492c('0x67')]=[];}_0x330716[_0x492c('0x67')]=_0x330716['subsections'][_0x492c('0x68')](_0x1aa2c3);}}return _0x330716;});});}else{return;}})[_0x492c('0x29')](function(_0x45e7f4){if(_0x45e7f4)_0x5154b7=_0x45e7f4;if(_[_0x492c('0x65')](_0x4d7587,0x709)){var _0x2eab6f=_[_0x492c('0x4b')](_0x5154b7,{'sectionId':0x709});return getPlugins(_0x2eab6f)['then'](function(_0x25c49d){if(_0x2eab6f[_0x492c('0x69')]){return _[_0x492c('0x31')](_0x5154b7,function(_0x41ddda){if(_0x41ddda[_0x492c('0x58')]===0x709){_0x41ddda['subsections']=_0x25c49d;}return _0x41ddda;});}else{var _0x3335c4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x25c49d};var _0x25160f=_[_0x492c('0x31')](_0x5154b7);_0x25160f[_0x492c('0x61')](_0x3335c4);return _0x25160f;}});}else{return;}})[_0x492c('0x29')](function(_0x49e29c){if(_0x49e29c)_0x5154b7=_0x49e29c;return _[_0x492c('0x42')](_0x5154b7,['enabled',0x1]);})[_0x492c('0x29')](respondWithResult(_0x590e76,null))[_0x492c('0x4c')](handleError(_0x590e76,null));};function hasDefaultDashboard(_0x41552c){var _0xa323fe=[0x65];return new BPromise(function(_0x111d37,_0x5bdd67){try{if(_0x41552c[_0x492c('0x57')]){_0x111d37(_0xa323fe);}else{return db[_0x492c('0x5b')][_0x492c('0x6a')]({'where':{'sectionId':_0x41552c['id']},'raw':!![]})[_0x492c('0x29')](function(_0xfbf661){_0xfbf661?_0x111d37(_0xa323fe):_0x111d37();});}}catch(_0x233aac){_0x5bdd67(_0x233aac);}});}function getCustomDashboards(_0x47270b){var _0x27218e=[];return new BPromise(function(_0x4e9cb1,_0x1abf61){try{if(_0x47270b[_0x492c('0x57')]){return db[_0x492c('0x6b')][_0x492c('0x49')]({'raw':!![]})[_0x492c('0x29')](function(_0x4b2018){_0x4b2018[_0x492c('0x6c')](function(_0x3b7f1d){_0x27218e[_0x492c('0x61')](_0x3b7f1d['id']+0x1869f);});_0x4e9cb1(_0x27218e);});}else{return db[_0x492c('0x5b')][_0x492c('0x49')]({'where':{'sectionId':_0x47270b['id']},'raw':!![]})['then'](function(_0x45d30a){_0x45d30a['forEach'](function(_0xbd23e7){_0x27218e[_0x492c('0x61')](_0xbd23e7['resourceId']+0x1869f);});_0x4e9cb1(_0x27218e);});}}catch(_0x4f4f76){_0x1abf61(_0x4f4f76);}});}function getPlugins(_0x101ac1){var _0x37ffd0=[];return new BPromise(function(_0x41f093,_0x3f1219){try{if(_0x101ac1[_0x492c('0x57')]){return db['Plugin'][_0x492c('0x49')]({'raw':!![]})[_0x492c('0x29')](function(_0x410f2b){_0x410f2b[_0x492c('0x6c')](function(_0x46d12d){_0x37ffd0[_0x492c('0x61')](_0x46d12d['id']+0x15b38);});_0x41f093(_0x37ffd0);});}else{return db[_0x492c('0x5b')][_0x492c('0x49')]({'where':{'sectionId':_0x101ac1['id']},'raw':!![]})[_0x492c('0x29')](function(_0x2f175c){_0x2f175c[_0x492c('0x6c')](function(_0x59d93c){_0x37ffd0[_0x492c('0x61')](_0x59d93c[_0x492c('0x6d')]+0x15b38);});_0x41f093(_0x37ffd0);});}}catch(_0x18e7bc){_0x3f1219(_0x18e7bc);}});}exports[_0x492c('0x6e')]=function(_0x1326b2,_0x27cb9f){return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x1326b2[_0x492c('0x4a')]['id']}})[_0x492c('0x29')](handleEntityNotFound(_0x27cb9f,null))[_0x492c('0x29')](function(_0x3eab0a){if(_0x3eab0a){return db[_0x492c('0x5f')][_0x492c('0x60')](function(_0x100bf3){return db['UserProfileSection'][_0x492c('0x49')]({'where':{'userProfileId':_0x1326b2['params']['id']},'attributes':['id'],'raw':!![]})[_0x492c('0x29')](function(_0x4b2020){if(_0x4b2020){return db[_0x492c('0x55')][_0x492c('0x2a')]({'where':{'userProfileId':_0x1326b2[_0x492c('0x4a')]['id'],'id':_['map'](_0x4b2020,function(_0x43ef73){return _0x43ef73['id'];})},'transaction':_0x100bf3});}})[_0x492c('0x29')](function(_0x255773){var _0x1b0820=_[_0x492c('0x31')](_0x1326b2[_0x492c('0x4e')],function(_0x4e905f){_0x4e905f[_0x492c('0x59')]=_0x1326b2['params']['id'];return _0x4e905f;});return db[_0x492c('0x55')][_0x492c('0x6f')](_0x1b0820,{'raw':!![],'transaction':_0x100bf3});})[_0x492c('0x29')](function(_0x3a5e61){var _0x4858e4=_[_0x492c('0x42')](_['map'](_0x3a5e61,function(_0x27108a){return _0x27108a['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4858e4){return db[_0x492c('0x55')][_0x492c('0x49')]({'where':{'userProfileId':_0x1326b2[_0x492c('0x4a')]['id'],'sectionId':_[_0x492c('0x31')](_0x4858e4,function(_0x109a73){return _0x109a73[_0x492c('0x58')];})},'attributes':['id',_0x492c('0x58')],'raw':!![]})[_0x492c('0x29')](function(_0x1a6072){var _0x4dd159=_['map'](_0x1326b2['body'],function(_0x55d326){_0x55d326[_0x492c('0x59')]=_0x1326b2[_0x492c('0x4a')]['id'];return _0x55d326;});return db[_0x492c('0x5b')][_0x492c('0x6f')](_0x4dd159,{'raw':!![],'transaction':_0x100bf3});});}})[_0x492c('0x4c')](handleError(_0x27cb9f,null));});}})[_0x492c('0x29')](function(_0x19dd1c){var _0x27c8f3=_[_0x492c('0x31')](_0x19dd1c,function(_0x2346aa){return _0x2346aa[_0x492c('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x27cb9f,null))[_0x492c('0x4c')](handleError(_0x27cb9f,null));};exports[_0x492c('0x70')]=function(_0x3d909b,_0x444f5e,_0x5d250c){return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x3d909b[_0x492c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x444f5e,null))[_0x492c('0x29')](function(_0x4233bd){if(_0x4233bd){return _0x4233bd[_0x492c('0x70')](_0x3d909b[_0x492c('0x37')][_0x492c('0x63')]);}})[_0x492c('0x29')](respondWithStatusCode(_0x444f5e,null))[_0x492c('0x4c')](handleError(_0x444f5e,null));};exports[_0x492c('0x71')]=function(_0x3f382d,_0x2e02ca){var _0x478c6d={};if(!_0x3f382d[_0x492c('0x37')][_0x492c('0x72')])throw new Error(_0x492c('0x73'));if(!_0x3f382d[_0x492c('0x37')][_0x492c('0x3e')](_0x492c('0x3f'))){_0x478c6d['limit']=qs['limit'](_0x3f382d[_0x492c('0x37')][_0x492c('0x21')]);_0x478c6d[_0x492c('0x23')]=qs[_0x492c('0x23')](_0x3f382d['query']['offset']);}return db[_0x492c('0x32')][_0x492c('0x4b')]({'where':{'id':_0x3f382d[_0x492c('0x4a')]['id']}})[_0x492c('0x29')](function(_0x178e26){if(!_0x178e26)throw new Error(_0x492c('0x74')+_0x3f382d[_0x492c('0x4a')]['id']);return db[_0x492c('0x32')]['getResources'](_0x3f382d);})[_0x492c('0x29')](respondWithFilteredResult(_0x2e02ca,_0x478c6d))[_0x492c('0x4c')](handleError(_0x2e02ca,null));}; \ No newline at end of file +var _0x57c9=['map','sectionId','userProfileId','Resources','update','describe','push','removeSections','ids','enabled','includes','isEmpty','subsections','findOne','forEach','bulkCreate','get','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','request-promise','moment','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/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','sendStatus','status','json','undefined','limit','count','offset','Content-Range','save','destroy','then','end','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','catch','show','include','options','create','body','clone','params','find','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','findAll','autoAssociation','UserProfileResource'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x57c9,0xee));var _0x957c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x57c9[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x957c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x957c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x957c('0x2'));var moment=require(_0x957c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x957c('0x4'));var sox=require(_0x957c('0x5'));var csv=require(_0x957c('0x6'));var ejs=require(_0x957c('0x7'));var fs=require('fs');var fs_extra=require(_0x957c('0x8'));var _=require(_0x957c('0x9'));var squel=require(_0x957c('0xa'));var crypto=require(_0x957c('0xb'));var jsforce=require(_0x957c('0xc'));var deskjs=require(_0x957c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x957c('0xe'));var Redis=require(_0x957c('0xf'));var authService=require(_0x957c('0x10'));var qs=require(_0x957c('0x11'));var as=require(_0x957c('0x12'));var hardwareService=require(_0x957c('0x13'));var logger=require(_0x957c('0x14'))(_0x957c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x957c('0x16'));var db=require(_0x957c('0x17'))['db'];config['redis']=_[_0x957c('0x18')](config['redis'],{'host':_0x957c('0x19'),'port':0x18eb});var socket=require(_0x957c('0x1a'))(new Redis(config[_0x957c('0x1b')]));require(_0x957c('0x1c'))['register'](socket);function respondWithStatusCode(_0x3d5c48,_0x1db8a0){_0x1db8a0=_0x1db8a0||0xcc;return function(_0x58af98){if(_0x58af98){return _0x3d5c48[_0x957c('0x1d')](_0x1db8a0);}return _0x3d5c48['status'](_0x1db8a0)['end']();};}function respondWithResult(_0xd3b75c,_0x53975f){_0x53975f=_0x53975f||0xc8;return function(_0x4259ff){if(_0x4259ff){return _0xd3b75c[_0x957c('0x1e')](_0x53975f)[_0x957c('0x1f')](_0x4259ff);}};}function respondWithFilteredResult(_0x1a07a3,_0x58aef1){return function(_0x1f89db){if(_0x1f89db){var _0x530090=typeof _0x58aef1['offset']===_0x957c('0x20')&&typeof _0x58aef1[_0x957c('0x21')]===_0x957c('0x20');var _0xd66a59=_0x1f89db[_0x957c('0x22')];var _0x2d8a26=_0x530090?0x0:_0x58aef1[_0x957c('0x23')];var _0x23fd18=_0x530090?_0x1f89db[_0x957c('0x22')]:_0x58aef1['offset']+_0x58aef1[_0x957c('0x21')];var _0x36bbfe;if(_0x23fd18>=_0xd66a59){_0x23fd18=_0xd66a59;_0x36bbfe=0xc8;}else{_0x36bbfe=0xce;}_0x1a07a3['status'](_0x36bbfe);return _0x1a07a3['set'](_0x957c('0x24'),_0x2d8a26+'-'+_0x23fd18+'/'+_0xd66a59)[_0x957c('0x1f')](_0x1f89db);}return null;};}function patchUpdates(_0x5dfd34){return function(_0x331222){try{jsonpatch['apply'](_0x331222,_0x5dfd34,!![]);}catch(_0x44a22f){return BPromise['reject'](_0x44a22f);}return _0x331222[_0x957c('0x25')]();};}function saveUpdates(_0x331e78,_0xb098a3){return function(_0x1ffdff){if(_0x1ffdff){return _0x1ffdff['update'](_0x331e78)['then'](function(_0x20ec0f){return _0x20ec0f;});}return null;};}function removeEntity(_0x8eea27,_0x11eb6d){return function(_0x3e3147){if(_0x3e3147){return _0x3e3147[_0x957c('0x26')]()[_0x957c('0x27')](function(){_0x8eea27[_0x957c('0x1e')](0xcc)[_0x957c('0x28')]();});}};}function handleEntityNotFound(_0x524636,_0x58c5ba){return function(_0x1fe1e0){if(!_0x1fe1e0){_0x524636[_0x957c('0x1d')](0x194);}return _0x1fe1e0;};}function handleError(_0x25cf82,_0xbdc736){_0xbdc736=_0xbdc736||0x1f4;return function(_0x4decbc){logger['error'](_0x4decbc[_0x957c('0x29')]);if(_0x4decbc[_0x957c('0x2a')]){delete _0x4decbc[_0x957c('0x2a')];}_0x25cf82[_0x957c('0x1e')](_0xbdc736)[_0x957c('0x2b')](_0x4decbc);};}exports[_0x957c('0x2c')]=function(_0x472cd4,_0x21f61c){var _0x545fa6={},_0x52d143={},_0x3af6e3={'count':0x0,'rows':[]};var _0x3de031=_['map'](db[_0x957c('0x2d')][_0x957c('0x2e')],function(_0x5425fa){return{'name':_0x5425fa[_0x957c('0x2f')],'type':_0x5425fa[_0x957c('0x30')]['key']};});_0x52d143[_0x957c('0x31')]=_['map'](_0x3de031,_0x957c('0x2a'));_0x52d143['query']=_[_0x957c('0x32')](_0x472cd4['query']);_0x52d143[_0x957c('0x33')]=_[_0x957c('0x34')](_0x52d143[_0x957c('0x31')],_0x52d143[_0x957c('0x35')]);_0x545fa6[_0x957c('0x36')]=_[_0x957c('0x34')](_0x52d143[_0x957c('0x31')],qs[_0x957c('0x37')](_0x472cd4[_0x957c('0x35')][_0x957c('0x37')]));_0x545fa6[_0x957c('0x36')]=_0x545fa6[_0x957c('0x36')][_0x957c('0x38')]?_0x545fa6['attributes']:_0x52d143[_0x957c('0x31')];if(!_0x472cd4[_0x957c('0x35')][_0x957c('0x39')](_0x957c('0x3a'))){_0x545fa6['limit']=qs['limit'](_0x472cd4[_0x957c('0x35')][_0x957c('0x21')]);_0x545fa6[_0x957c('0x23')]=qs[_0x957c('0x23')](_0x472cd4[_0x957c('0x35')][_0x957c('0x23')]);}_0x545fa6[_0x957c('0x3b')]=qs[_0x957c('0x3c')](_0x472cd4['query']['sort']);_0x545fa6[_0x957c('0x3d')]=qs[_0x957c('0x33')](_[_0x957c('0x3e')](_0x472cd4[_0x957c('0x35')],_0x52d143[_0x957c('0x33')]),_0x3de031);if(_0x472cd4[_0x957c('0x35')][_0x957c('0x3f')]){_0x545fa6[_0x957c('0x3d')]=_[_0x957c('0x40')](_0x545fa6[_0x957c('0x3d')],{'$or':_['map'](_0x3de031,function(_0x22bff3){if(_0x22bff3[_0x957c('0x30')]!==_0x957c('0x41')){var _0xe46e58={};_0xe46e58[_0x22bff3[_0x957c('0x2a')]]={'$like':'%'+_0x472cd4['query'][_0x957c('0x3f')]+'%'};return _0xe46e58;}})});}_0x545fa6=_[_0x957c('0x40')]({},_0x545fa6,_0x472cd4['options']);var _0x42127f={'where':_0x545fa6['where']};return db[_0x957c('0x2d')][_0x957c('0x22')](_0x42127f)[_0x957c('0x27')](function(_0x385192){_0x3af6e3[_0x957c('0x22')]=_0x385192;if(_0x472cd4[_0x957c('0x35')][_0x957c('0x42')]){_0x545fa6['include']=[{'all':!![]}];}return db[_0x957c('0x2d')]['findAll'](_0x545fa6);})[_0x957c('0x27')](function(_0x5f532f){_0x3af6e3['rows']=_0x5f532f;return _0x3af6e3;})['then'](respondWithFilteredResult(_0x21f61c,_0x545fa6))[_0x957c('0x43')](handleError(_0x21f61c,null));};exports[_0x957c('0x44')]=function(_0x3d5081,_0x2506f2){var _0x1cdd1c={'raw':![],'where':{'id':_0x3d5081['params']['id']}},_0x4c57b5={};_0x4c57b5['model']=_[_0x957c('0x32')](db[_0x957c('0x2d')][_0x957c('0x2e')]);_0x4c57b5['query']=_[_0x957c('0x32')](_0x3d5081['query']);_0x4c57b5['filters']=_[_0x957c('0x34')](_0x4c57b5[_0x957c('0x31')],_0x4c57b5['query']);_0x1cdd1c[_0x957c('0x36')]=_[_0x957c('0x34')](_0x4c57b5[_0x957c('0x31')],qs[_0x957c('0x37')](_0x3d5081[_0x957c('0x35')]['fields']));_0x1cdd1c[_0x957c('0x36')]=_0x1cdd1c[_0x957c('0x36')]['length']?_0x1cdd1c[_0x957c('0x36')]:_0x4c57b5[_0x957c('0x31')];if(_0x3d5081[_0x957c('0x35')][_0x957c('0x42')]){_0x1cdd1c[_0x957c('0x45')]=[{'all':!![]}];}_0x1cdd1c=_['merge']({},_0x1cdd1c,_0x3d5081[_0x957c('0x46')]);return db[_0x957c('0x2d')]['find'](_0x1cdd1c)[_0x957c('0x27')](handleEntityNotFound(_0x2506f2,null))[_0x957c('0x27')](respondWithResult(_0x2506f2,null))['catch'](handleError(_0x2506f2,null));};exports[_0x957c('0x47')]=function(_0x3c2b9a,_0x2ca386){return db[_0x957c('0x2d')][_0x957c('0x47')](_0x3c2b9a[_0x957c('0x48')],{})[_0x957c('0x27')](respondWithResult(_0x2ca386,0xc9))[_0x957c('0x43')](handleError(_0x2ca386,null));};exports[_0x957c('0x49')]=function(_0x7f371a,_0x2bd601){var _0x2e1f76={'where':{'id':_0x7f371a[_0x957c('0x4a')]['id']}},_0xc211fe={};_0xc211fe['model']=_['keys'](db[_0x957c('0x2d')]['rawAttributes']);_0x2e1f76[_0x957c('0x36')]=_[_0x957c('0x34')](_0xc211fe[_0x957c('0x31')],qs[_0x957c('0x37')](_0x7f371a[_0x957c('0x35')][_0x957c('0x37')]));_0x2e1f76['attributes']=_0x2e1f76['attributes'][_0x957c('0x38')]?_0x2e1f76[_0x957c('0x36')]:_0xc211fe[_0x957c('0x31')];if(_0x7f371a[_0x957c('0x35')][_0x957c('0x42')]){_0x2e1f76[_0x957c('0x45')]=[{'all':!![]}];}_0x2e1f76=_['merge']({},_0x2e1f76,_0x7f371a['options']);return db[_0x957c('0x2d')][_0x957c('0x4b')](_0x2e1f76)[_0x957c('0x27')](handleEntityNotFound(_0x2bd601,null))[_0x957c('0x27')](function(_0x4cf87b){if(_0x4cf87b){var _0x56ffa5=_0x4cf87b['get']({'plain':!![]});_0x56ffa5=qs[_0x957c('0x4c')](_0x56ffa5,['id',_0x957c('0x4d'),_0x957c('0x4e'),_0x957c('0x4f')]);_0x7f371a[_0x957c('0x48')]=_[_0x957c('0x4c')](_0x7f371a[_0x957c('0x48')],['id',_0x957c('0x4d'),_0x957c('0x4e')]);return db[_0x957c('0x50')][_0x957c('0x51')](function(_0x3c1e30){return db[_0x957c('0x2d')][_0x957c('0x47')](_[_0x957c('0x40')](_0x56ffa5,_0x7f371a[_0x957c('0x48')]),{'include':_0x7f371a[_0x957c('0x35')][_0x957c('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x3c1e30})[_0x957c('0x27')](function(_0x253cd6){var _0x5a19aa=_0x253cd6['get']({'plain':!![]});return db[_0x957c('0x52')][_0x957c('0x53')]({'where':{'userProfileId':_0x7f371a['params']['id']},'raw':!![]})[_0x957c('0x27')](function(_0xff5365){if(_0xff5365){return BPromise['each'](_0xff5365,function(_0x159663){return new BPromise(function(_0x428a78,_0x5c1f7e){if(_0x159663[_0x957c('0x54')]===null||_0x159663[_0x957c('0x54')]===0x1)_0x428a78(null);return db[_0x957c('0x55')][_0x957c('0x53')]({'where':{'sectionId':_0x159663['id']},'raw':!![]})[_0x957c('0x27')](function(_0xe0d7c9){var _0x44b4b2=_[_0x957c('0x56')](_0xe0d7c9,function(_0x39227a){return qs['omit'](_0x39227a,['id',_0x957c('0x4d'),'updatedAt',_0x957c('0x57')]);});_0x428a78(_0x44b4b2);})[_0x957c('0x43')](function(_0x5afc56){_0x5c1f7e(_0x5afc56);});})['then'](function(_0xefd9aa){var _0x2de91d=qs['omit'](_0x159663,['id',_0x957c('0x4d'),_0x957c('0x4e')]);_0x2de91d[_0x957c('0x58')]=_0x5a19aa['id'];if(_0xefd9aa)_0x2de91d[_0x957c('0x59')]=_0xefd9aa;return _0x2de91d;})[_0x957c('0x27')](function(_0x15b3d7){return db[_0x957c('0x52')][_0x957c('0x47')](_0x15b3d7,{'include':[{'model':db[_0x957c('0x55')],'as':_0x957c('0x59')}],'raw':!![],'transaction':_0x3c1e30});});})[_0x957c('0x27')](function(){return _0x5a19aa;});}});});});}})[_0x957c('0x27')](respondWithResult(_0x2bd601,0xc9))[_0x957c('0x43')](handleError(_0x2bd601,null));};exports[_0x957c('0x5a')]=function(_0xc7bfe9,_0x30d13d){if(_0xc7bfe9[_0x957c('0x48')]['id']){delete _0xc7bfe9[_0x957c('0x48')]['id'];}return db[_0x957c('0x2d')][_0x957c('0x4b')]({'where':{'id':_0xc7bfe9[_0x957c('0x4a')]['id']}})[_0x957c('0x27')](handleEntityNotFound(_0x30d13d,null))[_0x957c('0x27')](saveUpdates(_0xc7bfe9[_0x957c('0x48')],null))['then'](respondWithResult(_0x30d13d,null))['catch'](handleError(_0x30d13d,null));};exports[_0x957c('0x26')]=function(_0x4a34b5,_0x1fd042){return db[_0x957c('0x2d')]['find']({'where':{'id':_0x4a34b5[_0x957c('0x4a')]['id']}})[_0x957c('0x27')](handleEntityNotFound(_0x1fd042,null))['then'](removeEntity(_0x1fd042,null))[_0x957c('0x43')](handleError(_0x1fd042,null));};exports['describe']=function(_0xb18f3e,_0x418e50){return db['UserProfile'][_0x957c('0x5b')]()[_0x957c('0x27')](respondWithResult(_0x418e50,null))[_0x957c('0x43')](handleError(_0x418e50,null));};exports['addSections']=function(_0x522bd2,_0x450cf2){var _0x590f8c=_0x522bd2[_0x957c('0x48')];return db[_0x957c('0x2d')][_0x957c('0x4b')]({'where':{'id':_0x522bd2[_0x957c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x450cf2,null))['then'](function(_0x446450){if(_0x446450){return db[_0x957c('0x50')][_0x957c('0x51')](function(_0x3a8235){return db[_0x957c('0x52')][_0x957c('0x26')]({'where':{'userProfileId':_0x522bd2['params']['id'],'sectionId':_[_0x957c('0x56')](_0x590f8c,function(_0xd574b7){return _0xd574b7[_0x957c('0x57')];})},'transaction':_0x3a8235})['then'](function(){var _0x2e1564=_[_0x957c('0x56')](_0x590f8c,function(_0x1c982b){_0x1c982b[_0x957c('0x58')]=_0x522bd2[_0x957c('0x4a')]['id'];return _0x1c982b;});var _0x1a17e6=[];return BPromise['each'](_0x2e1564,function(_0x5284d1){return db[_0x957c('0x52')][_0x957c('0x47')](_0x5284d1,{'include':[{'model':db[_0x957c('0x55')],'as':_0x957c('0x59')}],'raw':!![],'transaction':_0x3a8235})['then'](function(_0x2ce555){_0x1a17e6[_0x957c('0x5c')](_0x2ce555['get']({'plain':!![]}));});})['then'](function(){return _0x1a17e6;});});});}})['then'](function(_0x465353){return _0x465353;})['then'](respondWithResult(_0x450cf2,null))[_0x957c('0x43')](handleError(_0x450cf2,null));};exports[_0x957c('0x5d')]=function(_0x14072b,_0x5c1181){var _0x1d94ff;return db['UserProfile']['find']({'where':{'id':_0x14072b['params']['id']},'attributes':['id',_0x957c('0x2a')]})['then'](handleEntityNotFound(_0x5c1181,null))[_0x957c('0x27')](function(_0x591afc){if(_0x591afc){_0x1d94ff=_0x591afc;return db[_0x957c('0x52')][_0x957c('0x26')]({'where':{'userProfileId':_0x14072b[_0x957c('0x4a')]['id'],'sectionId':_0x14072b['query'][_0x957c('0x5e')]}});}})['then'](function(){return _0x1d94ff;})[_0x957c('0x27')](respondWithStatusCode(_0x5c1181,null))['catch'](handleError(_0x5c1181,null));};exports['getSections']=function(_0x2cf2f1,_0x51ff44){var _0x1faa9d=[];var _0x61d1a7=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x2cf2f1[_0x957c('0x4a')]['id']},'raw':!![]})[_0x957c('0x27')](function(_0x4d8a51){_0x1faa9d=_['filter'](_0x4d8a51,function(_0x4dc4a0){return _0x4dc4a0[_0x957c('0x5f')]===0x1||_[_0x957c('0x60')]([0x3eb,0x709],_0x4dc4a0[_0x957c('0x57')]);});if(!_[_0x957c('0x61')](_0x1faa9d)){return _['map'](_0x1faa9d,function(_0x51ffd6){return _0x51ffd6[_0x957c('0x57')];});}else{return;}})[_0x957c('0x27')](function(_0x49f044){if(_0x49f044)_0x61d1a7=_0x49f044;if(_[_0x957c('0x60')](_0x61d1a7,0x64)){var _0x554910=_[_0x957c('0x4b')](_0x1faa9d,{'sectionId':0x64});return hasDefaultDashboard(_0x554910)[_0x957c('0x27')](function(_0x281f11){return _['map'](_0x1faa9d,function(_0x9070f7){if(_0x9070f7[_0x957c('0x57')]===0x64){_0x9070f7[_0x957c('0x62')]=_0x281f11;}return _0x9070f7;});});}else{return;}})[_0x957c('0x27')](function(_0xa682d5){if(_0xa682d5)_0x1faa9d=_0xa682d5;if(_[_0x957c('0x60')](_0x61d1a7,0x3eb)){var _0x4511eb=_[_0x957c('0x4b')](_0x1faa9d,{'sectionId':0x3eb});return getCustomDashboards(_0x4511eb)[_0x957c('0x27')](function(_0x22b2a5){return _['map'](_0x1faa9d,function(_0x3b6478){if(_0x4511eb[_0x957c('0x5f')]){if(_0x3b6478['sectionId']===0x3eb){_0x3b6478[_0x957c('0x62')]=_0x22b2a5;}}else{if(_0x3b6478[_0x957c('0x57')]===0x64){if(!_0x3b6478['subsections']){_0x3b6478[_0x957c('0x62')]=[];}_0x3b6478[_0x957c('0x62')]=_0x3b6478[_0x957c('0x62')]['concat'](_0x22b2a5);}}return _0x3b6478;});});}else{return;}})[_0x957c('0x27')](function(_0x27a2e2){if(_0x27a2e2)_0x1faa9d=_0x27a2e2;if(_[_0x957c('0x60')](_0x61d1a7,0x709)){var _0x59fbe4=_[_0x957c('0x4b')](_0x1faa9d,{'sectionId':0x709});return getPlugins(_0x59fbe4)[_0x957c('0x27')](function(_0xf1fc67){if(_0x59fbe4['enabled']){return _[_0x957c('0x56')](_0x1faa9d,function(_0x2bd5db){if(_0x2bd5db[_0x957c('0x57')]===0x709){_0x2bd5db[_0x957c('0x62')]=_0xf1fc67;}return _0x2bd5db;});}else{var _0x40e9c8={'sectionId':0x76c,'enabled':0x1,'subsections':_0xf1fc67};var _0x89ca5c=_[_0x957c('0x56')](_0x1faa9d);_0x89ca5c['push'](_0x40e9c8);return _0x89ca5c;}});}else{return;}})[_0x957c('0x27')](function(_0x4fa2cd){if(_0x4fa2cd)_0x1faa9d=_0x4fa2cd;return _[_0x957c('0x3f')](_0x1faa9d,['enabled',0x1]);})[_0x957c('0x27')](respondWithResult(_0x51ff44,null))[_0x957c('0x43')](handleError(_0x51ff44,null));};function hasDefaultDashboard(_0xc352b1){var _0x8187ed=[0x65];return new BPromise(function(_0x37f7e9,_0x2ac901){try{if(_0xc352b1[_0x957c('0x54')]){_0x37f7e9(_0x8187ed);}else{return db[_0x957c('0x55')][_0x957c('0x63')]({'where':{'sectionId':_0xc352b1['id']},'raw':!![]})['then'](function(_0x4db3c8){_0x4db3c8?_0x37f7e9(_0x8187ed):_0x37f7e9();});}}catch(_0x1dcfa1){_0x2ac901(_0x1dcfa1);}});}function getCustomDashboards(_0x268300){var _0x119744=[];return new BPromise(function(_0x4bbd7b,_0x2c9fc9){try{if(_0x268300[_0x957c('0x54')]){return db['Dashboard']['findAll']({'raw':!![]})[_0x957c('0x27')](function(_0x277760){_0x277760[_0x957c('0x64')](function(_0x3f6d51){_0x119744[_0x957c('0x5c')](_0x3f6d51['id']+0x1869f);});_0x4bbd7b(_0x119744);});}else{return db[_0x957c('0x55')][_0x957c('0x53')]({'where':{'sectionId':_0x268300['id']},'raw':!![]})['then'](function(_0x2d1b23){_0x2d1b23[_0x957c('0x64')](function(_0x5dc4d7){_0x119744[_0x957c('0x5c')](_0x5dc4d7['resourceId']+0x1869f);});_0x4bbd7b(_0x119744);});}}catch(_0x3b16a0){_0x2c9fc9(_0x3b16a0);}});}function getPlugins(_0x46f38d){var _0x5ae04f=[];return new BPromise(function(_0x1db3ef,_0x171518){try{if(_0x46f38d['autoAssociation']){return db['Plugin'][_0x957c('0x53')]({'raw':!![]})[_0x957c('0x27')](function(_0x1bd933){_0x1bd933[_0x957c('0x64')](function(_0x1eb144){_0x5ae04f[_0x957c('0x5c')](_0x1eb144['id']+0x15b38);});_0x1db3ef(_0x5ae04f);});}else{return db[_0x957c('0x55')][_0x957c('0x53')]({'where':{'sectionId':_0x46f38d['id']},'raw':!![]})[_0x957c('0x27')](function(_0x1c0961){_0x1c0961[_0x957c('0x64')](function(_0x579caa){_0x5ae04f['push'](_0x579caa['resourceId']+0x15b38);});_0x1db3ef(_0x5ae04f);});}}catch(_0x203531){_0x171518(_0x203531);}});}exports['addResources']=function(_0x2216aa,_0x5a4369){return db[_0x957c('0x2d')]['find']({'where':{'id':_0x2216aa[_0x957c('0x4a')]['id']}})[_0x957c('0x27')](handleEntityNotFound(_0x5a4369,null))[_0x957c('0x27')](function(_0x108ca3){if(_0x108ca3){return db['sequelize'][_0x957c('0x51')](function(_0x41ec4e){return db[_0x957c('0x52')]['findAll']({'where':{'userProfileId':_0x2216aa[_0x957c('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x957c('0x27')](function(_0xe53127){if(_0xe53127){return db['UserProfileSection'][_0x957c('0x26')]({'where':{'userProfileId':_0x2216aa[_0x957c('0x4a')]['id'],'id':_['map'](_0xe53127,function(_0x7a4466){return _0x7a4466['id'];})},'transaction':_0x41ec4e});}})[_0x957c('0x27')](function(_0x2eabc7){var _0x523632=_[_0x957c('0x56')](_0x2216aa[_0x957c('0x48')],function(_0xb2cc27){_0xb2cc27[_0x957c('0x58')]=_0x2216aa[_0x957c('0x4a')]['id'];return _0xb2cc27;});return db[_0x957c('0x52')][_0x957c('0x65')](_0x523632,{'raw':!![],'transaction':_0x41ec4e});})[_0x957c('0x27')](function(_0x3a6e20){var _0x21d462=_[_0x957c('0x3f')](_[_0x957c('0x56')](_0x3a6e20,function(_0x104726){return _0x104726[_0x957c('0x66')]({'plain':!![]});}),{'includeAll':![]});if(_0x21d462){return db['UserProfileSection'][_0x957c('0x53')]({'where':{'userProfileId':_0x2216aa[_0x957c('0x4a')]['id'],'sectionId':_['map'](_0x21d462,function(_0x55c9ee){return _0x55c9ee['sectionId'];})},'attributes':['id',_0x957c('0x57')],'raw':!![]})[_0x957c('0x27')](function(_0x167576){var _0x530bb0=_[_0x957c('0x56')](_0x2216aa[_0x957c('0x48')],function(_0x5030b6){_0x5030b6[_0x957c('0x58')]=_0x2216aa[_0x957c('0x4a')]['id'];return _0x5030b6;});return db[_0x957c('0x55')]['bulkCreate'](_0x530bb0,{'raw':!![],'transaction':_0x41ec4e});});}})[_0x957c('0x43')](handleError(_0x5a4369,null));});}})[_0x957c('0x27')](function(_0xed5ff6){var _0x4c6f76=_[_0x957c('0x56')](_0xed5ff6,function(_0x3f821e){return _0x3f821e[_0x957c('0x66')]({'plain':!![]});});})[_0x957c('0x27')](respondWithResult(_0x5a4369,null))[_0x957c('0x43')](handleError(_0x5a4369,null));};exports[_0x957c('0x67')]=function(_0x16712a,_0x38e2ae,_0x47626d){return db[_0x957c('0x2d')][_0x957c('0x4b')]({'where':{'id':_0x16712a[_0x957c('0x4a')]['id']}})[_0x957c('0x27')](handleEntityNotFound(_0x38e2ae,null))[_0x957c('0x27')](function(_0x47425c){if(_0x47425c){return _0x47425c['removeResources'](_0x16712a[_0x957c('0x35')][_0x957c('0x5e')]);}})[_0x957c('0x27')](respondWithStatusCode(_0x38e2ae,null))[_0x957c('0x43')](handleError(_0x38e2ae,null));};exports[_0x957c('0x68')]=function(_0x4f515e,_0x5b72de){var _0x5b58bd={};if(!_0x4f515e[_0x957c('0x35')][_0x957c('0x69')])throw new Error(_0x957c('0x6a'));if(!_0x4f515e[_0x957c('0x35')][_0x957c('0x39')](_0x957c('0x3a'))){_0x5b58bd['limit']=qs[_0x957c('0x21')](_0x4f515e['query'][_0x957c('0x21')]);_0x5b58bd[_0x957c('0x23')]=qs[_0x957c('0x23')](_0x4f515e[_0x957c('0x35')][_0x957c('0x23')]);}return db[_0x957c('0x2d')][_0x957c('0x4b')]({'where':{'id':_0x4f515e[_0x957c('0x4a')]['id']}})[_0x957c('0x27')](function(_0x3fbcfb){if(!_0x3fbcfb)throw new Error(_0x957c('0x6b')+_0x4f515e[_0x957c('0x4a')]['id']);return db['UserProfile'][_0x957c('0x68')](_0x4f515e);})[_0x957c('0x27')](respondWithFilteredResult(_0x5b72de,_0x5b58bd))[_0x957c('0x43')](handleError(_0x5b72de,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 30a7d98..fc50937 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 _0x1c63=['update','remove','emit','hasOwnProperty','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x1c45fb,_0x43db02){var _0x51e46c=function(_0x9b4982){while(--_0x9b4982){_0x1c45fb['push'](_0x1c45fb['shift']());}};_0x51e46c(++_0x43db02);}(_0x1c63,0xdc));var _0x31c6=function(_0x1dd4de,_0x189290){_0x1dd4de=_0x1dd4de-0x0;var _0xf23408=_0x1c63[_0x1dd4de];return _0xf23408;};'use strict';var EventEmitter=require(_0x31c6('0x0'));var UserProfile=require(_0x31c6('0x1'))['db'][_0x31c6('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x31c6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x31c6('0x4'),'afterDestroy':_0x31c6('0x5')};function emitEvent(_0x2501a8){return function(_0x598eed,_0x12da33,_0x3c1288){UserProfileEvents[_0x31c6('0x6')](_0x2501a8+':'+_0x598eed['id'],_0x598eed);UserProfileEvents[_0x31c6('0x6')](_0x2501a8,_0x598eed);_0x3c1288(null);};}for(var e in events){if(events[_0x31c6('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x9134=['hook','exports','../../mysqldb','UserProfile','setMaxListeners','save','emit'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x9134,0x87));var _0x4913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9134[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x4913('0x0'))['db'][_0x4913('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4913('0x2')](0x0);var events={'afterCreate':_0x4913('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x352f58){return function(_0x488795,_0x367836,_0x349c8c){UserProfileEvents[_0x4913('0x4')](_0x352f58+':'+_0x488795['id'],_0x488795);UserProfileEvents[_0x4913('0x4')](_0x352f58,_0x488795);_0x349c8c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x4913('0x5')](e,emitEvent(event));}}module[_0x4913('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2e9e4a4..05b95a5 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 _0xaf77=['lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','role','Telephones','membername','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','QueueCampaigns','users','agents','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','plugins','Plugin','extractedreports','Reports','metrics','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','ignore','union','length','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filters','merge','VIRTUAL','foreignKey','forEach','options','include','default','reportId','DefaultReports','custom','CustomReports','rows','ids','customSorting','count','Tags','color','ThroughTags','tag','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','squel','exports','filter','value','findAll','associatedResources','map','catch','field','model','then','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId'];(function(_0x233e6f,_0x4019ac){var _0x1deeb0=function(_0x43f942){while(--_0x43f942){_0x233e6f['push'](_0x233e6f['shift']());}};_0x1deeb0(++_0x4019ac);}(_0xaf77,0xa0));var _0x7af7=function(_0x379ca9,_0x268f7f){_0x379ca9=_0x379ca9-0x0;var _0x8c3467=_0xaf77[_0x379ca9];return _0x8c3467;};'use strict';var _=require('lodash');var attributes=require(_0x7af7('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0x7af7('0x1'));module[_0x7af7('0x2')]=function(_0x5c8b97){var _0x4936e5=_0x5c8b97['models'];function _0x46d93f(_0x33fc87,_0x4a7882){return new Promise(function(_0x6f1f90,_0x49eef6){if(!_0x4a7882)return _0x6f1f90(null);var _0x311ca2=_0x4a7882[_0x7af7('0x3')]?{[_0x4a7882['filter']['field']]:_0x4a7882[_0x7af7('0x3')][_0x7af7('0x4')]}:undefined;return _0x4936e5[_0x33fc87][_0x7af7('0x5')]({'where':_0x311ca2,'raw':!![]})['then'](function(_0x2330e4){_0x4a7882[_0x7af7('0x6')]=_[_0x7af7('0x7')](_0x2330e4,'id');_0x6f1f90(_0x4a7882);})[_0x7af7('0x8')](function(_0x2e99ed){_0x49eef6(_0x2e99ed);});});}function _0x17083b(_0x36f653,_0x3db663){return new Promise(function(_0x588644,_0x483a80){var _0x5f1863=_0x36f653['filter']?{[_0x36f653['filter'][_0x7af7('0x9')]]:_0x36f653[_0x7af7('0x3')][_0x7af7('0x4')]}:undefined;return _0x4936e5[_0x36f653[_0x7af7('0xa')]][_0x7af7('0x5')]({'where':_0x5f1863,'raw':!![]})[_0x7af7('0xb')](function(_0x36184a){_0x3db663[_0x7af7('0x6')]=_[_0x7af7('0x7')](_0x36184a,function(_0x2a3aa1){return _0x2a3aa1[_0x7af7('0xc')];});_0x588644(_0x3db663);})['catch'](function(_0x138bf6){_0x483a80(_0x138bf6);});});}function _0xb5b66e(_0x27aeef,_0x15af7a,_0x208137){if(!_0x15af7a)return Promise[_0x7af7('0xd')](null);return new Promise(function(_0x1e7e70,_0x3c5834){return _0x4936e5['UserProfileResource'][_0x7af7('0x5')]({'where':{'sectionId':_0x15af7a['id']},'raw':!![]})['then'](function(_0x152779){if(_0x27aeef[_0x7af7('0x9')]&&_0x27aeef[_0x7af7('0x9')]!=='id'){_0x15af7a['associatedResources']=_[_0x7af7('0x7')](_0x152779,function(_0x5a4c0d){return _0x5a4c0d[_0x27aeef[_0x7af7('0x9')]];});}else{if(_0x208137===_0x7af7('0xe')){_0x15af7a[_0x7af7('0x6')]=_[_0x7af7('0x7')](_0x152779,function(_0x16b6ac){return{'id':_0x16b6ac[_0x7af7('0xf')],'type':_0x16b6ac[_0x7af7('0x10')]};});}else{_0x15af7a[_0x7af7('0x6')]=_[_0x7af7('0x7')](_0x152779,function(_0x10a8b5){return _0x10a8b5[_0x7af7('0xf')];});}}_0x1e7e70(_0x15af7a);})[_0x7af7('0x8')](function(_0x5f429d){_0x3c5834(_0x5f429d);});});}function _0x5a2a98(_0x440352,_0x103faf){var _0x2462d7={'parentSections':[]};switch(_0x440352[_0x7af7('0x11')]()){case _0x7af7('0x12'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x14');break;case _0x7af7('0x15'):_0x2462d7['childModel']='SquareOdbc';break;case _0x7af7('0x16'):_0x2462d7['childModel']='SquareRecording';_0x2462d7['parentSections']=[{'name':'SquareProjects','field':_0x7af7('0xc'),'foreignKey':_0x7af7('0x17')}];break;case _0x7af7('0x18'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x19');break;case _0x7af7('0x1a'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x1b');_0x2462d7[_0x7af7('0x1c')]=[{'name':_0x7af7('0x1d'),'field':'id','foreignKey':_0x7af7('0x1e')}];break;case _0x7af7('0x1f'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x20');break;case _0x7af7('0x21'):_0x2462d7['childModel']=_0x7af7('0x22');break;case'globalcustomfields':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x23');break;case _0x7af7('0x24'):_0x2462d7['childModel']=_0x7af7('0x25');break;case'chatwebsites':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x26');break;case _0x7af7('0x27'):_0x2462d7['childModel']=_0x7af7('0x28');break;case _0x7af7('0x29'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x2a');break;case'inboundroutes':case _0x7af7('0x2b'):case'outboundroutes':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x2c');break;case _0x7af7('0x2d'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x2e');break;case _0x7af7('0x2f'):_0x2462d7[_0x7af7('0x13')]='VoiceMail';break;case _0x7af7('0x30'):_0x2462d7[_0x7af7('0x13')]='VoiceRecording';_0x2462d7[_0x7af7('0x1c')]=[{'name':_0x7af7('0x31'),'field':'name','foreignKey':'membername','model':_0x7af7('0x32'),'filter':{'field':_0x7af7('0x33'),'value':['agent']}},{'name':_0x7af7('0x34'),'field':_0x7af7('0xc'),'foreignKey':_0x7af7('0x35'),'model':_0x7af7('0x32'),'filter':{'field':'role','value':['telephone']}},{'name':_0x7af7('0x36'),'field':_0x7af7('0xc'),'foreignKey':_0x7af7('0x37'),'model':_0x7af7('0x38'),'filter':{'field':_0x7af7('0x10'),'value':[_0x7af7('0x39')]}},{'name':'QueueCampaigns','field':_0x7af7('0xc'),'foreignKey':'queue','model':_0x7af7('0x38'),'filter':{'field':_0x7af7('0x10'),'value':[_0x7af7('0x3a')]}}];break;case _0x7af7('0x3b'):_0x2462d7['childModel']=_0x7af7('0x3c');break;case'chanspies':_0x2462d7['childModel']='VoiceChanSpy';break;case _0x7af7('0x3d'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x3e');break;case _0x7af7('0x3f'):_0x2462d7['childModel']=_0x7af7('0x40');break;case _0x7af7('0x41'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x42');break;case _0x7af7('0x43'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x44');break;case _0x7af7('0x45'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x46');break;case _0x7af7('0x47'):_0x2462d7['childModel']='OpenchannelQueue';break;case _0x7af7('0x48'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x49');break;case _0x7af7('0x4a'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x4b');break;case _0x7af7('0x4c'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x4d');break;case'whatsappqueues':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x4e');break;case _0x7af7('0x4f'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x50');break;case _0x7af7('0x51'):_0x2462d7['childModel']='Team';break;case _0x7af7('0x52'):case _0x7af7('0x53'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x38');if(_0x103faf){_0x2462d7[_0x7af7('0x1c')]=[{'name':_0x7af7('0x36')},{'name':_0x7af7('0x54')}];}break;case _0x7af7('0x55'):case _0x7af7('0x56'):case'telephones':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x32');if(_0x103faf){_0x2462d7[_0x7af7('0x1c')]=[{'name':'Users','filter':{'field':_0x7af7('0x33'),'value':['admin',_0x7af7('0x57')]},'ignore':!![]},{'name':'Agents'},{'name':_0x7af7('0x34')}];}break;case'zendeskaccounts':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x58');break;case _0x7af7('0x59'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x5a');break;case'freshdeskaccounts':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x5b');break;case'sugarcrmaccounts':_0x2462d7['childModel']=_0x7af7('0x5c');break;case _0x7af7('0x5d'):_0x2462d7['childModel']=_0x7af7('0x5e');break;case _0x7af7('0x5f'):_0x2462d7[_0x7af7('0x13')]='ZohoAccount';break;case'vtigeraccounts':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x32');break;case _0x7af7('0x60'):_0x2462d7['childModel']='CannedAnswer';break;case'dispositions':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x61');break;case _0x7af7('0x62'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x63');break;case _0x7af7('0x64'):_0x2462d7[_0x7af7('0x13')]='Interval';break;case _0x7af7('0x65'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x66');break;case'scheduler':_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x67');break;case _0x7af7('0x68'):_0x2462d7['childModel']=_0x7af7('0x69');break;case _0x7af7('0x6a'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x6b');break;case _0x7af7('0x6c'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x6d');break;case _0x7af7('0x6e'):_0x2462d7[_0x7af7('0x13')]='Trigger';break;case _0x7af7('0x6f'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x70');break;case _0x7af7('0x71'):_0x2462d7[_0x7af7('0x13')]='Variable';break;case _0x7af7('0x72'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0x73');break;case _0x7af7('0x74'):_0x2462d7[_0x7af7('0x13')]=_0x7af7('0xe');_0x2462d7[_0x7af7('0x1c')]=[{'name':_0x7af7('0x75'),'field':'id','foreignKey':'reportId'}];break;case _0x7af7('0x76'):_0x2462d7[_0x7af7('0x13')]='AnalyticMetric';break;}return _0x2462d7;}function _0x28c200(_0x10cc25,_0xe5bafa){var _0x223ccc=_0x10cc25['charAt'](0x0)[_0x7af7('0x77')]()+_0x10cc25[_0x7af7('0x78')](0x1);var _0x588fa7={'type':_0x4936e5[_0x7af7('0x79')]['QueryTypes'][_0x7af7('0x7a')],'raw':!![]};return new Promise(function(_0x342085,_0x139ccb){var _0x4e402f=squel[_0x7af7('0x7b')]()['field'](_0x7af7('0x7c')+_0x223ccc+_0x7af7('0x7d'),'id')[_0x7af7('0x9')](_0x7af7('0x7e'))[_0x7af7('0x7f')](_0x7af7('0x80')+_0x10cc25+_0x7af7('0x81'),'ui')[_0x7af7('0x82')](_0x7af7('0x83'),_0xe5bafa['id']);return _0x4936e5['sequelize'][_0x7af7('0x84')](_0x4e402f[_0x7af7('0x85')](),_0x588fa7)[_0x7af7('0xb')](function(_0x5b13ad){_0xe5bafa[_0x223ccc+_0x7af7('0x86')]=_0x5b13ad;_0x342085(_0x5b13ad);})[_0x7af7('0x8')](function(_0x407294){_0x139ccb(_0x407294);});});}return _0x5c8b97[_0x7af7('0x87')](_0x7af7('0x88'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x89b986){var _0x206106={'raw':_0x89b986[_0x7af7('0x84')][_0x7af7('0x89')],'where':{}};var _0x1ffe78={};var _0x5a04d3={'count':0x0,'rows':[]};var _0x59c72c=_0x89b986[_0x7af7('0x84')][_0x7af7('0x8a')];var _0x48e53d=_0x89b986[_0x7af7('0x84')][_0x7af7('0x8b')]||![];var _0x45cd13=_0x5a2a98(_0x59c72c,_0x48e53d);if(!_0x45cd13['childModel'])throw new Error(_0x7af7('0x8c')+_0x59c72c+'\x27');var _0x72dd2=[{'name':_0x59c72c}];if(!_[_0x7af7('0x8d')](_0x45cd13['parentSections']))_0x72dd2=_0x45cd13[_0x7af7('0x1c')];var _0x1e59e1=[];for(var _0x5ce9ec=0x0;_0x5ce9ec<_0x72dd2['length'];_0x5ce9ec++){_0x1e59e1[_0x7af7('0x8e')](_0x4936e5[_0x7af7('0x8f')][_0x7af7('0x90')]({'where':{'userProfileId':_0x89b986[_0x7af7('0x91')]['id'],'name':_0x72dd2[_0x5ce9ec][_0x7af7('0xc')]},'raw':!![]}));}return Promise[_0x7af7('0x92')](_0x1e59e1)[_0x7af7('0xb')](function(_0x21b095){var _0x100c9e=_[_0x7af7('0x3')](_0x21b095,function(_0x5d6c86){return _0x5d6c86?_0x5d6c86:undefined;});var _0x2cf52b=_[_0x7af7('0x3')](_0x72dd2,[_0x7af7('0x93'),!![]]);var _0x46ddcd=_[_0x7af7('0x8d')](_0x100c9e)&&_[_0x7af7('0x8d')](_0x2cf52b)?null:_[_0x7af7('0x94')](_0x2cf52b,_0x100c9e);if(!_0x46ddcd)return null;var _0x3ce52e=[];for(var _0x426cde=0x0;_0x426cde<_0x46ddcd[_0x7af7('0x95')];_0x426cde++){var _0x5a0400=_[_0x7af7('0x90')](_0x72dd2,function(_0x8e1a0f){return _0x46ddcd[_0x426cde]?_0x8e1a0f[_0x7af7('0xc')]===_0x46ddcd[_0x426cde][_0x7af7('0xc')]:null;});if(_0x5a0400){if(_0x46ddcd[_0x426cde][_0x7af7('0x93')]){_0x3ce52e[_0x7af7('0x8e')](_0x46d93f(_0x45cd13[_0x7af7('0x13')],_0x46ddcd[_0x426cde]));}else{if(!_0x46ddcd[_0x426cde][_0x7af7('0x96')]){_0x3ce52e[_0x7af7('0x8e')](_0xb5b66e(_0x5a0400,_0x46ddcd[_0x426cde],_0x45cd13[_0x7af7('0x13')]));}else{if(_0x5a0400[_0x7af7('0xa')]){_0x3ce52e[_0x7af7('0x8e')](_0x17083b(_0x5a0400,_0x46ddcd[_0x426cde]));}}}}}return Promise['all'](_0x3ce52e);})[_0x7af7('0xb')](function(_0x5ddd3b){var _0x300ca3=_0x5ddd3b;var _0x355fc8=null;if(_0x300ca3){_0x355fc8=_0x300ca3[_0x7af7('0x95')]===0x1?_0x300ca3[0x0]:null;}if(!_0x355fc8&&!_0x300ca3)return _0x5a04d3;var _0x1c7073=_0x4936e5[_0x45cd13[_0x7af7('0x13')]][_0x7af7('0x97')];_0x1ffe78['model']=_[_0x7af7('0x98')](_0x1c7073);_0x1ffe78['query']=_[_0x7af7('0x98')](_0x89b986['query']);_0x1ffe78['filters']=_[_0x7af7('0x99')](_0x1ffe78[_0x7af7('0xa')],_0x1ffe78[_0x7af7('0x84')]);_0x206106[_0x7af7('0x9a')]=_['intersection'](_0x1ffe78[_0x7af7('0xa')],qs[_0x7af7('0x9b')](_0x89b986['query'][_0x7af7('0x9b')]));_0x206106[_0x7af7('0x9a')]=_0x206106['attributes'][_0x7af7('0x95')]?_0x206106[_0x7af7('0x9a')]:_0x1ffe78[_0x7af7('0xa')];if(!_0x89b986[_0x7af7('0x84')][_0x7af7('0x9c')](_0x7af7('0x9d'))){_0x206106[_0x7af7('0x9e')]=qs[_0x7af7('0x9e')](_0x89b986[_0x7af7('0x84')][_0x7af7('0x9e')]);_0x206106[_0x7af7('0x9f')]=qs['offset'](_0x89b986[_0x7af7('0x84')][_0x7af7('0x9f')]);}_0x206106[_0x7af7('0xa0')]=qs[_0x7af7('0xa1')](_0x89b986['query'][_0x7af7('0xa1')]);_0x206106[_0x7af7('0x82')]=qs['filters'](_[_0x7af7('0xa2')](_0x89b986[_0x7af7('0x84')],_0x1ffe78[_0x7af7('0xa3')]));if(_0x89b986[_0x7af7('0x84')][_0x7af7('0x3')]){_0x206106[_0x7af7('0x82')]=_[_0x7af7('0xa4')](_0x206106[_0x7af7('0x82')],{'$or':_[_0x7af7('0x7')](_0x1c7073,function(_0x2ec015){if(_0x2ec015[_0x7af7('0x10')]['key']!==_0x7af7('0xa5')){var _0x1712c1={};_0x1712c1[_0x2ec015['field']]={'$like':'%'+_0x89b986[_0x7af7('0x84')][_0x7af7('0x3')]+'%'};return _0x1712c1;}})});}var _0x6eb663=[];var _0x2d80b1=null;var _0x4b492b={};if(_0x355fc8){_0x2d80b1=_[_0x7af7('0x90')](_0x72dd2,[_0x7af7('0xc'),_0x355fc8[_0x7af7('0xc')]]);if(_0x2d80b1['field']){_0x4b492b={};if(_0x45cd13['childModel']==='AnalyticExtractedReport'){_0x4b492b[_0x2d80b1['foreignKey']]=_[_0x7af7('0x7')](_0x355fc8[_0x7af7('0x6')],'id');}else{_0x4b492b[_0x2d80b1[_0x7af7('0xa6')]]=_0x355fc8[_0x7af7('0x6')];}_0x6eb663[_0x7af7('0x8e')](_0x4b492b);}else{_0x206106['where']['id']=_0x355fc8[_0x7af7('0x6')];}}else{for(var _0x38487a=0x0;_0x38487a<_0x300ca3[_0x7af7('0x95')];_0x38487a++){_0x2d80b1=_[_0x7af7('0x90')](_0x72dd2,[_0x7af7('0xc'),_0x300ca3[_0x38487a][_0x7af7('0xc')]]);if(_0x2d80b1[_0x7af7('0x9')]){_0x4b492b={};_0x4b492b[_0x2d80b1['foreignKey']]=_0x300ca3[_0x38487a][_0x7af7('0x6')];_0x6eb663[_0x7af7('0x8e')](_0x4b492b);}else{if(!_0x206106['where']['id'])_0x206106[_0x7af7('0x82')]['id']=[];_0x300ca3[_0x38487a][_0x7af7('0x6')][_0x7af7('0xa7')](function(_0x271103){_0x206106[_0x7af7('0x82')]['id'][_0x7af7('0x8e')](_0x271103);});}}}if(!_[_0x7af7('0x8d')](_0x6eb663)){_0x206106[_0x7af7('0x82')]=_[_0x7af7('0xa4')](_0x206106[_0x7af7('0x82')],{'$and':{'$or':_0x6eb663}});}_0x206106=_[_0x7af7('0xa4')]({},_0x206106,_0x89b986[_0x7af7('0xa8')]);if(_0x355fc8&&!_0x355fc8[_0x7af7('0x96')]&&_0x45cd13['childModel']===_0x7af7('0xe')){if(_0x89b986['query']['includeAll']){_0x206106[_0x7af7('0xa9')]=[{'all':!![]}];}return _0x4936e5[_0x45cd13[_0x7af7('0x13')]][_0x7af7('0x5')](_0x206106)[_0x7af7('0xb')](function(_0x3eb662){var _0x555e89=[];_0x3eb662[_0x7af7('0xa7')](function(_0x549a6e){var _0x397e76;switch(_0x549a6e['reportType']){case _0x7af7('0xaa'):_0x397e76=_[_0x7af7('0x90')](_0x355fc8['associatedResources'],function(_0x329bbf){return _0x329bbf['id']===_0x549a6e[_0x7af7('0xab')]&&_0x329bbf[_0x7af7('0x10')]===_0x7af7('0xac');});break;case _0x7af7('0xad'):_0x397e76=_[_0x7af7('0x90')](_0x355fc8[_0x7af7('0x6')],function(_0x2e70e6){return _0x2e70e6['id']===_0x549a6e[_0x7af7('0xab')]&&_0x2e70e6['type']===_0x7af7('0xae');});break;}if(_0x397e76)_0x555e89[_0x7af7('0x8e')](_0x549a6e);});_0x5a04d3['count']=_0x555e89[_0x7af7('0x95')];_0x5a04d3[_0x7af7('0xaf')]=_0x555e89;return _0x5a04d3;});}else{if(!_[_0x7af7('0x8d')](_0x89b986[_0x7af7('0x84')][_0x7af7('0xb0')])){_0x206106[_0x7af7('0x82')]['id']=_0x206106[_0x7af7('0x82')]['id']?_[_0x7af7('0x99')](_0x206106['where']['id'],_0x89b986[_0x7af7('0x84')][_0x7af7('0xb0')]):_0x89b986[_0x7af7('0x84')][_0x7af7('0xb0')];if(_0x89b986['query'][_0x7af7('0xb1')]){_0x206106[_0x7af7('0xa0')]=_0x89b986[_0x7af7('0x84')][_0x7af7('0xb1')];}}if(_0x89b986['query']['extraQueryConditions']){_0x206106[_0x7af7('0x82')]=_['merge'](_0x206106['where'],{'$and':_0x89b986[_0x7af7('0x84')]['extraQueryConditions']});}return _0x4936e5[_0x45cd13[_0x7af7('0x13')]][_0x7af7('0xb2')]({'where':_0x206106['where']})[_0x7af7('0xb')](function(_0x27412c){_0x5a04d3['count']=_0x27412c;if(_0x89b986['query']['includeAll']){if(_0x45cd13['childModel']===_0x7af7('0x1b')){_0x206106[_0x7af7('0xa9')]=[{'model':_0x4936e5[_0x7af7('0x6b')],'as':_0x7af7('0xb3'),'attributes':['id','name',_0x7af7('0xb4')],'required':_0x89b986[_0x7af7('0x84')]['tag']?!![]:![]},{'model':_0x4936e5[_0x7af7('0x6b')],'as':_0x7af7('0xb5'),'attributes':['id',_0x7af7('0xc'),'color'],'through':_0x89b986[_0x7af7('0x84')][_0x7af7('0xb6')]?{'attributes':[],'where':{'TagId':_0x89b986[_0x7af7('0x84')][_0x7af7('0xb6')]||undefined}}:{},'required':_0x89b986[_0x7af7('0x84')][_0x7af7('0xb6')]?!![]:![]}];}else{_0x206106[_0x7af7('0xa9')]=[{'all':!![]}];}}return _0x4936e5[_0x45cd13['childModel']][_0x7af7('0x5')](_0x206106);})[_0x7af7('0xb')](function(_0x2ee73d){_0x5a04d3[_0x7af7('0xaf')]=_0x2ee73d;if(_0x59c72c==='Agents'&&_0x89b986[_0x7af7('0x84')][_0x7af7('0xb7')]==='true'){var _0x2a7e71=[];for(var _0x278bac=0x0;_0x278bac<_0x5a04d3[_0x7af7('0xaf')][_0x7af7('0x95')];_0x278bac++){_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xb8'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac][_0x7af7('0xb9')]));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xba'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac][_0x7af7('0xb9')]));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xbb'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac]['dataValues']));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xbc'),_0x5a04d3['rows'][_0x278bac][_0x7af7('0xb9')]));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xbd'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac][_0x7af7('0xb9')]));_0x2a7e71[_0x7af7('0x8e')](_0x28c200(_0x7af7('0xbe'),_0x5a04d3[_0x7af7('0xaf')][_0x278bac][_0x7af7('0xb9')]));}return Promise['all'](_0x2a7e71)[_0x7af7('0xb')](function(){return _0x5a04d3;});}return _0x5a04d3;});}});}}});}; \ No newline at end of file +var _0xf4ed=['membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','musiconholds','VoiceMusicOnHold','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','params','all','ignore','union','length','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','options','autoAssociation','includeAll','forEach','reportType','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','CmContact','include','Tags','color','ThroughTags','tag','true','chat','sms','dataValues','fax','mail','openchannel','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','map','catch','model','associatedResources','name','resolve','then','AnalyticExtractedReport','resourceId','type','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','Agents'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xf4ed,0x8d));var _0xdf4e=function(_0x2a5262,_0x578588){_0x2a5262=_0x2a5262-0x0;var _0x483802=_0xf4ed[_0x2a5262];return _0x483802;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0xdf4e('0x0'));var squel=require(_0xdf4e('0x1'));module[_0xdf4e('0x2')]=function(_0x277618){var _0x466838=_0x277618[_0xdf4e('0x3')];function _0x753b53(_0x4cc9e2,_0x577107){return new Promise(function(_0x29a0f3,_0x22f09c){if(!_0x577107)return _0x29a0f3(null);var _0x47374e=_0x577107[_0xdf4e('0x4')]?{[_0x577107[_0xdf4e('0x4')][_0xdf4e('0x5')]]:_0x577107['filter'][_0xdf4e('0x6')]}:undefined;return _0x466838[_0x4cc9e2][_0xdf4e('0x7')]({'where':_0x47374e,'raw':!![]})['then'](function(_0x5e87ae){_0x577107['associatedResources']=_[_0xdf4e('0x8')](_0x5e87ae,'id');_0x29a0f3(_0x577107);})[_0xdf4e('0x9')](function(_0x3f08e9){_0x22f09c(_0x3f08e9);});});}function _0x5f4898(_0x1c63b0,_0x25d626){return new Promise(function(_0x2fa903,_0x173d48){var _0x5b8098=_0x1c63b0[_0xdf4e('0x4')]?{[_0x1c63b0['filter'][_0xdf4e('0x5')]]:_0x1c63b0[_0xdf4e('0x4')][_0xdf4e('0x6')]}:undefined;return _0x466838[_0x1c63b0[_0xdf4e('0xa')]][_0xdf4e('0x7')]({'where':_0x5b8098,'raw':!![]})['then'](function(_0x17782c){_0x25d626[_0xdf4e('0xb')]=_[_0xdf4e('0x8')](_0x17782c,function(_0x4a8db9){return _0x4a8db9[_0xdf4e('0xc')];});_0x2fa903(_0x25d626);})[_0xdf4e('0x9')](function(_0x29785c){_0x173d48(_0x29785c);});});}function _0x1a6308(_0x2fcf55,_0x5f4ab1,_0x296f61){if(!_0x5f4ab1)return Promise[_0xdf4e('0xd')](null);return new Promise(function(_0x110448,_0x18410b){return _0x466838['UserProfileResource'][_0xdf4e('0x7')]({'where':{'sectionId':_0x5f4ab1['id']},'raw':!![]})[_0xdf4e('0xe')](function(_0x2c1a34){if(_0x2fcf55[_0xdf4e('0x5')]&&_0x2fcf55[_0xdf4e('0x5')]!=='id'){_0x5f4ab1[_0xdf4e('0xb')]=_[_0xdf4e('0x8')](_0x2c1a34,function(_0x173c48){return _0x173c48[_0x2fcf55['field']];});}else{if(_0x296f61===_0xdf4e('0xf')){_0x5f4ab1['associatedResources']=_['map'](_0x2c1a34,function(_0x23dcd4){return{'id':_0x23dcd4[_0xdf4e('0x10')],'type':_0x23dcd4[_0xdf4e('0x11')]};});}else{_0x5f4ab1[_0xdf4e('0xb')]=_['map'](_0x2c1a34,function(_0x252062){return _0x252062[_0xdf4e('0x10')];});}}_0x110448(_0x5f4ab1);})['catch'](function(_0x33c5db){_0x18410b(_0x33c5db);});});}function _0x24f5b6(_0x3965da,_0x23da4b){var _0x2d218f={'parentSections':[]};switch(_0x3965da['toLowerCase']()){case'squareprojects':_0x2d218f['childModel']=_0xdf4e('0x12');break;case _0xdf4e('0x13'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x15');break;case _0xdf4e('0x16'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x17');_0x2d218f[_0xdf4e('0x18')]=[{'name':_0xdf4e('0x19'),'field':_0xdf4e('0xc'),'foreignKey':'projectName'}];break;case _0xdf4e('0x1a'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x1b');break;case _0xdf4e('0x1c'):_0x2d218f[_0xdf4e('0x14')]='CmContact';_0x2d218f[_0xdf4e('0x18')]=[{'name':_0xdf4e('0x1d'),'field':'id','foreignKey':_0xdf4e('0x1e')}];break;case _0xdf4e('0x1f'):_0x2d218f['childModel']='CmList';break;case _0xdf4e('0x20'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x21');break;case _0xdf4e('0x22'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x23');break;case _0xdf4e('0x24'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x25');break;case _0xdf4e('0x26'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x27');break;case _0xdf4e('0x28'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x29');break;case'faxaccounts':_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x2a');break;case'inboundroutes':case _0xdf4e('0x2b'):case _0xdf4e('0x2c'):_0x2d218f[_0xdf4e('0x14')]='VoiceExtension';break;case _0xdf4e('0x2d'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x2e');break;case _0xdf4e('0x2f'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x30');break;case'voicerecordings':_0x2d218f[_0xdf4e('0x14')]='VoiceRecording';_0x2d218f[_0xdf4e('0x18')]=[{'name':_0xdf4e('0x31'),'field':_0xdf4e('0xc'),'foreignKey':_0xdf4e('0x32'),'model':_0xdf4e('0x33'),'filter':{'field':_0xdf4e('0x34'),'value':[_0xdf4e('0x35')]}},{'name':_0xdf4e('0x36'),'field':_0xdf4e('0xc'),'foreignKey':_0xdf4e('0x32'),'model':_0xdf4e('0x33'),'filter':{'field':'role','value':[_0xdf4e('0x37')]}},{'name':_0xdf4e('0x38'),'field':_0xdf4e('0xc'),'foreignKey':_0xdf4e('0x39'),'model':_0xdf4e('0x3a'),'filter':{'field':_0xdf4e('0x11'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xdf4e('0xc'),'foreignKey':_0xdf4e('0x39'),'model':'VoiceQueue','filter':{'field':_0xdf4e('0x11'),'value':['outbound']}}];break;case _0xdf4e('0x3b'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x3c');break;case'chanspies':_0x2d218f['childModel']=_0xdf4e('0x3d');break;case'voiceprefixes':_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x3e');break;case _0xdf4e('0x3f'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x40');break;case _0xdf4e('0x41'):_0x2d218f['childModel']='MailQueue';break;case _0xdf4e('0x42'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x43');break;case'mailsubstatuses':_0x2d218f['childModel']=_0xdf4e('0x44');break;case'openchannelqueues':_0x2d218f['childModel']=_0xdf4e('0x45');break;case _0xdf4e('0x46'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x47');break;case _0xdf4e('0x48'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x49');break;case _0xdf4e('0x4a'):_0x2d218f[_0xdf4e('0x14')]='SmsAccount';break;case'whatsappqueues':_0x2d218f['childModel']=_0xdf4e('0x4b');break;case _0xdf4e('0x4c'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x4d');break;case _0xdf4e('0x4e'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x4f');break;case _0xdf4e('0x50'):case _0xdf4e('0x51'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x3a');if(_0x23da4b){_0x2d218f['parentSections']=[{'name':_0xdf4e('0x38')},{'name':_0xdf4e('0x52')}];}break;case _0xdf4e('0x53'):case _0xdf4e('0x54'):case _0xdf4e('0x55'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x33');if(_0x23da4b){_0x2d218f[_0xdf4e('0x18')]=[{'name':'Users','filter':{'field':_0xdf4e('0x34'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0xdf4e('0x36')}];}break;case _0xdf4e('0x56'):_0x2d218f['childModel']=_0xdf4e('0x57');break;case _0xdf4e('0x58'):_0x2d218f[_0xdf4e('0x14')]='SalesforceAccount';break;case _0xdf4e('0x59'):_0x2d218f['childModel']=_0xdf4e('0x5a');break;case _0xdf4e('0x5b'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x5c');break;case _0xdf4e('0x5d'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x5e');break;case'zohoaccounts':_0x2d218f[_0xdf4e('0x14')]='ZohoAccount';break;case _0xdf4e('0x5f'):_0x2d218f['childModel']=_0xdf4e('0x33');break;case _0xdf4e('0x60'):_0x2d218f['childModel']=_0xdf4e('0x61');break;case _0xdf4e('0x62'):_0x2d218f['childModel']='Disposition';break;case _0xdf4e('0x63'):_0x2d218f[_0xdf4e('0x14')]='Dashboard';break;case'intervals':_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x64');break;case _0xdf4e('0x65'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x66');break;case _0xdf4e('0x67'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x68');break;case _0xdf4e('0x69'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x6a');break;case _0xdf4e('0x6b'):_0x2d218f['childModel']=_0xdf4e('0x6c');break;case _0xdf4e('0x6d'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x6e');break;case _0xdf4e('0x6f'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x70');break;case'trunks':_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x71');break;case _0xdf4e('0x72'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x73');break;case'plugins':_0x2d218f[_0xdf4e('0x14')]='Plugin';break;case _0xdf4e('0x74'):_0x2d218f[_0xdf4e('0x14')]='AnalyticExtractedReport';_0x2d218f[_0xdf4e('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xdf4e('0x75')}];break;case _0xdf4e('0x76'):_0x2d218f[_0xdf4e('0x14')]=_0xdf4e('0x77');break;}return _0x2d218f;}function _0x1fe5b1(_0x329c7c,_0x1952d9){var _0xd3c314=_0x329c7c[_0xdf4e('0x78')](0x0)[_0xdf4e('0x79')]()+_0x329c7c[_0xdf4e('0x7a')](0x1);var _0x9aa396={'type':_0x466838[_0xdf4e('0x7b')][_0xdf4e('0x7c')][_0xdf4e('0x7d')],'raw':!![]};return new Promise(function(_0x5e4e94,_0x18f844){var _0x839f03=squel[_0xdf4e('0x7e')]()[_0xdf4e('0x5')]('ui.'+_0xd3c314+_0xdf4e('0x7f'),'id')[_0xdf4e('0x5')](_0xdf4e('0x80'))[_0xdf4e('0x81')](_0xdf4e('0x82')+_0x329c7c+_0xdf4e('0x83'),'ui')[_0xdf4e('0x84')](_0xdf4e('0x85'),_0x1952d9['id']);return _0x466838['sequelize'][_0xdf4e('0x86')](_0x839f03[_0xdf4e('0x87')](),_0x9aa396)['then'](function(_0x29f2ba){_0x1952d9[_0xd3c314+'OpenTabs']=_0x29f2ba;_0x5e4e94(_0x29f2ba);})[_0xdf4e('0x9')](function(_0x52f77){_0x18f844(_0x52f77);});});}return _0x277618['define'](_0xdf4e('0x88'),attributes,{'tableName':_0xdf4e('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4c554c){var _0x59144f={'raw':_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0x8a')],'where':{}};var _0x3caf34={};var _0x4b7e60={'count':0x0,'rows':[]};var _0xcbaf3=_0x4c554c['query'][_0xdf4e('0x8b')];var _0x20250a=_0x4c554c[_0xdf4e('0x86')]['mergeResources']||![];var _0x115a29=_0x24f5b6(_0xcbaf3,_0x20250a);if(!_0x115a29[_0xdf4e('0x14')])throw new Error(_0xdf4e('0x8c')+_0xcbaf3+'\x27');var _0x4fb71b=[{'name':_0xcbaf3}];if(!_[_0xdf4e('0x8d')](_0x115a29[_0xdf4e('0x18')]))_0x4fb71b=_0x115a29[_0xdf4e('0x18')];var _0x1c9c63=[];for(var _0x51a3c0=0x0;_0x51a3c0<_0x4fb71b['length'];_0x51a3c0++){_0x1c9c63[_0xdf4e('0x8e')](_0x466838[_0xdf4e('0x8f')][_0xdf4e('0x90')]({'where':{'userProfileId':_0x4c554c[_0xdf4e('0x91')]['id'],'name':_0x4fb71b[_0x51a3c0][_0xdf4e('0xc')]},'raw':!![]}));}return Promise[_0xdf4e('0x92')](_0x1c9c63)[_0xdf4e('0xe')](function(_0x3a9c3f){var _0x36d28c=_[_0xdf4e('0x4')](_0x3a9c3f,function(_0x4ec1cd){return _0x4ec1cd?_0x4ec1cd:undefined;});var _0x3133d3=_[_0xdf4e('0x4')](_0x4fb71b,[_0xdf4e('0x93'),!![]]);var _0x12bb48=_[_0xdf4e('0x8d')](_0x36d28c)&&_[_0xdf4e('0x8d')](_0x3133d3)?null:_[_0xdf4e('0x94')](_0x3133d3,_0x36d28c);if(!_0x12bb48)return null;var _0x2abb06=[];for(var _0x4f6d=0x0;_0x4f6d<_0x12bb48[_0xdf4e('0x95')];_0x4f6d++){var _0x1f81af=_[_0xdf4e('0x90')](_0x4fb71b,function(_0x316bec){return _0x12bb48[_0x4f6d]?_0x316bec[_0xdf4e('0xc')]===_0x12bb48[_0x4f6d][_0xdf4e('0xc')]:null;});if(_0x1f81af){if(_0x12bb48[_0x4f6d][_0xdf4e('0x93')]){_0x2abb06['push'](_0x753b53(_0x115a29[_0xdf4e('0x14')],_0x12bb48[_0x4f6d]));}else{if(!_0x12bb48[_0x4f6d]['autoAssociation']){_0x2abb06[_0xdf4e('0x8e')](_0x1a6308(_0x1f81af,_0x12bb48[_0x4f6d],_0x115a29['childModel']));}else{if(_0x1f81af[_0xdf4e('0xa')]){_0x2abb06[_0xdf4e('0x8e')](_0x5f4898(_0x1f81af,_0x12bb48[_0x4f6d]));}}}}}return Promise[_0xdf4e('0x92')](_0x2abb06);})[_0xdf4e('0xe')](function(_0x257ca2){var _0x2b7448=_0x257ca2;var _0x5cb23a=null;if(_0x2b7448){_0x5cb23a=_0x2b7448[_0xdf4e('0x95')]===0x1?_0x2b7448[0x0]:null;}if(!_0x5cb23a&&!_0x2b7448)return _0x4b7e60;var _0x1bd16a=_0x466838[_0x115a29[_0xdf4e('0x14')]]['rawAttributes'];_0x3caf34[_0xdf4e('0xa')]=_[_0xdf4e('0x96')](_0x1bd16a);_0x3caf34[_0xdf4e('0x86')]=_['keys'](_0x4c554c[_0xdf4e('0x86')]);_0x3caf34[_0xdf4e('0x97')]=_[_0xdf4e('0x98')](_0x3caf34[_0xdf4e('0xa')],_0x3caf34['query']);_0x59144f[_0xdf4e('0x99')]=_[_0xdf4e('0x98')](_0x3caf34[_0xdf4e('0xa')],qs[_0xdf4e('0x9a')](_0x4c554c[_0xdf4e('0x86')]['fields']));_0x59144f[_0xdf4e('0x99')]=_0x59144f[_0xdf4e('0x99')][_0xdf4e('0x95')]?_0x59144f['attributes']:_0x3caf34[_0xdf4e('0xa')];if(!_0x4c554c['query'][_0xdf4e('0x9b')](_0xdf4e('0x9c'))){_0x59144f[_0xdf4e('0x9d')]=qs['limit'](_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0x9d')]);_0x59144f[_0xdf4e('0x9e')]=qs[_0xdf4e('0x9e')](_0x4c554c[_0xdf4e('0x86')]['offset']);}_0x59144f[_0xdf4e('0x9f')]=qs['sort'](_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xa0')]);_0x59144f[_0xdf4e('0x84')]=qs[_0xdf4e('0x97')](_[_0xdf4e('0xa1')](_0x4c554c['query'],_0x3caf34[_0xdf4e('0x97')]));if(_0x4c554c[_0xdf4e('0x86')]['filter']){_0x59144f[_0xdf4e('0x84')]=_[_0xdf4e('0xa2')](_0x59144f[_0xdf4e('0x84')],{'$or':_[_0xdf4e('0x8')](_0x1bd16a,function(_0x2bfc25){if(_0x2bfc25[_0xdf4e('0x11')][_0xdf4e('0xa3')]!==_0xdf4e('0xa4')){var _0x57cd4f={};_0x57cd4f[_0x2bfc25[_0xdf4e('0x5')]]={'$like':'%'+_0x4c554c['query'][_0xdf4e('0x4')]+'%'};return _0x57cd4f;}})});}var _0x2fecf2=[];var _0xf4524d=null;var _0x55053b={};if(_0x5cb23a){_0xf4524d=_[_0xdf4e('0x90')](_0x4fb71b,[_0xdf4e('0xc'),_0x5cb23a[_0xdf4e('0xc')]]);if(_0xf4524d['field']){_0x55053b={};if(_0x115a29[_0xdf4e('0x14')]==='AnalyticExtractedReport'){_0x55053b[_0xf4524d['foreignKey']]=_['map'](_0x5cb23a[_0xdf4e('0xb')],'id');}else{_0x55053b[_0xf4524d[_0xdf4e('0xa5')]]=_0x5cb23a['associatedResources'];}_0x2fecf2[_0xdf4e('0x8e')](_0x55053b);}else{_0x59144f[_0xdf4e('0x84')]['id']=_0x5cb23a[_0xdf4e('0xb')];}}else{for(var _0x4acb00=0x0;_0x4acb00<_0x2b7448['length'];_0x4acb00++){_0xf4524d=_[_0xdf4e('0x90')](_0x4fb71b,[_0xdf4e('0xc'),_0x2b7448[_0x4acb00][_0xdf4e('0xc')]]);if(_0xf4524d[_0xdf4e('0x5')]){_0x55053b={};_0x55053b[_0xf4524d[_0xdf4e('0xa5')]]=_0x2b7448[_0x4acb00][_0xdf4e('0xb')];_0x2fecf2[_0xdf4e('0x8e')](_0x55053b);}else{if(!_0x59144f[_0xdf4e('0x84')]['id'])_0x59144f['where']['id']=[];_0x2b7448[_0x4acb00][_0xdf4e('0xb')]['forEach'](function(_0xab81f9){_0x59144f['where']['id'][_0xdf4e('0x8e')](_0xab81f9);});}}}if(!_[_0xdf4e('0x8d')](_0x2fecf2)){_0x59144f[_0xdf4e('0x84')]=_['merge'](_0x59144f['where'],{'$and':{'$or':_0x2fecf2}});}_0x59144f=_[_0xdf4e('0xa2')]({},_0x59144f,_0x4c554c[_0xdf4e('0xa6')]);if(_0x5cb23a&&!_0x5cb23a[_0xdf4e('0xa7')]&&_0x115a29[_0xdf4e('0x14')]===_0xdf4e('0xf')){if(_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xa8')]){_0x59144f['include']=[{'all':!![]}];}return _0x466838[_0x115a29[_0xdf4e('0x14')]][_0xdf4e('0x7')](_0x59144f)['then'](function(_0xa145f4){var _0x417f92=[];_0xa145f4[_0xdf4e('0xa9')](function(_0x5779c){var _0x55e302;switch(_0x5779c[_0xdf4e('0xaa')]){case'default':_0x55e302=_[_0xdf4e('0x90')](_0x5cb23a['associatedResources'],function(_0x181fed){return _0x181fed['id']===_0x5779c[_0xdf4e('0x75')]&&_0x181fed[_0xdf4e('0x11')]===_0xdf4e('0xab');});break;case _0xdf4e('0xac'):_0x55e302=_['find'](_0x5cb23a[_0xdf4e('0xb')],function(_0x1f4d2a){return _0x1f4d2a['id']===_0x5779c[_0xdf4e('0x75')]&&_0x1f4d2a[_0xdf4e('0x11')]===_0xdf4e('0xad');});break;}if(_0x55e302)_0x417f92[_0xdf4e('0x8e')](_0x5779c);});_0x4b7e60['count']=_0x417f92['length'];_0x4b7e60[_0xdf4e('0xae')]=_0x417f92;return _0x4b7e60;});}else{if(!_[_0xdf4e('0x8d')](_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xaf')])){_0x59144f[_0xdf4e('0x84')]['id']=_0x59144f[_0xdf4e('0x84')]['id']?_['intersection'](_0x59144f[_0xdf4e('0x84')]['id'],_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xaf')]):_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xaf')];if(_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xb0')]){_0x59144f[_0xdf4e('0x9f')]=_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xb0')];}}if(_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xb1')]){_0x59144f['where']=_[_0xdf4e('0xa2')](_0x59144f[_0xdf4e('0x84')],{'$and':_0x4c554c['query'][_0xdf4e('0xb1')]});}return _0x466838[_0x115a29[_0xdf4e('0x14')]]['count']({'where':_0x59144f[_0xdf4e('0x84')]})[_0xdf4e('0xe')](function(_0x55e2b3){_0x4b7e60['count']=_0x55e2b3;if(_0x4c554c['query'][_0xdf4e('0xa8')]){if(_0x115a29[_0xdf4e('0x14')]===_0xdf4e('0xb2')){_0x59144f[_0xdf4e('0xb3')]=[{'model':_0x466838[_0xdf4e('0x6c')],'as':_0xdf4e('0xb4'),'attributes':['id',_0xdf4e('0xc'),_0xdf4e('0xb5')],'required':_0x4c554c['query']['tag']?!![]:![]},{'model':_0x466838[_0xdf4e('0x6c')],'as':_0xdf4e('0xb6'),'attributes':['id',_0xdf4e('0xc'),_0xdf4e('0xb5')],'through':_0x4c554c['query'][_0xdf4e('0xb7')]?{'attributes':[],'where':{'TagId':_0x4c554c[_0xdf4e('0x86')][_0xdf4e('0xb7')]||undefined}}:{},'required':_0x4c554c['query'][_0xdf4e('0xb7')]?!![]:![]}];}else{_0x59144f[_0xdf4e('0xb3')]=[{'all':!![]}];}}return _0x466838[_0x115a29[_0xdf4e('0x14')]][_0xdf4e('0x7')](_0x59144f);})['then'](function(_0x596478){_0x4b7e60[_0xdf4e('0xae')]=_0x596478;if(_0xcbaf3===_0xdf4e('0x31')&&_0x4c554c[_0xdf4e('0x86')]['openTabs']===_0xdf4e('0xb8')){var _0x395063=[];for(var _0x59e1ce=0x0;_0x59e1ce<_0x4b7e60[_0xdf4e('0xae')][_0xdf4e('0x95')];_0x59e1ce++){_0x395063['push'](_0x1fe5b1(_0xdf4e('0xb9'),_0x4b7e60['rows'][_0x59e1ce]['dataValues']));_0x395063[_0xdf4e('0x8e')](_0x1fe5b1(_0xdf4e('0xba'),_0x4b7e60[_0xdf4e('0xae')][_0x59e1ce][_0xdf4e('0xbb')]));_0x395063[_0xdf4e('0x8e')](_0x1fe5b1(_0xdf4e('0xbc'),_0x4b7e60['rows'][_0x59e1ce]['dataValues']));_0x395063[_0xdf4e('0x8e')](_0x1fe5b1(_0xdf4e('0xbd'),_0x4b7e60[_0xdf4e('0xae')][_0x59e1ce][_0xdf4e('0xbb')]));_0x395063[_0xdf4e('0x8e')](_0x1fe5b1(_0xdf4e('0xbe'),_0x4b7e60[_0xdf4e('0xae')][_0x59e1ce]['dataValues']));_0x395063[_0xdf4e('0x8e')](_0x1fe5b1('whatsapp',_0x4b7e60[_0xdf4e('0xae')][_0x59e1ce][_0xdf4e('0xbb')]));}return Promise[_0xdf4e('0x92')](_0x395063)[_0xdf4e('0xe')](function(){return _0x4b7e60;});}return _0x4b7e60;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 398ac1f..39b5d70 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 _0xdbcd=['stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','socket.io-emitter','redis','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xdbcd,0x1ba));var _0xddbc=function(_0x5bb223,_0x64db26){_0x5bb223=_0x5bb223-0x0;var _0x15bae2=_0xdbcd[_0x5bb223];return _0x15bae2;};'use strict';var _=require(_0xddbc('0x0'));var util=require(_0xddbc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddbc('0x2'));var fs=require('fs');var Redis=require(_0xddbc('0x3'));var db=require(_0xddbc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xddbc('0x5'))(_0xddbc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xddbc('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xddbc('0x8'))(new Redis(config[_0xddbc('0x9')]));require(_0xddbc('0xa'))[_0xddbc('0xb')](socket);function respondWithRpcPromise(_0x51d156,_0x4f90a9,_0x236a29){return new BPromise(function(_0x5e8424,_0x13b8f6){return client['request'](_0x51d156,_0x236a29)[_0xddbc('0xc')](function(_0x3a7f29){logger[_0xddbc('0xd')](_0xddbc('0xe'),_0x4f90a9,_0xddbc('0xf'));logger[_0xddbc('0x10')](_0xddbc('0x11'),_0x4f90a9,_0xddbc('0xf'),JSON[_0xddbc('0x12')](_0x3a7f29));if(_0x3a7f29[_0xddbc('0x13')]){if(_0x3a7f29[_0xddbc('0x13')][_0xddbc('0x14')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x4f90a9,_0x3a7f29[_0xddbc('0x13')][_0xddbc('0x15')]);return _0x13b8f6(_0x3a7f29['error']['message']);}logger[_0xddbc('0x13')](_0xddbc('0xe'),_0x4f90a9,_0x3a7f29[_0xddbc('0x13')][_0xddbc('0x15')]);return _0x5e8424(_0x3a7f29['error']['message']);}else{logger[_0xddbc('0xd')](_0xddbc('0xe'),_0x4f90a9,'request\x20sent');_0x5e8424(_0x3a7f29['result']['message']);}})[_0xddbc('0x16')](function(_0x48513e){logger[_0xddbc('0x13')](_0xddbc('0xe'),_0x4f90a9,_0x48513e);_0x13b8f6(_0x48513e);});});} \ No newline at end of file +var _0x4745=['then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request'];(function(_0x236487,_0x39046f){var _0x1c64cc=function(_0x5e1bfb){while(--_0x5e1bfb){_0x236487['push'](_0x236487['shift']());}};_0x1c64cc(++_0x39046f);}(_0x4745,0x1e7));var _0x5474=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x4745[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var BPromise=require(_0x5474('0x3'));var rs=require(_0x5474('0x4'));var fs=require('fs');var Redis=require(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var utils=require(_0x5474('0x7'));var logger=require(_0x5474('0x8'))(_0x5474('0x9'));var config=require(_0x5474('0xa'));var jayson=require(_0x5474('0xb'));var client=jayson['client'][_0x5474('0xc')]({'port':0x232a});config[_0x5474('0xd')]=_['defaults'](config[_0x5474('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5474('0xe'))(new Redis(config[_0x5474('0xd')]));require('./userProfile.socket')[_0x5474('0xf')](socket);function respondWithRpcPromise(_0x11dcb2,_0x46b4b3,_0x26cceb){return new BPromise(function(_0x4444dd,_0x40c4a8){return client[_0x5474('0x10')](_0x11dcb2,_0x26cceb)[_0x5474('0x11')](function(_0x48fc51){logger[_0x5474('0x12')](_0x5474('0x13'),_0x46b4b3,_0x5474('0x14'));logger[_0x5474('0x15')](_0x5474('0x16'),_0x46b4b3,_0x5474('0x14'),JSON[_0x5474('0x17')](_0x48fc51));if(_0x48fc51[_0x5474('0x18')]){if(_0x48fc51[_0x5474('0x18')]['code']===0x1f4){logger[_0x5474('0x18')](_0x5474('0x13'),_0x46b4b3,_0x48fc51[_0x5474('0x18')][_0x5474('0x19')]);return _0x40c4a8(_0x48fc51['error']['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x46b4b3,_0x48fc51[_0x5474('0x18')][_0x5474('0x19')]);return _0x4444dd(_0x48fc51[_0x5474('0x18')]['message']);}else{logger[_0x5474('0x12')](_0x5474('0x13'),_0x46b4b3,'request\x20sent');_0x4444dd(_0x48fc51[_0x5474('0x1a')][_0x5474('0x19')]);}})[_0x5474('0x1b')](function(_0x469d62){logger[_0x5474('0x18')]('UserProfile,\x20%s,\x20%s',_0x46b4b3,_0x469d62);_0x40c4a8(_0x469d62);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b1d62fd..60f17f5 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 _0x283a=['userProfile:','./userProfile.events','save','remove','removeListener','register','length'];(function(_0x18e896,_0x20d09b){var _0xfdd727=function(_0x258493){while(--_0x258493){_0x18e896['push'](_0x18e896['shift']());}};_0xfdd727(++_0x20d09b);}(_0x283a,0xf6));var _0xa283=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x283a[_0x3826ad];return _0x17b900;};'use strict';var UserProfileEvents=require(_0xa283('0x0'));var events=[_0xa283('0x1'),_0xa283('0x2'),'update'];function createListener(_0x36dc84,_0x22981f){return function(_0x2e99c4){_0x22981f['emit'](_0x36dc84,_0x2e99c4);};}function removeListener(_0x506419,_0x155346){return function(){UserProfileEvents[_0xa283('0x3')](_0x506419,_0x155346);};}exports[_0xa283('0x4')]=function(_0x3cd5c5){for(var _0x30ecda=0x0,_0x495d89=events[_0xa283('0x5')];_0x30ecda<_0x495d89;_0x30ecda++){var _0x36e10d=events[_0x30ecda];var _0x261da5=createListener(_0xa283('0x6')+_0x36e10d,_0x3cd5c5);UserProfileEvents['on'](_0x36e10d,_0x261da5);}}; \ No newline at end of file +var _0x9427=['save','remove','update','removeListener','register','length','./userProfile.events'];(function(_0x221813,_0x589c75){var _0x1769c6=function(_0x21fc49){while(--_0x21fc49){_0x221813['push'](_0x221813['shift']());}};_0x1769c6(++_0x589c75);}(_0x9427,0x110));var _0x7942=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9427[_0x40a045];return _0x1a687c;};'use strict';var UserProfileEvents=require(_0x7942('0x0'));var events=[_0x7942('0x1'),_0x7942('0x2'),_0x7942('0x3')];function createListener(_0x279c52,_0x43b488){return function(_0x302e6c){_0x43b488['emit'](_0x279c52,_0x302e6c);};}function removeListener(_0x38f790,_0x36cd5b){return function(){UserProfileEvents[_0x7942('0x4')](_0x38f790,_0x36cd5b);};}exports[_0x7942('0x5')]=function(_0x14c52c){for(var _0x182841=0x0,_0x104283=events[_0x7942('0x6')];_0x182841<_0x104283;_0x182841++){var _0x21d365=events[_0x182841];var _0x387ef8=createListener('userProfile:'+_0x21d365,_0x14c52c);UserProfileEvents['on'](_0x21d365,_0x387ef8);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c07dc0e..9dfe280 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 _0xe92b=['isAuthenticated','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x29bcc3,_0x4dd6cc){var _0x1b6655=function(_0x4f1ddf){while(--_0x4f1ddf){_0x29bcc3['push'](_0x29bcc3['shift']());}};_0x1b6655(++_0x4dd6cc);}(_0xe92b,0xb2));var _0xbe92=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xe92b[_0x1a8bbc];return _0x212fc2;};'use strict';var multer=require(_0xbe92('0x0'));var util=require(_0xbe92('0x1'));var path=require(_0xbe92('0x2'));var timeout=require(_0xbe92('0x3'));var express=require('express');var router=express[_0xbe92('0x4')]();var fs_extra=require(_0xbe92('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe92('0x6'));var config=require(_0xbe92('0x7'));var controller=require('./userProfileResource.controller');router[_0xbe92('0x8')]('/',auth[_0xbe92('0x9')](),controller['index']);router[_0xbe92('0x8')]('/describe',auth[_0xbe92('0x9')](),controller['describe']);router['get'](_0xbe92('0xa'),auth[_0xbe92('0x9')](),controller[_0xbe92('0xb')]);router[_0xbe92('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbe92('0xd')](_0xbe92('0xa'),auth['isAuthenticated'](),controller[_0xbe92('0xe')]);router[_0xbe92('0xf')](_0xbe92('0xa'),auth[_0xbe92('0x9')](),controller['destroy']);module[_0xbe92('0x10')]=router; \ No newline at end of file +var _0x7136=['get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7136,0x13d));var _0x6713=function(_0x4d4356,_0x27f883){_0x4d4356=_0x4d4356-0x0;var _0x232113=_0x7136[_0x4d4356];return _0x232113;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6713('0x0'));var express=require(_0x6713('0x1'));var router=express[_0x6713('0x2')]();var fs_extra=require(_0x6713('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6713('0x4'));var config=require(_0x6713('0x5'));var controller=require('./userProfileResource.controller');router[_0x6713('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6713('0x6')](_0x6713('0x7'),auth[_0x6713('0x8')](),controller[_0x6713('0x9')]);router['get'](_0x6713('0xa'),auth[_0x6713('0x8')](),controller['show']);router[_0x6713('0xb')]('/',auth[_0x6713('0x8')](),controller[_0x6713('0xc')]);router[_0x6713('0xd')](_0x6713('0xa'),auth[_0x6713('0x8')](),controller[_0x6713('0xe')]);router[_0x6713('0xf')](_0x6713('0xa'),auth[_0x6713('0x8')](),controller['destroy']);module[_0x6713('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index b5bce30..5822bee 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 _0x7c92=['exports','STRING','INTEGER'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x7c92,0x150));var _0x27c9=function(_0x57da94,_0x432a4c){_0x57da94=_0x57da94-0x0;var _0x514aea=_0x7c92[_0x57da94];return _0x514aea;};'use strict';var Sequelize=require('sequelize');module[_0x27c9('0x0')]={'name':{'type':Sequelize[_0x27c9('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x27c9('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xccdc=['sequelize','exports','STRING'];(function(_0x4f2495,_0x63fcdc){var _0x17b6f5=function(_0x186316){while(--_0x186316){_0x4f2495['push'](_0x4f2495['shift']());}};_0x17b6f5(++_0x63fcdc);}(_0xccdc,0xcf));var _0xcccd=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xccdc[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0xcccd('0x0'));module[_0xcccd('0x1')]={'name':{'type':Sequelize[_0xcccd('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index fa3bacb..9936a65 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 _0x1a37=['index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x1a37[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file +var _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x41699c,_0x317092){var _0xb1e0ad=function(_0x205f83){while(--_0x205f83){_0x41699c['push'](_0x41699c['shift']());}};_0xb1e0ad(++_0x317092);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1d3a66c..7693ef1 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 _0x4bea=['resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','path','define','user_profile_has_resources','compositeIndex'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x4bea,0x7a));var _0xa4be=function(_0x259ccc,_0xa5fb99){_0x259ccc=_0x259ccc-0x0;var _0x353a33=_0x4bea[_0x259ccc];return _0x353a33;};'use strict';var _=require(_0xa4be('0x0'));var util=require(_0xa4be('0x1'));var logger=require(_0xa4be('0x2'))(_0xa4be('0x3'));var moment=require('moment');var BPromise=require(_0xa4be('0x4'));var rp=require(_0xa4be('0x5'));var fs=require('fs');var path=require(_0xa4be('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x7a144e,_0x51ef99){return _0x7a144e[_0xa4be('0x7')]('UserProfileResource',attributes,{'tableName':_0xa4be('0x8'),'paranoid':![],'indexes':[{'name':_0xa4be('0x9'),'fields':[_0xa4be('0xa'),_0xa4be('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa00b=['path','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5a0247,_0x8d91d8){var _0x2c29a3=function(_0x30ab39){while(--_0x30ab39){_0x5a0247['push'](_0x5a0247['shift']());}};_0x2c29a3(++_0x8d91d8);}(_0xa00b,0x6a));var _0xba00=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa00b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xba00('0x0'));var util=require(_0xba00('0x1'));var logger=require(_0xba00('0x2'))(_0xba00('0x3'));var moment=require(_0xba00('0x4'));var BPromise=require(_0xba00('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba00('0x6'));var rimraf=require('rimraf');var config=require(_0xba00('0x7'));var attributes=require('./userProfileResource.attributes');module[_0xba00('0x8')]=function(_0x2b95f7,_0x21fcda){return _0x2b95f7[_0xba00('0x9')](_0xba00('0xa'),attributes,{'tableName':_0xba00('0xb'),'paranoid':![],'indexes':[{'name':_0xba00('0xc'),'fields':[_0xba00('0xd'),'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 a42e3d4..bb77280 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 _0x93d9=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x39d3ce,_0x20c8a8){var _0xab780b=function(_0x3594f3){while(--_0x3594f3){_0x39d3ce['push'](_0x39d3ce['shift']());}};_0xab780b(++_0x20c8a8);}(_0x93d9,0xf7));var _0x993d=function(_0x130f5d,_0x422e9e){_0x130f5d=_0x130f5d-0x0;var _0x425398=_0x93d9[_0x130f5d];return _0x425398;};'use strict';var _=require('lodash');var util=require(_0x993d('0x0'));var moment=require(_0x993d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x993d('0x2'))['db'];var utils=require(_0x993d('0x3'));var logger=require(_0x993d('0x4'))('rpc');var config=require(_0x993d('0x5'));var jayson=require(_0x993d('0x6'));var client=jayson[_0x993d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23f050,_0x219fe3,_0x33bc7c){return new BPromise(function(_0x370c85,_0x19aeac){return client[_0x993d('0x8')](_0x23f050,_0x33bc7c)[_0x993d('0x9')](function(_0x4867b4){logger['info'](_0x993d('0xa'),_0x219fe3,_0x993d('0xb'));logger[_0x993d('0xc')](_0x993d('0xd'),_0x219fe3,_0x993d('0xb'),JSON[_0x993d('0xe')](_0x4867b4));if(_0x4867b4['error']){if(_0x4867b4[_0x993d('0xf')]['code']===0x1f4){logger[_0x993d('0xf')](_0x993d('0xa'),_0x219fe3,_0x4867b4[_0x993d('0xf')][_0x993d('0x10')]);return _0x19aeac(_0x4867b4['error'][_0x993d('0x10')]);}logger[_0x993d('0xf')](_0x993d('0xa'),_0x219fe3,_0x4867b4[_0x993d('0xf')][_0x993d('0x10')]);return _0x370c85(_0x4867b4[_0x993d('0xf')][_0x993d('0x10')]);}else{logger[_0x993d('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x219fe3,'request\x20sent');_0x370c85(_0x4867b4[_0x993d('0x12')][_0x993d('0x10')]);}})[_0x993d('0x13')](function(_0x1c50fc){logger[_0x993d('0xf')](_0x993d('0xa'),_0x219fe3,_0x1c50fc);_0x19aeac(_0x1c50fc);});});} \ No newline at end of file +var _0x500f=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x1551bc,_0x334b59){var _0x228deb=function(_0x15551d){while(--_0x15551d){_0x1551bc['push'](_0x1551bc['shift']());}};_0x228deb(++_0x334b59);}(_0x500f,0x7a));var _0xf500=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0x500f[_0x47e93d];return _0xe86c46;};'use strict';var _=require(_0xf500('0x0'));var util=require(_0xf500('0x1'));var moment=require(_0xf500('0x2'));var BPromise=require(_0xf500('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf500('0x4'));var db=require(_0xf500('0x5'))['db'];var utils=require(_0xf500('0x6'));var logger=require(_0xf500('0x7'))('rpc');var config=require(_0xf500('0x8'));var jayson=require(_0xf500('0x9'));var client=jayson[_0xf500('0xa')][_0xf500('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54fd17,_0x1c5e27,_0x3415bc){return new BPromise(function(_0x361084,_0x4c74cd){return client['request'](_0x54fd17,_0x3415bc)[_0xf500('0xc')](function(_0x5856bb){logger[_0xf500('0xd')](_0xf500('0xe'),_0x1c5e27,_0xf500('0xf'));logger['debug'](_0xf500('0x10'),_0x1c5e27,'request\x20sent',JSON[_0xf500('0x11')](_0x5856bb));if(_0x5856bb['error']){if(_0x5856bb[_0xf500('0x12')][_0xf500('0x13')]===0x1f4){logger['error'](_0xf500('0xe'),_0x1c5e27,_0x5856bb[_0xf500('0x12')][_0xf500('0x14')]);return _0x4c74cd(_0x5856bb[_0xf500('0x12')][_0xf500('0x14')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x1c5e27,_0x5856bb[_0xf500('0x12')][_0xf500('0x14')]);return _0x361084(_0x5856bb[_0xf500('0x12')]['message']);}else{logger[_0xf500('0xd')](_0xf500('0xe'),_0x1c5e27,'request\x20sent');_0x361084(_0x5856bb[_0xf500('0x15')][_0xf500('0x14')]);}})[_0xf500('0x16')](function(_0x5a6320){logger['error'](_0xf500('0xe'),_0x1c5e27,_0x5a6320);_0x4c74cd(_0x5a6320);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 3e6a136..14305f6 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 _0xba86=['./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1574c7,_0xb0dac4){var _0x2b797e=function(_0x65d572){while(--_0x65d572){_0x1574c7['push'](_0x1574c7['shift']());}};_0x2b797e(++_0xb0dac4);}(_0xba86,0x128));var _0x6ba8=function(_0x5ad6b9,_0x13d6d4){_0x5ad6b9=_0x5ad6b9-0x0;var _0x4a42ca=_0xba86[_0x5ad6b9];return _0x4a42ca;};'use strict';var multer=require(_0x6ba8('0x0'));var util=require('util');var path=require(_0x6ba8('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ba8('0x2'));var router=express[_0x6ba8('0x3')]();var fs_extra=require(_0x6ba8('0x4'));var auth=require(_0x6ba8('0x5'));var interaction=require(_0x6ba8('0x6'));var config=require(_0x6ba8('0x7'));var controller=require(_0x6ba8('0x8'));router[_0x6ba8('0x9')]('/',auth[_0x6ba8('0xa')](),controller[_0x6ba8('0xb')]);router[_0x6ba8('0x9')]('/describe',auth[_0x6ba8('0xa')](),controller[_0x6ba8('0xc')]);router[_0x6ba8('0x9')](_0x6ba8('0xd'),auth[_0x6ba8('0xa')](),controller['show']);router[_0x6ba8('0xe')]('/',auth['isAuthenticated'](),controller[_0x6ba8('0xf')]);router['put'](_0x6ba8('0xd'),auth[_0x6ba8('0xa')](),controller[_0x6ba8('0x10')]);router[_0x6ba8('0x11')](_0x6ba8('0xd'),auth[_0x6ba8('0xa')](),controller['destroy']);module[_0x6ba8('0x12')]=router; \ No newline at end of file +var _0x8735=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x4a83cf,_0x3aaaa2){var _0x235d2a=function(_0x33f315){while(--_0x33f315){_0x4a83cf['push'](_0x4a83cf['shift']());}};_0x235d2a(++_0x3aaaa2);}(_0x8735,0xd5));var _0x5873=function(_0x538738,_0x3554e6){_0x538738=_0x538738-0x0;var _0x34a3f1=_0x8735[_0x538738];return _0x34a3f1;};'use strict';var multer=require(_0x5873('0x0'));var util=require(_0x5873('0x1'));var path=require(_0x5873('0x2'));var timeout=require(_0x5873('0x3'));var express=require('express');var router=express[_0x5873('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5873('0x5'));var config=require(_0x5873('0x6'));var controller=require(_0x5873('0x7'));router[_0x5873('0x8')]('/',auth[_0x5873('0x9')](),controller[_0x5873('0xa')]);router['get'](_0x5873('0xb'),auth[_0x5873('0x9')](),controller[_0x5873('0xc')]);router['get'](_0x5873('0xd'),auth[_0x5873('0x9')](),controller[_0x5873('0xe')]);router[_0x5873('0xf')]('/',auth[_0x5873('0x9')](),controller[_0x5873('0x10')]);router[_0x5873('0x11')](_0x5873('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5873('0x12')](_0x5873('0xd'),auth[_0x5873('0x9')](),controller[_0x5873('0x13')]);module[_0x5873('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 82c30fd..e621927 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 _0x3c81=['join','getDataValue','sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions'];(function(_0x51c237,_0x45a050){var _0x54beb3=function(_0x4c1dd4){while(--_0x4c1dd4){_0x51c237['push'](_0x51c237['shift']());}};_0x54beb3(++_0x45a050);}(_0x3c81,0x102));var _0x13c8=function(_0x1fd668,_0xde7652){_0x1fd668=_0x1fd668-0x0;var _0x2e3d3e=_0x3c81[_0x1fd668];return _0x2e3d3e;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x13c8('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x13c8('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x548599){this[_0x13c8('0x4')](_0x13c8('0x5'),_0x548599?_0x548599[_0x13c8('0x6')](''):[]);},'get':function(){return this[_0x13c8('0x7')](_0x13c8('0x5'))?this[_0x13c8('0x7')](_0x13c8('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0x0b0e=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize'];(function(_0x28e937,_0x31913c){var _0x389d9e=function(_0x5af49a){while(--_0x5af49a){_0x28e937['push'](_0x28e937['shift']());}};_0x389d9e(++_0x31913c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x384d39,_0xf060fc){_0x384d39=_0x384d39-0x0;var _0x13bf22=_0x0b0e[_0x384d39];return _0x13bf22;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe0b0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe0b0('0x1')],'set':function(_0x28040c){this[_0xe0b0('0x4')](_0xe0b0('0x5'),_0x28040c?_0x28040c[_0xe0b0('0x6')](''):[]);},'get':function(){return this[_0xe0b0('0x7')](_0xe0b0('0x5'))?this[_0xe0b0('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6f4ace1..7442328 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 _0x7882=['intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','include','findAll','rows','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','filters'];(function(_0x3dd5f5,_0x1ee4ca){var _0x5d16ce=function(_0x260949){while(--_0x260949){_0x3dd5f5['push'](_0x3dd5f5['shift']());}};_0x5d16ce(++_0x1ee4ca);}(_0x7882,0x1ea));var _0x2788=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x7882[_0x450689];return _0x46ffb0;};'use strict';var emlformat=require(_0x2788('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2788('0x1'));var jsonpatch=require(_0x2788('0x2'));var rp=require(_0x2788('0x3'));var moment=require('moment');var BPromise=require(_0x2788('0x4'));var Mustache=require(_0x2788('0x5'));var util=require(_0x2788('0x6'));var path=require(_0x2788('0x7'));var sox=require(_0x2788('0x8'));var csv=require('to-csv');var ejs=require(_0x2788('0x9'));var fs=require('fs');var fs_extra=require(_0x2788('0xa'));var _=require(_0x2788('0xb'));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(_0x2788('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2788('0x16'))(_0x2788('0x17'));var utils=require(_0x2788('0x18'));var config=require(_0x2788('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2788('0x1a'))['db'];function respondWithStatusCode(_0x1e48ce,_0x418c03){_0x418c03=_0x418c03||0xcc;return function(_0x22c4e7){if(_0x22c4e7){return _0x1e48ce[_0x2788('0x1b')](_0x418c03);}return _0x1e48ce['status'](_0x418c03)[_0x2788('0x1c')]();};}function respondWithResult(_0x3780f6,_0x4fd9c2){_0x4fd9c2=_0x4fd9c2||0xc8;return function(_0x389d4d){if(_0x389d4d){return _0x3780f6[_0x2788('0x1d')](_0x4fd9c2)['json'](_0x389d4d);}};}function respondWithFilteredResult(_0x17ae26,_0x4e5e88){return function(_0x9e308f){if(_0x9e308f){var _0x3c97c6=typeof _0x4e5e88['offset']===_0x2788('0x1e')&&typeof _0x4e5e88['limit']===_0x2788('0x1e');var _0x3abace=_0x9e308f['count'];var _0x254a1b=_0x3c97c6?0x0:_0x4e5e88[_0x2788('0x1f')];var _0x2173db=_0x3c97c6?_0x9e308f[_0x2788('0x20')]:_0x4e5e88['offset']+_0x4e5e88[_0x2788('0x21')];var _0x3eb86a;if(_0x2173db>=_0x3abace){_0x2173db=_0x3abace;_0x3eb86a=0xc8;}else{_0x3eb86a=0xce;}_0x17ae26[_0x2788('0x1d')](_0x3eb86a);return _0x17ae26[_0x2788('0x22')](_0x2788('0x23'),_0x254a1b+'-'+_0x2173db+'/'+_0x3abace)['json'](_0x9e308f);}return null;};}function patchUpdates(_0xffe07){return function(_0x3088c0){try{jsonpatch[_0x2788('0x24')](_0x3088c0,_0xffe07,!![]);}catch(_0x25eaa4){return BPromise[_0x2788('0x25')](_0x25eaa4);}return _0x3088c0[_0x2788('0x26')]();};}function saveUpdates(_0x347d8e,_0x19ff14){return function(_0x4a48a3){if(_0x4a48a3){return _0x4a48a3[_0x2788('0x27')](_0x347d8e)[_0x2788('0x28')](function(_0x10a543){return _0x10a543;});}return null;};}function removeEntity(_0x6f732f,_0xf1edce){return function(_0x36c8fd){if(_0x36c8fd){return _0x36c8fd[_0x2788('0x29')]()['then'](function(){_0x6f732f[_0x2788('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4df689,_0x136f20){return function(_0x3df005){if(!_0x3df005){_0x4df689[_0x2788('0x1b')](0x194);}return _0x3df005;};}function handleError(_0x1b0b38,_0x7fda4){_0x7fda4=_0x7fda4||0x1f4;return function(_0x5aaba1){logger[_0x2788('0x2a')](_0x5aaba1[_0x2788('0x2b')]);if(_0x5aaba1[_0x2788('0x2c')]){delete _0x5aaba1['name'];}_0x1b0b38['status'](_0x7fda4)[_0x2788('0x2d')](_0x5aaba1);};}exports[_0x2788('0x2e')]=function(_0x37e4ff,_0x173260){var _0x19d7d7={},_0x3ba648={},_0x4e94e7={'count':0x0,'rows':[]};var _0x242d60=_[_0x2788('0x2f')](db[_0x2788('0x30')][_0x2788('0x31')],function(_0x257847){return{'name':_0x257847[_0x2788('0x32')],'type':_0x257847[_0x2788('0x33')][_0x2788('0x34')]};});_0x3ba648[_0x2788('0x35')]=_[_0x2788('0x2f')](_0x242d60,'name');_0x3ba648['query']=_[_0x2788('0x36')](_0x37e4ff['query']);_0x3ba648[_0x2788('0x37')]=_[_0x2788('0x38')](_0x3ba648[_0x2788('0x35')],_0x3ba648[_0x2788('0x39')]);_0x19d7d7[_0x2788('0x3a')]=_[_0x2788('0x38')](_0x3ba648[_0x2788('0x35')],qs[_0x2788('0x3b')](_0x37e4ff[_0x2788('0x39')]['fields']));_0x19d7d7['attributes']=_0x19d7d7[_0x2788('0x3a')][_0x2788('0x3c')]?_0x19d7d7[_0x2788('0x3a')]:_0x3ba648[_0x2788('0x35')];if(!_0x37e4ff[_0x2788('0x39')][_0x2788('0x3d')](_0x2788('0x3e'))){_0x19d7d7[_0x2788('0x21')]=qs[_0x2788('0x21')](_0x37e4ff[_0x2788('0x39')]['limit']);_0x19d7d7[_0x2788('0x1f')]=qs[_0x2788('0x1f')](_0x37e4ff[_0x2788('0x39')]['offset']);}_0x19d7d7[_0x2788('0x3f')]=qs['sort'](_0x37e4ff[_0x2788('0x39')]['sort']);_0x19d7d7['where']=qs[_0x2788('0x37')](_[_0x2788('0x40')](_0x37e4ff['query'],_0x3ba648['filters']),_0x242d60);if(_0x37e4ff[_0x2788('0x39')][_0x2788('0x41')]){_0x19d7d7[_0x2788('0x42')]=_[_0x2788('0x43')](_0x19d7d7[_0x2788('0x42')],{'$or':_['map'](_0x242d60,function(_0x277e69){if(_0x277e69['type']!=='VIRTUAL'){var _0x51c339={};_0x51c339[_0x277e69[_0x2788('0x2c')]]={'$like':'%'+_0x37e4ff['query'][_0x2788('0x41')]+'%'};return _0x51c339;}})});}_0x19d7d7=_[_0x2788('0x43')]({},_0x19d7d7,_0x37e4ff['options']);var _0x65f299={'where':_0x19d7d7[_0x2788('0x42')]};return db[_0x2788('0x30')][_0x2788('0x20')](_0x65f299)[_0x2788('0x28')](function(_0x2003de){_0x4e94e7['count']=_0x2003de;if(_0x37e4ff['query']['includeAll']){_0x19d7d7[_0x2788('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0x2788('0x45')](_0x19d7d7);})['then'](function(_0x2f7d25){_0x4e94e7[_0x2788('0x46')]=_0x2f7d25;return _0x4e94e7;})[_0x2788('0x28')](respondWithFilteredResult(_0x173260,_0x19d7d7))['catch'](handleError(_0x173260,null));};exports['show']=function(_0x582ecf,_0x3b3be1){var _0x825dc5={'raw':![],'where':{'id':_0x582ecf[_0x2788('0x47')]['id']}},_0xe88104={};_0xe88104[_0x2788('0x35')]=_[_0x2788('0x36')](db[_0x2788('0x30')]['rawAttributes']);_0xe88104['query']=_[_0x2788('0x36')](_0x582ecf[_0x2788('0x39')]);_0xe88104[_0x2788('0x37')]=_[_0x2788('0x38')](_0xe88104[_0x2788('0x35')],_0xe88104['query']);_0x825dc5[_0x2788('0x3a')]=_[_0x2788('0x38')](_0xe88104['model'],qs['fields'](_0x582ecf['query']['fields']));_0x825dc5[_0x2788('0x3a')]=_0x825dc5[_0x2788('0x3a')]['length']?_0x825dc5[_0x2788('0x3a')]:_0xe88104[_0x2788('0x35')];if(_0x582ecf['query']['includeAll']){_0x825dc5[_0x2788('0x44')]=[{'all':!![]}];}_0x825dc5=_[_0x2788('0x43')]({},_0x825dc5,_0x582ecf[_0x2788('0x48')]);return db['UserProfileSection'][_0x2788('0x49')](_0x825dc5)[_0x2788('0x28')](handleEntityNotFound(_0x3b3be1,null))[_0x2788('0x28')](respondWithResult(_0x3b3be1,null))[_0x2788('0x4a')](handleError(_0x3b3be1,null));};exports[_0x2788('0x4b')]=function(_0x42df3a,_0x274896){return db[_0x2788('0x30')][_0x2788('0x4b')](_0x42df3a[_0x2788('0x4c')],{})[_0x2788('0x28')](respondWithResult(_0x274896,0xc9))['catch'](handleError(_0x274896,null));};exports[_0x2788('0x27')]=function(_0x5431b9,_0x426e48){if(_0x5431b9[_0x2788('0x4c')]['id']){delete _0x5431b9[_0x2788('0x4c')]['id'];}return db[_0x2788('0x30')][_0x2788('0x49')]({'where':{'id':_0x5431b9['params']['id']}})[_0x2788('0x28')](handleEntityNotFound(_0x426e48,null))[_0x2788('0x28')](saveUpdates(_0x5431b9['body'],null))['then'](respondWithResult(_0x426e48,null))[_0x2788('0x4a')](handleError(_0x426e48,null));};exports[_0x2788('0x29')]=function(_0x10e5d8,_0x4713ea){return db[_0x2788('0x30')]['find']({'where':{'id':_0x10e5d8[_0x2788('0x47')]['id']}})[_0x2788('0x28')](handleEntityNotFound(_0x4713ea,null))[_0x2788('0x28')](removeEntity(_0x4713ea,null))[_0x2788('0x4a')](handleError(_0x4713ea,null));};exports['describe']=function(_0x71f694,_0x3da94f){return db[_0x2788('0x30')][_0x2788('0x4d')]()[_0x2788('0x28')](respondWithResult(_0x3da94f,null))[_0x2788('0x4a')](handleError(_0x3da94f,null));}; \ No newline at end of file +var _0xede4=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','index','map','UserProfileSection','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra'];(function(_0x4040e0,_0x173ba7){var _0x4f1da9=function(_0x1a07f2){while(--_0x1a07f2){_0x4040e0['push'](_0x4040e0['shift']());}};_0x4f1da9(++_0x173ba7);}(_0xede4,0x16d));var _0x4ede=function(_0x5de03f,_0x3f1512){_0x5de03f=_0x5de03f-0x0;var _0x51d1c6=_0xede4[_0x5de03f];return _0x51d1c6;};'use strict';var emlformat=require(_0x4ede('0x0'));var rimraf=require(_0x4ede('0x1'));var zipdir=require(_0x4ede('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ede('0x3'));var moment=require(_0x4ede('0x4'));var BPromise=require(_0x4ede('0x5'));var Mustache=require(_0x4ede('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4ede('0x7'));var csv=require(_0x4ede('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ede('0x9'));var _=require(_0x4ede('0xa'));var squel=require(_0x4ede('0xb'));var crypto=require('crypto');var jsforce=require(_0x4ede('0xc'));var deskjs=require(_0x4ede('0xd'));var toCsv=require(_0x4ede('0x8'));var querystring=require(_0x4ede('0xe'));var Papa=require('papaparse');var Redis=require(_0x4ede('0xf'));var authService=require(_0x4ede('0x10'));var qs=require(_0x4ede('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ede('0x12'));var logger=require('../../config/logger')(_0x4ede('0x13'));var utils=require(_0x4ede('0x14'));var config=require(_0x4ede('0x15'));var licenseUtil=require(_0x4ede('0x16'));var db=require(_0x4ede('0x17'))['db'];function respondWithStatusCode(_0x190513,_0x583feb){_0x583feb=_0x583feb||0xcc;return function(_0x38a8fb){if(_0x38a8fb){return _0x190513[_0x4ede('0x18')](_0x583feb);}return _0x190513['status'](_0x583feb)[_0x4ede('0x19')]();};}function respondWithResult(_0x573ea2,_0x11dee0){_0x11dee0=_0x11dee0||0xc8;return function(_0x4e57b3){if(_0x4e57b3){return _0x573ea2[_0x4ede('0x1a')](_0x11dee0)[_0x4ede('0x1b')](_0x4e57b3);}};}function respondWithFilteredResult(_0x513545,_0x8fbdc2){return function(_0x227e9b){if(_0x227e9b){var _0x5ed12a=typeof _0x8fbdc2['offset']===_0x4ede('0x1c')&&typeof _0x8fbdc2[_0x4ede('0x1d')]===_0x4ede('0x1c');var _0x43c4bc=_0x227e9b[_0x4ede('0x1e')];var _0x1dd955=_0x5ed12a?0x0:_0x8fbdc2[_0x4ede('0x1f')];var _0x11b4f3=_0x5ed12a?_0x227e9b[_0x4ede('0x1e')]:_0x8fbdc2['offset']+_0x8fbdc2[_0x4ede('0x1d')];var _0x26934b;if(_0x11b4f3>=_0x43c4bc){_0x11b4f3=_0x43c4bc;_0x26934b=0xc8;}else{_0x26934b=0xce;}_0x513545[_0x4ede('0x1a')](_0x26934b);return _0x513545[_0x4ede('0x20')]('Content-Range',_0x1dd955+'-'+_0x11b4f3+'/'+_0x43c4bc)[_0x4ede('0x1b')](_0x227e9b);}return null;};}function patchUpdates(_0x18cd60){return function(_0x57485e){try{jsonpatch[_0x4ede('0x21')](_0x57485e,_0x18cd60,!![]);}catch(_0x5a9ea4){return BPromise[_0x4ede('0x22')](_0x5a9ea4);}return _0x57485e[_0x4ede('0x23')]();};}function saveUpdates(_0x5df7bd,_0x199192){return function(_0x36bff3){if(_0x36bff3){return _0x36bff3[_0x4ede('0x24')](_0x5df7bd)[_0x4ede('0x25')](function(_0x473dc4){return _0x473dc4;});}return null;};}function removeEntity(_0x2ecbfe,_0x3ceaf3){return function(_0x10df01){if(_0x10df01){return _0x10df01['destroy']()[_0x4ede('0x25')](function(){_0x2ecbfe['status'](0xcc)[_0x4ede('0x19')]();});}};}function handleEntityNotFound(_0x538316,_0x5ecbaa){return function(_0x132dca){if(!_0x132dca){_0x538316[_0x4ede('0x18')](0x194);}return _0x132dca;};}function handleError(_0x567c7d,_0x47196a){_0x47196a=_0x47196a||0x1f4;return function(_0x21cf78){logger[_0x4ede('0x26')](_0x21cf78[_0x4ede('0x27')]);if(_0x21cf78[_0x4ede('0x28')]){delete _0x21cf78['name'];}_0x567c7d[_0x4ede('0x1a')](_0x47196a)['send'](_0x21cf78);};}exports[_0x4ede('0x29')]=function(_0x34c037,_0x3e3c99){var _0x291d3d={},_0x5d6857={},_0x512566={'count':0x0,'rows':[]};var _0x135669=_[_0x4ede('0x2a')](db[_0x4ede('0x2b')][_0x4ede('0x2c')],function(_0x4055d7){return{'name':_0x4055d7['fieldName'],'type':_0x4055d7['type']['key']};});_0x5d6857[_0x4ede('0x2d')]=_[_0x4ede('0x2a')](_0x135669,'name');_0x5d6857[_0x4ede('0x2e')]=_[_0x4ede('0x2f')](_0x34c037['query']);_0x5d6857[_0x4ede('0x30')]=_['intersection'](_0x5d6857[_0x4ede('0x2d')],_0x5d6857[_0x4ede('0x2e')]);_0x291d3d[_0x4ede('0x31')]=_[_0x4ede('0x32')](_0x5d6857[_0x4ede('0x2d')],qs[_0x4ede('0x33')](_0x34c037[_0x4ede('0x2e')][_0x4ede('0x33')]));_0x291d3d[_0x4ede('0x31')]=_0x291d3d[_0x4ede('0x31')][_0x4ede('0x34')]?_0x291d3d['attributes']:_0x5d6857[_0x4ede('0x2d')];if(!_0x34c037[_0x4ede('0x2e')]['hasOwnProperty'](_0x4ede('0x35'))){_0x291d3d[_0x4ede('0x1d')]=qs[_0x4ede('0x1d')](_0x34c037['query'][_0x4ede('0x1d')]);_0x291d3d[_0x4ede('0x1f')]=qs[_0x4ede('0x1f')](_0x34c037[_0x4ede('0x2e')][_0x4ede('0x1f')]);}_0x291d3d[_0x4ede('0x36')]=qs[_0x4ede('0x37')](_0x34c037[_0x4ede('0x2e')][_0x4ede('0x37')]);_0x291d3d[_0x4ede('0x38')]=qs[_0x4ede('0x30')](_[_0x4ede('0x39')](_0x34c037[_0x4ede('0x2e')],_0x5d6857['filters']),_0x135669);if(_0x34c037[_0x4ede('0x2e')][_0x4ede('0x3a')]){_0x291d3d[_0x4ede('0x38')]=_['merge'](_0x291d3d[_0x4ede('0x38')],{'$or':_['map'](_0x135669,function(_0x5d174b){if(_0x5d174b[_0x4ede('0x3b')]!==_0x4ede('0x3c')){var _0x2b42c6={};_0x2b42c6[_0x5d174b[_0x4ede('0x28')]]={'$like':'%'+_0x34c037[_0x4ede('0x2e')][_0x4ede('0x3a')]+'%'};return _0x2b42c6;}})});}_0x291d3d=_[_0x4ede('0x3d')]({},_0x291d3d,_0x34c037[_0x4ede('0x3e')]);var _0x3c6624={'where':_0x291d3d[_0x4ede('0x38')]};return db[_0x4ede('0x2b')][_0x4ede('0x1e')](_0x3c6624)['then'](function(_0x10bd81){_0x512566[_0x4ede('0x1e')]=_0x10bd81;if(_0x34c037['query'][_0x4ede('0x3f')]){_0x291d3d['include']=[{'all':!![]}];}return db[_0x4ede('0x2b')][_0x4ede('0x40')](_0x291d3d);})[_0x4ede('0x25')](function(_0x37265f){_0x512566[_0x4ede('0x41')]=_0x37265f;return _0x512566;})[_0x4ede('0x25')](respondWithFilteredResult(_0x3e3c99,_0x291d3d))['catch'](handleError(_0x3e3c99,null));};exports[_0x4ede('0x42')]=function(_0x3986de,_0x1bb1a3){var _0x517f34={'raw':![],'where':{'id':_0x3986de[_0x4ede('0x43')]['id']}},_0x49d5eb={};_0x49d5eb[_0x4ede('0x2d')]=_[_0x4ede('0x2f')](db[_0x4ede('0x2b')][_0x4ede('0x2c')]);_0x49d5eb[_0x4ede('0x2e')]=_[_0x4ede('0x2f')](_0x3986de[_0x4ede('0x2e')]);_0x49d5eb[_0x4ede('0x30')]=_[_0x4ede('0x32')](_0x49d5eb[_0x4ede('0x2d')],_0x49d5eb[_0x4ede('0x2e')]);_0x517f34[_0x4ede('0x31')]=_[_0x4ede('0x32')](_0x49d5eb['model'],qs['fields'](_0x3986de[_0x4ede('0x2e')]['fields']));_0x517f34[_0x4ede('0x31')]=_0x517f34['attributes'][_0x4ede('0x34')]?_0x517f34['attributes']:_0x49d5eb['model'];if(_0x3986de[_0x4ede('0x2e')][_0x4ede('0x3f')]){_0x517f34[_0x4ede('0x44')]=[{'all':!![]}];}_0x517f34=_[_0x4ede('0x3d')]({},_0x517f34,_0x3986de[_0x4ede('0x3e')]);return db[_0x4ede('0x2b')][_0x4ede('0x45')](_0x517f34)[_0x4ede('0x25')](handleEntityNotFound(_0x1bb1a3,null))[_0x4ede('0x25')](respondWithResult(_0x1bb1a3,null))['catch'](handleError(_0x1bb1a3,null));};exports['create']=function(_0x1fc12b,_0x4e3e0e){return db[_0x4ede('0x2b')][_0x4ede('0x46')](_0x1fc12b[_0x4ede('0x47')],{})[_0x4ede('0x25')](respondWithResult(_0x4e3e0e,0xc9))[_0x4ede('0x48')](handleError(_0x4e3e0e,null));};exports['update']=function(_0xa21c1c,_0x5daf28){if(_0xa21c1c[_0x4ede('0x47')]['id']){delete _0xa21c1c[_0x4ede('0x47')]['id'];}return db[_0x4ede('0x2b')][_0x4ede('0x45')]({'where':{'id':_0xa21c1c[_0x4ede('0x43')]['id']}})[_0x4ede('0x25')](handleEntityNotFound(_0x5daf28,null))[_0x4ede('0x25')](saveUpdates(_0xa21c1c[_0x4ede('0x47')],null))[_0x4ede('0x25')](respondWithResult(_0x5daf28,null))[_0x4ede('0x48')](handleError(_0x5daf28,null));};exports[_0x4ede('0x49')]=function(_0x5ca2ba,_0x2c9d2b){return db[_0x4ede('0x2b')][_0x4ede('0x45')]({'where':{'id':_0x5ca2ba[_0x4ede('0x43')]['id']}})[_0x4ede('0x25')](handleEntityNotFound(_0x2c9d2b,null))['then'](removeEntity(_0x2c9d2b,null))[_0x4ede('0x48')](handleError(_0x2c9d2b,null));};exports['describe']=function(_0x21cb92,_0x570358){return db[_0x4ede('0x2b')][_0x4ede('0x4a')]()[_0x4ede('0x25')](respondWithResult(_0x570358,null))[_0x4ede('0x48')](handleError(_0x570358,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 79e43bc..ccf2047 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 _0xb59f=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x2f92a,_0x1536f9){var _0x1a4b6d=function(_0x415cce){while(--_0x415cce){_0x2f92a['push'](_0x2f92a['shift']());}};_0x1a4b6d(++_0x1536f9);}(_0xb59f,0xc0));var _0xfb59=function(_0x76bd17,_0x51e665){_0x76bd17=_0x76bd17-0x0;var _0x32b726=_0xb59f[_0x76bd17];return _0x32b726;};'use strict';var _=require(_0xfb59('0x0'));var util=require(_0xfb59('0x1'));var logger=require(_0xfb59('0x2'))('api');var moment=require(_0xfb59('0x3'));var BPromise=require(_0xfb59('0x4'));var rp=require(_0xfb59('0x5'));var fs=require('fs');var path=require(_0xfb59('0x6'));var rimraf=require(_0xfb59('0x7'));var config=require(_0xfb59('0x8'));var attributes=require(_0xfb59('0x9'));module[_0xfb59('0xa')]=function(_0x2242f2,_0x5c04ee){return _0x2242f2[_0xfb59('0xb')]('UserProfileSection',attributes,{'tableName':_0xfb59('0xc'),'paranoid':![],'indexes':[{'name':_0xfb59('0xd'),'fields':[_0xfb59('0xe'),_0xfb59('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x991d=['userProfileId','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId'];(function(_0x4b719b,_0x440b42){var _0x90fbee=function(_0xccfd7e){while(--_0xccfd7e){_0x4b719b['push'](_0x4b719b['shift']());}};_0x90fbee(++_0x440b42);}(_0x991d,0x189));var _0xd991=function(_0x4a0b7e,_0x357b78){_0x4a0b7e=_0x4a0b7e-0x0;var _0x5c9a4d=_0x991d[_0x4a0b7e];return _0x5c9a4d;};'use strict';var _=require('lodash');var util=require(_0xd991('0x0'));var logger=require(_0xd991('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd991('0x2'));var rp=require(_0xd991('0x3'));var fs=require('fs');var path=require(_0xd991('0x4'));var rimraf=require(_0xd991('0x5'));var config=require(_0xd991('0x6'));var attributes=require(_0xd991('0x7'));module['exports']=function(_0x55d236,_0xc80f1c){return _0x55d236[_0xd991('0x8')](_0xd991('0x9'),attributes,{'tableName':_0xd991('0xa'),'paranoid':![],'indexes':[{'name':_0xd991('0xb'),'fields':[_0xd991('0xc'),_0xd991('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1ed2978..c54d2a9 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 _0xdafa=['stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','info','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0xdafa,0x124));var _0xadaf=function(_0x684edd,_0x4e01b5){_0x684edd=_0x684edd-0x0;var _0x1d98b5=_0xdafa[_0x684edd];return _0x1d98b5;};'use strict';var _=require('lodash');var util=require(_0xadaf('0x0'));var moment=require(_0xadaf('0x1'));var BPromise=require(_0xadaf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadaf('0x3'))['db'];var utils=require(_0xadaf('0x4'));var logger=require(_0xadaf('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xadaf('0x6'));var client=jayson[_0xadaf('0x7')][_0xadaf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12c840,_0x4fe23a,_0x31d16a){return new BPromise(function(_0xa77e78,_0x107514){return client['request'](_0x12c840,_0x31d16a)[_0xadaf('0x9')](function(_0x266a0c){logger['info']('UserProfileSection,\x20%s,\x20%s',_0x4fe23a,'request\x20sent');logger['debug'](_0xadaf('0xa'),_0x4fe23a,_0xadaf('0xb'),JSON[_0xadaf('0xc')](_0x266a0c));if(_0x266a0c[_0xadaf('0xd')]){if(_0x266a0c[_0xadaf('0xd')][_0xadaf('0xe')]===0x1f4){logger[_0xadaf('0xd')](_0xadaf('0xf'),_0x4fe23a,_0x266a0c[_0xadaf('0xd')][_0xadaf('0x10')]);return _0x107514(_0x266a0c[_0xadaf('0xd')][_0xadaf('0x10')]);}logger[_0xadaf('0xd')](_0xadaf('0xf'),_0x4fe23a,_0x266a0c[_0xadaf('0xd')]['message']);return _0xa77e78(_0x266a0c[_0xadaf('0xd')]['message']);}else{logger[_0xadaf('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x4fe23a,_0xadaf('0xb'));_0xa77e78(_0x266a0c[_0xadaf('0x12')][_0xadaf('0x10')]);}})['catch'](function(_0x1b709a){logger[_0xadaf('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x4fe23a,_0x1b709a);_0x107514(_0x1b709a);});});} \ No newline at end of file +var _0x0633=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x45feb5,_0x393b38){var _0xf555a2=function(_0x58bcd2){while(--_0x58bcd2){_0x45feb5['push'](_0x45feb5['shift']());}};_0xf555a2(++_0x393b38);}(_0x0633,0x188));var _0x3063=function(_0x1963b9,_0xdf2e0c){_0x1963b9=_0x1963b9-0x0;var _0x2d40be=_0x0633[_0x1963b9];return _0x2d40be;};'use strict';var _=require(_0x3063('0x0'));var util=require(_0x3063('0x1'));var moment=require(_0x3063('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3063('0x3'));var db=require(_0x3063('0x4'))['db'];var utils=require(_0x3063('0x5'));var logger=require(_0x3063('0x6'))(_0x3063('0x7'));var config=require(_0x3063('0x8'));var jayson=require(_0x3063('0x9'));var client=jayson['client'][_0x3063('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5261c5,_0x2b0d5d,_0x5336f0){return new BPromise(function(_0x109f70,_0x2ac676){return client[_0x3063('0xb')](_0x5261c5,_0x5336f0)[_0x3063('0xc')](function(_0x38ea36){logger['info'](_0x3063('0xd'),_0x2b0d5d,'request\x20sent');logger[_0x3063('0xe')](_0x3063('0xf'),_0x2b0d5d,_0x3063('0x10'),JSON[_0x3063('0x11')](_0x38ea36));if(_0x38ea36[_0x3063('0x12')]){if(_0x38ea36[_0x3063('0x12')][_0x3063('0x13')]===0x1f4){logger[_0x3063('0x12')](_0x3063('0xd'),_0x2b0d5d,_0x38ea36[_0x3063('0x12')]['message']);return _0x2ac676(_0x38ea36[_0x3063('0x12')]['message']);}logger['error'](_0x3063('0xd'),_0x2b0d5d,_0x38ea36[_0x3063('0x12')][_0x3063('0x14')]);return _0x109f70(_0x38ea36[_0x3063('0x12')][_0x3063('0x14')]);}else{logger[_0x3063('0x15')](_0x3063('0xd'),_0x2b0d5d,_0x3063('0x10'));_0x109f70(_0x38ea36[_0x3063('0x16')][_0x3063('0x14')]);}})[_0x3063('0x17')](function(_0x3a4e50){logger[_0x3063('0x12')](_0x3063('0xd'),_0x2b0d5d,_0x3a4e50);_0x2ac676(_0x3a4e50);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 089d8ea..ea12865 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x513752,_0x50e1b7){var _0x407985=function(_0x54bd0f){while(--_0x54bd0f){_0x513752['push'](_0x513752['shift']());}};_0x407985(++_0x50e1b7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x209bbf,_0x2e2375){_0x209bbf=_0x209bbf-0x0;var _0x592d4b=_0xcb91[_0x209bbf];return _0x592d4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x234d2d,_0x110b27){var _0x440aed=function(_0x62fecd){while(--_0x62fecd){_0x234d2d['push'](_0x234d2d['shift']());}};_0x440aed(++_0x110b27);}(_0xe706,0xa3));var _0x6e70=function(_0x56a69f,_0x1bf698){_0x56a69f=_0x56a69f-0x0;var _0x1cb629=_0xe706[_0x56a69f];return _0x1cb629;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index da8475b..cf3126f 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 _0x8647=['INTEGER','sequelize','exports'];(function(_0x10d48f,_0x17f1a6){var _0x44673c=function(_0x18d462){while(--_0x18d462){_0x10d48f['push'](_0x10d48f['shift']());}};_0x44673c(++_0x17f1a6);}(_0x8647,0x1cc));var _0x7864=function(_0x2bb5c2,_0x2c11d0){_0x2bb5c2=_0x2bb5c2-0x0;var _0x199fc3=_0x8647[_0x2bb5c2];return _0x199fc3;};'use strict';var Sequelize=require(_0x7864('0x0'));module[_0x7864('0x1')]={'penalty':{'type':Sequelize[_0x7864('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb695=['exports','INTEGER','sequelize'];(function(_0x50824a,_0x442cda){var _0x256037=function(_0x241c1e){while(--_0x241c1e){_0x50824a['push'](_0x50824a['shift']());}};_0x256037(++_0x442cda);}(_0xb695,0x1d6));var _0x5b69=function(_0x44fbcf,_0x51778d){_0x44fbcf=_0x44fbcf-0x0;var _0x41ae61=_0xb695[_0x44fbcf];return _0x41ae61;};'use strict';var Sequelize=require(_0x5b69('0x0'));module[_0x5b69('0x1')]={'penalty':{'type':Sequelize[_0x5b69('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index c5015d2..4607f78 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 _0xaf1b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util','../../config/logger','api'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x4d7181,_0x407a34){_0x4d7181=_0x4d7181-0x0;var _0x4abf2a=_0xaf1b[_0x4d7181];return _0x4abf2a;};'use strict';var _=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var logger=require(_0xbaf1('0x2'))(_0xbaf1('0x3'));var moment=require(_0xbaf1('0x4'));var BPromise=require(_0xbaf1('0x5'));var rp=require(_0xbaf1('0x6'));var fs=require('fs');var path=require(_0xbaf1('0x7'));var rimraf=require(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var attributes=require(_0xbaf1('0xa'));module[_0xbaf1('0xb')]=function(_0x7dd657,_0x2f05ad){return _0x7dd657['define'](_0xbaf1('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger'];(function(_0x5a24e0,_0xd77459){var _0x1f5adb=function(_0x1fffdc){while(--_0x1fffdc){_0x5a24e0['push'](_0x5a24e0['shift']());}};_0x1f5adb(++_0xd77459);}(_0x4745,0x1e7));var _0x5474=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x4745[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('UserSmsQueue',attributes,{'tableName':_0x5474('0xd'),'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 94d0615..e86b8ac 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 _0xaabc=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x277cba,_0x3a8ed5){var _0x218df5=function(_0x26b4bb){while(--_0x26b4bb){_0x277cba['push'](_0x277cba['shift']());}};_0x218df5(++_0x3a8ed5);}(_0xaabc,0x1de));var _0xcaab=function(_0x2ae8ce,_0x2a5a1f){_0x2ae8ce=_0x2ae8ce-0x0;var _0x4bf686=_0xaabc[_0x2ae8ce];return _0x4bf686;};'use strict';var _=require(_0xcaab('0x0'));var util=require(_0xcaab('0x1'));var moment=require(_0xcaab('0x2'));var BPromise=require(_0xcaab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcaab('0x4'));var db=require(_0xcaab('0x5'))['db'];var utils=require(_0xcaab('0x6'));var logger=require('../../config/logger')(_0xcaab('0x7'));var config=require(_0xcaab('0x8'));var jayson=require(_0xcaab('0x9'));var client=jayson[_0xcaab('0xa')][_0xcaab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34349d,_0x3e20c8,_0x17f2ca){return new BPromise(function(_0x3d7b8e,_0x284838){return client[_0xcaab('0xc')](_0x34349d,_0x17f2ca)[_0xcaab('0xd')](function(_0xbd8f97){logger[_0xcaab('0xe')](_0xcaab('0xf'),_0x3e20c8,_0xcaab('0x10'));logger[_0xcaab('0x11')](_0xcaab('0x12'),_0x3e20c8,_0xcaab('0x10'),JSON[_0xcaab('0x13')](_0xbd8f97));if(_0xbd8f97[_0xcaab('0x14')]){if(_0xbd8f97['error'][_0xcaab('0x15')]===0x1f4){logger[_0xcaab('0x14')](_0xcaab('0xf'),_0x3e20c8,_0xbd8f97[_0xcaab('0x14')][_0xcaab('0x16')]);return _0x284838(_0xbd8f97[_0xcaab('0x14')]['message']);}logger[_0xcaab('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x3e20c8,_0xbd8f97[_0xcaab('0x14')][_0xcaab('0x16')]);return _0x3d7b8e(_0xbd8f97[_0xcaab('0x14')][_0xcaab('0x16')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x3e20c8,_0xcaab('0x10'));_0x3d7b8e(_0xbd8f97[_0xcaab('0x17')][_0xcaab('0x16')]);}})[_0xcaab('0x18')](function(_0x8210b6){logger['error'](_0xcaab('0xf'),_0x3e20c8,_0x8210b6);_0x284838(_0x8210b6);});});} \ No newline at end of file +var _0xe610=['code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x2a2303,_0x33f447){var _0x490f5b=function(_0x3b3b7c){while(--_0x3b3b7c){_0x2a2303['push'](_0x2a2303['shift']());}};_0x490f5b(++_0x33f447);}(_0xe610,0xc9));var _0x0e61=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe610[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x0e61('0x0'));var moment=require(_0x0e61('0x1'));var BPromise=require(_0x0e61('0x2'));var rs=require(_0x0e61('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e61('0x4'))['db'];var utils=require(_0x0e61('0x5'));var logger=require(_0x0e61('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0e61('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f6bf2,_0x290e94,_0x426ed3){return new BPromise(function(_0x40aca2,_0x2e8c19){return client[_0x0e61('0x8')](_0x1f6bf2,_0x426ed3)['then'](function(_0x3a8a9d){logger[_0x0e61('0x9')](_0x0e61('0xa'),_0x290e94,_0x0e61('0xb'));logger[_0x0e61('0xc')](_0x0e61('0xd'),_0x290e94,'request\x20sent',JSON['stringify'](_0x3a8a9d));if(_0x3a8a9d[_0x0e61('0xe')]){if(_0x3a8a9d[_0x0e61('0xe')][_0x0e61('0xf')]===0x1f4){logger['error'](_0x0e61('0xa'),_0x290e94,_0x3a8a9d[_0x0e61('0xe')]['message']);return _0x2e8c19(_0x3a8a9d['error']['message']);}logger[_0x0e61('0xe')](_0x0e61('0xa'),_0x290e94,_0x3a8a9d[_0x0e61('0xe')]['message']);return _0x40aca2(_0x3a8a9d[_0x0e61('0xe')][_0x0e61('0x10')]);}else{logger[_0x0e61('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x290e94,'request\x20sent');_0x40aca2(_0x3a8a9d[_0x0e61('0x11')][_0x0e61('0x10')]);}})['catch'](function(_0x4bb453){logger['error'](_0x0e61('0xa'),_0x290e94,_0x4bb453);_0x2e8c19(_0x4bb453);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 603056a..891c828 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 _0x0df3=['INTEGER','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0df3,0xb7));var _0x30df=function(_0x2fd0f0,_0x4b634e){_0x2fd0f0=_0x2fd0f0-0x0;var _0x57f71a=_0x0df3[_0x2fd0f0];return _0x57f71a;};'use strict';var Sequelize=require('sequelize');module[_0x30df('0x0')]={'UserId':{'type':Sequelize[_0x30df('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x30df('0x1')]}}; \ No newline at end of file +var _0xb0b2=['exports','INTEGER','sequelize'];(function(_0x410ba0,_0x41189a){var _0x27e6ef=function(_0x3099cb){while(--_0x3099cb){_0x410ba0['push'](_0x410ba0['shift']());}};_0x27e6ef(++_0x41189a);}(_0xb0b2,0x110));var _0x2b0b=function(_0x1279c8,_0x3286a1){_0x1279c8=_0x1279c8-0x0;var _0x54b96e=_0xb0b2[_0x1279c8];return _0x54b96e;};'use strict';var Sequelize=require(_0x2b0b('0x0'));module[_0x2b0b('0x1')]={'UserId':{'type':Sequelize[_0x2b0b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x2b0b('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 16477ea..9de4028 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(_0x54d507,_0x402db1){var _0x441b22=function(_0x40026a){while(--_0x40026a){_0x54d507['push'](_0x54d507['shift']());}};_0x441b22(++_0x402db1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x459fa3,_0x46a5ef){var _0x3a0138=function(_0x433216){while(--_0x433216){_0x459fa3['push'](_0x459fa3['shift']());}};_0x3a0138(++_0x46a5ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 5f9fedf..15d1ede 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x19a43b,_0x26ee5d){var _0x1b2679=function(_0x415dc8){while(--_0x415dc8){_0x19a43b['push'](_0x19a43b['shift']());}};_0x1b2679(++_0x26ee5d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x18e52b,_0x1fae35){_0x18e52b=_0x18e52b-0x0;var _0x3d3062=_0xcb91[_0x18e52b];return _0x3d3062;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2f57fb,_0x4e2d46){var _0x536ad7=function(_0x4a4636){while(--_0x4a4636){_0x2f57fb['push'](_0x2f57fb['shift']());}};_0x536ad7(++_0x4e2d46);}(_0x70e0,0x17b));var _0x070e=function(_0x4035a8,_0x2c9385){_0x4035a8=_0x4035a8-0x0;var _0x32bfc2=_0x70e0[_0x4035a8];return _0x32bfc2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6f07042..3c3c7d8 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 _0xaf70=['sequelize','exports'];(function(_0x5e1094,_0x411c56){var _0x3144aa=function(_0x59334b){while(--_0x59334b){_0x5e1094['push'](_0x5e1094['shift']());}};_0x3144aa(++_0x411c56);}(_0xaf70,0x17a));var _0x0af7=function(_0x999827,_0x13a115){_0x999827=_0x999827-0x0;var _0x5996ce=_0xaf70[_0x999827];return _0x5996ce;};'use strict';var Sequelize=require(_0x0af7('0x0'));module[_0x0af7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7b68=['INTEGER','sequelize','exports'];(function(_0x5ca4fa,_0xc8ca37){var _0x75cffb=function(_0x2080c0){while(--_0x2080c0){_0x5ca4fa['push'](_0x5ca4fa['shift']());}};_0x75cffb(++_0xc8ca37);}(_0x7b68,0x1e7));var _0x87b6=function(_0x2696eb,_0x11cc36){_0x2696eb=_0x2696eb-0x0;var _0x48250a=_0x7b68[_0x2696eb];return _0x48250a;};'use strict';var Sequelize=require(_0x87b6('0x0'));module[_0x87b6('0x1')]={'penalty':{'type':Sequelize[_0x87b6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index cde4632..c3c87c5 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 _0x2130=['./userVoiceQueue.attributes','exports','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3a53a3,_0x2f915d){var _0x3eabc2=function(_0x3f7c4f){while(--_0x3f7c4f){_0x3a53a3['push'](_0x3a53a3['shift']());}};_0x3eabc2(++_0x2f915d);}(_0x2130,0x1e7));var _0x0213=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2130[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x0213('0x0'));var util=require(_0x0213('0x1'));var logger=require(_0x0213('0x2'))(_0x0213('0x3'));var moment=require(_0x0213('0x4'));var BPromise=require(_0x0213('0x5'));var rp=require(_0x0213('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0213('0x7'));var attributes=require(_0x0213('0x8'));module[_0x0213('0x9')]=function(_0x2960a1,_0x3f06cf){return _0x2960a1['define'](_0x0213('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7abb=['moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x1ca6e3,_0x4c1e6c){var _0x492fbf=function(_0x3efcdd){while(--_0x3efcdd){_0x1ca6e3['push'](_0x1ca6e3['shift']());}};_0x492fbf(++_0x4c1e6c);}(_0x7abb,0x10d));var _0xb7ab=function(_0x2d04a4,_0x2dbab9){_0x2d04a4=_0x2d04a4-0x0;var _0x5994ff=_0x7abb[_0x2d04a4];return _0x5994ff;};'use strict';var _=require(_0xb7ab('0x0'));var util=require(_0xb7ab('0x1'));var logger=require(_0xb7ab('0x2'))(_0xb7ab('0x3'));var moment=require(_0xb7ab('0x4'));var BPromise=require(_0xb7ab('0x5'));var rp=require(_0xb7ab('0x6'));var fs=require('fs');var path=require(_0xb7ab('0x7'));var rimraf=require(_0xb7ab('0x8'));var config=require('../../config/environment');var attributes=require(_0xb7ab('0x9'));module['exports']=function(_0x6b658d,_0x57f46d){return _0x6b658d[_0xb7ab('0xa')](_0xb7ab('0xb'),attributes,{'tableName':_0xb7ab('0xc'),'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 dc40332..6881c75 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 _0x33ba=['jayson/promise','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x33ba,0xd5));var _0xa33b=function(_0x6162a,_0x3a6a5a){_0x6162a=_0x6162a-0x0;var _0x4d6dcb=_0x33ba[_0x6162a];return _0x4d6dcb;};'use strict';var _=require('lodash');var util=require(_0xa33b('0x0'));var moment=require(_0xa33b('0x1'));var BPromise=require(_0xa33b('0x2'));var rs=require(_0xa33b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa33b('0x4'))['db'];var utils=require(_0xa33b('0x5'));var logger=require(_0xa33b('0x6'))(_0xa33b('0x7'));var config=require('../../config/environment');var jayson=require(_0xa33b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x28ae48,_0x499579,_0x34d0ec){return new BPromise(function(_0xaf25e1,_0x421e10){return client[_0xa33b('0x9')](_0x28ae48,_0x34d0ec)[_0xa33b('0xa')](function(_0x228d00){logger[_0xa33b('0xb')](_0xa33b('0xc'),_0x499579,_0xa33b('0xd'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x499579,_0xa33b('0xd'),JSON['stringify'](_0x228d00));if(_0x228d00[_0xa33b('0xe')]){if(_0x228d00[_0xa33b('0xe')][_0xa33b('0xf')]===0x1f4){logger[_0xa33b('0xe')](_0xa33b('0xc'),_0x499579,_0x228d00[_0xa33b('0xe')][_0xa33b('0x10')]);return _0x421e10(_0x228d00[_0xa33b('0xe')]['message']);}logger[_0xa33b('0xe')](_0xa33b('0xc'),_0x499579,_0x228d00['error'][_0xa33b('0x10')]);return _0xaf25e1(_0x228d00[_0xa33b('0xe')][_0xa33b('0x10')]);}else{logger[_0xa33b('0xb')](_0xa33b('0xc'),_0x499579,'request\x20sent');_0xaf25e1(_0x228d00['result'][_0xa33b('0x10')]);}})['catch'](function(_0x5c3841){logger[_0xa33b('0xe')](_0xa33b('0xc'),_0x499579,_0x5c3841);_0x421e10(_0x5c3841);});});} \ No newline at end of file +var _0xd536=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd536,0x74));var _0x6d53=function(_0xc06cd6,_0x50c687){_0xc06cd6=_0xc06cd6-0x0;var _0x17883e=_0xd536[_0xc06cd6];return _0x17883e;};'use strict';var _=require(_0x6d53('0x0'));var util=require(_0x6d53('0x1'));var moment=require(_0x6d53('0x2'));var BPromise=require(_0x6d53('0x3'));var rs=require(_0x6d53('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d53('0x5'))['db'];var utils=require(_0x6d53('0x6'));var logger=require('../../config/logger')(_0x6d53('0x7'));var config=require('../../config/environment');var jayson=require(_0x6d53('0x8'));var client=jayson[_0x6d53('0x9')][_0x6d53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15f0a8,_0x4d4c74,_0x28c722){return new BPromise(function(_0x5b588b,_0x378fde){return client['request'](_0x15f0a8,_0x28c722)[_0x6d53('0xb')](function(_0x47e889){logger['info'](_0x6d53('0xc'),_0x4d4c74,_0x6d53('0xd'));logger[_0x6d53('0xe')](_0x6d53('0xf'),_0x4d4c74,_0x6d53('0xd'),JSON[_0x6d53('0x10')](_0x47e889));if(_0x47e889[_0x6d53('0x11')]){if(_0x47e889['error'][_0x6d53('0x12')]===0x1f4){logger[_0x6d53('0x11')](_0x6d53('0xc'),_0x4d4c74,_0x47e889['error'][_0x6d53('0x13')]);return _0x378fde(_0x47e889[_0x6d53('0x11')]['message']);}logger[_0x6d53('0x11')](_0x6d53('0xc'),_0x4d4c74,_0x47e889[_0x6d53('0x11')][_0x6d53('0x13')]);return _0x5b588b(_0x47e889['error']['message']);}else{logger[_0x6d53('0x14')](_0x6d53('0xc'),_0x4d4c74,_0x6d53('0xd'));_0x5b588b(_0x47e889[_0x6d53('0x15')]['message']);}})[_0x6d53('0x16')](function(_0x53da43){logger[_0x6d53('0x11')](_0x6d53('0xc'),_0x4d4c74,_0x53da43);_0x378fde(_0x53da43);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 1edd96c..7a69ecf 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5d7803,_0x30e9aa){var _0x1a43b2=function(_0x1359df){while(--_0x1359df){_0x5d7803['push'](_0x5d7803['shift']());}};_0x1a43b2(++_0x30e9aa);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4314c9,_0x1a6d36){var _0x1f8798=function(_0x27858f){while(--_0x27858f){_0x4314c9['push'](_0x4314c9['shift']());}};_0x1f8798(++_0x1a6d36);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 3a24f05..ab30ce9 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 _0xe888=['queue_interface','sequelize','INTEGER','STRING','Required\x20by\x20Asterisk'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xe888,0x97));var _0x8e88=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0xe888[_0x3227c1];return _0x31fd48;};'use strict';var Sequelize=require(_0x8e88('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8e88('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x8e88('0x2')],'allowNull':![],'comment':_0x8e88('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8e88('0x2')],'allowNull':![],'unique':_0x8e88('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x8e88('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8e88('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x8e88('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x8e88('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xb2bb=['queue_interface','exports','Required\x20by\x20Asterisk','INTEGER','STRING'];(function(_0x9b5abe,_0x4774e7){var _0x1132de=function(_0x2aa9b2){while(--_0x2aa9b2){_0x9b5abe['push'](_0x9b5abe['shift']());}};_0x1132de(++_0x4774e7);}(_0xb2bb,0x178));var _0xbb2b=function(_0xa041de,_0x3600e2){_0xa041de=_0xa041de-0x0;var _0x1d654c=_0xb2bb[_0xa041de];return _0x1d654c;};'use strict';var Sequelize=require('sequelize');module[_0xbb2b('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xbb2b('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xbb2b('0x1')},'UserId':{'type':Sequelize[_0xbb2b('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xbb2b('0x3')],'allowNull':![],'unique':_0xbb2b('0x4'),'comment':_0xbb2b('0x1')},'VoiceQueueId':{'type':Sequelize[_0xbb2b('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xbb2b('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xbb2b('0x1')},'penalty':{'type':Sequelize[_0xbb2b('0x2')](0xb),'defaultValue':0x0,'comment':_0xbb2b('0x1')},'paused':{'type':Sequelize[_0xbb2b('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e9785aa..8b8d599 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 _0x4756=['hook','exports','events','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x16141d,_0xf66077){var _0x512956=function(_0x80a038){while(--_0x80a038){_0x16141d['push'](_0x16141d['shift']());}};_0x512956(++_0xf66077);}(_0x4756,0x13d));var _0x6475=function(_0x18acb1,_0x438a64){_0x18acb1=_0x18acb1-0x0;var _0x36ea0b=_0x4756[_0x18acb1];return _0x36ea0b;};'use strict';var EventEmitter=require(_0x6475('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6475('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6475('0x2')};function emitEvent(_0x89dab4){return function(_0x5dae3d,_0x51e17d,_0x19c30e){UserVoiceQueueRtEvents[_0x6475('0x3')](_0x89dab4+':'+_0x5dae3d['id'],_0x5dae3d);UserVoiceQueueRtEvents[_0x6475('0x3')](_0x89dab4,_0x5dae3d);_0x19c30e(null);};}for(var e in events){if(events[_0x6475('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x6475('0x5')](e,emitEvent(event));}}module[_0x6475('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa127=['events','../../mysqldb','UserVoiceQueueRt','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x12bb43,_0x5866a8){var _0x53c896=function(_0x549ba4){while(--_0x549ba4){_0x12bb43['push'](_0x12bb43['shift']());}};_0x53c896(++_0x5866a8);}(_0xa127,0xab));var _0x7a12=function(_0x1e280b,_0xb8ce4a){_0x1e280b=_0x1e280b-0x0;var _0x11abaf=_0xa127[_0x1e280b];return _0x11abaf;};'use strict';var EventEmitter=require(_0x7a12('0x0'));var UserVoiceQueueRt=require(_0x7a12('0x1'))['db'][_0x7a12('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a12('0x3'),'afterUpdate':_0x7a12('0x4'),'afterDestroy':_0x7a12('0x5')};function emitEvent(_0x5e5101){return function(_0x54682c,_0x8f9586,_0x3fe974){UserVoiceQueueRtEvents['emit'](_0x5e5101+':'+_0x54682c['id'],_0x54682c);UserVoiceQueueRtEvents['emit'](_0x5e5101,_0x54682c);_0x3fe974(null);};}for(var e in events){if(events[_0x7a12('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x7a12('0x7')](e,emitEvent(event));}}module[_0x7a12('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3109703..2aa9415 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 _0x2aeb=['exports','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x57fd10,_0x1e6153){var _0x443ba1=function(_0x2c0d05){while(--_0x2c0d05){_0x57fd10['push'](_0x57fd10['shift']());}};_0x443ba1(++_0x1e6153);}(_0x2aeb,0xa4));var _0xb2ae=function(_0x1adcee,_0x21ed8e){_0x1adcee=_0x1adcee-0x0;var _0x4f79ba=_0x2aeb[_0x1adcee];return _0x4f79ba;};'use strict';var _=require(_0xb2ae('0x0'));var util=require(_0xb2ae('0x1'));var logger=require(_0xb2ae('0x2'))('api');var moment=require(_0xb2ae('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb2ae('0x4'));var config=require(_0xb2ae('0x5'));var attributes=require(_0xb2ae('0x6'));module[_0xb2ae('0x7')]=function(_0x40e417,_0x58213f){return _0x40e417['define']('UserVoiceQueueRt',attributes,{'tableName':_0xb2ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd346=['UserVoiceQueueRt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xd346,0x91));var _0x6d34=function(_0xeafe30,_0x21e452){_0xeafe30=_0xeafe30-0x0;var _0x2dcef7=_0xd346[_0xeafe30];return _0x2dcef7;};'use strict';var _=require(_0x6d34('0x0'));var util=require('util');var logger=require(_0x6d34('0x1'))(_0x6d34('0x2'));var moment=require(_0x6d34('0x3'));var BPromise=require(_0x6d34('0x4'));var rp=require(_0x6d34('0x5'));var fs=require('fs');var path=require(_0x6d34('0x6'));var rimraf=require(_0x6d34('0x7'));var config=require(_0x6d34('0x8'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x6d34('0x9')]=function(_0x16626d,_0x52d5b7){return _0x16626d[_0x6d34('0xa')](_0x6d34('0xb'),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 9556469..bd35f65 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 _0x7733=['register','request','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserVoiceQueueRt,\x20%s,\x20%s','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x180b01,_0x16cd10){var _0x51fe8f=function(_0x3590b8){while(--_0x3590b8){_0x180b01['push'](_0x180b01['shift']());}};_0x51fe8f(++_0x16cd10);}(_0x7733,0xd4));var _0x3773=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x7733[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x3773('0x0'));var util=require(_0x3773('0x1'));var moment=require(_0x3773('0x2'));var BPromise=require(_0x3773('0x3'));var rs=require(_0x3773('0x4'));var fs=require('fs');var Redis=require(_0x3773('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3773('0x6'));var logger=require(_0x3773('0x7'))('rpc');var config=require(_0x3773('0x8'));var jayson=require(_0x3773('0x9'));var client=jayson[_0x3773('0xa')]['http']({'port':0x232a});config[_0x3773('0xb')]=_[_0x3773('0xc')](config[_0x3773('0xb')],{'host':_0x3773('0xd'),'port':0x18eb});var socket=require(_0x3773('0xe'))(new Redis(config[_0x3773('0xb')]));require(_0x3773('0xf'))[_0x3773('0x10')](socket);function respondWithRpcPromise(_0x2ea956,_0x5eb99c,_0x2186d4){return new BPromise(function(_0x70170b,_0x41f926){return client[_0x3773('0x11')](_0x2ea956,_0x2186d4)[_0x3773('0x12')](function(_0x3935a9){logger[_0x3773('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5eb99c,_0x3773('0x14'));logger[_0x3773('0x15')](_0x3773('0x16'),_0x5eb99c,_0x3773('0x14'),JSON[_0x3773('0x17')](_0x3935a9));if(_0x3935a9['error']){if(_0x3935a9['error'][_0x3773('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5eb99c,_0x3935a9[_0x3773('0x19')][_0x3773('0x1a')]);return _0x41f926(_0x3935a9[_0x3773('0x19')][_0x3773('0x1a')]);}logger[_0x3773('0x19')](_0x3773('0x1b'),_0x5eb99c,_0x3935a9[_0x3773('0x19')][_0x3773('0x1a')]);return _0x70170b(_0x3935a9[_0x3773('0x19')]['message']);}else{logger['info'](_0x3773('0x1b'),_0x5eb99c,_0x3773('0x14'));_0x70170b(_0x3935a9[_0x3773('0x1c')]['message']);}})[_0x3773('0x1d')](function(_0x3a50ab){logger[_0x3773('0x19')](_0x3773('0x1b'),_0x5eb99c,_0x3a50ab);_0x41f926(_0x3a50ab);});});}exports[_0x3773('0x1e')]=function(_0x266303){var _0x33529d=this;return new Promise(function(_0x42c0c3,_0x2fa011){return db[_0x3773('0x1f')][_0x3773('0x20')]({'raw':_0x266303[_0x3773('0x21')]?_0x266303[_0x3773('0x21')][_0x3773('0x22')]===undefined?!![]:![]:!![],'where':_0x266303[_0x3773('0x21')]?_0x266303[_0x3773('0x21')]['where']||null:null,'attributes':[[db[_0x3773('0x23')]['fn'](_0x3773('0x24'),db[_0x3773('0x23')]['fn']('IF',db[_0x3773('0x23')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x3773('0x25')]]})[_0x3773('0x12')](function(_0x32840b){logger['info'](_0x3773('0x1e'),_0x266303);logger[_0x3773('0x15')](_0x3773('0x1e'),_0x266303,JSON['stringify'](_0x32840b));_0x42c0c3(_0x32840b);})[_0x3773('0x1d')](function(_0xe6245c){logger[_0x3773('0x19')](_0x3773('0x1e'),_0xe6245c['message'],_0x266303);_0x2fa011(_0x33529d[_0x3773('0x19')](0x1f4,_0xe6245c[_0x3773('0x1a')]));});});}; \ No newline at end of file +var _0x3f10=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x163d35,_0x339ba4){var _0x2aad1f=function(_0xc117f9){while(--_0xc117f9){_0x163d35['push'](_0x163d35['shift']());}};_0x2aad1f(++_0x339ba4);}(_0x3f10,0x129));var _0x03f1=function(_0x155d31,_0x4de5ce){_0x155d31=_0x155d31-0x0;var _0x5534c8=_0x3f10[_0x155d31];return _0x5534c8;};'use strict';var _=require('lodash');var util=require(_0x03f1('0x0'));var moment=require(_0x03f1('0x1'));var BPromise=require(_0x03f1('0x2'));var rs=require(_0x03f1('0x3'));var fs=require('fs');var Redis=require(_0x03f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03f1('0x5'));var logger=require('../../config/logger')(_0x03f1('0x6'));var config=require(_0x03f1('0x7'));var jayson=require(_0x03f1('0x8'));var client=jayson[_0x03f1('0x9')][_0x03f1('0xa')]({'port':0x232a});config[_0x03f1('0xb')]=_[_0x03f1('0xc')](config['redis'],{'host':_0x03f1('0xd'),'port':0x18eb});var socket=require(_0x03f1('0xe'))(new Redis(config['redis']));require(_0x03f1('0xf'))[_0x03f1('0x10')](socket);function respondWithRpcPromise(_0x3d04d7,_0x2b3d09,_0x3798ad){return new BPromise(function(_0x332c9e,_0x593310){return client['request'](_0x3d04d7,_0x3798ad)['then'](function(_0x1cbc2b){logger['info'](_0x03f1('0x11'),_0x2b3d09,_0x03f1('0x12'));logger[_0x03f1('0x13')](_0x03f1('0x14'),_0x2b3d09,'request\x20sent',JSON[_0x03f1('0x15')](_0x1cbc2b));if(_0x1cbc2b['error']){if(_0x1cbc2b[_0x03f1('0x16')][_0x03f1('0x17')]===0x1f4){logger[_0x03f1('0x16')](_0x03f1('0x11'),_0x2b3d09,_0x1cbc2b[_0x03f1('0x16')][_0x03f1('0x18')]);return _0x593310(_0x1cbc2b[_0x03f1('0x16')][_0x03f1('0x18')]);}logger[_0x03f1('0x16')](_0x03f1('0x11'),_0x2b3d09,_0x1cbc2b['error']['message']);return _0x332c9e(_0x1cbc2b[_0x03f1('0x16')][_0x03f1('0x18')]);}else{logger[_0x03f1('0x19')](_0x03f1('0x11'),_0x2b3d09,_0x03f1('0x12'));_0x332c9e(_0x1cbc2b[_0x03f1('0x1a')]['message']);}})['catch'](function(_0x45a0ee){logger[_0x03f1('0x16')](_0x03f1('0x11'),_0x2b3d09,_0x45a0ee);_0x593310(_0x45a0ee);});});}exports[_0x03f1('0x1b')]=function(_0x25b2df){var _0x1d9525=this;return new Promise(function(_0x3e816e,_0x118a23){return db[_0x03f1('0x1c')][_0x03f1('0x1d')]({'raw':_0x25b2df['options']?_0x25b2df['options'][_0x03f1('0x1e')]===undefined?!![]:![]:!![],'where':_0x25b2df[_0x03f1('0x1f')]?_0x25b2df['options'][_0x03f1('0x20')]||null:null,'attributes':[[db[_0x03f1('0x21')]['fn'](_0x03f1('0x22'),db[_0x03f1('0x21')]['fn']('IF',db['sequelize']['literal'](_0x03f1('0x23')))),_0x03f1('0x24')]]})[_0x03f1('0x25')](function(_0x411226){logger[_0x03f1('0x19')](_0x03f1('0x1b'),_0x25b2df);logger[_0x03f1('0x13')](_0x03f1('0x1b'),_0x25b2df,JSON[_0x03f1('0x15')](_0x411226));_0x3e816e(_0x411226);})['catch'](function(_0x285063){logger[_0x03f1('0x16')]('GetVoiceQueueRtPauses',_0x285063[_0x03f1('0x18')],_0x25b2df);_0x118a23(_0x1d9525['error'](0x1f4,_0x285063[_0x03f1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c9a1fdb..c4d1e97 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 _0x00f0=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x00f0,0xec));var _0x000f=function(_0x126c12,_0x194007){_0x126c12=_0x126c12-0x0;var _0x22a8fa=_0x00f0[_0x126c12];return _0x22a8fa;};'use strict';var UserVoiceQueueRtEvents=require(_0x000f('0x0'));var events=[_0x000f('0x1'),_0x000f('0x2'),_0x000f('0x3')];function createListener(_0x55b9cf,_0x4d5c3d){return function(_0x4095d5){_0x4d5c3d['emit'](_0x55b9cf,_0x4095d5);};}function removeListener(_0x3cd8ed,_0x53989d){return function(){UserVoiceQueueRtEvents[_0x000f('0x4')](_0x3cd8ed,_0x53989d);};}exports[_0x000f('0x5')]=function(_0x4ce2d9){for(var _0x7827b=0x0,_0x3c54d0=events[_0x000f('0x6')];_0x7827b<_0x3c54d0;_0x7827b++){var _0x621ab6=events[_0x7827b];var _0x330e11=createListener(_0x000f('0x7')+_0x621ab6,_0x4ce2d9);UserVoiceQueueRtEvents['on'](_0x621ab6,_0x330e11);}}; \ No newline at end of file +var _0xd206=['emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0xd206,0x107));var _0x6d20=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xd206[_0x725b8e];return _0x43ac45;};'use strict';var UserVoiceQueueRtEvents=require(_0x6d20('0x0'));var events=[_0x6d20('0x1'),'remove',_0x6d20('0x2')];function createListener(_0x2a6fc3,_0xbf89ef){return function(_0x580523){_0xbf89ef[_0x6d20('0x3')](_0x2a6fc3,_0x580523);};}function removeListener(_0x28bc49,_0x243da3){return function(){UserVoiceQueueRtEvents[_0x6d20('0x4')](_0x28bc49,_0x243da3);};}exports['register']=function(_0x467e6e){for(var _0x5c5950=0x0,_0x4dc981=events[_0x6d20('0x5')];_0x5c5950<_0x4dc981;_0x5c5950++){var _0x3080fb=events[_0x5c5950];var _0x5b4154=createListener(_0x6d20('0x6')+_0x3080fb,_0x467e6e);UserVoiceQueueRtEvents['on'](_0x3080fb,_0x5b4154);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 5fba7c0..8f2cb25 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x536498,_0x23cd37){var _0x582b16=function(_0x30967d){while(--_0x30967d){_0x536498['push'](_0x536498['shift']());}};_0x582b16(++_0x23cd37);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f8f7e,_0x47fd7d){_0x3f8f7e=_0x3f8f7e-0x0;var _0x5a708f=_0xedd9[_0x3f8f7e];return _0x5a708f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2f10b7,_0x566b9e){var _0x13d099=function(_0x51eb91){while(--_0x51eb91){_0x2f10b7['push'](_0x2f10b7['shift']());}};_0x13d099(++_0x566b9e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9006424..d73ff51 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc91c=['exports','INTEGER'];(function(_0x3d17ab,_0x2416b4){var _0x2fd463=function(_0x31e8d){while(--_0x31e8d){_0x3d17ab['push'](_0x3d17ab['shift']());}};_0x2fd463(++_0x2416b4);}(_0xc91c,0x150));var _0xcc91=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0xc91c[_0x12254f];return _0x3a4fa2;};'use strict';var Sequelize=require('sequelize');module[_0xcc91('0x0')]={'penalty':{'type':Sequelize[_0xcc91('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index c96dcf8..9635579 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 _0x7778=['bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment'];(function(_0x698215,_0x23dd08){var _0x54e777=function(_0x14e5bb){while(--_0x14e5bb){_0x698215['push'](_0x698215['shift']());}};_0x54e777(++_0x23dd08);}(_0x7778,0x8b));var _0x8777=function(_0x183119,_0x1162a5){_0x183119=_0x183119-0x0;var _0x19f642=_0x7778[_0x183119];return _0x19f642;};'use strict';var _=require(_0x8777('0x0'));var util=require(_0x8777('0x1'));var logger=require(_0x8777('0x2'))('api');var moment=require(_0x8777('0x3'));var BPromise=require(_0x8777('0x4'));var rp=require(_0x8777('0x5'));var fs=require('fs');var path=require(_0x8777('0x6'));var rimraf=require(_0x8777('0x7'));var config=require(_0x8777('0x8'));var attributes=require(_0x8777('0x9'));module[_0x8777('0xa')]=function(_0x3a37fd,_0x23cfe9){return _0x3a37fd['define'](_0x8777('0xb'),attributes,{'tableName':_0x8777('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff94=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','define'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xff94,0x14c));var _0x4ff9=function(_0x5e227a,_0x4b0e52){_0x5e227a=_0x5e227a-0x0;var _0x1320b4=_0xff94[_0x5e227a];return _0x1320b4;};'use strict';var _=require('lodash');var util=require(_0x4ff9('0x0'));var logger=require(_0x4ff9('0x1'))(_0x4ff9('0x2'));var moment=require(_0x4ff9('0x3'));var BPromise=require(_0x4ff9('0x4'));var rp=require(_0x4ff9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ff9('0x6'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x336835,_0x4a681a){return _0x336835[_0x4ff9('0x7')](_0x4ff9('0x8'),attributes,{'tableName':_0x4ff9('0x9'),'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 f846047..a18f330 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 _0xfc2c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x59d888,_0x858fa4){var _0x59a5ef=function(_0x4c159f){while(--_0x4c159f){_0x59d888['push'](_0x59d888['shift']());}};_0x59a5ef(++_0x858fa4);}(_0xfc2c,0x191));var _0xcfc2=function(_0x4ec263,_0x52c94b){_0x4ec263=_0x4ec263-0x0;var _0x336deb=_0xfc2c[_0x4ec263];return _0x336deb;};'use strict';var _=require(_0xcfc2('0x0'));var util=require(_0xcfc2('0x1'));var moment=require(_0xcfc2('0x2'));var BPromise=require(_0xcfc2('0x3'));var rs=require(_0xcfc2('0x4'));var fs=require('fs');var Redis=require(_0xcfc2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfc2('0x6'));var logger=require(_0xcfc2('0x7'))(_0xcfc2('0x8'));var config=require(_0xcfc2('0x9'));var jayson=require(_0xcfc2('0xa'));var client=jayson[_0xcfc2('0xb')][_0xcfc2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e40ae,_0x395f7a,_0x1ffbd3){return new BPromise(function(_0x4b6a29,_0x234af3){return client[_0xcfc2('0xd')](_0x4e40ae,_0x1ffbd3)['then'](function(_0x3dd23b){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x395f7a,_0xcfc2('0xe'));logger[_0xcfc2('0xf')](_0xcfc2('0x10'),_0x395f7a,_0xcfc2('0xe'),JSON[_0xcfc2('0x11')](_0x3dd23b));if(_0x3dd23b[_0xcfc2('0x12')]){if(_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x13')]===0x1f4){logger[_0xcfc2('0x12')](_0xcfc2('0x14'),_0x395f7a,_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x15')]);return _0x234af3(_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x15')]);}logger[_0xcfc2('0x12')](_0xcfc2('0x14'),_0x395f7a,_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x15')]);return _0x4b6a29(_0x3dd23b[_0xcfc2('0x12')][_0xcfc2('0x15')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x395f7a,_0xcfc2('0xe'));_0x4b6a29(_0x3dd23b[_0xcfc2('0x16')][_0xcfc2('0x15')]);}})[_0xcfc2('0x17')](function(_0x378a3e){logger[_0xcfc2('0x12')](_0xcfc2('0x14'),_0x395f7a,_0x378a3e);_0x234af3(_0x378a3e);});});} \ No newline at end of file +var _0x0c54=['stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3e5428,_0x4d6636){var _0xae3ef=function(_0xd20477){while(--_0xd20477){_0x3e5428['push'](_0x3e5428['shift']());}};_0xae3ef(++_0x4d6636);}(_0x0c54,0x17f));var _0x40c5=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x0c54[_0x3f3f40];return _0x403b7a;};'use strict';var _=require('lodash');var util=require(_0x40c5('0x0'));var moment=require('moment');var BPromise=require(_0x40c5('0x1'));var rs=require(_0x40c5('0x2'));var fs=require('fs');var Redis=require(_0x40c5('0x3'));var db=require(_0x40c5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x40c5('0x5'))(_0x40c5('0x6'));var config=require(_0x40c5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x40c5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f21a0,_0xe97240,_0x2c5f32){return new BPromise(function(_0x1af4cb,_0x312aef){return client[_0x40c5('0x9')](_0x5f21a0,_0x2c5f32)[_0x40c5('0xa')](function(_0x19a40d){logger['info'](_0x40c5('0xb'),_0xe97240,_0x40c5('0xc'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xe97240,_0x40c5('0xc'),JSON[_0x40c5('0xd')](_0x19a40d));if(_0x19a40d[_0x40c5('0xe')]){if(_0x19a40d[_0x40c5('0xe')]['code']===0x1f4){logger[_0x40c5('0xe')](_0x40c5('0xb'),_0xe97240,_0x19a40d['error'][_0x40c5('0xf')]);return _0x312aef(_0x19a40d[_0x40c5('0xe')]['message']);}logger[_0x40c5('0xe')](_0x40c5('0xb'),_0xe97240,_0x19a40d[_0x40c5('0xe')]['message']);return _0x1af4cb(_0x19a40d[_0x40c5('0xe')][_0x40c5('0xf')]);}else{logger['info'](_0x40c5('0xb'),_0xe97240,_0x40c5('0xc'));_0x1af4cb(_0x19a40d[_0x40c5('0x10')]['message']);}})[_0x40c5('0x11')](function(_0x542c22){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0xe97240,_0x542c22);_0x312aef(_0x542c22);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index da7c007..7b9120c 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 _0x6921=['post','create','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x55448c,_0x174be9){var _0x3b6b3a=function(_0x1ac9e0){while(--_0x1ac9e0){_0x55448c['push'](_0x55448c['shift']());}};_0x3b6b3a(++_0x174be9);}(_0x6921,0x1d1));var _0x1692=function(_0x33837d,_0x35f93b){_0x33837d=_0x33837d-0x0;var _0x133c21=_0x6921[_0x33837d];return _0x133c21;};'use strict';var multer=require('multer');var util=require(_0x1692('0x0'));var path=require('path');var timeout=require(_0x1692('0x1'));var express=require('express');var router=express[_0x1692('0x2')]();var fs_extra=require(_0x1692('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1692('0x4'));var config=require('../../config/environment');var controller=require(_0x1692('0x5'));router[_0x1692('0x6')]('/',auth[_0x1692('0x7')](),controller[_0x1692('0x8')]);router[_0x1692('0x6')](_0x1692('0x9'),auth[_0x1692('0x7')](),controller[_0x1692('0xa')]);router[_0x1692('0xb')]('/',auth[_0x1692('0x7')](),controller[_0x1692('0xc')]);router['put'](_0x1692('0x9'),auth['isAuthenticated'](),controller[_0x1692('0xd')]);router[_0x1692('0xe')](_0x1692('0x9'),auth[_0x1692('0x7')](),controller[_0x1692('0xf')]);module[_0x1692('0x10')]=router; \ No newline at end of file +var _0xe64a=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','show','post'];(function(_0x303e80,_0x27cef8){var _0x3aeb50=function(_0x2234c5){while(--_0x2234c5){_0x303e80['push'](_0x303e80['shift']());}};_0x3aeb50(++_0x27cef8);}(_0xe64a,0x1e0));var _0xae64=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe64a[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var path=require(_0xae64('0x2'));var timeout=require(_0xae64('0x3'));var express=require(_0xae64('0x4'));var router=express[_0xae64('0x5')]();var fs_extra=require(_0xae64('0x6'));var auth=require(_0xae64('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./variable.controller');router['get']('/',auth[_0xae64('0x8')](),controller[_0xae64('0x9')]);router[_0xae64('0xa')](_0xae64('0xb'),auth[_0xae64('0x8')](),controller[_0xae64('0xc')]);router[_0xae64('0xd')]('/',auth[_0xae64('0x8')](),controller[_0xae64('0xe')]);router[_0xae64('0xf')](_0xae64('0xb'),auth['isAuthenticated'](),controller[_0xae64('0x10')]);router['delete']('/:id',auth[_0xae64('0x8')](),controller[_0xae64('0x11')]);module[_0xae64('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index a43d4d0..ace0312 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 _0xd84d=['sequelize','STRING','name'];(function(_0x46cbff,_0x246e9){var _0x1554a4=function(_0x23ab02){while(--_0x23ab02){_0x46cbff['push'](_0x46cbff['shift']());}};_0x1554a4(++_0x246e9);}(_0xd84d,0x69));var _0xdd84=function(_0x33a559,_0x37ccba){_0x33a559=_0x33a559-0x0;var _0x5bff0f=_0xd84d[_0x33a559];return _0x5bff0f;};'use strict';var Sequelize=require(_0xdd84('0x0'));module['exports']={'name':{'type':Sequelize[_0xdd84('0x1')],'unique':_0xdd84('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdd84('0x1')]}}; \ No newline at end of file +var _0x045f=['name','STRING','exports'];(function(_0x524f00,_0x382c10){var _0x27429b=function(_0x47cbab){while(--_0x47cbab){_0x524f00['push'](_0x524f00['shift']());}};_0x27429b(++_0x382c10);}(_0x045f,0xce));var _0xf045=function(_0x575ed1,_0x36af05){_0x575ed1=_0x575ed1-0x0;var _0x335dd5=_0x045f[_0x575ed1];return _0x335dd5;};'use strict';var Sequelize=require('sequelize');module[_0xf045('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf045('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf045('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index b6fa8fc..32d85d9 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 _0xa36c=['undefined','limit','count','Content-Range','apply','reject','update','destroy','then','get','Variables','sendStatus','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','find','user','role','UserProfileSection','userProfileId','autoAssociation','create','params','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset'];(function(_0x227427,_0x39a41d){var _0x2f3aef=function(_0x391c69){while(--_0x391c69){_0x227427['push'](_0x227427['shift']());}};_0x2f3aef(++_0x39a41d);}(_0xa36c,0x17c));var _0xca36=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa36c[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xca36('0x0'));var rimraf=require(_0xca36('0x1'));var zipdir=require(_0xca36('0x2'));var jsonpatch=require(_0xca36('0x3'));var rp=require('request-promise');var moment=require(_0xca36('0x4'));var BPromise=require(_0xca36('0x5'));var Mustache=require(_0xca36('0x6'));var util=require(_0xca36('0x7'));var path=require(_0xca36('0x8'));var sox=require(_0xca36('0x9'));var csv=require(_0xca36('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca36('0xb'));var _=require(_0xca36('0xc'));var squel=require('squel');var crypto=require(_0xca36('0xd'));var jsforce=require(_0xca36('0xe'));var deskjs=require(_0xca36('0xf'));var toCsv=require(_0xca36('0xa'));var querystring=require(_0xca36('0x10'));var Papa=require(_0xca36('0x11'));var Redis=require(_0xca36('0x12'));var authService=require(_0xca36('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xca36('0x14'));var hardwareService=require(_0xca36('0x15'));var logger=require(_0xca36('0x16'))('api');var utils=require(_0xca36('0x17'));var config=require(_0xca36('0x18'));var licenseUtil=require(_0xca36('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x224cc2,_0x1cfcc9){_0x1cfcc9=_0x1cfcc9||0xcc;return function(_0x326668){if(_0x326668){return _0x224cc2['sendStatus'](_0x1cfcc9);}return _0x224cc2[_0xca36('0x1a')](_0x1cfcc9)[_0xca36('0x1b')]();};}function respondWithResult(_0x9b14cf,_0x4c91cd){_0x4c91cd=_0x4c91cd||0xc8;return function(_0x4573aa){if(_0x4573aa){return _0x9b14cf[_0xca36('0x1a')](_0x4c91cd)[_0xca36('0x1c')](_0x4573aa);}};}function respondWithFilteredResult(_0x148dbc,_0x586085){return function(_0xa02458){if(_0xa02458){var _0xb8d23b=typeof _0x586085[_0xca36('0x1d')]===_0xca36('0x1e')&&typeof _0x586085[_0xca36('0x1f')]===_0xca36('0x1e');var _0x3041fd=_0xa02458['count'];var _0x283fdf=_0xb8d23b?0x0:_0x586085[_0xca36('0x1d')];var _0x1c0b2b=_0xb8d23b?_0xa02458[_0xca36('0x20')]:_0x586085[_0xca36('0x1d')]+_0x586085[_0xca36('0x1f')];var _0x50e51f;if(_0x1c0b2b>=_0x3041fd){_0x1c0b2b=_0x3041fd;_0x50e51f=0xc8;}else{_0x50e51f=0xce;}_0x148dbc[_0xca36('0x1a')](_0x50e51f);return _0x148dbc['set'](_0xca36('0x21'),_0x283fdf+'-'+_0x1c0b2b+'/'+_0x3041fd)[_0xca36('0x1c')](_0xa02458);}return null;};}function patchUpdates(_0x458c7f){return function(_0xaa047f){try{jsonpatch[_0xca36('0x22')](_0xaa047f,_0x458c7f,!![]);}catch(_0x326d39){return BPromise[_0xca36('0x23')](_0x326d39);}return _0xaa047f['save']();};}function saveUpdates(_0x7a47ba,_0x110fdb){return function(_0x392d8b){if(_0x392d8b){return _0x392d8b[_0xca36('0x24')](_0x7a47ba)['then'](function(_0x3183d0){return _0x3183d0;});}return null;};}function removeEntity(_0x372493,_0x3d8f62){return function(_0x3c40a4){if(_0x3c40a4){return _0x3c40a4[_0xca36('0x25')]()[_0xca36('0x26')](function(){var _0x37b253=_0x3c40a4[_0xca36('0x27')]({'plain':!![]});var _0xa5b713=_0xca36('0x28');return db['UserProfileResource'][_0xca36('0x25')]({'where':{'type':_0xa5b713,'resourceId':_0x37b253['id']}})[_0xca36('0x26')](function(){return _0x3c40a4;});})[_0xca36('0x26')](function(){_0x372493[_0xca36('0x1a')](0xcc)[_0xca36('0x1b')]();});}};}function handleEntityNotFound(_0x346695,_0xf261ac){return function(_0x7d8ea3){if(!_0x7d8ea3){_0x346695[_0xca36('0x29')](0x194);}return _0x7d8ea3;};}function handleError(_0x549ff5,_0x4c413c){_0x4c413c=_0x4c413c||0x1f4;return function(_0x50d4c2){logger['error'](_0x50d4c2[_0xca36('0x2a')]);if(_0x50d4c2[_0xca36('0x2b')]){delete _0x50d4c2[_0xca36('0x2b')];}_0x549ff5[_0xca36('0x1a')](_0x4c413c)[_0xca36('0x2c')](_0x50d4c2);};}exports[_0xca36('0x2d')]=function(_0x5144ec,_0x517a3e){var _0x2bbbf2={},_0x476c24={},_0x2e0c22={'count':0x0,'rows':[]};var _0x5472b0=_[_0xca36('0x2e')](db[_0xca36('0x2f')][_0xca36('0x30')],function(_0x2c4bd0){return{'name':_0x2c4bd0[_0xca36('0x31')],'type':_0x2c4bd0[_0xca36('0x32')][_0xca36('0x33')]};});_0x476c24[_0xca36('0x34')]=_[_0xca36('0x2e')](_0x5472b0,_0xca36('0x2b'));_0x476c24['query']=_[_0xca36('0x35')](_0x5144ec[_0xca36('0x36')]);_0x476c24['filters']=_[_0xca36('0x37')](_0x476c24[_0xca36('0x34')],_0x476c24[_0xca36('0x36')]);_0x2bbbf2[_0xca36('0x38')]=_[_0xca36('0x37')](_0x476c24[_0xca36('0x34')],qs[_0xca36('0x39')](_0x5144ec[_0xca36('0x36')]['fields']));_0x2bbbf2[_0xca36('0x38')]=_0x2bbbf2[_0xca36('0x38')][_0xca36('0x3a')]?_0x2bbbf2[_0xca36('0x38')]:_0x476c24['model'];if(!_0x5144ec['query']['hasOwnProperty'](_0xca36('0x3b'))){_0x2bbbf2[_0xca36('0x1f')]=qs[_0xca36('0x1f')](_0x5144ec[_0xca36('0x36')][_0xca36('0x1f')]);_0x2bbbf2[_0xca36('0x1d')]=qs[_0xca36('0x1d')](_0x5144ec[_0xca36('0x36')][_0xca36('0x1d')]);}_0x2bbbf2['order']=qs[_0xca36('0x3c')](_0x5144ec['query']['sort']);_0x2bbbf2[_0xca36('0x3d')]=qs[_0xca36('0x3e')](_[_0xca36('0x3f')](_0x5144ec[_0xca36('0x36')],_0x476c24['filters']),_0x5472b0);if(_0x5144ec[_0xca36('0x36')]['filter']){_0x2bbbf2[_0xca36('0x3d')]=_[_0xca36('0x40')](_0x2bbbf2[_0xca36('0x3d')],{'$or':_[_0xca36('0x2e')](_0x5472b0,function(_0x307786){if(_0x307786[_0xca36('0x32')]!==_0xca36('0x41')){var _0x250212={};_0x250212[_0x307786[_0xca36('0x2b')]]={'$like':'%'+_0x5144ec['query'][_0xca36('0x42')]+'%'};return _0x250212;}})});}_0x2bbbf2=_[_0xca36('0x40')]({},_0x2bbbf2,_0x5144ec[_0xca36('0x43')]);var _0x11bf34={'where':_0x2bbbf2[_0xca36('0x3d')]};return db[_0xca36('0x2f')][_0xca36('0x20')](_0x11bf34)[_0xca36('0x26')](function(_0x1977cf){_0x2e0c22[_0xca36('0x20')]=_0x1977cf;if(_0x5144ec[_0xca36('0x36')][_0xca36('0x44')]){_0x2bbbf2[_0xca36('0x45')]=[{'all':!![]}];}return db[_0xca36('0x2f')]['findAll'](_0x2bbbf2);})['then'](function(_0x3b16a5){_0x2e0c22[_0xca36('0x46')]=_0x3b16a5;return _0x2e0c22;})['then'](respondWithFilteredResult(_0x517a3e,_0x2bbbf2))[_0xca36('0x47')](handleError(_0x517a3e,null));};exports[_0xca36('0x48')]=function(_0x338e49,_0x501fd2){var _0xc01643={'raw':!![],'where':{'id':_0x338e49['params']['id']}},_0x28c184={};_0x28c184['model']=_[_0xca36('0x35')](db[_0xca36('0x2f')]['rawAttributes']);_0x28c184['query']=_[_0xca36('0x35')](_0x338e49[_0xca36('0x36')]);_0x28c184[_0xca36('0x3e')]=_['intersection'](_0x28c184[_0xca36('0x34')],_0x28c184[_0xca36('0x36')]);_0xc01643[_0xca36('0x38')]=_[_0xca36('0x37')](_0x28c184[_0xca36('0x34')],qs[_0xca36('0x39')](_0x338e49['query'][_0xca36('0x39')]));_0xc01643[_0xca36('0x38')]=_0xc01643[_0xca36('0x38')][_0xca36('0x3a')]?_0xc01643[_0xca36('0x38')]:_0x28c184[_0xca36('0x34')];if(_0x338e49['query']['includeAll']){_0xc01643['include']=[{'all':!![]}];}_0xc01643=_[_0xca36('0x40')]({},_0xc01643,_0x338e49[_0xca36('0x43')]);return db[_0xca36('0x2f')][_0xca36('0x49')](_0xc01643)[_0xca36('0x26')](handleEntityNotFound(_0x501fd2,null))[_0xca36('0x26')](respondWithResult(_0x501fd2,null))[_0xca36('0x47')](handleError(_0x501fd2,null));};exports['create']=function(_0x211ed4,_0xfdfcc0){return db['Variable']['create'](_0x211ed4['body'],{})[_0xca36('0x26')](function(_0x272cd0){var _0x3e64cd=_0x211ed4[_0xca36('0x4a')][_0xca36('0x27')]({'plain':!![]});if(!_0x3e64cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e64cd[_0xca36('0x4b')]===_0xca36('0x4a')){var _0x14dc30=_0x272cd0['get']({'plain':!![]});var _0x4d0859=_0xca36('0x28');return db[_0xca36('0x4c')][_0xca36('0x49')]({'where':{'name':_0x4d0859,'userProfileId':_0x3e64cd[_0xca36('0x4d')]},'raw':!![]})['then'](function(_0x4f1907){if(_0x4f1907&&_0x4f1907[_0xca36('0x4e')]===0x0){return db['UserProfileResource'][_0xca36('0x4f')]({'name':_0x14dc30[_0xca36('0x2b')],'resourceId':_0x14dc30['id'],'type':_0x4f1907[_0xca36('0x2b')],'sectionId':_0x4f1907['id']},{})[_0xca36('0x26')](function(){return _0x272cd0;});}else{return _0x272cd0;}})[_0xca36('0x47')](function(_0x332007){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x332007);throw _0x332007;});}return _0x272cd0;})[_0xca36('0x26')](respondWithResult(_0xfdfcc0,0xc9))[_0xca36('0x47')](handleError(_0xfdfcc0,null));};exports['update']=function(_0x404517,_0x1c76bd){if(_0x404517['body']['id']){delete _0x404517['body']['id'];}return db['Variable'][_0xca36('0x49')]({'where':{'id':_0x404517[_0xca36('0x50')]['id']}})['then'](handleEntityNotFound(_0x1c76bd,null))[_0xca36('0x26')](saveUpdates(_0x404517[_0xca36('0x51')],null))[_0xca36('0x26')](respondWithResult(_0x1c76bd,null))[_0xca36('0x47')](handleError(_0x1c76bd,null));};exports[_0xca36('0x25')]=function(_0x397d56,_0x4262d5){return db[_0xca36('0x2f')][_0xca36('0x49')]({'where':{'id':_0x397d56[_0xca36('0x50')]['id']}})[_0xca36('0x26')](handleEntityNotFound(_0x4262d5,null))['then'](removeEntity(_0x4262d5,null))[_0xca36('0x47')](handleError(_0x4262d5,null));}; \ No newline at end of file +var _0x0aab=['Variables','UserProfileResource','error','stack','send','map','Variable','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0aab,0x81));var _0xb0aa=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x0aab[_0xfb0281];return _0x408dd3;};'use strict';var emlformat=require(_0xb0aa('0x0'));var rimraf=require(_0xb0aa('0x1'));var zipdir=require(_0xb0aa('0x2'));var jsonpatch=require(_0xb0aa('0x3'));var rp=require(_0xb0aa('0x4'));var moment=require(_0xb0aa('0x5'));var BPromise=require(_0xb0aa('0x6'));var Mustache=require(_0xb0aa('0x7'));var util=require('util');var path=require(_0xb0aa('0x8'));var sox=require(_0xb0aa('0x9'));var csv=require(_0xb0aa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0aa('0xb'));var _=require(_0xb0aa('0xc'));var squel=require('squel');var crypto=require(_0xb0aa('0xd'));var jsforce=require(_0xb0aa('0xe'));var deskjs=require(_0xb0aa('0xf'));var toCsv=require(_0xb0aa('0xa'));var querystring=require(_0xb0aa('0x10'));var Papa=require(_0xb0aa('0x11'));var Redis=require(_0xb0aa('0x12'));var authService=require(_0xb0aa('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb0aa('0x14'));var hardwareService=require(_0xb0aa('0x15'));var logger=require(_0xb0aa('0x16'))(_0xb0aa('0x17'));var utils=require(_0xb0aa('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb0aa('0x19'));var db=require(_0xb0aa('0x1a'))['db'];function respondWithStatusCode(_0x4742ae,_0x3eb39b){_0x3eb39b=_0x3eb39b||0xcc;return function(_0x1e0409){if(_0x1e0409){return _0x4742ae[_0xb0aa('0x1b')](_0x3eb39b);}return _0x4742ae[_0xb0aa('0x1c')](_0x3eb39b)[_0xb0aa('0x1d')]();};}function respondWithResult(_0x3898cc,_0x5c3b16){_0x5c3b16=_0x5c3b16||0xc8;return function(_0x1d93de){if(_0x1d93de){return _0x3898cc[_0xb0aa('0x1c')](_0x5c3b16)[_0xb0aa('0x1e')](_0x1d93de);}};}function respondWithFilteredResult(_0x23b0aa,_0x3ea39d){return function(_0x308714){if(_0x308714){var _0x4b8b97=typeof _0x3ea39d[_0xb0aa('0x1f')]===_0xb0aa('0x20')&&typeof _0x3ea39d[_0xb0aa('0x21')]==='undefined';var _0x27ad6e=_0x308714[_0xb0aa('0x22')];var _0x3e66fd=_0x4b8b97?0x0:_0x3ea39d[_0xb0aa('0x1f')];var _0x502e4c=_0x4b8b97?_0x308714[_0xb0aa('0x22')]:_0x3ea39d[_0xb0aa('0x1f')]+_0x3ea39d[_0xb0aa('0x21')];var _0x614a51;if(_0x502e4c>=_0x27ad6e){_0x502e4c=_0x27ad6e;_0x614a51=0xc8;}else{_0x614a51=0xce;}_0x23b0aa[_0xb0aa('0x1c')](_0x614a51);return _0x23b0aa[_0xb0aa('0x23')](_0xb0aa('0x24'),_0x3e66fd+'-'+_0x502e4c+'/'+_0x27ad6e)[_0xb0aa('0x1e')](_0x308714);}return null;};}function patchUpdates(_0x1b1d86){return function(_0x1cf930){try{jsonpatch[_0xb0aa('0x25')](_0x1cf930,_0x1b1d86,!![]);}catch(_0x47acd0){return BPromise[_0xb0aa('0x26')](_0x47acd0);}return _0x1cf930['save']();};}function saveUpdates(_0xdf6ccb,_0x5edfbf){return function(_0x22ac59){if(_0x22ac59){return _0x22ac59[_0xb0aa('0x27')](_0xdf6ccb)['then'](function(_0x372021){return _0x372021;});}return null;};}function removeEntity(_0x29d448,_0x4fdc0c){return function(_0x248f87){if(_0x248f87){return _0x248f87[_0xb0aa('0x28')]()[_0xb0aa('0x29')](function(){var _0x42d2e3=_0x248f87[_0xb0aa('0x2a')]({'plain':!![]});var _0x4cefea=_0xb0aa('0x2b');return db[_0xb0aa('0x2c')]['destroy']({'where':{'type':_0x4cefea,'resourceId':_0x42d2e3['id']}})[_0xb0aa('0x29')](function(){return _0x248f87;});})[_0xb0aa('0x29')](function(){_0x29d448[_0xb0aa('0x1c')](0xcc)[_0xb0aa('0x1d')]();});}};}function handleEntityNotFound(_0x245cee,_0x5573dd){return function(_0x56ee59){if(!_0x56ee59){_0x245cee['sendStatus'](0x194);}return _0x56ee59;};}function handleError(_0x4083a8,_0x4ba6db){_0x4ba6db=_0x4ba6db||0x1f4;return function(_0x33ee14){logger[_0xb0aa('0x2d')](_0x33ee14[_0xb0aa('0x2e')]);if(_0x33ee14['name']){delete _0x33ee14['name'];}_0x4083a8[_0xb0aa('0x1c')](_0x4ba6db)[_0xb0aa('0x2f')](_0x33ee14);};}exports['index']=function(_0xd4bd9c,_0x40bc49){var _0x1424dd={},_0x514ac2={},_0xb2cdda={'count':0x0,'rows':[]};var _0x74f37b=_[_0xb0aa('0x30')](db[_0xb0aa('0x31')][_0xb0aa('0x32')],function(_0x3c528b){return{'name':_0x3c528b[_0xb0aa('0x33')],'type':_0x3c528b[_0xb0aa('0x34')][_0xb0aa('0x35')]};});_0x514ac2[_0xb0aa('0x36')]=_[_0xb0aa('0x30')](_0x74f37b,_0xb0aa('0x37'));_0x514ac2[_0xb0aa('0x38')]=_[_0xb0aa('0x39')](_0xd4bd9c['query']);_0x514ac2[_0xb0aa('0x3a')]=_[_0xb0aa('0x3b')](_0x514ac2['model'],_0x514ac2[_0xb0aa('0x38')]);_0x1424dd[_0xb0aa('0x3c')]=_[_0xb0aa('0x3b')](_0x514ac2[_0xb0aa('0x36')],qs[_0xb0aa('0x3d')](_0xd4bd9c['query'][_0xb0aa('0x3d')]));_0x1424dd[_0xb0aa('0x3c')]=_0x1424dd[_0xb0aa('0x3c')][_0xb0aa('0x3e')]?_0x1424dd[_0xb0aa('0x3c')]:_0x514ac2[_0xb0aa('0x36')];if(!_0xd4bd9c[_0xb0aa('0x38')]['hasOwnProperty'](_0xb0aa('0x3f'))){_0x1424dd['limit']=qs[_0xb0aa('0x21')](_0xd4bd9c[_0xb0aa('0x38')][_0xb0aa('0x21')]);_0x1424dd['offset']=qs[_0xb0aa('0x1f')](_0xd4bd9c[_0xb0aa('0x38')][_0xb0aa('0x1f')]);}_0x1424dd[_0xb0aa('0x40')]=qs[_0xb0aa('0x41')](_0xd4bd9c[_0xb0aa('0x38')]['sort']);_0x1424dd[_0xb0aa('0x42')]=qs[_0xb0aa('0x3a')](_[_0xb0aa('0x43')](_0xd4bd9c[_0xb0aa('0x38')],_0x514ac2[_0xb0aa('0x3a')]),_0x74f37b);if(_0xd4bd9c[_0xb0aa('0x38')][_0xb0aa('0x44')]){_0x1424dd[_0xb0aa('0x42')]=_[_0xb0aa('0x45')](_0x1424dd[_0xb0aa('0x42')],{'$or':_[_0xb0aa('0x30')](_0x74f37b,function(_0x40af86){if(_0x40af86[_0xb0aa('0x34')]!==_0xb0aa('0x46')){var _0x15844b={};_0x15844b[_0x40af86['name']]={'$like':'%'+_0xd4bd9c[_0xb0aa('0x38')][_0xb0aa('0x44')]+'%'};return _0x15844b;}})});}_0x1424dd=_['merge']({},_0x1424dd,_0xd4bd9c[_0xb0aa('0x47')]);var _0x191a3d={'where':_0x1424dd['where']};return db[_0xb0aa('0x31')][_0xb0aa('0x22')](_0x191a3d)['then'](function(_0x1c71af){_0xb2cdda[_0xb0aa('0x22')]=_0x1c71af;if(_0xd4bd9c['query']['includeAll']){_0x1424dd['include']=[{'all':!![]}];}return db[_0xb0aa('0x31')][_0xb0aa('0x48')](_0x1424dd);})[_0xb0aa('0x29')](function(_0x442a2d){_0xb2cdda[_0xb0aa('0x49')]=_0x442a2d;return _0xb2cdda;})[_0xb0aa('0x29')](respondWithFilteredResult(_0x40bc49,_0x1424dd))[_0xb0aa('0x4a')](handleError(_0x40bc49,null));};exports[_0xb0aa('0x4b')]=function(_0x12fafc,_0x599dd4){var _0x2ffb16={'raw':!![],'where':{'id':_0x12fafc[_0xb0aa('0x4c')]['id']}},_0x262491={};_0x262491[_0xb0aa('0x36')]=_['keys'](db[_0xb0aa('0x31')][_0xb0aa('0x32')]);_0x262491[_0xb0aa('0x38')]=_[_0xb0aa('0x39')](_0x12fafc[_0xb0aa('0x38')]);_0x262491[_0xb0aa('0x3a')]=_[_0xb0aa('0x3b')](_0x262491[_0xb0aa('0x36')],_0x262491[_0xb0aa('0x38')]);_0x2ffb16['attributes']=_['intersection'](_0x262491[_0xb0aa('0x36')],qs['fields'](_0x12fafc[_0xb0aa('0x38')][_0xb0aa('0x3d')]));_0x2ffb16[_0xb0aa('0x3c')]=_0x2ffb16[_0xb0aa('0x3c')][_0xb0aa('0x3e')]?_0x2ffb16[_0xb0aa('0x3c')]:_0x262491[_0xb0aa('0x36')];if(_0x12fafc[_0xb0aa('0x38')]['includeAll']){_0x2ffb16[_0xb0aa('0x4d')]=[{'all':!![]}];}_0x2ffb16=_['merge']({},_0x2ffb16,_0x12fafc[_0xb0aa('0x47')]);return db[_0xb0aa('0x31')][_0xb0aa('0x4e')](_0x2ffb16)[_0xb0aa('0x29')](handleEntityNotFound(_0x599dd4,null))['then'](respondWithResult(_0x599dd4,null))[_0xb0aa('0x4a')](handleError(_0x599dd4,null));};exports[_0xb0aa('0x4f')]=function(_0x42b13a,_0xeed85e){return db['Variable']['create'](_0x42b13a[_0xb0aa('0x50')],{})[_0xb0aa('0x29')](function(_0x5e996a){var _0x6793ce=_0x42b13a[_0xb0aa('0x51')]['get']({'plain':!![]});if(!_0x6793ce)throw new Error(_0xb0aa('0x52'));if(_0x6793ce[_0xb0aa('0x53')]===_0xb0aa('0x51')){var _0x1a0678=_0x5e996a[_0xb0aa('0x2a')]({'plain':!![]});var _0x551cae='Variables';return db[_0xb0aa('0x54')][_0xb0aa('0x4e')]({'where':{'name':_0x551cae,'userProfileId':_0x6793ce[_0xb0aa('0x55')]},'raw':!![]})[_0xb0aa('0x29')](function(_0x53196c){if(_0x53196c&&_0x53196c['autoAssociation']===0x0){return db[_0xb0aa('0x2c')][_0xb0aa('0x4f')]({'name':_0x1a0678['name'],'resourceId':_0x1a0678['id'],'type':_0x53196c[_0xb0aa('0x37')],'sectionId':_0x53196c['id']},{})[_0xb0aa('0x29')](function(){return _0x5e996a;});}else{return _0x5e996a;}})[_0xb0aa('0x4a')](function(_0x106d49){logger[_0xb0aa('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x106d49);throw _0x106d49;});}return _0x5e996a;})[_0xb0aa('0x29')](respondWithResult(_0xeed85e,0xc9))[_0xb0aa('0x4a')](handleError(_0xeed85e,null));};exports[_0xb0aa('0x27')]=function(_0x24973d,_0x156349){if(_0x24973d[_0xb0aa('0x50')]['id']){delete _0x24973d['body']['id'];}return db['Variable'][_0xb0aa('0x4e')]({'where':{'id':_0x24973d['params']['id']}})[_0xb0aa('0x29')](handleEntityNotFound(_0x156349,null))[_0xb0aa('0x29')](saveUpdates(_0x24973d[_0xb0aa('0x50')],null))[_0xb0aa('0x29')](respondWithResult(_0x156349,null))['catch'](handleError(_0x156349,null));};exports[_0xb0aa('0x28')]=function(_0x5bda72,_0x21554f){return db[_0xb0aa('0x31')]['find']({'where':{'id':_0x5bda72[_0xb0aa('0x4c')]['id']}})[_0xb0aa('0x29')](handleEntityNotFound(_0x21554f,null))['then'](removeEntity(_0x21554f,null))[_0xb0aa('0x4a')](handleError(_0x21554f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 00baf77..c824f42 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 _0xa0c1=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Variable','tools_variables'];(function(_0x4a0d89,_0x1c0550){var _0x5946c3=function(_0xf76a7b){while(--_0xf76a7b){_0x4a0d89['push'](_0x4a0d89['shift']());}};_0x5946c3(++_0x1c0550);}(_0xa0c1,0x114));var _0x1a0c=function(_0x3d552b,_0x5c65ff){_0x3d552b=_0x3d552b-0x0;var _0x301793=_0xa0c1[_0x3d552b];return _0x301793;};'use strict';var _=require(_0x1a0c('0x0'));var util=require(_0x1a0c('0x1'));var logger=require(_0x1a0c('0x2'))('api');var moment=require(_0x1a0c('0x3'));var BPromise=require(_0x1a0c('0x4'));var rp=require(_0x1a0c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a0c('0x6'));var config=require(_0x1a0c('0x7'));var attributes=require('./variable.attributes');module[_0x1a0c('0x8')]=function(_0x5ecf03,_0x1ccef8){return _0x5ecf03[_0x1a0c('0x9')](_0x1a0c('0xa'),attributes,{'tableName':_0x1a0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e2=['Variable','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb7e2,0x151));var _0x2b7e=function(_0xb1d60,_0x41fd34){_0xb1d60=_0xb1d60-0x0;var _0x5411bf=_0xb7e2[_0xb1d60];return _0x5411bf;};'use strict';var _=require(_0x2b7e('0x0'));var util=require('util');var logger=require(_0x2b7e('0x1'))(_0x2b7e('0x2'));var moment=require(_0x2b7e('0x3'));var BPromise=require(_0x2b7e('0x4'));var rp=require(_0x2b7e('0x5'));var fs=require('fs');var path=require(_0x2b7e('0x6'));var rimraf=require('rimraf');var config=require(_0x2b7e('0x7'));var attributes=require(_0x2b7e('0x8'));module[_0x2b7e('0x9')]=function(_0x3bc8f2,_0x5593cd){return _0x3bc8f2[_0x2b7e('0xa')](_0x2b7e('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 78bc06e..d70da21 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x326f,0xd1));var _0xf326=function(_0x50438a,_0x45accc){_0x50438a=_0x50438a-0x0;var _0x5ec0c3=_0x326f[_0x50438a];return _0x5ec0c3;};'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')]('Variable,\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')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x5e3bda,_0x108667){var _0x3f02cf=function(_0x1faab9){while(--_0x1faab9){_0x5e3bda['push'](_0x5e3bda['shift']());}};_0x3f02cf(++_0x108667);}(_0xe14b,0x93));var _0xbe14=function(_0x2effba,_0x34989f){_0x2effba=_0x2effba-0x0;var _0x566a80=_0xe14b[_0x2effba];return _0x566a80;};'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);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4bffce6..fe49cc2 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 _0x0dcb=['/fetch','canUpdate','get','/reset','isAuthenticated','reset','/pull','pull','/restart','restart','/migrations','exports','Router','../../components/auth/service','./version.controller','index'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0dcb,0x12c));var _0xb0dc=function(_0x44eeb9,_0x1a5603){_0x44eeb9=_0x44eeb9-0x0;var _0x38738f=_0x0dcb[_0x44eeb9];return _0x38738f;};'use strict';var express=require('express');var router=express[_0xb0dc('0x0')]();var auth=require(_0xb0dc('0x1'));var controller=require(_0xb0dc('0x2'));router['get']('/',controller[_0xb0dc('0x3')]);router['get'](_0xb0dc('0x4'),auth['isAuthenticated'](),auth[_0xb0dc('0x5')](),controller['fetch']);router[_0xb0dc('0x6')](_0xb0dc('0x7'),auth[_0xb0dc('0x8')](),auth[_0xb0dc('0x5')](),controller[_0xb0dc('0x9')]);router[_0xb0dc('0x6')](_0xb0dc('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xb0dc('0xb')]);router[_0xb0dc('0x6')](_0xb0dc('0xc'),auth[_0xb0dc('0x8')](),controller[_0xb0dc('0xd')]);router[_0xb0dc('0x6')](_0xb0dc('0xe'),controller['migrations']);module[_0xb0dc('0xf')]=router; \ No newline at end of file +var _0xe64f=['exports','express','Router','./version.controller','get','index','isAuthenticated','fetch','/pull','canUpdate','pull','/restart','restart','migrations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe64f,0xe1));var _0xfe64=function(_0x139d12,_0x426262){_0x139d12=_0x139d12-0x0;var _0x293bc4=_0xe64f[_0x139d12];return _0x293bc4;};'use strict';var express=require(_0xfe64('0x0'));var router=express[_0xfe64('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfe64('0x2'));router[_0xfe64('0x3')]('/',controller[_0xfe64('0x4')]);router[_0xfe64('0x3')]('/fetch',auth[_0xfe64('0x5')](),auth['canUpdate'](),controller[_0xfe64('0x6')]);router['get']('/reset',auth[_0xfe64('0x5')](),auth['canUpdate'](),controller['reset']);router[_0xfe64('0x3')](_0xfe64('0x7'),auth[_0xfe64('0x5')](),auth[_0xfe64('0x8')](),controller[_0xfe64('0x9')]);router[_0xfe64('0x3')](_0xfe64('0xa'),auth['isAuthenticated'](),controller[_0xfe64('0xb')]);router['get']('/migrations',controller[_0xfe64('0xc')]);module[_0xfe64('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 062a899..321f677 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 _0x42a5=['length','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','server','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','exports','latest','fetch','tags','2.0.0','status','json','origin','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','push'];(function(_0x5ef12e,_0x59a72a){var _0xd8607=function(_0x4a71f8){while(--_0x4a71f8){_0x5ef12e['push'](_0x5ef12e['shift']());}};_0xd8607(++_0x59a72a);}(_0x42a5,0x7c));var _0x542a=function(_0x50d42d,_0x58ad84){_0x50d42d=_0x50d42d-0x0;var _0xdd8d30=_0x42a5[_0x50d42d];return _0xdd8d30;};'use strict';var Umzug=require(_0x542a('0x0'));var path=require(_0x542a('0x1'));var fs=require('fs');var _=require(_0x542a('0x2'));var pkginfo=require(_0x542a('0x3'))(module,_0x542a('0x4'));var compareVersions=require(_0x542a('0x5'));var exec=require('child_process')[_0x542a('0x6')];var db=require(_0x542a('0x7'))['db'];var config=require(_0x542a('0x8'));var pm2=require(_0x542a('0x9'));var logger=require(_0x542a('0xa'))(_0x542a('0xb'));var git=require(_0x542a('0xc'))(config['root']);exports['index']=function(_0x585859,_0xa987f3){var _0xe975e1={'current':module[_0x542a('0xd')][_0x542a('0x4')],'phonebar':0x2};if(_0x585859['query']&&_0x585859['query'][_0x542a('0xe')]){return git[_0x542a('0xf')]()[_0x542a('0x10')](function(_0x4bf222,_0x4142aa){_0xe975e1[_0x542a('0xe')]=(_0x4bf222?module[_0x542a('0xd')][_0x542a('0x4')]:_0x4142aa[_0x542a('0xe')])||_0x542a('0x11');return _0xa987f3[_0x542a('0x12')](0xc8)[_0x542a('0x13')](_0xe975e1);});}else{return _0xa987f3[_0x542a('0x12')](0xc8)[_0x542a('0x13')](_0xe975e1);}};exports['fetch']=function(_0x438cbc,_0x21a6bd){return git[_0x542a('0xf')]([_0x542a('0x14'),_0x542a('0x15')],function(_0x1e6b7f){if(_0x1e6b7f){logger['error'](_0x1e6b7f);return _0x21a6bd[_0x542a('0x12')](0x1f4)['json'](_0x1e6b7f);}logger['info'](_0x542a('0x16'));return _0x21a6bd[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x17')});});};exports[_0x542a('0x18')]=function(_0x386f73,_0x369046){return git['reset']([_0x542a('0x19'),'FETCH_HEAD'],function(_0x3341f6){if(_0x3341f6){logger[_0x542a('0x1a')](_0x3341f6);return _0x369046[_0x542a('0x12')](0x1f4)['json'](_0x3341f6);}logger[_0x542a('0x1b')](_0x542a('0x1c'));return _0x369046['status'](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x1d')});});};exports[_0x542a('0x1e')]=function(_0x1c2f14,_0x399df7){exec('npm\x20install\x20--production',function(_0x3447ea,_0x238dd6,_0x1c02f9){logger['info'](_0x238dd6);logger[_0x542a('0x1b')](_0x1c02f9);if(_0x3447ea){logger[_0x542a('0x1a')](_0x3447ea);return _0x399df7[_0x542a('0x12')](0x1f4)[_0x542a('0x13')](_0x3447ea);}return _0x399df7[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':_0x238dd6});});};exports[_0x542a('0x1f')]=function(_0x327f64,_0x563a1e){return pm2[_0x542a('0x1f')]('motion2')['then'](function(_0x44e8b7){logger['info'](_0x542a('0x20'),_0x44e8b7);return _0x563a1e[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x21')});})[_0x542a('0x22')](function(_0x1f1448){logger['error'](_0x1f1448);return _0x563a1e['status'](0x1f4)[_0x542a('0x13')](_0x1f1448);});};exports[_0x542a('0x23')]=function(_0x3c91f1,_0x5e4165){var _0x45e68e=fs[_0x542a('0x24')](path[_0x542a('0x25')](config['root'],'server',_0x542a('0x23')));var _0x519d84=[];for(var _0xdc38c6=0x0;_0xdc38c6<_0x45e68e['length'];_0xdc38c6++){var _0x4982ff=_0x45e68e[_0xdc38c6][_0x542a('0x26')](_0x542a('0x27'),'');if(compareVersions(module['exports'][_0x542a('0x4')],_0x4982ff)===-0x1){_0x519d84[_0x542a('0x28')](_0x4982ff);}}if(_0x519d84[_0x542a('0x29')]){var _0x4de6d1=_0x519d84[_0x542a('0x2a')](compareVersions);var _0x20a806=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x542a('0x2b'),'columnName':_0x542a('0x4')},'migrations':{'params':[db[_0x542a('0x2c')][_0x542a('0x2d')](),db[_0x542a('0x2c')][_0x542a('0x2e')],function(){throw new Error(_0x542a('0x2f'));}],'path':path[_0x542a('0x25')](config[_0x542a('0x30')],_0x542a('0x31'),_0x542a('0x23')),'pattern':/\.js$/}});_0x20a806['up']({'migrations':_['map'](_0x4de6d1,function(_0x1c3475){return _0x1c3475+_0x542a('0x27');})})[_0x542a('0x32')](function(){return _0x5e4165[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x33')+module[_0x542a('0xd')][_0x542a('0x4')]+_0x542a('0x34')+_[_0x542a('0x35')](_0x4de6d1),'migrations':_[_0x542a('0x25')](_0x4de6d1)});})['catch'](function(_0x8b2b3d){if(_0x8b2b3d instanceof db[_0x542a('0x2c')]['UniqueConstraintError']){return _0x5e4165['status'](0xc8)[_0x542a('0x13')]({'output':_0x542a('0x36')});}else{return _0x5e4165[_0x542a('0x12')](0x1f4)[_0x542a('0x13')](_0x8b2b3d);}});}else{return _0x5e4165[_0x542a('0x12')](0xc8)[_0x542a('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x4be1=['server','length','.js','sequelize','Migration','getQueryInterface','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','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','info','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join'];(function(_0x2f0166,_0x2c9892){var _0x1ba662=function(_0x305e9e){while(--_0x305e9e){_0x2f0166['push'](_0x2f0166['shift']());}};_0x1ba662(++_0x2c9892);}(_0x4be1,0x1a4));var _0x14be=function(_0x22f164,_0xaa4f80){_0x22f164=_0x22f164-0x0;var _0x51ab95=_0x4be1[_0x22f164];return _0x51ab95;};'use strict';var Umzug=require('umzug');var path=require(_0x14be('0x0'));var fs=require('fs');var _=require(_0x14be('0x1'));var pkginfo=require(_0x14be('0x2'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x14be('0x3'))['exec'];var db=require(_0x14be('0x4'))['db'];var config=require(_0x14be('0x5'));var pm2=require(_0x14be('0x6'));var logger=require(_0x14be('0x7'))(_0x14be('0x8'));var git=require(_0x14be('0x9'))(config[_0x14be('0xa')]);exports[_0x14be('0xb')]=function(_0x394aee,_0x34c0a7){var _0x366012={'current':module[_0x14be('0xc')][_0x14be('0xd')],'phonebar':0x2};if(_0x394aee[_0x14be('0xe')]&&_0x394aee[_0x14be('0xe')][_0x14be('0xf')]){return git[_0x14be('0x10')]()[_0x14be('0x11')](function(_0xf7bc8c,_0x38dc5b){_0x366012[_0x14be('0xf')]=(_0xf7bc8c?module[_0x14be('0xc')]['version']:_0x38dc5b['latest'])||_0x14be('0x12');return _0x34c0a7['status'](0xc8)['json'](_0x366012);});}else{return _0x34c0a7[_0x14be('0x13')](0xc8)[_0x14be('0x14')](_0x366012);}};exports[_0x14be('0x10')]=function(_0x2d826c,_0x114d70){return git[_0x14be('0x10')]([_0x14be('0x15'),_0x14be('0x16')],function(_0x5e08a5){if(_0x5e08a5){logger[_0x14be('0x17')](_0x5e08a5);return _0x114d70[_0x14be('0x13')](0x1f4)['json'](_0x5e08a5);}logger['info'](_0x14be('0x18'));return _0x114d70[_0x14be('0x13')](0xc8)[_0x14be('0x14')]({'output':_0x14be('0x19')});});};exports['reset']=function(_0x2944cf,_0xd3b6b5){return git[_0x14be('0x1a')](['--hard',_0x14be('0x1b')],function(_0x4d0f3c){if(_0x4d0f3c){logger[_0x14be('0x17')](_0x4d0f3c);return _0xd3b6b5['status'](0x1f4)[_0x14be('0x14')](_0x4d0f3c);}logger['info'](_0x14be('0x1c'));return _0xd3b6b5[_0x14be('0x13')](0xc8)[_0x14be('0x14')]({'output':'git\x20reset\x20--hard'});});};exports[_0x14be('0x1d')]=function(_0x3e1bc3,_0x42d9d8){exec(_0x14be('0x1e'),function(_0x32b215,_0xb65dc7,_0x481064){logger[_0x14be('0x1f')](_0xb65dc7);logger[_0x14be('0x1f')](_0x481064);if(_0x32b215){logger['error'](_0x32b215);return _0x42d9d8[_0x14be('0x13')](0x1f4)[_0x14be('0x14')](_0x32b215);}return _0x42d9d8[_0x14be('0x13')](0xc8)[_0x14be('0x14')]({'output':_0xb65dc7});});};exports[_0x14be('0x20')]=function(_0x755a51,_0x208aaa){return pm2[_0x14be('0x20')](_0x14be('0x21'))['then'](function(_0x3882c2){logger[_0x14be('0x1f')](_0x14be('0x22'),_0x3882c2);return _0x208aaa['status'](0xc8)[_0x14be('0x14')]({'output':_0x14be('0x23')});})[_0x14be('0x24')](function(_0x5f32cd){logger['error'](_0x5f32cd);return _0x208aaa[_0x14be('0x13')](0x1f4)[_0x14be('0x14')](_0x5f32cd);});};exports[_0x14be('0x25')]=function(_0x3f2d90,_0x5ae0c5){var _0x382fe4=fs['readdirSync'](path[_0x14be('0x26')](config['root'],_0x14be('0x27'),'migrations'));var _0x35d5e6=[];for(var _0x5b9679=0x0;_0x5b9679<_0x382fe4[_0x14be('0x28')];_0x5b9679++){var _0xab9b6a=_0x382fe4[_0x5b9679]['replace'](_0x14be('0x29'),'');if(compareVersions(module[_0x14be('0xc')][_0x14be('0xd')],_0xab9b6a)===-0x1){_0x35d5e6['push'](_0xab9b6a);}}if(_0x35d5e6['length']){var _0x26f6b5=_0x35d5e6['sort'](compareVersions);var _0x5bdbe7=new Umzug({'storage':_0x14be('0x2a'),'storageOptions':{'model':db[_0x14be('0x2b')],'modelName':_0x14be('0x2b'),'columnName':_0x14be('0xd')},'migrations':{'params':[db[_0x14be('0x2a')][_0x14be('0x2c')](),db[_0x14be('0x2a')][_0x14be('0x2d')],function(){throw new Error(_0x14be('0x2e'));}],'path':path[_0x14be('0x26')](config[_0x14be('0xa')],_0x14be('0x27'),'migrations'),'pattern':/\.js$/}});_0x5bdbe7['up']({'migrations':_[_0x14be('0x2f')](_0x26f6b5,function(_0x1a1c17){return _0x1a1c17+_0x14be('0x29');})})['then'](function(){return _0x5ae0c5[_0x14be('0x13')](0xc8)['json']({'output':_0x14be('0x30')+module[_0x14be('0xc')]['version']+'\x20to\x20'+_['last'](_0x26f6b5),'migrations':_['join'](_0x26f6b5)});})['catch'](function(_0x3e5dbf){if(_0x3e5dbf instanceof db[_0x14be('0x2a')][_0x14be('0x31')]){return _0x5ae0c5[_0x14be('0x13')](0xc8)[_0x14be('0x14')]({'output':_0x14be('0x32')});}else{return _0x5ae0c5[_0x14be('0x13')](0x1f4)[_0x14be('0x14')](_0x3e5dbf);}});}else{return _0x5ae0c5[_0x14be('0x13')](0xc8)[_0x14be('0x14')]({'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 727b548..9c362e1 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 _0xb34d=['show','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb34d,0x1ec));var _0xdb34=function(_0x4acf81,_0x531bd2){_0x4acf81=_0x4acf81-0x0;var _0x338298=_0xb34d[_0x4acf81];return _0x338298;};'use strict';var multer=require(_0xdb34('0x0'));var util=require(_0xdb34('0x1'));var path=require(_0xdb34('0x2'));var timeout=require(_0xdb34('0x3'));var express=require(_0xdb34('0x4'));var router=express['Router']();var fs_extra=require(_0xdb34('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb34('0x6'));var config=require(_0xdb34('0x7'));var controller=require(_0xdb34('0x8'));router[_0xdb34('0x9')]('/',auth[_0xdb34('0xa')](),controller[_0xdb34('0xb')]);router['get'](_0xdb34('0xc'),auth[_0xdb34('0xa')](),controller[_0xdb34('0xd')]);router[_0xdb34('0x9')]('/:id',auth[_0xdb34('0xa')](),controller[_0xdb34('0xe')]);router[_0xdb34('0xf')]('/',auth[_0xdb34('0xa')](),controller[_0xdb34('0x10')]);router[_0xdb34('0x11')]('/:id',auth[_0xdb34('0xa')](),controller['update']);router[_0xdb34('0x12')](_0xdb34('0x13'),auth[_0xdb34('0xa')](),controller[_0xdb34('0x14')]);module[_0xdb34('0x15')]=router; \ No newline at end of file +var _0xe1e8=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x2e90c3,_0x15528c){var _0x5db9ca=function(_0x311d1a){while(--_0x311d1a){_0x2e90c3['push'](_0x2e90c3['shift']());}};_0x5db9ca(++_0x15528c);}(_0xe1e8,0x162));var _0x8e1e=function(_0x121243,_0x50e778){_0x121243=_0x121243-0x0;var _0x471dbb=_0xe1e8[_0x121243];return _0x471dbb;};'use strict';var multer=require(_0x8e1e('0x0'));var util=require(_0x8e1e('0x1'));var path=require(_0x8e1e('0x2'));var timeout=require(_0x8e1e('0x3'));var express=require('express');var router=express[_0x8e1e('0x4')]();var fs_extra=require(_0x8e1e('0x5'));var auth=require(_0x8e1e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e1e('0x7'));var controller=require(_0x8e1e('0x8'));router[_0x8e1e('0x9')]('/',auth[_0x8e1e('0xa')](),controller['index']);router['get']('/describe',auth[_0x8e1e('0xa')](),controller['describe']);router[_0x8e1e('0x9')](_0x8e1e('0xb'),auth[_0x8e1e('0xa')](),controller['show']);router['post']('/',auth[_0x8e1e('0xa')](),controller[_0x8e1e('0xc')]);router[_0x8e1e('0xd')](_0x8e1e('0xb'),auth[_0x8e1e('0xa')](),controller[_0x8e1e('0xe')]);router[_0x8e1e('0xf')]('/:id',auth[_0x8e1e('0xa')](),controller['destroy']);module[_0x8e1e('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index da00f5d..855f3a7 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 _0x5c3c=['STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x43bd66,_0x27e9b3){var _0x5195cb=function(_0xe936f0){while(--_0xe936f0){_0x43bd66['push'](_0x43bd66['shift']());}};_0x5195cb(++_0x27e9b3);}(_0x5c3c,0x132));var _0xc5c3=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x5c3c[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'type':{'type':Sequelize[_0xc5c3('0x2')]},'uniqueid':{'type':Sequelize[_0xc5c3('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc5c3('0x2')]},'queue':{'type':Sequelize[_0xc5c3('0x2')]},'interface':{'type':Sequelize[_0xc5c3('0x2')]},'membername':{'type':Sequelize[_0xc5c3('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc5c3('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc5c3('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc5c3('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xc5c3('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc5c3('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc5c3('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc5c3('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc5c3('0x5')]},'reason':{'type':Sequelize[_0xc5c3('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc5c3('0x2')]},'channelstate':{'type':Sequelize[_0xc5c3('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc5c3('0x2')]},'connectedlinename':{'type':Sequelize[_0xc5c3('0x2')]},'language':{'type':Sequelize[_0xc5c3('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc5c3('0x2')]},'exten':{'type':Sequelize[_0xc5c3('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc5c3('0x2')]},'destchannelstate':{'type':Sequelize[_0xc5c3('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xc5c3('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc5c3('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc5c3('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc5c3('0x2')]},'destlanguage':{'type':Sequelize[_0xc5c3('0x2')]},'destaccountcode':{'type':Sequelize[_0xc5c3('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc5c3('0x2')]},'destuniqueid':{'type':Sequelize[_0xc5c3('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc5c3('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc5c3('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc5c3('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xc5c3('0x2')]},'agententerreason':{'type':Sequelize[_0xc5c3('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x56c8=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x56c8,0x12f));var _0x856c=function(_0x1a27a8,_0x145f28){_0x1a27a8=_0x1a27a8-0x0;var _0x2bcdc2=_0x56c8[_0x1a27a8];return _0x2bcdc2;};'use strict';var Sequelize=require(_0x856c('0x0'));module[_0x856c('0x1')]={'type':{'type':Sequelize[_0x856c('0x2')]},'uniqueid':{'type':Sequelize[_0x856c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x856c('0x2')]},'queue':{'type':Sequelize[_0x856c('0x2')]},'interface':{'type':Sequelize[_0x856c('0x2')]},'membername':{'type':Sequelize[_0x856c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x856c('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x856c('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x856c('0x3')]},'agentdumpAt':{'type':Sequelize[_0x856c('0x3')]},'holdtime':{'type':Sequelize[_0x856c('0x4')]},'agentcomplete':{'type':Sequelize[_0x856c('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x856c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x856c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x856c('0x4')]},'reason':{'type':Sequelize[_0x856c('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x856c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x856c('0x2')]},'connectedlinename':{'type':Sequelize[_0x856c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x856c('0x2')]},'context':{'type':Sequelize[_0x856c('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x856c('0x2')]},'destchannel':{'type':Sequelize[_0x856c('0x2')]},'destchannelstate':{'type':Sequelize[_0x856c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x856c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x856c('0x2')]},'destcalleridname':{'type':Sequelize[_0x856c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x856c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x856c('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x856c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x856c('0x2')]},'destpriority':{'type':Sequelize[_0x856c('0x2')]},'destuniqueid':{'type':Sequelize[_0x856c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x856c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x856c('0x2')]},'transfer':{'type':Sequelize[_0x856c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x856c('0x2')],'comment':_0x856c('0x6')},'transferexten':{'type':Sequelize[_0x856c('0x2')]},'transferuniqueid':{'type':Sequelize[_0x856c('0x2')]},'agententerreason':{'type':Sequelize[_0x856c('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index e9ac907..692d776 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(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 37e9ebe..a31aef9 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 _0x383d=['define','VoiceAgentReport','report_agent','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x1630f1,_0x2eba83){var _0x1531e6=function(_0x1d25ec){while(--_0x1d25ec){_0x1630f1['push'](_0x1630f1['shift']());}};_0x1531e6(++_0x2eba83);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd383('0x0'))(_0xd383('0x1'));var moment=require(_0xd383('0x2'));var BPromise=require('bluebird');var rp=require(_0xd383('0x3'));var fs=require('fs');var path=require(_0xd383('0x4'));var rimraf=require(_0xd383('0x5'));var config=require(_0xd383('0x6'));var attributes=require(_0xd383('0x7'));module[_0xd383('0x8')]=function(_0x5a0b1d,_0xc64e9b){return _0x5a0b1d[_0xd383('0x9')](_0xd383('0xa'),attributes,{'tableName':_0xd383('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd383('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1696=['destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x1696,0x79));var _0x6169=function(_0x4a6038,_0x4464af){_0x4a6038=_0x4a6038-0x0;var _0x42c946=_0x1696[_0x4a6038];return _0x42c946;};'use strict';var _=require(_0x6169('0x0'));var util=require('util');var logger=require(_0x6169('0x1'))(_0x6169('0x2'));var moment=require(_0x6169('0x3'));var BPromise=require(_0x6169('0x4'));var rp=require(_0x6169('0x5'));var fs=require('fs');var path=require(_0x6169('0x6'));var rimraf=require(_0x6169('0x7'));var config=require(_0x6169('0x8'));var attributes=require(_0x6169('0x9'));module['exports']=function(_0x3569ff,_0x128cf1){return _0x3569ff[_0x6169('0xa')](_0x6169('0xb'),attributes,{'tableName':_0x6169('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6169('0xd'),_0x6169('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f331a4d..1ec26b9 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 _0xf982=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','moment','randomstring','ioredis'];(function(_0xadeb56,_0x1c1af5){var _0xe0c8b2=function(_0x4ecbfa){while(--_0x4ecbfa){_0xadeb56['push'](_0xadeb56['shift']());}};_0xe0c8b2(++_0x1c1af5);}(_0xf982,0x170));var _0x2f98=function(_0x202f18,_0x2b615d){_0x202f18=_0x202f18-0x0;var _0x4d5e20=_0xf982[_0x202f18];return _0x4d5e20;};'use strict';var _=require(_0x2f98('0x0'));var util=require('util');var moment=require(_0x2f98('0x1'));var BPromise=require('bluebird');var rs=require(_0x2f98('0x2'));var fs=require('fs');var Redis=require(_0x2f98('0x3'));var db=require(_0x2f98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f98('0x5'))('rpc');var config=require(_0x2f98('0x6'));var jayson=require(_0x2f98('0x7'));var client=jayson['client'][_0x2f98('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bdd0d,_0x19e214,_0x180a9f){return new BPromise(function(_0x3bfae1,_0x4f232c){return client[_0x2f98('0x9')](_0x1bdd0d,_0x180a9f)[_0x2f98('0xa')](function(_0x48b43b){logger[_0x2f98('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x19e214,_0x2f98('0xc'));logger[_0x2f98('0xd')](_0x2f98('0xe'),_0x19e214,_0x2f98('0xc'),JSON[_0x2f98('0xf')](_0x48b43b));if(_0x48b43b[_0x2f98('0x10')]){if(_0x48b43b[_0x2f98('0x10')]['code']===0x1f4){logger[_0x2f98('0x10')](_0x2f98('0x11'),_0x19e214,_0x48b43b[_0x2f98('0x10')]['message']);return _0x4f232c(_0x48b43b[_0x2f98('0x10')]['message']);}logger[_0x2f98('0x10')](_0x2f98('0x11'),_0x19e214,_0x48b43b['error'][_0x2f98('0x12')]);return _0x3bfae1(_0x48b43b[_0x2f98('0x10')][_0x2f98('0x12')]);}else{logger[_0x2f98('0xb')](_0x2f98('0x11'),_0x19e214,_0x2f98('0xc'));_0x3bfae1(_0x48b43b[_0x2f98('0x13')][_0x2f98('0x12')]);}})[_0x2f98('0x14')](function(_0x12702c){logger['error'](_0x2f98('0x11'),_0x19e214,_0x12702c);_0x4f232c(_0x12702c);});});}exports[_0x2f98('0x15')]=function(_0x48743c){var _0x21273f=this;return new Promise(function(_0x4fb2a0,_0x87506c){return db[_0x2f98('0x16')]['create'](_0x48743c[_0x2f98('0x17')],{'raw':_0x48743c[_0x2f98('0x18')]?_0x48743c[_0x2f98('0x18')][_0x2f98('0x19')]===undefined?!![]:![]:!![]})[_0x2f98('0xa')](function(_0x10482e){logger[_0x2f98('0xb')](_0x2f98('0x15'),_0x48743c);logger['debug'](_0x2f98('0x15'),_0x48743c,JSON[_0x2f98('0xf')](_0x10482e));_0x4fb2a0(_0x10482e);})['catch'](function(_0x5e99d9){logger[_0x2f98('0x10')]('CreateVoiceAgentReport',_0x5e99d9[_0x2f98('0x12')],_0x48743c);_0x87506c(_0x21273f[_0x2f98('0x10')](0x1f4,_0x5e99d9[_0x2f98('0x12')]));});});};exports[_0x2f98('0x1a')]=function(_0x5cf83e){var _0x436839=this;return new Promise(function(_0x1557ab,_0x5d08e9){return db['VoiceAgentReport'][_0x2f98('0x1b')](_0x5cf83e['body'],{'raw':_0x5cf83e['options']?_0x5cf83e[_0x2f98('0x18')][_0x2f98('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cf83e[_0x2f98('0x18')]?_0x5cf83e[_0x2f98('0x18')][_0x2f98('0x1c')]||null:null,'attributes':_0x5cf83e[_0x2f98('0x18')]?_0x5cf83e[_0x2f98('0x18')][_0x2f98('0x1d')]||null:null,'limit':_0x5cf83e[_0x2f98('0x18')]?_0x5cf83e['options'][_0x2f98('0x1e')]||null:null})[_0x2f98('0xa')](function(_0x1bca30){logger['info'](_0x2f98('0x1a'),_0x5cf83e);logger[_0x2f98('0xd')](_0x2f98('0x1a'),_0x5cf83e,JSON[_0x2f98('0xf')](_0x1bca30));_0x1557ab(_0x1bca30);})['catch'](function(_0x1497df){logger[_0x2f98('0x10')](_0x2f98('0x1a'),_0x1497df[_0x2f98('0x12')],_0x5cf83e);_0x5d08e9(_0x436839[_0x2f98('0x10')](0x1f4,_0x1497df[_0x2f98('0x12')]));});});}; \ No newline at end of file +var _0x679a=['../../config/utils','rpc','../../config/environment','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','update','where','attributes','UpdateVoiceAgentReport','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3d8812,_0x24b648){var _0x3aa4ee=function(_0x1d5e09){while(--_0x1d5e09){_0x3d8812['push'](_0x3d8812['shift']());}};_0x3aa4ee(++_0x24b648);}(_0x679a,0x19b));var _0xa679=function(_0xe35a3,_0x4973eb){_0xe35a3=_0xe35a3-0x0;var _0x4ba2d2=_0x679a[_0xe35a3];return _0x4ba2d2;};'use strict';var _=require('lodash');var util=require(_0xa679('0x0'));var moment=require(_0xa679('0x1'));var BPromise=require(_0xa679('0x2'));var rs=require(_0xa679('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa679('0x4'))['db'];var utils=require(_0xa679('0x5'));var logger=require('../../config/logger')(_0xa679('0x6'));var config=require(_0xa679('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa679('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4eeb07,_0x2a3965,_0x29ae30){return new BPromise(function(_0x13eda3,_0x21cfcd){return client[_0xa679('0x9')](_0x4eeb07,_0x29ae30)[_0xa679('0xa')](function(_0x34020c){logger[_0xa679('0xb')](_0xa679('0xc'),_0x2a3965,_0xa679('0xd'));logger[_0xa679('0xe')](_0xa679('0xf'),_0x2a3965,_0xa679('0xd'),JSON[_0xa679('0x10')](_0x34020c));if(_0x34020c[_0xa679('0x11')]){if(_0x34020c[_0xa679('0x11')][_0xa679('0x12')]===0x1f4){logger[_0xa679('0x11')](_0xa679('0xc'),_0x2a3965,_0x34020c[_0xa679('0x11')][_0xa679('0x13')]);return _0x21cfcd(_0x34020c['error'][_0xa679('0x13')]);}logger[_0xa679('0x11')](_0xa679('0xc'),_0x2a3965,_0x34020c[_0xa679('0x11')][_0xa679('0x13')]);return _0x13eda3(_0x34020c[_0xa679('0x11')]['message']);}else{logger['info'](_0xa679('0xc'),_0x2a3965,_0xa679('0xd'));_0x13eda3(_0x34020c[_0xa679('0x14')][_0xa679('0x13')]);}})[_0xa679('0x15')](function(_0x38aed4){logger[_0xa679('0x11')](_0xa679('0xc'),_0x2a3965,_0x38aed4);_0x21cfcd(_0x38aed4);});});}exports[_0xa679('0x16')]=function(_0x41355c){var _0x5f5b45=this;return new Promise(function(_0x4cff3a,_0x4628f0){return db[_0xa679('0x17')][_0xa679('0x18')](_0x41355c[_0xa679('0x19')],{'raw':_0x41355c[_0xa679('0x1a')]?_0x41355c[_0xa679('0x1a')][_0xa679('0x1b')]===undefined?!![]:![]:!![]})[_0xa679('0xa')](function(_0x2b208d){logger[_0xa679('0xb')]('CreateVoiceAgentReport',_0x41355c);logger[_0xa679('0xe')](_0xa679('0x16'),_0x41355c,JSON['stringify'](_0x2b208d));_0x4cff3a(_0x2b208d);})[_0xa679('0x15')](function(_0x464650){logger[_0xa679('0x11')](_0xa679('0x16'),_0x464650[_0xa679('0x13')],_0x41355c);_0x4628f0(_0x5f5b45[_0xa679('0x11')](0x1f4,_0x464650['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x595004){var _0xa99df8=this;return new Promise(function(_0x1f7851,_0x307368){return db[_0xa679('0x17')][_0xa679('0x1c')](_0x595004[_0xa679('0x19')],{'raw':_0x595004[_0xa679('0x1a')]?_0x595004[_0xa679('0x1a')][_0xa679('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x595004[_0xa679('0x1a')]?_0x595004['options'][_0xa679('0x1d')]||null:null,'attributes':_0x595004['options']?_0x595004[_0xa679('0x1a')][_0xa679('0x1e')]||null:null,'limit':_0x595004[_0xa679('0x1a')]?_0x595004[_0xa679('0x1a')]['limit']||null:null})[_0xa679('0xa')](function(_0x386f6a){logger['info'](_0xa679('0x1f'),_0x595004);logger['debug'](_0xa679('0x1f'),_0x595004,JSON[_0xa679('0x10')](_0x386f6a));_0x1f7851(_0x386f6a);})[_0xa679('0x15')](function(_0x13bbc1){logger[_0xa679('0x11')](_0xa679('0x1f'),_0x13bbc1[_0xa679('0x13')],_0x595004);_0x307368(_0xa99df8[_0xa679('0x11')](0x1f4,_0x13bbc1[_0xa679('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 42a0baa..c499f06 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 _0x4bc3=['post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x10fd27,_0x9e3ecd){var _0x5b5d6a=function(_0x4e197a){while(--_0x4e197a){_0x10fd27['push'](_0x10fd27['shift']());}};_0x5b5d6a(++_0x9e3ecd);}(_0x4bc3,0x16e));var _0x34bc=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4bc3[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var fs_extra=require(_0x34bc('0x4'));var auth=require(_0x34bc('0x5'));var interaction=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var controller=require(_0x34bc('0x8'));router[_0x34bc('0x9')]('/',auth[_0x34bc('0xa')](),controller['index']);router[_0x34bc('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x34bc('0xb')]);router[_0x34bc('0x9')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0xa')](),controller['update']);router[_0x34bc('0x10')]('/:id',auth[_0x34bc('0xa')](),controller[_0x34bc('0x11')]);module[_0x34bc('0x12')]=router; \ No newline at end of file +var _0x00bb=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x5a7b5b,_0x3ca019){var _0x147ff6=function(_0x4bf31f){while(--_0x4bf31f){_0x5a7b5b['push'](_0x5a7b5b['shift']());}};_0x147ff6(++_0x3ca019);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var fs_extra=require(_0xb00b('0x4'));var auth=require(_0xb00b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb00b('0x6'));var controller=require(_0xb00b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb00b('0x8')](_0xb00b('0x9'),auth[_0xb00b('0xa')](),controller[_0xb00b('0xb')]);router[_0xb00b('0x8')](_0xb00b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb00b('0xd')]('/',auth[_0xb00b('0xa')](),controller[_0xb00b('0xe')]);router[_0xb00b('0xf')](_0xb00b('0xc'),auth['isAuthenticated'](),controller[_0xb00b('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb00b('0x11')]);module[_0xb00b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 552e884..7dbca96 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 _0x7152=['INTEGER','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x5969d1,_0xda2050){var _0x18cad1=function(_0x51821c){while(--_0x51821c){_0x5969d1['push'](_0x5969d1['shift']());}};_0x18cad1(++_0xda2050);}(_0x7152,0x114));var _0x2715=function(_0x40b6db,_0x2a1fbb){_0x40b6db=_0x40b6db-0x0;var _0x3eaa81=_0x7152[_0x40b6db];return _0x3eaa81;};'use strict';var Sequelize=require('sequelize');module[_0x2715('0x0')]={'uniqueid':{'type':Sequelize[_0x2715('0x1')]},'type':{'type':Sequelize['ENUM'](_0x2715('0x2'),_0x2715('0x3'),_0x2715('0x4'),_0x2715('0x5'),_0x2715('0x6'),_0x2715('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2715('0x1')]},'source':{'type':Sequelize[_0x2715('0x1')]},'destination':{'type':Sequelize[_0x2715('0x1')]},'destinationcontext':{'type':Sequelize[_0x2715('0x1')]},'callerid':{'type':Sequelize[_0x2715('0x1')]},'channel':{'type':Sequelize[_0x2715('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x2715('0x1')]},'lastdata':{'type':Sequelize[_0x2715('0x8')]},'starttime':{'type':Sequelize[_0x2715('0x9')]},'systemanswertime':{'type':Sequelize[_0x2715('0x9')]},'answertime':{'type':Sequelize[_0x2715('0x9')]},'endtime':{'type':Sequelize[_0x2715('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x2715('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2715('0x1')]},'amaflags':{'type':Sequelize[_0x2715('0x1')]},'userfield':{'type':Sequelize[_0x2715('0x1')]},'userDisposition':{'type':Sequelize[_0x2715('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2715('0x1')]},'note':{'type':Sequelize[_0x2715('0x1')]},'prefix':{'type':Sequelize[_0x2715('0x1')]},'routeid':{'type':Sequelize[_0x2715('0xa')]},'sipcallid':{'type':Sequelize[_0x2715('0x1')]}}; \ No newline at end of file +var _0x2b80=['outbound-fax','dialer','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x2b80,0x1a6));var _0x02b8=function(_0x4cc89d,_0x5bc1cf){_0x4cc89d=_0x4cc89d-0x0;var _0x5764f6=_0x2b80[_0x4cc89d];return _0x5764f6;};'use strict';var Sequelize=require(_0x02b8('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x02b8('0x1')]},'type':{'type':Sequelize[_0x02b8('0x2')](_0x02b8('0x3'),_0x02b8('0x4'),_0x02b8('0x5'),_0x02b8('0x6'),_0x02b8('0x7'),_0x02b8('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x02b8('0x1')]},'source':{'type':Sequelize[_0x02b8('0x1')]},'destination':{'type':Sequelize[_0x02b8('0x1')]},'destinationcontext':{'type':Sequelize[_0x02b8('0x1')]},'callerid':{'type':Sequelize[_0x02b8('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x02b8('0x1')]},'lastapplication':{'type':Sequelize[_0x02b8('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x02b8('0x9')]},'systemanswertime':{'type':Sequelize[_0x02b8('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x02b8('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x02b8('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x02b8('0x1')]},'userfield':{'type':Sequelize[_0x02b8('0x1')]},'userDisposition':{'type':Sequelize[_0x02b8('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x02b8('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x02b8('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x02b8('0x1')]},'routeid':{'type':Sequelize[_0x02b8('0xa')]},'sipcallid':{'type':Sequelize[_0x02b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index a25bf76..8bff0d2 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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9d76e6,_0x243275){_0x9d76e6=_0x9d76e6-0x0;var _0x357a60=_0x5f2f[_0x9d76e6];return _0x357a60;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file +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(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0xadb5,0xad));var _0x5adb=function(_0x20710a,_0x12aaf8){_0x20710a=_0x20710a-0x0;var _0x2733a7=_0xadb5[_0x20710a];return _0x2733a7;};'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 diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1d91c9e..2f52616 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 _0x282f=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','api'];(function(_0x29d28c,_0x2bd080){var _0xd6f3ea=function(_0x44360c){while(--_0x44360c){_0x29d28c['push'](_0x29d28c['shift']());}};_0xd6f3ea(++_0x2bd080);}(_0x282f,0x135));var _0xf282=function(_0x1122fa,_0x41cf04){_0x1122fa=_0x1122fa-0x0;var _0x481350=_0x282f[_0x1122fa];return _0x481350;};'use strict';var _=require(_0xf282('0x0'));var util=require(_0xf282('0x1'));var logger=require('../../config/logger')(_0xf282('0x2'));var moment=require(_0xf282('0x3'));var BPromise=require(_0xf282('0x4'));var rp=require(_0xf282('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf282('0x6'));var config=require(_0xf282('0x7'));var attributes=require(_0xf282('0x8'));module[_0xf282('0x9')]=function(_0x3a1af2,_0x4767a0){return _0x3a1af2[_0xf282('0xa')](_0xf282('0xb'),attributes,{'tableName':_0xf282('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x50ba=['VoiceCallReport','report_call','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceCallReport.attributes','exports','define'];(function(_0x19f433,_0x14d673){var _0x5eb846=function(_0x33bfcf){while(--_0x33bfcf){_0x19f433['push'](_0x19f433['shift']());}};_0x5eb846(++_0x14d673);}(_0x50ba,0x18e));var _0xa50b=function(_0x3ad1aa,_0x1e5418){_0x3ad1aa=_0x3ad1aa-0x0;var _0x535c08=_0x50ba[_0x3ad1aa];return _0x535c08;};'use strict';var _=require(_0xa50b('0x0'));var util=require('util');var logger=require(_0xa50b('0x1'))(_0xa50b('0x2'));var moment=require(_0xa50b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa50b('0x4'));var rimraf=require('rimraf');var config=require(_0xa50b('0x5'));var attributes=require(_0xa50b('0x6'));module[_0xa50b('0x7')]=function(_0x3cdfa1,_0x36bb65){return _0x3cdfa1[_0xa50b('0x8')](_0xa50b('0x9'),attributes,{'tableName':_0xa50b('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 6fd4611..c35ee19 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 _0x406f=['CreateVoiceCallReport','body','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','VoiceCallReport','options','raw','limit','include','map','model','attributes','GetVoiceCallReport'];(function(_0x4c91f6,_0x3fcabc){var _0x34d997=function(_0x1eea46){while(--_0x1eea46){_0x4c91f6['push'](_0x4c91f6['shift']());}};_0x34d997(++_0x3fcabc);}(_0x406f,0xe8));var _0xf406=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x406f[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xf406('0x0'));var util=require('util');var moment=require(_0xf406('0x1'));var BPromise=require('bluebird');var rs=require(_0xf406('0x2'));var fs=require('fs');var Redis=require(_0xf406('0x3'));var db=require(_0xf406('0x4'))['db'];var utils=require(_0xf406('0x5'));var logger=require(_0xf406('0x6'))(_0xf406('0x7'));var config=require(_0xf406('0x8'));var jayson=require(_0xf406('0x9'));var client=jayson[_0xf406('0xa')][_0xf406('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51237b,_0x198f48,_0x18bf2f){return new BPromise(function(_0x1130ae,_0x4a2821){return client[_0xf406('0xc')](_0x51237b,_0x18bf2f)[_0xf406('0xd')](function(_0x5286ac){logger[_0xf406('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x198f48,_0xf406('0xf'));logger[_0xf406('0x10')](_0xf406('0x11'),_0x198f48,_0xf406('0xf'),JSON[_0xf406('0x12')](_0x5286ac));if(_0x5286ac[_0xf406('0x13')]){if(_0x5286ac[_0xf406('0x13')][_0xf406('0x14')]===0x1f4){logger[_0xf406('0x13')](_0xf406('0x15'),_0x198f48,_0x5286ac['error'][_0xf406('0x16')]);return _0x4a2821(_0x5286ac[_0xf406('0x13')]['message']);}logger[_0xf406('0x13')](_0xf406('0x15'),_0x198f48,_0x5286ac['error']['message']);return _0x1130ae(_0x5286ac['error'][_0xf406('0x16')]);}else{logger[_0xf406('0xe')](_0xf406('0x15'),_0x198f48,_0xf406('0xf'));_0x1130ae(_0x5286ac[_0xf406('0x17')][_0xf406('0x16')]);}})[_0xf406('0x18')](function(_0xf12e37){logger['error'](_0xf406('0x15'),_0x198f48,_0xf12e37);_0x4a2821(_0xf12e37);});});}exports['GetVoiceCallReport']=function(_0x4f441f){var _0x5212c3=this;return new Promise(function(_0x42c349,_0x5d7d0c){return db[_0xf406('0x19')]['findAll']({'raw':_0x4f441f[_0xf406('0x1a')]?_0x4f441f['options'][_0xf406('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f441f[_0xf406('0x1a')]?_0x4f441f['options']['where']||null:null,'attributes':_0x4f441f[_0xf406('0x1a')]?_0x4f441f[_0xf406('0x1a')]['attributes']||null:null,'limit':_0x4f441f['options']?_0x4f441f[_0xf406('0x1a')][_0xf406('0x1c')]||null:null,'include':_0x4f441f[_0xf406('0x1a')]?_0x4f441f[_0xf406('0x1a')][_0xf406('0x1d')]?_[_0xf406('0x1e')](_0x4f441f['options'][_0xf406('0x1d')],function(_0x3ea732){return{'model':db[_0x3ea732[_0xf406('0x1f')]],'as':_0x3ea732['as'],'attributes':_0x3ea732[_0xf406('0x20')],'include':_0x3ea732[_0xf406('0x1d')]?_[_0xf406('0x1e')](_0x3ea732['include'],function(_0x14a818){return{'model':db[_0x14a818['model']],'as':_0x14a818['as'],'attributes':_0x14a818['attributes'],'include':_0x14a818[_0xf406('0x1d')]?_[_0xf406('0x1e')](_0x14a818[_0xf406('0x1d')],function(_0x44ff3c){return{'model':db[_0x44ff3c[_0xf406('0x1f')]],'as':_0x44ff3c['as'],'attributes':_0x44ff3c[_0xf406('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5377d8){logger['info'](_0xf406('0x21'),_0x4f441f);logger[_0xf406('0x10')](_0xf406('0x21'),_0x4f441f,JSON[_0xf406('0x12')](_0x5377d8));_0x42c349(_0x5377d8);})[_0xf406('0x18')](function(_0x1e2e45){logger[_0xf406('0x13')](_0xf406('0x21'),_0x1e2e45[_0xf406('0x16')],_0x4f441f);_0x5d7d0c(_0x5212c3[_0xf406('0x13')](0x1f4,_0x1e2e45['message']));});});};exports[_0xf406('0x22')]=function(_0x36ce13){var _0x170307=this;return new Promise(function(_0x291f69,_0x37b7f6){return db[_0xf406('0x19')]['create'](_0x36ce13[_0xf406('0x23')],{'raw':_0x36ce13[_0xf406('0x1a')]?_0x36ce13['options'][_0xf406('0x1b')]===undefined?!![]:![]:!![]})[_0xf406('0xd')](function(_0x274a3a){logger['info'](_0xf406('0x22'),_0x36ce13);logger[_0xf406('0x10')](_0xf406('0x22'),_0x36ce13,JSON[_0xf406('0x12')](_0x274a3a));_0x291f69(_0x274a3a);})[_0xf406('0x18')](function(_0x4b9e23){logger[_0xf406('0x13')](_0xf406('0x22'),_0x4b9e23[_0xf406('0x16')],_0x36ce13);_0x37b7f6(_0x170307[_0xf406('0x13')](0x1f4,_0x4b9e23[_0xf406('0x16')]));});});};exports[_0xf406('0x24')]=function(_0x1ccc56){var _0x30e232=this;return new Promise(function(_0x101383,_0x3b8106){return db[_0xf406('0x19')][_0xf406('0x25')](_0x1ccc56[_0xf406('0x23')],{'raw':_0x1ccc56['options']?_0x1ccc56[_0xf406('0x1a')][_0xf406('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ccc56[_0xf406('0x1a')]?_0x1ccc56[_0xf406('0x1a')]['where']||null:null,'attributes':_0x1ccc56[_0xf406('0x1a')]?_0x1ccc56[_0xf406('0x1a')][_0xf406('0x20')]||null:null,'limit':_0x1ccc56[_0xf406('0x1a')]?_0x1ccc56[_0xf406('0x1a')][_0xf406('0x1c')]||null:null})[_0xf406('0xd')](function(_0x2f5a1f){logger[_0xf406('0xe')](_0xf406('0x24'),_0x1ccc56);logger[_0xf406('0x10')]('UpdateVoiceCallReport',_0x1ccc56,JSON['stringify'](_0x2f5a1f));_0x101383(_0x2f5a1f);})[_0xf406('0x18')](function(_0xdb40f6){logger[_0xf406('0x13')](_0xf406('0x24'),_0xdb40f6[_0xf406('0x16')],_0x1ccc56);_0x3b8106(_0x30e232[_0xf406('0x13')](0x1f4,_0xdb40f6[_0xf406('0x16')]));});});}; \ No newline at end of file +var _0x4b2f=['catch','GetVoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','info','CreateVoiceCallReport','VoiceCallReport','body','debug','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x4b2f,0xa6));var _0xf4b2=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x4b2f[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0xf4b2('0x0'));var util=require(_0xf4b2('0x1'));var moment=require(_0xf4b2('0x2'));var BPromise=require(_0xf4b2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4b2('0x4'))['db'];var utils=require(_0xf4b2('0x5'));var logger=require('../../config/logger')(_0xf4b2('0x6'));var config=require('../../config/environment');var jayson=require(_0xf4b2('0x7'));var client=jayson[_0xf4b2('0x8')][_0xf4b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a5c55,_0x115eeb,_0x2c3f7d){return new BPromise(function(_0x5903e1,_0x2721ac){return client['request'](_0x3a5c55,_0x2c3f7d)[_0xf4b2('0xa')](function(_0x3cb471){logger['info'](_0xf4b2('0xb'),_0x115eeb,_0xf4b2('0xc'));logger['debug'](_0xf4b2('0xd'),_0x115eeb,_0xf4b2('0xc'),JSON[_0xf4b2('0xe')](_0x3cb471));if(_0x3cb471[_0xf4b2('0xf')]){if(_0x3cb471[_0xf4b2('0xf')][_0xf4b2('0x10')]===0x1f4){logger[_0xf4b2('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x115eeb,_0x3cb471[_0xf4b2('0xf')]['message']);return _0x2721ac(_0x3cb471[_0xf4b2('0xf')][_0xf4b2('0x11')]);}logger['error'](_0xf4b2('0xb'),_0x115eeb,_0x3cb471[_0xf4b2('0xf')]['message']);return _0x5903e1(_0x3cb471[_0xf4b2('0xf')][_0xf4b2('0x11')]);}else{logger['info'](_0xf4b2('0xb'),_0x115eeb,'request\x20sent');_0x5903e1(_0x3cb471[_0xf4b2('0x12')][_0xf4b2('0x11')]);}})[_0xf4b2('0x13')](function(_0x1502bf){logger[_0xf4b2('0xf')](_0xf4b2('0xb'),_0x115eeb,_0x1502bf);_0x2721ac(_0x1502bf);});});}exports[_0xf4b2('0x14')]=function(_0x130efd){var _0x4776be=this;return new Promise(function(_0x3380e6,_0x3b7d46){return db['VoiceCallReport'][_0xf4b2('0x15')]({'raw':_0x130efd[_0xf4b2('0x16')]?_0x130efd[_0xf4b2('0x16')][_0xf4b2('0x17')]===undefined?!![]:![]:!![],'where':_0x130efd[_0xf4b2('0x16')]?_0x130efd[_0xf4b2('0x16')]['where']||null:null,'attributes':_0x130efd[_0xf4b2('0x16')]?_0x130efd[_0xf4b2('0x16')][_0xf4b2('0x18')]||null:null,'limit':_0x130efd[_0xf4b2('0x16')]?_0x130efd['options'][_0xf4b2('0x19')]||null:null,'include':_0x130efd['options']?_0x130efd['options'][_0xf4b2('0x1a')]?_['map'](_0x130efd[_0xf4b2('0x16')]['include'],function(_0x56e356){return{'model':db[_0x56e356['model']],'as':_0x56e356['as'],'attributes':_0x56e356['attributes'],'include':_0x56e356[_0xf4b2('0x1a')]?_[_0xf4b2('0x1b')](_0x56e356[_0xf4b2('0x1a')],function(_0x19ef40){return{'model':db[_0x19ef40[_0xf4b2('0x1c')]],'as':_0x19ef40['as'],'attributes':_0x19ef40['attributes'],'include':_0x19ef40[_0xf4b2('0x1a')]?_['map'](_0x19ef40[_0xf4b2('0x1a')],function(_0x46598c){return{'model':db[_0x46598c[_0xf4b2('0x1c')]],'as':_0x46598c['as'],'attributes':_0x46598c[_0xf4b2('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf4b2('0xa')](function(_0x214131){logger[_0xf4b2('0x1d')](_0xf4b2('0x14'),_0x130efd);logger['debug'](_0xf4b2('0x14'),_0x130efd,JSON[_0xf4b2('0xe')](_0x214131));_0x3380e6(_0x214131);})[_0xf4b2('0x13')](function(_0x4e6d8f){logger[_0xf4b2('0xf')]('GetVoiceCallReport',_0x4e6d8f[_0xf4b2('0x11')],_0x130efd);_0x3b7d46(_0x4776be['error'](0x1f4,_0x4e6d8f[_0xf4b2('0x11')]));});});};exports[_0xf4b2('0x1e')]=function(_0x367794){var _0x4b2e11=this;return new Promise(function(_0x13977d,_0x3fd537){return db[_0xf4b2('0x1f')]['create'](_0x367794[_0xf4b2('0x20')],{'raw':_0x367794['options']?_0x367794[_0xf4b2('0x16')][_0xf4b2('0x17')]===undefined?!![]:![]:!![]})[_0xf4b2('0xa')](function(_0x171738){logger[_0xf4b2('0x1d')](_0xf4b2('0x1e'),_0x367794);logger[_0xf4b2('0x21')](_0xf4b2('0x1e'),_0x367794,JSON[_0xf4b2('0xe')](_0x171738));_0x13977d(_0x171738);})['catch'](function(_0x125e7a){logger['error'](_0xf4b2('0x1e'),_0x125e7a[_0xf4b2('0x11')],_0x367794);_0x3fd537(_0x4b2e11['error'](0x1f4,_0x125e7a[_0xf4b2('0x11')]));});});};exports[_0xf4b2('0x22')]=function(_0x2d8aea){var _0xfc7083=this;return new Promise(function(_0x1a2925,_0x525328){return db['VoiceCallReport'][_0xf4b2('0x23')](_0x2d8aea[_0xf4b2('0x20')],{'raw':_0x2d8aea[_0xf4b2('0x16')]?_0x2d8aea[_0xf4b2('0x16')][_0xf4b2('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d8aea[_0xf4b2('0x16')]?_0x2d8aea[_0xf4b2('0x16')][_0xf4b2('0x24')]||null:null,'attributes':_0x2d8aea[_0xf4b2('0x16')]?_0x2d8aea[_0xf4b2('0x16')]['attributes']||null:null,'limit':_0x2d8aea['options']?_0x2d8aea['options'][_0xf4b2('0x19')]||null:null})['then'](function(_0x2d6b83){logger[_0xf4b2('0x1d')](_0xf4b2('0x22'),_0x2d8aea);logger['debug']('UpdateVoiceCallReport',_0x2d8aea,JSON[_0xf4b2('0xe')](_0x2d6b83));_0x1a2925(_0x2d6b83);})[_0xf4b2('0x13')](function(_0x322abc){logger['error'](_0xf4b2('0x22'),_0x322abc[_0xf4b2('0x11')],_0x2d8aea);_0x525328(_0xfc7083[_0xf4b2('0xf')](0x1f4,_0x322abc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 1e32e6e..4f5fe86 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 _0xcbbd=['exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','update','delete','destroy'];(function(_0x4346f3,_0xfd454f){var _0xbc5a24=function(_0x82065f){while(--_0x82065f){_0x4346f3['push'](_0x4346f3['shift']());}};_0xbc5a24(++_0xfd454f);}(_0xcbbd,0xb5));var _0xdcbb=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xcbbd[_0x53e3fa];return _0xe8584a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdcbb('0x0'));var timeout=require(_0xdcbb('0x1'));var express=require('express');var router=express[_0xdcbb('0x2')]();var fs_extra=require(_0xdcbb('0x3'));var auth=require(_0xdcbb('0x4'));var interaction=require(_0xdcbb('0x5'));var config=require(_0xdcbb('0x6'));var controller=require(_0xdcbb('0x7'));router['get']('/',auth[_0xdcbb('0x8')](),controller[_0xdcbb('0x9')]);router[_0xdcbb('0xa')](_0xdcbb('0xb'),auth[_0xdcbb('0x8')](),controller[_0xdcbb('0xc')]);router[_0xdcbb('0xd')]('/',auth[_0xdcbb('0x8')](),controller['create']);router['put'](_0xdcbb('0xb'),auth[_0xdcbb('0x8')](),controller[_0xdcbb('0xe')]);router[_0xdcbb('0xf')](_0xdcbb('0xb'),auth['isAuthenticated'](),controller[_0xdcbb('0x10')]);module[_0xdcbb('0x11')]=router; \ No newline at end of file +var _0xc476=['post','create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0xc476,0xb0));var _0x6c47=function(_0x17d389,_0x2f85bf){_0x17d389=_0x17d389-0x0;var _0x28a0c4=_0xc476[_0x17d389];return _0x28a0c4;};'use strict';var multer=require(_0x6c47('0x0'));var util=require(_0x6c47('0x1'));var path=require(_0x6c47('0x2'));var timeout=require(_0x6c47('0x3'));var express=require(_0x6c47('0x4'));var router=express['Router']();var fs_extra=require(_0x6c47('0x5'));var auth=require(_0x6c47('0x6'));var interaction=require(_0x6c47('0x7'));var config=require(_0x6c47('0x8'));var controller=require('./voiceChanSpy.controller');router[_0x6c47('0x9')]('/',auth[_0x6c47('0xa')](),controller[_0x6c47('0xb')]);router['get'](_0x6c47('0xc'),auth[_0x6c47('0xa')](),controller[_0x6c47('0xd')]);router[_0x6c47('0xe')]('/',auth['isAuthenticated'](),controller[_0x6c47('0xf')]);router[_0x6c47('0x10')]('/:id',auth[_0x6c47('0xa')](),controller['update']);router[_0x6c47('0x11')](_0x6c47('0xc'),auth[_0x6c47('0xa')](),controller[_0x6c47('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index b26bb4f..2bfc14f 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 _0xec87=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','BOOLEAN'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xec87,0x18c));var _0x7ec8=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0xec87[_0x4fda88];return _0xe37511;};'use strict';var Sequelize=require(_0x7ec8('0x0'));module[_0x7ec8('0x1')]={'name':{'type':Sequelize[_0x7ec8('0x2')]},'prefix':{'type':Sequelize[_0x7ec8('0x2')],'unique':_0x7ec8('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x7ec8('0x2')],'set':function(_0x295d4c){this[_0x7ec8('0x4')](_0x7ec8('0x5'),_0x295d4c?_0x295d4c[_0x7ec8('0x6')](''):[]);},'get':function(){return this[_0x7ec8('0x7')](_0x7ec8('0x5'))?this[_0x7ec8('0x7')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x7ec8('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x7ec8('0x2')]},'record':{'type':Sequelize[_0x7ec8('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7ec8('0x2')]},'description':{'type':Sequelize[_0x7ec8('0x2')]}}; \ No newline at end of file +var _0x3022=['STRING','name','setDataValue','getDataValue','options','split','BOOLEAN','sequelize','exports'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0x3022,0x15d));var _0x2302=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3022[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require(_0x2302('0x0'));module[_0x2302('0x1')]={'name':{'type':Sequelize[_0x2302('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x2302('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2302('0x2')],'set':function(_0x2a2c60){this[_0x2302('0x4')]('options',_0x2a2c60?_0x2a2c60['join'](''):[]);},'get':function(){return this[_0x2302('0x5')]('options')?this[_0x2302('0x5')](_0x2302('0x6'))[_0x2302('0x7')](''):[];}},'auth':{'type':Sequelize[_0x2302('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x2302('0x2')]},'record':{'type':Sequelize[_0x2302('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2302('0x2')]},'description':{'type':Sequelize[_0x2302('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1c6c2f6..fdfca59 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 _0x3a79=['VoiceChanSpy','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','ChanSpies','destroy','error','stack','name','send','index'];(function(_0x5370d1,_0x55644e){var _0x479410=function(_0x449e7c){while(--_0x449e7c){_0x5370d1['push'](_0x5370d1['shift']());}};_0x479410(++_0x55644e);}(_0x3a79,0xca));var _0x93a7=function(_0x18435d,_0x1a5266){_0x18435d=_0x18435d-0x0;var _0x3a7d61=_0x3a79[_0x18435d];return _0x3a7d61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93a7('0x0'));var zipdir=require(_0x93a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93a7('0x2'));var moment=require(_0x93a7('0x3'));var BPromise=require(_0x93a7('0x4'));var Mustache=require(_0x93a7('0x5'));var util=require(_0x93a7('0x6'));var path=require(_0x93a7('0x7'));var sox=require(_0x93a7('0x8'));var csv=require('to-csv');var ejs=require(_0x93a7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93a7('0xa'));var squel=require(_0x93a7('0xb'));var crypto=require(_0x93a7('0xc'));var jsforce=require(_0x93a7('0xd'));var deskjs=require(_0x93a7('0xe'));var toCsv=require(_0x93a7('0xf'));var querystring=require('querystring');var Papa=require(_0x93a7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93a7('0x11'));var as=require(_0x93a7('0x12'));var hardwareService=require(_0x93a7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x93a7('0x14'));var config=require(_0x93a7('0x15'));var licenseUtil=require(_0x93a7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57ff4d,_0x1c9461){_0x1c9461=_0x1c9461||0xcc;return function(_0x5289f7){if(_0x5289f7){return _0x57ff4d[_0x93a7('0x17')](_0x1c9461);}return _0x57ff4d[_0x93a7('0x18')](_0x1c9461)[_0x93a7('0x19')]();};}function respondWithResult(_0xa0234a,_0x23380e){_0x23380e=_0x23380e||0xc8;return function(_0x423458){if(_0x423458){return _0xa0234a[_0x93a7('0x18')](_0x23380e)['json'](_0x423458);}};}function respondWithFilteredResult(_0x46967b,_0x27ae27){return function(_0x4aa44e){if(_0x4aa44e){var _0x517a72=typeof _0x27ae27[_0x93a7('0x1a')]==='undefined'&&typeof _0x27ae27[_0x93a7('0x1b')]===_0x93a7('0x1c');var _0x8c8f3b=_0x4aa44e[_0x93a7('0x1d')];var _0x3d1db3=_0x517a72?0x0:_0x27ae27['offset'];var _0xfe6814=_0x517a72?_0x4aa44e['count']:_0x27ae27[_0x93a7('0x1a')]+_0x27ae27[_0x93a7('0x1b')];var _0x1870cb;if(_0xfe6814>=_0x8c8f3b){_0xfe6814=_0x8c8f3b;_0x1870cb=0xc8;}else{_0x1870cb=0xce;}_0x46967b[_0x93a7('0x18')](_0x1870cb);return _0x46967b[_0x93a7('0x1e')]('Content-Range',_0x3d1db3+'-'+_0xfe6814+'/'+_0x8c8f3b)[_0x93a7('0x1f')](_0x4aa44e);}return null;};}function patchUpdates(_0x321c32){return function(_0xdebaba){try{jsonpatch[_0x93a7('0x20')](_0xdebaba,_0x321c32,!![]);}catch(_0x3d0e5a){return BPromise[_0x93a7('0x21')](_0x3d0e5a);}return _0xdebaba[_0x93a7('0x22')]();};}function saveUpdates(_0x446b7a,_0x50ea8d){return function(_0x29cd68){if(_0x29cd68){return _0x29cd68[_0x93a7('0x23')](_0x446b7a)['then'](function(_0x323cb2){return _0x323cb2;});}return null;};}function removeEntity(_0x198b82,_0x24fa68){return function(_0x461632){if(_0x461632){return _0x461632['destroy']()[_0x93a7('0x24')](function(){var _0x247d63=_0x461632['get']({'plain':!![]});var _0xafae92=_0x93a7('0x25');return db['UserProfileResource'][_0x93a7('0x26')]({'where':{'type':_0xafae92,'resourceId':_0x247d63['id']}})['then'](function(){return _0x461632;});})[_0x93a7('0x24')](function(){_0x198b82[_0x93a7('0x18')](0xcc)[_0x93a7('0x19')]();});}};}function handleEntityNotFound(_0x4735a8,_0x5994dd){return function(_0x1eaff9){if(!_0x1eaff9){_0x4735a8['sendStatus'](0x194);}return _0x1eaff9;};}function handleError(_0x5efcb7,_0x10d410){_0x10d410=_0x10d410||0x1f4;return function(_0x44c6da){logger[_0x93a7('0x27')](_0x44c6da[_0x93a7('0x28')]);if(_0x44c6da[_0x93a7('0x29')]){delete _0x44c6da['name'];}_0x5efcb7[_0x93a7('0x18')](_0x10d410)[_0x93a7('0x2a')](_0x44c6da);};}exports[_0x93a7('0x2b')]=function(_0x5a12b0,_0x4dca12){var _0x511748={},_0x1ecdd7={},_0x19cae4={'count':0x0,'rows':[]};var _0xd5bbf3=_['map'](db[_0x93a7('0x2c')]['rawAttributes'],function(_0x4d1a28){return{'name':_0x4d1a28['fieldName'],'type':_0x4d1a28[_0x93a7('0x2d')]['key']};});_0x1ecdd7[_0x93a7('0x2e')]=_[_0x93a7('0x2f')](_0xd5bbf3,'name');_0x1ecdd7['query']=_['keys'](_0x5a12b0[_0x93a7('0x30')]);_0x1ecdd7[_0x93a7('0x31')]=_[_0x93a7('0x32')](_0x1ecdd7[_0x93a7('0x2e')],_0x1ecdd7['query']);_0x511748[_0x93a7('0x33')]=_[_0x93a7('0x32')](_0x1ecdd7['model'],qs['fields'](_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x34')]));_0x511748[_0x93a7('0x33')]=_0x511748[_0x93a7('0x33')][_0x93a7('0x35')]?_0x511748[_0x93a7('0x33')]:_0x1ecdd7[_0x93a7('0x2e')];if(!_0x5a12b0['query'][_0x93a7('0x36')](_0x93a7('0x37'))){_0x511748[_0x93a7('0x1b')]=qs[_0x93a7('0x1b')](_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x1b')]);_0x511748[_0x93a7('0x1a')]=qs['offset'](_0x5a12b0['query'][_0x93a7('0x1a')]);}_0x511748[_0x93a7('0x38')]=qs[_0x93a7('0x39')](_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x39')]);_0x511748['where']=qs[_0x93a7('0x31')](_[_0x93a7('0x3a')](_0x5a12b0[_0x93a7('0x30')],_0x1ecdd7[_0x93a7('0x31')]),_0xd5bbf3);if(_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x3b')]){_0x511748[_0x93a7('0x3c')]=_[_0x93a7('0x3d')](_0x511748[_0x93a7('0x3c')],{'$or':_[_0x93a7('0x2f')](_0xd5bbf3,function(_0x5a0a88){if(_0x5a0a88[_0x93a7('0x2d')]!==_0x93a7('0x3e')){var _0x50b4f0={};_0x50b4f0[_0x5a0a88[_0x93a7('0x29')]]={'$like':'%'+_0x5a12b0[_0x93a7('0x30')][_0x93a7('0x3b')]+'%'};return _0x50b4f0;}})});}_0x511748=_['merge']({},_0x511748,_0x5a12b0[_0x93a7('0x3f')]);var _0x21cbaa={'where':_0x511748[_0x93a7('0x3c')]};return db[_0x93a7('0x2c')][_0x93a7('0x1d')](_0x21cbaa)[_0x93a7('0x24')](function(_0x50de34){_0x19cae4[_0x93a7('0x1d')]=_0x50de34;if(_0x5a12b0['query'][_0x93a7('0x40')]){_0x511748[_0x93a7('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x93a7('0x42')](_0x511748);})[_0x93a7('0x24')](function(_0x5659b9){_0x19cae4['rows']=_0x5659b9;return _0x19cae4;})[_0x93a7('0x24')](respondWithFilteredResult(_0x4dca12,_0x511748))['catch'](handleError(_0x4dca12,null));};exports['show']=function(_0x13c49b,_0x3342f2){var _0x5cd980={'raw':![],'where':{'id':_0x13c49b[_0x93a7('0x43')]['id']}},_0x5aca88={};_0x5aca88['model']=_[_0x93a7('0x44')](db['VoiceChanSpy'][_0x93a7('0x45')]);_0x5aca88[_0x93a7('0x30')]=_[_0x93a7('0x44')](_0x13c49b[_0x93a7('0x30')]);_0x5aca88['filters']=_['intersection'](_0x5aca88['model'],_0x5aca88[_0x93a7('0x30')]);_0x5cd980[_0x93a7('0x33')]=_[_0x93a7('0x32')](_0x5aca88['model'],qs[_0x93a7('0x34')](_0x13c49b[_0x93a7('0x30')][_0x93a7('0x34')]));_0x5cd980['attributes']=_0x5cd980[_0x93a7('0x33')][_0x93a7('0x35')]?_0x5cd980['attributes']:_0x5aca88[_0x93a7('0x2e')];if(_0x13c49b[_0x93a7('0x30')]['includeAll']){_0x5cd980[_0x93a7('0x41')]=[{'all':!![]}];}_0x5cd980=_[_0x93a7('0x3d')]({},_0x5cd980,_0x13c49b[_0x93a7('0x3f')]);return db[_0x93a7('0x2c')]['find'](_0x5cd980)[_0x93a7('0x24')](handleEntityNotFound(_0x3342f2,null))[_0x93a7('0x24')](respondWithResult(_0x3342f2,null))[_0x93a7('0x46')](handleError(_0x3342f2,null));};exports['create']=function(_0x1cddbc,_0x23a1dc){return db[_0x93a7('0x2c')][_0x93a7('0x47')](_0x1cddbc[_0x93a7('0x48')],{})[_0x93a7('0x24')](function(_0x4cb904){var _0x598a17=_0x1cddbc[_0x93a7('0x49')][_0x93a7('0x4a')]({'plain':!![]});if(!_0x598a17)throw new Error(_0x93a7('0x4b'));if(_0x598a17[_0x93a7('0x4c')]==='user'){var _0x18071f=_0x4cb904[_0x93a7('0x4a')]({'plain':!![]});var _0x3b79d9=_0x93a7('0x25');return db['UserProfileSection'][_0x93a7('0x4d')]({'where':{'name':_0x3b79d9,'userProfileId':_0x598a17[_0x93a7('0x4e')]},'raw':!![]})[_0x93a7('0x24')](function(_0x50a4f2){if(_0x50a4f2&&_0x50a4f2[_0x93a7('0x4f')]===0x0){return db[_0x93a7('0x50')]['create']({'name':_0x18071f[_0x93a7('0x29')],'resourceId':_0x18071f['id'],'type':_0x50a4f2[_0x93a7('0x29')],'sectionId':_0x50a4f2['id']},{})[_0x93a7('0x24')](function(){return _0x4cb904;});}else{return _0x4cb904;}})[_0x93a7('0x46')](function(_0x214498){logger[_0x93a7('0x27')](_0x93a7('0x51'),_0x214498);throw _0x214498;});}return _0x4cb904;})[_0x93a7('0x24')](respondWithResult(_0x23a1dc,0xc9))['catch'](handleError(_0x23a1dc,null));};exports['update']=function(_0x75339a,_0xcfb3fb){if(_0x75339a['body']['id']){delete _0x75339a[_0x93a7('0x48')]['id'];}return db['VoiceChanSpy'][_0x93a7('0x4d')]({'where':{'id':_0x75339a[_0x93a7('0x43')]['id']}})[_0x93a7('0x24')](handleEntityNotFound(_0xcfb3fb,null))[_0x93a7('0x24')](saveUpdates(_0x75339a[_0x93a7('0x48')],null))[_0x93a7('0x24')](respondWithResult(_0xcfb3fb,null))[_0x93a7('0x46')](handleError(_0xcfb3fb,null));};exports[_0x93a7('0x26')]=function(_0x15905d,_0x5e1c9f){return db[_0x93a7('0x2c')][_0x93a7('0x4d')]({'where':{'id':_0x15905d[_0x93a7('0x43')]['id']}})[_0x93a7('0x24')](handleEntityNotFound(_0x5e1c9f,null))[_0x93a7('0x24')](removeEntity(_0x5e1c9f,null))[_0x93a7('0x46')](handleError(_0x5e1c9f,null));}; \ No newline at end of file +var _0xaa88=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','get','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','VoiceChanSpy','includeAll','rows','show','params','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x216240,_0x3c172c){var _0xc1f964=function(_0x2c5b3f){while(--_0x2c5b3f){_0x216240['push'](_0x216240['shift']());}};_0xc1f964(++_0x3c172c);}(_0xaa88,0x137));var _0x8aa8=function(_0x4320ce,_0x49f5f5){_0x4320ce=_0x4320ce-0x0;var _0x537dae=_0xaa88[_0x4320ce];return _0x537dae;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){var _0xe978ab=_0x3ca7dc[_0x8aa8('0x25')]({'plain':!![]});var _0x547a7b='ChanSpies';return db[_0x8aa8('0x26')][_0x8aa8('0x27')]({'where':{'type':_0x547a7b,'resourceId':_0xe978ab['id']}})[_0x8aa8('0x24')](function(){return _0x3ca7dc;});})[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc34a,_0x49d561){return function(_0x2a0ff2){if(!_0x2a0ff2){_0x2bc34a[_0x8aa8('0x19')](0x194);}return _0x2a0ff2;};}function handleError(_0x15ff33,_0x519ac0){_0x519ac0=_0x519ac0||0x1f4;return function(_0x4c5c5c){logger[_0x8aa8('0x28')](_0x4c5c5c['stack']);if(_0x4c5c5c[_0x8aa8('0x29')]){delete _0x4c5c5c[_0x8aa8('0x29')];}_0x15ff33[_0x8aa8('0x1a')](_0x519ac0)[_0x8aa8('0x2a')](_0x4c5c5c);};}exports[_0x8aa8('0x2b')]=function(_0x4d5c2e,_0x267f4c){var _0x3003e5={},_0x4b67f5={},_0x99f74e={'count':0x0,'rows':[]};var _0xee2f61=_[_0x8aa8('0x2c')](db['VoiceChanSpy'][_0x8aa8('0x2d')],function(_0x3a0dce){return{'name':_0x3a0dce[_0x8aa8('0x2e')],'type':_0x3a0dce[_0x8aa8('0x2f')][_0x8aa8('0x30')]};});_0x4b67f5[_0x8aa8('0x31')]=_[_0x8aa8('0x2c')](_0xee2f61,_0x8aa8('0x29'));_0x4b67f5[_0x8aa8('0x32')]=_[_0x8aa8('0x33')](_0x4d5c2e[_0x8aa8('0x32')]);_0x4b67f5['filters']=_['intersection'](_0x4b67f5[_0x8aa8('0x31')],_0x4b67f5[_0x8aa8('0x32')]);_0x3003e5[_0x8aa8('0x34')]=_[_0x8aa8('0x35')](_0x4b67f5[_0x8aa8('0x31')],qs[_0x8aa8('0x36')](_0x4d5c2e['query']['fields']));_0x3003e5[_0x8aa8('0x34')]=_0x3003e5['attributes'][_0x8aa8('0x37')]?_0x3003e5[_0x8aa8('0x34')]:_0x4b67f5[_0x8aa8('0x31')];if(!_0x4d5c2e['query'][_0x8aa8('0x38')](_0x8aa8('0x39'))){_0x3003e5[_0x8aa8('0x1f')]=qs['limit'](_0x4d5c2e['query'][_0x8aa8('0x1f')]);_0x3003e5[_0x8aa8('0x1d')]=qs['offset'](_0x4d5c2e[_0x8aa8('0x32')][_0x8aa8('0x1d')]);}_0x3003e5['order']=qs[_0x8aa8('0x3a')](_0x4d5c2e['query']['sort']);_0x3003e5[_0x8aa8('0x3b')]=qs['filters'](_[_0x8aa8('0x3c')](_0x4d5c2e[_0x8aa8('0x32')],_0x4b67f5[_0x8aa8('0x3d')]),_0xee2f61);if(_0x4d5c2e[_0x8aa8('0x32')]['filter']){_0x3003e5[_0x8aa8('0x3b')]=_[_0x8aa8('0x3e')](_0x3003e5['where'],{'$or':_[_0x8aa8('0x2c')](_0xee2f61,function(_0xc770ec){if(_0xc770ec['type']!==_0x8aa8('0x3f')){var _0x3c6115={};_0x3c6115[_0xc770ec[_0x8aa8('0x29')]]={'$like':'%'+_0x4d5c2e[_0x8aa8('0x32')][_0x8aa8('0x40')]+'%'};return _0x3c6115;}})});}_0x3003e5=_[_0x8aa8('0x3e')]({},_0x3003e5,_0x4d5c2e[_0x8aa8('0x41')]);var _0x3fb265={'where':_0x3003e5[_0x8aa8('0x3b')]};return db[_0x8aa8('0x42')][_0x8aa8('0x20')](_0x3fb265)[_0x8aa8('0x24')](function(_0x17c730){_0x99f74e[_0x8aa8('0x20')]=_0x17c730;if(_0x4d5c2e[_0x8aa8('0x32')][_0x8aa8('0x43')]){_0x3003e5['include']=[{'all':!![]}];}return db[_0x8aa8('0x42')]['findAll'](_0x3003e5);})['then'](function(_0x572132){_0x99f74e[_0x8aa8('0x44')]=_0x572132;return _0x99f74e;})['then'](respondWithFilteredResult(_0x267f4c,_0x3003e5))['catch'](handleError(_0x267f4c,null));};exports[_0x8aa8('0x45')]=function(_0x4da4d8,_0x1ddf7f){var _0x5d8a6a={'raw':![],'where':{'id':_0x4da4d8[_0x8aa8('0x46')]['id']}},_0x5a132a={};_0x5a132a[_0x8aa8('0x31')]=_[_0x8aa8('0x33')](db[_0x8aa8('0x42')][_0x8aa8('0x2d')]);_0x5a132a[_0x8aa8('0x32')]=_[_0x8aa8('0x33')](_0x4da4d8['query']);_0x5a132a[_0x8aa8('0x3d')]=_['intersection'](_0x5a132a[_0x8aa8('0x31')],_0x5a132a[_0x8aa8('0x32')]);_0x5d8a6a[_0x8aa8('0x34')]=_[_0x8aa8('0x35')](_0x5a132a[_0x8aa8('0x31')],qs[_0x8aa8('0x36')](_0x4da4d8['query']['fields']));_0x5d8a6a[_0x8aa8('0x34')]=_0x5d8a6a[_0x8aa8('0x34')]['length']?_0x5d8a6a[_0x8aa8('0x34')]:_0x5a132a[_0x8aa8('0x31')];if(_0x4da4d8[_0x8aa8('0x32')]['includeAll']){_0x5d8a6a['include']=[{'all':!![]}];}_0x5d8a6a=_['merge']({},_0x5d8a6a,_0x4da4d8['options']);return db[_0x8aa8('0x42')][_0x8aa8('0x47')](_0x5d8a6a)['then'](handleEntityNotFound(_0x1ddf7f,null))[_0x8aa8('0x24')](respondWithResult(_0x1ddf7f,null))[_0x8aa8('0x48')](handleError(_0x1ddf7f,null));};exports[_0x8aa8('0x49')]=function(_0x1aa1b6,_0x20384a){return db[_0x8aa8('0x42')]['create'](_0x1aa1b6['body'],{})[_0x8aa8('0x24')](function(_0x546988){var _0x20c368=_0x1aa1b6['user'][_0x8aa8('0x25')]({'plain':!![]});if(!_0x20c368)throw new Error(_0x8aa8('0x4a'));if(_0x20c368[_0x8aa8('0x4b')]===_0x8aa8('0x4c')){var _0x36de37=_0x546988[_0x8aa8('0x25')]({'plain':!![]});var _0x997597=_0x8aa8('0x4d');return db[_0x8aa8('0x4e')][_0x8aa8('0x47')]({'where':{'name':_0x997597,'userProfileId':_0x20c368[_0x8aa8('0x4f')]},'raw':!![]})[_0x8aa8('0x24')](function(_0x4fc51d){if(_0x4fc51d&&_0x4fc51d[_0x8aa8('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x36de37['name'],'resourceId':_0x36de37['id'],'type':_0x4fc51d[_0x8aa8('0x29')],'sectionId':_0x4fc51d['id']},{})['then'](function(){return _0x546988;});}else{return _0x546988;}})[_0x8aa8('0x48')](function(_0x1474fd){logger[_0x8aa8('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1474fd);throw _0x1474fd;});}return _0x546988;})[_0x8aa8('0x24')](respondWithResult(_0x20384a,0xc9))[_0x8aa8('0x48')](handleError(_0x20384a,null));};exports[_0x8aa8('0x51')]=function(_0x24f34e,_0x4ccb77){if(_0x24f34e['body']['id']){delete _0x24f34e[_0x8aa8('0x52')]['id'];}return db[_0x8aa8('0x42')][_0x8aa8('0x47')]({'where':{'id':_0x24f34e[_0x8aa8('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ccb77,null))['then'](saveUpdates(_0x24f34e[_0x8aa8('0x52')],null))[_0x8aa8('0x24')](respondWithResult(_0x4ccb77,null))[_0x8aa8('0x48')](handleError(_0x4ccb77,null));};exports['destroy']=function(_0x33e9ae,_0x3a814f){return db['VoiceChanSpy']['find']({'where':{'id':_0x33e9ae['params']['id']}})['then'](handleEntityNotFound(_0x3a814f,null))[_0x8aa8('0x24')](removeEntity(_0x3a814f,null))['catch'](handleError(_0x3a814f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c359c78..5ffb817 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 _0x86b4=['from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','chanspy','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','SIP/%s,%s','name','options','join','record','StopMixMonitor','internal','concat','agent','then','catch','exports','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','length','lodash','util'];(function(_0x208f73,_0x54bfc2){var _0x465378=function(_0x7f4a5){while(--_0x7f4a5){_0x208f73['push'](_0x208f73['shift']());}};_0x465378(++_0x54bfc2);}(_0x86b4,0x64));var _0x486b=function(_0x11c5bc,_0x384d4e){_0x11c5bc=_0x11c5bc-0x0;var _0x91e217=_0x86b4[_0x11c5bc];return _0x91e217;};'use strict';var _=require(_0x486b('0x0'));var util=require(_0x486b('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x47252a,_0x2d23de,_0x531c64){var _0x1ec097=0x1;var _0x320d21=[];var _0x24badf={'context':_0x2d23de['context']||_0x486b('0x2'),'exten':util[_0x486b('0x3')](_0x486b('0x4'),_0x47252a[_0x486b('0x5')],_0x531c64),'type':_0x486b('0x6'),'isApp':![],'ChanSpyId':_0x47252a['id'],'UserId':_0x2d23de['id']};_0x320d21[_0x486b('0x7')](_['merge']({'app':_0x486b('0x8'),'appdata':util[_0x486b('0x3')](_0x486b('0x9'),_0x486b('0xa')),'priority':_0x1ec097++},_0x24badf));if(_0x47252a['record']){_0x320d21[_0x486b('0x7')](_[_0x486b('0xb')]({'app':_0x486b('0xc'),'appdata':util[_0x486b('0x3')](_0x486b('0xd'),_0x47252a[_0x486b('0xe')]),'priority':_0x1ec097++},_0x24badf));}if(_0x47252a['auth']){_0x320d21[_0x486b('0x7')](_[_0x486b('0xb')]({'app':'Authenticate','appdata':_0x47252a[_0x486b('0xf')],'priority':_0x1ec097++},_0x24badf));}_0x320d21['push'](_['merge']({'app':'ChanSpy','appdata':util['format'](_0x486b('0x10'),_0x2d23de[_0x486b('0x11')],_0x47252a['options']?_0x47252a[_0x486b('0x12')][_0x486b('0x13')](''):''),'priority':_0x1ec097++},_0x24badf));if(_0x47252a[_0x486b('0x14')]){_0x320d21[_0x486b('0x7')](_[_0x486b('0xb')]({'app':_0x486b('0x15'),'priority':_0x1ec097++},_0x24badf));}return _0x320d21;};var getChanSpyApplications=function(_0x139c88,_0x1d1057){var _0x3d1d2d=[];for(var _0x21e934=0x0,_0x4b1b0f=0x1;_0x21e934<_0x1d1057['length'];_0x21e934++,_0x4b1b0f=0x1){_0x3d1d2d=_0x3d1d2d['concat'](getUserApplications(_0x139c88,_0x1d1057[_0x21e934],_0x1d1057[_0x21e934][_0x486b('0x16')]));if(_0x1d1057[_0x21e934][_0x486b('0x16')]!=_0x1d1057[_0x21e934][_0x486b('0x11')]){_0x3d1d2d=_0x3d1d2d[_0x486b('0x17')](getUserApplications(_0x139c88,_0x1d1057[_0x21e934],_0x1d1057[_0x21e934][_0x486b('0x11')]));}}return _0x3d1d2d;};var getChanSpyPromise=function(_0x46bfea,_0x1463ea){return new BPromise(function(_0x5665d6,_0x4d5d55){return _0x46bfea['User']['findAll']({'attributes':['id',_0x486b('0x11'),_0x486b('0x16')],'where':{'role':_0x486b('0x18'),'chanspy':!![]},'raw':!![]})[_0x486b('0x19')](function(_0x4cdb38){if(_0x4cdb38){return _0x5665d6(getChanSpyApplications(_0x1463ea,_0x4cdb38));}return _0x5665d6([]);})[_0x486b('0x1a')](function(_0x3fc927){_0x4d5d55(_0x3fc927);});});};module[_0x486b('0x1b')]=function(_0x42ece4,_0x502fe5){var _0x1a6063=_0x42ece4['models'];return _0x42ece4[_0x486b('0x1c')](_0x486b('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a6a53,_0x210c8b,_0x17a769){return getChanSpyPromise(_0x1a6063,_0x4a6a53)['then'](function(_0x11e964){if(_0x11e964&&_0x11e964['length']){return _0x1a6063[_0x486b('0x1e')][_0x486b('0x1f')](_0x11e964);}})[_0x486b('0x19')](function(){_0x17a769();})[_0x486b('0x1a')](function(_0x4acd82){_0x17a769(_0x4acd82);});},'afterUpdate':function(_0x3fb060,_0x3f8e65,_0x3ba359){return _0x1a6063[_0x486b('0x1e')][_0x486b('0x20')]({'where':{'ChanSpyId':_0x3fb060['id']}})['then'](function(){return getChanSpyPromise(_0x1a6063,_0x3fb060);})[_0x486b('0x19')](function(_0x11c732){if(_0x11c732&&_0x11c732[_0x486b('0x21')]){return _0x1a6063[_0x486b('0x1e')]['bulkCreate'](_0x11c732);}})[_0x486b('0x19')](function(){_0x3ba359();})[_0x486b('0x1a')](function(_0x41fbcb){_0x3ba359(_0x41fbcb);});},'afterDestroy':function(_0x26d1db,_0x37a863,_0x3e39fc){return _0x1a6063[_0x486b('0x1e')][_0x486b('0x20')]({'where':{'ChanSpyId':_0x26d1db['id']}})[_0x486b('0x19')](function(){_0x3e39fc();})[_0x486b('0x1a')](function(_0x182c0e){_0x3e39fc(_0x182c0e);});}}});}; \ No newline at end of file +var _0x44d4=['util','context','from-sip','format','prefix','system','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','User','agent','then','catch','exports','define','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash'];(function(_0x2a4412,_0x314034){var _0x36f71e=function(_0x3dd386){while(--_0x3dd386){_0x2a4412['push'](_0x2a4412['shift']());}};_0x36f71e(++_0x314034);}(_0x44d4,0x175));var _0x444d=function(_0x149a41,_0x3cbb44){_0x149a41=_0x149a41-0x0;var _0x10132c=_0x44d4[_0x149a41];return _0x10132c;};'use strict';var _=require(_0x444d('0x0'));var util=require(_0x444d('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x5539bb,_0x353a2f,_0x25a2d3){var _0x1b3e05=0x1;var _0x5dc936=[];var _0x4701bd={'context':_0x353a2f[_0x444d('0x2')]||_0x444d('0x3'),'exten':util[_0x444d('0x4')]('%s%s',_0x5539bb[_0x444d('0x5')],_0x25a2d3),'type':_0x444d('0x6'),'isApp':![],'ChanSpyId':_0x5539bb['id'],'UserId':_0x353a2f['id']};_0x5dc936[_0x444d('0x7')](_[_0x444d('0x8')]({'app':'Set','appdata':util['format'](_0x444d('0x9'),_0x444d('0xa')),'priority':_0x1b3e05++},_0x4701bd));if(_0x5539bb[_0x444d('0xb')]){_0x5dc936['push'](_[_0x444d('0x8')]({'app':_0x444d('0xc'),'appdata':util[_0x444d('0x4')](_0x444d('0xd'),_0x5539bb[_0x444d('0xe')]),'priority':_0x1b3e05++},_0x4701bd));}if(_0x5539bb[_0x444d('0xf')]){_0x5dc936[_0x444d('0x7')](_['merge']({'app':_0x444d('0x10'),'appdata':_0x5539bb['password'],'priority':_0x1b3e05++},_0x4701bd));}_0x5dc936[_0x444d('0x7')](_[_0x444d('0x8')]({'app':'ChanSpy','appdata':util[_0x444d('0x4')](_0x444d('0x11'),_0x353a2f[_0x444d('0x12')],_0x5539bb[_0x444d('0x13')]?_0x5539bb[_0x444d('0x13')][_0x444d('0x14')](''):''),'priority':_0x1b3e05++},_0x4701bd));if(_0x5539bb[_0x444d('0xb')]){_0x5dc936[_0x444d('0x7')](_['merge']({'app':_0x444d('0x15'),'priority':_0x1b3e05++},_0x4701bd));}return _0x5dc936;};var getChanSpyApplications=function(_0xd3af80,_0x8d7712){var _0x46d9df=[];for(var _0x55975b=0x0,_0x26f75e=0x1;_0x55975b<_0x8d7712[_0x444d('0x16')];_0x55975b++,_0x26f75e=0x1){_0x46d9df=_0x46d9df['concat'](getUserApplications(_0xd3af80,_0x8d7712[_0x55975b],_0x8d7712[_0x55975b][_0x444d('0x17')]));if(_0x8d7712[_0x55975b]['internal']!=_0x8d7712[_0x55975b]['name']){_0x46d9df=_0x46d9df['concat'](getUserApplications(_0xd3af80,_0x8d7712[_0x55975b],_0x8d7712[_0x55975b]['name']));}}return _0x46d9df;};var getChanSpyPromise=function(_0x4b5b03,_0x569e82){return new BPromise(function(_0x1b9ad2,_0x3d46bf){return _0x4b5b03[_0x444d('0x18')]['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x444d('0x19'),'chanspy':!![]},'raw':!![]})[_0x444d('0x1a')](function(_0x205a75){if(_0x205a75){return _0x1b9ad2(getChanSpyApplications(_0x569e82,_0x205a75));}return _0x1b9ad2([]);})[_0x444d('0x1b')](function(_0x4b1530){_0x3d46bf(_0x4b1530);});});};module[_0x444d('0x1c')]=function(_0x435bd2,_0x24b5fc){var _0x336e7f=_0x435bd2['models'];return _0x435bd2[_0x444d('0x1d')]('VoiceChanSpy',attributes,{'tableName':_0x444d('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x19d9ac,_0x1b1bf3,_0x2955d6){return getChanSpyPromise(_0x336e7f,_0x19d9ac)[_0x444d('0x1a')](function(_0x3d8757){if(_0x3d8757&&_0x3d8757['length']){return _0x336e7f[_0x444d('0x1f')]['bulkCreate'](_0x3d8757);}})[_0x444d('0x1a')](function(){_0x2955d6();})[_0x444d('0x1b')](function(_0x15922b){_0x2955d6(_0x15922b);});},'afterUpdate':function(_0x1d7788,_0x58bcea,_0x163eec){return _0x336e7f[_0x444d('0x1f')][_0x444d('0x20')]({'where':{'ChanSpyId':_0x1d7788['id']}})['then'](function(){return getChanSpyPromise(_0x336e7f,_0x1d7788);})[_0x444d('0x1a')](function(_0x31a686){if(_0x31a686&&_0x31a686[_0x444d('0x16')]){return _0x336e7f['VoiceExtension'][_0x444d('0x21')](_0x31a686);}})[_0x444d('0x1a')](function(){_0x163eec();})[_0x444d('0x1b')](function(_0x3dbbd3){_0x163eec(_0x3dbbd3);});},'afterDestroy':function(_0x2ade0b,_0x21f941,_0x50c9b1){return _0x336e7f[_0x444d('0x1f')][_0x444d('0x20')]({'where':{'ChanSpyId':_0x2ade0b['id']}})[_0x444d('0x1a')](function(){_0x50c9b1();})[_0x444d('0x1b')](function(_0x3b69aa){_0x50c9b1(_0x3b69aa);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f718c76..6186fa9 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 _0xf9f7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error'];(function(_0x4092b6,_0x34ecad){var _0x56fef0=function(_0x53d3f7){while(--_0x53d3f7){_0x4092b6['push'](_0x4092b6['shift']());}};_0x56fef0(++_0x34ecad);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x4b0008,_0x41218b){_0x4b0008=_0x4b0008-0x0;var _0x401c96=_0xf9f7[_0x4b0008];return _0x401c96;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5819,_0x37e39f,_0x3da87e){return new BPromise(function(_0x181328,_0x3e9e75){return client[_0x7f9f('0xc')](_0x5b5819,_0x3da87e)['then'](function(_0x3fda85){logger[_0x7f9f('0xd')](_0x7f9f('0xe'),_0x37e39f,_0x7f9f('0xf'));logger[_0x7f9f('0x10')](_0x7f9f('0x11'),_0x37e39f,_0x7f9f('0xf'),JSON['stringify'](_0x3fda85));if(_0x3fda85[_0x7f9f('0x12')]){if(_0x3fda85[_0x7f9f('0x12')]['code']===0x1f4){logger['error'](_0x7f9f('0xe'),_0x37e39f,_0x3fda85['error'][_0x7f9f('0x13')]);return _0x3e9e75(_0x3fda85[_0x7f9f('0x12')]['message']);}logger[_0x7f9f('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x37e39f,_0x7f9f('0xf'));_0x181328(_0x3fda85[_0x7f9f('0x14')]['message']);}})[_0x7f9f('0x15')](function(_0x4a36c8){logger[_0x7f9f('0x12')](_0x7f9f('0xe'),_0x37e39f,_0x4a36c8);_0x3e9e75(_0x4a36c8);});});} \ No newline at end of file +var _0x9f4d=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x54f8cd,_0x355bc5){var _0x28e589=function(_0x2f3049){while(--_0x2f3049){_0x54f8cd['push'](_0x54f8cd['shift']());}};_0x28e589(++_0x355bc5);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x9f4d[_0x4f0e62];return _0x117ab8;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc036,_0x366b9d,_0x5cf448){return new BPromise(function(_0x6b13b5,_0x18305f){return client['request'](_0x2cc036,_0x5cf448)[_0xd9f4('0xc')](function(_0x47d52f){logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));logger[_0xd9f4('0x10')](_0xd9f4('0x11'),_0x366b9d,'request\x20sent',JSON[_0xd9f4('0x12')](_0x47d52f));if(_0x47d52f[_0xd9f4('0x13')]){if(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x14')]===0x1f4){logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x18305f(_0x47d52f['error'][_0xd9f4('0x15')]);}logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x6b13b5(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);}else{logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));_0x6b13b5(_0x47d52f[_0xd9f4('0x16')][_0xd9f4('0x15')]);}})[_0xd9f4('0x17')](function(_0x5e7da1){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x366b9d,_0x5e7da1);_0x18305f(_0x5e7da1);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 3ca5690..55a27d6 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 _0x734e=['exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0xa82967,_0x1fe811){var _0xd43329=function(_0x26c3c1){while(--_0x26c3c1){_0xa82967['push'](_0xa82967['shift']());}};_0xd43329(++_0x1fe811);}(_0x734e,0x1b6));var _0xe734=function(_0x579b79,_0x5b57b2){_0x579b79=_0x579b79-0x0;var _0x41e899=_0x734e[_0x579b79];return _0x41e899;};'use strict';var multer=require(_0xe734('0x0'));var util=require(_0xe734('0x1'));var path=require('path');var timeout=require(_0xe734('0x2'));var express=require(_0xe734('0x3'));var router=express[_0xe734('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe734('0x5'));var config=require(_0xe734('0x6'));var controller=require(_0xe734('0x7'));router[_0xe734('0x8')]('/',auth[_0xe734('0x9')](),controller[_0xe734('0xa')]);router[_0xe734('0x8')](_0xe734('0xb'),auth[_0xe734('0x9')](),controller[_0xe734('0xc')]);router[_0xe734('0xd')]('/',auth[_0xe734('0x9')](),controller[_0xe734('0xe')]);router['put'](_0xe734('0xb'),auth[_0xe734('0x9')](),controller[_0xe734('0xf')]);router[_0xe734('0x10')](_0xe734('0xb'),auth[_0xe734('0x9')](),controller[_0xe734('0x11')]);module[_0xe734('0x12')]=router; \ No newline at end of file +var _0xd956=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','post','create','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x1d5d34,_0x27eaa1){var _0x533119=function(_0x77fcaa){while(--_0x77fcaa){_0x1d5d34['push'](_0x1d5d34['shift']());}};_0x533119(++_0x27eaa1);}(_0xd956,0x152));var _0x6d95=function(_0xc1815e,_0x4bc3b5){_0xc1815e=_0xc1815e-0x0;var _0x31bbb3=_0xd956[_0xc1815e];return _0x31bbb3;};'use strict';var multer=require(_0x6d95('0x0'));var util=require(_0x6d95('0x1'));var path=require(_0x6d95('0x2'));var timeout=require(_0x6d95('0x3'));var express=require(_0x6d95('0x4'));var router=express[_0x6d95('0x5')]();var fs_extra=require(_0x6d95('0x6'));var auth=require(_0x6d95('0x7'));var interaction=require(_0x6d95('0x8'));var config=require(_0x6d95('0x9'));var controller=require(_0x6d95('0xa'));router[_0x6d95('0xb')]('/',auth[_0x6d95('0xc')](),controller['index']);router[_0x6d95('0xb')]('/:id',auth[_0x6d95('0xc')](),controller[_0x6d95('0xd')]);router[_0x6d95('0xe')]('/',auth[_0x6d95('0xc')](),controller[_0x6d95('0xf')]);router['put'](_0x6d95('0x10'),auth[_0x6d95('0xc')](),controller['update']);router['delete'](_0x6d95('0x10'),auth[_0x6d95('0xc')](),controller[_0x6d95('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 404fa95..2cf1def 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 _0x69dc=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x176953,_0x159407){var _0x58e5e2=function(_0x43fa0f){while(--_0x43fa0f){_0x176953['push'](_0x176953['shift']());}};_0x58e5e2(++_0x159407);}(_0x69dc,0x1df));var _0xc69d=function(_0x59b58e,_0x531882){_0x59b58e=_0x59b58e-0x0;var _0x58a7fe=_0x69dc[_0x59b58e];return _0x58a7fe;};'use strict';var Sequelize=require(_0xc69d('0x0'));module[_0xc69d('0x1')]={'name':{'type':Sequelize[_0xc69d('0x2')],'unique':_0xc69d('0x3')},'description':{'type':Sequelize[_0xc69d('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc69d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe3cd=['STRING','name','BOOLEAN','sequelize'];(function(_0x20fa63,_0x65c8d3){var _0x4c37ae=function(_0x4f1038){while(--_0x4f1038){_0x20fa63['push'](_0x20fa63['shift']());}};_0x4c37ae(++_0x65c8d3);}(_0xe3cd,0x10f));var _0xde3c=function(_0x4b863c,_0x3255c8){_0x4b863c=_0x4b863c-0x0;var _0x19dda8=_0xe3cd[_0x4b863c];return _0x19dda8;};'use strict';var Sequelize=require(_0xde3c('0x0'));module['exports']={'name':{'type':Sequelize[_0xde3c('0x1')],'unique':_0xde3c('0x2')},'description':{'type':Sequelize[_0xde3c('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xde3c('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 67d75ca..5054027 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 _0x3d03=['merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','Reload','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/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','offset','limit','Content-Range','apply','save','update','destroy','get','Contexts','UserProfileResource','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x4057f9,_0x17c5b5){var _0x5552b7=function(_0xeb792f){while(--_0xeb792f){_0x4057f9['push'](_0x4057f9['shift']());}};_0x5552b7(++_0x17c5b5);}(_0x3d03,0xef));var _0x33d0=function(_0x24896c,_0x3d3472){_0x24896c=_0x24896c-0x0;var _0x4dbcf6=_0x3d03[_0x24896c];return _0x4dbcf6;};'use strict';var emlformat=require(_0x33d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33d0('0x1'));var jsonpatch=require(_0x33d0('0x2'));var rp=require('request-promise');var moment=require(_0x33d0('0x3'));var BPromise=require(_0x33d0('0x4'));var Mustache=require(_0x33d0('0x5'));var util=require(_0x33d0('0x6'));var path=require('path');var sox=require(_0x33d0('0x7'));var csv=require(_0x33d0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33d0('0x9'));var _=require('lodash');var squel=require(_0x33d0('0xa'));var crypto=require(_0x33d0('0xb'));var jsforce=require(_0x33d0('0xc'));var deskjs=require(_0x33d0('0xd'));var toCsv=require(_0x33d0('0x8'));var querystring=require(_0x33d0('0xe'));var Papa=require(_0x33d0('0xf'));var Redis=require('ioredis');var authService=require(_0x33d0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x33d0('0x11'));var hardwareService=require(_0x33d0('0x12'));var logger=require('../../config/logger')(_0x33d0('0x13'));var utils=require(_0x33d0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x33d0('0x15'));var db=require(_0x33d0('0x16'))['db'];var jayson=require(_0x33d0('0x17'));var client=jayson[_0x33d0('0x18')][_0x33d0('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ff992,_0x18a467,_0x50a96c,_0x550761){return new BPromise(function(_0x157d7d,_0xd7e945){var _0x32b929=_0x550761||client;return _0x32b929[_0x33d0('0x1a')](_0x4ff992,_0x50a96c)[_0x33d0('0x1b')](function(_0x29c5ac){logger[_0x33d0('0x1c')](_0x33d0('0x1d'),_0x18a467,'request\x20sent');logger[_0x33d0('0x1e')](_0x33d0('0x1f'),_0x18a467,_0x33d0('0x20'),JSON['stringify'](_0x29c5ac));if(_0x29c5ac[_0x33d0('0x21')]){if(_0x29c5ac[_0x33d0('0x21')][_0x33d0('0x22')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x18a467,_0x29c5ac['error'][_0x33d0('0x23')]);return _0xd7e945(_0x29c5ac[_0x33d0('0x21')][_0x33d0('0x23')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x18a467,_0x29c5ac[_0x33d0('0x21')]['message']);return _0x157d7d(_0x29c5ac[_0x33d0('0x21')][_0x33d0('0x23')]);}else{logger[_0x33d0('0x1c')](_0x33d0('0x1d'),_0x18a467,'request\x20sent');_0x157d7d(_0x29c5ac[_0x33d0('0x24')][_0x33d0('0x23')]);}})[_0x33d0('0x25')](function(_0x5eba8f){logger['error'](_0x33d0('0x1d'),_0x18a467,_0x5eba8f);_0xd7e945(_0x5eba8f);});});}function respondWithStatusCode(_0x3c6225,_0x3759e4){_0x3759e4=_0x3759e4||0xcc;return function(_0x4047c0){if(_0x4047c0){return _0x3c6225[_0x33d0('0x26')](_0x3759e4);}return _0x3c6225[_0x33d0('0x27')](_0x3759e4)[_0x33d0('0x28')]();};}function respondWithResult(_0x1ed1ff,_0x59bf09){_0x59bf09=_0x59bf09||0xc8;return function(_0x13f9c3){if(_0x13f9c3){return _0x1ed1ff[_0x33d0('0x27')](_0x59bf09)[_0x33d0('0x29')](_0x13f9c3);}};}function respondWithFilteredResult(_0x53b92b,_0xf1e2d7){return function(_0x5da337){if(_0x5da337){var _0x175213=typeof _0xf1e2d7['offset']===_0x33d0('0x2a')&&typeof _0xf1e2d7['limit']==='undefined';var _0x4c0893=_0x5da337['count'];var _0x4ffab9=_0x175213?0x0:_0xf1e2d7[_0x33d0('0x2b')];var _0x5a4989=_0x175213?_0x5da337['count']:_0xf1e2d7[_0x33d0('0x2b')]+_0xf1e2d7[_0x33d0('0x2c')];var _0x3459d9;if(_0x5a4989>=_0x4c0893){_0x5a4989=_0x4c0893;_0x3459d9=0xc8;}else{_0x3459d9=0xce;}_0x53b92b['status'](_0x3459d9);return _0x53b92b['set'](_0x33d0('0x2d'),_0x4ffab9+'-'+_0x5a4989+'/'+_0x4c0893)['json'](_0x5da337);}return null;};}function patchUpdates(_0x417442){return function(_0x9d87d3){try{jsonpatch[_0x33d0('0x2e')](_0x9d87d3,_0x417442,!![]);}catch(_0x51235b){return BPromise['reject'](_0x51235b);}return _0x9d87d3[_0x33d0('0x2f')]();};}function saveUpdates(_0x576ac1,_0xc585e1){return function(_0x28ec87){if(_0x28ec87){return _0x28ec87[_0x33d0('0x30')](_0x576ac1)[_0x33d0('0x1b')](function(_0x38ace4){return _0x38ace4;});}return null;};}function removeEntity(_0x155e4d,_0xc46964){return function(_0x27d7f9){if(_0x27d7f9){return _0x27d7f9[_0x33d0('0x31')]()[_0x33d0('0x1b')](function(){var _0x4055ae=_0x27d7f9[_0x33d0('0x32')]({'plain':!![]});var _0x5b3a26=_0x33d0('0x33');return db[_0x33d0('0x34')][_0x33d0('0x31')]({'where':{'type':_0x5b3a26,'resourceId':_0x4055ae['id']}})[_0x33d0('0x1b')](function(){return _0x27d7f9;});})[_0x33d0('0x1b')](function(){_0x155e4d[_0x33d0('0x27')](0xcc)[_0x33d0('0x28')]();});}};}function handleEntityNotFound(_0x2cf9b6,_0x35bfd1){return function(_0x17569f){if(!_0x17569f){_0x2cf9b6['sendStatus'](0x194);}return _0x17569f;};}function handleError(_0x195e82,_0x33927c){_0x33927c=_0x33927c||0x1f4;return function(_0x10c059){logger[_0x33d0('0x21')](_0x10c059['stack']);if(_0x10c059[_0x33d0('0x35')]){delete _0x10c059['name'];}_0x195e82[_0x33d0('0x27')](_0x33927c)[_0x33d0('0x36')](_0x10c059);};}exports['index']=function(_0x48b2be,_0x5cc34e){var _0x1c02fe={},_0x320461={},_0x58c095={'count':0x0,'rows':[]};var _0x1b7416=_[_0x33d0('0x37')](db[_0x33d0('0x38')][_0x33d0('0x39')],function(_0xd615d6){return{'name':_0xd615d6[_0x33d0('0x3a')],'type':_0xd615d6[_0x33d0('0x3b')][_0x33d0('0x3c')]};});_0x320461['model']=_[_0x33d0('0x37')](_0x1b7416,_0x33d0('0x35'));_0x320461[_0x33d0('0x3d')]=_[_0x33d0('0x3e')](_0x48b2be[_0x33d0('0x3d')]);_0x320461[_0x33d0('0x3f')]=_[_0x33d0('0x40')](_0x320461[_0x33d0('0x41')],_0x320461[_0x33d0('0x3d')]);_0x1c02fe[_0x33d0('0x42')]=_[_0x33d0('0x40')](_0x320461[_0x33d0('0x41')],qs[_0x33d0('0x43')](_0x48b2be[_0x33d0('0x3d')]['fields']));_0x1c02fe['attributes']=_0x1c02fe[_0x33d0('0x42')][_0x33d0('0x44')]?_0x1c02fe[_0x33d0('0x42')]:_0x320461[_0x33d0('0x41')];if(!_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x45')](_0x33d0('0x46'))){_0x1c02fe[_0x33d0('0x2c')]=qs[_0x33d0('0x2c')](_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x2c')]);_0x1c02fe[_0x33d0('0x2b')]=qs[_0x33d0('0x2b')](_0x48b2be['query']['offset']);}_0x1c02fe[_0x33d0('0x47')]=qs[_0x33d0('0x48')](_0x48b2be['query'][_0x33d0('0x48')]);_0x1c02fe[_0x33d0('0x49')]=qs[_0x33d0('0x3f')](_[_0x33d0('0x4a')](_0x48b2be['query'],_0x320461[_0x33d0('0x3f')]),_0x1b7416);if(_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x4b')]){_0x1c02fe[_0x33d0('0x49')]=_[_0x33d0('0x4c')](_0x1c02fe[_0x33d0('0x49')],{'$or':_[_0x33d0('0x37')](_0x1b7416,function(_0x43556e){if(_0x43556e[_0x33d0('0x3b')]!==_0x33d0('0x4d')){var _0x1382b0={};_0x1382b0[_0x43556e[_0x33d0('0x35')]]={'$like':'%'+_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x4b')]+'%'};return _0x1382b0;}})});}_0x1c02fe=_[_0x33d0('0x4c')]({},_0x1c02fe,_0x48b2be['options']);var _0x5caa5d={'where':_0x1c02fe[_0x33d0('0x49')]};return db[_0x33d0('0x38')][_0x33d0('0x4e')](_0x5caa5d)[_0x33d0('0x1b')](function(_0x2f2ef8){_0x58c095[_0x33d0('0x4e')]=_0x2f2ef8;if(_0x48b2be[_0x33d0('0x3d')][_0x33d0('0x4f')]){_0x1c02fe[_0x33d0('0x50')]=[{'all':!![]}];}return db[_0x33d0('0x38')][_0x33d0('0x51')](_0x1c02fe);})[_0x33d0('0x1b')](function(_0x3512d3){_0x58c095[_0x33d0('0x52')]=_0x3512d3;return _0x58c095;})[_0x33d0('0x1b')](respondWithFilteredResult(_0x5cc34e,_0x1c02fe))[_0x33d0('0x25')](handleError(_0x5cc34e,null));};exports[_0x33d0('0x53')]=function(_0x347e1,_0x4ec193){var _0x6f791f={'raw':![],'where':{'id':_0x347e1[_0x33d0('0x54')]['id']}},_0x4d3427={};_0x4d3427['model']=_['keys'](db[_0x33d0('0x38')][_0x33d0('0x39')]);_0x4d3427[_0x33d0('0x3d')]=_[_0x33d0('0x3e')](_0x347e1[_0x33d0('0x3d')]);_0x4d3427[_0x33d0('0x3f')]=_[_0x33d0('0x40')](_0x4d3427[_0x33d0('0x41')],_0x4d3427[_0x33d0('0x3d')]);_0x6f791f['attributes']=_[_0x33d0('0x40')](_0x4d3427[_0x33d0('0x41')],qs[_0x33d0('0x43')](_0x347e1[_0x33d0('0x3d')][_0x33d0('0x43')]));_0x6f791f[_0x33d0('0x42')]=_0x6f791f[_0x33d0('0x42')][_0x33d0('0x44')]?_0x6f791f[_0x33d0('0x42')]:_0x4d3427['model'];if(_0x347e1[_0x33d0('0x3d')][_0x33d0('0x4f')]){_0x6f791f['include']=[{'all':!![]}];}_0x6f791f=_[_0x33d0('0x4c')]({},_0x6f791f,_0x347e1[_0x33d0('0x55')]);return db[_0x33d0('0x38')][_0x33d0('0x56')](_0x6f791f)['then'](handleEntityNotFound(_0x4ec193,null))[_0x33d0('0x1b')](respondWithResult(_0x4ec193,null))[_0x33d0('0x25')](handleError(_0x4ec193,null));};exports[_0x33d0('0x57')]=function(_0x2b2d1a,_0x162fd2,_0x2b94c5){var _0x119b9d;return db[_0x33d0('0x38')]['create'](_0x2b2d1a[_0x33d0('0x58')],{'raw':!![]})[_0x33d0('0x1b')](function(_0x215eb7){_0x119b9d=_0x215eb7;return db[_0x33d0('0x38')][_0x33d0('0x51')]({'raw':!![]});})[_0x33d0('0x1b')](function(_0x941a6e){var _0x50cf25=fs[_0x33d0('0x59')](path[_0x33d0('0x5a')](config[_0x33d0('0x5b')],_0x33d0('0x5c')),'utf8');var _0x238fc2=ejs[_0x33d0('0x5d')](_0x50cf25,{'contexts':_0x941a6e||[]});fs[_0x33d0('0x5e')](_0x33d0('0x5f'),_0x238fc2);})[_0x33d0('0x1b')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x33d0('0x60')});})[_0x33d0('0x1b')](function(){var _0x18e2e8=_0x2b2d1a[_0x33d0('0x61')][_0x33d0('0x32')]({'plain':!![]});if(!_0x18e2e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18e2e8[_0x33d0('0x62')]==='user'){var _0x23f847=_0x119b9d[_0x33d0('0x32')]({'plain':!![]});return db[_0x33d0('0x63')][_0x33d0('0x56')]({'where':{'name':_0x33d0('0x33'),'userProfileId':_0x18e2e8[_0x33d0('0x64')]},'raw':!![]})[_0x33d0('0x1b')](function(_0x32e1a8){if(_0x32e1a8&&_0x32e1a8[_0x33d0('0x65')]===0x0){return db[_0x33d0('0x34')][_0x33d0('0x57')]({'name':_0x23f847[_0x33d0('0x35')],'resourceId':_0x23f847['id'],'type':_0x32e1a8[_0x33d0('0x35')],'sectionId':_0x32e1a8['id']},{})[_0x33d0('0x1b')](function(){return _0x119b9d;});}else{return _0x119b9d;}})[_0x33d0('0x25')](function(_0xa94c){logger[_0x33d0('0x21')](_0x33d0('0x66'),_0xa94c);throw _0xa94c;});}return _0x119b9d;})[_0x33d0('0x1b')](respondWithResult(_0x162fd2,0xc9))[_0x33d0('0x25')](handleError(_0x162fd2,null));};exports[_0x33d0('0x30')]=function(_0x53a1a4,_0xd78a90,_0x5765c7){var _0x3adc61;return db[_0x33d0('0x38')][_0x33d0('0x56')]({'where':{'id':_0x53a1a4[_0x33d0('0x54')]['id']}})[_0x33d0('0x1b')](handleEntityNotFound(_0xd78a90,null))['then'](saveUpdates(_0x53a1a4[_0x33d0('0x58')],null))[_0x33d0('0x1b')](function(_0x31f01a){if(_0x31f01a){_0x3adc61=_0x31f01a;return db[_0x33d0('0x38')][_0x33d0('0x51')]({'raw':!![]});}})['then'](function(_0x264fbf){var _0x3c2cfb=fs[_0x33d0('0x59')](path[_0x33d0('0x5a')](config['root'],_0x33d0('0x5c')),_0x33d0('0x67'));var _0x331eb5=ejs[_0x33d0('0x5d')](_0x3c2cfb,{'contexts':_0x264fbf||[]});fs['writeFileSync'](_0x33d0('0x5f'),_0x331eb5);})['then'](function(){return respondWithRpcPromise('Reload',_0x33d0('0x30'),{'module':'chan_sip.so'});})[_0x33d0('0x1b')](function(){return _0x3adc61;})[_0x33d0('0x1b')](respondWithResult(_0xd78a90,null))[_0x33d0('0x25')](handleError(_0xd78a90,null));};exports[_0x33d0('0x31')]=function(_0x2f0e8b,_0x4d6541,_0x437bdc){var _0x332446;return db[_0x33d0('0x38')][_0x33d0('0x56')]({'where':{'id':_0x2f0e8b['params']['id']}})[_0x33d0('0x1b')](handleEntityNotFound(_0x4d6541,null))[_0x33d0('0x1b')](removeEntity(_0x4d6541,null))[_0x33d0('0x1b')](function(){return db[_0x33d0('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1413c5){var _0x612358=fs[_0x33d0('0x59')](path[_0x33d0('0x5a')](config[_0x33d0('0x5b')],_0x33d0('0x5c')),'utf8');var _0x5f383d=ejs[_0x33d0('0x5d')](_0x612358,{'contexts':_0x1413c5});fs['writeFileSync'](_0x33d0('0x5f'),_0x5f383d);return respondWithRpcPromise(_0x33d0('0x68'),_0x33d0('0x31'),{'module':_0x33d0('0x60')});})['catch'](handleError(_0x4d6541,null));}; \ No newline at end of file +var _0xe914=['model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge','where','type','options','includeAll','findAll','show','params','keys','include','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','utf8','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','get','Contexts','UserProfileResource','stack','name','send','index','VoiceContext','rawAttributes','fieldName','key'];(function(_0xf6d764,_0x465cd9){var _0x57e20d=function(_0x48bd83){while(--_0x48bd83){_0xf6d764['push'](_0xf6d764['shift']());}};_0x57e20d(++_0x465cd9);}(_0xe914,0x98));var _0x4e91=function(_0x59fffc,_0x526e06){_0x59fffc=_0x59fffc-0x0;var _0x4e168e=_0xe914[_0x59fffc];return _0x4e168e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e91('0x0'));var zipdir=require(_0x4e91('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e91('0x2'));var moment=require(_0x4e91('0x3'));var BPromise=require(_0x4e91('0x4'));var Mustache=require(_0x4e91('0x5'));var util=require(_0x4e91('0x6'));var path=require(_0x4e91('0x7'));var sox=require(_0x4e91('0x8'));var csv=require(_0x4e91('0x9'));var ejs=require(_0x4e91('0xa'));var fs=require('fs');var fs_extra=require(_0x4e91('0xb'));var _=require(_0x4e91('0xc'));var squel=require(_0x4e91('0xd'));var crypto=require(_0x4e91('0xe'));var jsforce=require(_0x4e91('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e91('0x10'));var Papa=require(_0x4e91('0x11'));var Redis=require(_0x4e91('0x12'));var authService=require(_0x4e91('0x13'));var qs=require(_0x4e91('0x14'));var as=require(_0x4e91('0x15'));var hardwareService=require(_0x4e91('0x16'));var logger=require(_0x4e91('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4e91('0x18'));var licenseUtil=require(_0x4e91('0x19'));var db=require(_0x4e91('0x1a'))['db'];var jayson=require(_0x4e91('0x1b'));var client=jayson[_0x4e91('0x1c')][_0x4e91('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1d9df5,_0x395421,_0x319248,_0x4b8bd7){return new BPromise(function(_0x43ede2,_0x7a1cb6){var _0x312e5a=_0x4b8bd7||client;return _0x312e5a[_0x4e91('0x1e')](_0x1d9df5,_0x319248)[_0x4e91('0x1f')](function(_0x3fa3fe){logger[_0x4e91('0x20')](_0x4e91('0x21'),_0x395421,_0x4e91('0x22'));logger[_0x4e91('0x23')](_0x4e91('0x24'),_0x395421,'request\x20sent',JSON[_0x4e91('0x25')](_0x3fa3fe));if(_0x3fa3fe['error']){if(_0x3fa3fe[_0x4e91('0x26')][_0x4e91('0x27')]===0x1f4){logger[_0x4e91('0x26')](_0x4e91('0x21'),_0x395421,_0x3fa3fe['error'][_0x4e91('0x28')]);return _0x7a1cb6(_0x3fa3fe[_0x4e91('0x26')][_0x4e91('0x28')]);}logger[_0x4e91('0x26')](_0x4e91('0x21'),_0x395421,_0x3fa3fe['error']['message']);return _0x43ede2(_0x3fa3fe['error'][_0x4e91('0x28')]);}else{logger[_0x4e91('0x20')](_0x4e91('0x21'),_0x395421,_0x4e91('0x22'));_0x43ede2(_0x3fa3fe[_0x4e91('0x29')][_0x4e91('0x28')]);}})[_0x4e91('0x2a')](function(_0x407961){logger['error'](_0x4e91('0x21'),_0x395421,_0x407961);_0x7a1cb6(_0x407961);});});}function respondWithStatusCode(_0x47e16f,_0x6e1e4c){_0x6e1e4c=_0x6e1e4c||0xcc;return function(_0x46bd03){if(_0x46bd03){return _0x47e16f['sendStatus'](_0x6e1e4c);}return _0x47e16f['status'](_0x6e1e4c)[_0x4e91('0x2b')]();};}function respondWithResult(_0x105fbb,_0x2c141b){_0x2c141b=_0x2c141b||0xc8;return function(_0x2a509c){if(_0x2a509c){return _0x105fbb[_0x4e91('0x2c')](_0x2c141b)[_0x4e91('0x2d')](_0x2a509c);}};}function respondWithFilteredResult(_0x2e328b,_0x1e9c37){return function(_0x373c1a){if(_0x373c1a){var _0x4846a6=typeof _0x1e9c37['offset']==='undefined'&&typeof _0x1e9c37['limit']===_0x4e91('0x2e');var _0x55070b=_0x373c1a[_0x4e91('0x2f')];var _0x1b2cd2=_0x4846a6?0x0:_0x1e9c37[_0x4e91('0x30')];var _0x180a97=_0x4846a6?_0x373c1a[_0x4e91('0x2f')]:_0x1e9c37[_0x4e91('0x30')]+_0x1e9c37[_0x4e91('0x31')];var _0x5108b6;if(_0x180a97>=_0x55070b){_0x180a97=_0x55070b;_0x5108b6=0xc8;}else{_0x5108b6=0xce;}_0x2e328b[_0x4e91('0x2c')](_0x5108b6);return _0x2e328b[_0x4e91('0x32')](_0x4e91('0x33'),_0x1b2cd2+'-'+_0x180a97+'/'+_0x55070b)[_0x4e91('0x2d')](_0x373c1a);}return null;};}function patchUpdates(_0x4e7d24){return function(_0x255575){try{jsonpatch[_0x4e91('0x34')](_0x255575,_0x4e7d24,!![]);}catch(_0x90a02a){return BPromise['reject'](_0x90a02a);}return _0x255575[_0x4e91('0x35')]();};}function saveUpdates(_0x582b01,_0x5781d0){return function(_0x314bea){if(_0x314bea){return _0x314bea['update'](_0x582b01)[_0x4e91('0x1f')](function(_0x13ae4b){return _0x13ae4b;});}return null;};}function removeEntity(_0x17943f,_0x5eed9e){return function(_0x2d928a){if(_0x2d928a){return _0x2d928a[_0x4e91('0x36')]()['then'](function(){var _0x430bd4=_0x2d928a[_0x4e91('0x37')]({'plain':!![]});var _0x41d7e2=_0x4e91('0x38');return db[_0x4e91('0x39')][_0x4e91('0x36')]({'where':{'type':_0x41d7e2,'resourceId':_0x430bd4['id']}})['then'](function(){return _0x2d928a;});})['then'](function(){_0x17943f[_0x4e91('0x2c')](0xcc)[_0x4e91('0x2b')]();});}};}function handleEntityNotFound(_0x2063f3,_0x238b40){return function(_0x2227db){if(!_0x2227db){_0x2063f3['sendStatus'](0x194);}return _0x2227db;};}function handleError(_0xfb9c5f,_0x1758d0){_0x1758d0=_0x1758d0||0x1f4;return function(_0xb6c8cf){logger['error'](_0xb6c8cf[_0x4e91('0x3a')]);if(_0xb6c8cf['name']){delete _0xb6c8cf[_0x4e91('0x3b')];}_0xfb9c5f[_0x4e91('0x2c')](_0x1758d0)[_0x4e91('0x3c')](_0xb6c8cf);};}exports[_0x4e91('0x3d')]=function(_0x36c14a,_0x5a59bc){var _0xff0179={},_0x3c491c={},_0x1fb112={'count':0x0,'rows':[]};var _0x14c45b=_['map'](db[_0x4e91('0x3e')][_0x4e91('0x3f')],function(_0x109668){return{'name':_0x109668[_0x4e91('0x40')],'type':_0x109668['type'][_0x4e91('0x41')]};});_0x3c491c[_0x4e91('0x42')]=_[_0x4e91('0x43')](_0x14c45b,'name');_0x3c491c[_0x4e91('0x44')]=_['keys'](_0x36c14a[_0x4e91('0x44')]);_0x3c491c[_0x4e91('0x45')]=_[_0x4e91('0x46')](_0x3c491c['model'],_0x3c491c['query']);_0xff0179[_0x4e91('0x47')]=_[_0x4e91('0x46')](_0x3c491c[_0x4e91('0x42')],qs['fields'](_0x36c14a[_0x4e91('0x44')][_0x4e91('0x48')]));_0xff0179[_0x4e91('0x47')]=_0xff0179['attributes'][_0x4e91('0x49')]?_0xff0179[_0x4e91('0x47')]:_0x3c491c[_0x4e91('0x42')];if(!_0x36c14a[_0x4e91('0x44')]['hasOwnProperty'](_0x4e91('0x4a'))){_0xff0179['limit']=qs[_0x4e91('0x31')](_0x36c14a[_0x4e91('0x44')][_0x4e91('0x31')]);_0xff0179[_0x4e91('0x30')]=qs[_0x4e91('0x30')](_0x36c14a['query'][_0x4e91('0x30')]);}_0xff0179['order']=qs[_0x4e91('0x4b')](_0x36c14a[_0x4e91('0x44')][_0x4e91('0x4b')]);_0xff0179['where']=qs[_0x4e91('0x45')](_[_0x4e91('0x4c')](_0x36c14a[_0x4e91('0x44')],_0x3c491c['filters']),_0x14c45b);if(_0x36c14a[_0x4e91('0x44')][_0x4e91('0x4d')]){_0xff0179['where']=_[_0x4e91('0x4e')](_0xff0179[_0x4e91('0x4f')],{'$or':_[_0x4e91('0x43')](_0x14c45b,function(_0x1bf680){if(_0x1bf680[_0x4e91('0x50')]!=='VIRTUAL'){var _0x20a4e5={};_0x20a4e5[_0x1bf680['name']]={'$like':'%'+_0x36c14a[_0x4e91('0x44')][_0x4e91('0x4d')]+'%'};return _0x20a4e5;}})});}_0xff0179=_[_0x4e91('0x4e')]({},_0xff0179,_0x36c14a[_0x4e91('0x51')]);var _0x2fed7a={'where':_0xff0179['where']};return db[_0x4e91('0x3e')]['count'](_0x2fed7a)[_0x4e91('0x1f')](function(_0x59c0f6){_0x1fb112[_0x4e91('0x2f')]=_0x59c0f6;if(_0x36c14a[_0x4e91('0x44')][_0x4e91('0x52')]){_0xff0179['include']=[{'all':!![]}];}return db[_0x4e91('0x3e')][_0x4e91('0x53')](_0xff0179);})['then'](function(_0x59263a){_0x1fb112['rows']=_0x59263a;return _0x1fb112;})[_0x4e91('0x1f')](respondWithFilteredResult(_0x5a59bc,_0xff0179))[_0x4e91('0x2a')](handleError(_0x5a59bc,null));};exports[_0x4e91('0x54')]=function(_0xa73f0a,_0x80dcd7){var _0x59194={'raw':![],'where':{'id':_0xa73f0a[_0x4e91('0x55')]['id']}},_0x580024={};_0x580024[_0x4e91('0x42')]=_[_0x4e91('0x56')](db[_0x4e91('0x3e')][_0x4e91('0x3f')]);_0x580024['query']=_['keys'](_0xa73f0a['query']);_0x580024[_0x4e91('0x45')]=_[_0x4e91('0x46')](_0x580024[_0x4e91('0x42')],_0x580024['query']);_0x59194[_0x4e91('0x47')]=_[_0x4e91('0x46')](_0x580024['model'],qs['fields'](_0xa73f0a['query'][_0x4e91('0x48')]));_0x59194[_0x4e91('0x47')]=_0x59194[_0x4e91('0x47')][_0x4e91('0x49')]?_0x59194['attributes']:_0x580024['model'];if(_0xa73f0a[_0x4e91('0x44')][_0x4e91('0x52')]){_0x59194[_0x4e91('0x57')]=[{'all':!![]}];}_0x59194=_[_0x4e91('0x4e')]({},_0x59194,_0xa73f0a[_0x4e91('0x51')]);return db[_0x4e91('0x3e')][_0x4e91('0x58')](_0x59194)[_0x4e91('0x1f')](handleEntityNotFound(_0x80dcd7,null))['then'](respondWithResult(_0x80dcd7,null))[_0x4e91('0x2a')](handleError(_0x80dcd7,null));};exports[_0x4e91('0x59')]=function(_0x5c414b,_0x457844,_0x4a3c59){var _0x1bfeda;return db[_0x4e91('0x3e')][_0x4e91('0x59')](_0x5c414b[_0x4e91('0x5a')],{'raw':!![]})['then'](function(_0x569dcb){_0x1bfeda=_0x569dcb;return db[_0x4e91('0x3e')]['findAll']({'raw':!![]});})[_0x4e91('0x1f')](function(_0x1835c3){var _0x2425c1=fs[_0x4e91('0x5b')](path[_0x4e91('0x5c')](config[_0x4e91('0x5d')],_0x4e91('0x5e')),'utf8');var _0xfb05a8=ejs[_0x4e91('0x5f')](_0x2425c1,{'contexts':_0x1835c3||[]});fs[_0x4e91('0x60')](_0x4e91('0x61'),_0xfb05a8);})[_0x4e91('0x1f')](function(){return respondWithRpcPromise(_0x4e91('0x62'),_0x4e91('0x59'),{'module':_0x4e91('0x63')});})['then'](function(){var _0x14108c=_0x5c414b[_0x4e91('0x64')][_0x4e91('0x37')]({'plain':!![]});if(!_0x14108c)throw new Error(_0x4e91('0x65'));if(_0x14108c[_0x4e91('0x66')]===_0x4e91('0x64')){var _0x1fa7d7=_0x1bfeda[_0x4e91('0x37')]({'plain':!![]});return db[_0x4e91('0x67')][_0x4e91('0x58')]({'where':{'name':_0x4e91('0x38'),'userProfileId':_0x14108c[_0x4e91('0x68')]},'raw':!![]})[_0x4e91('0x1f')](function(_0x512f69){if(_0x512f69&&_0x512f69[_0x4e91('0x69')]===0x0){return db[_0x4e91('0x39')][_0x4e91('0x59')]({'name':_0x1fa7d7['name'],'resourceId':_0x1fa7d7['id'],'type':_0x512f69['name'],'sectionId':_0x512f69['id']},{})[_0x4e91('0x1f')](function(){return _0x1bfeda;});}else{return _0x1bfeda;}})[_0x4e91('0x2a')](function(_0x59aab5){logger[_0x4e91('0x26')](_0x4e91('0x6a'),_0x59aab5);throw _0x59aab5;});}return _0x1bfeda;})[_0x4e91('0x1f')](respondWithResult(_0x457844,0xc9))[_0x4e91('0x2a')](handleError(_0x457844,null));};exports[_0x4e91('0x6b')]=function(_0x6a2a6f,_0x301e6c,_0x551cd8){var _0x596a09;return db['VoiceContext']['find']({'where':{'id':_0x6a2a6f[_0x4e91('0x55')]['id']}})[_0x4e91('0x1f')](handleEntityNotFound(_0x301e6c,null))[_0x4e91('0x1f')](saveUpdates(_0x6a2a6f[_0x4e91('0x5a')],null))[_0x4e91('0x1f')](function(_0x353237){if(_0x353237){_0x596a09=_0x353237;return db[_0x4e91('0x3e')][_0x4e91('0x53')]({'raw':!![]});}})[_0x4e91('0x1f')](function(_0x3de444){var _0x44af6d=fs[_0x4e91('0x5b')](path[_0x4e91('0x5c')](config[_0x4e91('0x5d')],_0x4e91('0x5e')),_0x4e91('0x6c'));var _0x31a863=ejs[_0x4e91('0x5f')](_0x44af6d,{'contexts':_0x3de444||[]});fs['writeFileSync'](_0x4e91('0x61'),_0x31a863);})[_0x4e91('0x1f')](function(){return respondWithRpcPromise('Reload',_0x4e91('0x6b'),{'module':_0x4e91('0x63')});})[_0x4e91('0x1f')](function(){return _0x596a09;})[_0x4e91('0x1f')](respondWithResult(_0x301e6c,null))[_0x4e91('0x2a')](handleError(_0x301e6c,null));};exports[_0x4e91('0x36')]=function(_0x341754,_0x369e7,_0x4b51a0){var _0x532743;return db[_0x4e91('0x3e')][_0x4e91('0x58')]({'where':{'id':_0x341754[_0x4e91('0x55')]['id']}})[_0x4e91('0x1f')](handleEntityNotFound(_0x369e7,null))[_0x4e91('0x1f')](removeEntity(_0x369e7,null))[_0x4e91('0x1f')](function(){return db[_0x4e91('0x3e')][_0x4e91('0x53')]({'raw':!![]});})[_0x4e91('0x1f')](function(_0xbadd72){var _0x32051e=fs[_0x4e91('0x5b')](path['join'](config[_0x4e91('0x5d')],_0x4e91('0x5e')),_0x4e91('0x6c'));var _0x4d4056=ejs['render'](_0x32051e,{'contexts':_0xbadd72});fs[_0x4e91('0x60')](_0x4e91('0x61'),_0x4d4056);return respondWithRpcPromise(_0x4e91('0x62'),_0x4e91('0x36'),{'module':_0x4e91('0x63')});})[_0x4e91('0x2a')](handleError(_0x369e7,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 69042ab..d879205 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 _0xa02b=['../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1523b6,_0x30d0ba){var _0x3f5ead=function(_0x26e9a3){while(--_0x26e9a3){_0x1523b6['push'](_0x1523b6['shift']());}};_0x3f5ead(++_0x30d0ba);}(_0xa02b,0xd5));var _0xba02=function(_0x9be62c,_0x4eb64d){_0x9be62c=_0x9be62c-0x0;var _0x969a49=_0xa02b[_0x9be62c];return _0x969a49;};'use strict';var _=require(_0xba02('0x0'));var util=require('util');var logger=require(_0xba02('0x1'))(_0xba02('0x2'));var moment=require(_0xba02('0x3'));var BPromise=require(_0xba02('0x4'));var rp=require(_0xba02('0x5'));var fs=require('fs');var path=require(_0xba02('0x6'));var rimraf=require(_0xba02('0x7'));var config=require(_0xba02('0x8'));var attributes=require(_0xba02('0x9'));module['exports']=function(_0x3c2749,_0x27ebc5){return _0x3c2749[_0xba02('0xa')](_0xba02('0xb'),attributes,{'tableName':_0xba02('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72c8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash'];(function(_0x43262b,_0x3aed9a){var _0x46ada8=function(_0x1310a5){while(--_0x1310a5){_0x43262b['push'](_0x43262b['shift']());}};_0x46ada8(++_0x3aed9a);}(_0x72c8,0x8e));var _0x872c=function(_0xe00643,_0x694809){_0xe00643=_0xe00643-0x0;var _0xdd3271=_0x72c8[_0xe00643];return _0xdd3271;};'use strict';var _=require(_0x872c('0x0'));var util=require(_0x872c('0x1'));var logger=require(_0x872c('0x2'))(_0x872c('0x3'));var moment=require(_0x872c('0x4'));var BPromise=require(_0x872c('0x5'));var rp=require(_0x872c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x872c('0x7'));var config=require(_0x872c('0x8'));var attributes=require(_0x872c('0x9'));module[_0x872c('0xa')]=function(_0x243e45,_0xedc533){return _0x243e45[_0x872c('0xb')](_0x872c('0xc'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index e7919b4..ef7b3e8 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 _0xb8c3=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c5c22,_0x41c92e){var _0x176952=function(_0x28f615){while(--_0x28f615){_0x4c5c22['push'](_0x4c5c22['shift']());}};_0x176952(++_0x41c92e);}(_0xb8c3,0x9d));var _0x3b8c=function(_0x32ef2a,_0x11d483){_0x32ef2a=_0x32ef2a-0x0;var _0x7e3556=_0xb8c3[_0x32ef2a];return _0x7e3556;};'use strict';var _=require(_0x3b8c('0x0'));var util=require(_0x3b8c('0x1'));var moment=require(_0x3b8c('0x2'));var BPromise=require(_0x3b8c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b8c('0x4'));var db=require(_0x3b8c('0x5'))['db'];var utils=require(_0x3b8c('0x6'));var logger=require(_0x3b8c('0x7'))(_0x3b8c('0x8'));var config=require(_0x3b8c('0x9'));var jayson=require(_0x3b8c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48f946,_0x52e4e9,_0x503953){return new BPromise(function(_0x58c96f,_0x57f7b3){return client[_0x3b8c('0xb')](_0x48f946,_0x503953)['then'](function(_0x163eec){logger[_0x3b8c('0xc')](_0x3b8c('0xd'),_0x52e4e9,_0x3b8c('0xe'));logger['debug'](_0x3b8c('0xf'),_0x52e4e9,'request\x20sent',JSON[_0x3b8c('0x10')](_0x163eec));if(_0x163eec['error']){if(_0x163eec[_0x3b8c('0x11')][_0x3b8c('0x12')]===0x1f4){logger['error'](_0x3b8c('0xd'),_0x52e4e9,_0x163eec[_0x3b8c('0x11')][_0x3b8c('0x13')]);return _0x57f7b3(_0x163eec[_0x3b8c('0x11')][_0x3b8c('0x13')]);}logger[_0x3b8c('0x11')](_0x3b8c('0xd'),_0x52e4e9,_0x163eec['error'][_0x3b8c('0x13')]);return _0x58c96f(_0x163eec['error'][_0x3b8c('0x13')]);}else{logger[_0x3b8c('0xc')]('VoiceContext,\x20%s,\x20%s',_0x52e4e9,_0x3b8c('0xe'));_0x58c96f(_0x163eec[_0x3b8c('0x14')]['message']);}})[_0x3b8c('0x15')](function(_0x3c319f){logger[_0x3b8c('0x11')]('VoiceContext,\x20%s,\x20%s',_0x52e4e9,_0x3c319f);_0x57f7b3(_0x3c319f);});});} \ No newline at end of file +var _0xe348=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3bdf35,_0x771660){var _0x13e45c=function(_0x187ba0){while(--_0x187ba0){_0x3bdf35['push'](_0x3bdf35['shift']());}};_0x13e45c(++_0x771660);}(_0xe348,0x137));var _0x8e34=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xe348[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x8e34('0x0'));var util=require(_0x8e34('0x1'));var moment=require('moment');var BPromise=require(_0x8e34('0x2'));var rs=require(_0x8e34('0x3'));var fs=require('fs');var Redis=require(_0x8e34('0x4'));var db=require(_0x8e34('0x5'))['db'];var utils=require(_0x8e34('0x6'));var logger=require(_0x8e34('0x7'))(_0x8e34('0x8'));var config=require('../../config/environment');var jayson=require(_0x8e34('0x9'));var client=jayson[_0x8e34('0xa')][_0x8e34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e8565,_0x1a5573,_0x5b4bbe){return new BPromise(function(_0x161e98,_0x41e8a8){return client['request'](_0x4e8565,_0x5b4bbe)[_0x8e34('0xc')](function(_0x3ee4d8){logger[_0x8e34('0xd')](_0x8e34('0xe'),_0x1a5573,_0x8e34('0xf'));logger[_0x8e34('0x10')](_0x8e34('0x11'),_0x1a5573,_0x8e34('0xf'),JSON[_0x8e34('0x12')](_0x3ee4d8));if(_0x3ee4d8[_0x8e34('0x13')]){if(_0x3ee4d8['error'][_0x8e34('0x14')]===0x1f4){logger[_0x8e34('0x13')](_0x8e34('0xe'),_0x1a5573,_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);return _0x41e8a8(_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x1a5573,_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);return _0x161e98(_0x3ee4d8[_0x8e34('0x13')][_0x8e34('0x15')]);}else{logger[_0x8e34('0xd')](_0x8e34('0xe'),_0x1a5573,'request\x20sent');_0x161e98(_0x3ee4d8[_0x8e34('0x16')]['message']);}})[_0x8e34('0x17')](function(_0x1b8ade){logger['error'](_0x8e34('0xe'),_0x1a5573,_0x1b8ade);_0x41e8a8(_0x1b8ade);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8eafcb0..58d5ea3 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 _0x6e5d=['exports','multer','util','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update'];(function(_0x5efbd0,_0x299553){var _0x475ec9=function(_0x3752ec){while(--_0x3752ec){_0x5efbd0['push'](_0x5efbd0['shift']());}};_0x475ec9(++_0x299553);}(_0x6e5d,0x9a));var _0xd6e5=function(_0x21928f,_0x486777){_0x21928f=_0x21928f-0x0;var _0x13583c=_0x6e5d[_0x21928f];return _0x13583c;};'use strict';var multer=require(_0xd6e5('0x0'));var util=require(_0xd6e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd6e5('0x2'));var router=express[_0xd6e5('0x3')]();var fs_extra=require(_0xd6e5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd6e5('0x5'));var controller=require(_0xd6e5('0x6'));router[_0xd6e5('0x7')]('/',auth[_0xd6e5('0x8')](),controller[_0xd6e5('0x9')]);router[_0xd6e5('0x7')]('/describe',auth[_0xd6e5('0x8')](),controller[_0xd6e5('0xa')]);router[_0xd6e5('0x7')](_0xd6e5('0xb'),auth[_0xd6e5('0x8')](),controller[_0xd6e5('0xc')]);router[_0xd6e5('0xd')]('/',auth[_0xd6e5('0x8')](),controller[_0xd6e5('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd6e5('0xf')]);router['delete'](_0xd6e5('0xb'),auth[_0xd6e5('0x8')](),controller['destroy']);module[_0xd6e5('0x10')]=router; \ No newline at end of file +var _0x7694=['/:id','show','post','put','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7694,0x1a2));var _0x4769=function(_0x294c60,_0x31448c){_0x294c60=_0x294c60-0x0;var _0x60878e=_0x7694[_0x294c60];return _0x60878e;};'use strict';var multer=require(_0x4769('0x0'));var util=require(_0x4769('0x1'));var path=require('path');var timeout=require(_0x4769('0x2'));var express=require(_0x4769('0x3'));var router=express[_0x4769('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4769('0x5'));var interaction=require(_0x4769('0x6'));var config=require(_0x4769('0x7'));var controller=require(_0x4769('0x8'));router['get']('/',auth[_0x4769('0x9')](),controller[_0x4769('0xa')]);router[_0x4769('0xb')](_0x4769('0xc'),auth[_0x4769('0x9')](),controller[_0x4769('0xd')]);router[_0x4769('0xb')](_0x4769('0xe'),auth[_0x4769('0x9')](),controller[_0x4769('0xf')]);router[_0x4769('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4769('0x11')](_0x4769('0xe'),auth[_0x4769('0x9')](),controller['update']);router['delete'](_0x4769('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 25254e2..19fc3a4 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 _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x27c46a,_0x5a02b0){var _0x21513b=function(_0x5d7ef8){while(--_0x5d7ef8){_0x27c46a['push'](_0x27c46a['shift']());}};_0x21513b(++_0x5a02b0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x32d330,_0xe907c8){_0x32d330=_0x32d330-0x0;var _0xe81a43=_0xf3cd[_0x32d330];return _0xe81a43;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x2453f1,_0x4c6a98){var _0x4d12a5=function(_0x2483a0){while(--_0x2483a0){_0x2453f1['push'](_0x2453f1['shift']());}};_0x4d12a5(++_0x4c6a98);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x236ce3,_0xb8d03f){_0x236ce3=_0x236ce3-0x0;var _0x4a3f88=_0x6f0d[_0x236ce3];return _0x4a3f88;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 924d0ee..fa304ac 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 _0xef3e=['where','pick','filter','merge','type','options','VoiceDialReport','include','findAll','rows','show','params','includeAll','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x19b50e,_0x481072){var _0x29a4fa=function(_0x915d99){while(--_0x915d99){_0x19b50e['push'](_0x19b50e['shift']());}};_0x29a4fa(++_0x481072);}(_0xef3e,0x152));var _0xeef3=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xef3e[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0xeef3('0x0'));var rimraf=require(_0xeef3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeef3('0x2'));var rp=require(_0xeef3('0x3'));var moment=require(_0xeef3('0x4'));var BPromise=require(_0xeef3('0x5'));var Mustache=require(_0xeef3('0x6'));var util=require(_0xeef3('0x7'));var path=require(_0xeef3('0x8'));var sox=require(_0xeef3('0x9'));var csv=require(_0xeef3('0xa'));var ejs=require(_0xeef3('0xb'));var fs=require('fs');var fs_extra=require(_0xeef3('0xc'));var _=require(_0xeef3('0xd'));var squel=require(_0xeef3('0xe'));var crypto=require(_0xeef3('0xf'));var jsforce=require(_0xeef3('0x10'));var deskjs=require(_0xeef3('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeef3('0x12'));var Redis=require('ioredis');var authService=require(_0xeef3('0x13'));var qs=require(_0xeef3('0x14'));var as=require(_0xeef3('0x15'));var hardwareService=require(_0xeef3('0x16'));var logger=require(_0xeef3('0x17'))(_0xeef3('0x18'));var utils=require('../../config/utils');var config=require(_0xeef3('0x19'));var licenseUtil=require(_0xeef3('0x1a'));var db=require(_0xeef3('0x1b'))['db'];function respondWithStatusCode(_0x1cddfa,_0x4d8e9e){_0x4d8e9e=_0x4d8e9e||0xcc;return function(_0x43480d){if(_0x43480d){return _0x1cddfa[_0xeef3('0x1c')](_0x4d8e9e);}return _0x1cddfa[_0xeef3('0x1d')](_0x4d8e9e)[_0xeef3('0x1e')]();};}function respondWithResult(_0x2f9c67,_0x4d27c4){_0x4d27c4=_0x4d27c4||0xc8;return function(_0x173553){if(_0x173553){return _0x2f9c67['status'](_0x4d27c4)[_0xeef3('0x1f')](_0x173553);}};}function respondWithFilteredResult(_0x22136d,_0x141b4d){return function(_0x3eb1e3){if(_0x3eb1e3){var _0x32e8c4=typeof _0x141b4d[_0xeef3('0x20')]===_0xeef3('0x21')&&typeof _0x141b4d['limit']===_0xeef3('0x21');var _0x1c1869=_0x3eb1e3[_0xeef3('0x22')];var _0xf47100=_0x32e8c4?0x0:_0x141b4d[_0xeef3('0x20')];var _0x2bb454=_0x32e8c4?_0x3eb1e3[_0xeef3('0x22')]:_0x141b4d[_0xeef3('0x20')]+_0x141b4d[_0xeef3('0x23')];var _0x5bbd09;if(_0x2bb454>=_0x1c1869){_0x2bb454=_0x1c1869;_0x5bbd09=0xc8;}else{_0x5bbd09=0xce;}_0x22136d[_0xeef3('0x1d')](_0x5bbd09);return _0x22136d[_0xeef3('0x24')]('Content-Range',_0xf47100+'-'+_0x2bb454+'/'+_0x1c1869)[_0xeef3('0x1f')](_0x3eb1e3);}return null;};}function patchUpdates(_0x3b5ecc){return function(_0x267584){try{jsonpatch[_0xeef3('0x25')](_0x267584,_0x3b5ecc,!![]);}catch(_0x1f9fdb){return BPromise[_0xeef3('0x26')](_0x1f9fdb);}return _0x267584[_0xeef3('0x27')]();};}function saveUpdates(_0x220974,_0x2e7026){return function(_0x57e505){if(_0x57e505){return _0x57e505[_0xeef3('0x28')](_0x220974)[_0xeef3('0x29')](function(_0x128fa9){return _0x128fa9;});}return null;};}function removeEntity(_0x2f206c,_0x3bc275){return function(_0x27ea9f){if(_0x27ea9f){return _0x27ea9f['destroy']()[_0xeef3('0x29')](function(){_0x2f206c[_0xeef3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d34c,_0x2648a8){return function(_0x573461){if(!_0x573461){_0x15d34c[_0xeef3('0x1c')](0x194);}return _0x573461;};}function handleError(_0x3bda90,_0x1c3102){_0x1c3102=_0x1c3102||0x1f4;return function(_0x3bccc8){logger[_0xeef3('0x2a')](_0x3bccc8[_0xeef3('0x2b')]);if(_0x3bccc8['name']){delete _0x3bccc8[_0xeef3('0x2c')];}_0x3bda90[_0xeef3('0x1d')](_0x1c3102)[_0xeef3('0x2d')](_0x3bccc8);};}exports[_0xeef3('0x2e')]=function(_0x4fc9b3,_0x32629a){var _0x28ed5b={},_0x3421ee={},_0x3e322b={'count':0x0,'rows':[]};var _0x5f4ebf=_[_0xeef3('0x2f')](db['VoiceDialReport']['rawAttributes'],function(_0x3c91f2){return{'name':_0x3c91f2[_0xeef3('0x30')],'type':_0x3c91f2['type'][_0xeef3('0x31')]};});_0x3421ee[_0xeef3('0x32')]=_[_0xeef3('0x2f')](_0x5f4ebf,_0xeef3('0x2c'));_0x3421ee[_0xeef3('0x33')]=_[_0xeef3('0x34')](_0x4fc9b3[_0xeef3('0x33')]);_0x3421ee[_0xeef3('0x35')]=_['intersection'](_0x3421ee[_0xeef3('0x32')],_0x3421ee[_0xeef3('0x33')]);_0x28ed5b['attributes']=_[_0xeef3('0x36')](_0x3421ee[_0xeef3('0x32')],qs[_0xeef3('0x37')](_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x37')]));_0x28ed5b[_0xeef3('0x38')]=_0x28ed5b[_0xeef3('0x38')][_0xeef3('0x39')]?_0x28ed5b[_0xeef3('0x38')]:_0x3421ee[_0xeef3('0x32')];if(!_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x3a')](_0xeef3('0x3b'))){_0x28ed5b[_0xeef3('0x23')]=qs[_0xeef3('0x23')](_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x23')]);_0x28ed5b[_0xeef3('0x20')]=qs[_0xeef3('0x20')](_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x20')]);}_0x28ed5b[_0xeef3('0x3c')]=qs['sort'](_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x3d')]);_0x28ed5b[_0xeef3('0x3e')]=qs[_0xeef3('0x35')](_[_0xeef3('0x3f')](_0x4fc9b3[_0xeef3('0x33')],_0x3421ee['filters']),_0x5f4ebf);if(_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x40')]){_0x28ed5b[_0xeef3('0x3e')]=_[_0xeef3('0x41')](_0x28ed5b['where'],{'$or':_[_0xeef3('0x2f')](_0x5f4ebf,function(_0x5c03e0){if(_0x5c03e0[_0xeef3('0x42')]!=='VIRTUAL'){var _0x557999={};_0x557999[_0x5c03e0[_0xeef3('0x2c')]]={'$like':'%'+_0x4fc9b3[_0xeef3('0x33')][_0xeef3('0x40')]+'%'};return _0x557999;}})});}_0x28ed5b=_['merge']({},_0x28ed5b,_0x4fc9b3[_0xeef3('0x43')]);var _0xbb57e8={'where':_0x28ed5b['where']};return db[_0xeef3('0x44')][_0xeef3('0x22')](_0xbb57e8)['then'](function(_0x51202a){_0x3e322b['count']=_0x51202a;if(_0x4fc9b3['query']['includeAll']){_0x28ed5b[_0xeef3('0x45')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xeef3('0x46')](_0x28ed5b);})[_0xeef3('0x29')](function(_0x133db2){_0x3e322b[_0xeef3('0x47')]=_0x133db2;return _0x3e322b;})['then'](respondWithFilteredResult(_0x32629a,_0x28ed5b))['catch'](handleError(_0x32629a,null));};exports[_0xeef3('0x48')]=function(_0x5cfaca,_0x159ff2){var _0x272d19={'raw':!![],'where':{'id':_0x5cfaca[_0xeef3('0x49')]['id']}},_0x24a5aa={};_0x24a5aa[_0xeef3('0x32')]=_['keys'](db[_0xeef3('0x44')]['rawAttributes']);_0x24a5aa[_0xeef3('0x33')]=_[_0xeef3('0x34')](_0x5cfaca[_0xeef3('0x33')]);_0x24a5aa[_0xeef3('0x35')]=_[_0xeef3('0x36')](_0x24a5aa[_0xeef3('0x32')],_0x24a5aa['query']);_0x272d19[_0xeef3('0x38')]=_['intersection'](_0x24a5aa[_0xeef3('0x32')],qs[_0xeef3('0x37')](_0x5cfaca[_0xeef3('0x33')][_0xeef3('0x37')]));_0x272d19[_0xeef3('0x38')]=_0x272d19[_0xeef3('0x38')]['length']?_0x272d19['attributes']:_0x24a5aa[_0xeef3('0x32')];if(_0x5cfaca[_0xeef3('0x33')][_0xeef3('0x4a')]){_0x272d19[_0xeef3('0x45')]=[{'all':!![]}];}_0x272d19=_[_0xeef3('0x41')]({},_0x272d19,_0x5cfaca[_0xeef3('0x43')]);return db[_0xeef3('0x44')]['find'](_0x272d19)['then'](handleEntityNotFound(_0x159ff2,null))[_0xeef3('0x29')](respondWithResult(_0x159ff2,null))[_0xeef3('0x4b')](handleError(_0x159ff2,null));};exports[_0xeef3('0x4c')]=function(_0x10e775,_0x213536){return db[_0xeef3('0x44')][_0xeef3('0x4c')](_0x10e775[_0xeef3('0x4d')],{})['then'](respondWithResult(_0x213536,0xc9))[_0xeef3('0x4b')](handleError(_0x213536,null));};exports[_0xeef3('0x28')]=function(_0x1c9a52,_0x2bf5d9){if(_0x1c9a52[_0xeef3('0x4d')]['id']){delete _0x1c9a52[_0xeef3('0x4d')]['id'];}return db[_0xeef3('0x44')]['find']({'where':{'id':_0x1c9a52['params']['id']}})[_0xeef3('0x29')](handleEntityNotFound(_0x2bf5d9,null))['then'](saveUpdates(_0x1c9a52[_0xeef3('0x4d')],null))[_0xeef3('0x29')](respondWithResult(_0x2bf5d9,null))['catch'](handleError(_0x2bf5d9,null));};exports['destroy']=function(_0x1966c4,_0x59b22f){return db[_0xeef3('0x44')][_0xeef3('0x4e')]({'where':{'id':_0x1966c4[_0xeef3('0x49')]['id']}})[_0xeef3('0x29')](handleEntityNotFound(_0x59b22f,null))[_0xeef3('0x29')](removeEntity(_0x59b22f,null))['catch'](handleError(_0x59b22f,null));};exports[_0xeef3('0x4f')]=function(_0x1131fe,_0x3f1393){return db[_0xeef3('0x44')][_0xeef3('0x4f')]()[_0xeef3('0x29')](respondWithResult(_0x3f1393,null))[_0xeef3('0x4b')](handleError(_0x3f1393,null));}; \ No newline at end of file +var _0x459b=['intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','VoiceDialReport','rows','catch','params','create','body','find','describe','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters'];(function(_0x1af2fd,_0xe1be5c){var _0x132392=function(_0x3f8131){while(--_0x3f8131){_0x1af2fd['push'](_0x1af2fd['shift']());}};_0x132392(++_0xe1be5c);}(_0x459b,0x1bc));var _0xb459=function(_0x489750,_0x3173f5){_0x489750=_0x489750-0x0;var _0x5b9f9f=_0x459b[_0x489750];return _0x5b9f9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb459('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb459('0x1'));var rp=require('request-promise');var moment=require(_0xb459('0x2'));var BPromise=require(_0xb459('0x3'));var Mustache=require(_0xb459('0x4'));var util=require('util');var path=require(_0xb459('0x5'));var sox=require(_0xb459('0x6'));var csv=require(_0xb459('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb459('0x8'));var _=require('lodash');var squel=require(_0xb459('0x9'));var crypto=require('crypto');var jsforce=require(_0xb459('0xa'));var deskjs=require(_0xb459('0xb'));var toCsv=require(_0xb459('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb459('0xc'));var authService=require(_0xb459('0xd'));var qs=require(_0xb459('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb459('0xf'));var logger=require(_0xb459('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xb459('0x11'));var licenseUtil=require(_0xb459('0x12'));var db=require(_0xb459('0x13'))['db'];function respondWithStatusCode(_0xeb3d23,_0x38f0b2){_0x38f0b2=_0x38f0b2||0xcc;return function(_0x3aa644){if(_0x3aa644){return _0xeb3d23[_0xb459('0x14')](_0x38f0b2);}return _0xeb3d23[_0xb459('0x15')](_0x38f0b2)[_0xb459('0x16')]();};}function respondWithResult(_0x5c2e9b,_0x4f8817){_0x4f8817=_0x4f8817||0xc8;return function(_0x122905){if(_0x122905){return _0x5c2e9b[_0xb459('0x15')](_0x4f8817)[_0xb459('0x17')](_0x122905);}};}function respondWithFilteredResult(_0x55a7b1,_0x5f5703){return function(_0x21f244){if(_0x21f244){var _0x1ed29c=typeof _0x5f5703['offset']===_0xb459('0x18')&&typeof _0x5f5703['limit']===_0xb459('0x18');var _0x27d52d=_0x21f244[_0xb459('0x19')];var _0x566e81=_0x1ed29c?0x0:_0x5f5703[_0xb459('0x1a')];var _0x48c864=_0x1ed29c?_0x21f244[_0xb459('0x19')]:_0x5f5703['offset']+_0x5f5703['limit'];var _0x2adc37;if(_0x48c864>=_0x27d52d){_0x48c864=_0x27d52d;_0x2adc37=0xc8;}else{_0x2adc37=0xce;}_0x55a7b1['status'](_0x2adc37);return _0x55a7b1[_0xb459('0x1b')](_0xb459('0x1c'),_0x566e81+'-'+_0x48c864+'/'+_0x27d52d)[_0xb459('0x17')](_0x21f244);}return null;};}function patchUpdates(_0x2ac39a){return function(_0x4e1d34){try{jsonpatch[_0xb459('0x1d')](_0x4e1d34,_0x2ac39a,!![]);}catch(_0x508733){return BPromise[_0xb459('0x1e')](_0x508733);}return _0x4e1d34[_0xb459('0x1f')]();};}function saveUpdates(_0x287a73,_0x16fe9f){return function(_0xf3bbf4){if(_0xf3bbf4){return _0xf3bbf4[_0xb459('0x20')](_0x287a73)['then'](function(_0x2e7aa9){return _0x2e7aa9;});}return null;};}function removeEntity(_0x3e315b,_0x2cb260){return function(_0x262caa){if(_0x262caa){return _0x262caa[_0xb459('0x21')]()[_0xb459('0x22')](function(){_0x3e315b[_0xb459('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x417c53,_0x170402){return function(_0x10dd4c){if(!_0x10dd4c){_0x417c53[_0xb459('0x14')](0x194);}return _0x10dd4c;};}function handleError(_0x4398e8,_0x337807){_0x337807=_0x337807||0x1f4;return function(_0xe2d0b9){logger['error'](_0xe2d0b9[_0xb459('0x23')]);if(_0xe2d0b9[_0xb459('0x24')]){delete _0xe2d0b9[_0xb459('0x24')];}_0x4398e8[_0xb459('0x15')](_0x337807)['send'](_0xe2d0b9);};}exports[_0xb459('0x25')]=function(_0xcc70f4,_0x4cc651){var _0x168679={},_0x34a055={},_0x35091a={'count':0x0,'rows':[]};var _0x115cf5=_[_0xb459('0x26')](db['VoiceDialReport'][_0xb459('0x27')],function(_0x115e04){return{'name':_0x115e04['fieldName'],'type':_0x115e04[_0xb459('0x28')][_0xb459('0x29')]};});_0x34a055[_0xb459('0x2a')]=_['map'](_0x115cf5,'name');_0x34a055[_0xb459('0x2b')]=_[_0xb459('0x2c')](_0xcc70f4[_0xb459('0x2b')]);_0x34a055[_0xb459('0x2d')]=_[_0xb459('0x2e')](_0x34a055['model'],_0x34a055[_0xb459('0x2b')]);_0x168679[_0xb459('0x2f')]=_['intersection'](_0x34a055['model'],qs[_0xb459('0x30')](_0xcc70f4[_0xb459('0x2b')][_0xb459('0x30')]));_0x168679[_0xb459('0x2f')]=_0x168679['attributes']['length']?_0x168679[_0xb459('0x2f')]:_0x34a055[_0xb459('0x2a')];if(!_0xcc70f4[_0xb459('0x2b')][_0xb459('0x31')](_0xb459('0x32'))){_0x168679['limit']=qs[_0xb459('0x33')](_0xcc70f4[_0xb459('0x2b')][_0xb459('0x33')]);_0x168679[_0xb459('0x1a')]=qs['offset'](_0xcc70f4[_0xb459('0x2b')][_0xb459('0x1a')]);}_0x168679[_0xb459('0x34')]=qs[_0xb459('0x35')](_0xcc70f4[_0xb459('0x2b')][_0xb459('0x35')]);_0x168679[_0xb459('0x36')]=qs[_0xb459('0x2d')](_[_0xb459('0x37')](_0xcc70f4[_0xb459('0x2b')],_0x34a055['filters']),_0x115cf5);if(_0xcc70f4[_0xb459('0x2b')][_0xb459('0x38')]){_0x168679[_0xb459('0x36')]=_['merge'](_0x168679[_0xb459('0x36')],{'$or':_[_0xb459('0x26')](_0x115cf5,function(_0x5ce1dd){if(_0x5ce1dd[_0xb459('0x28')]!==_0xb459('0x39')){var _0x4bf618={};_0x4bf618[_0x5ce1dd[_0xb459('0x24')]]={'$like':'%'+_0xcc70f4[_0xb459('0x2b')][_0xb459('0x38')]+'%'};return _0x4bf618;}})});}_0x168679=_[_0xb459('0x3a')]({},_0x168679,_0xcc70f4[_0xb459('0x3b')]);var _0xac9099={'where':_0x168679[_0xb459('0x36')]};return db['VoiceDialReport'][_0xb459('0x19')](_0xac9099)['then'](function(_0x3a1b1a){_0x35091a[_0xb459('0x19')]=_0x3a1b1a;if(_0xcc70f4[_0xb459('0x2b')][_0xb459('0x3c')]){_0x168679[_0xb459('0x3d')]=[{'all':!![]}];}return db[_0xb459('0x3e')]['findAll'](_0x168679);})[_0xb459('0x22')](function(_0x34cfd2){_0x35091a[_0xb459('0x3f')]=_0x34cfd2;return _0x35091a;})[_0xb459('0x22')](respondWithFilteredResult(_0x4cc651,_0x168679))[_0xb459('0x40')](handleError(_0x4cc651,null));};exports['show']=function(_0x179608,_0x539cda){var _0x1ee40c={'raw':!![],'where':{'id':_0x179608[_0xb459('0x41')]['id']}},_0x197562={};_0x197562[_0xb459('0x2a')]=_[_0xb459('0x2c')](db[_0xb459('0x3e')]['rawAttributes']);_0x197562[_0xb459('0x2b')]=_[_0xb459('0x2c')](_0x179608['query']);_0x197562[_0xb459('0x2d')]=_[_0xb459('0x2e')](_0x197562[_0xb459('0x2a')],_0x197562[_0xb459('0x2b')]);_0x1ee40c['attributes']=_[_0xb459('0x2e')](_0x197562[_0xb459('0x2a')],qs['fields'](_0x179608['query'][_0xb459('0x30')]));_0x1ee40c[_0xb459('0x2f')]=_0x1ee40c[_0xb459('0x2f')]['length']?_0x1ee40c[_0xb459('0x2f')]:_0x197562['model'];if(_0x179608[_0xb459('0x2b')]['includeAll']){_0x1ee40c[_0xb459('0x3d')]=[{'all':!![]}];}_0x1ee40c=_[_0xb459('0x3a')]({},_0x1ee40c,_0x179608['options']);return db['VoiceDialReport']['find'](_0x1ee40c)['then'](handleEntityNotFound(_0x539cda,null))[_0xb459('0x22')](respondWithResult(_0x539cda,null))[_0xb459('0x40')](handleError(_0x539cda,null));};exports[_0xb459('0x42')]=function(_0x373673,_0x3149d2){return db['VoiceDialReport'][_0xb459('0x42')](_0x373673[_0xb459('0x43')],{})[_0xb459('0x22')](respondWithResult(_0x3149d2,0xc9))[_0xb459('0x40')](handleError(_0x3149d2,null));};exports['update']=function(_0x19daff,_0x100935){if(_0x19daff[_0xb459('0x43')]['id']){delete _0x19daff[_0xb459('0x43')]['id'];}return db[_0xb459('0x3e')][_0xb459('0x44')]({'where':{'id':_0x19daff[_0xb459('0x41')]['id']}})[_0xb459('0x22')](handleEntityNotFound(_0x100935,null))[_0xb459('0x22')](saveUpdates(_0x19daff[_0xb459('0x43')],null))[_0xb459('0x22')](respondWithResult(_0x100935,null))[_0xb459('0x40')](handleError(_0x100935,null));};exports[_0xb459('0x21')]=function(_0xa44c02,_0x14e726){return db[_0xb459('0x3e')][_0xb459('0x44')]({'where':{'id':_0xa44c02[_0xb459('0x41')]['id']}})[_0xb459('0x22')](handleEntityNotFound(_0x14e726,null))[_0xb459('0x22')](removeEntity(_0x14e726,null))[_0xb459('0x40')](handleError(_0x14e726,null));};exports[_0xb459('0x45')]=function(_0x15dce1,_0x3b2c4d){return db[_0xb459('0x3e')]['describe']()[_0xb459('0x22')](respondWithResult(_0x3b2c4d,null))[_0xb459('0x40')](handleError(_0x3b2c4d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0e92e7c..1197174 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 _0x44b4=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceDialReport','report_dial'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x44b4,0x143));var _0x444b=function(_0x450b0d,_0x5c7ec9){_0x450b0d=_0x450b0d-0x0;var _0x271152=_0x44b4[_0x450b0d];return _0x271152;};'use strict';var _=require(_0x444b('0x0'));var util=require(_0x444b('0x1'));var logger=require(_0x444b('0x2'))(_0x444b('0x3'));var moment=require(_0x444b('0x4'));var BPromise=require(_0x444b('0x5'));var rp=require(_0x444b('0x6'));var fs=require('fs');var path=require(_0x444b('0x7'));var rimraf=require(_0x444b('0x8'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x444b('0x9')]=function(_0x1bd97f,_0x1b064e){return _0x1bd97f[_0x444b('0xa')](_0x444b('0xb'),attributes,{'tableName':_0x444b('0xc'),'paranoid':![],'indexes':[{'fields':[_0x444b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ef2=['api','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger'];(function(_0x216f98,_0x470c7f){var _0xea6b36=function(_0x38f18c){while(--_0x38f18c){_0x216f98['push'](_0x216f98['shift']());}};_0xea6b36(++_0x470c7f);}(_0x0ef2,0x169));var _0x20ef=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x0ef2[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x20ef('0x0'));var util=require(_0x20ef('0x1'));var logger=require(_0x20ef('0x2'))(_0x20ef('0x3'));var moment=require('moment');var BPromise=require(_0x20ef('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20ef('0x5'));var rimraf=require(_0x20ef('0x6'));var config=require(_0x20ef('0x7'));var attributes=require(_0x20ef('0x8'));module[_0x20ef('0x9')]=function(_0x2d503e,_0xe139ab){return _0x2d503e[_0x20ef('0xa')](_0x20ef('0xb'),attributes,{'tableName':_0x20ef('0xc'),'paranoid':![],'indexes':[{'fields':[_0x20ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 94fb32a..32f2486 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 _0x9803=['then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateVoiceDialReport','create','body','raw','VoiceDialReport','update','options','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x57d762,_0x1fd2e7){var _0x19db87=function(_0x3c08b7){while(--_0x3c08b7){_0x57d762['push'](_0x57d762['shift']());}};_0x19db87(++_0x1fd2e7);}(_0x9803,0x76));var _0x3980=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9803[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x3980('0x0'));var util=require(_0x3980('0x1'));var moment=require('moment');var BPromise=require(_0x3980('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3980('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3980('0x4'));var config=require(_0x3980('0x5'));var jayson=require(_0x3980('0x6'));var client=jayson[_0x3980('0x7')][_0x3980('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x82f8ee,_0x24aa77,_0x2b299b){return new BPromise(function(_0x27eb07,_0x93e159){return client[_0x3980('0x9')](_0x82f8ee,_0x2b299b)[_0x3980('0xa')](function(_0x1d3518){logger[_0x3980('0xb')](_0x3980('0xc'),_0x24aa77,'request\x20sent');logger[_0x3980('0xd')](_0x3980('0xe'),_0x24aa77,'request\x20sent',JSON[_0x3980('0xf')](_0x1d3518));if(_0x1d3518['error']){if(_0x1d3518[_0x3980('0x10')][_0x3980('0x11')]===0x1f4){logger[_0x3980('0x10')](_0x3980('0xc'),_0x24aa77,_0x1d3518[_0x3980('0x10')][_0x3980('0x12')]);return _0x93e159(_0x1d3518[_0x3980('0x10')][_0x3980('0x12')]);}logger[_0x3980('0x10')](_0x3980('0xc'),_0x24aa77,_0x1d3518[_0x3980('0x10')][_0x3980('0x12')]);return _0x27eb07(_0x1d3518['error'][_0x3980('0x12')]);}else{logger[_0x3980('0xb')](_0x3980('0xc'),_0x24aa77,_0x3980('0x13'));_0x27eb07(_0x1d3518[_0x3980('0x14')][_0x3980('0x12')]);}})[_0x3980('0x15')](function(_0x121691){logger['error'](_0x3980('0xc'),_0x24aa77,_0x121691);_0x93e159(_0x121691);});});}exports[_0x3980('0x16')]=function(_0x3d755c){var _0x3f8f3b=this;return new Promise(function(_0xa0261b,_0x3ab5b6){return db['VoiceDialReport'][_0x3980('0x17')](_0x3d755c[_0x3980('0x18')],{'raw':_0x3d755c['options']?_0x3d755c['options'][_0x3980('0x19')]===undefined?!![]:![]:!![]})[_0x3980('0xa')](function(_0x721ae4){logger[_0x3980('0xb')](_0x3980('0x16'),_0x3d755c);logger['debug'](_0x3980('0x16'),_0x3d755c,JSON[_0x3980('0xf')](_0x721ae4));_0xa0261b(_0x721ae4);})[_0x3980('0x15')](function(_0x2bdf31){logger[_0x3980('0x10')](_0x3980('0x16'),_0x2bdf31[_0x3980('0x12')],_0x3d755c);_0x3ab5b6(_0x3f8f3b['error'](0x1f4,_0x2bdf31[_0x3980('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x5ba82d){var _0x2b541f=this;return new Promise(function(_0x11e579,_0x3b45df){return db[_0x3980('0x1a')][_0x3980('0x1b')](_0x5ba82d['body'],{'raw':_0x5ba82d[_0x3980('0x1c')]?_0x5ba82d[_0x3980('0x1c')][_0x3980('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ba82d[_0x3980('0x1c')]?_0x5ba82d[_0x3980('0x1c')]['where']||null:null,'attributes':_0x5ba82d[_0x3980('0x1c')]?_0x5ba82d['options'][_0x3980('0x1d')]||null:null,'limit':_0x5ba82d[_0x3980('0x1c')]?_0x5ba82d[_0x3980('0x1c')][_0x3980('0x1e')]||null:null})['then'](function(_0xd4a472){logger['info'](_0x3980('0x1f'),_0x5ba82d);logger['debug'](_0x3980('0x1f'),_0x5ba82d,JSON[_0x3980('0xf')](_0xd4a472));_0x11e579(_0xd4a472);})['catch'](function(_0x30c27e){logger[_0x3980('0x10')](_0x3980('0x1f'),_0x30c27e[_0x3980('0x12')],_0x5ba82d);_0x3b45df(_0x2b541f['error'](0x1f4,_0x30c27e[_0x3980('0x12')]));});});}; \ No newline at end of file +var _0xc234=['result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','stringify','UpdateVoiceDialReport','update','options','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceDialReport,\x20%s,\x20%s'];(function(_0x46a658,_0x5d68d7){var _0x55119f=function(_0x32583e){while(--_0x32583e){_0x46a658['push'](_0x46a658['shift']());}};_0x55119f(++_0x5d68d7);}(_0xc234,0x160));var _0x4c23=function(_0x3188c1,_0x41b3a7){_0x3188c1=_0x3188c1-0x0;var _0x3698f6=_0xc234[_0x3188c1];return _0x3698f6;};'use strict';var _=require(_0x4c23('0x0'));var util=require(_0x4c23('0x1'));var moment=require(_0x4c23('0x2'));var BPromise=require(_0x4c23('0x3'));var rs=require(_0x4c23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c23('0x5'))['db'];var utils=require(_0x4c23('0x6'));var logger=require(_0x4c23('0x7'))(_0x4c23('0x8'));var config=require(_0x4c23('0x9'));var jayson=require(_0x4c23('0xa'));var client=jayson[_0x4c23('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdc38ab,_0x1f255a,_0x22aac3){return new BPromise(function(_0x4947a3,_0x3d7329){return client[_0x4c23('0xc')](_0xdc38ab,_0x22aac3)[_0x4c23('0xd')](function(_0x5e7f0a){logger[_0x4c23('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x1f255a,_0x4c23('0xf'));logger[_0x4c23('0x10')](_0x4c23('0x11'),_0x1f255a,_0x4c23('0xf'),JSON['stringify'](_0x5e7f0a));if(_0x5e7f0a[_0x4c23('0x12')]){if(_0x5e7f0a[_0x4c23('0x12')][_0x4c23('0x13')]===0x1f4){logger[_0x4c23('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x1f255a,_0x5e7f0a['error'][_0x4c23('0x14')]);return _0x3d7329(_0x5e7f0a[_0x4c23('0x12')][_0x4c23('0x14')]);}logger[_0x4c23('0x12')](_0x4c23('0x15'),_0x1f255a,_0x5e7f0a[_0x4c23('0x12')][_0x4c23('0x14')]);return _0x4947a3(_0x5e7f0a[_0x4c23('0x12')][_0x4c23('0x14')]);}else{logger[_0x4c23('0xe')](_0x4c23('0x15'),_0x1f255a,'request\x20sent');_0x4947a3(_0x5e7f0a[_0x4c23('0x16')][_0x4c23('0x14')]);}})[_0x4c23('0x17')](function(_0x540ea0){logger[_0x4c23('0x12')](_0x4c23('0x15'),_0x1f255a,_0x540ea0);_0x3d7329(_0x540ea0);});});}exports[_0x4c23('0x18')]=function(_0x6b6bb2){var _0x580828=this;return new Promise(function(_0x490462,_0x238cb9){return db[_0x4c23('0x19')][_0x4c23('0x1a')](_0x6b6bb2[_0x4c23('0x1b')],{'raw':_0x6b6bb2['options']?_0x6b6bb2['options']['raw']===undefined?!![]:![]:!![]})[_0x4c23('0xd')](function(_0x3bd99c){logger['info'](_0x4c23('0x18'),_0x6b6bb2);logger[_0x4c23('0x10')](_0x4c23('0x18'),_0x6b6bb2,JSON[_0x4c23('0x1c')](_0x3bd99c));_0x490462(_0x3bd99c);})[_0x4c23('0x17')](function(_0xe214ea){logger[_0x4c23('0x12')](_0x4c23('0x18'),_0xe214ea[_0x4c23('0x14')],_0x6b6bb2);_0x238cb9(_0x580828[_0x4c23('0x12')](0x1f4,_0xe214ea[_0x4c23('0x14')]));});});};exports[_0x4c23('0x1d')]=function(_0x325da1){var _0x497a08=this;return new Promise(function(_0x4c7fbd,_0x419659){return db[_0x4c23('0x19')][_0x4c23('0x1e')](_0x325da1[_0x4c23('0x1b')],{'raw':_0x325da1[_0x4c23('0x1f')]?_0x325da1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x325da1[_0x4c23('0x1f')]?_0x325da1['options']['where']||null:null,'attributes':_0x325da1[_0x4c23('0x1f')]?_0x325da1[_0x4c23('0x1f')][_0x4c23('0x20')]||null:null,'limit':_0x325da1[_0x4c23('0x1f')]?_0x325da1['options'][_0x4c23('0x21')]||null:null})[_0x4c23('0xd')](function(_0x27a4b9){logger[_0x4c23('0xe')](_0x4c23('0x1d'),_0x325da1);logger[_0x4c23('0x10')](_0x4c23('0x1d'),_0x325da1,JSON[_0x4c23('0x1c')](_0x27a4b9));_0x4c7fbd(_0x27a4b9);})['catch'](function(_0x2a9328){logger[_0x4c23('0x12')](_0x4c23('0x1d'),_0x2a9328[_0x4c23('0x14')],_0x325da1);_0x419659(_0x497a08[_0x4c23('0x12')](0x1f4,_0x2a9328[_0x4c23('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index aa4c164..cccc614 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 _0x912f=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','show','post','/:id/applications','addApplications','/:id','delete'];(function(_0x578676,_0x2b17e3){var _0x37f730=function(_0x31a6e8){while(--_0x31a6e8){_0x578676['push'](_0x578676['shift']());}};_0x37f730(++_0x2b17e3);}(_0x912f,0x11f));var _0xf912=function(_0x512061,_0x497fac){_0x512061=_0x512061-0x0;var _0xd576b4=_0x912f[_0x512061];return _0xd576b4;};'use strict';var multer=require(_0xf912('0x0'));var util=require(_0xf912('0x1'));var path=require(_0xf912('0x2'));var timeout=require('connect-timeout');var express=require(_0xf912('0x3'));var router=express[_0xf912('0x4')]();var fs_extra=require(_0xf912('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf912('0x6'));var config=require(_0xf912('0x7'));var controller=require(_0xf912('0x8'));router[_0xf912('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf912('0x9')]('/:id',auth[_0xf912('0xa')](),controller[_0xf912('0xb')]);router[_0xf912('0xc')]('/',auth[_0xf912('0xa')](),controller['create']);router[_0xf912('0xc')](_0xf912('0xd'),auth[_0xf912('0xa')](),controller[_0xf912('0xe')]);router['put'](_0xf912('0xf'),auth[_0xf912('0xa')](),controller['update']);router[_0xf912('0x10')](_0xf912('0xf'),auth[_0xf912('0xa')](),controller[_0xf912('0x11')]);module[_0xf912('0x12')]=router; \ No newline at end of file +var _0x4fcd=['post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id'];(function(_0x50e5dc,_0x25126e){var _0x433e4c=function(_0x2ebea4){while(--_0x2ebea4){_0x50e5dc['push'](_0x50e5dc['shift']());}};_0x433e4c(++_0x25126e);}(_0x4fcd,0x11d));var _0xd4fc=function(_0x410edf,_0x1a49cd){_0x410edf=_0x410edf-0x0;var _0x423cb5=_0x4fcd[_0x410edf];return _0x423cb5;};'use strict';var multer=require(_0xd4fc('0x0'));var util=require(_0xd4fc('0x1'));var path=require(_0xd4fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xd4fc('0x3'));var router=express[_0xd4fc('0x4')]();var fs_extra=require(_0xd4fc('0x5'));var auth=require(_0xd4fc('0x6'));var interaction=require(_0xd4fc('0x7'));var config=require(_0xd4fc('0x8'));var controller=require(_0xd4fc('0x9'));router['get']('/',auth[_0xd4fc('0xa')](),controller[_0xd4fc('0xb')]);router[_0xd4fc('0xc')](_0xd4fc('0xd'),auth[_0xd4fc('0xa')](),controller['show']);router[_0xd4fc('0xe')]('/',auth[_0xd4fc('0xa')](),controller[_0xd4fc('0xf')]);router['post'](_0xd4fc('0x10'),auth[_0xd4fc('0xa')](),controller[_0xd4fc('0x11')]);router[_0xd4fc('0x12')]('/:id',auth[_0xd4fc('0xa')](),controller[_0xd4fc('0x13')]);router[_0xd4fc('0x14')](_0xd4fc('0xd'),auth[_0xd4fc('0xa')](),controller[_0xd4fc('0x15')]);module[_0xd4fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 09140eb..5c4ef35 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 _0x8ab3=['STRING','compositeIndex','NoOp','inbound','internal','inbound-fax','system','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','exten','sequelize'];(function(_0x1f3da9,_0x2919b9){var _0x2d33ee=function(_0x4c718c){while(--_0x4c718c){_0x1f3da9['push'](_0x1f3da9['shift']());}};_0x2d33ee(++_0x2919b9);}(_0x8ab3,0x10d));var _0x38ab=function(_0x28cbc5,_0x326e44){_0x28cbc5=_0x28cbc5-0x0;var _0x310541=_0x8ab3[_0x28cbc5];return _0x310541;};'use strict';var Sequelize=require(_0x38ab('0x0'));module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'unique':_0x38ab('0x2')},'priority':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'defaultValue':_0x38ab('0x3')},'appdata':{'type':Sequelize[_0x38ab('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x38ab('0x4'),'outbound',_0x38ab('0x5'),_0x38ab('0x6'),'outbound-fax',_0x38ab('0x7'),_0x38ab('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x38ab('0x1')]},'interval':{'type':Sequelize[_0x38ab('0x1')],'allowNull':![],'defaultValue':_0x38ab('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x38ab('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x38ab('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x38ab('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x38ab('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x38ab('0xb')]},'recordingFormat':{'type':Sequelize[_0x38ab('0x1')],'defaultValue':_0x38ab('0xc')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x38ab('0xd')],'get':function(_0x9b1a1f){return this['getDataValue'](_0x38ab('0xe'));}},'alias':{'type':Sequelize[_0x38ab('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x60f8=['*,*,*,*','BOOLEAN','INTEGER','wav','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','outbound','internal','inbound-fax','outbound-fax'];(function(_0x165189,_0x19a741){var _0x44826b=function(_0x25bf5a){while(--_0x25bf5a){_0x165189['push'](_0x165189['shift']());}};_0x44826b(++_0x19a741);}(_0x60f8,0x105));var _0x860f=function(_0x3c614c,_0x59b40b){_0x3c614c=_0x3c614c-0x0;var _0x5650d3=_0x60f8[_0x3c614c];return _0x5650d3;};'use strict';var Sequelize=require(_0x860f('0x0'));module[_0x860f('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x860f('0x2')],'allowNull':![],'unique':_0x860f('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x860f('0x3')},'tag':{'type':Sequelize[_0x860f('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x860f('0x2')],'allowNull':![],'defaultValue':_0x860f('0x4')},'appdata':{'type':Sequelize[_0x860f('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0x860f('0x5'),_0x860f('0x6'),_0x860f('0x7'),_0x860f('0x8'),'system','any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x860f('0x2')],'allowNull':![],'defaultValue':_0x860f('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x860f('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x860f('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x860f('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x860f('0xc')},'answer':{'type':Sequelize[_0x860f('0xa')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1b9512){return this[_0x860f('0xd')](_0x860f('0xe'));}},'alias':{'type':Sequelize[_0x860f('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 a7ed75c..d29030b 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 _0x7c4d=['redis','localhost','socket.io-emitter','./voiceExtension.socket','register','end','offset','undefined','limit','count','set','Content-Range','json','destroy','OutboundRoutes','InternalRoutes','filter','ignore','map','value','includes','type','find','UserProfileResource','then','sendStatus','error','name','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','findAll','rows','catch','show','fields','params','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','inbound','userProfileId','autoAssociation','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','status','send','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb'];(function(_0x1fc331,_0x2f7678){var _0x35ece7=function(_0xc22e51){while(--_0xc22e51){_0x1fc331['push'](_0x1fc331['shift']());}};_0x35ece7(++_0x2f7678);}(_0x7c4d,0x163));var _0xd7c4=function(_0xdd8bef,_0x589d1d){_0xdd8bef=_0xdd8bef-0x0;var _0x2b16d3=_0x7c4d[_0xdd8bef];return _0x2b16d3;};'use strict';var _=require('lodash');var Redis=require(_0xd7c4('0x0'));var qs=require(_0xd7c4('0x1'));var logger=require('../../config/logger')(_0xd7c4('0x2'));var config=require(_0xd7c4('0x3'));var db=require(_0xd7c4('0x4'))['db'];config[_0xd7c4('0x5')]=_['defaults'](config[_0xd7c4('0x5')],{'host':_0xd7c4('0x6'),'port':0x18eb});var socket=require(_0xd7c4('0x7'))(new Redis(config[_0xd7c4('0x5')]));require(_0xd7c4('0x8'))[_0xd7c4('0x9')](socket);function respondWithStatusCode(_0x467014,_0x2a5c8c){_0x2a5c8c=_0x2a5c8c||0xcc;return function(_0x2c44fe){if(_0x2c44fe){return _0x467014['sendStatus'](_0x2a5c8c);}return _0x467014['status'](_0x2a5c8c)[_0xd7c4('0xa')]();};}function respondWithResult(_0x30c5c3,_0x288345){_0x288345=_0x288345||0xc8;return function(_0x58cd7e){if(_0x58cd7e){return _0x30c5c3['status'](_0x288345)['json'](_0x58cd7e);}};}function respondWithFilteredResult(_0x58c4f1,_0xfa8340){return function(_0x124602){if(_0x124602){var _0x4f0383=typeof _0xfa8340[_0xd7c4('0xb')]===_0xd7c4('0xc')&&typeof _0xfa8340[_0xd7c4('0xd')]==='undefined';var _0x26d021=_0x124602['count'];var _0x13bae7=_0x4f0383?0x0:_0xfa8340[_0xd7c4('0xb')];var _0x44dcfc=_0x4f0383?_0x124602[_0xd7c4('0xe')]:_0xfa8340['offset']+_0xfa8340['limit'];var _0x2bbbaa;if(_0x44dcfc>=_0x26d021){_0x44dcfc=_0x26d021;_0x2bbbaa=0xc8;}else{_0x2bbbaa=0xce;}_0x58c4f1['status'](_0x2bbbaa);return _0x58c4f1[_0xd7c4('0xf')](_0xd7c4('0x10'),_0x13bae7+'-'+_0x44dcfc+'/'+_0x26d021)[_0xd7c4('0x11')](_0x124602);}return null;};}function removeEntity(_0xe0137a){return function(_0x201ef0){if(_0x201ef0){return _0x201ef0[_0xd7c4('0x12')]()['then'](function(){var _0x177879=_0x201ef0['get']({'plain':!![]});var _0x43fd54=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xd7c4('0x13'),'value':'outbound','ignore':![]},{'name':_0xd7c4('0x14'),'value':'internal','ignore':![]}];var _0xbc4e06=_(_0x43fd54)[_0xd7c4('0x15')](_0xd7c4('0x16'))[_0xd7c4('0x17')](_0xd7c4('0x18'))[_0xd7c4('0x18')]();if(_[_0xd7c4('0x19')](_0xbc4e06,_0x177879[_0xd7c4('0x1a')])){return;}var _0x45811a=_[_0xd7c4('0x1b')](_0x43fd54,[_0xd7c4('0x18'),_0x177879[_0xd7c4('0x1a')]])['name'];return db[_0xd7c4('0x1c')]['destroy']({'where':{'type':_0x45811a,'resourceId':_0x177879['id']}})[_0xd7c4('0x1d')](function(){return _0x201ef0;});})[_0xd7c4('0x1d')](function(){_0xe0137a['status'](0xcc)[_0xd7c4('0xa')]();});}};}function handleEntityNotFound(_0x470ac9){return function(_0x361d3c){if(!_0x361d3c){_0x470ac9[_0xd7c4('0x1e')](0x194);}return _0x361d3c;};}function handleError(_0x4ca8cb,_0x4d27db){_0x4d27db=_0x4d27db||0x1f4;return function(_0x1f8829){logger[_0xd7c4('0x1f')](_0x1f8829['stack']);if(_0x1f8829[_0xd7c4('0x20')]){delete _0x1f8829[_0xd7c4('0x20')];}_0x4ca8cb['status'](_0x4d27db)['send'](_0x1f8829);};}exports[_0xd7c4('0x21')]=function(_0x248bcb,_0x19332e){var _0x524b5d={},_0xb1265a={},_0x65306b={'count':0x0,'rows':[]};var _0x45441d=_[_0xd7c4('0x17')](db['VoiceExtension'][_0xd7c4('0x22')],function(_0x28d400){return{'name':_0x28d400[_0xd7c4('0x23')],'type':_0x28d400[_0xd7c4('0x1a')][_0xd7c4('0x24')]};});_0xb1265a[_0xd7c4('0x25')]=_[_0xd7c4('0x17')](_0x45441d,_0xd7c4('0x20'));_0xb1265a[_0xd7c4('0x26')]=_[_0xd7c4('0x27')](_0x248bcb[_0xd7c4('0x26')]);_0xb1265a[_0xd7c4('0x28')]=_[_0xd7c4('0x29')](_0xb1265a['model'],_0xb1265a['query']);_0x524b5d[_0xd7c4('0x2a')]=_[_0xd7c4('0x29')](_0xb1265a[_0xd7c4('0x25')],qs['fields'](_0x248bcb[_0xd7c4('0x26')]['fields']));_0x524b5d[_0xd7c4('0x2a')]=_0x524b5d[_0xd7c4('0x2a')][_0xd7c4('0x2b')]?_0x524b5d[_0xd7c4('0x2a')]:_0xb1265a['model'];if(!_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0x2c')]('nolimit')){_0x524b5d[_0xd7c4('0xd')]=qs[_0xd7c4('0xd')](_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0xd')]);_0x524b5d[_0xd7c4('0xb')]=qs['offset'](_0x248bcb['query'][_0xd7c4('0xb')]);}_0x524b5d['order']=qs[_0xd7c4('0x2d')](_0x248bcb['query'][_0xd7c4('0x2d')]);_0x524b5d[_0xd7c4('0x2e')]=qs[_0xd7c4('0x28')](_[_0xd7c4('0x2f')](_0x248bcb[_0xd7c4('0x26')],_0xb1265a['filters']),_0x45441d);if(_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0x15')]){_0x524b5d[_0xd7c4('0x2e')]=_[_0xd7c4('0x30')](_0x524b5d[_0xd7c4('0x2e')],{'$or':_[_0xd7c4('0x17')](_0x45441d,function(_0xc5c3d7){if(_0xc5c3d7[_0xd7c4('0x1a')]!==_0xd7c4('0x31')){var _0x53e4f0={};_0x53e4f0[_0xc5c3d7[_0xd7c4('0x20')]]={'$like':'%'+_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0x15')]+'%'};return _0x53e4f0;}})});}_0x524b5d=_['merge']({},_0x524b5d,_0x248bcb[_0xd7c4('0x32')]);var _0x3cbfda={'where':_0x524b5d[_0xd7c4('0x2e')]};return db[_0xd7c4('0x33')][_0xd7c4('0xe')](_0x3cbfda)['then'](function(_0x1a6bf2){_0x65306b['count']=_0x1a6bf2;if(_0x248bcb[_0xd7c4('0x26')][_0xd7c4('0x34')]){_0x524b5d['include']=[{'all':!![]}];}return db[_0xd7c4('0x33')][_0xd7c4('0x35')](_0x524b5d);})[_0xd7c4('0x1d')](function(_0x410df4){_0x65306b[_0xd7c4('0x36')]=_0x410df4;return _0x65306b;})[_0xd7c4('0x1d')](respondWithFilteredResult(_0x19332e,_0x524b5d))[_0xd7c4('0x37')](handleError(_0x19332e,null));};exports[_0xd7c4('0x38')]=function(_0x1c34b1,_0x4e6c65){var _0x52c1c6={'raw':![],'where':{'id':_0x1c34b1['params']['id']}},_0x461aac={};_0x461aac[_0xd7c4('0x25')]=_[_0xd7c4('0x27')](db[_0xd7c4('0x33')][_0xd7c4('0x22')]);_0x461aac['query']=_[_0xd7c4('0x27')](_0x1c34b1[_0xd7c4('0x26')]);_0x461aac[_0xd7c4('0x28')]=_[_0xd7c4('0x29')](_0x461aac[_0xd7c4('0x25')],_0x461aac[_0xd7c4('0x26')]);_0x52c1c6['attributes']=_[_0xd7c4('0x29')](_0x461aac[_0xd7c4('0x25')],qs[_0xd7c4('0x39')](_0x1c34b1['query'][_0xd7c4('0x39')]));_0x52c1c6[_0xd7c4('0x2a')]=_0x52c1c6[_0xd7c4('0x2a')][_0xd7c4('0x2b')]?_0x52c1c6[_0xd7c4('0x2a')]:_0x461aac[_0xd7c4('0x25')];if(_0x1c34b1[_0xd7c4('0x26')][_0xd7c4('0x34')]){_0x52c1c6['include']=[{'all':!![]}];}_0x52c1c6=_['merge']({},_0x52c1c6,_0x1c34b1[_0xd7c4('0x32')]);return db[_0xd7c4('0x33')][_0xd7c4('0x1b')](_0x52c1c6)[_0xd7c4('0x1d')](handleEntityNotFound(_0x4e6c65,null))[_0xd7c4('0x1d')](respondWithResult(_0x4e6c65,null))[_0xd7c4('0x37')](handleError(_0x4e6c65,null));};exports[_0xd7c4('0x12')]=function(_0x5b9324,_0x5b252a){return db[_0xd7c4('0x33')][_0xd7c4('0x1b')]({'where':{'id':_0x5b9324[_0xd7c4('0x3a')]['id']}})[_0xd7c4('0x1d')](handleEntityNotFound(_0x5b252a,null))[_0xd7c4('0x1d')](removeEntity(_0x5b252a,null))['catch'](handleError(_0x5b252a,null));};exports[_0xd7c4('0x3b')]=function(_0x4ad8e8,_0xaf5d36){if(_0x4ad8e8['body'][_0xd7c4('0x1a')]==='outbound'&&!_['startsWith'](_0x4ad8e8[_0xd7c4('0x3c')][_0xd7c4('0x3d')],'_')){_0x4ad8e8['body'][_0xd7c4('0x3d')]='_'[_0xd7c4('0x3e')](_0x4ad8e8[_0xd7c4('0x3c')][_0xd7c4('0x3d')]);}return db[_0xd7c4('0x33')][_0xd7c4('0x3b')](_0x4ad8e8['body'],{'raw':![]})[_0xd7c4('0x1d')](function(_0x1ef952){var _0x3329e3=_0x4ad8e8[_0xd7c4('0x3f')][_0xd7c4('0x40')]({'plain':!![]});if(!_0x3329e3)throw new Error(_0xd7c4('0x41'));if(_0x3329e3[_0xd7c4('0x42')]===_0xd7c4('0x3f')){var _0x3a5474=_0x1ef952[_0xd7c4('0x40')]({'plain':!![]});var _0x493f1f=[{'name':_0xd7c4('0x43'),'value':_0xd7c4('0x44')},{'name':_0xd7c4('0x13'),'value':'outbound'},{'name':_0xd7c4('0x14'),'value':'internal'}];var _0x4da647=_['find'](_0x493f1f,[_0xd7c4('0x18'),_0x3a5474[_0xd7c4('0x1a')]])[_0xd7c4('0x20')];return db['UserProfileSection']['find']({'where':{'name':_0x4da647,'userProfileId':_0x3329e3[_0xd7c4('0x45')]},'raw':!![]})['then'](function(_0x3e9412){if(_0x3e9412&&_0x3e9412[_0xd7c4('0x46')]===0x0){return db['UserProfileResource'][_0xd7c4('0x3b')]({'name':_0x3a5474['name'],'resourceId':_0x3a5474['id'],'type':_0x3e9412['name'],'sectionId':_0x3e9412['id']},{})['then'](function(){return _0x1ef952;});}else{return _0x1ef952;}})[_0xd7c4('0x37')](function(_0xef7983){logger[_0xd7c4('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xef7983);throw _0xef7983;});}return _0x1ef952;})['then'](respondWithResult(_0xaf5d36,0xc9))[_0xd7c4('0x37')](handleError(_0xaf5d36,null));};exports[_0xd7c4('0x47')]=function(_0x4bfe60,_0x5f0fad){if(_0x4bfe60[_0xd7c4('0x3c')]['id']){delete _0x4bfe60[_0xd7c4('0x3c')]['id'];}return db[_0xd7c4('0x33')][_0xd7c4('0x1b')]({'where':{'id':_0x4bfe60[_0xd7c4('0x3a')]['id']}})[_0xd7c4('0x1d')](handleEntityNotFound(_0x5f0fad,null))['then'](function(_0x1c38b3){if(_0x1c38b3){return db[_0xd7c4('0x33')]['update'](_['pick'](_0x4bfe60[_0xd7c4('0x3c')],['exten',_0xd7c4('0x48'),'description',_0xd7c4('0x49'),_0xd7c4('0x4a'),_0xd7c4('0x4b'),_0xd7c4('0x4c')]),{'where':{'context':_0x1c38b3[_0xd7c4('0x48')],'exten':_0x1c38b3['exten']},'individualHooks':!![]})['then'](function(_0x2a97bf){return _0x2a97bf;});}return null;})[_0xd7c4('0x1d')](respondWithStatusCode(_0x5f0fad,null))[_0xd7c4('0x37')](handleError(_0x5f0fad,null));};exports[_0xd7c4('0x4d')]=function(_0x23ca0f,_0x3d693c){var _0x440d43=_0x23ca0f[_0xd7c4('0x3a')]['id'];var _0x337a7e=_0x23ca0f[_0xd7c4('0x3c')];var _0x33af6f=0xc8;var _0x526981=null;return db[_0xd7c4('0x4e')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xd7c4('0x4f')]['READ_COMMITTED']},function(_0x4cda03){return db[_0xd7c4('0x33')][_0xd7c4('0x50')]({'where':{'id':_0x440d43},'transaction':_0x4cda03})[_0xd7c4('0x1d')](function(_0x3604bf){if(_0x3604bf){return db[_0xd7c4('0x33')]['destroy']({'where':{'VoiceExtensionId':_0x440d43},'transaction':_0x4cda03})[_0xd7c4('0x1d')](function(){var _0x54eaf7=_[_0xd7c4('0x17')](_0x337a7e,function(_0xfa40e2){_0xfa40e2[_0xd7c4('0x51')]=_0x440d43;_0xfa40e2[_0xd7c4('0x52')]=!![];return _0xfa40e2;});return _0x3604bf[_0xd7c4('0x53')](_0x54eaf7);})[_0xd7c4('0x1d')](function(_0x1c8f70){return db[_0xd7c4('0x33')][_0xd7c4('0x54')](_0x1c8f70,{'transaction':_0x4cda03});});}else{_0x33af6f=0x194;_0x526981=[];}});})[_0xd7c4('0x1d')](function(){if(_0x33af6f!==0x194){return db[_0xd7c4('0x33')][_0xd7c4('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x440d43},'order':_0xd7c4('0x56')})[_0xd7c4('0x1d')](function(_0x53f286){_0x526981=_0x53f286;});}})[_0xd7c4('0x37')](function(_0x3bd237){_0x33af6f=0x1f4;logger[_0xd7c4('0x1f')](_0x3bd237['stack']);if(_0x3bd237[_0xd7c4('0x20')]){delete _0x3bd237[_0xd7c4('0x20')];}_0x526981=_0x3bd237;})[_0xd7c4('0x57')](function(){if(_0x526981===null){_0x3d693c[_0xd7c4('0x1e')](_0x33af6f);}else{if(_0x33af6f===0x1f4){_0x3d693c[_0xd7c4('0x58')](_0x33af6f)[_0xd7c4('0x59')](_0x526981);}else{_0x3d693c['status'](_0x33af6f)[_0xd7c4('0x11')](_0x526981);}}});}; \ No newline at end of file +var _0xd176=['params','VoiceExtension','options','create','body','outbound','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','alias','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','InboundRoutes','inbound','InternalRoutes','internal','ignore','map','value','includes','type','find','name','destroy','error','stack','send','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show'];(function(_0x399cff,_0x1de414){var _0x57e011=function(_0x43ea4a){while(--_0x43ea4a){_0x399cff['push'](_0x399cff['shift']());}};_0x57e011(++_0x1de414);}(_0xd176,0x130));var _0x6d17=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xd176[_0x367a3d];return _0x460539;};'use strict';var _=require(_0x6d17('0x0'));var Redis=require(_0x6d17('0x1'));var qs=require(_0x6d17('0x2'));var logger=require(_0x6d17('0x3'))('api');var config=require(_0x6d17('0x4'));var db=require(_0x6d17('0x5'))['db'];config[_0x6d17('0x6')]=_[_0x6d17('0x7')](config['redis'],{'host':_0x6d17('0x8'),'port':0x18eb});var socket=require(_0x6d17('0x9'))(new Redis(config[_0x6d17('0x6')]));require(_0x6d17('0xa'))['register'](socket);function respondWithStatusCode(_0x25afd9,_0x520955){_0x520955=_0x520955||0xcc;return function(_0x1b355b){if(_0x1b355b){return _0x25afd9[_0x6d17('0xb')](_0x520955);}return _0x25afd9[_0x6d17('0xc')](_0x520955)[_0x6d17('0xd')]();};}function respondWithResult(_0x9b1d7,_0x1e3b04){_0x1e3b04=_0x1e3b04||0xc8;return function(_0x484f20){if(_0x484f20){return _0x9b1d7[_0x6d17('0xc')](_0x1e3b04)[_0x6d17('0xe')](_0x484f20);}};}function respondWithFilteredResult(_0x464725,_0x30d76c){return function(_0x4a426a){if(_0x4a426a){var _0x3c9291=typeof _0x30d76c[_0x6d17('0xf')]===_0x6d17('0x10')&&typeof _0x30d76c[_0x6d17('0x11')]==='undefined';var _0x2bf143=_0x4a426a['count'];var _0x3b43bd=_0x3c9291?0x0:_0x30d76c['offset'];var _0x3725c8=_0x3c9291?_0x4a426a[_0x6d17('0x12')]:_0x30d76c[_0x6d17('0xf')]+_0x30d76c[_0x6d17('0x11')];var _0x21e4ed;if(_0x3725c8>=_0x2bf143){_0x3725c8=_0x2bf143;_0x21e4ed=0xc8;}else{_0x21e4ed=0xce;}_0x464725[_0x6d17('0xc')](_0x21e4ed);return _0x464725[_0x6d17('0x13')](_0x6d17('0x14'),_0x3b43bd+'-'+_0x3725c8+'/'+_0x2bf143)[_0x6d17('0xe')](_0x4a426a);}return null;};}function removeEntity(_0x5eaee1){return function(_0x25aac2){if(_0x25aac2){return _0x25aac2['destroy']()[_0x6d17('0x15')](function(){var _0xc4e8b5=_0x25aac2['get']({'plain':!![]});var _0x693959=[{'name':_0x6d17('0x16'),'value':_0x6d17('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0x6d17('0x18'),'value':_0x6d17('0x19'),'ignore':![]}];var _0x19e1c0=_(_0x693959)['filter'](_0x6d17('0x1a'))[_0x6d17('0x1b')](_0x6d17('0x1c'))[_0x6d17('0x1c')]();if(_[_0x6d17('0x1d')](_0x19e1c0,_0xc4e8b5[_0x6d17('0x1e')])){return;}var _0x3ee6f2=_[_0x6d17('0x1f')](_0x693959,[_0x6d17('0x1c'),_0xc4e8b5[_0x6d17('0x1e')]])[_0x6d17('0x20')];return db['UserProfileResource'][_0x6d17('0x21')]({'where':{'type':_0x3ee6f2,'resourceId':_0xc4e8b5['id']}})[_0x6d17('0x15')](function(){return _0x25aac2;});})[_0x6d17('0x15')](function(){_0x5eaee1['status'](0xcc)[_0x6d17('0xd')]();});}};}function handleEntityNotFound(_0x654724){return function(_0x366936){if(!_0x366936){_0x654724[_0x6d17('0xb')](0x194);}return _0x366936;};}function handleError(_0x1c3a51,_0x5be0cb){_0x5be0cb=_0x5be0cb||0x1f4;return function(_0x46d412){logger[_0x6d17('0x22')](_0x46d412[_0x6d17('0x23')]);if(_0x46d412[_0x6d17('0x20')]){delete _0x46d412[_0x6d17('0x20')];}_0x1c3a51[_0x6d17('0xc')](_0x5be0cb)[_0x6d17('0x24')](_0x46d412);};}exports['index']=function(_0x1aaefb,_0x4bd226){var _0x21c4bd={},_0x158c57={},_0x504cea={'count':0x0,'rows':[]};var _0x149553=_['map'](db['VoiceExtension'][_0x6d17('0x25')],function(_0x49c80c){return{'name':_0x49c80c[_0x6d17('0x26')],'type':_0x49c80c[_0x6d17('0x1e')][_0x6d17('0x27')]};});_0x158c57[_0x6d17('0x28')]=_['map'](_0x149553,_0x6d17('0x20'));_0x158c57[_0x6d17('0x29')]=_[_0x6d17('0x2a')](_0x1aaefb['query']);_0x158c57[_0x6d17('0x2b')]=_[_0x6d17('0x2c')](_0x158c57[_0x6d17('0x28')],_0x158c57[_0x6d17('0x29')]);_0x21c4bd['attributes']=_[_0x6d17('0x2c')](_0x158c57[_0x6d17('0x28')],qs[_0x6d17('0x2d')](_0x1aaefb[_0x6d17('0x29')][_0x6d17('0x2d')]));_0x21c4bd['attributes']=_0x21c4bd[_0x6d17('0x2e')][_0x6d17('0x2f')]?_0x21c4bd['attributes']:_0x158c57['model'];if(!_0x1aaefb[_0x6d17('0x29')][_0x6d17('0x30')](_0x6d17('0x31'))){_0x21c4bd[_0x6d17('0x11')]=qs[_0x6d17('0x11')](_0x1aaefb[_0x6d17('0x29')]['limit']);_0x21c4bd['offset']=qs[_0x6d17('0xf')](_0x1aaefb[_0x6d17('0x29')][_0x6d17('0xf')]);}_0x21c4bd[_0x6d17('0x32')]=qs['sort'](_0x1aaefb[_0x6d17('0x29')]['sort']);_0x21c4bd['where']=qs[_0x6d17('0x2b')](_['pick'](_0x1aaefb[_0x6d17('0x29')],_0x158c57[_0x6d17('0x2b')]),_0x149553);if(_0x1aaefb['query'][_0x6d17('0x33')]){_0x21c4bd['where']=_[_0x6d17('0x34')](_0x21c4bd['where'],{'$or':_['map'](_0x149553,function(_0x221366){if(_0x221366['type']!==_0x6d17('0x35')){var _0x3b4726={};_0x3b4726[_0x221366['name']]={'$like':'%'+_0x1aaefb[_0x6d17('0x29')][_0x6d17('0x33')]+'%'};return _0x3b4726;}})});}_0x21c4bd=_[_0x6d17('0x34')]({},_0x21c4bd,_0x1aaefb['options']);var _0x55d30e={'where':_0x21c4bd['where']};return db['VoiceExtension'][_0x6d17('0x12')](_0x55d30e)[_0x6d17('0x15')](function(_0x592612){_0x504cea['count']=_0x592612;if(_0x1aaefb[_0x6d17('0x29')][_0x6d17('0x36')]){_0x21c4bd[_0x6d17('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0x6d17('0x38')](_0x21c4bd);})[_0x6d17('0x15')](function(_0x8beb72){_0x504cea[_0x6d17('0x39')]=_0x8beb72;return _0x504cea;})[_0x6d17('0x15')](respondWithFilteredResult(_0x4bd226,_0x21c4bd))[_0x6d17('0x3a')](handleError(_0x4bd226,null));};exports[_0x6d17('0x3b')]=function(_0x2ae834,_0x3a174a){var _0x12c093={'raw':![],'where':{'id':_0x2ae834[_0x6d17('0x3c')]['id']}},_0x310892={};_0x310892['model']=_['keys'](db[_0x6d17('0x3d')]['rawAttributes']);_0x310892[_0x6d17('0x29')]=_['keys'](_0x2ae834[_0x6d17('0x29')]);_0x310892[_0x6d17('0x2b')]=_[_0x6d17('0x2c')](_0x310892[_0x6d17('0x28')],_0x310892[_0x6d17('0x29')]);_0x12c093['attributes']=_[_0x6d17('0x2c')](_0x310892[_0x6d17('0x28')],qs['fields'](_0x2ae834[_0x6d17('0x29')][_0x6d17('0x2d')]));_0x12c093['attributes']=_0x12c093[_0x6d17('0x2e')][_0x6d17('0x2f')]?_0x12c093[_0x6d17('0x2e')]:_0x310892[_0x6d17('0x28')];if(_0x2ae834['query'][_0x6d17('0x36')]){_0x12c093[_0x6d17('0x37')]=[{'all':!![]}];}_0x12c093=_['merge']({},_0x12c093,_0x2ae834[_0x6d17('0x3e')]);return db['VoiceExtension'][_0x6d17('0x1f')](_0x12c093)[_0x6d17('0x15')](handleEntityNotFound(_0x3a174a,null))['then'](respondWithResult(_0x3a174a,null))['catch'](handleError(_0x3a174a,null));};exports['destroy']=function(_0x28b20c,_0x3d5ad1){return db['VoiceExtension'][_0x6d17('0x1f')]({'where':{'id':_0x28b20c['params']['id']}})['then'](handleEntityNotFound(_0x3d5ad1,null))[_0x6d17('0x15')](removeEntity(_0x3d5ad1,null))[_0x6d17('0x3a')](handleError(_0x3d5ad1,null));};exports[_0x6d17('0x3f')]=function(_0x29e3ea,_0x217168){if(_0x29e3ea[_0x6d17('0x40')]['type']===_0x6d17('0x41')&&!_[_0x6d17('0x42')](_0x29e3ea[_0x6d17('0x40')][_0x6d17('0x43')],'_')){_0x29e3ea[_0x6d17('0x40')][_0x6d17('0x43')]='_'[_0x6d17('0x44')](_0x29e3ea[_0x6d17('0x40')][_0x6d17('0x43')]);}return db[_0x6d17('0x3d')][_0x6d17('0x3f')](_0x29e3ea[_0x6d17('0x40')],{'raw':![]})['then'](function(_0x549900){var _0x567a1b=_0x29e3ea[_0x6d17('0x45')][_0x6d17('0x46')]({'plain':!![]});if(!_0x567a1b)throw new Error(_0x6d17('0x47'));if(_0x567a1b['role']===_0x6d17('0x45')){var _0x11abe8=_0x549900['get']({'plain':!![]});var _0x5b82aa=[{'name':_0x6d17('0x16'),'value':'inbound'},{'name':_0x6d17('0x48'),'value':_0x6d17('0x41')},{'name':_0x6d17('0x18'),'value':_0x6d17('0x19')}];var _0xc242e8=_['find'](_0x5b82aa,[_0x6d17('0x1c'),_0x11abe8[_0x6d17('0x1e')]])[_0x6d17('0x20')];return db['UserProfileSection'][_0x6d17('0x1f')]({'where':{'name':_0xc242e8,'userProfileId':_0x567a1b[_0x6d17('0x49')]},'raw':!![]})[_0x6d17('0x15')](function(_0x279886){if(_0x279886&&_0x279886['autoAssociation']===0x0){return db['UserProfileResource'][_0x6d17('0x3f')]({'name':_0x11abe8['name'],'resourceId':_0x11abe8['id'],'type':_0x279886[_0x6d17('0x20')],'sectionId':_0x279886['id']},{})[_0x6d17('0x15')](function(){return _0x549900;});}else{return _0x549900;}})[_0x6d17('0x3a')](function(_0x567f2b){logger[_0x6d17('0x22')](_0x6d17('0x4a'),_0x567f2b);throw _0x567f2b;});}return _0x549900;})['then'](respondWithResult(_0x217168,0xc9))[_0x6d17('0x3a')](handleError(_0x217168,null));};exports['update']=function(_0x1a38da,_0xd782f7){if(_0x1a38da['body']['id']){delete _0x1a38da[_0x6d17('0x40')]['id'];}return db[_0x6d17('0x3d')][_0x6d17('0x1f')]({'where':{'id':_0x1a38da[_0x6d17('0x3c')]['id']}})['then'](handleEntityNotFound(_0xd782f7,null))[_0x6d17('0x15')](function(_0x582655){if(_0x582655){return db[_0x6d17('0x3d')]['update'](_['pick'](_0x1a38da[_0x6d17('0x40')],[_0x6d17('0x43'),'context',_0x6d17('0x4b'),_0x6d17('0x4c'),_0x6d17('0x4d'),'mandatoryDisposition',_0x6d17('0x4e')]),{'where':{'context':_0x582655[_0x6d17('0x4f')],'exten':_0x582655[_0x6d17('0x43')]},'individualHooks':!![]})[_0x6d17('0x15')](function(_0x43b5cb){return _0x43b5cb;});}return null;})['then'](respondWithStatusCode(_0xd782f7,null))[_0x6d17('0x3a')](handleError(_0xd782f7,null));};exports['addApplications']=function(_0x1b2b82,_0x1f9cec){var _0x17bee1=_0x1b2b82['params']['id'];var _0x184c5e=_0x1b2b82['body'];var _0x116473=0xc8;var _0x2c5b68=null;return db[_0x6d17('0x50')][_0x6d17('0x51')]({'isolationLevel':db['sequelize'][_0x6d17('0x52')][_0x6d17('0x53')][_0x6d17('0x54')]},function(_0xc78fe8){return db[_0x6d17('0x3d')][_0x6d17('0x55')]({'where':{'id':_0x17bee1},'transaction':_0xc78fe8})[_0x6d17('0x15')](function(_0x547734){if(_0x547734){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x17bee1},'transaction':_0xc78fe8})[_0x6d17('0x15')](function(){var _0x1c3703=_['map'](_0x184c5e,function(_0x448248){_0x448248['VoiceExtensionId']=_0x17bee1;_0x448248[_0x6d17('0x56')]=!![];return _0x448248;});return _0x547734['createRouting'](_0x1c3703);})[_0x6d17('0x15')](function(_0x577986){return db[_0x6d17('0x3d')][_0x6d17('0x57')](_0x577986,{'transaction':_0xc78fe8});});}else{_0x116473=0x194;_0x2c5b68=[];}});})['then'](function(){if(_0x116473!==0x194){return db[_0x6d17('0x3d')][_0x6d17('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x17bee1},'order':_0x6d17('0x59')})[_0x6d17('0x15')](function(_0x19fa2e){_0x2c5b68=_0x19fa2e;});}})[_0x6d17('0x3a')](function(_0x1655e6){_0x116473=0x1f4;logger[_0x6d17('0x22')](_0x1655e6[_0x6d17('0x23')]);if(_0x1655e6[_0x6d17('0x20')]){delete _0x1655e6['name'];}_0x2c5b68=_0x1655e6;})[_0x6d17('0x5a')](function(){if(_0x2c5b68===null){_0x1f9cec[_0x6d17('0xb')](_0x116473);}else{if(_0x116473===0x1f4){_0x1f9cec['status'](_0x116473)[_0x6d17('0x24')](_0x2c5b68);}else{_0x1f9cec['status'](_0x116473)[_0x6d17('0xe')](_0x2c5b68);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index aa006a1..0363072 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 _0xe39f=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x13020f,_0x190737){var _0x1151df=function(_0xf4b55e){while(--_0xf4b55e){_0x13020f['push'](_0x13020f['shift']());}};_0x1151df(++_0x190737);}(_0xe39f,0xb1));var _0xfe39=function(_0x41c44d,_0x31d1eb){_0x41c44d=_0x41c44d-0x0;var _0x5e00f5=_0xe39f[_0x41c44d];return _0x5e00f5;};'use strict';var EventEmitter=require(_0xfe39('0x0'));var VoiceExtension=require(_0xfe39('0x1'))['db'][_0xfe39('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xfe39('0x3')](0x0);var events={'afterCreate':_0xfe39('0x4'),'afterUpdate':_0xfe39('0x5'),'afterDestroy':_0xfe39('0x6')};function emitEvent(_0x22a160){return function(_0x34d58b,_0x4c3daf,_0xbed21){VoiceExtensionEvents[_0xfe39('0x7')](_0x22a160+':'+_0x34d58b['id'],_0x34d58b);VoiceExtensionEvents['emit'](_0x22a160,_0x34d58b);_0xbed21(null);};}for(var e in events){if(events[_0xfe39('0x8')](e)){var event=events[e];VoiceExtension[_0xfe39('0x9')](e,emitEvent(event));}}module[_0xfe39('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0xc643=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x2cee5e,_0x62bcf5){var _0x394970=function(_0x16852e){while(--_0x16852e){_0x2cee5e['push'](_0x2cee5e['shift']());}};_0x394970(++_0x62bcf5);}(_0xc643,0x1e0));var _0x3c64=function(_0x447b88,_0x34917a){_0x447b88=_0x447b88-0x0;var _0x270b0b=_0xc643[_0x447b88];return _0x270b0b;};'use strict';var EventEmitter=require(_0x3c64('0x0'));var VoiceExtension=require(_0x3c64('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x3c64('0x2')](0x0);var events={'afterCreate':_0x3c64('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x40455f){return function(_0x2c3894,_0x2f91e7,_0x4d9560){VoiceExtensionEvents[_0x3c64('0x4')](_0x40455f+':'+_0x2c3894['id'],_0x2c3894);VoiceExtensionEvents[_0x3c64('0x4')](_0x40455f,_0x2c3894);_0x4d9560(null);};}for(var e in events){if(events[_0x3c64('0x5')](e)){var event=events[e];VoiceExtension[_0x3c64('0x6')](e,emitEvent(event));}}module[_0x3c64('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 2148855..9505602 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 _0xe9e7=['appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','CDR(type)=','context','Set','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','url','split','param','phone','prefix','${EXTEN:','SIP','options','none','indexOf','U(xcally-mixmonitor-context)','replace','join','interval','IntervalId','then','length','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial'];(function(_0x3ffa2a,_0x2aeefe){var _0x5e3246=function(_0xa4b6db){while(--_0xa4b6db){_0x3ffa2a['push'](_0x3ffa2a['shift']());}};_0x5e3246(++_0x2aeefe);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x55e9d0,_0x3c2653){_0x55e9d0=_0x55e9d0-0x0;var _0x18eeff=_0xe9e7[_0x55e9d0];return _0x18eeff;};'use strict';var _=require(_0x7e9e('0x0'));var attributes=require(_0x7e9e('0x1'));module[_0x7e9e('0x2')]=function(_0x4d5fa1){var _0x1fd5fc=_0x4d5fa1[_0x7e9e('0x3')];function _0x108c11(_0x132bd3){var _0x410b21=0x2;var _0x18bf13=[{'type':_0x132bd3[_0x7e9e('0x4')],'app':'Set','appdata':_0x7e9e('0x5')+_0x132bd3[_0x7e9e('0x4')],'context':_0x132bd3[_0x7e9e('0x6')],'exten':_0x132bd3['exten'],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']},{'type':_0x132bd3[_0x7e9e('0x4')],'app':_0x132bd3['alias']?_0x7e9e('0x7'):_0x7e9e('0x8'),'appdata':_0x132bd3[_0x7e9e('0x9')]?_0x7e9e('0xa')+_0x132bd3[_0x7e9e('0x9')]:_0x7e9e('0xb'),'context':_0x132bd3[_0x7e9e('0x6')],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']}];if(_0x132bd3[_0x7e9e('0x4')]===_0x7e9e('0xd')){_0x18bf13[_0x7e9e('0xe')]({'type':_0x7e9e('0xd'),'app':'Set','appdata':'CDR(routeid)='+_0x132bd3['id'],'context':_0x132bd3['context'],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']});}_0x18bf13[_0x7e9e('0xe')]({'type':_0x132bd3[_0x7e9e('0x4')],'app':_0x7e9e('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x132bd3['context'],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']},{'type':_0x132bd3[_0x7e9e('0x4')],'app':_0x7e9e('0x7'),'appdata':_0x7e9e('0xf'),'context':_0x132bd3[_0x7e9e('0x6')],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']},{'type':_0x132bd3[_0x7e9e('0x4')],'app':'Set','appdata':_0x7e9e('0x10'),'context':_0x132bd3['context'],'exten':_0x132bd3[_0x7e9e('0xc')],'priority':_0x410b21++,'VoiceExtensionId':_0x132bd3['id']});return _0x18bf13;}function _0xfc5f48(_0x45e55c){var _0x1d973c=0x2;var _0x35af37=[{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':'CDR(type)=outbound','context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':'outbound','app':_0x45e55c['alias']?_0x7e9e('0x7'):'NoOp','appdata':_0x45e55c['alias']?_0x7e9e('0xa')+_0x45e55c[_0x7e9e('0x9')]:_0x7e9e('0xb'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':_0x7e9e('0x12')+(_0x45e55c[_0x7e9e('0x13')]?'${EXTEN:'+_0x45e55c[_0x7e9e('0x13')]+'}':_0x7e9e('0x14')),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':'outbound','app':_0x7e9e('0x7'),'appdata':_0x7e9e('0x15')+_0x45e55c['id'],'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x16'),'appdata':_0x7e9e('0x17')+(_0x1d973c+0x2)+'):Goto('+(_0x1d973c+0x1)+')','context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':_0x45e55c['cutdigits']?_0x7e9e('0x18')+_0x45e55c[_0x7e9e('0x13')]+'}':_0x7e9e('0x19'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c['exten'],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':'Set','appdata':_0x7e9e('0x1a'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':_0x7e9e('0xf'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':'outbound','app':'Set','appdata':_0x7e9e('0x10'),'context':_0x45e55c['context'],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':'Set','appdata':'outboundrouteid='+_0x45e55c['id'],'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c[_0x7e9e('0xc')],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']}];if(_0x45e55c['hasOwnProperty']('recordingFormat')&&_0x45e55c[_0x7e9e('0x1b')]!=='none'){_0x35af37[_0x7e9e('0xe')]({'type':_0x7e9e('0x11'),'app':'Set','appdata':_0x7e9e('0x1c'),'context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c['exten'],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']},{'type':_0x7e9e('0x11'),'app':_0x7e9e('0x7'),'appdata':_0x7e9e('0x1d')+_0x45e55c[_0x7e9e('0x1b')]||'wav','context':_0x45e55c[_0x7e9e('0x6')],'exten':_0x45e55c['exten'],'priority':_0x1d973c++,'VoiceExtensionId':_0x45e55c['id']});}return _0x35af37;}function _0xa26e82(_0xd37409,_0x2c7881){var _0x244ae9=[{'name':_0x7e9e('0x1e'),'param':0x0},{'name':_0x7e9e('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':_0x7e9e('0x20'),'param':0x3}];var _0x5878e3={};var _0x26317c=_0x2c7881[_0x7e9e('0x21')](',');var _0x19fb3b=[];for(var _0x5e8aa7=0x0;_0x5e8aa7<_0x244ae9['length'];_0x5e8aa7++){switch(_0x244ae9[_0x5e8aa7]['name']){case _0x7e9e('0x1e'):_0x5878e3[_0x7e9e('0x1e')]=_0x26317c[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]][_0x7e9e('0x21')]('/')[0x1];_0x5878e3['phone']=_0x26317c[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]]['split']('/')[0x2];_0x5878e3['prefix']=_0x5878e3[_0x7e9e('0x23')]?_0x5878e3[_0x7e9e('0x23')][_0x7e9e('0x21')]('$')[0x0]:undefined;_0x5878e3['phone']=_0xd37409[_0x7e9e('0x13')]?(_0x5878e3[_0x7e9e('0x24')]||'')+_0x7e9e('0x25')+_0xd37409['cutdigits']+'}':(_0x5878e3[_0x7e9e('0x24')]||'')+_0x7e9e('0x14');_0x19fb3b[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]]=[_0x7e9e('0x26'),_0x5878e3[_0x7e9e('0x1e')],_0x5878e3['phone']]['join']('/');break;case _0x7e9e('0x27'):_0x5878e3[_0x7e9e('0x27')]=_0x26317c[_0x244ae9[_0x5e8aa7]['param']];if(_0xd37409[_0x7e9e('0x1b')]!==_0x7e9e('0x28')){if(_0x5878e3[_0x7e9e('0x27')][_0x7e9e('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x5878e3[_0x7e9e('0x27')]+=_0x7e9e('0x2a');}}else{_0x5878e3['options']=_0x5878e3[_0x7e9e('0x27')][_0x7e9e('0x2b')](_0x7e9e('0x2a'),'');}_0x19fb3b[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]]=_0x5878e3['options'];break;default:_0x19fb3b[_0x244ae9[_0x5e8aa7]['param']]=_0x26317c[_0x244ae9[_0x5e8aa7][_0x7e9e('0x22')]];}}return _0x19fb3b[_0x7e9e('0x2c')](',');}function _0x29edfb(_0xd7c825,_0x54a160,_0x68bb1f){return new Promise(function(_0x10bdab,_0x123e6f){var _0x120bbc=[];if(_['isEmpty'](_0x54a160))return _0x10bdab(_0x120bbc);_0x1fd5fc['Interval']['findAll']({'attributes':['id',_0x7e9e('0x2d'),_0x7e9e('0x2e')],'raw':!![]})[_0x7e9e('0x2f')](function(_0x46cf93){for(var _0x2c3fce=0x0,_0x2d70ed=0x0;_0x2c3fce<_0x54a160[_0x7e9e('0x30')];_0x2c3fce++,_0x2d70ed=0x0){var _0x4dbf2a=_0x54a160[_0x2c3fce];var _0xf57087=[];var _0x181d33=[];delete _0x4dbf2a['id'];if(_0x4dbf2a[_0x7e9e('0x2d')]!=='*,*,*,*'){_0x4dbf2a['intervals']=[_0x4dbf2a[_0x7e9e('0x2d')]];}else{_0x4dbf2a[_0x7e9e('0x31')]=_0x4dbf2a[_0x7e9e('0x2e')]?_[_0x7e9e('0x32')](_[_0x7e9e('0x33')](_0x46cf93,{'IntervalId':_0x4dbf2a[_0x7e9e('0x2e')]}),_0x7e9e('0x2d')):[];}_0x4dbf2a[_0x7e9e('0x6')]=_0xd7c825[_0x7e9e('0x6')];_0x4dbf2a[_0x7e9e('0xc')]=_0xd7c825[_0x7e9e('0xc')];if(_0x4dbf2a[_0x7e9e('0x4')])_0x4dbf2a[_0x7e9e('0x4')]=_0x4dbf2a['type'][_0x7e9e('0x34')]();if(_0xd7c825[_0x7e9e('0x4')]===_0x7e9e('0x11')){if(_0x4dbf2a[_0x7e9e('0x35')](_0x7e9e('0x36'))&&_0x4dbf2a[_0x7e9e('0x36')]&&_0x4dbf2a[_0x7e9e('0x36')]!=='--'){_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')][_0x7e9e('0x34')](),'app':'Set','appdata':_0x7e9e('0x37')+_0x4dbf2a[_0x7e9e('0x36')],'context':_0xd7c825['context'],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a[_0x7e9e('0x31')][_0x7e9e('0x30')]+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});}_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')][_0x7e9e('0x34')](),'app':_0x7e9e('0x16'),'appdata':_0x7e9e('0x38')+(_0x4dbf2a[_0x7e9e('0x39')]?_0x7e9e('0x3a')+_0x4dbf2a[_0x7e9e('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0xd7c825[_0x7e9e('0x6')],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a[_0x7e9e('0x31')]['length']+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});}else{if(_0x4dbf2a[_0x7e9e('0x35')](_0x7e9e('0x3b'))){if([_0x7e9e('0x3c'),_0x7e9e('0x3d')][_0x7e9e('0x3e')](_0x4dbf2a[_0x7e9e('0x3f')][_0x7e9e('0x34')]())&&_0x4dbf2a[_0x7e9e('0x40')]!==_0x7e9e('0x41')){if(_0x4dbf2a[_0x7e9e('0x3b')]){_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')]['toLowerCase'](),'app':_0x7e9e('0x16'),'appdata':_0x7e9e('0x42'),'context':_0xd7c825[_0x7e9e('0x6')],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a[_0x7e9e('0x31')][_0x7e9e('0x30')]+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a['type'][_0x7e9e('0x34')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0xd7c825[_0x7e9e('0x6')],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a['intervals'][_0x7e9e('0x30')]+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});}else{_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')][_0x7e9e('0x34')](),'app':_0x7e9e('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xd7c825['context'],'exten':_0xd7c825['exten'],'priority':_0x4dbf2a[_0x7e9e('0x31')][_0x7e9e('0x30')]+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});_0xf57087[_0x7e9e('0xe')]({'type':_0x4dbf2a[_0x7e9e('0x4')][_0x7e9e('0x34')](),'app':'Set','appdata':_0x7e9e('0x43'),'context':_0xd7c825[_0x7e9e('0x6')],'exten':_0xd7c825[_0x7e9e('0xc')],'priority':_0x4dbf2a[_0x7e9e('0x31')]['length']+_0x68bb1f+_0x2d70ed++,'VoiceExtensionId':_0xd7c825['id']});}}}}for(var _0x5d41f6=0x0;_0x5d41f6<_0x4dbf2a['intervals'][_0x7e9e('0x30')];_0x5d41f6++){var _0x3c5be4=_0x68bb1f+_0x4dbf2a[_0x7e9e('0x31')]['length'];var _0x2a43e6=_0x5d41f6===_0x4dbf2a['intervals'][_0x7e9e('0x30')]-0x1?_0x68bb1f+_0xf57087[_0x7e9e('0x30')]+_0x181d33[_0x7e9e('0x30')]+0x2:_0x68bb1f+_0x5d41f6+0x1;_0xf57087[_0x7e9e('0x44')](_0x5d41f6,0x0,{'type':_0xd7c825[_0x7e9e('0x4')],'app':'GotoIfTime','appdata':_0x4dbf2a['intervals'][_0x5d41f6]+'?'+_0xd7c825[_0x7e9e('0x6')]+_0x7e9e('0x45')+_0x3c5be4+':'+_0xd7c825[_0x7e9e('0x6')]+_0x7e9e('0x45')+_0x2a43e6,'exten':_0xd7c825['exten'],'context':_0xd7c825['context'],'priority':_0x68bb1f+_0x5d41f6,'VoiceExtensionId':_0xd7c825['id']});}if(_0x4dbf2a[_0x7e9e('0x40')]===_0x7e9e('0x46'))_0x4dbf2a[_0x7e9e('0x47')]=_0xa26e82(_0xd7c825,_0x4dbf2a[_0x7e9e('0x47')]);_0x4dbf2a[_0x7e9e('0x48')]=_0xf57087[_0x7e9e('0x30')]?_[_0x7e9e('0x49')](_0xf57087)[_0x7e9e('0x48')]+0x1:_0x68bb1f;_0x120bbc=_[_0x7e9e('0x4a')](_0x120bbc,_0xf57087,[_0x4dbf2a],_0x181d33);_0x68bb1f=_[_0x7e9e('0x49')](_0x120bbc)[_0x7e9e('0x48')]+0x1;}return _0x10bdab(_0x120bbc);})[_0x7e9e('0x4b')](function(_0x1efdc5){_0x123e6f(_0x1efdc5);});});}return _0x4d5fa1[_0x7e9e('0x4c')](_0x7e9e('0x4d'),attributes,{'tableName':_0x7e9e('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4b94b9){var _0x720db6=this[_0x7e9e('0x4f')]({'plain':!![]});var _0x59d5b5=_0x720db6[_0x7e9e('0x4')]===_0x7e9e('0x11')?_0xfc5f48(_0x720db6):_0x108c11(_0x720db6);return _0x29edfb(_0x720db6,_0x4b94b9,_[_0x7e9e('0x49')](_0x59d5b5)['priority']+0x1)['then'](function(_0xbde5d3){var _0x41eb4f=_[_0x7e9e('0x4a')](_0x59d5b5,_0xbde5d3);_0x41eb4f[_0x7e9e('0xe')]({'type':_0x720db6[_0x7e9e('0x4')],'app':_0x7e9e('0x50'),'exten':_0x720db6[_0x7e9e('0xc')],'context':_0x720db6[_0x7e9e('0x6')],'priority':_[_0x7e9e('0x49')](_0x41eb4f)['priority']+0x1,'VoiceExtensionId':_0x720db6['id']});return _0x41eb4f;});}}});}; \ No newline at end of file +var _0x9206=['toLowerCase','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','hasOwnProperty','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','CDR(type)=','context','exten','type','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','indexOf','replace','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter'];(function(_0x558cf5,_0x3caae2){var _0x45f531=function(_0x260d74){while(--_0x260d74){_0x558cf5['push'](_0x558cf5['shift']());}};_0x45f531(++_0x3caae2);}(_0x9206,0x176));var _0x6920=function(_0xc75a45,_0x394769){_0xc75a45=_0xc75a45-0x0;var _0x3f6fe0=_0x9206[_0xc75a45];return _0x3f6fe0;};'use strict';var _=require(_0x6920('0x0'));var attributes=require(_0x6920('0x1'));module[_0x6920('0x2')]=function(_0xc3b83c){var _0x18c93a=_0xc3b83c[_0x6920('0x3')];function _0x4bc24b(_0x5774fa){var _0x1770ce=0x2;var _0x3c84f7=[{'type':_0x5774fa['type'],'app':'Set','appdata':_0x6920('0x4')+_0x5774fa['type'],'context':_0x5774fa[_0x6920('0x5')],'exten':_0x5774fa[_0x6920('0x6')],'priority':_0x1770ce++,'VoiceExtensionId':_0x5774fa['id']},{'type':_0x5774fa[_0x6920('0x7')],'app':_0x5774fa[_0x6920('0x8')]?'Set':'NoOp','appdata':_0x5774fa[_0x6920('0x8')]?_0x6920('0x9')+_0x5774fa[_0x6920('0x8')]:_0x6920('0xa'),'context':_0x5774fa[_0x6920('0x5')],'exten':_0x5774fa[_0x6920('0x6')],'priority':_0x1770ce++,'VoiceExtensionId':_0x5774fa['id']}];if(_0x5774fa[_0x6920('0x7')]===_0x6920('0xb')){_0x3c84f7[_0x6920('0xc')]({'type':_0x6920('0xb'),'app':_0x6920('0xd'),'appdata':_0x6920('0xe')+_0x5774fa['id'],'context':_0x5774fa[_0x6920('0x5')],'exten':_0x5774fa['exten'],'priority':_0x1770ce++,'VoiceExtensionId':_0x5774fa['id']});}_0x3c84f7['push']({'type':_0x5774fa[_0x6920('0x7')],'app':_0x6920('0xd'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5774fa[_0x6920('0x5')],'exten':_0x5774fa[_0x6920('0x6')],'priority':_0x1770ce++,'VoiceExtensionId':_0x5774fa['id']},{'type':_0x5774fa[_0x6920('0x7')],'app':_0x6920('0xd'),'appdata':_0x6920('0xf'),'context':_0x5774fa['context'],'exten':_0x5774fa[_0x6920('0x6')],'priority':_0x1770ce++,'VoiceExtensionId':_0x5774fa['id']},{'type':_0x5774fa[_0x6920('0x7')],'app':_0x6920('0xd'),'appdata':_0x6920('0x10'),'context':_0x5774fa[_0x6920('0x5')],'exten':_0x5774fa[_0x6920('0x6')],'priority':_0x1770ce++,'VoiceExtensionId':_0x5774fa['id']});return _0x3c84f7;}function _0x3452a4(_0x17a166){var _0x11ce91=0x2;var _0x2d04e7=[{'type':_0x6920('0x11'),'app':_0x6920('0xd'),'appdata':_0x6920('0x12'),'context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':'outbound','app':_0x17a166[_0x6920('0x8')]?_0x6920('0xd'):_0x6920('0x13'),'appdata':_0x17a166[_0x6920('0x8')]?_0x6920('0x9')+_0x17a166[_0x6920('0x8')]:_0x6920('0xa'),'context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':_0x6920('0x11'),'app':_0x6920('0xd'),'appdata':_0x6920('0x14')+(_0x17a166[_0x6920('0x15')]?_0x6920('0x16')+_0x17a166[_0x6920('0x15')]+'}':_0x6920('0x17')),'context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':_0x6920('0x11'),'app':_0x6920('0xd'),'appdata':'CDR(routeid)='+_0x17a166['id'],'context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166['exten'],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':_0x6920('0x11'),'app':'ExecIf','appdata':_0x6920('0x18')+(_0x11ce91+0x2)+_0x6920('0x19')+(_0x11ce91+0x1)+')','context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':'outbound','app':_0x6920('0xd'),'appdata':_0x17a166[_0x6920('0x15')]?_0x6920('0x1a')+_0x17a166[_0x6920('0x15')]+'}':_0x6920('0x1b'),'context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':_0x6920('0x11'),'app':_0x6920('0xd'),'appdata':_0x6920('0x1c'),'context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':'outbound','app':_0x6920('0xd'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166['exten'],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':_0x6920('0x11'),'app':_0x6920('0xd'),'appdata':'MONITOR_OPTIONS=ab','context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':_0x6920('0x11'),'app':'Set','appdata':'outboundrouteid='+_0x17a166['id'],'context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166['exten'],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']}];if(_0x17a166['hasOwnProperty'](_0x6920('0x1d'))&&_0x17a166[_0x6920('0x1d')]!==_0x6920('0x1e')){_0x2d04e7[_0x6920('0xc')]({'type':_0x6920('0x11'),'app':_0x6920('0xd'),'appdata':_0x6920('0x1f'),'context':_0x17a166['context'],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']},{'type':'outbound','app':_0x6920('0xd'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x17a166['recordingFormat']||_0x6920('0x20'),'context':_0x17a166[_0x6920('0x5')],'exten':_0x17a166[_0x6920('0x6')],'priority':_0x11ce91++,'VoiceExtensionId':_0x17a166['id']});}return _0x2d04e7;}function _0xcfe1bf(_0x54af8a,_0x506b5){var _0x25e0d4=[{'name':_0x6920('0x21'),'param':0x0},{'name':_0x6920('0x22'),'param':0x1},{'name':_0x6920('0x23'),'param':0x2},{'name':_0x6920('0x24'),'param':0x3}];var _0x33fa02={};var _0x55fa9f=_0x506b5[_0x6920('0x25')](',');var _0x4c56be=[];for(var _0x107106=0x0;_0x107106<_0x25e0d4[_0x6920('0x26')];_0x107106++){switch(_0x25e0d4[_0x107106][_0x6920('0x27')]){case'trunk':_0x33fa02[_0x6920('0x21')]=_0x55fa9f[_0x25e0d4[_0x107106][_0x6920('0x28')]][_0x6920('0x25')]('/')[0x1];_0x33fa02[_0x6920('0x29')]=_0x55fa9f[_0x25e0d4[_0x107106]['param']][_0x6920('0x25')]('/')[0x2];_0x33fa02[_0x6920('0x2a')]=_0x33fa02['phone']?_0x33fa02['phone'][_0x6920('0x25')]('$')[0x0]:undefined;_0x33fa02[_0x6920('0x29')]=_0x54af8a['cutdigits']?(_0x33fa02[_0x6920('0x2a')]||'')+_0x6920('0x16')+_0x54af8a['cutdigits']+'}':(_0x33fa02['prefix']||'')+_0x6920('0x17');_0x4c56be[_0x25e0d4[_0x107106][_0x6920('0x28')]]=[_0x6920('0x2b'),_0x33fa02[_0x6920('0x21')],_0x33fa02[_0x6920('0x29')]]['join']('/');break;case'options':_0x33fa02['options']=_0x55fa9f[_0x25e0d4[_0x107106][_0x6920('0x28')]];if(_0x54af8a['recordingFormat']!=='none'){if(_0x33fa02[_0x6920('0x23')][_0x6920('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x33fa02[_0x6920('0x23')]+='U(xcally-mixmonitor-context)';}}else{_0x33fa02[_0x6920('0x23')]=_0x33fa02[_0x6920('0x23')][_0x6920('0x2d')](_0x6920('0x2e'),'');}_0x4c56be[_0x25e0d4[_0x107106][_0x6920('0x28')]]=_0x33fa02['options'];break;default:_0x4c56be[_0x25e0d4[_0x107106]['param']]=_0x55fa9f[_0x25e0d4[_0x107106][_0x6920('0x28')]];}}return _0x4c56be['join'](',');}function _0x4e789c(_0x5a973f,_0x520cd1,_0xffefb9){return new Promise(function(_0x3c2a8e,_0x3ac662){var _0x483c3f=[];if(_[_0x6920('0x2f')](_0x520cd1))return _0x3c2a8e(_0x483c3f);_0x18c93a[_0x6920('0x30')][_0x6920('0x31')]({'attributes':['id',_0x6920('0x32'),_0x6920('0x33')],'raw':!![]})[_0x6920('0x34')](function(_0x4b487c){for(var _0x2ff770=0x0,_0x3fa7b6=0x0;_0x2ff770<_0x520cd1[_0x6920('0x26')];_0x2ff770++,_0x3fa7b6=0x0){var _0x1d2d44=_0x520cd1[_0x2ff770];var _0xab9d6c=[];var _0x1c13cd=[];delete _0x1d2d44['id'];if(_0x1d2d44[_0x6920('0x32')]!==_0x6920('0x35')){_0x1d2d44[_0x6920('0x36')]=[_0x1d2d44[_0x6920('0x32')]];}else{_0x1d2d44[_0x6920('0x36')]=_0x1d2d44[_0x6920('0x33')]?_['map'](_[_0x6920('0x37')](_0x4b487c,{'IntervalId':_0x1d2d44[_0x6920('0x33')]}),'interval'):[];}_0x1d2d44['context']=_0x5a973f[_0x6920('0x5')];_0x1d2d44[_0x6920('0x6')]=_0x5a973f[_0x6920('0x6')];if(_0x1d2d44[_0x6920('0x7')])_0x1d2d44[_0x6920('0x7')]=_0x1d2d44['type'][_0x6920('0x38')]();if(_0x5a973f[_0x6920('0x7')]===_0x6920('0x11')){if(_0x1d2d44['hasOwnProperty']('tag')&&_0x1d2d44[_0x6920('0x39')]&&_0x1d2d44[_0x6920('0x39')]!=='--'){_0xab9d6c[_0x6920('0xc')]({'type':_0x1d2d44[_0x6920('0x7')]['toLowerCase'](),'app':_0x6920('0xd'),'appdata':_0x6920('0x3a')+_0x1d2d44[_0x6920('0x39')],'context':_0x5a973f[_0x6920('0x5')],'exten':_0x5a973f[_0x6920('0x6')],'priority':_0x1d2d44['intervals'][_0x6920('0x26')]+_0xffefb9+_0x3fa7b6++,'VoiceExtensionId':_0x5a973f['id']});}_0xab9d6c[_0x6920('0xc')]({'type':_0x1d2d44[_0x6920('0x7')][_0x6920('0x38')](),'app':_0x6920('0x3b'),'appdata':_0x6920('0x3c')+(_0x1d2d44[_0x6920('0x3d')]?_0x6920('0x3e')+_0x1d2d44[_0x6920('0x3d')]+')':_0x6920('0x3f')),'context':_0x5a973f['context'],'exten':_0x5a973f[_0x6920('0x6')],'priority':_0x1d2d44[_0x6920('0x36')][_0x6920('0x26')]+_0xffefb9+_0x3fa7b6++,'VoiceExtensionId':_0x5a973f['id']});}else{if(_0x1d2d44[_0x6920('0x40')](_0x6920('0x41'))){if([_0x6920('0x42'),_0x6920('0x43')]['includes'](_0x1d2d44[_0x6920('0x44')][_0x6920('0x38')]())&&_0x1d2d44[_0x6920('0x45')]!==_0x6920('0x46')){if(_0x1d2d44['answer']){_0xab9d6c['push']({'type':_0x1d2d44['type'][_0x6920('0x38')](),'app':_0x6920('0x3b'),'appdata':_0x6920('0x47'),'context':_0x5a973f['context'],'exten':_0x5a973f[_0x6920('0x6')],'priority':_0x1d2d44[_0x6920('0x36')][_0x6920('0x26')]+_0xffefb9+_0x3fa7b6++,'VoiceExtensionId':_0x5a973f['id']});_0xab9d6c[_0x6920('0xc')]({'type':_0x1d2d44[_0x6920('0x7')][_0x6920('0x38')](),'app':_0x6920('0xd'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5a973f[_0x6920('0x5')],'exten':_0x5a973f[_0x6920('0x6')],'priority':_0x1d2d44['intervals'][_0x6920('0x26')]+_0xffefb9+_0x3fa7b6++,'VoiceExtensionId':_0x5a973f['id']});}else{_0xab9d6c[_0x6920('0xc')]({'type':_0x1d2d44[_0x6920('0x7')][_0x6920('0x38')](),'app':_0x6920('0x3b'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5a973f[_0x6920('0x5')],'exten':_0x5a973f[_0x6920('0x6')],'priority':_0x1d2d44['intervals'][_0x6920('0x26')]+_0xffefb9+_0x3fa7b6++,'VoiceExtensionId':_0x5a973f['id']});_0xab9d6c[_0x6920('0xc')]({'type':_0x1d2d44['type']['toLowerCase'](),'app':_0x6920('0xd'),'appdata':_0x6920('0x48'),'context':_0x5a973f['context'],'exten':_0x5a973f[_0x6920('0x6')],'priority':_0x1d2d44[_0x6920('0x36')][_0x6920('0x26')]+_0xffefb9+_0x3fa7b6++,'VoiceExtensionId':_0x5a973f['id']});}}}}for(var _0x196205=0x0;_0x196205<_0x1d2d44[_0x6920('0x36')][_0x6920('0x26')];_0x196205++){var _0x2bd8c9=_0xffefb9+_0x1d2d44['intervals'][_0x6920('0x26')];var _0x3b6121=_0x196205===_0x1d2d44[_0x6920('0x36')][_0x6920('0x26')]-0x1?_0xffefb9+_0xab9d6c[_0x6920('0x26')]+_0x1c13cd[_0x6920('0x26')]+0x2:_0xffefb9+_0x196205+0x1;_0xab9d6c[_0x6920('0x49')](_0x196205,0x0,{'type':_0x5a973f[_0x6920('0x7')],'app':_0x6920('0x4a'),'appdata':_0x1d2d44['intervals'][_0x196205]+'?'+_0x5a973f[_0x6920('0x5')]+_0x6920('0x4b')+_0x2bd8c9+':'+_0x5a973f[_0x6920('0x5')]+_0x6920('0x4b')+_0x3b6121,'exten':_0x5a973f['exten'],'context':_0x5a973f[_0x6920('0x5')],'priority':_0xffefb9+_0x196205,'VoiceExtensionId':_0x5a973f['id']});}if(_0x1d2d44[_0x6920('0x45')]===_0x6920('0x4c'))_0x1d2d44[_0x6920('0x4d')]=_0xcfe1bf(_0x5a973f,_0x1d2d44[_0x6920('0x4d')]);_0x1d2d44[_0x6920('0x4e')]=_0xab9d6c['length']?_[_0x6920('0x4f')](_0xab9d6c)[_0x6920('0x4e')]+0x1:_0xffefb9;_0x483c3f=_['concat'](_0x483c3f,_0xab9d6c,[_0x1d2d44],_0x1c13cd);_0xffefb9=_[_0x6920('0x4f')](_0x483c3f)[_0x6920('0x4e')]+0x1;}return _0x3c2a8e(_0x483c3f);})[_0x6920('0x50')](function(_0x3e34ab){_0x3ac662(_0x3e34ab);});});}return _0xc3b83c[_0x6920('0x51')](_0x6920('0x52'),attributes,{'tableName':_0x6920('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x433905){var _0x28f0bf=this[_0x6920('0x54')]({'plain':!![]});var _0xabcfa5=_0x28f0bf[_0x6920('0x7')]===_0x6920('0x11')?_0x3452a4(_0x28f0bf):_0x4bc24b(_0x28f0bf);return _0x4e789c(_0x28f0bf,_0x433905,_[_0x6920('0x4f')](_0xabcfa5)['priority']+0x1)[_0x6920('0x34')](function(_0xc3288b){var _0x36e588=_['concat'](_0xabcfa5,_0xc3288b);_0x36e588[_0x6920('0xc')]({'type':_0x28f0bf[_0x6920('0x7')],'app':_0x6920('0x55'),'exten':_0x28f0bf[_0x6920('0x6')],'context':_0x28f0bf[_0x6920('0x5')],'priority':_['last'](_0x36e588)[_0x6920('0x4e')]+0x1,'VoiceExtensionId':_0x28f0bf['id']});return _0x36e588;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 5878718..726cdba 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 _0x7958=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','model','include','map','lodash','util'];(function(_0x5ad24f,_0x42432){var _0x4cd608=function(_0x486d91){while(--_0x486d91){_0x5ad24f['push'](_0x5ad24f['shift']());}};_0x4cd608(++_0x42432);}(_0x7958,0x126));var _0x8795=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7958[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var moment=require('moment');var BPromise=require(_0x8795('0x2'));var rs=require(_0x8795('0x3'));var fs=require('fs');var Redis=require(_0x8795('0x4'));var db=require(_0x8795('0x5'))['db'];var utils=require(_0x8795('0x6'));var logger=require(_0x8795('0x7'))(_0x8795('0x8'));var config=require(_0x8795('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8795('0xa')][_0x8795('0xb')]({'port':0x232a});config[_0x8795('0xc')]=_['defaults'](config[_0x8795('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8795('0xd'))(new Redis(config[_0x8795('0xc')]));require(_0x8795('0xe'))[_0x8795('0xf')](socket);function respondWithRpcPromise(_0x1bcd9c,_0x2191fb,_0x191cb0){return new BPromise(function(_0x441669,_0x416a3a){return client[_0x8795('0x10')](_0x1bcd9c,_0x191cb0)[_0x8795('0x11')](function(_0x2118ff){logger[_0x8795('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x2191fb,_0x8795('0x13'));logger[_0x8795('0x14')](_0x8795('0x15'),_0x2191fb,_0x8795('0x13'),JSON[_0x8795('0x16')](_0x2118ff));if(_0x2118ff[_0x8795('0x17')]){if(_0x2118ff[_0x8795('0x17')]['code']===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2191fb,_0x2118ff[_0x8795('0x17')][_0x8795('0x18')]);return _0x416a3a(_0x2118ff[_0x8795('0x17')][_0x8795('0x18')]);}logger[_0x8795('0x17')](_0x8795('0x19'),_0x2191fb,_0x2118ff[_0x8795('0x17')]['message']);return _0x441669(_0x2118ff[_0x8795('0x17')]['message']);}else{logger[_0x8795('0x12')](_0x8795('0x19'),_0x2191fb,_0x8795('0x13'));_0x441669(_0x2118ff[_0x8795('0x1a')][_0x8795('0x18')]);}})[_0x8795('0x1b')](function(_0x353290){logger['error'](_0x8795('0x19'),_0x2191fb,_0x353290);_0x416a3a(_0x353290);});});}exports[_0x8795('0x1c')]=function(_0x4a65f0){var _0x377dde=this;return new Promise(function(_0x2a9501,_0x458787){return db[_0x8795('0x1d')]['findAll']({'raw':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0['options'][_0x8795('0x1f')]||null:null,'attributes':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0['options'][_0x8795('0x20')]||null:null,'limit':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0[_0x8795('0x1e')][_0x8795('0x21')]||null:null,'include':_0x4a65f0[_0x8795('0x1e')]?_0x4a65f0[_0x8795('0x1e')]['include']?_['map'](_0x4a65f0[_0x8795('0x1e')]['include'],function(_0x3ed14c){return{'model':db[_0x3ed14c[_0x8795('0x22')]],'as':_0x3ed14c['as'],'attributes':_0x3ed14c[_0x8795('0x20')],'include':_0x3ed14c[_0x8795('0x23')]?_[_0x8795('0x24')](_0x3ed14c['include'],function(_0x8dc441){return{'model':db[_0x8dc441[_0x8795('0x22')]],'as':_0x8dc441['as'],'attributes':_0x8dc441['attributes'],'include':_0x8dc441[_0x8795('0x23')]?_[_0x8795('0x24')](_0x8dc441[_0x8795('0x23')],function(_0x28770c){return{'model':db[_0x28770c[_0x8795('0x22')]],'as':_0x28770c['as'],'attributes':_0x28770c[_0x8795('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8795('0x11')](function(_0x2c7d1f){logger[_0x8795('0x12')](_0x8795('0x1c'),_0x4a65f0);logger[_0x8795('0x14')]('GetVoiceExtension',_0x4a65f0,JSON[_0x8795('0x16')](_0x2c7d1f));_0x2a9501(_0x2c7d1f);})[_0x8795('0x1b')](function(_0x3aab08){logger[_0x8795('0x17')]('GetVoiceExtension',_0x3aab08[_0x8795('0x18')],_0x4a65f0);_0x458787(_0x377dde[_0x8795('0x17')](0x1f4,_0x3aab08[_0x8795('0x18')]));});});}; \ No newline at end of file +var _0xfe91=['map','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceExtension','VoiceExtension','options','where','attributes','limit','include','model'];(function(_0x528720,_0x2e44fe){var _0x1f43d6=function(_0xde1fc){while(--_0xde1fc){_0x528720['push'](_0x528720['shift']());}};_0x1f43d6(++_0x2e44fe);}(_0xfe91,0xd4));var _0x1fe9=function(_0x2a453b,_0x479c50){_0x2a453b=_0x2a453b-0x0;var _0x132f79=_0xfe91[_0x2a453b];return _0x132f79;};'use strict';var _=require(_0x1fe9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1fe9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fe9('0x2'));var db=require(_0x1fe9('0x3'))['db'];var utils=require(_0x1fe9('0x4'));var logger=require(_0x1fe9('0x5'))(_0x1fe9('0x6'));var config=require(_0x1fe9('0x7'));var jayson=require(_0x1fe9('0x8'));var client=jayson['client'][_0x1fe9('0x9')]({'port':0x232a});config[_0x1fe9('0xa')]=_[_0x1fe9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1fe9('0xc'))(new Redis(config[_0x1fe9('0xa')]));require('./voiceExtension.socket')[_0x1fe9('0xd')](socket);function respondWithRpcPromise(_0x41669b,_0x35d723,_0x336ac6){return new BPromise(function(_0x1c3089,_0x421381){return client[_0x1fe9('0xe')](_0x41669b,_0x336ac6)[_0x1fe9('0xf')](function(_0x4e0e6b){logger[_0x1fe9('0x10')](_0x1fe9('0x11'),_0x35d723,'request\x20sent');logger[_0x1fe9('0x12')](_0x1fe9('0x13'),_0x35d723,_0x1fe9('0x14'),JSON[_0x1fe9('0x15')](_0x4e0e6b));if(_0x4e0e6b[_0x1fe9('0x16')]){if(_0x4e0e6b['error'][_0x1fe9('0x17')]===0x1f4){logger[_0x1fe9('0x16')](_0x1fe9('0x11'),_0x35d723,_0x4e0e6b[_0x1fe9('0x16')]['message']);return _0x421381(_0x4e0e6b[_0x1fe9('0x16')][_0x1fe9('0x18')]);}logger[_0x1fe9('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x35d723,_0x4e0e6b[_0x1fe9('0x16')][_0x1fe9('0x18')]);return _0x1c3089(_0x4e0e6b[_0x1fe9('0x16')]['message']);}else{logger[_0x1fe9('0x10')](_0x1fe9('0x11'),_0x35d723,_0x1fe9('0x14'));_0x1c3089(_0x4e0e6b['result'][_0x1fe9('0x18')]);}})['catch'](function(_0x2cc92e){logger[_0x1fe9('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x35d723,_0x2cc92e);_0x421381(_0x2cc92e);});});}exports[_0x1fe9('0x19')]=function(_0x376b4c){var _0xd7cd7f=this;return new Promise(function(_0x39119c,_0x442ae7){return db[_0x1fe9('0x1a')]['findAll']({'raw':_0x376b4c[_0x1fe9('0x1b')]?_0x376b4c['options']['raw']===undefined?!![]:![]:!![],'where':_0x376b4c[_0x1fe9('0x1b')]?_0x376b4c[_0x1fe9('0x1b')][_0x1fe9('0x1c')]||null:null,'attributes':_0x376b4c[_0x1fe9('0x1b')]?_0x376b4c[_0x1fe9('0x1b')][_0x1fe9('0x1d')]||null:null,'limit':_0x376b4c['options']?_0x376b4c[_0x1fe9('0x1b')][_0x1fe9('0x1e')]||null:null,'include':_0x376b4c['options']?_0x376b4c[_0x1fe9('0x1b')][_0x1fe9('0x1f')]?_['map'](_0x376b4c[_0x1fe9('0x1b')][_0x1fe9('0x1f')],function(_0x5f135d){return{'model':db[_0x5f135d[_0x1fe9('0x20')]],'as':_0x5f135d['as'],'attributes':_0x5f135d[_0x1fe9('0x1d')],'include':_0x5f135d['include']?_[_0x1fe9('0x21')](_0x5f135d[_0x1fe9('0x1f')],function(_0x46fe0b){return{'model':db[_0x46fe0b[_0x1fe9('0x20')]],'as':_0x46fe0b['as'],'attributes':_0x46fe0b[_0x1fe9('0x1d')],'include':_0x46fe0b[_0x1fe9('0x1f')]?_[_0x1fe9('0x21')](_0x46fe0b[_0x1fe9('0x1f')],function(_0xed426c){return{'model':db[_0xed426c[_0x1fe9('0x20')]],'as':_0xed426c['as'],'attributes':_0xed426c[_0x1fe9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1fe9('0xf')](function(_0x3551e4){logger['info'](_0x1fe9('0x19'),_0x376b4c);logger[_0x1fe9('0x12')](_0x1fe9('0x19'),_0x376b4c,JSON[_0x1fe9('0x15')](_0x3551e4));_0x39119c(_0x3551e4);})[_0x1fe9('0x22')](function(_0x43331c){logger['error'](_0x1fe9('0x19'),_0x43331c['message'],_0x376b4c);_0x442ae7(_0xd7cd7f[_0x1fe9('0x16')](0x1f4,_0x43331c[_0x1fe9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 01427b3..c25ba98 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x7e141e,_0x2091d0){var _0x527aff=function(_0x5f0c4f){while(--_0x5f0c4f){_0x7e141e['push'](_0x7e141e['shift']());}};_0x527aff(++_0x2091d0);}(_0x0295,0x1f0));var _0x5029=function(_0x3a07d4,_0xa80b88){_0x3a07d4=_0x3a07d4-0x0;var _0x2c352=_0x0295[_0x3a07d4];return _0x2c352;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x377897,_0x4d185e){var _0x165819=function(_0x2e814a){while(--_0x2e814a){_0x377897['push'](_0x377897['shift']());}};_0x165819(++_0x4d185e);}(_0x7a54,0x106));var _0x47a5=function(_0x25c370,_0x4cd2c7){_0x25c370=_0x25c370-0x0;var _0x8480c2=_0x7a54[_0x25c370];return _0x8480c2;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 0006b93..e9ca956 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7096=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0x7096,0x10c));var _0x6709=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7096[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require('multer');var util=require(_0x6709('0x0'));var path=require('path');var timeout=require(_0x6709('0x1'));var express=require('express');var router=express[_0x6709('0x2')]();var fs_extra=require(_0x6709('0x3'));var auth=require(_0x6709('0x4'));var interaction=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var controller=require(_0x6709('0x7'));router[_0x6709('0x8')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xa')]);router[_0x6709('0x8')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0xc')]);router['get']('/:id/messages',auth[_0x6709('0x9')](),controller[_0x6709('0xd')]);router[_0x6709('0xe')]('/',auth[_0x6709('0x9')](),controller[_0x6709('0xf')]);router[_0x6709('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6709('0x11')]);router[_0x6709('0x12')](_0x6709('0xb'),auth[_0x6709('0x9')](),controller[_0x6709('0x13')]);module[_0x6709('0x14')]=router; \ No newline at end of file +var _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post'];(function(_0x260354,_0x4d22b4){var _0x3fb5ae=function(_0x86753f){while(--_0x86753f){_0x260354['push'](_0x260354['shift']());}};_0x3fb5ae(++_0x4d22b4);}(_0x57ca,0x108));var _0xa57c=function(_0x309c84,_0x11367b){_0x309c84=_0x309c84-0x0;var _0x465678=_0x57ca[_0x309c84];return _0x465678;};'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('0xb'),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 diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e93cae2..9f4bdca 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 _0x5e9f=['contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x5e9f,0xd4));var _0xf5e9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5e9f[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xf5e9('0x0'));module[_0xf5e9('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf5e9('0x2')],'defaultValue':_0xf5e9('0x3'),'unique':_0xf5e9('0x4')},'mailbox':{'type':Sequelize[_0xf5e9('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf5e9('0x2')]},'fullname':{'type':Sequelize[_0xf5e9('0x2')]},'email':{'type':Sequelize[_0xf5e9('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3a1df3){this[_0xf5e9('0x5')](_0xf5e9('0x6'),typeof _0x3a1df3===_0xf5e9('0x7')&&_0x3a1df3[_0xf5e9('0x8')]()?_0x3a1df3[_0xf5e9('0x8')]():null);}},'pager':{'type':Sequelize[_0xf5e9('0x2')]},'tz':{'type':Sequelize[_0xf5e9('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xf5e9('0xa'),'no'),'defaultValue':_0xf5e9('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf5e9('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf5e9('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf5e9('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf5e9('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':_0xf5e9('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf5e9('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf5e9('0x9')](_0xf5e9('0xa'),'no'),'defaultValue':_0xf5e9('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf5e9('0x2')]},'emailbody':{'type':Sequelize[_0xf5e9('0x2')]},'maxsecs':{'type':Sequelize[_0xf5e9('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf5e9('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf5e9('0xd')],'get':function(){return this[_0xf5e9('0xe')](_0xf5e9('0xf'))+_0xf5e9('0x10')+this[_0xf5e9('0xe')](_0xf5e9('0x11'));}}}; \ No newline at end of file +var _0x8baf=['string','trim','yes','ENUM','TINYINT(4)','INTEGER','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email'];(function(_0x3db2e8,_0x49c09b){var _0xf05958=function(_0x291f99){while(--_0x291f99){_0x3db2e8['push'](_0x3db2e8['shift']());}};_0xf05958(++_0x49c09b);}(_0x8baf,0xd9));var _0xf8ba=function(_0x190252,_0x22ad4c){_0x190252=_0x190252-0x0;var _0x1a6c0b=_0x8baf[_0x190252];return _0x1a6c0b;};'use strict';var Sequelize=require(_0xf8ba('0x0'));module[_0xf8ba('0x1')]={'customer_id':{'type':Sequelize[_0xf8ba('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xf8ba('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xf8ba('0x4')},'password':{'type':Sequelize[_0xf8ba('0x2')]},'fullname':{'type':Sequelize[_0xf8ba('0x2')]},'email':{'type':Sequelize[_0xf8ba('0x2')],'validate':{'isEmail':!![]},'set':function(_0x12e38a){this[_0xf8ba('0x5')](_0xf8ba('0x6'),typeof _0x12e38a===_0xf8ba('0x7')&&_0x12e38a['trim']()?_0x12e38a[_0xf8ba('0x8')]():null);}},'pager':{'type':Sequelize[_0xf8ba('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0xf8ba('0x9'),'no'),'defaultValue':_0xf8ba('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf8ba('0xa')](_0xf8ba('0x9'),'no'),'defaultValue':_0xf8ba('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf8ba('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xf8ba('0xa')](_0xf8ba('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf8ba('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf8ba('0xa')](_0xf8ba('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf8ba('0xa')](_0xf8ba('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf8ba('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf8ba('0xa')](_0xf8ba('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf8ba('0xa')](_0xf8ba('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf8ba('0xa')](_0xf8ba('0x9'),'no'),'defaultValue':_0xf8ba('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xf8ba('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xf8ba('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf8ba('0xa')](_0xf8ba('0x9'),'no'),'defaultValue':_0xf8ba('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xf8ba('0x2')]},'emailbody':{'type':Sequelize[_0xf8ba('0x2')]},'maxsecs':{'type':Sequelize[_0xf8ba('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf8ba('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xf8ba('0xd')](_0xf8ba('0xe'))+_0xf8ba('0xf')+this[_0xf8ba('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 05dc404..e6c3d50 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 _0xb574=['filter','merge','VoiceMail','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','length','pick','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0xb574,0x106));var _0x4b57=function(_0x3b044e,_0x55b2e9){_0x3b044e=_0x3b044e-0x0;var _0x2d632b=_0xb574[_0x3b044e];return _0x2d632b;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['VoiceMail'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](removeEntity(_0x5c1082,null))['catch'](handleError(_0x5c1082,null));};exports['getMessages']=function(_0x54ff9d,_0x4c241a,_0x179802){return db[_0x4b57('0x3c')]['findOne']({'where':{'id':_0x54ff9d[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x4c241a,null))[_0x4b57('0x23')](function(_0x9ed750){var _0x64b0fd;var _0x1fcc10={},_0xf1bf63={};_0xf1bf63[_0x4b57('0x32')]=_[_0x4b57('0x30')](db['VoiceMailMessage'][_0x4b57('0x2c')]);_0xf1bf63['query']=_[_0x4b57('0x30')](_0x54ff9d[_0x4b57('0x2f')]);_0xf1bf63['filters']=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],_0xf1bf63[_0x4b57('0x2f')]);_0x1fcc10[_0x4b57('0x33')]=_[_0x4b57('0x43')](_0xf1bf63[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x34')]));_0x1fcc10[_0x4b57('0x33')]=_0x1fcc10[_0x4b57('0x33')][_0x4b57('0x4e')]?_0x1fcc10['attributes']:_0xf1bf63[_0x4b57('0x32')];if(!_0x54ff9d[_0x4b57('0x2f')]['hasOwnProperty'](_0x4b57('0x36'))){_0x1fcc10['limit']=qs['limit'](_0x54ff9d['query'][_0x4b57('0x1b')]);_0x1fcc10['offset']=qs[_0x4b57('0x1d')](_0x54ff9d[_0x4b57('0x2f')]['offset']);}_0x1fcc10['order']=qs[_0x4b57('0x38')](_0x54ff9d[_0x4b57('0x2f')][_0x4b57('0x38')]);_0x1fcc10['where']=qs[_0x4b57('0x31')](_[_0x4b57('0x4f')](_0x54ff9d['query'],_0xf1bf63[_0x4b57('0x31')]));if(_0x54ff9d[_0x4b57('0x2f')]['filter']){_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0x1fcc10[_0x4b57('0x33')],function(_0x5d9dd5){var _0x2112d5={};_0x2112d5[_0x5d9dd5]={'$like':'%'+_0x54ff9d['query']['filter']+'%'};return _0x2112d5;})});}_0x1fcc10[_0x4b57('0x39')]=_[_0x4b57('0x3b')](_0x1fcc10['where'],{'mailboxuser':_0x9ed750['mailbox']});_0x1fcc10=_[_0x4b57('0x3b')]({},_0x1fcc10,_0x54ff9d[_0x4b57('0x45')]);return db['VoiceMailMessage']['findAndCountAll'](_0x1fcc10)['then'](respondWithFilteredResult(_0x4c241a,_0x1fcc10));})[_0x4b57('0x40')](handleError(_0x4c241a,null));}; \ No newline at end of file +var _0x84a0=['UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','then','get','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0x84a0,0x66));var _0x084a=function(_0xf9cb79,_0x57cb52){_0xf9cb79=_0xf9cb79-0x0;var _0x4358e5=_0x84a0[_0xf9cb79];return _0x4358e5;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];function respondWithStatusCode(_0x3ca72f,_0xec90a5){_0xec90a5=_0xec90a5||0xcc;return function(_0x9245b1){if(_0x9245b1){return _0x3ca72f[_0x084a('0x18')](_0xec90a5);}return _0x3ca72f[_0x084a('0x19')](_0xec90a5)[_0x084a('0x1a')]();};}function respondWithResult(_0x3a76d1,_0x5aef40){_0x5aef40=_0x5aef40||0xc8;return function(_0x4277c9){if(_0x4277c9){return _0x3a76d1['status'](_0x5aef40)[_0x084a('0x1b')](_0x4277c9);}};}function respondWithFilteredResult(_0x3ccaca,_0x366624){return function(_0x2d35b8){if(_0x2d35b8){var _0xd20527=typeof _0x366624['offset']===_0x084a('0x1c')&&typeof _0x366624['limit']===_0x084a('0x1c');var _0x355b45=_0x2d35b8['count'];var _0xf2c333=_0xd20527?0x0:_0x366624[_0x084a('0x1d')];var _0x4134b9=_0xd20527?_0x2d35b8[_0x084a('0x1e')]:_0x366624[_0x084a('0x1d')]+_0x366624[_0x084a('0x1f')];var _0x447a19;if(_0x4134b9>=_0x355b45){_0x4134b9=_0x355b45;_0x447a19=0xc8;}else{_0x447a19=0xce;}_0x3ccaca[_0x084a('0x19')](_0x447a19);return _0x3ccaca[_0x084a('0x20')](_0x084a('0x21'),_0xf2c333+'-'+_0x4134b9+'/'+_0x355b45)[_0x084a('0x1b')](_0x2d35b8);}return null;};}function patchUpdates(_0x279e25){return function(_0x116328){try{jsonpatch[_0x084a('0x22')](_0x116328,_0x279e25,!![]);}catch(_0xf0dd98){return BPromise['reject'](_0xf0dd98);}return _0x116328[_0x084a('0x23')]();};}function saveUpdates(_0x1ad257,_0x41a90f){return function(_0x2d62bf){if(_0x2d62bf){return _0x2d62bf[_0x084a('0x24')](_0x1ad257)['then'](function(_0x755c24){return _0x755c24;});}return null;};}function removeEntity(_0x288e9e,_0x6346a5){return function(_0x1f2c9f){if(_0x1f2c9f){return _0x1f2c9f[_0x084a('0x25')]()[_0x084a('0x26')](function(){var _0x5be167=_0x1f2c9f[_0x084a('0x27')]({'plain':!![]});var _0x2af138=_0x084a('0x28');return db['UserProfileResource'][_0x084a('0x25')]({'where':{'type':_0x2af138,'resourceId':_0x5be167['id']}})[_0x084a('0x26')](function(){return _0x1f2c9f;});})[_0x084a('0x26')](function(){_0x288e9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4874fe,_0x52227a){return function(_0x33b88f){if(!_0x33b88f){_0x4874fe['sendStatus'](0x194);}return _0x33b88f;};}function handleError(_0x5bea78,_0x51c9f4){_0x51c9f4=_0x51c9f4||0x1f4;return function(_0x3b8176){logger[_0x084a('0x29')](_0x3b8176[_0x084a('0x2a')]);if(_0x3b8176[_0x084a('0x2b')]){delete _0x3b8176[_0x084a('0x2b')];}_0x5bea78[_0x084a('0x19')](_0x51c9f4)[_0x084a('0x2c')](_0x3b8176);};}exports[_0x084a('0x2d')]=function(_0x5e6ea8,_0x2ed3cd){var _0x3b2b38={},_0x501a16={},_0xe1980b={'count':0x0,'rows':[]};var _0x24bcf5=_[_0x084a('0x2e')](db[_0x084a('0x2f')][_0x084a('0x30')],function(_0x202602){return{'name':_0x202602[_0x084a('0x31')],'type':_0x202602[_0x084a('0x32')][_0x084a('0x33')]};});_0x501a16[_0x084a('0x34')]=_[_0x084a('0x2e')](_0x24bcf5,_0x084a('0x2b'));_0x501a16[_0x084a('0x35')]=_['keys'](_0x5e6ea8['query']);_0x501a16[_0x084a('0x36')]=_[_0x084a('0x37')](_0x501a16[_0x084a('0x34')],_0x501a16[_0x084a('0x35')]);_0x3b2b38[_0x084a('0x38')]=_['intersection'](_0x501a16[_0x084a('0x34')],qs[_0x084a('0x39')](_0x5e6ea8[_0x084a('0x35')]['fields']));_0x3b2b38[_0x084a('0x38')]=_0x3b2b38[_0x084a('0x38')][_0x084a('0x3a')]?_0x3b2b38['attributes']:_0x501a16['model'];if(!_0x5e6ea8['query'][_0x084a('0x3b')](_0x084a('0x3c'))){_0x3b2b38[_0x084a('0x1f')]=qs['limit'](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x1f')]);_0x3b2b38[_0x084a('0x1d')]=qs[_0x084a('0x1d')](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x1d')]);}_0x3b2b38[_0x084a('0x3d')]=qs[_0x084a('0x3e')](_0x5e6ea8[_0x084a('0x35')][_0x084a('0x3e')]);_0x3b2b38[_0x084a('0x3f')]=qs[_0x084a('0x36')](_[_0x084a('0x40')](_0x5e6ea8[_0x084a('0x35')],_0x501a16[_0x084a('0x36')]),_0x24bcf5);if(_0x5e6ea8['query'][_0x084a('0x41')]){_0x3b2b38[_0x084a('0x3f')]=_[_0x084a('0x42')](_0x3b2b38[_0x084a('0x3f')],{'$or':_[_0x084a('0x2e')](_0x24bcf5,function(_0x22862b){if(_0x22862b[_0x084a('0x32')]!==_0x084a('0x43')){var _0x13dc4c={};_0x13dc4c[_0x22862b['name']]={'$like':'%'+_0x5e6ea8[_0x084a('0x35')][_0x084a('0x41')]+'%'};return _0x13dc4c;}})});}_0x3b2b38=_[_0x084a('0x42')]({},_0x3b2b38,_0x5e6ea8[_0x084a('0x44')]);var _0x256008={'where':_0x3b2b38[_0x084a('0x3f')]};return db['VoiceMail'][_0x084a('0x1e')](_0x256008)[_0x084a('0x26')](function(_0x55c5f4){_0xe1980b[_0x084a('0x1e')]=_0x55c5f4;if(_0x5e6ea8[_0x084a('0x35')][_0x084a('0x45')]){_0x3b2b38['include']=[{'all':!![]}];}return db[_0x084a('0x2f')][_0x084a('0x46')](_0x3b2b38);})['then'](function(_0x3e2b92){_0xe1980b[_0x084a('0x47')]=_0x3e2b92;return _0xe1980b;})['then'](respondWithFilteredResult(_0x2ed3cd,_0x3b2b38))['catch'](handleError(_0x2ed3cd,null));};exports[_0x084a('0x48')]=function(_0x17a8d4,_0x3726bd){var _0xec2713={'raw':!![],'where':{'id':_0x17a8d4[_0x084a('0x49')]['id']}},_0x1e2a2d={};_0x1e2a2d[_0x084a('0x34')]=_[_0x084a('0x4a')](db[_0x084a('0x2f')][_0x084a('0x30')]);_0x1e2a2d[_0x084a('0x35')]=_['keys'](_0x17a8d4['query']);_0x1e2a2d[_0x084a('0x36')]=_[_0x084a('0x37')](_0x1e2a2d[_0x084a('0x34')],_0x1e2a2d['query']);_0xec2713[_0x084a('0x38')]=_[_0x084a('0x37')](_0x1e2a2d[_0x084a('0x34')],qs[_0x084a('0x39')](_0x17a8d4[_0x084a('0x35')]['fields']));_0xec2713[_0x084a('0x38')]=_0xec2713['attributes'][_0x084a('0x3a')]?_0xec2713[_0x084a('0x38')]:_0x1e2a2d[_0x084a('0x34')];if(_0x17a8d4['query']['includeAll']){_0xec2713[_0x084a('0x4b')]=[{'all':!![]}];}_0xec2713=_[_0x084a('0x42')]({},_0xec2713,_0x17a8d4['options']);return db[_0x084a('0x2f')][_0x084a('0x4c')](_0xec2713)[_0x084a('0x26')](handleEntityNotFound(_0x3726bd,null))[_0x084a('0x26')](respondWithResult(_0x3726bd,null))['catch'](handleError(_0x3726bd,null));};exports[_0x084a('0x4d')]=function(_0x865368,_0x31677b){return db[_0x084a('0x2f')]['create'](_0x865368[_0x084a('0x4e')],{})[_0x084a('0x26')](function(_0x411fa9){var _0x2d3d01=_0x865368['user']['get']({'plain':!![]});if(!_0x2d3d01)throw new Error(_0x084a('0x4f'));if(_0x2d3d01[_0x084a('0x50')]===_0x084a('0x51')){var _0x264f09=_0x411fa9[_0x084a('0x27')]({'plain':!![]});var _0x3b2df4=_0x084a('0x28');return db[_0x084a('0x52')][_0x084a('0x4c')]({'where':{'name':_0x3b2df4,'userProfileId':_0x2d3d01[_0x084a('0x53')]},'raw':!![]})[_0x084a('0x26')](function(_0x98769c){if(_0x98769c&&_0x98769c['autoAssociation']===0x0){return db[_0x084a('0x54')][_0x084a('0x4d')]({'name':_0x264f09[_0x084a('0x2b')],'resourceId':_0x264f09['id'],'type':_0x98769c[_0x084a('0x2b')],'sectionId':_0x98769c['id']},{})[_0x084a('0x26')](function(){return _0x411fa9;});}else{return _0x411fa9;}})[_0x084a('0x55')](function(_0xa5362){logger['error'](_0x084a('0x56'),_0xa5362);throw _0xa5362;});}return _0x411fa9;})[_0x084a('0x26')](respondWithResult(_0x31677b,0xc9))[_0x084a('0x55')](handleError(_0x31677b,null));};exports['update']=function(_0x54ca1f,_0x424cd1){if(_0x54ca1f['body']['id']){delete _0x54ca1f[_0x084a('0x4e')]['id'];}return db[_0x084a('0x2f')]['find']({'where':{'id':_0x54ca1f[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x424cd1,null))['then'](saveUpdates(_0x54ca1f[_0x084a('0x4e')],null))[_0x084a('0x26')](respondWithResult(_0x424cd1,null))[_0x084a('0x55')](handleError(_0x424cd1,null));};exports[_0x084a('0x25')]=function(_0x2a8056,_0x57d397){return db[_0x084a('0x2f')]['find']({'where':{'id':_0x2a8056[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x57d397,null))[_0x084a('0x26')](removeEntity(_0x57d397,null))['catch'](handleError(_0x57d397,null));};exports[_0x084a('0x57')]=function(_0x339088,_0x12db87,_0x9246dd){return db['VoiceMail'][_0x084a('0x58')]({'where':{'id':_0x339088['params']['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x12db87,null))[_0x084a('0x26')](function(_0x21a18a){var _0x4cc344;var _0x589e38={},_0xd37003={};_0xd37003[_0x084a('0x34')]=_['keys'](db[_0x084a('0x59')]['rawAttributes']);_0xd37003['query']=_[_0x084a('0x4a')](_0x339088[_0x084a('0x35')]);_0xd37003[_0x084a('0x36')]=_[_0x084a('0x37')](_0xd37003[_0x084a('0x34')],_0xd37003[_0x084a('0x35')]);_0x589e38[_0x084a('0x38')]=_[_0x084a('0x37')](_0xd37003[_0x084a('0x34')],qs['fields'](_0x339088[_0x084a('0x35')][_0x084a('0x39')]));_0x589e38[_0x084a('0x38')]=_0x589e38['attributes'][_0x084a('0x3a')]?_0x589e38[_0x084a('0x38')]:_0xd37003['model'];if(!_0x339088[_0x084a('0x35')]['hasOwnProperty']('nolimit')){_0x589e38[_0x084a('0x1f')]=qs['limit'](_0x339088['query'][_0x084a('0x1f')]);_0x589e38[_0x084a('0x1d')]=qs[_0x084a('0x1d')](_0x339088['query'][_0x084a('0x1d')]);}_0x589e38[_0x084a('0x3d')]=qs[_0x084a('0x3e')](_0x339088[_0x084a('0x35')][_0x084a('0x3e')]);_0x589e38[_0x084a('0x3f')]=qs[_0x084a('0x36')](_['pick'](_0x339088['query'],_0xd37003[_0x084a('0x36')]));if(_0x339088[_0x084a('0x35')]['filter']){_0x589e38[_0x084a('0x3f')]=_[_0x084a('0x42')](_0x589e38[_0x084a('0x3f')],{'$or':_[_0x084a('0x2e')](_0x589e38['attributes'],function(_0x21dd85){var _0x3fa52e={};_0x3fa52e[_0x21dd85]={'$like':'%'+_0x339088[_0x084a('0x35')]['filter']+'%'};return _0x3fa52e;})});}_0x589e38['where']=_[_0x084a('0x42')](_0x589e38[_0x084a('0x3f')],{'mailboxuser':_0x21a18a[_0x084a('0x5a')]});_0x589e38=_[_0x084a('0x42')]({},_0x589e38,_0x339088[_0x084a('0x44')]);return db[_0x084a('0x59')][_0x084a('0x5b')](_0x589e38)['then'](respondWithFilteredResult(_0x12db87,_0x589e38));})[_0x084a('0x55')](handleError(_0x12db87,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7a2ac25..f0d8f80 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 _0x5391=['voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','VoiceMail'];(function(_0x34aaa1,_0x54a4fd){var _0xe301af=function(_0x22d980){while(--_0x22d980){_0x34aaa1['push'](_0x34aaa1['shift']());}};_0xe301af(++_0x54a4fd);}(_0x5391,0xba));var _0x1539=function(_0x22199f,_0x3cd07c){_0x22199f=_0x22199f-0x0;var _0x2b8384=_0x5391[_0x22199f];return _0x2b8384;};'use strict';var _=require(_0x1539('0x0'));var util=require(_0x1539('0x1'));var logger=require(_0x1539('0x2'))('api');var moment=require(_0x1539('0x3'));var BPromise=require(_0x1539('0x4'));var rp=require(_0x1539('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1539('0x6'));var attributes=require('./voiceMail.attributes');module[_0x1539('0x7')]=function(_0x2c8b6d,_0x299c20){return _0x2c8b6d[_0x1539('0x8')](_0x1539('0x9'),attributes,{'tableName':_0x1539('0xa'),'paranoid':![],'indexes':[{'name':_0x1539('0xb'),'fields':[_0x1539('0xc'),_0x1539('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b93=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','context','util','../../config/logger','api','request-promise'];(function(_0xadfe63,_0x1765d2){var _0x47eba0=function(_0x5685fe){while(--_0x5685fe){_0xadfe63['push'](_0xadfe63['shift']());}};_0x47eba0(++_0x1765d2);}(_0x0b93,0xd9));var _0x30b9=function(_0x3c6402,_0x7d2a68){_0x3c6402=_0x3c6402-0x0;var _0x48ee69=_0x0b93[_0x3c6402];return _0x48ee69;};'use strict';var _=require('lodash');var util=require(_0x30b9('0x0'));var logger=require(_0x30b9('0x1'))(_0x30b9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x30b9('0x3'));var fs=require('fs');var path=require(_0x30b9('0x4'));var rimraf=require(_0x30b9('0x5'));var config=require(_0x30b9('0x6'));var attributes=require(_0x30b9('0x7'));module[_0x30b9('0x8')]=function(_0x1167eb,_0x3aa446){return _0x1167eb[_0x30b9('0x9')](_0x30b9('0xa'),attributes,{'tableName':_0x30b9('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x30b9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 31b376d..ae198a0 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 _0xa5c1=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x342cc6,_0x248259){var _0x560405=function(_0x37e0ce){while(--_0x37e0ce){_0x342cc6['push'](_0x342cc6['shift']());}};_0x560405(++_0x248259);}(_0xa5c1,0xa3));var _0x1a5c=function(_0x3f5d4f,_0x2f834f){_0x3f5d4f=_0x3f5d4f-0x0;var _0x7d0a62=_0xa5c1[_0x3f5d4f];return _0x7d0a62;};'use strict';var _=require('lodash');var util=require(_0x1a5c('0x0'));var moment=require('moment');var BPromise=require(_0x1a5c('0x1'));var rs=require(_0x1a5c('0x2'));var fs=require('fs');var Redis=require(_0x1a5c('0x3'));var db=require(_0x1a5c('0x4'))['db'];var utils=require(_0x1a5c('0x5'));var logger=require(_0x1a5c('0x6'))(_0x1a5c('0x7'));var config=require(_0x1a5c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1a5c('0x9')][_0x1a5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1175f0,_0x56882c,_0x10a757){return new BPromise(function(_0x447a51,_0x202a38){return client[_0x1a5c('0xb')](_0x1175f0,_0x10a757)[_0x1a5c('0xc')](function(_0xef4cbf){logger[_0x1a5c('0xd')](_0x1a5c('0xe'),_0x56882c,_0x1a5c('0xf'));logger[_0x1a5c('0x10')](_0x1a5c('0x11'),_0x56882c,'request\x20sent',JSON['stringify'](_0xef4cbf));if(_0xef4cbf[_0x1a5c('0x12')]){if(_0xef4cbf[_0x1a5c('0x12')][_0x1a5c('0x13')]===0x1f4){logger['error'](_0x1a5c('0xe'),_0x56882c,_0xef4cbf['error'][_0x1a5c('0x14')]);return _0x202a38(_0xef4cbf[_0x1a5c('0x12')][_0x1a5c('0x14')]);}logger[_0x1a5c('0x12')]('VoiceMail,\x20%s,\x20%s',_0x56882c,_0xef4cbf[_0x1a5c('0x12')]['message']);return _0x447a51(_0xef4cbf[_0x1a5c('0x12')]['message']);}else{logger[_0x1a5c('0xd')]('VoiceMail,\x20%s,\x20%s',_0x56882c,_0x1a5c('0xf'));_0x447a51(_0xef4cbf[_0x1a5c('0x15')][_0x1a5c('0x14')]);}})[_0x1a5c('0x16')](function(_0x2f718d){logger['error'](_0x1a5c('0xe'),_0x56882c,_0x2f718d);_0x202a38(_0x2f718d);});});} \ No newline at end of file +var _0xc03a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1222f2,_0x4c7e41){var _0x3dbb0f=function(_0x2e22b7){while(--_0x2e22b7){_0x1222f2['push'](_0x1222f2['shift']());}};_0x3dbb0f(++_0x4c7e41);}(_0xc03a,0x10f));var _0xac03=function(_0x3b604f,_0x25517c){_0x3b604f=_0x3b604f-0x0;var _0x3f07e9=_0xc03a[_0x3b604f];return _0x3f07e9;};'use strict';var _=require(_0xac03('0x0'));var util=require(_0xac03('0x1'));var moment=require(_0xac03('0x2'));var BPromise=require(_0xac03('0x3'));var rs=require(_0xac03('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac03('0x5'));var logger=require(_0xac03('0x6'))('rpc');var config=require(_0xac03('0x7'));var jayson=require(_0xac03('0x8'));var client=jayson[_0xac03('0x9')][_0xac03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a4704,_0x3b5d5c,_0x2e39ec){return new BPromise(function(_0x477375,_0x4ec7bd){return client[_0xac03('0xb')](_0x1a4704,_0x2e39ec)['then'](function(_0x3af37a){logger[_0xac03('0xc')](_0xac03('0xd'),_0x3b5d5c,_0xac03('0xe'));logger[_0xac03('0xf')](_0xac03('0x10'),_0x3b5d5c,_0xac03('0xe'),JSON[_0xac03('0x11')](_0x3af37a));if(_0x3af37a['error']){if(_0x3af37a[_0xac03('0x12')][_0xac03('0x13')]===0x1f4){logger['error'](_0xac03('0xd'),_0x3b5d5c,_0x3af37a[_0xac03('0x12')][_0xac03('0x14')]);return _0x4ec7bd(_0x3af37a[_0xac03('0x12')][_0xac03('0x14')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x3b5d5c,_0x3af37a[_0xac03('0x12')]['message']);return _0x477375(_0x3af37a['error'][_0xac03('0x14')]);}else{logger['info'](_0xac03('0xd'),_0x3b5d5c,_0xac03('0xe'));_0x477375(_0x3af37a[_0xac03('0x15')][_0xac03('0x14')]);}})[_0xac03('0x16')](function(_0xd6357){logger[_0xac03('0x12')]('VoiceMail,\x20%s,\x20%s',_0x3b5d5c,_0xd6357);_0x4ec7bd(_0xd6357);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a9708ee..7f94a8a 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 _0x6ca8=['index','isAuthenticated','show','/:id/download','post','create','/:id','update','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x553600,_0xf56180){var _0x156eae=function(_0x1239f5){while(--_0x1239f5){_0x553600['push'](_0x553600['shift']());}};_0x156eae(++_0xf56180);}(_0x6ca8,0x99));var _0x86ca=function(_0x456cca,_0x1b8475){_0x456cca=_0x456cca-0x0;var _0x73d1cd=_0x6ca8[_0x456cca];return _0x73d1cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x86ca('0x0'));var timeout=require(_0x86ca('0x1'));var express=require(_0x86ca('0x2'));var router=express['Router']();var fs_extra=require(_0x86ca('0x3'));var auth=require(_0x86ca('0x4'));var interaction=require(_0x86ca('0x5'));var config=require(_0x86ca('0x6'));var controller=require(_0x86ca('0x7'));router[_0x86ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x86ca('0x9')]);router[_0x86ca('0x8')]('/:id',auth[_0x86ca('0xa')](),controller[_0x86ca('0xb')]);router[_0x86ca('0x8')](_0x86ca('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x86ca('0xd')]('/',auth['isAuthenticated'](),controller[_0x86ca('0xe')]);router['put'](_0x86ca('0xf'),auth[_0x86ca('0xa')](),controller[_0x86ca('0x10')]);router[_0x86ca('0x11')](_0x86ca('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfc08=['index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x24273e,_0x32f476){var _0x1f0b3f=function(_0xf468dc){while(--_0xf468dc){_0x24273e['push'](_0x24273e['shift']());}};_0x1f0b3f(++_0x32f476);}(_0xfc08,0x1f0));var _0x8fc0=function(_0x3ad31b,_0x49560f){_0x3ad31b=_0x3ad31b-0x0;var _0xade7e2=_0xfc08[_0x3ad31b];return _0xade7e2;};'use strict';var multer=require(_0x8fc0('0x0'));var util=require(_0x8fc0('0x1'));var path=require(_0x8fc0('0x2'));var timeout=require(_0x8fc0('0x3'));var express=require(_0x8fc0('0x4'));var router=express[_0x8fc0('0x5')]();var fs_extra=require(_0x8fc0('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8fc0('0x7'));var controller=require('./voiceMailMessage.controller');router[_0x8fc0('0x8')]('/',auth[_0x8fc0('0x9')](),controller[_0x8fc0('0xa')]);router[_0x8fc0('0x8')](_0x8fc0('0xb'),auth[_0x8fc0('0x9')](),controller[_0x8fc0('0xc')]);router[_0x8fc0('0x8')](_0x8fc0('0xd'),auth[_0x8fc0('0x9')](),controller[_0x8fc0('0xe')]);router[_0x8fc0('0xf')]('/',auth['isAuthenticated'](),controller[_0x8fc0('0x10')]);router[_0x8fc0('0x11')](_0x8fc0('0xb'),auth['isAuthenticated'](),controller[_0x8fc0('0x12')]);router[_0x8fc0('0x13')](_0x8fc0('0xb'),auth[_0x8fc0('0x9')](),controller[_0x8fc0('0x14')]);module[_0x8fc0('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index ffcfaf1..fa15324 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 _0x3e49=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER'];(function(_0x49cb59,_0x376b89){var _0x3b78f7=function(_0x15d4cd){while(--_0x15d4cd){_0x49cb59['push'](_0x49cb59['shift']());}};_0x3b78f7(++_0x376b89);}(_0x3e49,0xe7));var _0x93e4=function(_0x5ae1e2,_0x452abe){_0x5ae1e2=_0x5ae1e2-0x0;var _0x3710e6=_0x3e49[_0x5ae1e2];return _0x3710e6;};'use strict';var Sequelize=require(_0x93e4('0x0'));module[_0x93e4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x23e87c){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x93e4('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x93e4('0x4')](_0x93e4('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x93e4('0x3')],'defaultValue':''},'stamp':{'type':_0x93e4('0x6'),'defaultValue':Sequelize[_0x93e4('0x7')](_0x93e4('0x8'))}}; \ No newline at end of file +var _0xda49=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','literal'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda49,0x1e0));var _0x9da4=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xda49[_0xda464c];return _0x19e222;};'use strict';var Sequelize=require('sequelize');module[_0x9da4('0x0')]={'name':{'type':Sequelize[_0x9da4('0x1')],'get':function(_0x229a91){return this[_0x9da4('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x9da4('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9da4('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9da4('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x9da4('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x9da4('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9da4('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x9da4('0x5')](_0x9da4('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9da4('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x9da4('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index da78f4f..513efef 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 _0x3acd=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','VoiceMailMessage','include','findAll','catch','show','params','rawAttributes','keys','includeAll','options','find','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xe4326d,_0x25784d){var _0xd1ff82=function(_0x4908ad){while(--_0x4908ad){_0xe4326d['push'](_0xe4326d['shift']());}};_0xd1ff82(++_0x25784d);}(_0x3acd,0x138));var _0xd3ac=function(_0x3aff18,_0x80bc2c){_0x3aff18=_0x3aff18-0x0;var _0x54339b=_0x3acd[_0x3aff18];return _0x54339b;};'use strict';var emlformat=require(_0xd3ac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3ac('0x1'));var jsonpatch=require(_0xd3ac('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd3ac('0x3'));var Mustache=require(_0xd3ac('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd3ac('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3ac('0x6'));var squel=require(_0xd3ac('0x7'));var crypto=require(_0xd3ac('0x8'));var jsforce=require(_0xd3ac('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd3ac('0xa'));var querystring=require(_0xd3ac('0xb'));var Papa=require('papaparse');var Redis=require(_0xd3ac('0xc'));var authService=require(_0xd3ac('0xd'));var qs=require(_0xd3ac('0xe'));var as=require(_0xd3ac('0xf'));var hardwareService=require(_0xd3ac('0x10'));var logger=require(_0xd3ac('0x11'))(_0xd3ac('0x12'));var utils=require(_0xd3ac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd3ac('0x14'));var db=require(_0xd3ac('0x15'))['db'];function respondWithStatusCode(_0x5dacad,_0x36177e){_0x36177e=_0x36177e||0xcc;return function(_0x42e9ac){if(_0x42e9ac){return _0x5dacad[_0xd3ac('0x16')](_0x36177e);}return _0x5dacad['status'](_0x36177e)[_0xd3ac('0x17')]();};}function respondWithResult(_0x511662,_0x67de80){_0x67de80=_0x67de80||0xc8;return function(_0x2ed889){if(_0x2ed889){return _0x511662[_0xd3ac('0x18')](_0x67de80)['json'](_0x2ed889);}};}function respondWithFilteredResult(_0x61a9f2,_0x165118){return function(_0x29f487){if(_0x29f487){var _0x28a3b3=typeof _0x165118['offset']==='undefined'&&typeof _0x165118['limit']===_0xd3ac('0x19');var _0x49a939=_0x29f487[_0xd3ac('0x1a')];var _0xc700=_0x28a3b3?0x0:_0x165118[_0xd3ac('0x1b')];var _0x1740bf=_0x28a3b3?_0x29f487[_0xd3ac('0x1a')]:_0x165118[_0xd3ac('0x1b')]+_0x165118[_0xd3ac('0x1c')];var _0xd27fb0;if(_0x1740bf>=_0x49a939){_0x1740bf=_0x49a939;_0xd27fb0=0xc8;}else{_0xd27fb0=0xce;}_0x61a9f2[_0xd3ac('0x18')](_0xd27fb0);return _0x61a9f2['set']('Content-Range',_0xc700+'-'+_0x1740bf+'/'+_0x49a939)[_0xd3ac('0x1d')](_0x29f487);}return null;};}function patchUpdates(_0x4d70a1){return function(_0x1e12ed){try{jsonpatch[_0xd3ac('0x1e')](_0x1e12ed,_0x4d70a1,!![]);}catch(_0x115d7d){return BPromise[_0xd3ac('0x1f')](_0x115d7d);}return _0x1e12ed[_0xd3ac('0x20')]();};}function saveUpdates(_0x2e31b3,_0x483c50){return function(_0x49fff4){if(_0x49fff4){return _0x49fff4[_0xd3ac('0x21')](_0x2e31b3)[_0xd3ac('0x22')](function(_0x2792e2){return _0x2792e2;});}return null;};}function removeEntity(_0x2f2abe,_0x575724){return function(_0x2223f7){if(_0x2223f7){return _0x2223f7[_0xd3ac('0x23')]()[_0xd3ac('0x22')](function(){_0x2f2abe['status'](0xcc)[_0xd3ac('0x17')]();});}};}function handleEntityNotFound(_0x3b78d8,_0x3dcc1c){return function(_0x2163bd){if(!_0x2163bd){_0x3b78d8['sendStatus'](0x194);}return _0x2163bd;};}function handleError(_0x57ae6f,_0x565318){_0x565318=_0x565318||0x1f4;return function(_0x30b415){logger[_0xd3ac('0x24')](_0x30b415[_0xd3ac('0x25')]);if(_0x30b415[_0xd3ac('0x26')]){delete _0x30b415['name'];}_0x57ae6f[_0xd3ac('0x18')](_0x565318)[_0xd3ac('0x27')](_0x30b415);};}exports['index']=function(_0x59a2aa,_0x270ee7){var _0x1307d6={},_0x42df91={},_0x7a9107={'count':0x0,'rows':[]};var _0x59a6a0=_[_0xd3ac('0x28')](db['VoiceMailMessage']['rawAttributes'],function(_0x53bca2){return{'name':_0x53bca2['fieldName'],'type':_0x53bca2['type'][_0xd3ac('0x29')]};});_0x42df91[_0xd3ac('0x2a')]=_[_0xd3ac('0x2b')](_[_0xd3ac('0x28')](_0x59a6a0,_0xd3ac('0x26')),[_0xd3ac('0x26')]);_0x42df91[_0xd3ac('0x2c')]=_['keys'](_0x59a2aa['query']);_0x42df91[_0xd3ac('0x2d')]=_[_0xd3ac('0x2e')](_0x42df91[_0xd3ac('0x2a')],_0x42df91[_0xd3ac('0x2c')]);_0x1307d6[_0xd3ac('0x2f')]=_['intersection'](_0x42df91[_0xd3ac('0x2a')],qs['fields'](_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x30')]));_0x1307d6[_0xd3ac('0x2f')]=_0x1307d6[_0xd3ac('0x2f')][_0xd3ac('0x31')]?_0x1307d6[_0xd3ac('0x2f')]:_0x42df91[_0xd3ac('0x2a')];if(!_0x59a2aa['query'][_0xd3ac('0x32')](_0xd3ac('0x33'))){_0x1307d6[_0xd3ac('0x1c')]=qs[_0xd3ac('0x1c')](_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x1c')]);_0x1307d6['offset']=qs[_0xd3ac('0x1b')](_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x1b')]);}_0x1307d6[_0xd3ac('0x34')]=qs['sort'](_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x35')]);_0x1307d6[_0xd3ac('0x36')]=qs[_0xd3ac('0x2d')](_[_0xd3ac('0x37')](_0x59a2aa[_0xd3ac('0x2c')],_0x42df91[_0xd3ac('0x2d')]),_0x59a6a0);if(_0x59a2aa[_0xd3ac('0x2c')]['filter']){_0x1307d6['where']=_[_0xd3ac('0x38')](_0x1307d6[_0xd3ac('0x36')],{'$or':_['map'](_0x59a6a0,function(_0x555985){if(_0x555985['type']!=='VIRTUAL'){var _0x36e0ed={};_0x36e0ed[_0x555985['name']]={'$like':'%'+_0x59a2aa[_0xd3ac('0x2c')][_0xd3ac('0x39')]+'%'};return _0x36e0ed;}})});}_0x1307d6=_[_0xd3ac('0x38')]({},_0x1307d6,_0x59a2aa['options']);var _0x571a0a={'where':_0x1307d6[_0xd3ac('0x36')]};return db[_0xd3ac('0x3a')][_0xd3ac('0x1a')](_0x571a0a)[_0xd3ac('0x22')](function(_0x2d622e){_0x7a9107[_0xd3ac('0x1a')]=_0x2d622e;if(_0x59a2aa[_0xd3ac('0x2c')]['includeAll']){_0x1307d6[_0xd3ac('0x3b')]=[{'all':!![]}];}return db[_0xd3ac('0x3a')][_0xd3ac('0x3c')](_0x1307d6);})[_0xd3ac('0x22')](function(_0x5440c5){_0x7a9107['rows']=_0x5440c5;return _0x7a9107;})['then'](respondWithFilteredResult(_0x270ee7,_0x1307d6))[_0xd3ac('0x3d')](handleError(_0x270ee7,null));};exports[_0xd3ac('0x3e')]=function(_0x2c3c16,_0xf6b81b){var _0x11ea02={'raw':!![],'where':{'id':_0x2c3c16[_0xd3ac('0x3f')]['id']}},_0x28b73d={};_0x28b73d[_0xd3ac('0x2a')]=_['keys'](db[_0xd3ac('0x3a')][_0xd3ac('0x40')]);_0x28b73d[_0xd3ac('0x2c')]=_[_0xd3ac('0x41')](_0x2c3c16[_0xd3ac('0x2c')]);_0x28b73d[_0xd3ac('0x2d')]=_[_0xd3ac('0x2e')](_0x28b73d['model'],_0x28b73d[_0xd3ac('0x2c')]);_0x11ea02[_0xd3ac('0x2f')]=_['intersection'](_0x28b73d[_0xd3ac('0x2a')],qs[_0xd3ac('0x30')](_0x2c3c16[_0xd3ac('0x2c')][_0xd3ac('0x30')]));_0x11ea02['attributes']=_0x11ea02[_0xd3ac('0x2f')][_0xd3ac('0x31')]?_0x11ea02[_0xd3ac('0x2f')]:_0x28b73d['model'];if(_0x2c3c16[_0xd3ac('0x2c')][_0xd3ac('0x42')]){_0x11ea02[_0xd3ac('0x3b')]=[{'all':!![]}];}_0x11ea02=_['merge']({},_0x11ea02,_0x2c3c16[_0xd3ac('0x43')]);return db[_0xd3ac('0x3a')][_0xd3ac('0x44')](_0x11ea02)['then'](handleEntityNotFound(_0xf6b81b,null))[_0xd3ac('0x22')](respondWithResult(_0xf6b81b,null))[_0xd3ac('0x3d')](handleError(_0xf6b81b,null));};exports[_0xd3ac('0x45')]=function(_0x2e70c0,_0x181c27){return db[_0xd3ac('0x3a')]['create'](_0x2e70c0[_0xd3ac('0x46')],{})['then'](respondWithResult(_0x181c27,0xc9))[_0xd3ac('0x3d')](handleError(_0x181c27,null));};exports[_0xd3ac('0x21')]=function(_0x4ff4e3,_0x4a0335){if(_0x4ff4e3[_0xd3ac('0x46')]['id']){delete _0x4ff4e3[_0xd3ac('0x46')]['id'];}return db[_0xd3ac('0x3a')][_0xd3ac('0x44')]({'where':{'id':_0x4ff4e3[_0xd3ac('0x3f')]['id']}})[_0xd3ac('0x22')](handleEntityNotFound(_0x4a0335,null))['then'](saveUpdates(_0x4ff4e3[_0xd3ac('0x46')],null))['then'](respondWithResult(_0x4a0335,null))[_0xd3ac('0x3d')](handleError(_0x4a0335,null));};exports[_0xd3ac('0x23')]=function(_0x33c1fb,_0xabaf73){return db[_0xd3ac('0x3a')][_0xd3ac('0x44')]({'where':{'id':_0x33c1fb[_0xd3ac('0x3f')]['id']}})[_0xd3ac('0x22')](handleEntityNotFound(_0xabaf73,null))[_0xd3ac('0x22')](removeEntity(_0xabaf73,null))[_0xd3ac('0x3d')](handleError(_0xabaf73,null));};exports[_0xd3ac('0x47')]=function(_0x364a17,_0x49a42a,_0x51b431){return db['VoiceMailMessage']['find']({'where':{'id':_0x364a17[_0xd3ac('0x3f')]['id']},'attributes':['id',_0xd3ac('0x48'),_0xd3ac('0x49')]})['then'](handleEntityNotFound(_0x49a42a,null))[_0xd3ac('0x22')](function(_0x36af09){if(_0x36af09){if(!_0x36af09[_0xd3ac('0x48')]){throw new db[(_0xd3ac('0x4a'))][(_0xd3ac('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x3a7f77={'Content-Type':_0xd3ac('0x4c'),'Content-Disposition':_0xd3ac('0x4d')};if(_0x36af09[_0xd3ac('0x49')]){_0x3a7f77[_0xd3ac('0x4e')]=_0xd3ac('0x4f')+_0x36af09[_0xd3ac('0x49')]+_0xd3ac('0x50');}_0x49a42a[_0xd3ac('0x51')](_0x3a7f77);return _0x49a42a[_0xd3ac('0x27')](new Buffer(_0x36af09[_0xd3ac('0x48')]));}})[_0xd3ac('0x3d')](handleError(_0x49a42a,null));}; \ No newline at end of file +var _0xb2f7=['model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','create','body','find','catch','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','map','VoiceMailMessage','rawAttributes','fieldName','type','differenceBy','name','query','keys','intersection'];(function(_0x3a35b6,_0x2be82f){var _0x5796b6=function(_0x2ef5d){while(--_0x2ef5d){_0x3a35b6['push'](_0x3a35b6['shift']());}};_0x5796b6(++_0x2be82f);}(_0xb2f7,0x12d));var _0x7b2f=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xb2f7[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0x7b2f('0x0'));var rimraf=require(_0x7b2f('0x1'));var zipdir=require(_0x7b2f('0x2'));var jsonpatch=require(_0x7b2f('0x3'));var rp=require(_0x7b2f('0x4'));var moment=require(_0x7b2f('0x5'));var BPromise=require(_0x7b2f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7b2f('0x7'));var sox=require(_0x7b2f('0x8'));var csv=require(_0x7b2f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b2f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7b2f('0xb'));var jsforce=require(_0x7b2f('0xc'));var deskjs=require(_0x7b2f('0xd'));var toCsv=require(_0x7b2f('0x9'));var querystring=require('querystring');var Papa=require(_0x7b2f('0xe'));var Redis=require(_0x7b2f('0xf'));var authService=require(_0x7b2f('0x10'));var qs=require(_0x7b2f('0x11'));var as=require(_0x7b2f('0x12'));var hardwareService=require(_0x7b2f('0x13'));var logger=require(_0x7b2f('0x14'))(_0x7b2f('0x15'));var utils=require(_0x7b2f('0x16'));var config=require(_0x7b2f('0x17'));var licenseUtil=require(_0x7b2f('0x18'));var db=require(_0x7b2f('0x19'))['db'];function respondWithStatusCode(_0x3e3a63,_0x540d76){_0x540d76=_0x540d76||0xcc;return function(_0x260758){if(_0x260758){return _0x3e3a63[_0x7b2f('0x1a')](_0x540d76);}return _0x3e3a63[_0x7b2f('0x1b')](_0x540d76)[_0x7b2f('0x1c')]();};}function respondWithResult(_0x430b32,_0x1f22ce){_0x1f22ce=_0x1f22ce||0xc8;return function(_0xd2cb75){if(_0xd2cb75){return _0x430b32[_0x7b2f('0x1b')](_0x1f22ce)['json'](_0xd2cb75);}};}function respondWithFilteredResult(_0x1b7ae5,_0x74f7b){return function(_0x1562d0){if(_0x1562d0){var _0x5c0b2f=typeof _0x74f7b[_0x7b2f('0x1d')]===_0x7b2f('0x1e')&&typeof _0x74f7b['limit']===_0x7b2f('0x1e');var _0x4b1088=_0x1562d0['count'];var _0x10cb08=_0x5c0b2f?0x0:_0x74f7b[_0x7b2f('0x1d')];var _0x2759fe=_0x5c0b2f?_0x1562d0[_0x7b2f('0x1f')]:_0x74f7b['offset']+_0x74f7b[_0x7b2f('0x20')];var _0x40382b;if(_0x2759fe>=_0x4b1088){_0x2759fe=_0x4b1088;_0x40382b=0xc8;}else{_0x40382b=0xce;}_0x1b7ae5[_0x7b2f('0x1b')](_0x40382b);return _0x1b7ae5[_0x7b2f('0x21')](_0x7b2f('0x22'),_0x10cb08+'-'+_0x2759fe+'/'+_0x4b1088)[_0x7b2f('0x23')](_0x1562d0);}return null;};}function patchUpdates(_0x288f7c){return function(_0x1b8791){try{jsonpatch[_0x7b2f('0x24')](_0x1b8791,_0x288f7c,!![]);}catch(_0x121d60){return BPromise[_0x7b2f('0x25')](_0x121d60);}return _0x1b8791[_0x7b2f('0x26')]();};}function saveUpdates(_0x6d4cf3,_0x5b6339){return function(_0x1cddc4){if(_0x1cddc4){return _0x1cddc4[_0x7b2f('0x27')](_0x6d4cf3)[_0x7b2f('0x28')](function(_0x21e2fc){return _0x21e2fc;});}return null;};}function removeEntity(_0x19de27,_0x73507e){return function(_0x4a2e98){if(_0x4a2e98){return _0x4a2e98[_0x7b2f('0x29')]()[_0x7b2f('0x28')](function(){_0x19de27['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10765d,_0x2cc667){return function(_0x5af5ad){if(!_0x5af5ad){_0x10765d[_0x7b2f('0x1a')](0x194);}return _0x5af5ad;};}function handleError(_0x5ce216,_0x3e1969){_0x3e1969=_0x3e1969||0x1f4;return function(_0x9da085){logger[_0x7b2f('0x2a')](_0x9da085[_0x7b2f('0x2b')]);if(_0x9da085['name']){delete _0x9da085['name'];}_0x5ce216[_0x7b2f('0x1b')](_0x3e1969)[_0x7b2f('0x2c')](_0x9da085);};}exports['index']=function(_0x316a00,_0x3f1ec1){var _0x56b5b3={},_0x3fa408={},_0x5de625={'count':0x0,'rows':[]};var _0x395dd2=_[_0x7b2f('0x2d')](db[_0x7b2f('0x2e')][_0x7b2f('0x2f')],function(_0x20eff6){return{'name':_0x20eff6[_0x7b2f('0x30')],'type':_0x20eff6[_0x7b2f('0x31')]['key']};});_0x3fa408['model']=_[_0x7b2f('0x32')](_[_0x7b2f('0x2d')](_0x395dd2,'name'),[_0x7b2f('0x33')]);_0x3fa408[_0x7b2f('0x34')]=_[_0x7b2f('0x35')](_0x316a00[_0x7b2f('0x34')]);_0x3fa408['filters']=_[_0x7b2f('0x36')](_0x3fa408['model'],_0x3fa408[_0x7b2f('0x34')]);_0x56b5b3['attributes']=_[_0x7b2f('0x36')](_0x3fa408[_0x7b2f('0x37')],qs[_0x7b2f('0x38')](_0x316a00[_0x7b2f('0x34')][_0x7b2f('0x38')]));_0x56b5b3[_0x7b2f('0x39')]=_0x56b5b3['attributes'][_0x7b2f('0x3a')]?_0x56b5b3['attributes']:_0x3fa408[_0x7b2f('0x37')];if(!_0x316a00['query'][_0x7b2f('0x3b')](_0x7b2f('0x3c'))){_0x56b5b3[_0x7b2f('0x20')]=qs[_0x7b2f('0x20')](_0x316a00['query']['limit']);_0x56b5b3['offset']=qs[_0x7b2f('0x1d')](_0x316a00[_0x7b2f('0x34')][_0x7b2f('0x1d')]);}_0x56b5b3[_0x7b2f('0x3d')]=qs[_0x7b2f('0x3e')](_0x316a00['query'][_0x7b2f('0x3e')]);_0x56b5b3[_0x7b2f('0x3f')]=qs['filters'](_[_0x7b2f('0x40')](_0x316a00[_0x7b2f('0x34')],_0x3fa408[_0x7b2f('0x41')]),_0x395dd2);if(_0x316a00[_0x7b2f('0x34')]['filter']){_0x56b5b3[_0x7b2f('0x3f')]=_[_0x7b2f('0x42')](_0x56b5b3['where'],{'$or':_['map'](_0x395dd2,function(_0x19cdd6){if(_0x19cdd6[_0x7b2f('0x31')]!==_0x7b2f('0x43')){var _0x134fa7={};_0x134fa7[_0x19cdd6['name']]={'$like':'%'+_0x316a00[_0x7b2f('0x34')][_0x7b2f('0x44')]+'%'};return _0x134fa7;}})});}_0x56b5b3=_[_0x7b2f('0x42')]({},_0x56b5b3,_0x316a00[_0x7b2f('0x45')]);var _0x484696={'where':_0x56b5b3['where']};return db['VoiceMailMessage'][_0x7b2f('0x1f')](_0x484696)[_0x7b2f('0x28')](function(_0x4748d5){_0x5de625['count']=_0x4748d5;if(_0x316a00[_0x7b2f('0x34')]['includeAll']){_0x56b5b3[_0x7b2f('0x46')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x7b2f('0x47')](_0x56b5b3);})[_0x7b2f('0x28')](function(_0x4e6c04){_0x5de625[_0x7b2f('0x48')]=_0x4e6c04;return _0x5de625;})[_0x7b2f('0x28')](respondWithFilteredResult(_0x3f1ec1,_0x56b5b3))['catch'](handleError(_0x3f1ec1,null));};exports[_0x7b2f('0x49')]=function(_0x36a106,_0x316b0f){var _0x5cf63d={'raw':!![],'where':{'id':_0x36a106[_0x7b2f('0x4a')]['id']}},_0x5b8457={};_0x5b8457[_0x7b2f('0x37')]=_[_0x7b2f('0x35')](db[_0x7b2f('0x2e')]['rawAttributes']);_0x5b8457[_0x7b2f('0x34')]=_['keys'](_0x36a106[_0x7b2f('0x34')]);_0x5b8457['filters']=_['intersection'](_0x5b8457[_0x7b2f('0x37')],_0x5b8457[_0x7b2f('0x34')]);_0x5cf63d[_0x7b2f('0x39')]=_[_0x7b2f('0x36')](_0x5b8457[_0x7b2f('0x37')],qs['fields'](_0x36a106[_0x7b2f('0x34')]['fields']));_0x5cf63d[_0x7b2f('0x39')]=_0x5cf63d[_0x7b2f('0x39')][_0x7b2f('0x3a')]?_0x5cf63d[_0x7b2f('0x39')]:_0x5b8457[_0x7b2f('0x37')];if(_0x36a106[_0x7b2f('0x34')]['includeAll']){_0x5cf63d[_0x7b2f('0x46')]=[{'all':!![]}];}_0x5cf63d=_['merge']({},_0x5cf63d,_0x36a106[_0x7b2f('0x45')]);return db['VoiceMailMessage']['find'](_0x5cf63d)[_0x7b2f('0x28')](handleEntityNotFound(_0x316b0f,null))['then'](respondWithResult(_0x316b0f,null))['catch'](handleError(_0x316b0f,null));};exports[_0x7b2f('0x4b')]=function(_0x353c25,_0x23dc66){return db[_0x7b2f('0x2e')][_0x7b2f('0x4b')](_0x353c25[_0x7b2f('0x4c')],{})[_0x7b2f('0x28')](respondWithResult(_0x23dc66,0xc9))['catch'](handleError(_0x23dc66,null));};exports[_0x7b2f('0x27')]=function(_0x19d945,_0x4bc4ca){if(_0x19d945['body']['id']){delete _0x19d945[_0x7b2f('0x4c')]['id'];}return db[_0x7b2f('0x2e')][_0x7b2f('0x4d')]({'where':{'id':_0x19d945[_0x7b2f('0x4a')]['id']}})[_0x7b2f('0x28')](handleEntityNotFound(_0x4bc4ca,null))[_0x7b2f('0x28')](saveUpdates(_0x19d945[_0x7b2f('0x4c')],null))[_0x7b2f('0x28')](respondWithResult(_0x4bc4ca,null))['catch'](handleError(_0x4bc4ca,null));};exports[_0x7b2f('0x29')]=function(_0x5b9e5b,_0x5f7df4){return db['VoiceMailMessage'][_0x7b2f('0x4d')]({'where':{'id':_0x5b9e5b[_0x7b2f('0x4a')]['id']}})[_0x7b2f('0x28')](handleEntityNotFound(_0x5f7df4,null))[_0x7b2f('0x28')](removeEntity(_0x5f7df4,null))[_0x7b2f('0x4e')](handleError(_0x5f7df4,null));};exports[_0x7b2f('0x4f')]=function(_0x361d50,_0x311dcb,_0x47c059){return db[_0x7b2f('0x2e')][_0x7b2f('0x4d')]({'where':{'id':_0x361d50[_0x7b2f('0x4a')]['id']},'attributes':['id',_0x7b2f('0x50'),_0x7b2f('0x51')]})['then'](handleEntityNotFound(_0x311dcb,null))[_0x7b2f('0x28')](function(_0x9f3884){if(_0x9f3884){if(!_0x9f3884[_0x7b2f('0x50')]){throw new db[(_0x7b2f('0x52'))][(_0x7b2f('0x53'))](_0x7b2f('0x54'));}var _0x2f449c={'Content-Type':_0x7b2f('0x55'),'Content-Disposition':_0x7b2f('0x56')};if(_0x9f3884[_0x7b2f('0x51')]){_0x2f449c[_0x7b2f('0x57')]=_0x7b2f('0x58')+_0x9f3884[_0x7b2f('0x51')]+'.wav\x22';}_0x311dcb[_0x7b2f('0x21')](_0x2f449c);return _0x311dcb[_0x7b2f('0x2c')](new Buffer(_0x9f3884[_0x7b2f('0x50')]));}})[_0x7b2f('0x4e')](handleError(_0x311dcb,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 35a6323..b7ea5a9 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 _0xc5b0=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceMailMessage.attributes'];(function(_0x2d5e48,_0x4b0937){var _0x50e8b5=function(_0x5a0320){while(--_0x5a0320){_0x2d5e48['push'](_0x2d5e48['shift']());}};_0x50e8b5(++_0x4b0937);}(_0xc5b0,0x65));var _0x0c5b=function(_0xc1a7d3,_0x6ac180){_0xc1a7d3=_0xc1a7d3-0x0;var _0x576e8d=_0xc5b0[_0xc1a7d3];return _0x576e8d;};'use strict';var _=require('lodash');var util=require(_0x0c5b('0x0'));var logger=require(_0x0c5b('0x1'))(_0x0c5b('0x2'));var moment=require('moment');var BPromise=require(_0x0c5b('0x3'));var rp=require(_0x0c5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c5b('0x5'));var config=require('../../config/environment');var attributes=require(_0x0c5b('0x6'));module[_0x0c5b('0x7')]=function(_0x3c660f,_0x1ab812){return _0x3c660f[_0x0c5b('0x8')](_0x0c5b('0x9'),attributes,{'tableName':_0x0c5b('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x0c5b('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x09ba=['dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages'];(function(_0x113bee,_0x1ded16){var _0x19875f=function(_0x210c93){while(--_0x210c93){_0x113bee['push'](_0x113bee['shift']());}};_0x19875f(++_0x1ded16);}(_0x09ba,0x135));var _0xa09b=function(_0x7edec1,_0x31f0f0){_0x7edec1=_0x7edec1-0x0;var _0x4c58c0=_0x09ba[_0x7edec1];return _0x4c58c0;};'use strict';var _=require(_0xa09b('0x0'));var util=require(_0xa09b('0x1'));var logger=require('../../config/logger')(_0xa09b('0x2'));var moment=require(_0xa09b('0x3'));var BPromise=require(_0xa09b('0x4'));var rp=require(_0xa09b('0x5'));var fs=require('fs');var path=require(_0xa09b('0x6'));var rimraf=require(_0xa09b('0x7'));var config=require(_0xa09b('0x8'));var attributes=require(_0xa09b('0x9'));module[_0xa09b('0xa')]=function(_0xfc3800,_0x3fd7d4){return _0xfc3800['define'](_0xa09b('0xb'),attributes,{'tableName':_0xa09b('0xc'),'paranoid':![],'indexes':[{'name':_0xa09b('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7c7c103..677c92c 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 _0x99d9=['catch','util','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x277fe7,_0x921c17){var _0x361fd0=function(_0x5f59d6){while(--_0x5f59d6){_0x277fe7['push'](_0x277fe7['shift']());}};_0x361fd0(++_0x921c17);}(_0x99d9,0x133));var _0x999d=function(_0x2ba61c,_0x7e207b){_0x2ba61c=_0x2ba61c-0x0;var _0x14cbe9=_0x99d9[_0x2ba61c];return _0x14cbe9;};'use strict';var _=require('lodash');var util=require(_0x999d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x999d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999d('0x2'))['db'];var utils=require(_0x999d('0x3'));var logger=require('../../config/logger')(_0x999d('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x999d('0x5')][_0x999d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x323575,_0x269008,_0x58d55b){return new BPromise(function(_0x3840fd,_0x49c683){return client[_0x999d('0x7')](_0x323575,_0x58d55b)['then'](function(_0x43e8a8){logger[_0x999d('0x8')](_0x999d('0x9'),_0x269008,_0x999d('0xa'));logger[_0x999d('0xb')](_0x999d('0xc'),_0x269008,_0x999d('0xa'),JSON['stringify'](_0x43e8a8));if(_0x43e8a8['error']){if(_0x43e8a8[_0x999d('0xd')][_0x999d('0xe')]===0x1f4){logger['error'](_0x999d('0x9'),_0x269008,_0x43e8a8[_0x999d('0xd')][_0x999d('0xf')]);return _0x49c683(_0x43e8a8[_0x999d('0xd')][_0x999d('0xf')]);}logger[_0x999d('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x269008,_0x43e8a8[_0x999d('0xd')]['message']);return _0x3840fd(_0x43e8a8[_0x999d('0xd')][_0x999d('0xf')]);}else{logger['info'](_0x999d('0x9'),_0x269008,_0x999d('0xa'));_0x3840fd(_0x43e8a8[_0x999d('0x10')][_0x999d('0xf')]);}})[_0x999d('0x11')](function(_0x5c14da){logger[_0x999d('0xd')](_0x999d('0x9'),_0x269008,_0x5c14da);_0x49c683(_0x5c14da);});});} \ No newline at end of file +var _0x3960=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x429ee0,_0xdc2143){var _0x1cda73=function(_0x3ca984){while(--_0x3ca984){_0x429ee0['push'](_0x429ee0['shift']());}};_0x1cda73(++_0xdc2143);}(_0x3960,0xa8));var _0x0396=function(_0x24cb8b,_0x1a4405){_0x24cb8b=_0x24cb8b-0x0;var _0x5bfd3c=_0x3960[_0x24cb8b];return _0x5bfd3c;};'use strict';var _=require(_0x0396('0x0'));var util=require(_0x0396('0x1'));var moment=require('moment');var BPromise=require(_0x0396('0x2'));var rs=require(_0x0396('0x3'));var fs=require('fs');var Redis=require(_0x0396('0x4'));var db=require(_0x0396('0x5'))['db'];var utils=require(_0x0396('0x6'));var logger=require(_0x0396('0x7'))('rpc');var config=require(_0x0396('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0396('0x9')][_0x0396('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58cf15,_0x389d09,_0x45aa4d){return new BPromise(function(_0x12b0ae,_0x4c2e88){return client[_0x0396('0xb')](_0x58cf15,_0x45aa4d)['then'](function(_0x5abf61){logger[_0x0396('0xc')](_0x0396('0xd'),_0x389d09,_0x0396('0xe'));logger[_0x0396('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x389d09,_0x0396('0xe'),JSON['stringify'](_0x5abf61));if(_0x5abf61[_0x0396('0x10')]){if(_0x5abf61[_0x0396('0x10')][_0x0396('0x11')]===0x1f4){logger[_0x0396('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x389d09,_0x5abf61[_0x0396('0x10')][_0x0396('0x12')]);return _0x4c2e88(_0x5abf61[_0x0396('0x10')][_0x0396('0x12')]);}logger[_0x0396('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x389d09,_0x5abf61[_0x0396('0x10')][_0x0396('0x12')]);return _0x12b0ae(_0x5abf61[_0x0396('0x10')][_0x0396('0x12')]);}else{logger[_0x0396('0xc')](_0x0396('0xd'),_0x389d09,_0x0396('0xe'));_0x12b0ae(_0x5abf61[_0x0396('0x13')][_0x0396('0x12')]);}})[_0x0396('0x14')](function(_0x52660a){logger[_0x0396('0x10')](_0x0396('0xd'),_0x389d09,_0x52660a);_0x4c2e88(_0x52660a);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index e32ae29..e140d0a 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 _0xce0b=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','post','create','addSound','/:id','delete','destroy','removeSound','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0xce0b,0x15f));var _0xbce0=function(_0x485cca,_0x316194){_0x485cca=_0x485cca-0x0;var _0x1eeaa0=_0xce0b[_0x485cca];return _0x1eeaa0;};'use strict';var multer=require('multer');var util=require(_0xbce0('0x0'));var path=require(_0xbce0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbce0('0x2')]();var fs_extra=require(_0xbce0('0x3'));var auth=require(_0xbce0('0x4'));var interaction=require(_0xbce0('0x5'));var config=require(_0xbce0('0x6'));var controller=require(_0xbce0('0x7'));router[_0xbce0('0x8')]('/',auth[_0xbce0('0x9')](),controller[_0xbce0('0xa')]);router['get']('/:id',auth[_0xbce0('0x9')](),controller[_0xbce0('0xb')]);router[_0xbce0('0x8')](_0xbce0('0xc'),auth['isAuthenticated'](),controller['getSounds']);router[_0xbce0('0xd')]('/',auth[_0xbce0('0x9')](),controller[_0xbce0('0xe')]);router[_0xbce0('0xd')](_0xbce0('0xc'),auth[_0xbce0('0x9')](),controller[_0xbce0('0xf')]);router['put'](_0xbce0('0x10'),auth[_0xbce0('0x9')](),controller['update']);router[_0xbce0('0x11')](_0xbce0('0x10'),auth[_0xbce0('0x9')](),controller[_0xbce0('0x12')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xbce0('0x13')]);module[_0xbce0('0x14')]=router; \ No newline at end of file +var _0xee5f=['getSounds','create','post','put','destroy','/:id/sounds/:id2','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds'];(function(_0x24a196,_0x212f3c){var _0x29b84f=function(_0x149bbd){while(--_0x149bbd){_0x24a196['push'](_0x24a196['shift']());}};_0x29b84f(++_0x212f3c);}(_0xee5f,0x1c0));var _0xfee5=function(_0x197f3d,_0x57cde0){_0x197f3d=_0x197f3d-0x0;var _0x535fb1=_0xee5f[_0x197f3d];return _0x535fb1;};'use strict';var multer=require(_0xfee5('0x0'));var util=require(_0xfee5('0x1'));var path=require('path');var timeout=require(_0xfee5('0x2'));var express=require('express');var router=express[_0xfee5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xfee5('0x4'));var interaction=require(_0xfee5('0x5'));var config=require(_0xfee5('0x6'));var controller=require(_0xfee5('0x7'));router[_0xfee5('0x8')]('/',auth[_0xfee5('0x9')](),controller[_0xfee5('0xa')]);router[_0xfee5('0x8')](_0xfee5('0xb'),auth[_0xfee5('0x9')](),controller[_0xfee5('0xc')]);router[_0xfee5('0x8')](_0xfee5('0xd'),auth['isAuthenticated'](),controller[_0xfee5('0xe')]);router['post']('/',auth[_0xfee5('0x9')](),controller[_0xfee5('0xf')]);router[_0xfee5('0x10')](_0xfee5('0xd'),auth[_0xfee5('0x9')](),controller['addSound']);router[_0xfee5('0x11')]('/:id',auth[_0xfee5('0x9')](),controller['update']);router['delete'](_0xfee5('0xb'),auth[_0xfee5('0x9')](),controller[_0xfee5('0x12')]);router['delete'](_0xfee5('0x13'),auth[_0xfee5('0x9')](),controller['removeSound']);module[_0xfee5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 361fa1a..3f3a027 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 _0x7420=['sequelize','exports','STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','alpha','TIMESTAMP','BOOLEAN'];(function(_0x4cf97f,_0x3bcb11){var _0x41106a=function(_0x31c7fb){while(--_0x31c7fb){_0x4cf97f['push'](_0x4cf97f['shift']());}};_0x41106a(++_0x3bcb11);}(_0x7420,0x6c));var _0x0742=function(_0x302d62,_0x97710d){_0x302d62=_0x302d62-0x0;var _0x43a9a7=_0x7420[_0x302d62];return _0x43a9a7;};'use strict';var Sequelize=require(_0x0742('0x0'));module[_0x0742('0x1')]={'name':{'type':Sequelize[_0x0742('0x2')],'allowNull':![],'unique':_0x0742('0x3')},'mode':{'type':Sequelize[_0x0742('0x4')](_0x0742('0x5'),_0x0742('0x6'),_0x0742('0x7'),_0x0742('0x8'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x0742('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![],'defaultValue':_0x0742('0x9')},'format':{'type':Sequelize[_0x0742('0x2')],'allowNull':!![]},'stamp':{'type':_0x0742('0xa')},'defaultEntry':{'type':Sequelize[_0x0742('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x472a=['mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','custom','mp3nb','quietmp3nb','quietmp3'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x472a,0x185));var _0xa472=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0x472a[_0x401ccd];return _0x5a57ad;};'use strict';var Sequelize=require(_0xa472('0x0'));module[_0xa472('0x1')]={'name':{'type':Sequelize[_0xa472('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xa472('0x3'),'files',_0xa472('0x4'),_0xa472('0x5'),_0xa472('0x6'),_0xa472('0x7')),'allowNull':!![],'defaultValue':_0xa472('0x8')},'directory':{'type':Sequelize[_0xa472('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa472('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa472('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa472('0x2')],'allowNull':!![],'defaultValue':_0xa472('0x9')},'format':{'type':Sequelize[_0xa472('0x2')],'allowNull':!![]},'stamp':{'type':_0xa472('0xa')},'defaultEntry':{'type':Sequelize[_0xa472('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 bd72693..2d297d2 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 _0x1e74=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','error','stack','name','VoiceMusicOnHold','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','length','body','find','params','mode','directory','join','root','server/files/moh','create','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','transaction','forEach','unlinkSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','extname','ValidationError','removeSound','sequelize','id2','%s.%s','getSounds','pick','filter','eml-format','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x21bdd1,_0x3f7cd8){var _0x30514e=function(_0x4c644a){while(--_0x4c644a){_0x21bdd1['push'](_0x21bdd1['shift']());}};_0x30514e(++_0x3f7cd8);}(_0x1e74,0xc9));var _0x41e7=function(_0x227ca3,_0x2a1ab2){_0x227ca3=_0x227ca3-0x0;var _0x17ca7e=_0x1e74[_0x227ca3];return _0x17ca7e;};'use strict';var emlformat=require(_0x41e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x41e7('0x1'));var jsonpatch=require(_0x41e7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x41e7('0x3'));var Mustache=require(_0x41e7('0x4'));var util=require('util');var path=require('path');var sox=require(_0x41e7('0x5'));var csv=require(_0x41e7('0x6'));var ejs=require(_0x41e7('0x7'));var fs=require('fs');var fs_extra=require(_0x41e7('0x8'));var _=require(_0x41e7('0x9'));var squel=require(_0x41e7('0xa'));var crypto=require(_0x41e7('0xb'));var jsforce=require(_0x41e7('0xc'));var deskjs=require(_0x41e7('0xd'));var toCsv=require(_0x41e7('0x6'));var querystring=require(_0x41e7('0xe'));var Papa=require(_0x41e7('0xf'));var Redis=require(_0x41e7('0x10'));var authService=require(_0x41e7('0x11'));var qs=require(_0x41e7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41e7('0x13'));var logger=require(_0x41e7('0x14'))(_0x41e7('0x15'));var utils=require(_0x41e7('0x16'));var config=require(_0x41e7('0x17'));var licenseUtil=require(_0x41e7('0x18'));var db=require(_0x41e7('0x19'))['db'];function respondWithStatusCode(_0x193af5,_0x26251d){_0x26251d=_0x26251d||0xcc;return function(_0x5c2b5d){if(_0x5c2b5d){return _0x193af5[_0x41e7('0x1a')](_0x26251d);}return _0x193af5['status'](_0x26251d)['end']();};}function respondWithResult(_0x2fffce,_0x27fc9c){_0x27fc9c=_0x27fc9c||0xc8;return function(_0x10d6d2){if(_0x10d6d2){return _0x2fffce[_0x41e7('0x1b')](_0x27fc9c)[_0x41e7('0x1c')](_0x10d6d2);}};}function respondWithFilteredResult(_0x6b3e6d,_0x570532){return function(_0x22694a){if(_0x22694a){var _0x4219ce=typeof _0x570532[_0x41e7('0x1d')]===_0x41e7('0x1e')&&typeof _0x570532[_0x41e7('0x1f')]===_0x41e7('0x1e');var _0x418d28=_0x22694a['count'];var _0x5be138=_0x4219ce?0x0:_0x570532[_0x41e7('0x1d')];var _0x2d0b64=_0x4219ce?_0x22694a[_0x41e7('0x20')]:_0x570532[_0x41e7('0x1d')]+_0x570532[_0x41e7('0x1f')];var _0x1d5dd6;if(_0x2d0b64>=_0x418d28){_0x2d0b64=_0x418d28;_0x1d5dd6=0xc8;}else{_0x1d5dd6=0xce;}_0x6b3e6d[_0x41e7('0x1b')](_0x1d5dd6);return _0x6b3e6d[_0x41e7('0x21')](_0x41e7('0x22'),_0x5be138+'-'+_0x2d0b64+'/'+_0x418d28)[_0x41e7('0x1c')](_0x22694a);}return null;};}function patchUpdates(_0x40404e){return function(_0x46a92d){try{jsonpatch['apply'](_0x46a92d,_0x40404e,!![]);}catch(_0x4b27ac){return BPromise[_0x41e7('0x23')](_0x4b27ac);}return _0x46a92d[_0x41e7('0x24')]();};}function saveUpdates(_0x100dba,_0x5b41f1){return function(_0x5e6d71){if(_0x5e6d71){return _0x5e6d71[_0x41e7('0x25')](_0x100dba)['then'](function(_0x187c17){return _0x187c17;});}return null;};}function removeEntity(_0x5861a6,_0x1def96){return function(_0x444b15){if(_0x444b15){return _0x444b15[_0x41e7('0x26')]()[_0x41e7('0x27')](function(){var _0x39ad84=_0x444b15[_0x41e7('0x28')]({'plain':!![]});var _0x230be3=_0x41e7('0x29');return db[_0x41e7('0x2a')][_0x41e7('0x26')]({'where':{'type':_0x230be3,'resourceId':_0x39ad84['id']}})[_0x41e7('0x27')](function(){return _0x444b15;});})['then'](function(){_0x5861a6[_0x41e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f5c16,_0x451801){return function(_0x31bec8){if(!_0x31bec8){_0x1f5c16[_0x41e7('0x1a')](0x194);}return _0x31bec8;};}function handleError(_0x2a2903,_0x283070){_0x283070=_0x283070||0x1f4;return function(_0x1f8fcd){logger[_0x41e7('0x2b')](_0x1f8fcd[_0x41e7('0x2c')]);if(_0x1f8fcd[_0x41e7('0x2d')]){delete _0x1f8fcd[_0x41e7('0x2d')];}_0x2a2903[_0x41e7('0x1b')](_0x283070)['send'](_0x1f8fcd);};}exports['index']=function(_0x13cc80,_0x499041){var _0x212723={},_0x1bd511={},_0x5294fb={'count':0x0,'rows':[]};var _0x1f0a81=_['map'](db[_0x41e7('0x2e')][_0x41e7('0x2f')],function(_0x1dafe6){return{'name':_0x1dafe6[_0x41e7('0x30')],'type':_0x1dafe6['type'][_0x41e7('0x31')]};});_0x1bd511[_0x41e7('0x32')]=_[_0x41e7('0x33')](_0x1f0a81,_0x41e7('0x2d'));_0x1bd511[_0x41e7('0x34')]=_['keys'](_0x13cc80[_0x41e7('0x34')]);_0x1bd511[_0x41e7('0x35')]=_[_0x41e7('0x36')](_0x1bd511[_0x41e7('0x32')],_0x1bd511[_0x41e7('0x34')]);_0x212723['attributes']=_['intersection'](_0x1bd511[_0x41e7('0x32')],qs[_0x41e7('0x37')](_0x13cc80['query'][_0x41e7('0x37')]));_0x212723[_0x41e7('0x38')]=_0x212723[_0x41e7('0x38')]['length']?_0x212723['attributes']:_0x1bd511[_0x41e7('0x32')];if(!_0x13cc80[_0x41e7('0x34')][_0x41e7('0x39')](_0x41e7('0x3a'))){_0x212723[_0x41e7('0x1f')]=qs[_0x41e7('0x1f')](_0x13cc80[_0x41e7('0x34')][_0x41e7('0x1f')]);_0x212723[_0x41e7('0x1d')]=qs['offset'](_0x13cc80['query'][_0x41e7('0x1d')]);}_0x212723[_0x41e7('0x3b')]=qs['sort'](_0x13cc80['query']['sort']);delete _0x13cc80[_0x41e7('0x34')][_0x41e7('0x3c')];_0x212723[_0x41e7('0x3d')]=qs[_0x41e7('0x35')](_['pick'](_0x13cc80['query'],_0x1bd511[_0x41e7('0x35')]),_0x1f0a81);if(_0x13cc80[_0x41e7('0x34')]['filter']){_0x212723[_0x41e7('0x3d')]=_['merge'](_0x212723[_0x41e7('0x3d')],{'$or':_[_0x41e7('0x33')](_0x1f0a81,function(_0x114f88){if(_0x114f88['type']!==_0x41e7('0x3e')){var _0x5df1dc={};_0x5df1dc[_0x114f88[_0x41e7('0x2d')]]={'$like':'%'+_0x13cc80[_0x41e7('0x34')]['filter']+'%'};return _0x5df1dc;}})});}_0x212723=_[_0x41e7('0x3f')]({},_0x212723,_0x13cc80[_0x41e7('0x40')]);var _0x380084={'where':_0x212723['where']};return db['VoiceMusicOnHold'][_0x41e7('0x20')](_0x380084)[_0x41e7('0x27')](function(_0x4eb98d){_0x5294fb[_0x41e7('0x20')]=_0x4eb98d;if(_0x13cc80[_0x41e7('0x34')][_0x41e7('0x41')]){_0x212723[_0x41e7('0x42')]=[{'all':!![]}];}return db[_0x41e7('0x2e')]['findAll'](_0x212723);})['then'](function(_0x1aa249){_0x5294fb[_0x41e7('0x43')]=_0x1aa249;return _0x5294fb;})['then'](respondWithFilteredResult(_0x499041,_0x212723))[_0x41e7('0x44')](handleError(_0x499041,null));};exports[_0x41e7('0x45')]=function(_0x4318bc,_0xf9cc97){var _0x15edff={'raw':![],'where':{'id':_0x4318bc['params']['id']}},_0x55d520={};_0x55d520[_0x41e7('0x32')]=_[_0x41e7('0x46')](db[_0x41e7('0x2e')][_0x41e7('0x2f')]);_0x55d520[_0x41e7('0x34')]=_[_0x41e7('0x46')](_0x4318bc[_0x41e7('0x34')]);_0x55d520[_0x41e7('0x35')]=_[_0x41e7('0x36')](_0x55d520[_0x41e7('0x32')],_0x55d520[_0x41e7('0x34')]);_0x15edff[_0x41e7('0x38')]=_[_0x41e7('0x36')](_0x55d520[_0x41e7('0x32')],qs[_0x41e7('0x37')](_0x4318bc[_0x41e7('0x34')][_0x41e7('0x37')]));_0x15edff[_0x41e7('0x38')]=_0x15edff['attributes'][_0x41e7('0x47')]?_0x15edff[_0x41e7('0x38')]:_0x55d520[_0x41e7('0x32')];if(_0x4318bc[_0x41e7('0x34')][_0x41e7('0x41')]){_0x15edff[_0x41e7('0x42')]=[{'all':!![]}];}_0x15edff=_['merge']({},_0x15edff,_0x4318bc[_0x41e7('0x40')]);return db[_0x41e7('0x2e')]['find'](_0x15edff)['then'](handleEntityNotFound(_0xf9cc97,null))['then'](respondWithResult(_0xf9cc97,null))['catch'](handleError(_0xf9cc97,null));};exports['update']=function(_0x25a69a,_0x27a332){if(_0x25a69a[_0x41e7('0x48')]['id']){delete _0x25a69a[_0x41e7('0x48')]['id'];}return db[_0x41e7('0x2e')][_0x41e7('0x49')]({'where':{'id':_0x25a69a[_0x41e7('0x4a')]['id']}})[_0x41e7('0x27')](handleEntityNotFound(_0x27a332,null))['then'](saveUpdates(_0x25a69a['body'],null))[_0x41e7('0x27')](respondWithResult(_0x27a332,null))[_0x41e7('0x44')](handleError(_0x27a332,null));};exports['create']=function(_0x171358,_0x120767,_0x39470a){return db['sequelize']['transaction'](function(_0x58e771){if(_0x171358[_0x41e7('0x48')][_0x41e7('0x4b')]==='files'){_0x171358[_0x41e7('0x48')][_0x41e7('0x4c')]=path[_0x41e7('0x4d')](config[_0x41e7('0x4e')],_0x41e7('0x4f'),_0x171358['body'][_0x41e7('0x2d')]);}return db[_0x41e7('0x2e')][_0x41e7('0x50')](_0x171358[_0x41e7('0x48')],{'transaction':_0x58e771})['then'](function(_0x4c04ed){if(_0x171358[_0x41e7('0x48')][_0x41e7('0x4b')]===_0x41e7('0x51')){fs[_0x41e7('0x52')](_0x4c04ed[_0x41e7('0x4c')],parseInt(_0x41e7('0x53'),0x8));}var _0x301867=_0x171358[_0x41e7('0x54')]['get']({'plain':!![]});if(!_0x301867)throw new Error(_0x41e7('0x55'));if(_0x301867['role']===_0x41e7('0x54')){var _0x5d64b5=_0x4c04ed['get']({'plain':!![]});return db[_0x41e7('0x56')][_0x41e7('0x49')]({'where':{'name':_0x41e7('0x29'),'userProfileId':_0x301867[_0x41e7('0x57')]},'raw':!![]})[_0x41e7('0x27')](function(_0x5e6c4c){if(_0x5e6c4c&&_0x5e6c4c['autoAssociation']===0x0){return db[_0x41e7('0x2a')][_0x41e7('0x50')]({'name':_0x5d64b5[_0x41e7('0x2d')],'resourceId':_0x5d64b5['id'],'type':_0x5e6c4c['name'],'sectionId':_0x5e6c4c['id']},{})[_0x41e7('0x27')](function(){return _0x4c04ed;});}else{return _0x4c04ed;}})[_0x41e7('0x44')](function(_0x5d29ad){logger[_0x41e7('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d29ad);});}return _0x4c04ed;});})[_0x41e7('0x27')](respondWithResult(_0x120767,0xc9))[_0x41e7('0x44')](handleError(_0x120767,null));};exports[_0x41e7('0x26')]=function(_0x24f3ba,_0x3cff38,_0x571772){var _0x1aab9b;return db[_0x41e7('0x2e')][_0x41e7('0x49')]({'where':{'id':_0x24f3ba[_0x41e7('0x4a')]['id']}})[_0x41e7('0x27')](function(_0x8f4953){if(_0x8f4953){return db['sequelize'][_0x41e7('0x58')](function(_0x150a16){return _0x8f4953[_0x41e7('0x26')]({'transaction':_0x150a16,'raw':!![]})[_0x41e7('0x27')](function(_0x318d64){if(_0x318d64[_0x41e7('0x4c')]){fs['readdirSync'](_0x318d64['directory'])[_0x41e7('0x59')](function(_0x29e5b1){fs[_0x41e7('0x5a')](path[_0x41e7('0x4d')](_0x318d64[_0x41e7('0x4c')],_0x29e5b1));});fs['rmdirSync'](_0x318d64[_0x41e7('0x4c')]);}return _0x318d64;});})['catch'](function(_0x5aced2){throw new db[(_0x41e7('0x5b'))]['ValidationError'](_0x5aced2[_0x41e7('0x5c')]);});}})[_0x41e7('0x27')](handleEntityNotFound(_0x3cff38,null))['then'](removeEntity(_0x3cff38,null))[_0x41e7('0x44')](handleError(_0x3cff38,null));};exports['addSound']=function(_0x214016,_0x9b19e0,_0x49fc43){return db['sequelize']['transaction'](function(_0x4fa1a1){var _0x2bf9f;return db[_0x41e7('0x2e')][_0x41e7('0x49')]({'where':{'id':_0x214016[_0x41e7('0x4a')]['id']}})[_0x41e7('0x27')](function(_0x563f19){if(_0x563f19){_0x2bf9f=_0x563f19;return _0x563f19[_0x41e7('0x5d')](_0x214016[_0x41e7('0x48')]['id'],{'transaction':_0x4fa1a1});}})[_0x41e7('0x27')](function(_0x11132a){if(_0x11132a){return db[_0x41e7('0x5e')][_0x41e7('0x5f')]({'where':{'id':_0x214016['body']['id']},'attributes':['id','name',_0x41e7('0x60'),_0x41e7('0x61'),_0x41e7('0x62')],'raw':!![]});}})[_0x41e7('0x27')](function(_0x48b9b3){if(_0x48b9b3){var _0x19d506=path['join'](config[_0x41e7('0x4e')],_0x41e7('0x63'),util[_0x41e7('0x64')]('%s.%s',path[_0x41e7('0x65')](_0x48b9b3[_0x41e7('0x60')],path[_0x41e7('0x66')](_0x48b9b3['save_name'])),_0x48b9b3[_0x41e7('0x61')]));var _0x5a570f=path[_0x41e7('0x4d')](config['root'],_0x41e7('0x4f'),_0x2bf9f['name'],util[_0x41e7('0x64')]('%s.%s',_0x48b9b3[_0x41e7('0x2d')],_0x48b9b3[_0x41e7('0x61')]));fs['symlinkSync'](_0x19d506,_0x5a570f);return _0x48b9b3;}})[_0x41e7('0x44')](function(_0x41dfc4){throw new db[(_0x41e7('0x5b'))][(_0x41e7('0x67'))](_0x41dfc4[_0x41e7('0x5c')]);});})['then'](handleEntityNotFound(_0x9b19e0,null))[_0x41e7('0x27')](respondWithResult(_0x9b19e0,0xc9))[_0x41e7('0x44')](handleError(_0x9b19e0,null));};exports[_0x41e7('0x68')]=function(_0x207b31,_0x229f32,_0xc14fee){return db[_0x41e7('0x69')][_0x41e7('0x58')](function(_0x55d8a6){var _0x4161ac;return db[_0x41e7('0x2e')]['findOne']({'where':{'id':_0x207b31['params']['id']}})['then'](handleEntityNotFound(_0x229f32,null))[_0x41e7('0x27')](function(_0x3a4f52){if(_0x3a4f52){_0x4161ac=_0x3a4f52;return _0x3a4f52[_0x41e7('0x68')](_0x207b31[_0x41e7('0x4a')][_0x41e7('0x6a')]);}})[_0x41e7('0x27')](function(_0x95c316){if(_0x95c316){return db[_0x41e7('0x5e')][_0x41e7('0x5f')]({'where':{'id':_0x207b31[_0x41e7('0x4a')][_0x41e7('0x6a')]},'attributes':['id',_0x41e7('0x2d'),_0x41e7('0x60'),'converted_format',_0x41e7('0x62')],'raw':!![]});}})[_0x41e7('0x27')](function(_0xfda3b9){if(_0xfda3b9){fs[_0x41e7('0x5a')](path['join'](_0x4161ac[_0x41e7('0x4c')],util['format'](_0x41e7('0x6b'),_0xfda3b9['name'],_0xfda3b9['converted_format'])));return _0xfda3b9;}})[_0x41e7('0x44')](function(_0x36af19){throw new db[(_0x41e7('0x5b'))][(_0x41e7('0x67'))](_0x36af19['message']);});})[_0x41e7('0x27')](handleEntityNotFound(_0x229f32,null))[_0x41e7('0x27')](respondWithStatusCode(_0x229f32,0xcc))[_0x41e7('0x44')](handleError(_0x229f32,null));};exports[_0x41e7('0x6c')]=function(_0x4a78ac,_0x376f26,_0x2e6f9c){var _0x3f4275={};var _0x29a272={};var _0x214a6d;var _0x2fa85d;return db['VoiceMusicOnHold'][_0x41e7('0x5f')]({'where':{'id':_0x4a78ac['params']['id']}})['then'](handleEntityNotFound(_0x376f26,null))[_0x41e7('0x27')](function(_0x7ae06c){if(_0x7ae06c){_0x214a6d=_0x7ae06c;_0x29a272[_0x41e7('0x32')]=_[_0x41e7('0x46')](db[_0x41e7('0x5e')][_0x41e7('0x2f')]);_0x29a272[_0x41e7('0x34')]=_['keys'](_0x4a78ac['query']);_0x29a272[_0x41e7('0x35')]=_[_0x41e7('0x36')](_0x29a272[_0x41e7('0x32')],_0x29a272[_0x41e7('0x34')]);_0x3f4275[_0x41e7('0x38')]=_[_0x41e7('0x36')](_0x29a272['model'],qs[_0x41e7('0x37')](_0x4a78ac[_0x41e7('0x34')][_0x41e7('0x37')]));_0x3f4275[_0x41e7('0x38')]=_0x3f4275[_0x41e7('0x38')]['length']?_0x3f4275['attributes']:_0x29a272['model'];_0x3f4275[_0x41e7('0x3b')]=qs[_0x41e7('0x3c')](_0x4a78ac[_0x41e7('0x34')]['sort']);_0x3f4275[_0x41e7('0x3d')]=qs[_0x41e7('0x35')](_[_0x41e7('0x6d')](_0x4a78ac[_0x41e7('0x34')],_0x29a272[_0x41e7('0x35')]));if(_0x4a78ac[_0x41e7('0x34')][_0x41e7('0x6e')]){_0x3f4275['where']=_[_0x41e7('0x3f')](_0x3f4275[_0x41e7('0x3d')],{'$or':_[_0x41e7('0x33')](_0x3f4275[_0x41e7('0x38')],function(_0x47f581){var _0x53c168={};_0x53c168[_0x47f581]={'$like':'%'+_0x4a78ac[_0x41e7('0x34')][_0x41e7('0x6e')]+'%'};return _0x53c168;})});}_0x3f4275=_[_0x41e7('0x3f')]({},_0x3f4275,_0x4a78ac[_0x41e7('0x40')]);return _0x214a6d[_0x41e7('0x6c')](_0x3f4275);}})[_0x41e7('0x27')](function(_0x5e0780){if(_0x5e0780){_0x2fa85d=_0x5e0780[_0x41e7('0x47')];if(!_0x4a78ac[_0x41e7('0x34')]['hasOwnProperty']('nolimit')){_0x3f4275[_0x41e7('0x1f')]=qs['limit'](_0x4a78ac[_0x41e7('0x34')][_0x41e7('0x1f')]);_0x3f4275[_0x41e7('0x1d')]=qs['offset'](_0x4a78ac[_0x41e7('0x34')]['offset']);}return _0x214a6d['getSounds'](_0x3f4275);}})[_0x41e7('0x27')](function(_0x1f3b48){if(_0x1f3b48){return _0x1f3b48?{'count':_0x2fa85d,'rows':_0x1f3b48}:null;}})[_0x41e7('0x27')](respondWithResult(_0x376f26,null))[_0x41e7('0x44')](handleError(_0x376f26,null));}; \ No newline at end of file +var _0x011a=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','MusicOnHolds','destroy','stack','index','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','keys','include','body','find','sequelize','files','directory','join','root','create','mode','mkdirSync','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','ValidationError','addSound','transaction','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','basename','%s.%s','symlinkSync','Sequelize','message','removeSound','getSounds','eml-format'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x011a,0xdb));var _0xa011=function(_0x25a787,_0x6926e7){_0x25a787=_0x25a787-0x0;var _0x37712a=_0x011a[_0x25a787];return _0x37712a;};'use strict';var emlformat=require(_0xa011('0x0'));var rimraf=require(_0xa011('0x1'));var zipdir=require(_0xa011('0x2'));var jsonpatch=require(_0xa011('0x3'));var rp=require(_0xa011('0x4'));var moment=require('moment');var BPromise=require(_0xa011('0x5'));var Mustache=require('mustache');var util=require(_0xa011('0x6'));var path=require(_0xa011('0x7'));var sox=require(_0xa011('0x8'));var csv=require(_0xa011('0x9'));var ejs=require(_0xa011('0xa'));var fs=require('fs');var fs_extra=require(_0xa011('0xb'));var _=require(_0xa011('0xc'));var squel=require(_0xa011('0xd'));var crypto=require(_0xa011('0xe'));var jsforce=require(_0xa011('0xf'));var deskjs=require(_0xa011('0x10'));var toCsv=require(_0xa011('0x9'));var querystring=require(_0xa011('0x11'));var Papa=require(_0xa011('0x12'));var Redis=require(_0xa011('0x13'));var authService=require(_0xa011('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa011('0x15'));var logger=require('../../config/logger')(_0xa011('0x16'));var utils=require(_0xa011('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa011('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5af674,_0x1d14ba){_0x1d14ba=_0x1d14ba||0xcc;return function(_0x3b0111){if(_0x3b0111){return _0x5af674[_0xa011('0x19')](_0x1d14ba);}return _0x5af674[_0xa011('0x1a')](_0x1d14ba)[_0xa011('0x1b')]();};}function respondWithResult(_0x2bbc9e,_0x10631d){_0x10631d=_0x10631d||0xc8;return function(_0x40469d){if(_0x40469d){return _0x2bbc9e[_0xa011('0x1a')](_0x10631d)[_0xa011('0x1c')](_0x40469d);}};}function respondWithFilteredResult(_0x498445,_0x38832b){return function(_0x276c12){if(_0x276c12){var _0x3fdab6=typeof _0x38832b['offset']===_0xa011('0x1d')&&typeof _0x38832b[_0xa011('0x1e')]===_0xa011('0x1d');var _0x1dbca5=_0x276c12[_0xa011('0x1f')];var _0x257a3e=_0x3fdab6?0x0:_0x38832b[_0xa011('0x20')];var _0x8c4a1e=_0x3fdab6?_0x276c12[_0xa011('0x1f')]:_0x38832b[_0xa011('0x20')]+_0x38832b[_0xa011('0x1e')];var _0x101c7a;if(_0x8c4a1e>=_0x1dbca5){_0x8c4a1e=_0x1dbca5;_0x101c7a=0xc8;}else{_0x101c7a=0xce;}_0x498445[_0xa011('0x1a')](_0x101c7a);return _0x498445[_0xa011('0x21')](_0xa011('0x22'),_0x257a3e+'-'+_0x8c4a1e+'/'+_0x1dbca5)[_0xa011('0x1c')](_0x276c12);}return null;};}function patchUpdates(_0x4367ce){return function(_0x1f7e0f){try{jsonpatch[_0xa011('0x23')](_0x1f7e0f,_0x4367ce,!![]);}catch(_0x496ef0){return BPromise['reject'](_0x496ef0);}return _0x1f7e0f[_0xa011('0x24')]();};}function saveUpdates(_0x24c11f,_0x348499){return function(_0x4c1f47){if(_0x4c1f47){return _0x4c1f47[_0xa011('0x25')](_0x24c11f)['then'](function(_0x32ff32){return _0x32ff32;});}return null;};}function removeEntity(_0x5cfd05,_0x5841ef){return function(_0x3df3a9){if(_0x3df3a9){return _0x3df3a9['destroy']()[_0xa011('0x26')](function(){var _0x561431=_0x3df3a9['get']({'plain':!![]});var _0x1ad769=_0xa011('0x27');return db['UserProfileResource'][_0xa011('0x28')]({'where':{'type':_0x1ad769,'resourceId':_0x561431['id']}})[_0xa011('0x26')](function(){return _0x3df3a9;});})['then'](function(){_0x5cfd05[_0xa011('0x1a')](0xcc)[_0xa011('0x1b')]();});}};}function handleEntityNotFound(_0x490352,_0x1424a9){return function(_0x112836){if(!_0x112836){_0x490352[_0xa011('0x19')](0x194);}return _0x112836;};}function handleError(_0x35a3ba,_0x35cb52){_0x35cb52=_0x35cb52||0x1f4;return function(_0x58e6c2){logger['error'](_0x58e6c2[_0xa011('0x29')]);if(_0x58e6c2['name']){delete _0x58e6c2['name'];}_0x35a3ba[_0xa011('0x1a')](_0x35cb52)['send'](_0x58e6c2);};}exports[_0xa011('0x2a')]=function(_0x324059,_0x148d9b){var _0x351257={},_0x4fb6df={},_0x2f31e0={'count':0x0,'rows':[]};var _0x376152=_['map'](db['VoiceMusicOnHold'][_0xa011('0x2b')],function(_0x28d524){return{'name':_0x28d524[_0xa011('0x2c')],'type':_0x28d524[_0xa011('0x2d')]['key']};});_0x4fb6df[_0xa011('0x2e')]=_['map'](_0x376152,_0xa011('0x2f'));_0x4fb6df['query']=_['keys'](_0x324059[_0xa011('0x30')]);_0x4fb6df[_0xa011('0x31')]=_[_0xa011('0x32')](_0x4fb6df[_0xa011('0x2e')],_0x4fb6df['query']);_0x351257[_0xa011('0x33')]=_['intersection'](_0x4fb6df[_0xa011('0x2e')],qs[_0xa011('0x34')](_0x324059[_0xa011('0x30')][_0xa011('0x34')]));_0x351257[_0xa011('0x33')]=_0x351257[_0xa011('0x33')][_0xa011('0x35')]?_0x351257[_0xa011('0x33')]:_0x4fb6df[_0xa011('0x2e')];if(!_0x324059[_0xa011('0x30')][_0xa011('0x36')](_0xa011('0x37'))){_0x351257['limit']=qs[_0xa011('0x1e')](_0x324059[_0xa011('0x30')][_0xa011('0x1e')]);_0x351257[_0xa011('0x20')]=qs[_0xa011('0x20')](_0x324059[_0xa011('0x30')][_0xa011('0x20')]);}_0x351257[_0xa011('0x38')]=qs[_0xa011('0x39')](_0x324059['query']['sort']);delete _0x324059['query'][_0xa011('0x39')];_0x351257[_0xa011('0x3a')]=qs[_0xa011('0x31')](_['pick'](_0x324059[_0xa011('0x30')],_0x4fb6df[_0xa011('0x31')]),_0x376152);if(_0x324059[_0xa011('0x30')]['filter']){_0x351257[_0xa011('0x3a')]=_[_0xa011('0x3b')](_0x351257[_0xa011('0x3a')],{'$or':_['map'](_0x376152,function(_0x611cb5){if(_0x611cb5[_0xa011('0x2d')]!==_0xa011('0x3c')){var _0x340ce4={};_0x340ce4[_0x611cb5['name']]={'$like':'%'+_0x324059[_0xa011('0x30')][_0xa011('0x3d')]+'%'};return _0x340ce4;}})});}_0x351257=_[_0xa011('0x3b')]({},_0x351257,_0x324059[_0xa011('0x3e')]);var _0x12b4f0={'where':_0x351257['where']};return db[_0xa011('0x3f')]['count'](_0x12b4f0)[_0xa011('0x26')](function(_0x1b66a3){_0x2f31e0['count']=_0x1b66a3;if(_0x324059[_0xa011('0x30')][_0xa011('0x40')]){_0x351257['include']=[{'all':!![]}];}return db[_0xa011('0x3f')][_0xa011('0x41')](_0x351257);})[_0xa011('0x26')](function(_0xd81ffc){_0x2f31e0[_0xa011('0x42')]=_0xd81ffc;return _0x2f31e0;})[_0xa011('0x26')](respondWithFilteredResult(_0x148d9b,_0x351257))[_0xa011('0x43')](handleError(_0x148d9b,null));};exports[_0xa011('0x44')]=function(_0x5c37dd,_0x3f9472){var _0x2c712a={'raw':![],'where':{'id':_0x5c37dd[_0xa011('0x45')]['id']}},_0x2d22c2={};_0x2d22c2[_0xa011('0x2e')]=_['keys'](db[_0xa011('0x3f')][_0xa011('0x2b')]);_0x2d22c2[_0xa011('0x30')]=_[_0xa011('0x46')](_0x5c37dd[_0xa011('0x30')]);_0x2d22c2['filters']=_['intersection'](_0x2d22c2[_0xa011('0x2e')],_0x2d22c2[_0xa011('0x30')]);_0x2c712a[_0xa011('0x33')]=_[_0xa011('0x32')](_0x2d22c2[_0xa011('0x2e')],qs[_0xa011('0x34')](_0x5c37dd[_0xa011('0x30')][_0xa011('0x34')]));_0x2c712a[_0xa011('0x33')]=_0x2c712a[_0xa011('0x33')]['length']?_0x2c712a[_0xa011('0x33')]:_0x2d22c2[_0xa011('0x2e')];if(_0x5c37dd[_0xa011('0x30')]['includeAll']){_0x2c712a[_0xa011('0x47')]=[{'all':!![]}];}_0x2c712a=_[_0xa011('0x3b')]({},_0x2c712a,_0x5c37dd[_0xa011('0x3e')]);return db[_0xa011('0x3f')]['find'](_0x2c712a)[_0xa011('0x26')](handleEntityNotFound(_0x3f9472,null))[_0xa011('0x26')](respondWithResult(_0x3f9472,null))['catch'](handleError(_0x3f9472,null));};exports[_0xa011('0x25')]=function(_0x39af15,_0x134acb){if(_0x39af15['body']['id']){delete _0x39af15[_0xa011('0x48')]['id'];}return db[_0xa011('0x3f')][_0xa011('0x49')]({'where':{'id':_0x39af15[_0xa011('0x45')]['id']}})[_0xa011('0x26')](handleEntityNotFound(_0x134acb,null))[_0xa011('0x26')](saveUpdates(_0x39af15[_0xa011('0x48')],null))[_0xa011('0x26')](respondWithResult(_0x134acb,null))[_0xa011('0x43')](handleError(_0x134acb,null));};exports['create']=function(_0x49c6d1,_0xb7b2cb,_0x2c2858){return db[_0xa011('0x4a')]['transaction'](function(_0xe72689){if(_0x49c6d1[_0xa011('0x48')]['mode']===_0xa011('0x4b')){_0x49c6d1[_0xa011('0x48')][_0xa011('0x4c')]=path[_0xa011('0x4d')](config[_0xa011('0x4e')],'server/files/moh',_0x49c6d1[_0xa011('0x48')][_0xa011('0x2f')]);}return db[_0xa011('0x3f')][_0xa011('0x4f')](_0x49c6d1['body'],{'transaction':_0xe72689})[_0xa011('0x26')](function(_0x4a6853){if(_0x49c6d1[_0xa011('0x48')][_0xa011('0x50')]==='files'){fs[_0xa011('0x51')](_0x4a6853['directory'],parseInt('0777',0x8));}var _0xb30363=_0x49c6d1[_0xa011('0x52')][_0xa011('0x53')]({'plain':!![]});if(!_0xb30363)throw new Error(_0xa011('0x54'));if(_0xb30363[_0xa011('0x55')]===_0xa011('0x52')){var _0x3112fb=_0x4a6853[_0xa011('0x53')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xa011('0x27'),'userProfileId':_0xb30363[_0xa011('0x56')]},'raw':!![]})['then'](function(_0x3d3bbd){if(_0x3d3bbd&&_0x3d3bbd[_0xa011('0x57')]===0x0){return db['UserProfileResource'][_0xa011('0x4f')]({'name':_0x3112fb[_0xa011('0x2f')],'resourceId':_0x3112fb['id'],'type':_0x3d3bbd['name'],'sectionId':_0x3d3bbd['id']},{})[_0xa011('0x26')](function(){return _0x4a6853;});}else{return _0x4a6853;}})['catch'](function(_0x510e92){logger[_0xa011('0x58')](_0xa011('0x59'),_0x510e92);});}return _0x4a6853;});})['then'](respondWithResult(_0xb7b2cb,0xc9))[_0xa011('0x43')](handleError(_0xb7b2cb,null));};exports['destroy']=function(_0x4b5df0,_0x484dee,_0x2b14a9){var _0x498682;return db[_0xa011('0x3f')][_0xa011('0x49')]({'where':{'id':_0x4b5df0[_0xa011('0x45')]['id']}})[_0xa011('0x26')](function(_0x1bfce9){if(_0x1bfce9){return db[_0xa011('0x4a')]['transaction'](function(_0x45b871){return _0x1bfce9[_0xa011('0x28')]({'transaction':_0x45b871,'raw':!![]})[_0xa011('0x26')](function(_0x45e042){if(_0x45e042[_0xa011('0x4c')]){fs[_0xa011('0x5a')](_0x45e042[_0xa011('0x4c')])[_0xa011('0x5b')](function(_0x40adb2){fs['unlinkSync'](path['join'](_0x45e042['directory'],_0x40adb2));});fs[_0xa011('0x5c')](_0x45e042[_0xa011('0x4c')]);}return _0x45e042;});})[_0xa011('0x43')](function(_0x449fd7){throw new db['Sequelize'][(_0xa011('0x5d'))](_0x449fd7['message']);});}})[_0xa011('0x26')](handleEntityNotFound(_0x484dee,null))[_0xa011('0x26')](removeEntity(_0x484dee,null))[_0xa011('0x43')](handleError(_0x484dee,null));};exports[_0xa011('0x5e')]=function(_0x1ced8c,_0x2350e9,_0x57ba89){return db[_0xa011('0x4a')][_0xa011('0x5f')](function(_0x244442){var _0x653aed;return db[_0xa011('0x3f')][_0xa011('0x49')]({'where':{'id':_0x1ced8c['params']['id']}})['then'](function(_0x5771f9){if(_0x5771f9){_0x653aed=_0x5771f9;return _0x5771f9[_0xa011('0x5e')](_0x1ced8c[_0xa011('0x48')]['id'],{'transaction':_0x244442});}})['then'](function(_0x3afcd1){if(_0x3afcd1){return db[_0xa011('0x60')][_0xa011('0x61')]({'where':{'id':_0x1ced8c[_0xa011('0x48')]['id']},'attributes':['id',_0xa011('0x2f'),_0xa011('0x62'),_0xa011('0x63'),_0xa011('0x64')],'raw':!![]});}})['then'](function(_0x4d0096){if(_0x4d0096){var _0x5d28ff=path['join'](config['root'],_0xa011('0x65'),util[_0xa011('0x66')]('%s.%s',path[_0xa011('0x67')](_0x4d0096['save_name'],path['extname'](_0x4d0096[_0xa011('0x62')])),_0x4d0096[_0xa011('0x63')]));var _0x342ec0=path['join'](config[_0xa011('0x4e')],'server/files/moh',_0x653aed[_0xa011('0x2f')],util[_0xa011('0x66')](_0xa011('0x68'),_0x4d0096[_0xa011('0x2f')],_0x4d0096[_0xa011('0x63')]));fs[_0xa011('0x69')](_0x5d28ff,_0x342ec0);return _0x4d0096;}})['catch'](function(_0x1ec6bb){throw new db[(_0xa011('0x6a'))][(_0xa011('0x5d'))](_0x1ec6bb[_0xa011('0x6b')]);});})['then'](handleEntityNotFound(_0x2350e9,null))[_0xa011('0x26')](respondWithResult(_0x2350e9,0xc9))[_0xa011('0x43')](handleError(_0x2350e9,null));};exports[_0xa011('0x6c')]=function(_0x7b2183,_0x580288,_0x4d9330){return db['sequelize'][_0xa011('0x5f')](function(_0x3cb84e){var _0x14400f;return db[_0xa011('0x3f')]['findOne']({'where':{'id':_0x7b2183[_0xa011('0x45')]['id']}})[_0xa011('0x26')](handleEntityNotFound(_0x580288,null))['then'](function(_0x5c0317){if(_0x5c0317){_0x14400f=_0x5c0317;return _0x5c0317[_0xa011('0x6c')](_0x7b2183[_0xa011('0x45')]['id2']);}})['then'](function(_0xef1511){if(_0xef1511){return db[_0xa011('0x60')]['findOne']({'where':{'id':_0x7b2183[_0xa011('0x45')]['id2']},'attributes':['id','name','save_name',_0xa011('0x63'),_0xa011('0x64')],'raw':!![]});}})[_0xa011('0x26')](function(_0x37616a){if(_0x37616a){fs['unlinkSync'](path[_0xa011('0x4d')](_0x14400f[_0xa011('0x4c')],util[_0xa011('0x66')](_0xa011('0x68'),_0x37616a[_0xa011('0x2f')],_0x37616a[_0xa011('0x63')])));return _0x37616a;}})[_0xa011('0x43')](function(_0x2eaf1a){throw new db[(_0xa011('0x6a'))][(_0xa011('0x5d'))](_0x2eaf1a['message']);});})[_0xa011('0x26')](handleEntityNotFound(_0x580288,null))[_0xa011('0x26')](respondWithStatusCode(_0x580288,0xcc))[_0xa011('0x43')](handleError(_0x580288,null));};exports[_0xa011('0x6d')]=function(_0x15d92b,_0xce995,_0x5d514e){var _0x35d521={};var _0x3f31fb={};var _0x367fb9;var _0x476ffd;return db['VoiceMusicOnHold'][_0xa011('0x61')]({'where':{'id':_0x15d92b[_0xa011('0x45')]['id']}})[_0xa011('0x26')](handleEntityNotFound(_0xce995,null))[_0xa011('0x26')](function(_0xaff5ae){if(_0xaff5ae){_0x367fb9=_0xaff5ae;_0x3f31fb['model']=_[_0xa011('0x46')](db['Sound'][_0xa011('0x2b')]);_0x3f31fb[_0xa011('0x30')]=_[_0xa011('0x46')](_0x15d92b[_0xa011('0x30')]);_0x3f31fb[_0xa011('0x31')]=_['intersection'](_0x3f31fb[_0xa011('0x2e')],_0x3f31fb[_0xa011('0x30')]);_0x35d521[_0xa011('0x33')]=_[_0xa011('0x32')](_0x3f31fb['model'],qs[_0xa011('0x34')](_0x15d92b[_0xa011('0x30')][_0xa011('0x34')]));_0x35d521[_0xa011('0x33')]=_0x35d521[_0xa011('0x33')][_0xa011('0x35')]?_0x35d521[_0xa011('0x33')]:_0x3f31fb['model'];_0x35d521[_0xa011('0x38')]=qs[_0xa011('0x39')](_0x15d92b[_0xa011('0x30')][_0xa011('0x39')]);_0x35d521[_0xa011('0x3a')]=qs['filters'](_['pick'](_0x15d92b[_0xa011('0x30')],_0x3f31fb[_0xa011('0x31')]));if(_0x15d92b['query'][_0xa011('0x3d')]){_0x35d521[_0xa011('0x3a')]=_[_0xa011('0x3b')](_0x35d521[_0xa011('0x3a')],{'$or':_['map'](_0x35d521[_0xa011('0x33')],function(_0x3b0275){var _0x10791e={};_0x10791e[_0x3b0275]={'$like':'%'+_0x15d92b['query'][_0xa011('0x3d')]+'%'};return _0x10791e;})});}_0x35d521=_[_0xa011('0x3b')]({},_0x35d521,_0x15d92b[_0xa011('0x3e')]);return _0x367fb9[_0xa011('0x6d')](_0x35d521);}})['then'](function(_0x3be8bf){if(_0x3be8bf){_0x476ffd=_0x3be8bf['length'];if(!_0x15d92b[_0xa011('0x30')][_0xa011('0x36')](_0xa011('0x37'))){_0x35d521['limit']=qs[_0xa011('0x1e')](_0x15d92b[_0xa011('0x30')][_0xa011('0x1e')]);_0x35d521[_0xa011('0x20')]=qs['offset'](_0x15d92b[_0xa011('0x30')][_0xa011('0x20')]);}return _0x367fb9[_0xa011('0x6d')](_0x35d521);}})[_0xa011('0x26')](function(_0x40bbde){if(_0x40bbde){return _0x40bbde?{'count':_0x476ffd,'rows':_0x40bbde}:null;}})[_0xa011('0x26')](respondWithResult(_0xce995,null))[_0xa011('0x43')](handleError(_0xce995,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 9a0d047..0f17abf 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 _0x8be1=['util','../../config/logger','bluebird','request-promise','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x2ea169,_0x3a6861){var _0x3d44b9=function(_0x253fae){while(--_0x253fae){_0x2ea169['push'](_0x2ea169['shift']());}};_0x3d44b9(++_0x3a6861);}(_0x8be1,0x104));var _0x18be=function(_0x223c62,_0x10f403){_0x223c62=_0x223c62-0x0;var _0x2b1c3d=_0x8be1[_0x223c62];return _0x2b1c3d;};'use strict';var _=require(_0x18be('0x0'));var util=require(_0x18be('0x1'));var logger=require(_0x18be('0x2'))('api');var moment=require('moment');var BPromise=require(_0x18be('0x3'));var rp=require(_0x18be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x18be('0x5'));module['exports']=function(_0x40706d,_0x4e4d72){return _0x40706d[_0x18be('0x6')](_0x18be('0x7'),attributes,{'tableName':_0x18be('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59c1=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','util','../../config/logger','api'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0x59c1,0x1aa));var _0x159c=function(_0x19ed3a,_0x2b4cbe){_0x19ed3a=_0x19ed3a-0x0;var _0x18b945=_0x59c1[_0x19ed3a];return _0x18b945;};'use strict';var _=require('lodash');var util=require(_0x159c('0x0'));var logger=require(_0x159c('0x1'))(_0x159c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x159c('0x3'));var fs=require('fs');var path=require(_0x159c('0x4'));var rimraf=require(_0x159c('0x5'));var config=require(_0x159c('0x6'));var attributes=require(_0x159c('0x7'));module[_0x159c('0x8')]=function(_0x3fe5fb,_0x39380e){return _0x3fe5fb[_0x159c('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x159c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 4a60245..087c82e 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x51b078,_0x559b66){var _0x2200dd=function(_0x638ec){while(--_0x638ec){_0x51b078['push'](_0x51b078['shift']());}};_0x2200dd(++_0x559b66);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x5862f5,_0x52f23c){var _0x4f30f2=function(_0x357aee){while(--_0x357aee){_0x5862f5['push'](_0x5862f5['shift']());}};_0x4f30f2(++_0x52f23c);}(_0xedd9,0xfc));var _0x9edd=function(_0x154ce7,_0x4567aa){_0x154ce7=_0x154ce7-0x0;var _0xc8e500=_0xedd9[_0x154ce7];return _0xc8e500;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index f9ca59a..691a347 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 _0xa378=['exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','show','/:id/users','/:id/teams','getTeams','create','post','addAgents','put','/:id','update','delete','destroy'];(function(_0x4f0222,_0x5d70a8){var _0x1574a2=function(_0x5d5c1d){while(--_0x5d5c1d){_0x4f0222['push'](_0x4f0222['shift']());}};_0x1574a2(++_0x5d70a8);}(_0xa378,0xb9));var _0x8a37=function(_0x4a8417,_0x3e1d17){_0x4a8417=_0x4a8417-0x0;var _0x9393f5=_0xa378[_0x4a8417];return _0x9393f5;};'use strict';var multer=require(_0x8a37('0x0'));var util=require(_0x8a37('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8a37('0x2'));var router=express[_0x8a37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8a37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8a37('0x5'));var controller=require(_0x8a37('0x6'));router[_0x8a37('0x7')]('/',auth[_0x8a37('0x8')](),controller['index']);router[_0x8a37('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8a37('0x9')]);router[_0x8a37('0x7')]('/:id',auth[_0x8a37('0x8')](),controller[_0x8a37('0xa')]);router['get'](_0x8a37('0xb'),auth[_0x8a37('0x8')](),controller['getAgents']);router[_0x8a37('0x7')](_0x8a37('0xc'),auth['isAuthenticated'](),controller[_0x8a37('0xd')]);router['post']('/',auth[_0x8a37('0x8')](),controller[_0x8a37('0xe')]);router[_0x8a37('0xf')]('/:id/users',auth[_0x8a37('0x8')](),controller[_0x8a37('0x10')]);router[_0x8a37('0xf')](_0x8a37('0xc'),auth[_0x8a37('0x8')](),controller['addTeams']);router[_0x8a37('0x11')](_0x8a37('0x12'),auth[_0x8a37('0x8')](),controller[_0x8a37('0x13')]);router[_0x8a37('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8a37('0x15')]);router[_0x8a37('0x14')](_0x8a37('0xb'),auth[_0x8a37('0x8')](),controller['removeAgents']);router['delete'](_0x8a37('0xc'),auth[_0x8a37('0x8')](),controller['removeTeams']);module[_0x8a37('0x16')]=router; \ No newline at end of file +var _0x25d5=['update','delete','destroy','removeAgents','removeTeams','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','getTeams','post','create','addAgents','/:id/teams','put'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x25d5,0x91));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x525d('0x0'));var util=require('util');var path=require(_0x525d('0x1'));var timeout=require('connect-timeout');var express=require(_0x525d('0x2'));var router=express[_0x525d('0x3')]();var fs_extra=require(_0x525d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x525d('0x5'));var config=require(_0x525d('0x6'));var controller=require(_0x525d('0x7'));router[_0x525d('0x8')]('/',auth['isAuthenticated'](),controller[_0x525d('0x9')]);router[_0x525d('0x8')](_0x525d('0xa'),auth[_0x525d('0xb')](),controller[_0x525d('0xc')]);router[_0x525d('0x8')](_0x525d('0xd'),auth[_0x525d('0xb')](),controller[_0x525d('0xe')]);router['get'](_0x525d('0xf'),auth['isAuthenticated'](),controller[_0x525d('0x10')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x525d('0x11')]);router[_0x525d('0x12')]('/',auth['isAuthenticated'](),controller[_0x525d('0x13')]);router[_0x525d('0x12')](_0x525d('0xf'),auth['isAuthenticated'](),controller[_0x525d('0x14')]);router[_0x525d('0x12')](_0x525d('0x15'),auth[_0x525d('0xb')](),controller['addTeams']);router[_0x525d('0x16')](_0x525d('0xd'),auth[_0x525d('0xb')](),controller[_0x525d('0x17')]);router[_0x525d('0x18')](_0x525d('0xd'),auth[_0x525d('0xb')](),controller[_0x525d('0x19')]);router['delete']('/:id/users',auth[_0x525d('0xb')](),controller[_0x525d('0x1a')]);router[_0x525d('0x18')](_0x525d('0x15'),auth[_0x525d('0xb')](),controller[_0x525d('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 77d36a0..e09790f 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 _0x3d52=['exports','STRING','name','VIRTUAL','system-','getDataValue','INTEGER','sequelize'];(function(_0x31ed80,_0x169ad8){var _0x79f455=function(_0x3ea504){while(--_0x3ea504){_0x31ed80['push'](_0x31ed80['shift']());}};_0x79f455(++_0x169ad8);}(_0x3d52,0x13f));var _0x23d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x23d5('0x0'));module[_0x23d5('0x1')]={'name':{'type':Sequelize[_0x23d5('0x2')],'allowNull':![],'unique':_0x23d5('0x3')},'prefix':{'type':Sequelize[_0x23d5('0x4')],'get':function(_0x539850){return _0x23d5('0x5')+this[_0x23d5('0x6')](_0x23d5('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x23d5('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x23d5('0x7')]}}; \ No newline at end of file +var _0xee88=['name','STRING','sequelize','exports','VIRTUAL','system-','getDataValue'];(function(_0x208cf0,_0x486665){var _0x372d0d=function(_0x293e01){while(--_0x293e01){_0x208cf0['push'](_0x208cf0['shift']());}};_0x372d0d(++_0x486665);}(_0xee88,0x14b));var _0x8ee8=function(_0x321625,_0x4f43c8){_0x321625=_0x321625-0x0;var _0x345c2e=_0xee88[_0x321625];return _0x345c2e;};'use strict';var Sequelize=require(_0x8ee8('0x0'));module[_0x8ee8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x8ee8('0x2')],'get':function(_0x2c634d){return _0x8ee8('0x3')+this[_0x8ee8('0x4')](_0x8ee8('0x5'))+'-';}},'description':{'type':Sequelize[_0x8ee8('0x6')]},'callerIdAll':{'type':Sequelize[_0x8ee8('0x6')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 927713d..1345751 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 _0xf4f4=['role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','context','charAt','system-','addAgents','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','User','order','findOne','Team','getTeams','addTeams','findAll','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','union','compact','value','removeAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','VoicePrefixes','destroy','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x45dfa3,_0x55a4f6){var _0x1fbee9=function(_0x141947){while(--_0x141947){_0x45dfa3['push'](_0x45dfa3['shift']());}};_0x1fbee9(++_0x55a4f6);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x2c11eb,_0x855d9a){_0x2c11eb=_0x2c11eb-0x0;var _0x30aece=_0xf4f4[_0x2c11eb];return _0x30aece;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];config[_0x4f4f('0x1b')]=_[_0x4f4f('0x1c')](config[_0x4f4f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f4f('0x1d'))(new Redis(config['redis']));require(_0x4f4f('0x1e'))[_0x4f4f('0x1f')](socket);function respondWithStatusCode(_0x3e16e9,_0x38535d){_0x38535d=_0x38535d||0xcc;return function(_0x4c849f){if(_0x4c849f){return _0x3e16e9[_0x4f4f('0x20')](_0x38535d);}return _0x3e16e9['status'](_0x38535d)['end']();};}function respondWithResult(_0x58de77,_0x422894){_0x422894=_0x422894||0xc8;return function(_0x8d65a2){if(_0x8d65a2){return _0x58de77[_0x4f4f('0x21')](_0x422894)[_0x4f4f('0x22')](_0x8d65a2);}};}function respondWithFilteredResult(_0x2d5e5d,_0x1777eb){return function(_0x1245c4){if(_0x1245c4){var _0x60ce2=typeof _0x1777eb[_0x4f4f('0x23')]===_0x4f4f('0x24')&&typeof _0x1777eb[_0x4f4f('0x25')]===_0x4f4f('0x24');var _0x499277=_0x1245c4[_0x4f4f('0x26')];var _0x4622c2=_0x60ce2?0x0:_0x1777eb[_0x4f4f('0x23')];var _0x201c60=_0x60ce2?_0x1245c4[_0x4f4f('0x26')]:_0x1777eb[_0x4f4f('0x23')]+_0x1777eb[_0x4f4f('0x25')];var _0x3e33d5;if(_0x201c60>=_0x499277){_0x201c60=_0x499277;_0x3e33d5=0xc8;}else{_0x3e33d5=0xce;}_0x2d5e5d[_0x4f4f('0x21')](_0x3e33d5);return _0x2d5e5d[_0x4f4f('0x27')](_0x4f4f('0x28'),_0x4622c2+'-'+_0x201c60+'/'+_0x499277)[_0x4f4f('0x22')](_0x1245c4);}return null;};}function patchUpdates(_0x17984d){return function(_0xc78135){try{jsonpatch['apply'](_0xc78135,_0x17984d,!![]);}catch(_0x4f7261){return BPromise['reject'](_0x4f7261);}return _0xc78135[_0x4f4f('0x29')]();};}function saveUpdates(_0x43e661,_0x5186ac){return function(_0x3960ae){if(_0x3960ae){return _0x3960ae[_0x4f4f('0x2a')](_0x43e661)[_0x4f4f('0x2b')](function(_0x2ec92a){return _0x2ec92a;});}return null;};}function removeEntity(_0x113ff7,_0x31b30e){return function(_0xa6371b){if(_0xa6371b){return _0xa6371b['destroy']()[_0x4f4f('0x2b')](function(){var _0x237cf9=_0xa6371b[_0x4f4f('0x2c')]({'plain':!![]});var _0x15c79c=_0x4f4f('0x2d');return db['UserProfileResource'][_0x4f4f('0x2e')]({'where':{'type':_0x15c79c,'resourceId':_0x237cf9['id']}})[_0x4f4f('0x2b')](function(){return _0xa6371b;});})[_0x4f4f('0x2b')](function(){_0x113ff7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2490,_0x73b8bb){return function(_0x5b4f6a){if(!_0x5b4f6a){_0x4c2490[_0x4f4f('0x20')](0x194);}return _0x5b4f6a;};}function handleError(_0x39c1a8,_0x2e688a){_0x2e688a=_0x2e688a||0x1f4;return function(_0x5eb7c9){logger[_0x4f4f('0x2f')](_0x5eb7c9[_0x4f4f('0x30')]);if(_0x5eb7c9['name']){delete _0x5eb7c9[_0x4f4f('0x31')];}_0x39c1a8[_0x4f4f('0x21')](_0x2e688a)[_0x4f4f('0x32')](_0x5eb7c9);};}exports['index']=function(_0x6bdf15,_0x343c75){var _0x59bdb0={},_0x5517d7={},_0x465a36={'count':0x0,'rows':[]};var _0x305bf7=_[_0x4f4f('0x33')](db[_0x4f4f('0x34')][_0x4f4f('0x35')],function(_0x8d0f53){return{'name':_0x8d0f53[_0x4f4f('0x36')],'type':_0x8d0f53[_0x4f4f('0x37')][_0x4f4f('0x38')]};});_0x5517d7[_0x4f4f('0x39')]=_['map'](_0x305bf7,'name');_0x5517d7[_0x4f4f('0x3a')]=_['keys'](_0x6bdf15[_0x4f4f('0x3a')]);_0x5517d7[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],_0x5517d7[_0x4f4f('0x3a')]);_0x59bdb0[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0x5517d7[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x59bdb0[_0x4f4f('0x3d')]=_0x59bdb0['attributes'][_0x4f4f('0x3f')]?_0x59bdb0[_0x4f4f('0x3d')]:_0x5517d7[_0x4f4f('0x39')];if(!_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x59bdb0[_0x4f4f('0x25')]=qs[_0x4f4f('0x25')](_0x6bdf15[_0x4f4f('0x3a')]['limit']);_0x59bdb0[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x6bdf15[_0x4f4f('0x3a')]['offset']);}_0x59bdb0['order']=qs[_0x4f4f('0x42')](_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x59bdb0[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x6bdf15[_0x4f4f('0x3a')],_0x5517d7[_0x4f4f('0x3b')]),_0x305bf7);if(_0x6bdf15[_0x4f4f('0x3a')][_0x4f4f('0x45')]){_0x59bdb0[_0x4f4f('0x43')]=_[_0x4f4f('0x46')](_0x59bdb0['where'],{'$or':_[_0x4f4f('0x33')](_0x305bf7,function(_0x1b031e){if(_0x1b031e[_0x4f4f('0x37')]!==_0x4f4f('0x47')){var _0x18e805={};_0x18e805[_0x1b031e['name']]={'$like':'%'+_0x6bdf15['query'][_0x4f4f('0x45')]+'%'};return _0x18e805;}})});}_0x59bdb0=_[_0x4f4f('0x46')]({},_0x59bdb0,_0x6bdf15[_0x4f4f('0x48')]);var _0xa8f1a5={'where':_0x59bdb0['where']};return db[_0x4f4f('0x34')]['count'](_0xa8f1a5)[_0x4f4f('0x2b')](function(_0x5a7c94){_0x465a36['count']=_0x5a7c94;if(_0x6bdf15[_0x4f4f('0x3a')]['includeAll']){_0x59bdb0[_0x4f4f('0x49')]=[{'all':!![]}];}return db[_0x4f4f('0x34')]['findAll'](_0x59bdb0);})[_0x4f4f('0x2b')](function(_0x2d8ff6){_0x465a36['rows']=_0x2d8ff6;return _0x465a36;})[_0x4f4f('0x2b')](respondWithFilteredResult(_0x343c75,_0x59bdb0))[_0x4f4f('0x4a')](handleError(_0x343c75,null));};exports[_0x4f4f('0x4b')]=function(_0x3defd0,_0x162674){var _0x62b468={'raw':![],'where':{'id':_0x3defd0[_0x4f4f('0x4c')]['id']}},_0xb0d1b2={};_0xb0d1b2[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x34')][_0x4f4f('0x35')]);_0xb0d1b2[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x3defd0[_0x4f4f('0x3a')]);_0xb0d1b2['filters']=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],_0xb0d1b2['query']);_0x62b468[_0x4f4f('0x3d')]=_[_0x4f4f('0x3c')](_0xb0d1b2['model'],qs[_0x4f4f('0x3e')](_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x62b468[_0x4f4f('0x3d')]=_0x62b468[_0x4f4f('0x3d')]['length']?_0x62b468[_0x4f4f('0x3d')]:_0xb0d1b2[_0x4f4f('0x39')];if(_0x3defd0[_0x4f4f('0x3a')][_0x4f4f('0x4e')]){_0x62b468[_0x4f4f('0x49')]=[{'all':!![]}];}_0x62b468=_[_0x4f4f('0x46')]({},_0x62b468,_0x3defd0[_0x4f4f('0x48')]);return db[_0x4f4f('0x34')][_0x4f4f('0x4f')](_0x62b468)['then'](handleEntityNotFound(_0x162674,null))[_0x4f4f('0x2b')](respondWithResult(_0x162674,null))[_0x4f4f('0x4a')](handleError(_0x162674,null));};exports['destroy']=function(_0x5ac4df,_0x5941ac){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x5ac4df[_0x4f4f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5941ac,null))[_0x4f4f('0x2b')](removeEntity(_0x5941ac,null))['catch'](handleError(_0x5941ac,null));};exports[_0x4f4f('0x50')]=function(_0x1c181e,_0x3c0d7b){return db[_0x4f4f('0x34')][_0x4f4f('0x50')]()[_0x4f4f('0x2b')](respondWithResult(_0x3c0d7b,null))[_0x4f4f('0x4a')](handleError(_0x3c0d7b,null));};exports[_0x4f4f('0x51')]=function(_0x17f6fb,_0x4dbce2){var _0x59e207;return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x4c04eb){return db['VoicePrefix'][_0x4f4f('0x51')](_0x17f6fb[_0x4f4f('0x54')],{'transaction':_0x4c04eb})[_0x4f4f('0x2b')](function(_0x55a5e4){_0x59e207=_0x55a5e4['get']({'plain':!![]});return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x59e207[_0x4f4f('0x56')]},'raw':!![]})[_0x4f4f('0x2b')](function(_0x37cf8e){return createVoicePrefixExtensions(_0x59e207,_0x37cf8e,_0x4c04eb);});});})[_0x4f4f('0x2b')](function(){var _0xe66fc=_0x17f6fb[_0x4f4f('0x57')][_0x4f4f('0x2c')]({'plain':!![]});if(!_0xe66fc)throw new Error(_0x4f4f('0x58'));if(_0xe66fc[_0x4f4f('0x59')]==='user'){var _0x585c06=_0x59e207;return db[_0x4f4f('0x5a')][_0x4f4f('0x4f')]({'where':{'name':_0x4f4f('0x2d'),'userProfileId':_0xe66fc[_0x4f4f('0x5b')]},'raw':!![]})['then'](function(_0x1bef77){if(_0x1bef77&&_0x1bef77['autoAssociation']===0x0){return db[_0x4f4f('0x5c')][_0x4f4f('0x51')]({'name':_0x585c06[_0x4f4f('0x31')],'resourceId':_0x585c06['id'],'type':_0x1bef77['name'],'sectionId':_0x1bef77['id']},{})[_0x4f4f('0x2b')](function(){return _0x59e207;});}else{return _0x59e207;}})[_0x4f4f('0x4a')](function(_0x23e9a9){logger['error'](_0x4f4f('0x5d'),_0x23e9a9);throw _0x23e9a9;});}return _0x59e207;})[_0x4f4f('0x2b')](respondWithResult(_0x4dbce2,null))[_0x4f4f('0x4a')](handleError(_0x4dbce2,null));};function Extension(_0x58a5dd,_0x2b01da,_0x16f162,_0x3fedae){this['context']=_0x4f4f('0x5e');this['exten']=_0x58a5dd;this[_0x4f4f('0x5f')]=_0x16f162;this[_0x4f4f('0x37')]=_0x4f4f('0x60');this[_0x4f4f('0x61')]=_0x4f4f('0x62');this[_0x4f4f('0x63')]=_0x2b01da;this[_0x4f4f('0x64')]=_0x3fedae;}function createVoicePrefixExtensions(_0xb2dfda,_0x40dffa,_0x36f369){return new BPromise(function(_0x269e0d,_0x5ba1e2){var _0x4794fe=new Extension(formatPrefixName(_0xb2dfda[_0x4f4f('0x65')]),0x1,_0x4f4f('0x66'),'Voice\x20Prefix');_0x4794fe[_0x4f4f('0x67')]=_0xb2dfda['id'];return db[_0x4f4f('0x55')][_0x4f4f('0x51')](_0x4794fe,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x561411){var _0x28f9e1=_0x561411[_0x4f4f('0x2c')]({'plain':!![]});var _0xc9a47a=_[_0x4f4f('0x33')](addVoicePrefixExtensions(_0xb2dfda,_0x40dffa),function(_0x157af6){_0x157af6['VoiceExtensionId']=_0x28f9e1['id'];_0x157af6[_0x4f4f('0x67')]=_0xb2dfda['id'];return _0x157af6;});return db['VoiceExtension'][_0x4f4f('0x68')](_0xc9a47a,{'transaction':_0x36f369})[_0x4f4f('0x2b')](function(_0x2da4ea){if(!_0x2da4ea){return _0x5ba1e2(_0x4f4f('0x69'));}else{return _0x269e0d(_0x2da4ea);}})[_0x4f4f('0x4a')](function(_0x23366b){return _0x5ba1e2(_0x23366b);});});;});};function addVoicePrefixExtensions(_0x4bbbf6,_0x50590c){var _0x15c86f=[];var _0x4c42fd=formatPrefixName(_0x4bbbf6[_0x4f4f('0x65')]);_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x2,_0x4f4f('0x6b'),_0x4f4f('0x6c')+_0x4bbbf6[_0x4f4f('0x31')]));if(_0x4bbbf6[_0x4f4f('0x6d')]){_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,_0x4f4f('0x6b'),_0x4f4f('0x6e')+_0x4bbbf6[_0x4f4f('0x6d')]));}else{_0x15c86f[_0x4f4f('0x6a')](new Extension(_0x4c42fd,0x3,'NoOp','No\x20callerid\x20available'));}_0x15c86f['push'](new Extension(_0x4c42fd,0x4,_0x4f4f('0x6f'),_0x50590c[_0x4f4f('0x70')]+','+'${EXTEN:'+(0x8+_0x4bbbf6[_0x4f4f('0x31')][_0x4f4f('0x3f')])+'}'+','+0x1));return _0x15c86f;}function formatPrefixName(_0x43d6c0){var _0x3007ff='_';for(var _0x12523f=0x0;_0x12523f<_0x43d6c0[_0x4f4f('0x3f')];_0x12523f++){if(_0x43d6c0['charAt'](_0x12523f)=='-'){_0x3007ff+=_0x43d6c0[_0x4f4f('0x71')](_0x12523f);}else{_0x3007ff+='['+_0x43d6c0[_0x4f4f('0x71')](_0x12523f)+']';}}_0x3007ff+='.';return _0x3007ff;}exports[_0x4f4f('0x2a')]=function(_0x24ed71,_0x33f4fd,_0x36299e){var _0x1d756b=_0x24ed71[_0x4f4f('0x54')];_0x1d756b['prefix']=_0x4f4f('0x72')+_0x1d756b[_0x4f4f('0x31')]+'-';return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x5f0efc){return db[_0x4f4f('0x34')]['update'](_0x1d756b,{'where':{'id':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x1d756b['id']},'transaction':_0x5f0efc})[_0x4f4f('0x2b')](function(){return db[_0x4f4f('0x55')][_0x4f4f('0x4f')]({'where':{'id':_0x1d756b[_0x4f4f('0x56')]},'raw':!![]})['then'](function(_0x90813f){return createVoicePrefixExtensions(_0x1d756b,_0x90813f,_0x5f0efc);});});});})['then'](function(){return db[_0x4f4f('0x34')]['findById'](_0x1d756b['id']);})[_0x4f4f('0x2b')](respondWithResult(_0x33f4fd,null))[_0x4f4f('0x4a')](handleError(_0x33f4fd,null));};exports[_0x4f4f('0x73')]=function(_0x577fd9,_0x41c31c,_0x4b0ab5){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x577fd9[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x41c31c,null))[_0x4f4f('0x2b')](function(_0x4511c6){if(_0x4511c6){return _0x4511c6[_0x4f4f('0x73')](_0x577fd9[_0x4f4f('0x54')][_0x4f4f('0x74')],_['omit'](_0x577fd9[_0x4f4f('0x54')],[_0x4f4f('0x74'),'id'])||{})[_0x4f4f('0x75')](function(_0x14e4f3){for(var _0x42c638=0x0;_0x42c638<_0x577fd9[_0x4f4f('0x54')]['ids'][_0x4f4f('0x3f')];_0x42c638+=0x1){socket[_0x4f4f('0x76')](_0x4f4f('0x77'),{'UserId':Number(_0x577fd9[_0x4f4f('0x54')]['ids'][_0x42c638]),'VoicePrefixId':Number(_0x577fd9[_0x4f4f('0x4c')]['id'])});}return _0x14e4f3;});}})[_0x4f4f('0x2b')](respondWithResult(_0x41c31c,null))[_0x4f4f('0x4a')](handleError(_0x41c31c,null));};exports['removeAgents']=function(_0x838d05,_0x40bab8,_0x5ae1b6){return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x838d05[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x40bab8,null))[_0x4f4f('0x2b')](function(_0x25cd1c){if(_0x25cd1c){return _0x25cd1c['removeAgents'](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])[_0x4f4f('0x2b')](function(){if(_[_0x4f4f('0x78')](_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')])){for(var _0x5b6633=0x0;_0x5b6633<_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x4f4f('0x3f')];_0x5b6633+=0x1){socket['emit'](_0x4f4f('0x79'),{'UserId':Number(_0x838d05[_0x4f4f('0x3a')][_0x4f4f('0x74')][_0x5b6633]),'VoicePrefixId':Number(_0x838d05[_0x4f4f('0x4c')]['id'])});}}else{socket[_0x4f4f('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x838d05[_0x4f4f('0x3a')]['ids']),'VoicePrefixId':Number(_0x838d05['params']['id'])});}});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x40bab8,null))[_0x4f4f('0x4a')](handleError(_0x40bab8,null));};exports[_0x4f4f('0x7a')]=function(_0x33c295,_0x762acd,_0x362c6d){var _0x1d1f5f={};var _0x19e743={};var _0x167c43;var _0x50058d;return db[_0x4f4f('0x34')]['findOne']({'where':{'id':_0x33c295[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x762acd,null))['then'](function(_0x3286b1){if(_0x3286b1){_0x167c43=_0x3286b1;_0x19e743[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7b')][_0x4f4f('0x35')]);_0x19e743[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0x33c295[_0x4f4f('0x3a')]);_0x19e743['filters']=_[_0x4f4f('0x3c')](_0x19e743[_0x4f4f('0x39')],_0x19e743[_0x4f4f('0x3a')]);_0x1d1f5f['attributes']=_[_0x4f4f('0x3c')](_0x19e743['model'],qs['fields'](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x3e')]));_0x1d1f5f[_0x4f4f('0x3d')]=_0x1d1f5f[_0x4f4f('0x3d')]['length']?_0x1d1f5f[_0x4f4f('0x3d')]:_0x19e743['model'];_0x1d1f5f[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x42')]);_0x1d1f5f[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0x33c295[_0x4f4f('0x3a')],_0x19e743[_0x4f4f('0x3b')]));if(_0x33c295[_0x4f4f('0x3a')]['filter']){_0x1d1f5f['where']=_[_0x4f4f('0x46')](_0x1d1f5f[_0x4f4f('0x43')],{'$or':_[_0x4f4f('0x33')](_0x1d1f5f[_0x4f4f('0x3d')],function(_0x515d05){var _0x485129={};_0x485129[_0x515d05]={'$like':'%'+_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x45')]+'%'};return _0x485129;})});}_0x1d1f5f=_[_0x4f4f('0x46')]({},_0x1d1f5f,_0x33c295[_0x4f4f('0x48')]);return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})['then'](function(_0x10fa9e){if(_0x10fa9e){_0x50058d=_0x10fa9e[_0x4f4f('0x3f')];if(!_0x33c295[_0x4f4f('0x3a')][_0x4f4f('0x40')](_0x4f4f('0x41'))){_0x1d1f5f['limit']=qs[_0x4f4f('0x25')](_0x33c295['query']['limit']);_0x1d1f5f[_0x4f4f('0x23')]=qs[_0x4f4f('0x23')](_0x33c295[_0x4f4f('0x3a')]['offset']);}return _0x167c43[_0x4f4f('0x7a')](_0x1d1f5f);}})[_0x4f4f('0x2b')](function(_0x56015c){if(_0x56015c){return _0x56015c?{'count':_0x50058d,'rows':_0x56015c}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x762acd,null))[_0x4f4f('0x4a')](handleError(_0x762acd,null));};exports['getTeams']=function(_0xaa0e50,_0x23e8bd,_0x3b5214){var _0x38ea5d={};var _0x4632c0={};var _0x6ec076;var _0x56f2c5;return db[_0x4f4f('0x34')][_0x4f4f('0x7d')]({'where':{'id':_0xaa0e50[_0x4f4f('0x4c')]['id']}})[_0x4f4f('0x2b')](handleEntityNotFound(_0x23e8bd,null))[_0x4f4f('0x2b')](function(_0x3d0e57){if(_0x3d0e57){_0x6ec076=_0x3d0e57;_0x4632c0[_0x4f4f('0x39')]=_[_0x4f4f('0x4d')](db[_0x4f4f('0x7e')][_0x4f4f('0x35')]);_0x4632c0[_0x4f4f('0x3a')]=_[_0x4f4f('0x4d')](_0xaa0e50[_0x4f4f('0x3a')]);_0x4632c0[_0x4f4f('0x3b')]=_[_0x4f4f('0x3c')](_0x4632c0['model'],_0x4632c0[_0x4f4f('0x3a')]);_0x38ea5d['attributes']=_[_0x4f4f('0x3c')](_0x4632c0[_0x4f4f('0x39')],qs[_0x4f4f('0x3e')](_0xaa0e50['query'][_0x4f4f('0x3e')]));_0x38ea5d[_0x4f4f('0x3d')]=_0x38ea5d[_0x4f4f('0x3d')][_0x4f4f('0x3f')]?_0x38ea5d[_0x4f4f('0x3d')]:_0x4632c0['model'];_0x38ea5d[_0x4f4f('0x7c')]=qs[_0x4f4f('0x42')](_0xaa0e50[_0x4f4f('0x3a')]['sort']);_0x38ea5d[_0x4f4f('0x43')]=qs[_0x4f4f('0x3b')](_[_0x4f4f('0x44')](_0xaa0e50['query'],_0x4632c0[_0x4f4f('0x3b')]));if(_0xaa0e50['query'][_0x4f4f('0x45')]){_0x38ea5d['where']=_['merge'](_0x38ea5d['where'],{'$or':_['map'](_0x38ea5d['attributes'],function(_0x446cbd){var _0x2f2cb9={};_0x2f2cb9[_0x446cbd]={'$like':'%'+_0xaa0e50['query']['filter']+'%'};return _0x2f2cb9;})});}_0x38ea5d=_[_0x4f4f('0x46')]({},_0x38ea5d,_0xaa0e50[_0x4f4f('0x48')]);return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})['then'](function(_0x5ad9f6){if(_0x5ad9f6){_0x56f2c5=_0x5ad9f6['length'];if(!_0xaa0e50[_0x4f4f('0x3a')]['hasOwnProperty']('nolimit')){_0x38ea5d[_0x4f4f('0x25')]=qs['limit'](_0xaa0e50[_0x4f4f('0x3a')][_0x4f4f('0x25')]);_0x38ea5d['offset']=qs[_0x4f4f('0x23')](_0xaa0e50[_0x4f4f('0x3a')]['offset']);}return _0x6ec076[_0x4f4f('0x7f')](_0x38ea5d);}})[_0x4f4f('0x2b')](function(_0x3be76f){if(_0x3be76f){return _0x3be76f?{'count':_0x56f2c5,'rows':_0x3be76f}:null;}})[_0x4f4f('0x2b')](respondWithResult(_0x23e8bd,null))['catch'](handleError(_0x23e8bd,null));};exports[_0x4f4f('0x80')]=function(_0x349e9c,_0x2fc478,_0x3a745a){var _0x53c962=_0x349e9c[_0x4f4f('0x54')][_0x4f4f('0x74')];var _0x27b573;return db[_0x4f4f('0x7e')][_0x4f4f('0x81')]({'where':{'id':_0x53c962},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id',_0x4f4f('0x31'),_0x4f4f('0x83'),_0x4f4f('0x84'),_0x4f4f('0x85')],'raw':!![]}]})[_0x4f4f('0x2b')](function(_0x3f87c8){if(_0x3f87c8){_0x27b573=_0x3f87c8;var _0x22e619=_['flatMap'](_0x3f87c8,function(_0x3bfc19){var _0x150474=_0x3bfc19[_0x4f4f('0x2c')]({'plain':!![]});return _0x150474[_0x4f4f('0x82')];});return db[_0x4f4f('0x34')][_0x4f4f('0x4f')]({'where':{'id':_0x349e9c['params']['id']}})[_0x4f4f('0x2b')](function(_0x5a4d26){return db[_0x4f4f('0x52')]['transaction'](function(_0x2d1cc1){return _0x5a4d26['addTeams'](_0x53c962,{'transaction':_0x2d1cc1})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x27b573,function(_0x2b6319){return db['TeamVoicePrefix'][_0x4f4f('0x87')]({'TeamId':_0x2b6319['id'],'VoicePrefixId':_0x349e9c[_0x4f4f('0x4c')]['id']},{'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){return BPromise[_0x4f4f('0x86')](_0x22e619,function(_0xbe8586){return db['UserVoicePrefix'][_0x4f4f('0x88')]({'where':{'UserId':_0xbe8586['id'],'VoicePrefixId':_0x349e9c['params']['id']},'transaction':_0x2d1cc1});});})[_0x4f4f('0x2b')](function(){_0x22e619[_0x4f4f('0x89')](function(_0x4bb547){socket['emit']('userVoicePrefix:save',{'UserId':_0x4bb547['id'],'VoicePrefixId':_0x5a4d26['id']});});});});});}})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2fc478,null))[_0x4f4f('0x4a')](handleError(_0x2fc478,null));};exports[_0x4f4f('0x8a')]=function(_0x4c178d,_0x2cf10a,_0x53a849){return db[_0x4f4f('0x7e')]['findAll']({'where':{'id':_0x4c178d[_0x4f4f('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4f4f('0x7b')],'as':_0x4f4f('0x82'),'attributes':['id'],'raw':!![]}]})[_0x4f4f('0x2b')](handleEntityNotFound(_0x2cf10a,null))[_0x4f4f('0x2b')](function(_0x5063a6){var _0x1ce179=_[_0x4f4f('0x33')](_0x5063a6,'id');var _0x3f2b27=[];var _0x28049b=[];var _0x13418d=squel[_0x4f4f('0x8b')]();_0x13418d[_0x4f4f('0x8c')](_0x4f4f('0x8d'))[_0x4f4f('0x8e')](_0x4f4f('0x8f'),'tq')[_0x4f4f('0x90')]('user_has_teams','ut',_0x4f4f('0x91'))[_0x4f4f('0x43')](_0x4f4f('0x92'),_0x4c178d[_0x4f4f('0x4c')]['id']);for(var _0x223179=0x0;_0x223179<_0x5063a6['length'];_0x223179+=0x1){let _0x373ead=_0x5063a6[_0x223179];for(var _0x53dfb2=0x0;_0x53dfb2<_0x373ead[_0x4f4f('0x82')][_0x4f4f('0x3f')];_0x53dfb2+=0x1){let _0x3fcb64=_0x373ead[_0x4f4f('0x82')][_0x53dfb2];var _0x57405d=_0x13418d[_0x4f4f('0x93')]();_0x57405d['where'](_0x4f4f('0x94'),_0x3fcb64['id']);_0x28049b[_0x4f4f('0x6a')](db[_0x4f4f('0x52')][_0x4f4f('0x3a')](_0x57405d[_0x4f4f('0x95')](),{'type':db[_0x4f4f('0x52')][_0x4f4f('0x96')][_0x4f4f('0x97')]})[_0x4f4f('0x2b')](function(_0x3ce86c){if(_0x3ce86c['length']===0x1){return _0x3fcb64['id'];}else{var _0xe830ee=_['every'](_[_0x4f4f('0x33')](_0x3ce86c,'TeamId'),function(_0x277c96){return _[_0x4f4f('0x98')](_0x1ce179,_0x277c96);});if(_0xe830ee){return _0x3fcb64['id'];}}}));}}return BPromise[_0x4f4f('0x99')](_0x28049b)[_0x4f4f('0x2b')](function(_0x3a0382){_0x3f2b27=_(_0x3f2b27)[_0x4f4f('0x9a')](_0x3a0382)[_0x4f4f('0x9b')]()[_0x4f4f('0x9c')]();return db['VoicePrefix'][_0x4f4f('0x4f')]({'where':{'id':_0x4c178d[_0x4f4f('0x4c')]['id']}})['then'](function(_0x379a2e){return db[_0x4f4f('0x52')][_0x4f4f('0x53')](function(_0x35e9e7){return _0x379a2e['removeTeams'](_0x4c178d[_0x4f4f('0x3a')]['ids'],{'transaction':_0x35e9e7})[_0x4f4f('0x2b')](function(){if(!_['isEmpty'](_0x3f2b27)){return _0x379a2e[_0x4f4f('0x9d')](_0x3f2b27,{'transaction':_0x35e9e7});}})['then'](function(){_0x3f2b27['forEach'](function(_0x3f2df9){socket[_0x4f4f('0x76')](_0x4f4f('0x79'),{'UserId':_0x3f2df9,'VoicePrefixId':_0x379a2e['id']});});});});});});})[_0x4f4f('0x2b')](respondWithStatusCode(_0x2cf10a,null))['catch'](handleError(_0x2cf10a,null));}; \ No newline at end of file +var _0x0598=['bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','count','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','options','find','describe','sequelize','transaction','create','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoiceExtensionId','VoicePrefixId','bulkCreate','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','order','getAgents','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','eml-format','rimraf','fast-json-patch'];(function(_0x49e51c,_0x2172e6){var _0x3ad79a=function(_0x423e9f){while(--_0x423e9f){_0x49e51c['push'](_0x49e51c['shift']());}};_0x3ad79a(++_0x2172e6);}(_0x0598,0x92));var _0x8059=function(_0x56797c,_0x41b7e9){_0x56797c=_0x56797c-0x0;var _0x394cf7=_0x0598[_0x56797c];return _0x394cf7;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8059('0x12')]=_[_0x8059('0x13')](config[_0x8059('0x12')],{'host':_0x8059('0x14'),'port':0x18eb});var socket=require(_0x8059('0x15'))(new Redis(config['redis']));require(_0x8059('0x16'))['register'](socket);function respondWithStatusCode(_0x346b23,_0x5c916e){_0x5c916e=_0x5c916e||0xcc;return function(_0x3e4f08){if(_0x3e4f08){return _0x346b23[_0x8059('0x17')](_0x5c916e);}return _0x346b23[_0x8059('0x18')](_0x5c916e)['end']();};}function respondWithResult(_0x516c1f,_0x5cda43){_0x5cda43=_0x5cda43||0xc8;return function(_0x3b8f18){if(_0x3b8f18){return _0x516c1f[_0x8059('0x18')](_0x5cda43)[_0x8059('0x19')](_0x3b8f18);}};}function respondWithFilteredResult(_0x246c9d,_0x3abfe8){return function(_0x4b6d55){if(_0x4b6d55){var _0x10ad98=typeof _0x3abfe8[_0x8059('0x1a')]===_0x8059('0x1b')&&typeof _0x3abfe8[_0x8059('0x1c')]==='undefined';var _0x5456a9=_0x4b6d55['count'];var _0x113f42=_0x10ad98?0x0:_0x3abfe8['offset'];var _0x1857c1=_0x10ad98?_0x4b6d55['count']:_0x3abfe8[_0x8059('0x1a')]+_0x3abfe8[_0x8059('0x1c')];var _0x1e9ac5;if(_0x1857c1>=_0x5456a9){_0x1857c1=_0x5456a9;_0x1e9ac5=0xc8;}else{_0x1e9ac5=0xce;}_0x246c9d['status'](_0x1e9ac5);return _0x246c9d['set'](_0x8059('0x1d'),_0x113f42+'-'+_0x1857c1+'/'+_0x5456a9)[_0x8059('0x19')](_0x4b6d55);}return null;};}function patchUpdates(_0x32aeda){return function(_0x1585a3){try{jsonpatch['apply'](_0x1585a3,_0x32aeda,!![]);}catch(_0x3bc226){return BPromise[_0x8059('0x1e')](_0x3bc226);}return _0x1585a3[_0x8059('0x1f')]();};}function saveUpdates(_0x5449d9,_0xe9a72d){return function(_0x2256b1){if(_0x2256b1){return _0x2256b1[_0x8059('0x20')](_0x5449d9)[_0x8059('0x21')](function(_0x59d3a6){return _0x59d3a6;});}return null;};}function removeEntity(_0x140f64,_0x2cd179){return function(_0x4781e2){if(_0x4781e2){return _0x4781e2[_0x8059('0x22')]()[_0x8059('0x21')](function(){var _0x54b88b=_0x4781e2[_0x8059('0x23')]({'plain':!![]});var _0x19b95a=_0x8059('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x19b95a,'resourceId':_0x54b88b['id']}})['then'](function(){return _0x4781e2;});})[_0x8059('0x21')](function(){_0x140f64[_0x8059('0x18')](0xcc)[_0x8059('0x25')]();});}};}function handleEntityNotFound(_0x1009af,_0x59abe9){return function(_0x1eb71b){if(!_0x1eb71b){_0x1009af['sendStatus'](0x194);}return _0x1eb71b;};}function handleError(_0x2f887c,_0x35c73e){_0x35c73e=_0x35c73e||0x1f4;return function(_0x5ecf7f){logger[_0x8059('0x26')](_0x5ecf7f[_0x8059('0x27')]);if(_0x5ecf7f[_0x8059('0x28')]){delete _0x5ecf7f[_0x8059('0x28')];}_0x2f887c[_0x8059('0x18')](_0x35c73e)[_0x8059('0x29')](_0x5ecf7f);};}exports[_0x8059('0x2a')]=function(_0x2016ea,_0x505756){var _0xb3c36e={},_0x40b39e={},_0x1f8983={'count':0x0,'rows':[]};var _0x15f843=_[_0x8059('0x2b')](db['VoicePrefix'][_0x8059('0x2c')],function(_0x22c492){return{'name':_0x22c492[_0x8059('0x2d')],'type':_0x22c492[_0x8059('0x2e')][_0x8059('0x2f')]};});_0x40b39e[_0x8059('0x30')]=_[_0x8059('0x2b')](_0x15f843,_0x8059('0x28'));_0x40b39e[_0x8059('0x31')]=_[_0x8059('0x32')](_0x2016ea['query']);_0x40b39e[_0x8059('0x33')]=_['intersection'](_0x40b39e[_0x8059('0x30')],_0x40b39e['query']);_0xb3c36e['attributes']=_[_0x8059('0x34')](_0x40b39e['model'],qs[_0x8059('0x35')](_0x2016ea['query'][_0x8059('0x35')]));_0xb3c36e['attributes']=_0xb3c36e[_0x8059('0x36')][_0x8059('0x37')]?_0xb3c36e['attributes']:_0x40b39e[_0x8059('0x30')];if(!_0x2016ea[_0x8059('0x31')][_0x8059('0x38')]('nolimit')){_0xb3c36e[_0x8059('0x1c')]=qs['limit'](_0x2016ea[_0x8059('0x31')]['limit']);_0xb3c36e[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x2016ea[_0x8059('0x31')][_0x8059('0x1a')]);}_0xb3c36e['order']=qs[_0x8059('0x39')](_0x2016ea['query']['sort']);_0xb3c36e[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x2016ea[_0x8059('0x31')],_0x40b39e[_0x8059('0x33')]),_0x15f843);if(_0x2016ea['query']['filter']){_0xb3c36e['where']=_['merge'](_0xb3c36e[_0x8059('0x3a')],{'$or':_[_0x8059('0x2b')](_0x15f843,function(_0xc84f04){if(_0xc84f04['type']!==_0x8059('0x3c')){var _0x406ec3={};_0x406ec3[_0xc84f04['name']]={'$like':'%'+_0x2016ea[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x406ec3;}})});}_0xb3c36e=_[_0x8059('0x3e')]({},_0xb3c36e,_0x2016ea['options']);var _0x2c48cf={'where':_0xb3c36e[_0x8059('0x3a')]};return db['VoicePrefix'][_0x8059('0x3f')](_0x2c48cf)[_0x8059('0x21')](function(_0x3f00de){_0x1f8983[_0x8059('0x3f')]=_0x3f00de;if(_0x2016ea[_0x8059('0x31')][_0x8059('0x40')]){_0xb3c36e[_0x8059('0x41')]=[{'all':!![]}];}return db[_0x8059('0x42')][_0x8059('0x43')](_0xb3c36e);})[_0x8059('0x21')](function(_0x1d64db){_0x1f8983[_0x8059('0x44')]=_0x1d64db;return _0x1f8983;})[_0x8059('0x21')](respondWithFilteredResult(_0x505756,_0xb3c36e))[_0x8059('0x45')](handleError(_0x505756,null));};exports[_0x8059('0x46')]=function(_0x93ee2f,_0x35c94a){var _0x25f542={'raw':![],'where':{'id':_0x93ee2f[_0x8059('0x47')]['id']}},_0x1b613f={};_0x1b613f[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x42')]['rawAttributes']);_0x1b613f[_0x8059('0x31')]=_['keys'](_0x93ee2f['query']);_0x1b613f[_0x8059('0x33')]=_['intersection'](_0x1b613f[_0x8059('0x30')],_0x1b613f['query']);_0x25f542[_0x8059('0x36')]=_[_0x8059('0x34')](_0x1b613f[_0x8059('0x30')],qs[_0x8059('0x35')](_0x93ee2f[_0x8059('0x31')][_0x8059('0x35')]));_0x25f542['attributes']=_0x25f542[_0x8059('0x36')]['length']?_0x25f542[_0x8059('0x36')]:_0x1b613f[_0x8059('0x30')];if(_0x93ee2f[_0x8059('0x31')]['includeAll']){_0x25f542[_0x8059('0x41')]=[{'all':!![]}];}_0x25f542=_[_0x8059('0x3e')]({},_0x25f542,_0x93ee2f[_0x8059('0x48')]);return db[_0x8059('0x42')]['find'](_0x25f542)[_0x8059('0x21')](handleEntityNotFound(_0x35c94a,null))[_0x8059('0x21')](respondWithResult(_0x35c94a,null))[_0x8059('0x45')](handleError(_0x35c94a,null));};exports['destroy']=function(_0x2ba3f1,_0x5d9458){return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x2ba3f1['params']['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x5d9458,null))['then'](removeEntity(_0x5d9458,null))[_0x8059('0x45')](handleError(_0x5d9458,null));};exports[_0x8059('0x4a')]=function(_0x5ea40c,_0x20d779){return db['VoicePrefix'][_0x8059('0x4a')]()[_0x8059('0x21')](respondWithResult(_0x20d779,null))[_0x8059('0x45')](handleError(_0x20d779,null));};exports['create']=function(_0x2dd991,_0x5035a9){var _0x21ceef;return db[_0x8059('0x4b')][_0x8059('0x4c')](function(_0xb63fee){return db['VoicePrefix'][_0x8059('0x4d')](_0x2dd991[_0x8059('0x4e')],{'transaction':_0xb63fee})['then'](function(_0x41e280){_0x21ceef=_0x41e280['get']({'plain':!![]});return db[_0x8059('0x4f')]['find']({'where':{'id':_0x21ceef['VoiceExtensionId']},'raw':!![]})[_0x8059('0x21')](function(_0x388829){return createVoicePrefixExtensions(_0x21ceef,_0x388829,_0xb63fee);});});})[_0x8059('0x21')](function(){var _0x3afe66=_0x2dd991[_0x8059('0x50')][_0x8059('0x23')]({'plain':!![]});if(!_0x3afe66)throw new Error(_0x8059('0x51'));if(_0x3afe66['role']==='user'){var _0x52ed37=_0x21ceef;return db['UserProfileSection'][_0x8059('0x49')]({'where':{'name':_0x8059('0x24'),'userProfileId':_0x3afe66['userProfileId']},'raw':!![]})[_0x8059('0x21')](function(_0x4b0078){if(_0x4b0078&&_0x4b0078['autoAssociation']===0x0){return db[_0x8059('0x52')]['create']({'name':_0x52ed37[_0x8059('0x28')],'resourceId':_0x52ed37['id'],'type':_0x4b0078[_0x8059('0x28')],'sectionId':_0x4b0078['id']},{})[_0x8059('0x21')](function(){return _0x21ceef;});}else{return _0x21ceef;}})['catch'](function(_0x52511f){logger[_0x8059('0x26')](_0x8059('0x53'),_0x52511f);throw _0x52511f;});}return _0x21ceef;})[_0x8059('0x21')](respondWithResult(_0x5035a9,null))['catch'](handleError(_0x5035a9,null));};function Extension(_0x501f2c,_0x1260b1,_0x538460,_0x479a19){this[_0x8059('0x54')]='from-sip';this[_0x8059('0x55')]=_0x501f2c;this[_0x8059('0x56')]=_0x538460;this['type']='system';this[_0x8059('0x57')]=_0x8059('0x58');this[_0x8059('0x59')]=_0x1260b1;this['appdata']=_0x479a19;}function createVoicePrefixExtensions(_0x2d9df5,_0x4452ab,_0xc6b6d8){return new BPromise(function(_0x18bce2,_0x4b4dbe){var _0x1b3553=new Extension(formatPrefixName(_0x2d9df5['prefix']),0x1,_0x8059('0x5a'),_0x8059('0x5b'));_0x1b3553['VoicePrefixId']=_0x2d9df5['id'];return db[_0x8059('0x4f')]['create'](_0x1b3553,{'transaction':_0xc6b6d8})[_0x8059('0x21')](function(_0x319c65){var _0x2e8ef2=_0x319c65[_0x8059('0x23')]({'plain':!![]});var _0x2750b0=_[_0x8059('0x2b')](addVoicePrefixExtensions(_0x2d9df5,_0x4452ab),function(_0x28b466){_0x28b466[_0x8059('0x5c')]=_0x2e8ef2['id'];_0x28b466[_0x8059('0x5d')]=_0x2d9df5['id'];return _0x28b466;});return db[_0x8059('0x4f')][_0x8059('0x5e')](_0x2750b0,{'transaction':_0xc6b6d8})[_0x8059('0x21')](function(_0x325f9c){if(!_0x325f9c){return _0x4b4dbe('Extensions\x20creation\x20failed');}else{return _0x18bce2(_0x325f9c);}})[_0x8059('0x45')](function(_0x2dc612){return _0x4b4dbe(_0x2dc612);});});;});};function addVoicePrefixExtensions(_0x391924,_0x421682){var _0x2cf1fd=[];var _0x59a211=formatPrefixName(_0x391924[_0x8059('0x5f')]);_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x2,_0x8059('0x61'),_0x8059('0x62')+_0x391924[_0x8059('0x28')]));if(_0x391924[_0x8059('0x63')]){_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x3,_0x8059('0x61'),_0x8059('0x64')+_0x391924['callerIdAll']));}else{_0x2cf1fd[_0x8059('0x60')](new Extension(_0x59a211,0x3,_0x8059('0x5a'),_0x8059('0x65')));}_0x2cf1fd['push'](new Extension(_0x59a211,0x4,'goto',_0x421682[_0x8059('0x54')]+','+_0x8059('0x66')+(0x8+_0x391924[_0x8059('0x28')][_0x8059('0x37')])+'}'+','+0x1));return _0x2cf1fd;}function formatPrefixName(_0x1878a6){var _0x2a1833='_';for(var _0x18b3d8=0x0;_0x18b3d8<_0x1878a6['length'];_0x18b3d8++){if(_0x1878a6[_0x8059('0x67')](_0x18b3d8)=='-'){_0x2a1833+=_0x1878a6[_0x8059('0x67')](_0x18b3d8);}else{_0x2a1833+='['+_0x1878a6[_0x8059('0x67')](_0x18b3d8)+']';}}_0x2a1833+='.';return _0x2a1833;}exports['update']=function(_0x3cacf8,_0x255ade,_0x3cd45d){var _0x2d4970=_0x3cacf8['body'];_0x2d4970['prefix']=_0x8059('0x68')+_0x2d4970[_0x8059('0x28')]+'-';return db['sequelize'][_0x8059('0x4c')](function(_0x1c19b0){return db[_0x8059('0x42')][_0x8059('0x20')](_0x2d4970,{'where':{'id':_0x2d4970['id']},'transaction':_0x1c19b0})[_0x8059('0x21')](function(){return db[_0x8059('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x2d4970['id']},'transaction':_0x1c19b0})[_0x8059('0x21')](function(){return db[_0x8059('0x4f')][_0x8059('0x49')]({'where':{'id':_0x2d4970['VoiceExtensionId']},'raw':!![]})['then'](function(_0x36b586){return createVoicePrefixExtensions(_0x2d4970,_0x36b586,_0x1c19b0);});});});})[_0x8059('0x21')](function(){return db['VoicePrefix'][_0x8059('0x69')](_0x2d4970['id']);})[_0x8059('0x21')](respondWithResult(_0x255ade,null))[_0x8059('0x45')](handleError(_0x255ade,null));};exports[_0x8059('0x6a')]=function(_0x2009d9,_0xb36842,_0x2596ff){return db[_0x8059('0x42')][_0x8059('0x49')]({'where':{'id':_0x2009d9[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0xb36842,null))[_0x8059('0x21')](function(_0x598596){if(_0x598596){return _0x598596[_0x8059('0x6a')](_0x2009d9[_0x8059('0x4e')][_0x8059('0x6b')],_['omit'](_0x2009d9['body'],[_0x8059('0x6b'),'id'])||{})['spread'](function(_0x4b31cb){for(var _0x1554ca=0x0;_0x1554ca<_0x2009d9[_0x8059('0x4e')]['ids'][_0x8059('0x37')];_0x1554ca+=0x1){socket[_0x8059('0x6c')]('userVoicePrefix:save',{'UserId':Number(_0x2009d9['body'][_0x8059('0x6b')][_0x1554ca]),'VoicePrefixId':Number(_0x2009d9['params']['id'])});}return _0x4b31cb;});}})['then'](respondWithResult(_0xb36842,null))[_0x8059('0x45')](handleError(_0xb36842,null));};exports[_0x8059('0x6d')]=function(_0x230c39,_0x3be51a,_0x55257a){return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x230c39[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x3be51a,null))[_0x8059('0x21')](function(_0x1611d0){if(_0x1611d0){return _0x1611d0[_0x8059('0x6d')](_0x230c39['query']['ids'])[_0x8059('0x21')](function(){if(_[_0x8059('0x6e')](_0x230c39[_0x8059('0x31')]['ids'])){for(var _0x25bae4=0x0;_0x25bae4<_0x230c39[_0x8059('0x31')]['ids'][_0x8059('0x37')];_0x25bae4+=0x1){socket[_0x8059('0x6c')]('userVoicePrefix:remove',{'UserId':Number(_0x230c39[_0x8059('0x31')][_0x8059('0x6b')][_0x25bae4]),'VoicePrefixId':Number(_0x230c39[_0x8059('0x47')]['id'])});}}else{socket[_0x8059('0x6c')](_0x8059('0x6f'),{'UserId':Number(_0x230c39[_0x8059('0x31')][_0x8059('0x6b')]),'VoicePrefixId':Number(_0x230c39[_0x8059('0x47')]['id'])});}});}})[_0x8059('0x21')](respondWithStatusCode(_0x3be51a,null))['catch'](handleError(_0x3be51a,null));};exports['getAgents']=function(_0x1b9f1a,_0x1452ed,_0x3fbdbe){var _0x32c6f2={};var _0x1a92c9={};var _0x29715f;var _0x5f3d1a;return db[_0x8059('0x42')][_0x8059('0x70')]({'where':{'id':_0x1b9f1a[_0x8059('0x47')]['id']}})['then'](handleEntityNotFound(_0x1452ed,null))[_0x8059('0x21')](function(_0x3c3b4d){if(_0x3c3b4d){_0x29715f=_0x3c3b4d;_0x1a92c9[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x71')][_0x8059('0x2c')]);_0x1a92c9[_0x8059('0x31')]=_[_0x8059('0x32')](_0x1b9f1a[_0x8059('0x31')]);_0x1a92c9[_0x8059('0x33')]=_[_0x8059('0x34')](_0x1a92c9[_0x8059('0x30')],_0x1a92c9[_0x8059('0x31')]);_0x32c6f2[_0x8059('0x36')]=_[_0x8059('0x34')](_0x1a92c9['model'],qs[_0x8059('0x35')](_0x1b9f1a[_0x8059('0x31')]['fields']));_0x32c6f2[_0x8059('0x36')]=_0x32c6f2['attributes'][_0x8059('0x37')]?_0x32c6f2[_0x8059('0x36')]:_0x1a92c9[_0x8059('0x30')];_0x32c6f2[_0x8059('0x72')]=qs[_0x8059('0x39')](_0x1b9f1a[_0x8059('0x31')][_0x8059('0x39')]);_0x32c6f2[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x1b9f1a[_0x8059('0x31')],_0x1a92c9[_0x8059('0x33')]));if(_0x1b9f1a['query']['filter']){_0x32c6f2[_0x8059('0x3a')]=_[_0x8059('0x3e')](_0x32c6f2['where'],{'$or':_[_0x8059('0x2b')](_0x32c6f2['attributes'],function(_0x27fb1c){var _0x33e2e9={};_0x33e2e9[_0x27fb1c]={'$like':'%'+_0x1b9f1a[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x33e2e9;})});}_0x32c6f2=_[_0x8059('0x3e')]({},_0x32c6f2,_0x1b9f1a[_0x8059('0x48')]);return _0x29715f[_0x8059('0x73')](_0x32c6f2);}})[_0x8059('0x21')](function(_0x403f68){if(_0x403f68){_0x5f3d1a=_0x403f68[_0x8059('0x37')];if(!_0x1b9f1a['query'][_0x8059('0x38')](_0x8059('0x74'))){_0x32c6f2['limit']=qs[_0x8059('0x1c')](_0x1b9f1a[_0x8059('0x31')][_0x8059('0x1c')]);_0x32c6f2[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x1b9f1a['query'][_0x8059('0x1a')]);}return _0x29715f[_0x8059('0x73')](_0x32c6f2);}})[_0x8059('0x21')](function(_0x360f2d){if(_0x360f2d){return _0x360f2d?{'count':_0x5f3d1a,'rows':_0x360f2d}:null;}})['then'](respondWithResult(_0x1452ed,null))[_0x8059('0x45')](handleError(_0x1452ed,null));};exports[_0x8059('0x75')]=function(_0x6356ed,_0x36c21b,_0x299b67){var _0x43388b={};var _0x29e863={};var _0x3ac878;var _0x163883;return db[_0x8059('0x42')]['findOne']({'where':{'id':_0x6356ed[_0x8059('0x47')]['id']}})[_0x8059('0x21')](handleEntityNotFound(_0x36c21b,null))[_0x8059('0x21')](function(_0x3fe77d){if(_0x3fe77d){_0x3ac878=_0x3fe77d;_0x29e863[_0x8059('0x30')]=_[_0x8059('0x32')](db[_0x8059('0x76')][_0x8059('0x2c')]);_0x29e863[_0x8059('0x31')]=_[_0x8059('0x32')](_0x6356ed['query']);_0x29e863[_0x8059('0x33')]=_[_0x8059('0x34')](_0x29e863[_0x8059('0x30')],_0x29e863[_0x8059('0x31')]);_0x43388b[_0x8059('0x36')]=_[_0x8059('0x34')](_0x29e863['model'],qs['fields'](_0x6356ed[_0x8059('0x31')]['fields']));_0x43388b['attributes']=_0x43388b['attributes'][_0x8059('0x37')]?_0x43388b[_0x8059('0x36')]:_0x29e863[_0x8059('0x30')];_0x43388b[_0x8059('0x72')]=qs['sort'](_0x6356ed[_0x8059('0x31')][_0x8059('0x39')]);_0x43388b[_0x8059('0x3a')]=qs[_0x8059('0x33')](_[_0x8059('0x3b')](_0x6356ed[_0x8059('0x31')],_0x29e863['filters']));if(_0x6356ed[_0x8059('0x31')][_0x8059('0x3d')]){_0x43388b[_0x8059('0x3a')]=_[_0x8059('0x3e')](_0x43388b[_0x8059('0x3a')],{'$or':_[_0x8059('0x2b')](_0x43388b[_0x8059('0x36')],function(_0x1c2e18){var _0x15a50f={};_0x15a50f[_0x1c2e18]={'$like':'%'+_0x6356ed[_0x8059('0x31')][_0x8059('0x3d')]+'%'};return _0x15a50f;})});}_0x43388b=_[_0x8059('0x3e')]({},_0x43388b,_0x6356ed[_0x8059('0x48')]);return _0x3ac878[_0x8059('0x75')](_0x43388b);}})['then'](function(_0x26f318){if(_0x26f318){_0x163883=_0x26f318[_0x8059('0x37')];if(!_0x6356ed[_0x8059('0x31')][_0x8059('0x38')]('nolimit')){_0x43388b['limit']=qs['limit'](_0x6356ed['query'][_0x8059('0x1c')]);_0x43388b[_0x8059('0x1a')]=qs[_0x8059('0x1a')](_0x6356ed[_0x8059('0x31')][_0x8059('0x1a')]);}return _0x3ac878[_0x8059('0x75')](_0x43388b);}})[_0x8059('0x21')](function(_0x2ec671){if(_0x2ec671){return _0x2ec671?{'count':_0x163883,'rows':_0x2ec671}:null;}})[_0x8059('0x21')](respondWithResult(_0x36c21b,null))[_0x8059('0x45')](handleError(_0x36c21b,null));};exports[_0x8059('0x77')]=function(_0x28a925,_0x4bc6a7,_0x11462a){var _0x42378f=_0x28a925[_0x8059('0x4e')][_0x8059('0x6b')];var _0x5369dd;return db[_0x8059('0x76')][_0x8059('0x43')]({'where':{'id':_0x42378f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8059('0x78'),'attributes':['id','name',_0x8059('0x79'),_0x8059('0x7a'),_0x8059('0x7b')],'raw':!![]}]})[_0x8059('0x21')](function(_0x23c4ce){if(_0x23c4ce){_0x5369dd=_0x23c4ce;var _0x179a1a=_[_0x8059('0x7c')](_0x23c4ce,function(_0x485ca3){var _0x234f25=_0x485ca3[_0x8059('0x23')]({'plain':!![]});return _0x234f25[_0x8059('0x78')];});return db[_0x8059('0x42')][_0x8059('0x49')]({'where':{'id':_0x28a925[_0x8059('0x47')]['id']}})[_0x8059('0x21')](function(_0x59d597){return db[_0x8059('0x4b')]['transaction'](function(_0x396e77){return _0x59d597[_0x8059('0x77')](_0x42378f,{'transaction':_0x396e77})[_0x8059('0x21')](function(){return BPromise[_0x8059('0x7d')](_0x5369dd,function(_0x554d39){return db[_0x8059('0x7e')][_0x8059('0x7f')]({'TeamId':_0x554d39['id'],'VoicePrefixId':_0x28a925['params']['id']},{'transaction':_0x396e77});});})['then'](function(){return BPromise[_0x8059('0x7d')](_0x179a1a,function(_0x52dc27){return db[_0x8059('0x80')][_0x8059('0x81')]({'where':{'UserId':_0x52dc27['id'],'VoicePrefixId':_0x28a925[_0x8059('0x47')]['id']},'transaction':_0x396e77});});})[_0x8059('0x21')](function(){_0x179a1a[_0x8059('0x82')](function(_0x4f5235){socket['emit']('userVoicePrefix:save',{'UserId':_0x4f5235['id'],'VoicePrefixId':_0x59d597['id']});});});});});}})['then'](respondWithStatusCode(_0x4bc6a7,null))[_0x8059('0x45')](handleError(_0x4bc6a7,null));};exports[_0x8059('0x83')]=function(_0x3741b9,_0x59feb8,_0x390e92){return db[_0x8059('0x76')][_0x8059('0x43')]({'where':{'id':_0x3741b9[_0x8059('0x31')][_0x8059('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x59feb8,null))[_0x8059('0x21')](function(_0xe6758c){var _0x11b71b=_[_0x8059('0x2b')](_0xe6758c,'id');var _0x4cc1c0=[];var _0x4e1ca4=[];var _0x5282b2=squel[_0x8059('0x84')]();_0x5282b2[_0x8059('0x85')]('tq.TeamId')[_0x8059('0x86')](_0x8059('0x87'),'tq')[_0x8059('0x88')](_0x8059('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8059('0x3a')](_0x8059('0x8a'),_0x3741b9[_0x8059('0x47')]['id']);for(var _0xdd7d0d=0x0;_0xdd7d0d<_0xe6758c[_0x8059('0x37')];_0xdd7d0d+=0x1){let _0x1922be=_0xe6758c[_0xdd7d0d];for(var _0x1baaba=0x0;_0x1baaba<_0x1922be[_0x8059('0x78')][_0x8059('0x37')];_0x1baaba+=0x1){let _0x4ca098=_0x1922be[_0x8059('0x78')][_0x1baaba];var _0x1e5ff8=_0x5282b2[_0x8059('0x8b')]();_0x1e5ff8['where']('ut.UserId\x20=\x20?',_0x4ca098['id']);_0x4e1ca4['push'](db[_0x8059('0x4b')][_0x8059('0x31')](_0x1e5ff8[_0x8059('0x8c')](),{'type':db[_0x8059('0x4b')][_0x8059('0x8d')][_0x8059('0x8e')]})[_0x8059('0x21')](function(_0x31fa7f){if(_0x31fa7f[_0x8059('0x37')]===0x1){return _0x4ca098['id'];}else{var _0x38dc0d=_[_0x8059('0x8f')](_['map'](_0x31fa7f,'TeamId'),function(_0x2b6c58){return _['includes'](_0x11b71b,_0x2b6c58);});if(_0x38dc0d){return _0x4ca098['id'];}}}));}}return BPromise[_0x8059('0x90')](_0x4e1ca4)[_0x8059('0x21')](function(_0xbe8fb){_0x4cc1c0=_(_0x4cc1c0)[_0x8059('0x91')](_0xbe8fb)[_0x8059('0x92')]()[_0x8059('0x93')]();return db['VoicePrefix'][_0x8059('0x49')]({'where':{'id':_0x3741b9[_0x8059('0x47')]['id']}})[_0x8059('0x21')](function(_0x3a5e9a){return db[_0x8059('0x4b')][_0x8059('0x4c')](function(_0x13dcc1){return _0x3a5e9a[_0x8059('0x83')](_0x3741b9[_0x8059('0x31')][_0x8059('0x6b')],{'transaction':_0x13dcc1})[_0x8059('0x21')](function(){if(!_[_0x8059('0x94')](_0x4cc1c0)){return _0x3a5e9a[_0x8059('0x6d')](_0x4cc1c0,{'transaction':_0x13dcc1});}})[_0x8059('0x21')](function(){_0x4cc1c0['forEach'](function(_0x3be218){socket['emit']('userVoicePrefix:remove',{'UserId':_0x3be218,'VoicePrefixId':_0x3a5e9a['id']});});});});});});})['then'](respondWithStatusCode(_0x59feb8,null))[_0x8059('0x45')](handleError(_0x59feb8,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index ec977b5..f1d4649 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 _0xe816=['emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x3cb68a,_0x648f8e){var _0x2e0bac=function(_0x459717){while(--_0x459717){_0x3cb68a['push'](_0x3cb68a['shift']());}};_0x2e0bac(++_0x648f8e);}(_0xe816,0x1bb));var _0x6e81=function(_0x16577c,_0x33d9a4){_0x16577c=_0x16577c-0x0;var _0x4d19b7=_0xe816[_0x16577c];return _0x4d19b7;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x6e81('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6e81('0x1')](0x0);var events={'afterCreate':_0x6e81('0x2'),'afterUpdate':_0x6e81('0x3'),'afterDestroy':_0x6e81('0x4')};function emitEvent(_0x1825d1){return function(_0x2043f2,_0x47140f,_0x54757c){VoicePrefixEvents[_0x6e81('0x5')](_0x1825d1+':'+_0x2043f2['id'],_0x2043f2);VoicePrefixEvents[_0x6e81('0x5')](_0x1825d1,_0x2043f2);_0x54757c(null);};}for(var e in events){if(events[_0x6e81('0x6')](e)){var event=events[e];VoicePrefix[_0x6e81('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x7d0b=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1a8d3a,_0x25589f){var _0x3b7cc6=function(_0x325fa0){while(--_0x325fa0){_0x1a8d3a['push'](_0x1a8d3a['shift']());}};_0x3b7cc6(++_0x25589f);}(_0x7d0b,0x102));var _0xb7d0=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7d0b[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xb7d0('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb7d0('0x1')](0x0);var events={'afterCreate':_0xb7d0('0x2'),'afterUpdate':_0xb7d0('0x3'),'afterDestroy':_0xb7d0('0x4')};function emitEvent(_0x4c6c65){return function(_0x4d1867,_0x5e30ca,_0x461c0f){VoicePrefixEvents[_0xb7d0('0x5')](_0x4c6c65+':'+_0x4d1867['id'],_0x4d1867);VoicePrefixEvents['emit'](_0x4c6c65,_0x4d1867);_0x461c0f(null);};}for(var e in events){if(events[_0xb7d0('0x6')](e)){var event=events[e];VoicePrefix[_0xb7d0('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index d8b5d2b..614d0f3 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 _0x80d2=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','api','moment','bluebird'];(function(_0x53ed59,_0x4beb34){var _0x5834ca=function(_0x5f51f0){while(--_0x5f51f0){_0x53ed59['push'](_0x53ed59['shift']());}};_0x5834ca(++_0x4beb34);}(_0x80d2,0x189));var _0x280d=function(_0x365092,_0x53e788){_0x365092=_0x365092-0x0;var _0x48a039=_0x80d2[_0x365092];return _0x48a039;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x280d('0x0'));var moment=require(_0x280d('0x1'));var BPromise=require(_0x280d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x280d('0x3'));var rimraf=require(_0x280d('0x4'));var config=require(_0x280d('0x5'));var attributes=require(_0x280d('0x6'));module[_0x280d('0x7')]=function(_0x4d69f2,_0xd4c8b6){return _0x4d69f2[_0x280d('0x8')](_0x280d('0x9'),attributes,{'tableName':_0x280d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5735=['define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x4dc9bb,_0x2d01dc){var _0x5679d4=function(_0xd94f58){while(--_0xd94f58){_0x4dc9bb['push'](_0x4dc9bb['shift']());}};_0x5679d4(++_0x2d01dc);}(_0x5735,0x100));var _0x5573=function(_0x35f83e,_0x30ec55){_0x35f83e=_0x35f83e-0x0;var _0x249b05=_0x5735[_0x35f83e];return _0x249b05;};'use strict';var _=require(_0x5573('0x0'));var util=require('util');var logger=require(_0x5573('0x1'))(_0x5573('0x2'));var moment=require('moment');var BPromise=require(_0x5573('0x3'));var rp=require(_0x5573('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5573('0x5'));var attributes=require(_0x5573('0x6'));module[_0x5573('0x7')]=function(_0x30b9f1,_0x1e2261){return _0x30b9f1[_0x5573('0x8')](_0x5573('0x9'),attributes,{'tableName':_0x5573('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index a9c74dc..cfd7ad6 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 _0x25a9=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x25a9,0xf1));var _0x925a=function(_0xc72a72,_0xfaaf35){_0xc72a72=_0xc72a72-0x0;var _0x20f9a9=_0x25a9[_0xc72a72];return _0x20f9a9;};'use strict';var _=require('lodash');var util=require(_0x925a('0x0'));var moment=require(_0x925a('0x1'));var BPromise=require(_0x925a('0x2'));var rs=require(_0x925a('0x3'));var fs=require('fs');var Redis=require(_0x925a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x925a('0x5'));var logger=require(_0x925a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x925a('0x7'));var client=jayson['client'][_0x925a('0x8')]({'port':0x232a});config[_0x925a('0x9')]=_[_0x925a('0xa')](config[_0x925a('0x9')],{'host':_0x925a('0xb'),'port':0x18eb});var socket=require(_0x925a('0xc'))(new Redis(config[_0x925a('0x9')]));require('./voicePrefix.socket')[_0x925a('0xd')](socket);function respondWithRpcPromise(_0x55a571,_0x4f76b2,_0x575450){return new BPromise(function(_0x152980,_0x5871f4){return client[_0x925a('0xe')](_0x55a571,_0x575450)[_0x925a('0xf')](function(_0xe633a1){logger[_0x925a('0x10')](_0x925a('0x11'),_0x4f76b2,_0x925a('0x12'));logger['debug'](_0x925a('0x13'),_0x4f76b2,_0x925a('0x12'),JSON[_0x925a('0x14')](_0xe633a1));if(_0xe633a1[_0x925a('0x15')]){if(_0xe633a1[_0x925a('0x15')][_0x925a('0x16')]===0x1f4){logger[_0x925a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4f76b2,_0xe633a1[_0x925a('0x15')][_0x925a('0x17')]);return _0x5871f4(_0xe633a1[_0x925a('0x15')][_0x925a('0x17')]);}logger['error'](_0x925a('0x11'),_0x4f76b2,_0xe633a1[_0x925a('0x15')]['message']);return _0x152980(_0xe633a1[_0x925a('0x15')][_0x925a('0x17')]);}else{logger[_0x925a('0x10')](_0x925a('0x11'),_0x4f76b2,'request\x20sent');_0x152980(_0xe633a1[_0x925a('0x18')][_0x925a('0x17')]);}})[_0x925a('0x19')](function(_0x3375e6){logger[_0x925a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4f76b2,_0x3375e6);_0x5871f4(_0x3375e6);});});} \ No newline at end of file +var _0x44c2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','socket.io-emitter','redis','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x89100d,_0x59c43d){var _0x15974a=function(_0x2fb1ac){while(--_0x2fb1ac){_0x89100d['push'](_0x89100d['shift']());}};_0x15974a(++_0x59c43d);}(_0x44c2,0x100));var _0x244c=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x44c2[_0xadde88];return _0x3b8eb6;};'use strict';var _=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var moment=require(_0x244c('0x2'));var BPromise=require(_0x244c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x244c('0x4'));var db=require(_0x244c('0x5'))['db'];var utils=require(_0x244c('0x6'));var logger=require(_0x244c('0x7'))(_0x244c('0x8'));var config=require(_0x244c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x244c('0xa')]({'port':0x232a});config['redis']=_[_0x244c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x244c('0xc'))(new Redis(config[_0x244c('0xd')]));require('./voicePrefix.socket')[_0x244c('0xe')](socket);function respondWithRpcPromise(_0x5b873e,_0x519feb,_0x10a810){return new BPromise(function(_0x4d7289,_0x16c6f9){return client['request'](_0x5b873e,_0x10a810)[_0x244c('0xf')](function(_0x53c038){logger['info'](_0x244c('0x10'),_0x519feb,_0x244c('0x11'));logger[_0x244c('0x12')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x519feb,_0x244c('0x11'),JSON[_0x244c('0x13')](_0x53c038));if(_0x53c038[_0x244c('0x14')]){if(_0x53c038[_0x244c('0x14')][_0x244c('0x15')]===0x1f4){logger[_0x244c('0x14')](_0x244c('0x10'),_0x519feb,_0x53c038['error'][_0x244c('0x16')]);return _0x16c6f9(_0x53c038['error']['message']);}logger[_0x244c('0x14')](_0x244c('0x10'),_0x519feb,_0x53c038[_0x244c('0x14')][_0x244c('0x16')]);return _0x4d7289(_0x53c038['error'][_0x244c('0x16')]);}else{logger[_0x244c('0x17')](_0x244c('0x10'),_0x519feb,_0x244c('0x11'));_0x4d7289(_0x53c038[_0x244c('0x18')]['message']);}})[_0x244c('0x19')](function(_0x2af7eb){logger[_0x244c('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x519feb,_0x2af7eb);_0x16c6f9(_0x2af7eb);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index eb90422..5094cc2 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 _0xc6d8=['remove','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0xd4ad6d,_0x5f0f35){var _0x5dca7d=function(_0x57b027){while(--_0x57b027){_0xd4ad6d['push'](_0xd4ad6d['shift']());}};_0x5dca7d(++_0x5f0f35);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x498e3c,_0x2455c4){_0x498e3c=_0x498e3c-0x0;var _0x1e5f5f=_0xc6d8[_0x498e3c];return _0x1e5f5f;};'use strict';var VoicePrefixEvents=require(_0x8c6d('0x0'));var events=['save',_0x8c6d('0x1'),'update'];function createListener(_0x3b88d1,_0x5974d3){return function(_0x292852){_0x5974d3['emit'](_0x3b88d1,_0x292852);};}function removeListener(_0x5b6b04,_0x352b8c){return function(){VoicePrefixEvents[_0x8c6d('0x2')](_0x5b6b04,_0x352b8c);};}exports[_0x8c6d('0x3')]=function(_0x4f5e8f){for(var _0x3c265c=0x0,_0x2dbb52=events[_0x8c6d('0x4')];_0x3c265c<_0x2dbb52;_0x3c265c++){var _0x5529f1=events[_0x3c265c];var _0x1496ba=createListener(_0x8c6d('0x5')+_0x5529f1,_0x4f5e8f);VoicePrefixEvents['on'](_0x5529f1,_0x1496ba);}}; \ No newline at end of file +var _0x0269=['register','length','voicePrefix:','./voicePrefix.events','remove','emit'];(function(_0x1cf9aa,_0x1a6f97){var _0x4d6c6e=function(_0x5b2dde){while(--_0x5b2dde){_0x1cf9aa['push'](_0x1cf9aa['shift']());}};_0x4d6c6e(++_0x1a6f97);}(_0x0269,0x135));var _0x9026=function(_0x52f6d3,_0x5b1c26){_0x52f6d3=_0x52f6d3-0x0;var _0x56659e=_0x0269[_0x52f6d3];return _0x56659e;};'use strict';var VoicePrefixEvents=require(_0x9026('0x0'));var events=['save',_0x9026('0x1'),'update'];function createListener(_0x190158,_0x5771e3){return function(_0x470464){_0x5771e3[_0x9026('0x2')](_0x190158,_0x470464);};}function removeListener(_0x357df7,_0xa3ba06){return function(){VoicePrefixEvents['removeListener'](_0x357df7,_0xa3ba06);};}exports[_0x9026('0x3')]=function(_0x15ff31){for(var _0x531611=0x0,_0x540056=events[_0x9026('0x4')];_0x531611<_0x540056;_0x531611++){var _0x1a212f=events[_0x531611];var _0x1149ad=createListener(_0x9026('0x5')+_0x1a212f,_0x15ff31);VoicePrefixEvents['on'](_0x1a212f,_0x1149ad);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d83e93c..22c5ea6 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x150aa1,_0x16169e){var _0x186ac7=function(_0x2b8786){while(--_0x2b8786){_0x150aa1['push'](_0x150aa1['shift']());}};_0x186ac7(++_0x16169e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _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(_0x5999ba,_0x97b26a){var _0x2140b5=function(_0x23b3fb){while(--_0x23b3fb){_0x5999ba['push'](_0x5999ba['shift']());}};_0x2140b5(++_0x97b26a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 0de2ab6..59964ab 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 _0x63c0=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','name','inbound','outbound','default','ENUM','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','INTEGER','STRING','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x163691,_0x3d10c4){var _0x543ae5=function(_0x4af2ea){while(--_0x4af2ea){_0x163691['push'](_0x163691['shift']());}};_0x543ae5(++_0x3d10c4);}(_0x63c0,0xed));var _0x063c=function(_0x332251,_0x3c134f){_0x332251=_0x332251-0x0;var _0x592e7d=_0x63c0[_0x332251];return _0x592e7d;};'use strict';var Sequelize=require(_0x063c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x063c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x063c('0x2'),_0x063c('0x3')),'allowNull':![],'defaultValue':_0x063c('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x063c('0x4')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x063c('0x5')]('rr',_0x063c('0x6'),_0x063c('0x7'),_0x063c('0x8'),'random',_0x063c('0x9'),'linear',_0x063c('0xa'),_0x063c('0xb')),'allowNull':![],'defaultValue':_0x063c('0x6'),'set':function(_0x250dc8){this[_0x063c('0xc')](_0x063c('0xd'),_0x250dc8?_0x250dc8:_0x063c('0x9'));},'get':function(){var _0x2940de=this[_0x063c('0xe')]('type');var _0x263c92=this[_0x063c('0xe')](_0x063c('0xf'));var _0x18b6ca=this['getDataValue']('strategy');if(_0x2940de==='outbound'){if(_0x263c92===_0x063c('0x10')){return null;}if(_0x263c92===_0x063c('0x11')&&!['rrmemory','roundrobin']['includes'](_0x18b6ca)){this[_0x063c('0xc')](_0x063c('0xd'),_0x063c('0x9'));}}return _0x18b6ca;}},'servicelevel':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x063c('0x12')](0xb)},'timeout':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x063c('0x13')]},'weight':{'type':Sequelize[_0x063c('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x063c('0x14'),'no'),'defaultValue':_0x063c('0x14')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x063c('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x063c('0x12')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x063c('0x5')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x063c('0x5')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x063c('0x5')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x063c('0x13')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defaultValue':_0x063c('0x14')},'announce_holdtime':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no',_0x063c('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x063c('0x13')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x063c('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x063c('0x13')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x063c('0x13')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x063c('0x13')]},'queue_quantity2':{'type':Sequelize[_0x063c('0x13')]},'queue_periodic_announce':{'type':Sequelize[_0x063c('0x13')]},'queue_less_than':{'type':Sequelize[_0x063c('0x13')]},'periodic_announce':{'type':Sequelize[_0x063c('0x17')],'set':function(_0xb73849){this[_0x063c('0xc')](_0x063c('0x18'),_0xb73849?_0xb73849[_0x063c('0x19')](','):[]);},'get':function(){return this[_0x063c('0xe')](_0x063c('0x18'))?this[_0x063c('0xe')](_0x063c('0x18'))[_0x063c('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x063c('0x13')],'defaultValue':'yes','set':function(_0x443a66){this['setDataValue'](_0x063c('0x1b'),_0x443a66?_0x443a66[_0x063c('0x19')](','):undefined);},'get':function(){return this[_0x063c('0xe')](_0x063c('0x1b'))?this[_0x063c('0xe')](_0x063c('0x1b'))[_0x063c('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x063c('0x13')],'defaultValue':'no','set':function(_0x4a2444){this['setDataValue']('leavewhenempty',_0x4a2444?_0x4a2444[_0x063c('0x19')](','):undefined);},'get':function(){return this[_0x063c('0xe')](_0x063c('0x1c'))?this[_0x063c('0xe')](_0x063c('0x1c'))[_0x063c('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x063c('0x13')]},'description':{'type':Sequelize[_0x063c('0x13')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5f1336){this['setDataValue'](_0x063c('0x1d'),_0x5f1336);if(_0x5f1336){if(this['getDataValue']('wrapuptime')<0x2){this[_0x063c('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x063c('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':0x0,'comment':_0x063c('0x1f')},'dialMethod':{'type':Sequelize[_0x063c('0x5')]('preview',_0x063c('0x20'),'power',_0x063c('0x21'),_0x063c('0x11')),'defaultValue':_0x063c('0x20'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x063c('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x063c('0x23')},'dialLimitQueue':{'type':Sequelize[_0x063c('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x063c('0x24')},'dialPowerLevel':{'type':Sequelize[_0x063c('0x25')](0x2)[_0x063c('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x063c('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x063c('0x5')](_0x063c('0x27'),_0x063c('0x28')),'defaultValue':'dropRate','comment':_0x063c('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x063c('0x25')](0x2)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x063c('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x063c('0x13')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x063c('0x13')]},'dialOriginateTimeout':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x063c('0x13')],'defaultValue':'tTxX','comment':_0x063c('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x2d')},'dialQueueProject':{'type':Sequelize[_0x063c('0x13')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'comment':_0x063c('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x063c('0x13')],'defaultValue':_0x063c('0x33')},'dialPrefix':{'type':Sequelize[_0x063c('0x13')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x063c('0x34'),'never',_0x063c('0x35')),'defaultValue':_0x063c('0x34')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x063c('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x063c('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x063c('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x063c('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x063c('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x063c('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x063c('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x063c('0x12')](0x9)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x063c('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x063c('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x063c('0x3c')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x063c('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':0x0,'comment':_0x063c('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x063c('0x5')]('DESC',_0x063c('0x3f')),'defaultValue':_0x063c('0x40')},'dialQueueProject2':{'type':Sequelize[_0x063c('0x13')],'comment':_0x063c('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x063c('0x42')},'dialCutDigit':{'type':Sequelize[_0x063c('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x063c('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x063c('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x063c('0x12')](0x5)[_0x063c('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x063c('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x063c('0x12')],'allowNull':!![],'comment':_0x063c('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':![],'comment':_0x063c('0x4d'),'set':function(_0x5e7d71){if(!_0x5e7d71)this[_0x063c('0xc')]('mandatoryDispositionPauseId',null);this[_0x063c('0xc')]('mandatoryDisposition',_0x5e7d71);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x063c('0x12')](0x3)[_0x063c('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x063c('0x22')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x063c('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x43f7=['#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','inbound','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','type','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x43f7,0x14f));var _0x743f=function(_0x49eae4,_0xc94d2a){_0x49eae4=_0x49eae4-0x0;var _0x379229=_0x43f7[_0x49eae4];return _0x379229;};'use strict';var Sequelize=require(_0x743f('0x0'));module[_0x743f('0x1')]={'name':{'type':Sequelize[_0x743f('0x2')],'allowNull':![],'unique':_0x743f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x743f('0x4')]('inbound',_0x743f('0x5')),'allowNull':![],'defaultValue':_0x743f('0x6')},'musiconhold':{'type':Sequelize[_0x743f('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x743f('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x743f('0x7'),_0x743f('0x8'),_0x743f('0x9'),_0x743f('0xa'),_0x743f('0xb'),_0x743f('0xc'),_0x743f('0xd')),'allowNull':![],'defaultValue':_0x743f('0xe'),'set':function(_0x4b95a3){this[_0x743f('0xf')](_0x743f('0x10'),_0x4b95a3?_0x4b95a3:_0x743f('0xa'));},'get':function(){var _0x259b4d=this['getDataValue'](_0x743f('0x11'));var _0x22f576=this[_0x743f('0x12')](_0x743f('0x13'));var _0x4e1064=this['getDataValue'](_0x743f('0x10'));if(_0x259b4d===_0x743f('0x5')){if(_0x22f576===_0x743f('0x14')){return null;}if(_0x22f576===_0x743f('0x15')&&!['rrmemory',_0x743f('0x16')][_0x743f('0x17')](_0x4e1064)){this['setDataValue']('strategy',_0x743f('0xa'));}}return _0x4e1064;}},'servicelevel':{'type':Sequelize[_0x743f('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x743f('0x18')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x743f('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x743f('0x2')]},'weight':{'type':Sequelize[_0x743f('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x743f('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x19'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x19'),'no',_0x743f('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x743f('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x743f('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x743f('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x743f('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x743f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x743f('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x743f('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x743f('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x19'),'no'),'defaultValue':_0x743f('0x19')},'announce_holdtime':{'type':Sequelize[_0x743f('0x4')]('yes','no',_0x743f('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x743f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x743f('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x743f('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x743f('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x743f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x743f('0x2')]},'queue_youarenext':{'type':Sequelize[_0x743f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x743f('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x743f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x743f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x743f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x743f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x743f('0x2')]},'queue_quantity1':{'type':Sequelize[_0x743f('0x2')]},'queue_quantity2':{'type':Sequelize[_0x743f('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x743f('0x2')]},'queue_less_than':{'type':Sequelize[_0x743f('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x17afd2){this['setDataValue']('periodic_announce',_0x17afd2?_0x17afd2[_0x743f('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0x743f('0x1d'))?this[_0x743f('0x12')]('periodic_announce')[_0x743f('0x1e')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x15aa39){this['setDataValue'](_0x743f('0x1f'),_0x15aa39?_0x15aa39[_0x743f('0x1c')](','):undefined);},'get':function(){return this[_0x743f('0x12')](_0x743f('0x1f'))?this[_0x743f('0x12')](_0x743f('0x1f'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x743f('0x2')],'defaultValue':'no','set':function(_0x5e5405){this[_0x743f('0xf')](_0x743f('0x20'),_0x5e5405?_0x5e5405[_0x743f('0x1c')](','):undefined);},'get':function(){return this[_0x743f('0x12')](_0x743f('0x20'))?this[_0x743f('0x12')]('leavewhenempty')[_0x743f('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x743f('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x743f('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x743f('0x2')]},'description':{'type':Sequelize[_0x743f('0x2')]},'acw':{'type':Sequelize[_0x743f('0x21')],'defaultValue':0x0,'set':function(_0x2b0b99){this[_0x743f('0xf')]('acw',_0x2b0b99);if(_0x2b0b99){if(this[_0x743f('0x12')](_0x743f('0x22'))<0x2){this[_0x743f('0xf')](_0x743f('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x743f('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x743f('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x14'),'progressive',_0x743f('0x23'),_0x743f('0x24'),_0x743f('0x15')),'defaultValue':_0x743f('0x25'),'comment':_0x743f('0x26')},'dialLimitChannel':{'type':Sequelize[_0x743f('0x18')](0x4)[_0x743f('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x743f('0x28')},'dialLimitQueue':{'type':Sequelize[_0x743f('0x18')](0x4)[_0x743f('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x743f('0x29')](0x2)[_0x743f('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x743f('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0x743f('0x4')](_0x743f('0x2b'),'dropRate'),'defaultValue':_0x743f('0x2c'),'comment':_0x743f('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x743f('0x29')](0x2)[_0x743f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x743f('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x743f('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x743f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x743f('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x743f('0x2')],'defaultValue':_0x743f('0x30'),'comment':_0x743f('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x743f('0x2')],'comment':_0x743f('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x743f('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x743f('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x743f('0x18')](0x5)[_0x743f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x743f('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0x743f('0x18')](0x5)[_0x743f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x743f('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x743f('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x743f('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x743f('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x743f('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x743f('0x38')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x743f('0x39')},'dialPrefix':{'type':Sequelize[_0x743f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x743f('0x3a'),'never',_0x743f('0x3b')),'defaultValue':_0x743f('0x3a')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x743f('0x18')](0x9)[_0x743f('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x743f('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x743f('0x18')](0x9)[_0x743f('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x743f('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x743f('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x743f('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x743f('0x18')](0x9)[_0x743f('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x743f('0x3f')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x743f('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x743f('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x743f('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x743f('0x18')](0x9)[_0x743f('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x743f('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x743f('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x743f('0x43')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x743f('0x18')](0x9)[_0x743f('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x743f('0x44')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x743f('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x743f('0x45')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x743f('0x46')},'dialOrderByScheduledAt':{'type':Sequelize[_0x743f('0x4')]('DESC','ASC'),'defaultValue':_0x743f('0x47')},'dialQueueProject2':{'type':Sequelize[_0x743f('0x2')],'comment':_0x743f('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x743f('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x743f('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x743f('0x48')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x743f('0x49')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x743f('0x4a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x743f('0x4b')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x743f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x743f('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x743f('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x743f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x743f('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x743f('0x18')](0x5)[_0x743f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x743f('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x743f('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x743f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x743f('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x743f('0x18')],'allowNull':!![],'comment':_0x743f('0x50')},'mandatoryDisposition':{'type':Sequelize[_0x743f('0x21')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2cb98b){if(!_0x2cb98b)this[_0x743f('0xf')]('mandatoryDispositionPauseId',null);this[_0x743f('0xf')](_0x743f('0x51'),_0x2cb98b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x743f('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x743f('0x18')](0x3)[_0x743f('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x743f('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ce521e1..ee6bae8 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 _0x44fe=['../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','filter','ignore','type','value','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','VoiceQueue','findAll','rows','show','params','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','include','updatedAt','omit','createdAt','getHoppers','findOne','CmHopper','getHopperHistories','order','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','User','online','voicePause','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','interface','userVoiceQueue:save','removeTeams','Team','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','compact','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','select','cm_hopper','onlyIfOpen','COALESCE(phone,\x27\x27)','cm_contacts','all','cm_hopper_additional_phones','CmHopperId','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1b4913,_0x4fbf17){var _0x1c6e02=function(_0x2825fe){while(--_0x2825fe){_0x1b4913['push'](_0x1b4913['shift']());}};_0x1c6e02(++_0x4fbf17);}(_0x44fe,0x16f));var _0xe44f=function(_0x3492c6,_0xf2e6d8){_0x3492c6=_0x3492c6-0x0;var _0x5ef20f=_0x44fe[_0x3492c6];return _0x5ef20f;};'use strict';var emlformat=require(_0xe44f('0x0'));var rimraf=require(_0xe44f('0x1'));var zipdir=require(_0xe44f('0x2'));var jsonpatch=require(_0xe44f('0x3'));var rp=require(_0xe44f('0x4'));var moment=require(_0xe44f('0x5'));var BPromise=require(_0xe44f('0x6'));var Mustache=require(_0xe44f('0x7'));var util=require(_0xe44f('0x8'));var path=require(_0xe44f('0x9'));var sox=require(_0xe44f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe44f('0xb'));var _=require(_0xe44f('0xc'));var squel=require('squel');var crypto=require(_0xe44f('0xd'));var jsforce=require(_0xe44f('0xe'));var deskjs=require(_0xe44f('0xf'));var toCsv=require(_0xe44f('0x10'));var querystring=require(_0xe44f('0x11'));var Papa=require('papaparse');var Redis=require(_0xe44f('0x12'));var authService=require(_0xe44f('0x13'));var qs=require(_0xe44f('0x14'));var as=require(_0xe44f('0x15'));var hardwareService=require(_0xe44f('0x16'));var logger=require(_0xe44f('0x17'))(_0xe44f('0x18'));var utils=require(_0xe44f('0x19'));var config=require(_0xe44f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe44f('0x1b'))['db'];config[_0xe44f('0x1c')]=_['defaults'](config[_0xe44f('0x1c')],{'host':_0xe44f('0x1d'),'port':0x18eb});var socket=require(_0xe44f('0x1e'))(new Redis(config[_0xe44f('0x1c')]));require(_0xe44f('0x1f'))[_0xe44f('0x20')](socket);function respondWithStatusCode(_0x3ec218,_0x626f8){_0x626f8=_0x626f8||0xcc;return function(_0x590d05){if(_0x590d05){return _0x3ec218[_0xe44f('0x21')](_0x626f8);}return _0x3ec218[_0xe44f('0x22')](_0x626f8)[_0xe44f('0x23')]();};}function respondWithResult(_0x190fec,_0x31175b){_0x31175b=_0x31175b||0xc8;return function(_0x3d334f){if(_0x3d334f){return _0x190fec[_0xe44f('0x22')](_0x31175b)[_0xe44f('0x24')](_0x3d334f);}};}function respondWithFilteredResult(_0x396c29,_0x1678e2){return function(_0x163af0){if(_0x163af0){var _0x3e7d5e=typeof _0x1678e2['offset']==='undefined'&&typeof _0x1678e2[_0xe44f('0x25')]===_0xe44f('0x26');var _0x2767ef=_0x163af0[_0xe44f('0x27')];var _0x467cda=_0x3e7d5e?0x0:_0x1678e2[_0xe44f('0x28')];var _0x42ed0a=_0x3e7d5e?_0x163af0[_0xe44f('0x27')]:_0x1678e2[_0xe44f('0x28')]+_0x1678e2['limit'];var _0x487bca;if(_0x42ed0a>=_0x2767ef){_0x42ed0a=_0x2767ef;_0x487bca=0xc8;}else{_0x487bca=0xce;}_0x396c29[_0xe44f('0x22')](_0x487bca);return _0x396c29[_0xe44f('0x29')](_0xe44f('0x2a'),_0x467cda+'-'+_0x42ed0a+'/'+_0x2767ef)[_0xe44f('0x24')](_0x163af0);}return null;};}function patchUpdates(_0xf3c259){return function(_0x538a03){try{jsonpatch['apply'](_0x538a03,_0xf3c259,!![]);}catch(_0x412b36){return BPromise[_0xe44f('0x2b')](_0x412b36);}return _0x538a03[_0xe44f('0x2c')]();};}function saveUpdates(_0x20c7aa,_0x55b679){return function(_0x1aa2cf){if(_0x1aa2cf){return _0x1aa2cf[_0xe44f('0x2d')](_0x20c7aa)[_0xe44f('0x2e')](function(_0x90d216){return _0x90d216;});}return null;};}function removeEntity(_0x59667c,_0x45a632){return function(_0x162443){if(_0x162443){return _0x162443[_0xe44f('0x2f')]()['then'](function(){var _0x4e3cce=_0x162443[_0xe44f('0x30')]({'plain':!![]});var _0x42f994=[{'name':_0xe44f('0x31'),'value':'inbound','ignore':![]},{'name':_0xe44f('0x32'),'value':'outbound','ignore':![]}];var _0x373d29=_(_0x42f994)[_0xe44f('0x33')](_0xe44f('0x34'))['map']('value')['value']();if(_['includes'](_0x373d29,_0x4e3cce[_0xe44f('0x35')])){return;}var _0x30ef3b=_['find'](_0x42f994,[_0xe44f('0x36'),_0x4e3cce[_0xe44f('0x35')]])[_0xe44f('0x37')];return db[_0xe44f('0x38')][_0xe44f('0x2f')]({'where':{'type':_0x30ef3b,'resourceId':_0x4e3cce['id']}})[_0xe44f('0x2e')](function(){return _0x162443;});})['then'](function(){_0x59667c[_0xe44f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x366f19,_0x2ba023){return function(_0x3724c5){if(!_0x3724c5){_0x366f19['sendStatus'](0x194);}return _0x3724c5;};}function handleError(_0x4532c8,_0x5f513a){_0x5f513a=_0x5f513a||0x1f4;return function(_0x54f0f){logger[_0xe44f('0x39')](_0x54f0f[_0xe44f('0x3a')]);if(_0x54f0f['name']){delete _0x54f0f['name'];}_0x4532c8[_0xe44f('0x22')](_0x5f513a)[_0xe44f('0x3b')](_0x54f0f);};}exports[_0xe44f('0x3c')]=function(_0x400747,_0x543b4b){var _0x444379={},_0x3bd36c={},_0x51febd={'count':0x0,'rows':[]};var _0x440c25=_[_0xe44f('0x3d')](db['VoiceQueue'][_0xe44f('0x3e')],function(_0x385161){return{'name':_0x385161[_0xe44f('0x3f')],'type':_0x385161[_0xe44f('0x35')][_0xe44f('0x40')]};});_0x3bd36c[_0xe44f('0x41')]=_['map'](_0x440c25,'name');_0x3bd36c[_0xe44f('0x42')]=_['keys'](_0x400747[_0xe44f('0x42')]);_0x3bd36c[_0xe44f('0x43')]=_['intersection'](_0x3bd36c[_0xe44f('0x41')],_0x3bd36c[_0xe44f('0x42')]);_0x444379[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x3bd36c[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x400747[_0xe44f('0x42')][_0xe44f('0x46')]));_0x444379[_0xe44f('0x44')]=_0x444379[_0xe44f('0x44')][_0xe44f('0x47')]?_0x444379[_0xe44f('0x44')]:_0x3bd36c[_0xe44f('0x41')];if(!_0x400747[_0xe44f('0x42')][_0xe44f('0x48')](_0xe44f('0x49'))){_0x444379[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x400747[_0xe44f('0x42')]['limit']);_0x444379['offset']=qs[_0xe44f('0x28')](_0x400747[_0xe44f('0x42')]['offset']);}_0x444379['order']=qs[_0xe44f('0x4a')](_0x400747[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x444379[_0xe44f('0x4b')]=qs['filters'](_[_0xe44f('0x4c')](_0x400747[_0xe44f('0x42')],_0x3bd36c[_0xe44f('0x43')]),_0x440c25);if(_0x400747[_0xe44f('0x42')][_0xe44f('0x33')]){_0x444379[_0xe44f('0x4b')]=_['merge'](_0x444379[_0xe44f('0x4b')],{'$or':_['map'](_0x440c25,function(_0x10afcb){if(_0x10afcb[_0xe44f('0x35')]!==_0xe44f('0x4d')){var _0x17dea7={};_0x17dea7[_0x10afcb['name']]={'$like':'%'+_0x400747['query'][_0xe44f('0x33')]+'%'};return _0x17dea7;}})});}_0x444379=_[_0xe44f('0x4e')]({},_0x444379,_0x400747['options']);var _0x5ea96c={'where':_0x444379['where']};return db[_0xe44f('0x4f')][_0xe44f('0x27')](_0x5ea96c)['then'](function(_0x28b920){_0x51febd['count']=_0x28b920;if(_0x400747[_0xe44f('0x42')]['includeAll']){_0x444379['include']=[{'all':!![]}];}return db[_0xe44f('0x4f')][_0xe44f('0x50')](_0x444379);})[_0xe44f('0x2e')](function(_0x14b760){_0x51febd[_0xe44f('0x51')]=_0x14b760;return _0x51febd;})[_0xe44f('0x2e')](respondWithFilteredResult(_0x543b4b,_0x444379))['catch'](handleError(_0x543b4b,null));};exports[_0xe44f('0x52')]=function(_0x4bcba8,_0x1177f4){var _0x39fe4f={'raw':![],'where':{'id':_0x4bcba8[_0xe44f('0x53')]['id']}},_0x250c9={};_0x250c9[_0xe44f('0x41')]=_['keys'](db[_0xe44f('0x4f')]['rawAttributes']);_0x250c9['query']=_['keys'](_0x4bcba8[_0xe44f('0x42')]);_0x250c9[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x250c9[_0xe44f('0x41')],_0x250c9['query']);_0x39fe4f[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x250c9['model'],qs[_0xe44f('0x46')](_0x4bcba8[_0xe44f('0x42')][_0xe44f('0x46')]));_0x39fe4f[_0xe44f('0x44')]=_0x39fe4f['attributes'][_0xe44f('0x47')]?_0x39fe4f[_0xe44f('0x44')]:_0x250c9[_0xe44f('0x41')];if(_0x4bcba8[_0xe44f('0x42')][_0xe44f('0x54')]){_0x39fe4f['include']=[{'all':!![]}];}_0x39fe4f=_[_0xe44f('0x4e')]({},_0x39fe4f,_0x4bcba8[_0xe44f('0x55')]);return db[_0xe44f('0x4f')][_0xe44f('0x56')](_0x39fe4f)[_0xe44f('0x2e')](handleEntityNotFound(_0x1177f4,null))[_0xe44f('0x2e')](respondWithResult(_0x1177f4,null))[_0xe44f('0x57')](handleError(_0x1177f4,null));};exports[_0xe44f('0x58')]=function(_0x5a4662,_0x10798b){return db[_0xe44f('0x4f')][_0xe44f('0x58')](_0x5a4662[_0xe44f('0x59')],{})[_0xe44f('0x2e')](function(_0x312ff5){var _0x2a0d2d=_0x5a4662[_0xe44f('0x5a')][_0xe44f('0x30')]({'plain':!![]});if(!_0x2a0d2d)throw new Error(_0xe44f('0x5b'));if(_0x2a0d2d[_0xe44f('0x5c')]==='user'){var _0x14c984=_0x312ff5[_0xe44f('0x30')]({'plain':!![]});var _0x46a505=[{'name':_0xe44f('0x31'),'value':_0xe44f('0x5d')},{'name':'QueueCampaigns','value':_0xe44f('0x5e')}];var _0x2ce4fc=_[_0xe44f('0x56')](_0x46a505,[_0xe44f('0x36'),_0x14c984[_0xe44f('0x35')]])[_0xe44f('0x37')];return db[_0xe44f('0x5f')][_0xe44f('0x56')]({'where':{'name':_0x2ce4fc,'userProfileId':_0x2a0d2d[_0xe44f('0x60')]},'raw':!![]})[_0xe44f('0x2e')](function(_0x37d01d){if(_0x37d01d&&_0x37d01d['autoAssociation']===0x0){return db[_0xe44f('0x38')][_0xe44f('0x58')]({'name':_0x14c984[_0xe44f('0x37')],'resourceId':_0x14c984['id'],'type':_0x37d01d[_0xe44f('0x37')],'sectionId':_0x37d01d['id']},{})['then'](function(){return _0x312ff5;});}else{return _0x312ff5;}})['catch'](function(_0x3ae248){logger[_0xe44f('0x39')](_0xe44f('0x61'),_0x3ae248);throw _0x3ae248;});}return _0x312ff5;})[_0xe44f('0x2e')](respondWithResult(_0x10798b,0xc9))['catch'](handleError(_0x10798b,null));};exports[_0xe44f('0x62')]=function(_0x106e02,_0x65b572){var _0x5b1e61={'where':{'id':_0x106e02[_0xe44f('0x53')]['id']}},_0x2abb2a={};_0x2abb2a[_0xe44f('0x41')]=_[_0xe44f('0x63')](db[_0xe44f('0x4f')][_0xe44f('0x3e')]);_0x5b1e61[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x2abb2a['model'],qs[_0xe44f('0x46')](_0x106e02['query']['fields']));_0x5b1e61[_0xe44f('0x44')]=_0x5b1e61[_0xe44f('0x44')][_0xe44f('0x47')]?_0x5b1e61['attributes']:_0x2abb2a['model'];if(_0x106e02['query'][_0xe44f('0x54')]){_0x5b1e61[_0xe44f('0x64')]=[{'all':!![]}];}_0x5b1e61=_['merge']({},_0x5b1e61,_0x106e02['options']);return db[_0xe44f('0x4f')][_0xe44f('0x56')](_0x5b1e61)[_0xe44f('0x2e')](handleEntityNotFound(_0x65b572,null))[_0xe44f('0x2e')](function(_0x4b14fa){if(_0x4b14fa){var _0x324f7f=_0x4b14fa[_0xe44f('0x30')]({'plain':!![]});_0x324f7f=qs['omit'](_0x324f7f,['id','createdAt',_0xe44f('0x65')]);_0x106e02['body']=_[_0xe44f('0x66')](_0x106e02['body'],['id',_0xe44f('0x67'),_0xe44f('0x65')]);return db[_0xe44f('0x4f')][_0xe44f('0x58')](_['merge'](_0x324f7f,_0x106e02[_0xe44f('0x59')]),{'include':_0x106e02['query'][_0xe44f('0x54')]?[{'all':!![]}]:undefined})['then'](function(_0x67c633){var _0x15097c=_0x106e02[_0xe44f('0x5a')][_0xe44f('0x30')]({'plain':!![]});if(!_0x15097c)throw new Error(_0xe44f('0x5b'));if(_0x15097c[_0xe44f('0x5c')]===_0xe44f('0x5a')){var _0x45ba2b=_0x67c633[_0xe44f('0x30')]({'plain':!![]});var _0x577bc4=[{'name':'VoiceQueues','value':_0xe44f('0x5d')},{'name':'QueueCampaigns','value':_0xe44f('0x5e')}];var _0x12da2c=_[_0xe44f('0x56')](_0x577bc4,['value',_0x45ba2b['type']])['name'];return db[_0xe44f('0x5f')][_0xe44f('0x56')]({'where':{'name':_0x12da2c,'userProfileId':_0x15097c['userProfileId']},'raw':!![]})[_0xe44f('0x2e')](function(_0x36796e){if(_0x36796e&&_0x36796e['autoAssociation']===0x0){return db[_0xe44f('0x38')]['create']({'name':_0x45ba2b[_0xe44f('0x37')],'resourceId':_0x45ba2b['id'],'type':_0x36796e['name'],'sectionId':_0x36796e['id']},{})['then'](function(){return _0x67c633;});}else{return _0x67c633;}})[_0xe44f('0x57')](function(_0x404dbc){logger[_0xe44f('0x39')](_0xe44f('0x61'),_0x404dbc);throw _0x404dbc;});}return _0x67c633;});}})[_0xe44f('0x2e')](respondWithResult(_0x65b572,0xc9))[_0xe44f('0x57')](handleError(_0x65b572,null));};exports['update']=function(_0xb5fa8d,_0x2249d9){if(_0xb5fa8d[_0xe44f('0x59')]['id']){delete _0xb5fa8d[_0xe44f('0x59')]['id'];}return db[_0xe44f('0x4f')][_0xe44f('0x56')]({'where':{'id':_0xb5fa8d['params']['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x2249d9,null))[_0xe44f('0x2e')](saveUpdates(_0xb5fa8d[_0xe44f('0x59')],null))[_0xe44f('0x2e')](respondWithResult(_0x2249d9,null))[_0xe44f('0x57')](handleError(_0x2249d9,null));};exports[_0xe44f('0x2f')]=function(_0x4aeda3,_0x2db23f){return db['VoiceQueue'][_0xe44f('0x56')]({'where':{'id':_0x4aeda3[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x2db23f,null))[_0xe44f('0x2e')](removeEntity(_0x2db23f,null))[_0xe44f('0x57')](handleError(_0x2db23f,null));};exports[_0xe44f('0x68')]=function(_0x580d92,_0x94f9bd,_0xf654c8){var _0x3dd3cd={'raw':![],'where':{}};var _0x3c37b3={};var _0x3de607={'count':0x0,'rows':[]};return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x580d92[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x94f9bd,null))[_0xe44f('0x2e')](function(_0x1b2eee){if(_0x1b2eee){_0x3c37b3[_0xe44f('0x41')]=_[_0xe44f('0x63')](db['CmHopper'][_0xe44f('0x3e')]);_0x3c37b3[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x580d92[_0xe44f('0x42')]);_0x3c37b3[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x3c37b3[_0xe44f('0x41')],_0x3c37b3['query']);_0x3dd3cd[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x3c37b3[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x580d92[_0xe44f('0x42')]['fields']));_0x3dd3cd['attributes']=_0x3dd3cd['attributes']['length']?_0x3dd3cd['attributes']:_0x3c37b3[_0xe44f('0x41')];if(!_0x580d92[_0xe44f('0x42')][_0xe44f('0x48')](_0xe44f('0x49'))){_0x3dd3cd[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x580d92[_0xe44f('0x42')]['limit']);_0x3dd3cd[_0xe44f('0x28')]=qs[_0xe44f('0x28')](_0x580d92[_0xe44f('0x42')]['offset']);}_0x3dd3cd['order']=qs[_0xe44f('0x4a')](_0x580d92[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x3dd3cd[_0xe44f('0x4b')]=qs[_0xe44f('0x43')](_[_0xe44f('0x4c')](_0x580d92[_0xe44f('0x42')],_0x3c37b3['filters']));_0x3dd3cd[_0xe44f('0x4b')]['VoiceQueueId']=_0x1b2eee['id'];if(_0x580d92[_0xe44f('0x42')]['filter']){_0x3dd3cd['where']=_[_0xe44f('0x4e')](_0x3dd3cd['where'],{'$or':_['map'](_0x3dd3cd[_0xe44f('0x44')],function(_0x31444e){var _0x2f0096={};_0x2f0096[_0x31444e]={'$like':'%'+_0x580d92['query']['filter']+'%'};return _0x2f0096;})});}_0x3dd3cd=_[_0xe44f('0x4e')]({},_0x3dd3cd,_0x580d92['options']);return db[_0xe44f('0x6a')][_0xe44f('0x27')]({'where':_0x3dd3cd[_0xe44f('0x4b')]})[_0xe44f('0x2e')](function(_0x2c14a4){_0x3de607['count']=_0x2c14a4;if(_0x580d92['query'][_0xe44f('0x54')]){_0x3dd3cd['include']=[{'all':!![]}];}return db[_0xe44f('0x6a')]['findAll'](_0x3dd3cd);})[_0xe44f('0x2e')](function(_0x36eb20){_0x3de607[_0xe44f('0x51')]=_0x36eb20;return _0x3de607;});}})[_0xe44f('0x2e')](respondWithFilteredResult(_0x94f9bd,_0x3dd3cd))['catch'](handleError(_0x94f9bd,null));};exports[_0xe44f('0x6b')]=function(_0x529069,_0x3017fb,_0x1fac7f){var _0x107f16={'raw':!![],'where':{}};var _0x10d45d={};var _0x4f643d={'count':0x0,'rows':[]};return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x529069[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x3017fb,null))[_0xe44f('0x2e')](function(_0x268486){if(_0x268486){_0x10d45d[_0xe44f('0x41')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x10d45d[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x529069['query']);_0x10d45d[_0xe44f('0x43')]=_['intersection'](_0x10d45d['model'],_0x10d45d['query']);_0x107f16[_0xe44f('0x44')]=_['intersection'](_0x10d45d[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x529069['query']['fields']));_0x107f16['attributes']=_0x107f16['attributes'][_0xe44f('0x47')]?_0x107f16[_0xe44f('0x44')]:_0x10d45d['model'];if(!_0x529069[_0xe44f('0x42')][_0xe44f('0x48')]('nolimit')){_0x107f16['limit']=qs['limit'](_0x529069[_0xe44f('0x42')][_0xe44f('0x25')]);_0x107f16[_0xe44f('0x28')]=qs['offset'](_0x529069[_0xe44f('0x42')][_0xe44f('0x28')]);}_0x107f16[_0xe44f('0x6c')]=qs['sort'](_0x529069[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x107f16[_0xe44f('0x4b')]=qs[_0xe44f('0x43')](_[_0xe44f('0x4c')](_0x529069['query'],_0x10d45d[_0xe44f('0x43')]));_0x107f16[_0xe44f('0x4b')][_0xe44f('0x6d')]=_0x268486['id'];if(_0x529069[_0xe44f('0x42')]['filter']){_0x107f16[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x107f16['where'],{'$or':_['map'](_0x107f16[_0xe44f('0x44')],function(_0x44ebb4){var _0xa5720a={};_0xa5720a[_0x44ebb4]={'$like':'%'+_0x529069['query'][_0xe44f('0x33')]+'%'};return _0xa5720a;})});}_0x107f16=_[_0xe44f('0x4e')]({},_0x107f16,_0x529069[_0xe44f('0x55')]);return db['CmHopperHistory'][_0xe44f('0x27')]({'where':_0x107f16[_0xe44f('0x4b')]})[_0xe44f('0x2e')](function(_0x5f49f0){_0x4f643d[_0xe44f('0x27')]=_0x5f49f0;if(_0x529069[_0xe44f('0x42')]['includeAll']){_0x107f16[_0xe44f('0x64')]=[{'all':!![]}];}return db[_0xe44f('0x6e')][_0xe44f('0x50')](_0x107f16);})['then'](function(_0x2702ab){_0x4f643d[_0xe44f('0x51')]=_0x2702ab;return _0x4f643d;});}})[_0xe44f('0x2e')](respondWithFilteredResult(_0x3017fb,_0x107f16))[_0xe44f('0x57')](handleError(_0x3017fb,null));};exports['getHopperFinals']=function(_0x42927b,_0x120bb3,_0x1d9921){var _0x42b38e={'raw':!![],'where':{}};var _0x1e7da6={};var _0x51c2d8={'count':0x0,'rows':[]};return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x42927b[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x120bb3,null))[_0xe44f('0x2e')](function(_0x3ef723){if(_0x3ef723){_0x1e7da6[_0xe44f('0x41')]=_[_0xe44f('0x63')](db[_0xe44f('0x6f')]['rawAttributes']);_0x1e7da6[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x42927b[_0xe44f('0x42')]);_0x1e7da6[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x1e7da6[_0xe44f('0x41')],_0x1e7da6[_0xe44f('0x42')]);_0x42b38e[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x1e7da6[_0xe44f('0x41')],qs['fields'](_0x42927b['query']['fields']));_0x42b38e[_0xe44f('0x44')]=_0x42b38e['attributes']['length']?_0x42b38e[_0xe44f('0x44')]:_0x1e7da6['model'];if(!_0x42927b[_0xe44f('0x42')][_0xe44f('0x48')]('nolimit')){_0x42b38e[_0xe44f('0x25')]=qs['limit'](_0x42927b[_0xe44f('0x42')][_0xe44f('0x25')]);_0x42b38e[_0xe44f('0x28')]=qs[_0xe44f('0x28')](_0x42927b[_0xe44f('0x42')][_0xe44f('0x28')]);}_0x42b38e[_0xe44f('0x6c')]=qs['sort'](_0x42927b[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x42b38e[_0xe44f('0x4b')]=qs['filters'](_[_0xe44f('0x4c')](_0x42927b['query'],_0x1e7da6[_0xe44f('0x43')]));_0x42b38e['where'][_0xe44f('0x6d')]=_0x3ef723['id'];if(_0x42927b[_0xe44f('0x42')][_0xe44f('0x33')]){_0x42b38e[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x42b38e[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x42b38e['attributes'],function(_0x3734ec){var _0x42487b={};_0x42487b[_0x3734ec]={'$like':'%'+_0x42927b[_0xe44f('0x42')][_0xe44f('0x33')]+'%'};return _0x42487b;})});}_0x42b38e=_[_0xe44f('0x4e')]({},_0x42b38e,_0x42927b[_0xe44f('0x55')]);return db[_0xe44f('0x6f')][_0xe44f('0x27')]({'where':_0x42b38e['where']})[_0xe44f('0x2e')](function(_0x4307d0){_0x51c2d8[_0xe44f('0x27')]=_0x4307d0;if(_0x42927b['query']['includeAll']){_0x42b38e[_0xe44f('0x64')]=[{'all':!![]}];}return db[_0xe44f('0x6f')][_0xe44f('0x50')](_0x42b38e);})['then'](function(_0x1dc1d7){_0x51c2d8['rows']=_0x1dc1d7;return _0x51c2d8;});}})[_0xe44f('0x2e')](respondWithFilteredResult(_0x120bb3,_0x42b38e))[_0xe44f('0x57')](handleError(_0x120bb3,null));};exports[_0xe44f('0x70')]=function(_0x51c000,_0x33df09,_0xc20beb){var _0x265f1d={'raw':!![],'where':{}};var _0x1c6676={};var _0x466c0c={'count':0x0,'rows':[]};return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x51c000['params']['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x33df09,null))[_0xe44f('0x2e')](function(_0x407622){if(_0x407622){_0x1c6676[_0xe44f('0x41')]=_[_0xe44f('0x63')](db['CmHopperBlack'][_0xe44f('0x3e')]);_0x1c6676[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x51c000[_0xe44f('0x42')]);_0x1c6676[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x1c6676['model'],_0x1c6676[_0xe44f('0x42')]);_0x265f1d[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x1c6676[_0xe44f('0x41')],qs['fields'](_0x51c000['query'][_0xe44f('0x46')]));_0x265f1d[_0xe44f('0x44')]=_0x265f1d['attributes'][_0xe44f('0x47')]?_0x265f1d[_0xe44f('0x44')]:_0x1c6676[_0xe44f('0x41')];if(!_0x51c000[_0xe44f('0x42')]['hasOwnProperty']('nolimit')){_0x265f1d[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x51c000[_0xe44f('0x42')][_0xe44f('0x25')]);_0x265f1d['offset']=qs[_0xe44f('0x28')](_0x51c000[_0xe44f('0x42')][_0xe44f('0x28')]);}_0x265f1d['order']=qs[_0xe44f('0x4a')](_0x51c000[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x265f1d['where']=qs[_0xe44f('0x43')](_[_0xe44f('0x4c')](_0x51c000[_0xe44f('0x42')],_0x1c6676[_0xe44f('0x43')]));_0x265f1d[_0xe44f('0x4b')]['VoiceQueueId']=_0x407622['id'];if(_0x51c000[_0xe44f('0x42')][_0xe44f('0x33')]){_0x265f1d[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x265f1d[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x265f1d[_0xe44f('0x44')],function(_0x595b75){var _0x55c57a={};_0x55c57a[_0x595b75]={'$like':'%'+_0x51c000[_0xe44f('0x42')]['filter']+'%'};return _0x55c57a;})});}_0x265f1d=_['merge']({},_0x265f1d,_0x51c000[_0xe44f('0x55')]);return db['CmHopperBlack'][_0xe44f('0x27')]({'where':_0x265f1d[_0xe44f('0x4b')]})[_0xe44f('0x2e')](function(_0x2a6a50){_0x466c0c[_0xe44f('0x27')]=_0x2a6a50;if(_0x51c000[_0xe44f('0x42')][_0xe44f('0x54')]){_0x265f1d[_0xe44f('0x64')]=[{'all':!![]}];}return db[_0xe44f('0x71')][_0xe44f('0x50')](_0x265f1d);})['then'](function(_0x16eba4){_0x466c0c[_0xe44f('0x51')]=_0x16eba4;return _0x466c0c;});}})[_0xe44f('0x2e')](respondWithFilteredResult(_0x33df09,_0x265f1d))[_0xe44f('0x57')](handleError(_0x33df09,null));};exports[_0xe44f('0x72')]=function(_0x3a27a3,_0x34566a,_0x50afe7){var _0x106adb={};var _0x20c633={};var _0x506ef2;var _0x58ee2c;return db['VoiceQueue']['findOne']({'where':{'id':_0x3a27a3[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x34566a,null))[_0xe44f('0x2e')](function(_0x2e7cb2){if(_0x2e7cb2){_0x506ef2=_0x2e7cb2;_0x20c633['model']=_['keys'](db['Team']['rawAttributes']);_0x20c633[_0xe44f('0x42')]=_['keys'](_0x3a27a3[_0xe44f('0x42')]);_0x20c633['filters']=_['intersection'](_0x20c633[_0xe44f('0x41')],_0x20c633['query']);_0x106adb[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x20c633[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x3a27a3[_0xe44f('0x42')][_0xe44f('0x46')]));_0x106adb[_0xe44f('0x44')]=_0x106adb['attributes'][_0xe44f('0x47')]?_0x106adb['attributes']:_0x20c633[_0xe44f('0x41')];_0x106adb[_0xe44f('0x6c')]=qs[_0xe44f('0x4a')](_0x3a27a3[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x106adb[_0xe44f('0x4b')]=qs[_0xe44f('0x43')](_[_0xe44f('0x4c')](_0x3a27a3[_0xe44f('0x42')],_0x20c633[_0xe44f('0x43')]));if(_0x3a27a3[_0xe44f('0x42')]['filter']){_0x106adb['where']=_[_0xe44f('0x4e')](_0x106adb[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x106adb[_0xe44f('0x44')],function(_0x1c00f8){var _0x28dbe9={};_0x28dbe9[_0x1c00f8]={'$like':'%'+_0x3a27a3['query']['filter']+'%'};return _0x28dbe9;})});}_0x106adb=_['merge']({},_0x106adb,_0x3a27a3['options']);return _0x506ef2[_0xe44f('0x72')](_0x106adb);}})['then'](function(_0x505435){if(_0x505435){_0x58ee2c=_0x505435['length'];if(!_0x3a27a3['query'][_0xe44f('0x48')](_0xe44f('0x49'))){_0x106adb[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x3a27a3[_0xe44f('0x42')][_0xe44f('0x25')]);_0x106adb[_0xe44f('0x28')]=qs['offset'](_0x3a27a3['query']['offset']);}return _0x506ef2[_0xe44f('0x72')](_0x106adb);}})[_0xe44f('0x2e')](function(_0x1e1fe7){if(_0x1e1fe7){return _0x1e1fe7?{'count':_0x58ee2c,'rows':_0x1e1fe7}:null;}})['then'](respondWithResult(_0x34566a,null))[_0xe44f('0x57')](handleError(_0x34566a,null));};exports[_0xe44f('0x73')]=function(_0xdd0765,_0x4aacc2,_0x2a188e){var _0x4e9e87=_0xdd0765['body'][_0xe44f('0x74')];var _0x594e8f=_['map'](_0x4e9e87,'id');return db['Team'][_0xe44f('0x50')]({'where':{'id':_0x594e8f},'attributes':['id'],'include':[{'model':db[_0xe44f('0x75')],'as':'Agents','attributes':['id',_0xe44f('0x37'),_0xe44f('0x76'),_0xe44f('0x77'),'interface'],'raw':!![]}]})[_0xe44f('0x2e')](function(_0x49185d){if(_0x49185d){var _0x49250a=_['flatMap'](_0x49185d,function(_0x33aad8){var _0x213106=_0x33aad8['get']({'plain':!![]});_0x213106[_0xe44f('0x78')][_0xe44f('0x79')](function(_0x5c6756){_0x5c6756['penalty']=_[_0xe44f('0x56')](_0x4e9e87,{'id':_0x213106['id']})[_0xe44f('0x7a')];});return _0x213106['Agents'];});return db[_0xe44f('0x4f')]['find']({'where':{'id':_0xdd0765[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](function(_0x5aef7b){return db[_0xe44f('0x7b')][_0xe44f('0x7c')](function(_0x2b8b8d){return _0x5aef7b[_0xe44f('0x73')](_0x594e8f,{'transaction':_0x2b8b8d})[_0xe44f('0x2e')](function(){return BPromise[_0xe44f('0x7d')](_0x4e9e87,function(_0x3f8a92){return db[_0xe44f('0x7e')][_0xe44f('0x7f')]({'TeamId':_0x3f8a92['id'],'VoiceQueueId':_0xdd0765[_0xe44f('0x53')]['id'],'penalty':_0x3f8a92[_0xe44f('0x7a')]},{'transaction':_0x2b8b8d});});})[_0xe44f('0x2e')](function(){return BPromise[_0xe44f('0x7d')](_0x49250a,function(_0x2858f0){return db['UserVoiceQueue'][_0xe44f('0x80')]({'where':{'UserId':_0x2858f0['id'],'VoiceQueueId':_0xdd0765[_0xe44f('0x53')]['id']},'defaults':{'penalty':_0x2858f0[_0xe44f('0x7a')]},'transaction':_0x2b8b8d});});})[_0xe44f('0x2e')](function(){return BPromise['each'](_[_0xe44f('0x33')](_0x49250a,{'online':!![]}),function(_0x2ea090){return db[_0xe44f('0x81')]['upsert']({'membername':_0x2ea090[_0xe44f('0x37')],'UserId':_0x2ea090['id'],'queue_name':_0x5aef7b['name'],'VoiceQueueId':_0x5aef7b['id'],'interface':_[_0xe44f('0x82')](_0x2ea090['interface'])?util[_0xe44f('0x83')]('SIP/%s',_0x2ea090[_0xe44f('0x37')]):_0x2ea090[_0xe44f('0x84')],'paused':_0x2ea090[_0xe44f('0x77')]||![],'penalty':_0x2ea090[_0xe44f('0x7a')]},{'transaction':_0x2b8b8d});});})[_0xe44f('0x2e')](function(){_0x49250a[_0xe44f('0x79')](function(_0x5c2f19){socket['emit'](_0xe44f('0x85'),{'UserId':_0x5c2f19['id'],'VoiceQueueId':_0x5aef7b['id']});});});});});}})[_0xe44f('0x2e')](respondWithStatusCode(_0x4aacc2,null))['catch'](handleError(_0x4aacc2,null));};exports[_0xe44f('0x86')]=function(_0x5e55d6,_0xc7a283,_0x4c2714){return db[_0xe44f('0x87')][_0xe44f('0x50')]({'where':{'id':_0x5e55d6[_0xe44f('0x42')][_0xe44f('0x88')]},'attributes':['id'],'include':[{'model':db[_0xe44f('0x75')],'as':_0xe44f('0x78'),'attributes':['id'],'raw':!![]}]})[_0xe44f('0x2e')](handleEntityNotFound(_0xc7a283,null))[_0xe44f('0x2e')](function(_0x1bb401){var _0x168014=_[_0xe44f('0x3d')](_0x1bb401,'id');var _0x50cb72=[];var _0x1d0ebd=[];var _0x16d9ca=squel['select']();_0x16d9ca[_0xe44f('0x89')](_0xe44f('0x8a'))[_0xe44f('0x8b')](_0xe44f('0x8c'),'tq')[_0xe44f('0x8d')](_0xe44f('0x8e'),'ut',_0xe44f('0x8f'))['where'](_0xe44f('0x90'),_0x5e55d6[_0xe44f('0x53')]['id']);for(var _0x5eaad2=0x0;_0x5eaad2<_0x1bb401['length'];_0x5eaad2+=0x1){let _0x2852d=_0x1bb401[_0x5eaad2];for(var _0xe81615=0x0;_0xe81615<_0x2852d[_0xe44f('0x78')][_0xe44f('0x47')];_0xe81615+=0x1){let _0x27556f=_0x2852d[_0xe44f('0x78')][_0xe81615];var _0x97e831=_0x16d9ca[_0xe44f('0x62')]();_0x97e831[_0xe44f('0x4b')](_0xe44f('0x91'),_0x27556f['id']);_0x1d0ebd[_0xe44f('0x92')](db[_0xe44f('0x7b')][_0xe44f('0x42')](_0x97e831[_0xe44f('0x93')](),{'type':db['sequelize'][_0xe44f('0x94')][_0xe44f('0x95')]})['then'](function(_0xd722cb){if(_0xd722cb['length']===0x1){return _0x27556f['id'];}else{var _0x5221e0=_['every'](_[_0xe44f('0x3d')](_0xd722cb,_0xe44f('0x96')),function(_0x4b1c3b){return _['includes'](_0x168014,_0x4b1c3b);});if(_0x5221e0){return _0x27556f['id'];}}}));}}return BPromise['all'](_0x1d0ebd)[_0xe44f('0x2e')](function(_0x5c2fd3){_0x50cb72=_(_0x50cb72)['union'](_0x5c2fd3)[_0xe44f('0x97')]()['value']();return db[_0xe44f('0x4f')]['find']({'where':{'id':_0x5e55d6[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](function(_0x392d9d){return db[_0xe44f('0x7b')][_0xe44f('0x7c')](function(_0x3b362a){return _0x392d9d['removeTeams'](_0x5e55d6[_0xe44f('0x42')]['ids'],{'transaction':_0x3b362a})[_0xe44f('0x2e')](function(){if(!_['isEmpty'](_0x50cb72)){return _0x392d9d[_0xe44f('0x98')](_0x50cb72,{'transaction':_0x3b362a})['then'](function(){return db[_0xe44f('0x81')][_0xe44f('0x2f')]({'where':{'VoiceQueueId':_0x5e55d6[_0xe44f('0x53')]['id'],'UserId':_0x50cb72},'transaction':_0x3b362a});});}})[_0xe44f('0x2e')](function(){_0x50cb72[_0xe44f('0x79')](function(_0x52d525){socket[_0xe44f('0x99')](_0xe44f('0x9a'),{'UserId':_0x52d525,'VoiceQueueId':_0x392d9d['id']});});});});});});})[_0xe44f('0x2e')](respondWithStatusCode(_0xc7a283,null))[_0xe44f('0x57')](handleError(_0xc7a283,null));};exports[_0xe44f('0x9b')]=function(_0x3cb252,_0x49dc2d,_0x2fe030){var _0x59fbb1,_0x1d6cea;return db['VoiceQueue'][_0xe44f('0x56')]({'where':{'id':_0x3cb252['params']['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x49dc2d,null))[_0xe44f('0x2e')](function(_0x36985e){if(_0x36985e){_0x1d6cea=_0x36985e;return _0x36985e[_0xe44f('0x9b')](_0x3cb252[_0xe44f('0x59')][_0xe44f('0x88')],_[_0xe44f('0x66')](_0x3cb252[_0xe44f('0x59')],['ids','id'])||{})[_0xe44f('0x9c')](function(_0x3fb087){for(var _0x195fed=0x0;_0x195fed<_0x3cb252[_0xe44f('0x59')][_0xe44f('0x88')][_0xe44f('0x47')];_0x195fed+=0x1){socket[_0xe44f('0x99')](_0xe44f('0x85'),{'UserId':Number(_0x3cb252['body']['ids'][_0x195fed]),'VoiceQueueId':Number(_0x3cb252[_0xe44f('0x53')]['id'])});}return _0x3fb087;});}})[_0xe44f('0x2e')](function(_0x4d04cc){_0x59fbb1=_0x4d04cc||[];if(_0x1d6cea){return db[_0xe44f('0x75')]['findAll']({'where':{'id':_0x3cb252[_0xe44f('0x59')][_0xe44f('0x88')]},'attributes':['id','name',_0xe44f('0x76'),_0xe44f('0x77'),'interface'],'raw':!![]});}})[_0xe44f('0x2e')](function(_0x2d863c){if(!_['isEmpty'](_0x2d863c)){var _0x2f0494=[];for(var _0x218cc7=0x0;_0x218cc7<_0x2d863c[_0xe44f('0x47')];_0x218cc7++){if(_0x2d863c[_0x218cc7]['online']){_0x2f0494['push'](db[_0xe44f('0x81')][_0xe44f('0x7f')]({'membername':_0x2d863c[_0x218cc7][_0xe44f('0x37')],'UserId':_0x2d863c[_0x218cc7]['id'],'queue_name':_0x1d6cea[_0xe44f('0x37')],'VoiceQueueId':_0x1d6cea['id'],'interface':_[_0xe44f('0x82')](_0x2d863c[_0x218cc7][_0xe44f('0x84')])?util[_0xe44f('0x83')]('SIP/%s',_0x2d863c[_0x218cc7]['name']):_0x2d863c[_0x218cc7][_0xe44f('0x84')],'paused':_0x2d863c[_0x218cc7][_0xe44f('0x77')]||![],'penalty':_0x3cb252[_0xe44f('0x59')]['penalty']||0x0}));}}return BPromise['all'](_0x2f0494);}})['then'](function(){return _0x59fbb1;})[_0xe44f('0x2e')](respondWithResult(_0x49dc2d,null))[_0xe44f('0x57')](handleError(_0x49dc2d,null));};exports[_0xe44f('0x98')]=function(_0x41ab34,_0x5eee9c,_0x272259){return db[_0xe44f('0x4f')]['find']({'where':{'id':_0x41ab34[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x5eee9c,null))[_0xe44f('0x2e')](function(_0x1dbc1e){if(_0x1dbc1e){return _0x1dbc1e[_0xe44f('0x98')](_0x41ab34[_0xe44f('0x42')][_0xe44f('0x88')])[_0xe44f('0x2e')](function(){if(_[_0xe44f('0x9d')](_0x41ab34['query']['ids'])){for(var _0x4167c8=0x0;_0x4167c8<_0x41ab34['query'][_0xe44f('0x88')][_0xe44f('0x47')];_0x4167c8+=0x1){socket[_0xe44f('0x99')]('userVoiceQueue:remove',{'UserId':Number(_0x41ab34[_0xe44f('0x42')][_0xe44f('0x88')][_0x4167c8]),'VoiceQueueId':Number(_0x41ab34[_0xe44f('0x53')]['id'])});}}else{socket[_0xe44f('0x99')](_0xe44f('0x9a'),{'UserId':Number(_0x41ab34[_0xe44f('0x42')]['ids']),'VoiceQueueId':Number(_0x41ab34['params']['id'])});}});}})[_0xe44f('0x2e')](function(_0x481b9a){return db['UserVoiceQueueRt'][_0xe44f('0x2f')]({'where':{'VoiceQueueId':_0x41ab34[_0xe44f('0x53')]['id'],'UserId':_0x41ab34['query'][_0xe44f('0x88')]}})[_0xe44f('0x2e')](function(){return _0x481b9a;});})[_0xe44f('0x2e')](respondWithStatusCode(_0x5eee9c,null))[_0xe44f('0x57')](handleError(_0x5eee9c,null));};exports[_0xe44f('0x9e')]=function(_0x21025e,_0x2c39b1,_0x2b9503){var _0xab3708={};var _0x161488={};var _0x5d2b1d;var _0x182c03;return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x21025e[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x2c39b1,null))[_0xe44f('0x2e')](function(_0x2c9cac){if(_0x2c9cac){_0x5d2b1d=_0x2c9cac;_0x161488[_0xe44f('0x41')]=_[_0xe44f('0x63')](db[_0xe44f('0x75')][_0xe44f('0x3e')]);_0x161488['query']=_['keys'](_0x21025e[_0xe44f('0x42')]);_0x161488[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x161488[_0xe44f('0x41')],_0x161488['query']);_0xab3708[_0xe44f('0x44')]=_['intersection'](_0x161488[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x21025e['query'][_0xe44f('0x46')]));_0xab3708[_0xe44f('0x44')]=_0xab3708[_0xe44f('0x44')][_0xe44f('0x47')]?_0xab3708[_0xe44f('0x44')]:_0x161488[_0xe44f('0x41')];_0xab3708[_0xe44f('0x6c')]=qs[_0xe44f('0x4a')](_0x21025e[_0xe44f('0x42')][_0xe44f('0x4a')]);_0xab3708['where']=qs['filters'](_[_0xe44f('0x4c')](_0x21025e[_0xe44f('0x42')],_0x161488[_0xe44f('0x43')]));if(_0x21025e[_0xe44f('0x42')]['filter']){_0xab3708['where']=_[_0xe44f('0x4e')](_0xab3708['where'],{'$or':_[_0xe44f('0x3d')](_0xab3708[_0xe44f('0x44')],function(_0x414fcb){var _0x5ed1bf={};_0x5ed1bf[_0x414fcb]={'$like':'%'+_0x21025e[_0xe44f('0x42')][_0xe44f('0x33')]+'%'};return _0x5ed1bf;})});}_0xab3708=_[_0xe44f('0x4e')]({},_0xab3708,_0x21025e[_0xe44f('0x55')]);return _0x5d2b1d['getAgents'](_0xab3708);}})[_0xe44f('0x2e')](function(_0x5958eb){if(_0x5958eb){_0x182c03=_0x5958eb[_0xe44f('0x47')];if(!_0x21025e[_0xe44f('0x42')][_0xe44f('0x48')](_0xe44f('0x49'))){_0xab3708[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x21025e[_0xe44f('0x42')]['limit']);_0xab3708['offset']=qs[_0xe44f('0x28')](_0x21025e[_0xe44f('0x42')]['offset']);}return _0x5d2b1d[_0xe44f('0x9e')](_0xab3708);}})[_0xe44f('0x2e')](function(_0x4a948b){if(_0x4a948b){return _0x4a948b?{'count':_0x182c03,'rows':_0x4a948b}:null;}})['then'](respondWithResult(_0x2c39b1,null))[_0xe44f('0x57')](handleError(_0x2c39b1,null));};exports[_0xe44f('0x9f')]=function(_0x4b2aa0,_0x390d0f,_0x47d131){var _0x189cdb={};var _0x3175a0={};var _0x459e51;var _0x33e243;return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x4b2aa0['params']['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x390d0f,null))[_0xe44f('0x2e')](function(_0xb88ccc){if(_0xb88ccc){_0x459e51=_0xb88ccc;_0x3175a0[_0xe44f('0x41')]=_[_0xe44f('0x63')](db[_0xe44f('0x81')]['rawAttributes']);_0x3175a0[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x4b2aa0[_0xe44f('0x42')]);_0x3175a0[_0xe44f('0x43')]=_['intersection'](_0x3175a0[_0xe44f('0x41')],_0x3175a0[_0xe44f('0x42')]);_0x189cdb['attributes']=_[_0xe44f('0x45')](_0x3175a0['model'],qs['fields'](_0x4b2aa0[_0xe44f('0x42')]['fields']));_0x189cdb[_0xe44f('0x44')]=_0x189cdb[_0xe44f('0x44')]['length']?_0x189cdb['attributes']:_0x3175a0[_0xe44f('0x41')];_0x189cdb[_0xe44f('0x6c')]=qs[_0xe44f('0x4a')](_0x4b2aa0[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x189cdb['where']=qs['filters'](_[_0xe44f('0x4c')](_0x4b2aa0[_0xe44f('0x42')],_0x3175a0['filters']));if(_0x4b2aa0['query'][_0xe44f('0x33')]){_0x189cdb[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x189cdb[_0xe44f('0x4b')],{'$or':_['map'](_0x189cdb['attributes'],function(_0x5cec58){var _0x4dbd8b={};_0x4dbd8b[_0x5cec58]={'$like':'%'+_0x4b2aa0['query']['filter']+'%'};return _0x4dbd8b;})});}_0x189cdb=_['merge']({},_0x189cdb,_0x4b2aa0[_0xe44f('0x55')]);return _0x459e51['getMembers'](_0x189cdb);}})[_0xe44f('0x2e')](function(_0x3399d0){if(_0x3399d0){_0x33e243=_0x3399d0['length'];if(!_0x4b2aa0['query'][_0xe44f('0x48')](_0xe44f('0x49'))){_0x189cdb['limit']=qs['limit'](_0x4b2aa0[_0xe44f('0x42')][_0xe44f('0x25')]);_0x189cdb['offset']=qs[_0xe44f('0x28')](_0x4b2aa0[_0xe44f('0x42')]['offset']);}return _0x459e51[_0xe44f('0x9f')](_0x189cdb);}})[_0xe44f('0x2e')](function(_0x13047c){return _0x13047c?{'count':_0x33e243,'rows':_0x13047c}:null;})[_0xe44f('0x2e')](respondWithResult(_0x390d0f,null))[_0xe44f('0x57')](handleError(_0x390d0f,null));};exports[_0xe44f('0xa0')]=function(_0x4863be,_0x302b0c,_0x39d94d){var _0x37216d={};var _0x3611f2={};var _0x14ab47;var _0x198e05;return db[_0xe44f('0x4f')][_0xe44f('0x69')]({'where':{'id':_0x4863be[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x302b0c,null))[_0xe44f('0x2e')](function(_0x13233e){if(_0x13233e){_0x14ab47=_0x13233e;_0x3611f2['model']=_['keys'](db[_0xe44f('0xa1')][_0xe44f('0x3e')]);_0x3611f2[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x4863be[_0xe44f('0x42')]);_0x3611f2[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x3611f2[_0xe44f('0x41')],_0x3611f2[_0xe44f('0x42')]);_0x37216d[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x3611f2[_0xe44f('0x41')],qs[_0xe44f('0x46')](_0x4863be[_0xe44f('0x42')][_0xe44f('0x46')]));_0x37216d[_0xe44f('0x44')]=_0x37216d[_0xe44f('0x44')][_0xe44f('0x47')]?_0x37216d['attributes']:_0x3611f2[_0xe44f('0x41')];_0x37216d[_0xe44f('0x6c')]=qs[_0xe44f('0x4a')](_0x4863be[_0xe44f('0x42')][_0xe44f('0x4a')]);_0x37216d[_0xe44f('0x4b')]=qs['filters'](_[_0xe44f('0x4c')](_0x4863be[_0xe44f('0x42')],_0x3611f2['filters']));if(_0x4863be['query'][_0xe44f('0x33')]){_0x37216d[_0xe44f('0x4b')]=_[_0xe44f('0x4e')](_0x37216d[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x37216d[_0xe44f('0x44')],function(_0x4a9821){var _0x355cef={};_0x355cef[_0x4a9821]={'$like':'%'+_0x4863be[_0xe44f('0x42')][_0xe44f('0x33')]+'%'};return _0x355cef;})});}_0x37216d=_['merge']({},_0x37216d,_0x4863be['options']);return _0x14ab47[_0xe44f('0xa0')](_0x37216d);}})['then'](function(_0x1f984f){if(_0x1f984f){_0x198e05=_0x1f984f[_0xe44f('0x47')];if(!_0x4863be[_0xe44f('0x42')]['hasOwnProperty'](_0xe44f('0x49'))){_0x37216d[_0xe44f('0x25')]=qs['limit'](_0x4863be[_0xe44f('0x42')]['limit']);_0x37216d[_0xe44f('0x28')]=qs[_0xe44f('0x28')](_0x4863be[_0xe44f('0x42')]['offset']);}return _0x14ab47['getLists'](_0x37216d);}})[_0xe44f('0x2e')](function(_0x145074){if(_0x145074){return _0x145074?{'count':_0x198e05,'rows':_0x145074}:null;}})['then'](respondWithResult(_0x302b0c,null))[_0xe44f('0x57')](handleError(_0x302b0c,null));};exports['addLists']=function(_0x4fcd74,_0x1de813,_0x24881e){var _0x412e0c=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2c74c6,_0x1a8726;return db['VoiceQueue'][_0xe44f('0x56')]({'where':{'id':_0x4fcd74[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x1de813,null))[_0xe44f('0x2e')](function(_0x25bf51){if(_0x25bf51){_0x1a8726=_0x25bf51;return _0x25bf51['addLists'](_0x4fcd74[_0xe44f('0x59')][_0xe44f('0x88')],_[_0xe44f('0x66')](_0x4fcd74['body'],[_0xe44f('0x88'),'id'])||{});}return null;})[_0xe44f('0x9c')](function(_0x55ad98){var _0x299e92;_0x2c74c6=_0x55ad98||[];var _0x58fa64=[];if(_0x55ad98){for(var _0x2e5166=0x0;_0x2e5166<_0x55ad98[_0xe44f('0x47')];_0x2e5166+=0x1){var _0x1f453b=_0x55ad98[_0x2e5166][_0xe44f('0x30')]({'plain':!![]});_0x1a8726['dialCheckDuplicateType']=_0x4fcd74['body'][_0xe44f('0xa2')]?_0x4fcd74[_0xe44f('0x59')][_0xe44f('0xa2')]:_0x1a8726[_0xe44f('0xa2')];switch(_0x1a8726[_0xe44f('0xa2')]){case _0xe44f('0xa3'):_0x299e92=squel[_0xe44f('0xa4')]()[_0xe44f('0xa5')]('cm_hopper')[_0xe44f('0xa6')]([_0xe44f('0xa7'),_0xe44f('0xa8'),_0xe44f('0xa9'),_0xe44f('0xaa'),_0xe44f('0x6d'),_0xe44f('0x67'),'updatedAt'],squel['select']()['field'](_0xe44f('0xa7'),_0xe44f('0xa7'))['field']('\x27'+_0x412e0c+'\x27',_0xe44f('0xa8'))['field']('id',_0xe44f('0xa9'))[_0xe44f('0x89')](_0x1f453b[_0xe44f('0xab')]['toString'](),_0xe44f('0xaa'))[_0xe44f('0x89')](_0x4fcd74[_0xe44f('0x53')]['id'][_0xe44f('0x93')](),_0xe44f('0x6d'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x67'))['field']('\x27'+_0x412e0c+'\x27',_0xe44f('0x65'))[_0xe44f('0x8b')]('cm_contacts')[_0xe44f('0x4b')](_0xe44f('0xac'))['where'](_0xe44f('0xad'),_0x1f453b[_0xe44f('0xab')]['toString']())[_0xe44f('0x4b')](_0xe44f('0xae'))[_0xe44f('0x4b')](_0xe44f('0xaf'),squel['select']()[_0xe44f('0x89')](_0xe44f('0xb0'))['from'](_0xe44f('0xb1'))[_0xe44f('0x4b')]('VoiceQueueId\x20=\x20?',_0x4fcd74[_0xe44f('0x53')]['id']['toString']()))['where'](_0xe44f('0xaf'),squel[_0xe44f('0xb2')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0xe44f('0xb3'))[_0xe44f('0x4b')](_0xe44f('0x90'),_0x4fcd74['params']['id'][_0xe44f('0x93')]())))[_0xe44f('0x93')]();break;case _0xe44f('0xb4'):_0x299e92=squel[_0xe44f('0xa4')]()[_0xe44f('0xa5')]('cm_hopper')['fromQuery']([_0xe44f('0xa7'),_0xe44f('0xa8'),_0xe44f('0xa9'),'ListId',_0xe44f('0x6d'),_0xe44f('0x67'),_0xe44f('0x65')],squel[_0xe44f('0xb2')]()[_0xe44f('0x89')](_0xe44f('0xa7'),_0xe44f('0xa7'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0xa8'))[_0xe44f('0x89')]('id',_0xe44f('0xa9'))[_0xe44f('0x89')](_0x1f453b[_0xe44f('0xab')][_0xe44f('0x93')](),'ListId')[_0xe44f('0x89')](_0x4fcd74[_0xe44f('0x53')]['id'][_0xe44f('0x93')](),_0xe44f('0x6d'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27','createdAt')[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x65'))[_0xe44f('0x8b')]('cm_contacts')[_0xe44f('0x4b')](_0xe44f('0xac'))[_0xe44f('0x4b')]('ListId\x20=\x20?',_0x1f453b['CmListId'][_0xe44f('0x93')]())[_0xe44f('0x4b')](_0xe44f('0xae'))[_0xe44f('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe44f('0xb2')]()[_0xe44f('0x89')](_0xe44f('0xb5'))[_0xe44f('0x8b')](_0xe44f('0xb3'))['where'](_0xe44f('0x90'),_0x4fcd74[_0xe44f('0x53')]['id'][_0xe44f('0x93')]())))[_0xe44f('0x93')]();break;default:_0x299e92=squel[_0xe44f('0xa4')]()[_0xe44f('0xa5')](_0xe44f('0xb3'))['fromQuery'](['phone',_0xe44f('0xa8'),_0xe44f('0xa9'),_0xe44f('0xaa'),_0xe44f('0x6d'),_0xe44f('0x67'),_0xe44f('0x65')],squel[_0xe44f('0xb2')]()['field']('phone',_0xe44f('0xa7'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0xa8'))[_0xe44f('0x89')]('id',_0xe44f('0xa9'))[_0xe44f('0x89')](_0x1f453b[_0xe44f('0xab')][_0xe44f('0x93')](),_0xe44f('0xaa'))[_0xe44f('0x89')](_0x4fcd74['params']['id'][_0xe44f('0x93')](),_0xe44f('0x6d'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x67'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x65'))['from'](_0xe44f('0xb6'))[_0xe44f('0x4b')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x1f453b[_0xe44f('0xab')][_0xe44f('0x93')]())[_0xe44f('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0xe44f('0x93')]();}_0x58fa64['push'](db[_0xe44f('0x7b')][_0xe44f('0x42')](_0x299e92));}return BPromise[_0xe44f('0xb7')](_0x58fa64);}})['then'](function(){var _0x10d8e5=[];var _0x2399a1=squel['insert']()[_0xe44f('0xa5')](_0xe44f('0xb8'))[_0xe44f('0xa6')]([_0xe44f('0xb9'),'phone','OrderBy',_0xe44f('0x67'),'updatedAt'],squel[_0xe44f('0xb2')]()[_0xe44f('0x89')](_0xe44f('0xba'))['field']('ci.item')[_0xe44f('0x89')](_0xe44f('0xbb'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x67'))[_0xe44f('0x89')]('\x27'+_0x412e0c+'\x27',_0xe44f('0x65'))[_0xe44f('0x8b')](_0xe44f('0xbc'),'ci')[_0xe44f('0x8d')](_0xe44f('0xb3'),'h','h.ContactId=ci.CmContactId')['where'](_0xe44f('0xbd'),_0x412e0c)[_0xe44f('0x4b')](_0xe44f('0xbe'),_0xe44f('0xbf')))[_0xe44f('0x93')]();_0x10d8e5[_0xe44f('0x92')](db[_0xe44f('0x7b')][_0xe44f('0x42')](_0x2399a1));return BPromise[_0xe44f('0xb7')](_0x10d8e5);})[_0xe44f('0x2e')](function(){return _0x2c74c6;})[_0xe44f('0x2e')](respondWithResult(_0x1de813,null))['catch'](handleError(_0x1de813,null));};exports['removeLists']=function(_0xea3335,_0x18678b,_0x13a70a){return db[_0xe44f('0x4f')][_0xe44f('0x56')]({'where':{'id':_0xea3335[_0xe44f('0x53')]['id']}})['then'](handleEntityNotFound(_0x18678b,null))[_0xe44f('0x2e')](function(_0x268cef){if(_0x268cef){return _0x268cef['removeLists'](_0xea3335[_0xe44f('0x42')]['ids']);}})[_0xe44f('0x2e')](function(_0x1285bf){if(_0x1285bf){return db[_0xe44f('0x6a')][_0xe44f('0x2f')]({'where':{'ListId':_0xea3335[_0xe44f('0x42')][_0xe44f('0x88')],'VoiceQueueId':_0xea3335[_0xe44f('0x53')]['id']}})['then'](function(){return _0x1285bf;});}})[_0xe44f('0x2e')](respondWithStatusCode(_0x18678b,null))[_0xe44f('0x57')](handleError(_0x18678b,null));};exports['getBlackLists']=function(_0x11e034,_0x4fc730,_0x1e01d8){var _0x17a42f={};var _0x2b1953={};var _0x227daa;var _0x5d1b7e;return db['VoiceQueue']['findOne']({'where':{'id':_0x11e034[_0xe44f('0x53')]['id']}})['then'](handleEntityNotFound(_0x4fc730,null))['then'](function(_0x3f4f){if(_0x3f4f){_0x227daa=_0x3f4f;_0x2b1953[_0xe44f('0x41')]=_[_0xe44f('0x63')](db['CmList'][_0xe44f('0x3e')]);_0x2b1953[_0xe44f('0x42')]=_[_0xe44f('0x63')](_0x11e034[_0xe44f('0x42')]);_0x2b1953[_0xe44f('0x43')]=_[_0xe44f('0x45')](_0x2b1953[_0xe44f('0x41')],_0x2b1953[_0xe44f('0x42')]);_0x17a42f[_0xe44f('0x44')]=_[_0xe44f('0x45')](_0x2b1953['model'],qs[_0xe44f('0x46')](_0x11e034[_0xe44f('0x42')]['fields']));_0x17a42f['attributes']=_0x17a42f[_0xe44f('0x44')][_0xe44f('0x47')]?_0x17a42f[_0xe44f('0x44')]:_0x2b1953[_0xe44f('0x41')];_0x17a42f['order']=qs[_0xe44f('0x4a')](_0x11e034['query'][_0xe44f('0x4a')]);_0x17a42f[_0xe44f('0x4b')]=qs['filters'](_['pick'](_0x11e034[_0xe44f('0x42')],_0x2b1953[_0xe44f('0x43')]));if(_0x11e034['query'][_0xe44f('0x33')]){_0x17a42f[_0xe44f('0x4b')]=_['merge'](_0x17a42f[_0xe44f('0x4b')],{'$or':_[_0xe44f('0x3d')](_0x17a42f[_0xe44f('0x44')],function(_0x368934){var _0x305d62={};_0x305d62[_0x368934]={'$like':'%'+_0x11e034[_0xe44f('0x42')][_0xe44f('0x33')]+'%'};return _0x305d62;})});}_0x17a42f=_['merge']({},_0x17a42f,_0x11e034[_0xe44f('0x55')]);return _0x227daa[_0xe44f('0xc0')](_0x17a42f);}})[_0xe44f('0x2e')](function(_0x5b4fae){if(_0x5b4fae){_0x5d1b7e=_0x5b4fae[_0xe44f('0x47')];if(!_0x11e034['query'][_0xe44f('0x48')](_0xe44f('0x49'))){_0x17a42f[_0xe44f('0x25')]=qs[_0xe44f('0x25')](_0x11e034[_0xe44f('0x42')][_0xe44f('0x25')]);_0x17a42f[_0xe44f('0x28')]=qs[_0xe44f('0x28')](_0x11e034[_0xe44f('0x42')][_0xe44f('0x28')]);}return _0x227daa[_0xe44f('0xc0')](_0x17a42f);}})['then'](function(_0x225b20){if(_0x225b20){return _0x225b20?{'count':_0x5d1b7e,'rows':_0x225b20}:null;}})['then'](respondWithResult(_0x4fc730,null))['catch'](handleError(_0x4fc730,null));};exports[_0xe44f('0xc1')]=function(_0x2b88f0,_0x11abbf,_0x45bf04){var _0x381cc2,_0x587492;return db[_0xe44f('0x4f')][_0xe44f('0x56')]({'where':{'id':_0x2b88f0[_0xe44f('0x53')]['id']}})['then'](handleEntityNotFound(_0x11abbf,null))['then'](function(_0x45ca00){if(_0x45ca00){_0x587492=_0x45ca00;return _0x45ca00[_0xe44f('0xc1')](_0x2b88f0[_0xe44f('0x59')][_0xe44f('0x88')],_[_0xe44f('0x66')](_0x2b88f0[_0xe44f('0x59')],[_0xe44f('0x88'),'id'])||{});}return null;})[_0xe44f('0x9c')](function(_0x47984f){var _0x408fbb;_0x381cc2=_0x47984f||[];var _0x39f07b=[];if(_0x47984f){for(var _0xcd315e=0x0;_0xcd315e<_0x47984f['length'];_0xcd315e+=0x1){var _0x448cd9=_0x47984f[_0xcd315e][_0xe44f('0x30')]({'plain':!![]});_0x408fbb=squel['insert']()[_0xe44f('0xa5')]('cm_hopper_black')[_0xe44f('0xa6')](['phone',_0xe44f('0xa9'),_0xe44f('0xaa'),_0xe44f('0x6d'),'createdAt','updatedAt'],squel[_0xe44f('0xb2')]()[_0xe44f('0x89')]('phone',_0xe44f('0xa7'))[_0xe44f('0x89')]('id','ContactId')[_0xe44f('0x89')](_0x448cd9[_0xe44f('0xab')][_0xe44f('0x93')](),'ListId')['field'](_0x2b88f0['params']['id'][_0xe44f('0x93')](),_0xe44f('0x6d'))['field']('NOW()',_0xe44f('0x67'))[_0xe44f('0x89')](_0xe44f('0xc2'),_0xe44f('0x65'))[_0xe44f('0x8b')](_0xe44f('0xb6'))[_0xe44f('0x4b')](_0xe44f('0xac'))['where']('ListId\x20=\x20?',_0x448cd9[_0xe44f('0xab')][_0xe44f('0x93')]())[_0xe44f('0x4b')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x39f07b['push'](db['sequelize'][_0xe44f('0x42')](_0x408fbb));}return BPromise[_0xe44f('0xb7')](_0x39f07b);}})[_0xe44f('0x2e')](function(){return _0x381cc2;})[_0xe44f('0x2e')](respondWithResult(_0x11abbf,null))[_0xe44f('0x57')](handleError(_0x11abbf,null));};exports[_0xe44f('0xc3')]=function(_0x439adf,_0x27480a,_0x1a1810){return db[_0xe44f('0x4f')][_0xe44f('0x56')]({'where':{'id':_0x439adf[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](handleEntityNotFound(_0x27480a,null))[_0xe44f('0x2e')](function(_0x3f54a6){if(_0x3f54a6){return _0x3f54a6['removeBlackLists'](_0x439adf['query'][_0xe44f('0x88')]);}})['then'](function(_0x184667){if(_0x184667){return db[_0xe44f('0x71')][_0xe44f('0x2f')]({'where':{'ListId':_0x439adf['query'][_0xe44f('0x88')],'VoiceQueueId':_0x439adf[_0xe44f('0x53')]['id']}})[_0xe44f('0x2e')](function(){return _0x184667;});}})[_0xe44f('0x2e')](respondWithStatusCode(_0x27480a,null))['catch'](handleError(_0x27480a,null));}; \ No newline at end of file +var _0xc6ac=['outbound','filter','ignore','map','value','find','type','name','UserProfileResource','error','stack','index','VoiceQueue','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','body','createdAt','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','order','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','isArray','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','ContactId','CmListId','ListId','updatedAt','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','scheduledAt','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','push','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','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','defaults','redis','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x3266cb,_0x1b7156){_0x3266cb=_0x3266cb-0x0;var _0x185c82=_0xc6ac[_0x3266cb];return _0x185c82;};'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'];config['redis']=_[_0xcc6a('0x1b')](config[_0xcc6a('0x1c')],{'host':_0xcc6a('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcc6a('0x1e'))[_0xcc6a('0x1f')](socket);function respondWithStatusCode(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xcc;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x20')](_0x348af7);}return _0x43710d[_0xcc6a('0x21')](_0x348af7)[_0xcc6a('0x22')]();};}function respondWithResult(_0x56ffb0,_0x4e628f){_0x4e628f=_0x4e628f||0xc8;return function(_0x4d021a){if(_0x4d021a){return _0x56ffb0[_0xcc6a('0x21')](_0x4e628f)[_0xcc6a('0x23')](_0x4d021a);}};}function respondWithFilteredResult(_0x307f2a,_0x3e63d9){return function(_0x33079c){if(_0x33079c){var _0x12ef33=typeof _0x3e63d9[_0xcc6a('0x24')]===_0xcc6a('0x25')&&typeof _0x3e63d9[_0xcc6a('0x26')]===_0xcc6a('0x25');var _0x1d20a3=_0x33079c['count'];var _0xfec60f=_0x12ef33?0x0:_0x3e63d9[_0xcc6a('0x24')];var _0x355b6f=_0x12ef33?_0x33079c[_0xcc6a('0x27')]:_0x3e63d9[_0xcc6a('0x24')]+_0x3e63d9[_0xcc6a('0x26')];var _0x36c80f;if(_0x355b6f>=_0x1d20a3){_0x355b6f=_0x1d20a3;_0x36c80f=0xc8;}else{_0x36c80f=0xce;}_0x307f2a[_0xcc6a('0x21')](_0x36c80f);return _0x307f2a[_0xcc6a('0x28')](_0xcc6a('0x29'),_0xfec60f+'-'+_0x355b6f+'/'+_0x1d20a3)[_0xcc6a('0x23')](_0x33079c);}return null;};}function patchUpdates(_0x845088){return function(_0x51be9a){try{jsonpatch[_0xcc6a('0x2a')](_0x51be9a,_0x845088,!![]);}catch(_0x3a081e){return BPromise[_0xcc6a('0x2b')](_0x3a081e);}return _0x51be9a['save']();};}function saveUpdates(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2c')](_0x10016a)[_0xcc6a('0x2d')](function(_0x5fc697){return _0x5fc697;});}return null;};}function removeEntity(_0x50abc1,_0x26def8){return function(_0x29d8be){if(_0x29d8be){return _0x29d8be[_0xcc6a('0x2e')]()['then'](function(){var _0x3afb3a=_0x29d8be[_0xcc6a('0x2f')]({'plain':!![]});var _0x4da301=[{'name':_0xcc6a('0x30'),'value':_0xcc6a('0x31'),'ignore':![]},{'name':_0xcc6a('0x32'),'value':_0xcc6a('0x33'),'ignore':![]}];var _0x5d7399=_(_0x4da301)[_0xcc6a('0x34')](_0xcc6a('0x35'))[_0xcc6a('0x36')]('value')[_0xcc6a('0x37')]();if(_['includes'](_0x5d7399,_0x3afb3a['type'])){return;}var _0x33b72b=_[_0xcc6a('0x38')](_0x4da301,[_0xcc6a('0x37'),_0x3afb3a[_0xcc6a('0x39')]])[_0xcc6a('0x3a')];return db[_0xcc6a('0x3b')]['destroy']({'where':{'type':_0x33b72b,'resourceId':_0x3afb3a['id']}})[_0xcc6a('0x2d')](function(){return _0x29d8be;});})[_0xcc6a('0x2d')](function(){_0x50abc1[_0xcc6a('0x21')](0xcc)[_0xcc6a('0x22')]();});}};}function handleEntityNotFound(_0x211a8c,_0x152ebd){return function(_0x2030a6){if(!_0x2030a6){_0x211a8c[_0xcc6a('0x20')](0x194);}return _0x2030a6;};}function handleError(_0x5bb39d,_0x36fc25){_0x36fc25=_0x36fc25||0x1f4;return function(_0xc8c90c){logger[_0xcc6a('0x3c')](_0xc8c90c[_0xcc6a('0x3d')]);if(_0xc8c90c[_0xcc6a('0x3a')]){delete _0xc8c90c[_0xcc6a('0x3a')];}_0x5bb39d[_0xcc6a('0x21')](_0x36fc25)['send'](_0xc8c90c);};}exports[_0xcc6a('0x3e')]=function(_0x5a41b4,_0x49c85b){var _0x50cfe0={},_0x38910a={},_0x2a3e93={'count':0x0,'rows':[]};var _0x1101ec=_[_0xcc6a('0x36')](db[_0xcc6a('0x3f')]['rawAttributes'],function(_0x58f6ee){return{'name':_0x58f6ee[_0xcc6a('0x40')],'type':_0x58f6ee[_0xcc6a('0x39')][_0xcc6a('0x41')]};});_0x38910a['model']=_[_0xcc6a('0x36')](_0x1101ec,_0xcc6a('0x3a'));_0x38910a[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x5a41b4[_0xcc6a('0x42')]);_0x38910a[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x38910a[_0xcc6a('0x46')],_0x38910a[_0xcc6a('0x42')]);_0x50cfe0[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x38910a[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x5a41b4[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x50cfe0[_0xcc6a('0x47')]=_0x50cfe0[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0x50cfe0['attributes']:_0x38910a['model'];if(!_0x5a41b4[_0xcc6a('0x42')][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x50cfe0[_0xcc6a('0x26')]=qs[_0xcc6a('0x26')](_0x5a41b4[_0xcc6a('0x42')][_0xcc6a('0x26')]);_0x50cfe0[_0xcc6a('0x24')]=qs['offset'](_0x5a41b4['query'][_0xcc6a('0x24')]);}_0x50cfe0['order']=qs['sort'](_0x5a41b4['query'][_0xcc6a('0x4c')]);_0x50cfe0[_0xcc6a('0x4d')]=qs[_0xcc6a('0x44')](_[_0xcc6a('0x4e')](_0x5a41b4[_0xcc6a('0x42')],_0x38910a['filters']),_0x1101ec);if(_0x5a41b4[_0xcc6a('0x42')][_0xcc6a('0x34')]){_0x50cfe0[_0xcc6a('0x4d')]=_[_0xcc6a('0x4f')](_0x50cfe0[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x1101ec,function(_0x54f862){if(_0x54f862[_0xcc6a('0x39')]!==_0xcc6a('0x50')){var _0x103eee={};_0x103eee[_0x54f862[_0xcc6a('0x3a')]]={'$like':'%'+_0x5a41b4['query'][_0xcc6a('0x34')]+'%'};return _0x103eee;}})});}_0x50cfe0=_['merge']({},_0x50cfe0,_0x5a41b4[_0xcc6a('0x51')]);var _0x3f280a={'where':_0x50cfe0[_0xcc6a('0x4d')]};return db['VoiceQueue'][_0xcc6a('0x27')](_0x3f280a)[_0xcc6a('0x2d')](function(_0x4214d8){_0x2a3e93['count']=_0x4214d8;if(_0x5a41b4['query'][_0xcc6a('0x52')]){_0x50cfe0[_0xcc6a('0x53')]=[{'all':!![]}];}return db[_0xcc6a('0x3f')][_0xcc6a('0x54')](_0x50cfe0);})[_0xcc6a('0x2d')](function(_0x5e59af){_0x2a3e93[_0xcc6a('0x55')]=_0x5e59af;return _0x2a3e93;})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x49c85b,_0x50cfe0))['catch'](handleError(_0x49c85b,null));};exports[_0xcc6a('0x56')]=function(_0xa45d06,_0x42ffcc){var _0x12a594={'raw':![],'where':{'id':_0xa45d06[_0xcc6a('0x57')]['id']}},_0x3b595f={};_0x3b595f['model']=_['keys'](db['VoiceQueue'][_0xcc6a('0x58')]);_0x3b595f[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0xa45d06[_0xcc6a('0x42')]);_0x3b595f['filters']=_[_0xcc6a('0x45')](_0x3b595f['model'],_0x3b595f[_0xcc6a('0x42')]);_0x12a594[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x3b595f[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0xa45d06[_0xcc6a('0x42')]['fields']));_0x12a594[_0xcc6a('0x47')]=_0x12a594[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0x12a594[_0xcc6a('0x47')]:_0x3b595f[_0xcc6a('0x46')];if(_0xa45d06[_0xcc6a('0x42')][_0xcc6a('0x52')]){_0x12a594[_0xcc6a('0x53')]=[{'all':!![]}];}_0x12a594=_[_0xcc6a('0x4f')]({},_0x12a594,_0xa45d06[_0xcc6a('0x51')]);return db['VoiceQueue'][_0xcc6a('0x38')](_0x12a594)[_0xcc6a('0x2d')](handleEntityNotFound(_0x42ffcc,null))[_0xcc6a('0x2d')](respondWithResult(_0x42ffcc,null))[_0xcc6a('0x59')](handleError(_0x42ffcc,null));};exports[_0xcc6a('0x5a')]=function(_0x465741,_0x4abb9b){return db['VoiceQueue'][_0xcc6a('0x5a')](_0x465741['body'],{})[_0xcc6a('0x2d')](function(_0x1f56b0){var _0x2b5782=_0x465741[_0xcc6a('0x5b')][_0xcc6a('0x2f')]({'plain':!![]});if(!_0x2b5782)throw new Error(_0xcc6a('0x5c'));if(_0x2b5782[_0xcc6a('0x5d')]===_0xcc6a('0x5b')){var _0x68b823=_0x1f56b0[_0xcc6a('0x2f')]({'plain':!![]});var _0x12224f=[{'name':'VoiceQueues','value':_0xcc6a('0x31')},{'name':'QueueCampaigns','value':_0xcc6a('0x33')}];var _0x1570fe=_[_0xcc6a('0x38')](_0x12224f,['value',_0x68b823[_0xcc6a('0x39')]])['name'];return db[_0xcc6a('0x5e')]['find']({'where':{'name':_0x1570fe,'userProfileId':_0x2b5782[_0xcc6a('0x5f')]},'raw':!![]})[_0xcc6a('0x2d')](function(_0x24fecc){if(_0x24fecc&&_0x24fecc[_0xcc6a('0x60')]===0x0){return db[_0xcc6a('0x3b')][_0xcc6a('0x5a')]({'name':_0x68b823[_0xcc6a('0x3a')],'resourceId':_0x68b823['id'],'type':_0x24fecc[_0xcc6a('0x3a')],'sectionId':_0x24fecc['id']},{})['then'](function(){return _0x1f56b0;});}else{return _0x1f56b0;}})[_0xcc6a('0x59')](function(_0x56d512){logger[_0xcc6a('0x3c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56d512);throw _0x56d512;});}return _0x1f56b0;})[_0xcc6a('0x2d')](respondWithResult(_0x4abb9b,0xc9))[_0xcc6a('0x59')](handleError(_0x4abb9b,null));};exports[_0xcc6a('0x61')]=function(_0x586789,_0x2fa7fa){var _0x5e4447={'where':{'id':_0x586789[_0xcc6a('0x57')]['id']}},_0x5e53e4={};_0x5e53e4[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x3f')][_0xcc6a('0x58')]);_0x5e4447[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x5e53e4[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x586789[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x5e4447[_0xcc6a('0x47')]=_0x5e4447[_0xcc6a('0x47')]['length']?_0x5e4447[_0xcc6a('0x47')]:_0x5e53e4[_0xcc6a('0x46')];if(_0x586789[_0xcc6a('0x42')][_0xcc6a('0x52')]){_0x5e4447['include']=[{'all':!![]}];}_0x5e4447=_[_0xcc6a('0x4f')]({},_0x5e4447,_0x586789[_0xcc6a('0x51')]);return db[_0xcc6a('0x3f')][_0xcc6a('0x38')](_0x5e4447)[_0xcc6a('0x2d')](handleEntityNotFound(_0x2fa7fa,null))[_0xcc6a('0x2d')](function(_0x16c6a3){if(_0x16c6a3){var _0x3f1361=_0x16c6a3[_0xcc6a('0x2f')]({'plain':!![]});_0x3f1361=qs[_0xcc6a('0x62')](_0x3f1361,['id','createdAt','updatedAt']);_0x586789['body']=_[_0xcc6a('0x62')](_0x586789[_0xcc6a('0x63')],['id',_0xcc6a('0x64'),'updatedAt']);return db[_0xcc6a('0x3f')][_0xcc6a('0x5a')](_[_0xcc6a('0x4f')](_0x3f1361,_0x586789[_0xcc6a('0x63')]),{'include':_0x586789['query']['includeAll']?[{'all':!![]}]:undefined})[_0xcc6a('0x2d')](function(_0x41527b){var _0x4403d3=_0x586789[_0xcc6a('0x5b')]['get']({'plain':!![]});if(!_0x4403d3)throw new Error(_0xcc6a('0x5c'));if(_0x4403d3[_0xcc6a('0x5d')]===_0xcc6a('0x5b')){var _0x3b5e04=_0x41527b[_0xcc6a('0x2f')]({'plain':!![]});var _0x55d129=[{'name':'VoiceQueues','value':_0xcc6a('0x31')},{'name':_0xcc6a('0x32'),'value':_0xcc6a('0x33')}];var _0x144495=_['find'](_0x55d129,['value',_0x3b5e04[_0xcc6a('0x39')]])[_0xcc6a('0x3a')];return db[_0xcc6a('0x5e')][_0xcc6a('0x38')]({'where':{'name':_0x144495,'userProfileId':_0x4403d3['userProfileId']},'raw':!![]})['then'](function(_0x58e6b4){if(_0x58e6b4&&_0x58e6b4[_0xcc6a('0x60')]===0x0){return db[_0xcc6a('0x3b')][_0xcc6a('0x5a')]({'name':_0x3b5e04[_0xcc6a('0x3a')],'resourceId':_0x3b5e04['id'],'type':_0x58e6b4['name'],'sectionId':_0x58e6b4['id']},{})[_0xcc6a('0x2d')](function(){return _0x41527b;});}else{return _0x41527b;}})[_0xcc6a('0x59')](function(_0x494d75){logger[_0xcc6a('0x3c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x494d75);throw _0x494d75;});}return _0x41527b;});}})[_0xcc6a('0x2d')](respondWithResult(_0x2fa7fa,0xc9))['catch'](handleError(_0x2fa7fa,null));};exports[_0xcc6a('0x2c')]=function(_0xcf0bf5,_0xa35084){if(_0xcf0bf5['body']['id']){delete _0xcf0bf5[_0xcc6a('0x63')]['id'];}return db['VoiceQueue'][_0xcc6a('0x38')]({'where':{'id':_0xcf0bf5['params']['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0xa35084,null))[_0xcc6a('0x2d')](saveUpdates(_0xcf0bf5[_0xcc6a('0x63')],null))[_0xcc6a('0x2d')](respondWithResult(_0xa35084,null))[_0xcc6a('0x59')](handleError(_0xa35084,null));};exports[_0xcc6a('0x2e')]=function(_0x4d752b,_0x18f5dc){return db[_0xcc6a('0x3f')][_0xcc6a('0x38')]({'where':{'id':_0x4d752b[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x18f5dc,null))['then'](removeEntity(_0x18f5dc,null))[_0xcc6a('0x59')](handleError(_0x18f5dc,null));};exports[_0xcc6a('0x65')]=function(_0x501341,_0x4dbfc7,_0x2fbdce){var _0x2e9b03={'raw':![],'where':{}};var _0x304c2b={};var _0x3e5ff1={'count':0x0,'rows':[]};return db[_0xcc6a('0x3f')][_0xcc6a('0x66')]({'where':{'id':_0x501341['params']['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x4dbfc7,null))[_0xcc6a('0x2d')](function(_0x2fbbe2){if(_0x2fbbe2){_0x304c2b[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x67')]['rawAttributes']);_0x304c2b['query']=_[_0xcc6a('0x43')](_0x501341[_0xcc6a('0x42')]);_0x304c2b[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x304c2b[_0xcc6a('0x46')],_0x304c2b[_0xcc6a('0x42')]);_0x2e9b03[_0xcc6a('0x47')]=_['intersection'](_0x304c2b[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x501341[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x2e9b03[_0xcc6a('0x47')]=_0x2e9b03[_0xcc6a('0x47')]['length']?_0x2e9b03[_0xcc6a('0x47')]:_0x304c2b[_0xcc6a('0x46')];if(!_0x501341[_0xcc6a('0x42')]['hasOwnProperty'](_0xcc6a('0x4b'))){_0x2e9b03[_0xcc6a('0x26')]=qs[_0xcc6a('0x26')](_0x501341[_0xcc6a('0x42')][_0xcc6a('0x26')]);_0x2e9b03[_0xcc6a('0x24')]=qs['offset'](_0x501341[_0xcc6a('0x42')][_0xcc6a('0x24')]);}_0x2e9b03['order']=qs[_0xcc6a('0x4c')](_0x501341[_0xcc6a('0x42')][_0xcc6a('0x4c')]);_0x2e9b03[_0xcc6a('0x4d')]=qs[_0xcc6a('0x44')](_['pick'](_0x501341[_0xcc6a('0x42')],_0x304c2b[_0xcc6a('0x44')]));_0x2e9b03[_0xcc6a('0x4d')][_0xcc6a('0x68')]=_0x2fbbe2['id'];if(_0x501341[_0xcc6a('0x42')][_0xcc6a('0x34')]){_0x2e9b03['where']=_['merge'](_0x2e9b03[_0xcc6a('0x4d')],{'$or':_['map'](_0x2e9b03[_0xcc6a('0x47')],function(_0x35a798){var _0x2026c6={};_0x2026c6[_0x35a798]={'$like':'%'+_0x501341[_0xcc6a('0x42')][_0xcc6a('0x34')]+'%'};return _0x2026c6;})});}_0x2e9b03=_[_0xcc6a('0x4f')]({},_0x2e9b03,_0x501341[_0xcc6a('0x51')]);return db[_0xcc6a('0x67')][_0xcc6a('0x27')]({'where':_0x2e9b03[_0xcc6a('0x4d')]})[_0xcc6a('0x2d')](function(_0x383b1b){_0x3e5ff1['count']=_0x383b1b;if(_0x501341[_0xcc6a('0x42')][_0xcc6a('0x52')]){_0x2e9b03[_0xcc6a('0x53')]=[{'all':!![]}];}return db[_0xcc6a('0x67')]['findAll'](_0x2e9b03);})[_0xcc6a('0x2d')](function(_0x4d7c56){_0x3e5ff1[_0xcc6a('0x55')]=_0x4d7c56;return _0x3e5ff1;});}})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x4dbfc7,_0x2e9b03))[_0xcc6a('0x59')](handleError(_0x4dbfc7,null));};exports[_0xcc6a('0x69')]=function(_0x223bbb,_0x327a39,_0x13f72f){var _0x4d2c38={'raw':!![],'where':{}};var _0x357b66={};var _0x60c0a2={'count':0x0,'rows':[]};return db[_0xcc6a('0x3f')][_0xcc6a('0x66')]({'where':{'id':_0x223bbb[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x327a39,null))['then'](function(_0x14a957){if(_0x14a957){_0x357b66[_0xcc6a('0x46')]=_['keys'](db['CmHopperHistory'][_0xcc6a('0x58')]);_0x357b66[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x223bbb[_0xcc6a('0x42')]);_0x357b66[_0xcc6a('0x44')]=_['intersection'](_0x357b66[_0xcc6a('0x46')],_0x357b66['query']);_0x4d2c38[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x357b66[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x223bbb[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x4d2c38[_0xcc6a('0x47')]=_0x4d2c38[_0xcc6a('0x47')]['length']?_0x4d2c38[_0xcc6a('0x47')]:_0x357b66[_0xcc6a('0x46')];if(!_0x223bbb[_0xcc6a('0x42')]['hasOwnProperty'](_0xcc6a('0x4b'))){_0x4d2c38[_0xcc6a('0x26')]=qs[_0xcc6a('0x26')](_0x223bbb[_0xcc6a('0x42')][_0xcc6a('0x26')]);_0x4d2c38[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x223bbb['query'][_0xcc6a('0x24')]);}_0x4d2c38[_0xcc6a('0x6a')]=qs[_0xcc6a('0x4c')](_0x223bbb[_0xcc6a('0x42')][_0xcc6a('0x4c')]);_0x4d2c38[_0xcc6a('0x4d')]=qs[_0xcc6a('0x44')](_[_0xcc6a('0x4e')](_0x223bbb['query'],_0x357b66['filters']));_0x4d2c38[_0xcc6a('0x4d')]['VoiceQueueId']=_0x14a957['id'];if(_0x223bbb[_0xcc6a('0x42')][_0xcc6a('0x34')]){_0x4d2c38[_0xcc6a('0x4d')]=_[_0xcc6a('0x4f')](_0x4d2c38[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x4d2c38[_0xcc6a('0x47')],function(_0x48b6e3){var _0x10d731={};_0x10d731[_0x48b6e3]={'$like':'%'+_0x223bbb['query']['filter']+'%'};return _0x10d731;})});}_0x4d2c38=_[_0xcc6a('0x4f')]({},_0x4d2c38,_0x223bbb['options']);return db[_0xcc6a('0x6b')][_0xcc6a('0x27')]({'where':_0x4d2c38['where']})['then'](function(_0x34e84b){_0x60c0a2['count']=_0x34e84b;if(_0x223bbb[_0xcc6a('0x42')][_0xcc6a('0x52')]){_0x4d2c38[_0xcc6a('0x53')]=[{'all':!![]}];}return db[_0xcc6a('0x6b')][_0xcc6a('0x54')](_0x4d2c38);})[_0xcc6a('0x2d')](function(_0x56ffcf){_0x60c0a2[_0xcc6a('0x55')]=_0x56ffcf;return _0x60c0a2;});}})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x327a39,_0x4d2c38))[_0xcc6a('0x59')](handleError(_0x327a39,null));};exports[_0xcc6a('0x6c')]=function(_0x5b2e22,_0x1b869a,_0x35b777){var _0x28112b={'raw':!![],'where':{}};var _0x2d24de={};var _0x383e2b={'count':0x0,'rows':[]};return db[_0xcc6a('0x3f')][_0xcc6a('0x66')]({'where':{'id':_0x5b2e22['params']['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x1b869a,null))[_0xcc6a('0x2d')](function(_0x4e675b){if(_0x4e675b){_0x2d24de[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x6d')][_0xcc6a('0x58')]);_0x2d24de[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x5b2e22[_0xcc6a('0x42')]);_0x2d24de[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x2d24de[_0xcc6a('0x46')],_0x2d24de[_0xcc6a('0x42')]);_0x28112b[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x2d24de[_0xcc6a('0x46')],qs['fields'](_0x5b2e22['query'][_0xcc6a('0x48')]));_0x28112b[_0xcc6a('0x47')]=_0x28112b['attributes'][_0xcc6a('0x49')]?_0x28112b[_0xcc6a('0x47')]:_0x2d24de[_0xcc6a('0x46')];if(!_0x5b2e22['query'][_0xcc6a('0x4a')]('nolimit')){_0x28112b[_0xcc6a('0x26')]=qs[_0xcc6a('0x26')](_0x5b2e22['query'][_0xcc6a('0x26')]);_0x28112b['offset']=qs[_0xcc6a('0x24')](_0x5b2e22[_0xcc6a('0x42')][_0xcc6a('0x24')]);}_0x28112b[_0xcc6a('0x6a')]=qs[_0xcc6a('0x4c')](_0x5b2e22[_0xcc6a('0x42')]['sort']);_0x28112b['where']=qs[_0xcc6a('0x44')](_[_0xcc6a('0x4e')](_0x5b2e22[_0xcc6a('0x42')],_0x2d24de['filters']));_0x28112b[_0xcc6a('0x4d')][_0xcc6a('0x68')]=_0x4e675b['id'];if(_0x5b2e22[_0xcc6a('0x42')][_0xcc6a('0x34')]){_0x28112b['where']=_[_0xcc6a('0x4f')](_0x28112b[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x28112b['attributes'],function(_0x417a7b){var _0x54ff5b={};_0x54ff5b[_0x417a7b]={'$like':'%'+_0x5b2e22[_0xcc6a('0x42')][_0xcc6a('0x34')]+'%'};return _0x54ff5b;})});}_0x28112b=_['merge']({},_0x28112b,_0x5b2e22[_0xcc6a('0x51')]);return db[_0xcc6a('0x6d')][_0xcc6a('0x27')]({'where':_0x28112b[_0xcc6a('0x4d')]})[_0xcc6a('0x2d')](function(_0x125dba){_0x383e2b[_0xcc6a('0x27')]=_0x125dba;if(_0x5b2e22[_0xcc6a('0x42')][_0xcc6a('0x52')]){_0x28112b[_0xcc6a('0x53')]=[{'all':!![]}];}return db[_0xcc6a('0x6d')]['findAll'](_0x28112b);})['then'](function(_0x3cb6bf){_0x383e2b['rows']=_0x3cb6bf;return _0x383e2b;});}})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x1b869a,_0x28112b))['catch'](handleError(_0x1b869a,null));};exports['getHopperBlacks']=function(_0x32ced0,_0x24fdcb,_0xc638ae){var _0x3367e8={'raw':!![],'where':{}};var _0x56f6e5={};var _0x17c091={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x32ced0[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x24fdcb,null))[_0xcc6a('0x2d')](function(_0x38d805){if(_0x38d805){_0x56f6e5[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x6e')]['rawAttributes']);_0x56f6e5[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x32ced0[_0xcc6a('0x42')]);_0x56f6e5['filters']=_[_0xcc6a('0x45')](_0x56f6e5['model'],_0x56f6e5[_0xcc6a('0x42')]);_0x3367e8['attributes']=_['intersection'](_0x56f6e5[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x32ced0[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x3367e8[_0xcc6a('0x47')]=_0x3367e8['attributes']['length']?_0x3367e8['attributes']:_0x56f6e5[_0xcc6a('0x46')];if(!_0x32ced0[_0xcc6a('0x42')][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x3367e8[_0xcc6a('0x26')]=qs[_0xcc6a('0x26')](_0x32ced0['query'][_0xcc6a('0x26')]);_0x3367e8['offset']=qs[_0xcc6a('0x24')](_0x32ced0[_0xcc6a('0x42')][_0xcc6a('0x24')]);}_0x3367e8[_0xcc6a('0x6a')]=qs[_0xcc6a('0x4c')](_0x32ced0['query']['sort']);_0x3367e8[_0xcc6a('0x4d')]=qs[_0xcc6a('0x44')](_['pick'](_0x32ced0[_0xcc6a('0x42')],_0x56f6e5[_0xcc6a('0x44')]));_0x3367e8[_0xcc6a('0x4d')][_0xcc6a('0x68')]=_0x38d805['id'];if(_0x32ced0[_0xcc6a('0x42')][_0xcc6a('0x34')]){_0x3367e8['where']=_[_0xcc6a('0x4f')](_0x3367e8[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x3367e8['attributes'],function(_0x54f0e4){var _0x559f4f={};_0x559f4f[_0x54f0e4]={'$like':'%'+_0x32ced0['query'][_0xcc6a('0x34')]+'%'};return _0x559f4f;})});}_0x3367e8=_['merge']({},_0x3367e8,_0x32ced0[_0xcc6a('0x51')]);return db[_0xcc6a('0x6e')]['count']({'where':_0x3367e8[_0xcc6a('0x4d')]})['then'](function(_0x347853){_0x17c091[_0xcc6a('0x27')]=_0x347853;if(_0x32ced0[_0xcc6a('0x42')][_0xcc6a('0x52')]){_0x3367e8[_0xcc6a('0x53')]=[{'all':!![]}];}return db[_0xcc6a('0x6e')][_0xcc6a('0x54')](_0x3367e8);})[_0xcc6a('0x2d')](function(_0x4c39fb){_0x17c091[_0xcc6a('0x55')]=_0x4c39fb;return _0x17c091;});}})[_0xcc6a('0x2d')](respondWithFilteredResult(_0x24fdcb,_0x3367e8))[_0xcc6a('0x59')](handleError(_0x24fdcb,null));};exports[_0xcc6a('0x6f')]=function(_0x171a2a,_0x326e25,_0x13860b){var _0x3b52f7={};var _0x335748={};var _0x1b870e;var _0x1f171d;return db[_0xcc6a('0x3f')][_0xcc6a('0x66')]({'where':{'id':_0x171a2a['params']['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x326e25,null))[_0xcc6a('0x2d')](function(_0x2d201c){if(_0x2d201c){_0x1b870e=_0x2d201c;_0x335748['model']=_[_0xcc6a('0x43')](db[_0xcc6a('0x70')]['rawAttributes']);_0x335748[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x171a2a['query']);_0x335748[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x335748[_0xcc6a('0x46')],_0x335748[_0xcc6a('0x42')]);_0x3b52f7[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x335748['model'],qs['fields'](_0x171a2a[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x3b52f7['attributes']=_0x3b52f7[_0xcc6a('0x47')]['length']?_0x3b52f7[_0xcc6a('0x47')]:_0x335748['model'];_0x3b52f7[_0xcc6a('0x6a')]=qs[_0xcc6a('0x4c')](_0x171a2a[_0xcc6a('0x42')]['sort']);_0x3b52f7[_0xcc6a('0x4d')]=qs[_0xcc6a('0x44')](_[_0xcc6a('0x4e')](_0x171a2a['query'],_0x335748['filters']));if(_0x171a2a['query'][_0xcc6a('0x34')]){_0x3b52f7[_0xcc6a('0x4d')]=_[_0xcc6a('0x4f')](_0x3b52f7[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x3b52f7[_0xcc6a('0x47')],function(_0x94974a){var _0x80ca93={};_0x80ca93[_0x94974a]={'$like':'%'+_0x171a2a[_0xcc6a('0x42')][_0xcc6a('0x34')]+'%'};return _0x80ca93;})});}_0x3b52f7=_[_0xcc6a('0x4f')]({},_0x3b52f7,_0x171a2a[_0xcc6a('0x51')]);return _0x1b870e['getTeams'](_0x3b52f7);}})[_0xcc6a('0x2d')](function(_0x38ffe2){if(_0x38ffe2){_0x1f171d=_0x38ffe2[_0xcc6a('0x49')];if(!_0x171a2a['query'][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x3b52f7[_0xcc6a('0x26')]=qs['limit'](_0x171a2a[_0xcc6a('0x42')][_0xcc6a('0x26')]);_0x3b52f7[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x171a2a['query'][_0xcc6a('0x24')]);}return _0x1b870e['getTeams'](_0x3b52f7);}})['then'](function(_0x573bce){if(_0x573bce){return _0x573bce?{'count':_0x1f171d,'rows':_0x573bce}:null;}})[_0xcc6a('0x2d')](respondWithResult(_0x326e25,null))['catch'](handleError(_0x326e25,null));};exports['addTeams']=function(_0x16978f,_0x27aba3,_0x44bda5){var _0x3d1201=_0x16978f[_0xcc6a('0x63')][_0xcc6a('0x71')];var _0x576ea7=_['map'](_0x3d1201,'id');return db['Team'][_0xcc6a('0x54')]({'where':{'id':_0x576ea7},'attributes':['id'],'include':[{'model':db[_0xcc6a('0x72')],'as':_0xcc6a('0x73'),'attributes':['id',_0xcc6a('0x3a'),_0xcc6a('0x74'),_0xcc6a('0x75'),'interface'],'raw':!![]}]})['then'](function(_0x235651){if(_0x235651){var _0x23b8ba=_[_0xcc6a('0x76')](_0x235651,function(_0x37cab9){var _0x5db741=_0x37cab9[_0xcc6a('0x2f')]({'plain':!![]});_0x5db741['Agents'][_0xcc6a('0x77')](function(_0x1c2115){_0x1c2115[_0xcc6a('0x78')]=_[_0xcc6a('0x38')](_0x3d1201,{'id':_0x5db741['id']})[_0xcc6a('0x78')];});return _0x5db741['Agents'];});return db['VoiceQueue'][_0xcc6a('0x38')]({'where':{'id':_0x16978f[_0xcc6a('0x57')]['id']}})['then'](function(_0x1d103c){return db[_0xcc6a('0x79')][_0xcc6a('0x7a')](function(_0xc92668){return _0x1d103c[_0xcc6a('0x7b')](_0x576ea7,{'transaction':_0xc92668})[_0xcc6a('0x2d')](function(){return BPromise[_0xcc6a('0x7c')](_0x3d1201,function(_0x164619){return db[_0xcc6a('0x7d')][_0xcc6a('0x7e')]({'TeamId':_0x164619['id'],'VoiceQueueId':_0x16978f['params']['id'],'penalty':_0x164619['penalty']},{'transaction':_0xc92668});});})[_0xcc6a('0x2d')](function(){return BPromise['each'](_0x23b8ba,function(_0x11386f){return db[_0xcc6a('0x7f')][_0xcc6a('0x80')]({'where':{'UserId':_0x11386f['id'],'VoiceQueueId':_0x16978f['params']['id']},'defaults':{'penalty':_0x11386f[_0xcc6a('0x78')]},'transaction':_0xc92668});});})['then'](function(){return BPromise[_0xcc6a('0x7c')](_[_0xcc6a('0x34')](_0x23b8ba,{'online':!![]}),function(_0x40e564){return db[_0xcc6a('0x81')]['upsert']({'membername':_0x40e564[_0xcc6a('0x3a')],'UserId':_0x40e564['id'],'queue_name':_0x1d103c[_0xcc6a('0x3a')],'VoiceQueueId':_0x1d103c['id'],'interface':_[_0xcc6a('0x82')](_0x40e564[_0xcc6a('0x83')])?util[_0xcc6a('0x84')](_0xcc6a('0x85'),_0x40e564[_0xcc6a('0x3a')]):_0x40e564['interface'],'paused':_0x40e564['voicePause']||![],'penalty':_0x40e564['penalty']},{'transaction':_0xc92668});});})[_0xcc6a('0x2d')](function(){_0x23b8ba[_0xcc6a('0x77')](function(_0x557c1c){socket[_0xcc6a('0x86')](_0xcc6a('0x87'),{'UserId':_0x557c1c['id'],'VoiceQueueId':_0x1d103c['id']});});});});});}})[_0xcc6a('0x2d')](respondWithStatusCode(_0x27aba3,null))['catch'](handleError(_0x27aba3,null));};exports[_0xcc6a('0x88')]=function(_0x5bc250,_0x2dc4a9,_0x5975af){return db[_0xcc6a('0x70')][_0xcc6a('0x54')]({'where':{'id':_0x5bc250[_0xcc6a('0x42')][_0xcc6a('0x89')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcc6a('0x73'),'attributes':['id'],'raw':!![]}]})[_0xcc6a('0x2d')](handleEntityNotFound(_0x2dc4a9,null))[_0xcc6a('0x2d')](function(_0x4ca5a1){var _0x5d9912=_['map'](_0x4ca5a1,'id');var _0xe5964a=[];var _0x15fd07=[];var _0x34f27d=squel[_0xcc6a('0x8a')]();_0x34f27d[_0xcc6a('0x8b')](_0xcc6a('0x8c'))[_0xcc6a('0x8d')](_0xcc6a('0x8e'),'tq')[_0xcc6a('0x8f')](_0xcc6a('0x90'),'ut',_0xcc6a('0x91'))[_0xcc6a('0x4d')]('VoiceQueueId\x20=\x20?',_0x5bc250[_0xcc6a('0x57')]['id']);for(var _0x1325e3=0x0;_0x1325e3<_0x4ca5a1[_0xcc6a('0x49')];_0x1325e3+=0x1){let _0x46b754=_0x4ca5a1[_0x1325e3];for(var _0x329d1=0x0;_0x329d1<_0x46b754[_0xcc6a('0x73')][_0xcc6a('0x49')];_0x329d1+=0x1){let _0x4efdd9=_0x46b754[_0xcc6a('0x73')][_0x329d1];var _0x53d72=_0x34f27d[_0xcc6a('0x61')]();_0x53d72[_0xcc6a('0x4d')](_0xcc6a('0x92'),_0x4efdd9['id']);_0x15fd07['push'](db[_0xcc6a('0x79')]['query'](_0x53d72[_0xcc6a('0x93')](),{'type':db[_0xcc6a('0x79')][_0xcc6a('0x94')][_0xcc6a('0x95')]})['then'](function(_0x186e38){if(_0x186e38[_0xcc6a('0x49')]===0x1){return _0x4efdd9['id'];}else{var _0x2e8c0a=_[_0xcc6a('0x96')](_[_0xcc6a('0x36')](_0x186e38,'TeamId'),function(_0x57be11){return _[_0xcc6a('0x97')](_0x5d9912,_0x57be11);});if(_0x2e8c0a){return _0x4efdd9['id'];}}}));}}return BPromise[_0xcc6a('0x98')](_0x15fd07)[_0xcc6a('0x2d')](function(_0x5bf2ab){_0xe5964a=_(_0xe5964a)['union'](_0x5bf2ab)[_0xcc6a('0x99')]()[_0xcc6a('0x37')]();return db[_0xcc6a('0x3f')][_0xcc6a('0x38')]({'where':{'id':_0x5bc250[_0xcc6a('0x57')]['id']}})['then'](function(_0x1a855d){return db[_0xcc6a('0x79')][_0xcc6a('0x7a')](function(_0x4523a6){return _0x1a855d['removeTeams'](_0x5bc250[_0xcc6a('0x42')][_0xcc6a('0x89')],{'transaction':_0x4523a6})[_0xcc6a('0x2d')](function(){if(!_[_0xcc6a('0x9a')](_0xe5964a)){return _0x1a855d[_0xcc6a('0x9b')](_0xe5964a,{'transaction':_0x4523a6})[_0xcc6a('0x2d')](function(){return db[_0xcc6a('0x81')][_0xcc6a('0x2e')]({'where':{'VoiceQueueId':_0x5bc250[_0xcc6a('0x57')]['id'],'UserId':_0xe5964a},'transaction':_0x4523a6});});}})[_0xcc6a('0x2d')](function(){_0xe5964a[_0xcc6a('0x77')](function(_0x1e0bcc){socket['emit'](_0xcc6a('0x9c'),{'UserId':_0x1e0bcc,'VoiceQueueId':_0x1a855d['id']});});});});});});})['then'](respondWithStatusCode(_0x2dc4a9,null))[_0xcc6a('0x59')](handleError(_0x2dc4a9,null));};exports['addAgents']=function(_0x37a52e,_0x4e0b02,_0xe6dc84){var _0x45f4d0,_0x45cef1;return db['VoiceQueue']['find']({'where':{'id':_0x37a52e['params']['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x4e0b02,null))[_0xcc6a('0x2d')](function(_0x1fb98a){if(_0x1fb98a){_0x45cef1=_0x1fb98a;return _0x1fb98a[_0xcc6a('0x9d')](_0x37a52e[_0xcc6a('0x63')][_0xcc6a('0x89')],_[_0xcc6a('0x62')](_0x37a52e[_0xcc6a('0x63')],['ids','id'])||{})['spread'](function(_0x51ccd1){for(var _0x23cb09=0x0;_0x23cb09<_0x37a52e['body'][_0xcc6a('0x89')][_0xcc6a('0x49')];_0x23cb09+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x37a52e[_0xcc6a('0x63')]['ids'][_0x23cb09]),'VoiceQueueId':Number(_0x37a52e[_0xcc6a('0x57')]['id'])});}return _0x51ccd1;});}})[_0xcc6a('0x2d')](function(_0x5f33bc){_0x45f4d0=_0x5f33bc||[];if(_0x45cef1){return db[_0xcc6a('0x72')][_0xcc6a('0x54')]({'where':{'id':_0x37a52e[_0xcc6a('0x63')][_0xcc6a('0x89')]},'attributes':['id',_0xcc6a('0x3a'),'online',_0xcc6a('0x75'),_0xcc6a('0x83')],'raw':!![]});}})[_0xcc6a('0x2d')](function(_0x28abbf){if(!_['isEmpty'](_0x28abbf)){var _0x4ec5fb=[];for(var _0x21c44b=0x0;_0x21c44b<_0x28abbf['length'];_0x21c44b++){if(_0x28abbf[_0x21c44b][_0xcc6a('0x74')]){_0x4ec5fb['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x28abbf[_0x21c44b][_0xcc6a('0x3a')],'UserId':_0x28abbf[_0x21c44b]['id'],'queue_name':_0x45cef1[_0xcc6a('0x3a')],'VoiceQueueId':_0x45cef1['id'],'interface':_['isNil'](_0x28abbf[_0x21c44b][_0xcc6a('0x83')])?util[_0xcc6a('0x84')]('SIP/%s',_0x28abbf[_0x21c44b]['name']):_0x28abbf[_0x21c44b][_0xcc6a('0x83')],'paused':_0x28abbf[_0x21c44b][_0xcc6a('0x75')]||![],'penalty':_0x37a52e['body'][_0xcc6a('0x78')]||0x0}));}}return BPromise[_0xcc6a('0x98')](_0x4ec5fb);}})[_0xcc6a('0x2d')](function(){return _0x45f4d0;})['then'](respondWithResult(_0x4e0b02,null))[_0xcc6a('0x59')](handleError(_0x4e0b02,null));};exports[_0xcc6a('0x9b')]=function(_0x2c4e84,_0x38e821,_0x58b86d){return db[_0xcc6a('0x3f')][_0xcc6a('0x38')]({'where':{'id':_0x2c4e84[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x38e821,null))['then'](function(_0x49f7a9){if(_0x49f7a9){return _0x49f7a9[_0xcc6a('0x9b')](_0x2c4e84['query'][_0xcc6a('0x89')])[_0xcc6a('0x2d')](function(){if(_[_0xcc6a('0x9e')](_0x2c4e84['query'][_0xcc6a('0x89')])){for(var _0x3ef204=0x0;_0x3ef204<_0x2c4e84['query'][_0xcc6a('0x89')][_0xcc6a('0x49')];_0x3ef204+=0x1){socket[_0xcc6a('0x86')](_0xcc6a('0x9c'),{'UserId':Number(_0x2c4e84['query'][_0xcc6a('0x89')][_0x3ef204]),'VoiceQueueId':Number(_0x2c4e84['params']['id'])});}}else{socket[_0xcc6a('0x86')](_0xcc6a('0x9c'),{'UserId':Number(_0x2c4e84['query']['ids']),'VoiceQueueId':Number(_0x2c4e84[_0xcc6a('0x57')]['id'])});}});}})[_0xcc6a('0x2d')](function(_0x2b7276){return db[_0xcc6a('0x81')][_0xcc6a('0x2e')]({'where':{'VoiceQueueId':_0x2c4e84[_0xcc6a('0x57')]['id'],'UserId':_0x2c4e84[_0xcc6a('0x42')]['ids']}})[_0xcc6a('0x2d')](function(){return _0x2b7276;});})[_0xcc6a('0x2d')](respondWithStatusCode(_0x38e821,null))[_0xcc6a('0x59')](handleError(_0x38e821,null));};exports['getAgents']=function(_0x3aac83,_0x516287,_0x5eab63){var _0x22adb4={};var _0x38704c={};var _0x2d1013;var _0x4ddd55;return db['VoiceQueue'][_0xcc6a('0x66')]({'where':{'id':_0x3aac83[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x516287,null))['then'](function(_0x44f305){if(_0x44f305){_0x2d1013=_0x44f305;_0x38704c[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x72')][_0xcc6a('0x58')]);_0x38704c[_0xcc6a('0x42')]=_['keys'](_0x3aac83[_0xcc6a('0x42')]);_0x38704c[_0xcc6a('0x44')]=_['intersection'](_0x38704c[_0xcc6a('0x46')],_0x38704c[_0xcc6a('0x42')]);_0x22adb4[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x38704c[_0xcc6a('0x46')],qs['fields'](_0x3aac83[_0xcc6a('0x42')]['fields']));_0x22adb4[_0xcc6a('0x47')]=_0x22adb4['attributes'][_0xcc6a('0x49')]?_0x22adb4[_0xcc6a('0x47')]:_0x38704c[_0xcc6a('0x46')];_0x22adb4[_0xcc6a('0x6a')]=qs['sort'](_0x3aac83[_0xcc6a('0x42')]['sort']);_0x22adb4['where']=qs[_0xcc6a('0x44')](_['pick'](_0x3aac83[_0xcc6a('0x42')],_0x38704c['filters']));if(_0x3aac83[_0xcc6a('0x42')][_0xcc6a('0x34')]){_0x22adb4['where']=_['merge'](_0x22adb4[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x22adb4[_0xcc6a('0x47')],function(_0x4ad0cf){var _0x5baf0c={};_0x5baf0c[_0x4ad0cf]={'$like':'%'+_0x3aac83[_0xcc6a('0x42')][_0xcc6a('0x34')]+'%'};return _0x5baf0c;})});}_0x22adb4=_['merge']({},_0x22adb4,_0x3aac83[_0xcc6a('0x51')]);return _0x2d1013[_0xcc6a('0x9f')](_0x22adb4);}})[_0xcc6a('0x2d')](function(_0x4aa187){if(_0x4aa187){_0x4ddd55=_0x4aa187[_0xcc6a('0x49')];if(!_0x3aac83[_0xcc6a('0x42')][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x22adb4[_0xcc6a('0x26')]=qs[_0xcc6a('0x26')](_0x3aac83[_0xcc6a('0x42')][_0xcc6a('0x26')]);_0x22adb4[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x3aac83[_0xcc6a('0x42')][_0xcc6a('0x24')]);}return _0x2d1013['getAgents'](_0x22adb4);}})['then'](function(_0xd98f07){if(_0xd98f07){return _0xd98f07?{'count':_0x4ddd55,'rows':_0xd98f07}:null;}})[_0xcc6a('0x2d')](respondWithResult(_0x516287,null))[_0xcc6a('0x59')](handleError(_0x516287,null));};exports[_0xcc6a('0xa0')]=function(_0x145679,_0x437c9b,_0x4f7c3a){var _0x176e07={};var _0x14d861={};var _0x4b0a43;var _0x1df6ff;return db[_0xcc6a('0x3f')][_0xcc6a('0x66')]({'where':{'id':_0x145679['params']['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x437c9b,null))['then'](function(_0x24aa0f){if(_0x24aa0f){_0x4b0a43=_0x24aa0f;_0x14d861[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x81')][_0xcc6a('0x58')]);_0x14d861[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x145679[_0xcc6a('0x42')]);_0x14d861[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x14d861[_0xcc6a('0x46')],_0x14d861[_0xcc6a('0x42')]);_0x176e07['attributes']=_[_0xcc6a('0x45')](_0x14d861[_0xcc6a('0x46')],qs['fields'](_0x145679[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x176e07[_0xcc6a('0x47')]=_0x176e07[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0x176e07[_0xcc6a('0x47')]:_0x14d861[_0xcc6a('0x46')];_0x176e07[_0xcc6a('0x6a')]=qs[_0xcc6a('0x4c')](_0x145679[_0xcc6a('0x42')][_0xcc6a('0x4c')]);_0x176e07['where']=qs['filters'](_[_0xcc6a('0x4e')](_0x145679['query'],_0x14d861[_0xcc6a('0x44')]));if(_0x145679[_0xcc6a('0x42')][_0xcc6a('0x34')]){_0x176e07['where']=_[_0xcc6a('0x4f')](_0x176e07[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x176e07[_0xcc6a('0x47')],function(_0x1aef1a){var _0x1dd383={};_0x1dd383[_0x1aef1a]={'$like':'%'+_0x145679[_0xcc6a('0x42')][_0xcc6a('0x34')]+'%'};return _0x1dd383;})});}_0x176e07=_['merge']({},_0x176e07,_0x145679[_0xcc6a('0x51')]);return _0x4b0a43[_0xcc6a('0xa0')](_0x176e07);}})[_0xcc6a('0x2d')](function(_0x263293){if(_0x263293){_0x1df6ff=_0x263293[_0xcc6a('0x49')];if(!_0x145679['query'][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x176e07[_0xcc6a('0x26')]=qs['limit'](_0x145679[_0xcc6a('0x42')]['limit']);_0x176e07[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x145679[_0xcc6a('0x42')][_0xcc6a('0x24')]);}return _0x4b0a43[_0xcc6a('0xa0')](_0x176e07);}})[_0xcc6a('0x2d')](function(_0x57efd1){return _0x57efd1?{'count':_0x1df6ff,'rows':_0x57efd1}:null;})[_0xcc6a('0x2d')](respondWithResult(_0x437c9b,null))[_0xcc6a('0x59')](handleError(_0x437c9b,null));};exports['getLists']=function(_0xdf0e0d,_0x375d00,_0x456adf){var _0x3eae4f={};var _0x563af2={};var _0xfb564b;var _0x15d7dc;return db[_0xcc6a('0x3f')]['findOne']({'where':{'id':_0xdf0e0d[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x375d00,null))[_0xcc6a('0x2d')](function(_0x467185){if(_0x467185){_0xfb564b=_0x467185;_0x563af2[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0xa1')][_0xcc6a('0x58')]);_0x563af2['query']=_[_0xcc6a('0x43')](_0xdf0e0d[_0xcc6a('0x42')]);_0x563af2[_0xcc6a('0x44')]=_['intersection'](_0x563af2[_0xcc6a('0x46')],_0x563af2[_0xcc6a('0x42')]);_0x3eae4f[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x563af2['model'],qs[_0xcc6a('0x48')](_0xdf0e0d[_0xcc6a('0x42')]['fields']));_0x3eae4f[_0xcc6a('0x47')]=_0x3eae4f[_0xcc6a('0x47')]['length']?_0x3eae4f[_0xcc6a('0x47')]:_0x563af2[_0xcc6a('0x46')];_0x3eae4f[_0xcc6a('0x6a')]=qs[_0xcc6a('0x4c')](_0xdf0e0d['query'][_0xcc6a('0x4c')]);_0x3eae4f[_0xcc6a('0x4d')]=qs[_0xcc6a('0x44')](_[_0xcc6a('0x4e')](_0xdf0e0d['query'],_0x563af2[_0xcc6a('0x44')]));if(_0xdf0e0d['query'][_0xcc6a('0x34')]){_0x3eae4f[_0xcc6a('0x4d')]=_[_0xcc6a('0x4f')](_0x3eae4f[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x3eae4f[_0xcc6a('0x47')],function(_0x44d2f7){var _0x591c58={};_0x591c58[_0x44d2f7]={'$like':'%'+_0xdf0e0d[_0xcc6a('0x42')][_0xcc6a('0x34')]+'%'};return _0x591c58;})});}_0x3eae4f=_[_0xcc6a('0x4f')]({},_0x3eae4f,_0xdf0e0d[_0xcc6a('0x51')]);return _0xfb564b[_0xcc6a('0xa2')](_0x3eae4f);}})[_0xcc6a('0x2d')](function(_0x39f877){if(_0x39f877){_0x15d7dc=_0x39f877[_0xcc6a('0x49')];if(!_0xdf0e0d[_0xcc6a('0x42')][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x3eae4f['limit']=qs['limit'](_0xdf0e0d[_0xcc6a('0x42')][_0xcc6a('0x26')]);_0x3eae4f[_0xcc6a('0x24')]=qs['offset'](_0xdf0e0d[_0xcc6a('0x42')][_0xcc6a('0x24')]);}return _0xfb564b['getLists'](_0x3eae4f);}})['then'](function(_0x4fa9b9){if(_0x4fa9b9){return _0x4fa9b9?{'count':_0x15d7dc,'rows':_0x4fa9b9}:null;}})['then'](respondWithResult(_0x375d00,null))['catch'](handleError(_0x375d00,null));};exports[_0xcc6a('0xa3')]=function(_0x34b277,_0x3c6f18,_0x181e0b){var _0x21715f=moment()[_0xcc6a('0x84')](_0xcc6a('0xa4'));var _0x4731ab,_0x1feb54;return db[_0xcc6a('0x3f')][_0xcc6a('0x38')]({'where':{'id':_0x34b277['params']['id']}})['then'](handleEntityNotFound(_0x3c6f18,null))[_0xcc6a('0x2d')](function(_0x464e5f){if(_0x464e5f){_0x1feb54=_0x464e5f;return _0x464e5f[_0xcc6a('0xa3')](_0x34b277[_0xcc6a('0x63')]['ids'],_[_0xcc6a('0x62')](_0x34b277['body'],[_0xcc6a('0x89'),'id'])||{});}return null;})[_0xcc6a('0xa5')](function(_0x518e8d){var _0x136e91;_0x4731ab=_0x518e8d||[];var _0x470c63=[];if(_0x518e8d){for(var _0x340c66=0x0;_0x340c66<_0x518e8d[_0xcc6a('0x49')];_0x340c66+=0x1){var _0xba6271=_0x518e8d[_0x340c66][_0xcc6a('0x2f')]({'plain':!![]});_0x1feb54[_0xcc6a('0xa6')]=_0x34b277[_0xcc6a('0x63')][_0xcc6a('0xa6')]?_0x34b277[_0xcc6a('0x63')][_0xcc6a('0xa6')]:_0x1feb54[_0xcc6a('0xa6')];switch(_0x1feb54[_0xcc6a('0xa6')]){case _0xcc6a('0xa7'):_0x136e91=squel[_0xcc6a('0xa8')]()['into']('cm_hopper')[_0xcc6a('0xa9')]([_0xcc6a('0xaa'),'scheduledAt',_0xcc6a('0xab'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xcc6a('0x8a')]()['field'](_0xcc6a('0xaa'),_0xcc6a('0xaa'))[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27','scheduledAt')['field']('id',_0xcc6a('0xab'))['field'](_0xba6271[_0xcc6a('0xac')][_0xcc6a('0x93')](),_0xcc6a('0xad'))['field'](_0x34b277['params']['id'][_0xcc6a('0x93')](),_0xcc6a('0x68'))[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27',_0xcc6a('0x64'))['field']('\x27'+_0x21715f+'\x27',_0xcc6a('0xae'))[_0xcc6a('0x8d')](_0xcc6a('0xaf'))[_0xcc6a('0x4d')](_0xcc6a('0xb0'))[_0xcc6a('0x4d')](_0xcc6a('0xb1'),_0xba6271[_0xcc6a('0xac')][_0xcc6a('0x93')]())['where'](_0xcc6a('0xb2'))[_0xcc6a('0x4d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x8a')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xcc6a('0x8d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x34b277['params']['id'][_0xcc6a('0x93')]()))[_0xcc6a('0x4d')]('phone\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x8a')]()['field'](_0xcc6a('0xb3'))[_0xcc6a('0x8d')](_0xcc6a('0xb4'))[_0xcc6a('0x4d')]('VoiceQueueId\x20=\x20?',_0x34b277[_0xcc6a('0x57')]['id'][_0xcc6a('0x93')]())))[_0xcc6a('0x93')]();break;case _0xcc6a('0xb5'):_0x136e91=squel[_0xcc6a('0xa8')]()[_0xcc6a('0xb6')](_0xcc6a('0xb4'))[_0xcc6a('0xa9')](['phone',_0xcc6a('0xb7'),_0xcc6a('0xab'),_0xcc6a('0xad'),_0xcc6a('0x68'),'createdAt','updatedAt'],squel['select']()[_0xcc6a('0x8b')]('phone',_0xcc6a('0xaa'))[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27','scheduledAt')[_0xcc6a('0x8b')]('id','ContactId')[_0xcc6a('0x8b')](_0xba6271['CmListId'][_0xcc6a('0x93')](),_0xcc6a('0xad'))['field'](_0x34b277['params']['id'][_0xcc6a('0x93')](),_0xcc6a('0x68'))[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27',_0xcc6a('0x64'))[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27',_0xcc6a('0xae'))['from'](_0xcc6a('0xaf'))[_0xcc6a('0x4d')]('deletedAt\x20IS\x20NULL')[_0xcc6a('0x4d')](_0xcc6a('0xb1'),_0xba6271[_0xcc6a('0xac')][_0xcc6a('0x93')]())[_0xcc6a('0x4d')](_0xcc6a('0xb2'))[_0xcc6a('0x4d')](_0xcc6a('0xb8'),squel[_0xcc6a('0x8a')]()[_0xcc6a('0x8b')](_0xcc6a('0xb3'))[_0xcc6a('0x8d')](_0xcc6a('0xb4'))[_0xcc6a('0x4d')](_0xcc6a('0xb9'),_0x34b277[_0xcc6a('0x57')]['id'][_0xcc6a('0x93')]())))[_0xcc6a('0x93')]();break;default:_0x136e91=squel[_0xcc6a('0xa8')]()[_0xcc6a('0xb6')](_0xcc6a('0xb4'))[_0xcc6a('0xa9')](['phone',_0xcc6a('0xb7'),_0xcc6a('0xab'),'ListId','VoiceQueueId',_0xcc6a('0x64'),_0xcc6a('0xae')],squel[_0xcc6a('0x8a')]()[_0xcc6a('0x8b')](_0xcc6a('0xaa'),_0xcc6a('0xaa'))[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27',_0xcc6a('0xb7'))[_0xcc6a('0x8b')]('id','ContactId')[_0xcc6a('0x8b')](_0xba6271[_0xcc6a('0xac')][_0xcc6a('0x93')](),_0xcc6a('0xad'))[_0xcc6a('0x8b')](_0x34b277[_0xcc6a('0x57')]['id'][_0xcc6a('0x93')](),_0xcc6a('0x68'))[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27','createdAt')[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27',_0xcc6a('0xae'))[_0xcc6a('0x8d')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xcc6a('0x4d')](_0xcc6a('0xb1'),_0xba6271[_0xcc6a('0xac')][_0xcc6a('0x93')]())[_0xcc6a('0x4d')]('phone\x20IS\x20NOT\x20NULL'))[_0xcc6a('0x93')]();}_0x470c63[_0xcc6a('0xba')](db[_0xcc6a('0x79')][_0xcc6a('0x42')](_0x136e91));}return BPromise['all'](_0x470c63);}})[_0xcc6a('0x2d')](function(){var _0x3c6c4c=[];var _0x235472=squel[_0xcc6a('0xa8')]()[_0xcc6a('0xb6')](_0xcc6a('0xbb'))[_0xcc6a('0xa9')](['CmHopperId',_0xcc6a('0xaa'),_0xcc6a('0xbc'),_0xcc6a('0x64'),_0xcc6a('0xae')],squel[_0xcc6a('0x8a')]()['field'](_0xcc6a('0xbd'))['field'](_0xcc6a('0xbe'))[_0xcc6a('0x8b')](_0xcc6a('0xbf'))[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27','createdAt')[_0xcc6a('0x8b')]('\x27'+_0x21715f+'\x27',_0xcc6a('0xae'))[_0xcc6a('0x8d')](_0xcc6a('0xc0'),'ci')[_0xcc6a('0x8f')](_0xcc6a('0xb4'),'h','h.ContactId=ci.CmContactId')[_0xcc6a('0x4d')](_0xcc6a('0xc1'),_0x21715f)[_0xcc6a('0x4d')]('ci.ItemClass=?','PHONE'))[_0xcc6a('0x93')]();_0x3c6c4c['push'](db[_0xcc6a('0x79')]['query'](_0x235472));return BPromise['all'](_0x3c6c4c);})[_0xcc6a('0x2d')](function(){return _0x4731ab;})[_0xcc6a('0x2d')](respondWithResult(_0x3c6f18,null))[_0xcc6a('0x59')](handleError(_0x3c6f18,null));};exports[_0xcc6a('0xc2')]=function(_0x539858,_0x566988,_0x46385a){return db[_0xcc6a('0x3f')]['find']({'where':{'id':_0x539858[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x566988,null))[_0xcc6a('0x2d')](function(_0x9cc943){if(_0x9cc943){return _0x9cc943[_0xcc6a('0xc2')](_0x539858[_0xcc6a('0x42')][_0xcc6a('0x89')]);}})[_0xcc6a('0x2d')](function(_0x16c8f3){if(_0x16c8f3){return db[_0xcc6a('0x67')][_0xcc6a('0x2e')]({'where':{'ListId':_0x539858[_0xcc6a('0x42')][_0xcc6a('0x89')],'VoiceQueueId':_0x539858[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](function(){return _0x16c8f3;});}})['then'](respondWithStatusCode(_0x566988,null))[_0xcc6a('0x59')](handleError(_0x566988,null));};exports['getBlackLists']=function(_0x591916,_0x248673,_0x2daa32){var _0x574475={};var _0x595382={};var _0x588783;var _0x3d43d2;return db['VoiceQueue'][_0xcc6a('0x66')]({'where':{'id':_0x591916[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x248673,null))['then'](function(_0x36f5f6){if(_0x36f5f6){_0x588783=_0x36f5f6;_0x595382[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0xa1')][_0xcc6a('0x58')]);_0x595382[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x591916[_0xcc6a('0x42')]);_0x595382[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x595382[_0xcc6a('0x46')],_0x595382['query']);_0x574475[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x595382[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x591916[_0xcc6a('0x42')]['fields']));_0x574475[_0xcc6a('0x47')]=_0x574475[_0xcc6a('0x47')]['length']?_0x574475[_0xcc6a('0x47')]:_0x595382[_0xcc6a('0x46')];_0x574475[_0xcc6a('0x6a')]=qs['sort'](_0x591916[_0xcc6a('0x42')][_0xcc6a('0x4c')]);_0x574475[_0xcc6a('0x4d')]=qs[_0xcc6a('0x44')](_[_0xcc6a('0x4e')](_0x591916[_0xcc6a('0x42')],_0x595382[_0xcc6a('0x44')]));if(_0x591916[_0xcc6a('0x42')][_0xcc6a('0x34')]){_0x574475[_0xcc6a('0x4d')]=_[_0xcc6a('0x4f')](_0x574475[_0xcc6a('0x4d')],{'$or':_[_0xcc6a('0x36')](_0x574475[_0xcc6a('0x47')],function(_0x117093){var _0x269e19={};_0x269e19[_0x117093]={'$like':'%'+_0x591916[_0xcc6a('0x42')][_0xcc6a('0x34')]+'%'};return _0x269e19;})});}_0x574475=_['merge']({},_0x574475,_0x591916[_0xcc6a('0x51')]);return _0x588783['getBlackLists'](_0x574475);}})[_0xcc6a('0x2d')](function(_0x1e23b4){if(_0x1e23b4){_0x3d43d2=_0x1e23b4['length'];if(!_0x591916[_0xcc6a('0x42')][_0xcc6a('0x4a')]('nolimit')){_0x574475['limit']=qs[_0xcc6a('0x26')](_0x591916[_0xcc6a('0x42')][_0xcc6a('0x26')]);_0x574475[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x591916['query'][_0xcc6a('0x24')]);}return _0x588783[_0xcc6a('0xc3')](_0x574475);}})['then'](function(_0x10e9ec){if(_0x10e9ec){return _0x10e9ec?{'count':_0x3d43d2,'rows':_0x10e9ec}:null;}})['then'](respondWithResult(_0x248673,null))['catch'](handleError(_0x248673,null));};exports[_0xcc6a('0xc4')]=function(_0x4347d1,_0x6506e7,_0x3ea8d3){var _0x1d016c,_0x4aff44;return db['VoiceQueue']['find']({'where':{'id':_0x4347d1[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x6506e7,null))[_0xcc6a('0x2d')](function(_0x134999){if(_0x134999){_0x4aff44=_0x134999;return _0x134999[_0xcc6a('0xc4')](_0x4347d1[_0xcc6a('0x63')]['ids'],_[_0xcc6a('0x62')](_0x4347d1[_0xcc6a('0x63')],[_0xcc6a('0x89'),'id'])||{});}return null;})[_0xcc6a('0xa5')](function(_0xed0317){var _0x182287;_0x1d016c=_0xed0317||[];var _0x28489=[];if(_0xed0317){for(var _0x4da31b=0x0;_0x4da31b<_0xed0317[_0xcc6a('0x49')];_0x4da31b+=0x1){var _0x1615ab=_0xed0317[_0x4da31b][_0xcc6a('0x2f')]({'plain':!![]});_0x182287=squel[_0xcc6a('0xa8')]()['into']('cm_hopper_black')['fromQuery']([_0xcc6a('0xaa'),'ContactId',_0xcc6a('0xad'),'VoiceQueueId',_0xcc6a('0x64'),_0xcc6a('0xae')],squel['select']()[_0xcc6a('0x8b')](_0xcc6a('0xaa'),'phone')[_0xcc6a('0x8b')]('id',_0xcc6a('0xab'))[_0xcc6a('0x8b')](_0x1615ab[_0xcc6a('0xac')]['toString'](),_0xcc6a('0xad'))[_0xcc6a('0x8b')](_0x4347d1[_0xcc6a('0x57')]['id'][_0xcc6a('0x93')](),'VoiceQueueId')[_0xcc6a('0x8b')](_0xcc6a('0xc5'),_0xcc6a('0x64'))['field']('NOW()',_0xcc6a('0xae'))[_0xcc6a('0x8d')](_0xcc6a('0xaf'))['where'](_0xcc6a('0xb0'))['where'](_0xcc6a('0xb1'),_0x1615ab['CmListId'][_0xcc6a('0x93')]())[_0xcc6a('0x4d')]('phone\x20IS\x20NOT\x20NULL'))[_0xcc6a('0x93')]();_0x28489[_0xcc6a('0xba')](db[_0xcc6a('0x79')][_0xcc6a('0x42')](_0x182287));}return BPromise[_0xcc6a('0x98')](_0x28489);}})[_0xcc6a('0x2d')](function(){return _0x1d016c;})[_0xcc6a('0x2d')](respondWithResult(_0x6506e7,null))[_0xcc6a('0x59')](handleError(_0x6506e7,null));};exports[_0xcc6a('0xc6')]=function(_0x451fd5,_0x107bdc,_0xaa650e){return db[_0xcc6a('0x3f')][_0xcc6a('0x38')]({'where':{'id':_0x451fd5[_0xcc6a('0x57')]['id']}})[_0xcc6a('0x2d')](handleEntityNotFound(_0x107bdc,null))['then'](function(_0x34e332){if(_0x34e332){return _0x34e332[_0xcc6a('0xc6')](_0x451fd5[_0xcc6a('0x42')][_0xcc6a('0x89')]);}})['then'](function(_0x24f49d){if(_0x24f49d){return db[_0xcc6a('0x6e')][_0xcc6a('0x2e')]({'where':{'ListId':_0x451fd5['query']['ids'],'VoiceQueueId':_0x451fd5[_0xcc6a('0x57')]['id']}})['then'](function(){return _0x24f49d;});}})[_0xcc6a('0x2d')](respondWithStatusCode(_0x107bdc,null))[_0xcc6a('0x59')](handleError(_0x107bdc,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2c6a9f7..250b634 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 _0xe559=['VoiceQueue','setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x43b150,_0x109558){var _0xe7aec9=function(_0x553c54){while(--_0x553c54){_0x43b150['push'](_0x43b150['shift']());}};_0xe7aec9(++_0x109558);}(_0xe559,0x8e));var _0x9e55=function(_0x4ae0ec,_0x589587){_0x4ae0ec=_0x4ae0ec-0x0;var _0x1ab6c5=_0xe559[_0x4ae0ec];return _0x1ab6c5;};'use strict';var EventEmitter=require(_0x9e55('0x0'));var VoiceQueue=require(_0x9e55('0x1'))['db'][_0x9e55('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9e55('0x3')](0x0);var events={'afterCreate':_0x9e55('0x4'),'afterUpdate':'update','afterDestroy':_0x9e55('0x5')};function emitEvent(_0x4eb62a){return function(_0x54b484,_0x1772ad,_0xff2780){VoiceQueueEvents[_0x9e55('0x6')](_0x4eb62a+':'+_0x54b484['id'],_0x54b484);VoiceQueueEvents[_0x9e55('0x6')](_0x4eb62a,_0x54b484);_0xff2780(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x9e55('0x7')](e,emitEvent(event));}}module[_0x9e55('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x7d42=['emit','hasOwnProperty','hook','exports','setMaxListeners','save','remove'];(function(_0x4121e5,_0x11f15a){var _0x338a08=function(_0x44e908){while(--_0x44e908){_0x4121e5['push'](_0x4121e5['shift']());}};_0x338a08(++_0x11f15a);}(_0x7d42,0x66));var _0x27d4=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7d42[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x27d4('0x0')](0x0);var events={'afterCreate':_0x27d4('0x1'),'afterUpdate':'update','afterDestroy':_0x27d4('0x2')};function emitEvent(_0x14cbba){return function(_0x4761e8,_0x43550f,_0x1aba9b){VoiceQueueEvents[_0x27d4('0x3')](_0x14cbba+':'+_0x4761e8['id'],_0x4761e8);VoiceQueueEvents['emit'](_0x14cbba,_0x4761e8);_0x1aba9b(null);};}for(var e in events){if(events[_0x27d4('0x4')](e)){var event=events[e];VoiceQueue[_0x27d4('0x5')](e,emitEvent(event));}}module[_0x27d4('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0757608..ada11a6 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x40fa00,_0x1fbb3f){var _0x2f2426=function(_0x18e6ee){while(--_0x18e6ee){_0x40fa00['push'](_0x40fa00['shift']());}};_0x2f2426(++_0x1fbb3f);}(_0x70e0,0x17b));var _0x070e=function(_0x185790,_0x5d0393){_0x185790=_0x185790-0x0;var _0x4e9074=_0x70e0[_0x185790];return _0x4e9074;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x28c959,_0x536acc){var _0x10cde3=function(_0x35c3f0){while(--_0x35c3f0){_0x28c959['push'](_0x28c959['shift']());}};_0x10cde3(++_0x536acc);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 77ae6a1..b6183db 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 _0x8071=['model','GetVoiceQueue','debug','ShowVoiceQueue','find','where','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','request','then','info','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','include','map'];(function(_0x3dc85,_0x4f2d39){var _0x3e938e=function(_0xbd5b55){while(--_0xbd5b55){_0x3dc85['push'](_0x3dc85['shift']());}};_0x3e938e(++_0x4f2d39);}(_0x8071,0x1da));var _0x1807=function(_0x45ff2d,_0x4b785f){_0x45ff2d=_0x45ff2d-0x0;var _0x343f00=_0x8071[_0x45ff2d];return _0x343f00;};'use strict';var _=require(_0x1807('0x0'));var util=require(_0x1807('0x1'));var moment=require(_0x1807('0x2'));var BPromise=require(_0x1807('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1807('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1807('0x5'));var logger=require('../../config/logger')(_0x1807('0x6'));var config=require(_0x1807('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1807('0x8')][_0x1807('0x9')]({'port':0x232a});config['redis']=_[_0x1807('0xa')](config['redis'],{'host':_0x1807('0xb'),'port':0x18eb});var socket=require(_0x1807('0xc'))(new Redis(config[_0x1807('0xd')]));require(_0x1807('0xe'))[_0x1807('0xf')](socket);function respondWithRpcPromise(_0x51db72,_0x35d930,_0x4a9fb2){return new BPromise(function(_0x419bbb,_0x249b3f){return client[_0x1807('0x10')](_0x51db72,_0x4a9fb2)[_0x1807('0x11')](function(_0x4d603a){logger[_0x1807('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x35d930,_0x1807('0x13'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x35d930,_0x1807('0x13'),JSON[_0x1807('0x14')](_0x4d603a));if(_0x4d603a[_0x1807('0x15')]){if(_0x4d603a['error'][_0x1807('0x16')]===0x1f4){logger[_0x1807('0x15')](_0x1807('0x17'),_0x35d930,_0x4d603a[_0x1807('0x15')][_0x1807('0x18')]);return _0x249b3f(_0x4d603a[_0x1807('0x15')][_0x1807('0x18')]);}logger[_0x1807('0x15')](_0x1807('0x17'),_0x35d930,_0x4d603a['error'][_0x1807('0x18')]);return _0x419bbb(_0x4d603a[_0x1807('0x15')][_0x1807('0x18')]);}else{logger['info'](_0x1807('0x17'),_0x35d930,_0x1807('0x13'));_0x419bbb(_0x4d603a[_0x1807('0x19')][_0x1807('0x18')]);}})[_0x1807('0x1a')](function(_0x375cb3){logger[_0x1807('0x15')](_0x1807('0x17'),_0x35d930,_0x375cb3);_0x249b3f(_0x375cb3);});});}exports['GetVoiceQueue']=function(_0x36647e){var _0x51096f=this;return new Promise(function(_0x58bd35,_0x4664db){return db['VoiceQueue'][_0x1807('0x1b')]({'raw':_0x36647e[_0x1807('0x1c')]?_0x36647e[_0x1807('0x1c')][_0x1807('0x1d')]===undefined?!![]:![]:!![],'where':_0x36647e[_0x1807('0x1c')]?_0x36647e[_0x1807('0x1c')]['where']||null:null,'attributes':_0x36647e['options']?_0x36647e[_0x1807('0x1c')][_0x1807('0x1e')]||null:null,'limit':_0x36647e[_0x1807('0x1c')]?_0x36647e[_0x1807('0x1c')]['limit']||null:null,'include':_0x36647e['options']?_0x36647e[_0x1807('0x1c')][_0x1807('0x1f')]?_[_0x1807('0x20')](_0x36647e['options']['include'],function(_0x44b702){return{'model':db[_0x44b702[_0x1807('0x21')]],'as':_0x44b702['as'],'attributes':_0x44b702['attributes'],'include':_0x44b702[_0x1807('0x1f')]?_[_0x1807('0x20')](_0x44b702[_0x1807('0x1f')],function(_0x4cda5e){return{'model':db[_0x4cda5e[_0x1807('0x21')]],'as':_0x4cda5e['as'],'attributes':_0x4cda5e[_0x1807('0x1e')],'include':_0x4cda5e[_0x1807('0x1f')]?_[_0x1807('0x20')](_0x4cda5e[_0x1807('0x1f')],function(_0x10c180){return{'model':db[_0x10c180[_0x1807('0x21')]],'as':_0x10c180['as'],'attributes':_0x10c180[_0x1807('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1807('0x11')](function(_0x2c7b68){logger[_0x1807('0x12')](_0x1807('0x22'),_0x36647e);logger[_0x1807('0x23')](_0x1807('0x22'),_0x36647e,JSON[_0x1807('0x14')](_0x2c7b68));_0x58bd35(_0x2c7b68);})[_0x1807('0x1a')](function(_0x221816){logger[_0x1807('0x15')]('GetVoiceQueue',_0x221816[_0x1807('0x18')],_0x36647e);_0x4664db(_0x51096f[_0x1807('0x15')](0x1f4,_0x221816['message']));});});};exports[_0x1807('0x24')]=function(_0xa043c){var _0x8282d6=this;return new Promise(function(_0x2f1d86,_0x4a237a){return db['VoiceQueue'][_0x1807('0x25')]({'raw':_0xa043c[_0x1807('0x1c')]?_0xa043c[_0x1807('0x1c')][_0x1807('0x1d')]===undefined?!![]:![]:!![],'where':_0xa043c[_0x1807('0x1c')]?_0xa043c[_0x1807('0x1c')][_0x1807('0x26')]||null:null,'attributes':_0xa043c[_0x1807('0x1c')]?_0xa043c['options'][_0x1807('0x1e')]||null:null,'include':_0xa043c[_0x1807('0x1c')]?_0xa043c['options'][_0x1807('0x1f')]?_[_0x1807('0x20')](_0xa043c[_0x1807('0x1c')][_0x1807('0x1f')],function(_0xd1258c){return{'model':db[_0xd1258c['model']],'as':_0xd1258c['as'],'attributes':_0xd1258c[_0x1807('0x1e')],'include':_0xd1258c['include']?_[_0x1807('0x20')](_0xd1258c[_0x1807('0x1f')],function(_0x2ab1a3){return{'model':db[_0x2ab1a3[_0x1807('0x21')]],'as':_0x2ab1a3['as'],'attributes':_0x2ab1a3[_0x1807('0x1e')],'include':_0x2ab1a3[_0x1807('0x1f')]?_['map'](_0x2ab1a3[_0x1807('0x1f')],function(_0x3e1d43){return{'model':db[_0x3e1d43[_0x1807('0x21')]],'as':_0x3e1d43['as'],'attributes':_0x3e1d43[_0x1807('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1807('0x11')](function(_0x372a1f){logger[_0x1807('0x12')](_0x1807('0x24'),_0xa043c);logger['debug'](_0x1807('0x24'),_0xa043c,JSON['stringify'](_0x372a1f));_0x2f1d86(_0x372a1f);})['catch'](function(_0x5e017e){logger['error'](_0x1807('0x24'),_0x5e017e[_0x1807('0x18')],_0xa043c);_0x4a237a(_0x8282d6['error'](0x1f4,_0x5e017e[_0x1807('0x18')]));});});}; \ No newline at end of file +var _0x9140=['GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x9140,0x1d4));var _0x0914=function(_0x569ed1,_0x516704){_0x569ed1=_0x569ed1-0x0;var _0x262a0b=_0x9140[_0x569ed1];return _0x262a0b;};'use strict';var _=require(_0x0914('0x0'));var util=require('util');var moment=require(_0x0914('0x1'));var BPromise=require(_0x0914('0x2'));var rs=require(_0x0914('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0914('0x4'))['db'];var utils=require(_0x0914('0x5'));var logger=require('../../config/logger')(_0x0914('0x6'));var config=require(_0x0914('0x7'));var jayson=require(_0x0914('0x8'));var client=jayson['client'][_0x0914('0x9')]({'port':0x232a});config[_0x0914('0xa')]=_['defaults'](config[_0x0914('0xa')],{'host':_0x0914('0xb'),'port':0x18eb});var socket=require(_0x0914('0xc'))(new Redis(config[_0x0914('0xa')]));require('./voiceQueue.socket')[_0x0914('0xd')](socket);function respondWithRpcPromise(_0x4e5075,_0x577cc1,_0x53e35a){return new BPromise(function(_0x543636,_0x49788b){return client[_0x0914('0xe')](_0x4e5075,_0x53e35a)[_0x0914('0xf')](function(_0x244e00){logger[_0x0914('0x10')](_0x0914('0x11'),_0x577cc1,'request\x20sent');logger[_0x0914('0x12')](_0x0914('0x13'),_0x577cc1,_0x0914('0x14'),JSON[_0x0914('0x15')](_0x244e00));if(_0x244e00[_0x0914('0x16')]){if(_0x244e00[_0x0914('0x16')]['code']===0x1f4){logger[_0x0914('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x577cc1,_0x244e00['error'][_0x0914('0x17')]);return _0x49788b(_0x244e00[_0x0914('0x16')]['message']);}logger[_0x0914('0x16')](_0x0914('0x11'),_0x577cc1,_0x244e00[_0x0914('0x16')][_0x0914('0x17')]);return _0x543636(_0x244e00['error'][_0x0914('0x17')]);}else{logger[_0x0914('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x577cc1,_0x0914('0x14'));_0x543636(_0x244e00[_0x0914('0x18')][_0x0914('0x17')]);}})[_0x0914('0x19')](function(_0x15282d){logger[_0x0914('0x16')](_0x0914('0x11'),_0x577cc1,_0x15282d);_0x49788b(_0x15282d);});});}exports[_0x0914('0x1a')]=function(_0x124377){var _0x127dc0=this;return new Promise(function(_0x164ae3,_0x47db0f){return db['VoiceQueue'][_0x0914('0x1b')]({'raw':_0x124377[_0x0914('0x1c')]?_0x124377[_0x0914('0x1c')][_0x0914('0x1d')]===undefined?!![]:![]:!![],'where':_0x124377[_0x0914('0x1c')]?_0x124377['options'][_0x0914('0x1e')]||null:null,'attributes':_0x124377[_0x0914('0x1c')]?_0x124377[_0x0914('0x1c')][_0x0914('0x1f')]||null:null,'limit':_0x124377[_0x0914('0x1c')]?_0x124377['options'][_0x0914('0x20')]||null:null,'include':_0x124377[_0x0914('0x1c')]?_0x124377[_0x0914('0x1c')][_0x0914('0x21')]?_[_0x0914('0x22')](_0x124377[_0x0914('0x1c')][_0x0914('0x21')],function(_0x21e68b){return{'model':db[_0x21e68b[_0x0914('0x23')]],'as':_0x21e68b['as'],'attributes':_0x21e68b[_0x0914('0x1f')],'include':_0x21e68b[_0x0914('0x21')]?_['map'](_0x21e68b[_0x0914('0x21')],function(_0x4396cd){return{'model':db[_0x4396cd[_0x0914('0x23')]],'as':_0x4396cd['as'],'attributes':_0x4396cd[_0x0914('0x1f')],'include':_0x4396cd['include']?_[_0x0914('0x22')](_0x4396cd[_0x0914('0x21')],function(_0x20d0ff){return{'model':db[_0x20d0ff[_0x0914('0x23')]],'as':_0x20d0ff['as'],'attributes':_0x20d0ff['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b9d43){logger[_0x0914('0x10')](_0x0914('0x1a'),_0x124377);logger[_0x0914('0x12')](_0x0914('0x1a'),_0x124377,JSON[_0x0914('0x15')](_0x4b9d43));_0x164ae3(_0x4b9d43);})[_0x0914('0x19')](function(_0x304af4){logger[_0x0914('0x16')](_0x0914('0x1a'),_0x304af4[_0x0914('0x17')],_0x124377);_0x47db0f(_0x127dc0['error'](0x1f4,_0x304af4[_0x0914('0x17')]));});});};exports[_0x0914('0x24')]=function(_0x321bec){var _0x204dbf=this;return new Promise(function(_0x5a48a1,_0x4918d6){return db['VoiceQueue'][_0x0914('0x25')]({'raw':_0x321bec[_0x0914('0x1c')]?_0x321bec[_0x0914('0x1c')][_0x0914('0x1d')]===undefined?!![]:![]:!![],'where':_0x321bec[_0x0914('0x1c')]?_0x321bec[_0x0914('0x1c')][_0x0914('0x1e')]||null:null,'attributes':_0x321bec['options']?_0x321bec['options'][_0x0914('0x1f')]||null:null,'include':_0x321bec[_0x0914('0x1c')]?_0x321bec[_0x0914('0x1c')]['include']?_[_0x0914('0x22')](_0x321bec[_0x0914('0x1c')][_0x0914('0x21')],function(_0x43792e){return{'model':db[_0x43792e[_0x0914('0x23')]],'as':_0x43792e['as'],'attributes':_0x43792e['attributes'],'include':_0x43792e[_0x0914('0x21')]?_[_0x0914('0x22')](_0x43792e[_0x0914('0x21')],function(_0x521171){return{'model':db[_0x521171[_0x0914('0x23')]],'as':_0x521171['as'],'attributes':_0x521171['attributes'],'include':_0x521171[_0x0914('0x21')]?_[_0x0914('0x22')](_0x521171['include'],function(_0x4fd307){return{'model':db[_0x4fd307[_0x0914('0x23')]],'as':_0x4fd307['as'],'attributes':_0x4fd307['attributes']};}):[]};}):[]};}):[]:[]})[_0x0914('0xf')](function(_0x3d8c3d){logger[_0x0914('0x10')](_0x0914('0x24'),_0x321bec);logger[_0x0914('0x12')](_0x0914('0x24'),_0x321bec,JSON[_0x0914('0x15')](_0x3d8c3d));_0x5a48a1(_0x3d8c3d);})['catch'](function(_0x354385){logger[_0x0914('0x16')]('ShowVoiceQueue',_0x354385[_0x0914('0x17')],_0x321bec);_0x4918d6(_0x204dbf[_0x0914('0x16')](0x1f4,_0x354385[_0x0914('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ccb009d..627962f 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 _0x4245=['./voiceQueue.events','save','remove','emit','removeListener','register','length','voiceQueue:'];(function(_0x29385e,_0x128792){var _0x15b273=function(_0x435639){while(--_0x435639){_0x29385e['push'](_0x29385e['shift']());}};_0x15b273(++_0x128792);}(_0x4245,0x1a0));var _0x5424=function(_0x5d2138,_0x2c9dde){_0x5d2138=_0x5d2138-0x0;var _0xb019f1=_0x4245[_0x5d2138];return _0xb019f1;};'use strict';var VoiceQueueEvents=require(_0x5424('0x0'));var events=[_0x5424('0x1'),_0x5424('0x2'),'update'];function createListener(_0x4ec21a,_0x7026a3){return function(_0x1d9a44){_0x7026a3[_0x5424('0x3')](_0x4ec21a,_0x1d9a44);};}function removeListener(_0x15f598,_0x535a1b){return function(){VoiceQueueEvents[_0x5424('0x4')](_0x15f598,_0x535a1b);};}exports[_0x5424('0x5')]=function(_0x4a5bbb){for(var _0x1b2062=0x0,_0x1ad055=events[_0x5424('0x6')];_0x1b2062<_0x1ad055;_0x1b2062++){var _0x4f7d72=events[_0x1b2062];var _0x40b52d=createListener(_0x5424('0x7')+_0x4f7d72,_0x4a5bbb);VoiceQueueEvents['on'](_0x4f7d72,_0x40b52d);}}; \ No newline at end of file +var _0xfbca=['removeListener','length','./voiceQueue.events','save','emit'];(function(_0x504671,_0x21f344){var _0x235cbe=function(_0x152db6){while(--_0x152db6){_0x504671['push'](_0x504671['shift']());}};_0x235cbe(++_0x21f344);}(_0xfbca,0x174));var _0xafbc=function(_0x328a63,_0x28733d){_0x328a63=_0x328a63-0x0;var _0x3c673f=_0xfbca[_0x328a63];return _0x3c673f;};'use strict';var VoiceQueueEvents=require(_0xafbc('0x0'));var events=[_0xafbc('0x1'),'remove','update'];function createListener(_0x15e9fe,_0x3e6eba){return function(_0x1ffed4){_0x3e6eba[_0xafbc('0x2')](_0x15e9fe,_0x1ffed4);};}function removeListener(_0x521652,_0x2fb3fe){return function(){VoiceQueueEvents[_0xafbc('0x3')](_0x521652,_0x2fb3fe);};}exports['register']=function(_0x4a1ff8){for(var _0x463ec5=0x0,_0x2ade8f=events[_0xafbc('0x4')];_0x463ec5<_0x2ade8f;_0x463ec5++){var _0x5110aa=events[_0x463ec5];var _0x1a771c=createListener('voiceQueue:'+_0x5110aa,_0x4a1ff8);VoiceQueueEvents['on'](_0x5110aa,_0x1a771c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ec2ff27..d3b6b24 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 _0x9a90=['update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','show','post','create','put'];(function(_0x32367d,_0x348e13){var _0x2b119a=function(_0x316a8c){while(--_0x316a8c){_0x32367d['push'](_0x32367d['shift']());}};_0x2b119a(++_0x348e13);}(_0x9a90,0x13e));var _0x09a9=function(_0x13b4e1,_0x2757e0){_0x13b4e1=_0x13b4e1-0x0;var _0x3027ae=_0x9a90[_0x13b4e1];return _0x3027ae;};'use strict';var multer=require(_0x09a9('0x0'));var util=require(_0x09a9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09a9('0x2'));var router=express['Router']();var fs_extra=require(_0x09a9('0x3'));var auth=require(_0x09a9('0x4'));var interaction=require(_0x09a9('0x5'));var config=require('../../config/environment');var controller=require(_0x09a9('0x6'));router[_0x09a9('0x7')]('/',auth[_0x09a9('0x8')](),controller[_0x09a9('0x9')]);router['get'](_0x09a9('0xa'),auth[_0x09a9('0x8')](),controller[_0x09a9('0xb')]);router[_0x09a9('0x7')]('/index',auth['isAuthenticated'](),controller[_0x09a9('0xc')]);router['get'](_0x09a9('0xd'),auth[_0x09a9('0x8')](),controller[_0x09a9('0xe')]);router[_0x09a9('0xf')]('/',auth['isAuthenticated'](),controller[_0x09a9('0x10')]);router[_0x09a9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x09a9('0x12')]);router[_0x09a9('0x13')](_0x09a9('0xd'),auth[_0x09a9('0x8')](),controller[_0x09a9('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd66c=['exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','post','put','/:id','update','destroy'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0xd66c,0xbe));var _0xcd66=function(_0x215cbb,_0x18875a){_0x215cbb=_0x215cbb-0x0;var _0x5ca86a=_0xd66c[_0x215cbb];return _0x5ca86a;};'use strict';var multer=require(_0xcd66('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcd66('0x1'));var express=require(_0xcd66('0x2'));var router=express['Router']();var fs_extra=require(_0xcd66('0x3'));var auth=require(_0xcd66('0x4'));var interaction=require(_0xcd66('0x5'));var config=require(_0xcd66('0x6'));var controller=require(_0xcd66('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcd66('0x8')]);router[_0xcd66('0x9')](_0xcd66('0xa'),auth[_0xcd66('0xb')](),controller[_0xcd66('0xc')]);router[_0xcd66('0x9')](_0xcd66('0xd'),auth[_0xcd66('0xb')](),controller[_0xcd66('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcd66('0xf')]('/',auth[_0xcd66('0xb')](),controller['create']);router[_0xcd66('0x10')](_0xcd66('0x11'),auth[_0xcd66('0xb')](),controller[_0xcd66('0x12')]);router['delete'](_0xcd66('0x11'),auth[_0xcd66('0xb')](),controller[_0xcd66('0x13')]);module[_0xcd66('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b72080c..1804717 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 _0x6949=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','sequelize'];(function(_0x49ad79,_0x48ee93){var _0xa4e38a=function(_0x4925c7){while(--_0x4925c7){_0x49ad79['push'](_0x49ad79['shift']());}};_0xa4e38a(++_0x48ee93);}(_0x6949,0xef));var _0x9694=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x6949[_0x5b740b];return _0x6f8f4e;};'use strict';var Sequelize=require(_0x9694('0x0'));var moment=require(_0x9694('0x1'));module[_0x9694('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9694('0x3')]},'calleridnum':{'type':Sequelize[_0x9694('0x3')]},'calleridname':{'type':Sequelize[_0x9694('0x3')]},'queue':{'type':Sequelize[_0x9694('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x9694('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x9694('0x4')],'set':function(_0x27a98f){var _0x5adf53=moment(_0x27a98f);var _0x5b0a52=moment(this[_0x9694('0x5')](_0x9694('0x6')))[_0x9694('0x7')](_0x9694('0x8'));var _0x4af954=_0x5adf53[_0x9694('0x9')](_0x5b0a52,_0x9694('0xa'));this[_0x9694('0xb')](_0x9694('0xc'),_0x27a98f);this['setDataValue'](_0x9694('0xd'),_0x4af954||null);}},'position':{'type':Sequelize[_0x9694('0xe')]},'count':{'type':Sequelize[_0x9694('0xe')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9694('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x9694('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9694('0x4')]},'queuecallerexit':{'type':Sequelize[_0x9694('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9694('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9694('0x3')]},'context':{'type':Sequelize[_0x9694('0x3')]},'exten':{'type':Sequelize[_0x9694('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9694('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9694('0x3')]},'transfer':{'type':Sequelize[_0x9694('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9694('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9694('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9694('0x3')]},'disposition':{'type':Sequelize[_0x9694('0x3')]},'secondDisposition':{'type':Sequelize[_0x9694('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9694('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x9694('0xe')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9694('0x3')]}}; \ No newline at end of file +var _0x8b81=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8b81,0x67));var _0x18b8=function(_0x1da4e1,_0x4b753b){_0x1da4e1=_0x1da4e1-0x0;var _0x3c8633=_0x8b81[_0x1da4e1];return _0x3c8633;};'use strict';var Sequelize=require(_0x18b8('0x0'));var moment=require(_0x18b8('0x1'));module[_0x18b8('0x2')]={'type':{'type':Sequelize[_0x18b8('0x3')]},'uniqueid':{'type':Sequelize[_0x18b8('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x18b8('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x18b8('0x4')],'set':function(_0x4ce12e){var _0x166419=moment(_0x4ce12e);var _0x3c16c7=moment(this[_0x18b8('0x5')]('queuecallerjoinAt'))['format'](_0x18b8('0x6'));var _0x590c71=_0x166419[_0x18b8('0x7')](_0x3c16c7,_0x18b8('0x8'));this[_0x18b8('0x9')](_0x18b8('0xa'),_0x4ce12e);this['setDataValue'](_0x18b8('0xb'),_0x590c71||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x18b8('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x18b8('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x18b8('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x18b8('0x4')]},'queuecallerexit':{'type':Sequelize[_0x18b8('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x18b8('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x18b8('0x3')],'comment':_0x18b8('0xe')},'originalposition':{'type':Sequelize[_0x18b8('0xc')]},'channel':{'type':Sequelize[_0x18b8('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x18b8('0x3')]},'context':{'type':Sequelize[_0x18b8('0x3')]},'exten':{'type':Sequelize[_0x18b8('0x3')]},'priority':{'type':Sequelize[_0x18b8('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x18b8('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x18b8('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x18b8('0x3')]},'transfer':{'type':Sequelize[_0x18b8('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x18b8('0xf')},'transferexten':{'type':Sequelize[_0x18b8('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x18b8('0x3')]},'secondDisposition':{'type':Sequelize[_0x18b8('0x3')]},'thirdDisposition':{'type':Sequelize[_0x18b8('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x18b8('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 54b8580..259a28b 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 _0x7ca3=['params','rawAttributes','include','options','create','body','update','destroy','find','describe','getVoiceQueuesReport','length','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','error','name','index','VoiceQueueReport','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show'];(function(_0x4fba26,_0x2fa3ea){var _0x4f4de9=function(_0x7d89){while(--_0x7d89){_0x4fba26['push'](_0x4fba26['shift']());}};_0x4f4de9(++_0x2fa3ea);}(_0x7ca3,0x144));var _0x37ca=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x7ca3[_0x1daaa9];return _0x1dd221;};'use strict';var emlformat=require(_0x37ca('0x0'));var rimraf=require(_0x37ca('0x1'));var zipdir=require(_0x37ca('0x2'));var jsonpatch=require(_0x37ca('0x3'));var rp=require('request-promise');var moment=require(_0x37ca('0x4'));var BPromise=require(_0x37ca('0x5'));var Mustache=require(_0x37ca('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x37ca('0x7'));var _=require(_0x37ca('0x8'));var squel=require(_0x37ca('0x9'));var crypto=require('crypto');var jsforce=require(_0x37ca('0xa'));var deskjs=require(_0x37ca('0xb'));var toCsv=require(_0x37ca('0xc'));var querystring=require(_0x37ca('0xd'));var Papa=require(_0x37ca('0xe'));var Redis=require(_0x37ca('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x37ca('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x37ca('0x11'));var utils=require(_0x37ca('0x12'));var config=require(_0x37ca('0x13'));var licenseUtil=require(_0x37ca('0x14'));var db=require(_0x37ca('0x15'))['db'];config[_0x37ca('0x16')]=_[_0x37ca('0x17')](config[_0x37ca('0x16')],{'host':_0x37ca('0x18'),'port':0x18eb});var socket=require(_0x37ca('0x19'))(new Redis(config[_0x37ca('0x16')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x4d6d3f,_0x4c8a83){_0x4c8a83=_0x4c8a83||0xcc;return function(_0x230f44){if(_0x230f44){return _0x4d6d3f[_0x37ca('0x1a')](_0x4c8a83);}return _0x4d6d3f[_0x37ca('0x1b')](_0x4c8a83)[_0x37ca('0x1c')]();};}function respondWithResult(_0x2145bc,_0x4223ce){_0x4223ce=_0x4223ce||0xc8;return function(_0x43df58){if(_0x43df58){return _0x2145bc['status'](_0x4223ce)[_0x37ca('0x1d')](_0x43df58);}};}function respondWithFilteredResult(_0xee494d,_0x186cc8){return function(_0x1f4755){if(_0x1f4755){var _0x1d06eb=typeof _0x186cc8[_0x37ca('0x1e')]==='undefined'&&typeof _0x186cc8[_0x37ca('0x1f')]===_0x37ca('0x20');var _0xdd5676=_0x1f4755['count'];var _0x27fdc9=_0x1d06eb?0x0:_0x186cc8[_0x37ca('0x1e')];var _0x443670=_0x1d06eb?_0x1f4755[_0x37ca('0x21')]:_0x186cc8[_0x37ca('0x1e')]+_0x186cc8[_0x37ca('0x1f')];var _0x50a542;if(_0x443670>=_0xdd5676){_0x443670=_0xdd5676;_0x50a542=0xc8;}else{_0x50a542=0xce;}_0xee494d[_0x37ca('0x1b')](_0x50a542);return _0xee494d[_0x37ca('0x22')](_0x37ca('0x23'),_0x27fdc9+'-'+_0x443670+'/'+_0xdd5676)[_0x37ca('0x1d')](_0x1f4755);}return null;};}function patchUpdates(_0x5ad476){return function(_0x214088){try{jsonpatch[_0x37ca('0x24')](_0x214088,_0x5ad476,!![]);}catch(_0x419a82){return BPromise['reject'](_0x419a82);}return _0x214088[_0x37ca('0x25')]();};}function saveUpdates(_0xc4f716,_0x3fbeb9){return function(_0x1c856a){if(_0x1c856a){return _0x1c856a['update'](_0xc4f716)[_0x37ca('0x26')](function(_0xfcdf6d){return _0xfcdf6d;});}return null;};}function removeEntity(_0x109616,_0x519470){return function(_0x538eaa){if(_0x538eaa){return _0x538eaa['destroy']()['then'](function(){_0x109616[_0x37ca('0x1b')](0xcc)[_0x37ca('0x1c')]();});}};}function handleEntityNotFound(_0xc4684e,_0x42fe68){return function(_0x2b27d3){if(!_0x2b27d3){_0xc4684e[_0x37ca('0x1a')](0x194);}return _0x2b27d3;};}function handleError(_0x5bae12,_0x84e675){_0x84e675=_0x84e675||0x1f4;return function(_0x53a002){logger[_0x37ca('0x27')](_0x53a002['stack']);if(_0x53a002[_0x37ca('0x28')]){delete _0x53a002[_0x37ca('0x28')];}_0x5bae12[_0x37ca('0x1b')](_0x84e675)['send'](_0x53a002);};}exports[_0x37ca('0x29')]=function(_0x37a583,_0x4dc683){var _0x2ae9bd={},_0x2b3004={},_0x273f60={'count':0x0,'rows':[]};var _0x4b61dc=_['map'](db[_0x37ca('0x2a')]['rawAttributes'],function(_0x1bed62){return{'name':_0x1bed62[_0x37ca('0x2b')],'type':_0x1bed62[_0x37ca('0x2c')][_0x37ca('0x2d')]};});_0x2b3004[_0x37ca('0x2e')]=_[_0x37ca('0x2f')](_0x4b61dc,'name');_0x2b3004[_0x37ca('0x30')]=_[_0x37ca('0x31')](_0x37a583[_0x37ca('0x30')]);_0x2b3004['filters']=_['intersection'](_0x2b3004[_0x37ca('0x2e')],_0x2b3004[_0x37ca('0x30')]);_0x2ae9bd[_0x37ca('0x32')]=_[_0x37ca('0x33')](_0x2b3004[_0x37ca('0x2e')],qs[_0x37ca('0x34')](_0x37a583['query'][_0x37ca('0x34')]));_0x2ae9bd[_0x37ca('0x32')]=_0x2ae9bd[_0x37ca('0x32')]['length']?_0x2ae9bd['attributes']:_0x2b3004['model'];if(!_0x37a583['query']['hasOwnProperty'](_0x37ca('0x35'))){_0x2ae9bd[_0x37ca('0x1f')]=qs[_0x37ca('0x1f')](_0x37a583[_0x37ca('0x30')][_0x37ca('0x1f')]);_0x2ae9bd[_0x37ca('0x1e')]=qs[_0x37ca('0x1e')](_0x37a583[_0x37ca('0x30')][_0x37ca('0x1e')]);}_0x2ae9bd[_0x37ca('0x36')]=qs[_0x37ca('0x37')](_0x37a583[_0x37ca('0x30')][_0x37ca('0x37')]);_0x2ae9bd[_0x37ca('0x38')]=qs[_0x37ca('0x39')](_[_0x37ca('0x3a')](_0x37a583[_0x37ca('0x30')],_0x2b3004[_0x37ca('0x39')]),_0x4b61dc);if(_0x37a583['query'][_0x37ca('0x3b')]){_0x2ae9bd[_0x37ca('0x38')]=_[_0x37ca('0x3c')](_0x2ae9bd[_0x37ca('0x38')],{'$or':_[_0x37ca('0x2f')](_0x4b61dc,function(_0x22840c){if(_0x22840c[_0x37ca('0x2c')]!==_0x37ca('0x3d')){var _0x504e98={};_0x504e98[_0x22840c[_0x37ca('0x28')]]={'$like':'%'+_0x37a583['query']['filter']+'%'};return _0x504e98;}})});}_0x2ae9bd=_['merge']({},_0x2ae9bd,_0x37a583['options']);var _0x46a7d0={'where':_0x2ae9bd[_0x37ca('0x38')]};return db[_0x37ca('0x2a')][_0x37ca('0x21')](_0x46a7d0)['then'](function(_0x331185){_0x273f60[_0x37ca('0x21')]=_0x331185;if(_0x37a583['query'][_0x37ca('0x3e')]){_0x2ae9bd['include']=[{'all':!![]}];}return db[_0x37ca('0x2a')][_0x37ca('0x3f')](_0x2ae9bd);})[_0x37ca('0x26')](function(_0x1a4a3b){_0x273f60['rows']=_0x1a4a3b;return _0x273f60;})['then'](respondWithFilteredResult(_0x4dc683,_0x2ae9bd))[_0x37ca('0x40')](handleError(_0x4dc683,null));};exports[_0x37ca('0x41')]=function(_0x1385d3,_0x125465){var _0x4be09f={'raw':![],'where':{'id':_0x1385d3[_0x37ca('0x42')]['id']}},_0xd9a3e6={};_0xd9a3e6[_0x37ca('0x2e')]=_['keys'](db[_0x37ca('0x2a')][_0x37ca('0x43')]);_0xd9a3e6[_0x37ca('0x30')]=_[_0x37ca('0x31')](_0x1385d3[_0x37ca('0x30')]);_0xd9a3e6[_0x37ca('0x39')]=_[_0x37ca('0x33')](_0xd9a3e6[_0x37ca('0x2e')],_0xd9a3e6[_0x37ca('0x30')]);_0x4be09f['attributes']=_[_0x37ca('0x33')](_0xd9a3e6[_0x37ca('0x2e')],qs['fields'](_0x1385d3[_0x37ca('0x30')][_0x37ca('0x34')]));_0x4be09f['attributes']=_0x4be09f[_0x37ca('0x32')]['length']?_0x4be09f['attributes']:_0xd9a3e6['model'];if(_0x1385d3[_0x37ca('0x30')][_0x37ca('0x3e')]){_0x4be09f[_0x37ca('0x44')]=[{'all':!![]}];}_0x4be09f=_[_0x37ca('0x3c')]({},_0x4be09f,_0x1385d3[_0x37ca('0x45')]);return db['VoiceQueueReport']['find'](_0x4be09f)[_0x37ca('0x26')](handleEntityNotFound(_0x125465,null))[_0x37ca('0x26')](respondWithResult(_0x125465,null))[_0x37ca('0x40')](handleError(_0x125465,null));};exports[_0x37ca('0x46')]=function(_0x443539,_0x4abf04){return db['VoiceQueueReport'][_0x37ca('0x46')](_0x443539[_0x37ca('0x47')],{})[_0x37ca('0x26')](respondWithResult(_0x4abf04,0xc9))['catch'](handleError(_0x4abf04,null));};exports[_0x37ca('0x48')]=function(_0x25e6ac,_0x475b55){if(_0x25e6ac[_0x37ca('0x47')]['id']){delete _0x25e6ac['body']['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x25e6ac['params']['id']}})[_0x37ca('0x26')](handleEntityNotFound(_0x475b55,null))[_0x37ca('0x26')](saveUpdates(_0x25e6ac['body'],null))[_0x37ca('0x26')](respondWithResult(_0x475b55,null))[_0x37ca('0x40')](handleError(_0x475b55,null));};exports[_0x37ca('0x49')]=function(_0x5391b1,_0x3db07e){return db[_0x37ca('0x2a')][_0x37ca('0x4a')]({'where':{'id':_0x5391b1['params']['id']}})['then'](handleEntityNotFound(_0x3db07e,null))[_0x37ca('0x26')](removeEntity(_0x3db07e,null))[_0x37ca('0x40')](handleError(_0x3db07e,null));};exports[_0x37ca('0x4b')]=function(_0x5e2882,_0x1fea20){return db[_0x37ca('0x2a')]['describe']()[_0x37ca('0x26')](respondWithResult(_0x1fea20,null))[_0x37ca('0x40')](handleError(_0x1fea20,null));};exports[_0x37ca('0x4c')]=function(_0x19756b,_0x1f701f){var _0x40001d={},_0x3f188d={},_0x7cbf6a={'count':0x0,'rows':[]};_0x3f188d[_0x37ca('0x2e')]=_[_0x37ca('0x31')](db['VoiceQueueReport'][_0x37ca('0x43')]);_0x3f188d[_0x37ca('0x30')]=_[_0x37ca('0x31')](_0x19756b['query']);_0x3f188d[_0x37ca('0x39')]=_[_0x37ca('0x33')](_0x3f188d['model'],_0x3f188d['query']);_0x40001d[_0x37ca('0x32')]=_['intersection'](_0x3f188d[_0x37ca('0x2e')],qs[_0x37ca('0x34')](_0x19756b[_0x37ca('0x30')]['fields']));_0x40001d[_0x37ca('0x32')]=_0x40001d[_0x37ca('0x32')][_0x37ca('0x4d')]?_0x40001d[_0x37ca('0x32')]:_0x3f188d['model'];if(!_0x19756b[_0x37ca('0x30')]['hasOwnProperty'](_0x37ca('0x35'))){_0x40001d['limit']=qs[_0x37ca('0x1f')](_0x19756b[_0x37ca('0x30')]['limit']);_0x40001d[_0x37ca('0x1e')]=qs[_0x37ca('0x1e')](_0x19756b[_0x37ca('0x30')]['offset']);}_0x40001d[_0x37ca('0x36')]=qs[_0x37ca('0x37')](_0x19756b[_0x37ca('0x30')][_0x37ca('0x37')]);_0x40001d[_0x37ca('0x38')]=qs[_0x37ca('0x39')](_['pick'](_0x19756b[_0x37ca('0x30')],_0x3f188d['filters']));if(_0x19756b[_0x37ca('0x30')]['filter']){_0x40001d[_0x37ca('0x38')]=_[_0x37ca('0x3c')](_0x40001d[_0x37ca('0x38')],{'$or':_['map'](_0x40001d[_0x37ca('0x32')],function(_0x31225e){var _0x407df0={};_0x407df0[_0x31225e]={'$like':'%'+_0x19756b[_0x37ca('0x30')][_0x37ca('0x3b')]+'%'};return _0x407df0;})});}_0x40001d=_[_0x37ca('0x3c')]({},_0x40001d,_0x19756b[_0x37ca('0x45')]);var _0x14cad9={'where':_0x40001d[_0x37ca('0x38')]};return db['VoiceQueueReport'][_0x37ca('0x21')](_0x14cad9)['then'](function(_0x535255){_0x7cbf6a[_0x37ca('0x21')]=_0x535255;if(_0x19756b[_0x37ca('0x30')]['includeAll']){_0x40001d['include']=[{'all':!![]}];}return db[_0x37ca('0x2a')][_0x37ca('0x3f')](_0x40001d);})['then'](function(_0x29e3e3){_0x7cbf6a['rows']=_0x29e3e3;return _0x7cbf6a;})[_0x37ca('0x26')](respondWithFilteredResult(_0x1f701f,_0x40001d,_0x37ca('0x4c')))[_0x37ca('0x40')](handleError(_0x1f701f,null,_0x37ca('0x4c')));}; \ No newline at end of file +var _0xe7b7=['length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','VoiceQueueReport','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','describe','getVoiceQueuesReport','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields'];(function(_0x38e261,_0x4db54a){var _0x5921f8=function(_0x32d5b4){while(--_0x32d5b4){_0x38e261['push'](_0x38e261['shift']());}};_0x5921f8(++_0x4db54a);}(_0xe7b7,0xbe));var _0x7e7b=function(_0x1ef85f,_0x1a5072){_0x1ef85f=_0x1ef85f-0x0;var _0x39bffd=_0xe7b7[_0x1ef85f];return _0x39bffd;};'use strict';var emlformat=require(_0x7e7b('0x0'));var rimraf=require(_0x7e7b('0x1'));var zipdir=require(_0x7e7b('0x2'));var jsonpatch=require(_0x7e7b('0x3'));var rp=require(_0x7e7b('0x4'));var moment=require(_0x7e7b('0x5'));var BPromise=require(_0x7e7b('0x6'));var Mustache=require('mustache');var util=require(_0x7e7b('0x7'));var path=require(_0x7e7b('0x8'));var sox=require(_0x7e7b('0x9'));var csv=require(_0x7e7b('0xa'));var ejs=require(_0x7e7b('0xb'));var fs=require('fs');var fs_extra=require(_0x7e7b('0xc'));var _=require(_0x7e7b('0xd'));var squel=require(_0x7e7b('0xe'));var crypto=require('crypto');var jsforce=require(_0x7e7b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7e7b('0xa'));var querystring=require('querystring');var Papa=require(_0x7e7b('0x10'));var Redis=require(_0x7e7b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7e7b('0x12'));var as=require(_0x7e7b('0x13'));var hardwareService=require(_0x7e7b('0x14'));var logger=require(_0x7e7b('0x15'))(_0x7e7b('0x16'));var utils=require(_0x7e7b('0x17'));var config=require(_0x7e7b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x7e7b('0x19')](config[_0x7e7b('0x1a')],{'host':_0x7e7b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7e7b('0x1c'))[_0x7e7b('0x1d')](socket);function respondWithStatusCode(_0x32a884,_0x3f2f3b){_0x3f2f3b=_0x3f2f3b||0xcc;return function(_0x19fa1a){if(_0x19fa1a){return _0x32a884[_0x7e7b('0x1e')](_0x3f2f3b);}return _0x32a884[_0x7e7b('0x1f')](_0x3f2f3b)[_0x7e7b('0x20')]();};}function respondWithResult(_0x4f252a,_0x133130){_0x133130=_0x133130||0xc8;return function(_0x190c9a){if(_0x190c9a){return _0x4f252a['status'](_0x133130)[_0x7e7b('0x21')](_0x190c9a);}};}function respondWithFilteredResult(_0x14556f,_0x5e4741){return function(_0x1252b7){if(_0x1252b7){var _0x2d7af4=typeof _0x5e4741[_0x7e7b('0x22')]==='undefined'&&typeof _0x5e4741[_0x7e7b('0x23')]===_0x7e7b('0x24');var _0x23be41=_0x1252b7[_0x7e7b('0x25')];var _0x4ab7b3=_0x2d7af4?0x0:_0x5e4741[_0x7e7b('0x22')];var _0xfd0bdb=_0x2d7af4?_0x1252b7[_0x7e7b('0x25')]:_0x5e4741[_0x7e7b('0x22')]+_0x5e4741[_0x7e7b('0x23')];var _0x46e184;if(_0xfd0bdb>=_0x23be41){_0xfd0bdb=_0x23be41;_0x46e184=0xc8;}else{_0x46e184=0xce;}_0x14556f['status'](_0x46e184);return _0x14556f[_0x7e7b('0x26')](_0x7e7b('0x27'),_0x4ab7b3+'-'+_0xfd0bdb+'/'+_0x23be41)[_0x7e7b('0x21')](_0x1252b7);}return null;};}function patchUpdates(_0x8dc093){return function(_0x5a94ab){try{jsonpatch[_0x7e7b('0x28')](_0x5a94ab,_0x8dc093,!![]);}catch(_0x3c4785){return BPromise[_0x7e7b('0x29')](_0x3c4785);}return _0x5a94ab['save']();};}function saveUpdates(_0x1130cf,_0x1cbaa1){return function(_0x4656d1){if(_0x4656d1){return _0x4656d1['update'](_0x1130cf)['then'](function(_0x3bbb93){return _0x3bbb93;});}return null;};}function removeEntity(_0x58cde9,_0x2dc3a4){return function(_0x1c2879){if(_0x1c2879){return _0x1c2879[_0x7e7b('0x2a')]()['then'](function(){_0x58cde9[_0x7e7b('0x1f')](0xcc)[_0x7e7b('0x20')]();});}};}function handleEntityNotFound(_0x3c8172,_0xbbbd28){return function(_0x339f58){if(!_0x339f58){_0x3c8172[_0x7e7b('0x1e')](0x194);}return _0x339f58;};}function handleError(_0x45c976,_0x36b004){_0x36b004=_0x36b004||0x1f4;return function(_0x5eb808){logger['error'](_0x5eb808['stack']);if(_0x5eb808[_0x7e7b('0x2b')]){delete _0x5eb808[_0x7e7b('0x2b')];}_0x45c976[_0x7e7b('0x1f')](_0x36b004)[_0x7e7b('0x2c')](_0x5eb808);};}exports[_0x7e7b('0x2d')]=function(_0x320817,_0x4684d2){var _0x4f4411={},_0x16dc14={},_0x3dd25f={'count':0x0,'rows':[]};var _0x429fc0=_['map'](db['VoiceQueueReport'][_0x7e7b('0x2e')],function(_0x46e071){return{'name':_0x46e071['fieldName'],'type':_0x46e071[_0x7e7b('0x2f')][_0x7e7b('0x30')]};});_0x16dc14[_0x7e7b('0x31')]=_[_0x7e7b('0x32')](_0x429fc0,_0x7e7b('0x2b'));_0x16dc14[_0x7e7b('0x33')]=_[_0x7e7b('0x34')](_0x320817['query']);_0x16dc14['filters']=_[_0x7e7b('0x35')](_0x16dc14[_0x7e7b('0x31')],_0x16dc14[_0x7e7b('0x33')]);_0x4f4411[_0x7e7b('0x36')]=_[_0x7e7b('0x35')](_0x16dc14[_0x7e7b('0x31')],qs[_0x7e7b('0x37')](_0x320817['query'][_0x7e7b('0x37')]));_0x4f4411[_0x7e7b('0x36')]=_0x4f4411[_0x7e7b('0x36')][_0x7e7b('0x38')]?_0x4f4411[_0x7e7b('0x36')]:_0x16dc14[_0x7e7b('0x31')];if(!_0x320817[_0x7e7b('0x33')][_0x7e7b('0x39')]('nolimit')){_0x4f4411[_0x7e7b('0x23')]=qs[_0x7e7b('0x23')](_0x320817[_0x7e7b('0x33')][_0x7e7b('0x23')]);_0x4f4411[_0x7e7b('0x22')]=qs[_0x7e7b('0x22')](_0x320817[_0x7e7b('0x33')][_0x7e7b('0x22')]);}_0x4f4411[_0x7e7b('0x3a')]=qs[_0x7e7b('0x3b')](_0x320817[_0x7e7b('0x33')]['sort']);_0x4f4411[_0x7e7b('0x3c')]=qs[_0x7e7b('0x3d')](_[_0x7e7b('0x3e')](_0x320817[_0x7e7b('0x33')],_0x16dc14[_0x7e7b('0x3d')]),_0x429fc0);if(_0x320817['query'][_0x7e7b('0x3f')]){_0x4f4411[_0x7e7b('0x3c')]=_['merge'](_0x4f4411['where'],{'$or':_[_0x7e7b('0x32')](_0x429fc0,function(_0x5169dc){if(_0x5169dc['type']!==_0x7e7b('0x40')){var _0x176420={};_0x176420[_0x5169dc[_0x7e7b('0x2b')]]={'$like':'%'+_0x320817[_0x7e7b('0x33')][_0x7e7b('0x3f')]+'%'};return _0x176420;}})});}_0x4f4411=_[_0x7e7b('0x41')]({},_0x4f4411,_0x320817[_0x7e7b('0x42')]);var _0x2d6f0f={'where':_0x4f4411[_0x7e7b('0x3c')]};return db[_0x7e7b('0x43')][_0x7e7b('0x25')](_0x2d6f0f)['then'](function(_0x222e5a){_0x3dd25f[_0x7e7b('0x25')]=_0x222e5a;if(_0x320817[_0x7e7b('0x33')]['includeAll']){_0x4f4411[_0x7e7b('0x44')]=[{'all':!![]}];}return db[_0x7e7b('0x43')][_0x7e7b('0x45')](_0x4f4411);})[_0x7e7b('0x46')](function(_0x59b1ad){_0x3dd25f[_0x7e7b('0x47')]=_0x59b1ad;return _0x3dd25f;})[_0x7e7b('0x46')](respondWithFilteredResult(_0x4684d2,_0x4f4411))[_0x7e7b('0x48')](handleError(_0x4684d2,null));};exports[_0x7e7b('0x49')]=function(_0x47c672,_0x364c57){var _0x4aae78={'raw':![],'where':{'id':_0x47c672[_0x7e7b('0x4a')]['id']}},_0x4d3002={};_0x4d3002[_0x7e7b('0x31')]=_['keys'](db[_0x7e7b('0x43')][_0x7e7b('0x2e')]);_0x4d3002['query']=_[_0x7e7b('0x34')](_0x47c672[_0x7e7b('0x33')]);_0x4d3002[_0x7e7b('0x3d')]=_[_0x7e7b('0x35')](_0x4d3002['model'],_0x4d3002[_0x7e7b('0x33')]);_0x4aae78[_0x7e7b('0x36')]=_[_0x7e7b('0x35')](_0x4d3002['model'],qs[_0x7e7b('0x37')](_0x47c672[_0x7e7b('0x33')][_0x7e7b('0x37')]));_0x4aae78['attributes']=_0x4aae78[_0x7e7b('0x36')]['length']?_0x4aae78['attributes']:_0x4d3002[_0x7e7b('0x31')];if(_0x47c672[_0x7e7b('0x33')][_0x7e7b('0x4b')]){_0x4aae78[_0x7e7b('0x44')]=[{'all':!![]}];}_0x4aae78=_[_0x7e7b('0x41')]({},_0x4aae78,_0x47c672[_0x7e7b('0x42')]);return db[_0x7e7b('0x43')][_0x7e7b('0x4c')](_0x4aae78)['then'](handleEntityNotFound(_0x364c57,null))['then'](respondWithResult(_0x364c57,null))[_0x7e7b('0x48')](handleError(_0x364c57,null));};exports[_0x7e7b('0x4d')]=function(_0x1085d8,_0x3e211c){return db['VoiceQueueReport'][_0x7e7b('0x4d')](_0x1085d8['body'],{})[_0x7e7b('0x46')](respondWithResult(_0x3e211c,0xc9))[_0x7e7b('0x48')](handleError(_0x3e211c,null));};exports['update']=function(_0x3ea724,_0x28bbcc){if(_0x3ea724['body']['id']){delete _0x3ea724['body']['id'];}return db[_0x7e7b('0x43')]['find']({'where':{'id':_0x3ea724[_0x7e7b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x28bbcc,null))['then'](saveUpdates(_0x3ea724[_0x7e7b('0x4e')],null))[_0x7e7b('0x46')](respondWithResult(_0x28bbcc,null))[_0x7e7b('0x48')](handleError(_0x28bbcc,null));};exports[_0x7e7b('0x2a')]=function(_0x18804d,_0x1ff0b3){return db[_0x7e7b('0x43')][_0x7e7b('0x4c')]({'where':{'id':_0x18804d['params']['id']}})[_0x7e7b('0x46')](handleEntityNotFound(_0x1ff0b3,null))[_0x7e7b('0x46')](removeEntity(_0x1ff0b3,null))[_0x7e7b('0x48')](handleError(_0x1ff0b3,null));};exports[_0x7e7b('0x4f')]=function(_0x51c2b7,_0x59bd4d){return db[_0x7e7b('0x43')][_0x7e7b('0x4f')]()[_0x7e7b('0x46')](respondWithResult(_0x59bd4d,null))[_0x7e7b('0x48')](handleError(_0x59bd4d,null));};exports[_0x7e7b('0x50')]=function(_0x575f65,_0x51df1e){var _0x2df705={},_0x3e0a62={},_0x8ca1e5={'count':0x0,'rows':[]};_0x3e0a62[_0x7e7b('0x31')]=_[_0x7e7b('0x34')](db[_0x7e7b('0x43')]['rawAttributes']);_0x3e0a62[_0x7e7b('0x33')]=_[_0x7e7b('0x34')](_0x575f65[_0x7e7b('0x33')]);_0x3e0a62[_0x7e7b('0x3d')]=_['intersection'](_0x3e0a62[_0x7e7b('0x31')],_0x3e0a62[_0x7e7b('0x33')]);_0x2df705['attributes']=_[_0x7e7b('0x35')](_0x3e0a62[_0x7e7b('0x31')],qs[_0x7e7b('0x37')](_0x575f65[_0x7e7b('0x33')][_0x7e7b('0x37')]));_0x2df705[_0x7e7b('0x36')]=_0x2df705[_0x7e7b('0x36')][_0x7e7b('0x38')]?_0x2df705[_0x7e7b('0x36')]:_0x3e0a62[_0x7e7b('0x31')];if(!_0x575f65[_0x7e7b('0x33')][_0x7e7b('0x39')](_0x7e7b('0x51'))){_0x2df705[_0x7e7b('0x23')]=qs[_0x7e7b('0x23')](_0x575f65[_0x7e7b('0x33')][_0x7e7b('0x23')]);_0x2df705[_0x7e7b('0x22')]=qs[_0x7e7b('0x22')](_0x575f65[_0x7e7b('0x33')][_0x7e7b('0x22')]);}_0x2df705[_0x7e7b('0x3a')]=qs[_0x7e7b('0x3b')](_0x575f65[_0x7e7b('0x33')][_0x7e7b('0x3b')]);_0x2df705['where']=qs['filters'](_[_0x7e7b('0x3e')](_0x575f65['query'],_0x3e0a62['filters']));if(_0x575f65[_0x7e7b('0x33')][_0x7e7b('0x3f')]){_0x2df705[_0x7e7b('0x3c')]=_[_0x7e7b('0x41')](_0x2df705['where'],{'$or':_['map'](_0x2df705[_0x7e7b('0x36')],function(_0x29ce0d){var _0x1e751d={};_0x1e751d[_0x29ce0d]={'$like':'%'+_0x575f65[_0x7e7b('0x33')][_0x7e7b('0x3f')]+'%'};return _0x1e751d;})});}_0x2df705=_[_0x7e7b('0x41')]({},_0x2df705,_0x575f65[_0x7e7b('0x42')]);var _0x57bf9d={'where':_0x2df705['where']};return db['VoiceQueueReport'][_0x7e7b('0x25')](_0x57bf9d)[_0x7e7b('0x46')](function(_0x12c672){_0x8ca1e5['count']=_0x12c672;if(_0x575f65[_0x7e7b('0x33')][_0x7e7b('0x4b')]){_0x2df705['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x2df705);})[_0x7e7b('0x46')](function(_0x349926){_0x8ca1e5[_0x7e7b('0x47')]=_0x349926;return _0x8ca1e5;})[_0x7e7b('0x46')](respondWithFilteredResult(_0x51df1e,_0x2df705,_0x7e7b('0x50')))['catch'](handleError(_0x51df1e,null,_0x7e7b('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 7b06bf1..852101f 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 _0xfa98=['hasOwnProperty','exports','events','setMaxListeners','save','update','emit'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0xfa98,0xf7));var _0x8fa9=function(_0x108949,_0x84b8a8){_0x108949=_0x108949-0x0;var _0x340504=_0xfa98[_0x108949];return _0x340504;};'use strict';var EventEmitter=require(_0x8fa9('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8fa9('0x1')](0x0);var events={'afterCreate':_0x8fa9('0x2'),'afterUpdate':_0x8fa9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x17bf23){return function(_0x59cf3d,_0x5dabf6,_0x176060){VoiceQueueReportEvents[_0x8fa9('0x4')](_0x17bf23+':'+_0x59cf3d['id'],_0x59cf3d);VoiceQueueReportEvents[_0x8fa9('0x4')](_0x17bf23,_0x59cf3d);_0x176060(null);};}for(var e in events){if(events[_0x8fa9('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x8fa9('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4eed=['update','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4eed,0xdc));var _0xd4ee=function(_0x20c79a,_0x2f5766){_0x20c79a=_0x20c79a-0x0;var _0x3321a1=_0x4eed[_0x20c79a];return _0x3321a1;};'use strict';var EventEmitter=require(_0xd4ee('0x0'));var VoiceQueueReport=require(_0xd4ee('0x1'))['db'][_0xd4ee('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4ee('0x3'),'afterUpdate':_0xd4ee('0x4'),'afterDestroy':'remove'};function emitEvent(_0x25fb41){return function(_0x3cff30,_0x37670a,_0x39dc15){VoiceQueueReportEvents['emit'](_0x25fb41+':'+_0x3cff30['id'],_0x3cff30);VoiceQueueReportEvents[_0xd4ee('0x5')](_0x25fb41,_0x3cff30);_0x39dc15(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xd4ee('0x6')](e,emitEvent(event));}}module[_0xd4ee('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 05532a5..05afee3 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 _0x44d9=['define','report_queue','uniqueid','util','../../config/logger','api','moment','path','../../config/environment','./voiceQueueReport.attributes'];(function(_0x2ca2b3,_0x128eb5){var _0x4da45c=function(_0xe5726){while(--_0xe5726){_0x2ca2b3['push'](_0x2ca2b3['shift']());}};_0x4da45c(++_0x128eb5);}(_0x44d9,0x125));var _0x944d=function(_0x424d7c,_0x49abec){_0x424d7c=_0x424d7c-0x0;var _0xbb2c0=_0x44d9[_0x424d7c];return _0xbb2c0;};'use strict';var _=require('lodash');var util=require(_0x944d('0x0'));var logger=require(_0x944d('0x1'))(_0x944d('0x2'));var moment=require(_0x944d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x944d('0x4'));var rimraf=require('rimraf');var config=require(_0x944d('0x5'));var attributes=require(_0x944d('0x6'));module['exports']=function(_0x545026,_0x3613a2){return _0x545026[_0x944d('0x7')]('VoiceQueueReport',attributes,{'tableName':_0x944d('0x8'),'paranoid':![],'indexes':[{'fields':[_0x944d('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x95e2=['../../config/environment','exports','VoiceQueueReport','uniqueid','calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x569352,_0x8f7335){var _0x23fb6e=function(_0x3902d0){while(--_0x3902d0){_0x569352['push'](_0x569352['shift']());}};_0x23fb6e(++_0x8f7335);}(_0x95e2,0x125));var _0x295e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x295e('0x0'));var util=require('util');var logger=require(_0x295e('0x1'))(_0x295e('0x2'));var moment=require(_0x295e('0x3'));var BPromise=require(_0x295e('0x4'));var rp=require(_0x295e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x295e('0x6'));var config=require(_0x295e('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0x295e('0x8')]=function(_0x4362cd,_0x307630){return _0x4362cd['define'](_0x295e('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x295e('0xa')]},{'fields':[_0x295e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3e26a47..4e8254b 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 _0x20ab=['VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','map','include','model','debug','CreateVoiceQueueReport','create','body','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','info'];(function(_0x1c84d0,_0x369a7a){var _0x39a7e1=function(_0x176172){while(--_0x176172){_0x1c84d0['push'](_0x1c84d0['shift']());}};_0x39a7e1(++_0x369a7a);}(_0x20ab,0x1d0));var _0xb20a=function(_0x54f01a,_0x12e01c){_0x54f01a=_0x54f01a-0x0;var _0x4787f1=_0x20ab[_0x54f01a];return _0x4787f1;};'use strict';var _=require(_0xb20a('0x0'));var util=require(_0xb20a('0x1'));var moment=require(_0xb20a('0x2'));var BPromise=require(_0xb20a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb20a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb20a('0x5'));var logger=require(_0xb20a('0x6'))(_0xb20a('0x7'));var config=require(_0xb20a('0x8'));var jayson=require(_0xb20a('0x9'));var client=jayson[_0xb20a('0xa')][_0xb20a('0xb')]({'port':0x232a});config[_0xb20a('0xc')]=_[_0xb20a('0xd')](config['redis'],{'host':_0xb20a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb20a('0xc')]));require(_0xb20a('0xf'))[_0xb20a('0x10')](socket);function respondWithRpcPromise(_0x36ce6d,_0x2ea506,_0x13d5e8){return new BPromise(function(_0x40c7e2,_0x1ff30f){return client[_0xb20a('0x11')](_0x36ce6d,_0x13d5e8)[_0xb20a('0x12')](function(_0x4475b9){logger[_0xb20a('0x13')](_0xb20a('0x14'),_0x2ea506,_0xb20a('0x15'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2ea506,_0xb20a('0x15'),JSON['stringify'](_0x4475b9));if(_0x4475b9[_0xb20a('0x16')]){if(_0x4475b9[_0xb20a('0x16')][_0xb20a('0x17')]===0x1f4){logger[_0xb20a('0x16')](_0xb20a('0x14'),_0x2ea506,_0x4475b9['error']['message']);return _0x1ff30f(_0x4475b9[_0xb20a('0x16')][_0xb20a('0x18')]);}logger[_0xb20a('0x16')](_0xb20a('0x14'),_0x2ea506,_0x4475b9['error'][_0xb20a('0x18')]);return _0x40c7e2(_0x4475b9[_0xb20a('0x16')][_0xb20a('0x18')]);}else{logger[_0xb20a('0x13')](_0xb20a('0x14'),_0x2ea506,_0xb20a('0x15'));_0x40c7e2(_0x4475b9[_0xb20a('0x19')][_0xb20a('0x18')]);}})[_0xb20a('0x1a')](function(_0x4c2755){logger['error'](_0xb20a('0x14'),_0x2ea506,_0x4c2755);_0x1ff30f(_0x4c2755);});});}exports[_0xb20a('0x1b')]=function(_0x49da48){var _0x51237e=this;return new Promise(function(_0x1dabd0,_0x44bfad){return db[_0xb20a('0x1c')][_0xb20a('0x1d')]({'raw':_0x49da48[_0xb20a('0x1e')]?_0x49da48[_0xb20a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x49da48['options']?_0x49da48[_0xb20a('0x1e')][_0xb20a('0x1f')]||null:null,'attributes':_0x49da48['options']?_0x49da48['options'][_0xb20a('0x20')]||null:null,'limit':_0x49da48[_0xb20a('0x1e')]?_0x49da48[_0xb20a('0x1e')][_0xb20a('0x21')]||null:null,'include':_0x49da48['options']?_0x49da48['options']['include']?_[_0xb20a('0x22')](_0x49da48[_0xb20a('0x1e')][_0xb20a('0x23')],function(_0x50976f){return{'model':db[_0x50976f[_0xb20a('0x24')]],'as':_0x50976f['as'],'attributes':_0x50976f[_0xb20a('0x20')],'include':_0x50976f[_0xb20a('0x23')]?_['map'](_0x50976f['include'],function(_0x2f8905){return{'model':db[_0x2f8905['model']],'as':_0x2f8905['as'],'attributes':_0x2f8905['attributes'],'include':_0x2f8905[_0xb20a('0x23')]?_['map'](_0x2f8905[_0xb20a('0x23')],function(_0x425ab9){return{'model':db[_0x425ab9['model']],'as':_0x425ab9['as'],'attributes':_0x425ab9[_0xb20a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51872e){logger[_0xb20a('0x13')](_0xb20a('0x1b'),_0x49da48);logger[_0xb20a('0x25')](_0xb20a('0x1b'),_0x49da48,JSON['stringify'](_0x51872e));_0x1dabd0(_0x51872e);})[_0xb20a('0x1a')](function(_0x36342e){logger[_0xb20a('0x16')]('GetVoiceQueueReport',_0x36342e['message'],_0x49da48);_0x44bfad(_0x51237e[_0xb20a('0x16')](0x1f4,_0x36342e['message']));});});};exports[_0xb20a('0x26')]=function(_0x115406){var _0x3bd915=this;return new Promise(function(_0x5c0fa2,_0x31f7bc){return db[_0xb20a('0x1c')][_0xb20a('0x27')](_0x115406[_0xb20a('0x28')],{'raw':_0x115406[_0xb20a('0x1e')]?_0x115406[_0xb20a('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb20a('0x12')](function(_0x4e6428){logger[_0xb20a('0x13')](_0xb20a('0x26'),_0x115406);logger[_0xb20a('0x25')]('CreateVoiceQueueReport',_0x115406,JSON[_0xb20a('0x29')](_0x4e6428));_0x5c0fa2(_0x4e6428);})[_0xb20a('0x1a')](function(_0xc38bec){logger['error'](_0xb20a('0x26'),_0xc38bec[_0xb20a('0x18')],_0x115406);_0x31f7bc(_0x3bd915[_0xb20a('0x16')](0x1f4,_0xc38bec['message']));});});};exports[_0xb20a('0x2a')]=function(_0x5c0c74){var _0x48631a=this;return new Promise(function(_0x30b506,_0x1268ea){return db[_0xb20a('0x1c')][_0xb20a('0x2b')](_0x5c0c74[_0xb20a('0x28')],{'raw':_0x5c0c74[_0xb20a('0x1e')]?_0x5c0c74[_0xb20a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c0c74[_0xb20a('0x1e')]?_0x5c0c74['options'][_0xb20a('0x1f')]||null:null,'attributes':_0x5c0c74[_0xb20a('0x1e')]?_0x5c0c74[_0xb20a('0x1e')]['attributes']||null:null,'limit':_0x5c0c74[_0xb20a('0x1e')]?_0x5c0c74['options'][_0xb20a('0x21')]||null:null})[_0xb20a('0x12')](function(_0x108f59){logger[_0xb20a('0x13')]('UpdateVoiceQueueReport',_0x5c0c74);logger[_0xb20a('0x25')](_0xb20a('0x2a'),_0x5c0c74,JSON[_0xb20a('0x29')](_0x108f59));_0x30b506(_0x108f59);})['catch'](function(_0x1393be){logger['error'](_0xb20a('0x2a'),_0x1393be['message'],_0x5c0c74);_0x1268ea(_0x48631a[_0xb20a('0x16')](0x1f4,_0x1393be[_0xb20a('0x18')]));});});}; \ No newline at end of file +var _0xf337=['where','attributes','limit','include','map','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw'];(function(_0x4bf979,_0x2e7e06){var _0xb037e1=function(_0x232b41){while(--_0x232b41){_0x4bf979['push'](_0x4bf979['shift']());}};_0xb037e1(++_0x2e7e06);}(_0xf337,0x19f));var _0x7f33=function(_0xe9169d,_0x59e5b6){_0xe9169d=_0xe9169d-0x0;var _0x336df9=_0xf337[_0xe9169d];return _0x336df9;};'use strict';var _=require('lodash');var util=require(_0x7f33('0x0'));var moment=require(_0x7f33('0x1'));var BPromise=require(_0x7f33('0x2'));var rs=require(_0x7f33('0x3'));var fs=require('fs');var Redis=require(_0x7f33('0x4'));var db=require(_0x7f33('0x5'))['db'];var utils=require(_0x7f33('0x6'));var logger=require(_0x7f33('0x7'))(_0x7f33('0x8'));var config=require(_0x7f33('0x9'));var jayson=require(_0x7f33('0xa'));var client=jayson[_0x7f33('0xb')]['http']({'port':0x232a});config[_0x7f33('0xc')]=_[_0x7f33('0xd')](config[_0x7f33('0xc')],{'host':_0x7f33('0xe'),'port':0x18eb});var socket=require(_0x7f33('0xf'))(new Redis(config[_0x7f33('0xc')]));require(_0x7f33('0x10'))[_0x7f33('0x11')](socket);function respondWithRpcPromise(_0xf52d2a,_0x3aef21,_0x4a5054){return new BPromise(function(_0x4b7031,_0x344edc){return client[_0x7f33('0x12')](_0xf52d2a,_0x4a5054)[_0x7f33('0x13')](function(_0x55d451){logger[_0x7f33('0x14')](_0x7f33('0x15'),_0x3aef21,_0x7f33('0x16'));logger[_0x7f33('0x17')](_0x7f33('0x18'),_0x3aef21,_0x7f33('0x16'),JSON[_0x7f33('0x19')](_0x55d451));if(_0x55d451['error']){if(_0x55d451[_0x7f33('0x1a')]['code']===0x1f4){logger[_0x7f33('0x1a')](_0x7f33('0x15'),_0x3aef21,_0x55d451[_0x7f33('0x1a')]['message']);return _0x344edc(_0x55d451['error'][_0x7f33('0x1b')]);}logger[_0x7f33('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x3aef21,_0x55d451['error'][_0x7f33('0x1b')]);return _0x4b7031(_0x55d451['error'][_0x7f33('0x1b')]);}else{logger[_0x7f33('0x14')](_0x7f33('0x15'),_0x3aef21,_0x7f33('0x16'));_0x4b7031(_0x55d451[_0x7f33('0x1c')]['message']);}})[_0x7f33('0x1d')](function(_0x384bbe){logger[_0x7f33('0x1a')](_0x7f33('0x15'),_0x3aef21,_0x384bbe);_0x344edc(_0x384bbe);});});}exports[_0x7f33('0x1e')]=function(_0x1b439b){var _0x252dac=this;return new Promise(function(_0x3a6f5f,_0x289345){return db[_0x7f33('0x1f')][_0x7f33('0x20')]({'raw':_0x1b439b[_0x7f33('0x21')]?_0x1b439b[_0x7f33('0x21')][_0x7f33('0x22')]===undefined?!![]:![]:!![],'where':_0x1b439b['options']?_0x1b439b[_0x7f33('0x21')][_0x7f33('0x23')]||null:null,'attributes':_0x1b439b[_0x7f33('0x21')]?_0x1b439b[_0x7f33('0x21')][_0x7f33('0x24')]||null:null,'limit':_0x1b439b[_0x7f33('0x21')]?_0x1b439b['options'][_0x7f33('0x25')]||null:null,'include':_0x1b439b[_0x7f33('0x21')]?_0x1b439b[_0x7f33('0x21')][_0x7f33('0x26')]?_[_0x7f33('0x27')](_0x1b439b[_0x7f33('0x21')][_0x7f33('0x26')],function(_0x9cb468){return{'model':db[_0x9cb468[_0x7f33('0x28')]],'as':_0x9cb468['as'],'attributes':_0x9cb468[_0x7f33('0x24')],'include':_0x9cb468[_0x7f33('0x26')]?_[_0x7f33('0x27')](_0x9cb468[_0x7f33('0x26')],function(_0x270fc8){return{'model':db[_0x270fc8[_0x7f33('0x28')]],'as':_0x270fc8['as'],'attributes':_0x270fc8['attributes'],'include':_0x270fc8[_0x7f33('0x26')]?_[_0x7f33('0x27')](_0x270fc8[_0x7f33('0x26')],function(_0x182d3b){return{'model':db[_0x182d3b[_0x7f33('0x28')]],'as':_0x182d3b['as'],'attributes':_0x182d3b[_0x7f33('0x24')]};}):[]};}):[]};}):[]:[]})[_0x7f33('0x13')](function(_0x395e7a){logger[_0x7f33('0x14')](_0x7f33('0x1e'),_0x1b439b);logger['debug'](_0x7f33('0x1e'),_0x1b439b,JSON[_0x7f33('0x19')](_0x395e7a));_0x3a6f5f(_0x395e7a);})[_0x7f33('0x1d')](function(_0x10ee3b){logger[_0x7f33('0x1a')](_0x7f33('0x1e'),_0x10ee3b[_0x7f33('0x1b')],_0x1b439b);_0x289345(_0x252dac[_0x7f33('0x1a')](0x1f4,_0x10ee3b['message']));});});};exports[_0x7f33('0x29')]=function(_0x2285a8){var _0x25d8f3=this;return new Promise(function(_0x45172a,_0x122dde){return db['VoiceQueueReport']['create'](_0x2285a8[_0x7f33('0x2a')],{'raw':_0x2285a8[_0x7f33('0x21')]?_0x2285a8[_0x7f33('0x21')][_0x7f33('0x22')]===undefined?!![]:![]:!![]})[_0x7f33('0x13')](function(_0x5296cb){logger[_0x7f33('0x14')]('CreateVoiceQueueReport',_0x2285a8);logger[_0x7f33('0x17')](_0x7f33('0x29'),_0x2285a8,JSON[_0x7f33('0x19')](_0x5296cb));_0x45172a(_0x5296cb);})[_0x7f33('0x1d')](function(_0x3892ff){logger[_0x7f33('0x1a')](_0x7f33('0x29'),_0x3892ff[_0x7f33('0x1b')],_0x2285a8);_0x122dde(_0x25d8f3[_0x7f33('0x1a')](0x1f4,_0x3892ff['message']));});});};exports[_0x7f33('0x2b')]=function(_0x2b0705){var _0x33f5d6=this;return new Promise(function(_0x4b8f0f,_0x3ba8c0){return db[_0x7f33('0x1f')][_0x7f33('0x2c')](_0x2b0705[_0x7f33('0x2a')],{'raw':_0x2b0705[_0x7f33('0x21')]?_0x2b0705[_0x7f33('0x21')][_0x7f33('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b0705[_0x7f33('0x21')]?_0x2b0705[_0x7f33('0x21')]['where']||null:null,'attributes':_0x2b0705[_0x7f33('0x21')]?_0x2b0705[_0x7f33('0x21')][_0x7f33('0x24')]||null:null,'limit':_0x2b0705['options']?_0x2b0705[_0x7f33('0x21')][_0x7f33('0x25')]||null:null})[_0x7f33('0x13')](function(_0x462500){logger[_0x7f33('0x14')](_0x7f33('0x2b'),_0x2b0705);logger[_0x7f33('0x17')](_0x7f33('0x2b'),_0x2b0705,JSON[_0x7f33('0x19')](_0x462500));_0x4b8f0f(_0x462500);})[_0x7f33('0x1d')](function(_0x3df867){logger[_0x7f33('0x1a')](_0x7f33('0x2b'),_0x3df867[_0x7f33('0x1b')],_0x2b0705);_0x3ba8c0(_0x33f5d6[_0x7f33('0x1a')](0x1f4,_0x3df867['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 47fe146..bde4e51 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 _0xbfda=['./voiceQueueReport.events','save','remove','emit','register','length','voiceQueueReport:'];(function(_0x25de33,_0x5006e7){var _0x3587b4=function(_0x10e95e){while(--_0x10e95e){_0x25de33['push'](_0x25de33['shift']());}};_0x3587b4(++_0x5006e7);}(_0xbfda,0x1dc));var _0xabfd=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xbfda[_0x251e8c];return _0x1e0c1d;};'use strict';var VoiceQueueReportEvents=require(_0xabfd('0x0'));var events=[_0xabfd('0x1'),_0xabfd('0x2'),'update'];function createListener(_0xafe249,_0x51bb8a){return function(_0x3ba7f2){_0x51bb8a[_0xabfd('0x3')](_0xafe249,_0x3ba7f2);};}function removeListener(_0x384d8e,_0x3818ef){return function(){VoiceQueueReportEvents['removeListener'](_0x384d8e,_0x3818ef);};}exports[_0xabfd('0x4')]=function(_0x4c306b){for(var _0x1dbf70=0x0,_0x537d54=events[_0xabfd('0x5')];_0x1dbf70<_0x537d54;_0x1dbf70++){var _0x49368e=events[_0x1dbf70];var _0x29d5b5=createListener(_0xabfd('0x6')+_0x49368e,_0x4c306b);VoiceQueueReportEvents['on'](_0x49368e,_0x29d5b5);}}; \ No newline at end of file +var _0x5c37=['remove','update','emit','register','./voiceQueueReport.events','save'];(function(_0x4c4f48,_0x35110e){var _0x488c58=function(_0x89f768){while(--_0x89f768){_0x4c4f48['push'](_0x4c4f48['shift']());}};_0x488c58(++_0x35110e);}(_0x5c37,0x11e));var _0x75c3=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x5c37[_0x44bcb0];return _0xfaf881;};'use strict';var VoiceQueueReportEvents=require(_0x75c3('0x0'));var events=[_0x75c3('0x1'),_0x75c3('0x2'),_0x75c3('0x3')];function createListener(_0x2a3a11,_0x79e9a5){return function(_0x524eee){_0x79e9a5[_0x75c3('0x4')](_0x2a3a11,_0x524eee);};}function removeListener(_0x2e1094,_0x207698){return function(){VoiceQueueReportEvents['removeListener'](_0x2e1094,_0x207698);};}exports[_0x75c3('0x5')]=function(_0xbbeb0d){for(var _0x19dc3b=0x0,_0x3c19fa=events['length'];_0x19dc3b<_0x3c19fa;_0x19dc3b++){var _0x1c9a68=events[_0x19dc3b];var _0x5b9389=createListener('voiceQueueReport:'+_0x1c9a68,_0xbbeb0d);VoiceQueueReportEvents['on'](_0x1c9a68,_0x5b9389);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 043eec5..0b206ed 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 _0x6865=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','exports','util','path','connect-timeout','Router'];(function(_0x5515d1,_0x40adf6){var _0x1c4c55=function(_0x13dec3){while(--_0x13dec3){_0x5515d1['push'](_0x5515d1['shift']());}};_0x1c4c55(++_0x40adf6);}(_0x6865,0xa7));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x5686('0x0'));var path=require(_0x5686('0x1'));var timeout=require(_0x5686('0x2'));var express=require('express');var router=express[_0x5686('0x3')]();var fs_extra=require(_0x5686('0x4'));var auth=require(_0x5686('0x5'));var interaction=require(_0x5686('0x6'));var config=require(_0x5686('0x7'));var controller=require(_0x5686('0x8'));router[_0x5686('0x9')]('/',auth[_0x5686('0xa')](),controller[_0x5686('0xb')]);router['get']('/:id',auth[_0x5686('0xa')](),controller[_0x5686('0xc')]);router[_0x5686('0xd')]('/',auth[_0x5686('0xa')](),controller[_0x5686('0xe')]);router[_0x5686('0xf')](_0x5686('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5686('0x11')](_0x5686('0x10'),auth[_0x5686('0xa')](),controller['destroy']);module[_0x5686('0x12')]=router; \ No newline at end of file +var _0xb05d=['index','/:id','show','post','create','update','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb05d,0x187));var _0xdb05=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0xb05d[_0x4ea413];return _0x51cf25;};'use strict';var multer=require(_0xdb05('0x0'));var util=require('util');var path=require(_0xdb05('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb05('0x2'));var router=express[_0xdb05('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdb05('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdb05('0x5'));var controller=require(_0xdb05('0x6'));router[_0xdb05('0x7')]('/',auth[_0xdb05('0x8')](),controller[_0xdb05('0x9')]);router['get'](_0xdb05('0xa'),auth[_0xdb05('0x8')](),controller[_0xdb05('0xb')]);router[_0xdb05('0xc')]('/',auth[_0xdb05('0x8')](),controller[_0xdb05('0xd')]);router['put'](_0xdb05('0xa'),auth[_0xdb05('0x8')](),controller[_0xdb05('0xe')]);router['delete'](_0xdb05('0xa'),auth[_0xdb05('0x8')](),controller['destroy']);module[_0xdb05('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 898c58e..7a25259 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 _0x4527=['sequelize','exports','STRING','literal'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x4527,0x1c0));var _0x7452=function(_0x19ff64,_0x19f359){_0x19ff64=_0x19ff64-0x0;var _0x2b677b=_0x4527[_0x19ff64];return _0x2b677b;};'use strict';var Sequelize=require(_0x7452('0x0'));var moment=require('moment');module[_0x7452('0x1')]={'time':{'type':Sequelize[_0x7452('0x2')]},'callid':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7452('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x7452('0x3')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x9f36=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','STRING','DATE'];(function(_0x532de2,_0x28082a){var _0xf8a0bc=function(_0x3898f2){while(--_0x3898f2){_0x532de2['push'](_0x532de2['shift']());}};_0xf8a0bc(++_0x28082a);}(_0x9f36,0xe0));var _0x69f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9f36[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x69f3('0x0'));var moment=require('moment');module[_0x69f3('0x1')]={'time':{'type':Sequelize[_0x69f3('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x69f3('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x69f3('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x69f3('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x69f3('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x69f3('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x69f3('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x69f3('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x69f3('0x4')](_0x69f3('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b3fda02..0921885 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 _0x5829=['find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields'];(function(_0x4ea855,_0x342f7b){var _0x1fa24c=function(_0xda8bdf){while(--_0xda8bdf){_0x4ea855['push'](_0x4ea855['shift']());}};_0x1fa24c(++_0x342f7b);}(_0x5829,0x9e));var _0x9582=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x5829[_0x2d2c16];return _0x53f2fb;};'use strict';var emlformat=require(_0x9582('0x0'));var rimraf=require(_0x9582('0x1'));var zipdir=require(_0x9582('0x2'));var jsonpatch=require(_0x9582('0x3'));var rp=require(_0x9582('0x4'));var moment=require(_0x9582('0x5'));var BPromise=require(_0x9582('0x6'));var Mustache=require(_0x9582('0x7'));var util=require('util');var path=require(_0x9582('0x8'));var sox=require(_0x9582('0x9'));var csv=require(_0x9582('0xa'));var ejs=require(_0x9582('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9582('0xc'));var squel=require('squel');var crypto=require(_0x9582('0xd'));var jsforce=require(_0x9582('0xe'));var deskjs=require(_0x9582('0xf'));var toCsv=require(_0x9582('0xa'));var querystring=require('querystring');var Papa=require(_0x9582('0x10'));var Redis=require(_0x9582('0x11'));var authService=require(_0x9582('0x12'));var qs=require(_0x9582('0x13'));var as=require(_0x9582('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9582('0x15'));var utils=require(_0x9582('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9582('0x17'))['db'];function respondWithStatusCode(_0x4bb946,_0x35a246){_0x35a246=_0x35a246||0xcc;return function(_0x565898){if(_0x565898){return _0x4bb946[_0x9582('0x18')](_0x35a246);}return _0x4bb946[_0x9582('0x19')](_0x35a246)['end']();};}function respondWithResult(_0x152186,_0x5df377){_0x5df377=_0x5df377||0xc8;return function(_0xe57c99){if(_0xe57c99){return _0x152186[_0x9582('0x19')](_0x5df377)[_0x9582('0x1a')](_0xe57c99);}};}function respondWithFilteredResult(_0x16fb5b,_0x294d87){return function(_0x2c498a){if(_0x2c498a){var _0x5a4691=typeof _0x294d87[_0x9582('0x1b')]===_0x9582('0x1c')&&typeof _0x294d87[_0x9582('0x1d')]==='undefined';var _0x15718b=_0x2c498a[_0x9582('0x1e')];var _0x11753d=_0x5a4691?0x0:_0x294d87[_0x9582('0x1b')];var _0x3987b6=_0x5a4691?_0x2c498a[_0x9582('0x1e')]:_0x294d87[_0x9582('0x1b')]+_0x294d87[_0x9582('0x1d')];var _0x36b009;if(_0x3987b6>=_0x15718b){_0x3987b6=_0x15718b;_0x36b009=0xc8;}else{_0x36b009=0xce;}_0x16fb5b[_0x9582('0x19')](_0x36b009);return _0x16fb5b[_0x9582('0x1f')](_0x9582('0x20'),_0x11753d+'-'+_0x3987b6+'/'+_0x15718b)[_0x9582('0x1a')](_0x2c498a);}return null;};}function patchUpdates(_0x9741f0){return function(_0x57694a){try{jsonpatch[_0x9582('0x21')](_0x57694a,_0x9741f0,!![]);}catch(_0x117ffd){return BPromise[_0x9582('0x22')](_0x117ffd);}return _0x57694a[_0x9582('0x23')]();};}function saveUpdates(_0x4d78a0,_0x204551){return function(_0x1759ed){if(_0x1759ed){return _0x1759ed[_0x9582('0x24')](_0x4d78a0)[_0x9582('0x25')](function(_0x179f52){return _0x179f52;});}return null;};}function removeEntity(_0x40a001,_0x363af8){return function(_0x37af62){if(_0x37af62){return _0x37af62['destroy']()[_0x9582('0x25')](function(){_0x40a001['status'](0xcc)[_0x9582('0x26')]();});}};}function handleEntityNotFound(_0x15310f,_0x104299){return function(_0x145215){if(!_0x145215){_0x15310f[_0x9582('0x18')](0x194);}return _0x145215;};}function handleError(_0x5688d4,_0x2de839){_0x2de839=_0x2de839||0x1f4;return function(_0x5d5b0f){logger[_0x9582('0x27')](_0x5d5b0f[_0x9582('0x28')]);if(_0x5d5b0f[_0x9582('0x29')]){delete _0x5d5b0f[_0x9582('0x29')];}_0x5688d4[_0x9582('0x19')](_0x2de839)[_0x9582('0x2a')](_0x5d5b0f);};}exports[_0x9582('0x2b')]=function(_0x5b2ce0,_0x3f0ca3){var _0x5ee612={},_0x1836e1={},_0x2c40ae={'count':0x0,'rows':[]};var _0x547ccf=_[_0x9582('0x2c')](db[_0x9582('0x2d')][_0x9582('0x2e')],function(_0x580a30){return{'name':_0x580a30[_0x9582('0x2f')],'type':_0x580a30[_0x9582('0x30')][_0x9582('0x31')]};});_0x1836e1[_0x9582('0x32')]=_['map'](_0x547ccf,_0x9582('0x29'));_0x1836e1[_0x9582('0x33')]=_[_0x9582('0x34')](_0x5b2ce0[_0x9582('0x33')]);_0x1836e1[_0x9582('0x35')]=_['intersection'](_0x1836e1[_0x9582('0x32')],_0x1836e1[_0x9582('0x33')]);_0x5ee612[_0x9582('0x36')]=_[_0x9582('0x37')](_0x1836e1[_0x9582('0x32')],qs['fields'](_0x5b2ce0['query']['fields']));_0x5ee612[_0x9582('0x36')]=_0x5ee612[_0x9582('0x36')][_0x9582('0x38')]?_0x5ee612['attributes']:_0x1836e1[_0x9582('0x32')];if(!_0x5b2ce0[_0x9582('0x33')][_0x9582('0x39')](_0x9582('0x3a'))){_0x5ee612[_0x9582('0x1d')]=qs['limit'](_0x5b2ce0['query'][_0x9582('0x1d')]);_0x5ee612[_0x9582('0x1b')]=qs[_0x9582('0x1b')](_0x5b2ce0['query'][_0x9582('0x1b')]);}_0x5ee612['order']=qs[_0x9582('0x3b')](_0x5b2ce0['query'][_0x9582('0x3b')]);_0x5ee612[_0x9582('0x3c')]=qs[_0x9582('0x35')](_['pick'](_0x5b2ce0[_0x9582('0x33')],_0x1836e1[_0x9582('0x35')]),_0x547ccf);if(_0x5b2ce0[_0x9582('0x33')][_0x9582('0x3d')]){_0x5ee612['where']=_[_0x9582('0x3e')](_0x5ee612[_0x9582('0x3c')],{'$or':_['map'](_0x547ccf,function(_0xfcc33f){if(_0xfcc33f[_0x9582('0x30')]!==_0x9582('0x3f')){var _0x27a4c8={};_0x27a4c8[_0xfcc33f[_0x9582('0x29')]]={'$like':'%'+_0x5b2ce0['query'][_0x9582('0x3d')]+'%'};return _0x27a4c8;}})});}_0x5ee612=_[_0x9582('0x3e')]({},_0x5ee612,_0x5b2ce0[_0x9582('0x40')]);var _0xe98f76={'where':_0x5ee612['where']};return db['VoiceQueuesLog'][_0x9582('0x1e')](_0xe98f76)[_0x9582('0x25')](function(_0xfeb564){_0x2c40ae[_0x9582('0x1e')]=_0xfeb564;if(_0x5b2ce0[_0x9582('0x33')][_0x9582('0x41')]){_0x5ee612[_0x9582('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x9582('0x43')](_0x5ee612);})[_0x9582('0x25')](function(_0x3d51f4){_0x2c40ae[_0x9582('0x44')]=_0x3d51f4;return _0x2c40ae;})[_0x9582('0x25')](respondWithFilteredResult(_0x3f0ca3,_0x5ee612))[_0x9582('0x45')](handleError(_0x3f0ca3,null));};exports[_0x9582('0x46')]=function(_0x32800c,_0x13cdbd){var _0x4f3d51={'raw':!![],'where':{'id':_0x32800c[_0x9582('0x47')]['id']}},_0x1d0639={};_0x1d0639[_0x9582('0x32')]=_[_0x9582('0x34')](db[_0x9582('0x2d')]['rawAttributes']);_0x1d0639[_0x9582('0x33')]=_[_0x9582('0x34')](_0x32800c[_0x9582('0x33')]);_0x1d0639[_0x9582('0x35')]=_['intersection'](_0x1d0639['model'],_0x1d0639['query']);_0x4f3d51[_0x9582('0x36')]=_[_0x9582('0x37')](_0x1d0639[_0x9582('0x32')],qs['fields'](_0x32800c[_0x9582('0x33')][_0x9582('0x48')]));_0x4f3d51[_0x9582('0x36')]=_0x4f3d51[_0x9582('0x36')]['length']?_0x4f3d51['attributes']:_0x1d0639[_0x9582('0x32')];if(_0x32800c[_0x9582('0x33')][_0x9582('0x41')]){_0x4f3d51[_0x9582('0x42')]=[{'all':!![]}];}_0x4f3d51=_['merge']({},_0x4f3d51,_0x32800c[_0x9582('0x40')]);return db['VoiceQueuesLog'][_0x9582('0x49')](_0x4f3d51)['then'](handleEntityNotFound(_0x13cdbd,null))[_0x9582('0x25')](respondWithResult(_0x13cdbd,null))[_0x9582('0x45')](handleError(_0x13cdbd,null));};exports[_0x9582('0x4a')]=function(_0xc09a83,_0x4d0527){return db[_0x9582('0x2d')][_0x9582('0x4a')](_0xc09a83[_0x9582('0x4b')],{})['then'](respondWithResult(_0x4d0527,0xc9))['catch'](handleError(_0x4d0527,null));};exports[_0x9582('0x24')]=function(_0x1beb3f,_0x4dbe0e){if(_0x1beb3f[_0x9582('0x4b')]['id']){delete _0x1beb3f[_0x9582('0x4b')]['id'];}return db['VoiceQueuesLog'][_0x9582('0x49')]({'where':{'id':_0x1beb3f['params']['id']}})[_0x9582('0x25')](handleEntityNotFound(_0x4dbe0e,null))[_0x9582('0x25')](saveUpdates(_0x1beb3f[_0x9582('0x4b')],null))[_0x9582('0x25')](respondWithResult(_0x4dbe0e,null))[_0x9582('0x45')](handleError(_0x4dbe0e,null));};exports[_0x9582('0x4c')]=function(_0x130395,_0x1a3739){return db[_0x9582('0x2d')][_0x9582('0x49')]({'where':{'id':_0x130395[_0x9582('0x47')]['id']}})[_0x9582('0x25')](handleEntityNotFound(_0x1a3739,null))[_0x9582('0x25')](removeEntity(_0x1a3739,null))['catch'](handleError(_0x1a3739,null));}; \ No newline at end of file +var _0x50f7=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceQueuesLog','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','includeAll','include','findAll','rows','keys','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger'];(function(_0x290358,_0x38c9b8){var _0x10641c=function(_0x5ac7a9){while(--_0x5ac7a9){_0x290358['push'](_0x290358['shift']());}};_0x10641c(++_0x38c9b8);}(_0x50f7,0x7b));var _0x750f=function(_0x2b1886,_0x321e34){_0x2b1886=_0x2b1886-0x0;var _0x546684=_0x50f7[_0x2b1886];return _0x546684;};'use strict';var emlformat=require(_0x750f('0x0'));var rimraf=require(_0x750f('0x1'));var zipdir=require(_0x750f('0x2'));var jsonpatch=require(_0x750f('0x3'));var rp=require('request-promise');var moment=require(_0x750f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x750f('0x5'));var path=require(_0x750f('0x6'));var sox=require(_0x750f('0x7'));var csv=require(_0x750f('0x8'));var ejs=require(_0x750f('0x9'));var fs=require('fs');var fs_extra=require(_0x750f('0xa'));var _=require('lodash');var squel=require(_0x750f('0xb'));var crypto=require('crypto');var jsforce=require(_0x750f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x750f('0x8'));var querystring=require(_0x750f('0xd'));var Papa=require(_0x750f('0xe'));var Redis=require('ioredis');var authService=require(_0x750f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x750f('0x10'))(_0x750f('0x11'));var utils=require(_0x750f('0x12'));var config=require(_0x750f('0x13'));var licenseUtil=require(_0x750f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x473a42,_0x4459a7){_0x4459a7=_0x4459a7||0xcc;return function(_0x5d67bf){if(_0x5d67bf){return _0x473a42[_0x750f('0x15')](_0x4459a7);}return _0x473a42[_0x750f('0x16')](_0x4459a7)[_0x750f('0x17')]();};}function respondWithResult(_0x3b805a,_0x3a5492){_0x3a5492=_0x3a5492||0xc8;return function(_0x4b3fa5){if(_0x4b3fa5){return _0x3b805a[_0x750f('0x16')](_0x3a5492)[_0x750f('0x18')](_0x4b3fa5);}};}function respondWithFilteredResult(_0x55da9b,_0xa2b1cf){return function(_0x4b9d06){if(_0x4b9d06){var _0xfadb3a=typeof _0xa2b1cf[_0x750f('0x19')]===_0x750f('0x1a')&&typeof _0xa2b1cf['limit']===_0x750f('0x1a');var _0x460d2c=_0x4b9d06['count'];var _0x253605=_0xfadb3a?0x0:_0xa2b1cf['offset'];var _0x1cfc7d=_0xfadb3a?_0x4b9d06[_0x750f('0x1b')]:_0xa2b1cf[_0x750f('0x19')]+_0xa2b1cf[_0x750f('0x1c')];var _0x2e0a23;if(_0x1cfc7d>=_0x460d2c){_0x1cfc7d=_0x460d2c;_0x2e0a23=0xc8;}else{_0x2e0a23=0xce;}_0x55da9b[_0x750f('0x16')](_0x2e0a23);return _0x55da9b['set'](_0x750f('0x1d'),_0x253605+'-'+_0x1cfc7d+'/'+_0x460d2c)[_0x750f('0x18')](_0x4b9d06);}return null;};}function patchUpdates(_0x52db5e){return function(_0x27f867){try{jsonpatch[_0x750f('0x1e')](_0x27f867,_0x52db5e,!![]);}catch(_0x3a214b){return BPromise[_0x750f('0x1f')](_0x3a214b);}return _0x27f867[_0x750f('0x20')]();};}function saveUpdates(_0x23da33,_0x585806){return function(_0x4d274e){if(_0x4d274e){return _0x4d274e[_0x750f('0x21')](_0x23da33)[_0x750f('0x22')](function(_0x50aa52){return _0x50aa52;});}return null;};}function removeEntity(_0x450d12,_0x45f13f){return function(_0x34f973){if(_0x34f973){return _0x34f973[_0x750f('0x23')]()[_0x750f('0x22')](function(){_0x450d12[_0x750f('0x16')](0xcc)[_0x750f('0x17')]();});}};}function handleEntityNotFound(_0x2f3b09,_0x46e508){return function(_0x429992){if(!_0x429992){_0x2f3b09[_0x750f('0x15')](0x194);}return _0x429992;};}function handleError(_0x2fe6d5,_0x1f7872){_0x1f7872=_0x1f7872||0x1f4;return function(_0x45ae2e){logger[_0x750f('0x24')](_0x45ae2e['stack']);if(_0x45ae2e[_0x750f('0x25')]){delete _0x45ae2e[_0x750f('0x25')];}_0x2fe6d5[_0x750f('0x16')](_0x1f7872)[_0x750f('0x26')](_0x45ae2e);};}exports[_0x750f('0x27')]=function(_0xa90f4e,_0x248fe8){var _0x231cdd={},_0xf196c0={},_0x3d3fb2={'count':0x0,'rows':[]};var _0x307027=_[_0x750f('0x28')](db[_0x750f('0x29')]['rawAttributes'],function(_0x5f4e65){return{'name':_0x5f4e65['fieldName'],'type':_0x5f4e65[_0x750f('0x2a')][_0x750f('0x2b')]};});_0xf196c0[_0x750f('0x2c')]=_[_0x750f('0x28')](_0x307027,_0x750f('0x25'));_0xf196c0['query']=_['keys'](_0xa90f4e[_0x750f('0x2d')]);_0xf196c0[_0x750f('0x2e')]=_[_0x750f('0x2f')](_0xf196c0[_0x750f('0x2c')],_0xf196c0['query']);_0x231cdd[_0x750f('0x30')]=_[_0x750f('0x2f')](_0xf196c0['model'],qs[_0x750f('0x31')](_0xa90f4e[_0x750f('0x2d')][_0x750f('0x31')]));_0x231cdd['attributes']=_0x231cdd[_0x750f('0x30')][_0x750f('0x32')]?_0x231cdd[_0x750f('0x30')]:_0xf196c0[_0x750f('0x2c')];if(!_0xa90f4e[_0x750f('0x2d')][_0x750f('0x33')](_0x750f('0x34'))){_0x231cdd[_0x750f('0x1c')]=qs[_0x750f('0x1c')](_0xa90f4e[_0x750f('0x2d')][_0x750f('0x1c')]);_0x231cdd['offset']=qs[_0x750f('0x19')](_0xa90f4e[_0x750f('0x2d')][_0x750f('0x19')]);}_0x231cdd[_0x750f('0x35')]=qs[_0x750f('0x36')](_0xa90f4e[_0x750f('0x2d')][_0x750f('0x36')]);_0x231cdd['where']=qs[_0x750f('0x2e')](_[_0x750f('0x37')](_0xa90f4e[_0x750f('0x2d')],_0xf196c0[_0x750f('0x2e')]),_0x307027);if(_0xa90f4e[_0x750f('0x2d')][_0x750f('0x38')]){_0x231cdd['where']=_[_0x750f('0x39')](_0x231cdd[_0x750f('0x3a')],{'$or':_[_0x750f('0x28')](_0x307027,function(_0x500095){if(_0x500095[_0x750f('0x2a')]!=='VIRTUAL'){var _0x413c5f={};_0x413c5f[_0x500095[_0x750f('0x25')]]={'$like':'%'+_0xa90f4e[_0x750f('0x2d')][_0x750f('0x38')]+'%'};return _0x413c5f;}})});}_0x231cdd=_['merge']({},_0x231cdd,_0xa90f4e['options']);var _0x4e1983={'where':_0x231cdd[_0x750f('0x3a')]};return db[_0x750f('0x29')][_0x750f('0x1b')](_0x4e1983)[_0x750f('0x22')](function(_0x5a8f87){_0x3d3fb2[_0x750f('0x1b')]=_0x5a8f87;if(_0xa90f4e[_0x750f('0x2d')][_0x750f('0x3b')]){_0x231cdd[_0x750f('0x3c')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x750f('0x3d')](_0x231cdd);})[_0x750f('0x22')](function(_0x4d966c){_0x3d3fb2[_0x750f('0x3e')]=_0x4d966c;return _0x3d3fb2;})['then'](respondWithFilteredResult(_0x248fe8,_0x231cdd))['catch'](handleError(_0x248fe8,null));};exports['show']=function(_0x5f4074,_0x2b7559){var _0x1618f8={'raw':!![],'where':{'id':_0x5f4074['params']['id']}},_0x5d4603={};_0x5d4603['model']=_[_0x750f('0x3f')](db[_0x750f('0x29')]['rawAttributes']);_0x5d4603[_0x750f('0x2d')]=_[_0x750f('0x3f')](_0x5f4074[_0x750f('0x2d')]);_0x5d4603[_0x750f('0x2e')]=_[_0x750f('0x2f')](_0x5d4603[_0x750f('0x2c')],_0x5d4603['query']);_0x1618f8['attributes']=_[_0x750f('0x2f')](_0x5d4603[_0x750f('0x2c')],qs[_0x750f('0x31')](_0x5f4074['query']['fields']));_0x1618f8[_0x750f('0x30')]=_0x1618f8[_0x750f('0x30')][_0x750f('0x32')]?_0x1618f8[_0x750f('0x30')]:_0x5d4603[_0x750f('0x2c')];if(_0x5f4074[_0x750f('0x2d')][_0x750f('0x3b')]){_0x1618f8['include']=[{'all':!![]}];}_0x1618f8=_[_0x750f('0x39')]({},_0x1618f8,_0x5f4074[_0x750f('0x40')]);return db[_0x750f('0x29')][_0x750f('0x41')](_0x1618f8)[_0x750f('0x22')](handleEntityNotFound(_0x2b7559,null))[_0x750f('0x22')](respondWithResult(_0x2b7559,null))[_0x750f('0x42')](handleError(_0x2b7559,null));};exports[_0x750f('0x43')]=function(_0x17b1eb,_0x55e5e2){return db[_0x750f('0x29')][_0x750f('0x43')](_0x17b1eb[_0x750f('0x44')],{})[_0x750f('0x22')](respondWithResult(_0x55e5e2,0xc9))[_0x750f('0x42')](handleError(_0x55e5e2,null));};exports[_0x750f('0x21')]=function(_0x4041c2,_0x2262b2){if(_0x4041c2['body']['id']){delete _0x4041c2[_0x750f('0x44')]['id'];}return db[_0x750f('0x29')][_0x750f('0x41')]({'where':{'id':_0x4041c2[_0x750f('0x45')]['id']}})['then'](handleEntityNotFound(_0x2262b2,null))['then'](saveUpdates(_0x4041c2[_0x750f('0x44')],null))[_0x750f('0x22')](respondWithResult(_0x2262b2,null))[_0x750f('0x42')](handleError(_0x2262b2,null));};exports[_0x750f('0x23')]=function(_0x336ccb,_0x5bc8ba){return db[_0x750f('0x29')]['find']({'where':{'id':_0x336ccb[_0x750f('0x45')]['id']}})[_0x750f('0x22')](handleEntityNotFound(_0x5bc8ba,null))[_0x750f('0x22')](removeEntity(_0x5bc8ba,null))[_0x750f('0x42')](handleError(_0x5bc8ba,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 73ee32c..e5cb1d2 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 _0x9f94=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger'];(function(_0x13282f,_0x5cd763){var _0x2c96c4=function(_0x2b4b24){while(--_0x2b4b24){_0x13282f['push'](_0x13282f['shift']());}};_0x2c96c4(++_0x5cd763);}(_0x9f94,0x1e7));var _0x49f9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9f94[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x49f9('0x0'));var util=require(_0x49f9('0x1'));var logger=require(_0x49f9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x49f9('0x3'));var rp=require(_0x49f9('0x4'));var fs=require('fs');var path=require(_0x49f9('0x5'));var rimraf=require(_0x49f9('0x6'));var config=require(_0x49f9('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x49f9('0x8')]=function(_0x31a7fe,_0x3cd35a){return _0x31a7fe[_0x49f9('0x9')](_0x49f9('0xa'),attributes,{'tableName':_0x49f9('0xb'),'paranoid':![],'indexes':[{'name':_0x49f9('0xc'),'fields':[_0x49f9('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xcad2=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ce433,_0xb84c64){var _0x3359bc=function(_0x59fb04){while(--_0x59fb04){_0x3ce433['push'](_0x3ce433['shift']());}};_0x3359bc(++_0xb84c64);}(_0xcad2,0x120));var _0x2cad=function(_0x14be7a,_0x250c92){_0x14be7a=_0x14be7a-0x0;var _0xa2db6b=_0xcad2[_0x14be7a];return _0xa2db6b;};'use strict';var _=require('lodash');var util=require(_0x2cad('0x0'));var logger=require(_0x2cad('0x1'))(_0x2cad('0x2'));var moment=require(_0x2cad('0x3'));var BPromise=require(_0x2cad('0x4'));var rp=require(_0x2cad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cad('0x6'));var config=require(_0x2cad('0x7'));var attributes=require(_0x2cad('0x8'));module[_0x2cad('0x9')]=function(_0x117769,_0x168ecb){return _0x117769[_0x2cad('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0x2cad('0xb'),'paranoid':![],'indexes':[{'name':_0x2cad('0xc'),'fields':[_0x2cad('0xd'),'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 bbff331..98d40de 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 _0xfd8e=['randomstring','ioredis','../../config/logger','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x15029f,_0x58be73){var _0x36688c=function(_0xc6062){while(--_0xc6062){_0x15029f['push'](_0x15029f['shift']());}};_0x36688c(++_0x58be73);}(_0xfd8e,0xa4));var _0xefd8=function(_0x58998c,_0x2b9ab4){_0x58998c=_0x58998c-0x0;var _0x9789db=_0xfd8e[_0x58998c];return _0x9789db;};'use strict';var _=require(_0xefd8('0x0'));var util=require(_0xefd8('0x1'));var moment=require(_0xefd8('0x2'));var BPromise=require(_0xefd8('0x3'));var rs=require(_0xefd8('0x4'));var fs=require('fs');var Redis=require(_0xefd8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xefd8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xefd8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x112abd,_0x484397,_0x389311){return new BPromise(function(_0x5aaf2e,_0x667de6){return client[_0xefd8('0x8')](_0x112abd,_0x389311)[_0xefd8('0x9')](function(_0x1a3d1c){logger[_0xefd8('0xa')](_0xefd8('0xb'),_0x484397,_0xefd8('0xc'));logger[_0xefd8('0xd')](_0xefd8('0xe'),_0x484397,_0xefd8('0xc'),JSON[_0xefd8('0xf')](_0x1a3d1c));if(_0x1a3d1c[_0xefd8('0x10')]){if(_0x1a3d1c[_0xefd8('0x10')][_0xefd8('0x11')]===0x1f4){logger['error'](_0xefd8('0xb'),_0x484397,_0x1a3d1c[_0xefd8('0x10')]['message']);return _0x667de6(_0x1a3d1c[_0xefd8('0x10')][_0xefd8('0x12')]);}logger[_0xefd8('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x484397,_0x1a3d1c['error']['message']);return _0x5aaf2e(_0x1a3d1c[_0xefd8('0x10')][_0xefd8('0x12')]);}else{logger[_0xefd8('0xa')](_0xefd8('0xb'),_0x484397,_0xefd8('0xc'));_0x5aaf2e(_0x1a3d1c[_0xefd8('0x13')][_0xefd8('0x12')]);}})[_0xefd8('0x14')](function(_0x1c15d7){logger['error'](_0xefd8('0xb'),_0x484397,_0x1c15d7);_0x667de6(_0x1c15d7);});});} \ No newline at end of file +var _0xbc50=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0xe204c3,_0xdc4dcf){var _0x2df1e2=function(_0x2db0c7){while(--_0x2db0c7){_0xe204c3['push'](_0xe204c3['shift']());}};_0x2df1e2(++_0xdc4dcf);}(_0xbc50,0x85));var _0x0bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0bc5('0x0'));var BPromise=require('bluebird');var rs=require(_0x0bc5('0x1'));var fs=require('fs');var Redis=require(_0x0bc5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bc5('0x3'));var logger=require(_0x0bc5('0x4'))(_0x0bc5('0x5'));var config=require(_0x0bc5('0x6'));var jayson=require(_0x0bc5('0x7'));var client=jayson['client'][_0x0bc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53d57b,_0x411946,_0x12a938){return new BPromise(function(_0x51ed70,_0x296aea){return client['request'](_0x53d57b,_0x12a938)['then'](function(_0x3ed3f4){logger[_0x0bc5('0x9')](_0x0bc5('0xa'),_0x411946,_0x0bc5('0xb'));logger[_0x0bc5('0xc')](_0x0bc5('0xd'),_0x411946,_0x0bc5('0xb'),JSON[_0x0bc5('0xe')](_0x3ed3f4));if(_0x3ed3f4[_0x0bc5('0xf')]){if(_0x3ed3f4[_0x0bc5('0xf')]['code']===0x1f4){logger[_0x0bc5('0xf')](_0x0bc5('0xa'),_0x411946,_0x3ed3f4[_0x0bc5('0xf')][_0x0bc5('0x10')]);return _0x296aea(_0x3ed3f4[_0x0bc5('0xf')][_0x0bc5('0x10')]);}logger[_0x0bc5('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x411946,_0x3ed3f4[_0x0bc5('0xf')][_0x0bc5('0x10')]);return _0x51ed70(_0x3ed3f4['error']['message']);}else{logger['info'](_0x0bc5('0xa'),_0x411946,_0x0bc5('0xb'));_0x51ed70(_0x3ed3f4[_0x0bc5('0x11')]['message']);}})[_0x0bc5('0x12')](function(_0x2b4194){logger[_0x0bc5('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x411946,_0x2b4194);_0x296aea(_0x2b4194);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 4921d91..6596277 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 _0xede0=['put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xede0,0xa0));var _0x0ede=function(_0x5372e6,_0x38b930){_0x5372e6=_0x5372e6-0x0;var _0x4ea514=_0xede0[_0x5372e6];return _0x4ea514;};'use strict';var multer=require(_0x0ede('0x0'));var util=require('util');var path=require(_0x0ede('0x1'));var timeout=require(_0x0ede('0x2'));var express=require('express');var router=express[_0x0ede('0x3')]();var fs_extra=require(_0x0ede('0x4'));var auth=require(_0x0ede('0x5'));var interaction=require(_0x0ede('0x6'));var config=require(_0x0ede('0x7'));var controller=require('./voiceRecording.controller');router[_0x0ede('0x8')]('/',auth['isAuthenticated'](),controller[_0x0ede('0x9')]);router[_0x0ede('0x8')](_0x0ede('0xa'),auth[_0x0ede('0xb')](),controller[_0x0ede('0xc')]);router[_0x0ede('0x8')](_0x0ede('0xd'),auth[_0x0ede('0xb')](),controller[_0x0ede('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x0ede('0x8')](_0x0ede('0xf'),controller[_0x0ede('0x10')]);router[_0x0ede('0x8')](_0x0ede('0x11'),auth[_0x0ede('0xb')](),controller[_0x0ede('0x12')]);router[_0x0ede('0x13')]('/',auth['isAuthenticated'](),controller[_0x0ede('0x14')]);router[_0x0ede('0x13')](_0x0ede('0x11'),auth['isAuthenticated'](),controller[_0x0ede('0x15')]);router[_0x0ede('0x16')]('/:id',auth[_0x0ede('0xb')](),controller[_0x0ede('0x17')]);router['delete']('/:id',auth[_0x0ede('0xb')](),controller[_0x0ede('0x18')]);module[_0x0ede('0x19')]=router; \ No newline at end of file +var _0x0fb1=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x4b0e21,_0x1ce4ee){var _0x5deda6=function(_0x13f5ab){while(--_0x13f5ab){_0x4b0e21['push'](_0x4b0e21['shift']());}};_0x5deda6(++_0x1ce4ee);}(_0x0fb1,0x128));var _0x10fb=function(_0x260a39,_0x53ce91){_0x260a39=_0x260a39-0x0;var _0xd38dfd=_0x0fb1[_0x260a39];return _0xd38dfd;};'use strict';var multer=require(_0x10fb('0x0'));var util=require(_0x10fb('0x1'));var path=require(_0x10fb('0x2'));var timeout=require(_0x10fb('0x3'));var express=require(_0x10fb('0x4'));var router=express[_0x10fb('0x5')]();var fs_extra=require(_0x10fb('0x6'));var auth=require(_0x10fb('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x10fb('0x8'));var controller=require('./voiceRecording.controller');router[_0x10fb('0x9')]('/',auth['isAuthenticated'](),controller[_0x10fb('0xa')]);router['get'](_0x10fb('0xb'),auth[_0x10fb('0xc')](),controller[_0x10fb('0xd')]);router[_0x10fb('0x9')](_0x10fb('0xe'),auth[_0x10fb('0xc')](),controller[_0x10fb('0xf')]);router[_0x10fb('0x9')]('/:id/download',auth[_0x10fb('0xc')](),controller['download']);router[_0x10fb('0x9')](_0x10fb('0x10'),controller[_0x10fb('0x11')]);router[_0x10fb('0x9')](_0x10fb('0x12'),auth[_0x10fb('0xc')](),controller[_0x10fb('0x13')]);router[_0x10fb('0x14')]('/',auth[_0x10fb('0xc')](),controller['create']);router[_0x10fb('0x14')]('/:id/transcribe',auth[_0x10fb('0xc')](),controller[_0x10fb('0x15')]);router[_0x10fb('0x16')](_0x10fb('0xe'),auth[_0x10fb('0xc')](),controller[_0x10fb('0x17')]);router['delete']('/:id',auth[_0x10fb('0xc')](),controller[_0x10fb('0x18')]);module[_0x10fb('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 3d90f34..7227237 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 e590e39..5eec2db 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 _0x3508=['VoiceRecording','rawAttributes','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','options','find','create','body','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','ValidationError','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','recording','Setting','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map'];(function(_0x66ede1,_0x229cbc){var _0x446691=function(_0x47bff8){while(--_0x47bff8){_0x66ede1['push'](_0x66ede1['shift']());}};_0x446691(++_0x229cbc);}(_0x3508,0x1a5));var _0x8350=function(_0x5d76f4,_0x5017b3){_0x5d76f4=_0x5d76f4-0x0;var _0x43c615=_0x3508[_0x5d76f4];return _0x43c615;};'use strict';var emlformat=require(_0x8350('0x0'));var rimraf=require(_0x8350('0x1'));var zipdir=require(_0x8350('0x2'));var jsonpatch=require(_0x8350('0x3'));var rp=require(_0x8350('0x4'));var moment=require(_0x8350('0x5'));var BPromise=require(_0x8350('0x6'));var Mustache=require(_0x8350('0x7'));var util=require(_0x8350('0x8'));var path=require('path');var sox=require(_0x8350('0x9'));var csv=require(_0x8350('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8350('0xb'));var _=require('lodash');var squel=require(_0x8350('0xc'));var crypto=require(_0x8350('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8350('0xe'));var toCsv=require(_0x8350('0xa'));var querystring=require(_0x8350('0xf'));var Papa=require(_0x8350('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x8350('0x11'));var Redis=require(_0x8350('0x12'));var authService=require(_0x8350('0x13'));var qs=require(_0x8350('0x14'));var as=require(_0x8350('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8350('0x16'))('api');var utils=require(_0x8350('0x17'));var config=require(_0x8350('0x18'));var licenseUtil=require(_0x8350('0x19'));var db=require(_0x8350('0x1a'))['db'];function respondWithStatusCode(_0x52ef76,_0x14c8d0){_0x14c8d0=_0x14c8d0||0xcc;return function(_0x84c6fb){if(_0x84c6fb){return _0x52ef76[_0x8350('0x1b')](_0x14c8d0);}return _0x52ef76[_0x8350('0x1c')](_0x14c8d0)[_0x8350('0x1d')]();};}function respondWithResult(_0xc0e821,_0x582dbf){_0x582dbf=_0x582dbf||0xc8;return function(_0x1bad5b){if(_0x1bad5b){return _0xc0e821[_0x8350('0x1c')](_0x582dbf)[_0x8350('0x1e')](_0x1bad5b);}};}function respondWithFilteredResult(_0x5b25bf,_0x240ae5){return function(_0x20d705){if(_0x20d705){var _0x289b41=typeof _0x240ae5['offset']==='undefined'&&typeof _0x240ae5[_0x8350('0x1f')]===_0x8350('0x20');var _0x4c7d0e=_0x20d705['count'];var _0x147bf3=_0x289b41?0x0:_0x240ae5['offset'];var _0x2509f5=_0x289b41?_0x20d705[_0x8350('0x21')]:_0x240ae5[_0x8350('0x22')]+_0x240ae5[_0x8350('0x1f')];var _0xa25a08;if(_0x2509f5>=_0x4c7d0e){_0x2509f5=_0x4c7d0e;_0xa25a08=0xc8;}else{_0xa25a08=0xce;}_0x5b25bf[_0x8350('0x1c')](_0xa25a08);return _0x5b25bf[_0x8350('0x23')](_0x8350('0x24'),_0x147bf3+'-'+_0x2509f5+'/'+_0x4c7d0e)['json'](_0x20d705);}return null;};}function patchUpdates(_0x261924){return function(_0x4d5972){try{jsonpatch[_0x8350('0x25')](_0x4d5972,_0x261924,!![]);}catch(_0x432c47){return BPromise[_0x8350('0x26')](_0x432c47);}return _0x4d5972[_0x8350('0x27')]();};}function saveUpdates(_0x531710,_0x180464){return function(_0x274770){if(_0x274770){return _0x274770['update'](_0x531710)[_0x8350('0x28')](function(_0x49d9ac){return _0x49d9ac;});}return null;};}function removeEntity(_0x2ab375,_0x409550){return function(_0x10deb0){if(_0x10deb0){return _0x10deb0[_0x8350('0x29')]()[_0x8350('0x28')](function(){_0x2ab375[_0x8350('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeea37,_0x664abe){return function(_0x17aac0){if(!_0x17aac0){_0xeea37[_0x8350('0x1b')](0x194);}return _0x17aac0;};}function handleError(_0x3917e3,_0x5deda4){_0x5deda4=_0x5deda4||0x1f4;return function(_0x561f59){logger[_0x8350('0x2a')](_0x561f59['stack']);if(_0x561f59[_0x8350('0x2b')]){delete _0x561f59['name'];}_0x3917e3[_0x8350('0x1c')](_0x5deda4)[_0x8350('0x2c')](_0x561f59);};}exports[_0x8350('0x2d')]=function(_0x13b5d1,_0x2e441a){var _0x4aed0a={},_0x3cfed1={},_0x10576d={'count':0x0,'rows':[]};var _0x334ef9=_[_0x8350('0x2e')](db[_0x8350('0x2f')][_0x8350('0x30')],function(_0x34819a){return{'name':_0x34819a['fieldName'],'type':_0x34819a['type'][_0x8350('0x31')]};});_0x3cfed1[_0x8350('0x32')]=_[_0x8350('0x33')](_[_0x8350('0x2e')](_0x334ef9,_0x8350('0x2b')),[_0x8350('0x34')]);_0x3cfed1[_0x8350('0x35')]=_[_0x8350('0x36')](_0x13b5d1[_0x8350('0x35')]);_0x3cfed1['filters']=_[_0x8350('0x37')](_0x3cfed1[_0x8350('0x32')],_0x3cfed1[_0x8350('0x35')]);_0x4aed0a[_0x8350('0x38')]=_['intersection'](_0x3cfed1['model'],qs[_0x8350('0x39')](_0x13b5d1['query'][_0x8350('0x39')]));_0x4aed0a[_0x8350('0x38')]=_0x4aed0a['attributes'][_0x8350('0x3a')]?_0x4aed0a[_0x8350('0x38')]:_0x3cfed1[_0x8350('0x32')];if(!_0x13b5d1[_0x8350('0x35')][_0x8350('0x3b')](_0x8350('0x3c'))){_0x4aed0a['limit']=qs[_0x8350('0x1f')](_0x13b5d1[_0x8350('0x35')]['limit']);_0x4aed0a['offset']=qs[_0x8350('0x22')](_0x13b5d1[_0x8350('0x35')]['offset']);}_0x4aed0a[_0x8350('0x3d')]=qs[_0x8350('0x3e')](_0x13b5d1[_0x8350('0x35')][_0x8350('0x3e')]);_0x4aed0a['where']=qs[_0x8350('0x3f')](_[_0x8350('0x40')](_0x13b5d1[_0x8350('0x35')],_0x3cfed1[_0x8350('0x3f')]),_0x334ef9);if(_0x13b5d1['query'][_0x8350('0x41')]){_0x4aed0a[_0x8350('0x42')]=_['merge'](_0x4aed0a['where'],{'$or':_['map'](_0x334ef9,function(_0x20990b){if(_0x20990b['type']!==_0x8350('0x43')){var _0x42b329={};_0x42b329[_0x20990b['name']]={'$like':'%'+_0x13b5d1[_0x8350('0x35')][_0x8350('0x41')]+'%'};return _0x42b329;}})});}_0x4aed0a=_[_0x8350('0x44')]({},_0x4aed0a,_0x13b5d1['options']);var _0x3fe935={'where':_0x4aed0a['where']};return db[_0x8350('0x2f')]['count'](_0x3fe935)[_0x8350('0x28')](function(_0x12c56b){_0x10576d[_0x8350('0x21')]=_0x12c56b;if(_0x13b5d1['query'][_0x8350('0x45')]){_0x4aed0a['include']=[{'all':!![]}];}return db[_0x8350('0x2f')][_0x8350('0x46')](_0x4aed0a);})[_0x8350('0x28')](function(_0x4fe600){_0x10576d[_0x8350('0x47')]=_0x4fe600;return _0x10576d;})[_0x8350('0x28')](respondWithFilteredResult(_0x2e441a,_0x4aed0a))[_0x8350('0x48')](handleError(_0x2e441a,null));};exports[_0x8350('0x49')]=function(_0x41c862,_0x5da792){var _0xb0fc4c={'raw':![],'where':{'id':_0x41c862[_0x8350('0x4a')]['id']}},_0x38a545={};_0x38a545['model']=_['keys'](db[_0x8350('0x2f')][_0x8350('0x30')]);_0x38a545[_0x8350('0x35')]=_[_0x8350('0x36')](_0x41c862['query']);_0x38a545[_0x8350('0x3f')]=_['intersection'](_0x38a545[_0x8350('0x32')],_0x38a545['query']);_0xb0fc4c[_0x8350('0x38')]=_['intersection'](_0x38a545[_0x8350('0x32')],qs[_0x8350('0x39')](_0x41c862[_0x8350('0x35')]['fields']));_0xb0fc4c[_0x8350('0x38')]=_0xb0fc4c['attributes'][_0x8350('0x3a')]?_0xb0fc4c[_0x8350('0x38')]:_0x38a545[_0x8350('0x32')];if(_0x41c862[_0x8350('0x35')][_0x8350('0x45')]){_0xb0fc4c['include']=[{'all':!![]}];}_0xb0fc4c=_[_0x8350('0x44')]({},_0xb0fc4c,_0x41c862[_0x8350('0x4b')]);return db['VoiceRecording'][_0x8350('0x4c')](_0xb0fc4c)[_0x8350('0x28')](handleEntityNotFound(_0x5da792,null))['then'](respondWithResult(_0x5da792,null))[_0x8350('0x48')](handleError(_0x5da792,null));};exports['create']=function(_0xc2f44f,_0x55bb87){return db[_0x8350('0x2f')][_0x8350('0x4d')](_0xc2f44f[_0x8350('0x4e')],{})['then'](respondWithResult(_0x55bb87,0xc9))[_0x8350('0x48')](handleError(_0x55bb87,null));};exports['update']=function(_0x195c78,_0xb2b22e){if(_0x195c78[_0x8350('0x4e')]['id']){delete _0x195c78[_0x8350('0x4e')]['id'];}return db[_0x8350('0x2f')][_0x8350('0x4c')]({'where':{'id':_0x195c78[_0x8350('0x4a')]['id']}})[_0x8350('0x28')](handleEntityNotFound(_0xb2b22e,null))[_0x8350('0x28')](saveUpdates(_0x195c78['body'],null))['then'](respondWithResult(_0xb2b22e,null))['catch'](handleError(_0xb2b22e,null));};exports[_0x8350('0x4f')]=function(_0x2c9b67,_0x37879f){return db[_0x8350('0x2f')][_0x8350('0x4f')]()[_0x8350('0x28')](respondWithResult(_0x37879f,null))['catch'](handleError(_0x37879f,null));};exports[_0x8350('0x50')]=function(_0x5ca912,_0x3581e5,_0x3bc7ad){var _0xb0e9dc=require(_0x8350('0x51'));var _0x26c0e4=![];var _0x206838={};if(_0x5ca912[_0x8350('0x35')]['type']&&_0x5ca912['query'][_0x8350('0x52')]===_0x8350('0x53')){_0x206838[_0x8350('0x53')]=_0x5ca912['params']['id'];}else{_0x206838['id']=_0x5ca912['params']['id'];}return db[_0x8350('0x2f')][_0x8350('0x4c')]({'where':_0x206838,'attributes':['id',_0x8350('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x3581e5,null))[_0x8350('0x28')](function(_0x20afe0){if(_0x20afe0){var _0x591fc0=_0x20afe0[_0x8350('0x54')];var _0x3f2992=util[_0x8350('0x34')](_0x8350('0x55'),_0x591fc0);if(fs[_0x8350('0x56')](_0x3f2992)){_0x26c0e4=!![];return _0xb0e9dc['decryptFile'](_0x3f2992,_0x591fc0,config[_0x8350('0x57')]['recording'])[_0x8350('0x28')](function(){return _0x20afe0;});}return _0x20afe0;}})['then'](function(_0x2cec1d){if(_0x2cec1d){var _0x3f123a=_0x2cec1d[_0x8350('0x54')];if(!fs[_0x8350('0x56')](_0x3f123a)){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x2cec1d['filename']){return _0x3581e5[_0x8350('0x50')](_0x3f123a,_0x2cec1d[_0x8350('0x5a')]+path['extname'](_0x3f123a),function(){if(_0x26c0e4){fs[_0x8350('0x5b')](_0x3f123a);}});}else{return _0x3581e5[_0x8350('0x50')](_0x3f123a,function(_0xd971ac){if(_0x26c0e4){fs[_0x8350('0x5b')](_0x3f123a);}});}}})['catch'](function(_0x1aaa80){if(_0x1aaa80[_0x8350('0x5c')]==='VoiceRecording\x20not\x20found'){_0x3581e5[_0x8350('0x1c')](0x194)[_0x8350('0x2c')](_0x8350('0x5d'));}else{return handleError(_0x3581e5,null);}});};exports[_0x8350('0x5e')]=function(_0x5ab01d,_0x21cbe4,_0x1ffb47){var _0x1d8a29=require(_0x8350('0x51'));var _0x5d51dd=![];var _0xdb287c={'$and':[db['sequelize'][_0x8350('0x42')](db[_0x8350('0x5f')]['fn'](_0x8350('0x60'),db[_0x8350('0x5f')][_0x8350('0x61')](_0x8350('0x53'))),_0x5ab01d[_0x8350('0x35')][_0x8350('0x62')])]};if(_0x5ab01d[_0x8350('0x35')][_0x8350('0x52')]&&_0x5ab01d[_0x8350('0x35')][_0x8350('0x52')]===_0x8350('0x53')){_0xdb287c[_0x8350('0x63')][_0x8350('0x64')]({'uniqueid':_0x5ab01d[_0x8350('0x4a')]['id']});}else{_0xdb287c[_0x8350('0x63')][_0x8350('0x64')]({'id':_0x5ab01d[_0x8350('0x4a')]['id']});}return db[_0x8350('0x2f')][_0x8350('0x4c')]({'where':_0xdb287c,'attributes':['id',_0x8350('0x54')],'raw':!![]})[_0x8350('0x28')](handleEntityNotFound(_0x21cbe4,null))['then'](function(_0x2d8d27){if(_0x2d8d27){var _0x5d3580=util[_0x8350('0x34')]('%s.cypher',_0x2d8d27['value']);if(fs[_0x8350('0x56')](_0x5d3580)){_0x5d51dd=!![];return _0x1d8a29[_0x8350('0x65')](_0x5d3580,_0x2d8d27[_0x8350('0x54')],config['secrets']['recording'])[_0x8350('0x28')](function(){return _0x2d8d27;});}return _0x2d8d27;}})[_0x8350('0x28')](function(_0x15b67f){if(_0x15b67f){if(!fs[_0x8350('0x56')](_0x15b67f[_0x8350('0x54')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x15b67f[_0x8350('0x5a')]){return _0x21cbe4['download'](_0x15b67f[_0x8350('0x54')],_0x15b67f[_0x8350('0x5a')]+path[_0x8350('0x66')](_0x15b67f[_0x8350('0x54')]),function(){if(_0x5d51dd){fs[_0x8350('0x5b')](_0x15b67f[_0x8350('0x54')]);}});}else{return _0x21cbe4['download'](_0x15b67f[_0x8350('0x54')],function(_0x5696d8){if(_0x5d51dd){fs['unlink'](_0x15b67f[_0x8350('0x54')]);}});}}})[_0x8350('0x48')](handleError(_0x21cbe4,null));};exports[_0x8350('0x29')]=function(_0x12a465,_0x4aaaaf){return db[_0x8350('0x2f')][_0x8350('0x4c')]({'where':{'id':_0x12a465[_0x8350('0x4a')]['id']}})[_0x8350('0x28')](function(_0x1411b2){if(_[_0x8350('0x67')](_0x1411b2)){throw new ReferenceError(_0x8350('0x68'));}return _0x1411b2;})['then'](function(_0x2d68aa){var _0x1cc462=_0x2d68aa['value'];logger['info'](_0x8350('0x69'),_0x1cc462);if(!_['isNil'](_0x2d68aa[_0x8350('0x54')])&&fs[_0x8350('0x56')](_0x1cc462)){logger[_0x8350('0x6a')](_0x8350('0x6b')+_0x1cc462+_0x8350('0x6c'));fs[_0x8350('0x6d')](_0x1cc462);}_0x1cc462=_0x1cc462+_0x8350('0x6e');if(!_[_0x8350('0x67')](_0x2d68aa[_0x8350('0x54')])&&fs['existsSync'](_0x1cc462)){logger[_0x8350('0x6a')]('File:\x20\x22'+_0x1cc462+_0x8350('0x6c'));fs[_0x8350('0x6d')](_0x1cc462);}return _0x2d68aa;})[_0x8350('0x28')](function(_0x2d9758){if(!_0x2d9758)throw new InternalError();return _0x2d9758[_0x8350('0x29')]();})[_0x8350('0x28')](function(){_0x4aaaaf[_0x8350('0x1c')](0xcc)[_0x8350('0x1d')]();})[_0x8350('0x48')](handleError(_0x4aaaaf,null));};function getBucketslist(_0x2d2511,_0x425791,_0x5422de){return new Promise(function(_0x51c93e,_0x19c09f){var _0x453582=new AWS['S3']({'accessKeyId':_0x425791,'secretAccessKey':_0x2d2511,'region':_0x5422de});_0x453582[_0x8350('0x6f')]({},function(_0x1f4551,_0x342524){if(_0x1f4551){return _0x19c09f(_0x1f4551);}else{return _0x51c93e(_0x342524);}});});}function createBucket(_0x3e2ff6,_0x36f3dd,_0x18ff10,_0x712ff){return new Promise(function(_0x2f60fd,_0x9909e3){var _0x55eb52=new AWS['S3']({'accessKeyId':_0x36f3dd,'secretAccessKey':_0x3e2ff6,'region':_0x18ff10});_0x55eb52[_0x8350('0x70')]({'Bucket':_0x712ff},function(_0x4048dc,_0x3460d3){if(_0x4048dc){return _0x9909e3(_0x4048dc);}else{return _0x2f60fd(_0x3460d3);}});});}function uploadFile(_0x37acc7,_0x3c41b0,_0x2176c3,_0x27e1a3,_0x281c5e,_0x3bbf74){return new Promise(function(_0x471ee4,_0x5272e7){var _0x218d0a=new AWS['S3']({'accessKeyId':_0x3c41b0,'secretAccessKey':_0x37acc7,'region':_0x2176c3});_0x218d0a['upload']({'Bucket':_0x27e1a3,'Key':_0x281c5e,'Body':_0x3bbf74},function(_0x1fe1b3,_0x329bc6){if(_0x1fe1b3){return _0x5272e7(_0x1fe1b3);}else{return _0x471ee4(_0x329bc6);}});});}function startTranscribe(_0x5683db,_0x38ec3a,_0x5084a1,_0x384236,_0xdcef09,_0x1accf5){return new Promise(function(_0x9d3883,_0xb38328){var _0x2adc8c=new AWS[(_0x8350('0x71'))]({'accessKeyId':_0x38ec3a,'secretAccessKey':_0x5683db,'region':_0x5084a1});_0x2adc8c['startTranscriptionJob']({'TranscriptionJobName':_0x384236,'LanguageCode':_0xdcef09,'Media':{'MediaFileUri':_0x1accf5}},function(_0x338b5c,_0x25936e){if(_0x338b5c){return _0xb38328(_0x338b5c);}else{return _0x9d3883(_0x25936e);}});});}function transcribe(_0x573e4b,_0x1af752,_0x19a110,_0x3c32f1,_0x29c123,_0xb0280b,_0x8095c5){return new Promise(function(_0x1030b0,_0x4cf5a4){var _0xcf8eb3={};logger['info'](util[_0x8350('0x34')](_0x8350('0x72'),_0x573e4b,_0x29c123));return uploadFile(_0x1af752,_0x19a110,_0x3c32f1,_0x29c123,path[_0x8350('0x73')](_0xb0280b),fs[_0x8350('0x74')](_0xb0280b))[_0x8350('0x28')](function(_0xec06e0){logger['info'](util[_0x8350('0x34')](_0x8350('0x75'),_0x573e4b,_0x29c123,_0xec06e0[_0x8350('0x76')]));_0xcf8eb3[_0x8350('0x77')]=_0xec06e0[_0x8350('0x78')];_0xcf8eb3['location']=_0xec06e0['Location'];logger[_0x8350('0x6a')](util[_0x8350('0x34')](_0x8350('0x79'),_0x573e4b));return startTranscribe(_0x1af752,_0x19a110,_0x3c32f1,uuidv4(),_0x8095c5,_0xec06e0[_0x8350('0x76')]);})[_0x8350('0x28')](function(_0x513c39){logger['info'](util[_0x8350('0x34')](_0x8350('0x7a'),_0x573e4b,_0x513c39[_0x8350('0x7b')]['TranscriptionJobName']));_0xcf8eb3[_0x8350('0x7c')]=_0x513c39[_0x8350('0x7b')][_0x8350('0x7d')];_0xcf8eb3['transcribeStatus']=_0x513c39['TranscriptionJob'][_0x8350('0x7e')];return _0x1030b0(_0xcf8eb3);})['catch'](function(_0x2df712){return _0x4cf5a4(_0x2df712);});});}exports[_0x8350('0x7f')]=function(_0x2b9161,_0x5bf7eb,_0x1be195){var _0x523e8c;var _0x55f413;var _0x427b34;var _0x132ee6=require(_0x8350('0x51'));return db['VoiceRecording'][_0x8350('0x80')]({'where':{'id':_0x2b9161[_0x8350('0x4a')]['id']}})[_0x8350('0x28')](function(_0x1c4fce){if(_0x1c4fce){var _0x34cce3=util['format']('%s.cypher',_0x1c4fce[_0x8350('0x54')]);if(fs[_0x8350('0x56')](_0x34cce3)){cypher=!![];return _0x132ee6[_0x8350('0x65')](_0x34cce3,_0x1c4fce[_0x8350('0x54')],config[_0x8350('0x57')][_0x8350('0x81')])[_0x8350('0x28')](function(){return _0x1c4fce;});}return _0x1c4fce;}})[_0x8350('0x28')](function(_0x29ce07){if(!_0x29ce07){throw new db[(_0x8350('0x58'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x55f413=_0x29ce07;return db[_0x8350('0x82')][_0x8350('0x80')]({'where':{'id':0x1}});})[_0x8350('0x28')](handleEntityNotFound(_0x5bf7eb,null))['then'](function(_0x836a6e){if(_0x836a6e){_0x523e8c=_0x836a6e;if(!_0x523e8c[_0x8350('0x83')]||!_0x523e8c['transcribeAccountId']||!_0x523e8c[_0x8350('0x84')]||!_0x523e8c['language']||!_0x523e8c[_0x8350('0x77')]){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))](_0x8350('0x85'));}if(_0x2b9161[_0x8350('0x4e')][_0x8350('0x86')]&&(!_0x523e8c[_0x8350('0x87')]||!_0x523e8c['sentimentAccountId']||!_0x523e8c[_0x8350('0x88')]||!_0x523e8c['language']||!_0x523e8c['bucket'])){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x8350('0x89')]['findOne']({'where':{'id':_0x523e8c['transcribeAccountId']}});}})[_0x8350('0x28')](function(_0x830b5c){if(!_0x830b5c){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x830b5c[_0x8350('0x8a')]||!_0x830b5c[_0x8350('0x8b')]){throw new db[(_0x8350('0x58'))][(_0x8350('0x59'))](_0x8350('0x8c'));}_0x427b34=_0x830b5c;return getBucketslist(_0x427b34[_0x8350('0x8a')],_0x427b34[_0x8350('0x8b')],_0x523e8c[_0x8350('0x84')]);})[_0x8350('0x28')](function(_0x4d584b){if(_0x4d584b&&_0x4d584b[_0x8350('0x8d')]){var _0x1152bd=_[_0x8350('0x4c')](_0x4d584b[_0x8350('0x8d')],function(_0x157378){return _0x157378[_0x8350('0x8e')]===_0x523e8c['bucket'];});if(!_0x1152bd){logger[_0x8350('0x6a')](util['format'](_0x8350('0x8f'),_0x2b9161[_0x8350('0x4a')]['id'],_0x523e8c[_0x8350('0x77')]));return createBucket(_0x427b34['data1'],_0x427b34[_0x8350('0x8b')],_0x523e8c[_0x8350('0x84')],_0x523e8c[_0x8350('0x77')]);}logger['info'](util[_0x8350('0x34')](_0x8350('0x90'),_0x2b9161[_0x8350('0x4a')]['id'],_0x523e8c[_0x8350('0x77')]));return;}})[_0x8350('0x28')](function(_0x2da654){if(_0x55f413['transcribeStatus']===_0x8350('0x91')){return transcribe(_0x2b9161['params']['id'],_0x427b34[_0x8350('0x8a')],_0x427b34[_0x8350('0x8b')],_0x523e8c[_0x8350('0x84')],_0x523e8c[_0x8350('0x77')],_0x55f413[_0x8350('0x54')],_0x523e8c[_0x8350('0x92')]);}else{logger[_0x8350('0x6a')](util[_0x8350('0x34')](_0x8350('0x93'),_0x2b9161[_0x8350('0x4a')]['id']));return{'transcribeStatus':_0x8350('0x94')};}})[_0x8350('0x28')](function(_0x41f648){if(_0x41f648){_0x41f648[_0x8350('0x95')]=_0x2b9161['body'][_0x8350('0x86')];return _0x55f413[_0x8350('0x96')](_0x41f648);}})[_0x8350('0x28')](respondWithResult(_0x5bf7eb,null))[_0x8350('0x48')](handleError(_0x5bf7eb,null));};function writeFile(_0x27a2b7,_0x39524f){return new Promise(function(_0x4bd585,_0x462157){fs[_0x8350('0x97')](_0x39524f,_0x27a2b7,function(_0x1ba5e5,_0x18b34b){if(_0x1ba5e5){return _0x462157(_0x1ba5e5);}else{return _0x4bd585(_0x18b34b);}});});}exports[_0x8350('0x98')]=function(_0x45a394,_0x57d0f6,_0x59bdd4){return db['VoiceRecording'][_0x8350('0x80')]({'where':{'id':_0x45a394[_0x8350('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57d0f6))[_0x8350('0x28')](function(_0x41eeac){if(_0x41eeac&&_0x41eeac[_0x8350('0x99')]){var _0x1cb99e=_0x41eeac[_0x8350('0x99')];var _0x611fb6=config['root']+_0x8350('0x9a')+_0x41eeac['id']+_0x8350('0x9b');if(fs[_0x8350('0x56')](_0x611fb6)){return _0x611fb6;}return writeFile(_0x1cb99e,_0x611fb6)[_0x8350('0x28')](function(){return _0x611fb6;});}else{throw new db[(_0x8350('0x58'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x8350('0x28')](function(_0x245c06){return _0x57d0f6[_0x8350('0x50')](_0x245c06);})[_0x8350('0x48')](handleError(_0x57d0f6));}; \ No newline at end of file +var _0x0fe7=['[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','recording','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','then','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','token','$and','push','format','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','info'];(function(_0xc29fe6,_0x1d820a){var _0x928810=function(_0x3da591){while(--_0x3da591){_0xc29fe6['push'](_0xc29fe6['shift']());}};_0x928810(++_0x1d820a);}(_0x0fe7,0x160));var _0x70fe=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x0fe7[_0x26f702];return _0x11417d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x70fe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70fe('0x1'));var rp=require('request-promise');var moment=require(_0x70fe('0x2'));var BPromise=require(_0x70fe('0x3'));var Mustache=require(_0x70fe('0x4'));var util=require(_0x70fe('0x5'));var path=require('path');var sox=require(_0x70fe('0x6'));var csv=require(_0x70fe('0x7'));var ejs=require(_0x70fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70fe('0x9'));var squel=require(_0x70fe('0xa'));var crypto=require(_0x70fe('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x70fe('0xc'));var toCsv=require(_0x70fe('0x7'));var querystring=require(_0x70fe('0xd'));var Papa=require(_0x70fe('0xe'));var AWS=require(_0x70fe('0xf'));var uuidv4=require(_0x70fe('0x10'));var Redis=require(_0x70fe('0x11'));var authService=require(_0x70fe('0x12'));var qs=require(_0x70fe('0x13'));var as=require(_0x70fe('0x14'));var hardwareService=require(_0x70fe('0x15'));var logger=require(_0x70fe('0x16'))(_0x70fe('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70fe('0x18'));var db=require(_0x70fe('0x19'))['db'];function respondWithStatusCode(_0x32fd9d,_0x81bb01){_0x81bb01=_0x81bb01||0xcc;return function(_0x579aa7){if(_0x579aa7){return _0x32fd9d[_0x70fe('0x1a')](_0x81bb01);}return _0x32fd9d[_0x70fe('0x1b')](_0x81bb01)[_0x70fe('0x1c')]();};}function respondWithResult(_0x8d7800,_0x238110){_0x238110=_0x238110||0xc8;return function(_0x86f96d){if(_0x86f96d){return _0x8d7800['status'](_0x238110)[_0x70fe('0x1d')](_0x86f96d);}};}function respondWithFilteredResult(_0x465d08,_0x169f63){return function(_0x411bb8){if(_0x411bb8){var _0xb7d256=typeof _0x169f63[_0x70fe('0x1e')]==='undefined'&&typeof _0x169f63[_0x70fe('0x1f')]==='undefined';var _0x274447=_0x411bb8[_0x70fe('0x20')];var _0x30c36e=_0xb7d256?0x0:_0x169f63[_0x70fe('0x1e')];var _0xe574a6=_0xb7d256?_0x411bb8[_0x70fe('0x20')]:_0x169f63[_0x70fe('0x1e')]+_0x169f63[_0x70fe('0x1f')];var _0x3a3230;if(_0xe574a6>=_0x274447){_0xe574a6=_0x274447;_0x3a3230=0xc8;}else{_0x3a3230=0xce;}_0x465d08[_0x70fe('0x1b')](_0x3a3230);return _0x465d08[_0x70fe('0x21')](_0x70fe('0x22'),_0x30c36e+'-'+_0xe574a6+'/'+_0x274447)[_0x70fe('0x1d')](_0x411bb8);}return null;};}function patchUpdates(_0x5abfb3){return function(_0x5cfb77){try{jsonpatch[_0x70fe('0x23')](_0x5cfb77,_0x5abfb3,!![]);}catch(_0x39a843){return BPromise['reject'](_0x39a843);}return _0x5cfb77[_0x70fe('0x24')]();};}function saveUpdates(_0xbf3476,_0x51d2bc){return function(_0x50bf59){if(_0x50bf59){return _0x50bf59['update'](_0xbf3476)[_0x70fe('0x25')](function(_0x3665ec){return _0x3665ec;});}return null;};}function removeEntity(_0x352a28,_0x218bff){return function(_0x4eb888){if(_0x4eb888){return _0x4eb888['destroy']()['then'](function(){_0x352a28[_0x70fe('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb3fd6f,_0x122f95){return function(_0x4406a2){if(!_0x4406a2){_0xb3fd6f[_0x70fe('0x1a')](0x194);}return _0x4406a2;};}function handleError(_0x19e753,_0x450f57){_0x450f57=_0x450f57||0x1f4;return function(_0x151c69){logger['error'](_0x151c69[_0x70fe('0x26')]);if(_0x151c69['name']){delete _0x151c69[_0x70fe('0x27')];}_0x19e753['status'](_0x450f57)[_0x70fe('0x28')](_0x151c69);};}exports[_0x70fe('0x29')]=function(_0xcef353,_0x2d76fe){var _0x2b6f85={},_0x1448bf={},_0xdbfcb2={'count':0x0,'rows':[]};var _0x37de61=_[_0x70fe('0x2a')](db[_0x70fe('0x2b')][_0x70fe('0x2c')],function(_0x36856a){return{'name':_0x36856a[_0x70fe('0x2d')],'type':_0x36856a[_0x70fe('0x2e')][_0x70fe('0x2f')]};});_0x1448bf[_0x70fe('0x30')]=_[_0x70fe('0x31')](_[_0x70fe('0x2a')](_0x37de61,_0x70fe('0x27')),['format']);_0x1448bf['query']=_[_0x70fe('0x32')](_0xcef353[_0x70fe('0x33')]);_0x1448bf[_0x70fe('0x34')]=_['intersection'](_0x1448bf[_0x70fe('0x30')],_0x1448bf[_0x70fe('0x33')]);_0x2b6f85[_0x70fe('0x35')]=_[_0x70fe('0x36')](_0x1448bf[_0x70fe('0x30')],qs[_0x70fe('0x37')](_0xcef353[_0x70fe('0x33')]['fields']));_0x2b6f85['attributes']=_0x2b6f85[_0x70fe('0x35')]['length']?_0x2b6f85[_0x70fe('0x35')]:_0x1448bf[_0x70fe('0x30')];if(!_0xcef353[_0x70fe('0x33')][_0x70fe('0x38')](_0x70fe('0x39'))){_0x2b6f85[_0x70fe('0x1f')]=qs[_0x70fe('0x1f')](_0xcef353[_0x70fe('0x33')]['limit']);_0x2b6f85[_0x70fe('0x1e')]=qs[_0x70fe('0x1e')](_0xcef353[_0x70fe('0x33')][_0x70fe('0x1e')]);}_0x2b6f85[_0x70fe('0x3a')]=qs[_0x70fe('0x3b')](_0xcef353[_0x70fe('0x33')][_0x70fe('0x3b')]);_0x2b6f85['where']=qs[_0x70fe('0x34')](_[_0x70fe('0x3c')](_0xcef353[_0x70fe('0x33')],_0x1448bf[_0x70fe('0x34')]),_0x37de61);if(_0xcef353[_0x70fe('0x33')][_0x70fe('0x3d')]){_0x2b6f85[_0x70fe('0x3e')]=_[_0x70fe('0x3f')](_0x2b6f85[_0x70fe('0x3e')],{'$or':_[_0x70fe('0x2a')](_0x37de61,function(_0x235c6f){if(_0x235c6f[_0x70fe('0x2e')]!==_0x70fe('0x40')){var _0x3e5791={};_0x3e5791[_0x235c6f[_0x70fe('0x27')]]={'$like':'%'+_0xcef353['query']['filter']+'%'};return _0x3e5791;}})});}_0x2b6f85=_['merge']({},_0x2b6f85,_0xcef353[_0x70fe('0x41')]);var _0x5e0d5f={'where':_0x2b6f85[_0x70fe('0x3e')]};return db[_0x70fe('0x2b')][_0x70fe('0x20')](_0x5e0d5f)[_0x70fe('0x25')](function(_0x209929){_0xdbfcb2[_0x70fe('0x20')]=_0x209929;if(_0xcef353[_0x70fe('0x33')][_0x70fe('0x42')]){_0x2b6f85[_0x70fe('0x43')]=[{'all':!![]}];}return db[_0x70fe('0x2b')][_0x70fe('0x44')](_0x2b6f85);})[_0x70fe('0x25')](function(_0x1b1000){_0xdbfcb2[_0x70fe('0x45')]=_0x1b1000;return _0xdbfcb2;})['then'](respondWithFilteredResult(_0x2d76fe,_0x2b6f85))[_0x70fe('0x46')](handleError(_0x2d76fe,null));};exports[_0x70fe('0x47')]=function(_0x5f4490,_0x143fca){var _0x2da79b={'raw':![],'where':{'id':_0x5f4490['params']['id']}},_0xa6ec7a={};_0xa6ec7a['model']=_['keys'](db['VoiceRecording']['rawAttributes']);_0xa6ec7a[_0x70fe('0x33')]=_[_0x70fe('0x32')](_0x5f4490[_0x70fe('0x33')]);_0xa6ec7a[_0x70fe('0x34')]=_[_0x70fe('0x36')](_0xa6ec7a['model'],_0xa6ec7a[_0x70fe('0x33')]);_0x2da79b[_0x70fe('0x35')]=_[_0x70fe('0x36')](_0xa6ec7a['model'],qs['fields'](_0x5f4490[_0x70fe('0x33')][_0x70fe('0x37')]));_0x2da79b[_0x70fe('0x35')]=_0x2da79b[_0x70fe('0x35')]['length']?_0x2da79b['attributes']:_0xa6ec7a[_0x70fe('0x30')];if(_0x5f4490['query'][_0x70fe('0x42')]){_0x2da79b[_0x70fe('0x43')]=[{'all':!![]}];}_0x2da79b=_['merge']({},_0x2da79b,_0x5f4490[_0x70fe('0x41')]);return db[_0x70fe('0x2b')][_0x70fe('0x48')](_0x2da79b)['then'](handleEntityNotFound(_0x143fca,null))['then'](respondWithResult(_0x143fca,null))[_0x70fe('0x46')](handleError(_0x143fca,null));};exports[_0x70fe('0x49')]=function(_0x2ef911,_0x21bf09){return db['VoiceRecording']['create'](_0x2ef911[_0x70fe('0x4a')],{})['then'](respondWithResult(_0x21bf09,0xc9))[_0x70fe('0x46')](handleError(_0x21bf09,null));};exports[_0x70fe('0x4b')]=function(_0x57fdee,_0x5d93e9){if(_0x57fdee[_0x70fe('0x4a')]['id']){delete _0x57fdee[_0x70fe('0x4a')]['id'];}return db[_0x70fe('0x2b')][_0x70fe('0x48')]({'where':{'id':_0x57fdee['params']['id']}})[_0x70fe('0x25')](handleEntityNotFound(_0x5d93e9,null))[_0x70fe('0x25')](saveUpdates(_0x57fdee['body'],null))[_0x70fe('0x25')](respondWithResult(_0x5d93e9,null))[_0x70fe('0x46')](handleError(_0x5d93e9,null));};exports[_0x70fe('0x4c')]=function(_0x51d74e,_0x2d9e8a){return db[_0x70fe('0x2b')]['describe']()[_0x70fe('0x25')](respondWithResult(_0x2d9e8a,null))[_0x70fe('0x46')](handleError(_0x2d9e8a,null));};exports[_0x70fe('0x4d')]=function(_0x2894cc,_0x10e5a1,_0x370df8){var _0x20872c=require(_0x70fe('0x4e'));var _0x597bfb=![];var _0x46ac0c={};if(_0x2894cc['query'][_0x70fe('0x2e')]&&_0x2894cc[_0x70fe('0x33')]['type']===_0x70fe('0x4f')){_0x46ac0c[_0x70fe('0x4f')]=_0x2894cc['params']['id'];}else{_0x46ac0c['id']=_0x2894cc[_0x70fe('0x50')]['id'];}return db[_0x70fe('0x2b')][_0x70fe('0x48')]({'where':_0x46ac0c,'attributes':['id',_0x70fe('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x10e5a1,null))['then'](function(_0x27ef13){if(_0x27ef13){var _0x25b504=_0x27ef13[_0x70fe('0x51')];var _0x3542ab=util['format'](_0x70fe('0x52'),_0x25b504);if(fs[_0x70fe('0x53')](_0x3542ab)){_0x597bfb=!![];return _0x20872c[_0x70fe('0x54')](_0x3542ab,_0x25b504,config['secrets']['recording'])[_0x70fe('0x25')](function(){return _0x27ef13;});}return _0x27ef13;}})[_0x70fe('0x25')](function(_0x2052da){if(_0x2052da){var _0x27ad79=_0x2052da['value'];if(!fs[_0x70fe('0x53')](_0x27ad79)){throw new db[(_0x70fe('0x55'))][(_0x70fe('0x56'))](_0x70fe('0x57'));}if(_0x2052da[_0x70fe('0x58')]){return _0x10e5a1['download'](_0x27ad79,_0x2052da[_0x70fe('0x58')]+path[_0x70fe('0x59')](_0x27ad79),function(){if(_0x597bfb){fs[_0x70fe('0x5a')](_0x27ad79);}});}else{return _0x10e5a1[_0x70fe('0x4d')](_0x27ad79,function(_0x19899c){if(_0x597bfb){fs['unlink'](_0x27ad79);}});}}})[_0x70fe('0x46')](function(_0x194cbe){if(_0x194cbe[_0x70fe('0x5b')]===_0x70fe('0x57')){_0x10e5a1['status'](0x194)[_0x70fe('0x28')](_0x70fe('0x5c'));}else{return handleError(_0x10e5a1,null);}});};exports['downloads']=function(_0x4f262a,_0x3147aa,_0x5ee124){var _0x1c75c5=require('../../components/encryptor');var _0x2d9744=![];var _0x3c0d3c={'$and':[db[_0x70fe('0x5d')][_0x70fe('0x3e')](db[_0x70fe('0x5d')]['fn'](_0x70fe('0x5e'),db[_0x70fe('0x5d')]['col'](_0x70fe('0x4f'))),_0x4f262a[_0x70fe('0x33')][_0x70fe('0x5f')])]};if(_0x4f262a[_0x70fe('0x33')][_0x70fe('0x2e')]&&_0x4f262a[_0x70fe('0x33')][_0x70fe('0x2e')]===_0x70fe('0x4f')){_0x3c0d3c[_0x70fe('0x60')][_0x70fe('0x61')]({'uniqueid':_0x4f262a[_0x70fe('0x50')]['id']});}else{_0x3c0d3c[_0x70fe('0x60')][_0x70fe('0x61')]({'id':_0x4f262a[_0x70fe('0x50')]['id']});}return db[_0x70fe('0x2b')][_0x70fe('0x48')]({'where':_0x3c0d3c,'attributes':['id',_0x70fe('0x51')],'raw':!![]})[_0x70fe('0x25')](handleEntityNotFound(_0x3147aa,null))['then'](function(_0x59b194){if(_0x59b194){var _0x592414=util[_0x70fe('0x62')]('%s.cypher',_0x59b194[_0x70fe('0x51')]);if(fs[_0x70fe('0x53')](_0x592414)){_0x2d9744=!![];return _0x1c75c5[_0x70fe('0x54')](_0x592414,_0x59b194['value'],config['secrets']['recording'])[_0x70fe('0x25')](function(){return _0x59b194;});}return _0x59b194;}})[_0x70fe('0x25')](function(_0x2ece50){if(_0x2ece50){if(!fs[_0x70fe('0x53')](_0x2ece50[_0x70fe('0x51')])){throw new db[(_0x70fe('0x55'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x2ece50[_0x70fe('0x58')]){return _0x3147aa[_0x70fe('0x4d')](_0x2ece50['value'],_0x2ece50[_0x70fe('0x58')]+path[_0x70fe('0x59')](_0x2ece50[_0x70fe('0x51')]),function(){if(_0x2d9744){fs[_0x70fe('0x5a')](_0x2ece50[_0x70fe('0x51')]);}});}else{return _0x3147aa[_0x70fe('0x4d')](_0x2ece50[_0x70fe('0x51')],function(_0x237f1a){if(_0x2d9744){fs['unlink'](_0x2ece50[_0x70fe('0x51')]);}});}}})[_0x70fe('0x46')](handleError(_0x3147aa,null));};exports['destroy']=function(_0x5922a3,_0x37508c){return db[_0x70fe('0x2b')][_0x70fe('0x48')]({'where':{'id':_0x5922a3['params']['id']}})['then'](function(_0x577319){if(_[_0x70fe('0x63')](_0x577319)){throw new ReferenceError(_0x70fe('0x64'));}return _0x577319;})[_0x70fe('0x25')](function(_0x495009){var _0x3a7d22=_0x495009[_0x70fe('0x51')];logger['info'](_0x70fe('0x65'),_0x3a7d22);if(!_[_0x70fe('0x63')](_0x495009[_0x70fe('0x51')])&&fs[_0x70fe('0x53')](_0x3a7d22)){logger['info']('File:\x20\x22'+_0x3a7d22+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3a7d22);}_0x3a7d22=_0x3a7d22+_0x70fe('0x66');if(!_['isNil'](_0x495009[_0x70fe('0x51')])&&fs[_0x70fe('0x53')](_0x3a7d22)){logger['info'](_0x70fe('0x67')+_0x3a7d22+_0x70fe('0x68'));fs['unlinkSync'](_0x3a7d22);}return _0x495009;})[_0x70fe('0x25')](function(_0x34211a){if(!_0x34211a)throw new InternalError();return _0x34211a['destroy']();})[_0x70fe('0x25')](function(){_0x37508c[_0x70fe('0x1b')](0xcc)[_0x70fe('0x1c')]();})['catch'](handleError(_0x37508c,null));};function getBucketslist(_0x4f55c2,_0xf515cf,_0x2a6431){return new Promise(function(_0x1d3251,_0xf6365d){var _0x4d355d=new AWS['S3']({'accessKeyId':_0xf515cf,'secretAccessKey':_0x4f55c2,'region':_0x2a6431});_0x4d355d[_0x70fe('0x69')]({},function(_0x441fd6,_0x4cc04b){if(_0x441fd6){return _0xf6365d(_0x441fd6);}else{return _0x1d3251(_0x4cc04b);}});});}function createBucket(_0x43ecb8,_0x551c2d,_0x440145,_0x5cd3a5){return new Promise(function(_0x209b5d,_0x4c2e7b){var _0x3e546b=new AWS['S3']({'accessKeyId':_0x551c2d,'secretAccessKey':_0x43ecb8,'region':_0x440145});_0x3e546b[_0x70fe('0x6a')]({'Bucket':_0x5cd3a5},function(_0x4ed983,_0x550438){if(_0x4ed983){return _0x4c2e7b(_0x4ed983);}else{return _0x209b5d(_0x550438);}});});}function uploadFile(_0x1f1a0c,_0x298626,_0x5d21ba,_0x226937,_0x246ba,_0x108869){return new Promise(function(_0x3b138d,_0x3f2546){var _0x297715=new AWS['S3']({'accessKeyId':_0x298626,'secretAccessKey':_0x1f1a0c,'region':_0x5d21ba});_0x297715[_0x70fe('0x6b')]({'Bucket':_0x226937,'Key':_0x246ba,'Body':_0x108869},function(_0x44cb34,_0x37d143){if(_0x44cb34){return _0x3f2546(_0x44cb34);}else{return _0x3b138d(_0x37d143);}});});}function startTranscribe(_0x17cc20,_0x3c5f6b,_0x554a02,_0x162b0a,_0x4369c1,_0x92bf98){return new Promise(function(_0x503cde,_0x16b861){var _0x4efde3=new AWS[(_0x70fe('0x6c'))]({'accessKeyId':_0x3c5f6b,'secretAccessKey':_0x17cc20,'region':_0x554a02});_0x4efde3[_0x70fe('0x6d')]({'TranscriptionJobName':_0x162b0a,'LanguageCode':_0x4369c1,'Media':{'MediaFileUri':_0x92bf98}},function(_0x4610bc,_0x1f1232){if(_0x4610bc){return _0x16b861(_0x4610bc);}else{return _0x503cde(_0x1f1232);}});});}function transcribe(_0x14d00e,_0x5f14f0,_0x30bb51,_0x137d95,_0x18776a,_0x59e07b,_0x2a81b4){return new Promise(function(_0x47dbeb,_0x260474){var _0x50a318={};logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x14d00e,_0x18776a));return uploadFile(_0x5f14f0,_0x30bb51,_0x137d95,_0x18776a,path[_0x70fe('0x6e')](_0x59e07b),fs[_0x70fe('0x6f')](_0x59e07b))[_0x70fe('0x25')](function(_0x5bdcbf){logger[_0x70fe('0x70')](util[_0x70fe('0x62')](_0x70fe('0x71'),_0x14d00e,_0x18776a,_0x5bdcbf['Location']));_0x50a318[_0x70fe('0x72')]=_0x5bdcbf[_0x70fe('0x73')];_0x50a318['location']=_0x5bdcbf[_0x70fe('0x74')];logger['info'](util[_0x70fe('0x62')](_0x70fe('0x75'),_0x14d00e));return startTranscribe(_0x5f14f0,_0x30bb51,_0x137d95,uuidv4(),_0x2a81b4,_0x5bdcbf[_0x70fe('0x74')]);})[_0x70fe('0x25')](function(_0x2d8a8){logger['info'](util[_0x70fe('0x62')](_0x70fe('0x76'),_0x14d00e,_0x2d8a8[_0x70fe('0x77')][_0x70fe('0x78')]));_0x50a318[_0x70fe('0x79')]=_0x2d8a8[_0x70fe('0x77')][_0x70fe('0x78')];_0x50a318[_0x70fe('0x7a')]=_0x2d8a8[_0x70fe('0x77')][_0x70fe('0x7b')];return _0x47dbeb(_0x50a318);})[_0x70fe('0x46')](function(_0x3e9f58){return _0x260474(_0x3e9f58);});});}exports[_0x70fe('0x7c')]=function(_0x725930,_0x9128d3,_0x32100d){var _0x1a39c0;var _0x2e5212;var _0x2c7b3a;var _0x1e3c82=require(_0x70fe('0x4e'));return db[_0x70fe('0x2b')][_0x70fe('0x7d')]({'where':{'id':_0x725930[_0x70fe('0x50')]['id']}})[_0x70fe('0x25')](function(_0x69550d){if(_0x69550d){var _0x526516=util[_0x70fe('0x62')](_0x70fe('0x52'),_0x69550d['value']);if(fs[_0x70fe('0x53')](_0x526516)){cypher=!![];return _0x1e3c82[_0x70fe('0x54')](_0x526516,_0x69550d[_0x70fe('0x51')],config['secrets'][_0x70fe('0x7e')])['then'](function(){return _0x69550d;});}return _0x69550d;}})[_0x70fe('0x25')](function(_0x2a31cf){if(!_0x2a31cf){throw new db[(_0x70fe('0x55'))][(_0x70fe('0x56'))](_0x70fe('0x7f'));}_0x2e5212=_0x2a31cf;return db[_0x70fe('0x80')][_0x70fe('0x7d')]({'where':{'id':0x1}});})[_0x70fe('0x25')](handleEntityNotFound(_0x9128d3,null))[_0x70fe('0x25')](function(_0x35ee8e){if(_0x35ee8e){_0x1a39c0=_0x35ee8e;if(!_0x1a39c0['transcribe']||!_0x1a39c0['transcribeAccountId']||!_0x1a39c0[_0x70fe('0x81')]||!_0x1a39c0[_0x70fe('0x82')]||!_0x1a39c0[_0x70fe('0x72')]){throw new db[(_0x70fe('0x55'))][(_0x70fe('0x56'))](_0x70fe('0x83'));}if(_0x725930['body'][_0x70fe('0x84')]&&(!_0x1a39c0[_0x70fe('0x85')]||!_0x1a39c0[_0x70fe('0x86')]||!_0x1a39c0[_0x70fe('0x87')]||!_0x1a39c0[_0x70fe('0x82')]||!_0x1a39c0[_0x70fe('0x72')])){throw new db[(_0x70fe('0x55'))][(_0x70fe('0x56'))](_0x70fe('0x88'));}return db['CloudProvider']['findOne']({'where':{'id':_0x1a39c0[_0x70fe('0x89')]}});}})['then'](function(_0x5cf9cb){if(!_0x5cf9cb){throw new db[(_0x70fe('0x55'))][(_0x70fe('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5cf9cb[_0x70fe('0x8a')]||!_0x5cf9cb[_0x70fe('0x8b')]){throw new db[(_0x70fe('0x55'))][(_0x70fe('0x56'))](_0x70fe('0x8c'));}_0x2c7b3a=_0x5cf9cb;return getBucketslist(_0x2c7b3a[_0x70fe('0x8a')],_0x2c7b3a[_0x70fe('0x8b')],_0x1a39c0[_0x70fe('0x81')]);})['then'](function(_0x4bde80){if(_0x4bde80&&_0x4bde80[_0x70fe('0x8d')]){var _0x417d06=_[_0x70fe('0x48')](_0x4bde80[_0x70fe('0x8d')],function(_0x19b8e1){return _0x19b8e1[_0x70fe('0x8e')]===_0x1a39c0[_0x70fe('0x72')];});if(!_0x417d06){logger[_0x70fe('0x70')](util[_0x70fe('0x62')](_0x70fe('0x8f'),_0x725930[_0x70fe('0x50')]['id'],_0x1a39c0['bucket']));return createBucket(_0x2c7b3a[_0x70fe('0x8a')],_0x2c7b3a[_0x70fe('0x8b')],_0x1a39c0[_0x70fe('0x81')],_0x1a39c0[_0x70fe('0x72')]);}logger[_0x70fe('0x70')](util['format'](_0x70fe('0x90'),_0x725930[_0x70fe('0x50')]['id'],_0x1a39c0['bucket']));return;}})[_0x70fe('0x25')](function(_0x58f975){if(_0x2e5212['transcribeStatus']===_0x70fe('0x91')){return transcribe(_0x725930[_0x70fe('0x50')]['id'],_0x2c7b3a[_0x70fe('0x8a')],_0x2c7b3a[_0x70fe('0x8b')],_0x1a39c0['transcribeRegion'],_0x1a39c0[_0x70fe('0x72')],_0x2e5212[_0x70fe('0x51')],_0x1a39c0[_0x70fe('0x82')]);}else{logger[_0x70fe('0x70')](util[_0x70fe('0x62')](_0x70fe('0x92'),_0x725930[_0x70fe('0x50')]['id']));return{'transcribeStatus':_0x70fe('0x93')};}})[_0x70fe('0x25')](function(_0x1d3a5d){if(_0x1d3a5d){_0x1d3a5d[_0x70fe('0x94')]=_0x725930[_0x70fe('0x4a')][_0x70fe('0x84')];return _0x2e5212[_0x70fe('0x95')](_0x1d3a5d);}})[_0x70fe('0x25')](respondWithResult(_0x9128d3,null))[_0x70fe('0x46')](handleError(_0x9128d3,null));};function writeFile(_0xb9a9fb,_0x443e82){return new Promise(function(_0x10449e,_0x4b084c){fs[_0x70fe('0x96')](_0x443e82,_0xb9a9fb,function(_0x22b176,_0x431f1e){if(_0x22b176){return _0x4b084c(_0x22b176);}else{return _0x10449e(_0x431f1e);}});});}exports[_0x70fe('0x97')]=function(_0x3125e5,_0x176f1d,_0x5d6232){return db[_0x70fe('0x2b')][_0x70fe('0x7d')]({'where':{'id':_0x3125e5[_0x70fe('0x50')]['id']}})[_0x70fe('0x25')](handleEntityNotFound(_0x176f1d))[_0x70fe('0x25')](function(_0x533c54){if(_0x533c54&&_0x533c54[_0x70fe('0x98')]){var _0x35b20c=_0x533c54[_0x70fe('0x98')];var _0x535009=config['root']+_0x70fe('0x99')+_0x533c54['id']+_0x70fe('0x9a');if(fs[_0x70fe('0x53')](_0x535009)){return _0x535009;}return writeFile(_0x35b20c,_0x535009)[_0x70fe('0x25')](function(){return _0x535009;});}else{throw new db[(_0x70fe('0x55'))]['ValidationError']('Transcript\x20not\x20available');}})[_0x70fe('0x25')](function(_0x44b0e6){return _0x176f1d[_0x70fe('0x4d')](_0x44b0e6);})['catch'](handleError(_0x176f1d));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index db327f9..036c450 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 _0x7f90=['exports','define','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x219659,_0x2f3adf){var _0x42f32c=function(_0x3659e8){while(--_0x3659e8){_0x219659['push'](_0x219659['shift']());}};_0x42f32c(++_0x2f3adf);}(_0x7f90,0xf4));var _0x07f9=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0x7f90[_0xc0d9bc];return _0x32ff73;};'use strict';var attributes=require(_0x07f9('0x0'));module[_0x07f9('0x1')]=function(_0x43c91f,_0x1521eb){return _0x43c91f[_0x07f9('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x07f9('0x3'),'fields':[_0x07f9('0x3')]},{'name':'transcribeStatus','fields':[_0x07f9('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf197=['./voiceRecording.attributes','exports','VoiceRecording','transcribeStatus'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0xf197,0x130));var _0x7f19=function(_0x100f31,_0xafcbb8){_0x100f31=_0x100f31-0x0;var _0xd185f9=_0xf197[_0x100f31];return _0xd185f9;};'use strict';var attributes=require(_0x7f19('0x0'));module[_0x7f19('0x1')]=function(_0x37f54a,_0x4aa601){return _0x37f54a['define'](_0x7f19('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':_0x7f19('0x3'),'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 4ceb90b..aba35e0 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 _0x430c=['../../components/encryptor','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','body','options','raw','where','limit','UpdateVoiceRecording','catch','CreateVoiceRecording'];(function(_0x21dac0,_0x3760c1){var _0x1879a5=function(_0x5fe775){while(--_0x5fe775){_0x21dac0['push'](_0x21dac0['shift']());}};_0x1879a5(++_0x3760c1);}(_0x430c,0x1a1));var _0xc430=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0x430c[_0x3d2e4b];return _0x509e78;};'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});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});}exports['UpdateVoiceRecording']=function(_0x5d3acc){var _0x36d112=this;return new Promise(function(_0x4c1937,_0x2bcb21){return db['VoiceRecording']['update'](_0x5d3acc[_0xc430('0x11')],{'raw':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d3acc[_0xc430('0x12')]?_0x5d3acc[_0xc430('0x12')][_0xc430('0x14')]||null:null,'attributes':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')]['attributes']||null:null,'limit':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x15')]||null:null})[_0xc430('0x8')](function(_0x56dd16){logger[_0xc430('0x9')]('UpdateVoiceRecording',_0x5d3acc);logger[_0xc430('0xb')](_0xc430('0x16'),_0x5d3acc,JSON['stringify'](_0x56dd16));_0x4c1937(_0x56dd16);})[_0xc430('0x17')](function(_0x3cdbd3){logger['error'](_0xc430('0x16'),_0x3cdbd3['message'],_0x5d3acc);_0x2bcb21(_0x36d112[_0xc430('0xe')](0x1f4,_0x3cdbd3['message']));});});};exports[_0xc430('0x18')]=function(_0x21e28a){var _0x50110b=this;return new Promise(function(_0x33433f,_0x2ec021){var _0x2c0422=require(_0xc430('0x19'));var _0x285407;return db['Setting'][_0xc430('0x1a')]({'attributes':['id',_0xc430('0x1b')],'where':{'id':0x1},'raw':!![]})[_0xc430('0x8')](function(_0x1591e3){_0x285407=_0x1591e3;return db['VoiceRecording'][_0xc430('0x1c')](_0x21e28a['body']);})[_0xc430('0x8')](function(_0x4ad29e){if(_0x285407[_0xc430('0x1b')]&&fs[_0xc430('0x1d')](_0x4ad29e[_0xc430('0x1e')])){var _0x3d7ccf=util['format'](_0xc430('0x1f'),_0x4ad29e[_0xc430('0x1e')]);return _0x2c0422[_0xc430('0x20')](_0x4ad29e[_0xc430('0x1e')],_0x3d7ccf,config['secrets'][_0xc430('0x21')])[_0xc430('0x8')](function(){fs['unlink'](_0x4ad29e[_0xc430('0x1e')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x4ad29e;});}return _0x4ad29e;})[_0xc430('0x8')](function(_0x973a39){logger[_0xc430('0x9')](_0xc430('0x18'),_0x21e28a);logger[_0xc430('0xb')](_0xc430('0x18'),_0x21e28a,JSON[_0xc430('0xd')](_0x973a39));_0x33433f(_0x973a39);})[_0xc430('0x17')](function(_0x47da0d){logger[_0xc430('0xe')]('CreateVoiceRecording',_0x47da0d[_0xc430('0xf')],_0x21e28a);_0x2ec021(_0x50110b[_0xc430('0xe')](0x1f4,_0x47da0d[_0xc430('0xf')]));});});}; \ No newline at end of file +var _0x0120=['attributes','limit','then','debug','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','format','value','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateVoiceRecording','update','body','options','raw'];(function(_0x451520,_0x1b57a4){var _0x18bc6b=function(_0x2d472c){while(--_0x2d472c){_0x451520['push'](_0x451520['shift']());}};_0x18bc6b(++_0x1b57a4);}(_0x0120,0x6f));var _0x0012=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0120[_0x432682];return _0x463d05;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});}exports[_0x0012('0x16')]=function(_0x1d0423){var _0x22ded1=this;return new Promise(function(_0x1e78ee,_0x2eb3fa){return db['VoiceRecording'][_0x0012('0x17')](_0x1d0423[_0x0012('0x18')],{'raw':_0x1d0423['options']?_0x1d0423[_0x0012('0x19')][_0x0012('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d0423[_0x0012('0x19')]?_0x1d0423[_0x0012('0x19')]['where']||null:null,'attributes':_0x1d0423['options']?_0x1d0423[_0x0012('0x19')][_0x0012('0x1b')]||null:null,'limit':_0x1d0423[_0x0012('0x19')]?_0x1d0423[_0x0012('0x19')][_0x0012('0x1c')]||null:null})[_0x0012('0x1d')](function(_0x2c9a96){logger[_0x0012('0xd')]('UpdateVoiceRecording',_0x1d0423);logger[_0x0012('0x1e')](_0x0012('0x16'),_0x1d0423,JSON['stringify'](_0x2c9a96));_0x1e78ee(_0x2c9a96);})[_0x0012('0x1f')](function(_0x13a78e){logger[_0x0012('0x12')](_0x0012('0x16'),_0x13a78e[_0x0012('0x14')],_0x1d0423);_0x2eb3fa(_0x22ded1['error'](0x1f4,_0x13a78e[_0x0012('0x14')]));});});};exports[_0x0012('0x20')]=function(_0xbb5b55){var _0x2a0302=this;return new Promise(function(_0x173cb3,_0xb37ef5){var _0x15d48a=require(_0x0012('0x21'));var _0x300e13;return db[_0x0012('0x22')][_0x0012('0x23')]({'attributes':['id',_0x0012('0x24')],'where':{'id':0x1},'raw':!![]})[_0x0012('0x1d')](function(_0x3ce788){_0x300e13=_0x3ce788;return db[_0x0012('0x25')][_0x0012('0x26')](_0xbb5b55[_0x0012('0x18')]);})[_0x0012('0x1d')](function(_0x1c23e0){if(_0x300e13[_0x0012('0x24')]&&fs[_0x0012('0x27')](_0x1c23e0['value'])){var _0x283134=util[_0x0012('0x28')]('%s.cypher',_0x1c23e0[_0x0012('0x29')]);return _0x15d48a[_0x0012('0x2a')](_0x1c23e0[_0x0012('0x29')],_0x283134,config[_0x0012('0x2b')][_0x0012('0x2c')])['then'](function(){fs[_0x0012('0x2d')](_0x1c23e0[_0x0012('0x29')]);logger[_0x0012('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x1c23e0;});}return _0x1c23e0;})[_0x0012('0x1d')](function(_0x31225a){logger[_0x0012('0xd')](_0x0012('0x20'),_0xbb5b55);logger[_0x0012('0x1e')](_0x0012('0x20'),_0xbb5b55,JSON['stringify'](_0x31225a));_0x173cb3(_0x31225a);})[_0x0012('0x1f')](function(_0x30dfd8){logger[_0x0012('0x12')](_0x0012('0x20'),_0x30dfd8['message'],_0xbb5b55);_0xb37ef5(_0x2a0302['error'](0x1f4,_0x30dfd8[_0x0012('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4ddfe3e..6f8524c 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 _0x9095=['update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','post','create','put'];(function(_0x3e9979,_0x3c7113){var _0x536f58=function(_0x543057){while(--_0x543057){_0x3e9979['push'](_0x3e9979['shift']());}};_0x536f58(++_0x3c7113);}(_0x9095,0xbe));var _0x5909=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x9095[_0x1e172a];return _0x96338b;};'use strict';var multer=require('multer');var util=require(_0x5909('0x0'));var path=require(_0x5909('0x1'));var timeout=require('connect-timeout');var express=require(_0x5909('0x2'));var router=express['Router']();var fs_extra=require(_0x5909('0x3'));var auth=require(_0x5909('0x4'));var interaction=require(_0x5909('0x5'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x5909('0x6')]('/',auth[_0x5909('0x7')](),controller[_0x5909('0x8')]);router[_0x5909('0x6')](_0x5909('0x9'),auth[_0x5909('0x7')](),controller[_0x5909('0xa')]);router[_0x5909('0x6')]('/:id',auth[_0x5909('0x7')](),controller['show']);router[_0x5909('0xb')]('/',auth[_0x5909('0x7')](),controller[_0x5909('0xc')]);router[_0x5909('0xd')]('/:id',auth[_0x5909('0x7')](),controller[_0x5909('0xe')]);router[_0x5909('0xf')]('/:id',auth[_0x5909('0x7')](),controller['destroy']);module[_0x5909('0x10')]=router; \ No newline at end of file +var _0x482a=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','delete','destroy'];(function(_0x8a6ca3,_0x21fc3e){var _0x17eaa9=function(_0x3325cf){while(--_0x3325cf){_0x8a6ca3['push'](_0x8a6ca3['shift']());}};_0x17eaa9(++_0x21fc3e);}(_0x482a,0x1ef));var _0xa482=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x482a[_0x1a36a5];return _0x746243;};'use strict';var multer=require(_0xa482('0x0'));var util=require('util');var path=require(_0xa482('0x1'));var timeout=require('connect-timeout');var express=require(_0xa482('0x2'));var router=express[_0xa482('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa482('0x4'));var interaction=require(_0xa482('0x5'));var config=require(_0xa482('0x6'));var controller=require(_0xa482('0x7'));router[_0xa482('0x8')]('/',auth[_0xa482('0x9')](),controller[_0xa482('0xa')]);router[_0xa482('0x8')](_0xa482('0xb'),auth[_0xa482('0x9')](),controller[_0xa482('0xc')]);router['get'](_0xa482('0xd'),auth[_0xa482('0x9')](),controller['show']);router['post']('/',auth[_0xa482('0x9')](),controller[_0xa482('0xe')]);router[_0xa482('0xf')](_0xa482('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa482('0x10')](_0xa482('0xd'),auth[_0xa482('0x9')](),controller[_0xa482('0x11')]);module[_0xa482('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4ef00e3..4a2ebf4 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 _0xc60b=['attended','STRING','Yes','sequelize','exports','ENUM'];(function(_0x25310e,_0x519244){var _0x55e6c2=function(_0xa529b0){while(--_0xa529b0){_0x25310e['push'](_0x25310e['shift']());}};_0x55e6c2(++_0x519244);}(_0xc60b,0x10b));var _0xbc60=function(_0x2f83ae,_0x575ee0){_0x2f83ae=_0x2f83ae-0x0;var _0x43b987=_0xc60b[_0x2f83ae];return _0x43b987;};'use strict';var Sequelize=require(_0xbc60('0x0'));var moment=require('moment');module[_0xbc60('0x1')]={'type':{'type':Sequelize[_0xbc60('0x2')]('blind',_0xbc60('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xbc60('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xbc60('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xbc60('0x4')]},'transferercontext':{'type':Sequelize[_0xbc60('0x4')]},'transfererexten':{'type':Sequelize[_0xbc60('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xbc60('0x4')]},'transfereechannel':{'type':Sequelize[_0xbc60('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xbc60('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbc60('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xbc60('0x4')]},'transfereecontext':{'type':Sequelize[_0xbc60('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xbc60('0x4')]},'isexternal':{'type':Sequelize[_0xbc60('0x2')](_0xbc60('0x5'),'No')},'context':{'type':Sequelize[_0xbc60('0x4')]},'extension':{'type':Sequelize[_0xbc60('0x4')]}}; \ No newline at end of file +var _0xf025=['sequelize','moment','ENUM','blind','STRING','Yes'];(function(_0x3ac179,_0x2832d4){var _0x5565f1=function(_0x7695a1){while(--_0x7695a1){_0x3ac179['push'](_0x3ac179['shift']());}};_0x5565f1(++_0x2832d4);}(_0xf025,0xb4));var _0x5f02=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xf025[_0x38854e];return _0x3f8415;};'use strict';var Sequelize=require(_0x5f02('0x0'));var moment=require(_0x5f02('0x1'));module['exports']={'type':{'type':Sequelize[_0x5f02('0x2')](_0x5f02('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x5f02('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x5f02('0x4')]},'transferercalleridname':{'type':Sequelize[_0x5f02('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x5f02('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x5f02('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x5f02('0x4')]},'transferercontext':{'type':Sequelize[_0x5f02('0x4')]},'transfererexten':{'type':Sequelize[_0x5f02('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x5f02('0x4')]},'transfereechannel':{'type':Sequelize[_0x5f02('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x5f02('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x5f02('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x5f02('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x5f02('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x5f02('0x4')]},'transfereecontext':{'type':Sequelize[_0x5f02('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x5f02('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x5f02('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5f02('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 391516e..d95a0c5 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 _0x6a06=['pick','filter','VIRTUAL','merge','options','count','includeAll','include','params','keys','rawAttributes','filters','find','catch','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','index','map','VoiceTransferReport','fieldName','type','model','name','query','attributes','intersection','fields','order','sort','where'];(function(_0x470be7,_0x181dfe){var _0x32063c=function(_0x3cda08){while(--_0x3cda08){_0x470be7['push'](_0x470be7['shift']());}};_0x32063c(++_0x181dfe);}(_0x6a06,0x174));var _0x66a0=function(_0x3f95f2,_0x307ecc){_0x3f95f2=_0x3f95f2-0x0;var _0x5a2a66=_0x6a06[_0x3f95f2];return _0x5a2a66;};'use strict';var emlformat=require(_0x66a0('0x0'));var rimraf=require(_0x66a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x66a0('0x2'));var moment=require(_0x66a0('0x3'));var BPromise=require(_0x66a0('0x4'));var Mustache=require(_0x66a0('0x5'));var util=require('util');var path=require(_0x66a0('0x6'));var sox=require(_0x66a0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66a0('0x8'));var _=require(_0x66a0('0x9'));var squel=require(_0x66a0('0xa'));var crypto=require(_0x66a0('0xb'));var jsforce=require(_0x66a0('0xc'));var deskjs=require(_0x66a0('0xd'));var toCsv=require(_0x66a0('0xe'));var querystring=require(_0x66a0('0xf'));var Papa=require(_0x66a0('0x10'));var Redis=require(_0x66a0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66a0('0x12'));var hardwareService=require(_0x66a0('0x13'));var logger=require(_0x66a0('0x14'))(_0x66a0('0x15'));var utils=require(_0x66a0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x66a0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e72f8,_0x303b5e){_0x303b5e=_0x303b5e||0xcc;return function(_0x118817){if(_0x118817){return _0x3e72f8[_0x66a0('0x18')](_0x303b5e);}return _0x3e72f8['status'](_0x303b5e)[_0x66a0('0x19')]();};}function respondWithResult(_0x592e21,_0x3b0e14){_0x3b0e14=_0x3b0e14||0xc8;return function(_0x390ac0){if(_0x390ac0){return _0x592e21[_0x66a0('0x1a')](_0x3b0e14)[_0x66a0('0x1b')](_0x390ac0);}};}function respondWithFilteredResult(_0x2dacf2,_0x4593ac){return function(_0x2d489d){if(_0x2d489d){var _0x5bfeca=typeof _0x4593ac[_0x66a0('0x1c')]===_0x66a0('0x1d')&&typeof _0x4593ac[_0x66a0('0x1e')]===_0x66a0('0x1d');var _0x2416d6=_0x2d489d['count'];var _0x4f9eaf=_0x5bfeca?0x0:_0x4593ac[_0x66a0('0x1c')];var _0x44749f=_0x5bfeca?_0x2d489d['count']:_0x4593ac[_0x66a0('0x1c')]+_0x4593ac['limit'];var _0x3c2235;if(_0x44749f>=_0x2416d6){_0x44749f=_0x2416d6;_0x3c2235=0xc8;}else{_0x3c2235=0xce;}_0x2dacf2[_0x66a0('0x1a')](_0x3c2235);return _0x2dacf2[_0x66a0('0x1f')](_0x66a0('0x20'),_0x4f9eaf+'-'+_0x44749f+'/'+_0x2416d6)[_0x66a0('0x1b')](_0x2d489d);}return null;};}function patchUpdates(_0x8b5c3e){return function(_0x4bd9d3){try{jsonpatch[_0x66a0('0x21')](_0x4bd9d3,_0x8b5c3e,!![]);}catch(_0x579d8c){return BPromise['reject'](_0x579d8c);}return _0x4bd9d3[_0x66a0('0x22')]();};}function saveUpdates(_0x1b667f,_0x1bc02b){return function(_0x45f2c5){if(_0x45f2c5){return _0x45f2c5[_0x66a0('0x23')](_0x1b667f)[_0x66a0('0x24')](function(_0x63f8dc){return _0x63f8dc;});}return null;};}function removeEntity(_0x129b9f,_0x3bbf83){return function(_0x332593){if(_0x332593){return _0x332593[_0x66a0('0x25')]()[_0x66a0('0x24')](function(){_0x129b9f[_0x66a0('0x1a')](0xcc)[_0x66a0('0x19')]();});}};}function handleEntityNotFound(_0xc6fb0d,_0x399ce0){return function(_0x3e5f0c){if(!_0x3e5f0c){_0xc6fb0d[_0x66a0('0x18')](0x194);}return _0x3e5f0c;};}function handleError(_0x3cab7c,_0x425d0b){_0x425d0b=_0x425d0b||0x1f4;return function(_0x5bc557){logger[_0x66a0('0x26')](_0x5bc557[_0x66a0('0x27')]);if(_0x5bc557['name']){delete _0x5bc557['name'];}_0x3cab7c[_0x66a0('0x1a')](_0x425d0b)['send'](_0x5bc557);};}exports[_0x66a0('0x28')]=function(_0x6a66f6,_0x253258){var _0x25fbeb={},_0x327eeb={},_0x5e8e39={'count':0x0,'rows':[]};var _0x20860e=_[_0x66a0('0x29')](db[_0x66a0('0x2a')]['rawAttributes'],function(_0x49adaf){return{'name':_0x49adaf[_0x66a0('0x2b')],'type':_0x49adaf[_0x66a0('0x2c')]['key']};});_0x327eeb[_0x66a0('0x2d')]=_[_0x66a0('0x29')](_0x20860e,_0x66a0('0x2e'));_0x327eeb['query']=_['keys'](_0x6a66f6[_0x66a0('0x2f')]);_0x327eeb['filters']=_['intersection'](_0x327eeb[_0x66a0('0x2d')],_0x327eeb[_0x66a0('0x2f')]);_0x25fbeb[_0x66a0('0x30')]=_[_0x66a0('0x31')](_0x327eeb[_0x66a0('0x2d')],qs[_0x66a0('0x32')](_0x6a66f6[_0x66a0('0x2f')]['fields']));_0x25fbeb['attributes']=_0x25fbeb[_0x66a0('0x30')]['length']?_0x25fbeb[_0x66a0('0x30')]:_0x327eeb[_0x66a0('0x2d')];if(!_0x6a66f6[_0x66a0('0x2f')]['hasOwnProperty']('nolimit')){_0x25fbeb[_0x66a0('0x1e')]=qs[_0x66a0('0x1e')](_0x6a66f6[_0x66a0('0x2f')]['limit']);_0x25fbeb['offset']=qs[_0x66a0('0x1c')](_0x6a66f6[_0x66a0('0x2f')][_0x66a0('0x1c')]);}_0x25fbeb[_0x66a0('0x33')]=qs[_0x66a0('0x34')](_0x6a66f6[_0x66a0('0x2f')]['sort']);_0x25fbeb[_0x66a0('0x35')]=qs['filters'](_[_0x66a0('0x36')](_0x6a66f6['query'],_0x327eeb['filters']),_0x20860e);if(_0x6a66f6[_0x66a0('0x2f')][_0x66a0('0x37')]){_0x25fbeb[_0x66a0('0x35')]=_['merge'](_0x25fbeb[_0x66a0('0x35')],{'$or':_[_0x66a0('0x29')](_0x20860e,function(_0x30a826){if(_0x30a826[_0x66a0('0x2c')]!==_0x66a0('0x38')){var _0x432fd0={};_0x432fd0[_0x30a826['name']]={'$like':'%'+_0x6a66f6[_0x66a0('0x2f')][_0x66a0('0x37')]+'%'};return _0x432fd0;}})});}_0x25fbeb=_[_0x66a0('0x39')]({},_0x25fbeb,_0x6a66f6[_0x66a0('0x3a')]);var _0x165b22={'where':_0x25fbeb[_0x66a0('0x35')]};return db[_0x66a0('0x2a')][_0x66a0('0x3b')](_0x165b22)[_0x66a0('0x24')](function(_0x346fa9){_0x5e8e39[_0x66a0('0x3b')]=_0x346fa9;if(_0x6a66f6['query'][_0x66a0('0x3c')]){_0x25fbeb[_0x66a0('0x3d')]=[{'all':!![]}];}return db[_0x66a0('0x2a')]['findAll'](_0x25fbeb);})[_0x66a0('0x24')](function(_0x3eaa78){_0x5e8e39['rows']=_0x3eaa78;return _0x5e8e39;})[_0x66a0('0x24')](respondWithFilteredResult(_0x253258,_0x25fbeb))['catch'](handleError(_0x253258,null));};exports['show']=function(_0xca3e34,_0x2ef735){var _0x13f27a={'raw':!![],'where':{'id':_0xca3e34[_0x66a0('0x3e')]['id']}},_0x376f9a={};_0x376f9a['model']=_[_0x66a0('0x3f')](db[_0x66a0('0x2a')][_0x66a0('0x40')]);_0x376f9a[_0x66a0('0x2f')]=_[_0x66a0('0x3f')](_0xca3e34[_0x66a0('0x2f')]);_0x376f9a[_0x66a0('0x41')]=_[_0x66a0('0x31')](_0x376f9a[_0x66a0('0x2d')],_0x376f9a[_0x66a0('0x2f')]);_0x13f27a['attributes']=_[_0x66a0('0x31')](_0x376f9a[_0x66a0('0x2d')],qs['fields'](_0xca3e34[_0x66a0('0x2f')][_0x66a0('0x32')]));_0x13f27a[_0x66a0('0x30')]=_0x13f27a[_0x66a0('0x30')]['length']?_0x13f27a[_0x66a0('0x30')]:_0x376f9a[_0x66a0('0x2d')];if(_0xca3e34[_0x66a0('0x2f')][_0x66a0('0x3c')]){_0x13f27a['include']=[{'all':!![]}];}_0x13f27a=_['merge']({},_0x13f27a,_0xca3e34['options']);return db['VoiceTransferReport'][_0x66a0('0x42')](_0x13f27a)['then'](handleEntityNotFound(_0x2ef735,null))[_0x66a0('0x24')](respondWithResult(_0x2ef735,null))[_0x66a0('0x43')](handleError(_0x2ef735,null));};exports[_0x66a0('0x44')]=function(_0x2a74fe,_0x4794e3){return db[_0x66a0('0x2a')]['create'](_0x2a74fe[_0x66a0('0x45')],{})[_0x66a0('0x24')](respondWithResult(_0x4794e3,0xc9))[_0x66a0('0x43')](handleError(_0x4794e3,null));};exports[_0x66a0('0x23')]=function(_0x1b32b6,_0x282800){if(_0x1b32b6[_0x66a0('0x45')]['id']){delete _0x1b32b6[_0x66a0('0x45')]['id'];}return db[_0x66a0('0x2a')]['find']({'where':{'id':_0x1b32b6[_0x66a0('0x3e')]['id']}})[_0x66a0('0x24')](handleEntityNotFound(_0x282800,null))[_0x66a0('0x24')](saveUpdates(_0x1b32b6[_0x66a0('0x45')],null))[_0x66a0('0x24')](respondWithResult(_0x282800,null))[_0x66a0('0x43')](handleError(_0x282800,null));};exports[_0x66a0('0x25')]=function(_0x543c51,_0x1b0bc5){return db[_0x66a0('0x2a')][_0x66a0('0x42')]({'where':{'id':_0x543c51[_0x66a0('0x3e')]['id']}})[_0x66a0('0x24')](handleEntityNotFound(_0x1b0bc5,null))[_0x66a0('0x24')](removeEntity(_0x1b0bc5,null))[_0x66a0('0x43')](handleError(_0x1b0bc5,null));};exports[_0x66a0('0x46')]=function(_0xd1fc41,_0x16d172){return db[_0x66a0('0x2a')][_0x66a0('0x46')]()[_0x66a0('0x24')](respondWithResult(_0x16d172,null))['catch'](handleError(_0x16d172,null));}; \ No newline at end of file +var _0xc061=['end','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','merge','type','filter','options','includeAll','rows','catch','show','params','keys','length','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xc061,0x1d9));var _0x1c06=function(_0x5bd944,_0x331f16){_0x5bd944=_0x5bd944-0x0;var _0xa8e184=_0xc061[_0x5bd944];return _0xa8e184;};'use strict';var emlformat=require(_0x1c06('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c06('0x1'));var jsonpatch=require(_0x1c06('0x2'));var rp=require('request-promise');var moment=require(_0x1c06('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c06('0x4'));var path=require(_0x1c06('0x5'));var sox=require(_0x1c06('0x6'));var csv=require(_0x1c06('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c06('0x8'));var _=require('lodash');var squel=require(_0x1c06('0x9'));var crypto=require(_0x1c06('0xa'));var jsforce=require(_0x1c06('0xb'));var deskjs=require(_0x1c06('0xc'));var toCsv=require(_0x1c06('0x7'));var querystring=require(_0x1c06('0xd'));var Papa=require(_0x1c06('0xe'));var Redis=require('ioredis');var authService=require(_0x1c06('0xf'));var qs=require(_0x1c06('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c06('0x11'));var logger=require(_0x1c06('0x12'))(_0x1c06('0x13'));var utils=require(_0x1c06('0x14'));var config=require(_0x1c06('0x15'));var licenseUtil=require(_0x1c06('0x16'));var db=require(_0x1c06('0x17'))['db'];function respondWithStatusCode(_0x2bac97,_0x531727){_0x531727=_0x531727||0xcc;return function(_0x3a776e){if(_0x3a776e){return _0x2bac97[_0x1c06('0x18')](_0x531727);}return _0x2bac97[_0x1c06('0x19')](_0x531727)['end']();};}function respondWithResult(_0x428296,_0x1ff068){_0x1ff068=_0x1ff068||0xc8;return function(_0x48beb6){if(_0x48beb6){return _0x428296[_0x1c06('0x19')](_0x1ff068)[_0x1c06('0x1a')](_0x48beb6);}};}function respondWithFilteredResult(_0x484af6,_0x4192fb){return function(_0x538b67){if(_0x538b67){var _0xe1d93a=typeof _0x4192fb[_0x1c06('0x1b')]==='undefined'&&typeof _0x4192fb[_0x1c06('0x1c')]===_0x1c06('0x1d');var _0x53bc1e=_0x538b67[_0x1c06('0x1e')];var _0x4ea057=_0xe1d93a?0x0:_0x4192fb[_0x1c06('0x1b')];var _0x13deb8=_0xe1d93a?_0x538b67['count']:_0x4192fb[_0x1c06('0x1b')]+_0x4192fb[_0x1c06('0x1c')];var _0x146036;if(_0x13deb8>=_0x53bc1e){_0x13deb8=_0x53bc1e;_0x146036=0xc8;}else{_0x146036=0xce;}_0x484af6[_0x1c06('0x19')](_0x146036);return _0x484af6[_0x1c06('0x1f')](_0x1c06('0x20'),_0x4ea057+'-'+_0x13deb8+'/'+_0x53bc1e)['json'](_0x538b67);}return null;};}function patchUpdates(_0x43cf4){return function(_0x3a3dfd){try{jsonpatch[_0x1c06('0x21')](_0x3a3dfd,_0x43cf4,!![]);}catch(_0x431739){return BPromise['reject'](_0x431739);}return _0x3a3dfd[_0x1c06('0x22')]();};}function saveUpdates(_0x2a1eb1,_0x4ecfb7){return function(_0x287ab2){if(_0x287ab2){return _0x287ab2[_0x1c06('0x23')](_0x2a1eb1)[_0x1c06('0x24')](function(_0x5f0329){return _0x5f0329;});}return null;};}function removeEntity(_0x10d772,_0x1c87e8){return function(_0x1be34a){if(_0x1be34a){return _0x1be34a[_0x1c06('0x25')]()[_0x1c06('0x24')](function(){_0x10d772[_0x1c06('0x19')](0xcc)[_0x1c06('0x26')]();});}};}function handleEntityNotFound(_0x3835b7,_0x170d8e){return function(_0x58ce31){if(!_0x58ce31){_0x3835b7[_0x1c06('0x18')](0x194);}return _0x58ce31;};}function handleError(_0x863fb1,_0x1fe71b){_0x1fe71b=_0x1fe71b||0x1f4;return function(_0x33c853){logger[_0x1c06('0x27')](_0x33c853[_0x1c06('0x28')]);if(_0x33c853[_0x1c06('0x29')]){delete _0x33c853[_0x1c06('0x29')];}_0x863fb1['status'](_0x1fe71b)[_0x1c06('0x2a')](_0x33c853);};}exports['index']=function(_0x254025,_0x33f85c){var _0x11930c={},_0x36eece={},_0x2950ee={'count':0x0,'rows':[]};var _0x5ec8c4=_[_0x1c06('0x2b')](db[_0x1c06('0x2c')][_0x1c06('0x2d')],function(_0x43d8fe){return{'name':_0x43d8fe[_0x1c06('0x2e')],'type':_0x43d8fe['type'][_0x1c06('0x2f')]};});_0x36eece['model']=_[_0x1c06('0x2b')](_0x5ec8c4,'name');_0x36eece[_0x1c06('0x30')]=_['keys'](_0x254025[_0x1c06('0x30')]);_0x36eece[_0x1c06('0x31')]=_[_0x1c06('0x32')](_0x36eece[_0x1c06('0x33')],_0x36eece[_0x1c06('0x30')]);_0x11930c[_0x1c06('0x34')]=_[_0x1c06('0x32')](_0x36eece[_0x1c06('0x33')],qs[_0x1c06('0x35')](_0x254025[_0x1c06('0x30')][_0x1c06('0x35')]));_0x11930c['attributes']=_0x11930c[_0x1c06('0x34')]['length']?_0x11930c[_0x1c06('0x34')]:_0x36eece[_0x1c06('0x33')];if(!_0x254025[_0x1c06('0x30')][_0x1c06('0x36')]('nolimit')){_0x11930c[_0x1c06('0x1c')]=qs[_0x1c06('0x1c')](_0x254025[_0x1c06('0x30')][_0x1c06('0x1c')]);_0x11930c[_0x1c06('0x1b')]=qs['offset'](_0x254025[_0x1c06('0x30')]['offset']);}_0x11930c['order']=qs[_0x1c06('0x37')](_0x254025[_0x1c06('0x30')][_0x1c06('0x37')]);_0x11930c[_0x1c06('0x38')]=qs[_0x1c06('0x31')](_[_0x1c06('0x39')](_0x254025[_0x1c06('0x30')],_0x36eece[_0x1c06('0x31')]),_0x5ec8c4);if(_0x254025[_0x1c06('0x30')]['filter']){_0x11930c[_0x1c06('0x38')]=_[_0x1c06('0x3a')](_0x11930c[_0x1c06('0x38')],{'$or':_[_0x1c06('0x2b')](_0x5ec8c4,function(_0x785284){if(_0x785284[_0x1c06('0x3b')]!=='VIRTUAL'){var _0x235b49={};_0x235b49[_0x785284[_0x1c06('0x29')]]={'$like':'%'+_0x254025[_0x1c06('0x30')][_0x1c06('0x3c')]+'%'};return _0x235b49;}})});}_0x11930c=_[_0x1c06('0x3a')]({},_0x11930c,_0x254025[_0x1c06('0x3d')]);var _0x4182a5={'where':_0x11930c[_0x1c06('0x38')]};return db[_0x1c06('0x2c')][_0x1c06('0x1e')](_0x4182a5)[_0x1c06('0x24')](function(_0x5b0837){_0x2950ee[_0x1c06('0x1e')]=_0x5b0837;if(_0x254025[_0x1c06('0x30')][_0x1c06('0x3e')]){_0x11930c['include']=[{'all':!![]}];}return db[_0x1c06('0x2c')]['findAll'](_0x11930c);})[_0x1c06('0x24')](function(_0x23b271){_0x2950ee[_0x1c06('0x3f')]=_0x23b271;return _0x2950ee;})[_0x1c06('0x24')](respondWithFilteredResult(_0x33f85c,_0x11930c))[_0x1c06('0x40')](handleError(_0x33f85c,null));};exports[_0x1c06('0x41')]=function(_0xfa6441,_0x4f5484){var _0x22b72c={'raw':!![],'where':{'id':_0xfa6441[_0x1c06('0x42')]['id']}},_0x3840b1={};_0x3840b1[_0x1c06('0x33')]=_['keys'](db[_0x1c06('0x2c')][_0x1c06('0x2d')]);_0x3840b1[_0x1c06('0x30')]=_[_0x1c06('0x43')](_0xfa6441[_0x1c06('0x30')]);_0x3840b1[_0x1c06('0x31')]=_[_0x1c06('0x32')](_0x3840b1[_0x1c06('0x33')],_0x3840b1[_0x1c06('0x30')]);_0x22b72c['attributes']=_[_0x1c06('0x32')](_0x3840b1[_0x1c06('0x33')],qs[_0x1c06('0x35')](_0xfa6441[_0x1c06('0x30')][_0x1c06('0x35')]));_0x22b72c['attributes']=_0x22b72c[_0x1c06('0x34')][_0x1c06('0x44')]?_0x22b72c[_0x1c06('0x34')]:_0x3840b1[_0x1c06('0x33')];if(_0xfa6441[_0x1c06('0x30')][_0x1c06('0x3e')]){_0x22b72c['include']=[{'all':!![]}];}_0x22b72c=_['merge']({},_0x22b72c,_0xfa6441[_0x1c06('0x3d')]);return db['VoiceTransferReport']['find'](_0x22b72c)['then'](handleEntityNotFound(_0x4f5484,null))[_0x1c06('0x24')](respondWithResult(_0x4f5484,null))[_0x1c06('0x40')](handleError(_0x4f5484,null));};exports[_0x1c06('0x45')]=function(_0x22696b,_0x16b882){return db['VoiceTransferReport'][_0x1c06('0x45')](_0x22696b['body'],{})[_0x1c06('0x24')](respondWithResult(_0x16b882,0xc9))[_0x1c06('0x40')](handleError(_0x16b882,null));};exports[_0x1c06('0x23')]=function(_0x444121,_0x1f7627){if(_0x444121[_0x1c06('0x46')]['id']){delete _0x444121[_0x1c06('0x46')]['id'];}return db[_0x1c06('0x2c')][_0x1c06('0x47')]({'where':{'id':_0x444121[_0x1c06('0x42')]['id']}})[_0x1c06('0x24')](handleEntityNotFound(_0x1f7627,null))['then'](saveUpdates(_0x444121[_0x1c06('0x46')],null))[_0x1c06('0x24')](respondWithResult(_0x1f7627,null))[_0x1c06('0x40')](handleError(_0x1f7627,null));};exports['destroy']=function(_0x3b39a7,_0x5ca754){return db[_0x1c06('0x2c')]['find']({'where':{'id':_0x3b39a7['params']['id']}})['then'](handleEntityNotFound(_0x5ca754,null))[_0x1c06('0x24')](removeEntity(_0x5ca754,null))[_0x1c06('0x40')](handleError(_0x5ca754,null));};exports[_0x1c06('0x48')]=function(_0x364665,_0x2d6986){return db['VoiceTransferReport'][_0x1c06('0x48')]()[_0x1c06('0x24')](respondWithResult(_0x2d6986,null))[_0x1c06('0x40')](handleError(_0x2d6986,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 12afd1c..5c88c2a 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 _0x98fc=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x5c6fa0,_0x28d1b5){var _0x4c0ace=function(_0x20856c){while(--_0x20856c){_0x5c6fa0['push'](_0x5c6fa0['shift']());}};_0x4c0ace(++_0x28d1b5);}(_0x98fc,0x18d));var _0xc98f=function(_0x3c8832,_0x16e93e){_0x3c8832=_0x3c8832-0x0;var _0xacf303=_0x98fc[_0x3c8832];return _0xacf303;};'use strict';var _=require(_0xc98f('0x0'));var util=require('util');var logger=require(_0xc98f('0x1'))(_0xc98f('0x2'));var moment=require(_0xc98f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc98f('0x4'));var fs=require('fs');var path=require(_0xc98f('0x5'));var rimraf=require(_0xc98f('0x6'));var config=require(_0xc98f('0x7'));var attributes=require(_0xc98f('0x8'));module[_0xc98f('0x9')]=function(_0x18015c,_0x2c6cab){return _0x18015c[_0xc98f('0xa')](_0xc98f('0xb'),attributes,{'tableName':_0xc98f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4d5=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x535ce9,_0x581953){var _0x39488d=function(_0x549733){while(--_0x549733){_0x535ce9['push'](_0x535ce9['shift']());}};_0x39488d(++_0x581953);}(_0xc4d5,0x139));var _0x5c4d=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0xc4d5[_0x52bfa5];return _0x26f80b;};'use strict';var _=require(_0x5c4d('0x0'));var util=require(_0x5c4d('0x1'));var logger=require(_0x5c4d('0x2'))(_0x5c4d('0x3'));var moment=require(_0x5c4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x5c4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c4d('0x6'));var config=require(_0x5c4d('0x7'));var attributes=require(_0x5c4d('0x8'));module[_0x5c4d('0x9')]=function(_0xf7af90,_0x504018){return _0xf7af90['define'](_0x5c4d('0xa'),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 089ebda..c6b3b39 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 _0xa79a=['result','catch','VoiceTransferReport','create','body','options','CreateVoiceTransferReport','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ccfa3,_0x22bb44){var _0x1fb26b=function(_0x407fcd){while(--_0x407fcd){_0x2ccfa3['push'](_0x2ccfa3['shift']());}};_0x1fb26b(++_0x22bb44);}(_0xa79a,0x19b));var _0xaa79=function(_0x477300,_0x4f3069){_0x477300=_0x477300-0x0;var _0x246be6=_0xa79a[_0x477300];return _0x246be6;};'use strict';var _=require(_0xaa79('0x0'));var util=require(_0xaa79('0x1'));var moment=require(_0xaa79('0x2'));var BPromise=require(_0xaa79('0x3'));var rs=require(_0xaa79('0x4'));var fs=require('fs');var Redis=require(_0xaa79('0x5'));var db=require(_0xaa79('0x6'))['db'];var utils=require(_0xaa79('0x7'));var logger=require(_0xaa79('0x8'))(_0xaa79('0x9'));var config=require(_0xaa79('0xa'));var jayson=require(_0xaa79('0xb'));var client=jayson[_0xaa79('0xc')][_0xaa79('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2c7a53,_0x7a6c38,_0x86b964){return new BPromise(function(_0x3a1246,_0x1ae6c3){return client['request'](_0x2c7a53,_0x86b964)[_0xaa79('0xe')](function(_0x9aade3){logger[_0xaa79('0xf')](_0xaa79('0x10'),_0x7a6c38,_0xaa79('0x11'));logger['debug'](_0xaa79('0x12'),_0x7a6c38,_0xaa79('0x11'),JSON[_0xaa79('0x13')](_0x9aade3));if(_0x9aade3[_0xaa79('0x14')]){if(_0x9aade3['error'][_0xaa79('0x15')]===0x1f4){logger[_0xaa79('0x14')](_0xaa79('0x10'),_0x7a6c38,_0x9aade3[_0xaa79('0x14')][_0xaa79('0x16')]);return _0x1ae6c3(_0x9aade3[_0xaa79('0x14')]['message']);}logger['error'](_0xaa79('0x10'),_0x7a6c38,_0x9aade3[_0xaa79('0x14')][_0xaa79('0x16')]);return _0x3a1246(_0x9aade3['error'][_0xaa79('0x16')]);}else{logger[_0xaa79('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x7a6c38,_0xaa79('0x11'));_0x3a1246(_0x9aade3[_0xaa79('0x17')]['message']);}})[_0xaa79('0x18')](function(_0x686369){logger[_0xaa79('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x7a6c38,_0x686369);_0x1ae6c3(_0x686369);});});}exports['CreateVoiceTransferReport']=function(_0x13e104){var _0xf0ab8a=this;return new Promise(function(_0x46c89a,_0x2e9653){return db[_0xaa79('0x19')][_0xaa79('0x1a')](_0x13e104[_0xaa79('0x1b')],{'raw':_0x13e104[_0xaa79('0x1c')]?_0x13e104[_0xaa79('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xaa79('0xe')](function(_0x1a5c34){logger[_0xaa79('0xf')](_0xaa79('0x1d'),_0x13e104);logger[_0xaa79('0x1e')]('CreateVoiceTransferReport',_0x13e104,JSON[_0xaa79('0x13')](_0x1a5c34));_0x46c89a(_0x1a5c34);})[_0xaa79('0x18')](function(_0x2c6739){logger['error'](_0xaa79('0x1d'),_0x2c6739[_0xaa79('0x16')],_0x13e104);_0x2e9653(_0xf0ab8a[_0xaa79('0x14')](0x1f4,_0x2c6739['message']));});});}; \ No newline at end of file +var _0x9062=['stringify','catch','lodash','moment','bluebird','randomstring','rpc','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','debug'];(function(_0xa5d559,_0x338e89){var _0x5edfaf=function(_0x1321fd){while(--_0x1321fd){_0xa5d559['push'](_0xa5d559['shift']());}};_0x5edfaf(++_0x338e89);}(_0x9062,0x1dd));var _0x2906=function(_0x12d095,_0x85233f){_0x12d095=_0x12d095-0x0;var _0x16081d=_0x9062[_0x12d095];return _0x16081d;};'use strict';var _=require(_0x2906('0x0'));var util=require('util');var moment=require(_0x2906('0x1'));var BPromise=require(_0x2906('0x2'));var rs=require(_0x2906('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2906('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2906('0x5')][_0x2906('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x433ede,_0x28fb25,_0x16156d){return new BPromise(function(_0x145bef,_0x20d1bf){return client[_0x2906('0x7')](_0x433ede,_0x16156d)[_0x2906('0x8')](function(_0x5b03b7){logger[_0x2906('0x9')](_0x2906('0xa'),_0x28fb25,'request\x20sent');logger['debug'](_0x2906('0xb'),_0x28fb25,'request\x20sent',JSON['stringify'](_0x5b03b7));if(_0x5b03b7[_0x2906('0xc')]){if(_0x5b03b7[_0x2906('0xc')][_0x2906('0xd')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x28fb25,_0x5b03b7[_0x2906('0xc')][_0x2906('0xe')]);return _0x20d1bf(_0x5b03b7[_0x2906('0xc')][_0x2906('0xe')]);}logger[_0x2906('0xc')](_0x2906('0xa'),_0x28fb25,_0x5b03b7[_0x2906('0xc')][_0x2906('0xe')]);return _0x145bef(_0x5b03b7[_0x2906('0xc')][_0x2906('0xe')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x28fb25,_0x2906('0xf'));_0x145bef(_0x5b03b7[_0x2906('0x10')]['message']);}})['catch'](function(_0x456e1a){logger[_0x2906('0xc')](_0x2906('0xa'),_0x28fb25,_0x456e1a);_0x20d1bf(_0x456e1a);});});}exports[_0x2906('0x11')]=function(_0x3c93f3){var _0x217513=this;return new Promise(function(_0x565a8b,_0x2f7b21){return db[_0x2906('0x12')][_0x2906('0x13')](_0x3c93f3['body'],{'raw':_0x3c93f3[_0x2906('0x14')]?_0x3c93f3[_0x2906('0x14')][_0x2906('0x15')]===undefined?!![]:![]:!![]})[_0x2906('0x8')](function(_0x6a9b41){logger[_0x2906('0x9')]('CreateVoiceTransferReport',_0x3c93f3);logger[_0x2906('0x16')]('CreateVoiceTransferReport',_0x3c93f3,JSON[_0x2906('0x17')](_0x6a9b41));_0x565a8b(_0x6a9b41);})[_0x2906('0x18')](function(_0x5bb835){logger[_0x2906('0xc')]('CreateVoiceTransferReport',_0x5bb835[_0x2906('0xe')],_0x3c93f3);_0x2f7b21(_0x217513[_0x2906('0xc')](0x1f4,_0x5bb835[_0x2906('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0529d47..68541b6 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 _0x750a=['Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x8ce506,_0x517f30){var _0x23c8e5=function(_0x1d048e){while(--_0x1d048e){_0x8ce506['push'](_0x8ce506['shift']());}};_0x23c8e5(++_0x517f30);}(_0x750a,0x140));var _0xa750=function(_0x2d8c5e,_0x5f1f60){_0x2d8c5e=_0x2d8c5e-0x0;var _0x2cd3f0=_0x750a[_0x2d8c5e];return _0x2cd3f0;};'use strict';var express=require('express');var router=express[_0xa750('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xa750('0x1')](_0xa750('0x2'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x5')]);router[_0xa750('0x1')](_0xa750('0x6'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x7')]);router[_0xa750('0x1')](_0xa750('0x8'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xa750('0x1')]('/hold',auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller['hold']);router[_0xa750('0x1')](_0xa750('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xa750('0xa')]);router['post'](_0xa750('0xb'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller[_0xa750('0xc')]);router[_0xa750('0x1')](_0xa750('0xd'),auth['isAuthenticated'](),auth[_0xa750('0x4')](),controller[_0xa750('0xe')]);module[_0xa750('0xf')]=router; \ No newline at end of file +var _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x523bd2,_0x4c3ecc){var _0x4a1012=function(_0x353d0b){while(--_0x353d0b){_0x523bd2['push'](_0x523bd2['shift']());}};_0x4a1012(++_0x4c3ecc);}(_0xb821,0xa7));var _0x1b82=function(_0x30b588,_0x3a5d76){_0x30b588=_0x30b588-0x0;var _0x419fe8=_0xb821[_0x30b588];return _0x419fe8;};'use strict';var express=require('express');var router=express[_0x1b82('0x0')]();var auth=require(_0x1b82('0x1'));var controller=require('./webbar.controller');router['post'](_0x1b82('0x2'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x1b82('0x3')]);router[_0x1b82('0x4')](_0x1b82('0x5'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x4')](_0x1b82('0x8'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x4')](_0x1b82('0xb'),auth[_0x1b82('0x6')](),auth['isWebrtcLicence'](),controller[_0x1b82('0xc')]);router[_0x1b82('0x4')](_0x1b82('0xd'),auth[_0x1b82('0x6')](),auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0x4')](_0x1b82('0xf'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);router[_0x1b82('0x4')](_0x1b82('0x11'),auth['isAuthenticated'](),auth[_0x1b82('0x9')](),controller['transfer']);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 6735de6..433f010 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 _0x1bca=['NotFound','request','code','message','result','catch','User','findOne','agent','then','VoiceChannels','all','UserId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','sessionId','format','webbar:hangup','answer','webbar:answer','hold\x20fired:','webbar:hold','unhold','unhold\x20executed!','calls\x20fired:','rows','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1bca,0xb6));var _0xa1bc=function(_0x5e16f6,_0x499cad){_0x5e16f6=_0x5e16f6-0x0;var _0x2fc865=_0x1bca[_0x5e16f6];return _0x2fc865;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xa1bc('0x0'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0xa1bc('0x1'));var BPromise=require('bluebird');var jayson=require(_0xa1bc('0x2'));var amiClient=jayson[_0xa1bc('0x3')][_0xa1bc('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xa1bc('0x5'));var Redis=require(_0xa1bc('0x6'));config[_0xa1bc('0x7')]=_[_0xa1bc('0x8')](config['redis'],{'host':_0xa1bc('0x9'),'port':0x18eb});var io=require(_0xa1bc('0xa'))(new Redis(config[_0xa1bc('0x7')]));var Schema=require(_0xa1bc('0xb'));var originateValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'callNumber':{'type':_0xa1bc('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xa1bc('0xe')},'callbackUrl':{'type':_0xa1bc('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'sessionId':{'type':_0xa1bc('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'sessionId':{'type':_0xa1bc('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa1bc('0xe'),'required':[!![],_0xa1bc('0xf')]},'transferNumber':{'type':_0xa1bc('0xe'),'required':[!![],_0xa1bc('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'sessionId':{'type':_0xa1bc('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],_0xa1bc('0xd')]},'sessionId':{'type':_0xa1bc('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa1bc('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa1bc('0xd')]}});function emit(_0xf8c08e,_0x1b90e6,_0x47459f){logger[_0xa1bc('0x11')](_0xf8c08e,_0x1b90e6,JSON[_0xa1bc('0x12')](_0x47459f));io['to'](_0xf8c08e)[_0xa1bc('0x13')](_0x1b90e6,_0x47459f);}function handleError(_0x3d2bd4){return function(_0x4765be){console['log']('handleError:',_0x4765be,_0x4765be instanceof RangeError);logger[_0xa1bc('0x14')](_0x4765be[_0xa1bc('0x15')]);if(_0x4765be instanceof RangeError){if(_0x4765be[_0xa1bc('0x16')]){delete _0x4765be[_0xa1bc('0x16')];}_0x3d2bd4['status'](0x194)['send'](_0x4765be);}else{if(_0x4765be[_0xa1bc('0x16')]){delete _0x4765be[_0xa1bc('0x16')];}_0x3d2bd4[_0xa1bc('0x17')](0x1f4)[_0xa1bc('0x18')](_0x4765be);}};}function checkError(){return function(_0x428eb5){if(!_0x428eb5){throw new RangeError(_0xa1bc('0x19'));}return _0x428eb5;};}function respondWithRpcPromise(_0x49d1ab,_0x3cda63){return new BPromise(function(_0xc81195,_0x1e4f4e){var _0x4fdf7d=amiClient;return _0x4fdf7d[_0xa1bc('0x1a')](_0x49d1ab,_0x3cda63)['then'](function(_0x10636d){if(_0x10636d[_0xa1bc('0x14')]){if(_0x10636d[_0xa1bc('0x14')][_0xa1bc('0x1b')]===0x1f4){return _0x1e4f4e(_0x10636d[_0xa1bc('0x14')][_0xa1bc('0x1c')]);}return _0xc81195(_0x10636d['error']['message']);}else{_0xc81195(_0x10636d[_0xa1bc('0x1d')]);}})[_0xa1bc('0x1e')](function(_0x5eff38){_0x1e4f4e(_0x5eff38);});});}function getAgent(_0x41acbc){return db[_0xa1bc('0x1f')][_0xa1bc('0x20')]({'where':{'id':_0x41acbc,'role':_0xa1bc('0x21')}})[_0xa1bc('0x22')](checkError());}function getAgentCheckSession(_0x2a89ba,_0x5a579f){return new BPromise(function(_0x4fdfd7,_0x359b54){var _0xa2137e=respondWithRpcPromise(_0xa1bc('0x23'));var _0x1270f5=getAgent(_0x2a89ba);Promise[_0xa1bc('0x24')]([_0xa2137e,_0x1270f5])['then'](function(_0x228fc8){var _0x512608=_0x228fc8[0x0];var _0x332201=_0x228fc8[0x1];var _0x447fc7=_['filter'](_0x512608['rows'],function(_0x4a120c){return _0x4a120c[_0xa1bc('0x25')]==_0x332201['id']&&_0x4a120c['sessionId']==_0x5a579f;});if(_0x447fc7[_0xa1bc('0x26')]==0x1){_0x4fdfd7(_0x332201);}else{_0x359b54(new RangeError(_0xa1bc('0x27')+_0x5a579f+_0xa1bc('0x28')));}});});}exports['originate']=function(_0x5c5af9,_0x1e68ba){logger['info'](_0xa1bc('0x29'),_0x5c5af9[_0xa1bc('0x2a')]);var _0x268ca7=originateValidation['validate'](_0x5c5af9['body']);if(_0x268ca7['length']>0x0){return _0x1e68ba[_0xa1bc('0x17')](0x190)[_0xa1bc('0x2b')](_0x268ca7);}var _0x4a089d=_0x5c5af9[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0xc92b07=_0x5c5af9['body'][_0xa1bc('0x2d')];var _0x431b47=_0x5c5af9[_0xa1bc('0x2a')]['callerId'];var _0x160bba=_0x5c5af9[_0xa1bc('0x2a')][_0xa1bc('0x2e')];return getAgent(_0x4a089d)[_0xa1bc('0x22')](function(_0x3d049c){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x3d049c[_0xa1bc('0x16')]);emit(util['format'](_0xa1bc('0x30'),_0x3d049c[_0xa1bc('0x16')]),_0xa1bc('0x31'),{'callNumber':_0xc92b07,'callerId':_0x431b47,'callbackUrl':_0x160bba});return _0x1e68ba[_0xa1bc('0x17')](0xc8)['json']({'error':![],'message':_0xa1bc('0x32')});})[_0xa1bc('0x1e')](handleError(_0x1e68ba));};exports['hangup']=function(_0x10d6e7,_0xaa47fc){logger[_0xa1bc('0x11')](_0xa1bc('0x33'),_0x10d6e7[_0xa1bc('0x2a')]);var _0x5ad131=hangupValidation[_0xa1bc('0xb')](_0x10d6e7[_0xa1bc('0x2a')]);if(_0x5ad131[_0xa1bc('0x26')]>0x0){return _0xaa47fc[_0xa1bc('0x17')](0x190)[_0xa1bc('0x2b')](_0x5ad131);}var _0x48c721=_0x10d6e7[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0x380d73=_0x10d6e7[_0xa1bc('0x2a')][_0xa1bc('0x34')];return getAgent(_0x48c721)['then'](function(_0x479438){logger['info'](_0xa1bc('0x2f'),_0x479438['name']);emit(util[_0xa1bc('0x35')](_0xa1bc('0x30'),_0x479438[_0xa1bc('0x16')]),_0xa1bc('0x36'),{'sessionId':_0x380d73});return _0xaa47fc['status'](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0xaa47fc));};exports[_0xa1bc('0x37')]=function(_0x5571c3,_0x16514c){logger[_0xa1bc('0x11')]('answer\x20fired:',_0x5571c3[_0xa1bc('0x2a')]);var _0x5cd49d=answerValidation[_0xa1bc('0xb')](_0x5571c3[_0xa1bc('0x2a')]);if(_0x5cd49d[_0xa1bc('0x26')]>0x0){return _0x16514c[_0xa1bc('0x17')](0x190)['json'](_0x5cd49d);}var _0x2b0e95=_0x5571c3[_0xa1bc('0x2a')]['userId'];var _0x982b40=_0x5571c3[_0xa1bc('0x2a')][_0xa1bc('0x34')];return getAgent(_0x2b0e95)[_0xa1bc('0x22')](function(_0x77518a){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x77518a[_0xa1bc('0x16')]);emit(util[_0xa1bc('0x35')](_0xa1bc('0x30'),_0x77518a[_0xa1bc('0x16')]),_0xa1bc('0x38'),{'sessionId':_0x982b40});return _0x16514c[_0xa1bc('0x17')](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':'answer\x20executed!'});})[_0xa1bc('0x1e')](handleError(_0x16514c));};exports['hold']=function(_0x44a0a9,_0x33db19){logger[_0xa1bc('0x11')](_0xa1bc('0x39'),_0x44a0a9['body']);var _0x531c74=holdValidation['validate'](_0x44a0a9['body']);if(_0x531c74['length']>0x0){return _0x33db19[_0xa1bc('0x17')](0x190)['json'](_0x531c74);}var _0x2dfad5=_0x44a0a9[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0x3a87cd=_0x44a0a9['body'][_0xa1bc('0x34')];return getAgent(_0x2dfad5)[_0xa1bc('0x22')](function(_0x3fa784){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x3fa784['name']);emit(util[_0xa1bc('0x35')](_0xa1bc('0x30'),_0x3fa784[_0xa1bc('0x16')]),_0xa1bc('0x3a'),{'sessionId':_0x3a87cd});return _0x33db19['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0xa1bc('0x1e')](handleError(_0x33db19));};exports[_0xa1bc('0x3b')]=function(_0x5b3b1,_0x274684){logger[_0xa1bc('0x11')]('unhold\x20fired:',_0x5b3b1['body']);var _0x14a113=unholdValidation[_0xa1bc('0xb')](_0x5b3b1[_0xa1bc('0x2a')]);if(_0x14a113[_0xa1bc('0x26')]>0x0){return _0x274684[_0xa1bc('0x17')](0x190)[_0xa1bc('0x2b')](_0x14a113);}var _0x21fb6e=_0x5b3b1[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0x49876b=_0x5b3b1[_0xa1bc('0x2a')][_0xa1bc('0x34')];return getAgent(_0x21fb6e)['then'](function(_0x1c0f31){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x1c0f31[_0xa1bc('0x16')]);emit(util[_0xa1bc('0x35')]('user:%s',_0x1c0f31['name']),'webbar:unhold',{'sessionId':_0x49876b});return _0x274684[_0xa1bc('0x17')](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':_0xa1bc('0x3c')});})[_0xa1bc('0x1e')](handleError(_0x274684));};exports['calls']=function(_0xd69ef3,_0x1a59cf){logger['info'](_0xa1bc('0x3d'),_0x1a59cf['body']);var _0x5c5719=callsValidation['validate'](_0xd69ef3[_0xa1bc('0x2a')]);if(_0x5c5719[_0xa1bc('0x26')]>0x0){return _0x1a59cf['status'](0x190)[_0xa1bc('0x2b')](_0x5c5719);}var _0x7124ab=_0xd69ef3[_0xa1bc('0x2a')][_0xa1bc('0x2c')];var _0x262fb3=respondWithRpcPromise(_0xa1bc('0x23'));var _0x45fa8c=getAgent(_0x7124ab);return Promise[_0xa1bc('0x24')]([_0x262fb3,_0x45fa8c])[_0xa1bc('0x22')](function(_0x1c0787){var _0x34c829=_0x1c0787[0x0];var _0x28a91c=_0x1c0787[0x1];var _0x16f9f1=_['filter'](_0x34c829[_0xa1bc('0x3e')],function(_0x5cccc9){return _0x5cccc9[_0xa1bc('0x25')]==_0x28a91c['id'];});return _0x1a59cf[_0xa1bc('0x17')](0xc8)[_0xa1bc('0x2b')]({'count':_0x16f9f1[_0xa1bc('0x26')],'rows':_0x16f9f1});})[_0xa1bc('0x1e')](handleError(_0x1a59cf));};exports['conference']=function(_0x8134b,_0x1a7673){logger[_0xa1bc('0x11')](_0xa1bc('0x3f'),_0x8134b[_0xa1bc('0x2a')]);var _0x503dbe=conferenceValidation[_0xa1bc('0xb')](_0x8134b['body']);if(_0x503dbe['length']>0x0){return _0x1a7673['status'](0x190)[_0xa1bc('0x2b')](_0x503dbe);}var _0x3ebe04=_0x8134b[_0xa1bc('0x2a')][_0xa1bc('0x2c')];return getAgent(_0x3ebe04)['then'](function(_0x4d5909){logger['info'](_0xa1bc('0x2f'),_0x4d5909[_0xa1bc('0x16')]);emit(util[_0xa1bc('0x35')](_0xa1bc('0x30'),_0x4d5909[_0xa1bc('0x16')]),'webbar:conference');return _0x1a7673['status'](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':_0xa1bc('0x40')});})[_0xa1bc('0x1e')](handleError(_0x1a7673));};exports[_0xa1bc('0x41')]=function(_0x1d2c67,_0x46a7e7){logger[_0xa1bc('0x11')](_0xa1bc('0x42'),_0x1d2c67[_0xa1bc('0x2a')]);var _0x3e9637=transferValidation[_0xa1bc('0xb')](_0x1d2c67['body']);if(_0x3e9637[_0xa1bc('0x26')]>0x0){return _0x46a7e7[_0xa1bc('0x17')](0x190)[_0xa1bc('0x2b')](_0x3e9637);}var _0xaf15de=_0x1d2c67[_0xa1bc('0x2a')]['userId'];var _0x26056f=_0x1d2c67[_0xa1bc('0x2a')]['sessionId'];var _0x48d01e=_0x1d2c67[_0xa1bc('0x2a')][_0xa1bc('0x43')];return getAgent(_0xaf15de)[_0xa1bc('0x22')](function(_0x53bb07){logger[_0xa1bc('0x11')](_0xa1bc('0x2f'),_0x53bb07['name']);emit(util['format']('user:%s',_0x53bb07['name']),'webbar:transfer',{'sessionId':_0x26056f,'transferNumber':_0x48d01e});return _0x46a7e7[_0xa1bc('0x17')](0xc8)[_0xa1bc('0x2b')]({'error':![],'message':_0xa1bc('0x44')});})[_0xa1bc('0x1e')](handleError(_0x46a7e7));}; \ No newline at end of file +var _0xc788=['all','filter','rows','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer\x20fired:','user:%s','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','name','send','status','NotFound','request','then','code','message','result','catch','findOne','agent','VoiceChannels'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xc788,0xc4));var _0x8c78=function(_0x1c0261,_0xbe62af){_0x1c0261=_0x1c0261-0x0;var _0x1f81d0=_0xc788[_0x1c0261];return _0x1f81d0;};'use strict';var path=require(_0x8c78('0x0'));var fs=require('fs');var _=require(_0x8c78('0x1'));var db=require(_0x8c78('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x8c78('0x3'));var jayson=require(_0x8c78('0x4'));var amiClient=jayson[_0x8c78('0x5')][_0x8c78('0x6')]({'port':0x232a});var logger=require(_0x8c78('0x7'))('webbarapi');var Redis=require(_0x8c78('0x8'));config[_0x8c78('0x9')]=_[_0x8c78('0xa')](config[_0x8c78('0x9')],{'host':_0x8c78('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c78('0x9')]));var Schema=require(_0x8c78('0xc'));var originateValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'callNumber':{'type':_0x8c78('0xf'),'required':[!![],_0x8c78('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x8c78('0xf')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x8c78('0xf'),'required':[!![],_0x8c78('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]},'sessionId':{'type':_0x8c78('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8c78('0xd'),'required':[!![],_0x8c78('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c78('0xe')]}});function emit(_0x293cfe,_0x57ad11,_0x45b85f){logger[_0x8c78('0x12')](_0x293cfe,_0x57ad11,JSON[_0x8c78('0x13')](_0x45b85f));io['to'](_0x293cfe)[_0x8c78('0x14')](_0x57ad11,_0x45b85f);}function handleError(_0x2a982c){return function(_0x461eff){console['log']('handleError:',_0x461eff,_0x461eff instanceof RangeError);logger[_0x8c78('0x15')](_0x461eff['stack']);if(_0x461eff instanceof RangeError){if(_0x461eff['name']){delete _0x461eff[_0x8c78('0x16')];}_0x2a982c['status'](0x194)[_0x8c78('0x17')](_0x461eff);}else{if(_0x461eff[_0x8c78('0x16')]){delete _0x461eff['name'];}_0x2a982c[_0x8c78('0x18')](0x1f4)['send'](_0x461eff);}};}function checkError(){return function(_0x2dba52){if(!_0x2dba52){throw new RangeError(_0x8c78('0x19'));}return _0x2dba52;};}function respondWithRpcPromise(_0x5a254d,_0xd1ae4d){return new BPromise(function(_0x188cc3,_0x499603){var _0x2bc595=amiClient;return _0x2bc595[_0x8c78('0x1a')](_0x5a254d,_0xd1ae4d)[_0x8c78('0x1b')](function(_0x9581c6){if(_0x9581c6[_0x8c78('0x15')]){if(_0x9581c6[_0x8c78('0x15')][_0x8c78('0x1c')]===0x1f4){return _0x499603(_0x9581c6[_0x8c78('0x15')][_0x8c78('0x1d')]);}return _0x188cc3(_0x9581c6['error'][_0x8c78('0x1d')]);}else{_0x188cc3(_0x9581c6[_0x8c78('0x1e')]);}})[_0x8c78('0x1f')](function(_0x49cccb){_0x499603(_0x49cccb);});});}function getAgent(_0x331bfe){return db['User'][_0x8c78('0x20')]({'where':{'id':_0x331bfe,'role':_0x8c78('0x21')}})[_0x8c78('0x1b')](checkError());}function getAgentCheckSession(_0x496c51,_0x583a74){return new BPromise(function(_0x2568d5,_0x4be49d){var _0x20b128=respondWithRpcPromise(_0x8c78('0x22'));var _0x394c1d=getAgent(_0x496c51);Promise[_0x8c78('0x23')]([_0x20b128,_0x394c1d])[_0x8c78('0x1b')](function(_0x2ab5cc){var _0x5ba7d4=_0x2ab5cc[0x0];var _0x1c3039=_0x2ab5cc[0x1];var _0x51add6=_[_0x8c78('0x24')](_0x5ba7d4[_0x8c78('0x25')],function(_0xb69c52){return _0xb69c52['UserId']==_0x1c3039['id']&&_0xb69c52[_0x8c78('0x26')]==_0x583a74;});if(_0x51add6[_0x8c78('0x27')]==0x1){_0x2568d5(_0x1c3039);}else{_0x4be49d(new RangeError('sessionId\x20'+_0x583a74+_0x8c78('0x28')));}});});}exports[_0x8c78('0x29')]=function(_0x32bc1f,_0x487a4c){logger[_0x8c78('0x12')](_0x8c78('0x2a'),_0x32bc1f[_0x8c78('0x2b')]);var _0x5348ab=originateValidation[_0x8c78('0xc')](_0x32bc1f[_0x8c78('0x2b')]);if(_0x5348ab['length']>0x0){return _0x487a4c[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x5348ab);}var _0x3a9372=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x5b5429=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2e')];var _0x201a43=_0x32bc1f[_0x8c78('0x2b')]['callerId'];var _0x3e9bf1=_0x32bc1f[_0x8c78('0x2b')][_0x8c78('0x2f')];return getAgent(_0x3a9372)[_0x8c78('0x1b')](function(_0x34481a){logger['info'](_0x8c78('0x30'),_0x34481a[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x34481a[_0x8c78('0x16')]),_0x8c78('0x32'),{'callNumber':_0x5b5429,'callerId':_0x201a43,'callbackUrl':_0x3e9bf1});return _0x487a4c['status'](0xc8)[_0x8c78('0x2c')]({'error':![],'message':'originate\x20executed!'});})[_0x8c78('0x1f')](handleError(_0x487a4c));};exports[_0x8c78('0x33')]=function(_0x245f62,_0x157b81){logger['info'](_0x8c78('0x34'),_0x245f62['body']);var _0x3b8f4f=hangupValidation[_0x8c78('0xc')](_0x245f62[_0x8c78('0x2b')]);if(_0x3b8f4f['length']>0x0){return _0x157b81['status'](0x190)[_0x8c78('0x2c')](_0x3b8f4f);}var _0x25d143=_0x245f62[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x2eb3ef=_0x245f62[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x25d143)[_0x8c78('0x1b')](function(_0x1f0a2b){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x1f0a2b[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x1f0a2b[_0x8c78('0x16')]),_0x8c78('0x35'),{'sessionId':_0x2eb3ef});return _0x157b81['status'](0xc8)['json']({'error':![],'message':_0x8c78('0x36')});})[_0x8c78('0x1f')](handleError(_0x157b81));};exports['answer']=function(_0x224c4b,_0x57ff42){logger['info'](_0x8c78('0x37'),_0x224c4b[_0x8c78('0x2b')]);var _0x57e2c7=answerValidation[_0x8c78('0xc')](_0x224c4b[_0x8c78('0x2b')]);if(_0x57e2c7[_0x8c78('0x27')]>0x0){return _0x57ff42[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x57e2c7);}var _0x4e4880=_0x224c4b['body'][_0x8c78('0x2d')];var _0x2f6a6b=_0x224c4b[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x4e4880)[_0x8c78('0x1b')](function(_0x460821){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x460821[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')](_0x8c78('0x38'),_0x460821['name']),_0x8c78('0x39'),{'sessionId':_0x2f6a6b});return _0x57ff42[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x3a')});})[_0x8c78('0x1f')](handleError(_0x57ff42));};exports['hold']=function(_0x356e47,_0x4588cd){logger[_0x8c78('0x12')](_0x8c78('0x3b'),_0x356e47[_0x8c78('0x2b')]);var _0x5cc829=holdValidation[_0x8c78('0xc')](_0x356e47['body']);if(_0x5cc829['length']>0x0){return _0x4588cd[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x5cc829);}var _0x61e20=_0x356e47['body'][_0x8c78('0x2d')];var _0xc6ba23=_0x356e47[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0x61e20)[_0x8c78('0x1b')](function(_0x38083e){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x38083e[_0x8c78('0x16')]);emit(util['format'](_0x8c78('0x38'),_0x38083e[_0x8c78('0x16')]),_0x8c78('0x3c'),{'sessionId':_0xc6ba23});return _0x4588cd[_0x8c78('0x18')](0xc8)['json']({'error':![],'message':_0x8c78('0x3d')});})[_0x8c78('0x1f')](handleError(_0x4588cd));};exports[_0x8c78('0x3e')]=function(_0x431125,_0x53e75c){logger[_0x8c78('0x12')](_0x8c78('0x3f'),_0x431125[_0x8c78('0x2b')]);var _0x551e0f=unholdValidation[_0x8c78('0xc')](_0x431125['body']);if(_0x551e0f[_0x8c78('0x27')]>0x0){return _0x53e75c[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x551e0f);}var _0xa87aba=_0x431125[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0xf68e0=_0x431125[_0x8c78('0x2b')][_0x8c78('0x26')];return getAgent(_0xa87aba)[_0x8c78('0x1b')](function(_0x23e568){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x23e568[_0x8c78('0x16')]);emit(util['format'](_0x8c78('0x38'),_0x23e568[_0x8c78('0x16')]),_0x8c78('0x40'),{'sessionId':_0xf68e0});return _0x53e75c[_0x8c78('0x18')](0xc8)['json']({'error':![],'message':_0x8c78('0x41')});})[_0x8c78('0x1f')](handleError(_0x53e75c));};exports[_0x8c78('0x42')]=function(_0x2b9b18,_0x40025d){logger[_0x8c78('0x12')]('calls\x20fired:',_0x40025d[_0x8c78('0x2b')]);var _0x42a34e=callsValidation['validate'](_0x2b9b18[_0x8c78('0x2b')]);if(_0x42a34e['length']>0x0){return _0x40025d[_0x8c78('0x18')](0x190)[_0x8c78('0x2c')](_0x42a34e);}var _0x257533=_0x2b9b18[_0x8c78('0x2b')][_0x8c78('0x2d')];var _0x35cf85=respondWithRpcPromise(_0x8c78('0x22'));var _0x49fa4c=getAgent(_0x257533);return Promise[_0x8c78('0x23')]([_0x35cf85,_0x49fa4c])[_0x8c78('0x1b')](function(_0x4e77a9){var _0x110e7b=_0x4e77a9[0x0];var _0x3529aa=_0x4e77a9[0x1];var _0x577361=_[_0x8c78('0x24')](_0x110e7b[_0x8c78('0x25')],function(_0x3e2160){return _0x3e2160[_0x8c78('0x43')]==_0x3529aa['id'];});return _0x40025d[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'count':_0x577361[_0x8c78('0x27')],'rows':_0x577361});})[_0x8c78('0x1f')](handleError(_0x40025d));};exports[_0x8c78('0x44')]=function(_0x1b3600,_0x25b8bc){logger[_0x8c78('0x12')](_0x8c78('0x45'),_0x1b3600[_0x8c78('0x2b')]);var _0x50ae7d=conferenceValidation[_0x8c78('0xc')](_0x1b3600['body']);if(_0x50ae7d[_0x8c78('0x27')]>0x0){return _0x25b8bc['status'](0x190)['json'](_0x50ae7d);}var _0x57a4b1=_0x1b3600[_0x8c78('0x2b')]['userId'];return getAgent(_0x57a4b1)['then'](function(_0x502991){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0x502991[_0x8c78('0x16')]);emit(util[_0x8c78('0x31')]('user:%s',_0x502991[_0x8c78('0x16')]),_0x8c78('0x46'));return _0x25b8bc[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x47')});})[_0x8c78('0x1f')](handleError(_0x25b8bc));};exports[_0x8c78('0x48')]=function(_0x54d561,_0x25c255){logger[_0x8c78('0x12')](_0x8c78('0x49'),_0x54d561[_0x8c78('0x2b')]);var _0x3e1ee0=transferValidation[_0x8c78('0xc')](_0x54d561['body']);if(_0x3e1ee0[_0x8c78('0x27')]>0x0){return _0x25c255['status'](0x190)[_0x8c78('0x2c')](_0x3e1ee0);}var _0x28d1a7=_0x54d561[_0x8c78('0x2b')]['userId'];var _0x97df9c=_0x54d561[_0x8c78('0x2b')][_0x8c78('0x26')];var _0x4fa0b0=_0x54d561[_0x8c78('0x2b')][_0x8c78('0x4a')];return getAgent(_0x28d1a7)['then'](function(_0xbfafd1){logger[_0x8c78('0x12')](_0x8c78('0x30'),_0xbfafd1['name']);emit(util[_0x8c78('0x31')](_0x8c78('0x38'),_0xbfafd1[_0x8c78('0x16')]),_0x8c78('0x4b'),{'sessionId':_0x97df9c,'transferNumber':_0x4fa0b0});return _0x25c255[_0x8c78('0x18')](0xc8)[_0x8c78('0x2c')]({'error':![],'message':_0x8c78('0x4c')});})[_0x8c78('0x1f')](handleError(_0x25c255));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 93ee06f..595e8c8 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 _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./whatsappAccount.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file +var _0xdb28=['removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','destroy'];(function(_0xdb17f8,_0x21d01a){var _0x445536=function(_0x39c71f){while(--_0x39c71f){_0xdb17f8['push'](_0xdb17f8['shift']());}};_0x445536(++_0x21d01a);}(_0xdb28,0x106));var _0x8db2=function(_0x2dc5a1,_0x40ef5f){_0x2dc5a1=_0x2dc5a1-0x0;var _0x5cf9ec=_0xdb28[_0x2dc5a1];return _0x5cf9ec;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./whatsappAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x15')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x15')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x17')]);router[_0x8db2('0x15')](_0x8db2('0x11'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x15')]('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x19')]);router[_0x8db2('0x15')](_0x8db2('0x1a'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['post']('/:id/notify',controller[_0x8db2('0x1c')]);router[_0x8db2('0x15')](_0x8db2('0x1d'),auth[_0x8db2('0xa')](),controller['send']);router[_0x8db2('0x1e')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x20')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x22')]);router[_0x8db2('0x20')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8db2('0x23')]);module[_0x8db2('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 6a7689f..948aa07 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 _0xb130=['sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','twilio'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb130,0xa4));var _0x0b13=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xb130[_0x1dbaf7];return _0x593f05;};'use strict';var Sequelize=require(_0x0b13('0x0'));var rs=require('randomstring');module[_0x0b13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0b13('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0b13('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0b13('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0b13('0x3')](_0x0b13('0x4'),_0x0b13('0x5'))},'accountSid':{'type':Sequelize[_0x0b13('0x2')]},'baseUrl':{'type':Sequelize[_0x0b13('0x2')]},'authToken':{'type':Sequelize[_0x0b13('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0b13('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0b13('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0b13('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0b13('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0b13('0x7')],'defaultValue':![],'comment':_0x0b13('0x9'),'set':function(_0x1f0292){if(!_0x1f0292){this['setDataValue'](_0x0b13('0xa'),null);}this[_0x0b13('0xb')](_0x0b13('0xc'),_0x1f0292);}},'description':{'type':Sequelize[_0x0b13('0x2')]}}; \ No newline at end of file +var _0x3db8=['STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','sequelize','randomstring','exports'];(function(_0x4ecbbc,_0x473214){var _0x2b7bda=function(_0x561b08){while(--_0x561b08){_0x4ecbbc['push'](_0x4ecbbc['shift']());}};_0x2b7bda(++_0x473214);}(_0x3db8,0xad));var _0x83db=function(_0x3560de,_0x28b150){_0x3560de=_0x3560de-0x0;var _0x2d31c1=_0x3db8[_0x3560de];return _0x2d31c1;};'use strict';var Sequelize=require(_0x83db('0x0'));var rs=require(_0x83db('0x1'));module[_0x83db('0x2')]={'name':{'type':Sequelize[_0x83db('0x3')],'unique':_0x83db('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x83db('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x83db('0x3')],'defaultValue':function(){return rs[_0x83db('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x83db('0x6')](_0x83db('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0x83db('0x3')]},'baseUrl':{'type':Sequelize[_0x83db('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x83db('0x8')],'defaultValue':function(){return _0x83db('0x9');}},'notificationSound':{'type':Sequelize[_0x83db('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x83db('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x83db('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x83db('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x83db('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x83db('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x83db('0xb')],'comment':_0x83db('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x83db('0xa')],'defaultValue':![],'comment':_0x83db('0xd'),'set':function(_0xf58f14){if(!_0xf58f14){this['setDataValue'](_0x83db('0xe'),null);}this[_0x83db('0xf')]('mandatoryDisposition',_0xf58f14);}},'description':{'type':Sequelize[_0x83db('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8102c43..ff81117 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 _0xf4c1=['map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','model','fields','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','removeAgents','isArray','emit','userWhatsappAccount:remove','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','whatsapp:','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key'];(function(_0x4fadc6,_0x4a76ec){var _0x1ee63c=function(_0x43f485){while(--_0x43f485){_0x4fadc6['push'](_0x4fadc6['shift']());}};_0x1ee63c(++_0x4a76ec);}(_0xf4c1,0x82));var _0x1f4c=function(_0x5b2783,_0x1f3362){_0x5b2783=_0x5b2783-0x0;var _0x74bfee=_0xf4c1[_0x5b2783];return _0x74bfee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f4c('0x0'));var rp=require(_0x1f4c('0x1'));var moment=require(_0x1f4c('0x2'));var BPromise=require(_0x1f4c('0x3'));var Mustache=require(_0x1f4c('0x4'));var util=require(_0x1f4c('0x5'));var path=require(_0x1f4c('0x6'));var sox=require(_0x1f4c('0x7'));var csv=require(_0x1f4c('0x8'));var ejs=require(_0x1f4c('0x9'));var fs=require('fs');var fs_extra=require(_0x1f4c('0xa'));var _=require(_0x1f4c('0xb'));var squel=require(_0x1f4c('0xc'));var crypto=require(_0x1f4c('0xd'));var jsforce=require(_0x1f4c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1f4c('0xf'));var Papa=require(_0x1f4c('0x10'));var Redis=require(_0x1f4c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f4c('0x12'));var logger=require('../../config/logger')(_0x1f4c('0x13'));var utils=require(_0x1f4c('0x14'));var config=require(_0x1f4c('0x15'));var licenseUtil=require(_0x1f4c('0x16'));var db=require(_0x1f4c('0x17'))['db'];config[_0x1f4c('0x18')]=_['defaults'](config['redis'],{'host':_0x1f4c('0x19'),'port':0x18eb});var socket=require(_0x1f4c('0x1a'))(new Redis(config[_0x1f4c('0x18')]));require('./whatsappAccount.socket')[_0x1f4c('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1f4c('0x1c')][_0x1f4c('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x369225,_0x2ada7b,_0x53e6df,_0x3dd2b2){return new BPromise(function(_0x116d44,_0x1185ca){var _0x2272fc=_0x3dd2b2||client;return _0x2272fc[_0x1f4c('0x1e')](_0x369225,_0x53e6df)[_0x1f4c('0x1f')](function(_0x42c180){logger['info'](_0x1f4c('0x20'),_0x2ada7b,'request\x20sent');logger[_0x1f4c('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2ada7b,'request\x20sent',JSON[_0x1f4c('0x22')](_0x42c180));if(_0x42c180['error']){if(_0x42c180[_0x1f4c('0x23')][_0x1f4c('0x24')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2ada7b,_0x42c180[_0x1f4c('0x23')][_0x1f4c('0x25')]);return _0x1185ca(_0x42c180['error']['message']);}logger['error'](_0x1f4c('0x20'),_0x2ada7b,_0x42c180['error']['message']);return _0x116d44(_0x42c180[_0x1f4c('0x23')]['message']);}else{logger[_0x1f4c('0x26')](_0x1f4c('0x20'),_0x2ada7b,_0x1f4c('0x27'));_0x116d44(_0x42c180['result'][_0x1f4c('0x25')]);}})[_0x1f4c('0x28')](function(_0x24e98d){logger[_0x1f4c('0x23')](_0x1f4c('0x20'),_0x2ada7b,_0x24e98d);_0x1185ca(_0x24e98d);});});}function respondWithStatusCode(_0x3dc3e2,_0x265652){_0x265652=_0x265652||0xcc;return function(_0xfd72d0){if(_0xfd72d0){return _0x3dc3e2[_0x1f4c('0x29')](_0x265652);}return _0x3dc3e2['status'](_0x265652)[_0x1f4c('0x2a')]();};}function respondWithResult(_0xa8ae46,_0x50a324){_0x50a324=_0x50a324||0xc8;return function(_0x4f9382){if(_0x4f9382){return _0xa8ae46['status'](_0x50a324)[_0x1f4c('0x2b')](_0x4f9382);}};}function respondWithFilteredResult(_0x3ae511,_0x14091b){return function(_0x4d2f3f){if(_0x4d2f3f){var _0x433395=typeof _0x14091b[_0x1f4c('0x2c')]===_0x1f4c('0x2d')&&typeof _0x14091b[_0x1f4c('0x2e')]===_0x1f4c('0x2d');var _0x33d1a0=_0x4d2f3f[_0x1f4c('0x2f')];var _0x47aba4=_0x433395?0x0:_0x14091b['offset'];var _0x43fce7=_0x433395?_0x4d2f3f[_0x1f4c('0x2f')]:_0x14091b['offset']+_0x14091b[_0x1f4c('0x2e')];var _0x4fda29;if(_0x43fce7>=_0x33d1a0){_0x43fce7=_0x33d1a0;_0x4fda29=0xc8;}else{_0x4fda29=0xce;}_0x3ae511[_0x1f4c('0x30')](_0x4fda29);return _0x3ae511[_0x1f4c('0x31')](_0x1f4c('0x32'),_0x47aba4+'-'+_0x43fce7+'/'+_0x33d1a0)[_0x1f4c('0x2b')](_0x4d2f3f);}return null;};}function patchUpdates(_0x58f8a1){return function(_0x2e94d5){try{jsonpatch[_0x1f4c('0x33')](_0x2e94d5,_0x58f8a1,!![]);}catch(_0x11e3ea){return BPromise[_0x1f4c('0x34')](_0x11e3ea);}return _0x2e94d5[_0x1f4c('0x35')]();};}function saveUpdates(_0x5c286e,_0x57bcb3){return function(_0x3858cb){if(_0x3858cb){return _0x3858cb[_0x1f4c('0x36')](_0x5c286e)[_0x1f4c('0x1f')](function(_0xc5d5ec){return _0xc5d5ec;});}return null;};}function removeEntity(_0x3f1679,_0x48845b){return function(_0x57b829){if(_0x57b829){return _0x57b829[_0x1f4c('0x37')]()[_0x1f4c('0x1f')](function(){var _0x479dfe=_0x57b829[_0x1f4c('0x38')]({'plain':!![]});var _0x6523f1='WhatsappAccounts';return db[_0x1f4c('0x39')][_0x1f4c('0x37')]({'where':{'type':_0x6523f1,'resourceId':_0x479dfe['id']}})['then'](function(){return _0x57b829;});})[_0x1f4c('0x1f')](function(){_0x3f1679[_0x1f4c('0x30')](0xcc)[_0x1f4c('0x2a')]();});}};}function handleEntityNotFound(_0x3ef7d1,_0x35d2b4){return function(_0x323a10){if(!_0x323a10){_0x3ef7d1[_0x1f4c('0x29')](0x194);}return _0x323a10;};}function handleError(_0x157250,_0x1faad5){_0x1faad5=_0x1faad5||0x1f4;return function(_0x2c8aca){logger[_0x1f4c('0x23')](_0x2c8aca[_0x1f4c('0x3a')]);if(_0x2c8aca[_0x1f4c('0x3b')]){delete _0x2c8aca[_0x1f4c('0x3b')];}_0x157250[_0x1f4c('0x30')](_0x1faad5)[_0x1f4c('0x3c')](_0x2c8aca);};}exports[_0x1f4c('0x3d')]=function(_0x57207d,_0x26847c){var _0x1608d4={'include':[{'model':db[_0x1f4c('0x3e')],'as':_0x1f4c('0x3f')}]},_0x337464={},_0x4fd811={'count':0x0,'rows':[]};var _0x5b091d=_['map'](db[_0x1f4c('0x40')][_0x1f4c('0x41')],function(_0xb3e5b0){return{'name':_0xb3e5b0[_0x1f4c('0x42')],'type':_0xb3e5b0[_0x1f4c('0x43')][_0x1f4c('0x44')]};});_0x337464['model']=_[_0x1f4c('0x45')](_0x5b091d,_0x1f4c('0x3b'));_0x337464[_0x1f4c('0x46')]=_[_0x1f4c('0x47')](_0x57207d[_0x1f4c('0x46')]);_0x337464[_0x1f4c('0x48')]=_[_0x1f4c('0x49')](_0x337464['model'],_0x337464[_0x1f4c('0x46')]);_0x1608d4[_0x1f4c('0x4a')]=_['intersection'](_0x337464['model'],qs['fields'](_0x57207d[_0x1f4c('0x46')]['fields']));_0x1608d4['attributes']=_0x1608d4[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x1608d4[_0x1f4c('0x4a')]:_0x337464['model'];if(!_0x57207d[_0x1f4c('0x46')][_0x1f4c('0x4c')](_0x1f4c('0x4d'))){_0x1608d4[_0x1f4c('0x2e')]=qs[_0x1f4c('0x2e')](_0x57207d['query']['limit']);_0x1608d4[_0x1f4c('0x2c')]=qs[_0x1f4c('0x2c')](_0x57207d['query'][_0x1f4c('0x2c')]);}_0x1608d4[_0x1f4c('0x4e')]=qs[_0x1f4c('0x4f')](_0x57207d['query'][_0x1f4c('0x4f')]);_0x1608d4[_0x1f4c('0x50')]=qs['filters'](_[_0x1f4c('0x51')](_0x57207d[_0x1f4c('0x46')],_0x337464[_0x1f4c('0x48')]),_0x5b091d);if(_0x57207d[_0x1f4c('0x46')][_0x1f4c('0x52')]){_0x1608d4[_0x1f4c('0x50')]=_[_0x1f4c('0x53')](_0x1608d4[_0x1f4c('0x50')],{'$or':_[_0x1f4c('0x45')](_0x5b091d,function(_0x326cea){if(_0x326cea[_0x1f4c('0x43')]!==_0x1f4c('0x54')){var _0x36ae04={};_0x36ae04[_0x326cea[_0x1f4c('0x3b')]]={'$like':'%'+_0x57207d[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0x36ae04;}})});}_0x1608d4=_[_0x1f4c('0x53')]({},_0x1608d4,_0x57207d[_0x1f4c('0x55')]);var _0x86709={'where':_0x1608d4[_0x1f4c('0x50')]};return db['WhatsappAccount']['count'](_0x86709)[_0x1f4c('0x1f')](function(_0x5641bd){_0x4fd811[_0x1f4c('0x2f')]=_0x5641bd;if(_0x57207d[_0x1f4c('0x46')][_0x1f4c('0x56')]){_0x1608d4[_0x1f4c('0x57')]=[{'all':!![]}];}return db[_0x1f4c('0x40')][_0x1f4c('0x58')](_0x1608d4);})['then'](function(_0x1cd780){_0x4fd811[_0x1f4c('0x59')]=_0x1cd780;return _0x4fd811;})[_0x1f4c('0x1f')](respondWithFilteredResult(_0x26847c,_0x1608d4))[_0x1f4c('0x28')](handleError(_0x26847c,null));};exports['show']=function(_0xa5cd95,_0x222e46){var _0x2f27e5={'raw':![],'where':{'id':_0xa5cd95[_0x1f4c('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x1f4c('0x3f')}]},_0x3b7349={};_0x3b7349[_0x1f4c('0x5b')]=_[_0x1f4c('0x47')](db['WhatsappAccount'][_0x1f4c('0x41')]);_0x3b7349['query']=_[_0x1f4c('0x47')](_0xa5cd95['query']);_0x3b7349['filters']=_[_0x1f4c('0x49')](_0x3b7349['model'],_0x3b7349['query']);_0x2f27e5[_0x1f4c('0x4a')]=_[_0x1f4c('0x49')](_0x3b7349[_0x1f4c('0x5b')],qs[_0x1f4c('0x5c')](_0xa5cd95[_0x1f4c('0x46')]['fields']));_0x2f27e5['attributes']=_0x2f27e5['attributes'][_0x1f4c('0x4b')]?_0x2f27e5['attributes']:_0x3b7349[_0x1f4c('0x5b')];if(_0xa5cd95['query'][_0x1f4c('0x56')]){_0x2f27e5[_0x1f4c('0x57')]=[{'all':!![]}];}_0x2f27e5=_[_0x1f4c('0x53')]({},_0x2f27e5,_0xa5cd95[_0x1f4c('0x55')]);return db[_0x1f4c('0x40')][_0x1f4c('0x5d')](_0x2f27e5)['then'](handleEntityNotFound(_0x222e46,null))[_0x1f4c('0x1f')](respondWithResult(_0x222e46,null))[_0x1f4c('0x28')](handleError(_0x222e46,null));};exports[_0x1f4c('0x5e')]=function(_0x5e40e9,_0x1abdf2){return db[_0x1f4c('0x40')][_0x1f4c('0x5e')](_0x5e40e9['body'],{})[_0x1f4c('0x1f')](function(_0x4eae2d){var _0x3b3df8=_0x5e40e9['user'][_0x1f4c('0x38')]({'plain':!![]});if(!_0x3b3df8)throw new Error(_0x1f4c('0x5f'));if(_0x3b3df8[_0x1f4c('0x60')]===_0x1f4c('0x61')){var _0x4b794e=_0x4eae2d['get']({'plain':!![]});var _0x95a908=_0x1f4c('0x62');return db[_0x1f4c('0x63')]['find']({'where':{'name':_0x95a908,'userProfileId':_0x3b3df8[_0x1f4c('0x64')]},'raw':!![]})['then'](function(_0x359365){if(_0x359365&&_0x359365[_0x1f4c('0x65')]===0x0){return db[_0x1f4c('0x39')]['create']({'name':_0x4b794e[_0x1f4c('0x3b')],'resourceId':_0x4b794e['id'],'type':_0x359365[_0x1f4c('0x3b')],'sectionId':_0x359365['id']},{})[_0x1f4c('0x1f')](function(){return _0x4eae2d;});}else{return _0x4eae2d;}})[_0x1f4c('0x28')](function(_0x17a9c7){logger[_0x1f4c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17a9c7);throw _0x17a9c7;});}return _0x4eae2d;})[_0x1f4c('0x1f')](respondWithResult(_0x1abdf2,0xc9))[_0x1f4c('0x28')](handleError(_0x1abdf2,null));};exports[_0x1f4c('0x36')]=function(_0x509b3f,_0x591f75){if(_0x509b3f[_0x1f4c('0x66')]['id']){delete _0x509b3f[_0x1f4c('0x66')]['id'];}return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x509b3f[_0x1f4c('0x5a')]['id']},'include':[{'model':db[_0x1f4c('0x3e')],'as':_0x1f4c('0x3f')}]})[_0x1f4c('0x1f')](handleEntityNotFound(_0x591f75,null))[_0x1f4c('0x1f')](saveUpdates(_0x509b3f['body'],null))[_0x1f4c('0x1f')](respondWithResult(_0x591f75,null))[_0x1f4c('0x28')](handleError(_0x591f75,null));};exports[_0x1f4c('0x37')]=function(_0x48eb37,_0x5303a7){return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x48eb37[_0x1f4c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5303a7,null))[_0x1f4c('0x1f')](removeEntity(_0x5303a7,null))[_0x1f4c('0x28')](handleError(_0x5303a7,null));};exports[_0x1f4c('0x67')]=function(_0x22e568,_0x2d4b61){return db[_0x1f4c('0x40')][_0x1f4c('0x67')]()[_0x1f4c('0x1f')](respondWithResult(_0x2d4b61,null))[_0x1f4c('0x28')](handleError(_0x2d4b61,null));};exports[_0x1f4c('0x68')]=function(_0x1ea46e,_0x2260b8,_0x39b602){if(_0x1ea46e[_0x1f4c('0x66')]['id']){delete _0x1ea46e['body']['id'];}return db[_0x1f4c('0x40')]['find']({'where':{'id':_0x1ea46e[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x2260b8,null))[_0x1f4c('0x1f')](function(_0x1878e9){if(_0x1878e9){_0x1ea46e[_0x1f4c('0x66')][_0x1f4c('0x69')]=_0x1878e9['id'];return db[_0x1f4c('0x6a')]['create'](_0x1ea46e[_0x1f4c('0x66')]);}})['then'](respondWithResult(_0x2260b8,null))[_0x1f4c('0x28')](handleError(_0x2260b8,null));};exports[_0x1f4c('0x6b')]=function(_0x5ac8ad,_0x20aab6,_0x24e69e){var _0x20d23e={'raw':![],'where':{}};var _0x58a0c3={};var _0x1802f6={'count':0x0,'rows':[]};return db[_0x1f4c('0x40')][_0x1f4c('0x6c')]({'where':{'id':_0x5ac8ad[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x20aab6,null))['then'](function(_0x1f51d6){if(_0x1f51d6){_0x58a0c3[_0x1f4c('0x5b')]=_[_0x1f4c('0x47')](db[_0x1f4c('0x6a')][_0x1f4c('0x41')]);_0x58a0c3[_0x1f4c('0x46')]=_[_0x1f4c('0x47')](_0x5ac8ad[_0x1f4c('0x46')]);_0x58a0c3[_0x1f4c('0x48')]=_['intersection'](_0x58a0c3[_0x1f4c('0x5b')],_0x58a0c3[_0x1f4c('0x46')]);_0x20d23e[_0x1f4c('0x4a')]=_[_0x1f4c('0x49')](_0x58a0c3[_0x1f4c('0x5b')],qs[_0x1f4c('0x5c')](_0x5ac8ad[_0x1f4c('0x46')][_0x1f4c('0x5c')]));_0x20d23e[_0x1f4c('0x4a')]=_0x20d23e[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x20d23e[_0x1f4c('0x4a')]:_0x58a0c3[_0x1f4c('0x5b')];if(!_0x5ac8ad[_0x1f4c('0x46')]['hasOwnProperty'](_0x1f4c('0x4d'))){_0x20d23e['limit']=qs['limit'](_0x5ac8ad[_0x1f4c('0x46')]['limit']);_0x20d23e['offset']=qs['offset'](_0x5ac8ad['query'][_0x1f4c('0x2c')]);}_0x20d23e[_0x1f4c('0x4e')]=qs[_0x1f4c('0x4f')](_0x5ac8ad['query']['sort']);_0x20d23e[_0x1f4c('0x50')]=qs['filters'](_[_0x1f4c('0x51')](_0x5ac8ad['query'],_0x58a0c3['filters']));_0x20d23e['where'][_0x1f4c('0x69')]=_0x1f51d6['id'];if(_0x5ac8ad[_0x1f4c('0x46')][_0x1f4c('0x52')]){_0x20d23e[_0x1f4c('0x50')]=_[_0x1f4c('0x53')](_0x20d23e['where'],{'$or':_[_0x1f4c('0x45')](_0x20d23e['attributes'],function(_0x5d1c49){var _0xb478f6={};_0xb478f6[_0x5d1c49]={'$like':'%'+_0x5ac8ad[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0xb478f6;})});}_0x20d23e=_[_0x1f4c('0x53')]({},_0x20d23e,_0x5ac8ad[_0x1f4c('0x55')]);return db[_0x1f4c('0x6a')][_0x1f4c('0x2f')]({'where':_0x20d23e[_0x1f4c('0x50')]})[_0x1f4c('0x1f')](function(_0x413cdb){_0x1802f6['count']=_0x413cdb;if(_0x5ac8ad['query'][_0x1f4c('0x56')]){_0x20d23e[_0x1f4c('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x1f4c('0x58')](_0x20d23e);})[_0x1f4c('0x1f')](function(_0x3821e8){_0x1802f6[_0x1f4c('0x59')]=_0x3821e8;return _0x1802f6;});}})[_0x1f4c('0x1f')](respondWithFilteredResult(_0x20aab6,_0x20d23e))[_0x1f4c('0x28')](handleError(_0x20aab6,null));};exports[_0x1f4c('0x6d')]=function(_0x86dd27,_0x506f28,_0x317204){return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x86dd27[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x506f28,null))[_0x1f4c('0x1f')](function(_0x27adb8){if(_0x27adb8){return _0x27adb8['removeDispositions'](_0x86dd27[_0x1f4c('0x46')][_0x1f4c('0x6e')]);}})[_0x1f4c('0x1f')](respondWithStatusCode(_0x506f28,null))[_0x1f4c('0x28')](handleError(_0x506f28,null));};exports[_0x1f4c('0x6f')]=function(_0x2598bb,_0x540519,_0x52c5b5){if(_0x2598bb['body']['id']){delete _0x2598bb[_0x1f4c('0x66')]['id'];}return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x2598bb[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x540519,null))[_0x1f4c('0x1f')](function(_0x3b492a){if(_0x3b492a){_0x2598bb[_0x1f4c('0x66')]['WhatsappAccountId']=_0x3b492a['id'];return db[_0x1f4c('0x70')]['create'](_0x2598bb['body']);}})['then'](respondWithResult(_0x540519,null))['catch'](handleError(_0x540519,null));};exports[_0x1f4c('0x71')]=function(_0x60b6aa,_0x40a541,_0x50fe19){var _0x125d07={'raw':![],'where':{}};var _0x1431a3={};var _0x3ac5a2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x1f4c('0x6c')]({'where':{'id':_0x60b6aa[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x40a541,null))[_0x1f4c('0x1f')](function(_0x61e17e){if(_0x61e17e){_0x1431a3[_0x1f4c('0x5b')]=_['keys'](db[_0x1f4c('0x70')][_0x1f4c('0x41')]);_0x1431a3['query']=_[_0x1f4c('0x47')](_0x60b6aa[_0x1f4c('0x46')]);_0x1431a3[_0x1f4c('0x48')]=_[_0x1f4c('0x49')](_0x1431a3[_0x1f4c('0x5b')],_0x1431a3[_0x1f4c('0x46')]);_0x125d07[_0x1f4c('0x4a')]=_[_0x1f4c('0x49')](_0x1431a3[_0x1f4c('0x5b')],qs[_0x1f4c('0x5c')](_0x60b6aa['query'][_0x1f4c('0x5c')]));_0x125d07[_0x1f4c('0x4a')]=_0x125d07[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x125d07[_0x1f4c('0x4a')]:_0x1431a3[_0x1f4c('0x5b')];if(!_0x60b6aa[_0x1f4c('0x46')][_0x1f4c('0x4c')](_0x1f4c('0x4d'))){_0x125d07[_0x1f4c('0x2e')]=qs[_0x1f4c('0x2e')](_0x60b6aa[_0x1f4c('0x46')][_0x1f4c('0x2e')]);_0x125d07[_0x1f4c('0x2c')]=qs[_0x1f4c('0x2c')](_0x60b6aa['query'][_0x1f4c('0x2c')]);}_0x125d07[_0x1f4c('0x4e')]=qs[_0x1f4c('0x4f')](_0x60b6aa[_0x1f4c('0x46')][_0x1f4c('0x4f')]);_0x125d07['where']=qs[_0x1f4c('0x48')](_[_0x1f4c('0x51')](_0x60b6aa[_0x1f4c('0x46')],_0x1431a3[_0x1f4c('0x48')]));_0x125d07[_0x1f4c('0x50')]['WhatsappAccountId']=_0x61e17e['id'];if(_0x60b6aa[_0x1f4c('0x46')]['filter']){_0x125d07[_0x1f4c('0x50')]=_[_0x1f4c('0x53')](_0x125d07[_0x1f4c('0x50')],{'$or':_[_0x1f4c('0x45')](_0x125d07[_0x1f4c('0x4a')],function(_0x44ee47){var _0x52256a={};_0x52256a[_0x44ee47]={'$like':'%'+_0x60b6aa[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0x52256a;})});}_0x125d07=_[_0x1f4c('0x53')]({},_0x125d07,_0x60b6aa[_0x1f4c('0x55')]);return db[_0x1f4c('0x70')][_0x1f4c('0x2f')]({'where':_0x125d07[_0x1f4c('0x50')]})[_0x1f4c('0x1f')](function(_0x2d1f04){_0x3ac5a2[_0x1f4c('0x2f')]=_0x2d1f04;if(_0x60b6aa[_0x1f4c('0x46')]['includeAll']){_0x125d07[_0x1f4c('0x57')]=[{'all':!![]}];}return db[_0x1f4c('0x70')][_0x1f4c('0x58')](_0x125d07);})[_0x1f4c('0x1f')](function(_0x1c40eb){_0x3ac5a2[_0x1f4c('0x59')]=_0x1c40eb;return _0x3ac5a2;});}})[_0x1f4c('0x1f')](respondWithFilteredResult(_0x40a541,_0x125d07))['catch'](handleError(_0x40a541,null));};exports['removeAnswers']=function(_0x250958,_0x790731,_0x87a065){return db['WhatsappAccount'][_0x1f4c('0x5d')]({'where':{'id':_0x250958[_0x1f4c('0x5a')]['id']}})['then'](handleEntityNotFound(_0x790731,null))[_0x1f4c('0x1f')](function(_0x2eb964){if(_0x2eb964){return _0x2eb964[_0x1f4c('0x72')](_0x250958['query'][_0x1f4c('0x6e')]);}})[_0x1f4c('0x1f')](respondWithStatusCode(_0x790731,null))['catch'](handleError(_0x790731,null));};exports[_0x1f4c('0x73')]=function(_0xaa05b,_0x3d577a,_0x1eb502){return db[_0x1f4c('0x40')]['find']({'where':{'id':_0xaa05b[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x3d577a,null))['then'](function(_0x4be1ce){if(_0x4be1ce){return _0x4be1ce['addAgents'](_0xaa05b[_0x1f4c('0x66')][_0x1f4c('0x6e')],_[_0x1f4c('0x74')](_0xaa05b[_0x1f4c('0x66')],[_0x1f4c('0x6e'),'id'])||{})[_0x1f4c('0x75')](function(_0x4a7e2f){for(var _0x2cd492=0x0;_0x2cd492<_0xaa05b[_0x1f4c('0x66')]['ids'][_0x1f4c('0x4b')];_0x2cd492+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0xaa05b[_0x1f4c('0x66')]['ids'][_0x2cd492]),'WhatsappAccountId':Number(_0xaa05b[_0x1f4c('0x5a')]['id'])});}return _0x4a7e2f;});}})[_0x1f4c('0x1f')](respondWithResult(_0x3d577a,null))[_0x1f4c('0x28')](handleError(_0x3d577a,null));};exports[_0x1f4c('0x76')]=function(_0x4a7c16,_0x4ffff3,_0x3d2cab){return db['WhatsappAccount'][_0x1f4c('0x5d')]({'where':{'id':_0x4a7c16['params']['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x4ffff3,null))['then'](function(_0x477f64){if(_0x477f64){return _0x477f64['removeAgents'](_0x4a7c16['query']['ids'])[_0x1f4c('0x1f')](function(){if(_[_0x1f4c('0x77')](_0x4a7c16[_0x1f4c('0x46')][_0x1f4c('0x6e')])){for(var _0x3f5b0d=0x0;_0x3f5b0d<_0x4a7c16[_0x1f4c('0x46')]['ids']['length'];_0x3f5b0d+=0x1){socket[_0x1f4c('0x78')](_0x1f4c('0x79'),{'UserId':Number(_0x4a7c16[_0x1f4c('0x46')]['ids'][_0x3f5b0d]),'WhatsappAccountId':Number(_0x4a7c16[_0x1f4c('0x5a')]['id'])});}}else{socket[_0x1f4c('0x78')]('userWhatsappAccount:remove',{'UserId':Number(_0x4a7c16['query']['ids']),'WhatsappAccountId':Number(_0x4a7c16[_0x1f4c('0x5a')]['id'])});}});}})[_0x1f4c('0x1f')](respondWithStatusCode(_0x4ffff3,null))[_0x1f4c('0x28')](handleError(_0x4ffff3,null));};exports['getAgents']=function(_0x350ca5,_0x10a101,_0x588772){var _0x5e882e={};var _0x3b4adb={};var _0x2bf970;var _0x1c9148;return db[_0x1f4c('0x40')][_0x1f4c('0x6c')]({'where':{'id':_0x350ca5[_0x1f4c('0x5a')]['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x10a101,null))['then'](function(_0x3afb22){if(_0x3afb22){_0x2bf970=_0x3afb22;_0x3b4adb['model']=_[_0x1f4c('0x47')](db[_0x1f4c('0x7a')][_0x1f4c('0x41')]);_0x3b4adb[_0x1f4c('0x46')]=_[_0x1f4c('0x47')](_0x350ca5['query']);_0x3b4adb['filters']=_[_0x1f4c('0x49')](_0x3b4adb[_0x1f4c('0x5b')],_0x3b4adb[_0x1f4c('0x46')]);_0x5e882e[_0x1f4c('0x4a')]=_[_0x1f4c('0x49')](_0x3b4adb[_0x1f4c('0x5b')],qs['fields'](_0x350ca5['query'][_0x1f4c('0x5c')]));_0x5e882e[_0x1f4c('0x4a')]=_0x5e882e[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x5e882e[_0x1f4c('0x4a')]:_0x3b4adb['model'];_0x5e882e[_0x1f4c('0x4e')]=qs['sort'](_0x350ca5['query'][_0x1f4c('0x4f')]);_0x5e882e[_0x1f4c('0x50')]=qs['filters'](_[_0x1f4c('0x51')](_0x350ca5['query'],_0x3b4adb[_0x1f4c('0x48')]));if(_0x350ca5[_0x1f4c('0x46')][_0x1f4c('0x52')]){_0x5e882e[_0x1f4c('0x50')]=_[_0x1f4c('0x53')](_0x5e882e[_0x1f4c('0x50')],{'$or':_['map'](_0x5e882e[_0x1f4c('0x4a')],function(_0x14603a){var _0xd3fc36={};_0xd3fc36[_0x14603a]={'$like':'%'+_0x350ca5[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0xd3fc36;})});}_0x5e882e=_[_0x1f4c('0x53')]({},_0x5e882e,_0x350ca5[_0x1f4c('0x55')]);return _0x2bf970['getAgents'](_0x5e882e);}})[_0x1f4c('0x1f')](function(_0x2d5211){if(_0x2d5211){_0x1c9148=_0x2d5211[_0x1f4c('0x4b')];if(!_0x350ca5[_0x1f4c('0x46')][_0x1f4c('0x4c')](_0x1f4c('0x4d'))){_0x5e882e[_0x1f4c('0x2e')]=qs[_0x1f4c('0x2e')](_0x350ca5['query'][_0x1f4c('0x2e')]);_0x5e882e[_0x1f4c('0x2c')]=qs[_0x1f4c('0x2c')](_0x350ca5['query'][_0x1f4c('0x2c')]);}return _0x2bf970['getAgents'](_0x5e882e);}})[_0x1f4c('0x1f')](function(_0x53f69a){if(_0x53f69a){return _0x53f69a?{'count':_0x1c9148,'rows':_0x53f69a}:null;}})[_0x1f4c('0x1f')](respondWithResult(_0x10a101,null))[_0x1f4c('0x28')](handleError(_0x10a101,null));};exports[_0x1f4c('0x7b')]=function(_0xff36aa,_0x7075ff){var _0x3b3729=_0xff36aa['params']['id'];var _0x52e790=_0xff36aa[_0x1f4c('0x66')];var _0xbfa2b6=0xc8;var _0x5c2ac5=null;return db[_0x1f4c('0x7c')][_0x1f4c('0x7d')]({'isolationLevel':db['sequelize'][_0x1f4c('0x7e')]['ISOLATION_LEVELS'][_0x1f4c('0x7f')]},function(_0xbd0897){return db[_0x1f4c('0x40')][_0x1f4c('0x6c')]({'where':{'id':_0x3b3729},'transaction':_0xbd0897})[_0x1f4c('0x1f')](function(_0x3a2ad8){if(_0x3a2ad8){return db[_0x1f4c('0x80')]['destroy']({'where':{'WhatsappAccountId':_0x3b3729},'transaction':_0xbd0897})[_0x1f4c('0x1f')](function(){var _0x291490=_[_0x1f4c('0x45')](_0x52e790,function(_0xf704dd){_0xf704dd[_0x1f4c('0x69')]=_0x3b3729;return _0xf704dd;});return db[_0x1f4c('0x80')][_0x1f4c('0x81')](_0x291490,{'transaction':_0xbd0897});});}else{_0xbfa2b6=0x194;_0x5c2ac5=[];}});})['then'](function(){if(_0xbfa2b6!==0x194){return db[_0x1f4c('0x80')][_0x1f4c('0x82')]({'where':{'WhatsappAccountId':_0x3b3729},'order':_0x1f4c('0x83')})[_0x1f4c('0x1f')](function(_0x14756a){_0x5c2ac5=_0x14756a;});}})[_0x1f4c('0x28')](function(_0x5c350a){_0xbfa2b6=0x1f4;logger[_0x1f4c('0x23')](_0x5c350a[_0x1f4c('0x3a')]);if(_0x5c350a[_0x1f4c('0x3b')]){delete _0x5c350a[_0x1f4c('0x3b')];}_0x5c2ac5=_0x5c350a;})[_0x1f4c('0x84')](function(){if(_0x5c2ac5===null){_0x7075ff[_0x1f4c('0x29')](_0xbfa2b6);}else{if(_0xbfa2b6===0x1f4){_0x7075ff['status'](_0xbfa2b6)[_0x1f4c('0x3c')](_0x5c2ac5);}else{_0x7075ff['status'](_0xbfa2b6)[_0x1f4c('0x2b')](_0x5c2ac5);}}});};exports[_0x1f4c('0x85')]=function(_0x2de71b,_0x40fe91,_0x22c5ac){var _0x586c62={};var _0x3444a4={};var _0x23e7f2;var _0x5a5f51;return db[_0x1f4c('0x40')][_0x1f4c('0x6c')]({'where':{'id':_0x2de71b['params']['id']}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x40fe91,null))[_0x1f4c('0x1f')](function(_0x37522c){if(_0x37522c){_0x23e7f2=_0x37522c;_0x3444a4[_0x1f4c('0x5b')]=_[_0x1f4c('0x47')](db[_0x1f4c('0x80')]['rawAttributes']);_0x3444a4[_0x1f4c('0x46')]=_[_0x1f4c('0x47')](_0x2de71b[_0x1f4c('0x46')]);_0x3444a4[_0x1f4c('0x48')]=_[_0x1f4c('0x49')](_0x3444a4[_0x1f4c('0x5b')],_0x3444a4[_0x1f4c('0x46')]);_0x586c62[_0x1f4c('0x4a')]=_['intersection'](_0x3444a4[_0x1f4c('0x5b')],qs[_0x1f4c('0x5c')](_0x2de71b[_0x1f4c('0x46')][_0x1f4c('0x5c')]));_0x586c62[_0x1f4c('0x4a')]=_0x586c62[_0x1f4c('0x4a')][_0x1f4c('0x4b')]?_0x586c62[_0x1f4c('0x4a')]:_0x3444a4[_0x1f4c('0x5b')];_0x586c62['order']=qs[_0x1f4c('0x4f')](_0x2de71b[_0x1f4c('0x46')]['sort']);_0x586c62[_0x1f4c('0x50')]=qs[_0x1f4c('0x48')](_[_0x1f4c('0x51')](_0x2de71b[_0x1f4c('0x46')],_0x3444a4[_0x1f4c('0x48')]));if(_0x2de71b[_0x1f4c('0x46')]['filter']){_0x586c62['where']=_['merge'](_0x586c62['where'],{'$or':_['map'](_0x586c62[_0x1f4c('0x4a')],function(_0x14a3d3){var _0x1d4aac={};_0x1d4aac[_0x14a3d3]={'$like':'%'+_0x2de71b[_0x1f4c('0x46')][_0x1f4c('0x52')]+'%'};return _0x1d4aac;})});}_0x586c62=_[_0x1f4c('0x53')]({},_0x586c62,_0x2de71b[_0x1f4c('0x55')]);return _0x23e7f2[_0x1f4c('0x85')](_0x586c62);}})[_0x1f4c('0x1f')](function(_0x304ef4){if(_0x304ef4){_0x5a5f51=_0x304ef4['length'];if(!_0x2de71b[_0x1f4c('0x46')][_0x1f4c('0x4c')](_0x1f4c('0x4d'))){_0x586c62['limit']=qs[_0x1f4c('0x2e')](_0x2de71b['query'][_0x1f4c('0x2e')]);_0x586c62['offset']=qs[_0x1f4c('0x2c')](_0x2de71b[_0x1f4c('0x46')][_0x1f4c('0x2c')]);}return _0x23e7f2[_0x1f4c('0x85')](_0x586c62);}})[_0x1f4c('0x1f')](function(_0x25b22f){if(_0x25b22f){return _0x25b22f?{'count':_0x5a5f51,'rows':_0x25b22f}:null;}})[_0x1f4c('0x1f')](respondWithResult(_0x40fe91,null))['catch'](handleError(_0x40fe91,null));};exports[_0x1f4c('0x86')]=function(_0x9279b5,_0x22cc62,_0x151129){var _0x34e44b={'channel':'whatsapp'};var _0x557226=[];var _0x20755d=[];var _0x186d58={};return db[_0x1f4c('0x40')]['find']({'where':{'id':_0x9279b5[_0x1f4c('0x5a')]['id']},'include':[{'model':db[_0x1f4c('0x80')],'as':_0x1f4c('0x87')}]})[_0x1f4c('0x1f')](handleEntityNotFound(_0x22cc62,null))[_0x1f4c('0x1f')](function(_0x446587){_0x34e44b[_0x1f4c('0x88')]=_0x446587;if(_0x34e44b['account']&&_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0x43')]===_0x1f4c('0x89')&&_0x9279b5['body'][_0x1f4c('0x8a')]){if(_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0x8a')]['length']===0x0)return;if(_0x9279b5['body']['statuses'][0x0][_0x1f4c('0x8b')]!==_0x1f4c('0x8c'))return;return db[_0x1f4c('0x8d')][_0x1f4c('0x36')]({'read':!![],'readAt':_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0x8a')][0x0][_0x1f4c('0x8e')]},{'where':{'messageId':_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0x8a')][0x0][_0x1f4c('0x8f')]},'individualHooks':!![]})[_0x1f4c('0x1f')](function(_0x53bfee){return _0x22cc62[_0x1f4c('0x30')](0xc8)['json'](_0x53bfee);});}_0x34e44b[_0x1f4c('0x90')]=_[_0x1f4c('0x91')](_0x446587[_0x1f4c('0x87')],[_0x1f4c('0x83')],[_0x1f4c('0x92')]);if(_0x34e44b['account'][_0x1f4c('0x87')]){delete _0x34e44b['account']['Applications'];}return db[_0x1f4c('0x93')][_0x1f4c('0x67')]()['then'](function(_0x4504cc){if(!_0x4504cc){throw new db[(_0x1f4c('0x94'))][(_0x1f4c('0x95'))](_0x1f4c('0x96'));}_0x557226=_[_0x1f4c('0x97')](_[_0x1f4c('0x47')](_0x4504cc),[_0x1f4c('0x98'),_0x1f4c('0x99')]);_0x20755d=_[_0x1f4c('0x97')](_[_0x1f4c('0x47')](_0x4504cc),[_0x1f4c('0x98'),'updatedAt',_0x1f4c('0x9a'),'ListId']);_0x34e44b[_0x1f4c('0x66')]={'mapKey':_0x1f4c('0x9b')};if(_0x34e44b[_0x1f4c('0x88')]&&_0x34e44b['account'][_0x1f4c('0x43')]===_0x1f4c('0x9c')){_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x9d')]=_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0x9e')]['replace'](_0x1f4c('0x9f'),'');_0x34e44b['body']['body']=_0x9279b5[_0x1f4c('0x66')]['Body'];_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0xa0')]=_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0xa1')];}if(_0x34e44b['account']&&_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0x43')]==='sinch'){_0x34e44b['body'][_0x1f4c('0x9d')]=_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0xa2')][0x0][_0x1f4c('0x9d')];_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x66')]=_0x9279b5[_0x1f4c('0x66')][_0x1f4c('0xa2')][0x0][_0x1f4c('0x25')][_0x1f4c('0x66')];_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0xa0')]=_0x9279b5['body']['notifications'][0x0]['message_id'];}if(_0x34e44b[_0x1f4c('0x66')]['id']){delete _0x34e44b['body']['id'];}if(_[_0x1f4c('0xa3')](_0x34e44b[_0x1f4c('0x66')]['from'])){throw new db[(_0x1f4c('0x94'))]['ValidationError'](_0x1f4c('0xa4'));}if(_[_0x1f4c('0xa3')](_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x66')])||_0x34e44b[_0x1f4c('0x66')]['body']===''){throw new db['Sequelize'][(_0x1f4c('0x95'))](_0x1f4c('0xa5'));}if(_['isNil'](_0x34e44b['body'][_0x1f4c('0xa6')])){throw new db['Sequelize'][(_0x1f4c('0x95'))](_0x1f4c('0xa7')+_0x20755d);}if(!_[_0x1f4c('0xa8')](_0x20755d,_0x34e44b[_0x1f4c('0x66')]['mapKey'])){throw new db[(_0x1f4c('0x94'))]['ValidationError'](_0x1f4c('0xa9')+_0x20755d);}_0x186d58[_0x34e44b['body'][_0x1f4c('0xa6')]]=_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x9d')];return db[_0x1f4c('0xaa')][_0x1f4c('0x5d')]({'where':{'id':_0x34e44b['account'][_0x1f4c('0xab')]},'include':[{'model':db[_0x1f4c('0x93')],'as':_0x1f4c('0xac'),'where':_0x186d58,'limit':0x1,'order':[[_0x1f4c('0x99'),_0x1f4c('0xad')]]}]});})[_0x1f4c('0x1f')](handleEntityNotFound(_0x22cc62,null))['then'](function(_0x4616b6){if(_0x4616b6){_0x34e44b[_0x1f4c('0xae')]=_[_0x1f4c('0x74')](_0x4616b6,[_0x1f4c('0xac')]);if(_0x4616b6[_0x1f4c('0xac')][_0x1f4c('0x4b')]){return _0x4616b6['Contacts'][0x0];}var _0xbe2677=_['defaults'](_0x34e44b[_0x1f4c('0x66')],{'firstName':_0x34e44b[_0x1f4c('0x66')]['from'],'ListId':_0x4616b6['id']});_0xbe2677[_0x34e44b[_0x1f4c('0x66')]['mapKey']]=_0x34e44b[_0x1f4c('0x66')]['from'];return db[_0x1f4c('0x93')][_0x1f4c('0x5e')](_0xbe2677,{'fields':_0x557226,'raw':!![]});}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x22cc62,null))[_0x1f4c('0x1f')](function(_0x48e2f4){if(_0x48e2f4){_0x34e44b[_0x1f4c('0xaf')]=_0x48e2f4;var _0x436af7={'ContactId':_0x48e2f4['id'],'phone':_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x9d')],'WhatsappAccountId':_0x9279b5[_0x1f4c('0x5a')]['id']};var _0x522bc6={'ContactId':_0x48e2f4['id'],'WhatsappAccountId':_0x9279b5['params']['id'],'closed':![]};return db[_0x1f4c('0xb0')][_0x1f4c('0x5d')]({'where':_0x522bc6})[_0x1f4c('0x1f')](function(_0x141aa6){if(_0x141aa6){return[_0x141aa6,![]];}return db[_0x1f4c('0xb0')][_0x1f4c('0x5e')](_0x436af7)[_0x1f4c('0x1f')](function(_0x351d6c){return[_0x351d6c,!![]];});});}})[_0x1f4c('0x75')](function(_0x4db153,_0x5edd2c){_0x34e44b['interaction']=_0x4db153['get']({'plain':!![]});_0x34e44b[_0x1f4c('0xb1')]['created']=![];if(_0x5edd2c){if(_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0xb2')]){_0x34e44b['applications'][_0x1f4c('0xb3')]({'id':0x0,'priority':_0x34e44b[_0x1f4c('0x90')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x1f4c('0xb4')});}_0x34e44b['interaction']['created']=!![];}return db['WhatsappMessage'][_0x1f4c('0x5e')]({'phone':_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x9d')],'messageId':_0x34e44b[_0x1f4c('0x66')]['messageId'],'body':_0x34e44b[_0x1f4c('0x66')][_0x1f4c('0x66')],'WhatsappAccountId':_0x9279b5[_0x1f4c('0x5a')]['id'],'WhatsappInteractionId':_0x4db153['id'],'direction':'in','ContactId':_0x4db153[_0x1f4c('0xb5')],'AttachmentId':_0x34e44b['body'][_0x1f4c('0xb6')]});})['then'](function(_0x5bd18b){_0x34e44b['message']=_0x5bd18b;if(_0x34e44b[_0x1f4c('0xb1')][_0x1f4c('0xb7')]){return db[_0x1f4c('0x7a')][_0x1f4c('0x5d')]({'attributes':['id',_0x1f4c('0x3b')],'where':{'id':_0x34e44b['interaction'][_0x1f4c('0xb7')]}})[_0x1f4c('0x1f')](function(_0x123e9d){if(_0x123e9d){_0x34e44b[_0x1f4c('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x123e9d['name']+','+(_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0xb8')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1f4c('0xb9'),_0x1f4c('0xba'),_0x34e44b);});}return respondWithRpcPromise(_0x1f4c('0xb9'),_0x1f4c('0xba'),_0x34e44b);})[_0x1f4c('0x1f')](function(_0x4a414f){if(_0x4a414f){var _0x1d1d99=0xc8;var _0xd9eaa5=_0x1f4c('0xbb');logger[_0x1f4c('0x26')](_0x1f4c('0xbc'),_0xd9eaa5,_0x1d1d99,_0x1f4c('0xbd'));logger[_0x1f4c('0x21')](_0x1f4c('0xbe'),_0xd9eaa5,_0x1d1d99,_0x1f4c('0xbd'),JSON[_0x1f4c('0x22')](_0x4a414f));if(_0x34e44b[_0x1f4c('0x88')][_0x1f4c('0x43')]===_0x1f4c('0x9c')){return _0x22cc62[_0x1f4c('0x30')](_0x1d1d99)['set'](_0x1f4c('0xbf'),'text/xml')[_0x1f4c('0x3c')](_0x1f4c('0xc0'));}else{return _0x22cc62[_0x1f4c('0x30')](_0x1d1d99)[_0x1f4c('0x2b')](_0x4a414f);}}});})[_0x1f4c('0x28')](handleError(_0x22cc62,null));};exports[_0x1f4c('0x3c')]=function(_0x41f425,_0x53bcbf,_0x1d8cd7){var _0x225b92,_0x6f18a6,_0x1da88;if(_[_0x1f4c('0xa3')](_0x41f425[_0x1f4c('0x66')]['body'])||_0x41f425['body']['body']===''){throw new db['Sequelize'][(_0x1f4c('0x95'))](_0x1f4c('0xa5'));}if(_['isNil'](_0x41f425['body']['to'])){throw new db[(_0x1f4c('0x94'))][(_0x1f4c('0x95'))](_0x1f4c('0xc1'));}_0x225b92=_0x41f425[_0x1f4c('0x66')]['to'];return db[_0x1f4c('0x40')][_0x1f4c('0x5d')]({'where':{'id':_0x41f425[_0x1f4c('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x1f4c('0xc2'),'include':[{'model':db['CmContact'],'as':_0x1f4c('0xac'),'where':{'mobile':_0x225b92},'limit':0x1,'order':[[_0x1f4c('0x99'),_0x1f4c('0xad')]]}]}]})[_0x1f4c('0x1f')](handleEntityNotFound(_0x53bcbf,null))['then'](function(_0x35986e){if(_0x35986e&&_0x35986e['List']){_0x6f18a6=_0x35986e[_0x1f4c('0x38')]({'plain':!![]});if(_0x6f18a6[_0x1f4c('0xc2')]&&_0x6f18a6['List'][_0x1f4c('0xac')]['length']){return _0x6f18a6['List'][_0x1f4c('0xac')][0x0];}return db[_0x1f4c('0x93')][_0x1f4c('0x5e')](_[_0x1f4c('0xc3')](_0x41f425[_0x1f4c('0x66')],{'firstName':_0x225b92,'mobile':_0x225b92,'phone':_0x225b92,'ListId':_0x6f18a6[_0x1f4c('0xab')]}));}})[_0x1f4c('0x1f')](handleEntityNotFound(_0x53bcbf,null))[_0x1f4c('0x1f')](function(_0x3d7c62){if(_0x3d7c62){_0x1da88=_0x3d7c62;return db[_0x1f4c('0xb0')][_0x1f4c('0x5d')]({'where':{'ContactId':_0x1da88['id'],'closed':![],'WhatsappAccountId':_0x6f18a6['id']}})[_0x1f4c('0x1f')](function(_0x134c05){if(_0x134c05){return[_0x134c05,![]];}return db[_0x1f4c('0xb0')]['create']({'UserId':_0x41f425[_0x1f4c('0x61')]['id'],'ContactId':_0x1da88['id'],'WhatsappAccountId':_0x6f18a6['id'],'phone':_0x225b92,'firstMsgDirection':_0x1f4c('0xc4'),'Messages':[_[_0x1f4c('0x53')](_0x41f425['body'],{'read':![],'body':_0x41f425[_0x1f4c('0x66')][_0x1f4c('0x66')],'phone':_0x225b92,'WhatsappAccountId':_0x6f18a6['id'],'UserId':_0x41f425[_0x1f4c('0x61')]['id'],'ContactId':_0x1da88['id']})]},{'include':[{'model':db[_0x1f4c('0x8d')],'as':_0x1f4c('0xc5')}]})[_0x1f4c('0x1f')](function(_0x36edac){return[_0x36edac,!![]];});});}})[_0x1f4c('0x75')](function(_0x3ec94a,_0x553d06){if(_0x553d06){return _0x3ec94a;}return db[_0x1f4c('0x8d')]['create'](_[_0x1f4c('0x53')](_0x41f425['body'],{'read':![],'body':_0x41f425['body'][_0x1f4c('0x66')],'phone':_0x225b92,'WhatsappAccountId':_0x6f18a6['id'],'WhatsappInteractionId':_0x3ec94a['id'],'UserId':_0x41f425[_0x1f4c('0x61')]['id'],'ContactId':_0x1da88['id']}))[_0x1f4c('0x1f')](function(_0x403ae8){_0x3ec94a[_0x1f4c('0xc6')]['Messages']=[];_0x3ec94a['dataValues'][_0x1f4c('0xc5')]['push'](_0x403ae8['dataValues']);return _0x3ec94a;});})['then'](respondWithResult(_0x53bcbf,null))['catch'](handleError(_0x53bcbf,null));}; \ No newline at end of file +var _0x0245=['created','ContactId','UserId','User','unshift','waitForTheAssignedAgent','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','List','DESC','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','sendStatus','stack','name','send','Pause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappAccount','include','rows','show','mandatoryDispositionPause','length','find','create','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','WhatsappAccountId','Disposition','findOne','includeAll','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','getAgents','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','asc','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','Body','messageId','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','WhatsappInteraction','interaction','close','unmanaged','*,*,*,*'];(function(_0x3cfa72,_0x8bc773){var _0x32c343=function(_0x340f3d){while(--_0x340f3d){_0x3cfa72['push'](_0x3cfa72['shift']());}};_0x32c343(++_0x8bc773);}(_0x0245,0x18f));var _0x5024=function(_0x5ba110,_0x3ef83c){_0x5ba110=_0x5ba110-0x0;var _0x118ed4=_0x0245[_0x5ba110];return _0x118ed4;};'use strict';var emlformat=require(_0x5024('0x0'));var rimraf=require(_0x5024('0x1'));var zipdir=require(_0x5024('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5024('0x3'));var moment=require(_0x5024('0x4'));var BPromise=require(_0x5024('0x5'));var Mustache=require(_0x5024('0x6'));var util=require(_0x5024('0x7'));var path=require('path');var sox=require(_0x5024('0x8'));var csv=require(_0x5024('0x9'));var ejs=require(_0x5024('0xa'));var fs=require('fs');var fs_extra=require(_0x5024('0xb'));var _=require(_0x5024('0xc'));var squel=require(_0x5024('0xd'));var crypto=require(_0x5024('0xe'));var jsforce=require(_0x5024('0xf'));var deskjs=require(_0x5024('0x10'));var toCsv=require(_0x5024('0x9'));var querystring=require(_0x5024('0x11'));var Papa=require(_0x5024('0x12'));var Redis=require(_0x5024('0x13'));var authService=require(_0x5024('0x14'));var qs=require(_0x5024('0x15'));var as=require(_0x5024('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5024('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x5024('0x18'));var licenseUtil=require(_0x5024('0x19'));var db=require('../../mysqldb')['db'];config[_0x5024('0x1a')]=_[_0x5024('0x1b')](config[_0x5024('0x1a')],{'host':_0x5024('0x1c'),'port':0x18eb});var socket=require(_0x5024('0x1d'))(new Redis(config[_0x5024('0x1a')]));require(_0x5024('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5024('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x56d909,_0x5ee42c,_0x1b0c95,_0x2bbf61){return new BPromise(function(_0x4ac32b,_0x1538e8){var _0x3748c7=_0x2bbf61||client;return _0x3748c7[_0x5024('0x20')](_0x56d909,_0x1b0c95)[_0x5024('0x21')](function(_0x42e6e6){logger[_0x5024('0x22')](_0x5024('0x23'),_0x5ee42c,_0x5024('0x24'));logger[_0x5024('0x25')](_0x5024('0x26'),_0x5ee42c,_0x5024('0x24'),JSON['stringify'](_0x42e6e6));if(_0x42e6e6[_0x5024('0x27')]){if(_0x42e6e6[_0x5024('0x27')][_0x5024('0x28')]===0x1f4){logger[_0x5024('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x5ee42c,_0x42e6e6[_0x5024('0x27')]['message']);return _0x1538e8(_0x42e6e6[_0x5024('0x27')][_0x5024('0x29')]);}logger[_0x5024('0x27')](_0x5024('0x23'),_0x5ee42c,_0x42e6e6['error'][_0x5024('0x29')]);return _0x4ac32b(_0x42e6e6[_0x5024('0x27')][_0x5024('0x29')]);}else{logger[_0x5024('0x22')](_0x5024('0x23'),_0x5ee42c,'request\x20sent');_0x4ac32b(_0x42e6e6[_0x5024('0x2a')][_0x5024('0x29')]);}})[_0x5024('0x2b')](function(_0x15d56a){logger[_0x5024('0x27')](_0x5024('0x23'),_0x5ee42c,_0x15d56a);_0x1538e8(_0x15d56a);});});}function respondWithStatusCode(_0x2e33ec,_0x39752a){_0x39752a=_0x39752a||0xcc;return function(_0x11e2ea){if(_0x11e2ea){return _0x2e33ec['sendStatus'](_0x39752a);}return _0x2e33ec['status'](_0x39752a)['end']();};}function respondWithResult(_0x3dc350,_0x3f5e0b){_0x3f5e0b=_0x3f5e0b||0xc8;return function(_0x150c1a){if(_0x150c1a){return _0x3dc350[_0x5024('0x2c')](_0x3f5e0b)[_0x5024('0x2d')](_0x150c1a);}};}function respondWithFilteredResult(_0x431d87,_0x2570ce){return function(_0x216771){if(_0x216771){var _0xe7a6c5=typeof _0x2570ce[_0x5024('0x2e')]==='undefined'&&typeof _0x2570ce[_0x5024('0x2f')]==='undefined';var _0x25f628=_0x216771[_0x5024('0x30')];var _0x4d7f68=_0xe7a6c5?0x0:_0x2570ce['offset'];var _0x31e98d=_0xe7a6c5?_0x216771[_0x5024('0x30')]:_0x2570ce[_0x5024('0x2e')]+_0x2570ce[_0x5024('0x2f')];var _0x161c5f;if(_0x31e98d>=_0x25f628){_0x31e98d=_0x25f628;_0x161c5f=0xc8;}else{_0x161c5f=0xce;}_0x431d87['status'](_0x161c5f);return _0x431d87[_0x5024('0x31')](_0x5024('0x32'),_0x4d7f68+'-'+_0x31e98d+'/'+_0x25f628)['json'](_0x216771);}return null;};}function patchUpdates(_0x1a6bdb){return function(_0x41cf63){try{jsonpatch[_0x5024('0x33')](_0x41cf63,_0x1a6bdb,!![]);}catch(_0x52c044){return BPromise[_0x5024('0x34')](_0x52c044);}return _0x41cf63[_0x5024('0x35')]();};}function saveUpdates(_0x5b5c9e,_0x40e555){return function(_0x3b056a){if(_0x3b056a){return _0x3b056a[_0x5024('0x36')](_0x5b5c9e)['then'](function(_0x2386a2){return _0x2386a2;});}return null;};}function removeEntity(_0x55e665,_0xa0fc9a){return function(_0x1f87bb){if(_0x1f87bb){return _0x1f87bb[_0x5024('0x37')]()[_0x5024('0x21')](function(){var _0x559dfa=_0x1f87bb[_0x5024('0x38')]({'plain':!![]});var _0x55e9fd=_0x5024('0x39');return db[_0x5024('0x3a')][_0x5024('0x37')]({'where':{'type':_0x55e9fd,'resourceId':_0x559dfa['id']}})[_0x5024('0x21')](function(){return _0x1f87bb;});})[_0x5024('0x21')](function(){_0x55e665[_0x5024('0x2c')](0xcc)[_0x5024('0x3b')]();});}};}function handleEntityNotFound(_0x35a75f,_0x200cf2){return function(_0x353095){if(!_0x353095){_0x35a75f[_0x5024('0x3c')](0x194);}return _0x353095;};}function handleError(_0x3c0c5c,_0x182ead){_0x182ead=_0x182ead||0x1f4;return function(_0x234b9c){logger[_0x5024('0x27')](_0x234b9c[_0x5024('0x3d')]);if(_0x234b9c[_0x5024('0x3e')]){delete _0x234b9c[_0x5024('0x3e')];}_0x3c0c5c['status'](_0x182ead)[_0x5024('0x3f')](_0x234b9c);};}exports['index']=function(_0x129e7b,_0x500a5f){var _0x3fe331={'include':[{'model':db[_0x5024('0x40')],'as':'mandatoryDispositionPause'}]},_0x5d6471={},_0x1e4267={'count':0x0,'rows':[]};var _0x57c200=_[_0x5024('0x41')](db['WhatsappAccount'][_0x5024('0x42')],function(_0x4a5c02){return{'name':_0x4a5c02[_0x5024('0x43')],'type':_0x4a5c02[_0x5024('0x44')]['key']};});_0x5d6471[_0x5024('0x45')]=_[_0x5024('0x41')](_0x57c200,_0x5024('0x3e'));_0x5d6471[_0x5024('0x46')]=_[_0x5024('0x47')](_0x129e7b[_0x5024('0x46')]);_0x5d6471[_0x5024('0x48')]=_[_0x5024('0x49')](_0x5d6471['model'],_0x5d6471[_0x5024('0x46')]);_0x3fe331['attributes']=_[_0x5024('0x49')](_0x5d6471[_0x5024('0x45')],qs['fields'](_0x129e7b[_0x5024('0x46')][_0x5024('0x4a')]));_0x3fe331[_0x5024('0x4b')]=_0x3fe331['attributes']['length']?_0x3fe331[_0x5024('0x4b')]:_0x5d6471[_0x5024('0x45')];if(!_0x129e7b['query'][_0x5024('0x4c')](_0x5024('0x4d'))){_0x3fe331['limit']=qs[_0x5024('0x2f')](_0x129e7b[_0x5024('0x46')][_0x5024('0x2f')]);_0x3fe331[_0x5024('0x2e')]=qs[_0x5024('0x2e')](_0x129e7b[_0x5024('0x46')]['offset']);}_0x3fe331[_0x5024('0x4e')]=qs[_0x5024('0x4f')](_0x129e7b[_0x5024('0x46')]['sort']);_0x3fe331['where']=qs[_0x5024('0x48')](_[_0x5024('0x50')](_0x129e7b['query'],_0x5d6471[_0x5024('0x48')]),_0x57c200);if(_0x129e7b['query'][_0x5024('0x51')]){_0x3fe331[_0x5024('0x52')]=_[_0x5024('0x53')](_0x3fe331[_0x5024('0x52')],{'$or':_[_0x5024('0x41')](_0x57c200,function(_0xa08b58){if(_0xa08b58[_0x5024('0x44')]!==_0x5024('0x54')){var _0x40b853={};_0x40b853[_0xa08b58[_0x5024('0x3e')]]={'$like':'%'+_0x129e7b[_0x5024('0x46')][_0x5024('0x51')]+'%'};return _0x40b853;}})});}_0x3fe331=_['merge']({},_0x3fe331,_0x129e7b[_0x5024('0x55')]);var _0x36eb61={'where':_0x3fe331[_0x5024('0x52')]};return db[_0x5024('0x56')][_0x5024('0x30')](_0x36eb61)[_0x5024('0x21')](function(_0x1d43f3){_0x1e4267[_0x5024('0x30')]=_0x1d43f3;if(_0x129e7b[_0x5024('0x46')]['includeAll']){_0x3fe331[_0x5024('0x57')]=[{'all':!![]}];}return db[_0x5024('0x56')]['findAll'](_0x3fe331);})['then'](function(_0x4d4e15){_0x1e4267[_0x5024('0x58')]=_0x4d4e15;return _0x1e4267;})[_0x5024('0x21')](respondWithFilteredResult(_0x500a5f,_0x3fe331))[_0x5024('0x2b')](handleError(_0x500a5f,null));};exports[_0x5024('0x59')]=function(_0x2e25f6,_0x5119ad){var _0x1ef288={'raw':![],'where':{'id':_0x2e25f6['params']['id']},'include':[{'model':db[_0x5024('0x40')],'as':_0x5024('0x5a')}]},_0x48a0b6={};_0x48a0b6[_0x5024('0x45')]=_[_0x5024('0x47')](db['WhatsappAccount'][_0x5024('0x42')]);_0x48a0b6[_0x5024('0x46')]=_[_0x5024('0x47')](_0x2e25f6[_0x5024('0x46')]);_0x48a0b6['filters']=_[_0x5024('0x49')](_0x48a0b6['model'],_0x48a0b6[_0x5024('0x46')]);_0x1ef288[_0x5024('0x4b')]=_[_0x5024('0x49')](_0x48a0b6[_0x5024('0x45')],qs[_0x5024('0x4a')](_0x2e25f6[_0x5024('0x46')][_0x5024('0x4a')]));_0x1ef288[_0x5024('0x4b')]=_0x1ef288['attributes'][_0x5024('0x5b')]?_0x1ef288[_0x5024('0x4b')]:_0x48a0b6[_0x5024('0x45')];if(_0x2e25f6['query']['includeAll']){_0x1ef288['include']=[{'all':!![]}];}_0x1ef288=_[_0x5024('0x53')]({},_0x1ef288,_0x2e25f6[_0x5024('0x55')]);return db[_0x5024('0x56')][_0x5024('0x5c')](_0x1ef288)['then'](handleEntityNotFound(_0x5119ad,null))[_0x5024('0x21')](respondWithResult(_0x5119ad,null))['catch'](handleError(_0x5119ad,null));};exports[_0x5024('0x5d')]=function(_0x49d51d,_0x12666d){return db['WhatsappAccount'][_0x5024('0x5d')](_0x49d51d['body'],{})[_0x5024('0x21')](function(_0x38cf61){var _0x51891b=_0x49d51d[_0x5024('0x5e')][_0x5024('0x38')]({'plain':!![]});if(!_0x51891b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51891b[_0x5024('0x5f')]===_0x5024('0x5e')){var _0x4d9612=_0x38cf61['get']({'plain':!![]});var _0x4a7a94='WhatsappAccounts';return db[_0x5024('0x60')][_0x5024('0x5c')]({'where':{'name':_0x4a7a94,'userProfileId':_0x51891b['userProfileId']},'raw':!![]})[_0x5024('0x21')](function(_0x24ca82){if(_0x24ca82&&_0x24ca82['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4d9612[_0x5024('0x3e')],'resourceId':_0x4d9612['id'],'type':_0x24ca82['name'],'sectionId':_0x24ca82['id']},{})[_0x5024('0x21')](function(){return _0x38cf61;});}else{return _0x38cf61;}})[_0x5024('0x2b')](function(_0x5a4c86){logger[_0x5024('0x27')](_0x5024('0x61'),_0x5a4c86);throw _0x5a4c86;});}return _0x38cf61;})['then'](respondWithResult(_0x12666d,0xc9))[_0x5024('0x2b')](handleError(_0x12666d,null));};exports['update']=function(_0x1603ba,_0x360e70){if(_0x1603ba['body']['id']){delete _0x1603ba[_0x5024('0x62')]['id'];}return db[_0x5024('0x56')]['find']({'where':{'id':_0x1603ba[_0x5024('0x63')]['id']},'include':[{'model':db[_0x5024('0x40')],'as':_0x5024('0x5a')}]})['then'](handleEntityNotFound(_0x360e70,null))[_0x5024('0x21')](saveUpdates(_0x1603ba['body'],null))[_0x5024('0x21')](respondWithResult(_0x360e70,null))[_0x5024('0x2b')](handleError(_0x360e70,null));};exports[_0x5024('0x37')]=function(_0x5f008a,_0x5bc7c0){return db[_0x5024('0x56')][_0x5024('0x5c')]({'where':{'id':_0x5f008a[_0x5024('0x63')]['id']}})[_0x5024('0x21')](handleEntityNotFound(_0x5bc7c0,null))[_0x5024('0x21')](removeEntity(_0x5bc7c0,null))[_0x5024('0x2b')](handleError(_0x5bc7c0,null));};exports[_0x5024('0x64')]=function(_0x21ee39,_0x27d6ac){return db[_0x5024('0x56')][_0x5024('0x64')]()[_0x5024('0x21')](respondWithResult(_0x27d6ac,null))[_0x5024('0x2b')](handleError(_0x27d6ac,null));};exports['addDisposition']=function(_0x45320c,_0x357fda,_0x218b7b){if(_0x45320c[_0x5024('0x62')]['id']){delete _0x45320c[_0x5024('0x62')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x45320c['params']['id']}})[_0x5024('0x21')](handleEntityNotFound(_0x357fda,null))[_0x5024('0x21')](function(_0x5dbfee){if(_0x5dbfee){_0x45320c[_0x5024('0x62')][_0x5024('0x65')]=_0x5dbfee['id'];return db[_0x5024('0x66')][_0x5024('0x5d')](_0x45320c[_0x5024('0x62')]);}})[_0x5024('0x21')](respondWithResult(_0x357fda,null))[_0x5024('0x2b')](handleError(_0x357fda,null));};exports['getDispositions']=function(_0x282489,_0x163054,_0x3b8549){var _0x13ffa3={'raw':![],'where':{}};var _0x416a61={};var _0x2d04d2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5024('0x67')]({'where':{'id':_0x282489['params']['id']}})[_0x5024('0x21')](handleEntityNotFound(_0x163054,null))['then'](function(_0x3b225a){if(_0x3b225a){_0x416a61[_0x5024('0x45')]=_['keys'](db[_0x5024('0x66')][_0x5024('0x42')]);_0x416a61[_0x5024('0x46')]=_[_0x5024('0x47')](_0x282489[_0x5024('0x46')]);_0x416a61[_0x5024('0x48')]=_['intersection'](_0x416a61['model'],_0x416a61[_0x5024('0x46')]);_0x13ffa3[_0x5024('0x4b')]=_['intersection'](_0x416a61[_0x5024('0x45')],qs[_0x5024('0x4a')](_0x282489['query']['fields']));_0x13ffa3['attributes']=_0x13ffa3[_0x5024('0x4b')][_0x5024('0x5b')]?_0x13ffa3[_0x5024('0x4b')]:_0x416a61[_0x5024('0x45')];if(!_0x282489['query'][_0x5024('0x4c')](_0x5024('0x4d'))){_0x13ffa3[_0x5024('0x2f')]=qs[_0x5024('0x2f')](_0x282489['query'][_0x5024('0x2f')]);_0x13ffa3[_0x5024('0x2e')]=qs[_0x5024('0x2e')](_0x282489[_0x5024('0x46')][_0x5024('0x2e')]);}_0x13ffa3['order']=qs[_0x5024('0x4f')](_0x282489[_0x5024('0x46')][_0x5024('0x4f')]);_0x13ffa3['where']=qs[_0x5024('0x48')](_[_0x5024('0x50')](_0x282489[_0x5024('0x46')],_0x416a61['filters']));_0x13ffa3[_0x5024('0x52')]['WhatsappAccountId']=_0x3b225a['id'];if(_0x282489[_0x5024('0x46')][_0x5024('0x51')]){_0x13ffa3[_0x5024('0x52')]=_[_0x5024('0x53')](_0x13ffa3[_0x5024('0x52')],{'$or':_['map'](_0x13ffa3['attributes'],function(_0x2310bf){var _0x3bc6e2={};_0x3bc6e2[_0x2310bf]={'$like':'%'+_0x282489['query'][_0x5024('0x51')]+'%'};return _0x3bc6e2;})});}_0x13ffa3=_[_0x5024('0x53')]({},_0x13ffa3,_0x282489[_0x5024('0x55')]);return db[_0x5024('0x66')][_0x5024('0x30')]({'where':_0x13ffa3['where']})[_0x5024('0x21')](function(_0x5d259c){_0x2d04d2[_0x5024('0x30')]=_0x5d259c;if(_0x282489['query'][_0x5024('0x68')]){_0x13ffa3[_0x5024('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x5024('0x69')](_0x13ffa3);})[_0x5024('0x21')](function(_0x742116){_0x2d04d2[_0x5024('0x58')]=_0x742116;return _0x2d04d2;});}})[_0x5024('0x21')](respondWithFilteredResult(_0x163054,_0x13ffa3))[_0x5024('0x2b')](handleError(_0x163054,null));};exports[_0x5024('0x6a')]=function(_0x21508d,_0x5c4db1,_0x51b23b){return db[_0x5024('0x56')]['find']({'where':{'id':_0x21508d['params']['id']}})['then'](handleEntityNotFound(_0x5c4db1,null))['then'](function(_0x2ccdeb){if(_0x2ccdeb){return _0x2ccdeb[_0x5024('0x6a')](_0x21508d['query'][_0x5024('0x6b')]);}})[_0x5024('0x21')](respondWithStatusCode(_0x5c4db1,null))[_0x5024('0x2b')](handleError(_0x5c4db1,null));};exports[_0x5024('0x6c')]=function(_0x3e71d7,_0x381af6,_0x4000bd){if(_0x3e71d7[_0x5024('0x62')]['id']){delete _0x3e71d7['body']['id'];}return db[_0x5024('0x56')][_0x5024('0x5c')]({'where':{'id':_0x3e71d7[_0x5024('0x63')]['id']}})[_0x5024('0x21')](handleEntityNotFound(_0x381af6,null))[_0x5024('0x21')](function(_0x495246){if(_0x495246){_0x3e71d7[_0x5024('0x62')][_0x5024('0x65')]=_0x495246['id'];return db[_0x5024('0x6d')]['create'](_0x3e71d7[_0x5024('0x62')]);}})[_0x5024('0x21')](respondWithResult(_0x381af6,null))[_0x5024('0x2b')](handleError(_0x381af6,null));};exports[_0x5024('0x6e')]=function(_0x892790,_0x378cf9,_0x52e2bb){var _0x173025={'raw':![],'where':{}};var _0xd1f0cf={};var _0x285d80={'count':0x0,'rows':[]};return db[_0x5024('0x56')][_0x5024('0x67')]({'where':{'id':_0x892790[_0x5024('0x63')]['id']}})[_0x5024('0x21')](handleEntityNotFound(_0x378cf9,null))[_0x5024('0x21')](function(_0x242efe){if(_0x242efe){_0xd1f0cf['model']=_[_0x5024('0x47')](db[_0x5024('0x6d')][_0x5024('0x42')]);_0xd1f0cf[_0x5024('0x46')]=_[_0x5024('0x47')](_0x892790[_0x5024('0x46')]);_0xd1f0cf[_0x5024('0x48')]=_[_0x5024('0x49')](_0xd1f0cf[_0x5024('0x45')],_0xd1f0cf['query']);_0x173025[_0x5024('0x4b')]=_[_0x5024('0x49')](_0xd1f0cf[_0x5024('0x45')],qs[_0x5024('0x4a')](_0x892790[_0x5024('0x46')][_0x5024('0x4a')]));_0x173025[_0x5024('0x4b')]=_0x173025[_0x5024('0x4b')][_0x5024('0x5b')]?_0x173025[_0x5024('0x4b')]:_0xd1f0cf['model'];if(!_0x892790[_0x5024('0x46')][_0x5024('0x4c')](_0x5024('0x4d'))){_0x173025['limit']=qs[_0x5024('0x2f')](_0x892790[_0x5024('0x46')]['limit']);_0x173025[_0x5024('0x2e')]=qs['offset'](_0x892790[_0x5024('0x46')][_0x5024('0x2e')]);}_0x173025[_0x5024('0x4e')]=qs[_0x5024('0x4f')](_0x892790['query']['sort']);_0x173025[_0x5024('0x52')]=qs[_0x5024('0x48')](_[_0x5024('0x50')](_0x892790[_0x5024('0x46')],_0xd1f0cf[_0x5024('0x48')]));_0x173025[_0x5024('0x52')][_0x5024('0x65')]=_0x242efe['id'];if(_0x892790[_0x5024('0x46')]['filter']){_0x173025[_0x5024('0x52')]=_['merge'](_0x173025[_0x5024('0x52')],{'$or':_['map'](_0x173025['attributes'],function(_0x48b0fe){var _0x4098fb={};_0x4098fb[_0x48b0fe]={'$like':'%'+_0x892790[_0x5024('0x46')][_0x5024('0x51')]+'%'};return _0x4098fb;})});}_0x173025=_[_0x5024('0x53')]({},_0x173025,_0x892790[_0x5024('0x55')]);return db[_0x5024('0x6d')][_0x5024('0x30')]({'where':_0x173025['where']})[_0x5024('0x21')](function(_0xfc4d1b){_0x285d80[_0x5024('0x30')]=_0xfc4d1b;if(_0x892790[_0x5024('0x46')][_0x5024('0x68')]){_0x173025['include']=[{'all':!![]}];}return db[_0x5024('0x6d')][_0x5024('0x69')](_0x173025);})['then'](function(_0x3cd0b9){_0x285d80[_0x5024('0x58')]=_0x3cd0b9;return _0x285d80;});}})[_0x5024('0x21')](respondWithFilteredResult(_0x378cf9,_0x173025))[_0x5024('0x2b')](handleError(_0x378cf9,null));};exports[_0x5024('0x6f')]=function(_0x32cd44,_0x2fbc90,_0x22e150){return db[_0x5024('0x56')]['find']({'where':{'id':_0x32cd44[_0x5024('0x63')]['id']}})[_0x5024('0x21')](handleEntityNotFound(_0x2fbc90,null))[_0x5024('0x21')](function(_0x41d49e){if(_0x41d49e){return _0x41d49e[_0x5024('0x6f')](_0x32cd44[_0x5024('0x46')]['ids']);}})[_0x5024('0x21')](respondWithStatusCode(_0x2fbc90,null))[_0x5024('0x2b')](handleError(_0x2fbc90,null));};exports[_0x5024('0x70')]=function(_0x27b26a,_0x48ac0c,_0x5ba0f0){return db['WhatsappAccount'][_0x5024('0x5c')]({'where':{'id':_0x27b26a[_0x5024('0x63')]['id']}})[_0x5024('0x21')](handleEntityNotFound(_0x48ac0c,null))[_0x5024('0x21')](function(_0x2baef8){if(_0x2baef8){return _0x2baef8['addAgents'](_0x27b26a[_0x5024('0x62')][_0x5024('0x6b')],_[_0x5024('0x71')](_0x27b26a['body'],[_0x5024('0x6b'),'id'])||{})[_0x5024('0x72')](function(_0x4bf144){for(var _0x42a715=0x0;_0x42a715<_0x27b26a['body'][_0x5024('0x6b')][_0x5024('0x5b')];_0x42a715+=0x1){socket['emit'](_0x5024('0x73'),{'UserId':Number(_0x27b26a[_0x5024('0x62')][_0x5024('0x6b')][_0x42a715]),'WhatsappAccountId':Number(_0x27b26a['params']['id'])});}return _0x4bf144;});}})[_0x5024('0x21')](respondWithResult(_0x48ac0c,null))['catch'](handleError(_0x48ac0c,null));};exports['removeAgents']=function(_0x5bd00e,_0x2f15b9,_0x2e1377){return db[_0x5024('0x56')]['find']({'where':{'id':_0x5bd00e[_0x5024('0x63')]['id']}})[_0x5024('0x21')](handleEntityNotFound(_0x2f15b9,null))[_0x5024('0x21')](function(_0x5cb504){if(_0x5cb504){return _0x5cb504[_0x5024('0x74')](_0x5bd00e['query']['ids'])['then'](function(){if(_[_0x5024('0x75')](_0x5bd00e[_0x5024('0x46')][_0x5024('0x6b')])){for(var _0x128241=0x0;_0x128241<_0x5bd00e[_0x5024('0x46')][_0x5024('0x6b')][_0x5024('0x5b')];_0x128241+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x5bd00e[_0x5024('0x46')][_0x5024('0x6b')][_0x128241]),'WhatsappAccountId':Number(_0x5bd00e[_0x5024('0x63')]['id'])});}}else{socket[_0x5024('0x76')]('userWhatsappAccount:remove',{'UserId':Number(_0x5bd00e[_0x5024('0x46')][_0x5024('0x6b')]),'WhatsappAccountId':Number(_0x5bd00e[_0x5024('0x63')]['id'])});}});}})[_0x5024('0x21')](respondWithStatusCode(_0x2f15b9,null))['catch'](handleError(_0x2f15b9,null));};exports[_0x5024('0x77')]=function(_0x2d7c83,_0x56cc17,_0x338019){var _0x3f5a09={};var _0x4493d3={};var _0x186a37;var _0x3c3ec1;return db[_0x5024('0x56')][_0x5024('0x67')]({'where':{'id':_0x2d7c83[_0x5024('0x63')]['id']}})['then'](handleEntityNotFound(_0x56cc17,null))[_0x5024('0x21')](function(_0x196855){if(_0x196855){_0x186a37=_0x196855;_0x4493d3[_0x5024('0x45')]=_[_0x5024('0x47')](db['User']['rawAttributes']);_0x4493d3[_0x5024('0x46')]=_[_0x5024('0x47')](_0x2d7c83['query']);_0x4493d3[_0x5024('0x48')]=_[_0x5024('0x49')](_0x4493d3[_0x5024('0x45')],_0x4493d3[_0x5024('0x46')]);_0x3f5a09[_0x5024('0x4b')]=_['intersection'](_0x4493d3['model'],qs[_0x5024('0x4a')](_0x2d7c83[_0x5024('0x46')][_0x5024('0x4a')]));_0x3f5a09[_0x5024('0x4b')]=_0x3f5a09[_0x5024('0x4b')][_0x5024('0x5b')]?_0x3f5a09[_0x5024('0x4b')]:_0x4493d3['model'];_0x3f5a09[_0x5024('0x4e')]=qs[_0x5024('0x4f')](_0x2d7c83[_0x5024('0x46')][_0x5024('0x4f')]);_0x3f5a09[_0x5024('0x52')]=qs[_0x5024('0x48')](_[_0x5024('0x50')](_0x2d7c83['query'],_0x4493d3[_0x5024('0x48')]));if(_0x2d7c83['query'][_0x5024('0x51')]){_0x3f5a09[_0x5024('0x52')]=_[_0x5024('0x53')](_0x3f5a09[_0x5024('0x52')],{'$or':_[_0x5024('0x41')](_0x3f5a09[_0x5024('0x4b')],function(_0x19dbbc){var _0x5c7113={};_0x5c7113[_0x19dbbc]={'$like':'%'+_0x2d7c83[_0x5024('0x46')][_0x5024('0x51')]+'%'};return _0x5c7113;})});}_0x3f5a09=_[_0x5024('0x53')]({},_0x3f5a09,_0x2d7c83[_0x5024('0x55')]);return _0x186a37[_0x5024('0x77')](_0x3f5a09);}})[_0x5024('0x21')](function(_0x145cf0){if(_0x145cf0){_0x3c3ec1=_0x145cf0[_0x5024('0x5b')];if(!_0x2d7c83[_0x5024('0x46')]['hasOwnProperty']('nolimit')){_0x3f5a09[_0x5024('0x2f')]=qs[_0x5024('0x2f')](_0x2d7c83[_0x5024('0x46')][_0x5024('0x2f')]);_0x3f5a09['offset']=qs[_0x5024('0x2e')](_0x2d7c83[_0x5024('0x46')]['offset']);}return _0x186a37[_0x5024('0x77')](_0x3f5a09);}})[_0x5024('0x21')](function(_0x3be8fd){if(_0x3be8fd){return _0x3be8fd?{'count':_0x3c3ec1,'rows':_0x3be8fd}:null;}})[_0x5024('0x21')](respondWithResult(_0x56cc17,null))[_0x5024('0x2b')](handleError(_0x56cc17,null));};exports[_0x5024('0x78')]=function(_0x5081aa,_0x3f0e18){var _0x1e084e=_0x5081aa[_0x5024('0x63')]['id'];var _0xfd56e5=_0x5081aa['body'];var _0x17c834=0xc8;var _0x3b142c=null;return db['sequelize'][_0x5024('0x79')]({'isolationLevel':db[_0x5024('0x7a')]['Transaction'][_0x5024('0x7b')][_0x5024('0x7c')]},function(_0x3d8ef7){return db[_0x5024('0x56')][_0x5024('0x67')]({'where':{'id':_0x1e084e},'transaction':_0x3d8ef7})[_0x5024('0x21')](function(_0x5c8828){if(_0x5c8828){return db[_0x5024('0x7d')][_0x5024('0x37')]({'where':{'WhatsappAccountId':_0x1e084e},'transaction':_0x3d8ef7})['then'](function(){var _0x5c829f=_['map'](_0xfd56e5,function(_0x2ea24a){_0x2ea24a['WhatsappAccountId']=_0x1e084e;return _0x2ea24a;});return db[_0x5024('0x7d')][_0x5024('0x7e')](_0x5c829f,{'transaction':_0x3d8ef7});});}else{_0x17c834=0x194;_0x3b142c=[];}});})[_0x5024('0x21')](function(){if(_0x17c834!==0x194){return db[_0x5024('0x7d')][_0x5024('0x7f')]({'where':{'WhatsappAccountId':_0x1e084e},'order':_0x5024('0x80')})[_0x5024('0x21')](function(_0x5afee0){_0x3b142c=_0x5afee0;});}})['catch'](function(_0xc0581c){_0x17c834=0x1f4;logger[_0x5024('0x27')](_0xc0581c[_0x5024('0x3d')]);if(_0xc0581c['name']){delete _0xc0581c['name'];}_0x3b142c=_0xc0581c;})[_0x5024('0x81')](function(){if(_0x3b142c===null){_0x3f0e18[_0x5024('0x3c')](_0x17c834);}else{if(_0x17c834===0x1f4){_0x3f0e18[_0x5024('0x2c')](_0x17c834)[_0x5024('0x3f')](_0x3b142c);}else{_0x3f0e18[_0x5024('0x2c')](_0x17c834)[_0x5024('0x2d')](_0x3b142c);}}});};exports[_0x5024('0x82')]=function(_0x540237,_0x2b9e46,_0x27d564){var _0x3b3a21={};var _0x3042a8={};var _0x3d59b1;var _0xdcaf42;return db[_0x5024('0x56')][_0x5024('0x67')]({'where':{'id':_0x540237[_0x5024('0x63')]['id']}})['then'](handleEntityNotFound(_0x2b9e46,null))[_0x5024('0x21')](function(_0x161c21){if(_0x161c21){_0x3d59b1=_0x161c21;_0x3042a8[_0x5024('0x45')]=_[_0x5024('0x47')](db[_0x5024('0x7d')]['rawAttributes']);_0x3042a8[_0x5024('0x46')]=_[_0x5024('0x47')](_0x540237[_0x5024('0x46')]);_0x3042a8[_0x5024('0x48')]=_['intersection'](_0x3042a8[_0x5024('0x45')],_0x3042a8[_0x5024('0x46')]);_0x3b3a21[_0x5024('0x4b')]=_['intersection'](_0x3042a8['model'],qs[_0x5024('0x4a')](_0x540237['query']['fields']));_0x3b3a21[_0x5024('0x4b')]=_0x3b3a21[_0x5024('0x4b')][_0x5024('0x5b')]?_0x3b3a21['attributes']:_0x3042a8['model'];_0x3b3a21[_0x5024('0x4e')]=qs[_0x5024('0x4f')](_0x540237[_0x5024('0x46')][_0x5024('0x4f')]);_0x3b3a21['where']=qs[_0x5024('0x48')](_['pick'](_0x540237[_0x5024('0x46')],_0x3042a8['filters']));if(_0x540237[_0x5024('0x46')][_0x5024('0x51')]){_0x3b3a21[_0x5024('0x52')]=_[_0x5024('0x53')](_0x3b3a21['where'],{'$or':_['map'](_0x3b3a21[_0x5024('0x4b')],function(_0x513d32){var _0x5cba82={};_0x5cba82[_0x513d32]={'$like':'%'+_0x540237[_0x5024('0x46')]['filter']+'%'};return _0x5cba82;})});}_0x3b3a21=_[_0x5024('0x53')]({},_0x3b3a21,_0x540237[_0x5024('0x55')]);return _0x3d59b1['getApplications'](_0x3b3a21);}})['then'](function(_0x188d63){if(_0x188d63){_0xdcaf42=_0x188d63[_0x5024('0x5b')];if(!_0x540237[_0x5024('0x46')]['hasOwnProperty'](_0x5024('0x4d'))){_0x3b3a21['limit']=qs[_0x5024('0x2f')](_0x540237['query']['limit']);_0x3b3a21['offset']=qs[_0x5024('0x2e')](_0x540237[_0x5024('0x46')][_0x5024('0x2e')]);}return _0x3d59b1['getApplications'](_0x3b3a21);}})[_0x5024('0x21')](function(_0xe331a){if(_0xe331a){return _0xe331a?{'count':_0xdcaf42,'rows':_0xe331a}:null;}})[_0x5024('0x21')](respondWithResult(_0x2b9e46,null))[_0x5024('0x2b')](handleError(_0x2b9e46,null));};exports[_0x5024('0x83')]=function(_0x5f0adf,_0x1539c5,_0x56bdbc){var _0x1ae818={'channel':_0x5024('0x84')};var _0x5a4949=[];var _0x399588=[];var _0x2cfe47={};return db[_0x5024('0x56')][_0x5024('0x5c')]({'where':{'id':_0x5f0adf[_0x5024('0x63')]['id']},'include':[{'model':db[_0x5024('0x7d')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x1539c5,null))[_0x5024('0x21')](function(_0x5e03bc){_0x1ae818[_0x5024('0x85')]=_0x5e03bc;if(_0x1ae818['account']&&_0x1ae818[_0x5024('0x85')][_0x5024('0x44')]===_0x5024('0x86')&&_0x5f0adf[_0x5024('0x62')][_0x5024('0x87')]){if(_0x5f0adf[_0x5024('0x62')][_0x5024('0x87')][_0x5024('0x5b')]===0x0)return;if(_0x5f0adf[_0x5024('0x62')][_0x5024('0x87')][0x0][_0x5024('0x88')]!==_0x5024('0x89'))return;return db[_0x5024('0x8a')][_0x5024('0x36')]({'read':!![],'readAt':_0x5f0adf[_0x5024('0x62')]['statuses'][0x0][_0x5024('0x8b')]},{'where':{'messageId':_0x5f0adf[_0x5024('0x62')][_0x5024('0x87')][0x0][_0x5024('0x8c')]},'individualHooks':!![]})[_0x5024('0x21')](function(_0x201878){return _0x1539c5[_0x5024('0x2c')](0xc8)['json'](_0x201878);});}_0x1ae818[_0x5024('0x8d')]=_[_0x5024('0x8e')](_0x5e03bc[_0x5024('0x8f')],[_0x5024('0x80')],[_0x5024('0x90')]);if(_0x1ae818[_0x5024('0x85')]['Applications']){delete _0x1ae818[_0x5024('0x85')][_0x5024('0x8f')];}return db['CmContact'][_0x5024('0x64')]()[_0x5024('0x21')](function(_0xe651cb){if(!_0xe651cb){throw new db[(_0x5024('0x91'))][(_0x5024('0x92'))]('no\x20available\x20attributes');}_0x5a4949=_[_0x5024('0x93')](_[_0x5024('0x47')](_0xe651cb),[_0x5024('0x94'),_0x5024('0x95')]);_0x399588=_[_0x5024('0x93')](_[_0x5024('0x47')](_0xe651cb),[_0x5024('0x94'),_0x5024('0x95'),_0x5024('0x96'),_0x5024('0x97')]);_0x1ae818['body']={'mapKey':_0x5024('0x98')};if(_0x1ae818[_0x5024('0x85')]&&_0x1ae818[_0x5024('0x85')][_0x5024('0x44')]==='twilio'){_0x1ae818[_0x5024('0x62')][_0x5024('0x99')]=_0x5f0adf['body'][_0x5024('0x9a')][_0x5024('0x9b')]('whatsapp:','');_0x1ae818[_0x5024('0x62')][_0x5024('0x62')]=_0x5f0adf[_0x5024('0x62')][_0x5024('0x9c')];_0x1ae818[_0x5024('0x62')][_0x5024('0x9d')]=_0x5f0adf[_0x5024('0x62')][_0x5024('0x9e')];}if(_0x1ae818[_0x5024('0x85')]&&_0x1ae818[_0x5024('0x85')][_0x5024('0x44')]===_0x5024('0x86')){_0x1ae818[_0x5024('0x62')][_0x5024('0x99')]=_0x5f0adf[_0x5024('0x62')]['notifications'][0x0][_0x5024('0x99')];_0x1ae818[_0x5024('0x62')]['body']=_0x5f0adf[_0x5024('0x62')][_0x5024('0x9f')][0x0][_0x5024('0x29')]['body'];_0x1ae818['body']['messageId']=_0x5f0adf[_0x5024('0x62')][_0x5024('0x9f')][0x0]['message_id'];}if(_0x1ae818[_0x5024('0x62')]['id']){delete _0x1ae818[_0x5024('0x62')]['id'];}if(_['isNil'](_0x1ae818[_0x5024('0x62')][_0x5024('0x99')])){throw new db['Sequelize'][(_0x5024('0x92'))]('from\x20is\x20mandatory');}if(_[_0x5024('0xa0')](_0x1ae818[_0x5024('0x62')][_0x5024('0x62')])||_0x1ae818[_0x5024('0x62')][_0x5024('0x62')]===''){throw new db[(_0x5024('0x91'))]['ValidationError'](_0x5024('0xa1'));}if(_[_0x5024('0xa0')](_0x1ae818['body'][_0x5024('0xa2')])){throw new db[(_0x5024('0x91'))][(_0x5024('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x399588);}if(!_[_0x5024('0xa3')](_0x399588,_0x1ae818['body'][_0x5024('0xa2')])){throw new db[(_0x5024('0x91'))][(_0x5024('0x92'))](_0x5024('0xa4')+_0x399588);}_0x2cfe47[_0x1ae818['body']['mapKey']]=_0x1ae818['body']['from'];return db[_0x5024('0xa5')][_0x5024('0x5c')]({'where':{'id':_0x1ae818[_0x5024('0x85')]['ListId']},'include':[{'model':db[_0x5024('0xa6')],'as':_0x5024('0xa7'),'where':_0x2cfe47,'limit':0x1,'order':[[_0x5024('0x95'),'DESC']]}]});})[_0x5024('0x21')](handleEntityNotFound(_0x1539c5,null))[_0x5024('0x21')](function(_0x427d58){if(_0x427d58){_0x1ae818[_0x5024('0xa8')]=_[_0x5024('0x71')](_0x427d58,[_0x5024('0xa7')]);if(_0x427d58[_0x5024('0xa7')][_0x5024('0x5b')]){return _0x427d58['Contacts'][0x0];}var _0x1f041d=_[_0x5024('0x1b')](_0x1ae818[_0x5024('0x62')],{'firstName':_0x1ae818[_0x5024('0x62')][_0x5024('0x99')],'ListId':_0x427d58['id']});_0x1f041d[_0x1ae818[_0x5024('0x62')]['mapKey']]=_0x1ae818[_0x5024('0x62')][_0x5024('0x99')];return db['CmContact'][_0x5024('0x5d')](_0x1f041d,{'fields':_0x5a4949,'raw':!![]});}})['then'](handleEntityNotFound(_0x1539c5,null))[_0x5024('0x21')](function(_0x377372){if(_0x377372){_0x1ae818['contact']=_0x377372;var _0x3599fd={'ContactId':_0x377372['id'],'phone':_0x1ae818[_0x5024('0x62')][_0x5024('0x99')],'WhatsappAccountId':_0x5f0adf[_0x5024('0x63')]['id']};var _0xc00739={'ContactId':_0x377372['id'],'WhatsappAccountId':_0x5f0adf[_0x5024('0x63')]['id'],'closed':![]};return db[_0x5024('0xa9')][_0x5024('0x5c')]({'where':_0xc00739})[_0x5024('0x21')](function(_0x248602){if(_0x248602){return[_0x248602,![]];}return db['WhatsappInteraction']['create'](_0x3599fd)[_0x5024('0x21')](function(_0x21e42a){return[_0x21e42a,!![]];});});}})[_0x5024('0x72')](function(_0x2840a3,_0x3be461){_0x1ae818[_0x5024('0xaa')]=_0x2840a3[_0x5024('0x38')]({'plain':!![]});_0x1ae818[_0x5024('0xaa')]['created']=![];if(_0x3be461){if(_0x1ae818[_0x5024('0x85')]['autoclose']){_0x1ae818[_0x5024('0x8d')]['push']({'id':0x0,'priority':_0x1ae818[_0x5024('0x8d')][_0x5024('0x5b')]+0x1,'app':_0x5024('0xab'),'appdata':_0x5024('0xac'),'interval':_0x5024('0xad')});}_0x1ae818[_0x5024('0xaa')][_0x5024('0xae')]=!![];}return db['WhatsappMessage'][_0x5024('0x5d')]({'phone':_0x1ae818[_0x5024('0x62')][_0x5024('0x99')],'messageId':_0x1ae818['body'][_0x5024('0x9d')],'body':_0x1ae818[_0x5024('0x62')][_0x5024('0x62')],'WhatsappAccountId':_0x5f0adf[_0x5024('0x63')]['id'],'WhatsappInteractionId':_0x2840a3['id'],'direction':'in','ContactId':_0x2840a3[_0x5024('0xaf')],'AttachmentId':_0x1ae818[_0x5024('0x62')]['AttachmentId']});})[_0x5024('0x21')](function(_0x1e6813){_0x1ae818[_0x5024('0x29')]=_0x1e6813;if(_0x1ae818[_0x5024('0xaa')][_0x5024('0xb0')]){return db[_0x5024('0xb1')][_0x5024('0x5c')]({'attributes':['id',_0x5024('0x3e')],'where':{'id':_0x1ae818[_0x5024('0xaa')][_0x5024('0xb0')]}})['then'](function(_0x5d58ca){if(_0x5d58ca){_0x1ae818[_0x5024('0x8d')][_0x5024('0xb2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5d58ca[_0x5024('0x3e')]+','+(_0x1ae818[_0x5024('0x85')][_0x5024('0xb3')]||0xa),'interval':_0x5024('0xad')});}return respondWithRpcPromise('Start','startRouting',_0x1ae818);});}return respondWithRpcPromise('Start','startRouting',_0x1ae818);})[_0x5024('0x21')](function(_0x18fb84){if(_0x18fb84){var _0x25c078=0xc8;var _0x97aace=_0x5024('0xb4');logger[_0x5024('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x97aace,_0x25c078,'entity\x20found');logger['debug'](_0x5024('0xb5'),_0x97aace,_0x25c078,_0x5024('0xb6'),JSON['stringify'](_0x18fb84));if(_0x1ae818[_0x5024('0x85')]['type']==='twilio'){return _0x1539c5[_0x5024('0x2c')](_0x25c078)[_0x5024('0x31')](_0x5024('0xb7'),_0x5024('0xb8'))[_0x5024('0x3f')](_0x5024('0xb9'));}else{return _0x1539c5[_0x5024('0x2c')](_0x25c078)[_0x5024('0x2d')](_0x18fb84);}}});})[_0x5024('0x2b')](handleError(_0x1539c5,null));};exports[_0x5024('0x3f')]=function(_0x580e16,_0x274e59,_0x38b842){var _0x2d9f19,_0x3c1dd1,_0x3c690e;if(_[_0x5024('0xa0')](_0x580e16[_0x5024('0x62')][_0x5024('0x62')])||_0x580e16['body'][_0x5024('0x62')]===''){throw new db[(_0x5024('0x91'))][(_0x5024('0x92'))](_0x5024('0xa1'));}if(_[_0x5024('0xa0')](_0x580e16['body']['to'])){throw new db[(_0x5024('0x91'))][(_0x5024('0x92'))]('to\x20is\x20mandatory');}_0x2d9f19=_0x580e16[_0x5024('0x62')]['to'];return db[_0x5024('0x56')]['find']({'where':{'id':_0x580e16['params']['id']},'include':[{'model':db[_0x5024('0xa5')],'as':_0x5024('0xba'),'include':[{'model':db[_0x5024('0xa6')],'as':_0x5024('0xa7'),'where':{'mobile':_0x2d9f19},'limit':0x1,'order':[['updatedAt',_0x5024('0xbb')]]}]}]})[_0x5024('0x21')](handleEntityNotFound(_0x274e59,null))[_0x5024('0x21')](function(_0x1f113f){if(_0x1f113f&&_0x1f113f[_0x5024('0xba')]){_0x3c1dd1=_0x1f113f[_0x5024('0x38')]({'plain':!![]});if(_0x3c1dd1[_0x5024('0xba')]&&_0x3c1dd1[_0x5024('0xba')]['Contacts'][_0x5024('0x5b')]){return _0x3c1dd1[_0x5024('0xba')]['Contacts'][0x0];}return db[_0x5024('0xa6')][_0x5024('0x5d')](_['defaults'](_0x580e16['body'],{'firstName':_0x2d9f19,'mobile':_0x2d9f19,'phone':_0x2d9f19,'ListId':_0x3c1dd1['ListId']}));}})['then'](handleEntityNotFound(_0x274e59,null))['then'](function(_0x2c8497){if(_0x2c8497){_0x3c690e=_0x2c8497;return db[_0x5024('0xa9')][_0x5024('0x5c')]({'where':{'ContactId':_0x3c690e['id'],'closed':![],'WhatsappAccountId':_0x3c1dd1['id']}})[_0x5024('0x21')](function(_0x26929c){if(_0x26929c){return[_0x26929c,![]];}return db['WhatsappInteraction'][_0x5024('0x5d')]({'UserId':_0x580e16[_0x5024('0x5e')]['id'],'ContactId':_0x3c690e['id'],'WhatsappAccountId':_0x3c1dd1['id'],'phone':_0x2d9f19,'firstMsgDirection':'out','Messages':[_[_0x5024('0x53')](_0x580e16[_0x5024('0x62')],{'read':![],'body':_0x580e16['body'][_0x5024('0x62')],'phone':_0x2d9f19,'WhatsappAccountId':_0x3c1dd1['id'],'UserId':_0x580e16[_0x5024('0x5e')]['id'],'ContactId':_0x3c690e['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x5024('0xbc')}]})[_0x5024('0x21')](function(_0x22d172){return[_0x22d172,!![]];});});}})[_0x5024('0x72')](function(_0x24ba4b,_0x3357e2){if(_0x3357e2){return _0x24ba4b;}return db[_0x5024('0x8a')][_0x5024('0x5d')](_[_0x5024('0x53')](_0x580e16[_0x5024('0x62')],{'read':![],'body':_0x580e16[_0x5024('0x62')][_0x5024('0x62')],'phone':_0x2d9f19,'WhatsappAccountId':_0x3c1dd1['id'],'WhatsappInteractionId':_0x24ba4b['id'],'UserId':_0x580e16[_0x5024('0x5e')]['id'],'ContactId':_0x3c690e['id']}))[_0x5024('0x21')](function(_0x59b7cf){_0x24ba4b[_0x5024('0xbd')][_0x5024('0xbc')]=[];_0x24ba4b['dataValues']['Messages'][_0x5024('0xbe')](_0x59b7cf[_0x5024('0xbd')]);return _0x24ba4b;});})[_0x5024('0x21')](respondWithResult(_0x274e59,null))[_0x5024('0x2b')](handleError(_0x274e59,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3aba130..5497edc 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 _0x693a=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappAccount'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x693a,0x75));var _0xa693=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x693a[_0x44d9ab];return _0x31485e;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xa693('0x0'))['db'][_0xa693('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa693('0x2'),'afterDestroy':_0xa693('0x3')};function emitEvent(_0x2d5f24){return function(_0x47f43b,_0x4fa51e,_0x3370d7){WhatsappAccountEvents[_0xa693('0x4')](_0x2d5f24+':'+_0x47f43b['id'],_0x47f43b);WhatsappAccountEvents['emit'](_0x2d5f24,_0x47f43b);_0x3370d7(null);};}for(var e in events){if(events[_0xa693('0x5')](e)){var event=events[e];WhatsappAccount[_0xa693('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xf12f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','WhatsappAccount'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0xf12f,0x18a));var _0xff12=function(_0x54ed3a,_0x1e1e50){_0x54ed3a=_0x54ed3a-0x0;var _0x459862=_0xf12f[_0x54ed3a];return _0x459862;};'use strict';var EventEmitter=require(_0xff12('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xff12('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xff12('0x2')](0x0);var events={'afterCreate':_0xff12('0x3'),'afterUpdate':_0xff12('0x4'),'afterDestroy':_0xff12('0x5')};function emitEvent(_0x4ff39a){return function(_0x2cb9fb,_0x25724d,_0x155c1e){WhatsappAccountEvents[_0xff12('0x6')](_0x4ff39a+':'+_0x2cb9fb['id'],_0x2cb9fb);WhatsappAccountEvents[_0xff12('0x6')](_0x4ff39a,_0x2cb9fb);_0x155c1e(null);};}for(var e in events){if(events[_0xff12('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xff12('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 2d3a3ce..dce2462 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 _0xd404=['WhatsappAccount','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x552bd5,_0x3fe02a){var _0x32b19a=function(_0x49cfc0){while(--_0x49cfc0){_0x552bd5['push'](_0x552bd5['shift']());}};_0x32b19a(++_0x3fe02a);}(_0xd404,0x11f));var _0x4d40=function(_0x2524ef,_0x307a13){_0x2524ef=_0x2524ef-0x0;var _0x517910=_0xd404[_0x2524ef];return _0x517910;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require(_0x4d40('0x2'))(_0x4d40('0x3'));var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var rp=require(_0x4d40('0x5'));var fs=require('fs');var path=require(_0x4d40('0x6'));var rimraf=require('rimraf');var config=require(_0x4d40('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0x4d40('0x8')]=function(_0x4d4eae,_0x81b56b){return _0x4d4eae[_0x4d40('0x9')](_0x4d40('0xa'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7213=['util','../../config/logger','api','moment','bluebird','path','rimraf','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x5f4c65,_0x19d6d7){var _0x3def7b=function(_0x337284){while(--_0x337284){_0x5f4c65['push'](_0x5f4c65['shift']());}};_0x3def7b(++_0x19d6d7);}(_0x7213,0x16a));var _0x3721=function(_0x291ca9,_0x32e7fd){_0x291ca9=_0x291ca9-0x0;var _0x5252ce=_0x7213[_0x291ca9];return _0x5252ce;};'use strict';var _=require(_0x3721('0x0'));var util=require(_0x3721('0x1'));var logger=require(_0x3721('0x2'))(_0x3721('0x3'));var moment=require(_0x3721('0x4'));var BPromise=require(_0x3721('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3721('0x6'));var rimraf=require(_0x3721('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x87a36e,_0x3392e6){return _0x87a36e[_0x3721('0x8')](_0x3721('0x9'),attributes,{'tableName':_0x3721('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 d34b670..3c88ce7 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 _0x2000=['redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','map','model','include','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x35d5d5,_0x4a4775){var _0x58df05=function(_0x54b700){while(--_0x54b700){_0x35d5d5['push'](_0x35d5d5['shift']());}};_0x58df05(++_0x4a4775);}(_0x2000,0x68));var _0x0200=function(_0xaba441,_0x45dcf4){_0xaba441=_0xaba441-0x0;var _0x4a96dc=_0x2000[_0xaba441];return _0x4a96dc;};'use strict';var _=require(_0x0200('0x0'));var util=require(_0x0200('0x1'));var moment=require(_0x0200('0x2'));var BPromise=require(_0x0200('0x3'));var rs=require(_0x0200('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0200('0x5'))['db'];var utils=require(_0x0200('0x6'));var logger=require(_0x0200('0x7'))('rpc');var config=require(_0x0200('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0200('0x9')]({'port':0x232a});config[_0x0200('0xa')]=_[_0x0200('0xb')](config[_0x0200('0xa')],{'host':_0x0200('0xc'),'port':0x18eb});var socket=require(_0x0200('0xd'))(new Redis(config['redis']));require(_0x0200('0xe'))[_0x0200('0xf')](socket);function respondWithRpcPromise(_0x4e7f7f,_0x50bfc4,_0x1fae2d){return new BPromise(function(_0x13690e,_0x2f0f8a){return client[_0x0200('0x10')](_0x4e7f7f,_0x1fae2d)[_0x0200('0x11')](function(_0x10ac9c){logger[_0x0200('0x12')](_0x0200('0x13'),_0x50bfc4,_0x0200('0x14'));logger[_0x0200('0x15')](_0x0200('0x16'),_0x50bfc4,_0x0200('0x14'),JSON[_0x0200('0x17')](_0x10ac9c));if(_0x10ac9c['error']){if(_0x10ac9c['error'][_0x0200('0x18')]===0x1f4){logger['error'](_0x0200('0x13'),_0x50bfc4,_0x10ac9c[_0x0200('0x19')][_0x0200('0x1a')]);return _0x2f0f8a(_0x10ac9c[_0x0200('0x19')][_0x0200('0x1a')]);}logger[_0x0200('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x50bfc4,_0x10ac9c[_0x0200('0x19')][_0x0200('0x1a')]);return _0x13690e(_0x10ac9c[_0x0200('0x19')][_0x0200('0x1a')]);}else{logger[_0x0200('0x12')](_0x0200('0x13'),_0x50bfc4,_0x0200('0x14'));_0x13690e(_0x10ac9c[_0x0200('0x1b')][_0x0200('0x1a')]);}})[_0x0200('0x1c')](function(_0x3185ca){logger['error'](_0x0200('0x13'),_0x50bfc4,_0x3185ca);_0x2f0f8a(_0x3185ca);});});}exports[_0x0200('0x1d')]=function(_0x2c19d1){var _0x454b67=this;return new Promise(function(_0x2a60c6,_0x2910a2){return db[_0x0200('0x1e')]['find']({'raw':_0x2c19d1[_0x0200('0x1f')]?_0x2c19d1[_0x0200('0x1f')][_0x0200('0x20')]===undefined?!![]:![]:!![],'where':_0x2c19d1[_0x0200('0x1f')]?_0x2c19d1['options'][_0x0200('0x21')]||null:null,'attributes':_0x2c19d1[_0x0200('0x1f')]?_0x2c19d1['options'][_0x0200('0x22')]||null:null,'include':_0x2c19d1[_0x0200('0x1f')]?_0x2c19d1[_0x0200('0x1f')]['include']?_[_0x0200('0x23')](_0x2c19d1[_0x0200('0x1f')]['include'],function(_0x12176a){return{'model':db[_0x12176a[_0x0200('0x24')]],'as':_0x12176a['as'],'attributes':_0x12176a[_0x0200('0x22')],'include':_0x12176a['include']?_[_0x0200('0x23')](_0x12176a['include'],function(_0x4e5987){return{'model':db[_0x4e5987[_0x0200('0x24')]],'as':_0x4e5987['as'],'attributes':_0x4e5987[_0x0200('0x22')],'include':_0x4e5987[_0x0200('0x25')]?_[_0x0200('0x23')](_0x4e5987[_0x0200('0x25')],function(_0x580ca3){return{'model':db[_0x580ca3[_0x0200('0x24')]],'as':_0x580ca3['as'],'attributes':_0x580ca3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0200('0x11')](function(_0x2ab6a7){logger[_0x0200('0x12')]('ShowWhatsappAccount',_0x2c19d1);logger[_0x0200('0x15')](_0x0200('0x1d'),_0x2c19d1,JSON[_0x0200('0x17')](_0x2ab6a7));_0x2a60c6(_0x2ab6a7);})['catch'](function(_0x303a38){logger[_0x0200('0x19')](_0x0200('0x1d'),_0x303a38[_0x0200('0x1a')],_0x2c19d1);_0x2910a2(_0x454b67['error'](0x1f4,_0x303a38[_0x0200('0x1a')]));});});}; \ No newline at end of file +var _0xa88f=['result','WhatsappAccount','options','raw','where','include','attributes','map','model','then','ShowWhatsappAccount','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5b4fc4,_0x16f134){var _0x51ae81=function(_0x594889){while(--_0x594889){_0x5b4fc4['push'](_0x5b4fc4['shift']());}};_0x51ae81(++_0x16f134);}(_0xa88f,0x182));var _0xfa88=function(_0x581ef4,_0x5713a1){_0x581ef4=_0x581ef4-0x0;var _0xbfc7ff=_0xa88f[_0x581ef4];return _0xbfc7ff;};'use strict';var _=require(_0xfa88('0x0'));var util=require(_0xfa88('0x1'));var moment=require(_0xfa88('0x2'));var BPromise=require(_0xfa88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa88('0x4'))['db'];var utils=require(_0xfa88('0x5'));var logger=require('../../config/logger')(_0xfa88('0x6'));var config=require(_0xfa88('0x7'));var jayson=require(_0xfa88('0x8'));var client=jayson[_0xfa88('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xfa88('0xa')],{'host':_0xfa88('0xb'),'port':0x18eb});var socket=require(_0xfa88('0xc'))(new Redis(config[_0xfa88('0xa')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3827c6,_0x4037e3,_0xe7b01f){return new BPromise(function(_0x4b375c,_0x1d8487){return client[_0xfa88('0xd')](_0x3827c6,_0xe7b01f)['then'](function(_0x2432cd){logger[_0xfa88('0xe')](_0xfa88('0xf'),_0x4037e3,_0xfa88('0x10'));logger[_0xfa88('0x11')](_0xfa88('0x12'),_0x4037e3,'request\x20sent',JSON[_0xfa88('0x13')](_0x2432cd));if(_0x2432cd['error']){if(_0x2432cd[_0xfa88('0x14')]['code']===0x1f4){logger[_0xfa88('0x14')](_0xfa88('0xf'),_0x4037e3,_0x2432cd['error'][_0xfa88('0x15')]);return _0x1d8487(_0x2432cd[_0xfa88('0x14')]['message']);}logger[_0xfa88('0x14')](_0xfa88('0xf'),_0x4037e3,_0x2432cd[_0xfa88('0x14')][_0xfa88('0x15')]);return _0x4b375c(_0x2432cd['error'][_0xfa88('0x15')]);}else{logger[_0xfa88('0xe')](_0xfa88('0xf'),_0x4037e3,_0xfa88('0x10'));_0x4b375c(_0x2432cd[_0xfa88('0x16')][_0xfa88('0x15')]);}})['catch'](function(_0x336fa4){logger[_0xfa88('0x14')](_0xfa88('0xf'),_0x4037e3,_0x336fa4);_0x1d8487(_0x336fa4);});});}exports['ShowWhatsappAccount']=function(_0x182246){var _0x46cd8c=this;return new Promise(function(_0x5a225e,_0x1e6897){return db[_0xfa88('0x17')]['find']({'raw':_0x182246[_0xfa88('0x18')]?_0x182246[_0xfa88('0x18')][_0xfa88('0x19')]===undefined?!![]:![]:!![],'where':_0x182246['options']?_0x182246['options'][_0xfa88('0x1a')]||null:null,'attributes':_0x182246[_0xfa88('0x18')]?_0x182246[_0xfa88('0x18')]['attributes']||null:null,'include':_0x182246[_0xfa88('0x18')]?_0x182246[_0xfa88('0x18')]['include']?_['map'](_0x182246['options'][_0xfa88('0x1b')],function(_0x4f0d16){return{'model':db[_0x4f0d16['model']],'as':_0x4f0d16['as'],'attributes':_0x4f0d16[_0xfa88('0x1c')],'include':_0x4f0d16[_0xfa88('0x1b')]?_['map'](_0x4f0d16[_0xfa88('0x1b')],function(_0x14eb41){return{'model':db[_0x14eb41['model']],'as':_0x14eb41['as'],'attributes':_0x14eb41[_0xfa88('0x1c')],'include':_0x14eb41[_0xfa88('0x1b')]?_[_0xfa88('0x1d')](_0x14eb41['include'],function(_0x25023f){return{'model':db[_0x25023f[_0xfa88('0x1e')]],'as':_0x25023f['as'],'attributes':_0x25023f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa88('0x1f')](function(_0x90ef74){logger[_0xfa88('0xe')]('ShowWhatsappAccount',_0x182246);logger[_0xfa88('0x11')](_0xfa88('0x20'),_0x182246,JSON[_0xfa88('0x13')](_0x90ef74));_0x5a225e(_0x90ef74);})[_0xfa88('0x21')](function(_0x45e65f){logger[_0xfa88('0x14')](_0xfa88('0x20'),_0x45e65f[_0xfa88('0x15')],_0x182246);_0x1e6897(_0x46cd8c[_0xfa88('0x14')](0x1f4,_0x45e65f[_0xfa88('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b7e153f..6dc90d7 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 _0xe12b=['remove','update','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x5c8108,_0x3bdf2b){var _0x31d609=function(_0x1e82b2){while(--_0x1e82b2){_0x5c8108['push'](_0x5c8108['shift']());}};_0x31d609(++_0x3bdf2b);}(_0xe12b,0xfb));var _0xbe12=function(_0x54cbab,_0x4b04ea){_0x54cbab=_0x54cbab-0x0;var _0x1df487=_0xe12b[_0x54cbab];return _0x1df487;};'use strict';var WhatsappAccountEvents=require(_0xbe12('0x0'));var events=['save',_0xbe12('0x1'),_0xbe12('0x2')];function createListener(_0x353476,_0x196b17){return function(_0x47ed54){_0x196b17['emit'](_0x353476,_0x47ed54);};}function removeListener(_0x40f159,_0x16ad44){return function(){WhatsappAccountEvents[_0xbe12('0x3')](_0x40f159,_0x16ad44);};}exports['register']=function(_0x3a07a6){for(var _0x5e9163=0x0,_0x5be8e8=events[_0xbe12('0x4')];_0x5e9163<_0x5be8e8;_0x5e9163++){var _0x52ff2b=events[_0x5e9163];var _0x16430f=createListener(_0xbe12('0x5')+_0x52ff2b,_0x3a07a6);WhatsappAccountEvents['on'](_0x52ff2b,_0x16430f);}}; \ No newline at end of file +var _0xa428=['emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x40f66d,_0x17cd27){var _0x435f0e=function(_0x1d9e9d){while(--_0x1d9e9d){_0x40f66d['push'](_0x40f66d['shift']());}};_0x435f0e(++_0x17cd27);}(_0xa428,0x74));var _0x8a42=function(_0x4add5e,_0x486f3f){_0x4add5e=_0x4add5e-0x0;var _0x2a4bcb=_0xa428[_0x4add5e];return _0x2a4bcb;};'use strict';var WhatsappAccountEvents=require(_0x8a42('0x0'));var events=[_0x8a42('0x1'),_0x8a42('0x2'),_0x8a42('0x3')];function createListener(_0x3409e9,_0x1de1f5){return function(_0x4a5cdd){_0x1de1f5[_0x8a42('0x4')](_0x3409e9,_0x4a5cdd);};}function removeListener(_0x2f170e,_0x303013){return function(){WhatsappAccountEvents[_0x8a42('0x5')](_0x2f170e,_0x303013);};}exports['register']=function(_0x125382){for(var _0x3d058a=0x0,_0xdab15d=events[_0x8a42('0x6')];_0x3d058a<_0xdab15d;_0x3d058a++){var _0x1a6b0a=events[_0x3d058a];var _0x2ad15d=createListener(_0x8a42('0x7')+_0x1a6b0a,_0x125382);WhatsappAccountEvents['on'](_0x1a6b0a,_0x2ad15d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 79ff202..79088c6 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 _0xa3b3=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1513af,_0x2251b0){var _0x176187=function(_0x5c2de7){while(--_0x5c2de7){_0x1513af['push'](_0x1513af['shift']());}};_0x176187(++_0x2251b0);}(_0xa3b3,0x175));var _0x3a3b=function(_0x2fc3fb,_0xfd777b){_0x2fc3fb=_0x2fc3fb-0x0;var _0x502f26=_0xa3b3[_0x2fc3fb];return _0x502f26;};'use strict';var multer=require(_0x3a3b('0x0'));var util=require(_0x3a3b('0x1'));var path=require(_0x3a3b('0x2'));var timeout=require(_0x3a3b('0x3'));var express=require(_0x3a3b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3a3b('0x5'));var interaction=require(_0x3a3b('0x6'));var config=require(_0x3a3b('0x7'));var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3a3b('0x8')]);router[_0x3a3b('0x9')](_0x3a3b('0xa'),auth[_0x3a3b('0xb')](),controller['show']);router[_0x3a3b('0xc')]('/',auth[_0x3a3b('0xb')](),controller[_0x3a3b('0xd')]);router[_0x3a3b('0xe')](_0x3a3b('0xa'),auth[_0x3a3b('0xb')](),controller['update']);router[_0x3a3b('0xf')](_0x3a3b('0xa'),auth['isAuthenticated'](),controller[_0x3a3b('0x10')]);module[_0x3a3b('0x11')]=router; \ No newline at end of file +var _0x72cb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x14628f,_0x4708b4){var _0x373467=function(_0x287125){while(--_0x287125){_0x14628f['push'](_0x14628f['shift']());}};_0x373467(++_0x4708b4);}(_0x72cb,0xc4));var _0xb72c=function(_0xcf5536,_0x4518f0){_0xcf5536=_0xcf5536-0x0;var _0x3dc63e=_0x72cb[_0xcf5536];return _0x3dc63e;};'use strict';var multer=require('multer');var util=require(_0xb72c('0x0'));var path=require(_0xb72c('0x1'));var timeout=require(_0xb72c('0x2'));var express=require(_0xb72c('0x3'));var router=express[_0xb72c('0x4')]();var fs_extra=require(_0xb72c('0x5'));var auth=require(_0xb72c('0x6'));var interaction=require(_0xb72c('0x7'));var config=require(_0xb72c('0x8'));var controller=require(_0xb72c('0x9'));router[_0xb72c('0xa')]('/',auth[_0xb72c('0xb')](),controller[_0xb72c('0xc')]);router[_0xb72c('0xa')](_0xb72c('0xd'),auth[_0xb72c('0xb')](),controller[_0xb72c('0xe')]);router[_0xb72c('0xf')]('/',auth[_0xb72c('0xb')](),controller['create']);router[_0xb72c('0x10')](_0xb72c('0xd'),auth[_0xb72c('0xb')](),controller[_0xb72c('0x11')]);router['delete'](_0xb72c('0xd'),auth[_0xb72c('0xb')](),controller[_0xb72c('0x12')]);module[_0xb72c('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7701b83..4d0cf95 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 _0x4bfb=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x4bfb,0xcc));var _0xb4bf=function(_0x13be43,_0x1261e8){_0x13be43=_0x13be43-0x0;var _0x2b5d2f=_0x4bfb[_0x13be43];return _0x2b5d2f;};'use strict';var Sequelize=require(_0xb4bf('0x0'));module[_0xb4bf('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb4bf('0x2')],'allowNull':![],'defaultValue':_0xb4bf('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb4bf('0x2')]},'interval':{'type':Sequelize[_0xb4bf('0x2')],'defaultValue':_0xb4bf('0x4')}}; \ No newline at end of file +var _0xe212=['STRING','sequelize','exports','INTEGER','noop'];(function(_0x3e0ca7,_0x42b5b2){var _0x4398c9=function(_0x11088d){while(--_0x11088d){_0x3e0ca7['push'](_0x3e0ca7['shift']());}};_0x4398c9(++_0x42b5b2);}(_0xe212,0xb0));var _0x2e21=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xe212[_0x5627e1];return _0x2f013f;};'use strict';var Sequelize=require(_0x2e21('0x0'));module[_0x2e21('0x1')]={'priority':{'type':Sequelize[_0x2e21('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2e21('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2e21('0x4')]},'interval':{'type':Sequelize[_0x2e21('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index c6898d0..5c2f81a 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 _0xa809=['to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','WhatsappApplication','findAll','rows','catch','show','keys','options','find','create','body','params','rimraf','request-promise','util','path','sox'];(function(_0x3522f2,_0x26c7f6){var _0x2ec865=function(_0x177086){while(--_0x177086){_0x3522f2['push'](_0x3522f2['shift']());}};_0x2ec865(++_0x26c7f6);}(_0xa809,0x1f3));var _0x9a80=function(_0x518f34,_0x18b5c3){_0x518f34=_0x518f34-0x0;var _0x5c046f=_0xa809[_0x518f34];return _0x5c046f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a80('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a80('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9a80('0x2'));var path=require(_0x9a80('0x3'));var sox=require(_0x9a80('0x4'));var csv=require(_0x9a80('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a80('0x6'));var _=require('lodash');var squel=require(_0x9a80('0x7'));var crypto=require(_0x9a80('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x9a80('0x9'));var toCsv=require(_0x9a80('0x5'));var querystring=require(_0x9a80('0xa'));var Papa=require(_0x9a80('0xb'));var Redis=require('ioredis');var authService=require(_0x9a80('0xc'));var qs=require(_0x9a80('0xd'));var as=require(_0x9a80('0xe'));var hardwareService=require(_0x9a80('0xf'));var logger=require(_0x9a80('0x10'))(_0x9a80('0x11'));var utils=require(_0x9a80('0x12'));var config=require(_0x9a80('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a80('0x14'))['db'];function respondWithStatusCode(_0x4dc0a5,_0x123cbd){_0x123cbd=_0x123cbd||0xcc;return function(_0x33170d){if(_0x33170d){return _0x4dc0a5[_0x9a80('0x15')](_0x123cbd);}return _0x4dc0a5[_0x9a80('0x16')](_0x123cbd)[_0x9a80('0x17')]();};}function respondWithResult(_0x20a68a,_0x5a6187){_0x5a6187=_0x5a6187||0xc8;return function(_0x16c1b5){if(_0x16c1b5){return _0x20a68a['status'](_0x5a6187)[_0x9a80('0x18')](_0x16c1b5);}};}function respondWithFilteredResult(_0x109066,_0x3625b0){return function(_0x5181b5){if(_0x5181b5){var _0x3f393c=typeof _0x3625b0[_0x9a80('0x19')]===_0x9a80('0x1a')&&typeof _0x3625b0[_0x9a80('0x1b')]===_0x9a80('0x1a');var _0x5a6efc=_0x5181b5[_0x9a80('0x1c')];var _0x4bfb77=_0x3f393c?0x0:_0x3625b0[_0x9a80('0x19')];var _0x281ca5=_0x3f393c?_0x5181b5[_0x9a80('0x1c')]:_0x3625b0[_0x9a80('0x19')]+_0x3625b0['limit'];var _0x47cfe4;if(_0x281ca5>=_0x5a6efc){_0x281ca5=_0x5a6efc;_0x47cfe4=0xc8;}else{_0x47cfe4=0xce;}_0x109066[_0x9a80('0x16')](_0x47cfe4);return _0x109066[_0x9a80('0x1d')](_0x9a80('0x1e'),_0x4bfb77+'-'+_0x281ca5+'/'+_0x5a6efc)[_0x9a80('0x18')](_0x5181b5);}return null;};}function patchUpdates(_0x42e054){return function(_0x5a244c){try{jsonpatch[_0x9a80('0x1f')](_0x5a244c,_0x42e054,!![]);}catch(_0x252fd6){return BPromise[_0x9a80('0x20')](_0x252fd6);}return _0x5a244c['save']();};}function saveUpdates(_0x55ce38,_0x28d895){return function(_0x5cc1b1){if(_0x5cc1b1){return _0x5cc1b1[_0x9a80('0x21')](_0x55ce38)['then'](function(_0x125731){return _0x125731;});}return null;};}function removeEntity(_0x5e164f,_0x2601c7){return function(_0x435b4b){if(_0x435b4b){return _0x435b4b[_0x9a80('0x22')]()[_0x9a80('0x23')](function(){_0x5e164f[_0x9a80('0x16')](0xcc)[_0x9a80('0x17')]();});}};}function handleEntityNotFound(_0x4546e6,_0x1ac84d){return function(_0x52ae41){if(!_0x52ae41){_0x4546e6[_0x9a80('0x15')](0x194);}return _0x52ae41;};}function handleError(_0x39b2a5,_0x5b7f91){_0x5b7f91=_0x5b7f91||0x1f4;return function(_0x3508d7){logger[_0x9a80('0x24')](_0x3508d7['stack']);if(_0x3508d7[_0x9a80('0x25')]){delete _0x3508d7[_0x9a80('0x25')];}_0x39b2a5[_0x9a80('0x16')](_0x5b7f91)[_0x9a80('0x26')](_0x3508d7);};}exports[_0x9a80('0x27')]=function(_0x341ae5,_0x5a86d1){var _0x15a185={},_0x40db09={},_0x2f8904={'count':0x0,'rows':[]};var _0x41c043=_[_0x9a80('0x28')](db['WhatsappApplication'][_0x9a80('0x29')],function(_0x364f32){return{'name':_0x364f32[_0x9a80('0x2a')],'type':_0x364f32[_0x9a80('0x2b')]['key']};});_0x40db09[_0x9a80('0x2c')]=_[_0x9a80('0x28')](_0x41c043,_0x9a80('0x25'));_0x40db09[_0x9a80('0x2d')]=_['keys'](_0x341ae5[_0x9a80('0x2d')]);_0x40db09[_0x9a80('0x2e')]=_['intersection'](_0x40db09[_0x9a80('0x2c')],_0x40db09[_0x9a80('0x2d')]);_0x15a185[_0x9a80('0x2f')]=_[_0x9a80('0x30')](_0x40db09['model'],qs[_0x9a80('0x31')](_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x31')]));_0x15a185[_0x9a80('0x2f')]=_0x15a185[_0x9a80('0x2f')][_0x9a80('0x32')]?_0x15a185[_0x9a80('0x2f')]:_0x40db09[_0x9a80('0x2c')];if(!_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x33')](_0x9a80('0x34'))){_0x15a185[_0x9a80('0x1b')]=qs[_0x9a80('0x1b')](_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x1b')]);_0x15a185['offset']=qs['offset'](_0x341ae5['query'][_0x9a80('0x19')]);}_0x15a185[_0x9a80('0x35')]=qs[_0x9a80('0x36')](_0x341ae5['query'][_0x9a80('0x36')]);_0x15a185[_0x9a80('0x37')]=qs[_0x9a80('0x2e')](_[_0x9a80('0x38')](_0x341ae5['query'],_0x40db09['filters']),_0x41c043);if(_0x341ae5['query']['filter']){_0x15a185[_0x9a80('0x37')]=_[_0x9a80('0x39')](_0x15a185[_0x9a80('0x37')],{'$or':_['map'](_0x41c043,function(_0x44b0aa){if(_0x44b0aa['type']!==_0x9a80('0x3a')){var _0x1ea1f2={};_0x1ea1f2[_0x44b0aa[_0x9a80('0x25')]]={'$like':'%'+_0x341ae5[_0x9a80('0x2d')]['filter']+'%'};return _0x1ea1f2;}})});}_0x15a185=_[_0x9a80('0x39')]({},_0x15a185,_0x341ae5['options']);var _0x44da37={'where':_0x15a185[_0x9a80('0x37')]};return db['WhatsappApplication']['count'](_0x44da37)['then'](function(_0x2d12d8){_0x2f8904['count']=_0x2d12d8;if(_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x3b')]){_0x15a185[_0x9a80('0x3c')]=[{'all':!![]}];}return db[_0x9a80('0x3d')][_0x9a80('0x3e')](_0x15a185);})[_0x9a80('0x23')](function(_0x15c750){_0x2f8904[_0x9a80('0x3f')]=_0x15c750;return _0x2f8904;})['then'](respondWithFilteredResult(_0x5a86d1,_0x15a185))[_0x9a80('0x40')](handleError(_0x5a86d1,null));};exports[_0x9a80('0x41')]=function(_0x2644b3,_0x554073){var _0x39cb75={'raw':!![],'where':{'id':_0x2644b3['params']['id']}},_0x52094e={};_0x52094e[_0x9a80('0x2c')]=_[_0x9a80('0x42')](db[_0x9a80('0x3d')][_0x9a80('0x29')]);_0x52094e[_0x9a80('0x2d')]=_[_0x9a80('0x42')](_0x2644b3[_0x9a80('0x2d')]);_0x52094e[_0x9a80('0x2e')]=_[_0x9a80('0x30')](_0x52094e[_0x9a80('0x2c')],_0x52094e['query']);_0x39cb75[_0x9a80('0x2f')]=_['intersection'](_0x52094e[_0x9a80('0x2c')],qs[_0x9a80('0x31')](_0x2644b3['query'][_0x9a80('0x31')]));_0x39cb75[_0x9a80('0x2f')]=_0x39cb75['attributes']['length']?_0x39cb75[_0x9a80('0x2f')]:_0x52094e[_0x9a80('0x2c')];if(_0x2644b3[_0x9a80('0x2d')][_0x9a80('0x3b')]){_0x39cb75['include']=[{'all':!![]}];}_0x39cb75=_['merge']({},_0x39cb75,_0x2644b3[_0x9a80('0x43')]);return db[_0x9a80('0x3d')][_0x9a80('0x44')](_0x39cb75)['then'](handleEntityNotFound(_0x554073,null))[_0x9a80('0x23')](respondWithResult(_0x554073,null))['catch'](handleError(_0x554073,null));};exports[_0x9a80('0x45')]=function(_0x1766b8,_0x5bec53){return db[_0x9a80('0x3d')][_0x9a80('0x45')](_0x1766b8[_0x9a80('0x46')],{})[_0x9a80('0x23')](respondWithResult(_0x5bec53,0xc9))[_0x9a80('0x40')](handleError(_0x5bec53,null));};exports['update']=function(_0x4790a7,_0x4a4fe6){if(_0x4790a7['body']['id']){delete _0x4790a7[_0x9a80('0x46')]['id'];}return db[_0x9a80('0x3d')][_0x9a80('0x44')]({'where':{'id':_0x4790a7[_0x9a80('0x47')]['id']}})[_0x9a80('0x23')](handleEntityNotFound(_0x4a4fe6,null))['then'](saveUpdates(_0x4790a7[_0x9a80('0x46')],null))[_0x9a80('0x23')](respondWithResult(_0x4a4fe6,null))[_0x9a80('0x40')](handleError(_0x4a4fe6,null));};exports[_0x9a80('0x22')]=function(_0x124e31,_0x4c742a){return db['WhatsappApplication'][_0x9a80('0x44')]({'where':{'id':_0x124e31[_0x9a80('0x47')]['id']}})[_0x9a80('0x23')](handleEntityNotFound(_0x4c742a,null))[_0x9a80('0x23')](removeEntity(_0x4c742a,null))[_0x9a80('0x40')](handleError(_0x4c742a,null));}; \ No newline at end of file +var _0x8838=['bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','WhatsappApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4bb331,_0x2ba5e1){var _0x496cd4=function(_0x4573fb){while(--_0x4573fb){_0x4bb331['push'](_0x4bb331['shift']());}};_0x496cd4(++_0x2ba5e1);}(_0x8838,0x90));var _0x8883=function(_0x5143b3,_0xaf14a7){_0x5143b3=_0x5143b3-0x0;var _0x25ac70=_0x8838[_0x5143b3];return _0x25ac70;};'use strict';var emlformat=require(_0x8883('0x0'));var rimraf=require(_0x8883('0x1'));var zipdir=require(_0x8883('0x2'));var jsonpatch=require(_0x8883('0x3'));var rp=require(_0x8883('0x4'));var moment=require(_0x8883('0x5'));var BPromise=require(_0x8883('0x6'));var Mustache=require(_0x8883('0x7'));var util=require(_0x8883('0x8'));var path=require(_0x8883('0x9'));var sox=require(_0x8883('0xa'));var csv=require(_0x8883('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8883('0xc'));var squel=require('squel');var crypto=require(_0x8883('0xd'));var jsforce=require(_0x8883('0xe'));var deskjs=require(_0x8883('0xf'));var toCsv=require(_0x8883('0xb'));var querystring=require(_0x8883('0x10'));var Papa=require(_0x8883('0x11'));var Redis=require(_0x8883('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8883('0x13'));var as=require(_0x8883('0x14'));var hardwareService=require(_0x8883('0x15'));var logger=require(_0x8883('0x16'))('api');var utils=require(_0x8883('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8883('0x18'));var db=require(_0x8883('0x19'))['db'];function respondWithStatusCode(_0x357db6,_0x42dd7f){_0x42dd7f=_0x42dd7f||0xcc;return function(_0x3ad46c){if(_0x3ad46c){return _0x357db6[_0x8883('0x1a')](_0x42dd7f);}return _0x357db6[_0x8883('0x1b')](_0x42dd7f)[_0x8883('0x1c')]();};}function respondWithResult(_0x4663ba,_0x5f5259){_0x5f5259=_0x5f5259||0xc8;return function(_0x37ed54){if(_0x37ed54){return _0x4663ba[_0x8883('0x1b')](_0x5f5259)[_0x8883('0x1d')](_0x37ed54);}};}function respondWithFilteredResult(_0x347575,_0x5b9cba){return function(_0x126280){if(_0x126280){var _0x55e8ab=typeof _0x5b9cba[_0x8883('0x1e')]==='undefined'&&typeof _0x5b9cba[_0x8883('0x1f')]==='undefined';var _0x2ff211=_0x126280[_0x8883('0x20')];var _0x127b5f=_0x55e8ab?0x0:_0x5b9cba[_0x8883('0x1e')];var _0x1ec1b5=_0x55e8ab?_0x126280['count']:_0x5b9cba['offset']+_0x5b9cba[_0x8883('0x1f')];var _0x118c33;if(_0x1ec1b5>=_0x2ff211){_0x1ec1b5=_0x2ff211;_0x118c33=0xc8;}else{_0x118c33=0xce;}_0x347575['status'](_0x118c33);return _0x347575[_0x8883('0x21')](_0x8883('0x22'),_0x127b5f+'-'+_0x1ec1b5+'/'+_0x2ff211)[_0x8883('0x1d')](_0x126280);}return null;};}function patchUpdates(_0x4a7185){return function(_0x1bb80d){try{jsonpatch[_0x8883('0x23')](_0x1bb80d,_0x4a7185,!![]);}catch(_0x10d674){return BPromise[_0x8883('0x24')](_0x10d674);}return _0x1bb80d[_0x8883('0x25')]();};}function saveUpdates(_0x4c2376,_0x2ee36c){return function(_0xbb362f){if(_0xbb362f){return _0xbb362f['update'](_0x4c2376)[_0x8883('0x26')](function(_0x154e5f){return _0x154e5f;});}return null;};}function removeEntity(_0x171d63,_0x51fdd9){return function(_0x3f90e8){if(_0x3f90e8){return _0x3f90e8[_0x8883('0x27')]()[_0x8883('0x26')](function(){_0x171d63[_0x8883('0x1b')](0xcc)[_0x8883('0x1c')]();});}};}function handleEntityNotFound(_0x223412,_0x2b53e5){return function(_0x5d7c59){if(!_0x5d7c59){_0x223412[_0x8883('0x1a')](0x194);}return _0x5d7c59;};}function handleError(_0x576019,_0x1b6c13){_0x1b6c13=_0x1b6c13||0x1f4;return function(_0x5c3a68){logger['error'](_0x5c3a68['stack']);if(_0x5c3a68['name']){delete _0x5c3a68[_0x8883('0x28')];}_0x576019[_0x8883('0x1b')](_0x1b6c13)[_0x8883('0x29')](_0x5c3a68);};}exports['index']=function(_0x21529a,_0x1147ed){var _0x26df5b={},_0x2e772e={},_0x576605={'count':0x0,'rows':[]};var _0x15fcdb=_['map'](db[_0x8883('0x2a')][_0x8883('0x2b')],function(_0x2bdd57){return{'name':_0x2bdd57[_0x8883('0x2c')],'type':_0x2bdd57[_0x8883('0x2d')][_0x8883('0x2e')]};});_0x2e772e[_0x8883('0x2f')]=_['map'](_0x15fcdb,'name');_0x2e772e['query']=_[_0x8883('0x30')](_0x21529a[_0x8883('0x31')]);_0x2e772e[_0x8883('0x32')]=_['intersection'](_0x2e772e[_0x8883('0x2f')],_0x2e772e[_0x8883('0x31')]);_0x26df5b['attributes']=_['intersection'](_0x2e772e[_0x8883('0x2f')],qs['fields'](_0x21529a['query'][_0x8883('0x33')]));_0x26df5b[_0x8883('0x34')]=_0x26df5b['attributes'][_0x8883('0x35')]?_0x26df5b[_0x8883('0x34')]:_0x2e772e[_0x8883('0x2f')];if(!_0x21529a['query'][_0x8883('0x36')](_0x8883('0x37'))){_0x26df5b[_0x8883('0x1f')]=qs[_0x8883('0x1f')](_0x21529a[_0x8883('0x31')][_0x8883('0x1f')]);_0x26df5b[_0x8883('0x1e')]=qs[_0x8883('0x1e')](_0x21529a[_0x8883('0x31')][_0x8883('0x1e')]);}_0x26df5b[_0x8883('0x38')]=qs[_0x8883('0x39')](_0x21529a[_0x8883('0x31')][_0x8883('0x39')]);_0x26df5b[_0x8883('0x3a')]=qs['filters'](_[_0x8883('0x3b')](_0x21529a['query'],_0x2e772e[_0x8883('0x32')]),_0x15fcdb);if(_0x21529a['query'][_0x8883('0x3c')]){_0x26df5b['where']=_[_0x8883('0x3d')](_0x26df5b[_0x8883('0x3a')],{'$or':_['map'](_0x15fcdb,function(_0x2c3965){if(_0x2c3965[_0x8883('0x2d')]!==_0x8883('0x3e')){var _0x480609={};_0x480609[_0x2c3965[_0x8883('0x28')]]={'$like':'%'+_0x21529a[_0x8883('0x31')][_0x8883('0x3c')]+'%'};return _0x480609;}})});}_0x26df5b=_[_0x8883('0x3d')]({},_0x26df5b,_0x21529a[_0x8883('0x3f')]);var _0x21e90c={'where':_0x26df5b[_0x8883('0x3a')]};return db[_0x8883('0x2a')][_0x8883('0x20')](_0x21e90c)[_0x8883('0x26')](function(_0x262ef7){_0x576605[_0x8883('0x20')]=_0x262ef7;if(_0x21529a[_0x8883('0x31')][_0x8883('0x40')]){_0x26df5b['include']=[{'all':!![]}];}return db[_0x8883('0x2a')]['findAll'](_0x26df5b);})[_0x8883('0x26')](function(_0x3626bf){_0x576605[_0x8883('0x41')]=_0x3626bf;return _0x576605;})[_0x8883('0x26')](respondWithFilteredResult(_0x1147ed,_0x26df5b))[_0x8883('0x42')](handleError(_0x1147ed,null));};exports[_0x8883('0x43')]=function(_0x12af4c,_0x27a11a){var _0x5a66de={'raw':!![],'where':{'id':_0x12af4c[_0x8883('0x44')]['id']}},_0x35b867={};_0x35b867[_0x8883('0x2f')]=_[_0x8883('0x30')](db[_0x8883('0x2a')][_0x8883('0x2b')]);_0x35b867[_0x8883('0x31')]=_['keys'](_0x12af4c[_0x8883('0x31')]);_0x35b867[_0x8883('0x32')]=_[_0x8883('0x45')](_0x35b867[_0x8883('0x2f')],_0x35b867['query']);_0x5a66de[_0x8883('0x34')]=_[_0x8883('0x45')](_0x35b867[_0x8883('0x2f')],qs['fields'](_0x12af4c[_0x8883('0x31')]['fields']));_0x5a66de[_0x8883('0x34')]=_0x5a66de['attributes'][_0x8883('0x35')]?_0x5a66de[_0x8883('0x34')]:_0x35b867['model'];if(_0x12af4c['query']['includeAll']){_0x5a66de[_0x8883('0x46')]=[{'all':!![]}];}_0x5a66de=_[_0x8883('0x3d')]({},_0x5a66de,_0x12af4c[_0x8883('0x3f')]);return db['WhatsappApplication'][_0x8883('0x47')](_0x5a66de)[_0x8883('0x26')](handleEntityNotFound(_0x27a11a,null))[_0x8883('0x26')](respondWithResult(_0x27a11a,null))[_0x8883('0x42')](handleError(_0x27a11a,null));};exports[_0x8883('0x48')]=function(_0x58fdd8,_0x43683f){return db[_0x8883('0x2a')][_0x8883('0x48')](_0x58fdd8[_0x8883('0x49')],{})[_0x8883('0x26')](respondWithResult(_0x43683f,0xc9))[_0x8883('0x42')](handleError(_0x43683f,null));};exports[_0x8883('0x4a')]=function(_0x21ee60,_0x598086){if(_0x21ee60['body']['id']){delete _0x21ee60[_0x8883('0x49')]['id'];}return db[_0x8883('0x2a')]['find']({'where':{'id':_0x21ee60[_0x8883('0x44')]['id']}})['then'](handleEntityNotFound(_0x598086,null))['then'](saveUpdates(_0x21ee60[_0x8883('0x49')],null))[_0x8883('0x26')](respondWithResult(_0x598086,null))['catch'](handleError(_0x598086,null));};exports[_0x8883('0x27')]=function(_0x153ba6,_0x23f464){return db[_0x8883('0x2a')][_0x8883('0x47')]({'where':{'id':_0x153ba6[_0x8883('0x44')]['id']}})[_0x8883('0x26')](handleEntityNotFound(_0x23f464,null))[_0x8883('0x26')](removeEntity(_0x23f464,null))[_0x8883('0x42')](handleError(_0x23f464,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ba0c1f3..5b5b510 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 _0xc997=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x371844,_0x5916fb){var _0x56f7d6=function(_0x29000c){while(--_0x29000c){_0x371844['push'](_0x371844['shift']());}};_0x56f7d6(++_0x5916fb);}(_0xc997,0x1ac));var _0x7c99=function(_0x464694,_0x5cf71c){_0x464694=_0x464694-0x0;var _0x5590c4=_0xc997[_0x464694];return _0x5590c4;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var moment=require(_0x7c99('0x3'));var BPromise=require(_0x7c99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c99('0x5'));var rimraf=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var attributes=require(_0x7c99('0x8'));module[_0x7c99('0x9')]=function(_0x404ffb,_0x1a21e1){return _0x404ffb[_0x7c99('0xa')]('WhatsappApplication',attributes,{'tableName':_0x7c99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c99('0xc'),'collate':_0x7c99('0xd')});}; \ No newline at end of file +var _0x5455=['define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes','exports'];(function(_0x946c78,_0x510e21){var _0x2d671e=function(_0x25ade4){while(--_0x25ade4){_0x946c78['push'](_0x946c78['shift']());}};_0x2d671e(++_0x510e21);}(_0x5455,0x197));var _0x5545=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5455[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var logger=require(_0x5545('0x1'))(_0x5545('0x2'));var moment=require(_0x5545('0x3'));var BPromise=require(_0x5545('0x4'));var rp=require(_0x5545('0x5'));var fs=require('fs');var path=require(_0x5545('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5545('0x7'));module[_0x5545('0x8')]=function(_0x5c22f1,_0x5a6ac7){return _0x5c22f1[_0x5545('0x9')](_0x5545('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5545('0xb'),'collate':_0x5545('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 17a9340..9d378b4 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 _0x33c5=['then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x33c5,0xe6));var _0x533c=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0x33c5[_0x3f59b1];return _0x11d2e8;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file +var _0x5c12=['../../config/environment','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x57966a,_0x477964){var _0x191765=function(_0x106a01){while(--_0x106a01){_0x57966a['push'](_0x57966a['shift']());}};_0x191765(++_0x477964);}(_0x5c12,0x188));var _0x25c1=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x5c12[_0x1a7846];return _0x48049;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382922,_0x4ab674,_0x5c69b1){return new BPromise(function(_0x24981c,_0x3b69ba){return client[_0x25c1('0xb')](_0x382922,_0x5c69b1)[_0x25c1('0xc')](function(_0xf8363f){logger['info'](_0x25c1('0xd'),_0x4ab674,_0x25c1('0xe'));logger[_0x25c1('0xf')](_0x25c1('0x10'),_0x4ab674,_0x25c1('0xe'),JSON['stringify'](_0xf8363f));if(_0xf8363f[_0x25c1('0x11')]){if(_0xf8363f[_0x25c1('0x11')]['code']===0x1f4){logger[_0x25c1('0x11')](_0x25c1('0xd'),_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x3b69ba(_0xf8363f['error']['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);return _0x24981c(_0xf8363f[_0x25c1('0x11')][_0x25c1('0x12')]);}else{logger[_0x25c1('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x25c1('0xe'));_0x24981c(_0xf8363f['result']['message']);}})['catch'](function(_0x284712){logger[_0x25c1('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x4ab674,_0x284712);_0x3b69ba(_0x284712);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 72b76b0..30fd670 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 _0xee14=['addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xee14,0x13a));var _0x4ee1=function(_0x1da760,_0x1e26a6){_0x1da760=_0x1da760-0x0;var _0x4f8b30=_0xee14[_0x1da760];return _0x4f8b30;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get']('/',auth[_0x4ee1('0x9')](),controller['index']);router[_0x4ee1('0xa')](_0x4ee1('0xb'),auth[_0x4ee1('0x9')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0xa')](_0x4ee1('0xd'),auth['isAuthenticated'](),controller[_0x4ee1('0xe')]);router[_0x4ee1('0xa')]('/:id/messages',auth[_0x4ee1('0x9')](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0xa')](_0x4ee1('0x10'),auth['isAuthenticated'](),controller[_0x4ee1('0x11')]);router[_0x4ee1('0x12')]('/',auth[_0x4ee1('0x9')](),controller[_0x4ee1('0x13')]);router[_0x4ee1('0x12')](_0x4ee1('0x14'),auth['isAuthenticated'](),controller[_0x4ee1('0x15')]);router[_0x4ee1('0x12')](_0x4ee1('0x16'),auth[_0x4ee1('0x9')](),interaction[_0x4ee1('0x17')](_0x4ee1('0x18'),_0x4ee1('0x19')),controller[_0x4ee1('0x1a')]);router[_0x4ee1('0x1b')]('/:id',auth[_0x4ee1('0x9')](),interaction[_0x4ee1('0x17')](_0x4ee1('0x18'),_0x4ee1('0x1c')),controller[_0x4ee1('0x1d')]);router[_0x4ee1('0x1e')](_0x4ee1('0xd'),auth[_0x4ee1('0x9')](),interaction[_0x4ee1('0x17')](_0x4ee1('0x18'),_0x4ee1('0x1f')),controller['destroy']);router[_0x4ee1('0x1e')](_0x4ee1('0x16'),auth[_0x4ee1('0x9')](),controller[_0x4ee1('0x20')]);module[_0x4ee1('0x21')]=router; \ No newline at end of file +var _0xfc65=['show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x295fa4,_0x461c3f){var _0x5559e4=function(_0x301d1f){while(--_0x301d1f){_0x295fa4['push'](_0x295fa4['shift']());}};_0x5559e4(++_0x461c3f);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x50a1df,_0x22feeb){_0x50a1df=_0x50a1df-0x0;var _0x105c93=_0xfc65[_0x50a1df];return _0x105c93;};'use strict';var multer=require(_0x5fc6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5fc6('0x1'));var express=require(_0x5fc6('0x2'));var router=express[_0x5fc6('0x3')]();var fs_extra=require(_0x5fc6('0x4'));var auth=require(_0x5fc6('0x5'));var interaction=require(_0x5fc6('0x6'));var config=require(_0x5fc6('0x7'));var controller=require(_0x5fc6('0x8'));router[_0x5fc6('0x9')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xb')]);router[_0x5fc6('0x9')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller[_0x5fc6('0xd')]);router[_0x5fc6('0x9')](_0x5fc6('0xe'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xf')]);router[_0x5fc6('0x9')](_0x5fc6('0x10'),auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x11')]);router[_0x5fc6('0x9')]('/:id/download',auth[_0x5fc6('0xa')](),controller['download']);router[_0x5fc6('0x12')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x13')]);router[_0x5fc6('0x12')]('/:id/messages',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0x14')]);router[_0x5fc6('0x12')](_0x5fc6('0x15'),auth[_0x5fc6('0xa')](),interaction[_0x5fc6('0x16')](_0x5fc6('0x17'),_0x5fc6('0x18')),controller[_0x5fc6('0x19')]);router[_0x5fc6('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x5fc6('0x16')](_0x5fc6('0x17'),'whatsappinteraction:update'),controller[_0x5fc6('0x1b')]);router[_0x5fc6('0x1c')](_0x5fc6('0xe'),auth[_0x5fc6('0xa')](),interaction[_0x5fc6('0x16')](_0x5fc6('0x17'),'whatsappinteraction:destroy'),controller[_0x5fc6('0x1d')]);router[_0x5fc6('0x1c')](_0x5fc6('0x15'),auth[_0x5fc6('0xa')](),controller['removeTags']);module[_0x5fc6('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index fa7fee0..7f73014 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 _0x5031=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x39a387,_0x496459){var _0x4d9420=function(_0x2b9cda){while(--_0x2b9cda){_0x39a387['push'](_0x39a387['shift']());}};_0x4d9420(++_0x496459);}(_0x5031,0x144));var _0x1503=function(_0xa226b0,_0x167a45){_0xa226b0=_0xa226b0-0x0;var _0x13c645=_0x5031[_0xa226b0];return _0x13c645;};'use strict';var Sequelize=require(_0x1503('0x0'));var moment=require(_0x1503('0x1'));module[_0x1503('0x2')]={'closed':{'type':Sequelize[_0x1503('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1503('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1503('0x5')]},'note':{'type':Sequelize[_0x1503('0x5')]},'phone':{'type':Sequelize[_0x1503('0x5')]},'read1stAt':{'type':Sequelize[_0x1503('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1503('0x6')]('in',_0x1503('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1503('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1503('0x6')]('in',_0x1503('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7dfd=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x14e2bf,_0x24aa11){var _0x59d3f4=function(_0x3e3160){while(--_0x3e3160){_0x14e2bf['push'](_0x14e2bf['shift']());}};_0x59d3f4(++_0x24aa11);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));module[_0xd7df('0x2')]={'closed':{'type':Sequelize[_0xd7df('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd7df('0x4')]},'disposition':{'type':Sequelize[_0xd7df('0x5')]},'secondDisposition':{'type':Sequelize[_0xd7df('0x5')]},'thirdDisposition':{'type':Sequelize[_0xd7df('0x5')]},'note':{'type':Sequelize[_0xd7df('0x5')]},'phone':{'type':Sequelize[_0xd7df('0x5')]},'read1stAt':{'type':Sequelize[_0xd7df('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd7df('0x6')]('in',_0xd7df('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd7df('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xd7df('0x6')]('in',_0xd7df('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd7df('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index d56742d..6542b9d 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 _0x79d7=['CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','toString','closed','disposition','basename','existsSync','createReadStream','createWriteStream','out','System','direction','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','rimraf','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','defaults','./whatsappInteraction.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','WhatsappInteraction','fieldName','type','getOptions','findAll','whatsapp','user','catch','show','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','WhatsappMessage','ids','hasOwnProperty','nolimit','sort','pick','where','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','omit','spread','color','removeTags','download','unix','server','tmp','root','files','join','transcript-%d-%s.zip','push','User','fullname'];(function(_0x1d686d,_0x570427){var _0x7e5e7=function(_0x1c44d3){while(--_0x1c44d3){_0x1d686d['push'](_0x1d686d['shift']());}};_0x7e5e7(++_0x570427);}(_0x79d7,0x9c));var _0x779d=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x79d7[_0x3511d3];return _0x5d6321;};'use strict';var rimraf=require(_0x779d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x779d('0x1'));var BPromise=require(_0x779d('0x2'));var util=require(_0x779d('0x3'));var path=require(_0x779d('0x4'));var ejs=require(_0x779d('0x5'));var fs=require('fs');var _=require(_0x779d('0x6'));var Redis=require('ioredis');var interaction=require(_0x779d('0x7'));var qs=require(_0x779d('0x8'));var pdf=require(_0x779d('0x9'));var logger=require('../../config/logger')('api');var config=require(_0x779d('0xa'));var db=require('../../mysqldb')['db'];config[_0x779d('0xb')]=_[_0x779d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x779d('0xd'))[_0x779d('0xe')](socket);function respondWithStatusCode(_0x3c820b,_0x505e77){_0x505e77=_0x505e77||0xcc;return function(_0x19f327){if(_0x19f327){return _0x3c820b['sendStatus'](_0x505e77);}return _0x3c820b[_0x779d('0xf')](_0x505e77)['end']();};}function respondWithResult(_0x4af5ab,_0x3b9ca0){_0x3b9ca0=_0x3b9ca0||0xc8;return function(_0x25948b){if(_0x25948b){return _0x4af5ab['status'](_0x3b9ca0)[_0x779d('0x10')](_0x25948b);}};}function respondWithFilteredResult(_0x40495a,_0x41a740){return function(_0x409ab5){if(_0x409ab5){var _0x279153=typeof _0x41a740[_0x779d('0x11')]==='undefined'&&typeof _0x41a740[_0x779d('0x12')]===_0x779d('0x13');var _0x2a0678=_0x409ab5[_0x779d('0x14')];var _0x1c7ad7=_0x279153?0x0:_0x41a740['offset'];var _0x26dfa2=_0x279153?_0x409ab5[_0x779d('0x14')]:_0x41a740[_0x779d('0x11')]+_0x41a740['limit'];var _0x13c843;if(_0x26dfa2>=_0x2a0678){_0x26dfa2=_0x2a0678;_0x13c843=0xc8;}else{_0x13c843=0xce;}_0x40495a[_0x779d('0xf')](_0x13c843);return _0x40495a[_0x779d('0x15')](_0x779d('0x16'),_0x1c7ad7+'-'+_0x26dfa2+'/'+_0x2a0678)[_0x779d('0x10')](_0x409ab5);}return null;};}function saveUpdates(_0x21102d){return function(_0x428186){if(_0x428186){return _0x428186[_0x779d('0x17')](_0x21102d)[_0x779d('0x18')](function(_0x4192c){return _0x4192c;});}return null;};}function removeEntity(_0x2629b3){return function(_0x373abb){if(_0x373abb){return _0x373abb[_0x779d('0x19')]()['then'](function(){_0x2629b3[_0x779d('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e81b9){return function(_0x4d0f40){if(!_0x4d0f40){_0x2e81b9[_0x779d('0x1a')](0x194);}return _0x4d0f40;};}function handleError(_0x4173cb,_0xffa3e){_0xffa3e=_0xffa3e||0x1f4;return function(_0x2d4e36){logger['error'](_0x2d4e36[_0x779d('0x1b')]);if(_0x2d4e36[_0x779d('0x1c')]){delete _0x2d4e36[_0x779d('0x1c')];}_0x4173cb[_0x779d('0xf')](_0xffa3e)[_0x779d('0x1d')](_0x2d4e36);};}exports[_0x779d('0x1e')]=function(_0x2fca0a,_0x42bc01){var _0x1e2ab5={};var _0x347af8=_['map'](db[_0x779d('0x1f')]['rawAttributes'],function(_0x5d7ab5){return{'name':_0x5d7ab5[_0x779d('0x20')],'type':_0x5d7ab5[_0x779d('0x21')]['key']};});_0x1e2ab5=qs[_0x779d('0x22')](_0x347af8,_0x2fca0a);return interaction[_0x779d('0x23')](_0x779d('0x24'),_0x2fca0a['query'],_0x2fca0a[_0x779d('0x25')],_0x1e2ab5,_0x347af8)[_0x779d('0x18')](respondWithFilteredResult(_0x42bc01,_0x1e2ab5))[_0x779d('0x26')](handleError(_0x42bc01,null));};exports[_0x779d('0x27')]=function(_0x23d5ea,_0x882d18){var _0x5e1611={'raw':![],'where':{'id':_0x23d5ea[_0x779d('0x28')]['id']}},_0x12714c={};_0x12714c[_0x779d('0x29')]=_[_0x779d('0x2a')](db[_0x779d('0x1f')][_0x779d('0x2b')]);_0x12714c[_0x779d('0x2c')]=_[_0x779d('0x2a')](_0x23d5ea[_0x779d('0x2c')]);_0x12714c[_0x779d('0x2d')]=_['intersection'](_0x12714c[_0x779d('0x29')],_0x12714c[_0x779d('0x2c')]);_0x5e1611[_0x779d('0x2e')]=_[_0x779d('0x2f')](_0x12714c[_0x779d('0x29')],qs[_0x779d('0x30')](_0x23d5ea[_0x779d('0x2c')][_0x779d('0x30')]));_0x5e1611[_0x779d('0x2e')]=_0x5e1611['attributes'][_0x779d('0x31')]?_0x5e1611[_0x779d('0x2e')]:_0x12714c[_0x779d('0x29')];if(_0x23d5ea['query'][_0x779d('0x32')]){_0x5e1611[_0x779d('0x33')]=[{'all':!![]}];}_0x5e1611=_[_0x779d('0x34')]({},_0x5e1611,_0x23d5ea[_0x779d('0x35')]);return db[_0x779d('0x1f')][_0x779d('0x36')](_0x5e1611)[_0x779d('0x18')](handleEntityNotFound(_0x882d18,null))['then'](respondWithResult(_0x882d18,null))[_0x779d('0x26')](handleError(_0x882d18,null));};exports[_0x779d('0x37')]=function(_0x467755,_0x5a7c0b){return db[_0x779d('0x1f')]['create'](_0x467755[_0x779d('0x38')],{})[_0x779d('0x18')](respondWithResult(_0x5a7c0b,0xc9))[_0x779d('0x26')](handleError(_0x5a7c0b,null));};exports[_0x779d('0x17')]=function(_0x42457a,_0x154897){if(_0x42457a[_0x779d('0x38')]['id']){delete _0x42457a[_0x779d('0x38')]['id'];}return db[_0x779d('0x1f')][_0x779d('0x36')]({'where':{'id':_0x42457a[_0x779d('0x28')]['id']}})['then'](handleEntityNotFound(_0x154897,null))['then'](saveUpdates(_0x42457a['body'],null))[_0x779d('0x18')](respondWithResult(_0x154897,null))[_0x779d('0x26')](handleError(_0x154897,null));};exports['destroy']=function(_0xcba9b3,_0x248e5f){return db['WhatsappInteraction'][_0x779d('0x36')]({'where':{'id':_0xcba9b3[_0x779d('0x28')]['id']}})[_0x779d('0x18')](handleEntityNotFound(_0x248e5f,null))[_0x779d('0x18')](removeEntity(_0x248e5f,null))[_0x779d('0x26')](handleError(_0x248e5f,null));};exports[_0x779d('0x39')]=function(_0x52f87d,_0xda5dc6){return db['WhatsappInteraction'][_0x779d('0x39')]()[_0x779d('0x18')](respondWithResult(_0xda5dc6,null))[_0x779d('0x26')](handleError(_0xda5dc6,null));};exports[_0x779d('0x3a')]=function(_0x42e580,_0x5292e5){return db[_0x779d('0x3b')][_0x779d('0x36')]({'where':{'id':_0x42e580[_0x779d('0x28')]['id']}})[_0x779d('0x18')](handleEntityNotFound(_0x5292e5,null))[_0x779d('0x18')](function(_0x38813f){if(_0x38813f){return _0x38813f[_0x779d('0x3a')](_0x42e580['body'][_0x779d('0x3c')],_['omit'](_0x42e580[_0x779d('0x38')],[_0x779d('0x3c'),'id'])||{});}})[_0x779d('0x18')](respondWithResult(_0x5292e5,null))['catch'](handleError(_0x5292e5,null));};exports['getMessages']=function(_0xfc722e,_0x4ad582){var _0x59dc0c={'raw':![],'where':{}};var _0x311d6c={};var _0x5a78fd={'count':0x0,'rows':[]};return db[_0x779d('0x1f')]['findOne']({'where':{'id':_0xfc722e[_0x779d('0x28')]['id']}})['then'](handleEntityNotFound(_0x4ad582,null))[_0x779d('0x18')](function(_0x128d5a){if(_0x128d5a){_0x311d6c[_0x779d('0x29')]=_[_0x779d('0x2a')](db[_0x779d('0x3b')][_0x779d('0x2b')]);_0x311d6c[_0x779d('0x2c')]=_[_0x779d('0x2a')](_0xfc722e[_0x779d('0x2c')]);_0x311d6c[_0x779d('0x2d')]=_[_0x779d('0x2f')](_0x311d6c['model'],_0x311d6c[_0x779d('0x2c')]);_0x59dc0c[_0x779d('0x2e')]=_['intersection'](_0x311d6c['model'],qs[_0x779d('0x30')](_0xfc722e[_0x779d('0x2c')]['fields']));_0x59dc0c[_0x779d('0x2e')]=_0x59dc0c[_0x779d('0x2e')][_0x779d('0x31')]?_0x59dc0c['attributes']:_0x311d6c[_0x779d('0x29')];if(!_0xfc722e[_0x779d('0x2c')][_0x779d('0x3d')](_0x779d('0x3e'))){_0x59dc0c[_0x779d('0x12')]=qs[_0x779d('0x12')](_0xfc722e[_0x779d('0x2c')][_0x779d('0x12')]);_0x59dc0c[_0x779d('0x11')]=qs[_0x779d('0x11')](_0xfc722e[_0x779d('0x2c')][_0x779d('0x11')]);}_0x59dc0c['order']=qs['sort'](_0xfc722e[_0x779d('0x2c')][_0x779d('0x3f')]);_0x59dc0c['where']=qs['filters'](_[_0x779d('0x40')](_0xfc722e[_0x779d('0x2c')],_0x311d6c[_0x779d('0x2d')]));_0x59dc0c[_0x779d('0x41')][_0x779d('0x42')]=_0x128d5a['id'];if(_0xfc722e['query'][_0x779d('0x43')]){_0x59dc0c[_0x779d('0x41')]=_[_0x779d('0x34')](_0x59dc0c[_0x779d('0x41')],{'$or':_[_0x779d('0x44')](_0x59dc0c[_0x779d('0x2e')],function(_0x5bea8c){var _0x44e72b={};_0x44e72b[_0x5bea8c]={'$like':'%'+_0xfc722e[_0x779d('0x2c')][_0x779d('0x43')]+'%'};return _0x44e72b;})});}if(_0xfc722e[_0x779d('0x2c')][_0x779d('0x45')]){var _0xadd3cf=_0xfc722e['query'][_0x779d('0x45')][_0x779d('0x46')](',');var _0x393ea9={};_0x393ea9[_0xadd3cf[0x0]]={'$gte':moment(_0xadd3cf[0x1])[_0x779d('0x47')](_0x779d('0x48'))};_0x59dc0c[_0x779d('0x41')]=_[_0x779d('0x34')](_0x59dc0c[_0x779d('0x41')],_0x393ea9);}_0x59dc0c=_[_0x779d('0x34')]({},_0x59dc0c,_0xfc722e[_0x779d('0x35')]);return db[_0x779d('0x3b')]['count']({'where':_0x59dc0c[_0x779d('0x41')]})['then'](function(_0x2e83b0){_0x5a78fd[_0x779d('0x14')]=_0x2e83b0;if(_0xfc722e['query'][_0x779d('0x32')]){_0x59dc0c[_0x779d('0x33')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x779d('0x23')](_0x59dc0c);})[_0x779d('0x18')](function(_0x5ee710){_0x5a78fd[_0x779d('0x49')]=_0x5ee710;return _0x5a78fd;});}})[_0x779d('0x18')](respondWithFilteredResult(_0x4ad582,_0x59dc0c))['catch'](handleError(_0x4ad582,null));};exports['addTags']=function(_0x5e3256,_0x2779f9){return db[_0x779d('0x1f')][_0x779d('0x36')]({'where':{'id':_0x5e3256[_0x779d('0x28')]['id']}})[_0x779d('0x18')](handleEntityNotFound(_0x2779f9,null))[_0x779d('0x18')](function(_0x295f56){if(_0x295f56){return _0x295f56[_0x779d('0x4a')](_0x5e3256[_0x779d('0x38')][_0x779d('0x3c')],_[_0x779d('0x4b')](_0x5e3256[_0x779d('0x38')],[_0x779d('0x3c'),'id'])||{})[_0x779d('0x4c')](function(){return db['Tag'][_0x779d('0x23')]({'attributes':['id',_0x779d('0x1c'),_0x779d('0x4d')],'where':{'id':_0x5e3256[_0x779d('0x38')][_0x779d('0x3c')]}});})[_0x779d('0x18')](function(_0x448236){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x5e3256['params']['id']),'tags':_0x448236||[]});return{'id':Number(_0x5e3256['params']['id']),'tags':_0x448236||[]};});}})[_0x779d('0x18')](respondWithResult(_0x2779f9,null))['catch'](handleError(_0x2779f9,null));};exports[_0x779d('0x4e')]=function(_0xf37e24,_0x573618){return db['WhatsappInteraction'][_0x779d('0x36')]({'where':{'id':_0xf37e24[_0x779d('0x28')]['id']}})[_0x779d('0x18')](handleEntityNotFound(_0x573618,null))[_0x779d('0x18')](function(_0x59d699){if(_0x59d699){return _0x59d699[_0x779d('0x4e')](_0xf37e24['query'][_0x779d('0x3c')]);}})[_0x779d('0x18')](respondWithStatusCode(_0x573618,null))[_0x779d('0x26')](handleError(_0x573618,null));};exports[_0x779d('0x4f')]=function(_0x44a004,_0x46f6c5){var _0x3bfd90=moment()[_0x779d('0x50')]()['toString']();var _0x3d141c=path['join'](config['root'],_0x779d('0x51'),'files',_0x779d('0x52'));var _0x567a06=path['join'](config[_0x779d('0x53')],_0x779d('0x51'),_0x779d('0x54'),'attachments');var _0x42ecc1=path[_0x779d('0x55')](_0x3d141c,_0x3bfd90);var _0x1e789a=util['format'](_0x779d('0x56'),_0x44a004[_0x779d('0x28')]['id'],_0x3bfd90);var _0x295fd3=path[_0x779d('0x55')](_0x3d141c,_0x1e789a);var _0x3931c1=[];_0x3931c1[_0x779d('0x57')]({'model':db[_0x779d('0x58')],'as':_0x779d('0x58'),'attributes':['id',_0x779d('0x59')],'raw':!![]});_0x3931c1[_0x779d('0x57')]({'model':db[_0x779d('0x5a')],'as':_0x779d('0x5b'),'attributes':['id',_0x779d('0x5c'),_0x779d('0x5d')],'raw':!![]});if(_0x44a004[_0x779d('0x2c')][_0x779d('0x5e')]){_0x3931c1['push']({'model':db['Attachment'],'as':_0x779d('0x5f'),'raw':!![]});}var _0x3741a4=[{'model':db[_0x779d('0x3b')],'as':_0x779d('0x60'),'attributes':['id',_0x779d('0x38'),_0x779d('0x61'),'direction',_0x779d('0x62'),_0x779d('0x63')],'include':_0x3931c1}];_0x3741a4[_0x779d('0x57')]({'model':db[_0x779d('0x64')],'as':_0x779d('0x65'),'attributes':['id',_0x779d('0x1c')]});_0x3741a4[_0x779d('0x57')]({'model':db[_0x779d('0x58')],'as':_0x779d('0x66'),'attributes':['id',_0x779d('0x59')]});return db[_0x779d('0x1f')][_0x779d('0x36')]({'where':{'id':_0x44a004['params']['id']},'include':_0x3741a4})[_0x779d('0x18')](handleEntityNotFound(_0x46f6c5,null))[_0x779d('0x18')](function(_0x3dfe1e){if(_0x3dfe1e){var _0x2ee135=_0x3dfe1e[_0x779d('0x67')]({'plain':!![]});fs[_0x779d('0x68')](_0x42ecc1);var _0x3485a2={'channel':_0x779d('0x69'),'account':_0x2ee135[_0x779d('0x65')][_0x779d('0x1c')],'agent':_0x2ee135['Owner']?_0x2ee135[_0x779d('0x66')][_0x779d('0x59')]:'N.A.','createdAt':moment(_0x2ee135['createdAt'])['format'](_0x779d('0x48'))[_0x779d('0x6a')](),'closedAt':_0x2ee135[_0x779d('0x6b')]?moment(_0x2ee135['closedAt'])[_0x779d('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x779d('0x6a')]():'','disposition':_0x2ee135[_0x779d('0x6c')],'messages':_(_0x2ee135[_0x779d('0x60')])[_0x779d('0x43')]({'secret':![]})[_0x779d('0x44')](function(_0xa91bea){if(_0xa91bea[_0x779d('0x5f')]){var _0x58cdfc=path[_0x779d('0x55')](_0x567a06,_0xa91bea[_0x779d('0x5f')][_0x779d('0x6d')]);if(fs[_0x779d('0x6e')](_0x58cdfc)){fs[_0x779d('0x6f')](_0x58cdfc)['pipe'](fs[_0x779d('0x70')](path['join'](_0x42ecc1,_0xa91bea[_0x779d('0x5f')][_0x779d('0x6d')])));}}return{'date':moment(_0xa91bea[_0x779d('0x61')])[_0x779d('0x47')](_0x779d('0x48'))['toString'](),'sender':_0xa91bea['direction']===_0x779d('0x71')?_0xa91bea['User']?_0xa91bea[_0x779d('0x58')]['fullname']:_0x779d('0x72'):_0xa91bea['Contact'][_0x779d('0x5c')]+(_0xa91bea[_0x779d('0x5b')][_0x779d('0x5d')]?'\x20'+_0xa91bea[_0x779d('0x5b')][_0x779d('0x5d')]:''),'body':_0xa91bea[_0x779d('0x5f')]?_0xa91bea['Attachment'][_0x779d('0x6d')]:_0xa91bea[_0x779d('0x38')],'direction':_0xa91bea[_0x779d('0x73')]==='out'?'A':'C','secret':_0xa91bea[_0x779d('0x62')],'read':_0xa91bea['read'],'attachment':_0xa91bea[_0x779d('0x5f')]};})[_0x779d('0x74')]()};return ejs[_0x779d('0x75')](path['join'](config[_0x779d('0x53')],_0x779d('0x51'),'views',_0x779d('0x76')),{'interaction':_0x3485a2})['then'](function(_0x5aeece){var _0x4a203a=path[_0x779d('0x55')](_0x42ecc1,_0x779d('0x77')+_0x2ee135['id']+'-'+_0x3bfd90+_0x779d('0x78'));var _0x55d238={'path':_0x4a203a,'channel':_0x779d('0x69'),'interactionId':_0x2ee135['id']};return pdf[_0x779d('0x79')](_0x5aeece,_0x55d238);})[_0x779d('0x18')](function(){return new BPromise(function(_0x2e7ea2,_0x14b922){zipdir(_0x42ecc1,{'saveTo':_0x295fd3},function(_0x59ddf7,_0x4d7425){if(_0x59ddf7)return _0x14b922(_0x59ddf7);return _0x2e7ea2(_0x4d7425);});})['then'](function(){return new BPromise(function(_0xb13ee7,_0x510582){rimraf(_0x42ecc1,function(_0xd87557){if(_0xd87557)_0x510582(_0xd87557);return _0xb13ee7();});});})['then'](function(){return _0x46f6c5[_0x779d('0x4f')](_0x295fd3,_0x1e789a,function(_0x3b538b){if(_0x3b538b){console['log'](_0x779d('0x7a'),_0x3b538b);}else{fs['unlinkSync'](_0x295fd3);}});});});}else{return _0x46f6c5[_0x779d('0x1a')](0xc8);}})['catch'](handleError(_0x46f6c5,null));}; \ No newline at end of file +var _0xf081=['rows','addTags','omit','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','tmp','root','server','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','lastName','attachments','Attachment','Messages','direction','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','filter','createReadStream','pipe','createWriteStream','basename','createdAt','System','out','secret','value','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end','status','json','offset','undefined','count','limit','update','then','destroy','sendStatus','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','order','sort','where','$gte','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x180d0d,_0x53672d){var _0x54362e=function(_0x1e66e4){while(--_0x1e66e4){_0x180d0d['push'](_0x180d0d['shift']());}};_0x54362e(++_0x53672d);}(_0xf081,0x130));var _0x1f08=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xf081[_0x1da527];return _0x40fc7c;};'use strict';var rimraf=require(_0x1f08('0x0'));var zipdir=require(_0x1f08('0x1'));var moment=require(_0x1f08('0x2'));var BPromise=require(_0x1f08('0x3'));var util=require(_0x1f08('0x4'));var path=require(_0x1f08('0x5'));var ejs=require(_0x1f08('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1f08('0x7'));var interaction=require(_0x1f08('0x8'));var qs=require(_0x1f08('0x9'));var pdf=require(_0x1f08('0xa'));var logger=require(_0x1f08('0xb'))('api');var config=require(_0x1f08('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1f08('0xd')](config[_0x1f08('0xe')],{'host':_0x1f08('0xf'),'port':0x18eb});var socket=require(_0x1f08('0x10'))(new Redis(config['redis']));require(_0x1f08('0x11'))[_0x1f08('0x12')](socket);function respondWithStatusCode(_0x1cc41c,_0x13921f){_0x13921f=_0x13921f||0xcc;return function(_0x480003){if(_0x480003){return _0x1cc41c['sendStatus'](_0x13921f);}return _0x1cc41c['status'](_0x13921f)[_0x1f08('0x13')]();};}function respondWithResult(_0x1b762b,_0x1a1a91){_0x1a1a91=_0x1a1a91||0xc8;return function(_0x309af9){if(_0x309af9){return _0x1b762b[_0x1f08('0x14')](_0x1a1a91)[_0x1f08('0x15')](_0x309af9);}};}function respondWithFilteredResult(_0x5f166d,_0x44f483){return function(_0x194a92){if(_0x194a92){var _0xfd5221=typeof _0x44f483[_0x1f08('0x16')]===_0x1f08('0x17')&&typeof _0x44f483['limit']==='undefined';var _0x447b42=_0x194a92[_0x1f08('0x18')];var _0xc7e8a=_0xfd5221?0x0:_0x44f483['offset'];var _0x135e5d=_0xfd5221?_0x194a92[_0x1f08('0x18')]:_0x44f483['offset']+_0x44f483[_0x1f08('0x19')];var _0x39695b;if(_0x135e5d>=_0x447b42){_0x135e5d=_0x447b42;_0x39695b=0xc8;}else{_0x39695b=0xce;}_0x5f166d[_0x1f08('0x14')](_0x39695b);return _0x5f166d['set']('Content-Range',_0xc7e8a+'-'+_0x135e5d+'/'+_0x447b42)[_0x1f08('0x15')](_0x194a92);}return null;};}function saveUpdates(_0x2fdac0){return function(_0x4878aa){if(_0x4878aa){return _0x4878aa[_0x1f08('0x1a')](_0x2fdac0)[_0x1f08('0x1b')](function(_0x156968){return _0x156968;});}return null;};}function removeEntity(_0x2cc610){return function(_0x487c1f){if(_0x487c1f){return _0x487c1f[_0x1f08('0x1c')]()[_0x1f08('0x1b')](function(){_0x2cc610['status'](0xcc)[_0x1f08('0x13')]();});}};}function handleEntityNotFound(_0x354fb1){return function(_0x2874b4){if(!_0x2874b4){_0x354fb1[_0x1f08('0x1d')](0x194);}return _0x2874b4;};}function handleError(_0x83726e,_0xa7889d){_0xa7889d=_0xa7889d||0x1f4;return function(_0x418c21){logger['error'](_0x418c21[_0x1f08('0x1e')]);if(_0x418c21[_0x1f08('0x1f')]){delete _0x418c21['name'];}_0x83726e[_0x1f08('0x14')](_0xa7889d)['send'](_0x418c21);};}exports[_0x1f08('0x20')]=function(_0x4bea24,_0x190c98){var _0x4b7e2c={};var _0x179530=_[_0x1f08('0x21')](db[_0x1f08('0x22')][_0x1f08('0x23')],function(_0x3be0a5){return{'name':_0x3be0a5[_0x1f08('0x24')],'type':_0x3be0a5[_0x1f08('0x25')][_0x1f08('0x26')]};});_0x4b7e2c=qs[_0x1f08('0x27')](_0x179530,_0x4bea24);return interaction[_0x1f08('0x28')](_0x1f08('0x29'),_0x4bea24[_0x1f08('0x2a')],_0x4bea24[_0x1f08('0x2b')],_0x4b7e2c,_0x179530)[_0x1f08('0x1b')](respondWithFilteredResult(_0x190c98,_0x4b7e2c))['catch'](handleError(_0x190c98,null));};exports[_0x1f08('0x2c')]=function(_0x423b1b,_0x531137){var _0x1c870d={'raw':![],'where':{'id':_0x423b1b[_0x1f08('0x2d')]['id']}},_0x1f47a1={};_0x1f47a1[_0x1f08('0x2e')]=_[_0x1f08('0x2f')](db['WhatsappInteraction'][_0x1f08('0x23')]);_0x1f47a1[_0x1f08('0x2a')]=_[_0x1f08('0x2f')](_0x423b1b[_0x1f08('0x2a')]);_0x1f47a1[_0x1f08('0x30')]=_[_0x1f08('0x31')](_0x1f47a1[_0x1f08('0x2e')],_0x1f47a1[_0x1f08('0x2a')]);_0x1c870d[_0x1f08('0x32')]=_['intersection'](_0x1f47a1[_0x1f08('0x2e')],qs['fields'](_0x423b1b['query'][_0x1f08('0x33')]));_0x1c870d[_0x1f08('0x32')]=_0x1c870d[_0x1f08('0x32')][_0x1f08('0x34')]?_0x1c870d[_0x1f08('0x32')]:_0x1f47a1[_0x1f08('0x2e')];if(_0x423b1b[_0x1f08('0x2a')][_0x1f08('0x35')]){_0x1c870d[_0x1f08('0x36')]=[{'all':!![]}];}_0x1c870d=_[_0x1f08('0x37')]({},_0x1c870d,_0x423b1b[_0x1f08('0x38')]);return db[_0x1f08('0x22')][_0x1f08('0x39')](_0x1c870d)['then'](handleEntityNotFound(_0x531137,null))['then'](respondWithResult(_0x531137,null))[_0x1f08('0x3a')](handleError(_0x531137,null));};exports[_0x1f08('0x3b')]=function(_0x415faa,_0x32c270){return db['WhatsappInteraction']['create'](_0x415faa[_0x1f08('0x3c')],{})['then'](respondWithResult(_0x32c270,0xc9))['catch'](handleError(_0x32c270,null));};exports[_0x1f08('0x1a')]=function(_0x3bc123,_0x2617d4){if(_0x3bc123[_0x1f08('0x3c')]['id']){delete _0x3bc123[_0x1f08('0x3c')]['id'];}return db[_0x1f08('0x22')][_0x1f08('0x39')]({'where':{'id':_0x3bc123[_0x1f08('0x2d')]['id']}})[_0x1f08('0x1b')](handleEntityNotFound(_0x2617d4,null))['then'](saveUpdates(_0x3bc123['body'],null))[_0x1f08('0x1b')](respondWithResult(_0x2617d4,null))[_0x1f08('0x3a')](handleError(_0x2617d4,null));};exports['destroy']=function(_0xc65346,_0x682205){return db['WhatsappInteraction'][_0x1f08('0x39')]({'where':{'id':_0xc65346[_0x1f08('0x2d')]['id']}})[_0x1f08('0x1b')](handleEntityNotFound(_0x682205,null))['then'](removeEntity(_0x682205,null))[_0x1f08('0x3a')](handleError(_0x682205,null));};exports[_0x1f08('0x3d')]=function(_0x1a85af,_0x2f0b09){return db['WhatsappInteraction'][_0x1f08('0x3d')]()[_0x1f08('0x1b')](respondWithResult(_0x2f0b09,null))[_0x1f08('0x3a')](handleError(_0x2f0b09,null));};exports[_0x1f08('0x3e')]=function(_0x3abe20,_0x50f66f){return db[_0x1f08('0x3f')]['find']({'where':{'id':_0x3abe20[_0x1f08('0x2d')]['id']}})[_0x1f08('0x1b')](handleEntityNotFound(_0x50f66f,null))[_0x1f08('0x1b')](function(_0x231323){if(_0x231323){return _0x231323['addMessage'](_0x3abe20[_0x1f08('0x3c')][_0x1f08('0x40')],_['omit'](_0x3abe20['body'],['ids','id'])||{});}})[_0x1f08('0x1b')](respondWithResult(_0x50f66f,null))['catch'](handleError(_0x50f66f,null));};exports[_0x1f08('0x41')]=function(_0x39bd0d,_0x27ba8d){var _0x2ae6a2={'raw':![],'where':{}};var _0x2e70a3={};var _0x389d74={'count':0x0,'rows':[]};return db[_0x1f08('0x22')][_0x1f08('0x42')]({'where':{'id':_0x39bd0d['params']['id']}})[_0x1f08('0x1b')](handleEntityNotFound(_0x27ba8d,null))[_0x1f08('0x1b')](function(_0x4bbae7){if(_0x4bbae7){_0x2e70a3[_0x1f08('0x2e')]=_[_0x1f08('0x2f')](db['WhatsappMessage'][_0x1f08('0x23')]);_0x2e70a3[_0x1f08('0x2a')]=_[_0x1f08('0x2f')](_0x39bd0d[_0x1f08('0x2a')]);_0x2e70a3[_0x1f08('0x30')]=_[_0x1f08('0x31')](_0x2e70a3['model'],_0x2e70a3[_0x1f08('0x2a')]);_0x2ae6a2['attributes']=_[_0x1f08('0x31')](_0x2e70a3[_0x1f08('0x2e')],qs[_0x1f08('0x33')](_0x39bd0d[_0x1f08('0x2a')]['fields']));_0x2ae6a2['attributes']=_0x2ae6a2[_0x1f08('0x32')][_0x1f08('0x34')]?_0x2ae6a2['attributes']:_0x2e70a3['model'];if(!_0x39bd0d['query'][_0x1f08('0x43')]('nolimit')){_0x2ae6a2[_0x1f08('0x19')]=qs['limit'](_0x39bd0d[_0x1f08('0x2a')][_0x1f08('0x19')]);_0x2ae6a2[_0x1f08('0x16')]=qs['offset'](_0x39bd0d[_0x1f08('0x2a')][_0x1f08('0x16')]);}_0x2ae6a2[_0x1f08('0x44')]=qs[_0x1f08('0x45')](_0x39bd0d[_0x1f08('0x2a')][_0x1f08('0x45')]);_0x2ae6a2['where']=qs['filters'](_['pick'](_0x39bd0d['query'],_0x2e70a3['filters']));_0x2ae6a2[_0x1f08('0x46')]['WhatsappInteractionId']=_0x4bbae7['id'];if(_0x39bd0d[_0x1f08('0x2a')]['filter']){_0x2ae6a2['where']=_[_0x1f08('0x37')](_0x2ae6a2[_0x1f08('0x46')],{'$or':_['map'](_0x2ae6a2['attributes'],function(_0x4488a3){var _0x15e9c6={};_0x15e9c6[_0x4488a3]={'$like':'%'+_0x39bd0d['query']['filter']+'%'};return _0x15e9c6;})});}if(_0x39bd0d[_0x1f08('0x2a')]['$gte']){var _0x4c1b68=_0x39bd0d[_0x1f08('0x2a')][_0x1f08('0x47')]['split'](',');var _0x3ad738={};_0x3ad738[_0x4c1b68[0x0]]={'$gte':moment(_0x4c1b68[0x1])[_0x1f08('0x48')](_0x1f08('0x49'))};_0x2ae6a2[_0x1f08('0x46')]=_[_0x1f08('0x37')](_0x2ae6a2[_0x1f08('0x46')],_0x3ad738);}_0x2ae6a2=_[_0x1f08('0x37')]({},_0x2ae6a2,_0x39bd0d[_0x1f08('0x38')]);return db[_0x1f08('0x3f')][_0x1f08('0x18')]({'where':_0x2ae6a2[_0x1f08('0x46')]})['then'](function(_0x4bbf6d){_0x389d74[_0x1f08('0x18')]=_0x4bbf6d;if(_0x39bd0d[_0x1f08('0x2a')][_0x1f08('0x35')]){_0x2ae6a2['include']=[{'all':!![]}];}return db[_0x1f08('0x3f')][_0x1f08('0x28')](_0x2ae6a2);})['then'](function(_0x1322fe){_0x389d74[_0x1f08('0x4a')]=_0x1322fe;return _0x389d74;});}})[_0x1f08('0x1b')](respondWithFilteredResult(_0x27ba8d,_0x2ae6a2))[_0x1f08('0x3a')](handleError(_0x27ba8d,null));};exports[_0x1f08('0x4b')]=function(_0x37720e,_0x4af2b1){return db[_0x1f08('0x22')][_0x1f08('0x39')]({'where':{'id':_0x37720e['params']['id']}})[_0x1f08('0x1b')](handleEntityNotFound(_0x4af2b1,null))['then'](function(_0x1d02c7){if(_0x1d02c7){return _0x1d02c7['setTags'](_0x37720e['body'][_0x1f08('0x40')],_[_0x1f08('0x4c')](_0x37720e[_0x1f08('0x3c')],[_0x1f08('0x40'),'id'])||{})[_0x1f08('0x4d')](function(){return db[_0x1f08('0x4e')][_0x1f08('0x28')]({'attributes':['id',_0x1f08('0x1f'),_0x1f08('0x4f')],'where':{'id':_0x37720e[_0x1f08('0x3c')][_0x1f08('0x40')]}});})[_0x1f08('0x1b')](function(_0x46a7bf){socket[_0x1f08('0x50')](_0x1f08('0x51'),{'id':Number(_0x37720e[_0x1f08('0x2d')]['id']),'tags':_0x46a7bf||[]});return{'id':Number(_0x37720e[_0x1f08('0x2d')]['id']),'tags':_0x46a7bf||[]};});}})[_0x1f08('0x1b')](respondWithResult(_0x4af2b1,null))[_0x1f08('0x3a')](handleError(_0x4af2b1,null));};exports[_0x1f08('0x52')]=function(_0x4b4b4e,_0x2de9af){return db[_0x1f08('0x22')]['find']({'where':{'id':_0x4b4b4e[_0x1f08('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2de9af,null))[_0x1f08('0x1b')](function(_0x3c978f){if(_0x3c978f){return _0x3c978f[_0x1f08('0x52')](_0x4b4b4e[_0x1f08('0x2a')]['ids']);}})[_0x1f08('0x1b')](respondWithStatusCode(_0x2de9af,null))[_0x1f08('0x3a')](handleError(_0x2de9af,null));};exports[_0x1f08('0x53')]=function(_0x44ce4a,_0x3a3cbd){var _0x223174=moment()[_0x1f08('0x54')]()[_0x1f08('0x55')]();var _0x4d26a0=path[_0x1f08('0x56')](config['root'],'server','files',_0x1f08('0x57'));var _0x3f9bec=path[_0x1f08('0x56')](config[_0x1f08('0x58')],_0x1f08('0x59'),'files','attachments');var _0x3a03c6=path[_0x1f08('0x56')](_0x4d26a0,_0x223174);var _0x5625c3=util[_0x1f08('0x48')](_0x1f08('0x5a'),_0x44ce4a[_0x1f08('0x2d')]['id'],_0x223174);var _0x4a2e4e=path[_0x1f08('0x56')](_0x4d26a0,_0x5625c3);var _0x6f5153=[];_0x6f5153['push']({'model':db[_0x1f08('0x5b')],'as':_0x1f08('0x5b'),'attributes':['id',_0x1f08('0x5c')],'raw':!![]});_0x6f5153[_0x1f08('0x5d')]({'model':db['CmContact'],'as':_0x1f08('0x5e'),'attributes':['id',_0x1f08('0x5f'),_0x1f08('0x60')],'raw':!![]});if(_0x44ce4a['query'][_0x1f08('0x61')]){_0x6f5153[_0x1f08('0x5d')]({'model':db[_0x1f08('0x62')],'as':'Attachment','raw':!![]});}var _0x169b51=[{'model':db[_0x1f08('0x3f')],'as':_0x1f08('0x63'),'attributes':['id',_0x1f08('0x3c'),'createdAt',_0x1f08('0x64'),'secret',_0x1f08('0x65')],'include':_0x6f5153}];_0x169b51[_0x1f08('0x5d')]({'model':db[_0x1f08('0x66')],'as':_0x1f08('0x67'),'attributes':['id',_0x1f08('0x1f')]});_0x169b51[_0x1f08('0x5d')]({'model':db[_0x1f08('0x5b')],'as':_0x1f08('0x68'),'attributes':['id','fullname']});return db[_0x1f08('0x22')][_0x1f08('0x39')]({'where':{'id':_0x44ce4a['params']['id']},'include':_0x169b51})[_0x1f08('0x1b')](handleEntityNotFound(_0x3a3cbd,null))[_0x1f08('0x1b')](function(_0x4161da){if(_0x4161da){var _0x1d4f95=_0x4161da[_0x1f08('0x69')]({'plain':!![]});fs[_0x1f08('0x6a')](_0x3a03c6);var _0x51a51d={'channel':_0x1f08('0x6b'),'account':_0x1d4f95['Account'][_0x1f08('0x1f')],'agent':_0x1d4f95[_0x1f08('0x68')]?_0x1d4f95[_0x1f08('0x68')]['fullname']:_0x1f08('0x6c'),'createdAt':moment(_0x1d4f95['createdAt'])[_0x1f08('0x48')](_0x1f08('0x49'))['toString'](),'closedAt':_0x1d4f95['closed']?moment(_0x1d4f95[_0x1f08('0x6d')])[_0x1f08('0x48')](_0x1f08('0x49'))[_0x1f08('0x55')]():'','disposition':_0x1d4f95[_0x1f08('0x6e')],'messages':_(_0x1d4f95[_0x1f08('0x63')])[_0x1f08('0x6f')]({'secret':![]})[_0x1f08('0x21')](function(_0x43d2c2){if(_0x43d2c2[_0x1f08('0x62')]){var _0x1beb14=path[_0x1f08('0x56')](_0x3f9bec,_0x43d2c2[_0x1f08('0x62')]['basename']);if(fs['existsSync'](_0x1beb14)){fs[_0x1f08('0x70')](_0x1beb14)[_0x1f08('0x71')](fs[_0x1f08('0x72')](path[_0x1f08('0x56')](_0x3a03c6,_0x43d2c2['Attachment'][_0x1f08('0x73')])));}}return{'date':moment(_0x43d2c2[_0x1f08('0x74')])['format'](_0x1f08('0x49'))[_0x1f08('0x55')](),'sender':_0x43d2c2[_0x1f08('0x64')]==='out'?_0x43d2c2[_0x1f08('0x5b')]?_0x43d2c2[_0x1f08('0x5b')]['fullname']:_0x1f08('0x75'):_0x43d2c2['Contact'][_0x1f08('0x5f')]+(_0x43d2c2[_0x1f08('0x5e')][_0x1f08('0x60')]?'\x20'+_0x43d2c2[_0x1f08('0x5e')][_0x1f08('0x60')]:''),'body':_0x43d2c2[_0x1f08('0x62')]?_0x43d2c2[_0x1f08('0x62')]['basename']:_0x43d2c2[_0x1f08('0x3c')],'direction':_0x43d2c2[_0x1f08('0x64')]===_0x1f08('0x76')?'A':'C','secret':_0x43d2c2[_0x1f08('0x77')],'read':_0x43d2c2['read'],'attachment':_0x43d2c2['Attachment']};})[_0x1f08('0x78')]()};return ejs[_0x1f08('0x79')](path[_0x1f08('0x56')](config[_0x1f08('0x58')],'server','views',_0x1f08('0x7a')),{'interaction':_0x51a51d})['then'](function(_0xd84e6e){var _0x2ea324=path[_0x1f08('0x56')](_0x3a03c6,'transcript-'+_0x1d4f95['id']+'-'+_0x223174+_0x1f08('0x7b'));var _0x20ec91={'path':_0x2ea324,'channel':'Whatsapp','interactionId':_0x1d4f95['id']};return pdf[_0x1f08('0x7c')](_0xd84e6e,_0x20ec91);})['then'](function(){return new BPromise(function(_0x99300e,_0x571281){zipdir(_0x3a03c6,{'saveTo':_0x4a2e4e},function(_0x15b05d,_0x59971f){if(_0x15b05d)return _0x571281(_0x15b05d);return _0x99300e(_0x59971f);});})[_0x1f08('0x1b')](function(){return new BPromise(function(_0x29f77c,_0x42837b){rimraf(_0x3a03c6,function(_0x459ba8){if(_0x459ba8)_0x42837b(_0x459ba8);return _0x29f77c();});});})[_0x1f08('0x1b')](function(){return _0x3a3cbd[_0x1f08('0x53')](_0x4a2e4e,_0x5625c3,function(_0x2422b6){if(_0x2422b6){console['log'](_0x1f08('0x7d'),_0x2422b6);}else{fs['unlinkSync'](_0x4a2e4e);}});});});}else{return _0x3a3cbd[_0x1f08('0x1d')](0xc8);}})[_0x1f08('0x3a')](handleError(_0x3a3cbd,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 86ce956..9d9b946 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 _0xbdeb=['setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','../../mysqldb'];(function(_0x59a17e,_0x6885a9){var _0x1c2557=function(_0x16a8e){while(--_0x16a8e){_0x59a17e['push'](_0x59a17e['shift']());}};_0x1c2557(++_0x6885a9);}(_0xbdeb,0x6f));var _0xbbde=function(_0x4aeb38,_0x3fb7f4){_0x4aeb38=_0x4aeb38-0x0;var _0x5afbe1=_0xbdeb[_0x4aeb38];return _0x5afbe1;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xbbde('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xbbde('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbbde('0x1')](0x0);var events={'afterCreate':_0xbbde('0x2'),'afterUpdate':_0xbbde('0x3'),'afterDestroy':_0xbbde('0x4')};function emitEvent(_0x5362c3){return function(_0x56c2f0,_0x1037e6,_0x1d4042){_0x56c2f0[_0xbbde('0x5')]({'attributes':['id'],'raw':!![]})[_0xbbde('0x6')](function(_0x5e6273){_0x56c2f0['setDataValue'](_0xbbde('0x7'),_0x5e6273[_0xbbde('0x8')](function(_0x51706d){return{'id':_0x51706d['id']};}));return WhatsappMessage[_0xbbde('0x9')]({'where':{'WhatsappInteractionId':_0x56c2f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbbde('0x6')](function(_0x3164f7){_0x56c2f0[_0xbbde('0xa')](_0xbbde('0xb'),_0x3164f7[_0xbbde('0xc')]);WhatsappInteractionEvents[_0xbbde('0xd')](_0x5362c3+':'+_0x56c2f0['id'],_0x56c2f0);WhatsappInteractionEvents[_0xbbde('0xd')](_0x5362c3,_0x56c2f0);_0x1d4042(null);})[_0xbbde('0xe')](_0x1d4042(null));};}for(var e in events){if(events[_0xbbde('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x263f=['update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0xd70c35,_0x2048eb){var _0x2881cd=function(_0x38e4ac){while(--_0x38e4ac){_0xd70c35['push'](_0xd70c35['shift']());}};_0x2881cd(++_0x2048eb);}(_0x263f,0x182));var _0xf263=function(_0x9bed49,_0x553699){_0x9bed49=_0x9bed49-0x0;var _0x5d0a47=_0x263f[_0x9bed49];return _0x5d0a47;};'use strict';var EventEmitter=require(_0xf263('0x0'));var WhatsappInteraction=require(_0xf263('0x1'))['db'][_0xf263('0x2')];var WhatsappMessage=require(_0xf263('0x1'))['db'][_0xf263('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf263('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf263('0x5'),'afterDestroy':_0xf263('0x6')};function emitEvent(_0x453b6e){return function(_0x528b98,_0xbd1369,_0xdb2fc1){_0x528b98['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0xa2b1b0){_0x528b98[_0xf263('0x7')](_0xf263('0x8'),_0xa2b1b0[_0xf263('0x9')](function(_0x5dcaa0){return{'id':_0x5dcaa0['id']};}));return WhatsappMessage[_0xf263('0xa')]({'where':{'WhatsappInteractionId':_0x528b98['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf263('0xb')](function(_0x3d8092){_0x528b98[_0xf263('0x7')](_0xf263('0xc'),_0x3d8092[_0xf263('0xd')]);WhatsappInteractionEvents[_0xf263('0xe')](_0x453b6e+':'+_0x528b98['id'],_0x528b98);WhatsappInteractionEvents['emit'](_0x453b6e,_0x528b98);_0xdb2fc1(null);})[_0xf263('0xf')](_0xdb2fc1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xf263('0x10')](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 06b2993..039e5cb 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 _0x7792=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x7792,0x131));var _0x2779=function(_0x48c998,_0x37d255){_0x48c998=_0x48c998-0x0;var _0x59c2a2=_0x7792[_0x48c998];return _0x59c2a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2779('0x0'))(_0x2779('0x1'));var moment=require(_0x2779('0x2'));var BPromise=require(_0x2779('0x3'));var rp=require(_0x2779('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2779('0x5'));var config=require(_0x2779('0x6'));var attributes=require(_0x2779('0x7'));module[_0x2779('0x8')]=function(_0x5ae4c4,_0x4a6692){return _0x5ae4c4[_0x2779('0x9')](_0x2779('0xa'),attributes,{'tableName':_0x2779('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f2717,_0x478e4b,_0x3cd5fd){if(_0x2f2717[_0x2779('0xc')](_0x2779('0xd'))){_0x2f2717[_0x2779('0xe')]=moment()[_0x2779('0xf')](_0x2779('0x10'));}_0x3cd5fd(null,_0x2f2717);}}});}; \ No newline at end of file +var _0xf0c4=['request-promise','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2ad5e8,_0x19d6b0){var _0x309820=function(_0x4d507b){while(--_0x4d507b){_0x2ad5e8['push'](_0x2ad5e8['shift']());}};_0x309820(++_0x19d6b0);}(_0xf0c4,0x15b));var _0x4f0c=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0xf0c4[_0x34bd34];return _0x4e36d6;};'use strict';var _=require(_0x4f0c('0x0'));var util=require(_0x4f0c('0x1'));var logger=require(_0x4f0c('0x2'))('api');var moment=require(_0x4f0c('0x3'));var BPromise=require(_0x4f0c('0x4'));var rp=require(_0x4f0c('0x5'));var fs=require('fs');var path=require(_0x4f0c('0x6'));var rimraf=require('rimraf');var config=require(_0x4f0c('0x7'));var attributes=require(_0x4f0c('0x8'));module['exports']=function(_0x7e8f31,_0x1f29ea){return _0x7e8f31[_0x4f0c('0x9')](_0x4f0c('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x281fe0,_0x5e0f31,_0x47c7cf){if(_0x281fe0[_0x4f0c('0xb')](_0x4f0c('0xc'))){_0x281fe0[_0x4f0c('0xd')]=moment()[_0x4f0c('0xe')](_0x4f0c('0xf'));}_0x47c7cf(null,_0x281fe0);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 0c4340d..136d626 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 _0x4a7f=['stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','limit','catch','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x291c93,_0x536250){var _0x27d898=function(_0x4c708a){while(--_0x4c708a){_0x291c93['push'](_0x291c93['shift']());}};_0x27d898(++_0x536250);}(_0x4a7f,0x1f3));var _0xf4a7=function(_0x1f39fc,_0x2cae43){_0x1f39fc=_0x1f39fc-0x0;var _0x538504=_0x4a7f[_0x1f39fc];return _0x538504;};'use strict';var _=require('lodash');var util=require(_0xf4a7('0x0'));var moment=require(_0xf4a7('0x1'));var BPromise=require(_0xf4a7('0x2'));var rs=require(_0xf4a7('0x3'));var fs=require('fs');var Redis=require(_0xf4a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4a7('0x5'));var logger=require(_0xf4a7('0x6'))(_0xf4a7('0x7'));var config=require(_0xf4a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf4a7('0x9')][_0xf4a7('0xa')]({'port':0x232a});config[_0xf4a7('0xb')]=_[_0xf4a7('0xc')](config['redis'],{'host':_0xf4a7('0xd'),'port':0x18eb});var socket=require(_0xf4a7('0xe'))(new Redis(config['redis']));require(_0xf4a7('0xf'))['register'](socket);function respondWithRpcPromise(_0x653d5a,_0x14bbc6,_0x3a6e64){return new BPromise(function(_0x5089eb,_0x360cd3){return client['request'](_0x653d5a,_0x3a6e64)[_0xf4a7('0x10')](function(_0x57d9b9){logger[_0xf4a7('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x14bbc6,_0xf4a7('0x12'));logger[_0xf4a7('0x13')](_0xf4a7('0x14'),_0x14bbc6,_0xf4a7('0x12'),JSON[_0xf4a7('0x15')](_0x57d9b9));if(_0x57d9b9[_0xf4a7('0x16')]){if(_0x57d9b9['error'][_0xf4a7('0x17')]===0x1f4){logger[_0xf4a7('0x16')](_0xf4a7('0x18'),_0x14bbc6,_0x57d9b9[_0xf4a7('0x16')]['message']);return _0x360cd3(_0x57d9b9[_0xf4a7('0x16')]['message']);}logger[_0xf4a7('0x16')](_0xf4a7('0x18'),_0x14bbc6,_0x57d9b9['error'][_0xf4a7('0x19')]);return _0x5089eb(_0x57d9b9[_0xf4a7('0x16')][_0xf4a7('0x19')]);}else{logger[_0xf4a7('0x11')](_0xf4a7('0x18'),_0x14bbc6,_0xf4a7('0x12'));_0x5089eb(_0x57d9b9[_0xf4a7('0x1a')][_0xf4a7('0x19')]);}})['catch'](function(_0xba57f5){logger['error'](_0xf4a7('0x18'),_0x14bbc6,_0xba57f5);_0x360cd3(_0xba57f5);});});}exports[_0xf4a7('0x1b')]=function(_0x15799b){var _0x5ae04d=this;return new Promise(function(_0x5dc32b,_0x2f6f5d){return db[_0xf4a7('0x1c')][_0xf4a7('0x1d')](_0x15799b[_0xf4a7('0x1e')],{'raw':_0x15799b['options']?_0x15799b[_0xf4a7('0x1f')][_0xf4a7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15799b[_0xf4a7('0x1f')]?_0x15799b[_0xf4a7('0x1f')]['where']||null:null,'attributes':_0x15799b[_0xf4a7('0x1f')]?_0x15799b[_0xf4a7('0x1f')]['attributes']||null:null,'limit':_0x15799b[_0xf4a7('0x1f')]?_0x15799b[_0xf4a7('0x1f')][_0xf4a7('0x21')]||null:null})[_0xf4a7('0x10')](function(_0x40f5ff){logger[_0xf4a7('0x11')](_0xf4a7('0x1b'),_0x15799b);logger[_0xf4a7('0x13')](_0xf4a7('0x1b'),_0x15799b,JSON[_0xf4a7('0x15')](_0x40f5ff));_0x5dc32b(_0x40f5ff);})[_0xf4a7('0x22')](function(_0xae9189){logger[_0xf4a7('0x16')](_0xf4a7('0x1b'),_0xae9189[_0xf4a7('0x19')],_0x15799b);_0x2f6f5d(_0x5ae04d[_0xf4a7('0x16')](0x1f4,_0xae9189[_0xf4a7('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0xe4809d){return new Promise(function(_0x32c2d0,_0x51fbca){return db[_0xf4a7('0x1c')][_0xf4a7('0x23')]({'where':_0xe4809d[_0xf4a7('0x1f')]?_0xe4809d[_0xf4a7('0x1f')]['where']||null:null})[_0xf4a7('0x10')](function(_0xae575b){if(_0xae575b){return _0xae575b[_0xf4a7('0x24')](_0xe4809d[_0xf4a7('0x1e')][_0xf4a7('0x25')],_['omit'](_0xe4809d[_0xf4a7('0x1e')],['ids','id'])||{});}})[_0xf4a7('0x26')](function(_0x14fe60){logger[_0xf4a7('0x11')]('AddTags',_0xe4809d);logger[_0xf4a7('0x13')](_0xf4a7('0x27'),_0xe4809d,JSON[_0xf4a7('0x15')](_0x14fe60));_0x32c2d0(_0x14fe60);})[_0xf4a7('0x22')](function(_0x4c741f){logger[_0xf4a7('0x16')]('AddTags',_0x4c741f[_0xf4a7('0x19')],_0xe4809d);_0x51fbca(_this['error'](0x1f4,_0x4c741f[_0xf4a7('0x19')]));});});}; \ No newline at end of file +var _0xfa19=['defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','find','omit','ids','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis'];(function(_0x30bdb1,_0x256980){var _0x24ec9d=function(_0x1c6925){while(--_0x1c6925){_0x30bdb1['push'](_0x30bdb1['shift']());}};_0x24ec9d(++_0x256980);}(_0xfa19,0xc2));var _0x9fa1=function(_0x2bc143,_0x3f38c8){_0x2bc143=_0x2bc143-0x0;var _0x2ec236=_0xfa19[_0x2bc143];return _0x2ec236;};'use strict';var _=require(_0x9fa1('0x0'));var util=require(_0x9fa1('0x1'));var moment=require('moment');var BPromise=require(_0x9fa1('0x2'));var rs=require(_0x9fa1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fa1('0x4'))['db'];var utils=require(_0x9fa1('0x5'));var logger=require(_0x9fa1('0x6'))(_0x9fa1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9fa1('0x8')][_0x9fa1('0x9')]({'port':0x232a});config[_0x9fa1('0xa')]=_[_0x9fa1('0xb')](config[_0x9fa1('0xa')],{'host':_0x9fa1('0xc'),'port':0x18eb});var socket=require(_0x9fa1('0xd'))(new Redis(config[_0x9fa1('0xa')]));require(_0x9fa1('0xe'))[_0x9fa1('0xf')](socket);function respondWithRpcPromise(_0x48df06,_0x244217,_0x31d914){return new BPromise(function(_0x267456,_0x5ea780){return client[_0x9fa1('0x10')](_0x48df06,_0x31d914)[_0x9fa1('0x11')](function(_0x1ad694){logger[_0x9fa1('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x244217,_0x9fa1('0x13'));logger[_0x9fa1('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x244217,'request\x20sent',JSON[_0x9fa1('0x15')](_0x1ad694));if(_0x1ad694[_0x9fa1('0x16')]){if(_0x1ad694[_0x9fa1('0x16')][_0x9fa1('0x17')]===0x1f4){logger[_0x9fa1('0x16')](_0x9fa1('0x18'),_0x244217,_0x1ad694[_0x9fa1('0x16')][_0x9fa1('0x19')]);return _0x5ea780(_0x1ad694[_0x9fa1('0x16')][_0x9fa1('0x19')]);}logger[_0x9fa1('0x16')](_0x9fa1('0x18'),_0x244217,_0x1ad694[_0x9fa1('0x16')][_0x9fa1('0x19')]);return _0x267456(_0x1ad694[_0x9fa1('0x16')][_0x9fa1('0x19')]);}else{logger[_0x9fa1('0x12')](_0x9fa1('0x18'),_0x244217,_0x9fa1('0x13'));_0x267456(_0x1ad694[_0x9fa1('0x1a')][_0x9fa1('0x19')]);}})[_0x9fa1('0x1b')](function(_0x5df7eb){logger[_0x9fa1('0x16')](_0x9fa1('0x18'),_0x244217,_0x5df7eb);_0x5ea780(_0x5df7eb);});});}exports[_0x9fa1('0x1c')]=function(_0x1a114b){var _0x5e0ff1=this;return new Promise(function(_0x5bd50a,_0x1ea231){return db[_0x9fa1('0x1d')][_0x9fa1('0x1e')](_0x1a114b[_0x9fa1('0x1f')],{'raw':_0x1a114b['options']?_0x1a114b[_0x9fa1('0x20')][_0x9fa1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a114b[_0x9fa1('0x20')]?_0x1a114b[_0x9fa1('0x20')][_0x9fa1('0x22')]||null:null,'attributes':_0x1a114b[_0x9fa1('0x20')]?_0x1a114b[_0x9fa1('0x20')][_0x9fa1('0x23')]||null:null,'limit':_0x1a114b['options']?_0x1a114b[_0x9fa1('0x20')][_0x9fa1('0x24')]||null:null})['then'](function(_0x573df1){logger[_0x9fa1('0x12')]('UpdateWhatsappInteraction',_0x1a114b);logger[_0x9fa1('0x14')](_0x9fa1('0x1c'),_0x1a114b,JSON[_0x9fa1('0x15')](_0x573df1));_0x5bd50a(_0x573df1);})[_0x9fa1('0x1b')](function(_0x104440){logger[_0x9fa1('0x16')](_0x9fa1('0x1c'),_0x104440['message'],_0x1a114b);_0x1ea231(_0x5e0ff1[_0x9fa1('0x16')](0x1f4,_0x104440[_0x9fa1('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x54b4b3){return new Promise(function(_0x10161b,_0x5ec4b5){return db['WhatsappInteraction'][_0x9fa1('0x25')]({'where':_0x54b4b3['options']?_0x54b4b3[_0x9fa1('0x20')][_0x9fa1('0x22')]||null:null})[_0x9fa1('0x11')](function(_0x3f5792){if(_0x3f5792){return _0x3f5792['addTags'](_0x54b4b3['body']['ids'],_[_0x9fa1('0x26')](_0x54b4b3[_0x9fa1('0x1f')],[_0x9fa1('0x27'),'id'])||{});}})['spread'](function(_0x121e08){logger[_0x9fa1('0x12')](_0x9fa1('0x28'),_0x54b4b3);logger[_0x9fa1('0x14')](_0x9fa1('0x28'),_0x54b4b3,JSON['stringify'](_0x121e08));_0x10161b(_0x121e08);})['catch'](function(_0x2e2889){logger[_0x9fa1('0x16')](_0x9fa1('0x28'),_0x2e2889[_0x9fa1('0x19')],_0x54b4b3);_0x5ec4b5(_this[_0x9fa1('0x16')](0x1f4,_0x2e2889[_0x9fa1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b3bf331..20774d9 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 _0xeaf7=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x3bf9bc,_0x8ccd3f){var _0x2d270d=function(_0x6651bc){while(--_0x6651bc){_0x3bf9bc['push'](_0x3bf9bc['shift']());}};_0x2d270d(++_0x8ccd3f);}(_0xeaf7,0x102));var _0x7eaf=function(_0x2c347c,_0x5ba2dd){_0x2c347c=_0x2c347c-0x0;var _0x1aebab=_0xeaf7[_0x2c347c];return _0x1aebab;};'use strict';var WhatsappInteractionEvents=require(_0x7eaf('0x0'));var events=[_0x7eaf('0x1'),_0x7eaf('0x2'),_0x7eaf('0x3')];function createListener(_0x175e59,_0x20fd22){return function(_0x419636){_0x20fd22[_0x7eaf('0x4')](_0x175e59,_0x419636);};}function removeListener(_0x20a5a4,_0x3339ad){return function(){WhatsappInteractionEvents[_0x7eaf('0x5')](_0x20a5a4,_0x3339ad);};}exports['register']=function(_0x4ab83d){for(var _0x4b78ba=0x0,_0x2a515b=events[_0x7eaf('0x6')];_0x4b78ba<_0x2a515b;_0x4b78ba++){var _0x33713f=events[_0x4b78ba];var _0x19b4bf=createListener(_0x7eaf('0x7')+_0x33713f,_0x4ab83d);WhatsappInteractionEvents['on'](_0x33713f,_0x19b4bf);}}; \ No newline at end of file +var _0xa1ac=['update','emit','removeListener','register','length','./whatsappInteraction.events'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa1ac,0x149));var _0xca1a=function(_0x293dc5,_0x4d287c){_0x293dc5=_0x293dc5-0x0;var _0x20f166=_0xa1ac[_0x293dc5];return _0x20f166;};'use strict';var WhatsappInteractionEvents=require(_0xca1a('0x0'));var events=['save','remove',_0xca1a('0x1')];function createListener(_0x6745f8,_0x369cbc){return function(_0x12c090){_0x369cbc[_0xca1a('0x2')](_0x6745f8,_0x12c090);};}function removeListener(_0x11cbe3,_0x295176){return function(){WhatsappInteractionEvents[_0xca1a('0x3')](_0x11cbe3,_0x295176);};}exports[_0xca1a('0x4')]=function(_0x2dbb03){for(var _0x5d08b7=0x0,_0x5bd460=events[_0xca1a('0x5')];_0x5d08b7<_0x5bd460;_0x5d08b7++){var _0x144423=events[_0x5d08b7];var _0x6a91cb=createListener('whatsappInteraction:'+_0x144423,_0x2dbb03);WhatsappInteractionEvents['on'](_0x144423,_0x6a91cb);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 35bf012..90e9877 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 _0xd2e1=['delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/:id','show','post','whatsapp','create','/:id/status','update','/:id/accept','/:id/reject'];(function(_0x5e5f9b,_0x508f99){var _0x1f8bfd=function(_0x54a566){while(--_0x54a566){_0x5e5f9b['push'](_0x5e5f9b['shift']());}};_0x1f8bfd(++_0x508f99);}(_0xd2e1,0x1d0));var _0x1d2e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xd2e1[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0x1d2e('0x0'));var util=require(_0x1d2e('0x1'));var path=require(_0x1d2e('0x2'));var timeout=require(_0x1d2e('0x3'));var express=require('express');var router=express[_0x1d2e('0x4')]();var fs_extra=require(_0x1d2e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1d2e('0x6'));var config=require('../../config/environment');var controller=require(_0x1d2e('0x7'));router[_0x1d2e('0x8')]('/',auth[_0x1d2e('0x9')](),controller[_0x1d2e('0xa')]);router[_0x1d2e('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1d2e('0x8')](_0x1d2e('0xb'),auth[_0x1d2e('0x9')](),controller[_0x1d2e('0xc')]);router[_0x1d2e('0xd')]('/',auth[_0x1d2e('0x9')](),interaction['tracked'](_0x1d2e('0xe'),'whatsappmessage:create'),controller[_0x1d2e('0xf')]);router[_0x1d2e('0xd')](_0x1d2e('0x10'),controller['status']);router['put']('/:id',auth[_0x1d2e('0x9')](),controller[_0x1d2e('0x11')]);router['put'](_0x1d2e('0x12'),auth[_0x1d2e('0x9')](),controller['accept']);router['put'](_0x1d2e('0x13'),auth[_0x1d2e('0x9')](),controller['reject']);router[_0x1d2e('0x14')](_0x1d2e('0xb'),auth['isAuthenticated'](),controller[_0x1d2e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbcd1=['whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','reject','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x3e15ee,_0x2f3411){var _0x1fb451=function(_0x827038){while(--_0x827038){_0x3e15ee['push'](_0x3e15ee['shift']());}};_0x1fb451(++_0x2f3411);}(_0xbcd1,0x16b));var _0x1bcd=function(_0x48b5bc,_0xeaa079){_0x48b5bc=_0x48b5bc-0x0;var _0x1beb4d=_0xbcd1[_0x48b5bc];return _0x1beb4d;};'use strict';var multer=require(_0x1bcd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1bcd('0x1'));var router=express['Router']();var fs_extra=require(_0x1bcd('0x2'));var auth=require(_0x1bcd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1bcd('0x4'));var controller=require(_0x1bcd('0x5'));router[_0x1bcd('0x6')]('/',auth[_0x1bcd('0x7')](),controller[_0x1bcd('0x8')]);router['get'](_0x1bcd('0x9'),auth[_0x1bcd('0x7')](),controller[_0x1bcd('0xa')]);router[_0x1bcd('0x6')](_0x1bcd('0xb'),auth[_0x1bcd('0x7')](),controller[_0x1bcd('0xc')]);router[_0x1bcd('0xd')]('/',auth[_0x1bcd('0x7')](),interaction[_0x1bcd('0xe')](_0x1bcd('0xf'),_0x1bcd('0x10')),controller[_0x1bcd('0x11')]);router[_0x1bcd('0xd')](_0x1bcd('0x12'),controller[_0x1bcd('0x13')]);router[_0x1bcd('0x14')](_0x1bcd('0xb'),auth['isAuthenticated'](),controller[_0x1bcd('0x15')]);router[_0x1bcd('0x14')](_0x1bcd('0x16'),auth[_0x1bcd('0x7')](),controller['accept']);router['put']('/:id/reject',auth[_0x1bcd('0x7')](),controller[_0x1bcd('0x17')]);router[_0x1bcd('0x18')](_0x1bcd('0xb'),auth['isAuthenticated'](),controller[_0x1bcd('0x19')]);module[_0x1bcd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3ac9475..d49e8de 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 _0x7136=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x236229,_0x2c2395){var _0x16cc71=function(_0x1c0f73){while(--_0x1c0f73){_0x236229['push'](_0x236229['shift']());}};_0x16cc71(++_0x2c2395);}(_0x7136,0x1c0));var _0x6713=function(_0x17c012,_0x581e0d){_0x17c012=_0x17c012-0x0;var _0x19e62c=_0x7136[_0x17c012];return _0x19e62c;};'use strict';var Sequelize=require(_0x6713('0x0'));module[_0x6713('0x1')]={'body':{'type':Sequelize[_0x6713('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6713('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6713('0x4')]('in',_0x6713('0x5')),'defaultValue':_0x6713('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x6713('0x6')]},'readAt':{'type':Sequelize[_0x6713('0x7')]},'secret':{'type':Sequelize[_0x6713('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6713('0x6')]},'providerResponse':{'type':Sequelize[_0x6713('0x2')]}}; \ No newline at end of file +var _0x5f1d=['TEXT','medium','ENUM','STRING','BOOLEAN','sequelize'];(function(_0x556790,_0x53579a){var _0x10bcdc=function(_0x476aac){while(--_0x476aac){_0x556790['push'](_0x556790['shift']());}};_0x10bcdc(++_0x53579a);}(_0x5f1d,0x17f));var _0xd5f1=function(_0x4ac112,_0x5dc7e0){_0x4ac112=_0x4ac112-0x0;var _0xaeebb3=_0x5f1d[_0x4ac112];return _0xaeebb3;};'use strict';var Sequelize=require(_0xd5f1('0x0'));module['exports']={'body':{'type':Sequelize[_0xd5f1('0x1')](_0xd5f1('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd5f1('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd5f1('0x4')](0xbe)},'phone':{'type':Sequelize[_0xd5f1('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd5f1('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd5f1('0x4')]},'providerResponse':{'type':Sequelize[_0xd5f1('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ab5eb9b..58e2aab 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 _0x838f=['keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','update','find','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','get','WhatsappInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','agent','WhatsappInteractionId','rejectMessage','event','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','MessageStatus','twilio','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key'];(function(_0x111215,_0x49f5aa){var _0x11ecfc=function(_0x398a6b){while(--_0x398a6b){_0x111215['push'](_0x111215['shift']());}};_0x11ecfc(++_0x49f5aa);}(_0x838f,0x162));var _0xf838=function(_0x14c06f,_0x18460b){_0x14c06f=_0x14c06f-0x0;var _0x2d54e2=_0x838f[_0x14c06f];return _0x2d54e2;};'use strict';var emlformat=require(_0xf838('0x0'));var rimraf=require(_0xf838('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf838('0x2'));var rp=require(_0xf838('0x3'));var moment=require(_0xf838('0x4'));var BPromise=require(_0xf838('0x5'));var Mustache=require(_0xf838('0x6'));var util=require(_0xf838('0x7'));var path=require('path');var sox=require(_0xf838('0x8'));var csv=require(_0xf838('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf838('0xa'));var _=require(_0xf838('0xb'));var squel=require('squel');var crypto=require(_0xf838('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf838('0x9'));var querystring=require(_0xf838('0xd'));var Papa=require(_0xf838('0xe'));var Redis=require(_0xf838('0xf'));var authService=require(_0xf838('0x10'));var qs=require(_0xf838('0x11'));var as=require(_0xf838('0x12'));var hardwareService=require(_0xf838('0x13'));var logger=require(_0xf838('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf838('0x15'));var licenseUtil=require(_0xf838('0x16'));var db=require(_0xf838('0x17'))['db'];config[_0xf838('0x18')]=_[_0xf838('0x19')](config[_0xf838('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xf838('0x1a'))(new Redis(config[_0xf838('0x18')]));require(_0xf838('0x1b'))['register'](socket);var jayson=require(_0xf838('0x1c'));var client=jayson[_0xf838('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xf838('0x1d')][_0xf838('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5b3fb0,_0x2702e2,_0x37af71,_0x475367){return new BPromise(function(_0x3d0bb1,_0x39d953){var _0x4e50bd=_0x475367||client;return _0x4e50bd[_0xf838('0x1f')](_0x5b3fb0,_0x37af71)[_0xf838('0x20')](function(_0x43ac44){logger[_0xf838('0x21')](_0xf838('0x22'),_0x2702e2,_0xf838('0x23'));logger['debug'](_0xf838('0x24'),_0x2702e2,_0xf838('0x23'),JSON[_0xf838('0x25')](_0x43ac44));if(_0x43ac44['error']){if(_0x43ac44[_0xf838('0x26')][_0xf838('0x27')]===0x1f4){logger['error'](_0xf838('0x22'),_0x2702e2,_0x43ac44[_0xf838('0x26')][_0xf838('0x28')]);return _0x39d953(_0x43ac44[_0xf838('0x26')][_0xf838('0x28')]);}logger[_0xf838('0x26')](_0xf838('0x22'),_0x2702e2,_0x43ac44[_0xf838('0x26')][_0xf838('0x28')]);return _0x3d0bb1(_0x43ac44[_0xf838('0x26')]['message']);}else{logger['info'](_0xf838('0x22'),_0x2702e2,_0xf838('0x23'));_0x3d0bb1(_0x43ac44[_0xf838('0x29')]['message']);}})[_0xf838('0x2a')](function(_0x318b14){logger[_0xf838('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x2702e2,_0x318b14);_0x39d953(_0x318b14);});});}function respondWithStatusCode(_0x14fbd9,_0x2fe0db){_0x2fe0db=_0x2fe0db||0xcc;return function(_0x70983a){if(_0x70983a){return _0x14fbd9[_0xf838('0x2b')](_0x2fe0db);}return _0x14fbd9[_0xf838('0x2c')](_0x2fe0db)['end']();};}function respondWithResult(_0x2fad7f,_0x4b888d){_0x4b888d=_0x4b888d||0xc8;return function(_0x4fbcdf){if(_0x4fbcdf){return _0x2fad7f['status'](_0x4b888d)[_0xf838('0x2d')](_0x4fbcdf);}};}function respondWithFilteredResult(_0x3e1552,_0xd51c8c){return function(_0xdce69b){if(_0xdce69b){var _0xdf30da=typeof _0xd51c8c['offset']===_0xf838('0x2e')&&typeof _0xd51c8c[_0xf838('0x2f')]===_0xf838('0x2e');var _0x36f12d=_0xdce69b[_0xf838('0x30')];var _0x1252dd=_0xdf30da?0x0:_0xd51c8c[_0xf838('0x31')];var _0x2ec838=_0xdf30da?_0xdce69b['count']:_0xd51c8c[_0xf838('0x31')]+_0xd51c8c[_0xf838('0x2f')];var _0x44c640;if(_0x2ec838>=_0x36f12d){_0x2ec838=_0x36f12d;_0x44c640=0xc8;}else{_0x44c640=0xce;}_0x3e1552[_0xf838('0x2c')](_0x44c640);return _0x3e1552[_0xf838('0x32')](_0xf838('0x33'),_0x1252dd+'-'+_0x2ec838+'/'+_0x36f12d)[_0xf838('0x2d')](_0xdce69b);}return null;};}function patchUpdates(_0x35025b){return function(_0x38ab09){try{jsonpatch['apply'](_0x38ab09,_0x35025b,!![]);}catch(_0x5abb11){return BPromise[_0xf838('0x34')](_0x5abb11);}return _0x38ab09[_0xf838('0x35')]();};}function saveUpdates(_0x4a86b8,_0x1dcebb){return function(_0xec9543){if(_0xec9543){return _0xec9543['update'](_0x4a86b8)[_0xf838('0x20')](function(_0x54ae52){return _0x54ae52;});}return null;};}function removeEntity(_0x43cdaa,_0x375ded){return function(_0x2d331b){if(_0x2d331b){return _0x2d331b['destroy']()['then'](function(){_0x43cdaa[_0xf838('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0f41,_0x50298e){return function(_0x13f95a){if(!_0x13f95a){_0x4f0f41[_0xf838('0x2b')](0x194);}return _0x13f95a;};}function handleError(_0x232645,_0x1ab593){_0x1ab593=_0x1ab593||0x1f4;return function(_0x2d036e){logger[_0xf838('0x26')](_0x2d036e[_0xf838('0x36')]);if(_0x2d036e[_0xf838('0x37')]){delete _0x2d036e[_0xf838('0x37')];}_0x232645[_0xf838('0x2c')](_0x1ab593)[_0xf838('0x38')](_0x2d036e);};}exports[_0xf838('0x39')]=function(_0x356298,_0x51c0d0){var _0x25b1c9={},_0x5cb7b3={},_0x889cd8={'count':0x0,'rows':[]};var _0x5a79bd=_[_0xf838('0x3a')](db[_0xf838('0x3b')][_0xf838('0x3c')],function(_0x560eab){return{'name':_0x560eab['fieldName'],'type':_0x560eab[_0xf838('0x3d')][_0xf838('0x3e')]};});_0x5cb7b3['model']=_[_0xf838('0x3a')](_0x5a79bd,_0xf838('0x37'));_0x5cb7b3['query']=_[_0xf838('0x3f')](_0x356298[_0xf838('0x40')]);_0x5cb7b3[_0xf838('0x41')]=_[_0xf838('0x42')](_0x5cb7b3[_0xf838('0x43')],_0x5cb7b3['query']);_0x25b1c9[_0xf838('0x44')]=_[_0xf838('0x42')](_0x5cb7b3[_0xf838('0x43')],qs['fields'](_0x356298[_0xf838('0x40')][_0xf838('0x45')]));_0x25b1c9['attributes']=_0x25b1c9[_0xf838('0x44')][_0xf838('0x46')]?_0x25b1c9[_0xf838('0x44')]:_0x5cb7b3[_0xf838('0x43')];if(!_0x356298[_0xf838('0x40')][_0xf838('0x47')](_0xf838('0x48'))){_0x25b1c9[_0xf838('0x2f')]=qs[_0xf838('0x2f')](_0x356298['query'][_0xf838('0x2f')]);_0x25b1c9['offset']=qs[_0xf838('0x31')](_0x356298['query'][_0xf838('0x31')]);}_0x25b1c9[_0xf838('0x49')]=qs['sort'](_0x356298['query'][_0xf838('0x4a')]);_0x25b1c9['where']=qs[_0xf838('0x41')](_[_0xf838('0x4b')](_0x356298[_0xf838('0x40')],_0x5cb7b3[_0xf838('0x41')]),_0x5a79bd);if(_0x356298[_0xf838('0x40')]['filter']){_0x25b1c9[_0xf838('0x4c')]=_[_0xf838('0x4d')](_0x25b1c9[_0xf838('0x4c')],{'$or':_[_0xf838('0x3a')](_0x5a79bd,function(_0x2d97bc){if(_0x2d97bc['type']!==_0xf838('0x4e')){var _0x48d6c4={};_0x48d6c4[_0x2d97bc[_0xf838('0x37')]]={'$like':'%'+_0x356298['query'][_0xf838('0x4f')]+'%'};return _0x48d6c4;}})});}_0x25b1c9=_[_0xf838('0x4d')]({},_0x25b1c9,_0x356298[_0xf838('0x50')]);var _0x531ee3={'where':_0x25b1c9['where']};return db[_0xf838('0x3b')][_0xf838('0x30')](_0x531ee3)[_0xf838('0x20')](function(_0x1dc810){_0x889cd8[_0xf838('0x30')]=_0x1dc810;if(_0x356298[_0xf838('0x40')][_0xf838('0x51')]){_0x25b1c9[_0xf838('0x52')]=[{'all':!![]}];}return db[_0xf838('0x3b')][_0xf838('0x53')](_0x25b1c9);})['then'](function(_0x979803){_0x889cd8[_0xf838('0x54')]=_0x979803;return _0x889cd8;})[_0xf838('0x20')](respondWithFilteredResult(_0x51c0d0,_0x25b1c9))[_0xf838('0x2a')](handleError(_0x51c0d0,null));};exports[_0xf838('0x55')]=function(_0x29de26,_0x1ef6ff){var _0x3131be={'raw':!![],'where':{'id':_0x29de26[_0xf838('0x56')]['id']}},_0x488369={};_0x488369[_0xf838('0x43')]=_[_0xf838('0x3f')](db[_0xf838('0x3b')][_0xf838('0x3c')]);_0x488369[_0xf838('0x40')]=_['keys'](_0x29de26[_0xf838('0x40')]);_0x488369[_0xf838('0x41')]=_[_0xf838('0x42')](_0x488369[_0xf838('0x43')],_0x488369[_0xf838('0x40')]);_0x3131be[_0xf838('0x44')]=_[_0xf838('0x42')](_0x488369[_0xf838('0x43')],qs['fields'](_0x29de26[_0xf838('0x40')][_0xf838('0x45')]));_0x3131be[_0xf838('0x44')]=_0x3131be[_0xf838('0x44')][_0xf838('0x46')]?_0x3131be['attributes']:_0x488369['model'];if(_0x29de26[_0xf838('0x40')][_0xf838('0x51')]){_0x3131be['include']=[{'all':!![]}];}_0x3131be=_[_0xf838('0x4d')]({},_0x3131be,_0x29de26[_0xf838('0x50')]);return db[_0xf838('0x3b')]['find'](_0x3131be)[_0xf838('0x20')](handleEntityNotFound(_0x1ef6ff,null))[_0xf838('0x20')](respondWithResult(_0x1ef6ff,null))[_0xf838('0x2a')](handleError(_0x1ef6ff,null));};exports[_0xf838('0x57')]=function(_0x526cb1,_0x34d6fb){return db[_0xf838('0x3b')][_0xf838('0x57')](_0x526cb1[_0xf838('0x58')],{})[_0xf838('0x20')](respondWithResult(_0x34d6fb,0xc9))['catch'](handleError(_0x34d6fb,null));};exports[_0xf838('0x59')]=function(_0x288d42,_0x55fc82){if(_0x288d42[_0xf838('0x58')]['id']){delete _0x288d42['body']['id'];}return db[_0xf838('0x3b')][_0xf838('0x5a')]({'where':{'id':_0x288d42[_0xf838('0x56')]['id']}})['then'](handleEntityNotFound(_0x55fc82,null))[_0xf838('0x20')](saveUpdates(_0x288d42[_0xf838('0x58')],null))[_0xf838('0x20')](respondWithResult(_0x55fc82,null))['catch'](handleError(_0x55fc82,null));};exports[_0xf838('0x5b')]=function(_0x38395f,_0x58dabc){return db['WhatsappMessage'][_0xf838('0x5a')]({'where':{'id':_0x38395f[_0xf838('0x56')]['id']}})[_0xf838('0x20')](handleEntityNotFound(_0x58dabc,null))['then'](removeEntity(_0x58dabc,null))[_0xf838('0x2a')](handleError(_0x58dabc,null));};exports[_0xf838('0x5c')]=function(_0x5dca8a,_0x2c9d00){return db[_0xf838('0x3b')]['describe']()[_0xf838('0x20')](respondWithResult(_0x2c9d00,null))[_0xf838('0x2a')](handleError(_0x2c9d00,null));};var interaction_log=require(_0xf838('0x14'))(_0xf838('0x5d'));exports[_0xf838('0x5e')]=function(_0x4a9cb1,_0x3ff985,_0xfbbde2){var _0x100f8c={'agent':{},'channel':_0xf838('0x5f')};if(_0x4a9cb1[_0xf838('0x58')]['id']){delete _0x4a9cb1[_0xf838('0x58')]['id'];}_0x4a9cb1[_0xf838('0x58')][_0xf838('0x60')]=!![];_0x4a9cb1[_0xf838('0x58')][_0xf838('0x61')]=moment()[_0xf838('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')]=_0x4a9cb1['body'][_0xf838('0x63')]||_0x4a9cb1[_0xf838('0x64')]['id'];_0x100f8c['agent']['id']=_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')];return db['WhatsappMessage'][_0xf838('0x5a')]({'where':{'id':_0x4a9cb1[_0xf838('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ff985,null))[_0xf838('0x20')](saveUpdates(_0x4a9cb1[_0xf838('0x58')],null))[_0xf838('0x20')](function(_0x563bf0){if(_0x563bf0){_0x100f8c[_0xf838('0x28')]=_0x563bf0[_0xf838('0x65')]({'plain':!![]});return db[_0xf838('0x66')][_0xf838('0x5a')]({'where':{'id':_0x563bf0['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3ff985,null))[_0xf838('0x20')](function(_0x475567){if(_0x475567){return _0x475567[_0xf838('0x59')]({'UserId':_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')],'read1stAt':_[_0xf838('0x67')](_0x475567['read1stAt'])?moment()['format'](_0xf838('0x68')):undefined});}return null;})[_0xf838('0x20')](function(_0x4973d4){if(_0x4973d4){_0x100f8c[_0xf838('0x69')]=_0x4973d4[_0xf838('0x65')]({'plain':!![]});interaction_log[_0xf838('0x21')](_0xf838('0x6a'),_0x4a9cb1[_0xf838('0x64')]['id'],_0x4a9cb1[_0xf838('0x64')][_0xf838('0x37')],_0x4a9cb1[_0xf838('0x64')][_0xf838('0x6b')],_0x100f8c[_0xf838('0x69')]['id'],_0x4a9cb1[_0xf838('0x58')]?JSON[_0xf838('0x25')](_0x4a9cb1[_0xf838('0x58')]):'null');return respondWithRpcPromise(_0xf838('0x6c'),_0xf838('0x6d'),_0x100f8c);}return null;})[_0xf838('0x20')](function(_0x3cb3b1){var _0x56f75c=_0xf838('0x6e')+_0x3cb3b1[_0xf838('0x28')][_0xf838('0x6f')];return db[_0xf838('0x70')][_0xf838('0x40')](_0x56f75c,{'type':db[_0xf838('0x71')]['QueryTypes'][_0xf838('0x72')],'raw':!![]})['then'](function(_0x45e51f){return _0x45e51f;});})['then'](function(_0x4b02b3){if(_0x4b02b3){_0x100f8c[_0xf838('0x28')][_0xf838('0x73')]=_0x4b02b3[0x0];if(!_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')])return;return db[_0xf838('0x74')]['find']({'where':{'id':_0x4a9cb1[_0xf838('0x58')][_0xf838('0x63')],'role':'agent'},'attributes':['id',_0xf838('0x37'),'fullname',_0xf838('0x75'),_0xf838('0x76')],'raw':!![]});}return null;})[_0xf838('0x20')](function(_0x2d0260){if(!_0x2d0260)return null;_0x100f8c[_0xf838('0x28')]['agent']=_0x2d0260;return _0x100f8c;})[_0xf838('0x20')](function(_0x3c7877){if(_0x3c7877){if(_0x4a9cb1[_0xf838('0x58')]['manual']){_0x100f8c[_0xf838('0x28')][_0xf838('0x77')]=util[_0xf838('0x62')](_0xf838('0x78'),_0x4a9cb1['user'][_0xf838('0x37')]);_0x100f8c[_0xf838('0x28')][_0xf838('0x79')]=_0x100f8c[_0xf838('0x79')];_0x100f8c[_0xf838('0x28')][_0xf838('0x7a')]=_0x100f8c[_0xf838('0x79')];_0x100f8c['message']['event']='accept';return respondWithRpcPromise(_0xf838('0x7b'),_0xf838('0x7b'),{'event':_0xf838('0x7c'),'message':_0x100f8c[_0xf838('0x28')]},client9002)[_0xf838('0x20')](function(){return _0x100f8c;});}return _0x100f8c;}return null;})[_0xf838('0x20')](respondWithResult(_0x3ff985,null))[_0xf838('0x2a')](handleError(_0x3ff985,null));};var interaction_log=require('../../config/logger')(_0xf838('0x5d'));exports[_0xf838('0x34')]=function(_0x24898e,_0x3e5513,_0x479fe6){var _0x151873={'agent':{},'channel':_0xf838('0x5f')};if(_0x24898e[_0xf838('0x58')]['id']){delete _0x24898e[_0xf838('0x58')]['id'];}_0x24898e[_0xf838('0x58')][_0xf838('0x63')]=_0x24898e[_0xf838('0x58')]['UserId']||_0x24898e['user']['id'];_0x151873[_0xf838('0x7d')]['id']=_0x24898e[_0xf838('0x58')][_0xf838('0x63')];return db[_0xf838('0x3b')][_0xf838('0x5a')]({'where':{'id':_0x24898e['params']['id'],'UserId':null}})[_0xf838('0x20')](handleEntityNotFound(_0x3e5513,null))[_0xf838('0x20')](function(_0x490b9e){if(_0x490b9e){_0x151873[_0xf838('0x28')]=_0x490b9e['get']({'plain':!![]});return db[_0xf838('0x66')][_0xf838('0x5a')]({'where':{'id':_0x490b9e[_0xf838('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x3e5513,null))['then'](function(_0x2ceec4){if(_0x2ceec4){_0x151873[_0xf838('0x69')]=_0x2ceec4[_0xf838('0x65')]({'plain':!![]});interaction_log[_0xf838('0x21')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x24898e[_0xf838('0x64')]['id'],_0x24898e['user'][_0xf838('0x37')],_0x24898e['user'][_0xf838('0x6b')],_0x151873[_0xf838('0x69')]['id'],_0x24898e[_0xf838('0x58')]?JSON['stringify'](_0x24898e[_0xf838('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0xf838('0x7f'),_0x151873);}return null;})[_0xf838('0x20')](function(_0x407b8e){var _0x386680=_0xf838('0x6e')+_0x407b8e[_0xf838('0x28')][_0xf838('0x6f')];return db[_0xf838('0x70')][_0xf838('0x40')](_0x386680,{'type':db[_0xf838('0x71')]['QueryTypes'][_0xf838('0x72')],'raw':!![]})[_0xf838('0x20')](function(_0x254ab7){return _0x254ab7;});})['then'](function(_0x18c77e){if(_0x18c77e){_0x151873[_0xf838('0x28')]['contact']=_0x18c77e[0x0];if(!_0x24898e[_0xf838('0x58')][_0xf838('0x63')])return;return db['User'][_0xf838('0x5a')]({'where':{'id':_0x24898e[_0xf838('0x58')][_0xf838('0x63')],'role':_0xf838('0x7d')},'attributes':['id',_0xf838('0x37'),'fullname','email','internal'],'raw':!![]});}return null;})[_0xf838('0x20')](function(_0x5a54cd){if(!_0x5a54cd)return null;_0x151873[_0xf838('0x28')][_0xf838('0x7d')]=_0x5a54cd;return _0x151873;})[_0xf838('0x20')](function(_0x222794){if(_0x222794){_0x222794[_0xf838('0x28')][_0xf838('0x77')]=util[_0xf838('0x62')](_0xf838('0x78'),_0x24898e[_0xf838('0x64')][_0xf838('0x37')]);_0x222794[_0xf838('0x28')][_0xf838('0x79')]=_0x151873[_0xf838('0x79')];_0x222794[_0xf838('0x28')][_0xf838('0x7a')]=_0x151873['channel'];_0x222794['message'][_0xf838('0x80')]=_0xf838('0x34');respondWithRpcPromise(_0xf838('0x7b'),_0xf838('0x7b'),{'event':_0xf838('0x81'),'message':_0x222794[_0xf838('0x28')]},client9002);return _0x151873;}return null;})['then'](respondWithResult(_0x3e5513,null))[_0xf838('0x2a')](handleError(_0x3e5513,null));};exports[_0xf838('0x2c')]=function(_0x18de01,_0x41580c,_0x108208){if(_0x18de01[_0xf838('0x58')]['id']){delete _0x18de01[_0xf838('0x58')]['id'];}var _0x163c9e;return db['WhatsappMessage'][_0xf838('0x5a')]({'where':{'id':_0x18de01['params']['id']}})[_0xf838('0x20')](handleEntityNotFound(_0x41580c,null))[_0xf838('0x20')](function(_0x42a627){if(_0x42a627){_0x163c9e=_0x42a627;return db[_0xf838('0x82')]['find']({'where':{'id':_0x42a627[_0xf838('0x83')]}});}})[_0xf838('0x20')](handleEntityNotFound(_0x41580c,null))[_0xf838('0x20')](function(_0x2c862c){if(_0x2c862c){logger[_0xf838('0x84')](_0xf838('0x85'),_0xf838('0x2c'),_0xf838('0x86'),_0x2c862c[_0xf838('0x3d')],util[_0xf838('0x87')](_0x18de01['body'],{'showHidden':![],'depth':null}));switch(_0x2c862c[_0xf838('0x3d')]){case'twilio':if(_0x18de01[_0xf838('0x58')][_0xf838('0x88')]&&_0x18de01[_0xf838('0x58')][_0xf838('0x88')]===_0x163c9e['messageId']&&_0x18de01[_0xf838('0x58')]['MessageStatus']&&_0x18de01[_0xf838('0x58')][_0xf838('0x89')]===_0xf838('0x60')){return _0x163c9e[_0xf838('0x59')]({'read':!![]});}else{logger[_0xf838('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xf838('0x8a'),util[_0xf838('0x87')](_0x18de01[_0xf838('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x163c9e;}})[_0xf838('0x20')](respondWithResult(_0x41580c,null))[_0xf838('0x2a')](handleError(_0x41580c,null));}; \ No newline at end of file +var _0x88a9=['WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','WhatsappMessage','includeAll','include','rows','catch','show','params','fields','find','create','body','update','describe','accept','readAt','UserId','user','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[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','QueryTypes','User','agent','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','whatsapp-interactions','whatsapp','RejectMessage','rejectMessage','Sequelize','contact','fullname','email','SIP/%s','event','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','info'];(function(_0x5bbae4,_0x2a4a4e){var _0x338a50=function(_0x478845){while(--_0x478845){_0x5bbae4['push'](_0x5bbae4['shift']());}};_0x338a50(++_0x2a4a4e);}(_0x88a9,0x17d));var _0x988a=function(_0x5bf59c,_0x3d6ecf){_0x5bf59c=_0x5bf59c-0x0;var _0x5b20fb=_0x88a9[_0x5bf59c];return _0x5b20fb;};'use strict';var emlformat=require(_0x988a('0x0'));var rimraf=require(_0x988a('0x1'));var zipdir=require(_0x988a('0x2'));var jsonpatch=require(_0x988a('0x3'));var rp=require(_0x988a('0x4'));var moment=require(_0x988a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x988a('0x6'));var util=require(_0x988a('0x7'));var path=require(_0x988a('0x8'));var sox=require(_0x988a('0x9'));var csv=require(_0x988a('0xa'));var ejs=require(_0x988a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x988a('0xc'));var squel=require(_0x988a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x988a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x988a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x988a('0x10'));var as=require(_0x988a('0x11'));var hardwareService=require(_0x988a('0x12'));var logger=require(_0x988a('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x988a('0x14'));var db=require(_0x988a('0x15'))['db'];config[_0x988a('0x16')]=_['defaults'](config[_0x988a('0x16')],{'host':_0x988a('0x17'),'port':0x18eb});var socket=require(_0x988a('0x18'))(new Redis(config[_0x988a('0x16')]));require(_0x988a('0x19'))['register'](socket);var jayson=require(_0x988a('0x1a'));var client=jayson[_0x988a('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x988a('0x1b')][_0x988a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3ecfb1,_0x25847a,_0x4d43d4,_0x2df42a){return new BPromise(function(_0x6bfac1,_0x1b40b1){var _0x4730fc=_0x2df42a||client;return _0x4730fc['request'](_0x3ecfb1,_0x4d43d4)['then'](function(_0x414b90){logger[_0x988a('0x1d')](_0x988a('0x1e'),_0x25847a,_0x988a('0x1f'));logger[_0x988a('0x20')](_0x988a('0x21'),_0x25847a,'request\x20sent',JSON[_0x988a('0x22')](_0x414b90));if(_0x414b90[_0x988a('0x23')]){if(_0x414b90['error'][_0x988a('0x24')]===0x1f4){logger[_0x988a('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x25847a,_0x414b90['error']['message']);return _0x1b40b1(_0x414b90[_0x988a('0x23')][_0x988a('0x25')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x25847a,_0x414b90[_0x988a('0x23')][_0x988a('0x25')]);return _0x6bfac1(_0x414b90['error'][_0x988a('0x25')]);}else{logger[_0x988a('0x1d')](_0x988a('0x1e'),_0x25847a,_0x988a('0x1f'));_0x6bfac1(_0x414b90[_0x988a('0x26')][_0x988a('0x25')]);}})['catch'](function(_0xf2fc0e){logger[_0x988a('0x23')](_0x988a('0x1e'),_0x25847a,_0xf2fc0e);_0x1b40b1(_0xf2fc0e);});});}function respondWithStatusCode(_0xce6c9c,_0x380e0d){_0x380e0d=_0x380e0d||0xcc;return function(_0x47c25f){if(_0x47c25f){return _0xce6c9c[_0x988a('0x27')](_0x380e0d);}return _0xce6c9c[_0x988a('0x28')](_0x380e0d)[_0x988a('0x29')]();};}function respondWithResult(_0x5b38a0,_0x4202f0){_0x4202f0=_0x4202f0||0xc8;return function(_0x454cb5){if(_0x454cb5){return _0x5b38a0[_0x988a('0x28')](_0x4202f0)[_0x988a('0x2a')](_0x454cb5);}};}function respondWithFilteredResult(_0xbdcc49,_0x8aa675){return function(_0x27223e){if(_0x27223e){var _0x1f46ff=typeof _0x8aa675['offset']===_0x988a('0x2b')&&typeof _0x8aa675['limit']===_0x988a('0x2b');var _0x58e866=_0x27223e[_0x988a('0x2c')];var _0x370ba7=_0x1f46ff?0x0:_0x8aa675[_0x988a('0x2d')];var _0x36ec07=_0x1f46ff?_0x27223e['count']:_0x8aa675[_0x988a('0x2d')]+_0x8aa675[_0x988a('0x2e')];var _0x291d6f;if(_0x36ec07>=_0x58e866){_0x36ec07=_0x58e866;_0x291d6f=0xc8;}else{_0x291d6f=0xce;}_0xbdcc49['status'](_0x291d6f);return _0xbdcc49[_0x988a('0x2f')](_0x988a('0x30'),_0x370ba7+'-'+_0x36ec07+'/'+_0x58e866)[_0x988a('0x2a')](_0x27223e);}return null;};}function patchUpdates(_0x45fdc7){return function(_0x25f425){try{jsonpatch[_0x988a('0x31')](_0x25f425,_0x45fdc7,!![]);}catch(_0x2bc16){return BPromise[_0x988a('0x32')](_0x2bc16);}return _0x25f425[_0x988a('0x33')]();};}function saveUpdates(_0xf50aaa,_0x24f64f){return function(_0x425406){if(_0x425406){return _0x425406['update'](_0xf50aaa)[_0x988a('0x34')](function(_0x5b0c80){return _0x5b0c80;});}return null;};}function removeEntity(_0x4ffa7c,_0x20ce59){return function(_0x7b5bd){if(_0x7b5bd){return _0x7b5bd[_0x988a('0x35')]()[_0x988a('0x34')](function(){_0x4ffa7c[_0x988a('0x28')](0xcc)[_0x988a('0x29')]();});}};}function handleEntityNotFound(_0x53fceb,_0x31d45c){return function(_0x14c9aa){if(!_0x14c9aa){_0x53fceb['sendStatus'](0x194);}return _0x14c9aa;};}function handleError(_0x24d648,_0x2d5510){_0x2d5510=_0x2d5510||0x1f4;return function(_0x27270f){logger['error'](_0x27270f[_0x988a('0x36')]);if(_0x27270f[_0x988a('0x37')]){delete _0x27270f[_0x988a('0x37')];}_0x24d648[_0x988a('0x28')](_0x2d5510)['send'](_0x27270f);};}exports[_0x988a('0x38')]=function(_0x477775,_0x31e346){var _0x6b6fd1={},_0x5d348b={},_0x4b0124={'count':0x0,'rows':[]};var _0x5f16a0=_['map'](db['WhatsappMessage'][_0x988a('0x39')],function(_0x3b2ad9){return{'name':_0x3b2ad9[_0x988a('0x3a')],'type':_0x3b2ad9[_0x988a('0x3b')][_0x988a('0x3c')]};});_0x5d348b[_0x988a('0x3d')]=_['map'](_0x5f16a0,_0x988a('0x37'));_0x5d348b[_0x988a('0x3e')]=_[_0x988a('0x3f')](_0x477775[_0x988a('0x3e')]);_0x5d348b[_0x988a('0x40')]=_[_0x988a('0x41')](_0x5d348b[_0x988a('0x3d')],_0x5d348b[_0x988a('0x3e')]);_0x6b6fd1['attributes']=_[_0x988a('0x41')](_0x5d348b[_0x988a('0x3d')],qs['fields'](_0x477775[_0x988a('0x3e')]['fields']));_0x6b6fd1[_0x988a('0x42')]=_0x6b6fd1['attributes'][_0x988a('0x43')]?_0x6b6fd1[_0x988a('0x42')]:_0x5d348b[_0x988a('0x3d')];if(!_0x477775[_0x988a('0x3e')][_0x988a('0x44')]('nolimit')){_0x6b6fd1[_0x988a('0x2e')]=qs[_0x988a('0x2e')](_0x477775[_0x988a('0x3e')][_0x988a('0x2e')]);_0x6b6fd1[_0x988a('0x2d')]=qs[_0x988a('0x2d')](_0x477775[_0x988a('0x3e')][_0x988a('0x2d')]);}_0x6b6fd1['order']=qs[_0x988a('0x45')](_0x477775[_0x988a('0x3e')][_0x988a('0x45')]);_0x6b6fd1[_0x988a('0x46')]=qs['filters'](_[_0x988a('0x47')](_0x477775[_0x988a('0x3e')],_0x5d348b[_0x988a('0x40')]),_0x5f16a0);if(_0x477775[_0x988a('0x3e')][_0x988a('0x48')]){_0x6b6fd1[_0x988a('0x46')]=_['merge'](_0x6b6fd1[_0x988a('0x46')],{'$or':_['map'](_0x5f16a0,function(_0x1bf36f){if(_0x1bf36f['type']!==_0x988a('0x49')){var _0x3f557d={};_0x3f557d[_0x1bf36f[_0x988a('0x37')]]={'$like':'%'+_0x477775[_0x988a('0x3e')]['filter']+'%'};return _0x3f557d;}})});}_0x6b6fd1=_['merge']({},_0x6b6fd1,_0x477775[_0x988a('0x4a')]);var _0x5ea41f={'where':_0x6b6fd1['where']};return db[_0x988a('0x4b')]['count'](_0x5ea41f)[_0x988a('0x34')](function(_0x94e8db){_0x4b0124['count']=_0x94e8db;if(_0x477775[_0x988a('0x3e')][_0x988a('0x4c')]){_0x6b6fd1[_0x988a('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x6b6fd1);})[_0x988a('0x34')](function(_0x315e40){_0x4b0124[_0x988a('0x4e')]=_0x315e40;return _0x4b0124;})[_0x988a('0x34')](respondWithFilteredResult(_0x31e346,_0x6b6fd1))[_0x988a('0x4f')](handleError(_0x31e346,null));};exports[_0x988a('0x50')]=function(_0x27efa6,_0x3df71b){var _0x600a91={'raw':!![],'where':{'id':_0x27efa6[_0x988a('0x51')]['id']}},_0x3eed38={};_0x3eed38['model']=_[_0x988a('0x3f')](db[_0x988a('0x4b')][_0x988a('0x39')]);_0x3eed38[_0x988a('0x3e')]=_[_0x988a('0x3f')](_0x27efa6['query']);_0x3eed38[_0x988a('0x40')]=_[_0x988a('0x41')](_0x3eed38[_0x988a('0x3d')],_0x3eed38[_0x988a('0x3e')]);_0x600a91[_0x988a('0x42')]=_[_0x988a('0x41')](_0x3eed38[_0x988a('0x3d')],qs[_0x988a('0x52')](_0x27efa6[_0x988a('0x3e')][_0x988a('0x52')]));_0x600a91[_0x988a('0x42')]=_0x600a91[_0x988a('0x42')][_0x988a('0x43')]?_0x600a91[_0x988a('0x42')]:_0x3eed38[_0x988a('0x3d')];if(_0x27efa6[_0x988a('0x3e')][_0x988a('0x4c')]){_0x600a91[_0x988a('0x4d')]=[{'all':!![]}];}_0x600a91=_['merge']({},_0x600a91,_0x27efa6[_0x988a('0x4a')]);return db[_0x988a('0x4b')][_0x988a('0x53')](_0x600a91)[_0x988a('0x34')](handleEntityNotFound(_0x3df71b,null))['then'](respondWithResult(_0x3df71b,null))[_0x988a('0x4f')](handleError(_0x3df71b,null));};exports[_0x988a('0x54')]=function(_0x195117,_0xd96561){return db[_0x988a('0x4b')][_0x988a('0x54')](_0x195117[_0x988a('0x55')],{})[_0x988a('0x34')](respondWithResult(_0xd96561,0xc9))[_0x988a('0x4f')](handleError(_0xd96561,null));};exports[_0x988a('0x56')]=function(_0x598fb1,_0x3b335d){if(_0x598fb1[_0x988a('0x55')]['id']){delete _0x598fb1[_0x988a('0x55')]['id'];}return db[_0x988a('0x4b')][_0x988a('0x53')]({'where':{'id':_0x598fb1['params']['id']}})[_0x988a('0x34')](handleEntityNotFound(_0x3b335d,null))[_0x988a('0x34')](saveUpdates(_0x598fb1[_0x988a('0x55')],null))['then'](respondWithResult(_0x3b335d,null))[_0x988a('0x4f')](handleError(_0x3b335d,null));};exports['destroy']=function(_0x172e97,_0x3e5e0c){return db[_0x988a('0x4b')][_0x988a('0x53')]({'where':{'id':_0x172e97[_0x988a('0x51')]['id']}})[_0x988a('0x34')](handleEntityNotFound(_0x3e5e0c,null))[_0x988a('0x34')](removeEntity(_0x3e5e0c,null))[_0x988a('0x4f')](handleError(_0x3e5e0c,null));};exports['describe']=function(_0x14b59d,_0x489fcf){return db[_0x988a('0x4b')][_0x988a('0x57')]()['then'](respondWithResult(_0x489fcf,null))[_0x988a('0x4f')](handleError(_0x489fcf,null));};var interaction_log=require(_0x988a('0x13'))('whatsapp-interactions');exports[_0x988a('0x58')]=function(_0x22c222,_0x1de46a,_0x42d615){var _0xcacce3={'agent':{},'channel':'whatsapp'};if(_0x22c222[_0x988a('0x55')]['id']){delete _0x22c222['body']['id'];}_0x22c222[_0x988a('0x55')]['read']=!![];_0x22c222[_0x988a('0x55')][_0x988a('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x22c222[_0x988a('0x55')]['UserId']=_0x22c222[_0x988a('0x55')][_0x988a('0x5a')]||_0x22c222[_0x988a('0x5b')]['id'];_0xcacce3['agent']['id']=_0x22c222[_0x988a('0x55')][_0x988a('0x5a')];return db[_0x988a('0x4b')][_0x988a('0x53')]({'where':{'id':_0x22c222['params']['id'],'UserId':null}})[_0x988a('0x34')](handleEntityNotFound(_0x1de46a,null))['then'](saveUpdates(_0x22c222[_0x988a('0x55')],null))[_0x988a('0x34')](function(_0x355b58){if(_0x355b58){_0xcacce3[_0x988a('0x25')]=_0x355b58['get']({'plain':!![]});return db[_0x988a('0x5c')][_0x988a('0x53')]({'where':{'id':_0x355b58[_0x988a('0x5d')]}});}return null;})[_0x988a('0x34')](handleEntityNotFound(_0x1de46a,null))[_0x988a('0x34')](function(_0x27df91){if(_0x27df91){return _0x27df91[_0x988a('0x56')]({'UserId':_0x22c222[_0x988a('0x55')]['UserId'],'read1stAt':_[_0x988a('0x5e')](_0x27df91[_0x988a('0x5f')])?moment()[_0x988a('0x60')](_0x988a('0x61')):undefined});}return null;})[_0x988a('0x34')](function(_0x39d7a6){if(_0x39d7a6){_0xcacce3[_0x988a('0x62')]=_0x39d7a6[_0x988a('0x63')]({'plain':!![]});interaction_log[_0x988a('0x1d')](_0x988a('0x64'),_0x22c222[_0x988a('0x5b')]['id'],_0x22c222[_0x988a('0x5b')]['name'],_0x22c222[_0x988a('0x5b')][_0x988a('0x65')],_0xcacce3[_0x988a('0x62')]['id'],_0x22c222[_0x988a('0x55')]?JSON[_0x988a('0x22')](_0x22c222[_0x988a('0x55')]):_0x988a('0x66'));return respondWithRpcPromise(_0x988a('0x67'),'acceptMessage',_0xcacce3);}return null;})[_0x988a('0x34')](function(_0x560921){var _0x26144e=_0x988a('0x68')+_0x560921['message'][_0x988a('0x69')];return db[_0x988a('0x6a')][_0x988a('0x3e')](_0x26144e,{'type':db['Sequelize'][_0x988a('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0x1e7138){return _0x1e7138;});})[_0x988a('0x34')](function(_0x48a2c6){if(_0x48a2c6){_0xcacce3['message']['contact']=_0x48a2c6[0x0];if(!_0x22c222['body']['UserId'])return;return db[_0x988a('0x6c')]['find']({'where':{'id':_0x22c222[_0x988a('0x55')][_0x988a('0x5a')],'role':_0x988a('0x6d')},'attributes':['id',_0x988a('0x37'),'fullname','email',_0x988a('0x6e')],'raw':!![]});}return null;})[_0x988a('0x34')](function(_0x179a1f){if(!_0x179a1f)return null;_0xcacce3[_0x988a('0x25')][_0x988a('0x6d')]=_0x179a1f;return _0xcacce3;})[_0x988a('0x34')](function(_0x15a71c){if(_0x15a71c){if(_0x22c222[_0x988a('0x55')][_0x988a('0x6f')]){_0xcacce3[_0x988a('0x25')][_0x988a('0x70')]=util[_0x988a('0x60')]('SIP/%s',_0x22c222[_0x988a('0x5b')]['name']);_0xcacce3[_0x988a('0x25')][_0x988a('0x71')]=_0xcacce3[_0x988a('0x71')];_0xcacce3[_0x988a('0x25')][_0x988a('0x72')]=_0xcacce3[_0x988a('0x71')];_0xcacce3[_0x988a('0x25')]['event']=_0x988a('0x58');return respondWithRpcPromise(_0x988a('0x73'),'EventManager',{'event':_0x988a('0x74'),'message':_0xcacce3['message']},client9002)[_0x988a('0x34')](function(){return _0xcacce3;});}return _0xcacce3;}return null;})['then'](respondWithResult(_0x1de46a,null))[_0x988a('0x4f')](handleError(_0x1de46a,null));};var interaction_log=require(_0x988a('0x13'))(_0x988a('0x75'));exports[_0x988a('0x32')]=function(_0x4edff9,_0x638eb9,_0x4becc4){var _0x393d81={'agent':{},'channel':_0x988a('0x76')};if(_0x4edff9[_0x988a('0x55')]['id']){delete _0x4edff9[_0x988a('0x55')]['id'];}_0x4edff9[_0x988a('0x55')][_0x988a('0x5a')]=_0x4edff9[_0x988a('0x55')][_0x988a('0x5a')]||_0x4edff9[_0x988a('0x5b')]['id'];_0x393d81[_0x988a('0x6d')]['id']=_0x4edff9[_0x988a('0x55')][_0x988a('0x5a')];return db[_0x988a('0x4b')]['find']({'where':{'id':_0x4edff9[_0x988a('0x51')]['id'],'UserId':null}})[_0x988a('0x34')](handleEntityNotFound(_0x638eb9,null))[_0x988a('0x34')](function(_0xdbe72){if(_0xdbe72){_0x393d81[_0x988a('0x25')]=_0xdbe72[_0x988a('0x63')]({'plain':!![]});return db[_0x988a('0x5c')]['find']({'where':{'id':_0xdbe72[_0x988a('0x5d')]}});}return null;})[_0x988a('0x34')](handleEntityNotFound(_0x638eb9,null))[_0x988a('0x34')](function(_0x495ed3){if(_0x495ed3){_0x393d81['interaction']=_0x495ed3[_0x988a('0x63')]({'plain':!![]});interaction_log[_0x988a('0x1d')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4edff9[_0x988a('0x5b')]['id'],_0x4edff9['user'][_0x988a('0x37')],_0x4edff9[_0x988a('0x5b')][_0x988a('0x65')],_0x393d81[_0x988a('0x62')]['id'],_0x4edff9[_0x988a('0x55')]?JSON[_0x988a('0x22')](_0x4edff9[_0x988a('0x55')]):_0x988a('0x66'));return respondWithRpcPromise(_0x988a('0x77'),_0x988a('0x78'),_0x393d81);}return null;})['then'](function(_0x67be0){var _0x474d87='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x67be0[_0x988a('0x25')]['ContactId'];return db['sequelize'][_0x988a('0x3e')](_0x474d87,{'type':db[_0x988a('0x79')][_0x988a('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0xbf1276){return _0xbf1276;});})[_0x988a('0x34')](function(_0x56ab34){if(_0x56ab34){_0x393d81['message'][_0x988a('0x7a')]=_0x56ab34[0x0];if(!_0x4edff9[_0x988a('0x55')][_0x988a('0x5a')])return;return db[_0x988a('0x6c')]['find']({'where':{'id':_0x4edff9[_0x988a('0x55')][_0x988a('0x5a')],'role':_0x988a('0x6d')},'attributes':['id',_0x988a('0x37'),_0x988a('0x7b'),_0x988a('0x7c'),_0x988a('0x6e')],'raw':!![]});}return null;})[_0x988a('0x34')](function(_0x36fc02){if(!_0x36fc02)return null;_0x393d81[_0x988a('0x25')][_0x988a('0x6d')]=_0x36fc02;return _0x393d81;})[_0x988a('0x34')](function(_0x178200){if(_0x178200){_0x178200[_0x988a('0x25')][_0x988a('0x70')]=util[_0x988a('0x60')](_0x988a('0x7d'),_0x4edff9[_0x988a('0x5b')][_0x988a('0x37')]);_0x178200[_0x988a('0x25')][_0x988a('0x71')]=_0x393d81[_0x988a('0x71')];_0x178200[_0x988a('0x25')][_0x988a('0x72')]=_0x393d81[_0x988a('0x71')];_0x178200[_0x988a('0x25')][_0x988a('0x7e')]=_0x988a('0x32');respondWithRpcPromise('EventManager',_0x988a('0x73'),{'event':_0x988a('0x7f'),'message':_0x178200['message']},client9002);return _0x393d81;}return null;})[_0x988a('0x34')](respondWithResult(_0x638eb9,null))['catch'](handleError(_0x638eb9,null));};exports[_0x988a('0x28')]=function(_0x53ff31,_0x22f684,_0x431760){if(_0x53ff31[_0x988a('0x55')]['id']){delete _0x53ff31[_0x988a('0x55')]['id'];}var _0x2fdaae;return db[_0x988a('0x4b')]['find']({'where':{'id':_0x53ff31[_0x988a('0x51')]['id']}})['then'](handleEntityNotFound(_0x22f684,null))[_0x988a('0x34')](function(_0x537440){if(_0x537440){_0x2fdaae=_0x537440;return db['WhatsappAccount'][_0x988a('0x53')]({'where':{'id':_0x537440[_0x988a('0x80')]}});}})['then'](handleEntityNotFound(_0x22f684,null))['then'](function(_0x3c37cb){if(_0x3c37cb){logger['debug'](_0x988a('0x81'),_0x988a('0x28'),'received\x20delivery\x20report\x20from',_0x3c37cb['type'],util[_0x988a('0x82')](_0x53ff31[_0x988a('0x55')],{'showHidden':![],'depth':null}));switch(_0x3c37cb[_0x988a('0x3b')]){case _0x988a('0x83'):if(_0x53ff31[_0x988a('0x55')]['MessageSid']&&_0x53ff31[_0x988a('0x55')][_0x988a('0x84')]===_0x2fdaae[_0x988a('0x85')]&&_0x53ff31[_0x988a('0x55')][_0x988a('0x86')]&&_0x53ff31['body'][_0x988a('0x86')]===_0x988a('0x87')){return _0x2fdaae[_0x988a('0x56')]({'read':!![]});}else{logger['error'](_0x988a('0x88'),'status',_0x988a('0x83'),util['inspect'](_0x53ff31[_0x988a('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x2fdaae;}})[_0x988a('0x34')](respondWithResult(_0x22f684,null))['catch'](handleError(_0x22f684,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 953501e..044b3bd 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 _0x98e5=['setMaxListeners','save','remove','emit','hook','exports'];(function(_0x58fd5c,_0x3cc7a8){var _0x104f5c=function(_0x8253bd){while(--_0x8253bd){_0x58fd5c['push'](_0x58fd5c['shift']());}};_0x104f5c(++_0x3cc7a8);}(_0x98e5,0x8a));var _0x598e=function(_0x1d7490,_0x24b525){_0x1d7490=_0x1d7490-0x0;var _0x53862c=_0x98e5[_0x1d7490];return _0x53862c;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x598e('0x0')](0x0);var events={'afterCreate':_0x598e('0x1'),'afterUpdate':'update','afterDestroy':_0x598e('0x2')};function emitEvent(_0xc090ec){return function(_0x5cc274,_0x3af01f,_0x5a876c){WhatsappMessageEvents['emit'](_0xc090ec+':'+_0x5cc274['id'],_0x5cc274);WhatsappMessageEvents[_0x598e('0x3')](_0xc090ec,_0x5cc274);_0x5a876c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x598e('0x4')](e,emitEvent(event));}}module[_0x598e('0x5')]=WhatsappMessageEvents; \ No newline at end of file +var _0xd64b=['exports','events','WhatsappMessage','save','update','remove','hasOwnProperty','hook'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd64b,0xc1));var _0xbd64=function(_0x517fc3,_0x384d51){_0x517fc3=_0x517fc3-0x0;var _0xc4a05c=_0xd64b[_0x517fc3];return _0xc4a05c;};'use strict';var EventEmitter=require(_0xbd64('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbd64('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd64('0x2'),'afterUpdate':_0xbd64('0x3'),'afterDestroy':_0xbd64('0x4')};function emitEvent(_0x3f1f05){return function(_0x30fe29,_0x5458d8,_0x5446e4){WhatsappMessageEvents['emit'](_0x3f1f05+':'+_0x30fe29['id'],_0x30fe29);WhatsappMessageEvents['emit'](_0x3f1f05,_0x30fe29);_0x5446e4(null);};}for(var e in events){if(events[_0xbd64('0x5')](e)){var event=events[e];WhatsappMessage[_0xbd64('0x6')](e,emitEvent(event));}}module[_0xbd64('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index f18fce8..50a60b9 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 _0x6f60=['get','direction','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','toLowerCase','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','node-fetch','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','body','FULLTEXT'];(function(_0x5c00d7,_0x272be2){var _0x2c4bad=function(_0x742e95){while(--_0x742e95){_0x5c00d7['push'](_0x5c00d7['shift']());}};_0x2c4bad(++_0x272be2);}(_0x6f60,0x116));var _0x06f6=function(_0xbd47fb,_0x3dbcfb){_0xbd47fb=_0xbd47fb-0x0;var _0x27b434=_0x6f60[_0xbd47fb];return _0x27b434;};'use strict';var _=require(_0x06f6('0x0'));var util=require(_0x06f6('0x1'));var logger=require('../../config/logger')(_0x06f6('0x2'));var moment=require(_0x06f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x06f6('0x4'));var fetch=require(_0x06f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x06f6('0x6'));module[_0x06f6('0x7')]=function(_0x4ebc1d,_0x1468ef){return _0x4ebc1d['define'](_0x06f6('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x06f6('0x9'),'fields':[_0x06f6('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0x06f6('0xa')],'type':_0x06f6('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53d087,_0x4efa5b,_0x2befcf){var _0x2f2d8e=_0x4ebc1d['models'];var _0xa69e69=_0x53d087[_0x06f6('0xc')]({'plain':!![]});if(_0xa69e69[_0x06f6('0xd')]['toLowerCase']()==='in'||_0xa69e69[_0x06f6('0xd')]['toLowerCase']()==='out'&&!_0xa69e69[_0x06f6('0xe')]&&!_[_0x06f6('0xf')](_0xa69e69[_0x06f6('0x10')])){_0x2f2d8e[_0x06f6('0x11')]['findOne']({'where':{'id':_0xa69e69[_0x06f6('0x12')]}})[_0x06f6('0x13')](function(_0x3c114d){if(_0x3c114d){_0x3c114d[_0x06f6('0x14')]({'lastMsgAt':_0xa69e69[_0x06f6('0x15')],'lastMsgDirection':_0xa69e69[_0x06f6('0xd')][_0x06f6('0x16')]()});}})['catch'](function(_0x3640f4){console[_0x06f6('0x17')](_0x3640f4);});}if(_0xa69e69[_0x06f6('0xd')]===_0x06f6('0x18')&&!_0xa69e69[_0x06f6('0xe')]){var _0x5ac873;_0x2f2d8e[_0x06f6('0x19')][_0x06f6('0x1a')]({'where':{'id':_0xa69e69[_0x06f6('0x1b')]},'raw':!![]})[_0x06f6('0x13')](function(_0x193a38){_0x5ac873=_0x193a38;if(_0x5ac873&&_0x5ac873[_0x06f6('0x1c')]){switch(_0x5ac873[_0x06f6('0x1c')]){case _0x06f6('0x1d'):var _0x391de3=require(_0x06f6('0x1d'));if(_0x5ac873[_0x06f6('0x1e')]&&_0x5ac873['authToken']&&_0x5ac873[_0x06f6('0x1f')]){var _0x393377=new _0x391de3(_0x5ac873['accountSid'],_0x5ac873[_0x06f6('0x20')]);_0x393377[_0x06f6('0x21')][_0x06f6('0x22')]({'body':_0xa69e69[_0x06f6('0xa')],'to':_0x06f6('0x23')+_0xa69e69[_0x06f6('0x1f')],'from':'whatsapp:'+_0x5ac873['phone'],'statusCallback':_0x5ac873[_0x06f6('0x24')]+_0x06f6('0x25')+_0xa69e69['id']+'/status?token='+_0x5ac873[_0x06f6('0x26')]})[_0x06f6('0x13')](function(_0x4e0a4d){if(_0x4e0a4d[_0x06f6('0x27')]){return _0x53d087[_0x06f6('0x14')]({'messageId':_0x4e0a4d[_0x06f6('0x27')]});}})[_0x06f6('0x28')](function(_0x115eef){logger[_0x06f6('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0x06f6('0x29')](_0x115eef,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x06f6('0x2a'),_0x06f6('0x2b'),'twilio',_0x06f6('0x2c'));}break;case _0x06f6('0x2d'):var _0x21444d=_0x5ac873[_0x06f6('0x1e')];var _0x45e580=_0x5ac873['authToken'];var _0x53d0d2=_0x5ac873[_0x06f6('0x2e')]+_0x06f6('0x2f')+_0x21444d+_0x06f6('0x30');var _0x202174={'to':[_0xa69e69[_0x06f6('0x1f')]],'message':{'type':_0x06f6('0x31'),'text':_0xa69e69[_0x06f6('0xa')]}};var _0x33f51d={'method':_0x06f6('0x32'),'uri':_0x53d0d2,'headers':{'Authorization':_0x06f6('0x33')+_0x45e580,'Content-Type':'application/json'},'body':_0x202174,'json':!![]};rp(_0x33f51d)[_0x06f6('0x13')](function(_0x5d9741){if(_0x5d9741[_0x06f6('0x34')][0x0]['message_id']){return _0x53d087['update']({'messageId':_0x5d9741['statuses'][0x0][_0x06f6('0x35')]});}})[_0x06f6('0x28')](function(_0x410ed8){logger[_0x06f6('0x36')](_0x06f6('0x37'),_0x410ed8);});break;}}})[_0x06f6('0x38')](function(){_0x2befcf();});}else{_0x2befcf();}}},'charset':'utf8mb4','collate':_0x06f6('0x39')});}; \ No newline at end of file +var _0x4e8d=['statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','then','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','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','baseUrl','/messages/','text','POST','Bearer\x20'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0x4e8d,0x156));var _0xd4e8=function(_0x21fed9,_0x55b72a){_0x21fed9=_0x21fed9-0x0;var _0x224ee8=_0x4e8d[_0x21fed9];return _0x224ee8;};'use strict';var _=require(_0xd4e8('0x0'));var util=require('util');var logger=require(_0xd4e8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd4e8('0x2'));var rp=require(_0xd4e8('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xd4e8('0x4'));var rimraf=require(_0xd4e8('0x5'));var config=require(_0xd4e8('0x6'));var attributes=require(_0xd4e8('0x7'));module['exports']=function(_0xcd01fa,_0x690d4e){return _0xcd01fa['define']('WhatsappMessage',attributes,{'tableName':_0xd4e8('0x8'),'paranoid':![],'indexes':[{'name':_0xd4e8('0x9'),'fields':['messageId']},{'name':_0xd4e8('0xa'),'fields':[_0xd4e8('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x402ec6,_0x389c90,_0x3369e4){var _0x176e73=_0xcd01fa[_0xd4e8('0xc')];var _0x540942=_0x402ec6[_0xd4e8('0xd')]({'plain':!![]});if(_0x540942[_0xd4e8('0xe')][_0xd4e8('0xf')]()==='in'||_0x540942['direction'][_0xd4e8('0xf')]()==='out'&&!_0x540942[_0xd4e8('0x10')]&&!_[_0xd4e8('0x11')](_0x540942[_0xd4e8('0x12')])){_0x176e73[_0xd4e8('0x13')]['findOne']({'where':{'id':_0x540942['WhatsappInteractionId']}})[_0xd4e8('0x14')](function(_0x596ac7){if(_0x596ac7){_0x596ac7['update']({'lastMsgAt':_0x540942[_0xd4e8('0x15')],'lastMsgDirection':_0x540942[_0xd4e8('0xe')][_0xd4e8('0xf')]()});}})[_0xd4e8('0x16')](function(_0x581a79){console[_0xd4e8('0x17')](_0x581a79);});}if(_0x540942[_0xd4e8('0xe')]===_0xd4e8('0x18')&&!_0x540942[_0xd4e8('0x10')]){var _0x3c11da;_0x176e73[_0xd4e8('0x19')][_0xd4e8('0x1a')]({'where':{'id':_0x540942[_0xd4e8('0x1b')]},'raw':!![]})[_0xd4e8('0x14')](function(_0x37ba2c){_0x3c11da=_0x37ba2c;if(_0x3c11da&&_0x3c11da[_0xd4e8('0x1c')]){switch(_0x3c11da[_0xd4e8('0x1c')]){case _0xd4e8('0x1d'):var _0x2926e8=require(_0xd4e8('0x1d'));if(_0x3c11da[_0xd4e8('0x1e')]&&_0x3c11da[_0xd4e8('0x1f')]&&_0x3c11da[_0xd4e8('0x20')]){var _0x41e459=new _0x2926e8(_0x3c11da[_0xd4e8('0x1e')],_0x3c11da[_0xd4e8('0x1f')]);_0x41e459[_0xd4e8('0x21')]['create']({'body':_0x540942[_0xd4e8('0xb')],'to':'whatsapp:'+_0x540942[_0xd4e8('0x20')],'from':_0xd4e8('0x22')+_0x3c11da[_0xd4e8('0x20')],'statusCallback':_0x3c11da[_0xd4e8('0x23')]+_0xd4e8('0x24')+_0x540942['id']+_0xd4e8('0x25')+_0x3c11da[_0xd4e8('0x26')]})[_0xd4e8('0x14')](function(_0x10700c){if(_0x10700c[_0xd4e8('0x27')]){return _0x402ec6[_0xd4e8('0x28')]({'messageId':_0x10700c[_0xd4e8('0x27')]});}})[_0xd4e8('0x16')](function(_0x23811c){logger[_0xd4e8('0x17')](_0xd4e8('0x29'),_0xd4e8('0x2a'),_0xd4e8('0x1d'),util[_0xd4e8('0x2b')](_0x23811c,{'showHidden':![],'depth':null}));});}else{logger[_0xd4e8('0x17')](_0xd4e8('0x29'),_0xd4e8('0x2a'),_0xd4e8('0x1d'),_0xd4e8('0x2c'));}break;case'sinch':var _0x40d5e7=_0x3c11da[_0xd4e8('0x1e')];var _0x47b533=_0x3c11da[_0xd4e8('0x1f')];var _0x3aa0d3=_0x3c11da[_0xd4e8('0x2d')]+'/whatsapp/v1/'+_0x40d5e7+_0xd4e8('0x2e');var _0x336a1f={'to':[_0x540942[_0xd4e8('0x20')]],'message':{'type':_0xd4e8('0x2f'),'text':_0x540942[_0xd4e8('0xb')]}};var _0x17988b={'method':_0xd4e8('0x30'),'uri':_0x3aa0d3,'headers':{'Authorization':_0xd4e8('0x31')+_0x47b533,'Content-Type':'application/json'},'body':_0x336a1f,'json':!![]};rp(_0x17988b)[_0xd4e8('0x14')](function(_0x59fdf8){if(_0x59fdf8[_0xd4e8('0x32')][0x0][_0xd4e8('0x33')]){return _0x402ec6[_0xd4e8('0x28')]({'messageId':_0x59fdf8[_0xd4e8('0x32')][0x0]['message_id']});}})['catch'](function(_0x59d10e){logger[_0xd4e8('0x34')](_0xd4e8('0x35'),_0x59d10e);});break;}}})[_0xd4e8('0x36')](function(){_0x3369e4();});}else{_0x3369e4();}}},'charset':'utf8mb4','collate':_0xd4e8('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index b91e35b..da91760 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 _0x1407=['result','CreateWhatsappMessage','WhatsappMessage','raw','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x21795a,_0x26731f){var _0x6873a8=function(_0x7e5c1a){while(--_0x7e5c1a){_0x21795a['push'](_0x21795a['shift']());}};_0x6873a8(++_0x26731f);}(_0x1407,0x165));var _0x7140=function(_0x35e779,_0x366e51){_0x35e779=_0x35e779-0x0;var _0x5446a8=_0x1407[_0x35e779];return _0x5446a8;};'use strict';var _=require(_0x7140('0x0'));var util=require(_0x7140('0x1'));var moment=require(_0x7140('0x2'));var BPromise=require('bluebird');var rs=require(_0x7140('0x3'));var fs=require('fs');var Redis=require(_0x7140('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7140('0x5'));var logger=require(_0x7140('0x6'))(_0x7140('0x7'));var config=require(_0x7140('0x8'));var jayson=require(_0x7140('0x9'));var client=jayson[_0x7140('0xa')]['http']({'port':0x232a});config[_0x7140('0xb')]=_[_0x7140('0xc')](config[_0x7140('0xb')],{'host':_0x7140('0xd'),'port':0x18eb});var socket=require(_0x7140('0xe'))(new Redis(config[_0x7140('0xb')]));require('./whatsappMessage.socket')[_0x7140('0xf')](socket);function respondWithRpcPromise(_0x46e1af,_0x3e0873,_0xa2ae1a){return new BPromise(function(_0x221c20,_0x3d1bca){return client[_0x7140('0x10')](_0x46e1af,_0xa2ae1a)[_0x7140('0x11')](function(_0x1ec19d){logger['info'](_0x7140('0x12'),_0x3e0873,_0x7140('0x13'));logger[_0x7140('0x14')](_0x7140('0x15'),_0x3e0873,_0x7140('0x13'),JSON[_0x7140('0x16')](_0x1ec19d));if(_0x1ec19d[_0x7140('0x17')]){if(_0x1ec19d['error'][_0x7140('0x18')]===0x1f4){logger[_0x7140('0x17')](_0x7140('0x12'),_0x3e0873,_0x1ec19d[_0x7140('0x17')][_0x7140('0x19')]);return _0x3d1bca(_0x1ec19d[_0x7140('0x17')][_0x7140('0x19')]);}logger[_0x7140('0x17')](_0x7140('0x12'),_0x3e0873,_0x1ec19d[_0x7140('0x17')]['message']);return _0x221c20(_0x1ec19d[_0x7140('0x17')][_0x7140('0x19')]);}else{logger[_0x7140('0x1a')](_0x7140('0x12'),_0x3e0873,'request\x20sent');_0x221c20(_0x1ec19d[_0x7140('0x1b')]['message']);}})['catch'](function(_0x16da0d){logger[_0x7140('0x17')](_0x7140('0x12'),_0x3e0873,_0x16da0d);_0x3d1bca(_0x16da0d);});});}exports[_0x7140('0x1c')]=function(_0x4f19fb){var _0x40fde1=this;return new Promise(function(_0x1e2836,_0x466ca4){return db[_0x7140('0x1d')]['create'](_0x4f19fb['body'],{'raw':_0x4f19fb['options']?_0x4f19fb['options'][_0x7140('0x1e')]===undefined?!![]:![]:!![]})[_0x7140('0x11')](function(_0x2bec68){logger['info']('CreateWhatsappMessage',_0x4f19fb);logger[_0x7140('0x14')](_0x7140('0x1c'),_0x4f19fb,JSON[_0x7140('0x16')](_0x2bec68));_0x1e2836(_0x2bec68);})[_0x7140('0x1f')](function(_0x44c9df){logger[_0x7140('0x17')](_0x7140('0x1c'),_0x44c9df['message'],_0x4f19fb);_0x466ca4(_0x40fde1['error'](0x1f4,_0x44c9df[_0x7140('0x19')]));});});}; \ No newline at end of file +var _0x5ff8=['WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','stringify','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','then','info'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x5ff8,0x138));var _0x85ff=function(_0x38950b,_0x44a172){_0x38950b=_0x38950b-0x0;var _0x2138fb=_0x5ff8[_0x38950b];return _0x2138fb;};'use strict';var _=require(_0x85ff('0x0'));var util=require(_0x85ff('0x1'));var moment=require('moment');var BPromise=require(_0x85ff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x85ff('0x3'));var logger=require('../../config/logger')(_0x85ff('0x4'));var config=require(_0x85ff('0x5'));var jayson=require(_0x85ff('0x6'));var client=jayson[_0x85ff('0x7')]['http']({'port':0x232a});config[_0x85ff('0x8')]=_['defaults'](config[_0x85ff('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x85ff('0x9'))(new Redis(config[_0x85ff('0x8')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2f4969,_0x6ecdac,_0x4fe4f6){return new BPromise(function(_0x2c50a2,_0x576f20){return client['request'](_0x2f4969,_0x4fe4f6)[_0x85ff('0xa')](function(_0x537e21){logger[_0x85ff('0xb')](_0x85ff('0xc'),_0x6ecdac,_0x85ff('0xd'));logger[_0x85ff('0xe')](_0x85ff('0xf'),_0x6ecdac,_0x85ff('0xd'),JSON['stringify'](_0x537e21));if(_0x537e21[_0x85ff('0x10')]){if(_0x537e21[_0x85ff('0x10')][_0x85ff('0x11')]===0x1f4){logger[_0x85ff('0x10')](_0x85ff('0xc'),_0x6ecdac,_0x537e21[_0x85ff('0x10')][_0x85ff('0x12')]);return _0x576f20(_0x537e21[_0x85ff('0x10')][_0x85ff('0x12')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x6ecdac,_0x537e21[_0x85ff('0x10')][_0x85ff('0x12')]);return _0x2c50a2(_0x537e21[_0x85ff('0x10')][_0x85ff('0x12')]);}else{logger[_0x85ff('0xb')](_0x85ff('0xc'),_0x6ecdac,_0x85ff('0xd'));_0x2c50a2(_0x537e21['result'][_0x85ff('0x12')]);}})[_0x85ff('0x13')](function(_0x1133bc){logger['error'](_0x85ff('0xc'),_0x6ecdac,_0x1133bc);_0x576f20(_0x1133bc);});});}exports['CreateWhatsappMessage']=function(_0x48c41d){var _0x1bc526=this;return new Promise(function(_0x163762,_0x36170c){return db[_0x85ff('0x14')][_0x85ff('0x15')](_0x48c41d[_0x85ff('0x16')],{'raw':_0x48c41d[_0x85ff('0x17')]?_0x48c41d['options'][_0x85ff('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x242fe8){logger[_0x85ff('0xb')](_0x85ff('0x19'),_0x48c41d);logger[_0x85ff('0xe')](_0x85ff('0x19'),_0x48c41d,JSON[_0x85ff('0x1a')](_0x242fe8));_0x163762(_0x242fe8);})[_0x85ff('0x13')](function(_0x3aab94){logger[_0x85ff('0x10')](_0x85ff('0x19'),_0x3aab94[_0x85ff('0x12')],_0x48c41d);_0x36170c(_0x1bc526[_0x85ff('0x10')](0x1f4,_0x3aab94[_0x85ff('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7a1972f..b19e75e 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 _0x284c=['./whatsappMessage.events','save','remove','whatsappMessage:'];(function(_0x2c095e,_0x23337f){var _0x1fbfab=function(_0x136dcb){while(--_0x136dcb){_0x2c095e['push'](_0x2c095e['shift']());}};_0x1fbfab(++_0x23337f);}(_0x284c,0x1c8));var _0xc284=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x284c[_0x397e5f];return _0x5302b8;};'use strict';var WhatsappMessageEvents=require(_0xc284('0x0'));var events=[_0xc284('0x1'),_0xc284('0x2'),'update'];function createListener(_0x307c94,_0x43dd0b){return function(_0x32615b){_0x43dd0b['emit'](_0x307c94,_0x32615b);};}function removeListener(_0xd02aa6,_0x4afff9){return function(){WhatsappMessageEvents['removeListener'](_0xd02aa6,_0x4afff9);};}exports['register']=function(_0x54df44){for(var _0x4a7df7=0x0,_0x567ec7=events['length'];_0x4a7df7<_0x567ec7;_0x4a7df7++){var _0xcd76c3=events[_0x4a7df7];var _0x1ba7ee=createListener(_0xc284('0x3')+_0xcd76c3,_0x54df44);WhatsappMessageEvents['on'](_0xcd76c3,_0x1ba7ee);}}; \ No newline at end of file +var _0x4d37=['remove','update','emit','length','./whatsappMessage.events','save'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x4d37,0x19c));var _0x74d3=function(_0x1ec3fe,_0x2bbc3d){_0x1ec3fe=_0x1ec3fe-0x0;var _0x23d25b=_0x4d37[_0x1ec3fe];return _0x23d25b;};'use strict';var WhatsappMessageEvents=require(_0x74d3('0x0'));var events=[_0x74d3('0x1'),_0x74d3('0x2'),_0x74d3('0x3')];function createListener(_0x9f29df,_0x21a23f){return function(_0x5e08d5){_0x21a23f[_0x74d3('0x4')](_0x9f29df,_0x5e08d5);};}function removeListener(_0x23505f,_0x42d03a){return function(){WhatsappMessageEvents['removeListener'](_0x23505f,_0x42d03a);};}exports['register']=function(_0x42025a){for(var _0x1c4ef5=0x0,_0x3f985d=events[_0x74d3('0x5')];_0x1c4ef5<_0x3f985d;_0x1c4ef5++){var _0x2b4c6f=events[_0x1c4ef5];var _0x257ba7=createListener('whatsappMessage:'+_0x2b4c6f,_0x42025a);WhatsappMessageEvents['on'](_0x2b4c6f,_0x257ba7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index fd788a3..7d220c0 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 _0x9d37=['update','destroy','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents'];(function(_0x13fb04,_0x5e536c){var _0x548f3e=function(_0x649f6e){while(--_0x649f6e){_0x13fb04['push'](_0x13fb04['shift']());}};_0x548f3e(++_0x5e536c);}(_0x9d37,0x18b));var _0x79d3=function(_0xb1465e,_0x25155a){_0xb1465e=_0xb1465e-0x0;var _0x2f78e9=_0x9d37[_0xb1465e];return _0x2f78e9;};'use strict';var multer=require(_0x79d3('0x0'));var util=require(_0x79d3('0x1'));var path=require(_0x79d3('0x2'));var timeout=require(_0x79d3('0x3'));var express=require(_0x79d3('0x4'));var router=express[_0x79d3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x79d3('0x6'));var interaction=require(_0x79d3('0x7'));var config=require(_0x79d3('0x8'));var controller=require(_0x79d3('0x9'));router[_0x79d3('0xa')]('/',auth[_0x79d3('0xb')](),controller[_0x79d3('0xc')]);router[_0x79d3('0xa')](_0x79d3('0xd'),auth[_0x79d3('0xb')](),controller['describe']);router[_0x79d3('0xa')](_0x79d3('0xe'),auth[_0x79d3('0xb')](),controller[_0x79d3('0xf')]);router[_0x79d3('0xa')](_0x79d3('0x10'),auth[_0x79d3('0xb')](),controller[_0x79d3('0x11')]);router[_0x79d3('0xa')]('/:id/teams',auth[_0x79d3('0xb')](),controller[_0x79d3('0x12')]);router[_0x79d3('0xa')](_0x79d3('0x13'),auth[_0x79d3('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x79d3('0x14')]);router[_0x79d3('0x15')](_0x79d3('0x16'),auth[_0x79d3('0xb')](),controller[_0x79d3('0x17')]);router[_0x79d3('0x15')](_0x79d3('0x13'),auth[_0x79d3('0xb')](),controller[_0x79d3('0x18')]);router['put'](_0x79d3('0xe'),auth['isAuthenticated'](),controller[_0x79d3('0x19')]);router['delete'](_0x79d3('0xe'),auth[_0x79d3('0xb')](),controller[_0x79d3('0x1a')]);router['delete'](_0x79d3('0x16'),auth[_0x79d3('0xb')](),controller['removeTeams']);router[_0x79d3('0x1b')](_0x79d3('0x13'),auth[_0x79d3('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf960=['create','post','addAgents','put','delete','destroy','removeTeams','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0xf960,0x19c));var _0x0f96=function(_0x462fe4,_0x394d3e){_0x462fe4=_0x462fe4-0x0;var _0x82b23a=_0xf960[_0x462fe4];return _0x82b23a;};'use strict';var multer=require('multer');var util=require(_0x0f96('0x0'));var path=require(_0x0f96('0x1'));var timeout=require(_0x0f96('0x2'));var express=require(_0x0f96('0x3'));var router=express[_0x0f96('0x4')]();var fs_extra=require(_0x0f96('0x5'));var auth=require(_0x0f96('0x6'));var interaction=require(_0x0f96('0x7'));var config=require(_0x0f96('0x8'));var controller=require(_0x0f96('0x9'));router[_0x0f96('0xa')]('/',auth[_0x0f96('0xb')](),controller['index']);router[_0x0f96('0xa')](_0x0f96('0xc'),auth['isAuthenticated'](),controller[_0x0f96('0xd')]);router['get'](_0x0f96('0xe'),auth[_0x0f96('0xb')](),controller[_0x0f96('0xf')]);router[_0x0f96('0xa')]('/:id/members',auth[_0x0f96('0xb')](),controller['getMembers']);router[_0x0f96('0xa')](_0x0f96('0x10'),auth['isAuthenticated'](),controller[_0x0f96('0x11')]);router['get'](_0x0f96('0x12'),auth[_0x0f96('0xb')](),controller[_0x0f96('0x13')]);router['post']('/',auth[_0x0f96('0xb')](),controller[_0x0f96('0x14')]);router[_0x0f96('0x15')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x0f96('0x15')](_0x0f96('0x12'),auth['isAuthenticated'](),controller[_0x0f96('0x16')]);router[_0x0f96('0x17')](_0x0f96('0xe'),auth[_0x0f96('0xb')](),controller['update']);router[_0x0f96('0x18')](_0x0f96('0xe'),auth[_0x0f96('0xb')](),controller[_0x0f96('0x19')]);router[_0x0f96('0x18')](_0x0f96('0x10'),auth[_0x0f96('0xb')](),controller[_0x0f96('0x1a')]);router[_0x0f96('0x18')](_0x0f96('0x12'),auth['isAuthenticated'](),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 ef7eb6f..0ae0b3a 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 _0x65d2=['sequelize','exports','name','INTEGER','ENUM','beepall','roundrobin','STRING'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x65d2,0xb8));var _0x265d=function(_0x4209d9,_0x532066){_0x4209d9=_0x4209d9-0x0;var _0x5cc1df=_0x65d2[_0x4209d9];return _0x5cc1df;};'use strict';var Sequelize=require(_0x265d('0x0'));module[_0x265d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x265d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x265d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x265d('0x4')]('rrmemory',_0x265d('0x5'),_0x265d('0x6'))},'description':{'type':Sequelize[_0x265d('0x7')]}}; \ No newline at end of file +var _0x4876=['STRING','ENUM','beepall','roundrobin'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6487('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6487('0x1')]('rrmemory',_0x6487('0x2'),_0x6487('0x3'))},'description':{'type':Sequelize[_0x6487('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ece3175..311feb5 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 _0x001b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','pick','WhatsappQueueId','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','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','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','limit','undefined','count','offset','save','update','then','destroy','get','WhatsappQueues','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x492924,_0x244592){var _0x19a16e=function(_0x56f560){while(--_0x56f560){_0x492924['push'](_0x492924['shift']());}};_0x19a16e(++_0x244592);}(_0x001b,0x15c));var _0xb001=function(_0x23c2ca,_0x1eba00){_0x23c2ca=_0x23c2ca-0x0;var _0x1a4dd1=_0x001b[_0x23c2ca];return _0x1a4dd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb001('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb001('0x1'));var rp=require('request-promise');var moment=require(_0xb001('0x2'));var BPromise=require(_0xb001('0x3'));var Mustache=require('mustache');var util=require(_0xb001('0x4'));var path=require(_0xb001('0x5'));var sox=require(_0xb001('0x6'));var csv=require(_0xb001('0x7'));var ejs=require(_0xb001('0x8'));var fs=require('fs');var fs_extra=require(_0xb001('0x9'));var _=require(_0xb001('0xa'));var squel=require(_0xb001('0xb'));var crypto=require(_0xb001('0xc'));var jsforce=require(_0xb001('0xd'));var deskjs=require(_0xb001('0xe'));var toCsv=require(_0xb001('0x7'));var querystring=require('querystring');var Papa=require(_0xb001('0xf'));var Redis=require('ioredis');var authService=require(_0xb001('0x10'));var qs=require(_0xb001('0x11'));var as=require(_0xb001('0x12'));var hardwareService=require(_0xb001('0x13'));var logger=require(_0xb001('0x14'))(_0xb001('0x15'));var utils=require('../../config/utils');var config=require(_0xb001('0x16'));var licenseUtil=require(_0xb001('0x17'));var db=require(_0xb001('0x18'))['db'];config[_0xb001('0x19')]=_[_0xb001('0x1a')](config[_0xb001('0x19')],{'host':_0xb001('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb001('0x19')]));require(_0xb001('0x1c'))[_0xb001('0x1d')](socket);function respondWithStatusCode(_0x4e0bf0,_0x4f7b55){_0x4f7b55=_0x4f7b55||0xcc;return function(_0x52a535){if(_0x52a535){return _0x4e0bf0[_0xb001('0x1e')](_0x4f7b55);}return _0x4e0bf0[_0xb001('0x1f')](_0x4f7b55)[_0xb001('0x20')]();};}function respondWithResult(_0x218c91,_0x149150){_0x149150=_0x149150||0xc8;return function(_0x4dd066){if(_0x4dd066){return _0x218c91['status'](_0x149150)['json'](_0x4dd066);}};}function respondWithFilteredResult(_0x533b5e,_0x561133){return function(_0x2b41f8){if(_0x2b41f8){var _0x4f0609=typeof _0x561133['offset']==='undefined'&&typeof _0x561133[_0xb001('0x21')]===_0xb001('0x22');var _0x14945a=_0x2b41f8[_0xb001('0x23')];var _0x1fec8e=_0x4f0609?0x0:_0x561133['offset'];var _0x132e14=_0x4f0609?_0x2b41f8['count']:_0x561133[_0xb001('0x24')]+_0x561133[_0xb001('0x21')];var _0x38cd65;if(_0x132e14>=_0x14945a){_0x132e14=_0x14945a;_0x38cd65=0xc8;}else{_0x38cd65=0xce;}_0x533b5e[_0xb001('0x1f')](_0x38cd65);return _0x533b5e['set']('Content-Range',_0x1fec8e+'-'+_0x132e14+'/'+_0x14945a)['json'](_0x2b41f8);}return null;};}function patchUpdates(_0x28850e){return function(_0x45a9c5){try{jsonpatch['apply'](_0x45a9c5,_0x28850e,!![]);}catch(_0x1908e7){return BPromise['reject'](_0x1908e7);}return _0x45a9c5[_0xb001('0x25')]();};}function saveUpdates(_0x56de09,_0x2242a7){return function(_0x34280c){if(_0x34280c){return _0x34280c[_0xb001('0x26')](_0x56de09)[_0xb001('0x27')](function(_0x25def8){return _0x25def8;});}return null;};}function removeEntity(_0x5cfe99,_0x44ae35){return function(_0x4267a9){if(_0x4267a9){return _0x4267a9[_0xb001('0x28')]()[_0xb001('0x27')](function(){var _0x24d667=_0x4267a9[_0xb001('0x29')]({'plain':!![]});var _0x4f64fb=_0xb001('0x2a');return db['UserProfileResource'][_0xb001('0x28')]({'where':{'type':_0x4f64fb,'resourceId':_0x24d667['id']}})[_0xb001('0x27')](function(){return _0x4267a9;});})[_0xb001('0x27')](function(){_0x5cfe99[_0xb001('0x1f')](0xcc)[_0xb001('0x20')]();});}};}function handleEntityNotFound(_0x49d123,_0x13a42e){return function(_0x3d7cb5){if(!_0x3d7cb5){_0x49d123[_0xb001('0x1e')](0x194);}return _0x3d7cb5;};}function handleError(_0x4e9a45,_0xdc75d6){_0xdc75d6=_0xdc75d6||0x1f4;return function(_0x45a8b4){logger[_0xb001('0x2b')](_0x45a8b4[_0xb001('0x2c')]);if(_0x45a8b4[_0xb001('0x2d')]){delete _0x45a8b4[_0xb001('0x2d')];}_0x4e9a45['status'](_0xdc75d6)[_0xb001('0x2e')](_0x45a8b4);};}exports[_0xb001('0x2f')]=function(_0x3a701d,_0x37ba5f){var _0x229504={},_0x219d7d={},_0x334c63={'count':0x0,'rows':[]};var _0x550e9f=_[_0xb001('0x30')](db[_0xb001('0x31')][_0xb001('0x32')],function(_0x1fbbaf){return{'name':_0x1fbbaf[_0xb001('0x33')],'type':_0x1fbbaf[_0xb001('0x34')][_0xb001('0x35')]};});_0x219d7d[_0xb001('0x36')]=_['map'](_0x550e9f,'name');_0x219d7d[_0xb001('0x37')]=_['keys'](_0x3a701d[_0xb001('0x37')]);_0x219d7d['filters']=_['intersection'](_0x219d7d[_0xb001('0x36')],_0x219d7d['query']);_0x229504[_0xb001('0x38')]=_[_0xb001('0x39')](_0x219d7d[_0xb001('0x36')],qs[_0xb001('0x3a')](_0x3a701d[_0xb001('0x37')][_0xb001('0x3a')]));_0x229504[_0xb001('0x38')]=_0x229504[_0xb001('0x38')][_0xb001('0x3b')]?_0x229504['attributes']:_0x219d7d[_0xb001('0x36')];if(!_0x3a701d[_0xb001('0x37')][_0xb001('0x3c')](_0xb001('0x3d'))){_0x229504[_0xb001('0x21')]=qs['limit'](_0x3a701d['query']['limit']);_0x229504['offset']=qs[_0xb001('0x24')](_0x3a701d[_0xb001('0x37')][_0xb001('0x24')]);}_0x229504[_0xb001('0x3e')]=qs[_0xb001('0x3f')](_0x3a701d[_0xb001('0x37')]['sort']);_0x229504[_0xb001('0x40')]=qs[_0xb001('0x41')](_['pick'](_0x3a701d['query'],_0x219d7d[_0xb001('0x41')]),_0x550e9f);if(_0x3a701d['query'][_0xb001('0x42')]){_0x229504[_0xb001('0x40')]=_[_0xb001('0x43')](_0x229504[_0xb001('0x40')],{'$or':_[_0xb001('0x30')](_0x550e9f,function(_0x1ed67e){if(_0x1ed67e[_0xb001('0x34')]!==_0xb001('0x44')){var _0x2b534f={};_0x2b534f[_0x1ed67e[_0xb001('0x2d')]]={'$like':'%'+_0x3a701d[_0xb001('0x37')][_0xb001('0x42')]+'%'};return _0x2b534f;}})});}_0x229504=_[_0xb001('0x43')]({},_0x229504,_0x3a701d[_0xb001('0x45')]);var _0xb737fb={'where':_0x229504[_0xb001('0x40')]};return db['WhatsappQueue'][_0xb001('0x23')](_0xb737fb)[_0xb001('0x27')](function(_0x569a69){_0x334c63[_0xb001('0x23')]=_0x569a69;if(_0x3a701d[_0xb001('0x37')][_0xb001('0x46')]){_0x229504[_0xb001('0x47')]=[{'all':!![]}];}return db[_0xb001('0x31')][_0xb001('0x48')](_0x229504);})[_0xb001('0x27')](function(_0x86dd7b){_0x334c63[_0xb001('0x49')]=_0x86dd7b;return _0x334c63;})['then'](respondWithFilteredResult(_0x37ba5f,_0x229504))[_0xb001('0x4a')](handleError(_0x37ba5f,null));};exports['show']=function(_0x15955f,_0x43c648){var _0x39d0c5={'raw':!![],'where':{'id':_0x15955f[_0xb001('0x4b')]['id']}},_0xf60969={};_0xf60969[_0xb001('0x36')]=_[_0xb001('0x4c')](db[_0xb001('0x31')][_0xb001('0x32')]);_0xf60969[_0xb001('0x37')]=_['keys'](_0x15955f[_0xb001('0x37')]);_0xf60969[_0xb001('0x41')]=_['intersection'](_0xf60969[_0xb001('0x36')],_0xf60969['query']);_0x39d0c5[_0xb001('0x38')]=_['intersection'](_0xf60969['model'],qs['fields'](_0x15955f[_0xb001('0x37')]['fields']));_0x39d0c5['attributes']=_0x39d0c5[_0xb001('0x38')][_0xb001('0x3b')]?_0x39d0c5[_0xb001('0x38')]:_0xf60969[_0xb001('0x36')];if(_0x15955f[_0xb001('0x37')][_0xb001('0x46')]){_0x39d0c5[_0xb001('0x47')]=[{'all':!![]}];}_0x39d0c5=_['merge']({},_0x39d0c5,_0x15955f['options']);return db[_0xb001('0x31')][_0xb001('0x4d')](_0x39d0c5)['then'](handleEntityNotFound(_0x43c648,null))[_0xb001('0x27')](respondWithResult(_0x43c648,null))[_0xb001('0x4a')](handleError(_0x43c648,null));};exports[_0xb001('0x4e')]=function(_0x34c661,_0x17d555){return db[_0xb001('0x31')][_0xb001('0x4e')](_0x34c661[_0xb001('0x4f')],{})[_0xb001('0x27')](function(_0x658b30){var _0x3ef044=_0x34c661[_0xb001('0x50')][_0xb001('0x29')]({'plain':!![]});if(!_0x3ef044)throw new Error(_0xb001('0x51'));if(_0x3ef044[_0xb001('0x52')]===_0xb001('0x50')){var _0x254e5e=_0x658b30['get']({'plain':!![]});var _0x3dafb2='WhatsappQueues';return db[_0xb001('0x53')]['find']({'where':{'name':_0x3dafb2,'userProfileId':_0x3ef044[_0xb001('0x54')]},'raw':!![]})[_0xb001('0x27')](function(_0x371878){if(_0x371878&&_0x371878[_0xb001('0x55')]===0x0){return db[_0xb001('0x56')][_0xb001('0x4e')]({'name':_0x254e5e['name'],'resourceId':_0x254e5e['id'],'type':_0x371878[_0xb001('0x2d')],'sectionId':_0x371878['id']},{})[_0xb001('0x27')](function(){return _0x658b30;});}else{return _0x658b30;}})[_0xb001('0x4a')](function(_0x2db439){logger[_0xb001('0x2b')](_0xb001('0x57'),_0x2db439);throw _0x2db439;});}return _0x658b30;})['then'](respondWithResult(_0x17d555,0xc9))['catch'](handleError(_0x17d555,null));};exports['update']=function(_0x587d07,_0x15375b){if(_0x587d07[_0xb001('0x4f')]['id']){delete _0x587d07[_0xb001('0x4f')]['id'];}return db[_0xb001('0x31')][_0xb001('0x4d')]({'where':{'id':_0x587d07['params']['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x15375b,null))[_0xb001('0x27')](saveUpdates(_0x587d07[_0xb001('0x4f')],null))[_0xb001('0x27')](respondWithResult(_0x15375b,null))[_0xb001('0x4a')](handleError(_0x15375b,null));};exports['destroy']=function(_0x3971a0,_0x61efc6){return db['WhatsappQueue'][_0xb001('0x4d')]({'where':{'id':_0x3971a0[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x61efc6,null))[_0xb001('0x27')](removeEntity(_0x61efc6,null))[_0xb001('0x4a')](handleError(_0x61efc6,null));};exports[_0xb001('0x58')]=function(_0x3a0213,_0xe27353){return db['WhatsappQueue'][_0xb001('0x58')]()[_0xb001('0x27')](respondWithResult(_0xe27353,null))[_0xb001('0x4a')](handleError(_0xe27353,null));};exports[_0xb001('0x59')]=function(_0x22b3fb,_0x2c0cf9,_0x44cf60){var _0x3e3d41={'raw':!![],'where':{}},_0x576f3d={},_0xf2f7;return db[_0xb001('0x31')][_0xb001('0x5a')]({'where':{'id':_0x22b3fb[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x2c0cf9,null))[_0xb001('0x27')](function(_0xbde4bb){if(_0xbde4bb){_0xf2f7=_0xbde4bb[_0xb001('0x29')]({'plain':!![]});_0x576f3d['model']=_[_0xb001('0x4c')](db[_0xb001('0x5b')][_0xb001('0x32')]);_0x576f3d[_0xb001('0x37')]=_['keys'](_0x22b3fb[_0xb001('0x37')]);_0x576f3d['filters']=_['intersection'](_0x576f3d[_0xb001('0x36')],_0x576f3d[_0xb001('0x37')]);_0x3e3d41[_0xb001('0x38')]=_[_0xb001('0x39')](_0x576f3d[_0xb001('0x36')],qs[_0xb001('0x3a')](_0x22b3fb['query'][_0xb001('0x3a')]));_0x3e3d41[_0xb001('0x38')]=_0x3e3d41[_0xb001('0x38')][_0xb001('0x3b')]?_0x3e3d41[_0xb001('0x38')]:_0x576f3d['model'];if(!_0x22b3fb[_0xb001('0x37')][_0xb001('0x3c')](_0xb001('0x3d'))){_0x3e3d41[_0xb001('0x21')]=qs[_0xb001('0x21')](_0x22b3fb[_0xb001('0x37')]['limit']);_0x3e3d41['offset']=qs[_0xb001('0x24')](_0x22b3fb[_0xb001('0x37')]['offset']);}_0x3e3d41[_0xb001('0x3e')]=qs[_0xb001('0x3f')](_0x22b3fb[_0xb001('0x37')]['sort']);_0x3e3d41['where']=qs[_0xb001('0x41')](_[_0xb001('0x5c')](_0x22b3fb[_0xb001('0x37')],_0x576f3d[_0xb001('0x41')]));_0x3e3d41[_0xb001('0x40')][_0xb001('0x5d')]=_0xbde4bb['id'];if(_0x22b3fb[_0xb001('0x37')][_0xb001('0x42')]){_0x3e3d41['where']=_[_0xb001('0x43')](_0x3e3d41[_0xb001('0x40')],{'$or':_[_0xb001('0x30')](_0x3e3d41[_0xb001('0x38')],function(_0x4ef23c){var _0x564766={};_0x564766[_0x4ef23c]={'$like':'%'+_0x22b3fb[_0xb001('0x37')][_0xb001('0x42')]+'%'};return _0x564766;})});}_0x3e3d41=_[_0xb001('0x43')]({},_0x3e3d41,_0x22b3fb[_0xb001('0x45')]);return db[_0xb001('0x5b')][_0xb001('0x48')](_0x3e3d41);}})['then'](function(_0x4ca36d){if(_0x4ca36d){return db['User']['findAndCountAll']({'where':{'id':_[_0xb001('0x30')](_0x4ca36d,_0xb001('0x5e')),'role':_0xb001('0x5f')},'attributes':['id','name',_0xb001('0x60'),_0xb001('0x61'),_0xb001('0x62')]});}})['then'](function(_0x189648){if(_0x189648){return{'count':_0x189648[_0xb001('0x23')],'rows':_[_0xb001('0x30')](_0x189648[_0xb001('0x49')],function(_0x50c783){return{'membername':_0x50c783[_0xb001('0x2d')],'UserId':_0x50c783['id'],'queue_name':_0xf2f7[_0xb001('0x2d')],'WhatsappQueueId':_0xf2f7['id'],'interface':util[_0xb001('0x63')]('%s/%s',_0xb001('0x64'),_0x50c783[_0xb001('0x2d')]),'penalty':0x0,'paused':_0x50c783[_0xb001('0x60')],'createdAt':_0x50c783[_0xb001('0x62')],'updatedAt':_0x50c783[_0xb001('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb001('0x27')](respondWithFilteredResult(_0x2c0cf9,_0x3e3d41))['catch'](handleError(_0x2c0cf9,null));};exports[_0xb001('0x65')]=function(_0x3a1467,_0xdf1bab,_0x544588){var _0x14a4b3={};var _0x36484b={};var _0x42d23e;var _0x175cad;return db[_0xb001('0x31')][_0xb001('0x5a')]({'where':{'id':_0x3a1467[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0xdf1bab,null))['then'](function(_0x3624c4){if(_0x3624c4){_0x42d23e=_0x3624c4;_0x36484b[_0xb001('0x36')]=_[_0xb001('0x4c')](db[_0xb001('0x66')][_0xb001('0x32')]);_0x36484b[_0xb001('0x37')]=_['keys'](_0x3a1467[_0xb001('0x37')]);_0x36484b[_0xb001('0x41')]=_['intersection'](_0x36484b['model'],_0x36484b[_0xb001('0x37')]);_0x14a4b3[_0xb001('0x38')]=_[_0xb001('0x39')](_0x36484b[_0xb001('0x36')],qs['fields'](_0x3a1467[_0xb001('0x37')][_0xb001('0x3a')]));_0x14a4b3[_0xb001('0x38')]=_0x14a4b3[_0xb001('0x38')][_0xb001('0x3b')]?_0x14a4b3['attributes']:_0x36484b[_0xb001('0x36')];_0x14a4b3['order']=qs[_0xb001('0x3f')](_0x3a1467[_0xb001('0x37')][_0xb001('0x3f')]);_0x14a4b3[_0xb001('0x40')]=qs[_0xb001('0x41')](_[_0xb001('0x5c')](_0x3a1467[_0xb001('0x37')],_0x36484b[_0xb001('0x41')]));if(_0x3a1467[_0xb001('0x37')][_0xb001('0x42')]){_0x14a4b3['where']=_['merge'](_0x14a4b3[_0xb001('0x40')],{'$or':_[_0xb001('0x30')](_0x14a4b3[_0xb001('0x38')],function(_0x3df7d1){var _0x56a064={};_0x56a064[_0x3df7d1]={'$like':'%'+_0x3a1467[_0xb001('0x37')][_0xb001('0x42')]+'%'};return _0x56a064;})});}_0x14a4b3=_[_0xb001('0x43')]({},_0x14a4b3,_0x3a1467['options']);return _0x42d23e[_0xb001('0x65')](_0x14a4b3);}})[_0xb001('0x27')](function(_0x741747){if(_0x741747){_0x175cad=_0x741747['length'];if(!_0x3a1467['query']['hasOwnProperty'](_0xb001('0x3d'))){_0x14a4b3[_0xb001('0x21')]=qs[_0xb001('0x21')](_0x3a1467['query'][_0xb001('0x21')]);_0x14a4b3['offset']=qs[_0xb001('0x24')](_0x3a1467['query'][_0xb001('0x24')]);}return _0x42d23e[_0xb001('0x65')](_0x14a4b3);}})[_0xb001('0x27')](function(_0x2600c7){if(_0x2600c7){return _0x2600c7?{'count':_0x175cad,'rows':_0x2600c7}:null;}})['then'](respondWithResult(_0xdf1bab,null))['catch'](handleError(_0xdf1bab,null));};exports['addTeams']=function(_0x285bf5,_0x5c36ad,_0x414575){var _0x5a08b9=_0x285bf5[_0xb001('0x4f')][_0xb001('0x67')];return db[_0xb001('0x66')][_0xb001('0x48')]({'where':{'id':_0x5a08b9},'attributes':['id'],'include':[{'model':db[_0xb001('0x68')],'as':_0xb001('0x69'),'attributes':['id',_0xb001('0x2d'),_0xb001('0x6a'),_0xb001('0x6b'),_0xb001('0x6c')],'raw':!![]}]})['then'](function(_0x3346cd){if(_0x3346cd){var _0x5d7fe3=_[_0xb001('0x6d')](_0x3346cd,function(_0x2043e8){var _0x1f83dc=_0x2043e8['get']({'plain':!![]});return _0x1f83dc[_0xb001('0x69')];});return db[_0xb001('0x31')][_0xb001('0x4d')]({'where':{'id':_0x285bf5[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](function(_0x5f0ac2){return db[_0xb001('0x6e')]['transaction'](function(_0x122ce0){return _0x5f0ac2[_0xb001('0x6f')](_0x5a08b9,{'transaction':_0x122ce0})[_0xb001('0x27')](function(){return BPromise[_0xb001('0x70')](_0x5d7fe3,function(_0x5344b2){return db['UserWhatsappQueue'][_0xb001('0x71')]({'where':{'UserId':_0x5344b2['id'],'WhatsappQueueId':_0x285bf5['params']['id']},'transaction':_0x122ce0});});})[_0xb001('0x27')](function(){_0x5d7fe3['forEach'](function(_0x450b17){socket[_0xb001('0x72')](_0xb001('0x73'),{'UserId':_0x450b17['id'],'WhatsappQueueId':_0x5f0ac2['id']});});});});});}})[_0xb001('0x27')](respondWithStatusCode(_0x5c36ad,null))['catch'](handleError(_0x5c36ad,null));};exports[_0xb001('0x74')]=function(_0x172eff,_0x26ff8f,_0x446587){return db[_0xb001('0x66')][_0xb001('0x48')]({'where':{'id':_0x172eff[_0xb001('0x37')][_0xb001('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb001('0x27')](handleEntityNotFound(_0x26ff8f,null))['then'](function(_0x1dc250){var _0xd13f4c=_[_0xb001('0x30')](_0x1dc250,'id');var _0x33950a=[];var _0x20fe47=[];var _0x1fe216=squel[_0xb001('0x75')]();_0x1fe216[_0xb001('0x76')](_0xb001('0x77'))[_0xb001('0x78')](_0xb001('0x79'),'tq')[_0xb001('0x7a')](_0xb001('0x7b'),'ut',_0xb001('0x7c'))['where'](_0xb001('0x7d'),_0x172eff['params']['id']);for(var _0x190c9c=0x0;_0x190c9c<_0x1dc250[_0xb001('0x3b')];_0x190c9c+=0x1){let _0x3425ad=_0x1dc250[_0x190c9c];for(var _0x5e571d=0x0;_0x5e571d<_0x3425ad[_0xb001('0x69')]['length'];_0x5e571d+=0x1){let _0x3746a8=_0x3425ad[_0xb001('0x69')][_0x5e571d];var _0x27b7de=_0x1fe216[_0xb001('0x7e')]();_0x27b7de[_0xb001('0x40')](_0xb001('0x7f'),_0x3746a8['id']);_0x20fe47[_0xb001('0x80')](db[_0xb001('0x6e')][_0xb001('0x37')](_0x27b7de['toString'](),{'type':db[_0xb001('0x6e')]['QueryTypes']['SELECT']})[_0xb001('0x27')](function(_0xe8805a){if(_0xe8805a['length']===0x1){return _0x3746a8['id'];}else{var _0x33c985=_[_0xb001('0x81')](_[_0xb001('0x30')](_0xe8805a,_0xb001('0x82')),function(_0x4a72df){return _[_0xb001('0x83')](_0xd13f4c,_0x4a72df);});if(_0x33c985){return _0x3746a8['id'];}}}));}}return BPromise[_0xb001('0x84')](_0x20fe47)['then'](function(_0x5162e2){_0x33950a=_(_0x33950a)[_0xb001('0x85')](_0x5162e2)[_0xb001('0x86')]()[_0xb001('0x87')]();return db[_0xb001('0x31')]['find']({'where':{'id':_0x172eff[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](function(_0x3bb255){return db[_0xb001('0x6e')][_0xb001('0x88')](function(_0x53b96d){return _0x3bb255[_0xb001('0x74')](_0x172eff[_0xb001('0x37')][_0xb001('0x67')],{'transaction':_0x53b96d})[_0xb001('0x27')](function(){if(!_[_0xb001('0x89')](_0x33950a)){return _0x3bb255[_0xb001('0x8a')](_0x33950a,{'transaction':_0x53b96d});}})[_0xb001('0x27')](function(){_0x33950a[_0xb001('0x8b')](function(_0x4af48a){socket[_0xb001('0x72')](_0xb001('0x8c'),{'UserId':_0x4af48a,'WhatsappQueueId':_0x3bb255['id']});});});});});});})[_0xb001('0x27')](respondWithStatusCode(_0x26ff8f,null))[_0xb001('0x4a')](handleError(_0x26ff8f,null));};exports[_0xb001('0x8d')]=function(_0x243bf3,_0x2354a7,_0x5b71a8){return db[_0xb001('0x31')]['find']({'where':{'id':_0x243bf3[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x2354a7,null))[_0xb001('0x27')](function(_0x797436){if(_0x797436){return _0x797436[_0xb001('0x8d')](_0x243bf3['body'][_0xb001('0x67')],_['omit'](_0x243bf3[_0xb001('0x4f')],['ids','id'])||{})[_0xb001('0x8e')](function(_0x16543f){for(var _0x2980dc=0x0;_0x2980dc<_0x243bf3['body'][_0xb001('0x67')]['length'];_0x2980dc+=0x1){socket[_0xb001('0x72')](_0xb001('0x73'),{'UserId':Number(_0x243bf3['body'][_0xb001('0x67')][_0x2980dc]),'WhatsappQueueId':Number(_0x243bf3[_0xb001('0x4b')]['id'])});}return _0x16543f;});}})[_0xb001('0x27')](respondWithResult(_0x2354a7,null))[_0xb001('0x4a')](handleError(_0x2354a7,null));};exports[_0xb001('0x8a')]=function(_0x485ad9,_0x5a2f06,_0x238bc3){return db[_0xb001('0x31')]['find']({'where':{'id':_0x485ad9[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x5a2f06,null))[_0xb001('0x27')](function(_0x12a137){if(_0x12a137){return _0x12a137['removeAgents'](_0x485ad9[_0xb001('0x37')][_0xb001('0x67')])[_0xb001('0x27')](function(){if(_[_0xb001('0x8f')](_0x485ad9[_0xb001('0x37')]['ids'])){for(var _0x32ac96=0x0;_0x32ac96<_0x485ad9['query'][_0xb001('0x67')][_0xb001('0x3b')];_0x32ac96+=0x1){socket[_0xb001('0x72')](_0xb001('0x8c'),{'UserId':Number(_0x485ad9[_0xb001('0x37')]['ids'][_0x32ac96]),'WhatsappQueueId':Number(_0x485ad9[_0xb001('0x4b')]['id'])});}}else{socket[_0xb001('0x72')](_0xb001('0x8c'),{'UserId':Number(_0x485ad9['query'][_0xb001('0x67')]),'WhatsappQueueId':Number(_0x485ad9[_0xb001('0x4b')]['id'])});}});}})[_0xb001('0x27')](respondWithStatusCode(_0x5a2f06,null))['catch'](handleError(_0x5a2f06,null));};exports[_0xb001('0x90')]=function(_0x48e73d,_0x4a10dd,_0x2f3cd6){var _0x2139a1={};var _0xdac465={};var _0x125cea;var _0x304d98;return db['WhatsappQueue'][_0xb001('0x5a')]({'where':{'id':_0x48e73d[_0xb001('0x4b')]['id']}})[_0xb001('0x27')](handleEntityNotFound(_0x4a10dd,null))[_0xb001('0x27')](function(_0x1d03b5){if(_0x1d03b5){_0x125cea=_0x1d03b5;_0xdac465['model']=_[_0xb001('0x4c')](db[_0xb001('0x68')][_0xb001('0x32')]);_0xdac465[_0xb001('0x37')]=_[_0xb001('0x4c')](_0x48e73d[_0xb001('0x37')]);_0xdac465[_0xb001('0x41')]=_[_0xb001('0x39')](_0xdac465[_0xb001('0x36')],_0xdac465[_0xb001('0x37')]);_0x2139a1[_0xb001('0x38')]=_[_0xb001('0x39')](_0xdac465[_0xb001('0x36')],qs[_0xb001('0x3a')](_0x48e73d['query'][_0xb001('0x3a')]));_0x2139a1[_0xb001('0x38')]=_0x2139a1[_0xb001('0x38')][_0xb001('0x3b')]?_0x2139a1[_0xb001('0x38')]:_0xdac465[_0xb001('0x36')];_0x2139a1[_0xb001('0x3e')]=qs['sort'](_0x48e73d[_0xb001('0x37')][_0xb001('0x3f')]);_0x2139a1['where']=qs[_0xb001('0x41')](_[_0xb001('0x5c')](_0x48e73d[_0xb001('0x37')],_0xdac465[_0xb001('0x41')]));if(_0x48e73d['query'][_0xb001('0x42')]){_0x2139a1['where']=_[_0xb001('0x43')](_0x2139a1[_0xb001('0x40')],{'$or':_[_0xb001('0x30')](_0x2139a1['attributes'],function(_0x13bd49){var _0x11a31f={};_0x11a31f[_0x13bd49]={'$like':'%'+_0x48e73d['query'][_0xb001('0x42')]+'%'};return _0x11a31f;})});}_0x2139a1=_[_0xb001('0x43')]({},_0x2139a1,_0x48e73d[_0xb001('0x45')]);return _0x125cea[_0xb001('0x90')](_0x2139a1);}})[_0xb001('0x27')](function(_0x72ec9b){if(_0x72ec9b){_0x304d98=_0x72ec9b[_0xb001('0x3b')];if(!_0x48e73d[_0xb001('0x37')][_0xb001('0x3c')](_0xb001('0x3d'))){_0x2139a1[_0xb001('0x21')]=qs[_0xb001('0x21')](_0x48e73d[_0xb001('0x37')]['limit']);_0x2139a1[_0xb001('0x24')]=qs[_0xb001('0x24')](_0x48e73d[_0xb001('0x37')][_0xb001('0x24')]);}return _0x125cea[_0xb001('0x90')](_0x2139a1);}})[_0xb001('0x27')](function(_0xbdee06){if(_0xbdee06){return _0xbdee06?{'count':_0x304d98,'rows':_0xbdee06}:null;}})['then'](respondWithResult(_0x4a10dd,null))['catch'](handleError(_0x4a10dd,null));}; \ No newline at end of file +var _0xcdfa=['flatMap','sequelize','transaction','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','type','key','model','keys','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','options','include','findAll','rows','catch','WhatsappQueue','rawAttributes','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserWhatsappQueue','intersection','order','WhatsappQueueId','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','findOne','Team','addTeams','ids','User','Agents','online','voicePause','interface'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xcdfa,0x12f));var _0xacdf=function(_0x40d333,_0x35e702){_0x40d333=_0x40d333-0x0;var _0x55d5d=_0xcdfa[_0x40d333];return _0x55d5d;};'use strict';var emlformat=require(_0xacdf('0x0'));var rimraf=require(_0xacdf('0x1'));var zipdir=require(_0xacdf('0x2'));var jsonpatch=require(_0xacdf('0x3'));var rp=require('request-promise');var moment=require(_0xacdf('0x4'));var BPromise=require(_0xacdf('0x5'));var Mustache=require('mustache');var util=require(_0xacdf('0x6'));var path=require(_0xacdf('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xacdf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacdf('0x9'));var squel=require(_0xacdf('0xa'));var crypto=require(_0xacdf('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xacdf('0xc'));var toCsv=require(_0xacdf('0xd'));var querystring=require(_0xacdf('0xe'));var Papa=require('papaparse');var Redis=require(_0xacdf('0xf'));var authService=require(_0xacdf('0x10'));var qs=require(_0xacdf('0x11'));var as=require(_0xacdf('0x12'));var hardwareService=require(_0xacdf('0x13'));var logger=require('../../config/logger')(_0xacdf('0x14'));var utils=require(_0xacdf('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xacdf('0x16')]=_[_0xacdf('0x17')](config['redis'],{'host':_0xacdf('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0xc6a477,_0x11a2cb){_0x11a2cb=_0x11a2cb||0xcc;return function(_0xcb4e9e){if(_0xcb4e9e){return _0xc6a477[_0xacdf('0x19')](_0x11a2cb);}return _0xc6a477[_0xacdf('0x1a')](_0x11a2cb)[_0xacdf('0x1b')]();};}function respondWithResult(_0x559e61,_0x26fff6){_0x26fff6=_0x26fff6||0xc8;return function(_0x4b8e22){if(_0x4b8e22){return _0x559e61[_0xacdf('0x1a')](_0x26fff6)[_0xacdf('0x1c')](_0x4b8e22);}};}function respondWithFilteredResult(_0x198b47,_0x3f6edf){return function(_0x5290e1){if(_0x5290e1){var _0x547b01=typeof _0x3f6edf[_0xacdf('0x1d')]===_0xacdf('0x1e')&&typeof _0x3f6edf[_0xacdf('0x1f')]===_0xacdf('0x1e');var _0x379d37=_0x5290e1['count'];var _0x3c3a94=_0x547b01?0x0:_0x3f6edf['offset'];var _0x47c9ed=_0x547b01?_0x5290e1[_0xacdf('0x20')]:_0x3f6edf[_0xacdf('0x1d')]+_0x3f6edf['limit'];var _0x13aff8;if(_0x47c9ed>=_0x379d37){_0x47c9ed=_0x379d37;_0x13aff8=0xc8;}else{_0x13aff8=0xce;}_0x198b47[_0xacdf('0x1a')](_0x13aff8);return _0x198b47[_0xacdf('0x21')](_0xacdf('0x22'),_0x3c3a94+'-'+_0x47c9ed+'/'+_0x379d37)[_0xacdf('0x1c')](_0x5290e1);}return null;};}function patchUpdates(_0x44cc1c){return function(_0x5703a7){try{jsonpatch[_0xacdf('0x23')](_0x5703a7,_0x44cc1c,!![]);}catch(_0x5c5012){return BPromise[_0xacdf('0x24')](_0x5c5012);}return _0x5703a7[_0xacdf('0x25')]();};}function saveUpdates(_0x526ed,_0x3b90fc){return function(_0x4d72f7){if(_0x4d72f7){return _0x4d72f7[_0xacdf('0x26')](_0x526ed)[_0xacdf('0x27')](function(_0x451cc9){return _0x451cc9;});}return null;};}function removeEntity(_0x8e728d,_0x16f4dc){return function(_0x1cc1db){if(_0x1cc1db){return _0x1cc1db[_0xacdf('0x28')]()[_0xacdf('0x27')](function(){var _0x370c94=_0x1cc1db[_0xacdf('0x29')]({'plain':!![]});var _0x3b9f69='WhatsappQueues';return db[_0xacdf('0x2a')][_0xacdf('0x28')]({'where':{'type':_0x3b9f69,'resourceId':_0x370c94['id']}})[_0xacdf('0x27')](function(){return _0x1cc1db;});})['then'](function(){_0x8e728d[_0xacdf('0x1a')](0xcc)[_0xacdf('0x1b')]();});}};}function handleEntityNotFound(_0x1e9a26,_0x2607f4){return function(_0xc0dabd){if(!_0xc0dabd){_0x1e9a26[_0xacdf('0x19')](0x194);}return _0xc0dabd;};}function handleError(_0xe12a54,_0x3ecd67){_0x3ecd67=_0x3ecd67||0x1f4;return function(_0x5da46e){logger[_0xacdf('0x2b')](_0x5da46e[_0xacdf('0x2c')]);if(_0x5da46e['name']){delete _0x5da46e[_0xacdf('0x2d')];}_0xe12a54[_0xacdf('0x1a')](_0x3ecd67)[_0xacdf('0x2e')](_0x5da46e);};}exports['index']=function(_0x594ab0,_0x22d391){var _0x54d269={},_0x1e24e5={},_0x39029d={'count':0x0,'rows':[]};var _0x518ade=_[_0xacdf('0x2f')](db['WhatsappQueue']['rawAttributes'],function(_0x53d19e){return{'name':_0x53d19e['fieldName'],'type':_0x53d19e[_0xacdf('0x30')][_0xacdf('0x31')]};});_0x1e24e5[_0xacdf('0x32')]=_[_0xacdf('0x2f')](_0x518ade,_0xacdf('0x2d'));_0x1e24e5['query']=_[_0xacdf('0x33')](_0x594ab0[_0xacdf('0x34')]);_0x1e24e5['filters']=_['intersection'](_0x1e24e5[_0xacdf('0x32')],_0x1e24e5[_0xacdf('0x34')]);_0x54d269['attributes']=_['intersection'](_0x1e24e5[_0xacdf('0x32')],qs[_0xacdf('0x35')](_0x594ab0[_0xacdf('0x34')][_0xacdf('0x35')]));_0x54d269[_0xacdf('0x36')]=_0x54d269[_0xacdf('0x36')][_0xacdf('0x37')]?_0x54d269[_0xacdf('0x36')]:_0x1e24e5[_0xacdf('0x32')];if(!_0x594ab0[_0xacdf('0x34')][_0xacdf('0x38')](_0xacdf('0x39'))){_0x54d269['limit']=qs[_0xacdf('0x1f')](_0x594ab0[_0xacdf('0x34')][_0xacdf('0x1f')]);_0x54d269[_0xacdf('0x1d')]=qs[_0xacdf('0x1d')](_0x594ab0[_0xacdf('0x34')][_0xacdf('0x1d')]);}_0x54d269['order']=qs['sort'](_0x594ab0[_0xacdf('0x34')][_0xacdf('0x3a')]);_0x54d269['where']=qs['filters'](_[_0xacdf('0x3b')](_0x594ab0[_0xacdf('0x34')],_0x1e24e5[_0xacdf('0x3c')]),_0x518ade);if(_0x594ab0[_0xacdf('0x34')][_0xacdf('0x3d')]){_0x54d269[_0xacdf('0x3e')]=_['merge'](_0x54d269[_0xacdf('0x3e')],{'$or':_['map'](_0x518ade,function(_0x3f31a5){if(_0x3f31a5['type']!=='VIRTUAL'){var _0x549a7f={};_0x549a7f[_0x3f31a5[_0xacdf('0x2d')]]={'$like':'%'+_0x594ab0[_0xacdf('0x34')][_0xacdf('0x3d')]+'%'};return _0x549a7f;}})});}_0x54d269=_['merge']({},_0x54d269,_0x594ab0[_0xacdf('0x3f')]);var _0x44a03={'where':_0x54d269[_0xacdf('0x3e')]};return db['WhatsappQueue'][_0xacdf('0x20')](_0x44a03)['then'](function(_0x187e8f){_0x39029d[_0xacdf('0x20')]=_0x187e8f;if(_0x594ab0[_0xacdf('0x34')]['includeAll']){_0x54d269[_0xacdf('0x40')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xacdf('0x41')](_0x54d269);})[_0xacdf('0x27')](function(_0x44e5e3){_0x39029d[_0xacdf('0x42')]=_0x44e5e3;return _0x39029d;})[_0xacdf('0x27')](respondWithFilteredResult(_0x22d391,_0x54d269))[_0xacdf('0x43')](handleError(_0x22d391,null));};exports['show']=function(_0x46ccb0,_0x30b889){var _0x46897f={'raw':!![],'where':{'id':_0x46ccb0['params']['id']}},_0x6112e={};_0x6112e[_0xacdf('0x32')]=_[_0xacdf('0x33')](db[_0xacdf('0x44')][_0xacdf('0x45')]);_0x6112e[_0xacdf('0x34')]=_[_0xacdf('0x33')](_0x46ccb0['query']);_0x6112e[_0xacdf('0x3c')]=_['intersection'](_0x6112e[_0xacdf('0x32')],_0x6112e['query']);_0x46897f['attributes']=_['intersection'](_0x6112e[_0xacdf('0x32')],qs[_0xacdf('0x35')](_0x46ccb0[_0xacdf('0x34')][_0xacdf('0x35')]));_0x46897f[_0xacdf('0x36')]=_0x46897f[_0xacdf('0x36')][_0xacdf('0x37')]?_0x46897f[_0xacdf('0x36')]:_0x6112e[_0xacdf('0x32')];if(_0x46ccb0[_0xacdf('0x34')][_0xacdf('0x46')]){_0x46897f[_0xacdf('0x40')]=[{'all':!![]}];}_0x46897f=_[_0xacdf('0x47')]({},_0x46897f,_0x46ccb0[_0xacdf('0x3f')]);return db[_0xacdf('0x44')][_0xacdf('0x48')](_0x46897f)['then'](handleEntityNotFound(_0x30b889,null))[_0xacdf('0x27')](respondWithResult(_0x30b889,null))[_0xacdf('0x43')](handleError(_0x30b889,null));};exports[_0xacdf('0x49')]=function(_0x527a74,_0x23f31f){return db['WhatsappQueue'][_0xacdf('0x49')](_0x527a74[_0xacdf('0x4a')],{})[_0xacdf('0x27')](function(_0x4e2aad){var _0x230241=_0x527a74['user']['get']({'plain':!![]});if(!_0x230241)throw new Error(_0xacdf('0x4b'));if(_0x230241[_0xacdf('0x4c')]===_0xacdf('0x4d')){var _0x57564f=_0x4e2aad['get']({'plain':!![]});var _0x5e5bdb=_0xacdf('0x4e');return db[_0xacdf('0x4f')][_0xacdf('0x48')]({'where':{'name':_0x5e5bdb,'userProfileId':_0x230241[_0xacdf('0x50')]},'raw':!![]})[_0xacdf('0x27')](function(_0x45fc94){if(_0x45fc94&&_0x45fc94[_0xacdf('0x51')]===0x0){return db[_0xacdf('0x2a')][_0xacdf('0x49')]({'name':_0x57564f[_0xacdf('0x2d')],'resourceId':_0x57564f['id'],'type':_0x45fc94['name'],'sectionId':_0x45fc94['id']},{})[_0xacdf('0x27')](function(){return _0x4e2aad;});}else{return _0x4e2aad;}})[_0xacdf('0x43')](function(_0x263d85){logger[_0xacdf('0x2b')](_0xacdf('0x52'),_0x263d85);throw _0x263d85;});}return _0x4e2aad;})[_0xacdf('0x27')](respondWithResult(_0x23f31f,0xc9))['catch'](handleError(_0x23f31f,null));};exports[_0xacdf('0x26')]=function(_0x316ba9,_0x229681){if(_0x316ba9[_0xacdf('0x4a')]['id']){delete _0x316ba9[_0xacdf('0x4a')]['id'];}return db[_0xacdf('0x44')]['find']({'where':{'id':_0x316ba9[_0xacdf('0x53')]['id']}})[_0xacdf('0x27')](handleEntityNotFound(_0x229681,null))['then'](saveUpdates(_0x316ba9[_0xacdf('0x4a')],null))[_0xacdf('0x27')](respondWithResult(_0x229681,null))[_0xacdf('0x43')](handleError(_0x229681,null));};exports[_0xacdf('0x28')]=function(_0x574f48,_0x1a6eb7){return db[_0xacdf('0x44')][_0xacdf('0x48')]({'where':{'id':_0x574f48['params']['id']}})[_0xacdf('0x27')](handleEntityNotFound(_0x1a6eb7,null))[_0xacdf('0x27')](removeEntity(_0x1a6eb7,null))['catch'](handleError(_0x1a6eb7,null));};exports[_0xacdf('0x54')]=function(_0x5ad7ed,_0x5e9877){return db[_0xacdf('0x44')][_0xacdf('0x54')]()[_0xacdf('0x27')](respondWithResult(_0x5e9877,null))[_0xacdf('0x43')](handleError(_0x5e9877,null));};exports[_0xacdf('0x55')]=function(_0x114de4,_0x452e72,_0x365231){var _0xa7da04={'raw':!![],'where':{}},_0x411eca={},_0x449ae7;return db[_0xacdf('0x44')]['findOne']({'where':{'id':_0x114de4[_0xacdf('0x53')]['id']}})[_0xacdf('0x27')](handleEntityNotFound(_0x452e72,null))['then'](function(_0x39e90f){if(_0x39e90f){_0x449ae7=_0x39e90f['get']({'plain':!![]});_0x411eca['model']=_['keys'](db[_0xacdf('0x56')][_0xacdf('0x45')]);_0x411eca[_0xacdf('0x34')]=_[_0xacdf('0x33')](_0x114de4[_0xacdf('0x34')]);_0x411eca[_0xacdf('0x3c')]=_[_0xacdf('0x57')](_0x411eca['model'],_0x411eca[_0xacdf('0x34')]);_0xa7da04[_0xacdf('0x36')]=_['intersection'](_0x411eca['model'],qs[_0xacdf('0x35')](_0x114de4[_0xacdf('0x34')][_0xacdf('0x35')]));_0xa7da04[_0xacdf('0x36')]=_0xa7da04[_0xacdf('0x36')]['length']?_0xa7da04[_0xacdf('0x36')]:_0x411eca[_0xacdf('0x32')];if(!_0x114de4[_0xacdf('0x34')][_0xacdf('0x38')](_0xacdf('0x39'))){_0xa7da04[_0xacdf('0x1f')]=qs['limit'](_0x114de4[_0xacdf('0x34')][_0xacdf('0x1f')]);_0xa7da04[_0xacdf('0x1d')]=qs[_0xacdf('0x1d')](_0x114de4[_0xacdf('0x34')][_0xacdf('0x1d')]);}_0xa7da04[_0xacdf('0x58')]=qs[_0xacdf('0x3a')](_0x114de4['query']['sort']);_0xa7da04[_0xacdf('0x3e')]=qs[_0xacdf('0x3c')](_[_0xacdf('0x3b')](_0x114de4[_0xacdf('0x34')],_0x411eca[_0xacdf('0x3c')]));_0xa7da04[_0xacdf('0x3e')][_0xacdf('0x59')]=_0x39e90f['id'];if(_0x114de4[_0xacdf('0x34')][_0xacdf('0x3d')]){_0xa7da04[_0xacdf('0x3e')]=_[_0xacdf('0x47')](_0xa7da04[_0xacdf('0x3e')],{'$or':_[_0xacdf('0x2f')](_0xa7da04['attributes'],function(_0x5a4848){var _0x178189={};_0x178189[_0x5a4848]={'$like':'%'+_0x114de4[_0xacdf('0x34')][_0xacdf('0x3d')]+'%'};return _0x178189;})});}_0xa7da04=_[_0xacdf('0x47')]({},_0xa7da04,_0x114de4[_0xacdf('0x3f')]);return db[_0xacdf('0x56')][_0xacdf('0x41')](_0xa7da04);}})['then'](function(_0x526477){if(_0x526477){return db['User'][_0xacdf('0x5a')]({'where':{'id':_['map'](_0x526477,_0xacdf('0x5b')),'role':_0xacdf('0x5c')},'attributes':['id',_0xacdf('0x2d'),'whatsappPause','updatedAt',_0xacdf('0x5d')]});}})['then'](function(_0x467388){if(_0x467388){return{'count':_0x467388[_0xacdf('0x20')],'rows':_[_0xacdf('0x2f')](_0x467388['rows'],function(_0x587738){return{'membername':_0x587738[_0xacdf('0x2d')],'UserId':_0x587738['id'],'queue_name':_0x449ae7['name'],'WhatsappQueueId':_0x449ae7['id'],'interface':util[_0xacdf('0x5e')](_0xacdf('0x5f'),_0xacdf('0x60'),_0x587738['name']),'penalty':0x0,'paused':_0x587738[_0xacdf('0x61')],'createdAt':_0x587738[_0xacdf('0x5d')],'updatedAt':_0x587738['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xacdf('0x27')](respondWithFilteredResult(_0x452e72,_0xa7da04))[_0xacdf('0x43')](handleError(_0x452e72,null));};exports[_0xacdf('0x62')]=function(_0x35fae6,_0x3bcbf1,_0x1d7f60){var _0x3d2046={};var _0xfd2179={};var _0x5b6e9c;var _0x4f63b2;return db[_0xacdf('0x44')][_0xacdf('0x63')]({'where':{'id':_0x35fae6[_0xacdf('0x53')]['id']}})[_0xacdf('0x27')](handleEntityNotFound(_0x3bcbf1,null))['then'](function(_0x279431){if(_0x279431){_0x5b6e9c=_0x279431;_0xfd2179[_0xacdf('0x32')]=_[_0xacdf('0x33')](db[_0xacdf('0x64')][_0xacdf('0x45')]);_0xfd2179[_0xacdf('0x34')]=_[_0xacdf('0x33')](_0x35fae6['query']);_0xfd2179[_0xacdf('0x3c')]=_[_0xacdf('0x57')](_0xfd2179[_0xacdf('0x32')],_0xfd2179[_0xacdf('0x34')]);_0x3d2046[_0xacdf('0x36')]=_[_0xacdf('0x57')](_0xfd2179[_0xacdf('0x32')],qs[_0xacdf('0x35')](_0x35fae6[_0xacdf('0x34')][_0xacdf('0x35')]));_0x3d2046[_0xacdf('0x36')]=_0x3d2046[_0xacdf('0x36')][_0xacdf('0x37')]?_0x3d2046[_0xacdf('0x36')]:_0xfd2179[_0xacdf('0x32')];_0x3d2046[_0xacdf('0x58')]=qs['sort'](_0x35fae6[_0xacdf('0x34')][_0xacdf('0x3a')]);_0x3d2046[_0xacdf('0x3e')]=qs[_0xacdf('0x3c')](_['pick'](_0x35fae6[_0xacdf('0x34')],_0xfd2179[_0xacdf('0x3c')]));if(_0x35fae6[_0xacdf('0x34')][_0xacdf('0x3d')]){_0x3d2046[_0xacdf('0x3e')]=_[_0xacdf('0x47')](_0x3d2046[_0xacdf('0x3e')],{'$or':_['map'](_0x3d2046[_0xacdf('0x36')],function(_0x1321a8){var _0x3992a5={};_0x3992a5[_0x1321a8]={'$like':'%'+_0x35fae6[_0xacdf('0x34')]['filter']+'%'};return _0x3992a5;})});}_0x3d2046=_[_0xacdf('0x47')]({},_0x3d2046,_0x35fae6[_0xacdf('0x3f')]);return _0x5b6e9c[_0xacdf('0x62')](_0x3d2046);}})['then'](function(_0x436261){if(_0x436261){_0x4f63b2=_0x436261[_0xacdf('0x37')];if(!_0x35fae6[_0xacdf('0x34')][_0xacdf('0x38')](_0xacdf('0x39'))){_0x3d2046[_0xacdf('0x1f')]=qs[_0xacdf('0x1f')](_0x35fae6['query'][_0xacdf('0x1f')]);_0x3d2046['offset']=qs['offset'](_0x35fae6[_0xacdf('0x34')][_0xacdf('0x1d')]);}return _0x5b6e9c[_0xacdf('0x62')](_0x3d2046);}})[_0xacdf('0x27')](function(_0x2bce0b){if(_0x2bce0b){return _0x2bce0b?{'count':_0x4f63b2,'rows':_0x2bce0b}:null;}})[_0xacdf('0x27')](respondWithResult(_0x3bcbf1,null))['catch'](handleError(_0x3bcbf1,null));};exports[_0xacdf('0x65')]=function(_0x3e75e7,_0x2439f1,_0x2cd64c){var _0xcf8507=_0x3e75e7[_0xacdf('0x4a')][_0xacdf('0x66')];return db[_0xacdf('0x64')][_0xacdf('0x41')]({'where':{'id':_0xcf8507},'attributes':['id'],'include':[{'model':db[_0xacdf('0x67')],'as':_0xacdf('0x68'),'attributes':['id',_0xacdf('0x2d'),_0xacdf('0x69'),_0xacdf('0x6a'),_0xacdf('0x6b')],'raw':!![]}]})['then'](function(_0x2b97cc){if(_0x2b97cc){var _0x17899a=_[_0xacdf('0x6c')](_0x2b97cc,function(_0x2d5ecf){var _0x2a2600=_0x2d5ecf['get']({'plain':!![]});return _0x2a2600['Agents'];});return db[_0xacdf('0x44')]['find']({'where':{'id':_0x3e75e7['params']['id']}})[_0xacdf('0x27')](function(_0x156591){return db[_0xacdf('0x6d')][_0xacdf('0x6e')](function(_0x56990f){return _0x156591[_0xacdf('0x65')](_0xcf8507,{'transaction':_0x56990f})[_0xacdf('0x27')](function(){return BPromise['each'](_0x17899a,function(_0x44ce65){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x44ce65['id'],'WhatsappQueueId':_0x3e75e7[_0xacdf('0x53')]['id']},'transaction':_0x56990f});});})[_0xacdf('0x27')](function(){_0x17899a[_0xacdf('0x6f')](function(_0xf0f1a1){socket[_0xacdf('0x70')](_0xacdf('0x71'),{'UserId':_0xf0f1a1['id'],'WhatsappQueueId':_0x156591['id']});});});});});}})[_0xacdf('0x27')](respondWithStatusCode(_0x2439f1,null))[_0xacdf('0x43')](handleError(_0x2439f1,null));};exports[_0xacdf('0x72')]=function(_0x293d43,_0x3a9864,_0x122eae){return db[_0xacdf('0x64')][_0xacdf('0x41')]({'where':{'id':_0x293d43['query'][_0xacdf('0x66')]},'attributes':['id'],'include':[{'model':db[_0xacdf('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3a9864,null))[_0xacdf('0x27')](function(_0x63cd2f){var _0x58cd36=_[_0xacdf('0x2f')](_0x63cd2f,'id');var _0x596515=[];var _0x463cbb=[];var _0x54a61f=squel[_0xacdf('0x73')]();_0x54a61f[_0xacdf('0x74')](_0xacdf('0x75'))[_0xacdf('0x76')]('team_has_whatsapp_queues','tq')[_0xacdf('0x77')](_0xacdf('0x78'),'ut',_0xacdf('0x79'))['where'](_0xacdf('0x7a'),_0x293d43[_0xacdf('0x53')]['id']);for(var _0x2d9dd9=0x0;_0x2d9dd9<_0x63cd2f[_0xacdf('0x37')];_0x2d9dd9+=0x1){let _0x2bd37b=_0x63cd2f[_0x2d9dd9];for(var _0x51ff7d=0x0;_0x51ff7d<_0x2bd37b[_0xacdf('0x68')][_0xacdf('0x37')];_0x51ff7d+=0x1){let _0x20d847=_0x2bd37b[_0xacdf('0x68')][_0x51ff7d];var _0x1df617=_0x54a61f['clone']();_0x1df617[_0xacdf('0x3e')](_0xacdf('0x7b'),_0x20d847['id']);_0x463cbb['push'](db['sequelize']['query'](_0x1df617['toString'](),{'type':db['sequelize'][_0xacdf('0x7c')][_0xacdf('0x7d')]})[_0xacdf('0x27')](function(_0x3b583d){if(_0x3b583d[_0xacdf('0x37')]===0x1){return _0x20d847['id'];}else{var _0x44bedc=_[_0xacdf('0x7e')](_[_0xacdf('0x2f')](_0x3b583d,_0xacdf('0x7f')),function(_0x228af6){return _[_0xacdf('0x80')](_0x58cd36,_0x228af6);});if(_0x44bedc){return _0x20d847['id'];}}}));}}return BPromise['all'](_0x463cbb)[_0xacdf('0x27')](function(_0x21d335){_0x596515=_(_0x596515)['union'](_0x21d335)['compact']()[_0xacdf('0x81')]();return db[_0xacdf('0x44')][_0xacdf('0x48')]({'where':{'id':_0x293d43[_0xacdf('0x53')]['id']}})[_0xacdf('0x27')](function(_0x50732f){return db[_0xacdf('0x6d')][_0xacdf('0x6e')](function(_0x178849){return _0x50732f[_0xacdf('0x72')](_0x293d43[_0xacdf('0x34')][_0xacdf('0x66')],{'transaction':_0x178849})['then'](function(){if(!_[_0xacdf('0x82')](_0x596515)){return _0x50732f[_0xacdf('0x83')](_0x596515,{'transaction':_0x178849});}})['then'](function(){_0x596515[_0xacdf('0x6f')](function(_0x5b2677){socket[_0xacdf('0x70')](_0xacdf('0x84'),{'UserId':_0x5b2677,'WhatsappQueueId':_0x50732f['id']});});});});});});})[_0xacdf('0x27')](respondWithStatusCode(_0x3a9864,null))['catch'](handleError(_0x3a9864,null));};exports[_0xacdf('0x85')]=function(_0x4e0bca,_0x37a704,_0x18392a){return db[_0xacdf('0x44')]['find']({'where':{'id':_0x4e0bca[_0xacdf('0x53')]['id']}})['then'](handleEntityNotFound(_0x37a704,null))[_0xacdf('0x27')](function(_0x4f407e){if(_0x4f407e){return _0x4f407e[_0xacdf('0x85')](_0x4e0bca[_0xacdf('0x4a')][_0xacdf('0x66')],_[_0xacdf('0x86')](_0x4e0bca[_0xacdf('0x4a')],[_0xacdf('0x66'),'id'])||{})[_0xacdf('0x87')](function(_0x2d2c9b){for(var _0x23b9d6=0x0;_0x23b9d6<_0x4e0bca[_0xacdf('0x4a')][_0xacdf('0x66')]['length'];_0x23b9d6+=0x1){socket[_0xacdf('0x70')](_0xacdf('0x71'),{'UserId':Number(_0x4e0bca[_0xacdf('0x4a')][_0xacdf('0x66')][_0x23b9d6]),'WhatsappQueueId':Number(_0x4e0bca[_0xacdf('0x53')]['id'])});}return _0x2d2c9b;});}})[_0xacdf('0x27')](respondWithResult(_0x37a704,null))[_0xacdf('0x43')](handleError(_0x37a704,null));};exports[_0xacdf('0x83')]=function(_0x43df56,_0xb842e3,_0x15ce86){return db['WhatsappQueue'][_0xacdf('0x48')]({'where':{'id':_0x43df56[_0xacdf('0x53')]['id']}})[_0xacdf('0x27')](handleEntityNotFound(_0xb842e3,null))[_0xacdf('0x27')](function(_0x3a9c60){if(_0x3a9c60){return _0x3a9c60[_0xacdf('0x83')](_0x43df56[_0xacdf('0x34')][_0xacdf('0x66')])[_0xacdf('0x27')](function(){if(_['isArray'](_0x43df56[_0xacdf('0x34')][_0xacdf('0x66')])){for(var _0x5aae6d=0x0;_0x5aae6d<_0x43df56[_0xacdf('0x34')][_0xacdf('0x66')][_0xacdf('0x37')];_0x5aae6d+=0x1){socket[_0xacdf('0x70')](_0xacdf('0x84'),{'UserId':Number(_0x43df56['query'][_0xacdf('0x66')][_0x5aae6d]),'WhatsappQueueId':Number(_0x43df56['params']['id'])});}}else{socket[_0xacdf('0x70')](_0xacdf('0x84'),{'UserId':Number(_0x43df56['query'][_0xacdf('0x66')]),'WhatsappQueueId':Number(_0x43df56[_0xacdf('0x53')]['id'])});}});}})[_0xacdf('0x27')](respondWithStatusCode(_0xb842e3,null))['catch'](handleError(_0xb842e3,null));};exports['getAgents']=function(_0x37f454,_0x462142,_0x5bd40c){var _0x977e7f={};var _0x10777a={};var _0x55843a;var _0x40bedf;return db['WhatsappQueue'][_0xacdf('0x63')]({'where':{'id':_0x37f454['params']['id']}})[_0xacdf('0x27')](handleEntityNotFound(_0x462142,null))[_0xacdf('0x27')](function(_0x50e7db){if(_0x50e7db){_0x55843a=_0x50e7db;_0x10777a[_0xacdf('0x32')]=_[_0xacdf('0x33')](db['User']['rawAttributes']);_0x10777a[_0xacdf('0x34')]=_['keys'](_0x37f454['query']);_0x10777a['filters']=_[_0xacdf('0x57')](_0x10777a['model'],_0x10777a[_0xacdf('0x34')]);_0x977e7f['attributes']=_['intersection'](_0x10777a[_0xacdf('0x32')],qs['fields'](_0x37f454[_0xacdf('0x34')][_0xacdf('0x35')]));_0x977e7f[_0xacdf('0x36')]=_0x977e7f[_0xacdf('0x36')][_0xacdf('0x37')]?_0x977e7f[_0xacdf('0x36')]:_0x10777a['model'];_0x977e7f[_0xacdf('0x58')]=qs[_0xacdf('0x3a')](_0x37f454[_0xacdf('0x34')][_0xacdf('0x3a')]);_0x977e7f[_0xacdf('0x3e')]=qs[_0xacdf('0x3c')](_[_0xacdf('0x3b')](_0x37f454[_0xacdf('0x34')],_0x10777a[_0xacdf('0x3c')]));if(_0x37f454[_0xacdf('0x34')]['filter']){_0x977e7f[_0xacdf('0x3e')]=_[_0xacdf('0x47')](_0x977e7f[_0xacdf('0x3e')],{'$or':_[_0xacdf('0x2f')](_0x977e7f['attributes'],function(_0x1ed63e){var _0x477302={};_0x477302[_0x1ed63e]={'$like':'%'+_0x37f454['query'][_0xacdf('0x3d')]+'%'};return _0x477302;})});}_0x977e7f=_[_0xacdf('0x47')]({},_0x977e7f,_0x37f454[_0xacdf('0x3f')]);return _0x55843a['getAgents'](_0x977e7f);}})['then'](function(_0x1c8567){if(_0x1c8567){_0x40bedf=_0x1c8567['length'];if(!_0x37f454[_0xacdf('0x34')][_0xacdf('0x38')](_0xacdf('0x39'))){_0x977e7f[_0xacdf('0x1f')]=qs['limit'](_0x37f454['query'][_0xacdf('0x1f')]);_0x977e7f[_0xacdf('0x1d')]=qs[_0xacdf('0x1d')](_0x37f454[_0xacdf('0x34')][_0xacdf('0x1d')]);}return _0x55843a[_0xacdf('0x88')](_0x977e7f);}})[_0xacdf('0x27')](function(_0x14b3ba){if(_0x14b3ba){return _0x14b3ba?{'count':_0x40bedf,'rows':_0x14b3ba}:null;}})['then'](respondWithResult(_0x462142,null))[_0xacdf('0x43')](handleError(_0x462142,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4bc7921..1984279 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 _0xdc27=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x350ec3,_0x1dcb41){var _0x1eef31=function(_0x388869){while(--_0x388869){_0x350ec3['push'](_0x350ec3['shift']());}};_0x1eef31(++_0x1dcb41);}(_0xdc27,0x1ba));var _0x7dc2=function(_0x412158,_0xce52f1){_0x412158=_0x412158-0x0;var _0x1c496b=_0xdc27[_0x412158];return _0x1c496b;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x7dc2('0x0'))['db'][_0x7dc2('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7dc2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7dc2('0x3'),'afterDestroy':_0x7dc2('0x4')};function emitEvent(_0x5ae4f4){return function(_0xe722f3,_0x86fd03,_0x117941){WhatsappQueueEvents[_0x7dc2('0x5')](_0x5ae4f4+':'+_0xe722f3['id'],_0xe722f3);WhatsappQueueEvents['emit'](_0x5ae4f4,_0xe722f3);_0x117941(null);};}for(var e in events){if(events[_0x7dc2('0x6')](e)){var event=events[e];WhatsappQueue[_0x7dc2('0x7')](e,emitEvent(event));}}module[_0x7dc2('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x6639=['exports','events','WhatsappQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1f2741,_0x583ebf){var _0x194638=function(_0x111829){while(--_0x111829){_0x1f2741['push'](_0x1f2741['shift']());}};_0x194638(++_0x583ebf);}(_0x6639,0x1c3));var _0x9663=function(_0x13683e,_0x5e6856){_0x13683e=_0x13683e-0x0;var _0x4c7cf7=_0x6639[_0x13683e];return _0x4c7cf7;};'use strict';var EventEmitter=require(_0x9663('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x9663('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9663('0x2'),'afterUpdate':_0x9663('0x3'),'afterDestroy':_0x9663('0x4')};function emitEvent(_0x725caf){return function(_0x40c209,_0x46b7f5,_0x5ca7de){WhatsappQueueEvents[_0x9663('0x5')](_0x725caf+':'+_0x40c209['id'],_0x40c209);WhatsappQueueEvents['emit'](_0x725caf,_0x40c209);_0x5ca7de(null);};}for(var e in events){if(events[_0x9663('0x6')](e)){var event=events[e];WhatsappQueue[_0x9663('0x7')](e,emitEvent(event));}}module[_0x9663('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 6529ad5..d9c407b 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 _0x2680=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash'];(function(_0x9f064a,_0x56c7b3){var _0x253c68=function(_0x2b9c8c){while(--_0x2b9c8c){_0x9f064a['push'](_0x9f064a['shift']());}};_0x253c68(++_0x56c7b3);}(_0x2680,0x1c6));var _0x0268=function(_0x359541,_0x20bfa6){_0x359541=_0x359541-0x0;var _0x60a1eb=_0x2680[_0x359541];return _0x60a1eb;};'use strict';var _=require(_0x0268('0x0'));var util=require(_0x0268('0x1'));var logger=require(_0x0268('0x2'))(_0x0268('0x3'));var moment=require(_0x0268('0x4'));var BPromise=require(_0x0268('0x5'));var rp=require(_0x0268('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0268('0x7'));var config=require(_0x0268('0x8'));var attributes=require(_0x0268('0x9'));module[_0x0268('0xa')]=function(_0x1d87d1,_0x30cbb5){return _0x1d87d1[_0x0268('0xb')]('WhatsappQueue',attributes,{'tableName':_0x0268('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefed=['path','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefed,0x118));var _0xdefe=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0xefed[_0x24392f];return _0x591e33;};'use strict';var _=require(_0xdefe('0x0'));var util=require(_0xdefe('0x1'));var logger=require(_0xdefe('0x2'))(_0xdefe('0x3'));var moment=require(_0xdefe('0x4'));var BPromise=require('bluebird');var rp=require(_0xdefe('0x5'));var fs=require('fs');var path=require(_0xdefe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdefe('0x7'));module[_0xdefe('0x8')]=function(_0x3f008e,_0x5a3e29){return _0x3f008e['define'](_0xdefe('0x9'),attributes,{'tableName':_0xdefe('0xa'),'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 b750e57..1936a7b 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 _0x4ee2=['raw','where','include','map','model','attributes','catch','ShowWhatsappQueue','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','result','message','GetWhatsappQueue','findAll','options'];(function(_0x5b0d0a,_0x5177c3){var _0x39b6f7=function(_0x47d86d){while(--_0x47d86d){_0x5b0d0a['push'](_0x5b0d0a['shift']());}};_0x39b6f7(++_0x5177c3);}(_0x4ee2,0xae));var _0x24ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4ee2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x24ee('0x0'));var util=require('util');var moment=require(_0x24ee('0x1'));var BPromise=require(_0x24ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24ee('0x3'));var db=require(_0x24ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x24ee('0x5'))(_0x24ee('0x6'));var config=require('../../config/environment');var jayson=require(_0x24ee('0x7'));var client=jayson[_0x24ee('0x8')]['http']({'port':0x232a});config[_0x24ee('0x9')]=_[_0x24ee('0xa')](config[_0x24ee('0x9')],{'host':_0x24ee('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24ee('0x9')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5375a4,_0x37f2c2,_0x41a86d){return new BPromise(function(_0x4c4256,_0x1ffefb){return client['request'](_0x5375a4,_0x41a86d)[_0x24ee('0xc')](function(_0x540a99){logger[_0x24ee('0xd')](_0x24ee('0xe'),_0x37f2c2,_0x24ee('0xf'));logger[_0x24ee('0x10')](_0x24ee('0x11'),_0x37f2c2,_0x24ee('0xf'),JSON['stringify'](_0x540a99));if(_0x540a99['error']){if(_0x540a99[_0x24ee('0x12')]['code']===0x1f4){logger[_0x24ee('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x37f2c2,_0x540a99[_0x24ee('0x12')]['message']);return _0x1ffefb(_0x540a99[_0x24ee('0x12')]['message']);}logger['error'](_0x24ee('0xe'),_0x37f2c2,_0x540a99[_0x24ee('0x12')]['message']);return _0x4c4256(_0x540a99['error']['message']);}else{logger[_0x24ee('0xd')](_0x24ee('0xe'),_0x37f2c2,_0x24ee('0xf'));_0x4c4256(_0x540a99[_0x24ee('0x13')][_0x24ee('0x14')]);}})['catch'](function(_0x47a0a0){logger['error'](_0x24ee('0xe'),_0x37f2c2,_0x47a0a0);_0x1ffefb(_0x47a0a0);});});}exports[_0x24ee('0x15')]=function(_0x5651f3){var _0xb8d47b=this;return new Promise(function(_0x6ff4de,_0x276861){return db['WhatsappQueue'][_0x24ee('0x16')]({'raw':_0x5651f3[_0x24ee('0x17')]?_0x5651f3[_0x24ee('0x17')][_0x24ee('0x18')]===undefined?!![]:![]:!![],'where':_0x5651f3['options']?_0x5651f3[_0x24ee('0x17')][_0x24ee('0x19')]||null:null,'attributes':_0x5651f3[_0x24ee('0x17')]?_0x5651f3[_0x24ee('0x17')]['attributes']||null:null,'limit':_0x5651f3[_0x24ee('0x17')]?_0x5651f3[_0x24ee('0x17')]['limit']||null:null,'include':_0x5651f3[_0x24ee('0x17')]?_0x5651f3['options'][_0x24ee('0x1a')]?_[_0x24ee('0x1b')](_0x5651f3[_0x24ee('0x17')][_0x24ee('0x1a')],function(_0x31f940){return{'model':db[_0x31f940[_0x24ee('0x1c')]],'as':_0x31f940['as'],'attributes':_0x31f940[_0x24ee('0x1d')],'include':_0x31f940[_0x24ee('0x1a')]?_['map'](_0x31f940['include'],function(_0x91c2b0){return{'model':db[_0x91c2b0[_0x24ee('0x1c')]],'as':_0x91c2b0['as'],'attributes':_0x91c2b0[_0x24ee('0x1d')],'include':_0x91c2b0[_0x24ee('0x1a')]?_[_0x24ee('0x1b')](_0x91c2b0[_0x24ee('0x1a')],function(_0xe6ca1f){return{'model':db[_0xe6ca1f[_0x24ee('0x1c')]],'as':_0xe6ca1f['as'],'attributes':_0xe6ca1f[_0x24ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x24ee('0xc')](function(_0x13f552){logger[_0x24ee('0xd')](_0x24ee('0x15'),_0x5651f3);logger['debug'](_0x24ee('0x15'),_0x5651f3,JSON['stringify'](_0x13f552));_0x6ff4de(_0x13f552);})[_0x24ee('0x1e')](function(_0x18d130){logger[_0x24ee('0x12')](_0x24ee('0x15'),_0x18d130[_0x24ee('0x14')],_0x5651f3);_0x276861(_0xb8d47b[_0x24ee('0x12')](0x1f4,_0x18d130[_0x24ee('0x14')]));});});};exports[_0x24ee('0x1f')]=function(_0xaff33){var _0x4ec21f=this;return new Promise(function(_0x27f35f,_0x4a2356){return db['WhatsappQueue']['find']({'raw':_0xaff33[_0x24ee('0x17')]?_0xaff33[_0x24ee('0x17')][_0x24ee('0x18')]===undefined?!![]:![]:!![],'where':_0xaff33[_0x24ee('0x17')]?_0xaff33[_0x24ee('0x17')][_0x24ee('0x19')]||null:null,'attributes':_0xaff33['options']?_0xaff33['options'][_0x24ee('0x1d')]||null:null,'include':_0xaff33[_0x24ee('0x17')]?_0xaff33[_0x24ee('0x17')][_0x24ee('0x1a')]?_['map'](_0xaff33[_0x24ee('0x17')][_0x24ee('0x1a')],function(_0xfcb9ca){return{'model':db[_0xfcb9ca[_0x24ee('0x1c')]],'as':_0xfcb9ca['as'],'attributes':_0xfcb9ca[_0x24ee('0x1d')],'include':_0xfcb9ca[_0x24ee('0x1a')]?_[_0x24ee('0x1b')](_0xfcb9ca['include'],function(_0x5525ff){return{'model':db[_0x5525ff['model']],'as':_0x5525ff['as'],'attributes':_0x5525ff[_0x24ee('0x1d')],'include':_0x5525ff['include']?_[_0x24ee('0x1b')](_0x5525ff[_0x24ee('0x1a')],function(_0x35becc){return{'model':db[_0x35becc['model']],'as':_0x35becc['as'],'attributes':_0x35becc[_0x24ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x24ee('0xc')](function(_0x15102e){logger[_0x24ee('0xd')](_0x24ee('0x1f'),_0xaff33);logger[_0x24ee('0x10')](_0x24ee('0x1f'),_0xaff33,JSON[_0x24ee('0x20')](_0x15102e));_0x27f35f(_0x15102e);})[_0x24ee('0x1e')](function(_0x65fe9d){logger[_0x24ee('0x12')]('ShowWhatsappQueue',_0x65fe9d[_0x24ee('0x14')],_0xaff33);_0x4a2356(_0x4ec21f[_0x24ee('0x12')](0x1f4,_0x65fe9d[_0x24ee('0x14')]));});});}; \ No newline at end of file +var _0x23a6=['find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowWhatsappQueue','WhatsappQueue'];(function(_0x2b61c9,_0x7d9c64){var _0xf55e24=function(_0x1a0fea){while(--_0x1a0fea){_0x2b61c9['push'](_0x2b61c9['shift']());}};_0xf55e24(++_0x7d9c64);}(_0x23a6,0xeb));var _0x623a=function(_0x1fa577,_0x54cd5c){_0x1fa577=_0x1fa577-0x0;var _0x5c1a51=_0x23a6[_0x1fa577];return _0x5c1a51;};'use strict';var _=require(_0x623a('0x0'));var util=require('util');var moment=require(_0x623a('0x1'));var BPromise=require(_0x623a('0x2'));var rs=require(_0x623a('0x3'));var fs=require('fs');var Redis=require(_0x623a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x623a('0x5'));var logger=require(_0x623a('0x6'))(_0x623a('0x7'));var config=require(_0x623a('0x8'));var jayson=require(_0x623a('0x9'));var client=jayson[_0x623a('0xa')][_0x623a('0xb')]({'port':0x232a});config[_0x623a('0xc')]=_['defaults'](config[_0x623a('0xc')],{'host':_0x623a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x623a('0xc')]));require('./whatsappQueue.socket')[_0x623a('0xe')](socket);function respondWithRpcPromise(_0x5be891,_0x2a514b,_0x474ee6){return new BPromise(function(_0x1638f7,_0x2cf75d){return client['request'](_0x5be891,_0x474ee6)[_0x623a('0xf')](function(_0xf76724){logger['info'](_0x623a('0x10'),_0x2a514b,_0x623a('0x11'));logger[_0x623a('0x12')](_0x623a('0x13'),_0x2a514b,_0x623a('0x11'),JSON[_0x623a('0x14')](_0xf76724));if(_0xf76724[_0x623a('0x15')]){if(_0xf76724[_0x623a('0x15')]['code']===0x1f4){logger[_0x623a('0x15')](_0x623a('0x10'),_0x2a514b,_0xf76724[_0x623a('0x15')][_0x623a('0x16')]);return _0x2cf75d(_0xf76724[_0x623a('0x15')]['message']);}logger[_0x623a('0x15')](_0x623a('0x10'),_0x2a514b,_0xf76724['error'][_0x623a('0x16')]);return _0x1638f7(_0xf76724[_0x623a('0x15')][_0x623a('0x16')]);}else{logger[_0x623a('0x17')](_0x623a('0x10'),_0x2a514b,_0x623a('0x11'));_0x1638f7(_0xf76724[_0x623a('0x18')][_0x623a('0x16')]);}})[_0x623a('0x19')](function(_0x11b572){logger[_0x623a('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2a514b,_0x11b572);_0x2cf75d(_0x11b572);});});}exports[_0x623a('0x1a')]=function(_0x2c1934){var _0x339f6b=this;return new Promise(function(_0x57ece4,_0x2d1e21){return db['WhatsappQueue'][_0x623a('0x1b')]({'raw':_0x2c1934[_0x623a('0x1c')]?_0x2c1934['options'][_0x623a('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c1934[_0x623a('0x1c')]?_0x2c1934[_0x623a('0x1c')][_0x623a('0x1e')]||null:null,'attributes':_0x2c1934['options']?_0x2c1934[_0x623a('0x1c')][_0x623a('0x1f')]||null:null,'limit':_0x2c1934[_0x623a('0x1c')]?_0x2c1934['options'][_0x623a('0x20')]||null:null,'include':_0x2c1934[_0x623a('0x1c')]?_0x2c1934[_0x623a('0x1c')][_0x623a('0x21')]?_[_0x623a('0x22')](_0x2c1934[_0x623a('0x1c')]['include'],function(_0x2dacd6){return{'model':db[_0x2dacd6['model']],'as':_0x2dacd6['as'],'attributes':_0x2dacd6[_0x623a('0x1f')],'include':_0x2dacd6['include']?_[_0x623a('0x22')](_0x2dacd6['include'],function(_0xa1dd3d){return{'model':db[_0xa1dd3d[_0x623a('0x23')]],'as':_0xa1dd3d['as'],'attributes':_0xa1dd3d['attributes'],'include':_0xa1dd3d[_0x623a('0x21')]?_[_0x623a('0x22')](_0xa1dd3d[_0x623a('0x21')],function(_0xbec5d5){return{'model':db[_0xbec5d5['model']],'as':_0xbec5d5['as'],'attributes':_0xbec5d5[_0x623a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x623a('0xf')](function(_0x27b760){logger[_0x623a('0x17')](_0x623a('0x1a'),_0x2c1934);logger['debug'](_0x623a('0x1a'),_0x2c1934,JSON[_0x623a('0x14')](_0x27b760));_0x57ece4(_0x27b760);})[_0x623a('0x19')](function(_0x7a58d1){logger['error'](_0x623a('0x1a'),_0x7a58d1[_0x623a('0x16')],_0x2c1934);_0x2d1e21(_0x339f6b['error'](0x1f4,_0x7a58d1[_0x623a('0x16')]));});});};exports[_0x623a('0x24')]=function(_0xd86a34){var _0x2e9e14=this;return new Promise(function(_0x220066,_0x2dd9a5){return db[_0x623a('0x25')][_0x623a('0x26')]({'raw':_0xd86a34['options']?_0xd86a34[_0x623a('0x1c')][_0x623a('0x1d')]===undefined?!![]:![]:!![],'where':_0xd86a34[_0x623a('0x1c')]?_0xd86a34['options'][_0x623a('0x1e')]||null:null,'attributes':_0xd86a34[_0x623a('0x1c')]?_0xd86a34[_0x623a('0x1c')][_0x623a('0x1f')]||null:null,'include':_0xd86a34[_0x623a('0x1c')]?_0xd86a34[_0x623a('0x1c')][_0x623a('0x21')]?_['map'](_0xd86a34[_0x623a('0x1c')][_0x623a('0x21')],function(_0x4f6d72){return{'model':db[_0x4f6d72[_0x623a('0x23')]],'as':_0x4f6d72['as'],'attributes':_0x4f6d72[_0x623a('0x1f')],'include':_0x4f6d72[_0x623a('0x21')]?_['map'](_0x4f6d72['include'],function(_0x219f73){return{'model':db[_0x219f73[_0x623a('0x23')]],'as':_0x219f73['as'],'attributes':_0x219f73[_0x623a('0x1f')],'include':_0x219f73['include']?_[_0x623a('0x22')](_0x219f73[_0x623a('0x21')],function(_0xc00ea1){return{'model':db[_0xc00ea1[_0x623a('0x23')]],'as':_0xc00ea1['as'],'attributes':_0xc00ea1[_0x623a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x623a('0xf')](function(_0x3b395a){logger['info'](_0x623a('0x24'),_0xd86a34);logger['debug'](_0x623a('0x24'),_0xd86a34,JSON['stringify'](_0x3b395a));_0x220066(_0x3b395a);})[_0x623a('0x19')](function(_0x238a44){logger[_0x623a('0x15')](_0x623a('0x24'),_0x238a44[_0x623a('0x16')],_0xd86a34);_0x2dd9a5(_0x2e9e14[_0x623a('0x15')](0x1f4,_0x238a44[_0x623a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d0904a2..038fea5 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 _0x4424=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener'];(function(_0x321d52,_0x69fd7f){var _0x390746=function(_0xaf45d9){while(--_0xaf45d9){_0x321d52['push'](_0x321d52['shift']());}};_0x390746(++_0x69fd7f);}(_0x4424,0x19b));var _0x4442=function(_0x5cd891,_0x2477d1){_0x5cd891=_0x5cd891-0x0;var _0x2c8b51=_0x4424[_0x5cd891];return _0x2c8b51;};'use strict';var WhatsappQueueEvents=require(_0x4442('0x0'));var events=[_0x4442('0x1'),_0x4442('0x2'),'update'];function createListener(_0x4c55ac,_0xeb1f93){return function(_0x514d20){_0xeb1f93[_0x4442('0x3')](_0x4c55ac,_0x514d20);};}function removeListener(_0x3d336a,_0xb63230){return function(){WhatsappQueueEvents[_0x4442('0x4')](_0x3d336a,_0xb63230);};}exports[_0x4442('0x5')]=function(_0x2129fd){for(var _0xe86480=0x0,_0x477e39=events[_0x4442('0x6')];_0xe86480<_0x477e39;_0xe86480++){var _0x44f767=events[_0xe86480];var _0x48eda8=createListener(_0x4442('0x7')+_0x44f767,_0x2129fd);WhatsappQueueEvents['on'](_0x44f767,_0x48eda8);}}; \ No newline at end of file +var _0x4727=['register','length','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x4727,0xaa));var _0x7472=function(_0x5e09a6,_0x5af50e){_0x5e09a6=_0x5e09a6-0x0;var _0x2624ff=_0x4727[_0x5e09a6];return _0x2624ff;};'use strict';var WhatsappQueueEvents=require(_0x7472('0x0'));var events=['save',_0x7472('0x1'),_0x7472('0x2')];function createListener(_0x1fe362,_0x52fdcc){return function(_0x5c95c5){_0x52fdcc[_0x7472('0x3')](_0x1fe362,_0x5c95c5);};}function removeListener(_0x5680bd,_0x3f775f){return function(){WhatsappQueueEvents[_0x7472('0x4')](_0x5680bd,_0x3f775f);};}exports[_0x7472('0x5')]=function(_0x3ca902){for(var _0x35fdc3=0x0,_0x215f6b=events[_0x7472('0x6')];_0x35fdc3<_0x215f6b;_0x35fdc3++){var _0x55f8d4=events[_0x35fdc3];var _0x227a7d=createListener('whatsappQueue:'+_0x55f8d4,_0x3ca902);WhatsappQueueEvents['on'](_0x55f8d4,_0x227a7d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3e0a376..813b9e4 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 _0x4210=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','get','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x178f27,_0x26e5b0){var _0x1bef17=function(_0x32cf4d){while(--_0x32cf4d){_0x178f27['push'](_0x178f27['shift']());}};_0x1bef17(++_0x26e5b0);}(_0x4210,0x7a));var _0x0421=function(_0x2f7092,_0x5d2987){_0x2f7092=_0x2f7092-0x0;var _0x22f651=_0x4210[_0x2f7092];return _0x22f651;};'use strict';var multer=require(_0x0421('0x0'));var util=require(_0x0421('0x1'));var path=require(_0x0421('0x2'));var timeout=require(_0x0421('0x3'));var express=require(_0x0421('0x4'));var router=express[_0x0421('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0421('0x6'));var interaction=require(_0x0421('0x7'));var config=require(_0x0421('0x8'));var controller=require(_0x0421('0x9'));router['get']('/',auth[_0x0421('0xa')](),controller['index']);router['get']('/describe',auth[_0x0421('0xa')](),controller['describe']);router[_0x0421('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0421('0xa')](),controller[_0x0421('0xc')]);router['put'](_0x0421('0xd'),auth[_0x0421('0xa')](),controller[_0x0421('0xe')]);router[_0x0421('0xf')](_0x0421('0xd'),auth['isAuthenticated'](),controller[_0x0421('0x10')]);module[_0x0421('0x11')]=router; \ No newline at end of file +var _0x76d1=['exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x390596,_0xb76c61){var _0x5bb579=function(_0x562335){while(--_0x562335){_0x390596['push'](_0x390596['shift']());}};_0x5bb579(++_0xb76c61);}(_0x76d1,0x17b));var _0x176d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x76d1[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0x176d('0x0'));var path=require('path');var timeout=require(_0x176d('0x1'));var express=require('express');var router=express[_0x176d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x176d('0x3'));var interaction=require(_0x176d('0x4'));var config=require(_0x176d('0x5'));var controller=require(_0x176d('0x6'));router[_0x176d('0x7')]('/',auth['isAuthenticated'](),controller[_0x176d('0x8')]);router[_0x176d('0x7')](_0x176d('0x9'),auth[_0x176d('0xa')](),controller[_0x176d('0xb')]);router[_0x176d('0x7')](_0x176d('0xc'),auth[_0x176d('0xa')](),controller[_0x176d('0xd')]);router[_0x176d('0xe')]('/',auth['isAuthenticated'](),controller[_0x176d('0xf')]);router[_0x176d('0x10')](_0x176d('0xc'),auth[_0x176d('0xa')](),controller[_0x176d('0x11')]);router[_0x176d('0x12')]('/:id',auth[_0x176d('0xa')](),controller[_0x176d('0x13')]);module[_0x176d('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ab4bf33..2b98107 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x10235d,_0x42f7fe){var _0x3107ce=function(_0x4c0cf4){while(--_0x4c0cf4){_0x10235d['push'](_0x10235d['shift']());}};_0x3107ce(++_0x42f7fe);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1be839,_0x486eca){var _0x13eb06=function(_0x485b11){while(--_0x485b11){_0x1be839['push'](_0x1be839['shift']());}};_0x13eb06(++_0x486eca);}(_0x7a54,0x106));var _0x47a5=function(_0x9a7298,_0x593f24){_0x9a7298=_0x9a7298-0x0;var _0x48b981=_0x7a54[_0x9a7298];return _0x48b981;};'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 85ecc50..cac9868 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 _0xb62e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448327,_0x4b0f46){return function(_0xfe3e16){if(!_0xfe3e16){_0x448327['sendStatus'](0x194);}return _0xfe3e16;};}function handleError(_0x3ac28c,_0x6bfbbc){_0x6bfbbc=_0x6bfbbc||0x1f4;return function(_0x46d1bb){logger['error'](_0x46d1bb[_0xeb62('0x27')]);if(_0x46d1bb[_0xeb62('0x28')]){delete _0x46d1bb[_0xeb62('0x28')];}_0x3ac28c[_0xeb62('0x1d')](_0x6bfbbc)[_0xeb62('0x29')](_0x46d1bb);};}exports[_0xeb62('0x2a')]=function(_0x511202,_0x192517){var _0x1616ee={},_0x57169a={},_0x157474={'count':0x0,'rows':[]};var _0x2b51b2=_[_0xeb62('0x2b')](db[_0xeb62('0x2c')][_0xeb62('0x2d')],function(_0x5195bf){return{'name':_0x5195bf['fieldName'],'type':_0x5195bf[_0xeb62('0x2e')][_0xeb62('0x2f')]};});_0x57169a[_0xeb62('0x30')]=_[_0xeb62('0x2b')](_0x2b51b2,_0xeb62('0x28'));_0x57169a[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x511202['query']);_0x57169a[_0xeb62('0x33')]=_['intersection'](_0x57169a['model'],_0x57169a[_0xeb62('0x31')]);_0x1616ee[_0xeb62('0x34')]=_['intersection'](_0x57169a[_0xeb62('0x30')],qs['fields'](_0x511202[_0xeb62('0x31')][_0xeb62('0x35')]));_0x1616ee['attributes']=_0x1616ee[_0xeb62('0x34')][_0xeb62('0x36')]?_0x1616ee['attributes']:_0x57169a[_0xeb62('0x30')];if(!_0x511202[_0xeb62('0x31')][_0xeb62('0x37')](_0xeb62('0x38'))){_0x1616ee['limit']=qs[_0xeb62('0x21')](_0x511202[_0xeb62('0x31')]['limit']);_0x1616ee['offset']=qs[_0xeb62('0x1f')](_0x511202[_0xeb62('0x31')]['offset']);}_0x1616ee[_0xeb62('0x39')]=qs[_0xeb62('0x3a')](_0x511202[_0xeb62('0x31')][_0xeb62('0x3a')]);_0x1616ee[_0xeb62('0x3b')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3c')](_0x511202['query'],_0x57169a['filters']),_0x2b51b2);if(_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]){_0x1616ee[_0xeb62('0x3b')]=_[_0xeb62('0x3e')](_0x1616ee['where'],{'$or':_[_0xeb62('0x2b')](_0x2b51b2,function(_0x510c7d){if(_0x510c7d[_0xeb62('0x2e')]!==_0xeb62('0x3f')){var _0x2dac2f={};_0x2dac2f[_0x510c7d[_0xeb62('0x28')]]={'$like':'%'+_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]+'%'};return _0x2dac2f;}})});}_0x1616ee=_[_0xeb62('0x3e')]({},_0x1616ee,_0x511202[_0xeb62('0x40')]);var _0x5e8ef8={'where':_0x1616ee[_0xeb62('0x3b')]};return db[_0xeb62('0x2c')][_0xeb62('0x22')](_0x5e8ef8)[_0xeb62('0x41')](function(_0x5dd0e3){_0x157474['count']=_0x5dd0e3;if(_0x511202[_0xeb62('0x31')][_0xeb62('0x42')]){_0x1616ee['include']=[{'all':!![]}];}return db[_0xeb62('0x2c')][_0xeb62('0x43')](_0x1616ee);})['then'](function(_0x25e9f0){_0x157474['rows']=_0x25e9f0;return _0x157474;})[_0xeb62('0x41')](respondWithFilteredResult(_0x192517,_0x1616ee))['catch'](handleError(_0x192517,null));};exports[_0xeb62('0x44')]=function(_0x5dde1d,_0x2bf77f){var _0x609b2d={'raw':!![],'where':{'id':_0x5dde1d['params']['id']}},_0x317f50={};_0x317f50['model']=_[_0xeb62('0x32')](db[_0xeb62('0x2c')][_0xeb62('0x2d')]);_0x317f50[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x5dde1d['query']);_0x317f50[_0xeb62('0x33')]=_['intersection'](_0x317f50[_0xeb62('0x30')],_0x317f50['query']);_0x609b2d[_0xeb62('0x34')]=_['intersection'](_0x317f50[_0xeb62('0x30')],qs['fields'](_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x35')]));_0x609b2d[_0xeb62('0x34')]=_0x609b2d[_0xeb62('0x34')][_0xeb62('0x36')]?_0x609b2d[_0xeb62('0x34')]:_0x317f50['model'];if(_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x42')]){_0x609b2d['include']=[{'all':!![]}];}_0x609b2d=_['merge']({},_0x609b2d,_0x5dde1d['options']);return db['WhatsappQueueReport'][_0xeb62('0x45')](_0x609b2d)[_0xeb62('0x41')](handleEntityNotFound(_0x2bf77f,null))['then'](respondWithResult(_0x2bf77f,null))[_0xeb62('0x46')](handleError(_0x2bf77f,null));};exports[_0xeb62('0x47')]=function(_0x412e93,_0x16e262){return db[_0xeb62('0x2c')]['create'](_0x412e93[_0xeb62('0x48')],{})['then'](respondWithResult(_0x16e262,0xc9))[_0xeb62('0x46')](handleError(_0x16e262,null));};exports[_0xeb62('0x49')]=function(_0x7fb53f,_0x18c40d){if(_0x7fb53f[_0xeb62('0x48')]['id']){delete _0x7fb53f[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2c')][_0xeb62('0x45')]({'where':{'id':_0x7fb53f[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x18c40d,null))[_0xeb62('0x41')](saveUpdates(_0x7fb53f[_0xeb62('0x48')],null))['then'](respondWithResult(_0x18c40d,null))[_0xeb62('0x46')](handleError(_0x18c40d,null));};exports['destroy']=function(_0x4edd8c,_0x2dcb2d){return db[_0xeb62('0x2c')]['find']({'where':{'id':_0x4edd8c[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x2dcb2d,null))['then'](removeEntity(_0x2dcb2d,null))[_0xeb62('0x46')](handleError(_0x2dcb2d,null));};exports[_0xeb62('0x4b')]=function(_0x20b73b,_0x60617){return db[_0xeb62('0x2c')][_0xeb62('0x4b')]()[_0xeb62('0x41')](respondWithResult(_0x60617,null))[_0xeb62('0x46')](handleError(_0x60617,null));}; \ No newline at end of file +var _0x7072=['moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','map','query','keys','filters','intersection','model','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','attributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7072,0x138));var _0x2707=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x7072[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];function respondWithStatusCode(_0x32d4bd,_0x40d370){_0x40d370=_0x40d370||0xcc;return function(_0x5bf16e){if(_0x5bf16e){return _0x32d4bd[_0x2707('0x1a')](_0x40d370);}return _0x32d4bd['status'](_0x40d370)[_0x2707('0x1b')]();};}function respondWithResult(_0x307367,_0xfe975c){_0xfe975c=_0xfe975c||0xc8;return function(_0x3a67f2){if(_0x3a67f2){return _0x307367[_0x2707('0x1c')](_0xfe975c)['json'](_0x3a67f2);}};}function respondWithFilteredResult(_0x345774,_0x1a687a){return function(_0x2f6381){if(_0x2f6381){var _0x5d523f=typeof _0x1a687a[_0x2707('0x1d')]===_0x2707('0x1e')&&typeof _0x1a687a[_0x2707('0x1f')]===_0x2707('0x1e');var _0x7ed037=_0x2f6381[_0x2707('0x20')];var _0x4a8b7f=_0x5d523f?0x0:_0x1a687a[_0x2707('0x1d')];var _0x449a61=_0x5d523f?_0x2f6381[_0x2707('0x20')]:_0x1a687a['offset']+_0x1a687a['limit'];var _0x58a4ee;if(_0x449a61>=_0x7ed037){_0x449a61=_0x7ed037;_0x58a4ee=0xc8;}else{_0x58a4ee=0xce;}_0x345774[_0x2707('0x1c')](_0x58a4ee);return _0x345774[_0x2707('0x21')](_0x2707('0x22'),_0x4a8b7f+'-'+_0x449a61+'/'+_0x7ed037)[_0x2707('0x23')](_0x2f6381);}return null;};}function patchUpdates(_0x1a0e1a){return function(_0x3c2935){try{jsonpatch[_0x2707('0x24')](_0x3c2935,_0x1a0e1a,!![]);}catch(_0x65b6e5){return BPromise[_0x2707('0x25')](_0x65b6e5);}return _0x3c2935[_0x2707('0x26')]();};}function saveUpdates(_0x37c475,_0x119df4){return function(_0x454fde){if(_0x454fde){return _0x454fde[_0x2707('0x27')](_0x37c475)['then'](function(_0x1acf22){return _0x1acf22;});}return null;};}function removeEntity(_0x3b030a,_0x46259e){return function(_0x369e3a){if(_0x369e3a){return _0x369e3a[_0x2707('0x28')]()[_0x2707('0x29')](function(){_0x3b030a['status'](0xcc)[_0x2707('0x1b')]();});}};}function handleEntityNotFound(_0x3f6976,_0x171add){return function(_0x2ad386){if(!_0x2ad386){_0x3f6976[_0x2707('0x1a')](0x194);}return _0x2ad386;};}function handleError(_0x528b20,_0x2dce16){_0x2dce16=_0x2dce16||0x1f4;return function(_0x4ca05d){logger[_0x2707('0x2a')](_0x4ca05d[_0x2707('0x2b')]);if(_0x4ca05d[_0x2707('0x2c')]){delete _0x4ca05d['name'];}_0x528b20[_0x2707('0x1c')](_0x2dce16)[_0x2707('0x2d')](_0x4ca05d);};}exports[_0x2707('0x2e')]=function(_0x529be8,_0x31e990){var _0x42adf8={},_0x4a99ce={},_0xd63d3f={'count':0x0,'rows':[]};var _0x497c92=_['map'](db[_0x2707('0x2f')]['rawAttributes'],function(_0x2a0d24){return{'name':_0x2a0d24[_0x2707('0x30')],'type':_0x2a0d24[_0x2707('0x31')][_0x2707('0x32')]};});_0x4a99ce['model']=_[_0x2707('0x33')](_0x497c92,_0x2707('0x2c'));_0x4a99ce[_0x2707('0x34')]=_[_0x2707('0x35')](_0x529be8[_0x2707('0x34')]);_0x4a99ce[_0x2707('0x36')]=_[_0x2707('0x37')](_0x4a99ce[_0x2707('0x38')],_0x4a99ce[_0x2707('0x34')]);_0x42adf8['attributes']=_[_0x2707('0x37')](_0x4a99ce[_0x2707('0x38')],qs['fields'](_0x529be8['query']['fields']));_0x42adf8['attributes']=_0x42adf8['attributes'][_0x2707('0x39')]?_0x42adf8['attributes']:_0x4a99ce['model'];if(!_0x529be8[_0x2707('0x34')][_0x2707('0x3a')]('nolimit')){_0x42adf8[_0x2707('0x1f')]=qs[_0x2707('0x1f')](_0x529be8['query']['limit']);_0x42adf8[_0x2707('0x1d')]=qs[_0x2707('0x1d')](_0x529be8['query']['offset']);}_0x42adf8[_0x2707('0x3b')]=qs[_0x2707('0x3c')](_0x529be8['query'][_0x2707('0x3c')]);_0x42adf8[_0x2707('0x3d')]=qs[_0x2707('0x36')](_[_0x2707('0x3e')](_0x529be8[_0x2707('0x34')],_0x4a99ce[_0x2707('0x36')]),_0x497c92);if(_0x529be8['query'][_0x2707('0x3f')]){_0x42adf8[_0x2707('0x3d')]=_[_0x2707('0x40')](_0x42adf8[_0x2707('0x3d')],{'$or':_[_0x2707('0x33')](_0x497c92,function(_0x1b9d71){if(_0x1b9d71[_0x2707('0x31')]!=='VIRTUAL'){var _0x3f85a0={};_0x3f85a0[_0x1b9d71[_0x2707('0x2c')]]={'$like':'%'+_0x529be8[_0x2707('0x34')][_0x2707('0x3f')]+'%'};return _0x3f85a0;}})});}_0x42adf8=_[_0x2707('0x40')]({},_0x42adf8,_0x529be8[_0x2707('0x41')]);var _0x3ed513={'where':_0x42adf8[_0x2707('0x3d')]};return db[_0x2707('0x2f')][_0x2707('0x20')](_0x3ed513)[_0x2707('0x29')](function(_0x3368cd){_0xd63d3f[_0x2707('0x20')]=_0x3368cd;if(_0x529be8[_0x2707('0x34')][_0x2707('0x42')]){_0x42adf8[_0x2707('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x2707('0x44')](_0x42adf8);})[_0x2707('0x29')](function(_0x5053ba){_0xd63d3f[_0x2707('0x45')]=_0x5053ba;return _0xd63d3f;})['then'](respondWithFilteredResult(_0x31e990,_0x42adf8))[_0x2707('0x46')](handleError(_0x31e990,null));};exports[_0x2707('0x47')]=function(_0x3a91da,_0x1d69d3){var _0x13e1c0={'raw':!![],'where':{'id':_0x3a91da[_0x2707('0x48')]['id']}},_0xdeec24={};_0xdeec24['model']=_[_0x2707('0x35')](db[_0x2707('0x2f')]['rawAttributes']);_0xdeec24[_0x2707('0x34')]=_[_0x2707('0x35')](_0x3a91da[_0x2707('0x34')]);_0xdeec24['filters']=_['intersection'](_0xdeec24[_0x2707('0x38')],_0xdeec24[_0x2707('0x34')]);_0x13e1c0['attributes']=_[_0x2707('0x37')](_0xdeec24['model'],qs[_0x2707('0x49')](_0x3a91da[_0x2707('0x34')][_0x2707('0x49')]));_0x13e1c0[_0x2707('0x4a')]=_0x13e1c0['attributes'][_0x2707('0x39')]?_0x13e1c0[_0x2707('0x4a')]:_0xdeec24[_0x2707('0x38')];if(_0x3a91da[_0x2707('0x34')][_0x2707('0x42')]){_0x13e1c0[_0x2707('0x43')]=[{'all':!![]}];}_0x13e1c0=_[_0x2707('0x40')]({},_0x13e1c0,_0x3a91da['options']);return db[_0x2707('0x2f')][_0x2707('0x4b')](_0x13e1c0)[_0x2707('0x29')](handleEntityNotFound(_0x1d69d3,null))[_0x2707('0x29')](respondWithResult(_0x1d69d3,null))[_0x2707('0x46')](handleError(_0x1d69d3,null));};exports['create']=function(_0x35917d,_0x4a6eea){return db[_0x2707('0x2f')][_0x2707('0x4c')](_0x35917d['body'],{})[_0x2707('0x29')](respondWithResult(_0x4a6eea,0xc9))[_0x2707('0x46')](handleError(_0x4a6eea,null));};exports[_0x2707('0x27')]=function(_0x4ae196,_0x1a8034){if(_0x4ae196['body']['id']){delete _0x4ae196[_0x2707('0x4d')]['id'];}return db[_0x2707('0x2f')]['find']({'where':{'id':_0x4ae196[_0x2707('0x48')]['id']}})[_0x2707('0x29')](handleEntityNotFound(_0x1a8034,null))[_0x2707('0x29')](saveUpdates(_0x4ae196['body'],null))['then'](respondWithResult(_0x1a8034,null))[_0x2707('0x46')](handleError(_0x1a8034,null));};exports[_0x2707('0x28')]=function(_0x292b44,_0x2515dc){return db[_0x2707('0x2f')]['find']({'where':{'id':_0x292b44['params']['id']}})['then'](handleEntityNotFound(_0x2515dc,null))[_0x2707('0x29')](removeEntity(_0x2515dc,null))[_0x2707('0x46')](handleError(_0x2515dc,null));};exports[_0x2707('0x4e')]=function(_0x1dcf74,_0x1ffcce){return db['WhatsappQueueReport'][_0x2707('0x4e')]()[_0x2707('0x29')](respondWithResult(_0x1ffcce,null))['catch'](handleError(_0x1ffcce,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index b9b03d3..214c3d9 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 _0x7dbc=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x1bba1a,_0xdb4f8b){var _0x4ed799=function(_0x2d523f){while(--_0x2d523f){_0x1bba1a['push'](_0x1bba1a['shift']());}};_0x4ed799(++_0xdb4f8b);}(_0x7dbc,0x1d9));var _0xc7db=function(_0x43212f,_0x554ee3){_0x43212f=_0x43212f-0x0;var _0x3a7fc1=_0x7dbc[_0x43212f];return _0x3a7fc1;};'use strict';var _=require('lodash');var util=require(_0xc7db('0x0'));var logger=require(_0xc7db('0x1'))(_0xc7db('0x2'));var moment=require(_0xc7db('0x3'));var BPromise=require(_0xc7db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc7db('0x5'));var config=require(_0xc7db('0x6'));var attributes=require(_0xc7db('0x7'));module['exports']=function(_0x4e3452,_0x5786df){return _0x4e3452[_0xc7db('0x8')](_0xc7db('0x9'),attributes,{'tableName':_0xc7db('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a2f=['report_whatsapp_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x5bd7d9,_0x9a830f){var _0x53c9a7=function(_0x595d9e){while(--_0x595d9e){_0x5bd7d9['push'](_0x5bd7d9['shift']());}};_0x53c9a7(++_0x9a830f);}(_0x5a2f,0xa7));var _0xf5a2=function(_0x340871,_0x3bb310){_0x340871=_0x340871-0x0;var _0x50506c=_0x5a2f[_0x340871];return _0x50506c;};'use strict';var _=require(_0xf5a2('0x0'));var util=require(_0xf5a2('0x1'));var logger=require('../../config/logger')(_0xf5a2('0x2'));var moment=require(_0xf5a2('0x3'));var BPromise=require(_0xf5a2('0x4'));var rp=require(_0xf5a2('0x5'));var fs=require('fs');var path=require(_0xf5a2('0x6'));var rimraf=require(_0xf5a2('0x7'));var config=require(_0xf5a2('0x8'));var attributes=require(_0xf5a2('0x9'));module[_0xf5a2('0xa')]=function(_0x590ac6,_0x3a997d){return _0x590ac6[_0xf5a2('0xb')](_0xf5a2('0xc'),attributes,{'tableName':_0xf5a2('0xd'),'paranoid':![],'indexes':[{'name':_0xf5a2('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index d0ce83a..20fd26d 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 _0xcf24=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateWhatsappQueueReport','create','body','options','raw','then','catch','WhatsappQueueReport','where','attributes','UpdateWhatsappQueueReport','lodash','util','moment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xcf24,0x189));var _0x4cf2=function(_0x2ae13d,_0x65c7a8){_0x2ae13d=_0x2ae13d-0x0;var _0x33bf5e=_0xcf24[_0x2ae13d];return _0x33bf5e;};'use strict';var _=require(_0x4cf2('0x0'));var util=require(_0x4cf2('0x1'));var moment=require(_0x4cf2('0x2'));var BPromise=require(_0x4cf2('0x3'));var rs=require(_0x4cf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4cf2('0x5'))['db'];var utils=require(_0x4cf2('0x6'));var logger=require('../../config/logger')(_0x4cf2('0x7'));var config=require(_0x4cf2('0x8'));var jayson=require(_0x4cf2('0x9'));var client=jayson[_0x4cf2('0xa')][_0x4cf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a1c6d,_0x3d13b4,_0x504f13){return new BPromise(function(_0x21f778,_0x15a9a0){return client[_0x4cf2('0xc')](_0x1a1c6d,_0x504f13)['then'](function(_0x4b8300){logger[_0x4cf2('0xd')](_0x4cf2('0xe'),_0x3d13b4,_0x4cf2('0xf'));logger[_0x4cf2('0x10')](_0x4cf2('0x11'),_0x3d13b4,'request\x20sent',JSON[_0x4cf2('0x12')](_0x4b8300));if(_0x4b8300[_0x4cf2('0x13')]){if(_0x4b8300[_0x4cf2('0x13')][_0x4cf2('0x14')]===0x1f4){logger[_0x4cf2('0x13')](_0x4cf2('0xe'),_0x3d13b4,_0x4b8300[_0x4cf2('0x13')][_0x4cf2('0x15')]);return _0x15a9a0(_0x4b8300['error'][_0x4cf2('0x15')]);}logger[_0x4cf2('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3d13b4,_0x4b8300['error'][_0x4cf2('0x15')]);return _0x21f778(_0x4b8300[_0x4cf2('0x13')][_0x4cf2('0x15')]);}else{logger['info'](_0x4cf2('0xe'),_0x3d13b4,'request\x20sent');_0x21f778(_0x4b8300['result'][_0x4cf2('0x15')]);}})['catch'](function(_0x352d82){logger[_0x4cf2('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3d13b4,_0x352d82);_0x15a9a0(_0x352d82);});});}exports[_0x4cf2('0x16')]=function(_0x555e62){var _0x285526=this;return new Promise(function(_0x5b9341,_0x32f1b1){return db['WhatsappQueueReport'][_0x4cf2('0x17')](_0x555e62[_0x4cf2('0x18')],{'raw':_0x555e62[_0x4cf2('0x19')]?_0x555e62['options'][_0x4cf2('0x1a')]===undefined?!![]:![]:!![]})[_0x4cf2('0x1b')](function(_0x2d8e25){logger[_0x4cf2('0xd')](_0x4cf2('0x16'),_0x555e62);logger[_0x4cf2('0x10')](_0x4cf2('0x16'),_0x555e62,JSON[_0x4cf2('0x12')](_0x2d8e25));_0x5b9341(_0x2d8e25);})[_0x4cf2('0x1c')](function(_0x431392){logger[_0x4cf2('0x13')](_0x4cf2('0x16'),_0x431392[_0x4cf2('0x15')],_0x555e62);_0x32f1b1(_0x285526['error'](0x1f4,_0x431392[_0x4cf2('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x361775){var _0x5edfad=this;return new Promise(function(_0x11a7b2,_0x28280b){return db[_0x4cf2('0x1d')]['update'](_0x361775[_0x4cf2('0x18')],{'raw':_0x361775[_0x4cf2('0x19')]?_0x361775[_0x4cf2('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x361775[_0x4cf2('0x19')]?_0x361775['options'][_0x4cf2('0x1e')]||null:null,'attributes':_0x361775['options']?_0x361775[_0x4cf2('0x19')][_0x4cf2('0x1f')]||null:null,'limit':_0x361775[_0x4cf2('0x19')]?_0x361775[_0x4cf2('0x19')]['limit']||null:null})[_0x4cf2('0x1b')](function(_0x5bf9c9){logger[_0x4cf2('0xd')](_0x4cf2('0x20'),_0x361775);logger[_0x4cf2('0x10')](_0x4cf2('0x20'),_0x361775,JSON[_0x4cf2('0x12')](_0x5bf9c9));_0x11a7b2(_0x5bf9c9);})['catch'](function(_0x1425a0){logger[_0x4cf2('0x13')]('UpdateWhatsappQueueReport',_0x1425a0[_0x4cf2('0x15')],_0x361775);_0x28280b(_0x5edfad[_0x4cf2('0x13')](0x1f4,_0x1425a0['message']));});});}; \ No newline at end of file +var _0x689f=['catch','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport','create','body','options','raw','debug'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x689f,0x1c0));var _0xf689=function(_0x2e1f26,_0x7e95c2){_0x2e1f26=_0x2e1f26-0x0;var _0x1717d2=_0x689f[_0x2e1f26];return _0x1717d2;};'use strict';var _=require('lodash');var util=require(_0xf689('0x0'));var moment=require(_0xf689('0x1'));var BPromise=require(_0xf689('0x2'));var rs=require(_0xf689('0x3'));var fs=require('fs');var Redis=require(_0xf689('0x4'));var db=require(_0xf689('0x5'))['db'];var utils=require(_0xf689('0x6'));var logger=require(_0xf689('0x7'))(_0xf689('0x8'));var config=require(_0xf689('0x9'));var jayson=require(_0xf689('0xa'));var client=jayson[_0xf689('0xb')][_0xf689('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a2de3,_0x26851b,_0x310604){return new BPromise(function(_0x23f61a,_0x14af2c){return client['request'](_0x5a2de3,_0x310604)[_0xf689('0xd')](function(_0x1139ee){logger[_0xf689('0xe')](_0xf689('0xf'),_0x26851b,_0xf689('0x10'));logger['debug'](_0xf689('0x11'),_0x26851b,_0xf689('0x10'),JSON[_0xf689('0x12')](_0x1139ee));if(_0x1139ee[_0xf689('0x13')]){if(_0x1139ee[_0xf689('0x13')]['code']===0x1f4){logger[_0xf689('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x26851b,_0x1139ee['error'][_0xf689('0x14')]);return _0x14af2c(_0x1139ee[_0xf689('0x13')][_0xf689('0x14')]);}logger['error'](_0xf689('0xf'),_0x26851b,_0x1139ee[_0xf689('0x13')][_0xf689('0x14')]);return _0x23f61a(_0x1139ee[_0xf689('0x13')]['message']);}else{logger[_0xf689('0xe')](_0xf689('0xf'),_0x26851b,_0xf689('0x10'));_0x23f61a(_0x1139ee[_0xf689('0x15')]['message']);}})['catch'](function(_0x5862da){logger[_0xf689('0x13')](_0xf689('0xf'),_0x26851b,_0x5862da);_0x14af2c(_0x5862da);});});}exports[_0xf689('0x16')]=function(_0x1e4df3){var _0xc4700a=this;return new Promise(function(_0x5a38db,_0x35d615){return db['WhatsappQueueReport'][_0xf689('0x17')](_0x1e4df3[_0xf689('0x18')],{'raw':_0x1e4df3['options']?_0x1e4df3[_0xf689('0x19')][_0xf689('0x1a')]===undefined?!![]:![]:!![]})[_0xf689('0xd')](function(_0x1526b2){logger['info'](_0xf689('0x16'),_0x1e4df3);logger[_0xf689('0x1b')](_0xf689('0x16'),_0x1e4df3,JSON[_0xf689('0x12')](_0x1526b2));_0x5a38db(_0x1526b2);})[_0xf689('0x1c')](function(_0x4b2986){logger['error']('CreateWhatsappQueueReport',_0x4b2986[_0xf689('0x14')],_0x1e4df3);_0x35d615(_0xc4700a[_0xf689('0x13')](0x1f4,_0x4b2986[_0xf689('0x14')]));});});};exports[_0xf689('0x1d')]=function(_0x50031c){var _0x48fe78=this;return new Promise(function(_0x3b0915,_0x5878c3){return db[_0xf689('0x1e')][_0xf689('0x1f')](_0x50031c[_0xf689('0x18')],{'raw':_0x50031c['options']?_0x50031c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50031c[_0xf689('0x19')]?_0x50031c[_0xf689('0x19')][_0xf689('0x20')]||null:null,'attributes':_0x50031c[_0xf689('0x19')]?_0x50031c['options'][_0xf689('0x21')]||null:null,'limit':_0x50031c[_0xf689('0x19')]?_0x50031c[_0xf689('0x19')]['limit']||null:null})[_0xf689('0xd')](function(_0x13fb32){logger[_0xf689('0xe')](_0xf689('0x1d'),_0x50031c);logger[_0xf689('0x1b')](_0xf689('0x1d'),_0x50031c,JSON[_0xf689('0x12')](_0x13fb32));_0x3b0915(_0x13fb32);})['catch'](function(_0x4d9ceb){logger[_0xf689('0x13')]('UpdateWhatsappQueueReport',_0x4d9ceb[_0xf689('0x14')],_0x50031c);_0x5878c3(_0x48fe78[_0xf689('0x13')](0x1f4,_0x4d9ceb[_0xf689('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9c96387..09a9889 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 _0xb0c8=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4783e9,_0x2c38aa){var _0x1d8fd6=function(_0x16b2ab){while(--_0x16b2ab){_0x4783e9['push'](_0x4783e9['shift']());}};_0x1d8fd6(++_0x2c38aa);}(_0xb0c8,0x14c));var _0x8b0c=function(_0x2dacd3,_0x1fcde1){_0x2dacd3=_0x2dacd3-0x0;var _0x96b9ad=_0xb0c8[_0x2dacd3];return _0x96b9ad;};'use strict';var multer=require(_0x8b0c('0x0'));var util=require(_0x8b0c('0x1'));var path=require(_0x8b0c('0x2'));var timeout=require(_0x8b0c('0x3'));var express=require(_0x8b0c('0x4'));var router=express['Router']();var fs_extra=require(_0x8b0c('0x5'));var auth=require(_0x8b0c('0x6'));var interaction=require(_0x8b0c('0x7'));var config=require(_0x8b0c('0x8'));var controller=require(_0x8b0c('0x9'));router[_0x8b0c('0xa')]('/',auth[_0x8b0c('0xb')](),controller[_0x8b0c('0xc')]);router[_0x8b0c('0xa')](_0x8b0c('0xd'),auth[_0x8b0c('0xb')](),controller[_0x8b0c('0xe')]);router['get'](_0x8b0c('0xf'),auth[_0x8b0c('0xb')](),controller[_0x8b0c('0x10')]);router[_0x8b0c('0x11')]('/',auth[_0x8b0c('0xb')](),controller[_0x8b0c('0x12')]);router[_0x8b0c('0x13')]('/:id',auth[_0x8b0c('0xb')](),controller[_0x8b0c('0x14')]);router[_0x8b0c('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x8b0c('0x16')]);module[_0x8b0c('0x17')]=router; \ No newline at end of file +var _0xc122=['delete','multer','util','Router','fs-extra','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','create','/:id','update'];(function(_0x29881a,_0x377466){var _0x340373=function(_0x390bb4){while(--_0x390bb4){_0x29881a['push'](_0x29881a['shift']());}};_0x340373(++_0x377466);}(_0xc122,0xe1));var _0x2c12=function(_0xadbcf5,_0x59c671){_0xadbcf5=_0xadbcf5-0x0;var _0x49831b=_0xc122[_0xadbcf5];return _0x49831b;};'use strict';var multer=require(_0x2c12('0x0'));var util=require(_0x2c12('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c12('0x2')]();var fs_extra=require(_0x2c12('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2c12('0x4'));var config=require('../../config/environment');var controller=require(_0x2c12('0x5'));router[_0x2c12('0x6')]('/',auth[_0x2c12('0x7')](),controller[_0x2c12('0x8')]);router[_0x2c12('0x6')](_0x2c12('0x9'),auth[_0x2c12('0x7')](),controller[_0x2c12('0xa')]);router[_0x2c12('0x6')]('/:id',auth[_0x2c12('0x7')](),controller[_0x2c12('0xb')]);router['post']('/',auth[_0x2c12('0x7')](),controller[_0x2c12('0xc')]);router['put'](_0x2c12('0xd'),auth[_0x2c12('0x7')](),controller[_0x2c12('0xe')]);router[_0x2c12('0xf')](_0x2c12('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 3f2fa8f..d0b6fd7 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 _0x85cf=['STRING','ENUM','account','agent','queue','DATE','exports'];(function(_0x2b7669,_0xbe4013){var _0x3b42b3=function(_0x19967e){while(--_0x19967e){_0x2b7669['push'](_0x2b7669['shift']());}};_0x3b42b3(++_0xbe4013);}(_0x85cf,0x76));var _0xf85c=function(_0x345cb6,_0xeae5b1){_0x345cb6=_0x345cb6-0x0;var _0xcf2853=_0x85cf[_0x345cb6];return _0xcf2853;};'use strict';var Sequelize=require('sequelize');module[_0xf85c('0x0')]={'uniqueid':{'type':Sequelize[_0xf85c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf85c('0x2')](_0xf85c('0x3'),_0xf85c('0x4'),_0xf85c('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf85c('0x6')]}}; \ No newline at end of file +var _0x4ffe=['STRING','account','agent','queue','sequelize','exports'];(function(_0x5c9e82,_0x3c18ad){var _0x5c741f=function(_0x136496){while(--_0x136496){_0x5c9e82['push'](_0x5c9e82['shift']());}};_0x5c741f(++_0x3c18ad);}(_0x4ffe,0x172));var _0xe4ff=function(_0x3d0098,_0x22ee82){_0x3d0098=_0x3d0098-0x0;var _0x3ef587=_0x4ffe[_0x3d0098];return _0x3ef587;};'use strict';var Sequelize=require(_0xe4ff('0x0'));module[_0xe4ff('0x1')]={'uniqueid':{'type':Sequelize[_0xe4ff('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe4ff('0x3'),_0xe4ff('0x4'),_0xe4ff('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d50c641..2ad2768 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 _0x9782=['fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','rows','catch','params','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','destroy','then','sendStatus','error','stack','name','send','index','map','WhatsappTransferReport'];(function(_0x518b99,_0x4333e4){var _0x45faed=function(_0x48efa3){while(--_0x48efa3){_0x518b99['push'](_0x518b99['shift']());}};_0x45faed(++_0x4333e4);}(_0x9782,0xf6));var _0x2978=function(_0x578d84,_0x352aef){_0x578d84=_0x578d84-0x0;var _0x2c0cea=_0x9782[_0x578d84];return _0x2c0cea;};'use strict';var emlformat=require(_0x2978('0x0'));var rimraf=require(_0x2978('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2978('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2978('0x3'));var Mustache=require(_0x2978('0x4'));var util=require(_0x2978('0x5'));var path=require(_0x2978('0x6'));var sox=require(_0x2978('0x7'));var csv=require(_0x2978('0x8'));var ejs=require(_0x2978('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2978('0xa'));var squel=require('squel');var crypto=require(_0x2978('0xb'));var jsforce=require(_0x2978('0xc'));var deskjs=require(_0x2978('0xd'));var toCsv=require(_0x2978('0x8'));var querystring=require(_0x2978('0xe'));var Papa=require(_0x2978('0xf'));var Redis=require(_0x2978('0x10'));var authService=require(_0x2978('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2978('0x12'));var hardwareService=require(_0x2978('0x13'));var logger=require(_0x2978('0x14'))(_0x2978('0x15'));var utils=require(_0x2978('0x16'));var config=require(_0x2978('0x17'));var licenseUtil=require(_0x2978('0x18'));var db=require(_0x2978('0x19'))['db'];function respondWithStatusCode(_0x4bec06,_0x4944b8){_0x4944b8=_0x4944b8||0xcc;return function(_0x5315f5){if(_0x5315f5){return _0x4bec06['sendStatus'](_0x4944b8);}return _0x4bec06['status'](_0x4944b8)[_0x2978('0x1a')]();};}function respondWithResult(_0x648ed0,_0x213cf0){_0x213cf0=_0x213cf0||0xc8;return function(_0x1a6397){if(_0x1a6397){return _0x648ed0[_0x2978('0x1b')](_0x213cf0)[_0x2978('0x1c')](_0x1a6397);}};}function respondWithFilteredResult(_0x2aea84,_0x1ef1c3){return function(_0x1b7e53){if(_0x1b7e53){var _0x5a3947=typeof _0x1ef1c3[_0x2978('0x1d')]===_0x2978('0x1e')&&typeof _0x1ef1c3[_0x2978('0x1f')]==='undefined';var _0x3db1c6=_0x1b7e53[_0x2978('0x20')];var _0x4346be=_0x5a3947?0x0:_0x1ef1c3[_0x2978('0x1d')];var _0x32403c=_0x5a3947?_0x1b7e53['count']:_0x1ef1c3[_0x2978('0x1d')]+_0x1ef1c3[_0x2978('0x1f')];var _0x20be5c;if(_0x32403c>=_0x3db1c6){_0x32403c=_0x3db1c6;_0x20be5c=0xc8;}else{_0x20be5c=0xce;}_0x2aea84[_0x2978('0x1b')](_0x20be5c);return _0x2aea84[_0x2978('0x21')](_0x2978('0x22'),_0x4346be+'-'+_0x32403c+'/'+_0x3db1c6)['json'](_0x1b7e53);}return null;};}function patchUpdates(_0x22f53a){return function(_0x3691f0){try{jsonpatch['apply'](_0x3691f0,_0x22f53a,!![]);}catch(_0x16f59c){return BPromise['reject'](_0x16f59c);}return _0x3691f0[_0x2978('0x23')]();};}function saveUpdates(_0x5b7f3c,_0x362fd3){return function(_0x4d9ac7){if(_0x4d9ac7){return _0x4d9ac7['update'](_0x5b7f3c)['then'](function(_0x518199){return _0x518199;});}return null;};}function removeEntity(_0xa02362,_0x5286b4){return function(_0x8b6090){if(_0x8b6090){return _0x8b6090[_0x2978('0x24')]()[_0x2978('0x25')](function(){_0xa02362[_0x2978('0x1b')](0xcc)[_0x2978('0x1a')]();});}};}function handleEntityNotFound(_0x3faaad,_0x2ecf8d){return function(_0x3b49ea){if(!_0x3b49ea){_0x3faaad[_0x2978('0x26')](0x194);}return _0x3b49ea;};}function handleError(_0x4995fb,_0x37cb52){_0x37cb52=_0x37cb52||0x1f4;return function(_0x53947b){logger[_0x2978('0x27')](_0x53947b[_0x2978('0x28')]);if(_0x53947b[_0x2978('0x29')]){delete _0x53947b[_0x2978('0x29')];}_0x4995fb[_0x2978('0x1b')](_0x37cb52)[_0x2978('0x2a')](_0x53947b);};}exports[_0x2978('0x2b')]=function(_0x1e2d06,_0x9d3489){var _0x31e276={},_0x500958={},_0xcf78a0={'count':0x0,'rows':[]};var _0x467a71=_[_0x2978('0x2c')](db[_0x2978('0x2d')]['rawAttributes'],function(_0xe728a0){return{'name':_0xe728a0[_0x2978('0x2e')],'type':_0xe728a0['type'][_0x2978('0x2f')]};});_0x500958[_0x2978('0x30')]=_[_0x2978('0x2c')](_0x467a71,_0x2978('0x29'));_0x500958[_0x2978('0x31')]=_[_0x2978('0x32')](_0x1e2d06[_0x2978('0x31')]);_0x500958[_0x2978('0x33')]=_[_0x2978('0x34')](_0x500958[_0x2978('0x30')],_0x500958[_0x2978('0x31')]);_0x31e276['attributes']=_['intersection'](_0x500958['model'],qs[_0x2978('0x35')](_0x1e2d06[_0x2978('0x31')]['fields']));_0x31e276[_0x2978('0x36')]=_0x31e276[_0x2978('0x36')][_0x2978('0x37')]?_0x31e276[_0x2978('0x36')]:_0x500958['model'];if(!_0x1e2d06[_0x2978('0x31')][_0x2978('0x38')](_0x2978('0x39'))){_0x31e276[_0x2978('0x1f')]=qs['limit'](_0x1e2d06[_0x2978('0x31')][_0x2978('0x1f')]);_0x31e276[_0x2978('0x1d')]=qs['offset'](_0x1e2d06[_0x2978('0x31')]['offset']);}_0x31e276['order']=qs[_0x2978('0x3a')](_0x1e2d06['query'][_0x2978('0x3a')]);_0x31e276[_0x2978('0x3b')]=qs[_0x2978('0x33')](_[_0x2978('0x3c')](_0x1e2d06[_0x2978('0x31')],_0x500958['filters']),_0x467a71);if(_0x1e2d06[_0x2978('0x31')][_0x2978('0x3d')]){_0x31e276['where']=_[_0x2978('0x3e')](_0x31e276[_0x2978('0x3b')],{'$or':_[_0x2978('0x2c')](_0x467a71,function(_0xca42ed){if(_0xca42ed[_0x2978('0x3f')]!=='VIRTUAL'){var _0x5093ee={};_0x5093ee[_0xca42ed[_0x2978('0x29')]]={'$like':'%'+_0x1e2d06['query'][_0x2978('0x3d')]+'%'};return _0x5093ee;}})});}_0x31e276=_[_0x2978('0x3e')]({},_0x31e276,_0x1e2d06['options']);var _0x5438c8={'where':_0x31e276[_0x2978('0x3b')]};return db[_0x2978('0x2d')]['count'](_0x5438c8)[_0x2978('0x25')](function(_0x566b14){_0xcf78a0[_0x2978('0x20')]=_0x566b14;if(_0x1e2d06['query'][_0x2978('0x40')]){_0x31e276['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x31e276);})[_0x2978('0x25')](function(_0x46c4f3){_0xcf78a0[_0x2978('0x41')]=_0x46c4f3;return _0xcf78a0;})[_0x2978('0x25')](respondWithFilteredResult(_0x9d3489,_0x31e276))[_0x2978('0x42')](handleError(_0x9d3489,null));};exports['show']=function(_0x22f97c,_0x16f7f4){var _0x3f530a={'raw':!![],'where':{'id':_0x22f97c[_0x2978('0x43')]['id']}},_0x2461fd={};_0x2461fd['model']=_[_0x2978('0x32')](db[_0x2978('0x2d')]['rawAttributes']);_0x2461fd['query']=_['keys'](_0x22f97c[_0x2978('0x31')]);_0x2461fd['filters']=_[_0x2978('0x34')](_0x2461fd['model'],_0x2461fd[_0x2978('0x31')]);_0x3f530a['attributes']=_[_0x2978('0x34')](_0x2461fd[_0x2978('0x30')],qs['fields'](_0x22f97c[_0x2978('0x31')][_0x2978('0x35')]));_0x3f530a[_0x2978('0x36')]=_0x3f530a[_0x2978('0x36')]['length']?_0x3f530a['attributes']:_0x2461fd[_0x2978('0x30')];if(_0x22f97c[_0x2978('0x31')]['includeAll']){_0x3f530a['include']=[{'all':!![]}];}_0x3f530a=_[_0x2978('0x3e')]({},_0x3f530a,_0x22f97c[_0x2978('0x44')]);return db[_0x2978('0x2d')][_0x2978('0x45')](_0x3f530a)[_0x2978('0x25')](handleEntityNotFound(_0x16f7f4,null))[_0x2978('0x25')](respondWithResult(_0x16f7f4,null))[_0x2978('0x42')](handleError(_0x16f7f4,null));};exports[_0x2978('0x46')]=function(_0x2bdfb5,_0x4e8e22){return db[_0x2978('0x2d')][_0x2978('0x46')](_0x2bdfb5[_0x2978('0x47')],{})[_0x2978('0x25')](respondWithResult(_0x4e8e22,0xc9))[_0x2978('0x42')](handleError(_0x4e8e22,null));};exports['update']=function(_0x12535f,_0x3e717d){if(_0x12535f[_0x2978('0x47')]['id']){delete _0x12535f[_0x2978('0x47')]['id'];}return db['WhatsappTransferReport'][_0x2978('0x45')]({'where':{'id':_0x12535f[_0x2978('0x43')]['id']}})[_0x2978('0x25')](handleEntityNotFound(_0x3e717d,null))[_0x2978('0x25')](saveUpdates(_0x12535f['body'],null))[_0x2978('0x25')](respondWithResult(_0x3e717d,null))[_0x2978('0x42')](handleError(_0x3e717d,null));};exports[_0x2978('0x24')]=function(_0x4c190e,_0x29ec68){return db['WhatsappTransferReport'][_0x2978('0x45')]({'where':{'id':_0x4c190e[_0x2978('0x43')]['id']}})[_0x2978('0x25')](handleEntityNotFound(_0x29ec68,null))[_0x2978('0x25')](removeEntity(_0x29ec68,null))['catch'](handleError(_0x29ec68,null));};exports[_0x2978('0x48')]=function(_0x12f56d,_0x3bc4cd){return db[_0x2978('0x2d')][_0x2978('0x48')]()[_0x2978('0x25')](respondWithResult(_0x3bc4cd,null))[_0x2978('0x42')](handleError(_0x3bc4cd,null));}; \ No newline at end of file +var _0xb2a6=['hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','update','destroy','then','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0xb2a6,0xf0));var _0x6b2a=function(_0x3465f6,_0x20e3f3){_0x3465f6=_0x3465f6-0x0;var _0x28e7a3=_0xb2a6[_0x3465f6];return _0x28e7a3;};'use strict';var emlformat=require(_0x6b2a('0x0'));var rimraf=require(_0x6b2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b2a('0x2'));var rp=require('request-promise');var moment=require(_0x6b2a('0x3'));var BPromise=require(_0x6b2a('0x4'));var Mustache=require(_0x6b2a('0x5'));var util=require(_0x6b2a('0x6'));var path=require(_0x6b2a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b2a('0x8'));var _=require(_0x6b2a('0x9'));var squel=require(_0x6b2a('0xa'));var crypto=require(_0x6b2a('0xb'));var jsforce=require(_0x6b2a('0xc'));var deskjs=require(_0x6b2a('0xd'));var toCsv=require(_0x6b2a('0xe'));var querystring=require(_0x6b2a('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b2a('0x10'));var authService=require(_0x6b2a('0x11'));var qs=require(_0x6b2a('0x12'));var as=require(_0x6b2a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b2a('0x14'))(_0x6b2a('0x15'));var utils=require(_0x6b2a('0x16'));var config=require(_0x6b2a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b2a('0x18'))['db'];function respondWithStatusCode(_0x2e8f05,_0x57047a){_0x57047a=_0x57047a||0xcc;return function(_0x461c95){if(_0x461c95){return _0x2e8f05[_0x6b2a('0x19')](_0x57047a);}return _0x2e8f05[_0x6b2a('0x1a')](_0x57047a)[_0x6b2a('0x1b')]();};}function respondWithResult(_0xb6c388,_0x246f92){_0x246f92=_0x246f92||0xc8;return function(_0x1ad2b1){if(_0x1ad2b1){return _0xb6c388['status'](_0x246f92)[_0x6b2a('0x1c')](_0x1ad2b1);}};}function respondWithFilteredResult(_0x261727,_0x20c428){return function(_0xd8c0f3){if(_0xd8c0f3){var _0x1f4d73=typeof _0x20c428['offset']==='undefined'&&typeof _0x20c428[_0x6b2a('0x1d')]===_0x6b2a('0x1e');var _0x3579a0=_0xd8c0f3[_0x6b2a('0x1f')];var _0x10b26e=_0x1f4d73?0x0:_0x20c428[_0x6b2a('0x20')];var _0x5c0788=_0x1f4d73?_0xd8c0f3['count']:_0x20c428[_0x6b2a('0x20')]+_0x20c428['limit'];var _0xfe576e;if(_0x5c0788>=_0x3579a0){_0x5c0788=_0x3579a0;_0xfe576e=0xc8;}else{_0xfe576e=0xce;}_0x261727[_0x6b2a('0x1a')](_0xfe576e);return _0x261727['set'](_0x6b2a('0x21'),_0x10b26e+'-'+_0x5c0788+'/'+_0x3579a0)[_0x6b2a('0x1c')](_0xd8c0f3);}return null;};}function patchUpdates(_0x9a61d8){return function(_0x180726){try{jsonpatch['apply'](_0x180726,_0x9a61d8,!![]);}catch(_0x166662){return BPromise[_0x6b2a('0x22')](_0x166662);}return _0x180726['save']();};}function saveUpdates(_0x32fa10,_0x5ebf6a){return function(_0x2fbfd8){if(_0x2fbfd8){return _0x2fbfd8[_0x6b2a('0x23')](_0x32fa10)['then'](function(_0x3b4bd3){return _0x3b4bd3;});}return null;};}function removeEntity(_0x373d24,_0x5b669f){return function(_0x30e47c){if(_0x30e47c){return _0x30e47c[_0x6b2a('0x24')]()[_0x6b2a('0x25')](function(){_0x373d24[_0x6b2a('0x1a')](0xcc)[_0x6b2a('0x1b')]();});}};}function handleEntityNotFound(_0x2284a3,_0x137346){return function(_0x2de01a){if(!_0x2de01a){_0x2284a3[_0x6b2a('0x19')](0x194);}return _0x2de01a;};}function handleError(_0x423818,_0xa3a7e4){_0xa3a7e4=_0xa3a7e4||0x1f4;return function(_0x2184f6){logger[_0x6b2a('0x26')](_0x2184f6[_0x6b2a('0x27')]);if(_0x2184f6[_0x6b2a('0x28')]){delete _0x2184f6[_0x6b2a('0x28')];}_0x423818[_0x6b2a('0x1a')](_0xa3a7e4)['send'](_0x2184f6);};}exports[_0x6b2a('0x29')]=function(_0x470684,_0x50d52e){var _0x33faf6={},_0x52d110={},_0x24d247={'count':0x0,'rows':[]};var _0x15ed2a=_[_0x6b2a('0x2a')](db[_0x6b2a('0x2b')][_0x6b2a('0x2c')],function(_0x16e871){return{'name':_0x16e871[_0x6b2a('0x2d')],'type':_0x16e871[_0x6b2a('0x2e')][_0x6b2a('0x2f')]};});_0x52d110[_0x6b2a('0x30')]=_[_0x6b2a('0x2a')](_0x15ed2a,'name');_0x52d110['query']=_[_0x6b2a('0x31')](_0x470684[_0x6b2a('0x32')]);_0x52d110[_0x6b2a('0x33')]=_['intersection'](_0x52d110['model'],_0x52d110[_0x6b2a('0x32')]);_0x33faf6[_0x6b2a('0x34')]=_[_0x6b2a('0x35')](_0x52d110[_0x6b2a('0x30')],qs[_0x6b2a('0x36')](_0x470684[_0x6b2a('0x32')][_0x6b2a('0x36')]));_0x33faf6[_0x6b2a('0x34')]=_0x33faf6[_0x6b2a('0x34')][_0x6b2a('0x37')]?_0x33faf6[_0x6b2a('0x34')]:_0x52d110[_0x6b2a('0x30')];if(!_0x470684[_0x6b2a('0x32')][_0x6b2a('0x38')](_0x6b2a('0x39'))){_0x33faf6['limit']=qs[_0x6b2a('0x1d')](_0x470684[_0x6b2a('0x32')][_0x6b2a('0x1d')]);_0x33faf6['offset']=qs[_0x6b2a('0x20')](_0x470684[_0x6b2a('0x32')][_0x6b2a('0x20')]);}_0x33faf6['order']=qs[_0x6b2a('0x3a')](_0x470684[_0x6b2a('0x32')][_0x6b2a('0x3a')]);_0x33faf6['where']=qs['filters'](_['pick'](_0x470684['query'],_0x52d110['filters']),_0x15ed2a);if(_0x470684[_0x6b2a('0x32')]['filter']){_0x33faf6[_0x6b2a('0x3b')]=_[_0x6b2a('0x3c')](_0x33faf6[_0x6b2a('0x3b')],{'$or':_[_0x6b2a('0x2a')](_0x15ed2a,function(_0x5deb85){if(_0x5deb85[_0x6b2a('0x2e')]!==_0x6b2a('0x3d')){var _0x2b5659={};_0x2b5659[_0x5deb85[_0x6b2a('0x28')]]={'$like':'%'+_0x470684[_0x6b2a('0x32')]['filter']+'%'};return _0x2b5659;}})});}_0x33faf6=_['merge']({},_0x33faf6,_0x470684['options']);var _0x19534b={'where':_0x33faf6['where']};return db[_0x6b2a('0x2b')][_0x6b2a('0x1f')](_0x19534b)[_0x6b2a('0x25')](function(_0x4805e0){_0x24d247['count']=_0x4805e0;if(_0x470684['query']['includeAll']){_0x33faf6[_0x6b2a('0x3e')]=[{'all':!![]}];}return db[_0x6b2a('0x2b')][_0x6b2a('0x3f')](_0x33faf6);})['then'](function(_0x4a83e3){_0x24d247[_0x6b2a('0x40')]=_0x4a83e3;return _0x24d247;})['then'](respondWithFilteredResult(_0x50d52e,_0x33faf6))['catch'](handleError(_0x50d52e,null));};exports[_0x6b2a('0x41')]=function(_0x3a2de8,_0x5de790){var _0xd91e02={'raw':!![],'where':{'id':_0x3a2de8[_0x6b2a('0x42')]['id']}},_0x18e96f={};_0x18e96f[_0x6b2a('0x30')]=_['keys'](db['WhatsappTransferReport']['rawAttributes']);_0x18e96f[_0x6b2a('0x32')]=_[_0x6b2a('0x31')](_0x3a2de8['query']);_0x18e96f[_0x6b2a('0x33')]=_['intersection'](_0x18e96f[_0x6b2a('0x30')],_0x18e96f[_0x6b2a('0x32')]);_0xd91e02[_0x6b2a('0x34')]=_[_0x6b2a('0x35')](_0x18e96f[_0x6b2a('0x30')],qs['fields'](_0x3a2de8[_0x6b2a('0x32')][_0x6b2a('0x36')]));_0xd91e02[_0x6b2a('0x34')]=_0xd91e02[_0x6b2a('0x34')][_0x6b2a('0x37')]?_0xd91e02[_0x6b2a('0x34')]:_0x18e96f[_0x6b2a('0x30')];if(_0x3a2de8[_0x6b2a('0x32')][_0x6b2a('0x43')]){_0xd91e02[_0x6b2a('0x3e')]=[{'all':!![]}];}_0xd91e02=_[_0x6b2a('0x3c')]({},_0xd91e02,_0x3a2de8[_0x6b2a('0x44')]);return db['WhatsappTransferReport'][_0x6b2a('0x45')](_0xd91e02)[_0x6b2a('0x25')](handleEntityNotFound(_0x5de790,null))[_0x6b2a('0x25')](respondWithResult(_0x5de790,null))[_0x6b2a('0x46')](handleError(_0x5de790,null));};exports['create']=function(_0x23dad0,_0x456e82){return db[_0x6b2a('0x2b')][_0x6b2a('0x47')](_0x23dad0[_0x6b2a('0x48')],{})[_0x6b2a('0x25')](respondWithResult(_0x456e82,0xc9))['catch'](handleError(_0x456e82,null));};exports[_0x6b2a('0x23')]=function(_0x123a25,_0x2818eb){if(_0x123a25[_0x6b2a('0x48')]['id']){delete _0x123a25[_0x6b2a('0x48')]['id'];}return db['WhatsappTransferReport'][_0x6b2a('0x45')]({'where':{'id':_0x123a25[_0x6b2a('0x42')]['id']}})[_0x6b2a('0x25')](handleEntityNotFound(_0x2818eb,null))[_0x6b2a('0x25')](saveUpdates(_0x123a25[_0x6b2a('0x48')],null))[_0x6b2a('0x25')](respondWithResult(_0x2818eb,null))['catch'](handleError(_0x2818eb,null));};exports[_0x6b2a('0x24')]=function(_0x5474b6,_0x74e29b){return db[_0x6b2a('0x2b')]['find']({'where':{'id':_0x5474b6[_0x6b2a('0x42')]['id']}})[_0x6b2a('0x25')](handleEntityNotFound(_0x74e29b,null))['then'](removeEntity(_0x74e29b,null))[_0x6b2a('0x46')](handleError(_0x74e29b,null));};exports[_0x6b2a('0x49')]=function(_0x1097f9,_0x3c3dcf){return db[_0x6b2a('0x2b')][_0x6b2a('0x49')]()['then'](respondWithResult(_0x3c3dcf,null))['catch'](handleError(_0x3c3dcf,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index b03cfc6..f04b529 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 _0xdbdf=['report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x155a36,_0x4bf39){var _0x3c99d0=function(_0x2ff601){while(--_0x2ff601){_0x155a36['push'](_0x155a36['shift']());}};_0x3c99d0(++_0x4bf39);}(_0xdbdf,0x122));var _0xfdbd=function(_0x566429,_0x1892bc){_0x566429=_0x566429-0x0;var _0xc2915f=_0xdbdf[_0x566429];return _0xc2915f;};'use strict';var _=require(_0xfdbd('0x0'));var util=require('util');var logger=require(_0xfdbd('0x1'))(_0xfdbd('0x2'));var moment=require(_0xfdbd('0x3'));var BPromise=require(_0xfdbd('0x4'));var rp=require(_0xfdbd('0x5'));var fs=require('fs');var path=require(_0xfdbd('0x6'));var rimraf=require('rimraf');var config=require(_0xfdbd('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xfdbd('0x8')]=function(_0x4cafc9,_0x23b654){return _0x4cafc9[_0xfdbd('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0xfdbd('0xa'),'paranoid':![],'indexes':[{'name':_0xfdbd('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x236a=['report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','WhatsappTransferReport'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x236a,0x178));var _0xa236=function(_0x410435,_0x530225){_0x410435=_0x410435-0x0;var _0x5cafda=_0x236a[_0x410435];return _0x5cafda;};'use strict';var _=require(_0xa236('0x0'));var util=require('util');var logger=require(_0xa236('0x1'))(_0xa236('0x2'));var moment=require(_0xa236('0x3'));var BPromise=require('bluebird');var rp=require(_0xa236('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa236('0x5'));var config=require(_0xa236('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0xa236('0x7')]=function(_0xcbd47a,_0x3dc20b){return _0xcbd47a['define'](_0xa236('0x8'),attributes,{'tableName':_0xa236('0x9'),'paranoid':![],'indexes':[{'name':_0xa236('0xa'),'fields':[_0xa236('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 53d7ff0..a5d1725 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 _0xec4e=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x5deee9,_0xf7bae7){var _0x1d84e0=function(_0x90da2b){while(--_0x90da2b){_0x5deee9['push'](_0x5deee9['shift']());}};_0x1d84e0(++_0xf7bae7);}(_0xec4e,0x1e0));var _0xeec4=function(_0x38fc1b,_0x4807c4){_0x38fc1b=_0x38fc1b-0x0;var _0x37b75a=_0xec4e[_0x38fc1b];return _0x37b75a;};'use strict';var _=require(_0xeec4('0x0'));var util=require(_0xeec4('0x1'));var moment=require('moment');var BPromise=require(_0xeec4('0x2'));var rs=require(_0xeec4('0x3'));var fs=require('fs');var Redis=require(_0xeec4('0x4'));var db=require(_0xeec4('0x5'))['db'];var utils=require(_0xeec4('0x6'));var logger=require('../../config/logger')(_0xeec4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeec4('0x8')][_0xeec4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x328da8,_0x383a02,_0x19d3b2){return new BPromise(function(_0xe75488,_0x18621c){return client[_0xeec4('0xa')](_0x328da8,_0x19d3b2)[_0xeec4('0xb')](function(_0x1d3c1e){logger[_0xeec4('0xc')](_0xeec4('0xd'),_0x383a02,_0xeec4('0xe'));logger['debug'](_0xeec4('0xf'),_0x383a02,_0xeec4('0xe'),JSON['stringify'](_0x1d3c1e));if(_0x1d3c1e[_0xeec4('0x10')]){if(_0x1d3c1e[_0xeec4('0x10')]['code']===0x1f4){logger['error'](_0xeec4('0xd'),_0x383a02,_0x1d3c1e['error'][_0xeec4('0x11')]);return _0x18621c(_0x1d3c1e['error'][_0xeec4('0x11')]);}logger[_0xeec4('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x383a02,_0x1d3c1e[_0xeec4('0x10')][_0xeec4('0x11')]);return _0xe75488(_0x1d3c1e[_0xeec4('0x10')][_0xeec4('0x11')]);}else{logger['info'](_0xeec4('0xd'),_0x383a02,_0xeec4('0xe'));_0xe75488(_0x1d3c1e[_0xeec4('0x12')][_0xeec4('0x11')]);}})[_0xeec4('0x13')](function(_0x9c2bcb){logger[_0xeec4('0x10')](_0xeec4('0xd'),_0x383a02,_0x9c2bcb);_0x18621c(_0x9c2bcb);});});} \ No newline at end of file +var _0x8221=['http','request','then','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x43d296,_0x4bb4d0){var _0x3e9f3d=function(_0x37a760){while(--_0x37a760){_0x43d296['push'](_0x43d296['shift']());}};_0x3e9f3d(++_0x4bb4d0);}(_0x8221,0xe5));var _0x1822=function(_0x3da707,_0x30c36d){_0x3da707=_0x3da707-0x0;var _0x342ee7=_0x8221[_0x3da707];return _0x342ee7;};'use strict';var _=require(_0x1822('0x0'));var util=require(_0x1822('0x1'));var moment=require(_0x1822('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1822('0x3'));var db=require(_0x1822('0x4'))['db'];var utils=require(_0x1822('0x5'));var logger=require(_0x1822('0x6'))(_0x1822('0x7'));var config=require(_0x1822('0x8'));var jayson=require(_0x1822('0x9'));var client=jayson[_0x1822('0xa')][_0x1822('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49094c,_0x589022,_0x5d4fbe){return new BPromise(function(_0x4dd441,_0x42dc75){return client[_0x1822('0xc')](_0x49094c,_0x5d4fbe)[_0x1822('0xd')](function(_0x3a4c7f){logger['info'](_0x1822('0xe'),_0x589022,'request\x20sent');logger['debug'](_0x1822('0xf'),_0x589022,_0x1822('0x10'),JSON[_0x1822('0x11')](_0x3a4c7f));if(_0x3a4c7f['error']){if(_0x3a4c7f[_0x1822('0x12')][_0x1822('0x13')]===0x1f4){logger[_0x1822('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x589022,_0x3a4c7f[_0x1822('0x12')][_0x1822('0x14')]);return _0x42dc75(_0x3a4c7f['error'][_0x1822('0x14')]);}logger[_0x1822('0x12')](_0x1822('0xe'),_0x589022,_0x3a4c7f[_0x1822('0x12')][_0x1822('0x14')]);return _0x4dd441(_0x3a4c7f[_0x1822('0x12')][_0x1822('0x14')]);}else{logger[_0x1822('0x15')](_0x1822('0xe'),_0x589022,_0x1822('0x10'));_0x4dd441(_0x3a4c7f[_0x1822('0x16')][_0x1822('0x14')]);}})[_0x1822('0x17')](function(_0x5c455a){logger[_0x1822('0x12')](_0x1822('0xe'),_0x589022,_0x5c455a);_0x42dc75(_0x5c455a);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8715241..27b60dd 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x972c=['App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','./config/seedDB','./config/license','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x972c,0xf2));var _0xc972=function(_0x37ce50,_0x515bf8){_0x37ce50=_0x37ce50-0x0;var _0x2d42b5=_0x972c[_0x37ce50];return _0x2d42b5;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0xc972('0x0'));var checkLicense=require(_0xc972('0x1'));var rpc=require('./rpc');var config=require(_0xc972('0x2'));var logger=require(_0xc972('0x3'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xc972('0x4'));var schedule=require(_0xc972('0x5'));var chat=require(_0xc972('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xc972('0x7'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xc972('0x8')][_0xc972('0x9')]()[_0xc972('0xa')](function(){if(config['seedDB']){return seedDb['default']();}})['then'](function(){return checkLicense[_0xc972('0xb')]();})['then'](function(){return rpc[_0xc972('0xc')]();})[_0xc972('0xa')](function(_0x32cb5b){logger[_0xc972('0xd')](_0x32cb5b);return chat[_0xc972('0xe')]();})[_0xc972('0xa')](function(){return whatsapp[_0xc972('0xe')]();})['then'](function(){return schedule[_0xc972('0xe')]();})[_0xc972('0xa')](function(){return transcribe[_0xc972('0xe')]();})['then'](function(){return provider[_0xc972('0xe')]();})[_0xc972('0xa')](function(_0x465fae){logger['info'](_0x465fae);return pm2[_0xc972('0xe')](pm2Config);})[_0xc972('0xa')](function(_0x3aa39d){var _0xe69dfe=_0x3aa39d['filter'](function(_0x665f8f){return typeof _0x665f8f[_0xc972('0xf')]===_0xc972('0x10')&&_0x665f8f[_0xc972('0xf')]>=0x0;});if(_0xe69dfe[_0xc972('0x11')]>0x0){throw new Error(_0xe69dfe[_0xc972('0x11')]+_0xc972('0x12')+_[_0xc972('0x13')](_0xe69dfe,function(_0x3a7521){return'\x22'+_0x3a7521[_0xc972('0x14')][_0xc972('0x15')]+'\x22';}));}logger[_0xc972('0xd')](_0xc972('0x16'),_[_0xc972('0x13')](_[_0xc972('0x17')](_0x3aa39d,{'status':_0xc972('0x18')}),'name')[_0xc972('0x19')]());logger[_0xc972('0xd')](_0xc972('0x1a'),_[_0xc972('0x13')](_[_0xc972('0x17')](_0x3aa39d,function(_0x5e1b06){return _0x5e1b06[_0xc972('0x1b')]!==_0xc972('0x18');}),'name')[_0xc972('0x19')]()||_0xc972('0x1c'));console[_0xc972('0x1d')](_0xc972('0x1e'));})[_0xc972('0x1f')](function(_0x1f72e1){console['log'](_0xc972('0x20'),_0x1f72e1);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1f72e1);process[_0xc972('0x21')](0x1);});}main(); \ No newline at end of file +var _0xf88f=['Online\x20apps:','online','name','join','Offline\x20apps:','map','status','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','filter','exitCode','number','length','pm2_env'];(function(_0x1a993,_0x71c9ce){var _0x48fd38=function(_0x454cc6){while(--_0x454cc6){_0x1a993['push'](_0x1a993['shift']());}};_0x48fd38(++_0x71c9ce);}(_0xf88f,0x1bb));var _0xff88=function(_0x5613d8,_0x5988f0){_0x5613d8=_0x5613d8-0x0;var _0x2be9e6=_0xf88f[_0x5613d8];return _0x2be9e6;};'use strict';var _=require(_0xff88('0x0'));var db=require(_0xff88('0x1'))['db'];var seedDb=require(_0xff88('0x2'));var checkLicense=require(_0xff88('0x3'));var rpc=require(_0xff88('0x4'));var config=require(_0xff88('0x5'));var logger=require(_0xff88('0x6'))('app');var pm2=require(_0xff88('0x7'));var pm2Config=require(_0xff88('0x8'));var schedule=require(_0xff88('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xff88('0xa'));var transcribe=require(_0xff88('0xb'));var provider=require(_0xff88('0xc'));function main(){return db[_0xff88('0xd')][_0xff88('0xe')]()[_0xff88('0xf')](function(){if(config['seedDB']){return seedDb[_0xff88('0x10')]();}})[_0xff88('0xf')](function(){return checkLicense[_0xff88('0x10')]();})[_0xff88('0xf')](function(){return rpc[_0xff88('0x11')]();})[_0xff88('0xf')](function(_0x22bca3){logger[_0xff88('0x12')](_0x22bca3);return chat[_0xff88('0x13')]();})[_0xff88('0xf')](function(){return whatsapp[_0xff88('0x13')]();})[_0xff88('0xf')](function(){return schedule[_0xff88('0x13')]();})[_0xff88('0xf')](function(){return transcribe[_0xff88('0x13')]();})['then'](function(){return provider[_0xff88('0x13')]();})[_0xff88('0xf')](function(_0x14b38a){logger['info'](_0x14b38a);return pm2[_0xff88('0x13')](pm2Config);})[_0xff88('0xf')](function(_0x44d5f6){var _0x116712=_0x44d5f6[_0xff88('0x14')](function(_0x3d4569){return typeof _0x3d4569[_0xff88('0x15')]===_0xff88('0x16')&&_0x3d4569['exitCode']>=0x0;});if(_0x116712[_0xff88('0x17')]>0x0){throw new Error(_0x116712[_0xff88('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x116712,function(_0x1181a1){return'\x22'+_0x1181a1[_0xff88('0x18')]['name']+'\x22';}));}logger[_0xff88('0x12')](_0xff88('0x19'),_['map'](_[_0xff88('0x14')](_0x44d5f6,{'status':_0xff88('0x1a')}),_0xff88('0x1b'))[_0xff88('0x1c')]());logger[_0xff88('0x12')](_0xff88('0x1d'),_[_0xff88('0x1e')](_['filter'](_0x44d5f6,function(_0x277fac){return _0x277fac[_0xff88('0x1f')]!==_0xff88('0x1a');}),_0xff88('0x1b'))[_0xff88('0x1c')]()||_0xff88('0x20'));console['log'](_0xff88('0x21'));})[_0xff88('0x22')](function(_0x2b8517){console[_0xff88('0x23')](_0xff88('0x24'),_0x2b8517);logger[_0xff88('0x25')](_0xff88('0x26'),_0x2b8517);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e36bd3e..9f50665 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 _0x008c=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','session','payload','options','promisify','verify','randomBytes','hex','floor','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','userpic','permissions','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','smsAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','unmanaged','json','headers','startsWith','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','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~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x008c,0x188));var _0xc008=function(_0x574159,_0x952110){_0x574159=_0x574159-0x0;var _0x5dd226=_0x008c[_0x574159];return _0x5dd226;};'use strict';var db=require(_0xc008('0x0'))['db'];var config=require(_0xc008('0x1'));var hardwareConf=require(_0xc008('0x2'));var licenseUtil=require(_0xc008('0x3'));var encryptor=require(_0xc008('0x4'));var _=require('lodash');var jwt=require(_0xc008('0x5'));var expressJwt=require(_0xc008('0x6'));var compose=require(_0xc008('0x7'));var basicAuth=require(_0xc008('0x8'));var crypto=require(_0xc008('0x9'));var BPromise=require(_0xc008('0xa'));var util=require(_0xc008('0xb'));var moment=require(_0xc008('0xc'));var validateJwt=expressJwt({'secret':config[_0xc008('0xd')]['session']});var userAttributes=['id',_0xc008('0xe'),'fullname',_0xc008('0xf'),'internal','email',_0xc008('0x10'),_0xc008('0x11'),'md5secret','voicePause','chatPause',_0xc008('0x12'),_0xc008('0x13'),'smsPause',_0xc008('0x14'),_0xc008('0x15'),_0xc008('0x16'),_0xc008('0x17'),_0xc008('0x18'),_0xc008('0x19'),_0xc008('0x1a'),'passwordResetAt','alias',_0xc008('0x1b'),'phoneBarAutoAnswerDelay',_0xc008('0x1c'),_0xc008('0x1d'),_0xc008('0x1e'),_0xc008('0x1f'),_0xc008('0x20'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0xc008('0x21'),_0xc008('0x22'),_0xc008('0x23'),_0xc008('0x24'),'settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0xc008('0x25'),_0xc008('0x26'),'selectRecallMeCampaign',_0xc008('0x27'),'chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer',_0xc008('0x28'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xc008('0x29')];exports[_0xc008('0x2a')]=function(){return this[_0xc008('0x2b')](!![])[_0xc008('0x2c')](function(_0x11cc75,_0x110128,_0x4f43e2){if(_0x11cc75[_0xc008('0x2d')]){_0x4f43e2();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x11cc75[_0xc008('0x2e')]['id']},'attributes':['id',_0xc008('0x2f'),_0xc008('0x30')],'raw':!![]})[_0xc008('0x31')](function(_0x5410f5){if(_0x5410f5&&_0x5410f5['closed']){return _0x110128['status'](_0x5410f5[_0xc008('0x30')]===_0xc008('0x32')?0x195:0x193)[_0xc008('0x33')]({'message':_0x5410f5[_0xc008('0x30')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x4f43e2();}})['catch'](function(_0x4caaf4){_0x4f43e2(_0x4caaf4);});}});};exports[_0xc008('0x2b')]=function isAuthenticated(_0x29ba43){return compose()[_0xc008('0x2c')](function(_0x529961,_0x24c14c,_0x32390d){var _0x209591;if(_0x529961[_0xc008('0x34')]['authorization']){if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],'Basic')){var _0x539766=basicAuth(_0x529961);db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'name':_0x539766[_0xc008('0xf')]}})[_0xc008('0x31')](function(_0x1de04b){if(!_0x1de04b||!_0x1de04b[_0xc008('0x38')](_0x539766[_0xc008('0x39')])){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x3b')});}_0x529961[_0xc008('0x2d')]={'id':_0x1de04b['id']};_0x32390d();})[_0xc008('0x3c')](function(_0x596ee8){_0x32390d(_0x596ee8);});}else if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],_0xc008('0x3d'))){validateJwt(_0x529961,_0x24c14c,_0x32390d);}else{if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}}}else if(_0x529961[_0xc008('0x3f')][_0xc008('0x40')]){try{var _0x7cfbc5={'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};verifyJwt(_0x529961['query'][_0xc008('0x40')],_0x7cfbc5)[_0xc008('0x31')](function(_0x459df4){return db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x459df4[_0xc008('0x42')]}})[_0xc008('0x31')](function(_0x5d0e06){_0x209591=_0x5d0e06;return db[_0xc008('0x43')][_0xc008('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc008('0x45')],'raw':!![]});})[_0xc008('0x31')](function(_0x5e38d5){if(!_0x209591||!_[_0xc008('0x46')](_0x209591[_0xc008('0x47')],_0x459df4[_0xc008('0x48')])){return _0x24c14c['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x209591[_0xc008('0x49')]){return _0x24c14c['status'](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}if(_0x209591[_0xc008('0x4b')]){if(_0x5e38d5[_0xc008('0x45')]>0x0){if(moment(_0x209591[_0xc008('0x4c')])[_0xc008('0x4d')](_0x5e38d5[_0xc008('0x45')],_0xc008('0x4e'))>moment()){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}else{return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}_0x529961['user']={'id':_0x209591['id']};_0x32390d();});})[_0xc008('0x3c')](function(){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});});}catch(_0x49a16d){_0x32390d(_0x49a16d);}}else if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}})[_0xc008('0x2c')](function(_0x2d142d,_0x5706bb,_0x398cdd){if(_0x2d142d[_0xc008('0x2d')]){db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x2d142d[_0xc008('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0xf4cc4b){if(!_0xf4cc4b){return _0x5706bb[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x4f')});}_0x2d142d['user']=_0xf4cc4b;_0x398cdd();})[_0xc008('0x3c')](function(_0xe37446){_0x398cdd(_0xe37446);});}else if(_0x29ba43){_0x398cdd();}else{return _0x5706bb[_0xc008('0x3a')](0x194)['json']({'message':_0xc008('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc008('0x2c')](function(_0x5d3a72,_0x46fa8f,_0x213014){return licenseUtil['getLicense']()[_0xc008('0x31')](function(_0x24ba0f){if(_0x24ba0f[_0xc008('0x51')]){_0x213014();}else{return _0x46fa8f['status'](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x44fc5d){_0x213014(_0x44fc5d);});});};exports[_0xc008('0x53')]=function isWebrtcLicence(){return compose()[_0xc008('0x2c')](function(_0x59ca2b,_0x47cafa,_0x5283a8){return licenseUtil[_0xc008('0x54')]()[_0xc008('0x31')](function(_0x103a83){if(_0x103a83[_0xc008('0x55')]){_0x5283a8();}else{return _0x47cafa[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x572593){_0x5283a8(_0x572593);});});};exports['isMiddleware']=function(_0x516e43,_0x2d5a49,_0x2651cf){_0x516e43[_0xc008('0x56')]=!![];return _0x2651cf();};exports['signToken']=function signToken(_0x28bc33){return signJwt(_0x28bc33);};exports[_0xc008('0x57')]=function(_0x17ab1a,_0x1c2c50){if(!_0x17ab1a[_0xc008('0x2d')]){return _0x1c2c50[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x58')});}var _0x3fd7d9={'payload':{'id':_0x17ab1a[_0xc008('0x2d')]['id'],'role':_0x17ab1a['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3fd7d9)[_0xc008('0x31')](function(_0x51cb14){_0x1c2c50[_0xc008('0x59')](_0xc008('0x5a'),_0x51cb14);_0x1c2c50[_0xc008('0x5b')]('/dashboards/general');})[_0xc008('0x3c')](function(_0x32b435){return _0x1c2c50[_0xc008('0x3a')](0x1f4)[_0xc008('0x5c')](_0x32b435);});};exports[_0xc008('0x5d')]=function(_0x51105f){if(_[_0xc008('0x5e')](_0x51105f[_0xc008('0x47')])||_['isNil'](_0x51105f[_0xc008('0x5f')])){return null;}else{return createJwt(_0x51105f);}};exports[_0xc008('0x60')]=function(_0x5b5fbf){_0x5b5fbf['apiKeyNonce']=generateNonce();_0x5b5fbf[_0xc008('0x5f')]=generateIssuedAt();return createJwt(_0x5b5fbf);};exports[_0xc008('0x61')]=function(_0x20947b,_0x30d0aa){var _0x14b6a0=_0x20947b['query']['apikey'];if(_0x14b6a0){var _0x34b72a={'nonce':_0x30d0aa['apiKeyNonce'],'iat':_0x30d0aa[_0xc008('0x5f')],'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};return verifyJwt(_0x14b6a0,_0x34b72a)[_0xc008('0x31')](function(){return generateApiKey(_0x30d0aa);});}else{throw{'message':_0xc008('0x62')};}};exports[_0xc008('0x63')]=function(_0x49d8b0){var _0x2ea742=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2ea742[_0xc008('0x64')](_0x49d8b0))throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0xc008('0x67'));return;};exports['validatePasswordHistory']=function(_0x41fae3,_0x4fdab4,_0x535e6e){var _0x5dbfca=encryptor[_0xc008('0x68')](_0x4fdab4)[_0xc008('0x69')](',');for(var _0x5dfb69=0x0;_0x5dfb69<_0x535e6e;_0x5dfb69++){if(!_0x5dbfca[_0x5dfb69])break;if(_0x41fae3['toLowerCase']()===_0x5dbfca[_0x5dfb69][_0xc008('0x6a')]()){var _0x2d8361=util[_0xc008('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x535e6e);if(_0x535e6e===0x1){_0x2d8361=_0xc008('0x6c');}throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0x2d8361);}}return;};exports[_0xc008('0x6d')]=function(_0x5baff1,_0x4022dd){var _0x4eaa6d=_0x4022dd?encryptor[_0xc008('0x68')](_0x4022dd)[_0xc008('0x69')](','):[];if(_0x4eaa6d[_0xc008('0x6e')]===0x5){_0x4eaa6d[_0xc008('0x6f')](-0x1,0x1);}_0x4eaa6d[_0xc008('0x70')](_0x5baff1);return encryptor[_0xc008('0x71')](_0x4eaa6d['join'](','));};function signJwt(_0x375e71){var _0x570001=BPromise['promisify'](jwt[_0xc008('0x72')],{'context':jwt});var _0x30aa1e=_0x375e71['secret']||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x3e373e,_0x4517c0){_0x570001(_0x375e71[_0xc008('0x74')],_0x30aa1e,_0x375e71[_0xc008('0x75')])[_0xc008('0x31')](function(_0x57ce9a){_0x3e373e(_0x57ce9a);})[_0xc008('0x3c')](function(_0x462e1e){_0x4517c0(_0x462e1e);});});}function verifyJwt(_0x3bfb15,_0x2a60e6,_0xb3ca0f){var _0x167425=BPromise[_0xc008('0x76')](jwt[_0xc008('0x77')],{'context':jwt});var _0xbc430a=_0xb3ca0f||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x2b5eb6,_0x131b81){_0x167425(_0x3bfb15,_0xbc430a,_0x2a60e6)[_0xc008('0x31')](function(_0x4e0251){_0x2b5eb6(_0x4e0251);})[_0xc008('0x3c')](function(_0x2e5467){_0x131b81(_0x2e5467);});});}function generateNonce(){return crypto[_0xc008('0x78')](0x10)['toString'](_0xc008('0x79'));}function generateIssuedAt(){return Math[_0xc008('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x1a03fd){var _0x2a4c2b={'payload':{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd[_0xc008('0x47')]},'options':{'algorithm':_0xc008('0x7b'),'subject':_0x1a03fd['id'][_0xc008('0x7c')](),'issuer':hardwareConf[_0xc008('0x41')](),'audience':hardwareConf[_0xc008('0x41')]()}};return signJwt(_0x2a4c2b)[_0xc008('0x31')](function(_0x1b059b){return{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd['apiKeyNonce'],'token':_0x1b059b};});} \ No newline at end of file +var _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x46f1b5,_0x3f96a4){var _0x505c69=function(_0x2ed41c){while(--_0x2ed41c){_0x46f1b5['push'](_0x46f1b5['shift']());}};_0x505c69(++_0x3f96a4);}(_0xedd9,0xfc));var _0x9edd=function(_0x27d1e3,_0x3169b2){_0x27d1e3=_0x27d1e3-0x0;var _0x58049c=_0xedd9[_0x27d1e3];return _0x58049c;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index da753d8..009b22c 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(_0x33c9f3,_0x3848a9){var _0x556cbf=function(_0x406eab){while(--_0x406eab){_0x33c9f3['push'](_0x33c9f3['shift']());}};_0x556cbf(++_0x3848a9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'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 _0x5f2f=['rows','catch','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','fields','user','clause','tags','skip','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts'];(function(_0xebbccf,_0x13d1ee){var _0x5dfbdf=function(_0x568809){while(--_0x568809){_0xebbccf['push'](_0xebbccf['shift']());}};_0x5dfbdf(++_0x13d1ee);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20ea59,_0x13560d){_0x20ea59=_0x20ea59-0x0;var _0x155a4f=_0x5f2f[_0x20ea59];return _0x155a4f;};'use strict';var _=require(_0xf5f2('0x0'));var sqlUtils=require(_0xf5f2('0x1'));var db=require(_0xf5f2('0x2'))['db'];exports[_0xf5f2('0x3')]=function(_0x1172dd,_0x174bc7,_0x3c72ee,_0x107cf){var _0x501fbd={'count':0x0,'rows':[]};var _0x4854b6=sqlUtils[_0xf5f2('0x4')](_0x174bc7,_0x1172dd);if(_0x4854b6){return Promise[_0xf5f2('0x5')](_0x501fbd);}var _0xad7f65=sqlUtils[_0xf5f2('0x6')]();var _0x3133bc={};var _0x473100=![];var _0x5907aa=![];return Promise[_0xf5f2('0x5')]()[_0xf5f2('0x7')](function(){if(_0x1172dd[_0xf5f2('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1172dd[_0xf5f2('0x8')],_0x107cf);}else{return sqlUtils[_0xf5f2('0x9')](_0x1172dd,_0x107cf);}})[_0xf5f2('0x7')](function(_0x4e0e6b){_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['default']);_0xad7f65['where'](_0x4e0e6b[_0xf5f2('0xb')]);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['filter']);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xd')]);_0x3133bc=_0x4e0e6b[_0xf5f2('0xe')];_0x5907aa=_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xf')];return sqlUtils['checkListsRestrictions'](_0x174bc7,_0x1172dd,_0x5907aa);})[_0xf5f2('0x7')](function(_0xea612c){_0xad7f65[_0xf5f2('0xa')](_0xea612c);var _0x1c1a5c=_0x1172dd[_0xf5f2('0x8')]?_0x3133bc['ids']:_0x1172dd[_0xf5f2('0x10')];_0x473100=_0x1c1a5c?!![]:![];return sqlUtils[_0xf5f2('0x11')](_0xad7f65,_0x1c1a5c);})[_0xf5f2('0x7')](function(_0x1b6dd2){_0x501fbd[_0xf5f2('0x12')]=_0x1b6dd2;if(_0x501fbd[_0xf5f2('0x12')]===0x0){return;}return sqlUtils[_0xf5f2('0x13')](_0xad7f65,_0x1172dd[_0xf5f2('0xb')],_0x3c72ee,_0x473100,_0x3133bc[_0xf5f2('0xd')],_0x5907aa);})[_0xf5f2('0x7')](function(_0x20fccd){if(!_0x20fccd){return[];}return sqlUtils[_0xf5f2('0x14')](_0x20fccd,_0x1172dd,_0x3c72ee);})[_0xf5f2('0x7')](function(_0x3ee69){_0x501fbd[_0xf5f2('0x15')]=_0x3ee69;return _0x501fbd;})[_0xf5f2('0x16')](function(_0x1bf655){throw _0x1bf655;});};exports['describe']=function(){var _0x34706d={};var _0x47101e=[];return db['CmContact']['describe']()[_0xf5f2('0x7')](function(_0x388e6c){_0x34706d=_0x388e6c;var _0x4ae323=Object[_0xf5f2('0x17')](_0x34706d)[_0xf5f2('0x18')](function(_0x39e44a){return _[_0xf5f2('0x19')](_0x39e44a,_0xf5f2('0x1a'))?_0x39e44a:undefined;});var _0x4c691a=_0x4ae323[_0xf5f2('0x1b')](function(_0x4669a6){return db[_0xf5f2('0x1c')][_0xf5f2('0x1d')]({'where':{'id':_0x4669a6[_0xf5f2('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x4c691a);})['then'](function(_0x5f1124){for(var _0x3f79d5=0x0;_0x3f79d5<_0x5f1124[_0xf5f2('0x1f')];_0x3f79d5++){if(_0x5f1124[_0x3f79d5]){var _0x1a5bb3=_0xf5f2('0x1a')+_0x5f1124[_0x3f79d5]['id'];_0x34706d[_0x1a5bb3][_0xf5f2('0x20')]=_0x5f1124[_0x3f79d5][_0xf5f2('0x21')];}}_0x47101e=_[_0xf5f2('0x1b')](Object[_0xf5f2('0x17')](_0x34706d),function(_0x4ab014){return{'name':_0x4ab014,'type':_0x34706d[_0x4ab014][_0xf5f2('0x21')]};});return _0x47101e;})[_0xf5f2('0x16')](function(_0x375ca8){throw _0x375ca8;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 79d8306..53c23ed 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 _0x2ba8=['CmContact','query','toString','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','sequelize','exports','lodash','../parsers/advancedSearch','../../mysqldb','agent','search','ListId','autocomplete','true','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','mobile','email','CompanyId','createdAt','deletedAt','TagIds','push','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','default','value','start','end','map','tags','clause','and','user','uc.UserId\x20=\x20?','skip','some','forEach','c.ListId\x20IN\x20?','concat','Contact','\x20=\x20?','resolve','then','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','Tag','findAll','color','keyBy','Sequelize','QueryTypes','SELECT'];(function(_0x58f1ed,_0x9666bb){var _0x65bc52=function(_0x229464){while(--_0x229464){_0x58f1ed['push'](_0x58f1ed['shift']());}};_0x65bc52(++_0x9666bb);}(_0x2ba8,0x14d));var _0x82ba=function(_0xb1b667,_0x416ddf){_0xb1b667=_0xb1b667-0x0;var _0xad0c7b=_0x2ba8[_0xb1b667];return _0xad0c7b;};'use strict';var _=require(_0x82ba('0x0'));var squel=require('squel');var as=require(_0x82ba('0x1'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x82ba('0x2'))['db'];function skipContactsQuery(_0x55bdf4,_0x2150df){var _0x4faef7=![];if(_0x55bdf4['role']===_0x82ba('0x3')&&!_0x2150df[_0x82ba('0x4')]&&!_0x2150df[_0x82ba('0x5')]&&_0x2150df[_0x82ba('0x6')]!==_0x82ba('0x7')){_0x4faef7=!![];}return _0x4faef7;}function getContactsSubquery(){return squel['select']()[_0x82ba('0x8')](_0x82ba('0x9'),'c')[_0x82ba('0xa')](_0x82ba('0xb'));}function applyJoinClauses(_0x5a711b,_0x25b965){var _0x2fa1ba=_0x25b965?'c':_0x82ba('0xc');_0x5a711b[_0x82ba('0xd')](_0x82ba('0xe'),'uc',_0x82ba('0xf')+_0x2fa1ba+'.id')[_0x82ba('0xd')](_0x82ba('0x10'),'ct',_0x82ba('0x11')+_0x2fa1ba+_0x82ba('0x12'))[_0x82ba('0xd')](_0x82ba('0x13'),'t',_0x82ba('0x14'));return _0x5a711b;}function addFieldsToQuery(_0x71de03,_0x1b2984,_0x36eddd,_0x4076f7,_0x4f1de9){var _0x3cb1e9=_0x4f1de9?'c':_0x82ba('0xc');if(!_0x1b2984){_0x1b2984=['id',_0x82ba('0x15'),_0x82ba('0x16'),'phone',_0x82ba('0x17'),'fax',_0x82ba('0x18'),'ListId',_0x82ba('0x19'),_0x82ba('0x1a'),'updatedAt',_0x82ba('0x1b'),_0x82ba('0x1c')];}else if(!_0x1b2984['includes']('id')){_0x1b2984[_0x82ba('0x1d')]('id');}var _0x395aba=_0x36eddd&&_0x4f1de9||!_0x36eddd&&!_0x4f1de9;if(_0x4076f7){_0x395aba=_0x4076f7&&_0x4f1de9||!_0x4076f7&&!_0x4f1de9;}_0x1b2984['forEach'](function(_0x1deee3){if(_0x1deee3===_0x82ba('0x1c')){if(_0x395aba){_0x71de03['field'](_0x82ba('0x1e'),_0x1deee3);}else if(_0x36eddd||_0x4076f7){_0x71de03[_0x82ba('0x1f')](_0x3cb1e9+'.'+_0x1deee3);}}else{_0x71de03[_0x82ba('0x1f')](_0x3cb1e9+'.'+_0x1deee3);}});return _0x71de03;}function getSqlClauses(){var _0x32702b={'default':squel['expr'](),'fields':squel[_0x82ba('0x20')](),'filter':squel[_0x82ba('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x82ba('0x20')](),'skip':![]}};return _0x32702b;}function parseTagParameter(_0x307542){var _0x30f25c=squel[_0x82ba('0x20')]();if(_0x307542){var _0x12cb89=utils[_0x82ba('0x21')](_0x307542);_0x12cb89['forEach'](function(_0x49a3ec){_0x30f25c['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49a3ec+',%');});}return _0x30f25c;}function parseSearchFilter(_0x59f3f8){var _0x4f3db8=squel[_0x82ba('0x20')]();if(_0x59f3f8){var _0x519cd4=_0x59f3f8[_0x82ba('0x22')]('\x5c','\x5c\x5c')[_0x82ba('0x22')](/'/g,'\x27\x27');if(_0x519cd4[_0x82ba('0x23')]('\x20')[_0x82ba('0x24')]>0x1){_0x4f3db8['or'](_0x82ba('0x25'),qs['getFullTextValue'](_0x519cd4),null);}else{if(qs[_0x82ba('0x26')](_0x519cd4)){_0x4f3db8['or'](_0x82ba('0x27'),_0x519cd4+'%');_0x4f3db8['or'](_0x82ba('0x28'),_0x519cd4+'%');_0x4f3db8['or'](_0x82ba('0x29'),_0x519cd4+'%');_0x4f3db8['or']('c.fax\x20LIKE\x20?',_0x519cd4+'%');}else if(qs[_0x82ba('0x2a')](_0x519cd4)){_0x4f3db8['or']('c.email\x20LIKE\x20?',_0x519cd4+'%');}else{_0x4f3db8['or'](_0x82ba('0x2b'),'%'+_0x519cd4+'%');_0x4f3db8['or'](_0x82ba('0x2c'),'%'+_0x519cd4+'%');_0x4f3db8['or'](_0x82ba('0x2d'),'%'+_0x519cd4+'%');}}}return _0x4f3db8;}function parseAdvancedSearchFilter(_0xb6e05,_0x17cd1e){var _0x66321a=getSqlClauses();var _0x5bde71=as[_0x82ba('0x2e')](_0xb6e05);var _0x18252e=_0x5bde71[_0x82ba('0x2f')];for(var _0x348deb=0x0;_0x348deb<_0x5bde71['conditions'][_0x82ba('0x24')];_0x348deb++){var _0x3f6e41=_0x5bde71[_0x82ba('0x30')][_0x348deb];var _0x29df75='c';var _0x455adb=_[_0x82ba('0x31')](_0x17cd1e,[_0x82ba('0x32'),_0x3f6e41[_0x82ba('0x1f')]]);if(_0x455adb){if(_0x3f6e41[_0x82ba('0x1f')]===_0x82ba('0x33')||_0x455adb[_0x82ba('0x34')]===_0x82ba('0x35')){_0x3f6e41['castTo']=_0x82ba('0x36');}var _0xcb559=as[_0x82ba('0x37')](_0x29df75,_0x455adb[_0x82ba('0x38')],_0x3f6e41);_0x66321a[_0x82ba('0x39')][_0x18252e](_0xcb559['text'],_0xcb559[_0x82ba('0x3a')][_0x82ba('0x3b')],_0xcb559['value'][_0x82ba('0x3c')]);}else{if(_0x3f6e41[_0x82ba('0x1f')]==='Tag'){var _0x209c5b=_0x3f6e41['value'][_0x82ba('0x23')](',')[_0x82ba('0x3d')](function(_0x42cc67){return Number(_0x42cc67);});var _0x3b2c5f=parseTagParameter(_0x209c5b);_0x66321a[_0x82ba('0x3e')][_0x82ba('0x3f')][_0x82ba('0x40')](_0x3b2c5f);_0x66321a[_0x82ba('0x3e')]['ids']=_0x209c5b;}else if(_0x3f6e41[_0x82ba('0x1f')]==='User'){_0x66321a[_0x82ba('0x41')][_0x82ba('0x3f')][_0x82ba('0x40')](_0x82ba('0x42'),_0x3f6e41['value']);_0x66321a[_0x82ba('0x41')][_0x82ba('0x43')]=!![];}}}return _0x66321a;}function parseModelFields(_0x3f7b7e,_0x168cfc){var _0x16d06b=squel[_0x82ba('0x20')]();var _0x2d1790=_(_0x3f7b7e)['keys']()['map'](function(_0x28f350){return _[_0x82ba('0x44')](_0x168cfc,['name',_0x28f350])?_0x28f350:undefined;})['compact']()['value']();if(_0x3f7b7e['Contact']){_0x2d1790[_0x82ba('0x1d')]('Contact');}if(_0x2d1790[_0x82ba('0x24')]>0x0){_0x2d1790[_0x82ba('0x45')](function(_0xf88ba5){if(_0xf88ba5===_0x82ba('0x5')){_0x16d06b[_0x82ba('0x40')](_0x82ba('0x46'),[][_0x82ba('0x47')](_0x3f7b7e[_0xf88ba5]));}else if(_0xf88ba5===_0x82ba('0x48')){var _0x55e7b5='%'+_0x3f7b7e[_0xf88ba5]+'%';_0x16d06b[_0x82ba('0x40')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x55e7b5);}else{_0x16d06b[_0x82ba('0x40')]('c.'+_0xf88ba5+_0x82ba('0x49'),_0x3f7b7e[_0xf88ba5]);}});}return _0x16d06b;}function parseQueryParameters(_0xbe58da,_0x40bfcd){var _0x6b00e8=getSqlClauses();return Promise[_0x82ba('0x4a')]()[_0x82ba('0x4b')](function(){return parseModelFields(_0xbe58da,_0x40bfcd);})[_0x82ba('0x4b')](function(_0x423104){_0x6b00e8['fields'][_0x82ba('0x40')](_0x423104);return parseTagParameter(_0xbe58da[_0x82ba('0x4c')]);})['then'](function(_0x415b49){_0x6b00e8['tags'][_0x82ba('0x3f')][_0x82ba('0x40')](_0x415b49);return parseSearchFilter(_0xbe58da[_0x82ba('0x4d')]);})[_0x82ba('0x4b')](function(_0x23c1cd){_0x6b00e8[_0x82ba('0x4d')]=_0x23c1cd;return _0x6b00e8;});}function checkListsRestrictions(_0x280bb0,_0x29fc61,_0x1837e3){var _0x2de94a=squel[_0x82ba('0x20')]();return Promise['resolve']()[_0x82ba('0x4b')](function(){if(_0x29fc61[_0x82ba('0x4')]&&_0x280bb0[_0x82ba('0x4e')]===_0x82ba('0x3')&&!_0x1837e3){return _0x280bb0[_0x82ba('0x4f')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x25bc75){if(_0x25bc75){if(_0x25bc75[_0x82ba('0x24')]===0x0){_0x2de94a[_0x82ba('0x40')](_0x82ba('0x50'));}else{_0x2de94a['and'](_0x82ba('0x46'),_[_0x82ba('0x3d')](_0x25bc75,'id'));}}})[_0x82ba('0x4b')](function(){return _0x2de94a;});}function buildContactsQuery(_0x3512bb,_0x2e98e7,_0x194443,_0x987271,_0x4a8e01,_0x2f80ef){if(_0x2e98e7){_0x2e98e7=_0x194443[_0x82ba('0x51')];}_0x3512bb=addFieldsToQuery(_0x3512bb,_0x2e98e7,_0x987271,_0x2f80ef,!![]);var _0x5e2c0c=squel[_0x82ba('0x52')]();_0x5e2c0c=addFieldsToQuery(_0x5e2c0c,_0x2e98e7,_0x987271,_0x2f80ef,![]);if(_0x987271||_0x2f80ef){_0x3512bb=applyJoinClauses(_0x3512bb,!![]);_0x3512bb[_0x82ba('0x53')](_0x82ba('0x54'));if(_0x194443['limit']){_0x5e2c0c[_0x82ba('0x55')](_0x194443[_0x82ba('0x55')]);}if(_0x194443[_0x82ba('0x56')]){_0x5e2c0c['offset'](_0x194443[_0x82ba('0x56')]);}}else{_0x5e2c0c=applyJoinClauses(_0x5e2c0c,![]);_0x5e2c0c[_0x82ba('0x53')](_0x82ba('0x57'));if(_0x194443[_0x82ba('0x55')]){_0x3512bb[_0x82ba('0x55')](_0x194443['limit']);}if(_0x194443[_0x82ba('0x56')]){_0x3512bb[_0x82ba('0x56')](_0x194443[_0x82ba('0x56')]);}}_0x5e2c0c[_0x82ba('0x58')](_0x4a8e01);if(_0x194443[_0x82ba('0x59')]){_0x194443['order'][_0x82ba('0x45')](function(_0x49e3a2){_0x3512bb[_0x82ba('0x59')]('c.'+_0x49e3a2[0x0],_0x49e3a2[0x1]===_0x82ba('0x5a')?![]:!![]);_0x5e2c0c['order'](_0x82ba('0x5b')+_0x49e3a2[0x0],_0x49e3a2[0x1]===_0x82ba('0x5a')?![]:!![]);});}_0x5e2c0c[_0x82ba('0x8')](_0x3512bb,'subqry');return _0x5e2c0c;}function getFilteredContacts(_0x220953){var _0x249190=[];return db[_0x82ba('0x5c')][_0x82ba('0x5d')]({'attributes':['id',_0x82ba('0x32'),_0x82ba('0x5e')],'raw':!![]})[_0x82ba('0x4b')](function(_0x56b666){_0x249190=_[_0x82ba('0x5f')](_0x56b666,'id');var _0x579792={'type':db[_0x82ba('0x60')][_0x82ba('0x61')][_0x82ba('0x62')],'model':db[_0x82ba('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x82ba('0x64')](_0x220953[_0x82ba('0x65')](),_0x579792);})[_0x82ba('0x4b')](function(_0xb2d33c){_0xb2d33c[_0x82ba('0x45')](function(_0x3a05c7){if(_0x3a05c7[_0x82ba('0x1c')]){_0x3a05c7['Tags']=[];_0x3a05c7['TagIds'][_0x82ba('0x23')](',')[_0x82ba('0x45')](function(_0x2aea58){_0x3a05c7[_0x82ba('0x66')][_0x82ba('0x1d')](_0x249190[_0x2aea58]);});}delete _0x3a05c7[_0x82ba('0x1c')];});return _0xb2d33c;});}function countFilteredContacts(_0x3d8015,_0x1cd46c){var _0xee6135=_0x3d8015['clone']();_0xee6135[_0x82ba('0x1f')](_0x82ba('0x67'));_0xee6135=applyJoinClauses(_0xee6135,!![]);_0x3d8015['group'](_0x82ba('0x54'));var _0x1acbad=utils[_0x82ba('0x21')](_0x1cd46c);if(!_[_0x82ba('0x68')](_0x1acbad)){_0xee6135['where'](_0x82ba('0x69'),_0x1acbad);}var _0x4d7cb2={'type':db[_0x82ba('0x60')][_0x82ba('0x61')][_0x82ba('0x62')],'raw':!![]};return db[_0x82ba('0x6a')]['query'](_0xee6135[_0x82ba('0x65')](),_0x4d7cb2)[_0x82ba('0x4b')](function(_0x43e8a5){return _0x43e8a5[0x0][_0x82ba('0x67')];});}module[_0x82ba('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xfe57=['c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','fieldType','datetime','castTo','DATE','buildExpression','default','text','value','start','Tag','map','tags','clause','and','uc.UserId\x20=\x20?','user','skip','keys','some','compact','Contact','push','forEach','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','then','fields','tag','filter','resolve','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','order','DESC','subqry.','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','exports','lodash','squel','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','left_join','t.id\x20=\x20ct.TagId','lastName','mobile','fax','email','updatedAt','TagIds','includes','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?'];(function(_0x169005,_0x4467a4){var _0x363f9f=function(_0x1ae696){while(--_0x1ae696){_0x169005['push'](_0x169005['shift']());}};_0x363f9f(++_0x4467a4);}(_0xfe57,0x171));var _0x7fe5=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0xfe57[_0x548d7d];return _0xb1c878;};'use strict';var _=require(_0x7fe5('0x0'));var squel=require(_0x7fe5('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x7fe5('0x2'));var utils=require(_0x7fe5('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x1a36b3,_0xb43b40){var _0x583c64=![];if(_0x1a36b3[_0x7fe5('0x4')]===_0x7fe5('0x5')&&!_0xb43b40[_0x7fe5('0x6')]&&!_0xb43b40[_0x7fe5('0x7')]&&_0xb43b40[_0x7fe5('0x8')]!=='true'){_0x583c64=!![];}return _0x583c64;}function getContactsSubquery(){return squel['select']()[_0x7fe5('0x9')](_0x7fe5('0xa'),'c')[_0x7fe5('0xb')](_0x7fe5('0xc'));}function applyJoinClauses(_0x4450ba,_0x4ce60b){var _0x24b89a=_0x4ce60b?'c':_0x7fe5('0xd');_0x4450ba['left_join'](_0x7fe5('0xe'),'uc',_0x7fe5('0xf')+_0x24b89a+_0x7fe5('0x10'))['left_join'](_0x7fe5('0x11'),'ct',_0x7fe5('0x12')+_0x24b89a+_0x7fe5('0x10'))[_0x7fe5('0x13')]('tools_tags','t',_0x7fe5('0x14'));return _0x4450ba;}function addFieldsToQuery(_0xac1c43,_0x38fd48,_0x3264a7,_0x51f9ba,_0x1e8852){var _0x4fa449=_0x1e8852?'c':_0x7fe5('0xd');if(!_0x38fd48){_0x38fd48=['id','firstName',_0x7fe5('0x15'),'phone',_0x7fe5('0x16'),_0x7fe5('0x17'),_0x7fe5('0x18'),_0x7fe5('0x7'),'CompanyId','createdAt',_0x7fe5('0x19'),'deletedAt',_0x7fe5('0x1a')];}else if(!_0x38fd48[_0x7fe5('0x1b')]('id')){_0x38fd48['push']('id');}var _0x16155c=_0x3264a7&&_0x1e8852||!_0x3264a7&&!_0x1e8852;if(_0x51f9ba){_0x16155c=_0x51f9ba&&_0x1e8852||!_0x51f9ba&&!_0x1e8852;}_0x38fd48['forEach'](function(_0x455d33){if(_0x455d33==='TagIds'){if(_0x16155c){_0xac1c43['field'](_0x7fe5('0x1c'),_0x455d33);}else if(_0x3264a7||_0x51f9ba){_0xac1c43['field'](_0x4fa449+'.'+_0x455d33);}}else{_0xac1c43[_0x7fe5('0x1d')](_0x4fa449+'.'+_0x455d33);}});return _0xac1c43;}function getSqlClauses(){var _0x27b4f9={'default':squel[_0x7fe5('0x1e')](),'fields':squel[_0x7fe5('0x1e')](),'filter':squel[_0x7fe5('0x1e')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x7fe5('0x1e')](),'skip':![]}};return _0x27b4f9;}function parseTagParameter(_0x1b9195){var _0xf40807=squel[_0x7fe5('0x1e')]();if(_0x1b9195){var _0x5447c0=utils['getSelectedTags'](_0x1b9195);_0x5447c0['forEach'](function(_0x558914){_0xf40807['or'](_0x7fe5('0x1f'),'%,'+_0x558914+',%');});}return _0xf40807;}function parseSearchFilter(_0x25c036){var _0x52a79a=squel[_0x7fe5('0x1e')]();if(_0x25c036){var _0x1297c8=_0x25c036[_0x7fe5('0x20')]('\x5c','\x5c\x5c')[_0x7fe5('0x20')](/'/g,'\x27\x27');if(_0x1297c8['split']('\x20')[_0x7fe5('0x21')]>0x1){_0x52a79a['or'](_0x7fe5('0x22'),qs[_0x7fe5('0x23')](_0x1297c8),null);}else{if(qs[_0x7fe5('0x24')](_0x1297c8)){_0x52a79a['or'](_0x7fe5('0x25'),_0x1297c8+'%');_0x52a79a['or']('c.phone\x20LIKE\x20?',_0x1297c8+'%');_0x52a79a['or'](_0x7fe5('0x26'),_0x1297c8+'%');_0x52a79a['or'](_0x7fe5('0x27'),_0x1297c8+'%');}else if(qs[_0x7fe5('0x28')](_0x1297c8)){_0x52a79a['or']('c.email\x20LIKE\x20?',_0x1297c8+'%');}else{_0x52a79a['or']('c.firstName\x20LIKE\x20?','%'+_0x1297c8+'%');_0x52a79a['or'](_0x7fe5('0x29'),'%'+_0x1297c8+'%');_0x52a79a['or'](_0x7fe5('0x2a'),'%'+_0x1297c8+'%');}}}return _0x52a79a;}function parseAdvancedSearchFilter(_0x46817c,_0x3f4f5a){var _0x472a20=getSqlClauses();var _0x4c96ec=as[_0x7fe5('0x2b')](_0x46817c);var _0x3c380d=_0x4c96ec[_0x7fe5('0x2c')];for(var _0x491483=0x0;_0x491483<_0x4c96ec[_0x7fe5('0x2d')][_0x7fe5('0x21')];_0x491483++){var _0x219d75=_0x4c96ec[_0x7fe5('0x2d')][_0x491483];var _0x23d772='c';var _0x22a7c6=_[_0x7fe5('0x2e')](_0x3f4f5a,[_0x7fe5('0x2f'),_0x219d75[_0x7fe5('0x1d')]]);if(_0x22a7c6){if(_0x219d75['field']==='dateOfBirth'||_0x22a7c6[_0x7fe5('0x30')]===_0x7fe5('0x31')){_0x219d75[_0x7fe5('0x32')]=_0x7fe5('0x33');}var _0x53dd3c=as[_0x7fe5('0x34')](_0x23d772,_0x22a7c6['type'],_0x219d75);_0x472a20[_0x7fe5('0x35')][_0x3c380d](_0x53dd3c[_0x7fe5('0x36')],_0x53dd3c[_0x7fe5('0x37')][_0x7fe5('0x38')],_0x53dd3c[_0x7fe5('0x37')]['end']);}else{if(_0x219d75['field']===_0x7fe5('0x39')){var _0x3616d8=_0x219d75['value']['split'](',')[_0x7fe5('0x3a')](function(_0x32c1ef){return Number(_0x32c1ef);});var _0x40223e=parseTagParameter(_0x3616d8);_0x472a20[_0x7fe5('0x3b')][_0x7fe5('0x3c')][_0x7fe5('0x3d')](_0x40223e);_0x472a20[_0x7fe5('0x3b')]['ids']=_0x3616d8;}else if(_0x219d75[_0x7fe5('0x1d')]==='User'){_0x472a20['user'][_0x7fe5('0x3c')][_0x7fe5('0x3d')](_0x7fe5('0x3e'),_0x219d75[_0x7fe5('0x37')]);_0x472a20[_0x7fe5('0x3f')][_0x7fe5('0x40')]=!![];}}}return _0x472a20;}function parseModelFields(_0x240736,_0x298de9){var _0x2a2943=squel[_0x7fe5('0x1e')]();var _0x4f09bd=_(_0x240736)[_0x7fe5('0x41')]()[_0x7fe5('0x3a')](function(_0x563474){return _[_0x7fe5('0x42')](_0x298de9,[_0x7fe5('0x2f'),_0x563474])?_0x563474:undefined;})[_0x7fe5('0x43')]()[_0x7fe5('0x37')]();if(_0x240736[_0x7fe5('0x44')]){_0x4f09bd[_0x7fe5('0x45')]('Contact');}if(_0x4f09bd[_0x7fe5('0x21')]>0x0){_0x4f09bd[_0x7fe5('0x46')](function(_0x18a631){if(_0x18a631==='ListId'){_0x2a2943[_0x7fe5('0x3d')]('c.ListId\x20IN\x20?',[]['concat'](_0x240736[_0x18a631]));}else if(_0x18a631===_0x7fe5('0x44')){var _0xef0c13='%'+_0x240736[_0x18a631]+'%';_0x2a2943[_0x7fe5('0x3d')](_0x7fe5('0x47'),_0xef0c13);}else{_0x2a2943[_0x7fe5('0x3d')]('c.'+_0x18a631+'\x20=\x20?',_0x240736[_0x18a631]);}});}return _0x2a2943;}function parseQueryParameters(_0x4043a6,_0x138d5c){var _0x58b6e9=getSqlClauses();return Promise['resolve']()[_0x7fe5('0x48')](function(){return parseModelFields(_0x4043a6,_0x138d5c);})['then'](function(_0x3b24d6){_0x58b6e9[_0x7fe5('0x49')]['and'](_0x3b24d6);return parseTagParameter(_0x4043a6[_0x7fe5('0x4a')]);})['then'](function(_0x180671){_0x58b6e9[_0x7fe5('0x3b')]['clause'][_0x7fe5('0x3d')](_0x180671);return parseSearchFilter(_0x4043a6['filter']);})[_0x7fe5('0x48')](function(_0x21b310){_0x58b6e9[_0x7fe5('0x4b')]=_0x21b310;return _0x58b6e9;});}function checkListsRestrictions(_0x1a5347,_0x5691c0,_0x4904ea){var _0x26ea98=squel[_0x7fe5('0x1e')]();return Promise[_0x7fe5('0x4c')]()[_0x7fe5('0x48')](function(){if(_0x5691c0[_0x7fe5('0x6')]&&_0x1a5347['role']===_0x7fe5('0x5')&&!_0x4904ea){return _0x1a5347['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x34d954){if(_0x34d954){if(_0x34d954[_0x7fe5('0x21')]===0x0){_0x26ea98[_0x7fe5('0x3d')](_0x7fe5('0x4d'));}else{_0x26ea98[_0x7fe5('0x3d')](_0x7fe5('0x4e'),_['map'](_0x34d954,'id'));}}})[_0x7fe5('0x48')](function(){return _0x26ea98;});}function buildContactsQuery(_0x18e238,_0xe1974c,_0xe2a0d8,_0x4f1c2f,_0x2e8495,_0x17a514){if(_0xe1974c){_0xe1974c=_0xe2a0d8[_0x7fe5('0x4f')];}_0x18e238=addFieldsToQuery(_0x18e238,_0xe1974c,_0x4f1c2f,_0x17a514,!![]);var _0x3a3e16=squel['select']();_0x3a3e16=addFieldsToQuery(_0x3a3e16,_0xe1974c,_0x4f1c2f,_0x17a514,![]);if(_0x4f1c2f||_0x17a514){_0x18e238=applyJoinClauses(_0x18e238,!![]);_0x18e238[_0x7fe5('0x50')](_0x7fe5('0x51'));if(_0xe2a0d8[_0x7fe5('0x52')]){_0x3a3e16[_0x7fe5('0x52')](_0xe2a0d8[_0x7fe5('0x52')]);}if(_0xe2a0d8[_0x7fe5('0x53')]){_0x3a3e16[_0x7fe5('0x53')](_0xe2a0d8[_0x7fe5('0x53')]);}}else{_0x3a3e16=applyJoinClauses(_0x3a3e16,![]);_0x3a3e16[_0x7fe5('0x50')](_0x7fe5('0x54'));if(_0xe2a0d8[_0x7fe5('0x52')]){_0x18e238[_0x7fe5('0x52')](_0xe2a0d8['limit']);}if(_0xe2a0d8['offset']){_0x18e238[_0x7fe5('0x53')](_0xe2a0d8[_0x7fe5('0x53')]);}}_0x3a3e16['having'](_0x2e8495);if(_0xe2a0d8['order']){_0xe2a0d8[_0x7fe5('0x55')][_0x7fe5('0x46')](function(_0x488006){_0x18e238[_0x7fe5('0x55')]('c.'+_0x488006[0x0],_0x488006[0x1]===_0x7fe5('0x56')?![]:!![]);_0x3a3e16[_0x7fe5('0x55')](_0x7fe5('0x57')+_0x488006[0x0],_0x488006[0x1]==='DESC'?![]:!![]);});}_0x3a3e16[_0x7fe5('0x9')](_0x18e238,'subqry');return _0x3a3e16;}function getFilteredContacts(_0x20a185){var _0x31157c=[];return db[_0x7fe5('0x39')]['findAll']({'attributes':['id','name',_0x7fe5('0x58')],'raw':!![]})[_0x7fe5('0x48')](function(_0x2ff138){_0x31157c=_[_0x7fe5('0x59')](_0x2ff138,'id');var _0x986ed2={'type':db[_0x7fe5('0x5a')][_0x7fe5('0x5b')][_0x7fe5('0x5c')],'model':db[_0x7fe5('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7fe5('0x5e')][_0x7fe5('0x5f')](_0x20a185[_0x7fe5('0x60')](),_0x986ed2);})[_0x7fe5('0x48')](function(_0x28e640){_0x28e640[_0x7fe5('0x46')](function(_0x30ad8b){if(_0x30ad8b[_0x7fe5('0x1a')]){_0x30ad8b[_0x7fe5('0x61')]=[];_0x30ad8b['TagIds']['split'](',')[_0x7fe5('0x46')](function(_0x1ec61e){_0x30ad8b[_0x7fe5('0x61')][_0x7fe5('0x45')](_0x31157c[_0x1ec61e]);});}delete _0x30ad8b['TagIds'];});return _0x28e640;});}function countFilteredContacts(_0xafb24d,_0x1fa1d3){var _0x43bca9=_0xafb24d[_0x7fe5('0x62')]();_0x43bca9[_0x7fe5('0x1d')](_0x7fe5('0x63'));_0x43bca9=applyJoinClauses(_0x43bca9,!![]);_0xafb24d[_0x7fe5('0x50')](_0x7fe5('0x51'));var _0xa3b567=utils['getSelectedTags'](_0x1fa1d3);if(!_[_0x7fe5('0x64')](_0xa3b567)){_0x43bca9['where']('t.id\x20IN\x20?',_0xa3b567);}var _0x32e0fe={'type':db[_0x7fe5('0x5a')][_0x7fe5('0x5b')]['SELECT'],'raw':!![]};return db[_0x7fe5('0x5e')]['query'](_0x43bca9[_0x7fe5('0x60')](),_0x32e0fe)[_0x7fe5('0x48')](function(_0x5d0ad0){return _0x5d0ad0[0x0][_0x7fe5('0x63')];});}module[_0x7fe5('0x65')]={'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 8bae089..f7df34d 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 _0xca9b=['app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','binary','write','final','end','close','unlink','createReadStream','createWriteStream','createDecipher','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger'];(function(_0x1c6efe,_0x262d82){var _0x54d3cd=function(_0x56d365){while(--_0x56d365){_0x1c6efe['push'](_0x1c6efe['shift']());}};_0x54d3cd(++_0x262d82);}(_0xca9b,0x67));var _0xbca9=function(_0xf3ce91,_0xcaf56a){_0xf3ce91=_0xf3ce91-0x0;var _0x4088d9=_0xca9b[_0xf3ce91];return _0x4088d9;};'use strict';var crypto=require(_0xbca9('0x0'));var fs=require('fs');var BPromise=require(_0xbca9('0x1'));var _=require(_0xbca9('0x2'));var config=require(_0xbca9('0x3'));var logger=require(_0xbca9('0x4'))(_0xbca9('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbca9('0x6')][_0xbca9('0x7')],'algorithm':_0xbca9('0x8')};const fileOptions={'algorithm':_0xbca9('0x9')};if(config[_0xbca9('0xa')]&&config[_0xbca9('0xa')][_0xbca9('0xb')]){var isSupported=isAlgorithmSupported(config[_0xbca9('0xa')][_0xbca9('0xb')]);if(isSupported){fileOptions[_0xbca9('0xb')]=config['encrypt'][_0xbca9('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbca9('0xc')](',\x20');logger['error'](config[_0xbca9('0xa')][_0xbca9('0xb')],_0xbca9('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x2bf2cb){return AES_SUPPORTED_RX[_0xbca9('0xe')](_0x2bf2cb);}function getSupportedCiphers(){return crypto[_0xbca9('0xf')]()[_0xbca9('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x26bd86){return getSupportedCiphers()[_0xbca9('0x11')](_0x26bd86)>-0x1;}function combineOptions(_0x229619){var _0x3ab9e9={};for(var _0x2501cd in fileOptions){if(fileOptions[_0xbca9('0x12')](_0x2501cd)){_0x3ab9e9[_0x2501cd]=fileOptions[_0x2501cd];}}if(_0x229619){for(var _0x35320a in _0x229619){if(_0x229619['hasOwnProperty'](_0x35320a)){_0x3ab9e9[_0x35320a]=_0x229619[_0x35320a];}}}return _0x3ab9e9;}exports[_0xbca9('0x13')]=function(_0x7ef28b,_0x4745da,_0x2107a3,_0x435f33){return new BPromise(function(_0x38ca68,_0xc7e5bd){_0x435f33=combineOptions(_0x435f33);var _0x4858b1=new Buffer(_0x2107a3);var _0x1d9970=fs['createReadStream'](_0x7ef28b);var _0x1cc285=fs['createWriteStream'](_0x4745da);var _0x3a8c3f=crypto[_0xbca9('0x14')](_0x435f33[_0xbca9('0xb')],_0x4858b1);_0x1d9970['on'](_0xbca9('0x15'),function(_0x2b448){var _0x2063c2=new Buffer(_0x3a8c3f[_0xbca9('0x16')](_0x2b448),_0xbca9('0x17'));_0x1cc285[_0xbca9('0x18')](_0x2063c2);});_0x1d9970['on']('end',function(){try{var _0x317289=new Buffer(_0x3a8c3f[_0xbca9('0x19')](_0xbca9('0x17')),_0xbca9('0x17'));_0x1cc285[_0xbca9('0x18')](_0x317289);_0x1cc285[_0xbca9('0x1a')]();_0x1cc285['on'](_0xbca9('0x1b'),function(){return _0x38ca68(_0x4745da);});}catch(_0x4eb00c){fs[_0xbca9('0x1c')](_0x4745da);return _0xc7e5bd(_0x4eb00c);}});});};exports['decryptFile']=function(_0x3a5186,_0x545b88,_0x19abe5,_0x2f193f){return new BPromise(function(_0x24c168,_0x1bcab2){_0x2f193f=combineOptions(_0x2f193f);var _0x56d839=new Buffer(_0x19abe5);var _0x21a481=fs[_0xbca9('0x1d')](_0x3a5186);var _0x559817=fs[_0xbca9('0x1e')](_0x545b88);var _0x3d09b5=crypto[_0xbca9('0x1f')](_0x2f193f[_0xbca9('0xb')],_0x56d839);_0x21a481['on']('data',function(_0x2eeda4){var _0xf5539b=new Buffer(_0x3d09b5[_0xbca9('0x16')](_0x2eeda4),'binary');_0x559817['write'](_0xf5539b);});_0x21a481['on'](_0xbca9('0x1a'),function(){try{var _0x5aa700=new Buffer(_0x3d09b5[_0xbca9('0x19')]('binary'),_0xbca9('0x17'));_0x559817[_0xbca9('0x18')](_0x5aa700);_0x559817[_0xbca9('0x1a')]();_0x559817['on'](_0xbca9('0x1b'),function(){return _0x24c168(_0x545b88);});}catch(_0x2b458b){fs[_0xbca9('0x1c')](_0x545b88);return _0x1bcab2(_0x2b458b);}});});};exports['encryptString']=function(_0x5c01bf,_0x375143,_0x10fb2f){var _0x46d7a3=_0x10fb2f||stringOptions[_0xbca9('0xb')];var _0x3f9030=_0x375143||stringOptions[_0xbca9('0x20')];var _0x3ee4e6=crypto[_0xbca9('0x14')](_0x46d7a3,_0x3f9030);var _0x4d6dbf=_0x3ee4e6[_0xbca9('0x16')](_0x5c01bf,_0xbca9('0x21'),_0xbca9('0x22'));_0x4d6dbf+=_0x3ee4e6[_0xbca9('0x19')](_0xbca9('0x22'));return _0x4d6dbf;};exports[_0xbca9('0x23')]=function(_0x137eb0,_0x3be521,_0x167907){var _0x17cf8b=_0x167907||stringOptions[_0xbca9('0xb')];var _0x54ea0d=_0x3be521||stringOptions[_0xbca9('0x20')];var _0x3d4d1b=crypto[_0xbca9('0x1f')](_0x17cf8b,_0x54ea0d);var _0x8df03c=_0x3d4d1b[_0xbca9('0x16')](_0x137eb0,_0xbca9('0x22'),_0xbca9('0x21'));_0x8df03c+=_0x3d4d1b['final'](_0xbca9('0x21'));return _0x8df03c;}; \ No newline at end of file +var _0x65ee=['aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','final','write','end','close','decryptFile','data','encryptString','secret','utf8','base64','createDecipher','../../config/logger','secrets'];(function(_0x528e23,_0x43013c){var _0x3d42ce=function(_0x4738f0){while(--_0x4738f0){_0x528e23['push'](_0x528e23['shift']());}};_0x3d42ce(++_0x43013c);}(_0x65ee,0x194));var _0xe65e=function(_0x3ff04e,_0x46b10d){_0x3ff04e=_0x3ff04e-0x0;var _0x300a2f=_0x65ee[_0x3ff04e];return _0x300a2f;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xe65e('0x0'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe65e('0x1')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xe65e('0x2')};if(config['encrypt']&&config[_0xe65e('0x3')][_0xe65e('0x4')]){var isSupported=isAlgorithmSupported(config[_0xe65e('0x3')][_0xe65e('0x4')]);if(isSupported){fileOptions['algorithm']=config[_0xe65e('0x3')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe65e('0x5')](',\x20');logger[_0xe65e('0x6')](config[_0xe65e('0x3')][_0xe65e('0x4')],_0xe65e('0x7'),supportedAlgorithms);}}function isASupportedCipher(_0x5de7b9){return AES_SUPPORTED_RX['test'](_0x5de7b9);}function getSupportedCiphers(){return crypto[_0xe65e('0x8')]()[_0xe65e('0x9')](isASupportedCipher);}function isAlgorithmSupported(_0x1511ef){return getSupportedCiphers()[_0xe65e('0xa')](_0x1511ef)>-0x1;}function combineOptions(_0x3738b6){var _0x1045d2={};for(var _0x33c1b6 in fileOptions){if(fileOptions[_0xe65e('0xb')](_0x33c1b6)){_0x1045d2[_0x33c1b6]=fileOptions[_0x33c1b6];}}if(_0x3738b6){for(var _0x5cad33 in _0x3738b6){if(_0x3738b6[_0xe65e('0xb')](_0x5cad33)){_0x1045d2[_0x5cad33]=_0x3738b6[_0x5cad33];}}}return _0x1045d2;}exports[_0xe65e('0xc')]=function(_0x4aecdc,_0x55a315,_0x577a26,_0x35a34d){return new BPromise(function(_0x4431a2,_0x3e9adf){_0x35a34d=combineOptions(_0x35a34d);var _0x316ecb=new Buffer(_0x577a26);var _0x1617d6=fs[_0xe65e('0xd')](_0x4aecdc);var _0x3cd9ae=fs[_0xe65e('0xe')](_0x55a315);var _0x53185e=crypto[_0xe65e('0xf')](_0x35a34d['algorithm'],_0x316ecb);_0x1617d6['on']('data',function(_0x42a189){var _0x579a55=new Buffer(_0x53185e[_0xe65e('0x10')](_0x42a189),_0xe65e('0x11'));_0x3cd9ae['write'](_0x579a55);});_0x1617d6['on']('end',function(){try{var _0x93e10f=new Buffer(_0x53185e[_0xe65e('0x12')](_0xe65e('0x11')),'binary');_0x3cd9ae[_0xe65e('0x13')](_0x93e10f);_0x3cd9ae[_0xe65e('0x14')]();_0x3cd9ae['on'](_0xe65e('0x15'),function(){return _0x4431a2(_0x55a315);});}catch(_0x23ba94){fs['unlink'](_0x55a315);return _0x3e9adf(_0x23ba94);}});});};exports[_0xe65e('0x16')]=function(_0x5d5a2b,_0x2a1a8f,_0x49b4b8,_0x426f9b){return new BPromise(function(_0x45f466,_0x434ff9){_0x426f9b=combineOptions(_0x426f9b);var _0x264cdf=new Buffer(_0x49b4b8);var _0x99fc35=fs[_0xe65e('0xd')](_0x5d5a2b);var _0x213c38=fs[_0xe65e('0xe')](_0x2a1a8f);var _0x4a14c5=crypto['createDecipher'](_0x426f9b[_0xe65e('0x4')],_0x264cdf);_0x99fc35['on'](_0xe65e('0x17'),function(_0x54eec5){var _0x5ee245=new Buffer(_0x4a14c5['update'](_0x54eec5),_0xe65e('0x11'));_0x213c38['write'](_0x5ee245);});_0x99fc35['on'](_0xe65e('0x14'),function(){try{var _0x2849a5=new Buffer(_0x4a14c5[_0xe65e('0x12')](_0xe65e('0x11')),_0xe65e('0x11'));_0x213c38[_0xe65e('0x13')](_0x2849a5);_0x213c38[_0xe65e('0x14')]();_0x213c38['on']('close',function(){return _0x45f466(_0x2a1a8f);});}catch(_0x70b3b1){fs['unlink'](_0x2a1a8f);return _0x434ff9(_0x70b3b1);}});});};exports[_0xe65e('0x18')]=function(_0x2ddf28,_0x31bd6d,_0xfc0741){var _0x8b53f8=_0xfc0741||stringOptions[_0xe65e('0x4')];var _0x4ddcf8=_0x31bd6d||stringOptions[_0xe65e('0x19')];var _0x2d0c33=crypto[_0xe65e('0xf')](_0x8b53f8,_0x4ddcf8);var _0x2d0d65=_0x2d0c33[_0xe65e('0x10')](_0x2ddf28,_0xe65e('0x1a'),_0xe65e('0x1b'));_0x2d0d65+=_0x2d0c33['final']('base64');return _0x2d0d65;};exports['decryptString']=function(_0x115ec9,_0x2ad97c,_0x1a42e4){var _0xf55e93=_0x1a42e4||stringOptions['algorithm'];var _0x45e6a0=_0x2ad97c||stringOptions[_0xe65e('0x19')];var _0x4b6cff=crypto[_0xe65e('0x1c')](_0xf55e93,_0x45e6a0);var _0x2dbd79=_0x4b6cff['update'](_0x115ec9,'base64','utf8');_0x2dbd79+=_0x4b6cff[_0xe65e('0x12')]('utf8');return _0x2dbd79;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index ce8f9c1..235ec59 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 _0x40ea=['update','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','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','push','dirname','basename','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','zip\x20finished','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport'];(function(_0x315239,_0x1bd801){var _0xa1e160=function(_0x425438){while(--_0x425438){_0x315239['push'](_0x315239['shift']());}};_0xa1e160(++_0x1bd801);}(_0x40ea,0x1c8));var _0xa40e=function(_0x12fc29,_0x3fcbd6){_0x12fc29=_0x12fc29-0x0;var _0x59076c=_0x40ea[_0x12fc29];return _0x59076c;};'use strict';var util=require(_0xa40e('0x0'));var path=require('path');var _=require(_0xa40e('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xa40e('0x2'));var zipdir=require(_0xa40e('0x3'));var rimraf=require(_0xa40e('0x4'));var db=require(_0xa40e('0x5'))['db'];var dbH=require('../../mysqldb')[_0xa40e('0x6')];var logger=require(_0xa40e('0x7'))(_0xa40e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa40e('0x9')][0x2]);var QUERY=process[_0xa40e('0x9')][0x3];var PATH=process[_0xa40e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b4d0c,_0x279e33){var _0x33bccb={'status':_0x1b4d0c};var _0x478983={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x279e33){_0x33bccb[_0xa40e('0xa')]=_0x279e33;}return db[_0xa40e('0xb')][_0xa40e('0xc')](_0x33bccb,_0x478983);}function main(){var _0x5ae44c=0x1388;var _0x399b7a;logger[_0xa40e('0xd')](util[_0xa40e('0xe')](_0xa40e('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xa40e('0x10')][_0xa40e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa40e('0x12'),_0xa40e('0x13')]})[_0xa40e('0x14')](function(_0x5b9b19){if(_0x5b9b19){_0x399b7a=_0x5b9b19;_0x5ae44c=_0x399b7a[_0xa40e('0x13')]||0x1388;}})[_0xa40e('0x14')](function(){return dbH[_0xa40e('0x15')][_0xa40e('0x16')](util[_0xa40e('0xe')](_0xa40e('0x17'),QUERY),{'type':dbH[_0xa40e('0x15')]['QueryTypes']['SELECT']});})[_0xa40e('0x14')](function(_0x52acb1){if(!_0x52acb1[0x0][_0xa40e('0x18')]){return analyticExtractedReport(_0xa40e('0x19'));}var _0x305a22=[];var _0x3d7b01=0x0;if(_0x399b7a[_0xa40e('0x12')]){if(_0x52acb1&&_0x52acb1[_0xa40e('0x1a')]){var _0x4eb1e2=_[_0xa40e('0x1b')](_0x52acb1[0x0][_0xa40e('0x18')]/_0x5ae44c);var _0x551282=Number[_0xa40e('0x1c')](_0x52acb1[0x0]['num']/_0x5ae44c)?_0x52acb1[0x0][_0xa40e('0x18')]%_0x5ae44c:0x0;_0x4eb1e2[_0xa40e('0x1d')](function(_0x541c57){if(_0x541c57>0x0){_0x3d7b01+=_0x5ae44c;}_0x305a22['push'](dbH[_0xa40e('0x15')][_0xa40e('0x16')](util['format'](_0xa40e('0x1e'),QUERY,_0x5ae44c,_0x3d7b01),{'type':dbH[_0xa40e('0x15')][_0xa40e('0x1f')][_0xa40e('0x20')]}));});if(_0x551282>0x0){_0x3d7b01+=_0x5ae44c;_0x305a22[_0xa40e('0x21')](dbH[_0xa40e('0x15')][_0xa40e('0x16')](util[_0xa40e('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x551282,_0x3d7b01),{'type':dbH[_0xa40e('0x15')]['QueryTypes'][_0xa40e('0x20')]}));}}}else{_0x305a22[_0xa40e('0x21')](dbH[_0xa40e('0x15')][_0xa40e('0x16')](QUERY,{'type':dbH[_0xa40e('0x15')]['QueryTypes'][_0xa40e('0x20')]}));}var _0x48e928=path[_0xa40e('0x22')](PATH);var _0x53582b=path[_0xa40e('0x23')](PATH,'.csv');var _0x233c51=_0x399b7a[_0xa40e('0x12')]&&_0x305a22[_0xa40e('0x1a')]>0x1;var _0x4bff6c=[];if(!fs[_0xa40e('0x24')](path[_0xa40e('0x25')](_0x48e928,_0x53582b))&&_0x233c51){fs[_0xa40e('0x26')](path[_0xa40e('0x25')](_0x48e928,_0x53582b));}return BPromise[_0xa40e('0x27')](_0x305a22,function(_0x407200){_0x4bff6c[_0xa40e('0x21')](_0x407200);})[_0xa40e('0x14')](function(){for(var _0x596d68=0x0;_0x596d68<_0x4bff6c[_0xa40e('0x1a')];_0x596d68+=0x1){var _0x364a1b;var _0x611d8a=_0x4bff6c[_0x596d68];if(_0x233c51){_0x364a1b=path['join'](_0x48e928,_0x53582b,util[_0xa40e('0xe')]('%s%d.%s',_0x53582b,_0x596d68,_0xa40e('0x28')));}else{_0x364a1b=path[_0xa40e('0x25')](_0x48e928,util[_0xa40e('0xe')](_0xa40e('0x29'),_0x53582b,_0xa40e('0x28')));}fs[_0xa40e('0x2a')](_0x364a1b,csv(_0x611d8a));}})[_0xa40e('0x14')](function(){if(_0x233c51){return new Promise(function(_0x3d1aa9){zipdir(path[_0xa40e('0x25')](_0x48e928,_0x53582b),{'saveTo':path[_0xa40e('0x25')](_0x48e928,util['format'](_0xa40e('0x29'),_0x53582b,_0xa40e('0x2b')))},function(_0x1c9a2d,_0x44328b){rimraf(path[_0xa40e('0x25')](_0x48e928,_0x53582b),function(){});_0x3d1aa9(_0xa40e('0x2c'));});});}})[_0xa40e('0x14')](function(){logger['info'](util[_0xa40e('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa40e('0x2d')));return analyticExtractedReport(_0xa40e('0x2e'),_0x233c51?util[_0xa40e('0xe')](_0xa40e('0x29'),_0x53582b,_0x233c51?_0xa40e('0x2b'):'csv'):null);});})[_0xa40e('0x2f')](function(_0x11a56c){logger['info'](util['format'](_0xa40e('0x30'),EXTRACTED_REPORT_ID,_0xa40e('0x2d')),util[_0xa40e('0x31')](_0x11a56c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa40e('0x32')](function(){process[_0xa40e('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2698=['CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','each','%s%d.%s','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2698,0x1b3));var _0x8269=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2698[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x8269('0x0'));var path=require('path');var _=require(_0x8269('0x1'));var csv=require(_0x8269('0x2'));var fs=require('fs');var BPromise=require(_0x8269('0x3'));var zipdir=require(_0x8269('0x4'));var rimraf=require(_0x8269('0x5'));var db=require(_0x8269('0x6'))['db'];var dbH=require(_0x8269('0x6'))['dbH'];var logger=require('../../config/logger')(_0x8269('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x8269('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8269('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x8a6e77,_0x4cbd17){var _0x5e26b2={'status':_0x8a6e77};var _0x1b2d95={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4cbd17){_0x5e26b2[_0x8269('0x9')]=_0x4cbd17;}return db[_0x8269('0xa')][_0x8269('0xb')](_0x5e26b2,_0x1b2d95);}function main(){var _0x3d7200=0x1388;var _0x1889fd;logger[_0x8269('0xc')](util[_0x8269('0xd')](_0x8269('0xe'),EXTRACTED_REPORT_ID,_0x8269('0xf')));return db[_0x8269('0x10')][_0x8269('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8269('0x12'),_0x8269('0x13')]})['then'](function(_0x5df227){if(_0x5df227){_0x1889fd=_0x5df227;_0x3d7200=_0x1889fd['splitSizeCsv']||0x1388;}})[_0x8269('0x14')](function(){return dbH[_0x8269('0x15')][_0x8269('0x16')](util['format'](_0x8269('0x17'),QUERY),{'type':dbH['sequelize'][_0x8269('0x18')]['SELECT']});})[_0x8269('0x14')](function(_0x214844){if(!_0x214844[0x0][_0x8269('0x19')]){return analyticExtractedReport(_0x8269('0x1a'));}var _0x3b98b8=[];var _0x19c302=0x0;if(_0x1889fd['split']){if(_0x214844&&_0x214844[_0x8269('0x1b')]){var _0x39f38e=_[_0x8269('0x1c')](_0x214844[0x0]['num']/_0x3d7200);var _0x461cfd=Number['isInteger'](_0x214844[0x0]['num']/_0x3d7200)?_0x214844[0x0]['num']%_0x3d7200:0x0;_0x39f38e[_0x8269('0x1d')](function(_0x244b73){if(_0x244b73>0x0){_0x19c302+=_0x3d7200;}_0x3b98b8[_0x8269('0x1e')](dbH['sequelize'][_0x8269('0x16')](util['format'](_0x8269('0x1f'),QUERY,_0x3d7200,_0x19c302),{'type':dbH['sequelize'][_0x8269('0x18')][_0x8269('0x20')]}));});if(_0x461cfd>0x0){_0x19c302+=_0x3d7200;_0x3b98b8[_0x8269('0x1e')](dbH[_0x8269('0x15')][_0x8269('0x16')](util['format'](_0x8269('0x1f'),QUERY,_0x461cfd,_0x19c302),{'type':dbH[_0x8269('0x15')][_0x8269('0x18')][_0x8269('0x20')]}));}}}else{_0x3b98b8[_0x8269('0x1e')](dbH[_0x8269('0x15')][_0x8269('0x16')](QUERY,{'type':dbH[_0x8269('0x15')][_0x8269('0x18')]['SELECT']}));}var _0x5f0fd6=path[_0x8269('0x21')](PATH);var _0xc5428d=path[_0x8269('0x22')](PATH,_0x8269('0x23'));var _0x376ac3=_0x1889fd[_0x8269('0x12')]&&_0x3b98b8[_0x8269('0x1b')]>0x1;var _0x2fb000=[];if(!fs[_0x8269('0x24')](path[_0x8269('0x25')](_0x5f0fd6,_0xc5428d))&&_0x376ac3){fs['mkdirSync'](path[_0x8269('0x25')](_0x5f0fd6,_0xc5428d));}return BPromise[_0x8269('0x26')](_0x3b98b8,function(_0x44c075){_0x2fb000[_0x8269('0x1e')](_0x44c075);})[_0x8269('0x14')](function(){for(var _0x3b5874=0x0;_0x3b5874<_0x2fb000[_0x8269('0x1b')];_0x3b5874+=0x1){var _0xbaf2dc;var _0xff8372=_0x2fb000[_0x3b5874];if(_0x376ac3){_0xbaf2dc=path[_0x8269('0x25')](_0x5f0fd6,_0xc5428d,util[_0x8269('0xd')](_0x8269('0x27'),_0xc5428d,_0x3b5874,'csv'));}else{_0xbaf2dc=path['join'](_0x5f0fd6,util[_0x8269('0xd')](_0x8269('0x28'),_0xc5428d,'csv'));}fs[_0x8269('0x29')](_0xbaf2dc,csv(_0xff8372));}})[_0x8269('0x14')](function(){if(_0x376ac3){return new Promise(function(_0x3dfac7){zipdir(path[_0x8269('0x25')](_0x5f0fd6,_0xc5428d),{'saveTo':path[_0x8269('0x25')](_0x5f0fd6,util[_0x8269('0xd')]('%s.%s',_0xc5428d,'zip'))},function(_0x4178ce,_0x520e5c){rimraf(path[_0x8269('0x25')](_0x5f0fd6,_0xc5428d),function(){});_0x3dfac7('zip\x20finished');});});}})[_0x8269('0x14')](function(){logger[_0x8269('0xc')](util['format'](_0x8269('0x2a'),EXTRACTED_REPORT_ID,_0x8269('0xf')));return analyticExtractedReport(_0x8269('0x2b'),_0x376ac3?util[_0x8269('0xd')](_0x8269('0x28'),_0xc5428d,_0x376ac3?_0x8269('0x2c'):_0x8269('0x2d')):null);});})[_0x8269('0x2e')](function(_0x4ddbf3){logger[_0x8269('0xc')](util[_0x8269('0xd')](_0x8269('0x2f'),EXTRACTED_REPORT_ID,_0x8269('0xf')),util[_0x8269('0x30')](_0x4ddbf3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x8269('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 95ce702..74fced9 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 _0x4194=['forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync','join','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','path','util','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','toString','value','fill','length','auto','body','push','chunk','keys','name','startDate','format','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','find','split','splitSizePdf','then','range','isInteger','num'];(function(_0x10c7a5,_0x261f71){var _0x50e807=function(_0x25a909){while(--_0x25a909){_0x10c7a5['push'](_0x10c7a5['shift']());}};_0x50e807(++_0x261f71);}(_0x4194,0x80));var _0x4419=function(_0x2242b9,_0x4b9e98){_0x2242b9=_0x2242b9-0x0;var _0x502439=_0x4194[_0x2242b9];return _0x502439;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x4419('0x0'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x4419('0x1'));var PdfPrinter=require(_0x4419('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x4419('0x3'));var JSDOM=require(_0x4419('0x4'))[_0x4419('0x5')];var window=new JSDOM('')[_0x4419('0x6')];var BPromise=require(_0x4419('0x7'));var db=require(_0x4419('0x8'))['db'];var dbH=require(_0x4419('0x8'))[_0x4419('0x9')];var logger=require(_0x4419('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x4419('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4419('0xb')][0x4];var NAME=process[_0x4419('0xb')][0x5];var FORMAT=_0x4419('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x46853a,_0x551818){var _0x3cd7cc={'status':_0x46853a};var _0xdcd125={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x551818){_0x3cd7cc[_0x4419('0xd')]=_0x551818;}return db['AnalyticExtractedReport']['update'](_0x3cd7cc,_0xdcd125);}function getHeaders(_0x249bd8){return _[_0x4419('0xe')](_0x249bd8,function(_0x3e279b){return{'text':_0x3e279b,'style':_0x4419('0xf')};});}function getRows(_0x55a00a,_0x2732ad){return _['map'](_0x2732ad,function(_0x561613){return _(_0x561613)[_0x4419('0x10')](_0x55a00a)[_0x4419('0xe')](function(_0x4cb73a){return _0x4cb73a?_[_0x4419('0x11')](_0x4cb73a):'';})[_0x4419('0x12')]();});}function createTable(_0x12bb13,_0x1f0f26){var _0x58f4e7={'widths':_[_0x4419('0x13')](Array(_0x12bb13[_0x4419('0x14')]),0x91),'heights':function(_0x3937ae){return _0x3937ae===0x0?_0x4419('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x42f08c=getHeaders(_0x12bb13);_0x58f4e7[_0x4419('0x16')][_0x4419('0x17')](_0x42f08c);var _0x19be18=getRows(_0x12bb13,_0x1f0f26);_0x58f4e7['body']=_0x58f4e7[_0x4419('0x16')]['concat'](_0x19be18);return _0x58f4e7;}function createTables(_0x3363f0){var _0x58618d=[];var _0x590a9f=_[_0x4419('0x18')](Object[_0x4419('0x19')](_0x3363f0[0x0]),0x5);_0x590a9f['forEach'](function(_0x17a037){_0x58618d[_0x4419('0x17')](createTable(_0x17a037,_0x3363f0));});return _0x58618d;}function getPDFDocDefinition(_0x5ab2cb){var _0x446bdb=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x4419('0x1a')],moment(EXTRACTED_REPORT[_0x4419('0x1b')])[_0x4419('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x4419('0x1d')])[_0x4419('0x1c')](FORMAT));var _0x75f551=[];for(var _0x2dab9a=0x0;_0x2dab9a<_0x5ab2cb['length'];_0x2dab9a++){var _0x4a3ca9=[];if(_0x2dab9a===0x0){_0x4a3ca9['push']({'text':_0x446bdb,'style':_0x4419('0x1e')});}var _0x481eb8={'table':_0x5ab2cb[_0x2dab9a]};if(_0x2dab9a>0x0){_0x481eb8[_0x4419('0x1f')]=_0x4419('0x20');_0x481eb8[_0x4419('0x21')]=[0x0,0x46,0x0,0x0];}_0x4a3ca9['push'](_0x481eb8);_0x75f551[_0x4419('0x17')](_0x4a3ca9);}return{'pageSize':'A4','pageOrientation':_0x4419('0x22'),'content':_0x75f551,'footer':function(_0x94f176,_0x57f681){return{'text':_0x94f176[_0x4419('0x11')]()+_0x4419('0x23')+_0x57f681,'style':_0x4419('0x24')};},'defaultStyle':{'font':_0x4419('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4419('0x26')},'footer':{'alignment':_0x4419('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x56f6f8){var _0x400650=0x1388;var _0x3ce3df;if(!_0x56f6f8[0x0]['num']){return analyticExtractedReport(_0x4419('0x28'));}return db['Setting'][_0x4419('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4419('0x2a'),_0x4419('0x2b')]})['then'](function(_0x4c586b){if(_0x4c586b){_0x3ce3df=_0x4c586b;_0x400650=_0x3ce3df[_0x4419('0x2b')]||0x3e8;}})[_0x4419('0x2c')](function(){var _0x4f7795=[];var _0x13e0b3=0x0;if(_0x3ce3df[_0x4419('0x2a')]){if(_0x56f6f8&&_0x56f6f8[_0x4419('0x14')]){var _0x45a0ee=_[_0x4419('0x2d')](_0x56f6f8[0x0]['num']/_0x400650);var _0x5d984a=Number[_0x4419('0x2e')](_0x56f6f8[0x0][_0x4419('0x2f')]/_0x400650)?_0x56f6f8[0x0][_0x4419('0x2f')]%_0x400650:0x0;_0x45a0ee[_0x4419('0x30')](function(_0x1ef6a0){if(_0x1ef6a0>0x0){_0x13e0b3+=_0x400650;}_0x4f7795[_0x4419('0x17')](dbH['sequelize']['query'](util[_0x4419('0x1c')](_0x4419('0x31'),QUERY,_0x400650,_0x13e0b3),{'type':dbH[_0x4419('0x32')][_0x4419('0x33')][_0x4419('0x34')]}));});if(_0x5d984a>0x0){_0x13e0b3+=_0x400650;_0x4f7795[_0x4419('0x17')](dbH['sequelize']['query'](util[_0x4419('0x1c')](_0x4419('0x31'),QUERY,_0x5d984a,_0x13e0b3),{'type':dbH['sequelize'][_0x4419('0x33')]['SELECT']}));}}}else{_0x4f7795['push'](dbH[_0x4419('0x32')]['query'](QUERY,{'type':dbH[_0x4419('0x32')]['QueryTypes'][_0x4419('0x34')]}));}var _0x3543ec=path[_0x4419('0x35')](PATH);var _0x4faae7=path[_0x4419('0x36')](PATH,_0x4419('0x37'));var _0x131db4=_0x3ce3df[_0x4419('0x2a')]&&_0x4f7795[_0x4419('0x14')]>0x1;var _0x514a22=[];if(!fs[_0x4419('0x38')](path['join'](_0x3543ec,_0x4faae7))&&_0x131db4){fs[_0x4419('0x39')](path[_0x4419('0x3a')](_0x3543ec,_0x4faae7));}return BPromise['each'](_0x4f7795,function(_0x3d8adc){_0x514a22[_0x4419('0x17')](_0x3d8adc);})[_0x4419('0x2c')](function(){var _0x5c84f4=[];for(var _0x18306a=0x0;_0x18306a<_0x514a22['length'];_0x18306a+=0x1){var _0x6fc2a5=_0x514a22[_0x18306a];var _0x31fd13=createTables(_['flatten'](_0x6fc2a5));var _0x489590;var _0x212d85=getPDFDocDefinition(_0x31fd13);var _0x32b44d=getPDFPrinter();var _0x17537c=_0x32b44d[_0x4419('0x3b')](_0x212d85);if(_0x131db4){_0x489590=path[_0x4419('0x3a')](_0x3543ec,_0x4faae7,util[_0x4419('0x1c')](_0x4419('0x3c'),_0x4faae7,_0x18306a,_0x4419('0x3d')));}else{_0x489590=path[_0x4419('0x3a')](_0x3543ec,util[_0x4419('0x1c')]('%s.%s',_0x4faae7,'pdf'));}_0x5c84f4[_0x4419('0x17')](writePDFDocument(_0x17537c,_0x489590));}return Promise[_0x4419('0x3e')](_0x5c84f4);})['then'](function(){if(_0x131db4){return new Promise(function(_0x55b1f6){zipdir(path[_0x4419('0x3a')](_0x3543ec,_0x4faae7),{'saveTo':path[_0x4419('0x3a')](_0x3543ec,util[_0x4419('0x1c')](_0x4419('0x3f'),_0x4faae7,_0x4419('0x40')))},function(){rimraf(path[_0x4419('0x3a')](_0x3543ec,_0x4faae7),function(){});_0x55b1f6(_0x4419('0x41'));});});}})[_0x4419('0x2c')](function(){if(!_0x131db4)return;rimraf(path[_0x4419('0x3a')](_0x3543ec,_0x4faae7),function(){});})[_0x4419('0x2c')](function(){logger[_0x4419('0x42')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x131db4?util[_0x4419('0x1c')](_0x4419('0x3f'),_0x4faae7,_0x131db4?_0x4419('0x40'):_0x4419('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4419('0x42')](util[_0x4419('0x1c')](_0x4419('0x43'),EXTRACTED_REPORT_ID,_0x4419('0x44')));return db[_0x4419('0x45')][_0x4419('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x2ebbca){EXTRACTED_REPORT=_0x2ebbca;return dbH[_0x4419('0x32')]['query'](util[_0x4419('0x1c')](_0x4419('0x47'),QUERY),{'type':dbH[_0x4419('0x32')][_0x4419('0x33')][_0x4419('0x34')]});})[_0x4419('0x2c')](extractReport)[_0x4419('0x48')](function(_0x4342cd){logger[_0x4419('0x42')](util[_0x4419('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4419('0x44')),util[_0x4419('0x49')](_0x4342cd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4419('0x4a'));})[_0x4419('0x4b')](function(){process[_0x4419('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x153726=new PdfPrinter({'Arial':{'normal':__dirname+_0x4419('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x4419('0x4e'),'bolditalics':__dirname+_0x4419('0x4f')}});return _0x153726;}function getPDFDocDefinitionFromHTML(_0x8a51b7,_0x12e50b){var _0x39e757=util[_0x4419('0x1c')](_0x4419('0x50'),_0x12e50b['channel'],_0x12e50b['interactionId']);var _0x22448f=moment()[_0x4419('0x1c')](_0x4419('0x51'))['toString']();var _0xf80478=htmlToPdfmake(_0x8a51b7,{'window':window,'tableAutoSize':!![]});return{'content':[_0xf80478],'defaultStyle':{'font':_0x4419('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4419('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4419('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x4419('0x53'),'style':_0x4419('0x1e')}];},'footer':function(_0x4c5bb3,_0x8352be){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x39e757,_0x4c5bb3,_0x8352be,_0x22448f),'style':'footer'}];}};}function writePDFDocument(_0x5cb0fc,_0x15dd57){return new Promise(function(_0x26030a,_0x1669dd){var _0x25dcc0=_0x5cb0fc[_0x4419('0x54')](fs[_0x4419('0x55')](_0x15dd57));_0x25dcc0['on']('finish',function(){_0x26030a(_0x4419('0x56'));});_0x25dcc0['on']('error',function(_0x7d3ab3){_0x1669dd(_0x7d3ab3);});_0x5cb0fc['end']();});}exports['createPdfFromHTML']=function(_0xf1123d,_0x4ee432){var _0x35ceb1=getPDFPrinter();var _0x29b16c=getPDFDocDefinitionFromHTML(_0xf1123d,_0x4ee432);var _0x594ae5=_0x35ceb1[_0x4419('0x3b')](_0x29b16c);return writePDFDocument(_0x594ae5,_0x4ee432[_0x4419('0x57')])[_0x4419('0x48')](function(_0x54e9db){throw _0x54e9db;});}; \ No newline at end of file +var _0x1ba3=['landscape','footer','Arial','right','num','Empty','Setting','find','split','then','splitSizePdf','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','basename','.pdf','existsSync','join','each','flatten','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','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','catch','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfKitDocument','lodash','path','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','forEach','format','endDate','header','pageBreak','before','margin'];(function(_0x590649,_0x28f93d){var _0x4e1806=function(_0x145c9a){while(--_0x145c9a){_0x590649['push'](_0x590649['shift']());}};_0x4e1806(++_0x28f93d);}(_0x1ba3,0xe7));var _0x31ba=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x1ba3[_0x2f3ecd];return _0xffdc44;};'use strict';var _=require(_0x31ba('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x31ba('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x31ba('0x2'));var PdfPrinter=require(_0x31ba('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x31ba('0x4'));var JSDOM=require(_0x31ba('0x5'))[_0x31ba('0x6')];var window=new JSDOM('')[_0x31ba('0x7')];var BPromise=require('bluebird');var db=require(_0x31ba('0x8'))['db'];var dbH=require(_0x31ba('0x8'))[_0x31ba('0x9')];var logger=require('../../config/logger')(_0x31ba('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x31ba('0xb')][0x2]);var QUERY=process[_0x31ba('0xb')][0x3];var PATH=process[_0x31ba('0xb')][0x4];var NAME=process[_0x31ba('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x119a2a,_0x3bae9a){var _0x5a1eba={'status':_0x119a2a};var _0x5041c9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bae9a){_0x5a1eba[_0x31ba('0xc')]=_0x3bae9a;}return db[_0x31ba('0xd')]['update'](_0x5a1eba,_0x5041c9);}function getHeaders(_0x592c83){return _[_0x31ba('0xe')](_0x592c83,function(_0x3d899e){return{'text':_0x3d899e,'style':_0x31ba('0xf')};});}function getRows(_0x3b61a4,_0x2dcd5d){return _['map'](_0x2dcd5d,function(_0x51d311){return _(_0x51d311)[_0x31ba('0x10')](_0x3b61a4)[_0x31ba('0xe')](function(_0x107d11){return _0x107d11?_[_0x31ba('0x11')](_0x107d11):'';})[_0x31ba('0x12')]();});}function createTable(_0xbd838d,_0x3328c5){var _0x25e51a={'widths':_[_0x31ba('0x13')](Array(_0xbd838d[_0x31ba('0x14')]),0x91),'heights':function(_0x54101d){return _0x54101d===0x0?_0x31ba('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x56829b=getHeaders(_0xbd838d);_0x25e51a[_0x31ba('0x16')][_0x31ba('0x17')](_0x56829b);var _0x3d7765=getRows(_0xbd838d,_0x3328c5);_0x25e51a['body']=_0x25e51a[_0x31ba('0x16')][_0x31ba('0x18')](_0x3d7765);return _0x25e51a;}function createTables(_0x502e58){var _0x380411=[];var _0x5c5d2a=_[_0x31ba('0x19')](Object['keys'](_0x502e58[0x0]),0x5);_0x5c5d2a[_0x31ba('0x1a')](function(_0x5f5aba){_0x380411[_0x31ba('0x17')](createTable(_0x5f5aba,_0x502e58));});return _0x380411;}function getPDFDocDefinition(_0x567a33){var _0x5ed093=util[_0x31ba('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x31ba('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x31ba('0x1c')])['format'](FORMAT));var _0x25038a=[];for(var _0x8d1c84=0x0;_0x8d1c84<_0x567a33['length'];_0x8d1c84++){var _0xfc874a=[];if(_0x8d1c84===0x0){_0xfc874a['push']({'text':_0x5ed093,'style':_0x31ba('0x1d')});}var _0xce100a={'table':_0x567a33[_0x8d1c84]};if(_0x8d1c84>0x0){_0xce100a[_0x31ba('0x1e')]=_0x31ba('0x1f');_0xce100a[_0x31ba('0x20')]=[0x0,0x46,0x0,0x0];}_0xfc874a[_0x31ba('0x17')](_0xce100a);_0x25038a['push'](_0xfc874a);}return{'pageSize':'A4','pageOrientation':_0x31ba('0x21'),'content':_0x25038a,'footer':function(_0x5861e8,_0x4687e3){return{'text':_0x5861e8[_0x31ba('0x11')]()+'\x20/\x20'+_0x4687e3,'style':_0x31ba('0x22')};},'defaultStyle':{'font':_0x31ba('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x31ba('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x160d57){var _0x3abace=0x1388;var _0x49a251;if(!_0x160d57[0x0][_0x31ba('0x25')]){return analyticExtractedReport(_0x31ba('0x26'));}return db[_0x31ba('0x27')][_0x31ba('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x31ba('0x29'),'splitSizePdf']})[_0x31ba('0x2a')](function(_0x512428){if(_0x512428){_0x49a251=_0x512428;_0x3abace=_0x49a251[_0x31ba('0x2b')]||0x3e8;}})['then'](function(){var _0x307c82=[];var _0x279901=0x0;if(_0x49a251['split']){if(_0x160d57&&_0x160d57[_0x31ba('0x14')]){var _0x3702a7=_[_0x31ba('0x2c')](_0x160d57[0x0][_0x31ba('0x25')]/_0x3abace);var _0x52a64a=Number[_0x31ba('0x2d')](_0x160d57[0x0]['num']/_0x3abace)?_0x160d57[0x0][_0x31ba('0x25')]%_0x3abace:0x0;_0x3702a7[_0x31ba('0x1a')](function(_0x4f238d){if(_0x4f238d>0x0){_0x279901+=_0x3abace;}_0x307c82[_0x31ba('0x17')](dbH['sequelize'][_0x31ba('0x2e')](util[_0x31ba('0x1b')](_0x31ba('0x2f'),QUERY,_0x3abace,_0x279901),{'type':dbH['sequelize'][_0x31ba('0x30')][_0x31ba('0x31')]}));});if(_0x52a64a>0x0){_0x279901+=_0x3abace;_0x307c82['push'](dbH[_0x31ba('0x32')]['query'](util['format'](_0x31ba('0x2f'),QUERY,_0x52a64a,_0x279901),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x307c82[_0x31ba('0x17')](dbH[_0x31ba('0x32')][_0x31ba('0x2e')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x31ba('0x31')]}));}var _0x286e50=path[_0x31ba('0x33')](PATH);var _0x360158=path[_0x31ba('0x34')](PATH,_0x31ba('0x35'));var _0x1f3ba2=_0x49a251[_0x31ba('0x29')]&&_0x307c82[_0x31ba('0x14')]>0x1;var _0xbae8ab=[];if(!fs[_0x31ba('0x36')](path[_0x31ba('0x37')](_0x286e50,_0x360158))&&_0x1f3ba2){fs['mkdirSync'](path[_0x31ba('0x37')](_0x286e50,_0x360158));}return BPromise[_0x31ba('0x38')](_0x307c82,function(_0x20fe42){_0xbae8ab[_0x31ba('0x17')](_0x20fe42);})[_0x31ba('0x2a')](function(){var _0x19ce47=[];for(var _0xe0d94=0x0;_0xe0d94<_0xbae8ab[_0x31ba('0x14')];_0xe0d94+=0x1){var _0x16a579=_0xbae8ab[_0xe0d94];var _0x1f1679=createTables(_[_0x31ba('0x39')](_0x16a579));var _0x245a4a;var _0xbb68c1=getPDFDocDefinition(_0x1f1679);var _0x33d9aa=getPDFPrinter();var _0x4e070a=_0x33d9aa['createPdfKitDocument'](_0xbb68c1);if(_0x1f3ba2){_0x245a4a=path[_0x31ba('0x37')](_0x286e50,_0x360158,util['format'](_0x31ba('0x3a'),_0x360158,_0xe0d94,_0x31ba('0x3b')));}else{_0x245a4a=path[_0x31ba('0x37')](_0x286e50,util[_0x31ba('0x1b')](_0x31ba('0x3c'),_0x360158,'pdf'));}_0x19ce47[_0x31ba('0x17')](writePDFDocument(_0x4e070a,_0x245a4a));}return Promise[_0x31ba('0x3d')](_0x19ce47);})[_0x31ba('0x2a')](function(){if(_0x1f3ba2){return new Promise(function(_0x483dc9){zipdir(path[_0x31ba('0x37')](_0x286e50,_0x360158),{'saveTo':path[_0x31ba('0x37')](_0x286e50,util['format'](_0x31ba('0x3c'),_0x360158,_0x31ba('0x3e')))},function(){rimraf(path[_0x31ba('0x37')](_0x286e50,_0x360158),function(){});_0x483dc9(_0x31ba('0x3f'));});});}})[_0x31ba('0x2a')](function(){if(!_0x1f3ba2)return;rimraf(path['join'](_0x286e50,_0x360158),function(){});})[_0x31ba('0x2a')](function(){logger[_0x31ba('0x40')](util[_0x31ba('0x1b')](_0x31ba('0x41'),EXTRACTED_REPORT_ID,_0x31ba('0x42')));return analyticExtractedReport(_0x31ba('0x43'),_0x1f3ba2?util[_0x31ba('0x1b')](_0x31ba('0x3c'),_0x360158,_0x1f3ba2?_0x31ba('0x3e'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x31ba('0x40')](util[_0x31ba('0x1b')](_0x31ba('0x44'),EXTRACTED_REPORT_ID,_0x31ba('0x42')));return db[_0x31ba('0xd')][_0x31ba('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x31ba('0x2a')](function(_0x5e9c3b){EXTRACTED_REPORT=_0x5e9c3b;return dbH[_0x31ba('0x32')][_0x31ba('0x2e')](util[_0x31ba('0x1b')](_0x31ba('0x46'),QUERY),{'type':dbH[_0x31ba('0x32')]['QueryTypes'][_0x31ba('0x31')]});})[_0x31ba('0x2a')](extractReport)[_0x31ba('0x47')](function(_0x447f26){logger[_0x31ba('0x40')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x31ba('0x42')),util['inspect'](_0x447f26,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x31ba('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x238669=new PdfPrinter({'Arial':{'normal':__dirname+_0x31ba('0x49'),'bold':__dirname+_0x31ba('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x31ba('0x4b')}});return _0x238669;}function getPDFDocDefinitionFromHTML(_0x37da6f,_0x4d444d){var _0x19df43=util[_0x31ba('0x1b')](_0x31ba('0x4c'),_0x4d444d['channel'],_0x4d444d[_0x31ba('0x4d')]);var _0x222cb8=moment()[_0x31ba('0x1b')](_0x31ba('0x4e'))[_0x31ba('0x11')]();var _0x3ed053=htmlToPdfmake(_0x37da6f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3ed053],'defaultStyle':{'font':_0x31ba('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x31ba('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x31ba('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x31ba('0x4f')}},'header':function(){return[{'text':_0x31ba('0x50'),'style':_0x31ba('0x1d')}];},'footer':function(_0x4791f9,_0x27c531){return[{'text':util['format'](_0x31ba('0x51'),_0x19df43,_0x4791f9,_0x27c531,_0x222cb8),'style':_0x31ba('0x22')}];}};}function writePDFDocument(_0x147bba,_0x27fa71){return new Promise(function(_0x41e2b9,_0x1d2d1b){var _0x464bcd=_0x147bba[_0x31ba('0x52')](fs[_0x31ba('0x53')](_0x27fa71));_0x464bcd['on']('finish',function(){_0x41e2b9(_0x31ba('0x54'));});_0x464bcd['on'](_0x31ba('0x55'),function(_0x4c89df){_0x1d2d1b(_0x4c89df);});_0x147bba[_0x31ba('0x56')]();});}exports['createPdfFromHTML']=function(_0x41c4f0,_0x89af0a){var _0x2fab5d=getPDFPrinter();var _0xc1dfac=getPDFDocDefinitionFromHTML(_0x41c4f0,_0x89af0a);var _0x2b6405=_0x2fab5d[_0x31ba('0x57')](_0xc1dfac);return writePDFDocument(_0x2b6405,_0x89af0a[_0x31ba('0x1')])['catch'](function(_0x298cf3){throw _0x298cf3;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 82e03fd..8f1f6c7 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 _0xe03c=['SELECT','dirname','.xlsx','length','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Failed','exit','util','path','lodash','json2xls','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','find','then','splitSizeXlsx','query','sequelize','QueryTypes','split','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3db3e9,_0xf948f8){var _0x5db23d=function(_0x214f3b){while(--_0x214f3b){_0x3db3e9['push'](_0x3db3e9['shift']());}};_0x5db23d(++_0xf948f8);}(_0xe03c,0x19e));var _0xce03=function(_0x5b19ae,_0x2fef9e){_0x5b19ae=_0x5b19ae-0x0;var _0x367f6a=_0xe03c[_0x5b19ae];return _0x367f6a;};'use strict';var util=require(_0xce03('0x0'));var path=require(_0xce03('0x1'));var _=require(_0xce03('0x2'));var fs=require('fs');var json2xls=require(_0xce03('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xce03('0x4'))[_0xce03('0x5')];var logger=require(_0xce03('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xce03('0x7')][0x3];var PATH=process[_0xce03('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x19274f,_0x26555f){var _0x18e535={'status':_0x19274f};var _0x1d581d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26555f){_0x18e535[_0xce03('0x8')]=_0x26555f;}return db[_0xce03('0x9')][_0xce03('0xa')](_0x18e535,_0x1d581d);}function main(){var _0x3930ef=0x1388;var _0x119a4c;logger[_0xce03('0xb')](util[_0xce03('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xce03('0xd')));return db['Setting'][_0xce03('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xce03('0xf')](function(_0x4f6390){if(_0x4f6390){_0x119a4c=_0x4f6390;_0x3930ef=_0x119a4c[_0xce03('0x10')]||0x1388;}})[_0xce03('0xf')](function(){return dbH['sequelize'][_0xce03('0x11')](util[_0xce03('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xce03('0x12')][_0xce03('0x13')]['SELECT']});})[_0xce03('0xf')](function(_0x3ad5fb){if(!_0x3ad5fb[0x0]['num']){return analyticExtractedReport('Empty');}var _0x4c5e71=[];var _0x20f229=0x0;if(_0x119a4c[_0xce03('0x14')]){if(_0x3ad5fb&&_0x3ad5fb['length']){var _0x5c8411=_[_0xce03('0x15')](_0x3ad5fb[0x0][_0xce03('0x16')]/_0x3930ef);var _0x190a73=Number[_0xce03('0x17')](_0x3ad5fb[0x0][_0xce03('0x16')]/_0x3930ef)?_0x3ad5fb[0x0]['num']%_0x3930ef:0x0;_0x5c8411['forEach'](function(_0x9cc2d9){if(_0x9cc2d9>0x0){_0x20f229+=_0x3930ef;}_0x4c5e71[_0xce03('0x18')](dbH['sequelize']['query'](util[_0xce03('0xc')](_0xce03('0x19'),QUERY,_0x3930ef,_0x20f229),{'type':dbH[_0xce03('0x12')]['QueryTypes'][_0xce03('0x1a')]}));});if(_0x190a73>0x0){_0x20f229+=_0x3930ef;_0x4c5e71[_0xce03('0x18')](dbH[_0xce03('0x12')][_0xce03('0x11')](util[_0xce03('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x190a73,_0x20f229),{'type':dbH[_0xce03('0x12')][_0xce03('0x13')][_0xce03('0x1a')]}));}}}else{_0x4c5e71[_0xce03('0x18')](dbH[_0xce03('0x12')]['query'](QUERY,{'type':dbH['sequelize'][_0xce03('0x13')]['SELECT']}));}var _0xc626e7=path[_0xce03('0x1b')](PATH);var _0x3a02ae=path['basename'](PATH,_0xce03('0x1c'));var _0x5d5612=_0x119a4c[_0xce03('0x14')]&&_0x4c5e71[_0xce03('0x1d')]>0x1;var _0xb0988=[];if(!fs['existsSync'](path['join'](_0xc626e7,_0x3a02ae))&&_0x5d5612){fs[_0xce03('0x1e')](path[_0xce03('0x1f')](_0xc626e7,_0x3a02ae));}return BPromise[_0xce03('0x20')](_0x4c5e71,function(_0x3f8174){_0xb0988[_0xce03('0x18')](_0x3f8174);})[_0xce03('0xf')](function(){for(var _0x557001=0x0;_0x557001<_0xb0988['length'];_0x557001+=0x1){var _0x3673c4;var _0x874aee=_0xb0988[_0x557001];if(_0x5d5612){_0x3673c4=path[_0xce03('0x1f')](_0xc626e7,_0x3a02ae,util[_0xce03('0xc')](_0xce03('0x21'),_0x3a02ae,_0x557001,'xlsx'));}else{_0x3673c4=path[_0xce03('0x1f')](_0xc626e7,util[_0xce03('0xc')](_0xce03('0x22'),_0x3a02ae,_0xce03('0x23')));}fs[_0xce03('0x24')](_0x3673c4,json2xls(_0x874aee),_0xce03('0x25'));}})[_0xce03('0xf')](function(){if(_0x5d5612){return new Promise(function(_0x1903e8){zipdir(path[_0xce03('0x1f')](_0xc626e7,_0x3a02ae),{'saveTo':path['join'](_0xc626e7,util['format'](_0xce03('0x22'),_0x3a02ae,_0xce03('0x26')))},function(_0x52af5c,_0x42a75c){rimraf(path[_0xce03('0x1f')](_0xc626e7,_0x3a02ae),function(){});_0x1903e8(_0xce03('0x27'));});});}})[_0xce03('0xf')](function(){logger[_0xce03('0xb')](util[_0xce03('0xc')](_0xce03('0x28'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x5d5612?util[_0xce03('0xc')]('%s.%s',_0x3a02ae,_0x5d5612?'zip':_0xce03('0x23')):null);});})[_0xce03('0x29')](function(_0x499748){logger['info'](util[_0xce03('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xce03('0xd')),util['inspect'](_0x499748,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xce03('0x2a'));})['finally'](function(){process[_0xce03('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6f87=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Failed','finally','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then'];(function(_0x40dbe2,_0x12bbd0){var _0xd30abe=function(_0x54624e){while(--_0x54624e){_0x40dbe2['push'](_0x40dbe2['shift']());}};_0xd30abe(++_0x12bbd0);}(_0x6f87,0x194));var _0x76f8=function(_0x548566,_0x3fe461){_0x548566=_0x548566-0x0;var _0x204ac4=_0x6f87[_0x548566];return _0x204ac4;};'use strict';var util=require(_0x76f8('0x0'));var path=require(_0x76f8('0x1'));var _=require(_0x76f8('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x76f8('0x3'));var zipdir=require(_0x76f8('0x4'));var rimraf=require(_0x76f8('0x5'));var db=require(_0x76f8('0x6'))['db'];var dbH=require(_0x76f8('0x6'))[_0x76f8('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x76f8('0x8')][0x2]);var QUERY=process[_0x76f8('0x8')][0x3];var PATH=process[_0x76f8('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d4293,_0x54e683){var _0x346770={'status':_0x5d4293};var _0x28733c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54e683){_0x346770[_0x76f8('0x9')]=_0x54e683;}return db[_0x76f8('0xa')][_0x76f8('0xb')](_0x346770,_0x28733c);}function main(){var _0x4f8a5a=0x1388;var _0x322e7a;logger['info'](util[_0x76f8('0xc')](_0x76f8('0xd'),EXTRACTED_REPORT_ID,_0x76f8('0xe')));return db[_0x76f8('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x76f8('0x10'),_0x76f8('0x11')]})[_0x76f8('0x12')](function(_0x58e9b8){if(_0x58e9b8){_0x322e7a=_0x58e9b8;_0x4f8a5a=_0x322e7a[_0x76f8('0x11')]||0x1388;}})[_0x76f8('0x12')](function(){return dbH['sequelize'][_0x76f8('0x13')](util[_0x76f8('0xc')](_0x76f8('0x14'),QUERY),{'type':dbH[_0x76f8('0x15')][_0x76f8('0x16')][_0x76f8('0x17')]});})[_0x76f8('0x12')](function(_0x25c3c7){if(!_0x25c3c7[0x0][_0x76f8('0x18')]){return analyticExtractedReport(_0x76f8('0x19'));}var _0x584063=[];var _0x3c1f8d=0x0;if(_0x322e7a[_0x76f8('0x10')]){if(_0x25c3c7&&_0x25c3c7[_0x76f8('0x1a')]){var _0x473b42=_[_0x76f8('0x1b')](_0x25c3c7[0x0][_0x76f8('0x18')]/_0x4f8a5a);var _0x470ae2=Number[_0x76f8('0x1c')](_0x25c3c7[0x0]['num']/_0x4f8a5a)?_0x25c3c7[0x0]['num']%_0x4f8a5a:0x0;_0x473b42['forEach'](function(_0x241b2c){if(_0x241b2c>0x0){_0x3c1f8d+=_0x4f8a5a;}_0x584063[_0x76f8('0x1d')](dbH[_0x76f8('0x15')][_0x76f8('0x13')](util[_0x76f8('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f8a5a,_0x3c1f8d),{'type':dbH['sequelize'][_0x76f8('0x16')][_0x76f8('0x17')]}));});if(_0x470ae2>0x0){_0x3c1f8d+=_0x4f8a5a;_0x584063['push'](dbH[_0x76f8('0x15')][_0x76f8('0x13')](util[_0x76f8('0xc')](_0x76f8('0x1e'),QUERY,_0x470ae2,_0x3c1f8d),{'type':dbH['sequelize'][_0x76f8('0x16')][_0x76f8('0x17')]}));}}}else{_0x584063['push'](dbH[_0x76f8('0x15')][_0x76f8('0x13')](QUERY,{'type':dbH[_0x76f8('0x15')][_0x76f8('0x16')]['SELECT']}));}var _0x271f90=path['dirname'](PATH);var _0x211d33=path[_0x76f8('0x1f')](PATH,'.xlsx');var _0x4a343a=_0x322e7a['split']&&_0x584063['length']>0x1;var _0x24c5b8=[];if(!fs[_0x76f8('0x20')](path[_0x76f8('0x21')](_0x271f90,_0x211d33))&&_0x4a343a){fs['mkdirSync'](path['join'](_0x271f90,_0x211d33));}return BPromise[_0x76f8('0x22')](_0x584063,function(_0x2f02b5){_0x24c5b8['push'](_0x2f02b5);})[_0x76f8('0x12')](function(){for(var _0x175b34=0x0;_0x175b34<_0x24c5b8[_0x76f8('0x1a')];_0x175b34+=0x1){var _0x1d9d68;var _0x43ad76=_0x24c5b8[_0x175b34];if(_0x4a343a){_0x1d9d68=path[_0x76f8('0x21')](_0x271f90,_0x211d33,util[_0x76f8('0xc')](_0x76f8('0x23'),_0x211d33,_0x175b34,_0x76f8('0x24')));}else{_0x1d9d68=path['join'](_0x271f90,util[_0x76f8('0xc')](_0x76f8('0x25'),_0x211d33,_0x76f8('0x24')));}fs[_0x76f8('0x26')](_0x1d9d68,json2xls(_0x43ad76),_0x76f8('0x27'));}})['then'](function(){if(_0x4a343a){return new Promise(function(_0x42fe54){zipdir(path['join'](_0x271f90,_0x211d33),{'saveTo':path['join'](_0x271f90,util[_0x76f8('0xc')](_0x76f8('0x25'),_0x211d33,_0x76f8('0x28')))},function(_0x597f37,_0x161220){rimraf(path['join'](_0x271f90,_0x211d33),function(){});_0x42fe54(_0x76f8('0x29'));});});}})[_0x76f8('0x12')](function(){logger[_0x76f8('0x2a')](util[_0x76f8('0xc')](_0x76f8('0x2b'),EXTRACTED_REPORT_ID,_0x76f8('0xe')));return analyticExtractedReport(_0x76f8('0x2c'),_0x4a343a?util[_0x76f8('0xc')]('%s.%s',_0x211d33,_0x4a343a?_0x76f8('0x28'):_0x76f8('0x24')):null);});})['catch'](function(_0xe5558d){logger[_0x76f8('0x2a')](util[_0x76f8('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x76f8('0xe')),util['inspect'](_0xe5558d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x76f8('0x2d'));})[_0x76f8('0x2e')](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 068bc74..b174079 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 _0x6dd7=['cutdigits','$[${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','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)='];(function(_0x53c92c,_0x462b9c){var _0x4f69cb=function(_0x2d75ac){while(--_0x2d75ac){_0x53c92c['push'](_0x53c92c['shift']());}};_0x4f69cb(++_0x462b9c);}(_0x6dd7,0x6e));var _0x76dd=function(_0x4b64a4,_0x1bdc50){_0x4b64a4=_0x4b64a4-0x0;var _0xd19b0e=_0x6dd7[_0x4b64a4];return _0xd19b0e;};'use strict';var _=require(_0x76dd('0x0'));var util=require(_0x76dd('0x1'));function rewrite(_0x2dd206,_0x5a735a){var _0x19b43f=this;return _0x2dd206[_0x76dd('0x2')][_0x76dd('0x3')][_0x76dd('0x4')]({'raw':!![]})['then'](function(_0x561be8){_0x19b43f[_0x76dd('0x5')]=_0x561be8;return _0x2dd206[_0x76dd('0x2')][_0x76dd('0x6')][_0x76dd('0x4')]({'where':{'IntervalId':_0x5a735a[_0x76dd('0x7')]},'raw':!![]});})['then'](function(_0x5c7aa1){return _0x2dd206[_0x76dd('0x2')][_0x76dd('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x76dd('0x8')](_['map'](_0x5c7aa1,_0x76dd('0x9')))}},'order':[{'raw':_0x76dd('0xa')}],'raw':!![]});})[_0x76dd('0xb')](function(_0x53a2ba){var _0x396034=_[_0x76dd('0xc')](_0x53a2ba,{'priority':'1'});var _0x5c4041=_['filter'](_0x53a2ba,{'isApp':0x1});var _0x2ec00f=_[_0x76dd('0xd')](_0x5c4041,_0x76dd('0x9'));var _0x1b495b=['queue',_0x76dd('0xe')];var _0x3eca65=[];var _0x515c3b=[];for(var _0x166faa in _0x2ec00f){if(_0x2ec00f[_0x76dd('0xf')](_0x166faa)){_0x19b43f[_0x76dd('0x10')]=0x2;_0x19b43f[_0x76dd('0x11')]=[];_0x19b43f[_0x76dd('0x12')]=_[_0x76dd('0x13')](_0x396034,{'exten':_0x2ec00f[_0x166faa][0x0]['exten']});_0x19b43f['extensions'][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':util[_0x76dd('0x17')]('CDR(type)=%s',_0x2ec00f[_0x166faa][0x0]['type']),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0]['exten'],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});if(_0x2ec00f[_0x166faa][0x0]['type']===_0x76dd('0x1a')){_0x19b43f['extensions'][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x1b')+_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')],'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f['priority']++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}else if(_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')]===_0x76dd('0x1c')){if(_0x19b43f[_0x76dd('0x12')]){_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x1d')+(_0x19b43f[_0x76dd('0x12')][_0x76dd('0x1e')]?'${EXTEN:'+_0x19b43f[_0x76dd('0x12')]['cutdigits']+'}':'${EXTEN}'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x1b')+_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')],'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0]['exten'],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});var _0x60edbb=_0x19b43f['priority']++;_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':'ExecIf','appdata':_0x76dd('0x1f')+(_0x60edbb+0x2)+_0x76dd('0x20')+(_0x60edbb+0x1)+')','context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x60edbb,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});if(_0x19b43f[_0x76dd('0x12')]){_0x19b43f[_0x76dd('0x11')]['push']({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x19b43f[_0x76dd('0x12')][_0x76dd('0x1e')]?_0x76dd('0x21')+_0x19b43f['extension'][_0x76dd('0x1e')]+'}':'CDR(prefix)=noprefix','context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f['priority']++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}_0x19b43f[_0x76dd('0x11')]['push']({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x22')+_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')],'context':_0x2ec00f[_0x166faa][0x0]['context'],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});if(_0x19b43f[_0x76dd('0x12')]&&_0x19b43f[_0x76dd('0x12')]['hasOwnProperty'](_0x76dd('0x23'))&&_0x19b43f['extension']['recordingFormat']!==_0x76dd('0x24')){_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0]['type'],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x25'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0]['type'],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x26')+_0x19b43f[_0x76dd('0x12')]['recordingFormat']||_0x76dd('0x27'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}}_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x28'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});_0x19b43f['extensions'][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2ec00f[_0x166faa][0x0]['context'],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x29'),'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'priority':_0x19b43f[_0x76dd('0x10')]++,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0]['VoiceExtensionId']});for(var _0xb55111=0x0,_0x3cc48d=0x0;_0xb55111<_0x2ec00f[_0x166faa][_0x76dd('0x2a')];_0xb55111+=0x1,_0x3cc48d=0x0){var _0x382d40=_0x2ec00f[_0x166faa][_0xb55111];if(_0x382d40[_0x76dd('0x15')]){_0x382d40['type']=_0x382d40[_0x76dd('0x15')][_0x76dd('0x2b')]();}var _0x45bfd8=[];var _0x5b2d59=[];delete _0x382d40['id'];delete _0x382d40[_0x76dd('0x2c')];delete _0x382d40[_0x76dd('0x2d')];var _0x280cb5=_0x382d40[_0x76dd('0x2e')]!==_0x76dd('0x2f')?[_0x382d40[_0x76dd('0x2e')]]:_0x382d40[_0x76dd('0x7')]?_[_0x76dd('0x30')](_[_0x76dd('0xc')](_0x19b43f['intervals'],{'IntervalId':_0x382d40[_0x76dd('0x7')]}),'interval'):[];if(_0x382d40['hasOwnProperty'](_0x76dd('0x31'))){if(_0x382d40[_0x76dd('0x31')]&&_0x382d40['tag']!=='--'){_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40['type'],'app':_0x76dd('0x16'),'appdata':'CDR(tag)='+_0x382d40[_0x76dd('0x31')],'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40['exten'],'priority':_0x280cb5['length']+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40[_0x76dd('0x19')]});}}if(_0x382d40[_0x76dd('0x15')]==='outbound'&&_0x382d40[_0x76dd('0xf')]('callerID')){if(_0x382d40[_0x76dd('0x32')]){_0x45bfd8['push']({'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x33'),'appdata':_0x76dd('0x34')+_0x382d40[_0x76dd('0x32')]+')','context':_0x382d40['context'],'exten':_0x382d40[_0x76dd('0x9')],'priority':_0x280cb5[_0x76dd('0x2a')]+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40['VoiceExtensionId']});}else{_0x45bfd8['push']({'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x33'),'appdata':_0x76dd('0x35'),'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40[_0x76dd('0x9')],'priority':_0x280cb5[_0x76dd('0x2a')]+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40[_0x76dd('0x19')]});}}if(_0x382d40['hasOwnProperty'](_0x76dd('0x36'))){if(_0x1b495b['indexOf'](_0x382d40['app'][_0x76dd('0x2b')]())>=0x0&&_0x382d40[_0x76dd('0x37')]!=='custom'){if(_0x382d40['answer']){_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x33'),'appdata':_0x76dd('0x38'),'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40['exten'],'priority':_0x280cb5['length']+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40['VoiceExtensionId']});_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40['type'],'app':_0x76dd('0x16'),'appdata':_0x76dd('0x39'),'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40['exten'],'priority':_0x280cb5['length']+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40['VoiceExtensionId']});}else{_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x33'),'appdata':_0x76dd('0x3a'),'context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40['exten'],'priority':_0x280cb5[_0x76dd('0x2a')]+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40[_0x76dd('0x19')]});_0x45bfd8[_0x76dd('0x14')]({'type':_0x382d40['type'],'app':_0x76dd('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x382d40[_0x76dd('0x18')],'exten':_0x382d40[_0x76dd('0x9')],'priority':_0x280cb5['length']+_0x19b43f[_0x76dd('0x10')]+_0x3cc48d++,'VoiceExtensionId':_0x382d40[_0x76dd('0x19')]});}}}for(var _0x62d43b=0x0;_0x62d43b<_0x280cb5[_0x76dd('0x2a')];_0x62d43b+=0x1){var _0x5ebc00=_0x19b43f[_0x76dd('0x10')]+_0x280cb5['length'];var _0x43a5af=_0x62d43b===_0x280cb5[_0x76dd('0x2a')]-0x1?_0x19b43f['priority']+_0x45bfd8[_0x76dd('0x2a')]+_0x5b2d59[_0x76dd('0x2a')]+0x2:_0x19b43f[_0x76dd('0x10')]+_0x62d43b+0x1;_0x45bfd8[_0x76dd('0x3b')](_0x62d43b,0x0,{'type':_0x382d40[_0x76dd('0x15')],'app':_0x76dd('0x3c'),'appdata':_0x280cb5[_0x62d43b]+'?'+_0x382d40[_0x76dd('0x18')]+_0x76dd('0x3d')+_0x5ebc00+':'+_0x382d40[_0x76dd('0x18')]+',${EXTEN},'+_0x43a5af,'exten':_0x382d40['exten'],'context':_0x382d40['context'],'priority':_0x19b43f[_0x76dd('0x10')]+_0x62d43b,'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});}_0x382d40[_0x76dd('0x10')]=_0x45bfd8[_0x76dd('0x2a')]?_[_0x76dd('0x3e')](_0x45bfd8)[_0x76dd('0x10')]+0x1:_0x19b43f[_0x76dd('0x10')];_0x19b43f[_0x76dd('0x10')]=(_0x5b2d59['length']?_['last'](_0x5b2d59)[_0x76dd('0x10')]:_0x382d40[_0x76dd('0x10')])+0x1;_0x19b43f[_0x76dd('0x11')]=_['concat'](_0x19b43f[_0x76dd('0x11')],_0x45bfd8,[_0x382d40],_0x5b2d59);}_0x19b43f[_0x76dd('0x11')][_0x76dd('0x14')]({'type':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x15')],'app':_0x76dd('0x3f'),'exten':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x9')],'context':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x18')],'priority':_0x19b43f[_0x76dd('0x10')],'VoiceExtensionId':_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]});_0x3eca65[_0x76dd('0x14')](_0x2ec00f[_0x166faa][0x0][_0x76dd('0x19')]);_0x515c3b=_[_0x76dd('0x40')](_0x515c3b,_0x19b43f[_0x76dd('0x11')]);}}return _0x2dd206[_0x76dd('0x41')](function(_0x1aa902){return _0x2dd206['models'][_0x76dd('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3eca65}},'transaction':_0x1aa902})[_0x76dd('0xb')](function(_0x2601be){return _0x2dd206['models'][_0x76dd('0x6')]['bulkCreate'](_[_0x76dd('0x42')](_0x515c3b,'priority'),{'transaction':_0x1aa902});});});})[_0x76dd('0x43')](function(_0x3a497d){console[_0x76dd('0x44')](_0x3a497d);});}exports[_0x76dd('0x45')]=rewrite; \ No newline at end of file +var _0xcaf6=['findAll','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','length','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','rewrite','util','models','Interval','then','intervals','VoiceExtension'];(function(_0x2cc989,_0x4c47cd){var _0x19deb9=function(_0x4ad0cf){while(--_0x4ad0cf){_0x2cc989['push'](_0x2cc989['shift']());}};_0x19deb9(++_0x4c47cd);}(_0xcaf6,0xc6));var _0x6caf=function(_0x4c4683,_0x241657){_0x4c4683=_0x4c4683-0x0;var _0x78ee7e=_0xcaf6[_0x4c4683];return _0x78ee7e;};'use strict';var _=require('lodash');var util=require(_0x6caf('0x0'));function rewrite(_0x55c1a8,_0x35c1ab){var _0x934837=this;return _0x55c1a8[_0x6caf('0x1')][_0x6caf('0x2')]['findAll']({'raw':!![]})[_0x6caf('0x3')](function(_0x52aafa){_0x934837[_0x6caf('0x4')]=_0x52aafa;return _0x55c1a8[_0x6caf('0x1')][_0x6caf('0x5')][_0x6caf('0x6')]({'where':{'IntervalId':_0x35c1ab[_0x6caf('0x7')]},'raw':!![]});})[_0x6caf('0x3')](function(_0x146d7b){return _0x55c1a8['models']['VoiceExtension'][_0x6caf('0x6')]({'where':{'exten':{'$in':_['uniq'](_[_0x6caf('0x8')](_0x146d7b,_0x6caf('0x9')))}},'order':[{'raw':_0x6caf('0xa')}],'raw':!![]});})[_0x6caf('0x3')](function(_0x55706a){var _0x219788=_[_0x6caf('0xb')](_0x55706a,{'priority':'1'});var _0x1ffe55=_[_0x6caf('0xb')](_0x55706a,{'isApp':0x1});var _0xebfcde=_[_0x6caf('0xc')](_0x1ffe55,'exten');var _0x439329=[_0x6caf('0xd'),_0x6caf('0xe')];var _0x5a59e3=[];var _0x1b2e40=[];for(var _0x5958ad in _0xebfcde){if(_0xebfcde[_0x6caf('0xf')](_0x5958ad)){_0x934837['priority']=0x2;_0x934837[_0x6caf('0x10')]=[];_0x934837[_0x6caf('0x11')]=_[_0x6caf('0x12')](_0x219788,{'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')]});_0x934837['extensions'][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':_0x6caf('0x15'),'appdata':util[_0x6caf('0x16')](_0x6caf('0x17'),_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')]),'context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837['priority']++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});if(_0xebfcde[_0x5958ad][0x0]['type']==='inbound'){_0x934837[_0x6caf('0x10')][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':_0x6caf('0x15'),'appdata':_0x6caf('0x1a')+_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')],'context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837[_0x6caf('0x1b')]++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});}else if(_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')]===_0x6caf('0x1c')){if(_0x934837[_0x6caf('0x11')]){_0x934837['extensions'][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0]['type'],'app':_0x6caf('0x15'),'appdata':_0x6caf('0x1d')+(_0x934837[_0x6caf('0x11')][_0x6caf('0x1e')]?_0x6caf('0x1f')+_0x934837[_0x6caf('0x11')]['cutdigits']+'}':_0x6caf('0x20')),'context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837['priority']++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});}_0x934837['extensions'][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':'Set','appdata':'CDR(routeid)='+_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')],'context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0]['exten'],'priority':_0x934837[_0x6caf('0x1b')]++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});var _0x5f4f8f=_0x934837[_0x6caf('0x1b')]++;_0x934837[_0x6caf('0x10')][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':_0x6caf('0x21'),'appdata':_0x6caf('0x22')+(_0x5f4f8f+0x2)+_0x6caf('0x23')+(_0x5f4f8f+0x1)+')','context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x5f4f8f,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});if(_0x934837[_0x6caf('0x11')]){_0x934837[_0x6caf('0x10')][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':'Set','appdata':_0x934837[_0x6caf('0x11')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x934837['extension'][_0x6caf('0x1e')]+'}':'CDR(prefix)=noprefix','context':_0xebfcde[_0x5958ad][0x0]['context'],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837['priority']++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});}_0x934837[_0x6caf('0x10')][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':_0x6caf('0x15'),'appdata':_0x6caf('0x24')+_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')],'context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837[_0x6caf('0x1b')]++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});if(_0x934837[_0x6caf('0x11')]&&_0x934837['extension']['hasOwnProperty'](_0x6caf('0x25'))&&_0x934837[_0x6caf('0x11')][_0x6caf('0x25')]!==_0x6caf('0x26')){_0x934837[_0x6caf('0x10')][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0]['type'],'app':_0x6caf('0x15'),'appdata':_0x6caf('0x27'),'context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837[_0x6caf('0x1b')]++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});_0x934837[_0x6caf('0x10')][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x934837['extension'][_0x6caf('0x25')]||'wav','context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837[_0x6caf('0x1b')]++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});}}_0x934837['extensions'][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':_0x6caf('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837[_0x6caf('0x1b')]++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});_0x934837['extensions'][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0]['type'],'app':_0x6caf('0x15'),'appdata':_0x6caf('0x28'),'context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837['priority']++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});_0x934837[_0x6caf('0x10')]['push']({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':_0x6caf('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'priority':_0x934837['priority']++,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});for(var _0x53f0d9=0x0,_0x2b70c1=0x0;_0x53f0d9<_0xebfcde[_0x5958ad][_0x6caf('0x29')];_0x53f0d9+=0x1,_0x2b70c1=0x0){var _0x41e991=_0xebfcde[_0x5958ad][_0x53f0d9];if(_0x41e991['type']){_0x41e991[_0x6caf('0x14')]=_0x41e991['type']['toLowerCase']();}var _0x5df1fa=[];var _0x185b51=[];delete _0x41e991['id'];delete _0x41e991['createdAt'];delete _0x41e991['updatedAt'];var _0x3c3b35=_0x41e991[_0x6caf('0x2a')]!==_0x6caf('0x2b')?[_0x41e991[_0x6caf('0x2a')]]:_0x41e991[_0x6caf('0x7')]?_['map'](_[_0x6caf('0xb')](_0x934837[_0x6caf('0x4')],{'IntervalId':_0x41e991[_0x6caf('0x7')]}),_0x6caf('0x2a')):[];if(_0x41e991[_0x6caf('0xf')](_0x6caf('0x2c'))){if(_0x41e991[_0x6caf('0x2c')]&&_0x41e991[_0x6caf('0x2c')]!=='--'){_0x5df1fa['push']({'type':_0x41e991[_0x6caf('0x14')],'app':_0x6caf('0x15'),'appdata':_0x6caf('0x2d')+_0x41e991[_0x6caf('0x2c')],'context':_0x41e991['context'],'exten':_0x41e991[_0x6caf('0x9')],'priority':_0x3c3b35[_0x6caf('0x29')]+_0x934837['priority']+_0x2b70c1++,'VoiceExtensionId':_0x41e991[_0x6caf('0x19')]});}}if(_0x41e991[_0x6caf('0x14')]===_0x6caf('0x1c')&&_0x41e991[_0x6caf('0xf')](_0x6caf('0x2e'))){if(_0x41e991[_0x6caf('0x2e')]){_0x5df1fa[_0x6caf('0x13')]({'type':_0x41e991['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x41e991[_0x6caf('0x2e')]+')','context':_0x41e991['context'],'exten':_0x41e991[_0x6caf('0x9')],'priority':_0x3c3b35[_0x6caf('0x29')]+_0x934837[_0x6caf('0x1b')]+_0x2b70c1++,'VoiceExtensionId':_0x41e991[_0x6caf('0x19')]});}else{_0x5df1fa[_0x6caf('0x13')]({'type':_0x41e991['type'],'app':_0x6caf('0x21'),'appdata':_0x6caf('0x2f'),'context':_0x41e991[_0x6caf('0x18')],'exten':_0x41e991[_0x6caf('0x9')],'priority':_0x3c3b35[_0x6caf('0x29')]+_0x934837[_0x6caf('0x1b')]+_0x2b70c1++,'VoiceExtensionId':_0x41e991['VoiceExtensionId']});}}if(_0x41e991[_0x6caf('0xf')](_0x6caf('0x30'))){if(_0x439329[_0x6caf('0x31')](_0x41e991['app'][_0x6caf('0x32')]())>=0x0&&_0x41e991[_0x6caf('0x33')]!==_0x6caf('0x34')){if(_0x41e991['answer']){_0x5df1fa['push']({'type':_0x41e991[_0x6caf('0x14')],'app':_0x6caf('0x21'),'appdata':_0x6caf('0x35'),'context':_0x41e991[_0x6caf('0x18')],'exten':_0x41e991[_0x6caf('0x9')],'priority':_0x3c3b35['length']+_0x934837[_0x6caf('0x1b')]+_0x2b70c1++,'VoiceExtensionId':_0x41e991[_0x6caf('0x19')]});_0x5df1fa[_0x6caf('0x13')]({'type':_0x41e991['type'],'app':_0x6caf('0x15'),'appdata':_0x6caf('0x36'),'context':_0x41e991['context'],'exten':_0x41e991['exten'],'priority':_0x3c3b35[_0x6caf('0x29')]+_0x934837['priority']+_0x2b70c1++,'VoiceExtensionId':_0x41e991[_0x6caf('0x19')]});}else{_0x5df1fa[_0x6caf('0x13')]({'type':_0x41e991[_0x6caf('0x14')],'app':_0x6caf('0x21'),'appdata':_0x6caf('0x37'),'context':_0x41e991['context'],'exten':_0x41e991[_0x6caf('0x9')],'priority':_0x3c3b35['length']+_0x934837[_0x6caf('0x1b')]+_0x2b70c1++,'VoiceExtensionId':_0x41e991[_0x6caf('0x19')]});_0x5df1fa[_0x6caf('0x13')]({'type':_0x41e991['type'],'app':_0x6caf('0x15'),'appdata':_0x6caf('0x38'),'context':_0x41e991[_0x6caf('0x18')],'exten':_0x41e991[_0x6caf('0x9')],'priority':_0x3c3b35[_0x6caf('0x29')]+_0x934837[_0x6caf('0x1b')]+_0x2b70c1++,'VoiceExtensionId':_0x41e991[_0x6caf('0x19')]});}}}for(var _0x4d1310=0x0;_0x4d1310<_0x3c3b35[_0x6caf('0x29')];_0x4d1310+=0x1){var _0x260121=_0x934837['priority']+_0x3c3b35[_0x6caf('0x29')];var _0x4c25fb=_0x4d1310===_0x3c3b35['length']-0x1?_0x934837[_0x6caf('0x1b')]+_0x5df1fa[_0x6caf('0x29')]+_0x185b51[_0x6caf('0x29')]+0x2:_0x934837[_0x6caf('0x1b')]+_0x4d1310+0x1;_0x5df1fa[_0x6caf('0x39')](_0x4d1310,0x0,{'type':_0x41e991[_0x6caf('0x14')],'app':_0x6caf('0x3a'),'appdata':_0x3c3b35[_0x4d1310]+'?'+_0x41e991[_0x6caf('0x18')]+_0x6caf('0x3b')+_0x260121+':'+_0x41e991[_0x6caf('0x18')]+_0x6caf('0x3b')+_0x4c25fb,'exten':_0x41e991[_0x6caf('0x9')],'context':_0x41e991[_0x6caf('0x18')],'priority':_0x934837['priority']+_0x4d1310,'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x19')]});}_0x41e991[_0x6caf('0x1b')]=_0x5df1fa[_0x6caf('0x29')]?_[_0x6caf('0x3c')](_0x5df1fa)['priority']+0x1:_0x934837[_0x6caf('0x1b')];_0x934837[_0x6caf('0x1b')]=(_0x185b51[_0x6caf('0x29')]?_[_0x6caf('0x3c')](_0x185b51)[_0x6caf('0x1b')]:_0x41e991['priority'])+0x1;_0x934837[_0x6caf('0x10')]=_[_0x6caf('0x3d')](_0x934837[_0x6caf('0x10')],_0x5df1fa,[_0x41e991],_0x185b51);}_0x934837[_0x6caf('0x10')][_0x6caf('0x13')]({'type':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x14')],'app':_0x6caf('0x3e'),'exten':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x9')],'context':_0xebfcde[_0x5958ad][0x0][_0x6caf('0x18')],'priority':_0x934837[_0x6caf('0x1b')],'VoiceExtensionId':_0xebfcde[_0x5958ad][0x0]['VoiceExtensionId']});_0x5a59e3[_0x6caf('0x13')](_0xebfcde[_0x5958ad][0x0]['VoiceExtensionId']);_0x1b2e40=_[_0x6caf('0x3d')](_0x1b2e40,_0x934837[_0x6caf('0x10')]);}}return _0x55c1a8['transaction'](function(_0x24b0e5){return _0x55c1a8[_0x6caf('0x1')][_0x6caf('0x5')][_0x6caf('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x5a59e3}},'transaction':_0x24b0e5})['then'](function(_0x2bfbf0){return _0x55c1a8[_0x6caf('0x1')][_0x6caf('0x5')][_0x6caf('0x40')](_[_0x6caf('0x41')](_0x1b2e40,_0x6caf('0x1b')),{'transaction':_0x24b0e5});});});})[_0x6caf('0x42')](function(_0x28f743){console['error'](_0x28f743);});}exports[_0x6caf('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 682b121..6f0f0f2 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 _0x2ba8=['argv','undefined','null','split','Missing\x20ListId\x20parameter!','error','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','updatedAt','select','field','NOW()','ContactId','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','createdAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','then','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','findAll','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','message','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x1e6766,_0x38810d){var _0x56df5e=function(_0x25cd44){while(--_0x25cd44){_0x1e6766['push'](_0x1e6766['shift']());}};_0x56df5e(++_0x38810d);}(_0x2ba8,0x1a2));var _0x82ba=function(_0x16b683,_0x1de3db){_0x16b683=_0x16b683-0x0;var _0x25c35c=_0x2ba8[_0x16b683];return _0x25c35c;};'use strict';var BPromise=require(_0x82ba('0x0'));var util=require('util');var _=require(_0x82ba('0x1'));var fs=require('fs');var squel=require(_0x82ba('0x2'));var Papa=require(_0x82ba('0x3'));var Redis=require(_0x82ba('0x4'));var db=require(_0x82ba('0x5'))['db'];var config=require(_0x82ba('0x6'));var logger=require(_0x82ba('0x7'))(_0x82ba('0x8'));config['redis']=_[_0x82ba('0x9')](config[_0x82ba('0xa')],{'host':_0x82ba('0xb'),'port':0x18eb});var socket=require(_0x82ba('0xc'))(new Redis(config[_0x82ba('0xa')]));require('../../../api/cmContact/cmContact.socket')[_0x82ba('0xd')](socket);try{if(!process[_0x82ba('0xe')][0x2]||process[_0x82ba('0xe')][0x2]===_0x82ba('0xf')||process[_0x82ba('0xe')][0x2]===_0x82ba('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x82ba('0xe')][0x2];if(!process[_0x82ba('0xe')][0x3]||process[_0x82ba('0xe')][0x3]===_0x82ba('0xf')||process['argv'][0x3]===_0x82ba('0x10')||!process[_0x82ba('0xe')][0x4]||process[_0x82ba('0xe')][0x4]===_0x82ba('0xf')||process[_0x82ba('0xe')][0x4]===_0x82ba('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x82ba('0xe')][0x3][_0x82ba('0x11')](','),process[_0x82ba('0xe')][0x4]['split'](','));if(!process[_0x82ba('0xe')][0x5]||process[_0x82ba('0xe')][0x5]===_0x82ba('0xf')||process[_0x82ba('0xe')][0x5]===_0x82ba('0x10')){throw new Error(_0x82ba('0x12'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x82ba('0xe')][0x6]&&process['argv'][0x6]!==_0x82ba('0xf')&&process[_0x82ba('0xe')][0x6]!==_0x82ba('0x10')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x82ba('0xe')][0x7]!==_0x82ba('0xf')&&process[_0x82ba('0xe')][0x7]!==_0x82ba('0x10')?process[_0x82ba('0xe')][0x7]:null;if(!process[_0x82ba('0xe')][0x8]||process['argv'][0x8]===_0x82ba('0xf')||process[_0x82ba('0xe')][0x8]===_0x82ba('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x52bf3f){logger[_0x82ba('0x13')](_0x52bf3f);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(_0x1b9f33,_0x13e63d,_0xc60c5c,_0x1ece90){var _0x5d0447={'message':_0x13e63d};_0x5d0447[_0x1b9f33]=!![];if(_0xc60c5c){_0x5d0447['contact']=_0xc60c5c;}if(_0x1ece90){_0x5d0447['index']=_0x1ece90;}return _0x5d0447;}function isEmail(_0x34ec9f){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'](_0x34ec9f);}function checkRow(_0xab23e0,_0x5ac9b8,_0x17e7c4){return new BPromise(function(_0x109049,_0x25c861){if(_[_0x82ba('0x14')](_0xab23e0)){return _0x25c861(handleCheckRowError('error',_0x82ba('0x15'),null,_0x17e7c4));}if(_0xab23e0[_0x82ba('0x16')]&&_0xab23e0['errors'][_0x82ba('0x17')]){var _0x69dd53=_[_0x82ba('0x18')](_0xab23e0[_0x82ba('0x16')],'message')[_0x82ba('0x19')](';');return _0x25c861(handleCheckRowError('error',_0x69dd53,null,_0x17e7c4));}var _0x41160d={};for(var _0x53356e in FIELDS){if(FIELDS[_0x82ba('0x1a')](_0x53356e)&&FIELDS[_0x53356e]){_0x41160d[_0x53356e]=_0xab23e0[_0x82ba('0x1b')][0x0][FIELDS[_0x53356e]]||_0xab23e0[_0x82ba('0x1b')][0x0]['\ufeff'+FIELDS[_0x53356e]];}}if(!_0x41160d['firstName']){return _0x25c861(handleCheckRowError(_0x82ba('0x13'),_0x82ba('0x1c'),null,_0x17e7c4));}if(!_0x41160d['phone']){return _0x25c861(handleCheckRowError(_0x82ba('0x13'),'phone\x20not\x20specified!',null,_0x17e7c4));}if(_0x41160d['birthDate']){var _0x520e78=moment(_0x41160d[_0x82ba('0x1d')],_0x82ba('0x1e'));if(!_0x520e78[_0x82ba('0x1f')]()){return _0x25c861(handleCheckRowError(_0x82ba('0x13'),_0x82ba('0x20'),null,_0x17e7c4));}}if(_0x41160d[_0x82ba('0x21')]){if(!isEmail(_0x41160d['email'])){return _0x25c861(handleCheckRowError('error',_0x82ba('0x22'),null,_0x17e7c4));}}_0x41160d[_0x82ba('0x23')]=LISTID;_0x41160d[_0x82ba('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x82ba('0x17')]&&_0x5ac9b8){var _0x328d42={};for(var _0x12ed9a=0x0,_0x469920=DUPLICATES['length'];_0x12ed9a<_0x469920;_0x12ed9a+=0x1){_0x328d42[DUPLICATES[_0x12ed9a]]=_0x41160d[DUPLICATES[_0x12ed9a]];}var _0x42421f=_[_0x82ba('0x25')](_0x5ac9b8,_0x328d42);if(_0x42421f){return _0x25c861(handleCheckRowError(_0x82ba('0x26'),'Duplicate\x20Contact',_0x42421f,_0x17e7c4));}}return db[_0x82ba('0x27')][_0x82ba('0x28')](_0x41160d,{'raw':!![],'hooks':![],'fields':_[_0x82ba('0x29')](_0x41160d)})['then'](function(_0x4f736f){if(DUPLICATES&&DUPLICATES[_0x82ba('0x17')]&&_0x5ac9b8){_0x5ac9b8[_0x82ba('0x2a')](_[_0x82ba('0x2b')](_0x41160d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4f736f['id'];return _0x109049();})[_0x82ba('0x2c')](function(_0x2f50d9){return _0x25c861(handleCheckRowError(_0x82ba('0x13'),_0x82ba('0x2d')+(_0x2f50d9['message']||JSON[_0x82ba('0x2e')](_0x2f50d9)),null,_0x17e7c4));});});}function checkHopper(){function _0x3c93da(){return function(_0x14512f){logger[_0x82ba('0x13')](_0x82ba('0x2f'),'checkHopper',util[_0x82ba('0x30')](_0x14512f,{'showHidden':![],'depth':null}));};}var _0x442f86=function(_0x3d136a,_0x5d2d43){var _0x59628f=squel[_0x82ba('0x31')]()[_0x82ba('0x32')](_0x82ba('0x33'))[_0x82ba('0x34')]([_0x82ba('0x35'),_0x82ba('0x36'),'ContactId',_0x82ba('0x23'),_0x5d2d43,'createdAt',_0x82ba('0x37')],squel[_0x82ba('0x38')]()[_0x82ba('0x39')](_0x82ba('0x35'),_0x82ba('0x35'))[_0x82ba('0x39')](_0x82ba('0x3a'),_0x82ba('0x36'))[_0x82ba('0x39')]('id',_0x82ba('0x3b'))[_0x82ba('0x39')](LISTID['toString'](),'ListId')[_0x82ba('0x39')](_0x3d136a['id']['toString'](),_0x5d2d43)[_0x82ba('0x39')]('NOW()','createdAt')[_0x82ba('0x39')]('NOW()',_0x82ba('0x37'))[_0x82ba('0x3c')](_0x82ba('0x3d'))[_0x82ba('0x3e')](_0x82ba('0x3f'))[_0x82ba('0x3e')](_0x82ba('0x40'),LISTID[_0x82ba('0x41')]())[_0x82ba('0x3e')](_0x82ba('0x42'))[_0x82ba('0x3e')](_0x82ba('0x43'),squel['select']()[_0x82ba('0x39')]('phone')['from'](_0x82ba('0x33'))[_0x82ba('0x3e')](_0x5d2d43+_0x82ba('0x44'),_0x3d136a['id'][_0x82ba('0x41')]())))['toString']();return _0x59628f;};var _0x3795d4=function(_0x3053be,_0x1a1c64){var _0x5973be=squel['insert']()['into'](_0x82ba('0x33'))['fromQuery']([_0x82ba('0x35'),_0x82ba('0x36'),_0x82ba('0x3b'),'ListId',_0x1a1c64,'createdAt',_0x82ba('0x37')],squel[_0x82ba('0x38')]()[_0x82ba('0x39')](_0x82ba('0x35'),_0x82ba('0x35'))[_0x82ba('0x39')](_0x82ba('0x3a'),_0x82ba('0x36'))[_0x82ba('0x39')]('id',_0x82ba('0x3b'))[_0x82ba('0x39')](LISTID[_0x82ba('0x41')](),_0x82ba('0x23'))[_0x82ba('0x39')](_0x3053be['id'][_0x82ba('0x41')](),_0x1a1c64)['field']('NOW()',_0x82ba('0x45'))[_0x82ba('0x39')](_0x82ba('0x3a'),'updatedAt')[_0x82ba('0x3c')](_0x82ba('0x3d'))[_0x82ba('0x3e')](_0x82ba('0x3f'))[_0x82ba('0x3e')](_0x82ba('0x40'),LISTID[_0x82ba('0x41')]())[_0x82ba('0x3e')](_0x82ba('0x46'),squel[_0x82ba('0x47')](hopperContacts))[_0x82ba('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x82ba('0x3e')](_0x82ba('0x43'),squel[_0x82ba('0x38')]()[_0x82ba('0x39')](_0x82ba('0x48'))[_0x82ba('0x3c')](_0x82ba('0x49'))[_0x82ba('0x3e')](_0x1a1c64+'\x20=\x20?',_0x3053be['id'][_0x82ba('0x41')]()))[_0x82ba('0x3e')](_0x82ba('0x43'),squel[_0x82ba('0x38')]()[_0x82ba('0x39')]('phone')[_0x82ba('0x3c')]('cm_hopper')[_0x82ba('0x3e')](_0x1a1c64+_0x82ba('0x44'),_0x3053be['id'][_0x82ba('0x41')]())))[_0x82ba('0x41')]();return _0x5973be;};function _0x2c7ef3(_0x42dac8,_0x3513ff){var _0x9bf345=squel[_0x82ba('0x31')]()[_0x82ba('0x32')](_0x82ba('0x33'))[_0x82ba('0x34')](['phone',_0x82ba('0x36'),'ContactId','ListId',_0x3513ff,_0x82ba('0x45'),_0x82ba('0x37')],squel['select']()['field'](_0x82ba('0x35'),_0x82ba('0x35'))[_0x82ba('0x39')](_0x82ba('0x3a'),'scheduledAt')['field']('id',_0x82ba('0x3b'))[_0x82ba('0x39')](LISTID['toString'](),_0x82ba('0x23'))[_0x82ba('0x39')](_0x42dac8['id'][_0x82ba('0x41')](),_0x3513ff)['field'](_0x82ba('0x3a'),_0x82ba('0x45'))['field'](_0x82ba('0x3a'),_0x82ba('0x37'))[_0x82ba('0x3c')]('cm_contacts')['where'](_0x82ba('0x3f'))[_0x82ba('0x3e')](_0x82ba('0x40'),LISTID[_0x82ba('0x41')]())[_0x82ba('0x3e')](_0x82ba('0x46'),squel[_0x82ba('0x47')](hopperContacts))[_0x82ba('0x3e')](_0x82ba('0x42')))[_0x82ba('0x41')]();return _0x9bf345;}function _0x4ed2bc(_0x13a370,_0x472f90){var _0x16cb28=squel[_0x82ba('0x31')]()[_0x82ba('0x32')](_0x82ba('0x4a'))[_0x82ba('0x34')]([_0x82ba('0x35'),_0x82ba('0x3b'),_0x82ba('0x23'),_0x472f90,_0x82ba('0x45'),'updatedAt'],squel[_0x82ba('0x38')]()['field'](_0x82ba('0x35'),_0x82ba('0x35'))[_0x82ba('0x39')]('id','ContactId')[_0x82ba('0x39')](LISTID[_0x82ba('0x41')](),'ListId')[_0x82ba('0x39')](_0x13a370['id']['toString'](),_0x472f90)['field'](_0x82ba('0x3a'),_0x82ba('0x45'))['field'](_0x82ba('0x3a'),_0x82ba('0x37'))[_0x82ba('0x3c')](_0x82ba('0x3d'))['where'](_0x82ba('0x3f'))[_0x82ba('0x3e')](_0x82ba('0x40'),LISTID[_0x82ba('0x41')]())[_0x82ba('0x3e')](_0x82ba('0x46'),squel[_0x82ba('0x47')](hopperContacts))[_0x82ba('0x3e')](_0x82ba('0x42')))[_0x82ba('0x41')]();return _0x16cb28;}return db[_0x82ba('0x4b')]['findAll']({'where':{'type':_0x82ba('0x4c')},'attributes':['id',_0x82ba('0x4d')],'include':[{'model':db[_0x82ba('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0x82ba('0x4f')](function(_0xfe40f8){var _0x49ddcb=[];if(_0xfe40f8){var _0x471a55;for(var _0x4a485b=0x0,_0x4e9b53;_0x4a485b<_0xfe40f8[_0x82ba('0x17')];_0x4a485b+=0x1){_0x4e9b53=_0xfe40f8[_0x4a485b][_0x82ba('0x50')]({'plain':!![]});switch(_0x4e9b53['dialCheckDuplicateType']){case _0x82ba('0x51'):_0x49ddcb[_0x82ba('0x2a')](db[_0x82ba('0x52')]['query'](_0x3795d4(_0x4e9b53,_0x82ba('0x53')))['then'](function(){})[_0x82ba('0x2c')](_0x3c93da()));break;case _0x82ba('0x54'):_0x49ddcb[_0x82ba('0x2a')](db[_0x82ba('0x52')][_0x82ba('0x55')](_0x442f86(_0x4e9b53,_0x82ba('0x53')))['then'](function(){})[_0x82ba('0x2c')](_0x3c93da()));break;default:_0x49ddcb[_0x82ba('0x2a')](db[_0x82ba('0x52')][_0x82ba('0x55')](_0x2c7ef3(_0x4e9b53,_0x82ba('0x53')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));}}}return _0x49ddcb;})[_0x82ba('0x56')]()['then'](function(){return db[_0x82ba('0x4b')][_0x82ba('0x57')]({'where':{'type':_0x82ba('0x4c')},'attributes':['id'],'include':[{'model':db[_0x82ba('0x4e')],'as':_0x82ba('0x58'),'where':{'id':LISTID}}]})[_0x82ba('0x4f')](function(_0x23d766){var _0x283df3=[];if(_0x23d766){var _0x10ff84;for(var _0x5f1851=0x0,_0x308efc;_0x5f1851<_0x23d766[_0x82ba('0x17')];_0x5f1851+=0x1){_0x308efc=_0x23d766[_0x5f1851][_0x82ba('0x50')]({'plain':!![]});_0x283df3[_0x82ba('0x2a')](db['sequelize'][_0x82ba('0x55')](_0x4ed2bc(_0x308efc,_0x82ba('0x53')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));}}return _0x283df3;})[_0x82ba('0x56')]();})['then'](function(){return db[_0x82ba('0x59')][_0x82ba('0x57')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x82ba('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0x82ba('0x4f')](function(_0xcc78f9){var _0x2a2161=[];if(_0xcc78f9){for(var _0x150920=0x0,_0x19aa0e;_0x150920<_0xcc78f9[_0x82ba('0x17')];_0x150920+=0x1){_0x19aa0e=_0xcc78f9[_0x150920][_0x82ba('0x50')]({'plain':!![]});switch(_0x19aa0e[_0x82ba('0x4d')]){case'always':_0x2a2161[_0x82ba('0x2a')](db[_0x82ba('0x52')][_0x82ba('0x55')](_0x3795d4(_0x19aa0e,_0x82ba('0x5a')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));break;case _0x82ba('0x54'):_0x2a2161[_0x82ba('0x2a')](db['sequelize']['query'](_0x442f86(_0x19aa0e,_0x82ba('0x5a')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));break;default:_0x2a2161[_0x82ba('0x2a')](db[_0x82ba('0x52')]['query'](_0x2c7ef3(_0x19aa0e,_0x82ba('0x5a')))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));}}}return _0x2a2161;})['all']();})[_0x82ba('0x4f')](function(){return db[_0x82ba('0x59')][_0x82ba('0x57')]({'attributes':['id'],'include':[{'model':db[_0x82ba('0x4e')],'as':_0x82ba('0x58'),'where':{'id':LISTID}}]})['then'](function(_0xacf681){var _0x375752=[];if(_0xacf681){for(var _0x49f987=0x0,_0x4ad992;_0x49f987<_0xacf681[_0x82ba('0x17')];_0x49f987+=0x1){_0x4ad992=_0xacf681[_0x49f987]['get']({'plain':!![]});_0x375752[_0x82ba('0x2a')](db[_0x82ba('0x52')][_0x82ba('0x55')](_0x4ed2bc(_0x4ad992,'CampaignId'))[_0x82ba('0x4f')](function(){})[_0x82ba('0x2c')](_0x3c93da()));}}return _0x375752;})[_0x82ba('0x56')]();})[_0x82ba('0x2c')](function(_0x3a2e71){logger[_0x82ba('0x13')](_0x82ba('0x5b'),'generalCheckHopper',_0x3a2e71[_0x82ba('0x5c')]);});}var processPromises=function(_0xe7893d){return BPromise['all'](promises)[_0x82ba('0x4f')](function(_0x5b147c){})[_0x82ba('0x2c')](function(_0x664e8e){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x82ba('0x2e')](_0x664e8e));})[_0x82ba('0x5d')](function(){socket[_0x82ba('0x5e')](_0x82ba('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xe7893d){return _0xe7893d[_0x82ba('0x60')]();}});};var endCsv=function(){return BPromise[_0x82ba('0x61')]()[_0x82ba('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0x82ba('0x4f')](function(){socket['emit'](_0x82ba('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x82ba('0x62')](FILEPATH);}catch(_0x4e3a59){logger['error'](_0x82ba('0x63'),JSON[_0x82ba('0x2e')](_0x4e3a59));}finally{process['exit'](0x0);}});};process['on'](_0x82ba('0x64'),function(){logger['info'](_0x82ba('0x65'));endCsv();});function main(){return BPromise[_0x82ba('0x61')]()[_0x82ba('0x4f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x82ba('0x11')](',');return db['CmContact']['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1dbae5){var _0x2d8c02=fs[_0x82ba('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x82ba('0x67')](_0x2d8c02,{'header':!![],'skipEmptyLines':!![],'step':function(_0x26d146,_0x1debe6){total+=0x1;var _0x13c6cd=total;promises[_0x82ba('0x2a')](checkRow(_0x26d146,_0x1dbae5,_0x13c6cd)[_0x82ba('0x4f')](function(){success+=0x1;})[_0x82ba('0x2c')](function(_0x3f10e5){if(_0x3f10e5[_0x82ba('0x13')]){errors+=0x1;delete _0x3f10e5[_0x82ba('0x13')];}else if(_0x3f10e5[_0x82ba('0x26')]){duplicates+=0x1;delete _0x3f10e5[_0x82ba('0x26')];}rows[_0x82ba('0x2a')](_0x3f10e5);}));if(total%0xc8===0x0){_0x1debe6[_0x82ba('0x68')]();return processPromises(_0x1debe6);}},'complete':function(){return processPromises()[_0x82ba('0x4f')](function(){logger[_0x82ba('0x69')](_0x82ba('0x6a'));endCsv();});},'error':function(_0x9b1984,_0x39afff){logger[_0x82ba('0x69')]('CSV\x20parse\x20error',JSON[_0x82ba('0x2e')](_0x9b1984));endCsv();}});})[_0x82ba('0x2c')](function(_0x2b1701){logger[_0x82ba('0x13')](_0x82ba('0x6b'),JSON[_0x82ba('0x2e')](_0x2b1701));});}main(); \ No newline at end of file +var _0x2e4e=['bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','push','pick','catch','stringify','cmContact','checkHopper','inspect','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','VoiceQueue','findAll','outbound','Lists','then','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','CmList','BlackLists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:'];(function(_0x2553bf,_0x29c8f7){var _0x555ff4=function(_0xe2dc9b){while(--_0xe2dc9b){_0x2553bf['push'](_0x2553bf['shift']());}};_0x555ff4(++_0x29c8f7);}(_0x2e4e,0x1b0));var _0xe2e4=function(_0x226e7e,_0x36583c){_0x226e7e=_0x226e7e-0x0;var _0x4b3e3b=_0x2e4e[_0x226e7e];return _0x4b3e3b;};'use strict';var BPromise=require(_0xe2e4('0x0'));var util=require('util');var _=require(_0xe2e4('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xe2e4('0x2'));var Redis=require('ioredis');var db=require(_0xe2e4('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0xe2e4('0x4'))(_0xe2e4('0x5'));config[_0xe2e4('0x6')]=_[_0xe2e4('0x7')](config['redis'],{'host':_0xe2e4('0x8'),'port':0x18eb});var socket=require(_0xe2e4('0x9'))(new Redis(config[_0xe2e4('0x6')]));require(_0xe2e4('0xa'))[_0xe2e4('0xb')](socket);try{if(!process[_0xe2e4('0xc')][0x2]||process[_0xe2e4('0xc')][0x2]===_0xe2e4('0xd')||process[_0xe2e4('0xc')][0x2]===_0xe2e4('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xe2e4('0xc')][0x2];if(!process['argv'][0x3]||process[_0xe2e4('0xc')][0x3]===_0xe2e4('0xd')||process[_0xe2e4('0xc')][0x3]===_0xe2e4('0xe')||!process[_0xe2e4('0xc')][0x4]||process[_0xe2e4('0xc')][0x4]===_0xe2e4('0xd')||process[_0xe2e4('0xc')][0x4]===_0xe2e4('0xe')){throw new Error(_0xe2e4('0xf'));}var FIELDS=_[_0xe2e4('0x10')](process[_0xe2e4('0xc')][0x3]['split'](','),process[_0xe2e4('0xc')][0x4][_0xe2e4('0x11')](','));if(!process[_0xe2e4('0xc')][0x5]||process[_0xe2e4('0xc')][0x5]===_0xe2e4('0xd')||process[_0xe2e4('0xc')][0x5]==='null'){throw new Error(_0xe2e4('0x12'));}var LISTID=process[_0xe2e4('0xc')][0x5];var COMPANYID=process[_0xe2e4('0xc')][0x6]&&process[_0xe2e4('0xc')][0x6]!=='undefined'&&process['argv'][0x6]!==_0xe2e4('0xe')?process[_0xe2e4('0xc')][0x6]:null;var DUPLICATES=process[_0xe2e4('0xc')][0x7]&&process[_0xe2e4('0xc')][0x7]!=='undefined'&&process['argv'][0x7]!=='null'?process[_0xe2e4('0xc')][0x7]:null;if(!process[_0xe2e4('0xc')][0x8]||process[_0xe2e4('0xc')][0x8]===_0xe2e4('0xd')||process[_0xe2e4('0xc')][0x8]===_0xe2e4('0xe')){throw new Error(_0xe2e4('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x58da6c){logger[_0xe2e4('0x14')](_0x58da6c);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(_0x322585,_0x490a0d,_0x2153e8,_0x2c9096){var _0x415b47={'message':_0x490a0d};_0x415b47[_0x322585]=!![];if(_0x2153e8){_0x415b47[_0xe2e4('0x15')]=_0x2153e8;}if(_0x2c9096){_0x415b47[_0xe2e4('0x16')]=_0x2c9096;}return _0x415b47;}function isEmail(_0x540c95){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'](_0x540c95);}function checkRow(_0x259056,_0x123f09,_0x3a8332){return new BPromise(function(_0x4e3338,_0x889fdb){if(_[_0xe2e4('0x17')](_0x259056)){return _0x889fdb(handleCheckRowError('error',_0xe2e4('0x18'),null,_0x3a8332));}if(_0x259056['errors']&&_0x259056[_0xe2e4('0x19')][_0xe2e4('0x1a')]){var _0xcb63d0=_[_0xe2e4('0x1b')](_0x259056[_0xe2e4('0x19')],_0xe2e4('0x1c'))[_0xe2e4('0x1d')](';');return _0x889fdb(handleCheckRowError(_0xe2e4('0x14'),_0xcb63d0,null,_0x3a8332));}var _0x284c03={};for(var _0x2c240f in FIELDS){if(FIELDS[_0xe2e4('0x1e')](_0x2c240f)&&FIELDS[_0x2c240f]){_0x284c03[_0x2c240f]=_0x259056[_0xe2e4('0x1f')][0x0][FIELDS[_0x2c240f]]||_0x259056[_0xe2e4('0x1f')][0x0]['\ufeff'+FIELDS[_0x2c240f]];}}if(!_0x284c03[_0xe2e4('0x20')]){return _0x889fdb(handleCheckRowError(_0xe2e4('0x14'),_0xe2e4('0x21'),null,_0x3a8332));}if(!_0x284c03[_0xe2e4('0x22')]){return _0x889fdb(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x3a8332));}if(_0x284c03[_0xe2e4('0x23')]){var _0x18d6d9=moment(_0x284c03[_0xe2e4('0x23')],_0xe2e4('0x24'));if(!_0x18d6d9['isValid']()){return _0x889fdb(handleCheckRowError(_0xe2e4('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3a8332));}}if(_0x284c03[_0xe2e4('0x25')]){if(!isEmail(_0x284c03[_0xe2e4('0x25')])){return _0x889fdb(handleCheckRowError('error',_0xe2e4('0x26'),null,_0x3a8332));}}_0x284c03[_0xe2e4('0x27')]=LISTID;_0x284c03['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe2e4('0x1a')]&&_0x123f09){var _0x839596={};for(var _0xc0147f=0x0,_0x39b670=DUPLICATES[_0xe2e4('0x1a')];_0xc0147f<_0x39b670;_0xc0147f+=0x1){_0x839596[DUPLICATES[_0xc0147f]]=_0x284c03[DUPLICATES[_0xc0147f]];}var _0x470174=_[_0xe2e4('0x28')](_0x123f09,_0x839596);if(_0x470174){return _0x889fdb(handleCheckRowError(_0xe2e4('0x29'),_0xe2e4('0x2a'),_0x470174,_0x3a8332));}}return db[_0xe2e4('0x2b')]['create'](_0x284c03,{'raw':!![],'hooks':![],'fields':_['keys'](_0x284c03)})['then'](function(_0x30aea3){if(DUPLICATES&&DUPLICATES[_0xe2e4('0x1a')]&&_0x123f09){_0x123f09[_0xe2e4('0x2c')](_[_0xe2e4('0x2d')](_0x284c03,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x30aea3['id'];return _0x4e3338();})[_0xe2e4('0x2e')](function(_0x3e0b02){return _0x889fdb(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x3e0b02[_0xe2e4('0x1c')]||JSON[_0xe2e4('0x2f')](_0x3e0b02)),null,_0x3a8332));});});}function checkHopper(){function _0x3e566c(){return function(_0x32d936){logger[_0xe2e4('0x14')](_0xe2e4('0x30'),_0xe2e4('0x31'),util[_0xe2e4('0x32')](_0x32d936,{'showHidden':![],'depth':null}));};}var _0x4fb347=function(_0x287174,_0xddab5b){var _0x52e074=squel['insert']()['into'](_0xe2e4('0x33'))[_0xe2e4('0x34')]([_0xe2e4('0x22'),'scheduledAt',_0xe2e4('0x35'),_0xe2e4('0x27'),_0xddab5b,_0xe2e4('0x36'),_0xe2e4('0x37')],squel[_0xe2e4('0x38')]()[_0xe2e4('0x39')]('phone',_0xe2e4('0x22'))[_0xe2e4('0x39')](_0xe2e4('0x3a'),_0xe2e4('0x3b'))[_0xe2e4('0x39')]('id',_0xe2e4('0x35'))['field'](LISTID[_0xe2e4('0x3c')](),_0xe2e4('0x27'))[_0xe2e4('0x39')](_0x287174['id'][_0xe2e4('0x3c')](),_0xddab5b)['field'](_0xe2e4('0x3a'),_0xe2e4('0x36'))[_0xe2e4('0x39')](_0xe2e4('0x3a'),_0xe2e4('0x37'))[_0xe2e4('0x3d')](_0xe2e4('0x3e'))[_0xe2e4('0x3f')](_0xe2e4('0x40'))[_0xe2e4('0x3f')](_0xe2e4('0x41'),LISTID[_0xe2e4('0x3c')]())[_0xe2e4('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0xe2e4('0x3f')](_0xe2e4('0x42'),squel[_0xe2e4('0x38')]()[_0xe2e4('0x39')](_0xe2e4('0x22'))[_0xe2e4('0x3d')](_0xe2e4('0x33'))[_0xe2e4('0x3f')](_0xddab5b+_0xe2e4('0x43'),_0x287174['id'][_0xe2e4('0x3c')]())))[_0xe2e4('0x3c')]();return _0x52e074;};var _0x1e2606=function(_0x365959,_0x393ef0){var _0x3ce429=squel[_0xe2e4('0x44')]()[_0xe2e4('0x45')]('cm_hopper')['fromQuery'](['phone',_0xe2e4('0x3b'),'ContactId','ListId',_0x393ef0,_0xe2e4('0x36'),_0xe2e4('0x37')],squel[_0xe2e4('0x38')]()[_0xe2e4('0x39')](_0xe2e4('0x22'),_0xe2e4('0x22'))[_0xe2e4('0x39')](_0xe2e4('0x3a'),'scheduledAt')[_0xe2e4('0x39')]('id',_0xe2e4('0x35'))[_0xe2e4('0x39')](LISTID[_0xe2e4('0x3c')](),'ListId')[_0xe2e4('0x39')](_0x365959['id'][_0xe2e4('0x3c')](),_0x393ef0)[_0xe2e4('0x39')](_0xe2e4('0x3a'),'createdAt')[_0xe2e4('0x39')](_0xe2e4('0x3a'),'updatedAt')['from'](_0xe2e4('0x3e'))[_0xe2e4('0x3f')](_0xe2e4('0x40'))[_0xe2e4('0x3f')]('ListId\x20=\x20?',LISTID[_0xe2e4('0x3c')]())[_0xe2e4('0x3f')](_0xe2e4('0x46'),squel[_0xe2e4('0x47')](hopperContacts))[_0xe2e4('0x3f')](_0xe2e4('0x48'))[_0xe2e4('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe2e4('0x38')]()[_0xe2e4('0x39')]('calleridnum')[_0xe2e4('0x3d')]('cm_hopper_final')[_0xe2e4('0x3f')](_0x393ef0+_0xe2e4('0x43'),_0x365959['id']['toString']()))['where'](_0xe2e4('0x42'),squel['select']()['field'](_0xe2e4('0x22'))[_0xe2e4('0x3d')](_0xe2e4('0x33'))[_0xe2e4('0x3f')](_0x393ef0+_0xe2e4('0x43'),_0x365959['id'][_0xe2e4('0x3c')]())))[_0xe2e4('0x3c')]();return _0x3ce429;};function _0x2629a1(_0x4c5017,_0x5361db){var _0x1d188f=squel['insert']()[_0xe2e4('0x45')](_0xe2e4('0x33'))[_0xe2e4('0x34')]([_0xe2e4('0x22'),_0xe2e4('0x3b'),_0xe2e4('0x35'),'ListId',_0x5361db,_0xe2e4('0x36'),_0xe2e4('0x37')],squel[_0xe2e4('0x38')]()[_0xe2e4('0x39')]('phone',_0xe2e4('0x22'))['field'](_0xe2e4('0x3a'),'scheduledAt')[_0xe2e4('0x39')]('id',_0xe2e4('0x35'))[_0xe2e4('0x39')](LISTID[_0xe2e4('0x3c')](),'ListId')[_0xe2e4('0x39')](_0x4c5017['id'][_0xe2e4('0x3c')](),_0x5361db)[_0xe2e4('0x39')]('NOW()',_0xe2e4('0x36'))['field'](_0xe2e4('0x3a'),_0xe2e4('0x37'))[_0xe2e4('0x3d')](_0xe2e4('0x3e'))['where']('deletedAt\x20IS\x20NULL')[_0xe2e4('0x3f')](_0xe2e4('0x41'),LISTID[_0xe2e4('0x3c')]())['where'](_0xe2e4('0x46'),squel[_0xe2e4('0x47')](hopperContacts))[_0xe2e4('0x3f')](_0xe2e4('0x48')))[_0xe2e4('0x3c')]();return _0x1d188f;}function _0x411d5a(_0x3075a1,_0x2e4514){var _0x3ecc06=squel['insert']()['into']('cm_hopper_black')[_0xe2e4('0x34')]([_0xe2e4('0x22'),_0xe2e4('0x35'),_0xe2e4('0x27'),_0x2e4514,'createdAt',_0xe2e4('0x37')],squel[_0xe2e4('0x38')]()[_0xe2e4('0x39')](_0xe2e4('0x22'),'phone')[_0xe2e4('0x39')]('id','ContactId')[_0xe2e4('0x39')](LISTID[_0xe2e4('0x3c')](),'ListId')['field'](_0x3075a1['id'][_0xe2e4('0x3c')](),_0x2e4514)[_0xe2e4('0x39')](_0xe2e4('0x3a'),_0xe2e4('0x36'))['field'](_0xe2e4('0x3a'),_0xe2e4('0x37'))['from'](_0xe2e4('0x3e'))[_0xe2e4('0x3f')]('deletedAt\x20IS\x20NULL')[_0xe2e4('0x3f')]('ListId\x20=\x20?',LISTID[_0xe2e4('0x3c')]())['where'](_0xe2e4('0x46'),squel[_0xe2e4('0x47')](hopperContacts))[_0xe2e4('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0xe2e4('0x3c')]();return _0x3ecc06;}return db[_0xe2e4('0x49')][_0xe2e4('0x4a')]({'where':{'type':_0xe2e4('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xe2e4('0x4c'),'where':{'id':LISTID}}]})[_0xe2e4('0x4d')](function(_0x3e15b7){var _0x506764=[];if(_0x3e15b7){var _0x46296c;for(var _0x166c7e=0x0,_0x554133;_0x166c7e<_0x3e15b7[_0xe2e4('0x1a')];_0x166c7e+=0x1){_0x554133=_0x3e15b7[_0x166c7e][_0xe2e4('0x4e')]({'plain':!![]});switch(_0x554133[_0xe2e4('0x4f')]){case _0xe2e4('0x50'):_0x506764[_0xe2e4('0x2c')](db[_0xe2e4('0x51')][_0xe2e4('0x52')](_0x1e2606(_0x554133,_0xe2e4('0x53')))[_0xe2e4('0x4d')](function(){})['catch'](_0x3e566c()));break;case _0xe2e4('0x54'):_0x506764['push'](db[_0xe2e4('0x51')]['query'](_0x4fb347(_0x554133,_0xe2e4('0x53')))['then'](function(){})['catch'](_0x3e566c()));break;default:_0x506764[_0xe2e4('0x2c')](db['sequelize'][_0xe2e4('0x52')](_0x2629a1(_0x554133,_0xe2e4('0x53')))[_0xe2e4('0x4d')](function(){})[_0xe2e4('0x2e')](_0x3e566c()));}}}return _0x506764;})[_0xe2e4('0x55')]()[_0xe2e4('0x4d')](function(){return db[_0xe2e4('0x49')][_0xe2e4('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xe2e4('0x56')],'as':_0xe2e4('0x57'),'where':{'id':LISTID}}]})[_0xe2e4('0x4d')](function(_0x35d4d2){var _0xf9dc31=[];if(_0x35d4d2){var _0x81f4c0;for(var _0x3a478a=0x0,_0xba707c;_0x3a478a<_0x35d4d2[_0xe2e4('0x1a')];_0x3a478a+=0x1){_0xba707c=_0x35d4d2[_0x3a478a][_0xe2e4('0x4e')]({'plain':!![]});_0xf9dc31[_0xe2e4('0x2c')](db[_0xe2e4('0x51')][_0xe2e4('0x52')](_0x411d5a(_0xba707c,_0xe2e4('0x53')))[_0xe2e4('0x4d')](function(){})[_0xe2e4('0x2e')](_0x3e566c()));}}return _0xf9dc31;})['all']();})['then'](function(){return db['Campaign'][_0xe2e4('0x4a')]({'attributes':['id',_0xe2e4('0x4f')],'include':[{'model':db[_0xe2e4('0x56')],'as':_0xe2e4('0x4c'),'where':{'id':LISTID}}]})[_0xe2e4('0x4d')](function(_0x92785f){var _0x41830d=[];if(_0x92785f){for(var _0x37e180=0x0,_0x43bd9e;_0x37e180<_0x92785f['length'];_0x37e180+=0x1){_0x43bd9e=_0x92785f[_0x37e180][_0xe2e4('0x4e')]({'plain':!![]});switch(_0x43bd9e[_0xe2e4('0x4f')]){case _0xe2e4('0x50'):_0x41830d[_0xe2e4('0x2c')](db[_0xe2e4('0x51')]['query'](_0x1e2606(_0x43bd9e,_0xe2e4('0x58')))[_0xe2e4('0x4d')](function(){})[_0xe2e4('0x2e')](_0x3e566c()));break;case _0xe2e4('0x54'):_0x41830d['push'](db[_0xe2e4('0x51')][_0xe2e4('0x52')](_0x4fb347(_0x43bd9e,_0xe2e4('0x58')))[_0xe2e4('0x4d')](function(){})['catch'](_0x3e566c()));break;default:_0x41830d[_0xe2e4('0x2c')](db['sequelize'][_0xe2e4('0x52')](_0x2629a1(_0x43bd9e,_0xe2e4('0x58')))['then'](function(){})[_0xe2e4('0x2e')](_0x3e566c()));}}}return _0x41830d;})[_0xe2e4('0x55')]();})[_0xe2e4('0x4d')](function(){return db[_0xe2e4('0x59')][_0xe2e4('0x4a')]({'attributes':['id'],'include':[{'model':db[_0xe2e4('0x56')],'as':_0xe2e4('0x57'),'where':{'id':LISTID}}]})[_0xe2e4('0x4d')](function(_0x10175f){var _0xb086fa=[];if(_0x10175f){for(var _0x50dc6b=0x0,_0x900a34;_0x50dc6b<_0x10175f[_0xe2e4('0x1a')];_0x50dc6b+=0x1){_0x900a34=_0x10175f[_0x50dc6b]['get']({'plain':!![]});_0xb086fa[_0xe2e4('0x2c')](db[_0xe2e4('0x51')]['query'](_0x411d5a(_0x900a34,_0xe2e4('0x58')))[_0xe2e4('0x4d')](function(){})[_0xe2e4('0x2e')](_0x3e566c()));}}return _0xb086fa;})['all']();})[_0xe2e4('0x2e')](function(_0x4178b7){logger[_0xe2e4('0x14')](_0xe2e4('0x5a'),_0xe2e4('0x5b'),_0x4178b7[_0xe2e4('0x1c')]);});}var processPromises=function(_0x1d801f){return BPromise[_0xe2e4('0x55')](promises)[_0xe2e4('0x4d')](function(_0x8656c2){})[_0xe2e4('0x2e')](function(_0x19d6d1){logger['error'](_0xe2e4('0x5c'),JSON['stringify'](_0x19d6d1));})['finally'](function(){socket[_0xe2e4('0x5d')](_0xe2e4('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1d801f){return _0x1d801f[_0xe2e4('0x5f')]();}});};var endCsv=function(){return BPromise[_0xe2e4('0x60')]()[_0xe2e4('0x4d')](function(){if(hopperContacts){return checkHopper();}})[_0xe2e4('0x4d')](function(){socket[_0xe2e4('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe2e4('0x61')](FILEPATH);}catch(_0x556bd6){logger[_0xe2e4('0x14')](_0xe2e4('0x62'),JSON[_0xe2e4('0x2f')](_0x556bd6));}finally{process[_0xe2e4('0x63')](0x0);}});};process['on'](_0xe2e4('0x64'),function(){logger[_0xe2e4('0x65')](_0xe2e4('0x66'));endCsv();});function main(){return BPromise['resolve']()[_0xe2e4('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe2e4('0x11')](',');return db[_0xe2e4('0x2b')][_0xe2e4('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe2e4('0x4d')](function(_0x992c8b){var _0xcf2043=fs[_0xe2e4('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe2e4('0x68')](_0xcf2043,{'header':!![],'skipEmptyLines':!![],'step':function(_0x45b3c5,_0x58f528){total+=0x1;var _0x3aaf40=total;promises[_0xe2e4('0x2c')](checkRow(_0x45b3c5,_0x992c8b,_0x3aaf40)[_0xe2e4('0x4d')](function(){success+=0x1;})['catch'](function(_0x18d7c1){if(_0x18d7c1[_0xe2e4('0x14')]){errors+=0x1;delete _0x18d7c1[_0xe2e4('0x14')];}else if(_0x18d7c1['duplicate']){duplicates+=0x1;delete _0x18d7c1[_0xe2e4('0x29')];}rows[_0xe2e4('0x2c')](_0x18d7c1);}));if(total%0xc8===0x0){_0x58f528['pause']();return processPromises(_0x58f528);}},'complete':function(){return processPromises()[_0xe2e4('0x4d')](function(){logger['info'](_0xe2e4('0x69'));endCsv();});},'error':function(_0xed8e29,_0x59c1ba){logger['info'](_0xe2e4('0x6a'),JSON[_0xe2e4('0x2f')](_0xed8e29));endCsv();}});})['catch'](function(_0x55070f){logger['error'](_0xe2e4('0x6b'),JSON['stringify'](_0x55070f));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index cb2bb63..5dfd760 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 _0x37f6=['timezones','utcOffset','\x20not\x20specified','itemTypeId','trim','SystemRow','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','ioredis','../../../config/environment','../../../config/environment/shared','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','then','length','push','all','AdditionalPhones','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','cm_hopper','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','from','join','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','into','cm_hopper_black','ContactId','cm_contacts','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','fromQuery','field','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query','campaigns.id','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','set','offset','dialTimezone','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','parse','createReadStream','data','rows','find','_description','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email','dateOfBirth','YYYY-MM-DD'];(function(_0x264e7f,_0x4b8f91){var _0x173e6e=function(_0x525cfc){while(--_0x525cfc){_0x264e7f['push'](_0x264e7f['shift']());}};_0x173e6e(++_0x4b8f91);}(_0x37f6,0x19b));var _0x637f=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0x37f6[_0x3e0191];return _0xf2ae83;};'use strict';var fs=require('fs');var path=require(_0x637f('0x0'));var _=require('lodash');var Papa=require(_0x637f('0x1'));var util=require(_0x637f('0x2'));var BPromise=require(_0x637f('0x3'));var moment=require(_0x637f('0x4'));var squel=require('squel');var Redis=require(_0x637f('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x637f('0x6'));var shared=require(_0x637f('0x7'));var logger=require('../../../config/logger')(_0x637f('0x8'));config['redis']=_[_0x637f('0x9')](config[_0x637f('0xa')],{'host':_0x637f('0xb'),'port':0x18eb});var socket=require(_0x637f('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x637f('0xd')](_0x637f('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x637f('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x164e2d){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))*$/[_0x637f('0xf')](_0x164e2d);}function selectNotIn(_0x45b04c,_0x502725,_0x25b737,_0x40d172,_0x1362ee){return squel[_0x637f('0x10')]()['field'](_0x637f('0x11'))['from'](_0x40d172)['join'](_0x502725,null,_0x502725+'.id\x20=\x20'+_0x40d172+'.'+_0x25b737)[_0x637f('0x12')](_0x40d172+'.'+_0x25b737+_0x637f('0x13')+_0x45b04c+'.'+_0x25b737)[_0x637f('0x12')](_0x502725+_0x637f('0x14')+_0x1362ee['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x476461,_0xdabbd){promisesAdditionalPhones=[];return db[_0x637f('0x15')][_0x637f('0x16')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x637f('0x17')](function(_0x8c63be){if(_0x8c63be!==null){var _0x539274=[];for(var _0x642187=0x0;_0x642187<_0x8c63be[_0x637f('0x18')];_0x642187++){var _0x22040c=_0x8c63be[_0x642187];_0x539274[_0x637f('0x19')](insertAdditionalPhones(_0x22040c));}}Promise[_0x637f('0x1a')](_0x539274)[_0x637f('0x17')](function(){_0x476461({'val':0x1});});});});}function insertAdditionalPhones(_0x3325fc){return new Promise(function(_0x12bc21,_0x287392){var _0x1b50ff=_0x3325fc[_0x637f('0x1b')];var _0x23b36c=_0x1b50ff[_0x637f('0x1c')](';');var _0x224779=[];orderBy=0x0;for(var _0x1b2c4e=0x0;_0x1b2c4e<_0x23b36c['length'];_0x1b2c4e++){_0x224779[_0x637f('0x19')](splitAdditionalPhone(_0x3325fc['id'],_0x23b36c[_0x1b2c4e]));}Promise[_0x637f('0x1a')](_0x224779)[_0x637f('0x17')](function(){_0x12bc21({'val':_0x23b36c[_0x637f('0x18')]});});});}function splitAdditionalPhone(_0x57fd60,_0x396b46){return new Promise(function(_0x4198cf,_0xcb67cf){var _0x71518a=_0x396b46['split'](':');var _0x219703=_0x71518a[0x0];var _0x5ad842=_0x71518a[0x1];if(!_[_0x637f('0x1d')](_0x5ad842)){var _0x35ad4c=_0x5ad842['split']('|');var _0x55dae3=[];for(var _0x1b6d52=0x0;_0x1b6d52<_0x35ad4c[_0x637f('0x18')];_0x1b6d52++){if(_0x35ad4c[_0x1b6d52]!==''){var _0x2ea6a0=_[_0x637f('0x1e')](promisesAdditionalPhones,{'contactId':_0x57fd60,'phone':_0x35ad4c[_0x1b6d52]});if(_0x2ea6a0['length']==0x0){orderBy++;promisesAdditionalPhones[_0x637f('0x19')]({'contactId':_0x57fd60,'contactTypeId':_0x219703,'phone':_0x35ad4c[_0x1b6d52],'orderBy':orderBy});}}}_0x4198cf({'ok':0x1});}else _0x4198cf({'res':0x0});});}function createAdditionalPhone(_0x2b152e,_0x48380f,_0x4b4a8a,_0x312031){var _0x4c53ec='';var _0x5c1b03='';var _0x5791ab=_0x4b4a8a[_0x637f('0x1c')]('§');_0x4c53ec=_0x5791ab[0x0];if(_0x5791ab['length']==0x2)_0x5c1b03=_0x5791ab[0x1];return new Promise(function(_0x5ab060,_0x2da915){return db[_0x637f('0x1f')][_0x637f('0x20')]({'where':{'CmContactId':_0x2b152e,'item':_0x4c53ec}})['then'](function(_0x430b31){if(_0x430b31){return db[_0x637f('0x1f')][_0x637f('0x21')]({'ItemTypeId':_0x48380f,'description':_0x5c1b03,'OrderBy':_0x312031},{'where':{'CmContactId':_0x2b152e,'item':_0x4c53ec}})[_0x637f('0x17')](function(_0x2bb181){_0x5ab060({'res':_0x637f('0x22')});});}else{return db[_0x637f('0x1f')][_0x637f('0x23')]({'CmContactId':_0x2b152e,'item':_0x4c53ec,'description':_0x5c1b03,'ItemTypeId':_0x48380f,'OrderBy':_0x312031,'ItemClass':'PHONE'})[_0x637f('0x17')](function(_0x52063c){_0x5ab060({'res':'inserted'});});}});});}function insertCmHopper(_0x280104,_0x301b03,_0x45c240,_0x39a26c,_0x49f9f4){var _0x3871ae=[_0x637f('0x24'),_0x637f('0x25'),_0x637f('0x26'),'cm_contacts.ListId',_0x301b03+'.'+_0x39a26c,_0x637f('0x27'),_0x637f('0x28'),'cm_contacts.priority',_0x637f('0x29'),'\x22'+_0x49f9f4+'\x22'];return squel[_0x637f('0x2a')]()['into'](_0x637f('0x2b'))['fromQuery']([_0x637f('0x11'),_0x637f('0x2c'),'ContactId',_0x637f('0x2d'),_0x39a26c,_0x637f('0x2e'),_0x637f('0x2f'),_0x637f('0x30'),_0x637f('0x31'),_0x637f('0x32')],squel[_0x637f('0x10')]()[_0x637f('0x33')](_0x3871ae)[_0x637f('0x34')](_0x301b03)[_0x637f('0x35')]('cm_contacts',null,_0x637f('0x36')+_0x301b03+_0x637f('0x37'))[_0x637f('0x35')](_0x45c240,null,_0x45c240+_0x637f('0x38')+_0x301b03+'.'+_0x39a26c)[_0x637f('0x12')](_0x301b03+_0x637f('0x39'),_0x280104)[_0x637f('0x12')](_0x637f('0x3a'),NOW)[_0x637f('0x12')](_0x637f('0x3b'),selectNotIn(_0x301b03,_0x45c240,_0x39a26c,_0x637f('0x2b'),[_0x637f('0x3c'),_0x637f('0x3d')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x301b03,_0x45c240,_0x39a26c,_0x637f('0x2b'),[_0x637f('0x3c')])))[_0x637f('0x3e')]();}function insertCmHopperBlack(_0x408b34,_0x445306,_0x37fde3,_0x371932){var _0x27e2bf=['cm_contacts.phone',_0x637f('0x26'),_0x637f('0x3f'),_0x445306+'.'+_0x371932,_0x637f('0x27'),_0x637f('0x28')];return squel[_0x637f('0x2a')]()[_0x637f('0x40')](_0x637f('0x41'))['fromQuery']([_0x637f('0x11'),_0x637f('0x42'),_0x637f('0x2d'),_0x371932,_0x637f('0x2e'),'updatedAt'],squel[_0x637f('0x10')]()['fields'](_0x27e2bf)[_0x637f('0x34')](_0x445306)[_0x637f('0x35')](_0x637f('0x43'),null,_0x637f('0x36')+_0x445306+_0x637f('0x37'))['join'](_0x37fde3,null,_0x37fde3+_0x637f('0x38')+_0x445306+'.'+_0x371932)[_0x637f('0x12')](_0x445306+_0x637f('0x39'),_0x408b34)[_0x637f('0x12')](_0x637f('0x3a'),NOW)['where'](_0x637f('0x3b'),squel[_0x637f('0x10')]()['field'](_0x637f('0x11'))[_0x637f('0x34')]('cm_hopper_black')[_0x637f('0x12')](_0x637f('0x44'),_0x408b34)[_0x637f('0x12')](_0x371932+_0x637f('0x13')+_0x445306+'.'+_0x371932)))[_0x637f('0x3e')]();}function insertTzCmHopper(_0x15942d,_0x3ed546,_0x175a85,_0x210f64,_0xeb588b,_0x47b09a){var _0x4e77bd=[_0x637f('0x24'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x47b09a+_0x637f('0x45'),_0x637f('0x26'),'cm_contacts.ListId',_0x3ed546+'.'+_0x210f64,_0x637f('0x27'),_0x637f('0x28'),_0x637f('0x46'),_0x637f('0x29'),'\x22'+_0xeb588b+'\x22'];var _0x3c9fc3=squel['insert']()['into'](_0x637f('0x2b'))['fromQuery']([_0x637f('0x11'),'scheduledat',_0x637f('0x42'),_0x637f('0x2d'),_0x210f64,'createdAt','updatedAt',_0x637f('0x30'),'UserId',_0x637f('0x32')],squel['select']()['fields'](_0x4e77bd)['from'](_0x3ed546)['join'](_0x637f('0x43'),null,'cm_contacts.ListId\x20=\x20'+_0x3ed546+_0x637f('0x37'))[_0x637f('0x35')](_0x175a85,null,_0x175a85+_0x637f('0x38')+_0x3ed546+'.'+_0x210f64)[_0x637f('0x35')](_0x47b09a,null,_0x47b09a+_0x637f('0x38')+_0x3ed546+'.'+_0x210f64)[_0x637f('0x12')](_0x3ed546+'.CmListId\x20=\x20?',_0x15942d)[_0x637f('0x12')](_0x637f('0x3a'),NOW)[_0x637f('0x12')](_0x637f('0x3b'),selectNotIn(_0x3ed546,_0x175a85,_0x210f64,_0x637f('0x2b'),['\x22always\x22',_0x637f('0x3d')]))[_0x637f('0x12')](_0x637f('0x3b'),selectNotIn(_0x3ed546,_0x175a85,_0x210f64,'cm_hopper',[_0x637f('0x3c')])))[_0x637f('0x3e')]();return _0x3c9fc3;}function insertTzCmHopperBlack(_0x58f350,_0x4dc695,_0x2a9de0,_0x30ecb3){var _0x7a8f2f=[_0x637f('0x24'),'cm_contacts.id',_0x637f('0x3f'),_0x4dc695+'.'+_0x30ecb3,'cm_contacts.createdAt',_0x637f('0x28')];return squel[_0x637f('0x2a')]()[_0x637f('0x40')](_0x637f('0x41'))[_0x637f('0x47')]([_0x637f('0x11'),_0x637f('0x42'),_0x637f('0x2d'),_0x30ecb3,'createdAt',_0x637f('0x2f')],squel[_0x637f('0x10')]()['fields'](_0x7a8f2f)[_0x637f('0x34')](_0x4dc695)[_0x637f('0x35')](_0x637f('0x43'),null,_0x637f('0x36')+_0x4dc695+_0x637f('0x37'))['join'](_0x2a9de0,null,_0x2a9de0+_0x637f('0x38')+_0x4dc695+'.'+_0x30ecb3)[_0x637f('0x12')](_0x4dc695+_0x637f('0x39'),_0x58f350)['where'](_0x637f('0x3a'),NOW)[_0x637f('0x12')](_0x637f('0x3b'),squel[_0x637f('0x10')]()[_0x637f('0x48')]('phone')[_0x637f('0x34')](_0x637f('0x41'))[_0x637f('0x12')](_0x637f('0x44'),_0x58f350)['where'](_0x30ecb3+_0x637f('0x13')+_0x4dc695+'.'+_0x30ecb3)))[_0x637f('0x3e')]();}function insertCmHopperAdditionalPhones(_0x1034be){var _0x46ada8=[_0x637f('0x49'),_0x637f('0x4a'),'cm_contact_has_items.OrderBy',_0x637f('0x4b'),'cm_contact_has_items.updatedAt'];return squel[_0x637f('0x2a')]()[_0x637f('0x40')](_0x637f('0x4c'))[_0x637f('0x47')]([_0x637f('0x4d'),_0x637f('0x11'),_0x637f('0x4e'),_0x637f('0x2e'),_0x637f('0x2f')],squel[_0x637f('0x10')]()['fields'](_0x46ada8)[_0x637f('0x34')](_0x637f('0x2b'))[_0x637f('0x35')](_0x637f('0x43'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x637f('0x35')]('cm_contact_has_items',null,_0x637f('0x4f'))[_0x637f('0x12')](_0x637f('0x50'),_0x1034be)[_0x637f('0x12')](_0x637f('0x3a'),NOW))[_0x637f('0x3e')]();}function insertCmContact(_0xe83c0a,_0x4851c2,_0x10d8f7,_0x44abc2){var _0x16b954=_['concat'](_[_0x637f('0x51')](_0x44abc2),[_0x637f('0x2d'),'CompanyId',_0x637f('0x2e'),_0x637f('0x2f')]);return squel[_0x637f('0x2a')]()[_0x637f('0x40')]('cm_contacts')['fromQuery'](_0x16b954,squel[_0x637f('0x10')]()[_0x637f('0x33')](_0x16b954)[_0x637f('0x34')](_0x4851c2)[_0x637f('0x12')]('('+_0x10d8f7[_0x637f('0x35')](',')+_0x637f('0x52'),squel[_0x637f('0x10')]()[_0x637f('0x33')](_0x10d8f7)[_0x637f('0x34')](_0x637f('0x43'))[_0x637f('0x12')](_0x637f('0x44'),_0xe83c0a)[_0x637f('0x12')]('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0x637f('0x10')]()[_0x637f('0x48')](_0x637f('0x53'),_0x637f('0x54'))[_0x637f('0x34')](_0x4851c2)[_0x637f('0x55')](_0x10d8f7[_0x637f('0x35')](','))))[_0x637f('0x3e')]();}function handleStop(){logger['info'](_0x637f('0x56'));stopped=!![];}function handleUncaughtException(_0xbfdba1){logger[_0x637f('0x57')](_0xbfdba1[_0x637f('0x58')]);process[_0x637f('0x59')](0x1);}function handleError(_0x3b86cc,_0x72a631){stats[_0x637f('0x5a')][_0x637f('0x19')]({'name':_0x72a631[_0x637f('0x5b')],'message':_0x72a631[_0x637f('0x58')],'row':_0x3b86cc});}function handleQuery(_0x5c67fa){logger[_0x637f('0x5c')](_0x5c67fa);return db[_0x637f('0x5d')][_0x637f('0x5e')](_0x5c67fa)['spread'](function(_0x160927){results[_0x637f('0x19')](_0x160927);})['catch'](function(_0xa1541a){logger[_0x637f('0x57')](_0xa1541a[_0x637f('0x58')]);});}function updateTzCampaigns(_0xdae07){return new Promise(function(_0x52c7e5,_0x3ea598){var _0x4c6c69=squel['select']()[_0x637f('0x33')]([_0x637f('0x5f'),'campaigns.dialTimezone'])[_0x637f('0x34')]('campaigns')['join'](_0x637f('0x60'),null,_0x637f('0x61'))[_0x637f('0x12')](_0x637f('0x62')+_0xdae07);db[_0x637f('0x5d')][_0x637f('0x5e')](_0x4c6c69[_0x637f('0x3e')]())[_0x637f('0x63')](function(_0x385407){var _0x59681b=[];for(var _0x5828b9=0x0;_0x5828b9<_0x385407['length'];_0x5828b9++){_0x59681b[_0x637f('0x19')](getTimezoneData(_0x385407[_0x5828b9],tmp_campaigns));}BPromise[_0x637f('0x1a')](_0x59681b)[_0x637f('0x17')](function(){_0x52c7e5({'val':0x1});});})[_0x637f('0x64')](function(_0x2f6a55){logger[_0x637f('0x57')](_0x2f6a55[_0x637f('0x58')]);_0x52c7e5({'val':0x0});});});}function updateTzVoiceQueues(_0xd37b3a){return new Promise(function(_0x468888,_0x1c931a){var _0x481568=squel[_0x637f('0x10')]()[_0x637f('0x33')]([_0x637f('0x65'),_0x637f('0x66')])[_0x637f('0x34')](_0x637f('0x67'))[_0x637f('0x35')]('voice_queues_has_cm_lists',null,_0x637f('0x68'))[_0x637f('0x12')]('voice_queues_has_cm_lists.CmListId='+_0xd37b3a);db[_0x637f('0x5d')][_0x637f('0x5e')](_0x481568[_0x637f('0x3e')]())[_0x637f('0x63')](function(_0x4d36e5){var _0x55bc0e=[];for(var _0x824a7e=0x0;_0x824a7e<_0x4d36e5[_0x637f('0x18')];_0x824a7e++){_0x55bc0e[_0x637f('0x19')](getTimezoneData(_0x4d36e5[_0x824a7e],tmp_voice_queues));}BPromise[_0x637f('0x1a')](_0x55bc0e)[_0x637f('0x17')](function(){_0x468888({'val':0x1});});})[_0x637f('0x64')](function(_0x560099){logger[_0x637f('0x57')](_0x560099[_0x637f('0x58')]);_0x468888({'val':0x0});});});}function getTimezoneData(_0x5ab82d,_0x463b5a){return new Promise(function(_0x1e83a1,_0x4a8cba){var _0x43e9ba=shared['timezones'];var _0x551a09=_0x43e9ba[_0x5ab82d['dialTimezone']];if(_[_0x637f('0x1d')](_0x551a09)){_0x1e83a1({'ret':0x1});}else{var _0x5afe62=_0x551a09['utcOffset'];var _0x557772=squel['insert']()[_0x637f('0x40')](_0x463b5a)[_0x637f('0x69')]('id',_0x5ab82d['id'])[_0x637f('0x69')](_0x637f('0x6a'),_0x5afe62)[_0x637f('0x69')](_0x637f('0x6b'),_0x5ab82d[_0x637f('0x6b')])[_0x637f('0x3e')]();return db[_0x637f('0x5d')][_0x637f('0x5e')](_0x557772)['spread'](function(_0x7e00ad){_0x1e83a1({'ret':0x1});})[_0x637f('0x64')](function(_0x2078bd){logger[_0x637f('0x57')](_0x2078bd[_0x637f('0x58')]);_0x4a8cba({'ret':0x1});});}});}function handleTZQuery(_0x49871a){logger['info'](_0x49871a);return db[_0x637f('0x5d')][_0x637f('0x5e')](_0x49871a)['spread'](function(_0x54d5a1){})[_0x637f('0x64')](function(_0x526bcb){logger[_0x637f('0x57')](_0x526bcb[_0x637f('0x58')]);});}function main(_0x5576c8,_0x47900e,_0x5ba677,_0x37610d){logger[_0x637f('0x5c')](_0x637f('0x6c'),_0x5576c8,JSON[_0x637f('0x6d')](_0x47900e));process[_0x637f('0x6e')](_0x637f('0x6f'));var _0x27a832=_0x47900e['binding'];var _0x477e94=_[_0x637f('0x70')](_0x27a832);var _0x1ec0eb=_0x47900e[_0x637f('0x71')];var _0x549020=path[_0x637f('0x35')](config[_0x637f('0x72')],_0x637f('0x73'),_0x1ec0eb+_0x637f('0x74'));hasTZ=_['keys'](_0x27a832)[_0x637f('0x75')]('dialTimezone');var _0xd3608d=_[_0x637f('0x51')](_0x27a832)[_0x637f('0x35')]();logger[_0x637f('0x5c')](_0x637f('0x76'),_0xd3608d);db[_0x637f('0x77')][_0x637f('0x16')]({'raw':!![],'attributes':['id',_0x637f('0x78')]})['then'](function(_0x5e47ab){for(var _0x387482=0x0;_0x387482<_0x5e47ab['length'];_0x387482++){if(_0x5e47ab[_0x387482]['name']in _0x27a832){contactItemTypes[_0x637f('0x19')](_0x5e47ab[_0x387482]);delete _0x477e94[_0x5e47ab[_0x387482][_0x637f('0x78')]];hasAdditionalPhones=!![];}for(var _0x2cbe50 in _0x27a832){if(_0x5e47ab[_0x387482][_0x637f('0x78')]+'_description'===_0x2cbe50){phoneDescriptions[_0x637f('0x19')]({'itemTypeId':_0x5e47ab[_0x387482]['id'],'description':_0x2cbe50});delete _0x477e94[_0x2cbe50];}}}if(hasAdditionalPhones)_0x477e94[_0x637f('0x1b')]='';var _0x3fb611=_['keys'](_0x477e94)[_0x637f('0x35')]();logger[_0x637f('0x5c')]('header',_0x3fb611);fs['writeFileSync'](_0x549020,_0x3fb611+'\x0a');Papa[_0x637f('0x79')](fs[_0x637f('0x7a')](_0x5576c8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4afd44,_0x1c4441){try{for(var _0x298c49=0x0,_0x1699e0=[];_0x298c49<_0x4afd44[_0x637f('0x7b')][_0x637f('0x18')];_0x298c49++){stats[_0x637f('0x7c')]+=0x1;if(_0x4afd44[_0x637f('0x5a')][_0x298c49]){handleError(_0x4afd44['data'][_0x298c49],_0x4afd44[_0x637f('0x5a')][_0x298c49]);}else{var _0x233216=[];var _0x433bb4=[];var _0xe10b37={};for(var _0x216dd5 in _0x27a832){let _0x3b8202=contactItemTypes[_0x637f('0x7d')](_0x704fdf=>_0x704fdf[_0x637f('0x78')]===_0x216dd5);let _0x4f80fe=contactItemTypes[_0x637f('0x7d')](_0x508f5a=>_0x508f5a[_0x637f('0x78')]+_0x637f('0x7e')===_0x216dd5);if(_[_0x637f('0x1d')](_0x3b8202)&&_[_0x637f('0x1d')](_0x4f80fe)){if(_0x27a832[_0x637f('0x7f')](_0x216dd5)){if(_0x4afd44[_0x637f('0x7b')][_0x298c49][_0x27a832[_0x216dd5]]){var _0x232a05=_['trim'](_0x4afd44['data'][_0x298c49][_0x27a832[_0x216dd5]][_0x637f('0x80')](/"/g,'\x27'));switch(_0x216dd5){case _0x637f('0x2c'):var _0x1695af=moment(_0x232a05,_0x637f('0xe'),!![]);if(_0x1695af[_0x637f('0x81')]()){_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');}else{_0x233216['push'](_0x637f('0x82'));}break;case _0x637f('0x30'):var _0x5037db=parseInt(_0x232a05);_0x232a05=_[_0x637f('0x83')](_0x5037db)||_0x5037db<0x0||_0x5037db>0x4?_0x37610d?0x3:0x2:_0x5037db;_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');break;case _0x637f('0x31'):var _0x3afd3b=parseInt(_0x232a05);if(_['isNumber'](_0x3afd3b)&&_[_0x637f('0x75')](_0x5ba677,_0x3afd3b)){_0x1699e0[_0x637f('0x19')]('\x22'+_0x3afd3b+'\x22');}else{_0x233216[_0x637f('0x19')]('agent\x20not\x20exists');}break;case _0x637f('0x84'):if(isEmail(_0x232a05)){_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');}else{_0x233216[_0x637f('0x19')]('email\x20wrong\x20format');}break;case _0x637f('0x85'):var _0x20f5ba=moment(_0x232a05,_0x637f('0x86'),!![]);if(_0x20f5ba[_0x637f('0x81')]()){_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');}else{_0x233216['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x637f('0x6b'):var _0x124c5f=shared[_0x637f('0x87')];var _0x34f267=_0x124c5f[_0x232a05];if(!_[_0x637f('0x1d')](_0x34f267)){var _0x44469e=_0x34f267[_0x637f('0x88')];_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');_0x1699e0['push']('\x22'+_0x44469e+'\x22');}break;default:_0x1699e0[_0x637f('0x19')]('\x22'+_0x232a05+'\x22');}}else{switch(_0x216dd5){case'firstName':case _0x637f('0x11'):_0x233216[_0x637f('0x19')](_0x216dd5+_0x637f('0x89'));break;default:_0x1699e0[_0x637f('0x19')]('\x22\x22');}}}}else{var _0x327580='';if(!_[_0x637f('0x1d')](_0x3b8202)){if(!_0xe10b37['hasOwnProperty'](_0x3b8202['id'])){if(!_[_0x637f('0x1d')](_0x4afd44[_0x637f('0x7b')][_0x298c49][_0x27a832[_0x216dd5]])){var _0x232a05=_['trim'](_0x4afd44['data'][_0x298c49][_0x27a832[_0x216dd5]][_0x637f('0x80')](/"/g,'\x27'));var _0x2e65be=phoneDescriptions[_0x637f('0x7d')](_0xf9e3db=>_0xf9e3db[_0x637f('0x8a')]===_0x3b8202['id']);if(!_['isNil'](_0x2e65be)){var _0x543e8b=_[_0x637f('0x8b')](_0x4afd44[_0x637f('0x7b')][_0x298c49][_0x27a832[_0x2e65be['description']]]['replace'](/"/g,'\x27'));if(!_[_0x637f('0x1d')](_0x543e8b))_0x232a05=_0x232a05+'§'+_0x543e8b;}if(_0x327580=='')_0x327580=_0x232a05;else _0x327580+='|'+_0x232a05;}_0x433bb4[_0x637f('0x19')](_0x3b8202['id']+':'+_0x327580);_0xe10b37[_0x3b8202['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1699e0['push']('\x22'+_0x433bb4[_0x637f('0x35')](';')+'\x22');}if(_0x233216['length']){handleError(_0x4afd44[_0x637f('0x7b')][_0x298c49],{'code':_0x637f('0x8c'),'message':_0x233216[_0x637f('0x35')]()});}else{fs['appendFileSync'](_0x549020,_0x1699e0[_0x637f('0x35')]()+'\x0a');}_0x1699e0=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x1ec0eb,stats);stats[_0x637f('0x5a')]=[];}}if(stopped){logger[_0x637f('0x5c')]('Abort\x20parser');_0x1c4441[_0x637f('0x8d')]();}}catch(_0x182753){handleError(_0x4afd44[_0x637f('0x7b')][_0x298c49],{'code':_0x637f('0x8e'),'message':_0x182753['message']});logger[_0x637f('0x57')](_0x637f('0x8f'),_0x182753[_0x637f('0x58')]);}},'complete':function(){try{var _0x157483=[];var _0x204db5=[];var _0x16c5ea=_0x637f('0x43');if(_0x47900e[_0x637f('0x90')]&&_0x47900e[_0x637f('0x90')][_0x637f('0x18')]){_0x16c5ea=_0x637f('0x91')+_0x1ec0eb;_0x157483[_0x637f('0x19')](_0x637f('0x92')+_0x16c5ea+_0x637f('0x93'));}tmp_campaigns=_0x637f('0x94')+_0x1ec0eb;tmp_voice_queues=_0x637f('0x95')+_0x1ec0eb;_0x204db5[_0x637f('0x19')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x637f('0x96'));_0x204db5['push'](_0x637f('0x92')+tmp_voice_queues+_0x637f('0x96'));BPromise['each'](_0x204db5,handleTZQuery)[_0x637f('0x17')](function(_0x2e2365){updateTzCampaigns(_0x47900e[_0x637f('0x2d')])[_0x637f('0x17')](function(_0x133c29){updateTzVoiceQueues(_0x47900e[_0x637f('0x2d')])[_0x637f('0x17')](function(_0x5643d6){if(hasTZ)_0x3fb611=_0x3fb611[_0x637f('0x80')]('dialTimezone',_0x637f('0x97'));var _0x56a1eb=util[_0x637f('0xd')]('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',_0x549020,_0x16c5ea,_0x3fb611,_0x47900e[_0x637f('0x2d')],_0x47900e[_0x637f('0x98')]||null,NOW,NOW);if(_[_0x637f('0x1d')](_0x27a832[_0x637f('0x2c')])){_0x56a1eb+=_0x637f('0x99');}_0x157483[_0x637f('0x19')](_0x56a1eb);if(_0x47900e['duplicates']&&_0x47900e['duplicates'][_0x637f('0x18')]){_0x157483[_0x637f('0x19')](insertCmContact(_0x47900e[_0x637f('0x2d')],_0x16c5ea,_0x47900e[_0x637f('0x90')],_0x27a832));_0x157483[_0x637f('0x19')]('DROP\x20TABLE\x20'+_0x16c5ea+';');}BPromise[_0x637f('0x9a')](_0x157483,handleQuery)[_0x637f('0x17')](function(_0x102401){BPromise[_0x637f('0x1a')]([handleAdditionalPhones()])[_0x637f('0x17')](function(){_0x157483=[];for(var _0x47a618=0x0;_0x47a618\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','phone','ContactId','createdAt','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','cm_hopper_black','fromQuery','ListId','updatedAt','fields','field','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','scheduledat','priority','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','Received\x20SIGINT','error','message','exit','errors','code','info','sequelize','query','spread','catch','campaigns','campaigns_has_cm_lists','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','root','server/files/tmp','.csv','includes','header','ContactItemType','name','writeFileSync','parse','data','rows','find','_description','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','itemTypeId','description','appendFileSync','contact:import:','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','voice_queues_','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8c09,0xbc));var _0x98c0=function(_0x48f71e,_0x250393){_0x48f71e=_0x48f71e-0x0;var _0x5d58d0=_0x8c09[_0x48f71e];return _0x5d58d0;};'use strict';var fs=require('fs');var path=require(_0x98c0('0x0'));var _=require(_0x98c0('0x1'));var Papa=require('papaparse');var util=require(_0x98c0('0x2'));var BPromise=require(_0x98c0('0x3'));var moment=require(_0x98c0('0x4'));var squel=require('squel');var Redis=require(_0x98c0('0x5'));var db=require(_0x98c0('0x6'))['db'];var config=require(_0x98c0('0x7'));var shared=require(_0x98c0('0x8'));var logger=require('../../../config/logger')(_0x98c0('0x9'));config[_0x98c0('0xa')]=_['defaults'](config[_0x98c0('0xa')],{'host':_0x98c0('0xb'),'port':0x18eb});var socket=require(_0x98c0('0xc'))(new Redis(config[_0x98c0('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x98c0('0xd')](_0x98c0('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x98c0('0xd')](_0x98c0('0xe'));function isEmail(_0x4136d5){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))*$/[_0x98c0('0xf')](_0x4136d5);}function selectNotIn(_0x7e0f1b,_0x27116d,_0x59ba55,_0x144747,_0xcbec28){return squel[_0x98c0('0x10')]()['field']('phone')[_0x98c0('0x11')](_0x144747)['join'](_0x27116d,null,_0x27116d+'.id\x20=\x20'+_0x144747+'.'+_0x59ba55)[_0x98c0('0x12')](_0x144747+'.'+_0x59ba55+_0x98c0('0x13')+_0x7e0f1b+'.'+_0x59ba55)[_0x98c0('0x12')](_0x27116d+_0x98c0('0x14')+_0xcbec28[_0x98c0('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x275d1c,_0x1ec78a){promisesAdditionalPhones=[];return db['CmContact'][_0x98c0('0x16')]({'raw':!![],'attributes':['id',_0x98c0('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x98c0('0x18')](function(_0x3837fa){if(_0x3837fa!==null){var _0x297059=[];for(var _0x2f15e9=0x0;_0x2f15e9<_0x3837fa[_0x98c0('0x19')];_0x2f15e9++){var _0x5b3631=_0x3837fa[_0x2f15e9];_0x297059[_0x98c0('0x1a')](insertAdditionalPhones(_0x5b3631));}}Promise[_0x98c0('0x1b')](_0x297059)['then'](function(){_0x275d1c({'val':0x1});});});});}function insertAdditionalPhones(_0x32939e){return new Promise(function(_0x5c56e4,_0x42597c){var _0xcece7e=_0x32939e[_0x98c0('0x17')];var _0x308da5=_0xcece7e[_0x98c0('0x1c')](';');var _0x36fe3f=[];orderBy=0x0;for(var _0x2f9172=0x0;_0x2f9172<_0x308da5[_0x98c0('0x19')];_0x2f9172++){_0x36fe3f[_0x98c0('0x1a')](splitAdditionalPhone(_0x32939e['id'],_0x308da5[_0x2f9172]));}Promise[_0x98c0('0x1b')](_0x36fe3f)[_0x98c0('0x18')](function(){_0x5c56e4({'val':_0x308da5[_0x98c0('0x19')]});});});}function splitAdditionalPhone(_0xf660da,_0x1d8f2f){return new Promise(function(_0x151b73,_0x4781d8){var _0x432b5d=_0x1d8f2f[_0x98c0('0x1c')](':');var _0x2f6d91=_0x432b5d[0x0];var _0x24a333=_0x432b5d[0x1];if(!_[_0x98c0('0x1d')](_0x24a333)){var _0x33c430=_0x24a333[_0x98c0('0x1c')]('|');var _0x37747c=[];for(var _0x47942c=0x0;_0x47942c<_0x33c430[_0x98c0('0x19')];_0x47942c++){if(_0x33c430[_0x47942c]!==''){var _0x412a20=_[_0x98c0('0x1e')](promisesAdditionalPhones,{'contactId':_0xf660da,'phone':_0x33c430[_0x47942c]});if(_0x412a20[_0x98c0('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x98c0('0x1a')]({'contactId':_0xf660da,'contactTypeId':_0x2f6d91,'phone':_0x33c430[_0x47942c],'orderBy':orderBy});}}}_0x151b73({'ok':0x1});}else _0x151b73({'res':0x0});});}function createAdditionalPhone(_0x21fea9,_0x3a5fcd,_0x1d1992,_0x2807e8){var _0x5a1edb='';var _0x2b26c7='';var _0x51abca=_0x1d1992['split']('§');_0x5a1edb=_0x51abca[0x0];if(_0x51abca[_0x98c0('0x19')]==0x2)_0x2b26c7=_0x51abca[0x1];return new Promise(function(_0x365683,_0x192999){return db[_0x98c0('0x1f')][_0x98c0('0x20')]({'where':{'CmContactId':_0x21fea9,'item':_0x5a1edb}})['then'](function(_0x258ddd){if(_0x258ddd){return db[_0x98c0('0x1f')]['update']({'ItemTypeId':_0x3a5fcd,'description':_0x2b26c7,'OrderBy':_0x2807e8},{'where':{'CmContactId':_0x21fea9,'item':_0x5a1edb}})[_0x98c0('0x18')](function(_0x48deb3){_0x365683({'res':_0x98c0('0x21')});});}else{return db[_0x98c0('0x1f')][_0x98c0('0x22')]({'CmContactId':_0x21fea9,'item':_0x5a1edb,'description':_0x2b26c7,'ItemTypeId':_0x3a5fcd,'OrderBy':_0x2807e8,'ItemClass':_0x98c0('0x23')})['then'](function(_0x37c6f9){_0x365683({'res':_0x98c0('0x24')});});}});});}function insertCmHopper(_0x443414,_0x2aac6d,_0x2ee94d,_0x28aba2,_0x267c81){var _0x3fbc37=[_0x98c0('0x25'),_0x98c0('0x26'),_0x98c0('0x27'),_0x98c0('0x28'),_0x2aac6d+'.'+_0x28aba2,_0x98c0('0x29'),'cm_contacts.updatedAt','cm_contacts.priority',_0x98c0('0x2a'),'\x22'+_0x267c81+'\x22'];return squel[_0x98c0('0x2b')]()[_0x98c0('0x2c')]('cm_hopper')['fromQuery']([_0x98c0('0x2d'),'scheduledat',_0x98c0('0x2e'),'ListId',_0x28aba2,_0x98c0('0x2f'),'updatedAt','priority',_0x98c0('0x30'),_0x98c0('0x31')],squel['select']()['fields'](_0x3fbc37)[_0x98c0('0x11')](_0x2aac6d)[_0x98c0('0x15')](_0x98c0('0x32'),null,_0x98c0('0x33')+_0x2aac6d+_0x98c0('0x34'))[_0x98c0('0x15')](_0x2ee94d,null,_0x2ee94d+_0x98c0('0x35')+_0x2aac6d+'.'+_0x28aba2)['where'](_0x2aac6d+_0x98c0('0x36'),_0x443414)['where'](_0x98c0('0x37'),NOW)['where'](_0x98c0('0x38'),selectNotIn(_0x2aac6d,_0x2ee94d,_0x28aba2,_0x98c0('0x39'),[_0x98c0('0x3a'),_0x98c0('0x3b')]))[_0x98c0('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2aac6d,_0x2ee94d,_0x28aba2,_0x98c0('0x39'),['\x22always\x22'])))[_0x98c0('0x3c')]();}function insertCmHopperBlack(_0x227434,_0x117154,_0x13f307,_0x482b2b){var _0x3bd4a6=[_0x98c0('0x25'),_0x98c0('0x27'),_0x98c0('0x28'),_0x117154+'.'+_0x482b2b,'cm_contacts.createdAt',_0x98c0('0x3d')];return squel[_0x98c0('0x2b')]()[_0x98c0('0x2c')](_0x98c0('0x3e'))[_0x98c0('0x3f')]([_0x98c0('0x2d'),_0x98c0('0x2e'),_0x98c0('0x40'),_0x482b2b,_0x98c0('0x2f'),_0x98c0('0x41')],squel['select']()[_0x98c0('0x42')](_0x3bd4a6)['from'](_0x117154)[_0x98c0('0x15')](_0x98c0('0x32'),null,_0x98c0('0x33')+_0x117154+_0x98c0('0x34'))['join'](_0x13f307,null,_0x13f307+'.id\x20=\x20'+_0x117154+'.'+_0x482b2b)['where'](_0x117154+_0x98c0('0x36'),_0x227434)['where'](_0x98c0('0x37'),NOW)[_0x98c0('0x12')](_0x98c0('0x38'),squel['select']()[_0x98c0('0x43')](_0x98c0('0x2d'))[_0x98c0('0x11')](_0x98c0('0x3e'))[_0x98c0('0x12')]('ListId\x20=\x20?',_0x227434)[_0x98c0('0x12')](_0x482b2b+_0x98c0('0x13')+_0x117154+'.'+_0x482b2b)))[_0x98c0('0x3c')]();}function insertTzCmHopper(_0x412a85,_0x34ece4,_0x3ca388,_0x4fe444,_0x2a3bd6,_0x2323a3){var _0x3a3c13=['cm_contacts.phone',_0x98c0('0x44')+_0x2323a3+_0x98c0('0x45'),_0x98c0('0x27'),_0x98c0('0x28'),_0x34ece4+'.'+_0x4fe444,_0x98c0('0x29'),_0x98c0('0x3d'),_0x98c0('0x46'),_0x98c0('0x2a'),'\x22'+_0x2a3bd6+'\x22'];var _0x56b943=squel['insert']()[_0x98c0('0x2c')](_0x98c0('0x39'))['fromQuery']([_0x98c0('0x2d'),_0x98c0('0x47'),_0x98c0('0x2e'),_0x98c0('0x40'),_0x4fe444,_0x98c0('0x2f'),_0x98c0('0x41'),_0x98c0('0x48'),_0x98c0('0x30'),_0x98c0('0x31')],squel[_0x98c0('0x10')]()[_0x98c0('0x42')](_0x3a3c13)['from'](_0x34ece4)[_0x98c0('0x15')](_0x98c0('0x32'),null,_0x98c0('0x33')+_0x34ece4+'.CmListId')[_0x98c0('0x15')](_0x3ca388,null,_0x3ca388+_0x98c0('0x35')+_0x34ece4+'.'+_0x4fe444)[_0x98c0('0x15')](_0x2323a3,null,_0x2323a3+_0x98c0('0x35')+_0x34ece4+'.'+_0x4fe444)['where'](_0x34ece4+_0x98c0('0x36'),_0x412a85)['where'](_0x98c0('0x37'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x34ece4,_0x3ca388,_0x4fe444,_0x98c0('0x39'),[_0x98c0('0x3a'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x34ece4,_0x3ca388,_0x4fe444,_0x98c0('0x39'),[_0x98c0('0x3a')])))['toString']();return _0x56b943;}function insertTzCmHopperBlack(_0x36eea9,_0x35abaf,_0x53f99d,_0x339926){var _0x415938=[_0x98c0('0x25'),_0x98c0('0x27'),_0x98c0('0x28'),_0x35abaf+'.'+_0x339926,_0x98c0('0x29'),_0x98c0('0x3d')];return squel[_0x98c0('0x2b')]()[_0x98c0('0x2c')]('cm_hopper_black')[_0x98c0('0x3f')](['phone',_0x98c0('0x2e'),_0x98c0('0x40'),_0x339926,'createdAt','updatedAt'],squel[_0x98c0('0x10')]()[_0x98c0('0x42')](_0x415938)[_0x98c0('0x11')](_0x35abaf)['join'](_0x98c0('0x32'),null,_0x98c0('0x33')+_0x35abaf+_0x98c0('0x34'))[_0x98c0('0x15')](_0x53f99d,null,_0x53f99d+_0x98c0('0x35')+_0x35abaf+'.'+_0x339926)[_0x98c0('0x12')](_0x35abaf+_0x98c0('0x36'),_0x36eea9)[_0x98c0('0x12')](_0x98c0('0x37'),NOW)['where'](_0x98c0('0x38'),squel[_0x98c0('0x10')]()[_0x98c0('0x43')]('phone')['from'](_0x98c0('0x3e'))['where']('ListId\x20=\x20?',_0x36eea9)[_0x98c0('0x12')](_0x339926+_0x98c0('0x13')+_0x35abaf+'.'+_0x339926)))[_0x98c0('0x3c')]();}function insertCmHopperAdditionalPhones(_0x1b7ac4){var _0x8fd9a3=[_0x98c0('0x49'),'cm_contact_has_items.item',_0x98c0('0x4a'),_0x98c0('0x4b'),_0x98c0('0x4c')];return squel[_0x98c0('0x2b')]()[_0x98c0('0x2c')]('cm_hopper_additional_phones')['fromQuery'](['CmHopperId',_0x98c0('0x2d'),_0x98c0('0x4d'),_0x98c0('0x2f'),_0x98c0('0x41')],squel[_0x98c0('0x10')]()[_0x98c0('0x42')](_0x8fd9a3)['from'](_0x98c0('0x39'))['join'](_0x98c0('0x32'),null,_0x98c0('0x4e'))[_0x98c0('0x15')](_0x98c0('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x98c0('0x12')](_0x98c0('0x50'),_0x1b7ac4)[_0x98c0('0x12')](_0x98c0('0x37'),NOW))[_0x98c0('0x3c')]();}function insertCmContact(_0x4d0b90,_0x2c7350,_0x3e2f5d,_0x2ecd5d){var _0x32c645=_[_0x98c0('0x51')](_[_0x98c0('0x52')](_0x2ecd5d),[_0x98c0('0x40'),_0x98c0('0x53'),_0x98c0('0x2f'),_0x98c0('0x41')]);return squel['insert']()[_0x98c0('0x2c')](_0x98c0('0x32'))[_0x98c0('0x3f')](_0x32c645,squel[_0x98c0('0x10')]()[_0x98c0('0x42')](_0x32c645)[_0x98c0('0x11')](_0x2c7350)['where']('('+_0x3e2f5d[_0x98c0('0x15')](',')+_0x98c0('0x54'),squel[_0x98c0('0x10')]()[_0x98c0('0x42')](_0x3e2f5d)[_0x98c0('0x11')](_0x98c0('0x32'))[_0x98c0('0x12')](_0x98c0('0x55'),_0x4d0b90)[_0x98c0('0x12')](_0x98c0('0x56')))[_0x98c0('0x12')]('id\x20IN\x20?',squel[_0x98c0('0x10')]()[_0x98c0('0x43')](_0x98c0('0x57'),'min_id')['from'](_0x2c7350)[_0x98c0('0x58')](_0x3e2f5d[_0x98c0('0x15')](','))))['toString']();}function handleStop(){logger['info'](_0x98c0('0x59'));stopped=!![];}function handleUncaughtException(_0x920dab){logger[_0x98c0('0x5a')](_0x920dab[_0x98c0('0x5b')]);process[_0x98c0('0x5c')](0x1);}function handleError(_0x469b22,_0x5ded94){stats[_0x98c0('0x5d')][_0x98c0('0x1a')]({'name':_0x5ded94[_0x98c0('0x5e')],'message':_0x5ded94[_0x98c0('0x5b')],'row':_0x469b22});}function handleQuery(_0x35c875){logger[_0x98c0('0x5f')](_0x35c875);return db[_0x98c0('0x60')][_0x98c0('0x61')](_0x35c875)[_0x98c0('0x62')](function(_0x566c55){results[_0x98c0('0x1a')](_0x566c55);})[_0x98c0('0x63')](function(_0x33e74e){logger[_0x98c0('0x5a')](_0x33e74e['message']);});}function updateTzCampaigns(_0x381ad1){return new Promise(function(_0x476d0d,_0x292206){var _0xf772b7=squel['select']()[_0x98c0('0x42')](['campaigns.id','campaigns.dialTimezone'])['from'](_0x98c0('0x64'))[_0x98c0('0x15')](_0x98c0('0x65'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where']('campaigns_has_cm_lists.CmListId='+_0x381ad1);db[_0x98c0('0x60')][_0x98c0('0x61')](_0xf772b7[_0x98c0('0x3c')]())['spread'](function(_0x566b1f){var _0x186faf=[];for(var _0x167fb2=0x0;_0x167fb2<_0x566b1f[_0x98c0('0x19')];_0x167fb2++){_0x186faf[_0x98c0('0x1a')](getTimezoneData(_0x566b1f[_0x167fb2],tmp_campaigns));}BPromise['all'](_0x186faf)[_0x98c0('0x18')](function(){_0x476d0d({'val':0x1});});})['catch'](function(_0x2b5b19){logger[_0x98c0('0x5a')](_0x2b5b19[_0x98c0('0x5b')]);_0x476d0d({'val':0x0});});});}function updateTzVoiceQueues(_0x1c5052){return new Promise(function(_0x357fc6,_0x9be803){var _0x59b1aa=squel['select']()[_0x98c0('0x42')](['voice_queues.id','voice_queues.dialTimezone'])['from'](_0x98c0('0x66'))[_0x98c0('0x15')]('voice_queues_has_cm_lists',null,_0x98c0('0x67'))['where']('voice_queues_has_cm_lists.CmListId='+_0x1c5052);db[_0x98c0('0x60')][_0x98c0('0x61')](_0x59b1aa[_0x98c0('0x3c')]())[_0x98c0('0x62')](function(_0x4244e0){var _0x13996b=[];for(var _0x446c54=0x0;_0x446c54<_0x4244e0[_0x98c0('0x19')];_0x446c54++){_0x13996b[_0x98c0('0x1a')](getTimezoneData(_0x4244e0[_0x446c54],tmp_voice_queues));}BPromise['all'](_0x13996b)['then'](function(){_0x357fc6({'val':0x1});});})[_0x98c0('0x63')](function(_0x41543d){logger[_0x98c0('0x5a')](_0x41543d[_0x98c0('0x5b')]);_0x357fc6({'val':0x0});});});}function getTimezoneData(_0x3c3786,_0x114e78){return new Promise(function(_0x1902c9,_0x14fed6){var _0xaf8238=shared[_0x98c0('0x68')];var _0x59e69a=_0xaf8238[_0x3c3786[_0x98c0('0x69')]];if(_[_0x98c0('0x1d')](_0x59e69a)){_0x1902c9({'ret':0x1});}else{var _0x16a845=_0x59e69a[_0x98c0('0x6a')];var _0xe52f2e=squel[_0x98c0('0x2b')]()['into'](_0x114e78)[_0x98c0('0x6b')]('id',_0x3c3786['id'])[_0x98c0('0x6b')](_0x98c0('0x6c'),_0x16a845)[_0x98c0('0x6b')]('dialTimezone',_0x3c3786[_0x98c0('0x69')])['toString']();return db[_0x98c0('0x60')][_0x98c0('0x61')](_0xe52f2e)['spread'](function(_0x33600e){_0x1902c9({'ret':0x1});})[_0x98c0('0x63')](function(_0x48ed17){logger[_0x98c0('0x5a')](_0x48ed17[_0x98c0('0x5b')]);_0x14fed6({'ret':0x1});});}});}function handleTZQuery(_0x3f286b){logger[_0x98c0('0x5f')](_0x3f286b);return db['sequelize'][_0x98c0('0x61')](_0x3f286b)[_0x98c0('0x62')](function(_0x210a90){})['catch'](function(_0x5233a9){logger[_0x98c0('0x5a')](_0x5233a9[_0x98c0('0x5b')]);});}function main(_0x43e721,_0xb1f354,_0x5793a0,_0x72c085){logger[_0x98c0('0x5f')](_0x98c0('0x6d'),_0x43e721,JSON[_0x98c0('0x6e')](_0xb1f354));process[_0x98c0('0x6f')](_0x98c0('0x70'));var _0x6d33ee=_0xb1f354[_0x98c0('0x71')];var _0x258afa=_['clone'](_0x6d33ee);var _0x193e8c=_0xb1f354['socket_timestamp'];var _0x3a0211=path['join'](config[_0x98c0('0x72')],_0x98c0('0x73'),_0x193e8c+_0x98c0('0x74'));hasTZ=_[_0x98c0('0x52')](_0x6d33ee)[_0x98c0('0x75')]('dialTimezone');var _0x2dcc61=_[_0x98c0('0x52')](_0x6d33ee)[_0x98c0('0x15')]();logger[_0x98c0('0x5f')](_0x98c0('0x76'),_0x2dcc61);db[_0x98c0('0x77')][_0x98c0('0x16')]({'raw':!![],'attributes':['id',_0x98c0('0x78')]})[_0x98c0('0x18')](function(_0x2dff38){for(var _0x46f7d3=0x0;_0x46f7d3<_0x2dff38[_0x98c0('0x19')];_0x46f7d3++){if(_0x2dff38[_0x46f7d3][_0x98c0('0x78')]in _0x6d33ee){contactItemTypes[_0x98c0('0x1a')](_0x2dff38[_0x46f7d3]);delete _0x258afa[_0x2dff38[_0x46f7d3][_0x98c0('0x78')]];hasAdditionalPhones=!![];}for(var _0x2cc336 in _0x6d33ee){if(_0x2dff38[_0x46f7d3][_0x98c0('0x78')]+'_description'===_0x2cc336){phoneDescriptions['push']({'itemTypeId':_0x2dff38[_0x46f7d3]['id'],'description':_0x2cc336});delete _0x258afa[_0x2cc336];}}}if(hasAdditionalPhones)_0x258afa[_0x98c0('0x17')]='';var _0x253fe7=_['keys'](_0x258afa)[_0x98c0('0x15')]();logger['info'](_0x98c0('0x76'),_0x253fe7);fs[_0x98c0('0x79')](_0x3a0211,_0x253fe7+'\x0a');Papa[_0x98c0('0x7a')](fs['createReadStream'](_0x43e721),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1b42e6,_0x112750){try{for(var _0x3d2d63=0x0,_0x1021f7=[];_0x3d2d63<_0x1b42e6[_0x98c0('0x7b')]['length'];_0x3d2d63++){stats[_0x98c0('0x7c')]+=0x1;if(_0x1b42e6[_0x98c0('0x5d')][_0x3d2d63]){handleError(_0x1b42e6[_0x98c0('0x7b')][_0x3d2d63],_0x1b42e6['errors'][_0x3d2d63]);}else{var _0xa86d53=[];var _0x35fc8b=[];var _0x2d5b7f={};for(var _0x3b0692 in _0x6d33ee){let _0x431d44=contactItemTypes['find'](_0x20ebc7=>_0x20ebc7['name']===_0x3b0692);let _0x234dc7=contactItemTypes[_0x98c0('0x7d')](_0x2caf29=>_0x2caf29[_0x98c0('0x78')]+_0x98c0('0x7e')===_0x3b0692);if(_[_0x98c0('0x1d')](_0x431d44)&&_[_0x98c0('0x1d')](_0x234dc7)){if(_0x6d33ee[_0x98c0('0x7f')](_0x3b0692)){if(_0x1b42e6[_0x98c0('0x7b')][_0x3d2d63][_0x6d33ee[_0x3b0692]]){var _0xacb5c7=_[_0x98c0('0x80')](_0x1b42e6['data'][_0x3d2d63][_0x6d33ee[_0x3b0692]][_0x98c0('0x81')](/"/g,'\x27'));switch(_0x3b0692){case _0x98c0('0x47'):var _0x34f1f6=moment(_0xacb5c7,_0x98c0('0xe'),!![]);if(_0x34f1f6[_0x98c0('0x82')]()){_0x1021f7[_0x98c0('0x1a')]('\x22'+_0xacb5c7+'\x22');}else{_0xa86d53[_0x98c0('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x98c0('0x48'):var _0x486cf5=parseInt(_0xacb5c7);_0xacb5c7=_[_0x98c0('0x83')](_0x486cf5)||_0x486cf5<0x0||_0x486cf5>0x4?_0x72c085?0x3:0x2:_0x486cf5;_0x1021f7[_0x98c0('0x1a')]('\x22'+_0xacb5c7+'\x22');break;case _0x98c0('0x30'):var _0x36ea32=parseInt(_0xacb5c7);if(_[_0x98c0('0x84')](_0x36ea32)&&_['includes'](_0x5793a0,_0x36ea32)){_0x1021f7['push']('\x22'+_0x36ea32+'\x22');}else{_0xa86d53[_0x98c0('0x1a')](_0x98c0('0x85'));}break;case _0x98c0('0x86'):if(isEmail(_0xacb5c7)){_0x1021f7[_0x98c0('0x1a')]('\x22'+_0xacb5c7+'\x22');}else{_0xa86d53[_0x98c0('0x1a')](_0x98c0('0x87'));}break;case _0x98c0('0x88'):var _0x5ec232=moment(_0xacb5c7,_0x98c0('0x89'),!![]);if(_0x5ec232[_0x98c0('0x82')]()){_0x1021f7[_0x98c0('0x1a')]('\x22'+_0xacb5c7+'\x22');}else{_0xa86d53[_0x98c0('0x1a')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x98c0('0x69'):var _0x5c2566=shared['timezones'];var _0x368e05=_0x5c2566[_0xacb5c7];if(!_[_0x98c0('0x1d')](_0x368e05)){var _0x34a554=_0x368e05[_0x98c0('0x6a')];_0x1021f7[_0x98c0('0x1a')]('\x22'+_0xacb5c7+'\x22');_0x1021f7[_0x98c0('0x1a')]('\x22'+_0x34a554+'\x22');}break;default:_0x1021f7['push']('\x22'+_0xacb5c7+'\x22');}}else{switch(_0x3b0692){case _0x98c0('0x8a'):case _0x98c0('0x2d'):_0xa86d53[_0x98c0('0x1a')](_0x3b0692+'\x20not\x20specified');break;default:_0x1021f7['push']('\x22\x22');}}}}else{var _0x405fcf='';if(!_['isNil'](_0x431d44)){if(!_0x2d5b7f['hasOwnProperty'](_0x431d44['id'])){if(!_['isNil'](_0x1b42e6[_0x98c0('0x7b')][_0x3d2d63][_0x6d33ee[_0x3b0692]])){var _0xacb5c7=_[_0x98c0('0x80')](_0x1b42e6[_0x98c0('0x7b')][_0x3d2d63][_0x6d33ee[_0x3b0692]]['replace'](/"/g,'\x27'));var _0x35f814=phoneDescriptions[_0x98c0('0x7d')](_0x16601c=>_0x16601c[_0x98c0('0x8b')]===_0x431d44['id']);if(!_[_0x98c0('0x1d')](_0x35f814)){var _0x32f4b3=_[_0x98c0('0x80')](_0x1b42e6[_0x98c0('0x7b')][_0x3d2d63][_0x6d33ee[_0x35f814[_0x98c0('0x8c')]]][_0x98c0('0x81')](/"/g,'\x27'));if(!_['isNil'](_0x32f4b3))_0xacb5c7=_0xacb5c7+'§'+_0x32f4b3;}if(_0x405fcf=='')_0x405fcf=_0xacb5c7;else _0x405fcf+='|'+_0xacb5c7;}_0x35fc8b[_0x98c0('0x1a')](_0x431d44['id']+':'+_0x405fcf);_0x2d5b7f[_0x431d44['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1021f7[_0x98c0('0x1a')]('\x22'+_0x35fc8b[_0x98c0('0x15')](';')+'\x22');}if(_0xa86d53[_0x98c0('0x19')]){handleError(_0x1b42e6[_0x98c0('0x7b')][_0x3d2d63],{'code':'SystemRow','message':_0xa86d53['join']()});}else{fs[_0x98c0('0x8d')](_0x3a0211,_0x1021f7['join']()+'\x0a');}_0x1021f7=[];}if(!(stats[_0x98c0('0x7c')]%0xc8)){socket['emit'](_0x98c0('0x8e')+_0x193e8c,stats);stats['errors']=[];}}if(stopped){logger[_0x98c0('0x5f')]('Abort\x20parser');_0x112750['abort']();}}catch(_0x5ad90d){handleError(_0x1b42e6[_0x98c0('0x7b')][_0x3d2d63],{'code':_0x98c0('0x8f'),'message':_0x5ad90d[_0x98c0('0x5b')]});logger['error'](_0x98c0('0x90'),_0x5ad90d[_0x98c0('0x5b')]);}},'complete':function(){try{var _0x2774d3=[];var _0x164228=[];var _0x328f57=_0x98c0('0x32');if(_0xb1f354[_0x98c0('0x91')]&&_0xb1f354[_0x98c0('0x91')][_0x98c0('0x19')]){_0x328f57=_0x98c0('0x92')+_0x193e8c;_0x2774d3[_0x98c0('0x1a')]('CREATE\x20TABLE\x20'+_0x328f57+_0x98c0('0x93'));}tmp_campaigns='campaigns_'+_0x193e8c;tmp_voice_queues=_0x98c0('0x94')+_0x193e8c;_0x164228[_0x98c0('0x1a')](_0x98c0('0x95')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x164228[_0x98c0('0x1a')](_0x98c0('0x95')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x164228,handleTZQuery)[_0x98c0('0x18')](function(_0x2df8d5){updateTzCampaigns(_0xb1f354['ListId'])[_0x98c0('0x18')](function(_0x3d64b7){updateTzVoiceQueues(_0xb1f354[_0x98c0('0x40')])['then'](function(_0x4e723d){if(hasTZ)_0x253fe7=_0x253fe7['replace'](_0x98c0('0x69'),'dialTimezone,utcOffset');var _0x14dff6=util[_0x98c0('0xd')](_0x98c0('0x96'),_0x3a0211,_0x328f57,_0x253fe7,_0xb1f354[_0x98c0('0x40')],_0xb1f354['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x6d33ee[_0x98c0('0x47')])){_0x14dff6+=_0x98c0('0x97');}_0x2774d3['push'](_0x14dff6);if(_0xb1f354[_0x98c0('0x91')]&&_0xb1f354[_0x98c0('0x91')][_0x98c0('0x19')]){_0x2774d3[_0x98c0('0x1a')](insertCmContact(_0xb1f354[_0x98c0('0x40')],_0x328f57,_0xb1f354[_0x98c0('0x91')],_0x6d33ee));_0x2774d3[_0x98c0('0x1a')]('DROP\x20TABLE\x20'+_0x328f57+';');}BPromise[_0x98c0('0x98')](_0x2774d3,handleQuery)['then'](function(_0x1c36e4){BPromise['all']([handleAdditionalPhones()])[_0x98c0('0x18')](function(){_0x2774d3=[];for(var _0x592114=0x0;_0x592114\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','field','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','then','catch','error','message','split','filter','CmContactHasItem','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','fields','from','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','cm_hopper_black','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','group','Received\x20SIGINT','exit','code','spread','info','main','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','body','findAll','name','_description','header','writeFileSync','parse','createReadStream','errors','data','find','hasOwnProperty','trim','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','all','contactTypeId','orderBy','DROP\x20TABLE\x20','finish'];(function(_0x4b53c0,_0x1bdfd6){var _0x1282b2=function(_0x4a5224){while(--_0x4a5224){_0x4b53c0['push'](_0x4b53c0['shift']());}};_0x1282b2(++_0x1bdfd6);}(_0xb396,0x1e8));var _0x6b39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb396[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x6b39('0x0'));var _=require(_0x6b39('0x1'));var Papa=require(_0x6b39('0x2'));var util=require(_0x6b39('0x3'));var BPromise=require('bluebird');var moment=require(_0x6b39('0x4'));var squel=require(_0x6b39('0x5'));var Redis=require(_0x6b39('0x6'));var db=require(_0x6b39('0x7'))['db'];var config=require(_0x6b39('0x8'));var logger=require(_0x6b39('0x9'))('import');config[_0x6b39('0xa')]=_['defaults'](config[_0x6b39('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b39('0xa')]));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()[_0x6b39('0xb')](_0x6b39('0xc'));var tempTableName=_0x6b39('0xd')+moment()[_0x6b39('0xb')](_0x6b39('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x32c7b2){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'](_0x32c7b2);}function selectNotIn(_0x4a1b39,_0x5c098a,_0x4f1e2e,_0x5db762,_0x5ba3af){return squel['select']()[_0x6b39('0xf')](_0x6b39('0x10'))['from'](_0x5db762)['join'](_0x5c098a,null,_0x5c098a+_0x6b39('0x11')+_0x5db762+'.'+_0x4f1e2e)[_0x6b39('0x12')](_0x5db762+'.'+_0x4f1e2e+_0x6b39('0x13')+_0x4a1b39+'.'+_0x4f1e2e)[_0x6b39('0x12')](_0x5c098a+_0x6b39('0x14')+_0x5ba3af['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3d12b0,_0x47f61f){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6b39('0x15')][_0x6b39('0x16')](_0x6b39('0x17')+tempTableName)['spread'](function(_0x84b853){if(_0x84b853!==null){var _0x5426f5=[];for(var _0x27cf58=0x0;_0x27cf58<_0x84b853[_0x6b39('0x18')];_0x27cf58++){var _0x1032b1=_0x84b853[_0x27cf58];if(!_[_0x6b39('0x19')](_0x1032b1[_0x6b39('0x10')])){if(!_[_0x6b39('0x19')](_0x1032b1[_0x6b39('0x1a')]))_0x5426f5[_0x6b39('0x1b')](insertAdditionalPhones(_0x1032b1));promisesContact['push']({'contact':_0x1032b1});}}}Promise['all'](_0x5426f5)[_0x6b39('0x1c')](function(){_0x3d12b0({'val':0x1});});})[_0x6b39('0x1d')](function(_0x6b9cde){logger[_0x6b39('0x1e')](_0x6b9cde[_0x6b39('0x1f')]);});});}function insertAdditionalPhones(_0x299538){return new Promise(function(_0x458e7d,_0x560024){var _0x30f50a=_0x299538[_0x6b39('0x1a')];if(_['isNil'](_0x30f50a))_0x560024({'val':0x0});else{var _0x187ab1=_0x30f50a[_0x6b39('0x20')](';');var _0x3b7250=[];orderBy=0x0;for(var _0x19e40f=0x0;_0x19e40f<_0x187ab1['length'];_0x19e40f++){_0x3b7250[_0x6b39('0x1b')](splitAdditionalPhone(_0x299538['id'],_0x187ab1[_0x19e40f]));}Promise['all'](_0x3b7250)['then'](function(){_0x458e7d({'val':_0x187ab1[_0x6b39('0x18')]});});}});}function splitAdditionalPhone(_0x2e4fbf,_0x1f70bd){return new Promise(function(_0x5183cc,_0x4ebc33){var _0x503d6f=_0x1f70bd['split'](':');var _0xd3a560=_0x503d6f[0x0];var _0x2423bb=_0x503d6f[0x1];if(_0x2423bb!==''){var _0x176d42=_0x2423bb['split']('|');var _0x8a5812=[];for(var _0x517d16=0x0;_0x517d16<_0x176d42[_0x6b39('0x18')];_0x517d16++){if(_0x176d42[_0x517d16]!==''){var _0x4f0c90=_[_0x6b39('0x21')](promisesAdditionalPhones,{'contactId':_0x2e4fbf,'phone':_0x176d42[_0x517d16]});if(_0x4f0c90[_0x6b39('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x6b39('0x1b')]({'contactId':_0x2e4fbf,'contactTypeId':_0xd3a560,'phone':_0x176d42[_0x517d16],'orderBy':orderBy});}}}_0x5183cc({'ok':0x1});}else _0x5183cc({'res':0x0});});}function createAdditionalPhone(_0x478821,_0x240333,_0x26ef5b,_0x2e2e8d){var _0x47bad3='';var _0x1689fb='';var _0x2fa81a=_0x26ef5b[_0x6b39('0x20')]('§');_0x47bad3=_0x2fa81a[0x0];if(_0x2fa81a['length']==0x2)_0x1689fb=_0x2fa81a[0x1];return new Promise(function(_0x2f0b4e,_0x2b708d){return db[_0x6b39('0x22')]['findOne']({'where':{'CmContactId':_0x478821,'item':_0x47bad3}})[_0x6b39('0x1c')](function(_0x99624a){if(_0x99624a){return db[_0x6b39('0x22')][_0x6b39('0x23')]({'ItemTypeId':_0x240333,'description':_0x1689fb,'OrderBy':_0x2e2e8d},{'where':{'CmContactId':_0x478821,'item':_0x47bad3}})[_0x6b39('0x1c')](function(_0x1ed454){_0x2f0b4e({'res':_0x6b39('0x24')});});}else{return db['CmContactHasItem'][_0x6b39('0x25')]({'CmContactId':_0x478821,'item':_0x47bad3,'ItemTypeId':_0x240333,'description':_0x1689fb,'OrderBy':_0x2e2e8d,'ItemClass':_0x6b39('0x26')})['then'](function(_0x3d3f98){_0x2f0b4e({'res':_0x6b39('0x27')});});}});});}function updateContact(_0x1fd3ca){return new Promise(function(_0x464b49,_0x415e3c){var _0xe1e73a=_0x1fd3ca['id'];delete _0x1fd3ca['id'];return db['CmContact'][_0x6b39('0x23')](_0x1fd3ca,{'where':{'id':_0xe1e73a}})[_0x6b39('0x1c')](function(_0xd0f0bd){updatedRows+=0x1;return db[_0x6b39('0x28')]['update']({'phone':_0x1fd3ca[_0x6b39('0x10')]},{'where':{'ContactId':_0xe1e73a}})[_0x6b39('0x1c')](function(_0x407d10){_0x464b49({'ret':'OK'});});});});}function insertCmHopper(_0xae010e,_0x3d6faa,_0x449afc,_0x31766f,_0x19269e){var _0x2dbc7f=['cm_contacts.phone','cm_contacts.scheduledat',_0x6b39('0x29'),_0x6b39('0x2a'),_0x3d6faa+'.'+_0x31766f,_0x6b39('0x2b'),'cm_contacts.updatedAt','cm_contacts.priority',_0x6b39('0x2c'),'\x22'+_0x19269e+'\x22'];return squel[_0x6b39('0x2d')]()[_0x6b39('0x2e')](_0x6b39('0x2f'))[_0x6b39('0x30')]([_0x6b39('0x10'),'scheduledat',_0x6b39('0x31'),_0x6b39('0x32'),_0x31766f,_0x6b39('0x33'),_0x6b39('0x34'),'priority',_0x6b39('0x35'),_0x6b39('0x36')],squel[_0x6b39('0x37')]()[_0x6b39('0x38')](_0x2dbc7f)[_0x6b39('0x39')](_0x3d6faa)[_0x6b39('0x3a')](_0x6b39('0x3b'),null,_0x6b39('0x3c')+_0x3d6faa+'.CmListId')['join'](_0x449afc,null,_0x449afc+_0x6b39('0x11')+_0x3d6faa+'.'+_0x31766f)['where'](_0x3d6faa+_0x6b39('0x3d'),_0xae010e)[_0x6b39('0x12')](_0x6b39('0x3e'),NOW)[_0x6b39('0x12')](_0x6b39('0x3f'),selectNotIn(_0x3d6faa,_0x449afc,_0x31766f,_0x6b39('0x2f'),[_0x6b39('0x40'),'\x22onlyIfOpen\x22']))[_0x6b39('0x12')](_0x6b39('0x3f'),selectNotIn(_0x3d6faa,_0x449afc,_0x31766f,_0x6b39('0x2f'),[_0x6b39('0x40')])))[_0x6b39('0x41')]();}function insertCmHopperBlack(_0x198eae,_0x1e94a8,_0x4d7390,_0x45c70b){var _0x32cca6=[_0x6b39('0x42'),'cm_contacts.id',_0x6b39('0x2a'),_0x1e94a8+'.'+_0x45c70b,_0x6b39('0x2b'),_0x6b39('0x43')];return squel[_0x6b39('0x2d')]()[_0x6b39('0x2e')](_0x6b39('0x44'))[_0x6b39('0x30')]([_0x6b39('0x10'),'ContactId',_0x6b39('0x32'),_0x45c70b,_0x6b39('0x33'),_0x6b39('0x34')],squel[_0x6b39('0x37')]()[_0x6b39('0x38')](_0x32cca6)[_0x6b39('0x39')](_0x1e94a8)['join'](_0x6b39('0x3b'),null,_0x6b39('0x3c')+_0x1e94a8+'.CmListId')['join'](_0x4d7390,null,_0x4d7390+_0x6b39('0x11')+_0x1e94a8+'.'+_0x45c70b)[_0x6b39('0x12')](_0x1e94a8+_0x6b39('0x3d'),_0x198eae)[_0x6b39('0x12')](_0x6b39('0x3e'),NOW)[_0x6b39('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6b39('0x37')]()['field'](_0x6b39('0x10'))['from'](_0x6b39('0x44'))[_0x6b39('0x12')]('ListId\x20=\x20?',_0x198eae)['where'](_0x45c70b+'\x20=\x20?',_0x1e94a8+'.'+_0x45c70b)))['toString']();}function insertCmHopperAdditionalPhones(_0xc8a66b){var _0x499657=[_0x6b39('0x45'),_0x6b39('0x46'),_0x6b39('0x47'),_0x6b39('0x48'),_0x6b39('0x49')];return squel[_0x6b39('0x2d')]()['into'](_0x6b39('0x4a'))[_0x6b39('0x30')]([_0x6b39('0x4b'),_0x6b39('0x10'),_0x6b39('0x4c'),'createdAt','updatedAt'],squel[_0x6b39('0x37')]()[_0x6b39('0x38')](_0x499657)[_0x6b39('0x39')](_0x6b39('0x2f'))[_0x6b39('0x3a')](_0x6b39('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6b39('0x3a')](_0x6b39('0x4d'),null,_0x6b39('0x4e'))[_0x6b39('0x12')]('cm_hopper.ListId\x20=\x20?',_0xc8a66b)['where'](_0x6b39('0x3e'),NOW))[_0x6b39('0x41')]();}function insertCmContact(_0x1a3867,_0xbc53b9,_0x2b50ba,_0x37e2ef){var _0x841aa6=_[_0x6b39('0x4f')](_[_0x6b39('0x50')](_0x37e2ef),[_0x6b39('0x32'),_0x6b39('0x51'),'createdAt',_0x6b39('0x34')]);return squel[_0x6b39('0x2d')]()[_0x6b39('0x2e')]('cm_contacts')[_0x6b39('0x30')](_0x841aa6,squel[_0x6b39('0x37')]()['fields'](_0x841aa6)[_0x6b39('0x39')](_0xbc53b9)['where']('('+_0x2b50ba[_0x6b39('0x3a')](',')+_0x6b39('0x52'),squel[_0x6b39('0x37')]()[_0x6b39('0x38')](_0x2b50ba)[_0x6b39('0x39')]('cm_contacts')[_0x6b39('0x12')]('ListId\x20=\x20?',_0x1a3867))[_0x6b39('0x12')]('id\x20IN\x20?',squel['select']()[_0x6b39('0xf')](_0x6b39('0x53'),'min_id')[_0x6b39('0x39')](_0xbc53b9)[_0x6b39('0x54')](_0x2b50ba[_0x6b39('0x3a')](','))))['toString']();}function handleStop(){logger['info'](_0x6b39('0x55'));stopped=!![];}function handleUncaughtException(_0x13f439){logger[_0x6b39('0x1e')](_0x13f439[_0x6b39('0x1f')]);process[_0x6b39('0x56')](0x1);}function handleError(_0x54dea6,_0x438008){stats['errors'][_0x6b39('0x1b')]({'name':_0x438008[_0x6b39('0x57')],'message':_0x438008[_0x6b39('0x1f')],'row':_0x54dea6});}function handleQuery(_0x458596){logger['info'](_0x458596);return db[_0x6b39('0x15')][_0x6b39('0x16')](_0x458596)[_0x6b39('0x58')](function(_0x277017){results[_0x6b39('0x1b')](_0x277017);})[_0x6b39('0x1d')](function(_0x47801e){logger[_0x6b39('0x1e')](_0x47801e[_0x6b39('0x1f')]);});}function main(_0x176cf0,_0x481167,_0x387ea9,_0x295657){logger[_0x6b39('0x59')](_0x6b39('0x5a'),_0x176cf0,JSON[_0x6b39('0x5b')](_0x481167));process[_0x6b39('0x5c')](_0x6b39('0x5d'));var _0x3e8aa6=_0x481167['binding'];var _0x1aeb70=_['clone'](_0x3e8aa6);var _0x2aa853=_0x481167[_0x6b39('0x5e')];var _0x387115=path[_0x6b39('0x3a')](config[_0x6b39('0x5f')],_0x6b39('0x60'),_0x2aa853+_0x6b39('0x61'));logger[_0x6b39('0x59')](_0x6b39('0x62'),_0x481167);db['ContactItemType'][_0x6b39('0x63')]({'raw':!![],'attributes':['id',_0x6b39('0x64')]})[_0x6b39('0x1c')](function(_0x13d6e0){for(var _0x59cd04=0x0;_0x59cd04<_0x13d6e0[_0x6b39('0x18')];_0x59cd04++){if(_0x13d6e0[_0x59cd04][_0x6b39('0x64')]in _0x3e8aa6){contactItemTypes['push'](_0x13d6e0[_0x59cd04]);delete _0x1aeb70[_0x13d6e0[_0x59cd04][_0x6b39('0x64')]];hasAdditionalPhones=!![];}for(var _0x5f3378 in _0x3e8aa6){if(_0x13d6e0[_0x59cd04][_0x6b39('0x64')]+_0x6b39('0x65')===_0x5f3378){phoneDescriptions[_0x6b39('0x1b')]({'itemTypeId':_0x13d6e0[_0x59cd04]['id'],'description':_0x5f3378});delete _0x1aeb70[_0x5f3378];}}}if(hasAdditionalPhones)_0x1aeb70[_0x6b39('0x1a')]='';var _0x32acea=_[_0x6b39('0x50')](_0x1aeb70)[_0x6b39('0x3a')]();logger[_0x6b39('0x59')](_0x6b39('0x66'),_0x32acea);fs[_0x6b39('0x67')](_0x387115,_0x32acea+'\x0a');Papa[_0x6b39('0x68')](fs[_0x6b39('0x69')](_0x176cf0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58e50e,_0x3d467e){try{for(var _0x55955a=0x0,_0x17e995=[];_0x55955a<_0x58e50e['data'][_0x6b39('0x18')];_0x55955a++){stats['rows']+=0x1;if(_0x58e50e[_0x6b39('0x6a')][_0x55955a]){handleError(_0x58e50e[_0x6b39('0x6b')][_0x55955a],_0x58e50e['errors'][_0x55955a]);}else{var _0x1f7f88=[];var _0x33a746=[];var _0x14b5ba={};for(var _0x31e804 in _0x3e8aa6){let _0x224e41=contactItemTypes[_0x6b39('0x6c')](_0xe74424=>_0xe74424['name']===_0x31e804);let _0x405d6d=contactItemTypes[_0x6b39('0x6c')](_0x579cd1=>_0x579cd1[_0x6b39('0x64')]+_0x6b39('0x65')===_0x31e804);if(_['isNil'](_0x224e41)&&_[_0x6b39('0x19')](_0x405d6d)){if(_0x3e8aa6[_0x6b39('0x6d')](_0x31e804)){if(_0x58e50e['data'][_0x55955a][_0x3e8aa6[_0x31e804]]){var _0x2e448e=_[_0x6b39('0x6e')](_0x58e50e[_0x6b39('0x6b')][_0x55955a][_0x3e8aa6[_0x31e804]][_0x6b39('0x6f')](/"/g,'\x27'));switch(_0x31e804){case _0x6b39('0x70'):var _0x92d331=moment(_0x2e448e,_0x6b39('0xc'),!![]);if(_0x92d331['isValid']()){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');}else{_0x1f7f88[_0x6b39('0x1b')](_0x6b39('0x71'));}break;case _0x6b39('0x72'):var _0x30e3bc=parseInt(_0x2e448e);_0x2e448e=_['isNaN'](_0x30e3bc)||_0x30e3bc<0x0||_0x30e3bc>0x4?_0x295657?0x3:0x2:_0x30e3bc;_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');break;case _0x6b39('0x35'):var _0x134a4b=parseInt(_0x2e448e);if(_[_0x6b39('0x73')](_0x134a4b)&&_[_0x6b39('0x74')](_0x387ea9,_0x134a4b)){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x134a4b+'\x22');}else{_0x1f7f88[_0x6b39('0x1b')](_0x6b39('0x75'));}break;case _0x6b39('0x76'):if(isEmail(_0x2e448e)){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');}else{_0x1f7f88[_0x6b39('0x1b')]('email\x20wrong\x20format');}break;case _0x6b39('0x77'):var _0x3c4a5c=moment(_0x2e448e,_0x6b39('0x78'),!![]);if(_0x3c4a5c[_0x6b39('0x79')]()){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');}else{_0x1f7f88['push'](_0x6b39('0x7a'));}break;default:_0x17e995[_0x6b39('0x1b')]('\x22'+_0x2e448e+'\x22');}}else{switch(_0x31e804){case _0x6b39('0x7b'):case _0x6b39('0x10'):_0x1f7f88[_0x6b39('0x1b')](_0x31e804+_0x6b39('0x7c'));break;default:_0x17e995['push']('\x22\x22');}}}}else{var _0xdd0122='';if(!_['isNil'](_0x224e41)){if(!_0x14b5ba['hasOwnProperty'](_0x224e41['id'])){for(var _0x4e407b=0x0;_0x4e407b<_0x3e8aa6[_0x31e804][_0x6b39('0x18')];_0x4e407b++){var _0x2e448e=_[_0x6b39('0x6e')](_0x58e50e['data'][_0x55955a][_0x3e8aa6[_0x31e804][_0x4e407b]][_0x6b39('0x6f')](/"/g,'\x27'));var _0x4cc24c=phoneDescriptions[_0x6b39('0x6c')](_0x5de53b=>_0x5de53b[_0x6b39('0x7d')]===_0x224e41['id']);if(!_['isNil'](_0x4cc24c)){var _0x84653f=_[_0x6b39('0x6e')](_0x58e50e[_0x6b39('0x6b')][_0x55955a][_0x3e8aa6[_0x4cc24c[_0x6b39('0x7e')]][0x0]][_0x6b39('0x6f')](/"/g,'\x27'));if(!_['isNil'](_0x84653f))_0x2e448e=_0x2e448e+'§'+_0x84653f;}if(_0xdd0122=='')_0xdd0122=_0x2e448e;else _0xdd0122+='|'+_0x2e448e;}_0x33a746[_0x6b39('0x1b')](_0x224e41['id']+':'+_0xdd0122);_0x14b5ba[_0x224e41['id']]=0x1;}}}}if(hasAdditionalPhones){_0x17e995[_0x6b39('0x1b')]('\x22'+_0x33a746[_0x6b39('0x3a')](';')+'\x22');}if(_0x1f7f88['length']){handleError(_0x58e50e['data'][_0x55955a],{'code':_0x6b39('0x7f'),'message':_0x1f7f88[_0x6b39('0x3a')]()});}else{fs[_0x6b39('0x80')](_0x387115,_0x17e995['join']()+'\x0a');}_0x17e995=[];}if(!(stats['rows']%0xc8)){socket[_0x6b39('0x81')](_0x6b39('0x82')+_0x2aa853,stats);stats['errors']=[];}}if(stopped){logger[_0x6b39('0x59')](_0x6b39('0x83'));_0x3d467e[_0x6b39('0x84')]();}}catch(_0x28b314){handleError(_0x58e50e[_0x6b39('0x6b')][_0x55955a],{'code':'SystemError','message':_0x28b314[_0x6b39('0x1f')]});logger[_0x6b39('0x1e')](_0x6b39('0x85'),_0x28b314[_0x6b39('0x1f')]);}},'complete':function(){try{var _0x3b0c4c=[];var _0x16488c=tempTableName;_0x3b0c4c[_0x6b39('0x1b')]('CREATE\x20TABLE\x20'+_0x16488c+_0x6b39('0x86'));logger[_0x6b39('0x59')](_0x6b39('0x87'),contactItemTypes[_0x6b39('0x18')]);var _0x38ca13=util[_0x6b39('0xb')](_0x6b39('0x88'),_0x387115,_0x16488c,_0x32acea,_0x481167['ListId'],_0x481167['CompanyId']||null,NOW,NOW);if(_[_0x6b39('0x19')](_0x3e8aa6[_0x6b39('0x70')])){_0x38ca13+=_0x6b39('0x89');}_0x3b0c4c[_0x6b39('0x1b')](_0x38ca13);BPromise[_0x6b39('0x8a')](_0x3b0c4c,handleQuery)[_0x6b39('0x1c')](function(_0x523406){BPromise[_0x6b39('0x8b')]([handleAdditionalPhones()])[_0x6b39('0x1c')](function(){_0x3b0c4c=[];for(var _0xe9c994=0x0;_0xe9c994\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','phone','from','join','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','message','split','then','CmContactHasItem','update','updated','create','PHONE','CmContact','CmHopper','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','ListId','updatedAt','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','field','min_id','group','info','Received\x20SIGINT','code','query'];(function(_0x5df3e8,_0x31f089){var _0x3f0f21=function(_0x3b8099){while(--_0x3b8099){_0x5df3e8['push'](_0x5df3e8['shift']());}};_0x3f0f21(++_0x31f089);}(_0x62c0,0xdb));var _0x062c=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0x62c0[_0x453e2b];return _0x50f306;};'use strict';var fs=require('fs');var path=require(_0x062c('0x0'));var _=require(_0x062c('0x1'));var Papa=require(_0x062c('0x2'));var util=require(_0x062c('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require(_0x062c('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x062c('0x5'));var logger=require(_0x062c('0x6'))(_0x062c('0x7'));config['redis']=_[_0x062c('0x8')](config[_0x062c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x062c('0xa'))(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()[_0x062c('0xb')](_0x062c('0xc'));var tempTableName=_0x062c('0xd')+moment()[_0x062c('0xb')](_0x062c('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x24d65e){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))*$/[_0x062c('0xf')](_0x24d65e);}function selectNotIn(_0x599f88,_0x4200fc,_0x4246cc,_0x7915ba,_0x1e5847){return squel['select']()['field'](_0x062c('0x10'))[_0x062c('0x11')](_0x7915ba)[_0x062c('0x12')](_0x4200fc,null,_0x4200fc+'.id\x20=\x20'+_0x7915ba+'.'+_0x4246cc)[_0x062c('0x13')](_0x7915ba+'.'+_0x4246cc+'\x20=\x20'+_0x599f88+'.'+_0x4246cc)[_0x062c('0x13')](_0x4200fc+_0x062c('0x14')+_0x1e5847[_0x062c('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x163a1d,_0x456c3e){promisesAdditionalPhones=[];promisesContact=[];return db[_0x062c('0x15')]['query'](_0x062c('0x16')+tempTableName)[_0x062c('0x17')](function(_0x4b9c53){if(_0x4b9c53!==null){var _0x53029a=[];for(var _0x1c3cc2=0x0;_0x1c3cc2<_0x4b9c53[_0x062c('0x18')];_0x1c3cc2++){var _0x3484c9=_0x4b9c53[_0x1c3cc2];if(!_[_0x062c('0x19')](_0x3484c9[_0x062c('0x10')])){if(!_[_0x062c('0x19')](_0x3484c9[_0x062c('0x1a')]))_0x53029a[_0x062c('0x1b')](insertAdditionalPhones(_0x3484c9));promisesContact[_0x062c('0x1b')]({'contact':_0x3484c9});}}}Promise[_0x062c('0x1c')](_0x53029a)['then'](function(){_0x163a1d({'val':0x1});});})['catch'](function(_0x411bc2){logger['error'](_0x411bc2[_0x062c('0x1d')]);});});}function insertAdditionalPhones(_0x38b0a7){return new Promise(function(_0x7a0dce,_0x5061bf){var _0x514533=_0x38b0a7[_0x062c('0x1a')];if(_[_0x062c('0x19')](_0x514533))_0x5061bf({'val':0x0});else{var _0x5a24dc=_0x514533[_0x062c('0x1e')](';');var _0x286938=[];orderBy=0x0;for(var _0x230040=0x0;_0x230040<_0x5a24dc[_0x062c('0x18')];_0x230040++){_0x286938['push'](splitAdditionalPhone(_0x38b0a7['id'],_0x5a24dc[_0x230040]));}Promise[_0x062c('0x1c')](_0x286938)[_0x062c('0x1f')](function(){_0x7a0dce({'val':_0x5a24dc[_0x062c('0x18')]});});}});}function splitAdditionalPhone(_0x3b7b89,_0x7b03e9){return new Promise(function(_0x226658,_0x533127){var _0x1c2a21=_0x7b03e9[_0x062c('0x1e')](':');var _0x2edc23=_0x1c2a21[0x0];var _0x574afa=_0x1c2a21[0x1];if(_0x574afa!==''){var _0x45d075=_0x574afa[_0x062c('0x1e')]('|');var _0x4e208c=[];for(var _0x4518b1=0x0;_0x4518b1<_0x45d075[_0x062c('0x18')];_0x4518b1++){if(_0x45d075[_0x4518b1]!==''){var _0x359a3c=_['filter'](promisesAdditionalPhones,{'contactId':_0x3b7b89,'phone':_0x45d075[_0x4518b1]});if(_0x359a3c[_0x062c('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3b7b89,'contactTypeId':_0x2edc23,'phone':_0x45d075[_0x4518b1],'orderBy':orderBy});}}}_0x226658({'ok':0x1});}else _0x226658({'res':0x0});});}function createAdditionalPhone(_0x3d0063,_0x99c328,_0xa36b16,_0x537b08){var _0x4a648e='';var _0x337551='';var _0x3caadf=_0xa36b16['split']('§');_0x4a648e=_0x3caadf[0x0];if(_0x3caadf[_0x062c('0x18')]==0x2)_0x337551=_0x3caadf[0x1];return new Promise(function(_0x128e26,_0x56f660){return db[_0x062c('0x20')]['findOne']({'where':{'CmContactId':_0x3d0063,'item':_0x4a648e}})[_0x062c('0x1f')](function(_0x16405b){if(_0x16405b){return db['CmContactHasItem'][_0x062c('0x21')]({'ItemTypeId':_0x99c328,'description':_0x337551,'OrderBy':_0x537b08},{'where':{'CmContactId':_0x3d0063,'item':_0x4a648e}})['then'](function(_0x3f1e3d){_0x128e26({'res':_0x062c('0x22')});});}else{return db[_0x062c('0x20')][_0x062c('0x23')]({'CmContactId':_0x3d0063,'item':_0x4a648e,'ItemTypeId':_0x99c328,'description':_0x337551,'OrderBy':_0x537b08,'ItemClass':_0x062c('0x24')})['then'](function(_0x614d51){_0x128e26({'res':'inserted'});});}});});}function updateContact(_0x15e605){return new Promise(function(_0x50d31f,_0x35e101){var _0x453041=_0x15e605['id'];delete _0x15e605['id'];return db[_0x062c('0x25')][_0x062c('0x21')](_0x15e605,{'where':{'id':_0x453041}})[_0x062c('0x1f')](function(_0x4cd776){updatedRows+=0x1;return db[_0x062c('0x26')][_0x062c('0x21')]({'phone':_0x15e605['phone']},{'where':{'ContactId':_0x453041}})[_0x062c('0x1f')](function(_0x2aaba7){_0x50d31f({'ret':'OK'});});});});}function insertCmHopper(_0x5b3633,_0x4b9c8e,_0x5adf85,_0x19f442,_0x5b7157){var _0x3f1b14=['cm_contacts.phone','cm_contacts.scheduledat',_0x062c('0x27'),_0x062c('0x28'),_0x4b9c8e+'.'+_0x19f442,_0x062c('0x29'),_0x062c('0x2a'),_0x062c('0x2b'),_0x062c('0x2c'),'\x22'+_0x5b7157+'\x22'];return squel[_0x062c('0x2d')]()[_0x062c('0x2e')](_0x062c('0x2f'))[_0x062c('0x30')](['phone',_0x062c('0x31'),_0x062c('0x32'),'ListId',_0x19f442,_0x062c('0x33'),'updatedAt','priority','UserId',_0x062c('0x34')],squel[_0x062c('0x35')]()[_0x062c('0x36')](_0x3f1b14)[_0x062c('0x11')](_0x4b9c8e)[_0x062c('0x12')](_0x062c('0x37'),null,_0x062c('0x38')+_0x4b9c8e+_0x062c('0x39'))[_0x062c('0x12')](_0x5adf85,null,_0x5adf85+'.id\x20=\x20'+_0x4b9c8e+'.'+_0x19f442)[_0x062c('0x13')](_0x4b9c8e+_0x062c('0x3a'),_0x5b3633)[_0x062c('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x062c('0x13')](_0x062c('0x3b'),selectNotIn(_0x4b9c8e,_0x5adf85,_0x19f442,_0x062c('0x2f'),[_0x062c('0x3c'),'\x22onlyIfOpen\x22']))[_0x062c('0x13')](_0x062c('0x3b'),selectNotIn(_0x4b9c8e,_0x5adf85,_0x19f442,_0x062c('0x2f'),[_0x062c('0x3c')])))[_0x062c('0x3d')]();}function insertCmHopperBlack(_0x7dc1a8,_0x359a97,_0x1b50b8,_0x580651){var _0x3aa252=['cm_contacts.phone','cm_contacts.id',_0x062c('0x28'),_0x359a97+'.'+_0x580651,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x062c('0x2d')]()[_0x062c('0x2e')]('cm_hopper_black')[_0x062c('0x30')]([_0x062c('0x10'),_0x062c('0x32'),_0x062c('0x3e'),_0x580651,'createdAt',_0x062c('0x3f')],squel[_0x062c('0x35')]()[_0x062c('0x36')](_0x3aa252)[_0x062c('0x11')](_0x359a97)[_0x062c('0x12')]('cm_contacts',null,_0x062c('0x38')+_0x359a97+_0x062c('0x39'))[_0x062c('0x12')](_0x1b50b8,null,_0x1b50b8+_0x062c('0x40')+_0x359a97+'.'+_0x580651)['where'](_0x359a97+'.CmListId\x20=\x20?',_0x7dc1a8)[_0x062c('0x13')](_0x062c('0x41'),NOW)[_0x062c('0x13')](_0x062c('0x3b'),squel[_0x062c('0x35')]()['field'](_0x062c('0x10'))[_0x062c('0x11')](_0x062c('0x42'))[_0x062c('0x13')]('ListId\x20=\x20?',_0x7dc1a8)[_0x062c('0x13')](_0x580651+'\x20=\x20?',_0x359a97+'.'+_0x580651)))[_0x062c('0x3d')]();}function insertCmHopperAdditionalPhones(_0x583b73){var _0x971b13=[_0x062c('0x43'),_0x062c('0x44'),_0x062c('0x45'),'cm_contact_has_items.createdAt',_0x062c('0x46')];return squel['insert']()[_0x062c('0x2e')](_0x062c('0x47'))['fromQuery'](['CmHopperId',_0x062c('0x10'),_0x062c('0x48'),_0x062c('0x33'),_0x062c('0x3f')],squel[_0x062c('0x35')]()[_0x062c('0x36')](_0x971b13)['from'](_0x062c('0x2f'))[_0x062c('0x12')](_0x062c('0x37'),null,_0x062c('0x49'))['join']('cm_contact_has_items',null,_0x062c('0x4a'))[_0x062c('0x13')](_0x062c('0x4b'),_0x583b73)[_0x062c('0x13')](_0x062c('0x41'),NOW))[_0x062c('0x3d')]();}function insertCmContact(_0x10cfdb,_0x10741d,_0x2ce96f,_0x2c425d){var _0x310c22=_[_0x062c('0x4c')](_[_0x062c('0x4d')](_0x2c425d),[_0x062c('0x3e'),_0x062c('0x4e'),_0x062c('0x33'),_0x062c('0x3f')]);return squel[_0x062c('0x2d')]()[_0x062c('0x2e')](_0x062c('0x37'))[_0x062c('0x30')](_0x310c22,squel['select']()[_0x062c('0x36')](_0x310c22)['from'](_0x10741d)[_0x062c('0x13')]('('+_0x2ce96f['join'](',')+_0x062c('0x4f'),squel[_0x062c('0x35')]()[_0x062c('0x36')](_0x2ce96f)['from'](_0x062c('0x37'))[_0x062c('0x13')]('ListId\x20=\x20?',_0x10cfdb))['where']('id\x20IN\x20?',squel[_0x062c('0x35')]()[_0x062c('0x50')]('MIN(id)',_0x062c('0x51'))[_0x062c('0x11')](_0x10741d)[_0x062c('0x52')](_0x2ce96f[_0x062c('0x12')](','))))[_0x062c('0x3d')]();}function handleStop(){logger[_0x062c('0x53')](_0x062c('0x54'));stopped=!![];}function handleUncaughtException(_0x59d86b){logger['error'](_0x59d86b['message']);process['exit'](0x1);}function handleError(_0x56293a,_0x52b57b){stats['errors'][_0x062c('0x1b')]({'name':_0x52b57b[_0x062c('0x55')],'message':_0x52b57b['message'],'row':_0x56293a});}function handleQuery(_0x48a6db){logger[_0x062c('0x53')](_0x48a6db);return db['sequelize'][_0x062c('0x56')](_0x48a6db)['spread'](function(_0x1fce5c){results[_0x062c('0x1b')](_0x1fce5c);})['catch'](function(_0x2f208d){logger[_0x062c('0x57')](_0x2f208d[_0x062c('0x1d')]);});}function main(_0x56eee5,_0xa4ac13,_0x9e0f07,_0x12f060){logger['info']('main',_0x56eee5,JSON[_0x062c('0x58')](_0xa4ac13));process[_0x062c('0x59')](_0x062c('0x5a'));var _0x305c58=_0xa4ac13['binding'];var _0x14cdd2=_['clone'](_0x305c58);var _0x836936=_0xa4ac13[_0x062c('0x5b')];var _0x1dc93e=path[_0x062c('0x12')](config[_0x062c('0x5c')],_0x062c('0x5d'),_0x836936+_0x062c('0x5e'));logger['info'](_0x062c('0x5f'),_0xa4ac13);db[_0x062c('0x60')][_0x062c('0x61')]({'raw':!![],'attributes':['id','name']})['then'](function(_0x21d7b4){for(var _0x2bc92f=0x0;_0x2bc92f<_0x21d7b4[_0x062c('0x18')];_0x2bc92f++){if(_0x21d7b4[_0x2bc92f][_0x062c('0x62')]in _0x305c58){contactItemTypes['push'](_0x21d7b4[_0x2bc92f]);delete _0x14cdd2[_0x21d7b4[_0x2bc92f]['name']];hasAdditionalPhones=!![];}for(var _0x69b59a in _0x305c58){if(_0x21d7b4[_0x2bc92f][_0x062c('0x62')]+_0x062c('0x63')===_0x69b59a){phoneDescriptions[_0x062c('0x1b')]({'itemTypeId':_0x21d7b4[_0x2bc92f]['id'],'description':_0x69b59a});delete _0x14cdd2[_0x69b59a];}}}if(hasAdditionalPhones)_0x14cdd2[_0x062c('0x1a')]='';var _0x59d65d=_[_0x062c('0x4d')](_0x14cdd2)[_0x062c('0x12')]();logger['info'](_0x062c('0x64'),_0x59d65d);fs[_0x062c('0x65')](_0x1dc93e,_0x59d65d+'\x0a');Papa[_0x062c('0x66')](fs[_0x062c('0x67')](_0x56eee5),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4ac2cd,_0x31b4eb){try{for(var _0x597be2=0x0,_0x157e48=[];_0x597be2<_0x4ac2cd[_0x062c('0x68')][_0x062c('0x18')];_0x597be2++){stats['rows']+=0x1;if(_0x4ac2cd[_0x062c('0x69')][_0x597be2]){handleError(_0x4ac2cd['data'][_0x597be2],_0x4ac2cd['errors'][_0x597be2]);}else{var _0x90486e=[];var _0xf4659b=[];var _0x16ea10={};for(var _0xcd1094 in _0x305c58){let _0x2aad86=contactItemTypes['find'](_0x39b527=>_0x39b527['name']===_0xcd1094);let _0x251c27=contactItemTypes[_0x062c('0x6a')](_0x132823=>_0x132823[_0x062c('0x62')]+_0x062c('0x63')===_0xcd1094);if(_['isNil'](_0x2aad86)&&_[_0x062c('0x19')](_0x251c27)){if(_0x305c58[_0x062c('0x6b')](_0xcd1094)){if(_0x4ac2cd[_0x062c('0x68')][_0x597be2][_0x305c58[_0xcd1094]]){var _0x619a27=_[_0x062c('0x6c')](_0x4ac2cd[_0x062c('0x68')][_0x597be2][_0x305c58[_0xcd1094]][_0x062c('0x6d')](/"/g,'\x27'));switch(_0xcd1094){case'scheduledat':var _0x587c29=moment(_0x619a27,_0x062c('0xc'),!![]);if(_0x587c29[_0x062c('0x6e')]()){_0x157e48[_0x062c('0x1b')]('\x22'+_0x619a27+'\x22');}else{_0x90486e[_0x062c('0x1b')](_0x062c('0x6f'));}break;case _0x062c('0x70'):var _0x1ae5cd=parseInt(_0x619a27);_0x619a27=_[_0x062c('0x71')](_0x1ae5cd)||_0x1ae5cd<0x0||_0x1ae5cd>0x4?_0x12f060?0x3:0x2:_0x1ae5cd;_0x157e48[_0x062c('0x1b')]('\x22'+_0x619a27+'\x22');break;case _0x062c('0x72'):var _0x4c50fb=parseInt(_0x619a27);if(_[_0x062c('0x73')](_0x4c50fb)&&_['includes'](_0x9e0f07,_0x4c50fb)){_0x157e48[_0x062c('0x1b')]('\x22'+_0x4c50fb+'\x22');}else{_0x90486e[_0x062c('0x1b')]('agent\x20not\x20exists');}break;case _0x062c('0x74'):if(isEmail(_0x619a27)){_0x157e48[_0x062c('0x1b')]('\x22'+_0x619a27+'\x22');}else{_0x90486e['push'](_0x062c('0x75'));}break;case _0x062c('0x76'):var _0x3d33e5=moment(_0x619a27,_0x062c('0x77'),!![]);if(_0x3d33e5[_0x062c('0x6e')]()){_0x157e48['push']('\x22'+_0x619a27+'\x22');}else{_0x90486e[_0x062c('0x1b')](_0x062c('0x78'));}break;default:_0x157e48[_0x062c('0x1b')]('\x22'+_0x619a27+'\x22');}}else{switch(_0xcd1094){case _0x062c('0x79'):case _0x062c('0x10'):_0x90486e[_0x062c('0x1b')](_0xcd1094+_0x062c('0x7a'));break;default:_0x157e48[_0x062c('0x1b')]('\x22\x22');}}}}else{var _0x5e2b92='';if(!_[_0x062c('0x19')](_0x2aad86)){if(!_0x16ea10[_0x062c('0x6b')](_0x2aad86['id'])){for(var _0x1b6c41=0x0;_0x1b6c41<_0x305c58[_0xcd1094][_0x062c('0x18')];_0x1b6c41++){var _0x619a27=_[_0x062c('0x6c')](_0x4ac2cd[_0x062c('0x68')][_0x597be2][_0x305c58[_0xcd1094][_0x1b6c41]]['replace'](/"/g,'\x27'));var _0x590857=phoneDescriptions[_0x062c('0x6a')](_0x24f9ee=>_0x24f9ee[_0x062c('0x7b')]===_0x2aad86['id']);if(!_['isNil'](_0x590857)){var _0x5f2f64=_['trim'](_0x4ac2cd[_0x062c('0x68')][_0x597be2][_0x305c58[_0x590857['description']][0x0]][_0x062c('0x6d')](/"/g,'\x27'));if(!_[_0x062c('0x19')](_0x5f2f64))_0x619a27=_0x619a27+'§'+_0x5f2f64;}if(_0x5e2b92=='')_0x5e2b92=_0x619a27;else _0x5e2b92+='|'+_0x619a27;}_0xf4659b[_0x062c('0x1b')](_0x2aad86['id']+':'+_0x5e2b92);_0x16ea10[_0x2aad86['id']]=0x1;}}}}if(hasAdditionalPhones){_0x157e48['push']('\x22'+_0xf4659b[_0x062c('0x12')](';')+'\x22');}if(_0x90486e[_0x062c('0x18')]){handleError(_0x4ac2cd[_0x062c('0x68')][_0x597be2],{'code':'SystemRow','message':_0x90486e[_0x062c('0x12')]()});}else{fs[_0x062c('0x7c')](_0x1dc93e,_0x157e48[_0x062c('0x12')]()+'\x0a');}_0x157e48=[];}if(!(stats['rows']%0xc8)){socket[_0x062c('0x7d')](_0x062c('0x7e')+_0x836936,stats);stats[_0x062c('0x69')]=[];}}if(stopped){logger['info'](_0x062c('0x7f'));_0x31b4eb[_0x062c('0x80')]();}}catch(_0x14fb7c){handleError(_0x4ac2cd[_0x062c('0x68')][_0x597be2],{'code':_0x062c('0x81'),'message':_0x14fb7c['message']});logger['error'](_0x062c('0x82'),_0x14fb7c[_0x062c('0x1d')]);}},'complete':function(){try{var _0xc6b40a=[];var _0x215db2=tempTableName;_0xc6b40a[_0x062c('0x1b')](_0x062c('0x83')+_0x215db2+'\x20LIKE\x20cm_contacts;');logger[_0x062c('0x53')](_0x062c('0x84'),contactItemTypes[_0x062c('0x18')]);var _0x35b55c=util[_0x062c('0xb')](_0x062c('0x85'),_0x1dc93e,_0x215db2,_0x59d65d,_0xa4ac13['ListId'],_0xa4ac13[_0x062c('0x4e')]||null,NOW,NOW);if(_[_0x062c('0x19')](_0x305c58[_0x062c('0x31')])){_0x35b55c+=',\x20scheduledAt\x20=\x20NOW()';}_0xc6b40a['push'](_0x35b55c);BPromise['each'](_0xc6b40a,handleQuery)[_0x062c('0x1f')](function(_0x14fc0c){BPromise[_0x062c('0x1c')]([handleAdditionalPhones()])['then'](function(){_0xc6b40a=[];for(var _0x173fd7=0x0;_0x173fd7\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','query','groupBy','Setting','findOne','enableEmailPreview','all','clone','getSelectedTags','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','name','field','from','tools_tags','user_has_','_interactions','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xde2c,0x7f));var _0xcde2=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0xde2c[_0x519c88];return _0x4668d7;};'use strict';var _=require(_0xcde2('0x0'));var squel=require(_0xcde2('0x1'));var as=require(_0xcde2('0x2'));var qs=require(_0xcde2('0x3'));var updateInteraction=require(_0xcde2('0x4'))[_0xcde2('0x5')];var utils=require(_0xcde2('0x6'));var db=require(_0xcde2('0x7'))['db'];function skipInteractionsQuery(_0x55c175,_0x4353c8,_0x196898){var _0x141f4b=![];var _0x1398de=utils[_0xcde2('0x8')](_0x55c175);if(_0x4353c8['role']===_0xcde2('0x9')&&!_0x196898[_0xcde2('0xa')]&&!_0x196898[_0x1398de]){_0x141f4b=!![];}return _0x141f4b;}function getTagsQuery(){return squel[_0xcde2('0xb')]()['field']('id')['field'](_0xcde2('0xc'))[_0xcde2('0xd')]('color')[_0xcde2('0xe')](_0xcde2('0xf'));}function getUsersQuery(_0x12a287,_0x127358){var _0x54b7c5=utils['getInteractionFK'](_0x12a287);var _0x25677f=_0xcde2('0x10')+_0x12a287+_0xcde2('0x11');var _0x39a973=squel[_0xcde2('0xb')]()[_0xcde2('0xd')]('u.id')[_0xcde2('0xd')]('u.fullname')[_0xcde2('0xd')]('ui.'+_0x54b7c5)['from'](_0x25677f,'ui')[_0xcde2('0x12')](_0xcde2('0x13'),'u',_0xcde2('0x14'));if(_0x127358[_0xcde2('0x15')]>0x0){_0x39a973[_0xcde2('0x16')]('ui.'+_0x54b7c5+_0xcde2('0x17'),_['map'](_0x127358,'id'));}return _0x39a973;}function getInteractionsQuery(_0x31b4a7){var _0x198840=utils[_0xcde2('0x18')](_0x31b4a7);var _0x1f1858=utils['getAccountFK'](_0x31b4a7);var _0x4fd5aa=utils['getInteractionFK'](_0x31b4a7);return squel[_0xcde2('0xb')]()['from'](_0x198840[_0xcde2('0x19')],'i')[_0xcde2('0x12')](_0xcde2('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xcde2('0x12')](_0xcde2('0x13'),'o',_0xcde2('0x1b'))[_0xcde2('0x12')](_0x198840[_0xcde2('0x1c')],'a','a.id\x20=\x20i.'+_0x1f1858)['left_join'](_0x198840['messages'],'me',_0xcde2('0x1d')+_0x4fd5aa+_0xcde2('0x1e'))[_0xcde2('0x12')](_0x198840[_0xcde2('0x1f')],'it',_0xcde2('0x20')+_0x4fd5aa+'\x20=\x20i.id')[_0xcde2('0x12')]('tools_tags','t',_0xcde2('0x21'));}function getSqlClauses(){var _0xb2123c={'body':squel[_0xcde2('0x22')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0xcde2('0x22')](),'filter':squel[_0xcde2('0x22')](),'read':squel[_0xcde2('0x22')](),'tags':{'clause':squel[_0xcde2('0x22')](),'ids':null},'user':squel[_0xcde2('0x22')]()};return _0xb2123c;}function parseTagParameter(_0x5a5b92){var _0x2d1d17=squel[_0xcde2('0x22')]();if(_0x5a5b92){var _0x1dce65=utils['getSelectedTags'](_0x5a5b92);_0x1dce65[_0xcde2('0x23')](function(_0x348ca1){_0x2d1d17['or'](_0xcde2('0x24'),'%,'+_0x348ca1+',%');});}return _0x2d1d17;}function parseReadParameter(_0x40309d){var _0xd7019='';if(_0x40309d){_0xd7019=_0xcde2('0x25');if(_0x40309d==='1'){_0xd7019=_0xd7019[_0xcde2('0x26')](_0xcde2('0x27'),'=');}else{_0xd7019=_0xd7019['replace'](_0xcde2('0x27'),'>');}}return _0xd7019;}function parseSearchFilter(_0x4a0826,_0x141072){var _0xb87851=squel[_0xcde2('0x22')]();if(_0x141072){var _0x49cb58=_0x141072[_0xcde2('0x26')]('\x5c','\x5c\x5c')[_0xcde2('0x26')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x49cb58)){_0xb87851['or'](_0xcde2('0x28'),_0x49cb58+'%');if([_0xcde2('0x29'),_0xcde2('0x2a')][_0xcde2('0x2b')](_0x4a0826)){_0xb87851['or'](_0xcde2('0x2c'),_0x49cb58+'%');}else if(_0x4a0826===_0xcde2('0x2d')){_0xb87851['or'](_0xcde2('0x2e'),_0x49cb58+'%');}else if(_0x4a0826===_0xcde2('0x2f')){_0xb87851['or']('i.from\x20LIKE\x20?',_0x49cb58+'%');}}else if(_0x4a0826===_0xcde2('0x30')&&qs[_0xcde2('0x31')](_0x49cb58)){_0xb87851['or'](_0xcde2('0x32'),_0x49cb58+'%');}else{if(_0x4a0826===_0xcde2('0x30')){_0xb87851['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcde2('0x33')](_0x49cb58))['or'](_0xcde2('0x34'),qs[_0xcde2('0x33')](_0x49cb58));}else{if(_0x4a0826!==_0xcde2('0x2d')){_0xb87851['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcde2('0x33')](_0x49cb58));}_0xb87851['or'](_0xcde2('0x35'),_0x49cb58+'%');}}}return _0xb87851;}function parseAdvancedSearchFilter(_0x29e3e0,_0x303d45){var _0x54ae78=getSqlClauses();var _0xb9c8d2=as[_0xcde2('0x36')](_0x29e3e0);var _0xbde4f4=_0xb9c8d2[_0xcde2('0x37')];for(var _0x1646a6=0x0;_0x1646a6<_0xb9c8d2['conditions'][_0xcde2('0x15')];_0x1646a6++){var _0x31feeb=_0xb9c8d2[_0xcde2('0x38')][_0x1646a6];var _0xa3d79c='i';var _0x4a64c1=_['find'](_0x303d45,[_0xcde2('0xc'),_0x31feeb[_0xcde2('0xd')]]);if(_0x4a64c1){var _0x40e1e2=as[_0xcde2('0x39')](_0xa3d79c,_0x4a64c1[_0xcde2('0x3a')],_0x31feeb);_0x54ae78[_0xcde2('0x3b')][_0xbde4f4](_0x40e1e2[_0xcde2('0x3c')],_0x40e1e2[_0xcde2('0x3d')][_0xcde2('0x3e')],_0x40e1e2['value'][_0xcde2('0x3f')]);}else{switch(_0x31feeb[_0xcde2('0xd')]){case _0xcde2('0x40'):var _0x51a0a6=parseReadParameter(_0x31feeb[_0xcde2('0x3d')]);_0x54ae78['read']['and'](_0x51a0a6);break;case _0xcde2('0x41'):if(_0x31feeb[_0xcde2('0x42')]===_0xcde2('0x43')){if(_0x31feeb[_0xcde2('0x3d')][_0xcde2('0x44')]('\x20')[_0xcde2('0x15')]>0x1){_0x54ae78['contact'][_0xbde4f4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x31feeb[_0xcde2('0x3d')]),null);}else{var _0x41a037='%'+_0x31feeb[_0xcde2('0x3d')]+'%';_0x54ae78[_0xcde2('0x45')][_0xbde4f4](_0xcde2('0x46'),_0x41a037,_0x41a037,_0x41a037);}}else{_0x4a64c1=_[_0xcde2('0x47')](_0x303d45,[_0xcde2('0xc'),'ContactId']);_0x31feeb['field']=_0xcde2('0x48');_0x40e1e2=as['buildExpression'](_0xa3d79c,_0x4a64c1[_0xcde2('0x3a')],_0x31feeb);_0x54ae78['contact'][_0xbde4f4](_0x40e1e2[_0xcde2('0x3c')],_0x40e1e2[_0xcde2('0x3d')][_0xcde2('0x3e')],_0x40e1e2['value'][_0xcde2('0x3f')]);}break;case'Tag':var _0x889aef=_0x31feeb[_0xcde2('0x3d')][_0xcde2('0x44')](',')[_0xcde2('0x49')](function(_0xcafd7){return Number(_0xcafd7);});var _0x27b64f=parseTagParameter(_0x889aef);_0x54ae78['tags']['clause'][_0xcde2('0x4a')](_0x27b64f);_0x54ae78['tags']['ids']=_0x889aef;break;case _0xcde2('0x4b'):if(_0x31feeb['operator']===_0xcde2('0x43')){_0x54ae78[_0xcde2('0x4c')][_0xbde4f4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x31feeb[_0xcde2('0x3d')]+'%',null);}else{_0x4a64c1=_['find'](_0x303d45,['name',_0xcde2('0x4d')]);_0x31feeb[_0xcde2('0xd')]='UserId';_0x40e1e2=as[_0xcde2('0x39')](_0xa3d79c,_0x4a64c1['type'],_0x31feeb);_0x54ae78[_0xcde2('0x4c')][_0xbde4f4](_0x40e1e2[_0xcde2('0x3c')],_0x40e1e2[_0xcde2('0x3d')][_0xcde2('0x3e')],_0x40e1e2[_0xcde2('0x3d')]['end']);}break;case _0xcde2('0x4e'):case _0xcde2('0x4f'):_0x40e1e2=as[_0xcde2('0x39')]('me',null,_0x31feeb);_0x54ae78[_0xcde2('0x4e')][_0xbde4f4](_0x40e1e2['text'],_0x40e1e2['value'][_0xcde2('0x3e')],_0x40e1e2['value'][_0xcde2('0x3f')]);break;}}}return _0x54ae78;}function parseModelFields(_0x3e9e79,_0x381bd4,_0x16675f){var _0x1ce210=utils[_0xcde2('0x8')](_0x3e9e79);var _0x5220bd=squel[_0xcde2('0x22')]();var _0x5b996d=_(_0x381bd4)[_0xcde2('0x50')]()['map'](function(_0x112a9f){return _[_0xcde2('0x51')](_0x16675f,[_0xcde2('0xc'),_0x112a9f])?_0x112a9f:undefined;})[_0xcde2('0x52')]()[_0xcde2('0x3d')]();if(_0x5b996d[_0xcde2('0x15')]>0x0){_0x5b996d['forEach'](function(_0x3adc5b){if(_0x3adc5b===_0x1ce210){_0x5220bd['and']('i.'+_0x1ce210+_0xcde2('0x17'),[][_0xcde2('0x53')](_0x381bd4[_0x3adc5b]));}else if(_0x3adc5b===_0xcde2('0x54')){var _0x428a55=JSON[_0xcde2('0x55')](_0x381bd4[_0x3adc5b])[_0xcde2('0x56')];var _0x3a0760=JSON[_0xcde2('0x55')](_0x381bd4[_0x3adc5b])[_0xcde2('0x57')];_0x5220bd[_0xcde2('0x4a')](_0xcde2('0x58'),_0x428a55,_0x3a0760);}else{if(_0x381bd4[_0x3adc5b]===_0xcde2('0x59')){_0x5220bd['and']('i.'+_0x3adc5b+'\x20IS\x20NULL');}else{_0x5220bd['and']('i.'+_0x3adc5b+_0xcde2('0x5a'),_0x381bd4[_0x3adc5b]);}}});}return _0x5220bd;}function parseQueryParameters(_0x59a64d,_0x1751dd,_0x3b9724){var _0x340ae6=getSqlClauses();return Promise['resolve']()[_0xcde2('0x5b')](function(){return parseModelFields(_0x59a64d,_0x1751dd,_0x3b9724);})['then'](function(_0x2ccfe9){_0x340ae6['fields'][_0xcde2('0x4a')](_0x2ccfe9);return parseReadParameter(_0x1751dd[_0xcde2('0x5c')]);})['then'](function(_0x418dd1){_0x340ae6['read']['and'](_0x418dd1);return parseTagParameter(_0x1751dd[_0xcde2('0x5d')]);})[_0xcde2('0x5b')](function(_0x8eddd4){_0x340ae6[_0xcde2('0x5e')][_0xcde2('0x5f')][_0xcde2('0x4a')](_0x8eddd4);return parseSearchFilter(_0x59a64d,_0x1751dd['filter']);})[_0xcde2('0x5b')](function(_0x44b3fb){_0x340ae6[_0xcde2('0x60')]=_0x44b3fb;return _0x340ae6;});}function checkAccountsRestrictions(_0x145b4a,_0x349818,_0x541a70){var _0x50892c=utils['getAccountFK'](_0x145b4a);var _0x30dee3=_0xcde2('0x61')+_[_0xcde2('0x62')](_0x145b4a)+(_0x145b4a===_0xcde2('0x63')?'Websites':_0xcde2('0x64'));var _0x345210=squel[_0xcde2('0x22')]();return Promise[_0xcde2('0x65')]()[_0xcde2('0x5b')](function(){if(_0x541a70[_0xcde2('0xa')]&&_0x349818['role']===_0xcde2('0x9')){return _0x349818[_0x30dee3]({'attributes':['id'],'raw':!![]});}})[_0xcde2('0x5b')](function(_0x585165){if(_0x585165){if(_0x585165[_0xcde2('0x15')]===0x0){_0x345210[_0xcde2('0x4a')]('i.'+_0x50892c+_0xcde2('0x66'));}else{_0x345210[_0xcde2('0x4a')]('i.'+_0x50892c+_0xcde2('0x17'),_[_0xcde2('0x49')](_0x585165,'id'));}}else if(!_0x541a70[_0x50892c]){_0x345210[_0xcde2('0x4a')]('i.'+_0x50892c+_0xcde2('0x67'));}})[_0xcde2('0x5b')](function(){return _0x345210;});}function getClosedOrderClause(_0x3ae71d,_0x5a9f19){var _0x223cb0='';var _0x33d76a=['i.thirdDisposition',_0xcde2('0x68'),_0xcde2('0x69')];if(_0x3ae71d===_0xcde2('0x30')){_0x33d76a['unshift'](_0xcde2('0x6a'));}if(_0x5a9f19[_0xcde2('0x6b')]==='0'&&_0x3ae71d===_0xcde2('0x30')){_0x223cb0=_0xcde2('0x6a');}else{if(_0x5a9f19[_0xcde2('0x6b')]==='1'){_0x33d76a[_0xcde2('0x6c')]();}_0x223cb0=_0xcde2('0x6d')+_0x33d76a[_0xcde2('0x6e')](',\x20')+')';}return _0x223cb0;}function getFilteredInteractions(_0x857e85,_0x34e72a,_0x3b0961,_0x5d42f8){var _0x5bd1bd=utils[_0xcde2('0x6f')](_0x857e85);var _0xd28773=_[_0xcde2('0x62')](_0x857e85)+'Interaction';var _0x485a79=[];var _0x5652a7=getTagsQuery();var _0x1341d0={'type':db[_0xcde2('0x70')][_0xcde2('0x71')][_0xcde2('0x72')],'raw':!![]};var _0x325b51=[];var _0x333cbb=[];return db['sequelize']['query'](_0x5652a7[_0xcde2('0x73')](),_0x1341d0)[_0xcde2('0x5b')](function(_0x8c9a24){_0x485a79=_[_0xcde2('0x74')](_0x8c9a24,'id');_0x1341d0=_[_0xcde2('0x75')](_0x1341d0,{'model':db[_0xd28773],'mapToModel':!![],'nest':!![]});if(_0x3b0961[_0xcde2('0x76')]){_0x5d42f8[_0xcde2('0x77')][_0xcde2('0x23')](function(_0x3f0b7c){_0x34e72a[_0xcde2('0xd')]('i.'+_0x3f0b7c);});}else{_0x34e72a[_0xcde2('0xd')](_0xcde2('0x78'),_0xcde2('0x40'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x79'),_0xcde2('0x7a'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x7b'),_0xcde2('0x7c'));if(_0x857e85===_0xcde2('0x30')){_0x34e72a['field'](_0xcde2('0x7d'),_0xcde2('0x7e'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x7f'),_0xcde2('0x80'));_0x34e72a['field'](_0xcde2('0x81'));_0x34e72a['field'](_0xcde2('0x82'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x83'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x84'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x85'));_0x34e72a['field']('i.attach');_0x34e72a[_0xcde2('0xd')]('i.lastMsgAt');_0x34e72a[_0xcde2('0xd')](_0xcde2('0x86'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x87'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x69'));_0x34e72a[_0xcde2('0xd')]('i.secondDisposition');_0x34e72a[_0xcde2('0xd')](_0xcde2('0x88'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x6a'));_0x34e72a['field'](_0xcde2('0x89'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8a'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8b'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8c'));}else if(_0x857e85===_0xcde2('0x2f')){_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8d'),_0xcde2('0x80'));}else{_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8e'),'contactName');}if(_0x857e85!==_0xcde2('0x30')){_0x34e72a[_0xcde2('0xd')](_0xcde2('0x8f'));}_0x34e72a[_0xcde2('0xd')](_0xcde2('0x90'),_0xcde2('0x91'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x92'),_0xcde2('0x93'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x94'),_0xcde2('0x95'));_0x34e72a[_0xcde2('0xd')](_0xcde2('0x96'),_0xcde2('0x97'));_0x34e72a[_0xcde2('0xd')]('c.mobile','Contact.mobile');_0x34e72a[_0xcde2('0xd')](_0xcde2('0x98'),_0xcde2('0x99'));_0x34e72a[_0xcde2('0xd')]('o.fullname',_0xcde2('0x9a'));_0x34e72a['field'](_0xcde2('0x9b'),'Owner.internal');_0x34e72a[_0xcde2('0xd')](_0xcde2('0x9c'),'TagIds');}if(_0x5d42f8[_0xcde2('0x9d')]){_0x34e72a[_0xcde2('0x9d')](_0x5d42f8[_0xcde2('0x9d')]);}if(_0x5d42f8['offset']){_0x34e72a[_0xcde2('0x9e')](_0x5d42f8[_0xcde2('0x9e')]);}return db[_0xcde2('0x9f')][_0xcde2('0xa0')](_0x34e72a['toString'](),_0x1341d0);})['then'](function(_0xc70ceb){_0x325b51=_0xc70ceb;var _0x3fa065=getUsersQuery(_0x857e85,_0x325b51);return db[_0xcde2('0x9f')][_0xcde2('0xa0')](_0x3fa065[_0xcde2('0x73')](),_0x1341d0);})[_0xcde2('0x5b')](function(_0x4be3c3){_0x333cbb=_[_0xcde2('0xa1')](_0x4be3c3,_0x5bd1bd);if(_0x857e85===_0xcde2('0x30')){return db[_0xcde2('0xa2')][_0xcde2('0xa3')]({'attributes':[_0xcde2('0xa4')],'raw':!![]});}})[_0xcde2('0x5b')](function(_0x113478){var _0x5e58fa=_0x113478?_0x113478[_0xcde2('0xa4')]:undefined;var _0x4ea322=_0x325b51['map'](function(_0x55757e){return updateInteraction(_0x55757e,_0x485a79,_0x333cbb,_0x5e58fa);});return Promise[_0xcde2('0xa5')](_0x4ea322);});}function countFilteredInteractions(_0x2b4b1f,_0x55c35f){var _0x2e0684=_0x2b4b1f[_0xcde2('0xa6')]();_0x2e0684['field']('COUNT(*)');_0x2e0684['field'](_0xcde2('0x78'),_0xcde2('0x40'));var _0x5acf6e=utils[_0xcde2('0xa7')](_0x55c35f);if(!_['isEmpty'](_0x5acf6e)){_0x2e0684['where'](_0xcde2('0xa8'),_0x5acf6e);}var _0x243504={'type':db[_0xcde2('0x70')]['QueryTypes'][_0xcde2('0x72')],'raw':!![]};return db[_0xcde2('0x9f')][_0xcde2('0xa0')](_0x2e0684[_0xcde2('0x73')](),_0x243504);}module[_0xcde2('0xa9')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xb7c8=['mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','sqlOperator','conditions','find','buildExpression','type','start','value','end','unreadMessages','read','and','Contact','operator','$substring','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','text','Tag','split','tags','ids','User','user','UserId','body','plainBody','keys','some','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','filter','get','chat','Websites','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','query','toString','merge','Account.key','Account.mandatoryDisposition','a.email','Account.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.secondDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','tools_tags','getInteractionFK','u.id','u.fullname','from','left_join','users','length','where','\x20IN\x20?','map','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','fax','openchannel','i.from\x20LIKE\x20?','isEmail'];(function(_0x1d5b46,_0x1c3643){var _0x21a1a1=function(_0x35521a){while(--_0x35521a){_0x1d5b46['push'](_0x1d5b46['shift']());}};_0x21a1a1(++_0x1c3643);}(_0xb7c8,0x119));var _0x8b7c=function(_0x16df62,_0x4458c6){_0x16df62=_0x16df62-0x0;var _0x411057=_0xb7c8[_0x16df62];return _0x411057;};'use strict';var _=require('lodash');var squel=require(_0x8b7c('0x0'));var as=require(_0x8b7c('0x1'));var qs=require(_0x8b7c('0x2'));var updateInteraction=require(_0x8b7c('0x3'))[_0x8b7c('0x4')];var utils=require(_0x8b7c('0x5'));var db=require(_0x8b7c('0x6'))['db'];function skipInteractionsQuery(_0x50113e,_0x38672b,_0x412f93){var _0x31190d=![];var _0x440900=utils[_0x8b7c('0x7')](_0x50113e);if(_0x38672b[_0x8b7c('0x8')]===_0x8b7c('0x9')&&!_0x412f93[_0x8b7c('0xa')]&&!_0x412f93[_0x440900]){_0x31190d=!![];}return _0x31190d;}function getTagsQuery(){return squel[_0x8b7c('0xb')]()[_0x8b7c('0xc')]('id')[_0x8b7c('0xc')](_0x8b7c('0xd'))['field'](_0x8b7c('0xe'))['from'](_0x8b7c('0xf'));}function getUsersQuery(_0x414df8,_0x5868ec){var _0x189a25=utils[_0x8b7c('0x10')](_0x414df8);var _0x3594b1='user_has_'+_0x414df8+'_interactions';var _0x1c7471=squel[_0x8b7c('0xb')]()[_0x8b7c('0xc')](_0x8b7c('0x11'))[_0x8b7c('0xc')](_0x8b7c('0x12'))[_0x8b7c('0xc')]('ui.'+_0x189a25)[_0x8b7c('0x13')](_0x3594b1,'ui')[_0x8b7c('0x14')](_0x8b7c('0x15'),'u','u.id\x20=\x20ui.UserId');if(_0x5868ec[_0x8b7c('0x16')]>0x0){_0x1c7471[_0x8b7c('0x17')]('ui.'+_0x189a25+_0x8b7c('0x18'),_[_0x8b7c('0x19')](_0x5868ec,'id'));}return _0x1c7471;}function getInteractionsQuery(_0x4262b5){var _0x1682fd=utils[_0x8b7c('0x1a')](_0x4262b5);var _0x4cc809=utils[_0x8b7c('0x7')](_0x4262b5);var _0x3ef583=utils[_0x8b7c('0x10')](_0x4262b5);return squel[_0x8b7c('0xb')]()[_0x8b7c('0x13')](_0x1682fd['interactions'],'i')[_0x8b7c('0x14')](_0x8b7c('0x1b'),'c',_0x8b7c('0x1c'))[_0x8b7c('0x14')](_0x8b7c('0x15'),'o',_0x8b7c('0x1d'))[_0x8b7c('0x14')](_0x1682fd[_0x8b7c('0x1e')],'a',_0x8b7c('0x1f')+_0x4cc809)[_0x8b7c('0x14')](_0x1682fd[_0x8b7c('0x20')],'me',_0x8b7c('0x21')+_0x3ef583+'\x20=\x20i.id')[_0x8b7c('0x14')](_0x1682fd[_0x8b7c('0x22')],'it',_0x8b7c('0x23')+_0x3ef583+_0x8b7c('0x24'))[_0x8b7c('0x14')](_0x8b7c('0xf'),'t',_0x8b7c('0x25'));}function getSqlClauses(){var _0x3870b4={'body':squel[_0x8b7c('0x26')](),'contact':squel[_0x8b7c('0x26')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x8b7c('0x26')](),'read':squel['expr'](),'tags':{'clause':squel[_0x8b7c('0x26')](),'ids':null},'user':squel[_0x8b7c('0x26')]()};return _0x3870b4;}function parseTagParameter(_0x22fe5b){var _0x3db721=squel[_0x8b7c('0x26')]();if(_0x22fe5b){var _0x3d2dfa=utils['getSelectedTags'](_0x22fe5b);_0x3d2dfa[_0x8b7c('0x27')](function(_0x31390d){_0x3db721['or'](_0x8b7c('0x28'),'%,'+_0x31390d+',%');});}return _0x3db721;}function parseReadParameter(_0x94a31e){var _0x305a40='';if(_0x94a31e){_0x305a40=_0x8b7c('0x29');if(_0x94a31e==='1'){_0x305a40=_0x305a40[_0x8b7c('0x2a')](_0x8b7c('0x2b'),'=');}else{_0x305a40=_0x305a40[_0x8b7c('0x2a')](_0x8b7c('0x2b'),'>');}}return _0x305a40;}function parseSearchFilter(_0x57f97d,_0x4bfe5d){var _0x25288e=squel[_0x8b7c('0x26')]();if(_0x4bfe5d){var _0x101649=_0x4bfe5d[_0x8b7c('0x2a')]('\x5c','\x5c\x5c')[_0x8b7c('0x2a')](/'/g,'\x27\x27');if(qs[_0x8b7c('0x2c')](_0x101649)){_0x25288e['or'](_0x8b7c('0x2d'),_0x101649+'%');if([_0x8b7c('0x2e'),_0x8b7c('0x2f')][_0x8b7c('0x30')](_0x57f97d)){_0x25288e['or']('i.phone\x20LIKE\x20?',_0x101649+'%');}else if(_0x57f97d===_0x8b7c('0x31')){_0x25288e['or']('i.fax\x20LIKE\x20?',_0x101649+'%');}else if(_0x57f97d===_0x8b7c('0x32')){_0x25288e['or'](_0x8b7c('0x33'),_0x101649+'%');}}else if(_0x57f97d==='mail'&&qs[_0x8b7c('0x34')](_0x101649)){_0x25288e['or']('c.email\x20LIKE\x20?',_0x101649+'%');}else{if(_0x57f97d===_0x8b7c('0x35')){_0x25288e['or'](_0x8b7c('0x36'),qs[_0x8b7c('0x37')](_0x101649))['or'](_0x8b7c('0x38'),qs[_0x8b7c('0x37')](_0x101649));}else{if(_0x57f97d!==_0x8b7c('0x31')){_0x25288e['or'](_0x8b7c('0x39'),qs[_0x8b7c('0x37')](_0x101649));}_0x25288e['or'](_0x8b7c('0x3a'),_0x101649+'%');}}}return _0x25288e;}function parseAdvancedSearchFilter(_0x581a03,_0x3ba155){var _0x2e1ad5=getSqlClauses();var _0x4f2719=as['parseSearch'](_0x581a03);var _0x514690=_0x4f2719[_0x8b7c('0x3b')];for(var _0x2743be=0x0;_0x2743be<_0x4f2719['conditions'][_0x8b7c('0x16')];_0x2743be++){var _0x15eb70=_0x4f2719[_0x8b7c('0x3c')][_0x2743be];var _0x110cb3='i';var _0x57715c=_[_0x8b7c('0x3d')](_0x3ba155,[_0x8b7c('0xd'),_0x15eb70[_0x8b7c('0xc')]]);if(_0x57715c){var _0x5eb191=as[_0x8b7c('0x3e')](_0x110cb3,_0x57715c[_0x8b7c('0x3f')],_0x15eb70);_0x2e1ad5['default'][_0x514690](_0x5eb191['text'],_0x5eb191['value'][_0x8b7c('0x40')],_0x5eb191[_0x8b7c('0x41')][_0x8b7c('0x42')]);}else{switch(_0x15eb70[_0x8b7c('0xc')]){case _0x8b7c('0x43'):var _0x2f9f6b=parseReadParameter(_0x15eb70['value']);_0x2e1ad5[_0x8b7c('0x44')][_0x8b7c('0x45')](_0x2f9f6b);break;case _0x8b7c('0x46'):if(_0x15eb70[_0x8b7c('0x47')]===_0x8b7c('0x48')){if(_0x15eb70[_0x8b7c('0x41')]['split']('\x20')[_0x8b7c('0x16')]>0x1){_0x2e1ad5[_0x8b7c('0x49')][_0x514690](_0x8b7c('0x4a'),qs[_0x8b7c('0x37')](_0x15eb70[_0x8b7c('0x41')]),null);}else{var _0x3252f9='%'+_0x15eb70['value']+'%';_0x2e1ad5['contact'][_0x514690](_0x8b7c('0x4b'),_0x3252f9,_0x3252f9,_0x3252f9);}}else{_0x57715c=_[_0x8b7c('0x3d')](_0x3ba155,['name','ContactId']);_0x15eb70[_0x8b7c('0xc')]=_0x8b7c('0x4c');_0x5eb191=as[_0x8b7c('0x3e')](_0x110cb3,_0x57715c[_0x8b7c('0x3f')],_0x15eb70);_0x2e1ad5[_0x8b7c('0x49')][_0x514690](_0x5eb191[_0x8b7c('0x4d')],_0x5eb191[_0x8b7c('0x41')][_0x8b7c('0x40')],_0x5eb191[_0x8b7c('0x41')][_0x8b7c('0x42')]);}break;case _0x8b7c('0x4e'):var _0x1d9229=_0x15eb70['value'][_0x8b7c('0x4f')](',')[_0x8b7c('0x19')](function(_0x1afec7){return Number(_0x1afec7);});var _0x403a91=parseTagParameter(_0x1d9229);_0x2e1ad5[_0x8b7c('0x50')]['clause']['and'](_0x403a91);_0x2e1ad5[_0x8b7c('0x50')][_0x8b7c('0x51')]=_0x1d9229;break;case _0x8b7c('0x52'):if(_0x15eb70[_0x8b7c('0x47')]===_0x8b7c('0x48')){_0x2e1ad5[_0x8b7c('0x53')][_0x514690]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x15eb70['value']+'%',null);}else{_0x57715c=_[_0x8b7c('0x3d')](_0x3ba155,[_0x8b7c('0xd'),'UserId']);_0x15eb70[_0x8b7c('0xc')]=_0x8b7c('0x54');_0x5eb191=as[_0x8b7c('0x3e')](_0x110cb3,_0x57715c['type'],_0x15eb70);_0x2e1ad5['user'][_0x514690](_0x5eb191[_0x8b7c('0x4d')],_0x5eb191['value'][_0x8b7c('0x40')],_0x5eb191[_0x8b7c('0x41')][_0x8b7c('0x42')]);}break;case _0x8b7c('0x55'):case _0x8b7c('0x56'):_0x5eb191=as[_0x8b7c('0x3e')]('me',null,_0x15eb70);_0x2e1ad5[_0x8b7c('0x55')][_0x514690](_0x5eb191['text'],_0x5eb191[_0x8b7c('0x41')][_0x8b7c('0x40')],_0x5eb191[_0x8b7c('0x41')][_0x8b7c('0x42')]);break;}}}return _0x2e1ad5;}function parseModelFields(_0x5d5758,_0x56d378,_0x498d5a){var _0xed7dad=utils[_0x8b7c('0x7')](_0x5d5758);var _0x277183=squel['expr']();var _0x190192=_(_0x56d378)[_0x8b7c('0x57')]()[_0x8b7c('0x19')](function(_0xa8019e){return _[_0x8b7c('0x58')](_0x498d5a,[_0x8b7c('0xd'),_0xa8019e])?_0xa8019e:undefined;})['compact']()[_0x8b7c('0x41')]();if(_0x190192[_0x8b7c('0x16')]>0x0){_0x190192[_0x8b7c('0x27')](function(_0x5d9307){if(_0x5d9307===_0xed7dad){_0x277183[_0x8b7c('0x45')]('i.'+_0xed7dad+_0x8b7c('0x18'),[][_0x8b7c('0x59')](_0x56d378[_0x5d9307]));}else if(_0x5d9307===_0x8b7c('0x5a')){var _0x4e4a4a=JSON['parse'](_0x56d378[_0x5d9307])[_0x8b7c('0x5b')];var _0x2638fa=JSON['parse'](_0x56d378[_0x5d9307])[_0x8b7c('0x5c')];_0x277183[_0x8b7c('0x45')](_0x8b7c('0x5d'),_0x4e4a4a,_0x2638fa);}else{if(_0x56d378[_0x5d9307]==='null'){_0x277183[_0x8b7c('0x45')]('i.'+_0x5d9307+_0x8b7c('0x5e'));}else{_0x277183[_0x8b7c('0x45')]('i.'+_0x5d9307+_0x8b7c('0x5f'),_0x56d378[_0x5d9307]);}}});}return _0x277183;}function parseQueryParameters(_0x29ff93,_0x2fbd87,_0x4f3a13){var _0x5bad25=getSqlClauses();return Promise[_0x8b7c('0x60')]()[_0x8b7c('0x61')](function(){return parseModelFields(_0x29ff93,_0x2fbd87,_0x4f3a13);})['then'](function(_0x539241){_0x5bad25['fields'][_0x8b7c('0x45')](_0x539241);return parseReadParameter(_0x2fbd87['read']);})['then'](function(_0x5a67b9){_0x5bad25['read'][_0x8b7c('0x45')](_0x5a67b9);return parseTagParameter(_0x2fbd87[_0x8b7c('0x62')]);})[_0x8b7c('0x61')](function(_0x3a821b){_0x5bad25[_0x8b7c('0x50')]['clause'][_0x8b7c('0x45')](_0x3a821b);return parseSearchFilter(_0x29ff93,_0x2fbd87[_0x8b7c('0x63')]);})[_0x8b7c('0x61')](function(_0x313361){_0x5bad25[_0x8b7c('0x63')]=_0x313361;return _0x5bad25;});}function checkAccountsRestrictions(_0xda5984,_0x4458fd,_0x21e779){var _0x3db1a6=utils[_0x8b7c('0x7')](_0xda5984);var _0x210b13=_0x8b7c('0x64')+_['capitalize'](_0xda5984)+(_0xda5984===_0x8b7c('0x65')?_0x8b7c('0x66'):'Accounts');var _0x4ac7fe=squel['expr']();return Promise[_0x8b7c('0x60')]()[_0x8b7c('0x61')](function(){if(_0x21e779[_0x8b7c('0xa')]&&_0x4458fd['role']===_0x8b7c('0x9')){return _0x4458fd[_0x210b13]({'attributes':['id'],'raw':!![]});}})[_0x8b7c('0x61')](function(_0x301ec3){if(_0x301ec3){if(_0x301ec3[_0x8b7c('0x16')]===0x0){_0x4ac7fe[_0x8b7c('0x45')]('i.'+_0x3db1a6+'\x20IS\x20NULL');}else{_0x4ac7fe[_0x8b7c('0x45')]('i.'+_0x3db1a6+_0x8b7c('0x18'),_[_0x8b7c('0x19')](_0x301ec3,'id'));}}else if(!_0x21e779[_0x3db1a6]){_0x4ac7fe[_0x8b7c('0x45')]('i.'+_0x3db1a6+_0x8b7c('0x67'));}})[_0x8b7c('0x61')](function(){return _0x4ac7fe;});}function getClosedOrderClause(_0x38ab9e,_0x6b6b14){var _0x713761='';var _0x2ac58d=[_0x8b7c('0x68'),'i.secondDisposition',_0x8b7c('0x69')];if(_0x38ab9e===_0x8b7c('0x35')){_0x2ac58d[_0x8b7c('0x6a')](_0x8b7c('0x6b'));}if(_0x6b6b14[_0x8b7c('0x6c')]==='0'&&_0x38ab9e===_0x8b7c('0x35')){_0x713761=_0x8b7c('0x6b');}else{if(_0x6b6b14[_0x8b7c('0x6c')]==='1'){_0x2ac58d[_0x8b7c('0x6d')]();}_0x713761=_0x8b7c('0x6e')+_0x2ac58d[_0x8b7c('0x6f')](',\x20')+')';}return _0x713761;}function getFilteredInteractions(_0x31b4c0,_0x16a318,_0x88ebe5,_0x24f291){var _0x4160c8=utils[_0x8b7c('0x10')](_0x31b4c0);var _0x2f28f9=_[_0x8b7c('0x70')](_0x31b4c0)+_0x8b7c('0x71');var _0x526e69=[];var _0x59ec6f=getTagsQuery();var _0x5bf0a5={'type':db[_0x8b7c('0x72')][_0x8b7c('0x73')][_0x8b7c('0x74')],'raw':!![]};var _0xa42d22=[];var _0x24a109=[];return db['sequelize'][_0x8b7c('0x75')](_0x59ec6f[_0x8b7c('0x76')](),_0x5bf0a5)[_0x8b7c('0x61')](function(_0x4fb571){_0x526e69=_['keyBy'](_0x4fb571,'id');_0x5bf0a5=_[_0x8b7c('0x77')](_0x5bf0a5,{'model':db[_0x2f28f9],'mapToModel':!![],'nest':!![]});if(_0x88ebe5['fields']){_0x24f291['attributes'][_0x8b7c('0x27')](function(_0x17f849){_0x16a318[_0x8b7c('0xc')]('i.'+_0x17f849);});}else{_0x16a318[_0x8b7c('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8b7c('0x43'));_0x16a318[_0x8b7c('0xc')]('a.key',_0x8b7c('0x78'));_0x16a318[_0x8b7c('0xc')]('a.mandatoryDisposition',_0x8b7c('0x79'));if(_0x31b4c0===_0x8b7c('0x35')){_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x7a'),_0x8b7c('0x7b'));_0x16a318['field']('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',_0x8b7c('0x7c'));_0x16a318['field'](_0x8b7c('0x7d'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x7e'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x7f'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x80'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x81'));_0x16a318['field'](_0x8b7c('0x82'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x83'));_0x16a318['field'](_0x8b7c('0x84'));_0x16a318['field']('i.subject');_0x16a318['field'](_0x8b7c('0x69'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x85'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x68'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x6b'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x86'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x87'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x88'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x89'));}else if(_0x31b4c0===_0x8b7c('0x32')){_0x16a318['field'](_0x8b7c('0x8a'),'contactName');}else{_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x8b'),_0x8b7c('0x7c'));}if(_0x31b4c0!==_0x8b7c('0x35')){_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x8c'));}_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x8d'),_0x8b7c('0x8e'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x8f'),'Contact.lastName');_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x90'),'Contact.email');_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x91'),_0x8b7c('0x92'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x93'),'Contact.mobile');_0x16a318['field'](_0x8b7c('0x94'),'Contact.fax');_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x95'),_0x8b7c('0x96'));_0x16a318[_0x8b7c('0xc')](_0x8b7c('0x97'),'Owner.internal');_0x16a318['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8b7c('0x98'));}if(_0x24f291[_0x8b7c('0x99')]){_0x16a318['limit'](_0x24f291[_0x8b7c('0x99')]);}if(_0x24f291['offset']){_0x16a318[_0x8b7c('0x9a')](_0x24f291[_0x8b7c('0x9a')]);}return db[_0x8b7c('0x9b')][_0x8b7c('0x75')](_0x16a318['toString'](),_0x5bf0a5);})[_0x8b7c('0x61')](function(_0x5526fc){_0xa42d22=_0x5526fc;var _0x2c539f=getUsersQuery(_0x31b4c0,_0xa42d22);return db[_0x8b7c('0x9b')][_0x8b7c('0x75')](_0x2c539f[_0x8b7c('0x76')](),_0x5bf0a5);})[_0x8b7c('0x61')](function(_0x3c02a1){_0x24a109=_[_0x8b7c('0x9c')](_0x3c02a1,_0x4160c8);if(_0x31b4c0===_0x8b7c('0x35')){return db[_0x8b7c('0x9d')][_0x8b7c('0x9e')]({'attributes':[_0x8b7c('0x9f')],'raw':!![]});}})['then'](function(_0x5e35c4){var _0x2301a=_0x5e35c4?_0x5e35c4[_0x8b7c('0x9f')]:undefined;var _0xc478ba=_0xa42d22[_0x8b7c('0x19')](function(_0x461608){return updateInteraction(_0x461608,_0x526e69,_0x24a109,_0x2301a);});return Promise[_0x8b7c('0xa0')](_0xc478ba);});}function countFilteredInteractions(_0x549ce1,_0x500e89){var _0x4c2fc4=_0x549ce1[_0x8b7c('0xa1')]();_0x4c2fc4[_0x8b7c('0xc')]('COUNT(*)');_0x4c2fc4['field'](_0x8b7c('0xa2'),_0x8b7c('0x43'));var _0x10c775=utils[_0x8b7c('0xa3')](_0x500e89);if(!_[_0x8b7c('0xa4')](_0x10c775)){_0x4c2fc4[_0x8b7c('0x17')](_0x8b7c('0xa5'),_0x10c775);}var _0x513f23={'type':db['Sequelize']['QueryTypes'][_0x8b7c('0x74')],'raw':!![]};return db[_0x8b7c('0x9b')]['query'](_0x4c2fc4['toString'](),_0x513f23);}module[_0x8b7c('0xa6')]={'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 ec9d5d4..511c268 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 _0xeb67=['TagIds','Tags','lodash','fullname','split','forEach','waiting','total','disposition','abandoned','UserId','answered','talking','MailMessage','out','plainBody','-id','then','trimStart','catch','Users'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0xeb67,0x113));var _0x7eb6=function(_0x3695a5,_0x2d678a){_0x3695a5=_0x3695a5-0x0;var _0x4baedf=_0xeb67[_0x3695a5];return _0x4baedf;};'use strict';var _=require(_0x7eb6('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x5ce6af,_0x410451){return new Promise(function(_0x25d838,_0x598ff8){try{var _0x5a1a24=[];if(_0x410451[_0x5ce6af]){_0x5a1a24=_0x410451[_0x5ce6af]['map'](function(_0x547a5b){return{'id':_0x547a5b['id'],'fullname':_0x547a5b[_0x7eb6('0x1')]};});}return _0x25d838(_0x5a1a24);}catch(_0x24fc6e){_0x598ff8(_0x24fc6e);}});}function getInteractionTags(_0x4fef74,_0x410966){var _0x3821d6=[];if(_0x4fef74){_0x4fef74[_0x7eb6('0x2')](',')[_0x7eb6('0x3')](function(_0x43ee16){_0x3821d6['push'](_0x410966[_0x43ee16]);});}return _0x3821d6;}function updateWaitingCounter(_0x541e2f){if(_0x541e2f['waiting']){_0x541e2f[_0x7eb6('0x4')]-=0x1;}}function updateInteractionCounters(_0x1fe383){_0x1fe383[_0x7eb6('0x4')]=0x0;_0x1fe383['talking']=0x0;_0x1fe383['answered']=0x0;_0x1fe383['unmanaged']=0x0;_0x1fe383['abandoned']=0x0;_0x1fe383[_0x7eb6('0x5')]=0x0;if(_0x1fe383['closed']){if(_0x1fe383[_0x7eb6('0x6')]==='abandoned'){_0x1fe383[_0x7eb6('0x7')]+=0x1;updateWaitingCounter(_0x1fe383);}if(_0x1fe383[_0x7eb6('0x8')]){_0x1fe383[_0x7eb6('0x9')]+=0x1;if(_0x1fe383['talking']){_0x1fe383[_0x7eb6('0xa')]-=0x1;}}else{if(_0x1fe383[_0x7eb6('0x6')]){_0x1fe383['unmanaged']+=0x1;updateWaitingCounter(_0x1fe383);}}}else{if(!_0x1fe383['UserId']){_0x1fe383[_0x7eb6('0x4')]+=0x1;}if(_0x1fe383['UserId']){_0x1fe383[_0x7eb6('0xa')]+=0x1;updateWaitingCounter(_0x1fe383);}}_0x1fe383['total']+=0x1;return _0x1fe383;}function getLastMessageText(_0x4ca1c7){return db[_0x7eb6('0xb')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x4ca1c7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7eb6('0xc')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7eb6('0xd')],'order':_0x7eb6('0xe'),'raw':!![]})[_0x7eb6('0xf')](function(_0xdbe83f){if(_0xdbe83f&&_0xdbe83f[_0x7eb6('0xd')]){_0x4ca1c7['lastMsgText']=_[_0x7eb6('0x10')](_0xdbe83f[_0x7eb6('0xd')]);}return _0x4ca1c7;})[_0x7eb6('0x11')](function(_0x1077b8){throw _0x1077b8;});}exports['updateInteraction']=function(_0xd7de97,_0x3d0ad7,_0x2a5dc5,_0x3f7723){return new Promise(function(_0x3f48d1,_0x58557c){return getInteractionUsers(_0xd7de97['id'],_0x2a5dc5)['then'](function(_0x5114ec){_0xd7de97[_0x7eb6('0x12')]=_0x5114ec;return getInteractionTags(_0xd7de97[_0x7eb6('0x13')],_0x3d0ad7);})[_0x7eb6('0xf')](function(_0x21162b){_0xd7de97[_0x7eb6('0x14')]=_0x21162b;delete _0xd7de97[_0x7eb6('0x13')];return updateInteractionCounters(_0xd7de97);})['then'](function(_0x7da6f9){if(_0x3f7723){return getLastMessageText(_0x7da6f9);}else{return _0x7da6f9;}})[_0x7eb6('0xf')](function(_0x166699){_0x3f48d1(_0x166699);})[_0x7eb6('0x11')](function(_0x206317){_0x58557c(_0x206317);});});}; \ No newline at end of file +var _0xebab=['plainBody','-id','then','catch','updateInteraction','Users','TagIds','Tags','lodash','../../mysqldb','fullname','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','UserId','disposition','MailMessage','findOne','out'];(function(_0x37c925,_0x2ee082){var _0xa19ebc=function(_0xd820e0){while(--_0xd820e0){_0x37c925['push'](_0x37c925['shift']());}};_0xa19ebc(++_0x2ee082);}(_0xebab,0x128));var _0xbeba=function(_0x264f69,_0x110f10){_0x264f69=_0x264f69-0x0;var _0x4a0490=_0xebab[_0x264f69];return _0x4a0490;};'use strict';var _=require(_0xbeba('0x0'));var db=require(_0xbeba('0x1'))['db'];function getInteractionUsers(_0x3772aa,_0xf14a3a){return new Promise(function(_0x5466f4,_0x1cf359){try{var _0x245c98=[];if(_0xf14a3a[_0x3772aa]){_0x245c98=_0xf14a3a[_0x3772aa]['map'](function(_0x1612c6){return{'id':_0x1612c6['id'],'fullname':_0x1612c6[_0xbeba('0x2')]};});}return _0x5466f4(_0x245c98);}catch(_0x167907){_0x1cf359(_0x167907);}});}function getInteractionTags(_0x477057,_0x2a2659){var _0xd4b937=[];if(_0x477057){_0x477057[_0xbeba('0x3')](',')[_0xbeba('0x4')](function(_0x35556a){_0xd4b937['push'](_0x2a2659[_0x35556a]);});}return _0xd4b937;}function updateWaitingCounter(_0x2ae54f){if(_0x2ae54f[_0xbeba('0x5')]){_0x2ae54f['waiting']-=0x1;}}function updateInteractionCounters(_0x224fb0){_0x224fb0[_0xbeba('0x5')]=0x0;_0x224fb0[_0xbeba('0x6')]=0x0;_0x224fb0[_0xbeba('0x7')]=0x0;_0x224fb0[_0xbeba('0x8')]=0x0;_0x224fb0[_0xbeba('0x9')]=0x0;_0x224fb0[_0xbeba('0xa')]=0x0;if(_0x224fb0['closed']){if(_0x224fb0['disposition']==='abandoned'){_0x224fb0[_0xbeba('0x9')]+=0x1;updateWaitingCounter(_0x224fb0);}if(_0x224fb0[_0xbeba('0xb')]){_0x224fb0[_0xbeba('0x7')]+=0x1;if(_0x224fb0[_0xbeba('0x6')]){_0x224fb0[_0xbeba('0x6')]-=0x1;}}else{if(_0x224fb0[_0xbeba('0xc')]){_0x224fb0[_0xbeba('0x8')]+=0x1;updateWaitingCounter(_0x224fb0);}}}else{if(!_0x224fb0[_0xbeba('0xb')]){_0x224fb0[_0xbeba('0x5')]+=0x1;}if(_0x224fb0[_0xbeba('0xb')]){_0x224fb0['talking']+=0x1;updateWaitingCounter(_0x224fb0);}}_0x224fb0['total']+=0x1;return _0x224fb0;}function getLastMessageText(_0x3cbcc6){return db[_0xbeba('0xd')][_0xbeba('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3cbcc6['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbeba('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xbeba('0x10')],'order':_0xbeba('0x11'),'raw':!![]})[_0xbeba('0x12')](function(_0x14b5dd){if(_0x14b5dd&&_0x14b5dd[_0xbeba('0x10')]){_0x3cbcc6['lastMsgText']=_['trimStart'](_0x14b5dd[_0xbeba('0x10')]);}return _0x3cbcc6;})[_0xbeba('0x13')](function(_0x4d311c){throw _0x4d311c;});}exports[_0xbeba('0x14')]=function(_0x2074c7,_0x464de8,_0x143179,_0x56154e){return new Promise(function(_0x222175,_0x3b8814){return getInteractionUsers(_0x2074c7['id'],_0x143179)[_0xbeba('0x12')](function(_0x54aa3b){_0x2074c7[_0xbeba('0x15')]=_0x54aa3b;return getInteractionTags(_0x2074c7[_0xbeba('0x16')],_0x464de8);})[_0xbeba('0x12')](function(_0x294a2c){_0x2074c7[_0xbeba('0x17')]=_0x294a2c;delete _0x2074c7[_0xbeba('0x16')];return updateInteractionCounters(_0x2074c7);})['then'](function(_0x33923d){if(_0x56154e){return getLastMessageText(_0x33923d);}else{return _0x33923d;}})['then'](function(_0x42851b){_0x222175(_0x42851b);})[_0xbeba('0x13')](function(_0x105248){_0x3b8814(_0x105248);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index dba063e..a5337a2 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 _0xa73d=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','findOne','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Account','InteractionId','upperFirst','chat','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','toLowerCase'];(function(_0x30ad90,_0x2803b5){var _0x5cc517=function(_0x53a962){while(--_0x53a962){_0x30ad90['push'](_0x30ad90['shift']());}};_0x5cc517(++_0x2803b5);}(_0xa73d,0xc5));var _0xda73=function(_0xdb5493,_0x284696){_0xdb5493=_0xdb5493-0x0;var _0x47d622=_0xa73d[_0xdb5493];return _0x47d622;};'use strict';var _=require(_0xda73('0x0'));var db=require(_0xda73('0x1'))['db'];var loggers={'openchannel':require(_0xda73('0x2'))(_0xda73('0x3')),'mail':require(_0xda73('0x2'))(_0xda73('0x4')),'fax':require(_0xda73('0x2'))('fax-interactions'),'sms':require('../../config/logger')(_0xda73('0x5')),'chat':require(_0xda73('0x2'))(_0xda73('0x6')),'whatsapp':require('../../config/logger')(_0xda73('0x7'))};function getAccountFK(_0x11cbd2){return _[_0xda73('0x8')](_0x11cbd2)+(_0x11cbd2==='chat'?'Website':_0xda73('0x9'))+'Id';}function getInteractionFK(_0xcd397a){return _[_0xda73('0x8')](_0xcd397a)+_0xda73('0xa');}function getInteractionId(_0x270665,_0x451d92,_0x8e1187){if(_0x270665&&_0x270665[_[_0xda73('0xb')](_0x8e1187)+_0xda73('0xa')]){return _0x270665[_[_0xda73('0xb')](_0x8e1187)+_0xda73('0xa')];}else if(_0x270665&&_0x270665['id']){return _0x270665['id'];}else if(_0x451d92&&_0x451d92['id']){return _0x451d92['id'];}else{return'unknown';}}function getInteractionsTables(_0xeeb747){return{'accounts':_0xeeb747+'_'+(_0xeeb747===_0xda73('0xc')?_0xda73('0xd'):_0xda73('0xe')),'interactions':_0xeeb747+_0xda73('0xf'),'interactionsTags':_0xeeb747+_0xda73('0x10'),'messages':_0xeeb747+'_messages','userInteractions':_0xda73('0x11')+_0xeeb747+'_interactions'};}function getSelectedTags(_0x5126cc){var _0x4b20c7=[];if(_0x5126cc){_0x4b20c7=Array[_0xda73('0x12')](_0x5126cc)?_0x5126cc:[_0x5126cc];}return _0x4b20c7;}function log(_0x338770,_0x554fbb,_0x2d7a9d,_0x1d51ee,_0x392eb7,_0x4e12d9){loggers[_0x392eb7[_0xda73('0x13')]()][_0x338770](_0xda73('0x14'),_0x4e12d9[_0xda73('0x15')](),_0x554fbb?_0x554fbb['id']:null,_0x554fbb?_0x554fbb[_0xda73('0x16')]:null,_0x554fbb?_0x554fbb['role']:null,getInteractionId(_0x2d7a9d,_0x1d51ee,_0x392eb7),_0x2d7a9d?JSON[_0xda73('0x17')](_0x2d7a9d):_0xda73('0x18'));}function updateUser(_0x26743b,_0x47a7b2,_0x32be03,_0x5e39d3,_0x2f5ef4){db[_[_0xda73('0xb')](_0x5e39d3)+'Interaction'][_0xda73('0x19')]({'where':{'id':getInteractionId(_0x47a7b2,_0x32be03,_0x5e39d3)}})[_0xda73('0x1a')](function(_0x1502ad){if(_0x1502ad){return _0x1502ad['update']({'UserId':_0x26743b?_0x26743b['id']:null});}})[_0xda73('0x1a')](function(_0xf8a662){if(_0xf8a662){log(_0xda73('0x1b'),_0x26743b,_0x47a7b2,_0x32be03,_0x5e39d3,_0x2f5ef4);}})[_0xda73('0x1c')](function(){log(_0xda73('0x1d'),_0x26743b,_0x47a7b2,_0x32be03,_0x5e39d3,_0x2f5ef4);});}module[_0xda73('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x1c3a=['InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','whatsapp-interactions','capitalize','chat'];(function(_0x19093e,_0x2b5387){var _0x2e3e83=function(_0x3d2a20){while(--_0x3d2a20){_0x19093e['push'](_0x19093e['shift']());}};_0x2e3e83(++_0x2b5387);}(_0x1c3a,0x1ba));var _0xa1c3=function(_0x256f90,_0x2187a6){_0x256f90=_0x256f90-0x0;var _0x415016=_0x1c3a[_0x256f90];return _0x415016;};'use strict';var _=require('lodash');var db=require(_0xa1c3('0x0'))['db'];var loggers={'openchannel':require(_0xa1c3('0x1'))(_0xa1c3('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0xa1c3('0x1'))('fax-interactions'),'sms':require(_0xa1c3('0x1'))('sms-interactions'),'chat':require(_0xa1c3('0x1'))('chat-interactions'),'whatsapp':require(_0xa1c3('0x1'))(_0xa1c3('0x3'))};function getAccountFK(_0x2194c3){return _[_0xa1c3('0x4')](_0x2194c3)+(_0x2194c3===_0xa1c3('0x5')?'Website':'Account')+'Id';}function getInteractionFK(_0xfdac3f){return _['capitalize'](_0xfdac3f)+_0xa1c3('0x6');}function getInteractionId(_0x4fb182,_0x5d761c,_0x53552c){if(_0x4fb182&&_0x4fb182[_[_0xa1c3('0x7')](_0x53552c)+'InteractionId']){return _0x4fb182[_[_0xa1c3('0x7')](_0x53552c)+'InteractionId'];}else if(_0x4fb182&&_0x4fb182['id']){return _0x4fb182['id'];}else if(_0x5d761c&&_0x5d761c['id']){return _0x5d761c['id'];}else{return _0xa1c3('0x8');}}function getInteractionsTables(_0x40bef7){return{'accounts':_0x40bef7+'_'+(_0x40bef7===_0xa1c3('0x5')?'websites':_0xa1c3('0x9')),'interactions':_0x40bef7+_0xa1c3('0xa'),'interactionsTags':_0x40bef7+_0xa1c3('0xb'),'messages':_0x40bef7+_0xa1c3('0xc'),'userInteractions':_0xa1c3('0xd')+_0x40bef7+_0xa1c3('0xa')};}function getSelectedTags(_0x5998c5){var _0x37e1f5=[];if(_0x5998c5){_0x37e1f5=Array['isArray'](_0x5998c5)?_0x5998c5:[_0x5998c5];}return _0x37e1f5;}function log(_0x2edaa0,_0x3ffc3d,_0x4d6dc5,_0x47d493,_0x13085a,_0x30a9f0){loggers[_0x13085a[_0xa1c3('0xe')]()][_0x2edaa0](_0xa1c3('0xf'),_0x30a9f0[_0xa1c3('0x10')](),_0x3ffc3d?_0x3ffc3d['id']:null,_0x3ffc3d?_0x3ffc3d[_0xa1c3('0x11')]:null,_0x3ffc3d?_0x3ffc3d[_0xa1c3('0x12')]:null,getInteractionId(_0x4d6dc5,_0x47d493,_0x13085a),_0x4d6dc5?JSON[_0xa1c3('0x13')](_0x4d6dc5):_0xa1c3('0x14'));}function updateUser(_0x5dcab7,_0x844d55,_0x3c0553,_0x4316b8,_0x533610){db[_[_0xa1c3('0x7')](_0x4316b8)+_0xa1c3('0x15')][_0xa1c3('0x16')]({'where':{'id':getInteractionId(_0x844d55,_0x3c0553,_0x4316b8)}})[_0xa1c3('0x17')](function(_0x442706){if(_0x442706){return _0x442706[_0xa1c3('0x18')]({'UserId':_0x5dcab7?_0x5dcab7['id']:null});}})[_0xa1c3('0x17')](function(_0x3e7a57){if(_0x3e7a57){log(_0xa1c3('0x19'),_0x5dcab7,_0x844d55,_0x3c0553,_0x4316b8,_0x533610);}})['catch'](function(){log(_0xa1c3('0x1a'),_0x5dcab7,_0x844d55,_0x3c0553,_0x4316b8,_0x533610);});}module[_0xa1c3('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c2d234c..b35952c 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 _0xe34f=['License','findOne','then','count','users','User','admin','user','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','parse','hasOwnProperty','use'];(function(_0x4e5d16,_0x3eb062){var _0x111845=function(_0xe956f4){while(--_0xe956f4){_0x4e5d16['push'](_0x4e5d16['shift']());}};_0x111845(++_0x3eb062);}(_0xe34f,0xbc));var _0xfe34=function(_0x5e24bc,_0x3f3c8e){_0x5e24bc=_0x5e24bc-0x0;var _0x2ecc20=_0xe34f[_0x5e24bc];return _0x2ecc20;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0xfe34('0x0'));function getValueFromLicense(_0x43eb44,_0x3378ed){if(_0x43eb44&&_0x3378ed){if(_0x3378ed[_0xfe34('0x1')]&&_0x3378ed[_0xfe34('0x2')]){var _0x123f0e=_0x3378ed[_0xfe34('0x1')];var _0x57c220=_0x3378ed[_0xfe34('0x2')];var _0x24e8cb=_0x123f0e[_0xfe34('0x3')]('-')[0x4];var _0x3fe816=_0x123f0e[_0xfe34('0x3')]('-')[0x0];var _0x4fa1cd=crypto['createDecipher'](_0xfe34('0x4'),util[_0xfe34('0x5')](_0xfe34('0x6'),_0x24e8cb,_0x123f0e,_0x3fe816));var _0x3eac84=_0x4fa1cd[_0xfe34('0x7')](_0x57c220,_0xfe34('0x8'),'utf8');_0x3eac84+=_0x4fa1cd['final']('utf8');var _0x4b67e6=JSON[_0xfe34('0x9')](_0x3eac84);return _0x4b67e6[_0xfe34('0xa')](_0x43eb44)?_0x4b67e6[_0x43eb44]:null;}}return null;}function isLimit(_0x53faa7,_0x431e54,_0x2fbadd,_0x17906a){var _0x30ea37=_0x431e54;return compose()[_0xfe34('0xb')](function(_0x3b00b9,_0x48e845,_0x193eeb){return db[_0xfe34('0xc')][_0xfe34('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xfe34('0xe')](function(_0x2a7790){var _0x5c599c=getValueFromLicense(_0x53faa7,_0x2a7790);return _0x5c599c?_0x5c599c:_0x30ea37;})[_0xfe34('0xe')](function(_0x3acbda){_0x30ea37=_0x3acbda;return _0x2fbadd[_0xfe34('0xf')](_0x17906a);})[_0xfe34('0xe')](function(_0x53099b){if(_0x53099b>=_0x30ea37){return _0x48e845['status'](0x193)['json']({'message':util[_0xfe34('0x5')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x53faa7)});}_0x193eeb();})['catch'](function(_0x495b48){_0x193eeb(_0x495b48);});});}function isUserLimit(){return isLimit(_0xfe34('0x10'),0x1,db[_0xfe34('0x11')],{'where':{'$or':[{'role':_0xfe34('0x12')},{'role':_0xfe34('0x13')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xf209=['json','format','catch','users','admin','crypto','composable-middleware','../../mysqldb','data1','license','split','createDecipher','base64','utf8','hasOwnProperty','License','findOne','then','count','status'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xf209,0x1a9));var _0x9f20=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0xf209[_0x270dba];return _0x36b83b;};'use strict';var crypto=require(_0x9f20('0x0'));var util=require('util');var compose=require(_0x9f20('0x1'));var db=require(_0x9f20('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x20d889,_0x260ca2){if(_0x20d889&&_0x260ca2){if(_0x260ca2[_0x9f20('0x3')]&&_0x260ca2[_0x9f20('0x4')]){var _0x5d89a5=_0x260ca2['data1'];var _0x3912ab=_0x260ca2[_0x9f20('0x4')];var _0x243c7b=_0x5d89a5[_0x9f20('0x5')]('-')[0x4];var _0x52b5bb=_0x5d89a5[_0x9f20('0x5')]('-')[0x0];var _0x552673=crypto[_0x9f20('0x6')]('aes-256-ctr',util['format']('%s:%s:%s',_0x243c7b,_0x5d89a5,_0x52b5bb));var _0x3bcc40=_0x552673['update'](_0x3912ab,_0x9f20('0x7'),_0x9f20('0x8'));_0x3bcc40+=_0x552673['final']('utf8');var _0x512b8f=JSON['parse'](_0x3bcc40);return _0x512b8f[_0x9f20('0x9')](_0x20d889)?_0x512b8f[_0x20d889]:null;}}return null;}function isLimit(_0x499d28,_0x41e7ee,_0x1fd2d5,_0x18750c){var _0x3e5a79=_0x41e7ee;return compose()['use'](function(_0x3965bc,_0x3b325d,_0x9402db){return db[_0x9f20('0xa')][_0x9f20('0xb')]({'where':{'id':0x1},'raw':!![]})[_0x9f20('0xc')](function(_0x31f292){var _0x27658b=getValueFromLicense(_0x499d28,_0x31f292);return _0x27658b?_0x27658b:_0x3e5a79;})[_0x9f20('0xc')](function(_0x5601bb){_0x3e5a79=_0x5601bb;return _0x1fd2d5[_0x9f20('0xd')](_0x18750c);})[_0x9f20('0xc')](function(_0x418af9){if(_0x418af9>=_0x3e5a79){return _0x3b325d[_0x9f20('0xe')](0x193)[_0x9f20('0xf')]({'message':util[_0x9f20('0x10')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x499d28)});}_0x9402db();})[_0x9f20('0x11')](function(_0x322216){_0x9402db(_0x322216);});});}function isUserLimit(){return isLimit(_0x9f20('0x12'),0x1,db['User'],{'where':{'$or':[{'role':_0x9f20('0x13')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5a28d40..5b508c8 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 _0x5ca7=['$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','$eq','$between','value','includes','$gt','$lte','operator','add','format','YYYY-MM-DD','castTo','field','\x20AS\x20','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?'];(function(_0x1b959e,_0x5b2d5f){var _0xa5ecea=function(_0x447b07){while(--_0x447b07){_0x1b959e['push'](_0x1b959e['shift']());}};_0xa5ecea(++_0x5b2d5f);}(_0x5ca7,0x1e7));var _0x75ca=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x5ca7[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var moment=require(_0x75ca('0x0'));exports[_0x75ca('0x1')]=function(_0x5b7829){var _0x547044={'conditions':[]};_0x547044[_0x75ca('0x2')]=_[_0x75ca('0x3')](_0x5b7829,_0x75ca('0x4'))?'or':_0x75ca('0x5');var _0x10a051=_0x5b7829[_0x75ca('0x6')](_0x75ca('0x7'),'')[_0x75ca('0x6')](_0x75ca('0x4'),'')[_0x75ca('0x8')]('||');for(var _0x3a5895=0x0;_0x3a5895<_0x10a051[_0x75ca('0x9')];_0x3a5895++){var _0x293376=_0x10a051[_0x3a5895][_0x75ca('0x8')](':=');var _0x313f6e=_0x293376[0x0];var _0x10e9c6=_0x293376[_0x75ca('0xa')](0x1);_0x10e9c6[_0x75ca('0xb')](function(_0x448d26){var _0xb76ef0=_0x448d26[_0x75ca('0x8')]('[')[_0x75ca('0xc')]();var _0x122b38=_0x448d26[_0x75ca('0xd')](/\[(.*?)\]/g);_0x122b38[_0x75ca('0xb')](function(_0x2ecb13){var _0x2cb959=_0x2ecb13[_0x75ca('0x8')]('[')[_0x75ca('0xe')](function(_0x6ab3ec){return _0x6ab3ec[_0x75ca('0xf')](']')>-0x1;})[_0x75ca('0x10')](function(_0x41c017){return _0x41c017[_0x75ca('0x8')](']')[0x0];})[0x0];_0x547044[_0x75ca('0x11')][_0x75ca('0x12')]({'field':_0x313f6e,'operator':_0xb76ef0,'value':_0x2cb959});});});}return _0x547044;};exports[_0x75ca('0x13')]=function(_0x5661f5,_0x4d2bcc,_0x947b3f){var _0x4b80d0={};if(_0x4d2bcc===_0x75ca('0x14')){if(_0x947b3f['operator']===_0x75ca('0x15')){_0x947b3f['operator']=_0x75ca('0x16');_0x947b3f[_0x75ca('0x17')]+=','+_0x947b3f['value'];}else if(_[_0x75ca('0x18')]([_0x75ca('0x19'),_0x75ca('0x1a')],_0x947b3f[_0x75ca('0x1b')])){_0x947b3f['value']=moment(_0x947b3f['value'])[_0x75ca('0x1c')](0x1,'days')[_0x75ca('0x1d')](_0x75ca('0x1e'));}}if(_0x947b3f[_0x75ca('0x1f')]){_0x4d2bcc=_0x947b3f['castTo'];_0x4b80d0['text']='CAST('+_0x5661f5+'.'+_0x947b3f[_0x75ca('0x20')]+_0x75ca('0x21')+_0x947b3f[_0x75ca('0x1f')]+')\x20'+parseOperator(_0x947b3f[_0x75ca('0x1b')]);}else{_0x4b80d0['text']=_0x5661f5+'.'+_0x947b3f[_0x75ca('0x20')]+'\x20'+parseOperator(_0x947b3f[_0x75ca('0x1b')]);}if(_['includes']([_0x75ca('0x22'),_0x75ca('0x23')],_0x947b3f[_0x75ca('0x1b')]))_0x4b80d0[_0x75ca('0x24')]='('+_0x4b80d0[_0x75ca('0x24')]+_0x75ca('0x25')+_0x5661f5+'.'+_0x947b3f[_0x75ca('0x20')]+_0x75ca('0x26');_0x4b80d0[_0x75ca('0x17')]=parseValue(_0x4d2bcc,_0x947b3f[_0x75ca('0x1b')],_0x947b3f['value']);return _0x4b80d0;};function parseOperator(_0x1ad212){var _0x2882aa;switch(_0x1ad212){case _0x75ca('0x27'):_0x2882aa=_0x75ca('0x28');break;case _0x75ca('0x23'):_0x2882aa=_0x75ca('0x29');break;case _0x75ca('0x15'):_0x2882aa=_0x75ca('0x2a');break;case _0x75ca('0x22'):_0x2882aa=_0x75ca('0x2b');break;case _0x75ca('0x2c'):case _0x75ca('0x2d'):case _0x75ca('0x2e'):_0x2882aa=_0x75ca('0x2f');break;case _0x75ca('0x30'):_0x2882aa='<\x20?';break;case'$gt':_0x2882aa=_0x75ca('0x31');break;case _0x75ca('0x1a'):_0x2882aa=_0x75ca('0x32');break;case _0x75ca('0x33'):_0x2882aa=_0x75ca('0x34');break;case'$between':_0x2882aa=_0x75ca('0x35');break;}return _0x2882aa;}function parseValue(_0x465f18,_0x1893e8,_0x324ca1){var _0x19b474={'start':undefined,'end':undefined};switch(_0x1893e8){case _0x75ca('0x27'):case _0x75ca('0x23'):_0x19b474[_0x75ca('0x36')]=_0x324ca1[_0x75ca('0x8')](',');break;case _0x75ca('0x2c'):_0x19b474['start']='%'+_0x324ca1+'%';break;case _0x75ca('0x2d'):_0x19b474[_0x75ca('0x36')]=_0x324ca1+'%';break;case _0x75ca('0x2e'):_0x19b474[_0x75ca('0x36')]='%'+_0x324ca1;break;case _0x75ca('0x16'):var _0x532357=_0x324ca1[_0x75ca('0x8')](',');var _0x324ca1=_0x532357[_0x75ca('0xc')]();var _0x5b90f8=_0x532357[_0x75ca('0x37')]();if(_0x465f18===_0x75ca('0x14')){_0x324ca1=moment(_0x324ca1)[_0x75ca('0x38')](0x0,!![])[_0x75ca('0x1d')]();_0x5b90f8=moment(_0x5b90f8)[_0x75ca('0x38')](0x0,!![])[_0x75ca('0x1c')](0x17,'hours')[_0x75ca('0x1c')](0x3b,_0x75ca('0x39'))[_0x75ca('0x1c')](0x3b,_0x75ca('0x3a'))[_0x75ca('0x1d')]();}_0x19b474={'start':_0x324ca1,'end':_0x5b90f8};break;default:_0x19b474[_0x75ca('0x36')]=_0x324ca1;break;}return _0x19b474;} \ No newline at end of file +var _0x3d47=['=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','minutes','moment','parseSearch','[$or]','replace','[$and]','length','split','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','\x20AS\x20','$ne','\x20OR\x20','field','\x20IS\x20NULL)','$in','$notIn','NOT\x20IN\x20?'];(function(_0x3f4cb8,_0x1ec222){var _0x272253=function(_0x4d31a1){while(--_0x4d31a1){_0x3f4cb8['push'](_0x3f4cb8['shift']());}};_0x272253(++_0x1ec222);}(_0x3d47,0xe0));var _0x73d4=function(_0x36833c,_0x286c2a){_0x36833c=_0x36833c-0x0;var _0x208ade=_0x3d47[_0x36833c];return _0x208ade;};'use strict';var _=require('lodash');var moment=require(_0x73d4('0x0'));exports[_0x73d4('0x1')]=function(_0x354f28){var _0x321c06={'conditions':[]};_0x321c06['sqlOperator']=_['startsWith'](_0x354f28,_0x73d4('0x2'))?'or':'and';var _0x10db7f=_0x354f28[_0x73d4('0x3')](_0x73d4('0x4'),'')[_0x73d4('0x3')]('[$or]','')['split']('||');for(var _0x4aa7d4=0x0;_0x4aa7d4<_0x10db7f[_0x73d4('0x5')];_0x4aa7d4++){var _0x3021d6=_0x10db7f[_0x4aa7d4][_0x73d4('0x6')](':=');var _0x1f31b4=_0x3021d6[0x0];var _0x28a2e2=_0x3021d6['slice'](0x1);_0x28a2e2[_0x73d4('0x7')](function(_0x2cf50f){var _0x965e36=_0x2cf50f[_0x73d4('0x6')]('[')['shift']();var _0xcdafd4=_0x2cf50f[_0x73d4('0x8')](/\[(.*?)\]/g);_0xcdafd4[_0x73d4('0x7')](function(_0x283dd7){var _0x4eefad=_0x283dd7[_0x73d4('0x6')]('[')[_0x73d4('0x9')](function(_0x29a12c){return _0x29a12c[_0x73d4('0xa')](']')>-0x1;})[_0x73d4('0xb')](function(_0x1dcdf9){return _0x1dcdf9[_0x73d4('0x6')](']')[0x0];})[0x0];_0x321c06[_0x73d4('0xc')][_0x73d4('0xd')]({'field':_0x1f31b4,'operator':_0x965e36,'value':_0x4eefad});});});}return _0x321c06;};exports[_0x73d4('0xe')]=function(_0x17f39d,_0x44d504,_0xeae212){var _0x5d676c={};if(_0x44d504===_0x73d4('0xf')){if(_0xeae212[_0x73d4('0x10')]===_0x73d4('0x11')){_0xeae212[_0x73d4('0x10')]=_0x73d4('0x12');_0xeae212[_0x73d4('0x13')]+=','+_0xeae212[_0x73d4('0x13')];}else if(_[_0x73d4('0x14')]([_0x73d4('0x15'),_0x73d4('0x16')],_0xeae212[_0x73d4('0x10')])){_0xeae212[_0x73d4('0x13')]=moment(_0xeae212[_0x73d4('0x13')])[_0x73d4('0x17')](0x1,'days')[_0x73d4('0x18')](_0x73d4('0x19'));}}if(_0xeae212[_0x73d4('0x1a')]){_0x44d504=_0xeae212[_0x73d4('0x1a')];_0x5d676c[_0x73d4('0x1b')]='CAST('+_0x17f39d+'.'+_0xeae212['field']+_0x73d4('0x1c')+_0xeae212[_0x73d4('0x1a')]+')\x20'+parseOperator(_0xeae212[_0x73d4('0x10')]);}else{_0x5d676c[_0x73d4('0x1b')]=_0x17f39d+'.'+_0xeae212['field']+'\x20'+parseOperator(_0xeae212[_0x73d4('0x10')]);}if(_[_0x73d4('0x14')]([_0x73d4('0x1d'),'$notIn'],_0xeae212['operator']))_0x5d676c[_0x73d4('0x1b')]='('+_0x5d676c['text']+_0x73d4('0x1e')+_0x17f39d+'.'+_0xeae212[_0x73d4('0x1f')]+_0x73d4('0x20');_0x5d676c[_0x73d4('0x13')]=parseValue(_0x44d504,_0xeae212[_0x73d4('0x10')],_0xeae212[_0x73d4('0x13')]);return _0x5d676c;};function parseOperator(_0x2197f3){var _0x9fe1fc;switch(_0x2197f3){case _0x73d4('0x21'):_0x9fe1fc='IN\x20?';break;case _0x73d4('0x22'):_0x9fe1fc=_0x73d4('0x23');break;case _0x73d4('0x11'):_0x9fe1fc=_0x73d4('0x24');break;case _0x73d4('0x1d'):_0x9fe1fc=_0x73d4('0x25');break;case _0x73d4('0x26'):case _0x73d4('0x27'):case _0x73d4('0x28'):_0x9fe1fc=_0x73d4('0x29');break;case'$lt':_0x9fe1fc='<\x20?';break;case _0x73d4('0x15'):_0x9fe1fc=_0x73d4('0x2a');break;case _0x73d4('0x16'):_0x9fe1fc=_0x73d4('0x2b');break;case _0x73d4('0x2c'):_0x9fe1fc=_0x73d4('0x2d');break;case _0x73d4('0x12'):_0x9fe1fc=_0x73d4('0x2e');break;}return _0x9fe1fc;}function parseValue(_0x4cca02,_0x1d2893,_0x40dec0){var _0x1fc289={'start':undefined,'end':undefined};switch(_0x1d2893){case _0x73d4('0x21'):case _0x73d4('0x22'):_0x1fc289[_0x73d4('0x2f')]=_0x40dec0[_0x73d4('0x6')](',');break;case _0x73d4('0x26'):_0x1fc289['start']='%'+_0x40dec0+'%';break;case _0x73d4('0x27'):_0x1fc289[_0x73d4('0x2f')]=_0x40dec0+'%';break;case'$endsWith':_0x1fc289[_0x73d4('0x2f')]='%'+_0x40dec0;break;case _0x73d4('0x12'):var _0x2c4357=_0x40dec0['split'](',');var _0x40dec0=_0x2c4357[_0x73d4('0x30')]();var _0x369e09=_0x2c4357[_0x73d4('0x31')]();if(_0x4cca02==='DATE'){_0x40dec0=moment(_0x40dec0)['utcOffset'](0x0,!![])[_0x73d4('0x18')]();_0x369e09=moment(_0x369e09)[_0x73d4('0x32')](0x0,!![])['add'](0x17,'hours')[_0x73d4('0x17')](0x3b,_0x73d4('0x33'))['add'](0x3b,'seconds')[_0x73d4('0x18')]();}_0x1fc289={'start':_0x40dec0,'end':_0x369e09};break;default:_0x1fc289[_0x73d4('0x2f')]=_0x40dec0;break;}return _0x1fc289;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 5062657..4017262 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac31=['object','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','limit','offset','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','unset','hasOwnProperty','omit','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','map','intersection','attributes','fields','length','nolimit','order','where','pick','filter'];(function(_0x1d86de,_0x752a4a){var _0x4dfd1f=function(_0x1513f1){while(--_0x1513f1){_0x1d86de['push'](_0x1d86de['shift']());}};_0x4dfd1f(++_0x752a4a);}(_0xac31,0xca));var _0x1ac3=function(_0x57698e,_0x40cf01){_0x57698e=_0x57698e-0x0;var _0x59f299=_0xac31[_0x57698e];return _0x59f299;};'use strict';var _=require(_0x1ac3('0x0'));var sequelize=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3086c0){var _0xd6934=['ne'];try{var _0x11dd6d=JSON[_0x1ac3('0x3')](_0x3086c0);var _0x59b42c=Object[_0x1ac3('0x4')](_0x11dd6d)[0x0];return _0xd6934[_0x1ac3('0x5')](_0x59b42c);}catch(_0x4dcc96){return![];}}function getOperatorValue(_0x5ef1b6){var _0xbe22b7=JSON[_0x1ac3('0x3')](_0x5ef1b6);var _0x2bf9b1=Object[_0x1ac3('0x4')](_0xbe22b7)[0x0];var _0x157604=_0xbe22b7[_0x2bf9b1];return{['$'+_0x2bf9b1]:_0x157604};}exports['fields']=function(_0x2d17de){var _0x4d7695=null;if(_0x2d17de){_0x4d7695=_0x2d17de[_0x1ac3('0x6')](',');}return _0x4d7695;};exports[_0x1ac3('0x7')]=function(_0x344674,_0x53500b){var _0xa26c88={};if(!_[_0x1ac3('0x8')](_0x344674)){_[_0x1ac3('0x9')](_0x344674,function(_0x24f0d2,_0x2a8dc7){try{if(_0x53500b){var _0x422d19=_['find'](_0x53500b,{'name':_0x2a8dc7})||{};if(hasSequelizeOperator(_0x24f0d2)){_0xa26c88[_0x2a8dc7]=getOperatorValue(_0x24f0d2);}else if(_0x422d19[_0x1ac3('0xa')]===_0x1ac3('0xb')&&_[_0x1ac3('0xc')](_0x24f0d2)){var _0x2338b9=JSON['parse'](_0x24f0d2);var _0x88ed7c={'$gte':moment(moment(_0x2338b9[_0x1ac3('0xd')])[_0x1ac3('0xe')](_0x1ac3('0xf')))['utc']()[_0x1ac3('0xe')](),'$lte':moment(moment(_0x2338b9[_0x1ac3('0x10')])['format'](_0x1ac3('0xf')))[_0x1ac3('0x11')]()[_0x1ac3('0x12')](0x1,'s')['format']()};_0xa26c88[_0x2a8dc7]=_0x88ed7c;}else if(_0x422d19[_0x1ac3('0x13')]===_0x1ac3('0x14')){_0xa26c88[_0x2a8dc7]=_0x24f0d2;}else{_0xa26c88[_0x2a8dc7]=_[_0x1ac3('0x15')](_0x24f0d2)?_0x24f0d2:JSON['parse'](_0x24f0d2);}}else{_0xa26c88[_0x2a8dc7]=_[_0x1ac3('0x15')](_0x24f0d2)?_0x24f0d2:JSON['parse'](_0x24f0d2);}}catch(_0x291616){_0xa26c88[_0x2a8dc7]=_0x24f0d2[_0x1ac3('0x6')](',');}});}return _0xa26c88;};exports[_0x1ac3('0x16')]=function(_0x3b7e51){_0x3b7e51=parseInt(_0x3b7e51,0xa);if(!_0x3b7e51||_0x3b7e51<0x0){_0x3b7e51=LIMIT_VALUE;}return _0x3b7e51;};exports[_0x1ac3('0x17')]=function(_0x557076){_0x557076=parseInt(_0x557076,0xa);if(!_0x557076||_0x557076<0x0){_0x557076=0x0;}return _0x557076;};exports[_0x1ac3('0x18')]=function(_0x2ea481){var _0x296abf,_0x257f60=null;if(_0x2ea481){_0x296abf=_0x2ea481['split'](',');_0x257f60=_['map'](_0x296abf,function(_0x2879d8){if(_0x2879d8[_0x1ac3('0x19')]('-')===0x0){return[_0x2879d8===_0x1ac3('0x1a')?sequelize[_0x1ac3('0x1b')](sequelize[_0x1ac3('0x1c')](_0x1ac3('0x1a')),_0x1ac3('0x1d')):_0x2879d8[_0x1ac3('0x1e')](0x1),_0x1ac3('0x1f')];}else{return[_0x2879d8==='priority'?sequelize[_0x1ac3('0x1b')](sequelize[_0x1ac3('0x1c')]('priority'),_0x1ac3('0x1d')):_0x2879d8,_0x1ac3('0x20')];}});}return _0x257f60;};exports['omit']=function(_0xf9affb,_0x2f65e8){if(_[_0x1ac3('0x8')](_0xf9affb)){return _0xf9affb;}if(_[_0x1ac3('0x15')](_0xf9affb)){for(var _0x10db3d=0x0;_0x10db3d<_0xf9affb['length'];_0x10db3d+=0x1){_0xf9affb[_0x10db3d]=this['omit'](_0xf9affb[_0x10db3d],_0x2f65e8);}return _0xf9affb;}if(!_['isObject'](_0xf9affb)){return _0xf9affb;}if(_['isString'](_0x2f65e8)){_0x2f65e8=[_0x2f65e8];}if(!_['isArray'](_0x2f65e8)){return _0xf9affb;}for(var _0x3ea482=0x0;_0x3ea482<_0x2f65e8['length'];_0x3ea482+=0x1){_[_0x1ac3('0x21')](_0xf9affb,_0x2f65e8[_0x3ea482]);}for(var _0x3e4a4e in _0xf9affb){if(_0xf9affb[_0x1ac3('0x22')](_0x3e4a4e)){_0xf9affb[_0x3e4a4e]=this[_0x1ac3('0x23')](_0xf9affb[_0x3e4a4e],_0x2f65e8);}}return _0xf9affb;};exports['isNumeric']=function(_0x61441d){return _0x61441d['match'](RegExp(_0x1ac3('0x24')))?!![]:![];};exports[_0x1ac3('0x25')]=function(_0x440aed){return _0x440aed[_0x1ac3('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x1ac3('0x27')]=function(_0xc3f097){var _0x9c17c2=[];_0xc3f097['split'](/[ ,]+/)[_0x1ac3('0x28')](function(_0x3b4c65){_0x3b4c65=_0x3b4c65[_0x1ac3('0x29')](/([^:]")"+/g,'$1');_0x3b4c65='+'+_0x3b4c65+'*';var _0x47437c=/[ `!@#$%^&*()_\-?~]/;if(_0x3b4c65['match'](_0x47437c))_0x3b4c65='\x22'+_0x3b4c65+'\x22';_0x9c17c2[_0x1ac3('0x2a')](_0x3b4c65);});return _0x9c17c2[_0x1ac3('0x2b')]('\x20');};exports[_0x1ac3('0x2c')]=function(_0x294513,_0x204d78,_0x479b42){var _0xbeed18={},_0x760b65={};if(_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x2e')]){_0x204d78[_0x1ac3('0x2d')]['id']=_0x204d78[_0x1ac3('0x2d')]['$id'];delete _0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x2e')];}_0xbeed18[_0x1ac3('0x2f')]=_[_0x1ac3('0x30')](_0x294513,'name');_0xbeed18[_0x1ac3('0x2d')]=_[_0x1ac3('0x4')](_0x204d78[_0x1ac3('0x2d')]);_0xbeed18[_0x1ac3('0x7')]=_[_0x1ac3('0x31')](_0xbeed18[_0x1ac3('0x2f')],_0xbeed18[_0x1ac3('0x2d')]);_0x760b65[_0x1ac3('0x32')]=_[_0x1ac3('0x31')](_0xbeed18['model'],this[_0x1ac3('0x33')](_0x204d78[_0x1ac3('0x2d')]['fields']));_0x760b65[_0x1ac3('0x32')]=_0x760b65[_0x1ac3('0x32')][_0x1ac3('0x34')]?_0x760b65[_0x1ac3('0x32')]:_0xbeed18[_0x1ac3('0x2f')];if(!_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x22')](_0x1ac3('0x35'))){_0x760b65['limit']=this[_0x1ac3('0x16')](_0x204d78['query'][_0x1ac3('0x16')]);_0x760b65[_0x1ac3('0x17')]=this[_0x1ac3('0x17')](_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x17')]);}_0x760b65[_0x1ac3('0x36')]=this['sort'](_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x18')]);_0x760b65[_0x1ac3('0x37')]=this['filters'](_[_0x1ac3('0x38')](_0x204d78[_0x1ac3('0x2d')],_0xbeed18['filters']),_0x294513);if(_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x39')]){var _0xb4664e=_0x294513;var _0x1b0099=_0x204d78[_0x1ac3('0x2d')][_0x1ac3('0x39')];if(typeof _0x1b0099===_0x1ac3('0x3a')){_0xb4664e=_[_0x1ac3('0x39')](_0x294513,function(_0x48a0a2){return _[_0x1ac3('0x5')](_0x1b0099[_0x1ac3('0x3b')],_0x48a0a2[_0x1ac3('0x13')]);});_0x1b0099=_0x1b0099[_0x1ac3('0x3c')];}_0x760b65[_0x1ac3('0x37')]=_[_0x1ac3('0x3d')](_0x760b65[_0x1ac3('0x37')],{'$or':_['map'](_0xb4664e,function(_0x4edc4d){if(_0x4edc4d[_0x1ac3('0xa')]!==_0x1ac3('0x3e')){if(_0x479b42){return sequelize['where'](sequelize['fn'](_0x1ac3('0x3f'),sequelize[_0x1ac3('0x1c')](_0x4edc4d['name'])),{'$like':sequelize['fn'](_0x1ac3('0x3f'),'%'+_0x204d78['query'][_0x1ac3('0x39')]+'%')});}else{var _0x406f0d={};_0x406f0d[_0x4edc4d[_0x1ac3('0x13')]]={'$like':'%'+_0x204d78[_0x1ac3('0x2d')]['filter']+'%'};return _0x406f0d;}}})});}_0x760b65=_[_0x1ac3('0x3d')]({},_0x760b65,_0x204d78[_0x1ac3('0x40')]);return _0x760b65;}; \ No newline at end of file +var _0x207c=['forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','name','uniqueid','isArray','split','sort','map','indexOf','priority','cast','col','substr','unsigned','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','query','$id','model','attributes','intersection','limit','offset','order','filter','object','columns','value','where','merge','type','VIRTUAL','lower','options','sequelize','moment','parse','includes','keys','fields','filters','isEmpty'];(function(_0x5b769e,_0x2c9b00){var _0x83634f=function(_0x5ba38b){while(--_0x5ba38b){_0x5b769e['push'](_0x5b769e['shift']());}};_0x83634f(++_0x2c9b00);}(_0x207c,0x1e8));var _0xc207=function(_0x24d24e,_0x4e17a4){_0x24d24e=_0x24d24e-0x0;var _0x20e068=_0x207c[_0x24d24e];return _0x20e068;};'use strict';var _=require('lodash');var sequelize=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1a420a){var _0xaaba3d=['ne'];try{var _0x2b40be=JSON[_0xc207('0x2')](_0x1a420a);var _0x1dd107=Object['keys'](_0x2b40be)[0x0];return _0xaaba3d[_0xc207('0x3')](_0x1dd107);}catch(_0x59bc89){return![];}}function getOperatorValue(_0x5a727b){var _0x55023e=JSON[_0xc207('0x2')](_0x5a727b);var _0x314561=Object[_0xc207('0x4')](_0x55023e)[0x0];var _0x59ff6f=_0x55023e[_0x314561];return{['$'+_0x314561]:_0x59ff6f};}exports[_0xc207('0x5')]=function(_0xad159b){var _0x3c579f=null;if(_0xad159b){_0x3c579f=_0xad159b['split'](',');}return _0x3c579f;};exports[_0xc207('0x6')]=function(_0x817576,_0x216e14){var _0x13ec41={};if(!_[_0xc207('0x7')](_0x817576)){_[_0xc207('0x8')](_0x817576,function(_0x487d95,_0x574425){try{if(_0x216e14){var _0x5b556f=_[_0xc207('0x9')](_0x216e14,{'name':_0x574425})||{};if(hasSequelizeOperator(_0x487d95)){_0x13ec41[_0x574425]=getOperatorValue(_0x487d95);}else if(_0x5b556f['type']===_0xc207('0xa')&&_[_0xc207('0xb')](_0x487d95)){var _0x59d401=JSON[_0xc207('0x2')](_0x487d95);var _0xb86b06={'$gte':moment(moment(_0x59d401[_0xc207('0xc')])[_0xc207('0xd')](_0xc207('0xe')))['utc']()[_0xc207('0xd')](),'$lte':moment(moment(_0x59d401[_0xc207('0xf')])[_0xc207('0xd')](_0xc207('0xe')))['utc']()['subtract'](0x1,'s')['format']()};_0x13ec41[_0x574425]=_0xb86b06;}else if(_0x5b556f[_0xc207('0x10')]===_0xc207('0x11')){_0x13ec41[_0x574425]=_0x487d95;}else{_0x13ec41[_0x574425]=_[_0xc207('0x12')](_0x487d95)?_0x487d95:JSON[_0xc207('0x2')](_0x487d95);}}else{_0x13ec41[_0x574425]=_['isArray'](_0x487d95)?_0x487d95:JSON[_0xc207('0x2')](_0x487d95);}}catch(_0x282595){_0x13ec41[_0x574425]=_0x487d95[_0xc207('0x13')](',');}});}return _0x13ec41;};exports['limit']=function(_0x4129b8){_0x4129b8=parseInt(_0x4129b8,0xa);if(!_0x4129b8||_0x4129b8<0x0){_0x4129b8=LIMIT_VALUE;}return _0x4129b8;};exports['offset']=function(_0x42c8ba){_0x42c8ba=parseInt(_0x42c8ba,0xa);if(!_0x42c8ba||_0x42c8ba<0x0){_0x42c8ba=0x0;}return _0x42c8ba;};exports[_0xc207('0x14')]=function(_0x131dc8){var _0x461f6a,_0xce0770=null;if(_0x131dc8){_0x461f6a=_0x131dc8[_0xc207('0x13')](',');_0xce0770=_[_0xc207('0x15')](_0x461f6a,function(_0x464dea){if(_0x464dea[_0xc207('0x16')]('-')===0x0){return[_0x464dea===_0xc207('0x17')?sequelize[_0xc207('0x18')](sequelize[_0xc207('0x19')](_0xc207('0x17')),'unsigned'):_0x464dea[_0xc207('0x1a')](0x1),'DESC'];}else{return[_0x464dea===_0xc207('0x17')?sequelize[_0xc207('0x18')](sequelize[_0xc207('0x19')](_0xc207('0x17')),_0xc207('0x1b')):_0x464dea,_0xc207('0x1c')];}});}return _0xce0770;};exports[_0xc207('0x1d')]=function(_0x1493fb,_0xa52138){if(_[_0xc207('0x7')](_0x1493fb)){return _0x1493fb;}if(_[_0xc207('0x12')](_0x1493fb)){for(var _0x27df03=0x0;_0x27df03<_0x1493fb[_0xc207('0x1e')];_0x27df03+=0x1){_0x1493fb[_0x27df03]=this[_0xc207('0x1d')](_0x1493fb[_0x27df03],_0xa52138);}return _0x1493fb;}if(!_[_0xc207('0x1f')](_0x1493fb)){return _0x1493fb;}if(_['isString'](_0xa52138)){_0xa52138=[_0xa52138];}if(!_[_0xc207('0x12')](_0xa52138)){return _0x1493fb;}for(var _0x5e0bd1=0x0;_0x5e0bd1<_0xa52138['length'];_0x5e0bd1+=0x1){_[_0xc207('0x20')](_0x1493fb,_0xa52138[_0x5e0bd1]);}for(var _0x3a05f3 in _0x1493fb){if(_0x1493fb[_0xc207('0x21')](_0x3a05f3)){_0x1493fb[_0x3a05f3]=this[_0xc207('0x1d')](_0x1493fb[_0x3a05f3],_0xa52138);}}return _0x1493fb;};exports[_0xc207('0x22')]=function(_0x478af7){return _0x478af7[_0xc207('0x23')](RegExp(_0xc207('0x24')))?!![]:![];};exports[_0xc207('0x25')]=function(_0x1bec3f){return _0x1bec3f[_0xc207('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xc207('0x26')]=function(_0x2e6a3e){var _0x27bc72=[];_0x2e6a3e[_0xc207('0x13')](/[ ,]+/)[_0xc207('0x27')](function(_0x2043cf){_0x2043cf=_0x2043cf[_0xc207('0x28')](/([^:]")"+/g,'$1');_0x2043cf='+'+_0x2043cf+'*';var _0x3cd4b4=/[ `!@#$%^&*()_\-?~]/;if(_0x2043cf['match'](_0x3cd4b4))_0x2043cf='\x22'+_0x2043cf+'\x22';_0x27bc72[_0xc207('0x29')](_0x2043cf);});return _0x27bc72[_0xc207('0x2a')]('\x20');};exports[_0xc207('0x2b')]=function(_0x448df1,_0x24df00,_0x2ce133){var _0x47d4c9={},_0x18bf7e={};if(_0x24df00[_0xc207('0x2c')][_0xc207('0x2d')]){_0x24df00[_0xc207('0x2c')]['id']=_0x24df00['query'][_0xc207('0x2d')];delete _0x24df00[_0xc207('0x2c')][_0xc207('0x2d')];}_0x47d4c9[_0xc207('0x2e')]=_[_0xc207('0x15')](_0x448df1,_0xc207('0x10'));_0x47d4c9[_0xc207('0x2c')]=_[_0xc207('0x4')](_0x24df00[_0xc207('0x2c')]);_0x47d4c9['filters']=_['intersection'](_0x47d4c9[_0xc207('0x2e')],_0x47d4c9[_0xc207('0x2c')]);_0x18bf7e[_0xc207('0x2f')]=_[_0xc207('0x30')](_0x47d4c9['model'],this[_0xc207('0x5')](_0x24df00[_0xc207('0x2c')][_0xc207('0x5')]));_0x18bf7e[_0xc207('0x2f')]=_0x18bf7e[_0xc207('0x2f')]['length']?_0x18bf7e[_0xc207('0x2f')]:_0x47d4c9[_0xc207('0x2e')];if(!_0x24df00['query'][_0xc207('0x21')]('nolimit')){_0x18bf7e[_0xc207('0x31')]=this[_0xc207('0x31')](_0x24df00['query'][_0xc207('0x31')]);_0x18bf7e[_0xc207('0x32')]=this[_0xc207('0x32')](_0x24df00['query']['offset']);}_0x18bf7e[_0xc207('0x33')]=this[_0xc207('0x14')](_0x24df00[_0xc207('0x2c')][_0xc207('0x14')]);_0x18bf7e['where']=this[_0xc207('0x6')](_['pick'](_0x24df00['query'],_0x47d4c9['filters']),_0x448df1);if(_0x24df00['query'][_0xc207('0x34')]){var _0x370d0d=_0x448df1;var _0xdde267=_0x24df00['query'][_0xc207('0x34')];if(typeof _0xdde267===_0xc207('0x35')){_0x370d0d=_[_0xc207('0x34')](_0x448df1,function(_0x5ae1ab){return _['includes'](_0xdde267[_0xc207('0x36')],_0x5ae1ab[_0xc207('0x10')]);});_0xdde267=_0xdde267[_0xc207('0x37')];}_0x18bf7e[_0xc207('0x38')]=_[_0xc207('0x39')](_0x18bf7e['where'],{'$or':_[_0xc207('0x15')](_0x370d0d,function(_0x19a67d){if(_0x19a67d[_0xc207('0x3a')]!==_0xc207('0x3b')){if(_0x2ce133){return sequelize[_0xc207('0x38')](sequelize['fn'](_0xc207('0x3c'),sequelize[_0xc207('0x19')](_0x19a67d[_0xc207('0x10')])),{'$like':sequelize['fn'](_0xc207('0x3c'),'%'+_0x24df00['query'][_0xc207('0x34')]+'%')});}else{var _0x16ed4f={};_0x16ed4f[_0x19a67d['name']]={'$like':'%'+_0x24df00[_0xc207('0x2c')][_0xc207('0x34')]+'%'};return _0x16ed4f;}}})});}_0x18bf7e=_[_0xc207('0x39')]({},_0x18bf7e,_0x24df00[_0xc207('0x3d')]);return _0x18bf7e;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 654dd51..7bdb889 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 _0x087b=['mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','lodash','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','openchannelPause','whatsappPause','length','idle','unknown','ringing','voicePause','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','whatsappStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','then','getAgents','flatten','uniq','value','filter','includes','getAgentIdsByStatus','resolve','findAll','fullname','faxPause','smsPause','pauseType','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','DESC','ASC','getUpdatedSortOptions','internal','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastPauseAt','openchannelCapacity'];(function(_0x846f06,_0x4b9509){var _0x20a953=function(_0x419d22){while(--_0x419d22){_0x846f06['push'](_0x846f06['shift']());}};_0x20a953(++_0x4b9509);}(_0x087b,0x167));var _0xb087=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x087b[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xb087('0x0'));var jayson=require(_0xb087('0x1'));var db=require(_0xb087('0x2'))['db'];var amiClient=jayson[_0xb087('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xb087('0x3')][_0xb087('0x4')]({'port':0x232c});function isAgentPaused(_0x469891,_0x2e8eea){var _0x95d09d=[_0x469891[_0xb087('0x5')],_0x469891['faxPause'],_0x469891[_0xb087('0x6')],_0x469891[_0xb087('0x7')],_0x469891['smsPause'],_0x469891['voicePause'],_0x469891[_0xb087('0x8')]];if(!_0x2e8eea)return _['every'](_0x95d09d);var _0x346988=_['filter'](_0x95d09d);return _0x346988[_0xb087('0x9')]>0x0&&_0x346988[_0xb087('0x9')]<_0x95d09d['length']?!![]:![];}function isIdle(_0x430ad3){return _0x430ad3===_0xb087('0xa')||_0x430ad3===_0xb087('0xb')||_0x430ad3==='unavailable'||_0x430ad3===_0xb087('0xc')||_['isNil'](_0x430ad3);}function isAgentIdle(_0x402036){if(_0x402036['voiceStatus']!==_0xb087('0xa')&&_0x402036[_0xb087('0xd')]){_0x402036['voiceStatus']=_0xb087('0xe');return![];}return _[_0xb087('0xf')]([_0x402036[_0xb087('0x10')],_0x402036[_0xb087('0x11')],_0x402036[_0xb087('0x12')],_0x402036[_0xb087('0x13')],_0x402036[_0xb087('0x14')],_0x402036[_0xb087('0x15')],_0x402036[_0xb087('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xb087('0x17')](_0xb087('0x18'),{})['then'](function(_0x1e07dd){if(_0x1e07dd[_0xb087('0x19')]){throw new Error(_0xb087('0x1a'));}var _0x2ffb06=_0x1e07dd[_0xb087('0x1b')];return routingClient['request']('Agents',{})['then'](function(_0x2f6de7){if(_0x2f6de7[_0xb087('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x5d97ba=_0x2f6de7[_0xb087('0x1b')];return _[_0xb087('0x1c')]({},_0x2ffb06,_0x5d97ba);});})[_0xb087('0x1d')](function(_0x326b3c){throw _0x326b3c;});}exports[_0xb087('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x3ec487){var _0x161675=_0xb087('0xb');if(isAgentPaused(_0x3ec487))_0x161675='pause';else if(isAgentPaused(_0x3ec487,!![]))_0x161675=_0xb087('0x1f');else if(isAgentIdle(_0x3ec487))_0x161675=_0xb087('0xa');else _0x161675=_0xb087('0x20');return _0x161675;}exports[_0xb087('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x1125c0,_0x2fc20d){var _0x1ee210=_[_0xb087('0x22')](_0x1125c0)?_0x1125c0:[_0x1125c0];var _0x5998f9=_[_0xb087('0x23')](_0x2fc20d)+_0xb087('0x24');var _0x7c0f44=_[_0xb087('0x25')](_0x1ee210,function(_0x190a84){return db[_0x5998f9][_0xb087('0x26')]({'where':{'id':_0x190a84}})[_0xb087('0x27')](function(_0x586449){if(!_0x586449)return[];return _0x586449[_0xb087('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x7c0f44)[_0xb087('0x27')](function(_0x87297){var _0x42d898=_(_0x87297)[_0xb087('0x29')]()[_0xb087('0x25')]('id')[_0xb087('0x2a')]()[_0xb087('0x2b')]();return _0x42d898;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x58224f,_0x2479d4,_0x29b7fb){try{if(_0x2479d4['length']>0x0){_0x58224f=_0x58224f[_0xb087('0x2c')](function(_0x1ef1b4){return _0x2479d4[_0xb087('0x2d')](_0x1ef1b4['id']);});}var _0x2af00c=_0x58224f[_0xb087('0x2c')](function(_0x1e5e87){var _0x5a16ae=_0xb087('0x20');if(isAgentIdle(_0x1e5e87)){_0x5a16ae=_0xb087('0xa');}return _0x5a16ae===_0x29b7fb;});return _[_0xb087('0x25')](_0x2af00c,'id');}catch(_0x5604cf){throw _0x5604cf;}}exports[_0xb087('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2ab60d,_0x5cf563,_0x782e07){return Promise[_0xb087('0x2f')]()[_0xb087('0x27')](function(){if(_0x5cf563[_0xb087('0x9')]>0x0){_0x2ab60d=_0x2ab60d[_0xb087('0x2c')](function(_0x2bdc8a){return _0x5cf563['includes'](_0x2bdc8a['id']);});}return _0x2ab60d;})['then'](function(){return db['User'][_0xb087('0x30')]({'attributes':['id','name',_0xb087('0x31'),_0xb087('0x5'),_0xb087('0x32'),_0xb087('0x6'),'openchannelPause',_0xb087('0x33'),_0xb087('0xd'),_0xb087('0x8'),_0xb087('0x34')],'where':{'id':{'$in':_[_0xb087('0x25')](_0x2ab60d,'id')}},'raw':!![]});})[_0xb087('0x27')](function(_0x2390a0){return _0x2390a0[_0xb087('0x25')](function(_0x3eb953){var _0x584f2d=_[_0xb087('0x35')](_0x2ab60d,['id',_0x3eb953['id']]);var _0x1537ff=filterAgentAttributes(_0x584f2d);_['merge'](_0x3eb953,_0x1537ff);_0x3eb953['globalStatus']=getAgentStatus(_0x3eb953);return _0x3eb953;});})['then'](function(_0x6fb7ec){var _0x1bb2d8=sortAgentsByStatus(_0x6fb7ec,_0x782e07);return _[_0xb087('0x25')](_0x1bb2d8,'id');})[_0xb087('0x1d')](function(_0x4b4c4c){throw _0x4b4c4c;});}exports[_0xb087('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x7e32e1){var _0x50b304={'fields':[],'order':null};var _0x491a2b=_0x7e32e1[_0xb087('0x37')](',');_0x50b304[_0xb087('0x38')]=_['filter'](_0x491a2b,function(_0x156e19){if(!_0x156e19[_0xb087('0x2d')](_0xb087('0x39'))){return!![];}_0x50b304[_0xb087('0x3a')]=_['startsWith'](_0x156e19,'-')?_0xb087('0x3b'):_0xb087('0x3c');return![];});return _0x50b304;}exports[_0xb087('0x3d')]=getUpdatedSortOptions;function validateSortParameter(_0x4b15bc){if(_0x4b15bc[_0xb087('0x2d')](_0xb087('0x31'))&&!_0x4b15bc['includes'](_0xb087('0x3e'))){var _0x2ae84e=_0x4b15bc['substring'](0x0,_0x4b15bc[_0xb087('0x3f')](_0xb087('0x31')));_0x4b15bc+=','+_0x2ae84e+_0xb087('0x3e');}return _0x4b15bc;}exports[_0xb087('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x3e034f,_0x4322dc){var _0x496af9=_0x3e034f[_0xb087('0x41')](function(_0x1b6f59,_0x59c369){if(_0x1b6f59[_0xb087('0x39')]===_0x59c369[_0xb087('0x39')]){if(_0x1b6f59[_0xb087('0x39')]==='pause'){if(_0x4322dc===_0xb087('0x3b')){return(_0x1b6f59[_0xb087('0x34')]||'')<(_0x59c369['pauseType']||'')||_0x1b6f59[_0xb087('0x31')]['toLowerCase']()>_0x59c369[_0xb087('0x31')][_0xb087('0x42')]()?0x1:-0x1;}else{return(_0x1b6f59[_0xb087('0x34')]||'')<(_0x59c369[_0xb087('0x34')]||'')||_0x1b6f59['fullname'][_0xb087('0x42')]()>_0x59c369[_0xb087('0x31')][_0xb087('0x42')]()?-0x1:0x1;}}else{if(_0x4322dc===_0xb087('0x3b')){return _0x1b6f59[_0xb087('0x31')][_0xb087('0x42')]()<_0x59c369[_0xb087('0x31')]['toLowerCase']()?0x1:-0x1;}else{return _0x1b6f59[_0xb087('0x31')][_0xb087('0x42')]()<_0x59c369[_0xb087('0x31')][_0xb087('0x42')]()?-0x1:0x1;}}}else{if(_0x4322dc===_0xb087('0x3b')){return _0x1b6f59[_0xb087('0x39')]<_0x59c369[_0xb087('0x39')]?0x1:-0x1;}else{return _0x1b6f59[_0xb087('0x39')]<_0x59c369[_0xb087('0x39')]?-0x1:0x1;}}});return _0x496af9;}exports[_0xb087('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x145962){var _0x2eaaee=['userpic',_0xb087('0x44'),'lastLoginAt',_0xb087('0x45'),_0xb087('0x34'),_0xb087('0x45'),_0xb087('0x3e'),'address',_0xb087('0x5'),'openchannelPause',_0xb087('0x6'),_0xb087('0x33'),'whatsappPause',_0xb087('0x32'),'voicePause','chatCapacity',_0xb087('0x46'),_0xb087('0x47'),_0xb087('0x48'),_0xb087('0x49'),'faxCapacity','chatCurrentCapacity',_0xb087('0x4a'),_0xb087('0x4b'),'smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity',_0xb087('0x10'),'openchannelStatus',_0xb087('0x12'),'smsStatus','whatsappStatus','faxStatus',_0xb087('0x15'),_0xb087('0x4c'),_0xb087('0x4d'),'mailStatusTime',_0xb087('0x4e'),_0xb087('0x4f'),'faxStatusTime',_0xb087('0x50'),_0xb087('0x51'),'destconnectedlinenum',_0xb087('0x52'),'phoneBarEnableScreenRecordingByAgent',_0xb087('0x53'),'routealias'];var _0xb199de=[_0xb087('0x5'),_0xb087('0x7'),_0xb087('0x6'),_0xb087('0x33'),'whatsappPause','faxPause',_0xb087('0xd'),_0xb087('0x44')];var _0x5eb38b=_(_0x145962)[_0xb087('0x54')](_0xb199de)[_0xb087('0x55')](_0x2eaaee)[_0xb087('0x2b')]();return _0x5eb38b;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x9f86=['Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','getAgentStatus','startCase','Queue','map','findOne','all','flatten','uniq','value','includes','filter','getAgentIdsByStatus','resolve','findAll','name','faxPause','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','startsWith','ASC','getUpdatedSortOptions','fullname','internal','substring','indexOf','validateSortParameter','toLowerCase','DESC','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','routealias','openchannelPause','omit','filterAgentAttributes','../../mysqldb','client','http','chatPause','mailPause','smsPause','voicePause','every','length','idle','unknown','ringing','voiceStatus','chatStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error'];(function(_0x2c78cf,_0x5a52c3){var _0x4a2ddc=function(_0x168f3c){while(--_0x168f3c){_0x2c78cf['push'](_0x2c78cf['shift']());}};_0x4a2ddc(++_0x5a52c3);}(_0x9f86,0x99));var _0x69f8=function(_0x16848e,_0x8effbf){_0x16848e=_0x16848e-0x0;var _0x1c459c=_0x9f86[_0x16848e];return _0x1c459c;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require(_0x69f8('0x0'))['db'];var amiClient=jayson[_0x69f8('0x1')][_0x69f8('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0x69f8('0x2')]({'port':0x232c});function isAgentPaused(_0x38ebe7,_0x3efd35){var _0x4fe0ca=[_0x38ebe7[_0x69f8('0x3')],_0x38ebe7['faxPause'],_0x38ebe7[_0x69f8('0x4')],_0x38ebe7['openchannelPause'],_0x38ebe7[_0x69f8('0x5')],_0x38ebe7[_0x69f8('0x6')],_0x38ebe7['whatsappPause']];if(!_0x3efd35)return _[_0x69f8('0x7')](_0x4fe0ca);var _0x345677=_['filter'](_0x4fe0ca);return _0x345677[_0x69f8('0x8')]>0x0&&_0x345677['length']<_0x4fe0ca[_0x69f8('0x8')]?!![]:![];}function isIdle(_0x57c60f){return _0x57c60f===_0x69f8('0x9')||_0x57c60f===_0x69f8('0xa')||_0x57c60f==='unavailable'||_0x57c60f===_0x69f8('0xb')||_['isNil'](_0x57c60f);}function isAgentIdle(_0x38b63c){if(_0x38b63c[_0x69f8('0xc')]!=='idle'&&_0x38b63c[_0x69f8('0x6')]){_0x38b63c['voiceStatus']='pause';return![];}return _[_0x69f8('0x7')]([_0x38b63c[_0x69f8('0xd')],_0x38b63c['faxStatus'],_0x38b63c[_0x69f8('0xe')],_0x38b63c[_0x69f8('0xf')],_0x38b63c['smsStatus'],_0x38b63c[_0x69f8('0xc')],_0x38b63c[_0x69f8('0x10')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x69f8('0x11')](_0x69f8('0x12'),{})[_0x69f8('0x13')](function(_0x3179db){if(_0x3179db['error']){throw new Error(_0x69f8('0x14'));}var _0x40c12d=_0x3179db[_0x69f8('0x15')];return routingClient[_0x69f8('0x11')](_0x69f8('0x12'),{})[_0x69f8('0x13')](function(_0x153e39){if(_0x153e39[_0x69f8('0x16')]){throw new Error(_0x69f8('0x17'));}var _0x3f860d=_0x153e39[_0x69f8('0x15')];return _[_0x69f8('0x18')]({},_0x40c12d,_0x3f860d);});})[_0x69f8('0x19')](function(_0x31b8b3){throw _0x31b8b3;});}exports[_0x69f8('0x1a')]=getRealtimeAgents;function getAgentStatus(_0x5de528){var _0x6ce167=_0x69f8('0xa');if(isAgentPaused(_0x5de528))_0x6ce167=_0x69f8('0x1b');else if(isAgentPaused(_0x5de528,!![]))_0x6ce167=_0x69f8('0x1c');else if(isAgentIdle(_0x5de528))_0x6ce167=_0x69f8('0x9');else _0x6ce167='busy';return _0x6ce167;}exports[_0x69f8('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x4fec50,_0x3e72c6){var _0xf8f513=_['isArray'](_0x4fec50)?_0x4fec50:[_0x4fec50];var _0x11862c=_[_0x69f8('0x1e')](_0x3e72c6)+_0x69f8('0x1f');var _0x14bfb7=_[_0x69f8('0x20')](_0xf8f513,function(_0x1683de){return db[_0x11862c][_0x69f8('0x21')]({'where':{'id':_0x1683de}})[_0x69f8('0x13')](function(_0x2025ad){if(!_0x2025ad)return[];return _0x2025ad['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x69f8('0x22')](_0x14bfb7)[_0x69f8('0x13')](function(_0x492945){var _0x5b4495=_(_0x492945)[_0x69f8('0x23')]()[_0x69f8('0x20')]('id')[_0x69f8('0x24')]()[_0x69f8('0x25')]();return _0x5b4495;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x167433,_0x4bc968,_0x35b787){try{if(_0x4bc968[_0x69f8('0x8')]>0x0){_0x167433=_0x167433['filter'](function(_0x48691d){return _0x4bc968[_0x69f8('0x26')](_0x48691d['id']);});}var _0x1c5bf1=_0x167433[_0x69f8('0x27')](function(_0xe48120){var _0xc2a947='busy';if(isAgentIdle(_0xe48120)){_0xc2a947=_0x69f8('0x9');}return _0xc2a947===_0x35b787;});return _['map'](_0x1c5bf1,'id');}catch(_0x186e54){throw _0x186e54;}}exports[_0x69f8('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x33dfe0,_0x5089eb,_0x399937){return Promise[_0x69f8('0x29')]()[_0x69f8('0x13')](function(){if(_0x5089eb[_0x69f8('0x8')]>0x0){_0x33dfe0=_0x33dfe0[_0x69f8('0x27')](function(_0x4bf5b9){return _0x5089eb['includes'](_0x4bf5b9['id']);});}return _0x33dfe0;})[_0x69f8('0x13')](function(){return db['User'][_0x69f8('0x2a')]({'attributes':['id',_0x69f8('0x2b'),'fullname',_0x69f8('0x3'),_0x69f8('0x2c'),_0x69f8('0x4'),'openchannelPause',_0x69f8('0x5'),_0x69f8('0x6'),_0x69f8('0x2d'),_0x69f8('0x2e')],'where':{'id':{'$in':_[_0x69f8('0x20')](_0x33dfe0,'id')}},'raw':!![]});})[_0x69f8('0x13')](function(_0x293830){return _0x293830['map'](function(_0x3d6939){var _0x147fe4=_[_0x69f8('0x2f')](_0x33dfe0,['id',_0x3d6939['id']]);var _0x3efbcc=filterAgentAttributes(_0x147fe4);_[_0x69f8('0x18')](_0x3d6939,_0x3efbcc);_0x3d6939[_0x69f8('0x30')]=getAgentStatus(_0x3d6939);return _0x3d6939;});})['then'](function(_0x2661e7){var _0x13a12c=sortAgentsByStatus(_0x2661e7,_0x399937);return _[_0x69f8('0x20')](_0x13a12c,'id');})[_0x69f8('0x19')](function(_0x2855b6){throw _0x2855b6;});}exports[_0x69f8('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xb1f6fd){var _0x3e26f8={'fields':[],'order':null};var _0x3637f0=_0xb1f6fd['split'](',');_0x3e26f8[_0x69f8('0x32')]=_[_0x69f8('0x27')](_0x3637f0,function(_0x4fbae9){if(!_0x4fbae9['includes'](_0x69f8('0x30'))){return!![];}_0x3e26f8['order']=_[_0x69f8('0x33')](_0x4fbae9,'-')?'DESC':_0x69f8('0x34');return![];});return _0x3e26f8;}exports[_0x69f8('0x35')]=getUpdatedSortOptions;function validateSortParameter(_0x4c4a50){if(_0x4c4a50[_0x69f8('0x26')](_0x69f8('0x36'))&&!_0x4c4a50[_0x69f8('0x26')](_0x69f8('0x37'))){var _0x16ef5f=_0x4c4a50[_0x69f8('0x38')](0x0,_0x4c4a50[_0x69f8('0x39')](_0x69f8('0x36')));_0x4c4a50+=','+_0x16ef5f+_0x69f8('0x37');}return _0x4c4a50;}exports[_0x69f8('0x3a')]=validateSortParameter;function sortAgentsByStatus(_0x1c99b7,_0x5420e4){var _0x3530b4=_0x1c99b7['sort'](function(_0x337ec1,_0x204f7b){if(_0x337ec1[_0x69f8('0x30')]===_0x204f7b['globalStatus']){if(_0x337ec1['globalStatus']==='pause'){if(_0x5420e4==='DESC'){return(_0x337ec1[_0x69f8('0x2e')]||'')<(_0x204f7b[_0x69f8('0x2e')]||'')||_0x337ec1[_0x69f8('0x36')][_0x69f8('0x3b')]()>_0x204f7b[_0x69f8('0x36')][_0x69f8('0x3b')]()?0x1:-0x1;}else{return(_0x337ec1[_0x69f8('0x2e')]||'')<(_0x204f7b[_0x69f8('0x2e')]||'')||_0x337ec1[_0x69f8('0x36')][_0x69f8('0x3b')]()>_0x204f7b['fullname'][_0x69f8('0x3b')]()?-0x1:0x1;}}else{if(_0x5420e4===_0x69f8('0x3c')){return _0x337ec1[_0x69f8('0x36')]['toLowerCase']()<_0x204f7b['fullname'][_0x69f8('0x3b')]()?0x1:-0x1;}else{return _0x337ec1[_0x69f8('0x36')][_0x69f8('0x3b')]()<_0x204f7b[_0x69f8('0x36')][_0x69f8('0x3b')]()?-0x1:0x1;}}}else{if(_0x5420e4===_0x69f8('0x3c')){return _0x337ec1['globalStatus']<_0x204f7b[_0x69f8('0x30')]?0x1:-0x1;}else{return _0x337ec1['globalStatus']<_0x204f7b[_0x69f8('0x30')]?-0x1:0x1;}}});return _0x3530b4;}exports[_0x69f8('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x5787a7){var _0x24c054=[_0x69f8('0x3e'),_0x69f8('0x3f'),_0x69f8('0x40'),_0x69f8('0x41'),_0x69f8('0x2e'),_0x69f8('0x41'),_0x69f8('0x37'),_0x69f8('0x42'),'chatPause','openchannelPause','mailPause','smsPause','whatsappPause',_0x69f8('0x2c'),'voicePause','chatCapacity',_0x69f8('0x43'),'mailCapacity','smsCapacity','whatsappCapacity',_0x69f8('0x44'),_0x69f8('0x45'),_0x69f8('0x46'),_0x69f8('0x47'),_0x69f8('0x48'),_0x69f8('0x49'),_0x69f8('0x4a'),_0x69f8('0xd'),_0x69f8('0xf'),_0x69f8('0xe'),_0x69f8('0x4b'),_0x69f8('0x10'),'faxStatus',_0x69f8('0xc'),'chatStatusTime','openchannelStatusTime',_0x69f8('0x4c'),_0x69f8('0x4d'),_0x69f8('0x4e'),_0x69f8('0x4f'),_0x69f8('0x50'),_0x69f8('0x51'),_0x69f8('0x52'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0x69f8('0x53'),_0x69f8('0x54')];var _0xb43a08=[_0x69f8('0x3'),_0x69f8('0x55'),_0x69f8('0x4'),'smsPause',_0x69f8('0x2d'),'faxPause',_0x69f8('0x6'),'online'];var _0x490123=_(_0x5787a7)[_0x69f8('0x56')](_0xb43a08)['pick'](_0x24c054)[_0x69f8('0x25')]();return _0x490123;}exports[_0x69f8('0x57')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index bed17b7..8cf8a16 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d82=['catch','getRealtimeQueues','inbound','concat','outbound','map','get','waiting','originated','find','merge','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unknown','pTalking','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0x8d82,0xb4));var _0x28d8=function(_0x11918a,_0x3af520){_0x11918a=_0x11918a-0x0;var _0xcd30eb=_0x8d82[_0x11918a];return _0xcd30eb;};'use strict';var _=require(_0x28d8('0x0'));var jayson=require(_0x28d8('0x1'));var util=require(_0x28d8('0x2'));var amiClient=jayson[_0x28d8('0x3')][_0x28d8('0x4')]({'port':0x232a});var routingClient=jayson[_0x28d8('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x28d8('0x5'),_0x28d8('0x6'),_0x28d8('0x7'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x28d8('0x8'),_0x28d8('0x9'),_0x28d8('0xa'),_0x28d8('0xb'),'notInUse',_0x28d8('0xc'),_0x28d8('0xd'),_0x28d8('0xe'),_0x28d8('0xf'),'unavailable',_0x28d8('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x28d8('0x11'),'originated',_0x28d8('0x12'),'statusMessage',_0x28d8('0x13'),_0x28d8('0x14'),_0x28d8('0x15'),_0x28d8('0x16'),_0x28d8('0x17'),_0x28d8('0x18'),_0x28d8('0x19'),_0x28d8('0x1a'),_0x28d8('0x1b'),_0x28d8('0x1c'),_0x28d8('0x1d'),'dialPredictiveIntervalMinThreshold',_0x28d8('0x1e'),_0x28d8('0x1f'),_0x28d8('0x20'),_0x28d8('0x21'),_0x28d8('0x22'),'predictiveIntervalAvgHoldtime',_0x28d8('0x23')];function getRealtimeQueues(_0x2f2c6e,_0x2c4e9){var _0x147614=_0x2c4e9===_0x28d8('0x24')?amiClient:routingClient;return _0x147614[_0x28d8('0x25')](_[_0x28d8('0x26')](_0x2c4e9)+_0x28d8('0x27'),_0x2f2c6e)[_0x28d8('0x28')](function(_0x3da300){if(_0x3da300[_0x28d8('0x29')])throw new Error(util[_0x28d8('0x2a')](_0x28d8('0x2b'),_0x2c4e9));return _0x3da300['result'];})[_0x28d8('0x2c')](function(_0x4d5bb4){throw _0x4d5bb4;});}exports[_0x28d8('0x2d')]=getRealtimeQueues;function initializeQueues(_0x3c07db,_0x3bab27,_0x34c968,_0x47c651){var _0x1a2561=DEFAULT_QUEUE_ATTRIBUTES;if(_0x34c968===_0x28d8('0x24')){if(_0x47c651===_0x28d8('0x2e')){_0x1a2561=_0x1a2561[_0x28d8('0x2f')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x47c651===_0x28d8('0x30')){_0x1a2561=_0x1a2561['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3c07db[_0x28d8('0x31')](function(_0x200ccd){var _0x2ee96d=_0x200ccd[_0x28d8('0x32')]({'plain':!![]});_0x2ee96d[_0x28d8('0x7')]=0x0;_0x2ee96d[_0x28d8('0xb')]=0x0;_0x2ee96d[_0x28d8('0x6')]=0x0;_0x2ee96d[_0x28d8('0x5')]=0x0;_0x2ee96d[_0x28d8('0x33')]=0x0;if(_0x34c968===_0x28d8('0x24')){_0x2ee96d[_0x28d8('0xf')]=0x0;_0x2ee96d['busy']=0x0;if(_0x47c651===_0x28d8('0x30')){_0x2ee96d[_0x28d8('0x11')]=0x0;_0x2ee96d[_0x28d8('0x34')]=0x0;}}var _0x5353a0=_[_0x28d8('0x35')](_0x3bab27,['id',_0x2ee96d['id']]);if(_0x5353a0){_[_0x28d8('0x36')](_0x2ee96d,_['pick'](_0x5353a0,_0x1a2561));}return _0x2ee96d;});}exports[_0x28d8('0x37')]=initializeQueues; \ No newline at end of file +var _0x9200=['unavailable','originated','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','startCase','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedInDb','loggedIn','waiting','talking','pTalking','pick','initializeQueues','lodash','jayson/promise','util','http','available','paused','busy','inUse','notInUse','onHold','ringing','ringInUse'];(function(_0x193a6e,_0x45dd00){var _0x599a9b=function(_0x37a9e2){while(--_0x37a9e2){_0x193a6e['push'](_0x193a6e['shift']());}};_0x599a9b(++_0x45dd00);}(_0x9200,0xc4));var _0x0920=function(_0x104eb5,_0x3e04a8){_0x104eb5=_0x104eb5-0x0;var _0x181535=_0x9200[_0x104eb5];return _0x181535;};'use strict';var _=require(_0x0920('0x0'));var jayson=require(_0x0920('0x1'));var util=require(_0x0920('0x2'));var amiClient=jayson['client'][_0x0920('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x0920('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x0920('0x4'),'loggedIn',_0x0920('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x0920('0x6'),_0x0920('0x7'),'invalid','loggedInDb',_0x0920('0x8'),_0x0920('0x9'),_0x0920('0xa'),_0x0920('0xb'),'talking',_0x0920('0xc'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x0920('0xd'),_0x0920('0xe'),_0x0920('0xf'),_0x0920('0x10'),_0x0920('0x11'),_0x0920('0x12'),_0x0920('0x13'),'startProgressive',_0x0920('0x14'),_0x0920('0x15'),_0x0920('0x16'),_0x0920('0x17'),_0x0920('0x18'),_0x0920('0x19'),_0x0920('0x1a'),_0x0920('0x1b'),_0x0920('0x1c'),_0x0920('0x1d'),_0x0920('0x1e'),_0x0920('0x1f'),'predictiveIntervalAvgHoldtime',_0x0920('0x20')];function getRealtimeQueues(_0x5a5cd5,_0x4fe84b){var _0x369980=_0x4fe84b===_0x0920('0x21')?amiClient:routingClient;return _0x369980['request'](_[_0x0920('0x22')](_0x4fe84b)+'Queues',_0x5a5cd5)['then'](function(_0x4bd47b){if(_0x4bd47b[_0x0920('0x23')])throw new Error(util['format'](_0x0920('0x24'),_0x4fe84b));return _0x4bd47b[_0x0920('0x25')];})[_0x0920('0x26')](function(_0x4d54b8){throw _0x4d54b8;});}exports[_0x0920('0x27')]=getRealtimeQueues;function initializeQueues(_0x18fab1,_0x590f6e,_0x39b9c9,_0x4e6401){var _0x170672=DEFAULT_QUEUE_ATTRIBUTES;if(_0x39b9c9==='voice'){if(_0x4e6401===_0x0920('0x28')){_0x170672=_0x170672[_0x0920('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x4e6401===_0x0920('0x2a')){_0x170672=_0x170672[_0x0920('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x18fab1[_0x0920('0x2b')](function(_0x58ea9f){var _0x2160f4=_0x58ea9f[_0x0920('0x2c')]({'plain':!![]});_0x2160f4['paused']=0x0;_0x2160f4[_0x0920('0x2d')]=0x0;_0x2160f4[_0x0920('0x2e')]=0x0;_0x2160f4[_0x0920('0x4')]=0x0;_0x2160f4[_0x0920('0x2f')]=0x0;if(_0x39b9c9===_0x0920('0x21')){_0x2160f4[_0x0920('0x30')]=0x0;_0x2160f4['busy']=0x0;if(_0x4e6401===_0x0920('0x2a')){_0x2160f4[_0x0920('0x31')]=0x0;_0x2160f4[_0x0920('0xd')]=0x0;}}var _0x31896e=_['find'](_0x590f6e,['id',_0x2160f4['id']]);if(_0x31896e){_['merge'](_0x2160f4,_[_0x0920('0x32')](_0x31896e,_0x170672));}return _0x2160f4;});}exports[_0x0920('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5de7d4b..ee91179 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x544ec1,_0x2814eb){var _0x31e735=function(_0x45f226){while(--_0x45f226){_0x544ec1['push'](_0x544ec1['shift']());}};_0x31e735(++_0x2814eb);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _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(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b3232af..f89f9f2 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 _0xd56a=['md5','update','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','join','createHash','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0xd56a,0x147));var _0xad56=function(_0x5b2e3d,_0x2d7f7b){_0x5b2e3d=_0x5b2e3d-0x0;var _0x35a13c=_0xd56a[_0x5b2e3d];return _0x35a13c;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xad56('0x0'));var machine=require(_0xad56('0x1'));var exec=require(_0xad56('0x2'))[_0xad56('0x3')];var config=require(_0xad56('0x4'));function getInterfaces(){var _0x4df192=[];var _0x20efb9=os[_0xad56('0x5')]();var _0x5dcebf=_[_0xad56('0x6')](_[_0xad56('0x7')](_0x20efb9));for(var _0x8c66f=0x0;_0x8c66f<_0x5dcebf[_0xad56('0x8')];_0x8c66f++){var _0x8ba6f6=_0x20efb9[_0x5dcebf[_0x8c66f]][_0xad56('0x9')](function(_0x17164b){return _0x17164b['family']===_0xad56('0xa')&&_0x17164b['internal']===![];});_0x4df192=_0x4df192[_0xad56('0xb')](_0x8ba6f6);}return _0x4df192;}function getFirstInterface(){var _0x3f84c5=_[_0xad56('0xc')](getInterfaces());return{'macAddress':_0x3f84c5&&_0x3f84c5['mac']?_0x3f84c5[_0xad56('0xd')]:_0xad56('0xe'),'ipAddress':_0x3f84c5&&_0x3f84c5[_0xad56('0xf')]?_0x3f84c5[_0xad56('0xf')]:'127.0.0.1'};}exports[_0xad56('0x10')]=getFirstInterface;function getCPUhash(){var _0xe3d99b=_[_0xad56('0x6')](os[_0xad56('0x11')]()[_0xad56('0x12')](function(_0x38b82d){return _0x38b82d['model'];}))[_0xad56('0x13')](':');return crypto[_0xad56('0x14')]('md5')['update'](_0xe3d99b)[_0xad56('0x15')](_0xad56('0x16'));}exports[_0xad56('0x17')]=function(){var _0x40e408=os['platform']();var _0x1648ce=/[0-9a-f-]{36}/;if(config[_0xad56('0x18')]&&_0x1648ce[_0xad56('0x19')](config[_0xad56('0x18')])){return config[_0xad56('0x18')];}else if(_0x40e408===_0xad56('0x1a')){return exec(_0xad56('0x1b'),{'encoding':_0xad56('0x1c')})[_0xad56('0x1d')]('\x0d\x0a','');}else{var _0x54116f=getFirstInterface();var _0xf076e5=getCPUhash();var _0x1d5d7e=_0xf076e5+'|'+os[_0xad56('0x1e')]()+'|'+_0x54116f[_0xad56('0x1f')]+'|'+_0x54116f[_0xad56('0x20')];var _0x52d0cf=crypto[_0xad56('0x14')](_0xad56('0x21'))[_0xad56('0x22')](_0x1d5d7e)[_0xad56('0x15')](_0xad56('0x16'));return _0x52d0cf[_0xad56('0x23')](0x0,0x8)+'-'+_0x52d0cf[_0xad56('0x23')](0x8,0xc)+'-'+_0x52d0cf['substring'](0xc,0x10)+'-'+_0x52d0cf['substring'](0x10,0x14)+'-'+_0x52d0cf['substring'](0x14);}}; \ No newline at end of file +var _0xc5e9=['getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','length','filter','family','IPv4','internal','head','mac','address','127.0.0.1','cpus','map','model','createHash','md5','update','hex'];(function(_0x12b7e0,_0x4ce130){var _0x3c5c1a=function(_0x3b5a1a){while(--_0x3b5a1a){_0x12b7e0['push'](_0x12b7e0['shift']());}};_0x3c5c1a(++_0x4ce130);}(_0xc5e9,0x16a));var _0x9c5e=function(_0x5ae9ff,_0x20c4df){_0x5ae9ff=_0x5ae9ff-0x0;var _0x23adf6=_0xc5e9[_0x5ae9ff];return _0x23adf6;};'use strict';var _=require(_0x9c5e('0x0'));var os=require('os');var crypto=require(_0x9c5e('0x1'));var machine=require(_0x9c5e('0x2'));var exec=require(_0x9c5e('0x3'))[_0x9c5e('0x4')];var config=require(_0x9c5e('0x5'));function getInterfaces(){var _0x3c76fb=[];var _0x51d448=os['networkInterfaces']();var _0x56e98c=_['orderBy'](_['keys'](_0x51d448));for(var _0x4c4828=0x0;_0x4c4828<_0x56e98c[_0x9c5e('0x6')];_0x4c4828++){var _0x57d255=_0x51d448[_0x56e98c[_0x4c4828]][_0x9c5e('0x7')](function(_0x24e7b8){return _0x24e7b8[_0x9c5e('0x8')]===_0x9c5e('0x9')&&_0x24e7b8[_0x9c5e('0xa')]===![];});_0x3c76fb=_0x3c76fb['concat'](_0x57d255);}return _0x3c76fb;}function getFirstInterface(){var _0x4e0ab2=_[_0x9c5e('0xb')](getInterfaces());return{'macAddress':_0x4e0ab2&&_0x4e0ab2[_0x9c5e('0xc')]?_0x4e0ab2[_0x9c5e('0xc')]:'00:00:00:00:00:00','ipAddress':_0x4e0ab2&&_0x4e0ab2[_0x9c5e('0xd')]?_0x4e0ab2['address']:_0x9c5e('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x38c4d0=_['orderBy'](os[_0x9c5e('0xf')]()[_0x9c5e('0x10')](function(_0x535354){return _0x535354[_0x9c5e('0x11')];}))['join'](':');return crypto[_0x9c5e('0x12')](_0x9c5e('0x13'))[_0x9c5e('0x14')](_0x38c4d0)['digest'](_0x9c5e('0x15'));}exports[_0x9c5e('0x16')]=function(){var _0x1a01eb=os[_0x9c5e('0x17')]();var _0x1bd60a=/[0-9a-f-]{36}/;if(config[_0x9c5e('0x18')]&&_0x1bd60a[_0x9c5e('0x19')](config[_0x9c5e('0x18')])){return config[_0x9c5e('0x18')];}else if(_0x1a01eb==='win32'){return exec(_0x9c5e('0x1a'),{'encoding':'utf8'})[_0x9c5e('0x1b')]('\x0d\x0a','');}else{var _0x1e6708=getFirstInterface();var _0x210526=getCPUhash();var _0x3c589c=_0x210526+'|'+os[_0x9c5e('0x1c')]()+'|'+_0x1e6708[_0x9c5e('0x1d')]+'|'+_0x1e6708[_0x9c5e('0x1e')];var _0x40ce16=crypto[_0x9c5e('0x12')](_0x9c5e('0x13'))[_0x9c5e('0x14')](_0x3c589c)['digest'](_0x9c5e('0x15'));return _0x40ce16[_0x9c5e('0x1f')](0x0,0x8)+'-'+_0x40ce16[_0x9c5e('0x1f')](0x8,0xc)+'-'+_0x40ce16['substring'](0xc,0x10)+'-'+_0x40ce16[_0x9c5e('0x1f')](0x10,0x14)+'-'+_0x40ce16[_0x9c5e('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index bce0e83..11fec24 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 _0x4676=['license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','data2','data1','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','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','days','catch','error','getUuid','spread','message','default','moment','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger'];(function(_0x5ddbf3,_0x3b1bd8){var _0x1dd926=function(_0x12df28){while(--_0x12df28){_0x5ddbf3['push'](_0x5ddbf3['shift']());}};_0x1dd926(++_0x3b1bd8);}(_0x4676,0x119));var _0x6467=function(_0x4f2a0f,_0x38e739){_0x4f2a0f=_0x4f2a0f-0x0;var _0xd4826c=_0x4676[_0x4f2a0f];return _0xd4826c;};'use strict';var util=require('util');var moment=require(_0x6467('0x0'));var rp=require('request-promise');var BPromise=require(_0x6467('0x1'));var pkginfo=require(_0x6467('0x2'))(module,_0x6467('0x3'));var db=require(_0x6467('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x6467('0x5'));var logger=require(_0x6467('0x6'))(_0x6467('0x7'));var HOST=_0x6467('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x426f22){return new BPromise(function(_0x13f503,_0x109969){var _0x43ef61=util[_0x6467('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x426f22,module[_0x6467('0xa')][_0x6467('0x3')]);if(oldToken){_0x43ef61=util['format'](_0x6467('0xb'),HOST,_0x426f22,module[_0x6467('0xa')]['version'],oldToken);}var _0x263ca5={'uri':_0x43ef61,'method':_0x6467('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x263ca5)[_0x6467('0xd')](function(_0x4e0544){_0x13f503(_0x4e0544);})['catch'](function(_0x24cbd7){_0x109969(_0x24cbd7);});});}function manageLicense(_0x451379,_0x3e63e5){var _0x388daf=_0x3e63e5['get']({'plain':!![]});if(!isOldTokenSent&&_0x388daf['data1']!==_0x451379&&!_0x388daf[_0x6467('0xe')]){oldToken=_0x388daf[_0x6467('0xf')];}httpRequest(_0x451379)[_0x6467('0xd')](function(_0x373a30){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x373a30[_0x6467('0x10')]){isOldTokenSent=![];if(!_0x388daf[_0x6467('0x7')]&&_0x388daf[_0x6467('0x7')]!=_0x373a30['license']||_0x388daf[_0x6467('0x7')]&&_0x388daf[_0x6467('0xe')]){logger['info'](_0x6467('0x11'));}if(_0x388daf['license']&&!_0x388daf['data2']&&_0x388daf[_0x6467('0x7')]!=_0x373a30[_0x6467('0x7')]){logger[_0x6467('0x12')](_0x6467('0x13'));}if(_0x388daf[_0x6467('0x7')]&&!_0x388daf['data2']&&_0x388daf['license']==_0x373a30[_0x6467('0x7')]){return _0x3e63e5;}return _0x3e63e5[_0x6467('0x14')]({'data1':_0x451379,'data2':null,'license':_0x373a30[_0x6467('0x7')]});}else{if(_0x373a30['license']||_0x388daf['license']){if(!_0x388daf[_0x6467('0xe')]){if(_0x388daf[_0x6467('0xf')]==_0x451379){GRAY_PERIOD_REASON=_0x6467('0x15');logger[_0x6467('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x6467('0x12')](_0x6467('0x16'),_0x388daf[_0x6467('0xf')],_0x451379);}logger['info'](_0x6467('0x17'),GRAY_PERIOD_REASON[_0x6467('0x18')](),moment()[_0x6467('0x9')](_0x6467('0x19')));return _0x3e63e5[_0x6467('0x14')]({'data2':encryptor[_0x6467('0x1a')](moment()[_0x6467('0x9')](_0x6467('0x19')))});}else{if(moment()[_0x6467('0x1b')](encryptor[_0x6467('0x1c')](_0x388daf[_0x6467('0xe')]),_0x6467('0x1d'))>DAYS){logger[_0x6467('0x12')]('DEMO\x20START\x20AT\x20%s',moment()[_0x6467('0x9')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x3e63e5['update']({'data1':_0x451379,'data2':null,'license':null});}}}else{if(_0x388daf[_0x6467('0xf')]!=_0x451379){logger[_0x6467('0x12')](_0x6467('0x16'),_0x388daf[_0x6467('0xf')],_0x451379);return _0x3e63e5[_0x6467('0x14')]({'data1':_0x451379,'data2':null,'license':null});}}}return _0x3e63e5;})['then'](function(_0x138111){_0x3e63e5=_0x138111;})[_0x6467('0x1e')](function(_0x540f71){logger[_0x6467('0x1f')](_0x540f71['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3e63e5);},TIME);});}function defaultLicense(){var _0x39329a=hardware[_0x6467('0x20')]();if(_0x39329a){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x39329a}})[_0x6467('0x21')](function(_0xc75366,_0x3cffc0){logger[_0x6467('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x39329a);manageLicense(_0x39329a,_0xc75366);})[_0x6467('0x1e')](function(_0xadb497){logger[_0x6467('0x1f')](_0xadb497[_0x6467('0x22')]);});}}exports[_0x6467('0x23')]=defaultLicense; \ No newline at end of file +var _0xe5c7=['then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','message','finally','getUuid','License','findOrCreate','spread','error','default','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET'];(function(_0xbe31fb,_0x4ccbbc){var _0x38d07a=function(_0x4df0a5){while(--_0x4df0a5){_0xbe31fb['push'](_0xbe31fb['shift']());}};_0x38d07a(++_0x4ccbbc);}(_0xe5c7,0xfe));var _0x7e5c=function(_0x2d464d,_0x1b1480){_0x2d464d=_0x2d464d-0x0;var _0x2ef441=_0xe5c7[_0x2d464d];return _0x2ef441;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x7e5c('0x0'));var BPromise=require(_0x7e5c('0x1'));var pkginfo=require(_0x7e5c('0x2'))(module,_0x7e5c('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x7e5c('0x4'));var hardware=require(_0x7e5c('0x5'));var logger=require(_0x7e5c('0x6'))(_0x7e5c('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xcdf15f){return new BPromise(function(_0x180853,_0xedc07){var _0x3f5298=util[_0x7e5c('0x8')](_0x7e5c('0x9'),HOST,_0xcdf15f,module['exports'][_0x7e5c('0x3')]);if(oldToken){_0x3f5298=util['format'](_0x7e5c('0xa'),HOST,_0xcdf15f,module['exports'][_0x7e5c('0x3')],oldToken);}var _0x985798={'uri':_0x3f5298,'method':_0x7e5c('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x985798)[_0x7e5c('0xc')](function(_0x6003c1){_0x180853(_0x6003c1);})[_0x7e5c('0xd')](function(_0x242ca5){_0xedc07(_0x242ca5);});});}function manageLicense(_0x2c568a,_0xc1c7d7){var _0x2a7b17=_0xc1c7d7[_0x7e5c('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x2a7b17['data1']!==_0x2c568a&&!_0x2a7b17['data2']){oldToken=_0x2a7b17[_0x7e5c('0xf')];}httpRequest(_0x2c568a)[_0x7e5c('0xc')](function(_0x2b98b7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2b98b7[_0x7e5c('0x10')]){isOldTokenSent=![];if(!_0x2a7b17['license']&&_0x2a7b17['license']!=_0x2b98b7[_0x7e5c('0x7')]||_0x2a7b17[_0x7e5c('0x7')]&&_0x2a7b17[_0x7e5c('0x11')]){logger[_0x7e5c('0x12')](_0x7e5c('0x13'));}if(_0x2a7b17[_0x7e5c('0x7')]&&!_0x2a7b17[_0x7e5c('0x11')]&&_0x2a7b17['license']!=_0x2b98b7['license']){logger[_0x7e5c('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2a7b17['license']&&!_0x2a7b17[_0x7e5c('0x11')]&&_0x2a7b17['license']==_0x2b98b7[_0x7e5c('0x7')]){return _0xc1c7d7;}return _0xc1c7d7[_0x7e5c('0x14')]({'data1':_0x2c568a,'data2':null,'license':_0x2b98b7['license']});}else{if(_0x2b98b7[_0x7e5c('0x7')]||_0x2a7b17[_0x7e5c('0x7')]){if(!_0x2a7b17[_0x7e5c('0x11')]){if(_0x2a7b17[_0x7e5c('0xf')]==_0x2c568a){GRAY_PERIOD_REASON=_0x7e5c('0x15');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x7e5c('0x16');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2a7b17[_0x7e5c('0xf')],_0x2c568a);}logger[_0x7e5c('0x12')](_0x7e5c('0x17'),GRAY_PERIOD_REASON[_0x7e5c('0x18')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0xc1c7d7[_0x7e5c('0x14')]({'data2':encryptor[_0x7e5c('0x19')](moment()[_0x7e5c('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x7e5c('0x1a')](_0x2a7b17[_0x7e5c('0x11')]),_0x7e5c('0x1b'))>DAYS){logger[_0x7e5c('0x12')](_0x7e5c('0x1c'),moment()[_0x7e5c('0x8')](_0x7e5c('0x1d')));isOldTokenSent=![];return _0xc1c7d7[_0x7e5c('0x14')]({'data1':_0x2c568a,'data2':null,'license':null});}}}else{if(_0x2a7b17[_0x7e5c('0xf')]!=_0x2c568a){logger[_0x7e5c('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2a7b17[_0x7e5c('0xf')],_0x2c568a);return _0xc1c7d7[_0x7e5c('0x14')]({'data1':_0x2c568a,'data2':null,'license':null});}}}return _0xc1c7d7;})[_0x7e5c('0xc')](function(_0x4551aa){_0xc1c7d7=_0x4551aa;})['catch'](function(_0x491232){logger['error'](_0x491232[_0x7e5c('0x1e')]);})[_0x7e5c('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x7e5c('0x20')](),_0xc1c7d7);},TIME);});}function defaultLicense(){var _0xda4836=hardware[_0x7e5c('0x20')]();if(_0xda4836){return db[_0x7e5c('0x21')][_0x7e5c('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0xda4836}})[_0x7e5c('0x23')](function(_0x3c4e81,_0x3abd84){logger[_0x7e5c('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0xda4836);manageLicense(_0xda4836,_0x3c4e81);})['catch'](function(_0x1a2b83){logger[_0x7e5c('0x24')](_0x1a2b83['message']);});}}exports[_0x7e5c('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f246a2c..596b568 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 _0x87f0=['admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','format','machineUuid','message','User','findAll','role','sequelize','col','count'];(function(_0x5a94fa,_0x58de2f){var _0x24b5e2=function(_0x136d16){while(--_0x136d16){_0x5a94fa['push'](_0x5a94fa['shift']());}};_0x24b5e2(++_0x58de2f);}(_0x87f0,0x93));var _0x087f=function(_0x87c41d,_0x1b7fca){_0x87c41d=_0x87c41d-0x0;var _0x2b91f7=_0x87f0[_0x87c41d];return _0x2b91f7;};'use strict';var util=require(_0x087f('0x0'));var _=require(_0x087f('0x1'));var moment=require(_0x087f('0x2'));var BPromise=require(_0x087f('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x087f('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x087f('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x087f('0x6'),'machineUuid':hardware[_0x087f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x087f('0x8'),'machineUuid':hardware[_0x087f('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xc79b1d){return new BPromise(function(_0x5c62c6,_0x354869){return db[_0x087f('0x9')][_0x087f('0xa')](_[_0x087f('0xb')](_0xc79b1d,{'raw':!![],'where':{'id':0x1}}))[_0x087f('0xc')](function(_0x2daeab){return checkLicense(_0x2daeab,null);})[_0x087f('0xc')](function(_0x31ec37){_0x5c62c6(_0x31ec37);return;})[_0x087f('0xd')](function(_0x513534){_0x354869(_0x513534);});});}function checkLicense(_0x18b59b,_0x5b6954){if(!_0x18b59b){demoLicense[_0x087f('0xe')]=_0x18b59b[_0x087f('0xf')];return demoLicense;}try{var _0xfb80bd=_0x5b6954||_0x18b59b[_0x087f('0x10')];if(_[_0x087f('0x11')](_0xfb80bd)){throw new Error(_0x087f('0x12'));}var _0x2c00fb=_0x18b59b[_0x087f('0xf')];var _0x466938=_0x18b59b[_0x087f('0x13')];var _0x303db0=_0x2c00fb[_0x087f('0x14')]('-')[0x4];var _0x246f0e=_0x2c00fb['split']('-')[0x0];var _0x5d4eeb=encryptor[_0x087f('0x15')](_0xfb80bd,util['format'](_0x087f('0x16'),_0x303db0,_0x2c00fb,_0x246f0e));var _0x2b074d=JSON[_0x087f('0x17')](_0x5d4eeb);_0x2b074d[_0x087f('0x18')]=![];_0x2b074d[_0x087f('0xe')]=_0x2c00fb;_0x2b074d['machineUuid']=hardware[_0x087f('0x7')]();if(_0x466938){var _0x48451a=encryptor[_0x087f('0x15')](_0x466938);_0x2b074d[_0x087f('0x19')]=_0x48451a;_0x2b074d[_0x087f('0x1a')]=moment(_0x48451a)[_0x087f('0x1b')](0x7,'days')[_0x087f('0x1c')]();_0x2b074d['grayReason']=_0x2b074d[_0x087f('0xe')]!=_0x2b074d[_0x087f('0x1d')]?'changed':'disabled';}return _0x2b074d;}catch(_0x3fe01e){breakingLicense[_0x087f('0xe')]=_0x18b59b[_0x087f('0xf')];breakingLicense[_0x087f('0x1e')]=_0x3fe01e[_0x087f('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3d538a,_0x4fc424){getLicense()['then'](function(_0x352f9d){return db[_0x087f('0x1f')][_0x087f('0x20')]({'attributes':[_0x087f('0x21'),[db['sequelize']['fn']('COUNT',db[_0x087f('0x22')][_0x087f('0x23')]('role')),_0x087f('0x24')]],'group':_0x087f('0x21'),'where':{'role':{'$or':[_0x087f('0x25'),_0x087f('0x26'),_0x087f('0x27')]}},'raw':!![]})[_0x087f('0xc')](function(_0x4ea4ed){var _0x4ef97a={'user':_0x352f9d[_0x087f('0x28')]||0x0,'telephone':_0x352f9d[_0x087f('0x29')]||0x0};_0x4ea4ed[_0x087f('0x2a')](function(_0x3f558b){var _0x4317c5=_0x3f558b[_0x087f('0x21')]===_0x087f('0x25')?_0x087f('0x26'):_0x3f558b[_0x087f('0x21')];_0x4ef97a[_0x4317c5]-=_0x3f558b[_0x087f('0x24')];if(_0x4ef97a[_0x4317c5]<0x0)_0x4ef97a[_0x4317c5]=0x0;});_0x3d538a(_0x4ef97a);return;});})[_0x087f('0xd')](function(_0x39edb4){_0x4fc424(_0x39edb4);});});}function checkUserLimits(_0x4a162d){return new BPromise(function(_0x496c00,_0x465a7e){getLimits()[_0x087f('0xc')](function(_0x5626df){var _0x29b27f=_['pick'](_[_0x087f('0x2b')](_0x4a162d,_0x087f('0x21')),[_0x087f('0x25'),_0x087f('0x26'),'telephone']);var _0x133ec8=(_0x29b27f['admin']||0x0)+(_0x29b27f['user']||0x0);var _0x4fb8ba=_0x29b27f[_0x087f('0x27')]||0x0;if(_0x133ec8>_0x5626df[_0x087f('0x26')])return _0x465a7e(_0x087f('0x2c'));if(_0x4fb8ba>_0x5626df[_0x087f('0x27')])return _0x465a7e('License\x20limit\x20reached\x20for\x20telephones');return _0x496c00();})[_0x087f('0xd')](function(_0x18c34b){_0x465a7e(_0x18c34b);});});}module[_0x087f('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf086=['admin','telephone','telephones','forEach','count','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','col'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xf086,0x91));var _0x6f08=function(_0x5bcfcb,_0x59d1ab){_0x5bcfcb=_0x5bcfcb-0x0;var _0x135d9d=_0xf086[_0x5bcfcb];return _0x135d9d;};'use strict';var util=require(_0x6f08('0x0'));var _=require(_0x6f08('0x1'));var moment=require('moment');var BPromise=require(_0x6f08('0x2'));var hardware=require(_0x6f08('0x3'));var encryptor=require(_0x6f08('0x4'));var db=require(_0x6f08('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6f08('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6f08('0x7'),'machineUuid':hardware[_0x6f08('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6f08('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x6f08('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xfd210b){return new BPromise(function(_0x5937a2,_0x3a9707){return db[_0x6f08('0x9')]['find'](_['defaults'](_0xfd210b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x53a94f){return checkLicense(_0x53a94f,null);})[_0x6f08('0xa')](function(_0x5ab2e3){_0x5937a2(_0x5ab2e3);return;})[_0x6f08('0xb')](function(_0x4ba45c){_0x3a9707(_0x4ba45c);});});}function checkLicense(_0x1c9488,_0x543c88){if(!_0x1c9488){demoLicense[_0x6f08('0xc')]=_0x1c9488[_0x6f08('0xd')];return demoLicense;}try{var _0x1127c7=_0x543c88||_0x1c9488[_0x6f08('0xe')];if(_[_0x6f08('0xf')](_0x1127c7)){throw new Error(_0x6f08('0x10'));}var _0x4b9f76=_0x1c9488[_0x6f08('0xd')];var _0x52b9cb=_0x1c9488[_0x6f08('0x11')];var _0x40d959=_0x4b9f76['split']('-')[0x4];var _0x398abc=_0x4b9f76['split']('-')[0x0];var _0x109e37=encryptor[_0x6f08('0x12')](_0x1127c7,util[_0x6f08('0x13')](_0x6f08('0x14'),_0x40d959,_0x4b9f76,_0x398abc));var _0x401b81=JSON[_0x6f08('0x15')](_0x109e37);_0x401b81[_0x6f08('0x16')]=![];_0x401b81[_0x6f08('0xc')]=_0x4b9f76;_0x401b81['machineUuid']=hardware[_0x6f08('0x8')]();if(_0x52b9cb){var _0x24de18=encryptor[_0x6f08('0x12')](_0x52b9cb);_0x401b81[_0x6f08('0x17')]=_0x24de18;_0x401b81[_0x6f08('0x18')]=moment(_0x24de18)['add'](0x7,'days')[_0x6f08('0x13')]();_0x401b81[_0x6f08('0x19')]=_0x401b81[_0x6f08('0xc')]!=_0x401b81[_0x6f08('0x1a')]?_0x6f08('0x1b'):_0x6f08('0x1c');}return _0x401b81;}catch(_0x27d367){breakingLicense[_0x6f08('0xc')]=_0x1c9488[_0x6f08('0xd')];breakingLicense[_0x6f08('0x1d')]=_0x27d367[_0x6f08('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x23196c,_0x52a79a){getLicense()['then'](function(_0x17a6a5){return db[_0x6f08('0x1e')][_0x6f08('0x1f')]({'attributes':[_0x6f08('0x20'),[db[_0x6f08('0x21')]['fn']('COUNT',db[_0x6f08('0x21')][_0x6f08('0x22')](_0x6f08('0x20'))),'count']],'group':'role','where':{'role':{'$or':[_0x6f08('0x23'),'user',_0x6f08('0x24')]}},'raw':!![]})['then'](function(_0x5a031a){var _0x2d772a={'user':_0x17a6a5['users']||0x0,'telephone':_0x17a6a5[_0x6f08('0x25')]||0x0};_0x5a031a[_0x6f08('0x26')](function(_0x4eb690){var _0xb7ecb=_0x4eb690[_0x6f08('0x20')]===_0x6f08('0x23')?'user':_0x4eb690[_0x6f08('0x20')];_0x2d772a[_0xb7ecb]-=_0x4eb690[_0x6f08('0x27')];if(_0x2d772a[_0xb7ecb]<0x0)_0x2d772a[_0xb7ecb]=0x0;});_0x23196c(_0x2d772a);return;});})[_0x6f08('0xb')](function(_0x48f818){_0x52a79a(_0x48f818);});});}function checkUserLimits(_0x32bf8f){return new BPromise(function(_0x28bd24,_0x20c726){getLimits()['then'](function(_0x459988){var _0x1adfe0=_[_0x6f08('0x28')](_[_0x6f08('0x29')](_0x32bf8f,'role'),[_0x6f08('0x23'),_0x6f08('0x2a'),_0x6f08('0x24')]);var _0x4b5417=(_0x1adfe0['admin']||0x0)+(_0x1adfe0['user']||0x0);var _0x71e431=_0x1adfe0[_0x6f08('0x24')]||0x0;if(_0x4b5417>_0x459988[_0x6f08('0x2a')])return _0x20c726(_0x6f08('0x2b'));if(_0x71e431>_0x459988[_0x6f08('0x24')])return _0x20c726('License\x20limit\x20reached\x20for\x20telephones');return _0x28bd24();})['catch'](function(_0x1d918d){_0x20c726(_0x1d918d);});});}module[_0x6f08('0x2c')]={'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 1c79db6..828e0be 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 _0x4325=['app-id','secret','exports','http://localhost:9000'];(function(_0x39bc06,_0x18d7ff){var _0x131143=function(_0x254f7f){while(--_0x254f7f){_0x39bc06['push'](_0x39bc06['shift']());}};_0x131143(++_0x18d7ff);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';module[_0x5432('0x0')]={'DOMAIN':_0x5432('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x5432('0x2'),'GOOGLE_SECRET':_0x5432('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xef0f=['exports','myappanuglar-secret','app-id','secret'];(function(_0x535f1b,_0x33f371){var _0x5a307b=function(_0x57cc08){while(--_0x57cc08){_0x535f1b['push'](_0x535f1b['shift']());}};_0x5a307b(++_0x33f371);}(_0xef0f,0x168));var _0xfef0=function(_0x1d13fd,_0x360f86){_0x1d13fd=_0x1d13fd-0x0;var _0x446418=_0xef0f[_0x1d13fd];return _0x446418;};'use strict';module[_0xfef0('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xfef0('0x1'),'GOOGLE_ID':_0xfef0('0x2'),'GOOGLE_SECRET':_0xfef0('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 927d03d..88625fd 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2620=['../utils/loggers','fileLogger','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2620,0xbd));var _0x0262=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x2620[_0x30ae5e];return _0x1f2e93;};'use strict';var fileLogger=require(_0x0262('0x0'))[_0x0262('0x1')];module[_0x0262('0x2')]=fileLogger; \ No newline at end of file +var _0x3395=['../utils/loggers','fileLogger','exports'];(function(_0x68105,_0x36c4ef){var _0x412d1a=function(_0x51bbd9){while(--_0x51bbd9){_0x68105['push'](_0x68105['shift']());}};_0x412d1a(++_0x36c4ef);}(_0x3395,0x7e));var _0x5339=function(_0x5e6338,_0x4c8b92){_0x5e6338=_0x5e6338-0x0;var _0x12556a=_0x3395[_0x5e6338];return _0x12556a;};'use strict';var fileLogger=require(_0x5339('0x0'))[_0x5339('0x1')];module[_0x5339('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 25dd271..7f19d7c 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 _0x6cf1=['../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','root','legacy-libs','../../services/express/index.js','ami','agi'];(function(_0x221e61,_0x53a7ef){var _0x9e0796=function(_0x6f24c7){while(--_0x6f24c7){_0x221e61['push'](_0x221e61['shift']());}};_0x9e0796(++_0x53a7ef);}(_0x6cf1,0x16f));var _0x16cf=function(_0xdb8b43,_0x534327){_0xdb8b43=_0xdb8b43-0x0;var _0x18e3b6=_0x6cf1[_0xdb8b43];return _0x18e3b6;};'use strict';var path=require(_0x16cf('0x0'));var cfg=require(_0x16cf('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x16cf('0x2')](cfg[_0x16cf('0x3')],_0x16cf('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x16cf('0x2')](__dirname,_0x16cf('0x5')),'env':env},{'name':_0x16cf('0x6'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x16cf('0x7'),'script':path[_0x16cf('0x2')](__dirname,_0x16cf('0x8')),'env':env},{'name':_0x16cf('0x9'),'script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x16cf('0xa'),'script':path['join'](__dirname,_0x16cf('0xb')),'env':env},{'name':_0x16cf('0xc'),'script':path[_0x16cf('0x2')](__dirname,_0x16cf('0xd')),'env':env}]};module[_0x16cf('0xe')]=pm2config; \ No newline at end of file +var _0xca25=['path','../../config/environment','resolve','root','legacy-libs','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','email','routing','xdr','../../services/xdr/index.js','exports'];(function(_0x321825,_0x8f3c91){var _0x907966=function(_0x23e4a0){while(--_0x23e4a0){_0x321825['push'](_0x321825['shift']());}};_0x907966(++_0x8f3c91);}(_0xca25,0x170));var _0x5ca2=function(_0x40c98f,_0x538320){_0x40c98f=_0x40c98f-0x0;var _0x2380b5=_0xca25[_0x40c98f];return _0x2380b5;};'use strict';var path=require(_0x5ca2('0x0'));var cfg=require(_0x5ca2('0x1'));var env={'NODE_PATH':path[_0x5ca2('0x2')](path['join'](cfg[_0x5ca2('0x3')],_0x5ca2('0x4')))};var pm2config={'apps':[{'name':_0x5ca2('0x5'),'script':path[_0x5ca2('0x6')](__dirname,_0x5ca2('0x7')),'env':env},{'name':_0x5ca2('0x8'),'script':path[_0x5ca2('0x6')](__dirname,_0x5ca2('0x9')),'env':env},{'name':_0x5ca2('0xa'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x5ca2('0xb'),'script':path[_0x5ca2('0x6')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x5ca2('0xc'),'script':path[_0x5ca2('0x6')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x5ca2('0xd'),'script':path[_0x5ca2('0x6')](__dirname,_0x5ca2('0xe')),'env':env}]};module[_0x5ca2('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 061fbda..e54adf2 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 _0x045f=['saved','bluebird','./config','connected','start','then','stop','disconnect','restart','list','describe','delete','dump'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0x045f,0x1e2));var _0xf045=function(_0x41b4df,_0x15b067){_0x41b4df=_0x41b4df-0x0;var _0x55d4dc=_0x045f[_0x41b4df];return _0x55d4dc;};'use strict';var pm2=require('pm2');var BPromise=require(_0xf045('0x0'));var config=require(_0xf045('0x1'));function connect(){return new BPromise(function(_0x3a1662,_0x40e319){return pm2['connect'](function(_0x135b02){if(_0x135b02){return _0x40e319(_0x135b02);}return _0x3a1662(_0xf045('0x2'));});});};exports[_0xf045('0x3')]=function(_0x4a15d4){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x3b9aa6,_0x1eee1c){return pm2[_0xf045('0x3')](_0x4a15d4,function(_0xea8494,_0x434175){if(_0xea8494){return _0x1eee1c(_0xea8494);}pm2['disconnect']();return _0x3b9aa6(_0x434175);});});});};exports[_0xf045('0x5')]=function(_0x11958d){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x31b6cf,_0x33f96e){return pm2[_0xf045('0x5')](_0x11958d,function(_0x4ba97d,_0x2f399b){if(_0x4ba97d){return _0x33f96e(_0x4ba97d);}pm2[_0xf045('0x6')]();return _0x31b6cf(_0x2f399b);});});});};exports[_0xf045('0x7')]=function(_0x156113){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x13ff12,_0x3d38fd){return pm2['restart'](_0x156113,function(_0x3602ed,_0x5f1dce){if(_0x3602ed){return _0x3d38fd(_0x3602ed);}pm2['disconnect']();return _0x13ff12(_0x5f1dce);});});});};exports[_0xf045('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1ecfdc,_0x299415){return pm2[_0xf045('0x8')](function(_0x22c8a6,_0x4e2bda){if(_0x22c8a6){return _0x299415(_0x22c8a6);}pm2[_0xf045('0x6')]();return _0x1ecfdc(_0x4e2bda);});});});};exports[_0xf045('0x9')]=function(_0x13387d){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x44c3a2,_0x425251){return pm2[_0xf045('0x9')](_0x13387d,function(_0x503828,_0x14d11d){if(_0x503828){return _0x425251(_0x503828);}pm2['disconnect']();return _0x44c3a2(_0x14d11d);});});});};exports[_0xf045('0xa')]=function(_0x322793){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0xaa4a45,_0xfdeba5){return pm2['delete'](_0x322793,function(_0x29672b,_0x3c4d65){if(_0x29672b){return _0xfdeba5(_0x29672b);}pm2['disconnect']();return _0xaa4a45(_0x3c4d65);});});});};exports[_0xf045('0xb')]=function(){return connect()[_0xf045('0x4')](function(){return new BPromise(function(_0x25a7a1,_0x80355c){return pm2['dump'](function(_0x2d0b40){if(_0x2d0b40){return _0x80355c(_0x2d0b40);}return _0x25a7a1(_0xf045('0xc'));});});});}; \ No newline at end of file +var _0x6a18=['bluebird','./config','connect','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0xadb904,_0x969d4d){var _0x5d5877=function(_0x5d66e1){while(--_0x5d66e1){_0xadb904['push'](_0xadb904['shift']());}};_0x5d5877(++_0x969d4d);}(_0x6a18,0x111));var _0x86a1=function(_0x2c8310,_0xca370b){_0x2c8310=_0x2c8310-0x0;var _0x3d5238=_0x6a18[_0x2c8310];return _0x3d5238;};'use strict';var pm2=require('pm2');var BPromise=require(_0x86a1('0x0'));var config=require(_0x86a1('0x1'));function connect(){return new BPromise(function(_0x29dbd9,_0x566943){return pm2[_0x86a1('0x2')](function(_0x385129){if(_0x385129){return _0x566943(_0x385129);}return _0x29dbd9('connected');});});};exports[_0x86a1('0x3')]=function(_0x132b9f){return connect()[_0x86a1('0x4')](function(){return new BPromise(function(_0x26987a,_0x29fb85){return pm2[_0x86a1('0x3')](_0x132b9f,function(_0x1711fa,_0x5d0094){if(_0x1711fa){return _0x29fb85(_0x1711fa);}pm2[_0x86a1('0x5')]();return _0x26987a(_0x5d0094);});});});};exports[_0x86a1('0x6')]=function(_0x318275){return connect()['then'](function(){return new BPromise(function(_0xdb55d1,_0x52cd37){return pm2[_0x86a1('0x6')](_0x318275,function(_0x143ad4,_0x32f8e3){if(_0x143ad4){return _0x52cd37(_0x143ad4);}pm2['disconnect']();return _0xdb55d1(_0x32f8e3);});});});};exports['restart']=function(_0x37a2b2){return connect()[_0x86a1('0x4')](function(){return new BPromise(function(_0x566679,_0x338b90){return pm2[_0x86a1('0x7')](_0x37a2b2,function(_0x1fec16,_0x57c692){if(_0x1fec16){return _0x338b90(_0x1fec16);}pm2['disconnect']();return _0x566679(_0x57c692);});});});};exports[_0x86a1('0x8')]=function(){return connect()[_0x86a1('0x4')](function(){return new BPromise(function(_0x53ac76,_0x1ccfc2){return pm2[_0x86a1('0x8')](function(_0x23db8b,_0x112f8d){if(_0x23db8b){return _0x1ccfc2(_0x23db8b);}pm2['disconnect']();return _0x53ac76(_0x112f8d);});});});};exports['describe']=function(_0x3f213d){return connect()[_0x86a1('0x4')](function(){return new BPromise(function(_0x291446,_0x43a731){return pm2[_0x86a1('0x9')](_0x3f213d,function(_0x5a35f8,_0x19d74d){if(_0x5a35f8){return _0x43a731(_0x5a35f8);}pm2['disconnect']();return _0x291446(_0x19d74d);});});});};exports[_0x86a1('0xa')]=function(_0x2f87a6){return connect()[_0x86a1('0x4')](function(){return new BPromise(function(_0x38a871,_0x3e5830){return pm2['delete'](_0x2f87a6,function(_0x4d06af,_0x89d8b1){if(_0x4d06af){return _0x3e5830(_0x4d06af);}pm2[_0x86a1('0x5')]();return _0x38a871(_0x89d8b1);});});});};exports[_0x86a1('0xb')]=function(){return connect()[_0x86a1('0x4')](function(){return new BPromise(function(_0x418bec,_0x54d403){return pm2[_0x86a1('0xb')](function(_0x2d882e){if(_0x2d882e){return _0x54d403(_0x2d882e);}return _0x418bec(_0x86a1('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 22c0d63..d89527f 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 _0x9572=['[CHAT]\x20Sending\x20updates\x20for\x20interactions:','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x9572,0x165));var _0x2957=function(_0x3a7a01,_0x378ccb){_0x3a7a01=_0x3a7a01-0x0;var _0x5a8e20=_0x9572[_0x3a7a01];return _0x5a8e20;};'use strict';var _=require('lodash');var moment=require(_0x2957('0x0'));var Redis=require(_0x2957('0x1'));var util=require('util');var config=require(_0x2957('0x2'));var db=require(_0x2957('0x3'))['db'];var logger=require(_0x2957('0x4'))(_0x2957('0x5'));config[_0x2957('0x6')]=_[_0x2957('0x7')](config[_0x2957('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x2957('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x3fd285=0x0;var _0x4c8587=[];return db[_0x2957('0x9')][_0x2957('0xa')]({'raw':!![],'attributes':['id',_0x2957('0xb')],'where':{'id':0x1}})[_0x2957('0xc')](function(_0x93f86e){_0x3fd285=_0x93f86e['chatTimeout'];if(_0x3fd285){return db[_0x2957('0xd')][_0x2957('0xe')]({'raw':!![],'attributes':['id',_0x2957('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2957('0x10')](_0x93f86e[_0x2957('0xb')],_0x2957('0x11'))}}});}else{return[];}})['then'](function(_0x524954){if(_0x524954&&_0x524954[_0x2957('0x12')]){_0x4c8587=_[_0x2957('0x13')](_0x524954||[],'id');logger['info'](_0x2957('0x14'),_0x4c8587[_0x2957('0x15')]());return db[_0x2957('0xd')]['update']({'closeReason':_0x2957('0x16'),'disposition':_0x2957('0x17'),'closed':!![],'closedAt':moment()[_0x2957('0x18')](_0x2957('0x19'))},{'where':{'id':_0x4c8587}});}})['then'](function(){if(_0x4c8587&&_0x4c8587[_0x2957('0x12')]){logger[_0x2957('0x1a')](_0x2957('0x1b'),_0x4c8587[_0x2957('0x15')]());for(var _0x2d06fd=0x0;_0x2d06fd<_0x4c8587[_0x2957('0x12')];_0x2d06fd++){io['emit']('chatInteraction:update',{'id':_0x4c8587[_0x2d06fd],'closed':!![]});}}})['catch'](function(_0x2daaaa){logger[_0x2957('0x1c')](_0x2957('0x1d'),_0x2daaaa?util[_0x2957('0x1e')](_0x2daaaa,{'showHidden':![],'depth':null}):'');});}exports[_0x2957('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xea6a=['findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0x13e455,_0x184a0d){var _0x38061e=function(_0x23b76e){while(--_0x23b76e){_0x13e455['push'](_0x13e455['shift']());}};_0x38061e(++_0x184a0d);}(_0xea6a,0x1bf));var _0xaea6=function(_0x4b98bd,_0x220af8){_0x4b98bd=_0x4b98bd-0x0;var _0x1d0d5c=_0xea6a[_0x4b98bd];return _0x1d0d5c;};'use strict';var _=require(_0xaea6('0x0'));var moment=require(_0xaea6('0x1'));var Redis=require('ioredis');var util=require(_0xaea6('0x2'));var config=require(_0xaea6('0x3'));var db=require(_0xaea6('0x4'))['db'];var logger=require(_0xaea6('0x5'))(_0xaea6('0x6'));config[_0xaea6('0x7')]=_[_0xaea6('0x8')](config[_0xaea6('0x7')],{'host':_0xaea6('0x9'),'port':0x18eb});var io=require(_0xaea6('0xa'))(new Redis(config[_0xaea6('0x7')]));function closeInteractions(){var _0x389f43=0x0;var _0x24da3e=[];return db[_0xaea6('0xb')][_0xaea6('0xc')]({'raw':!![],'attributes':['id',_0xaea6('0xd')],'where':{'id':0x1}})[_0xaea6('0xe')](function(_0x58e898){_0x389f43=_0x58e898[_0xaea6('0xd')];if(_0x389f43){return db['ChatInteraction'][_0xaea6('0xf')]({'raw':!![],'attributes':['id',_0xaea6('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xaea6('0x11')](_0x58e898['chatTimeout'],_0xaea6('0x12'))}}});}else{return[];}})[_0xaea6('0xe')](function(_0x4c49d2){if(_0x4c49d2&&_0x4c49d2[_0xaea6('0x13')]){_0x24da3e=_[_0xaea6('0x14')](_0x4c49d2||[],'id');logger[_0xaea6('0x15')](_0xaea6('0x16'),_0x24da3e[_0xaea6('0x17')]());return db['ChatInteraction']['update']({'closeReason':_0xaea6('0x18'),'disposition':_0xaea6('0x19'),'closed':!![],'closedAt':moment()['format'](_0xaea6('0x1a'))},{'where':{'id':_0x24da3e}});}})[_0xaea6('0xe')](function(){if(_0x24da3e&&_0x24da3e[_0xaea6('0x13')]){logger['info'](_0xaea6('0x1b'),_0x24da3e[_0xaea6('0x17')]());for(var _0x5b12b0=0x0;_0x5b12b0<_0x24da3e[_0xaea6('0x13')];_0x5b12b0++){io['emit'](_0xaea6('0x1c'),{'id':_0x24da3e[_0x5b12b0],'closed':!![]});}}})[_0xaea6('0x1d')](function(_0x2714d3){logger[_0xaea6('0x1e')](_0xaea6('0x1f'),_0x2714d3?util['inspect'](_0x2714d3,{'showHidden':![],'depth':null}):'');});}exports[_0xaea6('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 2d141cf..967f3db 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 _0x4837=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x3a0802,_0xf8fa73){var _0x4c847f=function(_0x5cacec){while(--_0x5cacec){_0x3a0802['push'](_0x3a0802['shift']());}};_0x4c847f(++_0xf8fa73);}(_0x4837,0x1aa));var _0x7483=function(_0x867e3,_0x1ace47){_0x867e3=_0x867e3-0x0;var _0x359cd4=_0x4837[_0x867e3];return _0x359cd4;};'use strict';function start(){var _0x247851=require(_0x7483('0x0'));return _0x247851[_0x7483('0x1')]();}module[_0x7483('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xce8b=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x345422,_0x34cb76){var _0x516b79=function(_0xd2de76){while(--_0xd2de76){_0x345422['push'](_0x345422['shift']());}};_0x516b79(++_0x34cb76);}(_0xce8b,0x173));var _0xbce8=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xce8b[_0x1f27df];return _0x286ee2;};'use strict';function start(){var _0x1f6b9e=require(_0xbce8('0x0'));return _0x1f6b9e[_0xbce8('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index e683c97..5d0ea0c 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 _0x4cfe=['lodash','moment','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','basename','savename','extname','zip','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','CloudProvider','keys','jobs','map','toString','keyBy','intersection','difference','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','add','add\x20cron','stop','deleteJob','stop\x20cron','length','endAt','update','run','start','util','path'];(function(_0x119177,_0xad8a05){var _0x1fdfb4=function(_0x2f1a8d){while(--_0x2f1a8d){_0x119177['push'](_0x119177['shift']());}};_0x1fdfb4(++_0xad8a05);}(_0x4cfe,0x156));var _0xe4cf=function(_0x204152,_0x302816){_0x204152=_0x204152-0x0;var _0x3f67db=_0x4cfe[_0x204152];return _0x3f67db;};'use strict';var fs=require('fs');var util=require(_0xe4cf('0x0'));var path=require(_0xe4cf('0x1'));var _=require(_0xe4cf('0x2'));var moment=require(_0xe4cf('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xe4cf('0x4'));var logger=require(_0xe4cf('0x5'))('schedule');var db=require(_0xe4cf('0x6'))['db'];var analyticCustomReportController=require(_0xe4cf('0x7'));var analyticDefaultReportController=require(_0xe4cf('0x8'));var client=jayson[_0xe4cf('0x9')][_0xe4cf('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2f5d5e,_0xb1a92d){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x2f5d5e[_0xe4cf('0xb')]);var _0xac7d74=!![];var _0x4b2fc1=_0x2f5d5e[_0xe4cf('0xc')][_0xe4cf('0xd')]();var _0xf957b6={'account':_0x4b2fc1,'message':{'from':util[_0xe4cf('0xe')](_0xe4cf('0xf'),_0x2f5d5e[_0xe4cf('0xc')]['name'],_0x2f5d5e[_0xe4cf('0xc')]['email']||_0x2f5d5e[_0xe4cf('0xc')]['Smtp']['user']),'to':_0x2f5d5e[_0xe4cf('0xb')],'cc':_0x2f5d5e['cc'],'bcc':_0x2f5d5e['bcc'],'subject':util[_0xe4cf('0xe')](_0xe4cf('0x10'),_0xb1a92d[_0xe4cf('0x11')],_0x2f5d5e[_0xe4cf('0x12')],_0x2f5d5e[_0xe4cf('0x13')])}};var _0x3c77b1=path[_0xe4cf('0x14')](__dirname,_0xe4cf('0x15'));var _0x2f44b2=_0xb1a92d['savename'];var _0x2e7b2a=util[_0xe4cf('0xe')]('%s.%s',path[_0xe4cf('0x16')](_0xb1a92d[_0xe4cf('0x17')],path[_0xe4cf('0x18')](_0xb1a92d[_0xe4cf('0x17')])),_0xe4cf('0x19'));var _0x43ee3b=path[_0xe4cf('0x14')](_0x3c77b1,_0x2f44b2);var _0x10633c=path[_0xe4cf('0x14')](_0x3c77b1,_0x2e7b2a);if(fs['existsSync'](_0x43ee3b)){_0xb1a92d[_0xe4cf('0x1a')]='Sent';_0xf957b6[_0xe4cf('0x1b')][_0xe4cf('0x1c')]=[{'filename':_0x2f44b2,'path':_0x43ee3b}];_0xf957b6[_0xe4cf('0x1b')][_0xe4cf('0x1d')]=util[_0xe4cf('0xe')](_0xe4cf('0x1e'),JSON[_0xe4cf('0x1f')](_0xb1a92d,null,0x2));}else if(fs[_0xe4cf('0x20')](_0x10633c)){_0xb1a92d['status']=_0xe4cf('0x21');_0xf957b6[_0xe4cf('0x1b')][_0xe4cf('0x1c')]=[{'filename':_0x2e7b2a,'path':_0x10633c}];}else{_0xf957b6[_0xe4cf('0x1b')][_0xe4cf('0x1d')]=_0xe4cf('0x22');if(!_0x2f5d5e[_0xe4cf('0x23')]){_0xac7d74=![];logger[_0xe4cf('0x24')](_0xe4cf('0x25'));}}if(_0xac7d74){return client[_0xe4cf('0x26')](_0xe4cf('0x27'),_0xf957b6)[_0xe4cf('0x28')](function(_0x2bc5b5){if(_0x2bc5b5[_0xe4cf('0x29')]){return logger[_0xe4cf('0x29')](_0xe4cf('0x2a'),JSON['stringify'](_0x2bc5b5));}return logger['info'](_0xe4cf('0x2b'));})[_0xe4cf('0x2c')](function(_0x18c1b8){return logger[_0xe4cf('0x29')](_0xe4cf('0x2a'),JSON[_0xe4cf('0x1f')](_0x18c1b8));});}};}function handleError(){return function(_0x58aaf2){return logger['error'](JSON[_0xe4cf('0x1f')](_0x58aaf2));};}function handleResult(_0x3a9ad3){return function(_0x2c6876){logger['info'](_0xe4cf('0x2d'),JSON[_0xe4cf('0x1f')](_0x2c6876));if(_0x3a9ad3[_0xe4cf('0xc')]&&_0x3a9ad3[_0xe4cf('0xc')][_0xe4cf('0x2e')]&&!_[_0xe4cf('0x2f')](_0x3a9ad3[_0xe4cf('0xb')])){setTimeout(handleSendEmail(_0x3a9ad3,_0x2c6876),0x3c*0x3e8);}};}function handleJob(_0x27ca06){return function(){try{if(_['isNil'](_0x27ca06[_0xe4cf('0x12')])){return logger[_0xe4cf('0x24')](_0xe4cf('0x30'));}if(_[_0xe4cf('0x2f')](_0x27ca06[_0xe4cf('0x13')])){return logger[_0xe4cf('0x24')](_0xe4cf('0x31'));}var _0x4fc72d={'startDate':moment()[_0xe4cf('0x32')](_0x27ca06[_0xe4cf('0x12')],_0x27ca06[_0xe4cf('0x13')])[_0xe4cf('0xe')](_0xe4cf('0x33')),'endDate':moment()[_0xe4cf('0xe')](_0xe4cf('0x33')),'type':'scheduled','output':_0x27ca06[_0xe4cf('0x34')],'name':_0x27ca06['name']};if(!_[_0xe4cf('0x2f')](_0x27ca06[_0xe4cf('0x35')])){logger[_0xe4cf('0x24')](_0xe4cf('0x36'),_0x27ca06[_0xe4cf('0x35')]);return analyticDefaultReportController[_0xe4cf('0x37')]({'id':_0x27ca06[_0xe4cf('0x35')]},_0x4fc72d)[_0xe4cf('0x28')](handleResult(_0x27ca06))['catch'](handleError());}if(!_['isNil'](_0x27ca06[_0xe4cf('0x38')])){logger[_0xe4cf('0x24')](_0xe4cf('0x39'),_0x27ca06[_0xe4cf('0x38')]);return analyticCustomReportController[_0xe4cf('0x37')]({'id':_0x27ca06['CustomReportId']},_0x4fc72d)[_0xe4cf('0x28')](handleResult(_0x27ca06))[_0xe4cf('0x2c')](handleError());}}catch(_0x686ecd){logger[_0xe4cf('0x29')](JSON[_0xe4cf('0x1f')](_0x686ecd));}return logger[_0xe4cf('0x24')](_0xe4cf('0x3a'));};}function getJobs(_0x4a5c45){var _0x414894={};if(_0x4a5c45){_0x414894['id']=_0x4a5c45;}return db[_0xe4cf('0x3b')]['findAll']({'where':_0x414894,'include':[{'model':db[_0xe4cf('0xc')],'attributes':['id',_0xe4cf('0x11'),_0xe4cf('0xb')],'include':[{'model':db['MailServerOut'],'as':_0xe4cf('0x2e'),'include':[{'model':db[_0xe4cf('0x3c')],'as':_0xe4cf('0x3c')}]}]}]})[_0xe4cf('0x28')](function(_0x52bae6){var _0x57acf=_[_0xe4cf('0x3d')](manager[_0xe4cf('0x3e')]);var _0x2b1396=_[_0xe4cf('0x3f')](_0x52bae6,function(_0x224ea7){return _0x224ea7['id'][_0xe4cf('0x40')]();});var _0x21862d=_[_0xe4cf('0x41')](_0x52bae6,function(_0x377c61){return _0x377c61['id'][_0xe4cf('0x40')]();});var _0x2baa40=_0x4a5c45?_0x2b1396:_['difference'](_0x2b1396,_0x57acf);var _0x230416=_[_0xe4cf('0x42')](_0x2b1396,_0x57acf);var _0x192022=_[_0xe4cf('0x43')](_0x57acf,_0x2b1396);var _0x553e23;var _0x4d6824;for(_0x553e23=0x0;_0x553e23<_0x192022['length']&&!_0x4a5c45;_0x553e23+=0x1){_0x4d6824=_0x192022[_0x553e23][_0xe4cf('0x40')]();if(manager['exists'](_0x4d6824)){manager['stop'](_0x4d6824);manager['deleteJob'](_0x4d6824);logger[_0xe4cf('0x24')]('delete\x20cron',_0x4d6824);}}logger[_0xe4cf('0x24')](_0xe4cf('0x44'),JSON[_0xe4cf('0x1f')](_0x2baa40));for(_0x553e23=0x0;_0x553e23<_0x2baa40['length'];_0x553e23+=0x1){_0x4d6824=_0x2baa40[_0x553e23][_0xe4cf('0x40')]();logger[_0xe4cf('0x24')](_0xe4cf('0x45'),_0x4d6824);if(_0x4a5c45){logger[_0xe4cf('0x24')]('my\x20id',_0x4a5c45);logger[_0xe4cf('0x24')](JSON['stringify'](_0x21862d[_0x4d6824]));BPromise[_0xe4cf('0x46')]()[_0xe4cf('0x28')](handleJob(_0x21862d[_0x4d6824]));logger[_0xe4cf('0x24')](_0xe4cf('0x47'),_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824][_0xe4cf('0x48')]);}else if(_0x21862d[_0x4d6824]['cron']&&_0x21862d[_0x4d6824][_0xe4cf('0x49')]&&moment()[_0xe4cf('0x4a')](_0x21862d[_0x4d6824][_0xe4cf('0x4b')],_0x21862d[_0x4d6824]['endAt'])){manager[_0xe4cf('0x4c')](_0x4d6824,_0x21862d[_0x4d6824][_0xe4cf('0x48')],handleJob(_0x21862d[_0x4d6824]));manager['start'](_0x4d6824);logger[_0xe4cf('0x24')](_0xe4cf('0x4d'),_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824][_0xe4cf('0x48')]);}else if(manager['exists'](_0x4d6824)){manager[_0xe4cf('0x4e')](_0x4d6824);manager[_0xe4cf('0x4f')](_0x4d6824);logger[_0xe4cf('0x24')](_0xe4cf('0x50'),_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824][_0xe4cf('0x48')]);}}for(_0x553e23=0x0,_0x4d6824;_0x553e23<_0x230416[_0xe4cf('0x51')]&&!_0x4a5c45;_0x553e23+=0x1){_0x4d6824=_0x230416[_0x553e23][_0xe4cf('0x40')]();if(manager['exists'](_0x4d6824)){if(_0x21862d[_0x4d6824][_0xe4cf('0x48')]&&_0x21862d[_0x4d6824][_0xe4cf('0x49')]&&moment()[_0xe4cf('0x4a')](_0x21862d[_0x4d6824][_0xe4cf('0x4b')],_0x21862d[_0x4d6824][_0xe4cf('0x52')])){manager[_0xe4cf('0x53')](_0x4d6824,_0x21862d[_0x4d6824][_0xe4cf('0x48')],handleJob(_0x21862d[_0x4d6824]));logger[_0xe4cf('0x24')]('update\x20cron',_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824]['cron']);}else{manager[_0xe4cf('0x4e')](_0x4d6824);manager[_0xe4cf('0x4f')](_0x4d6824);logger[_0xe4cf('0x24')]('stop\x20cron',_0x21862d[_0x4d6824][_0xe4cf('0x11')],_0x21862d[_0x4d6824][_0xe4cf('0x48')]);}}}})[_0xe4cf('0x2c')](function(_0x5a89cb){logger['error'](JSON[_0xe4cf('0x1f')](_0x5a89cb));});}exports[_0xe4cf('0x54')]=function(_0x179ebc){return getJobs(_0x179ebc);};exports[_0xe4cf('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4606=['info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','email\x20sent','data','Smtp','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','isBetween','endAt','add','start','add\x20cron','stop\x20cron','active','update','update\x20cron','deleteJob','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4606,0x1b0));var _0x6460=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4606[_0x3ab51d];return _0x29a04e;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x6460('0x0'));var _=require(_0x6460('0x1'));var moment=require(_0x6460('0x2'));var CronJobManager=require(_0x6460('0x3'));var jayson=require(_0x6460('0x4'));var BPromise=require(_0x6460('0x5'));var logger=require(_0x6460('0x6'))(_0x6460('0x7'));var db=require(_0x6460('0x8'))['db'];var analyticCustomReportController=require(_0x6460('0x9'));var analyticDefaultReportController=require(_0x6460('0xa'));var client=jayson[_0x6460('0xb')][_0x6460('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4f6002,_0x43e443){return function(){logger[_0x6460('0xd')](_0x6460('0xe'),_0x4f6002[_0x6460('0xf')]);var _0x43d7ae=!![];var _0x596287=_0x4f6002[_0x6460('0x10')][_0x6460('0x11')]();var _0x4825e2={'account':_0x596287,'message':{'from':util[_0x6460('0x12')](_0x6460('0x13'),_0x4f6002[_0x6460('0x10')]['name'],_0x4f6002[_0x6460('0x10')]['email']||_0x4f6002['MailAccount']['Smtp']['user']),'to':_0x4f6002[_0x6460('0xf')],'cc':_0x4f6002['cc'],'bcc':_0x4f6002[_0x6460('0x14')],'subject':util[_0x6460('0x12')](_0x6460('0x15'),_0x43e443[_0x6460('0x16')],_0x4f6002[_0x6460('0x17')],_0x4f6002[_0x6460('0x18')])}};var _0x7b9a64=path['join'](__dirname,'../../files/reports');var _0x20ec14=_0x43e443[_0x6460('0x19')];var _0x272a1a=util[_0x6460('0x12')](_0x6460('0x1a'),path[_0x6460('0x1b')](_0x43e443[_0x6460('0x19')],path[_0x6460('0x1c')](_0x43e443['savename'])),_0x6460('0x1d'));var _0x3abb42=path[_0x6460('0x1e')](_0x7b9a64,_0x20ec14);var _0x49549b=path[_0x6460('0x1e')](_0x7b9a64,_0x272a1a);if(fs[_0x6460('0x1f')](_0x3abb42)){_0x43e443[_0x6460('0x20')]=_0x6460('0x21');_0x4825e2[_0x6460('0x22')][_0x6460('0x23')]=[{'filename':_0x20ec14,'path':_0x3abb42}];_0x4825e2['message']['text']=util[_0x6460('0x12')](_0x6460('0x24'),JSON[_0x6460('0x25')](_0x43e443,null,0x2));}else if(fs['existsSync'](_0x49549b)){_0x43e443[_0x6460('0x20')]=_0x6460('0x21');_0x4825e2['message']['attachments']=[{'filename':_0x272a1a,'path':_0x49549b}];}else{_0x4825e2['message'][_0x6460('0x26')]=_0x6460('0x27');if(!_0x4f6002[_0x6460('0x28')]){_0x43d7ae=![];logger[_0x6460('0xd')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x43d7ae){return client[_0x6460('0x29')]('SendMail',_0x4825e2)[_0x6460('0x2a')](function(_0x3da4fb){if(_0x3da4fb[_0x6460('0x2b')]){return logger[_0x6460('0x2b')](_0x6460('0x2c'),JSON[_0x6460('0x25')](_0x3da4fb));}return logger['info'](_0x6460('0x2d'));})['catch'](function(_0x287407){return logger[_0x6460('0x2b')](_0x6460('0x2c'),JSON[_0x6460('0x25')](_0x287407));});}};}function handleError(){return function(_0x3e044f){return logger[_0x6460('0x2b')](JSON['stringify'](_0x3e044f));};}function handleResult(_0x340c2f){return function(_0x3c694c){logger[_0x6460('0xd')](_0x6460('0x2e'),JSON[_0x6460('0x25')](_0x3c694c));if(_0x340c2f['MailAccount']&&_0x340c2f['MailAccount'][_0x6460('0x2f')]&&!_[_0x6460('0x30')](_0x340c2f[_0x6460('0xf')])){setTimeout(handleSendEmail(_0x340c2f,_0x3c694c),0x3c*0x3e8);}};}function handleJob(_0x33a66e){return function(){try{if(_['isNil'](_0x33a66e[_0x6460('0x17')])){return logger[_0x6460('0xd')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x33a66e['subtractUnit'])){return logger[_0x6460('0xd')](_0x6460('0x31'));}var _0x3c34b5={'startDate':moment()['subtract'](_0x33a66e[_0x6460('0x17')],_0x33a66e['subtractUnit'])[_0x6460('0x12')](_0x6460('0x32')),'endDate':moment()['format'](_0x6460('0x32')),'type':_0x6460('0x33'),'output':_0x33a66e[_0x6460('0x34')],'name':_0x33a66e[_0x6460('0x16')]};if(!_[_0x6460('0x30')](_0x33a66e[_0x6460('0x35')])){logger[_0x6460('0xd')](_0x6460('0x36'),_0x33a66e['DefaultReportId']);return analyticDefaultReportController[_0x6460('0x37')]({'id':_0x33a66e[_0x6460('0x35')]},_0x3c34b5)[_0x6460('0x2a')](handleResult(_0x33a66e))[_0x6460('0x38')](handleError());}if(!_[_0x6460('0x30')](_0x33a66e[_0x6460('0x39')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x33a66e[_0x6460('0x39')]);return analyticCustomReportController['runReport']({'id':_0x33a66e[_0x6460('0x39')]},_0x3c34b5)['then'](handleResult(_0x33a66e))[_0x6460('0x38')](handleError());}}catch(_0xa7bac4){logger[_0x6460('0x2b')](JSON[_0x6460('0x25')](_0xa7bac4));}return logger[_0x6460('0xd')](_0x6460('0x3a'));};}function getJobs(_0x3e7522){var _0x34d58b={};if(_0x3e7522){_0x34d58b['id']=_0x3e7522;}return db[_0x6460('0x3b')][_0x6460('0x3c')]({'where':_0x34d58b,'include':[{'model':db[_0x6460('0x10')],'attributes':['id',_0x6460('0x16'),_0x6460('0xf')],'include':[{'model':db['MailServerOut'],'as':_0x6460('0x2f'),'include':[{'model':db[_0x6460('0x3d')],'as':'CloudProvider'}]}]}]})['then'](function(_0x5f4593){var _0x27201f=_[_0x6460('0x3e')](manager[_0x6460('0x3f')]);var _0x1d2895=_[_0x6460('0x40')](_0x5f4593,function(_0x426a55){return _0x426a55['id']['toString']();});var _0x12c74e=_[_0x6460('0x41')](_0x5f4593,function(_0x4034b9){return _0x4034b9['id'][_0x6460('0x42')]();});var _0x44584f=_0x3e7522?_0x1d2895:_[_0x6460('0x43')](_0x1d2895,_0x27201f);var _0xd6bc66=_[_0x6460('0x44')](_0x1d2895,_0x27201f);var _0x32a6ed=_[_0x6460('0x43')](_0x27201f,_0x1d2895);var _0x1a0576;var _0x5898cc;for(_0x1a0576=0x0;_0x1a0576<_0x32a6ed[_0x6460('0x45')]&&!_0x3e7522;_0x1a0576+=0x1){_0x5898cc=_0x32a6ed[_0x1a0576][_0x6460('0x42')]();if(manager[_0x6460('0x46')](_0x5898cc)){manager[_0x6460('0x47')](_0x5898cc);manager['deleteJob'](_0x5898cc);logger[_0x6460('0xd')](_0x6460('0x48'),_0x5898cc);}}logger['info']('toRun',JSON[_0x6460('0x25')](_0x44584f));for(_0x1a0576=0x0;_0x1a0576<_0x44584f[_0x6460('0x45')];_0x1a0576+=0x1){_0x5898cc=_0x44584f[_0x1a0576][_0x6460('0x42')]();logger[_0x6460('0xd')](_0x6460('0x49'),_0x5898cc);if(_0x3e7522){logger[_0x6460('0xd')](_0x6460('0x4a'),_0x3e7522);logger[_0x6460('0xd')](JSON[_0x6460('0x25')](_0x12c74e[_0x5898cc]));BPromise[_0x6460('0x4b')]()[_0x6460('0x2a')](handleJob(_0x12c74e[_0x5898cc]));logger[_0x6460('0xd')](_0x6460('0x4c'),_0x12c74e[_0x5898cc][_0x6460('0x16')],_0x12c74e[_0x5898cc][_0x6460('0x4d')]);}else if(_0x12c74e[_0x5898cc][_0x6460('0x4d')]&&_0x12c74e[_0x5898cc]['active']&&moment()[_0x6460('0x4e')](_0x12c74e[_0x5898cc]['startAt'],_0x12c74e[_0x5898cc][_0x6460('0x4f')])){manager[_0x6460('0x50')](_0x5898cc,_0x12c74e[_0x5898cc][_0x6460('0x4d')],handleJob(_0x12c74e[_0x5898cc]));manager[_0x6460('0x51')](_0x5898cc);logger['info'](_0x6460('0x52'),_0x12c74e[_0x5898cc]['name'],_0x12c74e[_0x5898cc][_0x6460('0x4d')]);}else if(manager[_0x6460('0x46')](_0x5898cc)){manager['stop'](_0x5898cc);manager['deleteJob'](_0x5898cc);logger[_0x6460('0xd')](_0x6460('0x53'),_0x12c74e[_0x5898cc][_0x6460('0x16')],_0x12c74e[_0x5898cc]['cron']);}}for(_0x1a0576=0x0,_0x5898cc;_0x1a0576<_0xd6bc66[_0x6460('0x45')]&&!_0x3e7522;_0x1a0576+=0x1){_0x5898cc=_0xd6bc66[_0x1a0576][_0x6460('0x42')]();if(manager[_0x6460('0x46')](_0x5898cc)){if(_0x12c74e[_0x5898cc][_0x6460('0x4d')]&&_0x12c74e[_0x5898cc][_0x6460('0x54')]&&moment()[_0x6460('0x4e')](_0x12c74e[_0x5898cc]['startAt'],_0x12c74e[_0x5898cc]['endAt'])){manager[_0x6460('0x55')](_0x5898cc,_0x12c74e[_0x5898cc]['cron'],handleJob(_0x12c74e[_0x5898cc]));logger[_0x6460('0xd')](_0x6460('0x56'),_0x12c74e[_0x5898cc]['name'],_0x12c74e[_0x5898cc][_0x6460('0x4d')]);}else{manager['stop'](_0x5898cc);manager[_0x6460('0x57')](_0x5898cc);logger[_0x6460('0xd')](_0x6460('0x53'),_0x12c74e[_0x5898cc][_0x6460('0x16')],_0x12c74e[_0x5898cc][_0x6460('0x4d')]);}}}})[_0x6460('0x38')](function(_0x470944){logger[_0x6460('0x2b')](JSON['stringify'](_0x470944));});}exports[_0x6460('0x58')]=function(_0x4296c5){return getJobs(_0x4296c5);};exports[_0x6460('0x51')]=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 7dfbf79..2653385 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 _0x99cd=['ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','bucket','CloudProvider','Cloud\x20Provider\x20not\x20configured','Sentiment','catch','name','SequelizeValidationError','error','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x99cd,0x1df));var _0xd99c=function(_0x18a32a,_0x438c51){_0x18a32a=_0x18a32a-0x0;var _0x1280cb=_0x99cd[_0x18a32a];return _0x1280cb;};var _=require(_0xd99c('0x0'));var AWS=require('aws-sdk');var rp=require(_0xd99c('0x1'));var util=require(_0xd99c('0x2'));var BPromise=require(_0xd99c('0x3'));var db=require(_0xd99c('0x4'))['db'];var logger=require(_0xd99c('0x5'))(_0xd99c('0x6'));function getTranscriptionJob(_0x21927c,_0x431503,_0x178a00,_0x3997a1){return new Promise(function(_0x5170e7,_0x87a727){var _0x4a56d5=new AWS[(_0xd99c('0x7'))]({'accessKeyId':_0x431503,'secretAccessKey':_0x21927c,'region':_0x178a00});_0x4a56d5['getTranscriptionJob']({'TranscriptionJobName':_0x3997a1},function(_0x53d8b2,_0x28ea88){if(_0x53d8b2){return _0x87a727(_0x53d8b2);}else{return _0x5170e7(_0x28ea88);}});});}function sentiment(_0x44fa1e,_0x2d5e7e,_0x2bcd16,_0x27e3cf,_0x25b064){return new Promise(function(_0x3e593b,_0x475cb9){var _0x4ca596=new AWS[(_0xd99c('0x8'))]({'accessKeyId':_0x2d5e7e,'secretAccessKey':_0x44fa1e,'region':_0x2bcd16});_0x4ca596[_0xd99c('0x9')]({'Text':_0x27e3cf,'LanguageCode':_0x25b064[_0xd99c('0xa')](0x0,0x2)},function(_0x284bf4,_0x470075){if(_0x284bf4){return _0x475cb9(_0x284bf4);}else{return _0x3e593b(_0x470075);}});});}function checkTranscribeJob(_0x557692,_0x46150e,_0x33a938){var _0x41042a;return new BPromise(function(_0x3f5d28,_0x25d241){logger['info'](util[_0xd99c('0xb')](_0xd99c('0xc'),_0x557692['id'],_0x557692[_0xd99c('0xd')]));return getTranscriptionJob(_0x33a938[_0xd99c('0xe')],_0x33a938[_0xd99c('0xf')],_0x46150e['transcribeRegion'],_0x557692[_0xd99c('0xd')])[_0xd99c('0x10')](function(_0x35b50f){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x12'),_0x557692['id'],_0x557692[_0xd99c('0xd')],_0x35b50f[_0xd99c('0x13')]['TranscriptionJobStatus']));if(!_0x557692['fileText']){switch(_0x35b50f[_0xd99c('0x13')][_0xd99c('0x14')]){case _0xd99c('0x15'):var _0x24948d={'transcribeStatus':_0x35b50f[_0xd99c('0x13')][_0xd99c('0x14')],'fileUri':_0x35b50f['TranscriptionJob']['Transcript'][_0xd99c('0x16')]};logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x17'),_0x557692['id']));return rp({'uri':_0x35b50f[_0xd99c('0x13')][_0xd99c('0x18')][_0xd99c('0x16')],'json':!![]})[_0xd99c('0x10')](function(_0x39c705){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x19'),_0x557692['id']));if(_0x39c705&&_0x39c705['results']&&_0x39c705[_0xd99c('0x1a')]['transcripts']&&_0x39c705['results'][_0xd99c('0x1b')][_0xd99c('0x1c')]){_0x24948d['fileText']='';for(var _0x4af932=0x0;_0x4af932<_0x39c705['results'][_0xd99c('0x1b')]['length'];_0x4af932++){_0x24948d[_0xd99c('0x1d')]+=_0x39c705[_0xd99c('0x1a')][_0xd99c('0x1b')][_0x4af932]['transcript']+'';}}return _0x557692[_0xd99c('0x1e')](_0x24948d);})['then'](function(){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x1f'),_0x557692['id']));if(!_0x557692['tempSentiment']){throw new db['Sequelize'][(_0xd99c('0x20'))](_0xd99c('0x21'));}if(!_0x46150e[_0xd99c('0x22')]||!_0x46150e[_0xd99c('0x23')]||!_0x46150e[_0xd99c('0x24')]||!_0x46150e[_0xd99c('0x25')]||!_0x46150e['bucket']){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x27'));}if(!_0x24948d['fileText']){throw new Error(_0xd99c('0x28'));}if(_0x46150e[_0xd99c('0x23')]===_0x33a938['id']){return _0x33a938;}else{return db['CloudProvider'][_0xd99c('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd99c('0x10')](function(_0x4c4405){if(!_0x4c4405){throw new db['Sequelize']['ValidationError'](_0xd99c('0x2a'));}if(!_0x4c4405[_0xd99c('0xe')]||!_0x4c4405['data2']){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x41042a=_0x4c4405;logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x2b'),_0x557692['id']));return sentiment(_0x41042a['data1'],_0x41042a[_0xd99c('0xf')],_0x46150e[_0xd99c('0x24')],_0x24948d[_0xd99c('0x1d')],_0x46150e[_0xd99c('0x25')]);})['then'](function(_0x44bf0e){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x2c'),_0x557692['id']));return _0x557692['update']({'sentiment':_0x44bf0e['Sentiment'],'sPositive':_0x44bf0e['SentimentScore'][_0xd99c('0x2d')],'sNegative':_0x44bf0e[_0xd99c('0x2e')][_0xd99c('0x2f')],'sMixed':_0x44bf0e[_0xd99c('0x2e')][_0xd99c('0x30')],'sNeutral':_0x44bf0e['SentimentScore'][_0xd99c('0x31')]});})['then'](function(){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x1f'),_0x557692['id']));_0x3f5d28();});case _0xd99c('0x32'):return _0x557692['update']({'transcribeStatus':_0xd99c('0x32'),'failureReason':_0x35b50f[_0xd99c('0x13')][_0xd99c('0x33')]})['then'](function(){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x1f'),_0x557692['id']));_0x3f5d28();});default:logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x34'),_0x557692['id']));break;}}else{return BPromise['resolve']()[_0xd99c('0x10')](function(){if(!_0x557692[_0xd99c('0x35')]){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x46150e[_0xd99c('0x22')]||!_0x46150e[_0xd99c('0x23')]||!_0x46150e[_0xd99c('0x24')]||!_0x46150e[_0xd99c('0x25')]||!_0x46150e[_0xd99c('0x36')]){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x557692[_0xd99c('0x1d')]){throw new Error(_0xd99c('0x28'));}if(_0x46150e['sentimentAccountId']===_0x33a938['id']){return _0x33a938;}else{return db[_0xd99c('0x37')][_0xd99c('0x29')]({'where':{'id':_settings[_0xd99c('0x23')]}});}})[_0xd99c('0x10')](function(_0x17c189){if(!_0x17c189){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x17c189[_0xd99c('0xe')]||!_0x17c189[_0xd99c('0xf')]){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x38'));}_0x41042a=_0x17c189;logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x2b'),_0x557692['id']));return sentiment(_0x41042a[_0xd99c('0xe')],_0x41042a[_0xd99c('0xf')],_0x46150e[_0xd99c('0x24')],_0x557692[_0xd99c('0x1d')],_0x46150e[_0xd99c('0x25')]);})[_0xd99c('0x10')](function(_0x2b836f){logger[_0xd99c('0x11')](util[_0xd99c('0xb')](_0xd99c('0x2c'),_0x557692['id']));return _0x557692[_0xd99c('0x1e')]({'sentiment':_0x2b836f[_0xd99c('0x39')],'sPositive':_0x2b836f['SentimentScore'][_0xd99c('0x2d')],'sNegative':_0x2b836f[_0xd99c('0x2e')][_0xd99c('0x2f')],'sMixed':_0x2b836f[_0xd99c('0x2e')][_0xd99c('0x30')],'sNeutral':_0x2b836f[_0xd99c('0x2e')]['Neutral'],'transcribeStatus':_0xd99c('0x15')});})[_0xd99c('0x10')](function(){logger['info'](util['format'](_0xd99c('0x1f'),_0x557692['id']));_0x3f5d28();});}})[_0xd99c('0x3a')](function(_0x559670){if(_0x559670){if(!_0x559670[_0xd99c('0x3b')]||_0x559670[_0xd99c('0x3b')]!==_0xd99c('0x3c')){logger[_0xd99c('0x3d')](util[_0xd99c('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x557692['id']),util[_0xd99c('0x3e')](_0x559670,{'showHidden':![],'depth':null}));}}_0x3f5d28();});});}function checkTranscribe(){var _0x16a0cd;var _0x5e2550;var _0x2c92d1;return db['VoiceRecording'][_0xd99c('0x3f')]({'where':{'transcribeStatus':_0xd99c('0x40')}})[_0xd99c('0x10')](function(_0x1da7e3){if(!_0x1da7e3||!_0x1da7e3[_0xd99c('0x1c')]){throw new db[(_0xd99c('0x26'))]['ValidationError'](_0xd99c('0x41'));}_0x16a0cd=_0x1da7e3;return db['Setting'][_0xd99c('0x29')]({'where':{'id':0x1}});})[_0xd99c('0x10')](function(_0x3d55f4){if(!_0x3d55f4){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x42'));}_0x5e2550=_0x3d55f4;if(!_0x5e2550['transcribe']||!_0x5e2550[_0xd99c('0x43')]||!_0x5e2550['transcribeRegion']||!_0x5e2550[_0xd99c('0x25')]||!_0x5e2550[_0xd99c('0x36')]){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x44'));}return db['CloudProvider'][_0xd99c('0x29')]({'where':{'id':_0x5e2550[_0xd99c('0x43')]}});})[_0xd99c('0x10')](function(_0x251312){if(!_0x251312){throw new db[(_0xd99c('0x26'))][(_0xd99c('0x20'))](_0xd99c('0x2a'));}if(!_0x251312[_0xd99c('0xe')]||!_0x251312[_0xd99c('0xf')]){throw new db['Sequelize'][(_0xd99c('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c92d1=_0x251312;var _0x32cbaa=[];_0x16a0cd[_0xd99c('0x45')](function(_0x17ad69){_0x32cbaa[_0xd99c('0x46')](checkTranscribeJob(_0x17ad69,_0x5e2550,_0x2c92d1));});return BPromise[_0xd99c('0x47')](_0x32cbaa);})[_0xd99c('0x3a')](function(_0x4851d5){if(_0x4851d5){if(!_0x4851d5['name']||_0x4851d5['name']!==_0xd99c('0x3c')){logger[_0xd99c('0x3d')](util[_0xd99c('0x3e')](_0x4851d5,{'showHidden':![],'depth':null}));}}});}exports[_0xd99c('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd3a0=['Sentiment','Negative','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','Cloud\x20Provider\x20not\x20available'];(function(_0x361ccf,_0x2b3f56){var _0x45010b=function(_0x1f5e97){while(--_0x1f5e97){_0x361ccf['push'](_0x361ccf['shift']());}};_0x45010b(++_0x2b3f56);}(_0xd3a0,0xaa));var _0x0d3a=function(_0x308ff9,_0x3148cb){_0x308ff9=_0x308ff9-0x0;var _0x148225=_0xd3a0[_0x308ff9];return _0x148225;};var _=require(_0x0d3a('0x0'));var AWS=require(_0x0d3a('0x1'));var rp=require(_0x0d3a('0x2'));var util=require(_0x0d3a('0x3'));var BPromise=require('bluebird');var db=require(_0x0d3a('0x4'))['db'];var logger=require(_0x0d3a('0x5'))(_0x0d3a('0x6'));function getTranscriptionJob(_0x118dc9,_0x3abd16,_0x525d35,_0x294812){return new Promise(function(_0x16f051,_0x22cf8f){var _0x437b06=new AWS[(_0x0d3a('0x7'))]({'accessKeyId':_0x3abd16,'secretAccessKey':_0x118dc9,'region':_0x525d35});_0x437b06['getTranscriptionJob']({'TranscriptionJobName':_0x294812},function(_0x1a3cac,_0x262ce7){if(_0x1a3cac){return _0x22cf8f(_0x1a3cac);}else{return _0x16f051(_0x262ce7);}});});}function sentiment(_0x2b7d16,_0xa10301,_0x66d9b,_0x263571,_0x2c2496){return new Promise(function(_0x5b1d51,_0x393396){var _0x3d0b73=new AWS['Comprehend']({'accessKeyId':_0xa10301,'secretAccessKey':_0x2b7d16,'region':_0x66d9b});_0x3d0b73[_0x0d3a('0x8')]({'Text':_0x263571,'LanguageCode':_0x2c2496[_0x0d3a('0x9')](0x0,0x2)},function(_0x17246d,_0x2816a4){if(_0x17246d){return _0x393396(_0x17246d);}else{return _0x5b1d51(_0x2816a4);}});});}function checkTranscribeJob(_0x58625a,_0x47f5a8,_0x1d5f00){var _0x36f478;return new BPromise(function(_0x1b7649,_0xbabec6){logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')](_0x0d3a('0xc'),_0x58625a['id'],_0x58625a[_0x0d3a('0xd')]));return getTranscriptionJob(_0x1d5f00[_0x0d3a('0xe')],_0x1d5f00[_0x0d3a('0xf')],_0x47f5a8[_0x0d3a('0x10')],_0x58625a['transcribeName'])['then'](function(_0x37c833){logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')](_0x0d3a('0x11'),_0x58625a['id'],_0x58625a[_0x0d3a('0xd')],_0x37c833[_0x0d3a('0x12')][_0x0d3a('0x13')]));if(!_0x58625a[_0x0d3a('0x14')]){switch(_0x37c833['TranscriptionJob'][_0x0d3a('0x13')]){case'COMPLETED':var _0x23b43c={'transcribeStatus':_0x37c833[_0x0d3a('0x12')][_0x0d3a('0x13')],'fileUri':_0x37c833['TranscriptionJob'][_0x0d3a('0x15')]['TranscriptFileUri']};logger['info'](util[_0x0d3a('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x58625a['id']));return rp({'uri':_0x37c833[_0x0d3a('0x12')][_0x0d3a('0x15')][_0x0d3a('0x16')],'json':!![]})[_0x0d3a('0x17')](function(_0x339ffb){logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')](_0x0d3a('0x18'),_0x58625a['id']));if(_0x339ffb&&_0x339ffb[_0x0d3a('0x19')]&&_0x339ffb[_0x0d3a('0x19')]['transcripts']&&_0x339ffb['results'][_0x0d3a('0x1a')]['length']){_0x23b43c['fileText']='';for(var _0x3ae44a=0x0;_0x3ae44a<_0x339ffb[_0x0d3a('0x19')][_0x0d3a('0x1a')][_0x0d3a('0x1b')];_0x3ae44a++){_0x23b43c[_0x0d3a('0x14')]+=_0x339ffb[_0x0d3a('0x19')][_0x0d3a('0x1a')][_0x3ae44a][_0x0d3a('0x1c')]+'';}}return _0x58625a[_0x0d3a('0x1d')](_0x23b43c);})['then'](function(){logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x58625a['id']));if(!_0x58625a[_0x0d3a('0x1e')]){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x21'));}if(!_0x47f5a8[_0x0d3a('0x22')]||!_0x47f5a8['sentimentAccountId']||!_0x47f5a8[_0x0d3a('0x23')]||!_0x47f5a8[_0x0d3a('0x24')]||!_0x47f5a8[_0x0d3a('0x25')]){throw new db['Sequelize']['ValidationError'](_0x0d3a('0x26'));}if(!_0x23b43c[_0x0d3a('0x14')]){throw new Error(_0x0d3a('0x27'));}if(_0x47f5a8[_0x0d3a('0x28')]===_0x1d5f00['id']){return _0x1d5f00;}else{return db['CloudProvider'][_0x0d3a('0x29')]({'where':{'id':_settings[_0x0d3a('0x28')]}});}})[_0x0d3a('0x17')](function(_0x5034fe){if(!_0x5034fe){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5034fe[_0x0d3a('0xe')]||!_0x5034fe['data2']){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x2a'));}_0x36f478=_0x5034fe;logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')](_0x0d3a('0x2b'),_0x58625a['id']));return sentiment(_0x36f478[_0x0d3a('0xe')],_0x36f478[_0x0d3a('0xf')],_0x47f5a8[_0x0d3a('0x23')],_0x23b43c[_0x0d3a('0x14')],_0x47f5a8[_0x0d3a('0x24')]);})['then'](function(_0x35b48a){logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')](_0x0d3a('0x2c'),_0x58625a['id']));return _0x58625a['update']({'sentiment':_0x35b48a['Sentiment'],'sPositive':_0x35b48a[_0x0d3a('0x2d')]['Positive'],'sNegative':_0x35b48a[_0x0d3a('0x2d')]['Negative'],'sMixed':_0x35b48a[_0x0d3a('0x2d')][_0x0d3a('0x2e')],'sNeutral':_0x35b48a['SentimentScore'][_0x0d3a('0x2f')]});})[_0x0d3a('0x17')](function(){logger[_0x0d3a('0xa')](util['format'](_0x0d3a('0x30'),_0x58625a['id']));_0x1b7649();});case'FAILED':return _0x58625a[_0x0d3a('0x1d')]({'transcribeStatus':_0x0d3a('0x31'),'failureReason':_0x37c833[_0x0d3a('0x12')][_0x0d3a('0x32')]})['then'](function(){logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')](_0x0d3a('0x30'),_0x58625a['id']));_0x1b7649();});default:logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')](_0x0d3a('0x33'),_0x58625a['id']));break;}}else{return BPromise[_0x0d3a('0x34')]()[_0x0d3a('0x17')](function(){if(!_0x58625a[_0x0d3a('0x1e')]){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x47f5a8[_0x0d3a('0x22')]||!_0x47f5a8[_0x0d3a('0x28')]||!_0x47f5a8[_0x0d3a('0x23')]||!_0x47f5a8['language']||!_0x47f5a8[_0x0d3a('0x25')]){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x26'));}if(!_0x58625a[_0x0d3a('0x14')]){throw new Error(_0x0d3a('0x27'));}if(_0x47f5a8[_0x0d3a('0x28')]===_0x1d5f00['id']){return _0x1d5f00;}else{return db[_0x0d3a('0x35')][_0x0d3a('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x0d3a('0x17')](function(_0x6de72e){if(!_0x6de72e){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x36'));}if(!_0x6de72e['data1']||!_0x6de72e['data2']){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x2a'));}_0x36f478=_0x6de72e;logger['info'](util[_0x0d3a('0xb')](_0x0d3a('0x2b'),_0x58625a['id']));return sentiment(_0x36f478['data1'],_0x36f478[_0x0d3a('0xf')],_0x47f5a8[_0x0d3a('0x23')],_0x58625a[_0x0d3a('0x14')],_0x47f5a8['language']);})[_0x0d3a('0x17')](function(_0x3dda46){logger[_0x0d3a('0xa')](util[_0x0d3a('0xb')](_0x0d3a('0x2c'),_0x58625a['id']));return _0x58625a['update']({'sentiment':_0x3dda46[_0x0d3a('0x37')],'sPositive':_0x3dda46[_0x0d3a('0x2d')]['Positive'],'sNegative':_0x3dda46[_0x0d3a('0x2d')][_0x0d3a('0x38')],'sMixed':_0x3dda46['SentimentScore'][_0x0d3a('0x2e')],'sNeutral':_0x3dda46[_0x0d3a('0x2d')]['Neutral'],'transcribeStatus':_0x0d3a('0x39')});})[_0x0d3a('0x17')](function(){logger['info'](util[_0x0d3a('0xb')](_0x0d3a('0x30'),_0x58625a['id']));_0x1b7649();});}})[_0x0d3a('0x3a')](function(_0x5cdc85){if(_0x5cdc85){if(!_0x5cdc85[_0x0d3a('0x3b')]||_0x5cdc85['name']!==_0x0d3a('0x3c')){logger[_0x0d3a('0x3d')](util[_0x0d3a('0xb')](_0x0d3a('0x3e'),_0x58625a['id']),util[_0x0d3a('0x3f')](_0x5cdc85,{'showHidden':![],'depth':null}));}}_0x1b7649();});});}function checkTranscribe(){var _0x136ca6;var _0x12d090;var _0x3eae80;return db[_0x0d3a('0x40')]['findAll']({'where':{'transcribeStatus':_0x0d3a('0x41')}})[_0x0d3a('0x17')](function(_0x1309c2){if(!_0x1309c2||!_0x1309c2[_0x0d3a('0x1b')]){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x42'));}_0x136ca6=_0x1309c2;return db[_0x0d3a('0x43')]['findOne']({'where':{'id':0x1}});})[_0x0d3a('0x17')](function(_0x9f97e1){if(!_0x9f97e1){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x44'));}_0x12d090=_0x9f97e1;if(!_0x12d090[_0x0d3a('0x6')]||!_0x12d090[_0x0d3a('0x45')]||!_0x12d090[_0x0d3a('0x10')]||!_0x12d090[_0x0d3a('0x24')]||!_0x12d090[_0x0d3a('0x25')]){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x46'));}return db['CloudProvider'][_0x0d3a('0x29')]({'where':{'id':_0x12d090[_0x0d3a('0x45')]}});})['then'](function(_0x504bd9){if(!_0x504bd9){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x36'));}if(!_0x504bd9[_0x0d3a('0xe')]||!_0x504bd9[_0x0d3a('0xf')]){throw new db[(_0x0d3a('0x1f'))][(_0x0d3a('0x20'))](_0x0d3a('0x2a'));}_0x3eae80=_0x504bd9;var _0x5c6415=[];_0x136ca6[_0x0d3a('0x47')](function(_0x2c073b){_0x5c6415[_0x0d3a('0x48')](checkTranscribeJob(_0x2c073b,_0x12d090,_0x3eae80));});return BPromise[_0x0d3a('0x49')](_0x5c6415);})[_0x0d3a('0x3a')](function(_0x2db9e5){if(_0x2db9e5){if(!_0x2db9e5[_0x0d3a('0x3b')]||_0x2db9e5[_0x0d3a('0x3b')]!==_0x0d3a('0x3c')){logger[_0x0d3a('0x3d')](util[_0x0d3a('0x3f')](_0x2db9e5,{'showHidden':![],'depth':null}));}}});}exports[_0x0d3a('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 1b343eb..6d6dd86 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 _0xbf91=['lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../mysqldb','../logger','redis','defaults','WhatsappInteraction'];(function(_0x3a67bb,_0x58d761){var _0x314c35=function(_0x572862){while(--_0x572862){_0x3a67bb['push'](_0x3a67bb['shift']());}};_0x314c35(++_0x58d761);}(_0xbf91,0xc1));var _0x1bf9=function(_0x777a68,_0x526ba2){_0x777a68=_0x777a68-0x0;var _0x5796e6=_0xbf91[_0x777a68];return _0x5796e6;};'use strict';var _=require(_0x1bf9('0x0'));var moment=require('moment');var Redis=require(_0x1bf9('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x1bf9('0x2'))['db'];var logger=require(_0x1bf9('0x3'))('schedule');config[_0x1bf9('0x4')]=_[_0x1bf9('0x5')](config[_0x1bf9('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1bf9('0x4')]));function closeInteractions(){var _0x507cfb=[];return db[_0x1bf9('0x6')]['findAll']({'raw':!![],'attributes':['id',_0x1bf9('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1bf9('0x8')](0x18,_0x1bf9('0x9'))}}})[_0x1bf9('0xa')](function(_0x5ae2d3){if(_0x5ae2d3&&_0x5ae2d3[_0x1bf9('0xb')]){_0x507cfb=_['map'](_0x5ae2d3||[],'id');logger[_0x1bf9('0xc')](_0x1bf9('0xd'),_0x507cfb[_0x1bf9('0xe')]());return db[_0x1bf9('0x6')][_0x1bf9('0xf')]({'closeReason':_0x1bf9('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x1bf9('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x507cfb}});}})['then'](function(){if(_0x507cfb&&_0x507cfb[_0x1bf9('0xb')]){logger[_0x1bf9('0xc')](_0x1bf9('0x12'),_0x507cfb[_0x1bf9('0xe')]());for(var _0x4bd07e=0x0;_0x4bd07e<_0x507cfb[_0x1bf9('0xb')];_0x4bd07e++){io[_0x1bf9('0x13')](_0x1bf9('0x14'),{'id':_0x507cfb[_0x4bd07e],'closed':!![]});}}})[_0x1bf9('0x15')](function(_0x3a96ba){logger['error'](_0x1bf9('0x16'),_0x3a96ba?util[_0x1bf9('0x17')](_0x3a96ba,{'showHidden':![],'depth':null}):'');});}exports[_0x1bf9('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5719=['emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x2673bb,_0x292576){var _0x3edc1c=function(_0x210d91){while(--_0x210d91){_0x2673bb['push'](_0x2673bb['shift']());}};_0x3edc1c(++_0x292576);}(_0x5719,0x155));var _0x9571=function(_0x49e08c,_0x4f4e21){_0x49e08c=_0x49e08c-0x0;var _0xec9be9=_0x5719[_0x49e08c];return _0xec9be9;};'use strict';var _=require('lodash');var moment=require(_0x9571('0x0'));var Redis=require('ioredis');var util=require(_0x9571('0x1'));var config=require('../../config/environment');var db=require(_0x9571('0x2'))['db'];var logger=require(_0x9571('0x3'))(_0x9571('0x4'));config[_0x9571('0x5')]=_[_0x9571('0x6')](config[_0x9571('0x5')],{'host':_0x9571('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9571('0x5')]));function closeInteractions(){var _0x902774=[];return db[_0x9571('0x8')][_0x9571('0x9')]({'raw':!![],'attributes':['id',_0x9571('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9571('0xb')](0x18,_0x9571('0xc'))}}})[_0x9571('0xd')](function(_0x3a04fc){if(_0x3a04fc&&_0x3a04fc[_0x9571('0xe')]){_0x902774=_[_0x9571('0xf')](_0x3a04fc||[],'id');logger[_0x9571('0x10')](_0x9571('0x11'),_0x902774['join']());return db[_0x9571('0x8')][_0x9571('0x12')]({'closeReason':_0x9571('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x9571('0x14')](_0x9571('0x15'))},{'where':{'id':_0x902774}});}})['then'](function(){if(_0x902774&&_0x902774[_0x9571('0xe')]){logger[_0x9571('0x10')](_0x9571('0x16'),_0x902774['join']());for(var _0x5b222b=0x0;_0x5b222b<_0x902774['length'];_0x5b222b++){io[_0x9571('0x17')](_0x9571('0x18'),{'id':_0x902774[_0x5b222b],'closed':!![]});}}})['catch'](function(_0x379f28){logger[_0x9571('0x19')](_0x9571('0x1a'),_0x379f28?util[_0x9571('0x1b')](_0x379f28,{'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 7056686..3f6358b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d4=['finished\x20populating','CmHopper','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','log'];(function(_0x3faba7,_0x78fd2d){var _0x591777=function(_0xf15b91){while(--_0xf15b91){_0x3faba7['push'](_0x3faba7['shift']());}};_0x591777(++_0x78fd2d);}(_0xd6d4,0x1e0));var _0x4d6d=function(_0x53465e,_0x19bf54){_0x53465e=_0x53465e-0x0;var _0x47b1e8=_0xd6d4[_0x53465e];return _0x47b1e8;};'use strict';var util=require(_0x4d6d('0x0'));var db=require(_0x4d6d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4d6d('0x2')]({'id':i,'firstName':_0x4d6d('0x3')+i,'lastName':_0x4d6d('0x4')+i,'phone':0xf879fb460+i,'email':_0x4d6d('0x5')+i+_0x4d6d('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4d6d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4d6d('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4d6d('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4d6d('0x2')]({'id':i,'firstName':_0x4d6d('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4d6d('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4d6d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4d6d('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4d6d('0x7')]()});}db[_0x4d6d('0x8')][_0x4d6d('0x9')]({'where':{}})[_0x4d6d('0xa')](function(){return db[_0x4d6d('0x8')][_0x4d6d('0xb')](contacts);})[_0x4d6d('0xa')](function(){console[_0x4d6d('0xc')](_0x4d6d('0xd'),'contacts1');return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db[_0x4d6d('0xe')][_0x4d6d('0xb')](hopper);})['then'](function(){console['log'](_0x4d6d('0xd'),'hopper1');return db[_0x4d6d('0x8')][_0x4d6d('0xb')](contacts2);})[_0x4d6d('0xa')](function(){console['log']('finished\x20populating','contacts2');return db[_0x4d6d('0xe')]['bulkCreate'](hopper2);})['then'](function(){console[_0x4d6d('0xc')](_0x4d6d('0xd'),_0x4d6d('0xf'));})[_0x4d6d('0x10')](function(_0x5b3db6){console[_0x4d6d('0xc')](_0x5b3db6);}); \ No newline at end of file +var _0xcc78=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','destroy','contacts2','hopper2','catch','util'];(function(_0xfe0690,_0x3606d2){var _0x1998cc=function(_0x58757c){while(--_0x58757c){_0xfe0690['push'](_0xfe0690['shift']());}};_0x1998cc(++_0x3606d2);}(_0xcc78,0xd7));var _0x8cc7=function(_0xa115c0,_0x50ce1b){_0xa115c0=_0xa115c0-0x0;var _0x4bc842=_0xcc78[_0xa115c0];return _0x4bc842;};'use strict';var util=require(_0x8cc7('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x8cc7('0x1')+i,'lastName':_0x8cc7('0x2')+i,'phone':0xf879fb460+i,'email':_0x8cc7('0x3')+i+_0x8cc7('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8cc7('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x8cc7('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8cc7('0x6')](),'updatedAt':Date[_0x8cc7('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8cc7('0x5')]({'id':i,'firstName':_0x8cc7('0x1')+i,'lastName':_0x8cc7('0x2')+i,'phone':0xf879fb460+i,'email':_0x8cc7('0x3')+i+_0x8cc7('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x8cc7('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8cc7('0x6')](),'updatedAt':Date['now']()});}db[_0x8cc7('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x8cc7('0x7')][_0x8cc7('0x8')](contacts);})[_0x8cc7('0x9')](function(){console[_0x8cc7('0xa')](_0x8cc7('0xb'),_0x8cc7('0xc'));return db[_0x8cc7('0xd')][_0x8cc7('0xe')]({'where':{}});})[_0x8cc7('0x9')](function(){return db[_0x8cc7('0xd')][_0x8cc7('0x8')](hopper);})[_0x8cc7('0x9')](function(){console[_0x8cc7('0xa')](_0x8cc7('0xb'),'hopper1');return db[_0x8cc7('0x7')][_0x8cc7('0x8')](contacts2);})['then'](function(){console[_0x8cc7('0xa')]('finished\x20populating',_0x8cc7('0xf'));return db['CmHopper'][_0x8cc7('0x8')](hopper2);})[_0x8cc7('0x9')](function(){console['log'](_0x8cc7('0xb'),_0x8cc7('0x10'));})[_0x8cc7('0x11')](function(_0xc075aa){console[_0x8cc7('0xa')](_0xc075aa);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a2bc102..cdcccd1 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c86=['%s%s','agent','password','friend','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','catch','log','util','../mysqldb','push','format'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x9c86,0x13c));var _0x69c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c86[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x69c8('0x0'));var db=require(_0x69c8('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x69c8('0x2')]({'name':util[_0x69c8('0x3')](_0x69c8('0x4'),'agent',i),'fullname':util['format'](_0x69c8('0x4'),'agent',i),'email':util[_0x69c8('0x3')]('%s%s@xcally.com',_0x69c8('0x5'),i),'role':_0x69c8('0x5'),'password':_0x69c8('0x6'),'internal':0xfa0+i,'type':_0x69c8('0x7'),'transport':[_0x69c8('0x8'),'ws',_0x69c8('0x9')],'disallow':[_0x69c8('0xa')],'allow':['ulaw'],'defaultuser':util[_0x69c8('0x3')](_0x69c8('0x4'),'agent',i),'encryption':_0x69c8('0xb'),'avpf':_0x69c8('0xb'),'force_avp':_0x69c8('0xb'),'icesupport':_0x69c8('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x69c8('0xc'),'dtlsprivatekey':_0x69c8('0xd'),'dtlssetup':_0x69c8('0xe'),'callerid':util[_0x69c8('0x3')](_0x69c8('0xf'),util[_0x69c8('0x3')](_0x69c8('0x4'),_0x69c8('0x5'),i),0xfa0+i)});}db[_0x69c8('0x10')][_0x69c8('0x11')](users)['then'](function(){console['log']('add\x20user');})[_0x69c8('0x12')](function(_0x1d2959){console[_0x69c8('0x13')](_0x1d2959);}); \ No newline at end of file +var _0xd2b8=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes'];(function(_0x58ee96,_0x5affd5){var _0xb346aa=function(_0x245b1a){while(--_0x245b1a){_0x58ee96['push'](_0x58ee96['shift']());}};_0xb346aa(++_0x5affd5);}(_0xd2b8,0x169));var _0x8d2b=function(_0x567e38,_0x28d171){_0x567e38=_0x567e38-0x0;var _0x1332cd=_0xd2b8[_0x567e38];return _0x1332cd;};'use strict';var util=require('util');var db=require(_0x8d2b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8d2b('0x1')]({'name':util[_0x8d2b('0x2')](_0x8d2b('0x3'),_0x8d2b('0x4'),i),'fullname':util['format'](_0x8d2b('0x3'),_0x8d2b('0x4'),i),'email':util[_0x8d2b('0x2')](_0x8d2b('0x5'),_0x8d2b('0x4'),i),'role':'agent','password':_0x8d2b('0x6'),'internal':0xfa0+i,'type':_0x8d2b('0x7'),'transport':[_0x8d2b('0x8'),'ws',_0x8d2b('0x9')],'disallow':[_0x8d2b('0xa')],'allow':[_0x8d2b('0xb')],'defaultuser':util[_0x8d2b('0x2')](_0x8d2b('0x3'),_0x8d2b('0x4'),i),'encryption':'yes','avpf':_0x8d2b('0xc'),'force_avp':_0x8d2b('0xc'),'icesupport':_0x8d2b('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x8d2b('0xd'),'dtlsprivatekey':_0x8d2b('0xe'),'dtlssetup':_0x8d2b('0xf'),'callerid':util[_0x8d2b('0x2')](_0x8d2b('0x10'),util[_0x8d2b('0x2')](_0x8d2b('0x3'),_0x8d2b('0x4'),i),0xfa0+i)});}db[_0x8d2b('0x11')][_0x8d2b('0x12')](users)[_0x8d2b('0x13')](function(){console[_0x8d2b('0x14')]('add\x20user');})[_0x8d2b('0x15')](function(_0x3203c7){console[_0x8d2b('0x14')](_0x3203c7);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 05e4739..e7f9bed 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa56=['SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','Campaign','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','length','voice','chat','fax','mail','openchannel','telephone:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','request','remotePort','connectedAt','SocketIO\x20','address','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','role','where','format','%s:queue:%s','Agents','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteractions'];(function(_0x42b5f2,_0x27e355){var _0x500768=function(_0x341d9c){while(--_0x341d9c){_0x42b5f2['push'](_0x42b5f2['shift']());}};_0x500768(++_0x27e355);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x1a4da1,_0x500266){_0x1a4da1=_0x1a4da1-0x0;var _0x28b9f3=_0xaa56[_0x1a4da1];return _0x28b9f3;};'use strict';var _=require('lodash');var util=require(_0x6aa5('0x0'));var BPromise=require(_0x6aa5('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x6aa5('0x2'));var queryQueues={'attributes':['id',_0x6aa5('0x3')],'include':[{'as':'Agents','model':db[_0x6aa5('0x4')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x6aa5('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6aa5('0x3')],'where':{'role':_0x6aa5('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6aa5('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x6aa5('0x7')],'where':{'type':_0x6aa5('0x8')}};function getAssociatedResources(_0x4e1cf5,_0x33e5ea,_0x3f7863){return db[_0x6aa5('0x9')][_0x6aa5('0xa')]({'where':{'name':_0x4e1cf5,'userProfileId':_0x33e5ea},'raw':!![]})[_0x6aa5('0xb')](function(_0x2c689f){if(_0x2c689f){if(_0x2c689f[_0x6aa5('0xc')]){switch(_0x4e1cf5){case _0x6aa5('0xd'):case _0x6aa5('0xe'):case _0x6aa5('0xf'):case _0x6aa5('0x10'):case'MailQueues':case _0x6aa5('0x11'):case _0x6aa5('0x12'):return db[_0x3f7863][_0x6aa5('0x13')](queryQueues);case'Telephones':return db[_0x3f7863][_0x6aa5('0x13')](queryTelephones);case _0x6aa5('0x14'):return db[_0x3f7863][_0x6aa5('0x13')](queryTrunks);case _0x6aa5('0x15'):return db[_0x3f7863][_0x6aa5('0x13')](queryCampaigns);}}else{return db[_0x6aa5('0x16')][_0x6aa5('0x13')]({'attributes':[_0x6aa5('0x17')],'where':{'sectionId':_0x2c689f['id']},'raw':!![]})[_0x6aa5('0xb')](function(_0x53254d){if(_0x53254d){var _0x33a636={'where':{'id':_['map'](_0x53254d,_0x6aa5('0x17'))},'raw':!![]};switch(_0x3f7863){case _0x6aa5('0x4'):_0x33a636['where'][_0x6aa5('0x18')]=_0x6aa5('0x6');break;case'Campaign':_0x33a636[_0x6aa5('0x19')][_0x6aa5('0x7')]=_0x6aa5('0x8');break;}return db[_0x3f7863][_0x6aa5('0x13')](_0x33a636);}else{return[];}});}}else{return[];}})[_0x6aa5('0xb')](function(_0x4cd123){return _0x4cd123;});}function joinOrLeaveQueues(_0xae4948,_0x20fe4c,_0x1f6458,_0x1e0b1a){_0xae4948[_0x20fe4c](util[_0x6aa5('0x1a')](_0x6aa5('0x1b'),_0x1f6458,_0x1e0b1a['name']));if(_0x1e0b1a['Agents']){for(var _0x5cf787=0x0;_0x5cf787<_0x1e0b1a[_0x6aa5('0x1c')]['length'];_0x5cf787+=0x1){_0xae4948[_0x20fe4c](util[_0x6aa5('0x1a')](_0x6aa5('0x1d'),_0x1e0b1a['Agents'][_0x5cf787][_0x6aa5('0x3')]));}}}function joinOrLeave(_0x80a99,_0x2087d5,_0x40f719){var _0x4bcb11;if(_0x80a99[_0x6aa5('0x1e')][_0x6aa5('0x1f')]['id']){db[_0x6aa5('0x4')][_0x6aa5('0x20')]({'attributes':['id',_0x6aa5('0x3'),_0x6aa5('0x18'),_0x6aa5('0x21')],'where':{'id':_0x80a99[_0x6aa5('0x1e')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x6aa5('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x6aa5('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6aa5('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x6aa5('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x6aa5('0x26')],'as':_0x6aa5('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x6aa5('0x28'),'attributes':['id'],'raw':!![]}]})[_0x6aa5('0xb')](function(_0x4b54e0){if(_0x4b54e0){_0x4bcb11=_0x4b54e0;_0x80a99[_0x2087d5](util[_0x6aa5('0x1a')](_0x6aa5('0x1d'),_0x4b54e0[_0x6aa5('0x3')]));var _0x1aff4f=[];switch(_0x4b54e0[_0x6aa5('0x18')]){case _0x6aa5('0x29'):_0x80a99[_0x2087d5](_0x6aa5('0x2a'));_0x80a99[_0x2087d5](_0x6aa5('0x2b'));if(queryQueues[_0x6aa5('0x2c')](_0x6aa5('0x2d'))){delete queryQueues[_0x6aa5('0x2d')];}_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x2f')][_0x6aa5('0x13')](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x30')][_0x6aa5('0x13')](queryQueues));_0x1aff4f['push'](db[_0x6aa5('0x31')]['findAll'](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x32')]['findAll'](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x33')][_0x6aa5('0x13')](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x34')][_0x6aa5('0x13')](queryQueues));_0x1aff4f['push'](db['WhatsappQueue'][_0x6aa5('0x13')](queryQueues));_0x1aff4f[_0x6aa5('0x2e')](db['User'][_0x6aa5('0x13')](queryTelephones));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x35')][_0x6aa5('0x13')](queryTrunks));_0x1aff4f[_0x6aa5('0x2e')](db[_0x6aa5('0x36')]['findAll'](queryCampaigns));_0x1aff4f['push'](db[_0x6aa5('0x4')][_0x6aa5('0x13')](queryAgents));break;case'user':_0x80a99[_0x2087d5]('voice:inbound');_0x80a99[_0x2087d5]('voice:outbound');_0x1aff4f['push'](getAssociatedResources(_0x6aa5('0xd'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x2f')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0xe'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x30')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0xf'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x31')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0x10'),_0x4b54e0['userProfileId'],_0x6aa5('0x32')));_0x1aff4f['push'](getAssociatedResources('MailQueues',_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x33')));_0x1aff4f['push'](getAssociatedResources('OpenchannelQueues',_0x4b54e0['userProfileId'],'OpenchannelQueue'));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0x12'),_0x4b54e0[_0x6aa5('0x21')],'WhatsappQueue'));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources('Telephones',_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x4')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0x14'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x35')));_0x1aff4f[_0x6aa5('0x2e')](getAssociatedResources(_0x6aa5('0x15'),_0x4b54e0[_0x6aa5('0x21')],_0x6aa5('0x36')));_0x1aff4f['push'](db[_0x6aa5('0x4')][_0x6aa5('0x13')](queryAgents));break;case _0x6aa5('0x5'):_0x80a99[_0x2087d5](_0x6aa5('0x2a'));_0x80a99[_0x2087d5](_0x6aa5('0x2b'));_0x1aff4f[_0x6aa5('0x2e')](_0x4b54e0[_0x6aa5('0x37')]({'attributes':['id',_0x6aa5('0x3')]}));_0x1aff4f[_0x6aa5('0x2e')](_0x4b54e0[_0x6aa5('0x38')]({'attributes':['id','name']}));_0x1aff4f['push'](_0x4b54e0[_0x6aa5('0x39')]({'attributes':['id',_0x6aa5('0x3')]}));_0x1aff4f['push'](_0x4b54e0[_0x6aa5('0x3a')]({'attributes':['id','name']}));_0x1aff4f['push'](_0x4b54e0['getMailQueues']({'attributes':['id',_0x6aa5('0x3')]}));_0x1aff4f[_0x6aa5('0x2e')](_0x4b54e0[_0x6aa5('0x3b')]({'attributes':['id',_0x6aa5('0x3')]}));_0x1aff4f[_0x6aa5('0x2e')](_0x4b54e0['getWhatsappQueues']({'attributes':['id',_0x6aa5('0x3')]}));break;}return BPromise['all'](_0x1aff4f);}})[_0x6aa5('0xb')](function(_0x1b450d){if(_0x1b450d&&_0x1b450d[_0x6aa5('0x3c')]){for(var _0x3386fc=0x0;_0x3386fc<_0x1b450d[_0x6aa5('0x3c')];_0x3386fc+=0x1){for(var _0x51408f=0x0;_0x51408f<_0x1b450d[_0x3386fc][_0x6aa5('0x3c')];_0x51408f+=0x1){switch(_0x3386fc){case 0x0:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x3d'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x1:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x3e'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x2:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x3f'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x3:joinOrLeaveQueues(_0x80a99,_0x2087d5,'sms',_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x4:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x40'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x5:joinOrLeaveQueues(_0x80a99,_0x2087d5,_0x6aa5('0x41'),_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x6:joinOrLeaveQueues(_0x80a99,_0x2087d5,'whatsapp',_0x1b450d[_0x3386fc][_0x51408f]);break;case 0x7:if(_0x4bcb11[_0x6aa5('0x18')]!==_0x6aa5('0x5'))_0x80a99[_0x2087d5](util['format'](_0x6aa5('0x42'),_0x1b450d[_0x3386fc][_0x51408f][_0x6aa5('0x3')]));break;case 0x8:if(_0x4bcb11[_0x6aa5('0x18')]!==_0x6aa5('0x5'))_0x80a99[_0x2087d5](util[_0x6aa5('0x1a')]('trunk:%s',_0x1b450d[_0x3386fc][_0x51408f][_0x6aa5('0x3')]));break;case 0x9:if(_0x4bcb11[_0x6aa5('0x18')]!=='agent')_0x80a99[_0x2087d5](util[_0x6aa5('0x1a')]('campaign:%s:%s',_0x1b450d[_0x3386fc][_0x51408f][_0x6aa5('0x7')],_0x1b450d[_0x3386fc][_0x51408f]['name']));break;case 0xa:_0x80a99[_0x2087d5](util[_0x6aa5('0x1a')](_0x6aa5('0x1d'),_0x1b450d[_0x3386fc][_0x51408f][_0x6aa5('0x3')]));break;}}}}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0xf55ee4=_[_0x6aa5('0x44')](_0x4bcb11[_0x6aa5('0x22')],'id');return _0x4bcb11[_0x6aa5('0x45')](_0xf55ee4)[_0x6aa5('0xb')](function(){for(var _0x4f2bf7=0x0;_0x4f2bf7<_0xf55ee4[_0x6aa5('0x3c')];_0x4f2bf7+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x47'),{'ChatInteractionId':Number(_0xf55ee4[_0x4f2bf7]),'UserId':Number(_0x4bcb11['id'])});}});}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x3a72ed=_['map'](_0x4bcb11[_0x6aa5('0x48')],'id');return _0x4bcb11['removeMailInteractions'](_0x3a72ed)[_0x6aa5('0xb')](function(){for(var _0x579e5f=0x0;_0x579e5f<_0x3a72ed['length'];_0x579e5f+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x49'),{'MailInteractionId':Number(_0x3a72ed[_0x579e5f]),'UserId':Number(_0x4bcb11['id'])});}});}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x21af0b=_['map'](_0x4bcb11[_0x6aa5('0x24')],'id');return _0x4bcb11[_0x6aa5('0x4a')](_0x21af0b)[_0x6aa5('0xb')](function(){for(var _0x1a35e4=0x0;_0x1a35e4<_0x21af0b[_0x6aa5('0x3c')];_0x1a35e4+=0x1){_0x40f719[_0x6aa5('0x46')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x21af0b[_0x1a35e4]),'UserId':Number(_0x4bcb11['id'])});}});}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x5bbc51=_[_0x6aa5('0x44')](_0x4bcb11[_0x6aa5('0x25')],'id');return _0x4bcb11[_0x6aa5('0x4b')](_0x5bbc51)[_0x6aa5('0xb')](function(){for(var _0x236fcd=0x0;_0x236fcd<_0x5bbc51[_0x6aa5('0x3c')];_0x236fcd+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x4c'),{'SmsInteractionId':Number(_0x5bbc51[_0x236fcd]),'UserId':Number(_0x4bcb11['id'])});}});}})['then'](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x31babd=_[_0x6aa5('0x44')](_0x4bcb11['OpenchannelInteractions'],'id');return _0x4bcb11[_0x6aa5('0x4d')](_0x31babd)['then'](function(){for(var _0x39ce6b=0x0;_0x39ce6b<_0x31babd['length'];_0x39ce6b+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x4e'),{'OpenchannelInteractionId':Number(_0x31babd[_0x39ce6b]),'UserId':Number(_0x4bcb11['id'])});}});}})[_0x6aa5('0xb')](function(){if(_0x2087d5===_0x6aa5('0x43')){var _0x545cd8=_['map'](_0x4bcb11[_0x6aa5('0x28')],'id');return _0x4bcb11[_0x6aa5('0x4f')](_0x545cd8)[_0x6aa5('0xb')](function(){for(var _0x2cdb57=0x0;_0x2cdb57<_0x545cd8[_0x6aa5('0x3c')];_0x2cdb57+=0x1){_0x40f719[_0x6aa5('0x46')](_0x6aa5('0x50'),{'WhatsappInteractionId':Number(_0x545cd8[_0x2cdb57]),'UserId':Number(_0x4bcb11['id'])});}});}})['catch'](function(_0x591534){_0x80a99[_0x6aa5('0x51')](_0x591534);});}}function onDisconnect(_0x4d5a0f,_0x1a1743){joinOrLeave(_0x4d5a0f,_0x6aa5('0x43'),_0x1a1743);}function onConnect(_0x371622){joinOrLeave(_0x371622,_0x6aa5('0x52'));}exports[_0x6aa5('0x53')]=function(_0x1b29cd){_0x1b29cd['on'](_0x6aa5('0x54'),function(_0xe5cb41){_0xe5cb41[_0x6aa5('0x55')](0x0);_0xe5cb41['address']=_0xe5cb41[_0x6aa5('0x56')][_0x6aa5('0x54')]['remoteAddress']+':'+_0xe5cb41[_0x6aa5('0x56')][_0x6aa5('0x54')][_0x6aa5('0x57')];_0xe5cb41[_0x6aa5('0x58')]=new Date();_0xe5cb41[_0x6aa5('0x51')]=function(_0xb9a370){console[_0x6aa5('0x51')](_0x6aa5('0x59')+_0xe5cb41['nsp'][_0x6aa5('0x3')]+'['+_0xe5cb41[_0x6aa5('0x5a')]+']',_0xb9a370);};_0xe5cb41['on']('disconnect',function(){onDisconnect(_0xe5cb41,_0x1b29cd);_0xe5cb41[_0x6aa5('0x51')](_0x6aa5('0x5b'));});onConnect(_0xe5cb41);_0xe5cb41[_0x6aa5('0x51')](_0x6aa5('0x5c'));});}; \ No newline at end of file +var _0x4547=['DISCONNECTED','lodash','util','../mysqldb','./environment','Agents','User','name','role','agent','telephone','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','resourceId','map','Campaign','where','type','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','FaxQueues','FaxQueue','WhatsappQueues','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20'];(function(_0x193ddf,_0x6f30bb){var _0x5bc6df=function(_0x70fd9e){while(--_0x70fd9e){_0x193ddf['push'](_0x193ddf['shift']());}};_0x5bc6df(++_0x6f30bb);}(_0x4547,0x11b));var _0x7454=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x4547[_0x23c73d];return _0x36ba47;};'use strict';var _=require(_0x7454('0x0'));var util=require(_0x7454('0x1'));var BPromise=require('bluebird');var db=require(_0x7454('0x2'))['db'];var config=require(_0x7454('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x7454('0x4'),'model':db[_0x7454('0x5')],'attributes':['id',_0x7454('0x6'),_0x7454('0x7')],'raw':!![],'where':{'role':_0x7454('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7454('0x6')],'where':{'role':_0x7454('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x7454('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7454('0x6'),'type'],'where':{'type':_0x7454('0xa')}};function getAssociatedResources(_0x53e5e0,_0x3cc940,_0x1097ff){return db['UserProfileSection'][_0x7454('0xb')]({'where':{'name':_0x53e5e0,'userProfileId':_0x3cc940},'raw':!![]})[_0x7454('0xc')](function(_0x81e1e1){if(_0x81e1e1){if(_0x81e1e1[_0x7454('0xd')]){switch(_0x53e5e0){case _0x7454('0xe'):case _0x7454('0xf'):case'FaxQueues':case _0x7454('0x10'):case _0x7454('0x11'):case _0x7454('0x12'):case'WhatsappQueues':return db[_0x1097ff]['findAll'](queryQueues);case _0x7454('0x13'):return db[_0x1097ff][_0x7454('0x14')](queryTelephones);case _0x7454('0x15'):return db[_0x1097ff]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x1097ff]['findAll'](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x7454('0x16')],'where':{'sectionId':_0x81e1e1['id']},'raw':!![]})[_0x7454('0xc')](function(_0x59d542){if(_0x59d542){var _0x4cbcbd={'where':{'id':_[_0x7454('0x17')](_0x59d542,_0x7454('0x16'))},'raw':!![]};switch(_0x1097ff){case _0x7454('0x5'):_0x4cbcbd['where']['role']=_0x7454('0x9');break;case _0x7454('0x18'):_0x4cbcbd[_0x7454('0x19')][_0x7454('0x1a')]=_0x7454('0xa');break;}return db[_0x1097ff][_0x7454('0x14')](_0x4cbcbd);}else{return[];}});}}else{return[];}})['then'](function(_0x1ba7f2){return _0x1ba7f2;});}function joinOrLeaveQueues(_0x56d3ba,_0x15e1bf,_0x2ddb7f,_0x5b7605){_0x56d3ba[_0x15e1bf](util[_0x7454('0x1b')](_0x7454('0x1c'),_0x2ddb7f,_0x5b7605[_0x7454('0x6')]));if(_0x5b7605[_0x7454('0x4')]){for(var _0x2640fb=0x0;_0x2640fb<_0x5b7605[_0x7454('0x4')][_0x7454('0x1d')];_0x2640fb+=0x1){_0x56d3ba[_0x15e1bf](util[_0x7454('0x1b')](_0x7454('0x1e'),_0x5b7605[_0x7454('0x4')][_0x2640fb][_0x7454('0x6')]));}}}function joinOrLeave(_0x581d56,_0x5a121f,_0x5c3a01){var _0x55253e;if(_0x581d56[_0x7454('0x1f')][_0x7454('0x20')]['id']){db[_0x7454('0x5')][_0x7454('0x21')]({'attributes':['id','name',_0x7454('0x7'),_0x7454('0x22')],'where':{'id':_0x581d56[_0x7454('0x1f')][_0x7454('0x20')]['id']},'include':[{'model':db[_0x7454('0x23')],'as':_0x7454('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7454('0x25')],'as':_0x7454('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7454('0x27')],'as':_0x7454('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7454('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x7454('0x2a')],'as':_0x7454('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x7454('0x2c')],'as':_0x7454('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x7454('0xc')](function(_0x14c525){if(_0x14c525){_0x55253e=_0x14c525;_0x581d56[_0x5a121f](util[_0x7454('0x1b')]('user:%s',_0x14c525['name']));var _0x405915=[];switch(_0x14c525['role']){case'admin':_0x581d56[_0x5a121f](_0x7454('0x2e'));_0x581d56[_0x5a121f](_0x7454('0x2f'));if(queryQueues[_0x7454('0x30')](_0x7454('0x31'))){delete queryQueues[_0x7454('0x31')];}_0x405915[_0x7454('0x32')](db[_0x7454('0x33')][_0x7454('0x14')](queryQueues));_0x405915[_0x7454('0x32')](db[_0x7454('0x34')][_0x7454('0x14')](queryQueues));_0x405915['push'](db['FaxQueue'][_0x7454('0x14')](queryQueues));_0x405915['push'](db[_0x7454('0x35')][_0x7454('0x14')](queryQueues));_0x405915['push'](db[_0x7454('0x36')]['findAll'](queryQueues));_0x405915[_0x7454('0x32')](db[_0x7454('0x37')]['findAll'](queryQueues));_0x405915[_0x7454('0x32')](db[_0x7454('0x38')][_0x7454('0x14')](queryQueues));_0x405915[_0x7454('0x32')](db[_0x7454('0x5')][_0x7454('0x14')](queryTelephones));_0x405915[_0x7454('0x32')](db[_0x7454('0x39')][_0x7454('0x14')](queryTrunks));_0x405915[_0x7454('0x32')](db[_0x7454('0x18')][_0x7454('0x14')](queryCampaigns));_0x405915['push'](db[_0x7454('0x5')][_0x7454('0x14')](queryAgents));break;case _0x7454('0x3a'):_0x581d56[_0x5a121f](_0x7454('0x2e'));_0x581d56[_0x5a121f](_0x7454('0x2f'));_0x405915[_0x7454('0x32')](getAssociatedResources(_0x7454('0xe'),_0x14c525[_0x7454('0x22')],_0x7454('0x33')));_0x405915[_0x7454('0x32')](getAssociatedResources(_0x7454('0xf'),_0x14c525[_0x7454('0x22')],'ChatQueue'));_0x405915['push'](getAssociatedResources(_0x7454('0x3b'),_0x14c525['userProfileId'],_0x7454('0x3c')));_0x405915['push'](getAssociatedResources(_0x7454('0x10'),_0x14c525['userProfileId'],_0x7454('0x35')));_0x405915['push'](getAssociatedResources('MailQueues',_0x14c525[_0x7454('0x22')],_0x7454('0x36')));_0x405915[_0x7454('0x32')](getAssociatedResources('OpenchannelQueues',_0x14c525[_0x7454('0x22')],_0x7454('0x37')));_0x405915[_0x7454('0x32')](getAssociatedResources(_0x7454('0x3d'),_0x14c525['userProfileId'],_0x7454('0x38')));_0x405915['push'](getAssociatedResources(_0x7454('0x13'),_0x14c525[_0x7454('0x22')],_0x7454('0x5')));_0x405915[_0x7454('0x32')](getAssociatedResources(_0x7454('0x15'),_0x14c525['userProfileId'],_0x7454('0x39')));_0x405915['push'](getAssociatedResources('IvrCampaigns',_0x14c525['userProfileId'],_0x7454('0x18')));_0x405915[_0x7454('0x32')](db[_0x7454('0x5')]['findAll'](queryAgents));break;case _0x7454('0x8'):_0x581d56[_0x5a121f](_0x7454('0x2e'));_0x581d56[_0x5a121f]('voice:outbound');_0x405915['push'](_0x14c525[_0x7454('0x3e')]({'attributes':['id',_0x7454('0x6')]}));_0x405915[_0x7454('0x32')](_0x14c525[_0x7454('0x3f')]({'attributes':['id',_0x7454('0x6')]}));_0x405915[_0x7454('0x32')](_0x14c525['getFaxQueues']({'attributes':['id',_0x7454('0x6')]}));_0x405915[_0x7454('0x32')](_0x14c525[_0x7454('0x40')]({'attributes':['id',_0x7454('0x6')]}));_0x405915[_0x7454('0x32')](_0x14c525['getMailQueues']({'attributes':['id',_0x7454('0x6')]}));_0x405915[_0x7454('0x32')](_0x14c525[_0x7454('0x41')]({'attributes':['id','name']}));_0x405915[_0x7454('0x32')](_0x14c525[_0x7454('0x42')]({'attributes':['id',_0x7454('0x6')]}));break;}return BPromise[_0x7454('0x43')](_0x405915);}})[_0x7454('0xc')](function(_0x197e20){if(_0x197e20&&_0x197e20['length']){for(var _0x362f64=0x0;_0x362f64<_0x197e20[_0x7454('0x1d')];_0x362f64+=0x1){for(var _0x39cec2=0x0;_0x39cec2<_0x197e20[_0x362f64][_0x7454('0x1d')];_0x39cec2+=0x1){switch(_0x362f64){case 0x0:joinOrLeaveQueues(_0x581d56,_0x5a121f,'voice',_0x197e20[_0x362f64][_0x39cec2]);break;case 0x1:joinOrLeaveQueues(_0x581d56,_0x5a121f,_0x7454('0x44'),_0x197e20[_0x362f64][_0x39cec2]);break;case 0x2:joinOrLeaveQueues(_0x581d56,_0x5a121f,_0x7454('0x45'),_0x197e20[_0x362f64][_0x39cec2]);break;case 0x3:joinOrLeaveQueues(_0x581d56,_0x5a121f,'sms',_0x197e20[_0x362f64][_0x39cec2]);break;case 0x4:joinOrLeaveQueues(_0x581d56,_0x5a121f,'mail',_0x197e20[_0x362f64][_0x39cec2]);break;case 0x5:joinOrLeaveQueues(_0x581d56,_0x5a121f,'openchannel',_0x197e20[_0x362f64][_0x39cec2]);break;case 0x6:joinOrLeaveQueues(_0x581d56,_0x5a121f,_0x7454('0x46'),_0x197e20[_0x362f64][_0x39cec2]);break;case 0x7:if(_0x55253e[_0x7454('0x7')]!==_0x7454('0x8'))_0x581d56[_0x5a121f](util[_0x7454('0x1b')](_0x7454('0x47'),_0x197e20[_0x362f64][_0x39cec2][_0x7454('0x6')]));break;case 0x8:if(_0x55253e[_0x7454('0x7')]!==_0x7454('0x8'))_0x581d56[_0x5a121f](util[_0x7454('0x1b')](_0x7454('0x48'),_0x197e20[_0x362f64][_0x39cec2]['name']));break;case 0x9:if(_0x55253e[_0x7454('0x7')]!=='agent')_0x581d56[_0x5a121f](util[_0x7454('0x1b')](_0x7454('0x49'),_0x197e20[_0x362f64][_0x39cec2][_0x7454('0x1a')],_0x197e20[_0x362f64][_0x39cec2][_0x7454('0x6')]));break;case 0xa:_0x581d56[_0x5a121f](util[_0x7454('0x1b')]('user:%s',_0x197e20[_0x362f64][_0x39cec2][_0x7454('0x6')]));break;}}}}})[_0x7454('0xc')](function(){if(_0x5a121f===_0x7454('0x4a')){var _0x141b3f=_[_0x7454('0x17')](_0x55253e[_0x7454('0x24')],'id');return _0x55253e[_0x7454('0x4b')](_0x141b3f)[_0x7454('0xc')](function(){for(var _0x3eb542=0x0;_0x3eb542<_0x141b3f[_0x7454('0x1d')];_0x3eb542+=0x1){_0x5c3a01[_0x7454('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x141b3f[_0x3eb542]),'UserId':Number(_0x55253e['id'])});}});}})[_0x7454('0xc')](function(){if(_0x5a121f===_0x7454('0x4a')){var _0x4f82fe=_[_0x7454('0x17')](_0x55253e['MailInteractions'],'id');return _0x55253e['removeMailInteractions'](_0x4f82fe)[_0x7454('0xc')](function(){for(var _0x155bdc=0x0;_0x155bdc<_0x4f82fe[_0x7454('0x1d')];_0x155bdc+=0x1){_0x5c3a01[_0x7454('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4f82fe[_0x155bdc]),'UserId':Number(_0x55253e['id'])});}});}})[_0x7454('0xc')](function(){if(_0x5a121f==='leave'){var _0x5d967f=_[_0x7454('0x17')](_0x55253e[_0x7454('0x28')],'id');return _0x55253e['removeFaxInteractions'](_0x5d967f)[_0x7454('0xc')](function(){for(var _0x520177=0x0;_0x520177<_0x5d967f[_0x7454('0x1d')];_0x520177+=0x1){_0x5c3a01[_0x7454('0x4c')](_0x7454('0x4d'),{'FaxInteractionId':Number(_0x5d967f[_0x520177]),'UserId':Number(_0x55253e['id'])});}});}})[_0x7454('0xc')](function(){if(_0x5a121f===_0x7454('0x4a')){var _0x3c4792=_[_0x7454('0x17')](_0x55253e[_0x7454('0x29')],'id');return _0x55253e[_0x7454('0x4e')](_0x3c4792)[_0x7454('0xc')](function(){for(var _0xd0a55b=0x0;_0xd0a55b<_0x3c4792[_0x7454('0x1d')];_0xd0a55b+=0x1){_0x5c3a01['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3c4792[_0xd0a55b]),'UserId':Number(_0x55253e['id'])});}});}})[_0x7454('0xc')](function(){if(_0x5a121f===_0x7454('0x4a')){var _0x4ebb8e=_[_0x7454('0x17')](_0x55253e[_0x7454('0x2b')],'id');return _0x55253e[_0x7454('0x4f')](_0x4ebb8e)[_0x7454('0xc')](function(){for(var _0x5297eb=0x0;_0x5297eb<_0x4ebb8e[_0x7454('0x1d')];_0x5297eb+=0x1){_0x5c3a01[_0x7454('0x4c')](_0x7454('0x50'),{'OpenchannelInteractionId':Number(_0x4ebb8e[_0x5297eb]),'UserId':Number(_0x55253e['id'])});}});}})[_0x7454('0xc')](function(){if(_0x5a121f===_0x7454('0x4a')){var _0x3ecd4c=_[_0x7454('0x17')](_0x55253e[_0x7454('0x2d')],'id');return _0x55253e[_0x7454('0x51')](_0x3ecd4c)['then'](function(){for(var _0xe976d0=0x0;_0xe976d0<_0x3ecd4c['length'];_0xe976d0+=0x1){_0x5c3a01['emit'](_0x7454('0x52'),{'WhatsappInteractionId':Number(_0x3ecd4c[_0xe976d0]),'UserId':Number(_0x55253e['id'])});}});}})[_0x7454('0x53')](function(_0x50715c){_0x581d56['log'](_0x50715c);});}}function onDisconnect(_0x3aaf5f,_0x163180){joinOrLeave(_0x3aaf5f,'leave',_0x163180);}function onConnect(_0x3056a6){joinOrLeave(_0x3056a6,'join');}exports['default']=function(_0x3ee54b){_0x3ee54b['on']('connection',function(_0x1ef7e9){_0x1ef7e9[_0x7454('0x54')](0x0);_0x1ef7e9[_0x7454('0x55')]=_0x1ef7e9[_0x7454('0x56')][_0x7454('0x57')][_0x7454('0x58')]+':'+_0x1ef7e9['request'][_0x7454('0x57')][_0x7454('0x59')];_0x1ef7e9[_0x7454('0x5a')]=new Date();_0x1ef7e9[_0x7454('0x5b')]=function(_0x2e972c){console['log'](_0x7454('0x5c')+_0x1ef7e9['nsp'][_0x7454('0x6')]+'['+_0x1ef7e9[_0x7454('0x55')]+']',_0x2e972c);};_0x1ef7e9['on']('disconnect',function(){onDisconnect(_0x1ef7e9,_0x3ee54b);_0x1ef7e9[_0x7454('0x5b')](_0x7454('0x5d'));});onConnect(_0x1ef7e9);_0x1ef7e9[_0x7454('0x5b')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 418a3f8..e0e7e64 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 _0x1886=['WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','get','channel','motionChannel','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','UserId','interface','format','SIP/%s','agent','outgoingmessage','event','offlineMessage','opened','resolve','SELECT','contact','catch','AfterCreate','changed','closed','substatus','name','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','callback','condition','../../mysqldb','jayson/promise','triggers','client','http','Chat','newinteraction','closedinteraction','ChatMessage','newmessage','afterCreate','Sms','SmsInteraction','afterUpdate','SmsMessage'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1886,0x19b));var _0x6188=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1886[_0x19950b];return _0x3c6b41;};'use strict';var util=require('util');var db=require(_0x6188('0x0'))['db'];var jayson=require(_0x6188('0x1'));var logger=require('../logger')(_0x6188('0x2'));var client=jayson[_0x6188('0x3')][_0x6188('0x4')]({'port':0x232a});var triggers=[{'channel':_0x6188('0x5'),'model':'ChatInteraction','event':'afterCreate','condition':_0x6188('0x6'),'callback':afterCreate},{'channel':_0x6188('0x5'),'model':'ChatInteraction','event':'afterUpdate','condition':_0x6188('0x7'),'callback':afterUpdate},{'channel':_0x6188('0x5'),'model':_0x6188('0x8'),'event':'afterCreate','condition':_0x6188('0x9'),'callback':afterCreateMessage},{'channel':_0x6188('0x5'),'model':'ChatOfflineMessage','event':_0x6188('0xa'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x6188('0xb'),'model':_0x6188('0xc'),'event':_0x6188('0xa'),'condition':_0x6188('0x6'),'callback':afterCreate},{'channel':_0x6188('0xb'),'model':_0x6188('0xc'),'event':_0x6188('0xd'),'condition':_0x6188('0x7'),'callback':afterUpdate},{'channel':_0x6188('0xb'),'model':_0x6188('0xe'),'event':_0x6188('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x6188('0xf'),'event':'afterCreate','condition':_0x6188('0x6'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x6188('0xf'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x6188('0x10'),'event':_0x6188('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6188('0x11'),'model':_0x6188('0x12'),'event':_0x6188('0xa'),'condition':_0x6188('0x6'),'callback':afterCreate},{'channel':_0x6188('0x11'),'model':_0x6188('0x12'),'event':_0x6188('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6188('0x11'),'model':'FaxMessage','event':_0x6188('0xa'),'condition':_0x6188('0x9'),'callback':afterCreateMessage},{'channel':_0x6188('0x13'),'model':_0x6188('0x14'),'event':_0x6188('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6188('0x13'),'model':_0x6188('0x14'),'event':_0x6188('0xd'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6188('0x13'),'model':_0x6188('0x15'),'event':_0x6188('0xa'),'condition':_0x6188('0x9'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x6188('0x16'),'event':_0x6188('0xa'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6188('0x17'),'model':_0x6188('0x16'),'event':_0x6188('0xd'),'condition':_0x6188('0x7'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x6188('0x18'),'event':_0x6188('0xa'),'condition':_0x6188('0x9'),'callback':afterCreateMessage}];function request(_0x1922f2){return client[_0x6188('0x19')](_0x6188('0x1a'),_0x1922f2)[_0x6188('0x1b')](function(_0x261998){logger['info'](_0x6188('0x1c'),_0x6188('0x1a'),_0x261998);if(_0x261998[_0x6188('0x1d')]){if(_0x261998[_0x6188('0x1d')][_0x6188('0x1e')]===0x1f4){logger[_0x6188('0x1d')](_0x6188('0x1c'),'EventManager',_0x261998[_0x6188('0x1d')]);}}})['catch'](function(_0xaeced1){logger['error'](_0x6188('0x1c'),_0x6188('0x1a'),_0xaeced1);});}function afterCreateMessage(_0x18f809){return function(_0x1701f2){_0x1701f2=_0x1701f2[_0x6188('0x1f')]({'plain':!![]});_0x1701f2[_0x6188('0x20')]=_0x18f809;_0x1701f2[_0x6188('0x21')]=_0x18f809;_0x1701f2['event']=_0x1701f2[_0x6188('0x22')];Promise['resolve']()['then'](function(){if(typeof _0x1701f2[_0x6188('0x23')]===_0x6188('0x24'))return null;var _0x45ff07=_0x6188('0x25')+_0x1701f2[_0x6188('0x23')];return db[_0x6188('0x26')][_0x6188('0x27')](_0x45ff07,{'type':db[_0x6188('0x28')][_0x6188('0x29')]['SELECT'],'raw':!![]});})['then'](function(_0x39cd85){if(_0x39cd85){_0x1701f2['contact']=_0x39cd85[0x0];}if(typeof _0x1701f2[_0x6188('0x2a')]===_0x6188('0x24'))return;return getAgent(_0x1701f2[_0x6188('0x2a')]);})[_0x6188('0x1b')](function(_0x1bbd29){if(_0x1bbd29){_0x1701f2[_0x6188('0x2b')]=util[_0x6188('0x2c')](_0x6188('0x2d'),_0x1bbd29['name']);_0x1701f2[_0x6188('0x2e')]=_0x1bbd29;_0x1701f2[_0x6188('0x20')]=_0x18f809;return request({'event':'incomingmessage','message':_0x1701f2});}else{return request({'event':_0x6188('0x2f'),'message':_0x1701f2});}})['catch'](function(_0x53b82a){logger[_0x6188('0x1d')]('Trigger,\x20%s','AfterCreateMessage',_0x53b82a);});};}function afterCreateOfflineMessage(_0x318722){return function(_0x2cd282){_0x2cd282=_0x2cd282[_0x6188('0x1f')]({'plain':!![]});_0x2cd282[_0x6188('0x20')]=_0x318722;_0x2cd282[_0x6188('0x21')]=_0x318722;_0x2cd282[_0x6188('0x30')]=_0x6188('0x31');return request({'event':_0x2cd282[_0x6188('0x30')],'message':_0x2cd282});};}function afterCreate(_0x527ca1,_0x41e119){return function(_0xe4ec59){_0xe4ec59=_0xe4ec59[_0x6188('0x1f')]({'plain':!![]});_0xe4ec59['channel']=_0x527ca1;_0xe4ec59[_0x6188('0x21')]=_0x527ca1;_0xe4ec59[_0x6188('0x30')]=_0x6188('0x32');Promise[_0x6188('0x33')]()[_0x6188('0x1b')](function(){var _0x2a193f=_0x6188('0x25')+_0xe4ec59[_0x6188('0x23')];return db[_0x6188('0x26')]['query'](_0x2a193f,{'type':db[_0x6188('0x28')]['QueryTypes'][_0x6188('0x34')],'raw':!![]});})[_0x6188('0x1b')](function(_0x31ff23){if(_0x31ff23){_0xe4ec59[_0x6188('0x35')]=_0x31ff23[0x0];}if(typeof _0xe4ec59[_0x6188('0x2a')]===_0x6188('0x24'))return;return getAgent(_0xe4ec59[_0x6188('0x2a')]);})[_0x6188('0x1b')](function(_0x31e48f){if(_0x31e48f){_0xe4ec59[_0x6188('0x2b')]=util['format'](_0x6188('0x2d'),_0x31e48f['name']);_0xe4ec59[_0x6188('0x2e')]=_0x31e48f;}return request({'event':_0x41e119,'message':_0xe4ec59});})[_0x6188('0x36')](function(_0x4e19c6){logger[_0x6188('0x1d')](_0x6188('0x1c'),_0x6188('0x37'),_0x4e19c6);});};}function afterUpdate(_0x5d9eb6){return function(_0x1de96c){var _0x117089=_0x1de96c[_0x6188('0x38')](_0x6188('0x39'))&&_0x1de96c[_0x6188('0x39')];var _0x14e0c5=_0x1de96c[_0x6188('0x38')]('substatus');if(_0x117089||_0x14e0c5){var _0x10e438=_0x117089?_0x6188('0x7'):_0x6188('0x3a');var _0x1688b3=_0x1de96c[_0x6188('0x1f')]({'plain':!![]});_0x1688b3[_0x6188('0x20')]=_0x5d9eb6;_0x1688b3[_0x6188('0x21')]=_0x5d9eb6;_0x1688b3['event']=_0x117089?_0x6188('0x39'):'substatus';var _0x3315d3=_0x6188('0x25')+_0x1688b3[_0x6188('0x23')];return db[_0x6188('0x26')][_0x6188('0x27')](_0x3315d3,{'type':db[_0x6188('0x28')]['QueryTypes'][_0x6188('0x34')],'raw':!![]})[_0x6188('0x1b')](function(_0x18a093){if(_0x18a093){_0x1688b3[_0x6188('0x35')]=_0x18a093[0x0];}if(typeof _0x1688b3['UserId']==='undefined')return;return getAgent(_0x1688b3[_0x6188('0x2a')]);})[_0x6188('0x1b')](function(_0x2ed78e){if(_0x2ed78e){_0x1688b3['interface']=util[_0x6188('0x2c')](_0x6188('0x2d'),_0x2ed78e[_0x6188('0x3b')]);_0x1688b3[_0x6188('0x2e')]=_0x2ed78e;}return request({'event':_0x10e438,'message':_0x1688b3});})[_0x6188('0x36')](function(_0x3f0967){logger['error']('Trigger,\x20%s',_0x6188('0x3c'),_0x3f0967);});}};}function getAgent(_0x498a65){return db[_0x6188('0x3d')][_0x6188('0x3e')]({'where':{'id':_0x498a65},'attributes':['id',_0x6188('0x3b'),_0x6188('0x3f'),'email',_0x6188('0x40')],'raw':!![]})[_0x6188('0x1b')](function(_0x2a7794){return _0x2a7794;});}exports[_0x6188('0x41')]=function(){for(var _0xc305f6=0x0;_0xc305f6=_0x1cae31[_0x5f0b('0x13')]){throw Error(_0x5f0b('0x14'));}_0x593da4(_0x114969);})[_0x5f0b('0x15')](function(_0x59f480){_0x59bee5(_0x59f480);});});}; \ No newline at end of file +var _0xfae8=['clearBlockUser','isUndefined','blockedAt','updateAttributes','role','User','count','then','agents','catch','lodash','bluebird','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes'];(function(_0x4900e4,_0x125f32){var _0x3ed7f5=function(_0x3083c2){while(--_0x3083c2){_0x4900e4['push'](_0x4900e4['shift']());}};_0x3ed7f5(++_0x125f32);}(_0xfae8,0xb2));var _0x8fae=function(_0x7a095,_0x315413){_0x7a095=_0x7a095-0x0;var _0x75ad5=_0xfae8[_0x7a095];return _0x75ad5;};'use strict';var _=require(_0x8fae('0x0'));var BPromise=require(_0x8fae('0x1'));var db=require(_0x8fae('0x2'))['db'];var util=require('./license/util');var channels=[_0x8fae('0x3'),_0x8fae('0x4'),_0x8fae('0x5'),_0x8fae('0x6'),_0x8fae('0x7'),_0x8fae('0x8'),_0x8fae('0x9')];exports[_0x8fae('0xa')]=function(){return channels;};exports[_0x8fae('0xb')]=function(_0x578c54){_0x578c54=_0x578c54[_0x8fae('0xc')]();return _[_0x8fae('0xd')](channels,_0x578c54);};exports[_0x8fae('0xe')]=function(_0x1da1cf,_0x2f6cca,_0x2f013b,_0xab9640){var _0x2b97ba={'loginAttempts':_0x2f6cca,'blocked':_0x2f013b};if(!_[_0x8fae('0xf')](_0xab9640)){_0x2b97ba[_0x8fae('0x10')]=_0xab9640;}return _0x1da1cf[_0x8fae('0x11')](_0x2b97ba);};exports['getLicense']=function(_0x1d718e){return new BPromise(function(_0x1a864e,_0x56235a){var _0x1cc720=0x0;if(_0x1d718e[_0x8fae('0x12')]!=='agent'){_0x1a864e(_0x1d718e);}db[_0x8fae('0x13')][_0x8fae('0x14')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1d718e['id']}}})[_0x8fae('0x15')](function(_0x433d08){_0x1cc720=_0x433d08;return util['getLicense']();})[_0x8fae('0x15')](function(_0x1c9b0b){if(_0x1c9b0b&&_0x1c9b0b['agents']&&_0x1cc720>=_0x1c9b0b[_0x8fae('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1a864e(_0x1d718e);})[_0x8fae('0x17')](function(_0x258655){_0x56235a(_0x258655);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 9587ab3..52a4dda 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['Bad\x20Request','Forbidden','Not\x20Found','error','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x878f,0x173));var _0xf878=function(_0x4fc508,_0x37bd1d){_0x4fc508=_0x4fc508-0x0;var _0x437160=_0x878f[_0x4fc508];return _0x437160;};'use strict';var util=require('util');var logger=require(_0xf878('0x0'))(_0xf878('0x1'));var APIError=function(_0x2e1d23,_0x12df2b){this[_0xf878('0x2')]=_0x2e1d23||_0xf878('0x3');this[_0xf878('0x4')]=_0x12df2b||_0xf878('0x5');util[_0xf878('0x6')](APIError,Error);};var APIBadRequestError=function(_0xcf1927){this[_0xf878('0x2')]=_0xcf1927||'Bad\x20Request';this['name']=_0xf878('0x7');util[_0xf878('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x59e564){this['message']=_0x59e564||'Entity\x20not\x20found';this[_0xf878('0x4')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x307653){switch(_0x307653){case _0xf878('0x7'):return 0x190;case _0xf878('0x8'),'OutOfInterval':return 0x193;case _0xf878('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x1399a3){return function(_0x531b9c){logger[_0xf878('0xa')](_0x531b9c['stack']);var _0x31d3d2=getStatusCode(_0x531b9c[_0xf878('0x4')]);if(_0x531b9c[_0xf878('0x4')])delete _0x531b9c['name'];return _0x1399a3[_0xf878('0xb')](_0x31d3d2)[_0xf878('0xc')](_0x531b9c);};}module[_0xf878('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x878f=['Bad\x20Request','Forbidden','Not\x20Found','error','status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x878f,0x173));var _0xf878=function(_0x10ae42,_0x3a4278){_0x10ae42=_0x10ae42-0x0;var _0x5bc9ed=_0x878f[_0x10ae42];return _0x5bc9ed;};'use strict';var util=require('util');var logger=require(_0xf878('0x0'))(_0xf878('0x1'));var APIError=function(_0x2e1d23,_0x12df2b){this[_0xf878('0x2')]=_0x2e1d23||_0xf878('0x3');this[_0xf878('0x4')]=_0x12df2b||_0xf878('0x5');util[_0xf878('0x6')](APIError,Error);};var APIBadRequestError=function(_0xcf1927){this[_0xf878('0x2')]=_0xcf1927||'Bad\x20Request';this['name']=_0xf878('0x7');util[_0xf878('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x59e564){this['message']=_0x59e564||'Entity\x20not\x20found';this[_0xf878('0x4')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x307653){switch(_0x307653){case _0xf878('0x7'):return 0x190;case _0xf878('0x8'),'OutOfInterval':return 0x193;case _0xf878('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x1399a3){return function(_0x531b9c){logger[_0xf878('0xa')](_0x531b9c['stack']);var _0x31d3d2=getStatusCode(_0x531b9c[_0xf878('0x4')]);if(_0x531b9c[_0xf878('0x4')])delete _0x531b9c['name'];return _0x1399a3[_0xf878('0xb')](_0x31d3d2)[_0xf878('0xc')](_0x531b9c);};}module[_0xf878('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 a88aa80..ebccd89 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd57b=['send','exports','status','render','json'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xd57b,0x1be));var _0xbd57=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xd57b[_0x5627e1];return _0x2f013f;};'use strict';module[_0xbd57('0x0')][0x194]=function pageNotFound(_0x4a638e,_0x5c869b){var _0x4c253e='404';var _0x179012=0x194;var _0x98d4c4={'status':_0x179012};_0x5c869b[_0xbd57('0x1')](_0x98d4c4['status']);_0x5c869b[_0xbd57('0x2')](_0x4c253e,{},function(_0x590dc4,_0x169563){if(_0x590dc4){return _0x5c869b['status'](_0x98d4c4[_0xbd57('0x1')])[_0xbd57('0x3')](_0x98d4c4);}_0x5c869b[_0xbd57('0x4')](_0x169563);});}; \ No newline at end of file +var _0xd334=['json','send','exports','404','status'];(function(_0x66ebe2,_0x39752f){var _0x3d7dce=function(_0x92740){while(--_0x92740){_0x66ebe2['push'](_0x66ebe2['shift']());}};_0x3d7dce(++_0x39752f);}(_0xd334,0x165));var _0x4d33=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xd334[_0x28947d];return _0x12d2ee;};'use strict';module[_0x4d33('0x0')][0x194]=function pageNotFound(_0x31f8a6,_0x168602){var _0x437d11=_0x4d33('0x1');var _0x32425c=0x194;var _0x30fdc0={'status':_0x32425c};_0x168602[_0x4d33('0x2')](_0x30fdc0[_0x4d33('0x2')]);_0x168602['render'](_0x437d11,{},function(_0x1f2708,_0x1f376b){if(_0x1f2708){return _0x168602[_0x4d33('0x2')](_0x30fdc0['status'])[_0x4d33('0x3')](_0x30fdc0);}_0x168602[_0x4d33('0x4')](_0x1f376b);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 6c7f8d0..a1ee6d4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e19=['../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','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','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','VoicePrefix','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','hasOne','cascade','UserId','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','OpenchannelQueues','UserOpenchannelQueue','cm_user_has_lists','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','belongsTo','IntervalId','mandatoryDispositionPause','Agents','Teams','BlackLists','VoiceMailMessage','mailbox','mailboxuser','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccount','MailAccountId','restrict','MailServerOut','CloudProviderId','Imap','Smtp','Dispositions','Messages','Interactions','Applications','ListId','TemplateId','mandatoryDispositionPauseId','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tag','Attachment','Attachments','Interaction','ChatOfflineMessageId','TagId','MailQueueReport','List','Dashboard','Items','FaxAccountId','fax_interaction_has_tags','Tags','ThroughTags','user_has_fax_interactions','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccount','Answers','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','Users','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroupId','CompanyId','CmContactId','CmCompany','Company','cm_contact_has_tags','CmHopperId','CampaignId','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','FaxApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemType','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SalesforceConfiguration','SalesforceField','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','SugarcrmField','int_desk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','FreshsalesConfiguration','FreshsalesField','FromId','SessionId','SmsQueueReport','ProjectId','team_has_mail_queues','team_has_chat_queues','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','lodash','jstz','determine','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','database','sequelize','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn'];(function(_0x370411,_0x3bbd23){var _0x121901=function(_0x251d7b){while(--_0x251d7b){_0x370411['push'](_0x370411['shift']());}};_0x121901(++_0x3bbd23);}(_0x8e19,0x1c8));var _0x98e1=function(_0x4143d1,_0x4716d0){_0x4143d1=_0x4143d1-0x0;var _0x28d009=_0x8e19[_0x4143d1];return _0x28d009;};'use strict';var config=require(_0x98e1('0x0'));var Sequelize=require('sequelize');var _=require(_0x98e1('0x1'));var jstz=require(_0x98e1('0x2'));var timezone=jstz[_0x98e1('0x3')]();config['sequelize']=_[_0x98e1('0x4')](config['sequelize'],{'database':'motion2','username':_0x98e1('0x5'),'password':'xC@LL1234','options':{'host':_0x98e1('0x6'),'port':0xcea,'dialect':_0x98e1('0x7'),'dialectOptions':{'charset':_0x98e1('0x8')},'logging':![],'timezone':timezone[_0x98e1('0x9')](),'define':{'charset':_0x98e1('0xa'),'collate':_0x98e1('0xb')}}});config[_0x98e1('0xc')]=_[_0x98e1('0x4')](config[_0x98e1('0xc')],{'database':'motion2','username':'xcall','password':_0x98e1('0xd'),'options':{'host':_0x98e1('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x98e1('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x98e1('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x98e1('0xe')],config['sequelize']['username'],config[_0x98e1('0xf')][_0x98e1('0x10')],config[_0x98e1('0xf')][_0x98e1('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x98e1('0xe')],config[_0x98e1('0xc')]['username'],config['sequelizeHistory'][_0x98e1('0x10')],config[_0x98e1('0xc')][_0x98e1('0x11')])};db[_0x98e1('0x12')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/user/user.model');db[_0x98e1('0x14')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x15'));db[_0x98e1('0x16')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x98e1('0x17')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x98e1('0x18')]=db['sequelize']['import'](_0x98e1('0x19'));db['VoiceRecording']=db[_0x98e1('0xf')]['import'](_0x98e1('0x1a'));db[_0x98e1('0x1b')]=db['sequelize'][_0x98e1('0x13')]('../api/screenRecording/screenRecording.model');db[_0x98e1('0x1c')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x1d'));db['VoiceMailMessage']=db[_0x98e1('0xf')]['import'](_0x98e1('0x1e'));db[_0x98e1('0x1f')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x20'));db['VoiceAgentReport']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x21'));db[_0x98e1('0x22')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x23'));db['MemberReport']=db[_0x98e1('0xf')]['import'](_0x98e1('0x24'));db[_0x98e1('0x25')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x26'));db[_0x98e1('0x27')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x28'));db[_0x98e1('0x29')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x2a'));db[_0x98e1('0x2b')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x2c'));db[_0x98e1('0x2d')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x2e'));db[_0x98e1('0x2f')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0x98e1('0x30')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x31'));db[_0x98e1('0x32')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x33'));db['UserOpenchannelQueue']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x34'));db[_0x98e1('0x35')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x36'));db[_0x98e1('0x37')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x38'));db['MailServerOut']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x39'));db['MailAccount']=db[_0x98e1('0xf')]['import'](_0x98e1('0x3a'));db[_0x98e1('0x3b')]=db['sequelize']['import'](_0x98e1('0x3c'));db[_0x98e1('0x3d')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x3e'));db[_0x98e1('0x3f')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x40'));db[_0x98e1('0x41')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x42'));db[_0x98e1('0x43')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x44'));db['MailQueueReport']=db[_0x98e1('0xf')]['import'](_0x98e1('0x45'));db['Dashboard']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x46'));db[_0x98e1('0x47')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x48'));db[_0x98e1('0x49')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x4a'));db[_0x98e1('0x4b')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x4c'));db[_0x98e1('0x4d')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x4e'));db[_0x98e1('0x4f')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x50'));db[_0x98e1('0x51')]=db[_0x98e1('0xf')]['import']('../api/faxQueue/faxQueue.model');db[_0x98e1('0x52')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x53'));db[_0x98e1('0x54')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x55'));db[_0x98e1('0x56')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x57'));db[_0x98e1('0x58')]=db[_0x98e1('0xf')]['import']('../api/smsMessage/smsMessage.model');db[_0x98e1('0x59')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x5a'));db[_0x98e1('0x5b')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x98e1('0x5c')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x5d'));db[_0x98e1('0x5e')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x5f'));db[_0x98e1('0x60')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x61'));db[_0x98e1('0x62')]=db['sequelize']['import'](_0x98e1('0x63'));db[_0x98e1('0x64')]=db['sequelize'][_0x98e1('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0x98e1('0x65')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x66'));db[_0x98e1('0x67')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x68'));db['ChatInteraction']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x69'));db[_0x98e1('0x6a')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x6b'));db[_0x98e1('0x6c')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x6d'));db[_0x98e1('0x6e')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/chatQueue/chatQueue.model');db[_0x98e1('0x6f')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x70'));db[_0x98e1('0x71')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x72'));db['CmCompany']=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x73'));db[_0x98e1('0x74')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x75'));db[_0x98e1('0x76')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x77'));db['CmHopperBlack']=db[_0x98e1('0xf')]['import'](_0x98e1('0x78'));db[_0x98e1('0x79')]=db['sequelize']['import'](_0x98e1('0x7a'));db[_0x98e1('0x7b')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x7c'));db[_0x98e1('0x7d')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x7e'));db['CmCustomField']=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x7f'));db[_0x98e1('0x80')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0x81'));db[_0x98e1('0x82')]=db['sequelize'][_0x98e1('0x13')]('../api/automation/automation.model');db[_0x98e1('0x83')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x84'));db[_0x98e1('0x85')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/disposition/disposition.model');db[_0x98e1('0x86')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/condition/condition.model');db[_0x98e1('0x87')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x88'));db[_0x98e1('0x89')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x8a'));db[_0x98e1('0x8b')]=db['sequelize']['import'](_0x98e1('0x8c'));db['VoiceQueuesLog']=db['sequelize']['import'](_0x98e1('0x8d'));db[_0x98e1('0x8e')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x8f'));db[_0x98e1('0x90')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x91'));db['Tag']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x92'));db['ContactItemType']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x93'));db[_0x98e1('0x94')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x95'));db[_0x98e1('0x96')]=db['sequelize']['import'](_0x98e1('0x97'));db[_0x98e1('0x98')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x99'));db['Trigger']=db['sequelize']['import'](_0x98e1('0x9a'));db[_0x98e1('0x9b')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x9c'));db[_0x98e1('0x9d')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x9e'));db['IntegrationReport']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x9f'));db['AnalyticCustomReport']=db[_0x98e1('0xf')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x98e1('0xa0')]=db['sequelize']['import'](_0x98e1('0xa1'));db['AnalyticExtractedReport']=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db['sequelize'][_0x98e1('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x98e1('0xa2')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xa3'));db[_0x98e1('0xa4')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xa5'));db['SalesforceConfiguration']=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xa6'));db['SalesforceField']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xa7'));db[_0x98e1('0xa8')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xa9'));db[_0x98e1('0xaa')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xab'));db['SugarcrmField']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xac'));db[_0x98e1('0xad')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xae'));db[_0x98e1('0xaf')]=db['sequelize'][_0x98e1('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x98e1('0xb0')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xb1'));db[_0x98e1('0xb2')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xb3'));db[_0x98e1('0xb4')]=db['sequelize'][_0x98e1('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x98e1('0xb5')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xb6'));db[_0x98e1('0xb7')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xb8'));db[_0x98e1('0xb9')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xba'));db[_0x98e1('0xbb')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xbc'));db['FreshdeskAccount']=db['sequelize'][_0x98e1('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x98e1('0xbd')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xbe'));db[_0x98e1('0xbf')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xc0'));db[_0x98e1('0xc1')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xc2'));db['VtigerConfiguration']=db[_0x98e1('0xf')]['import'](_0x98e1('0xc3'));db['VtigerField']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xc4'));db[_0x98e1('0xc5')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xc6'));db[_0x98e1('0xc7')]=db['sequelize']['import'](_0x98e1('0xc8'));db[_0x98e1('0xc9')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xca'));db[_0x98e1('0xcb')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xcc'));db[_0x98e1('0xcd')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x98e1('0xce')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xcf'));db[_0x98e1('0xd0')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xd1'));db['FreshsalesConfiguration']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xd2'));db['FreshsalesField']=db[_0x98e1('0xf')]['import'](_0x98e1('0xd3'));db[_0x98e1('0x9d')]=db[_0x98e1('0xf')]['import']('../api/integration/integration.model');db['Network']=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xd4'));db[_0x98e1('0xd5')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x98e1('0xd6')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xd7'));db['JscriptyAnswerReport']=db[_0x98e1('0xf')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x98e1('0xd8')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xd9'));db[_0x98e1('0xda')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db['sequelize']['import'](_0x98e1('0xdb'));db[_0x98e1('0xdc')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/squareReport/squareReport.model');db[_0x98e1('0xdd')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x98e1('0xde')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x98e1('0xdf')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xe0'));db[_0x98e1('0xe1')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x98e1('0xe2')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xe3'));db[_0x98e1('0xe4')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xe5'));db[_0x98e1('0xe6')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xe7'));db[_0x98e1('0xe8')]=db[_0x98e1('0xf')]['import'](_0x98e1('0xe9'));db[_0x98e1('0xea')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/license/license.model');db[_0x98e1('0xeb')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xec'));db[_0x98e1('0xed')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xee'));db['Attachment']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xef'));db[_0x98e1('0xf0')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xf1'));db[_0x98e1('0xf2')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xf3'));db[_0x98e1('0xf4')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xf5'));db[_0x98e1('0xf6')]=db['sequelize'][_0x98e1('0x13')](_0x98e1('0xf7'));db[_0x98e1('0xf8')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x98e1('0xf9')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/smsTransferReport/smsTransferReport.model');db[_0x98e1('0xfa')]=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x98e1('0xfb')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x98e1('0xfc')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/userProfile/userProfile.model');db[_0x98e1('0xfd')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0xfe'));db['UserProfileResource']=db[_0x98e1('0xf')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x98e1('0xff')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x100'));db[_0x98e1('0x101')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x102'));db[_0x98e1('0x103')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x104'));db[_0x98e1('0x105')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x106'));db[_0x98e1('0x107')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x98e1('0x108')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x109'));db[_0x98e1('0x10a')]=db[_0x98e1('0xf')]['import'](_0x98e1('0x10b'));db[_0x98e1('0x10c')]=db[_0x98e1('0xf')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x98e1('0x10d')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x10e'));db[_0x98e1('0x10f')]=db[_0x98e1('0xf')][_0x98e1('0x13')](_0x98e1('0x110'));db[_0x98e1('0x111')]=db[_0x98e1('0xf')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db[_0x98e1('0x112')]=db[_0x98e1('0xf')][_0x98e1('0x13')]('../api/user-setting/user-setting.model');db['User'][_0x98e1('0x113')](db[_0x98e1('0x1c')],{'as':'VoiceMail','onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')]['hasOne'](db[_0x98e1('0x112')],{'as':_0x98e1('0x116'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x118')],{'as':_0x98e1('0x119'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x29')],{'as':_0x98e1('0x11a'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':_0x98e1('0x11c'),'onDelete':_0x98e1('0x114'),'hooks':!![]});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x79')],{'as':_0x98e1('0x11d'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x7b')],{'as':_0x98e1('0x11e'),'foreignKey':'UserId'});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x7d')],{'as':_0x98e1('0x7d'),'foreignKey':_0x98e1('0x115')});db['User'][_0x98e1('0x117')](db[_0x98e1('0x5e')],{'as':_0x98e1('0x11f'),'foreignKey':_0x98e1('0x115')});db['User'][_0x98e1('0x117')](db[_0x98e1('0x120')],{'as':_0x98e1('0x121'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')]['hasMany'](db['SmsInteraction'],{'as':_0x98e1('0x122'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x4d')],{'as':_0x98e1('0x123'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x3f')],{'as':_0x98e1('0x124'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db[_0x98e1('0x125')],{'as':'WhatsappInteractions','foreignKey':_0x98e1('0x115')});db[_0x98e1('0x12')][_0x98e1('0x117')](db['UserNotification'],{'as':_0x98e1('0x126'),'foreignKey':_0x98e1('0x127')});db[_0x98e1('0x12')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x98e1('0x128')});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0x6f')],{'as':_0x98e1('0x12a'),'through':_0x98e1('0x12b')});db['User']['belongsToMany'](db[_0x98e1('0x74')],{'as':_0x98e1('0x12c'),'through':_0x98e1('0x12d')});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x12e'),'through':'cm_user_has_lists'});db['User'][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':_0x98e1('0x12f')});db['User'][_0x98e1('0x129')](db['MailInteraction'],{'as':_0x98e1('0x124'),'through':_0x98e1('0x130')});db[_0x98e1('0x12')][_0x98e1('0x129')](db['ChatInteraction'],{'as':_0x98e1('0x121'),'through':_0x98e1('0x131')});db['User'][_0x98e1('0x129')](db[_0x98e1('0x4d')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x98e1('0x12')]['belongsToMany'](db[_0x98e1('0x56')],{'as':_0x98e1('0x122'),'through':'user_has_sms_interactions'});db[_0x98e1('0x12')][_0x98e1('0x129')](db['OpenchannelInteraction'],{'as':_0x98e1('0x11f'),'through':_0x98e1('0x132')});db[_0x98e1('0x12')][_0x98e1('0x129')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x98e1('0x12')][_0x98e1('0x129')](db['VoiceQueue'],{'as':_0x98e1('0x133'),'through':_0x98e1('0x2b'),'required':![]});db['User']['belongsToMany'](db[_0x98e1('0xfb')],{'as':_0x98e1('0x134'),'through':_0x98e1('0x111'),'required':![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0x3b')],{'as':_0x98e1('0x135'),'through':_0x98e1('0x2f'),'required':![]});db['User'][_0x98e1('0x129')](db['ChatQueue'],{'as':_0x98e1('0x136'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0x59')],{'as':'SmsQueues','through':_0x98e1('0x32'),'required':![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0x62')],{'as':_0x98e1('0x137'),'through':_0x98e1('0x138'),'required':![]});db['User']['belongsToMany'](db[_0x98e1('0x10a')],{'as':'WhatsappQueues','through':_0x98e1('0x35'),'required':![]});db[_0x98e1('0x12')][_0x98e1('0x129')](db[_0x98e1('0xfa')],{'through':_0x98e1('0x139')});db['User'][_0x98e1('0x129')](db['ChatWebsite'],{'as':_0x98e1('0x13a'),'through':_0x98e1('0x13b')});db[_0x98e1('0x12')][_0x98e1('0x129')](db['FaxAccount'],{'as':'FaxAccounts','through':_0x98e1('0x13c')});db[_0x98e1('0x12')][_0x98e1('0x129')](db['MailAccount'],{'as':_0x98e1('0x13d'),'through':_0x98e1('0x13e')});db['User'][_0x98e1('0x129')](db[_0x98e1('0x5b')],{'as':_0x98e1('0x13f'),'through':_0x98e1('0x140')});db['User'][_0x98e1('0x129')](db['SmsAccount'],{'as':_0x98e1('0x141'),'through':_0x98e1('0x142')});db['User'][_0x98e1('0x129')](db[_0x98e1('0x101')],{'as':_0x98e1('0x143'),'through':_0x98e1('0x144')});db[_0x98e1('0x14')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':_0x98e1('0x145'),'onDelete':_0x98e1('0x114'),'foreignKey':'ChanSpyId'});db[_0x98e1('0x16')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'onDelete':_0x98e1('0x114')});db[_0x98e1('0x11b')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':'Applications','onDelete':'cascade'});db[_0x98e1('0x17')][_0x98e1('0x129')](db[_0x98e1('0x90')],{'as':_0x98e1('0x146'),'through':_0x98e1('0x147')});db[_0x98e1('0x18')][_0x98e1('0x117')](db[_0x98e1('0x29')],{'as':_0x98e1('0x148'),'foreignKey':_0x98e1('0x149')});db[_0x98e1('0x18')][_0x98e1('0x117')](db['CmHopper'],{'as':_0x98e1('0x14a'),'foreignKey':_0x98e1('0x149')});db['VoiceQueue'][_0x98e1('0x117')](db[_0x98e1('0x79')],{'as':_0x98e1('0x11d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x98e1('0x117')](db[_0x98e1('0x7b')],{'as':_0x98e1('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x98e1('0x18')][_0x98e1('0x117')](db[_0x98e1('0x7d')],{'as':'ReportAgentPreview','foreignKey':_0x98e1('0x149')});db[_0x98e1('0x18')][_0x98e1('0x117')](db[_0x98e1('0x14c')],{'as':_0x98e1('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x98e1('0x18')][_0x98e1('0x117')](db['JscriptySessionReport'],{'as':_0x98e1('0x14e'),'foreignKey':_0x98e1('0x149')});db['VoiceQueue']['belongsTo'](db[_0x98e1('0x25')],{'as':_0x98e1('0x25'),'foreignKey':_0x98e1('0x14f')});db[_0x98e1('0x18')]['belongsTo'](db[_0x98e1('0x25')],{'as':_0x98e1('0x150'),'foreignKey':'TrunkBackupId'});db[_0x98e1('0x18')][_0x98e1('0x151')](db[_0x98e1('0x87')],{'as':_0x98e1('0x87'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x18')][_0x98e1('0x151')](db['Pause'],{'as':_0x98e1('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x98e1('0x18')][_0x98e1('0x129')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x12e'),'through':'voice_queues_has_cm_lists'});db[_0x98e1('0x18')][_0x98e1('0x129')](db['User'],{'as':_0x98e1('0x154'),'through':_0x98e1('0x2b')});db[_0x98e1('0x18')][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'as':_0x98e1('0x155'),'through':_0x98e1('0x10d')});db[_0x98e1('0x18')][_0x98e1('0x129')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x156'),'through':'voice_queues_has_cm_blacklists'});db[_0x98e1('0x118')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x12'),'foreignKey':'UserId'});db['ScreenRecording'][_0x98e1('0x151')](db['User'],{'as':_0x98e1('0x12'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x1c')][_0x98e1('0x117')](db[_0x98e1('0x157')],{'as':'Messages','onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x98e1('0x158')});db[_0x98e1('0x157')][_0x98e1('0x151')](db[_0x98e1('0x1c')],{'foreignKey':_0x98e1('0x159'),'targetKey':'mailbox'});db[_0x98e1('0x1f')][_0x98e1('0x117')](db['VoiceQueueReport'],{'as':_0x98e1('0x15a'),'foreignKey':_0x98e1('0x15b'),'constraints':![]});db[_0x98e1('0x1f')][_0x98e1('0x117')](db[_0x98e1('0x15c')],{'as':_0x98e1('0x15d'),'foreignKey':'uniqueid','constraints':![]});db[_0x98e1('0x1f')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':'User','foreignKey':_0x98e1('0x115')});db['VoiceCallReport'][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x37')][_0x98e1('0x151')](db[_0x98e1('0x160')],{'as':_0x98e1('0x160'),'foreignKey':_0x98e1('0x161')});db[_0x98e1('0x37')][_0x98e1('0x151')](db[_0x98e1('0x10c')],{'as':_0x98e1('0x10c'),'foreignKey':'CloudProviderId','onDelete':_0x98e1('0x162')});db[_0x98e1('0x163')][_0x98e1('0x151')](db[_0x98e1('0x160')],{'as':'MailAccount','foreignKey':_0x98e1('0x161')});db[_0x98e1('0x163')][_0x98e1('0x151')](db[_0x98e1('0x10c')],{'as':_0x98e1('0x10c'),'foreignKey':_0x98e1('0x164'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x160')][_0x98e1('0x113')](db[_0x98e1('0x37')],{'as':_0x98e1('0x165'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x160')][_0x98e1('0x113')](db[_0x98e1('0x163')],{'as':_0x98e1('0x166'),'onDelete':'cascade'});db[_0x98e1('0x160')]['hasMany'](db['Disposition'],{'as':_0x98e1('0x167'),'foreignKey':'MailAccountId','onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x98e1('0x83')],{'as':'Answers','foreignKey':_0x98e1('0x161')});db['MailAccount']['hasMany'](db[_0x98e1('0x41')],{'as':_0x98e1('0x168'),'foreignKey':'MailAccountId'});db[_0x98e1('0x160')][_0x98e1('0x117')](db['MailInteraction'],{'as':_0x98e1('0x169')});db[_0x98e1('0x160')][_0x98e1('0x117')](db['MailApplication'],{'as':_0x98e1('0x16a')});db[_0x98e1('0x160')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x98e1('0x16b')});db['MailAccount'][_0x98e1('0x151')](db[_0x98e1('0x98')],{'as':_0x98e1('0x98'),'foreignKey':_0x98e1('0x16c')});db['MailAccount'][_0x98e1('0x151')](db[_0x98e1('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x98e1('0x16d')});db[_0x98e1('0x160')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x13e')});db[_0x98e1('0x3b')][_0x98e1('0x129')](db['User'],{'as':'Agents','through':_0x98e1('0x2f')});db[_0x98e1('0x3b')]['belongsToMany'](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction'][_0x98e1('0x117')](db[_0x98e1('0x41')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x16e')});db[_0x98e1('0x3f')][_0x98e1('0x151')](db['MailAccount'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x161')});db['MailInteraction'][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x3f')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':_0x98e1('0x115')});db['MailInteraction'][_0x98e1('0x129')](db['Tag'],{'through':_0x98e1('0x171'),'as':'Tags'});db[_0x98e1('0x3f')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x171'),'as':'ThroughTags'});db[_0x98e1('0x3f')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Users','through':_0x98e1('0x130'),'foreignKey':_0x98e1('0x16e')});db['MailMessage'][_0x98e1('0x117')](db[_0x98e1('0x173')],{'as':_0x98e1('0x174'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x41')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x12')});db['MailMessage'][_0x98e1('0x151')](db[_0x98e1('0x74')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x15e')});db['MailMessage']['belongsTo'](db['MailInteraction'],{'as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x16e')});db['MailMessage']['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0x98e1('0x161')});db[_0x98e1('0x41')]['belongsTo'](db[_0x98e1('0x64')],{'as':_0x98e1('0x64'),'foreignKey':'ChatWebsiteId'});db[_0x98e1('0x41')]['belongsTo'](db[_0x98e1('0x6c')],{'as':_0x98e1('0x6c'),'foreignKey':_0x98e1('0x176')});db[_0x98e1('0x43')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':'restrict'});db[_0x98e1('0x43')][_0x98e1('0x151')](db[_0x98e1('0x3b')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x43')]['belongsTo'](db[_0x98e1('0x160')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x43')][_0x98e1('0x151')](db[_0x98e1('0x87')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x43')][_0x98e1('0x151')](db[_0x98e1('0x172')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x177')});db[_0x98e1('0x178')][_0x98e1('0x151')](db[_0x98e1('0x160')],{});db['MailQueueReport'][_0x98e1('0x151')](db['CmList'],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x178')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x178')][_0x98e1('0x151')](db[_0x98e1('0x3f')],{});db[_0x98e1('0x178')][_0x98e1('0x151')](db[_0x98e1('0x41')],{});db[_0x98e1('0x178')][_0x98e1('0x151')](db['User'],{});db['MailQueueReport'][_0x98e1('0x151')](db['MailQueue'],{});db[_0x98e1('0x17a')][_0x98e1('0x117')](db['DashboardItem'],{'as':_0x98e1('0x17b'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x49')][_0x98e1('0x117')](db[_0x98e1('0x85')],{'as':_0x98e1('0x167'),'foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0x98e1('0x49')][_0x98e1('0x117')](db[_0x98e1('0x83')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x98e1('0x49')]['hasMany'](db[_0x98e1('0x4d')],{'as':_0x98e1('0x169')});db[_0x98e1('0x49')]['hasMany'](db[_0x98e1('0x4b')],{'as':'Applications'});db[_0x98e1('0x49')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':'Exntensions','onDelete':_0x98e1('0x114')});db[_0x98e1('0x49')][_0x98e1('0x117')](db[_0x98e1('0x4f')],{'as':_0x98e1('0x168')});db['FaxAccount'][_0x98e1('0x151')](db[_0x98e1('0x25')],{'as':'Trunk'});db[_0x98e1('0x49')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x49')]['belongsTo'](db[_0x98e1('0x89')],{'as':_0x98e1('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x98e1('0x49')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Agents','through':_0x98e1('0x13c')});db[_0x98e1('0x4b')][_0x98e1('0x151')](db['User'],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x4b')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x4b')][_0x98e1('0x151')](db[_0x98e1('0x49')],{'onDelete':'restrict'});db[_0x98e1('0x4b')][_0x98e1('0x151')](db[_0x98e1('0x172')],{'onDelete':_0x98e1('0x162'),'foreignKey':'TagId'});db[_0x98e1('0x4d')][_0x98e1('0x117')](db[_0x98e1('0x4f')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':'FaxInteractionId'});db[_0x98e1('0x4d')][_0x98e1('0x151')](db[_0x98e1('0x49')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x17c')});db[_0x98e1('0x4d')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x4d')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':'UserId'});db[_0x98e1('0x4d')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x17d'),'as':_0x98e1('0x17e')});db[_0x98e1('0x4d')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x17d'),'as':_0x98e1('0x17f')});db['FaxInteraction'][_0x98e1('0x129')](db['User'],{'as':'Users','through':_0x98e1('0x180'),'foreignKey':'FaxInteractionId'});db[_0x98e1('0x4f')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x12')});db[_0x98e1('0x4f')][_0x98e1('0x151')](db[_0x98e1('0x4d')],{'as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x181')});db[_0x98e1('0x4f')][_0x98e1('0x151')](db['CmContact'],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x15e')});db['FaxMessage'][_0x98e1('0x151')](db['Attachment'],{'as':'Attachment','foreignKey':_0x98e1('0x182')});db[_0x98e1('0x4f')]['belongsTo'](db['FaxAccount'],{'as':_0x98e1('0x16f'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x30')});db['FaxQueue'][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':_0x98e1('0x183'),'as':'Teams'});db['FaxQueueReport']['belongsTo'](db[_0x98e1('0x49')],{});db[_0x98e1('0x52')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x52')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':'ContactId'});db[_0x98e1('0x52')][_0x98e1('0x151')](db[_0x98e1('0x4d')],{});db[_0x98e1('0x52')][_0x98e1('0x151')](db[_0x98e1('0x4f')],{});db[_0x98e1('0x52')]['belongsTo'](db[_0x98e1('0x12')],{});db['FaxQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x51')],{});db[_0x98e1('0x184')][_0x98e1('0x117')](db['Disposition'],{'as':_0x98e1('0x167'),'foreignKey':'SmsAccountId','onDelete':_0x98e1('0x114')});db[_0x98e1('0x184')][_0x98e1('0x117')](db[_0x98e1('0x83')],{'as':_0x98e1('0x185'),'foreignKey':_0x98e1('0x186')});db[_0x98e1('0x184')]['hasMany'](db[_0x98e1('0x58')],{'as':_0x98e1('0x168'),'foreignKey':_0x98e1('0x186')});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0x98e1('0x169')});db['SmsAccount'][_0x98e1('0x117')](db['SmsApplication'],{'as':_0x98e1('0x16a')});db[_0x98e1('0x184')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':'ListId'});db[_0x98e1('0x184')][_0x98e1('0x151')](db['Pause'],{'as':_0x98e1('0x153'),'foreignKey':_0x98e1('0x16d')});db[_0x98e1('0x184')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x142')});db[_0x98e1('0x54')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x54')]['belongsTo'](db[_0x98e1('0x59')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x54')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x54')][_0x98e1('0x151')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x98e1('0x152')});db[_0x98e1('0x54')]['belongsTo'](db['Tag'],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x177')});db[_0x98e1('0x56')][_0x98e1('0x117')](db[_0x98e1('0x58')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x187')});db[_0x98e1('0x56')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'as':_0x98e1('0x16f'),'foreignKey':'SmsAccountId'});db[_0x98e1('0x56')][_0x98e1('0x151')](db['CmContact'],{'as':'Contact','foreignKey':_0x98e1('0x15f')});db['SmsInteraction'][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':'Owner','foreignKey':_0x98e1('0x115')});db[_0x98e1('0x56')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x188'),'as':_0x98e1('0x17e')});db[_0x98e1('0x56')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x188'),'as':_0x98e1('0x17f')});db[_0x98e1('0x56')][_0x98e1('0x129')](db['User'],{'as':'Users','through':_0x98e1('0x189'),'foreignKey':_0x98e1('0x187')});db[_0x98e1('0x58')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':'User'});db[_0x98e1('0x58')]['belongsTo'](db['CmContact'],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x15e')});db[_0x98e1('0x58')][_0x98e1('0x151')](db['SmsInteraction'],{'onDelete':'cascade','as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x187')});db[_0x98e1('0x58')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'as':_0x98e1('0x16f'),'foreignKey':'SmsAccountId'});db[_0x98e1('0x59')][_0x98e1('0x129')](db['User'],{'as':_0x98e1('0x154'),'through':_0x98e1('0x32'),'foreignKey':_0x98e1('0x18a')});db[_0x98e1('0x59')][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':_0x98e1('0x18b'),'as':'Teams'});db[_0x98e1('0x5b')][_0x98e1('0x117')](db[_0x98e1('0x85')],{'as':_0x98e1('0x167'),'foreignKey':_0x98e1('0x18c'),'onDelete':_0x98e1('0x114')});db['OpenchannelAccount'][_0x98e1('0x117')](db[_0x98e1('0x83')],{'as':_0x98e1('0x185'),'foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5b')][_0x98e1('0x117')](db[_0x98e1('0x5e')],{'as':_0x98e1('0x169'),'foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5b')][_0x98e1('0x117')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5b')][_0x98e1('0x117')](db[_0x98e1('0x5c')],{'as':'Applications','foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5b')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db['OpenchannelAccount'][_0x98e1('0x151')](db[_0x98e1('0x89')],{'as':_0x98e1('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x98e1('0x5b')]['belongsToMany'](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x140')});db[_0x98e1('0x5c')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x5c')][_0x98e1('0x151')](db[_0x98e1('0x62')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x18d')});db[_0x98e1('0x5c')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x98e1('0x162'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x98e1('0x151')](db[_0x98e1('0x87')],{'onDelete':'restrict','foreignKey':_0x98e1('0x152')});db['OpenchannelApplication'][_0x98e1('0x151')](db['Tag'],{'onDelete':_0x98e1('0x162'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0x98e1('0x117')](db[_0x98e1('0x60')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x18e')});db[_0x98e1('0x5e')][_0x98e1('0x151')](db[_0x98e1('0x5b')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x5e')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':'Contact','foreignKey':_0x98e1('0x15f')});db['OpenchannelInteraction'][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x98e1('0x129')](db['Tag'],{'through':_0x98e1('0x18f'),'as':'Tags'});db[_0x98e1('0x5e')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x18f'),'as':_0x98e1('0x17f')});db[_0x98e1('0x5e')]['belongsToMany'](db[_0x98e1('0x12')],{'as':_0x98e1('0x190'),'through':'user_has_openchannel_interactions','foreignKey':_0x98e1('0x18e')});db[_0x98e1('0x60')]['belongsTo'](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x114'),'as':'User'});db[_0x98e1('0x60')][_0x98e1('0x151')](db['CmContact'],{'onDelete':'cascade','as':_0x98e1('0x15e')});db['OpenchannelMessage']['belongsTo'](db[_0x98e1('0x5e')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x175'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage']['belongsTo'](db['Attachment'],{'as':_0x98e1('0x173'),'foreignKey':_0x98e1('0x182')});db['OpenchannelMessage'][_0x98e1('0x151')](db[_0x98e1('0x5b')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x18c')});db[_0x98e1('0x62')][_0x98e1('0x129')](db['User'],{'as':_0x98e1('0x154'),'through':_0x98e1('0x138'),'foreignKey':_0x98e1('0x18d')});db[_0x98e1('0x62')][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':'team_has_openchannel_queues','as':'Teams'});db['ChatWebsite'][_0x98e1('0x117')](db[_0x98e1('0x85')],{'as':_0x98e1('0x167'),'foreignKey':_0x98e1('0x191'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x64')][_0x98e1('0x117')](db['CannedAnswer'],{'as':_0x98e1('0x185'),'foreignKey':'ChatWebsiteId'});db[_0x98e1('0x64')][_0x98e1('0x117')](db[_0x98e1('0x71')],{'as':_0x98e1('0x192')});db[_0x98e1('0x64')][_0x98e1('0x117')](db[_0x98e1('0x120')],{'as':'Interactions'});db['ChatWebsite'][_0x98e1('0x117')](db[_0x98e1('0x67')],{'as':_0x98e1('0x16a')});db[_0x98e1('0x64')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0x98e1('0x64')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x64')][_0x98e1('0x151')](db[_0x98e1('0x87')],{'as':_0x98e1('0x87'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x64')][_0x98e1('0x151')](db['MailAccount'],{'as':_0x98e1('0x160'),'foreignKey':_0x98e1('0x161')});db[_0x98e1('0x64')][_0x98e1('0x151')](db[_0x98e1('0x89')],{'as':_0x98e1('0x153'),'foreignKey':_0x98e1('0x16d')});db[_0x98e1('0x64')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x13b')});db[_0x98e1('0x65')][_0x98e1('0x151')](db['OpenchannelAccount'],{});db[_0x98e1('0x65')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x65')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x98e1('0x65')][_0x98e1('0x151')](db['OpenchannelInteraction'],{});db[_0x98e1('0x65')][_0x98e1('0x151')](db[_0x98e1('0x60')],{});db[_0x98e1('0x65')][_0x98e1('0x151')](db[_0x98e1('0x12')],{});db[_0x98e1('0x65')][_0x98e1('0x151')](db[_0x98e1('0x62')],{});db[_0x98e1('0x67')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x193'),'foreignKey':_0x98e1('0x115'),'onDelete':'restrict'});db[_0x98e1('0x67')][_0x98e1('0x151')](db[_0x98e1('0x6e')],{'as':_0x98e1('0x194'),'foreignKey':_0x98e1('0x195'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x67')][_0x98e1('0x151')](db[_0x98e1('0x64')],{'as':_0x98e1('0x196'),'foreignKey':_0x98e1('0x191'),'onDelete':_0x98e1('0x162')});db['ChatApplication'][_0x98e1('0x151')](db[_0x98e1('0x172')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x177')});db['ChatInteraction']['hasMany'](db[_0x98e1('0x6a')],{'as':_0x98e1('0x168'),'onDelete':_0x98e1('0x114'),'foreignKey':'ChatInteractionId'});db[_0x98e1('0x120')][_0x98e1('0x151')](db['ChatWebsite'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x191')});db[_0x98e1('0x120')][_0x98e1('0x151')](db['CmContact'],{'as':_0x98e1('0x15e'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':_0x98e1('0x115')});db[_0x98e1('0x120')][_0x98e1('0x129')](db['Tag'],{'through':_0x98e1('0x197'),'as':'Tags'});db['ChatInteraction'][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x197'),'as':_0x98e1('0x17f')});db[_0x98e1('0x120')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Users','through':_0x98e1('0x131'),'foreignKey':_0x98e1('0x198')});db[_0x98e1('0x6a')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':'cascade','as':_0x98e1('0x12')});db[_0x98e1('0x6a')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'onDelete':'cascade','as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x6a')][_0x98e1('0x151')](db[_0x98e1('0x120')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x198')});db['ChatMessage'][_0x98e1('0x151')](db[_0x98e1('0x173')],{'as':'Attachment','foreignKey':_0x98e1('0x182')});db[_0x98e1('0x6a')][_0x98e1('0x151')](db[_0x98e1('0x64')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x98e1('0x6c')][_0x98e1('0x117')](db[_0x98e1('0x173')],{'as':_0x98e1('0x174'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x98e1('0x114'),'hooks':!![]});db[_0x98e1('0x6c')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x6c')][_0x98e1('0x151')](db[_0x98e1('0x64')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x191')});db[_0x98e1('0x6e')]['belongsToMany'](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':'team_has_chat_queues','as':_0x98e1('0x155')});db['ChatGroup'][_0x98e1('0x117')](db[_0x98e1('0xd6')],{'as':'Messages','foreignKey':_0x98e1('0x199'),'onDelete':'cascade'});db[_0x98e1('0x6f')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Members','through':'chat_group_has_users'});db[_0x98e1('0x71')][_0x98e1('0x151')](db[_0x98e1('0x64')],{'as':_0x98e1('0x196'),'foreignKey':_0x98e1('0x191')});db['CmCompany'][_0x98e1('0x117')](db[_0x98e1('0x74')],{'as':_0x98e1('0x12c'),'foreignKey':_0x98e1('0x19a')});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x94')],{'as':'Phones','foreignKey':_0x98e1('0x19b')});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x76')],{'as':_0x98e1('0x14a'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x74')]['hasMany'](db[_0x98e1('0x79')],{'as':_0x98e1('0x11d'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x7b')],{'as':_0x98e1('0x14b'),'foreignKey':'ContactId'});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x7d')],{'as':_0x98e1('0x7d'),'foreignKey':_0x98e1('0x15f')});db['CmContact'][_0x98e1('0x117')](db[_0x98e1('0xda')],{'as':_0x98e1('0x14e'),'foreignKey':'ContactId'});db['CmContact'][_0x98e1('0x117')](db[_0x98e1('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0x98e1('0x15f'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x74')][_0x98e1('0x117')](db[_0x98e1('0x120')],{'as':_0x98e1('0x121'),'foreignKey':'ContactId','onDelete':_0x98e1('0x162')});db[_0x98e1('0x74')]['hasMany'](db['SmsInteraction'],{'as':_0x98e1('0x122'),'foreignKey':_0x98e1('0x15f'),'onDelete':_0x98e1('0x162')});db['CmContact'][_0x98e1('0x117')](db['FaxInteraction'],{'as':_0x98e1('0x123'),'foreignKey':_0x98e1('0x15f'),'onDelete':'restrict'});db[_0x98e1('0x74')][_0x98e1('0x117')](db['MailInteraction'],{'as':_0x98e1('0x124'),'foreignKey':'ContactId','onDelete':_0x98e1('0x162')});db[_0x98e1('0x74')][_0x98e1('0x151')](db[_0x98e1('0x19c')],{'as':_0x98e1('0x19d'),'foreignKey':'CompanyId'});db[_0x98e1('0x74')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':'List','foreignKey':_0x98e1('0x16b'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x74')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x190'),'through':_0x98e1('0x12d')});db[_0x98e1('0x74')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'as':_0x98e1('0x17e'),'through':_0x98e1('0x19e')});db[_0x98e1('0x74')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':'cm_contact_has_tags','as':_0x98e1('0x17f')});db['CmHopper'][_0x98e1('0x117')](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x98e1('0x19f')});db[_0x98e1('0x76')][_0x98e1('0x151')](db['CmContact'],{'as':'Contact','foreignKey':_0x98e1('0x15f'),'onDelete':_0x98e1('0x114')});db['CmHopper'][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':'List','foreignKey':_0x98e1('0x16b'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x76')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x193'),'foreignKey':'UserId'});db['CmHopper'][_0x98e1('0x151')](db[_0x98e1('0x18')],{'as':_0x98e1('0x194'),'foreignKey':_0x98e1('0x149'),'onDelete':'cascade'});db[_0x98e1('0x76')]['belongsTo'](db[_0x98e1('0xeb')],{'as':_0x98e1('0xeb'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x98e1('0x76')]['belongsTo'](db[_0x98e1('0x12')],{'as':_0x98e1('0x170'),'foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0x98e1('0x74')],{'as':'Contact','foreignKey':_0x98e1('0x15f'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x14c')][_0x98e1('0x151')](db['CmList'],{'as':_0x98e1('0x179'),'foreignKey':'ListId','onDelete':_0x98e1('0x114')});db[_0x98e1('0x14c')][_0x98e1('0x151')](db[_0x98e1('0x18')],{'as':_0x98e1('0x194'),'foreignKey':_0x98e1('0x149'),'onDelete':'cascade'});db[_0x98e1('0x14c')][_0x98e1('0x151')](db[_0x98e1('0xeb')],{'as':_0x98e1('0xeb'),'foreignKey':_0x98e1('0x1a0'),'onDelete':_0x98e1('0x114')});db['Automation'][_0x98e1('0x117')](db['Condition'],{'as':{'plural':_0x98e1('0x1a1'),'singular':_0x98e1('0x1a2')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x98e1('0x82')][_0x98e1('0x117')](db[_0x98e1('0x86')],{'as':{'plural':_0x98e1('0x1a3'),'singular':_0x98e1('0x1a4')},'foreignKey':_0x98e1('0x1a5'),'onDelete':_0x98e1('0x114'),'hooks':!![]});db['Automation'][_0x98e1('0x117')](db[_0x98e1('0x80')],{'as':_0x98e1('0x1a6'),'foreignKey':_0x98e1('0x1a7'),'onDelete':'cascade','hooks':!![]});db['Disposition']['hasMany'](db['Disposition'],{'as':_0x98e1('0x167'),'foreignKey':'ParentId','onDelete':_0x98e1('0x114')});db[_0x98e1('0x87')][_0x98e1('0x117')](db[_0x98e1('0x87')],{'as':_0x98e1('0x1a8'),'foreignKey':_0x98e1('0x152'),'onDelete':_0x98e1('0x114'),'hooks':!![],'required':![]});db[_0x98e1('0x87')][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':_0x98e1('0x11c'),'foreignKey':_0x98e1('0x152'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x87')][_0x98e1('0x117')](db['MailApplication'],{'as':_0x98e1('0x1a9'),'foreignKey':_0x98e1('0x152')});db['Interval'][_0x98e1('0x117')](db[_0x98e1('0x67')],{'as':'ChatApplications','foreignKey':_0x98e1('0x152')});db[_0x98e1('0x87')][_0x98e1('0x117')](db['FaxApplication'],{'as':_0x98e1('0x1aa'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x87')][_0x98e1('0x117')](db[_0x98e1('0x54')],{'as':'SmsApplications','foreignKey':_0x98e1('0x152')});db[_0x98e1('0x8e')][_0x98e1('0x151')](db[_0x98e1('0x160')],{});db['Schedule'][_0x98e1('0x151')](db[_0x98e1('0xa0')],{'foreignKey':_0x98e1('0x1ab')});db[_0x98e1('0x8e')][_0x98e1('0x151')](db[_0x98e1('0x1ac')],{'foreignKey':_0x98e1('0x1ad')});db[_0x98e1('0x90')][_0x98e1('0x129')](db['VoiceMusicOnHold'],{'as':_0x98e1('0x1ae'),'through':_0x98e1('0x147'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x74')],{'through':_0x98e1('0x19e')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x120')],{'through':_0x98e1('0x197')});db['Tag'][_0x98e1('0x129')](db['MailInteraction'],{'through':_0x98e1('0x171')});db[_0x98e1('0x172')]['belongsToMany'](db[_0x98e1('0x56')],{'through':_0x98e1('0x188')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x4d')],{'through':_0x98e1('0x17d')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x5e')],{'through':_0x98e1('0x18f')});db[_0x98e1('0x172')][_0x98e1('0x129')](db[_0x98e1('0x125')],{'through':_0x98e1('0x1af')});db[_0x98e1('0x94')][_0x98e1('0x151')](db[_0x98e1('0x1b0')],{'as':_0x98e1('0x1b1'),'foreignKey':'ItemTypeId'});db[_0x98e1('0x96')][_0x98e1('0x151')](db[_0x98e1('0x76')],{'as':_0x98e1('0x1b2'),'foreignKey':'CmHopperId'});db['CmContactHasItem'][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':'CmContactId'});db[_0x98e1('0x1b3')][_0x98e1('0x117')](db['Condition'],{'as':{'plural':_0x98e1('0x1b4'),'singular':_0x98e1('0x1b5')},'foreignKey':_0x98e1('0x1b6'),'onDelete':_0x98e1('0x114'),'hooks':!![]});db['Trigger'][_0x98e1('0x117')](db[_0x98e1('0x86')],{'as':{'plural':_0x98e1('0x1b7'),'singular':_0x98e1('0x1b8')},'foreignKey':_0x98e1('0x1b9'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x98e1('0x117')](db[_0x98e1('0x80')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x98e1('0x114'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x98e1('0x1ba')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x98e1('0xa0')][_0x98e1('0x117')](db[_0x98e1('0x1ba')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1ab')});db[_0x98e1('0x1bc')][_0x98e1('0x117')](db[_0x98e1('0x1ba')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bd')});db[_0x98e1('0x1ba')][_0x98e1('0x151')](db[_0x98e1('0x1bc')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x98e1('0x117')](db['SalesforceConfiguration'],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0x1c0')][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1c2'),'onDelete':_0x98e1('0x114'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x98e1('0x117')](db['SalesforceField'],{'as':_0x98e1('0x1c3'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c4')});db['SalesforceConfiguration'][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0x1c0')]['belongsTo'](db[_0x98e1('0xa4')],{'as':_0x98e1('0x16f'),'foreignKey':'AccountId'});db[_0x98e1('0x1c1')][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db['SalesforceField'][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1c1')][_0x98e1('0x117')](db[_0x98e1('0x1c1')],{'as':_0x98e1('0x1c9'),'foreignKey':'FieldId'});db[_0x98e1('0x1c1')]['belongsTo'](db[_0x98e1('0x9b')],{'as':'Variable','foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xa8')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xaa')][_0x98e1('0x117')](db[_0x98e1('0x1cb')],{'as':_0x98e1('0x1c2'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xaa')][_0x98e1('0x117')](db[_0x98e1('0x1cb')],{'as':'Descriptions','onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c4')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x98e1('0xaa')][_0x98e1('0x151')](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0x98e1('0x1bf')});db['SugarcrmField'][_0x98e1('0x117')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0x1cb')][_0x98e1('0x117')](db['SugarcrmField'],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1cb')][_0x98e1('0x117')](db[_0x98e1('0x1cb')],{'as':_0x98e1('0x1c9'),'foreignKey':'FieldId'});db[_0x98e1('0x1cb')]['belongsTo'](db['Variable'],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db['DeskAccount'][_0x98e1('0x117')](db[_0x98e1('0xaf')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x98e1('0x1bf')});db['DeskConfiguration'][_0x98e1('0x117')](db[_0x98e1('0xb0')],{'as':_0x98e1('0x1c2'),'onDelete':'cascade','foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xaf')][_0x98e1('0x117')](db[_0x98e1('0xb0')],{'as':'Descriptions','onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xaf')][_0x98e1('0x117')](db[_0x98e1('0xb0')],{'as':_0x98e1('0x1bb'),'onDelete':'cascade','foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xaf')][_0x98e1('0x151')](db[_0x98e1('0xad')],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xaf')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x1cc')});db[_0x98e1('0xb0')][_0x98e1('0x117')](db['DeskField'],{'as':'Subject','foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xb0')]['hasMany'](db[_0x98e1('0xb0')],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xb0')][_0x98e1('0x117')](db['DeskField'],{'as':_0x98e1('0x1c9'),'foreignKey':'FieldId'});db[_0x98e1('0xb0')][_0x98e1('0x151')](db['Variable'],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xb2')][_0x98e1('0x117')](db[_0x98e1('0xb4')],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xb4')][_0x98e1('0x117')](db['ZohoField'],{'as':'Subjects','onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xb4')][_0x98e1('0x117')](db[_0x98e1('0xb5')],{'as':_0x98e1('0x1c3'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xb4')][_0x98e1('0x117')](db['ZohoField'],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xb4')][_0x98e1('0x151')](db[_0x98e1('0xb2')],{'as':_0x98e1('0x16f'),'foreignKey':'AccountId'});db[_0x98e1('0xb5')][_0x98e1('0x117')](db[_0x98e1('0xb5')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xb5')]['hasMany'](db[_0x98e1('0xb5')],{'as':'Description','foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xb5')][_0x98e1('0x117')](db[_0x98e1('0xb5')],{'as':_0x98e1('0x1c9'),'foreignKey':'FieldId'});db[_0x98e1('0xb5')][_0x98e1('0x151')](db['Variable'],{'as':_0x98e1('0x9b'),'foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0x98e1('0xb9')],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xb9')][_0x98e1('0x117')](db[_0x98e1('0xbb')],{'as':_0x98e1('0x1c2'),'foreignKey':_0x98e1('0x1c7')});db['ZendeskConfiguration']['hasMany'](db[_0x98e1('0xbb')],{'as':_0x98e1('0x1c3'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xb9')]['hasMany'](db['ZendeskField'],{'as':_0x98e1('0x1bb'),'foreignKey':'FieldId'});db[_0x98e1('0xb9')][_0x98e1('0x151')](db[_0x98e1('0xb7')],{'as':'Account','foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xb9')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x98e1('0x117')](db[_0x98e1('0xbb')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x98e1('0xbb')][_0x98e1('0x117')](db[_0x98e1('0xbb')],{'as':_0x98e1('0x1c8'),'foreignKey':'DescriptionId'});db[_0x98e1('0xbb')][_0x98e1('0x117')](db[_0x98e1('0xbb')],{'as':_0x98e1('0x1c9'),'foreignKey':_0x98e1('0x1c5')});db['ZendeskField']['belongsTo'](db[_0x98e1('0x9b')],{'as':_0x98e1('0x9b'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x98e1('0x117')](db[_0x98e1('0xbd')],{'as':_0x98e1('0x1be'),'onDelete':'cascade','foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c2'),'onDelete':'cascade','foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xbd')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x98e1('0xbd')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1bb'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xbd')][_0x98e1('0x151')](db['FreshdeskAccount'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xbd')][_0x98e1('0x129')](db['Tag'],{'through':_0x98e1('0x1cd')});db[_0x98e1('0xbf')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xbf')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0xbf')][_0x98e1('0x117')](db[_0x98e1('0xbf')],{'as':_0x98e1('0x1c9'),'foreignKey':_0x98e1('0x1c5')});db['FreshdeskField'][_0x98e1('0x151')](db[_0x98e1('0x9b')],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xc1')][_0x98e1('0x117')](db[_0x98e1('0x1ce')],{'as':_0x98e1('0x1be'),'onDelete':'cascade','foreignKey':_0x98e1('0x1bf')});db['VtigerConfiguration'][_0x98e1('0x117')](db[_0x98e1('0x1cf')],{'as':'Subjects','foreignKey':'SubjectId'});db['VtigerConfiguration'][_0x98e1('0x117')](db[_0x98e1('0x1cf')],{'as':_0x98e1('0x1c3'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1ce')]['hasMany'](db[_0x98e1('0x1cf')],{'as':_0x98e1('0x1bb'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0x1ce')][_0x98e1('0x151')](db[_0x98e1('0xc1')],{'as':_0x98e1('0x16f'),'foreignKey':'AccountId'});db[_0x98e1('0x1cf')][_0x98e1('0x117')](db['VtigerField'],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0x1cf')][_0x98e1('0x117')](db['VtigerField'],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1cf')][_0x98e1('0x117')](db['VtigerField'],{'as':'Field','foreignKey':_0x98e1('0x1c5')});db['VtigerField'][_0x98e1('0x151')](db[_0x98e1('0x9b')],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xc5')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x98e1('0x114'),'foreignKey':'AccountId'});db[_0x98e1('0xc7')][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':_0x98e1('0x1c2'),'foreignKey':_0x98e1('0x1c7')});db['ServicenowConfiguration'][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':_0x98e1('0x1c3'),'foreignKey':_0x98e1('0x1c4')});db['ServicenowConfiguration'][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':'Fields','foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xc7')][_0x98e1('0x151')](db['ServicenowAccount'],{'as':_0x98e1('0x16f'),'foreignKey':'AccountId'});db[_0x98e1('0xc9')][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xc9')][_0x98e1('0x117')](db['ServicenowField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x98e1('0xc9')][_0x98e1('0x117')](db[_0x98e1('0xc9')],{'as':_0x98e1('0x1c9'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xc9')]['belongsTo'](db[_0x98e1('0x9b')],{'as':'Variable','foreignKey':'VariableId'});db[_0x98e1('0xcb')][_0x98e1('0x117')](db['Dynamics365Configuration'],{'as':_0x98e1('0x1be'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1bf')});db['Dynamics365Account'][_0x98e1('0x151')](db[_0x98e1('0x10c')],{'as':_0x98e1('0x10c'),'foreignKey':_0x98e1('0x164')});db['Dynamics365Configuration']['hasMany'](db[_0x98e1('0xce')],{'as':_0x98e1('0x1c2'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xcd')][_0x98e1('0x117')](db['Dynamics365Field'],{'as':_0x98e1('0x1c3'),'onDelete':_0x98e1('0x114'),'foreignKey':'DescriptionId'});db[_0x98e1('0xcd')][_0x98e1('0x117')](db[_0x98e1('0xce')],{'as':_0x98e1('0x1bb'),'onDelete':'cascade','foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0xcd')][_0x98e1('0x151')](db['Dynamics365Account'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0xce')][_0x98e1('0x117')](db[_0x98e1('0xce')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0xce')][_0x98e1('0x117')](db['Dynamics365Field'],{'as':_0x98e1('0x1c8'),'foreignKey':_0x98e1('0x1c4')});db['Dynamics365Field'][_0x98e1('0x117')](db[_0x98e1('0xce')],{'as':'Field','foreignKey':_0x98e1('0x1c5')});db['Dynamics365Field']['belongsTo'](db[_0x98e1('0x9b')],{'as':_0x98e1('0x9b'),'foreignKey':_0x98e1('0x1ca')});db[_0x98e1('0xd0')][_0x98e1('0x117')](db[_0x98e1('0x1d0')],{'as':_0x98e1('0x1be'),'onDelete':'cascade','foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0x1d0')][_0x98e1('0x117')](db['FreshsalesField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x98e1('0x1d0')][_0x98e1('0x117')](db[_0x98e1('0x1d1')],{'as':_0x98e1('0x1c3'),'foreignKey':_0x98e1('0x1c4')});db[_0x98e1('0x1d0')][_0x98e1('0x117')](db[_0x98e1('0x1d1')],{'as':_0x98e1('0x1bb'),'foreignKey':'FieldId'});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1bf')});db[_0x98e1('0x1d1')][_0x98e1('0x117')](db[_0x98e1('0x1d1')],{'as':_0x98e1('0x1c6'),'foreignKey':_0x98e1('0x1c7')});db[_0x98e1('0x1d1')]['hasMany'](db[_0x98e1('0x1d1')],{'as':'Description','foreignKey':_0x98e1('0x1c4')});db['FreshsalesField'][_0x98e1('0x117')](db[_0x98e1('0x1d1')],{'as':_0x98e1('0x1c9'),'foreignKey':_0x98e1('0x1c5')});db[_0x98e1('0x1d1')][_0x98e1('0x151')](db[_0x98e1('0x9b')],{'as':'Variable','foreignKey':_0x98e1('0x1ca')});db['ChatQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x64')],{});db[_0x98e1('0xd5')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':'List','foreignKey':_0x98e1('0x16b')});db[_0x98e1('0xd5')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db['ChatQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x120')],{});db['ChatQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x6a')],{});db[_0x98e1('0xd5')][_0x98e1('0x151')](db[_0x98e1('0x12')],{});db[_0x98e1('0xd5')]['belongsTo'](db['ChatQueue'],{});db[_0x98e1('0xd6')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x1d2')});db[_0x98e1('0xd6')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x114'),'foreignKey':'ToId'});db[_0x98e1('0xda')][_0x98e1('0x117')](db[_0x98e1('0xd8')],{'foreignKey':_0x98e1('0x1d3'),'onDelete':_0x98e1('0x114')});db['JscriptySessionReport'][_0x98e1('0x117')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x98e1('0x114')});db['SmsQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x184')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x56')],{});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x58')],{});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x12')],{});db[_0x98e1('0x1d4')][_0x98e1('0x151')](db[_0x98e1('0x59')],{});db[_0x98e1('0xde')]['hasMany'](db[_0x98e1('0xda')],{'foreignKey':_0x98e1('0x1d5')});db['JscriptyProject']['hasMany'](db[_0x98e1('0xd8')],{'foreignKey':'ProjectId'});db[_0x98e1('0xde')][_0x98e1('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0x98e1('0x1d5')});db['Team'][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x12f')});db[_0x98e1('0xe8')][_0x98e1('0x129')](db['VoiceQueue'],{'through':_0x98e1('0x10d'),'as':_0x98e1('0x133')});db[_0x98e1('0xe8')][_0x98e1('0x129')](db['MailQueue'],{'through':_0x98e1('0x1d6'),'as':_0x98e1('0x135')});db[_0x98e1('0xe8')]['belongsToMany'](db['ChatQueue'],{'through':_0x98e1('0x1d7'),'as':_0x98e1('0x136')});db[_0x98e1('0xe8')]['belongsToMany'](db['FaxQueue'],{'through':_0x98e1('0x183'),'as':_0x98e1('0x1d8')});db[_0x98e1('0xe8')][_0x98e1('0x129')](db[_0x98e1('0x59')],{'through':_0x98e1('0x18b'),'as':'SmsQueues'});db[_0x98e1('0xe8')][_0x98e1('0x129')](db[_0x98e1('0x62')],{'through':_0x98e1('0x1d9'),'as':'OpenchannelQueues'});db[_0x98e1('0xe8')]['belongsToMany'](db['WhatsappQueue'],{'through':_0x98e1('0x1da'),'as':'WhatsappQueues'});db['Team'][_0x98e1('0x129')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':_0x98e1('0x134')});db[_0x98e1('0xeb')][_0x98e1('0x117')](db[_0x98e1('0x76')],{'as':_0x98e1('0x14a'),'foreignKey':'CampaignId'});db[_0x98e1('0xeb')]['hasMany'](db[_0x98e1('0x79')],{'as':'HopperFinals','foreignKey':_0x98e1('0x1a0')});db[_0x98e1('0xeb')][_0x98e1('0x117')](db['CmHopperHistory'],{'as':_0x98e1('0x14b'),'foreignKey':_0x98e1('0x1a0')});db[_0x98e1('0xeb')][_0x98e1('0x117')](db[_0x98e1('0x14c')],{'as':_0x98e1('0x14d'),'foreignKey':_0x98e1('0x1a0')});db['Campaign'][_0x98e1('0x151')](db[_0x98e1('0x25')],{'as':'Trunk','foreignKey':_0x98e1('0x14f')});db[_0x98e1('0xeb')][_0x98e1('0x151')](db[_0x98e1('0x25')],{'as':_0x98e1('0x150'),'foreignKey':_0x98e1('0x1db')});db[_0x98e1('0xeb')]['belongsTo'](db[_0x98e1('0x87')],{'as':_0x98e1('0x87'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0xeb')]['belongsTo'](db['SquareProject'],{'as':_0x98e1('0xe2'),'foreignKey':_0x98e1('0x1dc')});db[_0x98e1('0xeb')]['belongsToMany'](db[_0x98e1('0xfa')],{'as':_0x98e1('0x12e'),'through':'campaigns_has_cm_lists'});db[_0x98e1('0xeb')]['belongsToMany'](db['CmList'],{'as':_0x98e1('0x156'),'through':_0x98e1('0x1dd')});db[_0x98e1('0x173')][_0x98e1('0x151')](db[_0x98e1('0x6c')],{'as':_0x98e1('0x6c'),'foreignKey':_0x98e1('0x176')});db[_0x98e1('0xf2')][_0x98e1('0x151')](db[_0x98e1('0x41')],{});db[_0x98e1('0xf2')][_0x98e1('0x151')](db['MailInteraction'],{});db['MailTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x160')],{'foreignKey':_0x98e1('0x1de'),'as':_0x98e1('0x1df')});db['MailTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0xf2')]['belongsTo'](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e2'),'as':'ToAgent'});db[_0x98e1('0xf2')][_0x98e1('0x151')](db[_0x98e1('0x3b')],{'foreignKey':_0x98e1('0x1e3'),'as':_0x98e1('0x1e4')});db[_0x98e1('0xf2')][_0x98e1('0x151')](db[_0x98e1('0x160')],{'foreignKey':_0x98e1('0x1e5'),'as':_0x98e1('0x1e6')});db[_0x98e1('0xf4')]['belongsTo'](db[_0x98e1('0x6a')],{});db['ChatTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x120')],{});db['ChatTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x64')],{'foreignKey':'FromChatWebsiteId','as':_0x98e1('0x1df')});db[_0x98e1('0xf4')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e0'),'as':'FromAgent'});db[_0x98e1('0xf4')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e2'),'as':_0x98e1('0x1e7')});db['ChatTransferReport'][_0x98e1('0x151')](db['ChatQueue'],{'foreignKey':_0x98e1('0x1e8'),'as':_0x98e1('0x1e4')});db['ChatTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x64')],{'foreignKey':_0x98e1('0x1e9'),'as':_0x98e1('0x1e6')});db['FaxTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x4f')],{});db['FaxTransferReport'][_0x98e1('0x151')](db['FaxInteraction'],{});db[_0x98e1('0xf6')]['belongsTo'](db[_0x98e1('0x49')],{'foreignKey':_0x98e1('0x1ea'),'as':_0x98e1('0x1df')});db[_0x98e1('0xf6')][_0x98e1('0x151')](db['User'],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0xf6')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e2'),'as':_0x98e1('0x1e7')});db[_0x98e1('0xf6')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x98e1('0x1eb'),'as':_0x98e1('0x1e4')});db[_0x98e1('0xf6')][_0x98e1('0x151')](db[_0x98e1('0x49')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0x98e1('0xf8')][_0x98e1('0x151')](db[_0x98e1('0x60')],{});db[_0x98e1('0xf8')]['belongsTo'](db[_0x98e1('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x98e1('0x5b')],{'foreignKey':_0x98e1('0x1ec'),'as':_0x98e1('0x1df')});db[_0x98e1('0xf8')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0xf8')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e2'),'as':_0x98e1('0x1e7')});db['OpenchannelTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x62')],{'foreignKey':_0x98e1('0x1ed'),'as':'ToQueue'});db[_0x98e1('0xf8')][_0x98e1('0x151')](db['OpenchannelAccount'],{'foreignKey':_0x98e1('0x1ee'),'as':_0x98e1('0x1e6')});db[_0x98e1('0xf9')]['belongsTo'](db[_0x98e1('0x58')],{});db[_0x98e1('0xf9')]['belongsTo'](db[_0x98e1('0x56')],{});db[_0x98e1('0xf9')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db['SmsTransferReport'][_0x98e1('0x151')](db['User'],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0xf9')]['belongsTo'](db['User'],{'foreignKey':_0x98e1('0x1e2'),'as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db[_0x98e1('0x59')],{'foreignKey':_0x98e1('0x1ef'),'as':_0x98e1('0x1e4')});db[_0x98e1('0xf9')][_0x98e1('0x151')](db[_0x98e1('0x184')],{'foreignKey':_0x98e1('0x1f0'),'as':_0x98e1('0x1e6')});db[_0x98e1('0xfa')][_0x98e1('0x117')](db[_0x98e1('0x85')],{'as':_0x98e1('0x167'),'foreignKey':'ListId','onDelete':_0x98e1('0x114')});db[_0x98e1('0xfa')]['hasMany'](db[_0x98e1('0x1f1')],{'as':_0x98e1('0x1f2'),'foreignKey':'ListId'});db[_0x98e1('0xfa')][_0x98e1('0x117')](db['CmContact'],{'as':_0x98e1('0x12c'),'onDelete':_0x98e1('0x114'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0xfa')][_0x98e1('0x117')](db[_0x98e1('0x79')],{'as':_0x98e1('0x11d'),'foreignKey':_0x98e1('0x16b')});db['CmList'][_0x98e1('0x117')](db[_0x98e1('0x7b')],{'as':_0x98e1('0x11e'),'foreignKey':'ListId'});db['CmList'][_0x98e1('0x117')](db[_0x98e1('0x7d')],{'as':_0x98e1('0x7d'),'foreignKey':'ListId'});db['CmList'][_0x98e1('0x129')](db[_0x98e1('0x18')],{'as':_0x98e1('0x1f3'),'through':_0x98e1('0x1f4')});db[_0x98e1('0xfa')][_0x98e1('0x129')](db['User'],{'as':_0x98e1('0x154'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x98e1('0x117')](db[_0x98e1('0x11b')],{'as':'Extensions','onDelete':'cascade'});db['VoicePrefix'][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x111')});db[_0x98e1('0xfb')][_0x98e1('0x129')](db[_0x98e1('0xe8')],{'through':'TeamVoicePrefix','as':_0x98e1('0x155')});db[_0x98e1('0xfc')][_0x98e1('0x117')](db[_0x98e1('0x12')],{'as':_0x98e1('0x190'),'foreignKey':_0x98e1('0x128')});db[_0x98e1('0xfc')]['hasMany'](db[_0x98e1('0xfd')],{'as':_0x98e1('0x1f5'),'foreignKey':_0x98e1('0x128'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0xfd')]['hasMany'](db['UserProfileResource'],{'as':_0x98e1('0x1f6'),'foreignKey':_0x98e1('0x1f7'),'onDelete':_0x98e1('0x114')});db[_0x98e1('0x101')][_0x98e1('0x117')](db['Disposition'],{'as':_0x98e1('0x167'),'foreignKey':'WhatsappAccountId','onDelete':_0x98e1('0x114')});db[_0x98e1('0x101')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x98e1('0x1f8')});db[_0x98e1('0x101')][_0x98e1('0x117')](db['WhatsappMessage'],{'as':_0x98e1('0x168'),'foreignKey':_0x98e1('0x1f8')});db['WhatsappAccount'][_0x98e1('0x117')](db[_0x98e1('0x125')],{'as':_0x98e1('0x169')});db[_0x98e1('0x101')]['hasMany'](db[_0x98e1('0x103')],{'as':_0x98e1('0x16a')});db[_0x98e1('0x101')][_0x98e1('0x151')](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db[_0x98e1('0x101')]['belongsTo'](db['Pause'],{'as':_0x98e1('0x153'),'foreignKey':_0x98e1('0x16d')});db[_0x98e1('0x101')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':_0x98e1('0x144')});db[_0x98e1('0x103')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'onDelete':_0x98e1('0x162')});db['WhatsappApplication']['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x98e1('0x162')});db[_0x98e1('0x103')][_0x98e1('0x151')](db[_0x98e1('0x101')],{'onDelete':_0x98e1('0x162')});db['WhatsappApplication'][_0x98e1('0x151')](db[_0x98e1('0x87')],{'onDelete':_0x98e1('0x162'),'foreignKey':_0x98e1('0x152')});db[_0x98e1('0x103')]['belongsTo'](db[_0x98e1('0x172')],{'onDelete':_0x98e1('0x162'),'foreignKey':'TagId'});db[_0x98e1('0x125')][_0x98e1('0x117')](db[_0x98e1('0x105')],{'as':_0x98e1('0x168'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db[_0x98e1('0x125')][_0x98e1('0x151')](db[_0x98e1('0x101')],{'as':'Account','foreignKey':_0x98e1('0x1f8')});db[_0x98e1('0x125')]['belongsTo'](db[_0x98e1('0x74')],{'as':_0x98e1('0x15e'),'foreignKey':_0x98e1('0x15f')});db[_0x98e1('0x125')][_0x98e1('0x151')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x98e1('0x125')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x1af'),'as':_0x98e1('0x17e')});db[_0x98e1('0x125')][_0x98e1('0x129')](db[_0x98e1('0x172')],{'through':_0x98e1('0x1af'),'as':'ThroughTags'});db[_0x98e1('0x125')][_0x98e1('0x129')](db[_0x98e1('0x12')],{'as':'Users','through':_0x98e1('0x1f9'),'foreignKey':'WhatsappInteractionId'});db[_0x98e1('0x105')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'as':_0x98e1('0x12')});db[_0x98e1('0x105')]['belongsTo'](db['CmContact'],{'onDelete':_0x98e1('0x114'),'as':'Contact'});db[_0x98e1('0x105')]['belongsTo'](db[_0x98e1('0x125')],{'onDelete':_0x98e1('0x114'),'as':_0x98e1('0x175'),'foreignKey':_0x98e1('0x1fa')});db['WhatsappMessage'][_0x98e1('0x151')](db['WhatsappAccount'],{'as':_0x98e1('0x16f'),'foreignKey':_0x98e1('0x1f8')});db[_0x98e1('0x107')]['belongsTo'](db[_0x98e1('0x101')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x98e1('0xfa')],{'as':_0x98e1('0x179'),'foreignKey':_0x98e1('0x16b')});db['WhatsappQueueReport'][_0x98e1('0x151')](db['CmContact'],{'as':_0x98e1('0x15e'),'foreignKey':'ContactId'});db[_0x98e1('0x107')][_0x98e1('0x151')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x10a')],{});db[_0x98e1('0x107')]['belongsTo'](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x98e1('0x151')](db[_0x98e1('0x12')],{});db[_0x98e1('0x108')][_0x98e1('0x151')](db[_0x98e1('0x105')],{});db['WhatsappTransferReport'][_0x98e1('0x151')](db[_0x98e1('0x125')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x98e1('0x101')],{'foreignKey':_0x98e1('0x1fb'),'as':_0x98e1('0x1df')});db[_0x98e1('0x108')][_0x98e1('0x151')](db['WhatsappAccount'],{'foreignKey':_0x98e1('0x1fc'),'as':'ToAccount'});db[_0x98e1('0x108')][_0x98e1('0x151')](db[_0x98e1('0x10a')],{'foreignKey':_0x98e1('0x1fd'),'as':_0x98e1('0x1e4')});db[_0x98e1('0x108')][_0x98e1('0x151')](db[_0x98e1('0x12')],{'foreignKey':_0x98e1('0x1e0'),'as':_0x98e1('0x1e1')});db[_0x98e1('0x108')][_0x98e1('0x151')](db['User'],{'foreignKey':_0x98e1('0x1e2'),'as':'ToAgent'});db[_0x98e1('0x10a')]['belongsToMany'](db[_0x98e1('0x12')],{'as':_0x98e1('0x154'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x98e1('0x10a')]['belongsToMany'](db[_0x98e1('0xe8')],{'through':_0x98e1('0x1da'),'as':_0x98e1('0x155')});db['UserSetting']['belongsTo'](db['User'],{'as':_0x98e1('0x1fe'),'foreignKey':_0x98e1('0x115'),'onDelete':_0x98e1('0x114'),'hooks':!![]});db[_0x98e1('0x10c')][_0x98e1('0x113')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':'restrict'});db['CloudProvider'][_0x98e1('0x113')](db[_0x98e1('0x37')],{'as':_0x98e1('0x165'),'onDelete':_0x98e1('0x162')});db[_0x98e1('0x10c')][_0x98e1('0x113')](db[_0x98e1('0x163')],{'as':'Smtp','onDelete':_0x98e1('0x162')});module[_0x98e1('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x1b16=['UserSetting','userSetting','hasMany','Recordings','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueue','MailQueues','ChatQueue','ChatQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailbox','mailboxuser','QueueCalls','uniqueid','Contact','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','CannedAnswer','MailMessage','Interactions','Applications','List','ListId','MailQueue','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Interaction','ChatWebsite','ChatWebsiteId','TagId','ContactId','DashboardItem','Items','FaxAccountId','Answers','FaxApplication','Exntensions','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','FaxQueueReport','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatOfflineMessageId','team_has_chat_queues','CmCompany','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','All','OneAll','Any','AutomationAnyId','Action','Actions','AutomationId','ParentId','Extensions','MailApplications','FaxApplications','SmsApplications','DefaultReportId','Schedule','Mohs','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','ItemTypeId','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','MetricId','SalesforceConfiguration','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','SugarcrmAccount','SugarcrmConfiguration','Subjects','SugarcrmField','VariableId','int_desk_configuration_has_tags','DeskField','ZohoAccount','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowConfiguration','Dynamics365Configuration','FreshsalesAccount','FreshsalesField','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','CampaignId','SquareProjectId','campaigns_has_cm_lists','BlackLists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromChatWebsiteId','FromUserId','ToUserId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelAccountId','ToAccount','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileSection','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','user','exports','sequelize','jstz','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','motion2','utf8','utf8_general_ci','database','username','password','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','cascade','UserId'];(function(_0x349d61,_0x326213){var _0x1ac715=function(_0x2fafee){while(--_0x2fafee){_0x349d61['push'](_0x349d61['shift']());}};_0x1ac715(++_0x326213);}(_0x1b16,0xf7));var _0x61b1=function(_0x29aa12,_0x4b99a8){_0x29aa12=_0x29aa12-0x0;var _0x37ca07=_0x1b16[_0x29aa12];return _0x37ca07;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x61b1('0x0'));var _=require('lodash');var jstz=require(_0x61b1('0x1'));var timezone=jstz['determine']();config[_0x61b1('0x0')]=_[_0x61b1('0x2')](config[_0x61b1('0x0')],{'database':'motion2','username':_0x61b1('0x3'),'password':_0x61b1('0x4'),'options':{'host':_0x61b1('0x5'),'port':0xcea,'dialect':_0x61b1('0x6'),'dialectOptions':{'charset':_0x61b1('0x7')},'logging':![],'timezone':timezone[_0x61b1('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x61b1('0x9')]=_[_0x61b1('0x2')](config[_0x61b1('0x9')],{'database':_0x61b1('0xa'),'username':_0x61b1('0x3'),'password':_0x61b1('0x4'),'options':{'host':_0x61b1('0x5'),'port':0xcea,'dialect':_0x61b1('0x6'),'dialectOptions':{'charset':_0x61b1('0x7')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x61b1('0xb'),'collate':_0x61b1('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x61b1('0x0')][_0x61b1('0xd')],config['sequelize'][_0x61b1('0xe')],config[_0x61b1('0x0')][_0x61b1('0xf')],config[_0x61b1('0x0')][_0x61b1('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x61b1('0x9')][_0x61b1('0xd')],config[_0x61b1('0x9')][_0x61b1('0xe')],config['sequelizeHistory'][_0x61b1('0xf')],config[_0x61b1('0x9')][_0x61b1('0x10')])};db[_0x61b1('0x11')]=db['sequelize']['import']('../api/user/user.model');db[_0x61b1('0x12')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x14'));db[_0x61b1('0x15')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x16'));db[_0x61b1('0x17')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x61b1('0x18')]=db['sequelize']['import'](_0x61b1('0x19'));db['VoiceQueue']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x1a'));db['VoiceRecording']=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0x61b1('0x1b')]=db[_0x61b1('0x0')]['import']('../api/screenRecording/screenRecording.model');db[_0x61b1('0x1c')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x1d'));db[_0x61b1('0x1e')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x61b1('0x1f')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x20'));db[_0x61b1('0x21')]=db['sequelize']['import'](_0x61b1('0x22'));db[_0x61b1('0x23')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x24'));db[_0x61b1('0x25')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x26'));db[_0x61b1('0x27')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x28'));db[_0x61b1('0x29')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x2a'));db[_0x61b1('0x2b')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x2c'));db[_0x61b1('0x2d')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x2e'));db[_0x61b1('0x2f')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x30'));db[_0x61b1('0x31')]=db[_0x61b1('0x0')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x61b1('0x32')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0x61b1('0x0')]['import'](_0x61b1('0x33'));db['UserSmsQueue']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x34'));db[_0x61b1('0x35')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x36'));db[_0x61b1('0x37')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x38'));db[_0x61b1('0x39')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0x61b1('0x3a')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x3b'));db[_0x61b1('0x3c')]=db['sequelize']['import'](_0x61b1('0x3d'));db['MailQueue']=db[_0x61b1('0x0')]['import'](_0x61b1('0x3e'));db[_0x61b1('0x3f')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x40'));db[_0x61b1('0x41')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x42'));db['MailMessage']=db[_0x61b1('0x0')]['import']('../api/mailMessage/mailMessage.model');db[_0x61b1('0x43')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x44'));db[_0x61b1('0x45')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x46'));db[_0x61b1('0x47')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x48'));db['DashboardItem']=db[_0x61b1('0x0')]['import'](_0x61b1('0x49'));db[_0x61b1('0x4a')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x4b'));db['FaxApplication']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x4c'));db['FaxInteraction']=db[_0x61b1('0x0')]['import']('../api/faxInteraction/faxInteraction.model');db[_0x61b1('0x4d')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x4e'));db[_0x61b1('0x4f')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x50'));db['FaxQueueReport']=db['sequelize']['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x61b1('0x51')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x52'));db[_0x61b1('0x53')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x54'));db[_0x61b1('0x55')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/smsInteraction/smsInteraction.model');db[_0x61b1('0x56')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/smsMessage/smsMessage.model');db[_0x61b1('0x57')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x58'));db['OpenchannelAccount']=db[_0x61b1('0x0')]['import'](_0x61b1('0x59'));db[_0x61b1('0x5a')]=db['sequelize'][_0x61b1('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0x61b1('0x5b')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x5c'));db[_0x61b1('0x5d')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x5e'));db[_0x61b1('0x5f')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x60'));db['ChatWebsite']=db[_0x61b1('0x0')]['import'](_0x61b1('0x61'));db[_0x61b1('0x62')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x63'));db[_0x61b1('0x64')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x65'));db[_0x61b1('0x66')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x67'));db[_0x61b1('0x68')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x69'));db[_0x61b1('0x6a')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x6b'));db['ChatQueue']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x6c'));db[_0x61b1('0x6d')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x6e'));db[_0x61b1('0x6f')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db['CmCompany']=db[_0x61b1('0x0')]['import']('../api/cmCompany/cmCompany.model');db[_0x61b1('0x70')]=db['sequelize']['import'](_0x61b1('0x71'));db['CmHopper']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x72'));db[_0x61b1('0x73')]=db['sequelize']['import'](_0x61b1('0x74'));db[_0x61b1('0x75')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x76'));db[_0x61b1('0x77')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x78'));db[_0x61b1('0x79')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x7a'));db[_0x61b1('0x7b')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x7c'));db['Action']=db[_0x61b1('0x0')]['import'](_0x61b1('0x7d'));db[_0x61b1('0x7e')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x7f'));db['CannedAnswer']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x80'));db[_0x61b1('0x81')]=db[_0x61b1('0x0')]['import']('../api/disposition/disposition.model');db[_0x61b1('0x82')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x83'));db['Interval']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x84'));db['Pause']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x85'));db[_0x61b1('0x86')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x87'));db['VoiceQueuesLog']=db[_0x61b1('0x0')]['import'](_0x61b1('0x88'));db['Schedule']=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x89'));db['Sound']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x8a'));db[_0x61b1('0x8b')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x8c'));db[_0x61b1('0x8d')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x8e'));db[_0x61b1('0x8f')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x90'));db[_0x61b1('0x91')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x61b1('0x92')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x93'));db[_0x61b1('0x94')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x95'));db['Variable']=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x96'));db[_0x61b1('0x97')]=db[_0x61b1('0x0')]['import']('../api/integration/integration.model');db['IntegrationReport']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x98'));db[_0x61b1('0x99')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x9a'));db[_0x61b1('0x9b')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db['sequelize'][_0x61b1('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x61b1('0x9c')]=db['sequelize'][_0x61b1('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0x61b1('0x9d')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x61b1('0x9e')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x61b1('0x9f')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xa0'));db['SalesforceConfiguration']=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xa1'));db['SalesforceField']=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x61b1('0x0')]['import'](_0x61b1('0xa2'));db['SugarcrmConfiguration']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xa3'));db['SugarcrmField']=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x61b1('0xa4')]=db[_0x61b1('0x0')]['import'](_0x61b1('0xa5'));db[_0x61b1('0xa6')]=db['sequelize']['import'](_0x61b1('0xa7'));db['DeskField']=db[_0x61b1('0x0')]['import'](_0x61b1('0xa8'));db['ZohoAccount']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xa9'));db[_0x61b1('0xaa')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xab'));db[_0x61b1('0xac')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xad'));db[_0x61b1('0xae')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xaf'));db[_0x61b1('0xb0')]=db[_0x61b1('0x0')]['import'](_0x61b1('0xb1'));db['ZendeskField']=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/intZendeskField/intZendeskField.model');db[_0x61b1('0xb2')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xb3'));db[_0x61b1('0xb4')]=db['sequelize']['import'](_0x61b1('0xb5'));db[_0x61b1('0xb6')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xb7'));db[_0x61b1('0xb8')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xb9'));db[_0x61b1('0xba')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xbb'));db['VtigerField']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xbc'));db[_0x61b1('0xbd')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xbe'));db[_0x61b1('0xbf')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xc0'));db[_0x61b1('0xc1')]=db[_0x61b1('0x0')]['import'](_0x61b1('0xc2'));db['Dynamics365Configuration']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xc3'));db[_0x61b1('0xc4')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xc5'));db['FreshsalesAccount']=db[_0x61b1('0x0')]['import'](_0x61b1('0xc6'));db[_0x61b1('0xc7')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xc8'));db['Integration']=db[_0x61b1('0x0')]['import'](_0x61b1('0xc9'));db['Network']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xca'));db[_0x61b1('0xcb')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x61b1('0xcc')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xcd'));db[_0x61b1('0xce')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xcf'));db[_0x61b1('0xd0')]=db[_0x61b1('0x0')]['import'](_0x61b1('0xd1'));db[_0x61b1('0xd2')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x61b1('0xd3')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/squareReport/squareReport.model');db[_0x61b1('0xd4')]=db['sequelize']['import'](_0x61b1('0xd5'));db[_0x61b1('0xd6')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xd7'));db['Setting']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xd8'));db[_0x61b1('0xd9')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xda'));db[_0x61b1('0xdb')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xdc'));db[_0x61b1('0xdd')]=db[_0x61b1('0x0')]['import'](_0x61b1('0xde'));db[_0x61b1('0xdf')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/squareMessage/squareMessage.model');db[_0x61b1('0xe0')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xe1'));db[_0x61b1('0xe2')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xe3'));db[_0x61b1('0xe4')]=db['sequelize'][_0x61b1('0x13')]('../api/campaign/campaign.model');db['Migration']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xe5'));db[_0x61b1('0xe6')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xe7'));db[_0x61b1('0xe8')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xe9'));db[_0x61b1('0xea')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xeb'));db[_0x61b1('0xec')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xed'));db['FaxTransferReport']=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xee'));db['OpenchannelTransferReport']=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xef'));db[_0x61b1('0xf0')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xf1'));db[_0x61b1('0xf2')]=db[_0x61b1('0x0')]['import']('../api/cmList/cmList.model');db[_0x61b1('0xf3')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x61b1('0xf4')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xf5'));db['UserProfileSection']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xf6'));db[_0x61b1('0xf7')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0xf8'));db['UserNotification']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xf9'));db['WhatsappAccount']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xfa'));db[_0x61b1('0xfb')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xfc'));db[_0x61b1('0xfd')]=db['sequelize'][_0x61b1('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x61b1('0xfe')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0xff'));db[_0x61b1('0x100')]=db[_0x61b1('0x0')]['import'](_0x61b1('0x101'));db[_0x61b1('0x102')]=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x103'));db['CloudProvider']=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x104'));db[_0x61b1('0x105')]=db[_0x61b1('0x0')][_0x61b1('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x61b1('0x106')]=db['sequelize'][_0x61b1('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x61b1('0x107')]=db['sequelize'][_0x61b1('0x13')](_0x61b1('0x108'));db['UserSetting']=db[_0x61b1('0x0')][_0x61b1('0x13')](_0x61b1('0x109'));db[_0x61b1('0x11')][_0x61b1('0x10a')](db[_0x61b1('0x1c')],{'as':_0x61b1('0x1c'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x11')][_0x61b1('0x10a')](db[_0x61b1('0x10d')],{'as':_0x61b1('0x10e'),'onDelete':'cascade','foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x11')][_0x61b1('0x10f')](db['VoiceRecording'],{'as':_0x61b1('0x110'),'foreignKey':'UserId'});db[_0x61b1('0x11')][_0x61b1('0x10f')](db[_0x61b1('0x2d')],{'as':'VoiceQueuesRt','foreignKey':_0x61b1('0x10c')});db['User'][_0x61b1('0x10f')](db[_0x61b1('0x17')],{'as':'Extensions','onDelete':_0x61b1('0x10b'),'hooks':!![]});db[_0x61b1('0x11')][_0x61b1('0x10f')](db[_0x61b1('0x75')],{'as':_0x61b1('0x111'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x11')][_0x61b1('0x10f')](db['CmHopperHistory'],{'as':_0x61b1('0x112'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x11')]['hasMany'](db[_0x61b1('0x79')],{'as':_0x61b1('0x79'),'foreignKey':'UserId'});db['User'][_0x61b1('0x10f')](db['OpenchannelInteraction'],{'as':_0x61b1('0x113'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x11')]['hasMany'](db[_0x61b1('0x66')],{'as':_0x61b1('0x114'),'foreignKey':_0x61b1('0x10c')});db['User'][_0x61b1('0x10f')](db[_0x61b1('0x55')],{'as':_0x61b1('0x115'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x11')]['hasMany'](db[_0x61b1('0x116')],{'as':'FaxInteractions','foreignKey':_0x61b1('0x10c')});db['User'][_0x61b1('0x10f')](db[_0x61b1('0x41')],{'as':_0x61b1('0x117'),'foreignKey':_0x61b1('0x10c')});db['User']['hasMany'](db[_0x61b1('0x118')],{'as':_0x61b1('0x119'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x11')][_0x61b1('0x10f')](db[_0x61b1('0x11a')],{'as':_0x61b1('0x11b'),'foreignKey':_0x61b1('0x11c')});db[_0x61b1('0x11')][_0x61b1('0x11d')](db[_0x61b1('0xf4')],{'as':'UserProfile','foreignKey':_0x61b1('0x11e')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0x6d')],{'as':_0x61b1('0x120'),'through':'chat_group_has_users'});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0x70')],{'as':_0x61b1('0x121'),'through':'cm_user_has_contacts'});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x122'),'through':_0x61b1('0x123')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0xe0')],{'through':_0x61b1('0x124')});db['User'][_0x61b1('0x11f')](db['MailInteraction'],{'as':_0x61b1('0x117'),'through':_0x61b1('0x125')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0x66')],{'as':_0x61b1('0x114'),'through':_0x61b1('0x126')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0x116')],{'as':_0x61b1('0x127'),'through':_0x61b1('0x128')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db['SmsInteraction'],{'as':_0x61b1('0x115'),'through':_0x61b1('0x129')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0x5b')],{'as':'OpenchannelInteractions','through':_0x61b1('0x12a')});db[_0x61b1('0x11')]['belongsToMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x61b1('0x12b')});db['User']['belongsToMany'](db[_0x61b1('0x12c')],{'as':'VoiceQueues','through':_0x61b1('0x2f'),'required':![]});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0xf3')],{'as':'VoicePrefixes','through':_0x61b1('0x107'),'required':![]});db[_0x61b1('0x11')][_0x61b1('0x11f')](db['MailQueue'],{'as':_0x61b1('0x12d'),'through':_0x61b1('0x32'),'required':![]});db['User'][_0x61b1('0x11f')](db[_0x61b1('0x12e')],{'as':_0x61b1('0x12f'),'through':_0x61b1('0x31'),'required':![],'hooks':!![]});db[_0x61b1('0x11')]['belongsToMany'](db['FaxQueue'],{'as':_0x61b1('0x130'),'through':_0x61b1('0x131'),'required':![]});db[_0x61b1('0x11')]['belongsToMany'](db['SmsQueue'],{'as':_0x61b1('0x132'),'through':'UserSmsQueue','required':![]});db['User'][_0x61b1('0x11f')](db['OpenchannelQueue'],{'as':_0x61b1('0x133'),'through':_0x61b1('0x35'),'required':![]});db[_0x61b1('0x11')][_0x61b1('0x11f')](db['WhatsappQueue'],{'as':_0x61b1('0x134'),'through':_0x61b1('0x37'),'required':![]});db[_0x61b1('0x11')][_0x61b1('0x11f')](db['CmList'],{'through':_0x61b1('0x123')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db['ChatWebsite'],{'as':_0x61b1('0x135'),'through':_0x61b1('0x136')});db[_0x61b1('0x11')]['belongsToMany'](db[_0x61b1('0x4a')],{'as':_0x61b1('0x137'),'through':_0x61b1('0x138')});db['User'][_0x61b1('0x11f')](db['MailAccount'],{'as':'MailAccounts','through':_0x61b1('0x139')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0x13a')],{'as':_0x61b1('0x13b'),'through':_0x61b1('0x13c')});db[_0x61b1('0x11')][_0x61b1('0x11f')](db['SmsAccount'],{'as':_0x61b1('0x13d'),'through':'user_has_sms_accounts'});db[_0x61b1('0x11')][_0x61b1('0x11f')](db[_0x61b1('0x13e')],{'as':_0x61b1('0x13f'),'through':_0x61b1('0x140')});db[_0x61b1('0x12')][_0x61b1('0x10f')](db['VoiceExtension'],{'as':_0x61b1('0x141'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x61b1('0x15')][_0x61b1('0x10f')](db[_0x61b1('0x17')],{'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x17')][_0x61b1('0x10f')](db[_0x61b1('0x17')],{'as':'Applications','onDelete':_0x61b1('0x10b')});db['VoiceMusicOnHold'][_0x61b1('0x11f')](db[_0x61b1('0x142')],{'as':_0x61b1('0x143'),'through':_0x61b1('0x144')});db[_0x61b1('0x12c')][_0x61b1('0x10f')](db['UserVoiceQueueRt'],{'as':_0x61b1('0x145'),'foreignKey':_0x61b1('0x146')});db['VoiceQueue'][_0x61b1('0x10f')](db[_0x61b1('0x147')],{'as':_0x61b1('0x148'),'foreignKey':_0x61b1('0x146')});db[_0x61b1('0x12c')]['hasMany'](db[_0x61b1('0x75')],{'as':_0x61b1('0x111'),'foreignKey':'VoiceQueueId'});db[_0x61b1('0x12c')]['hasMany'](db[_0x61b1('0x77')],{'as':_0x61b1('0x149'),'foreignKey':_0x61b1('0x146')});db[_0x61b1('0x12c')][_0x61b1('0x10f')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x61b1('0x12c')]['hasMany'](db[_0x61b1('0x73')],{'as':_0x61b1('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x61b1('0x12c')][_0x61b1('0x10f')](db[_0x61b1('0xd2')],{'as':_0x61b1('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x61b1('0x12c')][_0x61b1('0x11d')](db[_0x61b1('0x29')],{'as':_0x61b1('0x29'),'foreignKey':_0x61b1('0x14c')});db[_0x61b1('0x12c')][_0x61b1('0x11d')](db[_0x61b1('0x29')],{'as':_0x61b1('0x14d'),'foreignKey':_0x61b1('0x14e')});db[_0x61b1('0x12c')][_0x61b1('0x11d')](db[_0x61b1('0x14f')],{'as':_0x61b1('0x14f'),'foreignKey':_0x61b1('0x150')});db[_0x61b1('0x12c')]['belongsTo'](db[_0x61b1('0x151')],{'as':_0x61b1('0x152'),'foreignKey':_0x61b1('0x153')});db[_0x61b1('0x12c')][_0x61b1('0x11f')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x122'),'through':_0x61b1('0x154')});db[_0x61b1('0x12c')][_0x61b1('0x11f')](db['User'],{'as':_0x61b1('0x155'),'through':_0x61b1('0x2f')});db[_0x61b1('0x12c')]['belongsToMany'](db[_0x61b1('0xe0')],{'as':_0x61b1('0x156'),'through':_0x61b1('0x105')});db[_0x61b1('0x12c')]['belongsToMany'](db[_0x61b1('0xf2')],{'as':'BlackLists','through':_0x61b1('0x157')});db[_0x61b1('0x158')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x11'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x1b')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x11'),'foreignKey':_0x61b1('0x10c')});db['VoiceMail'][_0x61b1('0x10f')](db['VoiceMailMessage'],{'as':_0x61b1('0x159'),'onDelete':_0x61b1('0x10b'),'foreignKey':'mailboxuser','sourceKey':_0x61b1('0x15a')});db[_0x61b1('0x1e')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x61b1('0x15b'),'targetKey':'mailbox'});db[_0x61b1('0x1f')]['hasMany'](db[_0x61b1('0x25')],{'as':_0x61b1('0x15c'),'foreignKey':_0x61b1('0x15d'),'constraints':![]});db[_0x61b1('0x1f')][_0x61b1('0x10f')](db[_0x61b1('0x23')],{'as':'AgentReports','foreignKey':_0x61b1('0x15d'),'constraints':![]});db[_0x61b1('0x1f')][_0x61b1('0x11d')](db['User'],{'as':_0x61b1('0x11'),'foreignKey':'UserId'});db[_0x61b1('0x1f')][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':'ContactId'});db[_0x61b1('0x39')][_0x61b1('0x11d')](db[_0x61b1('0x3c')],{'as':_0x61b1('0x3c'),'foreignKey':_0x61b1('0x15f')});db[_0x61b1('0x39')][_0x61b1('0x11d')](db[_0x61b1('0x160')],{'as':_0x61b1('0x160'),'foreignKey':_0x61b1('0x161'),'onDelete':'restrict'});db[_0x61b1('0x3a')][_0x61b1('0x11d')](db[_0x61b1('0x3c')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailServerOut'][_0x61b1('0x11d')](db['CloudProvider'],{'as':_0x61b1('0x160'),'foreignKey':_0x61b1('0x161'),'onDelete':_0x61b1('0x162')});db[_0x61b1('0x3c')][_0x61b1('0x10a')](db[_0x61b1('0x39')],{'as':_0x61b1('0x163'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x3c')][_0x61b1('0x10a')](db[_0x61b1('0x3a')],{'as':_0x61b1('0x164'),'onDelete':'cascade'});db[_0x61b1('0x3c')][_0x61b1('0x10f')](db[_0x61b1('0x81')],{'as':_0x61b1('0x165'),'foreignKey':_0x61b1('0x15f'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x3c')][_0x61b1('0x10f')](db[_0x61b1('0x166')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0x61b1('0x3c')][_0x61b1('0x10f')](db[_0x61b1('0x167')],{'as':_0x61b1('0x159'),'foreignKey':'MailAccountId'});db[_0x61b1('0x3c')][_0x61b1('0x10f')](db[_0x61b1('0x41')],{'as':_0x61b1('0x168')});db[_0x61b1('0x3c')][_0x61b1('0x10f')](db[_0x61b1('0x43')],{'as':_0x61b1('0x169')});db[_0x61b1('0x3c')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x16a'),'foreignKey':_0x61b1('0x16b')});db[_0x61b1('0x3c')][_0x61b1('0x11d')](db[_0x61b1('0x92')],{'as':_0x61b1('0x92'),'foreignKey':'TemplateId'});db[_0x61b1('0x3c')]['belongsTo'](db[_0x61b1('0x151')],{'as':_0x61b1('0x152'),'foreignKey':_0x61b1('0x153')});db[_0x61b1('0x3c')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':'user_has_mail_accounts'});db[_0x61b1('0x16c')][_0x61b1('0x11f')](db['User'],{'as':_0x61b1('0x155'),'through':_0x61b1('0x32')});db['MailQueue'][_0x61b1('0x11f')](db[_0x61b1('0xe0')],{'through':'team_has_mail_queues','as':'Teams'});db['MailInteraction']['hasMany'](db['MailMessage'],{'as':_0x61b1('0x159'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x16d')});db['MailInteraction'][_0x61b1('0x11d')](db[_0x61b1('0x3c')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x15f')});db[_0x61b1('0x41')][_0x61b1('0x11d')](db['CmContact'],{'as':_0x61b1('0x15e'),'foreignKey':'ContactId'});db[_0x61b1('0x41')]['belongsTo'](db[_0x61b1('0x11')],{'as':_0x61b1('0x16f'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x41')][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':_0x61b1('0x170'),'as':_0x61b1('0x171')});db['MailInteraction'][_0x61b1('0x11f')](db['Tag'],{'through':_0x61b1('0x170'),'as':_0x61b1('0x172')});db['MailInteraction'][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x173'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x61b1('0x167')]['hasMany'](db[_0x61b1('0xe6')],{'as':'Attachments','onDelete':_0x61b1('0x10b')});db[_0x61b1('0x167')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x11')});db[_0x61b1('0x167')]['belongsTo'](db[_0x61b1('0x70')],{'onDelete':_0x61b1('0x10b'),'as':_0x61b1('0x15e')});db[_0x61b1('0x167')][_0x61b1('0x11d')](db['MailInteraction'],{'as':_0x61b1('0x174'),'foreignKey':_0x61b1('0x16d')});db[_0x61b1('0x167')][_0x61b1('0x11d')](db[_0x61b1('0x3c')],{'as':_0x61b1('0x16e'),'foreignKey':'MailAccountId'});db[_0x61b1('0x167')]['belongsTo'](db['ChatWebsite'],{'as':_0x61b1('0x175'),'foreignKey':_0x61b1('0x176')});db['MailMessage'][_0x61b1('0x11d')](db[_0x61b1('0x6a')],{'as':_0x61b1('0x6a'),'foreignKey':'ChatOfflineMessageId'});db[_0x61b1('0x43')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'onDelete':_0x61b1('0x162')});db['MailApplication'][_0x61b1('0x11d')](db[_0x61b1('0x16c')],{'onDelete':_0x61b1('0x162')});db[_0x61b1('0x43')][_0x61b1('0x11d')](db[_0x61b1('0x3c')],{'onDelete':_0x61b1('0x162')});db['MailApplication'][_0x61b1('0x11d')](db[_0x61b1('0x14f')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x150')});db[_0x61b1('0x43')][_0x61b1('0x11d')](db[_0x61b1('0x8b')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x177')});db[_0x61b1('0x45')]['belongsTo'](db[_0x61b1('0x3c')],{});db[_0x61b1('0x45')][_0x61b1('0x11d')](db['CmList'],{'as':_0x61b1('0x16a'),'foreignKey':_0x61b1('0x16b')});db[_0x61b1('0x45')][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db['MailQueueReport'][_0x61b1('0x11d')](db[_0x61b1('0x41')],{});db[_0x61b1('0x45')][_0x61b1('0x11d')](db[_0x61b1('0x167')],{});db[_0x61b1('0x45')]['belongsTo'](db[_0x61b1('0x11')],{});db['MailQueueReport'][_0x61b1('0x11d')](db[_0x61b1('0x16c')],{});db['Dashboard'][_0x61b1('0x10f')](db[_0x61b1('0x179')],{'as':_0x61b1('0x17a'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x4a')][_0x61b1('0x10f')](db[_0x61b1('0x81')],{'as':_0x61b1('0x165'),'foreignKey':_0x61b1('0x17b'),'onDelete':'cascade'});db[_0x61b1('0x4a')][_0x61b1('0x10f')](db[_0x61b1('0x166')],{'as':_0x61b1('0x17c'),'foreignKey':_0x61b1('0x17b')});db['FaxAccount']['hasMany'](db[_0x61b1('0x116')],{'as':_0x61b1('0x168')});db[_0x61b1('0x4a')][_0x61b1('0x10f')](db[_0x61b1('0x17d')],{'as':'Applications'});db[_0x61b1('0x4a')][_0x61b1('0x10f')](db['VoiceExtension'],{'as':_0x61b1('0x17e'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x4a')][_0x61b1('0x10f')](db['FaxMessage'],{'as':'Messages'});db['FaxAccount'][_0x61b1('0x11d')](db[_0x61b1('0x29')],{'as':'Trunk'});db[_0x61b1('0x4a')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':'List','foreignKey':_0x61b1('0x16b')});db[_0x61b1('0x4a')][_0x61b1('0x11d')](db[_0x61b1('0x151')],{'as':'mandatoryDispositionPause','foreignKey':_0x61b1('0x153')});db[_0x61b1('0x4a')]['belongsToMany'](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x138')});db[_0x61b1('0x17d')]['belongsTo'](db['User'],{'onDelete':_0x61b1('0x162')});db[_0x61b1('0x17d')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x61b1('0x162')});db[_0x61b1('0x17d')][_0x61b1('0x11d')](db[_0x61b1('0x4a')],{'onDelete':_0x61b1('0x162')});db[_0x61b1('0x17d')][_0x61b1('0x11d')](db[_0x61b1('0x8b')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x177')});db[_0x61b1('0x116')][_0x61b1('0x10f')](db['FaxMessage'],{'as':_0x61b1('0x159'),'onDelete':'cascade','foreignKey':_0x61b1('0x17f')});db[_0x61b1('0x116')][_0x61b1('0x11d')](db[_0x61b1('0x4a')],{'as':_0x61b1('0x16e'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db['FaxInteraction'][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x16f'),'foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x116')][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':_0x61b1('0x180'),'as':_0x61b1('0x171')});db[_0x61b1('0x116')][_0x61b1('0x11f')](db['Tag'],{'through':_0x61b1('0x180'),'as':_0x61b1('0x172')});db[_0x61b1('0x116')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x61b1('0x17f')});db[_0x61b1('0x4d')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'onDelete':_0x61b1('0x10b'),'as':_0x61b1('0x11')});db[_0x61b1('0x4d')][_0x61b1('0x11d')](db[_0x61b1('0x116')],{'as':_0x61b1('0x174'),'foreignKey':_0x61b1('0x17f')});db[_0x61b1('0x4d')]['belongsTo'](db[_0x61b1('0x70')],{'onDelete':_0x61b1('0x10b'),'as':_0x61b1('0x15e')});db['FaxMessage']['belongsTo'](db[_0x61b1('0xe6')],{'as':_0x61b1('0xe6'),'foreignKey':'AttachmentId'});db[_0x61b1('0x4d')][_0x61b1('0x11d')](db['FaxAccount'],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x17b')});db[_0x61b1('0x4f')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x131')});db['FaxQueue'][_0x61b1('0x11f')](db['Team'],{'through':_0x61b1('0x181'),'as':_0x61b1('0x156')});db['FaxQueueReport']['belongsTo'](db[_0x61b1('0x4a')],{});db[_0x61b1('0x182')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x61b1('0x16b')});db[_0x61b1('0x182')][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db[_0x61b1('0x182')][_0x61b1('0x11d')](db['FaxInteraction'],{});db[_0x61b1('0x182')]['belongsTo'](db[_0x61b1('0x4d')],{});db[_0x61b1('0x182')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{});db[_0x61b1('0x182')]['belongsTo'](db[_0x61b1('0x4f')],{});db[_0x61b1('0x51')]['hasMany'](db[_0x61b1('0x81')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':'cascade'});db['SmsAccount'][_0x61b1('0x10f')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x61b1('0x183')});db[_0x61b1('0x51')]['hasMany'](db[_0x61b1('0x56')],{'as':_0x61b1('0x159'),'foreignKey':_0x61b1('0x183')});db[_0x61b1('0x51')][_0x61b1('0x10f')](db[_0x61b1('0x55')],{'as':_0x61b1('0x168')});db[_0x61b1('0x51')][_0x61b1('0x10f')](db[_0x61b1('0x53')],{'as':'Applications'});db[_0x61b1('0x51')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':'List','foreignKey':_0x61b1('0x16b')});db[_0x61b1('0x51')][_0x61b1('0x11d')](db[_0x61b1('0x151')],{'as':_0x61b1('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x61b1('0x51')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x184')});db[_0x61b1('0x53')][_0x61b1('0x11d')](db['User'],{'onDelete':_0x61b1('0x162')});db[_0x61b1('0x53')][_0x61b1('0x11d')](db[_0x61b1('0x57')],{'onDelete':'restrict'});db['SmsApplication'][_0x61b1('0x11d')](db[_0x61b1('0x51')],{'onDelete':'restrict'});db[_0x61b1('0x53')][_0x61b1('0x11d')](db[_0x61b1('0x14f')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x150')});db[_0x61b1('0x53')][_0x61b1('0x11d')](db[_0x61b1('0x8b')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x177')});db[_0x61b1('0x55')][_0x61b1('0x10f')](db[_0x61b1('0x56')],{'as':_0x61b1('0x159'),'onDelete':'cascade','foreignKey':_0x61b1('0x185')});db['SmsInteraction']['belongsTo'](db[_0x61b1('0x51')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x183')});db[_0x61b1('0x55')][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db['SmsInteraction'][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x16f'),'foreignKey':_0x61b1('0x10c')});db['SmsInteraction'][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':_0x61b1('0x186'),'as':'Tags'});db[_0x61b1('0x55')]['belongsToMany'](db[_0x61b1('0x8b')],{'through':_0x61b1('0x186'),'as':_0x61b1('0x172')});db[_0x61b1('0x55')]['belongsToMany'](db[_0x61b1('0x11')],{'as':'Users','through':_0x61b1('0x129'),'foreignKey':_0x61b1('0x185')});db[_0x61b1('0x56')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x11')});db[_0x61b1('0x56')][_0x61b1('0x11d')](db['CmContact'],{'onDelete':_0x61b1('0x10b'),'as':_0x61b1('0x15e')});db[_0x61b1('0x56')]['belongsTo'](db[_0x61b1('0x55')],{'onDelete':_0x61b1('0x10b'),'as':'Interaction','foreignKey':_0x61b1('0x185')});db[_0x61b1('0x56')][_0x61b1('0x11d')](db[_0x61b1('0x51')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x183')});db[_0x61b1('0x57')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x187'),'foreignKey':_0x61b1('0x188')});db['SmsQueue'][_0x61b1('0x11f')](db[_0x61b1('0xe0')],{'through':_0x61b1('0x189'),'as':_0x61b1('0x156')});db[_0x61b1('0x13a')][_0x61b1('0x10f')](db[_0x61b1('0x81')],{'as':_0x61b1('0x165'),'foreignKey':_0x61b1('0x18a'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x13a')][_0x61b1('0x10f')](db[_0x61b1('0x166')],{'as':_0x61b1('0x17c'),'foreignKey':_0x61b1('0x18a')});db[_0x61b1('0x13a')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x61b1('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x61b1('0x13a')][_0x61b1('0x10f')](db[_0x61b1('0x5d')],{'as':_0x61b1('0x159'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x61b1('0x10f')](db[_0x61b1('0x5a')],{'as':'Applications','foreignKey':_0x61b1('0x18a')});db[_0x61b1('0x13a')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x16a'),'foreignKey':_0x61b1('0x16b')});db['OpenchannelAccount'][_0x61b1('0x11d')](db['Pause'],{'as':_0x61b1('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x61b1('0x13a')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':'Agents','through':_0x61b1('0x13c')});db[_0x61b1('0x5a')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'onDelete':_0x61b1('0x162')});db[_0x61b1('0x5a')][_0x61b1('0x11d')](db[_0x61b1('0x5f')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x18b')});db[_0x61b1('0x5a')]['belongsTo'](db[_0x61b1('0x13a')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x18a')});db[_0x61b1('0x5a')][_0x61b1('0x11d')](db[_0x61b1('0x14f')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x150')});db['OpenchannelApplication'][_0x61b1('0x11d')](db['Tag'],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x177')});db[_0x61b1('0x5b')][_0x61b1('0x10f')](db[_0x61b1('0x5d')],{'as':_0x61b1('0x159'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x18c')});db[_0x61b1('0x5b')][_0x61b1('0x11d')](db[_0x61b1('0x13a')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x18a')});db['OpenchannelInteraction'][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db[_0x61b1('0x5b')]['belongsTo'](db[_0x61b1('0x11')],{'as':'Owner','foreignKey':_0x61b1('0x10c')});db[_0x61b1('0x5b')][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':'openchannel_interaction_has_tags','as':_0x61b1('0x171')});db['OpenchannelInteraction']['belongsToMany'](db[_0x61b1('0x8b')],{'through':'openchannel_interaction_has_tags','as':_0x61b1('0x172')});db[_0x61b1('0x5b')]['belongsToMany'](db[_0x61b1('0x11')],{'as':_0x61b1('0x173'),'through':'user_has_openchannel_interactions','foreignKey':_0x61b1('0x18c')});db[_0x61b1('0x5d')]['belongsTo'](db['User'],{'onDelete':_0x61b1('0x10b'),'as':'User'});db['OpenchannelMessage'][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'onDelete':_0x61b1('0x10b'),'as':_0x61b1('0x15e')});db[_0x61b1('0x5d')][_0x61b1('0x11d')](db[_0x61b1('0x5b')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x61b1('0x18c')});db[_0x61b1('0x5d')][_0x61b1('0x11d')](db[_0x61b1('0xe6')],{'as':'Attachment','foreignKey':_0x61b1('0x18d')});db[_0x61b1('0x5d')][_0x61b1('0x11d')](db['OpenchannelAccount'],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x18a')});db[_0x61b1('0x5f')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x35'),'foreignKey':_0x61b1('0x18b')});db['OpenchannelQueue'][_0x61b1('0x11f')](db[_0x61b1('0xe0')],{'through':_0x61b1('0x18e'),'as':_0x61b1('0x156')});db[_0x61b1('0x175')][_0x61b1('0x10f')](db[_0x61b1('0x81')],{'as':'Dispositions','foreignKey':_0x61b1('0x176'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x175')][_0x61b1('0x10f')](db[_0x61b1('0x166')],{'as':_0x61b1('0x17c'),'foreignKey':'ChatWebsiteId'});db[_0x61b1('0x175')][_0x61b1('0x10f')](db[_0x61b1('0x6f')],{'as':_0x61b1('0x18f')});db[_0x61b1('0x175')][_0x61b1('0x10f')](db[_0x61b1('0x66')],{'as':'Interactions'});db[_0x61b1('0x175')][_0x61b1('0x10f')](db[_0x61b1('0x64')],{'as':_0x61b1('0x169')});db[_0x61b1('0x175')]['hasMany'](db[_0x61b1('0x68')],{'as':_0x61b1('0x159')});db[_0x61b1('0x175')][_0x61b1('0x11d')](db['CmList'],{'as':_0x61b1('0x16a'),'foreignKey':_0x61b1('0x16b')});db[_0x61b1('0x175')][_0x61b1('0x11d')](db[_0x61b1('0x14f')],{'as':_0x61b1('0x14f'),'foreignKey':_0x61b1('0x150')});db[_0x61b1('0x175')]['belongsTo'](db[_0x61b1('0x3c')],{'as':_0x61b1('0x3c'),'foreignKey':_0x61b1('0x15f')});db[_0x61b1('0x175')][_0x61b1('0x11d')](db[_0x61b1('0x151')],{'as':_0x61b1('0x152'),'foreignKey':_0x61b1('0x153')});db[_0x61b1('0x175')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x136')});db[_0x61b1('0x62')]['belongsTo'](db[_0x61b1('0x13a')],{});db[_0x61b1('0x62')][_0x61b1('0x11d')](db['CmList'],{'as':_0x61b1('0x16a'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':'Contact','foreignKey':_0x61b1('0x178')});db['OpenchannelQueueReport']['belongsTo'](db[_0x61b1('0x5b')],{});db[_0x61b1('0x62')][_0x61b1('0x11d')](db[_0x61b1('0x5d')],{});db[_0x61b1('0x62')][_0x61b1('0x11d')](db['User'],{});db[_0x61b1('0x62')]['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication']['belongsTo'](db['User'],{'as':_0x61b1('0x190'),'foreignKey':_0x61b1('0x10c'),'onDelete':'restrict'});db[_0x61b1('0x64')]['belongsTo'](db[_0x61b1('0x12e')],{'as':_0x61b1('0x191'),'foreignKey':_0x61b1('0x192'),'onDelete':_0x61b1('0x162')});db['ChatApplication']['belongsTo'](db[_0x61b1('0x175')],{'as':_0x61b1('0x193'),'foreignKey':_0x61b1('0x176'),'onDelete':'restrict'});db[_0x61b1('0x64')][_0x61b1('0x11d')](db[_0x61b1('0x8b')],{'onDelete':_0x61b1('0x162'),'foreignKey':_0x61b1('0x177')});db['ChatInteraction'][_0x61b1('0x10f')](db[_0x61b1('0x68')],{'as':'Messages','onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x194')});db['ChatInteraction'][_0x61b1('0x11d')](db[_0x61b1('0x175')],{'as':'Account','foreignKey':_0x61b1('0x176')});db[_0x61b1('0x66')][_0x61b1('0x11d')](db['CmContact'],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db['ChatInteraction'][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x16f'),'foreignKey':'UserId'});db['ChatInteraction'][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':_0x61b1('0x195'),'as':'Tags'});db[_0x61b1('0x66')][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':_0x61b1('0x195'),'as':_0x61b1('0x172')});db[_0x61b1('0x66')][_0x61b1('0x11f')](db['User'],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x61b1('0x194')});db[_0x61b1('0x68')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'onDelete':_0x61b1('0x10b'),'as':'User'});db['ChatMessage'][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'onDelete':_0x61b1('0x10b'),'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db[_0x61b1('0x68')][_0x61b1('0x11d')](db[_0x61b1('0x66')],{'onDelete':_0x61b1('0x10b'),'as':_0x61b1('0x174'),'foreignKey':_0x61b1('0x194')});db[_0x61b1('0x68')][_0x61b1('0x11d')](db[_0x61b1('0xe6')],{'as':_0x61b1('0xe6'),'foreignKey':_0x61b1('0x18d')});db['ChatMessage'][_0x61b1('0x11d')](db[_0x61b1('0x175')],{'as':'Account','foreignKey':_0x61b1('0x176')});db[_0x61b1('0x6a')][_0x61b1('0x10f')](db[_0x61b1('0xe6')],{'as':_0x61b1('0x196'),'foreignKey':_0x61b1('0x197'),'onDelete':_0x61b1('0x10b'),'hooks':!![]});db[_0x61b1('0x6a')]['belongsTo'](db[_0x61b1('0x70')],{'onDelete':_0x61b1('0x10b'),'as':_0x61b1('0x15e'),'foreignKey':'ContactId'});db[_0x61b1('0x6a')][_0x61b1('0x11d')](db[_0x61b1('0x175')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x176')});db[_0x61b1('0x12e')]['belongsToMany'](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x31'),'hooks':!![]});db[_0x61b1('0x12e')]['belongsToMany'](db[_0x61b1('0xe0')],{'through':_0x61b1('0x198'),'as':_0x61b1('0x156')});db['ChatGroup'][_0x61b1('0x10f')](db['ChatInternalMessage'],{'as':_0x61b1('0x159'),'foreignKey':'ChatGroupId','onDelete':_0x61b1('0x10b')});db[_0x61b1('0x6d')]['belongsToMany'](db['User'],{'as':_0x61b1('0x145'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0x61b1('0x11d')](db[_0x61b1('0x175')],{'as':'Website','foreignKey':_0x61b1('0x176')});db[_0x61b1('0x199')]['hasMany'](db[_0x61b1('0x70')],{'as':_0x61b1('0x121'),'foreignKey':_0x61b1('0x19a')});db[_0x61b1('0x70')]['hasMany'](db[_0x61b1('0x8f')],{'as':_0x61b1('0x19b'),'foreignKey':_0x61b1('0x19c')});db[_0x61b1('0x70')]['hasMany'](db[_0x61b1('0x147')],{'as':_0x61b1('0x148'),'foreignKey':_0x61b1('0x178')});db['CmContact'][_0x61b1('0x10f')](db[_0x61b1('0x75')],{'as':_0x61b1('0x111'),'foreignKey':'ContactId'});db[_0x61b1('0x70')][_0x61b1('0x10f')](db[_0x61b1('0x77')],{'as':_0x61b1('0x149'),'foreignKey':_0x61b1('0x178')});db[_0x61b1('0x70')][_0x61b1('0x10f')](db[_0x61b1('0x79')],{'as':_0x61b1('0x79'),'foreignKey':'ContactId'});db[_0x61b1('0x70')][_0x61b1('0x10f')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x61b1('0x178')});db[_0x61b1('0x70')]['hasMany'](db[_0x61b1('0x5b')],{'as':'OpenchannelInteractions','foreignKey':_0x61b1('0x178'),'onDelete':_0x61b1('0x162')});db['CmContact'][_0x61b1('0x10f')](db[_0x61b1('0x66')],{'as':_0x61b1('0x114'),'foreignKey':_0x61b1('0x178'),'onDelete':_0x61b1('0x162')});db[_0x61b1('0x70')][_0x61b1('0x10f')](db[_0x61b1('0x55')],{'as':_0x61b1('0x115'),'foreignKey':_0x61b1('0x178'),'onDelete':'restrict'});db[_0x61b1('0x70')][_0x61b1('0x10f')](db['FaxInteraction'],{'as':_0x61b1('0x127'),'foreignKey':_0x61b1('0x178'),'onDelete':_0x61b1('0x162')});db[_0x61b1('0x70')]['hasMany'](db[_0x61b1('0x41')],{'as':_0x61b1('0x117'),'foreignKey':_0x61b1('0x178'),'onDelete':_0x61b1('0x162')});db[_0x61b1('0x70')][_0x61b1('0x11d')](db['CmCompany'],{'as':_0x61b1('0x19d'),'foreignKey':_0x61b1('0x19a')});db[_0x61b1('0x70')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x16a'),'foreignKey':_0x61b1('0x16b'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x70')]['belongsToMany'](db[_0x61b1('0x11')],{'as':_0x61b1('0x173'),'through':_0x61b1('0x19e')});db[_0x61b1('0x70')][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'as':'Tags','through':_0x61b1('0x19f')});db['CmContact'][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':_0x61b1('0x19f'),'as':'ThroughTags'});db[_0x61b1('0x147')][_0x61b1('0x10f')](db[_0x61b1('0x91')],{'as':_0x61b1('0x1a0'),'foreignKey':_0x61b1('0x1a1')});db[_0x61b1('0x147')][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x147')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x16a'),'foreignKey':_0x61b1('0x16b'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x147')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x190'),'foreignKey':'UserId'});db[_0x61b1('0x147')][_0x61b1('0x11d')](db[_0x61b1('0x12c')],{'as':_0x61b1('0x191'),'foreignKey':'VoiceQueueId','onDelete':_0x61b1('0x10b')});db['CmHopper'][_0x61b1('0x11d')](db[_0x61b1('0xe4')],{'as':_0x61b1('0xe4'),'foreignKey':'CampaignId','onDelete':_0x61b1('0x10b')});db[_0x61b1('0x147')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':'Owner','foreignKey':_0x61b1('0x1a2')});db[_0x61b1('0x73')][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178'),'onDelete':'cascade'});db[_0x61b1('0x73')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x16a'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x61b1('0x73')][_0x61b1('0x11d')](db[_0x61b1('0x12c')],{'as':_0x61b1('0x191'),'foreignKey':_0x61b1('0x146'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0x73')][_0x61b1('0x11d')](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x61b1('0x10b')});db[_0x61b1('0x7e')][_0x61b1('0x10f')](db['Condition'],{'as':{'plural':_0x61b1('0x1a3'),'singular':_0x61b1('0x1a4')},'foreignKey':'AutomationAllId','onDelete':_0x61b1('0x10b'),'hooks':!![]});db['Automation'][_0x61b1('0x10f')](db[_0x61b1('0x82')],{'as':{'plural':_0x61b1('0x1a5'),'singular':'OneAny'},'foreignKey':_0x61b1('0x1a6'),'onDelete':_0x61b1('0x10b'),'hooks':!![]});db[_0x61b1('0x7e')][_0x61b1('0x10f')](db[_0x61b1('0x1a7')],{'as':_0x61b1('0x1a8'),'foreignKey':_0x61b1('0x1a9'),'onDelete':_0x61b1('0x10b'),'hooks':!![]});db[_0x61b1('0x81')]['hasMany'](db[_0x61b1('0x81')],{'as':'Dispositions','foreignKey':_0x61b1('0x1aa'),'onDelete':_0x61b1('0x10b')});db['Interval']['hasMany'](db['Interval'],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x61b1('0x10b'),'hooks':!![],'required':![]});db[_0x61b1('0x14f')][_0x61b1('0x10f')](db[_0x61b1('0x17')],{'as':_0x61b1('0x1ab'),'foreignKey':_0x61b1('0x150'),'onDelete':'restrict'});db['Interval']['hasMany'](db['MailApplication'],{'as':_0x61b1('0x1ac'),'foreignKey':'IntervalId'});db[_0x61b1('0x14f')][_0x61b1('0x10f')](db[_0x61b1('0x64')],{'as':'ChatApplications','foreignKey':_0x61b1('0x150')});db['Interval'][_0x61b1('0x10f')](db['FaxApplication'],{'as':_0x61b1('0x1ad'),'foreignKey':_0x61b1('0x150')});db['Interval'][_0x61b1('0x10f')](db['SmsApplication'],{'as':_0x61b1('0x1ae'),'foreignKey':_0x61b1('0x150')});db['Schedule'][_0x61b1('0x11d')](db[_0x61b1('0x3c')],{});db['Schedule'][_0x61b1('0x11d')](db[_0x61b1('0x9b')],{'foreignKey':_0x61b1('0x1af')});db[_0x61b1('0x1b0')][_0x61b1('0x11d')](db[_0x61b1('0x99')],{'foreignKey':'CustomReportId'});db[_0x61b1('0x142')][_0x61b1('0x11f')](db[_0x61b1('0x18')],{'as':_0x61b1('0x1b1'),'through':_0x61b1('0x144'),'onDelete':'restrict'});db[_0x61b1('0x8b')][_0x61b1('0x11f')](db[_0x61b1('0x70')],{'through':'cm_contact_has_tags'});db[_0x61b1('0x8b')][_0x61b1('0x11f')](db[_0x61b1('0x66')],{'through':'chat_interaction_has_tags'});db[_0x61b1('0x8b')][_0x61b1('0x11f')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x61b1('0x8b')][_0x61b1('0x11f')](db['SmsInteraction'],{'through':_0x61b1('0x186')});db['Tag'][_0x61b1('0x11f')](db[_0x61b1('0x116')],{'through':'fax_interaction_has_tags'});db[_0x61b1('0x8b')][_0x61b1('0x11f')](db['OpenchannelInteraction'],{'through':_0x61b1('0x1b2')});db['Tag'][_0x61b1('0x11f')](db[_0x61b1('0x118')],{'through':_0x61b1('0x1b3')});db[_0x61b1('0x8f')]['belongsTo'](db[_0x61b1('0x8d')],{'as':'ItemType','foreignKey':_0x61b1('0x1b4')});db['CmHopperAdditionalPhone'][_0x61b1('0x11d')](db[_0x61b1('0x147')],{'as':'Hopper','foreignKey':'CmHopperId'});db['CmContactHasItem'][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':'Contact','foreignKey':_0x61b1('0x19c')});db[_0x61b1('0x94')][_0x61b1('0x10f')](db[_0x61b1('0x82')],{'as':{'plural':_0x61b1('0x1b5'),'singular':'AllCondition'},'foreignKey':_0x61b1('0x1b6'),'onDelete':_0x61b1('0x10b'),'hooks':!![]});db[_0x61b1('0x94')]['hasMany'](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x61b1('0x1b7')},'foreignKey':_0x61b1('0x1b8'),'onDelete':'cascade','hooks':!![]});db[_0x61b1('0x94')]['hasMany'](db[_0x61b1('0x1a7')],{'as':_0x61b1('0x1a8'),'foreignKey':_0x61b1('0x1b9'),'onDelete':_0x61b1('0x10b'),'hooks':!![]});db['AnalyticCustomReport'][_0x61b1('0x10f')](db[_0x61b1('0x9d')],{'as':_0x61b1('0x1ba'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1bb'),'hooks':!![]});db[_0x61b1('0x9b')]['hasMany'](db[_0x61b1('0x9d')],{'as':_0x61b1('0x1ba'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1af')});db[_0x61b1('0x9c')][_0x61b1('0x10f')](db[_0x61b1('0x9d')],{'as':_0x61b1('0x1ba'),'onDelete':'cascade','foreignKey':_0x61b1('0x1bc')});db[_0x61b1('0x9d')][_0x61b1('0x11d')](db[_0x61b1('0x9c')],{'foreignKey':_0x61b1('0x1bc')});db['SalesforceAccount'][_0x61b1('0x10f')](db[_0x61b1('0x1bd')],{'as':_0x61b1('0x1be'),'onDelete':'cascade','foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0x1bd')]['hasMany'](db[_0x61b1('0x1c0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0x1bd')][_0x61b1('0x10f')](db[_0x61b1('0x1c0')],{'as':_0x61b1('0x1c2'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0x1bd')][_0x61b1('0x10f')](db[_0x61b1('0x1c0')],{'as':_0x61b1('0x1ba'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0x1bd')][_0x61b1('0x11d')](db[_0x61b1('0x9f')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0x1c0')][_0x61b1('0x10f')](db[_0x61b1('0x1c0')],{'as':_0x61b1('0x1c5'),'foreignKey':'SubjectId'});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x61b1('0x1c6'),'foreignKey':_0x61b1('0x1c3')});db['SalesforceField']['hasMany'](db[_0x61b1('0x1c0')],{'as':_0x61b1('0x1c7'),'foreignKey':_0x61b1('0x1c4')});db['SalesforceField'][_0x61b1('0x11d')](db[_0x61b1('0x1c8')],{'as':'Variable','foreignKey':'VariableId'});db[_0x61b1('0x1c9')][_0x61b1('0x10f')](db[_0x61b1('0x1ca')],{'as':_0x61b1('0x1be'),'onDelete':'cascade','foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x61b1('0x10f')](db['SugarcrmField'],{'as':_0x61b1('0x1cb'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0x1ca')][_0x61b1('0x10f')](db[_0x61b1('0x1cc')],{'as':_0x61b1('0x1c2'),'onDelete':_0x61b1('0x10b'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':'Fields','onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c4')});db['SugarcrmConfiguration'][_0x61b1('0x11d')](db[_0x61b1('0x1c9')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0x1cc')][_0x61b1('0x10f')](db[_0x61b1('0x1cc')],{'as':_0x61b1('0x1c5'),'foreignKey':'SubjectId'});db[_0x61b1('0x1cc')]['hasMany'](db[_0x61b1('0x1cc')],{'as':'Description','foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0x1cc')][_0x61b1('0x10f')](db[_0x61b1('0x1cc')],{'as':_0x61b1('0x1c7'),'foreignKey':'FieldId'});db[_0x61b1('0x1cc')][_0x61b1('0x11d')](db[_0x61b1('0x1c8')],{'as':_0x61b1('0x1c8'),'foreignKey':_0x61b1('0x1cd')});db['DeskAccount'][_0x61b1('0x10f')](db[_0x61b1('0xa6')],{'as':_0x61b1('0x1be'),'onDelete':_0x61b1('0x10b'),'foreignKey':'AccountId'});db[_0x61b1('0xa6')][_0x61b1('0x10f')](db['DeskField'],{'as':'Subjects','onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0xa6')][_0x61b1('0x10f')](db['DeskField'],{'as':'Descriptions','onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0xa6')][_0x61b1('0x10f')](db['DeskField'],{'as':_0x61b1('0x1ba'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0xa6')][_0x61b1('0x11d')](db[_0x61b1('0xa4')],{'as':_0x61b1('0x16e'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':_0x61b1('0x1ce')});db[_0x61b1('0x1cf')][_0x61b1('0x10f')](db[_0x61b1('0x1cf')],{'as':_0x61b1('0x1c5'),'foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0x1cf')][_0x61b1('0x10f')](db[_0x61b1('0x1cf')],{'as':_0x61b1('0x1c6'),'foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0x1cf')]['hasMany'](db[_0x61b1('0x1cf')],{'as':_0x61b1('0x1c7'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0x1cf')][_0x61b1('0x11d')](db['Variable'],{'as':_0x61b1('0x1c8'),'foreignKey':_0x61b1('0x1cd')});db[_0x61b1('0x1d0')][_0x61b1('0x10f')](db[_0x61b1('0xaa')],{'as':_0x61b1('0x1be'),'onDelete':'cascade','foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0xaa')][_0x61b1('0x10f')](db['ZohoField'],{'as':_0x61b1('0x1cb'),'onDelete':_0x61b1('0x10b'),'foreignKey':'SubjectId'});db[_0x61b1('0xaa')]['hasMany'](db[_0x61b1('0xac')],{'as':_0x61b1('0x1c2'),'onDelete':'cascade','foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0xaa')][_0x61b1('0x10f')](db[_0x61b1('0xac')],{'as':'Fields','onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0xaa')][_0x61b1('0x11d')](db['ZohoAccount'],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0xac')][_0x61b1('0x10f')](db[_0x61b1('0xac')],{'as':_0x61b1('0x1c5'),'foreignKey':'SubjectId'});db[_0x61b1('0xac')]['hasMany'](db[_0x61b1('0xac')],{'as':'Description','foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0xac')][_0x61b1('0x10f')](db[_0x61b1('0xac')],{'as':'Field','foreignKey':'FieldId'});db[_0x61b1('0xac')]['belongsTo'](db[_0x61b1('0x1c8')],{'as':_0x61b1('0x1c8'),'foreignKey':_0x61b1('0x1cd')});db[_0x61b1('0xae')][_0x61b1('0x10f')](db['ZendeskConfiguration'],{'as':_0x61b1('0x1be'),'onDelete':'cascade','foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0xb0')]['hasMany'](db[_0x61b1('0x1d1')],{'as':_0x61b1('0x1cb'),'foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0xb0')]['hasMany'](db[_0x61b1('0x1d1')],{'as':_0x61b1('0x1c2'),'foreignKey':_0x61b1('0x1c3')});db['ZendeskConfiguration']['hasMany'](db[_0x61b1('0x1d1')],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db['ZendeskAccount'],{'as':_0x61b1('0x16e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x61b1('0x11f')](db[_0x61b1('0x8b')],{'through':_0x61b1('0x1d2')});db['ZendeskField']['hasMany'](db[_0x61b1('0x1d1')],{'as':_0x61b1('0x1c5'),'foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0x1d1')]['hasMany'](db[_0x61b1('0x1d1')],{'as':_0x61b1('0x1c6'),'foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0x1d1')]['hasMany'](db[_0x61b1('0x1d1')],{'as':_0x61b1('0x1c7'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0x1d1')][_0x61b1('0x11d')](db[_0x61b1('0x1c8')],{'as':'Variable','foreignKey':_0x61b1('0x1cd')});db[_0x61b1('0xb2')][_0x61b1('0x10f')](db[_0x61b1('0xb4')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x61b1('0xb4')][_0x61b1('0x10f')](db[_0x61b1('0xb6')],{'as':_0x61b1('0x1cb'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0xb4')][_0x61b1('0x10f')](db[_0x61b1('0xb6')],{'as':_0x61b1('0x1c2'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c3')});db['FreshdeskConfiguration'][_0x61b1('0x10f')](db[_0x61b1('0xb6')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x61b1('0xb4')][_0x61b1('0x11d')](db[_0x61b1('0xb2')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0xb4')][_0x61b1('0x11f')](db['Tag'],{'through':_0x61b1('0x1d3')});db['FreshdeskField'][_0x61b1('0x10f')](db[_0x61b1('0xb6')],{'as':'Subject','foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0xb6')][_0x61b1('0x10f')](db[_0x61b1('0xb6')],{'as':'Description','foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0xb6')][_0x61b1('0x10f')](db[_0x61b1('0xb6')],{'as':_0x61b1('0x1c7'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0xb6')]['belongsTo'](db[_0x61b1('0x1c8')],{'as':_0x61b1('0x1c8'),'foreignKey':_0x61b1('0x1cd')});db[_0x61b1('0xb8')][_0x61b1('0x10f')](db['VtigerConfiguration'],{'as':_0x61b1('0x1be'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0xba')][_0x61b1('0x10f')](db[_0x61b1('0x1d4')],{'as':_0x61b1('0x1cb'),'foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0xba')][_0x61b1('0x10f')](db[_0x61b1('0x1d4')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x61b1('0xba')]['hasMany'](db[_0x61b1('0x1d4')],{'as':_0x61b1('0x1ba'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0xba')]['belongsTo'](db[_0x61b1('0xb8')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0x1d4')]['hasMany'](db[_0x61b1('0x1d4')],{'as':_0x61b1('0x1c5'),'foreignKey':'SubjectId'});db[_0x61b1('0x1d4')][_0x61b1('0x10f')](db[_0x61b1('0x1d4')],{'as':_0x61b1('0x1c6'),'foreignKey':'DescriptionId'});db[_0x61b1('0x1d4')][_0x61b1('0x10f')](db[_0x61b1('0x1d4')],{'as':_0x61b1('0x1c7'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0x1d4')][_0x61b1('0x11d')](db[_0x61b1('0x1c8')],{'as':_0x61b1('0x1c8'),'foreignKey':_0x61b1('0x1cd')});db[_0x61b1('0xbd')][_0x61b1('0x10f')](db[_0x61b1('0x1d5')],{'as':_0x61b1('0x1be'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0x1d5')][_0x61b1('0x10f')](db[_0x61b1('0xbf')],{'as':'Subjects','foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0x1d5')][_0x61b1('0x10f')](db[_0x61b1('0xbf')],{'as':'Descriptions','foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0x1d5')][_0x61b1('0x10f')](db[_0x61b1('0xbf')],{'as':'Fields','foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0x1d5')][_0x61b1('0x11d')](db[_0x61b1('0xbd')],{'as':'Account','foreignKey':'AccountId'});db[_0x61b1('0xbf')][_0x61b1('0x10f')](db[_0x61b1('0xbf')],{'as':_0x61b1('0x1c5'),'foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0xbf')][_0x61b1('0x10f')](db[_0x61b1('0xbf')],{'as':_0x61b1('0x1c6'),'foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0xbf')][_0x61b1('0x10f')](db[_0x61b1('0xbf')],{'as':'Field','foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0xbf')][_0x61b1('0x11d')](db[_0x61b1('0x1c8')],{'as':_0x61b1('0x1c8'),'foreignKey':_0x61b1('0x1cd')});db[_0x61b1('0xc1')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x61b1('0x1be'),'onDelete':'cascade','foreignKey':_0x61b1('0x1bf')});db['Dynamics365Account'][_0x61b1('0x11d')](db[_0x61b1('0x160')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0x61b1('0x10f')](db[_0x61b1('0xc4')],{'as':_0x61b1('0x1cb'),'onDelete':'cascade','foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0x1d6')][_0x61b1('0x10f')](db[_0x61b1('0xc4')],{'as':'Descriptions','onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c3')});db[_0x61b1('0x1d6')]['hasMany'](db['Dynamics365Field'],{'as':_0x61b1('0x1ba'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0x1d6')][_0x61b1('0x11d')](db[_0x61b1('0xc1')],{'as':_0x61b1('0x16e'),'foreignKey':_0x61b1('0x1bf')});db['Dynamics365Field'][_0x61b1('0x10f')](db['Dynamics365Field'],{'as':_0x61b1('0x1c5'),'foreignKey':'SubjectId'});db[_0x61b1('0xc4')][_0x61b1('0x10f')](db[_0x61b1('0xc4')],{'as':_0x61b1('0x1c6'),'foreignKey':_0x61b1('0x1c3')});db['Dynamics365Field'][_0x61b1('0x10f')](db[_0x61b1('0xc4')],{'as':'Field','foreignKey':_0x61b1('0x1c4')});db['Dynamics365Field'][_0x61b1('0x11d')](db[_0x61b1('0x1c8')],{'as':_0x61b1('0x1c8'),'foreignKey':_0x61b1('0x1cd')});db[_0x61b1('0x1d7')][_0x61b1('0x10f')](db[_0x61b1('0xc7')],{'as':_0x61b1('0x1be'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0xc7')][_0x61b1('0x10f')](db[_0x61b1('0x1d8')],{'as':'Subjects','foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0xc7')][_0x61b1('0x10f')](db[_0x61b1('0x1d8')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x61b1('0xc7')][_0x61b1('0x10f')](db['FreshsalesField'],{'as':'Fields','foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0xc7')][_0x61b1('0x11d')](db[_0x61b1('0x1d7')],{'as':'Account','foreignKey':_0x61b1('0x1bf')});db[_0x61b1('0x1d8')][_0x61b1('0x10f')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0x61b1('0x1c1')});db[_0x61b1('0x1d8')]['hasMany'](db[_0x61b1('0x1d8')],{'as':_0x61b1('0x1c6'),'foreignKey':'DescriptionId'});db[_0x61b1('0x1d8')]['hasMany'](db[_0x61b1('0x1d8')],{'as':_0x61b1('0x1c7'),'foreignKey':_0x61b1('0x1c4')});db[_0x61b1('0x1d8')][_0x61b1('0x11d')](db['Variable'],{'as':_0x61b1('0x1c8'),'foreignKey':_0x61b1('0x1cd')});db['ChatQueueReport'][_0x61b1('0x11d')](db[_0x61b1('0x175')],{});db[_0x61b1('0xcb')]['belongsTo'](db['CmList'],{'as':_0x61b1('0x16a'),'foreignKey':'ListId'});db[_0x61b1('0xcb')][_0x61b1('0x11d')](db['CmContact'],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db['ChatQueueReport'][_0x61b1('0x11d')](db[_0x61b1('0x66')],{});db['ChatQueueReport'][_0x61b1('0x11d')](db[_0x61b1('0x68')],{});db[_0x61b1('0xcb')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{});db['ChatQueueReport'][_0x61b1('0x11d')](db[_0x61b1('0x12e')],{});db[_0x61b1('0xcc')][_0x61b1('0x11d')](db['User'],{'onDelete':'cascade','foreignKey':_0x61b1('0x1d9')});db[_0x61b1('0xcc')]['belongsTo'](db[_0x61b1('0x11')],{'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1da')});db['JscriptySessionReport'][_0x61b1('0x10f')](db['JscriptyQuestionReport'],{'foreignKey':_0x61b1('0x1db'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0xd2')][_0x61b1('0x10f')](db[_0x61b1('0xce')],{'foreignKey':_0x61b1('0x1db'),'onDelete':_0x61b1('0x10b')});db[_0x61b1('0xd3')][_0x61b1('0x11d')](db[_0x61b1('0x51')],{});db[_0x61b1('0xd3')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x16a'),'foreignKey':'ListId'});db[_0x61b1('0xd3')][_0x61b1('0x11d')](db['CmContact'],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db['SmsQueueReport'][_0x61b1('0x11d')](db[_0x61b1('0x55')],{});db[_0x61b1('0xd3')][_0x61b1('0x11d')](db[_0x61b1('0x56')],{});db[_0x61b1('0xd3')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{});db[_0x61b1('0xd3')][_0x61b1('0x11d')](db['SmsQueue'],{});db[_0x61b1('0xd6')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x61b1('0x1dc')});db[_0x61b1('0xd6')][_0x61b1('0x10f')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x61b1('0xd6')][_0x61b1('0x10f')](db[_0x61b1('0xce')],{'foreignKey':'ProjectId'});db['Team']['belongsToMany'](db[_0x61b1('0x11')],{'as':'Agents','through':'user_has_teams'});db[_0x61b1('0xe0')][_0x61b1('0x11f')](db[_0x61b1('0x12c')],{'through':_0x61b1('0x105'),'as':'VoiceQueues'});db['Team'][_0x61b1('0x11f')](db[_0x61b1('0x16c')],{'through':_0x61b1('0x1dd'),'as':'MailQueues'});db['Team'][_0x61b1('0x11f')](db['ChatQueue'],{'through':_0x61b1('0x198'),'as':_0x61b1('0x12f')});db[_0x61b1('0xe0')][_0x61b1('0x11f')](db[_0x61b1('0x4f')],{'through':_0x61b1('0x181'),'as':'FaxQueues'});db[_0x61b1('0xe0')]['belongsToMany'](db[_0x61b1('0x57')],{'through':_0x61b1('0x189'),'as':_0x61b1('0x132')});db['Team'][_0x61b1('0x11f')](db[_0x61b1('0x5f')],{'through':_0x61b1('0x18e'),'as':_0x61b1('0x133')});db[_0x61b1('0xe0')][_0x61b1('0x11f')](db[_0x61b1('0x102')],{'through':'team_has_whatsapp_queues','as':_0x61b1('0x134')});db[_0x61b1('0xe0')]['belongsToMany'](db[_0x61b1('0xf3')],{'through':_0x61b1('0x106'),'as':'VoicePrefixes'});db[_0x61b1('0xe4')][_0x61b1('0x10f')](db[_0x61b1('0x147')],{'as':_0x61b1('0x148'),'foreignKey':_0x61b1('0x1de')});db[_0x61b1('0xe4')][_0x61b1('0x10f')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x61b1('0x1de')});db[_0x61b1('0xe4')][_0x61b1('0x10f')](db['CmHopperHistory'],{'as':_0x61b1('0x149'),'foreignKey':_0x61b1('0x1de')});db[_0x61b1('0xe4')][_0x61b1('0x10f')](db['CmHopperBlack'],{'as':_0x61b1('0x14a'),'foreignKey':_0x61b1('0x1de')});db['Campaign']['belongsTo'](db[_0x61b1('0x29')],{'as':'Trunk','foreignKey':_0x61b1('0x14c')});db[_0x61b1('0xe4')][_0x61b1('0x11d')](db[_0x61b1('0x29')],{'as':_0x61b1('0x14d'),'foreignKey':_0x61b1('0x14e')});db[_0x61b1('0xe4')][_0x61b1('0x11d')](db[_0x61b1('0x14f')],{'as':_0x61b1('0x14f'),'foreignKey':_0x61b1('0x150')});db[_0x61b1('0xe4')]['belongsTo'](db[_0x61b1('0xdb')],{'as':'SquareProject','foreignKey':_0x61b1('0x1df')});db[_0x61b1('0xe4')]['belongsToMany'](db[_0x61b1('0xf2')],{'as':_0x61b1('0x122'),'through':_0x61b1('0x1e0')});db[_0x61b1('0xe4')]['belongsToMany'](db['CmList'],{'as':_0x61b1('0x1e1'),'through':'campaigns_has_cm_blacklists'});db[_0x61b1('0xe6')][_0x61b1('0x11d')](db[_0x61b1('0x6a')],{'as':_0x61b1('0x6a'),'foreignKey':_0x61b1('0x197')});db[_0x61b1('0xea')][_0x61b1('0x11d')](db[_0x61b1('0x167')],{});db['MailTransferReport'][_0x61b1('0x11d')](db[_0x61b1('0x41')],{});db[_0x61b1('0xea')][_0x61b1('0x11d')](db['MailAccount'],{'foreignKey':_0x61b1('0x1e2'),'as':_0x61b1('0x1e3')});db['MailTransferReport'][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'foreignKey':'FromUserId','as':_0x61b1('0x1e4')});db[_0x61b1('0xea')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'foreignKey':'ToUserId','as':_0x61b1('0x1e5')});db['MailTransferReport'][_0x61b1('0x11d')](db[_0x61b1('0x16c')],{'foreignKey':_0x61b1('0x1e6'),'as':_0x61b1('0x1e7')});db['MailTransferReport'][_0x61b1('0x11d')](db[_0x61b1('0x3c')],{'foreignKey':_0x61b1('0x1e8'),'as':'ToAccount'});db[_0x61b1('0xec')][_0x61b1('0x11d')](db['ChatMessage'],{});db[_0x61b1('0xec')]['belongsTo'](db['ChatInteraction'],{});db[_0x61b1('0xec')][_0x61b1('0x11d')](db[_0x61b1('0x175')],{'foreignKey':_0x61b1('0x1e9'),'as':_0x61b1('0x1e3')});db[_0x61b1('0xec')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'foreignKey':_0x61b1('0x1ea'),'as':'FromAgent'});db['ChatTransferReport'][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'foreignKey':_0x61b1('0x1eb'),'as':_0x61b1('0x1e5')});db['ChatTransferReport'][_0x61b1('0x11d')](db[_0x61b1('0x12e')],{'foreignKey':_0x61b1('0x1ec'),'as':_0x61b1('0x1e7')});db[_0x61b1('0xec')][_0x61b1('0x11d')](db[_0x61b1('0x175')],{'foreignKey':_0x61b1('0x1ed'),'as':'ToAccount'});db[_0x61b1('0x1ee')][_0x61b1('0x11d')](db[_0x61b1('0x4d')],{});db[_0x61b1('0x1ee')][_0x61b1('0x11d')](db[_0x61b1('0x116')],{});db['FaxTransferReport']['belongsTo'](db[_0x61b1('0x4a')],{'foreignKey':'FromFaxAccountId','as':'FromAccount'});db['FaxTransferReport'][_0x61b1('0x11d')](db['User'],{'foreignKey':_0x61b1('0x1ea'),'as':_0x61b1('0x1e4')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x61b1('0x1eb'),'as':_0x61b1('0x1e5')});db['FaxTransferReport'][_0x61b1('0x11d')](db[_0x61b1('0x4f')],{'foreignKey':_0x61b1('0x1ef'),'as':_0x61b1('0x1e7')});db['FaxTransferReport']['belongsTo'](db[_0x61b1('0x4a')],{'foreignKey':_0x61b1('0x1f0'),'as':'ToAccount'});db[_0x61b1('0x1f1')][_0x61b1('0x11d')](db[_0x61b1('0x5d')],{});db[_0x61b1('0x1f1')]['belongsTo'](db[_0x61b1('0x5b')],{});db[_0x61b1('0x1f1')][_0x61b1('0x11d')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x61b1('0x1e3')});db[_0x61b1('0x1f1')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'foreignKey':'FromUserId','as':_0x61b1('0x1e4')});db['OpenchannelTransferReport'][_0x61b1('0x11d')](db['User'],{'foreignKey':_0x61b1('0x1eb'),'as':_0x61b1('0x1e5')});db[_0x61b1('0x1f1')][_0x61b1('0x11d')](db[_0x61b1('0x5f')],{'foreignKey':'ToOpenchannelQueueId','as':_0x61b1('0x1e7')});db[_0x61b1('0x1f1')][_0x61b1('0x11d')](db[_0x61b1('0x13a')],{'foreignKey':_0x61b1('0x1f2'),'as':_0x61b1('0x1f3')});db['SmsTransferReport']['belongsTo'](db[_0x61b1('0x56')],{});db[_0x61b1('0xf0')]['belongsTo'](db[_0x61b1('0x55')],{});db[_0x61b1('0xf0')]['belongsTo'](db[_0x61b1('0x51')],{'foreignKey':_0x61b1('0x1f4'),'as':_0x61b1('0x1e3')});db['SmsTransferReport'][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'foreignKey':_0x61b1('0x1ea'),'as':_0x61b1('0x1e4')});db[_0x61b1('0xf0')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'foreignKey':_0x61b1('0x1eb'),'as':_0x61b1('0x1e5')});db[_0x61b1('0xf0')][_0x61b1('0x11d')](db['SmsQueue'],{'foreignKey':_0x61b1('0x1f5'),'as':_0x61b1('0x1e7')});db[_0x61b1('0xf0')][_0x61b1('0x11d')](db[_0x61b1('0x51')],{'foreignKey':_0x61b1('0x1f6'),'as':_0x61b1('0x1f3')});db['CmList']['hasMany'](db[_0x61b1('0x81')],{'as':_0x61b1('0x165'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x61b1('0xf2')][_0x61b1('0x10f')](db['CmCustomField'],{'as':_0x61b1('0x1f7'),'foreignKey':_0x61b1('0x16b')});db['CmList'][_0x61b1('0x10f')](db[_0x61b1('0x70')],{'as':_0x61b1('0x121'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x61b1('0xf2')][_0x61b1('0x10f')](db[_0x61b1('0x75')],{'as':_0x61b1('0x111'),'foreignKey':_0x61b1('0x16b')});db['CmList'][_0x61b1('0x10f')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x61b1('0x10f')](db['ReportAgentPreview'],{'as':_0x61b1('0x79'),'foreignKey':_0x61b1('0x16b')});db['CmList']['belongsToMany'](db['VoiceQueue'],{'as':_0x61b1('0x1f8'),'through':_0x61b1('0x154')});db['CmList']['belongsToMany'](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x123')});db[_0x61b1('0xf3')][_0x61b1('0x10f')](db[_0x61b1('0x17')],{'as':'Extensions','onDelete':_0x61b1('0x10b')});db['VoicePrefix'][_0x61b1('0x11f')](db['User'],{'as':_0x61b1('0x155'),'through':_0x61b1('0x107')});db[_0x61b1('0xf3')][_0x61b1('0x11f')](db[_0x61b1('0xe0')],{'through':_0x61b1('0x106'),'as':_0x61b1('0x156')});db[_0x61b1('0xf4')][_0x61b1('0x10f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x173'),'foreignKey':'userProfileId'});db[_0x61b1('0xf4')][_0x61b1('0x10f')](db[_0x61b1('0x1f9')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x61b1('0x10b')});db['UserProfileSection'][_0x61b1('0x10f')](db[_0x61b1('0xf7')],{'as':_0x61b1('0x1fa'),'foreignKey':_0x61b1('0x1fb'),'onDelete':_0x61b1('0x10b')});db['WhatsappAccount']['hasMany'](db[_0x61b1('0x81')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x61b1('0x13e')][_0x61b1('0x10f')](db[_0x61b1('0x166')],{'as':_0x61b1('0x17c'),'foreignKey':_0x61b1('0x1fc')});db[_0x61b1('0x13e')][_0x61b1('0x10f')](db[_0x61b1('0xfd')],{'as':_0x61b1('0x159'),'foreignKey':_0x61b1('0x1fc')});db[_0x61b1('0x13e')][_0x61b1('0x10f')](db[_0x61b1('0x118')],{'as':_0x61b1('0x168')});db[_0x61b1('0x13e')][_0x61b1('0x10f')](db[_0x61b1('0xfb')],{'as':_0x61b1('0x169')});db[_0x61b1('0x13e')]['belongsTo'](db['CmList'],{'as':_0x61b1('0x16a'),'foreignKey':'ListId'});db[_0x61b1('0x13e')]['belongsTo'](db['Pause'],{'as':_0x61b1('0x152'),'foreignKey':_0x61b1('0x153')});db['WhatsappAccount'][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x140')});db[_0x61b1('0xfb')][_0x61b1('0x11d')](db['User'],{'onDelete':'restrict'});db[_0x61b1('0xfb')][_0x61b1('0x11d')](db[_0x61b1('0x102')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db['WhatsappAccount'],{'onDelete':_0x61b1('0x162')});db[_0x61b1('0xfb')][_0x61b1('0x11d')](db[_0x61b1('0x14f')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x61b1('0xfb')][_0x61b1('0x11d')](db[_0x61b1('0x8b')],{'onDelete':'restrict','foreignKey':_0x61b1('0x177')});db[_0x61b1('0x118')]['hasMany'](db[_0x61b1('0xfd')],{'as':_0x61b1('0x159'),'onDelete':_0x61b1('0x10b'),'foreignKey':_0x61b1('0x1fd')});db[_0x61b1('0x118')][_0x61b1('0x11d')](db[_0x61b1('0x13e')],{'as':'Account','foreignKey':_0x61b1('0x1fc')});db[_0x61b1('0x118')]['belongsTo'](db[_0x61b1('0x70')],{'as':'Contact','foreignKey':'ContactId'});db[_0x61b1('0x118')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x16f'),'foreignKey':'UserId'});db[_0x61b1('0x118')][_0x61b1('0x11f')](db['Tag'],{'through':_0x61b1('0x1b3'),'as':_0x61b1('0x171')});db['WhatsappInteraction']['belongsToMany'](db[_0x61b1('0x8b')],{'through':_0x61b1('0x1b3'),'as':'ThroughTags'});db[_0x61b1('0x118')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x173'),'through':_0x61b1('0x12b'),'foreignKey':'WhatsappInteractionId'});db[_0x61b1('0xfd')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'as':_0x61b1('0x11')});db[_0x61b1('0xfd')]['belongsTo'](db[_0x61b1('0x70')],{'onDelete':'cascade','as':_0x61b1('0x15e')});db['WhatsappMessage'][_0x61b1('0x11d')](db[_0x61b1('0x118')],{'onDelete':_0x61b1('0x10b'),'as':'Interaction','foreignKey':_0x61b1('0x1fd')});db['WhatsappMessage'][_0x61b1('0x11d')](db[_0x61b1('0x13e')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x61b1('0xfe')][_0x61b1('0x11d')](db['WhatsappAccount'],{});db[_0x61b1('0xfe')][_0x61b1('0x11d')](db[_0x61b1('0xf2')],{'as':_0x61b1('0x16a'),'foreignKey':_0x61b1('0x16b')});db[_0x61b1('0xfe')][_0x61b1('0x11d')](db[_0x61b1('0x70')],{'as':_0x61b1('0x15e'),'foreignKey':_0x61b1('0x178')});db[_0x61b1('0xfe')][_0x61b1('0x11d')](db['WhatsappInteraction'],{});db[_0x61b1('0xfe')][_0x61b1('0x11d')](db[_0x61b1('0x102')],{});db[_0x61b1('0xfe')][_0x61b1('0x11d')](db['WhatsappMessage'],{});db[_0x61b1('0xfe')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{});db[_0x61b1('0x100')]['belongsTo'](db[_0x61b1('0xfd')],{});db[_0x61b1('0x100')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x61b1('0x100')]['belongsTo'](db[_0x61b1('0x13e')],{'foreignKey':_0x61b1('0x1fe'),'as':_0x61b1('0x1e3')});db[_0x61b1('0x100')][_0x61b1('0x11d')](db[_0x61b1('0x13e')],{'foreignKey':_0x61b1('0x1ff'),'as':_0x61b1('0x1f3')});db[_0x61b1('0x100')][_0x61b1('0x11d')](db[_0x61b1('0x102')],{'foreignKey':_0x61b1('0x200'),'as':'ToQueue'});db[_0x61b1('0x100')][_0x61b1('0x11d')](db[_0x61b1('0x11')],{'foreignKey':_0x61b1('0x1ea'),'as':'FromAgent'});db[_0x61b1('0x100')]['belongsTo'](db[_0x61b1('0x11')],{'foreignKey':_0x61b1('0x1eb'),'as':'ToAgent'});db[_0x61b1('0x102')][_0x61b1('0x11f')](db[_0x61b1('0x11')],{'as':_0x61b1('0x155'),'through':_0x61b1('0x37'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0x61b1('0x11f')](db[_0x61b1('0xe0')],{'through':_0x61b1('0x201'),'as':_0x61b1('0x156')});db['UserSetting'][_0x61b1('0x11d')](db['User'],{'as':_0x61b1('0x202'),'foreignKey':_0x61b1('0x10c'),'onDelete':_0x61b1('0x10b'),'hooks':!![]});db[_0x61b1('0x160')][_0x61b1('0x10a')](db[_0x61b1('0xc1')],{'as':'Dynamics365Account','onDelete':_0x61b1('0x162')});db[_0x61b1('0x160')][_0x61b1('0x10a')](db[_0x61b1('0x39')],{'as':_0x61b1('0x163'),'onDelete':_0x61b1('0x162')});db[_0x61b1('0x160')][_0x61b1('0x10a')](db['MailServerOut'],{'as':_0x61b1('0x164'),'onDelete':_0x61b1('0x162')});module[_0x61b1('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8f22feb..c808d25 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce31=['./api/webbar','/api/logs','static','join','root','/www','/demo','snippet','3.1.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/triggers','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/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/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/system','/api/pm2','./api/pm2','/api/webbar'];(function(_0x21feca,_0x165ecf){var _0x5f4d98=function(_0x2db50a){while(--_0x2db50a){_0x21feca['push'](_0x21feca['shift']());}};_0x5f4d98(++_0x165ecf);}(_0xce31,0x12a));var _0x1ce3=function(_0x4d4e4d,_0xd39cba){_0x4d4e4d=_0x4d4e4d-0x0;var _0x478f6b=_0xce31[_0x4d4e4d];return _0x478f6b;};'use strict';var path=require(_0x1ce3('0x0'));var express=require(_0x1ce3('0x1'));var errors=require(_0x1ce3('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x1ce3('0x3'))[_0x1ce3('0x4')];var clientSideLogs=require(_0x1ce3('0x5'));exports[_0x1ce3('0x6')]=function(_0x4a8dd0){return setupLoggers(_0x4a8dd0)[_0x1ce3('0x7')](function(){_0x4a8dd0[_0x1ce3('0x8')]('/api/users',require(_0x1ce3('0x9')));_0x4a8dd0['use'](_0x1ce3('0xa'),require('./api/voiceChanSpy'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb'),require(_0x1ce3('0xc')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd'),require('./api/voiceExtension'));_0x4a8dd0['use'](_0x1ce3('0xe'),require('./api/voiceMusicOnHold'));_0x4a8dd0['use'](_0x1ce3('0xf'),require(_0x1ce3('0x10')));_0x4a8dd0['use'](_0x1ce3('0x11'),require(_0x1ce3('0x12')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x13'),require('./api/screenRecording'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x14'),require(_0x1ce3('0x15')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x16'),require(_0x1ce3('0x17')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x18'),require('./api/voiceCallReport'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x19'),require(_0x1ce3('0x1a')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x1b'),require(_0x1ce3('0x1c')));_0x4a8dd0[_0x1ce3('0x8')]('/api/voice/queues/reports',require(_0x1ce3('0x1d')));_0x4a8dd0[_0x1ce3('0x8')]('/api/members/reports',require(_0x1ce3('0x1e')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x1f'),require(_0x1ce3('0x20')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x21'),require(_0x1ce3('0x22')));_0x4a8dd0['use'](_0x1ce3('0x23'),require(_0x1ce3('0x24')));_0x4a8dd0['use'](_0x1ce3('0x25'),require(_0x1ce3('0x26')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x27'),require(_0x1ce3('0x28')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x29'),require(_0x1ce3('0x2a')));_0x4a8dd0['use'](_0x1ce3('0x2b'),require(_0x1ce3('0x2c')));_0x4a8dd0[_0x1ce3('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x2d'),require(_0x1ce3('0x2e')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x2f'),require(_0x1ce3('0x30')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x31'),require(_0x1ce3('0x32')));_0x4a8dd0['use'](_0x1ce3('0x33'),require(_0x1ce3('0x34')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x35'),require(_0x1ce3('0x36')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x37'),require(_0x1ce3('0x38')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x39'),require(_0x1ce3('0x3a')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x3b'),require(_0x1ce3('0x3c')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x3d'),require(_0x1ce3('0x3e')));_0x4a8dd0[_0x1ce3('0x8')]('/api/fax/reports/queue',require(_0x1ce3('0x3f')));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/applications',require('./api/smsApplication'));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/interactions',require(_0x1ce3('0x40')));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/messages',require('./api/smsMessage'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x41'),require(_0x1ce3('0x42')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x43'),require(_0x1ce3('0x44')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x45'),require('./api/openchannelApplication'));_0x4a8dd0['use'](_0x1ce3('0x46'),require(_0x1ce3('0x47')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x48'),require(_0x1ce3('0x49')));_0x4a8dd0['use'](_0x1ce3('0x4a'),require(_0x1ce3('0x4b')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x4c'),require(_0x1ce3('0x4d')));_0x4a8dd0[_0x1ce3('0x8')]('/api/openchannel/reports/queue',require(_0x1ce3('0x4e')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x4f'),require(_0x1ce3('0x50')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x51'),require(_0x1ce3('0x52')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x53'),require('./api/chatMessage'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x54'),require(_0x1ce3('0x55')));_0x4a8dd0['use']('/api/chat/queues',require('./api/chatQueue'));_0x4a8dd0['use'](_0x1ce3('0x56'),require(_0x1ce3('0x57')));_0x4a8dd0[_0x1ce3('0x8')]('/api/chat/proactive_actions',require(_0x1ce3('0x58')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x59'),require(_0x1ce3('0x5a')));_0x4a8dd0[_0x1ce3('0x8')]('/api/cm/contacts',require('./api/cmContact'));_0x4a8dd0['use'](_0x1ce3('0x5b'),require(_0x1ce3('0x5c')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x5d'),require('./api/cmHopperBlack'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x5e'),require('./api/cmHopperFinal'));_0x4a8dd0['use'](_0x1ce3('0x5f'),require(_0x1ce3('0x60')));_0x4a8dd0['use'](_0x1ce3('0x61'),require(_0x1ce3('0x62')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x63'),require(_0x1ce3('0x64')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x65'),require(_0x1ce3('0x66')));_0x4a8dd0[_0x1ce3('0x8')]('/api/canned_answers',require(_0x1ce3('0x67')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x68'),require(_0x1ce3('0x69')));_0x4a8dd0['use']('/api/conditions',require(_0x1ce3('0x6a')));_0x4a8dd0['use']('/api/intervals',require(_0x1ce3('0x6b')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x6c'),require('./api/pause'));_0x4a8dd0['use'](_0x1ce3('0x6d'),require(_0x1ce3('0x6e')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x6f'),require('./api/voiceQueuesLog'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x70'),require(_0x1ce3('0x71')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x72'),require(_0x1ce3('0x73')));_0x4a8dd0[_0x1ce3('0x8')]('/api/tags',require('./api/tag'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x74'),require('./api/contactItemType'));_0x4a8dd0['use'](_0x1ce3('0x75'),require(_0x1ce3('0x76')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x77'),require(_0x1ce3('0x78')));_0x4a8dd0[_0x1ce3('0x8')]('/api/templates',require('./api/template'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x79'),require(_0x1ce3('0x7a')));_0x4a8dd0[_0x1ce3('0x8')]('/api/variables',require(_0x1ce3('0x7b')));_0x4a8dd0['use']('/api/integrations',require(_0x1ce3('0x7c')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x7d'),require(_0x1ce3('0x7e')));_0x4a8dd0[_0x1ce3('0x8')]('/api/analytics/custom_reports',require(_0x1ce3('0x7f')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x80'),require('./api/analyticDefaultReport'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x81'),require(_0x1ce3('0x82')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x83'),require(_0x1ce3('0x84')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x85'),require(_0x1ce3('0x86')));_0x4a8dd0['use'](_0x1ce3('0x87'),require(_0x1ce3('0x88')));_0x4a8dd0['use'](_0x1ce3('0x89'),require('./api/intSalesforceAccount'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x8a'),require(_0x1ce3('0x8b')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x8c'),require(_0x1ce3('0x8d')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x8e'),require('./api/intSugarcrmAccount'));_0x4a8dd0['use'](_0x1ce3('0x8f'),require(_0x1ce3('0x90')));_0x4a8dd0[_0x1ce3('0x8')]('/api/integrations/sugarcrm/fields',require(_0x1ce3('0x91')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x92'),require(_0x1ce3('0x93')));_0x4a8dd0['use']('/api/integrations/desk/configurations',require(_0x1ce3('0x94')));_0x4a8dd0[_0x1ce3('0x8')]('/api/integrations/desk/fields',require(_0x1ce3('0x95')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x96'),require(_0x1ce3('0x97')));_0x4a8dd0['use'](_0x1ce3('0x98'),require(_0x1ce3('0x99')));_0x4a8dd0[_0x1ce3('0x8')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x9a'),require(_0x1ce3('0x9b')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x9c'),require(_0x1ce3('0x9d')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x9e'),require(_0x1ce3('0x9f')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa0'),require(_0x1ce3('0xa1')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa2'),require(_0x1ce3('0xa3')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa4'),require(_0x1ce3('0xa5')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa6'),require(_0x1ce3('0xa7')));_0x4a8dd0['use']('/api/integrations/vtiger/configurations',require(_0x1ce3('0xa8')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xa9'),require(_0x1ce3('0xaa')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xab'),require('./api/intServicenowAccount'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xac'),require(_0x1ce3('0xad')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xae'),require('./api/intServicenowField'));_0x4a8dd0['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xaf'),require(_0x1ce3('0xb0')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb1'),require(_0x1ce3('0xb2')));_0x4a8dd0[_0x1ce3('0x8')]('/api/integrations/freshsales/accounts',require(_0x1ce3('0xb3')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb4'),require(_0x1ce3('0xb5')));_0x4a8dd0['use']('/api/integrations/freshsales/fields',require(_0x1ce3('0xb6')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb7'),require(_0x1ce3('0xb8')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xb9'),require('./api/chatQueueReport'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xba'),require(_0x1ce3('0xbb')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xbc'),require(_0x1ce3('0xbd')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xbe'),require(_0x1ce3('0xbf')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xc0'),require(_0x1ce3('0xc1')));_0x4a8dd0[_0x1ce3('0x8')]('/api/sms/reports/queue',require(_0x1ce3('0xc2')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xc3'),require(_0x1ce3('0xc4')));_0x4a8dd0['use'](_0x1ce3('0xc5'),require(_0x1ce3('0xc6')));_0x4a8dd0['use']('/api/jscripty/projects',require(_0x1ce3('0xc7')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xc8'),require(_0x1ce3('0xc9')));_0x4a8dd0['use'](_0x1ce3('0xca'),require(_0x1ce3('0xcb')));_0x4a8dd0['use'](_0x1ce3('0xcc'),require(_0x1ce3('0xcd')));_0x4a8dd0['use'](_0x1ce3('0xce'),require(_0x1ce3('0xcf')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd0'),require('./api/squareMessage'));_0x4a8dd0['use'](_0x1ce3('0xd1'),require(_0x1ce3('0xd2')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd3'),require(_0x1ce3('0xd4')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd5'),require(_0x1ce3('0xd6')));_0x4a8dd0['use'](_0x1ce3('0xd7'),require('./api/migration'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xd8'),require(_0x1ce3('0xd9')));_0x4a8dd0[_0x1ce3('0x8')]('/api/plugins',require(_0x1ce3('0xda')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xdb'),require(_0x1ce3('0xdc')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xdd'),require(_0x1ce3('0xde')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xdf'),require(_0x1ce3('0xe0')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xe1'),require(_0x1ce3('0xe2')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xe3'),require(_0x1ce3('0xe4')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xe5'),require(_0x1ce3('0xe6')));_0x4a8dd0['use'](_0x1ce3('0xe7'),require(_0x1ce3('0xe8')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xe9'),require('./api/userProfile'));_0x4a8dd0[_0x1ce3('0x8')]('/api/userProfile/sections',require(_0x1ce3('0xea')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xeb'),require(_0x1ce3('0xec')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xed'),require(_0x1ce3('0xee')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xef'),require(_0x1ce3('0xf0')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xf1'),require('./api/whatsappApplication'));_0x4a8dd0['use'](_0x1ce3('0xf2'),require(_0x1ce3('0xf3')));_0x4a8dd0[_0x1ce3('0x8')]('/api/whatsapp/messages',require(_0x1ce3('0xf4')));_0x4a8dd0['use'](_0x1ce3('0xf5'),require(_0x1ce3('0xf6')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xf7'),require('./api/whatsappTransferReport'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xf8'),require(_0x1ce3('0xf9')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xfa'),require(_0x1ce3('0xfb')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xfc'),require('./api/realtime'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0xfd'),require(_0x1ce3('0xfe')));_0x4a8dd0[_0x1ce3('0x8')]('/api/auth/local',require(_0x1ce3('0xff')));_0x4a8dd0[_0x1ce3('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x4a8dd0[_0x1ce3('0x8')]('/api/auth/activedirectory',require(_0x1ce3('0x100')));_0x4a8dd0['use']('/api/jira',require('./api/jira'));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x101'),require(_0x1ce3('0x102')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x103'),require('./api/version'));_0x4a8dd0[_0x1ce3('0x8')]('/api/system',require(_0x1ce3('0x104')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x105'),require(_0x1ce3('0x106')));_0x4a8dd0['use'](_0x1ce3('0x107'),require(_0x1ce3('0x108')));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x109'),clientSideLogs);_0x4a8dd0['use']('/apidoc',express[_0x1ce3('0x10a')](path[_0x1ce3('0x10b')](config[_0x1ce3('0x10c')],'/apidoc')));_0x4a8dd0[_0x1ce3('0x8')]('/www',express[_0x1ce3('0x10a')](path[_0x1ce3('0x10b')](config['root'],_0x1ce3('0x10d'))));_0x4a8dd0[_0x1ce3('0x8')]('/demo',express['static'](path[_0x1ce3('0x10b')](config[_0x1ce3('0x10c')],_0x1ce3('0x10e'))));_0x4a8dd0['use']('/snippet',express[_0x1ce3('0x10a')](path['join'](config[_0x1ce3('0x10c')],_0x1ce3('0x10f'),_0x1ce3('0x110'))));_0x4a8dd0[_0x1ce3('0x8')](_0x1ce3('0x111'),express[_0x1ce3('0x10a')](path[_0x1ce3('0x10b')](config[_0x1ce3('0x10c')],_0x1ce3('0x112'))));_0x4a8dd0[_0x1ce3('0x113')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1ce3('0x114')](errors[0x194]);_0x4a8dd0[_0x1ce3('0x113')]('/*')['get'](function(_0x16b661,_0xec8cb2){_0xec8cb2[_0x1ce3('0x115')](path[_0x1ce3('0x116')](_0x4a8dd0[_0x1ce3('0x114')](_0x1ce3('0x117'))+_0x1ce3('0x118')));});return _0x4a8dd0;});}; \ No newline at end of file +var _0xfd51=['/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/user-settings','/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/system','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.1.0','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailQueueReport','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/pauses','./api/pause','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField'];(function(_0x3acb5b,_0x484688){var _0x2a2633=function(_0x2fb582){while(--_0x2fb582){_0x3acb5b['push'](_0x3acb5b['shift']());}};_0x2a2633(++_0x484688);}(_0xfd51,0x17b));var _0x1fd5=function(_0x31c7c1,_0x45ae0b){_0x31c7c1=_0x31c7c1-0x0;var _0x39f43d=_0xfd51[_0x31c7c1];return _0x39f43d;};'use strict';var path=require(_0x1fd5('0x0'));var express=require(_0x1fd5('0x1'));var errors=require(_0x1fd5('0x2'));var config=require(_0x1fd5('0x3'));var setupLoggers=require(_0x1fd5('0x4'))[_0x1fd5('0x5')];var clientSideLogs=require(_0x1fd5('0x6'));exports[_0x1fd5('0x7')]=function(_0x3524e3){return setupLoggers(_0x3524e3)['then'](function(){_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x9'),require(_0x1fd5('0xa')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xb'),require(_0x1fd5('0xc')));_0x3524e3['use']('/api/voice/contexts',require(_0x1fd5('0xd')));_0x3524e3[_0x1fd5('0x8')]('/api/voice/extensions',require(_0x1fd5('0xe')));_0x3524e3['use'](_0x1fd5('0xf'),require(_0x1fd5('0x10')));_0x3524e3['use'](_0x1fd5('0x11'),require('./api/voiceQueue'));_0x3524e3['use'](_0x1fd5('0x12'),require('./api/voiceRecording'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x13'),require(_0x1fd5('0x14')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x15'),require(_0x1fd5('0x16')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x17'),require(_0x1fd5('0x18')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x19'),require('./api/voiceCallReport'));_0x3524e3['use'](_0x1fd5('0x1a'),require('./api/voiceDialReport'));_0x3524e3[_0x1fd5('0x8')]('/api/voice/agents/reports',require(_0x1fd5('0x1b')));_0x3524e3['use'](_0x1fd5('0x1c'),require(_0x1fd5('0x1d')));_0x3524e3['use'](_0x1fd5('0x1e'),require('./api/memberReport'));_0x3524e3[_0x1fd5('0x8')]('/api/trunks',require(_0x1fd5('0x1f')));_0x3524e3[_0x1fd5('0x8')]('/api/voice/transfers/reports',require(_0x1fd5('0x20')));_0x3524e3[_0x1fd5('0x8')]('/api/mail/out_servers',require(_0x1fd5('0x21')));_0x3524e3['use'](_0x1fd5('0x22'),require(_0x1fd5('0x23')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x24'),require(_0x1fd5('0x25')));_0x3524e3[_0x1fd5('0x8')]('/api/mail/substatuses',require(_0x1fd5('0x26')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x27'),require(_0x1fd5('0x28')));_0x3524e3['use'](_0x1fd5('0x29'),require(_0x1fd5('0x2a')));_0x3524e3[_0x1fd5('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x3524e3[_0x1fd5('0x8')]('/api/mail/reports/queue',require(_0x1fd5('0x2b')));_0x3524e3['use']('/api/dashboards',require('./api/dashboard'));_0x3524e3[_0x1fd5('0x8')]('/api/dashboards/items',require(_0x1fd5('0x2c')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x2d'),require(_0x1fd5('0x2e')));_0x3524e3['use'](_0x1fd5('0x2f'),require(_0x1fd5('0x30')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x31'),require(_0x1fd5('0x32')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x33'),require('./api/faxMessage'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x34'),require(_0x1fd5('0x35')));_0x3524e3['use'](_0x1fd5('0x36'),require('./api/faxQueueReport'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x37'),require(_0x1fd5('0x38')));_0x3524e3[_0x1fd5('0x8')]('/api/sms/applications',require(_0x1fd5('0x39')));_0x3524e3[_0x1fd5('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x3524e3[_0x1fd5('0x8')]('/api/sms/messages',require(_0x1fd5('0x3a')));_0x3524e3['use']('/api/sms/queues',require(_0x1fd5('0x3b')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x3c'),require('./api/openchannelAccount'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x3d'),require(_0x1fd5('0x3e')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x3f'),require(_0x1fd5('0x40')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x41'),require(_0x1fd5('0x42')));_0x3524e3[_0x1fd5('0x8')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x43'),require(_0x1fd5('0x44')));_0x3524e3['use'](_0x1fd5('0x45'),require('./api/openchannelQueueReport'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x46'),require(_0x1fd5('0x47')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x48'),require(_0x1fd5('0x49')));_0x3524e3['use']('/api/chat/messages',require(_0x1fd5('0x4a')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x4b'),require(_0x1fd5('0x4c')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x4d'),require('./api/chatQueue'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x4e'),require(_0x1fd5('0x4f')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x50'),require('./api/chatProactiveAction'));_0x3524e3['use'](_0x1fd5('0x51'),require(_0x1fd5('0x52')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x53'),require(_0x1fd5('0x54')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x55'),require(_0x1fd5('0x56')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x57'),require(_0x1fd5('0x58')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x59'),require(_0x1fd5('0x5a')));_0x3524e3[_0x1fd5('0x8')]('/api/cm/hopper_history',require(_0x1fd5('0x5b')));_0x3524e3[_0x1fd5('0x8')]('/api/cm/custom_fields',require(_0x1fd5('0x5c')));_0x3524e3[_0x1fd5('0x8')]('/api/actions',require(_0x1fd5('0x5d')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x5e'),require(_0x1fd5('0x5f')));_0x3524e3[_0x1fd5('0x8')]('/api/canned_answers',require(_0x1fd5('0x60')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x61'),require('./api/disposition'));_0x3524e3['use'](_0x1fd5('0x62'),require(_0x1fd5('0x63')));_0x3524e3[_0x1fd5('0x8')]('/api/intervals',require('./api/interval'));_0x3524e3['use'](_0x1fd5('0x64'),require(_0x1fd5('0x65')));_0x3524e3[_0x1fd5('0x8')]('/api/cdr',require('./api/cdr'));_0x3524e3['use']('/api/voiceQueuesLog',require(_0x1fd5('0x66')));_0x3524e3['use']('/api/schedules',require(_0x1fd5('0x67')));_0x3524e3[_0x1fd5('0x8')]('/api/sounds',require(_0x1fd5('0x68')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x69'),require(_0x1fd5('0x6a')));_0x3524e3['use'](_0x1fd5('0x6b'),require(_0x1fd5('0x6c')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x6d'),require(_0x1fd5('0x6e')));_0x3524e3['use'](_0x1fd5('0x6f'),require(_0x1fd5('0x70')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x71'),require(_0x1fd5('0x72')));_0x3524e3['use'](_0x1fd5('0x73'),require(_0x1fd5('0x74')));_0x3524e3[_0x1fd5('0x8')]('/api/variables',require(_0x1fd5('0x75')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x76'),require(_0x1fd5('0x77')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x78'),require(_0x1fd5('0x79')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x7a'),require(_0x1fd5('0x7b')));_0x3524e3[_0x1fd5('0x8')]('/api/analytics/default_reports',require(_0x1fd5('0x7c')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x7d'),require('./api/analyticExtractedReport'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x7e'),require(_0x1fd5('0x7f')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x80'),require(_0x1fd5('0x81')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x82'),require('./api/analyticTreeReport'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x83'),require('./api/intSalesforceAccount'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x84'),require(_0x1fd5('0x85')));_0x3524e3['use'](_0x1fd5('0x86'),require(_0x1fd5('0x87')));_0x3524e3['use'](_0x1fd5('0x88'),require(_0x1fd5('0x89')));_0x3524e3['use'](_0x1fd5('0x8a'),require('./api/intSugarcrmConfiguration'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x8b'),require('./api/intSugarcrmField'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x8c'),require(_0x1fd5('0x8d')));_0x3524e3['use'](_0x1fd5('0x8e'),require(_0x1fd5('0x8f')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x90'),require(_0x1fd5('0x91')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x92'),require('./api/intZohoAccount'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x93'),require('./api/intZohoConfiguration'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x94'),require('./api/intZohoField'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x95'),require(_0x1fd5('0x96')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x97'),require(_0x1fd5('0x98')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x99'),require(_0x1fd5('0x9a')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x9b'),require(_0x1fd5('0x9c')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x9d'),require('./api/intFreshdeskConfiguration'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x9e'),require(_0x1fd5('0x9f')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xa0'),require(_0x1fd5('0xa1')));_0x3524e3['use'](_0x1fd5('0xa2'),require(_0x1fd5('0xa3')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xa4'),require('./api/intVtigerField'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xa5'),require('./api/intServicenowAccount'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xa6'),require(_0x1fd5('0xa7')));_0x3524e3[_0x1fd5('0x8')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xa8'),require('./api/intDynamics365Account'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xa9'),require('./api/intDynamics365Configuration'));_0x3524e3[_0x1fd5('0x8')]('/api/integrations/dynamics365/fields',require(_0x1fd5('0xaa')));_0x3524e3[_0x1fd5('0x8')]('/api/integrations/freshsales/accounts',require(_0x1fd5('0xab')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xac'),require('./api/intFreshsalesConfiguration'));_0x3524e3['use'](_0x1fd5('0xad'),require(_0x1fd5('0xae')));_0x3524e3['use'](_0x1fd5('0xaf'),require(_0x1fd5('0xb0')));_0x3524e3[_0x1fd5('0x8')]('/api/chat/reports/queue',require(_0x1fd5('0xb1')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xb2'),require(_0x1fd5('0xb3')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xb4'),require(_0x1fd5('0xb5')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xb6'),require(_0x1fd5('0xb7')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xb8'),require(_0x1fd5('0xb9')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xba'),require(_0x1fd5('0xbb')));_0x3524e3[_0x1fd5('0x8')]('/api/square/reports',require(_0x1fd5('0xbc')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xbd'),require(_0x1fd5('0xbe')));_0x3524e3[_0x1fd5('0x8')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x3524e3[_0x1fd5('0x8')]('/api/settings',require(_0x1fd5('0xbf')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xc0'),require(_0x1fd5('0xc1')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xc2'),require('./api/squareProject'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xc3'),require('./api/squareRecording'));_0x3524e3['use']('/api/square/messages',require(_0x1fd5('0xc4')));_0x3524e3['use'](_0x1fd5('0xc5'),require(_0x1fd5('0xc6')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xc7'),require(_0x1fd5('0xc8')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xc9'),require(_0x1fd5('0xca')));_0x3524e3[_0x1fd5('0x8')]('/api/migrations',require(_0x1fd5('0xcb')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xcc'),require('./api/attachment'));_0x3524e3['use']('/api/plugins',require(_0x1fd5('0xcd')));_0x3524e3['use'](_0x1fd5('0xce'),require(_0x1fd5('0xcf')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xd0'),require(_0x1fd5('0xd1')));_0x3524e3[_0x1fd5('0x8')]('/api/fax/reports/transfer',require(_0x1fd5('0xd2')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xd3'),require(_0x1fd5('0xd4')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xd5'),require('./api/smsTransferReport'));_0x3524e3['use']('/api/cm/lists',require(_0x1fd5('0xd6')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xd7'),require('./api/voicePrefix'));_0x3524e3[_0x1fd5('0x8')]('/api/userProfiles',require(_0x1fd5('0xd8')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xd9'),require(_0x1fd5('0xda')));_0x3524e3['use'](_0x1fd5('0xdb'),require('./api/userProfileResource'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xdc'),require(_0x1fd5('0xdd')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xde'),require(_0x1fd5('0xdf')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xe0'),require(_0x1fd5('0xe1')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xe2'),require(_0x1fd5('0xe3')));_0x3524e3['use']('/api/whatsapp/messages',require(_0x1fd5('0xe4')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xe5'),require(_0x1fd5('0xe6')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xe7'),require(_0x1fd5('0xe8')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xe9'),require(_0x1fd5('0xea')));_0x3524e3[_0x1fd5('0x8')]('/api/cloudProviders',require(_0x1fd5('0xeb')));_0x3524e3['use']('/api/realtime',require('./api/realtime'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xec'),require('./api/user-setting'));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xed'),require(_0x1fd5('0xee')));_0x3524e3['use'](_0x1fd5('0xef'),require('./api/authGoogle'));_0x3524e3['use']('/api/auth/activedirectory',require(_0x1fd5('0xf0')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xf1'),require(_0x1fd5('0xf2')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xf3'),require(_0x1fd5('0xf4')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xf5'),require(_0x1fd5('0xf6')));_0x3524e3['use'](_0x1fd5('0xf7'),require(_0x1fd5('0xf8')));_0x3524e3['use']('/api/pm2',require('./api/pm2'));_0x3524e3['use']('/api/webbar',require(_0x1fd5('0xf9')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xfa'),clientSideLogs);_0x3524e3[_0x1fd5('0x8')]('/apidoc',express[_0x1fd5('0xfb')](path[_0x1fd5('0xfc')](config[_0x1fd5('0xfd')],_0x1fd5('0xfe'))));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0xff'),express[_0x1fd5('0xfb')](path['join'](config[_0x1fd5('0xfd')],'/www')));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x100'),express[_0x1fd5('0xfb')](path[_0x1fd5('0xfc')](config['root'],_0x1fd5('0x100'))));_0x3524e3[_0x1fd5('0x8')](_0x1fd5('0x101'),express[_0x1fd5('0xfb')](path[_0x1fd5('0xfc')](config[_0x1fd5('0xfd')],_0x1fd5('0x102'),_0x1fd5('0x103'))));_0x3524e3[_0x1fd5('0x8')]('/plugins',express['static'](path[_0x1fd5('0xfc')](config['root'],_0x1fd5('0x104'))));_0x3524e3[_0x1fd5('0x105')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1fd5('0x106')](errors[0x194]);_0x3524e3['route']('/*')['get'](function(_0x40cc18,_0x3b725c){_0x3b725c[_0x1fd5('0x107')](path[_0x1fd5('0x108')](_0x3524e3[_0x1fd5('0x106')](_0x1fd5('0x109'))+_0x1fd5('0x10a')));});return _0x3524e3;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 17240a6..76137e9 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d64=['../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.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/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.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/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc'];(function(_0xc54587,_0x2cb1d8){var _0x464a37=function(_0x23b6a3){while(--_0x23b6a3){_0xc54587['push'](_0xc54587['shift']());}};_0x464a37(++_0x2cb1d8);}(_0x0d64,0x1c4));var _0x40d6=function(_0x2ea74f,_0x358a70){_0x2ea74f=_0x2ea74f-0x0;var _0x448bdc=_0x0d64[_0x2ea74f];return _0x448bdc;};'use strict';var jayson=require('jayson/promise');var _=require(_0x40d6('0x0'));var config=require(_0x40d6('0x1'));exports['listen']=function(){return new Promise(function(_0x5cfba2,_0x330f0a){var _0x306594={};_0x306594=_['merge'](_0x306594,require(_0x40d6('0x2')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/voiceExtension/voiceExtension.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x4')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/voiceRecording/voiceRecording.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x5')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x6')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x7')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x8')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/memberReport/memberReport.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/trunk/trunk.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x9')));_0x306594=_['merge'](_0x306594,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xa')));_0x306594=_['merge'](_0x306594,require('../api/mailAccount/mailAccount.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0xb')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xc')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xd')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xe')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0xf')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x10')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x11')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x12')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/faxMessage/faxMessage.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x13')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x14')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x15')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x16')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x17')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x18')));_0x306594=_['merge'](_0x306594,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x19')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1a')));_0x306594=_['merge'](_0x306594,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1b')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1c')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1d')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/chatQueue/chatQueue.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1e')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x1f')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x20')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x21')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x22')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x23')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x24')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x25')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/sound/sound.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x26')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x27')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/trigger/trigger.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x28')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x29')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x2a')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x2b')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x2c')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x2d')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x2e')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x2f')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x30')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x31')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x32')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x33')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x34')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x35')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/squareRecording/squareRecording.rpc'));_0x306594=_['merge'](_0x306594,require('../api/squareMessage/squareMessage.rpc'));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x36')));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x37')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x38')));_0x306594=_[_0x40d6('0x3')](_0x306594,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x306594=_['merge'](_0x306594,require(_0x40d6('0x39')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x3a')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x3b')));_0x306594=_[_0x40d6('0x3')](_0x306594,require(_0x40d6('0x3c')));var _0x1d6642=jayson[_0x40d6('0x3d')](_0x306594)[_0x40d6('0x3e')]();var _0x33f292=config[_0x40d6('0x3f')][_0x40d6('0x40')]||config[_0x40d6('0x40')]+0x1;var _0x141281=config[_0x40d6('0x3f')]['ip']||_0x40d6('0x41');_0x1d6642['on'](_0x40d6('0x42'),function(_0x2a7404){return _0x330f0a(_0x2a7404);});_0x1d6642[_0x40d6('0x43')](_0x33f292,_0x141281,function(){console[_0x40d6('0x44')](_0x40d6('0x45'),_0x141281,_0x33f292);require(_0x40d6('0x46'))[_0x40d6('0x47')]();return _0x5cfba2(_0x40d6('0x48')+_0x141281+':'+_0x33f292);});});}; \ No newline at end of file +var _0xb7ae=['../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','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/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.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/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc'];(function(_0x53c828,_0x11a92f){var _0x22bf5f=function(_0x4a68ec){while(--_0x4a68ec){_0x53c828['push'](_0x53c828['shift']());}};_0x22bf5f(++_0x11a92f);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x3a419c,_0x55c831){_0x3a419c=_0x3a419c-0x0;var _0x350805=_0xb7ae[_0x3a419c];return _0x350805;};'use strict';var jayson=require(_0xeb7a('0x0'));var _=require(_0xeb7a('0x1'));var config=require(_0xeb7a('0x2'));exports[_0xeb7a('0x3')]=function(){return new Promise(function(_0x3749dd,_0x497fc8){var _0x1121bd={};_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x5')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x6')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x7')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x8')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x9')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0xa')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0xb')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0xc')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0xd')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0xe')));_0x1121bd=_['merge'](_0x1121bd,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0xf')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x10')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x11')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/mailQueue/mailQueue.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x12')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x13')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/mailApplication/mailApplication.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x14')));_0x1121bd=_['merge'](_0x1121bd,require('../api/faxApplication/faxApplication.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x15')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x16')));_0x1121bd=_['merge'](_0x1121bd,require('../api/faxQueue/faxQueue.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x17')));_0x1121bd=_['merge'](_0x1121bd,require('../api/smsAccount/smsAccount.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x18')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x19')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x1a')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x1b')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x1c')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x1d')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x1e')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x1f')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x20')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x21')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x22')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x23')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x24')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x25')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x26')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x27')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x28')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x29')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/template/template.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x2a')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x2b')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x2c')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x2d')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x2e')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x2f')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x30')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x31')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x32')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x33')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x34')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x35')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x36')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x37')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x38')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/squareOdbc/squareOdbc.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x39')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x3a')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x3b')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x3c')));_0x1121bd=_['merge'](_0x1121bd,require(_0xeb7a('0x3d')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/plugin/plugin.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x3e')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x3f')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x40')));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x1121bd=_[_0xeb7a('0x4')](_0x1121bd,require(_0xeb7a('0x41')));var _0x308a2e=jayson[_0xeb7a('0x42')](_0x1121bd)[_0xeb7a('0x43')]();var _0x2458fb=config[_0xeb7a('0x44')][_0xeb7a('0x45')]||config[_0xeb7a('0x45')]+0x1;var _0x16164b=config[_0xeb7a('0x44')]['ip']||_0xeb7a('0x46');_0x308a2e['on']('error',function(_0x2d3d4d){return _0x497fc8(_0x2d3d4d);});_0x308a2e[_0xeb7a('0x3')](_0x2458fb,_0x16164b,function(){console[_0xeb7a('0x47')](_0xeb7a('0x48'),_0x16164b,_0x2458fb);require('../config/triggers')[_0xeb7a('0x49')]();return _0x3749dd(_0xeb7a('0x4a')+_0x16164b+':'+_0x2458fb);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index bc9cdeb..e6c3863 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 _0x9a0d=['toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','emit','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','command','write','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','SET\x20VARIABLE\x20%s\x20\x22%s\x22'];(function(_0x209d12,_0x8597c5){var _0x46c291=function(_0x20667d){while(--_0x20667d){_0x209d12['push'](_0x209d12['shift']());}};_0x46c291(++_0x8597c5);}(_0x9a0d,0x1ee));var _0xd9a0=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x9a0d[_0x46cf00];return _0x3974dc;};'use strict';var util=require(_0xd9a0('0x0'));var _=require('lodash');var EventEmitter=require(_0xd9a0('0x1'))[_0xd9a0('0x2')];var AGIReply=require(_0xd9a0('0x3'));var AGIError=require(_0xd9a0('0x4'));function AGIChannel(_0x179d5c){var _0x1b5b4c=this,_0x603e=new AGIReply(),_0x519df1=![],_0x31c6ce={};EventEmitter[_0xd9a0('0x5')](_0x1b5b4c);_0x179d5c[_0xd9a0('0x6')](_0xd9a0('0x7'));_0x179d5c[_0xd9a0('0x8')](0x8*0x3c*0x3c*0x3e8);_0x603e[_0xd9a0('0x6')](_0xd9a0('0x7'));_0x603e['on'](_0xd9a0('0x9'),function(_0x17e5fc){for(var _0x1e079c in _0x17e5fc){_0x1b5b4c[_0x1e079c]=_0x17e5fc[_0x1e079c];}_0x1b5b4c['emit'](_0xd9a0('0xa'));});_0x603e['on'](_0xd9a0('0xb'),function(_0x1f5d6d){if(_0x1f5d6d[_0xd9a0('0xc')]()==_0xd9a0('0xd')){_0x1b5b4c['emit'](_0xd9a0('0xd'));return;}if(_0x1f5d6d['substring'](0x0,0xb)=='520-Invalid'){_0x519df1=!![];}if(_0x519df1){_0x31c6ce['rx']+=_0x1f5d6d+'\x0a';if(_0x1f5d6d[_0xd9a0('0xe')](_0xd9a0('0xf'))!=-0x1){_0x519df1=![];}}else{_0x31c6ce['rx']=_0x1f5d6d;}if(_0x519df1){return;}if(typeof _0x31c6ce['cb']==_0xd9a0('0x10')){var _0x4a2ec9=_0x31c6ce['rx'][_0xd9a0('0x11')](0x0,0x3),_0x4d7c8a=null,_0x302a08=null;_0x4a2ec9=parseInt(_0x4a2ec9);if(isNaN(_0x4a2ec9)){_0x31c6ce['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd9a0('0x12')});return;}if(_0x4a2ec9!=0xc8){_0x31c6ce['cb'](null,{'code':_0x4a2ec9,'result':-0x1,'extra':'KO'});return;}_0x4d7c8a=_0x31c6ce['rx'][_0xd9a0('0x11')](0x4)[_0xd9a0('0x13')](_0xd9a0('0x14'),'');if(_0x4d7c8a[_0xd9a0('0x15')]('\x20')!=-0x1){_0x4d7c8a=_0x4d7c8a[_0xd9a0('0x16')](0x0,_0x4d7c8a[_0xd9a0('0x15')]('\x20'));}if(_[_0xd9a0('0x17')](_0x4d7c8a,'-1')){_0x4d7c8a=parseInt(_0x4d7c8a);}_0x302a08=_0x31c6ce['rx'][_0xd9a0('0x18')]('\x20');if(_0x302a08[_0xd9a0('0x19')]==0x3){_0x302a08=_0x302a08[0x2][_0xd9a0('0x11')](0x1,_0x302a08[0x2][_0xd9a0('0x19')]-0x1);}else if(_0x302a08[_0xd9a0('0x19')]>0x3){var _0x50b08c=/\((.+)\)/;var _0x52d93d=_0x31c6ce['rx'][_0xd9a0('0x1a')](_0x50b08c);if(_0x52d93d){_0x302a08=_0x52d93d[0x1];}else{_0x302a08=null;}}else{_0x302a08=null;}_0x31c6ce['cb'](null,{'code':_0x4a2ec9,'result':_0x4d7c8a,'extra':_0x302a08});}});_0x179d5c['on'](_0xd9a0('0x1b'),function(_0x3448f2){_0x1b5b4c[_0xd9a0('0x1c')]('error',new AGIError(_0xd9a0('0x1d'),_0x3448f2[_0xd9a0('0x1e')]));});_0x179d5c['on'](_0xd9a0('0x1f'),function(){_0x1b5b4c['emit'](_0xd9a0('0x1f'),new AGIError(_0xd9a0('0x20')));});_0x179d5c['on']('timeout',function(){_0x1b5b4c['emit']('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x179d5c[_0xd9a0('0x21')]();});_0x179d5c[_0xd9a0('0x22')](_0x603e);this[_0xd9a0('0x23')]=function(_0x2fea9b,_0x1bcbb2){var _0x2fea9b=_0x2fea9b||'',_0x1bcbb2=typeof _0x1bcbb2=='function'?_0x1bcbb2:new Function();_0x31c6ce={'tx':_0x2fea9b,'rx':'','cb':_0x1bcbb2};_0x179d5c[_0xd9a0('0x24')](_0x2fea9b+'\x0a');},this[_0xd9a0('0x1f')]=function(){_0x179d5c[_0xd9a0('0x21')]();};}util[_0xd9a0('0x25')](AGIChannel,EventEmitter);AGIChannel[_0xd9a0('0x26')]['sendRequest']=function(_0x4de39a){return this[_0xd9a0('0x23')][_0xd9a0('0x27')](this,_0x4de39a);};AGIChannel['prototype'][_0xd9a0('0x28')]=function(){return this[_0xd9a0('0x29')](_0xd9a0('0x2a'));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x2b')]=function(_0x37c7ed,_0x589d12,_0x2e6f4e){_0x37c7ed=_0x37c7ed===undefined?'beep':_0x37c7ed;_0x589d12=_0x589d12===undefined?'5':_0x589d12;_0x2e6f4e=_0x2e6f4e===undefined?'1':_0x2e6f4e;return this['sendRequest'](util[_0xd9a0('0x2c')](_0xd9a0('0x2d'),_0x37c7ed,_0x589d12*0x3e8,_0x2e6f4e));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x2e')]=function(_0x1c2a20){_0x1c2a20=_0x1c2a20||'NO\x20MESSAGE';return this[_0xd9a0('0x29')](util['format'](_0xd9a0('0x2f'),_0x1c2a20));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x30')]=function(_0x4cf4ad,_0x2d619c){if(_[_0xd9a0('0x31')](_0x2d619c)){return this[_0xd9a0('0x29')](util['format']('EXEC\x20%s\x20%s',_0x4cf4ad,_0x2d619c[_0xd9a0('0x32')](',')));}return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x33'),_0x4cf4ad,_0x2d619c));};AGIChannel['prototype'][_0xd9a0('0x34')]=function(_0xea605b){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x35'),_0xea605b));};AGIChannel[_0xd9a0('0x26')]['setExtension']=function(_0x2bd4c4){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x36'),_0x2bd4c4));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x37')]=function(_0x4c07ea){return this['sendRequest'](util['format'](_0xd9a0('0x38'),_0x4c07ea));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0xd')]=function(){return this[_0xd9a0('0x29')](_0xd9a0('0x39'));};AGIChannel['prototype']['setVariable']=function(_0x8c93e6,_0x4b3408){var _0x4008e6=_['isBoolean'](_0x4b3408)||_['isNumber'](_0x4b3408)?_0x4b3408['toString']():_0x4b3408;return this['sendRequest'](util[_0xd9a0('0x2c')](_0xd9a0('0x3a'),_0x8c93e6,_0x4008e6?_0x4008e6[_0xd9a0('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x3c')]=function(_0x334f52,_0xd00a59){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0x334f52,_0xd00a59));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x3d')]=function(_0x243336,_0x50110c){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x3e'),_0x243336,_0x50110c));};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x3f')]=function(_0x69fbd5,_0x475535){return this['sendRequest'](util[_0xd9a0('0x2c')](_0xd9a0('0x40'),_0x69fbd5,_0x475535));};AGIChannel['prototype'][_0xd9a0('0x41')]=function(_0x17c497,_0x271888,_0x2e83fd){_0x271888=_0x271888||this[_0xd9a0('0x42')];_0x2e83fd=_0x2e83fd||0x1;this[_0xd9a0('0x34')](_0x17c497);this[_0xd9a0('0x43')](_0x271888);this['setPriority'](_0x2e83fd);return this[_0xd9a0('0x2e')](util['format'](_0xd9a0('0x44'),_0x17c497,_0x271888,_0x2e83fd));};AGIChannel[_0xd9a0('0x26')]['getVariable']=function(_0x3d21a2){return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x45'),_0x3d21a2));};AGIChannel['prototype'][_0xd9a0('0x46')]=function(_0x3a0ff5,_0x1a5669,_0xb2f25a,_0x4572f1,_0x40ea37,_0x4c44ec){_0x1a5669=_0x1a5669||_0xd9a0('0x47');_0xb2f25a=_0xb2f25a||'';_0x4572f1=_0x4572f1===undefined?-0x1:_0x4572f1==='-1'?-0x1:_0x4572f1*0x3e8;_0x40ea37=_0x40ea37===undefined?'':'s='+_0x40ea37;_0x4c44ec=_0x4c44ec?'BEEP':'';return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3a0ff5,_0x1a5669,_0xb2f25a,_0x4572f1,_0x4c44ec,_0x40ea37));};AGIChannel['prototype'][_0xd9a0('0x48')]=function(_0x5c7b64,_0x5a6c41){_0x5a6c41=_0x5a6c41||'';return this[_0xd9a0('0x29')](util[_0xd9a0('0x2c')](_0xd9a0('0x49'),_0x5c7b64,_0x5a6c41));};AGIChannel[_0xd9a0('0x26')]['agi']=function(_0x51d5dc){return this[_0xd9a0('0x30')](_0xd9a0('0x4a'),_0x51d5dc);};AGIChannel['prototype'][_0xd9a0('0x4b')]=function(_0x162472){return this[_0xd9a0('0x30')](_0xd9a0('0x4c'),_0x162472);};AGIChannel[_0xd9a0('0x26')][_0xd9a0('0x1b')]=function(_0x57b225,_0x345e18){this[_0xd9a0('0x2e')](util['format'](_0xd9a0('0x4d'),_0x57b225['id'],_0x57b225[_0xd9a0('0x4e')],_0x345e18));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xfeef=['answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','hangup','HANGUP','setVariable','isBoolean','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','toLowerCase','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','prototype','sendRequest'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfeef,0x10b));var _0xffee=function(_0x56272a,_0x205c53){_0x56272a=_0x56272a-0x0;var _0x3009c6=_0xfeef[_0x56272a];return _0x3009c6;};'use strict';var util=require(_0xffee('0x0'));var _=require('lodash');var EventEmitter=require(_0xffee('0x1'))[_0xffee('0x2')];var AGIReply=require(_0xffee('0x3'));var AGIError=require(_0xffee('0x4'));function AGIChannel(_0x2c8db1){var _0x35cf46=this,_0x1ad432=new AGIReply(),_0x19e939=![],_0x2c399a={};EventEmitter[_0xffee('0x5')](_0x35cf46);_0x2c8db1[_0xffee('0x6')]('utf8');_0x2c8db1[_0xffee('0x7')](0x8*0x3c*0x3c*0x3e8);_0x1ad432[_0xffee('0x6')](_0xffee('0x8'));_0x1ad432['on'](_0xffee('0x9'),function(_0x4dbf39){for(var _0x35a665 in _0x4dbf39){_0x35cf46[_0x35a665]=_0x4dbf39[_0x35a665];}_0x35cf46[_0xffee('0xa')](_0xffee('0xb'));});_0x1ad432['on']('line',function(_0x5ba871){if(_0x5ba871[_0xffee('0xc')]()=='hangup'){_0x35cf46['emit']('hangup');return;}if(_0x5ba871[_0xffee('0xd')](0x0,0xb)==_0xffee('0xe')){_0x19e939=!![];}if(_0x19e939){_0x2c399a['rx']+=_0x5ba871+'\x0a';if(_0x5ba871['search'](_0xffee('0xf'))!=-0x1){_0x19e939=![];}}else{_0x2c399a['rx']=_0x5ba871;}if(_0x19e939){return;}if(typeof _0x2c399a['cb']==_0xffee('0x10')){var _0x1693f1=_0x2c399a['rx'][_0xffee('0xd')](0x0,0x3),_0x9f0d6f=null,_0x2c7579=null;_0x1693f1=parseInt(_0x1693f1);if(isNaN(_0x1693f1)){_0x2c399a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xffee('0x11')});return;}if(_0x1693f1!=0xc8){_0x2c399a['cb'](null,{'code':_0x1693f1,'result':-0x1,'extra':'KO'});return;}_0x9f0d6f=_0x2c399a['rx']['substring'](0x4)[_0xffee('0x12')](_0xffee('0x13'),'');if(_0x9f0d6f['indexOf']('\x20')!=-0x1){_0x9f0d6f=_0x9f0d6f[_0xffee('0x14')](0x0,_0x9f0d6f[_0xffee('0x15')]('\x20'));}if(_[_0xffee('0x16')](_0x9f0d6f,'-1')){_0x9f0d6f=parseInt(_0x9f0d6f);}_0x2c7579=_0x2c399a['rx'][_0xffee('0x17')]('\x20');if(_0x2c7579[_0xffee('0x18')]==0x3){_0x2c7579=_0x2c7579[0x2]['substring'](0x1,_0x2c7579[0x2][_0xffee('0x18')]-0x1);}else if(_0x2c7579['length']>0x3){var _0x117f3a=/\((.+)\)/;var _0x46f2b8=_0x2c399a['rx']['match'](_0x117f3a);if(_0x46f2b8){_0x2c7579=_0x46f2b8[0x1];}else{_0x2c7579=null;}}else{_0x2c7579=null;}_0x2c399a['cb'](null,{'code':_0x1693f1,'result':_0x9f0d6f,'extra':_0x2c7579});}});_0x2c8db1['on'](_0xffee('0x19'),function(_0x55fbd4){_0x35cf46[_0xffee('0xa')](_0xffee('0x19'),new AGIError(_0xffee('0x1a'),_0x55fbd4[_0xffee('0x1b')]));});_0x2c8db1['on'](_0xffee('0x1c'),function(){_0x35cf46[_0xffee('0xa')](_0xffee('0x1c'),new AGIError(_0xffee('0x1d')));});_0x2c8db1['on'](_0xffee('0x1e'),function(){_0x35cf46[_0xffee('0xa')](_0xffee('0x1e'),new AGIError(_0xffee('0x1f')));_0x2c8db1[_0xffee('0x20')]();});_0x2c8db1[_0xffee('0x21')](_0x1ad432);this[_0xffee('0x22')]=function(_0x1ed05f,_0xa83505){var _0x1ed05f=_0x1ed05f||'',_0xa83505=typeof _0xa83505==_0xffee('0x10')?_0xa83505:new Function();_0x2c399a={'tx':_0x1ed05f,'rx':'','cb':_0xa83505};_0x2c8db1['write'](_0x1ed05f+'\x0a');},this[_0xffee('0x1c')]=function(){_0x2c8db1['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xffee('0x23')][_0xffee('0x24')]=function(_0x48a663){return this[_0xffee('0x22')]['sync'](this,_0x48a663);};AGIChannel[_0xffee('0x23')][_0xffee('0x25')]=function(){return this['sendRequest'](_0xffee('0x26'));};AGIChannel[_0xffee('0x23')][_0xffee('0x27')]=function(_0x21859a,_0x5cad6b,_0x505e42){_0x21859a=_0x21859a===undefined?_0xffee('0x28'):_0x21859a;_0x5cad6b=_0x5cad6b===undefined?'5':_0x5cad6b;_0x505e42=_0x505e42===undefined?'1':_0x505e42;return this[_0xffee('0x24')](util['format'](_0xffee('0x29'),_0x21859a,_0x5cad6b*0x3e8,_0x505e42));};AGIChannel[_0xffee('0x23')][_0xffee('0x2a')]=function(_0x2c0c23){_0x2c0c23=_0x2c0c23||_0xffee('0x2b');return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x2d'),_0x2c0c23));};AGIChannel[_0xffee('0x23')][_0xffee('0x2e')]=function(_0x2f7a31,_0x524d04){if(_[_0xffee('0x2f')](_0x524d04)){return this['sendRequest'](util[_0xffee('0x2c')](_0xffee('0x30'),_0x2f7a31,_0x524d04['join'](',')));}return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x30'),_0x2f7a31,_0x524d04));};AGIChannel['prototype'][_0xffee('0x31')]=function(_0x4fbdf8){return this[_0xffee('0x24')](util['format'](_0xffee('0x32'),_0x4fbdf8));};AGIChannel[_0xffee('0x23')][_0xffee('0x33')]=function(_0x46f5b9){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x34'),_0x46f5b9));};AGIChannel[_0xffee('0x23')][_0xffee('0x35')]=function(_0x6455c1){return this[_0xffee('0x24')](util['format']('SET\x20PRIORITY\x20%s',_0x6455c1));};AGIChannel[_0xffee('0x23')][_0xffee('0x36')]=function(){return this['sendRequest'](_0xffee('0x37'));};AGIChannel[_0xffee('0x23')][_0xffee('0x38')]=function(_0x49dacb,_0x247d41){var _0x2693ce=_[_0xffee('0x39')](_0x247d41)||_['isNumber'](_0x247d41)?_0x247d41[_0xffee('0x3a')]():_0x247d41;return this[_0xffee('0x24')](util[_0xffee('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x49dacb,_0x2693ce?_0x2693ce[_0xffee('0x3a')]()[_0xffee('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xffee('0x23')][_0xffee('0x3b')]=function(_0x39f63b,_0xf5c727){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x3c'),_0x39f63b,_0xf5c727));};AGIChannel[_0xffee('0x23')]['sayDigits']=function(_0x2fd982,_0x195339){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x3d'),_0x2fd982,_0x195339));};AGIChannel[_0xffee('0x23')][_0xffee('0x3e')]=function(_0x587d4f,_0x268111){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x3f'),_0x587d4f,_0x268111));};AGIChannel['prototype'][_0xffee('0x40')]=function(_0x2d423d,_0x2c49e4,_0x1321eb){_0x2c49e4=_0x2c49e4||this[_0xffee('0x41')];_0x1321eb=_0x1321eb||0x1;this[_0xffee('0x31')](_0x2d423d);this[_0xffee('0x33')](_0x2c49e4);this['setPriority'](_0x1321eb);return this['noop'](util[_0xffee('0x2c')](_0xffee('0x42'),_0x2d423d,_0x2c49e4,_0x1321eb));};AGIChannel[_0xffee('0x23')]['getVariable']=function(_0x2159d5){return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x43'),_0x2159d5));};AGIChannel['prototype'][_0xffee('0x44')]=function(_0x592d98,_0x61980a,_0x1d1d5b,_0x9aee4b,_0x1f5e1e,_0x267b79){_0x61980a=_0x61980a||'wav';_0x1d1d5b=_0x1d1d5b||'';_0x9aee4b=_0x9aee4b===undefined?-0x1:_0x9aee4b==='-1'?-0x1:_0x9aee4b*0x3e8;_0x1f5e1e=_0x1f5e1e===undefined?'':'s='+_0x1f5e1e;_0x267b79=_0x267b79?_0xffee('0x45'):'';return this['sendRequest'](util[_0xffee('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x592d98,_0x61980a,_0x1d1d5b,_0x9aee4b,_0x267b79,_0x1f5e1e));};AGIChannel['prototype'][_0xffee('0x46')]=function(_0x4acdd6,_0xf5e12b){_0xf5e12b=_0xf5e12b||'';return this[_0xffee('0x24')](util[_0xffee('0x2c')](_0xffee('0x47'),_0x4acdd6,_0xf5e12b));};AGIChannel[_0xffee('0x23')]['agi']=function(_0x215380){return this[_0xffee('0x2e')]('AGI',_0x215380);};AGIChannel[_0xffee('0x23')][_0xffee('0x48')]=function(_0x2e9332){return this['exec']('WAIT',_0x2e9332);};AGIChannel[_0xffee('0x23')]['error']=function(_0x3375ec,_0xf46326){this['noop'](util[_0xffee('0x2c')](_0xffee('0x49'),_0x3375ec['id'],_0x3375ec[_0xffee('0x4a')],_0xf46326));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xffee('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ffc6a28..5246a0b 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 _0x293c=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x582fb8,_0x420a67){var _0x359409=function(_0xc5d208){while(--_0xc5d208){_0x582fb8['push'](_0x582fb8['shift']());}};_0x359409(++_0x420a67);}(_0x293c,0x1c1));var _0xc293=function(_0x4edcdf,_0x388d17){_0x4edcdf=_0x4edcdf-0x0;var _0x5b96f8=_0x293c[_0x4edcdf];return _0x5b96f8;};'use strict';var util=require(_0xc293('0x0'));var error={'E_AGI_UNDEFINED':_0xc293('0x1'),'E_AGI_ARGUMENT_PORT':_0xc293('0x2'),'E_AGI_SERVER_ERROR':_0xc293('0x3'),'E_AGI_SERVER_CLOSE':_0xc293('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xc293('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xc293('0x6'),'E_AGI_SOCKET_ERROR':_0xc293('0x7'),'E_AGI_SOCKET_CLOSE':_0xc293('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xc293('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc293('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2e6473){var _0x2e6473=_0x2e6473||null,_0x23f892=_0x23f892||[],_0x8944c1=0x1,_0x5b1d70='';if(!error[_0x2e6473]){_0x2e6473=_0xc293('0xb');}_0x23f892[_0xc293('0xc')](error[_0x2e6473]);while(arguments[_0x8944c1]){_0x23f892['push'](arguments[_0x8944c1]);_0x8944c1++;}_0x5b1d70=util[_0xc293('0xd')][_0xc293('0xe')](util,_0x23f892);this[_0xc293('0xf')]=_0x5b1d70;this[_0xc293('0x10')]=_0x2e6473;}module[_0xc293('0x11')]=AGIError; \ No newline at end of file +var _0xf990=['util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name'];(function(_0x22521b,_0x1b15fb){var _0x5a72f5=function(_0x413b78){while(--_0x413b78){_0x22521b['push'](_0x22521b['shift']());}};_0x5a72f5(++_0x1b15fb);}(_0xf990,0xa5));var _0x0f99=function(_0x5258d4,_0x46189b){_0x5258d4=_0x5258d4-0x0;var _0x2c7c72=_0xf990[_0x5258d4];return _0x2c7c72;};'use strict';var util=require(_0x0f99('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x0f99('0x1'),'E_AGI_SERVER_ERROR':_0x0f99('0x2'),'E_AGI_SERVER_CLOSE':_0x0f99('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x0f99('0x4'),'E_AGI_SOCKET_ERROR':_0x0f99('0x5'),'E_AGI_SOCKET_CLOSE':_0x0f99('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x0f99('0x7'),'E_AGI_COMMAND_EMPTY':_0x0f99('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0f99('0x9')};function AGIError(_0x2563cd){var _0x2563cd=_0x2563cd||null,_0x57fdc3=_0x57fdc3||[],_0x458c00=0x1,_0x8032fd='';if(!error[_0x2563cd]){_0x2563cd=_0x0f99('0xa');}_0x57fdc3[_0x0f99('0xb')](error[_0x2563cd]);while(arguments[_0x458c00]){_0x57fdc3[_0x0f99('0xb')](arguments[_0x458c00]);_0x458c00++;}_0x8032fd=util[_0x0f99('0xc')]['apply'](util,_0x57fdc3);this[_0x0f99('0xd')]=_0x8032fd;this[_0x0f99('0xe')]=_0x2563cd;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 23d369d..307eae3 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 _0x3d59=['emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','lodash','events','EventEmitter','../../config/environment','redis','defaults','subscribe','agi'];(function(_0x5321ab,_0x519cb9){var _0x4866b1=function(_0x427199){while(--_0x427199){_0x5321ab['push'](_0x5321ab['shift']());}};_0x4866b1(++_0x519cb9);}(_0x3d59,0x102));var _0x93d5=function(_0x1290dd,_0x2c4021){_0x1290dd=_0x1290dd-0x0;var _0x3739e6=_0x3d59[_0x1290dd];return _0x3739e6;};'use strict';var _=require(_0x93d5('0x0'));var EventEmitter=require(_0x93d5('0x1'))[_0x93d5('0x2')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x93d5('0x3'));config[_0x93d5('0x4')]=_[_0x93d5('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x93d5('0x4')]);sub[_0x93d5('0x6')](_0x93d5('0x7'),function(_0x9bf482){if(_0x9bf482)return eventEmitter[_0x93d5('0x8')](_0x93d5('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x9bf482));});sub['on'](_0x93d5('0xa'),function(_0x28d92b,_0x3030b3){if(_0x28d92b!==_0x93d5('0x7'))return;try{var _0x28ab1a=JSON[_0x93d5('0xb')](_0x3030b3);eventEmitter[_0x93d5('0x8')](_0x93d5('0xc'),_0x28ab1a);}catch(_0x5dcaf2){eventEmitter[_0x93d5('0x8')]('error',new AGIError(_0x93d5('0xd'),_0x5dcaf2));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x29e5=['emit','exports','lodash','EventEmitter','ioredis','../../config/environment','defaults','subscribe','error','E_AGI_SERVER_ERROR','message','agi'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x29e5,0x7a));var _0x529e=function(_0x200581,_0x2aa092){_0x200581=_0x200581-0x0;var _0x59c5ca=_0x29e5[_0x200581];return _0x59c5ca;};'use strict';var _=require(_0x529e('0x0'));var EventEmitter=require('events')[_0x529e('0x1')];var Redis=require(_0x529e('0x2'));var AGIError=require('./error');var config=require(_0x529e('0x3'));config['redis']=_[_0x529e('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x529e('0x5')]('agi',function(_0x39d23f){if(_0x39d23f)return eventEmitter['emit'](_0x529e('0x6'),new AGIError(_0x529e('0x7'),_0x39d23f));});sub['on'](_0x529e('0x8'),function(_0x533f06,_0x5174cc){if(_0x533f06!==_0x529e('0x9'))return;try{var _0x5669dc=JSON['parse'](_0x5174cc);eventEmitter[_0x529e('0xa')]('projectUpdate',_0x5669dc);}catch(_0x52e468){eventEmitter[_0x529e('0xa')](_0x529e('0x6'),new AGIError(_0x529e('0x7'),_0x52e468));}});module[_0x529e('0xb')]={'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 2206109..1b102ca 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 _0xd0c2=['getdigits','vertices','numberOfEdges','addVertex','edges','prototype','addEdge','push','size','relations','getVertex','traverseBFS','info','length','no\x20edge/s\x20available','condition','split','agicommand','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','lodash','../../../config/logger','agi','menu'];(function(_0x3f857a,_0x1c75ad){var _0x1d6ce3=function(_0x23b622){while(--_0x23b622){_0x3f857a['push'](_0x3f857a['shift']());}};_0x1d6ce3(++_0x1c75ad);}(_0xd0c2,0x6c));var _0x2d0c=function(_0x534c8f,_0x500079){_0x534c8f=_0x534c8f-0x0;var _0x5a57f5=_0xd0c2[_0x534c8f];return _0x5a57f5;};'use strict';var _=require(_0x2d0c('0x0'));var logger=require(_0x2d0c('0x1'))(_0x2d0c('0x2'));var verticesWithRetry=[_0x2d0c('0x3'),_0x2d0c('0x4'),'getsecretdigits'];var Graph=function(){this[_0x2d0c('0x5')]={};this['edges']={};this[_0x2d0c('0x6')]=0x0;};Graph['prototype'][_0x2d0c('0x7')]=function(_0x320e8f){this[_0x2d0c('0x5')][_0x320e8f['id']]=_0x320e8f;this[_0x2d0c('0x8')][_0x320e8f['id']]=[];};Graph[_0x2d0c('0x9')][_0x2d0c('0xa')]=function(_0x198a8a,_0x2c15e2,_0x26704d){this['edges'][_0x198a8a][_0x2d0c('0xb')]({'target':_0x2c15e2,'condition':_0x26704d});this[_0x2d0c('0x6')]+=0x1;};Graph[_0x2d0c('0x9')][_0x2d0c('0xc')]=function(){return _[_0x2d0c('0xc')](this[_0x2d0c('0x5')]);};Graph[_0x2d0c('0x9')][_0x2d0c('0xd')]=function(){return this[_0x2d0c('0x6')];};Graph['prototype'][_0x2d0c('0xe')]=function(_0x71de6f){return this[_0x2d0c('0x5')][_0x71de6f];};Graph[_0x2d0c('0x9')][_0x2d0c('0xf')]=function(_0x58fb3f,_0x51c67e){if(!this['vertices'][_0x58fb3f]){return logger['info']('no\x20vertex\x20found');}var _0x380e22=_0x51c67e(this[_0x2d0c('0x5')][_0x58fb3f]);if(!_0x380e22){return logger[_0x2d0c('0x10')]('stop\x20traverse');}if(this[_0x2d0c('0x8')][_0x58fb3f][_0x2d0c('0x11')]===0x0){return logger['info'](_0x2d0c('0x12'));}for(var _0x4575fb=0x0,_0x1c4505=[],_0x2c6f3a=![];_0x4575fb\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','variables','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6823,0x1bb));var _0x3682=function(_0x257f33,_0x1f577c){_0x257f33=_0x257f33-0x0;var _0xd4b42c=_0x6823[_0x257f33];return _0xd4b42c;};'use strict';var _=require('lodash');var syncho=require(_0x3682('0x0'));var util=require(_0x3682('0x1'));var config=require(_0x3682('0x2'));var logger=require(_0x3682('0x3'))('agi');var utilLicense=require(_0x3682('0x4'));var rpc=require(_0x3682('0x5'));var Project=require(_0x3682('0x6'));var AGIEmitter=require(_0x3682('0x7'))[_0x3682('0x8')];var projects=[];config[_0x3682('0x9')]=_[_0x3682('0xa')](config[_0x3682('0x9')],{'ip':_0x3682('0xb'),'port':0x11dd});AGIEmitter['on'](_0x3682('0xc'),projectUpdateHandler);function connectionHandler(_0xbebc55){process[_0x3682('0xd')](function(){syncho(function(){try{setChannelVariables(_0xbebc55);agiHandler(_0xbebc55);}catch(_0x8b86ef){logger[_0x3682('0xe')](_0x8b86ef['stack']);}});});}function projectUpdateHandler(_0x55ddac){try{var _0x5a3af5=_[_0x3682('0xf')](projects,['id',_0x55ddac['id']]);if(_0x5a3af5>-0x1){if(_0x55ddac['deleted']===!![]){projects[_0x3682('0x10')](_0x5a3af5,0x1);}else{projects[_0x5a3af5]=_0x55ddac;}}else{projects['push'](_0x55ddac);}}catch(_0x5e5ed0){logger[_0x3682('0xe')](_0x5e5ed0[_0x3682('0x11')]);}}function listeningHandler(){console[_0x3682('0x12')](_0x3682('0x13'),config[_0x3682('0x9')][_0x3682('0x14')]);logger['info'](util[_0x3682('0x15')](_0x3682('0x16'),config[_0x3682('0x9')]['ip'],config[_0x3682('0x9')][_0x3682('0x14')]));}function errorHandler(_0x23af11){if(_0x23af11&&_0x23af11['name']&&_0x23af11[_0x3682('0x17')]){logger[_0x3682('0xe')](util[_0x3682('0x15')]('[%s]\x20%s',_0x23af11[_0x3682('0x18')],_0x23af11[_0x3682('0x17')]));}else{logger[_0x3682('0xe')](util[_0x3682('0x15')](_0x3682('0x19'),_0x23af11[_0x3682('0x11')]));}}function closeHandler(){logger['info'](util[_0x3682('0x15')](_0x3682('0x1a'),this[_0x3682('0x1b')],this[_0x3682('0x1c')],this[_0x3682('0x1d')],this[_0x3682('0x1e')],this[_0x3682('0x1f')]));try{createSquareReport(this);}catch(_0x38d872){logger['error'](_0x38d872['stack']);}}function timeoutHandler(){logger[_0x3682('0x20')](util[_0x3682('0x15')](_0x3682('0x21'),this[_0x3682('0x1b')],this[_0x3682('0x1c')],this[_0x3682('0x1d')],this['dnid'],this[_0x3682('0x1f')]));}function hangupHandler(){logger[_0x3682('0x20')](util[_0x3682('0x15')](_0x3682('0x22'),this['arg_1'],this[_0x3682('0x1c')],this[_0x3682('0x1d')],this['dnid'],this['uniqueid']));this[_0x3682('0x23')]=!![];}function createSquareReport(_0x2aabb7,_0x272aee){rpc['createSquareReport'](_0x2aabb7)[_0x3682('0x24')](function(_0x584b49){if(_0x272aee){_0x272aee(null,_0x584b49);}})[_0x3682('0x25')](function(_0x156336){if(_0x272aee){_0x272aee(null,_0x156336);}});}function setChannelVariables(_0x4b1d88){for(var _0x52a128 in _0x4b1d88){if(_0x4b1d88[_0x3682('0x26')](_0x52a128)){if(_0x52a128[_0x3682('0x27')]('agi_')===0x0){_0x4b1d88[_0x52a128['substring'](0x4)]=_0x4b1d88[_0x52a128];delete _0x4b1d88[_0x52a128];}}}}function agiHandler(_0x5dfd4f){logger['debug'](_0x3682('0x28'),JSON['stringify'](_0x5dfd4f,null,0x2));logger['info'](util[_0x3682('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5dfd4f[_0x3682('0x1b')],_0x5dfd4f[_0x3682('0x1c')],_0x5dfd4f[_0x3682('0x1d')],_0x5dfd4f[_0x3682('0x1e')],_0x5dfd4f[_0x3682('0x1f')]));_0x5dfd4f['on'](_0x3682('0xe'),errorHandler);_0x5dfd4f['on'](_0x3682('0x29'),closeHandler);_0x5dfd4f['on'](_0x3682('0x2a'),timeoutHandler);_0x5dfd4f[_0x3682('0x23')]=![];_0x5dfd4f['on'](_0x3682('0x2b'),hangupHandler);var _0x2d0987=_[_0x3682('0x2c')](projects,[_0x3682('0x18'),_0x5dfd4f['arg_1']]);if(!_0x2d0987)return Project[_0x3682('0x2d')](_0x5dfd4f);if(!_0x2d0987[_0x3682('0x2e')])return Project[_0x3682('0x2f')](_0x5dfd4f);return Project['initialize'](_0x2d0987,_0x5dfd4f);}function main(){var _0x9080f0;return utilLicense[_0x3682('0x30')]()[_0x3682('0x24')](function(_0x5392fa){if(!_0x5392fa)return;if(_0x5392fa[_0x3682('0x31')]){if(_0x5392fa[_0x3682('0x32')]&&_0x5392fa['callysquare']>0x0){logger[_0x3682('0x20')](util[_0x3682('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x5392fa[_0x3682('0x32')]));_0x9080f0=_0x5392fa['callysquare'];}else{logger[_0x3682('0x20')](_0x3682('0x33'));}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x9080f0=-0x1;}})[_0x3682('0x24')](function(){return Project[_0x3682('0x34')]();})[_0x3682('0x24')](function(_0x350528){projects=_0x350528;return;})[_0x3682('0x25')](function(_0x1130f3){logger[_0x3682('0xe')](_0x3682('0x35'),_0x1130f3[_0x3682('0x11')]);})[_0x3682('0x36')](function(){var _0x49f0ef=require(_0x3682('0x37'))(config[_0x3682('0x9')]['port'],config[_0x3682('0x9')]['ip'],_0x9080f0);_0x49f0ef['on'](_0x3682('0xe'),errorHandler);_0x49f0ef['on'](_0x3682('0x38'),listeningHandler);_0x49f0ef['on']('connection',connectionHandler);_0x49f0ef['on'](_0x3682('0x29'),closeHandler);});}main(); \ No newline at end of file +var _0xc9d7=['info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','indexOf','agi_','substring','variables','stringify','close','hangup','find','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','finally','./server','listening','connection','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','EventEmitter','stack','findIndex','deleted','splice','push','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s'];(function(_0x39a076,_0x34002b){var _0x46ce22=function(_0x4ae4f3){while(--_0x4ae4f3){_0x39a076['push'](_0x39a076['shift']());}};_0x46ce22(++_0x34002b);}(_0xc9d7,0xfd));var _0x7c9d=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0xc9d7[_0x31172e];return _0x414ada;};'use strict';var _=require('lodash');var syncho=require(_0x7c9d('0x0'));var util=require('util');var config=require(_0x7c9d('0x1'));var logger=require(_0x7c9d('0x2'))(_0x7c9d('0x3'));var utilLicense=require(_0x7c9d('0x4'));var rpc=require(_0x7c9d('0x5'));var Project=require('./project');var AGIEmitter=require('./events')[_0x7c9d('0x6')];var projects=[];config[_0x7c9d('0x3')]=_['defaults'](config[_0x7c9d('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x5ac5f2){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5ac5f2);agiHandler(_0x5ac5f2);}catch(_0x23c754){logger['error'](_0x23c754[_0x7c9d('0x7')]);}});});}function projectUpdateHandler(_0x4f40ed){try{var _0x4a2610=_[_0x7c9d('0x8')](projects,['id',_0x4f40ed['id']]);if(_0x4a2610>-0x1){if(_0x4f40ed[_0x7c9d('0x9')]===!![]){projects[_0x7c9d('0xa')](_0x4a2610,0x1);}else{projects[_0x4a2610]=_0x4f40ed;}}else{projects[_0x7c9d('0xb')](_0x4f40ed);}}catch(_0xa90fe){logger[_0x7c9d('0xc')](_0xa90fe[_0x7c9d('0x7')]);}}function listeningHandler(){console[_0x7c9d('0xd')](_0x7c9d('0xe'),config[_0x7c9d('0x3')][_0x7c9d('0xf')]);logger['info'](util['format'](_0x7c9d('0x10'),config['agi']['ip'],config['agi'][_0x7c9d('0xf')]));}function errorHandler(_0x343d9b){if(_0x343d9b&&_0x343d9b[_0x7c9d('0x11')]&&_0x343d9b[_0x7c9d('0x12')]){logger['error'](util[_0x7c9d('0x13')](_0x7c9d('0x14'),_0x343d9b[_0x7c9d('0x11')],_0x343d9b['message']));}else{logger[_0x7c9d('0xc')](util[_0x7c9d('0x13')](_0x7c9d('0x15'),_0x343d9b[_0x7c9d('0x7')]));}}function closeHandler(){logger[_0x7c9d('0x16')](util['format'](_0x7c9d('0x17'),this[_0x7c9d('0x18')],this[_0x7c9d('0x19')],this[_0x7c9d('0x1a')],this[_0x7c9d('0x1b')],this[_0x7c9d('0x1c')]));try{createSquareReport(this);}catch(_0x2b35dc){logger['error'](_0x2b35dc[_0x7c9d('0x7')]);}}function timeoutHandler(){logger[_0x7c9d('0x16')](util[_0x7c9d('0x13')](_0x7c9d('0x1d'),this[_0x7c9d('0x18')],this[_0x7c9d('0x19')],this['callerid'],this[_0x7c9d('0x1b')],this[_0x7c9d('0x1c')]));}function hangupHandler(){logger['info'](util['format'](_0x7c9d('0x1e'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x7c9d('0x1b')],this[_0x7c9d('0x1c')]));this[_0x7c9d('0x1f')]=!![];}function createSquareReport(_0x44fac0,_0x3b6909){rpc[_0x7c9d('0x20')](_0x44fac0)[_0x7c9d('0x21')](function(_0x4fa371){if(_0x3b6909){_0x3b6909(null,_0x4fa371);}})['catch'](function(_0x558fee){if(_0x3b6909){_0x3b6909(null,_0x558fee);}});}function setChannelVariables(_0x32318f){for(var _0x536684 in _0x32318f){if(_0x32318f['hasOwnProperty'](_0x536684)){if(_0x536684[_0x7c9d('0x22')](_0x7c9d('0x23'))===0x0){_0x32318f[_0x536684[_0x7c9d('0x24')](0x4)]=_0x32318f[_0x536684];delete _0x32318f[_0x536684];}}}}function agiHandler(_0xbf1ff){logger['debug'](_0x7c9d('0x25'),JSON[_0x7c9d('0x26')](_0xbf1ff,null,0x2));logger['info'](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbf1ff[_0x7c9d('0x18')],_0xbf1ff['calleridname'],_0xbf1ff[_0x7c9d('0x1a')],_0xbf1ff[_0x7c9d('0x1b')],_0xbf1ff[_0x7c9d('0x1c')]));_0xbf1ff['on'](_0x7c9d('0xc'),errorHandler);_0xbf1ff['on'](_0x7c9d('0x27'),closeHandler);_0xbf1ff['on']('timeout',timeoutHandler);_0xbf1ff['evtHangup']=![];_0xbf1ff['on'](_0x7c9d('0x28'),hangupHandler);var _0x430e40=_[_0x7c9d('0x29')](projects,['name',_0xbf1ff[_0x7c9d('0x18')]]);if(!_0x430e40)return Project['handleNotFound'](_0xbf1ff);if(!_0x430e40['production'])return Project['handleUnpublished'](_0xbf1ff);return Project[_0x7c9d('0x2a')](_0x430e40,_0xbf1ff);}function main(){var _0x116152;return utilLicense[_0x7c9d('0x2b')]()[_0x7c9d('0x21')](function(_0x472abb){if(!_0x472abb)return;if(_0x472abb[_0x7c9d('0x2c')]){if(_0x472abb['callysquare']&&_0x472abb[_0x7c9d('0x2d')]>0x0){logger[_0x7c9d('0x16')](util[_0x7c9d('0x13')](_0x7c9d('0x2e'),_0x472abb['callysquare']));_0x116152=_0x472abb['callysquare'];}else{logger[_0x7c9d('0x16')](_0x7c9d('0x2f'));}}else{logger['info'](_0x7c9d('0x30'));_0x116152=-0x1;}})['then'](function(){return Project[_0x7c9d('0x31')]();})[_0x7c9d('0x21')](function(_0x556057){projects=_0x556057;return;})[_0x7c9d('0x32')](function(_0x160aac){logger[_0x7c9d('0xc')]('[LICENSE]',_0x160aac['stack']);})[_0x7c9d('0x33')](function(){var _0x44913b=require(_0x7c9d('0x34'))(config[_0x7c9d('0x3')][_0x7c9d('0xf')],config[_0x7c9d('0x3')]['ip'],_0x116152);_0x44913b['on'](_0x7c9d('0xc'),errorHandler);_0x44913b['on'](_0x7c9d('0x35'),listeningHandler);_0x44913b['on'](_0x7c9d('0x36'),connectionHandler);_0x44913b['on'](_0x7c9d('0x27'),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 7a18f5e..525daee 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 _0xc083=['jayson/promise','client','http','request','then','error','message','result','sendMailMessage','SendMail','bluebird'];(function(_0x59831f,_0x5154ca){var _0x11f70c=function(_0x3e7adf){while(--_0x3e7adf){_0x59831f['push'](_0x59831f['shift']());}};_0x11f70c(++_0x5154ca);}(_0xc083,0x83));var _0x3c08=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc083[_0x1cc8fe];return _0x230054;};'use strict';var BPromise=require(_0x3c08('0x0'));var jayson=require(_0x3c08('0x1'));var client=jayson[_0x3c08('0x2')][_0x3c08('0x3')]({'port':0x232b});function request(_0xc1baa6,_0x5a9f40){return new BPromise(function(_0x5d2af0,_0x4cd441){return client[_0x3c08('0x4')](_0xc1baa6,_0x5a9f40)[_0x3c08('0x5')](function(_0x2f3fcf){if(_0x2f3fcf[_0x3c08('0x6')]){return _0x4cd441(_0x2f3fcf[_0x3c08('0x6')][_0x3c08('0x7')]);}else{return _0x5d2af0(_0x2f3fcf[_0x3c08('0x8')]);}})['catch'](function(_0x1d5571){return _0x4cd441(_0x1d5571);});});}exports[_0x3c08('0x9')]=function(_0x21a988,_0x57e473){return request(_0x3c08('0xa'),{'account':_0x21a988,'message':_0x57e473});}; \ No newline at end of file +var _0xe5c5=['http','request','error','result','catch','sendMailMessage','SendMail','bluebird','client'];(function(_0x346837,_0x176d87){var _0x40de49=function(_0x3c5571){while(--_0x3c5571){_0x346837['push'](_0x346837['shift']());}};_0x40de49(++_0x176d87);}(_0xe5c5,0x1ed));var _0x5e5c=function(_0x2684d3,_0x464630){_0x2684d3=_0x2684d3-0x0;var _0x385a3e=_0xe5c5[_0x2684d3];return _0x385a3e;};'use strict';var BPromise=require(_0x5e5c('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x5e5c('0x1')][_0x5e5c('0x2')]({'port':0x232b});function request(_0x87d27b,_0x5ab550){return new BPromise(function(_0x26f29a,_0x542903){return client[_0x5e5c('0x3')](_0x87d27b,_0x5ab550)['then'](function(_0x25d903){if(_0x25d903[_0x5e5c('0x4')]){return _0x542903(_0x25d903[_0x5e5c('0x4')]['message']);}else{return _0x26f29a(_0x25d903[_0x5e5c('0x5')]);}})[_0x5e5c('0x6')](function(_0xbb9a24){return _0x542903(_0xbb9a24);});});}exports[_0x5e5c('0x7')]=function(_0x5413fb,_0x29e192){return request(_0x5e5c('0x8'),{'account':_0x5413fb,'message':_0x29e192});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index cb78789..9246b7a 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 _0xb359=['vertex','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20found','continueAt','close','Project\x20%s\x20not\x20published','lodash','moment','xml2json','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','mxCell','length','addEdge','source','toJson','mxGraphModel','root','production','start','debug','stringify','joinAt','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear','context','extension','priority','response','code','result','evtHangup','isUndefined','finally','info','dnid'];(function(_0x1f812,_0x455a7b){var _0x1f6547=function(_0x4c95b4){while(--_0x4c95b4){_0x1f812['push'](_0x1f812['shift']());}};_0x1f6547(++_0x455a7b);}(_0xb359,0xb1));var _0x9b35=function(_0x149f48,_0x534714){_0x149f48=_0x149f48-0x0;var _0x3577d9=_0xb359[_0x149f48];return _0x3577d9;};'use strict';var _=require(_0x9b35('0x0'));var moment=require(_0x9b35('0x1'));var parser=require(_0x9b35('0x2'));var util=require('util');var logger=require('../../config/logger')(_0x9b35('0x3'));var rpc=require(_0x9b35('0x4'));var mailRpc=require(_0x9b35('0x5'));var Graph=require(_0x9b35('0x6'));var Vertices=require(_0x9b35('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x9b35('0x8')](function(_0xd763ad){logger[_0x9b35('0x9')](_0x9b35('0xa'),_0xd763ad[_0x9b35('0xb')]);return[];});}function addVertex(_0x94d9c4,_0x9c8b9d,_0x2a7bba){_0x9c8b9d[_0x9b35('0xc')]=_0x2a7bba;if(_0x9c8b9d[_0x9b35('0xd')](_0x9b35('0xe'))){_0x9c8b9d['maxRetry']=parseInt(_0x9c8b9d[_0x9b35('0xe')],0xa);}_0x94d9c4['addVertex'](_[_0x9b35('0xf')](_0x9c8b9d,_0x9b35('0x10')));}function initGraph(_0x1053f7,_0x24dc51){var _0x60ecb9=new Graph();for(var _0x5036b8 in _0x1053f7){if(_0x1053f7[_0x9b35('0xd')](_0x5036b8)){if(_['isArray'](_0x1053f7[_0x5036b8])){for(var _0x485845=0x0;_0x485845<_0x1053f7[_0x5036b8][_0x9b35('0x11')];_0x485845+=0x1){addVertex(_0x60ecb9,_0x1053f7[_0x5036b8][_0x485845],_0x5036b8);}}else{addVertex(_0x60ecb9,_0x1053f7[_0x5036b8],_0x5036b8);}}}for(var _0x5d1738=0x0;_0x5d1738<_0x24dc51[_0x9b35('0x11')];_0x5d1738+=0x1){if(_0x24dc51[_0x5d1738]['source']&&_0x24dc51[_0x5d1738]['target']){_0x60ecb9[_0x9b35('0x12')](_0x24dc51[_0x5d1738][_0x9b35('0x13')],_0x24dc51[_0x5d1738]['target'],_0x24dc51[_0x5d1738]['value']);}}return _0x60ecb9;}function getRoot(_0x37cfd9){return parser[_0x9b35('0x14')](_0x37cfd9,{'object':!![]})[_0x9b35('0x15')][_0x9b35('0x16')];}function inspect(_0x13d9b8){return util['inspect'](_0x13d9b8,{'showHidden':![],'depth':null});}function initialize(_0x4a1190,_0x1320b3){var _0x19250c=getRoot(_0x4a1190[_0x9b35('0x17')]);if(!_0x19250c||!_0x19250c[_0x9b35('0x18')])return;var _0x58ac89,_0x4c6e4c,_0x4f925a;logger[_0x9b35('0x19')](_0x9b35('0x16'),JSON[_0x9b35('0x1a')](_0x19250c,null,0x2));_0x1320b3[_0x9b35('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58ac89=initGraph(_[_0x9b35('0xf')](_0x19250c,'mxCell'),_0x19250c[_0x9b35('0x10')]);_0x4c6e4c=new Vertices(_0x1320b3,rpc,mailRpc);logger['info'](util[_0x9b35('0x1c')](_0x9b35('0x1d'),_0x1320b3[_0x9b35('0x1e')],_0x1320b3[_0x9b35('0x1f')],_0x1320b3[_0x9b35('0x20')],_0x1320b3['dnid'],_0x1320b3[_0x9b35('0x21')]));_0x58ac89[_0x9b35('0x22')](_0x19250c[_0x9b35('0x18')]['id'],function(_0x72d841){try{_0x72d841=_0x4c6e4c[_0x9b35('0x23')](_0x72d841);logger[_0x9b35('0x19')]('vertex',JSON['stringify'](_0x72d841,null,0x2));if(_0x72d841[_0x9b35('0xc')]==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1320b3[_0x9b35('0x24')]=_0x72d841[_0x9b35('0x24')]||_0x1320b3['context'];_0x1320b3[_0x9b35('0x25')]=_0x72d841[_0x9b35('0x25')];_0x1320b3['priority']=_0x72d841[_0x9b35('0x26')]?_0x72d841[_0x9b35('0x26')]-0x1:0x1;return null;}else if(_0x72d841&&_0x4c6e4c[_0x72d841[_0x9b35('0xc')]]){_0x4f925a=_0x4c6e4c[_0x72d841[_0x9b35('0xc')]](_0x72d841);logger['info'](_0x9b35('0x27'),JSON[_0x9b35('0x1a')](_0x4f925a,null,0x2));if(_0x4f925a&&_0x4f925a[_0x9b35('0x28')]===AGI_CODE_SUCCESS&&_0x4f925a[_0x9b35('0x29')]!==AGI_RESULT_ERROR&&!_0x1320b3[_0x9b35('0x2a')]){logger['debug'](_0x9b35('0x27'),inspect(_0x4f925a));return _[_0x9b35('0x2b')](_0x4f925a[_0x9b35('0x29')])?null:_0x4f925a[_0x9b35('0x29')]['toString']();}else{logger[_0x9b35('0x9')](_0x9b35('0x27'),inspect(_0x4f925a));return null;}}else{logger[_0x9b35('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x5d04c9){logger[_0x9b35('0x9')](_0x5d04c9['stack']);return null;}});if(_0x19250c[_0x9b35('0x2c')]){logger[_0x9b35('0x2d')](util[_0x9b35('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1320b3[_0x9b35('0x1e')],_0x1320b3[_0x9b35('0x1f')],_0x1320b3[_0x9b35('0x20')],_0x1320b3[_0x9b35('0x2e')],_0x1320b3[_0x9b35('0x21')]));_0x58ac89[_0x9b35('0x22')](_0x19250c[_0x9b35('0x2c')]['id'],function(_0x1b7f5f){try{_0x1b7f5f=_0x4c6e4c[_0x9b35('0x23')](_0x1b7f5f);logger[_0x9b35('0x19')](_0x9b35('0x2f'),JSON[_0x9b35('0x1a')](_0x1b7f5f,null,0x2));if(_0x1b7f5f&&_0x4c6e4c[_0x1b7f5f[_0x9b35('0xc')]]){_0x4f925a=_0x4c6e4c[_0x1b7f5f[_0x9b35('0xc')]](_0x1b7f5f);if(_0x4f925a){logger[_0x9b35('0x19')]('response',inspect(_0x4f925a));return _['isUndefined'](_0x4f925a[_0x9b35('0x29')])?null:_0x4f925a[_0x9b35('0x29')][_0x9b35('0x30')]();}else{logger[_0x9b35('0x9')](_0x9b35('0x27'),inspect(_0x4f925a));return null;}}else{logger[_0x9b35('0x9')](_0x9b35('0x31'));return null;}}catch(_0x465175){logger[_0x9b35('0x9')](_0x465175[_0x9b35('0xb')]);return null;}});}logger[_0x9b35('0x2d')](util[_0x9b35('0x1c')](_0x9b35('0x32'),_0x1320b3[_0x9b35('0x1e')],_0x1320b3[_0x9b35('0x1f')],_0x1320b3['callerid'],_0x1320b3[_0x9b35('0x2e')],_0x1320b3[_0x9b35('0x21')]));logger[_0x9b35('0x2d')](util['format'](_0x9b35('0x33'),_0x1320b3[_0x9b35('0x24')],_0x1320b3[_0x9b35('0x25')],parseInt(_0x1320b3[_0x9b35('0x26')],0xa)+0x1));_0x1320b3['continueAt'](_0x1320b3[_0x9b35('0x24')],_0x1320b3[_0x9b35('0x25')],parseInt(_0x1320b3['priority'],0xa)+0x1);_0x1320b3['close']();}function handleNotFound(_0x4ebccd){logger['error'](util[_0x9b35('0x1c')](_0x9b35('0x34'),_0x4ebccd[_0x9b35('0x1e')]));_0x4ebccd[_0x9b35('0x35')](_0x4ebccd[_0x9b35('0x24')],_0x4ebccd[_0x9b35('0x25')],parseInt(_0x4ebccd['priority'],0xa)+0x1);_0x4ebccd[_0x9b35('0x36')]();}function handleUnpublished(_0x25a237){logger[_0x9b35('0x9')](util['format'](_0x9b35('0x37'),_0x25a237['arg_1']));_0x25a237[_0x9b35('0x35')](_0x25a237['context'],_0x25a237[_0x9b35('0x25')],parseInt(_0x25a237[_0x9b35('0x26')],0xa)+0x1);_0x25a237[_0x9b35('0x36')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa614=['context','extension','priority','agicommand','evtHangup','response','isUndefined','result','error','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','continueAt','exports','lodash','xml2json','util','../../config/logger','./rpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','target','toJson','mxGraphModel','start','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xa614,0x1dc));var _0x4a61=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0xa614[_0x44dba1];return _0x2fbd3f;};'use strict';var _=require(_0x4a61('0x0'));var moment=require('moment');var parser=require(_0x4a61('0x1'));var util=require(_0x4a61('0x2'));var logger=require(_0x4a61('0x3'))('agi');var rpc=require(_0x4a61('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0x4a61('0x5'));var Vertices=require(_0x4a61('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4a61('0x7')]()[_0x4a61('0x8')](function(_0x10912d){logger['error'](_0x4a61('0x9'),_0x10912d['stack']);return[];});}function addVertex(_0x2a0a71,_0x57aec1,_0xe43b94){_0x57aec1['agicommand']=_0xe43b94;if(_0x57aec1[_0x4a61('0xa')](_0x4a61('0xb'))){_0x57aec1[_0x4a61('0xc')]=parseInt(_0x57aec1[_0x4a61('0xb')],0xa);}_0x2a0a71[_0x4a61('0xd')](_[_0x4a61('0xe')](_0x57aec1,_0x4a61('0xf')));}function initGraph(_0xc531dc,_0x1a2617){var _0x4016c2=new Graph();for(var _0x55832b in _0xc531dc){if(_0xc531dc[_0x4a61('0xa')](_0x55832b)){if(_['isArray'](_0xc531dc[_0x55832b])){for(var _0x5e3800=0x0;_0x5e3800<_0xc531dc[_0x55832b][_0x4a61('0x10')];_0x5e3800+=0x1){addVertex(_0x4016c2,_0xc531dc[_0x55832b][_0x5e3800],_0x55832b);}}else{addVertex(_0x4016c2,_0xc531dc[_0x55832b],_0x55832b);}}}for(var _0x580e40=0x0;_0x580e40<_0x1a2617['length'];_0x580e40+=0x1){if(_0x1a2617[_0x580e40][_0x4a61('0x11')]&&_0x1a2617[_0x580e40]['target']){_0x4016c2['addEdge'](_0x1a2617[_0x580e40][_0x4a61('0x11')],_0x1a2617[_0x580e40][_0x4a61('0x12')],_0x1a2617[_0x580e40]['value']);}}return _0x4016c2;}function getRoot(_0x5eb690){return parser[_0x4a61('0x13')](_0x5eb690,{'object':!![]})[_0x4a61('0x14')]['root'];}function inspect(_0x494c13){return util['inspect'](_0x494c13,{'showHidden':![],'depth':null});}function initialize(_0x4fc02a,_0xd01c18){var _0x30a303=getRoot(_0x4fc02a['production']);if(!_0x30a303||!_0x30a303[_0x4a61('0x15')])return;var _0x1e0a2a,_0x249729,_0x379b13;logger[_0x4a61('0x16')](_0x4a61('0x17'),JSON[_0x4a61('0x18')](_0x30a303,null,0x2));_0xd01c18['joinAt']=moment()[_0x4a61('0x19')](_0x4a61('0x1a'));_0x1e0a2a=initGraph(_[_0x4a61('0xe')](_0x30a303,_0x4a61('0xf')),_0x30a303[_0x4a61('0xf')]);_0x249729=new Vertices(_0xd01c18,rpc,mailRpc);logger[_0x4a61('0x1b')](util[_0x4a61('0x19')](_0x4a61('0x1c'),_0xd01c18[_0x4a61('0x1d')],_0xd01c18['calleridname'],_0xd01c18[_0x4a61('0x1e')],_0xd01c18[_0x4a61('0x1f')],_0xd01c18[_0x4a61('0x20')]));_0x1e0a2a[_0x4a61('0x21')](_0x30a303[_0x4a61('0x15')]['id'],function(_0x117419){try{_0x117419=_0x249729['clear'](_0x117419);logger[_0x4a61('0x16')](_0x4a61('0x22'),JSON[_0x4a61('0x18')](_0x117419,null,0x2));if(_0x117419['agicommand']===_0x4a61('0x23')){logger[_0x4a61('0x1b')](_0x4a61('0x24'));_0xd01c18[_0x4a61('0x25')]=_0x117419[_0x4a61('0x25')]||_0xd01c18[_0x4a61('0x25')];_0xd01c18[_0x4a61('0x26')]=_0x117419[_0x4a61('0x26')];_0xd01c18[_0x4a61('0x27')]=_0x117419[_0x4a61('0x27')]?_0x117419[_0x4a61('0x27')]-0x1:0x1;return null;}else if(_0x117419&&_0x249729[_0x117419['agicommand']]){_0x379b13=_0x249729[_0x117419[_0x4a61('0x28')]](_0x117419);logger[_0x4a61('0x1b')]('response',JSON[_0x4a61('0x18')](_0x379b13,null,0x2));if(_0x379b13&&_0x379b13['code']===AGI_CODE_SUCCESS&&_0x379b13['result']!==AGI_RESULT_ERROR&&!_0xd01c18[_0x4a61('0x29')]){logger[_0x4a61('0x16')](_0x4a61('0x2a'),inspect(_0x379b13));return _[_0x4a61('0x2b')](_0x379b13[_0x4a61('0x2c')])?null:_0x379b13[_0x4a61('0x2c')]['toString']();}else{logger['error'](_0x4a61('0x2a'),inspect(_0x379b13));return null;}}else{logger[_0x4a61('0x2d')](_0x4a61('0x2e'));return null;}}catch(_0x5cf427){logger[_0x4a61('0x2d')](_0x5cf427[_0x4a61('0x2f')]);return null;}});if(_0x30a303[_0x4a61('0x30')]){logger[_0x4a61('0x1b')](util[_0x4a61('0x19')](_0x4a61('0x31'),_0xd01c18['arg_1'],_0xd01c18['calleridname'],_0xd01c18[_0x4a61('0x1e')],_0xd01c18[_0x4a61('0x1f')],_0xd01c18[_0x4a61('0x20')]));_0x1e0a2a['traverseBFS'](_0x30a303[_0x4a61('0x30')]['id'],function(_0x13252e){try{_0x13252e=_0x249729['clear'](_0x13252e);logger[_0x4a61('0x16')](_0x4a61('0x22'),JSON[_0x4a61('0x18')](_0x13252e,null,0x2));if(_0x13252e&&_0x249729[_0x13252e[_0x4a61('0x28')]]){_0x379b13=_0x249729[_0x13252e[_0x4a61('0x28')]](_0x13252e);if(_0x379b13){logger['debug']('response',inspect(_0x379b13));return _[_0x4a61('0x2b')](_0x379b13[_0x4a61('0x2c')])?null:_0x379b13[_0x4a61('0x2c')][_0x4a61('0x32')]();}else{logger[_0x4a61('0x2d')](_0x4a61('0x2a'),inspect(_0x379b13));return null;}}else{logger['error'](_0x4a61('0x2e'));return null;}}catch(_0x6e226d){logger[_0x4a61('0x2d')](_0x6e226d[_0x4a61('0x2f')]);return null;}});}logger['info'](util[_0x4a61('0x19')](_0x4a61('0x33'),_0xd01c18['arg_1'],_0xd01c18[_0x4a61('0x34')],_0xd01c18[_0x4a61('0x1e')],_0xd01c18[_0x4a61('0x1f')],_0xd01c18[_0x4a61('0x20')]));logger[_0x4a61('0x1b')](util['format'](_0x4a61('0x35'),_0xd01c18[_0x4a61('0x25')],_0xd01c18[_0x4a61('0x26')],parseInt(_0xd01c18[_0x4a61('0x27')],0xa)+0x1));_0xd01c18['continueAt'](_0xd01c18[_0x4a61('0x25')],_0xd01c18[_0x4a61('0x26')],parseInt(_0xd01c18['priority'],0xa)+0x1);_0xd01c18[_0x4a61('0x36')]();}function handleNotFound(_0x3bc5d9){logger[_0x4a61('0x2d')](util[_0x4a61('0x19')]('Project\x20%s\x20not\x20found',_0x3bc5d9[_0x4a61('0x1d')]));_0x3bc5d9[_0x4a61('0x37')](_0x3bc5d9[_0x4a61('0x25')],_0x3bc5d9[_0x4a61('0x26')],parseInt(_0x3bc5d9['priority'],0xa)+0x1);_0x3bc5d9[_0x4a61('0x36')]();}function handleUnpublished(_0x49292f){logger[_0x4a61('0x2d')](util[_0x4a61('0x19')]('Project\x20%s\x20not\x20published',_0x49292f['arg_1']));_0x49292f['continueAt'](_0x49292f[_0x4a61('0x25')],_0x49292f[_0x4a61('0x26')],parseInt(_0x49292f[_0x4a61('0x27')],0xa)+0x1);_0x49292f[_0x4a61('0x36')]();}module[_0x4a61('0x38')]={'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 f02dffd..baedcda 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 _0x04f1=['_inBody','line','exports','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','indexOf','substring','slice','trim','length','emit','headers'];(function(_0x3f4fb5,_0x238e15){var _0x20bc31=function(_0x557221){while(--_0x557221){_0x3f4fb5['push'](_0x3f4fb5['shift']());}};_0x20bc31(++_0x238e15);}(_0x04f1,0xc1));var _0x104f=function(_0x39e7e7,_0x39694f){_0x39e7e7=_0x39e7e7-0x0;var _0x568aa0=_0x04f1[_0x39e7e7];return _0x568aa0;};'use strict';var util=require(_0x104f('0x0'));var Transform=require(_0x104f('0x1'))[_0x104f('0x2')];function AGIReply(_0xc5a5f4){Transform[_0x104f('0x3')](this,_0xc5a5f4);this[_0x104f('0x4')]='';this['_inBody']=![];}util[_0x104f('0x5')](AGIReply,Transform);AGIReply[_0x104f('0x6')][_0x104f('0x7')]=function(_0x36508b,_0x54c6a5,_0x347f10){var _0x51cffa='\x0a',_0x10a9ed=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xa6dd14=-0x1,_0x235367=-0x1,_0x117bd1='',_0x2097da=0x0,_0x3235a9='',_0x5fb224='';this['_localBuffer']+=_0x36508b[_0x104f('0x8')]();_0x3235a9=this[_0x104f('0x4')];if(!this['_inBody']){_0x2097da=0x0;while(_0x10a9ed[_0x2097da]){while((_0x235367=_0x3235a9[_0x104f('0x9')](_0x10a9ed[_0x2097da]))!=-0x1){_0x117bd1=_0x10a9ed[_0x2097da];_0x5fb224=_0x3235a9[_0x104f('0xa')](0x0,_0x235367);_0x3235a9=_0x3235a9[_0x104f('0xa')](_0x235367+_0x117bd1['length']);var _0x1e505b=_0x5fb224['split'](_0x51cffa),_0x381e6d=0x0,_0x350b79={},_0x53d126='',_0x5de83f='',_0x3d7255=-0x1;while(_0x1e505b[_0x381e6d]){_0x3d7255=_0x1e505b[_0x381e6d]['indexOf'](':');if(_0x3d7255!=-0x1){_0x53d126=_0x1e505b[_0x381e6d][_0x104f('0xb')](0x0,_0x3d7255)[_0x104f('0xc')]();_0x5de83f=_0x1e505b[_0x381e6d][_0x104f('0xb')](_0x3d7255+0x1)['trim']();if(_0x53d126[_0x104f('0xd')]>0x0){_0x350b79[_0x53d126]=_0x5de83f;}}else{}_0x381e6d++;}this[_0x104f('0xe')](_0x104f('0xf'),_0x350b79);this[_0x104f('0x10')]=!![];}_0x2097da++;}this['_localBuffer']=_0x3235a9;}else{while((_0xa6dd14=_0x3235a9[_0x104f('0x9')](_0x51cffa))!=-0x1){_0x5fb224=_0x3235a9[_0x104f('0xa')](0x0,_0xa6dd14);this[_0x104f('0xe')](_0x104f('0x11'),_0x5fb224);_0x3235a9=_0x3235a9[_0x104f('0xa')](_0xa6dd14+_0x51cffa[_0x104f('0xd')]);}this[_0x104f('0x4')]=_0x3235a9;}_0x347f10();};module[_0x104f('0x12')]=AGIReply; \ No newline at end of file +var _0xee9a=['toString','substring','split','indexOf','trim','slice','length','emit','headers','exports','stream','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x4d449f,_0xa69619){var _0x2dc602=function(_0xc37cc){while(--_0xc37cc){_0x4d449f['push'](_0x4d449f['shift']());}};_0x2dc602(++_0xa69619);}(_0xee9a,0x12a));var _0xaee9=function(_0x4f4539,_0xe4db6d){_0x4f4539=_0x4f4539-0x0;var _0x3b7fba=_0xee9a[_0x4f4539];return _0x3b7fba;};'use strict';var util=require('util');var Transform=require(_0xaee9('0x0'))['Transform'];function AGIReply(_0x4e43e0){Transform[_0xaee9('0x1')](this,_0x4e43e0);this[_0xaee9('0x2')]='';this[_0xaee9('0x3')]=![];}util[_0xaee9('0x4')](AGIReply,Transform);AGIReply[_0xaee9('0x5')][_0xaee9('0x6')]=function(_0x38ac2f,_0x45428f,_0x39f932){var _0x4204f3='\x0a',_0x3a8d01=['\x0a\x0a',_0xaee9('0x7')],_0x5a7f23=-0x1,_0x3ab40e=-0x1,_0x5ea11b='',_0x3d3d23=0x0,_0x117f30='',_0x5e90a6='';this[_0xaee9('0x2')]+=_0x38ac2f[_0xaee9('0x8')]();_0x117f30=this[_0xaee9('0x2')];if(!this[_0xaee9('0x3')]){_0x3d3d23=0x0;while(_0x3a8d01[_0x3d3d23]){while((_0x3ab40e=_0x117f30['indexOf'](_0x3a8d01[_0x3d3d23]))!=-0x1){_0x5ea11b=_0x3a8d01[_0x3d3d23];_0x5e90a6=_0x117f30[_0xaee9('0x9')](0x0,_0x3ab40e);_0x117f30=_0x117f30[_0xaee9('0x9')](_0x3ab40e+_0x5ea11b['length']);var _0x199571=_0x5e90a6[_0xaee9('0xa')](_0x4204f3),_0x45b4cb=0x0,_0x5e6163={},_0x598437='',_0x26957d='',_0x246693=-0x1;while(_0x199571[_0x45b4cb]){_0x246693=_0x199571[_0x45b4cb][_0xaee9('0xb')](':');if(_0x246693!=-0x1){_0x598437=_0x199571[_0x45b4cb]['slice'](0x0,_0x246693)[_0xaee9('0xc')]();_0x26957d=_0x199571[_0x45b4cb][_0xaee9('0xd')](_0x246693+0x1)['trim']();if(_0x598437[_0xaee9('0xe')]>0x0){_0x5e6163[_0x598437]=_0x26957d;}}else{}_0x45b4cb++;}this[_0xaee9('0xf')](_0xaee9('0x10'),_0x5e6163);this[_0xaee9('0x3')]=!![];}_0x3d3d23++;}this[_0xaee9('0x2')]=_0x117f30;}else{while((_0x5a7f23=_0x117f30[_0xaee9('0xb')](_0x4204f3))!=-0x1){_0x5e90a6=_0x117f30['substring'](0x0,_0x5a7f23);this['emit']('line',_0x5e90a6);_0x117f30=_0x117f30[_0xaee9('0x9')](_0x5a7f23+_0x4204f3[_0xaee9('0xe')]);}this[_0xaee9('0x2')]=_0x117f30;}_0x39f932();};module[_0xaee9('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 521481e..225f1a0 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 _0x47d6=['CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x47d6,0x1de));var _0x647d=function(_0x61a175,_0x410e43){_0x61a175=_0x61a175-0x0;var _0x1b066b=_0x47d6[_0x61a175];return _0x1b066b;};'use strict';var _=require(_0x647d('0x0'));var moment=require(_0x647d('0x1'));var jayson=require(_0x647d('0x2'));var client=jayson['client']['http']({'port':0x2329});function request(_0x3cd782,_0x1517be){return new Promise(function(_0x3c145f,_0x583a19){return client[_0x647d('0x3')](_0x3cd782,_0x1517be)[_0x647d('0x4')](function(_0x302936){if(_0x302936['error']){return _0x583a19(_0x302936[_0x647d('0x5')][_0x647d('0x6')]);}else{return _0x3c145f(_0x302936[_0x647d('0x7')]);}})[_0x647d('0x8')](function(_0x2a9508){return _0x583a19(_0x2a9508);});});}exports[_0x647d('0x9')]=function(){return request(_0x647d('0xa'),{'options':{'raw':![],'attributes':['id',_0x647d('0xb'),_0x647d('0xc')]}});};exports[_0x647d('0xd')]=function(_0x32bb36){return request(_0x647d('0xe'),{'options':{'raw':![],'where':{'name':_0x32bb36},'attributes':['production']}});};exports[_0x647d('0xf')]=function(_0x21aded){return request(_0x647d('0x10'),{'options':{'raw':![],'where':{'id':_0x21aded},'include':[{'model':_0x647d('0x11'),'as':_0x647d('0x12'),'include':[{'model':_0x647d('0x13'),'as':_0x647d('0x13')}]}],'attributes':['id',_0x647d('0xb'),_0x647d('0x14')],'smtp':!![]}});};exports[_0x647d('0x15')]=function(_0x328d38){return request(_0x647d('0xe'),{'options':{'where':{'id':_0x328d38},'attributes':[_0x647d('0xb')]}});};exports['getVoiceQueueById']=function(_0x18ef9e){return request(_0x647d('0x16'),{'options':{'where':{'id':_0x18ef9e},'attributes':[_0x647d('0xb')]}});};exports['getVariableById']=function(_0x25fa4a){return request('ShowVariable',{'options':{'where':{'id':_0x25fa4a},'attributes':[_0x647d('0xb')]}});};exports['getSquareOdbcById']=function(_0xb14b1e){return request(_0x647d('0x17'),{'options':{'where':{'id':_0xb14b1e},'attributes':['dsn']}});};exports[_0x647d('0x18')]=function(_0x539fe4){return request(_0x647d('0x19'),{'options':{'where':{'id':_0x539fe4},'attributes':[_0x647d('0xb')]}});};exports[_0x647d('0x1a')]=function(_0x407788){return request(_0x647d('0x1b'),{'options':{'where':{'phone':_0x407788[_0x647d('0x1c')]},'attributes':['id']}});};exports[_0x647d('0x1d')]=function(_0x29168d){return request(_0x647d('0x1e'),{'options':{'where':{'id':_0x29168d},'attributes':[_0x647d('0xb')]}});};exports[_0x647d('0x1f')]=function(_0x2fe974){return request(_0x647d('0x20'),{'options':{'where':{'id':_0x2fe974},'attributes':[_0x647d('0x21')]}});};exports[_0x647d('0x22')]=function(_0x40484c){return request(_0x647d('0x23'),{'options':{'raw':![],'where':{'id':_0x40484c},'include':[{'model':_0x647d('0x24'),'as':_0x647d('0x25')}]}});};exports['getSmsAccountById']=function(_0x417a03){return request(_0x647d('0x26'),{'options':{'where':{'id':_0x417a03},'attributes':['id','name']}});};exports[_0x647d('0x27')]=function(_0x3d8e69){return request(_0x647d('0x28'),{'body':_0x3d8e69});};exports[_0x647d('0x29')]=function(_0x5019c2){return request(_0x647d('0x2a'),{'body':_0x5019c2});};exports[_0x647d('0x2b')]=function(_0xe87980){return request(_0x647d('0x2c'),{'body':_[_0x647d('0x2d')](_0xe87980,{'project_name':_0xe87980['arg_1'],'prev_project_name':_0xe87980[_0x647d('0x2e')]||'','is_subproject':_0xe87980[_0x647d('0x2e')]?!![]:![],'leaveAt':moment()[_0x647d('0x2f')](_0x647d('0x30'))})});};exports[_0x647d('0x31')]=function(_0xee7626){return request(_0x647d('0x32'),{'body':_0xee7626});};exports[_0x647d('0x33')]=function(_0x5f18d7){return request('CreateSquareMessage',{'body':_0x5f18d7});};exports[_0x647d('0x34')]=function(_0x20d08d){return request(_0x647d('0x35'),{'options':{'raw':![],'where':{'phone':_0x20d08d[_0x647d('0x1c')],'ListId':_0x20d08d[_0x647d('0x36')]}}})[_0x647d('0x4')](function(_0x344fb5){if(_0x344fb5){return _0x344fb5;}return request(_0x647d('0x37'),{'body':_0x20d08d});});};exports[_0x647d('0x38')]=function(_0xe3983e){return request(_0x647d('0x39'),{'options':{'where':{'id':_0xe3983e},'attributes':[_0x647d('0xb')]}});};exports[_0x647d('0x3a')]=function(_0x135932,_0x2945f4){return request(_0x647d('0x3b'),{'body':{'interface':_0x2945f4},'options':{'where':_0x135932}});};exports['agentPause']=function(_0x16e563,_0x2197b6,_0x3ae6d2){return request(_0x647d('0x3c'),{'body':{'type':_0x2197b6,'uniqueid':_0x3ae6d2},'options':{'where':_0x16e563}});};exports[_0x647d('0x3d')]=function(_0x16387a){return request(_0x647d('0x3e'),{'body':{},'options':{'where':_0x16387a}});};exports[_0x647d('0x3f')]=function(_0x4a33b8){return request(_0x647d('0x40'),{'body':{},'options':{'where':_0x4a33b8}});}; \ No newline at end of file +var _0x13c0=['UnpauseUser','lodash','moment','jayson/promise','client','request','then','error','message','getSquareProjects','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createCmContact','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause'];(function(_0x20368b,_0x290bbb){var _0x7c6c4=function(_0x17d19b){while(--_0x17d19b){_0x20368b['push'](_0x20368b['shift']());}};_0x7c6c4(++_0x290bbb);}(_0x13c0,0x79));var _0x013c=function(_0x155413,_0x1c89b4){_0x155413=_0x155413-0x0;var _0x434c71=_0x13c0[_0x155413];return _0x434c71;};'use strict';var _=require(_0x013c('0x0'));var moment=require(_0x013c('0x1'));var jayson=require(_0x013c('0x2'));var client=jayson[_0x013c('0x3')]['http']({'port':0x2329});function request(_0x4fb1ff,_0x5b8e8e){return new Promise(function(_0x17ae19,_0x70a468){return client[_0x013c('0x4')](_0x4fb1ff,_0x5b8e8e)[_0x013c('0x5')](function(_0x129de9){if(_0x129de9[_0x013c('0x6')]){return _0x70a468(_0x129de9[_0x013c('0x6')][_0x013c('0x7')]);}else{return _0x17ae19(_0x129de9['result']);}})['catch'](function(_0x593053){return _0x70a468(_0x593053);});});}exports[_0x013c('0x8')]=function(){return request(_0x013c('0x9'),{'options':{'raw':![],'attributes':['id','name',_0x013c('0xa')]}});};exports[_0x013c('0xb')]=function(_0x371681){return request(_0x013c('0xc'),{'options':{'raw':![],'where':{'name':_0x371681},'attributes':[_0x013c('0xa')]}});};exports[_0x013c('0xd')]=function(_0x2ef1f9){return request(_0x013c('0xe'),{'options':{'raw':![],'where':{'id':_0x2ef1f9},'include':[{'model':_0x013c('0xf'),'as':_0x013c('0x10'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0x013c('0x11'),_0x013c('0x12')],'smtp':!![]}});};exports[_0x013c('0x13')]=function(_0x69c57b){return request('ShowSquareProject',{'options':{'where':{'id':_0x69c57b},'attributes':[_0x013c('0x11')]}});};exports[_0x013c('0x14')]=function(_0xcfe81a){return request(_0x013c('0x15'),{'options':{'where':{'id':_0xcfe81a},'attributes':[_0x013c('0x11')]}});};exports['getVariableById']=function(_0x307f34){return request(_0x013c('0x16'),{'options':{'where':{'id':_0x307f34},'attributes':[_0x013c('0x11')]}});};exports[_0x013c('0x17')]=function(_0x1a5e16){return request(_0x013c('0x18'),{'options':{'where':{'id':_0x1a5e16},'attributes':[_0x013c('0x19')]}});};exports[_0x013c('0x1a')]=function(_0x246f11){return request(_0x013c('0x1b'),{'options':{'where':{'id':_0x246f11},'attributes':[_0x013c('0x11')]}});};exports[_0x013c('0x1c')]=function(_0x25eb26){return request('GetContactByPhone',{'options':{'where':{'phone':_0x25eb26['phone']},'attributes':['id']}});};exports[_0x013c('0x1d')]=function(_0x153b0a){return request('ShowTrunk',{'options':{'where':{'id':_0x153b0a},'attributes':[_0x013c('0x11')]}});};exports[_0x013c('0x1e')]=function(_0x29c141){return request(_0x013c('0x1f'),{'options':{'where':{'id':_0x29c141},'attributes':[_0x013c('0x20')]}});};exports['getIntervalById']=function(_0xb039bc){return request(_0x013c('0x21'),{'options':{'raw':![],'where':{'id':_0xb039bc},'include':[{'model':'Interval','as':_0x013c('0x22')}]}});};exports[_0x013c('0x23')]=function(_0x53fbbd){return request('ShowSmsAccount',{'options':{'where':{'id':_0x53fbbd},'attributes':['id',_0x013c('0x11')]}});};exports[_0x013c('0x24')]=function(_0x2509f4){return request(_0x013c('0x25'),{'body':_0x2509f4});};exports[_0x013c('0x26')]=function(_0x2c28a7){return request(_0x013c('0x27'),{'body':_0x2c28a7});};exports[_0x013c('0x28')]=function(_0x4ffb6d){return request(_0x013c('0x29'),{'body':_[_0x013c('0x2a')](_0x4ffb6d,{'project_name':_0x4ffb6d[_0x013c('0x2b')],'prev_project_name':_0x4ffb6d[_0x013c('0x2c')]||'','is_subproject':_0x4ffb6d[_0x013c('0x2c')]?!![]:![],'leaveAt':moment()[_0x013c('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x013c('0x2e')]=function(_0xd85349){return request(_0x013c('0x2f'),{'body':_0xd85349});};exports['createSquareMessage']=function(_0xa74f05){return request('CreateSquareMessage',{'body':_0xa74f05});};exports[_0x013c('0x30')]=function(_0x455b88){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x455b88[_0x013c('0x31')],'ListId':_0x455b88[_0x013c('0x32')]}}})[_0x013c('0x5')](function(_0x43dc43){if(_0x43dc43){return _0x43dc43;}return request(_0x013c('0x33'),{'body':_0x455b88});});};exports[_0x013c('0x34')]=function(_0x12ba2a){return request(_0x013c('0x35'),{'options':{'where':{'id':_0x12ba2a},'attributes':[_0x013c('0x11')]}});};exports[_0x013c('0x36')]=function(_0x556bdc,_0x315cd8){return request(_0x013c('0x37'),{'body':{'interface':_0x315cd8},'options':{'where':_0x556bdc}});};exports[_0x013c('0x38')]=function(_0x24617f,_0x330ccf,_0x5b42ac){return request(_0x013c('0x39'),{'body':{'type':_0x330ccf,'uniqueid':_0x5b42ac},'options':{'where':_0x24617f}});};exports[_0x013c('0x3a')]=function(_0xd19307){return request(_0x013c('0x3b'),{'body':{},'options':{'where':_0xd19307}});};exports['agentLogout']=function(_0x4da083){return request('LogoutUser',{'body':{},'options':{'where':_0x4da083}});}; \ 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 a1e29f9..409083a 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 _0x03db=['./polly','./lex','exports'];(function(_0x1d745e,_0x144daf){var _0x259f61=function(_0x3f5bd7){while(--_0x3f5bd7){_0x1d745e['push'](_0x1d745e['shift']());}};_0x259f61(++_0x144daf);}(_0x03db,0x156));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};var polly=require(_0xb03d('0x0'));var lex=require(_0xb03d('0x1'));module[_0xb03d('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x644f=['./polly','./lex'];(function(_0x462b2a,_0x435e1c){var _0x7b6863=function(_0x46a361){while(--_0x46a361){_0x462b2a['push'](_0x462b2a['shift']());}};_0x7b6863(++_0x435e1c);}(_0x644f,0xc2));var _0xf644=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0x644f[_0x533528];return _0x3189f1;};var polly=require(_0xf644('0x0'));var lex=require(_0xf644('0x1'));module['exports']={'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 b925ad5..8d03fca 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f){return lex(_0x26fe42,_0xe4a5bf,_0x17d4ec,_0x22c4b8,_0x4c37e8,_0x8c392f);}; \ No newline at end of file +var _0x5ff3=['exports'];(function(_0x44ce6d,_0x4fbfc9){var _0x2b9011=function(_0x3f1e40){while(--_0x3f1e40){_0x44ce6d['push'](_0x44ce6d['shift']());}};_0x2b9011(++_0x4fbfc9);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1c247b,_0x43fada){_0x1c247b=_0x1c247b-0x0;var _0xf124ba=_0x5ff3[_0x1c247b];return _0xf124ba;};'use strict';var lex=require('./lib/api');module[_0x35ff('0x0')]=function(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a){return lex(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 0c8c13e..2335808 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(_0x6a41d1,_0x402efe){var _0x468262=function(_0x6d0ed8){while(--_0x6d0ed8){_0x6a41d1['push'](_0x6a41d1['shift']());}};_0x468262(++_0x402efe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x47abc5,_0x1abfdc){var _0x1ec637=function(_0x163f9f){while(--_0x163f9f){_0x47abc5['push'](_0x47abc5['shift']());}};_0x1ec637(++_0x1abfdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 0f565b5..f46766c 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 _0x0184=['exports','./lib/api'];(function(_0x5e5c6f,_0x29fc48){var _0x1ecf46=function(_0x14bf3b){while(--_0x14bf3b){_0x5e5c6f['push'](_0x5e5c6f['shift']());}};_0x1ecf46(++_0x29fc48);}(_0x0184,0x103));var _0x4018=function(_0x3af955,_0x21431c){_0x3af955=_0x3af955-0x0;var _0x167de5=_0x0184[_0x3af955];return _0x167de5;};'use strict';var polly=require(_0x4018('0x0'));module[_0x4018('0x1')]=function(_0x3bd14,_0x1a7e31,_0x1f4740,_0x5bf14d,_0x461c5b,_0x53a831,_0xc02f49){return polly(_0x3bd14,_0x1a7e31,_0x1f4740,_0x5bf14d,_0x461c5b,_0x53a831,_0xc02f49);}; \ No newline at end of file +var _0xa66c=['exports'];(function(_0x3bd97f,_0x44bb45){var _0x463ab9=function(_0x2fc0c5){while(--_0x2fc0c5){_0x3bd97f['push'](_0x3bd97f['shift']());}};_0x463ab9(++_0x44bb45);}(_0xa66c,0x6b));var _0xca66=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa66c[_0x14add3];return _0x4a174f;};'use strict';var polly=require('./lib/api');module[_0xca66('0x0')]=function(_0x38b487,_0x2421f0,_0x3d1ae7,_0x2f37b4,_0x456c99,_0x32e24c,_0x6349ad){return polly(_0x38b487,_0x2421f0,_0x3d1ae7,_0x2f37b4,_0x456c99,_0x32e24c,_0x6349ad);}; \ 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 d2e45e6..ce95273 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 _0xba39=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','mp3','bluebird'];(function(_0x32806e,_0x84d48f){var _0x564c55=function(_0xf5cd34){while(--_0xf5cd34){_0x32806e['push'](_0x32806e['shift']());}};_0x564c55(++_0x84d48f);}(_0xba39,0x110));var _0x9ba3=function(_0x4b63fb,_0x27beba){_0x4b63fb=_0x4b63fb-0x0;var _0x1e4b79=_0xba39[_0x4b63fb];return _0x1e4b79;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x9ba3('0x0'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x501ad5,_0x2362d0,_0xd27e80){return new BPromise(function(_0x170cce,_0x24438e){_0x501ad5[_0x9ba3('0x1')](_0x2362d0,function(_0x5e8ed3,_0x4ae216){if(_0x5e8ed3){_0x24438e(_0x5e8ed3);}else if(_0x4ae216){if(_0x4ae216[_0x9ba3('0x2')]instanceof Buffer){fs[_0x9ba3('0x3')](_0xd27e80,_0x4ae216['AudioStream'],function(_0x595c2b){if(_0x595c2b){_0x24438e(_0x595c2b);}else{_0x170cce();}});}else{_0x24438e(new Error(_0x9ba3('0x4')));}}else{_0x24438e(new Error(_0x9ba3('0x5')));}});});}module['exports']=function(_0x27bd99,_0x8228f5,_0x11bc53,_0x36db47,_0xae386a,_0x30a8c4,_0x13ae90){var _0xda1093=new AWS['Polly']({'accessKeyId':_0x27bd99,'secretAccessKey':_0x8228f5,'region':_0x11bc53});var _0xf0ac4b={'Text':_0xae386a,'TextType':_0x30a8c4||'text','OutputFormat':_0x9ba3('0x6'),'VoiceId':_0x36db47};return pollyResult(_0xda1093,_0xf0ac4b,_0x13ae90);}; \ No newline at end of file +var _0x6e87=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','synthesizeSpeech','AudioStream'];(function(_0x1c1788,_0x5419a2){var _0x27e9a4=function(_0x4bbd3d){while(--_0x4bbd3d){_0x1c1788['push'](_0x1c1788['shift']());}};_0x27e9a4(++_0x5419a2);}(_0x6e87,0x14e));var _0x76e8=function(_0x49e8e2,_0x44d58c){_0x49e8e2=_0x49e8e2-0x0;var _0x1ee938=_0x6e87[_0x49e8e2];return _0x1ee938;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x15bf93,_0x471aa7,_0x1c60b8){return new BPromise(function(_0x3ae601,_0x385bbd){_0x15bf93[_0x76e8('0x0')](_0x471aa7,function(_0x57564d,_0x108392){if(_0x57564d){_0x385bbd(_0x57564d);}else if(_0x108392){if(_0x108392[_0x76e8('0x1')]instanceof Buffer){fs[_0x76e8('0x2')](_0x1c60b8,_0x108392[_0x76e8('0x1')],function(_0xf56742){if(_0xf56742){_0x385bbd(_0xf56742);}else{_0x3ae601();}});}else{_0x385bbd(new Error(_0x76e8('0x3')));}}else{_0x385bbd(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x76e8('0x4')]=function(_0x56ef61,_0x1494ae,_0x130e40,_0x1eebf3,_0x228188,_0x359d50,_0x2b113b){var _0x39c519=new AWS[(_0x76e8('0x5'))]({'accessKeyId':_0x56ef61,'secretAccessKey':_0x1494ae,'region':_0x130e40});var _0x4eb10b={'Text':_0x228188,'TextType':_0x359d50||'text','OutputFormat':_0x76e8('0x6'),'VoiceId':_0x1eebf3};return pollyResult(_0x39c519,_0x4eb10b,_0x2b113b);}; \ 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 1ac5ccb..9e85a71 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 _0xf5c6=['./lib/api','exports'];(function(_0x55c7a3,_0x32621e){var _0x582832=function(_0x6adceb){while(--_0x6adceb){_0x55c7a3['push'](_0x55c7a3['shift']());}};_0x582832(++_0x32621e);}(_0xf5c6,0x172));var _0x6f5c=function(_0x4337d2,_0x189a48){_0x4337d2=_0x4337d2-0x0;var _0xe7b989=_0xf5c6[_0x4337d2];return _0xe7b989;};'use strict';var asr=require(_0x6f5c('0x0'));module[_0x6f5c('0x1')]=function(_0x2f5259,_0x459627,_0x1e188b,_0x6cdd67){return asr(_0x2f5259,_0x459627,_0x1e188b);}; \ No newline at end of file +var _0x8299=['./lib/api','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8299,0x1c2));var _0x9829=function(_0x4ba8cc,_0x182aac){_0x4ba8cc=_0x4ba8cc-0x0;var _0x5ef3fe=_0x8299[_0x4ba8cc];return _0x5ef3fe;};'use strict';var asr=require(_0x9829('0x0'));module[_0x9829('0x1')]=function(_0x4dfc4f,_0xe628c6,_0x1e6c37,_0x6c03b6){return asr(_0x4dfc4f,_0xe628c6,_0x1e6c37);}; \ 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 84d489a..fbb0853 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 _0xfc4c=['undefined','length','base64','/v1/speech:recognize?key=','url','bluebird','https://speech.googleapis.com','string','key\x20should\x20be\x20a\x20string'];(function(_0x262bff,_0x5cba81){var _0x52cf9d=function(_0x3d659a){while(--_0x3d659a){_0x262bff['push'](_0x262bff['shift']());}};_0x52cf9d(++_0x5cba81);}(_0xfc4c,0xca));var _0xcfc4=function(_0x259b0c,_0x242d07){_0x259b0c=_0x259b0c-0x0;var _0x4a1841=_0xfc4c[_0x259b0c];return _0x4a1841;};'use strict';var url=require(_0xcfc4('0x0'));var BPromise=require(_0xcfc4('0x1'));var fs=require('fs');var host=_0xcfc4('0x2');module['exports']=function(_0x29323d,_0xb8f67b,_0x3a0bd9){return new BPromise(function(_0x54bee8,_0x57bf8a){var _0x436d9b;if(typeof _0x29323d!==_0xcfc4('0x3')||_0x29323d['length']===0x0){return _0x57bf8a('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xb8f67b!==_0xcfc4('0x3')||_0xb8f67b['length']===0x0){return _0x57bf8a(_0xcfc4('0x4'));}if(typeof _0x3a0bd9!==_0xcfc4('0x5')&&(typeof _0x3a0bd9!=='string'||_0x3a0bd9[_0xcfc4('0x6')]===0x0)){return _0x57bf8a('lang\x20should\x20be\x20a\x20string');}try{_0x436d9b=fs['readFileSync'](_0x29323d)['toString'](_0xcfc4('0x7'));}catch(_0x2d8256){return _0x57bf8a(_0x2d8256);}return _0x54bee8({'method':'POST','uri':host+_0xcfc4('0x8')+_0xb8f67b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x3a0bd9},'audio':{'content':_0x436d9b}},'json':!![]});});}; \ No newline at end of file +var _0x3e25=['toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3e25,0x14f));var _0x53e2=function(_0xf1c42d,_0x330890){_0xf1c42d=_0xf1c42d-0x0;var _0x3b44bc=_0x3e25[_0xf1c42d];return _0x3b44bc;};'use strict';var url=require(_0x53e2('0x0'));var BPromise=require(_0x53e2('0x1'));var fs=require('fs');var host=_0x53e2('0x2');module['exports']=function(_0x7d9aaf,_0x4ac459,_0x3faa27){return new BPromise(function(_0x54366b,_0x36545f){var _0x2e0130;if(typeof _0x7d9aaf!==_0x53e2('0x3')||_0x7d9aaf[_0x53e2('0x4')]===0x0){return _0x36545f(_0x53e2('0x5'));}if(typeof _0x4ac459!==_0x53e2('0x3')||_0x4ac459[_0x53e2('0x4')]===0x0){return _0x36545f(_0x53e2('0x6'));}if(typeof _0x3faa27!==_0x53e2('0x7')&&(typeof _0x3faa27!==_0x53e2('0x3')||_0x3faa27[_0x53e2('0x4')]===0x0)){return _0x36545f(_0x53e2('0x8'));}try{_0x2e0130=fs[_0x53e2('0x9')](_0x7d9aaf)[_0x53e2('0xa')](_0x53e2('0xb'));}catch(_0x1b3c38){return _0x36545f(_0x1b3c38);}return _0x54366b({'method':_0x53e2('0xc'),'uri':host+_0x53e2('0xd')+_0x4ac459,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x53e2('0xe'),'languageCode':_0x3faa27},'audio':{'content':_0x2e0130}},'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 919e330..467232a 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 _0xd7ca=['exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xd7ca,0x9f));var _0xad7c=function(_0xd25678,_0x5880ab){_0xd25678=_0xd25678-0x0;var _0x5966e0=_0xd7ca[_0xd25678];return _0x5966e0;};var asr=require('./asr');module[_0xad7c('0x0')]={'asr':asr}; \ No newline at end of file +var _0xcdb3=['./asr','exports'];(function(_0xb21f,_0x4b4a49){var _0x19760c=function(_0x232251){while(--_0x232251){_0xb21f['push'](_0xb21f['shift']());}};_0x19760c(++_0x4b4a49);}(_0xcdb3,0x96));var _0x3cdb=function(_0x45fcaf,_0x32a5ab){_0x45fcaf=_0x45fcaf-0x0;var _0x44fa5e=_0xcdb3[_0x45fcaf];return _0x44fa5e;};var asr=require(_0x3cdb('0x0'));module[_0x3cdb('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 80b7462..0689794 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 _0x1274=['tmp','generate','writeFileSync','base64','then','777','split','toString','https://texttospeech.googleapis.com/v1/','input','voice','MP3','POST','audioContent','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','.mp3','.wav','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','http','https','md5','path','querystring','request-promise','sox','google-tts-api','parse','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','get','transcode','wav','finish\x20to\x20convert','resolve'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x1274,0x165));var _0x4127=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1274[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require(_0x4127('0x0'));var BPromise=require(_0x4127('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x4127('0x2'));var https=require(_0x4127('0x3'));var md5=require(_0x4127('0x4'));var path=require(_0x4127('0x5'));var querystring=require(_0x4127('0x6'));var rp=require(_0x4127('0x7'));var rs=require('randomstring');var sox=require(_0x4127('0x8'));var tts=require(_0x4127('0x9'));var urlParse=require('url')[_0x4127('0xa')];var util=require('util');var aws=require(_0x4127('0xb'));var google=require(_0x4127('0xc'));var sestek=require(_0x4127('0xd'));var tilde=require('./tilde');var logger=require(_0x4127('0xe'))(_0x4127('0xf'));var ISPEECH_API=_0x4127('0x10');function downloadFile(_0x513ae8,_0x383135){return new BPromise(function(_0x3d6f6e,_0x51bb59){var _0x25b67f=urlParse(_0x513ae8);var _0x41835c=_0x25b67f[_0x4127('0x11')]===_0x4127('0x12')?https:http;var _0x1d6385={'host':_0x25b67f[_0x4127('0x13')],'path':_0x25b67f[_0x4127('0x5')],'headers':{'user-agent':_0x4127('0x14')}};_0x41835c['get'](_0x1d6385,function(_0x351ec0){if(_0x351ec0[_0x4127('0x15')]!==0xc8){logger['error']('request\x20to\x20'+_0x513ae8+_0x4127('0x16')+_0x351ec0[_0x4127('0x15')]+'\x20('+_0x351ec0[_0x4127('0x17')]+')');_0x51bb59(new Error(_0x4127('0x18')+_0x513ae8+_0x4127('0x16')+_0x351ec0[_0x4127('0x15')]+'\x20('+_0x351ec0[_0x4127('0x17')]+')'));return;}var _0x249325=fs['createWriteStream'](_0x383135);_0x249325['on'](_0x4127('0x19'),function(){logger[_0x4127('0x1a')](_0x4127('0x1b'));_0x249325[_0x4127('0x1c')](_0x3d6f6e);});_0x249325['on'](_0x4127('0x1d'),function(_0x3a7460){fs[_0x4127('0x1e')](_0x383135);logger['error'](_0x4127('0x1f'),_0x3a7460);_0x51bb59(_0x3a7460);});_0x351ec0[_0x4127('0x20')](_0x249325);})['on']('error',function(_0x341649){logger[_0x4127('0x1d')](_0x341649);_0x51bb59(_0x341649);})[_0x4127('0x21')]();});}function uploadFile(_0x30a793){return new BPromise(function(_0x595669,_0x1ad885){var _0x241e75=urlParse(_0x30a793);var _0x4dee14=_0x241e75[_0x4127('0x11')]===_0x4127('0x12')?https:http;var _0x127aa8={'host':_0x241e75[_0x4127('0x13')],'path':_0x241e75[_0x4127('0x5')],'headers':{'user-agent':_0x4127('0x14')}};_0x4dee14[_0x4127('0x22')](_0x127aa8,function(_0x285be6){if(_0x285be6[_0x4127('0x15')]!==0xc8){_0x1ad885(new Error(_0x4127('0x18')+_0x30a793+'\x20failed,\x20status\x20code\x20=\x20'+_0x285be6[_0x4127('0x15')]+'\x20('+_0x285be6[_0x4127('0x17')]+')'));return;}var _0x351711='';_0x285be6['on']('data',function(_0x507f88){_0x351711+=_0x507f88;});_0x285be6['on'](_0x4127('0x21'),function(){_0x595669(_0x351711);});})['on'](_0x4127('0x1d'),function(_0x18151c){_0x1ad885(_0x18151c);})[_0x4127('0x21')]();});}function convertFile(_0x2c8e3b,_0x510396){return new BPromise(function(_0x2d4c9e,_0x5b801c){var _0x235d11=sox[_0x4127('0x23')](_0x2c8e3b,_0x510396,{'sampleRate':0x1f40,'format':_0x4127('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x235d11['on']('error',function(_0x89ed21){logger[_0x4127('0x1d')]('error\x20convert',_0x89ed21);_0x5b801c(_0x89ed21);});_0x235d11['on'](_0x4127('0x21'),function(){logger['info'](_0x4127('0x25'));_0x2d4c9e();});_0x235d11['start']();});}function base64Decode(_0x4013ba,_0x2612c9){var _0x54d956=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+'.wav');fs[_0x4127('0x29')](_0x54d956,_0x4013ba,_0x4127('0x2a'));return convertFile(_0x54d956,_0x2612c9)[_0x4127('0x2b')](function(){try{fs[_0x4127('0x1e')](_0x54d956);fs['chmodSync'](_0x2612c9,_0x4127('0x2c'));}catch(_0x568396){logger[_0x4127('0x1d')](_0x568396);}return _0x2612c9[_0x4127('0x2d')]('.')[0x0];});}function base64Encode(_0x26e145){var _0x708c1=fs['readFileSync'](_0x26e145);return new Buffer(_0x708c1)[_0x4127('0x2e')](_0x4127('0x2a'));}exports['googleCloudTTS']=function(_0x134fd7,_0x2d5344,_0x5b6f26,_0x37117b,_0x3152a1,_0x31097a){var _0x5db766,_0x50e5fd;var _0x7bbdae=_0x4127('0x2f');var _0x13f924='?key='+_0x134fd7;var _0x350962={};if(_0x2d5344==='ssml'){_0x350962[_0x4127('0x30')]={'ssml':_0x5b6f26};}else{_0x350962['input']={'text':_0x5b6f26};};_0x350962[_0x4127('0x31')]={'languageCode':_0x37117b,'ssmlGender':_0x3152a1};_0x350962['audioConfig']={'audioEncoding':_0x4127('0x32'),'sampleRateHertz':0x1f40};var _0x388e67={'url':_0x7bbdae+'text:synthesize'+_0x13f924,'method':_0x4127('0x33'),'json':!![],'body':_0x350962};return rp(_0x388e67)['then'](function(_0x4cd010){return new BPromise(function(_0x43ee1e,_0x43ecec){_0x5db766=path['resolve'](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+'.mp3');var _0x29a2c4=Buffer['from'](_0x4cd010[_0x4127('0x34')],_0x4127('0x2a'));return fs['writeFile'](_0x5db766,_0x29a2c4,function(_0x438765){_0x43ecec(_0x438765);},function(_0x17892b){fs['chmodSync'](_0x5db766,_0x4127('0x2c'));_0x43ee1e(_0x17892b);});});})['then'](function(_0x2a7e5a){_0x50e5fd=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+'.wav');return convertFile(_0x5db766,_0x50e5fd);})[_0x4127('0x2b')](function(){try{fs[_0x4127('0x1e')](_0x5db766);fs[_0x4127('0x35')](_0x50e5fd,_0x4127('0x2c'));}catch(_0x49fd9d){logger[_0x4127('0x1d')](_0x49fd9d);}logger[_0x4127('0x1a')](_0x4127('0x36'),_0x50e5fd[_0x4127('0x2d')]('.')[0x0]);return _0x50e5fd[_0x4127('0x2d')]('.')[0x0];});};exports[_0x4127('0x37')]=function(_0x52dd67,_0x16a27a){var _0x18931c=_0x4127('0x38');var _0x535b77,_0x398f6e;var _0x11a4c7;var _0x1bda5a={'encoding':_0x4127('0x39'),'method':_0x4127('0x33'),'timeout':0x2710,'url':_0x18931c,'headers':{'Content-Type':_0x4127('0x3a')},'body':_0x4127('0x3b')+encodeURIComponent(JSON[_0x4127('0x3c')]([[[_0x4127('0x3d'),JSON['stringify']([_0x52dd67,_0x16a27a||'en',![],'null']),null,'generic']]]))};return rp(_0x1bda5a)['then'](function(_0x49a51b){try{_0x11a4c7=eval(_0x49a51b['slice'](0x5))[0x0][0x2];}catch(_0x30bf9b){throw new Error(_0x4127('0x3e')+_0x49a51b[_0x4127('0x3f')]);}if(!_0x11a4c7){if(_0x52dd67[_0x4127('0x40')]>0xc8){throw new Error(_0x4127('0x41'));}else{throw new Error(_0x4127('0x42')+_0x16a27a+'\x22\x20might\x20not\x20exist');}}try{_0x11a4c7=eval(_0x11a4c7)[0x0];}catch(_0x1aff83){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x4127('0x3f')]);}const _0x1deec9=_0x11a4c7;_0x535b77=path[_0x4127('0x26')](__dirname,'tmp',rs[_0x4127('0x28')](0x4)+_0x4127('0x43'));fs['writeFileSync'](_0x535b77,_0x11a4c7,{'encoding':'base64'});_0x398f6e=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x44'));return convertFile(_0x535b77,_0x398f6e);})[_0x4127('0x2b')](function(){try{fs['unlink'](_0x535b77);fs[_0x4127('0x35')](_0x398f6e,'777');}catch(_0x567ff3){logger[_0x4127('0x1d')](_0x567ff3);}logger[_0x4127('0x1a')](_0x4127('0x45'),_0x398f6e[_0x4127('0x2d')]('.')[0x0]);return _0x398f6e[_0x4127('0x2d')]('.')[0x0];});};exports[_0x4127('0x46')]=function(_0xa3faac,_0x48bfc4,_0x37335e){return google[_0x4127('0x47')](_0xa3faac,_0x48bfc4,_0x37335e)['then'](function(_0x433f7f){logger[_0x4127('0x1a')](_0x433f7f['uri']);return rp(_0x433f7f);})[_0x4127('0x2b')](function(_0x1f5f47){var _0x5c021f='';var _0x69f2db=0x0;try{fs['unlink'](_0xa3faac);}catch(_0xeb7e8a){logger[_0x4127('0x1d')](_0xeb7e8a);}if(_0x1f5f47&&_0x1f5f47[_0x4127('0x48')]){_0x5c021f=_0x1f5f47[_0x4127('0x48')][_0x4127('0x49')](function(_0x24c12b){return _0x24c12b&&_0x24c12b[_0x4127('0x4a')][0x0]&&_0x24c12b['alternatives'][0x0]['transcript']?_0x24c12b[_0x4127('0x4a')][0x0][_0x4127('0x4b')]:'';})[_0x4127('0x4c')]('\x0a');_0x69f2db=_0x1f5f47[_0x4127('0x48')][_0x4127('0x49')](function(_0x5a287b){return _0x5a287b&&_0x5a287b['alternatives'][0x0]&&_0x5a287b[_0x4127('0x4a')][0x0][_0x4127('0x4d')]?_0x5a287b['alternatives'][0x0][_0x4127('0x4d')]:0x0;})[_0x4127('0x4c')]('\x0a');}logger['info'](_0x4127('0x4e'),_0x5c021f);logger[_0x4127('0x1a')]('googleASR\x20confidence',_0x69f2db);return{'transcript':_0x5c021f,'confidence':_0x69f2db};})[_0x4127('0x4f')](function(_0x473e36){logger[_0x4127('0x1d')](_0x4127('0x50'),_0x473e36[_0x4127('0x15')],_0x473e36[_0x4127('0x51')],_0x473e36[_0x4127('0x52')]);});};exports[_0x4127('0x53')]=function(_0x29354f,_0x5e73eb,_0x47d3da,_0x1363f2){var _0x4a6704=apiai(_0x5e73eb,{'language':_0x1363f2||'en'});return _0x4a6704[_0x4127('0x54')](_0x47d3da,{'sessionId':md5(_0x29354f)})[_0x4127('0x2b')](function(_0x2fc196){logger[_0x4127('0x1a')](JSON['stringify'](_0x2fc196));return{'source':_0x2fc196[_0x4127('0x55')][_0x4127('0x56')],'resolvedQuery':_0x2fc196[_0x4127('0x55')][_0x4127('0x57')],'action':_0x2fc196['result'][_0x4127('0x58')],'actionIncomplete':_0x2fc196[_0x4127('0x55')]['actionIncomplete'],'speech':_0x2fc196[_0x4127('0x55')]['fulfillment']['speech'],'score':_0x2fc196[_0x4127('0x55')][_0x4127('0x59')],'statusCode':_0x2fc196[_0x4127('0x5a')][_0x4127('0x5b')],'endConversation':_0x2fc196[_0x4127('0x55')][_0x4127('0x5c')][_0x4127('0x5d')]||![],'isFallbackIntent':_0x2fc196['result'][_0x4127('0x5c')][_0x4127('0x5e')]};});};exports[_0x4127('0x5f')]=function(_0x250336,_0x3a5557,_0xfa3ead,_0x4e87a6,_0xd2b973,_0x209ce0){var _0x5f1c89=_0x4e87a6[_0x4127('0x60')](/\\n/g,'\x0a');var _0x29aee4={'credentials':{'private_key':_0x5f1c89,'client_email':_0xfa3ead}};var _0x20cd7b=new dialogflow[(_0x4127('0x61'))](_0x29aee4);var _0xe8116b=_0x20cd7b['sessionPath'](_0x3a5557,md5(_0x250336));var _0x14d659={'session':_0xe8116b,'queryInput':{'text':{'text':_0xd2b973,'languageCode':_0x209ce0}}};return _0x20cd7b[_0x4127('0x62')](_0x14d659)[_0x4127('0x2b')](function(_0x45d309){if(_0x45d309&&_0x45d309['length']){logger[_0x4127('0x1a')](_0x4127('0x63'),JSON[_0x4127('0x3c')](_0x45d309));var _0x3ef909=_0x45d309[0x0];if(_0x3ef909){var _0x724c8d={'action':_0x3ef909[_0x4127('0x64')]['action'],'allRequiredParamsPresent':_0x3ef909[_0x4127('0x64')][_0x4127('0x65')],'endConversation':_0x3ef909[_0x4127('0x64')]['diagnosticInfo']&&_0x3ef909['queryResult'][_0x4127('0x66')]['fields']?_0x3ef909[_0x4127('0x64')]['diagnosticInfo'][_0x4127('0x67')][_0x4127('0x68')]['boolValue']:![],'fulfillmentText':_0x3ef909[_0x4127('0x64')][_0x4127('0x69')],'intentName':_0x3ef909['queryResult'][_0x4127('0x6a')][_0x4127('0x51')],'intentDisplayName':_0x3ef909['queryResult'][_0x4127('0x6a')]['displayName'],'isFallbackIntent':_0x3ef909[_0x4127('0x64')]['intent'][_0x4127('0x6b')],'languageCode':_0x3ef909[_0x4127('0x64')][_0x4127('0x6c')],'queryText':_0x3ef909['queryResult'][_0x4127('0x6d')],'responseId':_0x3ef909[_0x4127('0x6e')],'score':_0x3ef909['queryResult']['intentDetectionConfidence'],'speech':_0x3ef909[_0x4127('0x64')][_0x4127('0x69')],'providerResponse':JSON[_0x4127('0x3c')](_0x45d309)};return _0x724c8d;}}});};exports[_0x4127('0x6f')]=function(_0x56c9f9,_0x5dacbb,_0x1a3596,_0x1d62ed){return tilde['asr'](_0x56c9f9,_0x5dacbb,_0x1a3596,_0x1d62ed)['then'](function(_0x2cb0b2){try{fs['unlink'](_0x56c9f9);}catch(_0x42341f){logger[_0x4127('0x1d')](_0x42341f);}logger[_0x4127('0x1a')](_0x4127('0x70'),_0x2cb0b2[_0x4127('0x4b')]);logger['info'](_0x4127('0x71'),_0x2cb0b2[_0x4127('0x4d')]);return _0x2cb0b2;});};exports[_0x4127('0x72')]=function(_0x1a6966,_0x331b66,_0x583645,_0x4737dd,_0x37dc86,_0x4b63f8){var _0x42890b=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs['generate'](0x4)+_0x4127('0x43'));var _0x354f1c;return aws[_0x4127('0x73')](_0x1a6966,_0x331b66,_0x583645,_0x4737dd,_0x37dc86,_0x4b63f8,_0x42890b)[_0x4127('0x2b')](function(){_0x354f1c=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x44'));return convertFile(_0x42890b,_0x354f1c);})[_0x4127('0x2b')](function(){try{fs[_0x4127('0x1e')](_0x42890b);fs['chmodSync'](_0x354f1c,'777');}catch(_0xd9a7ae){logger[_0x4127('0x1d')](_0xd9a7ae);}return _0x354f1c['split']('.')[0x0];});};exports[_0x4127('0x74')]=function(_0x5088ad,_0x56ec08,_0xd1323d,_0x30ec65,_0x2d8ed4,_0x3dbda4){return aws['lex'](_0x5088ad,_0x56ec08,_0xd1323d,_0x30ec65,_0x2d8ed4,_0x3dbda4)[_0x4127('0x2b')](function(_0x5c552b){logger['info'](JSON[_0x4127('0x3c')](_0x5c552b));return _0x5c552b;});};exports[_0x4127('0x75')]=function(_0x4a3010,_0x3883c0,_0x3caed9,_0x28f351){var _0x25b022=util[_0x4127('0x76')](_0x4127('0x77'),ISPEECH_API,_0x4a3010,encodeURIComponent(_0x3883c0),_0x3caed9,_0x28f351);var _0x1ee8f7=path['resolve'](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x43'));var _0x1bc408;return downloadFile(_0x25b022,_0x1ee8f7)[_0x4127('0x2b')](function(){_0x1bc408=path[_0x4127('0x26')](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x44'));return convertFile(_0x1ee8f7,_0x1bc408);})[_0x4127('0x2b')](function(){try{fs[_0x4127('0x1e')](_0x1ee8f7);fs[_0x4127('0x35')](_0x1bc408,'777');}catch(_0x33be32){logger[_0x4127('0x1d')](_0x33be32);}return _0x1bc408['split']('.')[0x0];});};exports[_0x4127('0x78')]=function(_0x52cb27,_0x6044e8,_0x196586,_0x5cb035){var _0x3742e1=util[_0x4127('0x76')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x6044e8,_0x196586,base64Encode(_0x52cb27),_0x5cb035?util[_0x4127('0x76')](_0x4127('0x79'),encodeURIComponent(_0x5cb035)):_0x4127('0x7a'));return uploadFile(_0x3742e1)[_0x4127('0x2b')](function(_0x22eec4){return querystring[_0x4127('0xa')](_0x22eec4);});};exports['sestekNDA']=function(_0x1541ba,_0x56d3dd){return sestek[_0x4127('0x7b')](_0x1541ba,_0x56d3dd)['then'](function(_0x39f323){logger['info'](JSON['stringify'](_0x39f323));var _0x8874e6={'speech':_0x39f323[_0x4127('0x7c')],'action':_0x39f323[_0x4127('0x7d')]?_0x39f323['channelData'][_0x4127('0x7e')]:undefined,'actiondata':_0x39f323[_0x4127('0x7d')]?_0x39f323[_0x4127('0x7d')][_0x4127('0x7f')]:undefined};if(_0x39f323[_0x4127('0x7d')]&&_0x39f323[_0x4127('0x7d')]['AudioFromTts']){return base64Decode(_0x39f323[_0x4127('0x7d')][_0x4127('0x80')][_0x4127('0x81')],path['resolve'](__dirname,_0x4127('0x27'),rs[_0x4127('0x28')](0x4)+_0x4127('0x44')))[_0x4127('0x2b')](function(_0x2fff7c){_0x8874e6[_0x4127('0x82')]=_0x2fff7c;return _0x8874e6;});}return _0x8874e6;});};exports[_0x4127('0x83')]=function(){return __dirname;}; \ No newline at end of file +var _0xedff=['SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','fulfillmentText','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','https:','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','get','data','transcode','error\x20convert','resolve','tmp','writeFileSync','base64','then','unlink','chmodSync','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','POST','generate','.mp3','from','audioContent','writeFile','777','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.wav','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','action','actionIncomplete','fulfillment','score','metadata','isFallbackIntent','googleDialogflowV2','replace'];(function(_0x438ac3,_0x47c47d){var _0xfa892e=function(_0x5b8f7e){while(--_0x5b8f7e){_0x438ac3['push'](_0x438ac3['shift']());}};_0xfa892e(++_0x47c47d);}(_0xedff,0x132));var _0xfedf=function(_0x1668be,_0x4ff80c){_0x1668be=_0x1668be-0x0;var _0x579b1c=_0xedff[_0x1668be];return _0x579b1c;};'use strict';var apiai=require(_0xfedf('0x0'));var BPromise=require(_0xfedf('0x1'));var dialogflow=require(_0xfedf('0x2'));var fs=require('fs');var http=require(_0xfedf('0x3'));var https=require(_0xfedf('0x4'));var md5=require('md5');var path=require(_0xfedf('0x5'));var querystring=require(_0xfedf('0x6'));var rp=require(_0xfedf('0x7'));var rs=require(_0xfedf('0x8'));var sox=require('sox');var tts=require(_0xfedf('0x9'));var urlParse=require(_0xfedf('0xa'))[_0xfedf('0xb')];var util=require(_0xfedf('0xc'));var aws=require('./aws');var google=require(_0xfedf('0xd'));var sestek=require(_0xfedf('0xe'));var tilde=require(_0xfedf('0xf'));var logger=require(_0xfedf('0x10'))('agi');var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x503d27,_0x5eb8e7){return new BPromise(function(_0x5137d1,_0x54facb){var _0x20f8aa=urlParse(_0x503d27);var _0x33304d=_0x20f8aa['protocol']===_0xfedf('0x11')?https:http;var _0xa5d42={'host':_0x20f8aa[_0xfedf('0x12')],'path':_0x20f8aa[_0xfedf('0x5')],'headers':{'user-agent':_0xfedf('0x13')}};_0x33304d['get'](_0xa5d42,function(_0x39948b){if(_0x39948b[_0xfedf('0x14')]!==0xc8){logger[_0xfedf('0x15')]('request\x20to\x20'+_0x503d27+_0xfedf('0x16')+_0x39948b['statusCode']+'\x20('+_0x39948b[_0xfedf('0x17')]+')');_0x54facb(new Error(_0xfedf('0x18')+_0x503d27+_0xfedf('0x16')+_0x39948b[_0xfedf('0x14')]+'\x20('+_0x39948b[_0xfedf('0x17')]+')'));return;}var _0x4aaf6a=fs[_0xfedf('0x19')](_0x5eb8e7);_0x4aaf6a['on'](_0xfedf('0x1a'),function(){logger[_0xfedf('0x1b')](_0xfedf('0x1c'));_0x4aaf6a[_0xfedf('0x1d')](_0x5137d1);});_0x4aaf6a['on']('error',function(_0x1d2f7f){fs['unlink'](_0x5eb8e7);logger[_0xfedf('0x15')](_0xfedf('0x1e'),_0x1d2f7f);_0x54facb(_0x1d2f7f);});_0x39948b[_0xfedf('0x1f')](_0x4aaf6a);})['on'](_0xfedf('0x15'),function(_0x1a3c88){logger[_0xfedf('0x15')](_0x1a3c88);_0x54facb(_0x1a3c88);})[_0xfedf('0x20')]();});}function uploadFile(_0x40b434){return new BPromise(function(_0x64f9fa,_0x280c9b){var _0x532a1c=urlParse(_0x40b434);var _0x543a19=_0x532a1c[_0xfedf('0x21')]===_0xfedf('0x11')?https:http;var _0xa0309f={'host':_0x532a1c[_0xfedf('0x12')],'path':_0x532a1c[_0xfedf('0x5')],'headers':{'user-agent':_0xfedf('0x13')}};_0x543a19[_0xfedf('0x22')](_0xa0309f,function(_0x19082d){if(_0x19082d[_0xfedf('0x14')]!==0xc8){_0x280c9b(new Error(_0xfedf('0x18')+_0x40b434+_0xfedf('0x16')+_0x19082d[_0xfedf('0x14')]+'\x20('+_0x19082d[_0xfedf('0x17')]+')'));return;}var _0xee230d='';_0x19082d['on'](_0xfedf('0x23'),function(_0x1c800c){_0xee230d+=_0x1c800c;});_0x19082d['on'](_0xfedf('0x20'),function(){_0x64f9fa(_0xee230d);});})['on']('error',function(_0x433c13){_0x280c9b(_0x433c13);})[_0xfedf('0x20')]();});}function convertFile(_0x41ef21,_0xe9b4fc){return new BPromise(function(_0x2366a3,_0x5d919a){var _0x3b2604=sox[_0xfedf('0x24')](_0x41ef21,_0xe9b4fc,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3b2604['on'](_0xfedf('0x15'),function(_0x388d9a){logger['error'](_0xfedf('0x25'),_0x388d9a);_0x5d919a(_0x388d9a);});_0x3b2604['on'](_0xfedf('0x20'),function(){logger[_0xfedf('0x1b')]('finish\x20to\x20convert');_0x2366a3();});_0x3b2604['start']();});}function base64Decode(_0x39ff3f,_0x5413da){var _0x3bc6c8=path[_0xfedf('0x26')](__dirname,_0xfedf('0x27'),rs['generate'](0x4)+'.wav');fs[_0xfedf('0x28')](_0x3bc6c8,_0x39ff3f,_0xfedf('0x29'));return convertFile(_0x3bc6c8,_0x5413da)[_0xfedf('0x2a')](function(){try{fs[_0xfedf('0x2b')](_0x3bc6c8);fs[_0xfedf('0x2c')](_0x5413da,'777');}catch(_0x41226f){logger['error'](_0x41226f);}return _0x5413da[_0xfedf('0x2d')]('.')[0x0];});}function base64Encode(_0xa9c6da){var _0xa3fc57=fs[_0xfedf('0x2e')](_0xa9c6da);return new Buffer(_0xa3fc57)['toString'](_0xfedf('0x29'));}exports[_0xfedf('0x2f')]=function(_0x420c3c,_0x3eb44b,_0x165d53,_0x3feddf,_0x10ed4a,_0x385bca){var _0x405d68,_0x1aad65;var _0x568d68=_0xfedf('0x30');var _0x2663e6=_0xfedf('0x31')+_0x420c3c;var _0x122bc0={};if(_0x3eb44b===_0xfedf('0x32')){_0x122bc0[_0xfedf('0x33')]={'ssml':_0x165d53};}else{_0x122bc0[_0xfedf('0x33')]={'text':_0x165d53};};_0x122bc0[_0xfedf('0x34')]={'languageCode':_0x3feddf,'ssmlGender':_0x10ed4a};_0x122bc0['audioConfig']={'audioEncoding':_0xfedf('0x35'),'sampleRateHertz':0x1f40};var _0xcd6950={'url':_0x568d68+'text:synthesize'+_0x2663e6,'method':_0xfedf('0x36'),'json':!![],'body':_0x122bc0};return rp(_0xcd6950)['then'](function(_0x1c13e5){return new BPromise(function(_0xa5f0a9,_0x404acf){_0x405d68=path['resolve'](__dirname,'tmp',rs[_0xfedf('0x37')](0x4)+_0xfedf('0x38'));var _0x3cd214=Buffer[_0xfedf('0x39')](_0x1c13e5[_0xfedf('0x3a')],_0xfedf('0x29'));return fs[_0xfedf('0x3b')](_0x405d68,_0x3cd214,function(_0x36f1a3){_0x404acf(_0x36f1a3);},function(_0x28669f){fs['chmodSync'](_0x405d68,_0xfedf('0x3c'));_0xa5f0a9(_0x28669f);});});})[_0xfedf('0x2a')](function(_0x23baec){_0x1aad65=path[_0xfedf('0x26')](__dirname,'tmp',rs[_0xfedf('0x37')](0x4)+'.wav');return convertFile(_0x405d68,_0x1aad65);})['then'](function(){try{fs[_0xfedf('0x2b')](_0x405d68);fs[_0xfedf('0x2c')](_0x1aad65,_0xfedf('0x3c'));}catch(_0x2de38d){logger[_0xfedf('0x15')](_0x2de38d);}logger[_0xfedf('0x1b')](_0xfedf('0x3d'),_0x1aad65['split']('.')[0x0]);return _0x1aad65[_0xfedf('0x2d')]('.')[0x0];});};exports[_0xfedf('0x3e')]=function(_0x1ee5fe,_0x4392d0){var _0x60e26c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1966a9,_0x1ced30;var _0xb986a5;var _0x38ceba={'encoding':_0xfedf('0x3f'),'method':_0xfedf('0x36'),'timeout':0x2710,'url':_0x60e26c,'headers':{'Content-Type':_0xfedf('0x40')},'body':_0xfedf('0x41')+encodeURIComponent(JSON[_0xfedf('0x42')]([[['jQ1olc',JSON[_0xfedf('0x42')]([_0x1ee5fe,_0x4392d0||'en',![],'null']),null,_0xfedf('0x43')]]]))};return rp(_0x38ceba)[_0xfedf('0x2a')](function(_0x1b4314){try{_0xb986a5=eval(_0x1b4314[_0xfedf('0x44')](0x5))[0x0][0x2];}catch(_0x37614d){throw new Error(_0xfedf('0x45')+_0x1b4314[_0xfedf('0x23')]);}if(!_0xb986a5){if(_0x1ee5fe[_0xfedf('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xfedf('0x47')+_0x4392d0+_0xfedf('0x48'));}}try{_0xb986a5=eval(_0xb986a5)[0x0];}catch(_0x1c2285){throw new Error(_0xfedf('0x45')+res['data']);}const _0x15ca35=_0xb986a5;_0x1966a9=path[_0xfedf('0x26')](__dirname,_0xfedf('0x27'),rs[_0xfedf('0x37')](0x4)+_0xfedf('0x38'));fs['writeFileSync'](_0x1966a9,_0xb986a5,{'encoding':_0xfedf('0x29')});_0x1ced30=path[_0xfedf('0x26')](__dirname,'tmp',rs[_0xfedf('0x37')](0x4)+_0xfedf('0x49'));return convertFile(_0x1966a9,_0x1ced30);})[_0xfedf('0x2a')](function(){try{fs[_0xfedf('0x2b')](_0x1966a9);fs[_0xfedf('0x2c')](_0x1ced30,_0xfedf('0x3c'));}catch(_0x56a8dd){logger[_0xfedf('0x15')](_0x56a8dd);}logger[_0xfedf('0x1b')](_0xfedf('0x4a'),_0x1ced30[_0xfedf('0x2d')]('.')[0x0]);return _0x1ced30['split']('.')[0x0];});};exports['googleASR']=function(_0x5c227d,_0xe0982,_0x455018){return google[_0xfedf('0x4b')](_0x5c227d,_0xe0982,_0x455018)['then'](function(_0x1c3e90){logger[_0xfedf('0x1b')](_0x1c3e90[_0xfedf('0x4c')]);return rp(_0x1c3e90);})[_0xfedf('0x2a')](function(_0x90177e){var _0x423484='';var _0xc1651d=0x0;try{fs[_0xfedf('0x2b')](_0x5c227d);}catch(_0x13778d){logger[_0xfedf('0x15')](_0x13778d);}if(_0x90177e&&_0x90177e[_0xfedf('0x4d')]){_0x423484=_0x90177e[_0xfedf('0x4d')][_0xfedf('0x4e')](function(_0x929adf){return _0x929adf&&_0x929adf['alternatives'][0x0]&&_0x929adf[_0xfedf('0x4f')][0x0][_0xfedf('0x50')]?_0x929adf[_0xfedf('0x4f')][0x0][_0xfedf('0x50')]:'';})[_0xfedf('0x51')]('\x0a');_0xc1651d=_0x90177e[_0xfedf('0x4d')]['map'](function(_0x37fa47){return _0x37fa47&&_0x37fa47[_0xfedf('0x4f')][0x0]&&_0x37fa47['alternatives'][0x0]['confidence']?_0x37fa47['alternatives'][0x0][_0xfedf('0x52')]:0x0;})[_0xfedf('0x51')]('\x0a');}logger[_0xfedf('0x1b')]('googleASR\x20transcription',_0x423484);logger['info'](_0xfedf('0x53'),_0xc1651d);return{'transcript':_0x423484,'confidence':_0xc1651d};})[_0xfedf('0x54')](function(_0x85cdc3){logger['error'](_0xfedf('0x55'),_0x85cdc3[_0xfedf('0x14')],_0x85cdc3[_0xfedf('0x56')],_0x85cdc3[_0xfedf('0x57')]);});};exports[_0xfedf('0x58')]=function(_0x334f18,_0x20e882,_0x2a7ec9,_0x1a4efd){var _0x4fbba8=apiai(_0x20e882,{'language':_0x1a4efd||'en'});return _0x4fbba8['textRequest'](_0x2a7ec9,{'sessionId':md5(_0x334f18)})[_0xfedf('0x2a')](function(_0x81ba66){logger[_0xfedf('0x1b')](JSON[_0xfedf('0x42')](_0x81ba66));return{'source':_0x81ba66[_0xfedf('0x59')][_0xfedf('0x5a')],'resolvedQuery':_0x81ba66[_0xfedf('0x59')]['resolvedQuery'],'action':_0x81ba66[_0xfedf('0x59')][_0xfedf('0x5b')],'actionIncomplete':_0x81ba66['result'][_0xfedf('0x5c')],'speech':_0x81ba66['result'][_0xfedf('0x5d')]['speech'],'score':_0x81ba66[_0xfedf('0x59')][_0xfedf('0x5e')],'statusCode':_0x81ba66['status']['code'],'endConversation':_0x81ba66[_0xfedf('0x59')][_0xfedf('0x5f')]['endConversation']||![],'isFallbackIntent':_0x81ba66[_0xfedf('0x59')][_0xfedf('0x5f')][_0xfedf('0x60')]};});};exports[_0xfedf('0x61')]=function(_0x15a732,_0x2a6661,_0x2918ce,_0x538826,_0xf9b549,_0x15f6a7){var _0x180e60=_0x538826[_0xfedf('0x62')](/\\n/g,'\x0a');var _0x1b9fbb={'credentials':{'private_key':_0x180e60,'client_email':_0x2918ce}};var _0x53c438=new dialogflow[(_0xfedf('0x63'))](_0x1b9fbb);var _0x42be6d=_0x53c438[_0xfedf('0x64')](_0x2a6661,md5(_0x15a732));var _0x2cefae={'session':_0x42be6d,'queryInput':{'text':{'text':_0xf9b549,'languageCode':_0x15f6a7}}};return _0x53c438['detectIntent'](_0x2cefae)[_0xfedf('0x2a')](function(_0x1fd893){if(_0x1fd893&&_0x1fd893['length']){logger['info'](_0xfedf('0x65'),JSON[_0xfedf('0x42')](_0x1fd893));var _0x5cd8b9=_0x1fd893[0x0];if(_0x5cd8b9){var _0x275ca9={'action':_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x5b')],'allRequiredParamsPresent':_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x67')],'endConversation':_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x68')]&&_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x68')][_0xfedf('0x69')]?_0x5cd8b9['queryResult']['diagnosticInfo']['fields'][_0xfedf('0x6a')]['boolValue']:![],'fulfillmentText':_0x5cd8b9[_0xfedf('0x66')]['fulfillmentText'],'intentName':_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x6b')]['name'],'intentDisplayName':_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x6b')][_0xfedf('0x6c')],'isFallbackIntent':_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x6b')][_0xfedf('0x6d')],'languageCode':_0x5cd8b9['queryResult'][_0xfedf('0x6e')],'queryText':_0x5cd8b9[_0xfedf('0x66')]['queryText'],'responseId':_0x5cd8b9[_0xfedf('0x6f')],'score':_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x70')],'speech':_0x5cd8b9[_0xfedf('0x66')][_0xfedf('0x71')],'providerResponse':JSON[_0xfedf('0x42')](_0x1fd893)};return _0x275ca9;}}});};exports['tildeASR']=function(_0x130b38,_0x50ee1e,_0xfbaee6,_0x59716e){return tilde[_0xfedf('0x4b')](_0x130b38,_0x50ee1e,_0xfbaee6,_0x59716e)['then'](function(_0x42c10e){try{fs[_0xfedf('0x2b')](_0x130b38);}catch(_0x502d9a){logger[_0xfedf('0x15')](_0x502d9a);}logger['info']('Tilde\x20ASR\x20transcription',_0x42c10e[_0xfedf('0x50')]);logger[_0xfedf('0x1b')](_0xfedf('0x72'),_0x42c10e[_0xfedf('0x52')]);return _0x42c10e;});};exports[_0xfedf('0x73')]=function(_0x4f69f5,_0x580cfd,_0x13b251,_0x5c00fc,_0x147ec3,_0x41c9d5){var _0x4ac470=path[_0xfedf('0x26')](__dirname,_0xfedf('0x27'),rs[_0xfedf('0x37')](0x4)+_0xfedf('0x38'));var _0x425fcb;return aws[_0xfedf('0x74')](_0x4f69f5,_0x580cfd,_0x13b251,_0x5c00fc,_0x147ec3,_0x41c9d5,_0x4ac470)[_0xfedf('0x2a')](function(){_0x425fcb=path[_0xfedf('0x26')](__dirname,_0xfedf('0x27'),rs[_0xfedf('0x37')](0x4)+'.wav');return convertFile(_0x4ac470,_0x425fcb);})[_0xfedf('0x2a')](function(){try{fs['unlink'](_0x4ac470);fs[_0xfedf('0x2c')](_0x425fcb,_0xfedf('0x3c'));}catch(_0x406d63){logger[_0xfedf('0x15')](_0x406d63);}return _0x425fcb[_0xfedf('0x2d')]('.')[0x0];});};exports[_0xfedf('0x75')]=function(_0x54f860,_0x2f9a48,_0x38c51a,_0x337393,_0x5561b3,_0x466b93){return aws[_0xfedf('0x76')](_0x54f860,_0x2f9a48,_0x38c51a,_0x337393,_0x5561b3,_0x466b93)['then'](function(_0x28d198){logger[_0xfedf('0x1b')](JSON[_0xfedf('0x42')](_0x28d198));return _0x28d198;});};exports[_0xfedf('0x77')]=function(_0x4e5fdb,_0xe9db2c,_0x10a365,_0x53ef0f){var _0x5c6b30=util['format'](_0xfedf('0x78'),ISPEECH_API,_0x4e5fdb,encodeURIComponent(_0xe9db2c),_0x10a365,_0x53ef0f);var _0x1a1f1b=path[_0xfedf('0x26')](__dirname,_0xfedf('0x27'),rs['generate'](0x4)+_0xfedf('0x38'));var _0x21e9e2;return downloadFile(_0x5c6b30,_0x1a1f1b)[_0xfedf('0x2a')](function(){_0x21e9e2=path[_0xfedf('0x26')](__dirname,_0xfedf('0x27'),rs[_0xfedf('0x37')](0x4)+_0xfedf('0x49'));return convertFile(_0x1a1f1b,_0x21e9e2);})[_0xfedf('0x2a')](function(){try{fs['unlink'](_0x1a1f1b);fs['chmodSync'](_0x21e9e2,_0xfedf('0x3c'));}catch(_0x28e31b){logger['error'](_0x28e31b);}return _0x21e9e2[_0xfedf('0x2d')]('.')[0x0];});};exports[_0xfedf('0x79')]=function(_0xa254c5,_0x108cb9,_0x52b040,_0xc2fb84){var _0x544dca=util[_0xfedf('0x7a')](_0xfedf('0x7b'),ISPEECH_API,_0x108cb9,_0x52b040,base64Encode(_0xa254c5),_0xc2fb84?util[_0xfedf('0x7a')](_0xfedf('0x7c'),encodeURIComponent(_0xc2fb84)):_0xfedf('0x7d'));return uploadFile(_0x544dca)[_0xfedf('0x2a')](function(_0x57cf81){return querystring['parse'](_0x57cf81);});};exports[_0xfedf('0x7e')]=function(_0x3af0f7,_0x2a0d8f){return sestek[_0xfedf('0x7f')](_0x3af0f7,_0x2a0d8f)['then'](function(_0x3f5c7c){logger['info'](JSON['stringify'](_0x3f5c7c));var _0x519057={'speech':_0x3f5c7c[_0xfedf('0x80')],'action':_0x3f5c7c[_0xfedf('0x81')]?_0x3f5c7c['channelData'][_0xfedf('0x82')]:undefined,'actiondata':_0x3f5c7c['channelData']?_0x3f5c7c[_0xfedf('0x81')][_0xfedf('0x83')]:undefined};if(_0x3f5c7c['channelData']&&_0x3f5c7c[_0xfedf('0x81')]['AudioFromTts']){return base64Decode(_0x3f5c7c[_0xfedf('0x81')][_0xfedf('0x84')][_0xfedf('0x85')],path[_0xfedf('0x26')](__dirname,_0xfedf('0x27'),rs['generate'](0x4)+'.wav'))[_0xfedf('0x2a')](function(_0x2eca43){_0x519057[_0xfedf('0x86')]=_0x2eca43;return _0x519057;});}return _0x519057;});};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 610287a..f605a3a 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 _0x5a2d=['exports','./nda'];(function(_0xb53fb1,_0x58a815){var _0x5579b5=function(_0x2d8572){while(--_0x2d8572){_0xb53fb1['push'](_0xb53fb1['shift']());}};_0x5579b5(++_0x58a815);}(_0x5a2d,0xa9));var _0xd5a2=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x5a2d[_0x1aa049];return _0x357f29;};var nda=require(_0xd5a2('0x0'));module[_0xd5a2('0x1')]={'nda':nda}; \ No newline at end of file +var _0xad18=['./nda','exports'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0xad18,0x1b0));var _0x8ad1=function(_0x46aaea,_0x370790){_0x46aaea=_0x46aaea-0x0;var _0x2a7ee3=_0xad18[_0x46aaea];return _0x2a7ee3;};var nda=require(_0x8ad1('0x0'));module[_0x8ad1('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 3520933..31917fd 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 _0x2c6a=['audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','calleridname','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings'];(function(_0x2efb0d,_0x264636){var _0x475eda=function(_0x43c6b3){while(--_0x43c6b3){_0x2efb0d['push'](_0x2efb0d['shift']());}};_0x475eda(++_0x264636);}(_0x2c6a,0xa7));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xa2c6('0x0'));var url=require(_0xa2c6('0x1'));var logger=require(_0xa2c6('0x2'))(_0xa2c6('0x3'));module['exports']=function(_0x54904b,_0x1909fb){var _0x5cae61={'method':_0xa2c6('0x4'),'uri':url[_0xa2c6('0x5')](_0x1909fb[_0xa2c6('0x6')],_0xa2c6('0x7')),'form':{'grant_type':'password','username':_0x1909fb['username'],'password':_0x1909fb[_0xa2c6('0x8')]},'json':!![]};return rp(_0x5cae61)[_0xa2c6('0x9')](function(_0x3d1aa0){var _0x11aa17={'method':_0xa2c6('0x4'),'uri':url[_0xa2c6('0x5')](_0x1909fb[_0xa2c6('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1909fb[_0xa2c6('0xb')]||_0xa2c6('0xc'),'channelId':_0xa2c6('0xd'),'conversation':{'id':_0x54904b[_0xa2c6('0xe')]},'from':{'id':_0x54904b['callerid'],'name':_0x54904b[_0xa2c6('0xf')]},'recipient':{'id':_0x54904b['dnid'],'name':_0x54904b[_0xa2c6('0x10')]},'text':_0x1909fb[_0xa2c6('0x11')],'channelData':{}},'headers':{'Authorization':_0xa2c6('0x12')+_0x3d1aa0[_0xa2c6('0x13')]},'json':!![]};if(_0x1909fb['project']){_0x11aa17[_0xa2c6('0x14')][_0xa2c6('0x15')][_0xa2c6('0x16')]=_0x1909fb['project'];}if(_0x1909fb[_0xa2c6('0x17')]=='1'){_0x11aa17[_0xa2c6('0x14')][_0xa2c6('0x15')][_0xa2c6('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa2c6('0x19')};}if(_0x1909fb['custom_action']){_0x11aa17[_0xa2c6('0x14')][_0xa2c6('0x15')][_0xa2c6('0x1a')]=_0x1909fb[_0xa2c6('0x1b')];if(_0x1909fb[_0xa2c6('0x1c')]){_0x11aa17[_0xa2c6('0x14')]['channelData'][_0xa2c6('0x1d')]=_0x1909fb['custom_action_data'];}}logger[_0xa2c6('0x1e')](JSON[_0xa2c6('0x1f')](_0x11aa17));return rp(_0x11aa17);});}; \ No newline at end of file +var _0xa3b9=['custom_action_data','body','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','access_token','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action'];(function(_0x4425f0,_0x54173f){var _0x3a6c2f=function(_0x3e94ce){while(--_0x3e94ce){_0x4425f0['push'](_0x4425f0['shift']());}};_0x3a6c2f(++_0x54173f);}(_0xa3b9,0x112));var _0x9a3b=function(_0x475668,_0x3e740c){_0x475668=_0x475668-0x0;var _0x4bb776=_0xa3b9[_0x475668];return _0x4bb776;};'use strict';var rp=require(_0x9a3b('0x0'));var url=require(_0x9a3b('0x1'));var logger=require(_0x9a3b('0x2'))(_0x9a3b('0x3'));module[_0x9a3b('0x4')]=function(_0x2107db,_0x585f32){var _0x336367={'method':_0x9a3b('0x5'),'uri':url[_0x9a3b('0x6')](_0x585f32[_0x9a3b('0x7')],_0x9a3b('0x8')),'form':{'grant_type':'password','username':_0x585f32['username'],'password':_0x585f32[_0x9a3b('0x9')]},'json':!![]};return rp(_0x336367)[_0x9a3b('0xa')](function(_0x242fbe){var _0x2da1e2={'method':_0x9a3b('0x5'),'uri':url[_0x9a3b('0x6')](_0x585f32[_0x9a3b('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x585f32[_0x9a3b('0xc')]||_0x9a3b('0xd'),'channelId':_0x9a3b('0xe'),'conversation':{'id':_0x2107db[_0x9a3b('0xf')]},'from':{'id':_0x2107db['callerid'],'name':_0x2107db[_0x9a3b('0x10')]},'recipient':{'id':_0x2107db[_0x9a3b('0x11')],'name':_0x2107db[_0x9a3b('0x12')]},'text':_0x585f32['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x242fbe[_0x9a3b('0x13')]},'json':!![]};if(_0x585f32['project']){_0x2da1e2['body'][_0x9a3b('0x14')][_0x9a3b('0x15')]=_0x585f32['project'];}if(_0x585f32[_0x9a3b('0x16')]=='1'){_0x2da1e2['body'][_0x9a3b('0x14')][_0x9a3b('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9a3b('0x18')};}if(_0x585f32['custom_action']){_0x2da1e2['body'][_0x9a3b('0x14')]['CustomAction']=_0x585f32[_0x9a3b('0x19')];if(_0x585f32[_0x9a3b('0x1a')]){_0x2da1e2[_0x9a3b('0x1b')][_0x9a3b('0x14')][_0x9a3b('0x1c')]=_0x585f32['custom_action_data'];}}logger['info'](JSON[_0x9a3b('0x1d')](_0x2da1e2));return rp(_0x2da1e2);});}; \ 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 429de3b..42ee703 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 _0xdb4c=['./lib/api'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xdb4c,0xc0));var _0xcdb4=function(_0x1e9d33,_0x1c3e5e){_0x1e9d33=_0x1e9d33-0x0;var _0x149b05=_0xdb4c[_0x1e9d33];return _0x149b05;};'use strict';var asr=require(_0xcdb4('0x0'));module['exports']=function(_0x16a9fb,_0x1d8769,_0x17df5b,_0x2333b2){return asr(_0x16a9fb,_0x1d8769,_0x17df5b,_0x2333b2);}; \ No newline at end of file +var _0x611a=['exports','./lib/api'];(function(_0x4af5d5,_0x5989e5){var _0xd3beba=function(_0x13da70){while(--_0x13da70){_0x4af5d5['push'](_0x4af5d5['shift']());}};_0xd3beba(++_0x5989e5);}(_0x611a,0x19f));var _0xa611=function(_0x3329a1,_0x232322){_0x3329a1=_0x3329a1-0x0;var _0x552847=_0x611a[_0x3329a1];return _0x552847;};'use strict';var asr=require(_0xa611('0x0'));module[_0xa611('0x1')]=function(_0x5ef24f,_0x9e92ca,_0x5d63c8,_0xe59666){return asr(_0x5ef24f,_0x9e92ca,_0x5d63c8,_0xe59666);}; \ 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 1966139..136ce3f 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 _0xda61=['Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','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.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','lodash','crypto','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex'];(function(_0x51b169,_0x5efbc2){var _0x12605a=function(_0x570f5e){while(--_0x570f5e){_0x51b169['push'](_0x51b169['shift']());}};_0x12605a(++_0x5efbc2);}(_0xda61,0x197));var _0x1da6=function(_0x543bbb,_0x58b3a9){_0x543bbb=_0x543bbb-0x0;var _0x14dbb3=_0xda61[_0x543bbb];return _0x14dbb3;};'use strict';var BPromise=require('bluebird');var _=require(_0x1da6('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x1da6('0x1'));var logger=require('../../../../../../config/logger')(_0x1da6('0x2'));module[_0x1da6('0x3')]=function(_0x127246,_0x234588,_0x3daf00,_0x19819e){return new BPromise(function(_0x24c8dd,_0x2fbcc6){logger[_0x1da6('0x4')]('Tilde\x20URI',_0x19819e||_0x1da6('0x5'));var _0x3d039a=new WebSocket(_0x19819e||_0x1da6('0x5'),{'perMessageDeflate':![]});var _0x15eee7='';var _0x2ea9ef='0';var _0x25a531='1';var _0x31a617=_0x1da6('0x6');function _0x3f7230(_0x2e0c64){var _0x554649=crypto['createHash'](_0x1da6('0x7'));_0x554649[_0x1da6('0x8')](_0x2e0c64);return _0x554649[_0x1da6('0x9')](_0x1da6('0xa'));}function _0x239af3(){try{logger[_0x1da6('0x4')](_0x1da6('0xb'));var _0x3be5a0=moment()[_0x1da6('0xc')]();var _0x41a622=_0x3f7230(_0x3be5a0+_0x234588+_0x3daf00);_0x3d039a[_0x1da6('0xd')](JSON[_0x1da6('0xe')]({'appID':_0x234588,'timestamp':_0x3be5a0,'appKey':_0x41a622}));var _0x424f35=fs[_0x1da6('0xf')](_0x127246);_0x424f35['on']('data',function(_0x39a953){_0x3d039a[_0x1da6('0xd')](_0x39a953);});_0x424f35['on'](_0x1da6('0x10'),function(){_0x3d039a[_0x1da6('0xd')](_0x1da6('0x11'));});}catch(_0x32c946){logger[_0x1da6('0x12')](_0x1da6('0x13'),JSON['stringify'](_0x32c946));_0x3d039a[_0x1da6('0x14')]();}}function _0x48eb02(_0x3333bb){try{if(_0x3333bb){var _0x2ccee2=JSON[_0x1da6('0x15')](_0x3333bb);switch(_0x2ccee2[_0x1da6('0x16')]){case 0x0:if(_0x2ccee2[_0x1da6('0x17')]){if(_0x2ccee2[_0x1da6('0x17')][_0x1da6('0x18')]){logger['info'](_0x1da6('0x19'),JSON[_0x1da6('0xe')](_0x2ccee2[_0x1da6('0x17')][_0x1da6('0x1a')]));_0x15eee7=_0x2ccee2[_0x1da6('0x17')][_0x1da6('0x1a')][0x0][_0x1da6('0x1b')];_0x2ea9ef=_0x2ccee2[_0x1da6('0x17')]['hypotheses'][0x0][_0x1da6('0x1c')];_0x25a531='0';_0x31a617='Success.';_0x3d039a[_0x1da6('0x14')]();}}break;case 0x1:logger['info'](_0x1da6('0x6'));_0x25a531='1';_0x31a617=_0x1da6('0x6');break;case 0x2:logger[_0x1da6('0x4')](_0x1da6('0x1d'));_0x25a531='2';_0x31a617=_0x1da6('0x1d');break;case 0x9:logger[_0x1da6('0x4')](_0x1da6('0x1e'));_0x25a531='9';_0x31a617=_0x1da6('0x1e');break;case 0xa:logger[_0x1da6('0x4')](_0x1da6('0x1f'));_0x25a531='10';_0x31a617=_0x1da6('0x1f');break;case 0xb:logger[_0x1da6('0x4')](_0x1da6('0x20'));_0x25a531='11';_0x31a617=_0x1da6('0x20');}}}catch(_0x30babd){logger[_0x1da6('0x12')](_0x1da6('0x21'),JSON[_0x1da6('0xe')](_0x30babd));_0x3d039a[_0x1da6('0x14')]();}}function _0x4a7f76(){logger[_0x1da6('0x4')](_0x1da6('0x22'));_0x24c8dd({'transcript':_0x15eee7,'confidence':_0x2ea9ef,'status':_0x25a531,'status_message':_0x31a617});}function _0x103f4a(_0x3f5530){logger['error'](_0x1da6('0x23'));if(!_['isNil'](_0x3f5530)){logger[_0x1da6('0x12')](_[_0x1da6('0x24')](_0x3f5530)?JSON[_0x1da6('0xe')](_0x3f5530):_0x3f5530);}}_0x3d039a['on'](_0x1da6('0x25'),_0x239af3);_0x3d039a['on']('message',_0x48eb02);_0x3d039a['on'](_0x1da6('0x10'),_0x4a7f76);_0x3d039a['on'](_0x1da6('0x12'),_0x103f4a);});}; \ No newline at end of file +var _0x9841=['isObject','open','message','bluebird','crypto','../../../../../../config/logger','agi','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','Open\x20Tilde\x20ASR\x20socket','createReadStream','send','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','stringify','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0x40b0f,_0x3783e5){var _0x39a923=function(_0x1464b7){while(--_0x1464b7){_0x40b0f['push'](_0x40b0f['shift']());}};_0x39a923(++_0x3783e5);}(_0x9841,0x19a));var _0x1984=function(_0x49fd30,_0x22313f){_0x49fd30=_0x49fd30-0x0;var _0x4b704c=_0x9841[_0x49fd30];return _0x4b704c;};'use strict';var BPromise=require(_0x1984('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x1984('0x1'));var logger=require(_0x1984('0x2'))(_0x1984('0x3'));module['exports']=function(_0x2c3c2f,_0x392a74,_0x4b2ff1,_0x2eba30){return new BPromise(function(_0x4c3744,_0x4df9a5){logger[_0x1984('0x4')]('Tilde\x20URI',_0x2eba30||_0x1984('0x5'));var _0x146e07=new WebSocket(_0x2eba30||_0x1984('0x5'),{'perMessageDeflate':![]});var _0x296324='';var _0x342085='0';var _0x2a7a28='1';var _0x4a3ae3=_0x1984('0x6');function _0x4087ee(_0x29bcc7){var _0x1ef91c=crypto[_0x1984('0x7')]('sha1');_0x1ef91c[_0x1984('0x8')](_0x29bcc7);return _0x1ef91c[_0x1984('0x9')]('hex');}function _0x41711f(){try{logger[_0x1984('0x4')](_0x1984('0xa'));var _0x586eaf=moment()['unix']();var _0x4fb991=_0x4087ee(_0x586eaf+_0x392a74+_0x4b2ff1);_0x146e07['send'](JSON['stringify']({'appID':_0x392a74,'timestamp':_0x586eaf,'appKey':_0x4fb991}));var _0x2265a0=fs[_0x1984('0xb')](_0x2c3c2f);_0x2265a0['on']('data',function(_0x21a410){_0x146e07[_0x1984('0xc')](_0x21a410);});_0x2265a0['on']('close',function(){_0x146e07['send'](_0x1984('0xd'));});}catch(_0x1ba90c){logger[_0x1984('0xe')](_0x1984('0xf'),JSON['stringify'](_0x1ba90c));_0x146e07[_0x1984('0x10')]();}}function _0x34c26e(_0x4a3004){try{if(_0x4a3004){var _0xa4f77c=JSON[_0x1984('0x11')](_0x4a3004);switch(_0xa4f77c[_0x1984('0x12')]){case 0x0:if(_0xa4f77c[_0x1984('0x13')]){if(_0xa4f77c[_0x1984('0x13')][_0x1984('0x14')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x1984('0x15')](_0xa4f77c[_0x1984('0x13')][_0x1984('0x16')]));_0x296324=_0xa4f77c['result'][_0x1984('0x16')][0x0][_0x1984('0x17')];_0x342085=_0xa4f77c[_0x1984('0x13')][_0x1984('0x16')][0x0][_0x1984('0x18')];_0x2a7a28='0';_0x4a3ae3=_0x1984('0x19');_0x146e07[_0x1984('0x10')]();}}break;case 0x1:logger[_0x1984('0x4')](_0x1984('0x6'));_0x2a7a28='1';_0x4a3ae3=_0x1984('0x6');break;case 0x2:logger[_0x1984('0x4')](_0x1984('0x1a'));_0x2a7a28='2';_0x4a3ae3=_0x1984('0x1a');break;case 0x9:logger['info'](_0x1984('0x1b'));_0x2a7a28='9';_0x4a3ae3=_0x1984('0x1b');break;case 0xa:logger[_0x1984('0x4')](_0x1984('0x1c'));_0x2a7a28='10';_0x4a3ae3=_0x1984('0x1c');break;case 0xb:logger[_0x1984('0x4')](_0x1984('0x1d'));_0x2a7a28='11';_0x4a3ae3='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x28662e){logger[_0x1984('0xe')](_0x1984('0x1e'),JSON[_0x1984('0x15')](_0x28662e));_0x146e07['terminate']();}}function _0x5dd979(){logger[_0x1984('0x4')](_0x1984('0x1f'));_0x4c3744({'transcript':_0x296324,'confidence':_0x342085,'status':_0x2a7a28,'status_message':_0x4a3ae3});}function _0x169ee5(_0x5ca28a){logger[_0x1984('0xe')](_0x1984('0x20'));if(!_[_0x1984('0x21')](_0x5ca28a)){logger[_0x1984('0xe')](_[_0x1984('0x22')](_0x5ca28a)?JSON[_0x1984('0x15')](_0x5ca28a):_0x5ca28a);}}_0x146e07['on'](_0x1984('0x23'),_0x41711f);_0x146e07['on'](_0x1984('0x24'),_0x34c26e);_0x146e07['on']('close',_0x5dd979);_0x146e07['on'](_0x1984('0xe'),_0x169ee5);});}; \ 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 804094c..220e775 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 _0xb048=['./asr','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb048,0x160));var _0x8b04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb048[_0x321bb2];return _0x9c12ed;};var asr=require(_0x8b04('0x0'));module[_0x8b04('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa5d1=['./asr'];(function(_0x3e659f,_0x17abb3){var _0x32bc81=function(_0x41b1f6){while(--_0x41b1f6){_0x3e659f['push'](_0x3e659f['shift']());}};_0x32bc81(++_0x17abb3);}(_0xa5d1,0xc8));var _0x1a5d=function(_0x4a6cbb,_0x4d21be){_0x4a6cbb=_0x4a6cbb-0x0;var _0x562d6f=_0xa5d1[_0x4a6cbb];return _0x562d6f;};var asr=require(_0x1a5d('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 191495c..2c95d78 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x4baac8,_0x5f1dc7){var _0x56ebc5=function(_0x23d717){while(--_0x23d717){_0x4baac8['push'](_0x4baac8['shift']());}};_0x56ebc5(++_0x5f1dc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 95376fa..382a3f0 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 _0x7894=['audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','text','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','uri','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','result','maxRetry','sync','retry','noop','no\x20text\x20configured','exec','MRCPSynth','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','delay','add','minutes','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','query','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','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','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20is\x20unreachable','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','priority','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','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','opts','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','join','util','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','rpc','prototype','catch','getVoiceQueue','getVoiceQueueById','then','getSquareProject','name','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','en-US','MALE'];(function(_0x3de0d9,_0x2ccb8f){var _0x161cd9=function(_0x8e23e7){while(--_0x8e23e7){_0x3de0d9['push'](_0x3de0d9['shift']());}};_0x161cd9(++_0x2ccb8f);}(_0x7894,0x170));var _0x4789=function(_0x359c97,_0x3bf6a1){_0x359c97=_0x359c97-0x0;var _0x449d33=_0x7894[_0x359c97];return _0x449d33;};'use strict';var fs=require('fs');var util=require(_0x4789('0x0'));var _=require(_0x4789('0x1'));var sh=require(_0x4789('0x2'));var odbc=require(_0x4789('0x3'))();var rs=require(_0x4789('0x4'));var moment=require(_0x4789('0x5'));var Mustache=require('mustache');var rp=require(_0x4789('0x6'));var logger=require(_0x4789('0x7'))('agi');var config=require(_0x4789('0x8'));var shared=require(_0x4789('0x9'));var scripts=require(_0x4789('0xa'));var FILES_PATH=_0x4789('0xb');var recursiveMapAttributes=[_0x4789('0xc'),_0x4789('0xd')];var verticesWithRetry=[_0x4789('0xe'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x6dce84,_0x53a3af,_0x2e8038){this[_0x4789('0xf')]=_0x6dce84;this[_0x4789('0x10')]=_0x53a3af;this['mailRpc']=_0x2e8038;};AGIVertices[_0x4789('0x11')]['getVariable']=function(_0x231db9,_0x335f0f){this[_0x4789('0x10')]['getVariableById'](_0x231db9)['then'](function(_0x216c80){_0x335f0f(null,_0x216c80?_0x216c80['name']:![]);})[_0x4789('0x12')](function(_0x58743a){_0x335f0f(_0x58743a);});};AGIVertices[_0x4789('0x11')][_0x4789('0x13')]=function(_0x515a8d,_0x37a816){this['rpc'][_0x4789('0x14')](_0x515a8d)[_0x4789('0x15')](function(_0x5162bd){_0x37a816(null,_0x5162bd?_0x5162bd['name']:![]);})[_0x4789('0x12')](function(_0x364280){_0x37a816(_0x364280);});};AGIVertices['prototype'][_0x4789('0x16')]=function(_0x527656,_0x118f97){this[_0x4789('0x10')]['getSquareProjectById'](_0x527656)[_0x4789('0x15')](function(_0x5af7b3){_0x118f97(null,_0x5af7b3?_0x5af7b3[_0x4789('0x17')]:![]);})['catch'](function(_0x19dc59){_0x118f97(_0x19dc59);});};AGIVertices[_0x4789('0x11')]['getSquareOdbc']=function(_0x9034c9,_0x245f63){this[_0x4789('0x10')][_0x4789('0x18')](_0x9034c9)[_0x4789('0x15')](function(_0x3a707d){_0x245f63(null,_0x3a707d?_0x3a707d[_0x4789('0x19')]:![]);})[_0x4789('0x12')](function(_0x117a1c){_0x245f63(_0x117a1c);});};AGIVertices[_0x4789('0x11')][_0x4789('0x1a')]=function(_0x125285,_0x4f7ceb){this[_0x4789('0x10')][_0x4789('0x1b')](_0x125285)['then'](function(_0x20841e){_0x4f7ceb(null,_0x20841e?_0x20841e[_0x4789('0x17')]:![]);})['catch'](function(_0xff56dd){_0x4f7ceb(_0xff56dd);});};AGIVertices[_0x4789('0x11')]['getTrunk']=function(_0xd8601e,_0x50d00f){this[_0x4789('0x10')][_0x4789('0x1c')](_0xd8601e)[_0x4789('0x15')](function(_0x13a69c){_0x50d00f(null,_0x13a69c?_0x13a69c[_0x4789('0x17')]:![]);})[_0x4789('0x12')](function(_0x182958){_0x50d00f(_0x182958);});};AGIVertices[_0x4789('0x11')][_0x4789('0x1d')]=function(_0xaa1cbb,_0x29a4bb){var _0x33a7bb=this;this[_0x4789('0x10')][_0x4789('0x1e')](_0xaa1cbb)[_0x4789('0x15')](function(_0x3095a1){_0x29a4bb(null,_0x3095a1?_0x33a7bb[_0x4789('0x1f')](_0x3095a1[_0x4789('0x20')]):![]);})['catch'](function(_0x59de58){_0x29a4bb(_0x59de58);});};AGIVertices[_0x4789('0x11')]['getMailAccount']=function(_0x490ea3,_0x5894f8){this[_0x4789('0x10')][_0x4789('0x21')](_0x490ea3)[_0x4789('0x15')](function(_0x4547f7){_0x5894f8(null,_0x4547f7?_0x4547f7:![]);})[_0x4789('0x12')](function(_0x1f72ee){_0x5894f8(_0x1f72ee);});};AGIVertices[_0x4789('0x11')][_0x4789('0x22')]=function(_0x208469,_0x4cf167,_0x45e379){this[_0x4789('0x23')][_0x4789('0x22')](_0x208469,_0x4cf167)[_0x4789('0x15')](function(){_0x45e379(null);})[_0x4789('0x12')](function(_0x15660e){_0x45e379(_0x15660e);});};AGIVertices[_0x4789('0x11')][_0x4789('0x24')]=function(_0x33b4bb,_0x409af2){this[_0x4789('0x10')][_0x4789('0x25')](_0x33b4bb)[_0x4789('0x15')](function(_0x188b1b){if(_0x188b1b){if(_0x188b1b[_0x4789('0x26')]){_0x409af2(null,[_0x188b1b['interval']]);}else{_0x409af2(null,_[_0x4789('0x27')](_0x188b1b[_0x4789('0x28')],_0x4789('0x29')));}}else{_0x409af2(null,![]);}})[_0x4789('0x12')](function(_0x45785a){_0x409af2(_0x45785a);});};AGIVertices[_0x4789('0x11')][_0x4789('0x1f')]=function(_0x5486c6){return util[_0x4789('0x2a')](_0x4789('0x2b'),FILES_PATH,_0x5486c6);};AGIVertices['prototype']['getQueryOdbc']=function(_0x43ecc4,_0x430381,_0x24f47c){odbc[_0x4789('0x2c')](_0x43ecc4,function(_0x30fdd8){if(_0x30fdd8){logger[_0x4789('0x2d')](_0x4789('0x2e'),_0x30fdd8);_0x24f47c(_0x30fdd8);}else{logger['info']('ODBC\x20connection\x20successfully');odbc['query'](_0x430381,function(_0x2415e1,_0x105cea){if(_0x2415e1){logger[_0x4789('0x2f')](_0x4789('0x30'),_0x430381);_0x24f47c(_0x2415e1);}else{logger[_0x4789('0x2f')](_0x4789('0x31'),_0x430381);odbc[_0x4789('0x32')](function(_0x4bdd65){if(_0x4bdd65){logger[_0x4789('0x2d')](_0x4789('0x33'),_0x4bdd65);}_0x24f47c(null,_0x105cea);});}});}});};AGIVertices[_0x4789('0x11')]['getSmsAccount']=function(_0x3e7459,_0x19a986){this[_0x4789('0x10')][_0x4789('0x34')](_0x3e7459)[_0x4789('0x15')](function(_0x484354){_0x19a986(null,_0x484354?_0x484354:![]);})[_0x4789('0x12')](function(_0x522dd5){_0x19a986(_0x522dd5);});};AGIVertices[_0x4789('0x11')][_0x4789('0x35')]=function(_0x37b804,_0x21f7fd){this[_0x4789('0x10')]['createSmsMessage'](_0x37b804)[_0x4789('0x15')](function(_0x5356ae){_0x21f7fd(null,_0x5356ae);})[_0x4789('0x12')](function(_0xd43903){_0x21f7fd(_0xd43903);});};AGIVertices['prototype'][_0x4789('0x36')]=function(_0x4c30e8,_0x446713,_0x312872){this[_0x4789('0x10')][_0x4789('0x36')]({'uniqueid':this['channel'][_0x4789('0x37')],'node':_0x4c30e8[_0x4789('0x38')],'application':_0x4c30e8['agicommand'],'data':_0x446713||null,'project_name':this[_0x4789('0xf')][_0x4789('0x39')],'callerid':this[_0x4789('0xf')]['callerid']})['then'](function(_0x2620a5){if(_0x312872){_0x312872(null,_0x2620a5);}})['catch'](function(_0x3382eb){if(_0x312872){_0x312872(_0x3382eb);}});};AGIVertices['prototype'][_0x4789('0x3a')]=function(_0x91e8d,_0x147d09,_0x469aea,_0x43c349){this[_0x4789('0x10')][_0x4789('0x3a')]({'uniqueid':this['channel'][_0x4789('0x37')],'callerid':this[_0x4789('0xf')][_0x4789('0x3b')],'calleridname':this[_0x4789('0xf')][_0x4789('0x3c')],'context':this[_0x4789('0xf')][_0x4789('0x3d')],'extension':this[_0x4789('0xf')][_0x4789('0x3e')],'priority':this[_0x4789('0xf')]['priority'],'accountcode':this[_0x4789('0xf')][_0x4789('0x3f')],'dnid':this['channel'][_0x4789('0x40')],'projectName':this[_0x4789('0xf')][_0x4789('0x39')],'saveName':_0x147d09,'filename':_0x91e8d[_0x4789('0x41')]||_0x147d09,'savePath':_0x469aea})[_0x4789('0x15')](function(_0x4d0f56){_0x43c349(null,_0x4d0f56);})[_0x4789('0x12')](function(_0x2ec868){_0x43c349(_0x2ec868);});};AGIVertices[_0x4789('0x11')][_0x4789('0x42')]=function(_0x14c193,_0x2e206f,_0x2ae91d,_0x18b4f7,_0x1736e2){this[_0x4789('0x10')][_0x4789('0x42')]({'uniqueid':this['channel'][_0x4789('0x37')],'body':_0x14c193,'direction':_0x2e206f,'providerName':_0x2ae91d,'providerResponse':_0x18b4f7})[_0x4789('0x15')](function(_0x2e305b){if(_0x1736e2){_0x1736e2(null,_0x2e305b);}})[_0x4789('0x12')](function(_0x3a3d10){if(_0x1736e2){_0x1736e2(_0x3a3d10);}});};AGIVertices['prototype'][_0x4789('0x43')]=function(_0x5e6740,_0x5744bd){this[_0x4789('0x10')][_0x4789('0x43')]({'firstName':_[_0x4789('0x44')](_0x5e6740[_0x4789('0x17')])||_[_0x4789('0x45')](_0x5e6740[_0x4789('0x17')])?_0x4789('0x46')+Math[_0x4789('0x47')]():_0x5e6740['name'],'lastName':_[_0x4789('0x44')](_0x5e6740['lastName'])||_['isNil'](_0x5e6740[_0x4789('0x48')])?null:_0x5e6740['lastName'],'phone':_0x5e6740[_0x4789('0x49')],'ListId':_0x5e6740[_0x4789('0x4a')],'scheduledat':_0x5e6740[_0x4789('0x4b')],'callbackUniqueid':this['channel'][_0x4789('0x37')],'tags':'callback','description':_0x4789('0x4c')+_0x5e6740['scheduledAt'][_0x4789('0x4d')](),'priority':_0x5e6740[_0x4789('0x4e')]})[_0x4789('0x15')](function(_0x1f0610){_0x5744bd(null,_0x1f0610);})[_0x4789('0x12')](function(_0x62453c){_0x5744bd(_0x62453c);});};AGIVertices[_0x4789('0x11')][_0x4789('0x4f')]=function(_0x27cb96,_0x4901f2){this[_0x4789('0x10')]['getPauseById'](_0x27cb96)[_0x4789('0x15')](function(_0xa04ff5){_0x4901f2(null,_0xa04ff5?_0xa04ff5['name']:![]);})[_0x4789('0x12')](function(_0x1f247c){_0x4901f2(_0x1f247c);});};AGIVertices[_0x4789('0x11')][_0x4789('0x50')]=function(_0x33fdd3,_0x21ab9e,_0x2abbae){var _0x10cf2b={'role':_0x4789('0x51')};_0x10cf2b[_0x33fdd3]=this[_0x4789('0xf')][_0x4789('0x3b')];this[_0x4789('0x10')]['agentPause'](_0x10cf2b,_0x21ab9e,this['channel'][_0x4789('0x37')])['then'](function(_0x3fa9f2){_0x2abbae(null,_[_0x4789('0x45')](_0x3fa9f2)?![]:!![]);})[_0x4789('0x12')](function(_0x22820d){logger[_0x4789('0x2d')](_0x22820d);_0x2abbae(null,![]);});};AGIVertices[_0x4789('0x11')][_0x4789('0x52')]=function(_0x451bcd,_0x4ca8cf){var _0x16cd71={'role':_0x4789('0x51')};_0x16cd71[_0x451bcd]=this['channel'][_0x4789('0x3b')];this[_0x4789('0x10')][_0x4789('0x52')](_0x16cd71)[_0x4789('0x15')](function(_0x485521){_0x4ca8cf(null,_[_0x4789('0x45')](_0x485521)?![]:!![]);})['catch'](function(_0x4afba4){logger[_0x4789('0x2d')](_0x4afba4);_0x4ca8cf(null,![]);});};AGIVertices[_0x4789('0x11')][_0x4789('0x53')]=function(_0x3c0947,_0x1ffe59){var _0x38ba84={'role':_0x4789('0x51')};_0x38ba84[_0x3c0947]=this[_0x4789('0xf')][_0x4789('0x3b')];this[_0x4789('0x10')]['agentLogout'](_0x38ba84)[_0x4789('0x15')](function(_0x2f860d){_0x1ffe59(null,_[_0x4789('0x45')](_0x2f860d)?![]:!![]);})['catch'](function(_0x40d6a6){logger[_0x4789('0x2d')](_0x40d6a6);_0x1ffe59(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x57ffdb,_0xf5c2e3){var _0x5ba004={'role':_0x4789('0x51')};_0x5ba004[_0x57ffdb]=this[_0x4789('0xf')][_0x4789('0x3b')];var _0x56bcbb=_0x57ffdb!=_0x4789('0x54')?util[_0x4789('0x2a')]('%s/%s@from-sip/n','LOCAL',this[_0x4789('0xf')][_0x4789('0x3b')]):undefined;this['rpc'][_0x4789('0x55')](_0x5ba004,_0x56bcbb)['then'](function(_0x3457c1){_0xf5c2e3(null,_[_0x4789('0x45')](_0x3457c1)?![]:!![]);})[_0x4789('0x12')](function(_0x316c40){logger['error'](_0x316c40);_0xf5c2e3(null,![]);});};AGIVertices[_0x4789('0x11')][_0x4789('0x56')]=function(_0x327003,_0x9d5a36){sh['exec'](_[_0x4789('0x57')](_0x327003),function(_0x2f99ad,_0x8d827e){var _0x267021=_0x8d827e[_0x4789('0x58')](/(\r\n|\n|\r)/gm,'');_0x9d5a36(null,_0x267021);});};AGIVertices[_0x4789('0x11')][_0x4789('0x59')]=function(_0x392387,_0x165001){scripts[_0x4789('0x59')](_0x392387[_0x4789('0x5a')],_0x392387['google_cloud_tts_text_type']||'text',_0x392387['text'],_0x392387['languageCode']||_0x4789('0x5b'),_0x392387['ssmlGender']||_0x4789('0x5c'),_0x392387[_0x4789('0x5d')]||_0x4789('0x5e'))[_0x4789('0x15')](function(_0x3aa580){_0x165001(null,_0x3aa580);})[_0x4789('0x12')](function(_0x57f8a6){_0x165001(_0x57f8a6);});};AGIVertices[_0x4789('0x11')][_0x4789('0x5f')]=function(_0x444260,_0x424d72){scripts['googleTTS'](_0x444260['text'],_0x444260['google_tts_language']||'en',0x1)[_0x4789('0x15')](function(_0xdf9cba){_0x424d72(null,_0xdf9cba);})[_0x4789('0x12')](function(_0x1a2569){_0x424d72(_0x1a2569);});};AGIVertices[_0x4789('0x11')][_0x4789('0x60')]=function(_0x29104d,_0x154e0b){var _0x49ef89={'uri':_0x29104d[_0x4789('0x61')],'method':_0x29104d[_0x4789('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x29104d[_0x4789('0x63')])===_0x4789('0x64')&&parseInt(_0x29104d[_0x4789('0x63')])>=0x1?parseInt(_0x29104d[_0x4789('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x4789('0x65')]([_0x4789('0x66'),_0x4789('0x67')],_0x49ef89[_0x4789('0x62')][_0x4789('0x68')]())){try{_0x49ef89[_0x4789('0x69')]=_0x29104d[_0x4789('0xd')]?JSON['parse'](_0x29104d[_0x4789('0xd')]):{};}catch(_0x121ca3){logger[_0x4789('0x2d')](_0x4789('0x6a'),_0x121ca3);}}try{_0x49ef89[_0x4789('0x6b')]=_0x29104d[_0x4789('0xc')]?JSON[_0x4789('0x6c')](_0x29104d[_0x4789('0xc')]):{};}catch(_0x45bdc2){logger[_0x4789('0x2d')](_0x4789('0x6d'),_0x45bdc2);}if(_0x29104d['computedVariables']){try{var _0x234088=require(_0x29104d[_0x4789('0x6e')])['sync'](this,_0x49ef89);_0x49ef89['uri']=Mustache[_0x4789('0x6f')](_0x29104d[_0x4789('0x61')],_0x234088,{},['$$','$$']);if(_0x49ef89[_0x4789('0x6b')]){_0x49ef89[_0x4789('0x6b')]=JSON[_0x4789('0x6c')](Mustache['render'](JSON[_0x4789('0x70')](_0x49ef89[_0x4789('0x6b')]),_0x234088,{},['$$','$$']));}if(_0x49ef89[_0x4789('0x69')]){_0x49ef89[_0x4789('0x69')]=JSON[_0x4789('0x6c')](Mustache[_0x4789('0x6f')](JSON['stringify'](_0x49ef89['body']),_0x234088,{},['$$','$$']));}}catch(_0xa062c8){logger[_0x4789('0x2d')](_0x4789('0x71'),_0xa062c8);}}rp(_0x49ef89)[_0x4789('0x15')](function(_0x39e5cf){var _0x5dc404={'statusCode':_0x39e5cf[_0x4789('0x72')]||0xc8,'statusMessage':_0x39e5cf[_0x4789('0x73')]||'OK','headers':_0x39e5cf[_0x4789('0x6b')]||{},'body':_0x39e5cf[_0x4789('0x69')]||{}};_0x154e0b(null,_0x5dc404);})[_0x4789('0x12')](function(_0x5aa8ee){var _0x1d4319={'statusCode':_0x5aa8ee[_0x4789('0x72')]||0x1f4,'statusMessage':_0x5aa8ee[_0x4789('0x74')]||_0x4789('0x75'),'headers':_0x5aa8ee[_0x4789('0x76')][_0x4789('0x6b')]||{},'body':_0x5aa8ee[_0x4789('0x76')][_0x4789('0x69')]||{}};_0x154e0b(null,_0x1d4319);});};AGIVertices[_0x4789('0x11')]['googleDialogflow']=function(_0xfd3b6a,_0x1d4a0c){scripts['googleDialogflow'](this[_0x4789('0xf')][_0x4789('0x37')],_0xfd3b6a[_0x4789('0x77')],_0xfd3b6a[_0x4789('0x78')],_0xfd3b6a[_0x4789('0x79')]||'en')['then'](function(_0x2c6faf){_0x1d4a0c(null,_0x2c6faf);})['catch'](function(_0x5d3792){_0x1d4a0c(_0x5d3792);});};AGIVertices['prototype'][_0x4789('0x7a')]=function(_0x1dbaaf,_0x165995){scripts[_0x4789('0x7a')](this[_0x4789('0xf')][_0x4789('0x37')],_0x1dbaaf[_0x4789('0x7b')],_0x1dbaaf[_0x4789('0x7c')],_0x1dbaaf[_0x4789('0x7d')],_0x1dbaaf[_0x4789('0x78')],_0x1dbaaf[_0x4789('0x7e')]||'en')[_0x4789('0x15')](function(_0x3af7fc){_0x165995(null,_0x3af7fc);})[_0x4789('0x12')](function(_0x4522e7){_0x165995(_0x4522e7);});};AGIVertices['prototype'][_0x4789('0x7f')]=function(_0x3948ca,_0x3b62a2){scripts[_0x4789('0x7f')](this[_0x4789('0xf')],_0x3948ca)[_0x4789('0x15')](function(_0x1e0a52){_0x3b62a2(null,_0x1e0a52);})[_0x4789('0x12')](function(_0x373247){_0x3b62a2(_0x373247);});};AGIVertices[_0x4789('0x11')][_0x4789('0x80')]=function(_0x360d78,_0x35687b){scripts[_0x4789('0x80')](_0x360d78[_0x4789('0x77')],_0x360d78[_0x4789('0x78')],_0x360d78[_0x4789('0x81')]||_0x4789('0x5b'),_0x360d78[_0x4789('0x82')])[_0x4789('0x15')](function(_0x292204){_0x35687b(null,_0x292204);})[_0x4789('0x12')](function(_0x1aa2e3){_0x35687b(_0x1aa2e3);});};AGIVertices[_0x4789('0x11')][_0x4789('0x83')]=function(_0x4b33a6,_0x320109,_0x12e47d){scripts['ispeechASR'](_0x320109,_0x4b33a6[_0x4789('0x77')],_0x4b33a6['ispeech_asr_language']||_0x4789('0x5b'),this[_0x4789('0x84')](_0x4b33a6[_0x4789('0x85')])?_0x4b33a6['model']:undefined)['then'](function(_0x1c6f58){_0x12e47d(null,_0x1c6f58);})[_0x4789('0x12')](function(_0x254a4f){_0x12e47d(_0x254a4f);});};AGIVertices['prototype'][_0x4789('0x86')]=function(_0x18baf9,_0x272ff9){scripts['awsPolly'](_0x18baf9[_0x4789('0x87')],_0x18baf9[_0x4789('0x88')],_0x18baf9[_0x4789('0x89')],_0x18baf9[_0x4789('0x8a')]||_0x4789('0x8b'),_0x18baf9[_0x4789('0x78')],_0x18baf9[_0x4789('0x8c')]||_0x4789('0x78'))['then'](function(_0x9d5f82){_0x272ff9(null,_0x9d5f82);})[_0x4789('0x12')](function(_0x2ab7db){_0x272ff9(_0x2ab7db);});};AGIVertices[_0x4789('0x11')]['awsLex']=function(_0x291fcf,_0x50f053){scripts['awsLex'](this[_0x4789('0xf')][_0x4789('0x37')],_0x291fcf['aws_access_key_id'],_0x291fcf[_0x4789('0x88')],_0x291fcf[_0x4789('0x8d')],_0x291fcf['text'],_0x291fcf[_0x4789('0x8e')])[_0x4789('0x15')](function(_0x5aa1f9){_0x50f053(null,_0x5aa1f9);})[_0x4789('0x12')](function(_0x473394){_0x50f053(_0x473394);});};AGIVertices[_0x4789('0x11')][_0x4789('0x8f')]=function(_0xff015e,_0x3579d6,_0x3ced35){scripts['googleASR'](_0x3579d6,_0xff015e['key'],_0xff015e['google_asr_language']||'en-US')[_0x4789('0x15')](function(_0x5368c1){_0x3ced35(null,_0x5368c1);})['catch'](function(_0x24a933){_0x3ced35(_0x24a933);});};AGIVertices[_0x4789('0x11')][_0x4789('0x90')]=function(_0x24e6ab,_0x554044,_0x1eae09){scripts[_0x4789('0x90')](_0x554044,_0x24e6ab[_0x4789('0x91')],_0x24e6ab[_0x4789('0x92')],_0x24e6ab[_0x4789('0x93')])[_0x4789('0x15')](function(_0x530bf9){_0x1eae09(null,_0x530bf9);})[_0x4789('0x12')](function(_0x19c172){_0x1eae09(_0x19c172);});};AGIVertices[_0x4789('0x11')][_0x4789('0x94')]=function(_0x200e4f){var _0x13e2d7=_[_0x4789('0x65')](verticesWithRetry,_0x200e4f[_0x4789('0x95')])?_0x200e4f:_[_0x4789('0x96')](_0x200e4f);for(var _0x30f086 in _0x13e2d7){if(_0x13e2d7[_0x4789('0x97')](_0x30f086)){if(_0x13e2d7[_0x30f086]&&_['isString'](_0x13e2d7[_0x30f086])){if(_[_0x4789('0x65')](recursiveMapAttributes,_0x30f086)){_0x13e2d7[_0x30f086]=this[_0x4789('0x98')](_0x13e2d7[_0x30f086]);}else{_0x13e2d7[_0x30f086]=this['replaceAllVariables'](_0x13e2d7[_0x30f086]);}}}}return _0x13e2d7;};AGIVertices[_0x4789('0x11')][_0x4789('0x99')]=function(_0x33ec90){for(var _0x490d70 in _0x33ec90){if(_0x33ec90[_0x4789('0x97')](_0x490d70)){if(_[_0x4789('0x9a')](_0x33ec90[_0x490d70])){this[_0x4789('0x99')](_0x33ec90[_0x490d70]);}else if(_[_0x4789('0x9b')](_0x33ec90[_0x490d70])){for(var _0x1f097c=0x0;_0x1f097c<_0x33ec90[_0x490d70][_0x4789('0x9c')];_0x1f097c++){this[_0x4789('0x99')](_0x33ec90[_0x490d70][_0x1f097c]);}}else if(_[_0x4789('0x9d')](_0x33ec90[_0x490d70])){_0x33ec90[_0x490d70]=this[_0x4789('0x9e')](_0x33ec90[_0x490d70]);}}}};AGIVertices[_0x4789('0x11')][_0x4789('0x9f')]=function(_0x2b2ac2,_0x205c47){for(var _0x241e9f in _0x2b2ac2){if(_0x2b2ac2[_0x4789('0x97')](_0x241e9f)){if(_[_0x4789('0x9a')](_0x2b2ac2[_0x241e9f])){if(!_[_0x4789('0x44')](_0x2b2ac2[_0x241e9f])){this[_0x4789('0x9f')](_0x2b2ac2[_0x241e9f],util[_0x4789('0x2a')](_0x4789('0xa0'),_0x205c47,_0x241e9f));}}else if(_['isArray'](_0x2b2ac2[_0x241e9f])){for(var _0x3ff751=0x0;_0x3ff751<_0x2b2ac2[_0x241e9f][_0x4789('0x9c')];_0x3ff751++){this[_0x4789('0x9f')](_0x2b2ac2[_0x241e9f][_0x3ff751],util['format'](_0x4789('0xa0'),_0x205c47,_0x241e9f+'['+_0x3ff751+']'));}}else{if(!_['isNil'](_0x2b2ac2[_0x241e9f])){this[_0x4789('0xf')][_0x4789('0xa1')](util[_0x4789('0x2a')](_0x4789('0xa0'),_0x205c47,_0x241e9f),_0x2b2ac2[_0x241e9f]);}}}}};AGIVertices['prototype'][_0x4789('0x98')]=function(_0x2d4bbd){try{var _0xd6f74f=JSON[_0x4789('0x6c')](_0x2d4bbd);this['recursiveNodeIndex'](_0xd6f74f);return JSON[_0x4789('0x70')](_0xd6f74f);}catch(_0x5bcaa4){return this['replaceAllVariables'](_0x2d4bbd);}};AGIVertices['prototype'][_0x4789('0x9e')]=function(_0x27b3da){var _0x1acb98=_0x27b3da[_0x4789('0xa2')]('{');for(var _0x29c1b5=0x1;_0x29c1b5<_0x1acb98[_0x4789('0x9c')];_0x29c1b5+=0x1){var _0x4c90a2=_0x1acb98[_0x29c1b5][_0x4789('0xa2')]('}');if(_0x4c90a2['length']>0x1){_0x27b3da=_0x27b3da[_0x4789('0xa3')]('{'+_0x4c90a2[0x0]+'}',this[_0x4789('0xf')][_0x4789('0xa4')](_0x4c90a2[0x0])[_0x4789('0xa5')]||_0x4c90a2[0x0]);}}if(_0x1acb98[_0x4789('0x9c')]===0x1){return _0x27b3da[_0x4789('0x4d')]();}return this[_0x4789('0x9e')](_0x27b3da);};AGIVertices['prototype']['getAndSetVariable']=function(_0x3d4c60,_0x568186){var _0x14d05e=this[_0x4789('0xf')][_0x4789('0xa4')](_0x3d4c60);if(_0x14d05e[_0x4789('0xa6')]===-0x1){return _0x14d05e;}logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x568186,_0x14d05e[_0x4789('0xa5')]));return this[_0x4789('0xf')]['setVariable'](_0x568186,_0x14d05e[_0x4789('0xa5')]);};AGIVertices[_0x4789('0x11')][_0x4789('0x84')]=function(_0x1ee600){return _0x1ee600&&_0x1ee600!=='0'&&_0x1ee600!=='-1'&&_0x1ee600!=='';};AGIVertices['prototype'][_0x4789('0xa7')]=function(_0x5cda88){this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x5cda88,'-');_0x5cda88[_0x4789('0xa9')]=_0x5cda88['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x3ed9e6){logger[_0x4789('0x2f')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x3ed9e6['label']));if(!this['isConfigured'](_0x3ed9e6[_0x4789('0x78')])){return this['channel'][_0x4789('0xaa')](_0x4789('0xab'));}var _0x1c287c='\x22'+_0x3ed9e6['text']+'\x22';if(this[_0x4789('0x84')](_0x3ed9e6[_0x4789('0x76')])){_0x1c287c+=','+_0x3ed9e6['options'];}var _0x4921cb=this['channel'][_0x4789('0xac')](_0x4789('0xad'),_0x1c287c);if(_0x4921cb['result']===-0x1){return _0x4921cb;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1c287c));};AGIVertices[_0x4789('0x11')][_0x4789('0xae')]=function(_0xc0bc93){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0xc0bc93['label']));if(!this['isConfigured'](_0xc0bc93[_0x4789('0xaf')])){return this[_0x4789('0xf')]['noop'](_0x4789('0xb0'));}var _0x36bc2a=_0xc0bc93[_0x4789('0xaf')];if(this[_0x4789('0x84')](_0xc0bc93[_0x4789('0x76')])){_0x36bc2a+=','+_0xc0bc93[_0x4789('0x76')];}var _0x2b4e83=this['channel'][_0x4789('0xac')](_0x4789('0xb1'),_0x36bc2a);if(_0x2b4e83['result']===-0x1){return _0x2b4e83;}var _0x49819f=this[_0x4789('0xb2')]('RECOG_CONFIDENCE()',_0x4789('0xb3'));if(_0x49819f['result']===-0x1){return _0x49819f;}var _0x2df330=this[_0x4789('0xb2')](_0x4789('0xb4'),_0x4789('0xb5'));if(_0x2df330[_0x4789('0xa6')]===-0x1){return _0x2df330;}var _0x15bfd1=this[_0x4789('0xb2')](_0x4789('0xb6'),_0x4789('0xb7'));if(_0x15bfd1[_0x4789('0xa6')]===-0x1){return _0x15bfd1;}return this['channel']['noop'](util[_0x4789('0x2a')](_0x4789('0xb8'),_0x36bc2a));};AGIVertices[_0x4789('0x11')][_0x4789('0xb9')]=function(_0x32ad35){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x32ad35[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0xb9')]([_0x32ad35['command'],_0x32ad35[_0x4789('0xba')]]);};AGIVertices[_0x4789('0x11')][_0x4789('0xbb')]=function(_0xcff7c6){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0xbc'),_0xcff7c6[_0x4789('0x38')]));if(this[_0x4789('0x84')](_0xcff7c6['timeout'])){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0xbd'),_0xcff7c6[_0x4789('0x63')]));var _0xefba38=this[_0x4789('0xf')][_0x4789('0xbe')](_0xcff7c6['timeout']);if(_0xefba38[_0x4789('0xa6')]===-0x1){return _0xefba38;}}return this['channel'][_0x4789('0xbb')]();};AGIVertices['prototype'][_0x4789('0xbf')]=function(_0x1b9fb4){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x1b9fb4[_0x4789('0x38')]));if(!this['isConfigured'](_0x1b9fb4[_0x4789('0x4a')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x1b9fb4,'no\x20list\x20selected');}_0x1b9fb4[_0x4789('0x4b')]=moment();if(this[_0x4789('0x84')](_0x1b9fb4[_0x4789('0xc0')])){_0x1b9fb4[_0x4789('0x4b')]=moment()[_0x4789('0xc1')](_0x1b9fb4[_0x4789('0xc0')],_0x4789('0xc2'));}if(!this[_0x4789('0x84')](_0x1b9fb4['callback_priority'])){_0x1b9fb4[_0x4789('0x4e')]=0x2;}this[_0x4789('0x43')][_0x4789('0xa8')](this,_0x1b9fb4);return this[_0x4789('0xf')][_0x4789('0xaa')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1b9fb4[_0x4789('0x49')],_0x1b9fb4[_0x4789('0x4a')],_0x1b9fb4[_0x4789('0x4b')]));};AGIVertices[_0x4789('0x11')][_0x4789('0xc3')]=function(_0xc6076b){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xc6076b['label']));var _0xa4e816=this[_0x4789('0xf')][_0x4789('0xac')](_0xc6076b[_0x4789('0xc4')],_0xc6076b[_0x4789('0x76')]);if(_0xa4e816[_0x4789('0xa6')]===-0x1){return _0xa4e816;}return this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xc5'),_0xc6076b[_0x4789('0xc4')],_0xc6076b[_0x4789('0x76')]));};AGIVertices[_0x4789('0x11')][_0x4789('0xc6')]=function(_0x5e0c5f){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0xc7'),_0x5e0c5f['label']));if(!this[_0x4789('0x84')](_0x5e0c5f[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}var _0x2be8be='\x22'+_0x5e0c5f['text']+'\x22';if(this[_0x4789('0x84')](_0x5e0c5f[_0x4789('0x76')])){_0x2be8be+=','+_0x5e0c5f[_0x4789('0x76')];}var _0x217b60=this[_0x4789('0xf')][_0x4789('0xac')]('MRCPSynth',_0x2be8be);if(_0x217b60['result']===-0x1){return _0x217b60;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xc8'),_0x2be8be));};AGIVertices[_0x4789('0x11')][_0x4789('0xc9')]=function(_0x59c422){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x59c422[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x59c422[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20text\x20configured');}var _0x22b466='\x22'+_0x59c422[_0x4789('0x78')]+'\x22';if(this[_0x4789('0x84')](_0x59c422[_0x4789('0x76')])){_0x22b466+=','+_0x59c422[_0x4789('0x76')];}var _0x3c341b=this['channel'][_0x4789('0xac')](_0x4789('0xad'),_0x22b466);if(_0x3c341b[_0x4789('0xa6')]===-0x1){return _0x3c341b;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x22b466));};AGIVertices[_0x4789('0x11')][_0x4789('0xca')]=function(_0x5e92aa){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0xcb'),_0x5e92aa[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x5e92aa[_0x4789('0xaf')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xb0'));}var _0x5c64ca=_0x5e92aa['grammar'];if(this['isConfigured'](_0x5e92aa[_0x4789('0x76')])){_0x5c64ca+=','+_0x5e92aa['options'];}var _0x20bd4d=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0xb1'),_0x5c64ca);if(_0x20bd4d[_0x4789('0xa6')]===-0x1){return _0x20bd4d;}var _0x1b2ff5=this[_0x4789('0xb2')](_0x4789('0xcc'),_0x4789('0xcd'));if(_0x1b2ff5[_0x4789('0xa6')]===-0x1){return _0x1b2ff5;}var _0x5e4376=this[_0x4789('0xb2')](_0x4789('0xb4'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x5e4376[_0x4789('0xa6')]===-0x1){return _0x5e4376;}var _0x3171e4=this[_0x4789('0xb2')](_0x4789('0xb6'),_0x4789('0xce'));if(_0x3171e4[_0x4789('0xa6')]===-0x1){return _0x3171e4;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xb8'),_0x5c64ca));};AGIVertices[_0x4789('0x11')][_0x4789('0xcf')]=function(_0x310db3){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x310db3[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x310db3[_0x4789('0xaf')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20grammar\x20configured');}var _0x272d92=_0x310db3[_0x4789('0xaf')];if(this[_0x4789('0x84')](_0x310db3['options'])){_0x272d92+=','+_0x310db3[_0x4789('0x76')];}var _0x4c84d9=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0xb1'),_0x272d92);if(_0x4c84d9['result']===-0x1){return _0x4c84d9;}var _0x11a357=this[_0x4789('0xb2')](_0x4789('0xcc'),_0x4789('0xd0'));if(_0x11a357[_0x4789('0xa6')]===-0x1){return _0x11a357;}var _0x3a5f40=this[_0x4789('0xb2')](_0x4789('0xb4'),'SESTEK_ASR_TRANSCRIPT');if(_0x3a5f40[_0x4789('0xa6')]===-0x1){return _0x3a5f40;}var _0x52691c=this[_0x4789('0xb2')](_0x4789('0xb6'),_0x4789('0xd1'));if(_0x52691c[_0x4789('0xa6')]===-0x1){return _0x52691c;}return this['channel']['noop'](util[_0x4789('0x2a')](_0x4789('0xb8'),_0x272d92));};AGIVertices[_0x4789('0x11')]['database']=function(_0x2b9ef2){logger[_0x4789('0x2f')](util['format'](_0x4789('0xd2'),_0x2b9ef2['label']));if(!this['isConfigured'](_0x2b9ef2[_0x4789('0xd3')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2b9ef2,'no\x20database\x20selected');}var _0x27abf2=this[_0x4789('0xd4')][_0x4789('0xa8')](this,_0x2b9ef2[_0x4789('0xd3')]);if(!_0x27abf2){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2b9ef2,'no\x20odbc\x20database\x20found');}if(!this[_0x4789('0x84')](_0x2b9ef2[_0x4789('0xd5')])){return this['channel']['error'](_0x2b9ef2,'no\x20query\x20configured');}var _0xe39997=_0x2b9ef2[_0x4789('0xd5')][_0x4789('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0xd6'),_0xe39997));var _0x5ddae1=this[_0x4789('0xd7')][_0x4789('0xa8')](this,_0x27abf2,_0xe39997);this[_0x4789('0x36')]['sync'](this,_0x2b9ef2,_0xe39997);if(!this[_0x4789('0x84')](_0x2b9ef2[_0x4789('0xd8')])){return this[_0x4789('0xf')]['noop'](_0x4789('0xd9'));}var _0x59794a=this[_0x4789('0xa4')][_0x4789('0xa8')](this,_0x2b9ef2[_0x4789('0xd8')]);if(!_0x59794a){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2b9ef2,_0x4789('0xda'));}var _0x200b96=this;_0x5ddae1[_0x4789('0xdb')](function(_0x89aebf,_0x317985){Object[_0x4789('0xdc')](_0x89aebf)['forEach'](function(_0x111ce7){_0x200b96[_0x4789('0xf')]['setVariable'](util[_0x4789('0x2a')]('%s[%s][%s]',_0x59794a,_0x317985,_0x111ce7),_0x89aebf[_0x111ce7]);});});this[_0x4789('0xf')][_0x4789('0xa1')](util[_0x4789('0x2a')]('%s_ROWS_COUNT',_0x59794a),_0x5ddae1[_0x4789('0x9c')]);return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xdd'),_0x59794a));};AGIVertices[_0x4789('0x11')][_0x4789('0xde')]=function(_0x30a5b2){logger['debug'](util[_0x4789('0x2a')](_0x4789('0xdf'),_0x30a5b2['label']));if(!this[_0x4789('0x84')](_0x30a5b2[_0x4789('0xe0')])){return this[_0x4789('0xf')]['error'](_0x30a5b2,_0x4789('0xe1'));}var _0x435d59=this[_0x4789('0x1a')][_0x4789('0xa8')](this,_0x30a5b2[_0x4789('0xe0')]);if(!_0x435d59){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x30a5b2,_0x4789('0xe2'));}var _0x8d0c95=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0xe3'),[util[_0x4789('0x2a')](_0x4789('0xe4'),_0x435d59),_0x30a5b2[_0x4789('0x63')],_0x30a5b2['opts'],_0x30a5b2[_0x4789('0x61')]]);if(_0x8d0c95[_0x4789('0xa6')]===-0x1){return _0x8d0c95;}return this[_0x4789('0xf')][_0x4789('0xaa')](util['format']('Executed\x20command\x20%s',_0x4789('0xe3')));};AGIVertices[_0x4789('0x11')]['dialogflow']=function(_0x4f6abc){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4f6abc[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x4f6abc[_0x4789('0x77')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xe5'));}if(!this[_0x4789('0x84')](_0x4f6abc[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20text\x20configured');}this['channel'][_0x4789('0xe6')]=!![];this['createSquareDetailsReport'](_0x4f6abc);this['createSquareMessage'](_0x4f6abc[_0x4789('0x78')],'in','','');this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xe7'),_0x4f6abc[_0x4789('0x78')]));var _0x55ffad=this['googleDialogflow'][_0x4789('0xa8')](this,_0x4f6abc);if(_0x55ffad){for(var _0x1c9103 in _0x55ffad){if(_0x55ffad['hasOwnProperty'](_0x1c9103)){this['channel'][_0x4789('0xa1')](util[_0x4789('0x2a')](_0x4789('0xe8'),_0x1c9103[_0x4789('0x68')]()),_0x55ffad[_0x1c9103]);}}this[_0x4789('0x42')](_0x55ffad['speech'],_0x4789('0xe9'),_0x4789('0xea'),'');return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xeb'),_0x55ffad['speech']));}return this[_0x4789('0xf')][_0x4789('0x2d')](_0x4f6abc,_0x4789('0xec'));};AGIVertices[_0x4789('0x11')][_0x4789('0xed')]=function(_0x5b23b1){logger['info'](util[_0x4789('0x2a')](_0x4789('0xee'),_0x5b23b1[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x5b23b1[_0x4789('0x7b')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xef'));}if(!this[_0x4789('0x84')](_0x5b23b1['client_email'])){return this[_0x4789('0xf')]['noop'](_0x4789('0xf0'));}if(!this['isConfigured'](_0x5b23b1[_0x4789('0x7d')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20private_key\x20configured');}if(!this[_0x4789('0x84')](_0x5b23b1[_0x4789('0x7e')])){return this['channel'][_0x4789('0xaa')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x5b23b1['text'])){return this[_0x4789('0xf')]['noop'](_0x4789('0xab'));}this['channel'][_0x4789('0xe6')]=!![];this['createSquareDetailsReport'](_0x5b23b1);this[_0x4789('0x42')](_0x5b23b1[_0x4789('0x78')],'in','','');this['channel']['noop'](util[_0x4789('0x2a')](_0x4789('0xf1'),_0x5b23b1[_0x4789('0x78')]));var _0x998edc=this['googleDialogflowV2'][_0x4789('0xa8')](this,_0x5b23b1);if(_0x998edc){for(var _0x55eb80 in _0x998edc){if(_0x998edc['hasOwnProperty'](_0x55eb80)){if(_0x55eb80!==_0x4789('0xf2')){this[_0x4789('0xf')][_0x4789('0xa1')](util['format'](_0x4789('0xe8'),_0x55eb80[_0x4789('0x68')]()),_0x998edc[_0x55eb80]);}}}this['createSquareMessage'](_0x998edc[_0x4789('0xf3')],_0x4789('0xe9'),_0x4789('0xed'),_0x998edc[_0x4789('0xf2')]);return this['channel'][_0x4789('0xaa')](util['format']('DialogflowV2\x20Result\x20%s',_0x998edc[_0x4789('0xf3')]));}return this['channel'][_0x4789('0x2d')](_0x5b23b1,_0x4789('0xf4'));};AGIVertices['prototype']['sesteknda']=function(_0x198330){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x198330[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x198330[_0x4789('0xf5')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x4789('0x84')](_0x198330[_0x4789('0xf6')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xf7'));}if(!this['isConfigured'](_0x198330[_0x4789('0xf8')])){return this[_0x4789('0xf')]['noop'](_0x4789('0xf9'));}if(!this[_0x4789('0x84')](_0x198330[_0x4789('0xfa')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}this[_0x4789('0xf')][_0x4789('0xe6')]=!![];this['createSquareDetailsReport'](_0x198330);this[_0x4789('0x42')](_0x198330[_0x4789('0x78')],'in','','');this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xfb'),_0x198330[_0x4789('0x78')]));var _0x3f3e6e=this[_0x4789('0x7f')]['sync'](this,_0x198330);if(_0x3f3e6e){for(var _0x6d1f38 in _0x3f3e6e){if(_0x3f3e6e[_0x4789('0x97')](_0x6d1f38)){this[_0x4789('0xf')]['setVariable'](util[_0x4789('0x2a')](_0x4789('0xfc'),_0x6d1f38[_0x4789('0x68')]()),_0x3f3e6e[_0x6d1f38]);}}this[_0x4789('0x42')](_0x3f3e6e[_0x4789('0xf3')],_0x4789('0xe9'),_0x4789('0xfd'),'');if(_0x3f3e6e[_0x4789('0xfe')]){this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0xff'),_0x3f3e6e['audiofile']));var _0x575ed2=this['channel'][_0x4789('0x100')](_0x3f3e6e[_0x4789('0xfe')]);try{fs['unlink'](_0x3f3e6e[_0x4789('0xfe')]+'.wav');}catch(_0x5ee945){logger['error'](_0x5ee945);}return _0x575ed2;}else{return this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x101'),_0x3f3e6e[_0x4789('0xf3')]));}}return this['channel']['error'](_0x198330,_0x4789('0x102'));};AGIVertices[_0x4789('0x11')]['end']=function(_0x7ebf30){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x7ebf30['label']));return this['channel'][_0x4789('0xaa')](_0x4789('0x103'));};AGIVertices[_0x4789('0x11')][_0x4789('0x104')]=function(_0x15349e){logger[_0x4789('0x2f')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x15349e[_0x4789('0x38')]));var _0xc242c0='';if(_0x15349e['trunk_id']){if(!this[_0x4789('0x84')](_0x15349e[_0x4789('0x105')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x15349e,_0x4789('0x106'));}else{var _0x1b82a9=parseInt(_0x15349e[_0x4789('0x105')],0xa);if(isNaN(_0x1b82a9)){_0xc242c0=_0x15349e[_0x4789('0x105')];}else{_0xc242c0=this[_0x4789('0x107')][_0x4789('0xa8')](this,_0x15349e[_0x4789('0x105')]);if(!_0xc242c0){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x15349e,'no\x20trunk\x20found');}}}}else if(_0x15349e[_0x4789('0x108')]){_0xc242c0=_0x15349e[_0x4789('0x108')];}else{return this[_0x4789('0xf')][_0x4789('0x2d')](_0x15349e,_0x4789('0x106'));}var _0x5529f9=this[_0x4789('0xf')]['exec'](_0x4789('0xe3'),[util[_0x4789('0x2a')]('SIP/%s/%s',_0xc242c0,_0x15349e[_0x4789('0x49')]),_0x15349e[_0x4789('0x63')],_0x15349e['opts'],_0x15349e[_0x4789('0x61')]]);if(_0x5529f9[_0x4789('0xa6')]===-0x1){return _0x5529f9;}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20%s',_0x4789('0xe3')));};AGIVertices['prototype'][_0x4789('0x109')]=function(_0x5163e0){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x10a'),_0x5163e0['label']));return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x109'));};AGIVertices[_0x4789('0x11')]['getdigits']=function(_0x3e3457){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3e3457[_0x4789('0x38')]));if(_0x3e3457['retry']===0x0){return this[_0x4789('0xa7')](_0x3e3457);}_0x3e3457['retry']-=0x1;if(!this['isConfigured'](_0x3e3457['file_id'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x3e3457,_0x4789('0x10b'));}var _0x367eb0=this[_0x4789('0x1d')]['sync'](this,_0x3e3457[_0x4789('0x10c')]);if(!_0x367eb0){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x3e3457,_0x4789('0x10d'));}if(!this[_0x4789('0x84')](_0x3e3457['variable_id'])){return this[_0x4789('0xf')][_0x4789('0x2d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x30db41=this[_0x4789('0xf')]['getData'](_0x367eb0,_0x3e3457['response'],_0x3e3457[_0x4789('0x10e')]);var _0x54faab=_0x30db41[_0x4789('0xa6')]?_0x30db41['result'][_0x4789('0x4d')]():'';logger[_0x4789('0x2f')](_0x4789('0x10f'),JSON['stringify'](_0x30db41));if(_0x30db41['result']===-0x1){this[_0x4789('0x36')]['sync'](this,_0x3e3457,_0x54faab);return _0x30db41;}else if(_0x30db41['extra']===_0x4789('0x63')){_0x30db41[_0x4789('0xa6')]=_0x54faab[_0x4789('0x9c')]>=parseInt(_0x3e3457[_0x4789('0x110')])?'x':'i';}else{_0x30db41['result']=_0x54faab['length']>=parseInt(_0x3e3457[_0x4789('0x110')])&&_0x54faab[_0x4789('0x9c')]<=parseInt(_0x3e3457[_0x4789('0x10e')])?'x':'i';}var _0x229d47=this[_0x4789('0xa4')]['sync'](this,_0x3e3457[_0x4789('0xd8')]);if(!_0x229d47){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x3e3457,'no\x20variable\x20found');}this[_0x4789('0xf')][_0x4789('0xa1')](_0x229d47,_0x54faab);if(this[_0x4789('0x84')](_0x3e3457[_0x4789('0x111')])){var _0x11bb05=parseInt(_0x3e3457[_0x4789('0x111')],0xa);var _0x1e100e=rs[_0x4789('0x112')]({'charset':'*','length':_0x11bb05});var _0x32c678=_0x54faab['length'];if(_0x32c678>0x0){if(_0x32c678>_0x11bb05){this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x3e3457,_0x3e3457[_0x4789('0x113')]===_0x4789('0x114')?_0x1e100e+_0x54faab[_0x4789('0x115')](_0x11bb05):_0x54faab[_0x4789('0x115')](0x0,_0x32c678-_0x11bb05)+_0x1e100e);}else{this['createSquareDetailsReport'][_0x4789('0xa8')](this,_0x3e3457,rs[_0x4789('0x112')]({'charset':'*','length':_0x32c678}));}}else{this['createSquareDetailsReport'][_0x4789('0xa8')](this,_0x3e3457,'');}}else{this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x3e3457,_0x54faab);}return _0x30db41;};AGIVertices[_0x4789('0x11')][_0x4789('0x116')]=function(_0x71810a){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x71810a[_0x4789('0x38')]));return this[_0x4789('0x117')](_0x71810a);};AGIVertices[_0x4789('0x11')][_0x4789('0x118')]=function(_0x59265a){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x119'),_0x59265a[_0x4789('0x38')]));this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x59265a,_0x59265a[_0x4789('0x11a')]);return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x11b'),_0x59265a[_0x4789('0x11a')]));};AGIVertices[_0x4789('0x11')]['awspolly']=function(_0x1b1af6){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x11c'),_0x1b1af6[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x1b1af6[_0x4789('0x87')])||!this['isConfigured'](_0x1b1af6[_0x4789('0x88')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x11d'));}if(!this[_0x4789('0x84')](_0x1b1af6[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x11e'),_0x1b1af6['text']));var _0x24b7df=this[_0x4789('0x86')][_0x4789('0xa8')](this,_0x1b1af6);if(_0x24b7df){this['channel']['noop'](util['format'](_0x4789('0x11f'),_0x24b7df));var _0x1ff03f=this[_0x4789('0xf')][_0x4789('0x100')](_0x24b7df);try{fs[_0x4789('0x120')](_0x24b7df+_0x4789('0x121'));}catch(_0x353a14){logger['error'](_0x353a14);}return _0x1ff03f;}return this['channel'][_0x4789('0x2d')](_0x1b1af6,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x4789('0x122')]=function(_0x4d897c){logger[_0x4789('0x2f')](util['format'](_0x4789('0x123'),_0x4d897c[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x4d897c[_0x4789('0x87')])||!this['isConfigured'](_0x4d897c['aws_secret_access_key'])){return this['channel'][_0x4789('0xaa')](_0x4789('0x11d'));}if(!this['isConfigured'](_0x4d897c[_0x4789('0x8e')])){return this[_0x4789('0xf')]['noop'](_0x4789('0x124'));}if(!this[_0x4789('0x84')](_0x4d897c[_0x4789('0x78')])){return this['channel'][_0x4789('0xaa')]('no\x20text\x20configured');}this[_0x4789('0xf')][_0x4789('0xe6')]=!![];this['createSquareDetailsReport'](_0x4d897c);this[_0x4789('0x42')](_0x4d897c[_0x4789('0x78')],'in','','');this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x125'),_0x4d897c[_0x4789('0x78')]));var _0x1cb930=this[_0x4789('0x126')][_0x4789('0xa8')](this,_0x4d897c);if(_0x1cb930){for(var _0x3af07a in _0x1cb930){if(_0x1cb930[_0x4789('0x97')](_0x3af07a)&&_[_0x4789('0x9d')](_0x1cb930[_0x3af07a])){this[_0x4789('0xf')]['setVariable'](util['format'](_0x4789('0x127'),_0x3af07a[_0x4789('0x68')]()),_0x1cb930[_0x3af07a]);}}if(_[_0x4789('0x45')](_0x1cb930[_0x4789('0x74')])){return this[_0x4789('0xf')][_0x4789('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x1cb930[_0x4789('0x74')],_0x4789('0xe9'),_0x4789('0x128'),'');return this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x129'),_0x1cb930[_0x4789('0x74')]));}}return this['channel'][_0x4789('0x2d')](_0x4d897c,_0x4789('0x12a'));};AGIVertices[_0x4789('0x11')][_0x4789('0x12b')]=function(_0xe260cd){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x12c'),_0xe260cd[_0x4789('0x38')],_0xe260cd[_0x4789('0x63')]));if(!this[_0x4789('0x84')](_0xe260cd[_0x4789('0x77')])){return this['channel'][_0x4789('0xaa')]('no\x20key\x20configured');}var _0x198b0e=_0x4789('0x12d');var _0x31d314=util[_0x4789('0x2a')](_0x4789('0x12e'),FILES_PATH,rs[_0x4789('0x112')](0x4));var _0x1f9055=util[_0x4789('0x2a')](_0x4789('0xa0'),_0x31d314,_0x198b0e);var _0x87df35=!![];if(_0xe260cd['beep']===_0x4789('0x12f')){_0x87df35=![];}var _0x27ba4c=this[_0x4789('0xf')][_0x4789('0x130')](_0x31d314,_0x198b0e,_0xe260cd[_0x4789('0x131')],_0xe260cd['timeout'],undefined,_0x87df35);if(_0x27ba4c[_0x4789('0xa6')]!==-0x1){this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x132'),_0x1f9055));var _0x105c4e=this[_0x4789('0x8f')][_0x4789('0xa8')](this,_0xe260cd,_0x1f9055);if(_0x105c4e){for(var _0x3c32fa in _0x105c4e){if(_0x105c4e['hasOwnProperty'](_0x3c32fa)){this['channel']['setVariable'](util[_0x4789('0x2a')](_0x4789('0x133'),_0x3c32fa['toUpperCase']()),_0x105c4e[_0x3c32fa]);}}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x134'),JSON['stringify'](_0x105c4e)));}}return _0x27ba4c;};AGIVertices[_0x4789('0x11')][_0x4789('0x135')]=function(_0x574934){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x136'),_0x574934[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x574934[_0x4789('0x91')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x137'));}if(!this['isConfigured'](_0x574934[_0x4789('0x92')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x138'));}var _0x5c6a13=_0x4789('0x12d');var _0x2f287f=util[_0x4789('0x2a')](_0x4789('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x4ee8c6=util[_0x4789('0x2a')](_0x4789('0xa0'),_0x2f287f,_0x5c6a13);var _0x123dcd=!![];if(_0x574934[_0x4789('0x139')]===_0x4789('0x12f')){_0x123dcd=![];}var _0x52d97b=this['channel']['recordFile'](_0x2f287f,_0x5c6a13,_0x574934[_0x4789('0x131')],_0x574934[_0x4789('0x63')],undefined,_0x123dcd);if(_0x52d97b[_0x4789('0xa6')]!==-0x1){this[_0x4789('0xf')]['noop'](util['format'](_0x4789('0x13a'),_0x4ee8c6));var _0x4413e3=this[_0x4789('0x90')][_0x4789('0xa8')](this,_0x574934,_0x4ee8c6);if(_0x4413e3){for(var _0x721e24 in _0x4413e3){if(_0x4413e3[_0x4789('0x97')](_0x721e24)){this['channel'][_0x4789('0xa1')](util['format'](_0x4789('0x13b'),_0x721e24[_0x4789('0x68')]()),_0x4413e3[_0x721e24]);}}return this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x13c'),JSON[_0x4789('0x70')](_0x4413e3)));}}return _0x52d97b;};AGIVertices[_0x4789('0x11')][_0x4789('0x13d')]=function(_0x5acb3c){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5acb3c[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0x13e')](_0x5acb3c[_0x4789('0x3d')],_0x5acb3c[_0x4789('0x3e')],_0x5acb3c[_0x4789('0x13f')]);};AGIVertices[_0x4789('0x11')]['gotoif']=function(_0x453814){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x140'),_0x453814['label']));if(!this[_0x4789('0x84')](_0x453814[_0x4789('0x141')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x453814,_0x4789('0x142'));}try{var _0x7ed925=eval(_0x453814['condition'])?_0x4789('0x143'):_0x4789('0x144');this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x145'),_0x453814[_0x4789('0x141')],_0x7ed925));return{'code':0xc8,'result':_0x7ed925};}catch(_0x45dd83){return{'code':0xc8,'result':_0x4789('0x144')};}};AGIVertices[_0x4789('0x11')][_0x4789('0x146')]=function(_0x105d2b){logger['info'](util[_0x4789('0x2a')](_0x4789('0x147'),_0x105d2b['label']));if(!this[_0x4789('0x84')](_0x105d2b[_0x4789('0x148')])){return this['channel'][_0x4789('0x2d')](_0x105d2b,_0x4789('0x149'));}var _0x199b67=this[_0x4789('0x24')][_0x4789('0xa8')](this,_0x105d2b['interval_id']);if(!_0x199b67){return this[_0x4789('0xf')]['error'](_0x105d2b,_0x4789('0x14a'));}for(var _0x5f40f8=0x0;_0x5f40f8<_0x199b67[_0x4789('0x9c')];_0x5f40f8+=0x1){var _0x315cde=this['channel'][_0x4789('0xa4')](util['format'](_0x4789('0x14b'),_0x199b67[_0x5f40f8]));if(_0x315cde[_0x4789('0xa6')]===-0x1){return _0x315cde;}logger[_0x4789('0x2f')](util['format'](_0x4789('0x14c'),_0x199b67[_0x5f40f8],_0x315cde[_0x4789('0xa5')]));if(_0x315cde[_0x4789('0xa5')]==='true'){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x14c'),_0x199b67[_0x5f40f8],_0x4789('0x143')));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('IFTIME\x20%s\x20%s',_0x199b67[_0x5f40f8],_0x4789('0x143')));return{'code':0xc8,'result':_0x4789('0x143')};}else{logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x14c'),_0x199b67[_0x5f40f8],_0x4789('0x144')));this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x14c'),_0x199b67[_0x5f40f8],_0x4789('0x144')));}}return{'code':0xc8,'result':_0x4789('0x144')};};AGIVertices['prototype'][_0x4789('0x14d')]=function(_0x10dc8d){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x14e'),_0x10dc8d[_0x4789('0x38')]));return this[_0x4789('0xf')]['hangup']();};AGIVertices[_0x4789('0x11')][_0x4789('0x14f')]=function(_0x5a78b0){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x150'),_0x5a78b0[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x5a78b0[_0x4789('0x77')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xe5'));}var _0x3977aa=_0x4789('0x12d');var _0x562b7b=util[_0x4789('0x2a')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1c15ce=util['format'](_0x4789('0xa0'),_0x562b7b,_0x3977aa);var _0x3a4829=!![];if(_0x5a78b0['beep']===_0x4789('0x12f')){_0x3a4829=![];}var _0x2dd24c=this[_0x4789('0xf')][_0x4789('0x130')](_0x562b7b,_0x3977aa,_0x5a78b0[_0x4789('0x131')],_0x5a78b0['timeout'],undefined,_0x3a4829);if(_0x2dd24c[_0x4789('0xa6')]!==-0x1){this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x151'),_0x1c15ce));var _0xeee4f9=this[_0x4789('0x83')][_0x4789('0xa8')](this,_0x5a78b0,_0x1c15ce);if(_0xeee4f9){for(var _0x17bcc4 in _0xeee4f9){if(_0xeee4f9[_0x4789('0x97')](_0x17bcc4)){this[_0x4789('0xf')][_0x4789('0xa1')](util[_0x4789('0x2a')](_0x4789('0x152'),_0x17bcc4[_0x4789('0x68')]()),_0xeee4f9[_0x17bcc4]);}}return this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x153'),JSON[_0x4789('0x70')](_0xeee4f9)));}}return _0x2dd24c;};AGIVertices[_0x4789('0x11')][_0x4789('0x154')]=function(_0x2143a9){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2143a9[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x2143a9[_0x4789('0x77')])){return this['channel'][_0x4789('0xaa')](_0x4789('0xe5'));}if(!this[_0x4789('0x84')](_0x2143a9[_0x4789('0x78')])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x155'),_0x2143a9['text']));var _0x1e03ec=this['ispeechTTS'][_0x4789('0xa8')](this,_0x2143a9);if(_0x1e03ec){this[_0x4789('0xf')]['noop'](util[_0x4789('0x2a')](_0x4789('0x151'),_0x1e03ec));var _0x391ec4=this['channel']['streamFile'](_0x1e03ec,_0x2143a9[_0x4789('0x131')]);try{fs[_0x4789('0x120')](_0x1e03ec+'.wav');}catch(_0x5590d4){logger[_0x4789('0x2d')](_0x5590d4);}return _0x391ec4;}return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2143a9,_0x4789('0x156'));};AGIVertices[_0x4789('0x11')][_0x4789('0x157')]=function(_0x1f4083){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1f4083[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x1f4083['findBy'])){return this['channel'][_0x4789('0x2d')](_0x1f4083,_0x4789('0x158'));}logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x159'),this['channel']['callerid'],_0x1f4083[_0x4789('0x15a')]));var _0x3f50ff=this[_0x4789('0x55')][_0x4789('0xa8')](this,_0x1f4083[_0x4789('0x15a')]);if(_0x3f50ff){logger['info'](util['format'](_0x4789('0x15b'),this['channel'][_0x4789('0x3b')],_0x1f4083[_0x4789('0x15a')]));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4789('0xf')][_0x4789('0x3b')],_0x1f4083[_0x4789('0x15a')]));return{'code':0xc8,'result':_0x4789('0x15c')};}else{logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4789('0xf')]['callerid'],_0x1f4083[_0x4789('0x15a')]));this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15d'),this[_0x4789('0xf')]['callerid'],_0x1f4083[_0x4789('0x15a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4789('0x11')]['logout']=function(_0xa3a49c){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x15e'),_0xa3a49c[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0xa3a49c[_0x4789('0x15a')])){return this[_0x4789('0xf')]['error'](_0xa3a49c,'no\x20find\x20by\x20configured');}logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x159'),this[_0x4789('0xf')]['callerid'],_0xa3a49c[_0x4789('0x15a')]));var _0x28f246=this[_0x4789('0x53')][_0x4789('0xa8')](this,_0xa3a49c[_0x4789('0x15a')]);if(_0x28f246){logger['info'](util[_0x4789('0x2a')](_0x4789('0x15b'),this[_0x4789('0xf')]['callerid'],_0xa3a49c[_0x4789('0x15a')]));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15b'),this['channel']['callerid'],_0xa3a49c[_0x4789('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x4789('0x2a')](_0x4789('0x15d'),this['channel'][_0x4789('0x3b')],_0xa3a49c[_0x4789('0x15a')]));this['channel']['noop'](util[_0x4789('0x2a')](_0x4789('0x15d'),this[_0x4789('0xf')][_0x4789('0x3b')],_0xa3a49c['findBy']));return{'code':0xc8,'result':_0x4789('0x15f')};}};AGIVertices[_0x4789('0x11')][_0x4789('0x160')]=function(_0x5e589f){logger['info'](util[_0x4789('0x2a')](_0x4789('0x161'),_0x5e589f['label']));if(!this[_0x4789('0x84')](_0x5e589f['operation'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x5e589f,'no\x20operation\x20configured');}this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x162'),_0x5e589f[_0x4789('0x163')]));var _0x52778e=eval(_0x5e589f[_0x4789('0x163')]);if(!this[_0x4789('0x84')](_0x5e589f[_0x4789('0xd8')])){return this[_0x4789('0xf')]['noop'](_0x4789('0xd9'));}var _0x2647be=this[_0x4789('0xa4')][_0x4789('0xa8')](this,_0x5e589f[_0x4789('0xd8')]);if(!_0x2647be){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x5e589f,'no\x20variable\x20found');}if(_[_0x4789('0x9b')](_0x52778e)){var _0x5f2fe8=this;_0x52778e[_0x4789('0xdb')](function(_0x1bec53,_0x4eb71f){_0x5f2fe8[_0x4789('0xf')]['setVariable'](util['format'](_0x4789('0x164'),_0x2647be,_0x4eb71f),_0x1bec53);});return this[_0x4789('0xf')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x2647be));}else{return this[_0x4789('0xf')][_0x4789('0xa1')](_0x2647be,_0x52778e);}};AGIVertices[_0x4789('0x11')][_0x4789('0xe')]=function(_0x36332e){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x36332e[_0x4789('0x38')]));if(_0x36332e['retry']===0x0){return this[_0x4789('0xa7')](_0x36332e);}_0x36332e[_0x4789('0xa9')]-=0x1;if(!this['isConfigured'](_0x36332e['file_id'])){return this['channel'][_0x4789('0x2d')](_0x36332e,_0x4789('0x10b'));}var _0x5baf76=this[_0x4789('0x1d')][_0x4789('0xa8')](this,_0x36332e[_0x4789('0x10c')]);if(!_0x5baf76){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x36332e,'no\x20file\x20audio\x20found');}var _0x45de9e=this[_0x4789('0xf')][_0x4789('0x165')](_0x5baf76,_0x36332e[_0x4789('0x166')],_0x36332e[_0x4789('0x167')]);var _0x5b6880=_0x45de9e[_0x4789('0xa6')];if(_0x45de9e['result']===-0x1){this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x36332e,'-1');return _0x45de9e;}else if(_0x45de9e[_0x4789('0xa5')]===_0x4789('0x63')){_0x45de9e[_0x4789('0xa6')]=_0x45de9e[_0x4789('0xa6')][_0x4789('0x9c')]>0x0?_0x45de9e[_0x4789('0xa6')]:'t';}else if(_[_0x4789('0x44')](_0x45de9e[_0x4789('0xa6')])){_0x45de9e['result']='#';_0x5b6880='#';}if(!this[_0x4789('0x84')](_0x36332e[_0x4789('0xd8')])){this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x53cdaf=this['getVariable'][_0x4789('0xa8')](this,_0x36332e[_0x4789('0xd8')]);if(!_0x53cdaf){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x36332e,_0x4789('0xda'));}this[_0x4789('0xf')]['setVariable'](_0x53cdaf,_0x5b6880);}this[_0x4789('0x36')]['sync'](this,_0x36332e,_0x5b6880);return _0x45de9e;};AGIVertices[_0x4789('0x11')]['noop']=function(_0x4334b9){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x168'),_0x4334b9[_0x4789('0x38')]));return this['channel']['noop'](_0x4334b9[_0x4789('0x169')]||_0x4334b9['label']);};AGIVertices[_0x4789('0x11')][_0x4789('0x16a')]=function(_0x234984){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x16b'),_0x234984['label']));if(!this[_0x4789('0x84')](_0x234984['findBy'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x234984,_0x4789('0x158'));}logger['info'](util[_0x4789('0x2a')](_0x4789('0x159'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x234984[_0x4789('0x15a')]));var _0x22b0ce=this[_0x4789('0x4f')][_0x4789('0xa8')](this,_0x234984['pause_id']);var _0x27455d=this['agentPause'][_0x4789('0xa8')](this,_0x234984[_0x4789('0x15a')],_0x22b0ce);if(_0x27455d){logger['info'](util[_0x4789('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4789('0xf')][_0x4789('0x3b')],_0x234984['findBy']));this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15b'),this['channel'][_0x4789('0x3b')],_0x234984['findBy']));return{'code':0xc8,'result':_0x4789('0x15c')};}else{logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x15d'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x234984[_0x4789('0x15a')]));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15b'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x234984['findBy']));return{'code':0xc8,'result':_0x4789('0x15f')};}};AGIVertices[_0x4789('0x11')][_0x4789('0x16c')]=function(_0x337e7a){logger[_0x4789('0x2f')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x337e7a[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x337e7a['file_id'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x337e7a,_0x4789('0x10b'));}var _0x28dca6=this[_0x4789('0x1d')][_0x4789('0xa8')](this,_0x337e7a[_0x4789('0x10c')]);if(!_0x28dca6){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x337e7a,_0x4789('0x10d'));}var _0x34911b=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0x16d'),[_0x28dca6,_0x337e7a['opts']]);if(_0x34911b[_0x4789('0xa6')]===-0x1){return _0x34911b;}return this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20%s\x20%s',_0x4789('0x16d'),_0x28dca6));};AGIVertices[_0x4789('0x11')][_0x4789('0x16e')]=function(_0x4b948f){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x16f'),_0x4b948f[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x4b948f[_0x4789('0x170')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x4b948f,_0x4789('0x171'));}var _0x1ae166='';var _0x2efcf7=parseInt(_0x4b948f['queue_id'],0xa);if(isNaN(_0x2efcf7)){_0x1ae166=_0x4b948f[_0x4789('0x170')];}else{_0x1ae166=this['getVoiceQueue'][_0x4789('0xa8')](this,_0x4b948f[_0x4789('0x170')]);if(!_0x1ae166){return this['channel'][_0x4789('0x2d')](_0x4b948f,_0x4789('0x172'));}}var _0x5096c2='';if(this[_0x4789('0x84')](_0x4b948f[_0x4789('0x10c')])){var _0x39d9a2=this['getSound'][_0x4789('0xa8')](this,_0x4b948f['file_id']);if(_0x39d9a2){_0x5096c2=_0x39d9a2;}}this[_0x4789('0x36')]['sync'](this,_0x4b948f,_0x1ae166);if(_0x4b948f[_0x4789('0x173')][_0x4789('0x174')]('x')<0x0){_0x4b948f[_0x4789('0x173')]+='x';}if(_0x4b948f[_0x4789('0x173')]['indexOf']('X')<0x0){_0x4b948f['opts']+='X';}this[_0x4789('0xf')][_0x4789('0xa1')](_0x4789('0x175'),_0x1ae166?_0x1ae166[_0x4789('0x176')]():'');var _0x5b53b9=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0x177'),[_0x1ae166,_0x4b948f[_0x4789('0x173')],_0x4b948f[_0x4789('0x61')],_0x5096c2,_0x4b948f[_0x4789('0x63')],_0x4b948f[_0x4789('0xb9')],_0x4b948f[_0x4789('0x178')],_0x4b948f[_0x4789('0x179')],'',_0x4b948f[_0x4789('0x17a')]]);if(_0x5b53b9['result']===-0x1){return _0x5b53b9;}return this[_0x4789('0xf')]['noop'](util[_0x4789('0x2a')](_0x4789('0xc5'),_0x4789('0x177'),_0x1ae166));};AGIVertices[_0x4789('0x11')][_0x4789('0x17b')]=function(_0x570cd2){logger[_0x4789('0x2f')](util['format'](_0x4789('0x17c'),_0x570cd2[_0x4789('0x38')]));var _0x4a8b02=_0x570cd2[_0x4789('0x17d')]||_0x4789('0x12d');var _0x48cf87=util['format'](_0x4789('0x17e'),this['channel']['uniqueid'],rs[_0x4789('0x112')](0x5));var _0x2826fe=util[_0x4789('0x2a')](_0x4789('0x17f'),FILES_PATH,_0x48cf87,_0x4a8b02);var _0xf15cb5=util['format'](_0x4789('0x12e'),FILES_PATH,_0x48cf87);this[_0x4789('0x3a')]['sync'](this,_0x570cd2,_0x48cf87,_0x2826fe);this[_0x4789('0xf')][_0x4789('0xa1')](_0x4789('0x180'),_0x48cf87);logger['info'](_0x4789('0x181'),_0xf15cb5,_0x4a8b02,_0x570cd2['escape_digits'],_0x570cd2[_0x4789('0x63')]);return this[_0x4789('0xf')]['recordFile'](_0xf15cb5,_0x4a8b02,_0x570cd2[_0x4789('0x182')],_0x570cd2[_0x4789('0x63')],undefined,!![]);};AGIVertices[_0x4789('0x11')]['restapi']=function(_0xa0d247){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xa0d247[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0xa0d247['url'])){return this[_0x4789('0xf')]['noop'](_0x4789('0x183'));}var _0x3f7fa3=this[_0x4789('0x60')][_0x4789('0xa8')](this,_0xa0d247);logger['info'](util[_0x4789('0x2a')]('Response:',util[_0x4789('0x184')](_0x3f7fa3,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xa0d247['variable_id'])){return this[_0x4789('0xf')]['noop'](_0x4789('0x185'));}var _0x137797=this[_0x4789('0xa4')][_0x4789('0xa8')](this,_0xa0d247[_0x4789('0xd8')]);if(!_0x137797){return this['channel'][_0x4789('0x2d')](_0xa0d247,_0x4789('0xda'));}this[_0x4789('0xf')][_0x4789('0xa1')](util[_0x4789('0x2a')](_0x4789('0x186'),_0x137797),_0x3f7fa3['statusCode']?_0x3f7fa3[_0x4789('0x72')]:_0x4789('0x187'));this[_0x4789('0xf')][_0x4789('0xa1')](util['format'](_0x4789('0x188'),_0x137797),_0x3f7fa3['statusMessage']?_0x3f7fa3['statusMessage']:'OK');if(_0x3f7fa3['body']){try{this[_0x4789('0x9f')](_0x3f7fa3[_0x4789('0x69')],_0x137797);}catch(_0x15afd9){logger['error'](util['format'](_0x4789('0x189'),_0x137797));}}return this[_0x4789('0xf')]['noop'](util['format']('variable\x20%s\x20set',_0x137797));};AGIVertices[_0x4789('0x11')][_0x4789('0x18a')]=function(_0x9c90da){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x18b'),_0x9c90da[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0x18c')](_0x9c90da[_0x4789('0x18d')][_0x4789('0x58')](/\s+/g,''),_0x9c90da[_0x4789('0x182')]);};AGIVertices[_0x4789('0x11')]['saynumber']=function(_0x35feea){logger['info'](util[_0x4789('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x35feea[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0x18e')](_0x35feea['number']['replace'](/\s+/g,''),_0x35feea['escape_digits']);};AGIVertices[_0x4789('0x11')][_0x4789('0x18f')]=function(_0x6feea6){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x6feea6[_0x4789('0x38')]));return this[_0x4789('0xf')][_0x4789('0x190')](_0x6feea6[_0x4789('0x78')],_0x6feea6[_0x4789('0x182')]);};AGIVertices[_0x4789('0x11')][_0x4789('0x191')]=function(_0x4a14e9){logger['info'](util[_0x4789('0x2a')](_0x4789('0x192'),_0x4a14e9[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x4a14e9[_0x4789('0x193')])){return this[_0x4789('0xf')]['noop'](_0x4789('0x194'));}var _0x1a160c=this[_0x4789('0x195')]['sync'](this,_0x4a14e9[_0x4789('0x193')]);if(!_0x1a160c||!_0x1a160c['Smtp']){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x4a14e9,_0x4789('0x196'));}var _0x43f73a={'from':util[_0x4789('0x2a')](_0x4789('0x197'),_0x1a160c[_0x4789('0x17')],_0x1a160c[_0x4789('0x198')]||_0x1a160c['Smtp']['user']),'to':_0x4a14e9['to']||'','cc':_0x4a14e9['cc']||'','bcc':_0x4a14e9[_0x4789('0x199')]||'','subject':_0x4a14e9[_0x4789('0x19a')],'html':_0x4a14e9[_0x4789('0x78')],'text':_0x4a14e9[_0x4789('0x78')]};if(this[_0x4789('0x84')](_0x4a14e9[_0x4789('0x19b')])){}logger[_0x4789('0x19c')]('sendMail\x20message',JSON[_0x4789('0x70')](_0x43f73a));this['createSquareDetailsReport'][_0x4789('0xa8')](this,_0x4a14e9,_0x4a14e9[_0x4789('0x193')]);this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x19d'),_0x1a160c[_0x4789('0x17')]));this[_0x4789('0x22')]['sync'](this,_0x1a160c[_0x4789('0x19e')],_0x43f73a);return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x19f'));};AGIVertices[_0x4789('0x11')][_0x4789('0x1a0')]=function(_0x363853){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x1a1'),_0x363853['label']));return this[_0x4789('0xf')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x4789('0x11')]['sendSMS']=function(_0x16ef3c){logger['info'](util[_0x4789('0x2a')](_0x4789('0x1a2'),_0x16ef3c[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x16ef3c[_0x4789('0x1a3')])){return this['channel'][_0x4789('0xaa')](_0x4789('0x1a4'));}var _0x31bc6c=this['getSmsAccount'][_0x4789('0xa8')](this,_0x16ef3c[_0x4789('0x1a3')]);if(!_0x31bc6c){return this['channel'][_0x4789('0x2d')](_0x16ef3c,_0x4789('0x1a5'));}var _0x2850d7={'body':_0x16ef3c['sms_text'],'phone':_0x16ef3c['to']||'','SmsAccountId':_0x31bc6c['id']};logger[_0x4789('0x19c')](_0x4789('0x1a6'),JSON[_0x4789('0x70')](_0x2850d7));this[_0x4789('0x36')]['sync'](this,_0x16ef3c,_0x16ef3c['sms_account_id']);this['channel'][_0x4789('0xaa')](util['format'](_0x4789('0x1a7'),_0x31bc6c['name']));this[_0x4789('0x35')]['sync'](this,_0x2850d7);return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x1a8'));};AGIVertices[_0x4789('0x11')][_0x4789('0x1a9')]=function(_0x405851){logger['info'](util[_0x4789('0x2a')](_0x4789('0x1aa'),_0x405851[_0x4789('0x38')]));if(!this['isConfigured'](_0x405851[_0x4789('0xd8')])){return this[_0x4789('0xf')]['error'](_0x405851,_0x4789('0x1ab'));}var _0x5ca924=this['getVariable'][_0x4789('0xa8')](this,_0x405851[_0x4789('0xd8')]);if(!_0x5ca924){return this['channel'][_0x4789('0x2d')](_0x405851,'no\x20variable\x20found');}return this[_0x4789('0xf')][_0x4789('0xa1')](_0x5ca924,_0x405851['variable_value']);};AGIVertices['prototype'][_0x4789('0x1ac')]=function(_0x1fdb2d){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1fdb2d[_0x4789('0x38')]));this['channel'][_0x4789('0xaa')](_0x4789('0x1ad'));if(_0x1fdb2d[_0x4789('0xbb')]===_0x4789('0x1ae')){this['channel']['noop'](_0x4789('0x1af'));return this[_0x4789('0xf')][_0x4789('0xbb')]();}return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x1b0'));};AGIVertices['prototype'][_0x4789('0x1b1')]=function(_0x2eed16){logger[_0x4789('0x2f')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2eed16[_0x4789('0x38')]));if(!this['isConfigured'](_0x2eed16[_0x4789('0x1b2')])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2eed16,'no\x20subproject\x20selected');}var _0x15d315=this[_0x4789('0x16')]['sync'](this,_0x2eed16[_0x4789('0x1b2')]);if(!this[_0x4789('0x84')](_0x15d315)){return this[_0x4789('0xf')]['error'](_0x2eed16,util[_0x4789('0x2a')](_0x4789('0x1b3'),_0x2eed16[_0x4789('0x1b2')]));}if(_0x15d315===this[_0x4789('0xf')][_0x4789('0x39')]){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x2eed16,_0x4789('0x1b4'));}this[_0x4789('0x36')][_0x4789('0xa8')](this,_0x2eed16,_0x15d315);var _0xea740e=this[_0x4789('0xf')][_0x4789('0xac')](_0x4789('0x1b5'),util[_0x4789('0x2a')](_0x4789('0x1b6'),config[_0x4789('0xb9')]['host']||_0x4789('0x1b7'),_0x15d315,this[_0x4789('0xf')][_0x4789('0x39')]));if(_0xea740e['result']===-0x1){return _0xea740e;}return this[_0x4789('0xf')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x4789('0x1b5'),_0x15d315));};AGIVertices['prototype'][_0x4789('0x1b8')]=function(_0x2154ac){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x1b9'),_0x2154ac[_0x4789('0x38')]));var _0x543ccd=this['shellCommand']['sync'](this,_0x2154ac[_0x4789('0x1ba')]);this['createSquareDetailsReport'][_0x4789('0xa8')](this,_0x2154ac,_0x2154ac[_0x4789('0x1ba')]);if(this['isConfigured'](_0x2154ac[_0x4789('0xd8')])){var _0x19dfc3=this[_0x4789('0xa4')][_0x4789('0xa8')](this,_0x2154ac[_0x4789('0xd8')]);if(_0x19dfc3){this[_0x4789('0xf')][_0x4789('0xa1')](_0x19dfc3,_0x543ccd);return this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2154ac[_0x4789('0x1ba')],_0x19dfc3));}}return this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x1bb'),_0x2154ac[_0x4789('0x1ba')]));};AGIVertices[_0x4789('0x11')][_0x4789('0x1bc')]=function(_0x524edb){logger['info'](util[_0x4789('0x2a')](_0x4789('0x1bd'),_0x524edb['label']));_0x524edb[_0x4789('0x78')]=_0x524edb[_0x4789('0x78')][_0x4789('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4789('0x84')](_0x524edb['apiKey'])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0x1be'));}if(!this[_0x4789('0x84')](_0x524edb['text'])){return this[_0x4789('0xf')][_0x4789('0xaa')]('no\x20text\x20configured');}this[_0x4789('0xf')][_0x4789('0xaa')](util['format'](_0x4789('0x1bf'),_0x524edb['text']));var _0x52e312=this[_0x4789('0x59')][_0x4789('0xa8')](this,_0x524edb);if(_0x52e312){this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x52e312));var _0x3d4f14=this[_0x4789('0xf')]['streamFile'](_0x52e312);try{fs[_0x4789('0x120')](_0x52e312+_0x4789('0x121'));}catch(_0x1083ae){logger[_0x4789('0x2d')](_0x1083ae);}return _0x3d4f14;}return this['channel'][_0x4789('0x2d')](_0x524edb,_0x4789('0x1c0'));};AGIVertices[_0x4789('0x11')][_0x4789('0x1c1')]=function(_0x36962d){logger['info'](util[_0x4789('0x2a')](_0x4789('0x1c2'),_0x36962d[_0x4789('0x38')]));_0x36962d[_0x4789('0x78')]=_0x36962d[_0x4789('0x78')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4789('0x84')](_0x36962d['text'])){return this[_0x4789('0xf')][_0x4789('0xaa')](_0x4789('0xab'));}this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x1c3'),_0x36962d[_0x4789('0x78')]));var _0x5d7a7f=this[_0x4789('0x5f')][_0x4789('0xa8')](this,_0x36962d);if(_0x5d7a7f){this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x1c4'),_0x5d7a7f));var _0x5e2cec=this[_0x4789('0xf')][_0x4789('0x100')](_0x5d7a7f);try{fs['unlink'](_0x5d7a7f+_0x4789('0x121'));}catch(_0x54a49a){logger[_0x4789('0x2d')](_0x54a49a);}return _0x5e2cec;}return this[_0x4789('0xf')][_0x4789('0x2d')](_0x36962d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4789('0x11')][_0x4789('0x1c5')]=function(_0x389021){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x1c6'),_0x389021['label']));if(!this['isConfigured'](_0x389021['findBy'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x389021,'no\x20find\x20by\x20configured');}logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x159'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x389021[_0x4789('0x15a')]));var _0x205ccc=this[_0x4789('0x52')]['sync'](this,_0x389021[_0x4789('0x15a')]);if(_0x205ccc){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4789('0xf')][_0x4789('0x3b')],_0x389021[_0x4789('0x15a')]));this['channel']['noop'](util['format'](_0x4789('0x15b'),this[_0x4789('0xf')][_0x4789('0x3b')],_0x389021[_0x4789('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x15d'),this['channel'][_0x4789('0x3b')],_0x389021[_0x4789('0x15a')]));this[_0x4789('0xf')][_0x4789('0xaa')](util[_0x4789('0x2a')](_0x4789('0x15d'),this['channel'][_0x4789('0x3b')],_0x389021['findBy']));return{'code':0xc8,'result':_0x4789('0x15f')};}};AGIVertices[_0x4789('0x11')][_0x4789('0x1c7')]=function(_0x5b9eb7){logger[_0x4789('0x2f')](util[_0x4789('0x2a')](_0x4789('0x1c8'),_0x5b9eb7['label']));var _0xc0d504=this['channel'][_0x4789('0xac')]('VOICEMAIL',[_0x5b9eb7[_0x4789('0x1c9')],_0x5b9eb7[_0x4789('0x76')]]);if(_0xc0d504[_0x4789('0xa6')]===-0x1){return _0xc0d504;}return this['channel'][_0x4789('0xaa')](util[_0x4789('0x2a')]('Executed\x20command\x20%s\x20%s',_0x4789('0x1ca'),_0x5b9eb7[_0x4789('0x1c9')]));};AGIVertices[_0x4789('0x11')][_0x4789('0x1cb')]=function(_0x462311){logger[_0x4789('0x2f')](util[_0x4789('0x2a')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x462311[_0x4789('0x38')]));if(!this[_0x4789('0x84')](_0x462311['variable_id'])){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x462311,_0x4789('0x1ab'));}var _0x7d3c63=this[_0x4789('0xa4')]['sync'](this,_0x462311['variable_id']);if(!_0x7d3c63){return this[_0x4789('0xf')][_0x4789('0x2d')](_0x462311,_0x4789('0xda'));}var _0x5d4b3c=this[_0x4789('0xf')][_0x4789('0xa4')](_0x7d3c63);return{'code':0xc8,'result':_0x5d4b3c[_0x4789('0xa5')]?_0x5d4b3c[_0x4789('0xa5')]:'-'};};String['prototype'][_0x4789('0xa3')]=function(_0x36a561,_0x253fa8){return this[_0x4789('0xa2')](_0x36a561)[_0x4789('0x1cc')](_0x253fa8);};module['exports']=AGIVertices; \ No newline at end of file +var _0xbff2=['Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','retry','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','stringify','mindigit','getVariable','hiddendigitsnum','hiddendigitspos','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','context','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','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','findBy','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','forEach','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','output','pause','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','user','bcc','template_id','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','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','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','success','voicemail','VOICEMAIL','mailbox','vswitch','replaceAll','join','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','rawBody','menu','getsecretdigits','prototype','getVariableById','then','catch','getVoiceQueue','rpc','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getUser','getUserById','name','getTrunk','getTrunkById','getSound','getSoundById','getMailAccount','sendMailMessage','mailRpc','getIntervals','IntervalId','map','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agentUnpause','agent','agentLogout','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','MALE','googleTTS','restAPI','url','method','number','includes','POST','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','headers','render','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','getAndSetVariable','result','extra','isConfigured','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth'];(function(_0x302b1b,_0x18c465){var _0x1e6bfc=function(_0x42d603){while(--_0x42d603){_0x302b1b['push'](_0x302b1b['shift']());}};_0x1e6bfc(++_0x18c465);}(_0xbff2,0x10e));var _0x2bff=function(_0x5d3f8b,_0x31cb48){_0x5d3f8b=_0x5d3f8b-0x0;var _0x291946=_0xbff2[_0x5d3f8b];return _0x291946;};'use strict';var fs=require('fs');var util=require(_0x2bff('0x0'));var _=require(_0x2bff('0x1'));var sh=require(_0x2bff('0x2'));var odbc=require(_0x2bff('0x3'))();var rs=require(_0x2bff('0x4'));var moment=require(_0x2bff('0x5'));var Mustache=require(_0x2bff('0x6'));var rp=require(_0x2bff('0x7'));var logger=require(_0x2bff('0x8'))('agi');var config=require(_0x2bff('0x9'));var shared=require(_0x2bff('0xa'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x2bff('0xb')];var verticesWithRetry=[_0x2bff('0xc'),'getdigits',_0x2bff('0xd')];var AGIVertices=function(_0x4f1ba7,_0x530547,_0x172498){this['channel']=_0x4f1ba7;this['rpc']=_0x530547;this['mailRpc']=_0x172498;};AGIVertices[_0x2bff('0xe')]['getVariable']=function(_0x24c83f,_0x115745){this['rpc'][_0x2bff('0xf')](_0x24c83f)[_0x2bff('0x10')](function(_0x4a53a2){_0x115745(null,_0x4a53a2?_0x4a53a2['name']:![]);})[_0x2bff('0x11')](function(_0x2ff7ec){_0x115745(_0x2ff7ec);});};AGIVertices['prototype'][_0x2bff('0x12')]=function(_0x2af98f,_0x48f9f8){this[_0x2bff('0x13')][_0x2bff('0x14')](_0x2af98f)[_0x2bff('0x10')](function(_0x46a93c){_0x48f9f8(null,_0x46a93c?_0x46a93c['name']:![]);})[_0x2bff('0x11')](function(_0x348105){_0x48f9f8(_0x348105);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x15')]=function(_0x1074f8,_0x3fd79e){this['rpc'][_0x2bff('0x16')](_0x1074f8)[_0x2bff('0x10')](function(_0xf7b7b6){_0x3fd79e(null,_0xf7b7b6?_0xf7b7b6['name']:![]);})[_0x2bff('0x11')](function(_0x2fa1aa){_0x3fd79e(_0x2fa1aa);});};AGIVertices['prototype'][_0x2bff('0x17')]=function(_0x13406a,_0x415d0d){this['rpc']['getSquareOdbcById'](_0x13406a)[_0x2bff('0x10')](function(_0x1f3bd9){_0x415d0d(null,_0x1f3bd9?_0x1f3bd9['dsn']:![]);})[_0x2bff('0x11')](function(_0x49e763){_0x415d0d(_0x49e763);});};AGIVertices['prototype'][_0x2bff('0x18')]=function(_0x26c836,_0xd751ab){this[_0x2bff('0x13')][_0x2bff('0x19')](_0x26c836)[_0x2bff('0x10')](function(_0x33ab51){_0xd751ab(null,_0x33ab51?_0x33ab51[_0x2bff('0x1a')]:![]);})[_0x2bff('0x11')](function(_0x42c9c2){_0xd751ab(_0x42c9c2);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x1b')]=function(_0x567c09,_0x55648c){this[_0x2bff('0x13')][_0x2bff('0x1c')](_0x567c09)[_0x2bff('0x10')](function(_0x170a8f){_0x55648c(null,_0x170a8f?_0x170a8f['name']:![]);})[_0x2bff('0x11')](function(_0x59147b){_0x55648c(_0x59147b);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x1d')]=function(_0x551a59,_0x44c538){var _0x7feadf=this;this[_0x2bff('0x13')][_0x2bff('0x1e')](_0x551a59)[_0x2bff('0x10')](function(_0x354d1c){_0x44c538(null,_0x354d1c?_0x7feadf['getSoundPath'](_0x354d1c['save_name']):![]);})['catch'](function(_0x3e4b7e){_0x44c538(_0x3e4b7e);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x1f')]=function(_0x35eaf2,_0x3558e4){this['rpc']['getMailAccountById'](_0x35eaf2)['then'](function(_0x180aa6){_0x3558e4(null,_0x180aa6?_0x180aa6:![]);})['catch'](function(_0x56a1a3){_0x3558e4(_0x56a1a3);});};AGIVertices['prototype'][_0x2bff('0x20')]=function(_0x273acf,_0x339156,_0x255142){this[_0x2bff('0x21')][_0x2bff('0x20')](_0x273acf,_0x339156)[_0x2bff('0x10')](function(){_0x255142(null);})[_0x2bff('0x11')](function(_0x15c418){_0x255142(_0x15c418);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x22')]=function(_0xd30409,_0x3e3e45){this[_0x2bff('0x13')]['getIntervalById'](_0xd30409)[_0x2bff('0x10')](function(_0x17657c){if(_0x17657c){if(_0x17657c[_0x2bff('0x23')]){_0x3e3e45(null,[_0x17657c['interval']]);}else{_0x3e3e45(null,_[_0x2bff('0x24')](_0x17657c['Intervals'],_0x2bff('0x25')));}}else{_0x3e3e45(null,![]);}})[_0x2bff('0x11')](function(_0xec1cae){_0x3e3e45(_0xec1cae);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x26')]=function(_0x51e4c6){return util[_0x2bff('0x27')](_0x2bff('0x28'),FILES_PATH,_0x51e4c6);};AGIVertices[_0x2bff('0xe')][_0x2bff('0x29')]=function(_0x5c6b37,_0x212075,_0x56fb88){odbc['open'](_0x5c6b37,function(_0x337590){if(_0x337590){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x337590);_0x56fb88(_0x337590);}else{logger[_0x2bff('0x2a')](_0x2bff('0x2b'));odbc[_0x2bff('0x2c')](_0x212075,function(_0x25e2cc,_0x4b3aee){if(_0x25e2cc){logger[_0x2bff('0x2a')](_0x2bff('0x2d'),_0x212075);_0x56fb88(_0x25e2cc);}else{logger[_0x2bff('0x2a')]('Query\x20executed\x20correctly\x20%s',_0x212075);odbc[_0x2bff('0x2e')](function(_0x2fbabe){if(_0x2fbabe){logger[_0x2bff('0x2f')](_0x2bff('0x30'),_0x2fbabe);}_0x56fb88(null,_0x4b3aee);});}});}});};AGIVertices['prototype'][_0x2bff('0x31')]=function(_0x42a764,_0x5f13b5){this[_0x2bff('0x13')][_0x2bff('0x32')](_0x42a764)[_0x2bff('0x10')](function(_0x2aaf13){_0x5f13b5(null,_0x2aaf13?_0x2aaf13:![]);})[_0x2bff('0x11')](function(_0x3cf218){_0x5f13b5(_0x3cf218);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x33')]=function(_0x2afbff,_0x3a9718){this[_0x2bff('0x13')][_0x2bff('0x33')](_0x2afbff)[_0x2bff('0x10')](function(_0x14939e){_0x3a9718(null,_0x14939e);})[_0x2bff('0x11')](function(_0x3cd61c){_0x3a9718(_0x3cd61c);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x34')]=function(_0x14be36,_0x1369a9,_0x390762){this['rpc'][_0x2bff('0x34')]({'uniqueid':this[_0x2bff('0x35')][_0x2bff('0x36')],'node':_0x14be36[_0x2bff('0x37')],'application':_0x14be36[_0x2bff('0x38')],'data':_0x1369a9||null,'project_name':this[_0x2bff('0x35')][_0x2bff('0x39')],'callerid':this[_0x2bff('0x35')][_0x2bff('0x3a')]})['then'](function(_0x59f1c1){if(_0x390762){_0x390762(null,_0x59f1c1);}})[_0x2bff('0x11')](function(_0xef146d){if(_0x390762){_0x390762(_0xef146d);}});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x3b')]=function(_0x5d4f94,_0x21e088,_0x8757e9,_0x19ef86){this[_0x2bff('0x13')][_0x2bff('0x3b')]({'uniqueid':this['channel'][_0x2bff('0x36')],'callerid':this['channel'][_0x2bff('0x3a')],'calleridname':this[_0x2bff('0x35')][_0x2bff('0x3c')],'context':this[_0x2bff('0x35')]['context'],'extension':this['channel']['extension'],'priority':this['channel'][_0x2bff('0x3d')],'accountcode':this[_0x2bff('0x35')][_0x2bff('0x3e')],'dnid':this['channel'][_0x2bff('0x3f')],'projectName':this[_0x2bff('0x35')][_0x2bff('0x39')],'saveName':_0x21e088,'filename':_0x5d4f94[_0x2bff('0x40')]||_0x21e088,'savePath':_0x8757e9})[_0x2bff('0x10')](function(_0x419f07){_0x19ef86(null,_0x419f07);})['catch'](function(_0x1c4e93){_0x19ef86(_0x1c4e93);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x41')]=function(_0xc44470,_0x293efb,_0x19d915,_0x463af2,_0x4d18cc){this[_0x2bff('0x13')]['createSquareMessage']({'uniqueid':this[_0x2bff('0x35')][_0x2bff('0x36')],'body':_0xc44470,'direction':_0x293efb,'providerName':_0x19d915,'providerResponse':_0x463af2})[_0x2bff('0x10')](function(_0x4d650c){if(_0x4d18cc){_0x4d18cc(null,_0x4d650c);}})[_0x2bff('0x11')](function(_0x4c82e7){if(_0x4d18cc){_0x4d18cc(_0x4c82e7);}});};AGIVertices['prototype'][_0x2bff('0x42')]=function(_0x298308,_0x41a8d4){this['rpc'][_0x2bff('0x42')]({'firstName':_['isEmpty'](_0x298308[_0x2bff('0x1a')])||_[_0x2bff('0x43')](_0x298308['name'])?'callback_'+Math[_0x2bff('0x44')]():_0x298308[_0x2bff('0x1a')],'lastName':_[_0x2bff('0x45')](_0x298308[_0x2bff('0x46')])||_[_0x2bff('0x43')](_0x298308['lastName'])?null:_0x298308[_0x2bff('0x46')],'phone':_0x298308[_0x2bff('0x47')],'ListId':_0x298308[_0x2bff('0x48')],'scheduledat':_0x298308[_0x2bff('0x49')],'callbackUniqueid':this['channel'][_0x2bff('0x36')],'tags':_0x2bff('0x4a'),'description':_0x2bff('0x4b')+_0x298308['scheduledAt'][_0x2bff('0x4c')](),'priority':_0x298308[_0x2bff('0x4d')]})['then'](function(_0x365970){_0x41a8d4(null,_0x365970);})[_0x2bff('0x11')](function(_0x476695){_0x41a8d4(_0x476695);});};AGIVertices['prototype']['getPause']=function(_0x2bbef7,_0x589844){this['rpc'][_0x2bff('0x4e')](_0x2bbef7)[_0x2bff('0x10')](function(_0x39f257){_0x589844(null,_0x39f257?_0x39f257['name']:![]);})[_0x2bff('0x11')](function(_0x84fda1){_0x589844(_0x84fda1);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x4f')]=function(_0x574bdc,_0x3e427a,_0x7f6fe1){var _0x28b91b={'role':'agent'};_0x28b91b[_0x574bdc]=this[_0x2bff('0x35')][_0x2bff('0x3a')];this[_0x2bff('0x13')]['agentPause'](_0x28b91b,_0x3e427a,this[_0x2bff('0x35')][_0x2bff('0x36')])[_0x2bff('0x10')](function(_0xf8ec43){_0x7f6fe1(null,_['isNil'](_0xf8ec43)?![]:!![]);})[_0x2bff('0x11')](function(_0x564642){logger['error'](_0x564642);_0x7f6fe1(null,![]);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x50')]=function(_0x2c0a05,_0x192d35){var _0x2df4d9={'role':_0x2bff('0x51')};_0x2df4d9[_0x2c0a05]=this[_0x2bff('0x35')][_0x2bff('0x3a')];this[_0x2bff('0x13')]['agentUnpause'](_0x2df4d9)['then'](function(_0x5db865){_0x192d35(null,_[_0x2bff('0x43')](_0x5db865)?![]:!![]);})['catch'](function(_0x3dab0d){logger['error'](_0x3dab0d);_0x192d35(null,![]);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x52')]=function(_0x18780d,_0xd5c726){var _0x428e7a={'role':_0x2bff('0x51')};_0x428e7a[_0x18780d]=this['channel']['callerid'];this['rpc'][_0x2bff('0x52')](_0x428e7a)[_0x2bff('0x10')](function(_0x4040a6){_0xd5c726(null,_[_0x2bff('0x43')](_0x4040a6)?![]:!![]);})[_0x2bff('0x11')](function(_0x3606a0){logger['error'](_0x3606a0);_0xd5c726(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x57b758,_0x40dd9f){var _0x4ff70c={'role':'agent'};_0x4ff70c[_0x57b758]=this['channel'][_0x2bff('0x3a')];var _0x33debc=_0x57b758!=_0x2bff('0x53')?util[_0x2bff('0x27')](_0x2bff('0x54'),_0x2bff('0x55'),this[_0x2bff('0x35')][_0x2bff('0x3a')]):undefined;this['rpc']['agentLogin'](_0x4ff70c,_0x33debc)[_0x2bff('0x10')](function(_0x3a4091){_0x40dd9f(null,_[_0x2bff('0x43')](_0x3a4091)?![]:!![]);})[_0x2bff('0x11')](function(_0x320b7f){logger[_0x2bff('0x2f')](_0x320b7f);_0x40dd9f(null,![]);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x56')]=function(_0x4b2085,_0x271d4c){sh[_0x2bff('0x57')](_['trim'](_0x4b2085),function(_0x2a143c,_0x44c634){var _0x9f1851=_0x44c634[_0x2bff('0x58')](/(\r\n|\n|\r)/gm,'');_0x271d4c(null,_0x9f1851);});};AGIVertices['prototype']['googleCloudTTS']=function(_0xc875b3,_0x2f8f93){scripts[_0x2bff('0x59')](_0xc875b3[_0x2bff('0x5a')],_0xc875b3[_0x2bff('0x5b')]||_0x2bff('0x5c'),_0xc875b3[_0x2bff('0x5c')],_0xc875b3['languageCode']||_0x2bff('0x5d'),_0xc875b3['ssmlGender']||_0x2bff('0x5e'),_0xc875b3['audioEncoding']||'MP3')[_0x2bff('0x10')](function(_0x3577f2){_0x2f8f93(null,_0x3577f2);})[_0x2bff('0x11')](function(_0x5346ee){_0x2f8f93(_0x5346ee);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x5f')]=function(_0x25ce6d,_0x63e850){scripts[_0x2bff('0x5f')](_0x25ce6d[_0x2bff('0x5c')],_0x25ce6d['google_tts_language']||'en',0x1)[_0x2bff('0x10')](function(_0x32fd7d){_0x63e850(null,_0x32fd7d);})[_0x2bff('0x11')](function(_0x47f859){_0x63e850(_0x47f859);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x60')]=function(_0x5d1d7a,_0x37d08f){var _0x586e82={'uri':_0x5d1d7a[_0x2bff('0x61')],'method':_0x5d1d7a[_0x2bff('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5d1d7a['timeout'])===_0x2bff('0x63')&&parseInt(_0x5d1d7a['timeout'])>=0x1?parseInt(_0x5d1d7a['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x2bff('0x64')]([_0x2bff('0x65'),'PUT'],_0x586e82[_0x2bff('0x62')][_0x2bff('0x66')]())){try{_0x586e82['body']=_0x5d1d7a['rawBody']?JSON[_0x2bff('0x67')](_0x5d1d7a['rawBody']):{};}catch(_0x5a3fd3){logger[_0x2bff('0x2f')](_0x2bff('0x68'),_0x5a3fd3);}}try{_0x586e82['headers']=_0x5d1d7a[_0x2bff('0x69')]?JSON[_0x2bff('0x67')](_0x5d1d7a[_0x2bff('0x69')]):{};}catch(_0x3de811){logger['error'](_0x2bff('0x6a'),_0x3de811);}if(_0x5d1d7a[_0x2bff('0x6b')]){try{var _0x2b609b=require(_0x5d1d7a[_0x2bff('0x6b')])[_0x2bff('0x6c')](this,_0x586e82);_0x586e82['uri']=Mustache['render'](_0x5d1d7a['url'],_0x2b609b,{},['$$','$$']);if(_0x586e82[_0x2bff('0x6d')]){_0x586e82['headers']=JSON[_0x2bff('0x67')](Mustache[_0x2bff('0x6e')](JSON['stringify'](_0x586e82[_0x2bff('0x6d')]),_0x2b609b,{},['$$','$$']));}if(_0x586e82[_0x2bff('0x6f')]){_0x586e82['body']=JSON[_0x2bff('0x67')](Mustache['render'](JSON['stringify'](_0x586e82[_0x2bff('0x6f')]),_0x2b609b,{},['$$','$$']));}}catch(_0x5b0fc0){logger['error'](_0x2bff('0x70'),_0x5b0fc0);}}rp(_0x586e82)[_0x2bff('0x10')](function(_0x82384b){var _0x495113={'statusCode':_0x82384b[_0x2bff('0x71')]||0xc8,'statusMessage':_0x82384b[_0x2bff('0x72')]||'OK','headers':_0x82384b['headers']||{},'body':_0x82384b[_0x2bff('0x6f')]||{}};_0x37d08f(null,_0x495113);})['catch'](function(_0x120a7e){var _0x24e736={'statusCode':_0x120a7e[_0x2bff('0x71')]||0x1f4,'statusMessage':_0x120a7e[_0x2bff('0x73')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x120a7e['options'][_0x2bff('0x6d')]||{},'body':_0x120a7e[_0x2bff('0x74')][_0x2bff('0x6f')]||{}};_0x37d08f(null,_0x24e736);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x75')]=function(_0x4c9b6,_0x442f47){scripts['googleDialogflow'](this[_0x2bff('0x35')][_0x2bff('0x36')],_0x4c9b6['key'],_0x4c9b6[_0x2bff('0x5c')],_0x4c9b6[_0x2bff('0x76')]||'en')[_0x2bff('0x10')](function(_0x399369){_0x442f47(null,_0x399369);})[_0x2bff('0x11')](function(_0x21753b){_0x442f47(_0x21753b);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x77')]=function(_0x97393,_0x572ba6){scripts[_0x2bff('0x77')](this['channel']['uniqueid'],_0x97393['dialogflowV2_project_id'],_0x97393[_0x2bff('0x78')],_0x97393['private_key'],_0x97393[_0x2bff('0x5c')],_0x97393[_0x2bff('0x79')]||'en')[_0x2bff('0x10')](function(_0x36fe82){_0x572ba6(null,_0x36fe82);})[_0x2bff('0x11')](function(_0x111d9c){_0x572ba6(_0x111d9c);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x7a')]=function(_0x4191a7,_0x3fb58f){scripts[_0x2bff('0x7a')](this[_0x2bff('0x35')],_0x4191a7)[_0x2bff('0x10')](function(_0x1c3da9){_0x3fb58f(null,_0x1c3da9);})[_0x2bff('0x11')](function(_0x598752){_0x3fb58f(_0x598752);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x7b')]=function(_0x46f850,_0xd62cb3){scripts[_0x2bff('0x7b')](_0x46f850[_0x2bff('0x7c')],_0x46f850['text'],_0x46f850[_0x2bff('0x7d')]||_0x2bff('0x5d'),_0x46f850['speed'])[_0x2bff('0x10')](function(_0x339aa4){_0xd62cb3(null,_0x339aa4);})['catch'](function(_0x4c7f03){_0xd62cb3(_0x4c7f03);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x7e')]=function(_0x3b08fb,_0x39b988,_0x3c6433){scripts[_0x2bff('0x7e')](_0x39b988,_0x3b08fb[_0x2bff('0x7c')],_0x3b08fb[_0x2bff('0x7f')]||_0x2bff('0x5d'),this['isConfigured'](_0x3b08fb[_0x2bff('0x80')])?_0x3b08fb[_0x2bff('0x80')]:undefined)[_0x2bff('0x10')](function(_0xc71d43){_0x3c6433(null,_0xc71d43);})[_0x2bff('0x11')](function(_0x400027){_0x3c6433(_0x400027);});};AGIVertices['prototype'][_0x2bff('0x81')]=function(_0x3df4c1,_0x886b2d){scripts[_0x2bff('0x81')](_0x3df4c1[_0x2bff('0x82')],_0x3df4c1[_0x2bff('0x83')],_0x3df4c1[_0x2bff('0x84')],_0x3df4c1['aws_polly_voice']||_0x2bff('0x85'),_0x3df4c1['text'],_0x3df4c1[_0x2bff('0x86')]||_0x2bff('0x5c'))['then'](function(_0x3cb156){_0x886b2d(null,_0x3cb156);})[_0x2bff('0x11')](function(_0x38af21){_0x886b2d(_0x38af21);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x87')]=function(_0x336382,_0x30ccfb){scripts[_0x2bff('0x87')](this[_0x2bff('0x35')][_0x2bff('0x36')],_0x336382['aws_access_key_id'],_0x336382[_0x2bff('0x83')],_0x336382[_0x2bff('0x88')],_0x336382[_0x2bff('0x5c')],_0x336382[_0x2bff('0x89')])['then'](function(_0x8d5695){_0x30ccfb(null,_0x8d5695);})[_0x2bff('0x11')](function(_0x92e93){_0x30ccfb(_0x92e93);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x8a')]=function(_0x5920ad,_0x4ca62a,_0x1ea76f){scripts[_0x2bff('0x8a')](_0x4ca62a,_0x5920ad['key'],_0x5920ad[_0x2bff('0x8b')]||_0x2bff('0x5d'))[_0x2bff('0x10')](function(_0xea7742){_0x1ea76f(null,_0xea7742);})['catch'](function(_0x2bd923){_0x1ea76f(_0x2bd923);});};AGIVertices['prototype']['tildeASR']=function(_0x41cb22,_0x13a872,_0x55e66b){scripts[_0x2bff('0x8c')](_0x13a872,_0x41cb22[_0x2bff('0x8d')],_0x41cb22[_0x2bff('0x8e')],_0x41cb22[_0x2bff('0x8f')])[_0x2bff('0x10')](function(_0x109e5b){_0x55e66b(null,_0x109e5b);})[_0x2bff('0x11')](function(_0x25dcdd){_0x55e66b(_0x25dcdd);});};AGIVertices[_0x2bff('0xe')][_0x2bff('0x90')]=function(_0xd0d2b0){var _0x438225=_[_0x2bff('0x64')](verticesWithRetry,_0xd0d2b0[_0x2bff('0x38')])?_0xd0d2b0:_[_0x2bff('0x91')](_0xd0d2b0);for(var _0xd24084 in _0x438225){if(_0x438225[_0x2bff('0x92')](_0xd24084)){if(_0x438225[_0xd24084]&&_[_0x2bff('0x93')](_0x438225[_0xd24084])){if(_['includes'](recursiveMapAttributes,_0xd24084)){_0x438225[_0xd24084]=this[_0x2bff('0x94')](_0x438225[_0xd24084]);}else{_0x438225[_0xd24084]=this[_0x2bff('0x95')](_0x438225[_0xd24084]);}}}}return _0x438225;};AGIVertices['prototype'][_0x2bff('0x96')]=function(_0x2d016b){for(var _0x57c58b in _0x2d016b){if(_0x2d016b[_0x2bff('0x92')](_0x57c58b)){if(_[_0x2bff('0x97')](_0x2d016b[_0x57c58b])){this['recursiveNodeIndex'](_0x2d016b[_0x57c58b]);}else if(_[_0x2bff('0x98')](_0x2d016b[_0x57c58b])){for(var _0x17c3bf=0x0;_0x17c3bf<_0x2d016b[_0x57c58b][_0x2bff('0x99')];_0x17c3bf++){this['recursiveNodeIndex'](_0x2d016b[_0x57c58b][_0x17c3bf]);}}else if(_[_0x2bff('0x93')](_0x2d016b[_0x57c58b])){_0x2d016b[_0x57c58b]=this['replaceAllVariables'](_0x2d016b[_0x57c58b]);}}}};AGIVertices[_0x2bff('0xe')]['saveRestApiResult']=function(_0x56709b,_0x50809a){for(var _0x3f73cc in _0x56709b){if(_0x56709b[_0x2bff('0x92')](_0x3f73cc)){if(_[_0x2bff('0x97')](_0x56709b[_0x3f73cc])){if(!_[_0x2bff('0x45')](_0x56709b[_0x3f73cc])){this[_0x2bff('0x9a')](_0x56709b[_0x3f73cc],util[_0x2bff('0x27')](_0x2bff('0x9b'),_0x50809a,_0x3f73cc));}}else if(_[_0x2bff('0x98')](_0x56709b[_0x3f73cc])){for(var _0x5f531b=0x0;_0x5f531b<_0x56709b[_0x3f73cc][_0x2bff('0x99')];_0x5f531b++){this[_0x2bff('0x9a')](_0x56709b[_0x3f73cc][_0x5f531b],util['format'](_0x2bff('0x9b'),_0x50809a,_0x3f73cc+'['+_0x5f531b+']'));}}else{if(!_[_0x2bff('0x43')](_0x56709b[_0x3f73cc])){this[_0x2bff('0x35')][_0x2bff('0x9c')](util[_0x2bff('0x27')](_0x2bff('0x9b'),_0x50809a,_0x3f73cc),_0x56709b[_0x3f73cc]);}}}}};AGIVertices[_0x2bff('0xe')][_0x2bff('0x94')]=function(_0x19e979){try{var _0x164501=JSON['parse'](_0x19e979);this[_0x2bff('0x96')](_0x164501);return JSON['stringify'](_0x164501);}catch(_0x47e109){return this[_0x2bff('0x95')](_0x19e979);}};AGIVertices['prototype'][_0x2bff('0x95')]=function(_0x20f82e){var _0x3c3dbf=_0x20f82e[_0x2bff('0x9d')]('{');for(var _0x258d01=0x1;_0x258d01<_0x3c3dbf[_0x2bff('0x99')];_0x258d01+=0x1){var _0x4d0207=_0x3c3dbf[_0x258d01][_0x2bff('0x9d')]('}');if(_0x4d0207[_0x2bff('0x99')]>0x1){_0x20f82e=_0x20f82e['replaceAll']('{'+_0x4d0207[0x0]+'}',this[_0x2bff('0x35')]['getVariable'](_0x4d0207[0x0])['extra']||_0x4d0207[0x0]);}}if(_0x3c3dbf['length']===0x1){return _0x20f82e[_0x2bff('0x4c')]();}return this[_0x2bff('0x95')](_0x20f82e);};AGIVertices[_0x2bff('0xe')][_0x2bff('0x9e')]=function(_0x563544,_0x1b57a5){var _0x2961ec=this[_0x2bff('0x35')]['getVariable'](_0x563544);if(_0x2961ec[_0x2bff('0x9f')]===-0x1){return _0x2961ec;}logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1b57a5,_0x2961ec[_0x2bff('0xa0')]));return this[_0x2bff('0x35')][_0x2bff('0x9c')](_0x1b57a5,_0x2961ec[_0x2bff('0xa0')]);};AGIVertices[_0x2bff('0xe')][_0x2bff('0xa1')]=function(_0x249d80){return _0x249d80&&_0x249d80!=='0'&&_0x249d80!=='-1'&&_0x249d80!=='';};AGIVertices[_0x2bff('0xe')][_0x2bff('0xa2')]=function(_0x55bee3){this[_0x2bff('0x34')][_0x2bff('0x6c')](this,_0x55bee3,'-');_0x55bee3['retry']=_0x55bee3['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x2bff('0xe')][_0x2bff('0xa3')]=function(_0x4b2d8f){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0xa4'),_0x4b2d8f['label']));if(!this[_0x2bff('0xa1')](_0x4b2d8f['text'])){return this['channel'][_0x2bff('0xa5')](_0x2bff('0xa6'));}var _0x8ac501='\x22'+_0x4b2d8f[_0x2bff('0x5c')]+'\x22';if(this[_0x2bff('0xa1')](_0x4b2d8f[_0x2bff('0x74')])){_0x8ac501+=','+_0x4b2d8f[_0x2bff('0x74')];}var _0xfcd098=this[_0x2bff('0x35')][_0x2bff('0x57')](_0x2bff('0xa7'),_0x8ac501);if(_0xfcd098[_0x2bff('0x9f')]===-0x1){return _0xfcd098;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xa8'),_0x8ac501));};AGIVertices[_0x2bff('0xe')]['mrcprecog']=function(_0x214f4d){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0xa9'),_0x214f4d[_0x2bff('0x37')]));if(!this['isConfigured'](_0x214f4d[_0x2bff('0xaa')])){return this['channel']['noop'](_0x2bff('0xab'));}var _0x28f599=_0x214f4d[_0x2bff('0xaa')];if(this['isConfigured'](_0x214f4d[_0x2bff('0x74')])){_0x28f599+=','+_0x214f4d[_0x2bff('0x74')];}var _0x2e78e3=this[_0x2bff('0x35')]['exec']('MRCPRecog',_0x28f599);if(_0x2e78e3[_0x2bff('0x9f')]===-0x1){return _0x2e78e3;}var _0x1a273a=this[_0x2bff('0x9e')](_0x2bff('0xac'),_0x2bff('0xad'));if(_0x1a273a[_0x2bff('0x9f')]===-0x1){return _0x1a273a;}var _0x1883e4=this[_0x2bff('0x9e')]('RECOG_INPUT()',_0x2bff('0xae'));if(_0x1883e4[_0x2bff('0x9f')]===-0x1){return _0x1883e4;}var _0x2b513c=this[_0x2bff('0x9e')](_0x2bff('0xaf'),_0x2bff('0xb0'));if(_0x2b513c['result']===-0x1){return _0x2b513c;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xb1'),_0x28f599));};AGIVertices[_0x2bff('0xe')][_0x2bff('0xb2')]=function(_0x45c77d){logger['info'](util[_0x2bff('0x27')](_0x2bff('0xb3'),_0x45c77d[_0x2bff('0x37')]));return this[_0x2bff('0x35')][_0x2bff('0xb2')]([_0x45c77d['command'],_0x45c77d[_0x2bff('0xb4')]]);};AGIVertices[_0x2bff('0xe')][_0x2bff('0xb5')]=function(_0x5ed391){logger[_0x2bff('0x2a')](util['format'](_0x2bff('0xb6'),_0x5ed391[_0x2bff('0x37')]));if(this[_0x2bff('0xa1')](_0x5ed391[_0x2bff('0xb7')])){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0xb8'),_0x5ed391[_0x2bff('0xb7')]));var _0x379f3b=this[_0x2bff('0x35')][_0x2bff('0xb9')](_0x5ed391[_0x2bff('0xb7')]);if(_0x379f3b[_0x2bff('0x9f')]===-0x1){return _0x379f3b;}}return this['channel'][_0x2bff('0xb5')]();};AGIVertices[_0x2bff('0xe')][_0x2bff('0x4a')]=function(_0x22aeb1){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x22aeb1[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x22aeb1[_0x2bff('0x48')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x22aeb1,_0x2bff('0xba'));}_0x22aeb1[_0x2bff('0x49')]=moment();if(this[_0x2bff('0xa1')](_0x22aeb1[_0x2bff('0xbb')])){_0x22aeb1['scheduledAt']=moment()[_0x2bff('0xbc')](_0x22aeb1[_0x2bff('0xbb')],_0x2bff('0xbd'));}if(!this['isConfigured'](_0x22aeb1[_0x2bff('0x4d')])){_0x22aeb1[_0x2bff('0x4d')]=0x2;}this[_0x2bff('0x42')][_0x2bff('0x6c')](this,_0x22aeb1);return this['channel'][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xbe'),_0x22aeb1['phone'],_0x22aeb1[_0x2bff('0x48')],_0x22aeb1[_0x2bff('0x49')]));};AGIVertices['prototype']['custom_app']=function(_0x2f4a3f){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0xbf'),_0x2f4a3f[_0x2bff('0x37')]));var _0x32159b=this[_0x2bff('0x35')]['exec'](_0x2f4a3f[_0x2bff('0xc0')],_0x2f4a3f[_0x2bff('0x74')]);if(_0x32159b[_0x2bff('0x9f')]===-0x1){return _0x32159b;}return this['channel'][_0x2bff('0xa5')](util['format']('Executed\x20command\x20%s\x20%s',_0x2f4a3f[_0x2bff('0xc0')],_0x2f4a3f[_0x2bff('0x74')]));};AGIVertices[_0x2bff('0xe')][_0x2bff('0xc1')]=function(_0x18fd72){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0xc2'),_0x18fd72['label']));if(!this[_0x2bff('0xa1')](_0x18fd72[_0x2bff('0x5c')])){return this['channel'][_0x2bff('0xa5')]('no\x20text\x20configured');}var _0x1ca298='\x22'+_0x18fd72[_0x2bff('0x5c')]+'\x22';if(this[_0x2bff('0xa1')](_0x18fd72[_0x2bff('0x74')])){_0x1ca298+=','+_0x18fd72[_0x2bff('0x74')];}var _0x4a78cf=this[_0x2bff('0x35')][_0x2bff('0x57')](_0x2bff('0xa7'),_0x1ca298);if(_0x4a78cf['result']===-0x1){return _0x4a78cf;}return this['channel'][_0x2bff('0xa5')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1ca298));};AGIVertices[_0x2bff('0xe')][_0x2bff('0xc3')]=function(_0x482bfe){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0xc4'),_0x482bfe[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x482bfe[_0x2bff('0x5c')])){return this[_0x2bff('0x35')]['noop']('no\x20text\x20configured');}var _0x26637c='\x22'+_0x482bfe['text']+'\x22';if(this[_0x2bff('0xa1')](_0x482bfe['options'])){_0x26637c+=','+_0x482bfe[_0x2bff('0x74')];}var _0x3644fc=this['channel'][_0x2bff('0x57')](_0x2bff('0xa7'),_0x26637c);if(_0x3644fc['result']===-0x1){return _0x3644fc;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xa8'),_0x26637c));};AGIVertices['prototype']['lumenvoxasr']=function(_0x312162){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x312162[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x312162[_0x2bff('0xaa')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xab'));}var _0x69dd49=_0x312162[_0x2bff('0xaa')];if(this[_0x2bff('0xa1')](_0x312162[_0x2bff('0x74')])){_0x69dd49+=','+_0x312162[_0x2bff('0x74')];}var _0x13581c=this[_0x2bff('0x35')][_0x2bff('0x57')](_0x2bff('0xc5'),_0x69dd49);if(_0x13581c[_0x2bff('0x9f')]===-0x1){return _0x13581c;}var _0x5deb24=this[_0x2bff('0x9e')]('RECOG_CONFIDENCE()',_0x2bff('0xc6'));if(_0x5deb24[_0x2bff('0x9f')]===-0x1){return _0x5deb24;}var _0xcd154e=this['getAndSetVariable'](_0x2bff('0xc7'),_0x2bff('0xc8'));if(_0xcd154e[_0x2bff('0x9f')]===-0x1){return _0xcd154e;}var _0x1a57bc=this[_0x2bff('0x9e')](_0x2bff('0xaf'),_0x2bff('0xc9'));if(_0x1a57bc[_0x2bff('0x9f')]===-0x1){return _0x1a57bc;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x69dd49));};AGIVertices[_0x2bff('0xe')]['sestekasr']=function(_0x2a8ca1){logger[_0x2bff('0x2a')](util['format'](_0x2bff('0xca'),_0x2a8ca1[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x2a8ca1[_0x2bff('0xaa')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')]('no\x20grammar\x20configured');}var _0x58eacc=_0x2a8ca1['grammar'];if(this['isConfigured'](_0x2a8ca1[_0x2bff('0x74')])){_0x58eacc+=','+_0x2a8ca1['options'];}var _0x706081=this[_0x2bff('0x35')][_0x2bff('0x57')](_0x2bff('0xc5'),_0x58eacc);if(_0x706081['result']===-0x1){return _0x706081;}var _0x391208=this[_0x2bff('0x9e')]('RECOG_CONFIDENCE()',_0x2bff('0xcb'));if(_0x391208[_0x2bff('0x9f')]===-0x1){return _0x391208;}var _0x17e4eb=this[_0x2bff('0x9e')](_0x2bff('0xc7'),'SESTEK_ASR_TRANSCRIPT');if(_0x17e4eb[_0x2bff('0x9f')]===-0x1){return _0x17e4eb;}var _0x5cfefb=this[_0x2bff('0x9e')](_0x2bff('0xaf'),_0x2bff('0xcc'));if(_0x5cfefb[_0x2bff('0x9f')]===-0x1){return _0x5cfefb;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xb1'),_0x58eacc));};AGIVertices['prototype']['database']=function(_0x2010e8){logger[_0x2bff('0x2a')](util['format'](_0x2bff('0xcd'),_0x2010e8[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x2010e8['odbc_id'])){return this['channel'][_0x2bff('0x2f')](_0x2010e8,_0x2bff('0xce'));}var _0x3a6c23=this['getSquareOdbc'][_0x2bff('0x6c')](this,_0x2010e8[_0x2bff('0xcf')]);if(!_0x3a6c23){return this['channel'][_0x2bff('0x2f')](_0x2010e8,_0x2bff('0xd0'));}if(!this[_0x2bff('0xa1')](_0x2010e8['query'])){return this['channel'][_0x2bff('0x2f')](_0x2010e8,'no\x20query\x20configured');}var _0x7e4431=_0x2010e8[_0x2bff('0x2c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xd1'),_0x7e4431));var _0x2ff7f5=this[_0x2bff('0x29')][_0x2bff('0x6c')](this,_0x3a6c23,_0x7e4431);this['createSquareDetailsReport'][_0x2bff('0x6c')](this,_0x2010e8,_0x7e4431);if(!this[_0x2bff('0xa1')](_0x2010e8[_0x2bff('0xd2')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xd3'));}var _0x5e5c=this['getVariable'][_0x2bff('0x6c')](this,_0x2010e8[_0x2bff('0xd2')]);if(!_0x5e5c){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x2010e8,_0x2bff('0xd4'));}var _0x3b90d0=this;_0x2ff7f5['forEach'](function(_0x1a268d,_0x4eac34){Object[_0x2bff('0xd5')](_0x1a268d)['forEach'](function(_0x354353){_0x3b90d0[_0x2bff('0x35')][_0x2bff('0x9c')](util[_0x2bff('0x27')](_0x2bff('0xd6'),_0x5e5c,_0x4eac34,_0x354353),_0x1a268d[_0x354353]);});});this[_0x2bff('0x35')]['setVariable'](util[_0x2bff('0x27')](_0x2bff('0xd7'),_0x5e5c),_0x2ff7f5[_0x2bff('0x99')]);return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xd8'),_0x5e5c));};AGIVertices[_0x2bff('0xe')]['dial']=function(_0x45d70f){logger['debug'](util[_0x2bff('0x27')](_0x2bff('0xd9'),_0x45d70f[_0x2bff('0x37')]));if(!this['isConfigured'](_0x45d70f[_0x2bff('0xda')])){return this['channel']['error'](_0x45d70f,_0x2bff('0xdb'));}var _0x414e47=this['getUser'][_0x2bff('0x6c')](this,_0x45d70f[_0x2bff('0xda')]);if(!_0x414e47){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x45d70f,_0x2bff('0xdc'));}var _0x22b201=this[_0x2bff('0x35')][_0x2bff('0x57')](_0x2bff('0xdd'),[util[_0x2bff('0x27')](_0x2bff('0xde'),_0x414e47),_0x45d70f[_0x2bff('0xb7')],_0x45d70f[_0x2bff('0xdf')],_0x45d70f[_0x2bff('0x61')]]);if(_0x22b201[_0x2bff('0x9f')]===-0x1){return _0x22b201;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xe0'),_0x2bff('0xdd')));};AGIVertices['prototype']['dialogflow']=function(_0x5efc53){logger['info'](util[_0x2bff('0x27')](_0x2bff('0xe1'),_0x5efc53[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x5efc53['key'])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xe2'));}if(!this[_0x2bff('0xa1')](_0x5efc53['text'])){return this[_0x2bff('0x35')]['noop']('no\x20text\x20configured');}this[_0x2bff('0x35')][_0x2bff('0xe3')]=!![];this[_0x2bff('0x34')](_0x5efc53);this[_0x2bff('0x41')](_0x5efc53[_0x2bff('0x5c')],'in','','');this['channel']['noop'](util[_0x2bff('0x27')](_0x2bff('0xe4'),_0x5efc53[_0x2bff('0x5c')]));var _0x547e90=this[_0x2bff('0x75')][_0x2bff('0x6c')](this,_0x5efc53);if(_0x547e90){for(var _0xc0a20d in _0x547e90){if(_0x547e90[_0x2bff('0x92')](_0xc0a20d)){this['channel'][_0x2bff('0x9c')](util[_0x2bff('0x27')](_0x2bff('0xe5'),_0xc0a20d[_0x2bff('0x66')]()),_0x547e90[_0xc0a20d]);}}this[_0x2bff('0x41')](_0x547e90[_0x2bff('0xe6')],_0x2bff('0xe7'),_0x2bff('0xe8'),'');return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')]('Dialogflow\x20Result\x20%s',_0x547e90[_0x2bff('0xe6')]));}return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x5efc53,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x2bff('0xe')]['dialogflowV2']=function(_0x94c3d4){logger['info'](util[_0x2bff('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x94c3d4['label']));if(!this[_0x2bff('0xa1')](_0x94c3d4[_0x2bff('0xe9')])){return this['channel']['noop'](_0x2bff('0xea'));}if(!this[_0x2bff('0xa1')](_0x94c3d4[_0x2bff('0x78')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xeb'));}if(!this[_0x2bff('0xa1')](_0x94c3d4['private_key'])){return this['channel'][_0x2bff('0xa5')](_0x2bff('0xec'));}if(!this[_0x2bff('0xa1')](_0x94c3d4[_0x2bff('0x79')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xed'));}if(!this[_0x2bff('0xa1')](_0x94c3d4[_0x2bff('0x5c')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')]('no\x20text\x20configured');}this[_0x2bff('0x35')][_0x2bff('0xe3')]=!![];this[_0x2bff('0x34')](_0x94c3d4);this[_0x2bff('0x41')](_0x94c3d4[_0x2bff('0x5c')],'in','','');this['channel']['noop'](util[_0x2bff('0x27')](_0x2bff('0xee'),_0x94c3d4['text']));var _0x1bf989=this[_0x2bff('0x77')]['sync'](this,_0x94c3d4);if(_0x1bf989){for(var _0x52fbb2 in _0x1bf989){if(_0x1bf989['hasOwnProperty'](_0x52fbb2)){if(_0x52fbb2!==_0x2bff('0xef')){this[_0x2bff('0x35')][_0x2bff('0x9c')](util[_0x2bff('0x27')](_0x2bff('0xe5'),_0x52fbb2[_0x2bff('0x66')]()),_0x1bf989[_0x52fbb2]);}}}this[_0x2bff('0x41')](_0x1bf989[_0x2bff('0xe6')],'out',_0x2bff('0xf0'),_0x1bf989[_0x2bff('0xef')]);return this['channel'][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xf1'),_0x1bf989[_0x2bff('0xe6')]));}return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x94c3d4,_0x2bff('0xf2'));};AGIVertices[_0x2bff('0xe')][_0x2bff('0xf3')]=function(_0x97b2ad){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0xf4'),_0x97b2ad[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x97b2ad[_0x2bff('0xf5')])){return this[_0x2bff('0x35')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x97b2ad[_0x2bff('0xf6')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xf7'));}if(!this['isConfigured'](_0x97b2ad[_0x2bff('0xf8')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xf9'));}if(!this[_0x2bff('0xa1')](_0x97b2ad[_0x2bff('0xfa')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xa6'));}this[_0x2bff('0x35')][_0x2bff('0xe3')]=!![];this[_0x2bff('0x34')](_0x97b2ad);this[_0x2bff('0x41')](_0x97b2ad[_0x2bff('0x5c')],'in','','');this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')]('Trying\x20SestekNDA:\x20%s',_0x97b2ad[_0x2bff('0x5c')]));var _0x4fb358=this['sestekNDA']['sync'](this,_0x97b2ad);if(_0x4fb358){for(var _0x28fed9 in _0x4fb358){if(_0x4fb358[_0x2bff('0x92')](_0x28fed9)){this[_0x2bff('0x35')]['setVariable'](util[_0x2bff('0x27')](_0x2bff('0xfb'),_0x28fed9[_0x2bff('0x66')]()),_0x4fb358[_0x28fed9]);}}this[_0x2bff('0x41')](_0x4fb358[_0x2bff('0xe6')],'out',_0x2bff('0xf3'),'');if(_0x4fb358[_0x2bff('0xfc')]){this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xfd'),_0x4fb358['audiofile']));var _0x272af9=this[_0x2bff('0x35')][_0x2bff('0xfe')](_0x4fb358[_0x2bff('0xfc')]);try{fs['unlink'](_0x4fb358[_0x2bff('0xfc')]+_0x2bff('0xff'));}catch(_0x115b85){logger[_0x2bff('0x2f')](_0x115b85);}return _0x272af9;}else{return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')]('SestekNDA\x20Result\x20%s',_0x4fb358[_0x2bff('0xe6')]));}}return this['channel'][_0x2bff('0x2f')](_0x97b2ad,_0x2bff('0x100'));};AGIVertices['prototype'][_0x2bff('0x101')]=function(_0x3c3e10){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20END\x20(%s)\x20block',_0x3c3e10[_0x2bff('0x37')]));return this[_0x2bff('0x35')]['noop']('end');};AGIVertices[_0x2bff('0xe')][_0x2bff('0x102')]=function(_0x17d219){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x17d219['label']));var _0x317a4f='';if(_0x17d219[_0x2bff('0x103')]){if(!this[_0x2bff('0xa1')](_0x17d219[_0x2bff('0x103')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x17d219,_0x2bff('0x104'));}else{var _0x54590f=parseInt(_0x17d219[_0x2bff('0x103')],0xa);if(isNaN(_0x54590f)){_0x317a4f=_0x17d219[_0x2bff('0x103')];}else{_0x317a4f=this[_0x2bff('0x1b')][_0x2bff('0x6c')](this,_0x17d219[_0x2bff('0x103')]);if(!_0x317a4f){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x17d219,_0x2bff('0x105'));}}}}else if(_0x17d219[_0x2bff('0x106')]){_0x317a4f=_0x17d219[_0x2bff('0x106')];}else{return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x17d219,_0x2bff('0x104'));}var _0x28a39a=this[_0x2bff('0x35')][_0x2bff('0x57')](_0x2bff('0xdd'),[util[_0x2bff('0x27')]('SIP/%s/%s',_0x317a4f,_0x17d219[_0x2bff('0x47')]),_0x17d219['timeout'],_0x17d219['opts'],_0x17d219['url']]);if(_0x28a39a[_0x2bff('0x9f')]===-0x1){return _0x28a39a;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')]('Executed\x20command\x20%s',_0x2bff('0xdd')));};AGIVertices[_0x2bff('0xe')]['finally']=function(_0x4d4ad3){logger['info'](util[_0x2bff('0x27')](_0x2bff('0x107'),_0x4d4ad3['label']));return this[_0x2bff('0x35')]['noop'](_0x2bff('0x108'));};AGIVertices['prototype'][_0x2bff('0x109')]=function(_0x4b4e9a){logger[_0x2bff('0x2a')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x4b4e9a[_0x2bff('0x37')]));if(_0x4b4e9a[_0x2bff('0x10a')]===0x0){return this[_0x2bff('0xa2')](_0x4b4e9a);}_0x4b4e9a[_0x2bff('0x10a')]-=0x1;if(!this[_0x2bff('0xa1')](_0x4b4e9a['file_id'])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x4b4e9a,_0x2bff('0x10b'));}var _0x16e837=this[_0x2bff('0x1d')][_0x2bff('0x6c')](this,_0x4b4e9a[_0x2bff('0x10c')]);if(!_0x16e837){return this['channel']['error'](_0x4b4e9a,_0x2bff('0x10d'));}if(!this['isConfigured'](_0x4b4e9a[_0x2bff('0xd2')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x2bff('0xd3'));}var _0x25b201=this[_0x2bff('0x35')][_0x2bff('0x10e')](_0x16e837,_0x4b4e9a['response'],_0x4b4e9a[_0x2bff('0x10f')]);var _0x8a722c=_0x25b201[_0x2bff('0x9f')]?_0x25b201['result']['toString']():'';logger[_0x2bff('0x2a')](_0x2bff('0x110'),JSON[_0x2bff('0x111')](_0x25b201));if(_0x25b201['result']===-0x1){this[_0x2bff('0x34')]['sync'](this,_0x4b4e9a,_0x8a722c);return _0x25b201;}else if(_0x25b201[_0x2bff('0xa0')]===_0x2bff('0xb7')){_0x25b201['result']=_0x8a722c[_0x2bff('0x99')]>=parseInt(_0x4b4e9a[_0x2bff('0x112')])?'x':'i';}else{_0x25b201[_0x2bff('0x9f')]=_0x8a722c[_0x2bff('0x99')]>=parseInt(_0x4b4e9a['mindigit'])&&_0x8a722c['length']<=parseInt(_0x4b4e9a[_0x2bff('0x10f')])?'x':'i';}var _0x520fb1=this[_0x2bff('0x113')][_0x2bff('0x6c')](this,_0x4b4e9a['variable_id']);if(!_0x520fb1){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x4b4e9a,_0x2bff('0xd4'));}this[_0x2bff('0x35')]['setVariable'](_0x520fb1,_0x8a722c);if(this[_0x2bff('0xa1')](_0x4b4e9a[_0x2bff('0x114')])){var _0x1fcc38=parseInt(_0x4b4e9a[_0x2bff('0x114')],0xa);var _0x128636=rs['generate']({'charset':'*','length':_0x1fcc38});var _0xdd076a=_0x8a722c['length'];if(_0xdd076a>0x0){if(_0xdd076a>_0x1fcc38){this[_0x2bff('0x34')]['sync'](this,_0x4b4e9a,_0x4b4e9a[_0x2bff('0x115')]==='first'?_0x128636+_0x8a722c[_0x2bff('0x116')](_0x1fcc38):_0x8a722c['substr'](0x0,_0xdd076a-_0x1fcc38)+_0x128636);}else{this[_0x2bff('0x34')][_0x2bff('0x6c')](this,_0x4b4e9a,rs[_0x2bff('0x117')]({'charset':'*','length':_0xdd076a}));}}else{this[_0x2bff('0x34')]['sync'](this,_0x4b4e9a,'');}}else{this[_0x2bff('0x34')]['sync'](this,_0x4b4e9a,_0x8a722c);}return _0x25b201;};AGIVertices['prototype'][_0x2bff('0xd')]=function(_0x1cb33c){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x118'),_0x1cb33c[_0x2bff('0x37')]));return this[_0x2bff('0x109')](_0x1cb33c);};AGIVertices[_0x2bff('0xe')]['goal']=function(_0x7afff4){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x119'),_0x7afff4[_0x2bff('0x37')]));this['createSquareDetailsReport'][_0x2bff('0x6c')](this,_0x7afff4,_0x7afff4[_0x2bff('0x11a')]);return this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')](_0x2bff('0x11b'),_0x7afff4[_0x2bff('0x11a')]));};AGIVertices[_0x2bff('0xe')]['awspolly']=function(_0x1e86a9){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x11c'),_0x1e86a9[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x1e86a9[_0x2bff('0x82')])||!this[_0x2bff('0xa1')](_0x1e86a9[_0x2bff('0x83')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0x11d'));}if(!this[_0x2bff('0xa1')](_0x1e86a9[_0x2bff('0x5c')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xa6'));}this[_0x2bff('0x35')][_0x2bff('0xa5')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x1e86a9[_0x2bff('0x5c')]));var _0x1f2c3e=this[_0x2bff('0x81')][_0x2bff('0x6c')](this,_0x1e86a9);if(_0x1f2c3e){this['channel'][_0x2bff('0xa5')](util[_0x2bff('0x27')]('aws\x20Polly\x20%s\x20file\x20created',_0x1f2c3e));var _0x26a990=this['channel']['streamFile'](_0x1f2c3e);try{fs[_0x2bff('0x11e')](_0x1f2c3e+_0x2bff('0xff'));}catch(_0x470018){logger[_0x2bff('0x2f')](_0x470018);}return _0x26a990;}return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x1e86a9,_0x2bff('0x11f'));};AGIVertices['prototype']['awslex']=function(_0x197cfd){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x120'),_0x197cfd[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x197cfd['aws_access_key_id'])||!this[_0x2bff('0xa1')](_0x197cfd['aws_secret_access_key'])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0x11d'));}if(!this[_0x2bff('0xa1')](_0x197cfd[_0x2bff('0x89')])){return this['channel'][_0x2bff('0xa5')]('no\x20bot\x20name\x20configured');}if(!this[_0x2bff('0xa1')](_0x197cfd[_0x2bff('0x5c')])){return this[_0x2bff('0x35')]['noop'](_0x2bff('0xa6'));}this['channel'][_0x2bff('0xe3')]=!![];this['createSquareDetailsReport'](_0x197cfd);this[_0x2bff('0x41')](_0x197cfd[_0x2bff('0x5c')],'in','','');this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x197cfd[_0x2bff('0x5c')]));var _0x26894b=this[_0x2bff('0x87')][_0x2bff('0x6c')](this,_0x197cfd);if(_0x26894b){for(var _0x58aa5f in _0x26894b){if(_0x26894b['hasOwnProperty'](_0x58aa5f)&&_[_0x2bff('0x93')](_0x26894b[_0x58aa5f])){this[_0x2bff('0x35')][_0x2bff('0x9c')](util[_0x2bff('0x27')]('AWS_LEX_%s',_0x58aa5f['toUpperCase']()),_0x26894b[_0x58aa5f]);}}if(_[_0x2bff('0x43')](_0x26894b[_0x2bff('0x73')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0x121'));}else{this[_0x2bff('0x41')](_0x26894b[_0x2bff('0x73')],_0x2bff('0xe7'),'amazonlex','');return this['channel'][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x122'),_0x26894b[_0x2bff('0x73')]));}}return this[_0x2bff('0x35')]['error'](_0x197cfd,_0x2bff('0x123'));};AGIVertices[_0x2bff('0xe')][_0x2bff('0x124')]=function(_0x535c44){logger[_0x2bff('0x2a')](util['format'](_0x2bff('0x125'),_0x535c44[_0x2bff('0x37')],_0x535c44[_0x2bff('0xb7')]));if(!this[_0x2bff('0xa1')](_0x535c44[_0x2bff('0x7c')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0xe2'));}var _0x55e4fd='wav';var _0x51b87f=util[_0x2bff('0x27')](_0x2bff('0x126'),FILES_PATH,rs['generate'](0x4));var _0x5bba11=util[_0x2bff('0x27')]('%s.%s',_0x51b87f,_0x55e4fd);var _0x175d87=!![];if(_0x535c44[_0x2bff('0x127')]===_0x2bff('0x128')){_0x175d87=![];}var _0x2092aa=this[_0x2bff('0x35')][_0x2bff('0x129')](_0x51b87f,_0x55e4fd,_0x535c44['intKey'],_0x535c44[_0x2bff('0xb7')],undefined,_0x175d87);if(_0x2092aa[_0x2bff('0x9f')]!==-0x1){this[_0x2bff('0x35')]['noop'](util['format']('google\x20%s\x20file\x20created',_0x5bba11));var _0x3b8a96=this[_0x2bff('0x8a')][_0x2bff('0x6c')](this,_0x535c44,_0x5bba11);if(_0x3b8a96){for(var _0x2d403d in _0x3b8a96){if(_0x3b8a96[_0x2bff('0x92')](_0x2d403d)){this['channel'][_0x2bff('0x9c')](util[_0x2bff('0x27')](_0x2bff('0x12a'),_0x2d403d[_0x2bff('0x66')]()),_0x3b8a96[_0x2d403d]);}}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x12b'),JSON[_0x2bff('0x111')](_0x3b8a96)));}}return _0x2092aa;};AGIVertices[_0x2bff('0xe')][_0x2bff('0x12c')]=function(_0x152b97){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x152b97['label']));if(!this[_0x2bff('0xa1')](_0x152b97[_0x2bff('0x8d')])){return this['channel'][_0x2bff('0xa5')](_0x2bff('0x12d'));}if(!this['isConfigured'](_0x152b97[_0x2bff('0x8e')])){return this['channel'][_0x2bff('0xa5')](_0x2bff('0x12e'));}var _0x44a4d0=_0x2bff('0x12f');var _0xa0ae15=util[_0x2bff('0x27')](_0x2bff('0x126'),FILES_PATH,rs[_0x2bff('0x117')](0x4));var _0x7e23ce=util[_0x2bff('0x27')](_0x2bff('0x9b'),_0xa0ae15,_0x44a4d0);var _0x307dce=!![];if(_0x152b97['beep']==='NOBEEP'){_0x307dce=![];}var _0x799b00=this[_0x2bff('0x35')]['recordFile'](_0xa0ae15,_0x44a4d0,_0x152b97['intKey'],_0x152b97[_0x2bff('0xb7')],undefined,_0x307dce);if(_0x799b00[_0x2bff('0x9f')]!==-0x1){this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')]('tilde\x20%s\x20file\x20created',_0x7e23ce));var _0x411555=this[_0x2bff('0x8c')]['sync'](this,_0x152b97,_0x7e23ce);if(_0x411555){for(var _0x3a13d3 in _0x411555){if(_0x411555['hasOwnProperty'](_0x3a13d3)){this[_0x2bff('0x35')][_0x2bff('0x9c')](util[_0x2bff('0x27')](_0x2bff('0x130'),_0x3a13d3[_0x2bff('0x66')]()),_0x411555[_0x3a13d3]);}}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x131'),JSON[_0x2bff('0x111')](_0x411555)));}}return _0x799b00;};AGIVertices[_0x2bff('0xe')]['gotoc']=function(_0x125616){logger[_0x2bff('0x2a')](util['format'](_0x2bff('0x132'),_0x125616[_0x2bff('0x37')]));return this[_0x2bff('0x35')]['continueAt'](_0x125616[_0x2bff('0x133')],_0x125616['extension'],_0x125616['priority']);};AGIVertices[_0x2bff('0xe')]['gotoif']=function(_0x4d4748){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4d4748[_0x2bff('0x37')]));if(!this['isConfigured'](_0x4d4748[_0x2bff('0x134')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x4d4748,_0x2bff('0x135'));}try{var _0x15de93=eval(_0x4d4748[_0x2bff('0x134')])?_0x2bff('0x136'):_0x2bff('0x137');this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x138'),_0x4d4748[_0x2bff('0x134')],_0x15de93));return{'code':0xc8,'result':_0x15de93};}catch(_0x2d71cf){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x2bff('0x139')]=function(_0x220479){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x13a'),_0x220479[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x220479[_0x2bff('0x13b')])){return this[_0x2bff('0x35')]['error'](_0x220479,_0x2bff('0x13c'));}var _0x235ea8=this[_0x2bff('0x22')]['sync'](this,_0x220479[_0x2bff('0x13b')]);if(!_0x235ea8){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x220479,_0x2bff('0x13d'));}for(var _0x3b1283=0x0;_0x3b1283<_0x235ea8[_0x2bff('0x99')];_0x3b1283+=0x1){var _0x53a61c=this['channel']['getVariable'](util[_0x2bff('0x27')](_0x2bff('0x13e'),_0x235ea8[_0x3b1283]));if(_0x53a61c[_0x2bff('0x9f')]===-0x1){return _0x53a61c;}logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x13f'),_0x235ea8[_0x3b1283],_0x53a61c[_0x2bff('0xa0')]));if(_0x53a61c['extra']===_0x2bff('0x136')){logger['info'](util[_0x2bff('0x27')](_0x2bff('0x13f'),_0x235ea8[_0x3b1283],_0x2bff('0x136')));this['channel'][_0x2bff('0xa5')](util['format'](_0x2bff('0x13f'),_0x235ea8[_0x3b1283],_0x2bff('0x136')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x2bff('0x27')](_0x2bff('0x13f'),_0x235ea8[_0x3b1283],_0x2bff('0x137')));this['channel']['noop'](util[_0x2bff('0x27')](_0x2bff('0x13f'),_0x235ea8[_0x3b1283],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x2bff('0xe')][_0x2bff('0x140')]=function(_0x425f8b){logger['info'](util[_0x2bff('0x27')](_0x2bff('0x141'),_0x425f8b[_0x2bff('0x37')]));return this['channel']['hangup']();};AGIVertices[_0x2bff('0xe')]['ispeechasr']=function(_0x3a3326){logger['info'](util['format'](_0x2bff('0x142'),_0x3a3326[_0x2bff('0x37')]));if(!this['isConfigured'](_0x3a3326['key'])){return this['channel'][_0x2bff('0xa5')](_0x2bff('0xe2'));}var _0x337c03='wav';var _0x2957e9=util[_0x2bff('0x27')](_0x2bff('0x126'),FILES_PATH,rs['generate'](0x4));var _0x5adb8d=util['format'](_0x2bff('0x9b'),_0x2957e9,_0x337c03);var _0x547c9c=!![];if(_0x3a3326['beep']===_0x2bff('0x128')){_0x547c9c=![];}var _0x8eea5d=this[_0x2bff('0x35')][_0x2bff('0x129')](_0x2957e9,_0x337c03,_0x3a3326[_0x2bff('0x143')],_0x3a3326['timeout'],undefined,_0x547c9c);if(_0x8eea5d[_0x2bff('0x9f')]!==-0x1){this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')](_0x2bff('0x144'),_0x5adb8d));var _0x4a140f=this[_0x2bff('0x7e')][_0x2bff('0x6c')](this,_0x3a3326,_0x5adb8d);if(_0x4a140f){for(var _0x40c93c in _0x4a140f){if(_0x4a140f[_0x2bff('0x92')](_0x40c93c)){this[_0x2bff('0x35')][_0x2bff('0x9c')](util[_0x2bff('0x27')](_0x2bff('0x145'),_0x40c93c[_0x2bff('0x66')]()),_0x4a140f[_0x40c93c]);}}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0x2bff('0x111')](_0x4a140f)));}}return _0x8eea5d;};AGIVertices['prototype'][_0x2bff('0x146')]=function(_0x2d47d7){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x147'),_0x2d47d7[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x2d47d7[_0x2bff('0x7c')])){return this[_0x2bff('0x35')]['noop'](_0x2bff('0xe2'));}if(!this[_0x2bff('0xa1')](_0x2d47d7[_0x2bff('0x5c')])){return this['channel']['noop'](_0x2bff('0xa6'));}this[_0x2bff('0x35')]['noop'](util['format'](_0x2bff('0x148'),_0x2d47d7[_0x2bff('0x5c')]));var _0x27e84f=this[_0x2bff('0x7b')][_0x2bff('0x6c')](this,_0x2d47d7);if(_0x27e84f){this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')](_0x2bff('0x144'),_0x27e84f));var _0x67e4=this[_0x2bff('0x35')][_0x2bff('0xfe')](_0x27e84f,_0x2d47d7[_0x2bff('0x143')]);try{fs[_0x2bff('0x11e')](_0x27e84f+_0x2bff('0xff'));}catch(_0xd79c09){logger[_0x2bff('0x2f')](_0xd79c09);}return _0x67e4;}return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x2d47d7,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2bff('0xe')]['login']=function(_0x3d6ab){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x149'),_0x3d6ab['label']));if(!this[_0x2bff('0xa1')](_0x3d6ab['findBy'])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x3d6ab,'no\x20find\x20by\x20configured');}logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x14a'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x3d6ab['findBy']));var _0x587d24=this[_0x2bff('0x14b')][_0x2bff('0x6c')](this,_0x3d6ab['findBy']);if(_0x587d24){logger['info'](util[_0x2bff('0x27')](_0x2bff('0x14c'),this[_0x2bff('0x35')]['callerid'],_0x3d6ab[_0x2bff('0x14d')]));this[_0x2bff('0x35')][_0x2bff('0xa5')](util['format'](_0x2bff('0x14c'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x3d6ab[_0x2bff('0x14d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x14e'),this['channel'][_0x2bff('0x3a')],_0x3d6ab[_0x2bff('0x14d')]));this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x3d6ab[_0x2bff('0x14d')]));return{'code':0xc8,'result':_0x2bff('0x14f')};}};AGIVertices[_0x2bff('0xe')]['logout']=function(_0x3515fd){logger['info'](util[_0x2bff('0x27')](_0x2bff('0x150'),_0x3515fd[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x3515fd[_0x2bff('0x14d')])){return this['channel'][_0x2bff('0x2f')](_0x3515fd,_0x2bff('0x151'));}logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x14a'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x3515fd[_0x2bff('0x14d')]));var _0x163c86=this[_0x2bff('0x52')][_0x2bff('0x6c')](this,_0x3515fd[_0x2bff('0x14d')]);if(_0x163c86){logger[_0x2bff('0x2a')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x3515fd[_0x2bff('0x14d')]));this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x14c'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x3515fd['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x2bff('0x27')](_0x2bff('0x14e'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x3515fd['findBy']));this['channel'][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x14e'),this['channel'][_0x2bff('0x3a')],_0x3515fd[_0x2bff('0x14d')]));return{'code':0xc8,'result':_0x2bff('0x14f')};}};AGIVertices['prototype'][_0x2bff('0x152')]=function(_0x16ef2a){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x153'),_0x16ef2a[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x16ef2a[_0x2bff('0x154')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x16ef2a,_0x2bff('0x155'));}this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x156'),_0x16ef2a[_0x2bff('0x154')]));var _0x473ebb=eval(_0x16ef2a[_0x2bff('0x154')]);if(!this['isConfigured'](_0x16ef2a['variable_id'])){return this[_0x2bff('0x35')]['noop'](_0x2bff('0xd3'));}var _0x447706=this[_0x2bff('0x113')][_0x2bff('0x6c')](this,_0x16ef2a[_0x2bff('0xd2')]);if(!_0x447706){return this[_0x2bff('0x35')]['error'](_0x16ef2a,'no\x20variable\x20found');}if(_[_0x2bff('0x98')](_0x473ebb)){var _0x64f9c4=this;_0x473ebb[_0x2bff('0x157')](function(_0x41e30a,_0x42512f){_0x64f9c4[_0x2bff('0x35')]['setVariable'](util['format'](_0x2bff('0x158'),_0x447706,_0x42512f),_0x41e30a);});return this[_0x2bff('0x35')][_0x2bff('0xa5')](util['format']('variable\x20%s[key]\x20set',_0x447706));}else{return this[_0x2bff('0x35')]['setVariable'](_0x447706,_0x473ebb);}};AGIVertices[_0x2bff('0xe')][_0x2bff('0xc')]=function(_0x77445f){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x159'),_0x77445f[_0x2bff('0x37')]));if(_0x77445f['retry']===0x0){return this[_0x2bff('0xa2')](_0x77445f);}_0x77445f[_0x2bff('0x10a')]-=0x1;if(!this[_0x2bff('0xa1')](_0x77445f[_0x2bff('0x10c')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x77445f,_0x2bff('0x10b'));}var _0x4d7bf1=this['getSound'][_0x2bff('0x6c')](this,_0x77445f['file_id']);if(!_0x4d7bf1){return this[_0x2bff('0x35')]['error'](_0x77445f,_0x2bff('0x10d'));}var _0x28d672=this[_0x2bff('0x35')][_0x2bff('0x10e')](_0x4d7bf1,_0x77445f[_0x2bff('0x15a')],_0x77445f[_0x2bff('0x15b')]);var _0x5be68b=_0x28d672[_0x2bff('0x9f')];if(_0x28d672[_0x2bff('0x9f')]===-0x1){this[_0x2bff('0x34')][_0x2bff('0x6c')](this,_0x77445f,'-1');return _0x28d672;}else if(_0x28d672[_0x2bff('0xa0')]===_0x2bff('0xb7')){_0x28d672['result']=_0x28d672[_0x2bff('0x9f')][_0x2bff('0x99')]>0x0?_0x28d672['result']:'t';}else if(_['isEmpty'](_0x28d672['result'])){_0x28d672[_0x2bff('0x9f')]='#';_0x5be68b='#';}if(!this[_0x2bff('0xa1')](_0x77445f['variable_id'])){this[_0x2bff('0x35')]['noop'](_0x2bff('0xd3'));}else{var _0x48b1b3=this['getVariable'][_0x2bff('0x6c')](this,_0x77445f[_0x2bff('0xd2')]);if(!_0x48b1b3){return this['channel'][_0x2bff('0x2f')](_0x77445f,_0x2bff('0xd4'));}this[_0x2bff('0x35')]['setVariable'](_0x48b1b3,_0x5be68b);}this[_0x2bff('0x34')][_0x2bff('0x6c')](this,_0x77445f,_0x5be68b);return _0x28d672;};AGIVertices['prototype'][_0x2bff('0xa5')]=function(_0x1ed041){logger[_0x2bff('0x2a')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x1ed041[_0x2bff('0x37')]));return this['channel'][_0x2bff('0xa5')](_0x1ed041[_0x2bff('0x15c')]||_0x1ed041['label']);};AGIVertices[_0x2bff('0xe')][_0x2bff('0x15d')]=function(_0x54c50b){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x54c50b[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x54c50b[_0x2bff('0x14d')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x54c50b,_0x2bff('0x151'));}logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x14a'),this['channel'][_0x2bff('0x3a')],_0x54c50b[_0x2bff('0x14d')]));var _0x46acbe=this[_0x2bff('0x15e')]['sync'](this,_0x54c50b[_0x2bff('0x15f')]);var _0x544cca=this[_0x2bff('0x4f')]['sync'](this,_0x54c50b[_0x2bff('0x14d')],_0x46acbe);if(_0x544cca){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x14c'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x54c50b[_0x2bff('0x14d')]));this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x14c'),this['channel'][_0x2bff('0x3a')],_0x54c50b[_0x2bff('0x14d')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x2bff('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x54c50b[_0x2bff('0x14d')]));this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x54c50b[_0x2bff('0x14d')]));return{'code':0xc8,'result':_0x2bff('0x14f')};}};AGIVertices[_0x2bff('0xe')][_0x2bff('0x160')]=function(_0x447b1d){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x161'),_0x447b1d[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x447b1d[_0x2bff('0x10c')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x447b1d,_0x2bff('0x10b'));}var _0x5b64f0=this[_0x2bff('0x1d')][_0x2bff('0x6c')](this,_0x447b1d[_0x2bff('0x10c')]);if(!_0x5b64f0){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x447b1d,_0x2bff('0x10d'));}var _0x19be78=this[_0x2bff('0x35')]['exec'](_0x2bff('0x162'),[_0x5b64f0,_0x447b1d[_0x2bff('0xdf')]]);if(_0x19be78['result']===-0x1){return _0x19be78;}return this['channel']['noop'](util['format'](_0x2bff('0x163'),_0x2bff('0x162'),_0x5b64f0));};AGIVertices[_0x2bff('0xe')][_0x2bff('0x164')]=function(_0x3d5f50){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x3d5f50['label']));if(!this[_0x2bff('0xa1')](_0x3d5f50['queue_id'])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x3d5f50,'no\x20queue\x20selected');}var _0x5e247c='';var _0x431c50=parseInt(_0x3d5f50[_0x2bff('0x165')],0xa);if(isNaN(_0x431c50)){_0x5e247c=_0x3d5f50[_0x2bff('0x165')];}else{_0x5e247c=this['getVoiceQueue']['sync'](this,_0x3d5f50[_0x2bff('0x165')]);if(!_0x5e247c){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x3d5f50,_0x2bff('0x166'));}}var _0x12f54c='';if(this[_0x2bff('0xa1')](_0x3d5f50[_0x2bff('0x10c')])){var _0x58d6aa=this[_0x2bff('0x1d')][_0x2bff('0x6c')](this,_0x3d5f50[_0x2bff('0x10c')]);if(_0x58d6aa){_0x12f54c=_0x58d6aa;}}this[_0x2bff('0x34')]['sync'](this,_0x3d5f50,_0x5e247c);if(_0x3d5f50[_0x2bff('0xdf')]['indexOf']('x')<0x0){_0x3d5f50[_0x2bff('0xdf')]+='x';}if(_0x3d5f50[_0x2bff('0xdf')][_0x2bff('0x167')]('X')<0x0){_0x3d5f50[_0x2bff('0xdf')]+='X';}this['channel'][_0x2bff('0x9c')](_0x2bff('0x168'),_0x5e247c?_0x5e247c['toLowerCase']():'');var _0x18097c=this['channel']['exec'](_0x2bff('0x169'),[_0x5e247c,_0x3d5f50[_0x2bff('0xdf')],_0x3d5f50[_0x2bff('0x61')],_0x12f54c,_0x3d5f50[_0x2bff('0xb7')],_0x3d5f50[_0x2bff('0xb2')],_0x3d5f50[_0x2bff('0x16a')],_0x3d5f50[_0x2bff('0x16b')],'',_0x3d5f50['position']]);if(_0x18097c['result']===-0x1){return _0x18097c;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x163'),_0x2bff('0x169'),_0x5e247c));};AGIVertices[_0x2bff('0xe')][_0x2bff('0x16c')]=function(_0x514e5e){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x16d'),_0x514e5e[_0x2bff('0x37')]));var _0x4e014a=_0x514e5e[_0x2bff('0x16e')]||_0x2bff('0x12f');var _0x1f3817=util[_0x2bff('0x27')](_0x2bff('0x16f'),this['channel'][_0x2bff('0x36')],rs[_0x2bff('0x117')](0x5));var _0x7d23f=util['format'](_0x2bff('0x170'),FILES_PATH,_0x1f3817,_0x4e014a);var _0x2d9392=util['format'](_0x2bff('0x126'),FILES_PATH,_0x1f3817);this[_0x2bff('0x3b')][_0x2bff('0x6c')](this,_0x514e5e,_0x1f3817,_0x7d23f);this[_0x2bff('0x35')][_0x2bff('0x9c')](_0x2bff('0x171'),_0x1f3817);logger[_0x2bff('0x2a')](_0x2bff('0x172'),_0x2d9392,_0x4e014a,_0x514e5e[_0x2bff('0x173')],_0x514e5e[_0x2bff('0xb7')]);return this[_0x2bff('0x35')]['recordFile'](_0x2d9392,_0x4e014a,_0x514e5e[_0x2bff('0x173')],_0x514e5e[_0x2bff('0xb7')],undefined,!![]);};AGIVertices[_0x2bff('0xe')][_0x2bff('0x174')]=function(_0x475e48){logger[_0x2bff('0x2a')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x475e48['label']));if(!this['isConfigured'](_0x475e48[_0x2bff('0x61')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0x175'));}var _0x39fa02=this[_0x2bff('0x60')][_0x2bff('0x6c')](this,_0x475e48);logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x176'),util[_0x2bff('0x177')](_0x39fa02,{'showHidden':![],'depth':null})));if(!this[_0x2bff('0xa1')](_0x475e48['variable_id'])){return this['channel'][_0x2bff('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x51398f=this['getVariable'][_0x2bff('0x6c')](this,_0x475e48[_0x2bff('0xd2')]);if(!_0x51398f){return this['channel'][_0x2bff('0x2f')](_0x475e48,_0x2bff('0xd4'));}this['channel'][_0x2bff('0x9c')](util[_0x2bff('0x27')](_0x2bff('0x178'),_0x51398f),_0x39fa02['statusCode']?_0x39fa02[_0x2bff('0x71')]:_0x2bff('0x179'));this[_0x2bff('0x35')][_0x2bff('0x9c')](util[_0x2bff('0x27')]('%s_STATUS_MESSAGE',_0x51398f),_0x39fa02['statusMessage']?_0x39fa02[_0x2bff('0x72')]:'OK');if(_0x39fa02[_0x2bff('0x6f')]){try{this[_0x2bff('0x9a')](_0x39fa02[_0x2bff('0x6f')],_0x51398f);}catch(_0x5f275d){logger[_0x2bff('0x2f')](util[_0x2bff('0x27')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x51398f));}}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0xd8'),_0x51398f));};AGIVertices[_0x2bff('0xe')]['saydigits']=function(_0x343016){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x17a'),_0x343016['label']));return this[_0x2bff('0x35')]['sayDigits'](_0x343016[_0x2bff('0x17b')][_0x2bff('0x58')](/\s+/g,''),_0x343016['escape_digits']);};AGIVertices[_0x2bff('0xe')][_0x2bff('0x17c')]=function(_0x120573){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x120573[_0x2bff('0x37')]));return this['channel'][_0x2bff('0x17d')](_0x120573[_0x2bff('0x63')][_0x2bff('0x58')](/\s+/g,''),_0x120573[_0x2bff('0x173')]);};AGIVertices[_0x2bff('0xe')]['sayphonetic']=function(_0x463bbf){logger[_0x2bff('0x2a')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x463bbf[_0x2bff('0x37')]));return this[_0x2bff('0x35')][_0x2bff('0x17e')](_0x463bbf[_0x2bff('0x5c')],_0x463bbf['escape_digits']);};AGIVertices[_0x2bff('0xe')][_0x2bff('0x17f')]=function(_0x2f485d){logger['info'](util['format'](_0x2bff('0x180'),_0x2f485d['label']));if(!this['isConfigured'](_0x2f485d[_0x2bff('0x181')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0x182'));}var _0x2622ef=this[_0x2bff('0x1f')][_0x2bff('0x6c')](this,_0x2f485d['account_id']);if(!_0x2622ef||!_0x2622ef[_0x2bff('0x183')]){return this['channel'][_0x2bff('0x2f')](_0x2f485d,'no\x20mail\x20account\x20found');}var _0xbf4bec={'from':util[_0x2bff('0x27')](_0x2bff('0x184'),_0x2622ef[_0x2bff('0x1a')],_0x2622ef['email']||_0x2622ef[_0x2bff('0x183')][_0x2bff('0x185')]),'to':_0x2f485d['to']||'','cc':_0x2f485d['cc']||'','bcc':_0x2f485d[_0x2bff('0x186')]||'','subject':_0x2f485d['subject'],'html':_0x2f485d['text'],'text':_0x2f485d['text']};if(this[_0x2bff('0xa1')](_0x2f485d[_0x2bff('0x187')])){}logger[_0x2bff('0x188')](_0x2bff('0x189'),JSON['stringify'](_0xbf4bec));this[_0x2bff('0x34')][_0x2bff('0x6c')](this,_0x2f485d,_0x2f485d['account_id']);this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x2622ef['name']));this[_0x2bff('0x20')][_0x2bff('0x6c')](this,_0x2622ef['smtpOptions'],_0xbf4bec);return this[_0x2bff('0x35')]['noop'](_0x2bff('0x18a'));};AGIVertices[_0x2bff('0xe')]['sendFax']=function(_0x487dbe){logger[_0x2bff('0x2a')](util['format'](_0x2bff('0x18b'),_0x487dbe['label']));return this['channel'][_0x2bff('0xa5')](_0x2bff('0x18c'));};AGIVertices[_0x2bff('0xe')]['sendSMS']=function(_0x26a547){logger['info'](util[_0x2bff('0x27')](_0x2bff('0x18d'),_0x26a547['label']));if(!this[_0x2bff('0xa1')](_0x26a547[_0x2bff('0x18e')])){return this[_0x2bff('0x35')][_0x2bff('0xa5')]('no\x20sms\x20account\x20configured');}var _0x3601ed=this[_0x2bff('0x31')]['sync'](this,_0x26a547[_0x2bff('0x18e')]);if(!_0x3601ed){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x26a547,_0x2bff('0x18f'));}var _0x3fbed6={'body':_0x26a547[_0x2bff('0x190')],'phone':_0x26a547['to']||'','SmsAccountId':_0x3601ed['id']};logger[_0x2bff('0x188')](_0x2bff('0x191'),JSON[_0x2bff('0x111')](_0x3fbed6));this[_0x2bff('0x34')][_0x2bff('0x6c')](this,_0x26a547,_0x26a547[_0x2bff('0x18e')]);this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')](_0x2bff('0x192'),_0x3601ed[_0x2bff('0x1a')]));this[_0x2bff('0x33')][_0x2bff('0x6c')](this,_0x3fbed6);return this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0x193'));};AGIVertices[_0x2bff('0xe')]['set']=function(_0x52b99c){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x194'),_0x52b99c[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x52b99c[_0x2bff('0xd2')])){return this[_0x2bff('0x35')]['error'](_0x52b99c,_0x2bff('0x195'));}var _0x2db9aa=this[_0x2bff('0x113')][_0x2bff('0x6c')](this,_0x52b99c[_0x2bff('0xd2')]);if(!_0x2db9aa){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x52b99c,_0x2bff('0xd4'));}return this['channel']['setVariable'](_0x2db9aa,_0x52b99c[_0x2bff('0x196')]);};AGIVertices[_0x2bff('0xe')]['start']=function(_0x12ad57){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20START\x20(%s)\x20block',_0x12ad57[_0x2bff('0x37')]));this[_0x2bff('0x35')]['noop'](_0x2bff('0x197'));if(_0x12ad57['answer']==='yes'){this[_0x2bff('0x35')][_0x2bff('0xa5')](_0x2bff('0x198'));return this['channel'][_0x2bff('0xb5')]();}return this[_0x2bff('0x35')]['noop'](_0x2bff('0x199'));};AGIVertices[_0x2bff('0xe')][_0x2bff('0x19a')]=function(_0x4446cf){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x19b'),_0x4446cf[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x4446cf[_0x2bff('0x19c')])){return this[_0x2bff('0x35')]['error'](_0x4446cf,_0x2bff('0x19d'));}var _0x357f2=this[_0x2bff('0x15')]['sync'](this,_0x4446cf['project_id']);if(!this[_0x2bff('0xa1')](_0x357f2)){return this[_0x2bff('0x35')]['error'](_0x4446cf,util[_0x2bff('0x27')](_0x2bff('0x19e'),_0x4446cf[_0x2bff('0x19c')]));}if(_0x357f2===this[_0x2bff('0x35')]['arg_1']){return this[_0x2bff('0x35')]['error'](_0x4446cf,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x4446cf,_0x357f2);var _0x39ebc7=this[_0x2bff('0x35')][_0x2bff('0x57')](_0x2bff('0x19f'),util[_0x2bff('0x27')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x2bff('0xb2')]['host']||'127.0.0.1',_0x357f2,this['channel'][_0x2bff('0x39')]));if(_0x39ebc7['result']===-0x1){return _0x39ebc7;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x163'),'AGI',_0x357f2));};AGIVertices[_0x2bff('0xe')][_0x2bff('0x1a0')]=function(_0x2095b2){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x1a1'),_0x2095b2[_0x2bff('0x37')]));var _0x4bf58e=this[_0x2bff('0x56')][_0x2bff('0x6c')](this,_0x2095b2[_0x2bff('0x1a2')]);this[_0x2bff('0x34')][_0x2bff('0x6c')](this,_0x2095b2,_0x2095b2[_0x2bff('0x1a2')]);if(this[_0x2bff('0xa1')](_0x2095b2[_0x2bff('0xd2')])){var _0x34b3f1=this[_0x2bff('0x113')][_0x2bff('0x6c')](this,_0x2095b2[_0x2bff('0xd2')]);if(_0x34b3f1){this[_0x2bff('0x35')][_0x2bff('0x9c')](_0x34b3f1,_0x4bf58e);return this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')](_0x2bff('0x1a3'),_0x2095b2[_0x2bff('0x1a2')],_0x34b3f1));}}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x1a4'),_0x2095b2[_0x2bff('0x1a2')]));};AGIVertices[_0x2bff('0xe')]['google_cloud_tts']=function(_0x788705){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x1a5'),_0x788705[_0x2bff('0x37')]));_0x788705[_0x2bff('0x5c')]=_0x788705[_0x2bff('0x5c')][_0x2bff('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x788705[_0x2bff('0x5a')])){return this['channel'][_0x2bff('0xa5')](_0x2bff('0x1a6'));}if(!this[_0x2bff('0xa1')](_0x788705[_0x2bff('0x5c')])){return this[_0x2bff('0x35')]['noop']('no\x20text\x20configured');}this[_0x2bff('0x35')][_0x2bff('0xa5')](util['format'](_0x2bff('0x1a7'),_0x788705['text']));var _0x4a974f=this[_0x2bff('0x59')][_0x2bff('0x6c')](this,_0x788705);if(_0x4a974f){this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')](_0x2bff('0x1a8'),_0x4a974f));var _0x192435=this[_0x2bff('0x35')][_0x2bff('0xfe')](_0x4a974f);try{fs[_0x2bff('0x11e')](_0x4a974f+_0x2bff('0xff'));}catch(_0x545190){logger[_0x2bff('0x2f')](_0x545190);}return _0x192435;}return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x788705,_0x2bff('0x1a9'));};AGIVertices['prototype']['tts']=function(_0x20a2ee){logger[_0x2bff('0x2a')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x20a2ee['label']));_0x20a2ee['text']=_0x20a2ee['text'][_0x2bff('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2bff('0xa1')](_0x20a2ee[_0x2bff('0x5c')])){return this[_0x2bff('0x35')]['noop']('no\x20text\x20configured');}this[_0x2bff('0x35')][_0x2bff('0xa5')](util['format'](_0x2bff('0x1aa'),_0x20a2ee[_0x2bff('0x5c')]));var _0x3ded05=this[_0x2bff('0x5f')][_0x2bff('0x6c')](this,_0x20a2ee);if(_0x3ded05){this[_0x2bff('0x35')]['noop'](util[_0x2bff('0x27')](_0x2bff('0x1ab'),_0x3ded05));var _0x2f0110=this['channel'][_0x2bff('0xfe')](_0x3ded05);try{fs[_0x2bff('0x11e')](_0x3ded05+_0x2bff('0xff'));}catch(_0x5b716c){logger[_0x2bff('0x2f')](_0x5b716c);}return _0x2f0110;}return this[_0x2bff('0x35')]['error'](_0x20a2ee,_0x2bff('0x1ac'));};AGIVertices[_0x2bff('0xe')][_0x2bff('0x1ad')]=function(_0x4fde4){logger[_0x2bff('0x2a')](util['format'](_0x2bff('0x1ae'),_0x4fde4[_0x2bff('0x37')]));if(!this['isConfigured'](_0x4fde4[_0x2bff('0x14d')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x4fde4,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x2bff('0x14a'),this['channel'][_0x2bff('0x3a')],_0x4fde4[_0x2bff('0x14d')]));var _0x26ca99=this[_0x2bff('0x50')][_0x2bff('0x6c')](this,_0x4fde4[_0x2bff('0x14d')]);if(_0x26ca99){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')](_0x2bff('0x14c'),this[_0x2bff('0x35')]['callerid'],_0x4fde4[_0x2bff('0x14d')]));this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x14c'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x4fde4[_0x2bff('0x14d')]));return{'code':0xc8,'result':_0x2bff('0x1af')};}else{logger['info'](util[_0x2bff('0x27')](_0x2bff('0x14e'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x4fde4['findBy']));this[_0x2bff('0x35')][_0x2bff('0xa5')](util['format'](_0x2bff('0x14e'),this[_0x2bff('0x35')][_0x2bff('0x3a')],_0x4fde4[_0x2bff('0x14d')]));return{'code':0xc8,'result':_0x2bff('0x14f')};}};AGIVertices[_0x2bff('0xe')][_0x2bff('0x1b0')]=function(_0x33db64){logger['info'](util[_0x2bff('0x27')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x33db64[_0x2bff('0x37')]));var _0x5615ee=this['channel'][_0x2bff('0x57')](_0x2bff('0x1b1'),[_0x33db64[_0x2bff('0x1b2')],_0x33db64[_0x2bff('0x74')]]);if(_0x5615ee[_0x2bff('0x9f')]===-0x1){return _0x5615ee;}return this[_0x2bff('0x35')][_0x2bff('0xa5')](util[_0x2bff('0x27')](_0x2bff('0x163'),_0x2bff('0x1b1'),_0x33db64[_0x2bff('0x1b2')]));};AGIVertices[_0x2bff('0xe')][_0x2bff('0x1b3')]=function(_0x42d3ce){logger[_0x2bff('0x2a')](util[_0x2bff('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x42d3ce[_0x2bff('0x37')]));if(!this[_0x2bff('0xa1')](_0x42d3ce[_0x2bff('0xd2')])){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x42d3ce,_0x2bff('0x195'));}var _0x1566d9=this[_0x2bff('0x113')][_0x2bff('0x6c')](this,_0x42d3ce['variable_id']);if(!_0x1566d9){return this[_0x2bff('0x35')][_0x2bff('0x2f')](_0x42d3ce,_0x2bff('0xd4'));}var _0x2b45a8=this['channel'][_0x2bff('0x113')](_0x1566d9);return{'code':0xc8,'result':_0x2b45a8[_0x2bff('0xa0')]?_0x2b45a8[_0x2bff('0xa0')]:'-'};};String[_0x2bff('0xe')][_0x2bff('0x1b4')]=function(_0x180051,_0xe1387f){return this[_0x2bff('0x9d')](_0x180051)[_0x2bff('0x1b5')](_0xe1387f);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e7603b7..00f3a20 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 _0x2a85=['error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]'];(function(_0x198480,_0x574b93){var _0x58dff5=function(_0x370701){while(--_0x370701){_0x198480['push'](_0x198480['shift']());}};_0x58dff5(++_0x574b93);}(_0x2a85,0x1c5));var _0x52a8=function(_0x20c692,_0x454166){_0x20c692=_0x20c692-0x0;var _0x23d380=_0x2a85[_0x20c692];return _0x23d380;};'use strict';var _=require(_0x52a8('0x0'));var moment=require('moment');var ami=require(_0x52a8('0x1'));var logger=require(_0x52a8('0x2'))(_0x52a8('0x3'));var RpcUser=require(_0x52a8('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1d3f7e){this[_0x52a8('0x5')]=_0x1d3f7e[_0x52a8('0x5')];this[_0x52a8('0x6')]=_0x1d3f7e[_0x52a8('0x6')];this[_0x52a8('0x7')]=_0x1d3f7e[_0x52a8('0x7')];this[_0x52a8('0x8')]={};ami['on']('agentconnect',this[_0x52a8('0x9')][_0x52a8('0xa')](this));ami['on'](_0x52a8('0xb'),this['syncHangupRequest'][_0x52a8('0xa')](this));ami['on'](_0x52a8('0xc'),this[_0x52a8('0xd')][_0x52a8('0xa')](this));ami['on'](_0x52a8('0xe'),this['syncAgentRingNoAnswer'][_0x52a8('0xa')](this));ami['on'](_0x52a8('0xf'),this[_0x52a8('0x10')][_0x52a8('0xa')](this));ami['on'](_0x52a8('0x11'),this[_0x52a8('0x12')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0x52a8('0x13')][_0x52a8('0xa')](this));}function getDiff(_0x15a801){var _0x3181f6=moment()['milliseconds'](0x0);var _0x435d04=moment(_0x15a801)[_0x52a8('0x14')](0x0);return _0x3181f6[_0x52a8('0x15')](_0x435d04,_0x52a8('0x16'));}Acw[_0x52a8('0x17')]['startAcw']=function(_0x1a3d7c){try{var _0x50c45e=this;var _0x105d7d=this[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x18')];var _0xd88948=this[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x19')];var _0x197e88=this[_0x52a8('0x5')][_0xd88948];var _0x19dc78=![];var _0x2d256b=_0x52a8('0x1a');if(_0x197e88[_0x52a8('0x1b')]){if(_0x197e88[_0x52a8('0x1c')][_0x52a8('0x1d')]){_0x19dc78=!![];_0x2d256b=_0x197e88[_0x52a8('0x1c')][_0x52a8('0x1d')];}}return ami['Action']({'action':'QueuePause','interface':_0x105d7d,'paused':!![],'reason':_0x2d256b})[_0x52a8('0x1e')](function(){if(_0x50c45e[_0x52a8('0x6')][_0x105d7d]){return RpcUser[_0x52a8('0x1f')](_0x50c45e[_0x52a8('0x6')][_0x105d7d]['id'])['then'](function(_0x5eb085){if(_0x5eb085&&!_0x5eb085[_0x52a8('0x20')]){logger[_0x52a8('0x21')](_0x52a8('0x22'),_0x1a3d7c,_0x105d7d,_0xd88948);var _0xf312dc=_0x50c45e[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x23')]&&_0x50c45e[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x24')]?_0x50c45e[_0x52a8('0x8')][_0x1a3d7c][_0x52a8('0x24')]:_0x1a3d7c;return RpcUser[_0x52a8('0x25')](_0x50c45e[_0x52a8('0x6')][_0x105d7d],_0x2d256b,_0xf312dc)[_0x52a8('0x1e')](function(){if(!_0x19dc78){_0x50c45e[_0x52a8('0x7')][_0x105d7d]={};logger[_0x52a8('0x21')](_0x52a8('0x26'),_0x1a3d7c,_0x50c45e[_0x52a8('0x5')][_0xd88948][_0x52a8('0x27')],_0x105d7d,_0xd88948);_0x50c45e['timers'][_0x105d7d][_0x52a8('0x28')]=setTimeout(_0x50c45e[_0x52a8('0x29')][_0x52a8('0xa')](_0x50c45e,_0x105d7d),_0x50c45e[_0x52a8('0x5')][_0xd88948]['acwTimeout']*0x3e8);_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x2a')]=moment()[_0x52a8('0x2b')](_0x52a8('0x2c'));_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x2d')]=_0x1a3d7c;_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x19')]=_0xd88948;_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x2e')]=function(){var _0xb1e440=getDiff(_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x2a')]);clearTimeout(_0x50c45e['timers'][_0x105d7d][_0x52a8('0x28')]);_0x50c45e[_0x52a8('0x7')][_0x105d7d][_0x52a8('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0xb1e440},_0x50c45e[_0x52a8('0x7')][_0x105d7d]['uniqueid'],_0x105d7d)[_0x52a8('0x1e')](function(_0x1be118){logger[_0x52a8('0x21')](_0x52a8('0x2f'),_0x1a3d7c,_0xb1e440,_0x1be118);})[_0x52a8('0x30')](function(_0x193063){logger['error'](_0x52a8('0x31'),_0x1a3d7c,_0x193063);});delete _0x50c45e[_0x52a8('0x7')][_0x105d7d];};}});}else{logger[_0x52a8('0x21')](_0x52a8('0x32'),_0x1a3d7c,_0x105d7d,_0xd88948);}});}})[_0x52a8('0x30')](function(){logger[_0x52a8('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1a3d7c,_0x50c45e[_0x52a8('0x5')][_0xd88948][_0x52a8('0x27')],_0x105d7d,_0xd88948);})[_0x52a8('0x34')](function(){delete _0x50c45e[_0x52a8('0x8')][_0x1a3d7c];});}catch(_0x5867e2){logger['error'](_0x52a8('0x35'),_0x5867e2[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')][_0x52a8('0x29')]=function(_0x5ea77d){try{var _0x3efa43=this;if(_0x3efa43['timers'][_0x5ea77d]){_0x3efa43[_0x52a8('0x7')][_0x5ea77d][_0x52a8('0x28')]=![];var _0x5d13b1=_0x3efa43[_0x52a8('0x7')][_0x5ea77d]['uniqueid'];var _0x262599=_0x3efa43[_0x52a8('0x7')][_0x5ea77d][_0x52a8('0x19')];var _0x36d6ea=_0x3efa43[_0x52a8('0x5')][_0x262599][_0x52a8('0x27')];logger[_0x52a8('0x21')](_0x52a8('0x37'),_0x5d13b1,_0x5ea77d);RpcUser[_0x52a8('0x38')](this[_0x52a8('0x6')][_0x5ea77d]);RpcVoiceAgentReport[_0x52a8('0x39')]({'acwtime':_0x36d6ea,'agentacw':!![]},_0x5d13b1,_0x5ea77d)[_0x52a8('0x1e')](function(_0x338cb0){logger[_0x52a8('0x21')](_0x52a8('0x2f'),_0x5d13b1,_0x36d6ea,_0x338cb0);})['catch'](function(_0x503bdf){logger[_0x52a8('0x33')](_0x52a8('0x31'),_0x5d13b1,_0x503bdf);});}else{logger[_0x52a8('0x33')](_0x52a8('0x3a'),_0x5ea77d);if(_0x3efa43[_0x52a8('0x7')]){logger[_0x52a8('0x21')](_0x52a8('0x3b'),JSON[_0x52a8('0x3c')](_0x3efa43[_0x52a8('0x7')]));}}}catch(_0x55eead){logger['error'](_0x52a8('0x3d'),_0x55eead[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')][_0x52a8('0x9')]=function(_0x40ff3e){try{if(this['voiceQueues'][_0x40ff3e['queue']]&&(this['voiceQueues'][_0x40ff3e[_0x52a8('0x19')]]['acw']||this[_0x52a8('0x5')][_0x40ff3e[_0x52a8('0x19')]][_0x52a8('0x1b')])){if(this[_0x52a8('0x6')][_0x40ff3e['interface']]){this[_0x52a8('0x8')][_0x40ff3e[_0x52a8('0x2d')]]={'queue':_0x40ff3e[_0x52a8('0x19')],'interface':_0x40ff3e[_0x52a8('0x18')],'destlinkedid':_0x40ff3e[_0x52a8('0x24')]};}}}catch(_0x215ab3){logger['error'](_0x52a8('0x3e'),_0x215ab3[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')]['syncAgentConnectPreview']=function(_0x2965ba){try{if(this[_0x52a8('0x5')][_0x2965ba[_0x52a8('0x19')]]&&(this['voiceQueues'][_0x2965ba[_0x52a8('0x19')]]['acw']||this[_0x52a8('0x5')][_0x2965ba[_0x52a8('0x19')]][_0x52a8('0x1b')])){if(this['agents'][_0x2965ba[_0x52a8('0x18')]]){this[_0x52a8('0x8')][_0x2965ba[_0x52a8('0x2d')]]={'queue':_0x2965ba[_0x52a8('0x19')],'interface':_0x2965ba[_0x52a8('0x18')]};}}}catch(_0x1c2ccf){logger[_0x52a8('0x33')](_0x52a8('0x3f'),_0x1c2ccf[_0x52a8('0x36')]);}};Acw['prototype'][_0x52a8('0x40')]=function(_0xb4a40e){try{if(this[_0x52a8('0x8')][_0xb4a40e['uniqueid']]&&_[_0x52a8('0x41')](this[_0x52a8('0x8')][_0xb4a40e[_0x52a8('0x2d')]][_0x52a8('0x23')])){logger[_0x52a8('0x21')](_0x52a8('0x42'),_0xb4a40e[_0x52a8('0x2d')]);this['startAcw'](_0xb4a40e[_0x52a8('0x2d')]);}else if(this[_0x52a8('0x8')][_0xb4a40e[_0x52a8('0x43')]]&&_[_0x52a8('0x41')](this[_0x52a8('0x8')][_0xb4a40e['linkedid']][_0x52a8('0x23')])){logger[_0x52a8('0x21')](_0x52a8('0x44'),_0xb4a40e['linkedid']);this[_0x52a8('0x45')](_0xb4a40e['linkedid']);}}catch(_0x5d8728){logger['error'](_0x52a8('0x46'),_0x5d8728[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')][_0x52a8('0xd')]=function(_0x2b0aef){try{if(this[_0x52a8('0x8')][_0x2b0aef['uniqueid']]&&this[_0x52a8('0x8')][_0x2b0aef['uniqueid']][_0x52a8('0x23')]){logger[_0x52a8('0x21')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2b0aef[_0x52a8('0x2d')]);this['startAcw'](_0x2b0aef[_0x52a8('0x2d')]);}else if(this['channels'][_0x2b0aef['linkedid']]&&this['channels'][_0x2b0aef[_0x52a8('0x43')]][_0x52a8('0x23')]){logger[_0x52a8('0x21')](_0x52a8('0x47'),_0x2b0aef[_0x52a8('0x43')]);this[_0x52a8('0x45')](_0x2b0aef['linkedid']);}}catch(_0x1b3bce){logger[_0x52a8('0x33')]('[ACW][syncHangup]\x20%s',_0x1b3bce[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')]['syncAttendedTransfer']=function(_0x4164b6){try{if(!_['isNil'](this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x48')]])){this['startAcw'](_0x4164b6['transfereeuniqueid']);if(this['channels'][_0x4164b6[_0x52a8('0x49')]]){this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x49')]]['attended']=!![];this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x4a')]]=this['channels'][_0x4164b6[_0x52a8('0x49')]];delete this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x49')]];}}else if(!_['isNil'](this[_0x52a8('0x8')][_0x4164b6['transfertargetuniqueid']])){this[_0x52a8('0x45')](_0x4164b6[_0x52a8('0x4a')]);if(this[_0x52a8('0x8')][_0x4164b6[_0x52a8('0x4b')]]){this['channels'][_0x4164b6[_0x52a8('0x4b')]][_0x52a8('0x23')]=!![];this[_0x52a8('0x8')][_0x4164b6['transfereeuniqueid']]=this[_0x52a8('0x8')][_0x4164b6['origtransfereruniqueid']];delete this[_0x52a8('0x8')][_0x4164b6['origtransfereruniqueid']];}}}catch(_0x125db2){logger['error'](_0x52a8('0x4c'),_0x125db2[_0x52a8('0x36')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x469a9f){try{if(this[_0x52a8('0x8')][_0x469a9f[_0x52a8('0x4d')]]){logger[_0x52a8('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x52a8('0x3c')](_0x469a9f[_0x52a8('0x4d')]));this['startAcw'](_0x469a9f['transfereruniqueid']);}else if(this[_0x52a8('0x8')][_0x469a9f[_0x52a8('0x4e')]]){logger['info'](_0x52a8('0x4f'),JSON[_0x52a8('0x3c')](_0x469a9f[_0x52a8('0x4e')]));this[_0x52a8('0x45')](_0x469a9f['transfererlinkedid']);}}catch(_0x5d0e40){logger[_0x52a8('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x5d0e40[_0x52a8('0x36')]);}};Acw[_0x52a8('0x17')]['syncAgentRingNoAnswer']=function(_0x2a69ea){try{if(this[_0x52a8('0x5')][_0x2a69ea['queue']]&&this['voiceQueues'][_0x2a69ea[_0x52a8('0x19')]][_0x52a8('0x50')]==='all'){if(this['agents'][_0x2a69ea[_0x52a8('0x18')]]){logger['info'](_0x52a8('0x51'),_0x2a69ea[_0x52a8('0x2d')],_0x2a69ea['interface'],_0x2a69ea[_0x52a8('0x19')]);return RpcUser[_0x52a8('0x25')](this[_0x52a8('0x6')][_0x2a69ea[_0x52a8('0x18')]],_0x52a8('0x52'),_0x2a69ea[_0x52a8('0x2d')]);}}}catch(_0x42d6d3){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x42d6d3[_0x52a8('0x36')]);}};module[_0x52a8('0x53')]=Acw; \ No newline at end of file +var _0x548a=['autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','acwTimeout','timer','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s'];(function(_0x32dc73,_0x551418){var _0x427061=function(_0x4d510d){while(--_0x4d510d){_0x32dc73['push'](_0x32dc73['shift']());}};_0x427061(++_0x551418);}(_0x548a,0x15e));var _0xa548=function(_0x5479c6,_0x3a2d65){_0x5479c6=_0x5479c6-0x0;var _0xd4faba=_0x548a[_0x5479c6];return _0xd4faba;};'use strict';var _=require(_0xa548('0x0'));var moment=require(_0xa548('0x1'));var ami=require(_0xa548('0x2'));var logger=require(_0xa548('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xa548('0x4'));function Acw(_0x4c3156){this[_0xa548('0x5')]=_0x4c3156[_0xa548('0x5')];this['agents']=_0x4c3156[_0xa548('0x6')];this['timers']=_0x4c3156[_0xa548('0x7')];this[_0xa548('0x8')]={};ami['on'](_0xa548('0x9'),this[_0xa548('0xa')][_0xa548('0xb')](this));ami['on'](_0xa548('0xc'),this['syncHangupRequest'][_0xa548('0xb')](this));ami['on'](_0xa548('0xd'),this[_0xa548('0xe')][_0xa548('0xb')](this));ami['on'](_0xa548('0xf'),this[_0xa548('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0xa548('0x11')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on'](_0xa548('0x12'),this[_0xa548('0x13')][_0xa548('0xb')](this));}function getDiff(_0x3019fb){var _0x16de63=moment()['milliseconds'](0x0);var _0x30f2ad=moment(_0x3019fb)[_0xa548('0x14')](0x0);return _0x16de63['diff'](_0x30f2ad,_0xa548('0x15'));}Acw[_0xa548('0x16')][_0xa548('0x17')]=function(_0x3952c9){try{var _0x24b166=this;var _0x20a6b3=this[_0xa548('0x8')][_0x3952c9][_0xa548('0x18')];var _0x433e32=this['channels'][_0x3952c9]['queue'];var _0x269e6a=this[_0xa548('0x5')][_0x433e32];var _0x562295=![];var _0x2b5594=_0xa548('0x19');if(_0x269e6a[_0xa548('0x1a')]){if(_0x269e6a['mandatoryDispositionPause'][_0xa548('0x1b')]){_0x562295=!![];_0x2b5594=_0x269e6a[_0xa548('0x1c')][_0xa548('0x1b')];}}return ami[_0xa548('0x1d')]({'action':_0xa548('0x1e'),'interface':_0x20a6b3,'paused':!![],'reason':_0x2b5594})['then'](function(){if(_0x24b166['agents'][_0x20a6b3]){return RpcUser[_0xa548('0x1f')](_0x24b166[_0xa548('0x6')][_0x20a6b3]['id'])[_0xa548('0x20')](function(_0x2cb5f3){if(_0x2cb5f3&&!_0x2cb5f3[_0xa548('0x21')]){logger[_0xa548('0x22')](_0xa548('0x23'),_0x3952c9,_0x20a6b3,_0x433e32);var _0x42e1e3=_0x24b166['channels'][_0x3952c9][_0xa548('0x24')]&&_0x24b166[_0xa548('0x8')][_0x3952c9][_0xa548('0x25')]?_0x24b166['channels'][_0x3952c9][_0xa548('0x25')]:_0x3952c9;return RpcUser['savePause'](_0x24b166[_0xa548('0x6')][_0x20a6b3],_0x2b5594,_0x42e1e3)[_0xa548('0x20')](function(){if(!_0x562295){_0x24b166['timers'][_0x20a6b3]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3952c9,_0x24b166[_0xa548('0x5')][_0x433e32][_0xa548('0x26')],_0x20a6b3,_0x433e32);_0x24b166[_0xa548('0x7')][_0x20a6b3][_0xa548('0x27')]=setTimeout(_0x24b166[_0xa548('0x28')]['bind'](_0x24b166,_0x20a6b3),_0x24b166[_0xa548('0x5')][_0x433e32][_0xa548('0x26')]*0x3e8);_0x24b166[_0xa548('0x7')][_0x20a6b3][_0xa548('0x29')]=moment()['format'](_0xa548('0x2a'));_0x24b166[_0xa548('0x7')][_0x20a6b3][_0xa548('0x2b')]=_0x3952c9;_0x24b166[_0xa548('0x7')][_0x20a6b3][_0xa548('0x2c')]=_0x433e32;_0x24b166[_0xa548('0x7')][_0x20a6b3]['updateAcw']=function(){var _0x5ae37d=getDiff(_0x24b166[_0xa548('0x7')][_0x20a6b3]['lastPauseAt']);clearTimeout(_0x24b166[_0xa548('0x7')][_0x20a6b3][_0xa548('0x27')]);_0x24b166[_0xa548('0x7')][_0x20a6b3][_0xa548('0x27')]=![];RpcVoiceAgentReport[_0xa548('0x2d')]({'acwtime':_0x5ae37d},_0x24b166[_0xa548('0x7')][_0x20a6b3][_0xa548('0x2b')],_0x20a6b3)[_0xa548('0x20')](function(_0x22dad9){logger[_0xa548('0x22')](_0xa548('0x2e'),_0x3952c9,_0x5ae37d,_0x22dad9);})['catch'](function(_0x5f573f){logger[_0xa548('0x2f')](_0xa548('0x30'),_0x3952c9,_0x5f573f);});delete _0x24b166[_0xa548('0x7')][_0x20a6b3];};}});}else{logger['info'](_0xa548('0x31'),_0x3952c9,_0x20a6b3,_0x433e32);}});}})['catch'](function(){logger['error'](_0xa548('0x32'),_0x3952c9,_0x24b166[_0xa548('0x5')][_0x433e32]['acwTimeout'],_0x20a6b3,_0x433e32);})[_0xa548('0x33')](function(){delete _0x24b166[_0xa548('0x8')][_0x3952c9];});}catch(_0x35cf49){logger[_0xa548('0x2f')]('[ACW][START]\x20%s',_0x35cf49[_0xa548('0x34')]);}};Acw[_0xa548('0x16')][_0xa548('0x28')]=function(_0x19d6c8){try{var _0x25aa0f=this;if(_0x25aa0f[_0xa548('0x7')][_0x19d6c8]){_0x25aa0f[_0xa548('0x7')][_0x19d6c8][_0xa548('0x27')]=![];var _0x32a06f=_0x25aa0f['timers'][_0x19d6c8][_0xa548('0x2b')];var _0x3b80f=_0x25aa0f[_0xa548('0x7')][_0x19d6c8][_0xa548('0x2c')];var _0x2b21b8=_0x25aa0f['voiceQueues'][_0x3b80f][_0xa548('0x26')];logger[_0xa548('0x22')](_0xa548('0x35'),_0x32a06f,_0x19d6c8);RpcUser[_0xa548('0x36')](this['agents'][_0x19d6c8]);RpcVoiceAgentReport[_0xa548('0x2d')]({'acwtime':_0x2b21b8,'agentacw':!![]},_0x32a06f,_0x19d6c8)['then'](function(_0x757f40){logger[_0xa548('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x32a06f,_0x2b21b8,_0x757f40);})['catch'](function(_0x1fce0f){logger[_0xa548('0x2f')](_0xa548('0x30'),_0x32a06f,_0x1fce0f);});}else{logger[_0xa548('0x2f')](_0xa548('0x37'),_0x19d6c8);if(_0x25aa0f[_0xa548('0x7')]){logger[_0xa548('0x22')]('[ACW][TIMERS]',JSON[_0xa548('0x38')](_0x25aa0f[_0xa548('0x7')]));}}}catch(_0x159b60){logger[_0xa548('0x2f')](_0xa548('0x39'),_0x159b60['message']);}};Acw[_0xa548('0x16')][_0xa548('0xa')]=function(_0x1bf364){try{if(this[_0xa548('0x5')][_0x1bf364[_0xa548('0x2c')]]&&(this[_0xa548('0x5')][_0x1bf364[_0xa548('0x2c')]][_0xa548('0x3a')]||this['voiceQueues'][_0x1bf364[_0xa548('0x2c')]][_0xa548('0x1a')])){if(this[_0xa548('0x6')][_0x1bf364['interface']]){this[_0xa548('0x8')][_0x1bf364['uniqueid']]={'queue':_0x1bf364['queue'],'interface':_0x1bf364[_0xa548('0x18')],'destlinkedid':_0x1bf364[_0xa548('0x25')]};}}}catch(_0x371316){logger['error'](_0xa548('0x3b'),_0x371316[_0xa548('0x34')]);}};Acw[_0xa548('0x16')][_0xa548('0x13')]=function(_0x26ff8b){try{if(this[_0xa548('0x5')][_0x26ff8b[_0xa548('0x2c')]]&&(this[_0xa548('0x5')][_0x26ff8b['queue']][_0xa548('0x3a')]||this[_0xa548('0x5')][_0x26ff8b[_0xa548('0x2c')]][_0xa548('0x1a')])){if(this['agents'][_0x26ff8b['interface']]){this['channels'][_0x26ff8b['uniqueid']]={'queue':_0x26ff8b[_0xa548('0x2c')],'interface':_0x26ff8b[_0xa548('0x18')]};}}}catch(_0x2951b9){logger[_0xa548('0x2f')](_0xa548('0x3c'),_0x2951b9[_0xa548('0x34')]);}};Acw['prototype'][_0xa548('0x3d')]=function(_0x148288){try{if(this[_0xa548('0x8')][_0x148288['uniqueid']]&&_[_0xa548('0x3e')](this[_0xa548('0x8')][_0x148288[_0xa548('0x2b')]]['attended'])){logger[_0xa548('0x22')]('[%s][HANGUP:UNIQUEID]',_0x148288[_0xa548('0x2b')]);this[_0xa548('0x17')](_0x148288[_0xa548('0x2b')]);}else if(this['channels'][_0x148288[_0xa548('0x3f')]]&&_[_0xa548('0x3e')](this['channels'][_0x148288[_0xa548('0x3f')]][_0xa548('0x24')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x148288[_0xa548('0x3f')]);this[_0xa548('0x17')](_0x148288[_0xa548('0x3f')]);}}catch(_0x5522db){logger[_0xa548('0x2f')](_0xa548('0x40'),_0x5522db[_0xa548('0x34')]);}};Acw[_0xa548('0x16')][_0xa548('0xe')]=function(_0x53a59f){try{if(this[_0xa548('0x8')][_0x53a59f[_0xa548('0x2b')]]&&this[_0xa548('0x8')][_0x53a59f['uniqueid']]['attended']){logger[_0xa548('0x22')](_0xa548('0x41'),_0x53a59f[_0xa548('0x2b')]);this[_0xa548('0x17')](_0x53a59f[_0xa548('0x2b')]);}else if(this[_0xa548('0x8')][_0x53a59f[_0xa548('0x3f')]]&&this['channels'][_0x53a59f['linkedid']][_0xa548('0x24')]){logger[_0xa548('0x22')](_0xa548('0x42'),_0x53a59f['linkedid']);this['startAcw'](_0x53a59f[_0xa548('0x3f')]);}}catch(_0x103d46){logger[_0xa548('0x2f')](_0xa548('0x43'),_0x103d46['message']);}};Acw[_0xa548('0x16')][_0xa548('0x11')]=function(_0x352c36){try{if(!_[_0xa548('0x44')](this[_0xa548('0x8')][_0x352c36[_0xa548('0x45')]])){this[_0xa548('0x17')](_0x352c36[_0xa548('0x45')]);if(this['channels'][_0x352c36['secondtransfereruniqueid']]){this[_0xa548('0x8')][_0x352c36['secondtransfereruniqueid']][_0xa548('0x24')]=!![];this['channels'][_0x352c36[_0xa548('0x46')]]=this[_0xa548('0x8')][_0x352c36['secondtransfereruniqueid']];delete this[_0xa548('0x8')][_0x352c36[_0xa548('0x47')]];}}else if(!_[_0xa548('0x44')](this[_0xa548('0x8')][_0x352c36[_0xa548('0x46')]])){this[_0xa548('0x17')](_0x352c36[_0xa548('0x46')]);if(this[_0xa548('0x8')][_0x352c36[_0xa548('0x48')]]){this[_0xa548('0x8')][_0x352c36[_0xa548('0x48')]][_0xa548('0x24')]=!![];this[_0xa548('0x8')][_0x352c36[_0xa548('0x45')]]=this[_0xa548('0x8')][_0x352c36[_0xa548('0x48')]];delete this[_0xa548('0x8')][_0x352c36['origtransfereruniqueid']];}}}catch(_0x12ef41){logger[_0xa548('0x2f')](_0xa548('0x49'),_0x12ef41[_0xa548('0x34')]);}};Acw[_0xa548('0x16')][_0xa548('0x4a')]=function(_0x4279f4){try{if(this[_0xa548('0x8')][_0x4279f4[_0xa548('0x4b')]]){logger[_0xa548('0x22')](_0xa548('0x4c'),JSON['stringify'](_0x4279f4[_0xa548('0x4b')]));this['startAcw'](_0x4279f4[_0xa548('0x4b')]);}else if(this[_0xa548('0x8')][_0x4279f4[_0xa548('0x4d')]]){logger['info'](_0xa548('0x4e'),JSON['stringify'](_0x4279f4[_0xa548('0x4d')]));this[_0xa548('0x17')](_0x4279f4[_0xa548('0x4d')]);}}catch(_0x9dac8e){logger['error'](_0xa548('0x4f'),_0x9dac8e[_0xa548('0x34')]);}};Acw[_0xa548('0x16')][_0xa548('0x10')]=function(_0x46438f){try{if(this[_0xa548('0x5')][_0x46438f['queue']]&&this['voiceQueues'][_0x46438f['queue']][_0xa548('0x50')]===_0xa548('0x51')){if(this['agents'][_0x46438f[_0xa548('0x18')]]){logger['info'](_0xa548('0x52'),_0x46438f['uniqueid'],_0x46438f[_0xa548('0x18')],_0x46438f['queue']);return RpcUser[_0xa548('0x53')](this[_0xa548('0x6')][_0x46438f[_0xa548('0x18')]],_0xa548('0x54'),_0x46438f['uniqueid']);}}}catch(_0x2b09e7){logger[_0xa548('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2b09e7[_0xa548('0x34')]);}};module[_0xa548('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9b32114..8f48d57 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 _0xb3ed=['../../config/logger','../../config/environment','asterisk','username','password','Action','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','port','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionCoreShowChannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','actionQueueSummary','asterisk-manager','bluebird','util'];(function(_0x2cccd2,_0x21654c){var _0x9e9cf1=function(_0x232600){while(--_0x232600){_0x2cccd2['push'](_0x2cccd2['shift']());}};_0x9e9cf1(++_0x21654c);}(_0xb3ed,0x13d));var _0xdb3e=function(_0x57be54,_0x5d087b){_0x57be54=_0x57be54-0x0;var _0x5f5893=_0xb3ed[_0x57be54];return _0x5f5893;};'use strict';var Manager=require(_0xdb3e('0x0'));var BPromise=require(_0xdb3e('0x1'));var util=require(_0xdb3e('0x2'));var logger=require(_0xdb3e('0x3'))('ami');var config=require(_0xdb3e('0x4'));var ami=new Manager(config[_0xdb3e('0x5')]['port'],config['asterisk']['ip'],config[_0xdb3e('0x5')][_0xdb3e('0x6')],config['asterisk'][_0xdb3e('0x7')],!![]);ami['keepConnected']();ami[_0xdb3e('0x8')]=BPromise[_0xdb3e('0x9')](ami['action']);function error(_0x35247d){logger[_0xdb3e('0xa')](util['format'](_0xdb3e('0xb'),config[_0xdb3e('0x5')][_0xdb3e('0x6')],config['asterisk']['ip'],config[_0xdb3e('0x5')]['port'],util[_0xdb3e('0xc')](_0x35247d,![],null)));}function close(){logger[_0xdb3e('0xa')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xdb3e('0x5')]['ip'],config[_0xdb3e('0x5')][_0xdb3e('0xd')]));}ami[_0xdb3e('0xe')]=function(){return function(){return ami[_0xdb3e('0x8')]({'action':_0xdb3e('0xf')});};};ami[_0xdb3e('0x10')]=function(){return function(){return ami['Action']({'action':_0xdb3e('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xdb3e('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0xdb3e('0x13')]=function(){return function(){return ami[_0xdb3e('0x8')]({'action':'coreshowchannels'});};};function connect(){logger[_0xdb3e('0x14')](util[_0xdb3e('0x15')](_0xdb3e('0x16'),config['asterisk'][_0xdb3e('0x6')],config[_0xdb3e('0x5')]['ip'],config['asterisk']['port']));ami[_0xdb3e('0x17')](_0xdb3e('0xa'),error);ami[_0xdb3e('0x17')](_0xdb3e('0x18'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0xf24f6b){logger[_0xdb3e('0x14')](util[_0xdb3e('0x15')](_0xdb3e('0x19'),config[_0xdb3e('0x5')][_0xdb3e('0x6')],config[_0xdb3e('0x5')]['ip'],config[_0xdb3e('0x5')][_0xdb3e('0xd')],util[_0xdb3e('0xc')](_0xf24f6b,![],null)));});ami['on'](_0xdb3e('0x1a'),function(){logger[_0xdb3e('0x14')](util[_0xdb3e('0x15')](_0xdb3e('0x1b'),config[_0xdb3e('0x5')][_0xdb3e('0x6')],config[_0xdb3e('0x5')]['ip'],config[_0xdb3e('0x5')][_0xdb3e('0xd')]));return Promise[_0xdb3e('0x1c')]()['then'](ami[_0xdb3e('0xe')]())[_0xdb3e('0x1d')](ami[_0xdb3e('0x10')]())['then'](ami[_0xdb3e('0x1e')]())['then'](ami[_0xdb3e('0x1f')]())['then'](ami[_0xdb3e('0x13')]())['catch'](function(_0x1181f1){logger[_0xdb3e('0xa')]('[ami.js][fullybooted]',util[_0xdb3e('0xc')](_0x1181f1,{'showHidden':![],'depth':null}));});});ami['once'](_0xdb3e('0xa'),error);ami[_0xdb3e('0x17')](_0xdb3e('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0x8c82=['queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionDeviceStateList','catch','exports','asterisk-manager','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','devicestatelist','actionSipPeerStatus','actionQueueSummary'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8c82,0x19a));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require(_0x28c8('0x0'));var BPromise=require('bluebird');var util=require('util');var logger=require(_0x28c8('0x1'))(_0x28c8('0x2'));var config=require(_0x28c8('0x3'));var ami=new Manager(config[_0x28c8('0x4')][_0x28c8('0x5')],config[_0x28c8('0x4')]['ip'],config[_0x28c8('0x4')][_0x28c8('0x6')],config[_0x28c8('0x4')][_0x28c8('0x7')],!![]);ami[_0x28c8('0x8')]();ami[_0x28c8('0x9')]=BPromise['promisify'](ami[_0x28c8('0xa')]);function error(_0x4586d4){logger[_0x28c8('0xb')](util[_0x28c8('0xc')](_0x28c8('0xd'),config[_0x28c8('0x4')][_0x28c8('0x6')],config['asterisk']['ip'],config[_0x28c8('0x4')][_0x28c8('0x5')],util[_0x28c8('0xe')](_0x4586d4,![],null)));}function close(){logger[_0x28c8('0xb')](util[_0x28c8('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x28c8('0x4')]['username'],config['asterisk']['ip'],config[_0x28c8('0x4')][_0x28c8('0x5')]));}ami[_0x28c8('0xf')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x28c8('0x10')});};};ami[_0x28c8('0x11')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x28c8('0x12')]=function(){return function(){return ami[_0x28c8('0x9')]({'action':_0x28c8('0x13')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x28c8('0x9')]({'action':_0x28c8('0x14')});};};function connect(){logger[_0x28c8('0x15')](util[_0x28c8('0xc')](_0x28c8('0x16'),config[_0x28c8('0x4')]['username'],config[_0x28c8('0x4')]['ip'],config['asterisk'][_0x28c8('0x5')]));ami[_0x28c8('0x17')](_0x28c8('0xb'),error);ami['once'](_0x28c8('0x18'),close);}ami['on'](_0x28c8('0x19'),connect);ami['on'](_0x28c8('0x1a'),function(_0x11518d){logger[_0x28c8('0x15')](util[_0x28c8('0xc')](_0x28c8('0x1b'),config['asterisk'][_0x28c8('0x6')],config[_0x28c8('0x4')]['ip'],config[_0x28c8('0x4')][_0x28c8('0x5')],util[_0x28c8('0xe')](_0x11518d,![],null)));});ami['on']('fullybooted',function(){logger[_0x28c8('0x15')](util[_0x28c8('0xc')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0x28c8('0x4')][_0x28c8('0x5')]));return Promise[_0x28c8('0x1c')]()[_0x28c8('0x1d')](ami[_0x28c8('0xf')]())[_0x28c8('0x1d')](ami[_0x28c8('0x1e')]())[_0x28c8('0x1d')](ami[_0x28c8('0x11')]())[_0x28c8('0x1d')](ami[_0x28c8('0x12')]())['then'](ami['actionCoreShowChannels']())[_0x28c8('0x1f')](function(_0x576523){logger[_0x28c8('0xb')]('[ami.js][fullybooted]',util[_0x28c8('0xe')](_0x576523,{'showHidden':![],'depth':null}));});});ami[_0x28c8('0x17')](_0x28c8('0xb'),error);ami['once'](_0x28c8('0x18'),close);module[_0x28c8('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 803cc35..7fcbbb0 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x32e783,_0x192094){var _0x283241=function(_0x435eb5){while(--_0x435eb5){_0x32e783['push'](_0x32e783['shift']());}};_0x283241(++_0x192094);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xa1b0d4,_0xbeba0){_0xa1b0d4=_0xa1b0d4-0x0;var _0x19f06c=_0xbdb7[_0xa1b0d4];return _0x19f06c;};'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 +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x45595c,_0x35641d){var _0x37c5c3=function(_0x3948df){while(--_0x3948df){_0x45595c['push'](_0x45595c['shift']());}};_0x37c5c3(++_0x35641d);}(_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 logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c195632..93b53fa 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 _0x7f37=['checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','Failure','timezones','isArray','command','iftime\x20%s,%s','interval','content','indexOf','catch','Action','true','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','isGlobal','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','createHistory','moveContactManagedDialer','[syncAgentComplete]','type','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','dropreason','countabandonedretry','dialAbandonedRetryFrequency','verifyAdditionalPhones','dialAbandonedMaxRetry','rescheduleContact','ContactId','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','roundrobin','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','contactAgent-idHopper:\x20','isNil','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','membername','custom:amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','outboundAnswerAgiCallsDay','Machine','AMD','countmachineretry','amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','value','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countnoanswerretry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','object','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','getCallerId','Trunk','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','[rescheduleContact][Machine]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','checkContactEmpty','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','getContactDialer','RUNNING','[getContactDialer2]','tryOriginatePredictive','not_inuse','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','interval\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/queueCallerAbandon','env','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','stack','checkContactLowerLimitOriginate','error','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','prototype','active','SIP/%s','status','reachable','unmonitored'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7f37,0x197));var _0x77f3=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7f37[_0x5d6456];return _0x4d66c1;};'use strict';var util=require(_0x77f3('0x0'));var _=require(_0x77f3('0x1'));var uuid=require(_0x77f3('0x2'));var moment=require(_0x77f3('0x3'));var rr=require('rr');var Redis=require(_0x77f3('0x4'));var utils=require(_0x77f3('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0x77f3('0x6'));var config=require(_0x77f3('0x7'));var logger=require(_0x77f3('0x8'))(_0x77f3('0x9'));var loggerBooked=require(_0x77f3('0x8'))(_0x77f3('0xa'));var loggerPredictive=require(_0x77f3('0x8'))(_0x77f3('0xb'));var loggerPredictiveCalls=require(_0x77f3('0x8'))(_0x77f3('0xc'));var loggerSyncQueueSummary=require(_0x77f3('0x8'))('syncQueueSummary');var ami=require(_0x77f3('0xd'));config[_0x77f3('0xe')]=_[_0x77f3('0xf')](config[_0x77f3('0xe')],{'host':_0x77f3('0x10'),'port':0x18eb});var io=require(_0x77f3('0x11'))(new Redis(config[_0x77f3('0xe')]));var cmHopper=require(_0x77f3('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x77f3('0x13'));var Interval=require(_0x77f3('0x14'));var Action=require(_0x77f3('0x15'));var History=require(_0x77f3('0x16'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x77f3('0x17'));var Hangup=require('./models/hangup');var ipAgi=process[_0x77f3('0x18')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x77f3('0x19')]=function(_0x14765a){this[_0x77f3('0x1a')]=this['tail']?this[_0x77f3('0x1a')][_0x77f3('0x1b')](_0x14765a):_0x14765a();};function Dialer(_0x209c59,_0x4548f2){this[_0x77f3('0x1c')]=new Sequence();this[_0x77f3('0x1d')]=_0x4548f2;this[_0x77f3('0x1e')]=_0x209c59[_0x77f3('0x1e')];this[_0x77f3('0x1f')]=_0x209c59[_0x77f3('0x1f')];this[_0x77f3('0x20')]=_0x209c59[_0x77f3('0x20')];this[_0x77f3('0x21')]=_0x209c59[_0x77f3('0x21')];this[_0x77f3('0x22')]=config[_0x77f3('0x22')]||0x2;this[_0x77f3('0x23')]={};this[_0x77f3('0x24')]={};this[_0x77f3('0x25')]={};this[_0x77f3('0x26')]={};this[_0x77f3('0x27')]={};this['startPredictive']={};this['startProgressive']={};this[_0x77f3('0x28')]={};this[_0x77f3('0x29')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0x77f3('0x2a'),this[_0x77f3('0x2b')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x2d'),this[_0x77f3('0x2e')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x2f'),this[_0x77f3('0x30')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x31'),this[_0x77f3('0x32')]['bind'](this));ami['on'](_0x77f3('0x33'),this[_0x77f3('0x34')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x35'),this[_0x77f3('0x36')][_0x77f3('0x2c')](this));ami['on']('hangup',this[_0x77f3('0x37')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x38'),this[_0x77f3('0x39')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x3a'),this[_0x77f3('0x3b')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x3c'),this[_0x77f3('0x3d')][_0x77f3('0x2c')](this));ami['on'](_0x77f3('0x3e'),this[_0x77f3('0x3f')][_0x77f3('0x2c')](this));this[_0x77f3('0x40')]();this[_0x77f3('0x41')]();RpcSetting[_0x77f3('0x42')]()[_0x77f3('0x43')](function(_0x54e992){previewRecallmeReminderInterval=_0x54e992[_0x77f3('0x44')];});}function isNotNull(_0x5da540){return _0x5da540!==null&&!_[_0x77f3('0x45')](_0x5da540);}function msgResponse(_0x613154,_0x938054,_0x15718c){return{'action':_0x613154,'response':_0x938054,'message':_0x15718c,'stack':_0x15718c};}function emit(_0x430e14,_0x22a069,_0x940c25){io['to'](_0x430e14)[_0x77f3('0x46')](_0x22a069,_0x940c25);}function emitOutboundVoiceQueueSummary(_0x2ba8e2){if(_0x2ba8e2['type']===_0x77f3('0x47')){logger['debug'](_0x77f3('0x48'),util[_0x77f3('0x49')](_0x2ba8e2,{'showHidden':![],'depth':null}));emit(util[_0x77f3('0x4a')](_0x77f3('0x4b'),_0x2ba8e2[_0x77f3('0x4c')]),'voice_queue:save',_0x2ba8e2);}}function checkGetDataPredictive(_0x187727){if(isNotNull(_0x187727)&&!_[_0x77f3('0x4d')](_0x187727)){loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x4f'));loggerPredictive[_0x77f3('0x4e')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x187727[_0x77f3('0x50')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x51'),_0x187727[_0x77f3('0x52')]);loggerPredictive[_0x77f3('0x4e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x187727[_0x77f3('0x53')]);loggerPredictive[_0x77f3('0x4e')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x187727[_0x77f3('0x54')]);loggerPredictive['info'](_0x77f3('0x55'),_0x187727[_0x77f3('0x56')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x187727[_0x77f3('0x57')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x58'));if(_0x187727[_0x77f3('0x50')]>0x0){if(!_[_0x77f3('0x45')](_0x187727['predictiveIntervalAvgTalktime'])&&_0x187727[_0x77f3('0x57')]>0x0){return!![];}loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x59'));if(!_[_0x77f3('0x45')](_0x187727[_0x77f3('0x56')])&&_0x187727[_0x77f3('0x56')]>0x0){return!![];}loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5a'));}else{loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5b'));}}else{loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5c'));}return![];}function mergeDataErlangB(_0x578390){return function(_0x36b711){loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5d'));loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x5e'),_0x36b711[_0x77f3('0x5f')]);loggerPredictive['info'](_0x77f3('0x60'),_0x36b711[_0x77f3('0x61')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x62'),_0x36b711[_0x77f3('0x63')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x64'),_0x36b711[_0x77f3('0x65')]);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x62'),_0x36b711[_0x77f3('0x63')]);loggerPredictive[_0x77f3('0x4e')]('---------------------------');_[_0x77f3('0x66')](_0x578390,_0x36b711);};}function ifInterval(_0x4b5582,_0x3b980e){if(_[_0x77f3('0x45')](_0x3b980e)){return![];}return utils['getSeconds'](undefined,_0x3b980e)<_0x4b5582*0x3c;}function clearPredictiveAttributes(_0x5007fe){if(_0x5007fe[_0x77f3('0x67')]){_0x5007fe['startProgressive']=undefined;loggerPredictive[_0x77f3('0x68')](_0x5007fe[_0x77f3('0x4c')],_0x77f3('0x69'));}if(_0x5007fe['startPredictive']){_0x5007fe[_0x77f3('0x6a')]=undefined;loggerPredictive[_0x77f3('0x68')](_0x5007fe[_0x77f3('0x4c')],_0x77f3('0x6b'));}if(_0x5007fe[_0x77f3('0x6c')]){clearInterval(_0x5007fe[_0x77f3('0x6c')]);_0x5007fe[_0x77f3('0x6c')]=undefined;loggerPredictive[_0x77f3('0x68')](_0x5007fe[_0x77f3('0x4c')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x207226,_0x23c4bd){return function(_0x496e15){loggerPredictive['error'](_0x23c4bd[_0x77f3('0x4c')],_0x207226);loggerPredictive['error'](_0x496e15[_0x77f3('0x6d')]);clearPredictiveAttributes(_0x23c4bd);};}function loggerCatch(_0x534e53){return function(_0xb9bdb0){logger['error'](_0x534e53,util[_0x77f3('0x49')](_0xb9bdb0,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x38820c,_0x5c599e,_0x1aa7a7){return function(_0x1170bc){utils[_0x77f3('0x6e')](_0x5c599e,_0x1aa7a7,0x0);logger[_0x77f3('0x6f')](_0x38820c,util[_0x77f3('0x49')](_0x1170bc,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x14f29b){return function(_0x276f0e){if(isNotNull(_0x276f0e)&&isNotNull(_0x276f0e[0x0])){if(_0x276f0e[0x0][_0x77f3('0x70')]>0x0){_0x14f29b[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x73')];logger[_0x77f3('0x4e')](_0x77f3('0x74')+_0x14f29b[_0x77f3('0x4c')],_0x276f0e[0x0][_0x77f3('0x70')],_0x77f3('0x75'));}else{_0x14f29b[_0x77f3('0x71')]=utils['CAMPAIGN_STATUS'][_0x77f3('0x76')];logger[_0x77f3('0x4e')](_0x77f3('0x77')+_0x14f29b[_0x77f3('0x4c')]);}}};}function createObjHistory(_0x32c0f7,_0x2c4bd3,_0x22acca,_0x3a10e9,_0x4c489d){_0x32c0f7[_0x77f3('0x71')]=_0x22acca;var _0x2a04f2=new Action(_0x32c0f7,_0x2c4bd3);var _0x4a76da=new History(_0x2a04f2);_0x4a76da[_0x77f3('0x78')]=_0x3a10e9;_0x4a76da[_0x77f3('0x79')]=_0x4c489d;_0x4a76da[_0x77f3('0x7a')]=_0x2a04f2[_0x77f3('0x7b')];return _0x4a76da;}function unlockQueueStatus(_0x13da1d,_0x151433){setTimeout(function(){if(_[_0x77f3('0x45')](_0x13da1d[_0x77f3('0x7c')])){loggerBooked[_0x77f3('0x6f')](_0x77f3('0x7d'),_0x151433);}_0x13da1d['queueStatusComplete']=!![];loggerBooked[_0x77f3('0x4e')](_0x77f3('0x7e'),_0x151433,JSON[_0x77f3('0x7f')](_[_0x77f3('0x80')](_0x13da1d,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x7462ee){return function(){if(!isNotNull(_0x7462ee['Interval'])){_0x7462ee[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['NULL_INTERVAL'];throw _0x7462ee['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x7462ee['Interval']['Intervals'])){_0x7462ee[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x81')];throw _0x7462ee[_0x77f3('0x4c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x7462ee[_0x77f3('0x82')][_0x77f3('0x83')]))){_0x7462ee[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x81')];throw _0x7462ee[_0x77f3('0x4c')]+_0x77f3('0x84');}};}function checkIsIVRCampaignActive(_0x49552e){return function(){if(!utils[_0x77f3('0x85')](_0x49552e)){_0x49552e[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x86')];throw _0x49552e[_0x77f3('0x4c')]+_0x77f3('0x87');}};}function emitCampaignSummary(_0x357290){if(utils['isIVRCampaign'](_0x357290)){emit(util[_0x77f3('0x4a')](_0x77f3('0x88'),_0x357290['name']),_0x77f3('0x89'),_0x357290);}}function loggerCatchQueueSummary(_0x1c1da7,_0x526f0c){return function(_0x57aab4){clearPredictiveAttributes(_0x526f0c);emitCampaignSummary(_0x526f0c);loggerSyncQueueSummary['debug'](_0x1c1da7,util[_0x77f3('0x49')](_0x57aab4,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x6e47b2){if(_0x6e47b2['sendMessageOneNotActive']){if(_0x6e47b2['originated']===0x0){_0x6e47b2[_0x77f3('0x8a')]=![];_0x6e47b2[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x86')];loggerSyncQueueSummary[_0x77f3('0x68')](_0x77f3('0x8b'),_0x6e47b2[_0x77f3('0x4c')],_0x77f3('0x8c'));}else{_0x6e47b2[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['DISACTIVED'];loggerSyncQueueSummary[_0x77f3('0x68')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x6e47b2[_0x77f3('0x4c')],_0x77f3('0x8d'));}emitCampaignSummary(_0x6e47b2);}}function myreject(_0x3220ea){return function(_0x2d3951){return _0x3220ea(msgResponse(_0x77f3('0x8e'),_0x77f3('0x8f'),JSON[_0x77f3('0x7f')](_0x2d3951)));};}Dialer[_0x77f3('0x90')]['isTrunkReachable']=function(_0x3f94fa){return!_['isUndefined'](_0x3f94fa)&&_0x3f94fa&&!_[_0x77f3('0x45')](_0x3f94fa['name'])&&!_['isUndefined'](_0x3f94fa[_0x77f3('0x91')])&&_0x3f94fa['active']&&(this[_0x77f3('0x21')][util[_0x77f3('0x4a')](_0x77f3('0x92'),_0x3f94fa[_0x77f3('0x4c')])][_0x77f3('0x93')]===_0x77f3('0x94')||this[_0x77f3('0x21')][util['format']('SIP/%s',_0x3f94fa[_0x77f3('0x4c')])][_0x77f3('0x93')]===_0x77f3('0x95'));};Dialer[_0x77f3('0x90')][_0x77f3('0x96')]=function(_0x48efdb){var _0x59bdad=this;return function(){if(!_0x59bdad[_0x77f3('0x97')](_0x48efdb['Trunk'])){if(!_0x59bdad[_0x77f3('0x97')](_0x48efdb[_0x77f3('0x98')])){_0x48efdb[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x99')];throw _0x48efdb['name']+_0x77f3('0x9a');}}};};Dialer[_0x77f3('0x90')][_0x77f3('0x9b')]=function(_0x934dfb,_0x2fb5b6,_0x2064b4,_0x212017){var _0x46aabe=this;return function(){var _0x3fe874=!![];return _0x46aabe[_0x77f3('0x9c')](_0x934dfb,_0x2fb5b6,_0x2064b4,_0x212017,_0x3fe874);};};Dialer[_0x77f3('0x90')]['checkIfTimeIntervals']=function(_0x18e5de,_0x25f66a,_0x47387a,_0xf58cc3){var _0x338ae2=this;return function(){var _0x3934f6=![];return _0x338ae2['ifTimeIvr'](_0x18e5de[_0x77f3('0x83')],_0x25f66a,_0x47387a,_0xf58cc3,_0x3934f6);};};Dialer[_0x77f3('0x90')][_0x77f3('0x9c')]=function(_0x592757,_0x500ec7,_0x1a0d46,_0x475a0c,_0x377d89){var _0x18c7cc=[];return new Promise(function(_0x2b7ca6,_0x2abcfa){if(!isNotNull(_0x592757)){_0x475a0c['message']=utils[_0x77f3('0x72')][_0x77f3('0x81')];return _0x2abcfa(msgResponse('ifTime','Failure',_0x1a0d46+_0x77f3('0x9d')));}if(_[_0x77f3('0x4d')](_0x592757)){_0x475a0c[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x9e')];return _0x2abcfa(msgResponse(_0x77f3('0x9f'),_0x77f3('0xa0'),_0x1a0d46+'\x20Intervals\x20is\x20empty\x20'));}if(_0x500ec7&&_[_0x77f3('0x45')](config[_0x77f3('0xa1')][_0x500ec7])){_0x475a0c[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['UNKNOWN_TIMEZONE'];return _0x2abcfa(msgResponse('ifTime',_0x77f3('0xa0'),_0x1a0d46+'\x20Timezone\x20unknow\x20'+_0x500ec7));}if(_[_0x77f3('0xa2')](_0x592757)){for(var _0x234ed3=0x0;_0x234ed3<_0x592757['length'];_0x234ed3+=0x1){_0x18c7cc['push'](ami['Action']({'action':_0x77f3('0xa3'),'command':util[_0x77f3('0x4a')](_0x77f3('0xa4'),_0x592757[_0x234ed3][_0x77f3('0xa5')],!_[_0x77f3('0x45')](config[_0x77f3('0xa1')][_0x500ec7])?_0x500ec7:'')})[_0x77f3('0x43')](function(_0x18a4b1){return _0x18a4b1[_0x77f3('0xa6')][_0x77f3('0xa7')]('true')>=0x0;})[_0x77f3('0xa8')](myreject(_0x2abcfa)));}}else{_0x18c7cc['push'](ami[_0x77f3('0xa9')]({'action':_0x77f3('0xa3'),'command':util['format']('iftime\x20%s,%s',_0x592757,!_[_0x77f3('0x45')](config[_0x77f3('0xa1')][_0x500ec7])?_0x500ec7:'')})[_0x77f3('0x43')](function(_0x578b7f){return _0x578b7f['content'][_0x77f3('0xa7')](_0x77f3('0xaa'))>=0x0;})['catch'](myreject(_0x2abcfa)));}Promise[_0x77f3('0xab')](_0x18c7cc)[_0x77f3('0x43')](function(_0x561e41){var _0x3a58a7=_[_0x77f3('0xac')](_0x561e41);if(_0x3a58a7){return _0x2b7ca6(_0x3a58a7);}else{_0x475a0c[_0x77f3('0x71')]=_0x377d89?utils[_0x77f3('0x72')][_0x77f3('0xad')]:utils[_0x77f3('0x72')][_0x77f3('0xae')];return _0x2abcfa(msgResponse('[ifTime][promiseAll]',_0x77f3('0xa0'),'Global:\x20'+_0x377d89+'\x20'+_0x1a0d46+_0x77f3('0xaf')+util['inspect'](_0x592757,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x500ec7));}})['catch'](function(_0x556140){return _0x2abcfa(msgResponse('ifTime',_0x77f3('0xa0'),JSON[_0x77f3('0x7f')](_0x556140)));});});};Dialer['prototype'][_0x77f3('0x40')]=function(){var _0x2efb40=this;return cmHopper[_0x77f3('0xb0')]({'active':![]},{'where':{'active':!![]}})[_0x77f3('0x43')](function(){setInterval(function(){_0x2efb40[_0x77f3('0xb1')]();},0x3e8);});};Dialer[_0x77f3('0x90')][_0x77f3('0xb1')]=function(){var _0x1eb01b=this;var _0x534ab5;for(var _0x346622 in this['campaigns']){if(typeof this['campaigns'][_0x346622]!==_0x77f3('0xb2')){_0x534ab5=this[_0x77f3('0x1f')][_0x346622];if(utils[_0x77f3('0xb3')](_0x534ab5)&&utils[_0x77f3('0x85')](_0x534ab5)){_0x534ab5[_0x77f3('0x8a')]=!![];Promise[_0x77f3('0xb4')]()[_0x77f3('0x43')](checkIsIVRCampaignActive(_0x534ab5))[_0x77f3('0x43')](checkInterval(_0x534ab5))[_0x77f3('0x43')](_0x1eb01b[_0x77f3('0x96')](_0x534ab5))[_0x77f3('0x43')](_0x1eb01b[_0x77f3('0x9b')](_0x534ab5[_0x77f3('0xb5')],_0x534ab5[_0x77f3('0xb6')],_0x534ab5['name'],_0x534ab5))[_0x77f3('0x43')](_0x1eb01b[_0x77f3('0xb7')](_0x534ab5['Interval'],_0x534ab5[_0x77f3('0xb6')],_0x534ab5[_0x77f3('0x4c')],_0x534ab5))[_0x77f3('0x43')](_0x1eb01b[_0x77f3('0xb8')](_0x534ab5))[_0x77f3('0xa8')](loggerCatchQueueSummary('[syncCampaigns]',_0x534ab5));}else{notSendMessagesCampaign(_0x534ab5);}}}};Dialer['prototype'][_0x77f3('0xb9')]=function(_0x363935){if(_0x363935[_0x77f3('0xba')]!==_0x77f3('0xb')){clearPredictiveAttributes(_0x363935);}switch(_0x363935[_0x77f3('0xba')]){case _0x77f3('0xbb'):this[_0x77f3('0xbc')](_0x363935,0x1);break;case _0x77f3('0xbd'):this[_0x77f3('0xbc')](_0x363935,_0x363935[_0x77f3('0xbe')]);break;case _0x77f3('0xb'):this[_0x77f3('0xb')](_0x363935);break;case _0x77f3('0xa'):this[_0x77f3('0xbc')](_0x363935,0x1);break;default:logger[_0x77f3('0x6f')](_0x77f3('0xbf'),_0x363935['name'],_0x77f3('0xc0'));}};Dialer[_0x77f3('0x90')]['ifTime']=function(_0x4b81cf,_0x503c42){var _0x533612=_0x4b81cf['dialTimezone'];var _0x42faed=_0x503c42?_0x4b81cf['dialGlobalInterval']:_0x4b81cf['Interval'][_0x77f3('0x83')];logger[_0x77f3('0xc1')](_0x77f3('0xc2'),_0x42faed,_0x533612,_0x4b81cf[_0x77f3('0x4c')],util[_0x77f3('0x4a')](_0x77f3('0xc3'),_0x4b81cf['name'],_0x4b81cf['id']));var _0x47052c=null;return Interval[_0x77f3('0xc4')](_0x42faed,_0x533612)[_0x77f3('0x43')](function(_0x45b58a){if(_0x45b58a===!![]){return _0x45b58a;}else{_0x4b81cf['message']=_0x503c42?utils['CAMPAIGN_STATUS'][_0x77f3('0xad')]:utils[_0x77f3('0x72')]['OVERTIME_INTERVAL'];_0x47052c=msgResponse(_0x77f3('0xc5'),_0x77f3('0xa0'),_0x77f3('0xc6')+_0x503c42+'\x20'+_0x4b81cf[_0x77f3('0x4c')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x77f3('0x49')](_0x42faed,{'showHidden':![],'depth':null})+_0x77f3('0xc7')+_0x533612);}if(_0x47052c!==null){logger[_0x77f3('0xc1')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x47052c);_0x47052c[_0x77f3('0xc8')]=_0x503c42;throw _0x47052c;}})[_0x77f3('0xa8')](function(_0x3e8d86){logger[_0x77f3('0x6f')]('AMI\x20IfTime',_0x3e8d86);throw msgResponse('[ifTime][Action]',_0x77f3('0x8f'),util[_0x77f3('0x49')](_0x3e8d86,{'showHidden':![],'depth':null}));});};Dialer[_0x77f3('0x90')][_0x77f3('0x2b')]=function(_0x3cfa6f){if(this['voiceQueues'][_0x3cfa6f[_0x77f3('0xc9')]]){if(this[_0x77f3('0x26')][_0x3cfa6f[_0x77f3('0xca')]]&&this[_0x77f3('0x26')][_0x3cfa6f[_0x77f3('0xca')]]['type']!==_0x77f3('0xcb')){this[_0x77f3('0xcc')](this[_0x77f3('0x1e')][_0x3cfa6f[_0x77f3('0xc9')]]);this['uniqueId'][_0x3cfa6f[_0x77f3('0xca')]][_0x77f3('0xcd')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));}}};Dialer[_0x77f3('0x90')]['syncAgentComplete']=function(_0xed0fb7){var _0x29b71c=this[_0x77f3('0x26')][_0xed0fb7[_0x77f3('0xca')]];if(this[_0x77f3('0x1e')][_0xed0fb7['queue']]){if(_0x29b71c&&_0x29b71c['type']!==_0x77f3('0xcb')){delete this[_0x77f3('0x26')][_0xed0fb7[_0x77f3('0xca')]];this[_0x77f3('0x1e')][_0xed0fb7[_0x77f3('0xc9')]][_0x77f3('0xcf')]+=0x1;var _0x14f3d1=new AgentComplete(_0x29b71c,_0xed0fb7);if(_0xed0fb7[_0x77f3('0xd0')]===_0x77f3('0xd1')){_0x14f3d1[_0x77f3('0xd2')]=this['voiceQueues'][_0xed0fb7['queue']]['dialQueueProject2']&&this[_0x77f3('0x1e')][_0xed0fb7[_0x77f3('0xc9')]]['dialAgiAfterHangupAgent']?moment()[_0x77f3('0x4a')](_0x77f3('0xce')):undefined;}hopperUtils[_0x77f3('0xd3')](_0x14f3d1)[_0x77f3('0xa8')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x77f3('0xd4')](_0x14f3d1)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0xd5')));}}};Dialer[_0x77f3('0x90')][_0x77f3('0x2e')]=function(_0x33bc6f){var _0x2d27b7=this['uniqueId'][_0x33bc6f[_0x77f3('0xca')]];var _0x5d014e=this;var _0x59b083=![];var _0x2bc91e;var _0x38fe1b;if(this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]]){if(_0x2d27b7&&_0x2d27b7[_0x77f3('0xd6')]!=='ivr'){delete this[_0x77f3('0x26')][_0x33bc6f[_0x77f3('0xca')]];this[_0x77f3('0xcc')](this['voiceQueues'][_0x33bc6f[_0x77f3('0xc9')]]);_0x2d27b7[_0x77f3('0xd7')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));var _0x272d80=new QueueCallerAbandon(_0x2d27b7,_0x33bc6f);if(utils[_0x77f3('0xd8')](_0x2d27b7['droptime'],_0x2d27b7[_0x77f3('0xd9')])>=_0x2d27b7[_0x77f3('0xda')]){this[_0x77f3('0x1e')][_0x33bc6f['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xdb')]+=0x1;this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x272d80[_0x77f3('0x78')]=0xa;_0x272d80['statedesc']=_0x77f3('0xdc');_0x272d80['dropreason']=_0x77f3('0xdd');_0x272d80['agiafterat']=this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]]['dialQueueProject2']?moment()[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x272d80[_0x77f3('0xde')]+=0x1;_0x272d80[_0x77f3('0xdf')]+=0x1;_0x2bc91e=this[_0x77f3('0x1e')][_0x33bc6f['queue']]['dialDropRetryFrequency'];_0x38fe1b=this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xe0')];hopperUtils['verifyAdditionalPhones'](_0x272d80,_0x272d80[_0x77f3('0x78')],_0x2d27b7[_0x77f3('0xe1')])[_0x77f3('0x43')](function(_0x4cba4b){_0x59b083=_0x4cba4b[_0x77f3('0xe2')]==0x1;if(_0x272d80['countdropretry']>=_0x5d014e[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xe3')]){_0x5d014e[_0x77f3('0xe4')](_0x272d80,_0x4cba4b[_0x77f3('0xe2')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x272d80[_0x77f3('0xde')],'scheduledat':moment()[_0x77f3('0xe5')](_0x5d014e[_0x77f3('0x1e')][_0x33bc6f['queue']]['dialDropRetryFrequency'],_0x77f3('0xe6'))[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2d27b7['ContactId'],'ListId':_0x2d27b7[_0x77f3('0xe7')],'VoiceQueueId':_0x2d27b7[_0x77f3('0xe8')]||undefined,'CampaignId':_0x2d27b7[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Drop]'));var _0x42d420=new History(_0x272d80);_0x42d420['state']=0xa;_0x42d420[_0x77f3('0x79')]='Drop';_0x42d420[_0x77f3('0x7b')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));_0x42d420[_0x77f3('0x7a')]=_0x42d420[_0x77f3('0x7b')];_0x42d420['calleridname']=_0x272d80[_0x77f3('0xea')];_0x42d420[_0x77f3('0xeb')]=_0x272d80[_0x77f3('0xeb')];hopperUtils[_0x77f3('0xd3')](_0x42d420)[_0x77f3('0xa8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x77f3('0x43')](function(){if(_0x59b083)hopperUtils[_0x77f3('0xec')](_0x272d80,_0x2bc91e,_0x38fe1b)[_0x77f3('0x43')](function(){return 0x1;});});}else{this['voiceQueues'][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0x54')]+=0x1;this[_0x77f3('0x1e')][_0x33bc6f['queue']][_0x77f3('0xed')]+=0x1;_0x272d80[_0x77f3('0x78')]=0xb;_0x272d80[_0x77f3('0x79')]='Abandoned';_0x272d80[_0x77f3('0xee')]='CALLEREXIT';_0x272d80[_0x77f3('0xef')]+=0x1;_0x272d80[_0x77f3('0xdf')]+=0x1;_0x2bc91e=this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xf0')];_0x38fe1b=this[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xe0')];hopperUtils[_0x77f3('0xf1')](_0x272d80,_0x272d80[_0x77f3('0x78')],_0x2d27b7[_0x77f3('0xe1')])[_0x77f3('0x43')](function(_0x2e78fa){if(_0x272d80['countabandonedretry']>=_0x5d014e['voiceQueues'][_0x33bc6f[_0x77f3('0xc9')]][_0x77f3('0xf2')]){_0x5d014e['queueCallerAbandonCreateState'](_0x272d80,_0x2e78fa[_0x77f3('0xe2')]);}else{hopperUtils[_0x77f3('0xf3')]({'active':![],'countabandonedretry':_0x272d80[_0x77f3('0xef')],'scheduledat':moment()[_0x77f3('0xe5')](_0x5d014e[_0x77f3('0x1e')][_0x33bc6f[_0x77f3('0xc9')]]['dialAbandonedRetryFrequency'],'minutes')[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x2d27b7[_0x77f3('0xf4')],'ListId':_0x2d27b7[_0x77f3('0xe7')],'VoiceQueueId':_0x2d27b7[_0x77f3('0xe8')]||undefined,'CampaignId':_0x2d27b7['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x204c2c=new History(_0x272d80);_0x204c2c['state']=0xb;_0x204c2c[_0x77f3('0x79')]=_0x77f3('0xf5');_0x204c2c[_0x77f3('0x7b')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));_0x204c2c[_0x77f3('0x7a')]=_0x204c2c[_0x77f3('0x7b')];_0x204c2c[_0x77f3('0xea')]=_0x272d80['calleridname'];_0x204c2c[_0x77f3('0xeb')]=_0x272d80[_0x77f3('0xeb')];hopperUtils[_0x77f3('0xd3')](_0x204c2c)['catch'](loggerCatch(_0x77f3('0xf6')));}})[_0x77f3('0x43')](function(){if(_0x59b083)hopperUtils[_0x77f3('0xec')](_0x272d80,_0x2bc91e,_0x38fe1b)['then'](function(){return 0x1;});});}}}};Dialer['prototype'][_0x77f3('0x39')]=function(_0x65494b){if(this[_0x77f3('0x24')][_0x65494b[_0x77f3('0xca')]]){this[_0x77f3('0x24')][_0x65494b[_0x77f3('0xca')]]['channel']=_0x65494b[_0x77f3('0xf7')];}if(this[_0x77f3('0x26')][_0x65494b[_0x77f3('0xca')]]){this['uniqueId'][_0x65494b['uniqueid']][_0x77f3('0xf7')]=_0x65494b[_0x77f3('0xf7')];}};Dialer[_0x77f3('0x90')][_0x77f3('0x3d')]=function(_0x492977){if(!this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]]){return;}var _0x3a83ce=this[_0x77f3('0x1e')][this[_0x77f3('0x24')][_0x492977['actionid']]['queue']]['strategy']||'rrmemory';if(_0x3a83ce==='roundrobin'){if(this['actions'][_0x492977[_0x77f3('0xf8')]]&&_['isNil'](this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xf9')])&&_0x492977[_0x77f3('0x93')]==='1'&&_0x492977[_0x77f3('0xfa')]==='0'){if(this[_0x77f3('0x20')][_0x492977[_0x77f3('0xfb')]]){if(!this['agents'][_0x492977[_0x77f3('0xfb')]]['locked']){this['agents'][_0x492977[_0x77f3('0xfb')]][_0x77f3('0xf9')]=!![];this['actions'][_0x492977['actionid']][_0x77f3('0xf9')]=!![];this['actions'][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xfb')]=_0x492977[_0x77f3('0xfb')];}}}}else if(_0x3a83ce===_0x77f3('0xfc')){if(this[_0x77f3('0x24')][_0x492977['actionid']]){if(this[_0x77f3('0x20')][_0x492977[_0x77f3('0xfb')]]){this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xfb')]=_0x492977[_0x77f3('0xfb')];if(_['isNil'](this[_0x77f3('0x29')][this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xc9')]])){this['queueBooked'][this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xc9')]]=[];}this['queueBooked'][this[_0x77f3('0x24')][_0x492977[_0x77f3('0xf8')]][_0x77f3('0xc9')]][_0x77f3('0xfd')](_[_0x77f3('0x66')](_['pick'](this['actions'][_0x492977[_0x77f3('0xf8')]],[_0x77f3('0xfe'),'stateinterface']),{'status':_0x492977['status'],'paused':_0x492977[_0x77f3('0xfa')]}));}}}};Dialer[_0x77f3('0x90')][_0x77f3('0x3f')]=function(_0x3cc9c1){if(!this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]){return;}var _0x583ce3=this;var _0x42da4c=this[_0x77f3('0x1e')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['queue']];var _0x13b11a=_0x42da4c['strategy']||'rrmemory';if(_0x13b11a===_0x77f3('0xff')){if(this[_0x77f3('0x24')][_0x3cc9c1['actionid']]&&this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xfb')]){this[_0x77f3('0x1d')]['run'](this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xfe')],this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xfb')])[_0x77f3('0xa8')](function(_0xa47fc2){logger[_0x77f3('0x6f')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0xa47fc2,{'showHidden':![],'depth':null}));})[_0x77f3('0x1b')](function(){_0x583ce3[_0x77f3('0xcc')](_0x583ce3[_0x77f3('0x1e')][_0x583ce3[_0x77f3('0x24')][_0x3cc9c1['actionid']]['queue']]);_0x583ce3[_0x77f3('0x20')][_0x583ce3[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xfb')]][_0x77f3('0xf9')]=![];delete _0x583ce3['actions'][_0x3cc9c1[_0x77f3('0xf8')]];unlockQueueStatus(_0x42da4c);});}else{this[_0x77f3('0xcc')](this[_0x77f3('0x1e')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xc9')]]);hopperUtils[_0x77f3('0xf3')]({'active':![],'ContactId':this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['ContactId'],'ListId':this['actions'][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xe7')],'VoiceQueueId':this['actions'][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xe8')]||undefined,'CampaignId':this['actions'][_0x3cc9c1['actionid']][_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x100')));delete this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]];unlockQueueStatus(_0x42da4c);}}else if(_0x13b11a===_0x77f3('0xfc')){var _0x12c1bc;if(this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]&&!_[_0x77f3('0x4d')](this[_0x77f3('0x29')][this['actions'][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xc9')]])){if(this[_0x77f3('0x101')][_0x583ce3['actions'][_0x3cc9c1[_0x77f3('0xf8')]]['queue']]){this[_0x77f3('0x101')][_0x583ce3[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['queue']]=this[_0x77f3('0x101')][this['actions'][_0x3cc9c1['actionid']][_0x77f3('0xc9')]]?this[_0x77f3('0x101')][this[_0x77f3('0x24')][_0x3cc9c1['actionid']][_0x77f3('0xc9')]]:this[_0x77f3('0x29')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['queue']]?this[_0x77f3('0x29')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xc9')]][_0x77f3('0x102')]||0x0:0x0;}this[_0x77f3('0x29')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]]['queue']][_0x77f3('0x102')]=this[_0x77f3('0x101')][this[_0x77f3('0x24')][_0x3cc9c1[_0x77f3('0xf8')]][_0x77f3('0xc9')]];for(var _0xc71861=0x0;_0xc71861=_0x2eb36c[_0x77f3('0x129')]){_0x54bf70['stateGlobal'](_0x5cb990,_0x3cf55f,_0xc8af5d,_0x77f3('0x12a'));}else{if(_0x5cb990['countmachineretry']>=_0x2eb36c[_0x77f3('0x12b')]){_0x54bf70['createStateFinal'](_0x5cb990,_0x3cf55f,_0xc8af5d,_0x77f3('0x12c'));}else{hopperUtils[_0x77f3('0xf3')]({'active':![],'countmachineretry':_0x5cb990[_0x77f3('0x123')],'scheduledat':moment()[_0x77f3('0xe5')](_0x2eb36c[_0x77f3('0x12d')],'minutes')['format'](_0x77f3('0xce')),'ContactId':_0x5cb990[_0x77f3('0xf4')],'ListId':_0x5cb990[_0x77f3('0xe7')],'VoiceQueueId':_0x5cb990[_0x77f3('0xe8')]||undefined,'CampaignId':_0x5cb990[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x3cf55f({'reschedule':0x1});}}});}if(_0x48e07a[_0x77f3('0xd6')]===_0x77f3('0xcb')&&this[_0x77f3('0x1f')][_0x48e07a[_0x77f3('0xc9')]][_0x77f3('0x118')]&&_0x44593d[_0x77f3('0x12e')]===_0x77f3('0x119')){delete this[_0x77f3('0x26')][_0x44593d[_0x77f3('0xca')]];this[_0x77f3('0xcc')](this[_0x77f3('0x1f')][_0x48e07a['queue']]);_0x1d448f=new Hangup(_0x48e07a,_0x44593d);_0x1d448f[_0x77f3('0x78')]=0x12;_0x1d448f[_0x77f3('0x79')]=_0x77f3('0x11a');_0x1d448f[_0x77f3('0x11b')]=_0x77f3('0x122');ami['emit'](_0x77f3('0x11c'),ut[_0x77f3('0x125')](_0x1d448f,_0x77f3('0x124')));this[_0x77f3('0x11d')](_0x1d448f,_0x77f3('0x12f'),_0x77f3('0x130'));}if(_0x48e07a['type']==='ivr'&&this['campaigns'][_0x48e07a[_0x77f3('0xc9')]]['dialAMDActive']&&_0x44593d[_0x77f3('0x12e')]===_0x77f3('0x11f')){return new Promise(function(_0x398b5a,_0x188320){delete _0x54bf70[_0x77f3('0x26')][_0x44593d[_0x77f3('0xca')]];_0x54bf70[_0x77f3('0xcc')](_0x54bf70[_0x77f3('0x1f')][_0x48e07a[_0x77f3('0xc9')]]);_0x54bf70[_0x77f3('0x1f')][_0x48e07a['queue']][_0x77f3('0xcf')]+=0x1;_0x54bf70['campaigns'][_0x48e07a[_0x77f3('0xc9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3d42fd=_0x54bf70[_0x77f3('0x1f')][_0x48e07a[_0x77f3('0xc9')]];var _0x43005e=new Hangup(_0x48e07a,_0x44593d);_0x43005e[_0x77f3('0x78')]=0x13;_0x43005e[_0x77f3('0x79')]='Machine';_0x43005e[_0x77f3('0x11b')]=_0x77f3('0x122');_0x43005e[_0x77f3('0x123')]+=0x1;_0x43005e['countglobal']+=0x1;_0x43005e['amd']=!![];ami[_0x77f3('0x46')](_0x77f3('0x11c'),ut[_0x77f3('0x125')](_0x43005e,_0x77f3('0x124')));hopperUtils[_0x77f3('0xd3')](_0x43005e)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x126')));if(_0x43005e['countbusyretry']+_0x43005e[_0x77f3('0x131')]+_0x43005e[_0x77f3('0x132')]+_0x43005e['countnosuchnumberretry']+_0x43005e[_0x77f3('0xde')]+_0x43005e[_0x77f3('0xef')]+_0x43005e[_0x77f3('0x123')]+_0x43005e[_0x77f3('0x128')]>=_0x3d42fd[_0x77f3('0x129')]){_0x54bf70['stateGlobal'](_0x43005e,_0x398b5a,_0x188320,_0x77f3('0x12a'));}else{if(_0x43005e['countmachineretry']>=_0x3d42fd[_0x77f3('0x12b')]){_0x54bf70[_0x77f3('0x133')](_0x43005e,_0x398b5a,_0x188320,_0x77f3('0x12c'));}else{hopperUtils[_0x77f3('0xf3')]({'active':![],'countmachineretry':_0x43005e[_0x77f3('0x123')],'scheduledat':moment()[_0x77f3('0xe5')](_0x3d42fd[_0x77f3('0x12d')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x43005e[_0x77f3('0xf4')],'ListId':_0x43005e['ListId'],'VoiceQueueId':_0x43005e[_0x77f3('0xe8')]||undefined,'CampaignId':_0x43005e['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Machine]'));_0x398b5a({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x77f3('0x37')]=function(_0x1b3b34){var _0x19be2c=this[_0x77f3('0x26')][_0x1b3b34[_0x77f3('0xca')]];var _0x1c1c4a;if(_0x19be2c&&_0x19be2c['type']===_0x77f3('0xcb')){delete this[_0x77f3('0x26')][_0x1b3b34[_0x77f3('0xca')]];this[_0x77f3('0xcc')](this['campaigns'][_0x19be2c[_0x77f3('0xc9')]]);this[_0x77f3('0x1f')][_0x19be2c['queue']][_0x77f3('0x134')]+=0x1;_0x1c1c4a=new Hangup(_0x19be2c,_0x1b3b34);hopperUtils['createHistory'](_0x1c1c4a)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x135')));hopperUtils[_0x77f3('0xd4')](_0x1c1c4a)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x136')));}if(_0x19be2c&&_0x19be2c['type']!==_0x77f3('0xcb')&&isNotNull(this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]][_0x77f3('0x137')])){delete this[_0x77f3('0x26')][_0x1b3b34[_0x77f3('0xca')]];this['updateOriginated'](this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]]);this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]][_0x77f3('0xcf')]+=0x1;this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]][_0x77f3('0x120')]+=0x1;_0x1c1c4a=new Hangup(_0x19be2c,_0x1b3b34);_0x1c1c4a[_0x77f3('0x78')]=0x10;_0x1c1c4a[_0x77f3('0x79')]=_0x77f3('0x138');_0x1c1c4a['membername']=_0x77f3('0x139');hopperUtils[_0x77f3('0xd3')](_0x1c1c4a)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x1c1c4a)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x136')));}if(_0x19be2c&&_0x19be2c[_0x77f3('0xd6')]!==_0x77f3('0xcb')&&!isNotNull(this['voiceQueues'][_0x19be2c['queue']][_0x77f3('0x137')])){delete this['uniqueId'][_0x1b3b34[_0x77f3('0xca')]];this[_0x77f3('0xcc')](this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]]);this[_0x77f3('0x1e')][_0x19be2c[_0x77f3('0xc9')]][_0x77f3('0x13a')]+=0x1;_0x1c1c4a=new Hangup(_0x19be2c,_0x1b3b34);_0x1c1c4a[_0x77f3('0x78')]=0xc;_0x1c1c4a['statedesc']=_0x1b3b34[_0x77f3('0x13b')];_0x1c1c4a[_0x77f3('0x11b')]=_0x77f3('0x13c');hopperUtils[_0x77f3('0xd3')](_0x1c1c4a)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x135')));hopperUtils['moveContactManagedDialer'](_0x1c1c4a)['catch'](loggerCatch(_0x77f3('0x136')));}};Dialer['prototype'][_0x77f3('0x34')]=function(_0xce0cb4){var _0x52da46=this;if(!_0x52da46['queuesSummary'][_0xce0cb4[_0x77f3('0x4c')]]){_0x52da46[_0x77f3('0x13d')][_0xce0cb4['name']]={'running':![]};}else if(_0x52da46[_0x77f3('0x13d')][_0xce0cb4['name']][_0x77f3('0x13e')]===!![]){return;}else if(_0x52da46[_0x77f3('0x13d')][_0xce0cb4[_0x77f3('0x4c')]][_0x77f3('0x13e')]===![]){_0x52da46['queuesSummary'][_0xce0cb4[_0x77f3('0x4c')]][_0x77f3('0x13e')]=!![];}var _0x441cba=_0x52da46['voiceQueues'][_0xce0cb4['name']];var _0x907927=_0x441cba[_0x77f3('0x71')]!==utils[_0x77f3('0x72')][_0x77f3('0x86')];var _0x498b9d=utils[_0x77f3('0x13f')](_0x441cba);_0x441cba['statusMessage']=utils[_0x77f3('0x140')](_0x441cba,_0x52da46['trunks']);Promise[_0x77f3('0xb4')]()[_0x77f3('0x43')](function(){if(_0x441cba[_0x77f3('0x141')]===utils[_0x77f3('0x72')][_0x77f3('0x86')]){if(_0x907927){clearPredictiveAttributes(_0x441cba);_0xce0cb4[_0x77f3('0x6a')]=undefined;_0xce0cb4[_0x77f3('0x67')]=undefined;}if(_0x441cba['statusMessage']===utils[_0x77f3('0x72')][_0x77f3('0x86')]){_0xce0cb4[_0x77f3('0x142')]=0x0;_0xce0cb4[_0x77f3('0xfa')]=0x0;_0xce0cb4[_0x77f3('0x143')]=0x0;_0xce0cb4[_0x77f3('0x144')]=0x0;_0xce0cb4[_0x77f3('0x145')]=0x0;}}else if(_0x441cba[_0x77f3('0x141')]===utils['CAMPAIGN_STATUS'][_0x77f3('0x146')]&&!_0x498b9d){return _0x52da46[_0x77f3('0x9f')](_0x441cba,!![])[_0x77f3('0x43')](function(){return _0x52da46[_0x77f3('0x9f')](_0x441cba,![]);})[_0x77f3('0x43')](function(){return _0x52da46[_0x77f3('0xb9')](_0x441cba);})[_0x77f3('0xa8')](function(_0x231b52){loggerSyncQueueSummary[_0x77f3('0x68')](_0x77f3('0x147'),util['inspect'](_0x231b52,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x441cba);});}else{clearPredictiveAttributes(_0x441cba);}})[_0x77f3('0x43')](function(){var _0x185854=_0xce0cb4['compareToOutboundQueue'](_0x441cba);if(_0x185854||_0x441cba[_0x77f3('0x148')]){_0x441cba[_0x77f3('0x148')]=![];_0xce0cb4[_0x77f3('0x149')](_0x441cba);Object[_0x77f3('0x14a')](_0x441cba,_0xce0cb4);emitOutboundVoiceQueueSummary(_0xce0cb4);}_0x52da46[_0x77f3('0x13d')][_0x441cba['name']][_0x77f3('0x13e')]=![];})[_0x77f3('0xa8')](function(_0x382fdd){logger[_0x77f3('0x6f')](_0x77f3('0x147'),util['inspect'](_0x382fdd,{'showHidden':![],'depth':null}));_0x52da46[_0x77f3('0x13d')][_0x441cba['name']]['running']=![];});};Dialer['prototype'][_0x77f3('0x36')]=_[_0x77f3('0x14b')](function(){var _0x303572=_[_0x77f3('0x14c')](this[_0x77f3('0x1e')],function(_0x17ea0b){return _0x17ea0b[_0x77f3('0x14d')];});var _0x2714a7=_[_0x77f3('0x14c')](this[_0x77f3('0x20')],function(_0x5154ef){return _0x5154ef[_0x77f3('0x14e')]&&_0x5154ef[_0x77f3('0x93')]===_0x77f3('0x94');});if(_0x303572[_0x77f3('0x103')]>0x0&&_0x2714a7['length']>0x0){return Promise['resolve']()[_0x77f3('0x43')](cmHopper[_0x77f3('0x14f')](_['map'](_0x303572,'id'),previewRecallmeReminderInterval,_[_0x77f3('0x150')](_0x2714a7,'id')))[_0x77f3('0x43')](function(_0x4a1502){for(var _0x1b1a35=0x0;_0x1b1a35<_0x4a1502[_0x77f3('0x103')];_0x1b1a35++){var _0x1e0ed9=_0x4a1502[_0x1b1a35][_0x77f3('0x151')]['name'];if(_0x1e0ed9)io['to'](util[_0x77f3('0x4a')](_0x77f3('0x152'),_0x1e0ed9))[_0x77f3('0x46')](_0x77f3('0x153'),{'hopper':_0x4a1502[_0x1b1a35]});}})['catch'](function(_0x3a5405){logger[_0x77f3('0x6f')](_0x77f3('0x154'),_0x3a5405);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x77f3('0x90')]['loopClearZombieChannels']=function(){var _0x408cab=this;setInterval(function(){_0x408cab[_0x77f3('0x155')](_0x408cab['uniqueId'],_0x77f3('0x156'));_0x408cab['clearZombieChannels'](_0x408cab[_0x77f3('0x24')],_0x77f3('0x157'));},0x32c8);};Dialer['prototype'][_0x77f3('0x155')]=function(_0x2edd04,_0x324f7f){var _0x4242f8=this;for(var _0x1276c3 in _0x2edd04){if(typeof _0x2edd04[_0x1276c3]!==_0x77f3('0xb2')){this[_0x77f3('0x1c')][_0x77f3('0x19')](function(){if(!_[_0x77f3('0x106')](_0x2edd04[_0x1276c3])){return ami[_0x77f3('0xa9')]({'action':'status','channel':_0x2edd04[_0x1276c3][_0x77f3('0xf7')]})[_0x77f3('0xa8')](function(_0x45df39){if(_0x45df39['message']===_0x77f3('0x158')){setTimeout(function(){if(_0x2edd04[_0x1276c3]&&_0x2edd04[_0x1276c3][_0x77f3('0xd6')]!==_0x77f3('0xcb')){_0x4242f8[_0x77f3('0xcc')](_0x4242f8[_0x77f3('0x1e')][_0x2edd04[_0x1276c3]['queue']]);logger[_0x77f3('0x6f')](_0x77f3('0x159'),_0x324f7f,_0x1276c3,_0x2edd04[_0x1276c3][_0x77f3('0xc9')]);delete _0x2edd04[_0x1276c3];}if(_0x2edd04[_0x1276c3]&&_0x2edd04[_0x1276c3][_0x77f3('0xd6')]==='ivr'){_0x4242f8[_0x77f3('0xcc')](_0x4242f8[_0x77f3('0x1f')][_0x2edd04[_0x1276c3][_0x77f3('0xc9')]]);logger[_0x77f3('0x6f')]('[Dialer][checkChannel][ivr]',_0x324f7f,_0x1276c3,_0x2edd04[_0x1276c3]['queue']);delete _0x2edd04[_0x1276c3];}},0x2328);}});}});}}};Dialer['prototype'][_0x77f3('0x15a')]=function(_0x4320da){return Promise[_0x77f3('0xb4')]()['then'](voiceQueueRt[_0x77f3('0x15a')](_0x4320da))['catch'](loggerCatch(_0x77f3('0x15b')));};Dialer['prototype'][_0x77f3('0xcc')]=function(_0xe162e5){if(!_[_0x77f3('0x45')](_0xe162e5)&&_0xe162e5!==null){if(typeof _0xe162e5[_0x77f3('0x15c')]!==_0x77f3('0xb2')){if(_0xe162e5[_0x77f3('0x15c')]>0x0){_0xe162e5[_0x77f3('0x15c')]-=0x1;}else{logger[_0x77f3('0x6f')](_0x77f3('0x15d'));}}}else{logger[_0x77f3('0x6f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x77f3('0x90')][_0x77f3('0x15e')]=function(_0x17b327,_0x18865e){var _0x14d657=this;return function(_0x283a2a){_0x14d657[_0x77f3('0xcc')](_0x18865e);logger['error'](_0x17b327,util[_0x77f3('0x49')](_0x283a2a,{'showHidden':![],'depth':null}));};};Dialer[_0x77f3('0x90')][_0x77f3('0x15f')]=function(_0x564b65,_0x22fd52,_0x3bb2f7){var _0x188041={'state':0x19,'statedesc':'notFound'};this[_0x77f3('0xcc')](_0x22fd52);this[_0x77f3('0x11d')](_[_0x77f3('0x66')](_0x188041,_[_0x77f3('0x80')](_0x3bb2f7,[_0x77f3('0xf4'),'ListId',_0x77f3('0x160'),_0x77f3('0xe8'),_0x77f3('0xe9')])),_0x77f3('0x161'),'[emptyContact]');logger[_0x77f3('0x6f')](_0x564b65);};Dialer[_0x77f3('0x90')][_0x77f3('0x11d')]=function(_0x109c38,_0x3d389b,_0x4dadde){hopperUtils['createHistory'](_0x109c38)[_0x77f3('0xa8')](loggerCatch(_0x3d389b));hopperUtils['moveContactManagedDialer'](_0x109c38)['catch'](loggerCatch(_0x4dadde));};Dialer[_0x77f3('0x90')][_0x77f3('0xe4')]=function(_0x3fbb83,_0x406421){hopperUtils[_0x77f3('0xd3')](_0x3fbb83)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x162')));if(_0x406421==0x0){hopperUtils['moveContactManagedDialer'](_0x3fbb83)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x163')));}};Dialer[_0x77f3('0x90')][_0x77f3('0x154')]=function(_0x259f37){return Promise['resolve']()['then'](cmHopper[_0x77f3('0x14f')](_0x259f37['id'],previewRecallmeReminderInterval))[_0x77f3('0x43')](function(_0xad7ccc){for(var _0x1b499d=0x0;_0x1b499d<_0xad7ccc[_0x77f3('0x103')];_0x1b499d++){var _0xee8296=_0xad7ccc[_0x1b499d][_0x77f3('0x151')][_0x77f3('0x4c')];if(_0xee8296)io['to'](util[_0x77f3('0x4a')]('user:%s',_0xee8296))[_0x77f3('0x46')](_0x77f3('0x153'),{'hopper':_0xad7ccc[_0x1b499d]});}})[_0x77f3('0xa8')](function(){});};Dialer['prototype'][_0x77f3('0xb8')]=function(_0x20c898){var _0x3230f3=this;return function(){_0x3230f3[_0x77f3('0x164')](_0x20c898);};};Dialer['prototype']['actionOriginate']=function(_0x5d6042,_0x158a2e){var _0x43e16d=this;var _0x136aec=uuid['v4']();this['actions'][_0x136aec]=new Action(_0x5d6042,_0x158a2e,_0x136aec);return new Promise(function(_0x1cc894,_0x4c501d){if(_[_0x77f3('0x45')](_0x5d6042)&&typeof _0x5d6042!==_0x77f3('0x165')){return _0x4c501d(msgResponse('originate',_0x77f3('0xa0'),_0x77f3('0x166')));}if(_[_0x77f3('0x45')](_0x158a2e[_0x77f3('0x167')])||_0x158a2e[_0x77f3('0x167')]===null){return _0x4c501d(msgResponse('originate','Failure',_0x77f3('0x168')));}var _0x49d165={'XMD-CALLERID':_0x43e16d[_0x77f3('0x24')][_0x136aec][_0x77f3('0x169')](),'XMD-AGI':_0x5d6042[_0x77f3('0x137')]?util['format'](_0x77f3('0x16a'),ipAgi,_0x5d6042['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x5d6042[_0x77f3('0x16b')]?util[_0x77f3('0x4a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5d6042[_0x77f3('0x16b')]):_0x77f3('0x16c'),'XMD-QUEUE':utils['isOutboundQueue'](_0x5d6042)?util[_0x77f3('0x4a')](_0x77f3('0x16d'),_0x5d6042[_0x77f3('0x4c')],_0x5d6042[_0x77f3('0x16e')]||'',_0x5d6042[_0x77f3('0x16f')]?'c':'',_0x5d6042[_0x77f3('0xda')]||0x3):_0x77f3('0x16c'),'XMD-CONTACTID':_0x158a2e[_0x77f3('0xf4')],'XMD-CDRTYPE':_0x77f3('0x9'),'CALLERID(all)':_0x43e16d['actions'][_0x136aec][_0x77f3('0x169')](),'XMD-AMD':_0x5d6042[_0x77f3('0x118')]?'ACTIVE':_0x77f3('0x16c'),'XMD-DESTINATION':_0x77f3('0x117')};if(_0x5d6042[_0x77f3('0x118')]){_0x49d165[_0x77f3('0x170')]=_0x5d6042[_0x77f3('0x171')]||0x9c4;_0x49d165[_0x77f3('0x172')]=_0x5d6042[_0x77f3('0x173')]||0x5dc;_0x49d165['XMD-AMDAFTERGREETINGSILENCE']=_0x5d6042[_0x77f3('0x174')]||0x320;_0x49d165[_0x77f3('0x175')]=_0x5d6042[_0x77f3('0x176')]||0x1388;_0x49d165[_0x77f3('0x177')]=_0x5d6042[_0x77f3('0x178')]||0x64;_0x49d165[_0x77f3('0x179')]=_0x5d6042[_0x77f3('0x17a')]||0x32;_0x49d165[_0x77f3('0x17b')]=_0x5d6042[_0x77f3('0x17c')]||0x3;_0x49d165[_0x77f3('0x17d')]=_0x5d6042[_0x77f3('0x17e')]||0x100;_0x49d165[_0x77f3('0x17f')]=_0x5d6042[_0x77f3('0x180')]||0x1388;}if(utils['isOutboundQueue'](_0x5d6042)){_0x49d165['XMD-VOICEQUEUEID']=_0x158a2e['VoiceQueueId'];}else{_0x49d165[_0x77f3('0x181')]=_0x158a2e[_0x77f3('0xe9')];}for(var _0x231c2e in _0x158a2e[_0x77f3('0x182')]){if(typeof _0x158a2e['Contact'][_0x231c2e]!==_0x77f3('0xb2')){if(isNotNull(_0x158a2e[_0x77f3('0x182')][_0x231c2e])&&_0x231c2e!=='id'&&_0x231c2e!==_0x77f3('0x183')&&_0x231c2e!==_0x77f3('0x184')&&_0x231c2e!==_0x77f3('0x185')){_0x49d165[util[_0x77f3('0x4a')]('%s%s',_0x77f3('0x186'),_['toUpper'](_0x231c2e))]=_0x158a2e[_0x77f3('0x182')][_0x231c2e];}}}var _0x486c56=_0x43e16d['isTrunkReachable'](_0x5d6042['Trunk'])?utils[_0x77f3('0x187')](_0x5d6042[_0x77f3('0x188')][_0x77f3('0x189')],_0x5d6042[_0x77f3('0x18a')],_0x5d6042[_0x77f3('0x18b')]>0x0?utils[_0x77f3('0x18c')](_0x5d6042['dialOriginateCallerIdNumber'],_0x5d6042[_0x77f3('0x18b')]):_0x5d6042[_0x77f3('0x18d')]):utils[_0x77f3('0x187')](_[_0x77f3('0x106')](_0x5d6042[_0x77f3('0x98')])?_0x5d6042[_0x77f3('0x188')][_0x77f3('0x189')]:_0x5d6042['TrunkBackup'][_0x77f3('0x189')],_0x5d6042[_0x77f3('0x18a')],_0x5d6042[_0x77f3('0x18b')]>0x0?utils['getCallerIdRandom'](_0x5d6042[_0x77f3('0x18d')],_0x5d6042['dialRandomLastDigitCallerIdNumber']):_0x5d6042[_0x77f3('0x18d')]);if(_0x486c56){_0x49d165[_0x77f3('0x18e')]=_0x43e16d[_0x77f3('0x24')][_0x136aec][_0x77f3('0x18f')]=utils['extractCalleridName'](_0x486c56);_0x49d165[_0x77f3('0x190')]=_0x158a2e[_0x77f3('0x167')];}_0x5d6042['variables']=_0x49d165;return ami[_0x77f3('0xa9')]({'actionid':_0x136aec,'action':'originate','channel':_0x43e16d[_0x77f3('0x97')](_0x5d6042[_0x77f3('0x188')])?util[_0x77f3('0x4a')]('SIP/%s/%s%s',_0x5d6042[_0x77f3('0x188')][_0x77f3('0x4c')],isNotNull(_0x5d6042[_0x77f3('0x191')])?_0x5d6042[_0x77f3('0x191')]['trim']()||'':'',_0x5d6042[_0x77f3('0x192')]>0x0?_0x158a2e[_0x77f3('0x167')][_0x77f3('0x193')](_0x5d6042[_0x77f3('0x192')]):_0x158a2e[_0x77f3('0x167')]):util['format'](_0x77f3('0x194'),_['isNil'](_0x5d6042[_0x77f3('0x98')])?_0x5d6042[_0x77f3('0x188')][_0x77f3('0x4c')]:_0x5d6042[_0x77f3('0x98')][_0x77f3('0x4c')],isNotNull(_0x5d6042['dialPrefix'])?_0x5d6042[_0x77f3('0x191')]['trim']()||'':'',_0x5d6042[_0x77f3('0x192')]>0x0?_0x158a2e['phone'][_0x77f3('0x193')](_0x5d6042['dialCutDigit']):_0x158a2e['phone']),'callerid':_0x486c56,'Exten':_0x77f3('0x117'),'Context':_0x77f3('0x195'),'Priority':'1','variable':_0x49d165,'timeout':(_0x5d6042[_0x77f3('0x196')]||0x1e)*0x3e8,'async':!![],'channelid':_0x136aec})['then'](function(_0xb8aad9){return _0x1cc894(_0xb8aad9);})[_0x77f3('0xa8')](function(_0x439394){_0x5d6042[_0x77f3('0x197')]+=0x1;var _0x2a2662=new History(_0x43e16d[_0x77f3('0x24')][_0x136aec]);logger[_0x77f3('0x6f')](util['format'](_0x77f3('0x198'),JSON[_0x77f3('0x7f')](_0x439394)));_0x2a2662[_0x77f3('0x78')]=0xe;_0x2a2662[_0x77f3('0x79')]=_0x77f3('0x199');_0x2a2662[_0x77f3('0x7b')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));_0x2a2662['endtime']=_0x2a2662['starttime'];hopperUtils[_0x77f3('0xd3')](_0x2a2662)['catch'](loggerCatch(_0x77f3('0x19a')));_0x43e16d['moveContactManagedDialer'](_0x2a2662)[_0x77f3('0xa8')](loggerCatch('[originate][error]'))[_0x77f3('0x1b')](function(){delete _0x43e16d['actions'][_0x136aec];return _0x4c501d(msgResponse(_0x77f3('0x19b'),_0x77f3('0x8f'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x21a48d,_0x2af4c1,_0x312c04){var _0x1ceb66=new History(_0x2af4c1);if(_0x1ceb66[_0x77f3('0x127')]+_0x1ceb66[_0x77f3('0x131')]+_0x1ceb66[_0x77f3('0x132')]+_0x1ceb66[_0x77f3('0x19c')]+_0x1ceb66['countdropretry']+_0x1ceb66['countabandonedretry']+_0x1ceb66['countmachineretry']+_0x1ceb66[_0x77f3('0x128')]>=_0x312c04['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x21a48d){case 0x3:if(_0x1ceb66[_0x77f3('0x132')]>=_0x312c04[_0x77f3('0x19d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1ceb66[_0x77f3('0x132')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0x19e')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66[_0x77f3('0xe7')],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x1ceb66[_0x77f3('0x127')]>=_0x312c04['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countbusyretry':_0x1ceb66[_0x77f3('0x127')]+=0x1,'scheduledat':moment()['add'](_0x312c04[_0x77f3('0x19f')],'minutes')[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66['ContactId'],'ListId':_0x1ceb66[_0x77f3('0xe7')],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1a0')));break;case 0x8:if(_0x1ceb66[_0x77f3('0x131')]>=_0x312c04[_0x77f3('0x1a1')]-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countcongestionretry':_0x1ceb66[_0x77f3('0x131')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0x1a2')],'minutes')[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66['ListId'],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x1ceb66[_0x77f3('0x19c')]>=_0x312c04[_0x77f3('0x1a3')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1ceb66[_0x77f3('0x19c')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04['dialNoSuchNumberRetryFrequency'],_0x77f3('0xe6'))[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66['ListId'],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1a4')));}break;case 0xa:if(_0x1ceb66[_0x77f3('0xde')]>=_0x312c04[_0x77f3('0xe3')]-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countdropretry':_0x1ceb66[_0x77f3('0xde')]+=0x1,'scheduledat':moment()['add'](_0x312c04[_0x77f3('0x1a5')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66[_0x77f3('0xe7')],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1ceb66['countabandonedretry']>=_0x312c04[_0x77f3('0xf2')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1ceb66[_0x77f3('0xef')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0xf0')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66['ContactId'],'ListId':_0x1ceb66['ListId'],'VoiceQueueId':_0x1ceb66[_0x77f3('0xe8')]||undefined,'CampaignId':_0x1ceb66['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1a6')));break;case 0x13:if(_0x1ceb66[_0x77f3('0x123')]>=_0x312c04[_0x77f3('0x12b')]-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countmachineretry':_0x1ceb66[_0x77f3('0x123')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0x12d')],_0x77f3('0xe6'))[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66[_0x77f3('0xe7')],'VoiceQueueId':_0x1ceb66['VoiceQueueId']||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1a7')));break;case 0x14:if(_0x1ceb66[_0x77f3('0x128')]>=_0x312c04['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x77f3('0xf3')]({'active':![],'countagentrejectretry':_0x1ceb66[_0x77f3('0x128')]+=0x1,'scheduledat':moment()[_0x77f3('0xe5')](_0x312c04[_0x77f3('0x1a8')],'minutes')[_0x77f3('0x4a')](_0x77f3('0xce')),'ContactId':_0x1ceb66[_0x77f3('0xf4')],'ListId':_0x1ceb66['ListId'],'VoiceQueueId':_0x1ceb66['VoiceQueueId']||undefined,'CampaignId':_0x1ceb66[_0x77f3('0xe9')]||undefined})['catch'](loggerCatch(_0x77f3('0x1a9')));break;default:return!![];}};Dialer[_0x77f3('0x90')][_0x77f3('0x112')]=function(_0x4e3136,_0x3808ab,_0x2fb640){var _0x547a0e=this;var _0x547451=new History(_0x4e3136);var _0x48e120=![];var _0x41c4fd;var _0x3e609a;return new Promise(function(_0x4c551a,_0x454eac){if(_[_0x77f3('0x45')](_0x3808ab)&&typeof _0x3808ab!==_0x77f3('0x165')){return _0x454eac(msgResponse(_0x77f3('0x1aa'),_0x77f3('0xa0'),_0x77f3('0x1ab')));}if(_[_0x77f3('0x45')](_0x2fb640)&&typeof _0x2fb640!==_0x77f3('0x165')){return _0x454eac(msgResponse(_0x77f3('0x1aa'),'Failure',_0x77f3('0x1ac')));}hopperUtils[_0x77f3('0xf1')](_0x547451,_0x2fb640[_0x77f3('0xd0')],_0x3808ab)['then'](function(_0x22e4e5){if(_0x22e4e5['additional']==0x1)_0x48e120=!![];switch(_0x2fb640[_0x77f3('0xd0')]){case'0':_0x3808ab['outboundNoSuchCallsDay']+=0x1;_0x547451[_0x77f3('0x78')]=0x0;_0x547451['statedesc']=_0x77f3('0x1ad');_0x547451[_0x77f3('0x19c')]+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;ami[_0x77f3('0x46')]('custom:agentnosuchnumber',ut[_0x77f3('0x125')](_0x4e3136,'nosuchnumber'));_0x41c4fd=_0x3808ab[_0x77f3('0x1ae')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];hopperUtils[_0x77f3('0xd3')](_0x547451)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x126')));if(_0x547a0e[_0x77f3('0x1af')](0x0,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x19c')]>=_0x3808ab[_0x77f3('0x1a3')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1b0'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1b0'));}}break;case'3':_0x3808ab[_0x77f3('0x1b2')]+=0x1;_0x547451[_0x77f3('0x78')]=0x3;_0x547451[_0x77f3('0x79')]=_0x77f3('0x1b3');_0x547451['countnoanswerretry']+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;var _0x2a2122=ut['buildNoAnswerEventPayload'](_0x4e3136,_0x3808ab);ami[_0x77f3('0x46')](_0x77f3('0x1b4'),_0x2a2122);_0x41c4fd=_0x3808ab[_0x77f3('0x19e')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];hopperUtils[_0x77f3('0xd3')](_0x547451)['catch'](loggerCatch(_0x77f3('0x1b5')));if(_0x547a0e[_0x77f3('0x1af')](0x3,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x132')]>=_0x3808ab['dialNoAnswerMaxRetry']){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1b6'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1b6'));}}break;case'5':_0x3808ab[_0x77f3('0x1b7')]+=0x1;_0x547451[_0x77f3('0x78')]=0x5;_0x547451['statedesc']=_0x77f3('0x1b8');_0x547451[_0x77f3('0x127')]+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;ami[_0x77f3('0x46')]('custom:agentbusy',ut[_0x77f3('0x125')](_0x4e3136,_0x77f3('0x1b9')));_0x41c4fd=_0x3808ab[_0x77f3('0x19f')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];hopperUtils[_0x77f3('0xd3')](_0x547451)[_0x77f3('0xa8')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x547a0e[_0x77f3('0x1af')](0x5,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451['countbusyretry']>=_0x3808ab[_0x77f3('0x1ba')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1bb'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1bb'));}}break;case'8':_0x3808ab[_0x77f3('0x1bc')]+=0x1;_0x547451['state']=0x8;_0x547451[_0x77f3('0x79')]=_0x77f3('0x1bd');_0x547451[_0x77f3('0x131')]+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;_0x41c4fd=_0x3808ab[_0x77f3('0x1a2')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];ami[_0x77f3('0x46')]('custom:agentcongestion',ut[_0x77f3('0x125')](_0x4e3136,_0x77f3('0x1be')));hopperUtils['createHistory'](_0x547451)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1bf')));if(_0x547a0e[_0x77f3('0x1af')](0x8,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x131')]>=_0x3808ab[_0x77f3('0x1a1')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c0'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c0'));}}break;case'11':_0x3808ab['outboundAbandonedCallsDay']+=0x1;_0x547451[_0x77f3('0x78')]=0xb;_0x547451[_0x77f3('0x79')]=_0x77f3('0xf5');_0x547451['countabandonedretry']+=0x1;_0x547451[_0x77f3('0xdf')]+=0x1;_0x41c4fd=_0x3808ab[_0x77f3('0xf0')];_0x3e609a=_0x3808ab['callAdditionalPhoneAfterMin'];hopperUtils[_0x77f3('0xd3')](_0x547451)['catch'](loggerCatch(_0x77f3('0xf6')));if(_0x547a0e[_0x77f3('0x1af')](0xb,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451['countabandonedretry']>=_0x3808ab[_0x77f3('0xf2')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c1'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c1'));}}break;case'20':_0x3808ab[_0x77f3('0x1c2')]+=0x1;_0x547451[_0x77f3('0x78')]=0x14;_0x547451[_0x77f3('0x79')]=_0x77f3('0x1c3');_0x547451[_0x77f3('0x128')]+=0x1;_0x547451['countglobal']+=0x1;_0x41c4fd=_0x3808ab[_0x77f3('0x1a8')];_0x3e609a=_0x3808ab[_0x77f3('0xe0')];ami[_0x77f3('0x46')](_0x77f3('0x1c4'),ut['buildObj'](_0x4e3136,'agentreject'));hopperUtils['createHistory'](_0x547451)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1c5')));if(_0x547a0e[_0x77f3('0x1af')](0x14,_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x128')]>=_0x3808ab[_0x77f3('0x1c6')]){_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c7'));}else{_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x77f3('0x1c7'));}}break;default:_0x3808ab[_0x77f3('0x13a')]+=0x1;_0x547451[_0x77f3('0x78')]=0xc;_0x547451[_0x77f3('0x79')]=_0x2fb640[_0x77f3('0xd0')];_0x41c4fd=_0x3808ab[_0x77f3('0x1a8')];_0x3e609a=_0x3808ab['callAdditionalPhoneAfterMin'];hopperUtils[_0x77f3('0xd3')](_0x547451)[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1c8')));if(_0x547a0e[_0x77f3('0x1af')](_0x2fb640['reason'],_0x4e3136,_0x3808ab)&&!_0x48e120){if(_0x547451[_0x77f3('0x127')]+_0x547451[_0x77f3('0x131')]+_0x547451['countnoanswerretry']+_0x547451[_0x77f3('0x19c')]+_0x547451[_0x77f3('0xde')]+_0x547451['countabandonedretry']+_0x547451[_0x77f3('0x123')]+_0x547451[_0x77f3('0x128')]>=_0x3808ab[_0x77f3('0x129')]){_0x547a0e[_0x77f3('0x1b1')](_0x547451,_0x4c551a,_0x454eac,_0x2fb640[_0x77f3('0xd0')]);}else{_0x547a0e[_0x77f3('0x133')](_0x547451,_0x4c551a,_0x454eac,_0x2fb640[_0x77f3('0xd0')]);}}}})[_0x77f3('0x43')](function(){if(_0x48e120){hopperUtils[_0x77f3('0xec')](_0x547451,_0x41c4fd,_0x3e609a)[_0x77f3('0x43')](function(){return _0x4c551a(0x1);});}});});};Dialer['prototype'][_0x77f3('0x1b1')]=function(_0x175ffe,_0x2134b0,_0x434577,_0x4e1536){var _0x3ae7d4=new Final(_0x175ffe);_0x3ae7d4[_0x77f3('0x78')]=0xf;_0x3ae7d4[_0x77f3('0x79')]='Global';this['createStateFinal'](_0x3ae7d4,_0x2134b0,_0x434577,_0x4e1536);};Dialer[_0x77f3('0x90')]['createStateFinal']=function(_0x5a95a8,_0x72acdd,_0x190c62,_0x40a57e){hopperUtils['moveContactManagedDialer'](_0x5a95a8)[_0x77f3('0x43')](function(){return _0x72acdd(msgResponse(_0x77f3('0x1aa'),_0x77f3('0x111'),_0x40a57e));})['catch'](function(){return _0x190c62(msgResponse(_0x77f3('0x1c9'),_0x77f3('0xa0'),_0x77f3('0x1ca')));});};Dialer[_0x77f3('0x90')]['predictive']=function(_0x5cb8e1){var _0x3e756b=_0x5cb8e1['dialPredictiveOptimizationPercentage']/0x64;var _0x27e13e=_0x5cb8e1[_0x77f3('0xdb')]/(_0x5cb8e1['outboundDropCallsDayTimeout']+_0x5cb8e1[_0x77f3('0xcf')]);var _0x31a395=Math[_0x77f3('0x1cb')](_0x5cb8e1[_0x77f3('0x1cc')]*(_0x5cb8e1[_0x77f3('0x1cd')]/0x64));var _0x1bfb99=Math[_0x77f3('0x1cb')](_0x5cb8e1[_0x77f3('0x1cc')]*(_0x5cb8e1[_0x77f3('0x1ce')]/0x64));var _0x4b78df=_0x5cb8e1['available']+_0x5cb8e1['talking'];var _0x132f4e=Math[_0x77f3('0x1cf')](_0x5cb8e1[_0x77f3('0x5f')]*_0x5cb8e1[_0x77f3('0x63')]*_0x5cb8e1[_0x77f3('0x1d0')]*_0x5cb8e1[_0x77f3('0x1d1')]);if(_[_0x77f3('0x45')](_0x5cb8e1[_0x77f3('0x67')])){if(!_['isUndefined'](_0x5cb8e1[_0x77f3('0x6a')])){_0x5cb8e1[_0x77f3('0x6a')]=undefined;loggerPredictive[_0x77f3('0x6f')](_0x77f3('0x1d2'),_0x77f3('0x1d3'));}if(!_[_0x77f3('0x45')](_0x5cb8e1[_0x77f3('0x6c')])){loggerPredictive[_0x77f3('0x6f')](_0x77f3('0x1d2'),_0x77f3('0x1d4'));clearInterval(_0x5cb8e1[_0x77f3('0x6c')]);_0x5cb8e1[_0x77f3('0x6c')]=undefined;}_0x5cb8e1[_0x77f3('0x67')]=moment()['format'](_0x77f3('0xce'));loggerPredictive[_0x77f3('0x4e')](_0x5cb8e1[_0x77f3('0x4c')],_0x77f3('0x1d5'),_0x5cb8e1[_0x77f3('0x67')]);this[_0x77f3('0xbc')](_0x5cb8e1,0x1);}else if(ifInterval(_0x5cb8e1[_0x77f3('0x1d6')],_0x5cb8e1[_0x77f3('0x67')])){this['handlePower'](_0x5cb8e1,0x1);loggerPredictiveCalls['info'](_0x77f3('0x1d7'),_0x5cb8e1[_0x77f3('0x67')],_0x5cb8e1[_0x77f3('0x4c')]);_0x5cb8e1[_0x77f3('0x5f')]=0x0;_0x5cb8e1[_0x77f3('0x1d8')]=0x0;}else if(_0x3e756b<_0x27e13e&&_0x5cb8e1[_0x77f3('0x1d9')]===_0x77f3('0x1da')){clearPredictiveAttributes(_0x5cb8e1);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x1db'),_0x77f3('0x1dc'),_0x27e13e,'startProgressive',_0x5cb8e1[_0x77f3('0x4c')]);}else if(_0x132f4e<_0x5cb8e1[_0x77f3('0x1d8')]&&_0x5cb8e1['dialPredictiveOptimization']===_0x77f3('0x1da')){clearPredictiveAttributes(_0x5cb8e1);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x77f3('0x1dd'),_0x132f4e,'Drop\x20in\x20this\x20interval',_0x5cb8e1[_0x77f3('0x1d8')],_0x77f3('0x67'),_0x5cb8e1[_0x77f3('0x4c')]);}else if(!ifInterval(_0x5cb8e1[_0x77f3('0x1d6')],_0x5cb8e1[_0x77f3('0x67')])&&_[_0x77f3('0x45')](_0x5cb8e1[_0x77f3('0x6a')])&&!_[_0x77f3('0x45')](_0x5cb8e1[_0x77f3('0x67')])){_0x5cb8e1['startPredictive']=moment()[_0x77f3('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5cb8e1['name'],'started\x20in\x20predictive\x20at',_0x5cb8e1[_0x77f3('0x6a')]);hopperUtils['avgHandleTime'](_0x5cb8e1[_0x77f3('0x1d6')])[_0x77f3('0x43')](this[_0x77f3('0x1de')](_0x5cb8e1))[_0x77f3('0x43')](mergeDataErlangB(_0x5cb8e1))[_0x77f3('0x43')](this[_0x77f3('0x1df')](_0x5cb8e1))[_0x77f3('0xa8')](loggerCatchPredictive(_0x77f3('0x1e0'),_0x5cb8e1));}else if(!ifInterval(_0x5cb8e1[_0x77f3('0x1d6')],_0x5cb8e1['startPredictive'])){_0x5cb8e1[_0x77f3('0x1d8')]=0x0;_0x5cb8e1[_0x77f3('0x6a')]=moment()[_0x77f3('0x4a')](_0x77f3('0xce'));loggerPredictive['info'](_0x5cb8e1[_0x77f3('0x4c')],_0x77f3('0x1e1'),_0x5cb8e1[_0x77f3('0x6a')]);clearInterval(_0x5cb8e1[_0x77f3('0x6c')]);_0x5cb8e1[_0x77f3('0x6c')]=undefined;hopperUtils['avgHandleTime'](_0x5cb8e1[_0x77f3('0x1d6')])[_0x77f3('0x43')](this['getDataPredictive'](_0x5cb8e1))[_0x77f3('0x43')](mergeDataErlangB(_0x5cb8e1))[_0x77f3('0x43')](this[_0x77f3('0x1df')](_0x5cb8e1))[_0x77f3('0xa8')](loggerCatchPredictive(_0x77f3('0x1e2'),_0x5cb8e1));}else if(_0x5cb8e1[_0x77f3('0x1cc')]&&_0x4b78df<_0x5cb8e1[_0x77f3('0x1cc')]-_0x1bfb99){clearPredictiveAttributes(_0x5cb8e1);loggerPredictive[_0x77f3('0x4e')](_0x5cb8e1[_0x77f3('0x4c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4b78df,_0x77f3('0x1e3'),_0x5cb8e1[_0x77f3('0x1cc')],'-',_0x1bfb99,'=',_0x5cb8e1[_0x77f3('0x1cc')]-_0x1bfb99,')');}else if(_0x5cb8e1[_0x77f3('0x1cc')]&&_0x4b78df>_0x5cb8e1[_0x77f3('0x1cc')]+_0x31a395){clearPredictiveAttributes(_0x5cb8e1);loggerPredictive[_0x77f3('0x4e')](_0x5cb8e1[_0x77f3('0x4c')],_0x77f3('0x1e4'),_0x4b78df,_0x77f3('0x1e5'),_0x5cb8e1[_0x77f3('0x1cc')],'+',_0x31a395,'=',_0x5cb8e1[_0x77f3('0x1cc')]+_0x31a395,')');}};Dialer['prototype']['getDataPredictive']=function(_0x42cc68){var _0x1bcbfd=this;return function(_0x1fe0bb){return new Promise(function(_0x7d71a9,_0x2e650c){_[_0x77f3('0x66')](_0x42cc68,_0x1fe0bb[0x0]);if(checkGetDataPredictive(_0x1fe0bb[0x0])){var _0x177520=_0x42cc68['predictiveIntervalAvailable']=_0x42cc68[_0x77f3('0x144')]+_0x42cc68[_0x77f3('0x142')];var _0xa747bf=_0x42cc68[_0x77f3('0x1d6')]*0x3c;var _0x60fc3c=_0x1fe0bb[0x0][_0x77f3('0x57')]+_0x1fe0bb[0x0][_0x77f3('0x56')];var _0x1c9219=(_0x1fe0bb[0x0][_0x77f3('0x52')]+_0x1fe0bb[0x0][_0x77f3('0x53')]+_0x1fe0bb[0x0][_0x77f3('0x54')])/_0x1fe0bb[0x0][_0x77f3('0x50')];_0x42cc68[_0x77f3('0x1d0')]=_0x1c9219>0x0?_0x1c9219:0x1;switch(_0x42cc68[_0x77f3('0x1d9')]){case'dropRate':var _0x5a71dd=_0x42cc68[_0x77f3('0x1e6')]/0x64;return _0x1bcbfd[_0x77f3('0x1e7')](_0x177520,_0xa747bf,_0x60fc3c,_0x1c9219,_0x5a71dd)['then'](function(_0x2a5c7f){return _0x7d71a9(_0x2a5c7f);});case _0x77f3('0x1e8'):var _0x24b3de=_0x42cc68[_0x77f3('0x1e6')]/0x64;return _0x1bcbfd[_0x77f3('0x1e9')](_0x177520,_0xa747bf,_0x60fc3c,_0x1c9219,_0x24b3de)[_0x77f3('0x43')](function(_0x8a2aec){return _0x7d71a9(_0x8a2aec);});default:return _0x2e650c(msgResponse('[getDataPredictive]',_0x77f3('0xa0'),_0x77f3('0x1ea')));}}else{return _0x2e650c(msgResponse(_0x77f3('0x1eb'),_0x77f3('0xa0'),_0x77f3('0x1ec')));}});};};Dialer['prototype'][_0x77f3('0x1ed')]=function(_0x334316){var _0x514080=this;return function(_0x2a8132){return new Promise(function(_0x4f51c5,_0x3633f6){_['merge'](_0x334316,_0x2a8132[0x0]);if(checkGetDataPredictive(_0x2a8132[0x0])){loggerPredictive[_0x77f3('0x4e')](JSON['stringify'](_0x2a8132[0x0]));if(_0x334316[_0x77f3('0x1d9')]===_0x77f3('0x1da')){return _0x514080[_0x77f3('0x15a')](_0x334316['id'])[_0x77f3('0x43')](function(_0x418487){var _0x472bd5=_0x334316['loggedIn']-_0x418487[0x0][_0x77f3('0x1ee')];var _0x41f23d=_0x334316['dialPredictiveInterval']*0x3c;var _0xf299ba=_0x2a8132[0x0][_0x77f3('0x57')]+_0x2a8132[0x0][_0x77f3('0x56')];var _0xf252ba=(_0x2a8132[0x0]['predictiveIntervalAnsweredCalls']+_0x2a8132[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2a8132[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2a8132[0x0]['predictiveIntervalTotalCalls'];var _0x5cfdda=_0x334316[_0x77f3('0x1e6')]/0x64;_0x334316[_0x77f3('0x1ef')]=_0x418487[0x0]['outboundQueuePauses']||0x0;_0x334316[_0x77f3('0x1d0')]=_0xf252ba>0x0?_0xf252ba:0x1;return _0x514080[_0x77f3('0x1e7')](_0x472bd5,_0x41f23d,_0xf299ba,_0xf252ba,_0x5cfdda);})[_0x77f3('0x43')](function(_0x342222){return _0x4f51c5(_0x342222);})[_0x77f3('0xa8')](function(_0x49f9be){return _0x3633f6(msgResponse(_0x77f3('0x1f0'),_0x77f3('0xa0'),JSON[_0x77f3('0x7f')](_0x49f9be)));});}if(_0x334316['dialPredictiveOptimization']===_0x77f3('0x1e8')){return _0x514080['getVoiceQueueRtPauses'](_0x334316['id'])[_0x77f3('0x43')](function(_0xeda09){var _0x115f93=_0x334316[_0x77f3('0x1f1')]-_0xeda09[0x0][_0x77f3('0x1ee')];var _0x59f6d8=_0x334316['dialPredictiveInterval']*0x3c;var _0x55df45=_0x2a8132[0x0][_0x77f3('0x57')]+_0x2a8132[0x0][_0x77f3('0x56')];var _0x1d444d=(_0x2a8132[0x0][_0x77f3('0x52')]+_0x2a8132[0x0][_0x77f3('0x53')]+_0x2a8132[0x0][_0x77f3('0x54')])/_0x2a8132[0x0][_0x77f3('0x50')];var _0x2bd8ef=_0x334316[_0x77f3('0x1e6')]/0x64;_0x334316[_0x77f3('0x1ef')]=_0xeda09[0x0]['outboundQueuePauses']||0x0;_0x334316['predictiveIntervalHitRate']=_0x1d444d>0x0?_0x1d444d:0x1;return _0x514080[_0x77f3('0x1e9')](_0x115f93,_0x59f6d8,_0x55df45,_0x1d444d,_0x2bd8ef);})[_0x77f3('0x43')](function(_0x487f50){return _0x4f51c5(_0x487f50);})['catch'](function(_0xe3280c){return _0x3633f6(msgResponse(_0x77f3('0x1f0'),'Failure',JSON[_0x77f3('0x7f')](_0xe3280c)));});}}else{return _0x3633f6(msgResponse(_0x77f3('0x1eb'),_0x77f3('0xa0'),_0x77f3('0x1ec')));}});};};Dialer[_0x77f3('0x90')][_0x77f3('0x1df')]=function(_0x50a673){var _0xe717ce=this;return function(){var _0x12df1e=0x0;var _0x29835c=Math[_0x77f3('0x1cf')](_0x50a673[_0x77f3('0x61')]*0x3e8);if(_0x29835c>0x0){_0x29835c=_0x29835c<0x64?0x64:_0x29835c;loggerPredictive[_0x77f3('0x4e')](_0x50a673[_0x77f3('0x4c')],_0x77f3('0x1f2'),_0x29835c,_0x77f3('0x1f3'));_0x50a673['handlePredictive']=setInterval(function(){_0xe717ce[_0x77f3('0x6c')](_0x50a673);loggerPredictiveCalls[_0x77f3('0x4e')](_0x77f3('0x1f4'),_0x12df1e+=0x1);},_0x29835c);}else{loggerPredictive[_0x77f3('0x4e')](_0x50a673['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x77f3('0x1f5')]=function(_0x403cf7,_0x1c890a){var _0x3d5640=this;return function(_0x275edf){if(_[_0x77f3('0x4d')](_0x275edf)){if(_[_0x77f3('0x106')](_0x1c890a[_0x77f3('0x160')])||!_0x1c890a[_0x77f3('0x1f6')]){if(_0x403cf7[_0x77f3('0xba')]===_0x77f3('0xa')){_0x403cf7[_0x77f3('0x7c')]=_[_0x77f3('0x45')](_0x403cf7[_0x77f3('0x7c')])?!![]:_0x403cf7[_0x77f3('0x7c')];var _0x32e8f9=uuid['v4']();_0x3d5640[_0x77f3('0x24')][_0x32e8f9]=new Action(_0x403cf7,_0x1c890a,_0x32e8f9);loggerBooked[_0x77f3('0x4e')](_0x77f3('0x1f7'),_0x32e8f9,_0x77f3('0x1f8'),JSON[_0x77f3('0x7f')](_0x403cf7[_0x77f3('0x7c')]),'Queue:\x20',_0x403cf7[_0x77f3('0x4c')]);if(_0x403cf7[_0x77f3('0x7c')]){_0x403cf7['queueStatusComplete']=![];_0x3d5640['queueBooked'][_0x3d5640['actions'][_0x32e8f9]['queue']]=[];ami[_0x77f3('0xa9')]({'actionid':_0x32e8f9,'action':'queuestatus','queue':_0x403cf7[_0x77f3('0x4c')]})['catch'](function(){_0x3d5640['updateOriginated'](_0x403cf7);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9]['ContactId'],'ListId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9][_0x77f3('0xe7')],'VoiceQueueId':_0x3d5640['actions'][_0x32e8f9]['VoiceQueueId']||undefined,'CampaignId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9]['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1f9')));delete _0x3d5640[_0x77f3('0x24')][_0x32e8f9];});}else{loggerBooked[_0x77f3('0x4e')](_0x77f3('0x1fa'),JSON[_0x77f3('0x7f')](_0x403cf7[_0x77f3('0x7c')]),'Queue:\x20',_0x403cf7[_0x77f3('0x4c')]);_0x3d5640[_0x77f3('0xcc')](_0x403cf7);hopperUtils[_0x77f3('0xf3')]({'active':![],'ContactId':_0x3d5640['actions'][_0x32e8f9][_0x77f3('0xf4')],'ListId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9][_0x77f3('0xe7')],'VoiceQueueId':_0x3d5640[_0x77f3('0x24')][_0x32e8f9][_0x77f3('0xe8')]||undefined,'CampaignId':_0x3d5640['actions'][_0x32e8f9]['CampaignId']||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x1f9')));delete _0x3d5640[_0x77f3('0x24')][_0x32e8f9];}}else{return _0x3d5640[_0x77f3('0x1fb')](_0x403cf7,_0x1c890a);}}else{if(utils['getSeconds'](undefined,_0x1c890a[_0x77f3('0x1fc')])<_0x403cf7[_0x77f3('0x1fd')]*0x3c){if(_0x1c890a[_0x77f3('0x151')]&&!_0x1c890a[_0x77f3('0x151')][_0x77f3('0x1fe')]){_0x3d5640[_0x77f3('0x1d')][_0x77f3('0x107')](_0x1c890a['id'])[_0x77f3('0x1b')](function(){_0x3d5640[_0x77f3('0xcc')](_0x403cf7);});}else{hopperUtils[_0x77f3('0x1ff')]({'active':![]},_0x1c890a['id'],0x1)['finally'](function(){_0x3d5640['updateOriginated'](_0x403cf7);});}}else{_0x403cf7['outboundReCallsDay']+=0x1;_0x3d5640[_0x77f3('0xcc')](_0x403cf7);if(_0x403cf7[_0x77f3('0x200')]){hopperUtils[_0x77f3('0xf3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1c890a[_0x77f3('0xf4')],'ListId':_0x1c890a[_0x77f3('0xe7')],'VoiceQueueId':_0x1c890a['VoiceQueueId']||undefined,'CampaignId':_0x1c890a[_0x77f3('0xe9')]||undefined})[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x201')));hopperUtils[_0x77f3('0xd3')](createObjHistory(_0x403cf7,_0x1c890a,utils[_0x77f3('0x72')][_0x77f3('0x202')],0x17,_0x77f3('0x203')))[_0x77f3('0xa8')](loggerCatch(_0x77f3('0x204')));}else{_0x3d5640[_0x77f3('0x11d')](createObjHistory(_0x403cf7,_0x1c890a,utils[_0x77f3('0x72')][_0x77f3('0x205')],0x16,'RecallFailedTimeout'),_0x77f3('0x206'),_0x77f3('0x207'));}}}}else{_0x403cf7['outboundBlacklistCallsDay']+=0x1;_0x3d5640['saveInDb'](createObjHistory(_0x403cf7,_0x1c890a,utils[_0x77f3('0x72')]['BLACKLIST'],0xd,_0x77f3('0x208')),_0x77f3('0x209'),_0x77f3('0x20a'));throw _0x77f3('0x20b');}};};Dialer[_0x77f3('0x90')]['handleIvr']=function(_0x8c0398){var _0x79c5c4=this;var _0x39a93f=_0x8c0398[_0x77f3('0x20c')]-_0x8c0398['originated']-_0x8c0398[_0x77f3('0x20d')];emitCampaignSummary(_0x8c0398);if(_0x39a93f>0x0){if(_0x39a93f>this[_0x77f3('0x22')]){_0x39a93f=this['maxNumberOriginate'];}_0x8c0398[_0x77f3('0x20d')]+=_0x39a93f;hopperUtils['getContactDialerIvr'](_0x8c0398['id'],_0x39a93f,_0x8c0398[_0x77f3('0x20e')],_0x8c0398)[_0x77f3('0x43')](function(_0x47090b){_0x8c0398[_0x77f3('0x20d')]-=_0x39a93f;_0x8c0398[_0x77f3('0x20d')]=_0x8c0398[_0x77f3('0x20d')]>0x0?_0x8c0398[_0x77f3('0x20d')]:0x0;if(!utils[_0x77f3('0x20f')](_0x47090b)){_0x8c0398[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['NO_AVAILABLE_CONTACTS'];logger[_0x77f3('0x4e')]('[getContactCampaign2][Empty]'+_0x8c0398[_0x77f3('0x4c')]);}else{_0x8c0398['originated']+=_0x47090b[_0x77f3('0x103')];_0x8c0398[_0x77f3('0x71')]=utils[_0x77f3('0x72')]['RUNNING'];for(var _0x43e13e=0x0;_0x43e13e<_0x47090b['length'];_0x43e13e+=0x1){_0x8c0398['ivrTotalCallsDays']+=0x1;if(_[_0x77f3('0x106')](_0x47090b[_0x43e13e])||_[_0x77f3('0x106')](_0x47090b[_0x43e13e][_0x77f3('0x182')])||_['isNil'](_0x47090b[_0x43e13e][_0x77f3('0x167')])){_0x79c5c4[_0x77f3('0x15f')](_0x77f3('0x210'),_0x8c0398,_0x47090b[_0x43e13e]);}else{hopperUtils[_0x77f3('0x211')](_[_0x77f3('0x80')](_0x47090b[_0x43e13e],['CampaignId',_0x77f3('0x167')]))[_0x77f3('0x43')](_0x79c5c4[_0x77f3('0x1f5')](_0x8c0398,_0x47090b[_0x43e13e]))[_0x77f3('0xa8')](_0x79c5c4[_0x77f3('0x15e')](_0x77f3('0x212'),_0x8c0398));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x8c0398,_0x39a93f));}};Dialer[_0x77f3('0x90')][_0x77f3('0xbc')]=function(_0x5201e6,_0x3ed15e){var _0x488242=this;var _0x41eff5=[];if(_0x3ed15e<0x1||_0x5201e6[_0x77f3('0xba')]===_0x77f3('0xa')){_0x3ed15e=0x1;}var _0x58b7b3=Math['floor'](_0x5201e6['available']*_0x3ed15e)-_0x5201e6[_0x77f3('0x15c')]-_0x5201e6[_0x77f3('0x20d')];if(_0x5201e6[_0x77f3('0x213')]>0x0){var _0x307954=_0x5201e6[_0x77f3('0x213')]-_0x5201e6[_0x77f3('0x15c')]-_0x5201e6[_0x77f3('0x144')]-_0x5201e6['temp']-_0x5201e6[_0x77f3('0x145')];if(_0x58b7b3>_0x307954){_0x58b7b3=_0x307954;}}if(_0x58b7b3>0x0){if(_0x5201e6['dialMethod']===_0x77f3('0xa')){_0x58b7b3=0x1;}if(_0x58b7b3>this[_0x77f3('0x22')]){_0x58b7b3=this['maxNumberOriginate'];}_0x5201e6['temp']+=_0x58b7b3;for(var _0x19d883 in this[_0x77f3('0x20')]){if(typeof this[_0x77f3('0x20')][_0x19d883]!==_0x77f3('0xb2')){if(this[_0x77f3('0x20')][_0x19d883][_0x77f3('0x78')]==='not_inuse'&&this[_0x77f3('0x20')][_0x19d883][_0x77f3('0x93')]===_0x77f3('0x94')){_0x41eff5[_0x77f3('0xfd')](this['agents'][_0x19d883]['id']);}}}hopperUtils[_0x77f3('0x214')](_0x5201e6,_0x41eff5,_0x58b7b3)[_0x77f3('0x43')](function(_0x4036c5){_0x5201e6['temp']-=_0x58b7b3;_0x5201e6[_0x77f3('0x20d')]=_0x5201e6[_0x77f3('0x20d')]>0x0?_0x5201e6[_0x77f3('0x20d')]:0x0;if(!utils[_0x77f3('0x20f')](_0x4036c5)){hopperUtils['countReScheduled'](_0x5201e6)[_0x77f3('0x43')](sendMessageReschedule(_0x5201e6))[_0x77f3('0xa8')](loggerCatch('[countReScheduled]\x20'));}else{_0x5201e6['originated']+=_0x4036c5['length'];_0x5201e6['message']=_0x5201e6['dialMethod']===_0x77f3('0xa')?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0x77f3('0x72')][_0x77f3('0x215')];for(var _0xfaeafa=0x0;_0xfaeafa<_0x4036c5[_0x77f3('0x103')];_0xfaeafa+=0x1){if(_[_0x77f3('0x106')](_0x4036c5[_0xfaeafa])||_['isNil'](_0x4036c5[_0xfaeafa]['Contact'])||_[_0x77f3('0x106')](_0x4036c5[_0xfaeafa][_0x77f3('0x167')])){_0x488242[_0x77f3('0x15f')](_0x77f3('0x210'),_0x5201e6,_0x4036c5[_0xfaeafa]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x4036c5[_0xfaeafa],[_0x77f3('0xe8'),_0x77f3('0x167')]))['then'](_0x488242[_0x77f3('0x1f5')](_0x5201e6,_0x4036c5[_0xfaeafa]))[_0x77f3('0xa8')](_0x488242['loggerHandler'](_0x77f3('0x210'),_0x5201e6));}}}})[_0x77f3('0xa8')](loggerGetContactDialer(_0x77f3('0x216'),_0x5201e6,_0x58b7b3));}};Dialer[_0x77f3('0x90')]['handlePredictive']=function(_0x176090){if(_0x176090[_0x77f3('0x213')]>0x0){var _0x6af9c7=_0x176090['dialLimitQueue']-_0x176090[_0x77f3('0x15c')]-_0x176090[_0x77f3('0x144')];if(_0x6af9c7>0x0){this['tryOriginatePredictive'](_0x176090);}else{loggerPredictiveCalls[_0x77f3('0x4e')]('[handlePredictive][limitChannel]');}}else{this[_0x77f3('0x217')](_0x176090);}};Dialer[_0x77f3('0x90')][_0x77f3('0x217')]=function(_0x395a41){var _0x13c39a=this;var _0x570d0e=[];_0x395a41[_0x77f3('0x15c')]+=0x1;for(var _0x205e2c in this[_0x77f3('0x20')]){if(typeof this['agents'][_0x205e2c]!==_0x77f3('0xb2')){if(this['agents'][_0x205e2c][_0x77f3('0x78')]===_0x77f3('0x218')&&this['agents'][_0x205e2c][_0x77f3('0x93')]===_0x77f3('0x94')){_0x570d0e[_0x77f3('0xfd')](this[_0x77f3('0x20')][_0x205e2c]['id']);}}}return this[_0x77f3('0x214')](_0x395a41['id'],_0x570d0e,0x1,_0x395a41[_0x77f3('0x20e')],_0x395a41)[_0x77f3('0x43')](function(_0x4ffe87){if(!utils[_0x77f3('0x20f')](_0x4ffe87)){utils[_0x77f3('0x6e')](_0x395a41,0x1,0x0);return hopperUtils[_0x77f3('0x219')](_0x395a41)['then'](sendMessageReschedule(_0x395a41))['catch'](loggerCatch(_0x77f3('0x21a')));}else{_0x395a41[_0x77f3('0x71')]=utils[_0x77f3('0x72')][_0x77f3('0x215')];if(_[_0x77f3('0x106')](_0x4ffe87[0x0])||_[_0x77f3('0x106')](_0x4ffe87[0x0][_0x77f3('0x182')])||_[_0x77f3('0x106')](_0x4ffe87[0x0][_0x77f3('0x167')])){_0x13c39a[_0x77f3('0x15f')](_0x77f3('0x210'),_0x395a41,_0x4ffe87[0x0]);}else{return hopperUtils[_0x77f3('0x21b')](_['pick'](_0x4ffe87[0x0],[_0x77f3('0xe8'),_0x77f3('0x167')]))[_0x77f3('0x43')](_0x13c39a[_0x77f3('0x1f5')](_0x395a41,_0x4ffe87[0x0]))[_0x77f3('0xa8')](_0x13c39a[_0x77f3('0x15e')](_0x77f3('0x21c'),_0x395a41));}}})[_0x77f3('0xa8')](loggerGetContactDialer(_0x77f3('0x21d'),_0x395a41,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x4616ae,_0x3298df,_0x13b613,_0x8b74be,_0x41d311,_0x1c3000){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x21e'),_0x4616ae);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3298df);loggerPredictive['info'](_0x77f3('0x21f'),_0x13b613);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x220'),_0x8b74be);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x221'),_0x41d311);loggerPredictive['info'](_0x77f3('0x58'));return new Promise(function(_0xffec5c,_0x1b0dfc){if(_0x4616ae<=0x0||isNaN(_0x4616ae)){return _0x1b0dfc(msgResponse(_0x77f3('0x222'),_0x77f3('0x8f'),_0x77f3('0x223')+_0x4616ae));}if(_0x13b613<=0x0||isNaN(_0x13b613)){return _0x1b0dfc(msgResponse(_0x77f3('0x222'),_0x77f3('0x8f'),'Ts\x20=\x20'+_0x13b613));}if(_0x8b74be<=0x0||isNaN(_0x8b74be)){return _0x1b0dfc(msgResponse(_0x77f3('0x222'),_0x77f3('0x8f'),'p\x20=\x20'+_0x8b74be));}if(_0x3298df<=0x0||isNaN(_0x3298df)){return _0x1b0dfc(msgResponse('[abandonmentRate]',_0x77f3('0x8f'),_0x77f3('0x224')+_0x3298df));}if(_0x41d311<=0x0||isNaN(_0x41d311)){return _0x1b0dfc(msgResponse(_0x77f3('0x222'),_0x77f3('0x8f'),'Amax\x20=\x20'+_0x41d311));}_0x1c3000=_0x1c3000||0x0;var _0x5e22ca=0x1/_0x13b613;var _0x16d120=0x0;var _0x10ba6c=0x0;var _0x3bce73=0x0;var _0x5ba4e9=0x0;for(var _0x1b7757=0x0;_0x3bce73<_0x41d311;_0x1b7757+=0x1){_0x10ba6c=_0x1b7757/_0x3298df;_0x16d120=(_0x8b74be*_0x10ba6c+_0x1c3000)/_0x5e22ca;_0x3bce73=utils[_0x77f3('0x225')](_0x16d120,_0x4616ae);_0x5ba4e9=_0x16d120/_0x4616ae*(0x1-utils[_0x77f3('0x225')](_0x16d120,_0x4616ae));}return _0xffec5c({'erlangCalls':_0x1b7757,'erlangCallToSecond':_0x3298df/_0x1b7757,'erlangAbandonmentRate':_0x3bce73,'erlangBusyFactor':_0x5ba4e9});});};Dialer[_0x77f3('0x90')][_0x77f3('0x1e9')]=function(_0x3eb854,_0x2e7188,_0x4cc632,_0x70607c,_0x53a424,_0xd99ac6){loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x226'));loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x21e'),_0x3eb854);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x227'),_0x2e7188);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x21f'),_0x4cc632);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x220'),_0x70607c);loggerPredictive['info'](_0x77f3('0x228'),_0x53a424);loggerPredictive[_0x77f3('0x4e')](_0x77f3('0x58'));return new Promise(function(_0x3335b9,_0x18b9aa){if(_0x3eb854<=0x0||isNaN(_0x3eb854)){return _0x18b9aa(msgResponse(_0x77f3('0x229'),_0x77f3('0x8f'),_0x77f3('0x223')+_0x3eb854));}if(_0x4cc632<=0x0||isNaN(_0x4cc632)){return _0x18b9aa(msgResponse(_0x77f3('0x229'),'Error','Ts\x20=\x20'+_0x4cc632));}if(_0x70607c<=0x0||isNaN(_0x70607c)){return _0x18b9aa(msgResponse(_0x77f3('0x229'),_0x77f3('0x8f'),_0x77f3('0x22a')+_0x70607c));}if(_0x2e7188<=0x0||isNaN(_0x2e7188)){return _0x18b9aa(msgResponse(_0x77f3('0x229'),_0x77f3('0x8f'),_0x77f3('0x224')+_0x2e7188));}if(_0x53a424<=0x0||isNaN(_0x53a424)){return _0x18b9aa(msgResponse('[busyFactor]',_0x77f3('0x8f'),_0x77f3('0x22b')+_0x53a424));}_0xd99ac6=_0xd99ac6||0x0;var _0x545065=0x1/_0x4cc632;var _0x1680b4=0x0;var _0x4d945a=0x0;var _0x3246a3=0x0;var _0x215fbd=0x0;for(var _0x1decbf=0x0;_0x215fbd<_0x53a424;_0x1decbf+=0x1){_0x4d945a=_0x1decbf/_0x2e7188;_0x1680b4=(_0x70607c*_0x4d945a+_0xd99ac6)/_0x545065;_0x3246a3=utils[_0x77f3('0x225')](_0x1680b4,_0x3eb854);_0x215fbd=_0x1680b4/_0x3eb854*(0x1-utils['erlangb'](_0x1680b4,_0x3eb854));}return _0x3335b9({'erlangCalls':_0x1decbf,'erlangCallToSecond':_0x2e7188/_0x1decbf,'erlangAbandonmentRate':_0x3246a3,'erlangBusyFactor':_0x215fbd});});};module[_0x77f3('0x22c')]=Dialer; \ No newline at end of file +var _0x9989=['[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','UserId','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','unlockContact','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactLowerLimitOriginate','checkIsBlackList','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\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]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','startPredictive\x20value\x20cleared','handlePredictive','error','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','push','Action','interval','content','indexOf','true','command','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','catch','syncCampaigns','undefined','isIVRCampaignActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','isGlobal','AMI\x20IfTime','[ifTime][Action]','Error','uniqueId','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','syncQueueCallerAbandon','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','add','minutes','ContactId','VoiceQueueId','CampaignId','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','actions','channel','rrmemory','roundrobin','isNil','actionid','locked','paused','stateinterface','idHopper','strategy','run','ListId','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','membername','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','stateGlobal','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','statusMessage','getQueueCampaignStatusMessage','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','online','resolve','handlePreviewRecallNotifications','map','Agent','user:%s','[uniqueid]','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','user:dialPreviewRecallReminder','handleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialAgiAfterHangupAgent','ACTIVE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','%s%s','XMD-','toUpper','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion'];(function(_0x10624a,_0xdf2238){var _0x3c899e=function(_0x760d91){while(--_0x760d91){_0x10624a['push'](_0x10624a['shift']());}};_0x3c899e(++_0xdf2238);}(_0x9989,0x77));var _0x9998=function(_0x5338a0,_0x57c4db){_0x5338a0=_0x5338a0-0x0;var _0x4f1d26=_0x9989[_0x5338a0];return _0x4f1d26;};'use strict';var util=require(_0x9998('0x0'));var _=require(_0x9998('0x1'));var uuid=require(_0x9998('0x2'));var moment=require(_0x9998('0x3'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x9998('0x4'));var hopperUtils=require(_0x9998('0x5'));var ut=require(_0x9998('0x6'));var config=require(_0x9998('0x7'));var logger=require(_0x9998('0x8'))(_0x9998('0x9'));var loggerBooked=require(_0x9998('0x8'))(_0x9998('0xa'));var loggerPredictive=require(_0x9998('0x8'))('predictive');var loggerPredictiveCalls=require(_0x9998('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x9998('0xb'));config[_0x9998('0xc')]=_[_0x9998('0xd')](config[_0x9998('0xc')],{'host':_0x9998('0xe'),'port':0x18eb});var io=require(_0x9998('0xf'))(new Redis(config[_0x9998('0xc')]));var cmHopper=require(_0x9998('0x10'));var voiceQueueRt=require(_0x9998('0x11'));var RpcSetting=require(_0x9998('0x12'));var Interval=require(_0x9998('0x13'));var Action=require(_0x9998('0x14'));var History=require(_0x9998('0x15'));var Final=require(_0x9998('0x16'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x9998('0x17'));var Hangup=require('./models/hangup');var ipAgi=process[_0x9998('0x18')][_0x9998('0x19')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9998('0x1a')][_0x9998('0x1b')]=function(_0x31fe5a){this['tail']=this['tail']?this[_0x9998('0x1c')][_0x9998('0x1d')](_0x31fe5a):_0x31fe5a();};function Dialer(_0x55e62d,_0xa52963){this[_0x9998('0x1e')]=new Sequence();this[_0x9998('0x1f')]=_0xa52963;this[_0x9998('0x20')]=_0x55e62d[_0x9998('0x20')];this[_0x9998('0x21')]=_0x55e62d['campaigns'];this[_0x9998('0x22')]=_0x55e62d[_0x9998('0x22')];this[_0x9998('0x23')]=_0x55e62d[_0x9998('0x23')];this['maxNumberOriginate']=config[_0x9998('0x24')]||0x2;this[_0x9998('0x25')]={};this['actions']={};this[_0x9998('0x26')]={};this['uniqueId']={};this[_0x9998('0x27')]={};this[_0x9998('0x28')]={};this[_0x9998('0x29')]={};this[_0x9998('0x2a')]={};this[_0x9998('0x2b')]={};this[_0x9998('0x2c')]={};this['queuesSummary']={};ami['on'](_0x9998('0x2d'),this['syncAgentConnect'][_0x9998('0x2e')](this));ami['on'](_0x9998('0x2f'),this['syncQueueCallerAbandon'][_0x9998('0x2e')](this));ami['on'](_0x9998('0x30'),this[_0x9998('0x31')][_0x9998('0x2e')](this));ami['on']('agentcomplete',this[_0x9998('0x32')][_0x9998('0x2e')](this));ami['on'](_0x9998('0x33'),this[_0x9998('0x34')][_0x9998('0x2e')](this));ami['on'](_0x9998('0x35'),this[_0x9998('0x36')][_0x9998('0x2e')](this));ami['on'](_0x9998('0x37'),this[_0x9998('0x38')][_0x9998('0x2e')](this));ami['on'](_0x9998('0x39'),this[_0x9998('0x3a')][_0x9998('0x2e')](this));ami['on'](_0x9998('0x3b'),this['syncVarSet'][_0x9998('0x2e')](this));ami['on'](_0x9998('0x3c'),this[_0x9998('0x3d')][_0x9998('0x2e')](this));ami['on'](_0x9998('0x3e'),this[_0x9998('0x3f')][_0x9998('0x2e')](this));this[_0x9998('0x40')]();this[_0x9998('0x41')]();RpcSetting[_0x9998('0x42')]()[_0x9998('0x43')](function(_0x2ea3da){previewRecallmeReminderInterval=_0x2ea3da['previewRecallmeReminderInterval'];});}function isNotNull(_0x129a40){return _0x129a40!==null&&!_[_0x9998('0x44')](_0x129a40);}function msgResponse(_0x45b008,_0x24838a,_0x40461e){return{'action':_0x45b008,'response':_0x24838a,'message':_0x40461e,'stack':_0x40461e};}function emit(_0x43f676,_0xa891e1,_0x5bafa3){io['to'](_0x43f676)[_0x9998('0x45')](_0xa891e1,_0x5bafa3);}function emitOutboundVoiceQueueSummary(_0x5cd0df){if(_0x5cd0df[_0x9998('0x46')]===_0x9998('0x47')){logger[_0x9998('0x48')](_0x9998('0x49'),util[_0x9998('0x4a')](_0x5cd0df,{'showHidden':![],'depth':null}));emit(util[_0x9998('0x4b')]('voice:queue:%s',_0x5cd0df[_0x9998('0x4c')]),'voice_queue:save',_0x5cd0df);}}function checkGetDataPredictive(_0x46f85e){if(isNotNull(_0x46f85e)&&!_[_0x9998('0x4d')](_0x46f85e)){loggerPredictive[_0x9998('0x4e')](_0x9998('0x4f'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46f85e[_0x9998('0x50')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46f85e[_0x9998('0x51')]);loggerPredictive[_0x9998('0x4e')](_0x9998('0x52'),_0x46f85e[_0x9998('0x53')]);loggerPredictive[_0x9998('0x4e')](_0x9998('0x54'),_0x46f85e[_0x9998('0x55')]);loggerPredictive['info'](_0x9998('0x56'),_0x46f85e[_0x9998('0x57')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x46f85e[_0x9998('0x58')]);loggerPredictive['info'](_0x9998('0x59'));if(_0x46f85e[_0x9998('0x50')]>0x0){if(!_['isUndefined'](_0x46f85e['predictiveIntervalAvgTalktime'])&&_0x46f85e['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x9998('0x4e')](_0x9998('0x5a'));if(!_[_0x9998('0x44')](_0x46f85e[_0x9998('0x57')])&&_0x46f85e[_0x9998('0x57')]>0x0){return!![];}loggerPredictive['info'](_0x9998('0x5b'));}else{loggerPredictive[_0x9998('0x4e')](_0x9998('0x5c'));}}else{loggerPredictive['info'](_0x9998('0x5d'));}return![];}function mergeDataErlangB(_0x16698a){return function(_0x3ad95a){loggerPredictive[_0x9998('0x4e')](_0x9998('0x5e'));loggerPredictive[_0x9998('0x4e')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ad95a[_0x9998('0x5f')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ad95a[_0x9998('0x60')]);loggerPredictive['info'](_0x9998('0x61'),_0x3ad95a['erlangAbandonmentRate']);loggerPredictive[_0x9998('0x4e')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3ad95a[_0x9998('0x62')]);loggerPredictive[_0x9998('0x4e')](_0x9998('0x61'),_0x3ad95a[_0x9998('0x63')]);loggerPredictive['info'](_0x9998('0x59'));_[_0x9998('0x64')](_0x16698a,_0x3ad95a);};}function ifInterval(_0xebb3c0,_0x112e03){if(_[_0x9998('0x44')](_0x112e03)){return![];}return utils['getSeconds'](undefined,_0x112e03)<_0xebb3c0*0x3c;}function clearPredictiveAttributes(_0x415d9f){if(_0x415d9f['startProgressive']){_0x415d9f[_0x9998('0x29')]=undefined;loggerPredictive[_0x9998('0x48')](_0x415d9f[_0x9998('0x4c')],'startProgressive\x20value\x20cleared');}if(_0x415d9f[_0x9998('0x28')]){_0x415d9f[_0x9998('0x28')]=undefined;loggerPredictive[_0x9998('0x48')](_0x415d9f['name'],_0x9998('0x65'));}if(_0x415d9f[_0x9998('0x66')]){clearInterval(_0x415d9f[_0x9998('0x66')]);_0x415d9f['handlePredictive']=undefined;loggerPredictive[_0x9998('0x48')](_0x415d9f[_0x9998('0x4c')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x160353,_0x4500fe){return function(_0x1999a1){loggerPredictive[_0x9998('0x67')](_0x4500fe[_0x9998('0x4c')],_0x160353);loggerPredictive[_0x9998('0x67')](_0x1999a1['stack']);clearPredictiveAttributes(_0x4500fe);};}function loggerCatch(_0x195851){return function(_0x272062){logger[_0x9998('0x67')](_0x195851,util[_0x9998('0x4a')](_0x272062,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2f0658,_0x4f1995,_0x5787d4){return function(_0x492d57){utils['checkContactLowerLimitOriginate'](_0x4f1995,_0x5787d4,0x0);logger[_0x9998('0x67')](_0x2f0658,util[_0x9998('0x4a')](_0x492d57,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5c8f67){return function(_0x335b99){if(isNotNull(_0x335b99)&&isNotNull(_0x335b99[0x0])){if(_0x335b99[0x0][_0x9998('0x68')]>0x0){_0x5c8f67['message']=utils[_0x9998('0x69')][_0x9998('0x6a')];logger[_0x9998('0x4e')](_0x9998('0x6b')+_0x5c8f67[_0x9998('0x4c')],_0x335b99[0x0][_0x9998('0x68')],_0x9998('0x6c'));}else{_0x5c8f67[_0x9998('0x6d')]=utils[_0x9998('0x69')][_0x9998('0x6e')];logger['info'](_0x9998('0x6f')+_0x5c8f67[_0x9998('0x4c')]);}}};}function createObjHistory(_0xb71f4e,_0x51533c,_0x4ff809,_0x33edfe,_0xf3eb2a){_0xb71f4e['message']=_0x4ff809;var _0x20b90a=new Action(_0xb71f4e,_0x51533c);var _0x2f5178=new History(_0x20b90a);_0x2f5178[_0x9998('0x70')]=_0x33edfe;_0x2f5178[_0x9998('0x71')]=_0xf3eb2a;_0x2f5178[_0x9998('0x72')]=_0x20b90a['starttime'];return _0x2f5178;}function unlockQueueStatus(_0xb36b52,_0x102c75){setTimeout(function(){if(_[_0x9998('0x44')](_0xb36b52['queueStatusComplete'])){loggerBooked[_0x9998('0x67')](_0x9998('0x73'),_0x102c75);}_0xb36b52[_0x9998('0x74')]=!![];loggerBooked[_0x9998('0x4e')](_0x9998('0x75'),_0x102c75,JSON[_0x9998('0x76')](_[_0x9998('0x77')](_0xb36b52,['name',_0x9998('0x74')])));},0x1f3);}function checkInterval(_0x1a94ad){return function(){if(!isNotNull(_0x1a94ad[_0x9998('0x78')])){_0x1a94ad[_0x9998('0x6d')]=utils[_0x9998('0x69')][_0x9998('0x79')];throw _0x1a94ad[_0x9998('0x4c')]+_0x9998('0x7a');}if(!isNotNull(_0x1a94ad[_0x9998('0x78')][_0x9998('0x7b')])){_0x1a94ad['message']=utils[_0x9998('0x69')][_0x9998('0x79')];throw _0x1a94ad['name']+_0x9998('0x7a');}if(!isNotNull(_[_0x9998('0x4d')](_0x1a94ad[_0x9998('0x78')][_0x9998('0x7b')]))){_0x1a94ad[_0x9998('0x6d')]=utils[_0x9998('0x69')][_0x9998('0x79')];throw _0x1a94ad[_0x9998('0x4c')]+_0x9998('0x7a');}};}function checkIsIVRCampaignActive(_0x3b8db3){return function(){if(!utils['isIVRCampaignActive'](_0x3b8db3)){_0x3b8db3[_0x9998('0x6d')]=utils[_0x9998('0x69')][_0x9998('0x7c')];throw _0x3b8db3[_0x9998('0x4c')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x582ef1){if(utils[_0x9998('0x7d')](_0x582ef1)){emit(util['format'](_0x9998('0x7e'),_0x582ef1['name']),_0x9998('0x7f'),_0x582ef1);}}function loggerCatchQueueSummary(_0x58fc26,_0x5cef73){return function(_0x30462f){clearPredictiveAttributes(_0x5cef73);emitCampaignSummary(_0x5cef73);loggerSyncQueueSummary[_0x9998('0x48')](_0x58fc26,util['inspect'](_0x30462f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1c5f35){if(_0x1c5f35['sendMessageOneNotActive']){if(_0x1c5f35[_0x9998('0x80')]===0x0){_0x1c5f35[_0x9998('0x81')]=![];_0x1c5f35['message']=utils[_0x9998('0x69')][_0x9998('0x7c')];loggerSyncQueueSummary['debug'](_0x9998('0x82'),_0x1c5f35[_0x9998('0x4c')],_0x9998('0x83'));}else{_0x1c5f35[_0x9998('0x6d')]=utils[_0x9998('0x69')][_0x9998('0x84')];loggerSyncQueueSummary[_0x9998('0x48')](_0x9998('0x82'),_0x1c5f35[_0x9998('0x4c')],'is\x20disactive');}emitCampaignSummary(_0x1c5f35);}}function myreject(_0x141643){return function(_0x4b75be){return _0x141643(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x4b75be)));};}Dialer[_0x9998('0x1a')][_0x9998('0x85')]=function(_0x383585){return!_[_0x9998('0x44')](_0x383585)&&_0x383585&&!_[_0x9998('0x44')](_0x383585[_0x9998('0x4c')])&&!_['isUndefined'](_0x383585[_0x9998('0x86')])&&_0x383585[_0x9998('0x86')]&&(this[_0x9998('0x23')][util['format'](_0x9998('0x87'),_0x383585[_0x9998('0x4c')])][_0x9998('0x88')]===_0x9998('0x89')||this[_0x9998('0x23')][util['format'](_0x9998('0x87'),_0x383585[_0x9998('0x4c')])][_0x9998('0x88')]===_0x9998('0x8a'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0xfc0d91){var _0xcf56aa=this;return function(){if(!_0xcf56aa[_0x9998('0x85')](_0xfc0d91['Trunk'])){if(!_0xcf56aa[_0x9998('0x85')](_0xfc0d91['TrunkBackup'])){_0xfc0d91['message']=utils[_0x9998('0x69')][_0x9998('0x8b')];throw _0xfc0d91['name']+_0x9998('0x8c');}}};};Dialer[_0x9998('0x1a')][_0x9998('0x8d')]=function(_0x269a33,_0x37c8c1,_0x3e2bb4,_0x4dfa13){var _0x5a43a0=this;return function(){var _0x4b6ec3=!![];return _0x5a43a0[_0x9998('0x8e')](_0x269a33,_0x37c8c1,_0x3e2bb4,_0x4dfa13,_0x4b6ec3);};};Dialer[_0x9998('0x1a')][_0x9998('0x8f')]=function(_0x181ddf,_0x5f1081,_0x4f7e08,_0x2b95cb){var _0x4358b9=this;return function(){var _0x268af4=![];return _0x4358b9[_0x9998('0x8e')](_0x181ddf[_0x9998('0x7b')],_0x5f1081,_0x4f7e08,_0x2b95cb,_0x268af4);};};Dialer[_0x9998('0x1a')][_0x9998('0x8e')]=function(_0x1f7670,_0x1b01fe,_0x197a2d,_0xd793,_0x9b45a9){var _0x2d7403=[];return new Promise(function(_0x35b284,_0x16a890){if(!isNotNull(_0x1f7670)){_0xd793[_0x9998('0x6d')]=utils['CAMPAIGN_STATUS'][_0x9998('0x79')];return _0x16a890(msgResponse(_0x9998('0x90'),_0x9998('0x91'),_0x197a2d+_0x9998('0x92')));}if(_[_0x9998('0x4d')](_0x1f7670)){_0xd793['message']=utils[_0x9998('0x69')]['EMPTY_INTERVAL'];return _0x16a890(msgResponse('ifTime','Failure',_0x197a2d+_0x9998('0x93')));}if(_0x1b01fe&&_[_0x9998('0x44')](config['timezones'][_0x1b01fe])){_0xd793['message']=utils[_0x9998('0x69')][_0x9998('0x94')];return _0x16a890(msgResponse('ifTime',_0x9998('0x91'),_0x197a2d+_0x9998('0x95')+_0x1b01fe));}if(_['isArray'](_0x1f7670)){for(var _0x4df3af=0x0;_0x4df3af<_0x1f7670['length'];_0x4df3af+=0x1){_0x2d7403[_0x9998('0x96')](ami[_0x9998('0x97')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x1f7670[_0x4df3af][_0x9998('0x98')],!_['isUndefined'](config['timezones'][_0x1b01fe])?_0x1b01fe:'')})[_0x9998('0x43')](function(_0x479b18){return _0x479b18[_0x9998('0x99')][_0x9998('0x9a')](_0x9998('0x9b'))>=0x0;})['catch'](myreject(_0x16a890)));}}else{_0x2d7403[_0x9998('0x96')](ami[_0x9998('0x97')]({'action':_0x9998('0x9c'),'command':util['format']('iftime\x20%s,%s',_0x1f7670,!_[_0x9998('0x44')](config['timezones'][_0x1b01fe])?_0x1b01fe:'')})[_0x9998('0x43')](function(_0x43a02d){return _0x43a02d['content']['indexOf'](_0x9998('0x9b'))>=0x0;})['catch'](myreject(_0x16a890)));}Promise[_0x9998('0x9d')](_0x2d7403)['then'](function(_0x2498d5){var _0xcc0bb8=_[_0x9998('0x9e')](_0x2498d5);if(_0xcc0bb8){return _0x35b284(_0xcc0bb8);}else{_0xd793[_0x9998('0x6d')]=_0x9b45a9?utils['CAMPAIGN_STATUS'][_0x9998('0x9f')]:utils[_0x9998('0x69')]['OVERTIME_INTERVAL'];return _0x16a890(msgResponse(_0x9998('0xa0'),_0x9998('0x91'),_0x9998('0xa1')+_0x9b45a9+'\x20'+_0x197a2d+_0x9998('0xa2')+util[_0x9998('0x4a')](_0x1f7670,{'showHidden':![],'depth':null})+_0x9998('0xa3')+_0x1b01fe));}})[_0x9998('0xa4')](function(_0xa5f04e){return _0x16a890(msgResponse('ifTime',_0x9998('0x91'),JSON[_0x9998('0x76')](_0xa5f04e)));});});};Dialer[_0x9998('0x1a')][_0x9998('0x40')]=function(){var _0x402539=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x9998('0x43')](function(){setInterval(function(){_0x402539[_0x9998('0xa5')]();},0x3e8);});};Dialer[_0x9998('0x1a')][_0x9998('0xa5')]=function(){var _0x127ab3=this;var _0x53b583;for(var _0x341b5b in this[_0x9998('0x21')]){if(typeof this[_0x9998('0x21')][_0x341b5b]!==_0x9998('0xa6')){_0x53b583=this[_0x9998('0x21')][_0x341b5b];if(utils[_0x9998('0x7d')](_0x53b583)&&utils[_0x9998('0xa7')](_0x53b583)){_0x53b583[_0x9998('0x81')]=!![];Promise['resolve']()[_0x9998('0x43')](checkIsIVRCampaignActive(_0x53b583))[_0x9998('0x43')](checkInterval(_0x53b583))[_0x9998('0x43')](_0x127ab3[_0x9998('0xa8')](_0x53b583))[_0x9998('0x43')](_0x127ab3['checkIfTime'](_0x53b583[_0x9998('0xa9')],_0x53b583[_0x9998('0xaa')],_0x53b583['name'],_0x53b583))[_0x9998('0x43')](_0x127ab3[_0x9998('0x8f')](_0x53b583['Interval'],_0x53b583[_0x9998('0xaa')],_0x53b583[_0x9998('0x4c')],_0x53b583))[_0x9998('0x43')](_0x127ab3[_0x9998('0xab')](_0x53b583))[_0x9998('0xa4')](loggerCatchQueueSummary(_0x9998('0xac'),_0x53b583));}else{notSendMessagesCampaign(_0x53b583);}}}};Dialer['prototype'][_0x9998('0xad')]=function(_0x530fa1){if(_0x530fa1[_0x9998('0xae')]!==_0x9998('0xaf')){clearPredictiveAttributes(_0x530fa1);}switch(_0x530fa1[_0x9998('0xae')]){case _0x9998('0xb0'):this[_0x9998('0xb1')](_0x530fa1,0x1);break;case _0x9998('0xb2'):this[_0x9998('0xb1')](_0x530fa1,_0x530fa1[_0x9998('0xb3')]);break;case _0x9998('0xaf'):this[_0x9998('0xaf')](_0x530fa1);break;case _0x9998('0xa'):this['handlePower'](_0x530fa1,0x1);break;default:logger[_0x9998('0x67')](_0x9998('0xb4'),_0x530fa1[_0x9998('0x4c')],_0x9998('0xb5'));}};Dialer[_0x9998('0x1a')][_0x9998('0x90')]=function(_0x3407ea,_0x5ed55a){var _0x51f9e1=_0x3407ea[_0x9998('0xaa')];var _0x359457=_0x5ed55a?_0x3407ea[_0x9998('0xa9')]:_0x3407ea[_0x9998('0x78')][_0x9998('0x7b')];logger[_0x9998('0xb6')]('Dialer::ifTime()',_0x359457,_0x51f9e1,_0x3407ea['name'],util['format'](_0x9998('0xb7'),_0x3407ea[_0x9998('0x4c')],_0x3407ea['id']));var _0x1417e8=null;return Interval[_0x9998('0xb8')](_0x359457,_0x51f9e1)[_0x9998('0x43')](function(_0x1b87fa){if(_0x1b87fa===!![]){return _0x1b87fa;}else{_0x3407ea[_0x9998('0x6d')]=_0x5ed55a?utils[_0x9998('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x9998('0x69')][_0x9998('0xb9')];_0x1417e8=msgResponse(_0x9998('0xa0'),'Failure','Global:\x20'+_0x5ed55a+'\x20'+_0x3407ea['name']+_0x9998('0xa2')+util[_0x9998('0x4a')](_0x359457,{'showHidden':![],'depth':null})+_0x9998('0xa3')+_0x51f9e1);}if(_0x1417e8!==null){logger[_0x9998('0xb6')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x1417e8);_0x1417e8[_0x9998('0xba')]=_0x5ed55a;throw _0x1417e8;}})[_0x9998('0xa4')](function(_0x3cd9de){logger[_0x9998('0x67')](_0x9998('0xbb'),_0x3cd9de);throw msgResponse(_0x9998('0xbc'),_0x9998('0xbd'),util[_0x9998('0x4a')](_0x3cd9de,{'showHidden':![],'depth':null}));});};Dialer[_0x9998('0x1a')]['syncAgentConnect']=function(_0x158ecd){if(this['voiceQueues'][_0x158ecd['queue']]){if(this[_0x9998('0xbe')][_0x158ecd[_0x9998('0xbf')]]&&this[_0x9998('0xbe')][_0x158ecd[_0x9998('0xbf')]][_0x9998('0x46')]!==_0x9998('0xc0')){this[_0x9998('0xc1')](this['voiceQueues'][_0x158ecd['queue']]);this['uniqueId'][_0x158ecd[_0x9998('0xbf')]][_0x9998('0xc2')]=moment()[_0x9998('0x4b')](_0x9998('0xc3'));}}};Dialer[_0x9998('0x1a')][_0x9998('0x32')]=function(_0x596ee3){var _0xbb037=this[_0x9998('0xbe')][_0x596ee3['uniqueid']];if(this['voiceQueues'][_0x596ee3[_0x9998('0xc4')]]){if(_0xbb037&&_0xbb037[_0x9998('0x46')]!=='ivr'){delete this[_0x9998('0xbe')][_0x596ee3[_0x9998('0xbf')]];this[_0x9998('0x20')][_0x596ee3['queue']][_0x9998('0xc5')]+=0x1;var _0x37bca0=new AgentComplete(_0xbb037,_0x596ee3);if(_0x596ee3['reason']===_0x9998('0xc6')){_0x37bca0[_0x9998('0xc7')]=this['voiceQueues'][_0x596ee3[_0x9998('0xc4')]][_0x9998('0xc8')]&&this[_0x9998('0x20')][_0x596ee3['queue']]['dialAgiAfterHangupAgent']?moment()[_0x9998('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x9998('0xc9')](_0x37bca0)[_0x9998('0xa4')](loggerCatch(_0x9998('0xca')));hopperUtils[_0x9998('0xcb')](_0x37bca0)[_0x9998('0xa4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x9998('0x1a')][_0x9998('0xcc')]=function(_0x204bc0){var _0x19cd44=this[_0x9998('0xbe')][_0x204bc0['uniqueid']];var _0x32d156=this;var _0x2e7cb3=![];var _0x421f13;var _0xcd1566;if(this[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]]){if(_0x19cd44&&_0x19cd44[_0x9998('0x46')]!==_0x9998('0xc0')){delete this[_0x9998('0xbe')][_0x204bc0[_0x9998('0xbf')]];this[_0x9998('0xc1')](this[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]]);_0x19cd44[_0x9998('0xcd')]=moment()[_0x9998('0x4b')](_0x9998('0xc3'));var _0x59e49d=new QueueCallerAbandon(_0x19cd44,_0x204bc0);if(utils[_0x9998('0xce')](_0x19cd44['droptime'],_0x19cd44[_0x9998('0xcf')])>=_0x19cd44[_0x9998('0xd0')]){this[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x204bc0['queue']][_0x9998('0xd1')]+=0x1;_0x59e49d[_0x9998('0x70')]=0xa;_0x59e49d[_0x9998('0x71')]='Drop';_0x59e49d[_0x9998('0xd2')]=_0x9998('0xd3');_0x59e49d['agiafterat']=this[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]][_0x9998('0xc8')]?moment()['format'](_0x9998('0xc3')):undefined;_0x59e49d[_0x9998('0xd4')]+=0x1;_0x59e49d[_0x9998('0xd5')]+=0x1;_0x421f13=this['voiceQueues'][_0x204bc0[_0x9998('0xc4')]][_0x9998('0xd6')];_0xcd1566=this[_0x9998('0x20')][_0x204bc0['queue']][_0x9998('0xd7')];hopperUtils[_0x9998('0xd8')](_0x59e49d,_0x59e49d[_0x9998('0x70')],_0x19cd44[_0x9998('0xd9')])[_0x9998('0x43')](function(_0x27fd78){_0x2e7cb3=_0x27fd78[_0x9998('0xda')]==0x1;if(_0x59e49d['countdropretry']>=_0x32d156[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]][_0x9998('0xdb')]){_0x32d156['queueCallerAbandonCreateState'](_0x59e49d,_0x27fd78[_0x9998('0xda')]);}else{hopperUtils[_0x9998('0xdc')]({'active':![],'countdropretry':_0x59e49d[_0x9998('0xd4')],'scheduledat':moment()[_0x9998('0xdd')](_0x32d156[_0x9998('0x20')][_0x204bc0['queue']][_0x9998('0xd6')],_0x9998('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19cd44[_0x9998('0xdf')],'ListId':_0x19cd44['ListId'],'VoiceQueueId':_0x19cd44[_0x9998('0xe0')]||undefined,'CampaignId':_0x19cd44[_0x9998('0xe1')]||undefined})[_0x9998('0xa4')](loggerCatch('[rescheduleContact][Drop]'));var _0x4d4978=new History(_0x59e49d);_0x4d4978[_0x9998('0x70')]=0xa;_0x4d4978[_0x9998('0x71')]='Drop';_0x4d4978[_0x9998('0xe2')]=moment()[_0x9998('0x4b')](_0x9998('0xc3'));_0x4d4978['endtime']=_0x4d4978[_0x9998('0xe2')];_0x4d4978[_0x9998('0xe3')]=_0x59e49d[_0x9998('0xe3')];_0x4d4978['calleridnum']=_0x59e49d[_0x9998('0xe4')];hopperUtils[_0x9998('0xc9')](_0x4d4978)[_0x9998('0xa4')](loggerCatch(_0x9998('0xe5')));}})[_0x9998('0x43')](function(){if(_0x2e7cb3)hopperUtils['swapAdditionalPhones'](_0x59e49d,_0x421f13,_0xcd1566)[_0x9998('0x43')](function(){return 0x1;});});}else{this[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]][_0x9998('0x55')]+=0x1;this[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]][_0x9998('0xe6')]+=0x1;_0x59e49d[_0x9998('0x70')]=0xb;_0x59e49d[_0x9998('0x71')]='Abandoned';_0x59e49d[_0x9998('0xd2')]=_0x9998('0xe7');_0x59e49d[_0x9998('0xe8')]+=0x1;_0x59e49d['countglobal']+=0x1;_0x421f13=this['voiceQueues'][_0x204bc0['queue']][_0x9998('0xe9')];_0xcd1566=this[_0x9998('0x20')][_0x204bc0[_0x9998('0xc4')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x9998('0xd8')](_0x59e49d,_0x59e49d[_0x9998('0x70')],_0x19cd44['voiceQueue'])[_0x9998('0x43')](function(_0x5bd997){if(_0x59e49d[_0x9998('0xe8')]>=_0x32d156[_0x9998('0x20')][_0x204bc0['queue']][_0x9998('0xea')]){_0x32d156[_0x9998('0xeb')](_0x59e49d,_0x5bd997[_0x9998('0xda')]);}else{hopperUtils[_0x9998('0xdc')]({'active':![],'countabandonedretry':_0x59e49d[_0x9998('0xe8')],'scheduledat':moment()[_0x9998('0xdd')](_0x32d156[_0x9998('0x20')][_0x204bc0['queue']]['dialAbandonedRetryFrequency'],_0x9998('0xde'))[_0x9998('0x4b')](_0x9998('0xc3')),'ContactId':_0x19cd44[_0x9998('0xdf')],'ListId':_0x19cd44['ListId'],'VoiceQueueId':_0x19cd44['VoiceQueueId']||undefined,'CampaignId':_0x19cd44[_0x9998('0xe1')]||undefined})[_0x9998('0xa4')](loggerCatch(_0x9998('0xec')));var _0x4473b5=new History(_0x59e49d);_0x4473b5[_0x9998('0x70')]=0xb;_0x4473b5['statedesc']=_0x9998('0xed');_0x4473b5[_0x9998('0xe2')]=moment()['format'](_0x9998('0xc3'));_0x4473b5[_0x9998('0x72')]=_0x4473b5['starttime'];_0x4473b5[_0x9998('0xe3')]=_0x59e49d[_0x9998('0xe3')];_0x4473b5[_0x9998('0xe4')]=_0x59e49d['calleridnum'];hopperUtils[_0x9998('0xc9')](_0x4473b5)[_0x9998('0xa4')](loggerCatch(_0x9998('0xee')));}})['then'](function(){if(_0x2e7cb3)hopperUtils[_0x9998('0xef')](_0x59e49d,_0x421f13,_0xcd1566)[_0x9998('0x43')](function(){return 0x1;});});}}}};Dialer[_0x9998('0x1a')][_0x9998('0x3a')]=function(_0x2c773c){if(this['actions'][_0x2c773c[_0x9998('0xbf')]]){this[_0x9998('0xf0')][_0x2c773c['uniqueid']]['channel']=_0x2c773c['channel'];}if(this[_0x9998('0xbe')][_0x2c773c['uniqueid']]){this['uniqueId'][_0x2c773c['uniqueid']][_0x9998('0xf1')]=_0x2c773c['channel'];}};Dialer[_0x9998('0x1a')][_0x9998('0x3d')]=function(_0x18be97){if(!this[_0x9998('0xf0')][_0x18be97['actionid']]){return;}var _0x5d323e=this[_0x9998('0x20')][this[_0x9998('0xf0')][_0x18be97['actionid']][_0x9998('0xc4')]]['strategy']||_0x9998('0xf2');if(_0x5d323e===_0x9998('0xf3')){if(this['actions'][_0x18be97['actionid']]&&_[_0x9998('0xf4')](this['actions'][_0x18be97[_0x9998('0xf5')]][_0x9998('0xf6')])&&_0x18be97[_0x9998('0x88')]==='1'&&_0x18be97[_0x9998('0xf7')]==='0'){if(this[_0x9998('0x22')][_0x18be97[_0x9998('0xf8')]]){if(!this['agents'][_0x18be97[_0x9998('0xf8')]][_0x9998('0xf6')]){this[_0x9998('0x22')][_0x18be97[_0x9998('0xf8')]][_0x9998('0xf6')]=!![];this[_0x9998('0xf0')][_0x18be97[_0x9998('0xf5')]]['locked']=!![];this[_0x9998('0xf0')][_0x18be97[_0x9998('0xf5')]]['stateinterface']=_0x18be97[_0x9998('0xf8')];}}}}else if(_0x5d323e==='rrmemory'){if(this['actions'][_0x18be97[_0x9998('0xf5')]]){if(this['agents'][_0x18be97[_0x9998('0xf8')]]){this[_0x9998('0xf0')][_0x18be97['actionid']][_0x9998('0xf8')]=_0x18be97[_0x9998('0xf8')];if(_[_0x9998('0xf4')](this[_0x9998('0x2b')][this[_0x9998('0xf0')][_0x18be97[_0x9998('0xf5')]][_0x9998('0xc4')]])){this[_0x9998('0x2b')][this[_0x9998('0xf0')][_0x18be97[_0x9998('0xf5')]]['queue']]=[];}this[_0x9998('0x2b')][this[_0x9998('0xf0')][_0x18be97[_0x9998('0xf5')]][_0x9998('0xc4')]][_0x9998('0x96')](_['merge'](_['pick'](this[_0x9998('0xf0')][_0x18be97[_0x9998('0xf5')]],[_0x9998('0xf9'),_0x9998('0xf8')]),{'status':_0x18be97[_0x9998('0x88')],'paused':_0x18be97['paused']}));}}}};Dialer[_0x9998('0x1a')][_0x9998('0x3f')]=function(_0x45c0e6){if(!this['actions'][_0x45c0e6[_0x9998('0xf5')]]){return;}var _0x3b399b=this;var _0x500fe1=this[_0x9998('0x20')][this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xc4')]];var _0x53f5fd=_0x500fe1[_0x9998('0xfa')]||'rrmemory';if(_0x53f5fd===_0x9998('0xf3')){if(this['actions'][_0x45c0e6[_0x9998('0xf5')]]&&this[_0x9998('0xf0')][_0x45c0e6['actionid']][_0x9998('0xf8')]){this['preview'][_0x9998('0xfb')](this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xf9')],this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]]['stateinterface'])[_0x9998('0xa4')](function(_0xa9979e){logger[_0x9998('0x67')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x9998('0x4a')](_0xa9979e,{'showHidden':![],'depth':null}));})[_0x9998('0x1d')](function(){_0x3b399b[_0x9998('0xc1')](_0x3b399b[_0x9998('0x20')][_0x3b399b[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xc4')]]);_0x3b399b[_0x9998('0x22')][_0x3b399b['actions'][_0x45c0e6['actionid']][_0x9998('0xf8')]]['locked']=![];delete _0x3b399b[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]];unlockQueueStatus(_0x500fe1);});}else{this[_0x9998('0xc1')](this[_0x9998('0x20')][this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xc4')]]);hopperUtils[_0x9998('0xdc')]({'active':![],'ContactId':this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xdf')],'ListId':this[_0x9998('0xf0')][_0x45c0e6['actionid']][_0x9998('0xfc')],'VoiceQueueId':this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xe0')]||undefined,'CampaignId':this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xe1')]||undefined})[_0x9998('0xa4')](loggerCatch(_0x9998('0xfd')));delete this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]];unlockQueueStatus(_0x500fe1);}}else if(_0x53f5fd===_0x9998('0xf2')){var _0x343b40;if(this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]]&&!_[_0x9998('0x4d')](this['queueBooked'][this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xc4')]])){if(this[_0x9998('0x2c')][_0x3b399b[_0x9998('0xf0')][_0x45c0e6['actionid']]['queue']]){this[_0x9998('0x2c')][_0x3b399b[_0x9998('0xf0')][_0x45c0e6['actionid']]['queue']]=this['queueBookedRR'][this[_0x9998('0xf0')][_0x45c0e6['actionid']][_0x9998('0xc4')]]?this[_0x9998('0x2c')][this['actions'][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xc4')]]:this[_0x9998('0x2b')][this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xc4')]]?this['queueBooked'][this['actions'][_0x45c0e6[_0x9998('0xf5')]][_0x9998('0xc4')]][_0x9998('0xfe')]||0x0:0x0;}this['queueBooked'][this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]]['queue']][_0x9998('0xfe')]=this[_0x9998('0x2c')][this[_0x9998('0xf0')][_0x45c0e6[_0x9998('0xf5')]]['queue']];for(var _0x3790b3=0x0;_0x3790b3=_0x5b386c['dialGlobalMaxRetry']){_0x469ba0['stateGlobal'](_0x8e24f1,_0x4842ae,_0x4055ef,'reason19\x20machine....');}else{if(_0x8e24f1[_0x9998('0x11e')]>=_0x5b386c['dialMachineMaxRetry']){_0x469ba0[_0x9998('0x125')](_0x8e24f1,_0x4842ae,_0x4055ef,_0x9998('0x126'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x8e24f1[_0x9998('0x11e')],'scheduledat':moment()[_0x9998('0xdd')](_0x5b386c[_0x9998('0x127')],_0x9998('0xde'))[_0x9998('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8e24f1[_0x9998('0xdf')],'ListId':_0x8e24f1[_0x9998('0xfc')],'VoiceQueueId':_0x8e24f1['VoiceQueueId']||undefined,'CampaignId':_0x8e24f1[_0x9998('0xe1')]||undefined})[_0x9998('0xa4')](loggerCatch(_0x9998('0x128')));_0x4842ae({'reschedule':0x1});}}});}if(_0x3a0ddd[_0x9998('0x46')]===_0x9998('0xc0')&&this[_0x9998('0x21')][_0x3a0ddd[_0x9998('0xc4')]][_0x9998('0x112')]&&_0x2f5dfc[_0x9998('0x113')]==='HANGUP'){delete this['uniqueId'][_0x2f5dfc[_0x9998('0xbf')]];this[_0x9998('0xc1')](this['campaigns'][_0x3a0ddd[_0x9998('0xc4')]]);_0x51dd7a=new Hangup(_0x3a0ddd,_0x2f5dfc);_0x51dd7a[_0x9998('0x70')]=0x12;_0x51dd7a['statedesc']=_0x9998('0x129');_0x51dd7a[_0x9998('0x115')]=_0x9998('0x12a');ami[_0x9998('0x45')](_0x9998('0x116'),ut['buildObj'](_0x51dd7a,_0x9998('0x118')));this[_0x9998('0x119')](_0x51dd7a,_0x9998('0x12b'),_0x9998('0x12c'));}if(_0x3a0ddd[_0x9998('0x46')]===_0x9998('0xc0')&&this[_0x9998('0x21')][_0x3a0ddd[_0x9998('0xc4')]][_0x9998('0x112')]&&_0x2f5dfc[_0x9998('0x113')]===_0x9998('0x11c')){return new Promise(function(_0x5cd4a3,_0x5a3996){delete _0x469ba0[_0x9998('0xbe')][_0x2f5dfc['uniqueid']];_0x469ba0[_0x9998('0xc1')](_0x469ba0[_0x9998('0x21')][_0x3a0ddd[_0x9998('0xc4')]]);_0x469ba0[_0x9998('0x21')][_0x3a0ddd['queue']][_0x9998('0xc5')]+=0x1;_0x469ba0[_0x9998('0x21')][_0x3a0ddd[_0x9998('0xc4')]][_0x9998('0x114')]+=0x1;var _0x4e68f0=_0x469ba0[_0x9998('0x21')][_0x3a0ddd[_0x9998('0xc4')]];var _0x49aa8d=new Hangup(_0x3a0ddd,_0x2f5dfc);_0x49aa8d[_0x9998('0x70')]=0x13;_0x49aa8d[_0x9998('0x71')]=_0x9998('0x11d');_0x49aa8d[_0x9998('0x115')]=_0x9998('0x12a');_0x49aa8d[_0x9998('0x11e')]+=0x1;_0x49aa8d[_0x9998('0xd5')]+=0x1;_0x49aa8d[_0x9998('0x118')]=!![];ami[_0x9998('0x45')](_0x9998('0x116'),ut[_0x9998('0x117')](_0x49aa8d,_0x9998('0x118')));hopperUtils[_0x9998('0xc9')](_0x49aa8d)[_0x9998('0xa4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x49aa8d[_0x9998('0x120')]+_0x49aa8d['countcongestionretry']+_0x49aa8d['countnoanswerretry']+_0x49aa8d[_0x9998('0x123')]+_0x49aa8d[_0x9998('0xd4')]+_0x49aa8d[_0x9998('0xe8')]+_0x49aa8d[_0x9998('0x11e')]+_0x49aa8d['countagentrejectretry']>=_0x4e68f0['dialGlobalMaxRetry']){_0x469ba0[_0x9998('0x12d')](_0x49aa8d,_0x5cd4a3,_0x5a3996,'reason19\x20machine....');}else{if(_0x49aa8d['countmachineretry']>=_0x4e68f0[_0x9998('0x12e')]){_0x469ba0[_0x9998('0x125')](_0x49aa8d,_0x5cd4a3,_0x5a3996,_0x9998('0x126'));}else{hopperUtils[_0x9998('0xdc')]({'active':![],'countmachineretry':_0x49aa8d[_0x9998('0x11e')],'scheduledat':moment()[_0x9998('0xdd')](_0x4e68f0['dialMachineRetryFrequency'],_0x9998('0xde'))[_0x9998('0x4b')](_0x9998('0xc3')),'ContactId':_0x49aa8d[_0x9998('0xdf')],'ListId':_0x49aa8d['ListId'],'VoiceQueueId':_0x49aa8d[_0x9998('0xe0')]||undefined,'CampaignId':_0x49aa8d['CampaignId']||undefined})['catch'](loggerCatch(_0x9998('0x128')));_0x5cd4a3({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x9998('0x38')]=function(_0x1d2a92){var _0x2de91d=this[_0x9998('0xbe')][_0x1d2a92['uniqueid']];var _0x56e90a;if(_0x2de91d&&_0x2de91d[_0x9998('0x46')]==='ivr'){delete this[_0x9998('0xbe')][_0x1d2a92[_0x9998('0xbf')]];this[_0x9998('0xc1')](this[_0x9998('0x21')][_0x2de91d[_0x9998('0xc4')]]);this[_0x9998('0x21')][_0x2de91d[_0x9998('0xc4')]][_0x9998('0x12f')]+=0x1;_0x56e90a=new Hangup(_0x2de91d,_0x1d2a92);hopperUtils[_0x9998('0xc9')](_0x56e90a)[_0x9998('0xa4')](loggerCatch(_0x9998('0x130')));hopperUtils[_0x9998('0xcb')](_0x56e90a)[_0x9998('0xa4')](loggerCatch(_0x9998('0x131')));}if(_0x2de91d&&_0x2de91d[_0x9998('0x46')]!==_0x9998('0xc0')&&isNotNull(this[_0x9998('0x20')][_0x2de91d[_0x9998('0xc4')]]['dialQueueProject'])){delete this['uniqueId'][_0x1d2a92[_0x9998('0xbf')]];this[_0x9998('0xc1')](this[_0x9998('0x20')][_0x2de91d[_0x9998('0xc4')]]);this[_0x9998('0x20')][_0x2de91d[_0x9998('0xc4')]]['outboundAnswerCallsDay']+=0x1;this[_0x9998('0x20')][_0x2de91d[_0x9998('0xc4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x56e90a=new Hangup(_0x2de91d,_0x1d2a92);_0x56e90a[_0x9998('0x70')]=0x10;_0x56e90a[_0x9998('0x71')]=_0x9998('0x132');_0x56e90a['membername']='AGI';hopperUtils[_0x9998('0xc9')](_0x56e90a)[_0x9998('0xa4')](loggerCatch(_0x9998('0x130')));hopperUtils[_0x9998('0xcb')](_0x56e90a)[_0x9998('0xa4')](loggerCatch(_0x9998('0x131')));}if(_0x2de91d&&_0x2de91d[_0x9998('0x46')]!==_0x9998('0xc0')&&!isNotNull(this[_0x9998('0x20')][_0x2de91d['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x1d2a92[_0x9998('0xbf')]];this['updateOriginated'](this[_0x9998('0x20')][_0x2de91d['queue']]);this['voiceQueues'][_0x2de91d[_0x9998('0xc4')]][_0x9998('0x133')]+=0x1;_0x56e90a=new Hangup(_0x2de91d,_0x1d2a92);_0x56e90a[_0x9998('0x70')]=0xc;_0x56e90a[_0x9998('0x71')]=_0x1d2a92[_0x9998('0x134')];_0x56e90a['membername']=_0x9998('0x135');hopperUtils[_0x9998('0xc9')](_0x56e90a)[_0x9998('0xa4')](loggerCatch(_0x9998('0x130')));hopperUtils[_0x9998('0xcb')](_0x56e90a)[_0x9998('0xa4')](loggerCatch(_0x9998('0x131')));}};Dialer[_0x9998('0x1a')][_0x9998('0x34')]=function(_0x4418f0){var _0xab40a2=this;if(!_0xab40a2['queuesSummary'][_0x4418f0[_0x9998('0x4c')]]){_0xab40a2[_0x9998('0x136')][_0x4418f0['name']]={'running':![]};}else if(_0xab40a2[_0x9998('0x136')][_0x4418f0[_0x9998('0x4c')]][_0x9998('0x137')]===!![]){return;}else if(_0xab40a2[_0x9998('0x136')][_0x4418f0[_0x9998('0x4c')]][_0x9998('0x137')]===![]){_0xab40a2[_0x9998('0x136')][_0x4418f0[_0x9998('0x4c')]][_0x9998('0x137')]=!![];}var _0x4186d9=_0xab40a2[_0x9998('0x20')][_0x4418f0[_0x9998('0x4c')]];var _0x9778ca=_0x4186d9['message']!==utils[_0x9998('0x69')]['INACTIVE'];var _0x36e8e6=utils['isPreviewCampaign'](_0x4186d9);_0x4186d9[_0x9998('0x138')]=utils[_0x9998('0x139')](_0x4186d9,_0xab40a2[_0x9998('0x23')]);Promise['resolve']()[_0x9998('0x43')](function(){if(_0x4186d9[_0x9998('0x138')]===utils['CAMPAIGN_STATUS'][_0x9998('0x7c')]){if(_0x9778ca){clearPredictiveAttributes(_0x4186d9);_0x4418f0['startPredictive']=undefined;_0x4418f0[_0x9998('0x29')]=undefined;}if(_0x4186d9[_0x9998('0x138')]===utils[_0x9998('0x69')][_0x9998('0x7c')]){_0x4418f0['available']=0x0;_0x4418f0['paused']=0x0;_0x4418f0['inUse']=0x0;_0x4418f0[_0x9998('0x13a')]=0x0;_0x4418f0[_0x9998('0x13b')]=0x0;}}else if(_0x4186d9[_0x9998('0x138')]===utils[_0x9998('0x69')]['ACTIVE']&&!_0x36e8e6){return _0xab40a2[_0x9998('0x90')](_0x4186d9,!![])[_0x9998('0x43')](function(){return _0xab40a2[_0x9998('0x90')](_0x4186d9,![]);})[_0x9998('0x43')](function(){return _0xab40a2[_0x9998('0xad')](_0x4186d9);})['catch'](function(_0xdc47dc){loggerSyncQueueSummary[_0x9998('0x48')](_0x9998('0x13c'),util['inspect'](_0xdc47dc,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4186d9);});}else{clearPredictiveAttributes(_0x4186d9);}})['then'](function(){var _0x3d2fde=_0x4418f0[_0x9998('0x13d')](_0x4186d9);if(_0x3d2fde||_0x4186d9[_0x9998('0x13e')]){_0x4186d9[_0x9998('0x13e')]=![];_0x4418f0['updateReportFromOutboundQueue'](_0x4186d9);Object[_0x9998('0x13f')](_0x4186d9,_0x4418f0);emitOutboundVoiceQueueSummary(_0x4418f0);}_0xab40a2[_0x9998('0x136')][_0x4186d9['name']]['running']=![];})[_0x9998('0xa4')](function(_0x31fdbe){logger[_0x9998('0x67')](_0x9998('0x13c'),util['inspect'](_0x31fdbe,{'showHidden':![],'depth':null}));_0xab40a2[_0x9998('0x136')][_0x4186d9['name']][_0x9998('0x137')]=![];});};Dialer[_0x9998('0x1a')]['syncQueueSummaryComplete']=_[_0x9998('0x140')](function(){var _0x42be0b=_['filter'](this[_0x9998('0x20')],function(_0x444bb9){return _0x444bb9['dialPreviewRecallmeReminder'];});var _0x10660c=_[_0x9998('0x141')](this['agents'],function(_0x122aad){return _0x122aad[_0x9998('0x142')]&&_0x122aad['status']===_0x9998('0x89');});if(_0x42be0b[_0x9998('0xff')]>0x0&&_0x10660c['length']>0x0){return Promise[_0x9998('0x143')]()['then'](cmHopper[_0x9998('0x144')](_[_0x9998('0x145')](_0x42be0b,'id'),previewRecallmeReminderInterval,_[_0x9998('0x145')](_0x10660c,'id')))[_0x9998('0x43')](function(_0x1ff781){for(var _0x1ee519=0x0;_0x1ee519<_0x1ff781[_0x9998('0xff')];_0x1ee519++){var _0x3c7f19=_0x1ff781[_0x1ee519][_0x9998('0x146')][_0x9998('0x4c')];if(_0x3c7f19)io['to'](util[_0x9998('0x4b')](_0x9998('0x147'),_0x3c7f19))[_0x9998('0x45')]('user:dialPreviewRecallReminder',{'hopper':_0x1ff781[_0x1ee519]});}})['catch'](function(_0xb7822a){logger[_0x9998('0x67')]('checkPreviewRecallReminder',_0xb7822a);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x9998('0x1a')][_0x9998('0x41')]=function(){var _0x36a417=this;setInterval(function(){_0x36a417['clearZombieChannels'](_0x36a417['uniqueId'],_0x9998('0x148'));_0x36a417[_0x9998('0x149')](_0x36a417[_0x9998('0xf0')],_0x9998('0x14a'));},0x32c8);};Dialer[_0x9998('0x1a')][_0x9998('0x149')]=function(_0x7a7b8,_0x4be547){var _0x527a1b=this;for(var _0x103fc8 in _0x7a7b8){if(typeof _0x7a7b8[_0x103fc8]!==_0x9998('0xa6')){this[_0x9998('0x1e')][_0x9998('0x1b')](function(){if(!_[_0x9998('0xf4')](_0x7a7b8[_0x103fc8])){return ami[_0x9998('0x97')]({'action':_0x9998('0x88'),'channel':_0x7a7b8[_0x103fc8][_0x9998('0xf1')]})[_0x9998('0xa4')](function(_0x53275f){if(_0x53275f[_0x9998('0x6d')]===_0x9998('0x14b')){setTimeout(function(){if(_0x7a7b8[_0x103fc8]&&_0x7a7b8[_0x103fc8][_0x9998('0x46')]!==_0x9998('0xc0')){_0x527a1b[_0x9998('0xc1')](_0x527a1b[_0x9998('0x20')][_0x7a7b8[_0x103fc8][_0x9998('0xc4')]]);logger['error'](_0x9998('0x14c'),_0x4be547,_0x103fc8,_0x7a7b8[_0x103fc8][_0x9998('0xc4')]);delete _0x7a7b8[_0x103fc8];}if(_0x7a7b8[_0x103fc8]&&_0x7a7b8[_0x103fc8][_0x9998('0x46')]===_0x9998('0xc0')){_0x527a1b[_0x9998('0xc1')](_0x527a1b['campaigns'][_0x7a7b8[_0x103fc8][_0x9998('0xc4')]]);logger['error'](_0x9998('0x14d'),_0x4be547,_0x103fc8,_0x7a7b8[_0x103fc8][_0x9998('0xc4')]);delete _0x7a7b8[_0x103fc8];}},0x2328);}});}});}}};Dialer[_0x9998('0x1a')]['getVoiceQueueRtPauses']=function(_0x5d265e){return Promise['resolve']()[_0x9998('0x43')](voiceQueueRt[_0x9998('0x14e')](_0x5d265e))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype']['updateOriginated']=function(_0x335738){if(!_[_0x9998('0x44')](_0x335738)&&_0x335738!==null){if(typeof _0x335738[_0x9998('0x80')]!==_0x9998('0xa6')){if(_0x335738[_0x9998('0x80')]>0x0){_0x335738[_0x9998('0x80')]-=0x1;}else{logger['error'](_0x9998('0x14f'));}}}else{logger[_0x9998('0x67')](_0x9998('0x150'));}};Dialer[_0x9998('0x1a')][_0x9998('0x151')]=function(_0x46b729,_0x97881b){var _0x126a82=this;return function(_0x577f1b){_0x126a82[_0x9998('0xc1')](_0x97881b);logger['error'](_0x46b729,util[_0x9998('0x4a')](_0x577f1b,{'showHidden':![],'depth':null}));};};Dialer[_0x9998('0x1a')][_0x9998('0x152')]=function(_0x125ee6,_0xf76484,_0x416a65){var _0x1c3ff3={'state':0x19,'statedesc':_0x9998('0x153')};this[_0x9998('0xc1')](_0xf76484);this[_0x9998('0x119')](_[_0x9998('0x64')](_0x1c3ff3,_[_0x9998('0x77')](_0x416a65,[_0x9998('0xdf'),'ListId','UserId',_0x9998('0xe0'),_0x9998('0xe1')])),'[emptyContact][createHistory]',_0x9998('0x154'));logger[_0x9998('0x67')](_0x125ee6);};Dialer['prototype'][_0x9998('0x119')]=function(_0x3de49e,_0x2105bf,_0x44047c){hopperUtils[_0x9998('0xc9')](_0x3de49e)['catch'](loggerCatch(_0x2105bf));hopperUtils[_0x9998('0xcb')](_0x3de49e)[_0x9998('0xa4')](loggerCatch(_0x44047c));};Dialer[_0x9998('0x1a')][_0x9998('0xeb')]=function(_0x52edc4,_0x119795){hopperUtils[_0x9998('0xc9')](_0x52edc4)[_0x9998('0xa4')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x119795==0x0){hopperUtils['moveContactManagedDialer'](_0x52edc4)[_0x9998('0xa4')](loggerCatch(_0x9998('0x155')));}};Dialer[_0x9998('0x1a')]['checkPreviewRecallReminder']=function(_0x5b5658){return Promise['resolve']()[_0x9998('0x43')](cmHopper[_0x9998('0x144')](_0x5b5658['id'],previewRecallmeReminderInterval))[_0x9998('0x43')](function(_0x3bda45){for(var _0x45007e=0x0;_0x45007e<_0x3bda45[_0x9998('0xff')];_0x45007e++){var _0x360651=_0x3bda45[_0x45007e][_0x9998('0x146')][_0x9998('0x4c')];if(_0x360651)io['to'](util['format'](_0x9998('0x147'),_0x360651))[_0x9998('0x45')](_0x9998('0x156'),{'hopper':_0x3bda45[_0x45007e]});}})[_0x9998('0xa4')](function(){});};Dialer[_0x9998('0x1a')]['launchHandleIvr']=function(_0x5a1080){var _0xa6fced=this;return function(){_0xa6fced[_0x9998('0x157')](_0x5a1080);};};Dialer['prototype'][_0x9998('0x158')]=function(_0x25c399,_0x54e7f3){var _0x24c2ee=this;var _0x1a27d2=uuid['v4']();this[_0x9998('0xf0')][_0x1a27d2]=new Action(_0x25c399,_0x54e7f3,_0x1a27d2);return new Promise(function(_0x3a16d1,_0x3e4e58){if(_['isUndefined'](_0x25c399)&&typeof _0x25c399!==_0x9998('0x159')){return _0x3e4e58(msgResponse(_0x9998('0x15a'),_0x9998('0x91'),'voiceQueue\x20is\x20undefine'));}if(_[_0x9998('0x44')](_0x54e7f3[_0x9998('0x15b')])||_0x54e7f3[_0x9998('0x15b')]===null){return _0x3e4e58(msgResponse(_0x9998('0x15a'),_0x9998('0x91'),_0x9998('0x15c')));}var _0x12a18b={'XMD-CALLERID':_0x24c2ee[_0x9998('0xf0')][_0x1a27d2][_0x9998('0x15d')](),'XMD-AGI':_0x25c399[_0x9998('0x15e')]?util[_0x9998('0x4b')](_0x9998('0x15f'),ipAgi,_0x25c399[_0x9998('0x15e')]):_0x9998('0x160'),'XMD-AGIAFTER':_0x25c399[_0x9998('0xc8')]?util['format'](_0x9998('0x15f'),ipAgi,_0x25c399['dialQueueProject2']):_0x9998('0x160'),'XMD-QUEUE':utils[_0x9998('0x161')](_0x25c399)?util[_0x9998('0x4b')]('\x22%s,%s%s,,,%s\x22',_0x25c399[_0x9998('0x4c')],_0x25c399['dialQueueOptions']||'',_0x25c399[_0x9998('0x162')]?'c':'',_0x25c399[_0x9998('0xd0')]||0x3):_0x9998('0x160'),'XMD-CONTACTID':_0x54e7f3[_0x9998('0xdf')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x24c2ee[_0x9998('0xf0')][_0x1a27d2][_0x9998('0x15d')](),'XMD-AMD':_0x25c399[_0x9998('0x112')]?_0x9998('0x163'):_0x9998('0x160'),'XMD-DESTINATION':_0x9998('0x111')};if(_0x25c399[_0x9998('0x112')]){_0x12a18b['XMD-AMDINITIALSILENCE']=_0x25c399[_0x9998('0x164')]||0x9c4;_0x12a18b['XMD-AMDGREETING']=_0x25c399['dialAMDGreeting']||0x5dc;_0x12a18b[_0x9998('0x165')]=_0x25c399[_0x9998('0x166')]||0x320;_0x12a18b['XMD-AMDTOTALANALYSISTIME']=_0x25c399[_0x9998('0x167')]||0x1388;_0x12a18b[_0x9998('0x168')]=_0x25c399[_0x9998('0x169')]||0x64;_0x12a18b[_0x9998('0x16a')]=_0x25c399[_0x9998('0x16b')]||0x32;_0x12a18b[_0x9998('0x16c')]=_0x25c399[_0x9998('0x16d')]||0x3;_0x12a18b['XMD-AMDSILENCETHRESHOLD']=_0x25c399[_0x9998('0x16e')]||0x100;_0x12a18b[_0x9998('0x16f')]=_0x25c399[_0x9998('0x170')]||0x1388;}if(utils[_0x9998('0x161')](_0x25c399)){_0x12a18b[_0x9998('0x171')]=_0x54e7f3[_0x9998('0xe0')];}else{_0x12a18b[_0x9998('0x172')]=_0x54e7f3[_0x9998('0xe1')];}for(var _0x5d30b9 in _0x54e7f3['Contact']){if(typeof _0x54e7f3['Contact'][_0x5d30b9]!=='undefined'){if(isNotNull(_0x54e7f3[_0x9998('0x173')][_0x5d30b9])&&_0x5d30b9!=='id'&&_0x5d30b9!=='tags'&&_0x5d30b9!==_0x9998('0x174')&&_0x5d30b9!=='updatedAt'){_0x12a18b[util[_0x9998('0x4b')](_0x9998('0x175'),_0x9998('0x176'),_[_0x9998('0x177')](_0x5d30b9))]=_0x54e7f3[_0x9998('0x173')][_0x5d30b9];}}}var _0x757375=_0x24c2ee['isTrunkReachable'](_0x25c399[_0x9998('0x178')])?utils[_0x9998('0x179')](_0x25c399['Trunk'][_0x9998('0x17a')],_0x25c399[_0x9998('0x17b')],_0x25c399[_0x9998('0x17c')]>0x0?utils[_0x9998('0x17d')](_0x25c399[_0x9998('0x17e')],_0x25c399[_0x9998('0x17c')]):_0x25c399[_0x9998('0x17e')]):utils[_0x9998('0x179')](_['isNil'](_0x25c399['TrunkBackup'])?_0x25c399[_0x9998('0x178')][_0x9998('0x17a')]:_0x25c399[_0x9998('0x17f')][_0x9998('0x17a')],_0x25c399[_0x9998('0x17b')],_0x25c399[_0x9998('0x17c')]>0x0?utils[_0x9998('0x17d')](_0x25c399[_0x9998('0x17e')],_0x25c399[_0x9998('0x17c')]):_0x25c399['dialOriginateCallerIdNumber']);if(_0x757375){_0x12a18b[_0x9998('0x180')]=_0x24c2ee[_0x9998('0xf0')][_0x1a27d2][_0x9998('0x181')]=utils[_0x9998('0x182')](_0x757375);_0x12a18b[_0x9998('0x183')]=_0x54e7f3[_0x9998('0x15b')];}_0x25c399[_0x9998('0x184')]=_0x12a18b;return ami[_0x9998('0x97')]({'actionid':_0x1a27d2,'action':_0x9998('0x15a'),'channel':_0x24c2ee[_0x9998('0x85')](_0x25c399['Trunk'])?util[_0x9998('0x4b')](_0x9998('0x185'),_0x25c399[_0x9998('0x178')][_0x9998('0x4c')],isNotNull(_0x25c399[_0x9998('0x186')])?_0x25c399[_0x9998('0x186')][_0x9998('0x187')]()||'':'',_0x25c399['dialCutDigit']>0x0?_0x54e7f3[_0x9998('0x15b')]['substring'](_0x25c399[_0x9998('0x188')]):_0x54e7f3[_0x9998('0x15b')]):util['format'](_0x9998('0x185'),_[_0x9998('0xf4')](_0x25c399['TrunkBackup'])?_0x25c399[_0x9998('0x178')][_0x9998('0x4c')]:_0x25c399[_0x9998('0x17f')][_0x9998('0x4c')],isNotNull(_0x25c399[_0x9998('0x186')])?_0x25c399[_0x9998('0x186')][_0x9998('0x187')]()||'':'',_0x25c399[_0x9998('0x188')]>0x0?_0x54e7f3['phone'][_0x9998('0x189')](_0x25c399[_0x9998('0x188')]):_0x54e7f3['phone']),'callerid':_0x757375,'Exten':'xcally-motion-dialer','Context':_0x9998('0x18a'),'Priority':'1','variable':_0x12a18b,'timeout':(_0x25c399[_0x9998('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a27d2})[_0x9998('0x43')](function(_0x2f2674){return _0x3a16d1(_0x2f2674);})[_0x9998('0xa4')](function(_0x2952e3){_0x25c399[_0x9998('0x18c')]+=0x1;var _0xb5540c=new History(_0x24c2ee[_0x9998('0xf0')][_0x1a27d2]);logger['error'](util[_0x9998('0x4b')](_0x9998('0x18d'),JSON[_0x9998('0x76')](_0x2952e3)));_0xb5540c[_0x9998('0x70')]=0xe;_0xb5540c['statedesc']='OriginateError';_0xb5540c['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xb5540c[_0x9998('0x72')]=_0xb5540c[_0x9998('0xe2')];hopperUtils[_0x9998('0xc9')](_0xb5540c)[_0x9998('0xa4')](loggerCatch(_0x9998('0x18e')));_0x24c2ee[_0x9998('0xcb')](_0xb5540c)[_0x9998('0xa4')](loggerCatch(_0x9998('0x18e')))[_0x9998('0x1d')](function(){delete _0x24c2ee[_0x9998('0xf0')][_0x1a27d2];return _0x3e4e58(msgResponse(_0x9998('0x15a'),_0x9998('0xbd'),'originate\x20action\x20Error'));});});});};Dialer[_0x9998('0x1a')][_0x9998('0x18f')]=function(_0x3b4ebe,_0x1e1e67,_0x2e1a2c){var _0x55daea=new History(_0x1e1e67);if(_0x55daea[_0x9998('0x120')]+_0x55daea[_0x9998('0x121')]+_0x55daea['countnoanswerretry']+_0x55daea[_0x9998('0x123')]+_0x55daea['countdropretry']+_0x55daea[_0x9998('0xe8')]+_0x55daea['countmachineretry']+_0x55daea[_0x9998('0x124')]>=_0x2e1a2c[_0x9998('0x190')]-0x1){return!![];}switch(_0x3b4ebe){case 0x3:if(_0x55daea[_0x9998('0x122')]>=_0x2e1a2c[_0x9998('0x191')]-0x1){return!![];}hopperUtils[_0x9998('0xdc')]({'active':![],'countnoanswerretry':_0x55daea[_0x9998('0x122')]+=0x1,'scheduledat':moment()[_0x9998('0xdd')](_0x2e1a2c[_0x9998('0x192')],'minutes')[_0x9998('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55daea['ContactId'],'ListId':_0x55daea['ListId'],'VoiceQueueId':_0x55daea[_0x9998('0xe0')]||undefined,'CampaignId':_0x55daea[_0x9998('0xe1')]||undefined})[_0x9998('0xa4')](loggerCatch(_0x9998('0x193')));break;case 0x5:if(_0x55daea['countbusyretry']>=_0x2e1a2c['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x9998('0xdc')]({'active':![],'countbusyretry':_0x55daea[_0x9998('0x120')]+=0x1,'scheduledat':moment()[_0x9998('0xdd')](_0x2e1a2c[_0x9998('0x194')],_0x9998('0xde'))[_0x9998('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55daea[_0x9998('0xdf')],'ListId':_0x55daea[_0x9998('0xfc')],'VoiceQueueId':_0x55daea[_0x9998('0xe0')]||undefined,'CampaignId':_0x55daea[_0x9998('0xe1')]||undefined})['catch'](loggerCatch(_0x9998('0x195')));break;case 0x8:if(_0x55daea[_0x9998('0x121')]>=_0x2e1a2c[_0x9998('0x196')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x55daea[_0x9998('0x121')]+=0x1,'scheduledat':moment()[_0x9998('0xdd')](_0x2e1a2c[_0x9998('0x197')],_0x9998('0xde'))[_0x9998('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55daea[_0x9998('0xdf')],'ListId':_0x55daea[_0x9998('0xfc')],'VoiceQueueId':_0x55daea[_0x9998('0xe0')]||undefined,'CampaignId':_0x55daea[_0x9998('0xe1')]||undefined})['catch'](loggerCatch(_0x9998('0x198')));break;case 0x0:if(_0x55daea[_0x9998('0x123')]>=_0x2e1a2c[_0x9998('0x199')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x55daea[_0x9998('0x123')]+=0x1,'scheduledat':moment()[_0x9998('0xdd')](_0x2e1a2c[_0x9998('0x19a')],'minutes')[_0x9998('0x4b')](_0x9998('0xc3')),'ContactId':_0x55daea['ContactId'],'ListId':_0x55daea[_0x9998('0xfc')],'VoiceQueueId':_0x55daea[_0x9998('0xe0')]||undefined,'CampaignId':_0x55daea[_0x9998('0xe1')]||undefined})['catch'](loggerCatch(_0x9998('0x19b')));}break;case 0xa:if(_0x55daea['countdropretry']>=_0x2e1a2c[_0x9998('0xdb')]-0x1){return!![];}hopperUtils[_0x9998('0xdc')]({'active':![],'countdropretry':_0x55daea[_0x9998('0xd4')]+=0x1,'scheduledat':moment()[_0x9998('0xdd')](_0x2e1a2c[_0x9998('0xd6')],_0x9998('0xde'))[_0x9998('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55daea['ContactId'],'ListId':_0x55daea['ListId'],'VoiceQueueId':_0x55daea['VoiceQueueId']||undefined,'CampaignId':_0x55daea[_0x9998('0xe1')]||undefined})[_0x9998('0xa4')](loggerCatch(_0x9998('0x19c')));break;case 0xb:if(_0x55daea[_0x9998('0xe8')]>=_0x2e1a2c[_0x9998('0xea')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x55daea[_0x9998('0xe8')]+=0x1,'scheduledat':moment()[_0x9998('0xdd')](_0x2e1a2c[_0x9998('0xe9')],_0x9998('0xde'))[_0x9998('0x4b')](_0x9998('0xc3')),'ContactId':_0x55daea[_0x9998('0xdf')],'ListId':_0x55daea['ListId'],'VoiceQueueId':_0x55daea[_0x9998('0xe0')]||undefined,'CampaignId':_0x55daea['CampaignId']||undefined})[_0x9998('0xa4')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x55daea[_0x9998('0x11e')]>=_0x2e1a2c['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x55daea[_0x9998('0x11e')]+=0x1,'scheduledat':moment()[_0x9998('0xdd')](_0x2e1a2c['dialMachineRetryFrequency'],_0x9998('0xde'))['format'](_0x9998('0xc3')),'ContactId':_0x55daea['ContactId'],'ListId':_0x55daea[_0x9998('0xfc')],'VoiceQueueId':_0x55daea[_0x9998('0xe0')]||undefined,'CampaignId':_0x55daea[_0x9998('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x55daea[_0x9998('0x124')]>=_0x2e1a2c[_0x9998('0x19d')]-0x1){return!![];}hopperUtils[_0x9998('0xdc')]({'active':![],'countagentrejectretry':_0x55daea[_0x9998('0x124')]+=0x1,'scheduledat':moment()[_0x9998('0xdd')](_0x2e1a2c[_0x9998('0x19e')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55daea[_0x9998('0xdf')],'ListId':_0x55daea['ListId'],'VoiceQueueId':_0x55daea[_0x9998('0xe0')]||undefined,'CampaignId':_0x55daea[_0x9998('0xe1')]||undefined})[_0x9998('0xa4')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x9998('0x1a')][_0x9998('0x10b')]=function(_0x366af4,_0x5971d6,_0x47893e){var _0x446b93=this;var _0x164d42=new History(_0x366af4);var _0x1e8011=![];var _0x32bf4b;var _0x32b852;return new Promise(function(_0x5dfa3e,_0x331986){if(_[_0x9998('0x44')](_0x5971d6)&&typeof _0x5971d6!==_0x9998('0x159')){return _0x331986(msgResponse(_0x9998('0x19f'),'Failure',_0x9998('0x1a0')));}if(_[_0x9998('0x44')](_0x47893e)&&typeof _0x47893e!==_0x9998('0x159')){return _0x331986(msgResponse(_0x9998('0x19f'),_0x9998('0x91'),_0x9998('0x1a1')));}hopperUtils[_0x9998('0xd8')](_0x164d42,_0x47893e['reason'],_0x5971d6)[_0x9998('0x43')](function(_0x4f17c7){if(_0x4f17c7[_0x9998('0xda')]==0x1)_0x1e8011=!![];switch(_0x47893e[_0x9998('0x1a2')]){case'0':_0x5971d6[_0x9998('0x1a3')]+=0x1;_0x164d42[_0x9998('0x70')]=0x0;_0x164d42['statedesc']=_0x9998('0x1a4');_0x164d42[_0x9998('0x123')]+=0x1;_0x164d42['countglobal']+=0x1;ami['emit'](_0x9998('0x1a5'),ut[_0x9998('0x117')](_0x366af4,_0x9998('0x1a6')));_0x32bf4b=_0x5971d6[_0x9998('0x19a')];_0x32b852=_0x5971d6[_0x9998('0xd7')];hopperUtils[_0x9998('0xc9')](_0x164d42)['catch'](loggerCatch(_0x9998('0x11f')));if(_0x446b93['checkRetriveMax'](0x0,_0x366af4,_0x5971d6)&&!_0x1e8011){if(_0x164d42[_0x9998('0x123')]>=_0x5971d6[_0x9998('0x199')]){_0x446b93['createStateFinal'](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1a7'));}else{_0x446b93[_0x9998('0x12d')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1a7'));}}break;case'3':_0x5971d6[_0x9998('0x1a8')]+=0x1;_0x164d42['state']=0x3;_0x164d42['statedesc']='NoAnswer';_0x164d42[_0x9998('0x122')]+=0x1;_0x164d42['countglobal']+=0x1;var _0x338521=ut[_0x9998('0x1a9')](_0x366af4,_0x5971d6);ami[_0x9998('0x45')]('custom:agentnoanswer',_0x338521);_0x32bf4b=_0x5971d6[_0x9998('0x192')];_0x32b852=_0x5971d6[_0x9998('0xd7')];hopperUtils['createHistory'](_0x164d42)[_0x9998('0xa4')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x446b93[_0x9998('0x18f')](0x3,_0x366af4,_0x5971d6)&&!_0x1e8011){if(_0x164d42['countnoanswerretry']>=_0x5971d6[_0x9998('0x191')]){_0x446b93['createStateFinal'](_0x164d42,_0x5dfa3e,_0x331986,'reason\x203\x20ringing\x20no\x20answer');}else{_0x446b93[_0x9998('0x12d')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1aa'));}}break;case'5':_0x5971d6[_0x9998('0x1ab')]+=0x1;_0x164d42[_0x9998('0x70')]=0x5;_0x164d42[_0x9998('0x71')]=_0x9998('0x1ac');_0x164d42['countbusyretry']+=0x1;_0x164d42[_0x9998('0xd5')]+=0x1;ami[_0x9998('0x45')](_0x9998('0x1ad'),ut[_0x9998('0x117')](_0x366af4,_0x9998('0x1ae')));_0x32bf4b=_0x5971d6[_0x9998('0x194')];_0x32b852=_0x5971d6[_0x9998('0xd7')];hopperUtils[_0x9998('0xc9')](_0x164d42)['catch'](loggerCatch(_0x9998('0x1af')));if(_0x446b93['checkRetriveMax'](0x5,_0x366af4,_0x5971d6)&&!_0x1e8011){if(_0x164d42[_0x9998('0x120')]>=_0x5971d6[_0x9998('0x1b0')]){_0x446b93[_0x9998('0x125')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1b1'));}else{_0x446b93[_0x9998('0x12d')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1b1'));}}break;case'8':_0x5971d6[_0x9998('0x1b2')]+=0x1;_0x164d42['state']=0x8;_0x164d42[_0x9998('0x71')]=_0x9998('0x1b3');_0x164d42[_0x9998('0x121')]+=0x1;_0x164d42[_0x9998('0xd5')]+=0x1;_0x32bf4b=_0x5971d6[_0x9998('0x197')];_0x32b852=_0x5971d6[_0x9998('0xd7')];ami[_0x9998('0x45')]('custom:agentcongestion',ut[_0x9998('0x117')](_0x366af4,_0x9998('0x1b4')));hopperUtils[_0x9998('0xc9')](_0x164d42)[_0x9998('0xa4')](loggerCatch(_0x9998('0x1b5')));if(_0x446b93['checkRetriveMax'](0x8,_0x366af4,_0x5971d6)&&!_0x1e8011){if(_0x164d42[_0x9998('0x121')]>=_0x5971d6['dialCongestionMaxRetry']){_0x446b93[_0x9998('0x125')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1b6'));}else{_0x446b93[_0x9998('0x12d')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1b6'));}}break;case'11':_0x5971d6[_0x9998('0x1b7')]+=0x1;_0x164d42['state']=0xb;_0x164d42[_0x9998('0x71')]=_0x9998('0xed');_0x164d42[_0x9998('0xe8')]+=0x1;_0x164d42[_0x9998('0xd5')]+=0x1;_0x32bf4b=_0x5971d6[_0x9998('0xe9')];_0x32b852=_0x5971d6[_0x9998('0xd7')];hopperUtils[_0x9998('0xc9')](_0x164d42)[_0x9998('0xa4')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x446b93[_0x9998('0x18f')](0xb,_0x366af4,_0x5971d6)&&!_0x1e8011){if(_0x164d42['countabandonedretry']>=_0x5971d6[_0x9998('0xea')]){_0x446b93[_0x9998('0x125')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1b8'));}else{_0x446b93[_0x9998('0x12d')](_0x164d42,_0x5dfa3e,_0x331986,'reason\x2011\x20abandoned');}}break;case'20':_0x5971d6[_0x9998('0x1b9')]+=0x1;_0x164d42[_0x9998('0x70')]=0x14;_0x164d42[_0x9998('0x71')]=_0x9998('0x1ba');_0x164d42[_0x9998('0x124')]+=0x1;_0x164d42[_0x9998('0xd5')]+=0x1;_0x32bf4b=_0x5971d6[_0x9998('0x19e')];_0x32b852=_0x5971d6[_0x9998('0xd7')];ami['emit'](_0x9998('0x1bb'),ut[_0x9998('0x117')](_0x366af4,_0x9998('0x1bc')));hopperUtils['createHistory'](_0x164d42)[_0x9998('0xa4')](loggerCatch(_0x9998('0x1bd')));if(_0x446b93[_0x9998('0x18f')](0x14,_0x366af4,_0x5971d6)&&!_0x1e8011){if(_0x164d42[_0x9998('0x124')]>=_0x5971d6[_0x9998('0x19d')]){_0x446b93[_0x9998('0x125')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1be'));}else{_0x446b93[_0x9998('0x12d')](_0x164d42,_0x5dfa3e,_0x331986,_0x9998('0x1be'));}}break;default:_0x5971d6[_0x9998('0x133')]+=0x1;_0x164d42['state']=0xc;_0x164d42['statedesc']=_0x47893e[_0x9998('0x1a2')];_0x32bf4b=_0x5971d6[_0x9998('0x19e')];_0x32b852=_0x5971d6[_0x9998('0xd7')];hopperUtils['createHistory'](_0x164d42)[_0x9998('0xa4')](loggerCatch(_0x9998('0x1bf')));if(_0x446b93['checkRetriveMax'](_0x47893e[_0x9998('0x1a2')],_0x366af4,_0x5971d6)&&!_0x1e8011){if(_0x164d42[_0x9998('0x120')]+_0x164d42[_0x9998('0x121')]+_0x164d42[_0x9998('0x122')]+_0x164d42[_0x9998('0x123')]+_0x164d42[_0x9998('0xd4')]+_0x164d42[_0x9998('0xe8')]+_0x164d42[_0x9998('0x11e')]+_0x164d42[_0x9998('0x124')]>=_0x5971d6[_0x9998('0x190')]){_0x446b93[_0x9998('0x12d')](_0x164d42,_0x5dfa3e,_0x331986,_0x47893e[_0x9998('0x1a2')]);}else{_0x446b93[_0x9998('0x125')](_0x164d42,_0x5dfa3e,_0x331986,_0x47893e['reason']);}}}})[_0x9998('0x43')](function(){if(_0x1e8011){hopperUtils[_0x9998('0xef')](_0x164d42,_0x32bf4b,_0x32b852)['then'](function(){return _0x5dfa3e(0x1);});}});});};Dialer['prototype'][_0x9998('0x12d')]=function(_0x392bb9,_0x15c4e2,_0x501953,_0x504e03){var _0x522e39=new Final(_0x392bb9);_0x522e39[_0x9998('0x70')]=0xf;_0x522e39[_0x9998('0x71')]=_0x9998('0x1c0');this[_0x9998('0x125')](_0x522e39,_0x15c4e2,_0x501953,_0x504e03);};Dialer[_0x9998('0x1a')][_0x9998('0x125')]=function(_0x3b7376,_0x397b60,_0x585ac5,_0xbe18f4){hopperUtils[_0x9998('0xcb')](_0x3b7376)[_0x9998('0x43')](function(){return _0x397b60(msgResponse(_0x9998('0x19f'),'Success',_0xbe18f4));})[_0x9998('0xa4')](function(){return _0x585ac5(msgResponse(_0x9998('0x1c1'),_0x9998('0x91'),_0x9998('0x1c2')));});};Dialer['prototype'][_0x9998('0xaf')]=function(_0x12bd84){var _0x59f62b=_0x12bd84[_0x9998('0x1c3')]/0x64;var _0x38066f=_0x12bd84[_0x9998('0x1c4')]/(_0x12bd84[_0x9998('0x1c4')]+_0x12bd84['outboundAnswerCallsDay']);var _0x2bffe4=Math[_0x9998('0x1c5')](_0x12bd84['predictiveIntervalAvailable']*(_0x12bd84[_0x9998('0x1c6')]/0x64));var _0x5af6d6=Math[_0x9998('0x1c5')](_0x12bd84[_0x9998('0x1c7')]*(_0x12bd84[_0x9998('0x1c8')]/0x64));var _0x2f9227=_0x12bd84[_0x9998('0x1c9')]+_0x12bd84[_0x9998('0x13a')];var _0x404313=Math[_0x9998('0x1ca')](_0x12bd84[_0x9998('0x5f')]*_0x12bd84[_0x9998('0x63')]*_0x12bd84[_0x9998('0x1cb')]*_0x12bd84[_0x9998('0x1cc')]);if(_['isUndefined'](_0x12bd84[_0x9998('0x29')])){if(!_[_0x9998('0x44')](_0x12bd84['startPredictive'])){_0x12bd84[_0x9998('0x28')]=undefined;loggerPredictive[_0x9998('0x67')](_0x9998('0x1cd'),_0x9998('0x1ce'));}if(!_[_0x9998('0x44')](_0x12bd84[_0x9998('0x66')])){loggerPredictive[_0x9998('0x67')](_0x9998('0x1cd'),_0x9998('0x1cf'));clearInterval(_0x12bd84[_0x9998('0x66')]);_0x12bd84[_0x9998('0x66')]=undefined;}_0x12bd84[_0x9998('0x29')]=moment()[_0x9998('0x4b')](_0x9998('0xc3'));loggerPredictive[_0x9998('0x4e')](_0x12bd84[_0x9998('0x4c')],'collection\x20data\x20in\x20progressive\x20at',_0x12bd84['startProgressive']);this[_0x9998('0xb1')](_0x12bd84,0x1);}else if(ifInterval(_0x12bd84[_0x9998('0x1d0')],_0x12bd84[_0x9998('0x29')])){this[_0x9998('0xb1')](_0x12bd84,0x1);loggerPredictiveCalls[_0x9998('0x4e')]('[startMethodPredictive][StartProgressive][Loop]',_0x12bd84['startProgressive'],_0x12bd84[_0x9998('0x4c')]);_0x12bd84[_0x9998('0x5f')]=0x0;_0x12bd84['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x59f62b<_0x38066f&&_0x12bd84[_0x9998('0x1d1')]===_0x9998('0x1d2')){clearPredictiveAttributes(_0x12bd84);loggerPredictive['info'](_0x9998('0x1d3'),_0x9998('0x1d4'),_0x38066f,_0x9998('0x29'),_0x12bd84[_0x9998('0x4c')]);}else if(_0x404313<_0x12bd84[_0x9998('0xd1')]&&_0x12bd84[_0x9998('0x1d1')]===_0x9998('0x1d2')){clearPredictiveAttributes(_0x12bd84);loggerPredictive['info'](_0x9998('0x1d5'),_0x9998('0x1d6'),_0x404313,_0x9998('0x1d7'),_0x12bd84[_0x9998('0xd1')],_0x9998('0x29'),_0x12bd84[_0x9998('0x4c')]);}else if(!ifInterval(_0x12bd84[_0x9998('0x1d0')],_0x12bd84[_0x9998('0x29')])&&_[_0x9998('0x44')](_0x12bd84[_0x9998('0x28')])&&!_[_0x9998('0x44')](_0x12bd84[_0x9998('0x29')])){_0x12bd84['startPredictive']=moment()[_0x9998('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x9998('0x4e')](_0x12bd84[_0x9998('0x4c')],'started\x20in\x20predictive\x20at',_0x12bd84[_0x9998('0x28')]);hopperUtils[_0x9998('0x1d8')](_0x12bd84['dialPredictiveInterval'])[_0x9998('0x43')](this[_0x9998('0x1d9')](_0x12bd84))[_0x9998('0x43')](mergeDataErlangB(_0x12bd84))[_0x9998('0x43')](this[_0x9998('0x1da')](_0x12bd84))[_0x9998('0xa4')](loggerCatchPredictive(_0x9998('0x1db'),_0x12bd84));}else if(!ifInterval(_0x12bd84[_0x9998('0x1d0')],_0x12bd84['startPredictive'])){_0x12bd84[_0x9998('0xd1')]=0x0;_0x12bd84[_0x9998('0x28')]=moment()[_0x9998('0x4b')](_0x9998('0xc3'));loggerPredictive['info'](_0x12bd84[_0x9998('0x4c')],_0x9998('0x1dc'),_0x12bd84[_0x9998('0x28')]);clearInterval(_0x12bd84[_0x9998('0x66')]);_0x12bd84[_0x9998('0x66')]=undefined;hopperUtils[_0x9998('0x1d8')](_0x12bd84['dialPredictiveInterval'])['then'](this[_0x9998('0x1d9')](_0x12bd84))[_0x9998('0x43')](mergeDataErlangB(_0x12bd84))[_0x9998('0x43')](this[_0x9998('0x1da')](_0x12bd84))[_0x9998('0xa4')](loggerCatchPredictive(_0x9998('0x1dd'),_0x12bd84));}else if(_0x12bd84[_0x9998('0x1c7')]&&_0x2f9227<_0x12bd84[_0x9998('0x1c7')]-_0x5af6d6){clearPredictiveAttributes(_0x12bd84);loggerPredictive[_0x9998('0x4e')](_0x12bd84[_0x9998('0x4c')],_0x9998('0x1de'),_0x2f9227,_0x9998('0x1df'),_0x12bd84[_0x9998('0x1c7')],'-',_0x5af6d6,'=',_0x12bd84[_0x9998('0x1c7')]-_0x5af6d6,')');}else if(_0x12bd84['predictiveIntervalAvailable']&&_0x2f9227>_0x12bd84[_0x9998('0x1c7')]+_0x2bffe4){clearPredictiveAttributes(_0x12bd84);loggerPredictive[_0x9998('0x4e')](_0x12bd84[_0x9998('0x4c')],_0x9998('0x1de'),_0x2f9227,')\x20are\x20more\x20than\x20threshold\x20(',_0x12bd84['predictiveIntervalAvailable'],'+',_0x2bffe4,'=',_0x12bd84[_0x9998('0x1c7')]+_0x2bffe4,')');}};Dialer[_0x9998('0x1a')][_0x9998('0x1d9')]=function(_0x53b90a){var _0x4f7dc8=this;return function(_0x2cd2be){return new Promise(function(_0x158425,_0x19182e){_[_0x9998('0x64')](_0x53b90a,_0x2cd2be[0x0]);if(checkGetDataPredictive(_0x2cd2be[0x0])){var _0x396734=_0x53b90a[_0x9998('0x1c7')]=_0x53b90a['talking']+_0x53b90a[_0x9998('0x1c9')];var _0x151dc5=_0x53b90a[_0x9998('0x1d0')]*0x3c;var _0x5a47e2=_0x2cd2be[0x0][_0x9998('0x58')]+_0x2cd2be[0x0][_0x9998('0x57')];var _0x54fcb6=(_0x2cd2be[0x0][_0x9998('0x51')]+_0x2cd2be[0x0][_0x9998('0x53')]+_0x2cd2be[0x0][_0x9998('0x55')])/_0x2cd2be[0x0][_0x9998('0x50')];_0x53b90a['predictiveIntervalHitRate']=_0x54fcb6>0x0?_0x54fcb6:0x1;switch(_0x53b90a[_0x9998('0x1d1')]){case _0x9998('0x1d2'):var _0x286f75=_0x53b90a[_0x9998('0x1c3')]/0x64;return _0x4f7dc8[_0x9998('0x1e0')](_0x396734,_0x151dc5,_0x5a47e2,_0x54fcb6,_0x286f75)['then'](function(_0x20596c){return _0x158425(_0x20596c);});case _0x9998('0x1e1'):var _0x5f0fe9=_0x53b90a[_0x9998('0x1c3')]/0x64;return _0x4f7dc8[_0x9998('0x1e2')](_0x396734,_0x151dc5,_0x5a47e2,_0x54fcb6,_0x5f0fe9)[_0x9998('0x43')](function(_0x4372d9){return _0x158425(_0x4372d9);});default:return _0x19182e(msgResponse(_0x9998('0x1e3'),_0x9998('0x91'),_0x9998('0x1e4')));}}else{return _0x19182e(msgResponse(_0x9998('0x1e3'),_0x9998('0x91'),_0x9998('0x1e5')));}});};};Dialer[_0x9998('0x1a')][_0x9998('0x1e6')]=function(_0x385335){var _0x296ba0=this;return function(_0x2c57be){return new Promise(function(_0x4583ed,_0x2d067f){_[_0x9998('0x64')](_0x385335,_0x2c57be[0x0]);if(checkGetDataPredictive(_0x2c57be[0x0])){loggerPredictive['info'](JSON[_0x9998('0x76')](_0x2c57be[0x0]));if(_0x385335[_0x9998('0x1d1')]===_0x9998('0x1d2')){return _0x296ba0['getVoiceQueueRtPauses'](_0x385335['id'])[_0x9998('0x43')](function(_0x5bfb78){var _0x2b6236=_0x385335[_0x9998('0x1e7')]-_0x5bfb78[0x0][_0x9998('0x1e8')];var _0xfde55f=_0x385335[_0x9998('0x1d0')]*0x3c;var _0x1f1850=_0x2c57be[0x0]['predictiveIntervalAvgTalktime']+_0x2c57be[0x0][_0x9998('0x57')];var _0x1f5939=(_0x2c57be[0x0][_0x9998('0x51')]+_0x2c57be[0x0][_0x9998('0x53')]+_0x2c57be[0x0][_0x9998('0x55')])/_0x2c57be[0x0][_0x9998('0x50')];var _0x253a62=_0x385335[_0x9998('0x1c3')]/0x64;_0x385335[_0x9998('0x1e9')]=_0x5bfb78[0x0][_0x9998('0x1e8')]||0x0;_0x385335[_0x9998('0x1cb')]=_0x1f5939>0x0?_0x1f5939:0x1;return _0x296ba0[_0x9998('0x1e0')](_0x2b6236,_0xfde55f,_0x1f1850,_0x1f5939,_0x253a62);})[_0x9998('0x43')](function(_0x1430e9){return _0x4583ed(_0x1430e9);})[_0x9998('0xa4')](function(_0x3fbaca){return _0x2d067f(msgResponse(_0x9998('0x1ea'),'Failure',JSON[_0x9998('0x76')](_0x3fbaca)));});}if(_0x385335[_0x9998('0x1d1')]==='agentBusyFactor'){return _0x296ba0['getVoiceQueueRtPauses'](_0x385335['id'])[_0x9998('0x43')](function(_0x20c10e){var _0x35c86e=_0x385335[_0x9998('0x1e7')]-_0x20c10e[0x0][_0x9998('0x1e8')];var _0x5f4257=_0x385335['dialPredictiveInterval']*0x3c;var _0x2cc890=_0x2c57be[0x0][_0x9998('0x58')]+_0x2c57be[0x0][_0x9998('0x57')];var _0x35ea72=(_0x2c57be[0x0]['predictiveIntervalAnsweredCalls']+_0x2c57be[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2c57be[0x0][_0x9998('0x55')])/_0x2c57be[0x0]['predictiveIntervalTotalCalls'];var _0x133af2=_0x385335[_0x9998('0x1c3')]/0x64;_0x385335['predictiveIntervalPauses']=_0x20c10e[0x0]['outboundQueuePauses']||0x0;_0x385335[_0x9998('0x1cb')]=_0x35ea72>0x0?_0x35ea72:0x1;return _0x296ba0['busyFactor'](_0x35c86e,_0x5f4257,_0x2cc890,_0x35ea72,_0x133af2);})['then'](function(_0x29e518){return _0x4583ed(_0x29e518);})[_0x9998('0xa4')](function(_0x31d76f){return _0x2d067f(msgResponse(_0x9998('0x1ea'),_0x9998('0x91'),JSON[_0x9998('0x76')](_0x31d76f)));});}}else{return _0x2d067f(msgResponse('[getDataPredictive]',_0x9998('0x91'),_0x9998('0x1e5')));}});};};Dialer[_0x9998('0x1a')][_0x9998('0x1da')]=function(_0x375537){var _0x34a865=this;return function(){var _0x5c94a4=0x0;var _0x1febfd=Math[_0x9998('0x1ca')](_0x375537['erlangCallToSecond']*0x3e8);if(_0x1febfd>0x0){_0x1febfd=_0x1febfd<0x64?0x64:_0x1febfd;loggerPredictive[_0x9998('0x4e')](_0x375537['name'],_0x9998('0x1eb'),_0x1febfd,_0x9998('0x1ec'));_0x375537[_0x9998('0x66')]=setInterval(function(){_0x34a865['handlePredictive'](_0x375537);loggerPredictiveCalls[_0x9998('0x4e')](_0x9998('0x1ed'),_0x5c94a4+=0x1);},_0x1febfd);}else{loggerPredictive[_0x9998('0x4e')](_0x375537[_0x9998('0x4c')],_0x9998('0x1ee'));}};};Dialer['prototype']['checkContactBlack']=function(_0x5c54c7,_0x279471){var _0x38586b=this;return function(_0x2049fe){if(_[_0x9998('0x4d')](_0x2049fe)){if(_[_0x9998('0xf4')](_0x279471[_0x9998('0x1ef')])||!_0x279471['recallme']){if(_0x5c54c7['dialMethod']===_0x9998('0xa')){_0x5c54c7[_0x9998('0x74')]=_['isUndefined'](_0x5c54c7['queueStatusComplete'])?!![]:_0x5c54c7['queueStatusComplete'];var _0x45c936=uuid['v4']();_0x38586b[_0x9998('0xf0')][_0x45c936]=new Action(_0x5c54c7,_0x279471,_0x45c936);loggerBooked['info']('[booked][checkContactBlack]',_0x45c936,_0x9998('0x1f0'),JSON[_0x9998('0x76')](_0x5c54c7[_0x9998('0x74')]),_0x9998('0x1f1'),_0x5c54c7[_0x9998('0x4c')]);if(_0x5c54c7[_0x9998('0x74')]){_0x5c54c7[_0x9998('0x74')]=![];_0x38586b['queueBooked'][_0x38586b[_0x9998('0xf0')][_0x45c936][_0x9998('0xc4')]]=[];ami[_0x9998('0x97')]({'actionid':_0x45c936,'action':_0x9998('0x1f2'),'queue':_0x5c54c7['name']})['catch'](function(){_0x38586b['updateOriginated'](_0x5c54c7);hopperUtils[_0x9998('0xdc')]({'active':![],'ContactId':_0x38586b['actions'][_0x45c936][_0x9998('0xdf')],'ListId':_0x38586b[_0x9998('0xf0')][_0x45c936][_0x9998('0xfc')],'VoiceQueueId':_0x38586b[_0x9998('0xf0')][_0x45c936][_0x9998('0xe0')]||undefined,'CampaignId':_0x38586b[_0x9998('0xf0')][_0x45c936][_0x9998('0xe1')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x38586b[_0x9998('0xf0')][_0x45c936];});}else{loggerBooked['info'](_0x9998('0x1f3'),JSON['stringify'](_0x5c54c7[_0x9998('0x74')]),_0x9998('0x1f1'),_0x5c54c7['name']);_0x38586b[_0x9998('0xc1')](_0x5c54c7);hopperUtils[_0x9998('0xdc')]({'active':![],'ContactId':_0x38586b[_0x9998('0xf0')][_0x45c936][_0x9998('0xdf')],'ListId':_0x38586b[_0x9998('0xf0')][_0x45c936][_0x9998('0xfc')],'VoiceQueueId':_0x38586b[_0x9998('0xf0')][_0x45c936]['VoiceQueueId']||undefined,'CampaignId':_0x38586b['actions'][_0x45c936][_0x9998('0xe1')]||undefined})[_0x9998('0xa4')](loggerCatch(_0x9998('0x1f4')));delete _0x38586b[_0x9998('0xf0')][_0x45c936];}}else{return _0x38586b[_0x9998('0x158')](_0x5c54c7,_0x279471);}}else{if(utils[_0x9998('0xce')](undefined,_0x279471[_0x9998('0x1f5')])<_0x5c54c7[_0x9998('0x1f6')]*0x3c){if(_0x279471[_0x9998('0x146')]&&!_0x279471[_0x9998('0x146')]['voicePause']){_0x38586b[_0x9998('0x1f')][_0x9998('0xfb')](_0x279471['id'])[_0x9998('0x1d')](function(){_0x38586b['updateOriginated'](_0x5c54c7);});}else{hopperUtils[_0x9998('0x1f7')]({'active':![]},_0x279471['id'],0x1)[_0x9998('0x1d')](function(){_0x38586b[_0x9998('0xc1')](_0x5c54c7);});}}else{_0x5c54c7['outboundReCallsDay']+=0x1;_0x38586b['updateOriginated'](_0x5c54c7);if(_0x5c54c7[_0x9998('0x1f8')]){hopperUtils[_0x9998('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x279471[_0x9998('0xdf')],'ListId':_0x279471['ListId'],'VoiceQueueId':_0x279471['VoiceQueueId']||undefined,'CampaignId':_0x279471[_0x9998('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x9998('0xc9')](createObjHistory(_0x5c54c7,_0x279471,utils[_0x9998('0x69')][_0x9998('0x1f9')],0x17,_0x9998('0x1fa')))[_0x9998('0xa4')](loggerCatch(_0x9998('0x1fb')));}else{_0x38586b[_0x9998('0x119')](createObjHistory(_0x5c54c7,_0x279471,utils[_0x9998('0x69')][_0x9998('0x1fc')],0x16,_0x9998('0x1fd')),_0x9998('0x1fe'),_0x9998('0x1ff'));}}}}else{_0x5c54c7[_0x9998('0x200')]+=0x1;_0x38586b['saveInDb'](createObjHistory(_0x5c54c7,_0x279471,utils[_0x9998('0x69')][_0x9998('0x201')],0xd,_0x9998('0x202')),_0x9998('0x203'),_0x9998('0x204'));throw _0x9998('0x205');}};};Dialer[_0x9998('0x1a')][_0x9998('0x157')]=function(_0x2e89c6){var _0x1f0d91=this;var _0x439f10=_0x2e89c6[_0x9998('0x206')]-_0x2e89c6[_0x9998('0x80')]-_0x2e89c6[_0x9998('0x207')];emitCampaignSummary(_0x2e89c6);if(_0x439f10>0x0){if(_0x439f10>this[_0x9998('0x24')]){_0x439f10=this[_0x9998('0x24')];}_0x2e89c6['temp']+=_0x439f10;hopperUtils['getContactDialerIvr'](_0x2e89c6['id'],_0x439f10,_0x2e89c6[_0x9998('0x208')],_0x2e89c6)[_0x9998('0x43')](function(_0x35e77e){_0x2e89c6['temp']-=_0x439f10;_0x2e89c6[_0x9998('0x207')]=_0x2e89c6[_0x9998('0x207')]>0x0?_0x2e89c6[_0x9998('0x207')]:0x0;if(!utils[_0x9998('0x209')](_0x35e77e)){_0x2e89c6[_0x9998('0x6d')]=utils[_0x9998('0x69')][_0x9998('0x6e')];logger[_0x9998('0x4e')](_0x9998('0x20a')+_0x2e89c6[_0x9998('0x4c')]);}else{_0x2e89c6[_0x9998('0x80')]+=_0x35e77e[_0x9998('0xff')];_0x2e89c6[_0x9998('0x6d')]=utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x2aa092=0x0;_0x2aa092<_0x35e77e[_0x9998('0xff')];_0x2aa092+=0x1){_0x2e89c6[_0x9998('0x20b')]+=0x1;if(_['isNil'](_0x35e77e[_0x2aa092])||_[_0x9998('0xf4')](_0x35e77e[_0x2aa092][_0x9998('0x173')])||_[_0x9998('0xf4')](_0x35e77e[_0x2aa092][_0x9998('0x15b')])){_0x1f0d91['emptyContact']('[actionOriginate]\x20',_0x2e89c6,_0x35e77e[_0x2aa092]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x9998('0x77')](_0x35e77e[_0x2aa092],[_0x9998('0xe1'),_0x9998('0x15b')]))[_0x9998('0x43')](_0x1f0d91[_0x9998('0x20c')](_0x2e89c6,_0x35e77e[_0x2aa092]))[_0x9998('0xa4')](_0x1f0d91[_0x9998('0x151')](_0x9998('0x20d'),_0x2e89c6));}}}})[_0x9998('0xa4')](loggerGetContactDialer(_0x9998('0x20e'),_0x2e89c6,_0x439f10));}};Dialer[_0x9998('0x1a')]['handlePower']=function(_0x2c2349,_0x573487){var _0xfccc77=this;var _0x26be87=[];if(_0x573487<0x1||_0x2c2349[_0x9998('0xae')]==='booked'){_0x573487=0x1;}var _0x7ded9e=Math[_0x9998('0x1ca')](_0x2c2349['available']*_0x573487)-_0x2c2349[_0x9998('0x80')]-_0x2c2349[_0x9998('0x207')];if(_0x2c2349['dialLimitQueue']>0x0){var _0x26affa=_0x2c2349[_0x9998('0x20f')]-_0x2c2349['originated']-_0x2c2349[_0x9998('0x13a')]-_0x2c2349['temp']-_0x2c2349['pTalking'];if(_0x7ded9e>_0x26affa){_0x7ded9e=_0x26affa;}}if(_0x7ded9e>0x0){if(_0x2c2349[_0x9998('0xae')]===_0x9998('0xa')){_0x7ded9e=0x1;}if(_0x7ded9e>this[_0x9998('0x24')]){_0x7ded9e=this[_0x9998('0x24')];}_0x2c2349['temp']+=_0x7ded9e;for(var _0x5f32d0 in this[_0x9998('0x22')]){if(typeof this[_0x9998('0x22')][_0x5f32d0]!==_0x9998('0xa6')){if(this[_0x9998('0x22')][_0x5f32d0][_0x9998('0x70')]===_0x9998('0x210')&&this[_0x9998('0x22')][_0x5f32d0][_0x9998('0x88')]===_0x9998('0x89')){_0x26be87[_0x9998('0x96')](this['agents'][_0x5f32d0]['id']);}}}hopperUtils[_0x9998('0x211')](_0x2c2349,_0x26be87,_0x7ded9e)[_0x9998('0x43')](function(_0x968926){_0x2c2349[_0x9998('0x207')]-=_0x7ded9e;_0x2c2349[_0x9998('0x207')]=_0x2c2349['temp']>0x0?_0x2c2349[_0x9998('0x207')]:0x0;if(!utils[_0x9998('0x209')](_0x968926)){hopperUtils[_0x9998('0x212')](_0x2c2349)[_0x9998('0x43')](sendMessageReschedule(_0x2c2349))[_0x9998('0xa4')](loggerCatch(_0x9998('0x213')));}else{_0x2c2349[_0x9998('0x80')]+=_0x968926[_0x9998('0xff')];_0x2c2349[_0x9998('0x6d')]=_0x2c2349['dialMethod']===_0x9998('0xa')?utils[_0x9998('0x69')]['ACTIVE']:utils['CAMPAIGN_STATUS'][_0x9998('0x214')];for(var _0x2e7aff=0x0;_0x2e7aff<_0x968926[_0x9998('0xff')];_0x2e7aff+=0x1){if(_[_0x9998('0xf4')](_0x968926[_0x2e7aff])||_[_0x9998('0xf4')](_0x968926[_0x2e7aff]['Contact'])||_['isNil'](_0x968926[_0x2e7aff][_0x9998('0x15b')])){_0xfccc77[_0x9998('0x152')](_0x9998('0x215'),_0x2c2349,_0x968926[_0x2e7aff]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x968926[_0x2e7aff],['VoiceQueueId','phone']))['then'](_0xfccc77['checkContactBlack'](_0x2c2349,_0x968926[_0x2e7aff]))[_0x9998('0xa4')](_0xfccc77[_0x9998('0x151')](_0x9998('0x215'),_0x2c2349));}}}})['catch'](loggerGetContactDialer(_0x9998('0x216'),_0x2c2349,_0x7ded9e));}};Dialer[_0x9998('0x1a')][_0x9998('0x66')]=function(_0x55adb7){if(_0x55adb7[_0x9998('0x20f')]>0x0){var _0x3ef1e9=_0x55adb7['dialLimitQueue']-_0x55adb7['originated']-_0x55adb7[_0x9998('0x13a')];if(_0x3ef1e9>0x0){this[_0x9998('0x217')](_0x55adb7);}else{loggerPredictiveCalls['info'](_0x9998('0x218'));}}else{this[_0x9998('0x217')](_0x55adb7);}};Dialer[_0x9998('0x1a')][_0x9998('0x217')]=function(_0x409ae8){var _0x57e6cd=this;var _0x9cade=[];_0x409ae8['originated']+=0x1;for(var _0x289dc9 in this[_0x9998('0x22')]){if(typeof this['agents'][_0x289dc9]!==_0x9998('0xa6')){if(this[_0x9998('0x22')][_0x289dc9][_0x9998('0x70')]===_0x9998('0x210')&&this[_0x9998('0x22')][_0x289dc9][_0x9998('0x88')]==='reachable'){_0x9cade[_0x9998('0x96')](this[_0x9998('0x22')][_0x289dc9]['id']);}}}return this['getContactDialer'](_0x409ae8['id'],_0x9cade,0x1,_0x409ae8[_0x9998('0x208')],_0x409ae8)[_0x9998('0x43')](function(_0x10a2ff){if(!utils['checkContactEmpty'](_0x10a2ff)){utils[_0x9998('0x219')](_0x409ae8,0x1,0x0);return hopperUtils['countReScheduled'](_0x409ae8)['then'](sendMessageReschedule(_0x409ae8))[_0x9998('0xa4')](loggerCatch(_0x9998('0x213')));}else{_0x409ae8[_0x9998('0x6d')]=utils[_0x9998('0x69')][_0x9998('0x214')];if(_[_0x9998('0xf4')](_0x10a2ff[0x0])||_[_0x9998('0xf4')](_0x10a2ff[0x0][_0x9998('0x173')])||_['isNil'](_0x10a2ff[0x0][_0x9998('0x15b')])){_0x57e6cd[_0x9998('0x152')](_0x9998('0x215'),_0x409ae8,_0x10a2ff[0x0]);}else{return hopperUtils[_0x9998('0x21a')](_['pick'](_0x10a2ff[0x0],[_0x9998('0xe0'),_0x9998('0x15b')]))[_0x9998('0x43')](_0x57e6cd[_0x9998('0x20c')](_0x409ae8,_0x10a2ff[0x0]))[_0x9998('0xa4')](_0x57e6cd[_0x9998('0x151')]('[actionOriginatePredictive]\x20',_0x409ae8));}}})[_0x9998('0xa4')](loggerGetContactDialer(_0x9998('0x21b'),_0x409ae8,0x1));};Dialer['prototype'][_0x9998('0x1e0')]=function(_0x338de0,_0x3cc711,_0x3d8fb2,_0x441c01,_0x458937,_0x2c5474){loggerPredictive[_0x9998('0x4e')](_0x9998('0x21c'));loggerPredictive[_0x9998('0x4e')](_0x9998('0x21d'),_0x338de0);loggerPredictive[_0x9998('0x4e')](_0x9998('0x21e'),_0x3cc711);loggerPredictive['info']('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',_0x3d8fb2);loggerPredictive[_0x9998('0x4e')](_0x9998('0x21f'),_0x441c01);loggerPredictive['info'](_0x9998('0x220'),_0x458937);loggerPredictive[_0x9998('0x4e')](_0x9998('0x59'));return new Promise(function(_0x20e311,_0x284c9c){if(_0x338de0<=0x0||isNaN(_0x338de0)){return _0x284c9c(msgResponse(_0x9998('0x221'),'Error',_0x9998('0x222')+_0x338de0));}if(_0x3d8fb2<=0x0||isNaN(_0x3d8fb2)){return _0x284c9c(msgResponse(_0x9998('0x221'),_0x9998('0xbd'),'Ts\x20=\x20'+_0x3d8fb2));}if(_0x441c01<=0x0||isNaN(_0x441c01)){return _0x284c9c(msgResponse(_0x9998('0x221'),'Error',_0x9998('0x223')+_0x441c01));}if(_0x3cc711<=0x0||isNaN(_0x3cc711)){return _0x284c9c(msgResponse(_0x9998('0x221'),'Error','interval\x20=\x20'+_0x3cc711));}if(_0x458937<=0x0||isNaN(_0x458937)){return _0x284c9c(msgResponse(_0x9998('0x221'),'Error',_0x9998('0x224')+_0x458937));}_0x2c5474=_0x2c5474||0x0;var _0x5a15f3=0x1/_0x3d8fb2;var _0x3056da=0x0;var _0x1a1ac8=0x0;var _0x310f0f=0x0;var _0x594b8a=0x0;for(var _0x1d5b2d=0x0;_0x310f0f<_0x458937;_0x1d5b2d+=0x1){_0x1a1ac8=_0x1d5b2d/_0x3cc711;_0x3056da=(_0x441c01*_0x1a1ac8+_0x2c5474)/_0x5a15f3;_0x310f0f=utils[_0x9998('0x225')](_0x3056da,_0x338de0);_0x594b8a=_0x3056da/_0x338de0*(0x1-utils[_0x9998('0x225')](_0x3056da,_0x338de0));}return _0x20e311({'erlangCalls':_0x1d5b2d,'erlangCallToSecond':_0x3cc711/_0x1d5b2d,'erlangAbandonmentRate':_0x310f0f,'erlangBusyFactor':_0x594b8a});});};Dialer[_0x9998('0x1a')][_0x9998('0x1e2')]=function(_0x3c6a1a,_0x29f9b5,_0x1bd81b,_0x2445d7,_0x5dd138,_0x55cf42){loggerPredictive[_0x9998('0x4e')](_0x9998('0x226'));loggerPredictive[_0x9998('0x4e')](_0x9998('0x21d'),_0x3c6a1a);loggerPredictive[_0x9998('0x4e')](_0x9998('0x21e'),_0x29f9b5);loggerPredictive[_0x9998('0x4e')]('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',_0x1bd81b);loggerPredictive[_0x9998('0x4e')](_0x9998('0x21f'),_0x2445d7);loggerPredictive['info'](_0x9998('0x227'),_0x5dd138);loggerPredictive[_0x9998('0x4e')](_0x9998('0x59'));return new Promise(function(_0x4a0045,_0x258f34){if(_0x3c6a1a<=0x0||isNaN(_0x3c6a1a)){return _0x258f34(msgResponse(_0x9998('0x228'),_0x9998('0xbd'),'m\x20=\x20'+_0x3c6a1a));}if(_0x1bd81b<=0x0||isNaN(_0x1bd81b)){return _0x258f34(msgResponse('[busyFactor]',_0x9998('0xbd'),'Ts\x20=\x20'+_0x1bd81b));}if(_0x2445d7<=0x0||isNaN(_0x2445d7)){return _0x258f34(msgResponse(_0x9998('0x228'),'Error',_0x9998('0x223')+_0x2445d7));}if(_0x29f9b5<=0x0||isNaN(_0x29f9b5)){return _0x258f34(msgResponse(_0x9998('0x228'),_0x9998('0xbd'),_0x9998('0x229')+_0x29f9b5));}if(_0x5dd138<=0x0||isNaN(_0x5dd138)){return _0x258f34(msgResponse(_0x9998('0x228'),_0x9998('0xbd'),_0x9998('0x22a')+_0x5dd138));}_0x55cf42=_0x55cf42||0x0;var _0x16466b=0x1/_0x1bd81b;var _0x1c1a72=0x0;var _0x517371=0x0;var _0x16d363=0x0;var _0x383c42=0x0;for(var _0xb38ada=0x0;_0x383c42<_0x5dd138;_0xb38ada+=0x1){_0x517371=_0xb38ada/_0x29f9b5;_0x1c1a72=(_0x2445d7*_0x517371+_0x55cf42)/_0x16466b;_0x16d363=utils[_0x9998('0x225')](_0x1c1a72,_0x3c6a1a);_0x383c42=_0x1c1a72/_0x3c6a1a*(0x1-utils['erlangb'](_0x1c1a72,_0x3c6a1a));}return _0x4a0045({'erlangCalls':_0xb38ada,'erlangCallToSecond':_0x29f9b5/_0xb38ada,'erlangAbandonmentRate':_0x16d363,'erlangBusyFactor':_0x383c42});});};module[_0x9998('0x22b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index e61189e..4ac6e3b 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71e9=['uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','voiceQueue','dialCutDigit','getQueue','exports','util','lodash','moment','isNil','string'];(function(_0x30c8af,_0x465307){var _0x1b8e52=function(_0x18f4ab){while(--_0x18f4ab){_0x30c8af['push'](_0x30c8af['shift']());}};_0x1b8e52(++_0x465307);}(_0x71e9,0x14b));var _0x971e=function(_0x13dba2,_0x24b605){_0x13dba2=_0x13dba2-0x0;var _0x2bac53=_0x71e9[_0x13dba2];return _0x2bac53;};'use strict';var util=require(_0x971e('0x0'));var _=require(_0x971e('0x1'));var moment=require(_0x971e('0x2'));function checkNameSurname(_0x5b537b,_0x8c2d26,_0x6da22d){var _0x521ffc='';if(!_[_0x971e('0x3')](_0x8c2d26)&&_0x971e('0x4')===typeof _0x8c2d26){_0x521ffc+=_0x8c2d26;}if(!_[_0x971e('0x3')](_0x6da22d)&&'string'===typeof _0x6da22d){_0x521ffc+='\x20'+_0x6da22d;}if(_0x521ffc!==''){return _0x521ffc;}return _0x5b537b;}function Action(_0x3c3afb,_0x2717be,_0x3ae854){this['voiceQueue']=_0x3c3afb;this[_0x971e('0x5')]=_0x3ae854||undefined;this[_0x971e('0x6')]=checkNameSurname(_0x2717be[_0x971e('0x7')][_0x971e('0x8')],_0x2717be['Contact']['firstName'],_0x2717be[_0x971e('0x7')][_0x971e('0x9')]);this[_0x971e('0xa')]=_0x2717be['phone'];this[_0x971e('0xb')]=_0x3c3afb['name'];this[_0x971e('0xc')]=_0x2717be[_0x971e('0xc')]||![];this[_0x971e('0xd')]=_0x3c3afb[_0x971e('0xd')];this[_0x971e('0xe')]=_0x3c3afb[_0x971e('0xe')]||0x3;this[_0x971e('0xf')]=_0x2717be[_0x971e('0xf')];this[_0x971e('0x10')]=_0x2717be[_0x971e('0x10')];this[_0x971e('0x11')]=_0x2717be['countcongestionretry'];this[_0x971e('0x12')]=_0x2717be[_0x971e('0x12')];this['countnosuchnumberretry']=_0x2717be[_0x971e('0x13')];this['countdropretry']=_0x2717be[_0x971e('0x14')];this[_0x971e('0x15')]=_0x2717be[_0x971e('0x15')];this[_0x971e('0x16')]=_0x2717be[_0x971e('0x16')];this[_0x971e('0x17')]=_0x2717be[_0x971e('0x17')];this[_0x971e('0x18')]=_0x2717be[_0x971e('0x18')];this[_0x971e('0x19')]=_0x2717be[_0x971e('0x19')];this[_0x971e('0x1a')]=_0x2717be[_0x971e('0x1a')];this[_0x971e('0x1b')]=_0x2717be[_0x971e('0x1b')];this[_0x971e('0x1c')]=_0x2717be['CampaignId'];this['idHopper']=_0x2717be['id'];this['ContactFirstName']=_0x2717be['Contact']['firstName']||'';this[_0x971e('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x2717be['callback'];this[_0x971e('0x1e')]=_0x2717be[_0x971e('0x1e')];this['callbackat']=_0x2717be[_0x971e('0x1f')];this[_0x971e('0x20')]=_0x2717be['recallme'];this['originatecalleridnum']='';this[_0x971e('0x21')]='';}Action[_0x971e('0x22')][_0x971e('0x23')]=function(){return util['format'](_0x971e('0x24'),this[_0x971e('0x6')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x971e('0xa')][_0x971e('0x25')](this[_0x971e('0x26')][_0x971e('0x27')]):this[_0x971e('0xa')]);};Action[_0x971e('0x22')][_0x971e('0x28')]=function(){return this['queue'];};module[_0x971e('0x29')]=Action; \ No newline at end of file +var _0x1cc0=['idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','substring','dialCutDigit','number','getQueue','lodash','moment','string','voiceQueue','uniqueid','name','phone','Contact','firstName','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x427c28,_0xa7e491){var _0x2007df=function(_0x3cf94f){while(--_0x3cf94f){_0x427c28['push'](_0x427c28['shift']());}};_0x2007df(++_0xa7e491);}(_0x1cc0,0x67));var _0x01cc=function(_0x26a75a,_0x2892ac){_0x26a75a=_0x26a75a-0x0;var _0x1a0f4a=_0x1cc0[_0x26a75a];return _0x1a0f4a;};'use strict';var util=require('util');var _=require(_0x01cc('0x0'));var moment=require(_0x01cc('0x1'));function checkNameSurname(_0x5561cc,_0x3e1a11,_0x4d9a03){var _0xd8956c='';if(!_['isNil'](_0x3e1a11)&&_0x01cc('0x2')===typeof _0x3e1a11){_0xd8956c+=_0x3e1a11;}if(!_['isNil'](_0x4d9a03)&&_0x01cc('0x2')===typeof _0x4d9a03){_0xd8956c+='\x20'+_0x4d9a03;}if(_0xd8956c!==''){return _0xd8956c;}return _0x5561cc;}function Action(_0x28a256,_0x1e1e47,_0xfc0643){this[_0x01cc('0x3')]=_0x28a256;this[_0x01cc('0x4')]=_0xfc0643||undefined;this[_0x01cc('0x5')]=checkNameSurname(_0x1e1e47['Contact'][_0x01cc('0x6')],_0x1e1e47[_0x01cc('0x7')][_0x01cc('0x8')],_0x1e1e47[_0x01cc('0x7')]['lastName']);this['number']=_0x1e1e47[_0x01cc('0x6')];this['queue']=_0x28a256['name'];this[_0x01cc('0x9')]=_0x1e1e47[_0x01cc('0x9')]||![];this['type']=_0x28a256[_0x01cc('0xa')];this[_0x01cc('0xb')]=_0x28a256[_0x01cc('0xb')]||0x3;this[_0x01cc('0xc')]=_0x1e1e47[_0x01cc('0xc')];this['countbusyretry']=_0x1e1e47[_0x01cc('0xd')];this[_0x01cc('0xe')]=_0x1e1e47['countcongestionretry'];this['countnoanswerretry']=_0x1e1e47[_0x01cc('0xf')];this[_0x01cc('0x10')]=_0x1e1e47[_0x01cc('0x10')];this[_0x01cc('0x11')]=_0x1e1e47[_0x01cc('0x11')];this[_0x01cc('0x12')]=_0x1e1e47[_0x01cc('0x12')];this['countmachineretry']=_0x1e1e47[_0x01cc('0x13')];this[_0x01cc('0x14')]=_0x1e1e47[_0x01cc('0x14')];this[_0x01cc('0x15')]=_0x1e1e47[_0x01cc('0x15')];this['ListId']=_0x1e1e47[_0x01cc('0x16')];this[_0x01cc('0x17')]=_0x1e1e47[_0x01cc('0x17')];this[_0x01cc('0x18')]=_0x1e1e47[_0x01cc('0x18')];this[_0x01cc('0x19')]=_0x1e1e47[_0x01cc('0x19')];this[_0x01cc('0x1a')]=_0x1e1e47['id'];this['ContactFirstName']=_0x1e1e47[_0x01cc('0x7')][_0x01cc('0x8')]||'';this[_0x01cc('0x1b')]=moment()['format'](_0x01cc('0x1c'));this[_0x01cc('0x1d')]=_0x1e1e47[_0x01cc('0x1d')];this[_0x01cc('0x1e')]=_0x1e1e47['callbackuniqueid'];this[_0x01cc('0x1f')]=_0x1e1e47[_0x01cc('0x1f')];this[_0x01cc('0x20')]=_0x1e1e47[_0x01cc('0x20')];this[_0x01cc('0x21')]='';this[_0x01cc('0x22')]='';}Action[_0x01cc('0x23')][_0x01cc('0x24')]=function(){return util[_0x01cc('0x25')](_0x01cc('0x26'),this[_0x01cc('0x5')],this[_0x01cc('0x3')]['dialCutDigit']>0x0?this['number'][_0x01cc('0x27')](this[_0x01cc('0x3')][_0x01cc('0x28')]):this[_0x01cc('0x29')]);};Action['prototype'][_0x01cc('0x2a')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index e8453b3..ce11f99 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2930=['UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x1fc7b5,_0x5d4779){var _0x3ef5db=function(_0x1622cf){while(--_0x1622cf){_0x1fc7b5['push'](_0x1fc7b5['shift']());}};_0x3ef5db(++_0x5d4779);}(_0x2930,0x8a));var _0x0293=function(_0x3f91ca,_0x4a3fdf){_0x3f91ca=_0x3f91ca-0x0;var _0x695dbb=_0x2930[_0x3f91ca];return _0x695dbb;};'use strict';var moment=require(_0x0293('0x0'));var utils=require('../utils');function AgentComplete(_0x102c90,_0x4c8e2e){this['state']=0x4;this[_0x0293('0x1')]=_0x0293('0x2');this['scheduledat']=_0x102c90[_0x0293('0x3')];this[_0x0293('0x4')]=_0x102c90['type'];this[_0x0293('0x5')]=_0x102c90[_0x0293('0x4')]===_0x0293('0x6')?_0x0293('0x7'):_0x102c90['type'];this[_0x0293('0x8')]=_0x102c90[_0x0293('0x8')];this['countcongestionretry']=_0x102c90[_0x0293('0x9')];this[_0x0293('0xa')]=_0x102c90[_0x0293('0xa')];this[_0x0293('0xb')]=_0x102c90[_0x0293('0x8')]+_0x102c90[_0x0293('0x9')]+_0x102c90[_0x0293('0xa')]+_0x102c90[_0x0293('0xc')]+_0x102c90[_0x0293('0xd')]+_0x102c90[_0x0293('0xe')]+_0x102c90[_0x0293('0xf')]+_0x102c90['countagentrejectretry'];this[_0x0293('0xc')]=_0x102c90[_0x0293('0xc')];this['countdropretry']=_0x102c90[_0x0293('0xd')];this[_0x0293('0xe')]=_0x102c90['countabandonedretry'];this['countmachineretry']=_0x102c90[_0x0293('0xf')];this[_0x0293('0x10')]=_0x102c90[_0x0293('0x10')];this['uniqueid']=_0x4c8e2e[_0x0293('0x11')];this[_0x0293('0x12')]=_0x102c90[_0x0293('0x13')];this[_0x0293('0x14')]=_0x102c90[_0x0293('0x15')];this[_0x0293('0x16')]=_0x102c90[_0x0293('0x16')];this['responsetime']=_0x102c90[_0x0293('0x17')];this[_0x0293('0x18')]=_0x102c90[_0x0293('0x18')];this[_0x0293('0x19')]=moment()[_0x0293('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils[_0x0293('0x1b')](_0x102c90[_0x0293('0x17')],_0x102c90[_0x0293('0x16')]);this[_0x0293('0x1c')]=utils[_0x0293('0x1b')](_0x102c90[_0x0293('0x18')],_0x102c90['responsetime']);this[_0x0293('0x1d')]=utils[_0x0293('0x1b')](this[_0x0293('0x19')],_0x102c90[_0x0293('0x18')]);this[_0x0293('0x7')]=_0x4c8e2e['queue'];this[_0x0293('0x1e')]=_0x4c8e2e[_0x0293('0x1e')];this[_0x0293('0x1f')]=_0x4c8e2e[_0x0293('0x1f')];this[_0x0293('0x20')]=_0x102c90[_0x0293('0x20')];this['callbackuniqueid']=_0x102c90[_0x0293('0x21')];this[_0x0293('0x22')]=_0x102c90['callbackat'];this[_0x0293('0x23')]=_0x102c90[_0x0293('0x23')];this[_0x0293('0x24')]=_0x102c90[_0x0293('0x24')];this['ListId']=_0x102c90[_0x0293('0x25')];this[_0x0293('0x26')]=_0x102c90[_0x0293('0x26')];this['VoiceQueueId']=_0x102c90['VoiceQueueId'];this['CampaignId']=_0x102c90[_0x0293('0x27')];this[_0x0293('0x28')]=_0x102c90[_0x0293('0x28')]||'';this[_0x0293('0x29')]=_0x102c90[_0x0293('0x29')]||'';this['agiafterat']=_0x102c90[_0x0293('0x2a')];}module[_0x0293('0x2b')]=AgentComplete; \ No newline at end of file +var _0xc3f9=['ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme'];(function(_0x326b5f,_0x18fac6){var _0x5bc65a=function(_0x22ec9f){while(--_0x22ec9f){_0x326b5f['push'](_0x326b5f['shift']());}};_0x5bc65a(++_0x18fac6);}(_0xc3f9,0xe4));var _0x9c3f=function(_0x330b96,_0x191ef2){_0x330b96=_0x330b96-0x0;var _0x4d67f5=_0xc3f9[_0x330b96];return _0x4d67f5;};'use strict';var moment=require(_0x9c3f('0x0'));var utils=require(_0x9c3f('0x1'));function AgentComplete(_0x2a3556,_0x2903ff){this[_0x9c3f('0x2')]=0x4;this['statedesc']=_0x9c3f('0x3');this[_0x9c3f('0x4')]=_0x2a3556['scheduledat'];this['type']=_0x2a3556[_0x9c3f('0x5')];this[_0x9c3f('0x6')]=_0x2a3556[_0x9c3f('0x5')]===_0x9c3f('0x7')?_0x9c3f('0x8'):_0x2a3556['type'];this[_0x9c3f('0x9')]=_0x2a3556[_0x9c3f('0x9')];this['countcongestionretry']=_0x2a3556[_0x9c3f('0xa')];this[_0x9c3f('0xb')]=_0x2a3556[_0x9c3f('0xb')];this['countglobal']=_0x2a3556[_0x9c3f('0x9')]+_0x2a3556[_0x9c3f('0xa')]+_0x2a3556['countnoanswerretry']+_0x2a3556['countnosuchnumberretry']+_0x2a3556['countdropretry']+_0x2a3556[_0x9c3f('0xc')]+_0x2a3556['countmachineretry']+_0x2a3556[_0x9c3f('0xd')];this['countnosuchnumberretry']=_0x2a3556[_0x9c3f('0xe')];this[_0x9c3f('0xf')]=_0x2a3556[_0x9c3f('0xf')];this[_0x9c3f('0xc')]=_0x2a3556[_0x9c3f('0xc')];this[_0x9c3f('0x10')]=_0x2a3556[_0x9c3f('0x10')];this[_0x9c3f('0xd')]=_0x2a3556[_0x9c3f('0xd')];this[_0x9c3f('0x11')]=_0x2903ff[_0x9c3f('0x11')];this[_0x9c3f('0x12')]=_0x2a3556[_0x9c3f('0x13')];this[_0x9c3f('0x14')]=_0x2a3556[_0x9c3f('0x15')];this[_0x9c3f('0x16')]=_0x2a3556[_0x9c3f('0x16')];this['responsetime']=_0x2a3556[_0x9c3f('0x17')];this[_0x9c3f('0x18')]=_0x2a3556[_0x9c3f('0x18')];this[_0x9c3f('0x19')]=moment()[_0x9c3f('0x1a')](_0x9c3f('0x1b'));this['ringtime']=utils[_0x9c3f('0x1c')](_0x2a3556[_0x9c3f('0x17')],_0x2a3556['starttime']);this[_0x9c3f('0x1d')]=utils[_0x9c3f('0x1c')](_0x2a3556[_0x9c3f('0x18')],_0x2a3556[_0x9c3f('0x17')]);this[_0x9c3f('0x1e')]=utils[_0x9c3f('0x1c')](this[_0x9c3f('0x19')],_0x2a3556[_0x9c3f('0x18')]);this[_0x9c3f('0x8')]=_0x2903ff[_0x9c3f('0x8')];this[_0x9c3f('0x1f')]=_0x2903ff[_0x9c3f('0x1f')];this['reason']=_0x2903ff['reason'];this['callback']=_0x2a3556[_0x9c3f('0x20')];this[_0x9c3f('0x21')]=_0x2a3556['callbackuniqueid'];this[_0x9c3f('0x22')]=_0x2a3556[_0x9c3f('0x22')];this[_0x9c3f('0x23')]=_0x2a3556[_0x9c3f('0x23')];this[_0x9c3f('0x24')]=_0x2a3556['ContactId'];this[_0x9c3f('0x25')]=_0x2a3556[_0x9c3f('0x25')];this['UserId']=_0x2a3556['UserId'];this[_0x9c3f('0x26')]=_0x2a3556['VoiceQueueId'];this[_0x9c3f('0x27')]=_0x2a3556['CampaignId'];this[_0x9c3f('0x28')]=_0x2a3556['originatecalleridnum']||'';this[_0x9c3f('0x29')]=_0x2a3556[_0x9c3f('0x29')]||'';this[_0x9c3f('0x2a')]=_0x2a3556[_0x9c3f('0x2a')];}module[_0x9c3f('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 9d8a75b..9605866 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fe9=['originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8fe9,0x11d));var _0x98fe=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x8fe9[_0x45313f];return _0x402910;};'use strict';function Final(_0x58c7f8){this[_0x98fe('0x0')]=_0x58c7f8[_0x98fe('0x0')];this[_0x98fe('0x1')]=_0x58c7f8[_0x98fe('0x1')];this[_0x98fe('0x2')]=_0x58c7f8['type'];this[_0x98fe('0x3')]=_0x58c7f8[_0x98fe('0x2')]===_0x98fe('0x4')?_0x98fe('0x5'):_0x58c7f8['type'];this['countbusyretry']=_0x58c7f8[_0x98fe('0x6')];this['countcongestionretry']=_0x58c7f8[_0x98fe('0x7')];this[_0x98fe('0x8')]=_0x58c7f8[_0x98fe('0x8')];this[_0x98fe('0x9')]=_0x58c7f8[_0x98fe('0x6')]+_0x58c7f8[_0x98fe('0x7')]+_0x58c7f8[_0x98fe('0x8')]+_0x58c7f8[_0x98fe('0xa')]+_0x58c7f8[_0x98fe('0xb')]+_0x58c7f8[_0x98fe('0xc')]+_0x58c7f8[_0x98fe('0xd')]+_0x58c7f8['countagentrejectretry'];this['countnosuchnumberretry']=_0x58c7f8[_0x98fe('0xa')];this[_0x98fe('0xb')]=_0x58c7f8[_0x98fe('0xb')];this[_0x98fe('0xc')]=_0x58c7f8[_0x98fe('0xc')];this[_0x98fe('0xd')]=_0x58c7f8[_0x98fe('0xd')];this[_0x98fe('0xe')]=_0x58c7f8[_0x98fe('0xe')];this[_0x98fe('0x5')]=_0x58c7f8['queue'];this['calleridname']=_0x58c7f8['calleridname'];this[_0x98fe('0xf')]=_0x58c7f8[_0x98fe('0xf')];this[_0x98fe('0x10')]=_0x58c7f8[_0x98fe('0x10')];this['responsetime']=_0x58c7f8[_0x98fe('0x11')];this[_0x98fe('0x12')]=_0x58c7f8[_0x98fe('0x11')];this[_0x98fe('0x13')]=_0x58c7f8['ringtime']||0x0;this['holdtime']=_0x58c7f8[_0x98fe('0x14')]||0x0;this[_0x98fe('0x15')]=_0x58c7f8['talktime']||0x0;this['callback']=_0x58c7f8[_0x98fe('0x16')];this[_0x98fe('0x17')]=_0x58c7f8['callbackuniqueid'];this['callbackat']=_0x58c7f8[_0x98fe('0x18')];this[_0x98fe('0x19')]=_0x58c7f8[_0x98fe('0x19')];this[_0x98fe('0x1a')]=_0x58c7f8[_0x98fe('0x1a')];this['ListId']=_0x58c7f8['ListId'];this[_0x98fe('0x1b')]=_0x58c7f8[_0x98fe('0x1b')];this['VoiceQueueId']=_0x58c7f8[_0x98fe('0x1c')];this[_0x98fe('0x1d')]=_0x58c7f8[_0x98fe('0x1d')];this[_0x98fe('0x1e')]=_0x58c7f8[_0x98fe('0x1e')]||'';this[_0x98fe('0x1f')]=_0x58c7f8[_0x98fe('0x1f')]||'';this[_0x98fe('0x20')]=_0x58c7f8[_0x98fe('0x20')];this[_0x98fe('0x21')]=_0x58c7f8[_0x98fe('0x21')];}module[_0x98fe('0x22')]=Final; \ No newline at end of file +var _0x1223=['countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry'];(function(_0x52469e,_0x3579c2){var _0x2e6692=function(_0x3e5576){while(--_0x3e5576){_0x52469e['push'](_0x52469e['shift']());}};_0x2e6692(++_0x3579c2);}(_0x1223,0x180));var _0x3122=function(_0x3c1e60,_0xd55dd9){_0x3c1e60=_0x3c1e60-0x0;var _0x4c287d=_0x1223[_0x3c1e60];return _0x4c287d;};'use strict';function Final(_0x95aa8d){this[_0x3122('0x0')]=_0x95aa8d[_0x3122('0x0')];this[_0x3122('0x1')]=_0x95aa8d[_0x3122('0x1')];this[_0x3122('0x2')]=_0x95aa8d['type'];this[_0x3122('0x3')]=_0x95aa8d['type']===_0x3122('0x4')?_0x3122('0x5'):_0x95aa8d[_0x3122('0x2')];this[_0x3122('0x6')]=_0x95aa8d[_0x3122('0x6')];this[_0x3122('0x7')]=_0x95aa8d[_0x3122('0x7')];this[_0x3122('0x8')]=_0x95aa8d[_0x3122('0x8')];this[_0x3122('0x9')]=_0x95aa8d[_0x3122('0x6')]+_0x95aa8d[_0x3122('0x7')]+_0x95aa8d[_0x3122('0x8')]+_0x95aa8d['countnosuchnumberretry']+_0x95aa8d['countdropretry']+_0x95aa8d[_0x3122('0xa')]+_0x95aa8d[_0x3122('0xb')]+_0x95aa8d[_0x3122('0xc')];this[_0x3122('0xd')]=_0x95aa8d['countnosuchnumberretry'];this[_0x3122('0xe')]=_0x95aa8d[_0x3122('0xe')];this['countabandonedretry']=_0x95aa8d['countabandonedretry'];this[_0x3122('0xb')]=_0x95aa8d[_0x3122('0xb')];this['countagentrejectretry']=_0x95aa8d[_0x3122('0xc')];this['queue']=_0x95aa8d[_0x3122('0x5')];this['calleridname']=_0x95aa8d[_0x3122('0xf')];this[_0x3122('0x10')]=_0x95aa8d[_0x3122('0x10')];this[_0x3122('0x11')]=_0x95aa8d[_0x3122('0x11')];this[_0x3122('0x12')]=_0x95aa8d[_0x3122('0x12')];this[_0x3122('0x13')]=_0x95aa8d['responsetime'];this[_0x3122('0x14')]=_0x95aa8d[_0x3122('0x14')]||0x0;this[_0x3122('0x15')]=_0x95aa8d['holdtime']||0x0;this['talktime']=_0x95aa8d[_0x3122('0x16')]||0x0;this[_0x3122('0x17')]=_0x95aa8d[_0x3122('0x17')];this[_0x3122('0x18')]=_0x95aa8d['callbackuniqueid'];this[_0x3122('0x19')]=_0x95aa8d[_0x3122('0x19')];this[_0x3122('0x1a')]=_0x95aa8d[_0x3122('0x1a')];this[_0x3122('0x1b')]=_0x95aa8d[_0x3122('0x1b')];this['ListId']=_0x95aa8d[_0x3122('0x1c')];this[_0x3122('0x1d')]=_0x95aa8d['UserId'];this[_0x3122('0x1e')]=_0x95aa8d[_0x3122('0x1e')];this['CampaignId']=_0x95aa8d[_0x3122('0x1f')];this['originatecalleridnum']=_0x95aa8d['originatecalleridnum']||'';this[_0x3122('0x20')]=_0x95aa8d[_0x3122('0x20')]||'';this[_0x3122('0x21')]=_0x95aa8d['state'];this[_0x3122('0x22')]=_0x95aa8d['statedesc'];}module[_0x3122('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index baa34f9..75ee072 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3b2=['ListId','UserId','VoiceQueueId','CampaignId','exports','state','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','getSeconds','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x22491d,_0x3bad40){var _0x431173=function(_0x4fba3f){while(--_0x4fba3f){_0x22491d['push'](_0x22491d['shift']());}};_0x431173(++_0x3bad40);}(_0xc3b2,0xd7));var _0x2c3b=function(_0x5678ff,_0x55635c){_0x5678ff=_0x5678ff-0x0;var _0x2c1db9=_0xc3b2[_0x5678ff];return _0x2c1db9;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x1cee35,_0x1a8ca2){this[_0x2c3b('0x0')]=0x4;this['statedesc']=_0x2c3b('0x1');this[_0x2c3b('0x2')]=_0x1cee35[_0x2c3b('0x2')];this[_0x2c3b('0x3')]=_0x1cee35[_0x2c3b('0x3')];this[_0x2c3b('0x4')]=_0x1cee35[_0x2c3b('0x3')]===_0x2c3b('0x5')?'queue':_0x1cee35[_0x2c3b('0x3')];this[_0x2c3b('0x6')]=_0x1cee35['amd']||![];this[_0x2c3b('0x7')]=_0x1cee35[_0x2c3b('0x7')];this[_0x2c3b('0x8')]=_0x1cee35[_0x2c3b('0x8')];this[_0x2c3b('0x9')]=_0x1cee35[_0x2c3b('0x9')];this[_0x2c3b('0xa')]=_0x1cee35[_0x2c3b('0x7')]+_0x1cee35[_0x2c3b('0x8')]+_0x1cee35[_0x2c3b('0x9')]+_0x1cee35[_0x2c3b('0xb')]+_0x1cee35[_0x2c3b('0xc')]+_0x1cee35[_0x2c3b('0xd')]+_0x1cee35[_0x2c3b('0xe')]+_0x1cee35[_0x2c3b('0xf')];this['countnosuchnumberretry']=_0x1cee35[_0x2c3b('0xb')];this['countdropretry']=_0x1cee35[_0x2c3b('0xc')];this[_0x2c3b('0xd')]=_0x1cee35[_0x2c3b('0xd')];this[_0x2c3b('0xe')]=_0x1cee35[_0x2c3b('0xe')];this[_0x2c3b('0xf')]=_0x1cee35[_0x2c3b('0xf')];this['uniqueid']=_0x1a8ca2[_0x2c3b('0x10')];this[_0x2c3b('0x11')]=_0x1cee35[_0x2c3b('0x12')];this[_0x2c3b('0x13')]=_0x1cee35['number'];this[_0x2c3b('0x14')]=_0x1cee35[_0x2c3b('0x14')];this['responsetime']=_0x1cee35[_0x2c3b('0x15')];this['endtime']=moment()[_0x2c3b('0x16')](_0x2c3b('0x17'));this[_0x2c3b('0x18')]=utils['getSeconds'](_0x1cee35[_0x2c3b('0x15')],_0x1cee35[_0x2c3b('0x14')]);this['holdtime']=0x0;this[_0x2c3b('0x19')]=utils[_0x2c3b('0x1a')](this[_0x2c3b('0x1b')],_0x1cee35[_0x2c3b('0x15')]);this['queue']=_0x1cee35['queue'];this[_0x2c3b('0x1c')]=_0x2c3b('0x1d');this[_0x2c3b('0x1e')]=_0x1a8ca2[_0x2c3b('0x1f')];this[_0x2c3b('0x20')]=_0x1cee35[_0x2c3b('0x20')];this[_0x2c3b('0x21')]=_0x1cee35['callbackuniqueid'];this[_0x2c3b('0x22')]=_0x1cee35['callbackat'];this[_0x2c3b('0x23')]=_0x1cee35[_0x2c3b('0x23')];this[_0x2c3b('0x24')]=_0x1cee35[_0x2c3b('0x24')];this[_0x2c3b('0x25')]=_0x1cee35[_0x2c3b('0x25')];this[_0x2c3b('0x26')]=_0x1cee35[_0x2c3b('0x26')];this[_0x2c3b('0x27')]=_0x1cee35[_0x2c3b('0x27')];this[_0x2c3b('0x28')]=_0x1cee35['CampaignId'];}module[_0x2c3b('0x29')]=Hangup; \ No newline at end of file +var _0x77ca=['../utils','statedesc','scheduledat','campaigntype','type','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','endtime','membername','IVR','cause-txt','callback','callbackuniqueid','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment'];(function(_0x3d12d9,_0x1e0e49){var _0x2b622d=function(_0x1ca7ed){while(--_0x1ca7ed){_0x3d12d9['push'](_0x3d12d9['shift']());}};_0x2b622d(++_0x1e0e49);}(_0x77ca,0x1a1));var _0xa77c=function(_0x183162,_0x5bc223){_0x183162=_0x183162-0x0;var _0x67cf7d=_0x77ca[_0x183162];return _0x67cf7d;};'use strict';var moment=require(_0xa77c('0x0'));var utils=require(_0xa77c('0x1'));function Hangup(_0x32bf89,_0x251c76){this['state']=0x4;this[_0xa77c('0x2')]='Answer';this[_0xa77c('0x3')]=_0x32bf89[_0xa77c('0x3')];this['type']=_0x32bf89['type'];this[_0xa77c('0x4')]=_0x32bf89[_0xa77c('0x5')]==='outbound'?_0xa77c('0x6'):_0x32bf89[_0xa77c('0x5')];this[_0xa77c('0x7')]=_0x32bf89[_0xa77c('0x7')]||![];this[_0xa77c('0x8')]=_0x32bf89['countbusyretry'];this[_0xa77c('0x9')]=_0x32bf89['countcongestionretry'];this[_0xa77c('0xa')]=_0x32bf89[_0xa77c('0xa')];this[_0xa77c('0xb')]=_0x32bf89['countbusyretry']+_0x32bf89['countcongestionretry']+_0x32bf89['countnoanswerretry']+_0x32bf89[_0xa77c('0xc')]+_0x32bf89[_0xa77c('0xd')]+_0x32bf89['countabandonedretry']+_0x32bf89['countmachineretry']+_0x32bf89[_0xa77c('0xe')];this[_0xa77c('0xc')]=_0x32bf89[_0xa77c('0xc')];this[_0xa77c('0xd')]=_0x32bf89[_0xa77c('0xd')];this[_0xa77c('0xf')]=_0x32bf89[_0xa77c('0xf')];this['countmachineretry']=_0x32bf89['countmachineretry'];this['countagentrejectretry']=_0x32bf89[_0xa77c('0xe')];this[_0xa77c('0x10')]=_0x251c76['uniqueid'];this[_0xa77c('0x11')]=_0x32bf89[_0xa77c('0x12')];this[_0xa77c('0x13')]=_0x32bf89[_0xa77c('0x14')];this[_0xa77c('0x15')]=_0x32bf89[_0xa77c('0x15')];this[_0xa77c('0x16')]=_0x32bf89[_0xa77c('0x16')];this['endtime']=moment()[_0xa77c('0x17')](_0xa77c('0x18'));this[_0xa77c('0x19')]=utils[_0xa77c('0x1a')](_0x32bf89[_0xa77c('0x16')],_0x32bf89[_0xa77c('0x15')]);this['holdtime']=0x0;this['talktime']=utils[_0xa77c('0x1a')](this[_0xa77c('0x1b')],_0x32bf89[_0xa77c('0x16')]);this[_0xa77c('0x6')]=_0x32bf89[_0xa77c('0x6')];this[_0xa77c('0x1c')]=_0xa77c('0x1d');this['reason']=_0x251c76[_0xa77c('0x1e')];this[_0xa77c('0x1f')]=_0x32bf89[_0xa77c('0x1f')];this[_0xa77c('0x20')]=_0x32bf89[_0xa77c('0x20')];this['callbackat']=_0x32bf89['callbackat'];this['recallme']=_0x32bf89['recallme'];this[_0xa77c('0x21')]=_0x32bf89['ContactId'];this[_0xa77c('0x22')]=_0x32bf89['ListId'];this[_0xa77c('0x23')]=_0x32bf89[_0xa77c('0x23')];this['VoiceQueueId']=_0x32bf89[_0xa77c('0x24')];this['CampaignId']=_0x32bf89[_0xa77c('0x25')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index a0b1f79..dd359d2 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0000=['endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','name','number','starttime','responsetime'];(function(_0x3ac618,_0x28bf7a){var _0xa0f924=function(_0x3dd115){while(--_0x3dd115){_0x3ac618['push'](_0x3ac618['shift']());}};_0xa0f924(++_0x28bf7a);}(_0x0000,0xa4));var _0x0000=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0000[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x0000('0x0'));function History(_0xd48641){this[_0x0000('0x1')]=_0xd48641[_0x0000('0x1')];this[_0x0000('0x2')]=_0xd48641['scheduledat']||undefined;this[_0x0000('0x3')]=_0xd48641['type'];this[_0x0000('0x4')]=_0xd48641['type']===_0x0000('0x5')?'queue':_0xd48641['type'];this['countbusyretry']=_0xd48641[_0x0000('0x6')];this[_0x0000('0x7')]=_0xd48641[_0x0000('0x7')];this[_0x0000('0x8')]=_0xd48641[_0x0000('0x8')];this[_0x0000('0x9')]=_0xd48641[_0x0000('0x6')]+_0xd48641[_0x0000('0x7')]+_0xd48641[_0x0000('0x8')]+_0xd48641[_0x0000('0xa')]+_0xd48641['countdropretry']+_0xd48641[_0x0000('0xb')]+_0xd48641[_0x0000('0xc')]+_0xd48641[_0x0000('0xd')];this[_0x0000('0xa')]=_0xd48641[_0x0000('0xa')];this[_0x0000('0xe')]=_0xd48641[_0x0000('0xe')];this[_0x0000('0xb')]=_0xd48641[_0x0000('0xb')];this[_0x0000('0xc')]=_0xd48641['countmachineretry'];this[_0x0000('0xd')]=_0xd48641[_0x0000('0xd')];this['queue']=_0xd48641[_0x0000('0xf')];this[_0x0000('0x10')]=_0xd48641[_0x0000('0x11')];this['calleridnum']=_0xd48641[_0x0000('0x12')];this[_0x0000('0x13')]=_0xd48641[_0x0000('0x13')];this[_0x0000('0x14')]=_0xd48641[_0x0000('0x14')];this[_0x0000('0x15')]=_0xd48641['responsetime'];this['ringtime']=utils['getSeconds'](_0xd48641['responsetime'],_0xd48641[_0x0000('0x13')]);this['holdtime']=0x0;this[_0x0000('0x16')]=0x0;this[_0x0000('0x17')]=_0xd48641['callback'];this[_0x0000('0x18')]=_0xd48641[_0x0000('0x18')];this['callbackat']=_0xd48641[_0x0000('0x19')];this[_0x0000('0x1a')]=_0xd48641['recallme'];this[_0x0000('0x1b')]=_0xd48641[_0x0000('0x1b')];this[_0x0000('0x1c')]=_0xd48641['ListId'];this[_0x0000('0x1d')]=_0xd48641[_0x0000('0x1d')];this[_0x0000('0x1e')]=_0xd48641[_0x0000('0x1e')];this[_0x0000('0x1f')]=_0xd48641[_0x0000('0x1f')];this[_0x0000('0x20')]=_0xd48641[_0x0000('0x20')]||'';this[_0x0000('0x21')]=_0xd48641['originatecalleridname']||'';this[_0x0000('0x22')]=_0xd48641[_0x0000('0x22')];this[_0x0000('0x23')]=_0xd48641[_0x0000('0x23')];}module[_0x0000('0x24')]=History; \ No newline at end of file +var _0x16bb=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countnoanswerretry','countglobal','countbusyretry','countcongestionretry','countdropretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16bb,0x18b));var _0xb16b=function(_0x5de7bd,_0x5094a5){_0x5de7bd=_0x5de7bd-0x0;var _0x1b9ab1=_0x16bb[_0x5de7bd];return _0x1b9ab1;};'use strict';var utils=require(_0xb16b('0x0'));function History(_0x5e1c5c){this[_0xb16b('0x1')]=_0x5e1c5c[_0xb16b('0x1')];this[_0xb16b('0x2')]=_0x5e1c5c[_0xb16b('0x2')]||undefined;this['type']=_0x5e1c5c[_0xb16b('0x3')];this[_0xb16b('0x4')]=_0x5e1c5c['type']===_0xb16b('0x5')?_0xb16b('0x6'):_0x5e1c5c[_0xb16b('0x3')];this['countbusyretry']=_0x5e1c5c['countbusyretry'];this['countcongestionretry']=_0x5e1c5c['countcongestionretry'];this[_0xb16b('0x7')]=_0x5e1c5c[_0xb16b('0x7')];this[_0xb16b('0x8')]=_0x5e1c5c[_0xb16b('0x9')]+_0x5e1c5c[_0xb16b('0xa')]+_0x5e1c5c[_0xb16b('0x7')]+_0x5e1c5c['countnosuchnumberretry']+_0x5e1c5c[_0xb16b('0xb')]+_0x5e1c5c[_0xb16b('0xc')]+_0x5e1c5c[_0xb16b('0xd')]+_0x5e1c5c[_0xb16b('0xe')];this[_0xb16b('0xf')]=_0x5e1c5c['countnosuchnumberretry'];this[_0xb16b('0xb')]=_0x5e1c5c[_0xb16b('0xb')];this[_0xb16b('0xc')]=_0x5e1c5c[_0xb16b('0xc')];this[_0xb16b('0xd')]=_0x5e1c5c[_0xb16b('0xd')];this['countagentrejectretry']=_0x5e1c5c[_0xb16b('0xe')];this[_0xb16b('0x6')]=_0x5e1c5c[_0xb16b('0x6')];this[_0xb16b('0x10')]=_0x5e1c5c[_0xb16b('0x11')];this[_0xb16b('0x12')]=_0x5e1c5c[_0xb16b('0x13')];this[_0xb16b('0x14')]=_0x5e1c5c[_0xb16b('0x14')];this[_0xb16b('0x15')]=_0x5e1c5c[_0xb16b('0x15')];this['endtime']=_0x5e1c5c['responsetime'];this[_0xb16b('0x16')]=utils[_0xb16b('0x17')](_0x5e1c5c['responsetime'],_0x5e1c5c[_0xb16b('0x14')]);this[_0xb16b('0x18')]=0x0;this['talktime']=0x0;this['callback']=_0x5e1c5c['callback'];this[_0xb16b('0x19')]=_0x5e1c5c[_0xb16b('0x19')];this['callbackat']=_0x5e1c5c[_0xb16b('0x1a')];this['recallme']=_0x5e1c5c[_0xb16b('0x1b')];this[_0xb16b('0x1c')]=_0x5e1c5c[_0xb16b('0x1c')];this['ListId']=_0x5e1c5c[_0xb16b('0x1d')];this[_0xb16b('0x1e')]=_0x5e1c5c['UserId'];this[_0xb16b('0x1f')]=_0x5e1c5c[_0xb16b('0x1f')];this[_0xb16b('0x20')]=_0x5e1c5c[_0xb16b('0x20')];this[_0xb16b('0x21')]=_0x5e1c5c[_0xb16b('0x21')]||'';this[_0xb16b('0x22')]=_0x5e1c5c[_0xb16b('0x22')]||'';this[_0xb16b('0x23')]=_0x5e1c5c[_0xb16b('0x23')];this[_0xb16b('0x24')]=_0x5e1c5c['statedesc'];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index c33ea62..703432e 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdd3=['originatecalleridnum','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','ringtime','holdtime','getSeconds','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xfdd3,0x107));var _0x3fdd=function(_0x3b0c84,_0x35dc7a){_0x3b0c84=_0x3b0c84-0x0;var _0x241515=_0xfdd3[_0x3b0c84];return _0x241515;};'use strict';var utils=require(_0x3fdd('0x0'));function QueueCallerAbandon(_0x337405,_0x5cdd64){this[_0x3fdd('0x1')]=_0x337405[_0x3fdd('0x1')];this['type']=_0x337405[_0x3fdd('0x2')];this['campaigntype']=_0x337405[_0x3fdd('0x2')]===_0x3fdd('0x3')?_0x3fdd('0x4'):_0x337405[_0x3fdd('0x2')];this['countbusyretry']=_0x337405['countbusyretry'];this[_0x3fdd('0x5')]=_0x337405[_0x3fdd('0x5')];this[_0x3fdd('0x6')]=_0x337405['countnoanswerretry'];this[_0x3fdd('0x7')]=_0x337405['countbusyretry']+_0x337405['countcongestionretry']+_0x337405['countnoanswerretry']+_0x337405[_0x3fdd('0x8')]+_0x337405[_0x3fdd('0x9')]+_0x337405[_0x3fdd('0xa')]+_0x337405['countmachineretry']+_0x337405['countagentrejectretry'];this['countnosuchnumberretry']=_0x337405[_0x3fdd('0x8')];this[_0x3fdd('0x9')]=_0x337405[_0x3fdd('0x9')];this[_0x3fdd('0xa')]=_0x337405['countabandonedretry'];this[_0x3fdd('0xb')]=_0x337405[_0x3fdd('0xb')];this['countagentrejectretry']=_0x337405[_0x3fdd('0xc')];this[_0x3fdd('0xd')]=_0x5cdd64[_0x3fdd('0xd')];this[_0x3fdd('0xe')]=_0x337405[_0x3fdd('0xf')];this[_0x3fdd('0x10')]=_0x337405['number'];this[_0x3fdd('0x11')]=_0x337405[_0x3fdd('0x11')];this['responsetime']=_0x337405[_0x3fdd('0x12')];this['droptime']=_0x337405['droptime'];this['dropreason']=_0x337405['dropreason'];this['endtime']=this[_0x3fdd('0x13')];this[_0x3fdd('0x14')]=utils['getSeconds'](_0x337405['responsetime'],_0x337405[_0x3fdd('0x11')]);this[_0x3fdd('0x15')]=utils[_0x3fdd('0x16')](this[_0x3fdd('0x13')],_0x337405['responsetime']);this['talktime']=0x0;this[_0x3fdd('0x4')]=_0x5cdd64[_0x3fdd('0x4')];this['membername']=_0x5cdd64['connectedlinename'];this[_0x3fdd('0x17')]=_0x5cdd64[_0x3fdd('0x17')];this[_0x3fdd('0x18')]=_0x337405['callback'];this['callbackuniqueid']=_0x337405[_0x3fdd('0x19')];this['callbackat']=_0x337405[_0x3fdd('0x1a')];this[_0x3fdd('0x1b')]=_0x337405['recallme'];this[_0x3fdd('0x1c')]=_0x337405[_0x3fdd('0x1c')];this[_0x3fdd('0x1d')]=_0x337405[_0x3fdd('0x1d')];this[_0x3fdd('0x1e')]=_0x337405[_0x3fdd('0x1e')];this[_0x3fdd('0x1f')]=_0x337405['VoiceQueueId'];this['CampaignId']=_0x337405[_0x3fdd('0x20')];this['originatecalleridnum']=_0x337405[_0x3fdd('0x21')]||'';this['originatecalleridname']=_0x337405['originatecalleridname']||'';this['agiafterat']=_0x337405['agiafterat'];this[_0x3fdd('0x22')]=_0x337405[_0x3fdd('0x22')];this['statedesc']=_0x337405[_0x3fdd('0x23')];}module[_0x3fdd('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0x9ead=['countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x9ead,0x70));var _0xd9ea=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x9ead[_0x406e46];return _0x4a3742;};'use strict';var utils=require(_0xd9ea('0x0'));function QueueCallerAbandon(_0xcd4273,_0x1e1e97){this[_0xd9ea('0x1')]=_0xcd4273['scheduledat'];this[_0xd9ea('0x2')]=_0xcd4273[_0xd9ea('0x2')];this[_0xd9ea('0x3')]=_0xcd4273['type']===_0xd9ea('0x4')?'queue':_0xcd4273['type'];this[_0xd9ea('0x5')]=_0xcd4273[_0xd9ea('0x5')];this[_0xd9ea('0x6')]=_0xcd4273[_0xd9ea('0x6')];this['countnoanswerretry']=_0xcd4273[_0xd9ea('0x7')];this[_0xd9ea('0x8')]=_0xcd4273['countbusyretry']+_0xcd4273['countcongestionretry']+_0xcd4273['countnoanswerretry']+_0xcd4273['countnosuchnumberretry']+_0xcd4273[_0xd9ea('0x9')]+_0xcd4273[_0xd9ea('0xa')]+_0xcd4273[_0xd9ea('0xb')]+_0xcd4273[_0xd9ea('0xc')];this['countnosuchnumberretry']=_0xcd4273[_0xd9ea('0xd')];this[_0xd9ea('0x9')]=_0xcd4273[_0xd9ea('0x9')];this[_0xd9ea('0xa')]=_0xcd4273['countabandonedretry'];this[_0xd9ea('0xb')]=_0xcd4273[_0xd9ea('0xb')];this['countagentrejectretry']=_0xcd4273[_0xd9ea('0xc')];this[_0xd9ea('0xe')]=_0x1e1e97[_0xd9ea('0xe')];this[_0xd9ea('0xf')]=_0xcd4273['name'];this['calleridnum']=_0xcd4273[_0xd9ea('0x10')];this[_0xd9ea('0x11')]=_0xcd4273['starttime'];this[_0xd9ea('0x12')]=_0xcd4273[_0xd9ea('0x12')];this['droptime']=_0xcd4273[_0xd9ea('0x13')];this['dropreason']=_0xcd4273[_0xd9ea('0x14')];this[_0xd9ea('0x15')]=this['droptime'];this['ringtime']=utils[_0xd9ea('0x16')](_0xcd4273[_0xd9ea('0x12')],_0xcd4273['starttime']);this[_0xd9ea('0x17')]=utils[_0xd9ea('0x16')](this[_0xd9ea('0x13')],_0xcd4273['responsetime']);this['talktime']=0x0;this['queue']=_0x1e1e97[_0xd9ea('0x18')];this['membername']=_0x1e1e97[_0xd9ea('0x19')];this['reason']=_0x1e1e97[_0xd9ea('0x1a')];this[_0xd9ea('0x1b')]=_0xcd4273[_0xd9ea('0x1b')];this['callbackuniqueid']=_0xcd4273[_0xd9ea('0x1c')];this['callbackat']=_0xcd4273[_0xd9ea('0x1d')];this[_0xd9ea('0x1e')]=_0xcd4273[_0xd9ea('0x1e')];this[_0xd9ea('0x1f')]=_0xcd4273[_0xd9ea('0x1f')];this[_0xd9ea('0x20')]=_0xcd4273['ListId'];this[_0xd9ea('0x21')]=_0xcd4273[_0xd9ea('0x21')];this[_0xd9ea('0x22')]=_0xcd4273[_0xd9ea('0x22')];this['CampaignId']=_0xcd4273[_0xd9ea('0x23')];this[_0xd9ea('0x24')]=_0xcd4273['originatecalleridnum']||'';this[_0xd9ea('0x25')]=_0xcd4273['originatecalleridname']||'';this[_0xd9ea('0x26')]=_0xcd4273['agiafterat'];this[_0xd9ea('0x27')]=_0xcd4273[_0xd9ea('0x27')];this[_0xd9ea('0x28')]=_0xcd4273[_0xd9ea('0x28')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 7d89e01..2e61396 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0xf86327,_0x593328){var _0x5af202=function(_0x3ffaab){while(--_0x3ffaab){_0xf86327['push'](_0xf86327['shift']());}};_0x5af202(++_0x593328);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x28c4c1,_0x36716d){var _0x2e12e7=function(_0x3984f2){while(--_0x3984f2){_0x28c4c1['push'](_0x28c4c1['shift']());}};_0x2e12e7(++_0x36716d);}(_0xb10b,0x12a));var _0xbb10=function(_0x37909b,_0xbd548c){_0x37909b=_0x37909b-0x0;var _0x1a949b=_0xb10b[_0x37909b];return _0x1a949b;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 2a97e84..4641c0a 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a7b=['getSeconds','message','available','loggedIn','loggedInDb','paused','pTalking','waiting','inUse','originated','Trunk','name','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','TrunkBackup','INACTIVE','talking','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds'];(function(_0x595064,_0x2e5665){var _0x2b4122=function(_0x351236){while(--_0x351236){_0x595064['push'](_0x595064['shift']());}};_0x2b4122(++_0x2e5665);}(_0x4a7b,0x16c));var _0xb4a7=function(_0x3fb8e6,_0x3e20e2){_0x3fb8e6=_0x3fb8e6-0x0;var _0x116329=_0x4a7b[_0x3fb8e6];return _0x116329;};'use strict';var _=require(_0xb4a7('0x0'));var moment=require(_0xb4a7('0x1'));var util=require(_0xb4a7('0x2'));var logger=require(_0xb4a7('0x3'))(_0xb4a7('0x4'));var timezones=require(_0xb4a7('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xb4a7('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xb4a7('0x7'),'DEACTIVATED':_0xb4a7('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xb4a7('0x9'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xb4a7('0xa'),'NO_AVAILABLE_CONTACTS':_0xb4a7('0xb'),'NULL_INTERVAL':_0xb4a7('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xb4a7('0xd'),'QUEUE_RECALL':_0xb4a7('0xe'),'RECALL_TIMEOUT':_0xb4a7('0xf'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xb4a7('0x10'),'UNREACHABLE_TRUNK':_0xb4a7('0x11')};exports[_0xb4a7('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3320cc){return _0x3320cc[_0xb4a7('0x13')]===_0xb4a7('0x14');}exports[_0xb4a7('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x316869){return _0x316869['type']==='ivr';}exports[_0xb4a7('0x16')]=isIVRCampaign;function isOutboundQueue(_0x1138a5){return _0x1138a5['type']===_0xb4a7('0x17');}exports[_0xb4a7('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x19c850){return _0x19c850[_0xb4a7('0x19')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x4a6781){return _0x4a6781[_0xb4a7('0x1a')];}exports[_0xb4a7('0x1b')]=isIVRCampaignActive;function getSeconds(_0x111711,_0x42266c){var _0x339224=moment(_0x111711)[_0xb4a7('0x1c')](0x0);var _0x309578=moment(_0x42266c)['milliseconds'](0x0);return _0x339224[_0xb4a7('0x1d')](_0x309578,_0xb4a7('0x1e'));}exports[_0xb4a7('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x576e40,_0x3dfc07){var _0x1fc8eb=![];var _0x5a1db0=_0x576e40[_0xb4a7('0x13')]!==_0x3dfc07[_0xb4a7('0x13')]||_0x576e40['dialActive']!==_0x3dfc07['dialActive']||_0x576e40['message']!==_0x3dfc07[_0xb4a7('0x20')];var _0x1f2b6a=_0x576e40[_0xb4a7('0x21')]!==_0x3dfc07[_0xb4a7('0x21')]||_0x576e40[_0xb4a7('0x22')]!==_0x3dfc07[_0xb4a7('0x22')]||_0x576e40['loggedInDb']!==_0x3dfc07[_0xb4a7('0x23')]||_0x576e40['paused']!==_0x3dfc07[_0xb4a7('0x24')]||_0x576e40['talking']!==_0x3dfc07['talking']||_0x576e40[_0xb4a7('0x25')]!==_0x3dfc07[_0xb4a7('0x25')]||_0x576e40[_0xb4a7('0x26')]!==_0x3dfc07['waiting']||_0x576e40[_0xb4a7('0x27')]!==_0x3dfc07[_0xb4a7('0x27')]||_0x576e40[_0xb4a7('0x28')]!==_0x3dfc07['originated'];if(_0x576e40[_0xb4a7('0x29')]&&_0x3dfc07[_0xb4a7('0x29')]){_0x1fc8eb=_0x576e40[_0xb4a7('0x29')][_0xb4a7('0x2a')]!==_0x3dfc07[_0xb4a7('0x29')][_0xb4a7('0x2a')]||_0x576e40[_0xb4a7('0x29')][_0xb4a7('0x1a')]!==_0x3dfc07['Trunk']['active'];}return _0x5a1db0||_0x1f2b6a||_0x1fc8eb;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x106cfc){var _0x50cda0=null;var _0x1f1c46=_0x106cfc['dialTimezone'];if(_[_0xb4a7('0x2b')](_0x106cfc['dialGlobalInterval'])||_[_0xb4a7('0x2b')](_0x106cfc[_0xb4a7('0x2c')])||_[_0xb4a7('0x2b')](_0x106cfc[_0xb4a7('0x2c')][_0xb4a7('0x2d')])){_0x50cda0=CAMPAIGN_STATUS[_0xb4a7('0x2e')];}else if(_[_0xb4a7('0x2f')](_0x106cfc['dialGlobalInterval'])||_['isEmpty'](_0x106cfc[_0xb4a7('0x2c')]['Intervals'])){_0x50cda0=CAMPAIGN_STATUS[_0xb4a7('0x30')];}else if(_0x1f1c46&&!timezones[_0x1f1c46]){_0x50cda0=CAMPAIGN_STATUS[_0xb4a7('0x31')];}return _0x50cda0;}function checkAnyValidTrunk(_0x2a18ff,_0x1a4669){var _0x1d5e8f=null;var _0x3a0ac3=_0xb4a7('0x32');var _0x5d8d6d=[_0xb4a7('0x33'),_0xb4a7('0x34')];var _0x1a41ab=!![];if(_0x2a18ff[_0xb4a7('0x29')]&&_0x2a18ff[_0xb4a7('0x29')][_0xb4a7('0x1a')]){_0x3a0ac3+=_0x2a18ff[_0xb4a7('0x29')][_0xb4a7('0x2a')];_0x1d5e8f=_0x1a4669[_0x3a0ac3];_0x1a41ab=_0x5d8d6d[_0xb4a7('0x35')](_0x1d5e8f['status']);}else if(_0x2a18ff[_0xb4a7('0x36')]&&_0x2a18ff[_0xb4a7('0x36')][_0xb4a7('0x1a')]){_0x3a0ac3+=_0x2a18ff[_0xb4a7('0x36')][_0xb4a7('0x2a')];_0x1d5e8f=_0x1a4669[_0x3a0ac3];_0x1a41ab=_0x5d8d6d[_0xb4a7('0x35')](_0x1d5e8f['status']);}return _0x1a41ab;}function getQueueCampaignStatusMessage(_0x110af6,_0x4186d2){var _0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x6')];var _0x8a4284=isPreviewCampaign(_0x110af6);if(!isQueueCampaignActive(_0x110af6)){if(_0x8a4284){_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x37')];}else{if(_0x110af6[_0xb4a7('0x28')]===0x0&&_0x110af6[_0xb4a7('0x38')]===0x0&&_0x110af6[_0xb4a7('0x26')]===0x0&&(_0x110af6['pTalking']||0x0)===0x0){_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x37')];}else{_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x39')];}}}else if(_0x110af6['loggedIn']===0x0){_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x3a')];}else if(!checkAnyValidTrunk(_0x110af6,_0x4186d2)){_0xc5bebb=CAMPAIGN_STATUS[_0xb4a7('0x3b')];}else if(!isPreviewCampaign(_0x110af6)){var _0x170d94=checkAnyValidQueueCampaignInterval(_0x110af6);if(_0x170d94){_0xc5bebb=_0x170d94;}}return _0xc5bebb;}exports[_0xb4a7('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x11db7d){var _0x339172=CAMPAIGN_STATUS[_0xb4a7('0x39')];if(_0x11db7d[_0xb4a7('0x28')]===0x0&&_0x11db7d[_0xb4a7('0x38')]===0x0&&_0x11db7d['waiting']===0x0&&(_0x11db7d[_0xb4a7('0x25')]||0x0)===0x0){_0x339172=CAMPAIGN_STATUS[_0xb4a7('0x37')];}return _0x339172;}exports[_0xb4a7('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4c0ec3){var _0x5b4f7d=_0x4c0ec3[_0xb4a7('0x3e')](/"(.*?)"/);return _0x5b4f7d?_0x5b4f7d[0x1]:_0x4c0ec3;}exports[_0xb4a7('0x3f')]=extractCalleridName;function getCallerId(_0x831c47,_0x34ca9d,_0xa16fd8){if(!_['isUndefined'](_0xa16fd8)&&typeof _0xa16fd8===_0xb4a7('0x40')&&!_['isEmpty'](_0xa16fd8)){if(!_[_0xb4a7('0x41')](_0x34ca9d)&&typeof _0x34ca9d===_0xb4a7('0x40')&&!_[_0xb4a7('0x2f')](_0x34ca9d)){return util[_0xb4a7('0x42')]('\x22%s\x22\x20<%s>',_0x34ca9d,_0xa16fd8);}return util['format']('\x22%s\x22\x20<%s>',_0xa16fd8,_0xa16fd8);}if(!_[_0xb4a7('0x41')](_0x831c47)&&typeof _0x831c47==='string'&&!_[_0xb4a7('0x2f')](_0x831c47)){return _0x831c47;}return _0xb4a7('0x43');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x407646,_0x30126f){var _0x188489;var _0x3b0d18;var _0x5657eb;if(_0x30126f<=0x0){_0x30126f=0x1;}_0x188489=new RegExp(_0xb4a7('0x44')+_0x30126f+'}$');_0x3b0d18=Math[_0xb4a7('0x45')](0xa,_0x30126f-0x1);_0x5657eb=Math['pow'](0xa,_0x30126f)-0x1;return util[_0xb4a7('0x42')]('%s',_[_0xb4a7('0x46')](_0x407646,_0x188489,_[_0xb4a7('0x47')](_0x3b0d18,_0x5657eb)[_0xb4a7('0x48')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0xc01531){if(_0xc01531[_0xb4a7('0x28')]&&_0xc01531['originated']>0x0){_0xc01531[_0xb4a7('0x28')]-=0x1;}else{logger[_0xb4a7('0x49')](_0xb4a7('0x4a'));}}exports[_0xb4a7('0x4b')]=decrementOriginate;function checkContactEmpty(_0x171627){return _0x171627&&_0x171627['length']>0x0;}exports[_0xb4a7('0x4c')]=checkContactEmpty;function erlangb(_0x13663f,_0x59ecad){if(_0x59ecad===0x0){return 0x0;}var _0x278364=0x1;for(var _0x307681=0x1;_0x307681<=_0x59ecad;_0x307681+=0x1){_0x278364=0x1+_0x278364*_0x307681/_0x13663f;}return 0x1/_0x278364;}exports[_0xb4a7('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x53b67e,_0x4c6211,_0xce5835){if(_0x4c6211>_0xce5835){for(var _0x16bea7=0x0;_0x16bea7<_0x4c6211-_0xce5835;_0x16bea7+=0x1){decrementOriginate(_0x53b67e);}}}exports[_0xb4a7('0x4e')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0xb4dc=['message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','ACTIVE','INACTIVE','DISACTIVED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xb4dc,0x1e0));var _0xcb4d=function(_0x2d9e90,_0x5dcc72){_0x2d9e90=_0x2d9e90-0x0;var _0x54695f=_0xb4dc[_0x2d9e90];return _0x54695f;};'use strict';var _=require(_0xcb4d('0x0'));var moment=require('moment');var util=require(_0xcb4d('0x1'));var logger=require(_0xcb4d('0x2'))(_0xcb4d('0x3'));var timezones=require(_0xcb4d('0x4'))[_0xcb4d('0x5')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xcb4d('0x6'),'CONTACTS_RESCHEDULED':_0xcb4d('0x7'),'DEACTIVATED':_0xcb4d('0x8'),'DISACTIVED':_0xcb4d('0x9'),'EMPTY_INTERVAL':_0xcb4d('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xcb4d('0xb'),'NO_AVAILABLE_CONTACTS':_0xcb4d('0xc'),'NULL_INTERVAL':_0xcb4d('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xcb4d('0xe'),'QUEUE_RECALL':_0xcb4d('0xf'),'RECALL_TIMEOUT':_0xcb4d('0x10'),'RUNNING':_0xcb4d('0x11'),'UNKNOWN_TIMEZONE':_0xcb4d('0x12'),'UNREACHABLE_TRUNK':_0xcb4d('0x13')};exports[_0xcb4d('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0xabe50d){return _0xabe50d[_0xcb4d('0x15')]===_0xcb4d('0x16');}exports[_0xcb4d('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x151625){return _0x151625[_0xcb4d('0x18')]===_0xcb4d('0x19');}exports[_0xcb4d('0x1a')]=isIVRCampaign;function isOutboundQueue(_0x4bae1d){return _0x4bae1d[_0xcb4d('0x18')]===_0xcb4d('0x1b');}exports[_0xcb4d('0x1c')]=isOutboundQueue;function isQueueCampaignActive(_0x54ef23){return _0x54ef23[_0xcb4d('0x1d')];}exports[_0xcb4d('0x1e')]=isQueueCampaignActive;function isIVRCampaignActive(_0x57414f){return _0x57414f[_0xcb4d('0x1f')];}exports[_0xcb4d('0x20')]=isIVRCampaignActive;function getSeconds(_0x27e22b,_0x401beb){var _0x5319f2=moment(_0x27e22b)[_0xcb4d('0x21')](0x0);var _0x39852d=moment(_0x401beb)[_0xcb4d('0x21')](0x0);return _0x5319f2['diff'](_0x39852d,_0xcb4d('0x22'));}exports[_0xcb4d('0x23')]=getSeconds;function hasQueueCampaignDataChanged(_0x73a949,_0x4711b0){var _0x5d2e25=![];var _0x313e47=_0x73a949[_0xcb4d('0x15')]!==_0x4711b0[_0xcb4d('0x15')]||_0x73a949[_0xcb4d('0x1d')]!==_0x4711b0['dialActive']||_0x73a949[_0xcb4d('0x24')]!==_0x4711b0[_0xcb4d('0x24')];var _0x653e9f=_0x73a949[_0xcb4d('0x25')]!==_0x4711b0['available']||_0x73a949[_0xcb4d('0x26')]!==_0x4711b0[_0xcb4d('0x26')]||_0x73a949['loggedInDb']!==_0x4711b0[_0xcb4d('0x27')]||_0x73a949['paused']!==_0x4711b0[_0xcb4d('0x28')]||_0x73a949[_0xcb4d('0x29')]!==_0x4711b0['talking']||_0x73a949[_0xcb4d('0x2a')]!==_0x4711b0[_0xcb4d('0x2a')]||_0x73a949[_0xcb4d('0x2b')]!==_0x4711b0['waiting']||_0x73a949['inUse']!==_0x4711b0[_0xcb4d('0x2c')]||_0x73a949[_0xcb4d('0x2d')]!==_0x4711b0[_0xcb4d('0x2d')];if(_0x73a949[_0xcb4d('0x2e')]&&_0x4711b0['Trunk']){_0x5d2e25=_0x73a949[_0xcb4d('0x2e')][_0xcb4d('0x2f')]!==_0x4711b0[_0xcb4d('0x2e')]['name']||_0x73a949[_0xcb4d('0x2e')][_0xcb4d('0x1f')]!==_0x4711b0[_0xcb4d('0x2e')]['active'];}return _0x313e47||_0x653e9f||_0x5d2e25;}exports[_0xcb4d('0x30')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x5a2457){var _0x48da13=null;var _0x4a3a26=_0x5a2457[_0xcb4d('0x31')];if(_['isNil'](_0x5a2457[_0xcb4d('0x32')])||_['isNil'](_0x5a2457['Interval'])||_[_0xcb4d('0x33')](_0x5a2457[_0xcb4d('0x34')][_0xcb4d('0x35')])){_0x48da13=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x5a2457[_0xcb4d('0x32')])||_['isEmpty'](_0x5a2457[_0xcb4d('0x34')][_0xcb4d('0x35')])){_0x48da13=CAMPAIGN_STATUS[_0xcb4d('0x36')];}else if(_0x4a3a26&&!timezones[_0x4a3a26]){_0x48da13=CAMPAIGN_STATUS[_0xcb4d('0x37')];}return _0x48da13;}function checkAnyValidTrunk(_0xae160,_0x28c738){var _0x29c444=null;var _0x3081e2=_0xcb4d('0x38');var _0x4647f6=[_0xcb4d('0x39'),_0xcb4d('0x3a')];var _0x29be5e=!![];if(_0xae160[_0xcb4d('0x2e')]&&_0xae160[_0xcb4d('0x2e')][_0xcb4d('0x1f')]){_0x3081e2+=_0xae160[_0xcb4d('0x2e')][_0xcb4d('0x2f')];_0x29c444=_0x28c738[_0x3081e2];_0x29be5e=_0x4647f6[_0xcb4d('0x3b')](_0x29c444[_0xcb4d('0x3c')]);}else if(_0xae160[_0xcb4d('0x3d')]&&_0xae160[_0xcb4d('0x3d')][_0xcb4d('0x1f')]){_0x3081e2+=_0xae160[_0xcb4d('0x3d')][_0xcb4d('0x2f')];_0x29c444=_0x28c738[_0x3081e2];_0x29be5e=_0x4647f6['includes'](_0x29c444['status']);}return _0x29be5e;}function getQueueCampaignStatusMessage(_0x3b87b1,_0x1654db){var _0x202b65=CAMPAIGN_STATUS[_0xcb4d('0x3e')];var _0x4aa9ce=isPreviewCampaign(_0x3b87b1);if(!isQueueCampaignActive(_0x3b87b1)){if(_0x4aa9ce){_0x202b65=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3b87b1[_0xcb4d('0x2d')]===0x0&&_0x3b87b1[_0xcb4d('0x29')]===0x0&&_0x3b87b1[_0xcb4d('0x2b')]===0x0&&(_0x3b87b1[_0xcb4d('0x2a')]||0x0)===0x0){_0x202b65=CAMPAIGN_STATUS[_0xcb4d('0x3f')];}else{_0x202b65=CAMPAIGN_STATUS[_0xcb4d('0x40')];}}}else if(_0x3b87b1[_0xcb4d('0x26')]===0x0){_0x202b65=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x3b87b1,_0x1654db)){_0x202b65=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x3b87b1)){var _0x497921=checkAnyValidQueueCampaignInterval(_0x3b87b1);if(_0x497921){_0x202b65=_0x497921;}}return _0x202b65;}exports[_0xcb4d('0x41')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x19c201){var _0x1b52e3=CAMPAIGN_STATUS['DISACTIVED'];if(_0x19c201[_0xcb4d('0x2d')]===0x0&&_0x19c201[_0xcb4d('0x29')]===0x0&&_0x19c201[_0xcb4d('0x2b')]===0x0&&(_0x19c201[_0xcb4d('0x2a')]||0x0)===0x0){_0x1b52e3=CAMPAIGN_STATUS[_0xcb4d('0x3f')];}return _0x1b52e3;}exports[_0xcb4d('0x42')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2e2142){var _0x2a8765=_0x2e2142[_0xcb4d('0x43')](/"(.*?)"/);return _0x2a8765?_0x2a8765[0x1]:_0x2e2142;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x3d2f71,_0x3caa89,_0x17544b){if(!_[_0xcb4d('0x44')](_0x17544b)&&typeof _0x17544b===_0xcb4d('0x45')&&!_['isEmpty'](_0x17544b)){if(!_[_0xcb4d('0x44')](_0x3caa89)&&typeof _0x3caa89===_0xcb4d('0x45')&&!_[_0xcb4d('0x46')](_0x3caa89)){return util[_0xcb4d('0x47')](_0xcb4d('0x48'),_0x3caa89,_0x17544b);}return util[_0xcb4d('0x47')]('\x22%s\x22\x20<%s>',_0x17544b,_0x17544b);}if(!_[_0xcb4d('0x44')](_0x3d2f71)&&typeof _0x3d2f71===_0xcb4d('0x45')&&!_[_0xcb4d('0x46')](_0x3d2f71)){return _0x3d2f71;}return _0xcb4d('0x49');}exports[_0xcb4d('0x4a')]=getCallerId;function getCallerIdRandom(_0xc9f468,_0x25708a){var _0x172e24;var _0x125e4f;var _0x1329c3;if(_0x25708a<=0x0){_0x25708a=0x1;}_0x172e24=new RegExp(_0xcb4d('0x4b')+_0x25708a+'}$');_0x125e4f=Math[_0xcb4d('0x4c')](0xa,_0x25708a-0x1);_0x1329c3=Math['pow'](0xa,_0x25708a)-0x1;return util[_0xcb4d('0x47')]('%s',_[_0xcb4d('0x4d')](_0xc9f468,_0x172e24,_[_0xcb4d('0x4e')](_0x125e4f,_0x1329c3)[_0xcb4d('0x4f')]()));}exports[_0xcb4d('0x50')]=getCallerIdRandom;function decrementOriginate(_0x116e76){if(_0x116e76[_0xcb4d('0x2d')]&&_0x116e76['originated']>0x0){_0x116e76[_0xcb4d('0x2d')]-=0x1;}else{logger[_0xcb4d('0x51')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xcb4d('0x52')]=decrementOriginate;function checkContactEmpty(_0xc0b36b){return _0xc0b36b&&_0xc0b36b[_0xcb4d('0x53')]>0x0;}exports[_0xcb4d('0x54')]=checkContactEmpty;function erlangb(_0x60bf4b,_0x437e5b){if(_0x437e5b===0x0){return 0x0;}var _0x58b439=0x1;for(var _0x196e03=0x1;_0x196e03<=_0x437e5b;_0x196e03+=0x1){_0x58b439=0x1+_0x58b439*_0x196e03/_0x60bf4b;}return 0x1/_0x58b439;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x3d335f,_0x455c54,_0x11ad2a){if(_0x455c54>_0x11ad2a){for(var _0x3b5c47=0x0;_0x3b5c47<_0x455c54-_0x11ad2a;_0x3b5c47+=0x1){decrementOriginate(_0x3d335f);}}}exports[_0xcb4d('0x55')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 4be44ea..e0d541a 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(_0x29d7fe,_0x80a093){var _0x20c127=function(_0x2ca2ef){while(--_0x2ca2ef){_0x29d7fe['push'](_0x29d7fe['shift']());}};_0x20c127(++_0x80a093);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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(_0x426d94,_0x3791d6){var _0x2a6771=function(_0x52cdb3){while(--_0x52cdb3){_0x426d94['push'](_0x426d94['shift']());}};_0x2a6771(++_0x3791d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 4cc24a7..a4ac726 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 _0x57df=['originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','fax','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup'];(function(_0x251646,_0x547f01){var _0x514c78=function(_0x232293){while(--_0x232293){_0x251646['push'](_0x251646['shift']());}};_0x514c78(++_0x547f01);}(_0x57df,0xd4));var _0xf57d=function(_0x3d7087,_0x26ab40){_0x3d7087=_0x3d7087-0x0;var _0x21d7c0=_0x57df[_0x3d7087];return _0x21d7c0;};'use strict';var util=require(_0xf57d('0x0'));var _=require('lodash');var BPromise=require(_0xf57d('0x1'));var uuid=require('uuid');var moment=require(_0xf57d('0x2'));var path=require(_0xf57d('0x3'));var tiff2pdf=require(_0xf57d('0x4'));var gs=require(_0xf57d('0x5'));var logger=require('../../../config/logger')('fax');var ami=require(_0xf57d('0x6'));var rpcDb=require(_0xf57d('0x7'));var Channel=require(_0xf57d('0x8'));var ut=require(_0xf57d('0x9'));var Action=require(_0xf57d('0xa'));var faxAccount=require(_0xf57d('0xb'));var attachment=require(_0xf57d('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x17ce6c){this[_0xf57d('0xd')]={};this[_0xf57d('0xe')]=_0x17ce6c[_0xf57d('0xe')];this['trunks']=_0x17ce6c[_0xf57d('0xf')];this[_0xf57d('0x10')]={};ami['on'](_0xf57d('0x11'),this[_0xf57d('0x12')][_0xf57d('0x13')](this));ami['on']('varset',this[_0xf57d('0x14')][_0xf57d('0x13')](this));ami['on'](_0xf57d('0x15'),this[_0xf57d('0x16')][_0xf57d('0x13')](this));ami['on'](_0xf57d('0x17'),this[_0xf57d('0x18')][_0xf57d('0x13')](this));ami['on'](_0xf57d('0x19'),this[_0xf57d('0x1a')]['bind'](this));ami['on'](_0xf57d('0x1b'),this[_0xf57d('0x1c')][_0xf57d('0x13')](this));ami['on'](_0xf57d('0x1d'),this['syncHangup']['bind'](this));ami['on'](_0xf57d('0x1e'),this[_0xf57d('0x1f')][_0xf57d('0x13')](this));}Fax[_0xf57d('0x20')]['syncNewchannel']=function(_0x497608){if(_0x497608[_0xf57d('0x21')]===_0xf57d('0x22')){for(var _0x5971d3 in this[_0xf57d('0xe')]){if(this['faxAccounts']['hasOwnProperty'](_0x5971d3)){if(_0x497608[_0xf57d('0x23')]===this[_0xf57d('0xe')][_0x5971d3][_0xf57d('0x24')]){this['channels'][_0x497608[_0xf57d('0x25')]]={};this[_0xf57d('0xd')][_0x497608[_0xf57d('0x25')]][_0xf57d('0x26')]=_0x497608[_0xf57d('0x26')];this['channels'][_0x497608[_0xf57d('0x25')]]['id']=this[_0xf57d('0xe')][_0x5971d3]['id'];this['channels'][_0x497608[_0xf57d('0x25')]][_0xf57d('0x27')]=this[_0xf57d('0xe')][_0x5971d3][_0xf57d('0x27')];logger[_0xf57d('0x28')](_0x497608[_0xf57d('0x25')],_0xf57d('0x29'));}}}}if(this['actions'][_0x497608[_0xf57d('0x25')]]){this[_0xf57d('0xd')][_0x497608['uniqueid']]={};this[_0xf57d('0xd')][_0x497608[_0xf57d('0x25')]]['channel']=_0x497608[_0xf57d('0x26')];logger[_0xf57d('0x28')](_0x497608[_0xf57d('0x25')],'\x20syncNewchannel\x20');}};Fax[_0xf57d('0x20')][_0xf57d('0x14')]=function(_0x376cf0){if(this[_0xf57d('0xd')][_0x376cf0['uniqueid']]){for(var _0x1a1bac in _0x376cf0['variable']){if(_0x376cf0[_0xf57d('0x2a')]['hasOwnProperty'](_0x1a1bac)){this[_0xf57d('0xd')][_0x376cf0['uniqueid']][_0x1a1bac]=_0x376cf0[_0xf57d('0x2b')];}}}};Fax['prototype'][_0xf57d('0x16')]=function(_0x466bb7){if(this[_0xf57d('0xd')][_0x466bb7[_0xf57d('0x25')]]){this[_0xf57d('0xd')][_0x466bb7[_0xf57d('0x25')]][_0xf57d('0x2c')]=_0x466bb7[_0xf57d('0x2c')];this[_0xf57d('0xd')][_0x466bb7[_0xf57d('0x25')]][_0xf57d('0x2d')]=_0x466bb7['channelstatedesc'];}};Fax[_0xf57d('0x20')][_0xf57d('0x18')]=function(_0x5c7deb){if(this[_0xf57d('0xd')][_0x5c7deb[_0xf57d('0x25')]]){for(var _0x537d8a in _0x5c7deb[_0xf57d('0x2a')]){if(_0x5c7deb['variable'][_0xf57d('0x2e')](_0x537d8a)){this['channels'][_0x5c7deb[_0xf57d('0x25')]][_0x537d8a]=_0x5c7deb['value'];}}}};Fax[_0xf57d('0x20')][_0xf57d('0x1a')]=function(_0x3418b6){if(this['channels'][_0x3418b6['uniqueid']]){this[_0xf57d('0xd')][_0x3418b6[_0xf57d('0x25')]][_0xf57d('0x2f')]=_0x3418b6['operation'];this[_0xf57d('0xd')][_0x3418b6[_0xf57d('0x25')]][_0xf57d('0x30')]=_0x3418b6[_0xf57d('0x30')];this[_0xf57d('0xd')][_0x3418b6[_0xf57d('0x25')]][_0xf57d('0x24')]=_0x3418b6[_0xf57d('0x24')];this[_0xf57d('0xd')][_0x3418b6[_0xf57d('0x25')]][_0xf57d('0x31')]=_0x3418b6[_0xf57d('0x31')];logger[_0xf57d('0x28')](_0x3418b6[_0xf57d('0x25')],_0xf57d('0x32'));}};Fax[_0xf57d('0x20')]['syncReceiveFax']=function(_0x4d38a0){var _0x573a21=this;if(this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]]){var _0x54394a=this[_0xf57d('0xd')][_0x4d38a0['uniqueid']]['id'];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]]['remotestationid']=_0x4d38a0[_0xf57d('0x33')];this['channels'][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x34')]=_0x4d38a0[_0xf57d('0x34')];this['channels'][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x24')]=_0x4d38a0[_0xf57d('0x24')];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x35')]=_0x4d38a0[_0xf57d('0x35')];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x36')]=_0x4d38a0[_0xf57d('0x36')];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x31')]=_0x4d38a0['filename'];this[_0xf57d('0xd')][_0x4d38a0[_0xf57d('0x25')]]['calleridnum']=_0x4d38a0[_0xf57d('0x37')];if(this['channels'][_0x4d38a0[_0xf57d('0x25')]][_0xf57d('0x34')]>0x0){tiff2pdf(_0x4d38a0[_0xf57d('0x31')],_0xf57d('0x38'),function(_0x9b8fed){logger['info'](_0x4d38a0[_0xf57d('0x25')],'\x20result\x20conversion\x20file\x20',_0x9b8fed[_0xf57d('0x39')]);attachment[_0xf57d('0x3a')]({'name':path['parse'](_0x4d38a0[_0xf57d('0x31')])[_0xf57d('0x27')],'basename':path[_0xf57d('0x3b')](_0x4d38a0['filename'])['name']+'.pdf','type':_0xf57d('0x3c')})[_0xf57d('0x3d')](function(_0x57b686){faxAccount[_0xf57d('0x3e')](_0x54394a,{'from':_0x4d38a0[_0xf57d('0x37')],'mapKey':'fax','body':path[_0xf57d('0x3b')](_0x4d38a0[_0xf57d('0x31')])[_0xf57d('0x27')]+_0xf57d('0x3f'),'AttachmentId':_0x57b686['id']})[_0xf57d('0x40')](function(_0x4267d9){logger[_0xf57d('0x41')](_0x4d38a0['uniqueid'],_0xf57d('0x42'),JSON[_0xf57d('0x43')](_0x4267d9));});})[_0xf57d('0x40')](function(_0x56697d){logger['error'](_0x4d38a0['uniqueid'],_0xf57d('0x44'),JSON[_0xf57d('0x43')](_0x56697d));});});}logger[_0xf57d('0x28')](_0x4d38a0[_0xf57d('0x25')],_0xf57d('0x44'));}};Fax[_0xf57d('0x20')][_0xf57d('0x1f')]=function(_0x293d98){if(this['actions'][_0x293d98[_0xf57d('0x25')]]){_[_0xf57d('0x45')](this[_0xf57d('0xd')][_0x293d98[_0xf57d('0x25')]],_[_0xf57d('0x46')](_0x293d98,[_0xf57d('0x47'),_0xf57d('0x48')]));}};function updateStatus(_0xc10cbb){if(_0xc10cbb[_0xf57d('0x49')]){faxMessage['update'](_0xc10cbb[_0xf57d('0x49')],{'failMessage':_0xf57d('0x4a')})[_0xf57d('0x3d')](function(_0x1bfc95){ut[_0xf57d('0x4b')](_0xf57d('0x4c'),_0x1bfc95);})[_0xf57d('0x40')](function(_0x216448){ut[_0xf57d('0x4b')](_0xf57d('0x4d'),_0x216448);});}else{ut[_0xf57d('0x4b')](_0xf57d('0x4e'));}}Fax[_0xf57d('0x20')][_0xf57d('0x4f')]=function(_0xe591c2,_0x4a2384,_0x4f6cab){var _0x365a19=this;var _0x5723eb={};if(_0x4a2384){_0x5723eb={'read':_0x4a2384};}else{_0x5723eb={'failMessage':_0x4f6cab};}if(this['actions'][_0xe591c2][_0xf57d('0x49')]){faxMessage[_0xf57d('0x50')](this[_0xf57d('0x10')][_0xe591c2]['AttachmentId'],_0x5723eb)[_0xf57d('0x3d')](function(_0x481a56){ut[_0xf57d('0x4b')]('[Fax][Message][Updated]',_0x481a56);})[_0xf57d('0x40')](function(_0x1f9c65){ut[_0xf57d('0x4b')]('[Fax][Message][NoUpdate1]',_0x1f9c65);})['finally'](function(){delete _0x365a19[_0xf57d('0xd')][_0xe591c2];delete _0x365a19['actions'][_0xe591c2];});}else{ut['logger'](_0xf57d('0x51'));delete this['channels'][_0xe591c2];delete this[_0xf57d('0x10')][_0xe591c2];}};Fax['prototype'][_0xf57d('0x52')]=function(_0x2a3144){var _0x499de0=this;if(this['channels'][_0x2a3144[_0xf57d('0x25')]]){if(this[_0xf57d('0x10')][_0x2a3144[_0xf57d('0x25')]]){this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]]['id']=this[_0xf57d('0x10')][_0x2a3144['uniqueid']]['id'];this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x27')]=this[_0xf57d('0x10')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x27')];}logger[_0xf57d('0x28')](_0x2a3144[_0xf57d('0x25')],this[_0xf57d('0x10')][_0x2a3144[_0xf57d('0x25')]]?_0xf57d('0x53'):_0xf57d('0x54'),JSON[_0xf57d('0x43')](this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]]));if(this[_0xf57d('0x10')][_0x2a3144['uniqueid']]){if(this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x55')]>0x0&&this['channels'][_0x2a3144['uniqueid']]['faxstatus']==='SUCCESS'){this[_0xf57d('0x4f')](_0x2a3144[_0xf57d('0x25')],!![]);}else{this[_0xf57d('0x4f')](_0x2a3144[_0xf57d('0x25')],![],this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x56')]?'SENDING\x20FAILED:\x20'+this[_0xf57d('0xd')][_0x2a3144[_0xf57d('0x25')]][_0xf57d('0x56')]:'SENDING\x20FAILED');}}}};Fax[_0xf57d('0x20')][_0xf57d('0x57')]=function(_0x59bbb2){var _0x4dd4cf=this;return new BPromise(function(_0x5232aa,_0x1ebf2f){_0x4dd4cf[_0xf57d('0x58')](_0x59bbb2,_0x4dd4cf[_0xf57d('0xe')][_0x59bbb2[_0xf57d('0x59')]])[_0xf57d('0x3d')](function(_0x9fca0a){ut[_0xf57d('0x4b')]('[Fax][execOriginate][success]',_0x9fca0a);_0x5232aa(ut[_0xf57d('0x39')](_0xf57d('0x5a')));})[_0xf57d('0x40')](function(_0x9112b5){ut[_0xf57d('0x4b')](_0xf57d('0x5b'),_0x9112b5);updateStatus(_0x59bbb2);_0x1ebf2f(ut[_0xf57d('0x39')](_0xf57d('0x5c')));});});};Fax['prototype'][_0xf57d('0x5d')]=function(_0x11b8bd){var _0x2e7b2f=this;return new BPromise(function(_0xe1cac2,_0x3283e1){var _0x3f4f7d=_0x2e7b2f[_0xf57d('0x5e')](_0x2e7b2f[_0xf57d('0xe')][_0x11b8bd[_0xf57d('0x59')]][_0xf57d('0x5f')],_0x11b8bd);if(_0x3f4f7d['isValid']){_0xe1cac2(ut[_0xf57d('0x39')](_0xf57d('0x60')));}else{_0x3283e1(ut[_0xf57d('0x39')](_0x3f4f7d[_0xf57d('0x39')]));}});};function originate(_0x2d144d,_0xc433c3,_0x54e0d1){return new BPromise(function(_0xb18458,_0x208a6d){if(_0x54e0d1){var _0x2f164b=util[_0xf57d('0x61')](_0xf57d('0x62'),path[_0xf57d('0x3b')](_0x2d144d[_0xf57d('0x3')])['name'],_0x2d144d[_0xf57d('0x3')]);gs[_0xf57d('0x63')](_0x2f164b)[_0xf57d('0x3d')](function(){_0x2d144d['path']=util[_0xf57d('0x61')](_0xf57d('0x64'),path[_0xf57d('0x3b')](_0x2d144d['path'])['dir'],path['parse'](_0x2d144d['path'])[_0xf57d('0x27')]);_0xc433c3[_0xf57d('0x65')]=_0x2d144d[_0xf57d('0x3')];ut[_0xf57d('0x4b')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0xf57d('0x66')](_0x2d144d,_0xc433c3))[_0xf57d('0x3d')](function(_0x3c113b){_0xb18458(_0x3c113b);})['catch'](function(_0x4fa15d){_0x208a6d(_0x4fa15d);});})['catch'](function(_0x3e4c6f){_0x208a6d(_0x3e4c6f);});}else{ami['Action'](ut[_0xf57d('0x66')](_0x2d144d,_0xc433c3))['then'](function(_0x2449f2){_0xb18458(_0x2449f2);})['catch'](function(_0x326a24){_0x208a6d(_0x326a24);});}});}Fax[_0xf57d('0x20')]['execOriginate']=function(_0x3878e2,_0x155030){var _0x409466=this;return new BPromise(function(_0x1c423c,_0x245ea1){var _0x3343bb=uuid['v4']();var _0x10fbc7=ut[_0xf57d('0x67')](_0x3878e2,_0x155030);_0x409466[_0xf57d('0x10')][_0x3343bb]=new Action(_0x3343bb,_0x155030,_0x3878e2);var _0x29d908=_0x409466[_0xf57d('0x10')][_0x3343bb];if(path[_0xf57d('0x3b')](_0x3878e2[_0xf57d('0x3')])[_0xf57d('0x68')]===_0xf57d('0x3f')){originate(_0x29d908,_0x10fbc7,!![])['then'](function(_0x1a6edd){_0x1c423c(_0x1a6edd);})[_0xf57d('0x40')](function(_0x4029bc){_0x245ea1(_0x4029bc);});}else{originate(_0x29d908,_0x10fbc7,![])[_0xf57d('0x3d')](function(_0x2c50e5){_0x1c423c(_0x2c50e5);})[_0xf57d('0x40')](function(_0xbcf780){_0x245ea1(_0xbcf780);});}});};Fax[_0xf57d('0x20')][_0xf57d('0x69')]=function(_0x14f343){return!_[_0xf57d('0x6a')](_0x14f343)&&!_['isNil'](_0x14f343[_0xf57d('0x27')])&&!_['isNil'](_0x14f343[_0xf57d('0x6b')])&&_0x14f343[_0xf57d('0x6b')]&&!_[_0xf57d('0x6a')](this[_0xf57d('0xf')][util[_0xf57d('0x61')]('SIP/%s',_0x14f343[_0xf57d('0x27')])])&&!_['isNil'](this[_0xf57d('0xf')][util[_0xf57d('0x61')]('SIP/%s',_0x14f343[_0xf57d('0x27')])][_0xf57d('0x30')])&&(this[_0xf57d('0xf')][util[_0xf57d('0x61')](_0xf57d('0x6c'),_0x14f343[_0xf57d('0x27')])][_0xf57d('0x30')]===_0xf57d('0x6d')||this[_0xf57d('0xf')][util['format']('SIP/%s',_0x14f343[_0xf57d('0x27')])]['status']===_0xf57d('0x6e'));};Fax['prototype']['checkTrunk']=function(_0x4c3e80,_0xf4fd66){if(!this[_0xf57d('0x69')](_0x4c3e80)){ut[_0xf57d('0x4b')](_0xf57d('0x6f'),_[_0xf57d('0x6a')](_0x4c3e80)?'':_0x4c3e80['name']+_0xf57d('0x70'));return{'isValid':![],'message':_0xf57d('0x71')};}if(_[_0xf57d('0x6a')](_0xf4fd66[_0xf57d('0x72')])){ut[_0xf57d('0x4b')](_0xf57d('0x73'),JSON['stringify'](_0xf4fd66));return{'isValid':![],'message':_0xf57d('0x74')};}if(_[_0xf57d('0x6a')](_0xf4fd66[_0xf57d('0x3')])){ut[_0xf57d('0x4b')](_0xf57d('0x75'),JSON['stringify'](_0xf4fd66));return{'isValid':![],'message':_0xf57d('0x76')};}return{'isValid':!![],'message':_0xf57d('0x77')};};module[_0xf57d('0x78')]=Fax; \ No newline at end of file +var _0x2722=['checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newexten','syncNewExten','faxstatus','syncReceiveFax','hangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','syncNewState','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','error','stringify','catch','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','FaxAccountId','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable'];(function(_0x3a5131,_0x2d38b4){var _0x2c932d=function(_0x54c276){while(--_0x54c276){_0x3a5131['push'](_0x3a5131['shift']());}};_0x2c932d(++_0x2d38b4);}(_0x2722,0x15b));var _0x2272=function(_0x4e944f,_0x3e8b6e){_0x4e944f=_0x4e944f-0x0;var _0x399d39=_0x2722[_0x4e944f];return _0x399d39;};'use strict';var util=require(_0x2272('0x0'));var _=require(_0x2272('0x1'));var BPromise=require(_0x2272('0x2'));var uuid=require(_0x2272('0x3'));var moment=require('moment');var path=require(_0x2272('0x4'));var tiff2pdf=require(_0x2272('0x5'));var gs=require(_0x2272('0x6'));var logger=require(_0x2272('0x7'))(_0x2272('0x8'));var ami=require(_0x2272('0x9'));var rpcDb=require(_0x2272('0xa'));var Channel=require('./channel');var ut=require(_0x2272('0xb'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x2272('0xc'));var faxMessage=require(_0x2272('0xd'));function Fax(_0x3ba720){this[_0x2272('0xe')]={};this[_0x2272('0xf')]=_0x3ba720['faxAccounts'];this[_0x2272('0x10')]=_0x3ba720['trunks'];this[_0x2272('0x11')]={};ami['on'](_0x2272('0x12'),this['syncNewchannel'][_0x2272('0x13')](this));ami['on'](_0x2272('0x14'),this[_0x2272('0x15')][_0x2272('0x13')](this));ami['on']('newstate',this['syncNewState'][_0x2272('0x13')](this));ami['on'](_0x2272('0x16'),this[_0x2272('0x17')][_0x2272('0x13')](this));ami['on'](_0x2272('0x18'),this['syncFaxStatus'][_0x2272('0x13')](this));ami['on']('receivefax',this[_0x2272('0x19')]['bind'](this));ami['on'](_0x2272('0x1a'),this['syncHangup']['bind'](this));ami['on']('originateresponse',this[_0x2272('0x1b')][_0x2272('0x13')](this));}Fax['prototype'][_0x2272('0x1c')]=function(_0x408370){if(_0x408370[_0x2272('0x1d')]===_0x2272('0x1e')){for(var _0x31621d in this['faxAccounts']){if(this[_0x2272('0xf')][_0x2272('0x1f')](_0x31621d)){if(_0x408370[_0x2272('0x20')]===this[_0x2272('0xf')][_0x31621d][_0x2272('0x21')]){this[_0x2272('0xe')][_0x408370[_0x2272('0x22')]]={};this[_0x2272('0xe')][_0x408370[_0x2272('0x22')]][_0x2272('0x23')]=_0x408370[_0x2272('0x23')];this[_0x2272('0xe')][_0x408370[_0x2272('0x22')]]['id']=this[_0x2272('0xf')][_0x31621d]['id'];this[_0x2272('0xe')][_0x408370[_0x2272('0x22')]]['name']=this[_0x2272('0xf')][_0x31621d][_0x2272('0x24')];logger[_0x2272('0x25')](_0x408370[_0x2272('0x22')],_0x2272('0x26'));}}}}if(this['actions'][_0x408370[_0x2272('0x22')]]){this[_0x2272('0xe')][_0x408370['uniqueid']]={};this[_0x2272('0xe')][_0x408370[_0x2272('0x22')]][_0x2272('0x23')]=_0x408370[_0x2272('0x23')];logger[_0x2272('0x25')](_0x408370[_0x2272('0x22')],_0x2272('0x26'));}};Fax[_0x2272('0x27')][_0x2272('0x15')]=function(_0x3d40a5){if(this[_0x2272('0xe')][_0x3d40a5['uniqueid']]){for(var _0x52b2ac in _0x3d40a5[_0x2272('0x28')]){if(_0x3d40a5[_0x2272('0x28')][_0x2272('0x1f')](_0x52b2ac)){this[_0x2272('0xe')][_0x3d40a5[_0x2272('0x22')]][_0x52b2ac]=_0x3d40a5['value'];}}}};Fax[_0x2272('0x27')][_0x2272('0x29')]=function(_0x363323){if(this[_0x2272('0xe')][_0x363323[_0x2272('0x22')]]){this[_0x2272('0xe')][_0x363323[_0x2272('0x22')]]['channelstate']=_0x363323['channelstate'];this[_0x2272('0xe')][_0x363323['uniqueid']][_0x2272('0x2a')]=_0x363323[_0x2272('0x2a')];}};Fax[_0x2272('0x27')][_0x2272('0x17')]=function(_0xf7b5a7){if(this[_0x2272('0xe')][_0xf7b5a7[_0x2272('0x22')]]){for(var _0x21c7b7 in _0xf7b5a7[_0x2272('0x28')]){if(_0xf7b5a7['variable'][_0x2272('0x1f')](_0x21c7b7)){this[_0x2272('0xe')][_0xf7b5a7[_0x2272('0x22')]][_0x21c7b7]=_0xf7b5a7[_0x2272('0x2b')];}}}};Fax[_0x2272('0x27')]['syncFaxStatus']=function(_0x77b005){if(this[_0x2272('0xe')][_0x77b005[_0x2272('0x22')]]){this[_0x2272('0xe')][_0x77b005[_0x2272('0x22')]][_0x2272('0x2c')]=_0x77b005[_0x2272('0x2c')];this[_0x2272('0xe')][_0x77b005[_0x2272('0x22')]]['status']=_0x77b005[_0x2272('0x2d')];this['channels'][_0x77b005[_0x2272('0x22')]][_0x2272('0x21')]=_0x77b005[_0x2272('0x21')];this[_0x2272('0xe')][_0x77b005[_0x2272('0x22')]][_0x2272('0x2e')]=_0x77b005['filename'];logger[_0x2272('0x25')](_0x77b005[_0x2272('0x22')],_0x2272('0x2f'));}};Fax['prototype']['syncReceiveFax']=function(_0x4b40a1){var _0x293375=this;if(this[_0x2272('0xe')][_0x4b40a1['uniqueid']]){var _0x22c3d2=this[_0x2272('0xe')][_0x4b40a1[_0x2272('0x22')]]['id'];this[_0x2272('0xe')][_0x4b40a1['uniqueid']][_0x2272('0x30')]=_0x4b40a1[_0x2272('0x30')];this[_0x2272('0xe')][_0x4b40a1['uniqueid']][_0x2272('0x31')]=_0x4b40a1[_0x2272('0x31')];this[_0x2272('0xe')][_0x4b40a1[_0x2272('0x22')]][_0x2272('0x21')]=_0x4b40a1[_0x2272('0x21')];this[_0x2272('0xe')][_0x4b40a1[_0x2272('0x22')]][_0x2272('0x32')]=_0x4b40a1[_0x2272('0x32')];this[_0x2272('0xe')][_0x4b40a1['uniqueid']][_0x2272('0x33')]=_0x4b40a1[_0x2272('0x33')];this[_0x2272('0xe')][_0x4b40a1[_0x2272('0x22')]]['filename']=_0x4b40a1[_0x2272('0x2e')];this[_0x2272('0xe')][_0x4b40a1[_0x2272('0x22')]][_0x2272('0x34')]=_0x4b40a1[_0x2272('0x34')];if(this[_0x2272('0xe')][_0x4b40a1[_0x2272('0x22')]][_0x2272('0x31')]>0x0){tiff2pdf(_0x4b40a1[_0x2272('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x5e3847){logger[_0x2272('0x25')](_0x4b40a1[_0x2272('0x22')],_0x2272('0x35'),_0x5e3847[_0x2272('0x36')]);attachment['create']({'name':path[_0x2272('0x37')](_0x4b40a1[_0x2272('0x2e')])[_0x2272('0x24')],'basename':path[_0x2272('0x37')](_0x4b40a1['filename'])['name']+_0x2272('0x38'),'type':_0x2272('0x39')})[_0x2272('0x3a')](function(_0x52f52a){faxAccount[_0x2272('0x3b')](_0x22c3d2,{'from':_0x4b40a1[_0x2272('0x34')],'mapKey':'fax','body':path[_0x2272('0x37')](_0x4b40a1['filename'])[_0x2272('0x24')]+_0x2272('0x38'),'AttachmentId':_0x52f52a['id']})['catch'](function(_0x5ad678){logger[_0x2272('0x3c')](_0x4b40a1[_0x2272('0x22')],'\x20notify\x20',JSON[_0x2272('0x3d')](_0x5ad678));});})[_0x2272('0x3e')](function(_0x2aa307){logger[_0x2272('0x3c')](_0x4b40a1['uniqueid'],_0x2272('0x3f'),JSON[_0x2272('0x3d')](_0x2aa307));});});}logger[_0x2272('0x25')](_0x4b40a1[_0x2272('0x22')],_0x2272('0x3f'));}};Fax[_0x2272('0x27')][_0x2272('0x1b')]=function(_0x2e46ee){if(this['actions'][_0x2e46ee['uniqueid']]){_['merge'](this[_0x2272('0xe')][_0x2e46ee[_0x2272('0x22')]],_[_0x2272('0x40')](_0x2e46ee,[_0x2272('0x41'),_0x2272('0x42')]));}};function updateStatus(_0xdec672){if(_0xdec672[_0x2272('0x43')]){faxMessage[_0x2272('0x44')](_0xdec672[_0x2272('0x43')],{'failMessage':_0x2272('0x45')})[_0x2272('0x3a')](function(_0x8ddc36){ut[_0x2272('0x46')](_0x2272('0x47'),_0x8ddc36);})[_0x2272('0x3e')](function(_0x1f0e94){ut[_0x2272('0x46')](_0x2272('0x48'),_0x1f0e94);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x2272('0x49')]=function(_0x45c53e,_0x323bfd,_0x365cc8){var _0x370ce5=this;var _0x2c0602={};if(_0x323bfd){_0x2c0602={'read':_0x323bfd};}else{_0x2c0602={'failMessage':_0x365cc8};}if(this[_0x2272('0x11')][_0x45c53e]['AttachmentId']){faxMessage[_0x2272('0x44')](this['actions'][_0x45c53e]['AttachmentId'],_0x2c0602)[_0x2272('0x3a')](function(_0x4fc466){ut[_0x2272('0x46')](_0x2272('0x4a'),_0x4fc466);})[_0x2272('0x3e')](function(_0x4f2875){ut[_0x2272('0x46')](_0x2272('0x4b'),_0x4f2875);})['finally'](function(){delete _0x370ce5[_0x2272('0xe')][_0x45c53e];delete _0x370ce5[_0x2272('0x11')][_0x45c53e];});}else{ut[_0x2272('0x46')](_0x2272('0x4c'));delete this[_0x2272('0xe')][_0x45c53e];delete this[_0x2272('0x11')][_0x45c53e];}};Fax[_0x2272('0x27')][_0x2272('0x4d')]=function(_0x3558b5){var _0x37b54f=this;if(this['channels'][_0x3558b5[_0x2272('0x22')]]){if(this['actions'][_0x3558b5[_0x2272('0x22')]]){this[_0x2272('0xe')][_0x3558b5[_0x2272('0x22')]]['id']=this['actions'][_0x3558b5[_0x2272('0x22')]]['id'];this['channels'][_0x3558b5[_0x2272('0x22')]]['name']=this[_0x2272('0x11')][_0x3558b5[_0x2272('0x22')]][_0x2272('0x24')];}logger[_0x2272('0x25')](_0x3558b5[_0x2272('0x22')],this[_0x2272('0x11')][_0x3558b5[_0x2272('0x22')]]?'\x20hangup\x20sendFile\x20':_0x2272('0x4e'),JSON[_0x2272('0x3d')](this[_0x2272('0xe')][_0x3558b5[_0x2272('0x22')]]));if(this['actions'][_0x3558b5[_0x2272('0x22')]]){if(this['channels'][_0x3558b5[_0x2272('0x22')]][_0x2272('0x4f')]>0x0&&this[_0x2272('0xe')][_0x3558b5[_0x2272('0x22')]][_0x2272('0x18')]===_0x2272('0x50')){this[_0x2272('0x49')](_0x3558b5['uniqueid'],!![]);}else{this[_0x2272('0x49')](_0x3558b5[_0x2272('0x22')],![],this['channels'][_0x3558b5[_0x2272('0x22')]]['faxstatusstring']?_0x2272('0x51')+this[_0x2272('0xe')][_0x3558b5[_0x2272('0x22')]][_0x2272('0x52')]:_0x2272('0x53'));}}}};Fax[_0x2272('0x27')][_0x2272('0x54')]=function(_0x4b9f02){var _0x35accd=this;return new BPromise(function(_0x2e1263,_0x36859e){_0x35accd['execOriginate'](_0x4b9f02,_0x35accd[_0x2272('0xf')][_0x4b9f02['FaxAccountId']])[_0x2272('0x3a')](function(_0x4ace42){ut[_0x2272('0x46')](_0x2272('0x55'),_0x4ace42);_0x2e1263(ut[_0x2272('0x36')](_0x2272('0x56')));})[_0x2272('0x3e')](function(_0x2f0ef3){ut['logger']('[Fax][execOriginate][failure]',_0x2f0ef3);updateStatus(_0x4b9f02);_0x36859e(ut['message'](_0x2272('0x57')));});});};Fax['prototype'][_0x2272('0x58')]=function(_0x497084){var _0x1869ee=this;return new BPromise(function(_0x1688c3,_0x2d8097){var _0x53df23=_0x1869ee['checkTrunk'](_0x1869ee[_0x2272('0xf')][_0x497084[_0x2272('0x59')]][_0x2272('0x5a')],_0x497084);if(_0x53df23[_0x2272('0x5b')]){_0x1688c3(ut[_0x2272('0x36')]('Trunk\x20Reachable'));}else{_0x2d8097(ut[_0x2272('0x36')](_0x53df23[_0x2272('0x36')]));}});};function originate(_0x5d732e,_0x61217a,_0x3015cc){return new BPromise(function(_0x5c2038,_0x1ea5d7){if(_0x3015cc){var _0x2a1fcf=util[_0x2272('0x5c')](_0x2272('0x5d'),path[_0x2272('0x37')](_0x5d732e[_0x2272('0x4')])[_0x2272('0x24')],_0x5d732e[_0x2272('0x4')]);gs[_0x2272('0x5e')](_0x2a1fcf)['then'](function(){_0x5d732e['path']=util['format'](_0x2272('0x5f'),path[_0x2272('0x37')](_0x5d732e[_0x2272('0x4')])[_0x2272('0x60')],path[_0x2272('0x37')](_0x5d732e[_0x2272('0x4')])[_0x2272('0x24')]);_0x61217a[_0x2272('0x61')]=_0x5d732e['path'];ut['logger'](_0x2272('0x62'),'');ami[_0x2272('0x63')](ut[_0x2272('0x64')](_0x5d732e,_0x61217a))[_0x2272('0x3a')](function(_0x15c7bb){_0x5c2038(_0x15c7bb);})[_0x2272('0x3e')](function(_0x4fc56f){_0x1ea5d7(_0x4fc56f);});})[_0x2272('0x3e')](function(_0x90aa93){_0x1ea5d7(_0x90aa93);});}else{ami[_0x2272('0x63')](ut[_0x2272('0x64')](_0x5d732e,_0x61217a))[_0x2272('0x3a')](function(_0x114b02){_0x5c2038(_0x114b02);})[_0x2272('0x3e')](function(_0xc506d5){_0x1ea5d7(_0xc506d5);});}});}Fax[_0x2272('0x27')][_0x2272('0x65')]=function(_0x57936f,_0x4a1cf6){var _0x48ec13=this;return new BPromise(function(_0xdc79ee,_0x3c46b4){var _0x4b41e7=uuid['v4']();var _0x456b9a=ut[_0x2272('0x66')](_0x57936f,_0x4a1cf6);_0x48ec13[_0x2272('0x11')][_0x4b41e7]=new Action(_0x4b41e7,_0x4a1cf6,_0x57936f);var _0x40d8c8=_0x48ec13[_0x2272('0x11')][_0x4b41e7];if(path[_0x2272('0x37')](_0x57936f[_0x2272('0x4')])[_0x2272('0x67')]===_0x2272('0x38')){originate(_0x40d8c8,_0x456b9a,!![])['then'](function(_0x192e8d){_0xdc79ee(_0x192e8d);})[_0x2272('0x3e')](function(_0xb99b22){_0x3c46b4(_0xb99b22);});}else{originate(_0x40d8c8,_0x456b9a,![])[_0x2272('0x3a')](function(_0x208bf9){_0xdc79ee(_0x208bf9);})[_0x2272('0x3e')](function(_0x131a17){_0x3c46b4(_0x131a17);});}});};Fax[_0x2272('0x27')][_0x2272('0x68')]=function(_0x531605){return!_[_0x2272('0x69')](_0x531605)&&!_['isNil'](_0x531605['name'])&&!_[_0x2272('0x69')](_0x531605[_0x2272('0x6a')])&&_0x531605['active']&&!_[_0x2272('0x69')](this['trunks'][util[_0x2272('0x5c')](_0x2272('0x6b'),_0x531605[_0x2272('0x24')])])&&!_[_0x2272('0x69')](this[_0x2272('0x10')][util[_0x2272('0x5c')]('SIP/%s',_0x531605[_0x2272('0x24')])]['status'])&&(this[_0x2272('0x10')][util['format'](_0x2272('0x6b'),_0x531605['name'])]['status']===_0x2272('0x6c')||this[_0x2272('0x10')][util['format']('SIP/%s',_0x531605[_0x2272('0x24')])][_0x2272('0x2d')]==='unmonitored');};Fax[_0x2272('0x27')][_0x2272('0x6d')]=function(_0x5e49a7,_0x5c5ef4){if(!this[_0x2272('0x68')](_0x5e49a7)){ut[_0x2272('0x46')](_0x2272('0x6e'),_[_0x2272('0x69')](_0x5e49a7)?'':_0x5e49a7[_0x2272('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x2272('0x6f')};}if(_[_0x2272('0x69')](_0x5c5ef4[_0x2272('0x8')])){ut[_0x2272('0x46')](_0x2272('0x70'),JSON[_0x2272('0x3d')](_0x5c5ef4));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x2272('0x69')](_0x5c5ef4[_0x2272('0x4')])){ut[_0x2272('0x46')](_0x2272('0x71'),JSON[_0x2272('0x3d')](_0x5c5ef4));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ebe7a4b..2f4b5a8 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 _0x0321=['then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','notify','resolve'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0x0321,0x116));var _0x1032=function(_0x3342de,_0x5cb38b){_0x3342de=_0x3342de-0x0;var _0x5b2749=_0x0321[_0x3342de];return _0x5b2749;};'use strict';var util=require(_0x1032('0x0'));var BPromise=require(_0x1032('0x1'));var logger=require(_0x1032('0x2'))(_0x1032('0x3'));var _=require(_0x1032('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x510e23){return function(_0x3e2402){logger[_0x1032('0x5')](_0x510e23,util['inspect'](_0x3e2402,{'showHidden':![],'depth':null}));};}exports[_0x1032('0x6')]=function(_0x493e5b,_0x63644c){return BPromise[_0x1032('0x7')]()[_0x1032('0x8')](faxAccount['notify'](_0x493e5b,_0x63644c))[_0x1032('0x9')](loggerCatch(_0x1032('0xa')));}; \ No newline at end of file +var _0xc5b9=['error','inspect','resolve','then','notify','[Notify]\x20','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x9bca53,_0x59b4f8){var _0x3894bc=function(_0x1ae67d){while(--_0x1ae67d){_0x9bca53['push'](_0x9bca53['shift']());}};_0x3894bc(++_0x59b4f8);}(_0xc5b9,0x146));var _0x9c5b=function(_0x299de2,_0x591704){_0x299de2=_0x299de2-0x0;var _0x29163a=_0xc5b9[_0x299de2];return _0x29163a;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x9c5b('0x0'))(_0x9c5b('0x1'));var _=require(_0x9c5b('0x2'));var faxAccount=require(_0x9c5b('0x3'));function loggerCatch(_0x56c381){return function(_0x1d731d){logger[_0x9c5b('0x4')](_0x56c381,util[_0x9c5b('0x5')](_0x1d731d,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2b6e02,_0x59c9e7){return BPromise[_0x9c5b('0x6')]()[_0x9c5b('0x7')](faxAccount[_0x9c5b('0x8')](_0x2b6e02,_0x59c9e7))['catch'](loggerCatch(_0x9c5b('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 077bf43..3689717 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 _0x57b5=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','child_process'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x57b5,0x12f));var _0x557b=function(_0x396b44,_0x53777a){_0x396b44=_0x396b44-0x0;var _0x170b96=_0x57b5[_0x396b44];return _0x170b96;};'use strict';var util=require(_0x557b('0x0'));var logger=require(_0x557b('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x557b('0x2'))[_0x557b('0x3')];exports[_0x557b('0x4')]=function(_0x34794b){return new BPromise(function(_0x17eafc,_0x2920e0){exec(_0x34794b,function(_0x2aa281,_0x4c8c9f,_0x38b107){logger[_0x557b('0x5')](_0x557b('0x6'),_0x4c8c9f);if(_0x2aa281){logger[_0x557b('0x5')]('Exec\x20gs',_0x557b('0x7'),util[_0x557b('0x8')](_0x2aa281,{'showHidden':![],'depth':null}),_0x4c8c9f,_0x38b107);_0x2920e0(_0x2aa281);}_0x17eafc(_0x4c8c9f);});});}; \ No newline at end of file +var _0x0bac=['Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x27e104,_0x4a328e){var _0x26393a=function(_0x4f38ce){while(--_0x4f38ce){_0x27e104['push'](_0x27e104['shift']());}};_0x26393a(++_0x4a328e);}(_0x0bac,0xa4));var _0xc0ba=function(_0x4716ed,_0x51685){_0x4716ed=_0x4716ed-0x0;var _0xd438a1=_0x0bac[_0x4716ed];return _0xd438a1;};'use strict';var util=require(_0xc0ba('0x0'));var logger=require(_0xc0ba('0x1'))(_0xc0ba('0x2'));var BPromise=require(_0xc0ba('0x3'));var exec=require('child_process')['exec'];exports['execute']=function(_0x11c97b){return new BPromise(function(_0x670270,_0x26a77e){exec(_0x11c97b,function(_0x4e8a9b,_0x338f00,_0x4d1a85){logger['info'](_0xc0ba('0x4'),_0x338f00);if(_0x4e8a9b){logger[_0xc0ba('0x5')](_0xc0ba('0x4'),_0xc0ba('0x6'),util[_0xc0ba('0x7')](_0x4e8a9b,{'showHidden':![],'depth':null}),_0x338f00,_0x4d1a85);_0x26a77e(_0x4e8a9b);}_0x670270(_0x338f00);});});}; \ 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 39c3b41..a11a65e 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 _0xe70c=['maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe70c,0x145));var _0xce70=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe70c[_0x4154a6];return _0x3b2786;};'use strict';var util=require(_0xce70('0x0'));var _=require(_0xce70('0x1'));var moment=require(_0xce70('0x2'));var logger=require(_0xce70('0x3'))(_0xce70('0x4'));exports[_0xce70('0x5')]=function(_0x381f6f){return{'message':_0x381f6f};};exports[_0xce70('0x6')]=function(_0x22f68c,_0x38fb61){logger[_0xce70('0x7')](_0x22f68c,util[_0xce70('0x8')](_0x38fb61,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x25d099,_0x848e29){var _0x1703fc={'XMF-ECM':_0x848e29[_0xce70('0x9')],'XMF-HEADERINFO':_0x848e29['headerinfo'],'XMF-MINRATE':_0x848e29[_0xce70('0xa')],'XMF-MAXRATE':_0x848e29[_0xce70('0xb')],'XMF-MODEM':util[_0xce70('0xc')]('\x22%s\x22',_0x848e29[_0xce70('0xd')]),'XMF-GATEWAY':_0x848e29[_0xce70('0xe')],'XMF-FAXDETECT':_0x848e29[_0xce70('0xf')],'XMF-T38TIMEOUT':_0x848e29[_0xce70('0x10')],'XMF-LOCALSTATIONID':_0x848e29[_0xce70('0x11')],'XMF-PATH':_0x25d099[_0xce70('0x12')]};return _0x1703fc;};exports[_0xce70('0x13')]=function(_0x12101b,_0x171a41){return{'actionid':_0x12101b[_0xce70('0x14')],'action':_0xce70('0x15'),'channel':_0x12101b['channel'],'Exten':'xcally-motion-fax','Context':_0xce70('0x16'),'Priority':'1','callerid':util[_0xce70('0xc')](_0xce70('0x17'),_0x12101b['headerinfo']?_0x12101b['headerinfo']:'',_0x12101b['localstationid']),'variable':_0x171a41,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x12101b[_0xce70('0x14')]};}; \ No newline at end of file +var _0xaaf2=['channel','xcally-motion-fax','from-sip','format','lodash','moment','fax','message','info','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','uniqueid'];(function(_0xf39eab,_0x2374bd){var _0x42d887=function(_0x57b651){while(--_0x57b651){_0xf39eab['push'](_0xf39eab['shift']());}};_0x42d887(++_0x2374bd);}(_0xaaf2,0x169));var _0x2aaf=function(_0xe833cc,_0x467d44){_0xe833cc=_0xe833cc-0x0;var _0x3ac7d6=_0xaaf2[_0xe833cc];return _0x3ac7d6;};'use strict';var util=require('util');var _=require(_0x2aaf('0x0'));var moment=require(_0x2aaf('0x1'));var logger=require('../../../../config/logger')(_0x2aaf('0x2'));exports[_0x2aaf('0x3')]=function(_0x3972b4){return{'message':_0x3972b4};};exports['logger']=function(_0x2e17f9,_0x274410){logger[_0x2aaf('0x4')](_0x2e17f9,util['inspect'](_0x274410,{'showHidden':![],'depth':null}));};exports[_0x2aaf('0x5')]=function(_0x3313ff,_0x19f226){var _0x288621={'XMF-ECM':_0x19f226[_0x2aaf('0x6')],'XMF-HEADERINFO':_0x19f226[_0x2aaf('0x7')],'XMF-MINRATE':_0x19f226[_0x2aaf('0x8')],'XMF-MAXRATE':_0x19f226[_0x2aaf('0x9')],'XMF-MODEM':util['format'](_0x2aaf('0xa'),_0x19f226[_0x2aaf('0xb')]),'XMF-GATEWAY':_0x19f226['gateway'],'XMF-FAXDETECT':_0x19f226[_0x2aaf('0xc')],'XMF-T38TIMEOUT':_0x19f226[_0x2aaf('0xd')],'XMF-LOCALSTATIONID':_0x19f226[_0x2aaf('0xe')],'XMF-PATH':_0x3313ff[_0x2aaf('0xf')]};return _0x288621;};exports['variablesAction']=function(_0x3e1252,_0x17eaca){return{'actionid':_0x3e1252[_0x2aaf('0x10')],'action':'originate','channel':_0x3e1252[_0x2aaf('0x11')],'Exten':_0x2aaf('0x12'),'Context':_0x2aaf('0x13'),'Priority':'1','callerid':util[_0x2aaf('0x14')]('\x22%s\x22\x20<%s>',_0x3e1252[_0x2aaf('0x7')]?_0x3e1252[_0x2aaf('0x7')]:'',_0x3e1252[_0x2aaf('0xe')]),'variable':_0x17eaca,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3e1252[_0x2aaf('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b1aa1bd..ce4ab97 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 _0x86f6=['get','hour','then','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami'];(function(_0x480eb,_0x3f012c){var _0x3a4b72=function(_0x2948db){while(--_0x2948db){_0x480eb['push'](_0x480eb['shift']());}};_0x3a4b72(++_0x3f012c);}(_0x86f6,0x146));var _0x686f=function(_0x59394c,_0x1c325f){_0x59394c=_0x59394c-0x0;var _0x3668ad=_0x86f6[_0x59394c];return _0x3668ad;};'use strict';var util=require(_0x686f('0x0'));var moment=require('moment');var server=require(_0x686f('0x1'));var Realtime=require(_0x686f('0x2'));var Report=require(_0x686f('0x3'));var Acw=require(_0x686f('0x4'));var Trigger=require(_0x686f('0x5'));var Dialer=require(_0x686f('0x6'));var Preview=require(_0x686f('0x7'));var Fax=require('./fax');var user=require(_0x686f('0x8'));var voiceQueue=require(_0x686f('0x9'));var voiceQueueReport=require(_0x686f('0xa'));var voiceCallReport=require(_0x686f('0xb'));var trunk=require(_0x686f('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x686f('0xd'));var cmHopperHistory=require(_0x686f('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x686f('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x686f('0x10'));var salesforce=require(_0x686f('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x686f('0x12'));var desk=require(_0x686f('0x13'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x686f('0x14'));var dynamics365=require(_0x686f('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x686f('0x16'))(_0x686f('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x686f('0x18')](_0x686f('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x686f('0x18')](_0x686f('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x686f('0x1a')](user['getAgents']())[_0x686f('0x1a')](realtime[_0x686f('0x1b')]())[_0x686f('0x1a')](user['getTelephones']())[_0x686f('0x1a')](realtime[_0x686f('0x1c')]())[_0x686f('0x1a')](trunk[_0x686f('0x1d')]())[_0x686f('0x1a')](realtime[_0x686f('0x1e')]())[_0x686f('0x1a')](voiceQueue[_0x686f('0x1f')]())[_0x686f('0x1a')](realtime[_0x686f('0x20')]())[_0x686f('0x1a')](trigger[_0x686f('0x21')]())['then'](realtime['initTriggers']())['then'](template[_0x686f('0x22')]())['then'](realtime[_0x686f('0x23')]())['then'](zendesk['getZendeskAccounts']())[_0x686f('0x1a')](realtime[_0x686f('0x24')]())['then'](salesforce[_0x686f('0x25')]())['then'](realtime[_0x686f('0x26')]())[_0x686f('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x686f('0x1a')](realtime['initSugarcrmAccounts']())[_0x686f('0x1a')](freshdesk[_0x686f('0x27')]())[_0x686f('0x1a')](realtime[_0x686f('0x28')]())[_0x686f('0x1a')](desk[_0x686f('0x29')]())['then'](realtime['initDeskAccounts']())[_0x686f('0x1a')](zoho[_0x686f('0x2a')]())[_0x686f('0x1a')](realtime[_0x686f('0x2b')]())[_0x686f('0x1a')](vtiger[_0x686f('0x2c')]())[_0x686f('0x1a')](realtime['initVtigerAccounts']())['then'](freshsales[_0x686f('0x2d')]())[_0x686f('0x1a')](realtime[_0x686f('0x2e')]())['then'](servicenow[_0x686f('0x2f')]())[_0x686f('0x1a')](realtime[_0x686f('0x30')]())[_0x686f('0x1a')](dynamics365[_0x686f('0x31')]())[_0x686f('0x1a')](realtime[_0x686f('0x32')]())[_0x686f('0x1a')](campaign['getCampaigns']())[_0x686f('0x1a')](realtime[_0x686f('0x33')]())[_0x686f('0x1a')](voiceExtension[_0x686f('0x34')]())['then'](realtime[_0x686f('0x35')]())[_0x686f('0x1a')](faxAccount[_0x686f('0x36')]())[_0x686f('0x1a')](realtime[_0x686f('0x37')]())[_0x686f('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x686f('0x38')]()['then'](voiceQueueReport[_0x686f('0x39')]())[_0x686f('0x1a')](realtime[_0x686f('0x3a')]())['then'](cmHopperHistory[_0x686f('0x3b')]())['then'](realtime[_0x686f('0x3c')]())[_0x686f('0x1a')](cmHopperHistory['getCampaignHopperHistory']())[_0x686f('0x1a')](realtime[_0x686f('0x3d')]())[_0x686f('0x1a')](voiceCallReport[_0x686f('0x3e')]())[_0x686f('0x1a')](realtime['initVoiceCallReports']())[_0x686f('0x3f')](function(_0x32c44c){logger[_0x686f('0x40')](_0x686f('0x41'),util['inspect'](_0x32c44c,{'showHidden':![],'depth':null}));});}function main(){return server[_0x686f('0x42')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x686f('0x1a')](function(){return initParams();})['then'](function(){report[_0x686f('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x53ce93){logger[_0x686f('0x40')](_0x686f('0x44'),util[_0x686f('0x45')](_0x53ce93,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x1e33=['initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','[index.js][initParams]','inspect','sync','catch','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1e33,0x1c8));var _0x31e3=function(_0x4ffb9f,_0x5878d3){_0x4ffb9f=_0x4ffb9f-0x0;var _0x43ac97=_0x1e33[_0x4ffb9f];return _0x43ac97;};'use strict';var util=require(_0x31e3('0x0'));var moment=require(_0x31e3('0x1'));var server=require(_0x31e3('0x2'));var Realtime=require(_0x31e3('0x3'));var Report=require(_0x31e3('0x4'));var Acw=require(_0x31e3('0x5'));var Trigger=require(_0x31e3('0x6'));var Dialer=require(_0x31e3('0x7'));var Preview=require(_0x31e3('0x8'));var Fax=require(_0x31e3('0x9'));var user=require(_0x31e3('0xa'));var voiceQueue=require(_0x31e3('0xb'));var voiceQueueReport=require(_0x31e3('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x31e3('0xd'));var trigger=require(_0x31e3('0xe'));var template=require(_0x31e3('0xf'));var cmHopperHistory=require(_0x31e3('0x10'));var campaign=require(_0x31e3('0x11'));var voiceExtension=require(_0x31e3('0x12'));var faxAccount=require(_0x31e3('0x13'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x31e3('0x14'));var sugarcrm=require(_0x31e3('0x15'));var freshdesk=require(_0x31e3('0x16'));var desk=require(_0x31e3('0x17'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x31e3('0x18'));var freshsales=require(_0x31e3('0x19'));var servicenow=require(_0x31e3('0x1a'));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(_0x31e3('0x1b'))(_0x31e3('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x31e3('0x1d')](_0x31e3('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x31e3('0x1d')](_0x31e3('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x31e3('0x1f')]()[_0x31e3('0x20')](user['getAgents']())['then'](realtime[_0x31e3('0x21')]())[_0x31e3('0x20')](user[_0x31e3('0x22')]())[_0x31e3('0x20')](realtime[_0x31e3('0x23')]())[_0x31e3('0x20')](trunk[_0x31e3('0x24')]())[_0x31e3('0x20')](realtime[_0x31e3('0x25')]())[_0x31e3('0x20')](voiceQueue[_0x31e3('0x26')]())[_0x31e3('0x20')](realtime[_0x31e3('0x27')]())[_0x31e3('0x20')](trigger[_0x31e3('0x28')]())['then'](realtime[_0x31e3('0x29')]())[_0x31e3('0x20')](template[_0x31e3('0x2a')]())['then'](realtime[_0x31e3('0x2b')]())['then'](zendesk[_0x31e3('0x2c')]())[_0x31e3('0x20')](realtime[_0x31e3('0x2d')]())['then'](salesforce[_0x31e3('0x2e')]())[_0x31e3('0x20')](realtime[_0x31e3('0x2f')]())[_0x31e3('0x20')](sugarcrm[_0x31e3('0x30')]())[_0x31e3('0x20')](realtime[_0x31e3('0x31')]())[_0x31e3('0x20')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0x31e3('0x32')]())[_0x31e3('0x20')](desk[_0x31e3('0x33')]())[_0x31e3('0x20')](realtime[_0x31e3('0x34')]())['then'](zoho[_0x31e3('0x35')]())[_0x31e3('0x20')](realtime['initZohoAccounts']())[_0x31e3('0x20')](vtiger['getVtigerAccounts']())[_0x31e3('0x20')](realtime[_0x31e3('0x36')]())[_0x31e3('0x20')](freshsales[_0x31e3('0x37')]())['then'](realtime[_0x31e3('0x38')]())[_0x31e3('0x20')](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())[_0x31e3('0x20')](dynamics365['getDynamics365Accounts']())[_0x31e3('0x20')](realtime['initDynamics365Accounts']())[_0x31e3('0x20')](campaign[_0x31e3('0x39')]())[_0x31e3('0x20')](realtime[_0x31e3('0x3a')]())[_0x31e3('0x20')](voiceExtension[_0x31e3('0x3b')]())['then'](realtime[_0x31e3('0x3c')]())['then'](faxAccount['getFaxAccounts']())[_0x31e3('0x20')](realtime[_0x31e3('0x3d')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0x31e3('0x3e')]())[_0x31e3('0x20')](realtime[_0x31e3('0x3f')]())[_0x31e3('0x20')](cmHopperHistory[_0x31e3('0x40')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x31e3('0x20')](cmHopperHistory['getCampaignHopperHistory']())[_0x31e3('0x20')](realtime['initCampaignHopperHistory']())[_0x31e3('0x20')](voiceCallReport[_0x31e3('0x41')]())['then'](realtime[_0x31e3('0x42')]())['catch'](function(_0xcb0cc2){logger['error'](_0x31e3('0x43'),util[_0x31e3('0x44')](_0xcb0cc2,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x31e3('0x20')](function(){return initRealtime();})[_0x31e3('0x20')](function(){return initParams();})['then'](function(){report[_0x31e3('0x45')]();setInterval(initRealtime,0x1388);})[_0x31e3('0x46')](function(_0x4f261b){logger['error']('[index.js][main]',util[_0x31e3('0x44')](_0x4f261b,{'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 964895d..7d8e256 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 _0x69bd=['user:%s','emit','user:save','util','moment','md5','../../../config/environment','defaults','redis','name','email','accountcode','fullname','state','unknown','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','toLowerCase','not_inuse','talking','toNumber','format','stateTime','onhold','stringify'];(function(_0x35709d,_0x5ceef3){var _0x547f64=function(_0x476aaf){while(--_0x476aaf){_0x35709d['push'](_0x35709d['shift']());}};_0x547f64(++_0x5ceef3);}(_0x69bd,0x11b));var _0xd69b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x69bd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xd69b('0x0'));var moment=require(_0xd69b('0x1'));var md5=require(_0xd69b('0x2'));var Redis=require('ioredis');var config=require(_0xd69b('0x3'));config['redis']=_[_0xd69b('0x4')](config[_0xd69b('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd69b('0x5')]));function Agent(_0x16f2dc){this['id']=_0x16f2dc['id']||0x0;this[_0xd69b('0x6')]=_0x16f2dc[_0xd69b('0x6')]||'';this[_0xd69b('0x7')]=_0x16f2dc[_0xd69b('0x7')]||'';this[_0xd69b('0x8')]=_0x16f2dc[_0xd69b('0x8')]||'';this[_0xd69b('0x9')]=_0x16f2dc['fullname']||'';this[_0xd69b('0xa')]=_0xd69b('0xb');this['stateTime']=0x0;this[_0xd69b('0xc')]=_0xd69b('0xb');this[_0xd69b('0xd')]='';this[_0xd69b('0xe')]='';this[_0xd69b('0xf')]='';this[_0xd69b('0x10')]='';this[_0xd69b('0x11')]=_0x16f2dc[_0xd69b('0x11')]||![];this[_0xd69b('0x12')]=_0xd69b('0xb');this[_0xd69b('0x13')]=0x0;this[_0xd69b('0x14')]='';this[_0xd69b('0x15')]='';this['onhold']=![];this['local']=![];this[_0xd69b('0x2')]='';}Agent[_0xd69b('0x16')][_0xd69b('0x17')]=function(_0x55393f){var _0x653073;if(_0x55393f&&_0x55393f[_0xd69b('0xa')]){_0x653073=_0x55393f[_0xd69b('0xa')][_0xd69b('0x18')]();switch(_0x653073){case _0xd69b('0x19'):_0x653073='idle';break;case'inuse':_0x653073=_0xd69b('0x1a');break;}}if(_0x653073&&this[_0xd69b('0x12')]!==_0x653073||_0x55393f['statePause']){this[_0xd69b('0x13')]=_[_0xd69b('0x1b')](moment()[_0xd69b('0x1c')]('x'));}if(_0x653073){this[_0xd69b('0x12')]=_0x653073;}var _0x9762a={'id':this['id'],'name':this[_0xd69b('0x6')],'email':this[_0xd69b('0x7')],'accountcode':this[_0xd69b('0x8')],'fullname':this[_0xd69b('0x9')],'state':this['state'],'stateTime':this[_0xd69b('0x1d')],'status':this[_0xd69b('0xc')],'address':this[_0xd69b('0xd')],'online':this[_0xd69b('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd69b('0x13')],'voiceStatusCallerIdNumber':this[_0xd69b('0x14')],'voiceStatusQueue':this[_0xd69b('0x15')],'interface':this[_0xd69b('0x10')],'onhold':this[_0xd69b('0x1e')]};var _0x2e9af4=md5(JSON[_0xd69b('0x1f')](_0x9762a));if(this[_0xd69b('0x2')]!==_0x2e9af4){this[_0xd69b('0x2')]=_0x2e9af4;io['to'](util[_0xd69b('0x1c')](_0xd69b('0x20'),_0x9762a['name']))[_0xd69b('0x21')](_0xd69b('0x22'),_0x9762a);io[_0xd69b('0x21')]('user:presence',_0x9762a);}};module['exports']=Agent; \ No newline at end of file +var _0xbc76=['online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','talking','statePause','toNumber','email','status','interface','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','accountcode','fullname','unknown','stateTime','address','mobile'];(function(_0x1db3bb,_0x15c046){var _0x5d3b62=function(_0x13ba6a){while(--_0x13ba6a){_0x1db3bb['push'](_0x1db3bb['shift']());}};_0x5d3b62(++_0x15c046);}(_0xbc76,0x101));var _0x6bc7=function(_0x14d109,_0x2497fe){_0x14d109=_0x14d109-0x0;var _0x1e3b4f=_0xbc76[_0x14d109];return _0x1e3b4f;};'use strict';var _=require(_0x6bc7('0x0'));var util=require(_0x6bc7('0x1'));var moment=require(_0x6bc7('0x2'));var md5=require(_0x6bc7('0x3'));var Redis=require(_0x6bc7('0x4'));var config=require(_0x6bc7('0x5'));config['redis']=_[_0x6bc7('0x6')](config[_0x6bc7('0x7')],{'host':_0x6bc7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6bc7('0x7')]));function Agent(_0xb2f98e){this['id']=_0xb2f98e['id']||0x0;this[_0x6bc7('0x9')]=_0xb2f98e[_0x6bc7('0x9')]||'';this['email']=_0xb2f98e['email']||'';this['accountcode']=_0xb2f98e[_0x6bc7('0xa')]||'';this['fullname']=_0xb2f98e[_0x6bc7('0xb')]||'';this['state']=_0x6bc7('0xc');this[_0x6bc7('0xd')]=0x0;this['status']=_0x6bc7('0xc');this[_0x6bc7('0xe')]='';this['phone']='';this[_0x6bc7('0xf')]='';this['interface']='';this[_0x6bc7('0x10')]=_0xb2f98e['online']||![];this[_0x6bc7('0x11')]=_0x6bc7('0xc');this[_0x6bc7('0x12')]=0x0;this[_0x6bc7('0x13')]='';this[_0x6bc7('0x14')]='';this[_0x6bc7('0x15')]=![];this[_0x6bc7('0x16')]=![];this[_0x6bc7('0x3')]='';}Agent[_0x6bc7('0x17')][_0x6bc7('0x18')]=function(_0x4005da){var _0x588400;if(_0x4005da&&_0x4005da[_0x6bc7('0x19')]){_0x588400=_0x4005da[_0x6bc7('0x19')][_0x6bc7('0x1a')]();switch(_0x588400){case _0x6bc7('0x1b'):_0x588400='idle';break;case'inuse':_0x588400=_0x6bc7('0x1c');break;}}if(_0x588400&&this[_0x6bc7('0x11')]!==_0x588400||_0x4005da[_0x6bc7('0x1d')]){this[_0x6bc7('0x12')]=_[_0x6bc7('0x1e')](moment()['format']('x'));}if(_0x588400){this[_0x6bc7('0x11')]=_0x588400;}var _0x4a5de0={'id':this['id'],'name':this[_0x6bc7('0x9')],'email':this[_0x6bc7('0x1f')],'accountcode':this['accountcode'],'fullname':this[_0x6bc7('0xb')],'state':this[_0x6bc7('0x19')],'stateTime':this[_0x6bc7('0xd')],'status':this[_0x6bc7('0x20')],'address':this[_0x6bc7('0xe')],'online':this[_0x6bc7('0x10')],'voiceStatus':this[_0x6bc7('0x11')],'voiceStatusTime':this[_0x6bc7('0x12')],'voiceStatusCallerIdNumber':this[_0x6bc7('0x13')],'voiceStatusQueue':this[_0x6bc7('0x14')],'interface':this[_0x6bc7('0x21')],'onhold':this[_0x6bc7('0x15')]};var _0x407e82=md5(JSON['stringify'](_0x4a5de0));if(this[_0x6bc7('0x3')]!==_0x407e82){this[_0x6bc7('0x3')]=_0x407e82;io['to'](util['format'](_0x6bc7('0x22'),_0x4a5de0[_0x6bc7('0x9')]))[_0x6bc7('0x23')](_0x6bc7('0x24'),_0x4a5de0);io[_0x6bc7('0x23')](_0x6bc7('0x25'),_0x4a5de0);}};module[_0x6bc7('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b7feb49..0a69183 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 _0x1771=['campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type'];(function(_0x4349fc,_0x522ce2){var _0x18cdf3=function(_0x5225a0){while(--_0x5225a0){_0x4349fc['push'](_0x4349fc['shift']());}};_0x18cdf3(++_0x522ce2);}(_0x1771,0xf8));var _0x1177=function(_0x262ea9,_0x1f95ec){_0x262ea9=_0x262ea9-0x0;var _0x4dfe10=_0x1771[_0x262ea9];return _0x4dfe10;};'use strict';function Campaign(_0x48815b){this['id']=_0x48815b['id']||0x0;this[_0x1177('0x0')]=_0x48815b[_0x1177('0x0')]||'';this['type']=_0x48815b[_0x1177('0x1')]||_0x1177('0x2');this[_0x1177('0x3')]=0x0;this[_0x1177('0x4')]=0x0;this[_0x1177('0x5')]=0x0;this[_0x1177('0x6')]=0x0;this[_0x1177('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x1177('0x8')]=_0x48815b[_0x1177('0x8')];this[_0x1177('0x9')]=_0x48815b[_0x1177('0x9')];this[_0x1177('0xa')]=_0x48815b['dialTimezone']||null;this[_0x1177('0xb')]=_0x48815b[_0x1177('0xb')]?_0x48815b[_0x1177('0xb')]:null;this[_0x1177('0xc')]=_0x48815b[_0x1177('0xc')];this[_0x1177('0xd')]=_0x48815b['dialOriginateCallerIdNumber'];this[_0x1177('0xe')]=_0x48815b[_0x1177('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x48815b[_0x1177('0xf')];this[_0x1177('0x10')]=_0x48815b[_0x1177('0x10')];this['dialBusyMaxRetry']=_0x48815b[_0x1177('0x11')];this[_0x1177('0x12')]=_0x48815b[_0x1177('0x12')];this[_0x1177('0x13')]=_0x48815b[_0x1177('0x13')];this[_0x1177('0x14')]=_0x48815b[_0x1177('0x14')];this[_0x1177('0x15')]=_0x48815b[_0x1177('0x15')];this[_0x1177('0x16')]=_0x48815b[_0x1177('0x16')]||0x3;this[_0x1177('0x17')]=_0x48815b['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x48815b[_0x1177('0x18')]||0x3;this[_0x1177('0x19')]=_0x48815b['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x48815b['dialAbandonedMaxRetry']||0x3;this[_0x1177('0x1a')]=_0x48815b[_0x1177('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x48815b[_0x1177('0x1b')]||0x3;this['dialMachineRetryFrequency']=_0x48815b['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x48815b[_0x1177('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x48815b[_0x1177('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x48815b[_0x1177('0x1e')]||_0x1177('0x1f');this[_0x1177('0x20')]=_0x48815b[_0x1177('0x20')]||undefined;this[_0x1177('0x21')]=_0x48815b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1177('0x22')]=_0x48815b[_0x1177('0x22')]||undefined;this[_0x1177('0x23')]=_0x48815b[_0x1177('0x23')]?_0x48815b[_0x1177('0x23')]:undefined;this[_0x1177('0x24')]=_0x48815b['Trunk']?_0x48815b[_0x1177('0x24')]:undefined;this[_0x1177('0x25')]=_0x48815b[_0x1177('0x25')]?_0x48815b['Interval']:undefined;this['SquareProject']=_0x48815b[_0x1177('0x26')]?_0x48815b[_0x1177('0x26')]:undefined;this[_0x1177('0x27')]=_0x48815b[_0x1177('0x26')]?_0x48815b[_0x1177('0x26')][_0x1177('0x0')]:undefined;this[_0x1177('0x28')]=_0x48815b[_0x1177('0x28')]||![];this['dialAMDInitialSilence']=_0x48815b[_0x1177('0x29')];this[_0x1177('0x2a')]=_0x48815b[_0x1177('0x2a')];this['dialAMDAfterGreetingSilence']=_0x48815b['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x48815b[_0x1177('0x2b')];this[_0x1177('0x2c')]=_0x48815b[_0x1177('0x2c')];this[_0x1177('0x2d')]=_0x48815b[_0x1177('0x2d')];this[_0x1177('0x2e')]=_0x48815b[_0x1177('0x2e')];this[_0x1177('0x2f')]=_0x48815b[_0x1177('0x2f')];this[_0x1177('0x30')]=_0x48815b['dialAMDMaximumWordLength'];}module[_0x1177('0x31')]=Campaign; \ No newline at end of file +var _0xa970=['ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','temp','ivrAnswerCallsDay'];(function(_0x55e6fa,_0x1acd76){var _0x5b7d90=function(_0xa0303c){while(--_0xa0303c){_0x55e6fa['push'](_0x55e6fa['shift']());}};_0x5b7d90(++_0x1acd76);}(_0xa970,0x183));var _0x0a97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa970[_0x3dd15e];return _0x231fd0;};'use strict';function Campaign(_0xf3fb0c){this['id']=_0xf3fb0c['id']||0x0;this['name']=_0xf3fb0c[_0x0a97('0x0')]||'';this[_0x0a97('0x1')]=_0xf3fb0c[_0x0a97('0x1')]||_0x0a97('0x2');this['originated']=0x0;this[_0x0a97('0x3')]=0x0;this[_0x0a97('0x4')]=0x0;this[_0x0a97('0x5')]=0x0;this[_0x0a97('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x0a97('0x7')]=_0xf3fb0c['active'];this[_0x0a97('0x8')]=_0xf3fb0c[_0x0a97('0x8')];this[_0x0a97('0x9')]=_0xf3fb0c[_0x0a97('0x9')]||null;this['dialGlobalInterval']=_0xf3fb0c[_0x0a97('0xa')]?_0xf3fb0c[_0x0a97('0xa')]:null;this[_0x0a97('0xb')]=_0xf3fb0c[_0x0a97('0xb')];this[_0x0a97('0xc')]=_0xf3fb0c[_0x0a97('0xc')];this['dialOriginateTimeout']=_0xf3fb0c[_0x0a97('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0xf3fb0c['dialCongestionMaxRetry'];this[_0x0a97('0xe')]=_0xf3fb0c[_0x0a97('0xe')];this[_0x0a97('0xf')]=_0xf3fb0c[_0x0a97('0xf')];this[_0x0a97('0x10')]=_0xf3fb0c['dialBusyRetryFrequency'];this[_0x0a97('0x11')]=_0xf3fb0c[_0x0a97('0x11')];this[_0x0a97('0x12')]=_0xf3fb0c[_0x0a97('0x12')];this[_0x0a97('0x13')]=_0xf3fb0c['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0xf3fb0c['dialNoSuchNumberMaxRetry']||0x3;this[_0x0a97('0x14')]=_0xf3fb0c['dialNoSuchNumberRetryFrequency']||0x96;this[_0x0a97('0x15')]=_0xf3fb0c[_0x0a97('0x15')]||0x3;this[_0x0a97('0x16')]=_0xf3fb0c[_0x0a97('0x16')]||0x96;this[_0x0a97('0x17')]=_0xf3fb0c['dialAbandonedMaxRetry']||0x3;this[_0x0a97('0x18')]=_0xf3fb0c[_0x0a97('0x18')]||0x96;this[_0x0a97('0x19')]=_0xf3fb0c[_0x0a97('0x19')]||0x3;this[_0x0a97('0x1a')]=_0xf3fb0c[_0x0a97('0x1a')]||0x96;this[_0x0a97('0x1b')]=_0xf3fb0c[_0x0a97('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0xf3fb0c[_0x0a97('0x1c')]||0x96;this[_0x0a97('0x1d')]=_0xf3fb0c[_0x0a97('0x1d')]||_0x0a97('0x1e');this[_0x0a97('0x1f')]=_0xf3fb0c['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xf3fb0c[_0x0a97('0x20')]||undefined;this[_0x0a97('0x21')]=_0xf3fb0c['dialCutDigit']||undefined;this[_0x0a97('0x22')]=_0xf3fb0c[_0x0a97('0x22')]?_0xf3fb0c[_0x0a97('0x22')]:undefined;this[_0x0a97('0x23')]=_0xf3fb0c['Trunk']?_0xf3fb0c[_0x0a97('0x23')]:undefined;this[_0x0a97('0x24')]=_0xf3fb0c[_0x0a97('0x24')]?_0xf3fb0c[_0x0a97('0x24')]:undefined;this[_0x0a97('0x25')]=_0xf3fb0c[_0x0a97('0x25')]?_0xf3fb0c['SquareProject']:undefined;this[_0x0a97('0x26')]=_0xf3fb0c['SquareProject']?_0xf3fb0c[_0x0a97('0x25')][_0x0a97('0x0')]:undefined;this[_0x0a97('0x27')]=_0xf3fb0c[_0x0a97('0x27')]||![];this[_0x0a97('0x28')]=_0xf3fb0c['dialAMDInitialSilence'];this['dialAMDGreeting']=_0xf3fb0c[_0x0a97('0x29')];this[_0x0a97('0x2a')]=_0xf3fb0c['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0xf3fb0c[_0x0a97('0x2b')];this[_0x0a97('0x2c')]=_0xf3fb0c[_0x0a97('0x2c')];this[_0x0a97('0x2d')]=_0xf3fb0c[_0x0a97('0x2d')];this['dialAMDMaximumNumberOfWords']=_0xf3fb0c[_0x0a97('0x2e')];this[_0x0a97('0x2f')]=_0xf3fb0c[_0x0a97('0x2f')];this['dialAMDMaximumWordLength']=_0xf3fb0c[_0x0a97('0x30')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 1dc61e1..2ee9553 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 _0x30fc=['unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime'];(function(_0x3a96cd,_0x1095ad){var _0x5c4f4a=function(_0x2fab3c){while(--_0x2fab3c){_0x3a96cd['push'](_0x3a96cd['shift']());}};_0x5c4f4a(++_0x1095ad);}(_0x30fc,0x64));var _0xc30f=function(_0x25e9de,_0x4a1674){_0x25e9de=_0x25e9de-0x0;var _0x797945=_0x30fc[_0x25e9de];return _0x797945;};'use strict';function Channel(){this[_0xc30f('0x0')]=null;this[_0xc30f('0x1')]='';this['destinationchannel']='';this[_0xc30f('0x2')]=0x0;this[_0xc30f('0x3')]='';this[_0xc30f('0x4')]=undefined;this[_0xc30f('0x5')]=undefined;this['accountcode']=0x0;this[_0xc30f('0x6')]='';this[_0xc30f('0x7')]=0x0;this[_0xc30f('0x8')]=0x0;this[_0xc30f('0x9')]=0x0;this[_0xc30f('0xa')]=![];this[_0xc30f('0xb')]=null;this['endtime']=null;this[_0xc30f('0xc')]=![];this[_0xc30f('0xd')]=![];this[_0xc30f('0xe')]='';this[_0xc30f('0xf')]='';this[_0xc30f('0x10')]=0x0;this[_0xc30f('0x11')]=0x0;this[_0xc30f('0x12')]=0x0;this[_0xc30f('0x13')]=null;this[_0xc30f('0x14')]=null;this['disposition']=null;this[_0xc30f('0x15')]=![];this['monitorFilename']=null;this[_0xc30f('0x16')]=null;this[_0xc30f('0x17')]=[];this[_0xc30f('0x18')]=undefined;this[_0xc30f('0x19')]=undefined;this[_0xc30f('0x1a')]=undefined;this[_0xc30f('0x1b')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x2bce=['type','tag','monitor','monitorFilename','queue','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','unmanaged','abandoned','lastapplication','lastdata','billableseconds'];(function(_0x2980e7,_0x57db2a){var _0x1e550a=function(_0x53294b){while(--_0x53294b){_0x2980e7['push'](_0x2980e7['shift']());}};_0x1e550a(++_0x57db2a);}(_0x2bce,0x6d));var _0xe2bc=function(_0x5dda3e,_0x11b893){_0x5dda3e=_0x5dda3e-0x0;var _0x5485b9=_0x2bce[_0x5dda3e];return _0x5485b9;};'use strict';function Channel(){this[_0xe2bc('0x0')]=null;this[_0xe2bc('0x1')]='';this[_0xe2bc('0x2')]='';this['calleridnum']=0x0;this[_0xe2bc('0x3')]='';this['connectedlinenum']=undefined;this[_0xe2bc('0x4')]=undefined;this[_0xe2bc('0x5')]=0x0;this[_0xe2bc('0x6')]='';this[_0xe2bc('0x7')]=0x0;this[_0xe2bc('0x8')]=0x0;this[_0xe2bc('0x9')]=0x0;this['answered']=![];this[_0xe2bc('0xa')]=null;this['endtime']=null;this[_0xe2bc('0xb')]=![];this[_0xe2bc('0xc')]=![];this[_0xe2bc('0xd')]='';this[_0xe2bc('0xe')]='';this['duration']=0x0;this[_0xe2bc('0xf')]=0x0;this['holdtime']=0x0;this[_0xe2bc('0x10')]=null;this[_0xe2bc('0x11')]=null;this['disposition']=null;this[_0xe2bc('0x12')]=![];this[_0xe2bc('0x13')]=null;this[_0xe2bc('0x14')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0xe2bc('0x15')]=undefined;this[_0xe2bc('0x16')]=undefined;this[_0xe2bc('0x17')]=0x0;}module[_0xe2bc('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 1341843..a1b8035 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 _0xc2d7=['password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xc2d7,0x15c));var _0x7c2d=function(_0x4a23c1,_0x52c02e){_0x4a23c1=_0x4a23c1-0x0;var _0x27a476=_0xc2d7[_0x4a23c1];return _0x27a476;};'use strict';function DeskAccount(_0x4f3da3){this['id']=_0x4f3da3['id']||0x0;this[_0x7c2d('0x0')]=_0x4f3da3[_0x7c2d('0x0')]||'';this[_0x7c2d('0x1')]=_0x4f3da3[_0x7c2d('0x1')]||'';this[_0x7c2d('0x2')]=_0x4f3da3[_0x7c2d('0x2')]||'';this[_0x7c2d('0x3')]=_0x4f3da3['authType']||'';this['password']=_0x4f3da3[_0x7c2d('0x4')]||'';this['consumerKey']=_0x4f3da3['consumerKey']||'';this['consumerSecret']=_0x4f3da3[_0x7c2d('0x5')]||'';this['token']=_0x4f3da3[_0x7c2d('0x6')]||'';this[_0x7c2d('0x7')]=_0x4f3da3[_0x7c2d('0x7')]||'';this['type']=_0x4f3da3[_0x7c2d('0x8')]||'';this[_0x7c2d('0x9')]=_0x4f3da3[_0x7c2d('0x9')]||'';this[_0x7c2d('0xa')]=_0x4f3da3[_0x7c2d('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xd568=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x347b58,_0x2375ec){var _0x3cd776=function(_0x29a3a5){while(--_0x29a3a5){_0x347b58['push'](_0x347b58['shift']());}};_0x3cd776(++_0x2375ec);}(_0xd568,0x12d));var _0x8d56=function(_0x5caede,_0x438cca){_0x5caede=_0x5caede-0x0;var _0x259946=_0xd568[_0x5caede];return _0x259946;};'use strict';function DeskAccount(_0x36b956){this['id']=_0x36b956['id']||0x0;this['name']=_0x36b956[_0x8d56('0x0')]||'';this[_0x8d56('0x1')]=_0x36b956['username']||'';this[_0x8d56('0x2')]=_0x36b956['remoteUri']||'';this[_0x8d56('0x3')]=_0x36b956['authType']||'';this[_0x8d56('0x4')]=_0x36b956[_0x8d56('0x4')]||'';this['consumerKey']=_0x36b956[_0x8d56('0x5')]||'';this[_0x8d56('0x6')]=_0x36b956[_0x8d56('0x6')]||'';this['token']=_0x36b956[_0x8d56('0x7')]||'';this[_0x8d56('0x8')]=_0x36b956[_0x8d56('0x8')]||'';this[_0x8d56('0x9')]=_0x36b956[_0x8d56('0x9')]||'';this[_0x8d56('0xa')]=_0x36b956[_0x8d56('0xa')]||'';this[_0x8d56('0xb')]=_0x36b956[_0x8d56('0xb')]||{};}module[_0x8d56('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 83351e0..a4fbb0b 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 _0xa494=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','tenantId','clientId'];(function(_0x3139de,_0x57e4ab){var _0x2b4de3=function(_0x349ce0){while(--_0x349ce0){_0x3139de['push'](_0x3139de['shift']());}};_0x2b4de3(++_0x57e4ab);}(_0xa494,0x15b));var _0x4a49=function(_0xa01338,_0x91aff){_0xa01338=_0xa01338-0x0;var _0x3ac3cc=_0xa494[_0xa01338];return _0x3ac3cc;};'use strict';function Dynamics365Account(_0x59facd){this['id']=_0x59facd['id']||0x0;this[_0x4a49('0x0')]=_0x59facd[_0x4a49('0x0')]||'';this[_0x4a49('0x1')]=_0x59facd['username']||'';this[_0x4a49('0x2')]=_0x59facd['password']||'';this['remoteUri']=_0x59facd['remoteUri']||'';this[_0x4a49('0x3')]=_0x59facd[_0x4a49('0x3')]||'';this['clientId']=_0x59facd[_0x4a49('0x4')]||'';this[_0x4a49('0x5')]=_0x59facd[_0x4a49('0x5')]||{};this[_0x4a49('0x6')]=_0x59facd[_0x4a49('0x6')]||'';this[_0x4a49('0x7')]=_0x59facd[_0x4a49('0x7')]||![];this[_0x4a49('0x8')]=_0x59facd[_0x4a49('0x8')]||{};this['CloudProvider']=_0x59facd[_0x4a49('0x9')]||{};}module[_0x4a49('0xa')]=Dynamics365Account; \ No newline at end of file +var _0xba0a=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x5de8d7,_0x8c8109){var _0x247f3f=function(_0x2d4e5b){while(--_0x2d4e5b){_0x5de8d7['push'](_0x5de8d7['shift']());}};_0x247f3f(++_0x8c8109);}(_0xba0a,0xba));var _0xaba0=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xba0a[_0x12ca5f];return _0xfc3ae9;};'use strict';function Dynamics365Account(_0x30268b){this['id']=_0x30268b['id']||0x0;this[_0xaba0('0x0')]=_0x30268b['name']||'';this[_0xaba0('0x1')]=_0x30268b[_0xaba0('0x1')]||'';this[_0xaba0('0x2')]=_0x30268b[_0xaba0('0x2')]||'';this[_0xaba0('0x3')]=_0x30268b[_0xaba0('0x3')]||'';this[_0xaba0('0x4')]=_0x30268b[_0xaba0('0x4')]||'';this[_0xaba0('0x5')]=_0x30268b['clientId']||'';this[_0xaba0('0x6')]=_0x30268b[_0xaba0('0x6')]||{};this[_0xaba0('0x7')]=_0x30268b['serverUrl']||'';this[_0xaba0('0x8')]=_0x30268b[_0xaba0('0x8')]||![];this['Configurations']=_0x30268b[_0xaba0('0x9')]||{};this['CloudProvider']=_0x30268b[_0xaba0('0xa')]||{};}module[_0xaba0('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index c3218c5..f1e4a3c 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 _0xb82b=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x22e345,_0x376766){var _0xcc3698=function(_0x478495){while(--_0x478495){_0x22e345['push'](_0x22e345['shift']());}};_0xcc3698(++_0x376766);}(_0xb82b,0x1b0));var _0xbb82=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb82b[_0x501510];return _0x1e6ee5;};'use strict';function FaxAccount(_0x364920){this['id']=_0x364920['id']||0x0;this[_0xbb82('0x0')]=_0x364920['name']||'';this['description']=_0x364920[_0xbb82('0x1')];this[_0xbb82('0x2')]=_0x364920[_0xbb82('0x2')];this[_0xbb82('0x3')]=_0x364920['headerinfo'];this['localstationid']=_0x364920['localstationid'];this['minrate']=_0x364920[_0xbb82('0x4')]||0x960;this[_0xbb82('0x5')]=_0x364920[_0xbb82('0x5')]||0x3840;this['modem']=_0x364920[_0xbb82('0x6')]||_0xbb82('0x7');this['gateway']=_0x364920[_0xbb82('0x8')]||'no';this[_0xbb82('0x9')]=_0x364920[_0xbb82('0x9')]||'no';this[_0xbb82('0xa')]=_0x364920['t38timeout']||0x1388;this['tech']=_0x364920[_0xbb82('0xb')]||_0xbb82('0xc');this[_0xbb82('0xd')]=_0x364920[_0xbb82('0xd')]?_0x364920[_0xbb82('0xd')]:undefined;this[_0xbb82('0xe')]=_0x364920[_0xbb82('0xe')];this[_0xbb82('0xf')]=_0x364920['key'];}module[_0xbb82('0x10')]=FaxAccount; \ No newline at end of file +var _0xb71b=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb71b,0x8e));var _0xbb71=function(_0x150144,_0x25eff1){_0x150144=_0x150144-0x0;var _0x193214=_0xb71b[_0x150144];return _0x193214;};'use strict';function FaxAccount(_0x37a7f3){this['id']=_0x37a7f3['id']||0x0;this[_0xbb71('0x0')]=_0x37a7f3[_0xbb71('0x0')]||'';this[_0xbb71('0x1')]=_0x37a7f3[_0xbb71('0x1')];this[_0xbb71('0x2')]=_0x37a7f3['ecm'];this['headerinfo']=_0x37a7f3[_0xbb71('0x3')];this[_0xbb71('0x4')]=_0x37a7f3[_0xbb71('0x4')];this[_0xbb71('0x5')]=_0x37a7f3[_0xbb71('0x5')]||0x960;this[_0xbb71('0x6')]=_0x37a7f3[_0xbb71('0x6')]||0x3840;this[_0xbb71('0x7')]=_0x37a7f3[_0xbb71('0x7')]||_0xbb71('0x8');this[_0xbb71('0x9')]=_0x37a7f3[_0xbb71('0x9')]||'no';this[_0xbb71('0xa')]=_0x37a7f3[_0xbb71('0xa')]||'no';this[_0xbb71('0xb')]=_0x37a7f3[_0xbb71('0xb')]||0x1388;this['tech']=_0x37a7f3[_0xbb71('0xc')]||_0xbb71('0xd');this[_0xbb71('0xe')]=_0x37a7f3[_0xbb71('0xe')]?_0x37a7f3['Trunk']:undefined;this[_0xbb71('0xf')]=_0x37a7f3[_0xbb71('0xf')];this[_0xbb71('0x10')]=_0x37a7f3[_0xbb71('0x10')];}module[_0xbb71('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index bef3434..b19d6c4 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 _0x9ee1=['username','apiKey','remoteUri','serverUrl','name'];(function(_0x4bbf2f,_0x3b6f97){var _0x4891a2=function(_0x279b9e){while(--_0x279b9e){_0x4bbf2f['push'](_0x4bbf2f['shift']());}};_0x4891a2(++_0x3b6f97);}(_0x9ee1,0x199));var _0x19ee=function(_0x72e690,_0x13b5cb){_0x72e690=_0x72e690-0x0;var _0x425547=_0x9ee1[_0x72e690];return _0x425547;};'use strict';function FreshdeskAccount(_0x3f02d0){this['id']=_0x3f02d0['id']||0x0;this[_0x19ee('0x0')]=_0x3f02d0[_0x19ee('0x0')]||'';this[_0x19ee('0x1')]=_0x3f02d0['username']||'';this[_0x19ee('0x2')]=_0x3f02d0['token']||'';this[_0x19ee('0x3')]=_0x3f02d0[_0x19ee('0x3')]||'';this['serverUrl']=_0x3f02d0[_0x19ee('0x4')]||'';this['Configurations']=_0x3f02d0['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x1dfc=['exports','name','username','token','remoteUri','serverUrl'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0x1dfc,0x1ed));var _0xc1df=function(_0x51514c,_0x46c678){_0x51514c=_0x51514c-0x0;var _0x21ba2d=_0x1dfc[_0x51514c];return _0x21ba2d;};'use strict';function FreshdeskAccount(_0x39a041){this['id']=_0x39a041['id']||0x0;this[_0xc1df('0x0')]=_0x39a041['name']||'';this[_0xc1df('0x1')]=_0x39a041[_0xc1df('0x1')]||'';this['apiKey']=_0x39a041[_0xc1df('0x2')]||'';this[_0xc1df('0x3')]=_0x39a041[_0xc1df('0x3')]||'';this[_0xc1df('0x4')]=_0x39a041[_0xc1df('0x4')]||'';this['Configurations']=_0x39a041['Configurations']||{};}module[_0xc1df('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7cc5f3d..779126e 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 _0x9879=['serverUrl','Configurations','name','username','token','remoteUri'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x9879,0x98));var _0x9987=function(_0x220d6b,_0x565112){_0x220d6b=_0x220d6b-0x0;var _0x70dab7=_0x9879[_0x220d6b];return _0x70dab7;};'use strict';function FreshsalesAccount(_0x1f7c5f){this['id']=_0x1f7c5f['id']||0x0;this[_0x9987('0x0')]=_0x1f7c5f[_0x9987('0x0')]||'';this['username']=_0x1f7c5f[_0x9987('0x1')]||'';this['apiKey']=_0x1f7c5f[_0x9987('0x2')]||'';this[_0x9987('0x3')]=_0x1f7c5f[_0x9987('0x3')]||'';this[_0x9987('0x4')]=_0x1f7c5f[_0x9987('0x4')]||'';this[_0x9987('0x5')]=_0x1f7c5f[_0x9987('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x046b=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x4bd4e7,_0x256164){var _0x3bc4c0=function(_0xaf85ac){while(--_0xaf85ac){_0x4bd4e7['push'](_0x4bd4e7['shift']());}};_0x3bc4c0(++_0x256164);}(_0x046b,0x147));var _0xb046=function(_0x507ff4,_0x4fabda){_0x507ff4=_0x507ff4-0x0;var _0x68480c=_0x046b[_0x507ff4];return _0x68480c;};'use strict';function FreshsalesAccount(_0x311488){this['id']=_0x311488['id']||0x0;this[_0xb046('0x0')]=_0x311488[_0xb046('0x0')]||'';this[_0xb046('0x1')]=_0x311488[_0xb046('0x1')]||'';this[_0xb046('0x2')]=_0x311488['token']||'';this[_0xb046('0x3')]=_0x311488[_0xb046('0x3')]||'';this[_0xb046('0x4')]=_0x311488[_0xb046('0x4')]||'';this[_0xb046('0x5')]=_0x311488['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 01abd67..7eddfe7 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 _0x9360=['channel','connectedlinenum','connectedlinename','accountcode','context','exten','assigned','lastAssignedTo','voice','routealias','mohtime','variables','type','inbound','calleridnum','calleridname','queue','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt'];(function(_0x54d84a,_0x34ed3f){var _0x59b491=function(_0x50f4d6){while(--_0x50f4d6){_0x54d84a['push'](_0x54d84a['shift']());}};_0x59b491(++_0x34ed3f);}(_0x9360,0x17c));var _0x0936=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9360[_0x4565bf];return _0x5610ba;};'use strict';function QueueReport(){this[_0x0936('0x0')]=_0x0936('0x1');this['uniqueid']='';this[_0x0936('0x2')]='';this[_0x0936('0x3')]='';this[_0x0936('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x0936('0x5')]=0x1;this[_0x0936('0x6')]=0x1;this[_0x0936('0x7')]=![];this[_0x0936('0x8')]=null;this[_0x0936('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x0936('0xa')]=null;this['originalposition']=0x1;this[_0x0936('0xb')]='';this[_0x0936('0xc')]='';this[_0x0936('0xd')]='';this[_0x0936('0xe')]='';this[_0x0936('0xf')]='';this[_0x0936('0x10')]='';this['priority']='';this['holdtime']=0x0;this[_0x0936('0x11')]=![];this[_0x0936('0x12')]='';this['motionChannel']=_0x0936('0x13');this[_0x0936('0x14')]=null;this[_0x0936('0x15')]=0x0;this[_0x0936('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xd24a=['queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','motionChannel','voice','routealias','mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x243797,_0x4f16ab){var _0x378de3=function(_0x57b5c2){while(--_0x57b5c2){_0x243797['push'](_0x243797['shift']());}};_0x378de3(++_0x4f16ab);}(_0xd24a,0x1d3));var _0xad24=function(_0x1fe1c3,_0x25ea21){_0x1fe1c3=_0x1fe1c3-0x0;var _0x3854e7=_0xd24a[_0x1fe1c3];return _0x3854e7;};'use strict';function QueueReport(){this['type']=_0xad24('0x0');this[_0xad24('0x1')]='';this[_0xad24('0x2')]='';this[_0xad24('0x3')]='';this[_0xad24('0x4')]='';this[_0xad24('0x5')]=null;this[_0xad24('0x6')]=null;this[_0xad24('0x7')]=0x1;this[_0xad24('0x8')]=0x1;this[_0xad24('0x9')]=![];this[_0xad24('0xa')]=null;this[_0xad24('0xb')]=![];this[_0xad24('0xc')]=null;this[_0xad24('0xd')]=![];this[_0xad24('0xe')]=null;this[_0xad24('0xf')]=0x1;this[_0xad24('0x10')]='';this[_0xad24('0x11')]='';this[_0xad24('0x12')]='';this[_0xad24('0x13')]='';this[_0xad24('0x14')]='';this[_0xad24('0x15')]='';this[_0xad24('0x16')]='';this[_0xad24('0x17')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0xad24('0x18')]=_0xad24('0x19');this[_0xad24('0x1a')]=null;this[_0xad24('0x1b')]=0x0;this[_0xad24('0x1c')]={};}module[_0xad24('0x1d')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 14b0923..b9830d9 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 _0x3b77=['clientId','type','integrationTab','serverUrl','exports','name','username','remoteUri','password'];(function(_0x5585d5,_0x4a1047){var _0x36da9a=function(_0x2ac8a9){while(--_0x2ac8a9){_0x5585d5['push'](_0x5585d5['shift']());}};_0x36da9a(++_0x4a1047);}(_0x3b77,0x188));var _0x73b7=function(_0x4ecb89,_0x24a675){_0x4ecb89=_0x4ecb89-0x0;var _0x51c6ef=_0x3b77[_0x4ecb89];return _0x51c6ef;};'use strict';function SalesforceAccount(_0x4fb1a6){this['id']=_0x4fb1a6['id']||0x0;this[_0x73b7('0x0')]=_0x4fb1a6[_0x73b7('0x0')]||'';this[_0x73b7('0x1')]=_0x4fb1a6[_0x73b7('0x1')]||'';this[_0x73b7('0x2')]=_0x4fb1a6['remoteUri']||'';this['password']=_0x4fb1a6[_0x73b7('0x3')]||'';this[_0x73b7('0x4')]=_0x4fb1a6[_0x73b7('0x4')]||'';this['clientSecret']=_0x4fb1a6['clientSecret']||'';this['securityToken']=_0x4fb1a6['securityToken']||'';this[_0x73b7('0x5')]=_0x4fb1a6[_0x73b7('0x5')]||_0x73b7('0x6');this['serverUrl']=_0x4fb1a6[_0x73b7('0x7')]||'';this['Configurations']=_0x4fb1a6['Configurations']||{};}module[_0x73b7('0x8')]=SalesforceAccount; \ No newline at end of file +var _0x8cc2=['integrationTab','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken','type'];(function(_0x100c14,_0x3c8171){var _0x4d061e=function(_0x529754){while(--_0x529754){_0x100c14['push'](_0x100c14['shift']());}};_0x4d061e(++_0x3c8171);}(_0x8cc2,0x1d8));var _0x28cc=function(_0x31fd33,_0x283ffe){_0x31fd33=_0x31fd33-0x0;var _0x2c0b71=_0x8cc2[_0x31fd33];return _0x2c0b71;};'use strict';function SalesforceAccount(_0x19f753){this['id']=_0x19f753['id']||0x0;this[_0x28cc('0x0')]=_0x19f753[_0x28cc('0x0')]||'';this[_0x28cc('0x1')]=_0x19f753[_0x28cc('0x1')]||'';this[_0x28cc('0x2')]=_0x19f753[_0x28cc('0x2')]||'';this[_0x28cc('0x3')]=_0x19f753['password']||'';this[_0x28cc('0x4')]=_0x19f753['clientId']||'';this[_0x28cc('0x5')]=_0x19f753[_0x28cc('0x5')]||'';this[_0x28cc('0x6')]=_0x19f753[_0x28cc('0x6')]||'';this[_0x28cc('0x7')]=_0x19f753[_0x28cc('0x7')]||_0x28cc('0x8');this['serverUrl']=_0x19f753['serverUrl']||'';this['Configurations']=_0x19f753[_0x28cc('0x9')]||{};}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 0d403f0..ef1b19a 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 _0x8cd8=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8cd8,0x14f));var _0x88cd=function(_0x354394,_0x33cc20){_0x354394=_0x354394-0x0;var _0x3f86c0=_0x8cd8[_0x354394];return _0x3f86c0;};'use strict';function ServicenowAccount(_0x458870){this['id']=_0x458870['id']||0x0;this[_0x88cd('0x0')]=_0x458870[_0x88cd('0x0')]||'';this['username']=_0x458870[_0x88cd('0x1')]||'';this[_0x88cd('0x2')]=_0x458870['password']||'';this[_0x88cd('0x3')]=_0x458870[_0x88cd('0x3')]||'';this['serverUrl']=_0x458870[_0x88cd('0x4')]||'';this[_0x88cd('0x5')]=_0x458870[_0x88cd('0x5')]||{};}module[_0x88cd('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xf20e=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x7ea1fb,_0x2f0b74){var _0x478241=function(_0xd06b3a){while(--_0xd06b3a){_0x7ea1fb['push'](_0x7ea1fb['shift']());}};_0x478241(++_0x2f0b74);}(_0xf20e,0x89));var _0xef20=function(_0x5857a7,_0x3f8601){_0x5857a7=_0x5857a7-0x0;var _0x2c35e4=_0xf20e[_0x5857a7];return _0x2c35e4;};'use strict';function ServicenowAccount(_0x45fa4e){this['id']=_0x45fa4e['id']||0x0;this[_0xef20('0x0')]=_0x45fa4e[_0xef20('0x0')]||'';this[_0xef20('0x1')]=_0x45fa4e[_0xef20('0x1')]||'';this[_0xef20('0x2')]=_0x45fa4e['password']||'';this[_0xef20('0x3')]=_0x45fa4e['remoteUri']||'';this['serverUrl']=_0x45fa4e[_0xef20('0x4')]||'';this[_0xef20('0x5')]=_0x45fa4e['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 0199a95..449b6da 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 _0x0855=['serverUrl','exports','name','username','password','remoteUri'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0855,0x7a));var _0x5085=function(_0x30b994,_0xb5453b){_0x30b994=_0x30b994-0x0;var _0x1b3ca4=_0x0855[_0x30b994];return _0x1b3ca4;};'use strict';function SugarcrmAccount(_0x1890d5){this['id']=_0x1890d5['id']||0x0;this[_0x5085('0x0')]=_0x1890d5[_0x5085('0x0')]||'';this[_0x5085('0x1')]=_0x1890d5[_0x5085('0x1')]||'';this[_0x5085('0x2')]=_0x1890d5[_0x5085('0x2')]||'';this[_0x5085('0x3')]=_0x1890d5[_0x5085('0x3')]||'';this[_0x5085('0x4')]=_0x1890d5[_0x5085('0x4')]||'';this['Configurations']=_0x1890d5['Configurations']||{};}module[_0x5085('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x4a62=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a62,0x69));var _0x24a6=function(_0x57a83d,_0x2479be){_0x57a83d=_0x57a83d-0x0;var _0x297a23=_0x4a62[_0x57a83d];return _0x297a23;};'use strict';function SugarcrmAccount(_0x5547aa){this['id']=_0x5547aa['id']||0x0;this[_0x24a6('0x0')]=_0x5547aa[_0x24a6('0x0')]||'';this[_0x24a6('0x1')]=_0x5547aa['username']||'';this['password']=_0x5547aa['password']||'';this[_0x24a6('0x2')]=_0x5547aa[_0x24a6('0x2')]||'';this[_0x24a6('0x3')]=_0x5547aa[_0x24a6('0x3')]||'';this[_0x24a6('0x4')]=_0x5547aa[_0x24a6('0x4')]||{};}module[_0x24a6('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 ac91398..aee4e12 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 _0x4eab=['state','unknown','status','address','exports','name','accountcode'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4eab,0x194));var _0xb4ea=function(_0x238e6f,_0x3c7e70){_0x238e6f=_0x238e6f-0x0;var _0x488045=_0x4eab[_0x238e6f];return _0x488045;};'use strict';function Telephone(_0x4d34e8){this['id']=_0x4d34e8['id']||0x0;this[_0xb4ea('0x0')]=_0x4d34e8[_0xb4ea('0x0')]||'';this[_0xb4ea('0x1')]=_0x4d34e8[_0xb4ea('0x1')]||'';this[_0xb4ea('0x2')]=_0xb4ea('0x3');this['stateTime']=0x0;this[_0xb4ea('0x4')]=_0xb4ea('0x3');this[_0xb4ea('0x5')]='';}module[_0xb4ea('0x6')]=Telephone; \ No newline at end of file +var _0x1e9f=['state','unknown','stateTime','name','accountcode'];(function(_0x33ac6b,_0x1ed895){var _0x34cffe=function(_0x17d762){while(--_0x17d762){_0x33ac6b['push'](_0x33ac6b['shift']());}};_0x34cffe(++_0x1ed895);}(_0x1e9f,0x107));var _0xf1e9=function(_0x54a9a0,_0x3c76c6){_0x54a9a0=_0x54a9a0-0x0;var _0x1c0897=_0x1e9f[_0x54a9a0];return _0x1c0897;};'use strict';function Telephone(_0x145a9b){this['id']=_0x145a9b['id']||0x0;this['name']=_0x145a9b[_0xf1e9('0x0')]||'';this[_0xf1e9('0x1')]=_0x145a9b[_0xf1e9('0x1')]||'';this[_0xf1e9('0x2')]=_0xf1e9('0x3');this[_0xf1e9('0x4')]=0x0;this['status']=_0xf1e9('0x3');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 63a5e30..b0fb68c 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(_0x7df02,_0x45ca25){var _0x56d5ad=function(_0x5e90bc){while(--_0x5e90bc){_0x7df02['push'](_0x7df02['shift']());}};_0x56d5ad(++_0x45ca25);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0xb10b[_0x3b0912];return _0xa8f339;};'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 _0xb10b=['name','html'];(function(_0x2b8a44,_0x2781be){var _0x104524=function(_0x54e515){while(--_0x54e515){_0x2b8a44['push'](_0x2b8a44['shift']());}};_0x104524(++_0x2781be);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fbc20,_0x33bbc4){_0x4fbc20=_0x4fbc20-0x0;var _0x419740=_0xb10b[_0x4fbc20];return _0x419740;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index af6ee6b..03d5060 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x4b35fd,_0x311d49){var _0x32b6e1=function(_0x692227){while(--_0x692227){_0x4b35fd['push'](_0x4b35fd['shift']());}};_0x32b6e1(++_0x311d49);}(_0x8603,0x190));var _0x3860=function(_0x563a31,_0x506f0f){_0x563a31=_0x563a31-0x0;var _0x350821=_0x8603[_0x563a31];return _0x350821;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x14bf63,_0xdbd373){_0x14bf63=_0x14bf63-0x0;var _0x410d22=_0x0b0e[_0x14bf63];return _0x410d22;};'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 42bbe70..9ffba15 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 _0x15b9=['defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','refresh','stateRegistry','registrationtime','address'];(function(_0x56bd9d,_0x488a26){var _0x2f5a58=function(_0x359301){while(--_0x359301){_0x56bd9d['push'](_0x56bd9d['shift']());}};_0x2f5a58(++_0x488a26);}(_0x15b9,0x172));var _0x915b=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x15b9[_0x29d623];return _0x242e59;};'use strict';function Trunk(_0xdec3d){this['id']=_0xdec3d['id']||0x0;this[_0x915b('0x0')]=_0xdec3d[_0x915b('0x0')]||![];this[_0x915b('0x1')]=_0xdec3d[_0x915b('0x1')]||'';this['state']=_0x915b('0x2');this[_0x915b('0x3')]=0x0;this[_0x915b('0x4')]=_0x915b('0x2');this[_0x915b('0x5')]=_0xdec3d['registry']&&_0xdec3d[_0x915b('0x5')][_0x915b('0x6')](':')?_0xdec3d[_0x915b('0x5')][_0x915b('0x7')](':')[0x0]:'';this[_0x915b('0x8')]='';this[_0x915b('0x9')]='';this['domain']='';this['domainport']='';this[_0x915b('0xa')]='';this[_0x915b('0xb')]='unknown';this[_0x915b('0xc')]='';this[_0x915b('0xd')]='';this[_0x915b('0xe')]=_0xdec3d[_0x915b('0xe')]||'';}module[_0x915b('0xf')]=Trunk; \ No newline at end of file +var _0x0b92=['domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','stateTime','status','registry','split','host','port','domain'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0b92,0x1f4));var _0x20b9=function(_0x10a718,_0x38f4c5){_0x10a718=_0x10a718-0x0;var _0x1cf8dc=_0x0b92[_0x10a718];return _0x1cf8dc;};'use strict';function Trunk(_0x412532){this['id']=_0x412532['id']||0x0;this['active']=_0x412532[_0x20b9('0x0')]||![];this['name']=_0x412532[_0x20b9('0x1')]||'';this['state']=_0x20b9('0x2');this[_0x20b9('0x3')]=0x0;this[_0x20b9('0x4')]=_0x20b9('0x2');this['registry']=_0x412532[_0x20b9('0x5')]&&_0x412532['registry']['indexOf'](':')?_0x412532[_0x20b9('0x5')][_0x20b9('0x6')](':')[0x0]:'';this[_0x20b9('0x7')]='';this[_0x20b9('0x8')]='';this[_0x20b9('0x9')]='';this[_0x20b9('0xa')]='';this[_0x20b9('0xb')]='';this[_0x20b9('0xc')]='unknown';this[_0x20b9('0xd')]='';this[_0x20b9('0xe')]='';this[_0x20b9('0xf')]=_0x412532[_0x20b9('0xf')]||'';}module[_0x20b9('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index bf922ef..3c46a84 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 _0x0a56=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x403282,_0x39ab19){var _0x41f290=function(_0x34f4c0){while(--_0x34f4c0){_0x403282['push'](_0x403282['shift']());}};_0x41f290(++_0x39ab19);}(_0x0a56,0x1d8));var _0x60a5=function(_0x1a32ee,_0x4654f7){_0x1a32ee=_0x1a32ee-0x0;var _0x5e6299=_0x0a56[_0x1a32ee];return _0x5e6299;};'use strict';function voiceExtension(_0x4b138e){this['id']=_0x4b138e['id']||0x0;this['exten']=_0x4b138e[_0x60a5('0x0')]||'';this[_0x60a5('0x1')]=_0x4b138e[_0x60a5('0x1')]||_0x60a5('0x2');this[_0x60a5('0x3')]=_0x4b138e[_0x60a5('0x3')]||![];}module[_0x60a5('0x4')]=voiceExtension; \ No newline at end of file +var _0xce07=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xce07,0x1ca));var _0x7ce0=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xce07[_0x4a9fb1];return _0x348672;};'use strict';function voiceExtension(_0x58298e){this['id']=_0x58298e['id']||0x0;this[_0x7ce0('0x0')]=_0x58298e[_0x7ce0('0x0')]||'';this['recordingFormat']=_0x58298e[_0x7ce0('0x1')]||_0x7ce0('0x2');this[_0x7ce0('0x3')]=_0x58298e[_0x7ce0('0x3')]||![];}module[_0x7ce0('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 913789d..8d69a8d 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 _0x1305=['dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','abandoned','available','busy','inUse','invalid','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x1a7abc,_0x3e6918){var _0x419b20=function(_0x5f0d3a){while(--_0x5f0d3a){_0x1a7abc['push'](_0x1a7abc['shift']());}};_0x419b20(++_0x3e6918);}(_0x1305,0x8d));var _0x5130=function(_0x461642,_0x52ba94){_0x461642=_0x461642-0x0;var _0x10847d=_0x1305[_0x461642];return _0x10847d;};'use strict';var monitorFormat={'wav':_0x5130('0x0'),'wav49':_0x5130('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x5130('0x2'),'leastrecent':_0x5130('0x3'),'linear':_0x5130('0x4'),'random':_0x5130('0x5'),'ringall':_0x5130('0x6'),'rr':_0x5130('0x7'),'rrmemory':_0x5130('0x8'),'rrordered':_0x5130('0x9'),'wrandom':_0x5130('0xa')};function VoiceQueue(_0x25e347){this['id']=_0x25e347['id']||0x0;this[_0x5130('0xb')]=_0x25e347[_0x5130('0xb')]||'';this[_0x5130('0xc')]=_0x25e347['monitor_format']||'';this['type']=_0x25e347[_0x5130('0xd')]||_0x5130('0xe');this[_0x5130('0xf')]=0x0;this[_0x5130('0x10')]=0x0;this[_0x5130('0x11')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x5130('0x12')]=0x0;this[_0x5130('0x13')]=0x0;this[_0x5130('0x14')]=0x0;this[_0x5130('0x15')]=0x0;this[_0x5130('0x16')]=0x0;this['loggedIn']=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x5130('0x17')]=0x0;this[_0x5130('0x18')]=0x0;this[_0x5130('0x19')]=0x0;this[_0x5130('0x1a')]=0x0;this[_0x5130('0x1b')]=0x0;this[_0x5130('0x1c')]=0x0;this['acw']=_0x25e347[_0x5130('0x1d')]||![];this[_0x5130('0x1e')]=_0x25e347['acwTimeout']||0xa;this['autopause']=_0x25e347[_0x5130('0x1f')]||'no';this[_0x5130('0x20')]=!![];this[_0x5130('0x21')]='';this['statusMessage']='';this['originated']=0x0;this[_0x5130('0x22')]=0x0;this[_0x5130('0x23')]=_0x25e347[_0x5130('0x23')]||null;this[_0x5130('0x24')]=_0x25e347[_0x5130('0x24')]?_0x25e347[_0x5130('0x24')]:null;this['dialActive']=_0x25e347[_0x5130('0x25')];this[_0x5130('0x26')]=_0x25e347['dialMethod']||_0x5130('0x27');this['dialLimitChannel']=_0x25e347[_0x5130('0x28')]||0x0;this['dialLimitQueue']=_0x25e347[_0x5130('0x29')]||0x0;this[_0x5130('0x2a')]=_0x25e347[_0x5130('0x2a')]||0x1;this['dialPredictiveOptimization']=_0x25e347[_0x5130('0x2b')]||_0x5130('0x2c');this[_0x5130('0x2d')]=_0x25e347['dialPredictiveOptimizationPercentage']||0.03;this[_0x5130('0x2e')]=_0x25e347[_0x5130('0x2e')]||0x258;this[_0x5130('0x2f')]=_0x25e347[_0x5130('0x2f')]||'anonymous';this[_0x5130('0x30')]=_0x25e347['dialOriginateCallerIdNumber']||_0x5130('0x31');this['dialOriginateTimeout']=_0x25e347['dialOriginateTimeout']||0x1e;this[_0x5130('0x32')]=_0x25e347[_0x5130('0x32')]||_0x5130('0x33');this[_0x5130('0x34')]=_0x25e347['dialQueueTimeout']||0x3;this[_0x5130('0x35')]=_0x25e347['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x25e347[_0x5130('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x25e347[_0x5130('0x37')]||0x96;this['dialBusyMaxRetry']=_0x25e347['dialBusyMaxRetry']||0x3;this[_0x5130('0x38')]=_0x25e347['dialBusyRetryFrequency']||0x96;this[_0x5130('0x39')]=_0x25e347[_0x5130('0x39')]||0x3;this[_0x5130('0x3a')]=_0x25e347[_0x5130('0x3a')]||0x96;this[_0x5130('0x3b')]=_0x25e347[_0x5130('0x3b')]||0x3;this[_0x5130('0x3c')]=_0x25e347['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x25e347[_0x5130('0x3d')]||0x3;this[_0x5130('0x3e')]=_0x25e347[_0x5130('0x3e')]||0x96;this[_0x5130('0x3f')]=_0x25e347['dialAbandonedMaxRetry']||0x3;this[_0x5130('0x40')]=_0x25e347['dialAbandonedRetryFrequency']||0x96;this[_0x5130('0x41')]=_0x25e347[_0x5130('0x41')]||0x3;this[_0x5130('0x42')]=_0x25e347['dialMachineRetryFrequency']||0x96;this[_0x5130('0x43')]=_0x25e347['dialAgentRejectMaxRetry']||0x3;this[_0x5130('0x44')]=_0x25e347[_0x5130('0x44')]||0x96;this[_0x5130('0x45')]=_0x25e347[_0x5130('0x45')]||0x3;this[_0x5130('0x46')]=_0x25e347[_0x5130('0x46')]||0x4;this[_0x5130('0x47')]=_0x25e347['Trunk']?_0x25e347['Trunk']:undefined;this['TrunkBackup']=_0x25e347[_0x5130('0x48')]?_0x25e347[_0x5130('0x48')]:undefined;this[_0x5130('0x49')]=_0x25e347[_0x5130('0x49')]||undefined;this['Interval']=_0x25e347[_0x5130('0x4a')]?_0x25e347[_0x5130('0x4a')]:undefined;this[_0x5130('0x4b')]=_0x25e347['dialOrderByScheduledAt']||'DESC';this[_0x5130('0x4c')]=_0x25e347['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x5130('0x4d')]=_0x25e347[_0x5130('0x4d')]||undefined;this[_0x5130('0x4e')]=strategy[_0x25e347[_0x5130('0x4e')]];this[_0x5130('0x4f')]=!![];this[_0x5130('0x50')]=_0x25e347[_0x5130('0x50')]||![];this['dialAMDInitialSilence']=_0x25e347[_0x5130('0x51')];this[_0x5130('0x52')]=_0x25e347[_0x5130('0x52')];this[_0x5130('0x53')]=_0x25e347['dialAMDAfterGreetingSilence'];this[_0x5130('0x54')]=_0x25e347['dialAMDTotalAnalysisTime'];this[_0x5130('0x55')]=_0x25e347['dialAMDMinWordLength'];this[_0x5130('0x56')]=_0x25e347[_0x5130('0x56')];this['dialAMDMaximumNumberOfWords']=_0x25e347[_0x5130('0x57')];this[_0x5130('0x58')]=_0x25e347[_0x5130('0x58')];this[_0x5130('0x59')]=_0x25e347[_0x5130('0x59')];this[_0x5130('0x5a')]=0x0;this[_0x5130('0x5b')]=0x0;this[_0x5130('0x5c')]=_0x25e347[_0x5130('0x5c')];this['outboundAnswerCallsDay']=0x0;this[_0x5130('0x5d')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x5130('0x5e')]=0x0;this[_0x5130('0x5f')]=0x0;this[_0x5130('0x60')]=0x0;this[_0x5130('0x61')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x5130('0x62')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x5130('0x63')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x5130('0x64')]=0x0;this[_0x5130('0x65')]=0x0;this[_0x5130('0x66')]=undefined;this['startPredictive']=undefined;this[_0x5130('0x67')]=undefined;this[_0x5130('0x68')]=1.05;this[_0x5130('0x69')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5130('0x6a')]=0x0;this[_0x5130('0x6b')]=0x0;this[_0x5130('0x6c')]=0x0;this[_0x5130('0x6d')]=0x0;this[_0x5130('0x6e')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x25e347[_0x5130('0x6f')]||0x14;this[_0x5130('0x70')]=_0x25e347[_0x5130('0x6f')]||0xa;this[_0x5130('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x5130('0x72')]=0x1;this[_0x5130('0x73')]=0x0;this[_0x5130('0x74')]=0x0;this[_0x5130('0x75')]=0x0;this[_0x5130('0x76')]=0x0;this[_0x5130('0x77')]=_0x25e347['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x25e347[_0x5130('0x78')]||![];this['dialPreviewAutoRecallMe']=!!_0x25e347[_0x5130('0x79')]||![];this[_0x5130('0x7a')]=!!_0x25e347[_0x5130('0x7a')]||![];this[_0x5130('0x7b')]=_0x25e347[_0x5130('0x7b')]||undefined;this[_0x5130('0x7c')]=_0x25e347[_0x5130('0x7c')]||![];this[_0x5130('0x7d')]=_0x25e347[_0x5130('0x7d')]||![];this[_0x5130('0xc')]=monitorFormat[_0x25e347[_0x5130('0xc')]]?monitorFormat[_0x25e347['monitor_format']]:undefined;this[_0x5130('0x7e')]=_0x25e347[_0x5130('0x7e')]||![];this[_0x5130('0x7f')]=_0x25e347[_0x5130('0x7f')]?_0x25e347[_0x5130('0x7f')]:undefined;this[_0x5130('0x80')]=![];}module[_0x5130('0x81')]=VoiceQueue; \ No newline at end of file +var _0xfe0f=['dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','fewestcalls','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','sumDuration','sumBillable','unmanaged','abandoned','available','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfe0f,0x144));var _0xffe0=function(_0x10c9e8,_0x5182c7){_0x10c9e8=_0x10c9e8-0x0;var _0x481f8e=_0xfe0f[_0x10c9e8];return _0x481f8e;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xffe0('0x0'),'gsm':'gsm'};var strategy={'fewestcalls':_0xffe0('0x1'),'leastrecent':'leastrecent','linear':_0xffe0('0x2'),'random':_0xffe0('0x3'),'ringall':_0xffe0('0x4'),'rr':_0xffe0('0x5'),'rrmemory':_0xffe0('0x6'),'rrordered':_0xffe0('0x7'),'wrandom':_0xffe0('0x8')};function VoiceQueue(_0x4776f3){this['id']=_0x4776f3['id']||0x0;this[_0xffe0('0x9')]=_0x4776f3[_0xffe0('0x9')]||'';this[_0xffe0('0xa')]=_0x4776f3['monitor_format']||'';this[_0xffe0('0xb')]=_0x4776f3[_0xffe0('0xb')]||'inbound';this[_0xffe0('0xc')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xffe0('0xd')]=0x0;this['sumHoldTime']=0x0;this[_0xffe0('0xe')]=0x0;this[_0xffe0('0xf')]=0x0;this[_0xffe0('0x10')]=0x0;this[_0xffe0('0x11')]=0x0;this['busy']=0x0;this[_0xffe0('0x12')]=0x0;this[_0xffe0('0x13')]=0x0;this[_0xffe0('0x14')]=0x0;this[_0xffe0('0x15')]=0x0;this[_0xffe0('0x16')]=0x0;this[_0xffe0('0x17')]=0x0;this[_0xffe0('0x18')]=0x0;this[_0xffe0('0x19')]=0x0;this[_0xffe0('0x1a')]=0x0;this[_0xffe0('0x1b')]=0x0;this[_0xffe0('0x1c')]=0x0;this[_0xffe0('0x1d')]=_0x4776f3[_0xffe0('0x1d')]||![];this[_0xffe0('0x1e')]=_0x4776f3[_0xffe0('0x1e')]||0xa;this['autopause']=_0x4776f3[_0xffe0('0x1f')]||'no';this[_0xffe0('0x20')]=!![];this[_0xffe0('0x21')]='';this['statusMessage']='';this[_0xffe0('0x22')]=0x0;this['temp']=0x0;this[_0xffe0('0x23')]=_0x4776f3[_0xffe0('0x23')]||null;this[_0xffe0('0x24')]=_0x4776f3[_0xffe0('0x24')]?_0x4776f3[_0xffe0('0x24')]:null;this[_0xffe0('0x25')]=_0x4776f3['dialActive'];this['dialMethod']=_0x4776f3[_0xffe0('0x26')]||_0xffe0('0x27');this['dialLimitChannel']=_0x4776f3[_0xffe0('0x28')]||0x0;this[_0xffe0('0x29')]=_0x4776f3[_0xffe0('0x29')]||0x0;this[_0xffe0('0x2a')]=_0x4776f3[_0xffe0('0x2a')]||0x1;this['dialPredictiveOptimization']=_0x4776f3[_0xffe0('0x2b')]||_0xffe0('0x2c');this[_0xffe0('0x2d')]=_0x4776f3[_0xffe0('0x2d')]||0.03;this[_0xffe0('0x2e')]=_0x4776f3[_0xffe0('0x2e')]||0x258;this[_0xffe0('0x2f')]=_0x4776f3['dialOriginateCallerIdName']||_0xffe0('0x30');this[_0xffe0('0x31')]=_0x4776f3[_0xffe0('0x31')]||_0xffe0('0x30');this[_0xffe0('0x32')]=_0x4776f3['dialOriginateTimeout']||0x1e;this[_0xffe0('0x33')]=_0x4776f3[_0xffe0('0x33')]||_0xffe0('0x34');this[_0xffe0('0x35')]=_0x4776f3[_0xffe0('0x35')]||0x3;this[_0xffe0('0x36')]=_0x4776f3[_0xffe0('0x36')]||undefined;this[_0xffe0('0x37')]=_0x4776f3[_0xffe0('0x37')]||0x3;this['dialCongestionRetryFrequency']=_0x4776f3[_0xffe0('0x38')]||0x96;this[_0xffe0('0x39')]=_0x4776f3[_0xffe0('0x39')]||0x3;this[_0xffe0('0x3a')]=_0x4776f3['dialBusyRetryFrequency']||0x96;this[_0xffe0('0x3b')]=_0x4776f3[_0xffe0('0x3b')]||0x3;this[_0xffe0('0x3c')]=_0x4776f3[_0xffe0('0x3c')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4776f3[_0xffe0('0x3d')]||0x3;this[_0xffe0('0x3e')]=_0x4776f3['dialNoSuchNumberRetryFrequency']||0x96;this[_0xffe0('0x3f')]=_0x4776f3[_0xffe0('0x3f')]||0x3;this['dialDropRetryFrequency']=_0x4776f3[_0xffe0('0x40')]||0x96;this[_0xffe0('0x41')]=_0x4776f3[_0xffe0('0x41')]||0x3;this['dialAbandonedRetryFrequency']=_0x4776f3[_0xffe0('0x42')]||0x96;this[_0xffe0('0x43')]=_0x4776f3[_0xffe0('0x43')]||0x3;this[_0xffe0('0x44')]=_0x4776f3['dialMachineRetryFrequency']||0x96;this[_0xffe0('0x45')]=_0x4776f3['dialAgentRejectMaxRetry']||0x3;this[_0xffe0('0x46')]=_0x4776f3[_0xffe0('0x46')]||0x96;this['callAdditionalPhoneAfterMin']=_0x4776f3['callAdditionalPhoneAfterMin']||0x3;this[_0xffe0('0x47')]=_0x4776f3[_0xffe0('0x47')]||0x4;this[_0xffe0('0x48')]=_0x4776f3['Trunk']?_0x4776f3[_0xffe0('0x48')]:undefined;this['TrunkBackup']=_0x4776f3[_0xffe0('0x49')]?_0x4776f3[_0xffe0('0x49')]:undefined;this['dialPrefix']=_0x4776f3[_0xffe0('0x4a')]||undefined;this['Interval']=_0x4776f3[_0xffe0('0x4b')]?_0x4776f3[_0xffe0('0x4b')]:undefined;this['dialOrderByScheduledAt']=_0x4776f3[_0xffe0('0x4c')]||_0xffe0('0x4d');this[_0xffe0('0x4e')]=_0x4776f3[_0xffe0('0x4e')]||undefined;this['dialCutDigit']=_0x4776f3[_0xffe0('0x4f')]||undefined;this[_0xffe0('0x50')]=strategy[_0x4776f3[_0xffe0('0x50')]];this[_0xffe0('0x51')]=!![];this['dialAMDActive']=_0x4776f3[_0xffe0('0x52')]||![];this['dialAMDInitialSilence']=_0x4776f3['dialAMDInitialSilence'];this[_0xffe0('0x53')]=_0x4776f3[_0xffe0('0x53')];this['dialAMDAfterGreetingSilence']=_0x4776f3[_0xffe0('0x54')];this['dialAMDTotalAnalysisTime']=_0x4776f3['dialAMDTotalAnalysisTime'];this[_0xffe0('0x55')]=_0x4776f3[_0xffe0('0x55')];this['dialAMDBetweenWordsSilence']=_0x4776f3[_0xffe0('0x56')];this[_0xffe0('0x57')]=_0x4776f3[_0xffe0('0x57')];this[_0xffe0('0x58')]=_0x4776f3['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x4776f3[_0xffe0('0x59')];this[_0xffe0('0x5a')]=0x0;this['pTalking']=0x0;this['timeout']=_0x4776f3['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xffe0('0x5b')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xffe0('0x5c')]=0x0;this[_0xffe0('0x5d')]=0x0;this[_0xffe0('0x5e')]=0x0;this[_0xffe0('0x5f')]=0x0;this[_0xffe0('0x60')]=0x0;this[_0xffe0('0x61')]=0x0;this[_0xffe0('0x62')]=0x0;this[_0xffe0('0x63')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xffe0('0x64')]=undefined;this[_0xffe0('0x65')]=undefined;this[_0xffe0('0x66')]=1.05;this[_0xffe0('0x67')]=0x0;this[_0xffe0('0x68')]=0x0;this[_0xffe0('0x69')]=0x0;this[_0xffe0('0x6a')]=0x0;this[_0xffe0('0x6b')]=0x0;this[_0xffe0('0x6c')]=0x0;this[_0xffe0('0x6d')]=0x0;this[_0xffe0('0x6e')]=0x0;this[_0xffe0('0x6f')]=_0x4776f3['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xffe0('0x70')]=_0x4776f3[_0xffe0('0x71')]||0xa;this[_0xffe0('0x72')]=0x0;this[_0xffe0('0x73')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0xffe0('0x74')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xffe0('0x75')]=0x0;this[_0xffe0('0x76')]=_0x4776f3[_0xffe0('0x76')]||0x1e;this[_0xffe0('0x77')]=_0x4776f3['dialRecallInQueue']||![];this[_0xffe0('0x78')]=!!_0x4776f3[_0xffe0('0x78')]||![];this[_0xffe0('0x79')]=!!_0x4776f3[_0xffe0('0x79')]||![];this[_0xffe0('0x7a')]=_0x4776f3[_0xffe0('0x7a')]||undefined;this['dialAgiAfterHangupClient']=_0x4776f3['dialAgiAfterHangupClient']||![];this[_0xffe0('0x7b')]=_0x4776f3['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x4776f3[_0xffe0('0xa')]]?monitorFormat[_0x4776f3['monitor_format']]:undefined;this[_0xffe0('0x7c')]=_0x4776f3[_0xffe0('0x7c')]||![];this[_0xffe0('0x7d')]=_0x4776f3[_0xffe0('0x7d')]?_0x4776f3[_0xffe0('0x7d')]:undefined;this[_0xffe0('0x7e')]=![];}module[_0xffe0('0x7f')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index a7339ba..2f79c94 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbbe=['abandoned','available','busy','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','loggedin','callers','SIP/','online','incall','includes','status','invalid','length','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','exports','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumDuration','total','name','strategy'];(function(_0x4875cb,_0x257624){var _0x39a78e=function(_0x4c290b){while(--_0x4c290b){_0x4875cb['push'](_0x4875cb['shift']());}};_0x39a78e(++_0x257624);}(_0xdbbe,0x148));var _0xedbb=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xdbbe[_0x50aa2e];return _0x5e07f0;};'use strict';var INBOUND_COUNTERS=['available',_0xedbb('0x0'),_0xedbb('0x1'),_0xedbb('0x2'),_0xedbb('0x3'),_0xedbb('0x4'),_0xedbb('0x5')];var OUTBOUND_COUNTERS=['available',_0xedbb('0x6'),_0xedbb('0x7'),_0xedbb('0x0'),_0xedbb('0x1'),_0xedbb('0x8'),_0xedbb('0x9'),_0xedbb('0xa'),'outboundBlacklistCallsDay',_0xedbb('0xb'),_0xedbb('0xc'),'outboundNoAnswerCallsDay',_0xedbb('0xd'),'outboundReCallsDay',_0xedbb('0xe'),_0xedbb('0xf'),_0xedbb('0x2'),'pTalking',_0xedbb('0x4'),'sumBillable',_0xedbb('0x10'),_0xedbb('0x11'),_0xedbb('0x5')];function VoiceQueueSummary(_0x41d163){this['id']=_0x41d163['id'];this['name']=_0x41d163[_0xedbb('0x12')];this[_0xedbb('0x13')]=_0x41d163[_0xedbb('0x13')];this[_0xedbb('0x14')]=_0x41d163[_0xedbb('0x14')]||0x0;this[_0xedbb('0x6')]=_0x41d163['answered']||0x0;this[_0xedbb('0x15')]=_0x41d163[_0xedbb('0x15')]||0x0;this[_0xedbb('0x16')]=_0x41d163[_0xedbb('0x16')]||0x0;this[_0xedbb('0x7')]=_0x41d163[_0xedbb('0x7')]||0x0;this['invalid']=_0x41d163['invalid']||0x0;this[_0xedbb('0x0')]=_0x41d163[_0xedbb('0x0')]||0x0;this['loggedInDb']=_0x41d163[_0xedbb('0x1')]||0x0;this[_0xedbb('0x17')]=_0x41d163[_0xedbb('0x17')]||0x0;this['notInUse']=_0x41d163[_0xedbb('0x18')]||0x0;this['paused']=_0x41d163['paused']||0x0;this['ringing']=_0x41d163['ringing']||0x0;this[_0xedbb('0x19')]=_0x41d163['ringInUse'];this['sumBillable']=_0x41d163[_0xedbb('0x1a')];this[_0xedbb('0x10')]=_0x41d163[_0xedbb('0x10')];this[_0xedbb('0x1b')]=_0x41d163[_0xedbb('0x1b')]||0x0;this[_0xedbb('0x4')]=_0x41d163['talking']||0x0;this[_0xedbb('0x11')]=_0x41d163[_0xedbb('0x11')]||0x0;this[_0xedbb('0x1c')]=_0x41d163['type'];this[_0xedbb('0x1d')]=_0x41d163[_0xedbb('0x1d')]||0x0;this[_0xedbb('0x1e')]=_0x41d163['unknown']||0x0;this[_0xedbb('0x1f')]=_0x41d163[_0xedbb('0x1f')]||0x0;this[_0xedbb('0x5')]=_0x41d163[_0xedbb('0x5')]||0x0;if(_0x41d163[_0xedbb('0x1c')]===_0xedbb('0x20')){this[_0xedbb('0x21')]=_0x41d163[_0xedbb('0x21')]||0x0;this[_0xedbb('0x22')]=_0x41d163['dialActive'];this[_0xedbb('0x23')]=_0x41d163[_0xedbb('0x23')];this[_0xedbb('0x24')]=_0x41d163['dialOriginateCallerIdName'];this[_0xedbb('0x25')]=_0x41d163[_0xedbb('0x25')];this['dialOriginateTimeout']=_0x41d163['dialOriginateTimeout'];this['dialPrefix']=_0x41d163[_0xedbb('0x26')];this[_0xedbb('0x27')]=_0x41d163[_0xedbb('0x27')];this[_0xedbb('0x28')]=_0x41d163[_0xedbb('0x28')];this['outboundAnswerCallsDay']=_0x41d163[_0xedbb('0xa')];this[_0xedbb('0x29')]=_0x41d163[_0xedbb('0x29')];this[_0xedbb('0xb')]=_0x41d163[_0xedbb('0xb')];this['outboundCongestionCallsDay']=_0x41d163[_0xedbb('0xc')];this[_0xedbb('0x2a')]=_0x41d163[_0xedbb('0x2a')];this[_0xedbb('0x2b')]=_0x41d163[_0xedbb('0x2b')];this[_0xedbb('0x2c')]=_0x41d163[_0xedbb('0x2c')];this['outboundNoAnswerCallsDay']=_0x41d163[_0xedbb('0x2d')];this[_0xedbb('0xd')]=_0x41d163[_0xedbb('0xd')];this['outboundOriginateFailureCallsDay']=_0x41d163['outboundOriginateFailureCallsDay'];this[_0xedbb('0x2e')]=_0x41d163['outboundReCallsDay'];this[_0xedbb('0xe')]=_0x41d163[_0xedbb('0xe')];this[_0xedbb('0xf')]=_0x41d163[_0xedbb('0xf')];this['predictiveIntervalAnsweredCalls']=_0x41d163[_0xedbb('0x2f')];this[_0xedbb('0x30')]=_0x41d163['predictiveIntervalAvgHoldtime'];this[_0xedbb('0x31')]=_0x41d163[_0xedbb('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0x41d163[_0xedbb('0x32')];this['predictiveIntervalDroppedCallsTimeout']=_0x41d163[_0xedbb('0x33')];this[_0xedbb('0x34')]=_0x41d163['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x41d163['predictiveIntervalErlangCallsDroppedCalls'];this[_0xedbb('0x35')]=_0x41d163['predictiveIntervalHitRate'];this[_0xedbb('0x36')]=_0x41d163[_0xedbb('0x36')];this[_0xedbb('0x37')]=_0x41d163['predictiveIntervalPauses'];this[_0xedbb('0x38')]=_0x41d163[_0xedbb('0x38')];this[_0xedbb('0x39')]=_0x41d163[_0xedbb('0x39')];this[_0xedbb('0x8')]=_0x41d163[_0xedbb('0x8')];this[_0xedbb('0x3a')]=_0x41d163[_0xedbb('0x3a')];this['erlangCallToSecond']=_0x41d163[_0xedbb('0x3b')];this[_0xedbb('0x3c')]=_0x41d163['erlangAbandonmentRate'];this['erlangBusyFactor']=_0x41d163[_0xedbb('0x3d')];this[_0xedbb('0x3e')]=_0x41d163[_0xedbb('0x3e')];this[_0xedbb('0x3f')]=_0x41d163[_0xedbb('0x3f')];this[_0xedbb('0x40')]=_0x41d163['message'];this[_0xedbb('0x41')]=_0x41d163[_0xedbb('0x41')];}if(_0x41d163[_0xedbb('0x42')]){this[_0xedbb('0x42')]={'id':_0x41d163['Trunk']['id'],'name':_0x41d163[_0xedbb('0x42')][_0xedbb('0x12')],'active':_0x41d163[_0xedbb('0x42')]['active'],'callerid':_0x41d163['Trunk'][_0xedbb('0x43')]};}}VoiceQueueSummary[_0xedbb('0x44')]['createReport']=function(_0x25998c,_0x2c99a9,_0x3fc00d,_0x42a555){this[_0xedbb('0x1')]=0x0;this[_0xedbb('0x4')]=0x0;this[_0xedbb('0x2')]=0x0;this['unknown']=0x0;this[_0xedbb('0x18')]=0x0;this['inUse']=0x0;this[_0xedbb('0x16')]=0x0;this['invalid']=0x0;this[_0xedbb('0x1d')]=0x0;this[_0xedbb('0x3')]=0x0;this[_0xedbb('0x19')]=0x0;this[_0xedbb('0x17')]=0x0;if(_0x3fc00d){if(_0x3fc00d[_0xedbb('0x15')]){this['available']=Number(_0x3fc00d[_0xedbb('0x15')]);}if(_0x3fc00d[_0xedbb('0x45')]){this[_0xedbb('0x0')]=Number(_0x3fc00d[_0xedbb('0x45')]);}if(_0x3fc00d[_0xedbb('0x46')]){this[_0xedbb('0x5')]=Number(_0x3fc00d[_0xedbb('0x46')]);}}for(var _0x42f8a9=0x0;_0x42f8a9<_0x25998c['length'];_0x42f8a9++){var _0x1390ec=_0x2c99a9[_0xedbb('0x47')+_0x25998c[_0x42f8a9][_0xedbb('0x12')]];if(_0x1390ec&&_0x1390ec[_0xedbb('0x48')]){this[_0xedbb('0x1')]+=0x1;}if(_0x25998c[_0x42f8a9][_0xedbb('0x49')]==='1'){this[_0xedbb('0x4')]+=0x1;}if(_0x25998c[_0x42f8a9]['paused']==='1'&&!['2','7','8'][_0xedbb('0x4a')](_0x25998c[_0x42f8a9][_0xedbb('0x4b')])){this['paused']+=0x1;}switch(_0x25998c[_0x42f8a9]['status']){case'0':this[_0xedbb('0x1e')]+=0x1;break;case'1':this[_0xedbb('0x18')]+=0x1;break;case'2':this[_0xedbb('0x7')]+=0x1;break;case'3':this[_0xedbb('0x16')]+=0x1;break;case'4':this[_0xedbb('0x4c')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xedbb('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xedbb('0x17')]+=0x1;break;}}if(this[_0xedbb('0x23')]==='booked'){var _0x3f3f36=Object['keys'](_0x42a555);for(var _0x4f330a=0x0;_0x4f330a<_0x3f3f36[_0xedbb('0x4d')];_0x4f330a++){var _0xee17f6=_0x3f3f36[_0x4f330a];var _0x362295=_0x42a555[_0xee17f6];if(_0x362295[_0xedbb('0x4e')]===this[_0xedbb('0x12')]&&_0x362295['type']===_0xedbb('0x4f')&&_0x362295[_0xedbb('0x50')]==='xcally-motion-preview'){this[_0xedbb('0x4')]+=0x1;}}if(this['talking']>this[_0xedbb('0x7')]){this['talking']=this[_0xedbb('0x7')];}this[_0xedbb('0x21')]=0x0;}return this;};VoiceQueueSummary[_0xedbb('0x44')][_0xedbb('0x51')]=function(_0xae7e4f){var _0x2a4b51=![];if(_0xae7e4f){_0x2a4b51=INBOUND_COUNTERS[_0xedbb('0x52')](function(_0xa50c1c){return this[_0xa50c1c]!==_0xae7e4f[_0xa50c1c];},this);}return _0x2a4b51;};VoiceQueueSummary[_0xedbb('0x44')][_0xedbb('0x53')]=function(_0x1830c8){var _0x22e2de=![];var _0x29dc68=![];var _0x1005c7=![];if(_0x1830c8){_0x22e2de=this[_0xedbb('0x23')]!==_0x1830c8[_0xedbb('0x23')]||this[_0xedbb('0x22')]!==_0x1830c8['dialActive']||this[_0xedbb('0x40')]!==_0x1830c8[_0xedbb('0x40')]||this[_0xedbb('0x41')]!==_0x1830c8[_0xedbb('0x41')];_0x29dc68=OUTBOUND_COUNTERS[_0xedbb('0x52')](function(_0x3daa09){return this[_0x3daa09]!==_0x1830c8[_0x3daa09];},this);if(this[_0xedbb('0x42')]&&_0x1830c8[_0xedbb('0x42')]){_0x1005c7=this['Trunk'][_0xedbb('0x12')]!==_0x1830c8[_0xedbb('0x42')][_0xedbb('0x12')]||this[_0xedbb('0x42')][_0xedbb('0x54')]!==_0x1830c8['Trunk'][_0xedbb('0x54')];}}return _0x22e2de||_0x29dc68||_0x1005c7;};VoiceQueueSummary[_0xedbb('0x44')][_0xedbb('0x55')]=function(_0x387756){this[_0xedbb('0x6')]=_0x387756[_0xedbb('0x6')];this[_0xedbb('0x40')]=_0x387756[_0xedbb('0x40')];this[_0xedbb('0x41')]=_0x387756[_0xedbb('0x41')];this[_0xedbb('0x8')]=_0x387756[_0xedbb('0x8')];this['outboundAbandonedCallsDay']=_0x387756[_0xedbb('0x9')];this[_0xedbb('0xa')]=_0x387756[_0xedbb('0xa')];this[_0xedbb('0x29')]=_0x387756[_0xedbb('0x29')];this[_0xedbb('0xb')]=_0x387756[_0xedbb('0xb')];this[_0xedbb('0xc')]=_0x387756[_0xedbb('0xc')];this['outboundNoAnswerCallsDay']=_0x387756[_0xedbb('0x2d')];this[_0xedbb('0xd')]=_0x387756['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x387756['outboundReCallsDay'];this[_0xedbb('0xe')]=_0x387756[_0xedbb('0xe')];this['outboundUnknownCallsDay']=_0x387756[_0xedbb('0xf')];this['sumBillable']=_0x387756[_0xedbb('0x1a')];this[_0xedbb('0x10')]=_0x387756[_0xedbb('0x10')];this[_0xedbb('0x11')]=_0x387756[_0xedbb('0x11')];if(this[_0xedbb('0x23')]==='preview'){this[_0xedbb('0x21')]=_0x387756['pTalking'];}};module[_0xedbb('0x56')]=VoiceQueueSummary; \ No newline at end of file +var _0x383d=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','Trunk','callerid','prototype','createReport','loggedin','callers','length','online','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','dialActive','statusMessage','active','updateReportFromOutboundQueue','preview','exports','loggedInDb','paused','ringing','waiting','available','answered','inUse','loggedIn','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','talking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var INBOUND_COUNTERS=['available','loggedIn',_0xd383('0x0'),_0xd383('0x1'),_0xd383('0x2'),'talking',_0xd383('0x3')];var OUTBOUND_COUNTERS=[_0xd383('0x4'),_0xd383('0x5'),_0xd383('0x6'),_0xd383('0x7'),_0xd383('0x0'),'originated',_0xd383('0x8'),_0xd383('0x9'),_0xd383('0xa'),_0xd383('0xb'),_0xd383('0xc'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0xd383('0xd'),_0xd383('0xe'),'outboundUnknownCallsDay',_0xd383('0x1'),_0xd383('0xf'),_0xd383('0x10'),_0xd383('0x11'),_0xd383('0x12'),_0xd383('0x13'),'waiting'];function VoiceQueueSummary(_0x3bae30){this['id']=_0x3bae30['id'];this[_0xd383('0x14')]=_0x3bae30[_0xd383('0x14')];this[_0xd383('0x15')]=_0x3bae30['strategy'];this[_0xd383('0x16')]=_0x3bae30[_0xd383('0x16')]||0x0;this[_0xd383('0x5')]=_0x3bae30[_0xd383('0x5')]||0x0;this['available']=_0x3bae30[_0xd383('0x4')]||0x0;this['busy']=_0x3bae30[_0xd383('0x17')]||0x0;this[_0xd383('0x6')]=_0x3bae30[_0xd383('0x6')]||0x0;this[_0xd383('0x18')]=_0x3bae30[_0xd383('0x18')]||0x0;this[_0xd383('0x7')]=_0x3bae30['loggedIn']||0x0;this['loggedInDb']=_0x3bae30[_0xd383('0x0')]||0x0;this[_0xd383('0x19')]=_0x3bae30[_0xd383('0x19')]||0x0;this[_0xd383('0x1a')]=_0x3bae30[_0xd383('0x1a')]||0x0;this[_0xd383('0x1')]=_0x3bae30[_0xd383('0x1')]||0x0;this[_0xd383('0x2')]=_0x3bae30['ringing']||0x0;this[_0xd383('0x1b')]=_0x3bae30[_0xd383('0x1b')];this[_0xd383('0x11')]=_0x3bae30[_0xd383('0x11')];this[_0xd383('0x12')]=_0x3bae30[_0xd383('0x12')];this['sumHoldTime']=_0x3bae30[_0xd383('0x1c')]||0x0;this['talking']=_0x3bae30[_0xd383('0x10')]||0x0;this['total']=_0x3bae30[_0xd383('0x13')]||0x0;this[_0xd383('0x1d')]=_0x3bae30['type'];this[_0xd383('0x1e')]=_0x3bae30[_0xd383('0x1e')]||0x0;this[_0xd383('0x1f')]=_0x3bae30['unknown']||0x0;this['unmanaged']=_0x3bae30[_0xd383('0x20')]||0x0;this['waiting']=_0x3bae30['waiting']||0x0;if(_0x3bae30[_0xd383('0x1d')]==='outbound'){this[_0xd383('0xf')]=_0x3bae30['pTalking']||0x0;this['dialActive']=_0x3bae30['dialActive'];this[_0xd383('0x21')]=_0x3bae30[_0xd383('0x21')];this[_0xd383('0x22')]=_0x3bae30['dialOriginateCallerIdName'];this[_0xd383('0x23')]=_0x3bae30[_0xd383('0x23')];this[_0xd383('0x24')]=_0x3bae30[_0xd383('0x24')];this[_0xd383('0x25')]=_0x3bae30[_0xd383('0x25')];this[_0xd383('0x26')]=_0x3bae30[_0xd383('0x26')];this[_0xd383('0x27')]=_0x3bae30['outboundAnswerAgiCallsDay'];this[_0xd383('0x9')]=_0x3bae30[_0xd383('0x9')];this[_0xd383('0xa')]=_0x3bae30[_0xd383('0xa')];this[_0xd383('0xb')]=_0x3bae30[_0xd383('0xb')];this[_0xd383('0xc')]=_0x3bae30[_0xd383('0xc')];this[_0xd383('0x28')]=_0x3bae30[_0xd383('0x28')];this[_0xd383('0x29')]=_0x3bae30[_0xd383('0x29')];this[_0xd383('0x2a')]=_0x3bae30[_0xd383('0x2a')];this[_0xd383('0x2b')]=_0x3bae30['outboundNoAnswerCallsDay'];this[_0xd383('0x2c')]=_0x3bae30[_0xd383('0x2c')];this[_0xd383('0x2d')]=_0x3bae30[_0xd383('0x2d')];this[_0xd383('0xd')]=_0x3bae30[_0xd383('0xd')];this[_0xd383('0xe')]=_0x3bae30[_0xd383('0xe')];this[_0xd383('0x2e')]=_0x3bae30['outboundUnknownCallsDay'];this[_0xd383('0x2f')]=_0x3bae30['predictiveIntervalAnsweredCalls'];this[_0xd383('0x30')]=_0x3bae30['predictiveIntervalAvgHoldtime'];this[_0xd383('0x31')]=_0x3bae30['predictiveIntervalAvgTalktime'];this[_0xd383('0x32')]=_0x3bae30[_0xd383('0x32')];this['predictiveIntervalDroppedCallsTimeout']=_0x3bae30[_0xd383('0x33')];this[_0xd383('0x34')]=_0x3bae30[_0xd383('0x34')];this[_0xd383('0x35')]=_0x3bae30[_0xd383('0x35')];this[_0xd383('0x36')]=_0x3bae30[_0xd383('0x36')];this[_0xd383('0x37')]=_0x3bae30[_0xd383('0x37')];this[_0xd383('0x38')]=_0x3bae30['predictiveIntervalPauses'];this[_0xd383('0x39')]=_0x3bae30[_0xd383('0x39')];this[_0xd383('0x3a')]=_0x3bae30[_0xd383('0x3a')];this[_0xd383('0x3b')]=_0x3bae30[_0xd383('0x3b')];this[_0xd383('0x3c')]=_0x3bae30[_0xd383('0x3c')];this[_0xd383('0x3d')]=_0x3bae30[_0xd383('0x3d')];this[_0xd383('0x3e')]=_0x3bae30['erlangAbandonmentRate'];this[_0xd383('0x3f')]=_0x3bae30[_0xd383('0x3f')];this[_0xd383('0x40')]=_0x3bae30[_0xd383('0x40')];this[_0xd383('0x41')]=_0x3bae30['startProgressive'];this[_0xd383('0x42')]=_0x3bae30[_0xd383('0x42')];this['statusMessage']=_0x3bae30['statusMessage'];}if(_0x3bae30[_0xd383('0x43')]){this[_0xd383('0x43')]={'id':_0x3bae30[_0xd383('0x43')]['id'],'name':_0x3bae30[_0xd383('0x43')][_0xd383('0x14')],'active':_0x3bae30[_0xd383('0x43')]['active'],'callerid':_0x3bae30[_0xd383('0x43')][_0xd383('0x44')]};}}VoiceQueueSummary[_0xd383('0x45')][_0xd383('0x46')]=function(_0xcc3d42,_0x1029c5,_0x2d109a,_0x3f68a5){this[_0xd383('0x0')]=0x0;this[_0xd383('0x10')]=0x0;this[_0xd383('0x1')]=0x0;this[_0xd383('0x1f')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xd383('0x18')]=0x0;this[_0xd383('0x1e')]=0x0;this[_0xd383('0x2')]=0x0;this['ringInUse']=0x0;this[_0xd383('0x19')]=0x0;if(_0x2d109a){if(_0x2d109a[_0xd383('0x4')]){this[_0xd383('0x4')]=Number(_0x2d109a[_0xd383('0x4')]);}if(_0x2d109a['loggedin']){this[_0xd383('0x7')]=Number(_0x2d109a[_0xd383('0x47')]);}if(_0x2d109a[_0xd383('0x48')]){this[_0xd383('0x3')]=Number(_0x2d109a[_0xd383('0x48')]);}}for(var _0x54926f=0x0;_0x54926f<_0xcc3d42[_0xd383('0x49')];_0x54926f++){var _0x30046f=_0x1029c5['SIP/'+_0xcc3d42[_0x54926f][_0xd383('0x14')]];if(_0x30046f&&_0x30046f[_0xd383('0x4a')]){this[_0xd383('0x0')]+=0x1;}if(_0xcc3d42[_0x54926f]['incall']==='1'){this[_0xd383('0x10')]+=0x1;}if(_0xcc3d42[_0x54926f]['paused']==='1'&&!['2','7','8'][_0xd383('0x4b')](_0xcc3d42[_0x54926f][_0xd383('0x4c')])){this[_0xd383('0x1')]+=0x1;}switch(_0xcc3d42[_0x54926f]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0xd383('0x1a')]+=0x1;break;case'2':this[_0xd383('0x6')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xd383('0x18')]+=0x1;break;case'5':this[_0xd383('0x1e')]+=0x1;break;case'6':this[_0xd383('0x2')]+=0x1;break;case'7':this[_0xd383('0x1b')]+=0x1;break;case'8':this[_0xd383('0x19')]+=0x1;break;}}if(this['dialMethod']===_0xd383('0x4d')){var _0x136de8=Object[_0xd383('0x4e')](_0x3f68a5);for(var _0x41bbc6=0x0;_0x41bbc6<_0x136de8[_0xd383('0x49')];_0x41bbc6++){var _0x3ed7c0=_0x136de8[_0x41bbc6];var _0x405319=_0x3f68a5[_0x3ed7c0];if(_0x405319[_0xd383('0x4f')]===this[_0xd383('0x14')]&&_0x405319[_0xd383('0x1d')]===_0xd383('0x50')&&_0x405319[_0xd383('0x51')]===_0xd383('0x52')){this['talking']+=0x1;}}if(this[_0xd383('0x10')]>this[_0xd383('0x6')]){this['talking']=this[_0xd383('0x6')];}this[_0xd383('0xf')]=0x0;}return this;};VoiceQueueSummary[_0xd383('0x45')][_0xd383('0x53')]=function(_0x45bcfb){var _0x41b1f0=![];if(_0x45bcfb){_0x41b1f0=INBOUND_COUNTERS[_0xd383('0x54')](function(_0x566d21){return this[_0x566d21]!==_0x45bcfb[_0x566d21];},this);}return _0x41b1f0;};VoiceQueueSummary['prototype'][_0xd383('0x55')]=function(_0x24458e){var _0x3dc478=![];var _0x1ecbdc=![];var _0x1e4f53=![];if(_0x24458e){_0x3dc478=this[_0xd383('0x21')]!==_0x24458e['dialMethod']||this[_0xd383('0x56')]!==_0x24458e[_0xd383('0x56')]||this[_0xd383('0x42')]!==_0x24458e[_0xd383('0x42')]||this[_0xd383('0x57')]!==_0x24458e[_0xd383('0x57')];_0x1ecbdc=OUTBOUND_COUNTERS[_0xd383('0x54')](function(_0x5a2b26){return this[_0x5a2b26]!==_0x24458e[_0x5a2b26];},this);if(this[_0xd383('0x43')]&&_0x24458e[_0xd383('0x43')]){_0x1e4f53=this[_0xd383('0x43')][_0xd383('0x14')]!==_0x24458e[_0xd383('0x43')][_0xd383('0x14')]||this[_0xd383('0x43')][_0xd383('0x58')]!==_0x24458e[_0xd383('0x43')][_0xd383('0x58')];}}return _0x3dc478||_0x1ecbdc||_0x1e4f53;};VoiceQueueSummary['prototype'][_0xd383('0x59')]=function(_0x167276){this['answered']=_0x167276['answered'];this['message']=_0x167276['message'];this['statusMessage']=_0x167276[_0xd383('0x57')];this[_0xd383('0x3b')]=_0x167276[_0xd383('0x3b')];this['outboundAbandonedCallsDay']=_0x167276[_0xd383('0x8')];this[_0xd383('0x9')]=_0x167276[_0xd383('0x9')];this[_0xd383('0xa')]=_0x167276[_0xd383('0xa')];this['outboundBusyCallsDay']=_0x167276[_0xd383('0xb')];this[_0xd383('0xc')]=_0x167276[_0xd383('0xc')];this[_0xd383('0x2b')]=_0x167276[_0xd383('0x2b')];this['outboundNoSuchCallsDay']=_0x167276[_0xd383('0x2c')];this[_0xd383('0xd')]=_0x167276[_0xd383('0xd')];this['outboundRejectCallsDay']=_0x167276[_0xd383('0xe')];this[_0xd383('0x2e')]=_0x167276[_0xd383('0x2e')];this['sumBillable']=_0x167276[_0xd383('0x11')];this['sumDuration']=_0x167276[_0xd383('0x12')];this['total']=_0x167276[_0xd383('0x13')];if(this['dialMethod']===_0xd383('0x5a')){this['pTalking']=_0x167276[_0xd383('0xf')];}};module[_0xd383('0x5b')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index df8ec1d..ccfab7c 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 _0xac2c=['accessKey','remoteUri','serverUrl','exports','username'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xac2c,0x16c));var _0xcac2=function(_0x5a452e,_0x355a90){_0x5a452e=_0x5a452e-0x0;var _0x2c4c43=_0xac2c[_0x5a452e];return _0x2c4c43;};'use strict';function VtigerAccount(_0x299008){this['id']=_0x299008['id']||0x0;this['name']=_0x299008['name']||'';this[_0xcac2('0x0')]=_0x299008['username']||'';this['accessKey']=_0x299008[_0xcac2('0x1')]||'';this['remoteUri']=_0x299008[_0xcac2('0x2')]||'';this['serverUrl']=_0x299008[_0xcac2('0x3')]||'';this['Configurations']=_0x299008['Configurations']||{};}module[_0xcac2('0x4')]=VtigerAccount; \ No newline at end of file +var _0xdb2f=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x5b3d33,_0x338382){var _0x222132=function(_0x57f497){while(--_0x57f497){_0x5b3d33['push'](_0x5b3d33['shift']());}};_0x222132(++_0x338382);}(_0xdb2f,0x1d8));var _0xfdb2=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xdb2f[_0x30ae5e];return _0x1f2e93;};'use strict';function VtigerAccount(_0x56f24f){this['id']=_0x56f24f['id']||0x0;this[_0xfdb2('0x0')]=_0x56f24f[_0xfdb2('0x0')]||'';this[_0xfdb2('0x1')]=_0x56f24f['username']||'';this[_0xfdb2('0x2')]=_0x56f24f[_0xfdb2('0x2')]||'';this[_0xfdb2('0x3')]=_0x56f24f['remoteUri']||'';this[_0xfdb2('0x4')]=_0x56f24f['serverUrl']||'';this['Configurations']=_0x56f24f[_0xfdb2('0x5')]||{};}module[_0xfdb2('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 2dcd236..29a6c0f 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 _0x4ec2=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x5a07f4,_0x5dd927){var _0xaa5dc2=function(_0x1d6d82){while(--_0x1d6d82){_0x5a07f4['push'](_0x5a07f4['shift']());}};_0xaa5dc2(++_0x5dd927);}(_0x4ec2,0x13d));var _0x24ec=function(_0x2f6396,_0x50df65){_0x2f6396=_0x2f6396-0x0;var _0x16bcc1=_0x4ec2[_0x2f6396];return _0x16bcc1;};'use strict';function ZendeskAccount(_0x28e252){this['id']=_0x28e252['id']||0x0;this[_0x24ec('0x0')]=_0x28e252[_0x24ec('0x0')]||'';this[_0x24ec('0x1')]=_0x28e252[_0x24ec('0x1')]||'';this[_0x24ec('0x2')]=_0x28e252['password']||'';this[_0x24ec('0x3')]=_0x28e252['token']||'';this[_0x24ec('0x4')]=_0x28e252[_0x24ec('0x4')]||'';this[_0x24ec('0x5')]=_0x28e252['authType']||'';this[_0x24ec('0x6')]=_0x28e252[_0x24ec('0x6')]||_0x24ec('0x7');this[_0x24ec('0x8')]=_0x28e252[_0x24ec('0x8')]||'';this['Configurations']=_0x28e252[_0x24ec('0x9')]||{};}module[_0x24ec('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x8fd7=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0xb9ba0c,_0x2d717f){var _0x1bfc14=function(_0xa10b75){while(--_0xa10b75){_0xb9ba0c['push'](_0xb9ba0c['shift']());}};_0x1bfc14(++_0x2d717f);}(_0x8fd7,0x1a2));var _0x78fd=function(_0x19eff1,_0x57696c){_0x19eff1=_0x19eff1-0x0;var _0x31658f=_0x8fd7[_0x19eff1];return _0x31658f;};'use strict';function ZendeskAccount(_0x17295b){this['id']=_0x17295b['id']||0x0;this[_0x78fd('0x0')]=_0x17295b[_0x78fd('0x0')]||'';this['username']=_0x17295b[_0x78fd('0x1')]||'';this[_0x78fd('0x2')]=_0x17295b[_0x78fd('0x2')]||'';this['token']=_0x17295b[_0x78fd('0x3')]||'';this[_0x78fd('0x4')]=_0x17295b['remoteUri']||'';this['authType']=_0x17295b[_0x78fd('0x5')]||'';this[_0x78fd('0x6')]=_0x17295b[_0x78fd('0x6')]||_0x78fd('0x7');this[_0x78fd('0x8')]=_0x17295b['serverUrl']||'';this[_0x78fd('0x9')]=_0x17295b['Configurations']||{};}module[_0x78fd('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 99766c9..dcc88d9 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 _0x6c33=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x5e129c,_0x34efa1){var _0x1a599a=function(_0x40322f){while(--_0x40322f){_0x5e129c['push'](_0x5e129c['shift']());}};_0x1a599a(++_0x34efa1);}(_0x6c33,0x18b));var _0x36c3=function(_0x5d09d9,_0x181abf){_0x5d09d9=_0x5d09d9-0x0;var _0x7ce182=_0x6c33[_0x5d09d9];return _0x7ce182;};'use strict';function ZohoAccount(_0x573729){this['id']=_0x573729['id']||0x0;this[_0x36c3('0x0')]=_0x573729[_0x36c3('0x0')]||'';this['description']=_0x573729[_0x36c3('0x1')]||'';this['host']=_0x573729[_0x36c3('0x2')]||'';this['zone']=_0x573729[_0x36c3('0x3')]||'';this[_0x36c3('0x4')]=_0x573729['clientId']||'';this[_0x36c3('0x5')]=_0x573729[_0x36c3('0x5')]||'';this[_0x36c3('0x6')]=_0x573729[_0x36c3('0x6')]||'';this[_0x36c3('0x7')]=_0x573729[_0x36c3('0x7')]||'';this[_0x36c3('0x8')]=_0x573729[_0x36c3('0x8')]||'';this[_0x36c3('0x9')]=_0x573729['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x8ec3=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x5711d9,_0x1d3fd7){var _0x49dfe5=function(_0x45854a){while(--_0x45854a){_0x5711d9['push'](_0x5711d9['shift']());}};_0x49dfe5(++_0x1d3fd7);}(_0x8ec3,0x1b4));var _0x38ec=function(_0x9807f1,_0x2d61b8){_0x9807f1=_0x9807f1-0x0;var _0x54c7f0=_0x8ec3[_0x9807f1];return _0x54c7f0;};'use strict';function ZohoAccount(_0x53b58e){this['id']=_0x53b58e['id']||0x0;this[_0x38ec('0x0')]=_0x53b58e['name']||'';this[_0x38ec('0x1')]=_0x53b58e[_0x38ec('0x1')]||'';this['host']=_0x53b58e[_0x38ec('0x2')]||'';this[_0x38ec('0x3')]=_0x53b58e[_0x38ec('0x3')]||'';this[_0x38ec('0x4')]=_0x53b58e[_0x38ec('0x4')]||'';this[_0x38ec('0x5')]=_0x53b58e[_0x38ec('0x5')]||'';this[_0x38ec('0x6')]=_0x53b58e[_0x38ec('0x6')]||'';this['code']=_0x53b58e[_0x38ec('0x7')]||'';this['refreshToken']=_0x53b58e[_0x38ec('0x8')]||'';this['Configurations']=_0x53b58e[_0x38ec('0x9')]||{};}module[_0x38ec('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index edca4d8..3087c7b 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 _0x6a55=['countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','number','util','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0x5d054e,_0x19c2e0){var _0x28db29=function(_0x55886e){while(--_0x55886e){_0x5d054e['push'](_0x5d054e['shift']());}};_0x28db29(++_0x19c2e0);}(_0x6a55,0xdb));var _0x56a5=function(_0x16e9b5,_0x192142){_0x16e9b5=_0x16e9b5-0x0;var _0x206df0=_0x6a55[_0x16e9b5];return _0x206df0;};'use strict';var util=require(_0x56a5('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x4ec858,_0x173b37,_0x47b337){var _0x561353='';if(!_[_0x56a5('0x1')](_0x173b37)&&'string'===typeof _0x173b37){_0x561353+=_0x173b37;}if(!_[_0x56a5('0x1')](_0x47b337)&&'string'===typeof _0x47b337){_0x561353+='\x20'+_0x47b337;}if(_0x561353!==''){return _0x561353;}return _0x4ec858;}function Action(_0x28bb2b,_0x380b1b,_0x42d164,_0x293ea1,_0x444c65){this[_0x56a5('0x2')]=_0x42d164||undefined;this[_0x56a5('0x3')]=_0x28bb2b['id'];this[_0x56a5('0x4')]=_0x380b1b['name'];this[_0x56a5('0x5')]=_0x380b1b[_0x56a5('0x5')];this[_0x56a5('0x6')]=_0x56a5('0x4');this[_0x56a5('0x7')]=![];this[_0x56a5('0x8')]=_[_0x56a5('0x1')](_0x28bb2b[_0x56a5('0x9')])?undefined:_0x28bb2b[_0x56a5('0x9')]['name'];this['channelAgent']=this[_0x56a5('0x8')]?util[_0x56a5('0xa')](_0x56a5('0xb'),this[_0x56a5('0x8')]):_0x293ea1||undefined;this[_0x56a5('0xc')]=checkNameSurname(_0x28bb2b[_0x56a5('0xd')]['phone'],_0x28bb2b['Contact'][_0x56a5('0xe')],_0x28bb2b[_0x56a5('0xd')][_0x56a5('0xf')]);this[_0x56a5('0x10')]=_0x28bb2b[_0x56a5('0x10')]||![];this[_0x56a5('0x11')]=_0x28bb2b[_0x56a5('0x12')];this['scheduledat']=_0x28bb2b[_0x56a5('0x13')];this['countbusyretry']=_0x28bb2b[_0x56a5('0x14')]||0x0;this['countcongestionretry']=_0x28bb2b[_0x56a5('0x15')]||0x0;this[_0x56a5('0x16')]=_0x28bb2b[_0x56a5('0x16')]||0x0;this[_0x56a5('0x17')]=(_0x28bb2b[_0x56a5('0x14')]||0x0)+(_0x28bb2b[_0x56a5('0x15')]||0x0)+(_0x28bb2b[_0x56a5('0x16')]||0x0)+(_0x28bb2b['countnosuchnumberretry']||0x0)+(_0x28bb2b[_0x56a5('0x18')]||0x0)+(_0x28bb2b[_0x56a5('0x19')]||0x0)+(_0x28bb2b[_0x56a5('0x1a')]||0x0)+(_0x28bb2b[_0x56a5('0x1b')]||0x0);this['countnosuchnumberretry']=_0x28bb2b[_0x56a5('0x1c')]||0x0;this[_0x56a5('0x18')]=_0x28bb2b[_0x56a5('0x18')]||0x0;this[_0x56a5('0x19')]=_0x28bb2b[_0x56a5('0x19')]||0x0;this['countmachineretry']=_0x28bb2b['countmachineretry']||0x0;this[_0x56a5('0x1b')]=_0x28bb2b[_0x56a5('0x1b')]||0x0;this['callback']=_0x28bb2b[_0x56a5('0x1d')];this[_0x56a5('0x1e')]=_0x28bb2b[_0x56a5('0x1e')];this[_0x56a5('0x1f')]=_0x28bb2b[_0x56a5('0x1f')];this[_0x56a5('0x20')]=_0x28bb2b[_0x56a5('0x20')];this[_0x56a5('0x21')]=_0x28bb2b[_0x56a5('0x21')];this[_0x56a5('0x22')]=_0x28bb2b[_0x56a5('0x22')];this[_0x56a5('0x23')]=_[_0x56a5('0x1')](_0x28bb2b['Agent'])?_0x28bb2b[_0x56a5('0x23')]:_0x28bb2b[_0x56a5('0x9')]['id'];this[_0x56a5('0x24')]=_0x28bb2b[_0x56a5('0x24')];this[_0x56a5('0x25')]='';this['originatecalleridname']='';}Action[_0x56a5('0x26')]['getCaller']=function(){return util[_0x56a5('0xa')](_0x56a5('0x27'),this[_0x56a5('0xc')],this[_0x56a5('0x28')]);};module['exports']=Action; \ No newline at end of file +var _0x2032=['originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','lodash','moment','string','isNil','uniqueid','idContact','queue','type','dialAnswer','membername','Agent','name','format','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x2f8b0f,_0x2654eb){var _0x384196=function(_0x5a7991){while(--_0x5a7991){_0x2f8b0f['push'](_0x2f8b0f['shift']());}};_0x384196(++_0x2654eb);}(_0x2032,0xd9));var _0x2203=function(_0x32e821,_0x34d772){_0x32e821=_0x32e821-0x0;var _0x539b7f=_0x2032[_0x32e821];return _0x539b7f;};'use strict';var util=require('util');var _=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));function checkNameSurname(_0xcd892f,_0x4c28da,_0x486390){var _0x228a29='';if(!_['isNil'](_0x4c28da)&&_0x2203('0x2')===typeof _0x4c28da){_0x228a29+=_0x4c28da;}if(!_[_0x2203('0x3')](_0x486390)&&_0x2203('0x2')===typeof _0x486390){_0x228a29+='\x20'+_0x486390;}if(_0x228a29!==''){return _0x228a29;}return _0xcd892f;}function Action(_0x201796,_0x3f7ba1,_0x13367a,_0x2e0f63,_0x2676aa){this[_0x2203('0x4')]=_0x13367a||undefined;this[_0x2203('0x5')]=_0x201796['id'];this[_0x2203('0x6')]=_0x3f7ba1['name'];this['type']=_0x3f7ba1[_0x2203('0x7')];this['campaigntype']=_0x2203('0x6');this[_0x2203('0x8')]=![];this[_0x2203('0x9')]=_['isNil'](_0x201796[_0x2203('0xa')])?undefined:_0x201796['Agent'][_0x2203('0xb')];this['channelAgent']=this[_0x2203('0x9')]?util[_0x2203('0xc')]('SIP/%s',this['membername']):_0x2e0f63||undefined;this['calleridname']=checkNameSurname(_0x201796['Contact']['phone'],_0x201796[_0x2203('0xd')]['firstName'],_0x201796['Contact'][_0x2203('0xe')]);this[_0x2203('0xf')]=_0x201796[_0x2203('0xf')]||![];this[_0x2203('0x10')]=_0x201796[_0x2203('0x11')];this[_0x2203('0x12')]=_0x201796[_0x2203('0x12')];this[_0x2203('0x13')]=_0x201796[_0x2203('0x13')]||0x0;this[_0x2203('0x14')]=_0x201796['countcongestionretry']||0x0;this[_0x2203('0x15')]=_0x201796[_0x2203('0x15')]||0x0;this['countglobal']=(_0x201796[_0x2203('0x13')]||0x0)+(_0x201796[_0x2203('0x14')]||0x0)+(_0x201796['countnoanswerretry']||0x0)+(_0x201796[_0x2203('0x16')]||0x0)+(_0x201796['countdropretry']||0x0)+(_0x201796[_0x2203('0x17')]||0x0)+(_0x201796[_0x2203('0x18')]||0x0)+(_0x201796[_0x2203('0x19')]||0x0);this[_0x2203('0x16')]=_0x201796[_0x2203('0x16')]||0x0;this[_0x2203('0x1a')]=_0x201796['countdropretry']||0x0;this[_0x2203('0x17')]=_0x201796['countabandonedretry']||0x0;this['countmachineretry']=_0x201796[_0x2203('0x18')]||0x0;this['countagentrejectretry']=_0x201796[_0x2203('0x19')]||0x0;this[_0x2203('0x1b')]=_0x201796['callback'];this[_0x2203('0x1c')]=_0x201796['callbackuniqueid'];this['callbackat']=_0x201796[_0x2203('0x1d')];this[_0x2203('0x1e')]=_0x201796[_0x2203('0x1e')];this[_0x2203('0x1f')]=_0x201796[_0x2203('0x1f')];this[_0x2203('0x20')]=_0x201796[_0x2203('0x20')];this[_0x2203('0x21')]=_['isNil'](_0x201796[_0x2203('0xa')])?_0x201796[_0x2203('0x21')]:_0x201796[_0x2203('0xa')]['id'];this['VoiceQueueId']=_0x201796[_0x2203('0x22')];this[_0x2203('0x23')]='';this['originatecalleridname']='';}Action[_0x2203('0x24')][_0x2203('0x25')]=function(){return util[_0x2203('0xc')](_0x2203('0x26'),this[_0x2203('0x27')],this[_0x2203('0x28')]);};module[_0x2203('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index c3ac597..d4d0c4d 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 _0x00bb=['swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','rescheduleContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','[Blacklist][error]','active','SIP/%s','status','reachable','unmonitored','run','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','callerid','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','syncVarSet','filterKey','keys','variable','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/logger','preview','actionPreview','../ami','./util/util','../dialer/utils','redis','defaults','localhost','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','syncHangupRequest','syncDialEnd','bind','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','available','paused','INACTIVE','\x20is\x20not\x20active','message','CAMPAIGN_STATUS','DEACTIVATED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','Queue','queue','originated:\x20','stringify','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','catch','loggedIn','NO_AGENTS_LOGGED','isTrunkReachable','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','\x20Queue','pTalking:\x20','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var util=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var uuid=require(_0xb00b('0x2'));var moment=require('moment');var Redis=require(_0xb00b('0x3'));var config=require('../../../config/environment');var logger=require(_0xb00b('0x4'))(_0xb00b('0x5'));var loggerAction=require('../../../config/logger')(_0xb00b('0x6'));var ami=require(_0xb00b('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require('./action');var ut=require(_0xb00b('0x8'));var utils=require(_0xb00b('0x9'));config[_0xb00b('0xa')]=_[_0xb00b('0xb')](config[_0xb00b('0xa')],{'host':_0xb00b('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb00b('0xd')][_0xb00b('0xe')]=function(_0x5851d4){this[_0xb00b('0xf')]=this[_0xb00b('0xf')]?this['tail'][_0xb00b('0x10')](_0x5851d4):_0x5851d4();};function Preview(_0x5a63ed){this['sequence']=new Sequence();this['campaignsPreview']=_0x5a63ed[_0xb00b('0x11')];this[_0xb00b('0x12')]=_0x5a63ed[_0xb00b('0x12')];this[_0xb00b('0x13')]={};this[_0xb00b('0x14')]=_0x5a63ed[_0xb00b('0x14')];this['clockClearZombieChannels']=0x0;ami['on'](_0xb00b('0x15'),this[_0xb00b('0x16')]['bind'](this));ami['on'](_0xb00b('0x17'),this[_0xb00b('0x18')]['bind'](this));ami['on']('hanguprequest',this[_0xb00b('0x19')]['bind'](this));ami['on']('dialend',this[_0xb00b('0x1a')][_0xb00b('0x1b')](this));ami['on'](_0xb00b('0x1c'),this[_0xb00b('0x1d')]['bind'](this));ami['on'](_0xb00b('0x1e'),this['syncVarSet'][_0xb00b('0x1b')](this));ami['on']('attendedtransfer',this[_0xb00b('0x1f')]['bind'](this));ami['on'](_0xb00b('0x20'),this[_0xb00b('0x21')]['bind'](this));this['loopCampaigns'](this[_0xb00b('0x22')]);}function emit(_0x4a334b,_0x1344c4,_0x43da66){io['to'](_0x4a334b)[_0xb00b('0x23')](_0x1344c4,_0x43da66);}function emitVoiceQueueChannelRemove(_0x3501af){logger['info'](_0xb00b('0x24'),JSON['stringify'](_0x3501af));emit(util[_0xb00b('0x25')](_0xb00b('0x26'),_0x3501af['name']),_0xb00b('0x27'),_0x3501af);io[_0xb00b('0x23')]('voice_queue_presence:remove',_0x3501af);}function notSendMessagesQueue(_0x3ab3cc){if(_0x3ab3cc[_0xb00b('0x28')]){if(_0x3ab3cc['originated']===0x0&&_0x3ab3cc[_0xb00b('0x29')]===0x0){_0x3ab3cc[_0xb00b('0x28')]=![];_0x3ab3cc[_0xb00b('0x2a')]=0x0;_0x3ab3cc[_0xb00b('0x2b')]=0x0;_0x3ab3cc['message']=utils['CAMPAIGN_STATUS'][_0xb00b('0x2c')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3ab3cc['name']+_0xb00b('0x2d'));}else{_0x3ab3cc[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x30')];ut[_0xb00b('0x31')](_0xb00b('0x32'),_0x3ab3cc[_0xb00b('0x33')]+'\x20is\x20deactivated');}}}Preview[_0xb00b('0xd')]['loopCampaigns']=function(){var _0x450129=this;setInterval(function(){_0x450129[_0xb00b('0x34')]();},0x7cf);};Preview[_0xb00b('0xd')]['syncCampaigns']=function(){var _0x2fc11a=this[_0xb00b('0x22')];this[_0xb00b('0x35')]+=0x1;for(var _0x183233 in _0x2fc11a){if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&(_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x5')||_0x2fc11a[_0x183233][_0xb00b('0x37')]===_0xb00b('0x38'))&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(this[_0xb00b('0x35')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xb00b('0x3a')]();}}if(_0x2fc11a[_0xb00b('0x36')](_0x183233)&&_0x2fc11a[_0x183233]['dialMethod']===_0xb00b('0x5')&&_0x2fc11a[_0x183233]['type']===_0xb00b('0x39')){if(_0x2fc11a[_0x183233][_0xb00b('0x3b')]){this[_0xb00b('0x3c')](_0x2fc11a[_0x183233]);if(_0x2fc11a[_0x183233][_0xb00b('0x3d')])this[_0xb00b('0x3e')](_0x2fc11a[_0x183233]);}else{notSendMessagesQueue(_0x2fc11a[_0x183233]);}}}};Preview[_0xb00b('0xd')][_0xb00b('0x3f')]=function(_0x594840){var _0x57e8f9=this;this['sequence'][_0xb00b('0xe')](function(){if(!_[_0xb00b('0x40')](_0x57e8f9[_0xb00b('0x13')][_0x594840])){loggerAction[_0xb00b('0x41')]('[clearZombieChannels][talking]',_0x594840,_0xb00b('0x42'),_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')],_0xb00b('0x44'),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]]['originated']),'pTalking:\x20',JSON[_0xb00b('0x45')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]][_0xb00b('0x29')]),JSON[_0xb00b('0x45')](_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x46')]),JSON[_0xb00b('0x45')](_['pick'](_0x57e8f9[_0xb00b('0x13')][_0x594840],[_0xb00b('0x47'),_0xb00b('0x48'),_0xb00b('0x49'),_0xb00b('0x4a')])));return ami[_0xb00b('0x4b')]({'action':'status','channel':_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x4c')]})['catch'](function(_0x17ff34){if(_0x17ff34[_0xb00b('0x2e')]===_0xb00b('0x4d')){setTimeout(function(){if(_0x57e8f9[_0xb00b('0x13')][_0x594840]){ut[_0xb00b('0x4e')](_0x57e8f9['campaignsPreview'][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));if(_0x57e8f9[_0xb00b('0x13')][_0x594840]['dialAnswer']===!![]){ut['decrementTalkink'](_0x57e8f9[_0xb00b('0x22')][_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]],_0xb00b('0x4f'));ut[_0xb00b('0x50')](_0xb00b('0x51')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840]['queue']);}ut[_0xb00b('0x50')](_0xb00b('0x52')+_0x594840,_0x57e8f9[_0xb00b('0x13')][_0x594840][_0xb00b('0x43')]);delete _0x57e8f9[_0xb00b('0x13')][_0x594840];}},0x2328);}});}});};Preview[_0xb00b('0xd')][_0xb00b('0x3a')]=function(){var _0x974a29=this;loggerAction[_0xb00b('0x41')](_0xb00b('0x53'),_[_0xb00b('0x54')](this[_0xb00b('0x13')]));for(var _0x577bad in this[_0xb00b('0x13')]){if(_0x974a29[_0xb00b('0x13')][_0xb00b('0x36')](_0x577bad)){_0x974a29[_0xb00b('0x3f')](_0x577bad);}}};Preview[_0xb00b('0xd')][_0xb00b('0x3e')]=function(_0xd97f49){var _0x1b4f09=this;rpcDb[_0xb00b('0x55')](_0xd97f49['id'],ut[_0xb00b('0x56')](this[_0xb00b('0x14')]))[_0xb00b('0x57')](function(_0x5dbe00){if(!_['isNil'](_0x5dbe00)){for(var _0x47c6c0=0x0;_0x47c6c0<_0x5dbe00[_0xb00b('0x58')];_0x47c6c0+=0x1){if(ut[_0xb00b('0x59')](_0x5dbe00[_0x47c6c0]['scheduledat'])<_0xd97f49[_0xb00b('0x5a')]*0x3c){if(_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')]&&!_0x5dbe00[_0x47c6c0][_0xb00b('0x5b')][_0xb00b('0x5c')]){_0x1b4f09['run'](_0x5dbe00[_0x47c6c0]['id'])['then'](ut[_0xb00b('0x5d')](_0xb00b('0x5e')))['catch'](ut['logger2'](_0xb00b('0x5e')));}else{rpcDb[_0xb00b('0x5f')](_0x5dbe00[_0x47c6c0]['id']);}}else{var _0x4e0be4=new Action(_0x5dbe00[_0x47c6c0],_0xd97f49);_0x4e0be4[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd97f49['outboundReCallsDay']+=0x1;ut[_0xb00b('0x61')](_0x4e0be4,0x17,'RecallInQueue');if(_0xd97f49[_0xb00b('0x62')]){rpcDb[_0xb00b('0x63')](ut[_0xb00b('0x64')](_0x5dbe00[_0x47c6c0]));rpcDb[_0xb00b('0x65')](_0x4e0be4,_0xb00b('0x66'));}else{ut[_0xb00b('0x61')](_0x4e0be4,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x4e0be4,_0xb00b('0x67'));rpcDb[_0xb00b('0x68')](_0x4e0be4,'[HistoryRecallClose]');}}}}})[_0xb00b('0x69')](ut[_0xb00b('0x5d')]('[getContactRecallMe]'));};Preview[_0xb00b('0xd')][_0xb00b('0x3c')]=function(_0x3b5d82){_0x3b5d82['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3b5d82[_0xb00b('0x6a')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6b')];}else if(!ut['isActive'](_0x3b5d82[_0xb00b('0x3b')])){_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS']['INACTIVE'];}else if(!this[_0xb00b('0x6c')](_0x3b5d82['Trunk'])){if(!this[_0xb00b('0x6c')](_0x3b5d82[_0xb00b('0x6d')])){_0x3b5d82[_0xb00b('0x2e')]=utils[_0xb00b('0x2f')][_0xb00b('0x6e')];}else{_0x3b5d82[_0xb00b('0x2e')]=utils['CAMPAIGN_STATUS'][_0xb00b('0x6f')];}}else{_0x3b5d82['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];}};Preview[_0xb00b('0xd')]['callProgressDetectingCustomer']=function(_0x248335,_0x25f1f6,_0x4ba53a){var _0x598a55=this;var _0x24e826=this[_0xb00b('0x13')][_0x25f1f6];var _0x219b74=this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]];var _0x279467;var _0x347949=![];var _0x3a0b90=0x2;var _0x4c3067=0x3;if(_0x219b74){switch(_0x4ba53a){case'1':_0x219b74[_0xb00b('0x70')]+=0x1;_0x24e826[_0xb00b('0x71')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x0,_0xb00b('0x73'));ami[_0xb00b('0x23')](_0xb00b('0x74'),ut[_0xb00b('0x75')](_0x24e826,'nosuchnumber'));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x76'));_0x598a55[_0xb00b('0x77')](_0x24e826,'0',_0x219b74)[_0xb00b('0x57')](function(_0x4b1e5f){_0x347949=_0x4b1e5f[_0xb00b('0x78')]==0x1;_0x3a0b90=_0x219b74[_0xb00b('0x79')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb['createCustomerFinal'](_0x279467,_0xb00b('0x7f'));}else{if(_0x24e826['countnosuchnumberretry']>=_0x219b74[_0xb00b('0x80')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0x7f'));}else{rpcDb['rescheduleContact'](ut[_0xb00b('0x81')](_0x24e826,'countnosuchnumberretry',_0x219b74[_0xb00b('0x79')]),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}delete this['actions'][_0x248335['linkedid']];}else{_0x24e826['countnosuchnumberretry']++;logger[_0xb00b('0x41')](_0xb00b('0x84'),_0x24e826[_0xb00b('0x71')]);logger['info']('id',_0x24e826[_0xb00b('0x85')]);_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnosuchnumberretry':_0x24e826[_0xb00b('0x71')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0x87'):var _0x5622a4=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x24e826[_0xb00b('0x89')]=_0x5622a4;_0x24e826['answertime']=_0x5622a4;_0x24e826['dialAnswer']=!![];_0x219b74[_0xb00b('0x29')]+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x8a'),_0x24e826['uniqueid'],'\x20Queue',_0x219b74['name'],'pTalking:\x20',_0x219b74[_0xb00b('0x29')]);ami['emit'](_0xb00b('0x8b'),ut[_0xb00b('0x75')](_0x24e826,'connect',this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));if(_0x219b74[_0xb00b('0x8c')]){ami[_0xb00b('0x23')](_0xb00b('0x8d'),ut['buildAcw'](_0x24e826));}break;case'16':ami[_0xb00b('0x23')](_0xb00b('0x8e'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0x8f'),this[_0xb00b('0x22')][_0x24e826[_0xb00b('0x43')]]));emitVoiceQueueChannelRemove(ut[_0xb00b('0x75')](_0x24e826,'complete'));_0x219b74[_0xb00b('0x90')]+=0x1;_0x219b74[_0xb00b('0x91')]+=0x1;_0x219b74[_0xb00b('0x92')]+=0x1;ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0x94'));_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x4,'Answer');rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0x95'));rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0x96'));rpcDb[_0xb00b('0x97')](_0x24e826);_0x219b74[_0xb00b('0x98')]+=_0x24e826[_0xb00b('0x99')];_0x219b74[_0xb00b('0x9a')]+=_0x24e826['talktime'];logger[_0xb00b('0x41')](_0xb00b('0x9b'),_0x24e826[_0xb00b('0x9c')],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x9e'),_0x219b74[_0xb00b('0x29')]);delete this['actions'][_0x248335[_0xb00b('0x9f')]];break;case _0xb00b('0xa0'):_0x219b74[_0xb00b('0xa1')]+=0x1;_0x24e826[_0xb00b('0xa2')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x5,_0xb00b('0xa3'));_0x3a0b90=_0x219b74['dialBusyRetryFrequency'];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami['emit'](_0xb00b('0xa4'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xa5')));rpcDb['createCustomerHistory'](_0x24e826,'[callProgressDetectingCustomer][logBusy]');_0x598a55[_0xb00b('0x77')](_0x24e826,'5',_0x219b74)[_0xb00b('0x57')](function(_0x33a483){_0x347949=_0x33a483[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xa6'));}else{if(_0x24e826[_0xb00b('0xa2')]>=_0x219b74[_0xb00b('0xa7')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xa8'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x24e826,_0xb00b('0xa2'),_0x219b74[_0xb00b('0xa9')]),_0x24e826['unlockAgent'],_0x24e826['activeContact']);}}}else{_0x24e826[_0xb00b('0xa2')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countbusyretry':_0x24e826['countbusyretry']}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xab'):_0x219b74[_0xb00b('0xac')]+=0x1;_0x24e826[_0xb00b('0xad')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x3,'NoAnswer');_0x3a0b90=_0x219b74[_0xb00b('0xae')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];var _0x545dfd=ut[_0xb00b('0xaf')](_0x24e826,_0x219b74);ami[_0xb00b('0x23')](_0xb00b('0xb0'),_0x545dfd);rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xb1'));_0x598a55[_0xb00b('0x77')](_0x24e826,'3',_0x219b74)[_0xb00b('0x57')](function(_0x2423b2){_0x347949=_0x2423b2[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,'Global');rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xb2'));}else{if(_0x24e826[_0xb00b('0xad')]>=_0x219b74[_0xb00b('0xb3')]){rpcDb['createCustomerFinal'](_0x24e826,_0xb00b('0xb1'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xad'),_0x219b74[_0xb00b('0xae')]),_0x24e826['unlockAgent'],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826['countnoanswerretry']}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xb5'):_0x219b74[_0xb00b('0xb6')]+=0x1;_0x24e826[_0xb00b('0xb7')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x8,_0xb00b('0xb8'));_0x3a0b90=_0x219b74[_0xb00b('0xb9')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];ami[_0xb00b('0x23')]('custom:agentcongestion',ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xba')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xbb'));_0x598a55['verifyAdditionalPhones'](_0x24e826,'8',_0x219b74)[_0xb00b('0x57')](function(_0xb27b8b){_0x347949=_0xb27b8b['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x24e826[_0xb00b('0xb7')]>=_0x219b74[_0xb00b('0xbc')]){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xbb'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xb7'),_0x219b74[_0xb00b('0xa9')]),_0x24e826[_0xb00b('0x82')],_0x24e826['activeContact']);}}}else{_0x24e826['countcongestionretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countcongestionretry':_0x24e826[_0xb00b('0xb7')]}})[_0xb00b('0x57')](function(){_0x598a55['swapAdditionalPhones'](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case _0xb00b('0xbd'):_0x219b74['outboundRejectCallsDay']+=0x1;_0x24e826[_0xb00b('0xbe')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut['logCustomer'](_0x24e826,0x14,_0xb00b('0xbf'));_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74['callAdditionalPhoneAfterMin'];ami[_0xb00b('0x23')](_0xb00b('0xc1'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xc2')));rpcDb[_0xb00b('0x65')](_0x24e826,_0xb00b('0xc3'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x55ea09){_0x347949=_0x55ea09[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x14,'AgentReject');rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x24e826[_0xb00b('0xbe')]>=_0x219b74['dialAgentRejectMaxRetry']){rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xc4'));}else{rpcDb[_0xb00b('0xb4')](ut[_0xb00b('0x81')](_0x24e826,_0xb00b('0xbe'),_0x219b74['dialAgentRejectRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826['countnoanswerretry']++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826['idContact'],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'ABANDONED':_0x219b74[_0xb00b('0xc5')]+=0x1;_0x24e826[_0xb00b('0xc6')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xc7'));_0x598a55[_0xb00b('0x77')](_0x24e826,'11',_0x219b74)[_0xb00b('0x57')](function(_0x2d5652){_0x347949=_0x2d5652[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut['totalGlobal'](_0x24e826)>=_0x219b74['dialGlobalMaxRetry']){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xc7'));}else{if(_0x24e826[_0xb00b('0xc8')]>=_0x219b74[_0xb00b('0xc9')]){rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb00b('0xb4')](ut['scheduledAt'](_0x24e826,_0xb00b('0xc6'),_0x219b74['dialAbandonedRetryFrequency']),_0x24e826[_0xb00b('0x82')],_0x24e826[_0xb00b('0x83')]);}}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});break;case'18':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0xcb')]+=0x1;_0x24e826['countglobal']=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x12,_0x248335[_0xb00b('0xcc')]||_0x248335[_0xb00b('0xcd')]);ami['emit'](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,'amd'));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');_0x598a55[_0xb00b('0x77')](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x49fe3f){_0x347949=_0x49fe3f[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0x12,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xb00b('0x68')](_0x24e826,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55[_0xb00b('0x86')]({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})['then'](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335['linkedid']];break;case'19':_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut[_0xb00b('0x7b')](_0x24e826);ut[_0xb00b('0x61')](_0x24e826,0x13,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);ami[_0xb00b('0x23')](_0xb00b('0xce'),ut[_0xb00b('0x75')](_0x24e826,_0xb00b('0xcf')));rpcDb[_0xb00b('0x65')](_0x24e826,'[callProgressDetectingCustomer][machine]');_0x598a55['verifyAdditionalPhones'](_0x24e826,'18',_0x219b74)[_0xb00b('0x57')](function(_0x23d306){_0x347949=_0x23d306[_0xb00b('0x78')]==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut['cloneAction'](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd0'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd0'));}}else{_0x24e826[_0xb00b('0xad')]++;_0x598a55['incrementPreviewCounters']({'id':_0x24e826[_0xb00b('0x85')],'field':{'countnoanswerretry':_0x24e826[_0xb00b('0xad')]}})[_0xb00b('0x57')](function(){_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});});}});delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];break;default:if(_0x24e826[_0xb00b('0x46')]){ut[_0xb00b('0x93')](_0x219b74,_0xb00b('0xd1'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x219b74[_0xb00b('0x33')],_0x248335);}_0x219b74[_0xb00b('0xca')]+=0x1;_0x24e826[_0xb00b('0x72')]=ut['totalGlobal'](_0x24e826);ut['logCustomer'](_0x24e826,0xc,_0x248335['cause-txt']||_0x248335[_0xb00b('0xcd')]);_0x3a0b90=_0x219b74[_0xb00b('0xc0')];_0x4c3067=_0x219b74[_0xb00b('0x7a')];rpcDb['createCustomerHistory'](_0x24e826,_0xb00b('0xd2'));_0x598a55[_0xb00b('0x77')](_0x24e826,'20',_0x219b74)[_0xb00b('0x57')](function(_0x142674){_0x347949=_0x142674['additional']==0x1;if(!_0x347949){if(ut[_0xb00b('0x7b')](_0x24e826)>=_0x219b74[_0xb00b('0x7c')]){_0x279467=ut[_0xb00b('0x7d')](_0x24e826,0xf,_0xb00b('0x7e'));rpcDb[_0xb00b('0x68')](_0x279467,_0xb00b('0xd3'));}else{rpcDb[_0xb00b('0x68')](_0x24e826,_0xb00b('0xd3'));}delete this['actions'][_0x248335[_0xb00b('0x9f')]];}else{_0x598a55[_0xb00b('0xaa')](_0x24e826,_0x3a0b90,_0x4c3067)[_0xb00b('0x57')](function(){});}});}if(!(_0x24e826[_0xb00b('0x46')]&&_0x4ba53a==='16')){ut[_0xb00b('0x4e')](_0x219b74,_0xb00b('0xd4'));logger[_0xb00b('0x41')](_0xb00b('0xd5'),_0x24e826['uniqueid'],_0xb00b('0x9d'),_0x219b74[_0xb00b('0x33')],_0xb00b('0x44'),_0x219b74[_0xb00b('0xd6')]);}if(_0x4ba53a!=='ANSWER'){delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0x9f')]];delete this[_0xb00b('0x13')][_0x248335[_0xb00b('0xd7')]];}_0x219b74[_0xb00b('0xd8')]=!![];}};Preview[_0xb00b('0xd')][_0xb00b('0xd9')]=function(_0x3184de,_0x48ac4b,_0x5f0fab){if(_[_0xb00b('0xda')](_0x48ac4b)&&_0xb00b('0xdb')!==typeof _0x48ac4b){return;}if(_[_0xb00b('0xda')](_0x5f0fab)&&'object'!==typeof _0x5f0fab){return;}switch(_0x5f0fab[_0xb00b('0xdc')]){case'0':ut[_0xb00b('0xdd')](_0x3184de,0x0,_0xb00b('0x73'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xde'));break;case'3':ut[_0xb00b('0xdd')](_0x3184de,0x3,_0xb00b('0xdf'));rpcDb['createAgentHistory'](_0x3184de,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xb00b('0xdd')](_0x3184de,0x5,'Busy');rpcDb[_0xb00b('0xe0')](_0x3184de,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x3184de,0x8,_0xb00b('0xb8'));rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));break;case'22':ut[_0xb00b('0xdd')](_0x3184de,0x16,_0xb00b('0xe2'));rpcDb['createAgentHistory'](_0x3184de,_0xb00b('0xe3'));break;default:ut['logAgent'](_0x3184de,0xc,_0x5f0fab['reason']);rpcDb[_0xb00b('0xe0')](_0x3184de,_0xb00b('0xe1'));}ut[_0xb00b('0x4e')](_0x48ac4b,_0xb00b('0xe4'));logger[_0xb00b('0x41')](_0xb00b('0xe5'),_0x3184de['uniqueid'],_0xb00b('0x9d'),_0x48ac4b['name'],_0xb00b('0x44'),_0x48ac4b[_0xb00b('0xd6')]);delete this[_0xb00b('0x13')][_0x3184de['uniqueid']];};Preview[_0xb00b('0xd')][_0xb00b('0x77')]=function(_0x20790f,_0x3dc8d2,_0x5d224c){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20790f,_0x3dc8d2,_0x5d224c)[_0xb00b('0x69')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')]['swapAdditionalPhones']=function(_0x505ae2,_0x2fecca,_0x330bc7){return cmHopperAdditionalPhone[_0xb00b('0xaa')](_0x505ae2,_0x2fecca,_0x330bc7)[_0xb00b('0x69')](logger['info']('[swapAdditionalPhone]\x20'));};Preview[_0xb00b('0xd')][_0xb00b('0x86')]=function(_0x9facaf){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0xb00b('0x86')](_0x9facaf))['catch'](logger['info'](_0xb00b('0xe6')));};Preview['prototype'][_0xb00b('0xe7')]=function(_0x481671,_0x1b751e,_0x5712fd,_0x3de808,_0x3289aa){var _0x1ec560=this;return new Promise(function(_0x54498c,_0x442b28){if(_['isNil'](_0x1b751e)||_[_0xb00b('0x40')](_0x1b751e[_0xb00b('0xe8')])||_['isNil'](_0x1b751e['phone'])||_['isNil'](_0x1b751e['VoiceQueueId'])){_0x442b28(ut[_0xb00b('0x2e')]('Contact\x20is\x20undefined',_0x3de808,_0x3289aa));return;}var _0x134d17=uuid['v4']();var _0x5ad4d4=_0x1ec560[_0xb00b('0x22')][_0x1b751e[_0xb00b('0x42')][_0xb00b('0x33')]];var _0x44b2f1=_0x5712fd?_0x1ec560[_0xb00b('0x14')][_0x5712fd]['id']:undefined;_0x1ec560['actions'][_0x134d17]=new Action(_0x1b751e,_0x5ad4d4,_0x134d17,_0x5712fd,_0x44b2f1);var _0x8292fe=_0x1ec560[_0xb00b('0x13')][_0x134d17];_0x8292fe[_0xb00b('0x82')]=_0x3de808;_0x8292fe[_0xb00b('0x83')]=_0x3289aa;_0x8292fe['lookAgent']=_0x5712fd;if(_['isEmpty'](_0x481671)){_0x1ec560[_0xb00b('0xe9')](_0x8292fe,_0x5ad4d4,_0x1b751e,_0x5712fd)[_0xb00b('0x57')](function(_0x181393){logger[_0xb00b('0x41')](_0xb00b('0xea'),_0xb00b('0xeb')+_0x8292fe[_0xb00b('0x43')]+_0xb00b('0xec')+_0x8292fe[_0xb00b('0x85')],JSON['stringify'](_0x181393));ami[_0xb00b('0x23')](_0xb00b('0xed'),ut['buildObj'](_0x8292fe,_0xb00b('0xee'),_0x1ec560['campaignsPreview'][_0x8292fe[_0xb00b('0x43')]]));_0x54498c(ut[_0xb00b('0x2e')]('Calling'));})['catch'](function(_0x32264a){ut[_0xb00b('0x31')](_0xb00b('0xef'),_0x32264a);_0x442b28(ut['message'](_0xb00b('0xf0'),_0x3de808,_0x3289aa));});}else{_0x5ad4d4[_0xb00b('0xf1')]+=0x1;ut[_0xb00b('0xf2')](_0x8292fe);rpcDb['createHistory'](_0x8292fe,_0xb00b('0xf3'));delete _0x1ec560['actions'][_0x134d17];_0x442b28(ut['message']('Contact\x20in\x20black\x20List',_0x3de808,_0x3289aa));}});};Preview[_0xb00b('0xd')]['isTrunkReachable']=function(_0x1b8d45){return!_[_0xb00b('0x40')](_0x1b8d45)&&!_['isNil'](_0x1b8d45['name'])&&!_[_0xb00b('0x40')](_0x1b8d45[_0xb00b('0xf4')])&&_0x1b8d45['active']&&!_[_0xb00b('0x40')](this[_0xb00b('0x12')][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45[_0xb00b('0x33')])])&&!_[_0xb00b('0x40')](this['trunks'][util[_0xb00b('0x25')](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')])&&(this['trunks'][util['format'](_0xb00b('0xf5'),_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf7')||this[_0xb00b('0x12')][util['format']('SIP/%s',_0x1b8d45['name'])][_0xb00b('0xf6')]===_0xb00b('0xf8'));};Preview['prototype'][_0xb00b('0xf9')]=function(_0x18e86f,_0x3aa8c0){return this[_0xb00b('0xfa')](_0x18e86f,_0x3aa8c0)[_0xb00b('0x57')](function(_0x166ff5){return _[_0xb00b('0xfb')](_0x166ff5,[_0xb00b('0x2e')]);})['catch'](function(_0x1b097a){if(_0x1b097a[_0xb00b('0xfc')]){rpcDb[_0xb00b('0xfd')](_0x18e86f);}if(_0x1b097a['active']){rpcDb['disableContact'](_0x18e86f);}throw _['pick'](_0x1b097a,[_0xb00b('0x2e')]);});};Preview[_0xb00b('0xd')][_0xb00b('0xfa')]=function(_0x4bc6df,_0x399902){var _0x34985d=this;var _0x2057d1,_0xdee547;return rpcDb[_0xb00b('0xfe')](_0x4bc6df)['then'](function(_0x1674ab){if(!_['isNil'](_0x1674ab[0x0])){_0xdee547=_0x1674ab[0x0][_0xb00b('0xff')]?![]:!![];_0x2057d1=_0x1674ab[0x0][_0xb00b('0xff')]?!![]:![];_0x2057d1=_0x399902?!![]:_0x2057d1;}var _0xde6b5=_0x34985d[_0xb00b('0x100')](_0x1674ab);if(_0xde6b5[_0xb00b('0x101')]){rpcDb[_0xb00b('0x102')](_['pick'](_0x1674ab[0x0],[_0xb00b('0x49'),_0xb00b('0x103')]))[_0xb00b('0x57')](function(_0x278d9e){_0x34985d[_0xb00b('0xe7')](_0x278d9e,_0x1674ab[0x0],_0x399902,_0xdee547,_0x2057d1)[_0xb00b('0x57')](function(_0x26cd15){return _0x26cd15;})[_0xb00b('0x69')](function(_0xd2f1ba){throw _0xd2f1ba;});})[_0xb00b('0x69')](function(_0x5f1258){ut[_0xb00b('0x31')](_0xb00b('0x104'),_0x5f1258);throw ut['message'](_0xb00b('0x105'),_0xdee547,_0x2057d1);});}else{throw ut['message'](_0xde6b5['message'],_0xdee547,_0x2057d1);}})['catch'](function(_0x384a16){ut['logger'](_0xb00b('0x106'),_0x384a16);throw ut[_0xb00b('0x2e')](_0xb00b('0x105'),![],!![]);});};Preview[_0xb00b('0xd')][_0xb00b('0x100')]=function(_0x116ced){if(_[_0xb00b('0x40')](_0x116ced)||_[_0xb00b('0x107')](_0x116ced)||!_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')])&&_[_0xb00b('0x40')](_0x116ced[0x0][_0xb00b('0x5b')][_0xb00b('0x33')])){ut[_0xb00b('0x31')]('[Preview][validateContact][Empty\x20Contact]',_0x116ced);return{'isValid':![],'message':_0xb00b('0x108')};}var _0x15f9cd=this[_0xb00b('0x22')][_0x116ced[0x0][_0xb00b('0x42')][_0xb00b('0x33')]];_0x15f9cd['message']=utils[_0xb00b('0x2f')][_0xb00b('0x6f')];if(_['isNil'](_0x15f9cd)){ut['logger'](_0xb00b('0x109'),_0x15f9cd);return{'isValid':![],'message':_0xb00b('0x10a')};}if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x10b')])){ut[_0xb00b('0x31')](_0xb00b('0x10c'),_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x10e'));if(!this[_0xb00b('0x6c')](_0x15f9cd[_0xb00b('0x6d')])){ut['logger'](_0xb00b('0x10c'),_0x15f9cd['name']+_0xb00b('0x10f'));return{'isValid':![],'message':_0xb00b('0x110')};}}if(!ut[_0xb00b('0x111')](_0x15f9cd[_0xb00b('0x3b')])){ut[_0xb00b('0x31')](_0xb00b('0x112'),_0x15f9cd['name']+_0xb00b('0x113'));return{'isValid':![],'message':_0xb00b('0x10d')+_0x15f9cd[_0xb00b('0x33')]+_0xb00b('0x113')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xb00b('0xd')][_0xb00b('0xe9')]=function(_0x58dbf6,_0x199ba1,_0x16cca9,_0x3c57b2){var _0xca4a87=this;return new Promise(function(_0x456515,_0x26145a){var _0x31fa5b=_0x58dbf6[_0xb00b('0x9c')];var _0x1ba141=_0xca4a87['isTrunkReachable'](_0x199ba1[_0xb00b('0x10b')])?util[_0xb00b('0x25')]('SIP/%s/%s%s',_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x114')])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1[_0xb00b('0x116')]>0x0?_0x16cca9[_0xb00b('0x103')][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9[_0xb00b('0x103')]):util['format'](_0xb00b('0x118'),_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1['Trunk'][_0xb00b('0x33')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x33')],_[_0xb00b('0x40')](_0x199ba1['dialPrefix'])?'':_0x199ba1[_0xb00b('0x114')][_0xb00b('0x115')]()||'',_0x199ba1['dialCutDigit']>0x0?_0x16cca9['phone'][_0xb00b('0x117')](_0x199ba1[_0xb00b('0x116')]):_0x16cca9['phone']);var _0x1256a8=_0xca4a87['isTrunkReachable'](_0x199ba1['Trunk'])?ut[_0xb00b('0x119')](_0x199ba1['Trunk']['callerid'],_0x199ba1[_0xb00b('0x11a')],_0x199ba1[_0xb00b('0x11b')]>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1[_0xb00b('0x11b')]):_0x199ba1[_0xb00b('0x11d')]):ut[_0xb00b('0x119')](_[_0xb00b('0x40')](_0x199ba1[_0xb00b('0x6d')])?_0x199ba1[_0xb00b('0x10b')][_0xb00b('0x11e')]:_0x199ba1[_0xb00b('0x6d')][_0xb00b('0x11e')],_0x199ba1[_0xb00b('0x11a')],_0x199ba1['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb00b('0x11c')](_0x199ba1[_0xb00b('0x11d')],_0x199ba1['dialRandomLastDigitCallerIdNumber']):_0x199ba1[_0xb00b('0x11d')]);if(_0x1256a8){_0x58dbf6['originatecalleridname']=ut[_0xb00b('0x11f')](_0x1256a8);_0x58dbf6[_0xb00b('0x120')]=ut[_0xb00b('0x121')](_0x1256a8);}var _0x5657ee=ut[_0xb00b('0x122')](_0x199ba1,_0x16cca9,_0x1ba141,_0x1256a8,_0x31fa5b,_0x58dbf6);_[_0xb00b('0x123')](_0x58dbf6,ut['toLowerVariables'](_0x5657ee));_0x58dbf6[_0xb00b('0x60')]=moment()[_0xb00b('0x25')](_0xb00b('0x88'));_0x199ba1[_0xb00b('0x124')]=_0x5657ee;var _0x57bfab=ut[_0xb00b('0x125')](_0x58dbf6,_0x199ba1,_0x5657ee,_0x58dbf6[_0xb00b('0x83')],_0x3c57b2);return ami[_0xb00b('0x4b')](_0x57bfab)['then'](function(_0x571811){_0x199ba1['originated']+=0x1;logger[_0xb00b('0x41')](_0xb00b('0x126'),_0x31fa5b,_0xb00b('0x9d'),_0x199ba1[_0xb00b('0x33')],_0xb00b('0x44'),_0x199ba1[_0xb00b('0xd6')]);_0x456515(_0x571811);})[_0xb00b('0x69')](function(_0x39b4c6){ut[_0xb00b('0xdd')](_0x58dbf6,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x58dbf6,_0xb00b('0x127'));_0x26145a(_0x39b4c6);});});};Preview[_0xb00b('0xd')]['syncNewExten']=function(_0x42fdce){if(this['actions'][_0x42fdce[_0xb00b('0x9f')]]){this['actions'][_0x42fdce[_0xb00b('0x9f')]][_0xb00b('0x4c')]=_0x42fdce['channel'];}};Preview[_0xb00b('0xd')][_0xb00b('0x16')]=function(_0x5573c9){var _0x44767a=this;var _0x4d4dbe=this[_0xb00b('0x13')][_0x5573c9[_0xb00b('0x128')]];if(_0x4d4dbe){if(_0x4d4dbe[_0xb00b('0x129')]&&this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]]){ut[_0xb00b('0x12a')](_0x4d4dbe,this[_0xb00b('0x14')][_0x4d4dbe[_0xb00b('0x129')]][_0xb00b('0x33')],this[_0xb00b('0x14')][_0x4d4dbe['lookAgent']]['id']);}var _0x4cff99=_[_0xb00b('0x12b')](_0x4d4dbe);_0x4cff99['responsetime']=moment()[_0xb00b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');var _0x198536=_0x44767a[_0xb00b('0x22')][_0x4d4dbe['queue']];if(ut[_0xb00b('0x12c')](_0x5573c9['response'])){if(_0x4d4dbe[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x4d4dbe['idContact']);}if(_0x4d4dbe[_0xb00b('0x83')]){rpcDb[_0xb00b('0x5f')](_0x4d4dbe[_0xb00b('0x85')]);}ami[_0xb00b('0x23')](_0xb00b('0x12d'),ut['buildObj'](_0x4d4dbe,_0xb00b('0x12e'),this[_0xb00b('0x22')][_0x4d4dbe['queue']]));this['callProgressDetectingAgent'](_0x4cff99,_0x198536,_0x5573c9);}else{_0x4d4dbe[_0xb00b('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x4cff99,0x4,_0xb00b('0x12f'));rpcDb[_0xb00b('0xe0')](_0x4cff99,_0xb00b('0x130'));}}};Preview[_0xb00b('0xd')]['syncHangup']=function(_0xcaefbd){var _0x482fc4=this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]];var _0x22f2f6;if(_0x482fc4){_0x22f2f6=this[_0xb00b('0x22')][_0x482fc4['queue']];logger[_0xb00b('0x41')](_0xb00b('0x131'),_0xcaefbd['linkedid'],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6['pTalking']);}if(this['actions'][_0xcaefbd[_0xb00b('0x9f')]]&&_0xcaefbd[_0xb00b('0x9f')]!==_0xcaefbd[_0xb00b('0x9c')]){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){this['callProgressDetectingCustomer'](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this['actions'][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger[_0xb00b('0x41')]('[syncHangup][talking][cause]',_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6['name'],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}else if(_0x482fc4&&_[_0xb00b('0x40')](_0x482fc4[_0xb00b('0x134')])&&_0x22f2f6['dialQueueProject']&&_0xcaefbd[_0xb00b('0x9f')]===_0xcaefbd[_0xb00b('0x9c')]&&_['isNil'](_0xcaefbd['reason'])&&_0xcaefbd['cause']==='16'&&_0xcaefbd[_0xb00b('0x135')]==='6'&&_[_0xb00b('0xda')](_0x482fc4[_0xb00b('0x136')])){if(_0x482fc4[_0xb00b('0x82')]){rpcDb[_0xb00b('0xfd')](_0x482fc4[_0xb00b('0x85')]);}if(_0x482fc4[_0xb00b('0x83')]){rpcDb['disableContact'](_0x482fc4['idContact']);}_0xcaefbd[_0xb00b('0xdc')]='22';this[_0xb00b('0xd9')](_0x482fc4,_0x22f2f6,_0xcaefbd);}else if(_0x482fc4&&_0x482fc4['transfer']){if(_0xcaefbd[_0xb00b('0x132')]==='16'&&this[_0xb00b('0x13')][_0xcaefbd['linkedid']][_0xb00b('0x46')]){logger['info'](_0xb00b('0x137'),_0xcaefbd['linkedid'],_0xcaefbd['cause'],'\x20Queue',_0x22f2f6[_0xb00b('0x33')],_0xb00b('0x9e'),_0x22f2f6[_0xb00b('0x29')]);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd['linkedid'],_0xcaefbd[_0xb00b('0x132')]);}else if(this[_0xb00b('0x13')][_0xcaefbd[_0xb00b('0x9f')]][_0xb00b('0x46')]){logger[_0xb00b('0x41')](_0xb00b('0x138'),_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')],_0xb00b('0x9d'),_0x22f2f6[_0xb00b('0x33')],'pTalking:\x20',_0x22f2f6['pTalking']);this[_0xb00b('0x133')](_0xcaefbd,_0xcaefbd[_0xb00b('0x9f')],_0xcaefbd[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x1a')]=function(_0x1e0206){if(this[_0xb00b('0x13')][_0x1e0206[_0xb00b('0xd7')]]&&_0x1e0206[_0xb00b('0xd7')]!==_0x1e0206['destuniqueid']){this[_0xb00b('0x133')](_0x1e0206,_0x1e0206[_0xb00b('0xd7')],_0x1e0206[_0xb00b('0xcd')]);}};Preview[_0xb00b('0xd')]['syncHangupRequest']=function(_0x45ad1f){if(this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]]&&_0x45ad1f[_0xb00b('0x9f')]!==_0x45ad1f[_0xb00b('0x9c')]&&!this[_0xb00b('0x13')][_0x45ad1f[_0xb00b('0x9f')]][_0xb00b('0x46')]){if(_0x45ad1f[_0xb00b('0x132')]==='1'){this['callProgressDetectingCustomer'](_0x45ad1f,_0x45ad1f['linkedid'],_0x45ad1f[_0xb00b('0x132')]);}}};Preview[_0xb00b('0xd')][_0xb00b('0x139')]=function(_0x121451,_0x2e9604,_0x19fce8){if(this[_0xb00b('0x13')][_0x121451]){if(_['isNil'](this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')])){this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')]={};}this[_0xb00b('0x13')][_0x121451][_0xb00b('0x124')][_0x2e9604]=_0x19fce8;}};Preview['prototype'][_0xb00b('0x13a')]=function(_0x1ec1c7){try{if(!_['isNil'](_0x1ec1c7)){if(ut[_0xb00b('0x13b')](_[_0xb00b('0x13c')](_0x1ec1c7[_0xb00b('0x13d')])[0x0])){this[_0xb00b('0x139')](_0x1ec1c7[_0xb00b('0x9c')],_[_0xb00b('0x13c')](_0x1ec1c7['variable'])[0x0],_0x1ec1c7['value']);}}}catch(_0x465238){logger['error']('[syncVarSet][Preview]',util['inspect'](_0x465238,{'showHidden':![],'depth':null}));}};Preview[_0xb00b('0xd')][_0xb00b('0x1f')]=function(_0x5a400c){if(_0x5a400c){if(this['actions'][_0x5a400c[_0xb00b('0x13e')]]){this[_0xb00b('0x13')][_0x5a400c[_0xb00b('0x13e')]][_0xb00b('0x136')]=!![];}}};Preview[_0xb00b('0xd')][_0xb00b('0x21')]=function(_0x3fd141){if(_0x3fd141){if(this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]){this[_0xb00b('0x13')][_0x3fd141[_0xb00b('0x13f')]]['transfer']=!![];}}};module[_0xb00b('0x140')]=Preview; \ No newline at end of file +var _0x3e74=['unmonitored','run','execRun','unlock','unlockContact','getContactPreview','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20working\x20correctly','dialActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','originatecalleridnum','addVariables','merge','toLowerVariables','starttime','variables','variablesAction','Action','[originated][increment]','OriginateError','syncNewExten','actionid','logLookAgent','YYYY-MM-DD\x20HH:mm:ss','response','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','util','uuid','moment','ioredis','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','../dialer/utils','redis','defaults','localhost','tail','sequence','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','prototype','syncCampaigns','hasOwnProperty','dialMethod','type','outbound','clearZombieChannels','recallMe','clearZombieChannel','queue','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','Agent','voicePause','[RecallMe]','disableContact','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','logger2','[getContactRecallMe]','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','BUSY','Busy','dialBusyRetryFrequency','busy','additional','Global','dialBusyMaxRetry','countbusyretry','incrementPreviewCounters','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','queueSummaryCountersUpdated','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Queue','agents','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable'];(function(_0x3302db,_0xed01ad){var _0x20a3a6=function(_0x13339e){while(--_0x13339e){_0x3302db['push'](_0x3302db['shift']());}};_0x20a3a6(++_0xed01ad);}(_0x3e74,0x175));var _0x43e7=function(_0x2b67b5,_0x18c553){_0x2b67b5=_0x2b67b5-0x0;var _0x3874d8=_0x3e74[_0x2b67b5];return _0x3874d8;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var uuid=require(_0x43e7('0x1'));var moment=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x43e7('0x4'));var loggerAction=require('../../../config/logger')(_0x43e7('0x5'));var ami=require(_0x43e7('0x6'));var rpcDb=require(_0x43e7('0x7'));var cmHopperAdditionalPhone=require(_0x43e7('0x8'));var Action=require(_0x43e7('0x9'));var ut=require('./util/util');var utils=require(_0x43e7('0xa'));config[_0x43e7('0xb')]=_[_0x43e7('0xc')](config[_0x43e7('0xb')],{'host':_0x43e7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x39c8bd){this[_0x43e7('0xe')]=this['tail']?this[_0x43e7('0xe')]['finally'](_0x39c8bd):_0x39c8bd();};function Preview(_0xf7c520){this[_0x43e7('0xf')]=new Sequence();this['campaignsPreview']=_0xf7c520[_0x43e7('0x10')];this[_0x43e7('0x11')]=_0xf7c520[_0x43e7('0x11')];this[_0x43e7('0x12')]={};this['agents']=_0xf7c520['agents'];this[_0x43e7('0x13')]=0x0;ami['on'](_0x43e7('0x14'),this[_0x43e7('0x15')]['bind'](this));ami['on']('hangup',this[_0x43e7('0x16')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x18'),this[_0x43e7('0x19')]['bind'](this));ami['on']('dialend',this[_0x43e7('0x1a')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1b'),this['syncNewExten']['bind'](this));ami['on'](_0x43e7('0x1c'),this[_0x43e7('0x1d')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1e'),this[_0x43e7('0x1f')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x20'),this[_0x43e7('0x21')][_0x43e7('0x17')](this));this[_0x43e7('0x22')](this[_0x43e7('0x23')]);}function emit(_0x177ee1,_0x4b5d64,_0xef1a5a){io['to'](_0x177ee1)[_0x43e7('0x24')](_0x4b5d64,_0xef1a5a);}function emitVoiceQueueChannelRemove(_0x4b386b){logger[_0x43e7('0x25')](_0x43e7('0x26'),JSON[_0x43e7('0x27')](_0x4b386b));emit(util[_0x43e7('0x28')](_0x43e7('0x29'),_0x4b386b[_0x43e7('0x2a')]),'voice_queue_channel:remove',_0x4b386b);io[_0x43e7('0x24')]('voice_queue_presence:remove',_0x4b386b);}function notSendMessagesQueue(_0x4c9df3){if(_0x4c9df3[_0x43e7('0x2b')]){if(_0x4c9df3[_0x43e7('0x2c')]===0x0&&_0x4c9df3['pTalking']===0x0){_0x4c9df3[_0x43e7('0x2b')]=![];_0x4c9df3['available']=0x0;_0x4c9df3[_0x43e7('0x2d')]=0x0;_0x4c9df3['message']=utils[_0x43e7('0x2e')][_0x43e7('0x2f')];ut[_0x43e7('0x30')](_0x43e7('0x31'),_0x4c9df3['name']+'\x20is\x20not\x20active');}else{_0x4c9df3[_0x43e7('0x32')]=utils['CAMPAIGN_STATUS'][_0x43e7('0x33')];ut[_0x43e7('0x30')](_0x43e7('0x31'),_0x4c9df3[_0x43e7('0x2a')]+'\x20is\x20deactivated');}}}Preview[_0x43e7('0x34')][_0x43e7('0x22')]=function(){var _0x45b675=this;setInterval(function(){_0x45b675[_0x43e7('0x35')]();},0x7cf);};Preview[_0x43e7('0x34')][_0x43e7('0x35')]=function(){var _0x2b85a5=this[_0x43e7('0x23')];this[_0x43e7('0x13')]+=0x1;for(var _0x35dbcd in _0x2b85a5){if(_0x2b85a5[_0x43e7('0x36')](_0x35dbcd)&&(_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]===_0x43e7('0x4')||_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]==='booked')&&_0x2b85a5[_0x35dbcd][_0x43e7('0x38')]===_0x43e7('0x39')){if(this[_0x43e7('0x13')]>0x7){this[_0x43e7('0x13')]=0x0;this[_0x43e7('0x3a')]();}}if(_0x2b85a5['hasOwnProperty'](_0x35dbcd)&&_0x2b85a5[_0x35dbcd][_0x43e7('0x37')]===_0x43e7('0x4')&&_0x2b85a5[_0x35dbcd][_0x43e7('0x38')]===_0x43e7('0x39')){if(_0x2b85a5[_0x35dbcd]['dialActive']){this['setMessage'](_0x2b85a5[_0x35dbcd]);if(_0x2b85a5[_0x35dbcd]['dialPreviewAutoRecallMe'])this[_0x43e7('0x3b')](_0x2b85a5[_0x35dbcd]);}else{notSendMessagesQueue(_0x2b85a5[_0x35dbcd]);}}}};Preview[_0x43e7('0x34')][_0x43e7('0x3c')]=function(_0x234fe6){var _0x108313=this;this[_0x43e7('0xf')]['enqueue'](function(){if(!_['isNil'](_0x108313['actions'][_0x234fe6])){loggerAction['info']('[clearZombieChannels][talking]',_0x234fe6,'Queue',_0x108313['actions'][_0x234fe6][_0x43e7('0x3d')],'originated:\x20',JSON[_0x43e7('0x27')](_0x108313[_0x43e7('0x23')][_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x3d')]][_0x43e7('0x2c')]),_0x43e7('0x3e'),JSON[_0x43e7('0x27')](_0x108313['campaignsPreview'][_0x108313['actions'][_0x234fe6]['queue']][_0x43e7('0x3f')]),JSON[_0x43e7('0x27')](_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x40')]),JSON[_0x43e7('0x27')](_[_0x43e7('0x41')](_0x108313[_0x43e7('0x12')][_0x234fe6],[_0x43e7('0x42'),'UserId',_0x43e7('0x43'),_0x43e7('0x44')])));return ami['Action']({'action':_0x43e7('0x45'),'channel':_0x108313['actions'][_0x234fe6][_0x43e7('0x46')]})[_0x43e7('0x47')](function(_0x1c6f45){if(_0x1c6f45[_0x43e7('0x32')]===_0x43e7('0x48')){setTimeout(function(){if(_0x108313[_0x43e7('0x12')][_0x234fe6]){ut['updateOriginated'](_0x108313['campaignsPreview'][_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x3d')]],_0x43e7('0x49'));if(_0x108313[_0x43e7('0x12')][_0x234fe6][_0x43e7('0x40')]===!![]){ut['decrementTalkink'](_0x108313[_0x43e7('0x23')][_0x108313[_0x43e7('0x12')][_0x234fe6]['queue']],_0x43e7('0x49'));ut['loggerError'](_0x43e7('0x4a')+_0x234fe6,_0x108313['actions'][_0x234fe6][_0x43e7('0x3d')]);}ut[_0x43e7('0x4b')](_0x43e7('0x4c')+_0x234fe6,_0x108313[_0x43e7('0x12')][_0x234fe6]['queue']);delete _0x108313['actions'][_0x234fe6];}},0x2328);}});}});};Preview[_0x43e7('0x34')][_0x43e7('0x3a')]=function(){var _0xe979b5=this;loggerAction[_0x43e7('0x25')]('[action]',_['size'](this['actions']));for(var _0x35e4fb in this['actions']){if(_0xe979b5[_0x43e7('0x12')]['hasOwnProperty'](_0x35e4fb)){_0xe979b5['clearZombieChannel'](_0x35e4fb);}}};Preview[_0x43e7('0x34')]['recallMe']=function(_0x2de14f){var _0x39db7f=this;rpcDb[_0x43e7('0x4d')](_0x2de14f['id'],ut[_0x43e7('0x4e')](this['agents']))[_0x43e7('0x4f')](function(_0x2b9046){if(!_[_0x43e7('0x50')](_0x2b9046)){for(var _0x1fd277=0x0;_0x1fd277<_0x2b9046[_0x43e7('0x51')];_0x1fd277+=0x1){if(ut[_0x43e7('0x52')](_0x2b9046[_0x1fd277]['scheduledat'])<_0x2de14f['dialRecallMeTimeout']*0x3c){if(_0x2b9046[_0x1fd277][_0x43e7('0x53')]&&!_0x2b9046[_0x1fd277][_0x43e7('0x53')][_0x43e7('0x54')]){_0x39db7f['run'](_0x2b9046[_0x1fd277]['id'])['then'](ut['logger2'](_0x43e7('0x55')))[_0x43e7('0x47')](ut['logger2'](_0x43e7('0x55')));}else{rpcDb[_0x43e7('0x56')](_0x2b9046[_0x1fd277]['id']);}}else{var _0x3c96fe=new Action(_0x2b9046[_0x1fd277],_0x2de14f);_0x3c96fe['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2de14f['outboundReCallsDay']+=0x1;ut[_0x43e7('0x57')](_0x3c96fe,0x17,_0x43e7('0x58'));if(_0x2de14f['dialRecallInQueue']){rpcDb[_0x43e7('0x59')](ut[_0x43e7('0x5a')](_0x2b9046[_0x1fd277]));rpcDb[_0x43e7('0x5b')](_0x3c96fe,_0x43e7('0x5c'));}else{ut['logCustomer'](_0x3c96fe,0x16,_0x43e7('0x5d'));rpcDb['createCustomerHistory'](_0x3c96fe,'[HistoryRecallClose]');rpcDb[_0x43e7('0x5e')](_0x3c96fe,_0x43e7('0x5f'));}}}}})[_0x43e7('0x47')](ut[_0x43e7('0x60')](_0x43e7('0x61')));};Preview[_0x43e7('0x34')][_0x43e7('0x62')]=function(_0x256ddd){_0x256ddd[_0x43e7('0x2b')]=!![];if(ut[_0x43e7('0x63')](_0x256ddd['loggedIn'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x43e7('0x64')](_0x256ddd['dialActive'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x2f')];}else if(!this[_0x43e7('0x65')](_0x256ddd[_0x43e7('0x66')])){if(!this['isTrunkReachable'](_0x256ddd['TrunkBackup'])){_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x67')];}else{_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];}}else{_0x256ddd[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];}};Preview[_0x43e7('0x34')][_0x43e7('0x69')]=function(_0x4ace49,_0x1ec35a,_0x2da2f3){var _0x50a3fa=this;var _0x4314d8=this[_0x43e7('0x12')][_0x1ec35a];var _0x2d0052=this['campaignsPreview'][_0x4314d8['queue']];var _0x459c13;var _0x3d9a29=![];var _0x4ebdde=0x2;var _0x283dd8=0x3;if(_0x2d0052){switch(_0x2da2f3){case'1':_0x2d0052['outboundNoSuchCallsDay']+=0x1;_0x4314d8['countnosuchnumberretry']+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x0,_0x43e7('0x6c'));ami[_0x43e7('0x24')]('custom:agentnosuchnumber',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x6e')));rpcDb['createCustomerHistory'](_0x4314d8,_0x43e7('0x6f'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'0',_0x2d0052)[_0x43e7('0x4f')](function(_0x5bb536){_0x3d9a29=_0x5bb536['additional']==0x1;_0x4ebdde=_0x2d0052['dialNoSuchNumberRetryFrequency'];_0x283dd8=_0x2d0052[_0x43e7('0x71')];if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0x74'));}else{if(_0x4314d8[_0x43e7('0x75')]>=_0x2d0052[_0x43e7('0x76')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0x75'),_0x2d0052[_0x43e7('0x79')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];}else{_0x4314d8[_0x43e7('0x75')]++;logger[_0x43e7('0x25')](_0x43e7('0x7d'),_0x4314d8['countnosuchnumberretry']);logger['info']('id',_0x4314d8[_0x43e7('0x7e')]);_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8['idContact'],'field':{'countnosuchnumberretry':_0x4314d8['countnosuchnumberretry']}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)['then'](function(){});});}});break;case _0x43e7('0x80'):var _0x135791=moment()[_0x43e7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x4314d8[_0x43e7('0x81')]=_0x135791;_0x4314d8[_0x43e7('0x82')]=_0x135791;_0x4314d8[_0x43e7('0x40')]=!![];_0x2d0052[_0x43e7('0x3f')]+=0x1;logger[_0x43e7('0x25')](_0x43e7('0x83'),_0x4314d8[_0x43e7('0x84')],'\x20Queue',_0x2d0052[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x2d0052[_0x43e7('0x3f')]);ami['emit']('custom:agentconnect',ut[_0x43e7('0x6d')](_0x4314d8,'connect',this['campaignsPreview'][_0x4314d8[_0x43e7('0x3d')]]));if(_0x2d0052[_0x43e7('0x85')]){ami['emit'](_0x43e7('0x86'),ut[_0x43e7('0x87')](_0x4314d8));}break;case'16':ami[_0x43e7('0x24')](_0x43e7('0x88'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x89'),this[_0x43e7('0x23')][_0x4314d8['queue']]));emitVoiceQueueChannelRemove(ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x89')));_0x2d0052['outboundAnswerCallsDay']+=0x1;_0x2d0052[_0x43e7('0x8a')]+=0x1;_0x2d0052['answered']+=0x1;ut[_0x43e7('0x8b')](_0x2d0052,_0x43e7('0x8c'));_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x4,_0x43e7('0x8d'));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0x8e'));rpcDb['createCustomerFinal'](_0x4314d8,_0x43e7('0x8f'));rpcDb[_0x43e7('0x90')](_0x4314d8);_0x2d0052[_0x43e7('0x91')]+=_0x4314d8[_0x43e7('0x92')];_0x2d0052[_0x43e7('0x93')]+=_0x4314d8['talktime'];logger[_0x43e7('0x25')](_0x43e7('0x94'),_0x4314d8[_0x43e7('0x84')],_0x43e7('0x95'),_0x2d0052[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x2d0052[_0x43e7('0x3f')]);delete this['actions'][_0x4ace49['linkedid']];break;case _0x43e7('0x96'):_0x2d0052['outboundBusyCallsDay']+=0x1;_0x4314d8['countbusyretry']+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x5,_0x43e7('0x97'));_0x4ebdde=_0x2d0052[_0x43e7('0x98')];_0x283dd8=_0x2d0052[_0x43e7('0x71')];ami[_0x43e7('0x24')]('custom:agentbusy',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0x99')));rpcDb[_0x43e7('0x5b')](_0x4314d8,'[callProgressDetectingCustomer][logBusy]');_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'5',_0x2d0052)[_0x43e7('0x4f')](function(_0x184ae3){_0x3d9a29=_0x184ae3[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb['createCustomerFinal'](_0x459c13,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4314d8['countbusyretry']>=_0x2d0052[_0x43e7('0x9c')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0x9d'),_0x2d0052[_0x43e7('0x98')]),_0x4314d8['unlockAgent'],_0x4314d8['activeContact']);}}}else{_0x4314d8['countbusyretry']++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countbusyretry':_0x4314d8['countbusyretry']}})['then'](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0x9f'):_0x2d0052['outboundNoAnswerCallsDay']+=0x1;_0x4314d8[_0x43e7('0xa0')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x3,'NoAnswer');_0x4ebdde=_0x2d0052[_0x43e7('0xa1')];_0x283dd8=_0x2d0052['callAdditionalPhoneAfterMin'];var _0xa66309=ut[_0x43e7('0xa2')](_0x4314d8,_0x2d0052);ami[_0x43e7('0x24')](_0x43e7('0xa3'),_0xa66309);rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xa4'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'3',_0x2d0052)['then'](function(_0x109c86){_0x3d9a29=_0x109c86[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut['cloneAction'](_0x4314d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0xa5'));}else{if(_0x4314d8['countnoanswerretry']>=_0x2d0052[_0x43e7('0xa6')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xa4'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xa0'),_0x2d0052[_0x43e7('0xa1')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8['idContact'],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0xa7'):_0x2d0052['outboundCongestionCallsDay']+=0x1;_0x4314d8['countcongestionretry']+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x8,_0x43e7('0xa8'));_0x4ebdde=_0x2d0052[_0x43e7('0xa9')];_0x283dd8=_0x2d0052['callAdditionalPhoneAfterMin'];ami['emit'](_0x43e7('0xaa'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xab')));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xac'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'8',_0x2d0052)['then'](function(_0x403276){_0x3d9a29=_0x403276[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut['cloneAction'](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xad'));}else{if(_0x4314d8[_0x43e7('0xae')]>=_0x2d0052['dialCongestionMaxRetry']){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xac'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xae'),_0x2d0052['dialBusyRetryFrequency']),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8['countcongestionretry']++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countcongestionretry':_0x4314d8[_0x43e7('0xae')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case'CANCEL':_0x2d0052[_0x43e7('0xaf')]+=0x1;_0x4314d8[_0x43e7('0xb0')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x14,_0x43e7('0xb1'));_0x4ebdde=_0x2d0052[_0x43e7('0xb2')];_0x283dd8=_0x2d0052[_0x43e7('0x71')];ami[_0x43e7('0x24')]('custom:agentreject',ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xb3')));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xb4'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'20',_0x2d0052)['then'](function(_0x2c5bf9){_0x3d9a29=_0x2c5bf9[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x459c13,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4314d8[_0x43e7('0xb0')]>=_0x2d0052['dialAgentRejectMaxRetry']){rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xb5'));}else{rpcDb[_0x43e7('0x77')](ut[_0x43e7('0x78')](_0x4314d8,_0x43e7('0xb0'),_0x2d0052['dialAgentRejectRetryFrequency']),_0x4314d8['unlockAgent'],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case _0x43e7('0xb6'):_0x2d0052[_0x43e7('0xb7')]+=0x1;_0x4314d8[_0x43e7('0xb8')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0xb,_0x43e7('0xb9'));rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xba'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'11',_0x2d0052)[_0x43e7('0x4f')](function(_0x3286b1){_0x3d9a29=_0x3286b1[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052[_0x43e7('0x72')]){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb['createCustomerFinal'](_0x459c13,_0x43e7('0xba'));}else{if(_0x4314d8[_0x43e7('0xbb')]>=_0x2d0052[_0x43e7('0xbc')]){rpcDb[_0x43e7('0x5e')](_0x4314d8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x43e7('0x77')](ut['scheduledAt'](_0x4314d8,_0x43e7('0xb8'),_0x2d0052[_0x43e7('0xbd')]),_0x4314d8[_0x43e7('0x7a')],_0x4314d8[_0x43e7('0x7b')]);}}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8['idContact'],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});break;case'18':_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8['countmachineretry']+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut['logCustomer'](_0x4314d8,0x12,_0x4ace49[_0x43e7('0xbf')]||_0x4ace49[_0x43e7('0xc0')]);ami[_0x43e7('0x24')](_0x43e7('0xc1'),ut['buildObj'](_0x4314d8,'amd'));rpcDb['createCustomerHistory'](_0x4314d8,_0x43e7('0xc2'));_0x50a3fa['verifyAdditionalPhones'](_0x4314d8,'18',_0x2d0052)['then'](function(_0x4d7f0f){_0x3d9a29=_0x4d7f0f[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0x12,'Global');rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc2'));}else{rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xc2'));}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa['incrementPreviewCounters']({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)['then'](function(){});});}});delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];break;case'19':_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8[_0x43e7('0x6a')]=ut['totalGlobal'](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0x13,_0x4ace49[_0x43e7('0xbf')]||_0x4ace49[_0x43e7('0xc0')]);ami['emit'](_0x43e7('0xc1'),ut[_0x43e7('0x6d')](_0x4314d8,_0x43e7('0xc3')));rpcDb[_0x43e7('0x5b')](_0x4314d8,'[callProgressDetectingCustomer][machine]');_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'18',_0x2d0052)['then'](function(_0x299086){_0x3d9a29=_0x299086[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut['totalGlobal'](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc4'));}else{rpcDb[_0x43e7('0x5e')](_0x4314d8,_0x43e7('0xc4'));}}else{_0x4314d8[_0x43e7('0xa0')]++;_0x50a3fa[_0x43e7('0x9e')]({'id':_0x4314d8[_0x43e7('0x7e')],'field':{'countnoanswerretry':_0x4314d8[_0x43e7('0xa0')]}})[_0x43e7('0x4f')](function(){_0x50a3fa['swapAdditionalPhones'](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});});}});delete this['actions'][_0x4ace49[_0x43e7('0x7c')]];break;default:if(_0x4314d8[_0x43e7('0x40')]){ut[_0x43e7('0x8b')](_0x2d0052,'[default]');ut[_0x43e7('0x4b')](_0x43e7('0xc5')+_0x2d0052[_0x43e7('0x2a')],_0x4ace49);}_0x2d0052[_0x43e7('0xbe')]+=0x1;_0x4314d8['countglobal']=ut[_0x43e7('0x6b')](_0x4314d8);ut[_0x43e7('0x57')](_0x4314d8,0xc,_0x4ace49['cause-txt']||_0x4ace49['dialstatus']);_0x4ebdde=_0x2d0052['dialAgentRejectRetryFrequency'];_0x283dd8=_0x2d0052[_0x43e7('0x71')];rpcDb[_0x43e7('0x5b')](_0x4314d8,_0x43e7('0xc6'));_0x50a3fa[_0x43e7('0x70')](_0x4314d8,'20',_0x2d0052)[_0x43e7('0x4f')](function(_0x40019e){_0x3d9a29=_0x40019e[_0x43e7('0x9a')]==0x1;if(!_0x3d9a29){if(ut[_0x43e7('0x6b')](_0x4314d8)>=_0x2d0052['dialGlobalMaxRetry']){_0x459c13=ut[_0x43e7('0x73')](_0x4314d8,0xf,_0x43e7('0x9b'));rpcDb[_0x43e7('0x5e')](_0x459c13,_0x43e7('0xc7'));}else{rpcDb['createCustomerFinal'](_0x4314d8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];}else{_0x50a3fa[_0x43e7('0x7f')](_0x4314d8,_0x4ebdde,_0x283dd8)[_0x43e7('0x4f')](function(){});}});}if(!(_0x4314d8['dialAnswer']&&_0x2da2f3==='16')){ut[_0x43e7('0xc8')](_0x2d0052,_0x43e7('0xc9'));logger[_0x43e7('0x25')](_0x43e7('0xca'),_0x4314d8[_0x43e7('0x84')],_0x43e7('0x95'),_0x2d0052['name'],_0x43e7('0xcb'),_0x2d0052['originated']);}if(_0x2da2f3!=='ANSWER'){delete this[_0x43e7('0x12')][_0x4ace49[_0x43e7('0x7c')]];delete this['actions'][_0x4ace49['destlinkedid']];}_0x2d0052[_0x43e7('0xcc')]=!![];}};Preview[_0x43e7('0x34')]['callProgressDetectingAgent']=function(_0x189c38,_0x156a3c,_0x302138){if(_[_0x43e7('0xcd')](_0x156a3c)&&'object'!==typeof _0x156a3c){return;}if(_['isUndefined'](_0x302138)&&_0x43e7('0xce')!==typeof _0x302138){return;}switch(_0x302138[_0x43e7('0xcf')]){case'0':ut[_0x43e7('0xd0')](_0x189c38,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x189c38,_0x43e7('0xd1'));break;case'3':ut[_0x43e7('0xd0')](_0x189c38,0x3,_0x43e7('0xd2'));rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd4'));break;case'5':ut[_0x43e7('0xd0')](_0x189c38,0x5,_0x43e7('0x97'));rpcDb[_0x43e7('0xd3')](_0x189c38,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x189c38,0x8,'Congestion');rpcDb[_0x43e7('0xd3')](_0x189c38,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x43e7('0xd0')](_0x189c38,0x16,_0x43e7('0xd5'));rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd6'));break;default:ut[_0x43e7('0xd0')](_0x189c38,0xc,_0x302138['reason']);rpcDb[_0x43e7('0xd3')](_0x189c38,_0x43e7('0xd7'));}ut[_0x43e7('0xc8')](_0x156a3c,_0x43e7('0xd8'));logger['info'](_0x43e7('0xd9'),_0x189c38[_0x43e7('0x84')],_0x43e7('0x95'),_0x156a3c[_0x43e7('0x2a')],_0x43e7('0xcb'),_0x156a3c[_0x43e7('0x2c')]);delete this[_0x43e7('0x12')][_0x189c38['uniqueid']];};Preview[_0x43e7('0x34')][_0x43e7('0x70')]=function(_0x20fab2,_0x3637d9,_0x3c52d3){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x20fab2,_0x3637d9,_0x3c52d3)[_0x43e7('0x47')](logger[_0x43e7('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x43e7('0x34')][_0x43e7('0x7f')]=function(_0x577ac6,_0x235418,_0x368c57){return cmHopperAdditionalPhone[_0x43e7('0x7f')](_0x577ac6,_0x235418,_0x368c57)[_0x43e7('0x47')](logger[_0x43e7('0x25')]('[swapAdditionalPhone]\x20'));};Preview[_0x43e7('0x34')][_0x43e7('0x9e')]=function(_0x1e5d48){return Promise['resolve']()[_0x43e7('0x4f')](cmHopperAdditionalPhone[_0x43e7('0x9e')](_0x1e5d48))['catch'](logger[_0x43e7('0x25')](_0x43e7('0xda')));};Preview[_0x43e7('0x34')][_0x43e7('0xdb')]=function(_0x15b04a,_0x3b5f39,_0x4d5736,_0xcbdb35,_0xa5981f){var _0x19ddfa=this;return new Promise(function(_0x4a4031,_0x5a7f2e){if(_[_0x43e7('0x50')](_0x3b5f39)||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0xdc')])||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0xdd')])||_[_0x43e7('0x50')](_0x3b5f39[_0x43e7('0x43')])){_0x5a7f2e(ut[_0x43e7('0x32')]('Contact\x20is\x20undefined',_0xcbdb35,_0xa5981f));return;}var _0x723c7=uuid['v4']();var _0xfbdb90=_0x19ddfa[_0x43e7('0x23')][_0x3b5f39[_0x43e7('0xde')][_0x43e7('0x2a')]];var _0x114e00=_0x4d5736?_0x19ddfa[_0x43e7('0xdf')][_0x4d5736]['id']:undefined;_0x19ddfa[_0x43e7('0x12')][_0x723c7]=new Action(_0x3b5f39,_0xfbdb90,_0x723c7,_0x4d5736,_0x114e00);var _0x51e17c=_0x19ddfa[_0x43e7('0x12')][_0x723c7];_0x51e17c[_0x43e7('0x7a')]=_0xcbdb35;_0x51e17c[_0x43e7('0x7b')]=_0xa5981f;_0x51e17c[_0x43e7('0xe0')]=_0x4d5736;if(_[_0x43e7('0xe1')](_0x15b04a)){_0x19ddfa['execCall'](_0x51e17c,_0xfbdb90,_0x3b5f39,_0x4d5736)[_0x43e7('0x4f')](function(_0x186e57){logger[_0x43e7('0x25')](_0x43e7('0xe2'),_0x43e7('0xe3')+_0x51e17c['queue']+_0x43e7('0xe4')+_0x51e17c['idContact'],JSON[_0x43e7('0x27')](_0x186e57));ami[_0x43e7('0x24')](_0x43e7('0xe5'),ut[_0x43e7('0x6d')](_0x51e17c,'called',_0x19ddfa[_0x43e7('0x23')][_0x51e17c[_0x43e7('0x3d')]]));_0x4a4031(ut[_0x43e7('0x32')](_0x43e7('0xe6')));})[_0x43e7('0x47')](function(_0x27bbd6){ut[_0x43e7('0x30')](_0x43e7('0xe7'),_0x27bbd6);_0x5a7f2e(ut[_0x43e7('0x32')](_0x43e7('0xe8'),_0xcbdb35,_0xa5981f));});}else{_0xfbdb90[_0x43e7('0xe9')]+=0x1;ut['logBlacklist'](_0x51e17c);rpcDb['createHistory'](_0x51e17c,_0x43e7('0xea'));delete _0x19ddfa['actions'][_0x723c7];_0x5a7f2e(ut['message'](_0x43e7('0xeb'),_0xcbdb35,_0xa5981f));}});};Preview[_0x43e7('0x34')]['isTrunkReachable']=function(_0x143be2){return!_['isNil'](_0x143be2)&&!_['isNil'](_0x143be2['name'])&&!_[_0x43e7('0x50')](_0x143be2[_0x43e7('0xec')])&&_0x143be2[_0x43e7('0xec')]&&!_[_0x43e7('0x50')](this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])])&&!_[_0x43e7('0x50')](this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])][_0x43e7('0x45')])&&(this[_0x43e7('0x11')][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2[_0x43e7('0x2a')])][_0x43e7('0x45')]===_0x43e7('0xee')||this['trunks'][util[_0x43e7('0x28')](_0x43e7('0xed'),_0x143be2['name'])][_0x43e7('0x45')]===_0x43e7('0xef'));};Preview[_0x43e7('0x34')][_0x43e7('0xf0')]=function(_0x49441c,_0x31797a){return this[_0x43e7('0xf1')](_0x49441c,_0x31797a)['then'](function(_0x43500a){return _[_0x43e7('0x41')](_0x43500a,[_0x43e7('0x32')]);})['catch'](function(_0x22b824){if(_0x22b824[_0x43e7('0xf2')]){rpcDb[_0x43e7('0xf3')](_0x49441c);}if(_0x22b824[_0x43e7('0xec')]){rpcDb[_0x43e7('0x56')](_0x49441c);}throw _['pick'](_0x22b824,[_0x43e7('0x32')]);});};Preview[_0x43e7('0x34')]['execRun']=function(_0x1d31f5,_0x47b03b){var _0x4bf8ad=this;var _0x55baca,_0x5486a6;return rpcDb[_0x43e7('0xf4')](_0x1d31f5)[_0x43e7('0x4f')](function(_0x7f518f){if(!_[_0x43e7('0x50')](_0x7f518f[0x0])){_0x5486a6=_0x7f518f[0x0]['recallme']?![]:!![];_0x55baca=_0x7f518f[0x0]['recallme']?!![]:![];_0x55baca=_0x47b03b?!![]:_0x55baca;}var _0x267b26=_0x4bf8ad['validateContact'](_0x7f518f);if(_0x267b26[_0x43e7('0xf5')]){rpcDb['checkIsBlackList'](_[_0x43e7('0x41')](_0x7f518f[0x0],['VoiceQueueId','phone']))['then'](function(_0x5653b0){_0x4bf8ad[_0x43e7('0xdb')](_0x5653b0,_0x7f518f[0x0],_0x47b03b,_0x5486a6,_0x55baca)[_0x43e7('0x4f')](function(_0x574658){return _0x574658;})['catch'](function(_0x466aa7){throw _0x466aa7;});})[_0x43e7('0x47')](function(_0x517289){ut['logger'](_0x43e7('0xf6'),_0x517289);throw ut[_0x43e7('0x32')](_0x43e7('0xf7'),_0x5486a6,_0x55baca);});}else{throw ut[_0x43e7('0x32')](_0x267b26['message'],_0x5486a6,_0x55baca);}})[_0x43e7('0x47')](function(_0x536b7d){ut[_0x43e7('0x30')](_0x43e7('0xf8'),_0x536b7d);throw ut[_0x43e7('0x32')](_0x43e7('0xf7'),![],!![]);});};Preview[_0x43e7('0x34')][_0x43e7('0xf9')]=function(_0x2cbbda){if(_['isNil'](_0x2cbbda)||_[_0x43e7('0xe1')](_0x2cbbda)||!_[_0x43e7('0x50')](_0x2cbbda[0x0]['Agent'])&&_[_0x43e7('0x50')](_0x2cbbda[0x0][_0x43e7('0x53')][_0x43e7('0x2a')])){ut[_0x43e7('0x30')](_0x43e7('0xfa'),_0x2cbbda);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x3fd573=this['campaignsPreview'][_0x2cbbda[0x0][_0x43e7('0xde')]['name']];_0x3fd573[_0x43e7('0x32')]=utils[_0x43e7('0x2e')][_0x43e7('0x68')];if(_[_0x43e7('0x50')](_0x3fd573)){ut[_0x43e7('0x30')]('[Preview][validateContact][Empty\x20Campaign]',_0x3fd573);return{'isValid':![],'message':_0x43e7('0xfb')};}if(!this['isTrunkReachable'](_0x3fd573[_0x43e7('0x66')])){ut[_0x43e7('0x30')](_0x43e7('0xfc'),'campaign\x20Name:\x20'+_0x3fd573[_0x43e7('0x2a')]+_0x43e7('0xfd'));if(!this[_0x43e7('0x65')](_0x3fd573[_0x43e7('0xfe')])){ut[_0x43e7('0x30')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x3fd573[_0x43e7('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x43e7('0xff')};}}if(!ut[_0x43e7('0x64')](_0x3fd573[_0x43e7('0x100')])){ut[_0x43e7('0x30')](_0x43e7('0x101'),_0x3fd573[_0x43e7('0x2a')]+_0x43e7('0x102'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x3fd573[_0x43e7('0x2a')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x43e7('0x103')};};Preview[_0x43e7('0x34')][_0x43e7('0x104')]=function(_0xbc6e18,_0x16c757,_0xf9178f,_0x3bb7ab){var _0x2be8c7=this;return new Promise(function(_0x2bb14d,_0x57f7ea){var _0x240478=_0xbc6e18['uniqueid'];var _0x2b7b33=_0x2be8c7[_0x43e7('0x65')](_0x16c757['Trunk'])?util[_0x43e7('0x28')](_0x43e7('0x105'),_0x16c757['Trunk'][_0x43e7('0x2a')],_[_0x43e7('0x50')](_0x16c757[_0x43e7('0x106')])?'':_0x16c757[_0x43e7('0x106')][_0x43e7('0x107')]()||'',_0x16c757[_0x43e7('0x108')]>0x0?_0xf9178f[_0x43e7('0xdd')][_0x43e7('0x109')](_0x16c757['dialCutDigit']):_0xf9178f[_0x43e7('0xdd')]):util[_0x43e7('0x28')](_0x43e7('0x105'),_['isNil'](_0x16c757[_0x43e7('0xfe')])?_0x16c757[_0x43e7('0x66')]['name']:_0x16c757[_0x43e7('0xfe')][_0x43e7('0x2a')],_['isNil'](_0x16c757[_0x43e7('0x106')])?'':_0x16c757[_0x43e7('0x106')][_0x43e7('0x107')]()||'',_0x16c757['dialCutDigit']>0x0?_0xf9178f[_0x43e7('0xdd')][_0x43e7('0x109')](_0x16c757['dialCutDigit']):_0xf9178f[_0x43e7('0xdd')]);var _0x2ed5e0=_0x2be8c7[_0x43e7('0x65')](_0x16c757[_0x43e7('0x66')])?ut['getCallerId'](_0x16c757['Trunk'][_0x43e7('0x10a')],_0x16c757[_0x43e7('0x10b')],_0x16c757[_0x43e7('0x10c')]>0x0?ut[_0x43e7('0x10d')](_0x16c757['dialOriginateCallerIdNumber'],_0x16c757[_0x43e7('0x10c')]):_0x16c757[_0x43e7('0x10e')]):ut[_0x43e7('0x10f')](_[_0x43e7('0x50')](_0x16c757['TrunkBackup'])?_0x16c757[_0x43e7('0x66')][_0x43e7('0x10a')]:_0x16c757[_0x43e7('0xfe')][_0x43e7('0x10a')],_0x16c757[_0x43e7('0x10b')],_0x16c757['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x16c757['dialOriginateCallerIdNumber'],_0x16c757[_0x43e7('0x10c')]):_0x16c757[_0x43e7('0x10e')]);if(_0x2ed5e0){_0xbc6e18[_0x43e7('0x110')]=ut['extractCalleridName'](_0x2ed5e0);_0xbc6e18[_0x43e7('0x111')]=ut['extractCalleridNumber'](_0x2ed5e0);}var _0x1c7f6a=ut[_0x43e7('0x112')](_0x16c757,_0xf9178f,_0x2b7b33,_0x2ed5e0,_0x240478,_0xbc6e18);_[_0x43e7('0x113')](_0xbc6e18,ut[_0x43e7('0x114')](_0x1c7f6a));_0xbc6e18[_0x43e7('0x115')]=moment()[_0x43e7('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x16c757[_0x43e7('0x116')]=_0x1c7f6a;var _0x202421=ut[_0x43e7('0x117')](_0xbc6e18,_0x16c757,_0x1c7f6a,_0xbc6e18[_0x43e7('0x7b')],_0x3bb7ab);return ami[_0x43e7('0x118')](_0x202421)[_0x43e7('0x4f')](function(_0x4637f6){_0x16c757[_0x43e7('0x2c')]+=0x1;logger[_0x43e7('0x25')](_0x43e7('0x119'),_0x240478,_0x43e7('0x95'),_0x16c757[_0x43e7('0x2a')],_0x43e7('0xcb'),_0x16c757['originated']);_0x2bb14d(_0x4637f6);})[_0x43e7('0x47')](function(_0x24d6e4){ut['logAgent'](_0xbc6e18,0xe,_0x43e7('0x11a'));rpcDb[_0x43e7('0xd3')](_0xbc6e18,'[originateFailure][logOriginateFailure]');_0x57f7ea(_0x24d6e4);});});};Preview[_0x43e7('0x34')][_0x43e7('0x11b')]=function(_0x2b9cf9){if(this['actions'][_0x2b9cf9['linkedid']]){this[_0x43e7('0x12')][_0x2b9cf9[_0x43e7('0x7c')]][_0x43e7('0x46')]=_0x2b9cf9[_0x43e7('0x46')];}};Preview[_0x43e7('0x34')][_0x43e7('0x15')]=function(_0x25b5a2){var _0xfe77ea=this;var _0x5d2cb0=this[_0x43e7('0x12')][_0x25b5a2[_0x43e7('0x11c')]];if(_0x5d2cb0){if(_0x5d2cb0[_0x43e7('0xe0')]&&this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]]){ut[_0x43e7('0x11d')](_0x5d2cb0,this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]][_0x43e7('0x2a')],this[_0x43e7('0xdf')][_0x5d2cb0[_0x43e7('0xe0')]]['id']);}var _0x218743=_['clone'](_0x5d2cb0);_0x218743[_0x43e7('0x81')]=moment()[_0x43e7('0x28')](_0x43e7('0x11e'));var _0x21c8b9=_0xfe77ea[_0x43e7('0x23')][_0x5d2cb0[_0x43e7('0x3d')]];if(ut['isFailure'](_0x25b5a2[_0x43e7('0x11f')])){if(_0x5d2cb0['unlockAgent']){rpcDb[_0x43e7('0xf3')](_0x5d2cb0[_0x43e7('0x7e')]);}if(_0x5d2cb0[_0x43e7('0x7b')]){rpcDb['disableContact'](_0x5d2cb0[_0x43e7('0x7e')]);}ami[_0x43e7('0x24')]('custom:agentringnoanswer',ut[_0x43e7('0x6d')](_0x5d2cb0,'rejected',this[_0x43e7('0x23')][_0x5d2cb0[_0x43e7('0x3d')]]));this[_0x43e7('0x120')](_0x218743,_0x21c8b9,_0x25b5a2);}else{_0x5d2cb0[_0x43e7('0x115')]=moment()['format'](_0x43e7('0x11e'));ut[_0x43e7('0xd0')](_0x218743,0x4,_0x43e7('0x8d'));rpcDb['createAgentHistory'](_0x218743,_0x43e7('0x121'));}}};Preview[_0x43e7('0x34')][_0x43e7('0x16')]=function(_0x431345){var _0x77c2f=this[_0x43e7('0x12')][_0x431345['linkedid']];var _0x3f057e;if(_0x77c2f){_0x3f057e=this['campaignsPreview'][_0x77c2f[_0x43e7('0x3d')]];logger[_0x43e7('0x25')]('[syncHangup][talking]',_0x431345[_0x43e7('0x7c')],_0x43e7('0x95'),_0x3f057e['name'],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);}if(this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]]&&_0x431345['linkedid']!==_0x431345['uniqueid']){if(_0x431345[_0x43e7('0x122')]==='16'&&this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}else if(this[_0x43e7('0x12')][_0x431345['linkedid']][_0x43e7('0x40')]){logger[_0x43e7('0x25')]('[syncHangup][talking][cause]',_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')],_0x43e7('0x95'),_0x3f057e[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345['linkedid'],_0x431345[_0x43e7('0x122')]);}}else if(_0x77c2f&&_['isNil'](_0x77c2f[_0x43e7('0x123')])&&_0x3f057e[_0x43e7('0x124')]&&_0x431345['linkedid']===_0x431345[_0x43e7('0x84')]&&_['isNil'](_0x431345[_0x43e7('0xcf')])&&_0x431345[_0x43e7('0x122')]==='16'&&_0x431345[_0x43e7('0x125')]==='6'&&_['isUndefined'](_0x77c2f['transfer'])){if(_0x77c2f[_0x43e7('0x7a')]){rpcDb[_0x43e7('0xf3')](_0x77c2f['idContact']);}if(_0x77c2f[_0x43e7('0x7b')]){rpcDb[_0x43e7('0x56')](_0x77c2f[_0x43e7('0x7e')]);}_0x431345['reason']='22';this[_0x43e7('0x120')](_0x77c2f,_0x3f057e,_0x431345);}else if(_0x77c2f&&_0x77c2f[_0x43e7('0x126')]){if(_0x431345[_0x43e7('0x122')]==='16'&&this['actions'][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){logger[_0x43e7('0x25')](_0x43e7('0x127'),_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')],'\x20Queue',_0x3f057e[_0x43e7('0x2a')],_0x43e7('0x3e'),_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}else if(this[_0x43e7('0x12')][_0x431345[_0x43e7('0x7c')]][_0x43e7('0x40')]){logger[_0x43e7('0x25')](_0x43e7('0x128'),_0x431345[_0x43e7('0x7c')],_0x431345['cause'],'\x20Queue',_0x3f057e['name'],'pTalking:\x20',_0x3f057e[_0x43e7('0x3f')]);this[_0x43e7('0x69')](_0x431345,_0x431345[_0x43e7('0x7c')],_0x431345[_0x43e7('0x122')]);}}};Preview[_0x43e7('0x34')][_0x43e7('0x1a')]=function(_0x51dc07){if(this['actions'][_0x51dc07[_0x43e7('0x129')]]&&_0x51dc07[_0x43e7('0x129')]!==_0x51dc07['destuniqueid']){this['callProgressDetectingCustomer'](_0x51dc07,_0x51dc07[_0x43e7('0x129')],_0x51dc07[_0x43e7('0xc0')]);}};Preview['prototype'][_0x43e7('0x19')]=function(_0x57bcab){if(this['actions'][_0x57bcab[_0x43e7('0x7c')]]&&_0x57bcab[_0x43e7('0x7c')]!==_0x57bcab['uniqueid']&&!this['actions'][_0x57bcab[_0x43e7('0x7c')]][_0x43e7('0x40')]){if(_0x57bcab[_0x43e7('0x122')]==='1'){this[_0x43e7('0x69')](_0x57bcab,_0x57bcab['linkedid'],_0x57bcab[_0x43e7('0x122')]);}}};Preview[_0x43e7('0x34')]['addVariable']=function(_0x560373,_0x4cdb87,_0x4eaf92){if(this[_0x43e7('0x12')][_0x560373]){if(_[_0x43e7('0x50')](this['actions'][_0x560373]['variables'])){this[_0x43e7('0x12')][_0x560373][_0x43e7('0x116')]={};}this[_0x43e7('0x12')][_0x560373][_0x43e7('0x116')][_0x4cdb87]=_0x4eaf92;}};Preview[_0x43e7('0x34')]['syncVarSet']=function(_0x3836e7){try{if(!_[_0x43e7('0x50')](_0x3836e7)){if(ut[_0x43e7('0x12a')](_[_0x43e7('0x12b')](_0x3836e7[_0x43e7('0x12c')])[0x0])){this['addVariable'](_0x3836e7[_0x43e7('0x84')],_[_0x43e7('0x12b')](_0x3836e7[_0x43e7('0x12c')])[0x0],_0x3836e7[_0x43e7('0x12d')]);}}}catch(_0x5564b4){logger[_0x43e7('0x12e')](_0x43e7('0x12f'),util[_0x43e7('0x130')](_0x5564b4,{'showHidden':![],'depth':null}));}};Preview[_0x43e7('0x34')][_0x43e7('0x1f')]=function(_0x308403){if(_0x308403){if(this['actions'][_0x308403[_0x43e7('0x131')]]){this[_0x43e7('0x12')][_0x308403[_0x43e7('0x131')]][_0x43e7('0x126')]=!![];}}};Preview['prototype'][_0x43e7('0x21')]=function(_0x48c784){if(_0x48c784){if(this[_0x43e7('0x12')][_0x48c784['transfererlinkedid']]){this[_0x43e7('0x12')][_0x48c784['transfererlinkedid']][_0x43e7('0x126')]=!![];}}};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 82ab220..7f7ce6c 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 _0xb7c6=['getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','membername','exten','holdtime','assigned','lastAssignedTo','COMPLETED','resolve','create','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','then','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0xb7c6,0xe2));var _0x6b7c=function(_0x4425e6,_0x5da50d){_0x4425e6=_0x4425e6-0x0;var _0x5d15d6=_0xb7c6[_0x4425e6];return _0x5d15d6;};'use strict';var util=require(_0x6b7c('0x0'));var BPromise=require(_0x6b7c('0x1'));var logger=require(_0x6b7c('0x2'))(_0x6b7c('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6b7c('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x6b7c('0x5'));function loggerCatch(_0x5f3f14){return function(_0x38f78b){logger[_0x6b7c('0x6')](_0x5f3f14,util[_0x6b7c('0x7')](_0x38f78b,{'showHidden':![],'depth':null}));};}function create(_0x3fbadb){return cmHopperHistory['createHistory'](_0x3fbadb)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1decee){return BPromise['resolve']()[_0x6b7c('0x8')](agentReportPreview['createHistory'](_0x1decee))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0xa36241){return cmHopper[_0x6b7c('0x9')](_0xa36241,!![])[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0xb')));}exports[_0x6b7c('0xc')]=function(_0x44a623){return cmHopperBlack[_0x6b7c('0xc')](_0x44a623)['catch'](loggerCatch(_0x6b7c('0xd')));};exports[_0x6b7c('0xe')]=function(_0x492078){return BPromise['resolve']()[_0x6b7c('0x8')](cmHopper[_0x6b7c('0xe')](_0x492078))['catch'](loggerCatch(_0x6b7c('0xf')));};exports['createHistory']=function(_0xf779d2,_0x3715b8){create(_0xf779d2)['catch'](loggerCatch(_0x3715b8));moveContact(_0xf779d2)[_0x6b7c('0xa')](loggerCatch(_0x3715b8));};exports['createAgentHistory']=function(_0x3919cf,_0xd73569){createAgent(_0x3919cf)[_0x6b7c('0xa')](loggerCatch(_0xd73569));};exports['createCustomerHistory']=function(_0x50baa1,_0x3177e1){create(_0x50baa1)[_0x6b7c('0xa')](loggerCatch(_0x3177e1));};exports[_0x6b7c('0x10')]=function(_0x52c609,_0x266538){moveContact(_0x52c609)['catch'](loggerCatch(_0x266538));};exports[_0x6b7c('0x11')]=function(_0x2fdd41,_0x32a375,_0x166b06){if(_0x32a375){_0x2fdd41[_0x6b7c('0x12')]=null;}if(_0x166b06){_0x2fdd41[_0x6b7c('0x13')]=![];}return cmHopper[_0x6b7c('0x11')](_0x2fdd41)[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0x14')));};exports['countReScheduled']=function(_0x71d2cf){return cmHopper[_0x6b7c('0x15')](_0x71d2cf)[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0x16')));};exports[_0x6b7c('0x17')]=function(_0x4e116d){return cmHopper[_0x6b7c('0x17')]({'UserId':null},_0x4e116d,0x1)[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0x18')));};exports[_0x6b7c('0x19')]=function(_0x49bec5){return cmHopper[_0x6b7c('0x17')]({'active':![]},_0x49bec5,0x1)['catch'](loggerCatch(_0x6b7c('0x1a')));};exports[_0x6b7c('0x1b')]=function(_0x290d75){var _0x248734={};_0x248734[_0x6b7c('0x1c')]=_0x290d75[_0x6b7c('0x1c')];_0x248734[_0x6b7c('0x1d')]=_0x290d75[_0x6b7c('0x1d')];_0x248734[_0x6b7c('0x1e')]=_0x290d75[_0x6b7c('0x1e')];_0x248734[_0x6b7c('0x1f')]=_0x290d75[_0x6b7c('0x1f')];_0x248734[_0x6b7c('0x20')]=_0x290d75[_0x6b7c('0x20')];_0x248734[_0x6b7c('0x21')]=_0x290d75[_0x6b7c('0x22')];_0x248734[_0x6b7c('0x23')]=_0x290d75[_0x6b7c('0x22')];_0x248734['queuecallercomplete']=0x1;_0x248734[_0x6b7c('0x24')]=_0x290d75[_0x6b7c('0x25')];_0x248734['connectedlinename']=_0x290d75[_0x6b7c('0x26')];_0x248734['context']='from-sip';_0x248734[_0x6b7c('0x27')]='xcally-motion-preview';_0x248734[_0x6b7c('0x28')]=0x0;_0x248734[_0x6b7c('0x29')]=0x1;_0x248734[_0x6b7c('0x2a')]=_0x290d75['membername'];_0x248734['queuecallerexitreason']=_0x6b7c('0x2b');return BPromise[_0x6b7c('0x2c')]()[_0x6b7c('0x8')](voiceQueueReport[_0x6b7c('0x2d')](_0x248734))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x1fba4e,_0x28f0dc){return BPromise[_0x6b7c('0x2c')]()[_0x6b7c('0x8')](cmHopper[_0x6b7c('0x2e')](_0x1fba4e,_0x28f0dc))[_0x6b7c('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5a1ca6){return cmHopper['rescheduleContact'](_0x5a1ca6,!![],!![])[_0x6b7c('0xa')](loggerCatch(_0x6b7c('0x2f')));}; \ No newline at end of file +var _0x6d04=['inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','membername','from-sip','exten','holdtime','assigned','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport'];(function(_0x32a2cf,_0x20b153){var _0x250e9d=function(_0x506bf2){while(--_0x506bf2){_0x32a2cf['push'](_0x32a2cf['shift']());}};_0x250e9d(++_0x20b153);}(_0x6d04,0xb7));var _0x46d0=function(_0x1874e5,_0xabe75a){_0x1874e5=_0x1874e5-0x0;var _0x5541f9=_0x6d04[_0x1874e5];return _0x5541f9;};'use strict';var util=require(_0x46d0('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x46d0('0x1'));var cmHopper=require(_0x46d0('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x46d0('0x3'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x46d0('0x4'));function loggerCatch(_0x1e3b09){return function(_0x43ac10){logger['error'](_0x1e3b09,util[_0x46d0('0x5')](_0x43ac10,{'showHidden':![],'depth':null}));};}function create(_0x403730){return cmHopperHistory[_0x46d0('0x6')](_0x403730)[_0x46d0('0x7')](loggerCatch(_0x46d0('0x8')));}function createAgent(_0x1e88a0){return BPromise[_0x46d0('0x9')]()[_0x46d0('0xa')](agentReportPreview[_0x46d0('0x6')](_0x1e88a0))[_0x46d0('0x7')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3dfcd1){return cmHopper[_0x46d0('0xb')](_0x3dfcd1,!![])[_0x46d0('0x7')](loggerCatch(_0x46d0('0xc')));}exports['checkIsBlackList']=function(_0x19b0fc){return cmHopperBlack['checkIsBlackList'](_0x19b0fc)[_0x46d0('0x7')](loggerCatch(_0x46d0('0xd')));};exports[_0x46d0('0xe')]=function(_0x34ddc1){return BPromise[_0x46d0('0x9')]()[_0x46d0('0xa')](cmHopper[_0x46d0('0xe')](_0x34ddc1))[_0x46d0('0x7')](loggerCatch(_0x46d0('0xf')));};exports[_0x46d0('0x6')]=function(_0x412bb7,_0x3bc7fa){create(_0x412bb7)['catch'](loggerCatch(_0x3bc7fa));moveContact(_0x412bb7)[_0x46d0('0x7')](loggerCatch(_0x3bc7fa));};exports['createAgentHistory']=function(_0x16f987,_0x38c6b4){createAgent(_0x16f987)[_0x46d0('0x7')](loggerCatch(_0x38c6b4));};exports[_0x46d0('0x10')]=function(_0xb5f7dc,_0x50d58a){create(_0xb5f7dc)['catch'](loggerCatch(_0x50d58a));};exports[_0x46d0('0x11')]=function(_0x4e04ad,_0x29f8f9){moveContact(_0x4e04ad)[_0x46d0('0x7')](loggerCatch(_0x29f8f9));};exports[_0x46d0('0x12')]=function(_0x1f9144,_0x7ed83a,_0x246bf9){if(_0x7ed83a){_0x1f9144[_0x46d0('0x13')]=null;}if(_0x246bf9){_0x1f9144[_0x46d0('0x14')]=![];}return cmHopper['rescheduleContact'](_0x1f9144)['catch'](loggerCatch(_0x46d0('0x15')));};exports['countReScheduled']=function(_0x474811){return cmHopper[_0x46d0('0x16')](_0x474811)[_0x46d0('0x7')](loggerCatch('[countReScheduled]\x20'));};exports[_0x46d0('0x17')]=function(_0x342592){return cmHopper['unlockContact']({'UserId':null},_0x342592,0x1)[_0x46d0('0x7')](loggerCatch(_0x46d0('0x18')));};exports[_0x46d0('0x19')]=function(_0x58572b){return cmHopper[_0x46d0('0x17')]({'active':![]},_0x58572b,0x1)[_0x46d0('0x7')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x5810f8){var _0x25eb40={};_0x25eb40[_0x46d0('0x1a')]=_0x5810f8[_0x46d0('0x1a')];_0x25eb40[_0x46d0('0x1b')]=_0x5810f8['uniqueid'];_0x25eb40[_0x46d0('0x1c')]=_0x5810f8[_0x46d0('0x1c')];_0x25eb40['calleridname']=_0x5810f8[_0x46d0('0x1d')];_0x25eb40[_0x46d0('0x1e')]=_0x5810f8[_0x46d0('0x1e')];_0x25eb40[_0x46d0('0x1f')]=_0x5810f8[_0x46d0('0x20')];_0x25eb40[_0x46d0('0x21')]=_0x5810f8['answertime'];_0x25eb40['queuecallercomplete']=0x1;_0x25eb40[_0x46d0('0x22')]=_0x5810f8[_0x46d0('0x23')];_0x25eb40['connectedlinename']=_0x5810f8[_0x46d0('0x24')];_0x25eb40['context']=_0x46d0('0x25');_0x25eb40[_0x46d0('0x26')]='xcally-motion-preview';_0x25eb40[_0x46d0('0x27')]=0x0;_0x25eb40[_0x46d0('0x28')]=0x1;_0x25eb40[_0x46d0('0x29')]=_0x5810f8[_0x46d0('0x24')];_0x25eb40['queuecallerexitreason']=_0x46d0('0x2a');return BPromise[_0x46d0('0x9')]()['then'](voiceQueueReport['create'](_0x25eb40))[_0x46d0('0x7')](loggerCatch(_0x46d0('0x2b')));};exports['getContactRecallMe']=function(_0x3d25f7,_0x4a2a0d){return BPromise[_0x46d0('0x9')]()[_0x46d0('0xa')](cmHopper[_0x46d0('0x2c')](_0x3d25f7,_0x4a2a0d))[_0x46d0('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x46d0('0x2d')]=function(_0x2da8e2){return cmHopper[_0x46d0('0x12')](_0x2da8e2,!![],!![])['catch'](loggerCatch(_0x46d0('0x2e')));}; \ 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 3849d3f..ef142cd 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 _0x72e0=['monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','getSeconds','logLookAgent','UserId','logCustomer','talktime','answertime','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','reachable','push','milliseconds','diff','createBody','CampaignId','filterKey','type','campaigntype','dialAnswer','membername','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ListId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','lodash','moment','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','info','inspect','loggerError','error','logger2','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x72e0,0x1af));var _0x072e=function(_0x4b925b,_0x578e4f){_0x4b925b=_0x4b925b-0x0;var _0x1d9b54=_0x72e0[_0x4b925b];return _0x1d9b54;};'use strict';var util=require(_0x072e('0x0'));var _=require(_0x072e('0x1'));var moment=require(_0x072e('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process['env'][_0x072e('0x3')]||_0x072e('0x4');var utils=require(_0x072e('0x5'));exports[_0x072e('0x6')]=function(_0x2abc24){return function(_0x2ec2e9){logger['error'](_0x2abc24,util['inspect'](_0x2ec2e9,{'showHidden':![],'depth':null}));};};exports[_0x072e('0x7')]=function(_0x40a755,_0x3f79f3){logger[_0x072e('0x8')](_0x40a755,util[_0x072e('0x9')](_0x3f79f3,{'showHidden':![],'depth':null}));};exports[_0x072e('0xa')]=function(_0x18f787,_0x21a0cc){logger[_0x072e('0xb')](_0x18f787,util[_0x072e('0x9')](_0x21a0cc,{'showHidden':![],'depth':null}));};exports[_0x072e('0xc')]=function(_0x4ead31){return function(_0x5e2699){logger[_0x072e('0x8')](_0x4ead31,util['inspect'](_0x5e2699,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x169391,_0x15acb5,_0x263241){return{'message':_0x169391,'unlock':_0x15acb5,'active':_0x263241};};exports[_0x072e('0xd')]=function(_0x266c57,_0x18b73e,_0x2ca277){if(!_['isUndefined'](_0x2ca277)&&_0x072e('0xe')===typeof _0x2ca277&&!_[_0x072e('0xf')](_0x2ca277)){if(!_[_0x072e('0x10')](_0x18b73e)&&_0x072e('0xe')===typeof _0x18b73e&&!_[_0x072e('0xf')](_0x18b73e)){return util[_0x072e('0x11')]('\x22%s\x22\x20<%s>',_0x18b73e,_0x2ca277);}return util[_0x072e('0x11')](_0x072e('0x12'),_0x2ca277,_0x2ca277);}if(!_[_0x072e('0x10')](_0x266c57)&&_0x072e('0xe')===typeof _0x266c57&&!_[_0x072e('0xf')](_0x266c57)){return _0x266c57;}return _0x072e('0x13');};exports[_0x072e('0x14')]=function(_0x21d298){if(_['isNil'](_0x21d298)){return![];}return _0x21d298;};exports[_0x072e('0x15')]=function(_0x133b69,_0x4c874b,_0x4707a8,_0x6c6d13,_0xbc8cd2,_0x1dde72){var _0x4a5126={'XMD-QUEUE':_0x4c874b['Queue']?_0x4c874b['Queue'][_0x072e('0x16')]:'','XMD-CALLERID':_0x6c6d13,'XMD-CALLERID-PREVIEW':_0x1dde72?util[_0x072e('0x11')](_0x072e('0x12'),_0x1dde72[_0x072e('0x17')],_0x1dde72[_0x072e('0x18')]):_0x6c6d13,'XMD-DIALID':_0xbc8cd2,'XMD-CONTACTID':_0x4c874b[_0x072e('0x19')],'XMD-CDRTYPE':_0x072e('0x1a'),'CALLERID(all)':_0x6c6d13,'XMD-VOICEQUEUEID':_0x4c874b[_0x072e('0x1b')],'XMD-DIALCHANNEL':_0x4707a8,'XMD-DIALTIMEOUT':_0x133b69[_0x072e('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x072e('0x11')](_0x072e('0x1d'),_0x133b69[_0x072e('0x1e')]?'g':'',_[_0x072e('0xf')](_0x133b69[_0x072e('0x1f')])?'':_0x072e('0x20')),'XMD-DIALURL':_0x133b69[_0x072e('0x21')]||'','XMD-AGI':_0x133b69[_0x072e('0x22')]?util[_0x072e('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x133b69[_0x072e('0x22')]):'NONE','XMD-AGIAFTER':_0x133b69[_0x072e('0x1e')]?util[_0x072e('0x11')](_0x072e('0x23'),ipAgi,_0x133b69[_0x072e('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1dde72?_0x1dde72[_0x072e('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x1dde72?_0x1dde72[_0x072e('0x25')]:'','XMD-DESTINATION':_0x072e('0x26'),'SIPADDHEADER':_0x072e('0x27')};if(!_[_0x072e('0xf')](_0x133b69[_0x072e('0x1f')])){_0x4a5126[util[_0x072e('0x11')]('%s',_0x072e('0x28'))]=_0x133b69[_0x072e('0x1f')];_0x4a5126[util[_0x072e('0x11')]('%s',_0x072e('0x29'))]=_0xbc8cd2;}if(_0x4c874b&&_0x4c874b[_0x072e('0x2a')]){for(var _0x40d7a7 in _0x4c874b['Contact']){if(_0x4c874b[_0x072e('0x2a')][_0x072e('0x2b')](_0x40d7a7)){if(!_[_0x072e('0x2c')](_0x4c874b[_0x072e('0x2a')][_0x40d7a7])&&_0x40d7a7!=='id'&&_0x40d7a7!=='tags'&&_0x40d7a7!==_0x072e('0x2d')&&_0x40d7a7!==_0x072e('0x2e')){_0x4a5126[util[_0x072e('0x11')]('%s%s',_0x072e('0x2f'),_[_0x072e('0x30')](_0x40d7a7))]=_0x4c874b[_0x072e('0x2a')][_0x40d7a7];}}}}return _0x4a5126;};exports[_0x072e('0x31')]=function(_0x4f1b96){var _0x1a7449={};for(var _0x5113a4 in _0x4f1b96){if(_0x4f1b96[_0x072e('0x2b')](_0x5113a4)){_0x1a7449[util['format']('%s',_[_0x072e('0x32')](_0x5113a4))]=_0x4f1b96[_0x5113a4];}}return{'variables':_0x1a7449};};exports[_0x072e('0x33')]=function(_0x4dab3b,_0x2a5521){if(!_[_0x072e('0x2c')](_0x4dab3b)){if(_0x4dab3b[_0x072e('0x2b')](_0x072e('0x34'))){if(_0x4dab3b['originated']>0x0){_0x4dab3b[_0x072e('0x34')]-=0x1;}else{logger[_0x072e('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2a5521);}}}else{logger[_0x072e('0xb')](_0x072e('0x35'),_0x2a5521);}};exports[_0x072e('0x36')]=function(_0x5e843d){var _0x1abacb=moment()['format'](_0x072e('0x37'));_0x5e843d['state']=0xd;_0x5e843d[_0x072e('0x38')]=_0x072e('0x39');_0x5e843d[_0x072e('0x3a')]=_0x1abacb;_0x5e843d[_0x072e('0x3b')]=_0x1abacb;_0x5e843d[_0x072e('0x3c')]=_0x1abacb;};exports[_0x072e('0x3d')]=function(_0x23f350,_0x5b2d16,_0x1c79f2){var _0x3cb5d0=moment()['format'](_0x072e('0x37'));_0x23f350[_0x072e('0x3e')]=_0x5b2d16;_0x23f350[_0x072e('0x38')]=_0x1c79f2;_0x23f350[_0x072e('0x3b')]=_0x3cb5d0;_0x23f350[_0x072e('0x3f')]=utils[_0x072e('0x40')](_0x23f350[_0x072e('0x3b')],_0x23f350[_0x072e('0x3a')]);};exports[_0x072e('0x41')]=function(_0x48652f,_0x288259,_0x1cff29){_0x48652f['membername']=_0x288259;_0x48652f[_0x072e('0x42')]=_0x1cff29;};exports[_0x072e('0x43')]=function(_0xda0eed,_0x1aa77c,_0x353189){var _0x322b2c=moment()[_0x072e('0x11')](_0x072e('0x37'));_0xda0eed[_0x072e('0x3e')]=_0x1aa77c;_0xda0eed['statedesc']=_0x353189;_0xda0eed[_0x072e('0x3b')]=_0xda0eed[_0x072e('0x3b')]?_0xda0eed[_0x072e('0x3b')]:_0x322b2c;_0xda0eed[_0x072e('0x3c')]=_0xda0eed[_0x072e('0x3c')]?_0xda0eed['endtime']:_0x322b2c;_0xda0eed[_0x072e('0x3f')]=utils[_0x072e('0x40')](_0xda0eed[_0x072e('0x3b')]||0x0,_0xda0eed['starttime']||0x0);_0xda0eed[_0x072e('0x44')]=_0xda0eed[_0x072e('0x45')]?utils[_0x072e('0x40')](_0xda0eed['endtime'],_0xda0eed[_0x072e('0x45')]):0x0;};exports['isFailure']=function(_0x4d8a88){return _0x4d8a88===_0x072e('0x46');};exports[_0x072e('0x47')]=function(_0x3c5327,_0x198ceb,_0x5fc3e5,_0x3e8f18,_0x46d4b4){var _0x3e9599=_0x3e8f18?'RECALL':_0x3c5327['calleridname'];_0x3e9599=_0x46d4b4?_0x072e('0x48'):_0x3e9599;return{'actionid':_0x3c5327[_0x072e('0x49')],'action':_0x072e('0x4a'),'channel':_0x3c5327[_0x072e('0x4b')],'callerid':util[_0x072e('0x11')](_0x072e('0x12'),_0x3e9599,_0x3c5327[_0x072e('0x18')]),'Exten':_0x072e('0x26'),'Context':_0x072e('0x4c'),'Priority':'1','variable':_0x5fc3e5,'timeout':(_0x198ceb[_0x072e('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3c5327[_0x072e('0x49')]};};exports[_0x072e('0x4e')]=function(_0x2692ac){return _0x2692ac[_0x072e('0x4f')]+_0x2692ac[_0x072e('0x50')]+_0x2692ac['countnoanswerretry']+_0x2692ac[_0x072e('0x51')]+_0x2692ac['countnosuchnumberretry'];};exports[_0x072e('0x52')]=function(_0x25bb94){var _0x8cb449=_[_0x072e('0x53')](_0x25bb94);_0x8cb449[_0x072e('0x3e')]=0xf;_0x8cb449[_0x072e('0x38')]=_0x072e('0x54');return _0x8cb449;};exports[_0x072e('0x55')]=function(_0xf1e4f1,_0x2fb06f,_0xa37e58){var _0x1cc61e={};_0x1cc61e[_0x2fb06f]=_0xf1e4f1[_0x2fb06f];_0x1cc61e[_0x072e('0x56')]=![];_0x1cc61e[_0x072e('0x57')]=moment()['add'](_0xa37e58,'minutes')[_0x072e('0x11')](_0x072e('0x37'));_0x1cc61e[_0x072e('0x19')]=_0xf1e4f1['ContactId'];_0x1cc61e['ListId']=_0xf1e4f1['ListId'];_0x1cc61e[_0x072e('0x1b')]=_0xf1e4f1[_0x072e('0x1b')]||undefined;return _0x1cc61e;};exports[_0x072e('0x58')]=function(_0x201d07,_0x47ee86){if(!_[_0x072e('0x2c')](_0x201d07)){if(_0x201d07[_0x072e('0x59')]>0x0){_0x201d07[_0x072e('0x59')]-=0x1;}else{logger[_0x072e('0xb')](_0x47ee86,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x072e('0xb')](_0x47ee86,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x072e('0x5a')]=function(_0x2c0744){if(_0x2c0744<=0x0){return!![];}return![];};function buildObj(_0x545819,_0x222cd2,_0x403943){_0x545819[_0x072e('0x5b')]=_0x222cd2;_0x545819[_0x072e('0x16')]=_0x545819[_0x072e('0x5c')];_0x545819[_0x072e('0x5d')]=_0x545819[_0x072e('0x4b')];_0x545819[_0x072e('0x5e')]=_0x072e('0x5f');if(_0x403943){_0x545819[_0x072e('0x60')]=_0x403943[_0x072e('0x60')];}return _0x545819;}exports[_0x072e('0x61')]=buildObj;exports[_0x072e('0x62')]=function(_0x24f7b4){var _0x594958={};_0x594958[_0x072e('0x5c')]=_0x24f7b4['queue'];_0x594958[_0x072e('0x5d')]=_0x24f7b4[_0x072e('0x4b')];_0x594958[_0x072e('0x49')]=_0x24f7b4['uniqueid'];return _0x594958;};exports[_0x072e('0x63')]=function(_0x4d80b3){var _0x5e7d69=[];for(var _0x2c7c74 in _0x4d80b3){if(_0x4d80b3[_0x072e('0x2b')](_0x2c7c74)){if(!_[_0x072e('0x2c')](_0x4d80b3[_0x2c7c74])&&_0x4d80b3[_0x2c7c74][_0x072e('0x3e')]==='not_inuse'&&_0x4d80b3[_0x2c7c74]['status']===_0x072e('0x64')){_0x5e7d69[_0x072e('0x65')](_0x4d80b3[_0x2c7c74]['id']);}}}return _0x5e7d69;};exports['getDiff']=function(_0x4dd326){var _0x5e425a=moment()[_0x072e('0x66')](0x0);var _0x2532f9=moment(_0x4dd326)[_0x072e('0x66')](0x0);return _0x5e425a[_0x072e('0x67')](_0x2532f9,'seconds');};exports[_0x072e('0x68')]=function(_0x5d098b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d098b['ContactId'],'ListId':_0x5d098b['ListId'],'VoiceQueueId':_0x5d098b['VoiceQueueId']||undefined,'CampaignId':_0x5d098b[_0x072e('0x69')]||undefined};};exports[_0x072e('0x6a')]=function(_0x1407bb){if(_0x1407bb===_0x072e('0x49')||_0x1407bb==='idContact'||_0x1407bb===_0x072e('0x5c')||_0x1407bb===_0x072e('0x6b')||_0x1407bb===_0x072e('0x6c')||_0x1407bb===_0x072e('0x6d')||_0x1407bb===_0x072e('0x6e')||_0x1407bb===_0x072e('0x4b')||_0x1407bb===_0x072e('0x17')||_0x1407bb===_0x072e('0x56')||_0x1407bb==='calleridnum'||_0x1407bb==='scheduledat'||_0x1407bb===_0x072e('0x4f')||_0x1407bb===_0x072e('0x50')||_0x1407bb===_0x072e('0x6f')||_0x1407bb===_0x072e('0x70')||_0x1407bb===_0x072e('0x71')||_0x1407bb===_0x072e('0x72')||_0x1407bb===_0x072e('0x73')||_0x1407bb===_0x072e('0x74')||_0x1407bb===_0x072e('0x19')||_0x1407bb===_0x072e('0x75')||_0x1407bb===_0x072e('0x42')||_0x1407bb==='VoiceQueueId'||_0x1407bb===_0x072e('0x76')||_0x1407bb===_0x072e('0x77')||_0x1407bb===_0x072e('0x78')||_0x1407bb===_0x072e('0x79')||_0x1407bb===_0x072e('0x7a')||_0x1407bb===_0x072e('0x7b')||_0x1407bb===_0x072e('0x7c')||_0x1407bb===_0x072e('0x7d')||_0x1407bb===_0x072e('0x7e')||_0x1407bb===_0x072e('0x7f')||_0x1407bb===_0x072e('0x80')||_0x1407bb===_0x072e('0x81')||_0x1407bb===_0x072e('0x82')||_0x1407bb===_0x072e('0x83')||_0x1407bb===_0x072e('0x84')||_0x1407bb===_0x072e('0x85')||_0x1407bb===_0x072e('0x86')||_0x1407bb==='rtpaudioqosjitter'||_0x1407bb==='rtpaudioqosjitterbridged'||_0x1407bb===_0x072e('0x87')||_0x1407bb===_0x072e('0x88')||_0x1407bb===_0x072e('0x89')||_0x1407bb===_0x072e('0x8a')||_0x1407bb===_0x072e('0x85')||_0x1407bb===_0x072e('0x86')||_0x1407bb===_0x072e('0x8b')||_0x1407bb===_0x072e('0x8c')||_0x1407bb===_0x072e('0x87')||_0x1407bb===_0x072e('0x88')||_0x1407bb===_0x072e('0x89')||_0x1407bb===_0x072e('0x8a')||_0x1407bb===_0x072e('0x8d')||_0x1407bb==='bridgepvtcallid'||_0x1407bb===_0x072e('0x3e')||_0x1407bb===_0x072e('0x38')){return![];}return!![];};exports[_0x072e('0x8e')]=function(_0x2119a0,_0x5233f3){var _0x262332,_0xcda63d,_0x19bf5c;if(_0x5233f3<=0x0){_0x5233f3=0x1;}_0x262332=new RegExp(_0x072e('0x8f')+_0x5233f3+'}$');_0xcda63d=Math[_0x072e('0x90')](0xa,_0x5233f3-0x1);_0x19bf5c=Math[_0x072e('0x90')](0xa,_0x5233f3)-0x1;return util[_0x072e('0x11')]('%s',_['replace'](_0x2119a0,_0x262332,_[_0x072e('0x91')](_0xcda63d,_0x19bf5c)));};exports[_0x072e('0x92')]=function(_0x49b175){var _0x51ccf6=_0x49b175[_0x072e('0x93')](/"(.*?)"/);return _0x51ccf6?_0x51ccf6[0x1]:_0x49b175;};exports[_0x072e('0x94')]=function(_0x14e749){var _0x29dcf3=_0x14e749['match'](/<(.*?)>/);return _0x29dcf3?_0x29dcf3[0x1]:_0x14e749;};function buildNoAnswerEventPayload(_0x34b282,_0xb7a05f){var _0x311e7d=buildObj(_0x34b282,_0x072e('0x95'));if(!_[_0x072e('0xf')](_0xb7a05f[_0x072e('0x96')])){Object[_0x072e('0x97')](_0xb7a05f['variables'])[_0x072e('0x98')](function(_0x2ba894){_0x311e7d[_0x2ba894[_0x072e('0x99')]()]=_0xb7a05f[_0x072e('0x96')][_0x2ba894];});}return _0x311e7d;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x3b26=['ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','lastevent','queue','interface','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','push','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','type','membername','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','forEach','toLowerCase','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','logger','info','inspect','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','endtime','logAgent','responsetime','ringtime','logLookAgent','logCustomer','statedesc','getSeconds','talktime','answertime','isFailure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','channelAgent','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3b26,0x15f));var _0x63b2=function(_0xe1d6e6,_0x7d0637){_0xe1d6e6=_0xe1d6e6-0x0;var _0x464dc=_0x3b26[_0xe1d6e6];return _0x464dc;};'use strict';var util=require('util');var _=require(_0x63b2('0x0'));var moment=require(_0x63b2('0x1'));var logger=require(_0x63b2('0x2'))(_0x63b2('0x3'));var ipAgi=process[_0x63b2('0x4')][_0x63b2('0x5')]||'127.0.0.1';var utils=require(_0x63b2('0x6'));exports[_0x63b2('0x7')]=function(_0x4eae7f){return function(_0x59849e){logger[_0x63b2('0x8')](_0x4eae7f,util['inspect'](_0x59849e,{'showHidden':![],'depth':null}));};};exports[_0x63b2('0x9')]=function(_0x4662de,_0x3d56da){logger[_0x63b2('0xa')](_0x4662de,util['inspect'](_0x3d56da,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x80dc51,_0xd96e9b){logger['error'](_0x80dc51,util[_0x63b2('0xb')](_0xd96e9b,{'showHidden':![],'depth':null}));};exports[_0x63b2('0xc')]=function(_0x3c4172){return function(_0x49362f){logger['info'](_0x3c4172,util[_0x63b2('0xb')](_0x49362f,{'showHidden':![],'depth':null}));};};exports[_0x63b2('0xd')]=function(_0x3e99f5,_0x4895c5,_0x169ab0){return{'message':_0x3e99f5,'unlock':_0x4895c5,'active':_0x169ab0};};exports['getCallerId']=function(_0x3584ab,_0x285ab8,_0x15e98e){if(!_[_0x63b2('0xe')](_0x15e98e)&&_0x63b2('0xf')===typeof _0x15e98e&&!_[_0x63b2('0x10')](_0x15e98e)){if(!_[_0x63b2('0xe')](_0x285ab8)&&_0x63b2('0xf')===typeof _0x285ab8&&!_[_0x63b2('0x10')](_0x285ab8)){return util[_0x63b2('0x11')](_0x63b2('0x12'),_0x285ab8,_0x15e98e);}return util[_0x63b2('0x11')](_0x63b2('0x12'),_0x15e98e,_0x15e98e);}if(!_['isUndefined'](_0x3584ab)&&_0x63b2('0xf')===typeof _0x3584ab&&!_[_0x63b2('0x10')](_0x3584ab)){return _0x3584ab;}return _0x63b2('0x13');};exports[_0x63b2('0x14')]=function(_0x345bdb){if(_[_0x63b2('0x15')](_0x345bdb)){return![];}return _0x345bdb;};exports[_0x63b2('0x16')]=function(_0x4faa0a,_0x289804,_0x71c49d,_0x46b897,_0x57506d,_0x1aea33){var _0x54f148={'XMD-QUEUE':_0x289804['Queue']?_0x289804[_0x63b2('0x17')][_0x63b2('0x18')]:'','XMD-CALLERID':_0x46b897,'XMD-CALLERID-PREVIEW':_0x1aea33?util['format'](_0x63b2('0x12'),_0x1aea33['calleridname'],_0x1aea33[_0x63b2('0x19')]):_0x46b897,'XMD-DIALID':_0x57506d,'XMD-CONTACTID':_0x289804[_0x63b2('0x1a')],'XMD-CDRTYPE':_0x63b2('0x1b'),'CALLERID(all)':_0x46b897,'XMD-VOICEQUEUEID':_0x289804[_0x63b2('0x1c')],'XMD-DIALCHANNEL':_0x71c49d,'XMD-DIALTIMEOUT':_0x4faa0a[_0x63b2('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x63b2('0x11')]('\x22rtTxX%s%s\x22',_0x4faa0a['dialQueueProject2']?'g':'',_['isEmpty'](_0x4faa0a[_0x63b2('0x1e')])?'':_0x63b2('0x1f')),'XMD-DIALURL':_0x4faa0a[_0x63b2('0x20')]||'','XMD-AGI':_0x4faa0a[_0x63b2('0x21')]?util[_0x63b2('0x11')](_0x63b2('0x22'),ipAgi,_0x4faa0a[_0x63b2('0x21')]):'NONE','XMD-AGIAFTER':_0x4faa0a[_0x63b2('0x23')]?util[_0x63b2('0x11')](_0x63b2('0x22'),ipAgi,_0x4faa0a[_0x63b2('0x23')]):_0x63b2('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x1aea33?_0x1aea33[_0x63b2('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x1aea33?_0x1aea33['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x63b2('0x26')};if(!_[_0x63b2('0x10')](_0x4faa0a['monitor_format'])){_0x54f148[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4faa0a['monitor_format'];_0x54f148[util[_0x63b2('0x11')]('%s',_0x63b2('0x27'))]=_0x57506d;}if(_0x289804&&_0x289804[_0x63b2('0x28')]){for(var _0x22e479 in _0x289804[_0x63b2('0x28')]){if(_0x289804[_0x63b2('0x28')][_0x63b2('0x29')](_0x22e479)){if(!_[_0x63b2('0x15')](_0x289804[_0x63b2('0x28')][_0x22e479])&&_0x22e479!=='id'&&_0x22e479!=='tags'&&_0x22e479!==_0x63b2('0x2a')&&_0x22e479!=='updatedAt'){_0x54f148[util[_0x63b2('0x11')](_0x63b2('0x2b'),_0x63b2('0x2c'),_['toUpper'](_0x22e479))]=_0x289804[_0x63b2('0x28')][_0x22e479];}}}}return _0x54f148;};exports[_0x63b2('0x2d')]=function(_0x4352aa){var _0x55848e={};for(var _0x224bb7 in _0x4352aa){if(_0x4352aa['hasOwnProperty'](_0x224bb7)){_0x55848e[util['format']('%s',_[_0x63b2('0x2e')](_0x224bb7))]=_0x4352aa[_0x224bb7];}}return{'variables':_0x55848e};};exports[_0x63b2('0x2f')]=function(_0xfb92ab,_0x36ebd4){if(!_['isNil'](_0xfb92ab)){if(_0xfb92ab['hasOwnProperty'](_0x63b2('0x30'))){if(_0xfb92ab[_0x63b2('0x30')]>0x0){_0xfb92ab[_0x63b2('0x30')]-=0x1;}else{logger[_0x63b2('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x36ebd4);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x36ebd4);}};exports['logBlacklist']=function(_0x4692d7){var _0x3ecefa=moment()[_0x63b2('0x11')](_0x63b2('0x31'));_0x4692d7[_0x63b2('0x32')]=0xd;_0x4692d7['statedesc']=_0x63b2('0x33');_0x4692d7[_0x63b2('0x34')]=_0x3ecefa;_0x4692d7['responsetime']=_0x3ecefa;_0x4692d7[_0x63b2('0x35')]=_0x3ecefa;};exports[_0x63b2('0x36')]=function(_0x154c88,_0x567afe,_0x45e0e5){var _0x22d293=moment()[_0x63b2('0x11')](_0x63b2('0x31'));_0x154c88['state']=_0x567afe;_0x154c88['statedesc']=_0x45e0e5;_0x154c88[_0x63b2('0x37')]=_0x22d293;_0x154c88[_0x63b2('0x38')]=utils['getSeconds'](_0x154c88[_0x63b2('0x37')],_0x154c88[_0x63b2('0x34')]);};exports[_0x63b2('0x39')]=function(_0x256eee,_0x5eb5dc,_0x4370ce){_0x256eee['membername']=_0x5eb5dc;_0x256eee['UserId']=_0x4370ce;};exports[_0x63b2('0x3a')]=function(_0x52c8f1,_0x4ed05,_0xe7e8a3){var _0x357489=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x52c8f1[_0x63b2('0x32')]=_0x4ed05;_0x52c8f1[_0x63b2('0x3b')]=_0xe7e8a3;_0x52c8f1[_0x63b2('0x37')]=_0x52c8f1[_0x63b2('0x37')]?_0x52c8f1[_0x63b2('0x37')]:_0x357489;_0x52c8f1[_0x63b2('0x35')]=_0x52c8f1['endtime']?_0x52c8f1[_0x63b2('0x35')]:_0x357489;_0x52c8f1[_0x63b2('0x38')]=utils[_0x63b2('0x3c')](_0x52c8f1[_0x63b2('0x37')]||0x0,_0x52c8f1[_0x63b2('0x34')]||0x0);_0x52c8f1[_0x63b2('0x3d')]=_0x52c8f1[_0x63b2('0x3e')]?utils[_0x63b2('0x3c')](_0x52c8f1['endtime'],_0x52c8f1[_0x63b2('0x3e')]):0x0;};exports[_0x63b2('0x3f')]=function(_0x3cb7c4){return _0x3cb7c4==='Failure';};exports[_0x63b2('0x40')]=function(_0x17084c,_0xc0568c,_0x273eee,_0x2d1b5b,_0x4d6252){var _0xa846ce=_0x2d1b5b?_0x63b2('0x41'):_0x17084c[_0x63b2('0x42')];_0xa846ce=_0x4d6252?_0x63b2('0x43'):_0xa846ce;return{'actionid':_0x17084c[_0x63b2('0x44')],'action':'originate','channel':_0x17084c[_0x63b2('0x45')],'callerid':util['format'](_0x63b2('0x12'),_0xa846ce,_0x17084c[_0x63b2('0x19')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x273eee,'timeout':(_0xc0568c[_0x63b2('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x17084c['uniqueid']};};exports[_0x63b2('0x47')]=function(_0x4a36fa){return _0x4a36fa[_0x63b2('0x48')]+_0x4a36fa[_0x63b2('0x49')]+_0x4a36fa[_0x63b2('0x4a')]+_0x4a36fa['countagentrejectretry']+_0x4a36fa[_0x63b2('0x4b')];};exports[_0x63b2('0x4c')]=function(_0xd4b16e){var _0x681127=_[_0x63b2('0x4d')](_0xd4b16e);_0x681127['state']=0xf;_0x681127['statedesc']=_0x63b2('0x4e');return _0x681127;};exports[_0x63b2('0x4f')]=function(_0x18ae59,_0x239274,_0x51595e){var _0x5b6ea1={};_0x5b6ea1[_0x239274]=_0x18ae59[_0x239274];_0x5b6ea1[_0x63b2('0x50')]=![];_0x5b6ea1[_0x63b2('0x51')]=moment()[_0x63b2('0x52')](_0x51595e,_0x63b2('0x53'))[_0x63b2('0x11')](_0x63b2('0x31'));_0x5b6ea1[_0x63b2('0x1a')]=_0x18ae59['ContactId'];_0x5b6ea1[_0x63b2('0x54')]=_0x18ae59[_0x63b2('0x54')];_0x5b6ea1[_0x63b2('0x1c')]=_0x18ae59[_0x63b2('0x1c')]||undefined;return _0x5b6ea1;};exports[_0x63b2('0x55')]=function(_0x522fa0,_0x631aad){if(!_[_0x63b2('0x15')](_0x522fa0)){if(_0x522fa0[_0x63b2('0x56')]>0x0){_0x522fa0['pTalking']-=0x1;}else{logger['error'](_0x631aad,_0x63b2('0x57'));}}else{logger[_0x63b2('0x8')](_0x631aad,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x56e0b2){if(_0x56e0b2<=0x0){return!![];}return![];};function buildObj(_0x29b4ee,_0x4232a3,_0x25fd34){_0x29b4ee[_0x63b2('0x58')]=_0x4232a3;_0x29b4ee[_0x63b2('0x18')]=_0x29b4ee[_0x63b2('0x59')];_0x29b4ee[_0x63b2('0x5a')]=_0x29b4ee[_0x63b2('0x45')];_0x29b4ee['motionChannel']='voice';if(_0x25fd34){_0x29b4ee['mandatoryDisposition']=_0x25fd34[_0x63b2('0x5b')];}return _0x29b4ee;}exports[_0x63b2('0x5c')]=buildObj;exports['buildAcw']=function(_0x3333eb){var _0x1273f5={};_0x1273f5[_0x63b2('0x59')]=_0x3333eb[_0x63b2('0x59')];_0x1273f5[_0x63b2('0x5a')]=_0x3333eb[_0x63b2('0x45')];_0x1273f5[_0x63b2('0x44')]=_0x3333eb[_0x63b2('0x44')];return _0x1273f5;};exports[_0x63b2('0x5d')]=function(_0x4e76c9){var _0x179184=[];for(var _0xadcdd in _0x4e76c9){if(_0x4e76c9[_0x63b2('0x29')](_0xadcdd)){if(!_[_0x63b2('0x15')](_0x4e76c9[_0xadcdd])&&_0x4e76c9[_0xadcdd][_0x63b2('0x32')]===_0x63b2('0x5e')&&_0x4e76c9[_0xadcdd][_0x63b2('0x5f')]==='reachable'){_0x179184[_0x63b2('0x60')](_0x4e76c9[_0xadcdd]['id']);}}}return _0x179184;};exports['getDiff']=function(_0x1d4069){var _0x2701d8=moment()[_0x63b2('0x61')](0x0);var _0x1d28e1=moment(_0x1d4069)[_0x63b2('0x61')](0x0);return _0x2701d8['diff'](_0x1d28e1,_0x63b2('0x62'));};exports[_0x63b2('0x63')]=function(_0x1a5215){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a5215['ContactId'],'ListId':_0x1a5215[_0x63b2('0x54')],'VoiceQueueId':_0x1a5215[_0x63b2('0x1c')]||undefined,'CampaignId':_0x1a5215[_0x63b2('0x64')]||undefined};};exports[_0x63b2('0x65')]=function(_0xd87185){if(_0xd87185===_0x63b2('0x44')||_0xd87185===_0x63b2('0x66')||_0xd87185===_0x63b2('0x59')||_0xd87185===_0x63b2('0x67')||_0xd87185==='campaigntype'||_0xd87185==='dialAnswer'||_0xd87185===_0x63b2('0x68')||_0xd87185===_0x63b2('0x45')||_0xd87185===_0x63b2('0x42')||_0xd87185===_0x63b2('0x50')||_0xd87185===_0x63b2('0x19')||_0xd87185===_0x63b2('0x51')||_0xd87185===_0x63b2('0x48')||_0xd87185===_0x63b2('0x49')||_0xd87185===_0x63b2('0x4a')||_0xd87185==='countglobal'||_0xd87185===_0x63b2('0x69')||_0xd87185==='callbackuniqueid'||_0xd87185===_0x63b2('0x6a')||_0xd87185===_0x63b2('0x6b')||_0xd87185===_0x63b2('0x1a')||_0xd87185===_0x63b2('0x54')||_0xd87185===_0x63b2('0x6c')||_0xd87185===_0x63b2('0x1c')||_0xd87185===_0x63b2('0x6d')||_0xd87185===_0x63b2('0x6e')||_0xd87185===_0x63b2('0x6f')||_0xd87185===_0x63b2('0x70')||_0xd87185===_0x63b2('0x71')||_0xd87185==='xmd-dialurl'||_0xd87185===_0x63b2('0x72')||_0xd87185===_0x63b2('0x73')||_0xd87185===_0x63b2('0x74')||_0xd87185===_0x63b2('0x75')||_0xd87185===_0x63b2('0x76')||_0xd87185===_0x63b2('0x77')||_0xd87185===_0x63b2('0x78')||_0xd87185===_0x63b2('0x79')||_0xd87185===_0x63b2('0x7a')||_0xd87185===_0x63b2('0x7b')||_0xd87185===_0x63b2('0x7c')||_0xd87185===_0x63b2('0x7d')||_0xd87185===_0x63b2('0x7e')||_0xd87185===_0x63b2('0x7f')||_0xd87185===_0x63b2('0x80')||_0xd87185===_0x63b2('0x81')||_0xd87185===_0x63b2('0x82')||_0xd87185===_0x63b2('0x7b')||_0xd87185==='rtpaudioqosbridged'||_0xd87185===_0x63b2('0x7d')||_0xd87185==='rtpaudioqosjitterbridged'||_0xd87185===_0x63b2('0x7f')||_0xd87185==='rtpaudioqoslossbridged'||_0xd87185===_0x63b2('0x81')||_0xd87185===_0x63b2('0x82')||_0xd87185===_0x63b2('0x83')||_0xd87185===_0x63b2('0x84')||_0xd87185===_0x63b2('0x32')||_0xd87185===_0x63b2('0x3b')){return![];}return!![];};exports[_0x63b2('0x85')]=function(_0x11e844,_0x2a97c2){var _0x3ef73c,_0x5b40a,_0x546bff;if(_0x2a97c2<=0x0){_0x2a97c2=0x1;}_0x3ef73c=new RegExp('\x5cw{0,'+_0x2a97c2+'}$');_0x5b40a=Math[_0x63b2('0x86')](0xa,_0x2a97c2-0x1);_0x546bff=Math[_0x63b2('0x86')](0xa,_0x2a97c2)-0x1;return util[_0x63b2('0x11')]('%s',_[_0x63b2('0x87')](_0x11e844,_0x3ef73c,_[_0x63b2('0x88')](_0x5b40a,_0x546bff)));};exports[_0x63b2('0x89')]=function(_0x172177){var _0xfcfa61=_0x172177['match'](/"(.*?)"/);return _0xfcfa61?_0xfcfa61[0x1]:_0x172177;};exports[_0x63b2('0x8a')]=function(_0x5d61ac){var _0x9c2d58=_0x5d61ac[_0x63b2('0x8b')](/<(.*?)>/);return _0x9c2d58?_0x9c2d58[0x1]:_0x5d61ac;};function buildNoAnswerEventPayload(_0x21fd34,_0x18fd81){var _0x18c3aa=buildObj(_0x21fd34,_0x63b2('0x8c'));if(!_[_0x63b2('0x10')](_0x18fd81[_0x63b2('0x8d')])){Object[_0x63b2('0x8e')](_0x18fd81[_0x63b2('0x8d')])[_0x63b2('0x8f')](function(_0x536cdf){_0x18c3aa[_0x536cdf[_0x63b2('0x90')]()]=_0x18fd81[_0x63b2('0x8d')][_0x536cdf];});}return _0x18c3aa;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4497093..6c6853d 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 _0xcc70=['number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x51361c,_0x3ac7f6){var _0xafa94b=function(_0x2886ba){while(--_0x2886ba){_0x51361c['push'](_0x51361c['shift']());}};_0xafa94b(++_0x3ac7f6);}(_0xcc70,0x17f));var _0x0cc7=function(_0xb03f9,_0x588391){_0xb03f9=_0xb03f9-0x0;var _0x3ec30a=_0xcc70[_0xb03f9];return _0x3ec30a;};'use strict';exports[_0x0cc7('0x0')]={'queue':{'type':_0x0cc7('0x1'),'required':!![]},'interface':{'type':_0x0cc7('0x1'),'required':!![]},'membername':{'type':_0x0cc7('0x1'),'required':!![]},'penalty':{'type':_0x0cc7('0x2'),'required':![]},'paused':{'type':_0x0cc7('0x3'),'required':![]}};exports[_0x0cc7('0x4')]={'queue':{'type':_0x0cc7('0x1'),'required':!![]},'interface':{'type':_0x0cc7('0x1'),'required':!![]}};exports[_0x0cc7('0x5')]={'interface':{'type':_0x0cc7('0x1'),'required':!![]},'paused':{'type':_0x0cc7('0x3')},'reason':{'type':'string','required':![]}};exports[_0x0cc7('0x6')]={'module':{'type':_0x0cc7('0x1'),'required':![]}};exports[_0x0cc7('0x7')]={'uniqueid':{'type':_0x0cc7('0x1'),'required':!![]}};exports[_0x0cc7('0x8')]={'uniqueid':{'type':_0x0cc7('0x1'),'required':!![]},'filename':{'type':_0x0cc7('0x1')},'format':{'type':_0x0cc7('0x1')},'mixmonitorid':{'type':_0x0cc7('0x1')}};exports[_0x0cc7('0x9')]={'uniqueid':{'type':_0x0cc7('0x1'),'required':!![]}};exports[_0x0cc7('0xa')]={'uniqueid':{'type':_0x0cc7('0x1'),'required':!![]},'exten':{'type':_0x0cc7('0x1'),'required':!![]},'context':{'type':_0x0cc7('0x1')}}; \ No newline at end of file +var _0xedbe=['voicequeuechannelredirect','queueadd','number','boolean','queueremove','string','queuepause','reload','voicequeuechannel'];(function(_0x27289d,_0xe74797){var _0x2bda51=function(_0x337103){while(--_0x337103){_0x27289d['push'](_0x27289d['shift']());}};_0x2bda51(++_0xe74797);}(_0xedbe,0x6d));var _0xeedb=function(_0x46cc55,_0x3df722){_0x46cc55=_0x46cc55-0x0;var _0x2c5b3a=_0xedbe[_0x46cc55];return _0x2c5b3a;};'use strict';exports[_0xeedb('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xeedb('0x1'),'required':![]},'paused':{'type':_0xeedb('0x2'),'required':![]}};exports[_0xeedb('0x3')]={'queue':{'type':_0xeedb('0x4'),'required':!![]},'interface':{'type':_0xeedb('0x4'),'required':!![]}};exports[_0xeedb('0x5')]={'interface':{'type':_0xeedb('0x4'),'required':!![]},'paused':{'type':_0xeedb('0x2')},'reason':{'type':_0xeedb('0x4'),'required':![]}};exports[_0xeedb('0x6')]={'module':{'type':'string','required':![]}};exports[_0xeedb('0x7')]={'uniqueid':{'type':_0xeedb('0x4'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xeedb('0x4'),'required':!![]},'filename':{'type':_0xeedb('0x4')},'format':{'type':_0xeedb('0x4')},'mixmonitorid':{'type':_0xeedb('0x4')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xeedb('0x8')]={'uniqueid':{'type':_0xeedb('0x4'),'required':!![]},'exten':{'type':_0xeedb('0x4'),'required':!![]},'context':{'type':_0xeedb('0x4')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 8e88829..e94618d 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 _0x757a=['queuecallerabandonAt','queuecallerexitAt','total','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','moment','util','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','isNil','interface','name','hasOwnProperty','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','seconds','queuecallercompleteAt'];(function(_0xd19d9b,_0xaef32f){var _0xc26cb3=function(_0x16f1cc){while(--_0x16f1cc){_0xd19d9b['push'](_0xd19d9b['shift']());}};_0xc26cb3(++_0xaef32f);}(_0x757a,0xde));var _0xa757=function(_0x3fa3a6,_0x1aad10){_0x3fa3a6=_0x3fa3a6-0x0;var _0x5aa8f8=_0x757a[_0x3fa3a6];return _0x5aa8f8;};'use strict';var _=require('lodash');var moment=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xa757('0x2'));var Trigger=require(_0xa757('0x3'));var Template=require(_0xa757('0x4'));var Campaign=require(_0xa757('0x5'));var VoiceExtension=require(_0xa757('0x6'));var ZendeskAccount=require(_0xa757('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xa757('0x8'));var SugarcrmAccount=require(_0xa757('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xa757('0xa'));var VtigerAccount=require(_0xa757('0xb'));var ServicenowAccount=require(_0xa757('0xc'));var Dynamics365Account=require(_0xa757('0xd'));var FreshsalesAccount=require(_0xa757('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xa757('0xf')]={};this[_0xa757('0x10')]={};this[_0xa757('0x11')]={};this[_0xa757('0x12')]={};this[_0xa757('0x13')]={};this[_0xa757('0x14')]={};this[_0xa757('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0xa757('0x16')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa757('0x17')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa757('0x18')]={};this[_0xa757('0x19')]={};this[_0xa757('0x1a')]={};this[_0xa757('0x1b')]={};this[_0xa757('0x1c')]={};this[_0xa757('0x1d')]={};this[_0xa757('0x1e')]={};}function freeIsNotKey(_0x2f7947,_0x185011,_0x3df1f9){var _0x50aac1=_[_0xa757('0x1f')](_0x2f7947,function(_0x44eab8){return _0x44eab8[_0x3df1f9];});for(var _0xde8248 in _0x185011){if(_0x185011['hasOwnProperty'](_0xde8248)){if(!_0x50aac1[_0xde8248]){delete _0x185011[_0xde8248];}}}}function freeIsNotKeySip(_0x54b305,_0x151c04){var _0x468d45=_[_0xa757('0x1f')](_0x54b305,function(_0x340599){return util[_0xa757('0x20')](_0xa757('0x21'),_0x340599['name']);});for(var _0x58954 in _0x151c04){if(_0x151c04['hasOwnProperty'](_0x58954)){if(!_0x468d45[_0x58954]){delete _0x151c04[_0x58954];}}}}function freeIsNotKeyAgent(_0x32c2a1,_0x167640){var _0x14014c=_[_0xa757('0x1f')](_0x32c2a1,function(_0x4d598c){var _0x5638c7=_[_0xa757('0x22')](_0x4d598c[_0xa757('0x23')])?util[_0xa757('0x20')](_0xa757('0x21'),_0x4d598c[_0xa757('0x24')]):_0x4d598c[_0xa757('0x23')];return _0x5638c7;});for(var _0x2ca10d in _0x167640){if(_0x167640[_0xa757('0x25')](_0x2ca10d)){if(!_0x14014c[_0x2ca10d]){delete _0x167640[_0x2ca10d];}}}}function clearVoiceCallReports(_0x2bf276){_0x2bf276['total']=0x0;_0x2bf276[_0xa757('0x26')]=0x0;_0x2bf276['sumHoldTime']=0x0;_0x2bf276[_0xa757('0x27')]=0x0;_0x2bf276['sumBillable']=0x0;}function clearCampaigns(_0x40551d){if(!_[_0xa757('0x28')](_0x40551d)){for(var _0x37c7e6 in _0x40551d){if(_0x40551d['hasOwnProperty'](_0x37c7e6)){_0x40551d[_0x37c7e6][_0xa757('0x29')]=0x0;_0x40551d[_0x37c7e6][_0xa757('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x471e84){if(!_[_0xa757('0x28')](_0x471e84)){for(var _0x5b4779 in _0x471e84){if(_0x471e84[_0xa757('0x25')](_0x5b4779)){_0x471e84[_0x5b4779]['total']=0x0;_0x471e84[_0x5b4779]['answered']=0x0;_0x471e84[_0x5b4779]['unmanaged']=0x0;_0x471e84[_0x5b4779]['abandoned']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2b')]=0x0;_0x471e84[_0x5b4779]['sumDuration']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2c')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779]['outboundNoAnswerCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2e')]=0x0;_0x471e84[_0x5b4779]['outboundCongestionCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x2f')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x30')]=0x0;_0x471e84[_0x5b4779]['outboundDropCallsDayTimeout']=0x0;_0x471e84[_0x5b4779][_0xa757('0x31')]=0x0;_0x471e84[_0x5b4779]['outboundBlacklistCallsDay']=0x0;_0x471e84[_0x5b4779][_0xa757('0x32')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x33')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x34')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x2d')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x35')]=0x0;_0x471e84[_0x5b4779][_0xa757('0x36')]=!![];}}}}Realtime[_0xa757('0x37')][_0xa757('0x38')]=function(_0x112282,_0x384424){for(var _0x1f5d5a in _0x384424){if(_0x112282[_0xa757('0x25')](_0x1f5d5a)){_0x112282[_0x1f5d5a]=_0x384424[_0x1f5d5a];}}};Realtime[_0xa757('0x37')][_0xa757('0x39')]=function(){var _0x27be88=this;return function(_0xc1cc20){if(_0xc1cc20){freeIsNotKeyAgent(_0xc1cc20,_0x27be88[_0xa757('0xf')]);for(var _0x1ad384=0x0,_0x1eacde={};_0x1ad384<_0xc1cc20[_0xa757('0x3a')];_0x1ad384+=0x1){_0x1eacde=_0xc1cc20[_0x1ad384];var _0x3de18f=_[_0xa757('0x22')](_0x1eacde[_0xa757('0x23')])?util[_0xa757('0x20')]('SIP/%s',_0x1eacde[_0xa757('0x24')]):_0x1eacde[_0xa757('0x23')];if(_[_0xa757('0x3b')](_0x27be88[_0xa757('0xf')][_0x3de18f])){_0x27be88[_0xa757('0xf')][_0x3de18f]=new Agent(_0x1eacde);}else{_0x27be88['mergeFromDatabase'](_0x27be88[_0xa757('0xf')][_0x3de18f],_0x1eacde);}}}return _0x27be88[_0xa757('0xf')];};};Realtime[_0xa757('0x37')][_0xa757('0x3c')]=function(){var _0xd54446=this;return function(_0xc97cb8){if(_0xc97cb8){freeIsNotKeySip(_0xc97cb8,_0xd54446['telephones']);for(var _0x1346c2=0x0,_0x444639={};_0x1346c2<_0xc97cb8[_0xa757('0x3a')];_0x1346c2+=0x1){_0x444639=_0xc97cb8[_0x1346c2];if(_[_0xa757('0x3b')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639[_0xa757('0x24')])])){_0xd54446[_0xa757('0x10')][util['format'](_0xa757('0x21'),_0x444639[_0xa757('0x24')])]=new Telephone(_0x444639);}else{_0xd54446[_0xa757('0x38')](_0xd54446[_0xa757('0x10')][util[_0xa757('0x20')](_0xa757('0x21'),_0x444639['name'])],_0x444639);}}}return _0xd54446[_0xa757('0x10')];};};Realtime[_0xa757('0x37')]['initTrunks']=function(){var _0x5eae0b=this;return function(_0x9607af){if(_0x9607af){freeIsNotKeySip(_0x9607af,_0x5eae0b[_0xa757('0x11')]);for(var _0x5b11fe=0x0,_0x51c3d1={};_0x5b11fe<_0x9607af[_0xa757('0x3a')];_0x5b11fe+=0x1){_0x51c3d1=_0x9607af[_0x5b11fe];if(_[_0xa757('0x3b')](_0x5eae0b[_0xa757('0x11')][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])])){_0x5eae0b[_0xa757('0x11')][util[_0xa757('0x20')](_0xa757('0x21'),_0x51c3d1['name'])]=new Trunk(_0x51c3d1);}else{_0x5eae0b[_0xa757('0x38')](_0x5eae0b['trunks'][util['format'](_0xa757('0x21'),_0x51c3d1[_0xa757('0x24')])],_0x51c3d1);}}}return _0x5eae0b[_0xa757('0x11')];};};Realtime[_0xa757('0x37')][_0xa757('0x3d')]=function(){var _0x5d347c=this;return function(_0x5d25bb){if(_0x5d25bb){freeIsNotKey(_0x5d25bb,_0x5d347c[_0xa757('0x13')],'id');for(var _0x129d77=0x0,_0x2b171c={};_0x129d77<_0x5d25bb[_0xa757('0x3a')];_0x129d77+=0x1){_0x2b171c=_0x5d25bb[_0x129d77];if(_[_0xa757('0x3b')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']])){_0x5d347c['triggers'][_0x2b171c['id']]=new Trigger(_0x2b171c);}else{_0x5d347c[_0xa757('0x38')](_0x5d347c[_0xa757('0x13')][_0x2b171c['id']],_0x2b171c);}}}return _0x5d347c['triggers'];};};Realtime[_0xa757('0x37')]['initTemplates']=function(){var _0x2d111e=this;return function(_0x4518dc){if(_0x4518dc){freeIsNotKey(_0x4518dc,_0x2d111e['templates'],'id');for(var _0x267d68=0x0,_0x23efad={};_0x267d68<_0x4518dc['length'];_0x267d68+=0x1){_0x23efad=_0x4518dc[_0x267d68];if(_[_0xa757('0x3b')](_0x2d111e[_0xa757('0x15')][_0x23efad['id']])){_0x2d111e[_0xa757('0x15')][_0x23efad['id']]=new Template(_0x23efad);}else{_0x2d111e[_0xa757('0x38')](_0x2d111e['templates'][_0x23efad['id']],_0x23efad);}}}return _0x2d111e[_0xa757('0x15')];};};Realtime[_0xa757('0x37')][_0xa757('0x3e')]=function(){var _0xec4610=this;return function(_0x4d7493){if(_0x4d7493){freeIsNotKey(_0x4d7493,_0xec4610[_0xa757('0x3f')],'id');for(var _0x5b6017=0x0,_0x50c131={};_0x5b6017<_0x4d7493[_0xa757('0x3a')];_0x5b6017+=0x1){_0x50c131=_0x4d7493[_0x5b6017];if(_[_0xa757('0x3b')](_0xec4610[_0xa757('0x3f')][_0x50c131['id']])){_0xec4610['zendeskAccounts'][_0x50c131['id']]=new ZendeskAccount(_0x50c131);}else{_0xec4610[_0xa757('0x38')](_0xec4610['zendeskAccounts'][_0x50c131['id']],_0x50c131);}}}return _0xec4610[_0xa757('0x3f')];};};Realtime[_0xa757('0x37')][_0xa757('0x40')]=function(){var _0xbef575=this;return function(_0x18b0ca){if(_0x18b0ca){freeIsNotKey(_0x18b0ca,_0xbef575[_0xa757('0x17')],'id');for(var _0x57bf73=0x0,_0x505cd={};_0x57bf73<_0x18b0ca['length'];_0x57bf73+=0x1){_0x505cd=_0x18b0ca[_0x57bf73];if(_[_0xa757('0x3b')](_0xbef575[_0xa757('0x17')][_0x505cd['id']])){_0xbef575[_0xa757('0x17')][_0x505cd['id']]=new SalesforceAccount(_0x505cd);}else{_0xbef575[_0xa757('0x38')](_0xbef575[_0xa757('0x17')][_0x505cd['id']],_0x505cd);}}}return _0xbef575[_0xa757('0x17')];};};Realtime[_0xa757('0x37')][_0xa757('0x41')]=function(){var _0x405397=this;return function(_0x1d05d7){if(_0x1d05d7){freeIsNotKey(_0x1d05d7,_0x405397[_0xa757('0x42')],'id');for(var _0x19ceef=0x0,_0x2367c7={};_0x19ceef<_0x1d05d7[_0xa757('0x3a')];_0x19ceef+=0x1){_0x2367c7=_0x1d05d7[_0x19ceef];if(_[_0xa757('0x3b')](_0x405397[_0xa757('0x42')][_0x2367c7['id']])){_0x405397['freshdeskAccounts'][_0x2367c7['id']]=new FreshdeskAccount(_0x2367c7);}else{_0x405397[_0xa757('0x38')](_0x405397['freshdeskAccounts'][_0x2367c7['id']],_0x2367c7);}}}return _0x405397[_0xa757('0x42')];};};Realtime[_0xa757('0x37')][_0xa757('0x43')]=function(){var _0x24c0ad=this;return function(_0x4cb461){if(_0x4cb461){freeIsNotKey(_0x4cb461,_0x24c0ad[_0xa757('0x18')],'id');for(var _0x1ee01e=0x0,_0x8614f9={};_0x1ee01e<_0x4cb461[_0xa757('0x3a')];_0x1ee01e+=0x1){_0x8614f9=_0x4cb461[_0x1ee01e];if(_['isUndefined'](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']])){_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']]=new ZohoAccount(_0x8614f9);}else{_0x24c0ad[_0xa757('0x38')](_0x24c0ad[_0xa757('0x18')][_0x8614f9['id']],_0x8614f9);}}}return _0x24c0ad[_0xa757('0x18')];};};Realtime[_0xa757('0x37')]['initDeskAccounts']=function(){var _0x485100=this;return function(_0x5d21c1){if(_0x5d21c1){freeIsNotKey(_0x5d21c1,_0x485100['deskAccounts'],'id');for(var _0x1d8742=0x0,_0x9b3779={};_0x1d8742<_0x5d21c1[_0xa757('0x3a')];_0x1d8742+=0x1){_0x9b3779=_0x5d21c1[_0x1d8742];if(_[_0xa757('0x3b')](_0x485100[_0xa757('0x19')][_0x9b3779['id']])){_0x485100[_0xa757('0x19')][_0x9b3779['id']]=new DeskAccount(_0x9b3779);}else{_0x485100['mergeFromDatabase'](_0x485100[_0xa757('0x19')][_0x9b3779['id']],_0x9b3779);}}}return _0x485100[_0xa757('0x19')];};};Realtime[_0xa757('0x37')][_0xa757('0x44')]=function(){var _0x48b578=this;return function(_0x26c74e){if(_0x26c74e){freeIsNotKey(_0x26c74e,_0x48b578[_0xa757('0x45')],'id');for(var _0x4af840=0x0,_0x39699d={};_0x4af840<_0x26c74e['length'];_0x4af840+=0x1){_0x39699d=_0x26c74e[_0x4af840];if(_[_0xa757('0x3b')](_0x48b578['sugarcrmAccounts'][_0x39699d['id']])){_0x48b578[_0xa757('0x45')][_0x39699d['id']]=new SugarcrmAccount(_0x39699d);}else{_0x48b578['mergeFromDatabase'](_0x48b578['sugarcrmAccounts'][_0x39699d['id']],_0x39699d);}}}return _0x48b578[_0xa757('0x45')];};};Realtime[_0xa757('0x37')][_0xa757('0x46')]=function(){var _0x1b5db5=this;return function(_0x14e226){if(_0x14e226){freeIsNotKey(_0x14e226,_0x1b5db5[_0xa757('0x1a')],'id');for(var _0x4c19a6=0x0,_0x4f0d7b={};_0x4c19a6<_0x14e226[_0xa757('0x3a')];_0x4c19a6+=0x1){_0x4f0d7b=_0x14e226[_0x4c19a6];if(_[_0xa757('0x3b')](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']])){_0x1b5db5['vtigerAccounts'][_0x4f0d7b['id']]=new VtigerAccount(_0x4f0d7b);}else{_0x1b5db5['mergeFromDatabase'](_0x1b5db5[_0xa757('0x1a')][_0x4f0d7b['id']],_0x4f0d7b);}}}return _0x1b5db5[_0xa757('0x1a')];};};Realtime[_0xa757('0x37')][_0xa757('0x47')]=function(){var _0x12b802=this;return function(_0x3e6d40){if(_0x3e6d40){freeIsNotKey(_0x3e6d40,_0x12b802['servicenowAccounts'],'id');for(var _0x466728=0x0,_0x45f2a4={};_0x466728<_0x3e6d40[_0xa757('0x3a')];_0x466728+=0x1){_0x45f2a4=_0x3e6d40[_0x466728];if(_[_0xa757('0x3b')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']])){_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']]=new ServicenowAccount(_0x45f2a4);}else{_0x12b802[_0xa757('0x38')](_0x12b802[_0xa757('0x1b')][_0x45f2a4['id']],_0x45f2a4);}}}return _0x12b802[_0xa757('0x1b')];};};Realtime[_0xa757('0x37')]['initDynamics365Accounts']=function(){var _0x9e96e6=this;return function(_0x5c803a){if(_0x5c803a){freeIsNotKey(_0x5c803a,_0x9e96e6['dynamics365Accounts'],'id');for(var _0x40ce42=0x0,_0x3da8c1={};_0x40ce42<_0x5c803a[_0xa757('0x3a')];_0x40ce42+=0x1){_0x3da8c1=_0x5c803a[_0x40ce42];if(_[_0xa757('0x3b')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']])){_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']]=new Dynamics365Account(_0x3da8c1);}else{_0x9e96e6[_0xa757('0x38')](_0x9e96e6[_0xa757('0x1c')][_0x3da8c1['id']],_0x3da8c1);}}}return _0x9e96e6[_0xa757('0x1c')];};};Realtime[_0xa757('0x37')][_0xa757('0x48')]=function(){var _0x4fc507=this;return function(_0x3f8c5c){if(_0x3f8c5c){freeIsNotKey(_0x3f8c5c,_0x4fc507[_0xa757('0x1d')],'id');for(var _0x5f0b71=0x0,_0x11ebb3={};_0x5f0b71<_0x3f8c5c[_0xa757('0x3a')];_0x5f0b71+=0x1){_0x11ebb3=_0x3f8c5c[_0x5f0b71];if(_[_0xa757('0x3b')](_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']])){_0x4fc507[_0xa757('0x1d')][_0x11ebb3['id']]=new FreshsalesAccount(_0x11ebb3);}else{_0x4fc507[_0xa757('0x38')](_0x4fc507['freshsalesAccounts'][_0x11ebb3['id']],_0x11ebb3);}}}return _0x4fc507[_0xa757('0x1d')];};};Realtime['prototype'][_0xa757('0x49')]=function(){var _0x3250d0=this;return function(_0x2d9d97){for(var _0x3c87c0=0x0;_0x3c87c0<_0x2d9d97[_0xa757('0x3a')];_0x3c87c0+=0x1){_['merge'](_0x3250d0['voiceQueues'][_0x2d9d97[_0x3c87c0][_0xa757('0x24')]],_0x2d9d97[_0x3c87c0]);}return _0x3250d0[_0xa757('0x12')];};};Realtime[_0xa757('0x37')]['initVoiceQueueReports']=function(){var _0x115a94=this;return function(_0x55bc0f){clearVoiceQueues(_0x115a94[_0xa757('0x12')]);if(_0x55bc0f){_0x55bc0f=_[_0xa757('0x4a')](_0x55bc0f,_0xa757('0x4b'));for(var _0xbf1bbf in _0x55bc0f){if(_0x55bc0f[_0xa757('0x25')](_0xbf1bbf)){for(var _0x40a79b=0x0;_0x40a79b<_0x55bc0f[_0xbf1bbf]['length'];_0x40a79b+=0x1){var _0xa28144=_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4c')];if(_0x115a94[_0xa757('0x12')][_0xa28144]){if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4d')]){_0x115a94[_0xa757('0x12')][_0xa28144]['unmanaged']+=0x1;}if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x4e')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x4f')]+=0x1;}_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt'])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;if(_0x40a79b===_0x55bc0f[_0xbf1bbf]['length']-0x1){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x27')]+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x54')]||_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x55')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x51')]),_0xa757('0x52'))||0x0;_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x56')]+=0x1;if(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x57')]){_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x26')]+=0x1;_0x115a94[_0xa757('0x12')][_0xa28144]['sumBillable']+=moment(_0x55bc0f[_0xbf1bbf][_0x40a79b][_0xa757('0x53')])[_0xa757('0x50')](moment(_0x55bc0f[_0xbf1bbf][_0x40a79b]['queuecallerleaveAt']),_0xa757('0x52'))||0x0;}}else{_0x115a94[_0xa757('0x12')][_0xa28144]['sumDuration']+=_0x115a94[_0xa757('0x12')][_0xa28144][_0xa757('0x2b')]||0x0;}}}}}}return _0x115a94[_0xa757('0x12')];};};Realtime[_0xa757('0x37')][_0xa757('0x58')]=function(){var _0x312542=this;return function(_0xdb2ac6){clearVoiceCallReports(_0x312542[_0xa757('0x59')]);if(_0xdb2ac6){for(var _0x1f74af=0x0;_0x1f74af<_0xdb2ac6[_0xa757('0x3a')];_0x1f74af+=0x1){_0x312542[_0xa757('0x59')][_0xa757('0x56')]+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x27')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')];if(_0xdb2ac6[_0x1f74af][_0xa757('0x5b')]==='ANSWERED'){_0x312542[_0xa757('0x59')]['answered']+=0x1;_0x312542[_0xa757('0x59')][_0xa757('0x2b')]+=_0xdb2ac6[_0x1f74af][_0xa757('0x5a')]-_0xdb2ac6[_0x1f74af][_0xa757('0x5c')]||0x0;_0x312542[_0xa757('0x59')]['sumBillable']+=_0xdb2ac6[_0x1f74af][_0xa757('0x5c')];}}}return _0x312542[_0xa757('0x59')];};};Realtime[_0xa757('0x37')]['initCampaigns']=function(){var _0x3317d8=this;return function(_0x3619ec){if(_0x3619ec){freeIsNotKey(_0x3619ec,_0x3317d8[_0xa757('0x14')],'name');for(var _0x501134=0x0,_0x1f437d={};_0x501134<_0x3619ec[_0xa757('0x3a')];_0x501134+=0x1){_0x1f437d=_0x3619ec[_0x501134];if(_[_0xa757('0x3b')](_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]])){_0x3317d8['campaigns'][_0x1f437d['name']]=new Campaign(_0x1f437d);}else{_0x3317d8[_0xa757('0x38')](_0x3317d8[_0xa757('0x14')][_0x1f437d[_0xa757('0x24')]],_0x1f437d);_0x3317d8['campaigns'][_0x1f437d[_0xa757('0x24')]][_0xa757('0x5d')]=_0x1f437d[_0xa757('0x5e')]?_0x1f437d[_0xa757('0x5e')][_0xa757('0x24')]:undefined;}}}return _0x3317d8[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x5f')]=function(){var _0xe38e76=this;return function(_0x35c1aa){if(_0x35c1aa){freeIsNotKey(_0x35c1aa,_0xe38e76[_0xa757('0x60')],'id');for(var _0xafcf19=0x0,_0x5a7042={};_0xafcf19<_0x35c1aa[_0xa757('0x3a')];_0xafcf19+=0x1){_0x5a7042=_0x35c1aa[_0xafcf19];if(_[_0xa757('0x3b')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']])){_0xe38e76[_0xa757('0x60')][_0x5a7042['id']]=new VoiceExtension(_0x5a7042);}else{_0xe38e76[_0xa757('0x38')](_0xe38e76[_0xa757('0x60')][_0x5a7042['id']],_0x5a7042);}}}return _0xe38e76[_0xa757('0x60')];};};Realtime[_0xa757('0x37')][_0xa757('0x61')]=function(){var _0x2d34b7=this;return function(_0x3997f8){clearCampaigns(_0x2d34b7[_0xa757('0x14')]);for(var _0x132033=0x0;_0x132033<_0x3997f8[_0xa757('0x3a')];_0x132033+=0x1){_[_0xa757('0x62')](_0x2d34b7[_0xa757('0x14')][_0x3997f8[_0x132033][_0xa757('0x24')]],_0x3997f8[_0x132033]);}return _0x2d34b7[_0xa757('0x14')];};};Realtime[_0xa757('0x37')][_0xa757('0x63')]=function(){var _0x1bcb2e=this;return function(_0x20ea21){if(_0x20ea21){freeIsNotKey(_0x20ea21,_0x1bcb2e['faxAccounts'],'id');for(var _0x768a79=0x0,_0x39c52a={};_0x768a79<_0x20ea21['length'];_0x768a79+=0x1){_0x39c52a=_0x20ea21[_0x768a79];if(_[_0xa757('0x3b')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']])){_0x1bcb2e[_0xa757('0x1e')][_0x39c52a['id']]=new FaxAccount(_0x39c52a);}else{_0x1bcb2e[_0xa757('0x38')](_0x1bcb2e['faxAccounts'][_0x39c52a['id']],_0x39c52a);}}}return _0x1bcb2e[_0xa757('0x1e')];};};Realtime[_0xa757('0x37')][_0xa757('0x64')]=function(){var _0x7ba6b3=this;return function(_0x535ff7){if(_0x535ff7){freeIsNotKey(_0x535ff7,_0x7ba6b3[_0xa757('0x12')],_0xa757('0x24'));for(var _0x4bf5c2=0x0,_0x30716a={};_0x4bf5c2<_0x535ff7[_0xa757('0x3a')];_0x4bf5c2+=0x1){_0x30716a=_0x535ff7[_0x4bf5c2];if(_['isUndefined'](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]])){_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]]=new VoiceQueue(_0x30716a);}else{_0x7ba6b3[_0xa757('0x38')](_0x7ba6b3[_0xa757('0x12')][_0x30716a[_0xa757('0x24')]],_0x30716a);}}}return _0x7ba6b3[_0xa757('0x12')];};};module[_0xa757('0x65')]=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x1c0633,_0x2303cb){var _0xbb0710=function(_0xec9bcc){while(--_0xec9bcc){_0x1c0633['push'](_0x1c0633['shift']());}};_0xbb0710(++_0x2303cb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 0777e74..6b8c3cc 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2449=['assign','mergeDBDataToRealtime'];(function(_0x25e761,_0x24c218){var _0x190dfb=function(_0x5f2a26){while(--_0x5f2a26){_0x25e761['push'](_0x25e761['shift']());}};_0x190dfb(++_0x24c218);}(_0x2449,0xce));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';function mergeDBDataToRealtime(_0x581d18,_0x218267){var _0x350db7=Object[_0x9244('0x0')]({},_0x581d18);for(var _0xebb259 in _0x218267){if(_0x350db7['hasOwnProperty'](_0xebb259)){_0x350db7[_0xebb259]=_0x218267[_0xebb259];}}return _0x350db7;}exports[_0x9244('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x1239=['assign','hasOwnProperty'];(function(_0x105edf,_0x556730){var _0xd2db29=function(_0x2d89c9){while(--_0x2d89c9){_0x105edf['push'](_0x105edf['shift']());}};_0xd2db29(++_0x556730);}(_0x1239,0x146));var _0x9123=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1239[_0x2dafbe];return _0x58a45a;};'use strict';function mergeDBDataToRealtime(_0x4006ab,_0x434489){var _0x571e51=Object[_0x9123('0x0')]({},_0x4006ab);for(var _0x3b58f1 in _0x434489){if(_0x571e51[_0x9123('0x1')](_0x3b58f1)){_0x571e51[_0x3b58f1]=_0x434489[_0x3b58f1];}}return _0x571e51;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 05193a6..6d04d02 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 _0x3cb7=['connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','type','queue','callerid','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','getAgentByInternal','UserId','monitor','monitors','createdAt','calleridname','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','substring','indexOf','phone','transfererlinkedid','exports','lodash','moment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format','SIP/%s','length'];(function(_0x5ed5fd,_0x1e3a06){var _0x37564c=function(_0x40a6b7){while(--_0x40a6b7){_0x5ed5fd['push'](_0x5ed5fd['shift']());}};_0x37564c(++_0x1e3a06);}(_0x3cb7,0x88));var _0x73cb=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x3cb7[_0xab2afb];return _0x25262b;};'use strict';var _=require(_0x73cb('0x0'));var moment=require(_0x73cb('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x73cb('0x2'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x73cb('0x3'));var RpcMemberReport=require(_0x73cb('0x4'));var RpcVoiceQueueReport=require(_0x73cb('0x5'));var RpcVoiceRecording=require(_0x73cb('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x73cb('0x7'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x73cb('0x8'));var UserReport=require(_0x73cb('0x9'));function Report(_0x528948){this[_0x73cb('0xa')]=_0x528948;this[_0x73cb('0xb')]=_0x528948[_0x73cb('0xb')];this[_0x73cb('0xc')]=_0x528948[_0x73cb('0xc')];}Report[_0x73cb('0xd')][_0x73cb('0xe')]=function(_0x37430b){var _0x266099=new VoiceQueueReport(this[_0x73cb('0xa')]);var _0x94dd2a=new VoiceAgentReport(this[_0x73cb('0xa')]);var _0x5844ef=new VoiceDialReport(this['realtime']);var _0x3c263d=new VoiceCallReport(this[_0x73cb('0xa')]);var _0x36d222=new UserReport(this[_0x73cb('0xa')]);if(config[_0x73cb('0xf')]&&config['xdr'][_0x73cb('0x10')]){ami['on'](_0x73cb('0x11'),this[_0x73cb('0x12')]['bind'](this));ami['on'](_0x73cb('0x13'),this[_0x73cb('0x14')][_0x73cb('0x15')](this));ami['on'](_0x73cb('0x16'),this[_0x73cb('0x17')][_0x73cb('0x15')](this));ami['on'](_0x73cb('0x18'),this['voiceDialReport'][_0x73cb('0x15')](this));ami['on'](_0x73cb('0x19'),this[_0x73cb('0x1a')][_0x73cb('0x15')](this));ami['on'](_0x73cb('0x1b'),this[_0x73cb('0x1c')][_0x73cb('0x15')](this));}};Report[_0x73cb('0xd')][_0x73cb('0x1d')]=function(_0xa08067){var _0x337544;_0x337544=_['find'](this['agents'],function(_0x50457c){return _0x50457c[_0x73cb('0x1e')]==_0xa08067||_0x50457c[_0x73cb('0x1f')]==_0xa08067;});if(_[_0x73cb('0x20')](_0x337544)){var _0x21c3d6=_[_0x73cb('0x21')](this[_0x73cb('0xc')],function(_0x40a7e2){return _0x40a7e2[_0x73cb('0x1e')]==_0xa08067||_0x40a7e2['name']==_0xa08067;});if(_0x21c3d6){_0x337544=_[_0x73cb('0x21')](this[_0x73cb('0xb')],function(_0x7873a9){return _0x7873a9[_0x73cb('0x22')]==util[_0x73cb('0x23')](_0x73cb('0x24'),_0x21c3d6[_0x73cb('0x1f')]);});}}return _0x337544;};Report[_0x73cb('0xd')][_0x73cb('0x12')]=function(_0x220f9f){for(var _0x5a70d6=0x0;_0x5a70d6<_0x220f9f[_0x73cb('0x25')];_0x5a70d6+=0x1){var _0x2f968e=this['findAgent'](_0x220f9f[_0x5a70d6][_0x73cb('0x26')]);if(_0x2f968e){_0x220f9f[_0x5a70d6][_0x73cb('0x1e')]=_0x2f968e['accountcode'];_0x220f9f[_0x5a70d6]['assigned']=!![];_0x220f9f[_0x5a70d6][_0x73cb('0x27')]=_0x2f968e[_0x73cb('0x1f')];_0x220f9f[_0x5a70d6][_0x73cb('0x22')]=_[_0x73cb('0x20')](_0x2f968e[_0x73cb('0x22')])?util[_0x73cb('0x23')](_0x73cb('0x24'),_0x2f968e['name']):_0x2f968e[_0x73cb('0x22')];if(_0x220f9f[_0x5a70d6][_0x73cb('0x28')]){_0x220f9f[_0x5a70d6][_0x73cb('0x29')]=moment()[_0x73cb('0x23')](_0x73cb('0x2a'));}if(_0x220f9f[_0x5a70d6][_0x73cb('0x2b')]){_0x220f9f[_0x5a70d6][_0x73cb('0x2c')]=moment()[_0x73cb('0x23')](_0x73cb('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x220f9f[_0x5a70d6]);}RpcVoiceQueueReport[_0x73cb('0x2d')](_0x220f9f[_0x5a70d6]);}};function extractCalleridNumber(_0x35582e){var _0x278520=_0x35582e['match'](/<(.*?)>/);return _0x278520?_0x278520[0x1]:_0x35582e;}Report['prototype']['getAgentByInternal']=function(_0x51bb02){for(var _0x3945bc=0x0;_0x3945bc','transfers','linkedid','transfereelinkedid','UserId','create','monitor','monitors','monitorFilename','createdAt','calleridname','connectedlinename','membername','voiceAgentReport','forEach','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','voiceDialReport','blindTransfer','find'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0x8dfb,0x1f3));var _0xb8df=function(_0xb2dab9,_0x2f6f99){_0xb2dab9=_0xb2dab9-0x0;var _0x10c6ae=_0x8dfb[_0xb2dab9];return _0x10c6ae;};'use strict';var _=require('lodash');var moment=require(_0xb8df('0x0'));var util=require(_0xb8df('0x1'));var config=require(_0xb8df('0x2'));var ami=require(_0xb8df('0x3'));var RpcVoiceAgentReport=require(_0xb8df('0x4'));var RpcVoiceCallReport=require(_0xb8df('0x5'));var RpcVoiceDialReport=require(_0xb8df('0x6'));var RpcMemberReport=require(_0xb8df('0x7'));var RpcVoiceQueueReport=require(_0xb8df('0x8'));var RpcVoiceRecording=require(_0xb8df('0x9'));var RpcVoiceTransferReport=require(_0xb8df('0xa'));var VoiceQueueReport=require(_0xb8df('0xb'));var VoiceCallReport=require(_0xb8df('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xb8df('0xd'));var UserReport=require(_0xb8df('0xe'));function Report(_0x4a8af0){this[_0xb8df('0xf')]=_0x4a8af0;this[_0xb8df('0x10')]=_0x4a8af0['agents'];this['telephones']=_0x4a8af0[_0xb8df('0x11')];}Report[_0xb8df('0x12')][_0xb8df('0x13')]=function(_0x44d2a9){var _0x29360f=new VoiceQueueReport(this[_0xb8df('0xf')]);var _0xcebe2c=new VoiceAgentReport(this[_0xb8df('0xf')]);var _0x3248e5=new VoiceDialReport(this[_0xb8df('0xf')]);var _0x2d3be2=new VoiceCallReport(this['realtime']);var _0x5141df=new UserReport(this[_0xb8df('0xf')]);if(config['xdr']&&config[_0xb8df('0x14')][_0xb8df('0x15')]){ami['on'](_0xb8df('0x16'),this[_0xb8df('0x17')][_0xb8df('0x18')](this));ami['on']('custom:voiceCallReport',this[_0xb8df('0x19')][_0xb8df('0x18')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0xb8df('0x18')](this));ami['on']('custom:voiceDialReport',this[_0xb8df('0x1a')]['bind'](this));ami['on']('blindtransfer',this[_0xb8df('0x1b')][_0xb8df('0x18')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xb8df('0x18')](this));}};Report[_0xb8df('0x12')]['findAgent']=function(_0x1b8994){var _0x551b16;_0x551b16=_[_0xb8df('0x1c')](this[_0xb8df('0x10')],function(_0x309b01){return _0x309b01[_0xb8df('0x1d')]==_0x1b8994||_0x309b01[_0xb8df('0x1e')]==_0x1b8994;});if(_[_0xb8df('0x1f')](_0x551b16)){var _0x168f25=_['find'](this['telephones'],function(_0x50a8d2){return _0x50a8d2[_0xb8df('0x1d')]==_0x1b8994||_0x50a8d2[_0xb8df('0x1e')]==_0x1b8994;});if(_0x168f25){_0x551b16=_[_0xb8df('0x1c')](this[_0xb8df('0x10')],function(_0xdfccc6){return _0xdfccc6[_0xb8df('0x20')]==util[_0xb8df('0x21')](_0xb8df('0x22'),_0x168f25['name']);});}}return _0x551b16;};Report[_0xb8df('0x12')]['voiceQueueReport']=function(_0x2bfca3){for(var _0xe4ec07=0x0;_0xe4ec07<_0x2bfca3['length'];_0xe4ec07+=0x1){var _0x3c1a1e=this[_0xb8df('0x23')](_0x2bfca3[_0xe4ec07][_0xb8df('0x24')]);if(_0x3c1a1e){_0x2bfca3[_0xe4ec07][_0xb8df('0x1d')]=_0x3c1a1e[_0xb8df('0x1d')];_0x2bfca3[_0xe4ec07][_0xb8df('0x25')]=!![];_0x2bfca3[_0xe4ec07][_0xb8df('0x26')]=_0x3c1a1e['name'];_0x2bfca3[_0xe4ec07][_0xb8df('0x20')]=_[_0xb8df('0x1f')](_0x3c1a1e[_0xb8df('0x20')])?util[_0xb8df('0x21')](_0xb8df('0x22'),_0x3c1a1e[_0xb8df('0x1e')]):_0x3c1a1e[_0xb8df('0x20')];if(_0x2bfca3[_0xe4ec07][_0xb8df('0x27')]){_0x2bfca3[_0xe4ec07][_0xb8df('0x28')]=moment()[_0xb8df('0x21')](_0xb8df('0x29'));}if(_0x2bfca3[_0xe4ec07]['queuecallerexit']){_0x2bfca3[_0xe4ec07][_0xb8df('0x2a')]=moment()[_0xb8df('0x21')](_0xb8df('0x29'));}RpcMemberReport[_0xb8df('0x17')](_0x2bfca3[_0xe4ec07]);}RpcVoiceQueueReport['create'](_0x2bfca3[_0xe4ec07]);}};function extractCalleridNumber(_0x17657a){var _0x1abdaf=_0x17657a[_0xb8df('0x2b')](/<(.*?)>/);return _0x1abdaf?_0x1abdaf[0x1]:_0x17657a;}Report[_0xb8df('0x12')]['getAgentByInternal']=function(_0x221b90){for(var _0x7e234d=0x0;_0x7e234d0x0?!![]:![];if(!_0xb754fe){return this[_0xb13d('0x18')](this[_0xb13d('0x13')]['completeEvent']);}};VoiceQueueReport[_0xb13d('0x9')]['syncQueueMember']=function(_0xf75778){var _0x559072=this[_0xb13d('0x13')]['id'];if(this[_0xb13d('0x13')][_0xb13d('0x65')][_0x559072]&&this['summary'][_0xb13d('0x65')][_0x559072][_0xf75778['actionid']]){this[_0xb13d('0x13')][_0xb13d('0x65')][_0x559072][_0xf75778[_0xb13d('0x66')]][_0xb13d('0xf')]['push'](_0xf75778);}};VoiceQueueReport[_0xb13d('0x9')]['syncQueueSummary']=function(_0x3578ba){var _0x238c2a=this;try{if(this['isNotNull'](_0x3578ba)&&this[_0xb13d('0x5f')](_0x3578ba['queue'])){logger[_0xb13d('0x54')](_0xb13d('0x71'),util[_0xb13d('0x44')](_0x3578ba,{'showHidden':![],'depth':null}));var _0x37def3=this[_0xb13d('0x11')][_0x3578ba['queue']];if(_0x37def3){logger[_0xb13d('0x72')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x37def3[_0xb13d('0x69')]);this[_0xb13d('0x13')][_0xb13d('0x68')][_0x37def3[_0xb13d('0x69')]]={'summaryEvent':_0x3578ba};this['summary'][_0xb13d('0x70')]+=0x1;return ami[_0xb13d('0x3e')]({'action':_0xb13d('0x65'),'queue':_0x37def3[_0xb13d('0x69')]})[_0xb13d('0x73')](function(_0x1b3b46){if(!_0x238c2a[_0xb13d('0x13')][_0xb13d('0x65')][_0x3578ba[_0xb13d('0x66')]]){_0x238c2a[_0xb13d('0x13')][_0xb13d('0x65')][_0x3578ba['actionid']]={};}_0x238c2a['summary'][_0xb13d('0x65')][_0x3578ba[_0xb13d('0x66')]][_0x1b3b46['actionid']]={'queue':_0x37def3[_0xb13d('0x69')],'agents':[]};})[_0xb13d('0x41')](function(_0x9b0e7a){throw _0x9b0e7a;});}}}catch(_0x3c1b90){logger[_0xb13d('0x46')](_0xb13d('0x74'),util[_0xb13d('0x44')](_0x3c1b90,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')]['syncQueueSummaryComplete']=function(_0x4fc1c2){if(this[_0xb13d('0x13')][_0xb13d('0x70')]>0x0){this['summary'][_0xb13d('0x75')]=_0x4fc1c2;return;}logger[_0xb13d('0x54')](_0xb13d('0x76'),util[_0xb13d('0x44')](_0x4fc1c2,{'showHidden':![],'depth':null}));this[_0xb13d('0x13')]=initializeSummary();ami[_0xb13d('0x4c')](_0xb13d('0x77'),{});};VoiceQueueReport['prototype'][_0xb13d('0x78')]=function(_0x2fccec){try{if(this['isNotNull'](_0x2fccec)){logger['debug'](_0xb13d('0x79'),_0x2fccec[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x2fccec,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xb13d('0x45')][_0x2fccec[_0xb13d('0x4f')]])){this[_0xb13d('0x45')][_0x2fccec['uniqueid']]=[];}if(_[_0xb13d('0x60')](this[_0xb13d('0x3c')][_0x2fccec[_0xb13d('0x4f')]])){this[_0xb13d('0x3c')][_0x2fccec[_0xb13d('0x4f')]]={};}var _0xa683cb=new QueueReport();_0xa683cb[_0xb13d('0x52')]=_0x2fccec['queue'];_0xa683cb[_0xb13d('0x6e')]=this[_0xb13d('0x11')][_0xa683cb[_0xb13d('0x52')]]&&this['voiceQueues'][_0xa683cb['queue']][_0xb13d('0x6e')]?this['voiceQueues'][_0xa683cb[_0xb13d('0x52')]][_0xb13d('0x6e')]||_0xb13d('0x5c'):_0xb13d('0x5c');_0xa683cb[_0xb13d('0x7a')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0xa683cb[_0xb13d('0x7c')]=_0x2fccec['position'];_0xa683cb[_0xb13d('0x7d')]=_0x2fccec['count'];_0xa683cb[_0xb13d('0x4f')]=_0x2fccec['uniqueid'];_0xa683cb[_0xb13d('0x7e')]=this[_0xb13d('0x3c')][_0x2fccec['uniqueid']][_0xb13d('0x7e')];logger[_0xb13d('0x72')](_0xb13d('0x7f'),_0xa683cb[_0xb13d('0x52')],_0xa683cb[_0xb13d('0x6e')]);_['merge'](_0xa683cb,_[_0xb13d('0x80')](_0x2fccec,_['keys'](_0xa683cb)));this[_0xb13d('0x45')][_0x2fccec['uniqueid']][_0xb13d('0x81')](_0xa683cb);this[_0xb13d('0x3c')][_0x2fccec[_0xb13d('0x4f')]]=_0xa683cb;this[_0xb13d('0x4d')](_0xa683cb,_0xb13d('0x82'));}}catch(_0x2837be){logger[_0xb13d('0x46')](_0xb13d('0x79'),_0x2fccec[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x2837be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0x1e')]=function(_0x4820cb){try{if(this[_0xb13d('0x5f')](_0x4820cb)){logger[_0xb13d('0x54')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4820cb[_0xb13d('0x4f')],util['inspect'](_0x4820cb,{'showHidden':![],'depth':null}));if(this[_0xb13d('0x45')][_0x4820cb[_0xb13d('0x4f')]]){var _0x48a143=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x4820cb[_0xb13d('0x4f')]]);_0x48a143[_0xb13d('0x84')]=![];_0x48a143['queuecallercompleteAt']=null;_0x48a143[_0xb13d('0x85')]=_0x4820cb[_0xb13d('0x85')];_0x48a143[_0xb13d('0x86')]=_0x4820cb[_0xb13d('0x86')];_0x48a143['queuecallerabandon']=!![];_0x48a143[_0xb13d('0x87')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x48a143[_0xb13d('0x57')]=_0xb13d('0x88');_0x48a143[_0xb13d('0x89')]=null;logger['info'](_0xb13d('0x8a'),_0x48a143['queue'],_0x48a143['type']);this[_0xb13d('0x3c')][_0x4820cb[_0xb13d('0x4f')]]=_0x48a143;this[_0xb13d('0x4a')](_0x48a143,'queuecallerabandon');}}}catch(_0x1e6f1b){logger[_0xb13d('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4820cb[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x1e6f1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0x20')]=function(_0x5ece51){try{if(this[_0xb13d('0x5f')](_0x5ece51)){logger[_0xb13d('0x54')](_0xb13d('0x8b'),_0x5ece51[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x5ece51,{'showHidden':![],'depth':null}));if(this[_0xb13d('0x45')][_0x5ece51['uniqueid']]){var _0x443298=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x5ece51[_0xb13d('0x4f')]]);_0x443298[_0xb13d('0x8c')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x443298[_0xb13d('0x8d')]=_0x5ece51['connectedlinenum'];_0x443298['connectedlinename']=_0x5ece51[_0xb13d('0x8e')];logger[_0xb13d('0x72')](_0xb13d('0x8f'),_0x443298[_0xb13d('0x52')],_0x443298['type'],_0x5ece51['connectedlinenum'],_0x5ece51[_0xb13d('0x8e')]);this['channels'][_0x5ece51['uniqueid']]=_0x443298;this[_0xb13d('0x4d')](_0x443298,_0xb13d('0x1f'));}}}catch(_0x469b5a){logger[_0xb13d('0x46')](_0xb13d('0x8b'),_0x5ece51[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x469b5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')]['syncAgentConnect']=function(_0x4b3e47){try{if(this[_0xb13d('0x5f')](_0x4b3e47)){logger['debug'](_0xb13d('0x90'),_0x4b3e47[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x4b3e47,{'showHidden':![],'depth':null}));if(this[_0xb13d('0x45')][_0x4b3e47[_0xb13d('0x4f')]]){var _0x3b2cdb=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x4b3e47[_0xb13d('0x4f')]]);_0x3b2cdb['queuecallercomplete']=!![];_0x3b2cdb['queuecallerexitreason']=_0xb13d('0x91');logger[_0xb13d('0x72')](_0xb13d('0x92'),_0x3b2cdb[_0xb13d('0x52')],_0x3b2cdb[_0xb13d('0x6e')]);}}}catch(_0x4fb42e){logger[_0xb13d('0x46')](_0xb13d('0x90'),_0x4b3e47[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x4fb42e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0x22')]=function(_0x14bd9a){try{if(this[_0xb13d('0x5f')](_0x14bd9a)){logger['debug'](_0xb13d('0x93'),_0x14bd9a['uniqueid'],util[_0xb13d('0x44')](_0x14bd9a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x14bd9a[_0xb13d('0x4f')]]){var _0x38c561=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x4f')]]);_0x38c561[_0xb13d('0x1d')]=![];_0x38c561['queuecallerabandonAt']=null;_0x38c561[_0xb13d('0x94')]=!![];_0x38c561[_0xb13d('0x89')]=_0x14bd9a[_0xb13d('0x95')];_0x38c561['holdtime']=_0x14bd9a['holdtime'];_0x38c561[_0xb13d('0x84')]=!![];_0x38c561[_0xb13d('0x96')]=![];_0x38c561[_0xb13d('0x97')]=null;if(!_0x38c561['transfer']){if(_0x14bd9a['reason']==_0xb13d('0x98')){_0x38c561[_0xb13d('0x57')]='COMPLETED';logger[_0xb13d('0x72')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x38c561[_0xb13d('0x52')],_0x38c561['type']);}else{if(_[_0xb13d('0x99')](_0x14bd9a[_0xb13d('0x40')][_0xb13d('0x9a')](),'local/')){if(this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x9b')]]){var _0x2cf408=_[_0xb13d('0x83')](this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x9b')]]);_0x2cf408[_0xb13d('0x84')]=![];_0x2cf408[_0xb13d('0x96')]=!![];_0x2cf408['queuecallerexitAt']=moment(_0x38c561['queuecallerjoinAt'])[_0xb13d('0x9c')](_0x14bd9a['holdtime'],'seconds')[_0xb13d('0x50')](_0xb13d('0x7b'));_0x2cf408[_0xb13d('0x57')]=_0xb13d('0x9d');_0x2cf408[_0xb13d('0x98')]=!![];_0x2cf408[_0xb13d('0x9e')]='FORWARD';_0x2cf408[_0xb13d('0x9f')]=_0x14bd9a[_0xb13d('0xa0')];_0x2cf408[_0xb13d('0xa1')]=_0x14bd9a[_0xb13d('0x4f')];logger['info'](_0xb13d('0xa2'),_0x2cf408[_0xb13d('0x52')],_0x2cf408[_0xb13d('0x6e')]);var _0x2866ce=this[_0xb13d('0x45')][_0x14bd9a['linkedid']];this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x9b')]]=this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x4f')]];this[_0xb13d('0x45')][_0x14bd9a[_0xb13d('0x4f')]]=_0x2866ce;}}else{_0x38c561[_0xb13d('0x57')]=_0xb13d('0xa3')+_0x14bd9a['reason'][_0xb13d('0xa4')]();logger[_0xb13d('0x72')](_0xb13d('0xa5'),_0x38c561[_0xb13d('0x52')],_0x38c561[_0xb13d('0x6e')],_0x38c561['queuecallerexitreason']);}}}this[_0xb13d('0x3c')][_0x14bd9a['uniqueid']]=_0x38c561;}}}catch(_0x504254){logger[_0xb13d('0x46')](_0xb13d('0x93'),_0x14bd9a[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x504254,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0x26')]=function(_0x228582){try{if(this[_0xb13d('0x5f')](_0x228582)){logger[_0xb13d('0x54')]('[%s][voiceQueueReport][varset]',_0x228582[_0xb13d('0x4f')],util[_0xb13d('0x44')](_0x228582,{'showHidden':![],'depth':null}));this['addVariable'](_0x228582[_0xb13d('0x4f')],_[_0xb13d('0xa6')](_0x228582[_0xb13d('0xa7')])[0x0],_0x228582[_0xb13d('0xa8')]);if(this[_0xb13d('0x45')][_0x228582['uniqueid']]){var _0x5b79a6=_['last'](this[_0xb13d('0x45')][_0x228582[_0xb13d('0x4f')]]);if(_0x5b79a6){if(this[_0xb13d('0x5f')](_0x228582['variable'])&&this[_0xb13d('0x5f')](_0x228582[_0xb13d('0xa7')][_0xb13d('0x65')])){switch(_0x228582[_0xb13d('0xa8')]){case _0xb13d('0xa9'):_0x5b79a6['queuecallerexit']=![];_0x5b79a6[_0xb13d('0x97')]=null;break;case _0xb13d('0xaa'):_0x5b79a6[_0xb13d('0xab')]=_0xb13d('0xac');_0x5b79a6['queuecallerexit']=!![];_0x5b79a6['queuecallerexitAt']=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x5b79a6[_0xb13d('0x8c')]=moment()['format'](_0xb13d('0x7b'));logger[_0xb13d('0x54')](_0xb13d('0xad'),_0x228582['uniqueid'],util[_0xb13d('0x44')](_0x5b79a6,{'showHidden':![],'depth':null}));ami['emit'](_0xb13d('0xae'),_0x5b79a6);break;default:_0x5b79a6[_0xb13d('0x96')]=!![];_0x5b79a6[_0xb13d('0x97')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x5b79a6['queuecallerleaveAt']=moment()['format'](_0xb13d('0x7b'));}_0x5b79a6['queuecallerabandon']=![];_0x5b79a6['queuecallerabandonAt']=null;_0x5b79a6['queuecallerexitreason']=_0x228582[_0xb13d('0xa8')];this[_0xb13d('0x3c')][_0x228582['uniqueid']]=_0x5b79a6;this[_0xb13d('0x4a')](_0x5b79a6,_0xb13d('0x25'));}else if(this[_0xb13d('0x5f')](_0x228582[_0xb13d('0xa7')])&&this['isNotNull'](_0x228582['variable']['queueposition'])){if(!_0x5b79a6[_0xb13d('0x1d')]){_0x5b79a6[_0xb13d('0x96')]=!![];_0x5b79a6[_0xb13d('0x97')]=moment()[_0xb13d('0x50')](_0xb13d('0x7b'));_0x5b79a6[_0xb13d('0x57')]=_0xb13d('0xaf');_0x5b79a6['queuecallerleaveAt']=moment()['format'](_0xb13d('0x7b'));this[_0xb13d('0x3c')][_0x228582[_0xb13d('0x4f')]]=_0x5b79a6;}}logger[_0xb13d('0x72')](_0xb13d('0xb0'),_0x228582[_0xb13d('0x4f')],_0x5b79a6[_0xb13d('0x52')],_0x5b79a6['type'],_[_0xb13d('0xa6')](_0x228582[_0xb13d('0xa7')])[0x0],_0x228582[_0xb13d('0xa8')]);_0x5b79a6[_0xb13d('0x14')]=this[_0xb13d('0x14')][_0x228582[_0xb13d('0x4f')]];}}}}catch(_0x458f76){logger[_0xb13d('0x46')]('[%s][voiceQueueReport][varset]',_0x228582['uniqueid'],util[_0xb13d('0x44')](_0x458f76,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb13d('0xb1')]=function(_0x313f4c,_0x571106,_0xf24ddf){var _0x43e9e1=[_0xb13d('0xb2'),_0xb13d('0xb3'),_0xb13d('0xb4'),_0xb13d('0xb5'),_0xb13d('0xb6'),_0xb13d('0xb7'),_0xb13d('0xb8'),_0xb13d('0xb9'),_0xb13d('0xba'),_0xb13d('0xbb'),_0xb13d('0xbc'),'bridgepvtcallid',_0xb13d('0xbd'),'memberdynamic','memberinterface',_0xb13d('0xbe'),_0xb13d('0x95'),_0xb13d('0xbf'),_0xb13d('0xc0')];if(!_[_0xb13d('0xc1')](_0x571106)&&!_[_0xb13d('0xc2')](_0x43e9e1,_0x571106)){if(_[_0xb13d('0x60')](this['variables'][_0x313f4c])){this[_0xb13d('0x14')][_0x313f4c]={};}this['variables'][_0x313f4c][_0x571106]=_0xf24ddf;}};VoiceQueueReport[_0xb13d('0x9')][_0xb13d('0xc3')]=function(_0x3bb992,_0x59b303,_0x4bd980){var _0x137e37={};for(var _0x388262=0x0;_0x3882620x0?!![]:![];if(!_0x163ac7){return this['syncQueueSummaryComplete'](this[_0x3a70('0x13')][_0x3a70('0x6d')]);}};VoiceQueueReport[_0x3a70('0x35')][_0x3a70('0x6e')]=function(_0x723723){var _0x484dc0=this[_0x3a70('0x13')]['id'];if(this['summary'][_0x3a70('0x63')][_0x484dc0]&&this[_0x3a70('0x13')][_0x3a70('0x63')][_0x484dc0][_0x723723[_0x3a70('0x62')]]){this[_0x3a70('0x13')]['queuestatus'][_0x484dc0][_0x723723[_0x3a70('0x62')]][_0x3a70('0xe')]['push'](_0x723723);}};VoiceQueueReport['prototype'][_0x3a70('0x6f')]=function(_0x24e67b){var _0x15a6e2=this;try{if(this[_0x3a70('0x5b')](_0x24e67b)&&this['isNotNull'](_0x24e67b[_0x3a70('0x4e')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x3a70('0x4b')](_0x24e67b,{'showHidden':![],'depth':null}));var _0x13d652=this[_0x3a70('0x11')][_0x24e67b[_0x3a70('0x4e')]];if(_0x13d652){logger[_0x3a70('0x70')](_0x3a70('0x71'),_0x13d652[_0x3a70('0x59')]);this[_0x3a70('0x13')]['queues'][_0x13d652[_0x3a70('0x59')]]={'summaryEvent':_0x24e67b};this[_0x3a70('0x13')][_0x3a70('0x6c')]+=0x1;return ami[_0x3a70('0x39')]({'action':_0x3a70('0x63'),'queue':_0x13d652['name']})['then'](function(_0x3840d3){if(!_0x15a6e2['summary'][_0x3a70('0x63')][_0x24e67b[_0x3a70('0x62')]]){_0x15a6e2['summary'][_0x3a70('0x63')][_0x24e67b[_0x3a70('0x62')]]={};}_0x15a6e2[_0x3a70('0x13')][_0x3a70('0x63')][_0x24e67b['actionid']][_0x3840d3['actionid']]={'queue':_0x13d652['name'],'agents':[]};})[_0x3a70('0x3c')](function(_0x117fa0){throw _0x117fa0;});}}}catch(_0x16e53f){logger[_0x3a70('0x3f')](_0x3a70('0x72'),util[_0x3a70('0x4b')](_0x16e53f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3a70('0x35')][_0x3a70('0x17')]=function(_0x5f33e8){if(this[_0x3a70('0x13')][_0x3a70('0x6c')]>0x0){this[_0x3a70('0x13')][_0x3a70('0x6d')]=_0x5f33e8;return;}logger[_0x3a70('0x48')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x3a70('0x4b')](_0x5f33e8,{'showHidden':![],'depth':null}));this[_0x3a70('0x13')]=initializeSummary();ami[_0x3a70('0x46')]('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0x3a70('0x1d')]=function(_0x84de25){try{if(this[_0x3a70('0x5b')](_0x84de25)){logger[_0x3a70('0x48')](_0x3a70('0x73'),_0x84de25[_0x3a70('0x4a')],util[_0x3a70('0x4b')](_0x84de25,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x3a70('0x41')][_0x84de25[_0x3a70('0x4a')]])){this[_0x3a70('0x41')][_0x84de25[_0x3a70('0x4a')]]=[];}if(_[_0x3a70('0x5c')](this[_0x3a70('0xf')][_0x84de25[_0x3a70('0x4a')]])){this['channels'][_0x84de25[_0x3a70('0x4a')]]={};}var _0x2eda29=new QueueReport();_0x2eda29['queue']=_0x84de25[_0x3a70('0x4e')];_0x2eda29[_0x3a70('0x57')]=this[_0x3a70('0x11')][_0x2eda29[_0x3a70('0x4e')]]&&this[_0x3a70('0x11')][_0x2eda29[_0x3a70('0x4e')]][_0x3a70('0x57')]?this[_0x3a70('0x11')][_0x2eda29[_0x3a70('0x4e')]][_0x3a70('0x57')]||_0x3a70('0x6a'):_0x3a70('0x6a');_0x2eda29['queuecallerjoinAt']=moment()[_0x3a70('0x4c')](_0x3a70('0x74'));_0x2eda29[_0x3a70('0x75')]=_0x84de25['position'];_0x2eda29[_0x3a70('0x76')]=_0x84de25[_0x3a70('0x76')];_0x2eda29[_0x3a70('0x4a')]=_0x84de25[_0x3a70('0x4a')];_0x2eda29[_0x3a70('0x77')]=this[_0x3a70('0xf')][_0x84de25[_0x3a70('0x4a')]][_0x3a70('0x77')];logger['info'](_0x3a70('0x78'),_0x2eda29[_0x3a70('0x4e')],_0x2eda29[_0x3a70('0x57')]);_[_0x3a70('0x79')](_0x2eda29,_[_0x3a70('0x7a')](_0x84de25,_[_0x3a70('0x7b')](_0x2eda29)));this[_0x3a70('0x41')][_0x84de25[_0x3a70('0x4a')]]['push'](_0x2eda29);this[_0x3a70('0xf')][_0x84de25[_0x3a70('0x4a')]]=_0x2eda29;this[_0x3a70('0x47')](_0x2eda29,_0x3a70('0x1c'));}}catch(_0x5d945d){logger['error'](_0x3a70('0x73'),_0x84de25[_0x3a70('0x4a')],util[_0x3a70('0x4b')](_0x5d945d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3a70('0x35')][_0x3a70('0x1f')]=function(_0x34a131){try{if(this[_0x3a70('0x5b')](_0x34a131)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x34a131[_0x3a70('0x4a')],util[_0x3a70('0x4b')](_0x34a131,{'showHidden':![],'depth':null}));if(this[_0x3a70('0x41')][_0x34a131['uniqueid']]){var _0x5b9e12=_[_0x3a70('0x7c')](this['queueReports'][_0x34a131[_0x3a70('0x4a')]]);_0x5b9e12[_0x3a70('0x7d')]=![];_0x5b9e12[_0x3a70('0x7e')]=null;_0x5b9e12[_0x3a70('0x7f')]=_0x34a131[_0x3a70('0x7f')];_0x5b9e12[_0x3a70('0x80')]=_0x34a131[_0x3a70('0x80')];_0x5b9e12[_0x3a70('0x1e')]=!![];_0x5b9e12[_0x3a70('0x81')]=moment()[_0x3a70('0x4c')](_0x3a70('0x74'));_0x5b9e12['queuecallerexitreason']='ABANDONED';_0x5b9e12[_0x3a70('0x82')]=null;logger[_0x3a70('0x70')](_0x3a70('0x83'),_0x5b9e12[_0x3a70('0x4e')],_0x5b9e12[_0x3a70('0x57')]);this['channels'][_0x34a131['uniqueid']]=_0x5b9e12;this['emitVoiceQueueChannelRemove'](_0x5b9e12,'queuecallerabandon');}}}catch(_0x32d59f){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x34a131[_0x3a70('0x4a')],util[_0x3a70('0x4b')](_0x32d59f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3a70('0x35')]['syncQueueCallerLeave']=function(_0x1a0b7b){try{if(this[_0x3a70('0x5b')](_0x1a0b7b)){logger[_0x3a70('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0x1a0b7b[_0x3a70('0x4a')],util[_0x3a70('0x4b')](_0x1a0b7b,{'showHidden':![],'depth':null}));if(this[_0x3a70('0x41')][_0x1a0b7b[_0x3a70('0x4a')]]){var _0x18f5f6=_['last'](this[_0x3a70('0x41')][_0x1a0b7b[_0x3a70('0x4a')]]);_0x18f5f6[_0x3a70('0x84')]=moment()[_0x3a70('0x4c')](_0x3a70('0x74'));_0x18f5f6['connectedlinenum']=_0x1a0b7b['connectedlinenum'];_0x18f5f6[_0x3a70('0x85')]=_0x1a0b7b[_0x3a70('0x85')];logger[_0x3a70('0x70')](_0x3a70('0x86'),_0x18f5f6['queue'],_0x18f5f6['type'],_0x1a0b7b[_0x3a70('0x87')],_0x1a0b7b[_0x3a70('0x85')]);this[_0x3a70('0xf')][_0x1a0b7b[_0x3a70('0x4a')]]=_0x18f5f6;this[_0x3a70('0x47')](_0x18f5f6,_0x3a70('0x20'));}}}catch(_0x1ddad3){logger[_0x3a70('0x3f')]('[%s][voiceQueueReport][queuecallerleave]',_0x1a0b7b[_0x3a70('0x4a')],util['inspect'](_0x1ddad3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3a70('0x35')][_0x3a70('0x21')]=function(_0x2e98c5){try{if(this['isNotNull'](_0x2e98c5)){logger[_0x3a70('0x48')](_0x3a70('0x88'),_0x2e98c5['uniqueid'],util['inspect'](_0x2e98c5,{'showHidden':![],'depth':null}));if(this[_0x3a70('0x41')][_0x2e98c5[_0x3a70('0x4a')]]){var _0x5f3919=_[_0x3a70('0x7c')](this[_0x3a70('0x41')][_0x2e98c5[_0x3a70('0x4a')]]);_0x5f3919[_0x3a70('0x7d')]=!![];_0x5f3919[_0x3a70('0x52')]='COMPLETEDBYAGENT';logger[_0x3a70('0x70')](_0x3a70('0x89'),_0x5f3919['queue'],_0x5f3919['type']);}}}catch(_0x108028){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x2e98c5[_0x3a70('0x4a')],util['inspect'](_0x108028,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3a70('0x35')]['syncAgentComplete']=function(_0x5df3f8){try{if(this[_0x3a70('0x5b')](_0x5df3f8)){logger[_0x3a70('0x48')](_0x3a70('0x8a'),_0x5df3f8[_0x3a70('0x4a')],util['inspect'](_0x5df3f8,{'showHidden':![],'depth':null}));if(this[_0x3a70('0x41')][_0x5df3f8['uniqueid']]){var _0x4a7dbb=_[_0x3a70('0x7c')](this[_0x3a70('0x41')][_0x5df3f8[_0x3a70('0x4a')]]);_0x4a7dbb['queuecallerabandon']=![];_0x4a7dbb[_0x3a70('0x81')]=null;_0x4a7dbb[_0x3a70('0x8b')]=!![];_0x4a7dbb[_0x3a70('0x82')]=_0x5df3f8['membername'];_0x4a7dbb[_0x3a70('0x7f')]=_0x5df3f8[_0x3a70('0x7f')];_0x4a7dbb['queuecallercomplete']=!![];_0x4a7dbb[_0x3a70('0x8c')]=![];_0x4a7dbb[_0x3a70('0x8d')]=null;if(!_0x4a7dbb[_0x3a70('0x8e')]){if(_0x5df3f8[_0x3a70('0x8f')]==_0x3a70('0x8e')){_0x4a7dbb[_0x3a70('0x52')]=_0x3a70('0x90');logger[_0x3a70('0x70')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4a7dbb['queue'],_0x4a7dbb[_0x3a70('0x57')]);}else{if(_[_0x3a70('0x91')](_0x5df3f8[_0x3a70('0x3b')]['toLowerCase'](),_0x3a70('0x92'))){if(this[_0x3a70('0x41')][_0x5df3f8[_0x3a70('0x93')]]){var _0x5063fc=_[_0x3a70('0x7c')](this[_0x3a70('0x41')][_0x5df3f8[_0x3a70('0x93')]]);_0x5063fc['queuecallercomplete']=![];_0x5063fc[_0x3a70('0x8c')]=!![];_0x5063fc[_0x3a70('0x8d')]=moment(_0x4a7dbb['queuecallerjoinAt'])[_0x3a70('0x94')](_0x5df3f8[_0x3a70('0x7f')],_0x3a70('0x95'))[_0x3a70('0x4c')](_0x3a70('0x74'));_0x5063fc[_0x3a70('0x52')]='FORWARDTRANSFER';_0x5063fc[_0x3a70('0x8e')]=!![];_0x5063fc['transfertype']=_0x3a70('0x96');_0x5063fc['transferexten']=_0x5df3f8[_0x3a70('0x97')];_0x5063fc[_0x3a70('0x98')]=_0x5df3f8['uniqueid'];logger[_0x3a70('0x70')](_0x3a70('0x99'),_0x5063fc[_0x3a70('0x4e')],_0x5063fc[_0x3a70('0x57')]);var _0x5317bf=this[_0x3a70('0x41')][_0x5df3f8[_0x3a70('0x93')]];this[_0x3a70('0x41')][_0x5df3f8['linkedid']]=this[_0x3a70('0x41')][_0x5df3f8[_0x3a70('0x4a')]];this['queueReports'][_0x5df3f8[_0x3a70('0x4a')]]=_0x5317bf;}}else{_0x4a7dbb['queuecallerexitreason']=_0x3a70('0x9a')+_0x5df3f8[_0x3a70('0x8f')][_0x3a70('0x9b')]();logger[_0x3a70('0x70')](_0x3a70('0x9c'),_0x4a7dbb[_0x3a70('0x4e')],_0x4a7dbb[_0x3a70('0x57')],_0x4a7dbb[_0x3a70('0x52')]);}}}this['channels'][_0x5df3f8[_0x3a70('0x4a')]]=_0x4a7dbb;}}}catch(_0x353f0c){logger[_0x3a70('0x3f')](_0x3a70('0x8a'),_0x5df3f8['uniqueid'],util[_0x3a70('0x4b')](_0x353f0c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3a70('0x35')][_0x3a70('0x23')]=function(_0x386c5a){try{if(this[_0x3a70('0x5b')](_0x386c5a)){logger['debug'](_0x3a70('0x9d'),_0x386c5a[_0x3a70('0x4a')],util[_0x3a70('0x4b')](_0x386c5a,{'showHidden':![],'depth':null}));this[_0x3a70('0x9e')](_0x386c5a[_0x3a70('0x4a')],_[_0x3a70('0x7b')](_0x386c5a['variable'])[0x0],_0x386c5a[_0x3a70('0x9f')]);if(this[_0x3a70('0x41')][_0x386c5a['uniqueid']]){var _0x1a07d9=_[_0x3a70('0x7c')](this['queueReports'][_0x386c5a['uniqueid']]);if(_0x1a07d9){if(this[_0x3a70('0x5b')](_0x386c5a[_0x3a70('0xa0')])&&this[_0x3a70('0x5b')](_0x386c5a[_0x3a70('0xa0')][_0x3a70('0x63')])){switch(_0x386c5a[_0x3a70('0x9f')]){case'CONTINUE':_0x1a07d9[_0x3a70('0x8c')]=![];_0x1a07d9[_0x3a70('0x8d')]=null;break;case'TIMEOUT':_0x1a07d9[_0x3a70('0xa1')]=_0x3a70('0xa2');_0x1a07d9['queuecallerexit']=!![];_0x1a07d9[_0x3a70('0x8d')]=moment()[_0x3a70('0x4c')](_0x3a70('0x74'));_0x1a07d9[_0x3a70('0x84')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x3a70('0x48')](_0x3a70('0xa3'),_0x386c5a[_0x3a70('0x4a')],util[_0x3a70('0x4b')](_0x1a07d9,{'showHidden':![],'depth':null}));ami[_0x3a70('0x46')](_0x3a70('0xa4'),_0x1a07d9);break;default:_0x1a07d9['queuecallerexit']=!![];_0x1a07d9['queuecallerexitAt']=moment()['format'](_0x3a70('0x74'));_0x1a07d9[_0x3a70('0x84')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1a07d9[_0x3a70('0x1e')]=![];_0x1a07d9[_0x3a70('0x81')]=null;_0x1a07d9['queuecallerexitreason']=_0x386c5a[_0x3a70('0x9f')];this[_0x3a70('0xf')][_0x386c5a[_0x3a70('0x4a')]]=_0x1a07d9;this[_0x3a70('0x50')](_0x1a07d9,_0x3a70('0x22'));}else if(this['isNotNull'](_0x386c5a[_0x3a70('0xa0')])&&this[_0x3a70('0x5b')](_0x386c5a['variable'][_0x3a70('0xa5')])){if(!_0x1a07d9[_0x3a70('0x1e')]){_0x1a07d9['queuecallerexit']=!![];_0x1a07d9[_0x3a70('0x8d')]=moment()['format'](_0x3a70('0x74'));_0x1a07d9['queuecallerexitreason']=_0x3a70('0xa6');_0x1a07d9[_0x3a70('0x84')]=moment()[_0x3a70('0x4c')](_0x3a70('0x74'));this['channels'][_0x386c5a[_0x3a70('0x4a')]]=_0x1a07d9;}}logger[_0x3a70('0x70')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x386c5a['uniqueid'],_0x1a07d9[_0x3a70('0x4e')],_0x1a07d9[_0x3a70('0x57')],_['keys'](_0x386c5a[_0x3a70('0xa0')])[0x0],_0x386c5a[_0x3a70('0x9f')]);_0x1a07d9['variables']=this['variables'][_0x386c5a['uniqueid']];}}}}catch(_0x321f7e){logger['error']('[%s][voiceQueueReport][varset]',_0x386c5a[_0x3a70('0x4a')],util[_0x3a70('0x4b')](_0x321f7e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3a70('0x35')][_0x3a70('0x9e')]=function(_0x2ea53d,_0x32aa86,_0x177096){var _0x31f332=[_0x3a70('0xa7'),_0x3a70('0xa8'),_0x3a70('0xa9'),_0x3a70('0xaa'),_0x3a70('0xab'),_0x3a70('0xac'),_0x3a70('0xad'),'rtpaudioqosrttbridged',_0x3a70('0xae'),_0x3a70('0xaf'),_0x3a70('0xb0'),_0x3a70('0xb1'),_0x3a70('0xb2'),_0x3a70('0xb3'),'memberinterface',_0x3a70('0xb4'),_0x3a70('0xb5'),_0x3a70('0xb6'),'memberrealtime'];if(!_[_0x3a70('0x38')](_0x32aa86)&&!_['includes'](_0x31f332,_0x32aa86)){if(_[_0x3a70('0x5c')](this[_0x3a70('0x14')][_0x2ea53d])){this[_0x3a70('0x14')][_0x2ea53d]={};}this[_0x3a70('0x14')][_0x2ea53d][_0x32aa86]=_0x177096;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x17399a,_0x238b86,_0x525449){var _0x1b1248={};for(var _0xe850e3=0x0;_0xe850e3=0x0?moment(_0x37ae74[_0x67cf('0x1a')])[_0x67cf('0xd')](_0x37ae74['starttime'],'seconds'):null,'data1':'outbound','data2':_0x37ae74[_0x67cf('0x14')],'data3':_0x37ae74[_0x67cf('0x1b')],'data4':_0x37ae74[_0x67cf('0x1c')]||null,'role':'agent','internal':_0x37ae74[_0x67cf('0x14')]?_['toNumber'](_0x37ae74[_0x67cf('0x14')]):undefined,'uniqueid':_0x37ae74[_0x67cf('0x15')]},'log':_0x67cf('0x7')});}; \ No newline at end of file +var _0xca7b=['voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','accountcode','toNumber','CreateMemberReport','voiceDialReport','membername','starttime','endtime','dialstring','agent','uniqueid','moment','util','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca7b,0x131));var _0xbca7=function(_0x3e2c38,_0x80bf2e){_0x3e2c38=_0x3e2c38-0x0;var _0x5ae121=_0xca7b[_0x3e2c38];return _0x5ae121;};'use strict';var moment=require(_0xbca7('0x0'));var _=require('lodash');var util=require(_0xbca7('0x1'));var client=require(_0xbca7('0x2'));exports[_0xbca7('0x3')]=function(_0x4597f5){var _0x28f680=_0x4597f5[_0xbca7('0x4')]||_0x4597f5[_0xbca7('0x5')];return client[_0xbca7('0x6')]('CreateMemberReport',{'body':{'channel':_0xbca7('0x7'),'membername':_0x4597f5[_0xbca7('0x8')],'interface':_[_0xbca7('0x9')](_0x4597f5[_0xbca7('0xa')])?util['format']('SIP/%s',_0x4597f5[_0xbca7('0x8')]):_0x4597f5[_0xbca7('0xa')],'type':_0xbca7('0xb'),'enterAt':_0x4597f5[_0xbca7('0xc')],'exitAt':_0x28f680,'duration':moment(_0x28f680)[_0xbca7('0xd')](_0x4597f5['queuecallerleaveAt'],_0xbca7('0xe')),'data1':_0xbca7('0xf'),'data2':_0x4597f5[_0xbca7('0x10')],'data3':_0x4597f5[_0xbca7('0x11')],'data4':null,'data5':_0x4597f5['queue'],'role':'agent','internal':_0x4597f5[_0xbca7('0x12')]?_[_0xbca7('0x13')](_0x4597f5[_0xbca7('0x12')]):undefined,'uniqueid':_0x4597f5['uniqueid']},'log':_0xbca7('0x14')});};exports[_0xbca7('0x15')]=function(_0x4fc70f){return client['Request'](_0xbca7('0x14'),{'body':{'channel':_0xbca7('0x7'),'membername':_0x4fc70f[_0xbca7('0x16')],'interface':_0x4fc70f[_0xbca7('0xa')],'type':_0xbca7('0xb'),'enterAt':_0x4fc70f[_0xbca7('0x17')],'exitAt':_0x4fc70f['endtime'],'duration':moment(_0x4fc70f[_0xbca7('0x18')])['diff'](_0x4fc70f[_0xbca7('0x17')],_0xbca7('0xe'))>=0x0?moment(_0x4fc70f[_0xbca7('0x18')])[_0xbca7('0xd')](_0x4fc70f['starttime'],_0xbca7('0xe')):null,'data1':'outbound','data2':_0x4fc70f[_0xbca7('0x12')],'data3':_0x4fc70f[_0xbca7('0x11')],'data4':_0x4fc70f[_0xbca7('0x19')]||null,'role':_0xbca7('0x1a'),'internal':_0x4fc70f[_0xbca7('0x12')]?_[_0xbca7('0x13')](_0x4fc70f[_0xbca7('0x12')]):undefined,'uniqueid':_0x4fc70f[_0xbca7('0x1b')]},'log':_0xbca7('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 4496fcd..ca2ca6d 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 _0x5b1c=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request','ShowSetting'];(function(_0x3226f9,_0x114317){var _0x28ec11=function(_0x3e6f38){while(--_0x3e6f38){_0x3226f9['push'](_0x3226f9['shift']());}};_0x28ec11(++_0x114317);}(_0x5b1c,0x1b9));var _0xc5b1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5b1c[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0xc5b1('0x0'));exports['getSettings']=function(){return client[_0xc5b1('0x1')](_0xc5b1('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc5b1('0x3'),_0xc5b1('0x4')]},'log':_0xc5b1('0x5')});}; \ No newline at end of file +var _0xd5a2=['previewRecallmeReminderInterval','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x295e7f,_0x1a4d59){var _0xdb8b56=function(_0x41e909){while(--_0x41e909){_0x295e7f['push'](_0x295e7f['shift']());}};_0xdb8b56(++_0x1a4d59);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x2a7204,_0x362309){_0x2a7204=_0x2a7204-0x0;var _0x441f89=_0xd5a2[_0x2a7204];return _0x441f89;};'use strict';var client=require('../client');exports[_0x2d5a('0x0')]=function(){return client[_0x2d5a('0x1')](_0x2d5a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2d5a('0x3'),_0x2d5a('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 d3c2dee..cddab5e 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 _0x50d5=['name','html','../client','GetTemplate'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0x50d5,0x166));var _0x550d=function(_0x2f0b1c,_0x336074){_0x2f0b1c=_0x2f0b1c-0x0;var _0x491ac9=_0x50d5[_0x2f0b1c];return _0x491ac9;};'use strict';var client=require(_0x550d('0x0'));exports['getTemplates']=function(_0x27a5b2){return function(_0x5b4edf){return client['Request'](_0x550d('0x1'),{'options':{'raw':!![],'attributes':['id',_0x550d('0x2'),_0x550d('0x3')]},'log':_0x550d('0x1')});};}; \ No newline at end of file +var _0x4cff=['../client','GetTemplate','name','html'];(function(_0x5bf19e,_0x18e9ad){var _0x8304bb=function(_0x23071b){while(--_0x23071b){_0x5bf19e['push'](_0x5bf19e['shift']());}};_0x8304bb(++_0x18e9ad);}(_0x4cff,0xb8));var _0xf4cf=function(_0x4a08b6,_0x2eb2b5){_0x4a08b6=_0x4a08b6-0x0;var _0x90bb24=_0x4cff[_0x4a08b6];return _0x90bb24;};'use strict';var client=require(_0xf4cf('0x0'));exports['getTemplates']=function(_0xe22cd9){return function(_0x2d7d60){return client['Request'](_0xf4cf('0x1'),{'options':{'raw':!![],'attributes':['id',_0xf4cf('0x2'),_0xf4cf('0x3')]},'log':_0xf4cf('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 274eb78..8b244cf 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 _0xb1c8=['Condition','AllConditions','field','value','AnyConditions','operator','Action','action','data2','data3','data4','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0xb1c8,0x99));var _0x8b1c=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0xb1c8[_0x3a99f4];return _0xea0b42;};'use strict';var client=require(_0x8b1c('0x0'));exports[_0x8b1c('0x1')]=function(_0x3dd41a){return function(_0x2d7fdc){return client[_0x8b1c('0x2')](_0x8b1c('0x3'),{'options':{'raw':![],'attributes':['id',_0x8b1c('0x4'),_0x8b1c('0x5'),_0x8b1c('0x6')],'include':[{'model':_0x8b1c('0x7'),'as':_0x8b1c('0x8'),'attributes':['id',_0x8b1c('0x9'),'operator',_0x8b1c('0xa')]},{'model':_0x8b1c('0x7'),'as':_0x8b1c('0xb'),'attributes':['id',_0x8b1c('0x9'),_0x8b1c('0xc'),_0x8b1c('0xa')]},{'model':_0x8b1c('0xd'),'as':'Actions','attributes':['id',_0x8b1c('0xe'),'data1',_0x8b1c('0xf'),_0x8b1c('0x10'),_0x8b1c('0x11'),'data5',_0x8b1c('0x12'),_0x8b1c('0x13')]}]},'log':_0x8b1c('0x3')});};}; \ No newline at end of file +var _0xa7e1=['GetTrigger','name','AllConditions','field','operator','Condition','value','Actions','action','data2','data3','data4','data6','data7','../client','Request'];(function(_0x771676,_0x3b153b){var _0x2bbe43=function(_0x2ae5c2){while(--_0x2ae5c2){_0x771676['push'](_0x771676['shift']());}};_0x2bbe43(++_0x3b153b);}(_0xa7e1,0x13e));var _0x1a7e=function(_0x43828d,_0x4ec55d){_0x43828d=_0x43828d-0x0;var _0x31814a=_0xa7e1[_0x43828d];return _0x31814a;};'use strict';var client=require(_0x1a7e('0x0'));exports['getTriggers']=function(_0x50dcfe){return function(_0x5299a6){return client[_0x1a7e('0x1')](_0x1a7e('0x2'),{'options':{'raw':![],'attributes':['id',_0x1a7e('0x3'),'channel','status'],'include':[{'model':'Condition','as':_0x1a7e('0x4'),'attributes':['id',_0x1a7e('0x5'),_0x1a7e('0x6'),'value']},{'model':_0x1a7e('0x7'),'as':'AnyConditions','attributes':['id',_0x1a7e('0x5'),_0x1a7e('0x6'),_0x1a7e('0x8')]},{'model':'Action','as':_0x1a7e('0x9'),'attributes':['id',_0x1a7e('0xa'),'data1',_0x1a7e('0xb'),_0x1a7e('0xc'),_0x1a7e('0xd'),'data5',_0x1a7e('0xe'),_0x1a7e('0xf')]}]},'log':_0x1a7e('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 80541c7..dbcaa73 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 _0xfdcb=['Request','GetTrunk','name','../client','getTrunks'];(function(_0x35cc3c,_0x514401){var _0x2ca231=function(_0x5052ce){while(--_0x5052ce){_0x35cc3c['push'](_0x35cc3c['shift']());}};_0x2ca231(++_0x514401);}(_0xfdcb,0x134));var _0xbfdc=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xfdcb[_0x163691];return _0x543ae5;};'use strict';var client=require(_0xbfdc('0x0'));exports[_0xbfdc('0x1')]=function(_0x28d1bb){return function(_0x443da1){return client[_0xbfdc('0x2')](_0xbfdc('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xbfdc('0x4'),'registry','defaultuser']},'log':_0xbfdc('0x3')});};}; \ No newline at end of file +var _0xe07d=['getTrunks','Request','registry','defaultuser','GetTrunk','../client'];(function(_0x20d91b,_0x168dbd){var _0x1940ff=function(_0x4dc8ab){while(--_0x4dc8ab){_0x20d91b['push'](_0x20d91b['shift']());}};_0x1940ff(++_0x168dbd);}(_0xe07d,0x179));var _0xde07=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0xe07d[_0x55c485];return _0x6bb521;};'use strict';var client=require(_0xde07('0x0'));exports[_0xde07('0x1')]=function(_0x497dd8){return function(_0x51ec25){return client[_0xde07('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xde07('0x3'),_0xde07('0x4')]},'log':_0xde07('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 481fbeb..af3aa0c 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2c5b6f,_0xcb883f){var _0x44c49e=function(_0x31c6ae){while(--_0x31c6ae){_0x2c5b6f['push'](_0x2c5b6f['shift']());}};_0x44c49e(++_0xcb883f);}(_0x70e0,0x17b));var _0x070e=function(_0xf661c7,_0x15ef19){_0xf661c7=_0xf661c7-0x0;var _0x323193=_0x70e0[_0xf661c7];return _0x323193;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0xb08d75,_0x2218ae){var _0x207028=function(_0x416ecb){while(--_0x416ecb){_0xb08d75['push'](_0xb08d75['shift']());}};_0x207028(++_0x2218ae);}(_0xedd9,0xfc));var _0x9edd=function(_0x1dfb3c,_0x522aa4){_0x1dfb3c=_0x1dfb3c-0x0;var _0x41ac12=_0xedd9[_0x1dfb3c];return _0x41ac12;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 457a1a1..5549abc 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 _0x9861=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9861,0xd1));var _0x1986=function(_0x1a19b4,_0x43523f){_0x1a19b4=_0x1a19b4-0x0;var _0xe548fb=_0x9861[_0x1a19b4];return _0xe548fb;};'use strict';var client=require('../client');exports[_0x1986('0x0')]=function(_0xb5e90d){return client[_0x1986('0x1')](_0x1986('0x2'),{'body':_0xb5e90d,'log':_0x1986('0x2')});};exports[_0x1986('0x3')]=function(_0x2fdd55,_0xb43e77,_0x44245b){return client[_0x1986('0x1')]('UpdateVoiceAgentReport',{'body':_0x2fdd55,'options':{'where':{'uniqueid':_0xb43e77,'interface':_0x44245b,'agentcomplete':!![]}},'log':_0x1986('0x4')});}; \ No newline at end of file +var _0x6ab1=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x28a421,_0x331de4){var _0x4f560e=function(_0x53b7c5){while(--_0x53b7c5){_0x28a421['push'](_0x28a421['shift']());}};_0x4f560e(++_0x331de4);}(_0x6ab1,0x11d));var _0x16ab=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x6ab1[_0x2ff739];return _0x12dc13;};'use strict';var client=require(_0x16ab('0x0'));exports[_0x16ab('0x1')]=function(_0x51f728){return client[_0x16ab('0x2')]('CreateVoiceAgentReport',{'body':_0x51f728,'log':_0x16ab('0x3')});};exports[_0x16ab('0x4')]=function(_0x26ac46,_0x4a536c,_0x34366b){return client[_0x16ab('0x2')](_0x16ab('0x5'),{'body':_0x26ac46,'options':{'where':{'uniqueid':_0x4a536c,'interface':_0x34366b,'agentcomplete':!![]}},'log':_0x16ab('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 170cbe6..9973649 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 _0x847a=['day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x35282c,_0x7eba5e){var _0x267b6d=function(_0x441ba2){while(--_0x441ba2){_0x35282c['push'](_0x35282c['shift']());}};_0x267b6d(++_0x7eba5e);}(_0x847a,0x137));var _0xa847=function(_0xf0f6fb,_0x1c3ea1){_0xf0f6fb=_0xf0f6fb-0x0;var _0x122bfa=_0x847a[_0xf0f6fb];return _0x122bfa;};'use strict';var moment=require(_0xa847('0x0'));var util=require('util');var _=require(_0xa847('0x1'));var client=require(_0xa847('0x2'));exports[_0xa847('0x3')]=function(_0x357968){return client[_0xa847('0x4')](_0xa847('0x5'),{'body':_['merge'](_0x357968,{'source':_0x357968[_0xa847('0x6')],'destinationcontext':_0x357968[_0xa847('0x7')],'callerid':_0x357968['callerid'],'amaflags':_0xa847('0x8')}),'log':_0xa847('0x5')});};exports[_0xa847('0x9')]=function(){return function(){return client[_0xa847('0x4')](_0xa847('0xa'),{'options':{'where':{'type':[_0xa847('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xa847('0xc'))[_0xa847('0xd')](_0xa847('0xe')),moment()['endOf']('day')[_0xa847('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xa847('0xf'),_0xa847('0x10'),_0xa847('0x11'),_0xa847('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x281d=['../client','create','merge','calleridnum','context','callerid','CreateVoiceCallReport','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','GetVoiceCallReports','moment','lodash'];(function(_0xdc1397,_0x1fb6ec){var _0x5e9421=function(_0x75a28b){while(--_0x75a28b){_0xdc1397['push'](_0xdc1397['shift']());}};_0x5e9421(++_0x1fb6ec);}(_0x281d,0x1de));var _0xd281=function(_0x11cdd8,_0x4fb293){_0x11cdd8=_0x11cdd8-0x0;var _0x301e3f=_0x281d[_0x11cdd8];return _0x301e3f;};'use strict';var moment=require(_0xd281('0x0'));var util=require('util');var _=require(_0xd281('0x1'));var client=require(_0xd281('0x2'));exports[_0xd281('0x3')]=function(_0x5788b7){return client['Request']('CreateVoiceCallReport',{'body':_[_0xd281('0x4')](_0x5788b7,{'source':_0x5788b7[_0xd281('0x5')],'destinationcontext':_0x5788b7[_0xd281('0x6')],'callerid':_0x5788b7[_0xd281('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0xd281('0x8')});};exports[_0xd281('0x9')]=function(){return function(){return client[_0xd281('0xa')](_0xd281('0xb'),{'options':{'where':{'type':[_0xd281('0xc')],'createdAt':{'$between':[moment()[_0xd281('0xd')](_0xd281('0xe'))[_0xd281('0xf')](_0xd281('0x10')),moment()['endOf'](_0xd281('0xe'))[_0xd281('0xf')](_0xd281('0x10'))]}},'attributes':[_0xd281('0x11'),_0xd281('0x12'),'duration','billableseconds']},'log':_0xd281('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3004394..cc3bd17 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 _0x85cf=['../client','create','Request'];(function(_0xa88b45,_0x12160b){var _0x4fdc72=function(_0x5ba09d){while(--_0x5ba09d){_0xa88b45['push'](_0xa88b45['shift']());}};_0x4fdc72(++_0x12160b);}(_0x85cf,0x153));var _0xf85c=function(_0x4ee8be,_0x1c06c6){_0x4ee8be=_0x4ee8be-0x0;var _0x2b6758=_0x85cf[_0x4ee8be];return _0x2b6758;};'use strict';var client=require(_0xf85c('0x0'));exports[_0xf85c('0x1')]=function(_0x533f3f){return client[_0xf85c('0x2')]('CreateVoiceDialReport',{'body':_0x533f3f,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x0b02=['CreateVoiceDialReport','../client','Request'];(function(_0x3ef4fb,_0x17b249){var _0x11722b=function(_0x19c87c){while(--_0x19c87c){_0x3ef4fb['push'](_0x3ef4fb['shift']());}};_0x11722b(++_0x17b249);}(_0x0b02,0x73));var _0x20b0=function(_0x2e469a,_0xb5a321){_0x2e469a=_0x2e469a-0x0;var _0x403fe2=_0x0b02[_0x2e469a];return _0x403fe2;};'use strict';var client=require(_0x20b0('0x0'));exports['create']=function(_0x502dd5){return client[_0x20b0('0x1')](_0x20b0('0x2'),{'body':_0x502dd5,'log':_0x20b0('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f0e4b9c..37e94b0 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 _0x9348=['getVoiceExtensions','Request','GetVoiceExtension','exten','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9348,0x10d));var _0x8934=function(_0x242883,_0x3c8a9d){_0x242883=_0x242883-0x0;var _0x560b46=_0x9348[_0x242883];return _0x560b46;};'use strict';var client=require(_0x8934('0x0'));exports[_0x8934('0x1')]=function(){return function(){return client[_0x8934('0x2')](_0x8934('0x3'),{'options':{'raw':!![],'attributes':['id',_0x8934('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x8934('0x1')});};}; \ No newline at end of file +var _0x4483=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0x3220eb,_0x344adf){var _0x2760d5=function(_0x5dce25){while(--_0x5dce25){_0x3220eb['push'](_0x3220eb['shift']());}};_0x2760d5(++_0x344adf);}(_0x4483,0x1a3));var _0x3448=function(_0x3c3fae,_0x5d6c6d){_0x3c3fae=_0x3c3fae-0x0;var _0xba02b=_0x4483[_0x3c3fae];return _0xba02b;};'use strict';var client=require(_0x3448('0x0'));exports[_0x3448('0x1')]=function(){return function(){return client[_0x3448('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3448('0x3'),_0x3448('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x3448('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 22943ac..f435254 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 _0x0c3b=['dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0c3b,0x10b));var _0xb0c3=function(_0x351909,_0x1c723b){_0x351909=_0x351909-0x0;var _0xb70af9=_0x0c3b[_0x351909];return _0xb70af9;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0xb0c3('0x0')](_0xb0c3('0x1'),{'options':{'raw':![],'attributes':['id',_0xb0c3('0x2'),_0xb0c3('0x3'),_0xb0c3('0x4'),_0xb0c3('0x5'),_0xb0c3('0x6'),_0xb0c3('0x7'),_0xb0c3('0x8'),'dialMethod',_0xb0c3('0x9'),_0xb0c3('0xa'),_0xb0c3('0xb'),_0xb0c3('0xc'),'dialPredictiveOptimizationPercentage',_0xb0c3('0xd'),_0xb0c3('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout',_0xb0c3('0xf'),_0xb0c3('0x10'),_0xb0c3('0x11'),_0xb0c3('0x12'),_0xb0c3('0x13'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xb0c3('0x14'),'dialGlobalMaxRetry',_0xb0c3('0x15'),_0xb0c3('0x16'),_0xb0c3('0x17'),_0xb0c3('0x18'),_0xb0c3('0x19'),_0xb0c3('0x1a'),_0xb0c3('0x1b'),_0xb0c3('0x1c'),_0xb0c3('0x1d'),_0xb0c3('0x1e'),_0xb0c3('0x1f'),_0xb0c3('0x20'),_0xb0c3('0x21'),_0xb0c3('0x22'),_0xb0c3('0x23'),_0xb0c3('0x24'),'dialRecallInQueue',_0xb0c3('0x25'),_0xb0c3('0x26'),_0xb0c3('0x27'),_0xb0c3('0x28'),_0xb0c3('0x6'),_0xb0c3('0x29'),'dialRandomLastDigitCallerIdNumber',_0xb0c3('0x2a'),_0xb0c3('0x2b'),'dialNoSuchNumberRetryFrequency',_0xb0c3('0x2c'),_0xb0c3('0x2d'),_0xb0c3('0x2e'),_0xb0c3('0x2f'),_0xb0c3('0x30'),_0xb0c3('0x31'),_0xb0c3('0x32'),_0xb0c3('0x33'),_0xb0c3('0x34'),'dialPredictiveIntervalMaxThreshold',_0xb0c3('0x35'),_0xb0c3('0x36'),_0xb0c3('0x37')],'include':[{'model':'Trunk','as':_0xb0c3('0x38'),'attributes':['id',_0xb0c3('0x2'),_0xb0c3('0x39'),_0xb0c3('0x3a')]},{'model':_0xb0c3('0x3b'),'as':_0xb0c3('0x3c'),'attributes':['id',_0xb0c3('0x2')]},{'model':_0xb0c3('0x38'),'as':'TrunkBackup','attributes':['id',_0xb0c3('0x2'),_0xb0c3('0x39'),'active']},{'model':_0xb0c3('0x3d'),'as':_0xb0c3('0x3d'),'attributes':['id',_0xb0c3('0x2')],'include':[{'model':_0xb0c3('0x3d'),'as':_0xb0c3('0x3e'),'attributes':['id',_0xb0c3('0x2'),'interval']}]}]},'log':_0xb0c3('0x3f')});};}; \ No newline at end of file +var _0xaa77=['dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','Interval','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialCongestionMaxRetry','dialBusyMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition'];(function(_0x273613,_0x33c414){var _0x416e5f=function(_0x4b68bf){while(--_0x4b68bf){_0x273613['push'](_0x273613['shift']());}};_0x416e5f(++_0x33c414);}(_0xaa77,0xb0));var _0x7aa7=function(_0x5b83a9,_0x38cc84){_0x5b83a9=_0x5b83a9-0x0;var _0x660790=_0xaa77[_0x5b83a9];return _0x660790;};'use strict';var client=require(_0x7aa7('0x0'));exports[_0x7aa7('0x1')]=function(){return function(){return client['Request'](_0x7aa7('0x2'),{'options':{'raw':![],'attributes':['id',_0x7aa7('0x3'),_0x7aa7('0x4'),_0x7aa7('0x5'),_0x7aa7('0x6'),_0x7aa7('0x7'),'type',_0x7aa7('0x8'),'dialMethod',_0x7aa7('0x9'),'dialLimitQueue',_0x7aa7('0xa'),'dialPredictiveOptimization',_0x7aa7('0xb'),_0x7aa7('0xc'),_0x7aa7('0xd'),_0x7aa7('0xe'),'dialOriginateTimeout',_0x7aa7('0xf'),'dialQueueTimeout','dialQueueProject',_0x7aa7('0x10'),'dialCongestionRetryFrequency',_0x7aa7('0x11'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x7aa7('0x12'),'dialGlobalInterval',_0x7aa7('0x13'),_0x7aa7('0x14'),_0x7aa7('0x15'),_0x7aa7('0x16'),_0x7aa7('0x17'),_0x7aa7('0x18'),_0x7aa7('0x19'),_0x7aa7('0x1a'),_0x7aa7('0x1b'),_0x7aa7('0x1c'),'dialAMDSilenceThreshold',_0x7aa7('0x1d'),_0x7aa7('0x1e'),'dialRecallMeTimeout',_0x7aa7('0x1f'),'dialOrderByScheduledAt',_0x7aa7('0x20'),_0x7aa7('0x21'),_0x7aa7('0x22'),'monitor_format',_0x7aa7('0x23'),_0x7aa7('0x24'),_0x7aa7('0x25'),'dialNoSuchNumberMaxRetry',_0x7aa7('0x26'),_0x7aa7('0x27'),_0x7aa7('0x28'),_0x7aa7('0x29'),_0x7aa7('0x2a'),_0x7aa7('0x2b'),_0x7aa7('0x2c'),_0x7aa7('0x2d'),_0x7aa7('0x2e'),_0x7aa7('0x2f'),_0x7aa7('0x30'),'dialPredictiveIntervalMinThreshold',_0x7aa7('0x31'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x7aa7('0x32'),'as':_0x7aa7('0x32'),'attributes':['id','name',_0x7aa7('0x33'),_0x7aa7('0x34')]},{'model':_0x7aa7('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0x7aa7('0x3')]},{'model':_0x7aa7('0x32'),'as':'TrunkBackup','attributes':['id',_0x7aa7('0x3'),_0x7aa7('0x33'),_0x7aa7('0x34')]},{'model':_0x7aa7('0x36'),'as':_0x7aa7('0x36'),'attributes':['id','name'],'include':[{'model':_0x7aa7('0x36'),'as':'Intervals','attributes':['id',_0x7aa7('0x3'),_0x7aa7('0x37')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1cdb669..5f799be 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(_0x35752a,_0x20a551){var _0x333bd4=function(_0x4c1554){while(--_0x4c1554){_0x35752a['push'](_0x35752a['shift']());}};_0x333bd4(++_0x20a551);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x203ea0,_0x549543){var _0x1737bc=function(_0x118aac){while(--_0x118aac){_0x203ea0['push'](_0x203ea0['shift']());}};_0x1737bc(++_0x549543);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 173c29c..f6aca33 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 _0xf434=['getVoiceQueueRtPauses','Request','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf434,0x10d));var _0x4f43=function(_0x1ef708,_0x15ef44){_0x1ef708=_0x1ef708-0x0;var _0x517c62=_0xf434[_0x1ef708];return _0x517c62;};'use strict';var client=require(_0x4f43('0x0'));exports[_0x4f43('0x1')]=function(_0x59574f){return function(){return client[_0x4f43('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x59574f,'paused':!![]},'raw':!![]},'log':_0x4f43('0x1')});};}; \ No newline at end of file +var _0x1596=['GetVoiceQueueRtPauses','../client'];(function(_0x3bce39,_0x3edeff){var _0x424c8f=function(_0x2d31ea){while(--_0x2d31ea){_0x3bce39['push'](_0x3bce39['shift']());}};_0x424c8f(++_0x3edeff);}(_0x1596,0xa1));var _0x6159=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1596[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x6159('0x0'));exports['getVoiceQueueRtPauses']=function(_0x359929){return function(){return client['Request'](_0x6159('0x1'),{'options':{'where':{'VoiceQueueId':_0x359929,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 58c2dd2..6debc0f 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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2e6475,_0x51725e){var _0x330757=function(_0x259257){while(--_0x259257){_0x2e6475['push'](_0x2e6475['shift']());}};_0x330757(++_0x51725e);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x47e850,_0x26429f){var _0x4e9a25=function(_0x46aca8){while(--_0x46aca8){_0x47e850['push'](_0x47e850['shift']());}};_0x4e9a25(++_0x26429f);}(_0x7a54,0x106));var _0x47a5=function(_0x47983f,_0x211c70){_0x47983f=_0x47983f-0x0;var _0x4f14f0=_0x7a54[_0x47983f];return _0x4f14f0;};'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 dbf84ea..41b94c9 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 _0x689c=['attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x689c,0x1b3));var _0xc689=function(_0x2157de,_0x10347c){_0x2157de=_0x2157de-0x0;var _0x35f6e5=_0x689c[_0x2157de];return _0x35f6e5;};'use strict';var client=require(_0xc689('0x0'));exports[_0xc689('0x1')]={};exports[_0xc689('0x2')]=function(_0x303876){return client[_0xc689('0x3')](_0xc689('0x4'),{'body':{'result':_0x303876[_0xc689('0x5')],'transfererchannel':_0x303876[_0xc689('0x6')],'transferercalleridnum':_0x303876[_0xc689('0x7')],'transferercalleridname':_0x303876[_0xc689('0x8')],'transfererconnectedlinenum':_0x303876[_0xc689('0x9')],'transfererconnectedlinename':_0x303876['transfererconnectedlinename'],'transfereraccountcode':_0x303876[_0xc689('0xa')],'transferercontext':_0x303876['transferercontext'],'transfererexten':_0x303876[_0xc689('0xb')],'transfererlinkedid':_0x303876[_0xc689('0xc')],'transfereechannel':_0x303876[_0xc689('0xd')],'transfereecalleridnum':_0x303876[_0xc689('0xe')],'transfereecalleridname':_0x303876[_0xc689('0xf')],'transfereeconnectedlinenum':_0x303876[_0xc689('0x10')],'transfereeconnectedlinename':_0x303876[_0xc689('0x11')],'transfereeaccountcode':_0x303876[_0xc689('0x12')],'transfereecontext':_0x303876[_0xc689('0x13')],'transfereeexten':_0x303876[_0xc689('0x14')],'transfereelinkedid':_0x303876[_0xc689('0x15')],'isexternal':_0x303876[_0xc689('0x16')],'context':_0x303876[_0xc689('0x17')],'extension':_0x303876[_0xc689('0x18')],'type':'blind'},'log':_0xc689('0x4')});};exports[_0xc689('0x19')]=function(_0x10d8c3){return client[_0xc689('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x10d8c3['result'],'transfererchannel':_0x10d8c3[_0xc689('0x1a')],'transferercalleridnum':_0x10d8c3[_0xc689('0x1b')],'transferercalleridname':_0x10d8c3[_0xc689('0x1c')],'transfererconnectedlinenum':_0x10d8c3[_0xc689('0x1d')],'transfererconnectedlinename':_0x10d8c3[_0xc689('0x1e')],'transfereraccountcode':_0x10d8c3[_0xc689('0x1f')],'transferercontext':_0x10d8c3[_0xc689('0x20')],'transfererexten':_0x10d8c3[_0xc689('0x21')],'transfererlinkedid':_0x10d8c3['origtransfererlinkedid'],'transfereechannel':_0x10d8c3[_0xc689('0x22')],'transfereecalleridnum':_0x10d8c3[_0xc689('0x23')],'transfereecalleridname':_0x10d8c3[_0xc689('0x24')],'transfereeconnectedlinenum':_0x10d8c3[_0xc689('0x25')],'transfereeconnectedlinename':_0x10d8c3[_0xc689('0x26')],'transfereeaccountcode':_0x10d8c3[_0xc689('0x27')],'transfereecontext':_0x10d8c3[_0xc689('0x28')],'transfereeexten':_0x10d8c3[_0xc689('0x29')],'transfereelinkedid':_0x10d8c3[_0xc689('0x2a')],'isexternal':_0x10d8c3[_0xc689('0x16')],'context':_0x10d8c3[_0xc689('0x2b')],'extension':_0x10d8c3[_0xc689('0x2c')],'type':_0xc689('0x2d')},'log':_0xc689('0x4')});}; \ No newline at end of file +var _0x7920=['transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','blindTransfer','Request','CreateVoiceTransferReport','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7920,0x188));var _0x0792=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x7920[_0x36eaaa];return _0x461349;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x0792('0x0')]=function(_0x31bc20){return client[_0x0792('0x1')](_0x0792('0x2'),{'body':{'result':_0x31bc20[_0x0792('0x3')],'transfererchannel':_0x31bc20[_0x0792('0x4')],'transferercalleridnum':_0x31bc20[_0x0792('0x5')],'transferercalleridname':_0x31bc20[_0x0792('0x6')],'transfererconnectedlinenum':_0x31bc20['transfererconnectedlinenum'],'transfererconnectedlinename':_0x31bc20['transfererconnectedlinename'],'transfereraccountcode':_0x31bc20[_0x0792('0x7')],'transferercontext':_0x31bc20['transferercontext'],'transfererexten':_0x31bc20[_0x0792('0x8')],'transfererlinkedid':_0x31bc20[_0x0792('0x9')],'transfereechannel':_0x31bc20['transfereechannel'],'transfereecalleridnum':_0x31bc20[_0x0792('0xa')],'transfereecalleridname':_0x31bc20[_0x0792('0xb')],'transfereeconnectedlinenum':_0x31bc20[_0x0792('0xc')],'transfereeconnectedlinename':_0x31bc20[_0x0792('0xd')],'transfereeaccountcode':_0x31bc20[_0x0792('0xe')],'transfereecontext':_0x31bc20['transfereecontext'],'transfereeexten':_0x31bc20[_0x0792('0xf')],'transfereelinkedid':_0x31bc20[_0x0792('0x10')],'isexternal':_0x31bc20[_0x0792('0x11')],'context':_0x31bc20[_0x0792('0x12')],'extension':_0x31bc20['extension'],'type':_0x0792('0x13')},'log':_0x0792('0x2')});};exports[_0x0792('0x14')]=function(_0x4b6a33){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4b6a33[_0x0792('0x3')],'transfererchannel':_0x4b6a33[_0x0792('0x15')],'transferercalleridnum':_0x4b6a33[_0x0792('0x16')],'transferercalleridname':_0x4b6a33['origtransferercalleridname'],'transfererconnectedlinenum':_0x4b6a33['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4b6a33['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4b6a33[_0x0792('0x17')],'transferercontext':_0x4b6a33[_0x0792('0x18')],'transfererexten':_0x4b6a33[_0x0792('0x19')],'transfererlinkedid':_0x4b6a33['origtransfererlinkedid'],'transfereechannel':_0x4b6a33[_0x0792('0x1a')],'transfereecalleridnum':_0x4b6a33['transfertargetcalleridnum'],'transfereecalleridname':_0x4b6a33[_0x0792('0x1b')],'transfereeconnectedlinenum':_0x4b6a33[_0x0792('0x1c')],'transfereeconnectedlinename':_0x4b6a33[_0x0792('0x1d')],'transfereeaccountcode':_0x4b6a33[_0x0792('0x1e')],'transfereecontext':_0x4b6a33[_0x0792('0x1f')],'transfereeexten':_0x4b6a33[_0x0792('0x20')],'transfereelinkedid':_0x4b6a33[_0x0792('0x21')],'isexternal':_0x4b6a33[_0x0792('0x11')],'context':_0x4b6a33[_0x0792('0x22')],'extension':_0x4b6a33['origtransfererexten'],'type':_0x0792('0x23')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3c81311..57c65b9 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 _0x9fd4=['updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','reload','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','map','channel','%s.%s','uniqueid','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','Redirect','exten','context','trunks','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','listen','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','moment','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','format','%s/%s','name','timers','timer','updateAcw','agents'];(function(_0x3f7844,_0x145dd1){var _0x8a5a0b=function(_0x5ede7a){while(--_0x5ede7a){_0x3f7844['push'](_0x3f7844['shift']());}};_0x8a5a0b(++_0x145dd1);}(_0x9fd4,0x16c));var _0x49fd=function(_0x4ff2a7,_0x46fbd1){_0x4ff2a7=_0x4ff2a7-0x0;var _0x562f6e=_0x9fd4[_0x4ff2a7];return _0x562f6e;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var jayson=require(_0x49fd('0x2'));var schema=require(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var config=require(_0x49fd('0x5'));var properties=require(_0x49fd('0x6'));var ami=require(_0x49fd('0x7'));var VoiceQueueSummary=require(_0x49fd('0x8'));exports['listen']=function(_0x481f6a,_0x3b4b46,_0x42fdc7){return new Promise(function(_0x1bc16e,_0x9353cd){var _0x48b999={'QueuePause':function(_0x14bb94){return new Promise(function(_0x461ac1){var _0x36f605=util[_0x49fd('0x9')](_0x49fd('0xa'),'SIP',_0x14bb94[_0x49fd('0xb')]);if(_0x481f6a[_0x49fd('0xc')]&&_0x481f6a[_0x49fd('0xc')][_0x36f605]&&_0x481f6a[_0x49fd('0xc')][_0x36f605][_0x49fd('0xd')]){_0x481f6a[_0x49fd('0xc')][_0x36f605][_0x49fd('0xe')]();}if(_0x481f6a['agents'][_0x36f605]){_0x481f6a[_0x49fd('0xf')][_0x36f605][_0x49fd('0x10')]({'statePause':_0x14bb94[_0x49fd('0x11')]?!![]:![]});}_0x461ac1({'code':0xc8,'message':_0x49fd('0x12')});});},'Reload':function(_0x15dabd){var _0x206bd8=this;return new Promise(function(_0x26f2c1,_0x3fa518){if(ami[_0x49fd('0x13')]()==![]){return _0x3fa518(_0x206bd8[_0x49fd('0x14')](0x1f4,[config[_0x49fd('0x15')]['ip'],config[_0x49fd('0x15')][_0x49fd('0x16')],_0x49fd('0x17')][_0x49fd('0x18')]('\x20')));}_0x15dabd=_[_0x49fd('0x19')](_0x15dabd,_[_0x49fd('0x1a')](properties[_0x49fd('0x1b')][_0x49fd('0x1c')]));_0x15dabd[_0x49fd('0x1d')]=_0x49fd('0x1e');return ami[_0x49fd('0x1f')](_0x15dabd)[_0x49fd('0x20')](function(_0x475eee){_0x26f2c1({'code':0xc8,'message':_0x475eee[_0x49fd('0x21')]});})[_0x49fd('0x22')](function(_0x598793){_0x3fa518(_0x206bd8[_0x49fd('0x14')](0x1f5,_0x598793[_0x49fd('0x21')]));});});},'Command':function(_0x59a407){var _0x5c323a=this;return new Promise(function(_0x449c9a,_0x53cbd1){if(ami[_0x49fd('0x13')]()==![]){return _0x53cbd1(_0x5c323a[_0x49fd('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x49fd('0x15')][_0x49fd('0x16')],'ami\x20disconnected'][_0x49fd('0x18')]('\x20')));}_0x59a407=_[_0x49fd('0x19')](_0x59a407,_0x49fd('0x23'));_0x59a407[_0x49fd('0x1d')]=_0x49fd('0x24');return ami[_0x49fd('0x1f')](_0x59a407)['then'](function(_0x46019d){_0x449c9a({'code':0xc8,'message':_0x46019d[_0x49fd('0x25')]});})[_0x49fd('0x22')](function(_0x4bf811){_0x53cbd1(_0x5c323a[_0x49fd('0x14')](0x1f5,_0x4bf811[_0x49fd('0x21')]));});});},'VoiceQueues':function(){return new Promise(function(_0x146d55){var _0x4bff4c=[];for(var _0x597161 in _0x481f6a['voiceQueues']){if(_0x481f6a[_0x49fd('0x26')][_0x49fd('0x27')](_0x597161)){var _0x4ec190=_0x481f6a[_0x49fd('0x26')][_0x597161];var _0x9587b9=new VoiceQueueSummary(_0x4ec190);_0x4bff4c[_0x49fd('0x28')](_0x9587b9);}}_0x146d55({'count':_0x4bff4c[_0x49fd('0x29')],'rows':_0x4bff4c});});},'UpdateVoiceQueue':function(_0x9afc1c){return new Promise(function(_0x54c8bb,_0x2b2710){var _0x52b35d=_[_0x49fd('0x2a')](_0x481f6a[_0x49fd('0x26')],{'id':parseInt(_0x9afc1c['id'])});var _0x54acb5=_[_0x49fd('0x2b')](_0x9afc1c,['id']);if(_0x52b35d){for(var _0x2c8568 in _0x54acb5){if(typeof _0x54acb5[_0x2c8568]!==_0x49fd('0x2c')&&typeof _0x52b35d[_0x2c8568]!==_0x49fd('0x2c')){_0x52b35d[_0x2c8568]=_0x54acb5[_0x2c8568];}}_0x54c8bb(_0x52b35d);}else{_0x2b2710();}});},'VoiceChannels':function(){return new Promise(function(_0x404bc1){var _0x12dc3d=_[_0x49fd('0x2d')](_0x481f6a[_0x49fd('0x2e')]);_0x404bc1({'count':_0x12dc3d['length'],'rows':_0x12dc3d});});},'VoiceChannelMixMonitor':function(_0x42181b){var _0x4869fc=this;return new Promise(function(_0x1952d0,_0x4ca49c){if(ami[_0x49fd('0x13')]()==![]){return _0x4ca49c(_0x4869fc[_0x49fd('0x14')](0x1f4,[config[_0x49fd('0x15')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x49fd('0x18')]('\x20')));}var _0x831002=schema(properties['voicechannel'])[_0x49fd('0x3')](_0x42181b);if(_0x831002['length']>0x0){return _0x4ca49c(_0x4869fc['error'](0x1f4,_[_0x49fd('0x2f')](_0x831002,_0x49fd('0x21'))[_0x49fd('0x18')](',\x20')));}var _0x373f1f=_[_0x49fd('0x2a')](_0x481f6a['channels'],{'uniqueid':_0x42181b['uniqueid']});if(_0x373f1f&&_0x373f1f[_0x49fd('0x30')]){var _0x13d03b=util[_0x49fd('0x9')](_0x49fd('0x31'),_0x42181b['filename']||_0x42181b[_0x49fd('0x32')],_0x42181b[_0x49fd('0x9')]||_0x49fd('0x33'));return ami[_0x49fd('0x1f')]({'action':_0x49fd('0x34'),'channel':_0x373f1f[_0x49fd('0x30')],'file':_0x13d03b,'options':_0x49fd('0x35')})[_0x49fd('0x20')](function(_0x98571b){var _0x89f196=_[_0x49fd('0x2a')](_0x373f1f['monitors'],{'filename':_0x49fd('0x36')+_0x13d03b[_0x49fd('0x37')]()});if(_[_0x49fd('0x38')](_0x89f196)){_0x373f1f[_0x49fd('0x39')][_0x49fd('0x28')]({'filename':_0x49fd('0x36')+_0x13d03b[_0x49fd('0x37')](),'createdAt':moment()[_0x49fd('0x9')](_0x49fd('0x3a')),'mixmonitorid':_0x98571b['mixmonitorid'],'status':_0x49fd('0x3b')});}else{_0x89f196['mixmonitorid']=_0x98571b[_0x49fd('0x3c')];_0x89f196[_0x49fd('0x3d')]='rec';}_0x1952d0({'code':0xc8,'message':[_0x42181b[_0x49fd('0x32')],_0x49fd('0x3e'),_0x98571b['mixmonitorid']][_0x49fd('0x18')]('\x20'),'mixmonitorid':_0x98571b['mixmonitorid']});})['catch'](function(_0x5f56f8){_0x4ca49c(_0x4869fc[_0x49fd('0x14')](0x1f5,[_0x42181b[_0x49fd('0x32')],_0x5f56f8[_0x49fd('0x21')][_0x49fd('0x37')]()]['join']('\x20')));});}else{return _0x4ca49c(_0x4869fc[_0x49fd('0x14')](0x1f5,_0x49fd('0x3f')));}});},'VoiceChannelStopMixMonitor':function(_0x42c130){var _0x42c537=this;return new Promise(function(_0x115c5a,_0x28d7ea){if(ami[_0x49fd('0x13')]()==![]){return _0x28d7ea(_0x42c537[_0x49fd('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x49fd('0x15')][_0x49fd('0x16')],'ami\x20disconnected'][_0x49fd('0x18')]('\x20')));}var _0x237050=schema(properties['voicechannel'])[_0x49fd('0x3')](_0x42c130);if(_0x237050['length']>0x0){return _0x28d7ea(_0x42c537[_0x49fd('0x14')](0x1f4,_[_0x49fd('0x2f')](_0x237050,_0x49fd('0x21'))[_0x49fd('0x18')](',\x20')));}var _0x4f6902=_['find'](_0x481f6a[_0x49fd('0x2e')],{'uniqueid':_0x42c130['uniqueid']});if(_0x4f6902){return Promise[_0x49fd('0x40')]()[_0x49fd('0x20')](function(){if(_0x4f6902[_0x49fd('0x30')]){return ami[_0x49fd('0x1f')]({'action':'StopMixMonitor','channel':_0x4f6902[_0x49fd('0x30')],'mixmonitorid':_0x42c130[_0x49fd('0x3c')]})[_0x49fd('0x22')](function(){});}})[_0x49fd('0x20')](function(){if(_0x4f6902[_0x49fd('0x41')]){return ami[_0x49fd('0x1f')]({'action':_0x49fd('0x42'),'channel':_0x4f6902[_0x49fd('0x41')],'mixmonitorid':_0x42c130[_0x49fd('0x3c')]})[_0x49fd('0x22')](function(){});}})[_0x49fd('0x20')](function(){var _0x312344=_[_0x49fd('0x2a')](_0x4f6902[_0x49fd('0x39')],{'mixmonitorid':_0x42c130['mixmonitorid']});if(_0x312344){_0x312344['status']=_0x49fd('0x43');}})[_0x49fd('0x20')](function(){var _0x42287e=util[_0x49fd('0x9')]('%s.%s',_0x42c130[_0x49fd('0x44')]||_0x42c130[_0x49fd('0x32')],_0x42c130['format']||_0x49fd('0x33'));var _0x270360=_[_0x49fd('0x2a')](_0x4f6902[_0x49fd('0x39')],{'filename':_0x49fd('0x36')+_0x42287e[_0x49fd('0x37')]()});if(_0x270360){_0x270360[_0x49fd('0x3d')]=_0x49fd('0x43');}})[_0x49fd('0x20')](function(){_0x115c5a({'code':0xc8,'message':[_0x42c130[_0x49fd('0x32')],_0x49fd('0x45')]['join']('\x20')});})[_0x49fd('0x22')](function(_0x3a4677){_0x28d7ea(_0x42c537[_0x49fd('0x14')](0x1f5,[_0x42c130[_0x49fd('0x32')],_0x3a4677[_0x49fd('0x21')][_0x49fd('0x37')]()]['join']('\x20')));});}else{return _0x28d7ea(_0x42c537['error'](0x1f5,_0x49fd('0x3f')));}});},'VoiceQueuesChannels':function(_0x765bca){var _0x3f11d4=this;return new Promise(function(_0x5c34c0){var _0x31783f=_[_0x49fd('0x2d')](_0x481f6a['queueChannels']);var _0x501a05={'count':_0x31783f['length'],'rows':_0x31783f};if(_0x765bca&&_0x765bca[_0x49fd('0x46')]){if(!['inbound','outbound']['includes'](_0x765bca[_0x49fd('0x46')])){return _0x9353cd(_0x3f11d4[_0x49fd('0x14')](0x190,_0x49fd('0x47')));}var _0x2df12b=_[_0x49fd('0x48')](_0x31783f,function(_0x37e47d){return _0x37e47d[_0x49fd('0x46')]===_0x765bca[_0x49fd('0x46')];});_0x501a05[_0x49fd('0x49')]=_0x2df12b[_0x49fd('0x29')];_0x501a05['rows']=_0x2df12b;}_0x5c34c0(_0x501a05);});},'VoiceQueuesChannel':function(_0x444a0e){var _0x202a86=this;return new Promise(function(_0x1560c6,_0x3deda9){var _0x7e201c=schema(properties[_0x49fd('0x4a')])['validate'](_0x444a0e);if(_0x7e201c[_0x49fd('0x29')]>0x0){return _0x3deda9(_0x202a86[_0x49fd('0x14')](0x1f4,_['map'](_0x7e201c,'message')[_0x49fd('0x18')](',\x20')));}var _0x52c0b9=_[_0x49fd('0x2a')](_0x481f6a['queueChannels'],{'uniqueid':_0x444a0e[_0x49fd('0x32')]});if(_0x52c0b9){_0x1560c6(_0x52c0b9);}else{return _0x3deda9(_0x202a86['error'](0x1f5,_0x49fd('0x3f')));}});},'VoiceQueuesChannelHangup':function(_0x3e5609){var _0x4fe873=this;return new Promise(function(_0x2e4f29,_0xc34aed){if(ami[_0x49fd('0x13')]()==![]){return _0xc34aed(_0x4fe873[_0x49fd('0x14')](0x1f4,[config[_0x49fd('0x15')]['ip'],config[_0x49fd('0x15')][_0x49fd('0x16')],_0x49fd('0x17')]['join']('\x20')));}var _0x1428b3=schema(properties[_0x49fd('0x4b')])[_0x49fd('0x3')](_0x3e5609);if(_0x1428b3['length']>0x0){return _0xc34aed(_0x4fe873[_0x49fd('0x14')](0x1f4,_[_0x49fd('0x2f')](_0x1428b3,_0x49fd('0x21'))[_0x49fd('0x18')](',\x20')));}var _0x13e752=_[_0x49fd('0x2a')](_0x481f6a[_0x49fd('0x4c')],{'uniqueid':_0x3e5609[_0x49fd('0x32')]});if(_0x13e752&&_0x13e752[_0x49fd('0x30')]){return ami['Action']({'action':_0x49fd('0x4d'),'channel':_0x13e752[_0x49fd('0x30')]})['then'](function(_0x24b65e){_0x2e4f29({'code':0xc8,'message':[_0x3e5609[_0x49fd('0x32')],_0x24b65e['message']['toLowerCase']()]['join']('\x20')});})[_0x49fd('0x22')](function(_0x25cba9){_0xc34aed(_0x4fe873[_0x49fd('0x14')](0x1f5,[_0x3e5609[_0x49fd('0x32')],_0x25cba9[_0x49fd('0x21')]['toLowerCase']()][_0x49fd('0x18')]('\x20')));});}else{return _0xc34aed(_0x4fe873['error'](0x1f5,_0x49fd('0x3f')));}});},'VoiceQueuesChannelRedirect':function(_0x4eec73){var _0x1e5279=this;return new Promise(function(_0x1a8da2,_0x234e2a){if(ami[_0x49fd('0x13')]()==![]){return _0x234e2a(_0x1e5279['error'](0x1f4,[config[_0x49fd('0x15')]['ip'],config[_0x49fd('0x15')]['username'],_0x49fd('0x17')][_0x49fd('0x18')]('\x20')));}var _0xc3cddd=schema(properties['voicequeuechannelredirect'])[_0x49fd('0x3')](_0x4eec73);if(_0xc3cddd[_0x49fd('0x29')]>0x0){return _0x234e2a(_0x1e5279[_0x49fd('0x14')](0x1f4,_[_0x49fd('0x2f')](_0xc3cddd,_0x49fd('0x21'))[_0x49fd('0x18')](',\x20')));}var _0x59281f=_['find'](_0x481f6a[_0x49fd('0x4c')],{'uniqueid':_0x4eec73[_0x49fd('0x32')]});if(_0x59281f&&_0x59281f[_0x49fd('0x30')]){return ami[_0x49fd('0x1f')]({'action':_0x49fd('0x4e'),'channel':_0x59281f[_0x49fd('0x30')],'exten':_0x4eec73[_0x49fd('0x4f')],'context':_0x4eec73[_0x49fd('0x50')]||_0x59281f[_0x49fd('0x50')],'priority':0x1})[_0x49fd('0x20')](function(_0x39164b){_0x1a8da2({'code':0xc8,'message':[_0x4eec73[_0x49fd('0x32')],_0x39164b[_0x49fd('0x21')]['toLowerCase']()][_0x49fd('0x18')]('\x20')});})[_0x49fd('0x22')](function(_0x365bc3){_0x234e2a(_0x1e5279['error'](0x1f5,[_0x4eec73['uniqueid'],_0x365bc3[_0x49fd('0x21')][_0x49fd('0x37')]()][_0x49fd('0x18')]('\x20')));});}else{return _0x234e2a(_0x1e5279['error'](0x1f5,_0x49fd('0x3f')));}});},'Agents':function(_0x161767){return new Promise(function(_0x162b84){var _0x3ce72c=_[_0x49fd('0x2d')](_0x481f6a[_0x49fd('0xf')]);if(_0x161767&&_0x161767['id']){var _0x4169e9=_['find'](_0x3ce72c,function(_0x58eecf){return _0x58eecf['id']===_0x161767['id'];});_0x162b84(_0x4169e9);}else{_0x162b84({'count':_0x3ce72c[_0x49fd('0x29')],'rows':_0x3ce72c});}});},'Telephones':function(){return new Promise(function(_0x53185f){var _0x3b94e1=_['values'](_0x481f6a['telephones']);_0x53185f({'count':_0x3b94e1['length'],'rows':_0x3b94e1});});},'Trunks':function(){return new Promise(function(_0x240616){var _0x355c5e=_['values'](_0x481f6a[_0x49fd('0x51')]);_0x240616({'count':_0x355c5e[_0x49fd('0x29')],'rows':_0x355c5e});});},'OutboundChannels':function(){return new Promise(function(_0x4c3a12){var _0x67f0f5=_[_0x49fd('0x2d')](_0x481f6a['outboundChannels']);_0x4c3a12({'count':_0x67f0f5[_0x49fd('0x29')],'rows':_0x67f0f5});});},'Outbound':function(){return new Promise(function(_0x50d846){_0x50d846(_0x481f6a[_0x49fd('0x52')]);});},'Campaigns':function(){return new Promise(function(_0x148ff2){var _0x52ad1c=_[_0x49fd('0x2d')](_0x481f6a[_0x49fd('0x53')]);_0x148ff2({'count':_0x52ad1c['length'],'rows':_0x52ad1c});});},'VoiceQueuesPreview':function(_0x219152){var _0x12a2f8=this;return new Promise(function(_0x2e4f40,_0x194ded){_0x3b4b46[_0x49fd('0x54')](_0x219152['id'])[_0x49fd('0x20')](function(_0x1ffd5f){_0x2e4f40({'code':0xc8,'message':_0x1ffd5f[_0x49fd('0x21')]});})['catch'](function(_0x4cdc4c){_0x194ded(_0x12a2f8[_0x49fd('0x14')](0x1f4,_0x4cdc4c[_0x49fd('0x21')]));});});},'EventManager':function(_0x555a87){var _0x2ca980=this;return new Promise(function(_0xb42ebc,_0x5a2794){if(!_0x555a87[_0x49fd('0x55')]){return _0x5a2794(_0x2ca980[_0x49fd('0x14')](0x1f4,_0x49fd('0x56')));}ami[_0x49fd('0x57')]('custom:'+_0x555a87[_0x49fd('0x55')],_0x555a87[_0x49fd('0x21')]);_0xb42ebc({'code':0xc8,'message':_0x555a87});});},'FaxAccounts':function(){return new Promise(function(_0x1bf4b8){var _0x2f0e97=_[_0x49fd('0x2d')](_0x481f6a[_0x49fd('0x58')]);_0x1bf4b8({'count':_0x2f0e97[_0x49fd('0x29')],'rows':_0x2f0e97});});},'SendFax':function(_0x545740){var _0x1d04d5=this;return new Promise(function(_0x31dec5,_0x3c86dc){_0x42fdc7[_0x49fd('0x59')](_0x545740)[_0x49fd('0x20')](function(_0x3166e5){_0x31dec5({'code':0xc8,'message':_0x3166e5[_0x49fd('0x21')]});})[_0x49fd('0x22')](function(_0xe96b86){_0x3c86dc(_0x1d04d5[_0x49fd('0x14')](0x1f4,_0xe96b86[_0x49fd('0x21')]));});});},'CheckAfterSend':function(_0x40c089){var _0x23a779=this;return new Promise(function(_0x3c96e8,_0x14fcf7){_0x42fdc7[_0x49fd('0x5a')](_0x40c089)[_0x49fd('0x20')](function(_0xf1aee0){_0x3c96e8({'code':0xc8,'message':_0xf1aee0[_0x49fd('0x21')]});})[_0x49fd('0x22')](function(_0x57aeb8){_0x14fcf7(_0x23a779[_0x49fd('0x14')](0x1f4,_0x57aeb8['message']));});});}};var _0x181f12=jayson[_0x49fd('0x5b')](_0x48b999)['http']();_0x181f12['on']('error',function(_0x4138a8){return _0x9353cd(_0x4138a8);});_0x181f12[_0x49fd('0x5c')](0x232a,_0x49fd('0x5d'),function(){console['log'](_0x49fd('0x5e'),0x232a);return _0x1bc16e('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x950a=['../ami','../model/voiceQueueSummary','format','%s/%s','SIP','name','timer','updateAcw','agents','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','reload','module','Reload','Action','then','message','catch','pick','action','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','StopMixMonitor','destinationchannel','stop','%s.%s','filename','/var/spool/asterisk/monitor/','StopMixMonitor\x20Success','queueChannels','inbound','outbound','includes','type','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties'];(function(_0x34412f,_0x116bea){var _0x4b4b5a=function(_0x56fc5b){while(--_0x56fc5b){_0x34412f['push'](_0x34412f['shift']());}};_0x4b4b5a(++_0x116bea);}(_0x950a,0x111));var _0xa950=function(_0x456cba,_0x67d319){_0x456cba=_0x456cba-0x0;var _0x2dc091=_0x950a[_0x456cba];return _0x2dc091;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var jayson=require(_0xa950('0x2'));var schema=require(_0xa950('0x3'));var moment=require('moment');var config=require(_0xa950('0x4'));var properties=require(_0xa950('0x5'));var ami=require(_0xa950('0x6'));var VoiceQueueSummary=require(_0xa950('0x7'));exports['listen']=function(_0x1cd8ec,_0x46f86d,_0x512c0e){return new Promise(function(_0x14b4ac,_0x3645b6){var _0x5ba2da={'QueuePause':function(_0x5675f8){return new Promise(function(_0x26e05c){var _0x12ef5a=util[_0xa950('0x8')](_0xa950('0x9'),_0xa950('0xa'),_0x5675f8[_0xa950('0xb')]);if(_0x1cd8ec['timers']&&_0x1cd8ec['timers'][_0x12ef5a]&&_0x1cd8ec['timers'][_0x12ef5a][_0xa950('0xc')]){_0x1cd8ec['timers'][_0x12ef5a][_0xa950('0xd')]();}if(_0x1cd8ec[_0xa950('0xe')][_0x12ef5a]){_0x1cd8ec[_0xa950('0xe')][_0x12ef5a]['updateStatusRealtime']({'statePause':_0x5675f8[_0xa950('0xf')]?!![]:![]});}_0x26e05c({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x10e64a){var _0x439097=this;return new Promise(function(_0x3cdf5d,_0x4c217c){if(ami[_0xa950('0x10')]()==![]){return _0x4c217c(_0x439097[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config['asterisk'][_0xa950('0x13')],_0xa950('0x14')][_0xa950('0x15')]('\x20')));}_0x10e64a=_['pick'](_0x10e64a,_[_0xa950('0x16')](properties[_0xa950('0x17')][_0xa950('0x18')]));_0x10e64a['action']=_0xa950('0x19');return ami[_0xa950('0x1a')](_0x10e64a)[_0xa950('0x1b')](function(_0x1021da){_0x3cdf5d({'code':0xc8,'message':_0x1021da[_0xa950('0x1c')]});})[_0xa950('0x1d')](function(_0x2b0e44){_0x4c217c(_0x439097[_0xa950('0x11')](0x1f5,_0x2b0e44[_0xa950('0x1c')]));});});},'Command':function(_0x18266c){var _0x28fedf=this;return new Promise(function(_0x38fa5d,_0xc690ae){if(ami['isConnected']()==![]){return _0xc690ae(_0x28fedf[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config['asterisk'][_0xa950('0x13')],_0xa950('0x14')]['join']('\x20')));}_0x18266c=_[_0xa950('0x1e')](_0x18266c,'command');_0x18266c[_0xa950('0x1f')]=_0xa950('0x20');return ami[_0xa950('0x1a')](_0x18266c)[_0xa950('0x1b')](function(_0x5617cd){_0x38fa5d({'code':0xc8,'message':_0x5617cd[_0xa950('0x21')]});})[_0xa950('0x1d')](function(_0x31c135){_0xc690ae(_0x28fedf[_0xa950('0x11')](0x1f5,_0x31c135[_0xa950('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x22e2c1){var _0x300448=[];for(var _0x23cb20 in _0x1cd8ec[_0xa950('0x22')]){if(_0x1cd8ec[_0xa950('0x22')][_0xa950('0x23')](_0x23cb20)){var _0x26f366=_0x1cd8ec[_0xa950('0x22')][_0x23cb20];var _0x5d82d8=new VoiceQueueSummary(_0x26f366);_0x300448[_0xa950('0x24')](_0x5d82d8);}}_0x22e2c1({'count':_0x300448[_0xa950('0x25')],'rows':_0x300448});});},'UpdateVoiceQueue':function(_0x3f37f8){return new Promise(function(_0x1aa96a,_0x31c168){var _0x186f35=_[_0xa950('0x26')](_0x1cd8ec['voiceQueues'],{'id':parseInt(_0x3f37f8['id'])});var _0x19ad7a=_[_0xa950('0x27')](_0x3f37f8,['id']);if(_0x186f35){for(var _0x5e4c94 in _0x19ad7a){if(typeof _0x19ad7a[_0x5e4c94]!==_0xa950('0x28')&&typeof _0x186f35[_0x5e4c94]!==_0xa950('0x28')){_0x186f35[_0x5e4c94]=_0x19ad7a[_0x5e4c94];}}_0x1aa96a(_0x186f35);}else{_0x31c168();}});},'VoiceChannels':function(){return new Promise(function(_0x3e5915){var _0x1875eb=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x2a')]);_0x3e5915({'count':_0x1875eb[_0xa950('0x25')],'rows':_0x1875eb});});},'VoiceChannelMixMonitor':function(_0x2d0c59){var _0x203703=this;return new Promise(function(_0x3c6ea8,_0x4de9f0){if(ami[_0xa950('0x10')]()==![]){return _0x4de9f0(_0x203703['error'](0x1f4,[config['asterisk']['ip'],config[_0xa950('0x12')]['username'],_0xa950('0x14')][_0xa950('0x15')]('\x20')));}var _0x3ba469=schema(properties[_0xa950('0x2b')])['validate'](_0x2d0c59);if(_0x3ba469[_0xa950('0x25')]>0x0){return _0x4de9f0(_0x203703['error'](0x1f4,_[_0xa950('0x2c')](_0x3ba469,_0xa950('0x1c'))['join'](',\x20')));}var _0x4c3e3c=_[_0xa950('0x26')](_0x1cd8ec[_0xa950('0x2a')],{'uniqueid':_0x2d0c59[_0xa950('0x2d')]});if(_0x4c3e3c&&_0x4c3e3c[_0xa950('0x2e')]){var _0x3410cf=util[_0xa950('0x8')]('%s.%s',_0x2d0c59['filename']||_0x2d0c59[_0xa950('0x2d')],_0x2d0c59['format']||_0xa950('0x2f'));return ami[_0xa950('0x1a')]({'action':_0xa950('0x30'),'channel':_0x4c3e3c[_0xa950('0x2e')],'file':_0x3410cf,'options':_0xa950('0x31')})[_0xa950('0x1b')](function(_0xd7f55d){var _0x3cc798=_[_0xa950('0x26')](_0x4c3e3c[_0xa950('0x32')],{'filename':'/var/spool/asterisk/monitor/'+_0x3410cf[_0xa950('0x33')]()});if(_['isNil'](_0x3cc798)){_0x4c3e3c[_0xa950('0x32')][_0xa950('0x24')]({'filename':'/var/spool/asterisk/monitor/'+_0x3410cf['toLowerCase'](),'createdAt':moment()[_0xa950('0x8')](_0xa950('0x34')),'mixmonitorid':_0xd7f55d['mixmonitorid'],'status':_0xa950('0x35')});}else{_0x3cc798[_0xa950('0x36')]=_0xd7f55d['mixmonitorid'];_0x3cc798[_0xa950('0x37')]=_0xa950('0x35');}_0x3c6ea8({'code':0xc8,'message':[_0x2d0c59[_0xa950('0x2d')],_0xa950('0x38'),_0xd7f55d[_0xa950('0x36')]][_0xa950('0x15')]('\x20'),'mixmonitorid':_0xd7f55d[_0xa950('0x36')]});})[_0xa950('0x1d')](function(_0x5c385e){_0x4de9f0(_0x203703[_0xa950('0x11')](0x1f5,[_0x2d0c59[_0xa950('0x2d')],_0x5c385e['message'][_0xa950('0x33')]()][_0xa950('0x15')]('\x20')));});}else{return _0x4de9f0(_0x203703[_0xa950('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x25c9f3){var _0x2de8a1=this;return new Promise(function(_0x8bdd37,_0x59fd48){if(ami['isConnected']()==![]){return _0x59fd48(_0x2de8a1[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config[_0xa950('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x41619f=schema(properties[_0xa950('0x2b')])[_0xa950('0x3')](_0x25c9f3);if(_0x41619f[_0xa950('0x25')]>0x0){return _0x59fd48(_0x2de8a1[_0xa950('0x11')](0x1f4,_['map'](_0x41619f,_0xa950('0x1c'))[_0xa950('0x15')](',\x20')));}var _0x531e6a=_['find'](_0x1cd8ec[_0xa950('0x2a')],{'uniqueid':_0x25c9f3[_0xa950('0x2d')]});if(_0x531e6a){return Promise['resolve']()['then'](function(){if(_0x531e6a['channel']){return ami['Action']({'action':_0xa950('0x39'),'channel':_0x531e6a[_0xa950('0x2e')],'mixmonitorid':_0x25c9f3['mixmonitorid']})['catch'](function(){});}})[_0xa950('0x1b')](function(){if(_0x531e6a['destinationchannel']){return ami[_0xa950('0x1a')]({'action':_0xa950('0x39'),'channel':_0x531e6a[_0xa950('0x3a')],'mixmonitorid':_0x25c9f3[_0xa950('0x36')]})[_0xa950('0x1d')](function(){});}})[_0xa950('0x1b')](function(){var _0x41b44d=_[_0xa950('0x26')](_0x531e6a['monitors'],{'mixmonitorid':_0x25c9f3[_0xa950('0x36')]});if(_0x41b44d){_0x41b44d['status']=_0xa950('0x3b');}})[_0xa950('0x1b')](function(){var _0x22675d=util[_0xa950('0x8')](_0xa950('0x3c'),_0x25c9f3[_0xa950('0x3d')]||_0x25c9f3[_0xa950('0x2d')],_0x25c9f3[_0xa950('0x8')]||_0xa950('0x2f'));var _0x4f777a=_[_0xa950('0x26')](_0x531e6a[_0xa950('0x32')],{'filename':_0xa950('0x3e')+_0x22675d[_0xa950('0x33')]()});if(_0x4f777a){_0x4f777a[_0xa950('0x37')]='stop';}})[_0xa950('0x1b')](function(){_0x8bdd37({'code':0xc8,'message':[_0x25c9f3[_0xa950('0x2d')],_0xa950('0x3f')][_0xa950('0x15')]('\x20')});})[_0xa950('0x1d')](function(_0xdca6e2){_0x59fd48(_0x2de8a1[_0xa950('0x11')](0x1f5,[_0x25c9f3['uniqueid'],_0xdca6e2[_0xa950('0x1c')][_0xa950('0x33')]()][_0xa950('0x15')]('\x20')));});}else{return _0x59fd48(_0x2de8a1['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x262a64){var _0x26216c=this;return new Promise(function(_0x38c370){var _0x16572e=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x40')]);var _0x1af0a3={'count':_0x16572e[_0xa950('0x25')],'rows':_0x16572e};if(_0x262a64&&_0x262a64['type']){if(![_0xa950('0x41'),_0xa950('0x42')][_0xa950('0x43')](_0x262a64[_0xa950('0x44')])){return _0x3645b6(_0x26216c[_0xa950('0x11')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x200183=_['filter'](_0x16572e,function(_0x1fe2f3){return _0x1fe2f3[_0xa950('0x44')]===_0x262a64[_0xa950('0x44')];});_0x1af0a3[_0xa950('0x45')]=_0x200183[_0xa950('0x25')];_0x1af0a3[_0xa950('0x46')]=_0x200183;}_0x38c370(_0x1af0a3);});},'VoiceQueuesChannel':function(_0x4b64b8){var _0x5b5368=this;return new Promise(function(_0x4af042,_0x41e086){var _0x18dcd2=schema(properties[_0xa950('0x47')])[_0xa950('0x3')](_0x4b64b8);if(_0x18dcd2[_0xa950('0x25')]>0x0){return _0x41e086(_0x5b5368[_0xa950('0x11')](0x1f4,_[_0xa950('0x2c')](_0x18dcd2,_0xa950('0x1c'))['join'](',\x20')));}var _0x3631bd=_['find'](_0x1cd8ec[_0xa950('0x40')],{'uniqueid':_0x4b64b8['uniqueid']});if(_0x3631bd){_0x4af042(_0x3631bd);}else{return _0x41e086(_0x5b5368[_0xa950('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x292de6){var _0x53e809=this;return new Promise(function(_0x1b71a5,_0x3e536e){if(ami[_0xa950('0x10')]()==![]){return _0x3e536e(_0x53e809[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config['asterisk'][_0xa950('0x13')],_0xa950('0x14')][_0xa950('0x15')]('\x20')));}var _0x42282f=schema(properties[_0xa950('0x48')])['validate'](_0x292de6);if(_0x42282f[_0xa950('0x25')]>0x0){return _0x3e536e(_0x53e809[_0xa950('0x11')](0x1f4,_[_0xa950('0x2c')](_0x42282f,_0xa950('0x1c'))[_0xa950('0x15')](',\x20')));}var _0x590af1=_[_0xa950('0x26')](_0x1cd8ec['queueChannels'],{'uniqueid':_0x292de6['uniqueid']});if(_0x590af1&&_0x590af1[_0xa950('0x2e')]){return ami[_0xa950('0x1a')]({'action':_0xa950('0x49'),'channel':_0x590af1[_0xa950('0x2e')]})['then'](function(_0x520fc7){_0x1b71a5({'code':0xc8,'message':[_0x292de6[_0xa950('0x2d')],_0x520fc7[_0xa950('0x1c')][_0xa950('0x33')]()]['join']('\x20')});})[_0xa950('0x1d')](function(_0x47697b){_0x3e536e(_0x53e809[_0xa950('0x11')](0x1f5,[_0x292de6[_0xa950('0x2d')],_0x47697b[_0xa950('0x1c')][_0xa950('0x33')]()][_0xa950('0x15')]('\x20')));});}else{return _0x3e536e(_0x53e809[_0xa950('0x11')](0x1f5,_0xa950('0x4a')));}});},'VoiceQueuesChannelRedirect':function(_0x484818){var _0xf7d2d7=this;return new Promise(function(_0x57a070,_0x1f00eb){if(ami[_0xa950('0x10')]()==![]){return _0x1f00eb(_0xf7d2d7[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config[_0xa950('0x12')][_0xa950('0x13')],_0xa950('0x14')][_0xa950('0x15')]('\x20')));}var _0x47384c=schema(properties[_0xa950('0x4b')])[_0xa950('0x3')](_0x484818);if(_0x47384c[_0xa950('0x25')]>0x0){return _0x1f00eb(_0xf7d2d7[_0xa950('0x11')](0x1f4,_['map'](_0x47384c,'message')[_0xa950('0x15')](',\x20')));}var _0x3ac5d8=_[_0xa950('0x26')](_0x1cd8ec[_0xa950('0x40')],{'uniqueid':_0x484818[_0xa950('0x2d')]});if(_0x3ac5d8&&_0x3ac5d8[_0xa950('0x2e')]){return ami[_0xa950('0x1a')]({'action':'Redirect','channel':_0x3ac5d8[_0xa950('0x2e')],'exten':_0x484818[_0xa950('0x4c')],'context':_0x484818[_0xa950('0x4d')]||_0x3ac5d8[_0xa950('0x4d')],'priority':0x1})[_0xa950('0x1b')](function(_0x2cf13f){_0x57a070({'code':0xc8,'message':[_0x484818[_0xa950('0x2d')],_0x2cf13f[_0xa950('0x1c')]['toLowerCase']()][_0xa950('0x15')]('\x20')});})[_0xa950('0x1d')](function(_0x155def){_0x1f00eb(_0xf7d2d7[_0xa950('0x11')](0x1f5,[_0x484818[_0xa950('0x2d')],_0x155def['message'][_0xa950('0x33')]()][_0xa950('0x15')]('\x20')));});}else{return _0x1f00eb(_0xf7d2d7[_0xa950('0x11')](0x1f5,_0xa950('0x4a')));}});},'Agents':function(_0x123bf6){return new Promise(function(_0x579378){var _0x145a6a=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0xe')]);if(_0x123bf6&&_0x123bf6['id']){var _0x487a12=_[_0xa950('0x26')](_0x145a6a,function(_0x3683bc){return _0x3683bc['id']===_0x123bf6['id'];});_0x579378(_0x487a12);}else{_0x579378({'count':_0x145a6a[_0xa950('0x25')],'rows':_0x145a6a});}});},'Telephones':function(){return new Promise(function(_0x22a960){var _0x55209c=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x4e')]);_0x22a960({'count':_0x55209c['length'],'rows':_0x55209c});});},'Trunks':function(){return new Promise(function(_0xda1471){var _0x268ba4=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x4f')]);_0xda1471({'count':_0x268ba4[_0xa950('0x25')],'rows':_0x268ba4});});},'OutboundChannels':function(){return new Promise(function(_0x1215bb){var _0x17b60c=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x50')]);_0x1215bb({'count':_0x17b60c[_0xa950('0x25')],'rows':_0x17b60c});});},'Outbound':function(){return new Promise(function(_0x20b6ff){_0x20b6ff(_0x1cd8ec[_0xa950('0x42')]);});},'Campaigns':function(){return new Promise(function(_0x6e8019){var _0x59ef65=_['values'](_0x1cd8ec['campaigns']);_0x6e8019({'count':_0x59ef65['length'],'rows':_0x59ef65});});},'VoiceQueuesPreview':function(_0xd6b04f){var _0x22066c=this;return new Promise(function(_0x470823,_0x55b7bb){_0x46f86d[_0xa950('0x51')](_0xd6b04f['id'])[_0xa950('0x1b')](function(_0x72cfd7){_0x470823({'code':0xc8,'message':_0x72cfd7[_0xa950('0x1c')]});})[_0xa950('0x1d')](function(_0x2b8c7){_0x55b7bb(_0x22066c[_0xa950('0x11')](0x1f4,_0x2b8c7['message']));});});},'EventManager':function(_0x2cd52d){var _0x1a703b=this;return new Promise(function(_0x17d0af,_0x18d150){if(!_0x2cd52d[_0xa950('0x52')]){return _0x18d150(_0x1a703b[_0xa950('0x11')](0x1f4,_0xa950('0x53')));}ami['emit'](_0xa950('0x54')+_0x2cd52d[_0xa950('0x52')],_0x2cd52d['message']);_0x17d0af({'code':0xc8,'message':_0x2cd52d});});},'FaxAccounts':function(){return new Promise(function(_0x3c1ac8){var _0x15f4c3=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x55')]);_0x3c1ac8({'count':_0x15f4c3[_0xa950('0x25')],'rows':_0x15f4c3});});},'SendFax':function(_0x2cdfe8){var _0x188996=this;return new Promise(function(_0x55729c,_0x729af9){_0x512c0e[_0xa950('0x56')](_0x2cdfe8)[_0xa950('0x1b')](function(_0x3ff63f){_0x55729c({'code':0xc8,'message':_0x3ff63f[_0xa950('0x1c')]});})[_0xa950('0x1d')](function(_0x5ec64d){_0x729af9(_0x188996[_0xa950('0x11')](0x1f4,_0x5ec64d[_0xa950('0x1c')]));});});},'CheckAfterSend':function(_0x5b5b02){var _0x4caa09=this;return new Promise(function(_0x54b082,_0x5dccf2){_0x512c0e[_0xa950('0x57')](_0x5b5b02)[_0xa950('0x1b')](function(_0x4925f5){_0x54b082({'code':0xc8,'message':_0x4925f5[_0xa950('0x1c')]});})[_0xa950('0x1d')](function(_0x5e5ea0){_0x5dccf2(_0x4caa09[_0xa950('0x11')](0x1f4,_0x5e5ea0[_0xa950('0x1c')]));});});}};var _0x1b1484=jayson['server'](_0x5ba2da)['http']();_0x1b1484['on'](_0xa950('0x11'),function(_0x19d3b6){return _0x3645b6(_0x19d3b6);});_0x1b1484[_0xa950('0x58')](0x232a,_0xa950('0x59'),function(){console[_0xa950('0x5a')](_0xa950('0x5b'),0x232a);return _0x14b4ac(_0xa950('0x5c')+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 7b91a5f..8e82d52 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 _0x47b3=['action','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','localhost','redis','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name'];(function(_0x4b4535,_0x256290){var _0x3d32a8=function(_0x55fa0f){while(--_0x55fa0f){_0x4b4535['push'](_0x4b4535['shift']());}};_0x3d32a8(++_0x256290);}(_0x47b3,0xee));var _0x347b=function(_0x48e0de,_0x25e7f8){_0x48e0de=_0x48e0de-0x0;var _0x38697c=_0x47b3[_0x48e0de];return _0x38697c;};'use strict';var _=require(_0x347b('0x0'));var BPromise=require(_0x347b('0x1'));var Redis=require(_0x347b('0x2'));var util=require('util');var config=require(_0x347b('0x3'));var logger=require(_0x347b('0x4'))(_0x347b('0x5'));var cmContactRpc=require(_0x347b('0x6'));config['redis']=_[_0x347b('0x7')](config['redis'],{'host':_0x347b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x347b('0x9')]));function emit(_0x500fdd,_0x1c4869,_0x445534,_0x3fe99f,_0x526cbc){logger[_0x347b('0xa')](_0x347b('0xb'),_0x500fdd,_0x1c4869['id'],_0x445534,_0x3fe99f,JSON[_0x347b('0xc')](_0x526cbc));io['to'](_0x445534)[_0x347b('0xd')](_0x3fe99f,_0x526cbc);}exports[_0x347b('0xe')]=function(_0x46affd,_0x209acf,_0x11bb35,_0x1a8d41){var _0x1a868d,_0x4b2ac8;var _0x1b3e83={};var _0x2d4102;var _0x1694f4=Number(_0x11bb35[_0x347b('0xf')]);var _0x53ff03=_0x11bb35[_0x347b('0x10')]?Boolean(Number(_0x11bb35['data2'])):![];var _0x36a499;var _0x24566a=![];if(!_[_0x347b('0x11')](_0x11bb35[_0x347b('0x12')])){if(_0x11bb35['data5']=='1')_0x24566a=!![];}if(!_0x24566a){if(_0x1a8d41[_0x347b('0x13')]){_0x1b3e83['id']=_0x1a8d41[_0x347b('0x13')];}}if(!_0x1b3e83['id']){_0x1b3e83[_0x347b('0x14')]=_0x1694f4;_0x36a499=_0x11bb35[_0x347b('0x15')]&&_0x11bb35[_0x347b('0x15')]!=='0'?_0x11bb35[_0x347b('0x15')][_0x347b('0x16')](','):[_0x347b('0x17')];_0x1b3e83['$or']=_[_0x347b('0x18')](_0x36a499,function(_0x17fe87){var _0x123718={};_0x123718[_0x17fe87]=_0x1a8d41[_0x347b('0x19')]?_0x1a8d41[_0x347b('0x1a')]:_0x1a8d41[_0x347b('0x1b')];return _0x123718;});_0x2d4102=_0x1a8d41[_0x347b('0x19')]?_0x1a8d41[_0x347b('0x1a')]:_0x1a8d41['calleridnum'];}var _0x4adf1d=['id','firstName',_0x347b('0x1c'),_0x347b('0x17'),_0x347b('0x1d'),_0x347b('0x1e'),_0x347b('0x14'),_0x347b('0x1f'),_0x347b('0x20'),_0x347b('0x21')];var _0x55b293=_[_0x347b('0x22')](_0x4adf1d,_0x36a499);BPromise[_0x347b('0x23')]()['then'](cmContactRpc[_0x347b('0x24')]({'attributes':_0x55b293,'where':_0x1b3e83,'phone':_0x2d4102}))[_0x347b('0x25')](function(_0x518c4e){_0x4b2ac8=_0x518c4e;if(!_[_0x347b('0x26')](_0x4b2ac8)){if(_0x4b2ac8[_0x347b('0x27')]===0x1){_0x1a868d=_0x4b2ac8[0x0];logger[_0x347b('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1a8d41[_0x347b('0x28')],_0x209acf['id'],_0x1a868d['id']);}else{logger[_0x347b('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1a8d41['uniqueid'],_0x209acf['id'],_[_0x347b('0x18')](_0x4b2ac8,'id')[_0x347b('0x29')](','));}return;}else{logger['info'](_0x347b('0x2a'),_0x1a8d41[_0x347b('0x28')],_0x209acf['id']);var _0x3765ff={'ListId':_0x1694f4};var _0x2c59ca=_0x11bb35[_0x347b('0x2b')]&&_0x11bb35[_0x347b('0x2b')]!=='0'?_0x11bb35[_0x347b('0x2b')]:_0x347b('0x17');if(_0x53ff03){logger[_0x347b('0xa')](_0x347b('0x2c'),_0x1a8d41['uniqueid'],_0x209acf['id']);_0x3765ff[_0x2c59ca]=_[_0x347b('0x11')](_0x1a8d41[_0x347b('0x19')])?_0x1a8d41['calleridnum']:_0x1a8d41['destcalleridnum'];if(_[_0x347b('0x11')](_0x1a8d41['routeId'])){_0x3765ff[_0x347b('0x2d')]=_0x1a8d41[_0x347b('0x2e')]&&_0x1a8d41['calleridname']!==_0x347b('0x2f')?_0x1a8d41[_0x347b('0x2e')]:'Unknown';}else{_0x3765ff[_0x347b('0x2d')]=_0x1a8d41['destcalleridname']&&_0x1a8d41['destcalleridname']!==''?_0x1a8d41[_0x347b('0x30')]:_0x347b('0x31');}return BPromise['resolve']()[_0x347b('0x25')](cmContactRpc[_0x347b('0x32')](_0x3765ff))[_0x347b('0x25')](function(_0x33f0c7){_0x1a868d=_0x33f0c7;_0x4b2ac8[_0x347b('0x33')](_0x33f0c7);if(_0x1a868d){logger[_0x347b('0xa')](_0x347b('0x34'),_0x1a8d41[_0x347b('0x28')],_0x209acf['id'],_0x1a868d['id']);}return;});}else{logger[_0x347b('0xa')](_0x347b('0x35'),_0x1a8d41[_0x347b('0x28')],_0x209acf['id']);_0x3765ff[_0x2c59ca]=_['isNil'](_0x1a8d41[_0x347b('0x19')])?_0x1a8d41[_0x347b('0x1b')]:_0x1a8d41['destcalleridnum'];if(_['isNil'](_0x1a8d41[_0x347b('0x19')])){_0x3765ff[_0x347b('0x2d')]=_0x1a8d41[_0x347b('0x2e')]&&_0x1a8d41[_0x347b('0x2e')]!==_0x347b('0x2f')?_0x1a8d41[_0x347b('0x2e')]:_0x347b('0x31');}else{_0x3765ff[_0x347b('0x2d')]=_0x1a8d41['destcalleridname']&&_0x1a8d41[_0x347b('0x30')]!==''?_0x1a8d41['destcalleridname']:'Unknown';}_0x1a868d=_0x3765ff;_0x4b2ac8[_0x347b('0x33')](_0x3765ff);return;}}})[_0x347b('0x25')](function(){if(_0x46affd){emit(_0x1a8d41[_0x347b('0x28')],_0x209acf,util[_0x347b('0x36')](_0x347b('0x37'),_0x46affd[_0x347b('0x38')]),util[_0x347b('0x36')]('trigger:%s',_0x11bb35[_0x347b('0x39')]['toLowerCase']()),{'evt':_[_0x347b('0x3a')](_0x1a8d41,{'autoCreate':_0x53ff03}),'contact':_0x1a868d===undefined?{}:_0x1a868d,'contacts':_0x4b2ac8[_0x347b('0x27')]===0x0?undefined:_0x4b2ac8});}});}; \ No newline at end of file +var _0x0598=['util','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','data1','data2','data5','xmd-contactid','ListId','data3','$or','routeId','destcalleridnum','calleridnum','lastName','fax','createdAt','scheduledAt','updatedAt','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','data4','phone','isNil','firstName','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','merge','lodash','ioredis'];(function(_0x4b3fd0,_0x5a13b3){var _0x453c61=function(_0x2a00aa){while(--_0x2a00aa){_0x4b3fd0['push'](_0x4b3fd0['shift']());}};_0x453c61(++_0x5a13b3);}(_0x0598,0x19e));var _0x8059=function(_0xff7c6d,_0x813dc0){_0xff7c6d=_0xff7c6d-0x0;var _0x462c10=_0x0598[_0xff7c6d];return _0x462c10;};'use strict';var _=require(_0x8059('0x0'));var BPromise=require('bluebird');var Redis=require(_0x8059('0x1'));var util=require(_0x8059('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x8059('0x3'));config[_0x8059('0x4')]=_[_0x8059('0x5')](config[_0x8059('0x4')],{'host':_0x8059('0x6'),'port':0x18eb});var io=require(_0x8059('0x7'))(new Redis(config[_0x8059('0x4')]));function emit(_0x597b80,_0xf62089,_0x3a25c5,_0x208ca7,_0x43c777){logger[_0x8059('0x8')]('[CM][%s][%s]',_0x597b80,_0xf62089['id'],_0x3a25c5,_0x208ca7,JSON[_0x8059('0x9')](_0x43c777));io['to'](_0x3a25c5)['emit'](_0x208ca7,_0x43c777);}exports[_0x8059('0xa')]=function(_0x2663a8,_0x55c663,_0x151e57,_0x450bba){var _0x16fae1,_0x971b58;var _0x587653={};var _0x1490fd;var _0x5229cf=Number(_0x151e57[_0x8059('0xb')]);var _0x1e3f7d=_0x151e57[_0x8059('0xc')]?Boolean(Number(_0x151e57['data2'])):![];var _0x84711c;var _0x57f9f2=![];if(!_['isNil'](_0x151e57[_0x8059('0xd')])){if(_0x151e57[_0x8059('0xd')]=='1')_0x57f9f2=!![];}if(!_0x57f9f2){if(_0x450bba['xmd-contactid']){_0x587653['id']=_0x450bba[_0x8059('0xe')];}}if(!_0x587653['id']){_0x587653[_0x8059('0xf')]=_0x5229cf;_0x84711c=_0x151e57['data3']&&_0x151e57['data3']!=='0'?_0x151e57[_0x8059('0x10')]['split'](','):['phone'];_0x587653[_0x8059('0x11')]=_['map'](_0x84711c,function(_0x3c4421){var _0xd4bc8={};_0xd4bc8[_0x3c4421]=_0x450bba[_0x8059('0x12')]?_0x450bba[_0x8059('0x13')]:_0x450bba[_0x8059('0x14')];return _0xd4bc8;});_0x1490fd=_0x450bba[_0x8059('0x12')]?_0x450bba[_0x8059('0x13')]:_0x450bba[_0x8059('0x14')];}var _0x10bdc4=['id','firstName',_0x8059('0x15'),'phone','mobile',_0x8059('0x16'),_0x8059('0xf'),_0x8059('0x17'),_0x8059('0x18'),_0x8059('0x19')];var _0x180585=_['union'](_0x10bdc4,_0x84711c);BPromise['resolve']()[_0x8059('0x1a')](cmContactRpc[_0x8059('0x1b')]({'attributes':_0x180585,'where':_0x587653,'phone':_0x1490fd}))[_0x8059('0x1a')](function(_0x93078c){_0x971b58=_0x93078c;if(!_[_0x8059('0x1c')](_0x971b58)){if(_0x971b58[_0x8059('0x1d')]===0x1){_0x16fae1=_0x971b58[0x0];logger[_0x8059('0x8')](_0x8059('0x1e'),_0x450bba[_0x8059('0x1f')],_0x55c663['id'],_0x16fae1['id']);}else{logger[_0x8059('0x8')](_0x8059('0x20'),_0x450bba[_0x8059('0x1f')],_0x55c663['id'],_[_0x8059('0x21')](_0x971b58,'id')[_0x8059('0x22')](','));}return;}else{logger[_0x8059('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x450bba[_0x8059('0x1f')],_0x55c663['id']);var _0x4f198b={'ListId':_0x5229cf};var _0x25f852=_0x151e57['data4']&&_0x151e57['data4']!=='0'?_0x151e57[_0x8059('0x23')]:_0x8059('0x24');if(_0x1e3f7d){logger[_0x8059('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x450bba[_0x8059('0x1f')],_0x55c663['id']);_0x4f198b[_0x25f852]=_[_0x8059('0x25')](_0x450bba[_0x8059('0x12')])?_0x450bba[_0x8059('0x14')]:_0x450bba[_0x8059('0x13')];if(_[_0x8059('0x25')](_0x450bba[_0x8059('0x12')])){_0x4f198b[_0x8059('0x26')]=_0x450bba[_0x8059('0x27')]&&_0x450bba[_0x8059('0x27')]!==_0x8059('0x28')?_0x450bba[_0x8059('0x27')]:_0x8059('0x29');}else{_0x4f198b['firstName']=_0x450bba[_0x8059('0x2a')]&&_0x450bba[_0x8059('0x2a')]!==_0x8059('0x28')?_0x450bba[_0x8059('0x2a')]:_0x8059('0x29');}return BPromise['resolve']()[_0x8059('0x1a')](cmContactRpc['createContact'](_0x4f198b))[_0x8059('0x1a')](function(_0x118b2a){_0x16fae1=_0x118b2a;_0x971b58[_0x8059('0x2b')](_0x118b2a);if(_0x16fae1){logger['info'](_0x8059('0x2c'),_0x450bba[_0x8059('0x1f')],_0x55c663['id'],_0x16fae1['id']);}return;});}else{logger[_0x8059('0x8')](_0x8059('0x2d'),_0x450bba['uniqueid'],_0x55c663['id']);_0x4f198b[_0x25f852]=_[_0x8059('0x25')](_0x450bba[_0x8059('0x12')])?_0x450bba['calleridnum']:_0x450bba[_0x8059('0x13')];if(_[_0x8059('0x25')](_0x450bba[_0x8059('0x12')])){_0x4f198b[_0x8059('0x26')]=_0x450bba[_0x8059('0x27')]&&_0x450bba[_0x8059('0x27')]!==_0x8059('0x28')?_0x450bba[_0x8059('0x27')]:_0x8059('0x29');}else{_0x4f198b[_0x8059('0x26')]=_0x450bba[_0x8059('0x2a')]&&_0x450bba[_0x8059('0x2a')]!==_0x8059('0x28')?_0x450bba[_0x8059('0x2a')]:_0x8059('0x29');}_0x16fae1=_0x4f198b;_0x971b58[_0x8059('0x2b')](_0x4f198b);return;}}})[_0x8059('0x1a')](function(){if(_0x2663a8){emit(_0x450bba[_0x8059('0x1f')],_0x55c663,util[_0x8059('0x2e')](_0x8059('0x2f'),_0x2663a8[_0x8059('0x30')]),util[_0x8059('0x2e')](_0x8059('0x31'),_0x151e57[_0x8059('0x32')]['toLowerCase']()),{'evt':_[_0x8059('0x33')](_0x450bba,{'autoCreate':_0x1e3f7d}),'contact':_0x16fae1===undefined?{}:_0x16fae1,'contacts':_0x971b58[_0x8059('0x1d')]===0x0?undefined:_0x971b58});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 9e97d15..186261b 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 _0xacf7=['windowHeight','data6','600','winApplication','winArguments','format','name','trigger:%s:%s','data1','merge','jscripty','user:%s','trigger:%s','contactmanager','exec','integration','queue','routeId','urlforward','script','buildUri','parse','query','search','replace','channel','AllConditions','length','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','value','upperFirst','operator','AccountId','interaction','message','event','agent','membername','lastevent','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','vtigerAccounts','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','stringify','prototype','clone','undefined','motionChannel','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','action','toLowerCase','browser','TemplateId','data2','html','render','template\x20not\x20found','data3','data4','uriLocation','windowWidth','isNil','data5','800'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacf7,0x1bd));var _0x7acf=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xacf7[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x7acf('0x0'));var _=require(_0x7acf('0x1'));var url=require(_0x7acf('0x2'));var Mustache=require(_0x7acf('0x3'));var Redis=require(_0x7acf('0x4'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0x7acf('0x5'));var script=require(_0x7acf('0x6'));var config=require(_0x7acf('0x7'));var logger=require(_0x7acf('0x8'))(_0x7acf('0x9'));var ami=require(_0x7acf('0xa'));config['redis']=_[_0x7acf('0xb')](config[_0x7acf('0xc')],{'host':_0x7acf('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7acf('0xc')]));var operators={'equals':function(_0x3034cc,_0x453f81){return _0x3034cc==_0x453f81;},'not_equals':function(_0x174331,_0x35e2e8){return _0x174331!=_0x35e2e8;}};var barAndWebActions=[_0x7acf('0xe'),_0x7acf('0x2'),_0x7acf('0xf')];function Trigger(_0x3f06cb){this[_0x7acf('0x10')]=_0x3f06cb[_0x7acf('0x10')];this[_0x7acf('0x11')]=_0x3f06cb[_0x7acf('0x11')];this[_0x7acf('0x12')]=_0x3f06cb[_0x7acf('0x12')];this[_0x7acf('0x13')]=_0x3f06cb['templates'];this[_0x7acf('0x14')]=_0x3f06cb['voiceExtensions'];this[_0x7acf('0x15')]=_0x3f06cb['zendeskAccounts'];this[_0x7acf('0x16')]=_0x3f06cb[_0x7acf('0x16')];this[_0x7acf('0x17')]=_0x3f06cb['salesforceAccounts'];this[_0x7acf('0x18')]=_0x3f06cb[_0x7acf('0x18')];this['zohoAccounts']=_0x3f06cb['zohoAccounts'];this[_0x7acf('0x19')]=_0x3f06cb['deskAccounts'];this['vtigerAccounts']=_0x3f06cb['vtigerAccounts'];this[_0x7acf('0x1a')]=_0x3f06cb[_0x7acf('0x1a')];this[_0x7acf('0x1b')]=_0x3f06cb[_0x7acf('0x1b')];this[_0x7acf('0x1c')]=_0x3f06cb[_0x7acf('0x1c')];this[_0x7acf('0x1d')]={'zendesk':this[_0x7acf('0x15')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x7acf('0x16')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this[_0x7acf('0x1e')],'dynamics365':this[_0x7acf('0x1b')],'freshsales':this[_0x7acf('0x1c')],'servicenow':this[_0x7acf('0x1a')]};ami['on']('custom:agentcalled',this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on']('custom:agentconnect',this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x21'),this[_0x7acf('0x1f')]['bind'](this));ami['on'](_0x7acf('0x22'),this['syncCustomEvent'][_0x7acf('0x20')](this));ami['on']('custom:agentnosuchnumber',this[_0x7acf('0x1f')]['bind'](this));ami['on'](_0x7acf('0x23'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on']('custom:agentbusy',this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x24'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x25'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on']('custom:amd',this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x26'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x27'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x28'),this[_0x7acf('0x29')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x2a'),this[_0x7acf('0x29')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x2b'),this[_0x7acf('0x29')]['bind'](this));ami['on'](_0x7acf('0x2c'),this['syncCustomEvent'][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x2d'),this[_0x7acf('0x1f')]['bind'](this));ami['on'](_0x7acf('0x2e'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x2f'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x30'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x31'),this[_0x7acf('0x1f')][_0x7acf('0x20')](this));ami['on'](_0x7acf('0x32'),this['syncCustomEvent'][_0x7acf('0x20')](this));ami['on']('custom:offlineMessage',this['syncCustomEvent'][_0x7acf('0x20')](this));}Trigger['prototype'][_0x7acf('0x33')]=function(_0x48623b,_0xbeb182,_0x21a696){logger[_0x7acf('0x34')](_0x48623b,_0xbeb182,JSON[_0x7acf('0x35')](_0x21a696));io['to'](_0x48623b)[_0x7acf('0x33')](_0xbeb182,_0x21a696);};Trigger[_0x7acf('0x36')][_0x7acf('0x1f')]=function(_0x2ffd9f){var _0x1ebd0a=_[_0x7acf('0x37')](_0x2ffd9f);if(typeof _0x1ebd0a['motionChannel']===_0x7acf('0x38')){_0x1ebd0a[_0x7acf('0x39')]='voice';}this[_0x7acf('0x3a')](_0x1ebd0a);};Trigger[_0x7acf('0x36')][_0x7acf('0x29')]=function(_0x2e325e){if(this[_0x7acf('0x11')][_0x2e325e[_0x7acf('0x3b')]]){this[_0x7acf('0x1f')](_0x2e325e);}};Trigger[_0x7acf('0x36')][_0x7acf('0x3a')]=function(_0x122a2d){var _0x5a179c;for(var _0x511f06 in this[_0x7acf('0x10')]){if(this[_0x7acf('0x10')][_0x7acf('0x3c')](_0x511f06)){if(this[_0x7acf('0x10')][_0x511f06][_0x7acf('0x3d')]){_0x5a179c=this[_0x7acf('0x3e')](this[_0x7acf('0x10')][_0x511f06],_0x122a2d);if(_0x5a179c){_['merge'](_0x122a2d,_0x122a2d[_0x7acf('0x3f')]);for(var _0x460b65=0x0,_0x237aba,_0x456f7e,_0x2c9572;_0x460b650x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x2e3792,_0x379856){var _0x1e2c16=function(_0x233b74){while(--_0x233b74){_0x2e3792['push'](_0x2e3792['shift']());}};_0x1e2c16(++_0x379856);}(_0x3e74,0x175));var _0x43e7=function(_0x18144d,_0x2b2d3e){_0x18144d=_0x18144d-0x0;var _0x21a1f4=_0x3e74[_0x18144d];return _0x21a1f4;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 904e140..24591b2 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 _0x3bfb=[']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','Bearer\x20','value','isNil','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','systemuserid','message','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','4.0','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','nameField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','phonecall','callDirection','queue','phonecalls','Fields','ticketId','format','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','tenantId','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name'];(function(_0x2ea1d6,_0x3d6da4){var _0x238aad=function(_0x4c01ba){while(--_0x4c01ba){_0x2ea1d6['push'](_0x2ea1d6['shift']());}};_0x238aad(++_0x3d6da4);}(_0x3bfb,0x6d));var _0xb3bf=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x3bfb[_0x5b26cb];return _0x563d12;};'use strict';var _=require(_0xb3bf('0x0'));var rp=require(_0xb3bf('0x1'));var util=require('util');var intUtil=require(_0xb3bf('0x2'));var md5=require(_0xb3bf('0x3'));var Redis=require(_0xb3bf('0x4'));var logger=require(_0xb3bf('0x5'))('dynamics365');var config=require(_0xb3bf('0x6'));config[_0xb3bf('0x7')]=_['defaults'](config[_0xb3bf('0x7')],{'host':_0xb3bf('0x8'),'port':0x18eb});var io=require(_0xb3bf('0x9'))(new Redis(config[_0xb3bf('0x7')]));function getAuthToken(_0x3a832b,_0x6eedb,_0x3c0b22){if(_0x3a832b[_0xb3bf('0xa')]){_0x3a832b['remoteUri']=_0x3a832b[_0xb3bf('0xb')][_0xb3bf('0xc')];_0x3a832b['tenantId']=_0x3a832b[_0xb3bf('0xb')][_0xb3bf('0xd')];return Promise[_0xb3bf('0xe')](_0x3a832b[_0xb3bf('0xb')][_0xb3bf('0xf')]);}var _0x39f780={'method':_0xb3bf('0x10'),'uri':_0x6eedb,'form':{'client_id':_0x3a832b[_0xb3bf('0x11')],'resource':_0x3a832b[_0xb3bf('0x12')],'username':_0x3a832b[_0xb3bf('0x13')],'password':_0x3a832b[_0xb3bf('0x14')],'grant_type':'password','client_secret':_0x3a832b[_0xb3bf('0x15')]},'json':!![]};return rp(_0x39f780)['then'](function(_0x342389){return _0x342389['access_token'];})[_0xb3bf('0x16')](function(_0x54175c){logger[_0xb3bf('0x17')]('['+[_0x3c0b22[_0xb3bf('0x18')]()]+_0xb3bf('0x19'));return _0x54175c['message'];});}function getUser(_0x53c2b9,_0x41c3cf,_0x5d7e2e,_0x3cbfac,_0x5b6295,_0x5e7433){return new Promise(function(_0x350c50,_0x286f06){return getAuthToken(_0x41c3cf,_0x3cbfac,_0x5e7433)[_0xb3bf('0x1a')](function(_0x411ce4){var _0x4c648f={'method':_0xb3bf('0x1b'),'uri':_0x5b6295+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xb3bf('0x1c')+_0x411ce4,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c648f);})['then'](function(_0x7e6b4c){var _0x170fc3=_0x7e6b4c[_0xb3bf('0x1d')];var _0x26f568=![];var _0x5d31c9=null;if(!_[_0xb3bf('0x1e')](_0x5d7e2e)){if(intUtil['validateEmail'](_0x5d7e2e[_0xb3bf('0x1f')])){_0x53c2b9[_0xb3bf('0x20')]=_0x5d7e2e['email'];for(_0x5d31c9=0x0;_0x5d31c9<_0x170fc3[_0xb3bf('0x21')];_0x5d31c9++){if(_0x170fc3[_0x5d31c9][_0xb3bf('0x22')]===_0x5d7e2e[_0xb3bf('0x1f')]&&!_0x170fc3[_0x5d31c9][_0xb3bf('0x23')]){_0x26f568=!![];logger['info']('['+[_0x5e7433[_0xb3bf('0x18')]()]+_0xb3bf('0x24')+_0x170fc3[_0x5d31c9]['systemuserid']+'!');_0x53c2b9['userId']=_0x170fc3[_0x5d31c9]['systemuserid'];}}}}if(!_0x26f568){logger[_0xb3bf('0x25')]('['+[_0x5e7433[_0xb3bf('0x18')]()]+_0xb3bf('0x26'));_0x53c2b9['userEmail']=_0x41c3cf[_0xb3bf('0x13')];for(_0x5d31c9=0x0;_0x5d31c9<_0x170fc3[_0xb3bf('0x21')];_0x5d31c9++){if(_0x170fc3[_0x5d31c9][_0xb3bf('0x22')]===_0x41c3cf[_0xb3bf('0x13')]){_0x53c2b9[_0xb3bf('0x27')]=_0x170fc3[_0x5d31c9][_0xb3bf('0x28')];}}}_0x350c50(_0x53c2b9);})[_0xb3bf('0x16')](function(_0x5702a3){_0x286f06(_0x5702a3[_0xb3bf('0x29')]);});});}function createEndUser(_0xcfc4cd,_0x1fa976,_0x39f3f0,_0x33c07f,_0x3267df,_0x161ce4,_0x3bf9f4){return new Promise(function(_0x171d56,_0x2d14ac){return getAuthToken(_0x1fa976,_0x39f3f0,_0x161ce4)[_0xb3bf('0x1a')](function(_0x5ce2fb){var _0x10a4d3=_0x161ce4[_0xb3bf('0x2a')]()==='outbound'?_0x3267df[_0xb3bf('0x2b')]:_0x3267df[_0xb3bf('0x2c')];var _0xe6b37d={'method':_0xb3bf('0x10'),'uri':_0x33c07f+_0xb3bf('0x2d'),'body':{'fullname':_0x10a4d3,'firstname':_0x10a4d3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb3bf('0x2e')+_0xcfc4cd[_0xb3bf('0x27')]+')'},'headers':{'Authorization':_0xb3bf('0x1c')+_0x5ce2fb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0xe6b37d[_0xb3bf('0x2f')][_0x3bf9f4]=_0x10a4d3;return rp(_0xe6b37d);})[_0xb3bf('0x1a')](function(_0x54838a){var _0x207ce9=_0x54838a[_0xb3bf('0x30')][_0xb3bf('0x31')];var _0x16da92=_0x207ce9[_0xb3bf('0x32')](_0x207ce9[_0xb3bf('0x33')]('(')+0x1,_0x207ce9[_0xb3bf('0x33')](')'));_0xcfc4cd[_0xb3bf('0x34')]=_0x16da92;_0x171d56(_0xcfc4cd);})[_0xb3bf('0x16')](function(_0x48fedf){_0x2d14ac(_0x48fedf[_0xb3bf('0x29')]);});});}function getEndUser(_0x28ad01,_0x315d45,_0x2741c7,_0x149dd4,_0x51716a,_0x4e6077,_0x2129f2,_0x31a9ea){var _0x221a5e=_0x4e6077[_0xb3bf('0x2a')]()===_0xb3bf('0x35')?_0x51716a[_0xb3bf('0x2b')]:_0x51716a['calleridnum'];return getAuthToken(_0x315d45,_0x2741c7,_0x4e6077)[_0xb3bf('0x1a')](function(_0x1dbd37){_0x31a9ea=_0x31a9ea?_0x31a9ea:_0xb3bf('0x36');var _0x21e71a={'method':_0xb3bf('0x1b'),'uri':_0x149dd4+'contacts?$select='+_0x31a9ea+_0xb3bf('0x37')+_0x31a9ea+_0xb3bf('0x38')+_0x221a5e[_0xb3bf('0x39')]('+',_0xb3bf('0x3a'))+'\x27','headers':{'Authorization':_0xb3bf('0x1c')+_0x1dbd37,'If-None-Match':null,'OData-Version':_0xb3bf('0x3b')},'json':!![]};return rp(_0x21e71a);})[_0xb3bf('0x1a')](function(_0x5ad681){var _0x53169f=![];if(!_0x5ad681)return _0x53169f;var _0x55cdb5=_0x5ad681[_0xb3bf('0x1d')];for(var _0x5b079c=0x0;_0x5b079c<_0x55cdb5[_0xb3bf('0x21')];_0x5b079c++){if(_0x55cdb5[_0x5b079c][_0x31a9ea]===_0x221a5e){_0x53169f=!![];_0x28ad01[_0xb3bf('0x34')]=_0x55cdb5[_0x5b079c][_0xb3bf('0x3c')];}}return _0x53169f;})[_0xb3bf('0x1a')](function(_0x26243b){if(_0x26243b)return _0x28ad01;if(_0x2129f2===_0xb3bf('0x3d')){logger[_0xb3bf('0x25')]('['+[_0x4e6077[_0xb3bf('0x18')]()]+_0xb3bf('0x3e'));return _0x28ad01;}return createEndUser(_0x28ad01,_0x315d45,_0x2741c7,_0x149dd4,_0x51716a,_0x4e6077,_0x31a9ea)[_0xb3bf('0x1a')](function(_0x10ee25){logger[_0xb3bf('0x25')]('['+[_0x4e6077[_0xb3bf('0x18')]()]+_0xb3bf('0x3f'),_0x10ee25[_0xb3bf('0x34')]);return _0x10ee25;});});}function getCustomFields(_0x3b806c,_0x289cde,_0x31b997){var _0xe31e33={};if(_0x3b806c[_0xb3bf('0x21')]>0x0){_[_0xb3bf('0x40')](_0x3b806c,function(_0x4ae393){if(_[_0xb3bf('0x41')](['string','picklist'],_0x4ae393['type'])&&_0x4ae393[_0xb3bf('0x42')]&&!_0x4ae393['customField']){var _0x77c0c5=_0x4ae393[_0xb3bf('0x43')][_0xb3bf('0x2a')]();var _0x3475ae=_0x77c0c5['substring'](0x0,_0x77c0c5[_0xb3bf('0x44')]('_'));var _0x1ccf3c=_0x77c0c5[_0xb3bf('0x32')](_0x77c0c5[_0xb3bf('0x44')]('_')+0x1);if(_0x3475ae===_0x31b997){_0xe31e33[_0x1ccf3c]=_0x4ae393[_0xb3bf('0x45')];}}});}return _0xe31e33;}function getTicket(_0x544e7e,_0x1bc006,_0x5bda56,_0x2ce0e8,_0x3b2b7c,_0x2304ed,_0x585cd3){return new Promise(function(_0x4ff700,_0x1922ef){var _0x3d66aa;return getAuthToken(_0x1bc006,_0x5bda56,_0x585cd3)[_0xb3bf('0x1a')](function(_0x29e1c0){if(_0x2304ed[_0xb3bf('0x46')]===_0xb3bf('0x47')){_0x3d66aa={'method':_0xb3bf('0x10'),'uri':_0x2ce0e8+_0xb3bf('0x48'),'body':Object['assign']({},{'title':intUtil[_0xb3bf('0x49')](_0x2304ed[_0xb3bf('0x4a')],_0x3b2b7c,'\x20'),'description':intUtil[_0xb3bf('0x49')](_0x2304ed[_0xb3bf('0x4b')],_0x3b2b7c,'\x0a'),'customerid_contact@odata.bind':_0x544e7e['enduserId']?_0xb3bf('0x4c')+_0x544e7e[_0xb3bf('0x34')]+')':undefined,'ownerid@odata.bind':_0xb3bf('0x2e')+_0x544e7e[_0xb3bf('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x2304ed['Fields'],_0x3b2b7c,_0x2304ed['ticketType'])),'headers':{'Authorization':_0xb3bf('0x1c')+_0x29e1c0,'OData-Version':_0xb3bf('0x3b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2304ed['ticketType']===_0xb3bf('0x4d')){var _0x2aebec=_0x544e7e[_0xb3bf('0x34')]?[{'partyid_systemuser@odata.bind':_0xb3bf('0x2e')+_0x544e7e[_0xb3bf('0x27')]+')','participationtypemask':_0x544e7e[_0xb3bf('0x4e')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xb3bf('0x4c')+_0x544e7e[_0xb3bf('0x34')]+')','participationtypemask':_0x544e7e[_0xb3bf('0x4e')]===_0xb3bf('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb3bf('0x2e')+_0x544e7e['userId']+')','participationtypemask':_0x544e7e[_0xb3bf('0x4e')]==='queue'?0x2:0x1}];_0x3d66aa={'method':_0xb3bf('0x10'),'uri':_0x2ce0e8+_0xb3bf('0x50'),'body':Object['assign']({},{'subject':intUtil[_0xb3bf('0x49')](_0x2304ed[_0xb3bf('0x4a')],_0x3b2b7c,'\x20'),'phonenumber':String(_0x3b2b7c[_0xb3bf('0x2c')]),'description':intUtil[_0xb3bf('0x49')](_0x2304ed[_0xb3bf('0x4b')],_0x3b2b7c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x544e7e[_0xb3bf('0x34')]?_0xb3bf('0x4c')+_0x544e7e[_0xb3bf('0x34')]+')':undefined,'ownerid@odata.bind':_0xb3bf('0x2e')+_0x544e7e[_0xb3bf('0x27')]+')','directioncode':_0x544e7e[_0xb3bf('0x4e')]===_0xb3bf('0x4f')?![]:!![],'phonecall_activity_parties':_0x2aebec},getCustomFields(_0x2304ed[_0xb3bf('0x51')],_0x3b2b7c,_0x2304ed[_0xb3bf('0x46')])),'headers':{'Authorization':_0xb3bf('0x1c')+_0x29e1c0,'OData-Version':_0xb3bf('0x3b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3d66aa);})['then'](function(_0xa65dc5){var _0xafd5b9=_0xa65dc5[_0xb3bf('0x30')][_0xb3bf('0x31')];var _0x5c06e1=_0xafd5b9[_0xb3bf('0x32')](_0xafd5b9[_0xb3bf('0x33')]('(')+0x1,_0xafd5b9[_0xb3bf('0x33')](')'));_0x544e7e[_0xb3bf('0x52')]=_0x5c06e1;_0x4ff700(_0x544e7e);})[_0xb3bf('0x16')](function(_0x48d3cd){_0x1922ef(_0x48d3cd[_0xb3bf('0x29')]);});});}function emit(_0x285cc0,_0x3db70a,_0x3615e5,_0x42f0eb){var _0x5c0fb0={'uri':util[_0xb3bf('0x53')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x285cc0,_0x3615e5,_0x42f0eb)};io['to'](util[_0xb3bf('0x53')]('user:%s',_0x3db70a))['emit'](_0xb3bf('0x54'),_0x5c0fb0);}exports['cs']=function(_0x38ac9e,_0x30b49d,_0x42398f,_0x4950c7,_0x3d8edf,_0x3c78c2,_0x146156,_0x332f70){var _0x13b003={};_0x3c78c2[_0xb3bf('0x12')]=_0x3c78c2['modernAuthentication']?intUtil[_0xb3bf('0x55')](_0x3c78c2['CloudProvider']['data7']):intUtil[_0xb3bf('0x55')](_0x3c78c2[_0xb3bf('0x12')]);_0x3c78c2['serverUrl']=intUtil[_0xb3bf('0x55')](_0x3c78c2[_0xb3bf('0x56')]);_0x13b003[_0xb3bf('0x4e')]=_0x332f70===_0xb3bf('0x4f')||_0x332f70==='unmanaged'?_0xb3bf('0x4f'):_0xb3bf('0x35');var _0xf1ad08=_0x3c78c2[_0xb3bf('0xa')]?util[_0xb3bf('0x53')](_0xb3bf('0x57'),_0x3c78c2[_0xb3bf('0xb')][_0xb3bf('0xc')]):util['format'](_0xb3bf('0x57'),_0x3c78c2[_0xb3bf('0x12')]);var _0x2c85bc=util[_0xb3bf('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3c78c2[_0xb3bf('0x58')]);var _0x3f3b67=util[_0xb3bf('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c78c2['serverUrl'],_0x30b49d['uniqueid'],md5(_0x30b49d['uniqueid']));if(_0x3d8edf&&_0x3d8edf[_0xb3bf('0x59')]){logger[_0xb3bf('0x25')](_0xb3bf('0x5a'),_0xb3bf('0x5b'));_0x30b49d[_0xb3bf('0x5c')]=_0x3f3b67;}else if(_0x146156&&_0x146156[_0xb3bf('0x5d')]&&_0x146156[_0xb3bf('0x5d')]!==_0xb3bf('0x5e')){logger[_0xb3bf('0x25')](_0xb3bf('0x5f'),_0xb3bf('0x5b'));_0x30b49d[_0xb3bf('0x5c')]=_0x3f3b67;}else{_0x30b49d['recordingURL']='';}return getUser(_0x13b003,_0x3c78c2,_0x4950c7,_0x2c85bc,_0xf1ad08,_0x332f70)[_0xb3bf('0x1a')](function(_0x168a4c){logger[_0xb3bf('0x25')]('['+_0x332f70[_0xb3bf('0x18')]()+_0xb3bf('0x60'),_0x168a4c[_0xb3bf('0x27')]);logger['info']('['+_0x332f70[_0xb3bf('0x18')]()+_0xb3bf('0x61'),_0x168a4c[_0xb3bf('0x20')]);return getEndUser(_0x168a4c,_0x3c78c2,_0x2c85bc,_0xf1ad08,_0x30b49d,_0x332f70,_0x42398f[_0xb3bf('0x62')],_0x42398f[_0xb3bf('0x63')]);})[_0xb3bf('0x1a')](function(_0x109f39){logger[_0xb3bf('0x25')]('['+_0x332f70['toUpperCase']()+_0xb3bf('0x64'),_0x109f39['enduserId']);logger[_0xb3bf('0x25')]('['+_0x332f70[_0xb3bf('0x18')]()+_0xb3bf('0x65'),_0x30b49d[_0xb3bf('0x2c')]);return getTicket(_0x109f39,_0x3c78c2,_0x2c85bc,_0xf1ad08,_0x30b49d,_0x42398f,_0x332f70);})[_0xb3bf('0x1a')](function(_0x2c1180){logger[_0xb3bf('0x25')](util['format']('['+_0x332f70['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x42398f['ticketType'],_0x2c1180['ticketId']));logger[_0xb3bf('0x25')](util[_0xb3bf('0x53')]('['+_0x332f70[_0xb3bf('0x18')]()+']\x20Call\x20direction:\x20%s',_0x332f70));if(_0x332f70!==_0xb3bf('0x66')&&_0x42398f['openNewTab']){logger[_0xb3bf('0x25')]('['+_0x332f70['toUpperCase']()+']',_0xb3bf('0x67'));emit(_0x3c78c2['remoteUri'],_0x4950c7[_0xb3bf('0x68')],_0x42398f['ticketType'],_0x2c1180['ticketId']);}})[_0xb3bf('0x16')](function(_0x2f88a2){logger[_0xb3bf('0x17')]('['+_0x332f70[_0xb3bf('0x18')]()+_0xb3bf('0x69'),_0x2f88a2[_0xb3bf('0x29')]);console['error'](_0xb3bf('0x6a'),_0x2f88a2);});}; \ No newline at end of file +var _0x4141=['POST','phonecalls','Descriptions','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','modernAuthentication','CloudProvider','data7','tenantId','data2','clientId','remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','outbound','destcalleridnum','4.0','body','headers','odata-entityid','lastIndexOf','toLowerCase','calleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','enduserId','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','picklist','type','idField','substring','indexOf','content','ticketType','incident','assign','getString','/contacts(','/systemusers(','phonecall','callDirection','queue'];(function(_0x1bef07,_0x2a4e64){var _0x29edf6=function(_0x3e0230){while(--_0x3e0230){_0x1bef07['push'](_0x1bef07['shift']());}};_0x29edf6(++_0x2a4e64);}(_0x4141,0x1b2));var _0x1414=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4141[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1414('0x0'));var rp=require('request-promise');var util=require(_0x1414('0x1'));var intUtil=require('./util');var md5=require(_0x1414('0x2'));var Redis=require(_0x1414('0x3'));var logger=require(_0x1414('0x4'))(_0x1414('0x5'));var config=require(_0x1414('0x6'));config['redis']=_[_0x1414('0x7')](config[_0x1414('0x8')],{'host':_0x1414('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1414('0x8')]));function getAuthToken(_0x35b09f,_0x1ebdd6,_0x11dabd){if(_0x35b09f[_0x1414('0xa')]){_0x35b09f['remoteUri']=_0x35b09f[_0x1414('0xb')][_0x1414('0xc')];_0x35b09f[_0x1414('0xd')]=_0x35b09f[_0x1414('0xb')][_0x1414('0xe')];return Promise['resolve'](_0x35b09f[_0x1414('0xb')]['data5']);}var _0x35d2a3={'method':'POST','uri':_0x1ebdd6,'form':{'client_id':_0x35b09f[_0x1414('0xf')],'resource':_0x35b09f[_0x1414('0x10')],'username':_0x35b09f[_0x1414('0x11')],'password':_0x35b09f[_0x1414('0x12')],'grant_type':_0x1414('0x12'),'client_secret':_0x35b09f['clientSecret']},'json':!![]};return rp(_0x35d2a3)[_0x1414('0x13')](function(_0x5f1c74){return _0x5f1c74[_0x1414('0x14')];})[_0x1414('0x15')](function(_0x1bbb23){logger[_0x1414('0x16')]('['+[_0x11dabd[_0x1414('0x17')]()]+_0x1414('0x18'));return _0x1bbb23[_0x1414('0x19')];});}function getUser(_0x529bf2,_0x5d7b56,_0x440dc9,_0xfbe2d4,_0x414842,_0x20808e){return new Promise(function(_0x277ead,_0x207aa1){return getAuthToken(_0x5d7b56,_0xfbe2d4,_0x20808e)[_0x1414('0x13')](function(_0x1596bc){var _0x52d4b8={'method':'GET','uri':_0x414842+_0x1414('0x1a'),'headers':{'Authorization':_0x1414('0x1b')+_0x1596bc,'OData-Version':'4.0'},'json':!![]};return rp(_0x52d4b8);})[_0x1414('0x13')](function(_0x4d4a29){var _0xa31c34=_0x4d4a29[_0x1414('0x1c')];var _0x4418c7=![];var _0x1beeef=null;if(!_[_0x1414('0x1d')](_0x440dc9)){if(intUtil[_0x1414('0x1e')](_0x440dc9['email'])){_0x529bf2['userEmail']=_0x440dc9['email'];for(_0x1beeef=0x0;_0x1beeef<_0xa31c34['length'];_0x1beeef++){if(_0xa31c34[_0x1beeef]['internalemailaddress']===_0x440dc9[_0x1414('0x1f')]&&!_0xa31c34[_0x1beeef]['isdisabled']){_0x4418c7=!![];logger[_0x1414('0x20')]('['+[_0x20808e[_0x1414('0x17')]()]+']\x20Agent\x20found\x20'+_0xa31c34[_0x1beeef][_0x1414('0x21')]+'!');_0x529bf2[_0x1414('0x22')]=_0xa31c34[_0x1beeef][_0x1414('0x21')];}}}}if(!_0x4418c7){logger[_0x1414('0x20')]('['+[_0x20808e['toUpperCase']()]+_0x1414('0x23'));_0x529bf2[_0x1414('0x24')]=_0x5d7b56['username'];for(_0x1beeef=0x0;_0x1beeef<_0xa31c34[_0x1414('0x25')];_0x1beeef++){if(_0xa31c34[_0x1beeef]['internalemailaddress']===_0x5d7b56[_0x1414('0x11')]){_0x529bf2['userId']=_0xa31c34[_0x1beeef][_0x1414('0x21')];}}}_0x277ead(_0x529bf2);})[_0x1414('0x15')](function(_0x221f47){_0x207aa1(_0x221f47[_0x1414('0x19')]);});});}function createEndUser(_0xf23c65,_0x3bc4a0,_0x4ab698,_0x2dae64,_0x221ddb,_0x84d7e,_0x2fd24a){return new Promise(function(_0x4846a9,_0x3fad20){return getAuthToken(_0x3bc4a0,_0x4ab698,_0x84d7e)[_0x1414('0x13')](function(_0x4aa500){var _0x25cf0c=_0x84d7e['toLowerCase']()===_0x1414('0x26')?_0x221ddb[_0x1414('0x27')]:_0x221ddb['calleridnum'];var _0xe15ced={'method':'POST','uri':_0x2dae64+'contacts','body':{'fullname':_0x25cf0c,'firstname':_0x25cf0c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0xf23c65[_0x1414('0x22')]+')'},'headers':{'Authorization':_0x1414('0x1b')+_0x4aa500,'OData-Version':_0x1414('0x28')},'json':!![],'resolveWithFullResponse':!![]};_0xe15ced[_0x1414('0x29')][_0x2fd24a]=_0x25cf0c;return rp(_0xe15ced);})['then'](function(_0x58bfdb){var _0xd49eb1=_0x58bfdb[_0x1414('0x2a')][_0x1414('0x2b')];var _0x59d26a=_0xd49eb1['substring'](_0xd49eb1['lastIndexOf']('(')+0x1,_0xd49eb1[_0x1414('0x2c')](')'));_0xf23c65['enduserId']=_0x59d26a;_0x4846a9(_0xf23c65);})[_0x1414('0x15')](function(_0x4a3ec2){_0x3fad20(_0x4a3ec2[_0x1414('0x19')]);});});}function getEndUser(_0x43c035,_0x22078f,_0x256fdf,_0x3cf86b,_0x3762b6,_0x54f4cb,_0x317e92,_0x1cc4a6){var _0x5d91cc=_0x54f4cb[_0x1414('0x2d')]()===_0x1414('0x26')?_0x3762b6[_0x1414('0x27')]:_0x3762b6[_0x1414('0x2e')];return getAuthToken(_0x22078f,_0x256fdf,_0x54f4cb)['then'](function(_0x43cdf9){_0x1cc4a6=_0x1cc4a6?_0x1cc4a6:_0x1414('0x2f');var _0x8b2e31={'method':_0x1414('0x30'),'uri':_0x3cf86b+_0x1414('0x31')+_0x1cc4a6+_0x1414('0x32')+_0x1cc4a6+_0x1414('0x33')+_0x5d91cc['replace']('+',_0x1414('0x34'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x43cdf9,'If-None-Match':null,'OData-Version':_0x1414('0x28')},'json':!![]};return rp(_0x8b2e31);})['then'](function(_0x2e8cfc){var _0xc2da6=![];if(!_0x2e8cfc)return _0xc2da6;var _0x17ea7c=_0x2e8cfc[_0x1414('0x1c')];for(var _0x48cebf=0x0;_0x48cebf<_0x17ea7c[_0x1414('0x25')];_0x48cebf++){if(_0x17ea7c[_0x48cebf][_0x1cc4a6]===_0x5d91cc){_0xc2da6=!![];_0x43c035[_0x1414('0x35')]=_0x17ea7c[_0x48cebf][_0x1414('0x36')];}}return _0xc2da6;})[_0x1414('0x13')](function(_0x2469c8){if(_0x2469c8)return _0x43c035;if(_0x317e92==='nothing'){logger[_0x1414('0x20')]('['+[_0x54f4cb[_0x1414('0x17')]()]+_0x1414('0x37'));return _0x43c035;}return createEndUser(_0x43c035,_0x22078f,_0x256fdf,_0x3cf86b,_0x3762b6,_0x54f4cb,_0x1cc4a6)['then'](function(_0x595901){logger['info']('['+[_0x54f4cb[_0x1414('0x17')]()]+']\x20Enduser\x20created!',_0x595901[_0x1414('0x35')]);return _0x595901;});});}function getCustomFields(_0x1b59e5,_0x145989,_0x2627f8){var _0xb193ad={};if(_0x1b59e5[_0x1414('0x25')]>0x0){_['forEach'](_0x1b59e5,function(_0x3b849a){if(_['includes'](['string',_0x1414('0x38')],_0x3b849a[_0x1414('0x39')])&&_0x3b849a['nameField']&&!_0x3b849a['customField']){var _0x3fc61c=_0x3b849a[_0x1414('0x3a')][_0x1414('0x2d')]();var _0x3922b4=_0x3fc61c[_0x1414('0x3b')](0x0,_0x3fc61c[_0x1414('0x3c')]('_'));var _0x40b940=_0x3fc61c[_0x1414('0x3b')](_0x3fc61c[_0x1414('0x3c')]('_')+0x1);if(_0x3922b4===_0x2627f8){_0xb193ad[_0x40b940]=_0x3b849a[_0x1414('0x3d')];}}});}return _0xb193ad;}function getTicket(_0x40d72a,_0xfa5cc8,_0x3955c9,_0x479147,_0x5303d8,_0x3972f0,_0x2e4e4e){return new Promise(function(_0xa5f3ad,_0x2e7e2c){var _0x112a81;return getAuthToken(_0xfa5cc8,_0x3955c9,_0x2e4e4e)[_0x1414('0x13')](function(_0x1fa7ea){if(_0x3972f0[_0x1414('0x3e')]===_0x1414('0x3f')){_0x112a81={'method':'POST','uri':_0x479147+'incidents','body':Object[_0x1414('0x40')]({},{'title':intUtil[_0x1414('0x41')](_0x3972f0['Subjects'],_0x5303d8,'\x20'),'description':intUtil[_0x1414('0x41')](_0x3972f0['Descriptions'],_0x5303d8,'\x0a'),'customerid_contact@odata.bind':_0x40d72a[_0x1414('0x35')]?_0x1414('0x42')+_0x40d72a[_0x1414('0x35')]+')':undefined,'ownerid@odata.bind':_0x1414('0x43')+_0x40d72a[_0x1414('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x3972f0['Fields'],_0x5303d8,_0x3972f0[_0x1414('0x3e')])),'headers':{'Authorization':_0x1414('0x1b')+_0x1fa7ea,'OData-Version':_0x1414('0x28')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3972f0[_0x1414('0x3e')]===_0x1414('0x44')){var _0x4a9897=_0x40d72a[_0x1414('0x35')]?[{'partyid_systemuser@odata.bind':_0x1414('0x43')+_0x40d72a[_0x1414('0x22')]+')','participationtypemask':_0x40d72a[_0x1414('0x45')]===_0x1414('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x1414('0x42')+_0x40d72a[_0x1414('0x35')]+')','participationtypemask':_0x40d72a[_0x1414('0x45')]===_0x1414('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x1414('0x43')+_0x40d72a[_0x1414('0x22')]+')','participationtypemask':_0x40d72a['callDirection']==='queue'?0x2:0x1}];_0x112a81={'method':_0x1414('0x47'),'uri':_0x479147+_0x1414('0x48'),'body':Object['assign']({},{'subject':intUtil[_0x1414('0x41')](_0x3972f0['Subjects'],_0x5303d8,'\x20'),'phonenumber':String(_0x5303d8[_0x1414('0x2e')]),'description':intUtil[_0x1414('0x41')](_0x3972f0[_0x1414('0x49')],_0x5303d8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x40d72a[_0x1414('0x35')]?_0x1414('0x42')+_0x40d72a['enduserId']+')':undefined,'ownerid@odata.bind':_0x1414('0x43')+_0x40d72a[_0x1414('0x22')]+')','directioncode':_0x40d72a[_0x1414('0x45')]===_0x1414('0x46')?![]:!![],'phonecall_activity_parties':_0x4a9897},getCustomFields(_0x3972f0[_0x1414('0x4a')],_0x5303d8,_0x3972f0[_0x1414('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x1fa7ea,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x112a81);})[_0x1414('0x13')](function(_0x517431){var _0x1cab24=_0x517431[_0x1414('0x2a')][_0x1414('0x2b')];var _0xa3210c=_0x1cab24[_0x1414('0x3b')](_0x1cab24[_0x1414('0x2c')]('(')+0x1,_0x1cab24[_0x1414('0x2c')](')'));_0x40d72a[_0x1414('0x4b')]=_0xa3210c;_0xa5f3ad(_0x40d72a);})[_0x1414('0x15')](function(_0x44d129){_0x2e7e2c(_0x44d129[_0x1414('0x19')]);});});}function emit(_0x484f9f,_0x5dca3b,_0x4166fb,_0x3d46ef){var _0x4a33cf={'uri':util[_0x1414('0x4c')](_0x1414('0x4d'),_0x484f9f,_0x4166fb,_0x3d46ef)};io['to'](util[_0x1414('0x4c')](_0x1414('0x4e'),_0x5dca3b))['emit'](_0x1414('0x4f'),_0x4a33cf);}exports['cs']=function(_0x4c6c6c,_0x202f06,_0x327b66,_0x3d66b1,_0x9fd648,_0x4595a0,_0x46f910,_0x381f87){var _0x564d9c={};_0x4595a0[_0x1414('0x10')]=_0x4595a0['modernAuthentication']?intUtil[_0x1414('0x50')](_0x4595a0['CloudProvider'][_0x1414('0xc')]):intUtil[_0x1414('0x50')](_0x4595a0[_0x1414('0x10')]);_0x4595a0[_0x1414('0x51')]=intUtil[_0x1414('0x50')](_0x4595a0[_0x1414('0x51')]);_0x564d9c[_0x1414('0x45')]=_0x381f87===_0x1414('0x46')||_0x381f87===_0x1414('0x52')?_0x1414('0x46'):_0x1414('0x26');var _0x11c38f=_0x4595a0['modernAuthentication']?util['format'](_0x1414('0x53'),_0x4595a0[_0x1414('0xb')][_0x1414('0xc')]):util['format'](_0x1414('0x53'),_0x4595a0[_0x1414('0x10')]);var _0x1c283c=util[_0x1414('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4595a0['tenantId']);var _0x248fce=util[_0x1414('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4595a0[_0x1414('0x51')],_0x202f06[_0x1414('0x54')],md5(_0x202f06[_0x1414('0x54')]));if(_0x9fd648&&_0x9fd648['monitor_format']){logger[_0x1414('0x20')](_0x1414('0x55'),_0x1414('0x56'));_0x202f06[_0x1414('0x57')]=_0x248fce;}else if(_0x46f910&&_0x46f910[_0x1414('0x58')]&&_0x46f910[_0x1414('0x58')]!==_0x1414('0x59')){logger[_0x1414('0x20')](_0x1414('0x5a'),_0x1414('0x56'));_0x202f06[_0x1414('0x57')]=_0x248fce;}else{_0x202f06[_0x1414('0x57')]='';}return getUser(_0x564d9c,_0x4595a0,_0x3d66b1,_0x1c283c,_0x11c38f,_0x381f87)[_0x1414('0x13')](function(_0x7fa81a){logger[_0x1414('0x20')]('['+_0x381f87[_0x1414('0x17')]()+_0x1414('0x5b'),_0x7fa81a['userId']);logger[_0x1414('0x20')]('['+_0x381f87['toUpperCase']()+_0x1414('0x5c'),_0x7fa81a['userEmail']);return getEndUser(_0x7fa81a,_0x4595a0,_0x1c283c,_0x11c38f,_0x202f06,_0x381f87,_0x327b66[_0x1414('0x5d')],_0x327b66[_0x1414('0x5e')]);})[_0x1414('0x13')](function(_0x3217ed){logger[_0x1414('0x20')]('['+_0x381f87[_0x1414('0x17')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x3217ed[_0x1414('0x35')]);logger[_0x1414('0x20')]('['+_0x381f87[_0x1414('0x17')]()+_0x1414('0x5f'),_0x202f06['calleridnum']);return getTicket(_0x3217ed,_0x4595a0,_0x1c283c,_0x11c38f,_0x202f06,_0x327b66,_0x381f87);})['then'](function(_0x283114){logger[_0x1414('0x20')](util[_0x1414('0x4c')]('['+_0x381f87[_0x1414('0x17')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x327b66[_0x1414('0x3e')],_0x283114[_0x1414('0x4b')]));logger['info'](util[_0x1414('0x4c')]('['+_0x381f87[_0x1414('0x17')]()+_0x1414('0x60'),_0x381f87));if(_0x381f87!=='unmanaged'&&_0x327b66[_0x1414('0x61')]){logger['info']('['+_0x381f87['toUpperCase']()+']',_0x1414('0x62'));emit(_0x4595a0[_0x1414('0x10')],_0x3d66b1['name'],_0x327b66[_0x1414('0x3e')],_0x283114[_0x1414('0x4b')]);}})[_0x1414('0x15')](function(_0x2b4e47){logger[_0x1414('0x16')]('['+_0x381f87['toUpperCase']()+_0x1414('0x63'),_0x2b4e47[_0x1414('0x19')]);console['error'](_0x1414('0x64'),_0x2b4e47);});}; \ 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 b625761..5875ec5 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 _0x2d64=['custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','map','includes','string','picklist','type','nameField','customField','content','idField','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:browser:url','%s/helpdesk/tickets/%d','error','unmanaged','toUpperCase','The\x20Ticket\x20ID\x20is:','lastevent','lodash','request-promise','md5','ioredis','./util','defaults','localhost','socket.io-emitter','redis','application/json','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','Tags','name','Fields'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x2d64,0x15b));var _0x42d6=function(_0x4ca0c8,_0x579226){_0x4ca0c8=_0x4ca0c8-0x0;var _0x522a89=_0x2d64[_0x4ca0c8];return _0x522a89;};'use strict';var _=require(_0x42d6('0x0'));var rp=require(_0x42d6('0x1'));var md5=require(_0x42d6('0x2'));var util=require('util');var Redis=require(_0x42d6('0x3'));var intUtil=require(_0x42d6('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config['redis']=_[_0x42d6('0x5')](config['redis'],{'host':_0x42d6('0x6'),'port':0x18eb});var io=require(_0x42d6('0x7'))(new Redis(config[_0x42d6('0x8')]));var headers={'Content-Type':_0x42d6('0x9'),'Accept':_0x42d6('0x9')};function emit(_0xea8ff2,_0x55ecbe,_0x2be571){io['to'](_0xea8ff2)['emit'](_0x55ecbe,_0x2be571);}function getTicket(_0x3b881d,_0x595607,_0x52043e,_0x1c33b1,_0x3e952d){logger[_0x42d6('0xa')](_0x42d6('0xb'));var _0x2a500d=_['merge']({'responder_id':_0x595607['id'],'requester_id':_0x52043e['id'],'name':util[_0x42d6('0xc')](_0x42d6('0xd'),_0x3e952d[_0x42d6('0xe')]),'phone':_0x3e952d['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x42d6('0xf')](_0x1c33b1[_0x42d6('0x10')],_0x3e952d,'\x20'),'description':intUtil[_0x42d6('0xf')](_0x1c33b1[_0x42d6('0x11')],_0x3e952d,'
'),'tags':getTags(_0x1c33b1[_0x42d6('0x12')],_0x42d6('0x13'))},getCustomFields(_0x1c33b1[_0x42d6('0x14')],_0x3e952d));_0x2a500d[_0x42d6('0x15')]=_[_0x42d6('0x16')](_[_0x42d6('0x17')](_0x2a500d[_0x42d6('0x15')],'id'),_0x42d6('0x18'));return request({'uri':util[_0x42d6('0xc')](_0x42d6('0x19'),_0x3b881d[_0x42d6('0x1a')]),'method':_0x42d6('0x1b'),'body':_0x2a500d})['then'](function(_0x1a10d2){logger[_0x42d6('0xa')](_0x42d6('0x1c'));return _0x1a10d2;});}function getUser(_0x41f3e8,_0x394c93){if(intUtil[_0x42d6('0x1d')](_0x394c93)){return request({'uri':util['format']('%s/api/v2/agents',_0x41f3e8[_0x42d6('0x1a')]),'qs':{'email':_0x394c93}})[_0x42d6('0x1e')](function(_0x24c503){if(_0x24c503[_0x42d6('0x1f')]){logger['info'](_0x42d6('0x20'));return _['find'](_0x24c503,function(_0x43214a){return _0x43214a[_0x42d6('0x21')]['email']===_0x394c93;});}else{logger[_0x42d6('0xa')](_0x42d6('0x22'));return request({'uri':util[_0x42d6('0xc')](_0x42d6('0x23'),_0x41f3e8[_0x42d6('0x1a')])})['then'](function(_0x5e2c02){logger[_0x42d6('0xa')](_0x42d6('0x24'));return _0x5e2c02;});}});}else{logger[_0x42d6('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x42d6('0xc')](_0x42d6('0x23'),_0x41f3e8[_0x42d6('0x1a')])})[_0x42d6('0x1e')](function(_0x3712f7){logger[_0x42d6('0xa')]('Admin\x20account\x20selected.');return _0x3712f7;});}}function getEndUser(_0x55aa4a,_0x23363f,_0x47e3f2){logger[_0x42d6('0xa')](_0x42d6('0x25'),_0x47e3f2);return request({'uri':util[_0x42d6('0xc')]('%s/api/v2/contacts',_0x55aa4a[_0x42d6('0x1a')]),'qs':{'phone':_0x47e3f2}})[_0x42d6('0x1e')](function(_0xbf421a){if(_0xbf421a[_0x42d6('0x1f')]){logger[_0x42d6('0xa')]('Enduser\x20found!');return _[_0x42d6('0x26')](_0xbf421a,{'phone':_0x47e3f2});}else{logger[_0x42d6('0xa')](_0x42d6('0x27'));return request({'uri':util[_0x42d6('0xc')](_0x42d6('0x28'),_0x55aa4a[_0x42d6('0x1a')]),'method':'POST','body':{'name':_0x23363f,'phone':_0x47e3f2}})['then'](function(_0x4baff7){logger['info']('Enduser\x20created.');return _0x4baff7;});}});}function getAuth(_0x3640dc){return util[_0x42d6('0xc')](_0x42d6('0x29'),new Buffer(_0x3640dc[_0x42d6('0x2a')]+':X')['toString'](_0x42d6('0x2b')));}function request(_0x26c176){logger[_0x42d6('0x2c')](_0x42d6('0x2d'),JSON[_0x42d6('0x2e')](_0x26c176));return rp(_['defaults'](_0x26c176,{'method':_0x42d6('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0xae869a,_0x1fbcaf){var _0x74ee93=[];if(_0xae869a&&_0xae869a[_0x42d6('0x1f')]>0x0){_0x74ee93=_[_0x42d6('0x30')](_0xae869a,_0x1fbcaf);}return _0x74ee93;}function getCustomFields(_0x3fab88,_0x51eeea){var _0x3b9032=[];var _0x5adbb4={'custom_fields':[]};if(_0x3fab88['length']>0x0){_['forEach'](_0x3fab88,function(_0x34ed1e){if(_[_0x42d6('0x31')]([_0x42d6('0x32'),_0x42d6('0x33')],_0x34ed1e[_0x42d6('0x34')])&&_0x34ed1e[_0x42d6('0x35')]&&!_0x34ed1e[_0x42d6('0x36')]){_0x5adbb4[_0x34ed1e[_0x42d6('0x35')]['toLowerCase']()]=_0x34ed1e[_0x42d6('0x37')]['toString']();}else if(_[_0x42d6('0x31')]([_0x42d6('0x32'),_0x42d6('0x33')],_0x34ed1e[_0x42d6('0x34')])&&_0x34ed1e['idField']&&_0x34ed1e[_0x42d6('0x36')]){_0x5adbb4[_0x42d6('0x15')]['push']({'id':_0x34ed1e[_0x42d6('0x38')],'value':_0x34ed1e[_0x42d6('0x37')]['toString']()});}else if(_0x34ed1e['type']===_0x42d6('0x39')&&_0x34ed1e[_0x42d6('0x3a')]&&_0x34ed1e['idField']&&_0x34ed1e[_0x42d6('0x36')]){_0x51eeea[_0x34ed1e[_0x42d6('0x3a')]]&&_0x5adbb4['custom_fields'][_0x42d6('0x3b')]({'id':_0x34ed1e[_0x42d6('0x38')],'value':_0x51eeea[_0x34ed1e[_0x42d6('0x3a')]]['toString']()});}else if(_0x34ed1e[_0x42d6('0x34')]===_0x42d6('0x3c')&&_0x34ed1e[_0x42d6('0x3d')]&&_0x34ed1e[_0x42d6('0x3d')][_0x42d6('0x13')]&&_0x34ed1e[_0x42d6('0x38')]&&_0x34ed1e[_0x42d6('0x36')]){_0x51eeea[_0x34ed1e[_0x42d6('0x3d')][_0x42d6('0x13')]['toLowerCase']()]&&_0x5adbb4[_0x42d6('0x15')]['push']({'id':_0x34ed1e[_0x42d6('0x38')],'value':_0x51eeea[_0x34ed1e[_0x42d6('0x3d')][_0x42d6('0x13')][_0x42d6('0x3e')]()]['toString']()});}});}return _0x5adbb4;}exports[_0x42d6('0x3f')]=function(_0x466fd7,_0x4f68a4,_0x3b7218,_0x5ba8f2,_0x11e143,_0x5d1903){var _0x18538d,_0x418fbd;_0x5d1903[_0x42d6('0x1a')]=intUtil[_0x42d6('0x40')](_0x5d1903['remoteUri']);_0x5d1903[_0x42d6('0x41')]=intUtil[_0x42d6('0x40')](_0x5d1903[_0x42d6('0x41')]);if(_0x11e143&&_0x11e143[_0x42d6('0x42')]){logger[_0x42d6('0xa')](_0x42d6('0x43'),_0x42d6('0x44'));_0x4f68a4[_0x42d6('0x45')]=util[_0x42d6('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d1903['serverUrl'],_0x4f68a4['uniqueid'],md5(_0x4f68a4[_0x42d6('0x46')]));}else{_0x4f68a4[_0x42d6('0x45')]='';}headers[_0x42d6('0x47')]=getAuth(_0x5d1903);return getUser(_0x5d1903,_0x5ba8f2['email'])['then'](function(_0x44101c){_0x18538d=_0x44101c;logger[_0x42d6('0xa')](_0x42d6('0x48'),_0x18538d['id']);return getEndUser(_0x5d1903,_0x4f68a4[_0x42d6('0xe')],_0x4f68a4[_0x42d6('0x49')]);})[_0x42d6('0x1e')](function(_0x1315f0){_0x418fbd=_0x1315f0;logger[_0x42d6('0xa')]('The\x20Enduser\x20ID\x20is:',_0x418fbd['id']);return getTicket(_0x5d1903,_0x18538d,_0x418fbd,_0x3b7218,_0x4f68a4);})['then'](function(_0x3c3bbd){if(_0x3c3bbd&&_0x3c3bbd['id']){logger['info']('Ticket\x20created!');logger[_0x42d6('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3c3bbd['id']);logger[_0x42d6('0xa')](_0x42d6('0x43'),_0x42d6('0x4a'));emit(util[_0x42d6('0xc')](_0x42d6('0x4b'),_0x5ba8f2['name']),'trigger:browser:url',{'uri':util[_0x42d6('0xc')]('%s/helpdesk/tickets/%d',_0x5d1903[_0x42d6('0x1a')],_0x3c3bbd['id'])});}})[_0x42d6('0x4c')](function(_0x10bc44){logger['error'](_0x42d6('0x43'),JSON[_0x42d6('0x2e')](_0x10bc44));});};exports[_0x42d6('0x4d')]=function(_0x3bb6d4,_0x417a90,_0x35baa6,_0x26f94c,_0x49fb1a,_0x2d3fd4,_0x490b7e){var _0x4460e1,_0x537a9b;_0x2d3fd4[_0x42d6('0x1a')]=intUtil['stripTrailingSlash'](_0x2d3fd4['remoteUri']);_0x2d3fd4[_0x42d6('0x41')]=intUtil[_0x42d6('0x40')](_0x2d3fd4['serverUrl']);if(_0x490b7e&&_0x490b7e[_0x42d6('0x4e')]&&_0x490b7e[_0x42d6('0x4e')]!==_0x42d6('0x4f')){logger[_0x42d6('0xa')](_0x42d6('0x50'),'Recording\x20is\x20enabled!');_0x417a90[_0x42d6('0x45')]=util[_0x42d6('0xc')](_0x42d6('0x51'),_0x2d3fd4[_0x42d6('0x41')],_0x417a90[_0x42d6('0x46')],md5(_0x417a90[_0x42d6('0x46')]));}headers[_0x42d6('0x47')]=getAuth(_0x2d3fd4);return getUser(_0x2d3fd4,_0x26f94c['email'])[_0x42d6('0x1e')](function(_0x5083c6){_0x4460e1=_0x5083c6;logger[_0x42d6('0xa')](_0x42d6('0x48'),_0x4460e1['id']);return getEndUser(_0x2d3fd4,_0x417a90[_0x42d6('0x52')],_0x417a90[_0x42d6('0x53')]);})[_0x42d6('0x1e')](function(_0xd87292){_0x537a9b=_0xd87292;logger[_0x42d6('0xa')](_0x42d6('0x54'),_0x537a9b['id']);return getTicket(_0x2d3fd4,_0x4460e1,_0x537a9b,_0x35baa6,_0x417a90);})[_0x42d6('0x1e')](function(_0x4db027){if(_0x4db027&&_0x4db027['id']){logger[_0x42d6('0xa')]('Ticket\x20created!');logger[_0x42d6('0xa')]('The\x20Ticket\x20ID\x20is:',_0x4db027['id']);logger[_0x42d6('0xa')](_0x42d6('0x50'),_0x42d6('0x4a'));emit(util[_0x42d6('0xc')](_0x42d6('0x4b'),_0x26f94c['name']),_0x42d6('0x55'),{'uri':util['format'](_0x42d6('0x56'),_0x2d3fd4[_0x42d6('0x1a')],_0x4db027['id'])});}})[_0x42d6('0x4c')](function(_0x511a4e){logger[_0x42d6('0x57')](_0x42d6('0x50'),JSON[_0x42d6('0x2e')](_0x511a4e));});};exports[_0x42d6('0x58')]=function(_0x24c817,_0x5620d5,_0x592ae7,_0x210898,_0xc9fde,_0x1f140d){var _0x357066,_0x202d6d;_0x1f140d['remoteUri']=intUtil[_0x42d6('0x40')](_0x1f140d[_0x42d6('0x1a')]);_0x1f140d[_0x42d6('0x41')]=intUtil[_0x42d6('0x40')](_0x1f140d[_0x42d6('0x41')]);if(_0xc9fde&&_0xc9fde[_0x42d6('0x42')]){logger['info']('['+_0x5620d5['lastevent'][_0x42d6('0x59')]()+']',_0x42d6('0x44'));_0x5620d5[_0x42d6('0x45')]=util[_0x42d6('0xc')](_0x42d6('0x51'),_0x1f140d['serverUrl'],_0x5620d5['uniqueid'],md5(_0x5620d5[_0x42d6('0x46')]));}else{_0x5620d5[_0x42d6('0x45')]='';}headers['Authorization']=getAuth(_0x1f140d);return getUser(_0x1f140d,'')[_0x42d6('0x1e')](function(_0x1a2db0){_0x357066=_0x1a2db0;logger[_0x42d6('0xa')](_0x42d6('0x48'),_0x357066['id']);return getEndUser(_0x1f140d,_0x5620d5[_0x42d6('0xe')],_0x5620d5['calleridnum']);})[_0x42d6('0x1e')](function(_0x3d7953){_0x202d6d=_0x3d7953;logger['info'](_0x42d6('0x54'),_0x202d6d['id']);return getTicket(_0x1f140d,_0x357066,_0x202d6d,_0x592ae7,_0x5620d5);})[_0x42d6('0x1e')](function(_0x1dc2a0){if(_0x1dc2a0){logger['info']('Ticket\x20created!');logger['info'](_0x42d6('0x5a'),_0x1dc2a0['id']);}})[_0x42d6('0x4c')](function(_0x2461dd){logger[_0x42d6('0x57')]('['+_0x5620d5[_0x42d6('0x5b')][_0x42d6('0x59')]()+']',JSON[_0x42d6('0x2e')](_0x2461dd));});}; \ No newline at end of file +var _0xa528=['%s/api/v2/agents','remoteUri','length','find','contact','email','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','toString','base64','[HTTP]','stringify','GET','map','includes','string','picklist','customField','nameField','toLowerCase','content','type','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','lastevent','calleridname','toUpperCase','lodash','request-promise','md5','ioredis','./util','redis','defaults','localhost','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','getString','Subjects','
','Tags','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','validateEmail'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa528,0x92));var _0x8a52=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0xa528[_0x5cc3d4];return _0x17ca31;};'use strict';var _=require(_0x8a52('0x0'));var rp=require(_0x8a52('0x1'));var md5=require(_0x8a52('0x2'));var util=require('util');var Redis=require(_0x8a52('0x3'));var intUtil=require(_0x8a52('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshdesk');config[_0x8a52('0x5')]=_[_0x8a52('0x6')](config[_0x8a52('0x5')],{'host':_0x8a52('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8a52('0x5')]));var headers={'Content-Type':_0x8a52('0x8'),'Accept':_0x8a52('0x8')};function emit(_0x32d5e,_0x35d018,_0x3c64a6){io['to'](_0x32d5e)['emit'](_0x35d018,_0x3c64a6);}function getTicket(_0x21469f,_0x4bfffa,_0x3b1845,_0x8082aa,_0x4b9454){logger['info'](_0x8a52('0x9'));var _0x9c6930=_[_0x8a52('0xa')]({'responder_id':_0x4bfffa['id'],'requester_id':_0x3b1845['id'],'name':util[_0x8a52('0xb')](_0x8a52('0xc'),_0x4b9454['calleridname']),'phone':_0x4b9454['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8a52('0xd')](_0x8082aa[_0x8a52('0xe')],_0x4b9454,'\x20'),'description':intUtil[_0x8a52('0xd')](_0x8082aa['Descriptions'],_0x4b9454,_0x8a52('0xf')),'tags':getTags(_0x8082aa[_0x8a52('0x10')],_0x8a52('0x11'))},getCustomFields(_0x8082aa[_0x8a52('0x12')],_0x4b9454));_0x9c6930[_0x8a52('0x13')]=_[_0x8a52('0x14')](_[_0x8a52('0x15')](_0x9c6930[_0x8a52('0x13')],'id'),'value');return request({'uri':util['format'](_0x8a52('0x16'),_0x21469f['remoteUri']),'method':_0x8a52('0x17'),'body':_0x9c6930})[_0x8a52('0x18')](function(_0x11dd86){logger[_0x8a52('0x19')](_0x8a52('0x1a'));return _0x11dd86;});}function getUser(_0xd4c4a5,_0x141041){if(intUtil[_0x8a52('0x1b')](_0x141041)){return request({'uri':util[_0x8a52('0xb')](_0x8a52('0x1c'),_0xd4c4a5[_0x8a52('0x1d')]),'qs':{'email':_0x141041}})[_0x8a52('0x18')](function(_0x71f7fd){if(_0x71f7fd[_0x8a52('0x1e')]){logger[_0x8a52('0x19')]('Agent\x20found!');return _[_0x8a52('0x1f')](_0x71f7fd,function(_0x106f98){return _0x106f98[_0x8a52('0x20')][_0x8a52('0x21')]===_0x141041;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8a52('0xb')]('%s/api/v2/agents/me',_0xd4c4a5[_0x8a52('0x1d')])})[_0x8a52('0x18')](function(_0x1792fd){logger[_0x8a52('0x19')]('Admin\x20account\x20selected.');return _0x1792fd;});}});}else{logger['info'](_0x8a52('0x22'));return request({'uri':util[_0x8a52('0xb')](_0x8a52('0x23'),_0xd4c4a5[_0x8a52('0x1d')])})[_0x8a52('0x18')](function(_0xafef81){logger['info']('Admin\x20account\x20selected.');return _0xafef81;});}}function getEndUser(_0x51ce6d,_0x4a1df1,_0x4f3660){logger[_0x8a52('0x19')](_0x8a52('0x24'),_0x4f3660);return request({'uri':util[_0x8a52('0xb')]('%s/api/v2/contacts',_0x51ce6d[_0x8a52('0x1d')]),'qs':{'phone':_0x4f3660}})[_0x8a52('0x18')](function(_0x2f0567){if(_0x2f0567['length']){logger[_0x8a52('0x19')]('Enduser\x20found!');return _['find'](_0x2f0567,{'phone':_0x4f3660});}else{logger[_0x8a52('0x19')](_0x8a52('0x25'));return request({'uri':util[_0x8a52('0xb')]('%s/api/v2/contacts',_0x51ce6d['remoteUri']),'method':'POST','body':{'name':_0x4a1df1,'phone':_0x4f3660}})['then'](function(_0x452e43){logger[_0x8a52('0x19')](_0x8a52('0x26'));return _0x452e43;});}});}function getAuth(_0x18a5b6){return util[_0x8a52('0xb')]('Basic\x20%s',new Buffer(_0x18a5b6['apiKey']+':X')[_0x8a52('0x27')](_0x8a52('0x28')));}function request(_0x5357bb){logger['debug'](_0x8a52('0x29'),JSON[_0x8a52('0x2a')](_0x5357bb));return rp(_[_0x8a52('0x6')](_0x5357bb,{'method':_0x8a52('0x2b'),'headers':headers,'json':!![]}));}function getTags(_0x513531,_0x4bbf94){var _0x289828=[];if(_0x513531&&_0x513531['length']>0x0){_0x289828=_[_0x8a52('0x2c')](_0x513531,_0x4bbf94);}return _0x289828;}function getCustomFields(_0x2a8651,_0x24d2b4){var _0x48ac9b=[];var _0x27d756={'custom_fields':[]};if(_0x2a8651[_0x8a52('0x1e')]>0x0){_['forEach'](_0x2a8651,function(_0x5b80a4){if(_[_0x8a52('0x2d')]([_0x8a52('0x2e'),_0x8a52('0x2f')],_0x5b80a4['type'])&&_0x5b80a4['nameField']&&!_0x5b80a4[_0x8a52('0x30')]){_0x27d756[_0x5b80a4[_0x8a52('0x31')][_0x8a52('0x32')]()]=_0x5b80a4[_0x8a52('0x33')][_0x8a52('0x27')]();}else if(_[_0x8a52('0x2d')]([_0x8a52('0x2e'),_0x8a52('0x2f')],_0x5b80a4[_0x8a52('0x34')])&&_0x5b80a4[_0x8a52('0x35')]&&_0x5b80a4['customField']){_0x27d756['custom_fields'][_0x8a52('0x36')]({'id':_0x5b80a4[_0x8a52('0x35')],'value':_0x5b80a4['content'][_0x8a52('0x27')]()});}else if(_0x5b80a4[_0x8a52('0x34')]===_0x8a52('0x37')&&_0x5b80a4[_0x8a52('0x38')]&&_0x5b80a4[_0x8a52('0x35')]&&_0x5b80a4[_0x8a52('0x30')]){_0x24d2b4[_0x5b80a4[_0x8a52('0x38')]]&&_0x27d756[_0x8a52('0x13')][_0x8a52('0x36')]({'id':_0x5b80a4[_0x8a52('0x35')],'value':_0x24d2b4[_0x5b80a4[_0x8a52('0x38')]][_0x8a52('0x27')]()});}else if(_0x5b80a4[_0x8a52('0x34')]===_0x8a52('0x39')&&_0x5b80a4[_0x8a52('0x3a')]&&_0x5b80a4[_0x8a52('0x3a')][_0x8a52('0x11')]&&_0x5b80a4[_0x8a52('0x35')]&&_0x5b80a4[_0x8a52('0x30')]){_0x24d2b4[_0x5b80a4[_0x8a52('0x3a')][_0x8a52('0x11')][_0x8a52('0x32')]()]&&_0x27d756[_0x8a52('0x13')][_0x8a52('0x36')]({'id':_0x5b80a4[_0x8a52('0x35')],'value':_0x24d2b4[_0x5b80a4[_0x8a52('0x3a')][_0x8a52('0x11')][_0x8a52('0x32')]()][_0x8a52('0x27')]()});}});}return _0x27d756;}exports[_0x8a52('0x3b')]=function(_0x5f05bc,_0x19a234,_0x156699,_0x4e8277,_0x1f7ee5,_0x55bfae){var _0x23a433,_0x3f9626;_0x55bfae[_0x8a52('0x1d')]=intUtil[_0x8a52('0x3c')](_0x55bfae[_0x8a52('0x1d')]);_0x55bfae[_0x8a52('0x3d')]=intUtil[_0x8a52('0x3c')](_0x55bfae['serverUrl']);if(_0x1f7ee5&&_0x1f7ee5[_0x8a52('0x3e')]){logger[_0x8a52('0x19')](_0x8a52('0x3f'),_0x8a52('0x40'));_0x19a234[_0x8a52('0x41')]=util[_0x8a52('0xb')](_0x8a52('0x42'),_0x55bfae[_0x8a52('0x3d')],_0x19a234['uniqueid'],md5(_0x19a234[_0x8a52('0x43')]));}else{_0x19a234[_0x8a52('0x41')]='';}headers[_0x8a52('0x44')]=getAuth(_0x55bfae);return getUser(_0x55bfae,_0x4e8277['email'])[_0x8a52('0x18')](function(_0x4cdf12){_0x23a433=_0x4cdf12;logger['info'](_0x8a52('0x45'),_0x23a433['id']);return getEndUser(_0x55bfae,_0x19a234['calleridname'],_0x19a234[_0x8a52('0x46')]);})[_0x8a52('0x18')](function(_0x309ad5){_0x3f9626=_0x309ad5;logger[_0x8a52('0x19')](_0x8a52('0x47'),_0x3f9626['id']);return getTicket(_0x55bfae,_0x23a433,_0x3f9626,_0x156699,_0x19a234);})[_0x8a52('0x18')](function(_0x426a07){if(_0x426a07&&_0x426a07['id']){logger[_0x8a52('0x19')]('Ticket\x20created!');logger[_0x8a52('0x19')](_0x8a52('0x48'),_0x426a07['id']);logger[_0x8a52('0x19')](_0x8a52('0x3f'),_0x8a52('0x49'));emit(util[_0x8a52('0xb')](_0x8a52('0x4a'),_0x4e8277[_0x8a52('0x11')]),_0x8a52('0x4b'),{'uri':util['format'](_0x8a52('0x4c'),_0x55bfae[_0x8a52('0x1d')],_0x426a07['id'])});}})[_0x8a52('0x4d')](function(_0x18f50f){logger[_0x8a52('0x4e')](_0x8a52('0x3f'),JSON[_0x8a52('0x2a')](_0x18f50f));});};exports['outbound']=function(_0x4b8a06,_0x2e1d24,_0x2174dd,_0xa94a85,_0x3f66bb,_0x3324c5,_0x17d4b8){var _0x5d4677,_0x12a1a7;_0x3324c5['remoteUri']=intUtil[_0x8a52('0x3c')](_0x3324c5['remoteUri']);_0x3324c5[_0x8a52('0x3d')]=intUtil[_0x8a52('0x3c')](_0x3324c5[_0x8a52('0x3d')]);if(_0x17d4b8&&_0x17d4b8[_0x8a52('0x4f')]&&_0x17d4b8[_0x8a52('0x4f')]!==_0x8a52('0x50')){logger[_0x8a52('0x19')](_0x8a52('0x51'),'Recording\x20is\x20enabled!');_0x2e1d24[_0x8a52('0x41')]=util[_0x8a52('0xb')](_0x8a52('0x42'),_0x3324c5['serverUrl'],_0x2e1d24['uniqueid'],md5(_0x2e1d24[_0x8a52('0x43')]));}headers['Authorization']=getAuth(_0x3324c5);return getUser(_0x3324c5,_0xa94a85[_0x8a52('0x21')])[_0x8a52('0x18')](function(_0x2c6b7d){_0x5d4677=_0x2c6b7d;logger[_0x8a52('0x19')]('The\x20User\x20ID\x20is:',_0x5d4677['id']);return getEndUser(_0x3324c5,_0x2e1d24[_0x8a52('0x52')],_0x2e1d24[_0x8a52('0x53')]);})[_0x8a52('0x18')](function(_0x60df64){_0x12a1a7=_0x60df64;logger[_0x8a52('0x19')](_0x8a52('0x47'),_0x12a1a7['id']);return getTicket(_0x3324c5,_0x5d4677,_0x12a1a7,_0x2174dd,_0x2e1d24);})[_0x8a52('0x18')](function(_0x2908b2){if(_0x2908b2&&_0x2908b2['id']){logger[_0x8a52('0x19')]('Ticket\x20created!');logger['info'](_0x8a52('0x48'),_0x2908b2['id']);logger['info'](_0x8a52('0x51'),_0x8a52('0x49'));emit(util[_0x8a52('0xb')]('user:%s',_0xa94a85[_0x8a52('0x11')]),'trigger:browser:url',{'uri':util[_0x8a52('0xb')]('%s/helpdesk/tickets/%d',_0x3324c5[_0x8a52('0x1d')],_0x2908b2['id'])});}})[_0x8a52('0x4d')](function(_0x4df41a){logger[_0x8a52('0x4e')](_0x8a52('0x51'),JSON[_0x8a52('0x2a')](_0x4df41a));});};exports['unmanaged']=function(_0x46d9d1,_0x53fc6c,_0x404706,_0x5d5dcc,_0xbd1a31,_0x629a3e){var _0x3af20b,_0xf1f016;_0x629a3e[_0x8a52('0x1d')]=intUtil[_0x8a52('0x3c')](_0x629a3e[_0x8a52('0x1d')]);_0x629a3e['serverUrl']=intUtil[_0x8a52('0x3c')](_0x629a3e[_0x8a52('0x3d')]);if(_0xbd1a31&&_0xbd1a31[_0x8a52('0x3e')]){logger['info']('['+_0x53fc6c[_0x8a52('0x54')]['toUpperCase']()+']',_0x8a52('0x40'));_0x53fc6c[_0x8a52('0x41')]=util[_0x8a52('0xb')](_0x8a52('0x42'),_0x629a3e[_0x8a52('0x3d')],_0x53fc6c[_0x8a52('0x43')],md5(_0x53fc6c[_0x8a52('0x43')]));}else{_0x53fc6c[_0x8a52('0x41')]='';}headers[_0x8a52('0x44')]=getAuth(_0x629a3e);return getUser(_0x629a3e,'')[_0x8a52('0x18')](function(_0x54a153){_0x3af20b=_0x54a153;logger[_0x8a52('0x19')](_0x8a52('0x45'),_0x3af20b['id']);return getEndUser(_0x629a3e,_0x53fc6c[_0x8a52('0x55')],_0x53fc6c[_0x8a52('0x46')]);})['then'](function(_0x12579c){_0xf1f016=_0x12579c;logger[_0x8a52('0x19')]('The\x20Enduser\x20ID\x20is:',_0xf1f016['id']);return getTicket(_0x629a3e,_0x3af20b,_0xf1f016,_0x404706,_0x53fc6c);})[_0x8a52('0x18')](function(_0x5b9945){if(_0x5b9945){logger[_0x8a52('0x19')](_0x8a52('0x1a'));logger[_0x8a52('0x19')](_0x8a52('0x48'),_0x5b9945['id']);}})[_0x8a52('0x4d')](function(_0x5110cd){logger[_0x8a52('0x4e')]('['+_0x53fc6c[_0x8a52('0x54')][_0x8a52('0x56')]()+']',JSON[_0x8a52('0x2a')](_0x5110cd));});}; \ 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 b1d394c..9786c06 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 _0xf318=['Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','message','Creating\x20new\x20task','/api/tasks','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','Getting\x20user\x20list','users','Getting\x20user\x20with\x20email','agentEmail','email','userId','User\x20found:','Admin\x20selected','userEmail','catch','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','then'];(function(_0x314721,_0x38929f){var _0x4c09b3=function(_0x5c6f2e){while(--_0x5c6f2e){_0x314721['push'](_0x314721['shift']());}};_0x4c09b3(++_0x38929f);}(_0xf318,0xcf));var _0x8f31=function(_0x1bb398,_0x16ed5b){_0x1bb398=_0x1bb398-0x0;var _0x7414cb=_0xf318[_0x1bb398];return _0x7414cb;};'use strict';var _=require(_0x8f31('0x0'));var rp=require(_0x8f31('0x1'));var md5=require(_0x8f31('0x2'));var util=require(_0x8f31('0x3'));var moment=require(_0x8f31('0x4'));var Promise=require(_0x8f31('0x5'));var Redis=require(_0x8f31('0x6'));var intUtil=require(_0x8f31('0x7'));var config=require('../../../../config/environment');var logger=require(_0x8f31('0x8'))(_0x8f31('0x9'));config[_0x8f31('0xa')]=_[_0x8f31('0xb')](config[_0x8f31('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x8f31('0xc'))(new Redis(config['redis']));function getAdminId(_0x57619c,_0x293a66,_0x5225ea,_0x362e3c){return new Promise(function(_0x17a4cf,_0x237cdf){var _0x4d6f34=![];var _0x420dc6={'method':_0x8f31('0xd'),'uri':_0x362e3c+_0x8f31('0xe'),'json':!![]};_0x420dc6[_0x8f31('0xf')]=_0x5225ea;logger[_0x8f31('0x10')]('Getting\x20admin\x20information');return rp(_0x420dc6)['then'](function(_0x52a50e){if(_0x52a50e){var _0x1a776c=_0x52a50e['users'];var _0xa2d20d=null;for(_0xa2d20d=0x0;_0xa2d20d<_0x1a776c[_0x8f31('0x11')];_0xa2d20d++){if(_0x1a776c[_0xa2d20d]['email']===_0x57619c[_0x8f31('0x12')]){_0x57619c[_0x8f31('0x13')]=_0x1a776c[_0xa2d20d]['id'];_0x4d6f34=!![];}}if(_0x4d6f34){logger[_0x8f31('0x10')](_0x8f31('0x14'),_0x57619c[_0x8f31('0x13')]);_0x17a4cf(_0x57619c);}else{_0x237cdf({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x237cdf({'statusCode':0x194,'message':_0x8f31('0x15')});}})['catch'](function(_0x28a8de){logger[_0x8f31('0x16')]('['+[_0x293a66[_0x8f31('0x17')]()]+']',_0x28a8de['message']);_0x237cdf(_0x28a8de);});});}function getUser(_0x1ec640,_0x416d51,_0x58561c){return function(_0x111418){return new Promise(function(_0x25731a,_0x296b1f){var _0x417dc0={'method':_0x8f31('0xd'),'uri':_0x58561c+_0x8f31('0xe'),'json':!![]};_0x417dc0[_0x8f31('0xf')]=_0x416d51;logger[_0x8f31('0x10')](_0x8f31('0x18'));return rp(_0x417dc0)['then'](function(_0x11a1f3){if(_0x11a1f3){var _0x1850c4=_0x11a1f3[_0x8f31('0x19')];var _0x3491dc=![];var _0x1b2140=null;if(_0x111418['agentEmail']!==null){logger[_0x8f31('0x10')](_0x8f31('0x1a'),_0x111418[_0x8f31('0x1b')]);_0x111418['userEmail']=_0x111418[_0x8f31('0x1b')];for(_0x1b2140=0x0;_0x1b2140<_0x1850c4['length'];_0x1b2140++){if(_0x1850c4[_0x1b2140][_0x8f31('0x1c')]===_0x111418[_0x8f31('0x1b')]){_0x3491dc=!![];_0x111418[_0x8f31('0x1d')]=_0x1850c4[_0x1b2140]['id'];logger[_0x8f31('0x10')](_0x8f31('0x1e'),_0x111418['userId']);}}}if(!_0x3491dc){logger[_0x8f31('0x10')](_0x8f31('0x1f'));_0x111418[_0x8f31('0x20')]=_0x111418[_0x8f31('0x12')];_0x111418[_0x8f31('0x1d')]=_0x111418[_0x8f31('0x13')];_0x3491dc=!![];}if(_0x3491dc){_0x25731a(_0x111418);}else{_0x296b1f({'statusCode':0x194,'message':_0x8f31('0x15')});}}else{_0x296b1f({'statusCode':0x194,'message':_0x8f31('0x15')});}})[_0x8f31('0x21')](function(_0x152642){logger['error']('['+[_0x1ec640['toUpperCase']()]+']',_0x152642['message']);_0x296b1f(_0x152642);});});};}function searchContact(_0x321ece,_0x4b371a,_0x442797,_0x1cacea){return new Promise(function(_0x440b76,_0x3f4c33){var _0x4827f2={'method':_0x8f31('0xd'),'headers':_0x4b371a,'uri':_0x321ece+'/api/lookup?q='+_0x1cacea+'&f='+_0x442797+_0x8f31('0x22'),'json':!![]};rp(_0x4827f2)['then'](function(_0xb3dfac){var _0x5b5f77=_[_0x8f31('0x23')](_0xb3dfac[_0x8f31('0x24')]['contacts'],[_0x442797,_0x1cacea]);_0x440b76(_0x5b5f77);})[_0x8f31('0x21')](function(_0x57e7ac){_0x3f4c33(_0x57e7ac);});});}function getEndUser(_0x398c6a,_0x1f76a8,_0x174ddc){return function(_0x29388d){return new Promise(function(_0x304bc5,_0x47dba2){logger[_0x8f31('0x10')](util[_0x8f31('0x25')](_0x8f31('0x26'),_0x29388d['contactNumber']));searchContact(_0x174ddc,_0x1f76a8,_0x8f31('0x27'),_0x29388d[_0x8f31('0x28')])[_0x8f31('0x29')](function(_0x26ee6f){if(_0x26ee6f){_0x29388d['endUserId']=_0x26ee6f['id'];logger[_0x8f31('0x10')](_0x8f31('0x2a'),_0x29388d[_0x8f31('0x2b')]);return _0x304bc5(_0x29388d);}searchContact(_0x174ddc,_0x1f76a8,_0x8f31('0x2c'),_0x29388d['contactNumber'])['then'](function(_0x59a7b3){if(_0x59a7b3){_0x29388d[_0x8f31('0x2b')]=_0x59a7b3['id'];logger[_0x8f31('0x10')](_0x8f31('0x2d'),_0x29388d[_0x8f31('0x2b')]);return _0x304bc5(_0x29388d);}createEndUser(_0x29388d,_0x398c6a,_0x1f76a8,_0x174ddc)[_0x8f31('0x29')](function(_0x4c9634){logger[_0x8f31('0x10')]('Contact\x20created:',_0x4c9634[_0x8f31('0x2b')]);return _0x304bc5(_0x4c9634);});});})[_0x8f31('0x21')](function(_0x1e1f03){_0x47dba2(_0x1e1f03);});});};}function createEndUser(_0x1a8f43,_0x26bc96,_0x527df,_0x5dbcd1){return new Promise(function(_0x15eb37,_0x544c94){var _0x348690=moment();var _0x510d46={'method':_0x8f31('0x2e'),'uri':_0x5dbcd1+_0x8f31('0x2f'),'body':{'contact':{'last_name':_0x1a8f43[_0x8f31('0x28')],'work_number':_0x1a8f43[_0x8f31('0x28')],'mobile_number':_0x1a8f43[_0x8f31('0x28')],'owner_id':_0x1a8f43[_0x8f31('0x1d')],'created_at':_0x348690[_0x8f31('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x510d46[_0x8f31('0xf')]=_0x527df;logger[_0x8f31('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x510d46)[_0x8f31('0x29')](function(_0x15f016){_0x1a8f43['endUserId']=_0x15f016['contact']['id'];_0x15eb37(_0x1a8f43);})[_0x8f31('0x21')](function(_0x21c375){logger[_0x8f31('0x16')]('['+[_0x26bc96[_0x8f31('0x17')]()]+']',_0x21c375[_0x8f31('0x30')]);_0x544c94(_0x21c375[_0x8f31('0x30')]);});});}function getTicket(_0x445ba3,_0x1abf35,_0x11706a,_0x3e486a,_0x1808d1){return function(_0x2bd94a){logger[_0x8f31('0x10')](_0x8f31('0x31'));return new Promise(function(_0x491439,_0x3e4e1a){var _0x3d9a86=moment();var _0x22a77c={'method':_0x8f31('0x2e'),'uri':_0x11706a+_0x8f31('0x32'),'body':{'title':intUtil['getString'](_0x3e486a[_0x8f31('0x33')],_0x1808d1,'\x20'),'description':intUtil['getString'](_0x3e486a['Descriptions'],_0x1808d1,'\x0a'),'owner_id':_0x2bd94a[_0x8f31('0x1d')],'creater_id':_0x2bd94a[_0x8f31('0x13')],'targetable_id':_0x2bd94a[_0x8f31('0x2b')],'targetable_type':_0x8f31('0x34'),'created_at':_0x3d9a86['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x3d9a86[_0x8f31('0x35')](0x1e,'m')[_0x8f31('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x22a77c[_0x8f31('0xf')]=_0x1abf35;return rp(_0x22a77c)[_0x8f31('0x29')](function(_0x3a1c91){_0x2bd94a[_0x8f31('0x36')]=_0x3a1c91[_0x8f31('0x37')]['id'];logger[_0x8f31('0x10')](_0x8f31('0x38'),_0x2bd94a[_0x8f31('0x36')]);_0x491439(_0x2bd94a);})[_0x8f31('0x21')](function(_0x6a5d86){logger[_0x8f31('0x16')]('['+[_0x445ba3[_0x8f31('0x17')]()]+']',_0x6a5d86[_0x8f31('0x30')]);_0x3e4e1a(_0x6a5d86[_0x8f31('0x30')]);});});};}function emit(_0x5b09ac,_0x3d04af,_0x56a702){var _0xd7681f={'uri':_0x5b09ac+_0x8f31('0x39')+_0x56a702};io['to'](util[_0x8f31('0x25')](_0x8f31('0x3a'),_0x3d04af))[_0x8f31('0x3b')](_0x8f31('0x3c'),_0xd7681f);}exports['cs']=function(_0x29f145,_0x42a1e9,_0xb314fd,_0x1b12d4,_0x302afd,_0x712fd5,_0x507305,_0xf7c80e){var _0xdf119a={};var _0x2ac17e={'Authorization':_0x8f31('0x3d')+_0x712fd5[_0x8f31('0x3e')]};_0x712fd5[_0x8f31('0x3f')]=intUtil[_0x8f31('0x40')](_0x712fd5[_0x8f31('0x3f')]);_0x712fd5['serverUrl']=intUtil[_0x8f31('0x40')](_0x712fd5[_0x8f31('0x41')]);var _0x26fd03=_0x712fd5[_0x8f31('0x3f')];_0xdf119a[_0x8f31('0x12')]=_0x712fd5[_0x8f31('0x42')];_0xdf119a[_0x8f31('0x28')]=_0xf7c80e[_0x8f31('0x43')]()===_0x8f31('0x44')?_0x42a1e9['destcalleridnum']:_0x42a1e9['calleridnum'];_0xdf119a['callDirection']=_0xf7c80e==='queue'||_0xf7c80e===_0x8f31('0x45')?_0x8f31('0x46'):_0x8f31('0x44');if(_0x1b12d4){_0xdf119a[_0x8f31('0x1b')]=_0x1b12d4[_0x8f31('0x1c')];}var _0x12b213=util[_0x8f31('0x25')](_0x8f31('0x47'),_0x712fd5[_0x8f31('0x41')],_0x42a1e9['uniqueid'],md5(_0x42a1e9[_0x8f31('0x48')]));if(_0x302afd&&_0x302afd[_0x8f31('0x49')]){logger[_0x8f31('0x10')]('[QUEUE]',_0x8f31('0x4a'));_0x42a1e9[_0x8f31('0x4b')]=_0x12b213;}else if(_0x507305&&_0x507305[_0x8f31('0x4c')]&&_0x507305[_0x8f31('0x4c')]!==_0x8f31('0x4d')){logger['info'](_0x8f31('0x4e'),_0x8f31('0x4a'));_0x42a1e9[_0x8f31('0x4b')]=_0x12b213;}else{_0x42a1e9[_0x8f31('0x4b')]='';}return getAdminId(_0xdf119a,_0xf7c80e,_0x2ac17e,_0x26fd03)[_0x8f31('0x29')](getUser(_0xf7c80e,_0x2ac17e,_0x26fd03))[_0x8f31('0x29')](getEndUser(_0xf7c80e,_0x2ac17e,_0x26fd03))['then'](getTicket(_0xf7c80e,_0x2ac17e,_0x26fd03,_0xb314fd,_0x42a1e9))[_0x8f31('0x29')](function(_0x30bb5f){logger[_0x8f31('0x10')](util[_0x8f31('0x25')](_0x8f31('0x4f'),_0x30bb5f[_0x8f31('0x36')]));if(_0xf7c80e!==_0x8f31('0x45')){logger['info']('['+[_0xf7c80e[_0x8f31('0x17')]()]+']',_0x8f31('0x50'));emit(_0x26fd03,_0x1b12d4['name'],_0x30bb5f[_0x8f31('0x2b')]);}})[_0x8f31('0x21')](function(_0x1fda63){logger[_0x8f31('0x16')]('['+[_0xf7c80e[_0x8f31('0x17')]()]+_0x8f31('0x51'),util[_0x8f31('0x52')](_0x1fda63,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x776a=['/contacts/','user:%s','emit','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','Getting\x20user\x20list','users','agentEmail','userEmail','length','email','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','add','task','Task\x20created:','ticketId'];(function(_0x580cdc,_0x338623){var _0x55260c=function(_0x5b1a20){while(--_0x5b1a20){_0x580cdc['push'](_0x580cdc['shift']());}};_0x55260c(++_0x338623);}(_0x776a,0x1c8));var _0xa776=function(_0x1cb680,_0x28694d){_0x1cb680=_0x1cb680-0x0;var _0x2237fa=_0x776a[_0x1cb680];return _0x2237fa;};'use strict';var _=require(_0xa776('0x0'));var rp=require(_0xa776('0x1'));var md5=require(_0xa776('0x2'));var util=require(_0xa776('0x3'));var moment=require(_0xa776('0x4'));var Promise=require('bluebird');var Redis=require(_0xa776('0x5'));var intUtil=require(_0xa776('0x6'));var config=require(_0xa776('0x7'));var logger=require(_0xa776('0x8'))('freshsales');config['redis']=_[_0xa776('0x9')](config['redis'],{'host':_0xa776('0xa'),'port':0x18eb});var io=require(_0xa776('0xb'))(new Redis(config['redis']));function getAdminId(_0x3b3783,_0x214440,_0x38f518,_0x24e81b){return new Promise(function(_0x3c1503,_0x370d07){var _0xa40462=![];var _0x30c009={'method':'GET','uri':_0x24e81b+_0xa776('0xc'),'json':!![]};_0x30c009[_0xa776('0xd')]=_0x38f518;logger[_0xa776('0xe')](_0xa776('0xf'));return rp(_0x30c009)[_0xa776('0x10')](function(_0x22de78){if(_0x22de78){var _0xa2f6e5=_0x22de78['users'];var _0x39a4dc=null;for(_0x39a4dc=0x0;_0x39a4dc<_0xa2f6e5['length'];_0x39a4dc++){if(_0xa2f6e5[_0x39a4dc]['email']===_0x3b3783[_0xa776('0x11')]){_0x3b3783[_0xa776('0x12')]=_0xa2f6e5[_0x39a4dc]['id'];_0xa40462=!![];}}if(_0xa40462){logger[_0xa776('0xe')](_0xa776('0x13'),_0x3b3783[_0xa776('0x12')]);_0x3c1503(_0x3b3783);}else{_0x370d07({'statusCode':0x194,'message':_0xa776('0x14')});}}else{_0x370d07({'statusCode':0x194,'message':_0xa776('0x14')});}})[_0xa776('0x15')](function(_0x21addf){logger[_0xa776('0x16')]('['+[_0x214440[_0xa776('0x17')]()]+']',_0x21addf[_0xa776('0x18')]);_0x370d07(_0x21addf);});});}function getUser(_0x53ece3,_0x4ff1e0,_0x4b4d18){return function(_0x1b11a2){return new Promise(function(_0xce0f25,_0x103c05){var _0x490a4a={'method':_0xa776('0x19'),'uri':_0x4b4d18+_0xa776('0xc'),'json':!![]};_0x490a4a[_0xa776('0xd')]=_0x4ff1e0;logger['info'](_0xa776('0x1a'));return rp(_0x490a4a)[_0xa776('0x10')](function(_0x9ae0b0){if(_0x9ae0b0){var _0x867624=_0x9ae0b0[_0xa776('0x1b')];var _0x59918a=![];var _0x4e73bf=null;if(_0x1b11a2[_0xa776('0x1c')]!==null){logger[_0xa776('0xe')]('Getting\x20user\x20with\x20email',_0x1b11a2[_0xa776('0x1c')]);_0x1b11a2[_0xa776('0x1d')]=_0x1b11a2[_0xa776('0x1c')];for(_0x4e73bf=0x0;_0x4e73bf<_0x867624[_0xa776('0x1e')];_0x4e73bf++){if(_0x867624[_0x4e73bf][_0xa776('0x1f')]===_0x1b11a2[_0xa776('0x1c')]){_0x59918a=!![];_0x1b11a2[_0xa776('0x20')]=_0x867624[_0x4e73bf]['id'];logger[_0xa776('0xe')](_0xa776('0x21'),_0x1b11a2[_0xa776('0x20')]);}}}if(!_0x59918a){logger[_0xa776('0xe')](_0xa776('0x22'));_0x1b11a2[_0xa776('0x1d')]=_0x1b11a2[_0xa776('0x11')];_0x1b11a2[_0xa776('0x20')]=_0x1b11a2['adminId'];_0x59918a=!![];}if(_0x59918a){_0xce0f25(_0x1b11a2);}else{_0x103c05({'statusCode':0x194,'message':_0xa776('0x14')});}}else{_0x103c05({'statusCode':0x194,'message':_0xa776('0x14')});}})[_0xa776('0x15')](function(_0x27ca06){logger['error']('['+[_0x53ece3[_0xa776('0x17')]()]+']',_0x27ca06[_0xa776('0x18')]);_0x103c05(_0x27ca06);});});};}function searchContact(_0x4e6da2,_0x404bfd,_0x179c80,_0x11c10d){return new Promise(function(_0x28812a,_0x491e51){var _0x45f126={'method':_0xa776('0x19'),'headers':_0x404bfd,'uri':_0x4e6da2+_0xa776('0x23')+_0x11c10d+_0xa776('0x24')+_0x179c80+_0xa776('0x25'),'json':!![]};rp(_0x45f126)[_0xa776('0x10')](function(_0xb0e80c){var _0x32ed90=_[_0xa776('0x26')](_0xb0e80c[_0xa776('0x27')][_0xa776('0x27')],[_0x179c80,_0x11c10d]);_0x28812a(_0x32ed90);})[_0xa776('0x15')](function(_0x5eb9b2){_0x491e51(_0x5eb9b2);});});}function getEndUser(_0x2e7a50,_0x441df4,_0xac0df2){return function(_0xc162bb){return new Promise(function(_0x56f561,_0x264ecf){logger['info'](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0xc162bb[_0xa776('0x28')]));searchContact(_0xac0df2,_0x441df4,_0xa776('0x29'),_0xc162bb[_0xa776('0x28')])[_0xa776('0x10')](function(_0x5c5b40){if(_0x5c5b40){_0xc162bb[_0xa776('0x2a')]=_0x5c5b40['id'];logger[_0xa776('0xe')](_0xa776('0x2b'),_0xc162bb['endUserId']);return _0x56f561(_0xc162bb);}searchContact(_0xac0df2,_0x441df4,_0xa776('0x2c'),_0xc162bb[_0xa776('0x28')])[_0xa776('0x10')](function(_0x2af7f2){if(_0x2af7f2){_0xc162bb[_0xa776('0x2a')]=_0x2af7f2['id'];logger['info'](_0xa776('0x2d'),_0xc162bb[_0xa776('0x2a')]);return _0x56f561(_0xc162bb);}createEndUser(_0xc162bb,_0x2e7a50,_0x441df4,_0xac0df2)[_0xa776('0x10')](function(_0x170508){logger[_0xa776('0xe')](_0xa776('0x2e'),_0x170508[_0xa776('0x2a')]);return _0x56f561(_0x170508);});});})[_0xa776('0x15')](function(_0x249f75){_0x264ecf(_0x249f75);});});};}function createEndUser(_0x12444b,_0x1f5054,_0x1a9eb5,_0x6c8fb2){return new Promise(function(_0x1dd709,_0x14d677){var _0x524b76=moment();var _0x4cc976={'method':_0xa776('0x2f'),'uri':_0x6c8fb2+_0xa776('0x30'),'body':{'contact':{'last_name':_0x12444b[_0xa776('0x28')],'work_number':_0x12444b[_0xa776('0x28')],'mobile_number':_0x12444b[_0xa776('0x28')],'owner_id':_0x12444b[_0xa776('0x20')],'created_at':_0x524b76[_0xa776('0x31')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4cc976['headers']=_0x1a9eb5;logger['info'](_0xa776('0x32'));return rp(_0x4cc976)[_0xa776('0x10')](function(_0x466ede){_0x12444b[_0xa776('0x2a')]=_0x466ede[_0xa776('0x33')]['id'];_0x1dd709(_0x12444b);})['catch'](function(_0x3c7781){logger[_0xa776('0x16')]('['+[_0x1f5054[_0xa776('0x17')]()]+']',_0x3c7781['message']);_0x14d677(_0x3c7781[_0xa776('0x18')]);});});}function getTicket(_0x124c57,_0x2d8594,_0x44c76b,_0x23911d,_0x383885){return function(_0x1061c3){logger[_0xa776('0xe')](_0xa776('0x34'));return new Promise(function(_0x7189af,_0x1ad982){var _0x2b497c=moment();var _0x1ee761={'method':_0xa776('0x2f'),'uri':_0x44c76b+_0xa776('0x35'),'body':{'title':intUtil[_0xa776('0x36')](_0x23911d['Subjects'],_0x383885,'\x20'),'description':intUtil[_0xa776('0x36')](_0x23911d[_0xa776('0x37')],_0x383885,'\x0a'),'owner_id':_0x1061c3[_0xa776('0x20')],'creater_id':_0x1061c3[_0xa776('0x12')],'targetable_id':_0x1061c3[_0xa776('0x2a')],'targetable_type':'Contact','created_at':_0x2b497c[_0xa776('0x31')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x2b497c[_0xa776('0x38')](0x1e,'m')[_0xa776('0x31')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1ee761[_0xa776('0xd')]=_0x2d8594;return rp(_0x1ee761)['then'](function(_0x355981){_0x1061c3['ticketId']=_0x355981[_0xa776('0x39')]['id'];logger[_0xa776('0xe')](_0xa776('0x3a'),_0x1061c3[_0xa776('0x3b')]);_0x7189af(_0x1061c3);})[_0xa776('0x15')](function(_0x211252){logger['error']('['+[_0x124c57['toUpperCase']()]+']',_0x211252[_0xa776('0x18')]);_0x1ad982(_0x211252['message']);});});};}function emit(_0x5a2389,_0x4abebf,_0x4c00ab){var _0x4495ed={'uri':_0x5a2389+_0xa776('0x3c')+_0x4c00ab};io['to'](util[_0xa776('0x31')](_0xa776('0x3d'),_0x4abebf))[_0xa776('0x3e')]('trigger:browser:url',_0x4495ed);}exports['cs']=function(_0x1f08d8,_0x4e08db,_0x5369cc,_0x3d6844,_0x4317c3,_0x81108f,_0x156f3b,_0x7ebf7c){var _0x26994b={};var _0xc21d9a={'Authorization':'Token\x20token='+_0x81108f[_0xa776('0x3f')]};_0x81108f['remoteUri']=intUtil[_0xa776('0x40')](_0x81108f[_0xa776('0x41')]);_0x81108f['serverUrl']=intUtil[_0xa776('0x40')](_0x81108f[_0xa776('0x42')]);var _0x3728c3=_0x81108f['remoteUri'];_0x26994b[_0xa776('0x11')]=_0x81108f[_0xa776('0x43')];_0x26994b['contactNumber']=_0x7ebf7c[_0xa776('0x44')]()===_0xa776('0x45')?_0x4e08db[_0xa776('0x46')]:_0x4e08db['calleridnum'];_0x26994b['callDirection']=_0x7ebf7c===_0xa776('0x47')||_0x7ebf7c===_0xa776('0x48')?'queue':_0xa776('0x45');if(_0x3d6844){_0x26994b['agentEmail']=_0x3d6844[_0xa776('0x1f')];}var _0x13e5c6=util[_0xa776('0x31')](_0xa776('0x49'),_0x81108f['serverUrl'],_0x4e08db[_0xa776('0x4a')],md5(_0x4e08db[_0xa776('0x4a')]));if(_0x4317c3&&_0x4317c3[_0xa776('0x4b')]){logger[_0xa776('0xe')]('[QUEUE]',_0xa776('0x4c'));_0x4e08db['recordingURL']=_0x13e5c6;}else if(_0x156f3b&&_0x156f3b['recordingFormat']&&_0x156f3b[_0xa776('0x4d')]!==_0xa776('0x4e')){logger[_0xa776('0xe')](_0xa776('0x4f'),'Recording\x20is\x20enabled!');_0x4e08db[_0xa776('0x50')]=_0x13e5c6;}else{_0x4e08db[_0xa776('0x50')]='';}return getAdminId(_0x26994b,_0x7ebf7c,_0xc21d9a,_0x3728c3)[_0xa776('0x10')](getUser(_0x7ebf7c,_0xc21d9a,_0x3728c3))[_0xa776('0x10')](getEndUser(_0x7ebf7c,_0xc21d9a,_0x3728c3))[_0xa776('0x10')](getTicket(_0x7ebf7c,_0xc21d9a,_0x3728c3,_0x5369cc,_0x4e08db))['then'](function(_0x587b0d){logger['info'](util[_0xa776('0x31')](_0xa776('0x51'),_0x587b0d['ticketId']));if(_0x7ebf7c!=='unmanaged'){logger[_0xa776('0xe')]('['+[_0x7ebf7c[_0xa776('0x17')]()]+']',_0xa776('0x52'));emit(_0x3728c3,_0x3d6844[_0xa776('0x53')],_0x587b0d[_0xa776('0x2a')]);}})[_0xa776('0x15')](function(_0x5d22af){logger['error']('['+[_0x7ebf7c[_0xa776('0x17')]()]+_0xa776('0x54'),util[_0xa776('0x55')](_0x5d22af,{'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 7e96fa4..8787597 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 _0xc91b=['log','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','freshsales'];(function(_0x13271d,_0x58f9d3){var _0x5a7675=function(_0x4870be){while(--_0x4870be){_0x13271d['push'](_0x13271d['shift']());}};_0x5a7675(++_0x58f9d3);}(_0xc91b,0x118));var _0xbc91=function(_0x2e7446,_0x1faf52){_0x2e7446=_0x2e7446-0x0;var _0x432e4b=_0xc91b[_0x2e7446];return _0x432e4b;};'use strict';var _=require(_0xbc91('0x0'));var util=require(_0xbc91('0x1'));var zendesk=require(_0xbc91('0x2'));var salesforce=require(_0xbc91('0x3'));var sugarcrm=require(_0xbc91('0x4'));var freshdesk=require(_0xbc91('0x5'));var zoho=require('./zoho');var desk=require(_0xbc91('0x6'));var vtiger=require(_0xbc91('0x7'));var servicenow=require(_0xbc91('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xbc91('0x9'));var integrations=['zendesk',_0xbc91('0xa'),_0xbc91('0xb'),_0xbc91('0xc'),_0xbc91('0xd'),'desk',_0xbc91('0xe'),_0xbc91('0xf'),'freshsales',_0xbc91('0x10')];exports[_0xbc91('0x11')]=function(_0x32e7e5,_0x12757a,_0x31a520,_0xfe71d8,_0x228d1c,_0x266e32){if(_0x31a520){if(_[_0xbc91('0x12')](integrations,_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')]())){try{var _0x74cabd=null;var _0x39762b='';var _0x596a61=_0x31a520[_0x32e7e5['data1'][_0xbc91('0x14')]()];if(_0x596a61){var _0xd2be63=_0x596a61[_0x32e7e5[_0xbc91('0x15')]];if(_0xd2be63){var _0x3b3580=_[_0xbc91('0x16')](_0xd2be63[_0xbc91('0x17')],{'id':parseInt(_0x32e7e5[_0xbc91('0x18')],0xa)});if(_0x3b3580){if(_0xfe71d8){if(_0x228d1c&&_0x12757a[_0xbc91('0x19')]){_0x39762b=_0xbc91('0x19');}else if(_0x12757a[_0xbc91('0x1a')]){_0x39762b=_0xbc91('0x1b');}else{console['log'](_0xbc91('0x1c'),_0x12757a);}}else{_0x39762b=_0xbc91('0x1d');}switch(_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')]()){case _0xbc91('0x1e'):zendesk[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'salesforce':salesforce[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'sugarcrm':sugarcrm[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'freshdesk':freshdesk[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case _0xbc91('0xd'):zoho[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'desk':desk[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case'vtiger':vtiger[_0x39762b](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32);break;case _0xbc91('0x1f'):freshsales['cs'](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32,_0x39762b);break;case _0xbc91('0x10'):servicenow['cs'](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32,_0x39762b);break;case _0xbc91('0xf'):dynamics365['cs'](_0x32e7e5,_0x12757a,_0x3b3580,_0xfe71d8,_0x228d1c,_0xd2be63,_0x266e32,_0x39762b);break;default:console[_0xbc91('0x20')](_0xbc91('0x21'));}}else{_0x74cabd=require('../../../../config/logger')(_0x32e7e5[_0xbc91('0x13')]['toLowerCase']());_0x74cabd[_0xbc91('0x22')](_0xbc91('0x23'),util['format'](_0xbc91('0x24'),_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')](),_0x32e7e5[_0xbc91('0x18')]));}}else{_0x74cabd=require(_0xbc91('0x25'))(_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')]());_0x74cabd[_0xbc91('0x22')](_0xbc91('0x23'),util[_0xbc91('0x26')]('%s\x20account\x20#%s\x20not\x20found',_0x32e7e5[_0xbc91('0x13')][_0xbc91('0x14')](),_0x32e7e5[_0xbc91('0x15')]));}}else{}}catch(_0x119b5b){console[_0xbc91('0x22')](_0x119b5b);}}}}; \ No newline at end of file +var _0xf485=['format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','unknown\x20integration','../../../../config/logger','error'];(function(_0x25534d,_0x929d6){var _0x3c5c6e=function(_0x114526){while(--_0x114526){_0x25534d['push'](_0x25534d['shift']());}};_0x3c5c6e(++_0x929d6);}(_0xf485,0x1ee));var _0x5f48=function(_0xe1cd06,_0xb23be3){_0xe1cd06=_0xe1cd06-0x0;var _0x36e8d3=_0xf485[_0xe1cd06];return _0x36e8d3;};'use strict';var _=require('lodash');var util=require(_0x5f48('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0x5f48('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x5f48('0x2'));var zoho=require(_0x5f48('0x3'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x5f48('0x4'));var dynamics365=require(_0x5f48('0x5'));var freshsales=require(_0x5f48('0x6'));var integrations=[_0x5f48('0x7'),_0x5f48('0x8'),_0x5f48('0x9'),'freshdesk',_0x5f48('0xa'),_0x5f48('0xb'),_0x5f48('0xc'),_0x5f48('0xd'),_0x5f48('0xe'),_0x5f48('0xf')];exports[_0x5f48('0x10')]=function(_0x1fe354,_0x1044d4,_0x23321d,_0x4db35b,_0x40ccf3,_0x19495f){if(_0x23321d){if(_['includes'](integrations,_0x1fe354[_0x5f48('0x11')]['toLowerCase']())){try{var _0x5d7376=null;var _0x2ccfde='';var _0x5d2e57=_0x23321d[_0x1fe354[_0x5f48('0x11')][_0x5f48('0x12')]()];if(_0x5d2e57){var _0x23d0f3=_0x5d2e57[_0x1fe354[_0x5f48('0x13')]];if(_0x23d0f3){var _0x59fd04=_[_0x5f48('0x14')](_0x23d0f3[_0x5f48('0x15')],{'id':parseInt(_0x1fe354['data3'],0xa)});if(_0x59fd04){if(_0x4db35b){if(_0x40ccf3&&_0x1044d4[_0x5f48('0x16')]){_0x2ccfde=_0x5f48('0x16');}else if(_0x1044d4['routeId']){_0x2ccfde=_0x5f48('0x17');}else{console[_0x5f48('0x18')](_0x5f48('0x19'),_0x1044d4);}}else{_0x2ccfde=_0x5f48('0x1a');}switch(_0x1fe354['data1'][_0x5f48('0x12')]()){case _0x5f48('0x7'):zendesk[_0x2ccfde](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f);break;case _0x5f48('0x8'):salesforce[_0x2ccfde](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f);break;case _0x5f48('0x9'):sugarcrm[_0x2ccfde](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f);break;case _0x5f48('0x1b'):freshdesk[_0x2ccfde](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f);break;case'zoho':zoho[_0x2ccfde](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f);break;case _0x5f48('0xb'):desk[_0x2ccfde](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f);break;case _0x5f48('0xc'):vtiger[_0x2ccfde](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f);break;case _0x5f48('0xe'):freshsales['cs'](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f,_0x2ccfde);break;case _0x5f48('0xf'):servicenow['cs'](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f,_0x2ccfde);break;case _0x5f48('0xd'):dynamics365['cs'](_0x1fe354,_0x1044d4,_0x59fd04,_0x4db35b,_0x40ccf3,_0x23d0f3,_0x19495f,_0x2ccfde);break;default:console[_0x5f48('0x18')](_0x5f48('0x1c'));}}else{_0x5d7376=require(_0x5f48('0x1d'))(_0x1fe354[_0x5f48('0x11')]['toLowerCase']());_0x5d7376[_0x5f48('0x1e')]('[EXEC]',util[_0x5f48('0x1f')](_0x5f48('0x20'),_0x1fe354[_0x5f48('0x11')][_0x5f48('0x12')](),_0x1fe354[_0x5f48('0x21')]));}}else{_0x5d7376=require('../../../../config/logger')(_0x1fe354[_0x5f48('0x11')][_0x5f48('0x12')]());_0x5d7376[_0x5f48('0x1e')]('[EXEC]',util[_0x5f48('0x1f')](_0x5f48('0x22'),_0x1fe354['data1'][_0x5f48('0x12')](),_0x1fe354[_0x5f48('0x13')]));}}else{}}catch(_0xdc9ced){console['error'](_0xdc9ced);}}}}; \ 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 1b91258..321d24c 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 _0x4a3c=['string','picklist','type','idField','toString','variable','variableName','customVariable','name','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','isNil','calleridname','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','account','WhatId','Case','contact','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','sobject','find','execute','then','length','Email','Agent\x20%s\x20found.','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','additionalSearchLead','merge','$or','Lead','additionalSearchAccount','Contact','Account','first','Name','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','','format','Caller\x20-\x20%s','LastName','Company','upperFirst','includes'];(function(_0xbf089a,_0x2e4466){var _0xd2369a=function(_0x2c1bc7){while(--_0x2c1bc7){_0xbf089a['push'](_0xbf089a['shift']());}};_0xd2369a(++_0x2e4466);}(_0x4a3c,0x141));var _0xc4a3=function(_0x4accd7,_0x4979c3){_0x4accd7=_0x4accd7-0x0;var _0x14dd90=_0x4a3c[_0x4accd7];return _0x14dd90;};'use strict';var _=require(_0xc4a3('0x0'));var rp=require('request-promise');var moment=require(_0xc4a3('0x1'));var BPromise=require(_0xc4a3('0x2'));var md5=require(_0xc4a3('0x3'));var jsforce=require(_0xc4a3('0x4'));var util=require(_0xc4a3('0x5'));var Redis=require(_0xc4a3('0x6'));var intUtil=require(_0xc4a3('0x7'));var config=require(_0xc4a3('0x8'));var logger=require(_0xc4a3('0x9'))(_0xc4a3('0xa'));config[_0xc4a3('0xb')]=_[_0xc4a3('0xc')](config[_0xc4a3('0xb')],{'host':_0xc4a3('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x16d9da,_0x34ad69,_0x14ca0f){io['to'](_0x16d9da)[_0xc4a3('0xe')](_0x34ad69,_0x14ca0f);}function getTicket(_0x3c7215,_0x3b2a1b,_0x19a172,_0x1d41f7,_0x119198,_0x27ce2,_0x228b71,_0x3d07d6){var _0x18e597=Object[_0xc4a3('0xf')]({},{'OwnerId':_0x3b2a1b['id'],'Subject':intUtil['getString'](_0x1d41f7[_0xc4a3('0x10')],_0x119198,'\x20'),'Description':intUtil['getString'](_0x1d41f7[_0xc4a3('0x11')],_0x119198,'\x0a')},getCustomFields(_0x27ce2,_0x119198));if(_0x19a172){if(_0x1d41f7[_0xc4a3('0x12')]===_0xc4a3('0x13')){_0x18e597[_0xc4a3('0x14')]=moment[_0xc4a3('0x15')]();_0x18e597[_0xc4a3('0x16')]=![];_0x18e597[_0xc4a3('0x17')]=![];if(_0x19a172[_0xc4a3('0x18')]==='contact'||_0x19a172[_0xc4a3('0x18')]==='lead'){_0x18e597[_0xc4a3('0x19')]=_0x19a172['id'];}else if(_0x19a172[_0xc4a3('0x18')]===_0xc4a3('0x1a')){_0x18e597[_0xc4a3('0x1b')]=_0x19a172['id'];}}else if(_0x1d41f7['ticketType']===_0xc4a3('0x1c')){if(_0x19a172[_0xc4a3('0x18')]===_0xc4a3('0x1d')){_0x18e597[_0xc4a3('0x1e')]=_0x19a172['id'];}else if(_0x19a172['endUserType']===_0xc4a3('0x1a')){_0x18e597['AccountId']=_0x19a172['id'];}else if(_0x19a172[_0xc4a3('0x18')]===_0xc4a3('0x1f')&&_0x1d41f7[_0xc4a3('0x20')]){_0x18e597[_0x1d41f7[_0xc4a3('0x20')]]=_0x19a172['id'];}else{logger[_0xc4a3('0x21')](_0xc4a3('0x22'));}}}return _0x228b71['sobject'](_0x1d41f7[_0xc4a3('0x12')])[_0xc4a3('0x23')](_0x18e597);}function getUser(_0x3c9f03,_0x15ba61,_0x149772){if(!_['isNil'](_0x15ba61)&&intUtil['validateEmail'](_0x15ba61)){var _0x4d72ad={'Email':_0x15ba61};var _0x15b47d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x149772[_0xc4a3('0x24')]('User')[_0xc4a3('0x25')](_0x4d72ad,_0x15b47d)[_0xc4a3('0x26')]()[_0xc4a3('0x27')](function(_0xdcdc19){if(_0xdcdc19[_0xc4a3('0x28')]){var _0x21c40e=_[_0xc4a3('0x25')](_0xdcdc19,function(_0x27df19){return _0x27df19[_0xc4a3('0x29')]===_0x15ba61;});if(_0x21c40e){logger[_0xc4a3('0x21')](_0xc4a3('0x2a'),_0x15ba61);return BPromise['resolve']({'id':_0x21c40e['Id'],'name':_0x21c40e['Name']});}}else{logger[_0xc4a3('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x15ba61);return _0x149772[_0xc4a3('0x2b')]()[_0xc4a3('0x27')](function(_0x584e65){return BPromise['resolve']({'id':_0x584e65[_0xc4a3('0x2c')],'name':_0x584e65[_0xc4a3('0x2d')]});});}});}else{logger[_0xc4a3('0x21')](_0xc4a3('0x2e'),_0x15ba61);return _0x149772[_0xc4a3('0x2b')]()[_0xc4a3('0x27')](function(_0x3b7073){return BPromise[_0xc4a3('0x2f')]({'id':_0x3b7073[_0xc4a3('0x2c')],'name':_0x3b7073[_0xc4a3('0x2d')]});});}}function getEndUser(_0x58a1e0,_0x430cbc,_0x23dd05,_0x315b46,_0x5d2595){var _0x4639dd={'$or':{'Phone':_0x315b46}};var _0x4a90da={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc4a3('0x2f')]()[_0xc4a3('0x27')](function(){logger['info'](_0xc4a3('0x30'),_0x315b46,_0x430cbc[_0xc4a3('0x31')]);switch(_0x430cbc[_0xc4a3('0x31')]){case _0xc4a3('0x32'):var _0x4f16ae=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc['additionalSearchContact']){var _0x1de9a2={};_0x1de9a2[_0x430cbc[_0xc4a3('0x34')]]=_0x315b46;_['merge'](_0x4f16ae['$or'],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')]('Contact')[_0xc4a3('0x25')](_0x4f16ae,_0x4a90da)[_0xc4a3('0x26')]()[_0xc4a3('0x27')](function(_0x2dd954){if(_0x2dd954&&_0x2dd954[_0xc4a3('0x28')]){return _0x2dd954;}else{var _0x923d5=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x35')]){var _0x3671df={};_0x3671df[_0x430cbc[_0xc4a3('0x35')]]=_0x315b46;_[_0xc4a3('0x36')](_0x923d5[_0xc4a3('0x37')],_0x3671df);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x38'))[_0xc4a3('0x25')](_0x923d5,_0x4a90da);}});case'account_contact_lead':var _0x33a09f=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc['additionalSearchAccount']){var _0x1de9a2={};_0x1de9a2[_0x430cbc[_0xc4a3('0x39')]]=_0x315b46;_[_0xc4a3('0x36')](_0x33a09f[_0xc4a3('0x37')],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')]('Account')['find'](_0x33a09f,_0x4a90da)[_0xc4a3('0x26')]()[_0xc4a3('0x27')](function(_0x20afe9){if(_0x20afe9&&_0x20afe9['length']){return _0x20afe9;}else{var _0x584dcd=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc['additionalSearchContact']){var _0x4269f2={};_0x4269f2[_0x430cbc['additionalSearchContact']]=_0x315b46;_[_0xc4a3('0x36')](_0x584dcd[_0xc4a3('0x37')],_0x4269f2);}return _0x5d2595[_0xc4a3('0x24')]('Contact')[_0xc4a3('0x25')](_0x584dcd,_0x4a90da)[_0xc4a3('0x27')](function(_0xd73bce){if(_0xd73bce&&_0xd73bce[_0xc4a3('0x28')]){return _0xd73bce;}else{var _0x379ad3=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x35')]){var _0x3edf8={};_0x3edf8[_0x430cbc[_0xc4a3('0x35')]]=_0x315b46;_[_0xc4a3('0x36')](_0x379ad3[_0xc4a3('0x37')],_0x3edf8);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x38'))['find'](_0x379ad3,_0x4a90da);}});}});case _0xc4a3('0x1d'):var _0x4f16ae=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x34')]){var _0x1de9a2={};_0x1de9a2[_0x430cbc[_0xc4a3('0x34')]]=_0x315b46;_[_0xc4a3('0x36')](_0x4f16ae[_0xc4a3('0x37')],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x3a'))[_0xc4a3('0x25')](_0x4f16ae,_0x4a90da)[_0xc4a3('0x26')]();case'lead':var _0x15ed3c=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x35')]){var _0x1de9a2={};_0x1de9a2[_0x430cbc['additionalSearchLead']]=_0x315b46;_['merge'](_0x15ed3c[_0xc4a3('0x37')],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x38'))['find'](_0x15ed3c,_0x4a90da);case _0xc4a3('0x1a'):var _0x33a09f=_[_0xc4a3('0x33')](_0x4639dd);if(_0x430cbc[_0xc4a3('0x39')]){var _0x1de9a2={};_0x1de9a2[_0x430cbc[_0xc4a3('0x39')]]=_0x315b46;_[_0xc4a3('0x36')](_0x33a09f[_0xc4a3('0x37')],_0x1de9a2);}return _0x5d2595[_0xc4a3('0x24')](_0xc4a3('0x3b'))['find'](_0x33a09f,_0x4a90da);default:return null;}})[_0xc4a3('0x27')](function(_0x54ef6d){if(_0x54ef6d&&_0x54ef6d[_0xc4a3('0x28')]){var _0x536a6d=_[_0xc4a3('0x3c')](_0x54ef6d);if(_0x536a6d){return BPromise[_0xc4a3('0x2f')]({'id':_0x536a6d['Id'],'name':_0x536a6d[_0xc4a3('0x3d')],'phone':_0x536a6d[_0xc4a3('0x3e')],'endUserType':_0x536a6d['attributes']['type'][_0xc4a3('0x3f')]()});}}})[_0xc4a3('0x27')](function(_0x434030){if(_0x434030){logger['info'](_0xc4a3('0x40'),_0x434030[_0xc4a3('0x18')],_0x315b46);return BPromise['resolve'](_0x434030);}else{logger['info'](_0xc4a3('0x41'),_0x315b46);var _0x2de73e={'Phone':_0x315b46};if(_0x430cbc['moduleCreate']){if(_0x430cbc['moduleCreate']===_0xc4a3('0x1d')){logger[_0xc4a3('0x21')](_0xc4a3('0x42'),_0x315b46,_0x430cbc[_0xc4a3('0x43')]);_0x2de73e['LastName']=_0x23dd05!==_0xc4a3('0x44')?_0x23dd05:util[_0xc4a3('0x45')](_0xc4a3('0x46'),_0x315b46);}else if(_0x430cbc[_0xc4a3('0x43')]==='lead'){logger[_0xc4a3('0x21')](_0xc4a3('0x42'),_0x315b46,_0x430cbc[_0xc4a3('0x43')]);_0x2de73e[_0xc4a3('0x47')]=_0x23dd05!==_0xc4a3('0x44')?_0x23dd05:util['format'](_0xc4a3('0x46'),_0x315b46);_0x2de73e[_0xc4a3('0x48')]='No\x20Company';}else if(_0x430cbc[_0xc4a3('0x43')]===_0xc4a3('0x1a')){logger[_0xc4a3('0x21')](_0xc4a3('0x42'),_0x315b46,_0x430cbc[_0xc4a3('0x43')]);_0x2de73e[_0xc4a3('0x3d')]=_0x23dd05!==_0xc4a3('0x44')?_0x23dd05:util[_0xc4a3('0x45')](_0xc4a3('0x46'),_0x315b46);}else{return null;}}return _0x5d2595[_0xc4a3('0x24')](_[_0xc4a3('0x49')](_0x430cbc[_0xc4a3('0x43')]))['create'](_0x2de73e)[_0xc4a3('0x27')](function(_0x37dfbe){return BPromise[_0xc4a3('0x2f')]({'id':_0x37dfbe['id'],'endUserType':_0x430cbc['moduleCreate']});});}});}function getCustomFields(_0xc9ca0,_0x732c18){var _0x2bebb7={};if(_0xc9ca0[_0xc4a3('0x28')]>0x0){_['forEach'](_0xc9ca0,function(_0x575fa0){if(_[_0xc4a3('0x4a')]([_0xc4a3('0x4b'),_0xc4a3('0x4c')],_0x575fa0[_0xc4a3('0x4d')])&&_0x575fa0[_0xc4a3('0x4e')]){_0x2bebb7[_0x575fa0['idField']]=_0x575fa0['content'][_0xc4a3('0x4f')]();}else if(_0x575fa0[_0xc4a3('0x4d')]===_0xc4a3('0x50')&&_0x575fa0[_0xc4a3('0x51')]&&_0x575fa0['idField']){_0x732c18[_0x575fa0[_0xc4a3('0x51')]]&&(_0x2bebb7[_0x575fa0[_0xc4a3('0x4e')]]=_0x732c18[_0x575fa0[_0xc4a3('0x51')]]['toString']());}else if(_0x575fa0['type']===_0xc4a3('0x52')&&_0x575fa0['Variable']&&_0x575fa0['Variable'][_0xc4a3('0x53')]&&_0x575fa0[_0xc4a3('0x4e')]){_0x732c18[_0x575fa0['Variable'][_0xc4a3('0x53')][_0xc4a3('0x3f')]()]&&(_0x2bebb7[_0x575fa0['idField']]=_0x732c18[_0x575fa0[_0xc4a3('0x54')][_0xc4a3('0x53')][_0xc4a3('0x3f')]()][_0xc4a3('0x4f')]());}});}return _0x2bebb7;}function getConnection(_0x153c10){var _0xe93d3=_0x153c10[_0xc4a3('0x55')][_0xc4a3('0x56')](_0x153c10[_0xc4a3('0x57')]);var _0x310dda=new jsforce[(_0xc4a3('0x58'))]({'oauth2':{'loginUrl':_0x153c10[_0xc4a3('0x59')]||_0xc4a3('0x5a'),'clientId':_0x153c10[_0xc4a3('0x5b')],'clientSecret':_0x153c10[_0xc4a3('0x5c')]}});return _0x310dda[_0xc4a3('0x5d')](_0x153c10['username'],_0xe93d3)['then'](function(){logger[_0xc4a3('0x21')](_0xc4a3('0x5e'));return _0x310dda;});}exports[_0xc4a3('0x5f')]=function(_0x5c1832,_0x7d354a,_0x3a5f60,_0x449994,_0x4fbb9b,_0x607fb2){var _0x3cb273,_0x23f04d,_0x56128a,_0x38107a;_0x607fb2[_0xc4a3('0x60')]=intUtil[_0xc4a3('0x61')](_0x607fb2[_0xc4a3('0x60')]);_0x607fb2[_0xc4a3('0x59')]=intUtil['stripTrailingSlash'](_0x607fb2[_0xc4a3('0x59')]);if(_0x4fbb9b&&_0x4fbb9b[_0xc4a3('0x62')]){logger[_0xc4a3('0x21')]('[QUEUE]',_0xc4a3('0x63'));_0x7d354a[_0xc4a3('0x64')]=util[_0xc4a3('0x45')](_0xc4a3('0x65'),_0x607fb2['serverUrl'],_0x7d354a['uniqueid'],md5(_0x7d354a[_0xc4a3('0x66')]));}else{_0x7d354a[_0xc4a3('0x64')]='';}return getConnection(_0x607fb2)[_0xc4a3('0x27')](function(_0xea7784){_0x38107a=_0xea7784;return getUser(_0x607fb2,_0x449994[_0xc4a3('0x67')],_0x38107a);})[_0xc4a3('0x27')](function(_0x33790d){_0x3cb273=_0x33790d;return getEndUser(_0x607fb2,_0x3a5f60,_0x7d354a['calleridname'],_0x7d354a[_0xc4a3('0x68')],_0x38107a);})[_0xc4a3('0x27')](function(_0x51dba4){_0x23f04d=_0x51dba4;return getTicket(_0x607fb2,_0x3cb273,_0x23f04d,_0x3a5f60,_0x7d354a,_0x3a5f60['Fields'],_0x38107a,_0xc4a3('0x5f'));})[_0xc4a3('0x27')](function(_0x9f8c4c){_0x56128a=_0x9f8c4c;logger[_0xc4a3('0x21')](_0xc4a3('0x69'),_0x56128a['id']);logger[_0xc4a3('0x21')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x56128a['id'],_0x449994[_0xc4a3('0x53')],_0x607fb2['type']);switch(_0x607fb2['type']){case _0xc4a3('0x6a'):emit(util[_0xc4a3('0x45')]('user:%s',_0x449994[_0xc4a3('0x53')]),_0xc4a3('0x6b'),{'recordId':_0x56128a['id']});break;case _0xc4a3('0x6c'):emit(util[_0xc4a3('0x45')](_0xc4a3('0x6d'),_0x449994[_0xc4a3('0x53')]),_0xc4a3('0x6e'),{'uri':util[_0xc4a3('0x45')](_0xc4a3('0x6f'),_0x38107a[_0xc4a3('0x70')],_0x56128a['id'])});break;default:logger[_0xc4a3('0x71')](_0xc4a3('0x72'));}})[_0xc4a3('0x73')](function(_0x48c30e){logger[_0xc4a3('0x71')](_0xc4a3('0x74'),_0x48c30e);});};exports[_0xc4a3('0x75')]=function(_0x20edbd,_0x2b21c6,_0x2cc4e8,_0xe48494,_0x113834,_0x28a861,_0xc4bbb6){var _0x36844d,_0x54aaac,_0x4fd1cc,_0x2a1417;_0x28a861[_0xc4a3('0x60')]=intUtil[_0xc4a3('0x61')](_0x28a861['serverUrl']);_0x28a861[_0xc4a3('0x59')]=intUtil[_0xc4a3('0x61')](_0x28a861[_0xc4a3('0x59')]);if(_0xc4bbb6&&_0xc4bbb6['recordingFormat']&&_0xc4bbb6['recordingFormat']!==_0xc4a3('0x76')){logger[_0xc4a3('0x21')](_0xc4a3('0x77'),'Recording\x20is\x20enabled!');_0x2b21c6[_0xc4a3('0x64')]=util['format'](_0xc4a3('0x65'),_0x28a861[_0xc4a3('0x60')],_0x2b21c6[_0xc4a3('0x66')],md5(_0x2b21c6['uniqueid']));}return getConnection(_0x28a861)['then'](function(_0x49485d){_0x2a1417=_0x49485d;return getUser(_0x28a861,_0xe48494[_0xc4a3('0x67')],_0x2a1417);})[_0xc4a3('0x27')](function(_0x4f2ccd){_0x36844d=_0x4f2ccd;return getEndUser(_0x28a861,_0x2cc4e8,_0x2b21c6[_0xc4a3('0x78')],_0x2b21c6[_0xc4a3('0x79')],_0x2a1417);})[_0xc4a3('0x27')](function(_0x117506){_0x54aaac=_0x117506;return getTicket(_0x28a861,_0x36844d,_0x54aaac,_0x2cc4e8,_0x2b21c6,_0x2cc4e8[_0xc4a3('0x7a')],_0x2a1417,_0xc4a3('0x75'));})[_0xc4a3('0x27')](function(_0x573cdd){_0x4fd1cc=_0x573cdd;logger[_0xc4a3('0x21')](_0xc4a3('0x7b'),_0x4fd1cc['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4fd1cc['id'],_0xe48494[_0xc4a3('0x53')],_0x28a861['type']);switch(_0x28a861['type']){case _0xc4a3('0x6a'):emit(util[_0xc4a3('0x45')](_0xc4a3('0x6d'),_0xe48494['name']),_0xc4a3('0x6b'),{'recordId':_0x4fd1cc['id']});break;case'newTab':emit(util[_0xc4a3('0x45')](_0xc4a3('0x6d'),_0xe48494[_0xc4a3('0x53')]),_0xc4a3('0x6e'),{'uri':util[_0xc4a3('0x45')](_0xc4a3('0x6f'),_0x2a1417[_0xc4a3('0x70')],_0x4fd1cc['id'])});break;default:logger[_0xc4a3('0x71')](_0xc4a3('0x77'),_0xc4a3('0x7c'));}})[_0xc4a3('0x73')](function(_0xdd4d47){logger['error'](_0xc4a3('0x77'),_0xdd4d47);});};exports[_0xc4a3('0x7d')]=function(_0x22a7e7,_0x47b7a5,_0x1384ff,_0x248fcc,_0x4d0fde,_0x2c2f53){var _0x57b7c5,_0x5428f7,_0x23a153,_0x1d6e53;_0x2c2f53['serverUrl']=intUtil['stripTrailingSlash'](_0x2c2f53[_0xc4a3('0x60')]);_0x2c2f53[_0xc4a3('0x59')]=intUtil[_0xc4a3('0x61')](_0x2c2f53[_0xc4a3('0x59')]);if(_0x4d0fde&&_0x4d0fde[_0xc4a3('0x62')]){logger[_0xc4a3('0x21')]('['+_0x47b7a5['lastevent']['toUpperCase']()+']',_0xc4a3('0x63'));_0x47b7a5['recordingURL']=util[_0xc4a3('0x45')](_0xc4a3('0x65'),_0x2c2f53[_0xc4a3('0x60')],_0x47b7a5[_0xc4a3('0x66')],md5(_0x47b7a5[_0xc4a3('0x66')]));}else{_0x47b7a5[_0xc4a3('0x64')]='';}return getConnection(_0x2c2f53)['then'](function(_0x546cfa){_0x1d6e53=_0x546cfa;if(!_[_0xc4a3('0x7e')](_0x248fcc)){return getUser(_0x2c2f53,_0x248fcc[_0xc4a3('0x53')],_0x1d6e53);}else{return getUser(_0x2c2f53,null,_0x1d6e53);}})[_0xc4a3('0x27')](function(_0x3f61dd){_0x57b7c5=_0x3f61dd;return getEndUser(_0x2c2f53,_0x1384ff,_0x47b7a5[_0xc4a3('0x7f')],_0x47b7a5[_0xc4a3('0x68')],_0x1d6e53);})['then'](function(_0x1e7638){_0x5428f7=_0x1e7638;return getTicket(_0x2c2f53,_0x57b7c5,_0x5428f7,_0x1384ff,_0x47b7a5,_0x1384ff[_0xc4a3('0x7a')],_0x1d6e53);})[_0xc4a3('0x27')](function(_0x229665){_0x23a153=_0x229665;logger[_0xc4a3('0x21')]('['+_0x47b7a5[_0xc4a3('0x80')][_0xc4a3('0x81')]()+_0xc4a3('0x82'),_0x23a153['id']);logger[_0xc4a3('0x21')]('['+_0x47b7a5['lastevent'][_0xc4a3('0x81')]()+_0xc4a3('0x83'),_0x2c2f53[_0xc4a3('0x4d')]);})['catch'](function(_0x37ccb9){logger[_0xc4a3('0x71')]('['+_0x47b7a5[_0xc4a3('0x80')][_0xc4a3('0x81')]()+']',_0x37ccb9);});}; \ No newline at end of file +var _0xe30f=['queue','stripTrailingSlash','serverUrl','monitor_format','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','getString','Descriptions','Task','ActivityDate','IsReminderSet','endUserType','contact','WhoId','account','WhatId','ticketType','Case','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','type','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.','','format','Caller\x20-\x20%s','LastName','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','toString','variableName','Variable','name','toLowerCase','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.'];(function(_0x10a1ed,_0xef430e){var _0xf5340f=function(_0x469690){while(--_0x469690){_0x10a1ed['push'](_0x10a1ed['shift']());}};_0xf5340f(++_0xef430e);}(_0xe30f,0x11e));var _0xfe30=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe30f[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var rp=require(_0xfe30('0x0'));var moment=require(_0xfe30('0x1'));var BPromise=require('bluebird');var md5=require(_0xfe30('0x2'));var jsforce=require(_0xfe30('0x3'));var util=require(_0xfe30('0x4'));var Redis=require(_0xfe30('0x5'));var intUtil=require(_0xfe30('0x6'));var config=require(_0xfe30('0x7'));var logger=require(_0xfe30('0x8'))(_0xfe30('0x9'));config['redis']=_['defaults'](config[_0xfe30('0xa')],{'host':_0xfe30('0xb'),'port':0x18eb});var io=require(_0xfe30('0xc'))(new Redis(config[_0xfe30('0xa')]));function emit(_0x444e89,_0xf8054b,_0x11f6d2){io['to'](_0x444e89)['emit'](_0xf8054b,_0x11f6d2);}function getTicket(_0x3c2899,_0x2761f4,_0x5d1513,_0x3afa39,_0xa850cb,_0x536a42,_0x517f5f,_0x24747c){var _0x4f5a44=Object['assign']({},{'OwnerId':_0x2761f4['id'],'Subject':intUtil['getString'](_0x3afa39['Subjects'],_0xa850cb,'\x20'),'Description':intUtil[_0xfe30('0xd')](_0x3afa39[_0xfe30('0xe')],_0xa850cb,'\x0a')},getCustomFields(_0x536a42,_0xa850cb));if(_0x5d1513){if(_0x3afa39['ticketType']===_0xfe30('0xf')){_0x4f5a44[_0xfe30('0x10')]=moment['utc']();_0x4f5a44[_0xfe30('0x11')]=![];_0x4f5a44['IsRecurrence']=![];if(_0x5d1513[_0xfe30('0x12')]===_0xfe30('0x13')||_0x5d1513['endUserType']==='lead'){_0x4f5a44[_0xfe30('0x14')]=_0x5d1513['id'];}else if(_0x5d1513[_0xfe30('0x12')]===_0xfe30('0x15')){_0x4f5a44[_0xfe30('0x16')]=_0x5d1513['id'];}}else if(_0x3afa39[_0xfe30('0x17')]===_0xfe30('0x18')){if(_0x5d1513[_0xfe30('0x12')]===_0xfe30('0x13')){_0x4f5a44[_0xfe30('0x19')]=_0x5d1513['id'];}else if(_0x5d1513[_0xfe30('0x12')]===_0xfe30('0x15')){_0x4f5a44['AccountId']=_0x5d1513['id'];}else if(_0x5d1513[_0xfe30('0x12')]===_0xfe30('0x1a')&&_0x3afa39[_0xfe30('0x1b')]){_0x4f5a44[_0x3afa39['leadId']]=_0x5d1513['id'];}else{logger[_0xfe30('0x1c')](_0xfe30('0x1d'));}}}return _0x517f5f[_0xfe30('0x1e')](_0x3afa39[_0xfe30('0x17')])['create'](_0x4f5a44);}function getUser(_0xfe55e0,_0x3c0885,_0x20d415){if(!_[_0xfe30('0x1f')](_0x3c0885)&&intUtil[_0xfe30('0x20')](_0x3c0885)){var _0x357dde={'Email':_0x3c0885};var _0x5421bf={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x20d415[_0xfe30('0x1e')](_0xfe30('0x21'))[_0xfe30('0x22')](_0x357dde,_0x5421bf)[_0xfe30('0x23')]()[_0xfe30('0x24')](function(_0x27213d){if(_0x27213d[_0xfe30('0x25')]){var _0x5e6b3b=_['find'](_0x27213d,function(_0x3f87f0){return _0x3f87f0[_0xfe30('0x26')]===_0x3c0885;});if(_0x5e6b3b){logger[_0xfe30('0x1c')](_0xfe30('0x27'),_0x3c0885);return BPromise[_0xfe30('0x28')]({'id':_0x5e6b3b['Id'],'name':_0x5e6b3b[_0xfe30('0x29')]});}}else{logger[_0xfe30('0x1c')](_0xfe30('0x2a'),_0x3c0885);return _0x20d415[_0xfe30('0x2b')]()[_0xfe30('0x24')](function(_0x588326){return BPromise[_0xfe30('0x28')]({'id':_0x588326[_0xfe30('0x2c')],'name':_0x588326[_0xfe30('0x2d')]});});}});}else{logger[_0xfe30('0x1c')](_0xfe30('0x2a'),_0x3c0885);return _0x20d415[_0xfe30('0x2b')]()[_0xfe30('0x24')](function(_0x5db4e8){return BPromise['resolve']({'id':_0x5db4e8[_0xfe30('0x2c')],'name':_0x5db4e8[_0xfe30('0x2d')]});});}}function getEndUser(_0x306ae6,_0x3f2166,_0x5ac09b,_0x11a8d1,_0x314c70){var _0x2c60f0={'$or':{'Phone':_0x11a8d1}};var _0x5d57ab={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfe30('0x28')]()['then'](function(){logger[_0xfe30('0x1c')](_0xfe30('0x2e'),_0x11a8d1,_0x3f2166[_0xfe30('0x2f')]);switch(_0x3f2166['moduleSearch']){case'contact_lead':var _0x1d4bc5=_[_0xfe30('0x30')](_0x2c60f0);if(_0x3f2166[_0xfe30('0x31')]){var _0x3f2925={};_0x3f2925[_0x3f2166[_0xfe30('0x31')]]=_0x11a8d1;_[_0xfe30('0x32')](_0x1d4bc5[_0xfe30('0x33')],_0x3f2925);}return _0x314c70[_0xfe30('0x1e')](_0xfe30('0x34'))[_0xfe30('0x22')](_0x1d4bc5,_0x5d57ab)[_0xfe30('0x23')]()['then'](function(_0x51d0fe){if(_0x51d0fe&&_0x51d0fe[_0xfe30('0x25')]){return _0x51d0fe;}else{var _0x40ae6a=_[_0xfe30('0x30')](_0x2c60f0);if(_0x3f2166['additionalSearchLead']){var _0x5750d7={};_0x5750d7[_0x3f2166[_0xfe30('0x35')]]=_0x11a8d1;_[_0xfe30('0x32')](_0x40ae6a['$or'],_0x5750d7);}return _0x314c70['sobject'](_0xfe30('0x36'))['find'](_0x40ae6a,_0x5d57ab);}});case _0xfe30('0x37'):var _0x20d3ac=_['cloneDeep'](_0x2c60f0);if(_0x3f2166[_0xfe30('0x38')]){var _0x3f2925={};_0x3f2925[_0x3f2166[_0xfe30('0x38')]]=_0x11a8d1;_[_0xfe30('0x32')](_0x20d3ac[_0xfe30('0x33')],_0x3f2925);}return _0x314c70[_0xfe30('0x1e')](_0xfe30('0x39'))[_0xfe30('0x22')](_0x20d3ac,_0x5d57ab)['execute']()[_0xfe30('0x24')](function(_0x256f80){if(_0x256f80&&_0x256f80[_0xfe30('0x25')]){return _0x256f80;}else{var _0xc5bfd9=_['cloneDeep'](_0x2c60f0);if(_0x3f2166[_0xfe30('0x31')]){var _0x13abd7={};_0x13abd7[_0x3f2166[_0xfe30('0x31')]]=_0x11a8d1;_[_0xfe30('0x32')](_0xc5bfd9[_0xfe30('0x33')],_0x13abd7);}return _0x314c70[_0xfe30('0x1e')](_0xfe30('0x34'))[_0xfe30('0x22')](_0xc5bfd9,_0x5d57ab)['then'](function(_0x7eda22){if(_0x7eda22&&_0x7eda22[_0xfe30('0x25')]){return _0x7eda22;}else{var _0xf98b3d=_[_0xfe30('0x30')](_0x2c60f0);if(_0x3f2166[_0xfe30('0x35')]){var _0x1ee95a={};_0x1ee95a[_0x3f2166['additionalSearchLead']]=_0x11a8d1;_[_0xfe30('0x32')](_0xf98b3d['$or'],_0x1ee95a);}return _0x314c70[_0xfe30('0x1e')](_0xfe30('0x36'))[_0xfe30('0x22')](_0xf98b3d,_0x5d57ab);}});}});case'contact':var _0x1d4bc5=_[_0xfe30('0x30')](_0x2c60f0);if(_0x3f2166[_0xfe30('0x31')]){var _0x3f2925={};_0x3f2925[_0x3f2166['additionalSearchContact']]=_0x11a8d1;_['merge'](_0x1d4bc5[_0xfe30('0x33')],_0x3f2925);}return _0x314c70['sobject'](_0xfe30('0x34'))[_0xfe30('0x22')](_0x1d4bc5,_0x5d57ab)[_0xfe30('0x23')]();case _0xfe30('0x1a'):var _0x306011=_['cloneDeep'](_0x2c60f0);if(_0x3f2166[_0xfe30('0x35')]){var _0x3f2925={};_0x3f2925[_0x3f2166[_0xfe30('0x35')]]=_0x11a8d1;_[_0xfe30('0x32')](_0x306011['$or'],_0x3f2925);}return _0x314c70['sobject'](_0xfe30('0x36'))[_0xfe30('0x22')](_0x306011,_0x5d57ab);case'account':var _0x20d3ac=_[_0xfe30('0x30')](_0x2c60f0);if(_0x3f2166[_0xfe30('0x38')]){var _0x3f2925={};_0x3f2925[_0x3f2166[_0xfe30('0x38')]]=_0x11a8d1;_[_0xfe30('0x32')](_0x20d3ac[_0xfe30('0x33')],_0x3f2925);}return _0x314c70['sobject'](_0xfe30('0x39'))[_0xfe30('0x22')](_0x20d3ac,_0x5d57ab);default:return null;}})['then'](function(_0x396955){if(_0x396955&&_0x396955['length']){var _0x42f9ed=_[_0xfe30('0x3a')](_0x396955);if(_0x42f9ed){return BPromise[_0xfe30('0x28')]({'id':_0x42f9ed['Id'],'name':_0x42f9ed['Name'],'phone':_0x42f9ed[_0xfe30('0x3b')],'endUserType':_0x42f9ed[_0xfe30('0x3c')][_0xfe30('0x3d')]['toLowerCase']()});}}})[_0xfe30('0x24')](function(_0x52dc5f){if(_0x52dc5f){logger[_0xfe30('0x1c')](_0xfe30('0x3e'),_0x52dc5f['endUserType'],_0x11a8d1);return BPromise['resolve'](_0x52dc5f);}else{logger[_0xfe30('0x1c')](_0xfe30('0x3f'),_0x11a8d1);var _0x326508={'Phone':_0x11a8d1};if(_0x3f2166['moduleCreate']){if(_0x3f2166[_0xfe30('0x40')]===_0xfe30('0x13')){logger['info'](_0xfe30('0x41'),_0x11a8d1,_0x3f2166[_0xfe30('0x40')]);_0x326508['LastName']=_0x5ac09b!==_0xfe30('0x42')?_0x5ac09b:util[_0xfe30('0x43')](_0xfe30('0x44'),_0x11a8d1);}else if(_0x3f2166[_0xfe30('0x40')]===_0xfe30('0x1a')){logger[_0xfe30('0x1c')](_0xfe30('0x41'),_0x11a8d1,_0x3f2166[_0xfe30('0x40')]);_0x326508[_0xfe30('0x45')]=_0x5ac09b!==_0xfe30('0x42')?_0x5ac09b:util[_0xfe30('0x43')](_0xfe30('0x44'),_0x11a8d1);_0x326508['Company']=_0xfe30('0x46');}else if(_0x3f2166[_0xfe30('0x40')]===_0xfe30('0x15')){logger[_0xfe30('0x1c')](_0xfe30('0x41'),_0x11a8d1,_0x3f2166[_0xfe30('0x40')]);_0x326508[_0xfe30('0x29')]=_0x5ac09b!==_0xfe30('0x42')?_0x5ac09b:util[_0xfe30('0x43')](_0xfe30('0x44'),_0x11a8d1);}else{return null;}}return _0x314c70[_0xfe30('0x1e')](_[_0xfe30('0x47')](_0x3f2166[_0xfe30('0x40')]))['create'](_0x326508)[_0xfe30('0x24')](function(_0x27bbcc){return BPromise['resolve']({'id':_0x27bbcc['id'],'endUserType':_0x3f2166[_0xfe30('0x40')]});});}});}function getCustomFields(_0x2f7599,_0x387a50){var _0x40d0ae={};if(_0x2f7599[_0xfe30('0x25')]>0x0){_[_0xfe30('0x48')](_0x2f7599,function(_0x470a96){if(_[_0xfe30('0x49')]([_0xfe30('0x4a'),_0xfe30('0x4b')],_0x470a96[_0xfe30('0x3d')])&&_0x470a96[_0xfe30('0x4c')]){_0x40d0ae[_0x470a96[_0xfe30('0x4c')]]=_0x470a96['content'][_0xfe30('0x4d')]();}else if(_0x470a96['type']==='variable'&&_0x470a96['variableName']&&_0x470a96[_0xfe30('0x4c')]){_0x387a50[_0x470a96['variableName']]&&(_0x40d0ae[_0x470a96[_0xfe30('0x4c')]]=_0x387a50[_0x470a96[_0xfe30('0x4e')]][_0xfe30('0x4d')]());}else if(_0x470a96['type']==='customVariable'&&_0x470a96[_0xfe30('0x4f')]&&_0x470a96[_0xfe30('0x4f')][_0xfe30('0x50')]&&_0x470a96['idField']){_0x387a50[_0x470a96['Variable']['name'][_0xfe30('0x51')]()]&&(_0x40d0ae[_0x470a96[_0xfe30('0x4c')]]=_0x387a50[_0x470a96[_0xfe30('0x4f')][_0xfe30('0x50')]['toLowerCase']()][_0xfe30('0x4d')]());}});}return _0x40d0ae;}function getConnection(_0x34be05){var _0x2c3d97=_0x34be05['password']['concat'](_0x34be05[_0xfe30('0x52')]);var _0x16f97c=new jsforce[(_0xfe30('0x53'))]({'oauth2':{'loginUrl':_0x34be05[_0xfe30('0x54')]||_0xfe30('0x55'),'clientId':_0x34be05[_0xfe30('0x56')],'clientSecret':_0x34be05['clientSecret']}});return _0x16f97c['login'](_0x34be05[_0xfe30('0x57')],_0x2c3d97)[_0xfe30('0x24')](function(){logger[_0xfe30('0x1c')](_0xfe30('0x58'));return _0x16f97c;});}exports[_0xfe30('0x59')]=function(_0x51fea2,_0x2b1bf7,_0xd016cf,_0x2aafd1,_0x5c3f94,_0x2cea7c){var _0x14fdf9,_0x22a1e4,_0x14d614,_0x535354;_0x2cea7c['serverUrl']=intUtil[_0xfe30('0x5a')](_0x2cea7c[_0xfe30('0x5b')]);_0x2cea7c[_0xfe30('0x54')]=intUtil[_0xfe30('0x5a')](_0x2cea7c[_0xfe30('0x54')]);if(_0x5c3f94&&_0x5c3f94[_0xfe30('0x5c')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2b1bf7['recordingURL']=util[_0xfe30('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2cea7c[_0xfe30('0x5b')],_0x2b1bf7[_0xfe30('0x5d')],md5(_0x2b1bf7[_0xfe30('0x5d')]));}else{_0x2b1bf7[_0xfe30('0x5e')]='';}return getConnection(_0x2cea7c)[_0xfe30('0x24')](function(_0x98089c){_0x535354=_0x98089c;return getUser(_0x2cea7c,_0x2aafd1[_0xfe30('0x5f')],_0x535354);})['then'](function(_0x23e380){_0x14fdf9=_0x23e380;return getEndUser(_0x2cea7c,_0xd016cf,_0x2b1bf7[_0xfe30('0x60')],_0x2b1bf7[_0xfe30('0x61')],_0x535354);})['then'](function(_0x438a97){_0x22a1e4=_0x438a97;return getTicket(_0x2cea7c,_0x14fdf9,_0x22a1e4,_0xd016cf,_0x2b1bf7,_0xd016cf[_0xfe30('0x62')],_0x535354,_0xfe30('0x59'));})['then'](function(_0x1f5e39){_0x14d614=_0x1f5e39;logger[_0xfe30('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x14d614['id']);logger[_0xfe30('0x1c')](_0xfe30('0x63'),_0x14d614['id'],_0x2aafd1[_0xfe30('0x50')],_0x2cea7c[_0xfe30('0x3d')]);switch(_0x2cea7c[_0xfe30('0x3d')]){case _0xfe30('0x64'):emit(util[_0xfe30('0x43')](_0xfe30('0x65'),_0x2aafd1['name']),_0xfe30('0x66'),{'recordId':_0x14d614['id']});break;case _0xfe30('0x67'):emit(util[_0xfe30('0x43')](_0xfe30('0x65'),_0x2aafd1[_0xfe30('0x50')]),_0xfe30('0x68'),{'uri':util['format'](_0xfe30('0x69'),_0x535354[_0xfe30('0x6a')],_0x14d614['id'])});break;default:logger[_0xfe30('0x6b')](_0xfe30('0x6c'));}})['catch'](function(_0x464f3a){logger[_0xfe30('0x6b')](_0xfe30('0x6d'),_0x464f3a);});};exports['outbound']=function(_0x201fef,_0x2eead0,_0x33023d,_0x2984ef,_0x52ae6f,_0x55c296,_0xce4d20){var _0x20fb56,_0x563554,_0x4c98af,_0x246602;_0x55c296['serverUrl']=intUtil[_0xfe30('0x5a')](_0x55c296[_0xfe30('0x5b')]);_0x55c296[_0xfe30('0x54')]=intUtil[_0xfe30('0x5a')](_0x55c296[_0xfe30('0x54')]);if(_0xce4d20&&_0xce4d20['recordingFormat']&&_0xce4d20['recordingFormat']!=='none'){logger[_0xfe30('0x1c')](_0xfe30('0x6e'),_0xfe30('0x6f'));_0x2eead0[_0xfe30('0x5e')]=util[_0xfe30('0x43')](_0xfe30('0x70'),_0x55c296[_0xfe30('0x5b')],_0x2eead0[_0xfe30('0x5d')],md5(_0x2eead0['uniqueid']));}return getConnection(_0x55c296)[_0xfe30('0x24')](function(_0xa13e47){_0x246602=_0xa13e47;return getUser(_0x55c296,_0x2984ef[_0xfe30('0x5f')],_0x246602);})[_0xfe30('0x24')](function(_0x44e587){_0x20fb56=_0x44e587;return getEndUser(_0x55c296,_0x33023d,_0x2eead0[_0xfe30('0x71')],_0x2eead0[_0xfe30('0x72')],_0x246602);})[_0xfe30('0x24')](function(_0x46cd9c){_0x563554=_0x46cd9c;return getTicket(_0x55c296,_0x20fb56,_0x563554,_0x33023d,_0x2eead0,_0x33023d['Fields'],_0x246602,_0xfe30('0x73'));})[_0xfe30('0x24')](function(_0x503865){_0x4c98af=_0x503865;logger[_0xfe30('0x1c')](_0xfe30('0x74'),_0x4c98af['id']);logger[_0xfe30('0x1c')](_0xfe30('0x75'),_0x4c98af['id'],_0x2984ef[_0xfe30('0x50')],_0x55c296[_0xfe30('0x3d')]);switch(_0x55c296[_0xfe30('0x3d')]){case _0xfe30('0x64'):emit(util[_0xfe30('0x43')](_0xfe30('0x65'),_0x2984ef[_0xfe30('0x50')]),'trigger:salesforce:display',{'recordId':_0x4c98af['id']});break;case _0xfe30('0x67'):emit(util[_0xfe30('0x43')]('user:%s',_0x2984ef['name']),_0xfe30('0x68'),{'uri':util[_0xfe30('0x43')]('%s/%s/e',_0x246602['instanceUrl'],_0x4c98af['id'])});break;default:logger[_0xfe30('0x6b')](_0xfe30('0x6e'),_0xfe30('0x76'));}})[_0xfe30('0x77')](function(_0x4fb113){logger[_0xfe30('0x6b')](_0xfe30('0x6e'),_0x4fb113);});};exports[_0xfe30('0x78')]=function(_0x24f58c,_0x37a32d,_0x49c7dd,_0x22685a,_0x246fd1,_0x5d48ba){var _0x26b6bf,_0x37d6ea,_0x3d956f,_0x3674c8;_0x5d48ba[_0xfe30('0x5b')]=intUtil[_0xfe30('0x5a')](_0x5d48ba[_0xfe30('0x5b')]);_0x5d48ba[_0xfe30('0x54')]=intUtil['stripTrailingSlash'](_0x5d48ba[_0xfe30('0x54')]);if(_0x246fd1&&_0x246fd1[_0xfe30('0x5c')]){logger[_0xfe30('0x1c')]('['+_0x37a32d[_0xfe30('0x79')][_0xfe30('0x7a')]()+']',_0xfe30('0x6f'));_0x37a32d[_0xfe30('0x5e')]=util[_0xfe30('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d48ba[_0xfe30('0x5b')],_0x37a32d[_0xfe30('0x5d')],md5(_0x37a32d['uniqueid']));}else{_0x37a32d['recordingURL']='';}return getConnection(_0x5d48ba)[_0xfe30('0x24')](function(_0x279d89){_0x3674c8=_0x279d89;if(!_['isNil'](_0x22685a)){return getUser(_0x5d48ba,_0x22685a[_0xfe30('0x50')],_0x3674c8);}else{return getUser(_0x5d48ba,null,_0x3674c8);}})[_0xfe30('0x24')](function(_0x3675bb){_0x26b6bf=_0x3675bb;return getEndUser(_0x5d48ba,_0x49c7dd,_0x37a32d[_0xfe30('0x60')],_0x37a32d[_0xfe30('0x61')],_0x3674c8);})['then'](function(_0x249010){_0x37d6ea=_0x249010;return getTicket(_0x5d48ba,_0x26b6bf,_0x37d6ea,_0x49c7dd,_0x37a32d,_0x49c7dd[_0xfe30('0x62')],_0x3674c8);})[_0xfe30('0x24')](function(_0x563424){_0x3d956f=_0x563424;logger[_0xfe30('0x1c')]('['+_0x37a32d[_0xfe30('0x79')]['toUpperCase']()+_0xfe30('0x7b'),_0x3d956f['id']);logger[_0xfe30('0x1c')]('['+_0x37a32d[_0xfe30('0x79')][_0xfe30('0x7a')]()+_0xfe30('0x7c'),_0x5d48ba['type']);})[_0xfe30('0x77')](function(_0x487ddd){logger['error']('['+_0x37a32d['lastevent']['toUpperCase']()+']',_0x487ddd);});}; \ 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 7b4a05f..d87d1e5 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 _0x2b56=['nameField','toLowerCase','toString','string','idField','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Subjects','Descriptions','Fields','ticketId',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%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','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','userId','adminEmail',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','true','System','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','type','customField'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2b56,0x184));var _0x62b5=function(_0x586f48,_0x3d1aec){_0x586f48=_0x586f48-0x0;var _0x5c51ae=_0x2b56[_0x586f48];return _0x5c51ae;};'use strict';var _=require('lodash');var Promise=require(_0x62b5('0x0'));var rp=require(_0x62b5('0x1'));var util=require(_0x62b5('0x2'));var md5=require('md5');var Redis=require(_0x62b5('0x3'));var intUtil=require(_0x62b5('0x4'));var config=require('../../../../config/environment');var logger=require(_0x62b5('0x5'))(_0x62b5('0x6'));config[_0x62b5('0x7')]=_[_0x62b5('0x8')](config[_0x62b5('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x62b5('0x9'))(new Redis(config[_0x62b5('0x7')]));function getAdminUser(_0x370ed1,_0x51480b,_0x7a6f43,_0x2a8095,_0x104cbf,_0x1f4339){return new Promise(function(_0x1af12a,_0x2c580b){var _0x51c1dc={'method':'GET','uri':_0x2a8095+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x104cbf+'&'+_0x1f4339,'auth':_0x51480b,'json':!![]};return rp(_0x51c1dc)['then'](function(_0x3c8072){if(_0x3c8072[_0x62b5('0xa')][_0x62b5('0xb')]>0x0){_0x7a6f43[_0x62b5('0xc')]=_0x3c8072['result'][0x0][_0x62b5('0xd')];}logger[_0x62b5('0xe')]('['+[_0x370ed1[_0x62b5('0xf')]()]+_0x62b5('0x10'),_0x7a6f43);_0x1af12a(_0x7a6f43);})[_0x62b5('0x11')](function(_0x418b40){logger[_0x62b5('0x12')]('['+[_0x370ed1['toUpperCase']()]+']',_0x418b40[_0x62b5('0x13')]);_0x2c580b(_0x418b40[_0x62b5('0x13')]);});});}function getUser(_0x17c42c,_0x573194,_0x25e05a,_0x579750,_0x1057ab){return function(_0x1b57bc){logger['info']('['+[_0x17c42c[_0x62b5('0xf')]()]+_0x62b5('0x14'),_0x1b57bc);return new Promise(function(_0x4831ef,_0x31bf8a){if(intUtil[_0x62b5('0x15')](_0x1b57bc[_0x62b5('0x16')])){var _0x26a0d5={'method':'GET','uri':_0x25e05a+_0x62b5('0x17')+_0x1b57bc[_0x62b5('0x16')]+'&'+_0x579750+'&'+_0x1057ab,'auth':_0x573194,'json':!![]};logger[_0x62b5('0xe')]('['+[_0x17c42c['toUpperCase']()]+_0x62b5('0x18'),_0x26a0d5);return rp(_0x26a0d5)['then'](function(_0x3c90be){logger[_0x62b5('0xe')]('['+[_0x17c42c[_0x62b5('0xf')]()]+'],\x20getUser\x20entity',_0x3c90be);if(_0x3c90be[_0x62b5('0xa')][_0x62b5('0xb')]>0x0&&String(_0x3c90be[_0x62b5('0xa')][0x0]['active'])==='true'){_0x1b57bc[_0x62b5('0x19')]=_0x3c90be['result'][0x0][_0x62b5('0xd')];}else{_0x1b57bc[_0x62b5('0x19')]=_0x1b57bc[_0x62b5('0xc')];_0x1b57bc[_0x62b5('0x16')]=_0x1b57bc[_0x62b5('0x1a')];}logger[_0x62b5('0xe')]('['+[_0x17c42c[_0x62b5('0xf')]()]+'],\x20getUser\x20crm',_0x1b57bc);_0x4831ef(_0x1b57bc);})[_0x62b5('0x11')](function(_0x17934d){logger[_0x62b5('0x12')]('['+[_0x17c42c[_0x62b5('0xf')]()]+']',_0x17934d['message']);_0x31bf8a(_0x17934d[_0x62b5('0x13')]);});}else{logger[_0x62b5('0xe')]('['+[_0x17c42c['toUpperCase']()]+_0x62b5('0x1b'));_0x1b57bc[_0x62b5('0x19')]=_0x1b57bc[_0x62b5('0xc')];_0x1b57bc[_0x62b5('0x16')]=_0x1b57bc[_0x62b5('0x1a')];_0x4831ef(_0x1b57bc);}});};}function createEndUser(_0x2ccec8,_0x55d85c,_0x868e5d,_0x2b00ac,_0x13e0b0){logger[_0x62b5('0xe')]('['+[_0x2ccec8[_0x62b5('0xf')]()]+'],\x20createEndUser\x20input\x20crm',_0x868e5d);return new Promise(function(_0x1a34c0,_0x46f920){var _0x4c2ec5={'method':_0x62b5('0x1c'),'uri':_0x2b00ac+_0x62b5('0x1d')+_0x13e0b0,'body':{'user_name':_0x868e5d[_0x62b5('0x1e')],'roles':_0x62b5('0x1f'),'first_name':_0x868e5d[_0x62b5('0x1e')],'active':_0x62b5('0x20'),'date_format':_0x62b5('0x21'),'phone':_0x868e5d[_0x62b5('0x1e')]},'auth':_0x55d85c,'json':!![]};return rp(_0x4c2ec5)[_0x62b5('0x22')](function(_0x5bdd3a){logger['info']('['+[_0x2ccec8[_0x62b5('0xf')]()]+_0x62b5('0x23'),_0x5bdd3a[_0x62b5('0xa')]);_0x868e5d[_0x62b5('0x24')]=_0x5bdd3a[_0x62b5('0xa')][_0x62b5('0xd')];_0x1a34c0(_0x868e5d);})[_0x62b5('0x11')](function(_0xf12262){logger[_0x62b5('0x12')]('['+[_0x2ccec8[_0x62b5('0xf')]()]+']',_0xf12262[_0x62b5('0x13')]);_0x46f920(_0xf12262['message']);});});}function getEndUser(_0xba546d,_0x13b49e,_0x3a2cdd,_0x15bddc,_0x4cdca8){return function(_0x18fe2a){logger[_0x62b5('0xe')]('['+[_0xba546d[_0x62b5('0xf')]()]+_0x62b5('0x25'),_0x18fe2a);return new Promise(function(_0x1a51d5,_0x1458e4){var _0x13a503={'method':_0x62b5('0x26'),'uri':_0x3a2cdd+'sys_user?sysparm_query=phone%3D'+_0x18fe2a[_0x62b5('0x1e')]+'&'+_0x15bddc+'&'+_0x4cdca8,'auth':_0x13b49e,'json':!![]};return rp(_0x13a503)[_0x62b5('0x22')](function(_0x1d74bb){if(_0x1d74bb[_0x62b5('0xa')][_0x62b5('0xb')]>0x0){_0x18fe2a[_0x62b5('0x24')]=_0x1d74bb[_0x62b5('0xa')][0x0][_0x62b5('0xd')];logger['info']('['+[_0xba546d[_0x62b5('0xf')]()]+_0x62b5('0x27'),_0x18fe2a);_0x1a51d5(_0x18fe2a);}else{return createEndUser(_0xba546d,_0x13b49e,_0x18fe2a,_0x3a2cdd,_0x15bddc)[_0x62b5('0x22')](function(_0xa89e50){logger[_0x62b5('0xe')]('['+[_0xba546d[_0x62b5('0xf')]()]+_0x62b5('0x28'),_0xa89e50);_0x1a51d5(_0xa89e50);});}})[_0x62b5('0x11')](function(_0xe72eb7){logger[_0x62b5('0x12')]('['+[_0xba546d['toUpperCase']()]+']',_0xe72eb7[_0x62b5('0x13')]);_0x1458e4(_0xe72eb7['message']);});});};}function getCustomFields(_0x1a2bfd,_0x15f331){var _0x54f11e={};if(_0x1a2bfd[_0x62b5('0xb')]>0x0){_['forEach'](_0x1a2bfd,function(_0x21d2ef){if(_[_0x62b5('0x29')](['string','picklist'],_0x21d2ef[_0x62b5('0x2a')])&&_0x21d2ef['nameField']&&!_0x21d2ef[_0x62b5('0x2b')]){_0x54f11e[_0x21d2ef[_0x62b5('0x2c')][_0x62b5('0x2d')]()]=_0x21d2ef['content'][_0x62b5('0x2e')]();}else if(_[_0x62b5('0x29')]([_0x62b5('0x2f'),'picklist'],_0x21d2ef[_0x62b5('0x2a')])&&_0x21d2ef[_0x62b5('0x30')]&&_0x21d2ef[_0x62b5('0x2b')]){_0x54f11e[_0x21d2ef[_0x62b5('0x30')][_0x62b5('0x2d')]()]=_0x21d2ef[_0x62b5('0x31')]['toString']();}else if(_0x21d2ef[_0x62b5('0x2a')]===_0x62b5('0x32')&&_0x21d2ef[_0x62b5('0x33')]&&_0x21d2ef[_0x62b5('0x30')]&&_0x21d2ef['customField']){_0x54f11e[_0x21d2ef[_0x62b5('0x30')][_0x62b5('0x2d')]()]=_0x15f331[_0x21d2ef[_0x62b5('0x33')]][_0x62b5('0x2e')]();}else if(_0x21d2ef[_0x62b5('0x2a')]===_0x62b5('0x34')&&_0x21d2ef['Variable']&&_0x21d2ef[_0x62b5('0x35')][_0x62b5('0x36')]&&_0x21d2ef[_0x62b5('0x30')]&&_0x21d2ef[_0x62b5('0x2b')]){_0x54f11e[_0x21d2ef[_0x62b5('0x30')][_0x62b5('0x2d')]()]=_0x15f331[_0x21d2ef[_0x62b5('0x35')][_0x62b5('0x36')][_0x62b5('0x2d')]()]['toString']();}});}return _0x54f11e;}function getTicket(_0x29ae27,_0x408246,_0x4303d6,_0x55631c,_0x2519b0,_0x18590e){return function(_0x112869){logger[_0x62b5('0xe')]('['+[_0x29ae27[_0x62b5('0xf')]()]+_0x62b5('0x37'),_0x112869);return new Promise(function(_0x3ee8e0,_0x17a75a){var _0x3a4a29=_0x29ae27[_0x62b5('0x2d')]()==='outbound'?_0x112869['userId']:_0x112869[_0x62b5('0x24')];var _0x8a13ed={'method':_0x62b5('0x1c'),'uri':_0x4303d6+'incident'+'?'+_0x18590e,'body':Object[_0x62b5('0x38')]({},{'active':'true','caller_id':_0x3a4a29,'assigned_to':_0x112869[_0x62b5('0x19')],'short_description':intUtil[_0x62b5('0x39')](_0x55631c[_0x62b5('0x3a')],_0x2519b0,'\x20'),'description':intUtil[_0x62b5('0x39')](_0x55631c[_0x62b5('0x3b')],_0x2519b0,'\x0a')},getCustomFields(_0x55631c[_0x62b5('0x3c')],_0x2519b0)),'auth':_0x408246,'json':!![]};return rp(_0x8a13ed)['then'](function(_0x3aef27){logger[_0x62b5('0xe')]('['+[_0x29ae27[_0x62b5('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x3aef27[_0x62b5('0xa')]);_0x112869[_0x62b5('0x3d')]=_0x3aef27['result'][_0x62b5('0xd')];_0x112869['ticketNumber']=_0x3aef27['result']['number'];logger['info']('['+[_0x29ae27[_0x62b5('0xf')]()]+_0x62b5('0x3e'),_0x112869);_0x3ee8e0(_0x112869);})[_0x62b5('0x11')](function(_0x49bf46){logger[_0x62b5('0x12')]('['+[_0x29ae27[_0x62b5('0xf')]()]+']',_0x49bf46[_0x62b5('0x13')]);_0x17a75a(_0x49bf46[_0x62b5('0x13')]);});});};}function createRemoteTag(_0x8a9111,_0x174ee2,_0x329494,_0x903f69){return new Promise(function(_0x27b2b7,_0x1e8233){var _0x33334f={'method':'POST','uri':_0x329494+_0x62b5('0x3f')+'?'+_0x903f69,'body':{'short_description':_0x8a9111,'global':!![],'active':!![],'name':_0x8a9111},'auth':_0x174ee2,'json':!![]};return rp(_0x33334f)[_0x62b5('0x22')](function(_0x5bc164){var _0x3578cc=_0x5bc164[_0x62b5('0xa')][_0x62b5('0xd')];_0x27b2b7(_0x3578cc);});});}function getRemoteTag(_0x4a75df,_0x588ace,_0x57b5ee,_0x3e548b,_0x33534c){return new Promise(function(_0x5ecb75,_0x57301b){var _0x3e3457={'method':_0x62b5('0x26'),'uri':_0x57b5ee+_0x62b5('0x3f')+_0x62b5('0x40')+_0x4a75df+'&'+_0x3e548b,'auth':_0x588ace,'json':!![]};return rp(_0x3e3457)[_0x62b5('0x22')](function(_0x23ee2e){if(_0x23ee2e[_0x62b5('0xa')][_0x62b5('0xb')]>0x0){var _0x5090a5=_0x23ee2e[_0x62b5('0xa')][0x0]['sys_id'];_0x5ecb75(_0x5090a5);}else{return createRemoteTag(_0x4a75df,_0x588ace,_0x57b5ee,_0x3e548b)[_0x62b5('0x22')](function(_0x13769a){_0x5ecb75(_0x13769a);});}});});}function assignTagToIncident(_0x52fdb4,_0x2e5025,_0x59f4e6,_0x33de98,_0x34bd76){return new Promise(function(_0xa3b1e6,_0x40a100){var _0x565acf={'method':_0x62b5('0x1c'),'uri':_0x59f4e6+_0x62b5('0x41')+'?'+_0x34bd76,'body':{'label':_0x52fdb4,'table':'incident','id_type':_0x62b5('0x42'),'table_key':_0x33de98[_0x62b5('0x3d')],'title':_0x62b5('0x43')+_0x33de98[_0x62b5('0x44')],'id_display':_0x33de98[_0x62b5('0x44')]},'auth':_0x2e5025,'json':!![]};return rp(_0x565acf)[_0x62b5('0x22')](function(_0x4c95f1){_0xa3b1e6();})[_0x62b5('0x11')](function(){_0xa3b1e6();});});}function manageTags(_0x87c828,_0x413b58,_0x4961d0,_0x3b5591,_0x5c10d8,_0x543ead,_0x3cf37b){return new Promise(function(_0x1e8dca,_0xe6bf94){var _0x1036c9=[];_0x413b58['forEach'](function(_0x2bf7df){_0x1036c9[_0x62b5('0x45')](getRemoteTag(_0x2bf7df,_0x4961d0,_0x3b5591,_0x543ead,_0x3cf37b));});return Promise[_0x62b5('0x46')](_0x1036c9)[_0x62b5('0x22')](function(_0x1d5373){if(_0x1d5373[_0x62b5('0xb')]){logger[_0x62b5('0xe')]('['+[_0x87c828['toUpperCase']()]+_0x62b5('0x47'),_0x1d5373);var _0x5df0f8=[];_0x1d5373['forEach'](function(_0x47ebfa){_0x5df0f8[_0x62b5('0x45')](assignTagToIncident(_0x47ebfa,_0x4961d0,_0x3b5591,_0x5c10d8,_0x543ead));});return Promise['all'](_0x5df0f8)[_0x62b5('0x22')](function(){_0x1e8dca();})[_0x62b5('0x11')](function(){_0x1e8dca();});}else{_0x1e8dca();}});});}function getTags(_0x554509,_0x5048d7,_0x12c864,_0x4482b8,_0x59ee3f,_0xd2dd85){return function(_0x218ed1){return new Promise(function(_0x4cea14,_0x33fa38){var _0x21337c=[];var _0x4c4ee3=_0x4482b8[_0x62b5('0x48')];if(_0x4c4ee3&&_0x4c4ee3[_0x62b5('0xb')]>0x0){_0x21337c=_['map'](_0x4c4ee3,_0x62b5('0x36'));}if(_0x21337c['length']>0x0){return manageTags(_0x554509,_0x21337c,_0x5048d7,_0x12c864,_0x218ed1,_0x59ee3f,_0xd2dd85)['then'](function(){_0x4cea14(_0x218ed1);});}else{_0x4cea14(_0x218ed1);}});};}function emit(_0x148493,_0x32c8e0,_0x48b2fc){var _0x2116bd=_0x62b5('0x49')+_0x62b5('0x4a')+_0x62b5('0x4b')+_0x62b5('0x4c');var _0xdf52ed={'uri':_0x148493+_0x62b5('0x4d')+_0x48b2fc+_0x2116bd};io['to'](util['format']('user:%s',_0x32c8e0))['emit'](_0x62b5('0x4e'),_0xdf52ed);}exports['cs']=function(_0x2f542c,_0x339d8c,_0x33c171,_0x49e176,_0x320711,_0x1ab29a,_0x453c7e,_0x34bd6b){var _0x34e327={};var _0x2f7439={'user':_0x1ab29a[_0x62b5('0x4f')],'pass':_0x1ab29a[_0x62b5('0x50')]};var _0x3d6ff6=_0x62b5('0x51');var _0x1ddd2a=_0x62b5('0x52');_0x1ab29a[_0x62b5('0x53')]=intUtil[_0x62b5('0x54')](_0x1ab29a[_0x62b5('0x53')]);_0x1ab29a[_0x62b5('0x55')]=intUtil[_0x62b5('0x54')](_0x1ab29a[_0x62b5('0x55')]);var _0x229fe8=util[_0x62b5('0x56')]('%s/api/now/table/',_0x1ab29a[_0x62b5('0x53')]);_0x34e327[_0x62b5('0x16')]=!_[_0x62b5('0x57')](_0x49e176)?_0x49e176[_0x62b5('0x58')]:null;_0x34e327[_0x62b5('0x1a')]=_0x1ab29a[_0x62b5('0x58')];_0x34e327[_0x62b5('0x1e')]=_0x34bd6b['toLowerCase']()==='outbound'?_0x339d8c[_0x62b5('0x59')]:_0x339d8c[_0x62b5('0x5a')];_0x34e327[_0x62b5('0x5b')]=_0x34bd6b===_0x62b5('0x5c')||_0x34bd6b===_0x62b5('0x5d')?_0x62b5('0x5c'):_0x62b5('0x5e');var _0x5072cd=util['format'](_0x62b5('0x5f'),_0x1ab29a[_0x62b5('0x55')],_0x339d8c[_0x62b5('0x60')],md5(_0x339d8c[_0x62b5('0x60')]));if(_0x320711&&_0x320711['monitor_format']){logger[_0x62b5('0xe')](_0x62b5('0x61'),_0x62b5('0x62'));_0x339d8c['recordingURL']=_0x5072cd;}else if(_0x453c7e&&_0x453c7e[_0x62b5('0x63')]&&_0x453c7e[_0x62b5('0x63')]!==_0x62b5('0x64')){logger[_0x62b5('0xe')](_0x62b5('0x65'),_0x62b5('0x62'));_0x339d8c[_0x62b5('0x66')]=_0x5072cd;}else{_0x339d8c['recordingURL']='';}return getAdminUser(_0x34bd6b,_0x2f7439,_0x34e327,_0x229fe8,_0x1ddd2a,_0x3d6ff6)[_0x62b5('0x22')](getUser(_0x34bd6b,_0x2f7439,_0x229fe8,_0x1ddd2a,_0x3d6ff6))[_0x62b5('0x22')](getEndUser(_0x34bd6b,_0x2f7439,_0x229fe8,_0x1ddd2a,_0x3d6ff6))[_0x62b5('0x22')](getTicket(_0x34bd6b,_0x2f7439,_0x229fe8,_0x33c171,_0x339d8c,_0x1ddd2a))['then'](function(_0x3ed57e){logger[_0x62b5('0xe')](util[_0x62b5('0x56')](_0x62b5('0x67'),_0x3ed57e[_0x62b5('0x3d')]));logger[_0x62b5('0xe')](util[_0x62b5('0x56')](_0x62b5('0x68'),_0x34bd6b));if(_0x34bd6b!=='unmanaged'){logger['info']('['+[_0x34bd6b[_0x62b5('0xf')]()]+']',_0x62b5('0x69'));emit(_0x1ab29a[_0x62b5('0x53')],_0x49e176[_0x62b5('0x36')],_0x3ed57e[_0x62b5('0x3d')]);}})[_0x62b5('0x11')](function(_0x284b04){logger[_0x62b5('0x12')]('['+[_0x34bd6b[_0x62b5('0xf')]()]+_0x62b5('0x6a'),util[_0x62b5('0x6b')](_0x284b04,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5589=['incident','Incident','Incident\x20-\x20','ticketNumber','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','destcalleridnum','calleridnum','callDirection','queue','format','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','active','true','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','userId','adminEmail','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','content','toString','idField','toLowerCase','variable','variableName','customField','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','label_entry'];(function(_0x101152,_0x397ab0){var _0xe1c465=function(_0x25de02){while(--_0x25de02){_0x101152['push'](_0x101152['shift']());}};_0xe1c465(++_0x397ab0);}(_0x5589,0x1d8));var _0x9558=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5589[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x9558('0x0'));var Promise=require('bluebird');var rp=require(_0x9558('0x1'));var util=require(_0x9558('0x2'));var md5=require(_0x9558('0x3'));var Redis=require(_0x9558('0x4'));var intUtil=require(_0x9558('0x5'));var config=require(_0x9558('0x6'));var logger=require(_0x9558('0x7'))('servicenow');config['redis']=_[_0x9558('0x8')](config[_0x9558('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x9558('0xa'))(new Redis(config[_0x9558('0x9')]));function getAdminUser(_0x14dd0f,_0x2ceeaf,_0x21bdf3,_0x3f2ecc,_0x46b913,_0x24d475){return new Promise(function(_0x3d0394,_0x127f85){var _0x55dd47={'method':_0x9558('0xb'),'uri':_0x3f2ecc+_0x9558('0xc')+'&'+_0x46b913+'&'+_0x24d475,'auth':_0x2ceeaf,'json':!![]};return rp(_0x55dd47)['then'](function(_0x5ec0eb){if(_0x5ec0eb[_0x9558('0xd')][_0x9558('0xe')]>0x0){_0x21bdf3[_0x9558('0xf')]=_0x5ec0eb['result'][0x0][_0x9558('0x10')];}logger[_0x9558('0x11')]('['+[_0x14dd0f[_0x9558('0x12')]()]+_0x9558('0x13'),_0x21bdf3);_0x3d0394(_0x21bdf3);})[_0x9558('0x14')](function(_0x4e5168){logger['error']('['+[_0x14dd0f['toUpperCase']()]+']',_0x4e5168[_0x9558('0x15')]);_0x127f85(_0x4e5168[_0x9558('0x15')]);});});}function getUser(_0xa493b5,_0x91902c,_0x2e5702,_0x11b467,_0x2ead9f){return function(_0x473070){logger[_0x9558('0x11')]('['+[_0xa493b5[_0x9558('0x12')]()]+_0x9558('0x16'),_0x473070);return new Promise(function(_0x448167,_0x2d1bfa){if(intUtil[_0x9558('0x17')](_0x473070[_0x9558('0x18')])){var _0x6e616d={'method':_0x9558('0xb'),'uri':_0x2e5702+_0x9558('0x19')+_0x473070[_0x9558('0x18')]+'&'+_0x11b467+'&'+_0x2ead9f,'auth':_0x91902c,'json':!![]};logger[_0x9558('0x11')]('['+[_0xa493b5['toUpperCase']()]+_0x9558('0x1a'),_0x6e616d);return rp(_0x6e616d)[_0x9558('0x1b')](function(_0x1544b1){logger[_0x9558('0x11')]('['+[_0xa493b5[_0x9558('0x12')]()]+_0x9558('0x1c'),_0x1544b1);if(_0x1544b1[_0x9558('0xd')][_0x9558('0xe')]>0x0&&String(_0x1544b1[_0x9558('0xd')][0x0][_0x9558('0x1d')])===_0x9558('0x1e')){_0x473070['userId']=_0x1544b1[_0x9558('0xd')][0x0][_0x9558('0x10')];}else{_0x473070['userId']=_0x473070[_0x9558('0xf')];_0x473070[_0x9558('0x18')]=_0x473070['adminEmail'];}logger['info']('['+[_0xa493b5['toUpperCase']()]+_0x9558('0x1f'),_0x473070);_0x448167(_0x473070);})[_0x9558('0x14')](function(_0x7e228a){logger[_0x9558('0x20')]('['+[_0xa493b5['toUpperCase']()]+']',_0x7e228a[_0x9558('0x15')]);_0x2d1bfa(_0x7e228a['message']);});}else{logger[_0x9558('0x11')]('['+[_0xa493b5[_0x9558('0x12')]()]+_0x9558('0x21'));_0x473070[_0x9558('0x22')]=_0x473070['adminId'];_0x473070[_0x9558('0x18')]=_0x473070[_0x9558('0x23')];_0x448167(_0x473070);}});};}function createEndUser(_0x358e73,_0x22151f,_0x504122,_0x4d4a0c,_0xf272b1){logger[_0x9558('0x11')]('['+[_0x358e73['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x504122);return new Promise(function(_0x1b3d1a,_0x55d724){var _0x29ccae={'method':_0x9558('0x24'),'uri':_0x4d4a0c+_0x9558('0x25')+_0xf272b1,'body':{'user_name':_0x504122[_0x9558('0x26')],'roles':_0x9558('0x27'),'first_name':_0x504122['endUserNumber'],'active':_0x9558('0x1e'),'date_format':_0x9558('0x28'),'phone':_0x504122[_0x9558('0x26')]},'auth':_0x22151f,'json':!![]};return rp(_0x29ccae)[_0x9558('0x1b')](function(_0x7f23d3){logger[_0x9558('0x11')]('['+[_0x358e73[_0x9558('0x12')]()]+_0x9558('0x29'),_0x7f23d3[_0x9558('0xd')]);_0x504122[_0x9558('0x2a')]=_0x7f23d3['result']['sys_id'];_0x1b3d1a(_0x504122);})[_0x9558('0x14')](function(_0x141b38){logger[_0x9558('0x20')]('['+[_0x358e73[_0x9558('0x12')]()]+']',_0x141b38[_0x9558('0x15')]);_0x55d724(_0x141b38[_0x9558('0x15')]);});});}function getEndUser(_0x20fce3,_0x115691,_0x2922f1,_0x1b062b,_0x5dd9c2){return function(_0x3010e3){logger[_0x9558('0x11')]('['+[_0x20fce3[_0x9558('0x12')]()]+_0x9558('0x2b'),_0x3010e3);return new Promise(function(_0xba09af,_0x5bdd1d){var _0x5687bd={'method':_0x9558('0xb'),'uri':_0x2922f1+_0x9558('0x2c')+_0x3010e3[_0x9558('0x26')]+'&'+_0x1b062b+'&'+_0x5dd9c2,'auth':_0x115691,'json':!![]};return rp(_0x5687bd)[_0x9558('0x1b')](function(_0x52fd0c){if(_0x52fd0c[_0x9558('0xd')][_0x9558('0xe')]>0x0){_0x3010e3[_0x9558('0x2a')]=_0x52fd0c[_0x9558('0xd')][0x0][_0x9558('0x10')];logger[_0x9558('0x11')]('['+[_0x20fce3[_0x9558('0x12')]()]+'],\x20getEndUser\x20crm',_0x3010e3);_0xba09af(_0x3010e3);}else{return createEndUser(_0x20fce3,_0x115691,_0x3010e3,_0x2922f1,_0x1b062b)[_0x9558('0x1b')](function(_0x28914d){logger[_0x9558('0x11')]('['+[_0x20fce3[_0x9558('0x12')]()]+_0x9558('0x2d'),_0x28914d);_0xba09af(_0x28914d);});}})[_0x9558('0x14')](function(_0x13f1ab){logger['error']('['+[_0x20fce3[_0x9558('0x12')]()]+']',_0x13f1ab[_0x9558('0x15')]);_0x5bdd1d(_0x13f1ab['message']);});});};}function getCustomFields(_0xdaf83b,_0x284ab9){var _0x58ce3d={};if(_0xdaf83b['length']>0x0){_[_0x9558('0x2e')](_0xdaf83b,function(_0xbe746c){if(_[_0x9558('0x2f')]([_0x9558('0x30'),_0x9558('0x31')],_0xbe746c[_0x9558('0x32')])&&_0xbe746c[_0x9558('0x33')]&&!_0xbe746c['customField']){_0x58ce3d[_0xbe746c['nameField']['toLowerCase']()]=_0xbe746c[_0x9558('0x34')][_0x9558('0x35')]();}else if(_['includes']([_0x9558('0x30'),_0x9558('0x31')],_0xbe746c[_0x9558('0x32')])&&_0xbe746c[_0x9558('0x36')]&&_0xbe746c['customField']){_0x58ce3d[_0xbe746c[_0x9558('0x36')][_0x9558('0x37')]()]=_0xbe746c[_0x9558('0x34')][_0x9558('0x35')]();}else if(_0xbe746c[_0x9558('0x32')]===_0x9558('0x38')&&_0xbe746c[_0x9558('0x39')]&&_0xbe746c[_0x9558('0x36')]&&_0xbe746c[_0x9558('0x3a')]){_0x58ce3d[_0xbe746c[_0x9558('0x36')][_0x9558('0x37')]()]=_0x284ab9[_0xbe746c[_0x9558('0x39')]][_0x9558('0x35')]();}else if(_0xbe746c[_0x9558('0x32')]==='customVariable'&&_0xbe746c[_0x9558('0x3b')]&&_0xbe746c[_0x9558('0x3b')][_0x9558('0x3c')]&&_0xbe746c[_0x9558('0x36')]&&_0xbe746c[_0x9558('0x3a')]){_0x58ce3d[_0xbe746c[_0x9558('0x36')][_0x9558('0x37')]()]=_0x284ab9[_0xbe746c[_0x9558('0x3b')][_0x9558('0x3c')][_0x9558('0x37')]()][_0x9558('0x35')]();}});}return _0x58ce3d;}function getTicket(_0x5f01f2,_0x2397bb,_0x49284f,_0xbebb1e,_0x184abf,_0x4a37ac){return function(_0x4b52c5){logger[_0x9558('0x11')]('['+[_0x5f01f2[_0x9558('0x12')]()]+_0x9558('0x3d'),_0x4b52c5);return new Promise(function(_0x3332f2,_0x2f4158){var _0x16913c=_0x5f01f2[_0x9558('0x37')]()===_0x9558('0x3e')?_0x4b52c5[_0x9558('0x22')]:_0x4b52c5[_0x9558('0x2a')];var _0x337614={'method':_0x9558('0x24'),'uri':_0x49284f+'incident'+'?'+_0x4a37ac,'body':Object['assign']({},{'active':_0x9558('0x1e'),'caller_id':_0x16913c,'assigned_to':_0x4b52c5[_0x9558('0x22')],'short_description':intUtil[_0x9558('0x3f')](_0xbebb1e[_0x9558('0x40')],_0x184abf,'\x20'),'description':intUtil[_0x9558('0x3f')](_0xbebb1e[_0x9558('0x41')],_0x184abf,'\x0a')},getCustomFields(_0xbebb1e[_0x9558('0x42')],_0x184abf)),'auth':_0x2397bb,'json':!![]};return rp(_0x337614)[_0x9558('0x1b')](function(_0x3fbed8){logger[_0x9558('0x11')]('['+[_0x5f01f2['toUpperCase']()]+_0x9558('0x43'),_0x3fbed8[_0x9558('0xd')]);_0x4b52c5[_0x9558('0x44')]=_0x3fbed8[_0x9558('0xd')]['sys_id'];_0x4b52c5['ticketNumber']=_0x3fbed8[_0x9558('0xd')][_0x9558('0x45')];logger[_0x9558('0x11')]('['+[_0x5f01f2[_0x9558('0x12')]()]+']\x20getTicket\x20crm',_0x4b52c5);_0x3332f2(_0x4b52c5);})[_0x9558('0x14')](function(_0x141294){logger[_0x9558('0x20')]('['+[_0x5f01f2[_0x9558('0x12')]()]+']',_0x141294[_0x9558('0x15')]);_0x2f4158(_0x141294[_0x9558('0x15')]);});});};}function createRemoteTag(_0x549342,_0x1406ee,_0x33742d,_0x3a938d){return new Promise(function(_0x31d7f3,_0x52933d){var _0x100e3e={'method':_0x9558('0x24'),'uri':_0x33742d+_0x9558('0x46')+'?'+_0x3a938d,'body':{'short_description':_0x549342,'global':!![],'active':!![],'name':_0x549342},'auth':_0x1406ee,'json':!![]};return rp(_0x100e3e)[_0x9558('0x1b')](function(_0x37bd25){var _0x56e5a0=_0x37bd25[_0x9558('0xd')][_0x9558('0x10')];_0x31d7f3(_0x56e5a0);});});}function getRemoteTag(_0x445d22,_0x17c1f0,_0x36121c,_0xb683c,_0x5b5401){return new Promise(function(_0x107d7a,_0x1ec857){var _0xfa2b20={'method':'GET','uri':_0x36121c+_0x9558('0x46')+_0x9558('0x47')+_0x445d22+'&'+_0xb683c,'auth':_0x17c1f0,'json':!![]};return rp(_0xfa2b20)[_0x9558('0x1b')](function(_0xb21b3c){if(_0xb21b3c[_0x9558('0xd')][_0x9558('0xe')]>0x0){var _0x3d0406=_0xb21b3c[_0x9558('0xd')][0x0][_0x9558('0x10')];_0x107d7a(_0x3d0406);}else{return createRemoteTag(_0x445d22,_0x17c1f0,_0x36121c,_0xb683c)[_0x9558('0x1b')](function(_0x43dc6f){_0x107d7a(_0x43dc6f);});}});});}function assignTagToIncident(_0x5e3162,_0xd71846,_0x307afd,_0x1ae2ef,_0x30561a){return new Promise(function(_0x21fd62,_0x4546c0){var _0x43b273={'method':'POST','uri':_0x307afd+_0x9558('0x48')+'?'+_0x30561a,'body':{'label':_0x5e3162,'table':_0x9558('0x49'),'id_type':_0x9558('0x4a'),'table_key':_0x1ae2ef[_0x9558('0x44')],'title':_0x9558('0x4b')+_0x1ae2ef[_0x9558('0x4c')],'id_display':_0x1ae2ef[_0x9558('0x4c')]},'auth':_0xd71846,'json':!![]};return rp(_0x43b273)[_0x9558('0x1b')](function(_0x5e8c5a){_0x21fd62();})[_0x9558('0x14')](function(){_0x21fd62();});});}function manageTags(_0x1d5deb,_0x2ae642,_0x5733a6,_0x2c4d05,_0x48cf3b,_0x55af4a,_0x27b950){return new Promise(function(_0x1b6718,_0x13b9d4){var _0x1ba495=[];_0x2ae642[_0x9558('0x2e')](function(_0x5b64aa){_0x1ba495[_0x9558('0x4d')](getRemoteTag(_0x5b64aa,_0x5733a6,_0x2c4d05,_0x55af4a,_0x27b950));});return Promise['all'](_0x1ba495)['then'](function(_0x4d5653){if(_0x4d5653[_0x9558('0xe')]){logger[_0x9558('0x11')]('['+[_0x1d5deb['toUpperCase']()]+_0x9558('0x4e'),_0x4d5653);var _0x4be243=[];_0x4d5653[_0x9558('0x2e')](function(_0x3b8f0d){_0x4be243[_0x9558('0x4d')](assignTagToIncident(_0x3b8f0d,_0x5733a6,_0x2c4d05,_0x48cf3b,_0x55af4a));});return Promise[_0x9558('0x4f')](_0x4be243)['then'](function(){_0x1b6718();})[_0x9558('0x14')](function(){_0x1b6718();});}else{_0x1b6718();}});});}function getTags(_0x583b78,_0x49887b,_0x3e5c66,_0x14a0ce,_0x40c9cd,_0x1fe07c){return function(_0x142262){return new Promise(function(_0x336ff6,_0x4f095f){var _0x26b6da=[];var _0x391060=_0x14a0ce[_0x9558('0x50')];if(_0x391060&&_0x391060['length']>0x0){_0x26b6da=_['map'](_0x391060,_0x9558('0x3c'));}if(_0x26b6da['length']>0x0){return manageTags(_0x583b78,_0x26b6da,_0x49887b,_0x3e5c66,_0x142262,_0x40c9cd,_0x1fe07c)[_0x9558('0x1b')](function(){_0x336ff6(_0x142262);});}else{_0x336ff6(_0x142262);}});};}function emit(_0x57690b,_0x586bf9,_0x94e915){var _0x26eaeb='%26sysparm_record_target%3Dincident'+_0x9558('0x51')+_0x9558('0x52')+_0x9558('0x53');var _0x364470={'uri':_0x57690b+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x94e915+_0x26eaeb};io['to'](util['format']('user:%s',_0x586bf9))[_0x9558('0x54')](_0x9558('0x55'),_0x364470);}exports['cs']=function(_0x4eaa89,_0x31ffd1,_0x223a1d,_0xee39fd,_0x2405b1,_0x1fe652,_0x7ef22c,_0x4068b3){var _0x1ec47d={};var _0x534a20={'user':_0x1fe652[_0x9558('0x56')],'pass':_0x1fe652[_0x9558('0x57')]};var _0x17add5=_0x9558('0x58');var _0xeaed8a=_0x9558('0x59');_0x1fe652[_0x9558('0x5a')]=intUtil[_0x9558('0x5b')](_0x1fe652[_0x9558('0x5a')]);_0x1fe652[_0x9558('0x5c')]=intUtil['stripTrailingSlash'](_0x1fe652['serverUrl']);var _0x16c772=util['format']('%s/api/now/table/',_0x1fe652[_0x9558('0x5a')]);_0x1ec47d[_0x9558('0x18')]=!_[_0x9558('0x5d')](_0xee39fd)?_0xee39fd['email']:null;_0x1ec47d[_0x9558('0x23')]=_0x1fe652['email'];_0x1ec47d[_0x9558('0x26')]=_0x4068b3[_0x9558('0x37')]()===_0x9558('0x3e')?_0x31ffd1[_0x9558('0x5e')]:_0x31ffd1[_0x9558('0x5f')];_0x1ec47d[_0x9558('0x60')]=_0x4068b3===_0x9558('0x61')||_0x4068b3==='unmanaged'?_0x9558('0x61'):_0x9558('0x3e');var _0x52c8a9=util[_0x9558('0x62')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fe652['serverUrl'],_0x31ffd1[_0x9558('0x63')],md5(_0x31ffd1['uniqueid']));if(_0x2405b1&&_0x2405b1[_0x9558('0x64')]){logger[_0x9558('0x11')]('[QUEUE]',_0x9558('0x65'));_0x31ffd1[_0x9558('0x66')]=_0x52c8a9;}else if(_0x7ef22c&&_0x7ef22c[_0x9558('0x67')]&&_0x7ef22c[_0x9558('0x67')]!==_0x9558('0x68')){logger[_0x9558('0x11')](_0x9558('0x69'),'Recording\x20is\x20enabled!');_0x31ffd1[_0x9558('0x66')]=_0x52c8a9;}else{_0x31ffd1[_0x9558('0x66')]='';}return getAdminUser(_0x4068b3,_0x534a20,_0x1ec47d,_0x16c772,_0xeaed8a,_0x17add5)[_0x9558('0x1b')](getUser(_0x4068b3,_0x534a20,_0x16c772,_0xeaed8a,_0x17add5))[_0x9558('0x1b')](getEndUser(_0x4068b3,_0x534a20,_0x16c772,_0xeaed8a,_0x17add5))['then'](getTicket(_0x4068b3,_0x534a20,_0x16c772,_0x223a1d,_0x31ffd1,_0xeaed8a))[_0x9558('0x1b')](function(_0x6624a0){logger[_0x9558('0x11')](util['format'](_0x9558('0x6a'),_0x6624a0[_0x9558('0x44')]));logger[_0x9558('0x11')](util[_0x9558('0x62')]('call\x20direction:\x20%s',_0x4068b3));if(_0x4068b3!==_0x9558('0x6b')){logger[_0x9558('0x11')]('['+[_0x4068b3[_0x9558('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x1fe652['remoteUri'],_0xee39fd[_0x9558('0x3c')],_0x6624a0[_0x9558('0x44')]);}})[_0x9558('0x14')](function(_0x4525ef){logger[_0x9558('0x20')]('['+[_0x4068b3[_0x9558('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x9558('0x6c')](_0x4525ef,{'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 99f45d3..3708cff 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 _0x458f=['parent_id','parent_type','Contacts','parent_name','name','forEach','variableName','push','set_entry','stringify','Calls','apiKey','base64','get_server_info','JSON','isNil','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','length','find','name_value_list','Agent\x20found!','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','map','type','nameField','customField','toLowerCase','content','toString','string','idField','custom_fields','customVariable','Variable','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','stripTrailingSlash','uri','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Outbound','Ticket\x20created!','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','monitor_format','lastevent','contacts','lodash','request-promise','bluebird','md5','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','info','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','toISOString','slice','replace','duration_hours'];(function(_0x375b4f,_0x73421e){var _0x1ac303=function(_0x5ce2c7){while(--_0x5ce2c7){_0x375b4f['push'](_0x375b4f['shift']());}};_0x1ac303(++_0x73421e);}(_0x458f,0x14e));var _0xf458=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x458f[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xf458('0x0'));var rp=require(_0xf458('0x1'));var BPromise=require(_0xf458('0x2'));var md5=require(_0xf458('0x3'));var util=require('util');var Redis=require(_0xf458('0x4'));var intUtil=require('./util');var config=require(_0xf458('0x5'));var logger=require(_0xf458('0x6'))(_0xf458('0x7'));config['redis']=_[_0xf458('0x8')](config[_0xf458('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf458('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x305b52,_0x2092fa,_0x42ba33){io['to'](_0x305b52)['emit'](_0x2092fa,_0x42ba33);}function getTicket(_0xe2246c,_0x320474,_0x275371,_0x2ddece,_0x572751,_0x11bc25,_0x4b900c,_0x1a6882){logger[_0xf458('0xa')](_0xf458('0xb'));var _0x4fba37=new Date();var _0x12b3b8=[{'name':'name','value':intUtil['getString'](_0x2ddece[_0xf458('0xc')],_0x572751,'\x20')},{'name':_0xf458('0xd'),'value':_0x320474['id']},{'name':_0xf458('0xe'),'value':_0x320474['id']},{'name':_0xf458('0xf'),'value':intUtil[_0xf458('0x10')](_0x2ddece[_0xf458('0x11')],_0x572751,'\x0a')},{'name':_0xf458('0x12'),'value':_0x4fba37[_0xf458('0x13')]()[_0xf458('0x14')](0x0,0x13)[_0xf458('0x15')]('T','\x20')},{'name':_0xf458('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xf458('0x17'),'value':_0x275371['id']},{'name':_0xf458('0x18'),'value':_0xf458('0x19')},{'name':_0xf458('0x1a'),'value':_0x275371[_0xf458('0x1b')]},{'name':'direction','value':_0x1a6882}];if(_0x11bc25['length']){_[_0xf458('0x1c')](_0x11bc25,function(_0x2b9b6f){if(_0x572751[_0x2b9b6f[_0xf458('0x1d')]]){_0x12b3b8[_0xf458('0x1e')]({'name':_0x2b9b6f['idField'],'value':_0x572751[_0x2b9b6f[_0xf458('0x1d')]]});}});}return request({'form':{'method':_0xf458('0x1f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf458('0x20')]({'session':_0x4b900c['id'],'module_name':_0xf458('0x21'),'name_value_list':_0x12b3b8})}});}function getAuth(_0x304d2b){return util['format']('Basic\x20%s',new Buffer(_0x304d2b[_0xf458('0x22')]+':X')['toString'](_0xf458('0x23')));}function getServerInfo(_0xcce493){return request({'form':{'method':_0xf458('0x24'),'input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON[_0xf458('0x20')]({'session':_0xcce493['id']})}});}function getUser(_0x30bcda,_0x4ae392,_0x24c278){if(!_[_0xf458('0x26')](_0x4ae392)){logger['info'](_0xf458('0x27'),_0x4ae392);return request({'form':{'method':'get_entry_list','input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON[_0xf458('0x20')]({'session':_0x24c278['id'],'module_name':_0xf458('0x28'),'query':util[_0xf458('0x29')](_0xf458('0x2a'),_0x4ae392),'order_by':'','offset':'0','select_fields':['id',_0xf458('0x1b'),_0xf458('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x267038){if(_0x267038[_0xf458('0x2c')][_0xf458('0x2d')]){var _0x39271f=_[_0xf458('0x2e')](_0x267038['entry_list'],function(_0x4be3ea){return _0x4be3ea[_0xf458('0x2f')][_0xf458('0x2b')]['value']===_0x4ae392;});if(_0x39271f){logger[_0xf458('0xa')](_0xf458('0x30'));return BPromise['resolve']({'id':_0x39271f[_0xf458('0x2f')]['id'][_0xf458('0x31')],'name':_0x39271f['name_value_list'][_0xf458('0x1b')][_0xf458('0x31')]});}}logger[_0xf458('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf458('0x32')]({'id':_0x24c278[_0xf458('0x2f')][_0xf458('0x33')]['value'],'name':_0x24c278['name_value_list'][_0xf458('0x2b')]['value']});});}else{logger['info'](_0xf458('0x34'));return BPromise['resolve']({'id':_0x24c278[_0xf458('0x2f')][_0xf458('0x33')]['value'],'name':_0x24c278[_0xf458('0x2f')][_0xf458('0x2b')][_0xf458('0x31')]});}}function getEndUser(_0x19d665,_0x212a90,_0x22290e,_0x4eef8e){logger[_0xf458('0xa')](_0xf458('0x35'),_0x22290e);return request({'form':{'method':_0xf458('0x36'),'input_type':'JSON','response_type':_0xf458('0x25'),'rest_data':JSON['stringify']({'session':_0x4eef8e['id'],'module_name':_0xf458('0x19'),'query':util['format'](_0xf458('0x37'),_0x22290e),'order_by':'','offset':'0','select_fields':['id',_0xf458('0x1b'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf458('0x38')](function(_0x620fb5){if(_0x620fb5[_0xf458('0x2c')]['length']){var _0x1bfee9=_['find'](_0x620fb5[_0xf458('0x2c')],function(_0x278386){return _0x278386[_0xf458('0x2f')][_0xf458('0x39')][_0xf458('0x31')]===_0x22290e;});if(_0x1bfee9){logger[_0xf458('0xa')](_0xf458('0x3a'));return BPromise['resolve']({'id':_0x1bfee9['name_value_list']['id'][_0xf458('0x31')],'name':_0x1bfee9[_0xf458('0x2f')][_0xf458('0x1b')][_0xf458('0x31')],'phone':_0x1bfee9['name_value_list'][_0xf458('0x39')][_0xf458('0x31')]});}}else{logger[_0xf458('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON['stringify']({'session':_0x4eef8e['id'],'module_name':_0xf458('0x19'),'name_value_list':[{'name':_0xf458('0x3b'),'value':_0x212a90!==_0xf458('0x3c')?_0x212a90:util[_0xf458('0x29')](_0xf458('0x3d'),_0x22290e)},{'name':_0xf458('0x39'),'value':_0x22290e}]})}})['then'](function(_0x1e0059){logger['info'](_0xf458('0x3e'));return BPromise[_0xf458('0x32')]({'id':_0x1e0059['id'],'name':_0x1e0059[_0xf458('0x2c')][_0xf458('0x3b')][_0xf458('0x31')],'phone':_0x1e0059[_0xf458('0x2c')][_0xf458('0x39')][_0xf458('0x31')]});});}});}function request(_0x248815){logger['debug']('[HTTP]',JSON[_0xf458('0x20')](_0x248815));return rp(_['merge'](def,_0x248815));}function getTags(_0xfb31cf,_0x5e043f){var _0x2a8d67=[];if(_0xfb31cf&&_0xfb31cf[_0xf458('0x2d')]>0x0){_0x2a8d67=_[_0xf458('0x3f')](_0xfb31cf,_0x5e043f);}return _0x2a8d67;}function getCustomFields(_0xb16014,_0x1cc5ff){var _0x1c8a88=[];var _0x560a60={'custom_fields':[]};if(_0xb16014[_0xf458('0x2d')]>0x0){_[_0xf458('0x1c')](_0xb16014,function(_0x358931){if(_0x358931[_0xf458('0x40')]==='string'&&_0x358931[_0xf458('0x41')]&&!_0x358931[_0xf458('0x42')]){_0x560a60[_0x358931[_0xf458('0x41')][_0xf458('0x43')]()]=_0x358931[_0xf458('0x44')][_0xf458('0x45')]();}else if(_0x358931[_0xf458('0x40')]===_0xf458('0x46')&&_0x358931[_0xf458('0x47')]&&_0x358931[_0xf458('0x42')]){_0x560a60[_0xf458('0x48')][_0xf458('0x1e')]({'id':_0x358931[_0xf458('0x47')],'value':_0x358931[_0xf458('0x44')]['toString']()});}else if(_0x358931[_0xf458('0x40')]==='variable'&&_0x358931[_0xf458('0x1d')]&&_0x358931[_0xf458('0x47')]&&_0x358931[_0xf458('0x42')]){_0x1cc5ff[_0x358931[_0xf458('0x1d')]]&&_0x560a60[_0xf458('0x48')]['push']({'id':_0x358931['idField'],'value':_0x1cc5ff[_0x358931[_0xf458('0x1d')]][_0xf458('0x45')]()});}else if(_0x358931['type']===_0xf458('0x49')&&_0x358931[_0xf458('0x4a')]&&_0x358931[_0xf458('0x4a')][_0xf458('0x1b')]&&_0x358931[_0xf458('0x47')]&&_0x358931[_0xf458('0x42')]){_0x1cc5ff[_0x358931[_0xf458('0x4a')][_0xf458('0x1b')][_0xf458('0x43')]()]&&_0x560a60['custom_fields'][_0xf458('0x1e')]({'id':_0x358931[_0xf458('0x47')],'value':_0x1cc5ff[_0x358931[_0xf458('0x4a')][_0xf458('0x1b')][_0xf458('0x43')]()][_0xf458('0x45')]()});}});}return _0x560a60;}function getConnection(_0x1d2304){return request({'method':'POST','form':{'method':'login','input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1d2304[_0xf458('0x4b')],'password':_0x1d2304['password'],'encryption':_0xf458('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xf458('0x38')](function(_0xb58b32){var _0x2c0c87=_0xb58b32;if(_0x2c0c87['id']){def[_0xf458('0x4d')]=_0x2c0c87['id'];return BPromise[_0xf458('0x32')](_0x2c0c87);}else{throw new Error(util[_0xf458('0x29')](_0xf458('0x4e'),_0x1d2304['id']));}});}function setRelationship(_0x29ecf9,_0x571647,_0x59040e,_0x56cec4){return request({'form':{'method':_0xf458('0x4f'),'input_type':_0xf458('0x25'),'response_type':_0xf458('0x25'),'rest_data':JSON['stringify']({'session':_0x29ecf9['id'],'module_name':_0xf458('0x21'),'module_id':_0x59040e['id'],'link_field_name':_0x56cec4,'related_ids':[_0x571647['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf458('0x50')]=function(_0x305cd9,_0x2f32f9,_0x142edd,_0x51f3bf,_0x11fd49,_0x39ff80){var _0x7cf80d,_0xd5e8b2,_0x583341,_0x292dac;_0x39ff80[_0xf458('0x51')]=intUtil['stripTrailingSlash'](_0x39ff80[_0xf458('0x51')]);_0x39ff80[_0xf458('0x52')]=intUtil['stripTrailingSlash'](_0x39ff80[_0xf458('0x52')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x39ff80[_0xf458('0x51')]);if(_0x11fd49&&_0x11fd49['monitor_format']){logger[_0xf458('0xa')](_0xf458('0x53'),_0xf458('0x54'));_0x2f32f9[_0xf458('0x55')]=util[_0xf458('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39ff80[_0xf458('0x52')],_0x2f32f9[_0xf458('0x56')],md5(_0x2f32f9[_0xf458('0x56')]));}else{_0x2f32f9[_0xf458('0x55')]='';}return getConnection(_0x39ff80)[_0xf458('0x38')](function(_0x162bb8){_0x292dac=_0x162bb8;return getUser(_0x39ff80,_0x51f3bf[_0xf458('0x1b')],_0x292dac);})['then'](function(_0x5562d9){_0x7cf80d=_0x5562d9;logger['info'](_0xf458('0x57'),_0x7cf80d['id']);return getEndUser(_0x39ff80,_0x2f32f9[_0xf458('0x58')],_0x2f32f9[_0xf458('0x59')],_0x292dac);})['then'](function(_0x11c6bf){_0xd5e8b2=_0x11c6bf;logger[_0xf458('0xa')](_0xf458('0x5a'),_0xd5e8b2['id']);return getTicket(_0x39ff80,_0x7cf80d,_0xd5e8b2,_0x142edd,_0x2f32f9,_0x142edd[_0xf458('0x5b')],_0x292dac,_0xf458('0x5c'));})[_0xf458('0x38')](function(_0x27728b){_0x583341=_0x27728b;logger[_0xf458('0xa')]('Ticket\x20created!');logger['info'](_0xf458('0x5d'),_0x583341['id']);return setRelationship(_0x292dac,_0x7cf80d,_0x583341,_0xf458('0x5e'));})[_0xf458('0x38')](function(){return setRelationship(_0x292dac,_0xd5e8b2,_0x583341,'contacts');})['then'](function(){return getServerInfo(_0x292dac);})[_0xf458('0x38')](function(_0x55b22a){var _0x3ba4eb=parseInt(_0x55b22a[_0xf458('0x5f')][_0xf458('0x60')](0x0));var _0x1432b3=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x39ff80['remoteUri'],_0x583341['id']);if(_0x3ba4eb>0x6){_0x1432b3=util[_0xf458('0x29')](_0xf458('0x61'),_0x39ff80[_0xf458('0x51')],_0x583341['id']);}logger['info']('[QUEUE]',_0xf458('0x62'));emit(util['format'](_0xf458('0x63'),_0x51f3bf[_0xf458('0x1b')]),_0xf458('0x64'),{'uri':_0x1432b3});})[_0xf458('0x65')](function(_0x1c4c6f){logger[_0xf458('0x66')](_0xf458('0x53'),JSON[_0xf458('0x20')](_0x1c4c6f));});};exports[_0xf458('0x67')]=function(_0x302ea4,_0x5a6de1,_0x5d9540,_0x288f3f,_0x397ee6,_0x121d8f,_0x55175c){var _0xbd5866,_0x2aa08e,_0x46ad0e,_0xe5fbab;_0x121d8f['remoteUri']=intUtil['stripTrailingSlash'](_0x121d8f[_0xf458('0x51')]);_0x121d8f['serverUrl']=intUtil[_0xf458('0x68')](_0x121d8f[_0xf458('0x52')]);def[_0xf458('0x69')]=util[_0xf458('0x29')](_0xf458('0x6a'),_0x121d8f[_0xf458('0x51')]);if(_0x55175c&&_0x55175c[_0xf458('0x6b')]&&_0x55175c[_0xf458('0x6b')]!==_0xf458('0x6c')){logger[_0xf458('0xa')](_0xf458('0x6d'),_0xf458('0x54'));_0x5a6de1[_0xf458('0x55')]=util[_0xf458('0x29')](_0xf458('0x6e'),_0x121d8f['serverUrl'],_0x5a6de1[_0xf458('0x56')],md5(_0x5a6de1[_0xf458('0x56')]));}return getConnection(_0x121d8f)['then'](function(_0x40c42d){_0xe5fbab=_0x40c42d;return getUser(_0x121d8f,_0x288f3f['name'],_0xe5fbab);})[_0xf458('0x38')](function(_0x36b0c7){_0xbd5866=_0x36b0c7;logger[_0xf458('0xa')](_0xf458('0x57'),_0xbd5866['id']);return getEndUser(_0x121d8f,_0x5a6de1[_0xf458('0x6f')],_0x5a6de1['destcalleridnum'],_0xe5fbab);})[_0xf458('0x38')](function(_0x2c9076){_0x2aa08e=_0x2c9076;logger[_0xf458('0xa')](_0xf458('0x5a'),_0x2aa08e['id']);return getTicket(_0x121d8f,_0xbd5866,_0x2aa08e,_0x5d9540,_0x5a6de1,_0x5d9540[_0xf458('0x5b')],_0xe5fbab,_0xf458('0x70'));})[_0xf458('0x38')](function(_0x642c5a){_0x46ad0e=_0x642c5a;logger[_0xf458('0xa')](_0xf458('0x71'));logger[_0xf458('0xa')](_0xf458('0x5d'),_0x46ad0e['id']);return setRelationship(_0xe5fbab,_0xbd5866,_0x46ad0e,_0xf458('0x5e'));})[_0xf458('0x38')](function(){return setRelationship(_0xe5fbab,_0x2aa08e,_0x46ad0e,'contacts');})[_0xf458('0x38')](function(){return getServerInfo(_0xe5fbab);})[_0xf458('0x38')](function(_0x4155b3){var _0x3a7357=parseInt(_0x4155b3[_0xf458('0x5f')][_0xf458('0x60')](0x0));var _0x529365=util[_0xf458('0x29')](_0xf458('0x72'),_0x121d8f[_0xf458('0x51')],_0x46ad0e['id']);if(_0x3a7357>0x6){_0x529365=util[_0xf458('0x29')](_0xf458('0x61'),_0x121d8f[_0xf458('0x51')],_0x46ad0e['id']);}logger[_0xf458('0xa')]('[OUTBOUND]',_0xf458('0x62'));emit(util[_0xf458('0x29')](_0xf458('0x63'),_0x288f3f[_0xf458('0x1b')]),_0xf458('0x64'),{'uri':_0x529365});})[_0xf458('0x65')](function(_0x4536b2){logger[_0xf458('0x66')](_0xf458('0x6d'),JSON[_0xf458('0x20')](_0x4536b2));});};exports[_0xf458('0x73')]=function(_0x9d1911,_0x116930,_0x395b81,_0x5ed47b,_0x31eb1c,_0x40cfa4){var _0x586b80,_0x3c5cec,_0x1ddeaf,_0x4957cf;_0x40cfa4[_0xf458('0x51')]=intUtil[_0xf458('0x68')](_0x40cfa4[_0xf458('0x51')]);_0x40cfa4[_0xf458('0x52')]=intUtil[_0xf458('0x68')](_0x40cfa4[_0xf458('0x52')]);def[_0xf458('0x69')]=util[_0xf458('0x29')](_0xf458('0x6a'),_0x40cfa4[_0xf458('0x51')]);if(_0x31eb1c&&_0x31eb1c[_0xf458('0x74')]){logger['info']('['+_0x116930[_0xf458('0x75')]['toUpperCase']()+']',_0xf458('0x54'));_0x116930[_0xf458('0x55')]=util[_0xf458('0x29')](_0xf458('0x6e'),_0x40cfa4[_0xf458('0x52')],_0x116930[_0xf458('0x56')],md5(_0x116930[_0xf458('0x56')]));}else{_0x116930['recordingURL']='';}return getConnection(_0x40cfa4)[_0xf458('0x38')](function(_0x4705b4){_0x4957cf=_0x4705b4;if(!_[_0xf458('0x26')](_0x5ed47b)){return getUser(_0x40cfa4,_0x5ed47b[_0xf458('0x1b')],_0x4957cf);}else{return getUser(_0x40cfa4,null,_0x4957cf);}})[_0xf458('0x38')](function(_0x269b7e){_0x586b80=_0x269b7e;logger['info'](_0xf458('0x57'),_0x586b80['id']);return getEndUser(_0x40cfa4,_0x116930['calleridname'],_0x116930[_0xf458('0x59')],_0x4957cf);})[_0xf458('0x38')](function(_0x5ef792){_0x3c5cec=_0x5ef792;logger[_0xf458('0xa')]('The\x20Enduser\x20ID\x20is:',_0x3c5cec['id']);return getTicket(_0x40cfa4,_0x586b80,_0x3c5cec,_0x395b81,_0x116930,_0x395b81[_0xf458('0x5b')],_0x4957cf,_0xf458('0x5c'));})[_0xf458('0x38')](function(_0xa364ad){_0x1ddeaf=_0xa364ad;logger[_0xf458('0xa')](_0xf458('0x71'));logger[_0xf458('0xa')](_0xf458('0x5d'),_0x1ddeaf['id']);return setRelationship(_0x4957cf,_0x586b80,_0x1ddeaf,_0xf458('0x5e'));})[_0xf458('0x38')](function(){return setRelationship(_0x4957cf,_0x3c5cec,_0x1ddeaf,_0xf458('0x76'));})[_0xf458('0x38')](function(){return getServerInfo(_0x4957cf);})[_0xf458('0x65')](function(_0x1b824e){logger[_0xf458('0x66')]('['+_0x116930[_0xf458('0x75')]['toUpperCase']()+']',JSON[_0xf458('0x20')](_0x1b824e));});}; \ No newline at end of file +var _0x67b5=['parent_id','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','user_name','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','stringify','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','type','string','customField','toLowerCase','content','custom_fields','push','variable','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','version','error','unmanaged','lastevent','isNil','contacts','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes'];(function(_0x492e33,_0x111910){var _0x51be0d=function(_0x4a2ac8){while(--_0x4a2ac8){_0x492e33['push'](_0x492e33['shift']());}};_0x51be0d(++_0x111910);}(_0x67b5,0x1d1));var _0x567b=function(_0x224c05,_0x10ea58){_0x224c05=_0x224c05-0x0;var _0x10f037=_0x67b5[_0x224c05];return _0x10f037;};'use strict';var _=require('lodash');var rp=require(_0x567b('0x0'));var BPromise=require(_0x567b('0x1'));var md5=require(_0x567b('0x2'));var util=require(_0x567b('0x3'));var Redis=require(_0x567b('0x4'));var intUtil=require(_0x567b('0x5'));var config=require(_0x567b('0x6'));var logger=require(_0x567b('0x7'))(_0x567b('0x8'));config['redis']=_[_0x567b('0x9')](config[_0x567b('0xa')],{'host':_0x567b('0xb'),'port':0x18eb});var io=require(_0x567b('0xc'))(new Redis(config['redis']));var def={'method':_0x567b('0xd'),'json':!![]};function emit(_0x188a14,_0x39900c,_0x1ed25e){io['to'](_0x188a14)[_0x567b('0xe')](_0x39900c,_0x1ed25e);}function getTicket(_0x391486,_0xd94aca,_0x4af144,_0x46b3ad,_0xc14675,_0x5c0d76,_0x267e7e,_0x597bb4){logger[_0x567b('0xf')](_0x567b('0x10'));var _0x3a01a5=new Date();var _0x27d50b=[{'name':_0x567b('0x11'),'value':intUtil[_0x567b('0x12')](_0x46b3ad[_0x567b('0x13')],_0xc14675,'\x20')},{'name':'assigned_user_id','value':_0xd94aca['id']},{'name':'created_by','value':_0xd94aca['id']},{'name':_0x567b('0x14'),'value':intUtil['getString'](_0x46b3ad['Descriptions'],_0xc14675,'\x0a')},{'name':_0x567b('0x15'),'value':_0x3a01a5[_0x567b('0x16')]()[_0x567b('0x17')](0x0,0x13)[_0x567b('0x18')]('T','\x20')},{'name':_0x567b('0x19'),'value':'0'},{'name':_0x567b('0x1a'),'value':'15'},{'name':_0x567b('0x1b'),'value':_0x4af144['id']},{'name':'parent_type','value':_0x567b('0x1c')},{'name':_0x567b('0x1d'),'value':_0x4af144['name']},{'name':_0x567b('0x1e'),'value':_0x597bb4}];if(_0x5c0d76[_0x567b('0x1f')]){_[_0x567b('0x20')](_0x5c0d76,function(_0x3d3e33){if(_0xc14675[_0x3d3e33[_0x567b('0x21')]]){_0x27d50b['push']({'name':_0x3d3e33[_0x567b('0x22')],'value':_0xc14675[_0x3d3e33[_0x567b('0x21')]]});}});}return request({'form':{'method':_0x567b('0x23'),'input_type':_0x567b('0x24'),'response_type':_0x567b('0x24'),'rest_data':JSON['stringify']({'session':_0x267e7e['id'],'module_name':_0x567b('0x25'),'name_value_list':_0x27d50b})}});}function getAuth(_0x2adbbb){return util[_0x567b('0x26')](_0x567b('0x27'),new Buffer(_0x2adbbb[_0x567b('0x28')]+':X')[_0x567b('0x29')](_0x567b('0x2a')));}function getServerInfo(_0x5efb15){return request({'form':{'method':'get_server_info','input_type':_0x567b('0x24'),'response_type':_0x567b('0x24'),'rest_data':JSON['stringify']({'session':_0x5efb15['id']})}});}function getUser(_0x12d792,_0x295e32,_0x29fe9d){if(!_['isNil'](_0x295e32)){logger['info']('Getting\x20agent\x20with\x20name',_0x295e32);return request({'form':{'method':_0x567b('0x2b'),'input_type':_0x567b('0x24'),'response_type':_0x567b('0x24'),'rest_data':JSON['stringify']({'session':_0x29fe9d['id'],'module_name':'Employees','query':util[_0x567b('0x26')](_0x567b('0x2c'),_0x295e32),'order_by':'','offset':'0','select_fields':['id',_0x567b('0x11'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x152ba8){if(_0x152ba8[_0x567b('0x2d')]['length']){var _0x334c89=_[_0x567b('0x2e')](_0x152ba8[_0x567b('0x2d')],function(_0x29ac46){return _0x29ac46['name_value_list'][_0x567b('0x2f')]['value']===_0x295e32;});if(_0x334c89){logger[_0x567b('0xf')]('Agent\x20found!');return BPromise[_0x567b('0x30')]({'id':_0x334c89[_0x567b('0x31')]['id']['value'],'name':_0x334c89[_0x567b('0x31')][_0x567b('0x11')][_0x567b('0x32')]});}}logger[_0x567b('0xf')](_0x567b('0x33'));return BPromise[_0x567b('0x30')]({'id':_0x29fe9d[_0x567b('0x31')]['user_id'][_0x567b('0x32')],'name':_0x29fe9d[_0x567b('0x31')][_0x567b('0x2f')][_0x567b('0x32')]});});}else{logger[_0x567b('0xf')](_0x567b('0x34'));return BPromise['resolve']({'id':_0x29fe9d[_0x567b('0x31')]['user_id'][_0x567b('0x32')],'name':_0x29fe9d[_0x567b('0x31')][_0x567b('0x2f')][_0x567b('0x32')]});}}function getEndUser(_0x48a4c6,_0x16eea3,_0x11485f,_0x32bc72){logger[_0x567b('0xf')](_0x567b('0x35'),_0x11485f);return request({'form':{'method':_0x567b('0x2b'),'input_type':_0x567b('0x24'),'response_type':_0x567b('0x24'),'rest_data':JSON['stringify']({'session':_0x32bc72['id'],'module_name':_0x567b('0x1c'),'query':util['format'](_0x567b('0x36'),_0x11485f),'order_by':'','offset':'0','select_fields':['id',_0x567b('0x11'),_0x567b('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x567b('0x38')](function(_0x579530){if(_0x579530[_0x567b('0x2d')][_0x567b('0x1f')]){var _0x4d1b01=_[_0x567b('0x2e')](_0x579530['entry_list'],function(_0x3b03f2){return _0x3b03f2[_0x567b('0x31')][_0x567b('0x37')][_0x567b('0x32')]===_0x11485f;});if(_0x4d1b01){logger[_0x567b('0xf')](_0x567b('0x39'));return BPromise['resolve']({'id':_0x4d1b01[_0x567b('0x31')]['id'][_0x567b('0x32')],'name':_0x4d1b01['name_value_list'][_0x567b('0x11')][_0x567b('0x32')],'phone':_0x4d1b01['name_value_list'][_0x567b('0x37')][_0x567b('0x32')]});}}else{logger['info'](_0x567b('0x3a'));return request({'form':{'method':_0x567b('0x23'),'input_type':_0x567b('0x24'),'response_type':'JSON','rest_data':JSON[_0x567b('0x3b')]({'session':_0x32bc72['id'],'module_name':_0x567b('0x1c'),'name_value_list':[{'name':_0x567b('0x3c'),'value':_0x16eea3!==_0x567b('0x3d')?_0x16eea3:util[_0x567b('0x26')](_0x567b('0x3e'),_0x11485f)},{'name':_0x567b('0x37'),'value':_0x11485f}]})}})[_0x567b('0x38')](function(_0x34e6df){logger[_0x567b('0xf')](_0x567b('0x3f'));return BPromise[_0x567b('0x30')]({'id':_0x34e6df['id'],'name':_0x34e6df[_0x567b('0x2d')][_0x567b('0x3c')][_0x567b('0x32')],'phone':_0x34e6df['entry_list'][_0x567b('0x37')]['value']});});}});}function request(_0x2fab6b){logger[_0x567b('0x40')](_0x567b('0x41'),JSON[_0x567b('0x3b')](_0x2fab6b));return rp(_[_0x567b('0x42')](def,_0x2fab6b));}function getTags(_0x287d7d,_0x3f2e3c){var _0x20193e=[];if(_0x287d7d&&_0x287d7d[_0x567b('0x1f')]>0x0){_0x20193e=_['map'](_0x287d7d,_0x3f2e3c);}return _0x20193e;}function getCustomFields(_0x49d148,_0x5f2629){var _0x459a73=[];var _0x2d4e2f={'custom_fields':[]};if(_0x49d148[_0x567b('0x1f')]>0x0){_[_0x567b('0x20')](_0x49d148,function(_0x481e8c){if(_0x481e8c[_0x567b('0x43')]===_0x567b('0x44')&&_0x481e8c['nameField']&&!_0x481e8c[_0x567b('0x45')]){_0x2d4e2f[_0x481e8c['nameField'][_0x567b('0x46')]()]=_0x481e8c[_0x567b('0x47')][_0x567b('0x29')]();}else if(_0x481e8c[_0x567b('0x43')]==='string'&&_0x481e8c[_0x567b('0x22')]&&_0x481e8c[_0x567b('0x45')]){_0x2d4e2f[_0x567b('0x48')][_0x567b('0x49')]({'id':_0x481e8c[_0x567b('0x22')],'value':_0x481e8c[_0x567b('0x47')][_0x567b('0x29')]()});}else if(_0x481e8c[_0x567b('0x43')]===_0x567b('0x4a')&&_0x481e8c['variableName']&&_0x481e8c[_0x567b('0x22')]&&_0x481e8c[_0x567b('0x45')]){_0x5f2629[_0x481e8c[_0x567b('0x21')]]&&_0x2d4e2f[_0x567b('0x48')]['push']({'id':_0x481e8c[_0x567b('0x22')],'value':_0x5f2629[_0x481e8c[_0x567b('0x21')]][_0x567b('0x29')]()});}else if(_0x481e8c[_0x567b('0x43')]===_0x567b('0x4b')&&_0x481e8c[_0x567b('0x4c')]&&_0x481e8c[_0x567b('0x4c')][_0x567b('0x11')]&&_0x481e8c[_0x567b('0x22')]&&_0x481e8c[_0x567b('0x45')]){_0x5f2629[_0x481e8c[_0x567b('0x4c')][_0x567b('0x11')]['toLowerCase']()]&&_0x2d4e2f['custom_fields'][_0x567b('0x49')]({'id':_0x481e8c[_0x567b('0x22')],'value':_0x5f2629[_0x481e8c[_0x567b('0x4c')]['name']['toLowerCase']()][_0x567b('0x29')]()});}});}return _0x2d4e2f;}function getConnection(_0x13f62d){return request({'method':_0x567b('0xd'),'form':{'method':_0x567b('0x4d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x567b('0x3b')]({'user_auth':{'user_name':_0x13f62d[_0x567b('0x4e')],'password':_0x13f62d['password'],'encryption':_0x567b('0x4f')},'application':_0x567b('0x50')})}})['then'](function(_0x24ab87){var _0xa8f116=_0x24ab87;if(_0xa8f116['id']){def[_0x567b('0x51')]=_0xa8f116['id'];return BPromise[_0x567b('0x30')](_0xa8f116);}else{throw new Error(util[_0x567b('0x26')](_0x567b('0x52'),_0x13f62d['id']));}});}function setRelationship(_0x5c1927,_0x112335,_0x1b51c2,_0x581ec6){return request({'form':{'method':_0x567b('0x53'),'input_type':_0x567b('0x24'),'response_type':_0x567b('0x24'),'rest_data':JSON[_0x567b('0x3b')]({'session':_0x5c1927['id'],'module_name':'Calls','module_id':_0x1b51c2['id'],'link_field_name':_0x581ec6,'related_ids':[_0x112335['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3d1d81,_0x3cdb41,_0x2f939c,_0x25ed96,_0x109947,_0x150239){var _0x3169ef,_0xab10c3,_0x5d0bba,_0x1cd630;_0x150239[_0x567b('0x54')]=intUtil[_0x567b('0x55')](_0x150239[_0x567b('0x54')]);_0x150239[_0x567b('0x56')]=intUtil[_0x567b('0x55')](_0x150239[_0x567b('0x56')]);def[_0x567b('0x57')]=util[_0x567b('0x26')](_0x567b('0x58'),_0x150239['remoteUri']);if(_0x109947&&_0x109947[_0x567b('0x59')]){logger['info'](_0x567b('0x5a'),_0x567b('0x5b'));_0x3cdb41[_0x567b('0x5c')]=util[_0x567b('0x26')](_0x567b('0x5d'),_0x150239[_0x567b('0x56')],_0x3cdb41[_0x567b('0x5e')],md5(_0x3cdb41[_0x567b('0x5e')]));}else{_0x3cdb41[_0x567b('0x5c')]='';}return getConnection(_0x150239)[_0x567b('0x38')](function(_0x57cac5){_0x1cd630=_0x57cac5;return getUser(_0x150239,_0x25ed96[_0x567b('0x11')],_0x1cd630);})[_0x567b('0x38')](function(_0x292108){_0x3169ef=_0x292108;logger[_0x567b('0xf')](_0x567b('0x5f'),_0x3169ef['id']);return getEndUser(_0x150239,_0x3cdb41[_0x567b('0x60')],_0x3cdb41[_0x567b('0x61')],_0x1cd630);})['then'](function(_0x1f8b1c){_0xab10c3=_0x1f8b1c;logger['info'](_0x567b('0x62'),_0xab10c3['id']);return getTicket(_0x150239,_0x3169ef,_0xab10c3,_0x2f939c,_0x3cdb41,_0x2f939c[_0x567b('0x63')],_0x1cd630,_0x567b('0x64'));})['then'](function(_0x370824){_0x5d0bba=_0x370824;logger['info'](_0x567b('0x65'));logger['info'](_0x567b('0x66'),_0x5d0bba['id']);return setRelationship(_0x1cd630,_0x3169ef,_0x5d0bba,_0x567b('0x67'));})[_0x567b('0x38')](function(){return setRelationship(_0x1cd630,_0xab10c3,_0x5d0bba,'contacts');})['then'](function(){return getServerInfo(_0x1cd630);})[_0x567b('0x38')](function(_0x12afb9){var _0x432369=parseInt(_0x12afb9['version'][_0x567b('0x68')](0x0));var _0x329e0b=util[_0x567b('0x26')](_0x567b('0x69'),_0x150239[_0x567b('0x54')],_0x5d0bba['id']);if(_0x432369>0x6){_0x329e0b=util[_0x567b('0x26')](_0x567b('0x6a'),_0x150239['remoteUri'],_0x5d0bba['id']);}logger[_0x567b('0xf')]('[QUEUE]',_0x567b('0x6b'));emit(util['format'](_0x567b('0x6c'),_0x25ed96[_0x567b('0x11')]),_0x567b('0x6d'),{'uri':_0x329e0b});})[_0x567b('0x6e')](function(_0x28fd9a){logger['error']('[QUEUE]',JSON[_0x567b('0x3b')](_0x28fd9a));});};exports['outbound']=function(_0x2111e3,_0x46b7c5,_0xf85c90,_0x4b8baa,_0x1efb9a,_0x403c79,_0x4c17d3){var _0x1fb546,_0x33d541,_0x29eb05,_0x34cbbf;_0x403c79[_0x567b('0x54')]=intUtil['stripTrailingSlash'](_0x403c79[_0x567b('0x54')]);_0x403c79[_0x567b('0x56')]=intUtil['stripTrailingSlash'](_0x403c79[_0x567b('0x56')]);def[_0x567b('0x57')]=util[_0x567b('0x26')](_0x567b('0x58'),_0x403c79[_0x567b('0x54')]);if(_0x4c17d3&&_0x4c17d3[_0x567b('0x6f')]&&_0x4c17d3[_0x567b('0x6f')]!==_0x567b('0x70')){logger['info'](_0x567b('0x71'),'Recording\x20is\x20enabled!');_0x46b7c5[_0x567b('0x5c')]=util[_0x567b('0x26')](_0x567b('0x5d'),_0x403c79['serverUrl'],_0x46b7c5[_0x567b('0x5e')],md5(_0x46b7c5[_0x567b('0x5e')]));}return getConnection(_0x403c79)[_0x567b('0x38')](function(_0x557305){_0x34cbbf=_0x557305;return getUser(_0x403c79,_0x4b8baa[_0x567b('0x11')],_0x34cbbf);})[_0x567b('0x38')](function(_0x3414d9){_0x1fb546=_0x3414d9;logger[_0x567b('0xf')](_0x567b('0x5f'),_0x1fb546['id']);return getEndUser(_0x403c79,_0x46b7c5[_0x567b('0x72')],_0x46b7c5['destcalleridnum'],_0x34cbbf);})[_0x567b('0x38')](function(_0x4ab46b){_0x33d541=_0x4ab46b;logger[_0x567b('0xf')](_0x567b('0x62'),_0x33d541['id']);return getTicket(_0x403c79,_0x1fb546,_0x33d541,_0xf85c90,_0x46b7c5,_0xf85c90[_0x567b('0x63')],_0x34cbbf,_0x567b('0x73'));})[_0x567b('0x38')](function(_0x2d0c7f){_0x29eb05=_0x2d0c7f;logger[_0x567b('0xf')]('Ticket\x20created!');logger[_0x567b('0xf')]('The\x20Ticket\x20ID\x20is:',_0x29eb05['id']);return setRelationship(_0x34cbbf,_0x1fb546,_0x29eb05,_0x567b('0x67'));})[_0x567b('0x38')](function(){return setRelationship(_0x34cbbf,_0x33d541,_0x29eb05,'contacts');})[_0x567b('0x38')](function(){return getServerInfo(_0x34cbbf);})[_0x567b('0x38')](function(_0x36f0fc){var _0x46a49d=parseInt(_0x36f0fc[_0x567b('0x74')][_0x567b('0x68')](0x0));var _0x265910=util[_0x567b('0x26')](_0x567b('0x69'),_0x403c79[_0x567b('0x54')],_0x29eb05['id']);if(_0x46a49d>0x6){_0x265910=util[_0x567b('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x403c79[_0x567b('0x54')],_0x29eb05['id']);}logger['info'](_0x567b('0x71'),_0x567b('0x6b'));emit(util['format']('user:%s',_0x4b8baa[_0x567b('0x11')]),'trigger:browser:url',{'uri':_0x265910});})[_0x567b('0x6e')](function(_0x1b6134){logger[_0x567b('0x75')](_0x567b('0x71'),JSON['stringify'](_0x1b6134));});};exports[_0x567b('0x76')]=function(_0x5254ab,_0x4c51e6,_0x3d3851,_0x58378a,_0x51f92a,_0x12c375){var _0x84ea17,_0x486b03,_0x338ae7,_0xa3118c;_0x12c375[_0x567b('0x54')]=intUtil[_0x567b('0x55')](_0x12c375[_0x567b('0x54')]);_0x12c375['serverUrl']=intUtil['stripTrailingSlash'](_0x12c375['serverUrl']);def['uri']=util[_0x567b('0x26')]('%s/service/v4_1/rest.php',_0x12c375[_0x567b('0x54')]);if(_0x51f92a&&_0x51f92a[_0x567b('0x59')]){logger[_0x567b('0xf')]('['+_0x4c51e6[_0x567b('0x77')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4c51e6[_0x567b('0x5c')]=util[_0x567b('0x26')](_0x567b('0x5d'),_0x12c375[_0x567b('0x56')],_0x4c51e6['uniqueid'],md5(_0x4c51e6[_0x567b('0x5e')]));}else{_0x4c51e6[_0x567b('0x5c')]='';}return getConnection(_0x12c375)[_0x567b('0x38')](function(_0x436b2e){_0xa3118c=_0x436b2e;if(!_[_0x567b('0x78')](_0x58378a)){return getUser(_0x12c375,_0x58378a[_0x567b('0x11')],_0xa3118c);}else{return getUser(_0x12c375,null,_0xa3118c);}})[_0x567b('0x38')](function(_0xcd7f80){_0x84ea17=_0xcd7f80;logger['info'](_0x567b('0x5f'),_0x84ea17['id']);return getEndUser(_0x12c375,_0x4c51e6[_0x567b('0x60')],_0x4c51e6[_0x567b('0x61')],_0xa3118c);})[_0x567b('0x38')](function(_0x2202f2){_0x486b03=_0x2202f2;logger['info'](_0x567b('0x62'),_0x486b03['id']);return getTicket(_0x12c375,_0x84ea17,_0x486b03,_0x3d3851,_0x4c51e6,_0x3d3851[_0x567b('0x63')],_0xa3118c,_0x567b('0x64'));})[_0x567b('0x38')](function(_0x37d353){_0x338ae7=_0x37d353;logger[_0x567b('0xf')](_0x567b('0x65'));logger[_0x567b('0xf')](_0x567b('0x66'),_0x338ae7['id']);return setRelationship(_0xa3118c,_0x84ea17,_0x338ae7,_0x567b('0x67'));})[_0x567b('0x38')](function(){return setRelationship(_0xa3118c,_0x486b03,_0x338ae7,_0x567b('0x79'));})[_0x567b('0x38')](function(){return getServerInfo(_0xa3118c);})[_0x567b('0x6e')](function(_0x1ac978){logger['error']('['+_0x4c51e6[_0x567b('0x77')][_0x567b('0x7a')]()+']',JSON['stringify'](_0x1ac978));});}; \ 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 d8630ed..428e324 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 _0x1b9e=['lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','stripTrailingSlash','slice','substring'];(function(_0x3537a8,_0x4793c7){var _0x36ecb4=function(_0x2eb963){while(--_0x2eb963){_0x3537a8['push'](_0x3537a8['shift']());}};_0x36ecb4(++_0x4793c7);}(_0x1b9e,0x6f));var _0xe1b9=function(_0x48a556,_0xae59b3){_0x48a556=_0x48a556-0x0;var _0x41d6f2=_0x1b9e[_0x48a556];return _0x41d6f2;};'use strict';var _=require(_0xe1b9('0x0'));var util=require(_0xe1b9('0x1'));exports[_0xe1b9('0x2')]=function(_0x4544eb,_0xc3522c,_0x44860d){var _0x5c1863=[];if(_0x4544eb[_0xe1b9('0x3')]>0x0){var _0x212379=_['sortBy'](_0x4544eb,['id']);for(var _0x29bdb3=0x0;_0x29bdb3<_0x212379[_0xe1b9('0x3')];_0x29bdb3++){var _0x11595b=_0x212379[_0x29bdb3];if(_0x11595b[_0xe1b9('0x4')]===_0xe1b9('0x5')){_0x5c1863[_0xe1b9('0x6')](_0x11595b[_0xe1b9('0x7')]);}else if(_0x11595b['type']===_0xe1b9('0x8')&&_0x11595b[_0xe1b9('0x9')]){_0xc3522c[_0x11595b[_0xe1b9('0x9')]]&&_0x5c1863[_0xe1b9('0x6')](_0xc3522c[_0x11595b[_0xe1b9('0x9')]][_0xe1b9('0xa')]());}else if(_0x11595b[_0xe1b9('0x4')]===_0xe1b9('0xb')&&_0x11595b['Variable']&&_0x11595b['Variable']['name']){_0xc3522c[_0x11595b[_0xe1b9('0xc')][_0xe1b9('0xd')]['toLowerCase']()]&&_0x5c1863[_0xe1b9('0x6')](_0xc3522c[_0x11595b[_0xe1b9('0xc')][_0xe1b9('0xd')][_0xe1b9('0xe')]()]['toString']());}else if(_0x11595b['type']===_0xe1b9('0xf')){if(_0x11595b[_0xe1b9('0x10')]==='string'&&_0x11595b[_0xe1b9('0x11')]){_0x5c1863[_0xe1b9('0x6')](util[_0xe1b9('0x12')]('%s:\x20%s',_0x11595b['key'],_0x11595b[_0xe1b9('0x13')]));}else if(_0x11595b[_0xe1b9('0x10')]===_0xe1b9('0x8')&&_0x11595b[_0xe1b9('0x9')]&&_0x11595b['key']){_0xc3522c[_0x11595b[_0xe1b9('0x9')]]&&_0x5c1863[_0xe1b9('0x6')](util[_0xe1b9('0x12')](_0xe1b9('0x14'),_0x11595b[_0xe1b9('0x11')],_0xc3522c[_0x11595b[_0xe1b9('0x9')]]));}else if(_0x11595b[_0xe1b9('0x10')]===_0xe1b9('0xb')&&_0x11595b['Variable']&&_0x11595b['Variable'][_0xe1b9('0xd')]&&_0x11595b['key']){_0xc3522c[_0x11595b[_0xe1b9('0xc')][_0xe1b9('0xd')][_0xe1b9('0xe')]()]&&_0x5c1863[_0xe1b9('0x6')](util['format']('%s:\x20%s',_0x11595b[_0xe1b9('0x11')],_0xc3522c[_0x11595b['Variable'][_0xe1b9('0xd')][_0xe1b9('0xe')]()]));}}}}return _0x5c1863['join'](_0x44860d);};exports[_0xe1b9('0x15')]=function(_0x1a055e){var _0x15116c=_0x1a055e[_0xe1b9('0x16')](-0x1);if(_0x15116c==='/'){_0x1a055e=_0x1a055e[_0xe1b9('0x17')](0x0,_0x1a055e[_0xe1b9('0x18')](_0x15116c));}return _0x1a055e;};exports[_0xe1b9('0x19')]=function(_0x3b7f02){if(!_[_0xe1b9('0x1a')](_0x3b7f02)&&_0x3b7f02!==''){var _0x41aefb=/^(([^<>()\[\]\\.,;:\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 _0x41aefb['test'](String(_0x3b7f02)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x5df6=['validateEmail','test','lodash','util','getString','length','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash','substring','lastIndexOf'];(function(_0x257268,_0x2d5655){var _0x5a7a98=function(_0x8f3db4){while(--_0x8f3db4){_0x257268['push'](_0x257268['shift']());}};_0x5a7a98(++_0x2d5655);}(_0x5df6,0x154));var _0x65df=function(_0x4398ef,_0x12526b){_0x4398ef=_0x4398ef-0x0;var _0x55834b=_0x5df6[_0x4398ef];return _0x55834b;};'use strict';var _=require(_0x65df('0x0'));var util=require(_0x65df('0x1'));exports[_0x65df('0x2')]=function(_0x5ce964,_0xa5cccf,_0x52267e){var _0xf0ae33=[];if(_0x5ce964[_0x65df('0x3')]>0x0){var _0x4471d3=_['sortBy'](_0x5ce964,['id']);for(var _0x3f791a=0x0;_0x3f791a<_0x4471d3['length'];_0x3f791a++){var _0x1330ef=_0x4471d3[_0x3f791a];if(_0x1330ef['type']===_0x65df('0x4')){_0xf0ae33[_0x65df('0x5')](_0x1330ef[_0x65df('0x6')]);}else if(_0x1330ef[_0x65df('0x7')]===_0x65df('0x8')&&_0x1330ef[_0x65df('0x9')]){_0xa5cccf[_0x1330ef[_0x65df('0x9')]]&&_0xf0ae33[_0x65df('0x5')](_0xa5cccf[_0x1330ef[_0x65df('0x9')]][_0x65df('0xa')]());}else if(_0x1330ef[_0x65df('0x7')]===_0x65df('0xb')&&_0x1330ef[_0x65df('0xc')]&&_0x1330ef[_0x65df('0xc')][_0x65df('0xd')]){_0xa5cccf[_0x1330ef[_0x65df('0xc')][_0x65df('0xd')][_0x65df('0xe')]()]&&_0xf0ae33['push'](_0xa5cccf[_0x1330ef[_0x65df('0xc')][_0x65df('0xd')][_0x65df('0xe')]()][_0x65df('0xa')]());}else if(_0x1330ef[_0x65df('0x7')]==='keyValue'){if(_0x1330ef[_0x65df('0xf')]===_0x65df('0x4')&&_0x1330ef['key']){_0xf0ae33[_0x65df('0x5')](util[_0x65df('0x10')](_0x65df('0x11'),_0x1330ef[_0x65df('0x12')],_0x1330ef[_0x65df('0x13')]));}else if(_0x1330ef['keyType']===_0x65df('0x8')&&_0x1330ef[_0x65df('0x9')]&&_0x1330ef[_0x65df('0x12')]){_0xa5cccf[_0x1330ef[_0x65df('0x9')]]&&_0xf0ae33[_0x65df('0x5')](util[_0x65df('0x10')](_0x65df('0x11'),_0x1330ef[_0x65df('0x12')],_0xa5cccf[_0x1330ef[_0x65df('0x9')]]));}else if(_0x1330ef[_0x65df('0xf')]===_0x65df('0xb')&&_0x1330ef[_0x65df('0xc')]&&_0x1330ef[_0x65df('0xc')][_0x65df('0xd')]&&_0x1330ef[_0x65df('0x12')]){_0xa5cccf[_0x1330ef[_0x65df('0xc')][_0x65df('0xd')]['toLowerCase']()]&&_0xf0ae33['push'](util[_0x65df('0x10')]('%s:\x20%s',_0x1330ef[_0x65df('0x12')],_0xa5cccf[_0x1330ef[_0x65df('0xc')][_0x65df('0xd')][_0x65df('0xe')]()]));}}}}return _0xf0ae33[_0x65df('0x14')](_0x52267e);};exports[_0x65df('0x15')]=function(_0x335c32){var _0x4dc409=_0x335c32['slice'](-0x1);if(_0x4dc409==='/'){_0x335c32=_0x335c32[_0x65df('0x16')](0x0,_0x335c32[_0x65df('0x17')](_0x4dc409));}return _0x335c32;};exports[_0x65df('0x18')]=function(_0x59c259){if(!_['isNil'](_0x59c259)&&_0x59c259!==''){var _0x395ebd=/^(([^<>()\[\]\\.,;:\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 _0x395ebd[_0x65df('0x19')](String(_0x59c259)[_0x65df('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 538ecc8..e08fdd0 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x47c2a2,_0x196f83){var _0x46db37=function(_0x52c829){while(--_0x52c829){_0x47c2a2['push'](_0x47c2a2['shift']());}};_0x46db37(++_0x196f83);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x2d1965,_0x5811b0){var _0x38f880=function(_0x50f2e9){while(--_0x50f2e9){_0x2d1965['push'](_0x2d1965['shift']());}};_0x38f880(++_0x5811b0);}(_0xe706,0xa3));var _0x6e70=function(_0x2e08cb,_0x3987c8){_0x2e08cb=_0x2e08cb-0x0;var _0x223e9d=_0xe706[_0x2e08cb];return _0x223e9d;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index fe70c9d..2d8d763 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 _0xcd97=['The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','error','[QUEUE]','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','serverUrl','stripTrailingSlash','recordingFormat','none','destcalleridname','integrationTab','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','format','%s/tickets.json','POST','Tags','getString','Subjects','Fields','Ticket\x20created!','ticket','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','user','then','Admin\x20account\x20selected.','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','forEach','string','picklist','nameField','toLowerCase','content','includes','type','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:'];(function(_0xf852,_0x4ddd76){var _0x5b2550=function(_0x4811b1){while(--_0x4811b1){_0xf852['push'](_0xf852['shift']());}};_0x5b2550(++_0x4ddd76);}(_0xcd97,0xfa));var _0x7cd9=function(_0x59a1d9,_0x181115){_0x59a1d9=_0x59a1d9-0x0;var _0x577f9c=_0xcd97[_0x59a1d9];return _0x577f9c;};'use strict';var _=require(_0x7cd9('0x0'));var rp=require(_0x7cd9('0x1'));var md5=require('md5');var util=require(_0x7cd9('0x2'));var Redis=require(_0x7cd9('0x3'));var intUtil=require(_0x7cd9('0x4'));var config=require(_0x7cd9('0x5'));var logger=require(_0x7cd9('0x6'))(_0x7cd9('0x7'));config[_0x7cd9('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7cd9('0x9'))(new Redis(config[_0x7cd9('0x8')]));function emit(_0x801c2e,_0x4fbcc5,_0x41aa8e){io['to'](_0x801c2e)[_0x7cd9('0xa')](_0x4fbcc5,_0x41aa8e);}var headers={'Content-Type':_0x7cd9('0xb'),'Accept':_0x7cd9('0xb')};function getTicket(_0x297b9a,_0x4c4837,_0x5509f2,_0x4678dd,_0x124042){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x7cd9('0xc')](_0x7cd9('0xd'),_0x297b9a['remoteUri']),'method':_0x7cd9('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x5509f2['id'],'submitter_id':_0x4c4837?_0x4c4837['id']:undefined,'assignee_id':_0x4c4837?_0x4c4837['id']:undefined,'tags':getTags(_0x4678dd[_0x7cd9('0xf')],'name'),'subject':intUtil[_0x7cd9('0x10')](_0x4678dd[_0x7cd9('0x11')],_0x124042,'\x20'),'description':intUtil[_0x7cd9('0x10')](_0x4678dd['Descriptions'],_0x124042,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7cd9('0x10')](_0x4678dd['Descriptions'],_0x124042,'\x0a')}},getCustomFields(_0x4678dd[_0x7cd9('0x12')],_0x124042))}})['then'](function(_0x10f734){logger['info'](_0x7cd9('0x13'));return _0x10f734[_0x7cd9('0x14')];});}function getUser(_0x501714,_0x3a394b){if(intUtil['validateEmail'](_0x3a394b)){logger[_0x7cd9('0x15')](_0x7cd9('0x16'),_0x3a394b);return request({'uri':util[_0x7cd9('0xc')](_0x7cd9('0x17'),_0x501714['remoteUri']),'qs':{'query':util['format'](_0x7cd9('0x18'),_0x3a394b)}})['then'](function(_0x53b433){if(_0x53b433['count']){logger[_0x7cd9('0x15')](_0x7cd9('0x19'));return _['find'](_0x53b433[_0x7cd9('0x1a')],{'email':_0x3a394b,'role':'agent'});}else{logger[_0x7cd9('0x15')](_0x7cd9('0x1b'));return request({'uri':util[_0x7cd9('0xc')](_0x7cd9('0x1c'),_0x501714[_0x7cd9('0x1d')])})['then'](function(_0x4e3f2d){logger[_0x7cd9('0x15')]('Admin\x20account\x20selected.');return _0x4e3f2d[_0x7cd9('0x1e')];});}});}else{logger['info'](_0x7cd9('0x1b'));return request({'uri':util[_0x7cd9('0xc')]('%s/users/me.json',_0x501714[_0x7cd9('0x1d')])})[_0x7cd9('0x1f')](function(_0x118f45){logger['info'](_0x7cd9('0x20'));return _0x118f45[_0x7cd9('0x1e')];});}}function getEndUser(_0xeff0f,_0x682b15,_0x329936){logger[_0x7cd9('0x15')]('Searching\x20enduser\x20with\x20phone',_0x329936);return request({'uri':util[_0x7cd9('0xc')]('%s/search.json',_0xeff0f[_0x7cd9('0x1d')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x329936)}})['then'](function(_0x313338){var _0x3da95e;if(_0x313338['results'][_0x7cd9('0x21')]){_0x313338[_0x7cd9('0x1a')]=_[_0x7cd9('0x22')](_0x313338[_0x7cd9('0x1a')],{'suspended':![],'role':_0x7cd9('0x23')});if(_0x313338[_0x7cd9('0x1a')]['length']){_0x3da95e=_[_0x7cd9('0x24')](_0x313338[_0x7cd9('0x1a')]);}}if(_0x3da95e){logger[_0x7cd9('0x15')](_0x7cd9('0x25'));return _0x3da95e;}else{logger[_0x7cd9('0x15')](_0x7cd9('0x26'));return request({'uri':util['format'](_0x7cd9('0x27'),_0xeff0f[_0x7cd9('0x1d')]),'method':_0x7cd9('0xe'),'body':{'user':{'role':'end-user','name':util[_0x7cd9('0xc')](_0x7cd9('0x28'),_0x682b15||_0x329936),'phone':_0x329936}}})['then'](function(_0x4c9279){logger[_0x7cd9('0x15')](_0x7cd9('0x29'));return _0x4c9279[_0x7cd9('0x1e')];});}});}function getAuth(_0xf252a7){var _0x1fa73c;if(_0xf252a7['authType']===_0x7cd9('0x2a')){_0x1fa73c=util[_0x7cd9('0xc')](_0x7cd9('0x2b'),_0xf252a7['username'],_0xf252a7[_0x7cd9('0x2a')]);}else if(_0xf252a7[_0x7cd9('0x2c')]===_0x7cd9('0x2d')){_0x1fa73c=util[_0x7cd9('0xc')](_0x7cd9('0x2e'),_0xf252a7['username'],_0xf252a7['token']);}return util['format'](_0x7cd9('0x2f'),new Buffer(_0x1fa73c)[_0x7cd9('0x30')](_0x7cd9('0x31')));}function request(_0x13c78f){logger[_0x7cd9('0x32')](_0x7cd9('0x33'),JSON[_0x7cd9('0x34')](_0x13c78f));return rp(_[_0x7cd9('0x35')](_0x13c78f,{'method':_0x7cd9('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x4e7e52,_0x277800){var _0x31d96f=[];if(_0x4e7e52&&_0x4e7e52[_0x7cd9('0x21')]>0x0){_0x31d96f=_['map'](_0x4e7e52,_0x277800);}return _0x31d96f;}function getCustomFields(_0x3801c0,_0x4dea4a){var _0x485d77=[];var _0x1919a8={'custom_fields':[]};if(_0x3801c0['length']>0x0){_[_0x7cd9('0x37')](_0x3801c0,function(_0x452724){if(_['includes']([_0x7cd9('0x38'),_0x7cd9('0x39')],_0x452724['type'])&&_0x452724[_0x7cd9('0x3a')]&&!_0x452724['customField']){_0x1919a8[_0x452724[_0x7cd9('0x3a')][_0x7cd9('0x3b')]()]=_0x452724[_0x7cd9('0x3c')]['toString']();}else if(_[_0x7cd9('0x3d')]([_0x7cd9('0x38'),'picklist'],_0x452724[_0x7cd9('0x3e')])&&_0x452724[_0x7cd9('0x3f')]&&_0x452724[_0x7cd9('0x40')]){_0x1919a8[_0x7cd9('0x41')][_0x7cd9('0x42')]({'id':_0x452724[_0x7cd9('0x3f')],'value':_0x452724[_0x7cd9('0x3c')]['toString']()});}else if(_0x452724[_0x7cd9('0x3e')]===_0x7cd9('0x43')&&_0x452724[_0x7cd9('0x44')]&&_0x452724[_0x7cd9('0x3f')]&&_0x452724[_0x7cd9('0x40')]){_0x4dea4a[_0x452724[_0x7cd9('0x44')]]&&_0x1919a8['custom_fields'][_0x7cd9('0x42')]({'id':_0x452724[_0x7cd9('0x3f')],'value':_0x4dea4a[_0x452724[_0x7cd9('0x44')]][_0x7cd9('0x30')]()});}else if(_0x452724[_0x7cd9('0x3e')]===_0x7cd9('0x45')&&_0x452724[_0x7cd9('0x46')]&&_0x452724[_0x7cd9('0x46')]['name']&&_0x452724[_0x7cd9('0x3f')]&&_0x452724['customField']){_0x4dea4a[_0x452724[_0x7cd9('0x46')][_0x7cd9('0x47')][_0x7cd9('0x3b')]()]&&_0x1919a8[_0x7cd9('0x41')][_0x7cd9('0x42')]({'id':_0x452724[_0x7cd9('0x3f')],'value':_0x4dea4a[_0x452724[_0x7cd9('0x46')]['name'][_0x7cd9('0x3b')]()][_0x7cd9('0x30')]()});}});}return _0x1919a8;}exports[_0x7cd9('0x48')]=function(_0x1b5a6c,_0x5c0c12,_0x2e6693,_0x39bd6b,_0x4634e8,_0x4530a6){var _0x2dfa95,_0x3d9b57;_0x4530a6['remoteUri']=intUtil['stripTrailingSlash'](_0x4530a6['remoteUri']);_0x4530a6['serverUrl']=intUtil['stripTrailingSlash'](_0x4530a6['serverUrl']);if(_0x4634e8&&_0x4634e8[_0x7cd9('0x49')]){logger[_0x7cd9('0x15')]('[QUEUE]',_0x7cd9('0x4a'));_0x5c0c12[_0x7cd9('0x4b')]=util[_0x7cd9('0xc')](_0x7cd9('0x4c'),_0x4530a6['serverUrl'],_0x5c0c12['uniqueid'],md5(_0x5c0c12[_0x7cd9('0x4d')]));}else{_0x5c0c12['recordingURL']='';}headers[_0x7cd9('0x4e')]=getAuth(_0x4530a6);return getUser(_0x4530a6,_0x39bd6b[_0x7cd9('0x4f')])['then'](function(_0x214ec2){_0x2dfa95=_0x214ec2;logger[_0x7cd9('0x15')](_0x7cd9('0x50'),_0x2dfa95['id']);return getEndUser(_0x4530a6,_0x5c0c12[_0x7cd9('0x51')],_0x5c0c12['calleridnum']);})[_0x7cd9('0x1f')](function(_0x17f45d){_0x3d9b57=_0x17f45d;logger[_0x7cd9('0x15')](_0x7cd9('0x52'),_0x3d9b57['id']);return getTicket(_0x4530a6,_0x2dfa95,_0x3d9b57,_0x2e6693,_0x5c0c12);})[_0x7cd9('0x1f')](function(_0x206ff6){if(_0x206ff6){logger[_0x7cd9('0x15')](_0x7cd9('0x53'),_0x206ff6['id']);switch(_0x4530a6[_0x7cd9('0x3e')]){case'integrationTab':logger[_0x7cd9('0x15')]('[QUEUE]',_0x7cd9('0x54'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4530a6[_0x7cd9('0x1d')],_0x2dfa95['id'],_0x206ff6['id']),'method':_0x7cd9('0xe')});case _0x7cd9('0x55'):logger[_0x7cd9('0x15')]('[QUEUE]',_0x7cd9('0x56'));emit(util[_0x7cd9('0xc')]('user:%s',_0x39bd6b['name']),_0x7cd9('0x57'),{'uri':util[_0x7cd9('0xc')]('%s/agent/tickets/%s',_0x4530a6[_0x7cd9('0x1d')][_0x7cd9('0x58')]('/api/v2',''),_0x206ff6['id'])});break;default:logger[_0x7cd9('0x59')](_0x7cd9('0x5a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x3c79b1){logger['error'](_0x7cd9('0x5b'),util[_0x7cd9('0x5c')](_0x3c79b1,{'showHidden':!![],'depth':null}));});};exports[_0x7cd9('0x5d')]=function(_0x21c7be,_0x27e69f,_0x1d75a7,_0x13dc7a,_0x10e79b,_0x4a559d,_0x369c9f){var _0x3bedb2,_0xb98700;_0x4a559d[_0x7cd9('0x1d')]=intUtil['stripTrailingSlash'](_0x4a559d[_0x7cd9('0x1d')]);_0x4a559d[_0x7cd9('0x5e')]=intUtil[_0x7cd9('0x5f')](_0x4a559d[_0x7cd9('0x5e')]);if(_0x369c9f&&_0x369c9f['recordingFormat']&&_0x369c9f[_0x7cd9('0x60')]!==_0x7cd9('0x61')){logger['info']('[OUTBOUND]',_0x7cd9('0x4a'));_0x27e69f[_0x7cd9('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a559d[_0x7cd9('0x5e')],_0x27e69f['uniqueid'],md5(_0x27e69f[_0x7cd9('0x4d')]));}headers[_0x7cd9('0x4e')]=getAuth(_0x4a559d);return getUser(_0x4a559d,_0x13dc7a[_0x7cd9('0x4f')])[_0x7cd9('0x1f')](function(_0x88215b){_0x3bedb2=_0x88215b;logger['info'](_0x7cd9('0x50'),_0x3bedb2['id']);return getEndUser(_0x4a559d,_0x27e69f[_0x7cd9('0x62')],_0x27e69f['destcalleridnum']);})['then'](function(_0x3f45ee){_0xb98700=_0x3f45ee;logger['info'](_0x7cd9('0x52'),_0xb98700['id']);return getTicket(_0x4a559d,_0x3bedb2,_0xb98700,_0x1d75a7,_0x27e69f);})[_0x7cd9('0x1f')](function(_0x1c4e81){if(_0x1c4e81){logger[_0x7cd9('0x15')]('The\x20Ticket\x20ID\x20is:',_0x1c4e81['id']);switch(_0x4a559d[_0x7cd9('0x3e')]){case _0x7cd9('0x63'):logger[_0x7cd9('0x15')](_0x7cd9('0x64'),_0x7cd9('0x54'));return request({'uri':util['format'](_0x7cd9('0x65'),_0x4a559d[_0x7cd9('0x1d')],_0x3bedb2['id'],_0x1c4e81['id']),'method':'POST'});case _0x7cd9('0x55'):logger[_0x7cd9('0x15')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7cd9('0xc')](_0x7cd9('0x66'),_0x13dc7a[_0x7cd9('0x47')]),_0x7cd9('0x57'),{'uri':util[_0x7cd9('0xc')](_0x7cd9('0x67'),_0x4a559d['remoteUri'][_0x7cd9('0x58')](_0x7cd9('0x68'),''),_0x1c4e81['id'])});break;default:logger[_0x7cd9('0x59')](_0x7cd9('0x64'),_0x7cd9('0x69'));}}})[_0x7cd9('0x6a')](function(_0x26706c){logger['error'](_0x7cd9('0x6b'),util[_0x7cd9('0x5c')](_0x26706c,{'showHidden':!![],'depth':null}));});};exports[_0x7cd9('0x6c')]=function(_0x46bd0a,_0x7c261d,_0x899e9a,_0x24a050,_0x5944c5,_0x4adc27){var _0x3ac144,_0x2adf39;_0x4adc27['remoteUri']=intUtil['stripTrailingSlash'](_0x4adc27['remoteUri']);_0x4adc27['serverUrl']=intUtil[_0x7cd9('0x5f')](_0x4adc27[_0x7cd9('0x5e')]);if(_0x5944c5&&_0x5944c5['monitor_format']){logger['info']('['+_0x7c261d['lastevent']['toUpperCase']()+']',_0x7cd9('0x4a'));_0x7c261d[_0x7cd9('0x4b')]=util[_0x7cd9('0xc')](_0x7cd9('0x4c'),_0x4adc27[_0x7cd9('0x5e')],_0x7c261d[_0x7cd9('0x4d')],md5(_0x7c261d['uniqueid']));}else{_0x7c261d[_0x7cd9('0x4b')]='';}headers[_0x7cd9('0x4e')]=getAuth(_0x4adc27);return getUser(_0x4adc27)[_0x7cd9('0x1f')](function(_0x2a186f){_0x3ac144=_0x2a186f;logger[_0x7cd9('0x15')](_0x7cd9('0x50'),_0x3ac144['id']);return getEndUser(_0x4adc27,_0x7c261d['calleridname'],_0x7c261d['calleridnum']);})['then'](function(_0x3663db){_0x2adf39=_0x3663db;logger[_0x7cd9('0x15')](_0x7cd9('0x52'),_0x2adf39['id']);return getTicket(_0x4adc27,_0x3ac144,_0x2adf39,_0x899e9a,_0x7c261d);})['then'](function(_0x420d15){if(_0x420d15){logger['info'](_0x7cd9('0x53'),_0x420d15['id']);}})[_0x7cd9('0x6a')](function(_0x4b4c43){logger[_0x7cd9('0x59')]('['+_0x7c261d[_0x7cd9('0x6d')][_0x7cd9('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7cd9('0x5c')](_0x4b4c43,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x74da=['%s/search.json','remoteUri','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','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Enduser\x20created.','authType','password','username','token','%s/token:%s','base64','debug','stringify','GET','map','forEach','picklist','type','nameField','customField','toLowerCase','content','toString','includes','string','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','error','inspect','outbound','recordingFormat','none','email','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','POST','Tags','name','Subjects','getString','Descriptions','then','Getting\x20agent\x20with\x20email','format'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x74da,0x136));var _0xa74d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x74da[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa74d('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xa74d('0x1'));var Redis=require('ioredis');var intUtil=require(_0xa74d('0x2'));var config=require(_0xa74d('0x3'));var logger=require(_0xa74d('0x4'))(_0xa74d('0x5'));config[_0xa74d('0x6')]=_[_0xa74d('0x7')](config[_0xa74d('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa74d('0x8'))(new Redis(config['redis']));function emit(_0x22945b,_0x54d013,_0x806de9){io['to'](_0x22945b)[_0xa74d('0x9')](_0x54d013,_0x806de9);}var headers={'Content-Type':'application/json','Accept':_0xa74d('0xa')};function getTicket(_0x2f2ba3,_0x149e60,_0x54f35c,_0x525fd7,_0x34030b){logger[_0xa74d('0xb')](_0xa74d('0xc'));return request({'uri':util['format'](_0xa74d('0xd'),_0x2f2ba3['remoteUri']),'method':_0xa74d('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x54f35c['id'],'submitter_id':_0x149e60?_0x149e60['id']:undefined,'assignee_id':_0x149e60?_0x149e60['id']:undefined,'tags':getTags(_0x525fd7[_0xa74d('0xf')],_0xa74d('0x10')),'subject':intUtil['getString'](_0x525fd7[_0xa74d('0x11')],_0x34030b,'\x20'),'description':intUtil[_0xa74d('0x12')](_0x525fd7['Descriptions'],_0x34030b,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa74d('0x12')](_0x525fd7[_0xa74d('0x13')],_0x34030b,'\x0a')}},getCustomFields(_0x525fd7['Fields'],_0x34030b))}})[_0xa74d('0x14')](function(_0x414be1){logger[_0xa74d('0xb')]('Ticket\x20created!');return _0x414be1['ticket'];});}function getUser(_0x466726,_0x243a14){if(intUtil['validateEmail'](_0x243a14)){logger[_0xa74d('0xb')](_0xa74d('0x15'),_0x243a14);return request({'uri':util[_0xa74d('0x16')](_0xa74d('0x17'),_0x466726[_0xa74d('0x18')]),'qs':{'query':util[_0xa74d('0x16')](_0xa74d('0x19'),_0x243a14)}})['then'](function(_0x5cf28d){if(_0x5cf28d[_0xa74d('0x1a')]){logger[_0xa74d('0xb')](_0xa74d('0x1b'));return _[_0xa74d('0x1c')](_0x5cf28d[_0xa74d('0x1d')],{'email':_0x243a14,'role':_0xa74d('0x1e')});}else{logger[_0xa74d('0xb')](_0xa74d('0x1f'));return request({'uri':util['format'](_0xa74d('0x20'),_0x466726['remoteUri'])})[_0xa74d('0x14')](function(_0x18e6b4){logger[_0xa74d('0xb')](_0xa74d('0x21'));return _0x18e6b4['user'];});}});}else{logger[_0xa74d('0xb')](_0xa74d('0x1f'));return request({'uri':util[_0xa74d('0x16')](_0xa74d('0x20'),_0x466726['remoteUri'])})['then'](function(_0x14eb37){logger[_0xa74d('0xb')](_0xa74d('0x21'));return _0x14eb37[_0xa74d('0x22')];});}}function getEndUser(_0x386226,_0x4d022c,_0x539e44){logger[_0xa74d('0xb')]('Searching\x20enduser\x20with\x20phone',_0x539e44);return request({'uri':util['format'](_0xa74d('0x17'),_0x386226[_0xa74d('0x18')]),'qs':{'query':util[_0xa74d('0x16')](_0xa74d('0x23'),_0x539e44)}})['then'](function(_0x354e51){var _0x1b41ab;if(_0x354e51[_0xa74d('0x1d')][_0xa74d('0x24')]){_0x354e51['results']=_[_0xa74d('0x25')](_0x354e51[_0xa74d('0x1d')],{'suspended':![],'role':'end-user'});if(_0x354e51[_0xa74d('0x1d')]['length']){_0x1b41ab=_[_0xa74d('0x26')](_0x354e51['results']);}}if(_0x1b41ab){logger[_0xa74d('0xb')](_0xa74d('0x27'));return _0x1b41ab;}else{logger['info'](_0xa74d('0x28'));return request({'uri':util[_0xa74d('0x16')](_0xa74d('0x29'),_0x386226['remoteUri']),'method':'POST','body':{'user':{'role':_0xa74d('0x2a'),'name':util[_0xa74d('0x16')]('Caller\x20-\x20%s',_0x4d022c||_0x539e44),'phone':_0x539e44}}})[_0xa74d('0x14')](function(_0x945e50){logger[_0xa74d('0xb')](_0xa74d('0x2b'));return _0x945e50['user'];});}});}function getAuth(_0x52e25){var _0x3aa759;if(_0x52e25[_0xa74d('0x2c')]===_0xa74d('0x2d')){_0x3aa759=util[_0xa74d('0x16')]('%s:%s',_0x52e25[_0xa74d('0x2e')],_0x52e25['password']);}else if(_0x52e25[_0xa74d('0x2c')]===_0xa74d('0x2f')){_0x3aa759=util[_0xa74d('0x16')](_0xa74d('0x30'),_0x52e25['username'],_0x52e25['token']);}return util[_0xa74d('0x16')]('Basic\x20%s',new Buffer(_0x3aa759)['toString'](_0xa74d('0x31')));}function request(_0x1f5dcf){logger[_0xa74d('0x32')]('[HTTP]',JSON[_0xa74d('0x33')](_0x1f5dcf));return rp(_[_0xa74d('0x7')](_0x1f5dcf,{'method':_0xa74d('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x1ec023,_0x5b52c3){var _0x59aecf=[];if(_0x1ec023&&_0x1ec023[_0xa74d('0x24')]>0x0){_0x59aecf=_[_0xa74d('0x35')](_0x1ec023,_0x5b52c3);}return _0x59aecf;}function getCustomFields(_0x4642d9,_0x46150a){var _0x4863d2=[];var _0x40ec12={'custom_fields':[]};if(_0x4642d9[_0xa74d('0x24')]>0x0){_[_0xa74d('0x36')](_0x4642d9,function(_0x3e52c8){if(_['includes'](['string',_0xa74d('0x37')],_0x3e52c8[_0xa74d('0x38')])&&_0x3e52c8[_0xa74d('0x39')]&&!_0x3e52c8[_0xa74d('0x3a')]){_0x40ec12[_0x3e52c8[_0xa74d('0x39')][_0xa74d('0x3b')]()]=_0x3e52c8[_0xa74d('0x3c')][_0xa74d('0x3d')]();}else if(_[_0xa74d('0x3e')]([_0xa74d('0x3f'),_0xa74d('0x37')],_0x3e52c8['type'])&&_0x3e52c8[_0xa74d('0x40')]&&_0x3e52c8[_0xa74d('0x3a')]){_0x40ec12[_0xa74d('0x41')][_0xa74d('0x42')]({'id':_0x3e52c8[_0xa74d('0x40')],'value':_0x3e52c8['content'][_0xa74d('0x3d')]()});}else if(_0x3e52c8[_0xa74d('0x38')]===_0xa74d('0x43')&&_0x3e52c8['variableName']&&_0x3e52c8[_0xa74d('0x40')]&&_0x3e52c8[_0xa74d('0x3a')]){_0x46150a[_0x3e52c8[_0xa74d('0x44')]]&&_0x40ec12[_0xa74d('0x41')][_0xa74d('0x42')]({'id':_0x3e52c8[_0xa74d('0x40')],'value':_0x46150a[_0x3e52c8['variableName']][_0xa74d('0x3d')]()});}else if(_0x3e52c8[_0xa74d('0x38')]==='customVariable'&&_0x3e52c8[_0xa74d('0x45')]&&_0x3e52c8[_0xa74d('0x45')][_0xa74d('0x10')]&&_0x3e52c8[_0xa74d('0x40')]&&_0x3e52c8[_0xa74d('0x3a')]){_0x46150a[_0x3e52c8['Variable'][_0xa74d('0x10')]['toLowerCase']()]&&_0x40ec12['custom_fields']['push']({'id':_0x3e52c8[_0xa74d('0x40')],'value':_0x46150a[_0x3e52c8['Variable'][_0xa74d('0x10')][_0xa74d('0x3b')]()][_0xa74d('0x3d')]()});}});}return _0x40ec12;}exports[_0xa74d('0x46')]=function(_0x12b9cc,_0x37db86,_0x1ea9c6,_0x21a05b,_0x3f7e5f,_0xc776e7){var _0x581c8e,_0x4ad80d;_0xc776e7['remoteUri']=intUtil[_0xa74d('0x47')](_0xc776e7[_0xa74d('0x18')]);_0xc776e7['serverUrl']=intUtil[_0xa74d('0x47')](_0xc776e7[_0xa74d('0x48')]);if(_0x3f7e5f&&_0x3f7e5f[_0xa74d('0x49')]){logger[_0xa74d('0xb')](_0xa74d('0x4a'),_0xa74d('0x4b'));_0x37db86[_0xa74d('0x4c')]=util[_0xa74d('0x16')](_0xa74d('0x4d'),_0xc776e7[_0xa74d('0x48')],_0x37db86[_0xa74d('0x4e')],md5(_0x37db86['uniqueid']));}else{_0x37db86['recordingURL']='';}headers[_0xa74d('0x4f')]=getAuth(_0xc776e7);return getUser(_0xc776e7,_0x21a05b['email'])[_0xa74d('0x14')](function(_0x205bfc){_0x581c8e=_0x205bfc;logger[_0xa74d('0xb')](_0xa74d('0x50'),_0x581c8e['id']);return getEndUser(_0xc776e7,_0x37db86[_0xa74d('0x51')],_0x37db86[_0xa74d('0x52')]);})['then'](function(_0x367322){_0x4ad80d=_0x367322;logger[_0xa74d('0xb')](_0xa74d('0x53'),_0x4ad80d['id']);return getTicket(_0xc776e7,_0x581c8e,_0x4ad80d,_0x1ea9c6,_0x37db86);})[_0xa74d('0x14')](function(_0x494b6c){if(_0x494b6c){logger[_0xa74d('0xb')](_0xa74d('0x54'),_0x494b6c['id']);switch(_0xc776e7[_0xa74d('0x38')]){case _0xa74d('0x55'):logger[_0xa74d('0xb')](_0xa74d('0x4a'),_0xa74d('0x56'));return request({'uri':util[_0xa74d('0x16')](_0xa74d('0x57'),_0xc776e7[_0xa74d('0x18')],_0x581c8e['id'],_0x494b6c['id']),'method':_0xa74d('0xe')});case _0xa74d('0x58'):logger[_0xa74d('0xb')](_0xa74d('0x4a'),_0xa74d('0x59'));emit(util[_0xa74d('0x16')]('user:%s',_0x21a05b[_0xa74d('0x10')]),_0xa74d('0x5a'),{'uri':util[_0xa74d('0x16')](_0xa74d('0x5b'),_0xc776e7['remoteUri']['replace'](_0xa74d('0x5c'),''),_0x494b6c['id'])});break;default:logger['error'](_0xa74d('0x4a'),_0xa74d('0x5d'));}}})['catch'](function(_0x395a8e){logger[_0xa74d('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa74d('0x5f')](_0x395a8e,{'showHidden':!![],'depth':null}));});};exports[_0xa74d('0x60')]=function(_0x4d1f8f,_0x3d1a4d,_0x542853,_0x93acad,_0x22813d,_0x355981,_0x410128){var _0x5ebc96,_0x36d222;_0x355981[_0xa74d('0x18')]=intUtil[_0xa74d('0x47')](_0x355981[_0xa74d('0x18')]);_0x355981[_0xa74d('0x48')]=intUtil[_0xa74d('0x47')](_0x355981[_0xa74d('0x48')]);if(_0x410128&&_0x410128[_0xa74d('0x61')]&&_0x410128['recordingFormat']!==_0xa74d('0x62')){logger[_0xa74d('0xb')]('[OUTBOUND]',_0xa74d('0x4b'));_0x3d1a4d['recordingURL']=util[_0xa74d('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x355981[_0xa74d('0x48')],_0x3d1a4d['uniqueid'],md5(_0x3d1a4d['uniqueid']));}headers[_0xa74d('0x4f')]=getAuth(_0x355981);return getUser(_0x355981,_0x93acad[_0xa74d('0x63')])[_0xa74d('0x14')](function(_0x5dd847){_0x5ebc96=_0x5dd847;logger[_0xa74d('0xb')](_0xa74d('0x50'),_0x5ebc96['id']);return getEndUser(_0x355981,_0x3d1a4d[_0xa74d('0x64')],_0x3d1a4d[_0xa74d('0x65')]);})[_0xa74d('0x14')](function(_0x1e81c6){_0x36d222=_0x1e81c6;logger[_0xa74d('0xb')](_0xa74d('0x53'),_0x36d222['id']);return getTicket(_0x355981,_0x5ebc96,_0x36d222,_0x542853,_0x3d1a4d);})['then'](function(_0xa0743c){if(_0xa0743c){logger[_0xa74d('0xb')](_0xa74d('0x54'),_0xa0743c['id']);switch(_0x355981['type']){case _0xa74d('0x55'):logger[_0xa74d('0xb')](_0xa74d('0x66'),_0xa74d('0x56'));return request({'uri':util[_0xa74d('0x16')](_0xa74d('0x57'),_0x355981[_0xa74d('0x18')],_0x5ebc96['id'],_0xa0743c['id']),'method':_0xa74d('0xe')});case _0xa74d('0x58'):logger['info'](_0xa74d('0x66'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa74d('0x16')](_0xa74d('0x67'),_0x93acad['name']),'trigger:browser:url',{'uri':util['format'](_0xa74d('0x5b'),_0x355981[_0xa74d('0x18')][_0xa74d('0x68')]('/api/v2',''),_0xa0743c['id'])});break;default:logger[_0xa74d('0x5e')]('[OUTBOUND]',_0xa74d('0x5d'));}}})[_0xa74d('0x69')](function(_0x17f247){logger[_0xa74d('0x5e')](_0xa74d('0x6a'),util[_0xa74d('0x5f')](_0x17f247,{'showHidden':!![],'depth':null}));});};exports[_0xa74d('0x6b')]=function(_0x24960b,_0x248dbe,_0x362f87,_0x514e3f,_0x1007c4,_0x34c824){var _0x3dc43e,_0x7cbd0e;_0x34c824[_0xa74d('0x18')]=intUtil[_0xa74d('0x47')](_0x34c824[_0xa74d('0x18')]);_0x34c824['serverUrl']=intUtil[_0xa74d('0x47')](_0x34c824[_0xa74d('0x48')]);if(_0x1007c4&&_0x1007c4[_0xa74d('0x49')]){logger[_0xa74d('0xb')]('['+_0x248dbe[_0xa74d('0x6c')]['toUpperCase']()+']',_0xa74d('0x4b'));_0x248dbe['recordingURL']=util[_0xa74d('0x16')](_0xa74d('0x4d'),_0x34c824['serverUrl'],_0x248dbe['uniqueid'],md5(_0x248dbe[_0xa74d('0x4e')]));}else{_0x248dbe[_0xa74d('0x4c')]='';}headers['Authorization']=getAuth(_0x34c824);return getUser(_0x34c824)[_0xa74d('0x14')](function(_0x46cef7){_0x3dc43e=_0x46cef7;logger[_0xa74d('0xb')](_0xa74d('0x50'),_0x3dc43e['id']);return getEndUser(_0x34c824,_0x248dbe['calleridname'],_0x248dbe[_0xa74d('0x52')]);})[_0xa74d('0x14')](function(_0x283ea3){_0x7cbd0e=_0x283ea3;logger[_0xa74d('0xb')](_0xa74d('0x53'),_0x7cbd0e['id']);return getTicket(_0x34c824,_0x3dc43e,_0x7cbd0e,_0x362f87,_0x248dbe);})[_0xa74d('0x14')](function(_0x586ed9){if(_0x586ed9){logger[_0xa74d('0xb')](_0xa74d('0x54'),_0x586ed9['id']);}})[_0xa74d('0x69')](function(_0x157831){logger[_0xa74d('0x5e')]('['+_0x248dbe[_0xa74d('0x6c')][_0xa74d('0x6d')]()+']'+_0xa74d('0x6e'),util[_0xa74d('0x5f')](_0x157831,{'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 7529aca..feed39b 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 _0x94ca=['First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','length','forEach','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name'];(function(_0x201a9e,_0x4a3cda){var _0x3cabd8=function(_0x2d88a7){while(--_0x2d88a7){_0x201a9e['push'](_0x201a9e['shift']());}};_0x3cabd8(++_0x4a3cda);}(_0x94ca,0xde));var _0xa94c=function(_0x511a19,_0x417e36){_0x511a19=_0x511a19-0x0;var _0x499aa6=_0x94ca[_0x511a19];return _0x499aa6;};'use strict';var _=require(_0xa94c('0x0'));var rp=require(_0xa94c('0x1'));var md5=require(_0xa94c('0x2'));var util=require(_0xa94c('0x3'));var intUtil=require(_0xa94c('0x4'));var moment=require(_0xa94c('0x5'));var Redis=require(_0xa94c('0x6'));var BPromise=require(_0xa94c('0x7'));var config=require(_0xa94c('0x8'));var logger=require(_0xa94c('0x9'))(_0xa94c('0xa'));config[_0xa94c('0xb')]=_[_0xa94c('0xc')](config['redis'],{'host':_0xa94c('0xd'),'port':0x18eb});var io=require(_0xa94c('0xe'))(new Redis(config[_0xa94c('0xb')]));function emit(_0x46f724,_0x579f29,_0x482c02){io['to'](_0x46f724)['emit'](_0x579f29,_0x482c02);}function request(_0x5dcf28){logger[_0xa94c('0xf')](_0xa94c('0x10'),JSON['stringify'](_0x5dcf28));return rp(_0x5dcf28);}function getCustomFields(_0x46fcd3,_0x26a4f3){var _0x2cb23e={};if(_0x46fcd3[_0xa94c('0x11')]>0x0){_[_0xa94c('0x12')](_0x46fcd3,function(_0x1a028d){if(_['includes'](['string','picklist'],_0x1a028d[_0xa94c('0x13')])&&_0x1a028d[_0xa94c('0x14')]){_0x2cb23e[_0x1a028d[_0xa94c('0x14')]]=_0x1a028d[_0xa94c('0x15')][_0xa94c('0x16')]();}else if(_0x1a028d[_0xa94c('0x13')]===_0xa94c('0x17')&&_0x1a028d[_0xa94c('0x18')]&&_0x1a028d[_0xa94c('0x14')]&&_0x26a4f3[_0x1a028d['variableName']]){_0x2cb23e[_0x1a028d[_0xa94c('0x14')]]=_0x26a4f3[_0x1a028d[_0xa94c('0x18')]][_0xa94c('0x16')]();}else if(_0x1a028d[_0xa94c('0x13')]==='customVariable'&&_0x1a028d[_0xa94c('0x19')]&&_0x1a028d[_0xa94c('0x19')][_0xa94c('0x1a')]&&_0x1a028d[_0xa94c('0x14')]&&_0x26a4f3[_0x1a028d['Variable']['name'][_0xa94c('0x1b')]()]){_0x2cb23e[_0x1a028d[_0xa94c('0x14')]]=_0x26a4f3[_0x1a028d['Variable'][_0xa94c('0x1a')][_0xa94c('0x1b')]()][_0xa94c('0x16')]();}});}return _0x2cb23e;}function getName(_0x37bb37){if(_0x37bb37[_0xa94c('0x1c')]('\x20')>0x0){var _0x351faa=_0x37bb37[_0xa94c('0x1d')](/ (.+)/);if(_0x351faa[0x1]){return _0x351faa;}}return[_0x37bb37,_0x37bb37];}var accountsTokens={};function getAccessToken(_0x3b925c){return new Promise(function(_0x26d61d,_0xbac76b){if(!_[_0xa94c('0x1e')](accountsTokens[_0x3b925c['id']])&&!_[_0xa94c('0x1e')](accountsTokens[_0x3b925c['id']][_0xa94c('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x3b925c['id']]['expires_in'])){_0x26d61d(accountsTokens[_0x3b925c['id']]['access_token']);}}var _0x4c1ac4;switch(_0x3b925c[_0xa94c('0x20')]){case'US':_0x4c1ac4=_0xa94c('0x21');break;case'AU':_0x4c1ac4=_0xa94c('0x22');break;case'EU':_0x4c1ac4='https://accounts.zoho.eu';break;case'IN':_0x4c1ac4=_0xa94c('0x23');break;case'CN':_0x4c1ac4=_0xa94c('0x24');break;default:_0x4c1ac4=_0xa94c('0x25');break;}var _0x48c9bd={'method':'POST','uri':_0x4c1ac4+_0xa94c('0x26'),'qs':{'refresh_token':_0x3b925c[_0xa94c('0x27')],'client_id':_0x3b925c[_0xa94c('0x28')],'client_secret':_0x3b925c[_0xa94c('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x48c9bd)[_0xa94c('0x2a')](function(_0x437e92){accountsTokens[_0x3b925c['id']]={'access_token':_0x437e92[_0xa94c('0x1f')],'expires_in':moment()[_0xa94c('0x2b')](_0x437e92['expires_in'],_0xa94c('0x2c'))};_0x26d61d(_0x437e92[_0xa94c('0x1f')]);})[_0xa94c('0x2d')](function(_0x58e079){logger[_0xa94c('0x2e')](_0xa94c('0x2f'),_0x58e079[_0xa94c('0x30')]);_0xbac76b(_0x58e079);});});}function getUser(_0x3c8ba2,_0x398e39,_0x9a36c3,_0x4b2b7e){logger[_0xa94c('0x31')](_0xa94c('0x32'));return request({'method':_0xa94c('0x33'),'uri':util[_0xa94c('0x34')]('https://www.zohoapis.%s/crm/v2/users',_0x398e39),'qs':{'type':_0xa94c('0x35')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3c8ba2},'json':!![]})[_0xa94c('0x2a')](function(_0x5acf0a){if(_0x5acf0a[_0xa94c('0x36')]){var _0x2f9edc=-0x1;if(_[_0xa94c('0x37')](_0x5acf0a[_0xa94c('0x36')])){if(!_[_0xa94c('0x1e')](_0x4b2b7e)){_0x2f9edc=_['findIndex'](_0x5acf0a[_0xa94c('0x36')],function(_0x4da282){return _0x4da282[_0xa94c('0x38')]===_0x4b2b7e;});}if(_0x2f9edc>=0x0){logger[_0xa94c('0x31')](_0xa94c('0x39'));}else{logger['info'](_0xa94c('0x3a'));_0x2f9edc=_[_0xa94c('0x3b')](_0x5acf0a[_0xa94c('0x36')],function(_0x3457a0){return _0x3457a0[_0xa94c('0x3c')][_0xa94c('0x1a')]===_0xa94c('0x3d');});}return _0x5acf0a[_0xa94c('0x36')][_0x2f9edc];}else{if(_0x5acf0a[_0xa94c('0x3e')][_0xa94c('0x3c')][_0xa94c('0x1a')]===_0xa94c('0x3d')){logger[_0xa94c('0x31')](_0xa94c('0x3a'));user=_0x5acf0a[_0xa94c('0x3e')];return user;}else{logger[_0xa94c('0x2e')](_0xa94c('0x3f'),JSON[_0xa94c('0x40')](_0x5acf0a));throw new Error(_0xa94c('0x41')+JSON[_0xa94c('0x40')](_0x5acf0a));}}}else{logger[_0xa94c('0x2e')]('The\x20failing\x20result\x20is',JSON[_0xa94c('0x40')](_0x5acf0a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x5acf0a));}})[_0xa94c('0x2d')](function(_0x1f6d2b){console[_0xa94c('0x2e')](_0x1f6d2b);});}function getZohoUser(_0x562cf8,_0x13771b){return new BPromise(function(_0x511f65,_0x577153){request(_0x562cf8)[_0xa94c('0x2a')](function(_0x5a0769){var _0xfe5c5d=null;if(_0x5a0769){_0xfe5c5d=_0x5a0769[_0xa94c('0x42')][0x0];_0xfe5c5d[_0xa94c('0x43')]=_0x13771b;}_0x511f65(_0xfe5c5d);})[_0xa94c('0x2d')](function(_0x204919){_0x577153(_0x204919);});});}function createEndUser(_0x727d1c,_0x16c909,_0x16a838,_0x12f182,_0x44385f,_0x293adc){var _0x16a838=getName(_0x16a838);return request({'method':_0xa94c('0x44'),'uri':_0xa94c('0x45')+_0x16c909+_0xa94c('0x46')+_[_0xa94c('0x47')](_0x293adc[_0xa94c('0x48')])+'s','body':{'data':[{'Last_Name':_0x16a838[0x1],'First_Name':_0x16a838[0x0],'Phone':_0x12f182,'Owner':{'name':!_[_0xa94c('0x1e')](_0x44385f[_0xa94c('0x49')][_0xa94c('0x1a')])?_0x44385f['role'][_0xa94c('0x1a')]:!_['isNil'](_0x44385f[_0xa94c('0x4a')])?_0x44385f[_0xa94c('0x4a')]+'\x20'+_0x44385f[_0xa94c('0x4b')]:_0x44385f['last_name'],'id':_0x44385f['id']}}]},'headers':{'Authorization':_0xa94c('0x4c')+_0x727d1c},'json':!![]})['then'](function(_0x4f1214){if(_0x4f1214&&_0x4f1214[_0xa94c('0x42')][0x0]['code']===_0xa94c('0x4d')){var _0x157b9d=_0x4f1214[_0xa94c('0x42')][0x0][_0xa94c('0x4e')];_0x157b9d[_0xa94c('0x43')]=_[_0xa94c('0x47')](_0x293adc[_0xa94c('0x48')])+'s';return _0x157b9d;}logger[_0xa94c('0x2e')](_0xa94c('0x3f'),JSON['stringify'](data));throw new Error(_0xa94c('0x4f')+JSON['stringify'](data));})['catch'](function(_0x4caa6a){console[_0xa94c('0x50')](_0xa94c('0x51'),_0x4caa6a);});}function getEndUser(_0x127ebf,_0x3b5c91,_0x544cf2,_0x1b1fd4,_0xb8e33a,_0x363d26,_0xe9db61){var _0x97047d={'method':_0xa94c('0x33'),'uri':'','headers':{'Authorization':_0xa94c('0x4c')+_0x127ebf},'json':!![]};switch(_0xe9db61['moduleSearch']){case _0xa94c('0x52'):_0x97047d[_0xa94c('0x53')]=_0xa94c('0x45')+_0x3b5c91+_0xa94c('0x54')+_0xb8e33a+'))';return getZohoUser(_0x97047d,_0xa94c('0x55'))[_0xa94c('0x2a')](function(_0x3257e6){if(_0x3257e6)return _0x3257e6;_0x97047d['uri']=_0xa94c('0x45')+_0x3b5c91+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xb8e33a+'))';return getZohoUser(_0x97047d,'Leads')[_0xa94c('0x2a')](function(_0x1f33e6){if(_0x1f33e6)return _0x1f33e6;if(_0xe9db61[_0xa94c('0x48')]!=_0xa94c('0x56')){return createEndUser(_0x127ebf,_0x3b5c91,_0x1b1fd4,_0xb8e33a,_0x363d26,_0xe9db61);}else{return{};}});});break;case _0xa94c('0x57'):_0x97047d['uri']=_0xa94c('0x45')+_0x3b5c91+_0xa94c('0x54')+_0xb8e33a+'))';return getZohoUser(_0x97047d,_0xa94c('0x55'))['then'](function(_0x406ce2){if(_0x406ce2)return _0x406ce2;if(_0xe9db61[_0xa94c('0x48')]!=_0xa94c('0x56')){return createEndUser(_0x127ebf,_0x3b5c91,_0x1b1fd4,_0xb8e33a,_0x363d26,_0xe9db61);}else{return{};}});break;case _0xa94c('0x58'):_0x97047d[_0xa94c('0x53')]=_0xa94c('0x45')+_0x3b5c91+_0xa94c('0x59')+_0xb8e33a+'))';return getZohoUser(_0x97047d,_0xa94c('0x5a'))[_0xa94c('0x2a')](function(_0x20b522){if(_0x20b522)return _0x20b522;if(_0xe9db61[_0xa94c('0x48')]!=_0xa94c('0x56')){return createEndUser(_0x127ebf,_0x3b5c91,_0x1b1fd4,_0xb8e33a,_0x363d26,_0xe9db61);}else{return{};}});break;}}function getCall(_0x22378d,_0x1af1f9,_0x40cf97,_0xb05071,_0x44a2dd,_0x59d145,_0x3b6ca4,_0x4b2ac9){logger[_0xa94c('0x31')]('Creating\x20new\x20call...');var _0xa16dba={};_0xa16dba[_0xa94c('0x5b')]={'name':!_[_0xa94c('0x1e')](_0xb05071['role'][_0xa94c('0x1a')])&&!_[_0xa94c('0x1e')](_0xb05071['profile']['name'])&&_0xb05071[_0xa94c('0x3c')][_0xa94c('0x1a')]===_0xa94c('0x5c')?_0xb05071[_0xa94c('0x49')][_0xa94c('0x1a')]:!_[_0xa94c('0x1e')](_0xb05071[_0xa94c('0x4a')])?_0xb05071['first_name']+'\x20'+_0xb05071['last_name']:_0xb05071[_0xa94c('0x4b')],'id':_0xb05071['id']};_0xa16dba[_0xa94c('0x5d')]=intUtil[_0xa94c('0x5e')](_0x59d145[_0xa94c('0x5f')],_0x3b6ca4,'\x20');_0xa16dba[_0xa94c('0x60')]=intUtil[_0xa94c('0x5e')](_0x59d145[_0xa94c('0x61')],_0x3b6ca4,'\x0a');if(_0x44a2dd[_0xa94c('0x43')]===_0xa94c('0x55')){_0xa16dba[_0xa94c('0x62')]={'name':!_[_0xa94c('0x1e')](_0x44a2dd[_0xa94c('0x63')])?_0x44a2dd[_0xa94c('0x63')]:!_[_0xa94c('0x1e')](_0x44a2dd[_0xa94c('0x64')])?_0x44a2dd[_0xa94c('0x64')]+'\x20'+_0x44a2dd[_0xa94c('0x65')]:_0x44a2dd[_0xa94c('0x65')],'id':_0x44a2dd['id']};}if(_0x44a2dd[_0xa94c('0x43')]==='Leads'){_0xa16dba[_0xa94c('0x66')]={'name':!_['isNil'](_0x44a2dd[_0xa94c('0x63')])?_0x44a2dd['Full_Name']:!_[_0xa94c('0x1e')](_0x44a2dd[_0xa94c('0x64')])?_0x44a2dd[_0xa94c('0x64')]+'\x20'+_0x44a2dd[_0xa94c('0x65')]:_0x44a2dd[_0xa94c('0x65')],'id':_0x44a2dd['id']};_0xa16dba[_0xa94c('0x67')]=_[_0xa94c('0x47')](_0x44a2dd[_0xa94c('0x43')]);}if(_0x3b6ca4['talktime']){_0xa16dba[_0xa94c('0x68')]=moment[_0xa94c('0x69')](parseInt(_0x3b6ca4[_0xa94c('0x6a')])*0x3e8)['format'](_0xa94c('0x6b'));}else if(_0x3b6ca4[_0xa94c('0x6c')]&&_0x3b6ca4[_0xa94c('0x6d')]){_0xa16dba[_0xa94c('0x68')]=moment[_0xa94c('0x69')](moment(_0x3b6ca4[_0xa94c('0x6d')],_0xa94c('0x6e'))[_0xa94c('0x6f')](moment(_0x3b6ca4[_0xa94c('0x70')],_0xa94c('0x6e'))))['format'](_0xa94c('0x6b'));}switch(_0x3b6ca4[_0xa94c('0x71')]){case _0xa94c('0x72'):_0xa16dba[_0xa94c('0x73')]=_0xa94c('0x74');break;case _0xa94c('0x75'):case _0xa94c('0x76'):_0xa16dba[_0xa94c('0x73')]=_0xa94c('0x77');break;case _0xa94c('0x78'):_0xa16dba['Call_Result']=_0xa94c('0x79');break;case'abandoned':_0xa16dba[_0xa94c('0x73')]=_0xa94c('0x7a');break;case _0xa94c('0x7b'):_0xa16dba[_0xa94c('0x73')]=_0xa94c('0x7c');default:}_0xa16dba[_0xa94c('0x7d')]=(_0x4b2ac9===_0xa94c('0x7e')?moment(_0x3b6ca4[_0xa94c('0x70')])[_0xa94c('0x34')](_0xa94c('0x6e')):moment(_0x3b6ca4[_0xa94c('0x7f')])[_0xa94c('0x34')](_0xa94c('0x6e')))||moment()[_0xa94c('0x34')](_0xa94c('0x6e'));_0xa16dba[_0xa94c('0x80')]=_0x4b2ac9||_0xa94c('0x81');_0xa16dba=_[_0xa94c('0x82')](_0xa16dba,getCustomFields(_0x59d145['Fields'],_0x3b6ca4));return request({'method':_0xa94c('0x44'),'uri':_0xa94c('0x45')+_0x1af1f9+_0xa94c('0x83'),'headers':{'Authorization':_0xa94c('0x4c')+_0x22378d},'body':{'data':[_0xa16dba]},'json':!![]})[_0xa94c('0x2a')](function(_0x362415){if(_0x362415&&_0x362415[_0xa94c('0x42')][0x0]['code']==='SUCCESS'){logger[_0xa94c('0x31')](_0xa94c('0x84'));return{'id':_0x362415[_0xa94c('0x42')][0x0][_0xa94c('0x4e')]['id']};}})[_0xa94c('0x2d')](function(_0x107338){logger[_0xa94c('0x31')](_0xa94c('0x85'),_0x107338[_0xa94c('0x30')]);console['log']('err',_0x107338);});}exports['queue']=function(_0xb47e5f,_0x58a631,_0x44a8f9,_0x3acfdc,_0x1c3c2d,_0x42c243){var _0x190e1d,_0x5bc199,_0x1d38a9;_0x42c243[_0xa94c('0x86')]=intUtil[_0xa94c('0x87')](_0x42c243[_0xa94c('0x86')]);_0x42c243[_0xa94c('0x88')]=intUtil[_0xa94c('0x87')](_0x42c243[_0xa94c('0x88')]);if(_0x1c3c2d&&_0x1c3c2d[_0xa94c('0x89')]){logger[_0xa94c('0x31')](_0xa94c('0x8a'),'Recording\x20is\x20enabled!');_0x58a631[_0xa94c('0x8b')]=_0x42c243[_0xa94c('0x88')]+_0xa94c('0x8c')+_0x58a631[_0xa94c('0x8d')]+'/downloads?type=uniqueid&token='+md5(_0x58a631[_0xa94c('0x8d')]);}else{_0x58a631[_0xa94c('0x8b')]='';}var _0x7a5ad0=_0x42c243[_0xa94c('0x86')]===_0xa94c('0x8e')?'eu':_0xa94c('0x8f');return getAccessToken(_0x42c243)[_0xa94c('0x2a')](function(_0x461e36){_0x1d38a9=_0x461e36;return getUser(_0x1d38a9,_0x7a5ad0,_0x42c243,_0x3acfdc['email']);})['then'](function(_0x1e4f22){_0x190e1d=_0x1e4f22;logger[_0xa94c('0x31')](_0xa94c('0x90'),_0x190e1d['id']);return getEndUser(_0x1d38a9,_0x7a5ad0,_0x42c243,_0x58a631[_0xa94c('0x91')],_0x58a631[_0xa94c('0x92')],_0x190e1d,_0x44a8f9);})[_0xa94c('0x2a')](function(_0x5c18ca){_0x5bc199=_0x5c18ca;return getCall(_0x1d38a9,_0x7a5ad0,_0x42c243,_0x190e1d,_0x5bc199,_0x44a8f9,_0x58a631,_0xa94c('0x81'));})[_0xa94c('0x2a')](function(_0xd9c004){if(_0xd9c004){logger[_0xa94c('0x31')](_0xa94c('0x93'),_0xd9c004['id']);logger[_0xa94c('0x31')](_0xa94c('0x8a'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa94c('0x34')](_0xa94c('0x94'),_0x3acfdc['name']),_0xa94c('0x95'),{'uri':_0xa94c('0x96')+_0x42c243['host']+_0xa94c('0x97')+_0xd9c004['id']});}})[_0xa94c('0x2d')](function(_0x257877){logger['error'](_0xa94c('0x8a'),JSON[_0xa94c('0x40')](_0x257877));});};exports[_0xa94c('0x7e')]=function(_0x2300d6,_0x136991,_0x178c8d,_0x4c82e1,_0x2ba9f7,_0x493228,_0x5c6779){var _0xc628b4,_0x1faad7,_0x3153e7;_0x493228[_0xa94c('0x86')]=intUtil[_0xa94c('0x87')](_0x493228[_0xa94c('0x86')]);_0x493228[_0xa94c('0x88')]=intUtil[_0xa94c('0x87')](_0x493228[_0xa94c('0x88')]);if(_0x5c6779&&_0x5c6779['recordingFormat']&&_0x5c6779['recordingFormat']!=='none'){logger[_0xa94c('0x31')]('[OUTBOUND]',_0xa94c('0x98'));_0x136991[_0xa94c('0x8b')]=_0x493228[_0xa94c('0x88')]+'/api/voice/recordings/'+_0x136991[_0xa94c('0x8d')]+_0xa94c('0x99')+md5(_0x136991[_0xa94c('0x8d')]);}var _0x3cfa13=_0x493228[_0xa94c('0x86')]===_0xa94c('0x8e')?'eu':_0xa94c('0x8f');return getAccessToken(_0x493228)[_0xa94c('0x2a')](function(_0x551cdf){_0x3153e7=_0x551cdf;return getUser(_0x3153e7,_0x3cfa13,_0x493228,_0x4c82e1[_0xa94c('0x38')]);})[_0xa94c('0x2a')](function(_0x13dcd3){_0xc628b4=_0x13dcd3;logger['info'](_0xa94c('0x90'),_0xc628b4['id']);return getEndUser(_0x3153e7,_0x3cfa13,_0x493228,_0x136991[_0xa94c('0x9a')],_0x136991[_0xa94c('0x9b')],_0xc628b4,_0x178c8d);})[_0xa94c('0x2a')](function(_0x5ac905){_0x1faad7=_0x5ac905;return getCall(_0x3153e7,_0x3cfa13,_0x493228,_0xc628b4,_0x1faad7,_0x178c8d,_0x136991,_0xa94c('0x9c'));})[_0xa94c('0x2a')](function(_0x1e8ed8){if(_0x1e8ed8){logger[_0xa94c('0x31')](_0xa94c('0x93'),_0x1e8ed8['id']);logger[_0xa94c('0x31')](_0xa94c('0x9d'),_0xa94c('0x9e'));emit(util['format'](_0xa94c('0x94'),_0x4c82e1['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x493228[_0xa94c('0x86')]+_0xa94c('0x97')+_0x1e8ed8['id']});}})[_0xa94c('0x2d')](function(_0x5bf94c){logger[_0xa94c('0x2e')](_0xa94c('0x9d'),JSON[_0xa94c('0x40')](_0x5bf94c));});};exports[_0xa94c('0x9f')]=function(_0x1ae7a4,_0x4bdc0d,_0x40b714,_0x54632e,_0x5bae60,_0x462a6d){var _0x356801,_0x3514b7,_0x572579;_0x462a6d[_0xa94c('0x86')]=intUtil[_0xa94c('0x87')](_0x462a6d[_0xa94c('0x86')]);_0x462a6d[_0xa94c('0x88')]=intUtil[_0xa94c('0x87')](_0x462a6d[_0xa94c('0x88')]);if(_0x5bae60&&_0x5bae60[_0xa94c('0x89')]){logger[_0xa94c('0x31')]('['+_0x4bdc0d[_0xa94c('0x71')][_0xa94c('0xa0')]()+']',_0xa94c('0x98'));_0x4bdc0d[_0xa94c('0x8b')]=_0x462a6d[_0xa94c('0x88')]+_0xa94c('0x8c')+_0x4bdc0d[_0xa94c('0x8d')]+_0xa94c('0x99')+md5(_0x4bdc0d[_0xa94c('0x8d')]);}else{_0x4bdc0d[_0xa94c('0x8b')]='';}var _0x1b36c0=_0x462a6d[_0xa94c('0x86')]===_0xa94c('0x8e')?'eu':_0xa94c('0x8f');return getAccessToken(_0x462a6d)[_0xa94c('0x2a')](function(_0x5d394a){_0x572579=_0x5d394a;return getUser(_0x572579,_0x1b36c0,_0x462a6d);})['then'](function(_0x31ca30){_0x356801=_0x31ca30;logger[_0xa94c('0x31')](_0xa94c('0x90'),_0x356801['id']);return getEndUser(_0x572579,_0x1b36c0,_0x462a6d,_0x4bdc0d[_0xa94c('0x91')],_0x4bdc0d[_0xa94c('0x92')],_0x356801,_0x40b714);})[_0xa94c('0x2a')](function(_0x58b41c){_0x3514b7=_0x58b41c;return getCall(_0x572579,_0x1b36c0,_0x462a6d,_0x356801,_0x3514b7,_0x40b714,_0x4bdc0d,_0xa94c('0x81'));})['then'](function(_0x57848b){if(_0x57848b){logger[_0xa94c('0x31')](_0xa94c('0x93'),_0x57848b['id']);}})['catch'](function(_0x308207){logger[_0xa94c('0x2e')]('['+_0x4bdc0d[_0xa94c('0x71')][_0xa94c('0xa0')]()+']',JSON[_0xa94c('0x40')](_0x308207));});}; \ No newline at end of file +var _0x1f15=['moduleCreate','contact','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','enduserType','What_Id','$se_module','talktime','utc','mm:ss','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Call\x20created!','details','err','log','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','host','zoho.eu','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=','recordingFormat','none','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','lastevent','toUpperCase','com','lodash','request-promise','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','toString','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','data','code','SUCCESS','Error:\x20','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads'];(function(_0x43699c,_0x560ce5){var _0x1805dc=function(_0x8bf42b){while(--_0x8bf42b){_0x43699c['push'](_0x43699c['shift']());}};_0x1805dc(++_0x560ce5);}(_0x1f15,0xe6));var _0x51f1=function(_0x103568,_0x5b08f8){_0x103568=_0x103568-0x0;var _0x218ff5=_0x1f15[_0x103568];return _0x218ff5;};'use strict';var _=require(_0x51f1('0x0'));var rp=require(_0x51f1('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x51f1('0x2'));var moment=require('moment');var Redis=require(_0x51f1('0x3'));var BPromise=require(_0x51f1('0x4'));var config=require(_0x51f1('0x5'));var logger=require(_0x51f1('0x6'))(_0x51f1('0x7'));config['redis']=_[_0x51f1('0x8')](config[_0x51f1('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x51f1('0xa'))(new Redis(config['redis']));function emit(_0x7ea2e5,_0x45b0af,_0x144cc1){io['to'](_0x7ea2e5)[_0x51f1('0xb')](_0x45b0af,_0x144cc1);}function request(_0x17c68b){logger['debug'](_0x51f1('0xc'),JSON[_0x51f1('0xd')](_0x17c68b));return rp(_0x17c68b);}function getCustomFields(_0xace465,_0x586f43){var _0x48a41b={};if(_0xace465[_0x51f1('0xe')]>0x0){_[_0x51f1('0xf')](_0xace465,function(_0x447337){if(_[_0x51f1('0x10')]([_0x51f1('0x11'),'picklist'],_0x447337[_0x51f1('0x12')])&&_0x447337[_0x51f1('0x13')]){_0x48a41b[_0x447337[_0x51f1('0x13')]]=_0x447337[_0x51f1('0x14')][_0x51f1('0x15')]();}else if(_0x447337[_0x51f1('0x12')]==='variable'&&_0x447337[_0x51f1('0x16')]&&_0x447337[_0x51f1('0x13')]&&_0x586f43[_0x447337['variableName']]){_0x48a41b[_0x447337[_0x51f1('0x13')]]=_0x586f43[_0x447337[_0x51f1('0x16')]][_0x51f1('0x15')]();}else if(_0x447337['type']==='customVariable'&&_0x447337[_0x51f1('0x17')]&&_0x447337['Variable']['name']&&_0x447337['idField']&&_0x586f43[_0x447337['Variable'][_0x51f1('0x18')][_0x51f1('0x19')]()]){_0x48a41b[_0x447337['idField']]=_0x586f43[_0x447337[_0x51f1('0x17')][_0x51f1('0x18')][_0x51f1('0x19')]()][_0x51f1('0x15')]();}});}return _0x48a41b;}function getName(_0x502fd3){if(_0x502fd3[_0x51f1('0x1a')]('\x20')>0x0){var _0x16468d=_0x502fd3[_0x51f1('0x1b')](/ (.+)/);if(_0x16468d[0x1]){return _0x16468d;}}return[_0x502fd3,_0x502fd3];}var accountsTokens={};function getAccessToken(_0x3a9048){return new Promise(function(_0x54fc24,_0x53bea0){if(!_['isNil'](accountsTokens[_0x3a9048['id']])&&!_[_0x51f1('0x1c')](accountsTokens[_0x3a9048['id']][_0x51f1('0x1d')])){if(moment()[_0x51f1('0x1e')](accountsTokens[_0x3a9048['id']][_0x51f1('0x1f')])){_0x54fc24(accountsTokens[_0x3a9048['id']][_0x51f1('0x1d')]);}}var _0x52da44;switch(_0x3a9048[_0x51f1('0x20')]){case'US':_0x52da44='https://accounts.zoho.com';break;case'AU':_0x52da44=_0x51f1('0x21');break;case'EU':_0x52da44=_0x51f1('0x22');break;case'IN':_0x52da44=_0x51f1('0x23');break;case'CN':_0x52da44=_0x51f1('0x24');break;default:_0x52da44=_0x51f1('0x22');break;}var _0x24ad55={'method':_0x51f1('0x25'),'uri':_0x52da44+_0x51f1('0x26'),'qs':{'refresh_token':_0x3a9048[_0x51f1('0x27')],'client_id':_0x3a9048[_0x51f1('0x28')],'client_secret':_0x3a9048['clientSecret'],'grant_type':_0x51f1('0x29')},'json':!![]};return rp(_0x24ad55)[_0x51f1('0x2a')](function(_0x41b9e0){accountsTokens[_0x3a9048['id']]={'access_token':_0x41b9e0['access_token'],'expires_in':moment()[_0x51f1('0x2b')](_0x41b9e0[_0x51f1('0x1f')],_0x51f1('0x2c'))};_0x54fc24(_0x41b9e0[_0x51f1('0x1d')]);})[_0x51f1('0x2d')](function(_0x3443b1){logger[_0x51f1('0x2e')](_0x51f1('0x2f'),_0x3443b1[_0x51f1('0x30')]);_0x53bea0(_0x3443b1);});});}function getUser(_0x3b5f14,_0xf25f64,_0x326d4f,_0x908be9){logger[_0x51f1('0x31')]('Search\x20user');return request({'method':_0x51f1('0x32'),'uri':util[_0x51f1('0x33')](_0x51f1('0x34'),_0xf25f64),'qs':{'type':_0x51f1('0x35')},'headers':{'Authorization':_0x51f1('0x36')+_0x3b5f14},'json':!![]})['then'](function(_0x2639e7){if(_0x2639e7['users']){var _0x45a1ba=-0x1;if(_[_0x51f1('0x37')](_0x2639e7[_0x51f1('0x38')])){if(!_[_0x51f1('0x1c')](_0x908be9)){_0x45a1ba=_[_0x51f1('0x39')](_0x2639e7[_0x51f1('0x38')],function(_0x5ade38){return _0x5ade38[_0x51f1('0x3a')]===_0x908be9;});}if(_0x45a1ba>=0x0){logger[_0x51f1('0x31')]('Agent\x20found!');}else{logger[_0x51f1('0x31')](_0x51f1('0x3b'));_0x45a1ba=_[_0x51f1('0x39')](_0x2639e7[_0x51f1('0x38')],function(_0x5a3ebc){return _0x5a3ebc[_0x51f1('0x3c')][_0x51f1('0x18')]===_0x51f1('0x3d');});}return _0x2639e7[_0x51f1('0x38')][_0x45a1ba];}else{if(_0x2639e7[_0x51f1('0x3e')][_0x51f1('0x3c')][_0x51f1('0x18')]===_0x51f1('0x3d')){logger[_0x51f1('0x31')](_0x51f1('0x3b'));user=_0x2639e7[_0x51f1('0x3e')];return user;}else{logger['error'](_0x51f1('0x3f'),JSON[_0x51f1('0xd')](_0x2639e7));throw new Error(_0x51f1('0x40')+JSON[_0x51f1('0xd')](_0x2639e7));}}}else{logger[_0x51f1('0x2e')](_0x51f1('0x3f'),JSON['stringify'](_0x2639e7));throw new Error(_0x51f1('0x40')+JSON[_0x51f1('0xd')](_0x2639e7));}})['catch'](function(_0x816cba){console['error'](_0x816cba);});}function getZohoUser(_0x37bf79,_0x57f5ce){return new BPromise(function(_0x4a399c,_0x13e581){request(_0x37bf79)['then'](function(_0xd29c2f){var _0x431bdb=null;if(_0xd29c2f){_0x431bdb=_0xd29c2f['data'][0x0];_0x431bdb['enduserType']=_0x57f5ce;}_0x4a399c(_0x431bdb);})[_0x51f1('0x2d')](function(_0x3ea825){_0x13e581(_0x3ea825);});});}function createEndUser(_0x322f7d,_0x4c6116,_0x81018c,_0x44dae5,_0x100014,_0x4aebcd){var _0x81018c=getName(_0x81018c);return request({'method':_0x51f1('0x25'),'uri':_0x51f1('0x41')+_0x4c6116+_0x51f1('0x42')+_[_0x51f1('0x43')](_0x4aebcd['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x81018c[0x1],'First_Name':_0x81018c[0x0],'Phone':_0x44dae5,'Owner':{'name':!_[_0x51f1('0x1c')](_0x100014[_0x51f1('0x44')]['name'])?_0x100014[_0x51f1('0x44')][_0x51f1('0x18')]:!_[_0x51f1('0x1c')](_0x100014[_0x51f1('0x45')])?_0x100014[_0x51f1('0x45')]+'\x20'+_0x100014[_0x51f1('0x46')]:_0x100014[_0x51f1('0x46')],'id':_0x100014['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x322f7d},'json':!![]})[_0x51f1('0x2a')](function(_0x54aa2f){if(_0x54aa2f&&_0x54aa2f[_0x51f1('0x47')][0x0][_0x51f1('0x48')]===_0x51f1('0x49')){var _0x24820b=_0x54aa2f[_0x51f1('0x47')][0x0]['details'];_0x24820b['enduserType']=_[_0x51f1('0x43')](_0x4aebcd['moduleCreate'])+'s';return _0x24820b;}logger[_0x51f1('0x2e')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x51f1('0x4a')+JSON[_0x51f1('0xd')](data));})[_0x51f1('0x2d')](function(_0x54ea5e){console['log']('CREATE\x20ERROR',_0x54ea5e);});}function getEndUser(_0x104c08,_0x1b88c3,_0x54b0f4,_0x16036a,_0x482a3f,_0x322a33,_0x36d3c6){var _0x2615d4={'method':'GET','uri':'','headers':{'Authorization':_0x51f1('0x36')+_0x104c08},'json':!![]};switch(_0x36d3c6['moduleSearch']){case _0x51f1('0x4b'):_0x2615d4['uri']=_0x51f1('0x41')+_0x1b88c3+_0x51f1('0x4c')+_0x482a3f+'))';return getZohoUser(_0x2615d4,_0x51f1('0x4d'))[_0x51f1('0x2a')](function(_0x46a4cb){if(_0x46a4cb)return _0x46a4cb;_0x2615d4[_0x51f1('0x4e')]=_0x51f1('0x41')+_0x1b88c3+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x482a3f+'))';return getZohoUser(_0x2615d4,_0x51f1('0x4f'))[_0x51f1('0x2a')](function(_0x515a82){if(_0x515a82)return _0x515a82;if(_0x36d3c6[_0x51f1('0x50')]!='nothing'){return createEndUser(_0x104c08,_0x1b88c3,_0x16036a,_0x482a3f,_0x322a33,_0x36d3c6);}else{return{};}});});break;case _0x51f1('0x51'):_0x2615d4[_0x51f1('0x4e')]=_0x51f1('0x41')+_0x1b88c3+_0x51f1('0x4c')+_0x482a3f+'))';return getZohoUser(_0x2615d4,_0x51f1('0x4d'))[_0x51f1('0x2a')](function(_0x20069f){if(_0x20069f)return _0x20069f;if(_0x36d3c6[_0x51f1('0x50')]!=_0x51f1('0x52')){return createEndUser(_0x104c08,_0x1b88c3,_0x16036a,_0x482a3f,_0x322a33,_0x36d3c6);}else{return{};}});break;case _0x51f1('0x53'):_0x2615d4[_0x51f1('0x4e')]=_0x51f1('0x41')+_0x1b88c3+_0x51f1('0x54')+_0x482a3f+'))';return getZohoUser(_0x2615d4,_0x51f1('0x4f'))[_0x51f1('0x2a')](function(_0x5d7bb5){if(_0x5d7bb5)return _0x5d7bb5;if(_0x36d3c6[_0x51f1('0x50')]!='nothing'){return createEndUser(_0x104c08,_0x1b88c3,_0x16036a,_0x482a3f,_0x322a33,_0x36d3c6);}else{return{};}});break;}}function getCall(_0x37896d,_0x30be93,_0x58b1b5,_0x559b63,_0x317520,_0xce862c,_0x3e0d99,_0x47ca07){logger[_0x51f1('0x31')](_0x51f1('0x55'));var _0x1e33c5={};_0x1e33c5[_0x51f1('0x56')]={'name':!_['isNil'](_0x559b63[_0x51f1('0x44')]['name'])&&!_[_0x51f1('0x1c')](_0x559b63[_0x51f1('0x3c')][_0x51f1('0x18')])&&_0x559b63[_0x51f1('0x3c')][_0x51f1('0x18')]===_0x51f1('0x57')?_0x559b63[_0x51f1('0x44')]['name']:!_[_0x51f1('0x1c')](_0x559b63[_0x51f1('0x45')])?_0x559b63[_0x51f1('0x45')]+'\x20'+_0x559b63[_0x51f1('0x46')]:_0x559b63['last_name'],'id':_0x559b63['id']};_0x1e33c5[_0x51f1('0x58')]=intUtil[_0x51f1('0x59')](_0xce862c[_0x51f1('0x5a')],_0x3e0d99,'\x20');_0x1e33c5['Description']=intUtil[_0x51f1('0x59')](_0xce862c[_0x51f1('0x5b')],_0x3e0d99,'\x0a');if(_0x317520['enduserType']===_0x51f1('0x4d')){_0x1e33c5[_0x51f1('0x5c')]={'name':!_[_0x51f1('0x1c')](_0x317520[_0x51f1('0x5d')])?_0x317520['Full_Name']:!_[_0x51f1('0x1c')](_0x317520[_0x51f1('0x5e')])?_0x317520['First_Name']+'\x20'+_0x317520[_0x51f1('0x5f')]:_0x317520[_0x51f1('0x5f')],'id':_0x317520['id']};}if(_0x317520[_0x51f1('0x60')]===_0x51f1('0x4f')){_0x1e33c5[_0x51f1('0x61')]={'name':!_[_0x51f1('0x1c')](_0x317520['Full_Name'])?_0x317520['Full_Name']:!_['isNil'](_0x317520[_0x51f1('0x5e')])?_0x317520[_0x51f1('0x5e')]+'\x20'+_0x317520[_0x51f1('0x5f')]:_0x317520['Last_Name'],'id':_0x317520['id']};_0x1e33c5[_0x51f1('0x62')]=_[_0x51f1('0x43')](_0x317520[_0x51f1('0x60')]);}if(_0x3e0d99[_0x51f1('0x63')]){_0x1e33c5['Call_Duration']=moment[_0x51f1('0x64')](parseInt(_0x3e0d99[_0x51f1('0x63')])*0x3e8)[_0x51f1('0x33')](_0x51f1('0x65'));}else if(_0x3e0d99['answertime']&&_0x3e0d99['endtime']){_0x1e33c5[_0x51f1('0x66')]=moment[_0x51f1('0x64')](moment(_0x3e0d99[_0x51f1('0x67')],_0x51f1('0x68'))[_0x51f1('0x69')](moment(_0x3e0d99[_0x51f1('0x6a')],_0x51f1('0x68'))))[_0x51f1('0x33')](_0x51f1('0x65'));}switch(_0x3e0d99['lastevent']){case _0x51f1('0x6b'):_0x1e33c5[_0x51f1('0x6c')]=_0x51f1('0x6d');break;case _0x51f1('0x6e'):case _0x51f1('0x6f'):_0x1e33c5['Call_Result']='Answered';break;case _0x51f1('0x70'):_0x1e33c5[_0x51f1('0x6c')]=_0x51f1('0x71');break;case _0x51f1('0x72'):_0x1e33c5[_0x51f1('0x6c')]=_0x51f1('0x73');break;case _0x51f1('0x74'):_0x1e33c5[_0x51f1('0x6c')]='Timeout';default:}_0x1e33c5[_0x51f1('0x75')]=(_0x47ca07===_0x51f1('0x76')?moment(_0x3e0d99[_0x51f1('0x6a')])[_0x51f1('0x33')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3e0d99[_0x51f1('0x77')])[_0x51f1('0x33')](_0x51f1('0x68')))||moment()[_0x51f1('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x1e33c5[_0x51f1('0x78')]=_0x47ca07||_0x51f1('0x79');_0x1e33c5=_['merge'](_0x1e33c5,getCustomFields(_0xce862c['Fields'],_0x3e0d99));return request({'method':_0x51f1('0x25'),'uri':_0x51f1('0x41')+_0x30be93+'/crm/v2/Calls','headers':{'Authorization':_0x51f1('0x36')+_0x37896d},'body':{'data':[_0x1e33c5]},'json':!![]})[_0x51f1('0x2a')](function(_0x584924){if(_0x584924&&_0x584924[_0x51f1('0x47')][0x0][_0x51f1('0x48')]===_0x51f1('0x49')){logger[_0x51f1('0x31')](_0x51f1('0x7a'));return{'id':_0x584924[_0x51f1('0x47')][0x0][_0x51f1('0x7b')]['id']};}})[_0x51f1('0x2d')](function(_0x46ec2f){logger['info'](_0x51f1('0x7c'),_0x46ec2f[_0x51f1('0x30')]);console[_0x51f1('0x7d')](_0x51f1('0x7c'),_0x46ec2f);});}exports['queue']=function(_0x33ba02,_0x416648,_0x38f09c,_0x2fb233,_0x281e00,_0x117dde){var _0x57286b,_0x25ccd5,_0x14077a;_0x117dde['host']=intUtil[_0x51f1('0x7e')](_0x117dde['host']);_0x117dde[_0x51f1('0x7f')]=intUtil[_0x51f1('0x7e')](_0x117dde[_0x51f1('0x7f')]);if(_0x281e00&&_0x281e00[_0x51f1('0x80')]){logger[_0x51f1('0x31')](_0x51f1('0x81'),_0x51f1('0x82'));_0x416648[_0x51f1('0x83')]=_0x117dde['serverUrl']+_0x51f1('0x84')+_0x416648['uniqueid']+_0x51f1('0x85')+md5(_0x416648[_0x51f1('0x86')]);}else{_0x416648[_0x51f1('0x83')]='';}var _0x1b7b78=_0x117dde[_0x51f1('0x87')]===_0x51f1('0x88')?'eu':'com';return getAccessToken(_0x117dde)[_0x51f1('0x2a')](function(_0x247364){_0x14077a=_0x247364;return getUser(_0x14077a,_0x1b7b78,_0x117dde,_0x2fb233[_0x51f1('0x3a')]);})['then'](function(_0x5a57e7){_0x57286b=_0x5a57e7;logger[_0x51f1('0x31')](_0x51f1('0x89'),_0x57286b['id']);return getEndUser(_0x14077a,_0x1b7b78,_0x117dde,_0x416648[_0x51f1('0x8a')],_0x416648[_0x51f1('0x8b')],_0x57286b,_0x38f09c);})[_0x51f1('0x2a')](function(_0x33430f){_0x25ccd5=_0x33430f;return getCall(_0x14077a,_0x1b7b78,_0x117dde,_0x57286b,_0x25ccd5,_0x38f09c,_0x416648,_0x51f1('0x79'));})[_0x51f1('0x2a')](function(_0x2dbd9c){if(_0x2dbd9c){logger[_0x51f1('0x31')](_0x51f1('0x8c'),_0x2dbd9c['id']);logger[_0x51f1('0x31')](_0x51f1('0x81'),_0x51f1('0x8d'));emit(util['format'](_0x51f1('0x8e'),_0x2fb233[_0x51f1('0x18')]),_0x51f1('0x8f'),{'uri':_0x51f1('0x90')+_0x117dde['host']+_0x51f1('0x91')+_0x2dbd9c['id']});}})[_0x51f1('0x2d')](function(_0xa5ca55){logger[_0x51f1('0x2e')](_0x51f1('0x81'),JSON[_0x51f1('0xd')](_0xa5ca55));});};exports[_0x51f1('0x76')]=function(_0x5f53c9,_0x46ef05,_0x1fb71e,_0x4defc8,_0x532880,_0x50d60d,_0x286ae7){var _0x10c149,_0x6c9d3a,_0x1d19bd;_0x50d60d[_0x51f1('0x87')]=intUtil[_0x51f1('0x7e')](_0x50d60d[_0x51f1('0x87')]);_0x50d60d[_0x51f1('0x7f')]=intUtil['stripTrailingSlash'](_0x50d60d[_0x51f1('0x7f')]);if(_0x286ae7&&_0x286ae7[_0x51f1('0x92')]&&_0x286ae7['recordingFormat']!==_0x51f1('0x93')){logger['info']('[OUTBOUND]',_0x51f1('0x82'));_0x46ef05[_0x51f1('0x83')]=_0x50d60d[_0x51f1('0x7f')]+'/api/voice/recordings/'+_0x46ef05[_0x51f1('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x46ef05[_0x51f1('0x86')]);}var _0x3b7a8d=_0x50d60d['host']===_0x51f1('0x88')?'eu':'com';return getAccessToken(_0x50d60d)[_0x51f1('0x2a')](function(_0x503150){_0x1d19bd=_0x503150;return getUser(_0x1d19bd,_0x3b7a8d,_0x50d60d,_0x4defc8[_0x51f1('0x3a')]);})[_0x51f1('0x2a')](function(_0x5e3c19){_0x10c149=_0x5e3c19;logger[_0x51f1('0x31')]('The\x20User\x20ID\x20is:',_0x10c149['id']);return getEndUser(_0x1d19bd,_0x3b7a8d,_0x50d60d,_0x46ef05['destcalleridname'],_0x46ef05[_0x51f1('0x94')],_0x10c149,_0x1fb71e);})[_0x51f1('0x2a')](function(_0x472851){_0x6c9d3a=_0x472851;return getCall(_0x1d19bd,_0x3b7a8d,_0x50d60d,_0x10c149,_0x6c9d3a,_0x1fb71e,_0x46ef05,_0x51f1('0x95'));})[_0x51f1('0x2a')](function(_0x31b417){if(_0x31b417){logger[_0x51f1('0x31')]('The\x20Call\x20ID\x20is:',_0x31b417['id']);logger[_0x51f1('0x31')](_0x51f1('0x96'),_0x51f1('0x8d'));emit(util['format'](_0x51f1('0x8e'),_0x4defc8[_0x51f1('0x18')]),'trigger:browser:url',{'uri':_0x51f1('0x90')+_0x50d60d[_0x51f1('0x87')]+'/crm/EntityInfo.do?module=Calls&id='+_0x31b417['id']});}})['catch'](function(_0x414983){logger[_0x51f1('0x2e')]('[OUTBOUND]',JSON[_0x51f1('0xd')](_0x414983));});};exports[_0x51f1('0x97')]=function(_0x5660c2,_0x34ffdc,_0x11be06,_0x42b88d,_0x5ed995,_0x948065){var _0x2f9f4f,_0x565126,_0x384fca;_0x948065[_0x51f1('0x87')]=intUtil[_0x51f1('0x7e')](_0x948065['host']);_0x948065[_0x51f1('0x7f')]=intUtil[_0x51f1('0x7e')](_0x948065['serverUrl']);if(_0x5ed995&&_0x5ed995['monitor_format']){logger[_0x51f1('0x31')]('['+_0x34ffdc[_0x51f1('0x98')][_0x51f1('0x99')]()+']','Recording\x20is\x20enabled!');_0x34ffdc[_0x51f1('0x83')]=_0x948065[_0x51f1('0x7f')]+_0x51f1('0x84')+_0x34ffdc['uniqueid']+_0x51f1('0x85')+md5(_0x34ffdc['uniqueid']);}else{_0x34ffdc['recordingURL']='';}var _0x32443b=_0x948065['host']===_0x51f1('0x88')?'eu':_0x51f1('0x9a');return getAccessToken(_0x948065)[_0x51f1('0x2a')](function(_0x160b51){_0x384fca=_0x160b51;return getUser(_0x384fca,_0x32443b,_0x948065);})[_0x51f1('0x2a')](function(_0x564503){_0x2f9f4f=_0x564503;logger[_0x51f1('0x31')](_0x51f1('0x89'),_0x2f9f4f['id']);return getEndUser(_0x384fca,_0x32443b,_0x948065,_0x34ffdc['calleridname'],_0x34ffdc[_0x51f1('0x8b')],_0x2f9f4f,_0x11be06);})[_0x51f1('0x2a')](function(_0x2f0153){_0x565126=_0x2f0153;return getCall(_0x384fca,_0x32443b,_0x948065,_0x2f9f4f,_0x565126,_0x11be06,_0x34ffdc,_0x51f1('0x79'));})[_0x51f1('0x2a')](function(_0x2d7a0f){if(_0x2d7a0f){logger[_0x51f1('0x31')](_0x51f1('0x8c'),_0x2d7a0f['id']);}})[_0x51f1('0x2d')](function(_0x11ef54){logger[_0x51f1('0x2e')]('['+_0x34ffdc[_0x51f1('0x98')]['toUpperCase']()+']',JSON[_0x51f1('0xd')](_0x11ef54));});}; \ 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 bbcf055..806ad42 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 _0x32d9=['util','shelljs','trigger','exec','data2','Script','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x131435,_0x33131d){var _0x5a3081=function(_0x49466a){while(--_0x49466a){_0x131435['push'](_0x131435['shift']());}};_0x5a3081(++_0x33131d);}(_0x32d9,0x18c));var _0x932d=function(_0x526d8c,_0xd26737){_0x526d8c=_0x526d8c-0x0;var _0x4934d1=_0x32d9[_0x526d8c];return _0x4934d1;};'use strict';var util=require(_0x932d('0x0'));var sh=require(_0x932d('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x932d('0x2'));exports[_0x932d('0x3')]=function(_0x549ccb,_0x5e3fc8){var _0x59653a=_0x549ccb[_0x932d('0x4')]?_0x549ccb[_0x932d('0x4')]:_0x932d('0x5');var _0xd0373a=_0x549ccb[_0x932d('0x6')]?Mustache['render'](_0x549ccb[_0x932d('0x6')],_0x5e3fc8):_0x5e3fc8;sh[_0x932d('0x3')](_0xd0373a,function(_0x8e19ef,_0x3da8aa,_0x9c0963){if(_0x8e19ef!==0x0){logger['error'](util[_0x932d('0x7')](_0x932d('0x8'),_0x59653a,_0xd0373a,_0x8e19ef,_0x9c0963));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x59653a,_0xd0373a,_0x3da8aa));}});}; \ No newline at end of file +var _0x96a6=['shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','format','%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'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x96a6,0x1db));var _0x696a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x96a6[_0x31e29a];return _0x32d892;};'use strict';var util=require(_0x696a('0x0'));var sh=require(_0x696a('0x1'));var Mustache=require(_0x696a('0x2'));var logger=require(_0x696a('0x3'))(_0x696a('0x4'));exports['exec']=function(_0x1083a6,_0x39f666){var _0x172752=_0x1083a6['data2']?_0x1083a6[_0x696a('0x5')]:_0x696a('0x6');var _0x2886e3=_0x1083a6[_0x696a('0x7')]?Mustache[_0x696a('0x8')](_0x1083a6[_0x696a('0x7')],_0x39f666):_0x39f666;sh[_0x696a('0x9')](_0x2886e3,function(_0x3c85bd,_0x22b1ac,_0xdabf2f){if(_0x3c85bd!==0x0){logger['error'](util[_0x696a('0xa')](_0x696a('0xb'),_0x172752,_0x2886e3,_0x3c85bd,_0xdabf2f));}else{logger[_0x696a('0xc')](util['format'](_0x696a('0xd'),_0x172752,_0x2886e3,_0x22b1ac));}});}; \ 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 57e9955..53b0fc8 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 _0x3ab9=['format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','mustache','../../../../config/logger','trigger','exec','render','data5','headers','data6','error','stack','data1','GET','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then','isNil',',\x20request\x20body:\x20','object','stringify'];(function(_0x48a40e,_0x3e4b89){var _0x5c0cce=function(_0x39fe1f){while(--_0x39fe1f){_0x48a40e['push'](_0x48a40e['shift']());}};_0x5c0cce(++_0x3e4b89);}(_0x3ab9,0xa6));var _0x93ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab9[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x93ab('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x93ab('0x1'));var logger=require(_0x93ab('0x2'))(_0x93ab('0x3'));exports[_0x93ab('0x4')]=function(_0x196fb4,_0x5b1d75){var _0x34ae7c,_0x45fc55;var _0x26f220={'method':_0x196fb4['data1']['toUpperCase'](),'uri':Mustache[_0x93ab('0x5')](_0x196fb4['data2'],_0x5b1d75),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x196fb4[_0x93ab('0x6')])==='number'&&parseInt(_0x196fb4[_0x93ab('0x6')])>=0x1&&parseInt(_0x196fb4[_0x93ab('0x6')])<=0xa?parseInt(_0x196fb4['data5'])*0x3e8:0x5*0x3e8};try{_0x26f220[_0x93ab('0x7')]=_0x196fb4['data6']?JSON['parse'](Mustache[_0x93ab('0x5')](_0x196fb4[_0x93ab('0x8')],_0x5b1d75)):{};}catch(_0x5a437e){logger[_0x93ab('0x9')](_0x5a437e[_0x93ab('0xa')]);}switch(_0x196fb4[_0x93ab('0xb')]['toUpperCase']()){case _0x93ab('0xc'):case'DELETE':_0x34ae7c=null;_0x26f220['qs']=_0x5b1d75;break;case _0x93ab('0xd'):case'PUT':if(_0x196fb4[_0x93ab('0xe')]){try{_0x34ae7c=JSON[_0x93ab('0xf')](Mustache['render'](_0x196fb4[_0x93ab('0xe')],_0x5b1d75));_0x26f220[_0x93ab('0x10')]=_0x34ae7c;}catch(_0x551a3e){logger[_0x93ab('0x9')](_0x551a3e['stack']);logger[_0x93ab('0x9')](_0x93ab('0x11'));}}else{_0x34ae7c=_0x5b1d75;_0x26f220[_0x93ab('0x10')]=_0x34ae7c;}break;}logger[_0x93ab('0x12')](util['format'](_0x93ab('0x13'),_0x196fb4[_0x93ab('0xb')],_0x196fb4[_0x93ab('0x14')],JSON['stringify'](_0x26f220)));rp(_0x26f220)[_0x93ab('0x15')](function(_0x5c68a7){_0x34ae7c=!_[_0x93ab('0x16')](_0x34ae7c)?_0x93ab('0x17')+_0x34ae7c:'';_0x45fc55=typeof _0x5c68a7['body']===_0x93ab('0x18')?JSON[_0x93ab('0x19')](_0x5c68a7[_0x93ab('0x10')]):_0x5c68a7[_0x93ab('0x10')];logger['info'](util[_0x93ab('0x1a')](_0x93ab('0x1b'),_0x196fb4[_0x93ab('0xb')],_0x196fb4[_0x93ab('0x14')],_0x5c68a7[_0x93ab('0x1c')],_0x45fc55));})[_0x93ab('0x1d')](function(_0x3f77df){logger[_0x93ab('0x9')](util[_0x93ab('0x1a')](_0x93ab('0x1e'),_0x196fb4[_0x93ab('0xb')],_0x196fb4[_0x93ab('0x14')],_0x3f77df['statusCode'],_0x3f77df[_0x93ab('0x1f')],_0x3f77df['message']));});}; \ No newline at end of file +var _0x843c=['data2','data5','number','headers','data6','parse','render','stack','data1','toUpperCase','GET','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','error','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','../../../../config/logger','trigger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x843c,0x10c));var _0xc843=function(_0x2ffb10,_0x40c81e){_0x2ffb10=_0x2ffb10-0x0;var _0x5f4e4e=_0x843c[_0x2ffb10];return _0x5f4e4e;};'use strict';var rp=require('request-promise');var util=require(_0xc843('0x0'));var _=require(_0xc843('0x1'));var Mustache=require('mustache');var logger=require(_0xc843('0x2'))(_0xc843('0x3'));exports['exec']=function(_0x5ef742,_0x26ba1a){var _0x16e373,_0x4b7969;var _0x18dd89={'method':_0x5ef742['data1']['toUpperCase'](),'uri':Mustache['render'](_0x5ef742[_0xc843('0x4')],_0x26ba1a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5ef742[_0xc843('0x5')])===_0xc843('0x6')&&parseInt(_0x5ef742[_0xc843('0x5')])>=0x1&&parseInt(_0x5ef742[_0xc843('0x5')])<=0xa?parseInt(_0x5ef742['data5'])*0x3e8:0x5*0x3e8};try{_0x18dd89[_0xc843('0x7')]=_0x5ef742[_0xc843('0x8')]?JSON[_0xc843('0x9')](Mustache[_0xc843('0xa')](_0x5ef742[_0xc843('0x8')],_0x26ba1a)):{};}catch(_0xd3cad9){logger['error'](_0xd3cad9[_0xc843('0xb')]);}switch(_0x5ef742[_0xc843('0xc')][_0xc843('0xd')]()){case _0xc843('0xe'):case'DELETE':_0x16e373=null;_0x18dd89['qs']=_0x26ba1a;break;case _0xc843('0xf'):case _0xc843('0x10'):if(_0x5ef742[_0xc843('0x11')]){try{_0x16e373=JSON[_0xc843('0x9')](Mustache[_0xc843('0xa')](_0x5ef742['data7'],_0x26ba1a));_0x18dd89[_0xc843('0x12')]=_0x16e373;}catch(_0x116900){logger['error'](_0x116900[_0xc843('0xb')]);logger['error'](_0xc843('0x13'));}}else{_0x16e373=_0x26ba1a;_0x18dd89[_0xc843('0x12')]=_0x16e373;}break;}logger[_0xc843('0x14')](util[_0xc843('0x15')](_0xc843('0x16'),_0x5ef742[_0xc843('0xc')],_0x5ef742[_0xc843('0x4')],JSON[_0xc843('0x17')](_0x18dd89)));rp(_0x18dd89)[_0xc843('0x18')](function(_0x2f8045){_0x16e373=!_[_0xc843('0x19')](_0x16e373)?_0xc843('0x1a')+_0x16e373:'';_0x4b7969=typeof _0x2f8045[_0xc843('0x12')]==='object'?JSON[_0xc843('0x17')](_0x2f8045[_0xc843('0x12')]):_0x2f8045[_0xc843('0x12')];logger[_0xc843('0x14')](util[_0xc843('0x15')](_0xc843('0x1b'),_0x5ef742[_0xc843('0xc')],_0x5ef742[_0xc843('0x4')],_0x2f8045[_0xc843('0x1c')],_0x4b7969));})[_0xc843('0x1d')](function(_0x4fb96b){logger[_0xc843('0x1e')](util['format'](_0xc843('0x1f'),_0x5ef742['data1'],_0x5ef742['data2'],_0x4fb96b[_0xc843('0x1c')],_0x4fb96b[_0xc843('0x20')],_0x4fb96b[_0xc843('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index aeebbcb..e7119e0 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 _0xf916=['jayson/promise','bluebird','../../config/logger','routing','client','http','request','then','debug','error','message','result','catch','exports'];(function(_0x206379,_0x9cbd7e){var _0x8d8555=function(_0x683435){while(--_0x683435){_0x206379['push'](_0x206379['shift']());}};_0x8d8555(++_0x9cbd7e);}(_0xf916,0xa8));var _0x6f91=function(_0x51a995,_0x13db8b){_0x51a995=_0x51a995-0x0;var _0x465770=_0xf916[_0x51a995];return _0x465770;};'use strict';var jayson=require(_0x6f91('0x0'));var BPromise=require(_0x6f91('0x1'));var logger=require(_0x6f91('0x2'))(_0x6f91('0x3'));var client=jayson[_0x6f91('0x4')][_0x6f91('0x5')]({'port':0x2329});client['Request']=function(_0x181e29,_0x5bc321){return new BPromise(function(_0x523938,_0x3b6059){return client[_0x6f91('0x6')](_0x181e29,_0x5bc321)[_0x6f91('0x7')](function(_0x4077f8){logger[_0x6f91('0x8')]('rpc',_0x6f91('0x3'),_0x181e29,_0x5bc321,_0x4077f8);if(_0x4077f8[_0x6f91('0x9')]){logger[_0x6f91('0x9')]('rpc',_0x6f91('0x3'),_0x181e29,_0x4077f8[_0x6f91('0x9')][_0x6f91('0xa')],_0x5bc321);return _0x3b6059(_0x4077f8[_0x6f91('0x9')]['message']);}else{return _0x523938(_0x4077f8[_0x6f91('0xb')]);}})[_0x6f91('0xc')](function(_0x16e8a7){logger['error']('rpc','routing',_0x181e29,_0x16e8a7,_0x5bc321);return _0x3b6059(_0x16e8a7);});});};module[_0x6f91('0xd')]=client; \ No newline at end of file +var _0x9fda=['message','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','debug','rpc','routing','error'];(function(_0x5d6448,_0x53522f){var _0x58c195=function(_0x200a2f){while(--_0x200a2f){_0x5d6448['push'](_0x5d6448['shift']());}};_0x58c195(++_0x53522f);}(_0x9fda,0x11b));var _0xa9fd=function(_0x4b0e28,_0x40fcc7){_0x4b0e28=_0x4b0e28-0x0;var _0x40e7c5=_0x9fda[_0x4b0e28];return _0x40e7c5;};'use strict';var jayson=require(_0xa9fd('0x0'));var BPromise=require(_0xa9fd('0x1'));var logger=require(_0xa9fd('0x2'))('routing');var client=jayson[_0xa9fd('0x3')][_0xa9fd('0x4')]({'port':0x2329});client[_0xa9fd('0x5')]=function(_0xb114f,_0x21481a){return new BPromise(function(_0x4c12df,_0x4f6d98){return client[_0xa9fd('0x6')](_0xb114f,_0x21481a)['then'](function(_0x5a4ba8){logger[_0xa9fd('0x7')](_0xa9fd('0x8'),_0xa9fd('0x9'),_0xb114f,_0x21481a,_0x5a4ba8);if(_0x5a4ba8['error']){logger[_0xa9fd('0xa')](_0xa9fd('0x8'),'routing',_0xb114f,_0x5a4ba8[_0xa9fd('0xa')][_0xa9fd('0xb')],_0x21481a);return _0x4f6d98(_0x5a4ba8['error']['message']);}else{return _0x4c12df(_0x5a4ba8['result']);}})[_0xa9fd('0xc')](function(_0x4cffe5){logger[_0xa9fd('0xa')](_0xa9fd('0x8'),_0xa9fd('0x9'),_0xb114f,_0x4cffe5,_0x21481a);return _0x4f6d98(_0x4cffe5);});});};module[_0xa9fd('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 33bfec8..fccca1d 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 _0xc347=['getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then'];(function(_0x16dd8d,_0x433387){var _0x317d95=function(_0x369efb){while(--_0x369efb){_0x16dd8d['push'](_0x16dd8d['shift']());}};_0x317d95(++_0x433387);}(_0xc347,0x10a));var _0x7c34=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc347[_0x432682];return _0x463d05;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x7c34('0x0'));var mailAccount=require(_0x7c34('0x1'));var setting=require('./rpc/setting');var logger=require(_0x7c34('0x2'))(_0x7c34('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x7c34('0x4')]()[_0x7c34('0x5')](mailAccount[_0x7c34('0x6')]())[_0x7c34('0x5')](realtime[_0x7c34('0x7')]())[_0x7c34('0x5')](function(){email[_0x7c34('0x8')](realtime[_0x7c34('0x9')]);return realtime;});}function main(){return server[_0x7c34('0xa')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x7c34('0xb')]();})['then'](function(_0x3c64bc){return setInterval(initRealtime,_0x3c64bc[_0x7c34('0xc')]*0x3e8);})[_0x7c34('0xd')](function(_0x49519b){logger[_0x7c34('0xe')](_0x7c34('0xf'),_0x49519b);});}main(); \ No newline at end of file +var _0x6dab=['then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','./server','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','initMailAccounts'];(function(_0x1b5727,_0x4c524d){var _0x365fce=function(_0x42d440){while(--_0x42d440){_0x1b5727['push'](_0x1b5727['shift']());}};_0x365fce(++_0x4c524d);}(_0x6dab,0x115));var _0xb6da=function(_0x11b4fb,_0x10c784){_0x11b4fb=_0x11b4fb-0x0;var _0x56cbb5=_0x6dab[_0x11b4fb];return _0x56cbb5;};'use strict';var server=require(_0xb6da('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0xb6da('0x1'));var setting=require(_0xb6da('0x2'));var logger=require(_0xb6da('0x3'))(_0xb6da('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb6da('0x5')]()['then'](mailAccount[_0xb6da('0x6')]())['then'](realtime[_0xb6da('0x7')]())[_0xb6da('0x8')](function(){email[_0xb6da('0x9')](realtime[_0xb6da('0xa')]);return realtime;});}function main(){return server[_0xb6da('0xb')](realtime,email)[_0xb6da('0x8')](function(){return initRealtime();})[_0xb6da('0x8')](function(){return setting[_0xb6da('0xc')]();})[_0xb6da('0x8')](function(_0x5a556e){return setInterval(initRealtime,_0x5a556e[_0xb6da('0xd')]*0x3e8);})['catch'](function(_0xb3dde2){logger[_0xb6da('0xe')]('Email\x20service\x20initialization',_0xb3dde2);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 5028563..79a33d8 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 _0x14e5=['isNil','Smtp','verify','then','verified','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','total','stringify','refresh','hasOwnProperty','service','custom','box','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','messageStatus','messages','firstName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','status','send','verifySmtp'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0x14e5,0x118));var _0x514e=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x14e5[_0x12a2a6];return _0x1754ae;};'use strict';var _=require(_0x514e('0x0'));var moment=require(_0x514e('0x1'));var BPromise=require(_0x514e('0x2'));var md5=require(_0x514e('0x3'));var Redis=require(_0x514e('0x4'));var config=require('../../../config/environment');var logger=require(_0x514e('0x5'))(_0x514e('0x6'));config[_0x514e('0x7')]=_[_0x514e('0x8')](config[_0x514e('0x7')],{'host':_0x514e('0x9'),'port':0x18eb});var io=require(_0x514e('0xa'))(new Redis(config[_0x514e('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x514e('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x394919){logger[_0x514e('0xc')](_0x514e('0xd'));this[_0x514e('0xe')]=_0x394919[_0x514e('0xe')];this[_0x514e('0xf')]={};this[_0x514e('0x10')]=new EmailSmtp();}EmailChannel[_0x514e('0x11')][_0x514e('0x12')]=function(_0x1856e5){var _0x3690e3=this[_0x514e('0xe')][_0x1856e5];var _0xfc734={'id':_0x3690e3['id'],'name':_0x3690e3[_0x514e('0x13')],'key':_0x3690e3[_0x514e('0x14')],'active':_0x3690e3[_0x514e('0x15')],'Imap':{'status':_0x3690e3[_0x514e('0x16')]['status'],'messageStatus':_0x3690e3[_0x514e('0x16')]['messageStatus'],'total':_0x3690e3[_0x514e('0x16')][_0x514e('0x17')]}};if(_['isNil'](md5Accounts[_0x1856e5])){md5Accounts[_0x1856e5]={};}var _0x226b13=md5(JSON[_0x514e('0x18')](_0xfc734));if(md5Accounts[_0x1856e5]['md5']!==_0x226b13){md5Accounts[_0x1856e5]['md5']=_0x226b13;io[_0x514e('0x12')]('mailAccount:update',_0xfc734);}};EmailChannel[_0x514e('0x11')][_0x514e('0x19')]=function(_0x2dcb58){for(var _0x26573e in _0x2dcb58){if(_0x2dcb58[_0x514e('0x1a')](_0x26573e)){if(_0x2dcb58[_0x26573e][_0x514e('0x16')]&&_0x2dcb58[_0x26573e][_0x514e('0x15')]){var _0x4cb372=_0x2dcb58[_0x26573e][_0x514e('0x16')];if(!_0x4cb372[_0x514e('0x1b')]&&_0x2dcb58[_0x26573e]['provider']!==_0x514e('0x1c'))_0x4cb372['service']=_0x2dcb58[_0x26573e]['provider'];if(!this[_0x514e('0xf')][_0x514e('0x1a')](_0x4cb372['id'])){this[_0x514e('0xf')][_0x4cb372['id']]=new EmailImap(_0x4cb372,_0x2dcb58[_0x26573e][_0x514e('0x6')]);this[_0x514e('0xf')][_0x4cb372['id']]['on'](_0x514e('0x1d'),this['handleImapBox']['bind'](this,_0x26573e));this[_0x514e('0xf')][_0x4cb372['id']]['on'](_0x514e('0x6'),this[_0x514e('0x1e')][_0x514e('0x1f')](this,_0x26573e));this[_0x514e('0xf')][_0x4cb372['id']]['on'](_0x514e('0x20'),this[_0x514e('0x21')]['bind'](this,_0x26573e));this[_0x514e('0xf')][_0x4cb372['id']]['on'](_0x514e('0x22'),this[_0x514e('0x23')][_0x514e('0x1f')](this,_0x26573e));}}else{if(_['isNil'](this[_0x514e('0xe')][_0x26573e][_0x514e('0x16')])){this[_0x514e('0xe')][_0x26573e]['Imap']={};}this[_0x514e('0xe')][_0x26573e][_0x514e('0x16')]['status']=_0x514e('0x24');this[_0x514e('0xe')][_0x26573e]['Imap']['messageStatus']='';this[_0x514e('0x12')](_0x26573e);}}}};EmailChannel[_0x514e('0x11')][_0x514e('0x25')]=function(_0x47cace,_0x493175){if(this[_0x514e('0xe')][_0x47cace]){this[_0x514e('0xe')][_0x47cace]['Imap']['status']=_0x514e('0x26');this[_0x514e('0xe')][_0x47cace][_0x514e('0x16')][_0x514e('0x27')]=_0x493175[_0x514e('0x13')];if(_0x493175[_0x514e('0x28')]){this[_0x514e('0xe')][_0x47cace][_0x514e('0x16')]['total']=_0x493175[_0x514e('0x28')][_0x514e('0x17')];}return this['emit'](_0x47cace);}};EmailChannel['prototype'][_0x514e('0x1e')]=function(_0x142d45,_0x363792){logger[_0x514e('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x363792[_0x514e('0x29')],_0x363792['lastName'],_0x363792[_0x514e('0x2a')],_0x142d45);if(this[_0x514e('0xe')][_0x142d45]){return mailAccount[_0x514e('0x2b')](_0x142d45,_0x363792)['then'](function(_0x2d0ee3){if(_0x2d0ee3){logger[_0x514e('0xc')]('Mail\x20accepted\x20from\x20routing');}})[_0x514e('0x2c')](function(_0x43b863){logger[_0x514e('0x22')](_0x514e('0x2d'),JSON[_0x514e('0x18')](_0x43b863));});}};EmailChannel[_0x514e('0x11')]['handleImapEnd']=function(_0x4003d9){if(this[_0x514e('0xe')][_0x4003d9]&&this[_0x514e('0xe')][_0x4003d9][_0x514e('0x16')]){if(this[_0x514e('0xf')][this[_0x514e('0xe')][_0x4003d9][_0x514e('0x16')]['id']]){delete this[_0x514e('0xf')][this[_0x514e('0xe')][_0x4003d9][_0x514e('0x16')]['id']];}this[_0x514e('0xe')][_0x4003d9][_0x514e('0x16')][_0x514e('0x2e')]=moment();this['emit'](_0x4003d9);}};EmailChannel[_0x514e('0x11')][_0x514e('0x23')]=function(_0x38cb69,_0x305c21){if(this['mailAccounts'][_0x38cb69]){this[_0x514e('0xe')][_0x38cb69][_0x514e('0x16')][_0x514e('0x2f')]=_0x514e('0x22');this[_0x514e('0xe')][_0x38cb69]['Imap']['messageStatus']=_0x305c21;return this[_0x514e('0x12')](_0x38cb69);}};EmailChannel[_0x514e('0x11')]['sendMail']=function(_0x2fbc4c,_0x2c2ec1){return this[_0x514e('0x10')][_0x514e('0x30')](_0x2fbc4c,_0x2c2ec1);};EmailChannel[_0x514e('0x11')][_0x514e('0x31')]=function(_0x1fbc28){var _0x7fabe1=this;if(this[_0x514e('0xe')][_0x1fbc28['id']]){if(_[_0x514e('0x32')](this[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')])){this[_0x514e('0xe')][_0x1fbc28['id']]['Smtp']={};}this[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')]['lastSync']=moment();return new BPromise(function(_0x11fe72,_0x479272){return _0x7fabe1[_0x514e('0x10')][_0x514e('0x34')](_0x1fbc28)[_0x514e('0x35')](function(_0x3f5407){_0x7fabe1[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')][_0x514e('0x2f')]=_0x514e('0x36');_0x7fabe1[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')][_0x514e('0x27')]='';_0x7fabe1[_0x514e('0x12')](_0x1fbc28['id']);_0x11fe72(_0x3f5407);})[_0x514e('0x2c')](function(_0x4d136e){_0x7fabe1[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')][_0x514e('0x2f')]=_0x514e('0x22');_0x7fabe1[_0x514e('0xe')][_0x1fbc28['id']][_0x514e('0x33')][_0x514e('0x27')]=_0x4d136e;_0x7fabe1['emit'](_0x1fbc28['id']);_0x479272(_0x4d136e);});});}return this[_0x514e('0x10')][_0x514e('0x34')](_0x1fbc28);};module['exports']=EmailChannel; \ No newline at end of file +var _0xf97b=['notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verified','verify','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','service','custom','provider','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','handleImapBox','messages','total','lastName','from'];(function(_0x3d99a5,_0x467427){var _0x456392=function(_0x5e337b){while(--_0x5e337b){_0x3d99a5['push'](_0x3d99a5['shift']());}};_0x456392(++_0x467427);}(_0xf97b,0x1cb));var _0xbf97=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xf97b[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xbf97('0x0'));var moment=require(_0xbf97('0x1'));var BPromise=require(_0xbf97('0x2'));var md5=require(_0xbf97('0x3'));var Redis=require(_0xbf97('0x4'));var config=require(_0xbf97('0x5'));var logger=require(_0xbf97('0x6'))(_0xbf97('0x7'));config[_0xbf97('0x8')]=_[_0xbf97('0x9')](config[_0xbf97('0x8')],{'host':_0xbf97('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbf97('0x8')]));var EmailImap=require(_0xbf97('0xb'));var EmailSmtp=require(_0xbf97('0xc'));var mailAccount=require(_0xbf97('0xd'));var md5Accounts={};function EmailChannel(_0x4c83ed){logger['info'](_0xbf97('0xe'));this[_0xbf97('0xf')]=_0x4c83ed['mailAccounts'];this[_0xbf97('0x10')]={};this[_0xbf97('0x11')]=new EmailSmtp();}EmailChannel[_0xbf97('0x12')][_0xbf97('0x13')]=function(_0x27b579){var _0x590b9f=this[_0xbf97('0xf')][_0x27b579];var _0x5e5852={'id':_0x590b9f['id'],'name':_0x590b9f[_0xbf97('0x14')],'key':_0x590b9f[_0xbf97('0x15')],'active':_0x590b9f[_0xbf97('0x16')],'Imap':{'status':_0x590b9f[_0xbf97('0x17')][_0xbf97('0x18')],'messageStatus':_0x590b9f[_0xbf97('0x17')][_0xbf97('0x19')],'total':_0x590b9f[_0xbf97('0x17')]['total']}};if(_[_0xbf97('0x1a')](md5Accounts[_0x27b579])){md5Accounts[_0x27b579]={};}var _0x257944=md5(JSON[_0xbf97('0x1b')](_0x5e5852));if(md5Accounts[_0x27b579][_0xbf97('0x3')]!==_0x257944){md5Accounts[_0x27b579][_0xbf97('0x3')]=_0x257944;io[_0xbf97('0x13')](_0xbf97('0x1c'),_0x5e5852);}};EmailChannel[_0xbf97('0x12')][_0xbf97('0x1d')]=function(_0x48e52b){for(var _0x3f51df in _0x48e52b){if(_0x48e52b['hasOwnProperty'](_0x3f51df)){if(_0x48e52b[_0x3f51df][_0xbf97('0x17')]&&_0x48e52b[_0x3f51df]['active']){var _0xc85ff5=_0x48e52b[_0x3f51df][_0xbf97('0x17')];if(!_0xc85ff5[_0xbf97('0x1e')]&&_0x48e52b[_0x3f51df]['provider']!==_0xbf97('0x1f'))_0xc85ff5[_0xbf97('0x1e')]=_0x48e52b[_0x3f51df][_0xbf97('0x20')];if(!this[_0xbf97('0x10')]['hasOwnProperty'](_0xc85ff5['id'])){this[_0xbf97('0x10')][_0xc85ff5['id']]=new EmailImap(_0xc85ff5,_0x48e52b[_0x3f51df][_0xbf97('0x7')]);this[_0xbf97('0x10')][_0xc85ff5['id']]['on'](_0xbf97('0x21'),this['handleImapBox'][_0xbf97('0x22')](this,_0x3f51df));this[_0xbf97('0x10')][_0xc85ff5['id']]['on'](_0xbf97('0x7'),this[_0xbf97('0x23')][_0xbf97('0x22')](this,_0x3f51df));this[_0xbf97('0x10')][_0xc85ff5['id']]['on'](_0xbf97('0x24'),this[_0xbf97('0x25')]['bind'](this,_0x3f51df));this[_0xbf97('0x10')][_0xc85ff5['id']]['on'](_0xbf97('0x26'),this[_0xbf97('0x27')][_0xbf97('0x22')](this,_0x3f51df));}}else{if(_[_0xbf97('0x1a')](this['mailAccounts'][_0x3f51df]['Imap'])){this[_0xbf97('0xf')][_0x3f51df][_0xbf97('0x17')]={};}this[_0xbf97('0xf')][_0x3f51df]['Imap'][_0xbf97('0x18')]='disabled';this[_0xbf97('0xf')][_0x3f51df][_0xbf97('0x17')][_0xbf97('0x19')]='';this['emit'](_0x3f51df);}}}};EmailChannel['prototype'][_0xbf97('0x28')]=function(_0x506162,_0x4d52bf){if(this[_0xbf97('0xf')][_0x506162]){this[_0xbf97('0xf')][_0x506162]['Imap']['status']='connected';this['mailAccounts'][_0x506162][_0xbf97('0x17')][_0xbf97('0x19')]=_0x4d52bf[_0xbf97('0x14')];if(_0x4d52bf[_0xbf97('0x29')]){this[_0xbf97('0xf')][_0x506162]['Imap'][_0xbf97('0x2a')]=_0x4d52bf[_0xbf97('0x29')]['total'];}return this[_0xbf97('0x13')](_0x506162);}};EmailChannel[_0xbf97('0x12')]['handleImapEmail']=function(_0x2a9525,_0x3687a2){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3687a2['firstName'],_0x3687a2[_0xbf97('0x2b')],_0x3687a2[_0xbf97('0x2c')],_0x2a9525);if(this['mailAccounts'][_0x2a9525]){return mailAccount[_0xbf97('0x2d')](_0x2a9525,_0x3687a2)[_0xbf97('0x2e')](function(_0x3a8ffc){if(_0x3a8ffc){logger['info'](_0xbf97('0x2f'));}})[_0xbf97('0x30')](function(_0x5a1e32){logger[_0xbf97('0x26')](_0xbf97('0x31'),JSON[_0xbf97('0x1b')](_0x5a1e32));});}};EmailChannel[_0xbf97('0x12')][_0xbf97('0x25')]=function(_0x349ef5){if(this[_0xbf97('0xf')][_0x349ef5]&&this[_0xbf97('0xf')][_0x349ef5][_0xbf97('0x17')]){if(this[_0xbf97('0x10')][this[_0xbf97('0xf')][_0x349ef5][_0xbf97('0x17')]['id']]){delete this[_0xbf97('0x10')][this[_0xbf97('0xf')][_0x349ef5][_0xbf97('0x17')]['id']];}this[_0xbf97('0xf')][_0x349ef5]['Imap'][_0xbf97('0x32')]=moment();this['emit'](_0x349ef5);}};EmailChannel[_0xbf97('0x12')][_0xbf97('0x27')]=function(_0x1cde49,_0xebd912){if(this[_0xbf97('0xf')][_0x1cde49]){this[_0xbf97('0xf')][_0x1cde49]['Imap']['status']='error';this['mailAccounts'][_0x1cde49][_0xbf97('0x17')][_0xbf97('0x19')]=_0xebd912;return this[_0xbf97('0x13')](_0x1cde49);}};EmailChannel[_0xbf97('0x12')][_0xbf97('0x33')]=function(_0x345eb1,_0x48f2ec){return this[_0xbf97('0x11')]['send'](_0x345eb1,_0x48f2ec);};EmailChannel[_0xbf97('0x12')][_0xbf97('0x34')]=function(_0x3f4e4b){var _0xbd26a=this;if(this[_0xbf97('0xf')][_0x3f4e4b['id']]){if(_[_0xbf97('0x1a')](this['mailAccounts'][_0x3f4e4b['id']][_0xbf97('0x35')])){this[_0xbf97('0xf')][_0x3f4e4b['id']][_0xbf97('0x35')]={};}this[_0xbf97('0xf')][_0x3f4e4b['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x3640ce,_0x541a00){return _0xbd26a['smtp']['verify'](_0x3f4e4b)['then'](function(_0x173e39){_0xbd26a['mailAccounts'][_0x3f4e4b['id']]['Smtp'][_0xbf97('0x18')]=_0xbf97('0x36');_0xbd26a[_0xbf97('0xf')][_0x3f4e4b['id']]['Smtp'][_0xbf97('0x19')]='';_0xbd26a[_0xbf97('0x13')](_0x3f4e4b['id']);_0x3640ce(_0x173e39);})[_0xbf97('0x30')](function(_0x587376){_0xbd26a[_0xbf97('0xf')][_0x3f4e4b['id']][_0xbf97('0x35')][_0xbf97('0x18')]='error';_0xbd26a[_0xbf97('0xf')][_0x3f4e4b['id']]['Smtp']['messageStatus']=_0x587376;_0xbd26a['emit'](_0x3f4e4b['id']);_0x541a00(_0x587376);});});}return this[_0xbf97('0x11')][_0xbf97('0x37')](_0x3f4e4b);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 65fc052..d49cda4 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 _0x9f73=['host','port','tls','required','openBox','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','xoauth2','generateXOAuth2Token','CloudProvider','user','password'];(function(_0x4a99d1,_0x45850a){var _0x13a22e=function(_0x35b7b1){while(--_0x35b7b1){_0x4a99d1['push'](_0x4a99d1['shift']());}};_0x13a22e(++_0x45850a);}(_0x9f73,0x108));var _0x39f7=function(_0x243e5e,_0x3a44be){_0x243e5e=_0x243e5e-0x0;var _0x15752f=_0x9f73[_0x243e5e];return _0x15752f;};'use strict';var _=require(_0x39f7('0x0'));var util=require(_0x39f7('0x1'));var Imap=require(_0x39f7('0x2'));var simpleParser=require(_0x39f7('0x3'))[_0x39f7('0x4')];var Iconv=require('iconv')[_0x39f7('0x5')];var EventEmitter=require(_0x39f7('0x6'))[_0x39f7('0x7')];var utils=require('./utils');var logger=require(_0x39f7('0x8'))(_0x39f7('0x9'));function EmailImap(_0x5d01fc,_0x398e29){this[_0x39f7('0xa')]=_0x5d01fc[_0x39f7('0xa')];this[_0x39f7('0xb')]=this[_0x39f7('0xc')](_0x5d01fc,_0x398e29);this[_0x39f7('0x2')]=new Imap(this[_0x39f7('0xb')]);this['imap']['once'](_0x39f7('0xd'),this[_0x39f7('0xe')][_0x39f7('0xf')](this));this[_0x39f7('0x2')][_0x39f7('0x10')](_0x39f7('0x11'),this[_0x39f7('0x12')][_0x39f7('0xf')](this));this[_0x39f7('0x2')]['on'](_0x39f7('0x13'),this[_0x39f7('0x14')]['bind'](this));this['imap']['connect']();}util[_0x39f7('0x15')](EmailImap,EventEmitter);EmailImap[_0x39f7('0x16')][_0x39f7('0xc')]=function(_0x2064d5,_0x1b5e2b){var _0x339d7a={'connTimeout':_0x2064d5[_0x39f7('0x17')]?_0x2064d5['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2064d5[_0x39f7('0x18')]?_0x2064d5[_0x39f7('0x18')]*0x3e8:0x1388};if(_0x2064d5[_0x39f7('0x19')]){_0x339d7a['user']=_0x2064d5['user'];if(_0x2064d5['modernAuthentication']){_0x339d7a[_0x39f7('0x1a')]=utils[_0x39f7('0x1b')](_0x2064d5[_0x39f7('0x1c')]['data5'],_0x2064d5[_0x39f7('0x1d')]);}else{_0x339d7a[_0x39f7('0x1e')]=_0x2064d5['password'];}}else{if(_0x2064d5['authentication']){_0x339d7a[_0x39f7('0x1d')]=_0x2064d5[_0x39f7('0x1d')];_0x339d7a[_0x39f7('0x1e')]=_0x2064d5[_0x39f7('0x1e')];}}_0x339d7a[_0x39f7('0x9')]=_0x1b5e2b||_0x2064d5[_0x39f7('0x1d')]||'anonymous@xcally.com';_0x339d7a[_0x39f7('0x1f')]=_0x2064d5[_0x39f7('0x1f')];_0x339d7a[_0x39f7('0x20')]=_0x2064d5[_0x39f7('0x20')]||0x3e1;if(_0x2064d5['tls']){_0x339d7a['tls']=!![];}else{_0x339d7a[_0x39f7('0x21')]=![];_0x339d7a['autotls']=_0x39f7('0x22');}return _0x339d7a;};EmailImap[_0x39f7('0x16')][_0x39f7('0xe')]=function(){this[_0x39f7('0x2')][_0x39f7('0x23')](this['mailbox'],![],this[_0x39f7('0x24')][_0x39f7('0xf')](this));};EmailImap[_0x39f7('0x16')][_0x39f7('0x24')]=function(_0x244009,_0x402b3e){if(_0x244009){this[_0x39f7('0x14')](_0x244009,!![]);}else{this[_0x39f7('0x25')](_0x39f7('0x26'),_0x402b3e);this[_0x39f7('0x27')]();}};EmailImap[_0x39f7('0x16')]['handleCloseBox']=function(_0x1f9d99){if(_0x1f9d99){this[_0x39f7('0x14')](_0x1f9d99,!![]);}else{this[_0x39f7('0x2')]['end']();}};EmailImap[_0x39f7('0x16')]['readUnseen']=function(){this[_0x39f7('0x2')]['search']([_0x39f7('0x28')],this[_0x39f7('0x29')][_0x39f7('0xf')](this));};EmailImap['prototype'][_0x39f7('0x29')]=function(_0xd80891,_0x5a307c){if(_0xd80891){this[_0x39f7('0x14')](_0xd80891,!![]);}else{if(_0x5a307c['length']){try{var _0x2be434=this['imap']['fetch'](_0x5a307c,{'bodies':'','markSeen':!![]});_0x2be434['on'](_0x39f7('0x2a'),this[_0x39f7('0x2b')]['bind'](this));_0x2be434[_0x39f7('0x10')](_0x39f7('0x13'),this[_0x39f7('0x2c')]['bind'](this));_0x2be434[_0x39f7('0x10')](_0x39f7('0x11'),this[_0x39f7('0x2d')][_0x39f7('0xf')](this));}catch(_0x54f12e){logger[_0x39f7('0x13')](_0x54f12e);}}else{this[_0x39f7('0x2')][_0x39f7('0x2e')](!![],this[_0x39f7('0x2f')][_0x39f7('0xf')](this));}}};EmailImap['prototype'][_0x39f7('0x2b')]=function(_0x315384){_0x315384['on'](_0x39f7('0x30'),this[_0x39f7('0x31')][_0x39f7('0xf')](this));_0x315384[_0x39f7('0x10')](_0x39f7('0x32'),this['handleMessageAttributes']['bind'](this));_0x315384[_0x39f7('0x10')](_0x39f7('0x11'),this[_0x39f7('0x33')][_0x39f7('0xf')](this));};EmailImap[_0x39f7('0x16')][_0x39f7('0x31')]=function(_0x24624f){simpleParser(_0x24624f,{'Iconv':Iconv},this[_0x39f7('0x34')][_0x39f7('0xf')](this));};EmailImap[_0x39f7('0x16')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x39f7('0x33')]=function(){};EmailImap[_0x39f7('0x16')][_0x39f7('0x34')]=function(_0x39338b,_0x2ab147){if(_0x39338b){logger[_0x39f7('0x13')](_0x39338b);}else{var _0x1b8a07=this;utils[_0x39f7('0x35')](this[_0x39f7('0xb')],_0x2ab147,function(_0x3c15ef){_0x1b8a07[_0x39f7('0x25')](_0x39f7('0x9'),_0x3c15ef);});}};EmailImap[_0x39f7('0x16')]['handleFetchEnd']=function(){this[_0x39f7('0x2')][_0x39f7('0x2e')](!![],this[_0x39f7('0x2f')][_0x39f7('0xf')](this));};EmailImap[_0x39f7('0x16')][_0x39f7('0x2c')]=function(_0x33f7ee){this[_0x39f7('0x14')](_0x33f7ee);this[_0x39f7('0x2')][_0x39f7('0x2e')](!![],this[_0x39f7('0x2f')][_0x39f7('0xf')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x39f7('0x25')](_0x39f7('0x11'));};EmailImap['prototype']['handleError']=function(_0x5b68ef,_0x5a4695){logger['error'](_0x39f7('0x14'),this[_0x39f7('0xb')]['email'],JSON[_0x39f7('0x36')](_0x5b68ef));var _0x57a629='';if(_0x5b68ef){if(_0x5b68ef['textCode']){_0x57a629=_0x5b68ef[_0x39f7('0x37')];}else{for(var _0x4278fa in _0x5b68ef){if(_0x5b68ef[_0x39f7('0x38')](_0x4278fa)){_0x57a629+=_[_0x39f7('0x39')](_0x4278fa)+':\x20'+_0x5b68ef[_0x4278fa]+'\x0a';}}}}if(_0x5a4695){this[_0x39f7('0x2')]['end']();}else{this[_0x39f7('0x25')]('error',_0x57a629);this[_0x39f7('0x25')](_0x39f7('0x11'));}};module[_0x39f7('0x3a')]=EmailImap; \ No newline at end of file +var _0x1a1f=['handleMessageAttributes','parser','handleEnd','textCode','upperFirst','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','end','error','handleError','inherits','getAccount','connTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','authentication','host','port','tls','autotls','prototype','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes'];(function(_0x5b1695,_0x230075){var _0x447b2d=function(_0x3a1168){while(--_0x3a1168){_0x5b1695['push'](_0x5b1695['shift']());}};_0x447b2d(++_0x230075);}(_0x1a1f,0x1d5));var _0xf1a1=function(_0x58397a,_0x37c197){_0x58397a=_0x58397a-0x0;var _0x4acf4b=_0x1a1f[_0x58397a];return _0x4acf4b;};'use strict';var _=require(_0xf1a1('0x0'));var util=require(_0xf1a1('0x1'));var Imap=require(_0xf1a1('0x2'));var simpleParser=require(_0xf1a1('0x3'))[_0xf1a1('0x4')];var Iconv=require('iconv')[_0xf1a1('0x5')];var EventEmitter=require(_0xf1a1('0x6'))[_0xf1a1('0x7')];var utils=require(_0xf1a1('0x8'));var logger=require(_0xf1a1('0x9'))(_0xf1a1('0xa'));function EmailImap(_0x331608,_0x2551f4){this['mailbox']=_0x331608[_0xf1a1('0xb')];this['account']=this['getAccount'](_0x331608,_0x2551f4);this[_0xf1a1('0x2')]=new Imap(this[_0xf1a1('0xc')]);this['imap'][_0xf1a1('0xd')](_0xf1a1('0xe'),this[_0xf1a1('0xf')][_0xf1a1('0x10')](this));this[_0xf1a1('0x2')][_0xf1a1('0xd')](_0xf1a1('0x11'),this['handleEnd']['bind'](this));this[_0xf1a1('0x2')]['on'](_0xf1a1('0x12'),this[_0xf1a1('0x13')]['bind'](this));this[_0xf1a1('0x2')]['connect']();}util[_0xf1a1('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0xf1a1('0x15')]=function(_0x31028e,_0xe6e418){var _0x1110e8={'connTimeout':_0x31028e[_0xf1a1('0x16')]?_0x31028e[_0xf1a1('0x16')]*0x3e8:0x2710,'authTimeout':_0x31028e['authTimeout']?_0x31028e['authTimeout']*0x3e8:0x1388};if(_0x31028e[_0xf1a1('0x17')]){_0x1110e8[_0xf1a1('0x18')]=_0x31028e[_0xf1a1('0x18')];if(_0x31028e[_0xf1a1('0x19')]){_0x1110e8[_0xf1a1('0x1a')]=utils[_0xf1a1('0x1b')](_0x31028e['CloudProvider'][_0xf1a1('0x1c')],_0x31028e[_0xf1a1('0x18')]);}else{_0x1110e8[_0xf1a1('0x1d')]=_0x31028e[_0xf1a1('0x1d')];}}else{if(_0x31028e[_0xf1a1('0x1e')]){_0x1110e8[_0xf1a1('0x18')]=_0x31028e[_0xf1a1('0x18')];_0x1110e8[_0xf1a1('0x1d')]=_0x31028e[_0xf1a1('0x1d')];}}_0x1110e8[_0xf1a1('0xa')]=_0xe6e418||_0x31028e[_0xf1a1('0x18')]||'anonymous@xcally.com';_0x1110e8[_0xf1a1('0x1f')]=_0x31028e[_0xf1a1('0x1f')];_0x1110e8[_0xf1a1('0x20')]=_0x31028e[_0xf1a1('0x20')]||0x3e1;if(_0x31028e[_0xf1a1('0x21')]){_0x1110e8[_0xf1a1('0x21')]=!![];}else{_0x1110e8['tls']=![];_0x1110e8[_0xf1a1('0x22')]='required';}return _0x1110e8;};EmailImap[_0xf1a1('0x23')]['handleReady']=function(){this[_0xf1a1('0x2')][_0xf1a1('0x24')](this[_0xf1a1('0xb')],![],this[_0xf1a1('0x25')][_0xf1a1('0x10')](this));};EmailImap[_0xf1a1('0x23')]['handleOpenBox']=function(_0x2de575,_0x223e18){if(_0x2de575){this['handleError'](_0x2de575,!![]);}else{this[_0xf1a1('0x26')]('box',_0x223e18);this[_0xf1a1('0x27')]();}};EmailImap[_0xf1a1('0x23')][_0xf1a1('0x28')]=function(_0x51e64d){if(_0x51e64d){this[_0xf1a1('0x13')](_0x51e64d,!![]);}else{this['imap'][_0xf1a1('0x11')]();}};EmailImap[_0xf1a1('0x23')][_0xf1a1('0x27')]=function(){this[_0xf1a1('0x2')]['search']([_0xf1a1('0x29')],this[_0xf1a1('0x2a')][_0xf1a1('0x10')](this));};EmailImap[_0xf1a1('0x23')][_0xf1a1('0x2a')]=function(_0x25e5ee,_0x4bdbb2){if(_0x25e5ee){this[_0xf1a1('0x13')](_0x25e5ee,!![]);}else{if(_0x4bdbb2[_0xf1a1('0x2b')]){try{var _0x426010=this[_0xf1a1('0x2')][_0xf1a1('0x2c')](_0x4bdbb2,{'bodies':'','markSeen':!![]});_0x426010['on'](_0xf1a1('0x2d'),this['handleFetchMessage'][_0xf1a1('0x10')](this));_0x426010[_0xf1a1('0xd')](_0xf1a1('0x12'),this[_0xf1a1('0x2e')]['bind'](this));_0x426010[_0xf1a1('0xd')](_0xf1a1('0x11'),this[_0xf1a1('0x2f')][_0xf1a1('0x10')](this));}catch(_0x182aea){logger['error'](_0x182aea);}}else{this[_0xf1a1('0x2')][_0xf1a1('0x30')](!![],this['handleCloseBox'][_0xf1a1('0x10')](this));}}};EmailImap[_0xf1a1('0x23')][_0xf1a1('0x31')]=function(_0x556bf2){_0x556bf2['on'](_0xf1a1('0x32'),this[_0xf1a1('0x33')][_0xf1a1('0x10')](this));_0x556bf2[_0xf1a1('0xd')](_0xf1a1('0x34'),this[_0xf1a1('0x35')][_0xf1a1('0x10')](this));_0x556bf2[_0xf1a1('0xd')](_0xf1a1('0x11'),this['handleMessageEnd'][_0xf1a1('0x10')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x1812de){simpleParser(_0x1812de,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0xf1a1('0x23')][_0xf1a1('0x35')]=function(){};EmailImap[_0xf1a1('0x23')]['handleMessageEnd']=function(){};EmailImap[_0xf1a1('0x23')]['handleSimpleParser']=function(_0x5fe040,_0x14a13e){if(_0x5fe040){logger[_0xf1a1('0x12')](_0x5fe040);}else{var _0xcdb9b8=this;utils[_0xf1a1('0x36')](this[_0xf1a1('0xc')],_0x14a13e,function(_0x4042c2){_0xcdb9b8[_0xf1a1('0x26')](_0xf1a1('0xa'),_0x4042c2);});}};EmailImap[_0xf1a1('0x23')][_0xf1a1('0x2f')]=function(){this[_0xf1a1('0x2')][_0xf1a1('0x30')](!![],this[_0xf1a1('0x28')][_0xf1a1('0x10')](this));};EmailImap[_0xf1a1('0x23')]['handleFetchError']=function(_0xa1ee5a){this['handleError'](_0xa1ee5a);this[_0xf1a1('0x2')][_0xf1a1('0x30')](!![],this[_0xf1a1('0x28')][_0xf1a1('0x10')](this));};EmailImap['prototype'][_0xf1a1('0x37')]=function(){this[_0xf1a1('0x26')](_0xf1a1('0x11'));};EmailImap[_0xf1a1('0x23')][_0xf1a1('0x13')]=function(_0x3466a0,_0x206e49){logger[_0xf1a1('0x12')](_0xf1a1('0x13'),this['account'][_0xf1a1('0xa')],JSON['stringify'](_0x3466a0));var _0x16925b='';if(_0x3466a0){if(_0x3466a0[_0xf1a1('0x38')]){_0x16925b=_0x3466a0[_0xf1a1('0x38')];}else{for(var _0x4fdebf in _0x3466a0){if(_0x3466a0['hasOwnProperty'](_0x4fdebf)){_0x16925b+=_[_0xf1a1('0x39')](_0x4fdebf)+':\x20'+_0x3466a0[_0x4fdebf]+'\x0a';}}}}if(_0x206e49){this['imap'][_0xf1a1('0x11')]();}else{this['emit']('error',_0x16925b);this[_0xf1a1('0x26')](_0xf1a1('0x11'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 971ac70..2808f52 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 _0x878f=['sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','compile'];(function(_0x57d367,_0x2d1b8b){var _0x21c22f=function(_0x15ced4){while(--_0x15ced4){_0x57d367['push'](_0x57d367['shift']());}};_0x21c22f(++_0x2d1b8b);}(_0x878f,0x118));var _0xf878=function(_0x186fea,_0x29ef55){_0x186fea=_0x186fea-0x0;var _0x5afd5a=_0x878f[_0x186fea];return _0x5afd5a;};'use strict';var nodemailer=require(_0xf878('0x0'));var inlineBase64=require(_0xf878('0x1'));function EmailSmtp(){}EmailSmtp[_0xf878('0x2')][_0xf878('0x3')]=function(_0x2b8d6e,_0x4f3a01){return new Promise(function(_0x2a5200,_0x1d504e){var _0x22a115=nodemailer[_0xf878('0x4')](_0x2b8d6e);_0x22a115['use'](_0xf878('0x5'),inlineBase64());_0x22a115[_0xf878('0x6')](_0x4f3a01,function(_0x54966e,_0x8a4be2){if(_0x54966e){_0x1d504e(_0x54966e[_0xf878('0x7')]());}else{_0x2a5200(_0x8a4be2);}});});};EmailSmtp[_0xf878('0x2')]['verify']=function(_0xfda73c){return new Promise(function(_0x42a5fb,_0x335b84){var _0x32cde7=nodemailer[_0xf878('0x4')](_0xfda73c);_0x32cde7[_0xf878('0x8')](function(_0x1c36a9,_0x5abb57){if(_0x1c36a9){_0x335b84(_0x1c36a9[_0xf878('0x7')]());}else{if(_0x5abb57){_0x42a5fb(_0x5abb57);}else{_0x335b84(_0xf878('0x9'));}}});});};module[_0xf878('0xa')]=EmailSmtp; \ No newline at end of file +var _0xad82=['toString','createTransport','verify','nodemailer','nodemailer-plugin-inline-base64','prototype','compile'];(function(_0x3d5f3c,_0x361042){var _0x359c35=function(_0x3e3fa6){while(--_0x3e3fa6){_0x3d5f3c['push'](_0x3d5f3c['shift']());}};_0x359c35(++_0x361042);}(_0xad82,0x9d));var _0x2ad8=function(_0x19ee96,_0x48b7d5){_0x19ee96=_0x19ee96-0x0;var _0x57aaf0=_0xad82[_0x19ee96];return _0x57aaf0;};'use strict';var nodemailer=require(_0x2ad8('0x0'));var inlineBase64=require(_0x2ad8('0x1'));function EmailSmtp(){}EmailSmtp[_0x2ad8('0x2')]['send']=function(_0x4fa3a5,_0x3ee565){return new Promise(function(_0x20eb4e,_0x5754de){var _0x207e06=nodemailer['createTransport'](_0x4fa3a5);_0x207e06['use'](_0x2ad8('0x3'),inlineBase64());_0x207e06['sendMail'](_0x3ee565,function(_0x1d4a3d,_0x24a49c){if(_0x1d4a3d){_0x5754de(_0x1d4a3d[_0x2ad8('0x4')]());}else{_0x20eb4e(_0x24a49c);}});});};EmailSmtp[_0x2ad8('0x2')]['verify']=function(_0x50190f){return new Promise(function(_0x382fdc,_0x22e816){var _0x151274=nodemailer[_0x2ad8('0x5')](_0x50190f);_0x151274[_0x2ad8('0x6')](function(_0x298348,_0xa3fd77){if(_0x298348){_0x22e816(_0x298348[_0x2ad8('0x4')]());}else{if(_0xa3fd77){_0x382fdc(_0xa3fd77);}else{_0x22e816('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 59a2a2d..61dd204 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 _0xa1e4=['email','head','value','address','generate','name','substring','indexOf','split','length','slice','join','pop','isEmpty','anonymous','@xcally.com','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attach','type','attachment','format','%s-%s','root','server/files/attachments/','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','line','isAutoreply','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','

Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','../../../config/logger'];(function(_0x3f1014,_0x34bc1c){var _0x1cd499=function(_0x410820){while(--_0x410820){_0x3f1014['push'](_0x3f1014['shift']());}};_0x1cd499(++_0x34bc1c);}(_0xa1e4,0x15d));var _0x4a1e=function(_0xac3328,_0x23745a){_0xac3328=_0xac3328-0x0;var _0x33aec4=_0xa1e4[_0xac3328];return _0x33aec4;};'use strict';var _=require(_0x4a1e('0x0'));var moment=require(_0x4a1e('0x1'));var random=require(_0x4a1e('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x4a1e('0x3'));var tnef=require(_0x4a1e('0x4'));var logger=require(_0x4a1e('0x5'))(_0x4a1e('0x6'));var config=require('../../../config/environment');function getAddress(_0x65ab85){var _0x5b6294=_[_0x4a1e('0x7')](_0x65ab85[_0x4a1e('0x8')]);return _0x5b6294&&_0x5b6294['address']?_0x5b6294[_0x4a1e('0x9')]:'anonymous'+random[_0x4a1e('0xa')](0x6)+'@xcally.com';}function getFirstName(_0xf87a5c){var _0x44a735=_[_0x4a1e('0x7')](_0xf87a5c[_0x4a1e('0x8')]);if(_0x44a735&&_0x44a735[_0x4a1e('0xb')]){if(_0x44a735[_0x4a1e('0xb')]==_0x44a735[_0x4a1e('0x9')]){return _0x44a735[_0x4a1e('0xb')][_0x4a1e('0xc')](0x0,_0x44a735[_0x4a1e('0xb')][_0x4a1e('0xd')]('@'));}var _0x3b52c2=_0x44a735[_0x4a1e('0xb')][_0x4a1e('0xe')](/\s+/);return _0x3b52c2[_0x4a1e('0xf')]>0x1?_0x3b52c2[_0x4a1e('0x10')](0x0,-0x1)[_0x4a1e('0x11')]('\x20'):_0x44a735[_0x4a1e('0xb')];}return'Anonymous';}function getLastName(_0x55ec00){var _0x33bd83=_[_0x4a1e('0x7')](_0x55ec00['value']);if(_0x33bd83&&_0x33bd83[_0x4a1e('0xb')]){var _0x2e1d8e=_0x33bd83[_0x4a1e('0xb')][_0x4a1e('0xe')](/\s+/);return _0x2e1d8e['length']>0x1?_0x2e1d8e[_0x4a1e('0x12')]():'';}return'';}function getMails(_0x22e99d,_0x4c49c1){var _0x1a1472='';for(var _0x4be7cf=0x0;_0x4be7cf<_0x4c49c1[_0x4a1e('0x8')]['length'];_0x4be7cf+=0x1){if(_0x4c49c1['value'][_0x4be7cf][_0x4a1e('0x9')]!==_0x22e99d){if(!_[_0x4a1e('0x13')](_0x1a1472)){_0x1a1472+=',';}_0x1a1472+=_0x4c49c1[_0x4a1e('0x8')][_0x4be7cf]['name']||_0x4c49c1[_0x4a1e('0x8')][_0x4be7cf][_0x4a1e('0x9')]||'';_0x1a1472+='\x20<';_0x1a1472+=_0x4c49c1[_0x4a1e('0x8')][_0x4be7cf]['address']?_0x4c49c1[_0x4a1e('0x8')][_0x4be7cf]['address']:_0x4a1e('0x14')+random[_0x4a1e('0xa')](0x6)+_0x4a1e('0x15');_0x1a1472+='>';}}return _0x1a1472;}function parseEmail(_0x3f2f76,_0x3f87a4,_0x2bf5fd){if(_0x3f87a4[_0x4a1e('0x16')]){var _0xa46abf=/)<[^<]*)*<\/script>/gi;while(_0xa46abf['test'](_0x3f87a4[_0x4a1e('0x16')])){_0x3f87a4[_0x4a1e('0x16')]=_0x3f87a4[_0x4a1e('0x16')][_0x4a1e('0x17')](_0xa46abf,'');}if(_0x3f87a4['html'][_0x4a1e('0x18')](_0x4a1e('0x19'))){var _0xa6688e=[];_0x3f87a4[_0x4a1e('0x1a')][_0x4a1e('0x1b')](_0x525f62=>{_0xa6688e[_0x4a1e('0x1c')](_0x525f62[_0x4a1e('0x1d')]);});var _0xa916f3=/]+>/g;var _0x11145a=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3c4dc7=_0x3f87a4['html'][_0x4a1e('0x17')](_0x11145a,'_SRC');var _0x5d1c7f=_0x3c4dc7[_0x4a1e('0x17')](_0xa916f3,_0x4a1e('0x1e'));for(let _0x35700f=0x0;_0x35700f<_0xa6688e[_0x4a1e('0xf')];_0x35700f++){var _0x7e9880=_0x5d1c7f[_0x4a1e('0x17')](_0x4a1e('0x1e'),_0x4a1e('0x1f')+_0xa6688e[_0x35700f]+_0x4a1e('0x20'));_0x5d1c7f=_0x7e9880;}_0x3f87a4['html']=_0x5d1c7f;}_0x2bf5fd[_0x4a1e('0x21')]=_0x3f87a4['html'];}else{_0x2bf5fd[_0x4a1e('0x21')]=_0x3f87a4[_0x4a1e('0x22')];}if(_0x2bf5fd[_0x4a1e('0x21')]){_0x2bf5fd[_0x4a1e('0x21')]=_0x2bf5fd[_0x4a1e('0x21')][_0x4a1e('0x17')](/0x0){var _0x197864=[_0x4a1e('0x31'),_0x4a1e('0x32'),'Precedence:\x20auto_reply'];for(var _0x4d3a9d=0x0;_0x4d3a9d<_0x3f87a4[_0x4a1e('0x30')]['length'];_0x4d3a9d++){var _0x567d20=_[_0x4a1e('0xd')](_0x197864,_0x3f87a4[_0x4a1e('0x30')][_0x4d3a9d][_0x4a1e('0x33')]);if(_0x567d20>=0x0){_0x2bf5fd[_0x4a1e('0x34')]=!![];}}}return _0x2bf5fd;}exports['parser']=function(_0x29f14d,_0x5887cf,_0x19f79a){var _0x5b09e9={'from':getAddress(_0x5887cf['from']),'firstName':getFirstName(_0x5887cf[_0x4a1e('0x35')]),'lastName':getLastName(_0x5887cf[_0x4a1e('0x35')]),'mapKey':_0x4a1e('0x6'),'message':{'from':getMails(_0x29f14d[_0x4a1e('0x6')],_0x5887cf[_0x4a1e('0x35')]),'to':_0x29f14d['email'],'cc':'','subject':_0x5887cf['subject']||'','messageId':_0x5887cf[_0x4a1e('0x36')],'inReplyTo':_0x5887cf[_0x4a1e('0x37')],'sentAt':moment(_0x5887cf[_0x4a1e('0x38')])['format'](_0x4a1e('0x39')),'attach':![],'attachments':[]}};if(!_0x5887cf[_0x4a1e('0x16')]&&!_0x5887cf[_0x4a1e('0x22')]){var _0x3a734c=_[_0x4a1e('0x3a')](_0x5887cf['attachments'],{'contentType':'application/ms-tnef'});if(_0x3a734c['length']){logger[_0x4a1e('0x3b')](util[_0x4a1e('0x2a')](_0x4a1e('0x3c'),_0x5887cf[_0x4a1e('0x36')]));tnef['parseBuffer'](_[_0x4a1e('0x3d')](_0x3a734c)['content'],function(_0x54ee60,_0x3fccab){if(_0x3fccab){_0x5887cf[_0x4a1e('0x16')]=_0x3fccab['BodyHTML']||_0x4a1e('0x3e');if(_0x3fccab[_0x4a1e('0x3f')]){for(var _0x5edcba=0x0;_0x5edcba<_0x3fccab[_0x4a1e('0x3f')][_0x4a1e('0xf')];_0x5edcba++){var _0x1b6724=_0x3fccab[_0x4a1e('0x3f')][_0x5edcba];_0x5b09e9[_0x4a1e('0x23')][_0x4a1e('0x1a')][_0x4a1e('0x1c')]({'filename':_0x1b6724[_0x4a1e('0x40')],'content':Buffer[_0x4a1e('0x35')](_0x1b6724[_0x4a1e('0x41')])});}}}_0x19f79a(parseEmail(_0x29f14d,_0x5887cf,_0x5b09e9));});}else{_0x5887cf[_0x4a1e('0x16')]=_0x4a1e('0x3e');_0x19f79a(parseEmail(_0x29f14d,_0x5887cf,_0x5b09e9));}}else{_0x19f79a(parseEmail(_0x29f14d,_0x5887cf,_0x5b09e9));}};exports['generateXOAuth2Token']=function(_0x2f9c54,_0x3b57ad){var _0xa64ffd=[_0x4a1e('0x42')+(_0x3b57ad||''),_0x4a1e('0x43')+_0x2f9c54,'',''];return Buffer[_0x4a1e('0x35')](_0xa64ffd[_0x4a1e('0x11')](''),_0x4a1e('0x44'))[_0x4a1e('0x45')](_0x4a1e('0x46'));}; \ No newline at end of file +var _0x9223=['\x20]','body','message','originTo','originCc','bcc','attachments','attach','type','attachment-','format','%s-%s','now','root','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','isAutoreply','from','messageId','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','

Empty\x20message

','Attachments','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','generate','name','indexOf','split','length','slice','join','pop','isEmpty','anonymous','@xcally.com','html','test','replace','includes','0x1?_0x1b310b[_0x3922('0x10')](0x0,-0x1)[_0x3922('0x11')]('\x20'):_0x3ea5c6[_0x3922('0xc')];}return'Anonymous';}function getLastName(_0x9f1583){var _0x5e8865=_[_0x3922('0x8')](_0x9f1583[_0x3922('0x9')]);if(_0x5e8865&&_0x5e8865['name']){var _0x5277af=_0x5e8865[_0x3922('0xc')][_0x3922('0xe')](/\s+/);return _0x5277af['length']>0x1?_0x5277af[_0x3922('0x12')]():'';}return'';}function getMails(_0x243e17,_0x2817a8){var _0x3dd5af='';for(var _0x7bf869=0x0;_0x7bf869<_0x2817a8[_0x3922('0x9')]['length'];_0x7bf869+=0x1){if(_0x2817a8[_0x3922('0x9')][_0x7bf869]['address']!==_0x243e17){if(!_[_0x3922('0x13')](_0x3dd5af)){_0x3dd5af+=',';}_0x3dd5af+=_0x2817a8[_0x3922('0x9')][_0x7bf869][_0x3922('0xc')]||_0x2817a8[_0x3922('0x9')][_0x7bf869]['address']||'';_0x3dd5af+='\x20<';_0x3dd5af+=_0x2817a8['value'][_0x7bf869][_0x3922('0xa')]?_0x2817a8[_0x3922('0x9')][_0x7bf869][_0x3922('0xa')]:_0x3922('0x14')+random[_0x3922('0xb')](0x6)+_0x3922('0x15');_0x3dd5af+='>';}}return _0x3dd5af;}function parseEmail(_0x3076e0,_0x2b46a7,_0x3a553d){if(_0x2b46a7[_0x3922('0x16')]){var _0x12d33d=/)<[^<]*)*<\/script>/gi;while(_0x12d33d[_0x3922('0x17')](_0x2b46a7[_0x3922('0x16')])){_0x2b46a7[_0x3922('0x16')]=_0x2b46a7[_0x3922('0x16')][_0x3922('0x18')](_0x12d33d,'');}if(_0x2b46a7[_0x3922('0x16')][_0x3922('0x19')](_0x3922('0x1a'))){var _0x7257b=[];_0x2b46a7['attachments']['forEach'](_0x38aae4=>{_0x7257b[_0x3922('0x1b')](_0x38aae4[_0x3922('0x1c')]);});var _0x322999=/]+>/g;var _0x1f5088=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4fa9f1=_0x2b46a7[_0x3922('0x16')]['replace'](_0x1f5088,_0x3922('0x1d'));var _0x5d1033=_0x4fa9f1['replace'](_0x322999,_0x3922('0x1e'));for(let _0x3a1491=0x0;_0x3a1491<_0x7257b[_0x3922('0xf')];_0x3a1491++){var _0x539807=_0x5d1033[_0x3922('0x18')](_0x3922('0x1e'),'\x20[Attachment:\x20'+_0x7257b[_0x3a1491]+_0x3922('0x1f'));_0x5d1033=_0x539807;}_0x2b46a7[_0x3922('0x16')]=_0x5d1033;}_0x3a553d[_0x3922('0x20')]=_0x2b46a7[_0x3922('0x16')];}else{_0x3a553d['body']=_0x2b46a7['textAsHtml'];}if(_0x3a553d[_0x3922('0x20')]){_0x3a553d['body']=_0x3a553d[_0x3922('0x20')][_0x3922('0x18')](/0x0){var _0x11fc11=[_0x3922('0x30'),_0x3922('0x31'),'Precedence:\x20auto_reply'];for(var _0x524927=0x0;_0x524927<_0x2b46a7[_0x3922('0x2f')][_0x3922('0xf')];_0x524927++){var _0x22bc76=_[_0x3922('0xd')](_0x11fc11,_0x2b46a7[_0x3922('0x2f')][_0x524927]['line']);if(_0x22bc76>=0x0){_0x3a553d[_0x3922('0x32')]=!![];}}}return _0x3a553d;}exports['parser']=function(_0x161e51,_0x571670,_0x3f1f96){var _0x1813fa={'from':getAddress(_0x571670[_0x3922('0x33')]),'firstName':getFirstName(_0x571670[_0x3922('0x33')]),'lastName':getLastName(_0x571670[_0x3922('0x33')]),'mapKey':_0x3922('0x7'),'message':{'from':getMails(_0x161e51[_0x3922('0x7')],_0x571670[_0x3922('0x33')]),'to':_0x161e51[_0x3922('0x7')],'cc':'','subject':_0x571670['subject']||'','messageId':_0x571670[_0x3922('0x34')],'inReplyTo':_0x571670[_0x3922('0x35')],'sentAt':moment(_0x571670['date'])['format'](_0x3922('0x36')),'attach':![],'attachments':[]}};if(!_0x571670[_0x3922('0x16')]&&!_0x571670[_0x3922('0x37')]){var _0x2f5e41=_[_0x3922('0x38')](_0x571670['attachments'],{'contentType':_0x3922('0x39')});if(_0x2f5e41[_0x3922('0xf')]){logger['info'](util[_0x3922('0x29')](_0x3922('0x3a'),_0x571670[_0x3922('0x34')]));tnef[_0x3922('0x3b')](_['first'](_0x2f5e41)[_0x3922('0x2d')],function(_0x1f299c,_0x526b75){if(_0x526b75){_0x571670[_0x3922('0x16')]=_0x526b75['BodyHTML']||_0x3922('0x3c');if(_0x526b75[_0x3922('0x3d')]){for(var _0x71de33=0x0;_0x71de33<_0x526b75[_0x3922('0x3d')][_0x3922('0xf')];_0x71de33++){var _0x3879e0=_0x526b75[_0x3922('0x3d')][_0x71de33];_0x1813fa[_0x3922('0x21')]['attachments'][_0x3922('0x1b')]({'filename':_0x3879e0['Title'],'content':Buffer[_0x3922('0x33')](_0x3879e0[_0x3922('0x3e')])});}}}_0x3f1f96(parseEmail(_0x161e51,_0x571670,_0x1813fa));});}else{_0x571670[_0x3922('0x16')]=_0x3922('0x3c');_0x3f1f96(parseEmail(_0x161e51,_0x571670,_0x1813fa));}}else{_0x3f1f96(parseEmail(_0x161e51,_0x571670,_0x1813fa));}};exports[_0x3922('0x3f')]=function(_0x43b5ed,_0x47a16e){var _0x1baaff=[_0x3922('0x40')+(_0x47a16e||''),_0x3922('0x41')+_0x43b5ed,'',''];return Buffer[_0x3922('0x33')](_0x1baaff[_0x3922('0x11')](''),_0x3922('0x42'))[_0x3922('0x43')](_0x3922('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 28cf6e8..6195433 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 _0xb0c4=['lodash','name','Service','key','SERV','active','Smtp'];(function(_0x351aad,_0x146763){var _0x3f4ef4=function(_0x51c4a2){while(--_0x51c4a2){_0x351aad['push'](_0x351aad['shift']());}};_0x3f4ef4(++_0x146763);}(_0xb0c4,0x10a));var _0x4b0c=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0xb0c4[_0x2850c0];return _0x21e830;};'use strict';var _=require(_0x4b0c('0x0'));function MailAccount(_0x34988e){this['id']=_0x34988e['id']||0x0;this[_0x4b0c('0x1')]=_0x34988e['name']||_0x4b0c('0x2');this[_0x4b0c('0x3')]=_0x34988e[_0x4b0c('0x3')]||_0x4b0c('0x4');this[_0x4b0c('0x5')]=_0x34988e[_0x4b0c('0x5')]||![];this['Imap']=_0x34988e['Imap']||[];this[_0x4b0c('0x6')]=_0x34988e[_0x4b0c('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x8915=['name','Service','key','active','Imap','Smtp','exports','lodash'];(function(_0x1a0f0b,_0x14f695){var _0x5b7d46=function(_0x27e3fb){while(--_0x27e3fb){_0x1a0f0b['push'](_0x1a0f0b['shift']());}};_0x5b7d46(++_0x14f695);}(_0x8915,0x137));var _0x5891=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x8915[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0x5891('0x0'));function MailAccount(_0x31ae3a){this['id']=_0x31ae3a['id']||0x0;this[_0x5891('0x1')]=_0x31ae3a['name']||_0x5891('0x2');this[_0x5891('0x3')]=_0x31ae3a[_0x5891('0x3')]||'SERV';this[_0x5891('0x4')]=_0x31ae3a['active']||![];this[_0x5891('0x5')]=_0x31ae3a[_0x5891('0x5')]||[];this['Smtp']=_0x31ae3a[_0x5891('0x6')]||[];}module[_0x5891('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index b932558..ef6f5d8 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 _0xbd69=['mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','merge','exports','lodash','../model/mailAccount'];(function(_0x2fd5c3,_0x2a5b6b){var _0x2752ca=function(_0x21162a){while(--_0x21162a){_0x2fd5c3['push'](_0x2fd5c3['shift']());}};_0x2752ca(++_0x2a5b6b);}(_0xbd69,0x198));var _0x9bd6=function(_0x25a081,_0xe0ca73){_0x25a081=_0x25a081-0x0;var _0x188ad7=_0xbd69[_0x25a081];return _0x188ad7;};'use strict';var _=require(_0x9bd6('0x0'));var MailAccount=require(_0x9bd6('0x1'));var Realtime=function(){this[_0x9bd6('0x2')]={};};function freeIsNotKey(_0xfc764c,_0x476c0a,_0x4bbff1){var _0x4a7853=_[_0x9bd6('0x3')](_0xfc764c,function(_0x3a9757,_0x1e7689){return _0x3a9757[_0x4bbff1];});for(var _0x27129c in _0x476c0a){if(_0x476c0a[_0x9bd6('0x4')](_0x27129c)){if(!_0x4a7853[_0x27129c]){delete _0x476c0a[_0x27129c];}}}}Realtime[_0x9bd6('0x5')]['mergeFromDatabase']=function(_0x16c0da,_0x12cb3d){for(var _0x5b1413 in _0x12cb3d){if(_0x16c0da[_0x9bd6('0x4')](_0x5b1413)){_0x16c0da[_0x5b1413]=_0x12cb3d[_0x5b1413];}}};Realtime[_0x9bd6('0x5')][_0x9bd6('0x6')]=function(){var _0x4548b4=this;return function(_0x5ee346){if(_0x5ee346){freeIsNotKey(_0x5ee346,_0x4548b4['mailAccounts'],'id');for(var _0x3e379e=0x0,_0x43754e={},_0x51a695={};_0x3e379e<_0x5ee346[_0x9bd6('0x7')];_0x3e379e+=0x1){_0x43754e=_0x5ee346[_0x3e379e];if(_['isUndefined'](_0x4548b4['mailAccounts'][_0x43754e['id']])){_0x4548b4[_0x9bd6('0x2')][_0x43754e['id']]=new MailAccount(_0x43754e);}else{_[_0x9bd6('0x8')](_0x4548b4[_0x9bd6('0x2')][_0x43754e['id']],_0x43754e);}}}return _0x4548b4[_0x9bd6('0x2')];};};module[_0x9bd6('0x9')]=Realtime; \ No newline at end of file +var _0x082b=['merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','initMailAccounts','length','isUndefined'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0x082b,0x105));var _0xb082=function(_0x14e6af,_0x6a8a7a){_0x14e6af=_0x14e6af-0x0;var _0x511341=_0x082b[_0x14e6af];return _0x511341;};'use strict';var _=require(_0xb082('0x0'));var MailAccount=require(_0xb082('0x1'));var Realtime=function(){this[_0xb082('0x2')]={};};function freeIsNotKey(_0xb9dbb5,_0x576704,_0x17f6d2){var _0x138666=_[_0xb082('0x3')](_0xb9dbb5,function(_0x1d5160,_0x4a80a8){return _0x1d5160[_0x17f6d2];});for(var _0x135b32 in _0x576704){if(_0x576704[_0xb082('0x4')](_0x135b32)){if(!_0x138666[_0x135b32]){delete _0x576704[_0x135b32];}}}}Realtime[_0xb082('0x5')]['mergeFromDatabase']=function(_0x3cde13,_0x32e630){for(var _0xc05ca5 in _0x32e630){if(_0x3cde13[_0xb082('0x4')](_0xc05ca5)){_0x3cde13[_0xc05ca5]=_0x32e630[_0xc05ca5];}}};Realtime[_0xb082('0x5')][_0xb082('0x6')]=function(){var _0x58e1af=this;return function(_0x21b386){if(_0x21b386){freeIsNotKey(_0x21b386,_0x58e1af[_0xb082('0x2')],'id');for(var _0x269763=0x0,_0x1ca941={},_0x498dc6={};_0x269763<_0x21b386[_0xb082('0x7')];_0x269763+=0x1){_0x1ca941=_0x21b386[_0x269763];if(_[_0xb082('0x8')](_0x58e1af[_0xb082('0x2')][_0x1ca941['id']])){_0x58e1af[_0xb082('0x2')][_0x1ca941['id']]=new MailAccount(_0x1ca941);}else{_[_0xb082('0x9')](_0x58e1af[_0xb082('0x2')][_0x1ca941['id']],_0x1ca941);}}}return _0x58e1af[_0xb082('0x2')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 17c68b0..35bdf44 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 _0xbff5=['getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','active','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','Smtp'];(function(_0x5da984,_0x47e5c1){var _0x4cf0aa=function(_0x3e804c){while(--_0x3e804c){_0x5da984['push'](_0x5da984['shift']());}};_0x4cf0aa(++_0x47e5c1);}(_0xbff5,0x1bc));var _0x5bff=function(_0x2c6cad,_0x1490a4){_0x2c6cad=_0x2c6cad-0x0;var _0x76eee=_0xbff5[_0x2c6cad];return _0x76eee;};'use strict';var client=require(_0x5bff('0x0'));exports[_0x5bff('0x1')]=function(){return function(){return client[_0x5bff('0x2')](_0x5bff('0x3'),{'options':{'attributes':['id',_0x5bff('0x4'),_0x5bff('0x5'),_0x5bff('0x6'),'email',_0x5bff('0x7'),'key','ListId',_0x5bff('0x8')],'raw':![],'include':[{'model':_0x5bff('0x9'),'as':_0x5bff('0xa'),'include':[{'model':_0x5bff('0xb'),'attributes':['id',_0x5bff('0x4'),_0x5bff('0x6'),_0x5bff('0xc'),_0x5bff('0xd')],'as':_0x5bff('0xb')}]},{'model':'MailServerOut','as':_0x5bff('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x5bff('0x4'),_0x5bff('0x6'),'type',_0x5bff('0xd')],'as':'CloudProvider'}]}]},'log':_0x5bff('0xf')});};};exports['notify']=function(_0x207835,_0x135003){return client['Request'](_0x5bff('0x10'),{'account':{'id':_0x207835},'body':_0x135003,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x444e=['MailServerIn','Imap','type','CloudProvider','MailServerOut','Smtp','NotifyMailAccount','../client','Request','name','service','active','key','ListId','TemplateId'];(function(_0x279807,_0x37247f){var _0x8d628=function(_0x15c624){while(--_0x15c624){_0x279807['push'](_0x279807['shift']());}};_0x8d628(++_0x37247f);}(_0x444e,0xe8));var _0xe444=function(_0x1741c8,_0x4d943f){_0x1741c8=_0x1741c8-0x0;var _0x1614d8=_0x444e[_0x1741c8];return _0x1614d8;};'use strict';var client=require(_0xe444('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xe444('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0xe444('0x2'),'provider',_0xe444('0x3'),'email',_0xe444('0x4'),_0xe444('0x5'),_0xe444('0x6'),_0xe444('0x7')],'raw':![],'include':[{'model':_0xe444('0x8'),'as':_0xe444('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0xe444('0x2'),'service',_0xe444('0xa'),'data5'],'as':_0xe444('0xb')}]},{'model':_0xe444('0xc'),'as':_0xe444('0xd'),'include':[{'model':'CloudProvider','attributes':['id','name',_0xe444('0x3'),_0xe444('0xa'),'data5'],'as':_0xe444('0xb')}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x390347,_0x4cb1b6){return client[_0xe444('0x1')](_0xe444('0xe'),{'account':{'id':_0x390347},'body':_0x4cb1b6,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index b47d51b..cf2c4f2 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 _0x41a7=['GetSettings','../client','Request','ShowSetting'];(function(_0x2627e5,_0x5b8a5c){var _0x14a553=function(_0x3b2aff){while(--_0x3b2aff){_0x2627e5['push'](_0x2627e5['shift']());}};_0x14a553(++_0x5b8a5c);}(_0x41a7,0x101));var _0x741a=function(_0x3b87e6,_0xd3df37){_0x3b87e6=_0x3b87e6-0x0;var _0x132778=_0x41a7[_0x3b87e6];return _0x132778;};'use strict';var client=require(_0x741a('0x0'));exports['getSettings']=function(){return client[_0x741a('0x1')](_0x741a('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x741a('0x3')});}; \ No newline at end of file +var _0x07d2=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0x07d2,0xf4));var _0x207d=function(_0x5ba736,_0x4b1c30){_0x5ba736=_0x5ba736-0x0;var _0xd6b66d=_0x07d2[_0x5ba736];return _0xd6b66d;};'use strict';var client=require(_0x207d('0x0'));exports[_0x207d('0x1')]=function(){return client['Request'](_0x207d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x207d('0x3')]},'log':_0x207d('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a6357a1..ed42600 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 3b8ac07..dbedc25 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 _0xd9f9=['socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','sticky-session','../../config/environment','createServer','timeout','listen','socket.io','websocket','redis','defaults','localhost'];(function(_0x1d73ab,_0x4db32c){var _0x2ed1df=function(_0x245cc6){while(--_0x245cc6){_0x1d73ab['push'](_0x1d73ab['shift']());}};_0x2ed1df(++_0x4db32c);}(_0xd9f9,0x17b));var _0x9d9f=function(_0x5e9840,_0x1a8fac){_0x5e9840=_0x5e9840-0x0;var _0x213781=_0xd9f9[_0x5e9840];return _0x213781;};'use strict';var _=require(_0x9d9f('0x0'));var http=require('http');var express=require(_0x9d9f('0x1'));var sticky=require(_0x9d9f('0x2'));var Redis=require('ioredis');var config=require(_0x9d9f('0x3'));var app=express();var server=http[_0x9d9f('0x4')](app);server[_0x9d9f('0x5')]=0xdbba0;if(sticky[_0x9d9f('0x6')](server,config['port'])){var socketio=require(_0x9d9f('0x7'))(server,{'transports':[_0x9d9f('0x8'),'polling']});config[_0x9d9f('0x9')]=_[_0x9d9f('0xa')](config[_0x9d9f('0x9')],{'host':_0x9d9f('0xb'),'port':0x18eb});socketio['adapter'](require(_0x9d9f('0xc'))({'pubClient':new Redis(config[_0x9d9f('0x9')]),'subClient':new Redis(config[_0x9d9f('0x9')])}));require(_0x9d9f('0xd'))[_0x9d9f('0xe')]();require(_0x9d9f('0xf'))[_0x9d9f('0xe')](socketio);require(_0x9d9f('0x10'))[_0x9d9f('0xe')](app);require(_0x9d9f('0x11'))[_0x9d9f('0xe')](app);}else{server['once'](_0x9d9f('0x12'),function(){console[_0x9d9f('0x13')](_0x9d9f('0x14'),config[_0x9d9f('0x15')]);});}exports=module[_0x9d9f('0x16')]=app; \ No newline at end of file +var _0xcea3=['adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../routes','once','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','createServer','timeout','listen','port','websocket','polling','redis','localhost'];(function(_0x273c8d,_0x49fe05){var _0x4e287f=function(_0x2ec21e){while(--_0x2ec21e){_0x273c8d['push'](_0x273c8d['shift']());}};_0x4e287f(++_0x49fe05);}(_0xcea3,0xa3));var _0x3cea=function(_0x3f333b,_0x2a50c1){_0x3f333b=_0x3f333b-0x0;var _0x91606c=_0xcea3[_0x3f333b];return _0x91606c;};'use strict';var _=require(_0x3cea('0x0'));var http=require(_0x3cea('0x1'));var express=require(_0x3cea('0x2'));var sticky=require(_0x3cea('0x3'));var Redis=require(_0x3cea('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0x3cea('0x5')](app);server[_0x3cea('0x6')]=0xdbba0;if(sticky[_0x3cea('0x7')](server,config[_0x3cea('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x3cea('0x9'),_0x3cea('0xa')]});config[_0x3cea('0xb')]=_['defaults'](config[_0x3cea('0xb')],{'host':_0x3cea('0xc'),'port':0x18eb});socketio[_0x3cea('0xd')](require(_0x3cea('0xe'))({'pubClient':new Redis(config[_0x3cea('0xb')]),'subClient':new Redis(config[_0x3cea('0xb')])}));require(_0x3cea('0xf'))['default']();require(_0x3cea('0x10'))[_0x3cea('0x11')](socketio);require('../../config/express')[_0x3cea('0x11')](app);require(_0x3cea('0x12'))[_0x3cea('0x11')](app);}else{server[_0x3cea('0x13')]('listening',function(){console['log'](_0x3cea('0x14'),config['port']);});}exports=module[_0x3cea('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e600ac4..b0b2847 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 _0xc8a5=['debug','error','rpc','result','catch','exports','jayson/promise','bluebird','routing','Request','request'];(function(_0x1ac035,_0x31012b){var _0x1148bf=function(_0x515d7e){while(--_0x515d7e){_0x1ac035['push'](_0x1ac035['shift']());}};_0x1148bf(++_0x31012b);}(_0xc8a5,0x7f));var _0x5c8a=function(_0x47f00d,_0x536faf){_0x47f00d=_0x47f00d-0x0;var _0x24e599=_0xc8a5[_0x47f00d];return _0x24e599;};'use strict';var jayson=require(_0x5c8a('0x0'));var BPromise=require(_0x5c8a('0x1'));var logger=require('../../config/logger')(_0x5c8a('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0x5c8a('0x3')]=function(_0x1374cf,_0x2bf02b){return new BPromise(function(_0x1f5896,_0xdbd8e4){return client[_0x5c8a('0x4')](_0x1374cf,_0x2bf02b)['then'](function(_0x4b3da8){logger[_0x5c8a('0x5')]('rpc','routing',_0x1374cf,_0x2bf02b,_0x4b3da8);if(_0x4b3da8[_0x5c8a('0x6')]){logger[_0x5c8a('0x6')](_0x5c8a('0x7'),'routing',_0x1374cf,_0x4b3da8[_0x5c8a('0x6')]['message'],_0x2bf02b);return _0xdbd8e4(_0x4b3da8[_0x5c8a('0x6')]['message']);}else{return _0x1f5896(_0x4b3da8[_0x5c8a('0x8')]);}})[_0x5c8a('0x9')](function(_0x458335){logger[_0x5c8a('0x6')](_0x5c8a('0x7'),_0x5c8a('0x2'),_0x1374cf,_0x458335,_0x2bf02b);return _0xdbd8e4(_0x458335);});});};module[_0x5c8a('0xa')]=client; \ No newline at end of file +var _0x18a3=['catch','exports','jayson/promise','routing','client','http','request','debug','error','rpc','message'];(function(_0x323419,_0x2a6172){var _0x4c0be7=function(_0x5ae2df){while(--_0x5ae2df){_0x323419['push'](_0x323419['shift']());}};_0x4c0be7(++_0x2a6172);}(_0x18a3,0xc8));var _0x318a=function(_0x307686,_0x154c9e){_0x307686=_0x307686-0x0;var _0x1a0bce=_0x18a3[_0x307686];return _0x1a0bce;};'use strict';var jayson=require(_0x318a('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x318a('0x1'));var client=jayson[_0x318a('0x2')][_0x318a('0x3')]({'port':0x2329});client['Request']=function(_0x3f6006,_0x25923b){return new BPromise(function(_0x1182a7,_0x594882){return client[_0x318a('0x4')](_0x3f6006,_0x25923b)['then'](function(_0x1ab303){logger[_0x318a('0x5')]('rpc',_0x318a('0x1'),_0x3f6006,_0x25923b,_0x1ab303);if(_0x1ab303[_0x318a('0x6')]){logger[_0x318a('0x6')](_0x318a('0x7'),_0x318a('0x1'),_0x3f6006,_0x1ab303['error'][_0x318a('0x8')],_0x25923b);return _0x594882(_0x1ab303[_0x318a('0x6')][_0x318a('0x8')]);}else{return _0x1182a7(_0x1ab303['result']);}})[_0x318a('0x9')](function(_0x42019f){logger[_0x318a('0x6')](_0x318a('0x7'),_0x318a('0x1'),_0x3f6006,_0x42019f,_0x25923b);return _0x594882(_0x42019f);});});};module[_0x318a('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 7c54f29..678b359 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 _0x7f17=['initWhatsappQueues','catch','bluebird','./server','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getFaxQueues'];(function(_0x492273,_0x4cd32c){var _0x1ace99=function(_0x516edb){while(--_0x516edb){_0x492273['push'](_0x492273['shift']());}};_0x1ace99(++_0x4cd32c);}(_0x7f17,0xca));var _0x77f1=function(_0x1249f4,_0x27226c){_0x1249f4=_0x1249f4-0x0;var _0x47c8a9=_0x7f17[_0x1249f4];return _0x47c8a9;};'use strict';var BPromise=require(_0x77f1('0x0'));var server=require(_0x77f1('0x1'));var Realtime=require('./realtime');var user=require(_0x77f1('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x77f1('0x3'));var chatQueue=require(_0x77f1('0x4'));var smsQueue=require(_0x77f1('0x5'));var mailQueue=require(_0x77f1('0x6'));var faxQueue=require(_0x77f1('0x7'));var whatsappQueue=require(_0x77f1('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x77f1('0x9')]()[_0x77f1('0xa')](user[_0x77f1('0xb')]())[_0x77f1('0xa')](realtime['initAgents']())['then'](interval[_0x77f1('0xc')]())[_0x77f1('0xa')](realtime['initIntervals']())[_0x77f1('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x77f1('0xa')](realtime[_0x77f1('0xd')]())[_0x77f1('0xa')](chatQueue[_0x77f1('0xe')]())[_0x77f1('0xa')](realtime['initChatQueues']())[_0x77f1('0xa')](smsQueue[_0x77f1('0xf')]())[_0x77f1('0xa')](realtime[_0x77f1('0x10')]())[_0x77f1('0xa')](mailQueue['getMailQueues']())[_0x77f1('0xa')](realtime['initMailQueues']())[_0x77f1('0xa')](faxQueue[_0x77f1('0x11')]())[_0x77f1('0xa')](realtime['initFaxQueues']())[_0x77f1('0xa')](whatsappQueue['getWhatsappQueues']())[_0x77f1('0xa')](realtime[_0x77f1('0x12')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x4f17fe){return initRealtime();})[_0x77f1('0xa')](function(_0x41a2d7){return setInterval(initRealtime,0x1388);})[_0x77f1('0x13')](function(_0x25bffb){console['log'](_0x25bffb);});}main(); \ No newline at end of file +var _0x70e6=['initOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','getOpenchannelQueues'];(function(_0x26e2e8,_0x105b22){var _0x238da5=function(_0x55835f){while(--_0x55835f){_0x26e2e8['push'](_0x26e2e8['shift']());}};_0x238da5(++_0x105b22);}(_0x70e6,0xc2));var _0x670e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x70e6[_0x2bf141];return _0x48277b;};'use strict';var BPromise=require(_0x670e('0x0'));var server=require(_0x670e('0x1'));var Realtime=require('./realtime');var user=require(_0x670e('0x2'));var interval=require(_0x670e('0x3'));var openchannelQueue=require(_0x670e('0x4'));var chatQueue=require(_0x670e('0x5'));var smsQueue=require(_0x670e('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x670e('0x7'));var whatsappQueue=require(_0x670e('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x670e('0x9')](user['getAgents']())[_0x670e('0x9')](realtime[_0x670e('0xa')]())[_0x670e('0x9')](interval[_0x670e('0xb')]())[_0x670e('0x9')](realtime['initIntervals']())[_0x670e('0x9')](openchannelQueue[_0x670e('0xc')]())[_0x670e('0x9')](realtime[_0x670e('0xd')]())[_0x670e('0x9')](chatQueue['getChatQueues']())[_0x670e('0x9')](realtime['initChatQueues']())[_0x670e('0x9')](smsQueue[_0x670e('0xe')]())['then'](realtime[_0x670e('0xf')]())[_0x670e('0x9')](mailQueue[_0x670e('0x10')]())[_0x670e('0x9')](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0x670e('0x9')](realtime[_0x670e('0x11')]())['then'](whatsappQueue[_0x670e('0x12')]())[_0x670e('0x9')](realtime[_0x670e('0x13')]())[_0x670e('0x9')](function(){return realtime;});}function main(){return server[_0x670e('0x14')](realtime)['then'](function(_0x4476ed){return initRealtime();})['then'](function(_0x5c865d){return setInterval(initRealtime,0x1388);})[_0x670e('0x15')](function(_0x3e07a){console[_0x670e('0x16')](_0x3e07a);});}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 e42c801..8c6ed95 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x27b0c4,_0xaf6d02){var _0xcb87b2=function(_0x2bd20f){while(--_0x2bd20f){_0x27b0c4['push'](_0x27b0c4['shift']());}};_0xcb87b2(++_0xaf6d02);}(_0x326f,0xd1));var _0xf326=function(_0x2b4a39,_0x4c7979){_0x2b4a39=_0x2b4a39-0x0;var _0x4e0f68=_0x326f[_0x2b4a39];return _0x4e0f68;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x1bd740,_0x3a2dbf){var _0x28b53f=function(_0x1793ca){while(--_0x1793ca){_0x1bd740['push'](_0x1bd740['shift']());}};_0x28b53f(++_0x3a2dbf);}(_0xe14b,0x93));var _0xbe14=function(_0x39db9e,_0x4569ae){_0x39db9e=_0x39db9e-0x0;var _0x5a7a01=_0xe14b[_0x39db9e];return _0x5a7a01;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 1a5116f..b6cda3a 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 _0x6249=['sendMailMessage','SendMail','bluebird','jayson/promise','http','request','then','error','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6249,0xd4));var _0x9624=function(_0x320584,_0x2e6e3b){_0x320584=_0x320584-0x0;var _0x9e355a=_0x6249[_0x320584];return _0x9e355a;};'use strict';var BPromise=require(_0x9624('0x0'));var jayson=require(_0x9624('0x1'));var client=jayson['client'][_0x9624('0x2')]({'port':0x232b});function request(_0x583ca9,_0x3085f3){return new BPromise(function(_0x1d338f,_0x166209){return client[_0x9624('0x3')](_0x583ca9,_0x3085f3)[_0x9624('0x4')](function(_0xe525dd){if(_0xe525dd[_0x9624('0x5')]){return _0x166209(_0xe525dd['error']['message']);}else{return _0x1d338f(_0xe525dd[_0x9624('0x6')]);}})[_0x9624('0x7')](function(_0x505e78){return _0x166209(_0x505e78);});});}exports[_0x9624('0x8')]=function(_0x442c9c,_0x5df602){return request(_0x9624('0x9'),{'account':_0x442c9c,'message':_0x5df602});}; \ No newline at end of file +var _0x134f=['error','message','result','catch','SendMail','bluebird','jayson/promise','client','http','request','then'];(function(_0x3b67e4,_0x2a5d46){var _0x21adcf=function(_0x3b0243){while(--_0x3b0243){_0x3b67e4['push'](_0x3b67e4['shift']());}};_0x21adcf(++_0x2a5d46);}(_0x134f,0x186));var _0xf134=function(_0x15f325,_0x24ff39){_0x15f325=_0x15f325-0x0;var _0x433de1=_0x134f[_0x15f325];return _0x433de1;};'use strict';var BPromise=require(_0xf134('0x0'));var jayson=require(_0xf134('0x1'));var client=jayson[_0xf134('0x2')][_0xf134('0x3')]({'port':0x232b});function request(_0x1aa348,_0x1dd5e2){return new BPromise(function(_0x530909,_0x421899){return client[_0xf134('0x4')](_0x1aa348,_0x1dd5e2)[_0xf134('0x5')](function(_0x16d28d){if(_0x16d28d[_0xf134('0x6')]){return _0x421899(_0x16d28d['error'][_0xf134('0x7')]);}else{return _0x530909(_0x16d28d[_0xf134('0x8')]);}})[_0xf134('0x9')](function(_0x46a9dc){return _0x421899(_0x46a9dc);});});}exports['sendMailMessage']=function(_0x12ff43,_0x13fbe6){return request(_0xf134('0xa'),{'account':_0x12ff43,'message':_0x13fbe6});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5707759..117426d 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 _0xf630=['stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','Capacity','CurrentCapacity','maxcapacity','working','idle','prototype','openchannel','fax','sms','whatsapp','length','getChannelStatus','StatusTime','toNumber','format','Status','mailStatus','faxStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy'];(function(_0x5da45a,_0xeb5d80){var _0xa7f98d=function(_0x3eefed){while(--_0x3eefed){_0x5da45a['push'](_0x5da45a['shift']());}};_0xa7f98d(++_0xeb5d80);}(_0xf630,0xd3));var _0x0f63=function(_0x1fd4f0,_0x5bac6d){_0x1fd4f0=_0x1fd4f0-0x0;var _0x1cd3d4=_0xf630[_0x1fd4f0];return _0x1cd3d4;};'use strict';var _=require(_0x0f63('0x0'));var moment=require(_0x0f63('0x1'));var md5=require(_0x0f63('0x2'));var Redis=require(_0x0f63('0x3'));var config=require(_0x0f63('0x4'));config[_0x0f63('0x5')]=_[_0x0f63('0x6')](config[_0x0f63('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0f63('0x7'))(new Redis(config[_0x0f63('0x5')]));function Agent(_0x35f889){this['id']=_0x35f889['id']||0x0;this['name']=_0x35f889[_0x0f63('0x8')]||'';this[_0x0f63('0x9')]=_0x35f889[_0x0f63('0x9')]||!![];this[_0x0f63('0xa')]=_0x35f889[_0x0f63('0xa')]||![];this[_0x0f63('0xb')]=_0x35f889[_0x0f63('0xb')]||![];this['mailPause']=_0x35f889[_0x0f63('0xc')]||![];this[_0x0f63('0xd')]=_0x35f889[_0x0f63('0xd')]||![];this['smsPause']=_0x35f889[_0x0f63('0xe')]||![];this[_0x0f63('0xf')]=_0x35f889[_0x0f63('0xf')]||![];this[_0x0f63('0x10')]=_0x0f63('0x11');this[_0x0f63('0x12')]=0x0;this[_0x0f63('0x13')]=_0x35f889[_0x0f63('0x13')]||0x0;this[_0x0f63('0x14')]=0x0;this['mailStatus']=_0x0f63('0x11');this[_0x0f63('0x15')]=0x0;this[_0x0f63('0x16')]=_0x35f889['mailCapacity']||0x0;this[_0x0f63('0x17')]=0x0;this[_0x0f63('0x18')]=_0x0f63('0x11');this['faxStatusTime']=0x0;this[_0x0f63('0x19')]=_0x35f889[_0x0f63('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x0f63('0x1a')]=_0x0f63('0x11');this[_0x0f63('0x1b')]=0x0;this['smsCapacity']=_0x35f889[_0x0f63('0x1c')]||0x0;this[_0x0f63('0x1d')]=0x0;this[_0x0f63('0x1e')]=_0x0f63('0x11');this[_0x0f63('0x1f')]=0x0;this[_0x0f63('0x20')]=_0x35f889[_0x0f63('0x20')]||0x0;this[_0x0f63('0x21')]=0x0;this[_0x0f63('0x22')]=_0x0f63('0x11');this[_0x0f63('0x23')]=0x0;this['openchannelCapacity']=_0x35f889['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0x0f63('0x24')]=undefined;this['md5']='';this[_0x0f63('0x25')]={};this[_0x0f63('0x26')]={};this[_0x0f63('0x27')]={};this[_0x0f63('0x28')]={};this[_0x0f63('0x29')]={};this[_0x0f63('0x2a')]={};this[_0x0f63('0x2b')]();}Agent['prototype']['getChannelStatus']=function(_0x268ce5){if(this[_0x268ce5+'CurrentCapacity']>0x0){if(this[_0x268ce5+_0x0f63('0x2c')]>0x0&&this[_0x268ce5+_0x0f63('0x2d')]>=this[_0x268ce5+_0x0f63('0x2c')]){return _0x0f63('0x2e');}else{return _0x0f63('0x2f');}}else{return _0x0f63('0x30');}};Agent[_0x0f63('0x31')]['updateRealtime']=function(){var _0x14288e=['mail','chat',_0x0f63('0x32'),_0x0f63('0x33'),_0x0f63('0x34'),_0x0f63('0x35')];for(var _0x2b9ca2=0x0;_0x2b9ca2<_0x14288e[_0x0f63('0x36')];_0x2b9ca2+=0x1){var _0x3689f6=this[_0x0f63('0x37')](_0x14288e[_0x2b9ca2]);if(this[_0x14288e[_0x2b9ca2]+'Status']!==_0x3689f6){this[_0x14288e[_0x2b9ca2]+_0x0f63('0x38')]=_[_0x0f63('0x39')](moment()[_0x0f63('0x3a')]('x'));}this[_0x14288e[_0x2b9ca2]+_0x0f63('0x3b')]=_0x3689f6;}var _0x4eb075={'id':this['id'],'name':this[_0x0f63('0x8')],'online':this[_0x0f63('0x9')],'voicePause':this[_0x0f63('0xa')],'chatPause':this[_0x0f63('0xb')],'mailPause':this[_0x0f63('0xc')],'smsPause':this[_0x0f63('0xe')],'faxPause':this[_0x0f63('0xd')],'openchannelPause':this[_0x0f63('0xf')],'chatStatus':this[_0x0f63('0x10')],'chatStatusTime':this[_0x0f63('0x12')],'chatCapacity':this[_0x0f63('0x13')],'chatCurrentCapacity':this[_0x0f63('0x14')],'mailStatus':this[_0x0f63('0x3c')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x0f63('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x0f63('0x3d')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x0f63('0x1a')],'smsStatusTime':this[_0x0f63('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x0f63('0x1d')],'whatsappStatus':this[_0x0f63('0x1e')],'whatsappStatusTime':this[_0x0f63('0x1f')],'whatsappCapacity':this[_0x0f63('0x20')],'whatsappCurrentCapacity':this[_0x0f63('0x21')],'openchannelStatus':this[_0x0f63('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x0f63('0x3e')],'openchannelCurrentCapacity':this[_0x0f63('0x3f')],'busy':this[_0x0f63('0x40')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x0f63('0x25')],'faxWaitingInteractions':this[_0x0f63('0x26')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x0f63('0x29')],'whatsappWaitingInteractions':this[_0x0f63('0x2a')]};var _0x18e344=md5(JSON[_0x0f63('0x41')](_0x4eb075));if(this[_0x0f63('0x2')]!==_0x18e344){this[_0x0f63('0x2')]=_0x18e344;io[_0x0f63('0x42')](_0x0f63('0x43'),_0x4eb075);}};module[_0x0f63('0x44')]=Agent; \ No newline at end of file +var _0xcc69=['mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','maxcapacity','idle','mail','chat','fax','sms','whatsapp','length','StatusTime','format','Status','chatCurrentCapacity','mailStatusTime','faxCapacity','openchannelCurrentCapacity','chatWaitingInteractions','stringify','emit','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcc69,0x12e));var _0x9cc6=function(_0x23c6f2,_0x4e033c){_0x23c6f2=_0x23c6f2-0x0;var _0x4c270b=_0xcc69[_0x23c6f2];return _0x4c270b;};'use strict';var _=require('lodash');var moment=require(_0x9cc6('0x0'));var md5=require(_0x9cc6('0x1'));var Redis=require(_0x9cc6('0x2'));var config=require(_0x9cc6('0x3'));config['redis']=_[_0x9cc6('0x4')](config[_0x9cc6('0x5')],{'host':_0x9cc6('0x6'),'port':0x18eb});var io=require(_0x9cc6('0x7'))(new Redis(config[_0x9cc6('0x5')]));function Agent(_0x721482){this['id']=_0x721482['id']||0x0;this[_0x9cc6('0x8')]=_0x721482[_0x9cc6('0x8')]||'';this['online']=_0x721482[_0x9cc6('0x9')]||!![];this[_0x9cc6('0xa')]=_0x721482['voicePause']||![];this[_0x9cc6('0xb')]=_0x721482[_0x9cc6('0xb')]||![];this['mailPause']=_0x721482[_0x9cc6('0xc')]||![];this[_0x9cc6('0xd')]=_0x721482['faxPause']||![];this[_0x9cc6('0xe')]=_0x721482[_0x9cc6('0xe')]||![];this[_0x9cc6('0xf')]=_0x721482['openchannelPause']||![];this[_0x9cc6('0x10')]='unknown';this[_0x9cc6('0x11')]=0x0;this['chatCapacity']=_0x721482['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0x9cc6('0x12')]='unknown';this['mailStatusTime']=0x0;this[_0x9cc6('0x13')]=_0x721482[_0x9cc6('0x13')]||0x0;this[_0x9cc6('0x14')]=0x0;this[_0x9cc6('0x15')]='unknown';this[_0x9cc6('0x16')]=0x0;this['faxCapacity']=_0x721482['faxCapacity']||0x0;this[_0x9cc6('0x17')]=0x0;this[_0x9cc6('0x18')]='unknown';this[_0x9cc6('0x19')]=0x0;this['smsCapacity']=_0x721482[_0x9cc6('0x1a')]||0x0;this[_0x9cc6('0x1b')]=0x0;this[_0x9cc6('0x1c')]='unknown';this[_0x9cc6('0x1d')]=0x0;this[_0x9cc6('0x1e')]=_0x721482[_0x9cc6('0x1e')]||0x0;this[_0x9cc6('0x1f')]=0x0;this[_0x9cc6('0x20')]='unknown';this['openchannelStatusTime']=0x0;this[_0x9cc6('0x21')]=_0x721482[_0x9cc6('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x9cc6('0x22')]=![];this[_0x9cc6('0x23')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0x9cc6('0x24')]={};this[_0x9cc6('0x25')]={};this[_0x9cc6('0x26')]={};this[_0x9cc6('0x27')]={};this[_0x9cc6('0x28')]={};this[_0x9cc6('0x29')]();}Agent[_0x9cc6('0x2a')][_0x9cc6('0x2b')]=function(_0x3ee266){if(this[_0x3ee266+'CurrentCapacity']>0x0){if(this[_0x3ee266+_0x9cc6('0x2c')]>0x0&&this[_0x3ee266+'CurrentCapacity']>=this[_0x3ee266+_0x9cc6('0x2c')]){return _0x9cc6('0x2d');}else{return'working';}}else{return _0x9cc6('0x2e');}};Agent[_0x9cc6('0x2a')][_0x9cc6('0x29')]=function(){var _0x49ced4=[_0x9cc6('0x2f'),_0x9cc6('0x30'),'openchannel',_0x9cc6('0x31'),_0x9cc6('0x32'),_0x9cc6('0x33')];for(var _0x4213d8=0x0;_0x4213d8<_0x49ced4[_0x9cc6('0x34')];_0x4213d8+=0x1){var _0x9da1ae=this[_0x9cc6('0x2b')](_0x49ced4[_0x4213d8]);if(this[_0x49ced4[_0x4213d8]+'Status']!==_0x9da1ae){this[_0x49ced4[_0x4213d8]+_0x9cc6('0x35')]=_['toNumber'](moment()[_0x9cc6('0x36')]('x'));}this[_0x49ced4[_0x4213d8]+_0x9cc6('0x37')]=_0x9da1ae;}var _0x163dfd={'id':this['id'],'name':this[_0x9cc6('0x8')],'online':this[_0x9cc6('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x9cc6('0xb')],'mailPause':this[_0x9cc6('0xc')],'smsPause':this[_0x9cc6('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0x9cc6('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x9cc6('0x38')],'mailStatus':this[_0x9cc6('0x12')],'mailStatusTime':this[_0x9cc6('0x39')],'mailCapacity':this[_0x9cc6('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x9cc6('0x15')],'faxStatusTime':this[_0x9cc6('0x16')],'faxCapacity':this[_0x9cc6('0x3a')],'faxCurrentCapacity':this[_0x9cc6('0x17')],'smsStatus':this[_0x9cc6('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x9cc6('0x1a')],'smsCurrentCapacity':this[_0x9cc6('0x1b')],'whatsappStatus':this[_0x9cc6('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x9cc6('0x1e')],'whatsappCurrentCapacity':this[_0x9cc6('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x9cc6('0x21')],'openchannelCurrentCapacity':this[_0x9cc6('0x3b')],'busy':this[_0x9cc6('0x22')],'busyQueue':this[_0x9cc6('0x23')],'chatWaitingInteractions':this[_0x9cc6('0x3c')],'faxWaitingInteractions':this[_0x9cc6('0x24')],'mailWaitingInteractions':this[_0x9cc6('0x25')],'openchannelWaitingInteractions':this[_0x9cc6('0x26')],'smsWaitingInteractions':this[_0x9cc6('0x27')],'whatsappWaitingInteractions':this[_0x9cc6('0x28')]};var _0x477701=md5(JSON[_0x9cc6('0x3d')](_0x163dfd));if(this[_0x9cc6('0x1')]!==_0x477701){this[_0x9cc6('0x1')]=_0x477701;io[_0x9cc6('0x3e')]('user:save',_0x163dfd);}};module[_0x9cc6('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 9551c9f..648b815 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 _0x4033=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','chatPause','available','stringify','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x4a6896,_0x16bd71){var _0x47b1ca=function(_0x843733){while(--_0x843733){_0x4a6896['push'](_0x4a6896['shift']());}};_0x47b1ca(++_0x16bd71);}(_0x4033,0xff));var _0x3403=function(_0x2d0953,_0x30bcf9){_0x2d0953=_0x2d0953-0x0;var _0x1e824a=_0x4033[_0x2d0953];return _0x1e824a;};'use strict';var _=require(_0x3403('0x0'));var md5=require(_0x3403('0x1'));var util=require(_0x3403('0x2'));var Redis=require(_0x3403('0x3'));var config=require(_0x3403('0x4'));config[_0x3403('0x5')]=_[_0x3403('0x6')](config[_0x3403('0x5')],{'host':_0x3403('0x7'),'port':0x18eb});var io=require(_0x3403('0x8'))(new Redis(config[_0x3403('0x5')]));function ChatQueue(_0x5b82f3){this['id']=_0x5b82f3['id']||0x0;this[_0x3403('0x9')]=_0x5b82f3[_0x3403('0x9')]||'';this[_0x3403('0xa')]=_0x5b82f3[_0x3403('0xa')]||0xa;this[_0x3403('0xb')]=_0x5b82f3['strategy']||_0x3403('0xc');this[_0x3403('0xd')]=_0x5b82f3[_0x3403('0xd')];this[_0x3403('0xe')]={};this[_0x3403('0xf')]=0x0;this[_0x3403('0x1')]='';this[_0x3403('0x10')]();this[_0x3403('0x11')]();}ChatQueue[_0x3403('0x12')][_0x3403('0x10')]=function(){var _0x3db66a=this['mapAgentsId'][_0x3403('0x13')];this[_0x3403('0xe')]=_[_0x3403('0x14')](this['Agents'],'id');this[_0x3403('0xe')][_0x3403('0x13')]=_0x3db66a;};ChatQueue[_0x3403('0x12')][_0x3403('0x11')]=function(){this[_0x3403('0x15')]=0x0;this[_0x3403('0x16')]=0x0;for(var _0x339896=0x0;_0x339896=0x0?this[_0x3403('0x19')]:0x0;var _0x21fa3f={'id':this['id'],'available':this[_0x3403('0x19')],'loggedIn':this[_0x3403('0x15')],'name':this[_0x3403('0x9')],'paused':this['paused'],'waiting':this[_0x3403('0xf')]};var _0x29a63c=md5(JSON[_0x3403('0x1a')](_0x21fa3f));if(this[_0x3403('0x1')]!==_0x29a63c){this[_0x3403('0x1')]=_0x29a63c;io['to'](util['format']('chat:queue:%s',_0x21fa3f[_0x3403('0x9')]))[_0x3403('0x1b')]('chat_queue:save',_0x21fa3f);}};module[_0x3403('0x1c')]=ChatQueue; \ No newline at end of file +var _0xac8c=['chatPause','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused','online'];(function(_0x162bb5,_0xad928){var _0x2e0e45=function(_0x2ca868){while(--_0x2ca868){_0x162bb5['push'](_0x162bb5['shift']());}};_0x2e0e45(++_0xad928);}(_0xac8c,0x115));var _0xcac8=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xac8c[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0xcac8('0x0'));var md5=require('md5');var util=require(_0xcac8('0x1'));var Redis=require(_0xcac8('0x2'));var config=require(_0xcac8('0x3'));config['redis']=_[_0xcac8('0x4')](config[_0xcac8('0x5')],{'host':_0xcac8('0x6'),'port':0x18eb});var io=require(_0xcac8('0x7'))(new Redis(config['redis']));function ChatQueue(_0x2a3d0e){this['id']=_0x2a3d0e['id']||0x0;this['name']=_0x2a3d0e[_0xcac8('0x8')]||'';this[_0xcac8('0x9')]=_0x2a3d0e[_0xcac8('0x9')]||0xa;this[_0xcac8('0xa')]=_0x2a3d0e[_0xcac8('0xa')]||_0xcac8('0xb');this[_0xcac8('0xc')]=_0x2a3d0e[_0xcac8('0xc')];this['mapAgentsId']={};this[_0xcac8('0xd')]=0x0;this[_0xcac8('0xe')]='';this[_0xcac8('0xf')]();this[_0xcac8('0x10')]();}ChatQueue[_0xcac8('0x11')][_0xcac8('0xf')]=function(){var _0x1209bc=this[_0xcac8('0x12')]['_rr'];this[_0xcac8('0x12')]=_[_0xcac8('0x13')](this['Agents'],'id');this[_0xcac8('0x12')]['_rr']=_0x1209bc;};ChatQueue[_0xcac8('0x11')][_0xcac8('0x10')]=function(){this[_0xcac8('0x14')]=0x0;this[_0xcac8('0x15')]=0x0;for(var _0x3d945d=0x0;_0x3d945d=0x0?this['available']:0x0;var _0x50369c={'id':this['id'],'available':this[_0xcac8('0x18')],'loggedIn':this[_0xcac8('0x14')],'name':this['name'],'paused':this[_0xcac8('0x15')],'waiting':this['waiting']};var _0x120763=md5(JSON['stringify'](_0x50369c));if(this[_0xcac8('0xe')]!==_0x120763){this[_0xcac8('0xe')]=_0x120763;io['to'](util[_0xcac8('0x19')](_0xcac8('0x1a'),_0x50369c['name']))[_0xcac8('0x1b')](_0xcac8('0x1c'),_0x50369c);}};module[_0xcac8('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 06ab92c..3ebcdac 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 _0xe12b=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','faxPause','paused','available','stringify','md5','format','fax:queue:%s','emit','fax_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x3a4bf,_0x16a2cf){var _0x24b6e9=function(_0x49bdba){while(--_0x49bdba){_0x3a4bf['push'](_0x3a4bf['shift']());}};_0x24b6e9(++_0x16a2cf);}(_0xe12b,0x1bb));var _0xbe12=function(_0x3c7b09,_0x172698){_0x3c7b09=_0x3c7b09-0x0;var _0x55a91a=_0xe12b[_0x3c7b09];return _0x55a91a;};'use strict';var _=require(_0xbe12('0x0'));var md5=require('md5');var util=require(_0xbe12('0x1'));var Redis=require(_0xbe12('0x2'));var config=require(_0xbe12('0x3'));config[_0xbe12('0x4')]=_[_0xbe12('0x5')](config['redis'],{'host':_0xbe12('0x6'),'port':0x18eb});var io=require(_0xbe12('0x7'))(new Redis(config['redis']));function FaxQueue(_0x3dbd22){this['id']=_0x3dbd22['id']||0x0;this['name']=_0x3dbd22[_0xbe12('0x8')]||'';this[_0xbe12('0x9')]=_0x3dbd22[_0xbe12('0x9')]||0xa;this[_0xbe12('0xa')]=_0x3dbd22[_0xbe12('0xa')]||_0xbe12('0xb');this[_0xbe12('0xc')]=_0x3dbd22[_0xbe12('0xc')];this[_0xbe12('0xd')]={};this[_0xbe12('0xe')]=0x0;this['md5']='';this[_0xbe12('0xf')]();this[_0xbe12('0x10')]();}FaxQueue[_0xbe12('0x11')][_0xbe12('0xf')]=function(){var _0x8ec4d0=this[_0xbe12('0xd')]['_rr'];this['mapAgentsId']=_[_0xbe12('0x12')](this[_0xbe12('0xc')],'id');this['mapAgentsId'][_0xbe12('0x13')]=_0x8ec4d0;};FaxQueue[_0xbe12('0x11')][_0xbe12('0x10')]=function(){this[_0xbe12('0x14')]=0x0;this['paused']=0x0;for(var _0x499e39=0x0;_0x499e39=0x0?this[_0xbe12('0x17')]:0x0;var _0x895d23={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbe12('0x14')],'name':this[_0xbe12('0x8')],'paused':this[_0xbe12('0x16')],'waiting':this[_0xbe12('0xe')]};var _0x524362=md5(JSON[_0xbe12('0x18')](_0x895d23));if(this[_0xbe12('0x19')]!==_0x524362){this['md5']=_0x524362;io['to'](util[_0xbe12('0x1a')](_0xbe12('0x1b'),_0x895d23[_0xbe12('0x8')]))[_0xbe12('0x1c')](_0xbe12('0x1d'),_0x895d23);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x9eb1=['lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','length','online','faxPause','paused','available','stringify','md5','format','fax:queue:%s','emit'];(function(_0x298374,_0x4d34c4){var _0x42ada1=function(_0x1ed25b){while(--_0x1ed25b){_0x298374['push'](_0x298374['shift']());}};_0x42ada1(++_0x4d34c4);}(_0x9eb1,0x186));var _0x19eb=function(_0xbce6cd,_0x36aee2){_0xbce6cd=_0xbce6cd-0x0;var _0x2ebdb7=_0x9eb1[_0xbce6cd];return _0x2ebdb7;};'use strict';var _=require(_0x19eb('0x0'));var md5=require('md5');var util=require(_0x19eb('0x1'));var Redis=require(_0x19eb('0x2'));var config=require(_0x19eb('0x3'));config[_0x19eb('0x4')]=_[_0x19eb('0x5')](config['redis'],{'host':_0x19eb('0x6'),'port':0x18eb});var io=require(_0x19eb('0x7'))(new Redis(config[_0x19eb('0x4')]));function FaxQueue(_0x5a46c0){this['id']=_0x5a46c0['id']||0x0;this['name']=_0x5a46c0[_0x19eb('0x8')]||'';this['timeout']=_0x5a46c0[_0x19eb('0x9')]||0xa;this[_0x19eb('0xa')]=_0x5a46c0['strategy']||_0x19eb('0xb');this[_0x19eb('0xc')]=_0x5a46c0['Agents'];this[_0x19eb('0xd')]={};this[_0x19eb('0xe')]=0x0;this['md5']='';this[_0x19eb('0xf')]();this[_0x19eb('0x10')]();}FaxQueue['prototype'][_0x19eb('0xf')]=function(){var _0x42be9b=this[_0x19eb('0xd')][_0x19eb('0x11')];this[_0x19eb('0xd')]=_[_0x19eb('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x42be9b;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x19eb('0x13')]=0x0;this['paused']=0x0;for(var _0x2369e8=0x0;_0x2369e8=0x0?this['available']:0x0;var _0x5896f3={'id':this['id'],'available':this['available'],'loggedIn':this[_0x19eb('0x13')],'name':this[_0x19eb('0x8')],'paused':this[_0x19eb('0x17')],'waiting':this[_0x19eb('0xe')]};var _0x4f7d60=md5(JSON[_0x19eb('0x19')](_0x5896f3));if(this[_0x19eb('0x1a')]!==_0x4f7d60){this[_0x19eb('0x1a')]=_0x4f7d60;io['to'](util[_0x19eb('0x1b')](_0x19eb('0x1c'),_0x5896f3['name']))[_0x19eb('0x1d')]('fax_queue:save',_0x5896f3);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 799b7a2..24f7a1c 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 _0x78cb=['name','Intervals'];(function(_0x142c0c,_0x3f61c6){var _0x3aefb0=function(_0x5c96d6){while(--_0x5c96d6){_0x142c0c['push'](_0x142c0c['shift']());}};_0x3aefb0(++_0x3f61c6);}(_0x78cb,0xe4));var _0xb78c=function(_0x21972d,_0x4ad788){_0x21972d=_0x21972d-0x0;var _0xcf6d7b=_0x78cb[_0x21972d];return _0xcf6d7b;};'use strict';function Interval(_0xe76cd7){this['id']=_0xe76cd7['id']||0x0;this[_0xb78c('0x0')]=_0xe76cd7[_0xb78c('0x0')]||'';this[_0xb78c('0x1')]=_0xe76cd7[_0xb78c('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x382e=['name','Intervals'];(function(_0x2e6a7f,_0x128393){var _0x9a82b=function(_0x411307){while(--_0x411307){_0x2e6a7f['push'](_0x2e6a7f['shift']());}};_0x9a82b(++_0x128393);}(_0x382e,0x18a));var _0xe382=function(_0x537f86,_0x5d4f20){_0x537f86=_0x537f86-0x0;var _0x205ea6=_0x382e[_0x537f86];return _0x205ea6;};'use strict';function Interval(_0x2434ec){this['id']=_0x2434ec['id']||0x0;this[_0xe382('0x0')]=_0x2434ec[_0xe382('0x0')]||'';this['Intervals']=_0x2434ec[_0xe382('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index a65a230..d940024 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 _0x444e=['loggedIn','paused','length','mailPause','available','format','emit','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype'];(function(_0x41521f,_0x3809ba){var _0x4c91a3=function(_0x25386e){while(--_0x25386e){_0x41521f['push'](_0x41521f['shift']());}};_0x4c91a3(++_0x3809ba);}(_0x444e,0xe9));var _0xe444=function(_0x306040,_0x396ee8){_0x306040=_0x306040-0x0;var _0x42942c=_0x444e[_0x306040];return _0x42942c;};'use strict';var _=require(_0xe444('0x0'));var md5=require(_0xe444('0x1'));var util=require(_0xe444('0x2'));var Redis=require(_0xe444('0x3'));var config=require('../../../config/environment');config[_0xe444('0x4')]=_[_0xe444('0x5')](config[_0xe444('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe444('0x6'))(new Redis(config[_0xe444('0x4')]));function MailQueue(_0x3c7256){this['id']=_0x3c7256['id']||0x0;this[_0xe444('0x7')]=_0x3c7256[_0xe444('0x7')]||'';this[_0xe444('0x8')]=_0x3c7256['timeout']||0xa;this['strategy']=_0x3c7256[_0xe444('0x9')]||_0xe444('0xa');this['Agents']=_0x3c7256[_0xe444('0xb')];this[_0xe444('0xc')]={};this[_0xe444('0xd')]=0x0;this[_0xe444('0x1')]='';this[_0xe444('0xe')]();this[_0xe444('0xf')]();}MailQueue['prototype'][_0xe444('0xe')]=function(){var _0x2ffe5b=this['mapAgentsId']['_rr'];this[_0xe444('0xc')]=_['map'](this[_0xe444('0xb')],'id');this[_0xe444('0xc')]['_rr']=_0x2ffe5b;};MailQueue[_0xe444('0x10')][_0xe444('0xf')]=function(){this[_0xe444('0x11')]=0x0;this[_0xe444('0x12')]=0x0;for(var _0x5a079b=0x0;_0x5a079b=0x0?this[_0xe444('0x15')]:0x0;var _0x27716e={'id':this['id'],'available':this[_0xe444('0x15')],'loggedIn':this[_0xe444('0x11')],'name':this[_0xe444('0x7')],'paused':this['paused'],'waiting':this[_0xe444('0xd')]};var _0x2d9438=md5(JSON['stringify'](_0x27716e));if(this[_0xe444('0x1')]!==_0x2d9438){this['md5']=_0x2d9438;io['to'](util[_0xe444('0x16')]('mail:queue:%s',_0x27716e['name']))[_0xe444('0x17')]('mail_queue:save',_0x27716e);}};module[_0xe444('0x18')]=MailQueue; \ No newline at end of file +var _0x8dbe=['_rr','map','prototype','loggedIn','paused','length','mailPause','available','stringify','format','emit','mail_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime','updateRouting','mapAgentsId'];(function(_0x4f9e31,_0x19881c){var _0x2f9fc7=function(_0x318c57){while(--_0x318c57){_0x4f9e31['push'](_0x4f9e31['shift']());}};_0x2f9fc7(++_0x19881c);}(_0x8dbe,0x124));var _0xe8db=function(_0x1472dd,_0x51c63a){_0x1472dd=_0x1472dd-0x0;var _0x46c7b6=_0x8dbe[_0x1472dd];return _0x46c7b6;};'use strict';var _=require(_0xe8db('0x0'));var md5=require('md5');var util=require(_0xe8db('0x1'));var Redis=require(_0xe8db('0x2'));var config=require(_0xe8db('0x3'));config[_0xe8db('0x4')]=_[_0xe8db('0x5')](config[_0xe8db('0x4')],{'host':_0xe8db('0x6'),'port':0x18eb});var io=require(_0xe8db('0x7'))(new Redis(config[_0xe8db('0x4')]));function MailQueue(_0x108b80){this['id']=_0x108b80['id']||0x0;this[_0xe8db('0x8')]=_0x108b80[_0xe8db('0x8')]||'';this[_0xe8db('0x9')]=_0x108b80[_0xe8db('0x9')]||0xa;this[_0xe8db('0xa')]=_0x108b80['strategy']||_0xe8db('0xb');this['Agents']=_0x108b80[_0xe8db('0xc')];this['mapAgentsId']={};this[_0xe8db('0xd')]=0x0;this[_0xe8db('0xe')]='';this['updateRouting']();this[_0xe8db('0xf')]();}MailQueue['prototype'][_0xe8db('0x10')]=function(){var _0x4d5c34=this[_0xe8db('0x11')][_0xe8db('0x12')];this[_0xe8db('0x11')]=_[_0xe8db('0x13')](this[_0xe8db('0xc')],'id');this[_0xe8db('0x11')]['_rr']=_0x4d5c34;};MailQueue[_0xe8db('0x14')]['updateRealtime']=function(){this[_0xe8db('0x15')]=0x0;this[_0xe8db('0x16')]=0x0;for(var _0x1c7401=0x0;_0x1c7401=0x0?this[_0xe8db('0x19')]:0x0;var _0x455e19={'id':this['id'],'available':this[_0xe8db('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xe8db('0x8')],'paused':this[_0xe8db('0x16')],'waiting':this[_0xe8db('0xd')]};var _0x157a45=md5(JSON[_0xe8db('0x1a')](_0x455e19));if(this['md5']!==_0x157a45){this[_0xe8db('0xe')]=_0x157a45;io['to'](util[_0xe8db('0x1b')]('mail:queue:%s',_0x455e19['name']))[_0xe8db('0x1c')](_0xe8db('0x1d'),_0x455e19);}};module[_0xe8db('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 2b2045f..c589ab7 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3eb5b8,_0x3f5f48){var _0x588136=function(_0x5aa818){while(--_0x5aa818){_0x3eb5b8['push'](_0x3eb5b8['shift']());}};_0x588136(++_0x3f5f48);}(_0x814b,0x1a2));var _0xb814=function(_0x443520,_0x2fe333){_0x443520=_0x443520-0x0;var _0x20afa5=_0x814b[_0x443520];return _0x20afa5;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x1190c2,_0x2c078b){var _0x6ec988=function(_0x333cdf){while(--_0x333cdf){_0x1190c2['push'](_0x1190c2['shift']());}};_0x6ec988(++_0x2c078b);}(_0xadb5,0xad));var _0x5adb=function(_0x31955a,_0x2b7a5d){_0x31955a=_0x31955a-0x0;var _0x34f927=_0xadb5[_0x31955a];return _0x34f927;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 38aa381..5246e84 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 _0x87f8=['updateRouting','updateRealtime','prototype','map','paused','length','loggedIn','smsPause','available','waiting','stringify','sms:queue:%s','sms_queue:save','exports','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x5b9842,_0x52a26b){var _0x3aab10=function(_0x4e844d){while(--_0x4e844d){_0x5b9842['push'](_0x5b9842['shift']());}};_0x3aab10(++_0x52a26b);}(_0x87f8,0x152));var _0x887f=function(_0x1ef1d4,_0x5cb4a7){_0x1ef1d4=_0x1ef1d4-0x0;var _0x1dc1b8=_0x87f8[_0x1ef1d4];return _0x1dc1b8;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x887f('0x0'));var config=require(_0x887f('0x1'));config['redis']=_[_0x887f('0x2')](config['redis'],{'host':_0x887f('0x3'),'port':0x18eb});var io=require(_0x887f('0x4'))(new Redis(config[_0x887f('0x5')]));function SmsQueue(_0x2d4cec){this['id']=_0x2d4cec['id']||0x0;this['name']=_0x2d4cec[_0x887f('0x6')]||'';this[_0x887f('0x7')]=_0x2d4cec[_0x887f('0x7')]||0xa;this[_0x887f('0x8')]=_0x2d4cec[_0x887f('0x8')]||_0x887f('0x9');this[_0x887f('0xa')]=_0x2d4cec['Agents'];this[_0x887f('0xb')]={};this['waiting']=0x0;this[_0x887f('0xc')]='';this[_0x887f('0xd')]();this[_0x887f('0xe')]();}SmsQueue[_0x887f('0xf')]['updateRouting']=function(){var _0x12383f=this[_0x887f('0xb')]['_rr'];this['mapAgentsId']=_[_0x887f('0x10')](this[_0x887f('0xa')],'id');this[_0x887f('0xb')]['_rr']=_0x12383f;};SmsQueue[_0x887f('0xf')][_0x887f('0xe')]=function(){this['loggedIn']=0x0;this[_0x887f('0x11')]=0x0;for(var _0x58152e=0x0;_0x58152e=0x0?this[_0x887f('0x15')]:0x0;var _0x3d3b0c={'id':this['id'],'available':this[_0x887f('0x15')],'loggedIn':this[_0x887f('0x13')],'name':this[_0x887f('0x6')],'paused':this[_0x887f('0x11')],'waiting':this[_0x887f('0x16')]};var _0x3964d6=md5(JSON[_0x887f('0x17')](_0x3d3b0c));if(this[_0x887f('0xc')]!==_0x3964d6){this[_0x887f('0xc')]=_0x3964d6;io['to'](util['format'](_0x887f('0x18'),_0x3d3b0c[_0x887f('0x6')]))['emit'](_0x887f('0x19'),_0x3d3b0c);}};module[_0x887f('0x1a')]=SmsQueue; \ No newline at end of file +var _0x7341=['updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','smsPause','available','emit','exports','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','md5','updateRouting'];(function(_0x1b0452,_0x3c69a5){var _0x140bb1=function(_0x3a0e1d){while(--_0x3a0e1d){_0x1b0452['push'](_0x1b0452['shift']());}};_0x140bb1(++_0x3c69a5);}(_0x7341,0xe4));var _0x1734=function(_0x56027a,_0x1a009f){_0x56027a=_0x56027a-0x0;var _0x4d423a=_0x7341[_0x56027a];return _0x4d423a;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1734('0x0'));var Redis=require('ioredis');var config=require(_0x1734('0x1'));config[_0x1734('0x2')]=_['defaults'](config[_0x1734('0x2')],{'host':_0x1734('0x3'),'port':0x18eb});var io=require(_0x1734('0x4'))(new Redis(config[_0x1734('0x2')]));function SmsQueue(_0x2de514){this['id']=_0x2de514['id']||0x0;this[_0x1734('0x5')]=_0x2de514[_0x1734('0x5')]||'';this['timeout']=_0x2de514[_0x1734('0x6')]||0xa;this[_0x1734('0x7')]=_0x2de514[_0x1734('0x7')]||'beepall';this[_0x1734('0x8')]=_0x2de514['Agents'];this['mapAgentsId']={};this[_0x1734('0x9')]=0x0;this[_0x1734('0xa')]='';this[_0x1734('0xb')]();this[_0x1734('0xc')]();}SmsQueue[_0x1734('0xd')][_0x1734('0xb')]=function(){var _0x33edca=this[_0x1734('0xe')][_0x1734('0xf')];this[_0x1734('0xe')]=_['map'](this[_0x1734('0x8')],'id');this[_0x1734('0xe')][_0x1734('0xf')]=_0x33edca;};SmsQueue[_0x1734('0xd')][_0x1734('0xc')]=function(){this[_0x1734('0x10')]=0x0;this[_0x1734('0x11')]=0x0;for(var _0xd2f288=0x0;_0xd2f288=0x0?this[_0x1734('0x15')]:0x0;var _0x665ddc={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1734('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x14347d=md5(JSON['stringify'](_0x665ddc));if(this[_0x1734('0xa')]!==_0x14347d){this[_0x1734('0xa')]=_0x14347d;io['to'](util['format']('sms:queue:%s',_0x665ddc['name']))[_0x1734('0x16')]('sms_queue:save',_0x665ddc);}};module[_0x1734('0x17')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index fe8cb9f..12acaca 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 _0xe9a2=['lodash','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','available','format','whatsapp:queue:%s','emit'];(function(_0x289e64,_0x5adb3c){var _0x30246c=function(_0x1bf7f6){while(--_0x1bf7f6){_0x289e64['push'](_0x289e64['shift']());}};_0x30246c(++_0x5adb3c);}(_0xe9a2,0x16c));var _0x2e9a=function(_0x19b2ca,_0x7a0686){_0x19b2ca=_0x19b2ca-0x0;var _0x36a946=_0xe9a2[_0x19b2ca];return _0x36a946;};'use strict';var _=require(_0x2e9a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x2e9a('0x1'));var config=require(_0x2e9a('0x2'));config[_0x2e9a('0x3')]=_[_0x2e9a('0x4')](config['redis'],{'host':_0x2e9a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x3967fe){this['id']=_0x3967fe['id']||0x0;this[_0x2e9a('0x6')]=_0x3967fe['name']||'';this[_0x2e9a('0x7')]=_0x3967fe['timeout']||0xa;this['strategy']=_0x3967fe[_0x2e9a('0x8')]||_0x2e9a('0x9');this[_0x2e9a('0xa')]=_0x3967fe[_0x2e9a('0xa')];this[_0x2e9a('0xb')]={};this[_0x2e9a('0xc')]=0x0;this[_0x2e9a('0xd')]='';this[_0x2e9a('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x2e9a('0xf')][_0x2e9a('0xe')]=function(){var _0x4401b6=this[_0x2e9a('0xb')][_0x2e9a('0x10')];this['mapAgentsId']=_[_0x2e9a('0x11')](this[_0x2e9a('0xa')],'id');this[_0x2e9a('0xb')][_0x2e9a('0x10')]=_0x4401b6;};WhatsappQueue['prototype'][_0x2e9a('0x12')]=function(){this[_0x2e9a('0x13')]=0x0;this[_0x2e9a('0x14')]=0x0;for(var _0x3c1982=0x0;_0x3c1982=0x0?this[_0x2e9a('0x16')]:0x0;var _0x24c0d1={'id':this['id'],'available':this[_0x2e9a('0x16')],'loggedIn':this[_0x2e9a('0x13')],'name':this[_0x2e9a('0x6')],'paused':this[_0x2e9a('0x14')],'waiting':this['waiting']};var _0x382c88=md5(JSON['stringify'](_0x24c0d1));if(this[_0x2e9a('0xd')]!==_0x382c88){this[_0x2e9a('0xd')]=_0x382c88;io['to'](util[_0x2e9a('0x17')](_0x2e9a('0x18'),_0x24c0d1['name']))[_0x2e9a('0x19')]('whatsapp_queue:save',_0x24c0d1);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xed6f=['_rr','loggedIn','online','paused','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x165417,_0x2b8c14){var _0x1f3fe1=function(_0x9aa37f){while(--_0x9aa37f){_0x165417['push'](_0x165417['shift']());}};_0x1f3fe1(++_0x2b8c14);}(_0xed6f,0x1f0));var _0xfed6=function(_0x32d571,_0xb9332f){_0x32d571=_0x32d571-0x0;var _0x425250=_0xed6f[_0x32d571];return _0x425250;};'use strict';var _=require(_0xfed6('0x0'));var md5=require(_0xfed6('0x1'));var util=require('util');var Redis=require(_0xfed6('0x2'));var config=require(_0xfed6('0x3'));config[_0xfed6('0x4')]=_[_0xfed6('0x5')](config[_0xfed6('0x4')],{'host':_0xfed6('0x6'),'port':0x18eb});var io=require(_0xfed6('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0xdd7780){this['id']=_0xdd7780['id']||0x0;this['name']=_0xdd7780[_0xfed6('0x8')]||'';this[_0xfed6('0x9')]=_0xdd7780[_0xfed6('0x9')]||0xa;this[_0xfed6('0xa')]=_0xdd7780[_0xfed6('0xa')]||_0xfed6('0xb');this['Agents']=_0xdd7780[_0xfed6('0xc')];this[_0xfed6('0xd')]={};this[_0xfed6('0xe')]=0x0;this['md5']='';this[_0xfed6('0xf')]();this[_0xfed6('0x10')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x77e801=this[_0xfed6('0xd')][_0xfed6('0x11')];this[_0xfed6('0xd')]=_['map'](this['Agents'],'id');this['mapAgentsId'][_0xfed6('0x11')]=_0x77e801;};WhatsappQueue['prototype'][_0xfed6('0x10')]=function(){this[_0xfed6('0x12')]=0x0;this['paused']=0x0;for(var _0x52510a=0x0;_0x52510a=0x0?this['available']:0x0;var _0x4e7fea={'id':this['id'],'available':this[_0xfed6('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x4fe329=md5(JSON['stringify'](_0x4e7fea));if(this[_0xfed6('0x1')]!==_0x4fe329){this['md5']=_0x4fe329;io['to'](util[_0xfed6('0x16')](_0xfed6('0x17'),_0x4e7fea[_0xfed6('0x8')]))[_0xfed6('0x18')](_0xfed6('0x19'),_0x4e7fea);}};module[_0xfed6('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b7ee07f..69f7ee6 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(_0x856507,_0x5e5f76){var _0x1bc06c=function(_0x1995a1){while(--_0x1995a1){_0x856507['push'](_0x856507['shift']());}};_0x1bc06c(++_0x5e5f76);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c8618,_0x54ada2){_0x3c8618=_0x3c8618-0x0;var _0x2deb98=_0xb10b[_0x3c8618];return _0x2deb98;};'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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 138e624..b6721fc 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 _0xe97c=['addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x46a5aa,_0x9952d1){var _0x4375cc=function(_0x50ab83){while(--_0x50ab83){_0x46a5aa['push'](_0x46a5aa['shift']());}};_0x4375cc(++_0x9952d1);}(_0xe97c,0x1a5));var _0xce97=function(_0x24dd85,_0x224447){_0x24dd85=_0x24dd85-0x0;var _0x1847d7=_0xe97c[_0x24dd85];return _0x1847d7;};'use strict';var client=require('../client');exports['update']=function(_0x32acad,_0x1fb064){return client[_0xce97('0x0')](_0xce97('0x1'),{'body':_0x1fb064,'options':{'where':{'id':_0x32acad}},'log':_0xce97('0x2')});};exports[_0xce97('0x3')]=function(_0x2be8c9,_0x297a47){return client[_0xce97('0x0')](_0xce97('0x4'),{'body':_0x297a47,'options':{'where':{'id':_0x2be8c9}},'log':_0xce97('0x5')});}; \ No newline at end of file +var _0xa23a=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x557260,_0x553e78){var _0x4bac08=function(_0x5a1c1c){while(--_0x5a1c1c){_0x557260['push'](_0x557260['shift']());}};_0x4bac08(++_0x553e78);}(_0xa23a,0x1d2));var _0xaa23=function(_0xed58fb,_0x3ad96e){_0xed58fb=_0xed58fb-0x0;var _0x34ff8a=_0xa23a[_0xed58fb];return _0x34ff8a;};'use strict';var client=require(_0xaa23('0x0'));exports[_0xaa23('0x1')]=function(_0x2c12ef,_0x6b04b7){return client[_0xaa23('0x2')]('UpdateChatInteraction',{'body':_0x6b04b7,'options':{'where':{'id':_0x2c12ef}},'log':_0xaa23('0x3')});};exports[_0xaa23('0x4')]=function(_0x22ed3d,_0x58e52a){return client[_0xaa23('0x2')](_0xaa23('0x5'),{'body':_0x58e52a,'options':{'where':{'id':_0x22ed3d}},'log':_0xaa23('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index bb85908..f496604 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 _0x64d0=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x64d0,0x118));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x064d('0x0'));exports[_0x064d('0x1')]=function(_0x32013a){return client['Request'](_0x064d('0x2'),{'body':_0x32013a,'log':_0x064d('0x3')});}; \ No newline at end of file +var _0x1e2c=['CreateChatMessage','createChatMessage','create','Request'];(function(_0x574912,_0x3e903e){var _0x246891=function(_0xa7d448){while(--_0xa7d448){_0x574912['push'](_0x574912['shift']());}};_0x246891(++_0x3e903e);}(_0x1e2c,0xe2));var _0xc1e2=function(_0x5cf299,_0x4ba3ec){_0x5cf299=_0x5cf299-0x0;var _0x42b17f=_0x1e2c[_0x5cf299];return _0x42b17f;};'use strict';var client=require('../client');exports[_0xc1e2('0x0')]=function(_0x29dae7){return client[_0xc1e2('0x1')](_0xc1e2('0x2'),{'body':_0x29dae7,'log':_0xc1e2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8a23a0f..e9ad5be 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 _0xe105=['chatPause','../client','timeout','strategy','User','Agents','online'];(function(_0x3c1364,_0x3e7817){var _0x7631c6=function(_0x28857f){while(--_0x28857f){_0x3c1364['push'](_0x3c1364['shift']());}};_0x7631c6(++_0x3e7817);}(_0xe105,0xef));var _0x5e10=function(_0x46a3df,_0x4492b5){_0x46a3df=_0x46a3df-0x0;var _0x24c689=_0xe105[_0x46a3df];return _0x24c689;};'use strict';var client=require(_0x5e10('0x0'));exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x5e10('0x1'),_0x5e10('0x2')],'include':[{'model':_0x5e10('0x3'),'as':_0x5e10('0x4'),'attributes':['id','name',_0x5e10('0x5'),_0x5e10('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xea03=['getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy','online','chatPause'];(function(_0x5aba3f,_0x486205){var _0x14a4a7=function(_0x1437f8){while(--_0x1437f8){_0x5aba3f['push'](_0x5aba3f['shift']());}};_0x14a4a7(++_0x486205);}(_0xea03,0x1ba));var _0x3ea0=function(_0x107df9,_0x4d1825){_0x107df9=_0x107df9-0x0;var _0x2df84a=_0xea03[_0x107df9];return _0x2df84a;};'use strict';var client=require(_0x3ea0('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x3ea0('0x1')](_0x3ea0('0x2'),{'options':{'raw':![],'attributes':['id',_0x3ea0('0x3'),_0x3ea0('0x4'),_0x3ea0('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x3ea0('0x6'),_0x3ea0('0x7')]}]},'log':_0x3ea0('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6d9fe14..863443d 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 _0xb492=['CreateChatQueueReport','UpdateChatQueueReport','create','Request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb492,0x172));var _0x2b49=function(_0x2b6f91,_0x2dd3dd){_0x2b6f91=_0x2b6f91-0x0;var _0x558bdf=_0xb492[_0x2b6f91];return _0x558bdf;};'use strict';var client=require('../client');exports[_0x2b49('0x0')]=function(_0x32fdad){return client[_0x2b49('0x1')](_0x2b49('0x2'),{'body':_0x32fdad,'log':'CreateChatQueueReport'});};exports['update']=function(_0x31a7e5,_0x340296){return client[_0x2b49('0x1')](_0x2b49('0x3'),{'body':_0x340296,'options':{'where':{'uniqueid':_0x31a7e5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x5620=['Request','DESC','UpdateChatQueueReport','../client'];(function(_0x3c009c,_0x205d96){var _0x45a42f=function(_0x38e6ee){while(--_0x38e6ee){_0x3c009c['push'](_0x3c009c['shift']());}};_0x45a42f(++_0x205d96);}(_0x5620,0xbf));var _0x0562=function(_0x4a6362,_0x9e782a){_0x4a6362=_0x4a6362-0x0;var _0x2653a5=_0x5620[_0x4a6362];return _0x2653a5;};'use strict';var client=require(_0x0562('0x0'));exports['create']=function(_0x3817f8){return client[_0x0562('0x1')]('CreateChatQueueReport',{'body':_0x3817f8,'log':'CreateChatQueueReport'});};exports['update']=function(_0x215fe5,_0x4ef07f){return client[_0x0562('0x1')]('UpdateChatQueueReport',{'body':_0x4ef07f,'options':{'where':{'uniqueid':_0x215fe5},'order':[['id',_0x0562('0x2')]],'limit':0x1},'log':_0x0562('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2eca725..e6e4a37 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(_0x5bf420,_0x2d068d){var _0x1c5255=function(_0x4964a2){while(--_0x4964a2){_0x5bf420['push'](_0x5bf420['shift']());}};_0x1c5255(++_0x2d068d);}(_0x7a54,0x106));var _0x47a5=function(_0x216886,_0x42f31f){_0x216886=_0x216886-0x0;var _0x5e3065=_0x7a54[_0x216886];return _0x5e3065;};'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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0x7a54,0x106));var _0x47a5=function(_0x4aa129,_0x37472b){_0x4aa129=_0x4aa129-0x0;var _0x4f3620=_0x7a54[_0x4aa129];return _0x4f3620;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 336edc5..10caf76 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 _0xe8be=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe8be,0x64));var _0xee8b=function(_0x2b81be,_0x544bdf){_0x2b81be=_0x2b81be-0x0;var _0x8ed4a7=_0xe8be[_0x2b81be];return _0x8ed4a7;};'use strict';var client=require(_0xee8b('0x0'));exports[_0xee8b('0x1')]=function(_0x1bcb66){return client[_0xee8b('0x2')](_0xee8b('0x3'),{'body':_0x1bcb66,'log':_0xee8b('0x4')});}; \ No newline at end of file +var _0x7074=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7074,0x1cf));var _0x4707=function(_0x53f5ec,_0x2d0fd2){_0x53f5ec=_0x53f5ec-0x0;var _0xf2538f=_0x7074[_0x53f5ec];return _0xf2538f;};'use strict';var client=require('../client');exports[_0x4707('0x0')]=function(_0x45e4ef){return client[_0x4707('0x1')](_0x4707('0x2'),{'body':_0x45e4ef,'log':_0x4707('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index a7753b0..b5f1bd0 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 _0xcd02=['Agents','online','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x2b9aa2,_0x1ee287){var _0x3c9155=function(_0x8108fa){while(--_0x8108fa){_0x2b9aa2['push'](_0x2b9aa2['shift']());}};_0x3c9155(++_0x1ee287);}(_0xcd02,0x1ec));var _0x2cd0=function(_0x5bebc5,_0x39bdeb){_0x5bebc5=_0x5bebc5-0x0;var _0x538278=_0xcd02[_0x5bebc5];return _0x538278;};'use strict';var client=require(_0x2cd0('0x0'));exports[_0x2cd0('0x1')]=function(){return function(){return client[_0x2cd0('0x2')](_0x2cd0('0x3'),{'options':{'raw':![],'attributes':['id',_0x2cd0('0x4'),_0x2cd0('0x5'),_0x2cd0('0x6')],'include':[{'model':_0x2cd0('0x7'),'as':_0x2cd0('0x8'),'attributes':['id',_0x2cd0('0x4'),_0x2cd0('0x9'),'faxPause']}]},'log':_0x2cd0('0x1')});};}; \ No newline at end of file +var _0x7b6f=['GetFaxQueue','name','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request'];(function(_0x3cc990,_0x5071f5){var _0x1276b9=function(_0xa55f3){while(--_0xa55f3){_0x3cc990['push'](_0x3cc990['shift']());}};_0x1276b9(++_0x5071f5);}(_0x7b6f,0x179));var _0xf7b6=function(_0x4c67b7,_0x517302){_0x4c67b7=_0x4c67b7-0x0;var _0x5cc87b=_0x7b6f[_0x4c67b7];return _0x5cc87b;};'use strict';var client=require(_0xf7b6('0x0'));exports[_0xf7b6('0x1')]=function(){return function(){return client[_0xf7b6('0x2')](_0xf7b6('0x3'),{'options':{'raw':![],'attributes':['id',_0xf7b6('0x4'),'timeout',_0xf7b6('0x5')],'include':[{'model':_0xf7b6('0x6'),'as':_0xf7b6('0x7'),'attributes':['id',_0xf7b6('0x4'),_0xf7b6('0x8'),_0xf7b6('0x9')]}]},'log':_0xf7b6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index cc7e43f..153593a 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 _0xfdf8=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x2586c7,_0x277605){var _0x11dae8=function(_0x3d1faa){while(--_0x3d1faa){_0x2586c7['push'](_0x2586c7['shift']());}};_0x11dae8(++_0x277605);}(_0xfdf8,0x1ec));var _0x8fdf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfdf8[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0x8fdf('0x0')]=function(_0x2ec45b){return client[_0x8fdf('0x1')](_0x8fdf('0x2'),{'body':_0x2ec45b,'log':_0x8fdf('0x2')});};exports[_0x8fdf('0x3')]=function(_0x19a5c9,_0x45e635){return client['Request'](_0x8fdf('0x4'),{'body':_0x45e635,'options':{'where':{'uniqueid':_0x19a5c9},'order':[['id',_0x8fdf('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xebef=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xebef,0x10d));var _0xfebe=function(_0xf3b334,_0x41b574){_0xf3b334=_0xf3b334-0x0;var _0x108fc3=_0xebef[_0xf3b334];return _0x108fc3;};'use strict';var client=require(_0xfebe('0x0'));exports['create']=function(_0x939418){return client[_0xfebe('0x1')](_0xfebe('0x2'),{'body':_0x939418,'log':'CreateFaxQueueReport'});};exports[_0xfebe('0x3')]=function(_0x5a030f,_0x2df219){return client[_0xfebe('0x1')](_0xfebe('0x4'),{'body':_0x2df219,'options':{'where':{'uniqueid':_0x5a030f},'order':[['id',_0xfebe('0x5')]],'limit':0x1},'log':_0xfebe('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 06afe85..e4bc940 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 _0x97fe=['Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x3c74cc,_0x612d4d){var _0x3631aa=function(_0x2a638f){while(--_0x2a638f){_0x3c74cc['push'](_0x3c74cc['shift']());}};_0x3631aa(++_0x612d4d);}(_0x97fe,0x152));var _0xe97f=function(_0xefc910,_0x4a9dd1){_0xefc910=_0xefc910-0x0;var _0x5db0e3=_0x97fe[_0xefc910];return _0x5db0e3;};'use strict';var client=require(_0xe97f('0x0'));exports[_0xe97f('0x1')]=function(){return function(){return client[_0xe97f('0x2')](_0xe97f('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe97f('0x4')],'include':[{'model':'Interval','as':_0xe97f('0x5'),'attributes':['id','name',_0xe97f('0x6')]}]},'log':_0xe97f('0x1')});};}; \ No newline at end of file +var _0x42a1=['interval','../client','getIntervals','Request','GetInterval','Intervals','name'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x42a1,0x143));var _0x142a=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0x42a1[_0x1e9d62];return _0x56c490;};'use strict';var client=require(_0x142a('0x0'));exports[_0x142a('0x1')]=function(){return function(){return client[_0x142a('0x2')](_0x142a('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x142a('0x4'),'attributes':['id',_0x142a('0x5'),_0x142a('0x6')]}]},'log':_0x142a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index e2f3c27..e50393e 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 _0x68b3=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b3,0x1d8));var _0x368b=function(_0x1a909a,_0x3103a2){_0x1a909a=_0x1a909a-0x0;var _0x222b98=_0x68b3[_0x1a909a];return _0x222b98;};'use strict';var client=require(_0x368b('0x0'));exports[_0x368b('0x1')]=function(_0x3e8034,_0xa371c){return client[_0x368b('0x2')]('UpdateMailInteraction',{'body':_0xa371c,'options':{'where':{'id':_0x3e8034}},'log':_0x368b('0x3')});};exports[_0x368b('0x4')]=function(_0xc40116,_0x404282){return client['Request'](_0x368b('0x5'),{'body':_0x404282,'options':{'where':{'id':_0xc40116}},'log':_0x368b('0x6')});}; \ No newline at end of file +var _0xcf2f=['update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x412509,_0x53645c){var _0x23d200=function(_0x2ad573){while(--_0x2ad573){_0x412509['push'](_0x412509['shift']());}};_0x23d200(++_0x53645c);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x390748,_0x2cf00a){_0x390748=_0x390748-0x0;var _0xc265e0=_0xcf2f[_0x390748];return _0xc265e0;};'use strict';var client=require(_0xfcf2('0x0'));exports[_0xfcf2('0x1')]=function(_0xe6b3a5,_0x3165cf){return client[_0xfcf2('0x2')]('UpdateMailInteraction',{'body':_0x3165cf,'options':{'where':{'id':_0xe6b3a5}},'log':_0xfcf2('0x3')});};exports[_0xfcf2('0x4')]=function(_0x1e3661,_0x34bcaf){return client[_0xfcf2('0x2')](_0xfcf2('0x5'),{'body':_0x34bcaf,'options':{'where':{'id':_0x1e3661}},'log':_0xfcf2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 54063f1..4fe8359 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 _0x7fe3=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x487bd7,_0x42e3db){var _0x2f363f=function(_0x52944d){while(--_0x52944d){_0x487bd7['push'](_0x487bd7['shift']());}};_0x2f363f(++_0x42e3db);}(_0x7fe3,0x17d));var _0x37fe=function(_0x36bcf2,_0x363835){_0x36bcf2=_0x36bcf2-0x0;var _0x200c4b=_0x7fe3[_0x36bcf2];return _0x200c4b;};'use strict';var client=require(_0x37fe('0x0'));exports[_0x37fe('0x1')]=function(_0x4b9f3e){return client['Request'](_0x37fe('0x2'),{'body':_0x4b9f3e,'log':_0x37fe('0x3')});}; \ No newline at end of file +var _0xb978=['Request','CreateMailMessage','createMailMessage','create'];(function(_0x480afe,_0x175253){var _0x19e5f9=function(_0x57d2d6){while(--_0x57d2d6){_0x480afe['push'](_0x480afe['shift']());}};_0x19e5f9(++_0x175253);}(_0xb978,0x133));var _0x8b97=function(_0xceeca8,_0x16c691){_0xceeca8=_0xceeca8-0x0;var _0x530bf1=_0xb978[_0xceeca8];return _0x530bf1;};'use strict';var client=require('../client');exports[_0x8b97('0x0')]=function(_0x1968d3){return client[_0x8b97('0x1')](_0x8b97('0x2'),{'body':_0x1968d3,'log':_0x8b97('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 3ddfdc5..1ad860e 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 _0x8963=['Agents','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x456032,_0x1a799d){var _0x1a53cd=function(_0x162cc8){while(--_0x162cc8){_0x456032['push'](_0x456032['shift']());}};_0x1a53cd(++_0x1a799d);}(_0x8963,0xb6));var _0x3896=function(_0x1dfbb2,_0x37f1c7){_0x1dfbb2=_0x1dfbb2-0x0;var _0x5351f2=_0x8963[_0x1dfbb2];return _0x5351f2;};'use strict';var client=require(_0x3896('0x0'));exports[_0x3896('0x1')]=function(){return function(){return client[_0x3896('0x2')](_0x3896('0x3'),{'options':{'raw':![],'attributes':['id',_0x3896('0x4'),_0x3896('0x5'),_0x3896('0x6')],'include':[{'model':_0x3896('0x7'),'as':_0x3896('0x8'),'attributes':['id','name','online',_0x3896('0x9')]}]},'log':_0x3896('0x1')});};}; \ No newline at end of file +var _0x2d74=['getMailQueues','../client','Request','name','timeout','strategy','User','online','mailPause'];(function(_0x1d1860,_0x367c77){var _0x14550e=function(_0x5a1193){while(--_0x5a1193){_0x1d1860['push'](_0x1d1860['shift']());}};_0x14550e(++_0x367c77);}(_0x2d74,0x157));var _0x42d7=function(_0x517b24,_0x2c98b0){_0x517b24=_0x517b24-0x0;var _0x289293=_0x2d74[_0x517b24];return _0x289293;};'use strict';var client=require(_0x42d7('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x42d7('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x42d7('0x2'),_0x42d7('0x3'),_0x42d7('0x4')],'include':[{'model':_0x42d7('0x5'),'as':'Agents','attributes':['id',_0x42d7('0x2'),_0x42d7('0x6'),_0x42d7('0x7')]}]},'log':_0x42d7('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index c605849..83418d0 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 _0x344e=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x344e,0x132));var _0xe344=function(_0x515984,_0x4cd902){_0x515984=_0x515984-0x0;var _0x54cd26=_0x344e[_0x515984];return _0x54cd26;};'use strict';var client=require(_0xe344('0x0'));exports[_0xe344('0x1')]=function(_0xa8f1b0){return client[_0xe344('0x2')](_0xe344('0x3'),{'body':_0xa8f1b0,'log':_0xe344('0x3')});};exports[_0xe344('0x4')]=function(_0x25e036,_0x1c9f46){return client[_0xe344('0x2')](_0xe344('0x5'),{'body':_0x1c9f46,'options':{'where':{'uniqueid':_0x25e036},'order':[['id',_0xe344('0x6')]],'limit':0x1},'log':_0xe344('0x5')});}; \ No newline at end of file +var _0x3b7a=['../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x2c9d79,_0x3130ef){var _0x33cee1=function(_0x80860){while(--_0x80860){_0x2c9d79['push'](_0x2c9d79['shift']());}};_0x33cee1(++_0x3130ef);}(_0x3b7a,0xde));var _0xa3b7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b7a[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xa3b7('0x0'));exports[_0xa3b7('0x1')]=function(_0x3d457c){return client['Request'](_0xa3b7('0x2'),{'body':_0x3d457c,'log':'CreateMailQueueReport'});};exports[_0xa3b7('0x3')]=function(_0x510990,_0x36dec0){return client[_0xa3b7('0x4')](_0xa3b7('0x5'),{'body':_0x36dec0,'options':{'where':{'uniqueid':_0x510990},'order':[['id','DESC']],'limit':0x1},'log':_0xa3b7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index f26c34e..a439d1d 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 _0xac12=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','update','Request'];(function(_0x45f9db,_0x1f3104){var _0x54f66d=function(_0x3524b9){while(--_0x3524b9){_0x45f9db['push'](_0x45f9db['shift']());}};_0x54f66d(++_0x1f3104);}(_0xac12,0x71));var _0x2ac1=function(_0x563173,_0x42d40){_0x563173=_0x563173-0x0;var _0x2f58d3=_0xac12[_0x563173];return _0x2f58d3;};'use strict';var client=require('../client');exports[_0x2ac1('0x0')]=function(_0x2e385d,_0x841ea7){return client[_0x2ac1('0x1')](_0x2ac1('0x2'),{'body':_0x841ea7,'options':{'where':{'id':_0x2e385d}},'log':_0x2ac1('0x3')});};exports['addTags']=function(_0x1c3b5b,_0x3238f4){return client[_0x2ac1('0x1')](_0x2ac1('0x4'),{'body':_0x3238f4,'options':{'where':{'id':_0x1c3b5b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xbb46=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x2197d8,_0x5dbe0e){var _0x41396b=function(_0x2a54f7){while(--_0x2a54f7){_0x2197d8['push'](_0x2197d8['shift']());}};_0x41396b(++_0x5dbe0e);}(_0xbb46,0xee));var _0x6bb4=function(_0x4177e2,_0x4fa24b){_0x4177e2=_0x4177e2-0x0;var _0x49ee31=_0xbb46[_0x4177e2];return _0x49ee31;};'use strict';var client=require('../client');exports[_0x6bb4('0x0')]=function(_0x3782ed,_0x4899a0){return client[_0x6bb4('0x1')](_0x6bb4('0x2'),{'body':_0x4899a0,'options':{'where':{'id':_0x3782ed}},'log':_0x6bb4('0x3')});};exports['addTags']=function(_0x4040e7,_0x8de10b){return client[_0x6bb4('0x1')](_0x6bb4('0x4'),{'body':_0x8de10b,'options':{'where':{'id':_0x4040e7}},'log':_0x6bb4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a003ab2..e978a08 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 _0xab7f=['createOpenchannelMessage','../client','Request','CreateOpenchannelMessage'];(function(_0x24892f,_0x3bdc63){var _0x18eb50=function(_0x5b3662){while(--_0x5b3662){_0x24892f['push'](_0x24892f['shift']());}};_0x18eb50(++_0x3bdc63);}(_0xab7f,0x109));var _0xfab7=function(_0x11cf75,_0xc423db){_0x11cf75=_0x11cf75-0x0;var _0x54d8cc=_0xab7f[_0x11cf75];return _0x54d8cc;};'use strict';var client=require(_0xfab7('0x0'));exports['create']=function(_0x547750){return client[_0xfab7('0x1')](_0xfab7('0x2'),{'body':_0x547750,'log':_0xfab7('0x3')});}; \ No newline at end of file +var _0x5a08=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x38d6f3,_0x155c40){var _0x3f7cd5=function(_0x229b19){while(--_0x229b19){_0x38d6f3['push'](_0x38d6f3['shift']());}};_0x3f7cd5(++_0x155c40);}(_0x5a08,0x198));var _0x85a0=function(_0x34bd85,_0x3f3350){_0x34bd85=_0x34bd85-0x0;var _0x1512fc=_0x5a08[_0x34bd85];return _0x1512fc;};'use strict';var client=require(_0x85a0('0x0'));exports[_0x85a0('0x1')]=function(_0x1e8b85){return client[_0x85a0('0x2')](_0x85a0('0x3'),{'body':_0x1e8b85,'log':_0x85a0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index a0867f2..6566d2f 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 _0x31ee=['getOpenchannelQueues','Request','GetOpenchannelQueue','strategy','Agents','online','openchannelPause'];(function(_0x158d51,_0x43732f){var _0x441542=function(_0x38695c){while(--_0x38695c){_0x158d51['push'](_0x158d51['shift']());}};_0x441542(++_0x43732f);}(_0x31ee,0x181));var _0xe31e=function(_0x1b43e3,_0x9f8fed){_0x1b43e3=_0x1b43e3-0x0;var _0xbfcd48=_0x31ee[_0x1b43e3];return _0xbfcd48;};'use strict';var client=require('../client');exports[_0xe31e('0x0')]=function(){return function(){return client[_0xe31e('0x1')](_0xe31e('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xe31e('0x3')],'include':[{'model':'User','as':_0xe31e('0x4'),'attributes':['id','name',_0xe31e('0x5'),_0xe31e('0x6')]}]},'log':_0xe31e('0x0')});};}; \ No newline at end of file +var _0x9cf8=['../client','getOpenchannelQueues','GetOpenchannelQueue','name','strategy','Agents','openchannelPause'];(function(_0xbd8868,_0xfbfd94){var _0x24527d=function(_0x3e5ce5){while(--_0x3e5ce5){_0xbd8868['push'](_0xbd8868['shift']());}};_0x24527d(++_0xfbfd94);}(_0x9cf8,0x150));var _0x89cf=function(_0x4786cd,_0x239649){_0x4786cd=_0x4786cd-0x0;var _0x569e56=_0x9cf8[_0x4786cd];return _0x569e56;};'use strict';var client=require(_0x89cf('0x0'));exports[_0x89cf('0x1')]=function(){return function(){return client['Request'](_0x89cf('0x2'),{'options':{'raw':![],'attributes':['id',_0x89cf('0x3'),'timeout',_0x89cf('0x4')],'include':[{'model':'User','as':_0x89cf('0x5'),'attributes':['id','name','online',_0x89cf('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c777381..116d6f5 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 _0x3ee7=['UpdateOpenchannelQueueReport','DESC','create','CreateOpenchannelQueueReport','update','Request'];(function(_0x18d634,_0x37fe9f){var _0x29111e=function(_0x53262a){while(--_0x53262a){_0x18d634['push'](_0x18d634['shift']());}};_0x29111e(++_0x37fe9f);}(_0x3ee7,0x98));var _0x73ee=function(_0x2e68f3,_0x13dc10){_0x2e68f3=_0x2e68f3-0x0;var _0x977ca0=_0x3ee7[_0x2e68f3];return _0x977ca0;};'use strict';var client=require('../client');exports[_0x73ee('0x0')]=function(_0x5b474a){return client['Request'](_0x73ee('0x1'),{'body':_0x5b474a,'log':'CreateOpenchannelQueueReport'});};exports[_0x73ee('0x2')]=function(_0x241962,_0x2aebdc){return client[_0x73ee('0x3')](_0x73ee('0x4'),{'body':_0x2aebdc,'options':{'where':{'uniqueid':_0x241962},'order':[['id',_0x73ee('0x5')]],'limit':0x1},'log':_0x73ee('0x4')});}; \ No newline at end of file +var _0x2545=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2545,0x1e4));var _0x5254=function(_0x3f1053,_0x2ca47e){_0x3f1053=_0x3f1053-0x0;var _0x244309=_0x2545[_0x3f1053];return _0x244309;};'use strict';var client=require(_0x5254('0x0'));exports[_0x5254('0x1')]=function(_0x179935){return client[_0x5254('0x2')](_0x5254('0x3'),{'body':_0x179935,'log':'CreateOpenchannelQueueReport'});};exports[_0x5254('0x4')]=function(_0x240027,_0x5cddb3){return client[_0x5254('0x2')](_0x5254('0x5'),{'body':_0x5cddb3,'options':{'where':{'uniqueid':_0x240027},'order':[['id',_0x5254('0x6')]],'limit':0x1},'log':_0x5254('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d668eb5..dce027e 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 _0x3c6d=['addTags','Request','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x34d0a7,_0x5d4984){var _0x4fcb37=function(_0x50027a){while(--_0x50027a){_0x34d0a7['push'](_0x34d0a7['shift']());}};_0x4fcb37(++_0x5d4984);}(_0x3c6d,0x199));var _0xd3c6=function(_0x52d09e,_0x322ec4){_0x52d09e=_0x52d09e-0x0;var _0x8dc34d=_0x3c6d[_0x52d09e];return _0x8dc34d;};'use strict';var client=require(_0xd3c6('0x0'));exports[_0xd3c6('0x1')]=function(_0x223ca0,_0x272030){return client['Request'](_0xd3c6('0x2'),{'body':_0x272030,'options':{'where':{'id':_0x223ca0}},'log':_0xd3c6('0x3')});};exports[_0xd3c6('0x4')]=function(_0x28b706,_0x26c5b9){return client[_0xd3c6('0x5')]('AddTagsToSmsInteraction',{'body':_0x26c5b9,'options':{'where':{'id':_0x28b706}},'log':_0xd3c6('0x6')});}; \ No newline at end of file +var _0xac9d=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xac9d,0x14d));var _0xdac9=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0xac9d[_0x417baa];return _0x42724f;};'use strict';var client=require(_0xdac9('0x0'));exports[_0xdac9('0x1')]=function(_0x30732b,_0x1e6d33){return client[_0xdac9('0x2')](_0xdac9('0x3'),{'body':_0x1e6d33,'options':{'where':{'id':_0x30732b}},'log':_0xdac9('0x4')});};exports[_0xdac9('0x5')]=function(_0x51a5d7,_0x1c17a6){return client['Request'](_0xdac9('0x6'),{'body':_0x1c17a6,'options':{'where':{'id':_0x51a5d7}},'log':_0xdac9('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 687d633..b5b6897 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 _0x8a97=['createSmsMessage','../client','create'];(function(_0x2ce9da,_0xb5c27a){var _0xa53326=function(_0x59e6d0){while(--_0x59e6d0){_0x2ce9da['push'](_0x2ce9da['shift']());}};_0xa53326(++_0xb5c27a);}(_0x8a97,0x67));var _0x78a9=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x8a97[_0xf50820];return _0x2a9b10;};'use strict';var client=require(_0x78a9('0x0'));exports[_0x78a9('0x1')]=function(_0x4852e5){return client['Request']('CreateSmsMessage',{'body':_0x4852e5,'log':_0x78a9('0x2')});}; \ No newline at end of file +var _0xf6cb=['../client','create','Request','createSmsMessage'];(function(_0x256237,_0x10232e){var _0x2325f3=function(_0x4f9f44){while(--_0x4f9f44){_0x256237['push'](_0x256237['shift']());}};_0x2325f3(++_0x10232e);}(_0xf6cb,0xd8));var _0xbf6c=function(_0x1fcfcf,_0x5c8867){_0x1fcfcf=_0x1fcfcf-0x0;var _0x4346f5=_0xf6cb[_0x1fcfcf];return _0x4346f5;};'use strict';var client=require(_0xbf6c('0x0'));exports[_0xbf6c('0x1')]=function(_0x14400f){return client[_0xbf6c('0x2')]('CreateSmsMessage',{'body':_0x14400f,'log':_0xbf6c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 2ebb431..fe4f419 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x4aa67d,_0x2558fe){var _0x20f5eb=function(_0xb9afbf){while(--_0xb9afbf){_0x4aa67d['push'](_0x4aa67d['shift']());}};_0x20f5eb(++_0x2558fe);}(_0xe706,0xa3));var _0x6e70=function(_0x54cfa4,_0x2d41ac){_0x54cfa4=_0x54cfa4-0x0;var _0x26ecf5=_0xe706[_0x54cfa4];return _0x26ecf5;};'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 +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x1f1ce2,_0x3f7c6e){var _0x52743e=function(_0x23a32c){while(--_0x23a32c){_0x1f1ce2['push'](_0x1f1ce2['shift']());}};_0x52743e(++_0x3f7c6e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xb7e7[_0x42f009];return _0x22a1e0;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 13ea53d..e5352e9 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x3b0c67,_0x3edd6f){var _0x16cdd1=function(_0x198dbf){while(--_0x198dbf){_0x3b0c67['push'](_0x3b0c67['shift']());}};_0x16cdd1(++_0x3edd6f);}(_0x34e8,0x12c));var _0x834e=function(_0x388d2b,_0x36b89f){_0x388d2b=_0x388d2b-0x0;var _0x5018c1=_0x34e8[_0x388d2b];return _0x5018c1;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5717fa,_0x4c0526){var _0xcfcaa3=function(_0x239180){while(--_0x239180){_0x5717fa['push'](_0x5717fa['shift']());}};_0xcfcaa3(++_0x4c0526);}(_0x008c,0x188));var _0xc008=function(_0x4dfd10,_0x3169d5){_0x4dfd10=_0x4dfd10-0x0;var _0x267950=_0x008c[_0x4dfd10];return _0x267950;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index e6353c5..1f0ad86 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(_0x485c22,_0x46cd95){var _0x35e3f8=function(_0x28bb50){while(--_0x28bb50){_0x485c22['push'](_0x485c22['shift']());}};_0x35e3f8(++_0x46cd95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x2579a4,_0x3ce934){var _0x2afd00=function(_0x1f1ec2){while(--_0x1f1ec2){_0x2579a4['push'](_0x2579a4['shift']());}};_0x2afd00(++_0x3ce934);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 bf58f5d..a913f61 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 _0x93bb=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x3f528a,_0xbf8522){var _0x39ffb5=function(_0x574ab7){while(--_0x574ab7){_0x3f528a['push'](_0x3f528a['shift']());}};_0x39ffb5(++_0xbf8522);}(_0x93bb,0x135));var _0xb93b=function(_0x126f94,_0x3163bb){_0x126f94=_0x126f94-0x0;var _0x4defd1=_0x93bb[_0x126f94];return _0x4defd1;};'use strict';var client=require(_0xb93b('0x0'));exports[_0xb93b('0x1')]=function(_0x3f1712,_0x34b579){return client[_0xb93b('0x2')](_0xb93b('0x3'),{'body':_0x34b579,'options':{'where':{'id':_0x3f1712}},'log':_0xb93b('0x4')});};exports[_0xb93b('0x5')]=function(_0x3eb285,_0x355196){return client['Request'](_0xb93b('0x6'),{'body':_0x355196,'options':{'where':{'id':_0x3eb285}},'log':_0xb93b('0x7')});}; \ No newline at end of file +var _0x01d9=['addTags','Request','AddTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x43b807,_0x527ec6){var _0x3ce675=function(_0x4e28a0){while(--_0x4e28a0){_0x43b807['push'](_0x43b807['shift']());}};_0x3ce675(++_0x527ec6);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x901d('0x0'));exports[_0x901d('0x1')]=function(_0x30eba2,_0x209575){return client['Request'](_0x901d('0x2'),{'body':_0x209575,'options':{'where':{'id':_0x30eba2}},'log':_0x901d('0x3')});};exports[_0x901d('0x4')]=function(_0x8f7b4,_0x214f38){return client[_0x901d('0x5')](_0x901d('0x6'),{'body':_0x214f38,'options':{'where':{'id':_0x8f7b4}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 9d57ffb..2495c4d 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 _0x13a0=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0x13a0,0x1ce));var _0x013a=function(_0x501099,_0x223250){_0x501099=_0x501099-0x0;var _0x555ebf=_0x13a0[_0x501099];return _0x555ebf;};'use strict';var client=require('../client');exports[_0x013a('0x0')]=function(_0x4d443f){return client[_0x013a('0x1')](_0x013a('0x2'),{'body':_0x4d443f,'log':_0x013a('0x3')});}; \ No newline at end of file +var _0x16e2=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x309903,_0x1f850a){var _0x485dea=function(_0x1fbebd){while(--_0x1fbebd){_0x309903['push'](_0x309903['shift']());}};_0x485dea(++_0x1f850a);}(_0x16e2,0xde));var _0x216e=function(_0x37bb3a,_0xb33e31){_0x37bb3a=_0x37bb3a-0x0;var _0x538c4d=_0x16e2[_0x37bb3a];return _0x538c4d;};'use strict';var client=require(_0x216e('0x0'));exports[_0x216e('0x1')]=function(_0x38d20b){return client[_0x216e('0x2')](_0x216e('0x3'),{'body':_0x38d20b,'log':_0x216e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ad6480f..365a113 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 _0x71d2=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x13a219,_0x25acd3){var _0x50e371=function(_0x187aea){while(--_0x187aea){_0x13a219['push'](_0x13a219['shift']());}};_0x50e371(++_0x25acd3);}(_0x71d2,0x64));var _0x271d=function(_0x3a247e,_0x4b9170){_0x3a247e=_0x3a247e-0x0;var _0x372de8=_0x71d2[_0x3a247e];return _0x372de8;};'use strict';var client=require('../client');exports[_0x271d('0x0')]=function(){return function(){return client[_0x271d('0x1')](_0x271d('0x2'),{'options':{'raw':![],'attributes':['id',_0x271d('0x3'),_0x271d('0x4'),_0x271d('0x5')],'include':[{'model':_0x271d('0x6'),'as':_0x271d('0x7'),'attributes':['id','name','online',_0x271d('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x25f7=['GetWhatsappQueue','name','timeout','User','online','whatsappPause','../client','getWhatsappQueues','Request'];(function(_0x2e6021,_0x39ea73){var _0x49d2c6=function(_0x4ed7e3){while(--_0x4ed7e3){_0x2e6021['push'](_0x2e6021['shift']());}};_0x49d2c6(++_0x39ea73);}(_0x25f7,0x19b));var _0x725f=function(_0x3c44c3,_0xc882c8){_0x3c44c3=_0x3c44c3-0x0;var _0x56d961=_0x25f7[_0x3c44c3];return _0x56d961;};'use strict';var client=require(_0x725f('0x0'));exports[_0x725f('0x1')]=function(){return function(){return client[_0x725f('0x2')](_0x725f('0x3'),{'options':{'raw':![],'attributes':['id',_0x725f('0x4'),_0x725f('0x5'),'strategy'],'include':[{'model':_0x725f('0x6'),'as':'Agents','attributes':['id',_0x725f('0x4'),_0x725f('0x7'),_0x725f('0x8')]}]},'log':_0x725f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 8337ee9..558eb08 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 _0xe18d=['Request','UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport','update'];(function(_0x28f8e4,_0x52349f){var _0x1f2ebd=function(_0xae7aab){while(--_0xae7aab){_0x28f8e4['push'](_0x28f8e4['shift']());}};_0x1f2ebd(++_0x52349f);}(_0xe18d,0x75));var _0xde18=function(_0x4dc161,_0x13b5f8){_0x4dc161=_0x4dc161-0x0;var _0x4c5572=_0xe18d[_0x4dc161];return _0x4c5572;};'use strict';var client=require(_0xde18('0x0'));exports['create']=function(_0x127ad0){return client['Request'](_0xde18('0x1'),{'body':_0x127ad0,'log':_0xde18('0x1')});};exports[_0xde18('0x2')]=function(_0x283528,_0x42a502){return client[_0xde18('0x3')](_0xde18('0x4'),{'body':_0x42a502,'options':{'where':{'uniqueid':_0x283528},'order':[['id',_0xde18('0x5')]],'limit':0x1},'log':_0xde18('0x4')});}; \ No newline at end of file +var _0x80f8=['../client','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC'];(function(_0x367f90,_0x91e171){var _0x1bd7ee=function(_0x3a739c){while(--_0x3a739c){_0x367f90['push'](_0x367f90['shift']());}};_0x1bd7ee(++_0x91e171);}(_0x80f8,0x14a));var _0x880f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x80f8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x880f('0x0'));exports['create']=function(_0x19f9b2){return client['Request'](_0x880f('0x1'),{'body':_0x19f9b2,'log':_0x880f('0x1')});};exports[_0x880f('0x2')]=function(_0x2062e5,_0x4fd12d){return client[_0x880f('0x3')](_0x880f('0x4'),{'body':_0x4fd12d,'options':{'where':{'uniqueid':_0x2062e5},'order':[['id',_0x880f('0x5')]],'limit':0x1},'log':_0x880f('0x4')});}; \ 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 1e3f4ac..1c2514e 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 _0xf5cc=['info','format','name','toLowerCase','consequence','length','error','map','join','stop','find','agents','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xf5cc,0x1a5));var _0xcf5c=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xf5cc[_0x176329];return _0x31997c;};'use strict';var schema=require(_0xcf5c('0x0'));var _=require(_0xcf5c('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xcf5c('0x2'));var strategy=require(_0xcf5c('0x3'));var queue=schema({'name':{'type':_0xcf5c('0x4'),'required':!![],'message':_0xcf5c('0x5')},'timeout':{'type':_0xcf5c('0x6'),'message':_0xcf5c('0x7')}});function writeLog(_0x318cf5,_0x1dbede,_0xfa62c8){return logger[_0xcf5c('0x8')](util[_0xcf5c('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x318cf5,_0x1dbede[_0xcf5c('0xa')],_0xfa62c8));}function handleFindAgent(_0x2fae1b){return function(_0x36f6be){return _0x36f6be[_0xcf5c('0xa')][_0xcf5c('0xb')]()===_0x2fae1b['toLowerCase']();};}exports[_0xcf5c('0xc')]=function(_0xdf0ba3,_0x26c7ed,_0x285f00,_0x271642){return function(_0x1f1c49){try{var _0x255c4a={'name':_0x26c7ed[0x0],'timeout':_0x26c7ed[0x1]};var _0x5c5a22=queue[_0xcf5c('0x0')](_0x255c4a,{'typecast':!![]});if(_0x5c5a22[_0xcf5c('0xd')]){logger[_0xcf5c('0xe')]('[%s][AGENT]\x20%s',_0xdf0ba3,_[_0xcf5c('0xf')](_0x5c5a22,'message')[_0xcf5c('0x10')](',\x20'));_0x1f1c49[_0xcf5c('0x11')]();}else{var _0x34b035=_[_0xcf5c('0x12')](_0x285f00[_0xcf5c('0x13')],handleFindAgent(_0x255c4a[_0xcf5c('0xa')]));if(_0x34b035){var _0x271286=(_0x255c4a['timeout']||0xa)*0x3e8;var _0x2a6e4c,_0x32d917;var _0x37eee2=seqqueue['createQueue'](_0x271286);_0x37eee2['id']=_0xdf0ba3;_0x37eee2[_0xcf5c('0x14')]=_0x271286;_0x37eee2['channel']=_0x271642[_0xcf5c('0x15')];writeLog(_0xdf0ba3,_0x34b035,util[_0xcf5c('0x9')](_0xcf5c('0x16'),_0x271286));_0x285f00[_0xcf5c('0x17')][_0xdf0ba3]['on'](_0xcf5c('0x18'),function(){logger[_0xcf5c('0x8')](_0xcf5c('0x19'),_0xdf0ba3);clearTimeout(_0x32d917);_0x32d917=undefined;_0x37eee2['close']();if(_0x285f00[_0xcf5c('0x17')][_0xdf0ba3]){delete _0x285f00[_0xcf5c('0x17')][_0xdf0ba3];}_0x1f1c49[_0xcf5c('0x11')]();});_0x285f00['rules'][_0xdf0ba3]['on']('complete',function(){if(_0x285f00[_0xcf5c('0x17')][_0xdf0ba3]){delete _0x285f00[_0xcf5c('0x17')][_0xdf0ba3];}});_0x32d917=setTimeout(function(){logger[_0xcf5c('0x8')](_0xcf5c('0x1a'),_0xdf0ba3);clearTimeout(_0x32d917);_0x37eee2[_0xcf5c('0x1b')]();_0x1f1c49[_0xcf5c('0x1c')]();},_0x271286);strategy['agent'](_0x37eee2,_0x34b035,_0x285f00,_0x271642);}else{logger['error'](_0xcf5c('0x1d'),_0xdf0ba3,_0x255c4a[_0xcf5c('0xa')]);_0x1f1c49[_0xcf5c('0x11')]();}}}catch(_0xf3ddf){console[_0xcf5c('0x1e')](_0xf3ddf);logger[_0xcf5c('0xe')](_0xcf5c('0x1f'),_0xdf0ba3,_0xf3ddf[_0xcf5c('0x20')]);_0x1f1c49['stop']();}};}; \ No newline at end of file +var _0x6b2b=['stop','find','agents','timeout','createQueue','atimeout','channel','format','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','close','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','lodash','util','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6b2b,0x97));var _0xb6b2=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x6b2b[_0x3740fe];return _0x55492b;};'use strict';var schema=require('validate');var _=require(_0xb6b2('0x0'));var util=require(_0xb6b2('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xb6b2('0x2'))(_0xb6b2('0x3'));var strategy=require(_0xb6b2('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xb6b2('0x5')},'timeout':{'type':'number','message':_0xb6b2('0x6')}});function writeLog(_0x59e585,_0x3590e3,_0x3e2cc6){return logger[_0xb6b2('0x7')](util['format'](_0xb6b2('0x8'),_0x59e585,_0x3590e3[_0xb6b2('0x9')],_0x3e2cc6));}function handleFindAgent(_0x3b1b55){return function(_0x274428){return _0x274428[_0xb6b2('0x9')][_0xb6b2('0xa')]()===_0x3b1b55[_0xb6b2('0xa')]();};}exports[_0xb6b2('0xb')]=function(_0x4a5eb6,_0x40063e,_0x2138d6,_0x1d09e6){return function(_0x425c1a){try{var _0x1c14d8={'name':_0x40063e[0x0],'timeout':_0x40063e[0x1]};var _0x45366c=queue[_0xb6b2('0xc')](_0x1c14d8,{'typecast':!![]});if(_0x45366c[_0xb6b2('0xd')]){logger[_0xb6b2('0xe')](_0xb6b2('0xf'),_0x4a5eb6,_[_0xb6b2('0x10')](_0x45366c,_0xb6b2('0x11'))[_0xb6b2('0x12')](',\x20'));_0x425c1a[_0xb6b2('0x13')]();}else{var _0x4a5cf2=_[_0xb6b2('0x14')](_0x2138d6[_0xb6b2('0x15')],handleFindAgent(_0x1c14d8[_0xb6b2('0x9')]));if(_0x4a5cf2){var _0x7a6819=(_0x1c14d8[_0xb6b2('0x16')]||0xa)*0x3e8;var _0x53347d,_0x473a84;var _0x5201cf=seqqueue[_0xb6b2('0x17')](_0x7a6819);_0x5201cf['id']=_0x4a5eb6;_0x5201cf[_0xb6b2('0x18')]=_0x7a6819;_0x5201cf['channel']=_0x1d09e6[_0xb6b2('0x19')];writeLog(_0x4a5eb6,_0x4a5cf2,util[_0xb6b2('0x1a')]('START:%s',_0x7a6819));_0x2138d6[_0xb6b2('0x1b')][_0x4a5eb6]['on'](_0xb6b2('0x1c'),function(){logger['info'](_0xb6b2('0x1d'),_0x4a5eb6);clearTimeout(_0x473a84);_0x473a84=undefined;_0x5201cf['close']();if(_0x2138d6[_0xb6b2('0x1b')][_0x4a5eb6]){delete _0x2138d6[_0xb6b2('0x1b')][_0x4a5eb6];}_0x425c1a[_0xb6b2('0x13')]();});_0x2138d6[_0xb6b2('0x1b')][_0x4a5eb6]['on'](_0xb6b2('0x1e'),function(){if(_0x2138d6[_0xb6b2('0x1b')][_0x4a5eb6]){delete _0x2138d6[_0xb6b2('0x1b')][_0x4a5eb6];}});_0x473a84=setTimeout(function(){logger[_0xb6b2('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x4a5eb6);clearTimeout(_0x473a84);_0x5201cf[_0xb6b2('0x1f')]();_0x425c1a['next']();},_0x7a6819);strategy['agent'](_0x5201cf,_0x4a5cf2,_0x2138d6,_0x1d09e6);}else{logger['error'](_0xb6b2('0x20'),_0x4a5eb6,_0x1c14d8['name']);_0x425c1a[_0xb6b2('0x13')]();}}}catch(_0x3fb3e7){console['log'](_0x3fb3e7);logger[_0xb6b2('0xe')](_0xb6b2('0x21'),_0x4a5eb6,_0x3fb3e7['stack']);_0x425c1a['stop']();}};}; \ 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 e61ec18..e4aa9a9 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 _0x0e1a=['finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','then','dialogState','Failed','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','chat','account','AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','body','catch','error','stringify'];(function(_0x46c5d3,_0x591ff9){var _0x280fc2=function(_0x5e7d2c){while(--_0x5e7d2c){_0x46c5d3['push'](_0x46c5d3['shift']());}};_0x280fc2(++_0x591ff9);}(_0x0e1a,0x1d0));var _0xa0e1=function(_0x260f5d,_0x43e929){_0x260f5d=_0x260f5d-0x0;var _0x5d1bcf=_0x0e1a[_0x260f5d];return _0x5d1bcf;};'use strict';var _=require(_0xa0e1('0x0'));var moment=require(_0xa0e1('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xa0e1('0x2'));var rpc={'chatMessage':require(_0xa0e1('0x3')),'openchannelMessage':require(_0xa0e1('0x4')),'mailMessage':require(_0xa0e1('0x5')),'smsMessage':require(_0xa0e1('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa0e1('0x7'))};exports[_0xa0e1('0x8')]=function(_0x3c14ae,_0x59b055){return function(_0x5e7398){try{if(!_[_0xa0e1('0x9')](this['interaction'][_0xa0e1('0xa')])){logger[_0xa0e1('0xb')](_0xa0e1('0xc'),_0x3c14ae,_0xa0e1('0xd'));return _0x5e7398[_0xa0e1('0xe')]();}var _0x174fb2={'ContactId':this[_0xa0e1('0xf')]['id'],'sentAt':moment()[_0xa0e1('0x10')](_0xa0e1('0x11')),'direction':_0xa0e1('0x12')};if(this[_0xa0e1('0x13')]===_0xa0e1('0x14')||this['channel']===_0xa0e1('0x15')){_0x174fb2['phone']=this[_0xa0e1('0x16')][_0xa0e1('0x17')];}var _0x32753d=this[_0xa0e1('0x13')];if(_0x32753d===_0xa0e1('0x18')){_0x174fb2['ChatWebsiteId']=this[_0xa0e1('0x19')]['id'];}else{_0x174fb2[_['upperFirst'](_0x32753d)+_0xa0e1('0x1a')]=this['account']['id'];}_0x174fb2[_[_0xa0e1('0x1b')](_0x32753d)+_0xa0e1('0x1c')]=this[_0xa0e1('0x16')]['id'];if(this[_0xa0e1('0x16')]['created']){var _0x3df9b1=_0x59b055[0x4];if(!_[_0xa0e1('0x1d')](_0x3df9b1)){_0x174fb2['body']=utils[_0xa0e1('0x1e')](_0x3df9b1,this);return rpc[_0x32753d+_0xa0e1('0x1f')]['create'](_0x174fb2)['then'](function(_0x3e3fe6){logger[_0xa0e1('0xb')](_0xa0e1('0xc'),_0x3c14ae,_0x174fb2[_0xa0e1('0x20')]);})[_0xa0e1('0x21')](function(_0x4b98c8){logger[_0xa0e1('0x22')]('[%s][AMAZONLEX]\x20%s',_0x3c14ae,JSON[_0xa0e1('0x23')](_0x4b98c8));})[_0xa0e1('0x24')](function(){logger[_0xa0e1('0xb')](_0xa0e1('0x25'),_0x3c14ae);_0x5e7398[_0xa0e1('0x26')]();});}else{logger[_0xa0e1('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3c14ae);_0x5e7398[_0xa0e1('0x26')]();}}else{var _0x589bb8=this;var _0x56130a=new AWS[(_0xa0e1('0x27'))]({'accessKeyId':_0x59b055[0x0],'secretAccessKey':_0x59b055[0x1],'region':_0x59b055[0x2]});var _0x494075={'botAlias':_0xa0e1('0x28'),'botName':_0x59b055[0x3],'inputText':this[_0xa0e1('0x29')][_0xa0e1('0x20')],'userId':this[_0xa0e1('0x13')]+':'+this['interaction']['id'][_0xa0e1('0x2a')]()};_0x56130a[_0xa0e1('0x2b')](_0x494075,function(_0x1e029f,_0x1e2c4c){if(_0x1e029f){logger[_0xa0e1('0x22')](_0xa0e1('0xc'),_0x3c14ae,_0x1e029f['message']);_0x5e7398[_0xa0e1('0xe')]();}else if(_0x1e2c4c&&_0x1e2c4c['message']){_0x589bb8[_0xa0e1('0x20')][_0xa0e1('0x2c')]=_0x1e2c4c;_0x174fb2[_0xa0e1('0x20')]=_0x1e2c4c[_0xa0e1('0x29')];_0x174fb2[_0xa0e1('0x2d')]='amazonlex';_0x174fb2[_0xa0e1('0x2e')]=JSON[_0xa0e1('0x23')](_0x1e2c4c);return rpc[_0x32753d+'Message']['create'](_0x174fb2)[_0xa0e1('0x2f')](function(_0x37468a){logger[_0xa0e1('0xb')](_0xa0e1('0xc'),_0x3c14ae,_0x174fb2['body']);if(_0x1e2c4c[_0xa0e1('0x30')]==_0xa0e1('0x31')){_0x5e7398[_0xa0e1('0xe')]();}else{_0x5e7398[_0xa0e1('0x26')]();}})['catch'](function(_0x37a2aa){logger[_0xa0e1('0x22')]('[%s][AMAZONLEX]\x20%s',_0x3c14ae,JSON['stringify'](_0x37a2aa));_0x5e7398[_0xa0e1('0xe')]();});}else{_0x5e7398[_0xa0e1('0xe')]();}});}}catch(_0x4fdd38){logger[_0xa0e1('0x22')](_0xa0e1('0xc'),_0x3c14ae,JSON[_0xa0e1('0x23')](_0x4fdd38));_0x5e7398[_0xa0e1('0x26')]();}};}; \ No newline at end of file +var _0xefbb=['catch','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','error','message','amazonlex','providerResponse','dialogState','Failed','next','stringify','lodash','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','out','whatsapp','phone','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info'];(function(_0x158641,_0x5b701d){var _0x10bd90=function(_0x46dfe0){while(--_0x46dfe0){_0x158641['push'](_0x158641['shift']());}};_0x10bd90(++_0x5b701d);}(_0xefbb,0x136));var _0xbefb=function(_0x37e09a,_0x1218dc){_0x37e09a=_0x37e09a-0x0;var _0x36272c=_0xefbb[_0x37e09a];return _0x36272c;};'use strict';var _=require(_0xbefb('0x0'));var moment=require('moment');var AWS=require(_0xbefb('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xbefb('0x2'));var rpc={'chatMessage':require(_0xbefb('0x3')),'openchannelMessage':require(_0xbefb('0x4')),'mailMessage':require(_0xbefb('0x5')),'smsMessage':require(_0xbefb('0x6')),'faxMessage':require(_0xbefb('0x7')),'whatsappMessage':require(_0xbefb('0x8'))};exports[_0xbefb('0x9')]=function(_0x175fe4,_0xc3ff2d){return function(_0x2917b6){try{if(!_[_0xbefb('0xa')](this[_0xbefb('0xb')][_0xbefb('0xc')])){logger['info'](_0xbefb('0xd'),_0x175fe4,_0xbefb('0xe'));return _0x2917b6['next']();}var _0x262e33={'ContactId':this[_0xbefb('0xf')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xbefb('0x10')};if(this['channel']==='sms'||this['channel']===_0xbefb('0x11')){_0x262e33[_0xbefb('0x12')]=this[_0xbefb('0xb')][_0xbefb('0x12')];}var _0x4487bb=this[_0xbefb('0x13')];if(_0x4487bb==='chat'){_0x262e33[_0xbefb('0x14')]=this[_0xbefb('0x15')]['id'];}else{_0x262e33[_[_0xbefb('0x16')](_0x4487bb)+_0xbefb('0x17')]=this['account']['id'];}_0x262e33[_['upperFirst'](_0x4487bb)+_0xbefb('0x18')]=this[_0xbefb('0xb')]['id'];if(this[_0xbefb('0xb')][_0xbefb('0x19')]){var _0x9490ac=_0xc3ff2d[0x4];if(!_[_0xbefb('0x1a')](_0x9490ac)){_0x262e33[_0xbefb('0x1b')]=utils[_0xbefb('0x1c')](_0x9490ac,this);return rpc[_0x4487bb+_0xbefb('0x1d')][_0xbefb('0x1e')](_0x262e33)[_0xbefb('0x1f')](function(_0x31e627){logger[_0xbefb('0x20')](_0xbefb('0xd'),_0x175fe4,_0x262e33['body']);})[_0xbefb('0x21')](function(_0x41212c){logger['error'](_0xbefb('0xd'),_0x175fe4,JSON['stringify'](_0x41212c));})[_0xbefb('0x22')](function(){logger[_0xbefb('0x20')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x175fe4);_0x2917b6[_0xbefb('0x23')]();});}else{logger[_0xbefb('0x20')](_0xbefb('0x24'),_0x175fe4);_0x2917b6['stop']();}}else{var _0x36b2fa=this;var _0x2a00aa=new AWS[(_0xbefb('0x25'))]({'accessKeyId':_0xc3ff2d[0x0],'secretAccessKey':_0xc3ff2d[0x1],'region':_0xc3ff2d[0x2]});var _0x3fee2f={'botAlias':_0xbefb('0x26'),'botName':_0xc3ff2d[0x3],'inputText':this['message'][_0xbefb('0x1b')],'userId':this[_0xbefb('0x13')]+':'+this[_0xbefb('0xb')]['id'][_0xbefb('0x27')]()};_0x2a00aa[_0xbefb('0x28')](_0x3fee2f,function(_0x463271,_0x2245c0){if(_0x463271){logger[_0xbefb('0x29')](_0xbefb('0xd'),_0x175fe4,_0x463271[_0xbefb('0x2a')]);_0x2917b6['next']();}else if(_0x2245c0&&_0x2245c0[_0xbefb('0x2a')]){_0x36b2fa['body'][_0xbefb('0x2b')]=_0x2245c0;_0x262e33['body']=_0x2245c0['message'];_0x262e33['providerName']=_0xbefb('0x2b');_0x262e33[_0xbefb('0x2c')]=JSON['stringify'](_0x2245c0);return rpc[_0x4487bb+'Message'][_0xbefb('0x1e')](_0x262e33)[_0xbefb('0x1f')](function(_0x4a927a){logger[_0xbefb('0x20')](_0xbefb('0xd'),_0x175fe4,_0x262e33['body']);if(_0x2245c0[_0xbefb('0x2d')]==_0xbefb('0x2e')){_0x2917b6[_0xbefb('0x2f')]();}else{_0x2917b6[_0xbefb('0x23')]();}})['catch'](function(_0x53be70){logger[_0xbefb('0x29')]('[%s][AMAZONLEX]\x20%s',_0x175fe4,JSON[_0xbefb('0x30')](_0x53be70));_0x2917b6[_0xbefb('0x2f')]();});}else{_0x2917b6['next']();}});}}catch(_0x54e841){logger['error'](_0xbefb('0xd'),_0x175fe4,JSON[_0xbefb('0x30')](_0x54e841));_0x2917b6[_0xbefb('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 7a7f0d4..6a02785 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 _0x5c75=['InteractionId','Message','messageId','','replace','','auto-replied','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','stop','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','format','mail','body','getMustacheRender','message','from','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c75,0x1ad));var _0x55c7=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0x5c75[_0x58da8a];return _0x5294b9;};'use strict';var _=require('lodash');var moment=require(_0x55c7('0x0'));var utils=require('./utils');var logger=require(_0x55c7('0x1'))('routing');var rpc={'chatMessage':require(_0x55c7('0x2')),'openchannelMessage':require(_0x55c7('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x55c7('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x55c7('0x5')),'openchannelInteraction':require(_0x55c7('0x6')),'mailInteraction':require(_0x55c7('0x7')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x55c7('0x8')),'whatsappInteraction':require(_0x55c7('0x9'))};var mailRpc=require('../../mailRpc');exports[_0x55c7('0xa')]=function(_0x5e0882,_0x37dd51,_0x4c617c,_0x269558){return function(_0x1bbaab){try{var _0x9e8630=this[_0x55c7('0xb')];if(_0x9e8630==='mail'&&_0x269558['body'][_0x55c7('0xc')]){logger[_0x55c7('0xd')](_0x55c7('0xe'),_0x5e0882,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x1bbaab[_0x55c7('0xf')]();}if(_0x37dd51[0x0]==='1'&&(_['isNil'](this[_0x55c7('0x10')][_0x55c7('0x11')])||!this[_0x55c7('0x10')][_0x55c7('0x11')])){logger[_0x55c7('0xd')]('[%s][AUTOREPLY]\x20%s',_0x5e0882,_0x55c7('0x12'));return _0x1bbaab[_0x55c7('0xf')]();}if(_0x37dd51[0x0]==='2'&&this[_0x55c7('0x10')][_0x55c7('0x13')]){logger[_0x55c7('0xd')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5e0882,'One\x20Time\x20already\x20sent');return _0x1bbaab[_0x55c7('0xf')]();}var _0x415f6e={'ContactId':this['contact']['id'],'sentAt':moment()[_0x55c7('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x55c7('0x15')){_0x415f6e[_0x55c7('0x16')]=utils[_0x55c7('0x17')](_0x37dd51[0x2],this);}else{_0x415f6e['body']=utils[_0x55c7('0x17')](_0x37dd51[0x1],this);}if(this[_0x55c7('0x18')]){_0x415f6e['to']=this['message'][_0x55c7('0x19')]||'';if(this[_0x55c7('0xb')]===_0x55c7('0x15')&&_0x37dd51[0x1]==='1'){_0x415f6e['cc']=this[_0x55c7('0x18')]['cc']||'';}_0x415f6e[_0x55c7('0x19')]=this[_0x55c7('0x18')]['to']||'';_0x415f6e['phone']=this[_0x55c7('0x18')]['phone']||'';_0x415f6e[_0x55c7('0x1a')]=!![];if(this[_0x55c7('0x18')]['subject']){_0x415f6e['subject']='';_0x415f6e[_0x55c7('0x1b')]+=_[_0x55c7('0x1c')](this[_0x55c7('0x18')]['subject'],_0x55c7('0x1d'))?'':_0x55c7('0x1e');_0x415f6e['subject']+=this[_0x55c7('0x18')]['subject'];}}if(this[_0x55c7('0xb')]==='chat'){_0x415f6e[_0x55c7('0x1f')]=this[_0x55c7('0x20')]['id'];}else{_0x415f6e[_[_0x55c7('0x21')](this['channel'])+_0x55c7('0x22')]=this['account']['id'];}_0x415f6e[_[_0x55c7('0x21')](this[_0x55c7('0xb')])+_0x55c7('0x23')]=this[_0x55c7('0x10')]['id'];var _0x59240e=this[_0x55c7('0x10')];if(rpc[this[_0x55c7('0xb')]+_0x55c7('0x24')]){if(this[_0x55c7('0xb')]===_0x55c7('0x15')){_0x415f6e['inReplyTo']=this['message'][_0x55c7('0x25')];_0x415f6e['html']=_0x55c7('0x26')+_[_0x55c7('0x27')](_0x415f6e[_0x55c7('0x16')],_0x55c7('0x28'),'','','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify'];(function(_0x447ce1,_0x11cf0b){var _0x4c1e7a=function(_0x6693b9){while(--_0x6693b9){_0x447ce1['push'](_0x447ce1['shift']());}};_0x4c1e7a(++_0x11cf0b);}(_0x72a4,0x1ce));var _0x472a=function(_0xf64e53,_0x4db24b){_0xf64e53=_0xf64e53-0x0;var _0x1e185e=_0x72a4[_0xf64e53];return _0x1e185e;};'use strict';var _=require(_0x472a('0x0'));var moment=require('moment');var utils=require(_0x472a('0x1'));var logger=require(_0x472a('0x2'))(_0x472a('0x3'));var rpc={'chatMessage':require(_0x472a('0x4')),'openchannelMessage':require(_0x472a('0x5')),'mailMessage':require(_0x472a('0x6')),'smsMessage':require(_0x472a('0x7')),'faxMessage':require(_0x472a('0x8')),'whatsappMessage':require(_0x472a('0x9')),'chatInteraction':require(_0x472a('0xa')),'openchannelInteraction':require(_0x472a('0xb')),'mailInteraction':require(_0x472a('0xc')),'smsInteraction':require(_0x472a('0xd')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x472a('0xe'));exports['consequence']=function(_0x1de569,_0x52c489,_0x157bda,_0x179b2d){return function(_0x41b0f0){try{var _0x2a5bdd=this[_0x472a('0xf')];if(_0x2a5bdd==='mail'&&_0x179b2d[_0x472a('0x10')][_0x472a('0x11')]){logger[_0x472a('0x12')](_0x472a('0x13'),_0x1de569,_0x472a('0x14'));return _0x41b0f0[_0x472a('0x15')]();}if(_0x52c489[0x0]==='1'&&(_[_0x472a('0x16')](this['interaction'][_0x472a('0x17')])||!this[_0x472a('0x18')][_0x472a('0x17')])){logger[_0x472a('0x12')](_0x472a('0x13'),_0x1de569,_0x472a('0x19'));return _0x41b0f0[_0x472a('0x15')]();}if(_0x52c489[0x0]==='2'&&this['interaction'][_0x472a('0x1a')]){logger[_0x472a('0x12')](_0x472a('0x1b'),_0x1de569,_0x472a('0x1c'));return _0x41b0f0[_0x472a('0x15')]();}var _0x456f73={'ContactId':this['contact']['id'],'sentAt':moment()[_0x472a('0x1d')](_0x472a('0x1e')),'direction':_0x472a('0x1f')};if(this[_0x472a('0xf')]===_0x472a('0x20')){_0x456f73[_0x472a('0x10')]=utils[_0x472a('0x21')](_0x52c489[0x2],this);}else{_0x456f73[_0x472a('0x10')]=utils['getMustacheRender'](_0x52c489[0x1],this);}if(this[_0x472a('0x22')]){_0x456f73['to']=this[_0x472a('0x22')][_0x472a('0x23')]||'';if(this['channel']===_0x472a('0x20')&&_0x52c489[0x1]==='1'){_0x456f73['cc']=this['message']['cc']||'';}_0x456f73['from']=this[_0x472a('0x22')]['to']||'';_0x456f73['phone']=this[_0x472a('0x22')][_0x472a('0x24')]||'';_0x456f73['read']=!![];if(this[_0x472a('0x22')]['subject']){_0x456f73[_0x472a('0x25')]='';_0x456f73['subject']+=_['startsWith'](this[_0x472a('0x22')]['subject'],_0x472a('0x26'))?'':'Re:\x20';_0x456f73[_0x472a('0x25')]+=this[_0x472a('0x22')][_0x472a('0x25')];}}if(this[_0x472a('0xf')]==='chat'){_0x456f73[_0x472a('0x27')]=this[_0x472a('0x28')]['id'];}else{_0x456f73[_[_0x472a('0x29')](this[_0x472a('0xf')])+_0x472a('0x2a')]=this[_0x472a('0x28')]['id'];}_0x456f73[_['upperFirst'](this[_0x472a('0xf')])+_0x472a('0x2b')]=this[_0x472a('0x18')]['id'];var _0xf922dd=this[_0x472a('0x18')];if(rpc[this[_0x472a('0xf')]+_0x472a('0x2c')]){if(this['channel']==='mail'){_0x456f73[_0x472a('0x2d')]=this[_0x472a('0x22')][_0x472a('0x2e')];_0x456f73['html']=_0x472a('0x2f')+_['replace'](_0x456f73[_0x472a('0x10')],']+(>|$)/g,''),'priorityTrue':_0x79a1d4[0x1],'priorityFalse':_0x79a1d4[0x2]};var _0x354070=gotoif[_0xac50('0xb')](_0x483976,{'typecast':!![]});if(_0x354070['length']){logger[_0xac50('0xc')](_0xac50('0xd'),_0x466ba7,_[_0xac50('0xe')](_0x354070,_0xac50('0xf'))['join'](',\x20'));_0x56aa98[_0xac50('0x10')]();}else{try{var _0x3b0e25=eval('('+_0x483976[_0xac50('0x11')]+')');var _0x3a4d46=_0x3b0e25?_0x483976[_0xac50('0x12')]:_0x483976[_0xac50('0x13')];logger[_0xac50('0x14')](_0xac50('0x15'),_0x466ba7,_0x483976[_0xac50('0x11')],_0x3b0e25,_0x3a4d46||_0xac50('0x16'));if(_0x3a4d46){var _0x4d7ba4=_['findIndex'](_0x56aa98[_0xac50('0x17')](),{'p':_0x3a4d46});if(_0x4d7ba4>=0x0){logger['info'](_0xac50('0x18'),_0x466ba7,_0x3a4d46||_0xac50('0x16'),_0x4d7ba4);_0x56aa98[_0xac50('0x16')](_0x4d7ba4);}else{logger[_0xac50('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x466ba7,_0x3a4d46||'next');_0x56aa98[_0xac50('0x10')]();}}else{_0x56aa98[_0xac50('0x16')]();}}catch(_0x3933d1){logger[_0xac50('0xc')](_0xac50('0x19'),_0x466ba7,_0x3933d1['message']);_0x56aa98[_0xac50('0x10')]();}}}catch(_0x24ad69){logger[_0xac50('0xc')](_0xac50('0xd'),_0x466ba7,JSON[_0xac50('0x1a')](_0x24ad69));_0x56aa98[_0xac50('0x10')]();}};}; \ No newline at end of file +var _0xa43b=['condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','error','stringify','validate','lodash','html-to-text','../../../../config/logger','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','join','stop'];(function(_0x284511,_0x357253){var _0x5e6972=function(_0x290b89){while(--_0x290b89){_0x284511['push'](_0x284511['shift']());}};_0x5e6972(++_0x357253);}(_0xa43b,0x97));var _0xba43=function(_0x404322,_0xa181){_0x404322=_0x404322-0x0;var _0x100411=_0xa43b[_0x404322];return _0x100411;};'use strict';var schema=require(_0xba43('0x0'));var _=require(_0xba43('0x1'));var htmlToText=require(_0xba43('0x2'));var utils=require('./utils');var logger=require(_0xba43('0x3'))('routing');var gotoif=schema({'condition':{'type':_0xba43('0x4'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xba43('0x5'),'message':_0xba43('0x6')},'priorityFalse':{'type':'number','message':_0xba43('0x7')}});exports[_0xba43('0x8')]=function(_0x25e94f,_0x1708d7){return function(_0x5ce82c){try{var _0x29c06c={'condition':htmlToText[_0xba43('0x9')](utils[_0xba43('0xa')](_0x1708d7[0x0],this),{'wordwrap':![]})[_0xba43('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1708d7[0x1],'priorityFalse':_0x1708d7[0x2]};var _0x4b3433=gotoif[_0xba43('0x0')](_0x29c06c,{'typecast':!![]});if(_0x4b3433[_0xba43('0xc')]){logger['error'](_0xba43('0xd'),_0x25e94f,_[_0xba43('0xe')](_0x4b3433,'message')[_0xba43('0xf')](',\x20'));_0x5ce82c[_0xba43('0x10')]();}else{try{var _0x3384e8=eval('('+_0x29c06c[_0xba43('0x11')]+')');var _0x4c5e05=_0x3384e8?_0x29c06c['priorityTrue']:_0x29c06c[_0xba43('0x12')];logger['info'](_0xba43('0x13'),_0x25e94f,_0x29c06c[_0xba43('0x11')],_0x3384e8,_0x4c5e05||_0xba43('0x14'));if(_0x4c5e05){var _0x28e693=_[_0xba43('0x15')](_0x5ce82c['rules'](),{'p':_0x4c5e05});if(_0x28e693>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x25e94f,_0x4c5e05||_0xba43('0x14'),_0x28e693);_0x5ce82c[_0xba43('0x14')](_0x28e693);}else{logger[_0xba43('0x16')](_0xba43('0x17'),_0x25e94f,_0x4c5e05||'next');_0x5ce82c[_0xba43('0x10')]();}}else{_0x5ce82c[_0xba43('0x14')]();}}catch(_0x4bed9b){logger['error'](_0xba43('0x18'),_0x25e94f,_0x4bed9b[_0xba43('0x19')]);_0x5ce82c[_0xba43('0x10')]();}}}catch(_0x40bdb4){logger[_0xba43('0x1a')](_0xba43('0xd'),_0x25e94f,JSON[_0xba43('0x1b')](_0x40bdb4));_0x5ce82c[_0xba43('0x10')]();}};}; \ 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 d82de69..cbc10e5 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 _0xbb7d=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','message','join','stop','priority','next','info'];(function(_0x214d4e,_0x5acd62){var _0x59468a=function(_0x52cc51){while(--_0x52cc51){_0x214d4e['push'](_0x214d4e['shift']());}};_0x59468a(++_0x5acd62);}(_0xbb7d,0xf1));var _0xdbb7=function(_0x279e82,_0xe025df){_0x279e82=_0x279e82-0x0;var _0x283623=_0xbb7d[_0x279e82];return _0x283623;};'use strict';var schema=require(_0xdbb7('0x0'));var _=require(_0xdbb7('0x1'));var logger=require(_0xdbb7('0x2'))(_0xdbb7('0x3'));var gotop=schema({'priority':{'type':_0xdbb7('0x4'),'required':!![],'message':_0xdbb7('0x5')}});exports['consequence']=function(_0x4a817e,_0x40ba31){return function(_0x2b1b14){try{var _0x560313={'priority':_0x40ba31[0x0]};var _0x2caedf=gotop['validate'](_0x560313,{'typecast':!![]});if(_0x2caedf[_0xdbb7('0x6')]){logger['error'](_0xdbb7('0x7'),_0x4a817e,_['map'](_0x2caedf,_0xdbb7('0x8'))[_0xdbb7('0x9')](',\x20'));_0x2b1b14[_0xdbb7('0xa')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x4a817e,_0x560313[_0xdbb7('0xb')]);if(_0x560313['priority']){var _0x5831eb=_['findIndex'](_0x2b1b14['rules'](),{'p':_0x560313[_0xdbb7('0xb')]});if(_0x5831eb>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4a817e,_0x560313[_0xdbb7('0xb')]||_0xdbb7('0xc'),_0x5831eb);_0x2b1b14['next'](_0x5831eb);}else{logger[_0xdbb7('0xd')](_0xdbb7('0xe'),_0x4a817e,_0x560313[_0xdbb7('0xb')]||_0xdbb7('0xc'));_0x2b1b14['stop']();}}else{_0x2b1b14['next']();}}}catch(_0x5af372){logger['error']('[%s][GOTOP]\x20%s',_0x4a817e,JSON['stringify'](_0x5af372));_0x2b1b14[_0xdbb7('0xa')]();}};}; \ No newline at end of file +var _0x186f=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','next'];(function(_0x4e6c23,_0x353924){var _0x41554d=function(_0x17a40a){while(--_0x17a40a){_0x4e6c23['push'](_0x4e6c23['shift']());}};_0x41554d(++_0x353924);}(_0x186f,0x67));var _0xf186=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x186f[_0x1facfa];return _0x9ec701;};'use strict';var schema=require(_0xf186('0x0'));var _=require(_0xf186('0x1'));var logger=require(_0xf186('0x2'))(_0xf186('0x3'));var gotop=schema({'priority':{'type':_0xf186('0x4'),'required':!![],'message':_0xf186('0x5')}});exports[_0xf186('0x6')]=function(_0x18120f,_0x3f1da4){return function(_0x49f5e5){try{var _0x21ded1={'priority':_0x3f1da4[0x0]};var _0x5a1abc=gotop[_0xf186('0x0')](_0x21ded1,{'typecast':!![]});if(_0x5a1abc[_0xf186('0x7')]){logger['error'](_0xf186('0x8'),_0x18120f,_[_0xf186('0x9')](_0x5a1abc,'message')[_0xf186('0xa')](',\x20'));_0x49f5e5[_0xf186('0xb')]();}else{logger[_0xf186('0xc')](_0xf186('0xd'),_0x18120f,_0x21ded1[_0xf186('0xe')]);if(_0x21ded1['priority']){var _0x469d03=_['findIndex'](_0x49f5e5[_0xf186('0xf')](),{'p':_0x21ded1['priority']});if(_0x469d03>=0x0){logger[_0xf186('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x18120f,_0x21ded1['priority']||_0xf186('0x10'),_0x469d03);_0x49f5e5[_0xf186('0x10')](_0x469d03);}else{logger[_0xf186('0xc')](_0xf186('0x11'),_0x18120f,_0x21ded1[_0xf186('0xe')]||_0xf186('0x10'));_0x49f5e5['stop']();}}else{_0x49f5e5['next']();}}}catch(_0x3de772){logger[_0xf186('0x12')]('[%s][GOTOP]\x20%s',_0x18120f,JSON[_0xf186('0x13')](_0x3de772));_0x49f5e5[_0xf186('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 39cb10f..aed72ac 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 _0x6b9d=['create','then','info','[%s][MESSAGE]\x20%s','body','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message'];(function(_0x12e0e2,_0x34a20e){var _0x5b1820=function(_0x4daff8){while(--_0x4daff8){_0x12e0e2['push'](_0x12e0e2['shift']());}};_0x5b1820(++_0x34a20e);}(_0x6b9d,0x1e4));var _0xd6b9=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x6b9d[_0x38537f];return _0x141e23;};'use strict';var _=require(_0xd6b9('0x0'));var utils=require(_0xd6b9('0x1'));var logger=require(_0xd6b9('0x2'))(_0xd6b9('0x3'));var rpc={'chatMessage':require(_0xd6b9('0x4')),'openchannelMessage':require(_0xd6b9('0x5')),'mailMessage':require(_0xd6b9('0x6')),'smsMessage':require(_0xd6b9('0x7')),'faxMessage':require(_0xd6b9('0x8')),'whatsappMessage':require(_0xd6b9('0x9'))};exports['consequence']=function(_0xc88d44,_0x2aac6e){return function(_0x394962){try{var _0x1b4f81={'body':utils[_0xd6b9('0xa')](_0x2aac6e[0x0],this),'ContactId':this[_0xd6b9('0xb')]['id']};if(this[_0xd6b9('0xc')]===_0xd6b9('0xd')){_0x1b4f81[_0xd6b9('0xe')]=this[_0xd6b9('0xf')]['id'];}else{_0x1b4f81[_[_0xd6b9('0x10')](this['channel'])+_0xd6b9('0x11')]=this['account']['id'];}_0x1b4f81[_[_0xd6b9('0x10')](this[_0xd6b9('0xc')])+'InteractionId']=this[_0xd6b9('0x12')]['id'];if(rpc[this[_0xd6b9('0xc')]+_0xd6b9('0x13')]){return rpc[this[_0xd6b9('0xc')]+'Message'][_0xd6b9('0x14')](_0x1b4f81)[_0xd6b9('0x15')](function(_0x3b55f3){logger[_0xd6b9('0x16')](_0xd6b9('0x17'),_0xc88d44,_0x1b4f81[_0xd6b9('0x18')]);_0x394962['next']();})['catch'](function(_0x4fa0a7){logger[_0xd6b9('0x19')](_0xd6b9('0x17'),_0xc88d44,JSON[_0xd6b9('0x1a')](_0x4fa0a7));_0x394962['stop']();});}}catch(_0x2ec76c){logger[_0xd6b9('0x19')](_0xd6b9('0x17'),_0xc88d44,JSON[_0xd6b9('0x1a')](_0x2ec76c));_0x394962[_0xd6b9('0x1b')]();}};}; \ No newline at end of file +var _0xaf5c=['stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','upperFirst','channel','AccountId','InteractionId','Message','then','info','body','catch','error','[%s][MESSAGE]\x20%s','stringify'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xaf5c,0x161));var _0xcaf5=function(_0x3b8e7c,_0x148810){_0x3b8e7c=_0x3b8e7c-0x0;var _0x2dd973=_0xaf5c[_0x3b8e7c];return _0x2dd973;};'use strict';var _=require('lodash');var utils=require(_0xcaf5('0x0'));var logger=require(_0xcaf5('0x1'))(_0xcaf5('0x2'));var rpc={'chatMessage':require(_0xcaf5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcaf5('0x4')),'smsMessage':require(_0xcaf5('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcaf5('0x6'))};exports['consequence']=function(_0x1fd2d7,_0x118558){return function(_0x3695d5){try{var _0x17c418={'body':utils[_0xcaf5('0x7')](_0x118558[0x0],this),'ContactId':this[_0xcaf5('0x8')]['id']};if(this['channel']==='chat'){_0x17c418['ChatWebsiteId']=this['account']['id'];}else{_0x17c418[_[_0xcaf5('0x9')](this[_0xcaf5('0xa')])+_0xcaf5('0xb')]=this['account']['id'];}_0x17c418[_[_0xcaf5('0x9')](this[_0xcaf5('0xa')])+_0xcaf5('0xc')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0xcaf5('0xa')]+_0xcaf5('0xd')]['create'](_0x17c418)[_0xcaf5('0xe')](function(_0x121296){logger[_0xcaf5('0xf')]('[%s][MESSAGE]\x20%s',_0x1fd2d7,_0x17c418[_0xcaf5('0x10')]);_0x3695d5['next']();})[_0xcaf5('0x11')](function(_0x44df7e){logger[_0xcaf5('0x12')](_0xcaf5('0x13'),_0x1fd2d7,JSON[_0xcaf5('0x14')](_0x44df7e));_0x3695d5[_0xcaf5('0x15')]();});}}catch(_0x124a58){logger[_0xcaf5('0x12')](_0xcaf5('0x13'),_0x1fd2d7,JSON[_0xcaf5('0x14')](_0x124a58));_0x3695d5[_0xcaf5('0x15')]();}};}; \ 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 f07abc4..a061cc8 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 _0x7984=['stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x44c8a6,_0x50ba98){var _0x15ab7f=function(_0x5e7d0e){while(--_0x5e7d0e){_0x44c8a6['push'](_0x44c8a6['shift']());}};_0x15ab7f(++_0x50ba98);}(_0x7984,0xc8));var _0x4798=function(_0x14be19,_0x3067bb){_0x14be19=_0x14be19-0x0;var _0x240fb4=_0x7984[_0x14be19];return _0x240fb4;};'use strict';var utils=require(_0x4798('0x0'));var logger=require(_0x4798('0x1'))(_0x4798('0x2'));exports[_0x4798('0x3')]=function(_0x215030,_0x34e4ad){return function(_0x3cc061){try{logger[_0x4798('0x4')](_0x4798('0x5'),_0x215030,utils[_0x4798('0x6')](_0x34e4ad[0x0],this));_0x3cc061[_0x4798('0x7')]();}catch(_0x48f2c6){logger[_0x4798('0x8')]('[%s][NOOP]\x20%s',_0x215030,JSON[_0x4798('0x9')](_0x48f2c6));_0x3cc061[_0x4798('0xa')]();}};}; \ No newline at end of file +var _0xbf32=['error','stringify','stop','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x14c132,_0x30fcfa){var _0x45e0c3=function(_0x200bfe){while(--_0x200bfe){_0x14c132['push'](_0x14c132['shift']());}};_0x45e0c3(++_0x30fcfa);}(_0xbf32,0x88));var _0x2bf3=function(_0x28a77e,_0x51d7ab){_0x28a77e=_0x28a77e-0x0;var _0x323250=_0xbf32[_0x28a77e];return _0x323250;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports['consequence']=function(_0x33acdc,_0x4afa1c){return function(_0x1737e2){try{logger[_0x2bf3('0x0')](_0x2bf3('0x1'),_0x33acdc,utils[_0x2bf3('0x2')](_0x4afa1c[0x0],this));_0x1737e2[_0x2bf3('0x3')]();}catch(_0x417b32){logger[_0x2bf3('0x4')]('[%s][NOOP]\x20%s',_0x33acdc,JSON[_0x2bf3('0x5')](_0x417b32));_0x1737e2[_0x2bf3('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 774935d..e1c22f6 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 _0x2c6c=['number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','message','chat','WebsiteId','info','name','QueueReport','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','timeout','catch','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','Queues','createQueue','atimeout','qtimeout','end','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','queue_id','account','from','emit','clone','queue','push','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c6c,0xc5));var _0xc2c6=function(_0x33adac,_0xffc778){_0x33adac=_0x33adac-0x0;var _0x2ceb31=_0x2c6c[_0x33adac];return _0x2ceb31;};'use strict';var schema=require('validate');var _=require(_0xc2c6('0x0'));var util=require(_0xc2c6('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xc2c6('0x2'));var Redis=require(_0xc2c6('0x3'));var config=require(_0xc2c6('0x4'));var logger=require(_0xc2c6('0x5'))('routing');var strategy=require('./strategy');config[_0xc2c6('0x6')]=_['defaults'](config[_0xc2c6('0x6')],{'host':_0xc2c6('0x7'),'port':0x18eb});var io=require(_0xc2c6('0x8'))(new Redis(config['redis']));var attributes=['id',_0xc2c6('0x9'),_0xc2c6('0xa'),'queue',_0xc2c6('0xb'),'joinAt'];function emit(_0xf5e52,_0x4ce9d4,_0x549b20){io['to'](_0xf5e52)[_0xc2c6('0xc')](_0x4ce9d4,_0x549b20);}function emitChannelQueueInteraction(_0x5db459,_0x3dae43,_0xd6b6f,_0x48d40e,_0x840d27,_0x41ca9a,_0x747ca6,_0x1b6f3b){var _0x27eb9a=_[_0xc2c6('0xd')](_0xd6b6f);_0x27eb9a[_0xc2c6('0x9')]=_0x1b6f3b;_0x27eb9a[_0xc2c6('0xe')]=_0x3dae43;_0x27eb9a[_0xc2c6('0xa')]=_0x48d40e;_0x27eb9a['id']=_0x840d27;if(_0x41ca9a){attributes[_0xc2c6('0xf')](_['capitalize'](_0x5db459)+'InteractionId');_0x747ca6[util[_0xc2c6('0x10')](_0xc2c6('0x11'),_0x5db459)][_0x840d27]=_[_0xc2c6('0x12')](_0x27eb9a,attributes);}else{delete _0x747ca6[util[_0xc2c6('0x10')](_0xc2c6('0x11'),_0x5db459)][_0x840d27];}emit(util['format'](_0xc2c6('0x13'),_0x5db459,_0x3dae43),util[_0xc2c6('0x10')](_0xc2c6('0x14'),_0x5db459,_0x41ca9a?_0xc2c6('0x15'):_0xc2c6('0x16')),_['pick'](_0x27eb9a,attributes));}var rpc={'openchannelQueueReport':require(_0xc2c6('0x17')),'mailQueueReport':require(_0xc2c6('0x18')),'chatQueueReport':require(_0xc2c6('0x19')),'smsQueueReport':require(_0xc2c6('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc2c6('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xc2c6('0x1c'),'message':_0xc2c6('0x1d')}});function startRouting(_0xff2967,_0x1fe005,_0x481eb8,_0x58aa45){if(_0xff2967&&_0x1fe005&&_0x481eb8){_0x1fe005['waiting']+=0x1;var _0x3c0943={'uniqueid':_0xff2967,'from':_0x481eb8[_0xc2c6('0x1e')]?_0x481eb8[_0xc2c6('0x1e')][_0xc2c6('0xb')]:'','joinAt':moment()[_0xc2c6('0x10')](_0xc2c6('0x1f')),'ContactId':_0x481eb8['contact']?_0x481eb8['contact']['id']:null,'ListId':_0x481eb8['list']?_0x481eb8[_0xc2c6('0x20')]['id']:null};_0x3c0943[_[_0xc2c6('0x21')](_0x481eb8['channel'])+_0xc2c6('0x22')]=_0x1fe005['id']||null;_0x3c0943[_[_0xc2c6('0x21')](_0x481eb8['channel'])+_0xc2c6('0x23')]=_0x481eb8[_0xc2c6('0x24')]?_0x481eb8[_0xc2c6('0x24')]['id']:null;_0x3c0943[_[_0xc2c6('0x21')](_0x481eb8[_0xc2c6('0x25')])+_0xc2c6('0x26')]=_0x481eb8[_0xc2c6('0x27')]?_0x481eb8[_0xc2c6('0x27')]['id']:null;_0x3c0943[_[_0xc2c6('0x21')](_0x481eb8[_0xc2c6('0x25')])+(_0x481eb8[_0xc2c6('0x25')]!==_0xc2c6('0x28')?'AccountId':_0xc2c6('0x29'))]=_0x481eb8[_0xc2c6('0xa')]?_0x481eb8['account']['id']:null;logger[_0xc2c6('0x2a')](util[_0xc2c6('0x10')]('[%s][START:QUEUE][NAME:%s]',_0xff2967,_0x1fe005[_0xc2c6('0x2b')]));emitChannelQueueInteraction(_0x481eb8[_0xc2c6('0x25')],_0x1fe005[_0xc2c6('0x2b')],_0x3c0943,_0x481eb8['account'][_0xc2c6('0x2b')],_0x481eb8[_0xc2c6('0x27')]['id'],!![],_0x58aa45,_0x1fe005['id']);if(rpc[_0x481eb8[_0xc2c6('0x25')]+_0xc2c6('0x2c')]){return rpc[_0x481eb8[_0xc2c6('0x25')]+'QueueReport']['create'](_0x3c0943)['catch'](function(_0x125576){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x111e1f,_0x52a081,_0x14fca8,_0x57e307){if(_0x111e1f&&_0x52a081){_0x52a081[_0xc2c6('0x2d')]-=0x1;var _0xc2518e={'leaveAt':moment()[_0xc2c6('0x10')](_0xc2c6('0x1f')),'acceptAt':moment()[_0xc2c6('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xc2c6('0x2e')};logger[_0xc2c6('0x2a')](util['format'](_0xc2c6('0x2f'),_0x111e1f,_0x52a081[_0xc2c6('0x2b')]));emitChannelQueueInteraction(_0x14fca8['channel'],_0x52a081[_0xc2c6('0x2b')],_0x14fca8[_0xc2c6('0x1e')],_0x14fca8[_0xc2c6('0xa')][_0xc2c6('0x2b')],_0x14fca8[_0xc2c6('0x27')]['id'],![],_0x57e307,_0x52a081['id']);if(rpc[_0x14fca8[_0xc2c6('0x25')]+'QueueReport']){return rpc[_0x14fca8[_0xc2c6('0x25')]+_0xc2c6('0x2c')]['update'](_0x111e1f,_0xc2518e)['catch'](function(_0x453b9a){logger[_0xc2c6('0x30')](_0xc2c6('0x31'));});}}}function endRouting(_0x482359,_0x37a79f,_0x185b5f,_0xdebf3a){if(_0x482359&&_0x37a79f){_0x37a79f[_0xc2c6('0x2d')]-=0x1;var _0x202ea9={'leaveAt':moment()[_0xc2c6('0x10')](_0xc2c6('0x1f')),'exitAt':moment()[_0xc2c6('0x10')](_0xc2c6('0x1f')),'reason':_0xc2c6('0x32')};logger['info'](util[_0xc2c6('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x482359,_0x37a79f['name']));emitChannelQueueInteraction(_0x185b5f[_0xc2c6('0x25')],_0x37a79f['name'],_0x185b5f[_0xc2c6('0x1e')],_0x185b5f[_0xc2c6('0xa')]['name'],_0x185b5f[_0xc2c6('0x27')]['id'],![],_0xdebf3a);if(rpc[_0x185b5f[_0xc2c6('0x25')]+_0xc2c6('0x2c')]){return rpc[_0x185b5f[_0xc2c6('0x25')]+_0xc2c6('0x2c')]['update'](_0x482359,_0x202ea9)[_0xc2c6('0x33')](function(_0x27eeaf){logger[_0xc2c6('0x30')](_0xc2c6('0x31'));});}}}function handleFindQueue(_0x2c4673){return function(_0xceb7f9){return _0xceb7f9['name'][_0xc2c6('0x34')]()===_0x2c4673[_0xc2c6('0x34')]();};}exports[_0xc2c6('0x35')]=function(_0x5538ed,_0x24a691,_0x27c693,_0x32d09e){return function(_0x45678c){try{var _0x47999d={'name':_0x24a691[0x0],'timeout':_0x24a691[0x1]};var _0x5ac1ef=queue[_0xc2c6('0x36')](_0x47999d,{'typecast':!![]});if(_0x5ac1ef[_0xc2c6('0x37')]){logger[_0xc2c6('0x30')](_0xc2c6('0x38'),_0x5538ed,_['map'](_0x5ac1ef,_0xc2c6('0x27'))[_0xc2c6('0x39')](',\x20'));_0x45678c[_0xc2c6('0x3a')]();}else{var _0x29219e=_['find'](_0x27c693[_0x32d09e[_0xc2c6('0x25')]+_0xc2c6('0x3b')],handleFindQueue(_0x47999d['name']));if(_0x29219e){startRouting(_0x5538ed,_0x29219e,_0x32d09e,_0x27c693);var _0x119abb=(_0x29219e[_0xc2c6('0x32')]||0xa)*0x3e8;var _0x4a249c=(_0x47999d[_0xc2c6('0x32')]||0x14)*0x3e8;var _0x22304e;if(_0x119abb>_0x4a249c){_0x4a249c=_0x119abb;}var _0x55736c=seqqueue[_0xc2c6('0x3c')](_0x119abb);_0x55736c['id']=_0x5538ed;_0x55736c[_0xc2c6('0x3d')]=_0x119abb;_0x55736c[_0xc2c6('0x3e')]=_0x4a249c;_0x55736c['channel']=_0x32d09e[_0xc2c6('0x25')];_0x27c693['rules'][_0x5538ed]['on'](_0xc2c6('0x3f'),function(){logger[_0xc2c6('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5538ed);stopRouting(_0x5538ed,_0x29219e,_0x32d09e,_0x27c693);clearTimeout(_0x22304e);_0x22304e=undefined;_0x55736c[_0xc2c6('0x40')](!![]);if(_0x27c693['rules'][_0x5538ed]){delete _0x27c693[_0xc2c6('0x41')][_0x5538ed];}_0x45678c[_0xc2c6('0x3a')]();});_0x27c693[_0xc2c6('0x41')][_0x5538ed]['on'](_0xc2c6('0x42'),function(){if(_0x27c693[_0xc2c6('0x41')][_0x5538ed]){delete _0x27c693[_0xc2c6('0x41')][_0x5538ed];}});_0x22304e=setTimeout(function(){logger[_0xc2c6('0x2a')](_0xc2c6('0x43'),_0x5538ed);endRouting(_0x5538ed,_0x29219e,_0x32d09e,_0x27c693);clearTimeout(_0x22304e);_0x55736c[_0xc2c6('0x40')](!![]);_0x45678c[_0xc2c6('0x44')]();},_0x4a249c);switch(_0x29219e[_0xc2c6('0x45')]){case _0xc2c6('0x46'):strategy[_0xc2c6('0x46')](_0x55736c,_0x29219e,_0x27c693,_0x32d09e);break;default:strategy[_0xc2c6('0x47')](_0x55736c,_0x29219e,_0x27c693,_0x32d09e);}}else{logger[_0xc2c6('0x30')](_0xc2c6('0x48'),_0x5538ed,_0x47999d[_0xc2c6('0x2b')]);_0x45678c[_0xc2c6('0x3a')]();}}}catch(_0x19b4a4){console[_0xc2c6('0x49')](_0x19b4a4);logger[_0xc2c6('0x30')](_0xc2c6('0x38'),_0x5538ed,_0x19b4a4[_0xc2c6('0x4a')]);_0x45678c[_0xc2c6('0x3a')]();}};}; \ No newline at end of file +var _0x841c=['createQueue','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','stop','log','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','moment','ioredis','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','interaction','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','accepted','[%s][STOP:QUEUE][NAME:%s]','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','consequence','validate','length','map','join','find','Queues'];(function(_0x5982f9,_0x113f36){var _0x2c3c12=function(_0xb34f39){while(--_0xb34f39){_0x5982f9['push'](_0x5982f9['shift']());}};_0x2c3c12(++_0x113f36);}(_0x841c,0x17f));var _0xc841=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x841c[_0x2e4e19];return _0x9ba20b;};'use strict';var schema=require('validate');var _=require(_0xc841('0x0'));var util=require('util');var seqqueue=require(_0xc841('0x1'));var moment=require(_0xc841('0x2'));var Redis=require(_0xc841('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('routing');var strategy=require(_0xc841('0x4'));config[_0xc841('0x5')]=_[_0xc841('0x6')](config[_0xc841('0x5')],{'host':_0xc841('0x7'),'port':0x18eb});var io=require(_0xc841('0x8'))(new Redis(config['redis']));var attributes=['id',_0xc841('0x9'),_0xc841('0xa'),_0xc841('0xb'),_0xc841('0xc'),_0xc841('0xd')];function emit(_0x350f80,_0x13818e,_0xd8170e){io['to'](_0x350f80)['emit'](_0x13818e,_0xd8170e);}function emitChannelQueueInteraction(_0x10c4e1,_0x5bd684,_0x354140,_0x5d5ae7,_0x425c10,_0x41499b,_0x30e70b,_0x428fb5){var _0x7e9168=_[_0xc841('0xe')](_0x354140);_0x7e9168[_0xc841('0x9')]=_0x428fb5;_0x7e9168[_0xc841('0xb')]=_0x5bd684;_0x7e9168[_0xc841('0xa')]=_0x5d5ae7;_0x7e9168['id']=_0x425c10;if(_0x41499b){attributes[_0xc841('0xf')](_[_0xc841('0x10')](_0x10c4e1)+_0xc841('0x11'));_0x30e70b[util[_0xc841('0x12')](_0xc841('0x13'),_0x10c4e1)][_0x425c10]=_[_0xc841('0x14')](_0x7e9168,attributes);}else{delete _0x30e70b[util['format'](_0xc841('0x13'),_0x10c4e1)][_0x425c10];}emit(util['format']('%s:queue:%s',_0x10c4e1,_0x5bd684),util[_0xc841('0x12')](_0xc841('0x15'),_0x10c4e1,_0x41499b?_0xc841('0x16'):'remove'),_['pick'](_0x7e9168,attributes));}var rpc={'openchannelQueueReport':require(_0xc841('0x17')),'mailQueueReport':require(_0xc841('0x18')),'chatQueueReport':require(_0xc841('0x19')),'smsQueueReport':require(_0xc841('0x1a')),'faxQueueReport':require(_0xc841('0x1b')),'whatsappQueueReport':require(_0xc841('0x1c'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xc841('0x1d')},'timeout':{'type':_0xc841('0x1e'),'message':_0xc841('0x1f')}});function startRouting(_0x918f4d,_0x15815f,_0x63eb3d,_0x1b5692){if(_0x918f4d&&_0x15815f&&_0x63eb3d){_0x15815f[_0xc841('0x20')]+=0x1;var _0x311bb2={'uniqueid':_0x918f4d,'from':_0x63eb3d[_0xc841('0x21')]?_0x63eb3d[_0xc841('0x21')][_0xc841('0xc')]:'','joinAt':moment()[_0xc841('0x12')](_0xc841('0x22')),'ContactId':_0x63eb3d['contact']?_0x63eb3d['contact']['id']:null,'ListId':_0x63eb3d['list']?_0x63eb3d[_0xc841('0x23')]['id']:null};_0x311bb2[_[_0xc841('0x24')](_0x63eb3d[_0xc841('0x25')])+'QueueId']=_0x15815f['id']||null;_0x311bb2[_[_0xc841('0x24')](_0x63eb3d[_0xc841('0x25')])+_0xc841('0x11')]=_0x63eb3d[_0xc841('0x26')]?_0x63eb3d[_0xc841('0x26')]['id']:null;_0x311bb2[_['upperFirst'](_0x63eb3d[_0xc841('0x25')])+'MessageId']=_0x63eb3d['message']?_0x63eb3d[_0xc841('0x27')]['id']:null;_0x311bb2[_['upperFirst'](_0x63eb3d[_0xc841('0x25')])+(_0x63eb3d['channel']!=='chat'?_0xc841('0x28'):_0xc841('0x29'))]=_0x63eb3d[_0xc841('0xa')]?_0x63eb3d['account']['id']:null;logger[_0xc841('0x2a')](util[_0xc841('0x12')](_0xc841('0x2b'),_0x918f4d,_0x15815f['name']));emitChannelQueueInteraction(_0x63eb3d[_0xc841('0x25')],_0x15815f[_0xc841('0x2c')],_0x311bb2,_0x63eb3d[_0xc841('0xa')][_0xc841('0x2c')],_0x63eb3d[_0xc841('0x27')]['id'],!![],_0x1b5692,_0x15815f['id']);if(rpc[_0x63eb3d[_0xc841('0x25')]+_0xc841('0x2d')]){return rpc[_0x63eb3d[_0xc841('0x25')]+_0xc841('0x2d')][_0xc841('0x2e')](_0x311bb2)['catch'](function(_0x5412f0){logger[_0xc841('0x2f')]('create\x20queue\x20report');});}}}function stopRouting(_0x371640,_0x233e4f,_0x1e9aad,_0x419d70){if(_0x371640&&_0x233e4f){_0x233e4f[_0xc841('0x20')]-=0x1;var _0x21b2bc={'leaveAt':moment()[_0xc841('0x12')](_0xc841('0x22')),'acceptAt':moment()[_0xc841('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xc841('0x30')};logger[_0xc841('0x2a')](util[_0xc841('0x12')](_0xc841('0x31'),_0x371640,_0x233e4f['name']));emitChannelQueueInteraction(_0x1e9aad[_0xc841('0x25')],_0x233e4f[_0xc841('0x2c')],_0x1e9aad[_0xc841('0x21')],_0x1e9aad[_0xc841('0xa')]['name'],_0x1e9aad[_0xc841('0x27')]['id'],![],_0x419d70,_0x233e4f['id']);if(rpc[_0x1e9aad[_0xc841('0x25')]+_0xc841('0x2d')]){return rpc[_0x1e9aad['channel']+'QueueReport']['update'](_0x371640,_0x21b2bc)[_0xc841('0x32')](function(_0x3f03c9){logger['error'](_0xc841('0x33'));});}}}function endRouting(_0xad4b29,_0x25b82c,_0x18fbaa,_0x1a845f){if(_0xad4b29&&_0x25b82c){_0x25b82c['waiting']-=0x1;var _0x363b88={'leaveAt':moment()['format'](_0xc841('0x22')),'exitAt':moment()[_0xc841('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xc841('0x34')};logger[_0xc841('0x2a')](util[_0xc841('0x12')](_0xc841('0x35'),_0xad4b29,_0x25b82c[_0xc841('0x2c')]));emitChannelQueueInteraction(_0x18fbaa[_0xc841('0x25')],_0x25b82c[_0xc841('0x2c')],_0x18fbaa[_0xc841('0x21')],_0x18fbaa[_0xc841('0xa')][_0xc841('0x2c')],_0x18fbaa[_0xc841('0x27')]['id'],![],_0x1a845f);if(rpc[_0x18fbaa[_0xc841('0x25')]+'QueueReport']){return rpc[_0x18fbaa['channel']+'QueueReport']['update'](_0xad4b29,_0x363b88)['catch'](function(_0x4b0d60){logger[_0xc841('0x2f')](_0xc841('0x33'));});}}}function handleFindQueue(_0x51377c){return function(_0x2f2690){return _0x2f2690[_0xc841('0x2c')]['toLowerCase']()===_0x51377c['toLowerCase']();};}exports[_0xc841('0x36')]=function(_0x342d73,_0x3701a0,_0x6a0928,_0x1ef3e0){return function(_0x334f6d){try{var _0x3c5d5c={'name':_0x3701a0[0x0],'timeout':_0x3701a0[0x1]};var _0x3640eb=queue[_0xc841('0x37')](_0x3c5d5c,{'typecast':!![]});if(_0x3640eb[_0xc841('0x38')]){logger['error']('[%s][QUEUE]\x20%s',_0x342d73,_[_0xc841('0x39')](_0x3640eb,_0xc841('0x27'))[_0xc841('0x3a')](',\x20'));_0x334f6d['stop']();}else{var _0x51b4ae=_[_0xc841('0x3b')](_0x6a0928[_0x1ef3e0['channel']+_0xc841('0x3c')],handleFindQueue(_0x3c5d5c[_0xc841('0x2c')]));if(_0x51b4ae){startRouting(_0x342d73,_0x51b4ae,_0x1ef3e0,_0x6a0928);var _0x3298fe=(_0x51b4ae['timeout']||0xa)*0x3e8;var _0x259fd4=(_0x3c5d5c['timeout']||0x14)*0x3e8;var _0xfea8ca;if(_0x3298fe>_0x259fd4){_0x259fd4=_0x3298fe;}var _0x4b49ac=seqqueue[_0xc841('0x3d')](_0x3298fe);_0x4b49ac['id']=_0x342d73;_0x4b49ac[_0xc841('0x3e')]=_0x3298fe;_0x4b49ac['qtimeout']=_0x259fd4;_0x4b49ac['channel']=_0x1ef3e0[_0xc841('0x25')];_0x6a0928[_0xc841('0x3f')][_0x342d73]['on']('end',function(){logger[_0xc841('0x2a')](_0xc841('0x40'),_0x342d73);stopRouting(_0x342d73,_0x51b4ae,_0x1ef3e0,_0x6a0928);clearTimeout(_0xfea8ca);_0xfea8ca=undefined;_0x4b49ac[_0xc841('0x41')](!![]);if(_0x6a0928[_0xc841('0x3f')][_0x342d73]){delete _0x6a0928[_0xc841('0x3f')][_0x342d73];}_0x334f6d['stop']();});_0x6a0928[_0xc841('0x3f')][_0x342d73]['on'](_0xc841('0x42'),function(){if(_0x6a0928[_0xc841('0x3f')][_0x342d73]){delete _0x6a0928[_0xc841('0x3f')][_0x342d73];}});_0xfea8ca=setTimeout(function(){logger[_0xc841('0x2a')](_0xc841('0x43'),_0x342d73);endRouting(_0x342d73,_0x51b4ae,_0x1ef3e0,_0x6a0928);clearTimeout(_0xfea8ca);_0x4b49ac[_0xc841('0x41')](!![]);_0x334f6d[_0xc841('0x44')]();},_0x259fd4);switch(_0x51b4ae['strategy']){case _0xc841('0x45'):strategy[_0xc841('0x45')](_0x4b49ac,_0x51b4ae,_0x6a0928,_0x1ef3e0);break;default:strategy['beepall'](_0x4b49ac,_0x51b4ae,_0x6a0928,_0x1ef3e0);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x342d73,_0x3c5d5c[_0xc841('0x2c')]);_0x334f6d[_0xc841('0x46')]();}}}catch(_0x2d7c35){console[_0xc841('0x47')](_0x2d7c35);logger['error'](_0xc841('0x48'),_0x342d73,_0x2d7c35[_0xc841('0x49')]);_0x334f6d[_0xc841('0x46')]();}};}; \ 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 b94bd94..ce481f9 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['notificationId','squeue','agent','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3378a5,_0x317f7f){_0x3378a5=_0x3378a5-0x0;var _0x43235f=_0x7fbe[_0x3378a5];return _0x43235f;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xe7fb('0x0'));var logger=require(_0xe7fb('0x1'))(_0xe7fb('0x2'));var Agent=function(_0x1703d5,_0x517d3a,_0x47625b,_0x11d2c4){this[_0xe7fb('0x3')]=uuid['v4']();this[_0xe7fb('0x4')]=_0x1703d5;this[_0xe7fb('0x5')]=_0x517d3a;this[_0xe7fb('0x6')]=_0x47625b;this[_0xe7fb('0x2')]=_0x11d2c4;this[_0xe7fb('0x4')][_0xe7fb('0x7')](this['handleRun'][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on']('timeout',this['handleTimeout'][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on'](_0xe7fb('0xa'),this[_0xe7fb('0xb')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0x7')]=function(){this[_0xe7fb('0x4')][_0xe7fb('0x7')](this[_0xe7fb('0xd')][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));};Agent[_0xe7fb('0xc')][_0xe7fb('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xe7fb('0xc')][_0xe7fb('0xd')]=function(){logger['debug'](_0xe7fb('0xe'),this[_0xe7fb('0x4')]['id'],this['agent']['id']);if(_[_0xe7fb('0xf')](this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){logger[_0xe7fb('0x11')](_0xe7fb('0x12'),this['squeue']['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}else{if(this['routing'][_0xe7fb('0x13')]||util[_0xe7fb('0x14')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],this['squeue'][_0xe7fb('0x15')],![])){this['realtime'][_0xe7fb('0x10')][this['agent']['id']][_0xe7fb('0x16')]=!![];this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x18')](this['realtime'],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this['squeue']['channel']);util['showNotification'](this[_0xe7fb('0x3')],this['squeue']['id'],this['realtime'][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);util['writeLog'](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']],_0xe7fb('0x19')+(this[_0xe7fb('0x2')][_0xe7fb('0x13')]?':FORCED':''));}else{logger['debug'](_0xe7fb('0x1a'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);setTimeout(this['push'][_0xe7fb('0x8')](this),0x3e8);}}};Agent[_0xe7fb('0xc')][_0xe7fb('0x9')]=function(_0x5f265f){if(_[_0xe7fb('0xf')](this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']])){return logger['debug'](_0xe7fb('0x12'),this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe7fb('0x4')]['id'],this['agent']['id']);util[_0xe7fb('0x1b')](this[_0xe7fb('0x3')],this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],null,this[_0xe7fb('0x2')]);this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']]['busy']=![];this[_0xe7fb('0x6')][_0xe7fb('0x10')][this[_0xe7fb('0x5')]['id']][_0xe7fb('0x17')]=undefined;util[_0xe7fb('0x1c')](this[_0xe7fb('0x6')],this[_0xe7fb('0x2')],this[_0xe7fb('0x5')],this[_0xe7fb('0x4')]['channel']);util[_0xe7fb('0x1d')](this[_0xe7fb('0x4')]['id'],this[_0xe7fb('0x6')]['agents'][this[_0xe7fb('0x5')]['id']],_0x5f265f?_0xe7fb('0x1e'):_0xe7fb('0x1f'));}if(!_0x5f265f){setTimeout(this[_0xe7fb('0x7')][_0xe7fb('0x8')](this),0x3e8);}};function agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35){return new Agent(_0x35b828,_0xfeefb1,_0xc4e271,_0x195c35);}module[_0xe7fb('0x20')]=agent; \ No newline at end of file +var _0xca9e=['handleDrained','prototype','handleTimeout','[%s][AGENT]\x20try\x20with\x20%s','isNil','debug','forcedOwnership','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','removeWaitingNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','drained'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xca9e,0x136));var _0xeca9=function(_0x50ceea,_0xb36150){_0x50ceea=_0x50ceea-0x0;var _0x1c0789=_0xca9e[_0x50ceea];return _0x1c0789;};'use strict';var _=require(_0xeca9('0x0'));var uuid=require(_0xeca9('0x1'));var util=require(_0xeca9('0x2'));var logger=require(_0xeca9('0x3'))(_0xeca9('0x4'));var Agent=function(_0x1443e3,_0x8dbabb,_0x2c6185,_0x1b2864){this[_0xeca9('0x5')]=uuid['v4']();this[_0xeca9('0x6')]=_0x1443e3;this[_0xeca9('0x7')]=_0x8dbabb;this[_0xeca9('0x8')]=_0x2c6185;this[_0xeca9('0x4')]=_0x1b2864;this['squeue'][_0xeca9('0x9')](this[_0xeca9('0xa')]['bind'](this),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xc'),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xd'),this[_0xeca9('0xe')][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['push']=function(){this[_0xeca9('0x6')][_0xeca9('0x9')](this['handleRun'][_0xeca9('0xb')](this),this['handleTimeout'][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['handleDrained']=function(){this[_0xeca9('0x10')](!![]);};Agent[_0xeca9('0xf')][_0xeca9('0xa')]=function(){logger['debug'](_0xeca9('0x11'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);if(_[_0xeca9('0x12')](this['realtime']['agents'][this[_0xeca9('0x7')]['id']])){logger[_0xeca9('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xeca9('0x14')]||util[_0xeca9('0x15')](this[_0xeca9('0x6')]['id'],this['realtime'][_0xeca9('0x16')][this['agent']['id']],this['squeue'][_0xeca9('0x17')],![])){this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']]['busy']=!![];this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x18')]=undefined;util['saveWaitingNotification'](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this[_0xeca9('0x7')],this['squeue'][_0xeca9('0x17')]);util[_0xeca9('0x19')](this['notificationId'],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],null,this['routing']);util[_0xeca9('0x1a')](this['squeue']['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0xeca9('0x1b')+(this[_0xeca9('0x4')][_0xeca9('0x14')]?_0xeca9('0x1c'):''));}else{logger[_0xeca9('0x13')](_0xeca9('0x1d'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}}};Agent[_0xeca9('0xf')][_0xeca9('0x10')]=function(_0x4910a3){if(_['isNil'](this['realtime'][_0xeca9('0x16')][this['agent']['id']])){return logger[_0xeca9('0x13')](_0xeca9('0x1e'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);}else{logger[_0xeca9('0x13')](_0xeca9('0x1f'),this['squeue']['id'],this[_0xeca9('0x7')]['id']);util['hideNotification'](this[_0xeca9('0x5')],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')]['agents'][this[_0xeca9('0x7')]['id']],null,this[_0xeca9('0x4')]);this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x20')]=![];this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']][_0xeca9('0x18')]=undefined;util[_0xeca9('0x21')](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this['agent'],this[_0xeca9('0x6')][_0xeca9('0x17')]);util[_0xeca9('0x1a')](this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0x4910a3?'STOP':_0xeca9('0x22'));}if(!_0x4910a3){setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}};function agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463){return new Agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463);}module[_0xeca9('0x23')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 7e5f8f9..9be27fe 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 _0x0f26=['[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','busyQueue','removeWaitingNotification','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','drained','prototype','handleDrained','isNil','Agents','length','agents','debug','realtime','channel','writeLog','RINGING','busy','name','saveWaitingNotification','showNotification'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0f26,0x8a));var _0x60f2=function(_0x4fccec,_0x14f0e3){_0x4fccec=_0x4fccec-0x0;var _0x565681=_0x0f26[_0x4fccec];return _0x565681;};'use strict';var _=require(_0x60f2('0x0'));var uuid=require(_0x60f2('0x1'));var util=require('./util');var logger=require(_0x60f2('0x2'))(_0x60f2('0x3'));var Beepall=function(_0x4ad373,_0x32d2c6,_0x3f0e70,_0xb22e5f){this[_0x60f2('0x4')]=uuid['v4']();this[_0x60f2('0x5')]=_0x4ad373;this[_0x60f2('0x6')]=_0x32d2c6;this['realtime']=_0x3f0e70;this['routing']=_0xb22e5f;this['squeue'][_0x60f2('0x7')](this[_0x60f2('0x8')][_0x60f2('0x9')](this),this[_0x60f2('0xa')][_0x60f2('0x9')](this));this[_0x60f2('0x5')]['on']('timeout',this[_0x60f2('0xa')]['bind'](this));this[_0x60f2('0x5')]['on'](_0x60f2('0xb'),this['handleDrained'][_0x60f2('0x9')](this));};Beepall[_0x60f2('0xc')][_0x60f2('0x7')]=function(){this[_0x60f2('0x5')][_0x60f2('0x7')](this[_0x60f2('0x8')][_0x60f2('0x9')](this),this[_0x60f2('0xa')][_0x60f2('0x9')](this));};Beepall['prototype'][_0x60f2('0xd')]=function(){this[_0x60f2('0xa')](!![]);};Beepall[_0x60f2('0xc')][_0x60f2('0x8')]=function(){var _0x47b9fe=!![];if(!_[_0x60f2('0xe')](this[_0x60f2('0x6')])&&!_[_0x60f2('0xe')](this[_0x60f2('0x6')][_0x60f2('0xf')])&&this['queue'][_0x60f2('0xf')][_0x60f2('0x10')]>0x0){for(var _0x5de190=0x0,_0x32b0cf;_0x5de1900x0){for(var _0x3dceba=0x0,_0x39663e;_0x3dceba0x0&&_0x1389e0[_0xa46f96+_0x49d6('0x25')]>=_0x1389e0[_0xa46f96+'Capacity']){writeLog(_0x5f4bf1,_0x1389e0,_0xa46f96[_0x49d6('0x27')]()+_0x49d6('0x28'));return![];}}return!![];};exports[_0x49d6('0x29')]=function(_0x178b2e,_0x40bd6c,_0x293bd6,_0x15168f,_0x56b13f){return sendNotification(!![],_0x178b2e,_0x40bd6c,_0x293bd6,_0x15168f,_0x56b13f);};exports[_0x49d6('0x2a')]=function(_0x1f17e8,_0x24d4d6,_0x57fa76,_0x9d2b71,_0x157135){return sendNotification(![],_0x1f17e8,_0x24d4d6,_0x57fa76,_0x9d2b71,_0x157135);};exports[_0x49d6('0x2b')]=function(_0x3a7721,_0x3a1713,_0x2ceda0){var _0x196058=_0x3a1713['interaction']['UserId'];if(!_0x196058&&_0x2ceda0){_0x196058=_0x2ceda0['id'];}var _0x517212=_['some'](_0x3a7721[_0x3a1713[_0x49d6('0x2c')]+_0x49d6('0x2d')],function(_0x5f0ff1){var _0x224f29=_[_0x49d6('0x2e')](_0x3a1713[_0x49d6('0x2c')])+_0x49d6('0x2f');return _0x5f0ff1[_0x224f29]===_0x3a1713[_0x49d6('0x30')]['id'];});if(!_0x517212&&_0x196058){_0x517212=_[_0x49d6('0x31')](_0x3a7721[_0x49d6('0x32')][_0x196058][_0x3a1713['channel']+_0x49d6('0x33')],function(_0x547f8d){return _0x547f8d['id']===_0x3a1713[_0x49d6('0x30')]['id'];});}return _0x517212;};exports[_0x49d6('0x34')]=function(_0x5a38ef,_0x4025da,_0x56783e,_0x21ab69){_0x5a38ef[_0x49d6('0x32')][_0x56783e['id']][_0x21ab69+_0x49d6('0x33')][_0x4025da[_0x49d6('0x19')]['id']]={'id':_0x4025da['interaction']['id']};};exports['removeWaitingNotification']=function(_0x438284,_0x3ddbe5,_0x508734,_0x1774a5){delete _0x438284[_0x49d6('0x32')][_0x508734['id']][_0x1774a5+_0x49d6('0x33')][_0x3ddbe5[_0x49d6('0x19')]['id']];};exports[_0x49d6('0x35')]=writeLog; \ No newline at end of file +var _0x5df9=['../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','emit','user:save','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','notification:%s','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','interaction','UserId','some','QueuesWaitingInteractions','capitalize','channel','agents','WaitingInteractions','saveWaitingNotification','message','removeWaitingNotification','writeLog','util'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x5df9,0xc3));var _0x95df=function(_0x173da1,_0x4e91c6){_0x173da1=_0x173da1-0x0;var _0x13d9f5=_0x5df9[_0x173da1];return _0x13d9f5;};'use strict';var _=require('lodash');var util=require(_0x95df('0x0'));var utils=require(_0x95df('0x1'));var Redis=require(_0x95df('0x2'));var config=require('../../../../../config/environment');var logger=require(_0x95df('0x3'))(_0x95df('0x4'));config[_0x95df('0x5')]=_[_0x95df('0x6')](config[_0x95df('0x5')],{'host':_0x95df('0x7'),'port':0x18eb});var io=require(_0x95df('0x8'))(new Redis(config[_0x95df('0x5')]));function sendNotification(_0x54f62d,_0x3ccfe0,_0x1facfd,_0x319330,_0x33c670,_0x4d954d){io['to'](util['format'](_0x95df('0x9'),_0x319330[_0x95df('0xa')]))[_0x95df('0xb')](_0x95df('0xc'),_0x319330);var _0x1aa6f8=_0x4d954d||{};var _0x5e0158=_0x1facfd['split']('.');var _0xbcfc64={'uniqueid':_0x3ccfe0,'channel':_0x5e0158[0x0],'id':_0x5e0158[0x1],'title':_0x5e0158[0x0]+'\x20interaction','interactionId':_0x5e0158[0x2],'queue':_0x33c670?_0x33c670[_0x95df('0xa')]:null,'sound':_0x1aa6f8['account']['notificationSound'],'shake':_0x1aa6f8['account'][_0x95df('0xd')]};try{if(!_0x1aa6f8[_0x95df('0xe')]){_0x1aa6f8[_0x95df('0xe')]={};}if(_0x33c670){_0x1aa6f8[_0x95df('0xe')][_0x95df('0xf')]=_0x33c670;}else if(_0x1aa6f8[_0x95df('0xe')]['queue']){delete _0x1aa6f8[_0x95df('0xe')]['queue'];}_0xbcfc64[_0x95df('0x10')]=utils[_0x95df('0x11')](_0x1aa6f8['account'][_0x95df('0x12')],_0x1aa6f8);}catch(_0x1ff6e4){_0xbcfc64[_0x95df('0x10')]=_0x95df('0x13');logger[_0x95df('0x14')](util[_0x95df('0x15')](_0x95df('0x16'),_0x3ccfe0,_0x1ff6e4['message']));}io['to'](util[_0x95df('0x15')]('user:%s',_0x319330[_0x95df('0xa')]))['emit'](util[_0x95df('0x15')](_0x95df('0x17'),_0x54f62d?'save':_0x95df('0x18')),_0xbcfc64);}function writeLog(_0x263023,_0x2191b4,_0x4396df){return logger['debug'](util[_0x95df('0x15')](_0x95df('0x19'),_0x263023,_0x2191b4[_0x95df('0xa')],_0x4396df));}exports[_0x95df('0x1a')]=function(_0x24ae1a,_0x4b0020,_0x43043a,_0x56588b){if(_0x4b0020['busy']){writeLog(_0x24ae1a,_0x4b0020,_0x95df('0x1b'));return![];}if(!_0x4b0020[_0x95df('0x1c')]){writeLog(_0x24ae1a,_0x4b0020,_0x95df('0x1d'));return![];}if(_0x4b0020[_0x43043a+_0x95df('0x1e')]){writeLog(_0x24ae1a,_0x4b0020,_0x95df('0x1f'));return![];}if(_0x56588b&&_0x4b0020['hasOwnProperty'](_0x43043a+'Capacity')&&_0x4b0020[_0x95df('0x20')](_0x43043a+_0x95df('0x21'))){if(_0x4b0020[_0x43043a+_0x95df('0x22')]>0x0&&_0x4b0020[_0x43043a+'CurrentCapacity']>=_0x4b0020[_0x43043a+_0x95df('0x22')]){writeLog(_0x24ae1a,_0x4b0020,_0x43043a[_0x95df('0x23')]()+_0x95df('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x448788,_0x2361e9,_0x15f1f0,_0x3fa468,_0x8a5a67){return sendNotification(!![],_0x448788,_0x2361e9,_0x15f1f0,_0x3fa468,_0x8a5a67);};exports['hideNotification']=function(_0x55c30f,_0x14c6ee,_0x5b8df6,_0x29ba38,_0x27f710){return sendNotification(![],_0x55c30f,_0x14c6ee,_0x5b8df6,_0x29ba38,_0x27f710);};exports['checkWaitingNotifications']=function(_0x23963d,_0x5b46a2,_0x1c66cc){var _0xbb7610=_0x5b46a2[_0x95df('0x25')][_0x95df('0x26')];if(!_0xbb7610&&_0x1c66cc){_0xbb7610=_0x1c66cc['id'];}var _0x1e5735=_[_0x95df('0x27')](_0x23963d[_0x5b46a2['channel']+_0x95df('0x28')],function(_0x5c1cd5){var _0x4188d0=_[_0x95df('0x29')](_0x5b46a2[_0x95df('0x2a')])+'InteractionId';return _0x5c1cd5[_0x4188d0]===_0x5b46a2[_0x95df('0x25')]['id'];});if(!_0x1e5735&&_0xbb7610){_0x1e5735=_['some'](_0x23963d[_0x95df('0x2b')][_0xbb7610][_0x5b46a2[_0x95df('0x2a')]+_0x95df('0x2c')],function(_0x1063bf){return _0x1063bf['id']===_0x5b46a2[_0x95df('0x25')]['id'];});}return _0x1e5735;};exports[_0x95df('0x2d')]=function(_0x341b11,_0x3d5499,_0x1fc0f1,_0x1b710c){_0x341b11[_0x95df('0x2b')][_0x1fc0f1['id']][_0x1b710c+_0x95df('0x2c')][_0x3d5499[_0x95df('0x2e')]['id']]={'id':_0x3d5499[_0x95df('0x25')]['id']};};exports[_0x95df('0x2f')]=function(_0x5b8490,_0x566244,_0x286c47,_0x786dd3){delete _0x5b8490[_0x95df('0x2b')][_0x286c47['id']][_0x786dd3+_0x95df('0x2c')][_0x566244['message']['id']];};exports[_0x95df('0x30')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 3931c9b..714caf2 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 _0xa34c=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','lodash','./utils'];(function(_0x1ff085,_0xa5d361){var _0x229856=function(_0x5aea49){while(--_0x5aea49){_0x1ff085['push'](_0x1ff085['shift']());}};_0x229856(++_0xa5d361);}(_0xa34c,0x111));var _0xca34=function(_0x473f10,_0x1c91ea){_0x473f10=_0x473f10-0x0;var _0x4d9e6e=_0xa34c[_0x473f10];return _0x4d9e6e;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xca34('0x0'));var utils=require(_0xca34('0x1'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0xca34('0x2'),'required':!![],'message':_0xca34('0x3')}});exports[_0xca34('0x4')]=function(_0x4aada0,_0x5e0eb5){return function(_0x439bc4){try{var _0x3b4605={'command':_0x5e0eb5[0x0]};var _0x3e44e2=system[_0xca34('0x5')](_0x3b4605,{'typecast':!![]});if(_0x3e44e2[_0xca34('0x6')]){logger[_0xca34('0x7')](_0xca34('0x8'),_0x4aada0,_[_0xca34('0x9')](_0x3e44e2,'message')['join'](',\x20'));logger[_0xca34('0xa')](_0xca34('0xb'),_0x4aada0);_0x439bc4[_0xca34('0xc')]();}else{var _0x2c0d15=this;var _0x1867d3=utils[_0xca34('0xd')](_0x5e0eb5[0x0],this);logger['info'](_0xca34('0xe'),_0x4aada0,_0x1867d3);sh[_0xca34('0xf')](_[_0xca34('0x10')](_0x1867d3),function(_0x428c2f,_0x53ad0e){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x4aada0,_0x428c2f);if(_0x428c2f==0x0){var _0x2ba63e=_0x53ad0e[_0xca34('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xca34('0x12')](_0x5e0eb5[0x1])||_[_0xca34('0x13')](_0x5e0eb5[0x1])){logger[_0xca34('0xa')](_0xca34('0x14'),_0x4aada0);_0x2c0d15[_0xca34('0x15')][_0x5e0eb5[0x1]]=_0x2ba63e;}else{logger[_0xca34('0xa')](_0xca34('0x16'),_0x4aada0,_0x5e0eb5[0x1],_0x2ba63e);_0x2c0d15[_0xca34('0x15')][_0x5e0eb5[0x1]]=_0x2ba63e;}}_0x439bc4[_0xca34('0xc')]();});}}catch(_0x3d1fbe){logger[_0xca34('0x7')](_0xca34('0x8'),_0x4aada0,_[_0xca34('0x17')](_0x3d1fbe)?JSON[_0xca34('0x18')](_0x3d1fbe):_0x3d1fbe);logger[_0xca34('0xa')](_0xca34('0xb'),_0x4aada0);_0x439bc4['next']();}};}; \ No newline at end of file +var _0x7d28=['join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','message'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7d28,0x112));var _0x87d2=function(_0x229643,_0x71e2a3){_0x229643=_0x229643-0x0;var _0x15ce21=_0x7d28[_0x229643];return _0x15ce21;};'use strict';var schema=require(_0x87d2('0x0'));var sh=require(_0x87d2('0x1'));var _=require(_0x87d2('0x2'));var utils=require(_0x87d2('0x3'));var logger=require(_0x87d2('0x4'))(_0x87d2('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x87d2('0x6')}});exports['consequence']=function(_0x4ba6cd,_0x2d45da){return function(_0x4fd052){try{var _0x15bfa4={'command':_0x2d45da[0x0]};var _0x16bb80=system[_0x87d2('0x0')](_0x15bfa4,{'typecast':!![]});if(_0x16bb80[_0x87d2('0x7')]){logger[_0x87d2('0x8')](_0x87d2('0x9'),_0x4ba6cd,_[_0x87d2('0xa')](_0x16bb80,_0x87d2('0xb'))[_0x87d2('0xc')](',\x20'));logger['info'](_0x87d2('0xd'),_0x4ba6cd);_0x4fd052[_0x87d2('0xe')]();}else{var _0x18b53b=this;var _0x27be52=utils[_0x87d2('0xf')](_0x2d45da[0x0],this);logger[_0x87d2('0x10')](_0x87d2('0x11'),_0x4ba6cd,_0x27be52);sh[_0x87d2('0x12')](_['trim'](_0x27be52),function(_0x7df971,_0x157c4a){logger[_0x87d2('0x10')](_0x87d2('0x13'),_0x4ba6cd,_0x7df971);if(_0x7df971==0x0){var _0x2a9387=_0x157c4a[_0x87d2('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x87d2('0x15')](_0x2d45da[0x1])||_[_0x87d2('0x16')](_0x2d45da[0x1])){logger['info'](_0x87d2('0x17'),_0x4ba6cd);_0x18b53b[_0x87d2('0x18')][_0x2d45da[0x1]]=_0x2a9387;}else{logger[_0x87d2('0x10')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4ba6cd,_0x2d45da[0x1],_0x2a9387);_0x18b53b[_0x87d2('0x18')][_0x2d45da[0x1]]=_0x2a9387;}}_0x4fd052['next']();});}}catch(_0x3ee74a){logger['error'](_0x87d2('0x9'),_0x4ba6cd,_[_0x87d2('0x19')](_0x3ee74a)?JSON['stringify'](_0x3ee74a):_0x3ee74a);logger[_0x87d2('0x10')](_0x87d2('0xd'),_0x4ba6cd);_0x4fd052['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 45c3ae6..842fee4 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 _0xd1fa=['error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length'];(function(_0x35e643,_0x333824){var _0x167f63=function(_0x268230){while(--_0x268230){_0x35e643['push'](_0x35e643['shift']());}};_0x167f63(++_0x333824);}(_0xd1fa,0x96));var _0xad1f=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xd1fa[_0x160c73];return _0xd9302;};'use strict';var schema=require(_0xad1f('0x0'));var _=require(_0xad1f('0x1'));var rpc={'chatInteraction':require(_0xad1f('0x2')),'openchannelInteraction':require(_0xad1f('0x3')),'smsInteraction':require(_0xad1f('0x4')),'mailInteraction':require(_0xad1f('0x5')),'faxInteraction':require(_0xad1f('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xad1f('0x7'))(_0xad1f('0x8'));var tag=schema({'tag':{'type':_0xad1f('0x9'),'required':!![],'message':_0xad1f('0xa')}});exports['consequence']=function(_0x952040,_0x4e89ee,_0x53d2b3,_0x421231){return function(_0x1b683f){try{var _0x5ea71d={'tag':_0x4e89ee[0x0]};var _0x48025a=tag['validate'](_0x5ea71d,{'typecast':!![]});if(_0x48025a[_0xad1f('0xb')]){logger[_0xad1f('0xc')](_0xad1f('0xd'),_0x952040,_[_0xad1f('0xe')](_0x48025a,_0xad1f('0xf'))['join'](',\x20'));logger[_0xad1f('0x10')](_0xad1f('0x11'),_0x952040);_0x1b683f[_0xad1f('0x12')]();}else{var _0x38c1f0={'ids':[_0x4e89ee[0x0]]};if(rpc[_0x421231[_0xad1f('0x13')]+_0xad1f('0x14')]){rpc[_0x421231[_0xad1f('0x13')]+'Interaction'][_0xad1f('0x15')](_0x421231[_0xad1f('0x16')]['id'],_0x38c1f0)['then'](function(_0x3addc6){logger[_0xad1f('0x10')](_0xad1f('0x17'),_0x952040,_0x4e89ee[0x1],_0x421231['channel'],_0x421231[_0xad1f('0x16')]['id']);})['catch'](function(_0x1359f8){logger[_0xad1f('0xc')](_0xad1f('0xd'),_0x952040,JSON[_0xad1f('0x18')](_0x1359f8));logger[_0xad1f('0x10')](_0xad1f('0x11'),_0x952040);})[_0xad1f('0x19')](function(){_0x1b683f[_0xad1f('0x12')]();});}}}catch(_0x53b10c){logger[_0xad1f('0xc')](_0xad1f('0xd'),_0x952040,_[_0xad1f('0x1a')](_0x53b10c)?JSON[_0xad1f('0x18')](_0x53b10c):_0x53b10c);logger[_0xad1f('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x952040);_0x1b683f[_0xad1f('0x12')]();}};}; \ No newline at end of file +var _0x7534=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number'];(function(_0x5c104b,_0xd2aa4){var _0x27a62e=function(_0x13b4e2){while(--_0x13b4e2){_0x5c104b['push'](_0x5c104b['shift']());}};_0x27a62e(++_0xd2aa4);}(_0x7534,0x1a7));var _0x4753=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7534[_0x19e35c];return _0x3e1fe8;};'use strict';var schema=require(_0x4753('0x0'));var _=require(_0x4753('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x4753('0x2')),'smsInteraction':require(_0x4753('0x3')),'mailInteraction':require(_0x4753('0x4')),'faxInteraction':require(_0x4753('0x5')),'whatsappInteraction':require(_0x4753('0x6'))};var logger=require('../../../../config/logger')(_0x4753('0x7'));var tag=schema({'tag':{'type':_0x4753('0x8'),'required':!![],'message':_0x4753('0x9')}});exports['consequence']=function(_0x448772,_0x1a94dd,_0x3d49ea,_0x5128f9){return function(_0x29f717){try{var _0x1f4aad={'tag':_0x1a94dd[0x0]};var _0x2f3602=tag[_0x4753('0x0')](_0x1f4aad,{'typecast':!![]});if(_0x2f3602[_0x4753('0xa')]){logger['error'](_0x4753('0xb'),_0x448772,_[_0x4753('0xc')](_0x2f3602,_0x4753('0xd'))[_0x4753('0xe')](',\x20'));logger[_0x4753('0xf')](_0x4753('0x10'),_0x448772);_0x29f717[_0x4753('0x11')]();}else{var _0x5b6019={'ids':[_0x1a94dd[0x0]]};if(rpc[_0x5128f9[_0x4753('0x12')]+_0x4753('0x13')]){rpc[_0x5128f9[_0x4753('0x12')]+_0x4753('0x13')][_0x4753('0x14')](_0x5128f9['interaction']['id'],_0x5b6019)[_0x4753('0x15')](function(_0x159baf){logger['info'](_0x4753('0x16'),_0x448772,_0x1a94dd[0x1],_0x5128f9[_0x4753('0x12')],_0x5128f9[_0x4753('0x17')]['id']);})[_0x4753('0x18')](function(_0x5c559e){logger['error'](_0x4753('0xb'),_0x448772,JSON[_0x4753('0x19')](_0x5c559e));logger[_0x4753('0xf')](_0x4753('0x10'),_0x448772);})['finally'](function(){_0x29f717['next']();});}}}catch(_0x2c31ad){logger['error'](_0x4753('0xb'),_0x448772,_[_0x4753('0x1a')](_0x2c31ad)?JSON['stringify'](_0x2c31ad):_0x2c31ad);logger[_0x4753('0xf')](_0x4753('0x10'),_0x448772);_0x29f717[_0x4753('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 2d4f242..c48c396 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 _0x82ea=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','stringify','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','replace','includes','push','urlOnAnswer','urlOnRing','jsonrpc','2.0','method','login','utf8','application/json-rpc','parse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82ea,0xf6));var _0xa82e=function(_0xb9a9cb,_0x35753b){_0xb9a9cb=_0xb9a9cb-0x0;var _0x9b1e6c=_0x82ea[_0xb9a9cb];return _0x9b1e6c;};'use strict';var rp=require(_0xa82e('0x0'));var logger=require(_0xa82e('0x1'))(_0xa82e('0x2'));var _=require('lodash');var arr=[];exports['consequence']=function(_0x4432cf,_0xbe3e80){return function(_0x57cafd){var _0x51e328=_0xbe3e80[0xa];var _0x482b99=_0xbe3e80[0xb];var _0x19b5f0=_0xbe3e80[0xc];var _0x267277=_0xbe3e80[0xd];var _0x4598d1=_0xbe3e80[0xe];var _0x367c22=_0xbe3e80[0xf][_0xa82e('0x3')](/\n/g,'\x20-\x20');var _0x5b4c11=_0xbe3e80[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xa82e('0x4')](_0x482b99)){arr[_0xa82e('0x5')](_0x482b99);var _0x2729b1=_0xbe3e80[0x3];var _0x276b5a=_0xbe3e80[0x4];var _0x17ac08=_0xbe3e80[0x1];var _0x254852=_0xbe3e80[0x0];var _0x4ec43a={};_0x4ec43a[_0xa82e('0x6')]=_0xbe3e80[0x8]+'?params='+_0x19b5f0+'|'+_0x51e328+'|'+_0x267277+'|'+_0x482b99+'|'+_0x4598d1;_0x4ec43a[_0xa82e('0x7')]=_0xbe3e80[0x7]+'?params='+_0x19b5f0+'|'+_0x51e328+'|'+_0x267277+'|'+_0x482b99+'|'+_0x4598d1+'|'+_0x367c22+'|'+_0x5b4c11;_0x4ec43a['title']=_0xbe3e80[0x9];var _0x1f2c0e={};_0x1f2c0e[_0xa82e('0x8')]=_0xa82e('0x9');_0x1f2c0e[_0xa82e('0xa')]=_0xa82e('0xb');var _0x4985be=[];_0x4985be[_0xa82e('0x5')](_0xbe3e80[0x2]);_0x4985be[_0xa82e('0x5')](_0xbe3e80[0x5]);_0x4985be[_0xa82e('0x5')](_0xbe3e80[0x6]);_0x1f2c0e['params']=_0x4985be;_0x1f2c0e['id']=0x1;var _0x2dd21f=JSON['stringify'](_0x1f2c0e);var _0x26e6ea={'encoding':_0xa82e('0xc'),'method':'POST','timeout':0x2710,'url':_0x2729b1,'headers':{'Content-Type':_0xa82e('0xd')},'body':_0x2dd21f};return rp(_0x26e6ea)['then'](function(_0xe1f183){const _0x46929f=JSON[_0xa82e('0xe')](_0xe1f183);if(!_0x46929f['result'][_0xa82e('0xf')]){throw new Error(_0xa82e('0x10'));}var _0x4421e8=_0x482b99;var _0x1c4daf='channelId='+_0x17ac08+_0xa82e('0x11')+_0x254852+_0xa82e('0x12')+_0x4421e8+_0xa82e('0x13')+JSON[_0xa82e('0x14')](_0x4ec43a);var _0x541d66=_0x276b5a+'?'+_0x1c4daf;return rp(_0x541d66);})[_0xa82e('0x15')](function(_0x54cd72){logger[_0xa82e('0x16')](_0xa82e('0x17'),_0x4432cf,_0x54cd72);_0x57cafd[_0xa82e('0x18')]();})[_0xa82e('0x19')](function(_0x9a84ad){logger['error'](_0xa82e('0x1a'),_0x4432cf,_[_0xa82e('0x1b')](_0x9a84ad)?JSON['stringify'](_0x9a84ad):_0x9a84ad);_0x57cafd[_0xa82e('0x18')]();});}else{logger[_0xa82e('0x16')](_0xa82e('0x1c'),_0x4432cf);_0x57cafd['next']();}};}; \ No newline at end of file +var _0x14ad=['channelId=','&serviceId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0x3766db,_0x412796){var _0x1c767d=function(_0x3c71d8){while(--_0x3c71d8){_0x3766db['push'](_0x3766db['shift']());}};_0x1c767d(++_0x412796);}(_0x14ad,0x18d));var _0xd14a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x14ad[_0x50a0c2];return _0x5ebadd;};'use strict';var rp=require('request-promise');var logger=require(_0xd14a('0x0'))('routing');var _=require('lodash');var arr=[];exports[_0xd14a('0x1')]=function(_0x31d71a,_0x290f9a){return function(_0x1f89eb){var _0x4de16d=_0x290f9a[0xa];var _0x4d7481=_0x290f9a[0xb];var _0x5b1d33=_0x290f9a[0xc];var _0x1ecfb9=_0x290f9a[0xd];var _0x4a1cd3=_0x290f9a[0xe];var _0x2fac34=_0x290f9a[0xf][_0xd14a('0x2')](/\n/g,_0xd14a('0x3'));var _0x120168=_0x290f9a[0x10][_0xd14a('0x2')](/\n/g,'\x20');if(!arr[_0xd14a('0x4')](_0x4d7481)){arr[_0xd14a('0x5')](_0x4d7481);var _0x3cbf99=_0x290f9a[0x3];var _0x3568b2=_0x290f9a[0x4];var _0x3d528a=_0x290f9a[0x1];var _0x15b31d=_0x290f9a[0x0];var _0x179caf={};_0x179caf[_0xd14a('0x6')]=_0x290f9a[0x8]+_0xd14a('0x7')+_0x5b1d33+'|'+_0x4de16d+'|'+_0x1ecfb9+'|'+_0x4d7481+'|'+_0x4a1cd3;_0x179caf[_0xd14a('0x8')]=_0x290f9a[0x7]+_0xd14a('0x7')+_0x5b1d33+'|'+_0x4de16d+'|'+_0x1ecfb9+'|'+_0x4d7481+'|'+_0x4a1cd3+'|'+_0x2fac34+'|'+_0x120168;_0x179caf[_0xd14a('0x9')]=_0x290f9a[0x9];var _0x5ab103={};_0x5ab103[_0xd14a('0xa')]=_0xd14a('0xb');_0x5ab103[_0xd14a('0xc')]=_0xd14a('0xd');var _0xc67353=[];_0xc67353[_0xd14a('0x5')](_0x290f9a[0x2]);_0xc67353[_0xd14a('0x5')](_0x290f9a[0x5]);_0xc67353['push'](_0x290f9a[0x6]);_0x5ab103[_0xd14a('0xe')]=_0xc67353;_0x5ab103['id']=0x1;var _0x163657=JSON['stringify'](_0x5ab103);var _0x408dd7={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3cbf99,'headers':{'Content-Type':'application/json-rpc'},'body':_0x163657};return rp(_0x408dd7)[_0xd14a('0xf')](function(_0x5ab7c0){const _0x30eecf=JSON['parse'](_0x5ab7c0);if(!_0x30eecf[_0xd14a('0x10')][_0xd14a('0x11')]){throw new Error(_0xd14a('0x12'));}var _0x4ab120=_0x4d7481;var _0x1b4e10=_0xd14a('0x13')+_0x3d528a+_0xd14a('0x14')+_0x15b31d+'&sessionId='+_0x4ab120+_0xd14a('0x15')+JSON[_0xd14a('0x16')](_0x179caf);var _0x866cea=_0x3568b2+'?'+_0x1b4e10;return rp(_0x866cea);})[_0xd14a('0xf')](function(_0x2954ef){logger[_0xd14a('0x17')](_0xd14a('0x18'),_0x31d71a,_0x2954ef);_0x1f89eb['stop']();})[_0xd14a('0x19')](function(_0x370cde){logger[_0xd14a('0x1a')](_0xd14a('0x1b'),_0x31d71a,_[_0xd14a('0x1c')](_0x370cde)?JSON[_0xd14a('0x16')](_0x370cde):_0x370cde);_0x1f89eb[_0xd14a('0x1d')]();});}else{logger[_0xd14a('0x17')](_0xd14a('0x1e'),_0x31d71a);_0x1f89eb[_0xd14a('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 6302e77..c7ded7a 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x2b1932,_0x5da007){var _0x2da643=function(_0x23ef90){while(--_0x23ef90){_0x2b1932['push'](_0x2b1932['shift']());}};_0x2da643(++_0x5da007);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x32b0a6,_0x53465b){var _0x1a2f9c=function(_0x31df9c){while(--_0x31df9c){_0x32b0a6['push'](_0x32b0a6['shift']());}};_0x1a2f9c(++_0x53465b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ccc5f51..686a127 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 _0x61a5=['app','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','matchPath','emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','existsSync','join','.js','toLowerCase','appdata','split','push','slice','length','dialogflow','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','notificationTemplate','ContactId','body','%s:%s:%s'];(function(_0x29240d,_0x2d7d89){var _0x55f59d=function(_0x29c697){while(--_0x29c697){_0x29240d['push'](_0x29240d['shift']());}};_0x55f59d(++_0x2d7d89);}(_0x61a5,0x102));var _0x561a=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0x61a5[_0x2d3d0d];return _0xca35b6;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require('./applications/utils');var sUtils=require(_0x561a('0x0'));var logger=require(_0x561a('0x1'))('routing');var rpc={'openchannelQueueReport':require(_0x561a('0x2')),'mailQueueReport':require(_0x561a('0x3')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x561a('0x4')),'faxQueueReport':require(_0x561a('0x5')),'whatsappQueueReport':require(_0x561a('0x6'))};var RuleEngine=require(_0x561a('0x7'));function getId(_0xae45d9,_0x14eec7,_0xa7a778){return util[_0x561a('0x8')](_0x561a('0x9'),_0xae45d9,_0x14eec7||0x0,_0xa7a778||0x0);}function getIntervals(_0x3dd4da,_0x4bf4b0){var _0x3e124b=[];if(!_[_0x561a('0xa')](_0x4bf4b0[_0x561a('0xb')])&&!_[_0x561a('0xa')](_0x3dd4da[_0x4bf4b0[_0x561a('0xb')]])&&!_[_0x561a('0xa')](_0x3dd4da[_0x4bf4b0[_0x561a('0xb')]][_0x561a('0xc')])){_0x3e124b=_[_0x561a('0xd')](_0x3dd4da[_0x4bf4b0['IntervalId']][_0x561a('0xc')],'interval');}else if(!_['isNil'](_0x4bf4b0['interval'])){_0x3e124b=[_0x4bf4b0[_0x561a('0xe')]];}return _0x3e124b;}exports[_0x561a('0xf')]=function(_0x8ba3fa){_0x8ba3fa[_0x561a('0x10')]={};return new BPromise(function(_0x164253,_0x1731ac){var _0x3545c2={'Start':function(_0x42fff2){var _0x11e2b7=this;return new Promise(function(_0x46d1bf,_0x851214){if(_0x42fff2){try{var _0x949f30=[];var _0x47ad4e=getId(_0x42fff2[_0x561a('0x11')],_0x42fff2['message']?_0x42fff2[_0x561a('0x12')]['id']:0x0,_0x42fff2['interaction']?_0x42fff2[_0x561a('0x13')]['id']:0x0);var _0xf75199=sUtils[_0x561a('0x14')](_0x8ba3fa,_0x42fff2);if(!_0xf75199&&_0x42fff2[_0x561a('0x15')]&&_[_0x561a('0x16')](_0x42fff2[_0x561a('0x15')])&&_0x42fff2[_0x561a('0x15')]['length']){for(var _0x2df785=0x0;_0x2df785<_0x42fff2[_0x561a('0x15')]['length'];_0x2df785+=0x1){var _0x5360f7=_0x42fff2['applications'][_0x2df785];if(fs[_0x561a('0x17')](path[_0x561a('0x18')](__dirname,_0x561a('0x15'),_0x5360f7['app']+_0x561a('0x19')))){var _0x4d2458=[];switch(_0x5360f7['app'][_0x561a('0x1a')]()){case'autoreply':var _0x443f07=_0x5360f7[_0x561a('0x1b')][_0x561a('0x1c')](',');if(_0x42fff2[_0x561a('0x11')]==='mail'){_0x4d2458['push'](_0x443f07[0x0]);_0x4d2458[_0x561a('0x1d')](_0x443f07[0x1]);_0x4d2458[_0x561a('0x1d')](_0x443f07[_0x561a('0x1e')](0x2,_0x443f07[_0x561a('0x1f')])[_0x561a('0x18')](','));}else{_0x4d2458['push'](_0x443f07[0x0]);_0x4d2458[_0x561a('0x1d')](_0x443f07[_0x561a('0x1e')](0x1,_0x443f07[_0x561a('0x1f')])[_0x561a('0x18')](','));}break;case _0x561a('0x20'):var _0x7ef8f2=_0x5360f7[_0x561a('0x1b')][_0x561a('0x1c')](',');_0x4d2458['push'](_0x7ef8f2[0x0]);_0x4d2458['push'](_0x7ef8f2[0x1]);_0x4d2458[_0x561a('0x1d')](_0x7ef8f2[_0x561a('0x1e')](0x2,_0x7ef8f2[_0x561a('0x1f')])[_0x561a('0x18')](','));break;case _0x561a('0x21'):var _0x8b67d=_0x5360f7[_0x561a('0x1b')][_0x561a('0x1c')](',');_0x4d2458[_0x561a('0x1d')](_0x8b67d[0x0]);_0x4d2458[_0x561a('0x1d')](_0x8b67d[0x1]);_0x4d2458['push'](_0x8b67d[0x2]);_0x4d2458[_0x561a('0x1d')](_0x8b67d[0x3]);_0x4d2458[_0x561a('0x1d')](_0x8b67d[_0x561a('0x1e')](0x4,_0x8b67d['length'])['join'](','));break;case _0x561a('0x22'):var _0x4c398f=_0x5360f7['appdata'][_0x561a('0x1c')](',');_0x4d2458[_0x561a('0x1d')](_0x4c398f[0x0]);_0x4d2458['push'](_0x4c398f[0x1]);_0x4d2458[_0x561a('0x1d')](_0x4c398f[0x2]);_0x4d2458['push'](_0x4c398f[0x3]);_0x4d2458[_0x561a('0x1d')](_0x4c398f[_0x561a('0x1e')](0x4,_0x4c398f[_0x561a('0x1f')])[_0x561a('0x18')](','));break;case _0x561a('0x12'):_0x4d2458[_0x561a('0x1d')](_0x5360f7['appdata']);break;case _0x561a('0x23'):_0x4d2458[_0x561a('0x1d')](_0x5360f7['TagId']);_0x4d2458[_0x561a('0x1d')](_0x5360f7[_0x561a('0x1b')]);break;case _0x561a('0x24'):var _0x2a0e12=utils[_0x561a('0x25')](_0x42fff2['account'][_0x561a('0x26')],_0x42fff2);var _0x518b52=_0x5360f7[_0x561a('0x1b')]['split'](',');_0x4d2458[_0x561a('0x1d')](_0x518b52[0x0]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x1]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x2]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x3]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x4]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x5]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x6]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x7]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x8]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0x9]);_0x4d2458[_0x561a('0x1d')](_0x518b52[0xa]);_0x4d2458['push'](_0x42fff2[_0x561a('0x13')]['id']);_0x4d2458[_0x561a('0x1d')](_0x42fff2[_0x561a('0x12')]['id']);_0x4d2458[_0x561a('0x1d')](_0x5360f7['ChatWebsiteId']);_0x4d2458[_0x561a('0x1d')](_0x42fff2[_0x561a('0x13')][_0x561a('0x27')]);_0x4d2458['push'](_0x42fff2[_0x561a('0x28')][_0x561a('0x28')]);_0x4d2458['push'](_0x2a0e12);break;default:_0x4d2458=_[_0x561a('0xa')](_0x5360f7[_0x561a('0x1b')])?[]:_0x5360f7[_0x561a('0x1b')]['split'](',');}var _0x228b73={'id':util[_0x561a('0x8')](_0x561a('0x29'),_0x47ad4e,_0x5360f7['id'],_0x5360f7[_0x561a('0x2a')]),'condition':require(_0x561a('0x2b'))[_0x561a('0x2c')](_0x47ad4e,getIntervals(_0x8ba3fa[_0x561a('0x2d')],_0x5360f7),_0x8ba3fa),'consequence':require(_0x561a('0x2e')+_0x5360f7['app'])[_0x561a('0x2f')](_0x47ad4e,_0x4d2458,_0x8ba3fa,_0x42fff2),'p':_0x5360f7[_0x561a('0x30')]||0x0};logger['info'](_0x561a('0x31'),_0x228b73['id'],_0x561a('0x32'),getIntervals(_0x8ba3fa[_0x561a('0x2d')],_0x5360f7)[_0x561a('0x18')](_0x561a('0x33')));_0x949f30[_0x561a('0x1d')](_0x228b73);}else{logger[_0x561a('0x34')](_0x561a('0x35'),path[_0x561a('0x18')](__dirname,'applications',_0x5360f7[_0x561a('0x2a')]+_0x561a('0x19')));}}_0x8ba3fa['rules'][_0x47ad4e]=new RuleEngine(_0x949f30);_0x8ba3fa[_0x561a('0x10')][_0x47ad4e]['execute'](_0x42fff2,function(_0x2280d3){logger[_0x561a('0x36')](_0x561a('0x37'),JSON[_0x561a('0x38')](_0x2280d3[_0x561a('0x39')]));if(_0x8ba3fa[_0x561a('0x10')][_0x47ad4e]){_0x8ba3fa[_0x561a('0x10')][_0x47ad4e][_0x561a('0x3a')](_0x561a('0x3b'));}});return _0x46d1bf({'code':0xc8,'message':_0x42fff2});}else{if(_0xf75199){logger[_0x561a('0x36')](util[_0x561a('0x8')]('Skipped\x20routing\x20for\x20%s',_0x47ad4e));}else{logger[_0x561a('0x36')]('No\x20applications\x20to\x20execute');}return _0x46d1bf({'code':0xc8,'message':_0x42fff2});}}catch(_0x49d07c){logger[_0x561a('0x34')](_0x49d07c[_0x561a('0x3c')]);return _0x851214(_0x11e2b7[_0x561a('0x34')](0x1f4,_0x49d07c));}}return _0x851214(_0x561a('0x3d'));});},'AcceptMessage':function(_0x396e7b){var _0x1ac2e1=this;return new Promise(function(_0x45d0ec,_0x38a44b){if(_0x396e7b[_0x561a('0x3e')]&&_0x396e7b[_0x561a('0x3e')]['id']){if(_0x8ba3fa[_0x561a('0x3f')][_0x396e7b[_0x561a('0x3e')]['id']]){_0x8ba3fa[_0x561a('0x3f')][_0x396e7b['agent']['id']][_0x561a('0x40')]=![];_0x8ba3fa[_0x561a('0x3f')][_0x396e7b[_0x561a('0x3e')]['id']][_0x561a('0x41')]=undefined;}}if(_0x396e7b[_0x561a('0x12')]&&_0x396e7b[_0x561a('0x12')]['id']){try{var _0x471e37=getId(_0x396e7b['channel'],_0x396e7b[_0x561a('0x12')]?_0x396e7b[_0x561a('0x12')]['id']:0x0,_0x396e7b[_0x561a('0x13')]?_0x396e7b[_0x561a('0x13')]['id']:0x0);if(_0x8ba3fa[_0x561a('0x10')][_0x471e37]){_0x8ba3fa[_0x561a('0x10')][_0x471e37][_0x561a('0x3a')](_0x561a('0x42'));if(rpc[_0x396e7b['channel']+_0x561a('0x43')]){rpc[_0x396e7b[_0x561a('0x11')]+'QueueReport'][_0x561a('0x44')](_0x471e37,{'UserId':_0x396e7b[_0x561a('0x12')]['UserId']})[_0x561a('0x45')](function(){logger[_0x561a('0x34')](_0x561a('0x46'));});}}return _0x45d0ec({'code':0xc8,'message':_0x396e7b});}catch(_0x35a546){logger[_0x561a('0x34')](_0x35a546['stack']);return _0x38a44b(_0x1ac2e1[_0x561a('0x34')](0x1f4,_0x35a546));}}logger[_0x561a('0x34')](_0x561a('0x47'));return _0x38a44b(_0x1ac2e1[_0x561a('0x34')](0x1f4,_0x561a('0x47')));});},'RejectMessage':function(_0x217b15){var _0xd9131c=this;return new Promise(function(_0x106ce0,_0x1b5360){if(_0x217b15['agent']&&_0x217b15['agent']['id']){try{if(_0x8ba3fa[_0x561a('0x3f')][_0x217b15[_0x561a('0x3e')]['id']]){_0x8ba3fa['agents'][_0x217b15[_0x561a('0x3e')]['id']][_0x561a('0x40')]=![];_0x8ba3fa[_0x561a('0x3f')][_0x217b15[_0x561a('0x3e')]['id']][_0x561a('0x41')]=undefined;}return _0x106ce0({'code':0xc8,'message':_0x217b15});}catch(_0x40ad2c){logger[_0x561a('0x34')](_0x40ad2c[_0x561a('0x3c')]);return _0x1b5360(_0xd9131c[_0x561a('0x34')](0x1f4,_0x40ad2c));}}logger['error']('message\x20is\x20empty');return _0x1b5360(_0xd9131c[_0x561a('0x34')](0x1f4,_0x561a('0x47')));});},'AbandonInteraction':function(_0x274f1c){var _0x6b40de=this;return new Promise(function(_0x5f31c2,_0x20fea6){if(_0x274f1c['channel']&&_0x274f1c[_0x561a('0x13')]&&_0x274f1c['interaction']['id']){try{var _0x13a04c=getId(_0x274f1c['channel'],_0x274f1c[_0x561a('0x12')]?_0x274f1c['message']['id']:0x0,_0x274f1c['interaction']?_0x274f1c[_0x561a('0x13')]['id']:0x0);if(_0x8ba3fa[_0x561a('0x10')][_0x13a04c]){_0x8ba3fa[_0x561a('0x10')][_0x13a04c]['emit'](_0x561a('0x42'));}return _0x5f31c2({'code':0xc8,'message':_0x274f1c});}catch(_0x1ce5cb){logger[_0x561a('0x34')](_0x1ce5cb[_0x561a('0x3c')]);return _0x20fea6(_0x6b40de['error'](0x1f4,_0x1ce5cb));}}logger[_0x561a('0x34')](_0x561a('0x47'));return _0x20fea6(_0x6b40de[_0x561a('0x34')](0x1f4,_0x561a('0x47')));});},'AgentCapacity':function(_0x4d5836){var _0xe38710=this;return new Promise(function(_0x1e21ff,_0x39c051){if(_0x8ba3fa[_0x561a('0x3f')]['hasOwnProperty'](_0x4d5836['id'])){for(var _0x27ca0a in _0x4d5836[_0x561a('0x48')]){if(_0x4d5836['capacity'][_0x561a('0x49')](_0x27ca0a)){if(_0x8ba3fa['agents'][_0x4d5836['id']]['hasOwnProperty'](_0x27ca0a+_0x561a('0x4a'))){_0x8ba3fa['agents'][_0x4d5836['id']][_0x27ca0a+_0x561a('0x4a')]=parseInt(_0x4d5836[_0x561a('0x48')][_0x27ca0a],0xa);}}}_0x8ba3fa[_0x561a('0x3f')][_0x4d5836['id']][_0x561a('0x4b')]();return _0x1e21ff({'code':0xc8,'message':_0x8ba3fa[_0x561a('0x3f')][_0x4d5836['id']]});}else{return _0x39c051(_0xe38710[_0x561a('0x34')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x29a5a8){return new Promise(function(_0x2ffad9){var _0x34a254=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x3f')]);if(_0x29a5a8&&_0x29a5a8['id']){var _0x408e9a=_[_0x561a('0x4d')](_0x34a254,function(_0xc9bb0a){return _0xc9bb0a['id']===_0x29a5a8['id'];});_0x2ffad9(_0x408e9a);}else{_0x2ffad9({'count':_0x34a254[_0x561a('0x1f')],'rows':_0x34a254});}});},'ChatQueues':function(){return new Promise(function(_0x1b4a7e){var _0x4d339d=[];for(var _0x30da72 in _0x8ba3fa[_0x561a('0x4e')]){if(_0x8ba3fa[_0x561a('0x4e')][_0x561a('0x49')](_0x30da72)){var _0x3cdd42=_0x8ba3fa[_0x561a('0x4e')][_0x30da72];var _0x34f35c={'id':_0x3cdd42['id'],'available':_0x3cdd42[_0x561a('0x4f')],'loggedIn':_0x3cdd42['loggedIn'],'name':_0x3cdd42[_0x561a('0x50')],'paused':_0x3cdd42[_0x561a('0x51')],'waiting':_0x3cdd42[_0x561a('0x52')]};_0x4d339d['push'](_0x34f35c);}}_0x1b4a7e({'count':_0x4d339d['length'],'rows':_0x4d339d});});},'MailQueues':function(){return new Promise(function(_0x43adfc){var _0x4a9cbe=[];for(var _0x2f50e9 in _0x8ba3fa[_0x561a('0x53')]){if(_0x8ba3fa[_0x561a('0x53')][_0x561a('0x49')](_0x2f50e9)){var _0x4b495d=_0x8ba3fa['mailQueues'][_0x2f50e9];var _0x5d60b6={'id':_0x4b495d['id'],'available':_0x4b495d[_0x561a('0x4f')],'loggedIn':_0x4b495d[_0x561a('0x54')],'name':_0x4b495d['name'],'paused':_0x4b495d[_0x561a('0x51')],'waiting':_0x4b495d['waiting']};_0x4a9cbe[_0x561a('0x1d')](_0x5d60b6);}}_0x43adfc({'count':_0x4a9cbe[_0x561a('0x1f')],'rows':_0x4a9cbe});});},'OpenchannelQueues':function(){return new Promise(function(_0x57e14b){var _0x53b19b=[];for(var _0x4c0e83 in _0x8ba3fa[_0x561a('0x55')]){if(_0x8ba3fa[_0x561a('0x55')][_0x561a('0x49')](_0x4c0e83)){var _0x181394=_0x8ba3fa[_0x561a('0x55')][_0x4c0e83];var _0x174ec6={'id':_0x181394['id'],'available':_0x181394[_0x561a('0x4f')],'loggedIn':_0x181394[_0x561a('0x54')],'name':_0x181394[_0x561a('0x50')],'paused':_0x181394[_0x561a('0x51')],'waiting':_0x181394[_0x561a('0x52')]};_0x53b19b[_0x561a('0x1d')](_0x174ec6);}}_0x57e14b({'count':_0x53b19b[_0x561a('0x1f')],'rows':_0x53b19b});});},'SmsQueues':function(){return new Promise(function(_0x55a925){var _0x17db59=[];for(var _0x104f84 in _0x8ba3fa[_0x561a('0x56')]){if(_0x8ba3fa[_0x561a('0x56')][_0x561a('0x49')](_0x104f84)){var _0x25af10=_0x8ba3fa['smsQueues'][_0x104f84];var _0x384b29={'id':_0x25af10['id'],'available':_0x25af10[_0x561a('0x4f')],'loggedIn':_0x25af10[_0x561a('0x54')],'name':_0x25af10[_0x561a('0x50')],'paused':_0x25af10[_0x561a('0x51')],'waiting':_0x25af10[_0x561a('0x52')]};_0x17db59['push'](_0x384b29);}}_0x55a925({'count':_0x17db59[_0x561a('0x1f')],'rows':_0x17db59});});},'FaxQueues':function(){return new Promise(function(_0x25ec86){var _0x349b98=[];for(var _0x1bd6c9 in _0x8ba3fa[_0x561a('0x57')]){if(_0x8ba3fa[_0x561a('0x57')][_0x561a('0x49')](_0x1bd6c9)){var _0x5148e3=_0x8ba3fa[_0x561a('0x57')][_0x1bd6c9];var _0x5e89ef={'id':_0x5148e3['id'],'available':_0x5148e3[_0x561a('0x4f')],'loggedIn':_0x5148e3[_0x561a('0x54')],'name':_0x5148e3[_0x561a('0x50')],'paused':_0x5148e3[_0x561a('0x51')],'waiting':_0x5148e3[_0x561a('0x52')]};_0x349b98['push'](_0x5e89ef);}}_0x25ec86({'count':_0x349b98[_0x561a('0x1f')],'rows':_0x349b98});});},'WhatsappQueues':function(){return new Promise(function(_0x1224a3){var _0x7e62f5=[];for(var _0xeb0024 in _0x8ba3fa[_0x561a('0x58')]){if(_0x8ba3fa[_0x561a('0x58')][_0x561a('0x49')](_0xeb0024)){var _0x59183b=_0x8ba3fa[_0x561a('0x58')][_0xeb0024];var _0x2e7f7a={'id':_0x59183b['id'],'available':_0x59183b[_0x561a('0x4f')],'loggedIn':_0x59183b[_0x561a('0x54')],'name':_0x59183b['name'],'paused':_0x59183b[_0x561a('0x51')],'waiting':_0x59183b['waiting']};_0x7e62f5[_0x561a('0x1d')](_0x2e7f7a);}}_0x1224a3({'count':_0x7e62f5[_0x561a('0x1f')],'rows':_0x7e62f5});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x94080c){var _0x4e9c8e=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x59')]);_0x94080c({'count':_0x4e9c8e[_0x561a('0x1f')],'rows':_0x4e9c8e});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x41d3ae){var _0x41110e=_['values'](_0x8ba3fa[_0x561a('0x5a')]);_0x41d3ae({'count':_0x41110e[_0x561a('0x1f')],'rows':_0x41110e});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x60ccc6){var _0x4dd7fc=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x5b')]);_0x60ccc6({'count':_0x4dd7fc[_0x561a('0x1f')],'rows':_0x4dd7fc});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3535e7){var _0x249f6d=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x5c')]);_0x3535e7({'count':_0x249f6d['length'],'rows':_0x249f6d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3c9ac3){var _0x46022e=_[_0x561a('0x4c')](_0x8ba3fa[_0x561a('0x5d')]);_0x3c9ac3({'count':_0x46022e[_0x561a('0x1f')],'rows':_0x46022e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x559285){var _0x1e800d=_['values'](_0x8ba3fa[_0x561a('0x5e')]);_0x559285({'count':_0x1e800d['length'],'rows':_0x1e800d});});}};var _0x3f000e=jayson[_0x561a('0x5f')](_0x3545c2)[_0x561a('0x60')]();_0x3f000e['on'](_0x561a('0x34'),function(_0x2bdc41){logger[_0x561a('0x34')](JSON[_0x561a('0x38')](_0x2bdc41));return _0x1731ac(_0x2bdc41);});_0x3f000e[_0x561a('0xf')](0x232c,_0x561a('0x61'),function(){console[_0x561a('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x164253(_0x561a('0x63')+0x232c);});});}; \ No newline at end of file +var _0x830a=['agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','name','paused','mailQueues','available','loggedIn','openchannelQueues','smsQueues','waiting','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','.js','rules','execute','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty'];(function(_0x5ae7ae,_0x253d30){var _0x9603c0=function(_0x48e1af){while(--_0x48e1af){_0x5ae7ae['push'](_0x5ae7ae['shift']());}};_0x9603c0(++_0x253d30);}(_0x830a,0x1ac));var _0xa830=function(_0xba4fdd,_0x5620b6){_0xba4fdd=_0xba4fdd-0x0;var _0x103499=_0x830a[_0xba4fdd];return _0x103499;};'use strict';var _=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xa830('0x2'));var BPromise=require(_0xa830('0x3'));var utils=require(_0xa830('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0xa830('0x5'))(_0xa830('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xa830('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xa830('0x8')),'faxQueueReport':require(_0xa830('0x9')),'whatsappQueueReport':require(_0xa830('0xa'))};var RuleEngine=require(_0xa830('0xb'));function getId(_0x439ec1,_0x148a55,_0x46b32a){return util[_0xa830('0xc')](_0xa830('0xd'),_0x439ec1,_0x148a55||0x0,_0x46b32a||0x0);}function getIntervals(_0x3445a8,_0x39c331){var _0x1ef97c=[];if(!_[_0xa830('0xe')](_0x39c331[_0xa830('0xf')])&&!_[_0xa830('0xe')](_0x3445a8[_0x39c331[_0xa830('0xf')]])&&!_[_0xa830('0xe')](_0x3445a8[_0x39c331['IntervalId']]['Intervals'])){_0x1ef97c=_[_0xa830('0x10')](_0x3445a8[_0x39c331[_0xa830('0xf')]][_0xa830('0x11')],_0xa830('0x12'));}else if(!_[_0xa830('0xe')](_0x39c331[_0xa830('0x12')])){_0x1ef97c=[_0x39c331[_0xa830('0x12')]];}return _0x1ef97c;}exports[_0xa830('0x13')]=function(_0x2ec04f){_0x2ec04f['rules']={};return new BPromise(function(_0x4bf51e,_0xf8a29e){var _0x1c504b={'Start':function(_0xa2d962){var _0x343f1d=this;return new Promise(function(_0x5b22bc,_0x12b5e1){if(_0xa2d962){try{var _0x979247=[];var _0x375697=getId(_0xa2d962[_0xa830('0x14')],_0xa2d962[_0xa830('0x15')]?_0xa2d962['message']['id']:0x0,_0xa2d962[_0xa830('0x16')]?_0xa2d962[_0xa830('0x16')]['id']:0x0);var _0x3771f9=sUtils[_0xa830('0x17')](_0x2ec04f,_0xa2d962);if(!_0x3771f9&&_0xa2d962[_0xa830('0x18')]&&_[_0xa830('0x19')](_0xa2d962[_0xa830('0x18')])&&_0xa2d962[_0xa830('0x18')][_0xa830('0x1a')]){for(var _0x1b9767=0x0;_0x1b9767<_0xa2d962[_0xa830('0x18')][_0xa830('0x1a')];_0x1b9767+=0x1){var _0x2fef4d=_0xa2d962[_0xa830('0x18')][_0x1b9767];if(fs[_0xa830('0x1b')](path[_0xa830('0x1c')](__dirname,'applications',_0x2fef4d[_0xa830('0x1d')]+'.js'))){var _0x3fcfdb=[];switch(_0x2fef4d['app'][_0xa830('0x1e')]()){case _0xa830('0x1f'):var _0x10ddfc=_0x2fef4d[_0xa830('0x20')][_0xa830('0x21')](',');if(_0xa2d962[_0xa830('0x14')]===_0xa830('0x22')){_0x3fcfdb[_0xa830('0x23')](_0x10ddfc[0x0]);_0x3fcfdb[_0xa830('0x23')](_0x10ddfc[0x1]);_0x3fcfdb['push'](_0x10ddfc[_0xa830('0x24')](0x2,_0x10ddfc['length'])[_0xa830('0x1c')](','));}else{_0x3fcfdb[_0xa830('0x23')](_0x10ddfc[0x0]);_0x3fcfdb[_0xa830('0x23')](_0x10ddfc[_0xa830('0x24')](0x1,_0x10ddfc[_0xa830('0x1a')])[_0xa830('0x1c')](','));}break;case'dialogflow':var _0x4d9b0a=_0x2fef4d[_0xa830('0x20')][_0xa830('0x21')](',');_0x3fcfdb[_0xa830('0x23')](_0x4d9b0a[0x0]);_0x3fcfdb['push'](_0x4d9b0a[0x1]);_0x3fcfdb[_0xa830('0x23')](_0x4d9b0a[_0xa830('0x24')](0x2,_0x4d9b0a[_0xa830('0x1a')])[_0xa830('0x1c')](','));break;case _0xa830('0x25'):var _0x1fe871=_0x2fef4d['appdata'][_0xa830('0x21')](',');_0x3fcfdb[_0xa830('0x23')](_0x1fe871[0x0]);_0x3fcfdb[_0xa830('0x23')](_0x1fe871[0x1]);_0x3fcfdb['push'](_0x1fe871[0x2]);_0x3fcfdb[_0xa830('0x23')](_0x1fe871[0x3]);_0x3fcfdb['push'](_0x1fe871[_0xa830('0x24')](0x4,_0x1fe871[_0xa830('0x1a')])['join'](','));break;case _0xa830('0x26'):var _0x425995=_0x2fef4d[_0xa830('0x20')][_0xa830('0x21')](',');_0x3fcfdb[_0xa830('0x23')](_0x425995[0x0]);_0x3fcfdb[_0xa830('0x23')](_0x425995[0x1]);_0x3fcfdb[_0xa830('0x23')](_0x425995[0x2]);_0x3fcfdb[_0xa830('0x23')](_0x425995[0x3]);_0x3fcfdb[_0xa830('0x23')](_0x425995[_0xa830('0x24')](0x4,_0x425995[_0xa830('0x1a')])[_0xa830('0x1c')](','));break;case _0xa830('0x15'):_0x3fcfdb[_0xa830('0x23')](_0x2fef4d['appdata']);break;case _0xa830('0x27'):_0x3fcfdb[_0xa830('0x23')](_0x2fef4d[_0xa830('0x28')]);_0x3fcfdb[_0xa830('0x23')](_0x2fef4d[_0xa830('0x20')]);break;case'tvox':var _0x1f44b0=utils[_0xa830('0x29')](_0xa2d962[_0xa830('0x2a')][_0xa830('0x2b')],_0xa2d962);var _0x1da199=_0x2fef4d[_0xa830('0x20')]['split'](',');_0x3fcfdb['push'](_0x1da199[0x0]);_0x3fcfdb[_0xa830('0x23')](_0x1da199[0x1]);_0x3fcfdb[_0xa830('0x23')](_0x1da199[0x2]);_0x3fcfdb[_0xa830('0x23')](_0x1da199[0x3]);_0x3fcfdb[_0xa830('0x23')](_0x1da199[0x4]);_0x3fcfdb[_0xa830('0x23')](_0x1da199[0x5]);_0x3fcfdb[_0xa830('0x23')](_0x1da199[0x6]);_0x3fcfdb['push'](_0x1da199[0x7]);_0x3fcfdb['push'](_0x1da199[0x8]);_0x3fcfdb[_0xa830('0x23')](_0x1da199[0x9]);_0x3fcfdb['push'](_0x1da199[0xa]);_0x3fcfdb['push'](_0xa2d962[_0xa830('0x16')]['id']);_0x3fcfdb[_0xa830('0x23')](_0xa2d962[_0xa830('0x15')]['id']);_0x3fcfdb[_0xa830('0x23')](_0x2fef4d[_0xa830('0x2c')]);_0x3fcfdb[_0xa830('0x23')](_0xa2d962[_0xa830('0x16')][_0xa830('0x2d')]);_0x3fcfdb[_0xa830('0x23')](_0xa2d962[_0xa830('0x2e')]['body']);_0x3fcfdb[_0xa830('0x23')](_0x1f44b0);break;default:_0x3fcfdb=_[_0xa830('0xe')](_0x2fef4d[_0xa830('0x20')])?[]:_0x2fef4d[_0xa830('0x20')][_0xa830('0x21')](',');}var _0x52b523={'id':util[_0xa830('0xc')](_0xa830('0x2f'),_0x375697,_0x2fef4d['id'],_0x2fef4d[_0xa830('0x1d')]),'condition':require(_0xa830('0x30'))[_0xa830('0x31')](_0x375697,getIntervals(_0x2ec04f['intervals'],_0x2fef4d),_0x2ec04f),'consequence':require(_0xa830('0x32')+_0x2fef4d[_0xa830('0x1d')])[_0xa830('0x33')](_0x375697,_0x3fcfdb,_0x2ec04f,_0xa2d962),'p':_0x2fef4d['priority']||0x0};logger[_0xa830('0x34')](_0xa830('0x35'),_0x52b523['id'],_0xa830('0x36'),getIntervals(_0x2ec04f['intervals'],_0x2fef4d)[_0xa830('0x1c')](_0xa830('0x37')));_0x979247[_0xa830('0x23')](_0x52b523);}else{logger[_0xa830('0x38')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xa830('0x1c')](__dirname,_0xa830('0x18'),_0x2fef4d[_0xa830('0x1d')]+_0xa830('0x39')));}}_0x2ec04f[_0xa830('0x3a')][_0x375697]=new RuleEngine(_0x979247);_0x2ec04f[_0xa830('0x3a')][_0x375697][_0xa830('0x3b')](_0xa2d962,function(_0x39741f){logger['info']('Applications\x20executed',JSON[_0xa830('0x3c')](_0x39741f[_0xa830('0x3d')]));if(_0x2ec04f['rules'][_0x375697]){_0x2ec04f[_0xa830('0x3a')][_0x375697][_0xa830('0x3e')]('complete');}});return _0x5b22bc({'code':0xc8,'message':_0xa2d962});}else{if(_0x3771f9){logger[_0xa830('0x34')](util[_0xa830('0xc')](_0xa830('0x3f'),_0x375697));}else{logger[_0xa830('0x34')](_0xa830('0x40'));}return _0x5b22bc({'code':0xc8,'message':_0xa2d962});}}catch(_0x17bbd0){logger[_0xa830('0x38')](_0x17bbd0[_0xa830('0x41')]);return _0x12b5e1(_0x343f1d[_0xa830('0x38')](0x1f4,_0x17bbd0));}}return _0x12b5e1(_0xa830('0x42'));});},'AcceptMessage':function(_0x3eddfe){var _0xb871ed=this;return new Promise(function(_0x4b9c5a,_0x9873d1){if(_0x3eddfe[_0xa830('0x43')]&&_0x3eddfe['agent']['id']){if(_0x2ec04f[_0xa830('0x44')][_0x3eddfe[_0xa830('0x43')]['id']]){_0x2ec04f['agents'][_0x3eddfe[_0xa830('0x43')]['id']]['busy']=![];_0x2ec04f[_0xa830('0x44')][_0x3eddfe[_0xa830('0x43')]['id']][_0xa830('0x45')]=undefined;}}if(_0x3eddfe[_0xa830('0x15')]&&_0x3eddfe['message']['id']){try{var _0x534d80=getId(_0x3eddfe['channel'],_0x3eddfe[_0xa830('0x15')]?_0x3eddfe['message']['id']:0x0,_0x3eddfe[_0xa830('0x16')]?_0x3eddfe['interaction']['id']:0x0);if(_0x2ec04f[_0xa830('0x3a')][_0x534d80]){_0x2ec04f[_0xa830('0x3a')][_0x534d80][_0xa830('0x3e')](_0xa830('0x46'));if(rpc[_0x3eddfe['channel']+_0xa830('0x47')]){rpc[_0x3eddfe[_0xa830('0x14')]+'QueueReport'][_0xa830('0x48')](_0x534d80,{'UserId':_0x3eddfe[_0xa830('0x15')][_0xa830('0x49')]})[_0xa830('0x4a')](function(){logger[_0xa830('0x38')](_0xa830('0x4b'));});}}return _0x4b9c5a({'code':0xc8,'message':_0x3eddfe});}catch(_0x5904ca){logger['error'](_0x5904ca[_0xa830('0x41')]);return _0x9873d1(_0xb871ed[_0xa830('0x38')](0x1f4,_0x5904ca));}}logger['error'](_0xa830('0x4c'));return _0x9873d1(_0xb871ed['error'](0x1f4,_0xa830('0x4c')));});},'RejectMessage':function(_0x11abc2){var _0x380326=this;return new Promise(function(_0xfd793,_0x4a2173){if(_0x11abc2[_0xa830('0x43')]&&_0x11abc2[_0xa830('0x43')]['id']){try{if(_0x2ec04f['agents'][_0x11abc2[_0xa830('0x43')]['id']]){_0x2ec04f[_0xa830('0x44')][_0x11abc2[_0xa830('0x43')]['id']][_0xa830('0x4d')]=![];_0x2ec04f[_0xa830('0x44')][_0x11abc2[_0xa830('0x43')]['id']][_0xa830('0x45')]=undefined;}return _0xfd793({'code':0xc8,'message':_0x11abc2});}catch(_0x6b4e41){logger['error'](_0x6b4e41[_0xa830('0x41')]);return _0x4a2173(_0x380326[_0xa830('0x38')](0x1f4,_0x6b4e41));}}logger['error'](_0xa830('0x4c'));return _0x4a2173(_0x380326[_0xa830('0x38')](0x1f4,_0xa830('0x4c')));});},'AbandonInteraction':function(_0x11d5a9){var _0x127cfc=this;return new Promise(function(_0x580de8,_0xf27e20){if(_0x11d5a9[_0xa830('0x14')]&&_0x11d5a9[_0xa830('0x16')]&&_0x11d5a9[_0xa830('0x16')]['id']){try{var _0x25f6fc=getId(_0x11d5a9[_0xa830('0x14')],_0x11d5a9[_0xa830('0x15')]?_0x11d5a9['message']['id']:0x0,_0x11d5a9[_0xa830('0x16')]?_0x11d5a9['interaction']['id']:0x0);if(_0x2ec04f['rules'][_0x25f6fc]){_0x2ec04f[_0xa830('0x3a')][_0x25f6fc]['emit'](_0xa830('0x46'));}return _0x580de8({'code':0xc8,'message':_0x11d5a9});}catch(_0x50eab0){logger[_0xa830('0x38')](_0x50eab0[_0xa830('0x41')]);return _0xf27e20(_0x127cfc['error'](0x1f4,_0x50eab0));}}logger[_0xa830('0x38')](_0xa830('0x4c'));return _0xf27e20(_0x127cfc[_0xa830('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5953b1){var _0x38971a=this;return new Promise(function(_0xf37e2c,_0x383d12){if(_0x2ec04f[_0xa830('0x44')][_0xa830('0x4e')](_0x5953b1['id'])){for(var _0x33a5b6 in _0x5953b1[_0xa830('0x4f')]){if(_0x5953b1['capacity'][_0xa830('0x4e')](_0x33a5b6)){if(_0x2ec04f[_0xa830('0x44')][_0x5953b1['id']]['hasOwnProperty'](_0x33a5b6+_0xa830('0x50'))){_0x2ec04f[_0xa830('0x44')][_0x5953b1['id']][_0x33a5b6+'CurrentCapacity']=parseInt(_0x5953b1['capacity'][_0x33a5b6],0xa);}}}_0x2ec04f['agents'][_0x5953b1['id']][_0xa830('0x51')]();return _0xf37e2c({'code':0xc8,'message':_0x2ec04f[_0xa830('0x44')][_0x5953b1['id']]});}else{return _0x383d12(_0x38971a[_0xa830('0x38')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x32d687){return new Promise(function(_0x5894d5){var _0x5e2428=_[_0xa830('0x52')](_0x2ec04f[_0xa830('0x44')]);if(_0x32d687&&_0x32d687['id']){var _0xa8e629=_[_0xa830('0x53')](_0x5e2428,function(_0x46d8aa){return _0x46d8aa['id']===_0x32d687['id'];});_0x5894d5(_0xa8e629);}else{_0x5894d5({'count':_0x5e2428[_0xa830('0x1a')],'rows':_0x5e2428});}});},'ChatQueues':function(){return new Promise(function(_0x5daca7){var _0x3a11d2=[];for(var _0x53a552 in _0x2ec04f[_0xa830('0x54')]){if(_0x2ec04f[_0xa830('0x54')][_0xa830('0x4e')](_0x53a552)){var _0x54f202=_0x2ec04f['chatQueues'][_0x53a552];var _0x47068b={'id':_0x54f202['id'],'available':_0x54f202['available'],'loggedIn':_0x54f202['loggedIn'],'name':_0x54f202[_0xa830('0x55')],'paused':_0x54f202[_0xa830('0x56')],'waiting':_0x54f202['waiting']};_0x3a11d2['push'](_0x47068b);}}_0x5daca7({'count':_0x3a11d2[_0xa830('0x1a')],'rows':_0x3a11d2});});},'MailQueues':function(){return new Promise(function(_0x236d11){var _0x342084=[];for(var _0x364797 in _0x2ec04f[_0xa830('0x57')]){if(_0x2ec04f['mailQueues'][_0xa830('0x4e')](_0x364797)){var _0x33b9cf=_0x2ec04f[_0xa830('0x57')][_0x364797];var _0x4b9bc2={'id':_0x33b9cf['id'],'available':_0x33b9cf[_0xa830('0x58')],'loggedIn':_0x33b9cf[_0xa830('0x59')],'name':_0x33b9cf[_0xa830('0x55')],'paused':_0x33b9cf[_0xa830('0x56')],'waiting':_0x33b9cf['waiting']};_0x342084[_0xa830('0x23')](_0x4b9bc2);}}_0x236d11({'count':_0x342084[_0xa830('0x1a')],'rows':_0x342084});});},'OpenchannelQueues':function(){return new Promise(function(_0x124618){var _0x5ef2ef=[];for(var _0x155b05 in _0x2ec04f[_0xa830('0x5a')]){if(_0x2ec04f[_0xa830('0x5a')][_0xa830('0x4e')](_0x155b05)){var _0x5dc224=_0x2ec04f[_0xa830('0x5a')][_0x155b05];var _0x432d64={'id':_0x5dc224['id'],'available':_0x5dc224[_0xa830('0x58')],'loggedIn':_0x5dc224['loggedIn'],'name':_0x5dc224['name'],'paused':_0x5dc224[_0xa830('0x56')],'waiting':_0x5dc224['waiting']};_0x5ef2ef[_0xa830('0x23')](_0x432d64);}}_0x124618({'count':_0x5ef2ef[_0xa830('0x1a')],'rows':_0x5ef2ef});});},'SmsQueues':function(){return new Promise(function(_0x58f937){var _0x4016ca=[];for(var _0x14070b in _0x2ec04f[_0xa830('0x5b')]){if(_0x2ec04f['smsQueues'][_0xa830('0x4e')](_0x14070b)){var _0x4f2693=_0x2ec04f[_0xa830('0x5b')][_0x14070b];var _0x237a33={'id':_0x4f2693['id'],'available':_0x4f2693[_0xa830('0x58')],'loggedIn':_0x4f2693['loggedIn'],'name':_0x4f2693['name'],'paused':_0x4f2693[_0xa830('0x56')],'waiting':_0x4f2693[_0xa830('0x5c')]};_0x4016ca[_0xa830('0x23')](_0x237a33);}}_0x58f937({'count':_0x4016ca[_0xa830('0x1a')],'rows':_0x4016ca});});},'FaxQueues':function(){return new Promise(function(_0x23cdd6){var _0x4d75c6=[];for(var _0xa2d056 in _0x2ec04f[_0xa830('0x5d')]){if(_0x2ec04f[_0xa830('0x5d')][_0xa830('0x4e')](_0xa2d056)){var _0x45acfc=_0x2ec04f[_0xa830('0x5d')][_0xa2d056];var _0x41dbf3={'id':_0x45acfc['id'],'available':_0x45acfc[_0xa830('0x58')],'loggedIn':_0x45acfc[_0xa830('0x59')],'name':_0x45acfc[_0xa830('0x55')],'paused':_0x45acfc[_0xa830('0x56')],'waiting':_0x45acfc[_0xa830('0x5c')]};_0x4d75c6[_0xa830('0x23')](_0x41dbf3);}}_0x23cdd6({'count':_0x4d75c6[_0xa830('0x1a')],'rows':_0x4d75c6});});},'WhatsappQueues':function(){return new Promise(function(_0x4a6dff){var _0x4187c0=[];for(var _0x269376 in _0x2ec04f[_0xa830('0x5e')]){if(_0x2ec04f[_0xa830('0x5e')][_0xa830('0x4e')](_0x269376)){var _0x8078ed=_0x2ec04f[_0xa830('0x5e')][_0x269376];var _0x3d40fb={'id':_0x8078ed['id'],'available':_0x8078ed[_0xa830('0x58')],'loggedIn':_0x8078ed[_0xa830('0x59')],'name':_0x8078ed[_0xa830('0x55')],'paused':_0x8078ed[_0xa830('0x56')],'waiting':_0x8078ed['waiting']};_0x4187c0[_0xa830('0x23')](_0x3d40fb);}}_0x4a6dff({'count':_0x4187c0[_0xa830('0x1a')],'rows':_0x4187c0});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x84005f){var _0x482697=_[_0xa830('0x52')](_0x2ec04f[_0xa830('0x5f')]);_0x84005f({'count':_0x482697[_0xa830('0x1a')],'rows':_0x482697});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2d8091){var _0x388986=_[_0xa830('0x52')](_0x2ec04f['mailQueuesWaitingInteractions']);_0x2d8091({'count':_0x388986[_0xa830('0x1a')],'rows':_0x388986});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3c48f0){var _0x4fd701=_['values'](_0x2ec04f[_0xa830('0x60')]);_0x3c48f0({'count':_0x4fd701[_0xa830('0x1a')],'rows':_0x4fd701});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xbddd27){var _0x173c0d=_[_0xa830('0x52')](_0x2ec04f['smsQueuesWaitingInteractions']);_0xbddd27({'count':_0x173c0d[_0xa830('0x1a')],'rows':_0x173c0d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1700e8){var _0x1c412a=_[_0xa830('0x52')](_0x2ec04f['faxQueuesWaitingInteractions']);_0x1700e8({'count':_0x1c412a['length'],'rows':_0x1c412a});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x56513a){var _0x372530=_[_0xa830('0x52')](_0x2ec04f['whatsappQueuesWaitingInteractions']);_0x56513a({'count':_0x372530[_0xa830('0x1a')],'rows':_0x372530});});}};var _0x123709=jayson['server'](_0x1c504b)[_0xa830('0x61')]();_0x123709['on'](_0xa830('0x38'),function(_0x42d5f5){logger[_0xa830('0x38')](JSON[_0xa830('0x3c')](_0x42d5f5));return _0xf8a29e(_0x42d5f5);});_0x123709[_0xa830('0x13')](0x232c,'127.0.0.1',function(){console['log'](_0xa830('0x62'),0x232c);return _0x4bf51e('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 7ae8af0..19df26c 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 _0x5df9=['util','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','catch','condition','rules','info','stop','push','Command','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack'];(function(_0x20118a,_0x3dbdf3){var _0x538b5f=function(_0x31c5b4){while(--_0x31c5b4){_0x20118a['push'](_0x20118a['shift']());}};_0x538b5f(++_0x3dbdf3);}(_0x5df9,0x122));var _0x95df=function(_0x4caf78,_0x389e8d){_0x4caf78=_0x4caf78-0x0;var _0x335527=_0x5df9[_0x4caf78];return _0x335527;};'use strict';var util=require(_0x95df('0x0'));var BPromise=require(_0x95df('0x1'));var jayson=require(_0x95df('0x2'));var _=require(_0x95df('0x3'));var logger=require('../../../config/logger')(_0x95df('0x4'));var client=jayson[_0x95df('0x5')][_0x95df('0x6')]({'port':0x232a});function request(_0x20a9e7,_0x588e91){return new BPromise(function(_0x549e2c,_0x37208e){return client[_0x95df('0x7')](_0x20a9e7,_0x588e91)[_0x95df('0x8')](function(_0x164236){if(_0x164236['error']){return _0x37208e(_0x164236[_0x95df('0x9')]['message']);}else{return _0x549e2c(_0x164236['result']);}})[_0x95df('0xa')](function(_0x2b31c8){return _0x37208e(_0x2b31c8);});});}exports[_0x95df('0xb')]=function(_0x4517d2,_0x5b8c7d,_0x2b7e8a){return function(_0x200f1a){if(_0x2b7e8a[_0x95df('0xc')]&&!_0x2b7e8a[_0x95df('0xc')][_0x4517d2]){logger[_0x95df('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x4517d2);return _0x200f1a[_0x95df('0xe')]();}var _0x11fff5=[];for(var _0x45844d=0x0;_0x45844d<_0x5b8c7d['length'];_0x45844d+=0x1){_0x11fff5[_0x95df('0xf')](request(_0x95df('0x10'),{'command':util['format'](_0x95df('0x11'),_0x5b8c7d[_0x45844d])})[_0x95df('0x8')](function(_0x5aa3ec){return _0x5aa3ec&&_0x5aa3ec[_0x95df('0x12')]&&_0x5aa3ec[_0x95df('0x12')][_0x95df('0x13')](_0x95df('0x14'))>=0x0?!![]:![];})[_0x95df('0xa')](function(_0x49c319){logger[_0x95df('0x9')](_0x95df('0x15'),_0x4517d2,_0x5b8c7d[_0x45844d]);}));}BPromise[_0x95df('0x16')](_0x11fff5)['then'](function(_0x1eb750){var _0x5d8a56=_['some'](_0x1eb750);logger[_0x95df('0xd')](_0x95df('0x17'),_0x4517d2,_0x5b8c7d[_0x95df('0x18')](_0x95df('0x19')),_0x5d8a56);_0x200f1a[_0x95df('0x1a')](_0x5d8a56);})['catch'](function(_0x2d23ad){console[_0x95df('0x1b')](_0x2d23ad);logger[_0x95df('0x9')](_0x95df('0x17'),_0x4517d2,_0x5b8c7d[_0x95df('0x18')](_0x95df('0x19')),_0x2d23ad[_0x95df('0x1c')]);_0x200f1a[_0x95df('0xe')]();});};}; \ No newline at end of file +var _0xc631=['client','http','request','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stop','util','jayson/promise','lodash','../../../config/logger','routing'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0xc631,0x1ea));var _0x1c63=function(_0x56780a,_0x548106){_0x56780a=_0x56780a-0x0;var _0x29c132=_0xc631[_0x56780a];return _0x29c132;};'use strict';var util=require(_0x1c63('0x0'));var BPromise=require('bluebird');var jayson=require(_0x1c63('0x1'));var _=require(_0x1c63('0x2'));var logger=require(_0x1c63('0x3'))(_0x1c63('0x4'));var client=jayson[_0x1c63('0x5')][_0x1c63('0x6')]({'port':0x232a});function request(_0x1dff1c,_0x23bcb){return new BPromise(function(_0x33fbbb,_0x36ced4){return client[_0x1c63('0x7')](_0x1dff1c,_0x23bcb)['then'](function(_0x32fc9b){if(_0x32fc9b[_0x1c63('0x8')]){return _0x36ced4(_0x32fc9b[_0x1c63('0x8')][_0x1c63('0x9')]);}else{return _0x33fbbb(_0x32fc9b[_0x1c63('0xa')]);}})[_0x1c63('0xb')](function(_0x229dba){return _0x36ced4(_0x229dba);});});}exports[_0x1c63('0xc')]=function(_0x4e0fa,_0x11a28e,_0x138a11){return function(_0xb5042e){if(_0x138a11[_0x1c63('0xd')]&&!_0x138a11[_0x1c63('0xd')][_0x4e0fa]){logger[_0x1c63('0xe')](_0x1c63('0xf'),_0x4e0fa);return _0xb5042e['stop']();}var _0x2c0f68=[];for(var _0xdc5c1e=0x0;_0xdc5c1e<_0x11a28e[_0x1c63('0x10')];_0xdc5c1e+=0x1){_0x2c0f68[_0x1c63('0x11')](request(_0x1c63('0x12'),{'command':util[_0x1c63('0x13')](_0x1c63('0x14'),_0x11a28e[_0xdc5c1e])})[_0x1c63('0x15')](function(_0x53e505){return _0x53e505&&_0x53e505[_0x1c63('0x9')]&&_0x53e505[_0x1c63('0x9')][_0x1c63('0x16')](_0x1c63('0x17'))>=0x0?!![]:![];})['catch'](function(_0x1978ad){logger[_0x1c63('0x8')](_0x1c63('0x18'),_0x4e0fa,_0x11a28e[_0xdc5c1e]);}));}BPromise[_0x1c63('0x19')](_0x2c0f68)[_0x1c63('0x15')](function(_0x41a3cc){var _0x5aa24f=_[_0x1c63('0x1a')](_0x41a3cc);logger[_0x1c63('0xe')](_0x1c63('0x1b'),_0x4e0fa,_0x11a28e[_0x1c63('0x1c')](_0x1c63('0x1d')),_0x5aa24f);_0xb5042e[_0x1c63('0x1e')](_0x5aa24f);})[_0x1c63('0xb')](function(_0x1d163f){console[_0x1c63('0x1f')](_0x1d163f);logger[_0x1c63('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x4e0fa,_0x11a28e[_0x1c63('0x1c')](_0x1c63('0x1d')),_0x1d163f['stack']);_0xb5042e[_0x1c63('0x20')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c613f97..062e42e 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 _0x84a0=['transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','complete','lodash','util','./utils','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x84a0,0x66));var _0x084a=function(_0x1b9aa1,_0x3454cf){_0x1b9aa1=_0x1b9aa1-0x0;var _0x149c8f=_0x84a0[_0x1b9aa1];return _0x149c8f;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var utils=require(_0x084a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fff7f,_0x483bfa){utils[_0x084a('0x3')](util[_0x084a('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1fff7f['uniqueid'],_0x1fff7f[_0x084a('0x5')],_0x1fff7f[_0x084a('0x6')],_0x1fff7f['membername'],_0x1fff7f[_0x084a('0x7')],_0x1fff7f[_0x084a('0x8')],_0x1fff7f[_0x084a('0x9')],_0x1fff7f[_0x084a('0xa')]));if(_0x1fff7f[_0x084a('0x6')]){utils['getVoiceQueueByName'](_0x1fff7f[_0x084a('0x6')])[_0x084a('0xb')](function(_0x8198ad){if(_0x8198ad){_0x1fff7f[_0x084a('0xc')]=_0x8198ad[_0x084a('0xc')];_0x1fff7f['agentacw']=_0x1fff7f['agentcomplete']?_0x8198ad[_0x084a('0xd')]:![];_0x1fff7f[_0x084a('0xe')]=_0x1fff7f[_0x084a('0xf')]?_0x8198ad[_0x084a('0x10')]:0x0;}utils[_0x084a('0x11')]('CreateVoiceAgentReport',_0x1fff7f);});}else{utils['request'](_0x084a('0x12'),_0x1fff7f);}if(_0x483bfa){delete transfers[_0x1fff7f[_0x084a('0x13')]];}else{delete agents[_0x1fff7f[_0x084a('0x14')]];}}exports[_0x084a('0x15')]=function(_0x1bdfb8){try{utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8['uniqueid']),_0x1bdfb8);agents[_0x1bdfb8[_0x084a('0x14')]]=_0x1bdfb8;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x18')]=utils[_0x084a('0x19')]();agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x1a');agents[_0x1bdfb8['destuniqueid']][_0x084a('0x9')]=null;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x1b')]=null;utils[_0x084a('0x3')](util['format'](_0x084a('0x1c'),_0x1bdfb8[_0x084a('0x13')],agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0x1d')],_0x1bdfb8[_0x084a('0x14')]));}catch(_0x145636){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8[_0x084a('0x13')]),_0x145636);}};exports[_0x084a('0x1f')]=function(_0x279e25){try{if(!_[_0x084a('0x20')](agents[_0x279e25[_0x084a('0x14')]])){utils[_0x084a('0x16')](util['format'](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x279e25);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x22'),_0x279e25['uniqueid'],agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1d')],_0x279e25[_0x084a('0x14')]));agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1f')]=!![];agents[_0x279e25[_0x084a('0x14')]]['agentringnoanswerAt']=utils[_0x084a('0x19')]();agents[_0x279e25[_0x084a('0x14')]][_0x084a('0xa')]='timeout';agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x23')]=_0x084a('0x24');agents[_0x279e25['destuniqueid']]['holdtime']=_0x279e25['ringtime']?parseInt(_0x279e25['ringtime'])/0x3e8:0x0;agents[_0x279e25[_0x084a('0x14')]]['talktime']=0x0;unanswered['push'](_0x279e25['destuniqueid']);}}catch(_0x3b8176){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x3b8176);}};exports[_0x084a('0x25')]=function(_0x378de6){try{_[_0x084a('0x26')](agents,function(_0x5e6ea8,_0x2ed3cd){if(_0x5e6ea8[_0x084a('0x13')]==_0x378de6['uniqueid']&&!_[_0x084a('0x27')](unanswered,_0x5e6ea8[_0x084a('0x14')])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x378de6);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x29'),_0x378de6[_0x084a('0x13')],_0x5e6ea8[_0x084a('0x1d')],_0x5e6ea8[_0x084a('0x14')]));_0x5e6ea8[_0x084a('0x1f')]=!![];_0x5e6ea8['agentringnoanswerAt']=utils['now']();_0x5e6ea8[_0x084a('0xa')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x23')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x2b')]=_0x378de6['holdtime'];_0x5e6ea8[_0x084a('0x2c')]=0x0;writeDB(_0x5e6ea8);}});}catch(_0x1b56ad){utils[_0x084a('0x1e')](util['format'](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x1b56ad);}};exports[_0x084a('0x2d')]=function(_0x4c4c90){try{if(agents[_0x4c4c90['destuniqueid']]){utils['debug'](util[_0x084a('0x4')](_0x084a('0x2e'),_0x4c4c90[_0x084a('0x13')]),_0x4c4c90);utils['info'](util[_0x084a('0x4')](_0x084a('0x2f'),_0x4c4c90[_0x084a('0x13')],agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1d')],_0x4c4c90[_0x084a('0x14')]));agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x9')]=_0x4c4c90[_0x084a('0x9')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1b')]=_0x4c4c90[_0x084a('0x1b')];agents[_0x4c4c90['destuniqueid']][_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x32');_[_0x084a('0x26')](agents,function(_0xa7b652,_0x183e10){if(_0xa7b652[_0x084a('0x14')]!=_0x4c4c90['destuniqueid']&&_0xa7b652[_0x084a('0x13')]==_0x4c4c90[_0x084a('0x13')]){_0xa7b652[_0x084a('0x2c')]=0x0;_0xa7b652[_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];_0xa7b652[_0x084a('0x1f')]=!![];_0xa7b652['agentringnoanswerAt']=utils[_0x084a('0x19')]();_0xa7b652[_0x084a('0xa')]='answered_elsewhere';_0xa7b652[_0x084a('0x23')]=_0x084a('0x33');_0xa7b652[_0x084a('0x34')]=_0x4c4c90['destuniqueid'];_0xa7b652[_0x084a('0x35')]=_0x4c4c90[_0x084a('0x1d')];writeDB(_0xa7b652);}});}}catch(_0x4fe9c2){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentconnect]',_0x4c4c90['uniqueid']),_0x4fe9c2);}};exports[_0x084a('0x36')]=function(_0x17a8d4){try{if(!_[_0x084a('0x20')](agents[_0x17a8d4[_0x084a('0x14')]])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x37'),_0x17a8d4[_0x084a('0x13')]),_0x17a8d4);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x38'),_0x17a8d4['uniqueid'],agents[_0x17a8d4['destuniqueid']][_0x084a('0x1d')],_0x17a8d4[_0x084a('0x14')]));agents[_0x17a8d4[_0x084a('0x14')]]['agentcomplete']=!![];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x2c')]=utils['diffTime'](agents[_0x17a8d4[_0x084a('0x14')]]['agentcompleteAt'],agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x30')]);agents[_0x17a8d4[_0x084a('0x14')]]['reason']=_0x17a8d4['reason'];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0xa')]='complete';writeDB(agents[_0x17a8d4[_0x084a('0x14')]]);}}catch(_0x2c2c2e){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentcomplete]',_0x17a8d4[_0x084a('0x13')]),_0x2c2c2e);}};exports[_0x084a('0x3a')]=function(_0x31677b){try{if(!_[_0x084a('0x20')](agents[_0x31677b['transfereruniqueid']])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x31677b);utils['info'](util['format'](_0x084a('0x3c'),_0x31677b[_0x084a('0x13')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x1d')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')]));agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3e')]=!![];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3f')]=_0x084a('0x40');agents[_0x31677b[_0x084a('0x3d')]]['transferexten']=_0x31677b[_0x084a('0x41')];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x42')]=agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')];}}catch(_0x1c972c){utils[_0x084a('0x1e')](util['format'](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x1c972c);}};exports[_0x084a('0x43')]=function(_0x54aa6c){try{utils['debug'](util[_0x084a('0x4')]('[%s][agents][attendedtransfer]',_0x54aa6c[_0x084a('0x44')]),_0x54aa6c);if(_0x54aa6c[_0x084a('0x44')]==_0x54aa6c['origtransfererlinkedid']){if(!_[_0x084a('0x20')](agents[_0x54aa6c['secondtransfereruniqueid']])){utils['info'](util[_0x084a('0x4')](_0x084a('0x45'),_0x54aa6c[_0x084a('0x44')],agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x1d')]));agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x3e')]=!![];agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c[_0x084a('0x46')]]['transferexten']=_0x54aa6c[_0x084a('0x48')];agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x44')];}if(_0x54aa6c['transfereeuniqueid']&&agents[_0x54aa6c[_0x084a('0x49')]]){agents[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x1;transfers[_0x54aa6c[_0x084a('0x49')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfereeuniqueid']]);transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x46')]]['calleridnum'];transfers[_0x54aa6c[_0x084a('0x49')]]['calleridname']=agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x4c')];transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x18')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x2;}}else if(_0x54aa6c[_0x084a('0x46')]==_0x54aa6c[_0x084a('0x4d')]){if(!_['isNil'](agents[_0x54aa6c[_0x084a('0x44')]])){utils[_0x084a('0x3')](util['format'](_0x084a('0x45'),_0x54aa6c['origtransfereruniqueid'],agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x1d')]));agents[_0x54aa6c['origtransfereruniqueid']]['transfer']=!![];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x4e')]=_0x54aa6c[_0x084a('0x4f')];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x46')];}if(_0x54aa6c[_0x084a('0x50')]&&agents[_0x54aa6c[_0x084a('0x50')]]){agents[_0x54aa6c['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x54aa6c[_0x084a('0x50')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfertargetuniqueid']]);transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x8')];transfers[_0x54aa6c['transfertargetuniqueid']][_0x084a('0x4c')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x4c')];transfers[_0x54aa6c['transfertargetuniqueid']]['agentcalledAt']=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c[_0x084a('0x50')]]['agententerreason']=0x2;}}}catch(_0x22efb6){utils['error'](util['format'](_0x084a('0x51'),_0x54aa6c[_0x084a('0x44')]),_0x22efb6);}};exports[_0x084a('0x52')]=function(_0x4a2745){try{utils[_0x084a('0x16')](util['format'](_0x084a('0x53'),_0x4a2745[_0x084a('0x13')]),_0x4a2745);if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]===_0x084a('0x24')){if(_0x4a2745['cause']==='21'){agents[_0x4a2745['uniqueid']][_0x084a('0x23')]=_0x084a('0x54');agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]=_0x084a('0x54');}utils[_0x084a('0x3')](util['format'](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]]['lastevent']));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);var _0x38b5b6=unanswered[_0x084a('0x56')](_0x4a2745[_0x084a('0x13')]);if(_0x38b5b6>-0x1){unanswered[_0x084a('0x57')](_0x38b5b6,0x1);}}if(transfers[_0x4a2745[_0x084a('0x13')]]){transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils['now']();transfers[_0x4a2745['uniqueid']]['talktime']=utils[_0x084a('0x58')](transfers[_0x4a2745[_0x084a('0x13')]]['agentcompleteAt'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x30')]);transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]='agent';transfers[_0x4a2745['uniqueid']][_0x084a('0xa')]=_0x084a('0x59');utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],transfers[_0x4a2745[_0x084a('0x13')]]['membername'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(transfers[_0x4a2745[_0x084a('0x13')]],!![]);}if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']){agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x2c')]=utils[_0x084a('0x58')](agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')],agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']);agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]=agents[_0x4a2745['uniqueid']][_0x084a('0x3e')]?'transfer':'agent';agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]='complete';utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);}}catch(_0x7c85e3){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x53'),_0x4a2745['uniqueid']),_0x7c85e3);}}; \ No newline at end of file +var _0x153f=['type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','info','format','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x153f,0x15b));var _0xf153=function(_0x16cf81,_0xd280af){_0x16cf81=_0x16cf81-0x0;var _0x387327=_0x153f[_0x16cf81];return _0x387327;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var utils=require(_0xf153('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44cea3,_0x2afb9a){utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x44cea3[_0xf153('0x5')],_0x44cea3['channel'],_0x44cea3[_0xf153('0x6')],_0x44cea3[_0xf153('0x7')],_0x44cea3[_0xf153('0x8')],_0x44cea3[_0xf153('0x9')],_0x44cea3[_0xf153('0xa')],_0x44cea3['lastevent']));if(_0x44cea3[_0xf153('0x6')]){utils[_0xf153('0xb')](_0x44cea3[_0xf153('0x6')])[_0xf153('0xc')](function(_0x253fd3){if(_0x253fd3){_0x44cea3[_0xf153('0xd')]=_0x253fd3[_0xf153('0xd')];_0x44cea3[_0xf153('0xe')]=_0x44cea3[_0xf153('0xf')]?_0x253fd3[_0xf153('0x10')]:![];_0x44cea3['acwtime']=_0x44cea3[_0xf153('0xe')]?_0x253fd3[_0xf153('0x11')]:0x0;}utils[_0xf153('0x12')]('CreateVoiceAgentReport',_0x44cea3);});}else{utils[_0xf153('0x12')](_0xf153('0x13'),_0x44cea3);}if(_0x2afb9a){delete transfers[_0x44cea3[_0xf153('0x5')]];}else{delete agents[_0x44cea3[_0xf153('0x14')]];}}exports[_0xf153('0x15')]=function(_0x107d31){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31['uniqueid']),_0x107d31);agents[_0x107d31[_0xf153('0x14')]]=_0x107d31;agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x18')]=utils[_0xf153('0x19')]();agents[_0x107d31[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x1b');agents[_0x107d31[_0xf153('0x14')]]['connectedlinenum']=null;agents[_0x107d31[_0xf153('0x14')]]['connectedlinename']=null;utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x1c'),_0x107d31[_0xf153('0x5')],agents[_0x107d31['destuniqueid']][_0xf153('0x7')],_0x107d31[_0xf153('0x14')]));}catch(_0x41946a){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x17'),_0x107d31[_0xf153('0x5')]),_0x41946a);}};exports[_0xf153('0x1e')]=function(_0x3735a7){try{if(!_[_0xf153('0x1f')](agents[_0x3735a7[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x3735a7);utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x21'),_0x3735a7[_0xf153('0x5')],agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x7')],_0x3735a7[_0xf153('0x14')]));agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1e')]=!![];agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x22')]=utils[_0xf153('0x19')]();agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x1a')]=_0xf153('0x23');agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x24')]=_0xf153('0x23');agents[_0x3735a7['destuniqueid']][_0xf153('0x25')]=_0x3735a7[_0xf153('0x26')]?parseInt(_0x3735a7['ringtime'])/0x3e8:0x0;agents[_0x3735a7[_0xf153('0x14')]][_0xf153('0x27')]=0x0;unanswered['push'](_0x3735a7[_0xf153('0x14')]);}}catch(_0x10295e){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x20'),_0x3735a7[_0xf153('0x5')]),_0x10295e);}};exports[_0xf153('0x28')]=function(_0x3b5f4f){try{_[_0xf153('0x29')](agents,function(_0x8e31bf,_0x13b541){if(_0x8e31bf[_0xf153('0x5')]==_0x3b5f4f['uniqueid']&&!_[_0xf153('0x2a')](unanswered,_0x8e31bf[_0xf153('0x14')])){utils[_0xf153('0x16')](util[_0xf153('0x4')]('[%s][agents][queuecallerabandon]',_0x3b5f4f['uniqueid']),_0x3b5f4f);utils[_0xf153('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x3b5f4f[_0xf153('0x5')],_0x8e31bf['membername'],_0x8e31bf[_0xf153('0x14')]));_0x8e31bf['agentringnoanswer']=!![];_0x8e31bf[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x8e31bf['lastevent']=_0xf153('0x2b');_0x8e31bf[_0xf153('0x24')]=_0xf153('0x2b');_0x8e31bf[_0xf153('0x25')]=_0x3b5f4f[_0xf153('0x25')];_0x8e31bf[_0xf153('0x27')]=0x0;writeDB(_0x8e31bf);}});}catch(_0x4ab69c){utils[_0xf153('0x1d')](util['format'](_0xf153('0x2c'),_0x3b5f4f[_0xf153('0x5')]),_0x4ab69c);}};exports[_0xf153('0x2d')]=function(_0x1820c3){try{if(agents[_0x1820c3[_0xf153('0x14')]]){utils[_0xf153('0x16')](util['format'](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1820c3);utils[_0xf153('0x3')](util['format'](_0xf153('0x2f'),_0x1820c3[_0xf153('0x5')],agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x7')],_0x1820c3[_0xf153('0x14')]));agents[_0x1820c3[_0xf153('0x14')]]['agentconnectAt']=utils[_0xf153('0x19')]();agents[_0x1820c3[_0xf153('0x14')]]['connectedlinenum']=_0x1820c3[_0xf153('0xa')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x30')]=_0x1820c3[_0xf153('0x30')];agents[_0x1820c3[_0xf153('0x14')]][_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];agents[_0x1820c3['destuniqueid']][_0xf153('0x1a')]=_0xf153('0x31');_[_0xf153('0x29')](agents,function(_0x352e7c,_0x25657a){if(_0x352e7c[_0xf153('0x14')]!=_0x1820c3['destuniqueid']&&_0x352e7c['uniqueid']==_0x1820c3[_0xf153('0x5')]){_0x352e7c['talktime']=0x0;_0x352e7c[_0xf153('0x25')]=_0x1820c3[_0xf153('0x26')];_0x352e7c[_0xf153('0x1e')]=!![];_0x352e7c[_0xf153('0x22')]=utils[_0xf153('0x19')]();_0x352e7c[_0xf153('0x1a')]='answered_elsewhere';_0x352e7c['reason']=_0xf153('0x32');_0x352e7c[_0xf153('0x33')]=_0x1820c3['destuniqueid'];_0x352e7c[_0xf153('0x34')]=_0x1820c3[_0xf153('0x7')];writeDB(_0x352e7c);}});}}catch(_0x1edf65){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x2e'),_0x1820c3[_0xf153('0x5')]),_0x1edf65);}};exports[_0xf153('0xf')]=function(_0x1b453f){try{if(!_[_0xf153('0x1f')](agents[_0x1b453f[_0xf153('0x14')]])){utils[_0xf153('0x16')](util['format'](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x1b453f);utils[_0xf153('0x3')](util['format'](_0xf153('0x36'),_0x1b453f[_0xf153('0x5')],agents[_0x1b453f['destuniqueid']][_0xf153('0x7')],_0x1b453f['destuniqueid']));agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0xf')]=!![];agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt']=utils[_0xf153('0x19')]();agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x1b453f[_0xf153('0x14')]]['agentcompleteAt'],agents[_0x1b453f[_0xf153('0x14')]][_0xf153('0x38')]);agents[_0x1b453f['destuniqueid']][_0xf153('0x24')]=_0x1b453f[_0xf153('0x24')];agents[_0x1b453f[_0xf153('0x14')]]['lastevent']=_0xf153('0x39');writeDB(agents[_0x1b453f[_0xf153('0x14')]]);}}catch(_0x82dc34){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x35'),_0x1b453f[_0xf153('0x5')]),_0x82dc34);}};exports[_0xf153('0x3a')]=function(_0x3b91ed){try{if(!_['isNil'](agents[_0x3b91ed[_0xf153('0x3b')]])){utils['debug'](util['format']('[%s][agents][blindtransfer]',_0x3b91ed[_0xf153('0x5')]),_0x3b91ed);utils[_0xf153('0x3')](util['format'](_0xf153('0x3c'),_0x3b91ed[_0xf153('0x5')],agents[_0x3b91ed['transfereruniqueid']][_0xf153('0x7')],agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')]));agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3d')]=!![];agents[_0x3b91ed[_0xf153('0x3b')]]['transfertype']=_0xf153('0x3e');agents[_0x3b91ed[_0xf153('0x3b')]]['transferexten']=_0x3b91ed['extension'];agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x3f')]=agents[_0x3b91ed[_0xf153('0x3b')]][_0xf153('0x5')];}}catch(_0x419e7e){utils[_0xf153('0x1d')](util['format'](_0xf153('0x40'),_0x3b91ed['uniqueid']),_0x419e7e);}};exports[_0xf153('0x41')]=function(_0x365209){try{utils[_0xf153('0x16')](util['format'](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x365209);if(_0x365209[_0xf153('0x43')]==_0x365209[_0xf153('0x44')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x45')]])){utils[_0xf153('0x3')](util['format'](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209[_0xf153('0x45')]]['membername']));agents[_0x365209[_0xf153('0x45')]][_0xf153('0x3d')]=!![];agents[_0x365209[_0xf153('0x45')]][_0xf153('0x47')]=_0xf153('0x48');agents[_0x365209[_0xf153('0x45')]][_0xf153('0x49')]=_0x365209[_0xf153('0x4a')];agents[_0x365209['secondtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x43')];}if(_0x365209['transfereeuniqueid']&&agents[_0x365209[_0xf153('0x4b')]]){agents[_0x365209[_0xf153('0x4b')]][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x4b')]]=_[_0xf153('0x4d')](agents[_0x365209[_0xf153('0x4b')]]);transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x9')];transfers[_0x365209[_0xf153('0x4b')]]['calleridname']=agents[_0x365209[_0xf153('0x45')]][_0xf153('0x4e')];transfers[_0x365209['transfereeuniqueid']][_0xf153('0x18')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x38')]=utils[_0xf153('0x19')]();transfers[_0x365209[_0xf153('0x4b')]][_0xf153('0x25')]=0x0;transfers[_0x365209['transfereeuniqueid']][_0xf153('0x4c')]=0x2;}}else if(_0x365209[_0xf153('0x45')]==_0x365209[_0xf153('0x4f')]){if(!_[_0xf153('0x1f')](agents[_0x365209[_0xf153('0x43')]])){utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x46'),_0x365209[_0xf153('0x43')],agents[_0x365209['origtransfereruniqueid']][_0xf153('0x7')]));agents[_0x365209[_0xf153('0x43')]]['transfer']=!![];agents[_0x365209[_0xf153('0x43')]]['transfertype']=_0xf153('0x48');agents[_0x365209[_0xf153('0x43')]]['transferexten']=_0x365209[_0xf153('0x50')];agents[_0x365209['origtransfereruniqueid']][_0xf153('0x3f')]=_0x365209[_0xf153('0x45')];}if(_0x365209[_0xf153('0x51')]&&agents[_0x365209[_0xf153('0x51')]]){agents[_0x365209['transfertargetuniqueid']][_0xf153('0x4c')]=0x1;transfers[_0x365209[_0xf153('0x51')]]=_['clone'](agents[_0x365209[_0xf153('0x51')]]);transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x9')]=agents[_0x365209[_0xf153('0x43')]][_0xf153('0x9')];transfers[_0x365209['transfertargetuniqueid']][_0xf153('0x4e')]=agents[_0x365209['origtransfereruniqueid']][_0xf153('0x4e')];transfers[_0x365209[_0xf153('0x51')]]['agentcalledAt']=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x38')]=utils['now']();transfers[_0x365209[_0xf153('0x51')]][_0xf153('0x25')]=0x0;transfers[_0x365209[_0xf153('0x51')]]['agententerreason']=0x2;}}}catch(_0x671efe){utils[_0xf153('0x1d')](util[_0xf153('0x4')](_0xf153('0x42'),_0x365209[_0xf153('0x43')]),_0x671efe);}};exports[_0xf153('0x52')]=function(_0x37443f){try{utils[_0xf153('0x16')](util[_0xf153('0x4')](_0xf153('0x53'),_0x37443f[_0xf153('0x5')]),_0x37443f);if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]===_0xf153('0x23')){if(_0x37443f[_0xf153('0x54')]==='21'){agents[_0x37443f['uniqueid']][_0xf153('0x24')]='rejected';agents[_0x37443f['uniqueid']][_0xf153('0x1a')]='rejected';}utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(agents[_0x37443f['uniqueid']]);var _0x59e22d=unanswered[_0xf153('0x56')](_0x37443f[_0xf153('0x5')]);if(_0x59e22d>-0x1){unanswered[_0xf153('0x57')](_0x59e22d,0x1);}}if(transfers[_0x37443f['uniqueid']]){transfers[_0x37443f[_0xf153('0x5')]]['agentcomplete']=!![];transfers[_0x37443f['uniqueid']][_0xf153('0x58')]=utils[_0xf153('0x19')]();transfers[_0x37443f[_0xf153('0x5')]]['talktime']=utils[_0xf153('0x37')](transfers[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x38')]);transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')]=_0xf153('0x59');transfers[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')](_0xf153('0x55'),_0x37443f[_0xf153('0x5')],transfers[_0x37443f[_0xf153('0x5')]]['membername'],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x24')],transfers[_0x37443f[_0xf153('0x5')]][_0xf153('0x1a')]));writeDB(transfers[_0x37443f[_0xf153('0x5')]],!![]);}if(agents[_0x37443f[_0xf153('0x5')]]&&agents[_0x37443f['uniqueid']][_0xf153('0x38')]){agents[_0x37443f[_0xf153('0x5')]][_0xf153('0xf')]=!![];agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x58')]=utils[_0xf153('0x19')]();agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x27')]=utils[_0xf153('0x37')](agents[_0x37443f[_0xf153('0x5')]]['agentcompleteAt'],agents[_0x37443f['uniqueid']]['agentconnectAt']);agents[_0x37443f['uniqueid']][_0xf153('0x24')]=agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x3d')]?_0xf153('0x3d'):_0xf153('0x59');agents[_0x37443f['uniqueid']][_0xf153('0x1a')]=_0xf153('0x39');utils[_0xf153('0x3')](util[_0xf153('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37443f[_0xf153('0x5')],agents[_0x37443f[_0xf153('0x5')]][_0xf153('0x7')],agents[_0x37443f['uniqueid']][_0xf153('0x24')],agents[_0x37443f['uniqueid']][_0xf153('0x1a')]));writeDB(agents[_0x37443f[_0xf153('0x5')]]);}}catch(_0x2651ff){utils['error'](util['format']('[%s][agents][hangup]',_0x37443f[_0xf153('0x5')]),_0x2651ff);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3d29278..70f94bd 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 _0xac73=['[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','execif','set','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','FAILED','uniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','blinds','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','format','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','debug'];(function(_0x626f86,_0x7619b5){var _0x418916=function(_0x4a68f0){while(--_0x4a68f0){_0x626f86['push'](_0x626f86['shift']());}};_0x418916(++_0x7619b5);}(_0xac73,0x186));var _0x3ac7=function(_0x1a7d3a,_0x53e745){_0x1a7d3a=_0x1a7d3a-0x0;var _0x7728b0=_0xac73[_0x1a7d3a];return _0x7728b0;};'use strict';var _=require(_0x3ac7('0x0'));var util=require(_0x3ac7('0x1'));var utils=require(_0x3ac7('0x2'));var transfers=require(_0x3ac7('0x3'));var dispositions=[_0x3ac7('0x4'),'FAILED','FAILED',_0x3ac7('0x4'),_0x3ac7('0x4'),_0x3ac7('0x4'),_0x3ac7('0x5'),'BUSY',_0x3ac7('0x6'),_0x3ac7('0x6'),_0x3ac7('0x6')];var channels={};function writeDB(_0x245025){var _0x37917c;if(transfers['blinds'][_0x245025[_0x3ac7('0x7')]]){_0x37917c=_0x245025[_0x3ac7('0x7')];_0x245025[_0x3ac7('0x7')]=transfers['blinds'][_0x245025[_0x3ac7('0x7')]]['transfereeuniqueid'];}utils['info'](util['format'](_0x3ac7('0x8'),_0x245025[_0x3ac7('0x7')],_0x245025[_0x3ac7('0x9')],_0x245025[_0x3ac7('0xa')],_0x245025['membername'],_0x245025['interface'],_0x245025[_0x3ac7('0xb')],_0x245025[_0x3ac7('0xc')],_0x245025[_0x3ac7('0xd')]));if(_0x245025[_0x3ac7('0xe')]){utils[_0x3ac7('0xf')](_0x245025['accountcode'])['then'](function(_0x1c6733){if(_0x1c6733){_0x245025[_0x3ac7('0x10')]=_0x1c6733['id'];}utils[_0x3ac7('0x11')](_0x3ac7('0x12'),_0x245025);});}else{utils['request']('CreateVoiceCallReport',_0x245025);}if(channels[_0x245025[_0x3ac7('0x7')]]){delete channels[_0x245025[_0x3ac7('0x7')]];}else if(_0x37917c&&channels[_0x37917c]){if(!transfers['blinds'][_0x37917c]['recording'])delete transfers[_0x3ac7('0x13')][_0x37917c];delete channels[_0x37917c];}}exports[_0x3ac7('0x14')]=function(_0x13d240){try{utils['debug'](util['format'](_0x3ac7('0x15'),_0x13d240['uniqueid']),_0x13d240);if(_0x13d240[_0x3ac7('0x7')]==_0x13d240[_0x3ac7('0x16')]&&_0x13d240[_0x3ac7('0x9')]!=_0x3ac7('0x17')){utils[_0x3ac7('0x18')](util['format'](_0x3ac7('0x19'),_0x13d240[_0x3ac7('0x7')],_0x13d240[_0x3ac7('0x1a')],_0x13d240['exten']));channels[_0x13d240[_0x3ac7('0x7')]]={'uniqueid':_0x13d240[_0x3ac7('0x7')],'accountcode':_0x13d240[_0x3ac7('0xe')],'source':_0x13d240['calleridnum'],'destination':_0x13d240[_0x3ac7('0x1b')],'destinationcontext':_0x13d240['context'],'channel':_0x13d240['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x3ac7('0x1c')};}}catch(_0xebbe47){utils[_0x3ac7('0x1d')](util[_0x3ac7('0x1e')](_0x3ac7('0x15'),_0x13d240['uniqueid']),_0xebbe47);}};exports[_0x3ac7('0x1f')]=function(_0x430c51){try{utils['debug'](util['format'](_0x3ac7('0x20'),_0x430c51[_0x3ac7('0x7')]),_0x430c51);if(!_[_0x3ac7('0x21')](channels[_0x430c51['uniqueid']])&&_0x430c51[_0x3ac7('0x22')]==0x6){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x23'),_0x430c51['uniqueid'],_0x430c51[_0x3ac7('0x1a')],_0x430c51[_0x3ac7('0x9')]));if(_[_0x3ac7('0x21')](channels[_0x430c51[_0x3ac7('0x7')]][_0x3ac7('0x24')])){channels[_0x430c51['uniqueid']][_0x3ac7('0x24')]=utils[_0x3ac7('0x25')]();}}else if(!_[_0x3ac7('0x21')](channels[_0x430c51[_0x3ac7('0x16')]])&&_0x430c51[_0x3ac7('0x22')]==0x6&&_0x430c51[_0x3ac7('0x1a')]!='transfer'){utils['info'](util[_0x3ac7('0x1e')](_0x3ac7('0x26'),_0x430c51['uniqueid'],_0x430c51[_0x3ac7('0x16')],_0x430c51['context'],_0x430c51[_0x3ac7('0x9')]));channels[_0x430c51['linkedid']][_0x3ac7('0xe')]=_0x430c51[_0x3ac7('0xe')];channels[_0x430c51[_0x3ac7('0x16')]][_0x3ac7('0x27')]=_0x430c51['channel'];if(_[_0x3ac7('0x21')](channels[_0x430c51[_0x3ac7('0x16')]][_0x3ac7('0x28')])){channels[_0x430c51[_0x3ac7('0x16')]][_0x3ac7('0x28')]=utils['now']();}channels[_0x430c51[_0x3ac7('0x16')]][_0x3ac7('0x29')]=dispositions[_[_0x3ac7('0x2a')](_0x430c51[_0x3ac7('0x22')])]||'ANSWERED';}}catch(_0x2c8956){utils['error'](util[_0x3ac7('0x1e')]('[%s][calls][newstate]',_0x430c51[_0x3ac7('0x7')]),_0x2c8956);}};exports['hangup']=function(_0x3e19e1){try{if(!_[_0x3ac7('0x21')](channels[_0x3e19e1[_0x3ac7('0x7')]])){utils['debug'](util[_0x3ac7('0x1e')]('[%s][calls][hangup]',_0x3e19e1[_0x3ac7('0x7')]),_0x3e19e1);if(_[_0x3ac7('0x21')](channels[_0x3e19e1['uniqueid']][_0x3ac7('0x2b')])){channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x2b')]=_0x3e19e1[_0x3ac7('0x2c')]+'\x20<'+_0x3e19e1['calleridnum']+'>';}utils['info'](util[_0x3ac7('0x1e')](_0x3ac7('0x2d'),_0x3e19e1[_0x3ac7('0x7')],channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x2b')],_0x3e19e1[_0x3ac7('0x2e')]));channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x2f')]=utils[_0x3ac7('0x25')]();channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x30')]=utils[_0x3ac7('0x31')](channels[_0x3e19e1['uniqueid']][_0x3ac7('0x2f')],channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x32')]);channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x33')]=channels[_0x3e19e1[_0x3ac7('0x7')]]['answertime']?utils[_0x3ac7('0x31')](channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x2f')],channels[_0x3e19e1[_0x3ac7('0x7')]][_0x3ac7('0x28')]):0x0;writeDB(channels[_0x3e19e1['uniqueid']]);}}catch(_0x5ad647){utils[_0x3ac7('0x1d')](util[_0x3ac7('0x1e')](_0x3ac7('0x34'),_0x3e19e1[_0x3ac7('0x7')]),_0x5ad647);}};exports[_0x3ac7('0x35')]=function(_0x4b6c36){try{if(!_[_0x3ac7('0x21')](channels[_0x4b6c36[_0x3ac7('0x36')]])){utils['debug'](util[_0x3ac7('0x1e')](_0x3ac7('0x37'),_0x4b6c36[_0x3ac7('0x38')]),_0x4b6c36);if(channels[_0x4b6c36['localtwolinkedid']][_0x3ac7('0x9')]==_0x4b6c36[_0x3ac7('0x39')]){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x3a'),_0x4b6c36[_0x3ac7('0x38')],_0x4b6c36[_0x3ac7('0x36')],_0x4b6c36[_0x3ac7('0x3b')]));channels[_0x4b6c36[_0x3ac7('0x36')]][_0x3ac7('0x27')]=_0x4b6c36[_0x3ac7('0x3b')];channels[_0x4b6c36['localtwolinkedid']][_0x3ac7('0x3c')]=_0x3ac7('0x3d');}else if(channels[_0x4b6c36['localtwolinkedid']][_0x3ac7('0x9')]=_0x4b6c36[_0x3ac7('0x3e')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4b6c36[_0x3ac7('0x38')],_0x4b6c36[_0x3ac7('0x36')],_0x4b6c36[_0x3ac7('0x3f')]));channels[_0x4b6c36['localtwolinkedid']][_0x3ac7('0x27')]=_0x4b6c36[_0x3ac7('0x3f')];channels[_0x4b6c36[_0x3ac7('0x36')]][_0x3ac7('0x3c')]=_0x3ac7('0x3d');}}}catch(_0xb76e3d){utils[_0x3ac7('0x1d')](util['format'](_0x3ac7('0x37'),_0x4b6c36[_0x3ac7('0x38')]),_0xb76e3d);}};exports[_0x3ac7('0x40')]=function(_0x38228f){try{if(!_[_0x3ac7('0x21')](channels[_0x38228f['uniqueid']])){utils[_0x3ac7('0x41')](util[_0x3ac7('0x1e')](_0x3ac7('0x42'),_0x38228f[_0x3ac7('0x7')]),_0x38228f);channels[_0x38228f['uniqueid']][_0x3ac7('0x43')]=utils[_0x3ac7('0x25')]();utils[_0x3ac7('0x18')](util['format'](_0x3ac7('0x44'),_0x38228f['uniqueid'],channels[_0x38228f['uniqueid']][_0x3ac7('0x43')]));}}catch(_0x5e555b){utils['error'](util[_0x3ac7('0x1e')](_0x3ac7('0x42'),_0x38228f[_0x3ac7('0x7')]),_0x5e555b);}};exports[_0x3ac7('0x45')]=function(_0x291116){try{if(!_[_0x3ac7('0x21')](channels[_0x291116[_0x3ac7('0x7')]])){utils[_0x3ac7('0x41')](util['format']('[%s][calls][musiconholdstop]',_0x291116[_0x3ac7('0x7')]),_0x291116);if(!_[_0x3ac7('0x21')](channels[_0x291116[_0x3ac7('0x7')]][_0x3ac7('0x43')])){channels[_0x291116[_0x3ac7('0x7')]][_0x3ac7('0x46')]+=utils[_0x3ac7('0x31')](utils['now'](),channels[_0x291116[_0x3ac7('0x7')]][_0x3ac7('0x43')]);utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x47'),_0x291116[_0x3ac7('0x7')],channels[_0x291116[_0x3ac7('0x7')]][_0x3ac7('0x46')]));delete channels[_0x291116['uniqueid']][_0x3ac7('0x43')];}}}catch(_0x39984c){utils[_0x3ac7('0x1d')](util['format'](_0x3ac7('0x48'),_0x291116[_0x3ac7('0x7')]),_0x39984c);}};exports['varset']=function(_0x294abd){try{if(!_['isNil'](channels[_0x294abd['uniqueid']])){utils[_0x3ac7('0x41')](util[_0x3ac7('0x1e')](_0x3ac7('0x49'),_0x294abd[_0x3ac7('0x7')]),_0x294abd);if(!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x4b')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x4c'),_0x294abd['uniqueid'],_0x294abd['value']));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x4d')]=_0x294abd[_0x3ac7('0x4e')];}if(!_[_0x3ac7('0x21')](_0x294abd['variable'][_0x3ac7('0x4f')])){utils['info'](util['format'](_0x3ac7('0x50'),_0x294abd[_0x3ac7('0x7')],_0x294abd[_0x3ac7('0x4e')]));channels[_0x294abd[_0x3ac7('0x7')]]['destination']=_0x294abd[_0x3ac7('0x4e')];channels[_0x294abd[_0x3ac7('0x7')]]['callerid']='\x22'+_0x294abd[_0x3ac7('0x4e')]+_0x3ac7('0x51')+_0x294abd[_0x3ac7('0x4e')]+'>';}if(!_[_0x3ac7('0x21')](_0x294abd['variable'][_0x3ac7('0x52')])||!_['isNil'](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x53')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x294abd[_0x3ac7('0x7')],!_['isNil'](_0x294abd['variable'][_0x3ac7('0x52')])?_0x3ac7('0x52'):_0x3ac7('0x53'),_0x294abd['value']));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x2b')]=_0x294abd[_0x3ac7('0x4e')];}if(!_[_0x3ac7('0x21')](_0x294abd['variable']['xmd-queue'])||!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x54')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x55'),_0x294abd[_0x3ac7('0x7')],!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x56')])?'xmd-queue':_0x3ac7('0x54'),_0x294abd['value']));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x57')]=_0x3ac7('0x58');channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x59')]=_0x294abd[_0x3ac7('0x4e')];channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0xa')]=!![];}if(!_[_0x3ac7('0x21')](_0x294abd['variable'][_0x3ac7('0x5a')])){utils['info'](util[_0x3ac7('0x1e')](_0x3ac7('0x5b'),_0x294abd[_0x3ac7('0x7')],_0x294abd[_0x3ac7('0x4e')]));channels[_0x294abd[_0x3ac7('0x7')]]['ContactId']=_0x294abd[_0x3ac7('0x4e')];}if(!_[_0x3ac7('0x21')](_0x294abd['variable'][_0x3ac7('0x5c')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x5d'),_0x294abd['uniqueid'],_0x294abd[_0x3ac7('0x4e')]));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x5e')]=_0x294abd['value'];}if(!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x5f')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x60'),_0x294abd['uniqueid'],_0x294abd[_0x3ac7('0x4e')]));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x61')]=_0x294abd['value'];}if(!_[_0x3ac7('0x21')](_0x294abd[_0x3ac7('0x4a')][_0x3ac7('0x62')])){utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x63'),_0x294abd[_0x3ac7('0x7')],_0x294abd['value']));channels[_0x294abd[_0x3ac7('0x7')]][_0x3ac7('0x62')]=_0x294abd[_0x3ac7('0x4e')];}}}catch(_0x1926fe){utils['error'](util[_0x3ac7('0x1e')](_0x3ac7('0x49'),_0x294abd[_0x3ac7('0x7')]),_0x1926fe);}};exports['newexten']=function(_0x2093c9){try{if(!_[_0x3ac7('0x21')](channels[_0x2093c9[_0x3ac7('0x7')]])){utils[_0x3ac7('0x41')](util[_0x3ac7('0x1e')](_0x3ac7('0x64'),_0x2093c9[_0x3ac7('0x7')]),_0x2093c9);utils[_0x3ac7('0x18')](util[_0x3ac7('0x1e')](_0x3ac7('0x65'),_0x2093c9[_0x3ac7('0x7')],_0x2093c9[_0x3ac7('0x66')],_0x2093c9['appdata']));if(_0x2093c9[_0x3ac7('0x66')][_0x3ac7('0x67')]()=='set'&&_[_0x3ac7('0x68')](_0x2093c9[_0x3ac7('0x69')][_0x3ac7('0x67')](),_0x3ac7('0x6a'))){var _0x3dc13b=_0x2093c9['appdata'][_0x3ac7('0x6b')]('=');var _0x52b260=_0x3dc13b[0x0][_0x3ac7('0x6c')](_0x3dc13b[0x0][_0x3ac7('0x6d')]('(')+0x1,_0x3dc13b[0x0]['lastIndexOf'](')'));var _0xeb8dc6=_0x3dc13b[0x1];channels[_0x2093c9[_0x3ac7('0x7')]][_0x52b260]=_0xeb8dc6;}if(!_[_0x3ac7('0x6e')](['hangup','noop',_0x3ac7('0x6f'),_0x3ac7('0x70'),_0x3ac7('0x71')],_0x2093c9[_0x3ac7('0x66')][_0x3ac7('0x67')]())){channels[_0x2093c9[_0x3ac7('0x7')]][_0x3ac7('0x57')]=_0x2093c9[_0x3ac7('0x66')];channels[_0x2093c9[_0x3ac7('0x7')]][_0x3ac7('0x59')]=_0x2093c9[_0x3ac7('0x69')];}}}catch(_0x301727){utils[_0x3ac7('0x1d')](util[_0x3ac7('0x1e')](_0x3ac7('0x64'),_0x2093c9[_0x3ac7('0x7')]),_0x301727);}}; \ No newline at end of file +var _0xd1f8=['[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','now','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','origtransfererchannel','userfield','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','ANSWERED','[%s][calls][newstate]','[%s][calls][hangup]','callerid'];(function(_0x2556a8,_0x20455e){var _0x488358=function(_0x20d646){while(--_0x20d646){_0x2556a8['push'](_0x2556a8['shift']());}};_0x488358(++_0x20455e);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0xd1f8[_0x4bfade];return _0x272465;};'use strict';var _=require(_0x8d1f('0x0'));var util=require(_0x8d1f('0x1'));var utils=require(_0x8d1f('0x2'));var transfers=require(_0x8d1f('0x3'));var dispositions=['NO\x20ANSWER',_0x8d1f('0x4'),'FAILED',_0x8d1f('0x5'),'NO\x20ANSWER',_0x8d1f('0x5'),'ANSWERED',_0x8d1f('0x6'),_0x8d1f('0x4'),'FAILED',_0x8d1f('0x4')];var channels={};function writeDB(_0x140754){var _0x66ee15;if(transfers[_0x8d1f('0x7')][_0x140754[_0x8d1f('0x8')]]){_0x66ee15=_0x140754['uniqueid'];_0x140754[_0x8d1f('0x8')]=transfers[_0x8d1f('0x7')][_0x140754['uniqueid']][_0x8d1f('0x9')];}utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0xc'),_0x140754[_0x8d1f('0x8')],_0x140754['channel'],_0x140754['queue'],_0x140754[_0x8d1f('0xd')],_0x140754['interface'],_0x140754[_0x8d1f('0xe')],_0x140754[_0x8d1f('0xf')],_0x140754['lastevent']));if(_0x140754[_0x8d1f('0x10')]){utils[_0x8d1f('0x11')](_0x140754[_0x8d1f('0x10')])['then'](function(_0x7d9ae5){if(_0x7d9ae5){_0x140754[_0x8d1f('0x12')]=_0x7d9ae5['id'];}utils[_0x8d1f('0x13')](_0x8d1f('0x14'),_0x140754);});}else{utils[_0x8d1f('0x13')](_0x8d1f('0x14'),_0x140754);}if(channels[_0x140754[_0x8d1f('0x8')]]){delete channels[_0x140754[_0x8d1f('0x8')]];}else if(_0x66ee15&&channels[_0x66ee15]){if(!transfers[_0x8d1f('0x7')][_0x66ee15][_0x8d1f('0x15')])delete transfers[_0x8d1f('0x7')][_0x66ee15];delete channels[_0x66ee15];}}exports[_0x8d1f('0x16')]=function(_0x431beb){try{utils[_0x8d1f('0x17')](util[_0x8d1f('0xb')](_0x8d1f('0x18'),_0x431beb[_0x8d1f('0x8')]),_0x431beb);if(_0x431beb['uniqueid']==_0x431beb['linkedid']&&_0x431beb[_0x8d1f('0x19')]!=_0x8d1f('0x1a')){utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x1b'),_0x431beb[_0x8d1f('0x8')],_0x431beb['context'],_0x431beb[_0x8d1f('0x1c')]));channels[_0x431beb[_0x8d1f('0x8')]]={'uniqueid':_0x431beb[_0x8d1f('0x8')],'accountcode':_0x431beb[_0x8d1f('0x10')],'source':_0x431beb['calleridnum'],'destination':_0x431beb['exten'],'destinationcontext':_0x431beb[_0x8d1f('0x1d')],'channel':_0x431beb[_0x8d1f('0x19')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x8d1f('0x5'),'amaflags':'DOCUMENTATION'};}}catch(_0x285e7f){utils[_0x8d1f('0x1e')](util[_0x8d1f('0xb')](_0x8d1f('0x18'),_0x431beb[_0x8d1f('0x8')]),_0x285e7f);}};exports[_0x8d1f('0x1f')]=function(_0x250e58){try{utils[_0x8d1f('0x17')](util[_0x8d1f('0xb')]('[%s][calls][newstate]',_0x250e58[_0x8d1f('0x8')]),_0x250e58);if(!_[_0x8d1f('0x20')](channels[_0x250e58['uniqueid']])&&_0x250e58[_0x8d1f('0x21')]==0x6){utils[_0x8d1f('0xa')](util['format'](_0x8d1f('0x22'),_0x250e58[_0x8d1f('0x8')],_0x250e58[_0x8d1f('0x1d')],_0x250e58['channel']));if(_[_0x8d1f('0x20')](channels[_0x250e58[_0x8d1f('0x8')]][_0x8d1f('0x23')])){channels[_0x250e58['uniqueid']][_0x8d1f('0x23')]=utils['now']();}}else if(!_['isNil'](channels[_0x250e58[_0x8d1f('0x24')]])&&_0x250e58[_0x8d1f('0x21')]==0x6&&_0x250e58[_0x8d1f('0x1d')]!=_0x8d1f('0x25')){utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x26'),_0x250e58[_0x8d1f('0x8')],_0x250e58['linkedid'],_0x250e58[_0x8d1f('0x1d')],_0x250e58[_0x8d1f('0x19')]));channels[_0x250e58[_0x8d1f('0x24')]][_0x8d1f('0x10')]=_0x250e58[_0x8d1f('0x10')];channels[_0x250e58[_0x8d1f('0x24')]]['destinationchannel']=_0x250e58[_0x8d1f('0x19')];if(_[_0x8d1f('0x20')](channels[_0x250e58['linkedid']][_0x8d1f('0x27')])){channels[_0x250e58[_0x8d1f('0x24')]]['answertime']=utils['now']();}channels[_0x250e58['linkedid']][_0x8d1f('0x28')]=dispositions[_[_0x8d1f('0x29')](_0x250e58[_0x8d1f('0x21')])]||_0x8d1f('0x2a');}}catch(_0x2cff29){utils[_0x8d1f('0x1e')](util[_0x8d1f('0xb')](_0x8d1f('0x2b'),_0x250e58['uniqueid']),_0x2cff29);}};exports['hangup']=function(_0x51a012){try{if(!_[_0x8d1f('0x20')](channels[_0x51a012[_0x8d1f('0x8')]])){utils[_0x8d1f('0x17')](util[_0x8d1f('0xb')](_0x8d1f('0x2c'),_0x51a012[_0x8d1f('0x8')]),_0x51a012);if(_['isNil'](channels[_0x51a012[_0x8d1f('0x8')]]['callerid'])){channels[_0x51a012[_0x8d1f('0x8')]][_0x8d1f('0x2d')]=_0x51a012['calleridname']+'\x20<'+_0x51a012['calleridnum']+'>';}utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x2e'),_0x51a012[_0x8d1f('0x8')],channels[_0x51a012[_0x8d1f('0x8')]][_0x8d1f('0x2d')],_0x51a012['cause-txt']));channels[_0x51a012[_0x8d1f('0x8')]][_0x8d1f('0x2f')]=utils[_0x8d1f('0x30')]();channels[_0x51a012[_0x8d1f('0x8')]][_0x8d1f('0x31')]=utils[_0x8d1f('0x32')](channels[_0x51a012[_0x8d1f('0x8')]][_0x8d1f('0x2f')],channels[_0x51a012[_0x8d1f('0x8')]][_0x8d1f('0x33')]);channels[_0x51a012[_0x8d1f('0x8')]]['billableseconds']=channels[_0x51a012[_0x8d1f('0x8')]][_0x8d1f('0x27')]?utils[_0x8d1f('0x32')](channels[_0x51a012['uniqueid']]['endtime'],channels[_0x51a012['uniqueid']][_0x8d1f('0x27')]):0x0;writeDB(channels[_0x51a012[_0x8d1f('0x8')]]);}}catch(_0x5799db){utils[_0x8d1f('0x1e')](util[_0x8d1f('0xb')](_0x8d1f('0x2c'),_0x51a012[_0x8d1f('0x8')]),_0x5799db);}};exports[_0x8d1f('0x34')]=function(_0x144bc7){try{if(!_[_0x8d1f('0x20')](channels[_0x144bc7[_0x8d1f('0x35')]])){utils[_0x8d1f('0x17')](util[_0x8d1f('0xb')](_0x8d1f('0x36'),_0x144bc7['origtransfereruniqueid']),_0x144bc7);if(channels[_0x144bc7[_0x8d1f('0x35')]][_0x8d1f('0x19')]==_0x144bc7['transfereechannel']){utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x37'),_0x144bc7[_0x8d1f('0x38')],_0x144bc7['localtwolinkedid'],_0x144bc7['secondtransfererchannel']));channels[_0x144bc7['localtwolinkedid']]['destinationchannel']=_0x144bc7[_0x8d1f('0x39')];channels[_0x144bc7[_0x8d1f('0x35')]]['userfield']=_0x8d1f('0x3a');}else if(channels[_0x144bc7['localtwolinkedid']]['channel']=_0x144bc7['transfertargetchannel']){utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x37'),_0x144bc7[_0x8d1f('0x38')],_0x144bc7['localtwolinkedid'],_0x144bc7[_0x8d1f('0x3b')]));channels[_0x144bc7['localtwolinkedid']]['destinationchannel']=_0x144bc7[_0x8d1f('0x3b')];channels[_0x144bc7[_0x8d1f('0x35')]][_0x8d1f('0x3c')]=_0x8d1f('0x3a');}}}catch(_0x1070c8){utils[_0x8d1f('0x1e')](util[_0x8d1f('0xb')](_0x8d1f('0x36'),_0x144bc7[_0x8d1f('0x38')]),_0x1070c8);}};exports['musiconholdstart']=function(_0x8d0dba){try{if(!_[_0x8d1f('0x20')](channels[_0x8d0dba[_0x8d1f('0x8')]])){utils[_0x8d1f('0x17')](util[_0x8d1f('0xb')](_0x8d1f('0x3d'),_0x8d0dba[_0x8d1f('0x8')]),_0x8d0dba);channels[_0x8d0dba[_0x8d1f('0x8')]][_0x8d1f('0x3e')]=utils[_0x8d1f('0x30')]();utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x3f'),_0x8d0dba[_0x8d1f('0x8')],channels[_0x8d0dba[_0x8d1f('0x8')]][_0x8d1f('0x3e')]));}}catch(_0x4f2215){utils[_0x8d1f('0x1e')](util[_0x8d1f('0xb')](_0x8d1f('0x3d'),_0x8d0dba[_0x8d1f('0x8')]),_0x4f2215);}};exports[_0x8d1f('0x40')]=function(_0x3f4f6c){try{if(!_[_0x8d1f('0x20')](channels[_0x3f4f6c[_0x8d1f('0x8')]])){utils[_0x8d1f('0x17')](util[_0x8d1f('0xb')](_0x8d1f('0x41'),_0x3f4f6c[_0x8d1f('0x8')]),_0x3f4f6c);if(!_[_0x8d1f('0x20')](channels[_0x3f4f6c['uniqueid']][_0x8d1f('0x3e')])){channels[_0x3f4f6c[_0x8d1f('0x8')]][_0x8d1f('0x42')]+=utils[_0x8d1f('0x32')](utils[_0x8d1f('0x30')](),channels[_0x3f4f6c['uniqueid']][_0x8d1f('0x3e')]);utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x43'),_0x3f4f6c['uniqueid'],channels[_0x3f4f6c[_0x8d1f('0x8')]][_0x8d1f('0x42')]));delete channels[_0x3f4f6c[_0x8d1f('0x8')]]['musiconholdstartAt'];}}}catch(_0x52c8c0){utils[_0x8d1f('0x1e')](util[_0x8d1f('0xb')](_0x8d1f('0x41'),_0x3f4f6c[_0x8d1f('0x8')]),_0x52c8c0);}};exports[_0x8d1f('0x44')]=function(_0x535fde){try{if(!_[_0x8d1f('0x20')](channels[_0x535fde[_0x8d1f('0x8')]])){utils['debug'](util[_0x8d1f('0xb')](_0x8d1f('0x45'),_0x535fde[_0x8d1f('0x8')]),_0x535fde);if(!_[_0x8d1f('0x20')](_0x535fde[_0x8d1f('0x46')]['xmd-originatecalleridnum'])){utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x47'),_0x535fde[_0x8d1f('0x8')],_0x535fde[_0x8d1f('0x48')]));channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x49')]=_0x535fde[_0x8d1f('0x48')];}if(!_['isNil'](_0x535fde[_0x8d1f('0x46')][_0x8d1f('0x4a')])){utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x4b'),_0x535fde[_0x8d1f('0x8')],_0x535fde['value']));channels[_0x535fde['uniqueid']][_0x8d1f('0x4c')]=_0x535fde[_0x8d1f('0x48')];channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x2d')]='\x22'+_0x535fde[_0x8d1f('0x48')]+_0x8d1f('0x4d')+_0x535fde[_0x8d1f('0x48')]+'>';}if(!_[_0x8d1f('0x20')](_0x535fde[_0x8d1f('0x46')][_0x8d1f('0x4e')])||!_['isNil'](_0x535fde[_0x8d1f('0x46')][_0x8d1f('0x4f')])){utils[_0x8d1f('0xa')](util['format'](_0x8d1f('0x50'),_0x535fde[_0x8d1f('0x8')],!_[_0x8d1f('0x20')](_0x535fde[_0x8d1f('0x46')][_0x8d1f('0x4e')])?'xmd-callerid-preview':_0x8d1f('0x4f'),_0x535fde[_0x8d1f('0x48')]));channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x2d')]=_0x535fde[_0x8d1f('0x48')];}if(!_[_0x8d1f('0x20')](_0x535fde[_0x8d1f('0x46')]['xmd-queue'])||!_[_0x8d1f('0x20')](_0x535fde['variable'][_0x8d1f('0x51')])){utils['info'](util[_0x8d1f('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x535fde[_0x8d1f('0x8')],!_[_0x8d1f('0x20')](_0x535fde['variable'][_0x8d1f('0x52')])?_0x8d1f('0x52'):_0x8d1f('0x51'),_0x535fde[_0x8d1f('0x48')]));channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x53')]=_0x8d1f('0x54');channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x55')]=_0x535fde[_0x8d1f('0x48')];channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x56')]=!![];}if(!_[_0x8d1f('0x20')](_0x535fde[_0x8d1f('0x46')][_0x8d1f('0x57')])){utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x535fde[_0x8d1f('0x8')],_0x535fde['value']));channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x58')]=_0x535fde[_0x8d1f('0x48')];}if(!_[_0x8d1f('0x20')](_0x535fde[_0x8d1f('0x46')][_0x8d1f('0x59')])){utils['info'](util[_0x8d1f('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x535fde[_0x8d1f('0x8')],_0x535fde[_0x8d1f('0x48')]));channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x5a')]=_0x535fde[_0x8d1f('0x48')];}if(!_[_0x8d1f('0x20')](_0x535fde['variable'][_0x8d1f('0x5b')])){utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x535fde[_0x8d1f('0x8')],_0x535fde[_0x8d1f('0x48')]));channels[_0x535fde['uniqueid']][_0x8d1f('0x5c')]=_0x535fde[_0x8d1f('0x48')];}if(!_[_0x8d1f('0x20')](_0x535fde['variable'][_0x8d1f('0x5d')])){utils[_0x8d1f('0xa')](util['format'](_0x8d1f('0x5e'),_0x535fde[_0x8d1f('0x8')],_0x535fde[_0x8d1f('0x48')]));channels[_0x535fde[_0x8d1f('0x8')]][_0x8d1f('0x5d')]=_0x535fde[_0x8d1f('0x48')];}}}catch(_0x4a8d8b){utils['error'](util[_0x8d1f('0xb')](_0x8d1f('0x45'),_0x535fde[_0x8d1f('0x8')]),_0x4a8d8b);}};exports[_0x8d1f('0x5f')]=function(_0x2cedde){try{if(!_[_0x8d1f('0x20')](channels[_0x2cedde[_0x8d1f('0x8')]])){utils[_0x8d1f('0x17')](util[_0x8d1f('0xb')](_0x8d1f('0x60'),_0x2cedde[_0x8d1f('0x8')]),_0x2cedde);utils[_0x8d1f('0xa')](util[_0x8d1f('0xb')](_0x8d1f('0x61'),_0x2cedde['uniqueid'],_0x2cedde['application'],_0x2cedde[_0x8d1f('0x62')]));if(_0x2cedde[_0x8d1f('0x63')][_0x8d1f('0x64')]()==_0x8d1f('0x65')&&_[_0x8d1f('0x66')](_0x2cedde['appdata'][_0x8d1f('0x64')](),_0x8d1f('0x67'))){var _0x552350=_0x2cedde['appdata']['split']('=');var _0x33232c=_0x552350[0x0][_0x8d1f('0x68')](_0x552350[0x0]['lastIndexOf']('(')+0x1,_0x552350[0x0][_0x8d1f('0x69')](')'));var _0x2bc024=_0x552350[0x1];channels[_0x2cedde[_0x8d1f('0x8')]][_0x33232c]=_0x2bc024;}if(!_[_0x8d1f('0x6a')]([_0x8d1f('0x6b'),_0x8d1f('0x6c'),_0x8d1f('0x6d'),'set',_0x8d1f('0x6e')],_0x2cedde[_0x8d1f('0x63')][_0x8d1f('0x64')]())){channels[_0x2cedde[_0x8d1f('0x8')]][_0x8d1f('0x53')]=_0x2cedde[_0x8d1f('0x63')];channels[_0x2cedde[_0x8d1f('0x8')]]['lastdata']=_0x2cedde[_0x8d1f('0x62')];}}}catch(_0x27ef81){utils['error'](util[_0x8d1f('0xb')](_0x8d1f('0x60'),_0x2cedde[_0x8d1f('0x8')]),_0x27ef81);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index bba2862..959bc72 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 _0x8d05=['[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','info'];(function(_0x598fca,_0x533239){var _0x5f1509=function(_0x1aadf9){while(--_0x1aadf9){_0x598fca['push'](_0x598fca['shift']());}};_0x5f1509(++_0x533239);}(_0x8d05,0x6c));var _0x58d0=function(_0x2d8e9b,_0x3d4f9f){_0x2d8e9b=_0x2d8e9b-0x0;var _0x357afc=_0x8d05[_0x2d8e9b];return _0x357afc;};'use strict';var utils=require(_0x58d0('0x0'));exports['connect']=function(){utils[_0x58d0('0x1')](_0x58d0('0x2'));};exports['shutdown']=function(){utils[_0x58d0('0x1')](_0x58d0('0x3'));};exports[_0x58d0('0x4')]=function(){utils[_0x58d0('0x1')](_0x58d0('0x5'));};exports[_0x58d0('0x6')]=function(_0x5e2178){utils[_0x58d0('0x6')]('[core]\x20error',_0x5e2178);};exports[_0x58d0('0x7')]=function(){utils['info'](_0x58d0('0x8'));};exports[_0x58d0('0x9')]=function(_0x320542){}; \ No newline at end of file +var _0x2b67=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close'];(function(_0x41159b,_0x18ae88){var _0x5bea4e=function(_0x95177e){while(--_0x95177e){_0x41159b['push'](_0x41159b['shift']());}};_0x5bea4e(++_0x18ae88);}(_0x2b67,0xf3));var _0x72b6=function(_0x3a6b86,_0x548787){_0x3a6b86=_0x3a6b86-0x0;var _0x254a9b=_0x2b67[_0x3a6b86];return _0x254a9b;};'use strict';var utils=require(_0x72b6('0x0'));exports[_0x72b6('0x1')]=function(){utils[_0x72b6('0x2')](_0x72b6('0x3'));};exports[_0x72b6('0x4')]=function(){utils[_0x72b6('0x2')]('[core]\x20shutdown');};exports[_0x72b6('0x5')]=function(){utils['info'](_0x72b6('0x6'));};exports[_0x72b6('0x7')]=function(_0x51562e){utils['error']('[core]\x20error',_0x51562e);};exports[_0x72b6('0x8')]=function(){utils[_0x72b6('0x2')](_0x72b6('0x9'));};exports[_0x72b6('0xa')]=function(_0x229a65){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1115cd1..bc6e054 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 _0xa373=['[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','request','uniqueid','newexten','debug','format','toLowerCase','set','startsWith','cdr(routeid)','appdata','error','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect'];(function(_0x37e09b,_0x4c5ee9){var _0x26a1ed=function(_0x5c1d86){while(--_0x5c1d86){_0x37e09b['push'](_0x37e09b['shift']());}};_0x26a1ed(++_0x4c5ee9);}(_0xa373,0x71));var _0x3a37=function(_0x48ac79,_0x57a9be){_0x48ac79=_0x48ac79-0x0;var _0xd977f=_0xa373[_0x48ac79];return _0xd977f;};'use strict';var _=require('lodash');var util=require(_0x3a37('0x0'));var utils=require(_0x3a37('0x1'));var dials={};function writeDB(_0x2e860c){utils[_0x3a37('0x2')](util['format'](_0x3a37('0x3'),_0x2e860c['uniqueid'],_0x2e860c[_0x3a37('0x4')],_0x2e860c[_0x3a37('0x5')],_0x2e860c[_0x3a37('0x6')],_0x2e860c['connectedlinenum'],_0x2e860c['dialstatus']));utils[_0x3a37('0x7')]('CreateVoiceDialReport',_0x2e860c);delete dials[_0x2e860c[_0x3a37('0x8')]];}exports[_0x3a37('0x9')]=function(_0x4fd56a){try{utils[_0x3a37('0xa')](util[_0x3a37('0xb')]('[%s][dials][newexten]',_0x4fd56a['uniqueid']),_0x4fd56a);utils['info'](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4fd56a[_0x3a37('0x8')],_0x4fd56a['application'],_0x4fd56a['appdata']));if(_0x4fd56a['application'][_0x3a37('0xc')]()==_0x3a37('0xd')&&_[_0x3a37('0xe')](_0x4fd56a['appdata'][_0x3a37('0xc')](),_0x3a37('0xf'))){var _0x114121=_0x4fd56a[_0x3a37('0x10')]['split']('=');dials[_0x4fd56a[_0x3a37('0x8')]]={'routeId':_0x114121[0x1]};}}catch(_0x5b8013){utils[_0x3a37('0x11')](util['format'](_0x3a37('0x12'),_0x4fd56a['uniqueid']),_0x5b8013);}};exports[_0x3a37('0x13')]=function(_0x3e70ca){try{utils[_0x3a37('0xa')](util[_0x3a37('0xb')](_0x3a37('0x14'),_0x3e70ca[_0x3a37('0x8')]),_0x3e70ca);if(!_['isNil'](_0x3e70ca[_0x3a37('0x15')][_0x3a37('0x16')])){utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x17'),_0x3e70ca[_0x3a37('0x8')],_0x3e70ca[_0x3a37('0x18')]));dials[_0x3e70ca[_0x3a37('0x8')]]={'routeId':_0x3e70ca[_0x3a37('0x18')]};}}catch(_0x24c154){utils[_0x3a37('0x11')](util['format'](_0x3a37('0x14'),_0x3e70ca[_0x3a37('0x8')]),_0x24c154);}};exports[_0x3a37('0x19')]=function(_0x2dbf1e){try{if(!_['isNil'](dials[_0x2dbf1e[_0x3a37('0x8')]])){utils[_0x3a37('0xa')](util[_0x3a37('0xb')](_0x3a37('0x1a'),_0x2dbf1e['uniqueid']),_0x2dbf1e);dials[_0x2dbf1e[_0x3a37('0x8')]]=_[_0x3a37('0x1b')](dials[_0x2dbf1e['uniqueid']],_0x2dbf1e);dials[_0x2dbf1e['uniqueid']][_0x3a37('0x1c')]=utils[_0x3a37('0x1d')]();dials[_0x2dbf1e[_0x3a37('0x8')]]['lastevent']=_0x3a37('0x1e');utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x1f'),_0x2dbf1e['uniqueid'],dials[_0x2dbf1e[_0x3a37('0x8')]]['starttime']));}}catch(_0x1b5a07){utils[_0x3a37('0x11')](util[_0x3a37('0xb')](_0x3a37('0x1a'),_0x2dbf1e[_0x3a37('0x8')]),_0x1b5a07);}};exports[_0x3a37('0x20')]=function(_0x54db8b){try{if(!_[_0x3a37('0x21')](dials[_0x54db8b[_0x3a37('0x8')]])){utils[_0x3a37('0xa')](util[_0x3a37('0xb')](_0x3a37('0x22'),_0x54db8b[_0x3a37('0x8')]),_0x54db8b);dials[_0x54db8b[_0x3a37('0x8')]]['dialstatus']=_0x54db8b[_0x3a37('0x23')];if(_0x54db8b[_0x3a37('0x23')]==_0x3a37('0x24')){dials[_0x54db8b[_0x3a37('0x8')]]=_[_0x3a37('0x1b')](dials[_0x54db8b[_0x3a37('0x8')]],_0x54db8b);dials[_0x54db8b[_0x3a37('0x8')]][_0x3a37('0x25')]=utils[_0x3a37('0x1d')]();dials[_0x54db8b['uniqueid']]['lastevent']=_0x3a37('0x26');utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x27'),_0x54db8b[_0x3a37('0x8')],_0x54db8b[_0x3a37('0x23')],dials[_0x54db8b[_0x3a37('0x8')]][_0x3a37('0x25')]));}else{utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x28'),_0x54db8b[_0x3a37('0x8')],_0x54db8b[_0x3a37('0x23')]));}}}catch(_0x295e18){utils[_0x3a37('0x11')](util[_0x3a37('0xb')]('[%s][dials][dialend]',_0x54db8b[_0x3a37('0x8')]),_0x295e18);}};exports[_0x3a37('0x29')]=function(_0x5479f4){try{if(!_['isNil'](dials[_0x5479f4[_0x3a37('0x8')]])){utils['debug'](util[_0x3a37('0xb')](_0x3a37('0x2a'),_0x5479f4['uniqueid']),_0x5479f4);utils[_0x3a37('0x2')](util[_0x3a37('0xb')](_0x3a37('0x2b'),_0x5479f4[_0x3a37('0x8')],_0x5479f4[_0x3a37('0x6')],_0x5479f4[_0x3a37('0x2c')],_0x5479f4['cause-txt']));dials[_0x5479f4[_0x3a37('0x8')]]=_['assign'](dials[_0x5479f4['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x3a37('0x2d')});dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x2e')]=utils[_0x3a37('0x2f')](dials[_0x5479f4['uniqueid']][_0x3a37('0x30')],dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x1c')]);dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x31')]=utils[_0x3a37('0x2f')](dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x25')]||dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x30')],dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x1c')]);dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x32')]=dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x25')]?utils[_0x3a37('0x2f')](dials[_0x5479f4[_0x3a37('0x8')]]['endtime'],dials[_0x5479f4[_0x3a37('0x8')]][_0x3a37('0x25')]):0x0;writeDB(dials[_0x5479f4['uniqueid']]);}}catch(_0x54e064){utils[_0x3a37('0x11')](util['format'](_0x3a37('0x2a'),_0x5479f4[_0x3a37('0x8')]),_0x54e064);}}; \ No newline at end of file +var _0xea60=['calleridnum','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','uniqueid','application','toLowerCase','set','appdata','cdr(routeid)','split','error','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x2bb662,_0x21f2e6){var _0x39e825=function(_0x5b4d5a){while(--_0x5b4d5a){_0x2bb662['push'](_0x2bb662['shift']());}};_0x39e825(++_0x21f2e6);}(_0xea60,0x6e));var _0x0ea6=function(_0x298238,_0x4a4a4d){_0x298238=_0x298238-0x0;var _0x26021f=_0xea60[_0x298238];return _0x26021f;};'use strict';var _=require(_0x0ea6('0x0'));var util=require(_0x0ea6('0x1'));var utils=require(_0x0ea6('0x2'));var dials={};function writeDB(_0x53a49e){utils[_0x0ea6('0x3')](util[_0x0ea6('0x4')](_0x0ea6('0x5'),_0x53a49e['uniqueid'],_0x53a49e[_0x0ea6('0x6')],_0x53a49e['dialstring'],_0x53a49e['calleridnum'],_0x53a49e[_0x0ea6('0x7')],_0x53a49e[_0x0ea6('0x8')]));utils[_0x0ea6('0x9')](_0x0ea6('0xa'),_0x53a49e);delete dials[_0x53a49e['uniqueid']];}exports['newexten']=function(_0x1e8abd){try{utils[_0x0ea6('0xb')](util['format'](_0x0ea6('0xc'),_0x1e8abd['uniqueid']),_0x1e8abd);utils[_0x0ea6('0x3')](util[_0x0ea6('0x4')](_0x0ea6('0xd'),_0x1e8abd[_0x0ea6('0xe')],_0x1e8abd[_0x0ea6('0xf')],_0x1e8abd['appdata']));if(_0x1e8abd[_0x0ea6('0xf')][_0x0ea6('0x10')]()==_0x0ea6('0x11')&&_['startsWith'](_0x1e8abd[_0x0ea6('0x12')][_0x0ea6('0x10')](),_0x0ea6('0x13'))){var _0x1cd57e=_0x1e8abd[_0x0ea6('0x12')][_0x0ea6('0x14')]('=');dials[_0x1e8abd[_0x0ea6('0xe')]]={'routeId':_0x1cd57e[0x1]};}}catch(_0x415696){utils[_0x0ea6('0x15')](util['format'](_0x0ea6('0xc'),_0x1e8abd[_0x0ea6('0xe')]),_0x415696);}};exports['varset']=function(_0x256e5c){try{utils['debug'](util[_0x0ea6('0x4')](_0x0ea6('0x16'),_0x256e5c[_0x0ea6('0xe')]),_0x256e5c);if(!_[_0x0ea6('0x17')](_0x256e5c['variable'][_0x0ea6('0x18')])){utils['info'](util[_0x0ea6('0x4')](_0x0ea6('0x19'),_0x256e5c[_0x0ea6('0xe')],_0x256e5c[_0x0ea6('0x1a')]));dials[_0x256e5c['uniqueid']]={'routeId':_0x256e5c['value']};}}catch(_0x3deba2){utils[_0x0ea6('0x15')](util[_0x0ea6('0x4')](_0x0ea6('0x16'),_0x256e5c[_0x0ea6('0xe')]),_0x3deba2);}};exports[_0x0ea6('0x1b')]=function(_0x481742){try{if(!_[_0x0ea6('0x17')](dials[_0x481742[_0x0ea6('0xe')]])){utils[_0x0ea6('0xb')](util['format'](_0x0ea6('0x1c'),_0x481742[_0x0ea6('0xe')]),_0x481742);dials[_0x481742[_0x0ea6('0xe')]]=_[_0x0ea6('0x1d')](dials[_0x481742['uniqueid']],_0x481742);dials[_0x481742[_0x0ea6('0xe')]][_0x0ea6('0x1e')]=utils[_0x0ea6('0x1f')]();dials[_0x481742[_0x0ea6('0xe')]]['lastevent']='called';utils[_0x0ea6('0x3')](util[_0x0ea6('0x4')](_0x0ea6('0x20'),_0x481742['uniqueid'],dials[_0x481742[_0x0ea6('0xe')]][_0x0ea6('0x1e')]));}}catch(_0x9247b0){utils[_0x0ea6('0x15')](util['format'](_0x0ea6('0x1c'),_0x481742[_0x0ea6('0xe')]),_0x9247b0);}};exports[_0x0ea6('0x21')]=function(_0x2803b3){try{if(!_['isNil'](dials[_0x2803b3[_0x0ea6('0xe')]])){utils[_0x0ea6('0xb')](util['format'](_0x0ea6('0x22'),_0x2803b3[_0x0ea6('0xe')]),_0x2803b3);dials[_0x2803b3[_0x0ea6('0xe')]][_0x0ea6('0x8')]=_0x2803b3[_0x0ea6('0x8')];if(_0x2803b3[_0x0ea6('0x8')]==_0x0ea6('0x23')){dials[_0x2803b3[_0x0ea6('0xe')]]=_[_0x0ea6('0x1d')](dials[_0x2803b3[_0x0ea6('0xe')]],_0x2803b3);dials[_0x2803b3[_0x0ea6('0xe')]][_0x0ea6('0x24')]=utils[_0x0ea6('0x1f')]();dials[_0x2803b3[_0x0ea6('0xe')]][_0x0ea6('0x25')]='connect';utils[_0x0ea6('0x3')](util['format'](_0x0ea6('0x26'),_0x2803b3[_0x0ea6('0xe')],_0x2803b3['dialstatus'],dials[_0x2803b3[_0x0ea6('0xe')]][_0x0ea6('0x24')]));}else{utils[_0x0ea6('0x3')](util[_0x0ea6('0x4')](_0x0ea6('0x27'),_0x2803b3[_0x0ea6('0xe')],_0x2803b3[_0x0ea6('0x8')]));}}}catch(_0xef8092){utils[_0x0ea6('0x15')](util['format'](_0x0ea6('0x22'),_0x2803b3[_0x0ea6('0xe')]),_0xef8092);}};exports[_0x0ea6('0x28')]=function(_0xe28938){try{if(!_[_0x0ea6('0x17')](dials[_0xe28938[_0x0ea6('0xe')]])){utils[_0x0ea6('0xb')](util['format'](_0x0ea6('0x29'),_0xe28938[_0x0ea6('0xe')]),_0xe28938);utils['info'](util['format'](_0x0ea6('0x2a'),_0xe28938[_0x0ea6('0xe')],_0xe28938[_0x0ea6('0x2b')],_0xe28938['calleridname'],_0xe28938[_0x0ea6('0x2c')]));dials[_0xe28938['uniqueid']]=_[_0x0ea6('0x1d')](dials[_0xe28938['uniqueid']],{'endtime':utils[_0x0ea6('0x1f')](),'lastevent':_0x0ea6('0x2d')});dials[_0xe28938['uniqueid']][_0x0ea6('0x2e')]=utils[_0x0ea6('0x2f')](dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x30')],dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x1e')]);dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x31')]=utils[_0x0ea6('0x2f')](dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x24')]||dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x30')],dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x1e')]);dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x32')]=dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x24')]?utils['diffTime'](dials[_0xe28938['uniqueid']][_0x0ea6('0x30')],dials[_0xe28938[_0x0ea6('0xe')]][_0x0ea6('0x24')]):0x0;writeDB(dials[_0xe28938[_0x0ea6('0xe')]]);}}catch(_0x4c8f6e){utils[_0x0ea6('0x15')](util['format']('[%s][dials][hangup]',_0xe28938[_0x0ea6('0xe')]),_0x4c8f6e);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8eb3a76..bf4eefd 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 _0xe418=['[%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','port','password','keepConnected','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','debug','format','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel'];(function(_0x21e32e,_0x49c6f8){var _0x2a2eb2=function(_0x2e9554){while(--_0x2e9554){_0x21e32e['push'](_0x21e32e['shift']());}};_0x2a2eb2(++_0x49c6f8);}(_0xe418,0x126));var _0x8e41=function(_0x41ef4b,_0x60913f){_0x41ef4b=_0x41ef4b-0x0;var _0x25a0a1=_0xe418[_0x41ef4b];return _0x25a0a1;};var AsteriskManager=require(_0x8e41('0x0'));var config=require(_0x8e41('0x1'));var utils=require(_0x8e41('0x2'));var util=require(_0x8e41('0x3'));var isXDREnabled=config[_0x8e41('0x4')]&&config[_0x8e41('0x4')][_0x8e41('0x5')]?!config[_0x8e41('0x4')][_0x8e41('0x5')]:!![];var isProduction=config[_0x8e41('0x6')]===_0x8e41('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0x8e41('0x4')][_0x8e41('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x8e41('0x9')][_0x8e41('0xa')],config['asterisk']['ip'],config[_0x8e41('0x9')]['username'],config[_0x8e41('0x9')][_0x8e41('0xb')],!![]);ami[_0x8e41('0xc')]();if(!isXDREnabled){utils[_0x8e41('0xd')](_0x8e41('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8e41('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x8e41('0xf'));var queues=require('./queues.controller');var recordings=require(_0x8e41('0x10'));var members=require(_0x8e41('0x11'));var dials=require(_0x8e41('0x12'));var transfers=require(_0x8e41('0x13'));var core=require(_0x8e41('0x14'));ami['on'](_0x8e41('0x15'),core['connect']);ami['on'](_0x8e41('0x16'),core[_0x8e41('0x16')]);ami['on'](_0x8e41('0x17'),core[_0x8e41('0x17')]);ami['on'](_0x8e41('0x18'),core[_0x8e41('0x18')]);ami['on'](_0x8e41('0x19'),core['close']);ami['on'](_0x8e41('0x1a'),core[_0x8e41('0x1a')]);ami['on'](_0x8e41('0x1b'),function(_0xa39714){try{utils['debug'](util['format'](_0x8e41('0x1c'),_0xa39714['device']),_0xa39714);members['devicestatechange'](_0xa39714);}catch(_0x4f8505){utils['error'](util['format'](_0x8e41('0x1c'),_0xa39714[_0x8e41('0x1d')]),_0x4f8505);}});ami['on'](_0x8e41('0x1e'),function(_0x219881){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x21'),_0x219881[_0x8e41('0x22')]),_0x219881);agents['agentcalled'](_0x219881);}catch(_0x21bda8){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x21'),_0x219881[_0x8e41('0x22')]),_0x21bda8);}});ami['on'](_0x8e41('0x23'),function(_0x190a0d){try{utils['debug'](util['format'](_0x8e41('0x24'),_0x190a0d[_0x8e41('0x22')]),_0x190a0d);agents[_0x8e41('0x23')](_0x190a0d);}catch(_0x582499){utils['error'](util[_0x8e41('0x20')](_0x8e41('0x24'),_0x190a0d[_0x8e41('0x22')]),_0x582499);}});ami['on'](_0x8e41('0x25'),function(_0x239c90){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x26'),_0x239c90[_0x8e41('0x22')]),_0x239c90);agents[_0x8e41('0x25')](_0x239c90);queues[_0x8e41('0x25')](_0x239c90);}catch(_0x3cf555){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x26'),_0x239c90[_0x8e41('0x22')]),_0x3cf555);}});ami['on'](_0x8e41('0x27'),function(_0x1cc70b){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x28'),_0x1cc70b['uniqueid']),_0x1cc70b);agents['agentcomplete'](_0x1cc70b);queues[_0x8e41('0x27')](_0x1cc70b);members[_0x8e41('0x27')](_0x1cc70b);}catch(_0x5e36cf){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x28'),_0x1cc70b['uniqueid']),_0x5e36cf);}});ami['on'](_0x8e41('0x29'),function(_0x11e991){try{utils['debug'](util[_0x8e41('0x20')](_0x8e41('0x2a'),_0x11e991[_0x8e41('0x22')]),_0x11e991);agents['queuecallerabandon'](_0x11e991);queues[_0x8e41('0x29')](_0x11e991);}catch(_0x519788){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x11e991['uniqueid']),_0x519788);}});ami['on'](_0x8e41('0x2b'),function(_0x5d47c5){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x2c'),_0x5d47c5[_0x8e41('0x22')]),_0x5d47c5);queues[_0x8e41('0x2b')](_0x5d47c5);recordings['queuecallerjoin'](_0x5d47c5);}catch(_0x1b62e0){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x2c'),_0x5d47c5[_0x8e41('0x22')]),_0x1b62e0);}});ami['on'](_0x8e41('0x2d'),function(_0x5e5e85){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x2e'),_0x5e5e85[_0x8e41('0x22')]),_0x5e5e85);queues[_0x8e41('0x2d')](_0x5e5e85);}catch(_0x3c606c){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x2e'),_0x5e5e85['uniqueid']),_0x3c606c);}});ami['on']('musiconholdstart',function(_0x40d802){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x2f'),_0x40d802[_0x8e41('0x22')]),_0x40d802);queues[_0x8e41('0x30')](_0x40d802);calls[_0x8e41('0x30')](_0x40d802);}catch(_0x608acb){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x2f'),_0x40d802[_0x8e41('0x22')]),_0x608acb);}});ami['on']('musiconholdstop',function(_0x2e2c2d){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x31'),_0x2e2c2d[_0x8e41('0x22')]),_0x2e2c2d);queues[_0x8e41('0x32')](_0x2e2c2d);calls[_0x8e41('0x32')](_0x2e2c2d);}catch(_0x249f0b){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x31'),_0x2e2c2d[_0x8e41('0x22')]),_0x249f0b);}});ami['on'](_0x8e41('0x33'),function(_0x578010){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x34'),_0x578010[_0x8e41('0x22')]),_0x578010);calls['newstate'](_0x578010);recordings['newstate'](_0x578010);}catch(_0x36acf1){utils[_0x8e41('0x18')](util['format'](_0x8e41('0x34'),_0x578010[_0x8e41('0x22')]),_0x36acf1);}});ami['on'](_0x8e41('0x35'),function(_0x842759){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x36'),_0x842759[_0x8e41('0x22')]),_0x842759);calls['hangup'](_0x842759);recordings[_0x8e41('0x35')](_0x842759);dials['hangup'](_0x842759);agents[_0x8e41('0x35')](_0x842759);queues[_0x8e41('0x35')](_0x842759);}catch(_0x2d89b3){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x36'),_0x842759[_0x8e41('0x22')]),_0x2d89b3);}});ami['on'](_0x8e41('0x37'),function(_0x107c0c){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x38'),_0x107c0c['uniqueid']),_0x107c0c);members[_0x8e41('0x37')](_0x107c0c);}catch(_0x2be2cd){utils['error'](util[_0x8e41('0x20')](_0x8e41('0x38'),_0x107c0c[_0x8e41('0x22')]),_0x2be2cd);}});ami['on'](_0x8e41('0x39'),function(_0xe4308e){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x3a'),_0xe4308e[_0x8e41('0x22')]),_0xe4308e);queues[_0x8e41('0x39')](_0xe4308e);agents['blindtransfer'](_0xe4308e);transfers[_0x8e41('0x39')](_0xe4308e);recordings['blindtransfer'](_0xe4308e);}catch(_0x3dab61){utils['error'](util[_0x8e41('0x20')](_0x8e41('0x3a'),_0xe4308e[_0x8e41('0x22')]),_0x3dab61);}});ami['on']('attendedtransfer',function(_0x401b22){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')]('[%s][index][attendedtransfer]',_0x401b22[_0x8e41('0x3b')]),_0x401b22);queues[_0x8e41('0x3c')](_0x401b22);transfers[_0x8e41('0x3c')](_0x401b22);agents[_0x8e41('0x3c')](_0x401b22);calls[_0x8e41('0x3c')](_0x401b22);}catch(_0x216954){utils[_0x8e41('0x18')](util['format']('[%s][index][attendedtransfer]',_0x401b22[_0x8e41('0x3b')]),_0x216954);}});ami['on'](_0x8e41('0x3d'),function(_0x4ce00f){try{utils['debug'](util[_0x8e41('0x20')](_0x8e41('0x3e'),_0x4ce00f[_0x8e41('0x22')]),_0x4ce00f);queues['varset'](_0x4ce00f);recordings[_0x8e41('0x3d')](_0x4ce00f);calls[_0x8e41('0x3d')](_0x4ce00f);dials[_0x8e41('0x3d')](_0x4ce00f);}catch(_0x4a9ded){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x3e'),_0x4ce00f[_0x8e41('0x22')]),_0x4a9ded);}});ami['on'](_0x8e41('0x3f'),function(_0x1a51ad){try{utils['debug'](util[_0x8e41('0x20')](_0x8e41('0x40'),_0x1a51ad['uniqueid']),_0x1a51ad);calls[_0x8e41('0x3f')](_0x1a51ad);recordings[_0x8e41('0x3f')](_0x1a51ad);dials['newexten'](_0x1a51ad);}catch(_0x86acea){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x40'),_0x1a51ad[_0x8e41('0x22')]),_0x86acea);}});ami['on'](_0x8e41('0x41'),function(_0x31b1ee){try{utils['debug'](util[_0x8e41('0x20')](_0x8e41('0x42'),_0x31b1ee[_0x8e41('0x22')]),_0x31b1ee);calls[_0x8e41('0x41')](_0x31b1ee);recordings[_0x8e41('0x41')](_0x31b1ee);}catch(_0x4979fb){utils[_0x8e41('0x18')](util['format'](_0x8e41('0x42'),_0x31b1ee[_0x8e41('0x22')]),_0x4979fb);}});ami['on'](_0x8e41('0x43'),function(_0x471729){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')](_0x8e41('0x44'),_0x471729['uniqueid']),_0x471729);dials[_0x8e41('0x43')](_0x471729);}catch(_0x5028da){utils['error'](util[_0x8e41('0x20')](_0x8e41('0x45'),_0x471729[_0x8e41('0x22')]),_0x5028da);}});ami['on'](_0x8e41('0x46'),function(_0x41df3e){try{utils[_0x8e41('0x1f')](util[_0x8e41('0x20')]('[%s][index][dialend]',_0x41df3e[_0x8e41('0x22')]),_0x41df3e);dials[_0x8e41('0x46')](_0x41df3e);}catch(_0x1aeab8){utils[_0x8e41('0x18')](util[_0x8e41('0x20')](_0x8e41('0x47'),_0x41df3e[_0x8e41('0x22')]),_0x1aeab8);}});} \ No newline at end of file +var _0x98b7=['dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','port','username','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x98b7,0xd7));var _0x798b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x98b7[_0x2c91e9];return _0x13f0ff;};var AsteriskManager=require(_0x798b('0x0'));var config=require(_0x798b('0x1'));var utils=require(_0x798b('0x2'));var util=require(_0x798b('0x3'));var isXDREnabled=config['xdr']&&config[_0x798b('0x4')][_0x798b('0x5')]?!config['xdr'][_0x798b('0x5')]:!![];var isProduction=config[_0x798b('0x6')]===_0x798b('0x7')||![];var isLocalAsterisk=config[_0x798b('0x4')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x798b('0x8')][_0x798b('0x9')],config['asterisk']['ip'],config[_0x798b('0x8')][_0x798b('0xa')],config[_0x798b('0x8')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x798b('0xb')](_0x798b('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x798b('0xb')](_0x798b('0xd'));}else{var agents=require(_0x798b('0xe'));var calls=require(_0x798b('0xf'));var queues=require(_0x798b('0x10'));var recordings=require(_0x798b('0x11'));var members=require('./members.controller');var dials=require(_0x798b('0x12'));var transfers=require(_0x798b('0x13'));var core=require(_0x798b('0x14'));ami['on'](_0x798b('0x15'),core[_0x798b('0x15')]);ami['on'](_0x798b('0x16'),core['shutdown']);ami['on'](_0x798b('0x17'),core[_0x798b('0x17')]);ami['on'](_0x798b('0x18'),core[_0x798b('0x18')]);ami['on'](_0x798b('0x19'),core[_0x798b('0x19')]);ami['on'](_0x798b('0x1a'),core[_0x798b('0x1a')]);ami['on']('devicestatechange',function(_0x41ddda){try{utils['debug'](util[_0x798b('0x1b')](_0x798b('0x1c'),_0x41ddda['device']),_0x41ddda);members['devicestatechange'](_0x41ddda);}catch(_0x777ac1){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x1c'),_0x41ddda[_0x798b('0x1d')]),_0x777ac1);}});ami['on'](_0x798b('0x1e'),function(_0x9b7686){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')](_0x798b('0x20'),_0x9b7686[_0x798b('0x21')]),_0x9b7686);agents['agentcalled'](_0x9b7686);}catch(_0x3268fc){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x20'),_0x9b7686[_0x798b('0x21')]),_0x3268fc);}});ami['on']('agentringnoanswer',function(_0x48c20f){try{utils[_0x798b('0x1f')](util['format'](_0x798b('0x22'),_0x48c20f[_0x798b('0x21')]),_0x48c20f);agents[_0x798b('0x23')](_0x48c20f);}catch(_0xc8c3fa){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x22'),_0x48c20f[_0x798b('0x21')]),_0xc8c3fa);}});ami['on'](_0x798b('0x24'),function(_0x293f89){try{utils['debug'](util[_0x798b('0x1b')]('[%s][index][agentconnect]',_0x293f89[_0x798b('0x21')]),_0x293f89);agents[_0x798b('0x24')](_0x293f89);queues[_0x798b('0x24')](_0x293f89);}catch(_0xca34ba){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x25'),_0x293f89[_0x798b('0x21')]),_0xca34ba);}});ami['on'](_0x798b('0x26'),function(_0x2d48fc){try{utils[_0x798b('0x1f')](util['format'](_0x798b('0x27'),_0x2d48fc['uniqueid']),_0x2d48fc);agents[_0x798b('0x26')](_0x2d48fc);queues[_0x798b('0x26')](_0x2d48fc);members[_0x798b('0x26')](_0x2d48fc);}catch(_0x130682){utils['error'](util[_0x798b('0x1b')](_0x798b('0x27'),_0x2d48fc[_0x798b('0x21')]),_0x130682);}});ami['on'](_0x798b('0x28'),function(_0x500ae6){try{utils['debug'](util['format'](_0x798b('0x29'),_0x500ae6['uniqueid']),_0x500ae6);agents[_0x798b('0x28')](_0x500ae6);queues[_0x798b('0x28')](_0x500ae6);}catch(_0x226ddb){utils[_0x798b('0x18')](util[_0x798b('0x1b')]('[%s][index][queuecallerabandon]',_0x500ae6[_0x798b('0x21')]),_0x226ddb);}});ami['on'](_0x798b('0x2a'),function(_0x547895){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')]('[%s][index][queuecallerjoin]',_0x547895['uniqueid']),_0x547895);queues[_0x798b('0x2a')](_0x547895);recordings[_0x798b('0x2a')](_0x547895);}catch(_0x466fd5){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x2b'),_0x547895['uniqueid']),_0x466fd5);}});ami['on'](_0x798b('0x2c'),function(_0x1fbd68){try{utils['debug'](util['format'](_0x798b('0x2d'),_0x1fbd68[_0x798b('0x21')]),_0x1fbd68);queues[_0x798b('0x2c')](_0x1fbd68);}catch(_0x4dd824){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x2d'),_0x1fbd68[_0x798b('0x21')]),_0x4dd824);}});ami['on']('musiconholdstart',function(_0x474b60){try{utils[_0x798b('0x1f')](util['format'](_0x798b('0x2e'),_0x474b60[_0x798b('0x21')]),_0x474b60);queues[_0x798b('0x2f')](_0x474b60);calls[_0x798b('0x2f')](_0x474b60);}catch(_0x25836c){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x2e'),_0x474b60[_0x798b('0x21')]),_0x25836c);}});ami['on']('musiconholdstop',function(_0x433199){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')](_0x798b('0x30'),_0x433199[_0x798b('0x21')]),_0x433199);queues[_0x798b('0x31')](_0x433199);calls['musiconholdstop'](_0x433199);}catch(_0x4c48c1){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x30'),_0x433199[_0x798b('0x21')]),_0x4c48c1);}});ami['on'](_0x798b('0x32'),function(_0x5f1ad0){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')](_0x798b('0x33'),_0x5f1ad0['uniqueid']),_0x5f1ad0);calls[_0x798b('0x32')](_0x5f1ad0);recordings['newstate'](_0x5f1ad0);}catch(_0x6f0705){utils[_0x798b('0x18')](util['format'](_0x798b('0x33'),_0x5f1ad0[_0x798b('0x21')]),_0x6f0705);}});ami['on']('hangup',function(_0x37aed6){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')](_0x798b('0x34'),_0x37aed6['uniqueid']),_0x37aed6);calls['hangup'](_0x37aed6);recordings[_0x798b('0x35')](_0x37aed6);dials[_0x798b('0x35')](_0x37aed6);agents[_0x798b('0x35')](_0x37aed6);queues[_0x798b('0x35')](_0x37aed6);}catch(_0x3eb8e1){utils['error'](util[_0x798b('0x1b')](_0x798b('0x34'),_0x37aed6[_0x798b('0x21')]),_0x3eb8e1);}});ami['on'](_0x798b('0x36'),function(_0x529012){try{utils[_0x798b('0x1f')](util['format']('[%s][index][cdr]',_0x529012[_0x798b('0x21')]),_0x529012);members['cdr'](_0x529012);}catch(_0x2731c0){utils[_0x798b('0x18')](util[_0x798b('0x1b')]('[%s][index][cdr]',_0x529012[_0x798b('0x21')]),_0x2731c0);}});ami['on'](_0x798b('0x37'),function(_0x3d0cea){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')](_0x798b('0x38'),_0x3d0cea['uniqueid']),_0x3d0cea);queues[_0x798b('0x37')](_0x3d0cea);agents['blindtransfer'](_0x3d0cea);transfers['blindtransfer'](_0x3d0cea);recordings['blindtransfer'](_0x3d0cea);}catch(_0x2ab4d7){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x38'),_0x3d0cea[_0x798b('0x21')]),_0x2ab4d7);}});ami['on'](_0x798b('0x39'),function(_0x21a9be){try{utils['debug'](util[_0x798b('0x1b')]('[%s][index][attendedtransfer]',_0x21a9be[_0x798b('0x3a')]),_0x21a9be);queues[_0x798b('0x39')](_0x21a9be);transfers[_0x798b('0x39')](_0x21a9be);agents[_0x798b('0x39')](_0x21a9be);calls[_0x798b('0x39')](_0x21a9be);}catch(_0x3ba9db){utils[_0x798b('0x18')](util[_0x798b('0x1b')]('[%s][index][attendedtransfer]',_0x21a9be[_0x798b('0x3a')]),_0x3ba9db);}});ami['on'](_0x798b('0x3b'),function(_0x4abcfb){try{utils[_0x798b('0x1f')](util['format'](_0x798b('0x3c'),_0x4abcfb[_0x798b('0x21')]),_0x4abcfb);queues['varset'](_0x4abcfb);recordings[_0x798b('0x3b')](_0x4abcfb);calls[_0x798b('0x3b')](_0x4abcfb);dials[_0x798b('0x3b')](_0x4abcfb);}catch(_0x6e12b0){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x3c'),_0x4abcfb[_0x798b('0x21')]),_0x6e12b0);}});ami['on'](_0x798b('0x3d'),function(_0x1f5fe4){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')]('[%s][index][newexten]',_0x1f5fe4[_0x798b('0x21')]),_0x1f5fe4);calls[_0x798b('0x3d')](_0x1f5fe4);recordings[_0x798b('0x3d')](_0x1f5fe4);dials[_0x798b('0x3d')](_0x1f5fe4);}catch(_0x4e2dd4){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x3e'),_0x1f5fe4[_0x798b('0x21')]),_0x4e2dd4);}});ami['on'](_0x798b('0x3f'),function(_0x1ac653){try{utils['debug'](util[_0x798b('0x1b')](_0x798b('0x40'),_0x1ac653[_0x798b('0x21')]),_0x1ac653);calls[_0x798b('0x3f')](_0x1ac653);recordings['newchannel'](_0x1ac653);}catch(_0x33a032){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x40'),_0x1ac653['uniqueid']),_0x33a032);}});ami['on'](_0x798b('0x41'),function(_0x4dda01){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')](_0x798b('0x42'),_0x4dda01['uniqueid']),_0x4dda01);dials['dialbegin'](_0x4dda01);}catch(_0x4bb4f1){utils[_0x798b('0x18')](util[_0x798b('0x1b')](_0x798b('0x43'),_0x4dda01[_0x798b('0x21')]),_0x4bb4f1);}});ami['on'](_0x798b('0x44'),function(_0x1235f4){try{utils[_0x798b('0x1f')](util[_0x798b('0x1b')](_0x798b('0x45'),_0x1235f4[_0x798b('0x21')]),_0x1235f4);dials[_0x798b('0x44')](_0x1235f4);}catch(_0x16589c){utils[_0x798b('0x18')](util['format'](_0x798b('0x45'),_0x1235f4[_0x798b('0x21')]),_0x16589c);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index dcd49d6..4d3eadf 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 _0x00d6=['info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','then','membername','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','some','startsWith','[%s][members][devicestatechange]','device','state','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','debug','[%s][members][cdr]','assign','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:'];(function(_0x39cccb,_0x10d5e4){var _0x2a2a81=function(_0x31cea8){while(--_0x31cea8){_0x39cccb['push'](_0x39cccb['shift']());}};_0x2a2a81(++_0x10d5e4);}(_0x00d6,0x1e5));var _0x600d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x00d6[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x600d('0x0'));var util=require(_0x600d('0x1'));var utils=require(_0x600d('0x2'));var members={};var exclude=[_0x600d('0x3'),_0x600d('0x4')];function writeDB(_0x255be3){utils[_0x600d('0x5')](util[_0x600d('0x6')](_0x600d('0x7'),_0x255be3[_0x600d('0x8')],_0x255be3[_0x600d('0x9')],_0x255be3[_0x600d('0xa')],_0x255be3[_0x600d('0xb')],_0x255be3['membername'],_0x255be3['type']));if(_0x255be3[_0x600d('0x9')]){utils['getUserByInterface'](_0x255be3[_0x600d('0x9')])[_0x600d('0xc')](function(_0x150acd){if(_0x150acd){_0x255be3[_0x600d('0xd')]=_0x150acd[_0x600d('0xe')];_0x255be3[_0x600d('0xf')]=_0x150acd[_0x600d('0xf')];utils[_0x600d('0x10')]('CreateMemberReport',_0x255be3);}else{utils[_0x600d('0x11')](_0x255be3[_0x600d('0x9')][_0x600d('0x12')]('/')[0x1])[_0x600d('0xc')](function(_0x1f23ee){if(_0x1f23ee){_0x255be3['membername']=_0x1f23ee['name'];_0x255be3[_0x600d('0xf')]=_0x1f23ee[_0x600d('0xf')];utils[_0x600d('0x10')](_0x600d('0x13'),_0x255be3);}});}})[_0x600d('0x14')](function(_0x207862){utils[_0x600d('0x15')](util[_0x600d('0x6')]('[%s][members][writeDB]',_0x255be3[_0x600d('0x8')]),_0x207862);});}delete members[_0x255be3[_0x600d('0x9')]];}function startsWith(_0xe9a89a,_0x15c76d){return _[_0x600d('0x16')](_0xe9a89a,function(_0x484cbd){return _[_0x600d('0x17')](_0x15c76d,_0x484cbd);});}exports['devicestatechange']=function(_0x35fd38){try{utils['debug'](util[_0x600d('0x6')](_0x600d('0x18'),members[_0x35fd38[_0x600d('0x19')]]?members[_0x35fd38[_0x600d('0x19')]][_0x600d('0x8')]:_0x35fd38['device']),_0x35fd38);utils['info'](util[_0x600d('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x35fd38['device']]?members[_0x35fd38[_0x600d('0x19')]]['uniqueid']:_0x35fd38[_0x600d('0x19')],_0x35fd38[_0x600d('0x1a')],_0x35fd38['device']));switch(_0x35fd38[_0x600d('0x1a')]){case'INUSE':case _0x600d('0x1b'):if(!startsWith(exclude,_0x35fd38[_0x600d('0x19')])){members[_0x35fd38['device']]={'channel':'voice','interface':_0x35fd38['device'],'type':_0x600d('0x1c'),'enterAt':utils[_0x600d('0x1d')](),'role':_0x600d('0x1e')};}break;case _0x600d('0x1f'):if(!_[_0x600d('0x20')](members[_0x35fd38['device']])){members[_0x35fd38['device']][_0x600d('0x21')]=utils[_0x600d('0x1d')]();members[_0x35fd38[_0x600d('0x19')]][_0x600d('0x22')]=utils['diffTime'](members[_0x35fd38[_0x600d('0x19')]]['exitAt'],members[_0x35fd38[_0x600d('0x19')]][_0x600d('0x23')]);if(members[_0x35fd38[_0x600d('0x19')]][_0x600d('0x8')]){writeDB(members[_0x35fd38['device']]);}}break;default:break;}}catch(_0x286153){utils[_0x600d('0x15')](util[_0x600d('0x6')](_0x600d('0x18'),members[_0x35fd38[_0x600d('0x19')]]?members[_0x35fd38[_0x600d('0x19')]]['uniqueid']:_0x35fd38['device']),_0x286153);}};exports['agentcomplete']=function(_0x569379){try{if(!_[_0x600d('0x20')](members[_0x569379['interface']])){utils['debug'](util[_0x600d('0x6')]('[%s][members][agentcomplete]',_0x569379['uniqueid']),_0x569379);utils[_0x600d('0x5')](util[_0x600d('0x6')](_0x600d('0x24'),_0x569379[_0x600d('0x8')],_0x569379[_0x600d('0x9')],_0x569379[_0x600d('0x25')]));members[_0x569379[_0x600d('0x9')]]=_['assign'](members[_0x569379[_0x600d('0x9')]],{'data4':_0x569379[_0x600d('0x25')],'uniqueid':_0x569379['uniqueid']});}}catch(_0xefb8c4){utils[_0x600d('0x15')](util[_0x600d('0x6')]('[%s][members][agentcomplete]',_0x569379[_0x600d('0x8')]),_0xefb8c4);}};exports[_0x600d('0x26')]=function(_0x403030){try{utils[_0x600d('0x27')](util[_0x600d('0x6')](_0x600d('0x28'),_0x403030[_0x600d('0x8')]),_0x403030);if(_0x403030[_0x600d('0xa')]){var _0x21fb3d=_0x403030[_0x600d('0xa')][_0x600d('0x12')]('-')[0x0];if(!_['isNil'](members[_0x21fb3d])){members[_0x21fb3d]=_[_0x600d('0x29')](members[_0x21fb3d],{'data1':members[_0x21fb3d][_0x600d('0x2a')]||_0x403030[_0x600d('0x2b')],'data2':members[_0x21fb3d][_0x600d('0xb')]||_0x403030[_0x600d('0x2c')],'data3':members[_0x21fb3d][_0x600d('0x2d')]||_0x403030[_0x600d('0x2e')],'uniqueid':members[_0x21fb3d][_0x600d('0x8')]||_0x403030['uniqueid']});utils['info'](util[_0x600d('0x6')](_0x600d('0x2f'),_0x403030['uniqueid'],members[_0x21fb3d][_0x600d('0x2a')],members[_0x21fb3d][_0x600d('0xb')],members[_0x21fb3d]['data3']));if(members[_0x21fb3d][_0x600d('0x21')]){writeDB(members[_0x21fb3d]);}}}if(_0x403030[_0x600d('0x30')]){var _0x2b577a=_0x403030[_0x600d('0x30')]['split']('-')[0x0];if(!_[_0x600d('0x20')](members[_0x2b577a])){members[_0x2b577a]=_['assign'](members[_0x2b577a],{'data1':members[_0x2b577a][_0x600d('0x2a')]||_0x403030['type'],'data2':members[_0x2b577a]['data2']||_0x403030[_0x600d('0x2c')],'data3':members[_0x2b577a][_0x600d('0x2d')]||_0x403030['destination'],'uniqueid':members[_0x2b577a][_0x600d('0x8')]||_0x403030[_0x600d('0x8')]});utils[_0x600d('0x5')](util[_0x600d('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x403030[_0x600d('0x8')],members[_0x2b577a][_0x600d('0x2a')],members[_0x2b577a][_0x600d('0xb')],members[_0x2b577a][_0x600d('0x2d')]));if(members[_0x2b577a][_0x600d('0x21')]){writeDB(members[_0x2b577a]);}}}}catch(_0x251097){utils['error'](util[_0x600d('0x6')](_0x600d('0x28'),_0x403030[_0x600d('0x8')]),_0x251097);}}; \ No newline at end of file +var _0x81dc=['cdr','assign','data1','source','data3','destination','data2','destinationchannel','type','util','./utils','Local/_attended@transfer','Queue:','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','membername','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','[%s][members][writeDB]','devicestatechange','debug','format','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','diffTime','enterAt','error','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue'];(function(_0x353bbb,_0x56e1ab){var _0x4e6a0e=function(_0x2e1703){while(--_0x2e1703){_0x353bbb['push'](_0x353bbb['shift']());}};_0x4e6a0e(++_0x56e1ab);}(_0x81dc,0x1e9));var _0xc81d=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x81dc[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require('lodash');var util=require(_0xc81d('0x0'));var utils=require(_0xc81d('0x1'));var members={};var exclude=[_0xc81d('0x2'),_0xc81d('0x3')];function writeDB(_0x42b9a8){utils['info'](util['format'](_0xc81d('0x4'),_0x42b9a8[_0xc81d('0x5')],_0x42b9a8['interface'],_0x42b9a8[_0xc81d('0x6')],_0x42b9a8['data2'],_0x42b9a8[_0xc81d('0x7')],_0x42b9a8['type']));if(_0x42b9a8[_0xc81d('0x8')]){utils[_0xc81d('0x9')](_0x42b9a8[_0xc81d('0x8')])[_0xc81d('0xa')](function(_0x5c1dc5){if(_0x5c1dc5){_0x42b9a8[_0xc81d('0x7')]=_0x5c1dc5[_0xc81d('0xb')];_0x42b9a8[_0xc81d('0xc')]=_0x5c1dc5[_0xc81d('0xc')];utils[_0xc81d('0xd')](_0xc81d('0xe'),_0x42b9a8);}else{utils[_0xc81d('0xf')](_0x42b9a8[_0xc81d('0x8')][_0xc81d('0x10')]('/')[0x1])['then'](function(_0x16325e){if(_0x16325e){_0x42b9a8[_0xc81d('0x7')]=_0x16325e[_0xc81d('0xb')];_0x42b9a8['internal']=_0x16325e[_0xc81d('0xc')];utils['request'](_0xc81d('0xe'),_0x42b9a8);}});}})['catch'](function(_0x508047){utils['error'](util['format'](_0xc81d('0x11'),_0x42b9a8[_0xc81d('0x5')]),_0x508047);});}delete members[_0x42b9a8[_0xc81d('0x8')]];}function startsWith(_0x47856e,_0x25d574){return _['some'](_0x47856e,function(_0x329b86){return _['startsWith'](_0x25d574,_0x329b86);});}exports[_0xc81d('0x12')]=function(_0x4f2f26){try{utils[_0xc81d('0x13')](util[_0xc81d('0x14')]('[%s][members][devicestatechange]',members[_0x4f2f26['device']]?members[_0x4f2f26[_0xc81d('0x15')]][_0xc81d('0x5')]:_0x4f2f26['device']),_0x4f2f26);utils['info'](util[_0xc81d('0x14')](_0xc81d('0x16'),members[_0x4f2f26[_0xc81d('0x15')]]?members[_0x4f2f26['device']]['uniqueid']:_0x4f2f26['device'],_0x4f2f26[_0xc81d('0x17')],_0x4f2f26[_0xc81d('0x15')]));switch(_0x4f2f26['state']){case _0xc81d('0x18'):case _0xc81d('0x19'):if(!startsWith(exclude,_0x4f2f26[_0xc81d('0x15')])){members[_0x4f2f26[_0xc81d('0x15')]]={'channel':_0xc81d('0x1a'),'interface':_0x4f2f26['device'],'type':_0xc81d('0x1b'),'enterAt':utils[_0xc81d('0x1c')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0xc81d('0x1d')](members[_0x4f2f26['device']])){members[_0x4f2f26[_0xc81d('0x15')]][_0xc81d('0x1e')]=utils[_0xc81d('0x1c')]();members[_0x4f2f26[_0xc81d('0x15')]][_0xc81d('0x1f')]=utils[_0xc81d('0x20')](members[_0x4f2f26[_0xc81d('0x15')]]['exitAt'],members[_0x4f2f26['device']][_0xc81d('0x21')]);if(members[_0x4f2f26[_0xc81d('0x15')]][_0xc81d('0x5')]){writeDB(members[_0x4f2f26[_0xc81d('0x15')]]);}}break;default:break;}}catch(_0x18ab23){utils[_0xc81d('0x22')](util[_0xc81d('0x14')]('[%s][members][devicestatechange]',members[_0x4f2f26[_0xc81d('0x15')]]?members[_0x4f2f26['device']][_0xc81d('0x5')]:_0x4f2f26[_0xc81d('0x15')]),_0x18ab23);}};exports['agentcomplete']=function(_0x53e829){try{if(!_['isNil'](members[_0x53e829[_0xc81d('0x8')]])){utils[_0xc81d('0x13')](util['format'](_0xc81d('0x23'),_0x53e829[_0xc81d('0x5')]),_0x53e829);utils[_0xc81d('0x24')](util['format'](_0xc81d('0x25'),_0x53e829[_0xc81d('0x5')],_0x53e829[_0xc81d('0x8')],_0x53e829[_0xc81d('0x26')]));members[_0x53e829['interface']]=_['assign'](members[_0x53e829['interface']],{'data4':_0x53e829[_0xc81d('0x26')],'uniqueid':_0x53e829[_0xc81d('0x5')]});}}catch(_0x2d1a4d){utils[_0xc81d('0x22')](util['format'](_0xc81d('0x23'),_0x53e829[_0xc81d('0x5')]),_0x2d1a4d);}};exports[_0xc81d('0x27')]=function(_0x2090c1){try{utils[_0xc81d('0x13')](util[_0xc81d('0x14')]('[%s][members][cdr]',_0x2090c1[_0xc81d('0x5')]),_0x2090c1);if(_0x2090c1[_0xc81d('0x6')]){var _0x5166fc=_0x2090c1[_0xc81d('0x6')]['split']('-')[0x0];if(!_[_0xc81d('0x1d')](members[_0x5166fc])){members[_0x5166fc]=_[_0xc81d('0x28')](members[_0x5166fc],{'data1':members[_0x5166fc][_0xc81d('0x29')]||_0x2090c1['type'],'data2':members[_0x5166fc]['data2']||_0x2090c1[_0xc81d('0x2a')],'data3':members[_0x5166fc][_0xc81d('0x2b')]||_0x2090c1[_0xc81d('0x2c')],'uniqueid':members[_0x5166fc]['uniqueid']||_0x2090c1['uniqueid']});utils[_0xc81d('0x24')](util[_0xc81d('0x14')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2090c1[_0xc81d('0x5')],members[_0x5166fc][_0xc81d('0x29')],members[_0x5166fc][_0xc81d('0x2d')],members[_0x5166fc][_0xc81d('0x2b')]));if(members[_0x5166fc][_0xc81d('0x1e')]){writeDB(members[_0x5166fc]);}}}if(_0x2090c1[_0xc81d('0x2e')]){var _0x4bef4a=_0x2090c1[_0xc81d('0x2e')][_0xc81d('0x10')]('-')[0x0];if(!_[_0xc81d('0x1d')](members[_0x4bef4a])){members[_0x4bef4a]=_[_0xc81d('0x28')](members[_0x4bef4a],{'data1':members[_0x4bef4a][_0xc81d('0x29')]||_0x2090c1[_0xc81d('0x2f')],'data2':members[_0x4bef4a][_0xc81d('0x2d')]||_0x2090c1[_0xc81d('0x2a')],'data3':members[_0x4bef4a][_0xc81d('0x2b')]||_0x2090c1[_0xc81d('0x2c')],'uniqueid':members[_0x4bef4a]['uniqueid']||_0x2090c1[_0xc81d('0x5')]});utils[_0xc81d('0x24')](util[_0xc81d('0x14')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2090c1[_0xc81d('0x5')],members[_0x4bef4a][_0xc81d('0x29')],members[_0x4bef4a]['data2'],members[_0x4bef4a]['data3']));if(members[_0x4bef4a][_0xc81d('0x1e')]){writeDB(members[_0x4bef4a]);}}}}catch(_0x132b5d){utils[_0xc81d('0x22')](util[_0xc81d('0x14')]('[%s][members][cdr]',_0x2090c1[_0xc81d('0x5')]),_0x132b5d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 28835de..a6b8aa3 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 _0x13bf=['request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','origtransfererlinkedid','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','then','type'];(function(_0x516a8c,_0x3446a1){var _0x305378=function(_0x5b1698){while(--_0x5b1698){_0x516a8c['push'](_0x516a8c['shift']());}};_0x305378(++_0x3446a1);}(_0x13bf,0x184));var _0xf13b=function(_0x2f71b0,_0x5027cc){_0x2f71b0=_0x2f71b0-0x0;var _0x49e237=_0x13bf[_0x2f71b0];return _0x49e237;};'use strict';var _=require('lodash');var util=require(_0xf13b('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x3280a2){utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x3'),_0x3280a2[_0xf13b('0x4')],_0x3280a2[_0xf13b('0x5')],_0x3280a2[_0xf13b('0x6')],_0x3280a2['lastAssignedTo'],_0x3280a2[_0xf13b('0x7')],_0x3280a2[_0xf13b('0x8')],_0x3280a2[_0xf13b('0x9')]));if(_0x3280a2[_0xf13b('0x6')]){utils['getVoiceQueueByName'](_0x3280a2[_0xf13b('0x6')])[_0xf13b('0xa')](function(_0xf6ab39){if(_0xf6ab39){_0x3280a2['type']=_0xf6ab39[_0xf13b('0xb')];}utils[_0xf13b('0xc')](_0xf13b('0xd'),_0x3280a2);});}else{utils['request'](_0xf13b('0xd'),_0x3280a2);}if(_0x3280a2[_0xf13b('0xe')]){delete queues[_0x3280a2['transfereduniqueid']];}else{delete queues[_0x3280a2[_0xf13b('0x4')]];}}exports['queuecallerjoin']=function(_0x39c0fa){try{utils[_0xf13b('0xf')](util['format']('[%s][queues][queuecallerjoin]',_0x39c0fa[_0xf13b('0x4')]),_0x39c0fa);utils['info'](util['format'](_0xf13b('0x10'),_0x39c0fa[_0xf13b('0x4')],_0x39c0fa[_0xf13b('0x6')],_0x39c0fa[_0xf13b('0x11')]));queues[_0x39c0fa[_0xf13b('0x4')]]=_['assign'](_0x39c0fa,{'originalposition':_0x39c0fa['position'],'queuecallerjoinAt':utils[_0xf13b('0x12')](),'mohtime':0x0});}catch(_0x9e5334){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x14'),_0x39c0fa[_0xf13b('0x4')]),_0x9e5334);}};exports['hangup']=function(_0x126439){try{if(!_['isNil'](queues[_0x126439[_0xf13b('0x4')]])){utils['debug'](util['format'](_0xf13b('0x15'),_0x126439[_0xf13b('0x4')]),_0x126439);if(queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x16')]){if(!queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x17')]&&!queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x18')]){queues[_0x126439[_0xf13b('0x4')]]['queuecallercomplete']=!![];queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x19')]=utils[_0xf13b('0x12')]();queues[_0x126439['uniqueid']][_0xf13b('0x9')]=_0xf13b('0x1a');}utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x1b'),_0x126439['uniqueid'],queues[_0x126439['uniqueid']][_0xf13b('0x1c')],queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x9')]));writeDB(queues[_0x126439[_0xf13b('0x4')]]);}else if(queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0xe')]){utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x1d'),_0x126439[_0xf13b('0x4')],queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0x1c')],queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0xe')]));queues[queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0xe')]]=queues[_0x126439['uniqueid']];queues[queues[_0x126439[_0xf13b('0x4')]][_0xf13b('0xe')]][_0xf13b('0x1e')]=0x2;delete queues[_0x126439[_0xf13b('0x4')]];}}}catch(_0x3a7df5){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x15'),_0x126439[_0xf13b('0x4')]),_0x3a7df5);}};exports[_0xf13b('0x1f')]=function(_0x3b91be){try{utils[_0xf13b('0xf')](util['format'](_0xf13b('0x20'),_0x3b91be['uniqueid']),_0x3b91be);if(!_[_0xf13b('0x21')](_0x3b91be[_0xf13b('0x22')][_0xf13b('0x23')])&&_0x3b91be[_0xf13b('0x24')][_0xf13b('0x25')]()!==_0xf13b('0x26')){if(!_[_0xf13b('0x21')](queues[_0x3b91be[_0xf13b('0x4')]])){queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x17')]=![];queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x27')]=null;queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x18')]=!![];queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x28')]=utils[_0xf13b('0x12')]();queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x9')]=_0x3b91be[_0xf13b('0x24')]['toUpperCase']();utils[_0xf13b('0x1')](util['format'](_0xf13b('0x29'),_0x3b91be[_0xf13b('0x4')],queues[_0x3b91be['uniqueid']][_0xf13b('0x1c')],_0x3b91be[_0xf13b('0x24')],queues[_0x3b91be['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x3b91be[_0xf13b('0x4')]]);}}else if(!_['isNil'](_0x3b91be[_0xf13b('0x22')]['queueposition'])){if(!_[_0xf13b('0x21')](queues[_0x3b91be[_0xf13b('0x4')]])&&!queues[_0x3b91be['uniqueid']][_0xf13b('0x17')]){queues[_0x3b91be['uniqueid']][_0xf13b('0x17')]=![];queues[_0x3b91be['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3b91be['uniqueid']][_0xf13b('0x18')]=!![];queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x28')]=utils[_0xf13b('0x12')]();queues[_0x3b91be[_0xf13b('0x4')]]['queuecallerexitreason']=_0xf13b('0x2a');utils['info'](util[_0xf13b('0x2')](_0xf13b('0x2b'),_0x3b91be[_0xf13b('0x4')],queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x1c')],_0x3b91be[_0xf13b('0x24')],queues[_0x3b91be[_0xf13b('0x4')]][_0xf13b('0x9')]));}}}catch(_0x518079){utils['error'](util[_0xf13b('0x2')](_0xf13b('0x20'),_0x3b91be[_0xf13b('0x4')]),_0x518079);}};exports[_0xf13b('0x17')]=function(_0x29e939){try{if(!_[_0xf13b('0x21')](queues[_0x29e939[_0xf13b('0x4')]])){utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x2c'),_0x29e939[_0xf13b('0x4')]),_0x29e939);queues[_0x29e939[_0xf13b('0x4')]][_0xf13b('0x18')]=![];queues[_0x29e939[_0xf13b('0x4')]][_0xf13b('0x28')]=null;queues[_0x29e939['uniqueid']][_0xf13b('0x17')]=!![];queues[_0x29e939['uniqueid']][_0xf13b('0x27')]=utils['now']();queues[_0x29e939[_0xf13b('0x4')]][_0xf13b('0x9')]='ABANDONED';utils['info'](util['format'](_0xf13b('0x2d'),_0x29e939[_0xf13b('0x4')],queues[_0x29e939[_0xf13b('0x4')]]['name'],queues[_0x29e939[_0xf13b('0x4')]][_0xf13b('0x9')]));}}catch(_0x2e5d84){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x2c'),_0x29e939['uniqueid']),_0x2e5d84);}};exports[_0xf13b('0x2e')]=function(_0x3dd169){try{if(!_[_0xf13b('0x21')](queues[_0x3dd169[_0xf13b('0x4')]])){utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x2f'),_0x3dd169['uniqueid']),_0x3dd169);utils[_0xf13b('0x1')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3dd169['uniqueid'],queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x1c')],_0x3dd169['connectedlinenum'],_0x3dd169[_0xf13b('0x30')]));queues[_0x3dd169[_0xf13b('0x4')]]['queuecallerleave']=!![];queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x16')]=utils[_0xf13b('0x12')]();queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x31')]=utils[_0xf13b('0x32')](queues[_0x3dd169['uniqueid']][_0xf13b('0x16')],queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x33')]);queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x11')]=_0x3dd169['position'];queues[_0x3dd169[_0xf13b('0x4')]][_0xf13b('0x34')]=_0x3dd169[_0xf13b('0x34')];queues[_0x3dd169['uniqueid']][_0xf13b('0x35')]=_0x3dd169[_0xf13b('0x35')];queues[_0x3dd169['uniqueid']]['connectedlinename']=_0x3dd169[_0xf13b('0x30')];}}catch(_0x1470b2){utils[_0xf13b('0x13')](util[_0xf13b('0x2')]('[%s][queues][queuecallerleave]',_0x3dd169[_0xf13b('0x4')]),_0x1470b2);}};exports[_0xf13b('0x36')]=function(_0x133fef){try{if(!_['isNil'](queues[_0x133fef[_0xf13b('0x4')]])){utils[_0xf13b('0xf')](util['format'](_0xf13b('0x37'),_0x133fef['uniqueid']),_0x133fef);utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x38'),_0x133fef[_0xf13b('0x4')],queues[_0x133fef[_0xf13b('0x4')]]['name'],_0x133fef[_0xf13b('0x39')],_0x133fef[_0xf13b('0x3a')]));queues[_0x133fef['uniqueid']]['queuecallerabandon']=![];queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x17')]=![];queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x27')]=null;queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x18')]=![];queues[_0x133fef[_0xf13b('0x4')]]['queuecallerexitreason']=null;queues[_0x133fef[_0xf13b('0x4')]]['queuecallerexitAt']=null;queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x3b')]=!![];queues[_0x133fef[_0xf13b('0x4')]]['accountcode']=_0x133fef['destaccountcode'];queues[_0x133fef[_0xf13b('0x4')]][_0xf13b('0x3c')]=_0x133fef[_0xf13b('0x39')];}}catch(_0x266edc){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x37'),_0x133fef[_0xf13b('0x4')]),_0x266edc);}};exports[_0xf13b('0x3d')]=function(_0x53273d){try{if(!_['isNil'](queues[_0x53273d['uniqueid']])){if(queues[_0x53273d[_0xf13b('0x4')]]['queuecallerleaveAt']){utils[_0xf13b('0xf')](util[_0xf13b('0x2')]('[%s][queues][agentcomplete]',_0x53273d[_0xf13b('0x4')]),_0x53273d);queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x17')]=![];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x17')]=![];queues[_0x53273d['uniqueid']]['queuecallerabandonAt']=null;queues[_0x53273d[_0xf13b('0x4')]]['queuecallerexit']=![];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x28')]=null;queues[_0x53273d['uniqueid']]['assigned']=!![];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x3c')]=_0x53273d['membername'];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x3e')]=!![];queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x19')]=utils['now']();if(_0x53273d[_0xf13b('0x3f')]==_0xf13b('0x40')){if(!queues[_0x53273d['uniqueid']][_0xf13b('0x40')]){queues[_0x53273d[_0xf13b('0x4')]][_0xf13b('0x9')]=_0xf13b('0x41');}}else{queues[_0x53273d['uniqueid']][_0xf13b('0x9')]=_0xf13b('0x42')+_0x53273d[_0xf13b('0x3f')]['toUpperCase']();}utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x43'),_0x53273d[_0xf13b('0x4')],queues[_0x53273d['uniqueid']][_0xf13b('0x1c')],_0x53273d['membername'],queues[_0x53273d[_0xf13b('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x53273d['uniqueid']]);}}}catch(_0x6135a3){utils['error'](util[_0xf13b('0x2')]('[%s][queues][agentcomplete]',_0x53273d[_0xf13b('0x4')]),_0x6135a3);}};exports[_0xf13b('0x44')]=function(_0xefccbf){try{if(!_['isNil'](queues[_0xefccbf[_0xf13b('0x45')]])){utils['debug'](util[_0xf13b('0x2')](_0xf13b('0x46'),_0xefccbf[_0xf13b('0x4')]),_0xefccbf);queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x40')]=!![];queues[_0xefccbf[_0xf13b('0x45')]]['transfertype']='BLIND';queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x47')]=_0xefccbf['extension'];queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x48')]=_0xefccbf[_0xf13b('0x45')];queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x9')]=_0xf13b('0x49');utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x4a'),_0xefccbf[_0xf13b('0x4')],queues[_0xefccbf[_0xf13b('0x45')]][_0xf13b('0x1c')],_0xefccbf[_0xf13b('0x45')],_0xefccbf[_0xf13b('0x4b')]));}}catch(_0x100ded){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x46'),_0xefccbf[_0xf13b('0x4')]),_0x100ded);}};exports['attendedtransfer']=function(_0x59faad){try{utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x4c'),_0x59faad[_0xf13b('0x4d')]),_0x59faad);if(_0x59faad[_0xf13b('0x4d')]==_0x59faad['origtransfererlinkedid']){if(!_[_0xf13b('0x21')](queues[_0x59faad[_0xf13b('0x4e')]])){utils[_0xf13b('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x59faad[_0xf13b('0x4d')],queues[_0x59faad['secondtransfererlinkedid']][_0xf13b('0x1c')],_0x59faad['origtransfererexten']));queues[_0x59faad[_0xf13b('0x4e')]]['transfer']=!![];queues[_0x59faad[_0xf13b('0x4e')]][_0xf13b('0x4f')]=_0xf13b('0x50');queues[_0x59faad['secondtransfererlinkedid']]['transferexten']=_0x59faad[_0xf13b('0x51')];queues[_0x59faad[_0xf13b('0x4e')]][_0xf13b('0x48')]=_0x59faad[_0xf13b('0x4d')];queues[_0x59faad[_0xf13b('0x4e')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x59faad[_0xf13b('0x52')]])){if(_0x59faad[_0xf13b('0x53')]&&queues[_0x59faad[_0xf13b('0x53')]]){queues[_0x59faad[_0xf13b('0x53')]][_0xf13b('0x1e')]=0x1;queues[_0x59faad[_0xf13b('0x45')]]=_[_0xf13b('0x54')](queues[_0x59faad[_0xf13b('0x53')]]);queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0xe')]=_0x59faad['transfertargetuniqueid'];queues[_0x59faad['transfereeuniqueid']][_0xf13b('0x1e')]=0x2;queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x7')]=queues[_0x59faad[_0xf13b('0x4e')]]['calleridnum'];queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x55')]=queues[_0x59faad[_0xf13b('0x4e')]][_0xf13b('0x55')];queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x33')]=utils['now']();queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x16')]=utils[_0xf13b('0x12')]();queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x31')]=0x0;queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x56')]=0x0;utils[_0xf13b('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x59faad[_0xf13b('0x4d')],queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x1c')],queues[_0x59faad[_0xf13b('0x45')]][_0xf13b('0x7')],queues[_0x59faad['transfereeuniqueid']][_0xf13b('0x55')]));}else{utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x57'),_0x59faad[_0xf13b('0x4d')],queues[_0x59faad['origtransfererlinkedid']][_0xf13b('0x1c')],_0x59faad['secondtransfererlinkedid']));queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0xe')]=_0x59faad[_0xf13b('0x4e')];}}}else if(_0x59faad[_0xf13b('0x58')]==_0x59faad[_0xf13b('0x4e')]){if(!_['isNil'](queues[_0x59faad[_0xf13b('0x52')]])){utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x59'),_0x59faad[_0xf13b('0x4d')],queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0x1c')],_0x59faad[_0xf13b('0x58')],_0x59faad['secondtransfererexten']));queues[_0x59faad[_0xf13b('0x52')]]['transfer']=!![];queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0x4f')]='ATTENDED';queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0x47')]=_0x59faad[_0xf13b('0x5a')];queues[_0x59faad[_0xf13b('0x52')]]['transferuniqueid']=_0x59faad[_0xf13b('0x58')];queues[_0x59faad[_0xf13b('0x52')]][_0xf13b('0x9')]='ATTENDEDTRANSFER';}if(!_[_0xf13b('0x21')](queues[_0x59faad[_0xf13b('0x4e')]])){if(_0x59faad[_0xf13b('0x5b')]&&queues[_0x59faad[_0xf13b('0x5b')]]){queues[_0x59faad['transfertargetlinkedid']][_0xf13b('0x1e')]=0x1;queues[_0x59faad[_0xf13b('0x5c')]]=_[_0xf13b('0x54')](queues[_0x59faad[_0xf13b('0x5b')]]);queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0xe')]=_0x59faad[_0xf13b('0x5c')];queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x1e')]=0x2;queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0x7')]=queues[_0x59faad['origtransfererlinkedid']][_0xf13b('0x7')];queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x55')]=queues[_0x59faad['origtransfererlinkedid']][_0xf13b('0x55')];queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0x33')]=utils[_0xf13b('0x12')]();queues[_0x59faad[_0xf13b('0x5c')]]['queuecallerleaveAt']=utils[_0xf13b('0x12')]();queues[_0x59faad[_0xf13b('0x5c')]]['holdtime']=0x0;queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x56')]=0x0;utils[_0xf13b('0x1')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x59faad[_0xf13b('0x4d')],queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x1c')],queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0xe')],queues[_0x59faad['transfertargetuniqueid']][_0xf13b('0x7')],queues[_0x59faad[_0xf13b('0x5c')]][_0xf13b('0x55')]));}else{utils['info'](util[_0xf13b('0x2')](_0xf13b('0x57'),_0x59faad['origtransfereruniqueid'],queues[_0x59faad['secondtransfererlinkedid']][_0xf13b('0x1c')],_0x59faad[_0xf13b('0x52')]));queues[_0x59faad[_0xf13b('0x4e')]]['transfereduniqueid']=_0x59faad[_0xf13b('0x52')];}}}}catch(_0x559363){utils['error'](util[_0xf13b('0x2')](_0xf13b('0x4c'),_0x59faad[_0xf13b('0x4d')]),_0x559363);}};exports[_0xf13b('0x5d')]=function(_0x3bd583){try{if(!_[_0xf13b('0x21')](queues[_0x3bd583[_0xf13b('0x4')]])){utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x5e'),_0x3bd583[_0xf13b('0x4')]),_0x3bd583);queues[_0x3bd583[_0xf13b('0x4')]][_0xf13b('0x5f')]=utils[_0xf13b('0x12')]();utils['info'](util[_0xf13b('0x2')](_0xf13b('0x60'),_0x3bd583['uniqueid'],queues[_0x3bd583[_0xf13b('0x4')]][_0xf13b('0x1c')],queues[_0x3bd583[_0xf13b('0x4')]][_0xf13b('0x5f')]));}}catch(_0x404eb0){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x5e'),_0x3bd583[_0xf13b('0x4')]),_0x404eb0);}};exports[_0xf13b('0x61')]=function(_0x5c2ebb){try{if(!_[_0xf13b('0x21')](queues[_0x5c2ebb[_0xf13b('0x4')]])){if(!_[_0xf13b('0x21')](queues[_0x5c2ebb[_0xf13b('0x4')]][_0xf13b('0x5f')])){utils[_0xf13b('0xf')](util[_0xf13b('0x2')](_0xf13b('0x62'),_0x5c2ebb[_0xf13b('0x4')]),_0x5c2ebb);queues[_0x5c2ebb[_0xf13b('0x4')]][_0xf13b('0x56')]+=utils[_0xf13b('0x32')](utils['now'](),queues[_0x5c2ebb['uniqueid']][_0xf13b('0x5f')]);utils[_0xf13b('0x1')](util[_0xf13b('0x2')](_0xf13b('0x63'),_0x5c2ebb[_0xf13b('0x4')],queues[_0x5c2ebb[_0xf13b('0x4')]][_0xf13b('0x1c')],queues[_0x5c2ebb[_0xf13b('0x4')]][_0xf13b('0x56')]));delete queues[_0x5c2ebb[_0xf13b('0x4')]]['musiconholdstartAt'];}}}catch(_0x39ba7c){utils[_0xf13b('0x13')](util[_0xf13b('0x2')](_0xf13b('0x62'),_0x5c2ebb[_0xf13b('0x4')]),_0x39ba7c);}}; \ No newline at end of file +var _0x5104=['[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','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','[%s][queues][hangup]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s'];(function(_0x197083,_0x408808){var _0x4a2d03=function(_0x27ceed){while(--_0x27ceed){_0x197083['push'](_0x197083['shift']());}};_0x4a2d03(++_0x408808);}(_0x5104,0x1be));var _0x4510=function(_0x2589d1,_0x5c4817){_0x2589d1=_0x2589d1-0x0;var _0x5b057e=_0x5104[_0x2589d1];return _0x5b057e;};'use strict';var _=require(_0x4510('0x0'));var util=require('util');var utils=require(_0x4510('0x1'));var queues={};function writeDB(_0x76d612){utils[_0x4510('0x2')](util[_0x4510('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x76d612[_0x4510('0x4')],_0x76d612[_0x4510('0x5')],_0x76d612[_0x4510('0x6')],_0x76d612[_0x4510('0x7')],_0x76d612['calleridnum'],_0x76d612[_0x4510('0x8')],_0x76d612['queuecallerexitreason']));if(_0x76d612[_0x4510('0x6')]){utils[_0x4510('0x9')](_0x76d612[_0x4510('0x6')])[_0x4510('0xa')](function(_0x429b21){if(_0x429b21){_0x76d612[_0x4510('0xb')]=_0x429b21[_0x4510('0xb')];}utils[_0x4510('0xc')](_0x4510('0xd'),_0x76d612);});}else{utils[_0x4510('0xc')]('CreateVoiceQueueReport',_0x76d612);}if(_0x76d612[_0x4510('0xe')]){delete queues[_0x76d612[_0x4510('0xe')]];}else{delete queues[_0x76d612['uniqueid']];}}exports[_0x4510('0xf')]=function(_0x44543e){try{utils[_0x4510('0x10')](util['format'](_0x4510('0x11'),_0x44543e[_0x4510('0x4')]),_0x44543e);utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x12'),_0x44543e['uniqueid'],_0x44543e[_0x4510('0x6')],_0x44543e[_0x4510('0x13')]));queues[_0x44543e[_0x4510('0x4')]]=_[_0x4510('0x14')](_0x44543e,{'originalposition':_0x44543e[_0x4510('0x13')],'queuecallerjoinAt':utils[_0x4510('0x15')](),'mohtime':0x0});}catch(_0x30bc52){utils['error'](util['format'](_0x4510('0x11'),_0x44543e[_0x4510('0x4')]),_0x30bc52);}};exports[_0x4510('0x16')]=function(_0x54b4bb){try{if(!_[_0x4510('0x17')](queues[_0x54b4bb[_0x4510('0x4')]])){utils[_0x4510('0x10')](util[_0x4510('0x3')]('[%s][queues][hangup]',_0x54b4bb['uniqueid']),_0x54b4bb);if(queues[_0x54b4bb['uniqueid']][_0x4510('0x18')]){if(!queues[_0x54b4bb[_0x4510('0x4')]][_0x4510('0x19')]&&!queues[_0x54b4bb[_0x4510('0x4')]][_0x4510('0x1a')]){queues[_0x54b4bb[_0x4510('0x4')]][_0x4510('0x1b')]=!![];queues[_0x54b4bb['uniqueid']][_0x4510('0x1c')]=utils[_0x4510('0x15')]();queues[_0x54b4bb[_0x4510('0x4')]][_0x4510('0x1d')]=_0x4510('0x1e');}utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x1f'),_0x54b4bb[_0x4510('0x4')],queues[_0x54b4bb[_0x4510('0x4')]]['name'],queues[_0x54b4bb[_0x4510('0x4')]][_0x4510('0x1d')]));writeDB(queues[_0x54b4bb[_0x4510('0x4')]]);}else if(queues[_0x54b4bb[_0x4510('0x4')]]['transfereduniqueid']){utils['info'](util['format'](_0x4510('0x20'),_0x54b4bb[_0x4510('0x4')],queues[_0x54b4bb['uniqueid']][_0x4510('0x21')],queues[_0x54b4bb[_0x4510('0x4')]][_0x4510('0xe')]));queues[queues[_0x54b4bb['uniqueid']]['transfereduniqueid']]=queues[_0x54b4bb[_0x4510('0x4')]];queues[queues[_0x54b4bb[_0x4510('0x4')]][_0x4510('0xe')]][_0x4510('0x22')]=0x2;delete queues[_0x54b4bb[_0x4510('0x4')]];}}}catch(_0x23f48b){utils['error'](util[_0x4510('0x3')](_0x4510('0x23'),_0x54b4bb[_0x4510('0x4')]),_0x23f48b);}};exports['varset']=function(_0x13381b){try{utils[_0x4510('0x10')](util[_0x4510('0x3')]('[%s][queues][varset]',_0x13381b['uniqueid']),_0x13381b);if(!_[_0x4510('0x17')](_0x13381b['variable'][_0x4510('0x24')])&&_0x13381b[_0x4510('0x25')][_0x4510('0x26')]()!==_0x4510('0x27')){if(!_[_0x4510('0x17')](queues[_0x13381b['uniqueid']])){queues[_0x13381b[_0x4510('0x4')]]['queuecallerabandon']=![];queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x28')]=null;queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x1a')]=!![];queues[_0x13381b[_0x4510('0x4')]]['queuecallerexitAt']=utils['now']();queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x1d')]=_0x13381b[_0x4510('0x25')]['toUpperCase']();utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x29'),_0x13381b[_0x4510('0x4')],queues[_0x13381b['uniqueid']][_0x4510('0x21')],_0x13381b[_0x4510('0x25')],queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x1d')]));writeDB(queues[_0x13381b[_0x4510('0x4')]]);}}else if(!_['isNil'](_0x13381b[_0x4510('0x2a')][_0x4510('0x2b')])){if(!_[_0x4510('0x17')](queues[_0x13381b['uniqueid']])&&!queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x19')]){queues[_0x13381b['uniqueid']][_0x4510('0x19')]=![];queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x28')]=null;queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x1a')]=!![];queues[_0x13381b['uniqueid']]['queuecallerexitAt']=utils[_0x4510('0x15')]();queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x1d')]=_0x4510('0x2c');utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x2d'),_0x13381b[_0x4510('0x4')],queues[_0x13381b['uniqueid']][_0x4510('0x21')],_0x13381b[_0x4510('0x25')],queues[_0x13381b[_0x4510('0x4')]][_0x4510('0x1d')]));}}}catch(_0x4d7888){utils[_0x4510('0x2e')](util[_0x4510('0x3')]('[%s][queues][varset]',_0x13381b[_0x4510('0x4')]),_0x4d7888);}};exports[_0x4510('0x19')]=function(_0x588c67){try{if(!_[_0x4510('0x17')](queues[_0x588c67[_0x4510('0x4')]])){utils[_0x4510('0x10')](util[_0x4510('0x3')](_0x4510('0x2f'),_0x588c67[_0x4510('0x4')]),_0x588c67);queues[_0x588c67[_0x4510('0x4')]]['queuecallerexit']=![];queues[_0x588c67[_0x4510('0x4')]][_0x4510('0x30')]=null;queues[_0x588c67[_0x4510('0x4')]][_0x4510('0x19')]=!![];queues[_0x588c67[_0x4510('0x4')]][_0x4510('0x28')]=utils[_0x4510('0x15')]();queues[_0x588c67[_0x4510('0x4')]][_0x4510('0x1d')]=_0x4510('0x31');utils[_0x4510('0x2')](util['format'](_0x4510('0x32'),_0x588c67[_0x4510('0x4')],queues[_0x588c67[_0x4510('0x4')]][_0x4510('0x21')],queues[_0x588c67[_0x4510('0x4')]][_0x4510('0x1d')]));}}catch(_0x42cb8a){utils['error'](util[_0x4510('0x3')](_0x4510('0x2f'),_0x588c67[_0x4510('0x4')]),_0x42cb8a);}};exports[_0x4510('0x33')]=function(_0x3d7407){try{if(!_['isNil'](queues[_0x3d7407[_0x4510('0x4')]])){utils[_0x4510('0x10')](util[_0x4510('0x3')](_0x4510('0x34'),_0x3d7407['uniqueid']),_0x3d7407);utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x35'),_0x3d7407['uniqueid'],queues[_0x3d7407[_0x4510('0x4')]]['name'],_0x3d7407[_0x4510('0x36')],_0x3d7407['connectedlinename']));queues[_0x3d7407[_0x4510('0x4')]]['queuecallerleave']=!![];queues[_0x3d7407[_0x4510('0x4')]][_0x4510('0x18')]=utils[_0x4510('0x15')]();queues[_0x3d7407[_0x4510('0x4')]]['holdtime']=utils[_0x4510('0x37')](queues[_0x3d7407[_0x4510('0x4')]][_0x4510('0x18')],queues[_0x3d7407[_0x4510('0x4')]][_0x4510('0x38')]);queues[_0x3d7407['uniqueid']][_0x4510('0x13')]=_0x3d7407['position'];queues[_0x3d7407['uniqueid']][_0x4510('0x39')]=_0x3d7407[_0x4510('0x39')];queues[_0x3d7407[_0x4510('0x4')]][_0x4510('0x36')]=_0x3d7407[_0x4510('0x36')];queues[_0x3d7407['uniqueid']][_0x4510('0x3a')]=_0x3d7407['connectedlinename'];}}catch(_0x1ea079){utils['error'](util['format'](_0x4510('0x34'),_0x3d7407[_0x4510('0x4')]),_0x1ea079);}};exports[_0x4510('0x3b')]=function(_0x52249c){try{if(!_[_0x4510('0x17')](queues[_0x52249c[_0x4510('0x4')]])){utils[_0x4510('0x10')](util[_0x4510('0x3')]('[%s][queues][agentconnect]',_0x52249c['uniqueid']),_0x52249c);utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x3c'),_0x52249c['uniqueid'],queues[_0x52249c['uniqueid']][_0x4510('0x21')],_0x52249c[_0x4510('0x3d')],_0x52249c[_0x4510('0x3e')]));queues[_0x52249c['uniqueid']][_0x4510('0x19')]=![];queues[_0x52249c[_0x4510('0x4')]][_0x4510('0x19')]=![];queues[_0x52249c[_0x4510('0x4')]][_0x4510('0x28')]=null;queues[_0x52249c['uniqueid']][_0x4510('0x1a')]=![];queues[_0x52249c[_0x4510('0x4')]]['queuecallerexitreason']=null;queues[_0x52249c['uniqueid']]['queuecallerexitAt']=null;queues[_0x52249c[_0x4510('0x4')]]['assigned']=!![];queues[_0x52249c[_0x4510('0x4')]][_0x4510('0x8')]=_0x52249c[_0x4510('0x3e')];queues[_0x52249c[_0x4510('0x4')]][_0x4510('0x7')]=_0x52249c[_0x4510('0x3d')];}}catch(_0x1fe750){utils[_0x4510('0x2e')](util[_0x4510('0x3')](_0x4510('0x3f'),_0x52249c[_0x4510('0x4')]),_0x1fe750);}};exports[_0x4510('0x40')]=function(_0x5c994d){try{if(!_[_0x4510('0x17')](queues[_0x5c994d['uniqueid']])){if(queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x18')]){utils[_0x4510('0x10')](util[_0x4510('0x3')](_0x4510('0x41'),_0x5c994d['uniqueid']),_0x5c994d);queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x19')]=![];queues[_0x5c994d[_0x4510('0x4')]]['queuecallerabandon']=![];queues[_0x5c994d[_0x4510('0x4')]]['queuecallerabandonAt']=null;queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x1a')]=![];queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x30')]=null;queues[_0x5c994d['uniqueid']][_0x4510('0x42')]=!![];queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x7')]=_0x5c994d[_0x4510('0x3d')];queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x1b')]=!![];queues[_0x5c994d['uniqueid']][_0x4510('0x1c')]=utils[_0x4510('0x15')]();if(_0x5c994d[_0x4510('0x43')]=='transfer'){if(!queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x44')]){queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x1d')]=_0x4510('0x45');}}else{queues[_0x5c994d[_0x4510('0x4')]]['queuecallerexitreason']=_0x4510('0x46')+_0x5c994d[_0x4510('0x43')][_0x4510('0x26')]();}utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x47'),_0x5c994d[_0x4510('0x4')],queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x21')],_0x5c994d[_0x4510('0x3d')],queues[_0x5c994d[_0x4510('0x4')]][_0x4510('0x1d')]));writeDB(queues[_0x5c994d[_0x4510('0x4')]]);}}}catch(_0x3d9179){utils[_0x4510('0x2e')](util[_0x4510('0x3')](_0x4510('0x41'),_0x5c994d[_0x4510('0x4')]),_0x3d9179);}};exports['blindtransfer']=function(_0x3c8a31){try{if(!_[_0x4510('0x17')](queues[_0x3c8a31[_0x4510('0x48')]])){utils[_0x4510('0x10')](util[_0x4510('0x3')](_0x4510('0x49'),_0x3c8a31[_0x4510('0x4')]),_0x3c8a31);queues[_0x3c8a31['transfereeuniqueid']][_0x4510('0x44')]=!![];queues[_0x3c8a31['transfereeuniqueid']][_0x4510('0x4a')]='BLIND';queues[_0x3c8a31['transfereeuniqueid']][_0x4510('0x4b')]=_0x3c8a31[_0x4510('0x4c')];queues[_0x3c8a31[_0x4510('0x48')]][_0x4510('0x4d')]=_0x3c8a31[_0x4510('0x48')];queues[_0x3c8a31[_0x4510('0x48')]][_0x4510('0x1d')]=_0x4510('0x4e');utils['info'](util[_0x4510('0x3')](_0x4510('0x4f'),_0x3c8a31[_0x4510('0x4')],queues[_0x3c8a31[_0x4510('0x48')]]['name'],_0x3c8a31[_0x4510('0x48')],_0x3c8a31[_0x4510('0x4c')]));}}catch(_0x22d6b5){utils[_0x4510('0x2e')](util[_0x4510('0x3')]('[%s][queues][blindtransfer]',_0x3c8a31[_0x4510('0x4')]),_0x22d6b5);}};exports['attendedtransfer']=function(_0xc013f){try{utils['debug'](util[_0x4510('0x3')]('[%s][queues][attendedtransfer]',_0xc013f[_0x4510('0x50')]),_0xc013f);if(_0xc013f[_0x4510('0x50')]==_0xc013f[_0x4510('0x51')]){if(!_[_0x4510('0x17')](queues[_0xc013f[_0x4510('0x52')]])){utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x53'),_0xc013f[_0x4510('0x50')],queues[_0xc013f[_0x4510('0x52')]][_0x4510('0x21')],_0xc013f[_0x4510('0x54')]));queues[_0xc013f[_0x4510('0x52')]][_0x4510('0x44')]=!![];queues[_0xc013f[_0x4510('0x52')]][_0x4510('0x4a')]=_0x4510('0x55');queues[_0xc013f[_0x4510('0x52')]][_0x4510('0x4b')]=_0xc013f[_0x4510('0x54')];queues[_0xc013f['secondtransfererlinkedid']][_0x4510('0x4d')]=_0xc013f[_0x4510('0x50')];queues[_0xc013f[_0x4510('0x52')]][_0x4510('0x1d')]=_0x4510('0x56');}if(!_['isNil'](queues[_0xc013f['origtransfererlinkedid']])){if(_0xc013f[_0x4510('0x57')]&&queues[_0xc013f[_0x4510('0x57')]]){queues[_0xc013f[_0x4510('0x57')]]['queuecallerenterreason']=0x1;queues[_0xc013f['transfereeuniqueid']]=_['clone'](queues[_0xc013f['transfereelinkedid']]);queues[_0xc013f[_0x4510('0x48')]][_0x4510('0xe')]=_0xc013f[_0x4510('0x58')];queues[_0xc013f[_0x4510('0x48')]][_0x4510('0x22')]=0x2;queues[_0xc013f[_0x4510('0x48')]][_0x4510('0x59')]=queues[_0xc013f[_0x4510('0x52')]][_0x4510('0x59')];queues[_0xc013f[_0x4510('0x48')]][_0x4510('0x5a')]=queues[_0xc013f['secondtransfererlinkedid']][_0x4510('0x5a')];queues[_0xc013f[_0x4510('0x48')]][_0x4510('0x38')]=utils[_0x4510('0x15')]();queues[_0xc013f['transfereeuniqueid']][_0x4510('0x18')]=utils['now']();queues[_0xc013f[_0x4510('0x48')]][_0x4510('0x5b')]=0x0;queues[_0xc013f[_0x4510('0x48')]][_0x4510('0x5c')]=0x0;utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x5d'),_0xc013f[_0x4510('0x50')],queues[_0xc013f[_0x4510('0x48')]][_0x4510('0x21')],queues[_0xc013f[_0x4510('0x48')]]['calleridnum'],queues[_0xc013f[_0x4510('0x48')]][_0x4510('0x5a')]));}else{utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x5e'),_0xc013f['origtransfereruniqueid'],queues[_0xc013f['origtransfererlinkedid']][_0x4510('0x21')],_0xc013f['secondtransfererlinkedid']));queues[_0xc013f[_0x4510('0x51')]]['transfereduniqueid']=_0xc013f[_0x4510('0x52')];}}}else if(_0xc013f['secondtransfereruniqueid']==_0xc013f[_0x4510('0x52')]){if(!_['isNil'](queues[_0xc013f[_0x4510('0x51')]])){utils['info'](util[_0x4510('0x3')](_0x4510('0x5f'),_0xc013f[_0x4510('0x50')],queues[_0xc013f[_0x4510('0x51')]][_0x4510('0x21')],_0xc013f[_0x4510('0x60')],_0xc013f[_0x4510('0x61')]));queues[_0xc013f[_0x4510('0x51')]][_0x4510('0x44')]=!![];queues[_0xc013f[_0x4510('0x51')]][_0x4510('0x4a')]=_0x4510('0x55');queues[_0xc013f['origtransfererlinkedid']][_0x4510('0x4b')]=_0xc013f['secondtransfererexten'];queues[_0xc013f[_0x4510('0x51')]][_0x4510('0x4d')]=_0xc013f[_0x4510('0x60')];queues[_0xc013f[_0x4510('0x51')]][_0x4510('0x1d')]='ATTENDEDTRANSFER';}if(!_[_0x4510('0x17')](queues[_0xc013f[_0x4510('0x52')]])){if(_0xc013f['transfertargetlinkedid']&&queues[_0xc013f['transfertargetlinkedid']]){queues[_0xc013f[_0x4510('0x62')]][_0x4510('0x22')]=0x1;queues[_0xc013f[_0x4510('0x58')]]=_[_0x4510('0x63')](queues[_0xc013f[_0x4510('0x62')]]);queues[_0xc013f[_0x4510('0x58')]][_0x4510('0xe')]=_0xc013f[_0x4510('0x58')];queues[_0xc013f['transfertargetuniqueid']][_0x4510('0x22')]=0x2;queues[_0xc013f[_0x4510('0x58')]][_0x4510('0x59')]=queues[_0xc013f[_0x4510('0x51')]][_0x4510('0x59')];queues[_0xc013f['transfertargetuniqueid']][_0x4510('0x5a')]=queues[_0xc013f[_0x4510('0x51')]][_0x4510('0x5a')];queues[_0xc013f[_0x4510('0x58')]][_0x4510('0x38')]=utils[_0x4510('0x15')]();queues[_0xc013f['transfertargetuniqueid']][_0x4510('0x18')]=utils[_0x4510('0x15')]();queues[_0xc013f['transfertargetuniqueid']][_0x4510('0x5b')]=0x0;queues[_0xc013f[_0x4510('0x58')]][_0x4510('0x5c')]=0x0;utils['info'](util[_0x4510('0x3')](_0x4510('0x64'),_0xc013f[_0x4510('0x50')],queues[_0xc013f[_0x4510('0x58')]][_0x4510('0x21')],queues[_0xc013f[_0x4510('0x58')]][_0x4510('0xe')],queues[_0xc013f[_0x4510('0x58')]][_0x4510('0x59')],queues[_0xc013f[_0x4510('0x58')]][_0x4510('0x5a')]));}else{utils[_0x4510('0x2')](util[_0x4510('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xc013f[_0x4510('0x50')],queues[_0xc013f[_0x4510('0x52')]][_0x4510('0x21')],_0xc013f[_0x4510('0x51')]));queues[_0xc013f['secondtransfererlinkedid']][_0x4510('0xe')]=_0xc013f[_0x4510('0x51')];}}}}catch(_0x574a4f){utils[_0x4510('0x2e')](util[_0x4510('0x3')](_0x4510('0x65'),_0xc013f[_0x4510('0x50')]),_0x574a4f);}};exports[_0x4510('0x66')]=function(_0x3640ce){try{if(!_[_0x4510('0x17')](queues[_0x3640ce[_0x4510('0x4')]])){utils['debug'](util['format'](_0x4510('0x67'),_0x3640ce['uniqueid']),_0x3640ce);queues[_0x3640ce[_0x4510('0x4')]][_0x4510('0x68')]=utils[_0x4510('0x15')]();utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x69'),_0x3640ce[_0x4510('0x4')],queues[_0x3640ce[_0x4510('0x4')]][_0x4510('0x21')],queues[_0x3640ce['uniqueid']]['musiconholdstartAt']));}}catch(_0x35725f){utils['error'](util['format'](_0x4510('0x67'),_0x3640ce['uniqueid']),_0x35725f);}};exports[_0x4510('0x6a')]=function(_0x3862d7){try{if(!_[_0x4510('0x17')](queues[_0x3862d7[_0x4510('0x4')]])){if(!_[_0x4510('0x17')](queues[_0x3862d7['uniqueid']][_0x4510('0x68')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x3862d7[_0x4510('0x4')]),_0x3862d7);queues[_0x3862d7[_0x4510('0x4')]][_0x4510('0x5c')]+=utils[_0x4510('0x37')](utils[_0x4510('0x15')](),queues[_0x3862d7[_0x4510('0x4')]][_0x4510('0x68')]);utils[_0x4510('0x2')](util[_0x4510('0x3')](_0x4510('0x6b'),_0x3862d7[_0x4510('0x4')],queues[_0x3862d7[_0x4510('0x4')]][_0x4510('0x21')],queues[_0x3862d7['uniqueid']][_0x4510('0x5c')]));delete queues[_0x3862d7['uniqueid']]['musiconholdstartAt'];}}}catch(_0x596ba5){utils[_0x4510('0x2e')](util[_0x4510('0x3')]('[%s][queues][musiconholdstop]',_0x3862d7[_0x4510('0x4')]),_0x596ba5);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 7b11512..4ae867c 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 _0x5a8d=['connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','appdata','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereruniqueid','[%s][recordings][blindtransfer]','lodash','util','./transfers.controller','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','info','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','transfer','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','type','outbound'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x5a8d,0x12e));var _0xd5a8=function(_0x199a19,_0x3d7fba){_0x199a19=_0x199a19-0x0;var _0x292d09=_0x5a8d[_0x199a19];return _0x292d09;};'use strict';var _=require(_0xd5a8('0x0'));var util=require(_0xd5a8('0x1'));var utils=require('./utils');var transfers=require(_0xd5a8('0x2'));var recordings={};function writeDB(_0x42c97f){var _0x5871b1;utils['info'](util['format']('[%s][recordings][writeDB]',_0x42c97f[_0xd5a8('0x3')]));if(transfers[_0xd5a8('0x4')][_0x42c97f[_0xd5a8('0x3')]]){_0x5871b1=_0x42c97f[_0xd5a8('0x3')];_0x42c97f[_0xd5a8('0x3')]=transfers[_0xd5a8('0x4')][_0x42c97f[_0xd5a8('0x3')]][_0xd5a8('0x5')];}if(_0x42c97f[_0xd5a8('0x6')]){utils[_0xd5a8('0x7')](_0x42c97f[_0xd5a8('0x6')])[_0xd5a8('0x8')](function(_0x4fe418){if(_0x4fe418){_0x42c97f[_0xd5a8('0x9')]=_0x4fe418[_0xd5a8('0xa')];_0x42c97f['UserId']=_0x4fe418['id'];}utils[_0xd5a8('0xb')]('CreateVoiceRecording',_0x42c97f);});}else{utils[_0xd5a8('0xb')](_0xd5a8('0xc'),_0x42c97f);}if(_0x5871b1)delete transfers[_0xd5a8('0x4')][_0x5871b1];}exports[_0xd5a8('0xd')]=function(_0x5bceb0){try{utils[_0xd5a8('0xe')](util['format']('[%s][recordings][newchannel]',_0x5bceb0[_0xd5a8('0x3')]),_0x5bceb0);if(_0x5bceb0[_0xd5a8('0x3')]==_0x5bceb0['linkedid']){utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x11'),_0x5bceb0[_0xd5a8('0x3')],_0x5bceb0[_0xd5a8('0x12')],_0x5bceb0[_0xd5a8('0x13')]));recordings[_0x5bceb0[_0xd5a8('0x3')]]={'uniqueid':_0x5bceb0[_0xd5a8('0x3')],'accountcode':_0x5bceb0[_0xd5a8('0x6')],'exten':_0x5bceb0[_0xd5a8('0x13')],'context':_0x5bceb0[_0xd5a8('0x12')],'channel':_0x5bceb0['channel'],'monitors':[]};}}catch(_0x4571e5){utils[_0xd5a8('0x14')](util[_0xd5a8('0x10')](_0xd5a8('0x15'),_0x5bceb0[_0xd5a8('0x3')]),_0x4571e5);}};exports[_0xd5a8('0x16')]=function(_0x16116c){try{utils[_0xd5a8('0xe')](util[_0xd5a8('0x10')]('[%s][recordings][newstate]',_0x16116c['uniqueid']),_0x16116c);if(!_[_0xd5a8('0x17')](recordings[_0x16116c[_0xd5a8('0x3')]])&&_0x16116c[_0xd5a8('0x18')]==0x6){utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x19'),_0x16116c['uniqueid'],_0x16116c[_0xd5a8('0x12')],_0x16116c[_0xd5a8('0x1a')]));}else if(!_['isNil'](recordings[_0x16116c[_0xd5a8('0x1b')]])&&_0x16116c[_0xd5a8('0x18')]==0x6&&_0x16116c['context']!=_0xd5a8('0x1c')){utils[_0xd5a8('0xf')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x16116c[_0xd5a8('0x3')],_0x16116c[_0xd5a8('0x1b')],_0x16116c[_0xd5a8('0x12')],_0x16116c['channel']));recordings[_0x16116c[_0xd5a8('0x1b')]][_0xd5a8('0x6')]=_0x16116c[_0xd5a8('0x6')];}}catch(_0x2aaf51){utils[_0xd5a8('0x14')](util['format'](_0xd5a8('0x1d'),_0x16116c[_0xd5a8('0x3')]),_0x2aaf51);}};exports['varset']=function(_0x23c966){try{if(!_[_0xd5a8('0x17')](_0x23c966[_0xd5a8('0x1e')])&&!_[_0xd5a8('0x17')](_0x23c966[_0xd5a8('0x1e')][_0xd5a8('0x1f')])){utils[_0xd5a8('0xe')](util['format'](_0xd5a8('0x20'),_0x23c966[_0xd5a8('0x3')]),_0x23c966);utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x21'),_0x23c966[_0xd5a8('0x3')],_0x23c966[_0xd5a8('0x1e')],_0x23c966[_0xd5a8('0x22')]));if(_[_0xd5a8('0x23')](_0x23c966[_0xd5a8('0x22')],_0xd5a8('0x24'))){_0x23c966['value']=_0x23c966[_0xd5a8('0x22')][_0xd5a8('0x25')](_0xd5a8('0x24'),_0xd5a8('0x26'));}if(recordings[_0x23c966[_0xd5a8('0x1b')]]){var _0x580b3d=_[_0xd5a8('0x27')](recordings[_0x23c966[_0xd5a8('0x1b')]][_0xd5a8('0x28')],{'value':_0x23c966[_0xd5a8('0x22')]});if(_['isNil'](_0x580b3d)){recordings[_0x23c966['linkedid']]['monitors']['push']({'value':_0x23c966['value']});}}}}catch(_0xa0d003){utils['error'](util[_0xd5a8('0x10')](_0xd5a8('0x20'),_0x23c966[_0xd5a8('0x3')]),_0xa0d003);}};exports['hangup']=function(_0x560337){try{if(!_[_0xd5a8('0x17')](recordings[_0x560337[_0xd5a8('0x3')]])){utils['debug'](util[_0xd5a8('0x10')](_0xd5a8('0x29'),_0x560337['uniqueid']),_0x560337);utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x2a'),_0x560337[_0xd5a8('0x3')],_0x560337[_0xd5a8('0x2b')],_0x560337['calleridname'],_0x560337['cause-txt']));recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x2b')]=_0x560337[_0xd5a8('0x2b')];recordings[_0x560337['uniqueid']]['calleridname']=_0x560337[_0xd5a8('0x2c')];recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x2d')]=_0x560337[_0xd5a8('0x2d')];recordings[_0x560337['uniqueid']]['connectedlinename']=_0x560337['connectedlinename'];if(recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x2e')]==_0xd5a8('0x2f')&&recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x6')]){recordings[_0x560337[_0xd5a8('0x3')]]['connectedlinenum']=recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x6')];recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x30')]='';}recordings[_0x560337[_0xd5a8('0x3')]][_0xd5a8('0x28')][_0xd5a8('0x31')](function(_0x268771){var _0x1d7205=_[_0xd5a8('0x32')](recordings[_0x560337['uniqueid']]);_0x1d7205[_0xd5a8('0x22')]=_0x268771[_0xd5a8('0x22')];writeDB(_0x1d7205);});delete recordings[_0x560337[_0xd5a8('0x3')]];}}catch(_0x44f37f){utils[_0xd5a8('0x14')](util[_0xd5a8('0x10')]('[%s][recordings][hangup]',_0x560337[_0xd5a8('0x3')]),_0x44f37f);}};exports[_0xd5a8('0x33')]=function(_0x5ed4b0){try{if(!_[_0xd5a8('0x17')](recordings[_0x5ed4b0[_0xd5a8('0x3')]])){utils[_0xd5a8('0xe')](util[_0xd5a8('0x10')]('[%s][recordings][newexten]',_0x5ed4b0[_0xd5a8('0x3')]),_0x5ed4b0);utils[_0xd5a8('0xf')](util[_0xd5a8('0x10')](_0xd5a8('0x34'),_0x5ed4b0[_0xd5a8('0x3')],_0x5ed4b0[_0xd5a8('0x35')],_0x5ed4b0['appdata']));if(_0x5ed4b0['application']['toLowerCase']()==_0xd5a8('0x36')&&_['startsWith'](_0x5ed4b0[_0xd5a8('0x37')][_0xd5a8('0x38')](),_0xd5a8('0x39'))){var _0x28d739=_0x5ed4b0[_0xd5a8('0x37')][_0xd5a8('0x3a')]('=');var _0x2011b2=_0x28d739[0x0][_0xd5a8('0x3b')](_0x28d739[0x0][_0xd5a8('0x3c')]('(')+0x1,_0x28d739[0x0][_0xd5a8('0x3c')](')'));var _0xb892b2=_0x28d739[0x1];recordings[_0x5ed4b0[_0xd5a8('0x3')]][_0x2011b2]=_0xb892b2;}}}catch(_0x5d8e05){utils['error'](util[_0xd5a8('0x10')](_0xd5a8('0x3d'),_0x5ed4b0[_0xd5a8('0x3')]),_0x5d8e05);}};exports[_0xd5a8('0x3e')]=function(_0x259ab7){try{if(!_[_0xd5a8('0x17')](recordings[_0x259ab7[_0xd5a8('0x3')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x259ab7[_0xd5a8('0x3')]),_0x259ab7);utils['info'](util['format'](_0xd5a8('0x3f'),_0x259ab7['uniqueid'],_0x259ab7['queue']));recordings[_0x259ab7[_0xd5a8('0x3')]][_0xd5a8('0x40')]=_0x259ab7[_0xd5a8('0x40')];}}catch(_0x5a4ca0){utils[_0xd5a8('0x14')](util[_0xd5a8('0x10')]('[%s][recordings][queuecallerjoin]',_0x259ab7['uniqueid']),_0x5a4ca0);}};exports[_0xd5a8('0x41')]=function(_0x3cccf2){try{utils[_0xd5a8('0xe')](util[_0xd5a8('0x10')]('[%s][recordings][blindtransfer]',_0x3cccf2[_0xd5a8('0x3')]),_0x3cccf2);utils[_0xd5a8('0xf')](util['format'](_0xd5a8('0x42'),_0x3cccf2[_0xd5a8('0x3')],_0x3cccf2['transferercalleridnum'],_0x3cccf2[_0xd5a8('0x43')],_0x3cccf2['transfereecalleridnum'],_0x3cccf2['transfereecalleridname']));if(recordings[_0x3cccf2[_0xd5a8('0x44')]]&&transfers[_0xd5a8('0x4')][_0x3cccf2[_0xd5a8('0x44')]]){transfers[_0xd5a8('0x4')][_0x3cccf2[_0xd5a8('0x44')]]['recording']=!![];}}catch(_0x35a5f0){utils['error'](util['format'](_0xd5a8('0x45'),_0x3cccf2[_0xd5a8('0x3')]),_0x35a5f0);}}; \ No newline at end of file +var _0xb5c7=['then','membername','request','CreateVoiceRecording','newchannel','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','mixmonitor_filename','[%s][recordings][varset]','variable','endsWith','.wav49','value','.WAV','push','error','[%s][recordings][hangup]','calleridname','calleridnum','connectedlinenum','connectedlinename','type','monitors','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','util','./transfers.controller','info','format','blinds','uniqueid','transfereeuniqueid','getUserByInternal','accountcode'];(function(_0xa90dc0,_0x512c5a){var _0x156754=function(_0x3d70c6){while(--_0x3d70c6){_0xa90dc0['push'](_0xa90dc0['shift']());}};_0x156754(++_0x512c5a);}(_0xb5c7,0x170));var _0x7b5c=function(_0x1e5685,_0x3179fd){_0x1e5685=_0x1e5685-0x0;var _0x2ab447=_0xb5c7[_0x1e5685];return _0x2ab447;};'use strict';var _=require(_0x7b5c('0x0'));var util=require(_0x7b5c('0x1'));var utils=require('./utils');var transfers=require(_0x7b5c('0x2'));var recordings={};function writeDB(_0x5b02e8){var _0x47a874;utils[_0x7b5c('0x3')](util[_0x7b5c('0x4')]('[%s][recordings][writeDB]',_0x5b02e8['uniqueid']));if(transfers[_0x7b5c('0x5')][_0x5b02e8[_0x7b5c('0x6')]]){_0x47a874=_0x5b02e8[_0x7b5c('0x6')];_0x5b02e8['uniqueid']=transfers[_0x7b5c('0x5')][_0x5b02e8[_0x7b5c('0x6')]][_0x7b5c('0x7')];}if(_0x5b02e8['accountcode']){utils[_0x7b5c('0x8')](_0x5b02e8[_0x7b5c('0x9')])[_0x7b5c('0xa')](function(_0x22b304){if(_0x22b304){_0x5b02e8[_0x7b5c('0xb')]=_0x22b304['name'];_0x5b02e8['UserId']=_0x22b304['id'];}utils[_0x7b5c('0xc')](_0x7b5c('0xd'),_0x5b02e8);});}else{utils['request'](_0x7b5c('0xd'),_0x5b02e8);}if(_0x47a874)delete transfers['blinds'][_0x47a874];}exports[_0x7b5c('0xe')]=function(_0x1ff002){try{utils['debug'](util[_0x7b5c('0x4')]('[%s][recordings][newchannel]',_0x1ff002[_0x7b5c('0x6')]),_0x1ff002);if(_0x1ff002[_0x7b5c('0x6')]==_0x1ff002[_0x7b5c('0xf')]){utils[_0x7b5c('0x3')](util['format'](_0x7b5c('0x10'),_0x1ff002[_0x7b5c('0x6')],_0x1ff002[_0x7b5c('0x11')],_0x1ff002['exten']));recordings[_0x1ff002['uniqueid']]={'uniqueid':_0x1ff002[_0x7b5c('0x6')],'accountcode':_0x1ff002[_0x7b5c('0x9')],'exten':_0x1ff002['exten'],'context':_0x1ff002[_0x7b5c('0x11')],'channel':_0x1ff002[_0x7b5c('0x12')],'monitors':[]};}}catch(_0x3274c1){utils['error'](util[_0x7b5c('0x4')](_0x7b5c('0x13'),_0x1ff002[_0x7b5c('0x6')]),_0x3274c1);}};exports[_0x7b5c('0x14')]=function(_0x55f36f){try{utils[_0x7b5c('0x15')](util['format'](_0x7b5c('0x16'),_0x55f36f['uniqueid']),_0x55f36f);if(!_[_0x7b5c('0x17')](recordings[_0x55f36f['uniqueid']])&&_0x55f36f[_0x7b5c('0x18')]==0x6){utils[_0x7b5c('0x3')](util[_0x7b5c('0x4')](_0x7b5c('0x19'),_0x55f36f[_0x7b5c('0x6')],_0x55f36f[_0x7b5c('0x11')],_0x55f36f[_0x7b5c('0x12')]));}else if(!_[_0x7b5c('0x17')](recordings[_0x55f36f[_0x7b5c('0xf')]])&&_0x55f36f[_0x7b5c('0x18')]==0x6&&_0x55f36f[_0x7b5c('0x11')]!=_0x7b5c('0x1a')){utils['info'](util[_0x7b5c('0x4')](_0x7b5c('0x1b'),_0x55f36f[_0x7b5c('0x6')],_0x55f36f[_0x7b5c('0xf')],_0x55f36f[_0x7b5c('0x11')],_0x55f36f[_0x7b5c('0x12')]));recordings[_0x55f36f[_0x7b5c('0xf')]][_0x7b5c('0x9')]=_0x55f36f[_0x7b5c('0x9')];}}catch(_0x5c00b9){utils['error'](util[_0x7b5c('0x4')](_0x7b5c('0x16'),_0x55f36f[_0x7b5c('0x6')]),_0x5c00b9);}};exports[_0x7b5c('0x1c')]=function(_0x51b76b){try{if(!_[_0x7b5c('0x17')](_0x51b76b['variable'])&&!_[_0x7b5c('0x17')](_0x51b76b['variable'][_0x7b5c('0x1d')])){utils['debug'](util[_0x7b5c('0x4')](_0x7b5c('0x1e'),_0x51b76b[_0x7b5c('0x6')]),_0x51b76b);utils['info'](util[_0x7b5c('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x51b76b[_0x7b5c('0x6')],_0x51b76b[_0x7b5c('0x1f')],_0x51b76b['value']));if(_[_0x7b5c('0x20')](_0x51b76b['value'],_0x7b5c('0x21'))){_0x51b76b['value']=_0x51b76b[_0x7b5c('0x22')]['replace'](_0x7b5c('0x21'),_0x7b5c('0x23'));}if(recordings[_0x51b76b[_0x7b5c('0xf')]]){var _0x2da28c=_['find'](recordings[_0x51b76b['linkedid']]['monitors'],{'value':_0x51b76b[_0x7b5c('0x22')]});if(_[_0x7b5c('0x17')](_0x2da28c)){recordings[_0x51b76b[_0x7b5c('0xf')]]['monitors'][_0x7b5c('0x24')]({'value':_0x51b76b[_0x7b5c('0x22')]});}}}}catch(_0x230276){utils[_0x7b5c('0x25')](util['format']('[%s][recordings][varset]',_0x51b76b['uniqueid']),_0x230276);}};exports['hangup']=function(_0x43cca2){try{if(!_['isNil'](recordings[_0x43cca2['uniqueid']])){utils[_0x7b5c('0x15')](util[_0x7b5c('0x4')](_0x7b5c('0x26'),_0x43cca2[_0x7b5c('0x6')]),_0x43cca2);utils['info'](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x43cca2[_0x7b5c('0x6')],_0x43cca2['calleridnum'],_0x43cca2[_0x7b5c('0x27')],_0x43cca2['cause-txt']));recordings[_0x43cca2[_0x7b5c('0x6')]][_0x7b5c('0x28')]=_0x43cca2[_0x7b5c('0x28')];recordings[_0x43cca2[_0x7b5c('0x6')]]['calleridname']=_0x43cca2[_0x7b5c('0x27')];recordings[_0x43cca2[_0x7b5c('0x6')]][_0x7b5c('0x29')]=_0x43cca2[_0x7b5c('0x29')];recordings[_0x43cca2['uniqueid']][_0x7b5c('0x2a')]=_0x43cca2[_0x7b5c('0x2a')];if(recordings[_0x43cca2[_0x7b5c('0x6')]][_0x7b5c('0x2b')]=='outbound'&&recordings[_0x43cca2[_0x7b5c('0x6')]][_0x7b5c('0x9')]){recordings[_0x43cca2[_0x7b5c('0x6')]][_0x7b5c('0x29')]=recordings[_0x43cca2['uniqueid']]['accountcode'];recordings[_0x43cca2[_0x7b5c('0x6')]][_0x7b5c('0x2a')]='';}recordings[_0x43cca2[_0x7b5c('0x6')]][_0x7b5c('0x2c')]['forEach'](function(_0xb58126){var _0x1b14e4=_[_0x7b5c('0x2d')](recordings[_0x43cca2[_0x7b5c('0x6')]]);_0x1b14e4['value']=_0xb58126['value'];writeDB(_0x1b14e4);});delete recordings[_0x43cca2[_0x7b5c('0x6')]];}}catch(_0x2e1daa){utils[_0x7b5c('0x25')](util['format']('[%s][recordings][hangup]',_0x43cca2[_0x7b5c('0x6')]),_0x2e1daa);}};exports['newexten']=function(_0x5efcb9){try{if(!_['isNil'](recordings[_0x5efcb9['uniqueid']])){utils['debug'](util[_0x7b5c('0x4')](_0x7b5c('0x2e'),_0x5efcb9[_0x7b5c('0x6')]),_0x5efcb9);utils[_0x7b5c('0x3')](util[_0x7b5c('0x4')](_0x7b5c('0x2f'),_0x5efcb9[_0x7b5c('0x6')],_0x5efcb9['application'],_0x5efcb9[_0x7b5c('0x30')]));if(_0x5efcb9[_0x7b5c('0x31')][_0x7b5c('0x32')]()=='set'&&_[_0x7b5c('0x33')](_0x5efcb9[_0x7b5c('0x30')][_0x7b5c('0x32')](),_0x7b5c('0x34'))){var _0x56114e=_0x5efcb9[_0x7b5c('0x30')][_0x7b5c('0x35')]('=');var _0x526535=_0x56114e[0x0]['substring'](_0x56114e[0x0][_0x7b5c('0x36')]('(')+0x1,_0x56114e[0x0][_0x7b5c('0x36')](')'));var _0x23422b=_0x56114e[0x1];recordings[_0x5efcb9[_0x7b5c('0x6')]][_0x526535]=_0x23422b;}}}catch(_0xbf75ab){utils[_0x7b5c('0x25')](util[_0x7b5c('0x4')](_0x7b5c('0x2e'),_0x5efcb9['uniqueid']),_0xbf75ab);}};exports['queuecallerjoin']=function(_0x28adef){try{if(!_[_0x7b5c('0x17')](recordings[_0x28adef['uniqueid']])){utils[_0x7b5c('0x15')](util[_0x7b5c('0x4')](_0x7b5c('0x37'),_0x28adef[_0x7b5c('0x6')]),_0x28adef);utils[_0x7b5c('0x3')](util[_0x7b5c('0x4')](_0x7b5c('0x38'),_0x28adef[_0x7b5c('0x6')],_0x28adef[_0x7b5c('0x39')]));recordings[_0x28adef[_0x7b5c('0x6')]][_0x7b5c('0x39')]=_0x28adef[_0x7b5c('0x39')];}}catch(_0x10a989){utils['error'](util[_0x7b5c('0x4')](_0x7b5c('0x37'),_0x28adef[_0x7b5c('0x6')]),_0x10a989);}};exports[_0x7b5c('0x3a')]=function(_0x53cc7f){try{utils[_0x7b5c('0x15')](util[_0x7b5c('0x4')]('[%s][recordings][blindtransfer]',_0x53cc7f[_0x7b5c('0x6')]),_0x53cc7f);utils[_0x7b5c('0x3')](util[_0x7b5c('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x53cc7f[_0x7b5c('0x6')],_0x53cc7f['transferercalleridnum'],_0x53cc7f[_0x7b5c('0x3b')],_0x53cc7f[_0x7b5c('0x3c')],_0x53cc7f[_0x7b5c('0x3d')]));if(recordings[_0x53cc7f[_0x7b5c('0x3e')]]&&transfers['blinds'][_0x53cc7f['transfereruniqueid']]){transfers[_0x7b5c('0x5')][_0x53cc7f['transfereruniqueid']]['recording']=!![];}}catch(_0x2e4fe7){utils[_0x7b5c('0x25')](util['format']('[%s][recordings][blindtransfer]',_0x53cc7f[_0x7b5c('0x6')]),_0x2e4fe7);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 03ee65f..0fc5b9e 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 _0xa70b=['[%s][transfers][attendedtransfer]','info','transfertargetcalleridnum','assign','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','blind','transfereruniqueid','error','attendedtransfer'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa70b,0xcb));var _0xba70=function(_0x17fc20,_0x7d3f2f){_0x17fc20=_0x17fc20-0x0;var _0x29d108=_0xa70b[_0x17fc20];return _0x29d108;};'use strict';var _=require('lodash');var util=require(_0xba70('0x0'));var utils=require(_0xba70('0x1'));function writeDB(_0x28dbca){utils['info'](util[_0xba70('0x2')](_0xba70('0x3'),_0x28dbca[_0xba70('0x4')]===_0xba70('0x5')?_0x28dbca[_0xba70('0x6')]:_0x28dbca[_0xba70('0x7')],_0x28dbca[_0xba70('0x4')]));utils[_0xba70('0x8')]('CreateVoiceTransferReport',_0x28dbca);}exports[_0xba70('0x9')]={};exports[_0xba70('0xa')]=function(_0x228d18){try{utils[_0xba70('0xb')](util['format'](_0xba70('0xc'),_0x228d18[_0xba70('0x7')]),_0x228d18);utils['info'](util[_0xba70('0x2')](_0xba70('0xd'),_0x228d18[_0xba70('0x7')],_0x228d18['transferercalleridnum'],_0x228d18['transferercalleridname'],_0x228d18[_0xba70('0xe')],_0x228d18['transfereecalleridname']));_0x228d18[_0xba70('0x4')]=_0xba70('0xf');exports[_0xba70('0x9')][_0x228d18[_0xba70('0x10')]]=_0x228d18;writeDB(_0x228d18);}catch(_0x595b17){utils[_0xba70('0x11')](util[_0xba70('0x2')](_0xba70('0xc'),_0x228d18[_0xba70('0x7')]),_0x595b17);}};exports[_0xba70('0x12')]=function(_0x4af0bf){try{utils[_0xba70('0xb')](util[_0xba70('0x2')](_0xba70('0x13'),_0x4af0bf[_0xba70('0x6')]),_0x4af0bf);utils[_0xba70('0x14')](util[_0xba70('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4af0bf[_0xba70('0x6')],_0x4af0bf['origtransferercalleridnum'],_0x4af0bf['origtransferercalleridname'],_0x4af0bf[_0xba70('0x15')],_0x4af0bf['transfertargetcalleridname']));_0x4af0bf=_[_0xba70('0x16')](_0x4af0bf,{'transfererchannel':_0x4af0bf['origtransfererchannel'],'transferercalleridnum':_0x4af0bf[_0xba70('0x17')],'transferercalleridname':_0x4af0bf[_0xba70('0x18')],'transfererconnectedlinenum':_0x4af0bf[_0xba70('0x19')],'transfererconnectedlinename':_0x4af0bf[_0xba70('0x1a')],'transfereraccountcode':_0x4af0bf[_0xba70('0x1b')],'transferercontext':_0x4af0bf[_0xba70('0x1c')],'transfererexten':_0x4af0bf[_0xba70('0x1d')],'transfererlinkedid':_0x4af0bf['origtransfererlinkedid'],'context':_0x4af0bf[_0xba70('0x1e')],'extension':_0x4af0bf['origtransfererexten'],'type':_0xba70('0x5')});if(_['isNil'](_0x4af0bf['transfereechannel'])){_0x4af0bf=_[_0xba70('0x16')](_0x4af0bf,{'transfereechannel':_0x4af0bf[_0xba70('0x1f')],'transfereecalleridnum':_0x4af0bf[_0xba70('0x15')],'transfereecalleridname':_0x4af0bf['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4af0bf['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4af0bf[_0xba70('0x20')],'transfereeaccountcode':_0x4af0bf[_0xba70('0x21')],'transfereecontext':_0x4af0bf[_0xba70('0x22')],'transfereeexten':_0x4af0bf[_0xba70('0x23')],'transfereelinkedid':_0x4af0bf[_0xba70('0x24')]});}writeDB(_0x4af0bf);}catch(_0x51c8b3){utils[_0xba70('0x11')](util[_0xba70('0x2')](_0xba70('0x13'),_0x4af0bf[_0xba70('0x6')]),_0x51c8b3);}}; \ No newline at end of file +var _0x0cd7=['blind','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','blinds','blindtransfer','format','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname'];(function(_0x4242c1,_0x1b3ac){var _0x5eb8f9=function(_0x1287e9){while(--_0x1287e9){_0x4242c1['push'](_0x4242c1['shift']());}};_0x5eb8f9(++_0x1b3ac);}(_0x0cd7,0xad));var _0x70cd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0cd7[_0x432682];return _0x463d05;};'use strict';var _=require(_0x70cd('0x0'));var util=require(_0x70cd('0x1'));var utils=require(_0x70cd('0x2'));function writeDB(_0x147da4){utils['info'](util['format'](_0x70cd('0x3'),_0x147da4[_0x70cd('0x4')]==='attended'?_0x147da4[_0x70cd('0x5')]:_0x147da4[_0x70cd('0x6')],_0x147da4[_0x70cd('0x4')]));utils['request']('CreateVoiceTransferReport',_0x147da4);}exports[_0x70cd('0x7')]={};exports[_0x70cd('0x8')]=function(_0x12d967){try{utils['debug'](util[_0x70cd('0x9')](_0x70cd('0xa'),_0x12d967[_0x70cd('0x6')]),_0x12d967);utils[_0x70cd('0xb')](util[_0x70cd('0x9')](_0x70cd('0xc'),_0x12d967[_0x70cd('0x6')],_0x12d967[_0x70cd('0xd')],_0x12d967[_0x70cd('0xe')],_0x12d967[_0x70cd('0xf')],_0x12d967[_0x70cd('0x10')]));_0x12d967[_0x70cd('0x4')]=_0x70cd('0x11');exports[_0x70cd('0x7')][_0x12d967['transfereruniqueid']]=_0x12d967;writeDB(_0x12d967);}catch(_0x257505){utils['error'](util[_0x70cd('0x9')](_0x70cd('0xa'),_0x12d967[_0x70cd('0x6')]),_0x257505);}};exports['attendedtransfer']=function(_0x22d527){try{utils['debug'](util[_0x70cd('0x9')]('[%s][transfers][attendedtransfer]',_0x22d527[_0x70cd('0x5')]),_0x22d527);utils[_0x70cd('0xb')](util[_0x70cd('0x9')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x22d527[_0x70cd('0x5')],_0x22d527[_0x70cd('0x12')],_0x22d527['origtransferercalleridname'],_0x22d527[_0x70cd('0x13')],_0x22d527[_0x70cd('0x14')]));_0x22d527=_['assign'](_0x22d527,{'transfererchannel':_0x22d527[_0x70cd('0x15')],'transferercalleridnum':_0x22d527[_0x70cd('0x12')],'transferercalleridname':_0x22d527['origtransferercalleridname'],'transfererconnectedlinenum':_0x22d527[_0x70cd('0x16')],'transfererconnectedlinename':_0x22d527[_0x70cd('0x17')],'transfereraccountcode':_0x22d527[_0x70cd('0x18')],'transferercontext':_0x22d527[_0x70cd('0x19')],'transfererexten':_0x22d527['secondtransfererexten'],'transfererlinkedid':_0x22d527[_0x70cd('0x1a')],'context':_0x22d527[_0x70cd('0x1b')],'extension':_0x22d527['origtransfererexten'],'type':_0x70cd('0x1c')});if(_[_0x70cd('0x1d')](_0x22d527[_0x70cd('0x1e')])){_0x22d527=_[_0x70cd('0x1f')](_0x22d527,{'transfereechannel':_0x22d527[_0x70cd('0x20')],'transfereecalleridnum':_0x22d527[_0x70cd('0x13')],'transfereecalleridname':_0x22d527[_0x70cd('0x14')],'transfereeconnectedlinenum':_0x22d527[_0x70cd('0x21')],'transfereeconnectedlinename':_0x22d527[_0x70cd('0x22')],'transfereeaccountcode':_0x22d527['transfertargetaccountcode'],'transfereecontext':_0x22d527[_0x70cd('0x23')],'transfereeexten':_0x22d527['transfertargetexten'],'transfereelinkedid':_0x22d527[_0x70cd('0x24')]});}writeDB(_0x22d527);}catch(_0x1fbc89){utils['error'](util['format'](_0x70cd('0x25'),_0x22d527['origtransfereruniqueid']),_0x1fbc89);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ce94e2a..02f2506 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 _0xf34b=['length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','found','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify'];(function(_0x3f13d6,_0x1069c5){var _0x1bbca9=function(_0x636976){while(--_0x636976){_0x3f13d6['push'](_0x3f13d6['shift']());}};_0x1bbca9(++_0x1069c5);}(_0xf34b,0xb1));var _0xbf34=function(_0xb18cbc,_0x396ffe){_0xb18cbc=_0xb18cbc-0x0;var _0x39afb6=_0xf34b[_0xb18cbc];return _0x39afb6;};'use strict';var BPromise=require(_0xbf34('0x0'));var jayson=require(_0xbf34('0x1'));var moment=require(_0xbf34('0x2'));var util=require(_0xbf34('0x3'));var client=jayson['client'][_0xbf34('0x4')]({'port':0x2329});var logger=require(_0xbf34('0x5'))(_0xbf34('0x6'));exports[_0xbf34('0x7')]=function(_0x395c1d,_0x86aeaa){logger[_0xbf34('0x7')](_0x395c1d,_0x86aeaa?util[_0xbf34('0x8')](_0x86aeaa,{'showHidden':![],'depth':null}):'');};exports[_0xbf34('0x9')]=function(_0x4a809f,_0x596c61){logger[_0xbf34('0x9')](_0x4a809f,_0x596c61?util[_0xbf34('0x8')](_0x596c61,{'showHidden':![],'depth':null}):'');};exports[_0xbf34('0xa')]=function(_0x598e11,_0x1e6ba1){logger['error'](_0x598e11,_0x1e6ba1?util[_0xbf34('0x8')](_0x1e6ba1,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4b2769,_0x102afb){return client[_0xbf34('0xb')](_0x4b2769,{'body':_0x102afb})[_0xbf34('0xc')](function(_0x244b6f){logger[_0xbf34('0x9')](_0xbf34('0xd'),_0x4b2769,_0x244b6f?util[_0xbf34('0x8')](_0x244b6f,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4e3df7){logger[_0xbf34('0xa')](_0xbf34('0xd'),_0x4b2769,_0x4e3df7?util[_0xbf34('0x8')](_0x4e3df7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1bbe15){return client[_0xbf34('0xb')](_0xbf34('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbf34('0xf'),_0xbf34('0x10'),'interface'],'where':_0x1bbe15,'limit':0x1}})[_0xbf34('0xc')](function(_0x5151d2){logger['debug'](_0xbf34('0x11'),JSON[_0xbf34('0x12')](_0x1bbe15),_0x5151d2?util['inspect'](_0x5151d2,{'showHidden':![],'depth':null}):'');return _0x5151d2['result'][_0xbf34('0x13')]?_0x5151d2[_0xbf34('0x14')][0x0]:null;});}exports[_0xbf34('0x15')]=function(_0xeb360d){return new BPromise(function(_0x70b706,_0x5ef0c3){if(_0xeb360d){return getUser({'internal':_0xeb360d})[_0xbf34('0xc')](function(_0x1c5bed){logger[_0xbf34('0x7')](_0xbf34('0x16'),_0xeb360d,_0x1c5bed?'found':_0xbf34('0x17'));return _0x70b706(_0x1c5bed);})[_0xbf34('0x18')](function(_0x598f26){logger[_0xbf34('0xa')](_0xbf34('0x19'),_0x598f26?util[_0xbf34('0x8')](_0x598f26,{'showHidden':![],'depth':null}):'');return _0x70b706(null);});}return _0x70b706(null);});};exports[_0xbf34('0x1a')]=function(_0x4a75e1){return new BPromise(function(_0x6f2930,_0x465697){if(_0x4a75e1){return getUser({'interface':_0x4a75e1})[_0xbf34('0xc')](function(_0x1c4d12){logger['info'](_0xbf34('0x1b'),_0x4a75e1,_0x1c4d12?'found':_0xbf34('0x17'));return _0x6f2930(_0x1c4d12);})[_0xbf34('0x18')](function(_0x174f0f){logger[_0xbf34('0xa')]('[utils][getUserByInterface]',_0x174f0f?util[_0xbf34('0x8')](_0x174f0f,{'showHidden':![],'depth':null}):'');return _0x6f2930(null);});}return _0x6f2930(null);});};exports[_0xbf34('0x1c')]=function(_0x50932b){return new BPromise(function(_0x4b0163,_0x98d60d){if(_0x50932b){return getUser({'name':_0x50932b})[_0xbf34('0xc')](function(_0x3e29dd){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x50932b,_0x3e29dd?'found':_0xbf34('0x17'));return _0x4b0163(_0x3e29dd);})[_0xbf34('0x18')](function(_0x286137){logger['error'](_0xbf34('0x1d'),_0x286137?util['inspect'](_0x286137,{'showHidden':![],'depth':null}):'');return _0x4b0163(null);});}return _0x4b0163(null);});};exports[_0xbf34('0x1e')]=function(_0x4622c4){return new BPromise(function(_0x4c33aa,_0x566744){if(_0x4622c4){return client[_0xbf34('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xbf34('0x10'),_0xbf34('0x1f'),_0xbf34('0x20'),_0xbf34('0x21')],'where':{'name':_0x4622c4},'limit':0x1}})[_0xbf34('0xc')](function(_0x51174b){logger['debug'](_0xbf34('0x22'),_0x4622c4,_0x51174b?util[_0xbf34('0x8')](_0x51174b,{'showHidden':![],'depth':null}):'');logger['info'](_0xbf34('0x23'),_0x4622c4,_0x51174b?_0xbf34('0x24'):'notfound');return _0x4c33aa(_0x51174b[_0xbf34('0x14')][_0xbf34('0x13')]?_0x51174b['result'][0x0]:null);})[_0xbf34('0x18')](function(_0x169fa8){logger[_0xbf34('0xa')]('[utils][getVoiceQueueByName]',_0x169fa8?util['inspect'](_0x169fa8,{'showHidden':![],'depth':null}):'');return _0x4c33aa(null);});}return _0x4c33aa(null);});};exports[_0xbf34('0x25')]=function(_0x19df1b,_0x5213ab){return moment(_0x19df1b)[_0xbf34('0x26')](_0x5213ab,_0xbf34('0x27'))[_0xbf34('0x28')](_0xbf34('0x29'));};exports[_0xbf34('0x2a')]=function(_0x284168,_0x5a7c6f){return moment(_0x284168)[_0xbf34('0x2b')](_0x5a7c6f,_0xbf34('0x27'))[_0xbf34('0x28')](_0xbf34('0x29'));};exports[_0xbf34('0x2c')]=function(_0x2c2a6d,_0x608986){return moment(_0x2c2a6d)['diff'](moment(_0x608986),_0xbf34('0x27'));};exports[_0xbf34('0x2d')]=function(_0x932c61,_0x5297b9){return parseInt(_0x932c61,0xa)+parseInt(_0x5297b9,0xa);};exports[_0xbf34('0x2e')]=function(){return moment()[_0xbf34('0x28')](_0xbf34('0x29'));};exports[_0xbf34('0x2f')]=function(_0x253192,_0x113fac){if(_0x113fac){return moment(_0x253192)[_0xbf34('0x2f')](_0x113fac);}return!![];};exports[_0xbf34('0x30')]=function(_0x53918b,_0x3d0402){if(_0x3d0402){return moment(_0x53918b)[_0xbf34('0x30')](_0x3d0402);}else if(_0x53918b){return!![];}return![];}; \ No newline at end of file +var _0xe9e7=['getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','isAfter','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','interface','stringify','result','length','getUserByInternal','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0xd70ad0,_0x57df60){_0xd70ad0=_0xd70ad0-0x0;var _0x19085a=_0xe9e7[_0xd70ad0];return _0x19085a;};'use strict';var BPromise=require(_0x7e9e('0x0'));var jayson=require(_0x7e9e('0x1'));var moment=require(_0x7e9e('0x2'));var util=require('util');var client=jayson[_0x7e9e('0x3')][_0x7e9e('0x4')]({'port':0x2329});var logger=require(_0x7e9e('0x5'))(_0x7e9e('0x6'));exports[_0x7e9e('0x7')]=function(_0x18bf13,_0x214b6c){logger['info'](_0x18bf13,_0x214b6c?util[_0x7e9e('0x8')](_0x214b6c,{'showHidden':![],'depth':null}):'');};exports[_0x7e9e('0x9')]=function(_0xba25,_0x508a97){logger[_0x7e9e('0x9')](_0xba25,_0x508a97?util['inspect'](_0x508a97,{'showHidden':![],'depth':null}):'');};exports[_0x7e9e('0xa')]=function(_0x2c6c16,_0x2a7911){logger[_0x7e9e('0xa')](_0x2c6c16,_0x2a7911?util[_0x7e9e('0x8')](_0x2a7911,{'showHidden':![],'depth':null}):'');};exports[_0x7e9e('0xb')]=function(_0x7a18bd,_0x399920){return client[_0x7e9e('0xb')](_0x7a18bd,{'body':_0x399920})[_0x7e9e('0xc')](function(_0x4a8235){logger[_0x7e9e('0x9')]('[utils][request]\x20name:%s',_0x7a18bd,_0x4a8235?util['inspect'](_0x4a8235,{'showHidden':![],'depth':null}):'');})['catch'](function(_0xa5db58){logger[_0x7e9e('0xa')](_0x7e9e('0xd'),_0x7a18bd,_0xa5db58?util[_0x7e9e('0x8')](_0xa5db58,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4c13a8){return client['request'](_0x7e9e('0xe'),{'options':{'raw':!![],'attributes':['id',_0x7e9e('0xf'),_0x7e9e('0x10'),_0x7e9e('0x11')],'where':_0x4c13a8,'limit':0x1}})[_0x7e9e('0xc')](function(_0x89bb24){logger[_0x7e9e('0x9')]('[utils][getUser]\x20where:%s',JSON[_0x7e9e('0x12')](_0x4c13a8),_0x89bb24?util['inspect'](_0x89bb24,{'showHidden':![],'depth':null}):'');return _0x89bb24[_0x7e9e('0x13')][_0x7e9e('0x14')]?_0x89bb24[_0x7e9e('0x13')][0x0]:null;});}exports[_0x7e9e('0x15')]=function(_0x35af37){return new BPromise(function(_0x11f414,_0x15cd67){if(_0x35af37){return getUser({'internal':_0x35af37})['then'](function(_0x18e896){logger[_0x7e9e('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x35af37,_0x18e896?'found':_0x7e9e('0x16'));return _0x11f414(_0x18e896);})['catch'](function(_0x5ac867){logger[_0x7e9e('0xa')](_0x7e9e('0x17'),_0x5ac867?util[_0x7e9e('0x8')](_0x5ac867,{'showHidden':![],'depth':null}):'');return _0x11f414(null);});}return _0x11f414(null);});};exports[_0x7e9e('0x18')]=function(_0x2654d3){return new BPromise(function(_0x3df008,_0xcd3ea0){if(_0x2654d3){return getUser({'interface':_0x2654d3})[_0x7e9e('0xc')](function(_0x18c975){logger['info'](_0x7e9e('0x19'),_0x2654d3,_0x18c975?_0x7e9e('0x1a'):_0x7e9e('0x16'));return _0x3df008(_0x18c975);})[_0x7e9e('0x1b')](function(_0x523e5f){logger[_0x7e9e('0xa')](_0x7e9e('0x1c'),_0x523e5f?util[_0x7e9e('0x8')](_0x523e5f,{'showHidden':![],'depth':null}):'');return _0x3df008(null);});}return _0x3df008(null);});};exports[_0x7e9e('0x1d')]=function(_0xfa0b70){return new BPromise(function(_0xeaa799,_0x3df586){if(_0xfa0b70){return getUser({'name':_0xfa0b70})['then'](function(_0x2b4df6){logger[_0x7e9e('0x7')](_0x7e9e('0x1e'),_0xfa0b70,_0x2b4df6?_0x7e9e('0x1a'):'notfound');return _0xeaa799(_0x2b4df6);})[_0x7e9e('0x1b')](function(_0x3f6655){logger[_0x7e9e('0xa')](_0x7e9e('0x1f'),_0x3f6655?util['inspect'](_0x3f6655,{'showHidden':![],'depth':null}):'');return _0xeaa799(null);});}return _0xeaa799(null);});};exports[_0x7e9e('0x20')]=function(_0x5da39e){return new BPromise(function(_0xe5b8ef,_0x266b4a){if(_0x5da39e){return client[_0x7e9e('0xb')](_0x7e9e('0x21'),{'options':{'raw':!![],'attributes':['id',_0x7e9e('0x10'),_0x7e9e('0x22'),_0x7e9e('0x23'),_0x7e9e('0x24')],'where':{'name':_0x5da39e},'limit':0x1}})['then'](function(_0x5c33e1){logger[_0x7e9e('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x5da39e,_0x5c33e1?util[_0x7e9e('0x8')](_0x5c33e1,{'showHidden':![],'depth':null}):'');logger[_0x7e9e('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x5da39e,_0x5c33e1?'found':_0x7e9e('0x16'));return _0xe5b8ef(_0x5c33e1[_0x7e9e('0x13')]['length']?_0x5c33e1['result'][0x0]:null);})[_0x7e9e('0x1b')](function(_0x4e7087){logger[_0x7e9e('0xa')](_0x7e9e('0x25'),_0x4e7087?util['inspect'](_0x4e7087,{'showHidden':![],'depth':null}):'');return _0xe5b8ef(null);});}return _0xe5b8ef(null);});};exports[_0x7e9e('0x26')]=function(_0x39191f,_0x583e1f){return moment(_0x39191f)[_0x7e9e('0x27')](_0x583e1f,_0x7e9e('0x28'))[_0x7e9e('0x29')](_0x7e9e('0x2a'));};exports['subtractTime']=function(_0x2654ae,_0x4da4d4){return moment(_0x2654ae)[_0x7e9e('0x2b')](_0x4da4d4,_0x7e9e('0x28'))[_0x7e9e('0x29')](_0x7e9e('0x2a'));};exports[_0x7e9e('0x2c')]=function(_0x188f60,_0x56583c){return moment(_0x188f60)[_0x7e9e('0x2d')](moment(_0x56583c),'seconds');};exports[_0x7e9e('0x2e')]=function(_0x3aeead,_0x19fb3b){return parseInt(_0x3aeead,0xa)+parseInt(_0x19fb3b,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7e9e('0x2f')]=function(_0x21a854,_0x127c92){if(_0x127c92){return moment(_0x21a854)[_0x7e9e('0x2f')](_0x127c92);}return!![];};exports['isBefore']=function(_0xeea03c,_0x55654a){if(_0x55654a){return moment(_0xeea03c)['isBefore'](_0x55654a);}else if(_0xeea03c){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 36a6472..a5c243f 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 _0x086d=['user','data','timestamp','error','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','name','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','other','agent_name','test','fs-extra','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','role','then','client','catch'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0x086d,0x16e));var _0xd086=function(_0x5e3be8,_0x1814de){_0x5e3be8=_0x5e3be8-0x0;var _0xcf9d15=_0x086d[_0x5e3be8];return _0xcf9d15;};var fs=require(_0xd086('0x0'));var _=require(_0xd086('0x1'));var ewinston=require(_0xd086('0x2'));var path=require(_0xd086('0x3'));var util=require(_0xd086('0x4'));var fileLogger=require('./loggers')[_0xd086('0x5')];var safeTemplate=require(_0xd086('0x6'))[_0xd086('0x7')];var maskSensitiveData=require(_0xd086('0x8'))[_0xd086('0x9')];function ClientSideLogger(){function _0x5a479e(_0x50ec8b){var _0x5d68dd=path[_0xd086('0xa')](_0xd086('0xb'),_0xd086('0xc'),_0xd086('0xd'));var _0x1bd0c4=path[_0xd086('0xa')]('client',_0x50ec8b[_0xd086('0xe')]+'-'+_0x50ec8b['name']);return fs['ensureDir'](path[_0xd086('0xa')](_0x5d68dd,_0x1bd0c4))[_0xd086('0xf')](function(){var _0x3b5589=fileLogger(_0xd086('0x10'),path['join'](_0x5d68dd,_0x1bd0c4));return _0x3b5589;})[_0xd086('0x11')](function(_0x82b530){throw _0x82b530;});}this[_0xd086('0xc')]=function(_0x3ca982,_0x10efb5,_0x3f81b0,_0x4a953e){return _0x5a479e(_0x3ca982[_0xd086('0x12')])['then'](function(_0x29f364){var _0x477547=_0x29f364[_0x10efb5];return _0x477547;})[_0xd086('0xf')](function(_0x15cbe3){var _0x5a4911=_0x3ca982['user']?_0x3ca982[_0xd086('0x12')]['id']:'no-user';var _0x1682d8=_0x4a953e[_0xd086('0x13')];var _0xe1f476=_0x4a953e[_0xd086('0x14')];var _0x2979d7=new Date(Number(_0xe1f476));return _0x15cbe3(_0x5a4911,_0x2979d7,_0x3f81b0,_0x1682d8);})[_0xd086('0x11')](function(_0x33da26){fileLogger('client')[_0xd086('0x15')](_0x33da26);});};}function setupLoggers(_0xbab163){return new Promise(function(_0x357df7){var _0x20d50d=new ClientSideLogger();var _0x280188=fileLogger('api');var _0xed1a70=fileLogger(_0xd086('0x16'));_0xbab163[_0xd086('0x17')](_0xd086('0x18'),_0x20d50d);_0xbab163[_0xd086('0x19')](ewinston[_0xd086('0x1a')]({'winstonInstance':_0x280188,'meta':![],'statusLevels':!![],'msg':function(_0x55f7e5,_0x15d564){var _0xd130ac=_0xd086('0x1b');if(!_[_0xd086('0x1c')](_0x55f7e5[_0xd086('0x1d')])){_0xd130ac+=_0xd086('0x1e');var _0x41bfd4=_0x55f7e5[_0xd086('0x1d')];maskSensitiveData(_0x41bfd4);}return safeTemplate(util[_0xd086('0x1f')](_0xd130ac,_0x55f7e5[_0xd086('0x20')],_0x55f7e5['headers'][_0xd086('0x21')]?_0x55f7e5[_0xd086('0x22')]['x-forwarded-for']:_0x55f7e5[_0xd086('0x23')][_0xd086('0x24')]||_0x55f7e5['ip'],_0x55f7e5['url'],_0x15d564[_0xd086('0x25')],_0x15d564[_0xd086('0x26')],_0x55f7e5['user']?_0x55f7e5[_0xd086('0x12')]['id']:null,_0x55f7e5[_0xd086('0x12')]?_0x55f7e5[_0xd086('0x12')][_0xd086('0x27')]:null,_0x55f7e5[_0xd086('0x12')]?_0x55f7e5[_0xd086('0x12')][_0xd086('0xe')]:null,_0x41bfd4?util[_0xd086('0x28')](_0x41bfd4,![],null):''));}}));_0xbab163['use'](ewinston['logger']({'winstonInstance':_0xed1a70,'meta':![],'statusLevels':!![],'msg':function(_0x513363,_0x41d7bb){var _0x4e46cf='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x513363['body']&&_0x513363[_0xd086('0x1d')][_0xd086('0x29')]&&_0x513363[_0xd086('0x1d')][_0xd086('0x2a')]){_0x4e46cf=_0xd086('0x2b');}return util['format'](_0x4e46cf,_0x513363[_0xd086('0x20')],_0x513363[_0xd086('0x22')][_0xd086('0x21')]?_0x513363[_0xd086('0x22')]['x-forwarded-for']:_0x513363[_0xd086('0x23')][_0xd086('0x24')]||_0x513363['ip'],_0x513363[_0xd086('0x2c')],_0x41d7bb['statusCode'],_0x41d7bb[_0xd086('0x26')],_0x513363['user']?_0x513363[_0xd086('0x12')]['id']:null,_0x513363[_0xd086('0x12')]?_0x513363['user'][_0xd086('0x27')]:null,_0x513363['user']?_0x513363[_0xd086('0x12')][_0xd086('0xe')]:null,_0x513363[_0xd086('0x1d')]&&_0x513363['body'][_0xd086('0x29')]?_0x513363[_0xd086('0x1d')][_0xd086('0x29')]:_0xd086('0x2d'),_0x513363['body']&&_0x513363[_0xd086('0x1d')]['agent_id']?_0x513363[_0xd086('0x1d')][_0xd086('0x2a')]:'',_0x513363['body']&&_0x513363[_0xd086('0x1d')][_0xd086('0x2e')]?_0x513363['body'][_0xd086('0x2e')]:'');},'ignoreRoute':function(_0x1bc62a){var _0x1206be=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1206be[_0xd086('0x2f')](_0x1bc62a[_0xd086('0x2c')]);}}));return _0x357df7();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x8c84=['log','client','role','ensureDir','then','catch','user','timestamp','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','method','headers','x-forwarded-for','remoteAddress','url','responseTime','name','inspect','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','device','other','fs-extra','util','./loggers','fileLogger','./safe-template','join'];(function(_0x57d97f,_0x3e347d){var _0x3f4353=function(_0x55f1ae){while(--_0x55f1ae){_0x57d97f['push'](_0x57d97f['shift']());}};_0x3f4353(++_0x3e347d);}(_0x8c84,0x13e));var _0x48c8=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x8c84[_0x4243a3];return _0x1b2a33;};var fs=require(_0x48c8('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require(_0x48c8('0x1'));var fileLogger=require(_0x48c8('0x2'))[_0x48c8('0x3')];var safeTemplate=require(_0x48c8('0x4'))['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')['maskSensitiveData'];function ClientSideLogger(){function _0x5523c2(_0x197e8e){var _0x498a01=path[_0x48c8('0x5')]('/var',_0x48c8('0x6'),'xcally');var _0x2d1b7c=path[_0x48c8('0x5')](_0x48c8('0x7'),_0x197e8e[_0x48c8('0x8')]+'-'+_0x197e8e['name']);return fs[_0x48c8('0x9')](path[_0x48c8('0x5')](_0x498a01,_0x2d1b7c))[_0x48c8('0xa')](function(){var _0x57d45b=fileLogger(_0x48c8('0x7'),path['join'](_0x498a01,_0x2d1b7c));return _0x57d45b;})[_0x48c8('0xb')](function(_0x32e9fc){throw _0x32e9fc;});}this['log']=function(_0x14fb47,_0x368942,_0x1db6d4,_0x32b75b){return _0x5523c2(_0x14fb47[_0x48c8('0xc')])['then'](function(_0x54e8ab){var _0x1fbe39=_0x54e8ab[_0x368942];return _0x1fbe39;})[_0x48c8('0xa')](function(_0x38e81c){var _0x106d2d=_0x14fb47[_0x48c8('0xc')]?_0x14fb47[_0x48c8('0xc')]['id']:'no-user';var _0x1b3ef5=_0x32b75b['data'];var _0x3d577f=_0x32b75b[_0x48c8('0xd')];var _0x1730dd=new Date(Number(_0x3d577f));return _0x38e81c(_0x106d2d,_0x1730dd,_0x1db6d4,_0x1b3ef5);})[_0x48c8('0xb')](function(_0x2d177e){fileLogger(_0x48c8('0x7'))['error'](_0x2d177e);});};}function setupLoggers(_0x152f78){return new Promise(function(_0x3bce58){var _0x8c0218=new ClientSideLogger();var _0x2c5ca5=fileLogger(_0x48c8('0xe'));var _0x3c09d9=fileLogger(_0x48c8('0xf'));_0x152f78[_0x48c8('0x10')](_0x48c8('0x11'),_0x8c0218);_0x152f78[_0x48c8('0x12')](ewinston[_0x48c8('0x13')]({'winstonInstance':_0x2c5ca5,'meta':![],'statusLevels':!![],'msg':function(_0x432a15,_0x4567cc){var _0x3a67ae=_0x48c8('0x14');if(!_[_0x48c8('0x15')](_0x432a15[_0x48c8('0x16')])){_0x3a67ae+='\x20body=%s';var _0xfcbd9e=_0x432a15[_0x48c8('0x16')];maskSensitiveData(_0xfcbd9e);}return safeTemplate(util['format'](_0x3a67ae,_0x432a15[_0x48c8('0x17')],_0x432a15[_0x48c8('0x18')][_0x48c8('0x19')]?_0x432a15[_0x48c8('0x18')][_0x48c8('0x19')]:_0x432a15['connection'][_0x48c8('0x1a')]||_0x432a15['ip'],_0x432a15[_0x48c8('0x1b')],_0x4567cc['statusCode'],_0x4567cc[_0x48c8('0x1c')],_0x432a15['user']?_0x432a15['user']['id']:null,_0x432a15[_0x48c8('0xc')]?_0x432a15[_0x48c8('0xc')][_0x48c8('0x1d')]:null,_0x432a15[_0x48c8('0xc')]?_0x432a15[_0x48c8('0xc')][_0x48c8('0x8')]:null,_0xfcbd9e?util[_0x48c8('0x1e')](_0xfcbd9e,![],null):''));}}));_0x152f78[_0x48c8('0x12')](ewinston[_0x48c8('0x13')]({'winstonInstance':_0x3c09d9,'meta':![],'statusLevels':!![],'msg':function(_0x2c66fd,_0x2167ac){var _0x27ecdb='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2c66fd['body']&&_0x2c66fd[_0x48c8('0x16')]['device']&&_0x2c66fd[_0x48c8('0x16')][_0x48c8('0x1f')]){_0x27ecdb=_0x48c8('0x20');}return util['format'](_0x27ecdb,_0x2c66fd['method'],_0x2c66fd[_0x48c8('0x18')][_0x48c8('0x19')]?_0x2c66fd[_0x48c8('0x18')][_0x48c8('0x19')]:_0x2c66fd[_0x48c8('0x21')][_0x48c8('0x1a')]||_0x2c66fd['ip'],_0x2c66fd['url'],_0x2167ac['statusCode'],_0x2167ac[_0x48c8('0x1c')],_0x2c66fd['user']?_0x2c66fd[_0x48c8('0xc')]['id']:null,_0x2c66fd[_0x48c8('0xc')]?_0x2c66fd[_0x48c8('0xc')][_0x48c8('0x1d')]:null,_0x2c66fd[_0x48c8('0xc')]?_0x2c66fd['user']['role']:null,_0x2c66fd['body']&&_0x2c66fd[_0x48c8('0x16')][_0x48c8('0x22')]?_0x2c66fd[_0x48c8('0x16')][_0x48c8('0x22')]:_0x48c8('0x23'),_0x2c66fd[_0x48c8('0x16')]&&_0x2c66fd[_0x48c8('0x16')]['agent_id']?_0x2c66fd[_0x48c8('0x16')][_0x48c8('0x1f')]:'',_0x2c66fd[_0x48c8('0x16')]&&_0x2c66fd[_0x48c8('0x16')]['agent_name']?_0x2c66fd[_0x48c8('0x16')]['agent_name']:'');},'ignoreRoute':function(_0x1e6e50){var _0x4a25bb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4a25bb['test'](_0x1e6e50['url']);}}));return _0x3bce58();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index e03f921..aadc3f8 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad72=['length','padStart','iftime','moment-timezone','source','split','locale','weekdaysShort','map','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','isBetween','timeCompare','ddd','includes','dowCompare','max','min','MMM','guess','test','isMoment'];(function(_0x2a77ae,_0x4049ea){var _0x8df0e3=function(_0x3e6e05){while(--_0x3e6e05){_0x2a77ae['push'](_0x2a77ae['shift']());}};_0x8df0e3(++_0x4049ea);}(_0xad72,0x113));var _0x2ad7=function(_0x593b6f,_0x2189f2){_0x593b6f=_0x593b6f-0x0;var _0x58a501=_0xad72[_0x593b6f];return _0x58a501;};var _=require('lodash');var moment=require(_0x2ad7('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x32e2c7){return _0x32e2c7[_0x2ad7('0x1')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x324d4c){if(!_0x324d4c['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x154230){var _0x3eaf6b=_0x154230[_0x2ad7('0x2')](':')['map'](function(_0x2d86e8){return parseInt(_0x2d86e8,0xa);});var _0x475234=_0x3eaf6b[0x0];var _0x3f6f3e=_0x3eaf6b[0x1];if(_0x475234<0x0||_0x475234>0x17||_0x3f6f3e<0x0||_0x3f6f3e>0x3b){throw new Error(EINVALID_DATE);}return[_0x475234,_0x3f6f3e];}function circularDoWInterval(_0x4e9529,_0x53a926){if(_0x4e9529===_0x53a926){return[_0x4e9529];}else{var _0x1929aa=moment['locale']();moment[_0x2ad7('0x3')]('en');var _0x28f419=moment[_0x2ad7('0x4')]()[_0x2ad7('0x5')](function(_0x35163f){return _0x35163f[_0x2ad7('0x6')]();});moment[_0x2ad7('0x3')](_0x1929aa);var _0xc54984=_0x28f419['indexOf'](_0x4e9529);var _0x50faab=_0x28f419[_0x2ad7('0x7')](_0x53a926);if(_0x50faab>_0xc54984){return _0x28f419[_0x2ad7('0x8')](_0xc54984,_0x50faab+0x1);}else{var _0x424ae5=_0x28f419[_0x2ad7('0x8')](0x0,_0x50faab+0x1);var _0x2dae92=_0x28f419[_0x2ad7('0x8')](_0xc54984);return _0x2dae92[_0x2ad7('0x9')](_0x424ae5);}}}module[_0x2ad7('0xa')][_0x2ad7('0xb')]=circularDoWInterval;function circularMonthInterval(_0xd01846,_0x573a72){if(_0xd01846===_0x573a72){return[_0xd01846];}else{var _0x5c3a6a=moment[_0x2ad7('0x3')]();moment[_0x2ad7('0x3')]('en');var _0xb403c9=moment[_0x2ad7('0xc')]()['map'](function(_0x362a80){return _0x362a80[_0x2ad7('0x6')]();});moment[_0x2ad7('0x3')](_0x5c3a6a);var _0xd45791=_0xb403c9[_0x2ad7('0x7')](_0xd01846);var _0x35d7c0=_0xb403c9['indexOf'](_0x573a72);if(_0x35d7c0>_0xd45791){return _0xb403c9[_0x2ad7('0x8')](_0xd45791,_0x35d7c0+0x1);}else{var _0x128b23=_0xb403c9[_0x2ad7('0x8')](0x0,_0x35d7c0+0x1);var _0x401f08=_0xb403c9[_0x2ad7('0x8')](_0xd45791);return _0x401f08[_0x2ad7('0x9')](_0x128b23);}}}module[_0x2ad7('0xa')][_0x2ad7('0xd')]=circularMonthInterval;function parseDom(_0x599262){var _0x433f9c=parseInt(_0x599262,0xa);if(_0x433f9c<0x1||_0x433f9c>0x1f){throw new Error(EINVALID_DATE);}return _0x433f9c;}function timeCompare(_0x3c2534,_0x1beeb9,_0x1aaf9c){var _0x44efed=_0x3c2534[_0x2ad7('0xe')]();var _0x5726db=extractTime(_0x1beeb9);var _0x26f7e5=_0x5726db[0x0];var _0xdbb4b=_0x5726db[0x1];var _0x473158=_0x3c2534[_0x2ad7('0xe')]()['hours'](_0x26f7e5)[_0x2ad7('0xf')](_0xdbb4b);throwIfDateNotValid(_0x473158);var _0x247329=extractTime(_0x1aaf9c);var _0x3e0f07=_0x247329[0x0];var _0x2030af=_0x247329[0x1];var _0x56b8bd=_0x3c2534[_0x2ad7('0xe')]()[_0x2ad7('0x10')](_0x3e0f07)[_0x2ad7('0xf')](_0x2030af);throwIfDateNotValid(_0x56b8bd);if(_0x56b8bd[_0x2ad7('0x11')](_0x473158)){var _0x2ccddf=_0x44efed[_0x2ad7('0xe')]()[_0x2ad7('0x12')](_0x2ad7('0x13'));var _0x84c924=_0x44efed[_0x2ad7('0xe')]()['endOf']('day');return _0x44efed[_0x2ad7('0x14')](_0x473158,_0x84c924,undefined,'[]')||_0x44efed[_0x2ad7('0x14')](_0x2ccddf,_0x56b8bd,undefined,'[]');}else{return _0x44efed['isBetween'](_0x473158,_0x56b8bd,undefined,'[]');}}module[_0x2ad7('0xa')][_0x2ad7('0x15')]=timeCompare;function dowCompare(_0x4df22c,_0x4bd70a,_0x5dc4b8){var _0x589755=_0x4df22c[_0x2ad7('0x3')]('en')['format'](_0x2ad7('0x16'))[_0x2ad7('0x6')]();return circularDoWInterval(_0x4bd70a,_0x5dc4b8)[_0x2ad7('0x17')](_0x589755);}module[_0x2ad7('0xa')][_0x2ad7('0x18')]=dowCompare;function domCompare(_0x1e44f6,_0x235f52,_0x1528c1){var _0x50bbbd=_0x1e44f6['date']();if(_0x235f52===_0x1528c1){return _0x50bbbd===_0x235f52;}else{var _0x4c0295=_0x1e44f6['daysInMonth']();var _0x26198a=_0x235f52<_0x1528c1;let _0x3c178b=![];var _0x4721c8=0x0;var _0xd8bb7a=0x0;if(_0x26198a){_0x4721c8=Math[_0x2ad7('0x19')](0x1,_0x235f52);_0xd8bb7a=Math[_0x2ad7('0x1a')](_0x1528c1,_0x4c0295);_0x3c178b=_0x50bbbd>=_0x4721c8&&_0x50bbbd<=_0xd8bb7a;}else{_0x4721c8=Math[_0x2ad7('0x1a')](_0x235f52,_0x4c0295);_0xd8bb7a=Math['max'](0x1,_0x1528c1);_0x3c178b=_0x50bbbd>=_0x4721c8||_0x50bbbd<=_0xd8bb7a;}return _0x3c178b;}}module[_0x2ad7('0xa')]['domCompare']=domCompare;function monthCompare(_0x5ec771,_0x16684a,_0x5c0fae){var _0x38a1af=_0x5ec771['locale']('en')['format'](_0x2ad7('0x1b'))['toLowerCase']();return circularMonthInterval(_0x16684a,_0x5c0fae)[_0x2ad7('0x17')](_0x38a1af);}module[_0x2ad7('0xa')]['monthCompare']=monthCompare;function iftime(_0x3267ff,_0x281453=moment['tz'][_0x2ad7('0x1c')](),_0x2db2a8=moment()){if(!validateRx[_0x2ad7('0x1d')](_0x3267ff)){throw new Error(EINVALID_STRING);}else{var _0x285e11=(moment[_0x2ad7('0x1e')](_0x2db2a8)?_0x2db2a8[_0x2ad7('0xe')]():moment(_0x2db2a8))['tz'](_0x281453)[_0x2ad7('0x3')]('en');throwIfDateNotValid(_0x285e11);var _0x416869=_0x3267ff['split'](',');var _0x2d0f68=_0x416869[0x0];var _0xe1e14=_0x416869[0x1];var _0x5b16a5=_0x416869[0x2];var _0x510260=_0x416869[0x3];let _0xb9f135=!![];if(_0x2d0f68!=='*'){var _0x42638b=_0x2d0f68[_0x2ad7('0x2')]('-');var _0x9f5e6c=_['padStart'](_0x42638b[0x0],0x5,'0');var _0x277730=_0x42638b[_0x2ad7('0x1f')]===0x2?_[_0x2ad7('0x20')](_0x42638b[0x1],0x5,'0'):_0x9f5e6c;_0xb9f135=timeCompare(_0x285e11,_0x9f5e6c,_0x277730);}let _0x629651=!![];if(_0xe1e14!=='*'){var _0x344a59=_0xe1e14[_0x2ad7('0x2')]('-');var _0x546571=_0x344a59[0x0];var _0xb6a70d=_0x344a59[_0x2ad7('0x1f')]===0x2?_0x344a59[0x1]:_0x546571;_0x629651=dowCompare(_0x285e11,_0x546571,_0xb6a70d);}let _0x22a1a0=!![];if(_0x5b16a5!=='*'){var _0x3736e3=_0x5b16a5['split']('-');var _0x4bcfc1=parseDom(_0x3736e3[0x0]);var _0x1ceeeb=_0x3736e3['length']===0x2?parseDom(_0x3736e3[0x1]):_0x4bcfc1;_0x22a1a0=domCompare(_0x285e11,_0x4bcfc1,_0x1ceeeb);}let _0x2b0a65=!![];if(_0x510260!=='*'){var _0x4615b7=_0x510260[_0x2ad7('0x2')]('-');var _0x5d7cb2=_0x4615b7[0x0];var _0x21cdac=_0x4615b7[_0x2ad7('0x1f')]===0x2?_0x4615b7[0x1]:_0x4615b7[0x0];_0x2b0a65=monthCompare(_0x285e11,_0x5d7cb2,_0x21cdac);}return _0xb9f135&&_0x629651&&_0x22a1a0&&_0x2b0a65;}}module[_0x2ad7('0xa')][_0x2ad7('0x21')]=iftime; \ No newline at end of file +var _0x6e60=['min','domCompare','format','MMM','monthCompare','guess','isMoment','split','length','lodash','moment-timezone','map','Interval\x20string\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','includes','dowCompare','date','daysInMonth','max'];(function(_0x45d64d,_0x2f1fb4){var _0x57b89e=function(_0x419693){while(--_0x419693){_0x45d64d['push'](_0x45d64d['shift']());}};_0x57b89e(++_0x2f1fb4);}(_0x6e60,0x1a0));var _0x06e6=function(_0x56bc93,_0x4ffce4){_0x56bc93=_0x56bc93-0x0;var _0x53ee60=_0x6e60[_0x56bc93];return _0x53ee60;};var _=require(_0x06e6('0x0'));var moment=require(_0x06e6('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x06e6('0x2')](function(_0x3fd4db){return _0x3fd4db['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x06e6('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x2a0fd8){if(!_0x2a0fd8[_0x06e6('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x489e9c){var _0x269691=_0x489e9c['split'](':')[_0x06e6('0x2')](function(_0x4dd53f){return parseInt(_0x4dd53f,0xa);});var _0x14c2ee=_0x269691[0x0];var _0x31a7e0=_0x269691[0x1];if(_0x14c2ee<0x0||_0x14c2ee>0x17||_0x31a7e0<0x0||_0x31a7e0>0x3b){throw new Error(EINVALID_DATE);}return[_0x14c2ee,_0x31a7e0];}function circularDoWInterval(_0x2f064b,_0x3897ab){if(_0x2f064b===_0x3897ab){return[_0x2f064b];}else{var _0x549c45=moment['locale']();moment[_0x06e6('0x5')]('en');var _0x449da6=moment[_0x06e6('0x6')]()[_0x06e6('0x2')](function(_0x28b73b){return _0x28b73b[_0x06e6('0x7')]();});moment[_0x06e6('0x5')](_0x549c45);var _0x3b6401=_0x449da6[_0x06e6('0x8')](_0x2f064b);var _0x426d19=_0x449da6[_0x06e6('0x8')](_0x3897ab);if(_0x426d19>_0x3b6401){return _0x449da6['slice'](_0x3b6401,_0x426d19+0x1);}else{var _0x1a41ce=_0x449da6[_0x06e6('0x9')](0x0,_0x426d19+0x1);var _0x1bd85d=_0x449da6['slice'](_0x3b6401);return _0x1bd85d[_0x06e6('0xa')](_0x1a41ce);}}}module[_0x06e6('0xb')][_0x06e6('0xc')]=circularDoWInterval;function circularMonthInterval(_0x451d87,_0x37abef){if(_0x451d87===_0x37abef){return[_0x451d87];}else{var _0x1b0d07=moment[_0x06e6('0x5')]();moment[_0x06e6('0x5')]('en');var _0x383d50=moment['monthsShort']()[_0x06e6('0x2')](function(_0x17d1fc){return _0x17d1fc[_0x06e6('0x7')]();});moment[_0x06e6('0x5')](_0x1b0d07);var _0x173191=_0x383d50['indexOf'](_0x451d87);var _0x77661a=_0x383d50['indexOf'](_0x37abef);if(_0x77661a>_0x173191){return _0x383d50[_0x06e6('0x9')](_0x173191,_0x77661a+0x1);}else{var _0x1c8459=_0x383d50['slice'](0x0,_0x77661a+0x1);var _0x546471=_0x383d50[_0x06e6('0x9')](_0x173191);return _0x546471['concat'](_0x1c8459);}}}module[_0x06e6('0xb')][_0x06e6('0xd')]=circularMonthInterval;function parseDom(_0x10fff8){var _0x442279=parseInt(_0x10fff8,0xa);if(_0x442279<0x1||_0x442279>0x1f){throw new Error(EINVALID_DATE);}return _0x442279;}function timeCompare(_0x28eece,_0x2406bc,_0x3f40bd){var _0x5a6632=_0x28eece[_0x06e6('0xe')]();var _0x4baaad=extractTime(_0x2406bc);var _0x24c2e0=_0x4baaad[0x0];var _0x1f4f34=_0x4baaad[0x1];var _0x47bae3=_0x28eece[_0x06e6('0xe')]()[_0x06e6('0xf')](_0x24c2e0)[_0x06e6('0x10')](_0x1f4f34);throwIfDateNotValid(_0x47bae3);var _0x182363=extractTime(_0x3f40bd);var _0x110f6d=_0x182363[0x0];var _0x2b42ee=_0x182363[0x1];var _0x279cc5=_0x28eece[_0x06e6('0xe')]()['hours'](_0x110f6d)['minutes'](_0x2b42ee);throwIfDateNotValid(_0x279cc5);if(_0x279cc5[_0x06e6('0x11')](_0x47bae3)){var _0x3820b4=_0x5a6632[_0x06e6('0xe')]()[_0x06e6('0x12')]('day');var _0x34cbae=_0x5a6632[_0x06e6('0xe')]()[_0x06e6('0x13')](_0x06e6('0x14'));return _0x5a6632[_0x06e6('0x15')](_0x47bae3,_0x34cbae,undefined,'[]')||_0x5a6632[_0x06e6('0x15')](_0x3820b4,_0x279cc5,undefined,'[]');}else{return _0x5a6632[_0x06e6('0x15')](_0x47bae3,_0x279cc5,undefined,'[]');}}module[_0x06e6('0xb')][_0x06e6('0x16')]=timeCompare;function dowCompare(_0xe6e21e,_0x11263c,_0x20edba){var _0x5d9fa0=_0xe6e21e[_0x06e6('0x5')]('en')['format']('ddd')['toLowerCase']();return circularDoWInterval(_0x11263c,_0x20edba)[_0x06e6('0x17')](_0x5d9fa0);}module[_0x06e6('0xb')][_0x06e6('0x18')]=dowCompare;function domCompare(_0x78f3c6,_0x3710a5,_0x2d4cde){var _0xb50976=_0x78f3c6[_0x06e6('0x19')]();if(_0x3710a5===_0x2d4cde){return _0xb50976===_0x3710a5;}else{var _0x4e27db=_0x78f3c6[_0x06e6('0x1a')]();var _0x3fc642=_0x3710a5<_0x2d4cde;let _0xdc16b2=![];var _0x3175b4=0x0;var _0x36be63=0x0;if(_0x3fc642){_0x3175b4=Math[_0x06e6('0x1b')](0x1,_0x3710a5);_0x36be63=Math[_0x06e6('0x1c')](_0x2d4cde,_0x4e27db);_0xdc16b2=_0xb50976>=_0x3175b4&&_0xb50976<=_0x36be63;}else{_0x3175b4=Math[_0x06e6('0x1c')](_0x3710a5,_0x4e27db);_0x36be63=Math[_0x06e6('0x1b')](0x1,_0x2d4cde);_0xdc16b2=_0xb50976>=_0x3175b4||_0xb50976<=_0x36be63;}return _0xdc16b2;}}module[_0x06e6('0xb')][_0x06e6('0x1d')]=domCompare;function monthCompare(_0x4af9ec,_0x2c07a5,_0x2dc392){var _0x47fe08=_0x4af9ec['locale']('en')[_0x06e6('0x1e')](_0x06e6('0x1f'))['toLowerCase']();return circularMonthInterval(_0x2c07a5,_0x2dc392)[_0x06e6('0x17')](_0x47fe08);}module[_0x06e6('0xb')][_0x06e6('0x20')]=monthCompare;function iftime(_0x1c7157,_0x1266bf=moment['tz'][_0x06e6('0x21')](),_0x38d7ed=moment()){if(!validateRx['test'](_0x1c7157)){throw new Error(EINVALID_STRING);}else{var _0x4bd182=(moment[_0x06e6('0x22')](_0x38d7ed)?_0x38d7ed[_0x06e6('0xe')]():moment(_0x38d7ed))['tz'](_0x1266bf)['locale']('en');throwIfDateNotValid(_0x4bd182);var _0x517bc6=_0x1c7157[_0x06e6('0x23')](',');var _0xa1563a=_0x517bc6[0x0];var _0x4257b3=_0x517bc6[0x1];var _0x2b3eda=_0x517bc6[0x2];var _0x574f2d=_0x517bc6[0x3];let _0x38c3c3=!![];if(_0xa1563a!=='*'){var _0xec9458=_0xa1563a['split']('-');var _0x3cf6d9=_['padStart'](_0xec9458[0x0],0x5,'0');var _0x33a941=_0xec9458['length']===0x2?_['padStart'](_0xec9458[0x1],0x5,'0'):_0x3cf6d9;_0x38c3c3=timeCompare(_0x4bd182,_0x3cf6d9,_0x33a941);}let _0x92e15=!![];if(_0x4257b3!=='*'){var _0x141c3d=_0x4257b3[_0x06e6('0x23')]('-');var _0x49c61a=_0x141c3d[0x0];var _0x59444c=_0x141c3d[_0x06e6('0x24')]===0x2?_0x141c3d[0x1]:_0x49c61a;_0x92e15=dowCompare(_0x4bd182,_0x49c61a,_0x59444c);}let _0x136b78=!![];if(_0x2b3eda!=='*'){var _0x2925cb=_0x2b3eda[_0x06e6('0x23')]('-');var _0x165e13=parseDom(_0x2925cb[0x0]);var _0x21dba9=_0x2925cb[_0x06e6('0x24')]===0x2?parseDom(_0x2925cb[0x1]):_0x165e13;_0x136b78=domCompare(_0x4bd182,_0x165e13,_0x21dba9);}let _0x5a0aae=!![];if(_0x574f2d!=='*'){var _0x4bef6a=_0x574f2d[_0x06e6('0x23')]('-');var _0x59bcaf=_0x4bef6a[0x0];var _0x365de2=_0x4bef6a['length']===0x2?_0x4bef6a[0x1]:_0x4bef6a[0x0];_0x5a0aae=monthCompare(_0x4bd182,_0x59bcaf,_0x365de2);}return _0x38c3c3&&_0x92e15&&_0x136b78&&_0x5a0aae;}}module[_0x06e6('0xb')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index c8f42a2..1ba36e0 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20eb=['util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','length','stringify','level','toUpperCase','transports','Console','Logger','File','error','%s-%s','warn','consoleLogger','fileLogger','path'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x20eb,0xef));var _0xb20e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x20eb[_0x565c49];return _0x20ca34;};'use strict';var path=require(_0xb20e('0x0'));var util=require(_0xb20e('0x1'));var moment=require(_0xb20e('0x2'));var winston=require(_0xb20e('0x3'));var config=require(_0xb20e('0x4'));var debugLevel=config['debugLevel']?config[_0xb20e('0x5')][_0xb20e('0x6')]():_0xb20e('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':_0xb20e('0x8'),'error':'red','warn':_0xb20e('0x9'),'info':_0xb20e('0xa'),'print':_0xb20e('0xb'),'success':_0xb20e('0xc'),'http':_0xb20e('0xd'),'verbose':_0xb20e('0xe'),'debug':_0xb20e('0xf'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x541e76,_0x4a5484,_0x2d41db){var _0x40b21e=_0x541e76||_0xb20e('0x10');return path[_0xb20e('0x11')](_0x40b21e,util[_0xb20e('0x12')](_0xb20e('0x13'),_0x4a5484,_0x2d41db));}function formatter(_0x3333d7,_0x28f4d0){_0x28f4d0[_0xb20e('0x14')]=_0x28f4d0[_0xb20e('0x14')][_0xb20e('0x15')](/@@{/g,_0xb20e('0x16'))[_0xb20e('0x15')](/}@@/g,_0xb20e('0x17'))[_0xb20e('0x15')](/@{/g,'{{')[_0xb20e('0x15')](/}@/g,'}}');return util[_0xb20e('0x12')](_0xb20e('0x18'),moment()[_0xb20e('0x12')](_0xb20e('0x19')),_0x28f4d0['level']['toUpperCase'](),_0x3333d7,_0x28f4d0[_0xb20e('0x14')]);}function fileFormat(_0x4dd077,_0x58e499){_0x58e499['message']=_0x58e499[_0xb20e('0x14')][_0xb20e('0x15')](/@@{/g,_0xb20e('0x16'))[_0xb20e('0x15')](/}@@/g,_0xb20e('0x17'))['replace'](/@{/g,'{{')[_0xb20e('0x15')](/}@/g,'}}');var _0x308801=_0x58e499[_0xb20e('0x1a')]&&Object['keys'](_0x58e499[_0xb20e('0x1a')])[_0xb20e('0x1b')]?'\x0a\x09'+JSON[_0xb20e('0x1c')](_0x58e499[_0xb20e('0x1a')]):'';return util[_0xb20e('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x58e499[_0xb20e('0x1d')][_0xb20e('0x1e')](),_0x4dd077,_0x58e499['message'],_0x308801);}function consoleLogger(){var _0xe7991c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb20e('0x1f'))][(_0xb20e('0x20'))]({'level':'warn','json':![],'formatter':function(_0x34a373){return formatter('',_0x34a373);}})]});return _0xe7991c;}function fileLogger(_0x283410,_0x40f812){var _0xf1ab13=new winston[(_0xb20e('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xb20e('0x22'))]({'name':util['format']('%s-%s',_0x283410,_0xb20e('0x23')),'filename':getLogFileName(_0x40f812,_0x283410,_0xb20e('0x23')),'level':_0xb20e('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4a86d9){return fileFormat(_0x283410,_0x4a86d9);}}),new winston[(_0xb20e('0x1f'))][(_0xb20e('0x22'))]({'name':util[_0xb20e('0x12')](_0xb20e('0x24'),_0x283410,debugLevel),'filename':getLogFileName(_0x40f812,_0x283410,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x309e51){return fileFormat(_0x283410,_0x309e51);}}),new winston['transports'][(_0xb20e('0x20'))]({'level':_0xb20e('0x25'),'json':![],'formatter':function(_0x32bdaf){return fileFormat(_0x283410,_0x32bdaf);}})]});return _0xf1ab13;}exports[_0xb20e('0x26')]=consoleLogger;exports[_0xb20e('0x27')]=fileLogger; \ No newline at end of file +var _0xb65a=['toUpperCase','message','}}}','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','%s-%s','error','fileLogger','path','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','replace','{{{','format','YYYY-MM-DD\x20HH:mm:ss','level'];(function(_0x28d371,_0x559ac1){var _0x18aab6=function(_0xb1ff47){while(--_0xb1ff47){_0x28d371['push'](_0x28d371['shift']());}};_0x18aab6(++_0x559ac1);}(_0xb65a,0x1f0));var _0xab65=function(_0x26b9af,_0x1d9a8f){_0x26b9af=_0x26b9af-0x0;var _0x13d125=_0xb65a[_0x26b9af];return _0x13d125;};'use strict';var path=require(_0xab65('0x0'));var util=require('util');var moment=require(_0xab65('0x1'));var winston=require('winston');var config=require(_0xab65('0x2'));var debugLevel=config[_0xab65('0x3')]?config['debugLevel'][_0xab65('0x4')]():_0xab65('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xab65('0x6'),'error':_0xab65('0x7'),'warn':_0xab65('0x8'),'info':_0xab65('0x9'),'print':'bold\x20white','success':'bold\x20green','http':'gray','verbose':_0xab65('0xa'),'debug':_0xab65('0xb'),'silly':_0xab65('0xc')};winston[_0xab65('0xd')](XC_LOG_COLORS);function getLogFileName(_0x66a7ec,_0xcabb98,_0x107e34){var _0x4ac9aa=_0x66a7ec||_0xab65('0xe');return path[_0xab65('0xf')](_0x4ac9aa,util['format'](_0xab65('0x10'),_0xcabb98,_0x107e34));}function formatter(_0x4456ff,_0x2c1955){_0x2c1955['message']=_0x2c1955['message'][_0xab65('0x11')](/@@{/g,_0xab65('0x12'))[_0xab65('0x11')](/}@@/g,'}}}')[_0xab65('0x11')](/@{/g,'{{')[_0xab65('0x11')](/}@/g,'}}');return util[_0xab65('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xab65('0x13')](_0xab65('0x14')),_0x2c1955[_0xab65('0x15')][_0xab65('0x16')](),_0x4456ff,_0x2c1955[_0xab65('0x17')]);}function fileFormat(_0x3621ee,_0x884dc2){_0x884dc2[_0xab65('0x17')]=_0x884dc2['message']['replace'](/@@{/g,_0xab65('0x12'))[_0xab65('0x11')](/}@@/g,_0xab65('0x18'))[_0xab65('0x11')](/@{/g,'{{')[_0xab65('0x11')](/}@/g,'}}');var _0x239735=_0x884dc2[_0xab65('0x19')]&&Object[_0xab65('0x1a')](_0x884dc2[_0xab65('0x19')])[_0xab65('0x1b')]?'\x0a\x09'+JSON[_0xab65('0x1c')](_0x884dc2[_0xab65('0x19')]):'';return util[_0xab65('0x13')](_0xab65('0x1d'),moment()['format'](_0xab65('0x14')),_0x884dc2['level'][_0xab65('0x16')](),_0x3621ee,_0x884dc2[_0xab65('0x17')],_0x239735);}function consoleLogger(){var _0xad0cbe=new winston[(_0xab65('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xab65('0x1f'))][(_0xab65('0x20'))]({'level':_0xab65('0x21'),'json':![],'formatter':function(_0x12b965){return formatter('',_0x12b965);}})]});return _0xad0cbe;}function fileLogger(_0x46aef3,_0x3b0daf){var _0x4693c6=new winston[(_0xab65('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xab65('0x1f'))]['File']({'name':util['format'](_0xab65('0x22'),_0x46aef3,_0xab65('0x23')),'filename':getLogFileName(_0x3b0daf,_0x46aef3,'error'),'level':_0xab65('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58dd42){return fileFormat(_0x46aef3,_0x58dd42);}}),new winston[(_0xab65('0x1f'))]['File']({'name':util[_0xab65('0x13')](_0xab65('0x22'),_0x46aef3,debugLevel),'filename':getLogFileName(_0x3b0daf,_0x46aef3,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x78b917){return fileFormat(_0x46aef3,_0x78b917);}}),new winston[(_0xab65('0x1f'))][(_0xab65('0x20'))]({'level':'warn','json':![],'formatter':function(_0x3121d2){return fileFormat(_0x46aef3,_0x3121d2);}})]});return _0x4693c6;}exports['consoleLogger']=consoleLogger;exports[_0xab65('0x24')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 1e2634b..6bf9d29 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 _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x34419d,_0x35dc99){var _0x3989af=function(_0x3416a0){while(--_0x3416a0){_0x34419d['push'](_0x34419d['shift']());}};_0x3989af(++_0x35dc99);}(_0x2ef3,0xba));var _0x32ef=function(_0x27ef21,_0x5d0828){_0x27ef21=_0x27ef21-0x0;var _0x4483bd=_0x2ef3[_0x27ef21];return _0x4483bd;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x1967,0x173));var _0x7196=function(_0x3a6794,_0x2d8418){_0x3a6794=_0x3a6794-0x0;var _0x499a73=_0x1967[_0x3a6794];return _0x499a73;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 0a86d87..4c2b5c9 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 _0xed3c=['{\x20{\x20','\x20}\x20}','string','replace','isPlainObject','keys','reduce','safeTemplate','lodash'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xed3c,0x1a6));var _0xced3=function(_0x22df9f,_0x9ec477){_0x22df9f=_0x22df9f-0x0;var _0x4ed906=_0xed3c[_0x22df9f];return _0x4ed906;};var _=require(_0xced3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x408853){return _0x408853==='{{'?_0xced3('0x1'):_0xced3('0x2');}function safeTemplate(_0x558ee8){var _0xfdc1ed=_0x558ee8;if(typeof _0x558ee8===_0xced3('0x3')){_0xfdc1ed=_0x558ee8[_0xced3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x558ee8)){_0xfdc1ed=_0x558ee8['map'](function(_0x3d3aa0){return safeTemplate(_0x3d3aa0);});}else if(_[_0xced3('0x5')](_0x558ee8)){_0xfdc1ed=Object[_0xced3('0x6')](_0x558ee8)[_0xced3('0x7')](function(_0x4795cd,_0x510164){_0x4795cd[_0x510164]=safeTemplate(_0x558ee8[_0x510164]);return _0x4795cd;},{});}return _0xfdc1ed;}module['exports'][_0xced3('0x8')]=safeTemplate; \ No newline at end of file +var _0xf7b4=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}'];(function(_0x5408f3,_0x567a87){var _0x317d70=function(_0x5d58ef){while(--_0x5d58ef){_0x5408f3['push'](_0x5408f3['shift']());}};_0x317d70(++_0x567a87);}(_0xf7b4,0x152));var _0x4f7b=function(_0x709dc6,_0xcc0527){_0x709dc6=_0x709dc6-0x0;var _0x13cecd=_0xf7b4[_0x709dc6];return _0x13cecd;};var _=require(_0x4f7b('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5579ed){return _0x5579ed==='{{'?'{\x20{\x20':_0x4f7b('0x1');}function safeTemplate(_0x103165){var _0x50ea23=_0x103165;if(typeof _0x103165==='string'){_0x50ea23=_0x103165[_0x4f7b('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4f7b('0x3')](_0x103165)){_0x50ea23=_0x103165[_0x4f7b('0x4')](function(_0x44f991){return safeTemplate(_0x44f991);});}else if(_[_0x4f7b('0x5')](_0x103165)){_0x50ea23=Object[_0x4f7b('0x6')](_0x103165)[_0x4f7b('0x7')](function(_0x3ad135,_0x173784){_0x3ad135[_0x173784]=safeTemplate(_0x103165[_0x173784]);return _0x3ad135;},{});}return _0x50ea23;}module[_0x4f7b('0x8')][_0x4f7b('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 19b099b..cf8df7f 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd35d=['fs-extra','path','../config/environment','root','resolve','legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','string','then','info','Updating\x20app.json','writeJSON','exports'];(function(_0x1bedb6,_0xfef025){var _0x2f5c38=function(_0x3961e5){while(--_0x3961e5){_0x1bedb6['push'](_0x1bedb6['shift']());}};_0x2f5c38(++_0xfef025);}(_0xd35d,0xb4));var _0xdd35=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xd35d[_0x3740fe];return _0x55492b;};var fs=require(_0xdd35('0x0'));var path=require(_0xdd35('0x1'));var config=require(_0xdd35('0x2'));var root=config[_0xdd35('0x3')];var APP_JSON_PATH=path[_0xdd35('0x4')](root,'server/app.json');var NODEPATH=path[_0xdd35('0x4')](root,_0xdd35('0x5'));function setLegacyLibsNodeEnvPath(_0x187e36){let _0x37fe3b=![];if(Array['isArray'](_0x187e36[_0xdd35('0x6')])){var _0x275981=_0x187e36[_0xdd35('0x6')][_0xdd35('0x7')](function(_0x2f9168){return _0x2f9168[_0xdd35('0x8')]===_0xdd35('0x9');});if(_0x275981>-0x1){var _0x1c53d2=_0x187e36[_0xdd35('0x6')][_0x275981];if(typeof _0x1c53d2[_0xdd35('0xa')][_0xdd35('0xb')]!==_0xdd35('0xc')){_0x1c53d2['env'][_0xdd35('0xb')]=NODEPATH;_0x37fe3b=!![];}}return{'appConfig':_0x187e36,'updated':_0x37fe3b};}}function updateAppConfig(_0x50e76b){return fs['pathExists'](APP_JSON_PATH)[_0xdd35('0xd')](function(_0x25871f){if(_0x25871f){return fs['readJSON'](APP_JSON_PATH)[_0xdd35('0xd')](function(_0x267749){var _0x452c3b=setLegacyLibsNodeEnvPath(_0x267749);if(_0x452c3b['updated']){_0x50e76b[_0xdd35('0xe')](_0xdd35('0xf'));return fs[_0xdd35('0x10')](APP_JSON_PATH,_0x267749,{'spaces':0x2});}else{return Promise[_0xdd35('0x4')]();}});}else{return Promise[_0xdd35('0x4')]();}});}module[_0xdd35('0x11')]=updateAppConfig; \ No newline at end of file +var _0x28e0=['findIndex','name','motion2','env','NODE_PATH','then','readJSON','info','Updating\x20app.json','writeJSON','path','../config/environment','root','resolve','isArray','apps'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x28e0,0x16a));var _0x028e=function(_0x5baa6d,_0x32779d){_0x5baa6d=_0x5baa6d-0x0;var _0xef22e2=_0x28e0[_0x5baa6d];return _0xef22e2;};var fs=require('fs-extra');var path=require(_0x028e('0x0'));var config=require(_0x028e('0x1'));var root=config[_0x028e('0x2')];var APP_JSON_PATH=path[_0x028e('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4308e3){let _0x341ebf=![];if(Array[_0x028e('0x4')](_0x4308e3['apps'])){var _0x4e0654=_0x4308e3[_0x028e('0x5')][_0x028e('0x6')](function(_0x1ba026){return _0x1ba026[_0x028e('0x7')]===_0x028e('0x8');});if(_0x4e0654>-0x1){var _0x4973c4=_0x4308e3[_0x028e('0x5')][_0x4e0654];if(typeof _0x4973c4['env']['NODE_PATH']!=='string'){_0x4973c4[_0x028e('0x9')][_0x028e('0xa')]=NODEPATH;_0x341ebf=!![];}}return{'appConfig':_0x4308e3,'updated':_0x341ebf};}}function updateAppConfig(_0x41070f){return fs['pathExists'](APP_JSON_PATH)[_0x028e('0xb')](function(_0x44f94f){if(_0x44f94f){return fs[_0x028e('0xc')](APP_JSON_PATH)[_0x028e('0xb')](function(_0x451ab9){var _0x379157=setLegacyLibsNodeEnvPath(_0x451ab9);if(_0x379157['updated']){_0x41070f[_0x028e('0xd')](_0x028e('0xe'));return fs[_0x028e('0xf')](APP_JSON_PATH,_0x451ab9,{'spaces':0x2});}else{return Promise[_0x028e('0x3')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file